From: Cris Di Sclafani Date: Fri, 29 Jan 2021 14:28:31 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.14 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=ea2785ac57a8ccb2d5ad2ad79966f30221e6c57e;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4cd4fbc..554cbb5 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T14:19:45.830Z", "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 9a39f29..e91158c 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 _0x932e=['sequelize','exports','INTEGER'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x932e,0xfc));var _0xe932=function(_0x5a6595,_0x49bae9){_0x5a6595=_0x5a6595-0x0;var _0x57fa63=_0x932e[_0x5a6595];return _0x57fa63;};'use strict';var Sequelize=require(_0xe932('0x0'));module[_0xe932('0x1')]={'ChatInteractionId':{'type':Sequelize[_0xe932('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xe932('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xb463=['INTEGER','sequelize'];(function(_0x56b678,_0x5e39de){var _0x4a38b2=function(_0x16fa39){while(--_0x16fa39){_0x56b678['push'](_0x56b678['shift']());}};_0x4a38b2(++_0x5e39de);}(_0xb463,0x17f));var _0x3b46=function(_0x21b9fe,_0x4a505a){_0x21b9fe=_0x21b9fe-0x0;var _0x5da6b0=_0xb463[_0x21b9fe];return _0x5da6b0;};'use strict';var Sequelize=require(_0x3b46('0x0'));module['exports']={'ChatInteractionId':{'type':Sequelize[_0x3b46('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x3b46('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index acefce5..73bca30 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 _0xcc65=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','UserChatInteractions','UserProfileResource','error','stack','name','send','index','map','UserChatInteraction','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','pick','merge','VIRTUAL','filter','options','where','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xcc65,0x1e3));var _0x5cc6=function(_0x5936c8,_0x5731e9){_0x5936c8=_0x5936c8-0x0;var _0x1dff51=_0xcc65[_0x5936c8];return _0x1dff51;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5cc6('0x0'));var rimraf=require(_0x5cc6('0x1'));var zipdir=require(_0x5cc6('0x2'));var jsonpatch=require(_0x5cc6('0x3'));var rp=require(_0x5cc6('0x4'));var moment=require(_0x5cc6('0x5'));var BPromise=require(_0x5cc6('0x6'));var Mustache=require(_0x5cc6('0x7'));var util=require(_0x5cc6('0x8'));var path=require(_0x5cc6('0x9'));var sox=require(_0x5cc6('0xa'));var csv=require(_0x5cc6('0xb'));var ejs=require(_0x5cc6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5cc6('0xd'));var crypto=require('crypto');var jsforce=require(_0x5cc6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5cc6('0xf'));var Papa=require(_0x5cc6('0x10'));var Redis=require('ioredis');var authService=require(_0x5cc6('0x11'));var qs=require(_0x5cc6('0x12'));var as=require(_0x5cc6('0x13'));var hardwareService=require(_0x5cc6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5cc6('0x15'));var config=require(_0x5cc6('0x16'));var licenseUtil=require(_0x5cc6('0x17'));var db=require(_0x5cc6('0x18'))['db'];function respondWithStatusCode(_0x6cebf8,_0x179d9f){_0x179d9f=_0x179d9f||0xcc;return function(_0x7697fc){if(_0x7697fc){return _0x6cebf8[_0x5cc6('0x19')](_0x179d9f);}return _0x6cebf8[_0x5cc6('0x1a')](_0x179d9f)[_0x5cc6('0x1b')]();};}function respondWithResult(_0x148142,_0x2c642c){_0x2c642c=_0x2c642c||0xc8;return function(_0x26aa26){if(_0x26aa26){return _0x148142[_0x5cc6('0x1a')](_0x2c642c)[_0x5cc6('0x1c')](_0x26aa26);}};}function respondWithFilteredResult(_0x4a43f3,_0x5eb3ec){return function(_0x4c50ba){if(_0x4c50ba){var _0x16ca41=_0x4c50ba[_0x5cc6('0x1d')],_0x10e3ff=_0x5eb3ec['offset'],_0x58db40=_0x5eb3ec[_0x5cc6('0x1e')]+_0x5eb3ec[_0x5cc6('0x1f')],_0x44748d;if(_0x58db40>=_0x16ca41){_0x58db40=_0x16ca41;_0x44748d=0xc8;}else{_0x44748d=0xce;}_0x4a43f3[_0x5cc6('0x1a')](_0x44748d);return _0x4a43f3[_0x5cc6('0x20')](_0x5cc6('0x21'),_0x10e3ff+'-'+_0x58db40+'/'+_0x16ca41)[_0x5cc6('0x1c')](_0x4c50ba);}return null;};}function patchUpdates(_0xc7fe86){return function(_0x437032){try{jsonpatch['apply'](_0x437032,_0xc7fe86,!![]);}catch(_0x1adedf){return BPromise[_0x5cc6('0x22')](_0x1adedf);}return _0x437032[_0x5cc6('0x23')]();};}function saveUpdates(_0x5ea31c,_0x5e09a4){return function(_0x277970){if(_0x277970){return _0x277970['update'](_0x5ea31c)[_0x5cc6('0x24')](function(_0x2b044b){return _0x2b044b;});}return null;};}function removeEntity(_0x4cfbc7,_0x5cdbab){return function(_0x5aaea9){if(_0x5aaea9){return _0x5aaea9[_0x5cc6('0x25')]()[_0x5cc6('0x24')](function(){var _0x455a69=_0x5aaea9[_0x5cc6('0x26')]({'plain':!![]});var _0x16a3ac=_0x5cc6('0x27');return db[_0x5cc6('0x28')][_0x5cc6('0x25')]({'where':{'type':_0x16a3ac,'resourceId':_0x455a69['id']}})[_0x5cc6('0x24')](function(){return _0x5aaea9;});})[_0x5cc6('0x24')](function(){_0x4cfbc7['status'](0xcc)[_0x5cc6('0x1b')]();});}};}function handleEntityNotFound(_0x287a37,_0x585849){return function(_0x261326){if(!_0x261326){_0x287a37[_0x5cc6('0x19')](0x194);}return _0x261326;};}function handleError(_0x45dd0b,_0x5cf3a8){_0x5cf3a8=_0x5cf3a8||0x1f4;return function(_0x136f8a){logger[_0x5cc6('0x29')](_0x136f8a[_0x5cc6('0x2a')]);if(_0x136f8a[_0x5cc6('0x2b')]){delete _0x136f8a[_0x5cc6('0x2b')];}_0x45dd0b['status'](_0x5cf3a8)[_0x5cc6('0x2c')](_0x136f8a);};}exports[_0x5cc6('0x2d')]=function(_0x586632,_0x2f760a){var _0x17e3d2={},_0x803dc3={},_0x260f93={'count':0x0,'rows':[]};var _0x2217d5=_[_0x5cc6('0x2e')](db[_0x5cc6('0x2f')]['rawAttributes'],function(_0xfcee59){return{'name':_0xfcee59['fieldName'],'type':_0xfcee59[_0x5cc6('0x30')][_0x5cc6('0x31')]};});_0x803dc3[_0x5cc6('0x32')]=_['map'](_0x2217d5,'name');_0x803dc3[_0x5cc6('0x33')]=_[_0x5cc6('0x34')](_0x586632[_0x5cc6('0x33')]);_0x803dc3[_0x5cc6('0x35')]=_[_0x5cc6('0x36')](_0x803dc3[_0x5cc6('0x32')],_0x803dc3['query']);_0x17e3d2['attributes']=_[_0x5cc6('0x36')](_0x803dc3[_0x5cc6('0x32')],qs[_0x5cc6('0x37')](_0x586632[_0x5cc6('0x33')]['fields']));_0x17e3d2['attributes']=_0x17e3d2[_0x5cc6('0x38')]['length']?_0x17e3d2[_0x5cc6('0x38')]:_0x803dc3[_0x5cc6('0x32')];if(!_0x586632[_0x5cc6('0x33')]['hasOwnProperty']('nolimit')){_0x17e3d2[_0x5cc6('0x1f')]=qs[_0x5cc6('0x1f')](_0x586632[_0x5cc6('0x33')][_0x5cc6('0x1f')]);_0x17e3d2[_0x5cc6('0x1e')]=qs[_0x5cc6('0x1e')](_0x586632[_0x5cc6('0x33')][_0x5cc6('0x1e')]);}_0x17e3d2[_0x5cc6('0x39')]=qs[_0x5cc6('0x3a')](_0x586632[_0x5cc6('0x33')][_0x5cc6('0x3a')]);_0x17e3d2['where']=qs[_0x5cc6('0x35')](_[_0x5cc6('0x3b')](_0x586632[_0x5cc6('0x33')],_0x803dc3[_0x5cc6('0x35')]),_0x2217d5);if(_0x586632['query']['filter']){_0x17e3d2['where']=_[_0x5cc6('0x3c')](_0x17e3d2['where'],{'$or':_[_0x5cc6('0x2e')](_0x2217d5,function(_0x3c9ee4){if(_0x3c9ee4[_0x5cc6('0x30')]!==_0x5cc6('0x3d')){var _0x51bad0={};_0x51bad0[_0x3c9ee4[_0x5cc6('0x2b')]]={'$like':'%'+_0x586632[_0x5cc6('0x33')][_0x5cc6('0x3e')]+'%'};return _0x51bad0;}})});}_0x17e3d2=_[_0x5cc6('0x3c')]({},_0x17e3d2,_0x586632[_0x5cc6('0x3f')]);var _0x17674d={'where':_0x17e3d2[_0x5cc6('0x40')]};return db[_0x5cc6('0x2f')][_0x5cc6('0x1d')](_0x17674d)[_0x5cc6('0x24')](function(_0x1b2474){_0x260f93[_0x5cc6('0x1d')]=_0x1b2474;if(_0x586632['query']['includeAll']){_0x17e3d2[_0x5cc6('0x41')]=[{'all':!![]}];}return db['UserChatInteraction'][_0x5cc6('0x42')](_0x17e3d2);})[_0x5cc6('0x24')](function(_0x124118){_0x260f93[_0x5cc6('0x43')]=_0x124118;return _0x260f93;})[_0x5cc6('0x24')](respondWithFilteredResult(_0x2f760a,_0x17e3d2))[_0x5cc6('0x44')](handleError(_0x2f760a,null));};exports[_0x5cc6('0x45')]=function(_0x4e7757,_0x308b81){var _0xec37b5={'raw':!![],'where':{'id':_0x4e7757[_0x5cc6('0x46')]['id']}},_0x18dabe={};_0x18dabe[_0x5cc6('0x32')]=_[_0x5cc6('0x34')](db[_0x5cc6('0x2f')]['rawAttributes']);_0x18dabe[_0x5cc6('0x33')]=_['keys'](_0x4e7757['query']);_0x18dabe[_0x5cc6('0x35')]=_[_0x5cc6('0x36')](_0x18dabe['model'],_0x18dabe[_0x5cc6('0x33')]);_0xec37b5[_0x5cc6('0x38')]=_[_0x5cc6('0x36')](_0x18dabe[_0x5cc6('0x32')],qs[_0x5cc6('0x37')](_0x4e7757[_0x5cc6('0x33')][_0x5cc6('0x37')]));_0xec37b5[_0x5cc6('0x38')]=_0xec37b5['attributes']['length']?_0xec37b5[_0x5cc6('0x38')]:_0x18dabe[_0x5cc6('0x32')];if(_0x4e7757[_0x5cc6('0x33')][_0x5cc6('0x47')]){_0xec37b5['include']=[{'all':!![]}];}_0xec37b5=_[_0x5cc6('0x3c')]({},_0xec37b5,_0x4e7757['options']);return db[_0x5cc6('0x2f')][_0x5cc6('0x48')](_0xec37b5)[_0x5cc6('0x24')](handleEntityNotFound(_0x308b81,null))['then'](respondWithResult(_0x308b81,null))['catch'](handleError(_0x308b81,null));};exports[_0x5cc6('0x49')]=function(_0x38fc28,_0x5f7046){return db[_0x5cc6('0x2f')][_0x5cc6('0x49')](_0x38fc28[_0x5cc6('0x4a')],{})['then'](function(_0x66f38d){var _0x1811d8=_0x38fc28[_0x5cc6('0x4b')][_0x5cc6('0x26')]({'plain':!![]});if(!_0x1811d8)throw new Error(_0x5cc6('0x4c'));if(_0x1811d8[_0x5cc6('0x4d')]==='user'){var _0x80f271=_0x66f38d['get']({'plain':!![]});var _0x20bd26=_0x5cc6('0x27');return db[_0x5cc6('0x4e')][_0x5cc6('0x48')]({'where':{'name':_0x20bd26,'userProfileId':_0x1811d8[_0x5cc6('0x4f')]},'raw':!![]})[_0x5cc6('0x24')](function(_0x141222){if(_0x141222&&_0x141222[_0x5cc6('0x50')]===0x0){return db[_0x5cc6('0x28')]['create']({'name':_0x80f271[_0x5cc6('0x2b')],'resourceId':_0x80f271['id'],'type':_0x141222[_0x5cc6('0x2b')],'sectionId':_0x141222['id']},{})[_0x5cc6('0x24')](function(){return _0x66f38d;});}else{return _0x66f38d;}})[_0x5cc6('0x44')](function(_0x29d53f){logger['error'](_0x5cc6('0x51'),_0x29d53f);throw _0x29d53f;});}return _0x66f38d;})['then'](respondWithResult(_0x5f7046,0xc9))[_0x5cc6('0x44')](handleError(_0x5f7046,null));};exports[_0x5cc6('0x52')]=function(_0x5dddf9,_0x1230d0){if(_0x5dddf9['body']['id']){delete _0x5dddf9['body']['id'];}return db['UserChatInteraction'][_0x5cc6('0x48')]({'where':{'id':_0x5dddf9[_0x5cc6('0x46')]['id']}})[_0x5cc6('0x24')](handleEntityNotFound(_0x1230d0,null))[_0x5cc6('0x24')](saveUpdates(_0x5dddf9['body'],null))[_0x5cc6('0x24')](respondWithResult(_0x1230d0,null))[_0x5cc6('0x44')](handleError(_0x1230d0,null));};exports[_0x5cc6('0x25')]=function(_0x2e0fe4,_0x166f07){return db[_0x5cc6('0x2f')]['find']({'where':{'id':_0x2e0fe4[_0x5cc6('0x46')]['id']}})[_0x5cc6('0x24')](handleEntityNotFound(_0x166f07,null))[_0x5cc6('0x24')](removeEntity(_0x166f07,null))[_0x5cc6('0x44')](handleError(_0x166f07,null));}; \ No newline at end of file +var _0xff47=['includeAll','findAll','rows','show','params','UserChatInteraction','rawAttributes','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','options','count'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xff47,0x15c));var _0x7ff4=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xff47[_0x37e886];return _0x57c5cd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7ff4('0x0'));var zipdir=require(_0x7ff4('0x1'));var jsonpatch=require(_0x7ff4('0x2'));var rp=require(_0x7ff4('0x3'));var moment=require(_0x7ff4('0x4'));var BPromise=require(_0x7ff4('0x5'));var Mustache=require(_0x7ff4('0x6'));var util=require('util');var path=require(_0x7ff4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ff4('0x8'));var jsforce=require(_0x7ff4('0x9'));var deskjs=require(_0x7ff4('0xa'));var toCsv=require(_0x7ff4('0xb'));var querystring=require(_0x7ff4('0xc'));var Papa=require(_0x7ff4('0xd'));var Redis=require(_0x7ff4('0xe'));var authService=require(_0x7ff4('0xf'));var qs=require(_0x7ff4('0x10'));var as=require(_0x7ff4('0x11'));var hardwareService=require(_0x7ff4('0x12'));var logger=require(_0x7ff4('0x13'))(_0x7ff4('0x14'));var utils=require(_0x7ff4('0x15'));var config=require(_0x7ff4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ff4('0x17'))['db'];function respondWithStatusCode(_0x2a4ce7,_0x149aa5){_0x149aa5=_0x149aa5||0xcc;return function(_0x16ed6f){if(_0x16ed6f){return _0x2a4ce7[_0x7ff4('0x18')](_0x149aa5);}return _0x2a4ce7[_0x7ff4('0x19')](_0x149aa5)['end']();};}function respondWithResult(_0x526d04,_0x2f1af0){_0x2f1af0=_0x2f1af0||0xc8;return function(_0xdecad3){if(_0xdecad3){return _0x526d04[_0x7ff4('0x19')](_0x2f1af0)[_0x7ff4('0x1a')](_0xdecad3);}};}function respondWithFilteredResult(_0x46912b,_0x197001){return function(_0xf950b7){if(_0xf950b7){var _0x2d28f1=_0xf950b7['count'],_0x3ae6b3=_0x197001[_0x7ff4('0x1b')],_0x3a0168=_0x197001[_0x7ff4('0x1b')]+_0x197001['limit'],_0x41b58d;if(_0x3a0168>=_0x2d28f1){_0x3a0168=_0x2d28f1;_0x41b58d=0xc8;}else{_0x41b58d=0xce;}_0x46912b['status'](_0x41b58d);return _0x46912b[_0x7ff4('0x1c')](_0x7ff4('0x1d'),_0x3ae6b3+'-'+_0x3a0168+'/'+_0x2d28f1)['json'](_0xf950b7);}return null;};}function patchUpdates(_0x3d78ab){return function(_0x4f9da7){try{jsonpatch[_0x7ff4('0x1e')](_0x4f9da7,_0x3d78ab,!![]);}catch(_0x16390d){return BPromise[_0x7ff4('0x1f')](_0x16390d);}return _0x4f9da7[_0x7ff4('0x20')]();};}function saveUpdates(_0x4ad58f,_0x18bf55){return function(_0x1fb7aa){if(_0x1fb7aa){return _0x1fb7aa[_0x7ff4('0x21')](_0x4ad58f)[_0x7ff4('0x22')](function(_0xc4b4e8){return _0xc4b4e8;});}return null;};}function removeEntity(_0x548071,_0x224ab7){return function(_0xe5f150){if(_0xe5f150){return _0xe5f150[_0x7ff4('0x23')]()['then'](function(){var _0x5e1798=_0xe5f150[_0x7ff4('0x24')]({'plain':!![]});var _0x4bbfa='UserChatInteractions';return db['UserProfileResource'][_0x7ff4('0x23')]({'where':{'type':_0x4bbfa,'resourceId':_0x5e1798['id']}})[_0x7ff4('0x22')](function(){return _0xe5f150;});})[_0x7ff4('0x22')](function(){_0x548071[_0x7ff4('0x19')](0xcc)[_0x7ff4('0x25')]();});}};}function handleEntityNotFound(_0x1892d4,_0x3aae44){return function(_0x432d72){if(!_0x432d72){_0x1892d4[_0x7ff4('0x18')](0x194);}return _0x432d72;};}function handleError(_0x2e3d10,_0x4f4054){_0x4f4054=_0x4f4054||0x1f4;return function(_0x331fc4){logger[_0x7ff4('0x26')](_0x331fc4[_0x7ff4('0x27')]);if(_0x331fc4[_0x7ff4('0x28')]){delete _0x331fc4['name'];}_0x2e3d10[_0x7ff4('0x19')](_0x4f4054)[_0x7ff4('0x29')](_0x331fc4);};}exports['index']=function(_0x1f9114,_0x2d5025){var _0x49eea7={},_0x36d20e={},_0x5c9f88={'count':0x0,'rows':[]};var _0x345f4f=_[_0x7ff4('0x2a')](db['UserChatInteraction']['rawAttributes'],function(_0x18e98b){return{'name':_0x18e98b[_0x7ff4('0x2b')],'type':_0x18e98b[_0x7ff4('0x2c')][_0x7ff4('0x2d')]};});_0x36d20e[_0x7ff4('0x2e')]=_[_0x7ff4('0x2a')](_0x345f4f,_0x7ff4('0x28'));_0x36d20e[_0x7ff4('0x2f')]=_['keys'](_0x1f9114[_0x7ff4('0x2f')]);_0x36d20e[_0x7ff4('0x30')]=_[_0x7ff4('0x31')](_0x36d20e[_0x7ff4('0x2e')],_0x36d20e[_0x7ff4('0x2f')]);_0x49eea7[_0x7ff4('0x32')]=_[_0x7ff4('0x31')](_0x36d20e['model'],qs['fields'](_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x33')]));_0x49eea7['attributes']=_0x49eea7[_0x7ff4('0x32')][_0x7ff4('0x34')]?_0x49eea7[_0x7ff4('0x32')]:_0x36d20e[_0x7ff4('0x2e')];if(!_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x35')]('nolimit')){_0x49eea7[_0x7ff4('0x36')]=qs[_0x7ff4('0x36')](_0x1f9114[_0x7ff4('0x2f')]['limit']);_0x49eea7[_0x7ff4('0x1b')]=qs[_0x7ff4('0x1b')](_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x1b')]);}_0x49eea7[_0x7ff4('0x37')]=qs['sort'](_0x1f9114['query'][_0x7ff4('0x38')]);_0x49eea7[_0x7ff4('0x39')]=qs['filters'](_['pick'](_0x1f9114[_0x7ff4('0x2f')],_0x36d20e[_0x7ff4('0x30')]),_0x345f4f);if(_0x1f9114[_0x7ff4('0x2f')][_0x7ff4('0x3a')]){_0x49eea7['where']=_[_0x7ff4('0x3b')](_0x49eea7[_0x7ff4('0x39')],{'$or':_[_0x7ff4('0x2a')](_0x345f4f,function(_0x4c8289){if(_0x4c8289[_0x7ff4('0x2c')]!=='VIRTUAL'){var _0x168a25={};_0x168a25[_0x4c8289[_0x7ff4('0x28')]]={'$like':'%'+_0x1f9114['query'][_0x7ff4('0x3a')]+'%'};return _0x168a25;}})});}_0x49eea7=_[_0x7ff4('0x3b')]({},_0x49eea7,_0x1f9114[_0x7ff4('0x3c')]);var _0x1e4fa8={'where':_0x49eea7[_0x7ff4('0x39')]};return db['UserChatInteraction']['count'](_0x1e4fa8)[_0x7ff4('0x22')](function(_0x33b0f9){_0x5c9f88[_0x7ff4('0x3d')]=_0x33b0f9;if(_0x1f9114['query'][_0x7ff4('0x3e')]){_0x49eea7['include']=[{'all':!![]}];}return db['UserChatInteraction'][_0x7ff4('0x3f')](_0x49eea7);})['then'](function(_0x20113d){_0x5c9f88[_0x7ff4('0x40')]=_0x20113d;return _0x5c9f88;})[_0x7ff4('0x22')](respondWithFilteredResult(_0x2d5025,_0x49eea7))['catch'](handleError(_0x2d5025,null));};exports[_0x7ff4('0x41')]=function(_0x765c69,_0x542377){var _0x3c4153={'raw':!![],'where':{'id':_0x765c69[_0x7ff4('0x42')]['id']}},_0x27e4df={};_0x27e4df[_0x7ff4('0x2e')]=_['keys'](db[_0x7ff4('0x43')][_0x7ff4('0x44')]);_0x27e4df['query']=_[_0x7ff4('0x45')](_0x765c69[_0x7ff4('0x2f')]);_0x27e4df[_0x7ff4('0x30')]=_[_0x7ff4('0x31')](_0x27e4df[_0x7ff4('0x2e')],_0x27e4df[_0x7ff4('0x2f')]);_0x3c4153['attributes']=_[_0x7ff4('0x31')](_0x27e4df[_0x7ff4('0x2e')],qs[_0x7ff4('0x33')](_0x765c69[_0x7ff4('0x2f')]['fields']));_0x3c4153[_0x7ff4('0x32')]=_0x3c4153[_0x7ff4('0x32')][_0x7ff4('0x34')]?_0x3c4153['attributes']:_0x27e4df[_0x7ff4('0x2e')];if(_0x765c69[_0x7ff4('0x2f')][_0x7ff4('0x3e')]){_0x3c4153[_0x7ff4('0x46')]=[{'all':!![]}];}_0x3c4153=_[_0x7ff4('0x3b')]({},_0x3c4153,_0x765c69['options']);return db[_0x7ff4('0x43')][_0x7ff4('0x47')](_0x3c4153)[_0x7ff4('0x22')](handleEntityNotFound(_0x542377,null))[_0x7ff4('0x22')](respondWithResult(_0x542377,null))[_0x7ff4('0x48')](handleError(_0x542377,null));};exports[_0x7ff4('0x49')]=function(_0x2f613a,_0x35002e){return db['UserChatInteraction'][_0x7ff4('0x49')](_0x2f613a[_0x7ff4('0x4a')],{})[_0x7ff4('0x22')](function(_0x3df2e8){var _0x32b66e=_0x2f613a[_0x7ff4('0x4b')]['get']({'plain':!![]});if(!_0x32b66e)throw new Error(_0x7ff4('0x4c'));if(_0x32b66e[_0x7ff4('0x4d')]===_0x7ff4('0x4b')){var _0x4762d3=_0x3df2e8[_0x7ff4('0x24')]({'plain':!![]});var _0xf9ea09='UserChatInteractions';return db[_0x7ff4('0x4e')]['find']({'where':{'name':_0xf9ea09,'userProfileId':_0x32b66e[_0x7ff4('0x4f')]},'raw':!![]})[_0x7ff4('0x22')](function(_0x4a94d8){if(_0x4a94d8&&_0x4a94d8['autoAssociation']===0x0){return db[_0x7ff4('0x50')]['create']({'name':_0x4762d3['name'],'resourceId':_0x4762d3['id'],'type':_0x4a94d8[_0x7ff4('0x28')],'sectionId':_0x4a94d8['id']},{})[_0x7ff4('0x22')](function(){return _0x3df2e8;});}else{return _0x3df2e8;}})[_0x7ff4('0x48')](function(_0x519e8f){logger['error'](_0x7ff4('0x51'),_0x519e8f);throw _0x519e8f;});}return _0x3df2e8;})['then'](respondWithResult(_0x35002e,0xc9))[_0x7ff4('0x48')](handleError(_0x35002e,null));};exports['update']=function(_0x28a913,_0x37ff1e){if(_0x28a913['body']['id']){delete _0x28a913['body']['id'];}return db['UserChatInteraction'][_0x7ff4('0x47')]({'where':{'id':_0x28a913['params']['id']}})[_0x7ff4('0x22')](handleEntityNotFound(_0x37ff1e,null))[_0x7ff4('0x22')](saveUpdates(_0x28a913[_0x7ff4('0x4a')],null))[_0x7ff4('0x22')](respondWithResult(_0x37ff1e,null))[_0x7ff4('0x48')](handleError(_0x37ff1e,null));};exports[_0x7ff4('0x23')]=function(_0x5e5607,_0x3dfa76){return db['UserChatInteraction'][_0x7ff4('0x47')]({'where':{'id':_0x5e5607[_0x7ff4('0x42')]['id']}})[_0x7ff4('0x22')](handleEntityNotFound(_0x3dfa76,null))[_0x7ff4('0x22')](removeEntity(_0x3dfa76,null))[_0x7ff4('0x48')](handleError(_0x3dfa76,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index 65fc16b..b52aee5 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 _0x195c=['define','UserChatInteraction','user_has_chat_interactions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x128f7d,_0x3dad54){var _0x3c0b13=function(_0x25c618){while(--_0x25c618){_0x128f7d['push'](_0x128f7d['shift']());}};_0x3c0b13(++_0x3dad54);}(_0x195c,0x153));var _0xc195=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x195c[_0x934425];return _0x31d596;};'use strict';var _=require(_0xc195('0x0'));var util=require(_0xc195('0x1'));var logger=require(_0xc195('0x2'))(_0xc195('0x3'));var moment=require(_0xc195('0x4'));var BPromise=require(_0xc195('0x5'));var rp=require(_0xc195('0x6'));var fs=require('fs');var path=require(_0xc195('0x7'));var rimraf=require(_0xc195('0x8'));var config=require(_0xc195('0x9'));var attributes=require('./UserChatInteraction.attributes');module[_0xc195('0xa')]=function(_0x4b9dd4,_0x5c0c9f){return _0x4b9dd4[_0xc195('0xb')](_0xc195('0xc'),attributes,{'tableName':_0xc195('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83cc=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserChatInteraction.attributes'];(function(_0x5afc86,_0x5705a3){var _0x1cfae3=function(_0x36eabe){while(--_0x36eabe){_0x5afc86['push'](_0x5afc86['shift']());}};_0x1cfae3(++_0x5705a3);}(_0x83cc,0x1c4));var _0xc83c=function(_0x2e8a70,_0x43d2b0){_0x2e8a70=_0x2e8a70-0x0;var _0x1ffcdf=_0x83cc[_0x2e8a70];return _0x1ffcdf;};'use strict';var _=require('lodash');var util=require(_0xc83c('0x0'));var logger=require(_0xc83c('0x1'))(_0xc83c('0x2'));var moment=require(_0xc83c('0x3'));var BPromise=require(_0xc83c('0x4'));var rp=require(_0xc83c('0x5'));var fs=require('fs');var path=require(_0xc83c('0x6'));var rimraf=require(_0xc83c('0x7'));var config=require(_0xc83c('0x8'));var attributes=require(_0xc83c('0x9'));module['exports']=function(_0x53d7d5,_0x428647){return _0x53d7d5[_0xc83c('0xa')]('UserChatInteraction',attributes,{'tableName':'user_has_chat_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.rpc.js b/server/api/UserChatInteraction/UserChatInteraction.rpc.js index 484c5e7..8818d01 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 _0x2a70=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x2e361c,_0x3e078c){var _0x45a993=function(_0x411297){while(--_0x411297){_0x2e361c['push'](_0x2e361c['shift']());}};_0x45a993(++_0x3e078c);}(_0x2a70,0xe7));var _0x02a7=function(_0x1648d7,_0x4c398b){_0x1648d7=_0x1648d7-0x0;var _0x1836d8=_0x2a70[_0x1648d7];return _0x1836d8;};'use strict';var _=require(_0x02a7('0x0'));var util=require(_0x02a7('0x1'));var moment=require(_0x02a7('0x2'));var BPromise=require(_0x02a7('0x3'));var rs=require(_0x02a7('0x4'));var fs=require('fs');var Redis=require(_0x02a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x02a7('0x6'));var logger=require(_0x02a7('0x7'))(_0x02a7('0x8'));var config=require(_0x02a7('0x9'));var jayson=require(_0x02a7('0xa'));var client=jayson[_0x02a7('0xb')][_0x02a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x256997,_0x3321f0,_0x374e26){return new BPromise(function(_0x320cae,_0x1ad7f0){return client['request'](_0x256997,_0x374e26)['then'](function(_0x3bbc20){logger[_0x02a7('0xd')](_0x02a7('0xe'),_0x3321f0,'request\x20sent');logger[_0x02a7('0xf')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x3321f0,_0x02a7('0x10'),JSON[_0x02a7('0x11')](_0x3bbc20));if(_0x3bbc20[_0x02a7('0x12')]){if(_0x3bbc20[_0x02a7('0x12')][_0x02a7('0x13')]===0x1f4){logger[_0x02a7('0x12')](_0x02a7('0xe'),_0x3321f0,_0x3bbc20['error'][_0x02a7('0x14')]);return _0x1ad7f0(_0x3bbc20[_0x02a7('0x12')][_0x02a7('0x14')]);}logger[_0x02a7('0x12')]('UserChatInteraction,\x20%s,\x20%s',_0x3321f0,_0x3bbc20[_0x02a7('0x12')][_0x02a7('0x14')]);return _0x320cae(_0x3bbc20[_0x02a7('0x12')]['message']);}else{logger[_0x02a7('0xd')](_0x02a7('0xe'),_0x3321f0,_0x02a7('0x10'));_0x320cae(_0x3bbc20[_0x02a7('0x15')]['message']);}})[_0x02a7('0x16')](function(_0x473c44){logger[_0x02a7('0x12')](_0x02a7('0xe'),_0x3321f0,_0x473c44);_0x1ad7f0(_0x473c44);});});} \ No newline at end of file +var _0x3220=['stringify','error','UserChatInteraction,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug'];(function(_0x5ed928,_0x2dbbdc){var _0x2effcc=function(_0x19ba45){while(--_0x19ba45){_0x5ed928['push'](_0x5ed928['shift']());}};_0x2effcc(++_0x2dbbdc);}(_0x3220,0x156));var _0x0322=function(_0x5460fb,_0xb4e34d){_0x5460fb=_0x5460fb-0x0;var _0x3a4026=_0x3220[_0x5460fb];return _0x3a4026;};'use strict';var _=require(_0x0322('0x0'));var util=require('util');var moment=require(_0x0322('0x1'));var BPromise=require('bluebird');var rs=require(_0x0322('0x2'));var fs=require('fs');var Redis=require(_0x0322('0x3'));var db=require(_0x0322('0x4'))['db'];var utils=require(_0x0322('0x5'));var logger=require(_0x0322('0x6'))(_0x0322('0x7'));var config=require(_0x0322('0x8'));var jayson=require(_0x0322('0x9'));var client=jayson[_0x0322('0xa')][_0x0322('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2314ce,_0x18f4ac,_0x20137e){return new BPromise(function(_0x5472f6,_0x4e636c){return client['request'](_0x2314ce,_0x20137e)['then'](function(_0x519f57){logger[_0x0322('0xc')]('UserChatInteraction,\x20%s,\x20%s',_0x18f4ac,_0x0322('0xd'));logger[_0x0322('0xe')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x18f4ac,_0x0322('0xd'),JSON[_0x0322('0xf')](_0x519f57));if(_0x519f57[_0x0322('0x10')]){if(_0x519f57['error']['code']===0x1f4){logger['error'](_0x0322('0x11'),_0x18f4ac,_0x519f57['error']['message']);return _0x4e636c(_0x519f57['error'][_0x0322('0x12')]);}logger[_0x0322('0x10')](_0x0322('0x11'),_0x18f4ac,_0x519f57[_0x0322('0x10')][_0x0322('0x12')]);return _0x5472f6(_0x519f57[_0x0322('0x10')][_0x0322('0x12')]);}else{logger[_0x0322('0xc')](_0x0322('0x11'),_0x18f4ac,'request\x20sent');_0x5472f6(_0x519f57[_0x0322('0x13')]['message']);}})[_0x0322('0x14')](function(_0x4ff819){logger['error'](_0x0322('0x11'),_0x18f4ac,_0x4ff819);_0x4e636c(_0x4ff819);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index 82f0109..edcaa5c 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 _0x9608=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../config/environment'];(function(_0x4960e1,_0x5a46ad){var _0x3a97b5=function(_0x3925d9){while(--_0x3925d9){_0x4960e1['push'](_0x4960e1['shift']());}};_0x3a97b5(++_0x5a46ad);}(_0x9608,0x17b));var _0x8960=function(_0x404cb9,_0x5c050f){_0x404cb9=_0x404cb9-0x0;var _0x2553a6=_0x9608[_0x404cb9];return _0x2553a6;};'use strict';var multer=require(_0x8960('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8960('0x1'));var express=require(_0x8960('0x2'));var router=express[_0x8960('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8960('0x4'));var controller=require('./UserChatInteraction.controller');router[_0x8960('0x5')]('/',auth[_0x8960('0x6')](),controller[_0x8960('0x7')]);router[_0x8960('0x5')](_0x8960('0x8'),auth[_0x8960('0x6')](),controller[_0x8960('0x9')]);router[_0x8960('0xa')]('/',auth['isAuthenticated'](),controller[_0x8960('0xb')]);router['put'](_0x8960('0x8'),auth[_0x8960('0x6')](),controller[_0x8960('0xc')]);router[_0x8960('0xd')](_0x8960('0x8'),auth[_0x8960('0x6')](),controller[_0x8960('0xe')]);module[_0x8960('0xf')]=router; \ No newline at end of file +var _0x3ce8=['connect-timeout','express','../../components/auth/service','../../config/environment','./UserChatInteraction.controller','get','index','isAuthenticated','show','create','put','delete','destroy','exports','multer','util'];(function(_0x282983,_0x4c4038){var _0x48dc28=function(_0x1078d0){while(--_0x1078d0){_0x282983['push'](_0x282983['shift']());}};_0x48dc28(++_0x4c4038);}(_0x3ce8,0xde));var _0x83ce=function(_0x34e408,_0xf259df){_0x34e408=_0x34e408-0x0;var _0x33787d=_0x3ce8[_0x34e408];return _0x33787d;};'use strict';var multer=require(_0x83ce('0x0'));var util=require(_0x83ce('0x1'));var path=require('path');var timeout=require(_0x83ce('0x2'));var express=require(_0x83ce('0x3'));var router=express['Router']();var auth=require(_0x83ce('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x83ce('0x5'));var controller=require(_0x83ce('0x6'));router[_0x83ce('0x7')]('/',auth['isAuthenticated'](),controller[_0x83ce('0x8')]);router['get']('/:id',auth[_0x83ce('0x9')](),controller[_0x83ce('0xa')]);router['post']('/',auth[_0x83ce('0x9')](),controller[_0x83ce('0xb')]);router[_0x83ce('0xc')]('/:id',auth[_0x83ce('0x9')](),controller['update']);router[_0x83ce('0xd')]('/:id',auth[_0x83ce('0x9')](),controller[_0x83ce('0xe')]);module[_0x83ce('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index c25a33a..a1b48a6 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 _0x1d85=['sequelize','exports','INTEGER'];(function(_0x273f19,_0x1b951d){var _0x2206da=function(_0x4e6979){while(--_0x4e6979){_0x273f19['push'](_0x273f19['shift']());}};_0x2206da(++_0x1b951d);}(_0x1d85,0x141));var _0x51d8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1d85[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x51d8('0x0'));module[_0x51d8('0x1')]={'FaxInteractionId':{'type':Sequelize[_0x51d8('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x51d8('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x499f=['sequelize','exports','INTEGER'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x499f,0x99));var _0xf499=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0x499f[_0x42c341];return _0x43621b;};'use strict';var Sequelize=require(_0xf499('0x0'));module[_0xf499('0x1')]={'FaxInteractionId':{'type':Sequelize[_0xf499('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf499('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 9750b7b..7cc8e89 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 _0xcd85=['end','error','stack','name','send','index','map','UserFaxInteraction','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','then','destroy','get','UserFaxInteractions'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xcd85,0x1c1));var _0x5cd8=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xcd85[_0xcf4569];return _0x7fef;};'use strict';var pdf=require(_0x5cd8('0x0'));var emlformat=require(_0x5cd8('0x1'));var rimraf=require(_0x5cd8('0x2'));var zipdir=require(_0x5cd8('0x3'));var jsonpatch=require(_0x5cd8('0x4'));var rp=require(_0x5cd8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5cd8('0x6'));var util=require(_0x5cd8('0x7'));var path=require(_0x5cd8('0x8'));var sox=require(_0x5cd8('0x9'));var csv=require('to-csv');var ejs=require(_0x5cd8('0xa'));var fs=require('fs');var _=require(_0x5cd8('0xb'));var squel=require(_0x5cd8('0xc'));var crypto=require(_0x5cd8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5cd8('0xe'));var Redis=require(_0x5cd8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5cd8('0x10'));var as=require(_0x5cd8('0x11'));var hardwareService=require(_0x5cd8('0x12'));var logger=require(_0x5cd8('0x13'))(_0x5cd8('0x14'));var utils=require(_0x5cd8('0x15'));var config=require(_0x5cd8('0x16'));var licenseUtil=require(_0x5cd8('0x17'));var db=require(_0x5cd8('0x18'))['db'];function respondWithStatusCode(_0x3a99d6,_0xf79684){_0xf79684=_0xf79684||0xcc;return function(_0xe04245){if(_0xe04245){return _0x3a99d6[_0x5cd8('0x19')](_0xf79684);}return _0x3a99d6[_0x5cd8('0x1a')](_0xf79684)['end']();};}function respondWithResult(_0x1135bc,_0x154eb8){_0x154eb8=_0x154eb8||0xc8;return function(_0x35c873){if(_0x35c873){return _0x1135bc['status'](_0x154eb8)[_0x5cd8('0x1b')](_0x35c873);}};}function respondWithFilteredResult(_0x58139f,_0x2af78e){return function(_0x5ae864){if(_0x5ae864){var _0x31aa17=_0x5ae864[_0x5cd8('0x1c')],_0x13f3db=_0x2af78e[_0x5cd8('0x1d')],_0x59736a=_0x2af78e[_0x5cd8('0x1d')]+_0x2af78e[_0x5cd8('0x1e')],_0x138942;if(_0x59736a>=_0x31aa17){_0x59736a=_0x31aa17;_0x138942=0xc8;}else{_0x138942=0xce;}_0x58139f['status'](_0x138942);return _0x58139f[_0x5cd8('0x1f')](_0x5cd8('0x20'),_0x13f3db+'-'+_0x59736a+'/'+_0x31aa17)[_0x5cd8('0x1b')](_0x5ae864);}return null;};}function patchUpdates(_0x14ae9b){return function(_0x396e2b){try{jsonpatch['apply'](_0x396e2b,_0x14ae9b,!![]);}catch(_0x22369c){return BPromise['reject'](_0x22369c);}return _0x396e2b['save']();};}function saveUpdates(_0x16bdcd,_0x317fa8){return function(_0x3e388d){if(_0x3e388d){return _0x3e388d['update'](_0x16bdcd)[_0x5cd8('0x21')](function(_0x1aabc4){return _0x1aabc4;});}return null;};}function removeEntity(_0x51f0a1,_0x3754f6){return function(_0x571800){if(_0x571800){return _0x571800[_0x5cd8('0x22')]()[_0x5cd8('0x21')](function(){var _0x4be960=_0x571800[_0x5cd8('0x23')]({'plain':!![]});var _0x1f48e6=_0x5cd8('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f48e6,'resourceId':_0x4be960['id']}})['then'](function(){return _0x571800;});})['then'](function(){_0x51f0a1[_0x5cd8('0x1a')](0xcc)[_0x5cd8('0x25')]();});}};}function handleEntityNotFound(_0x438342,_0x46dc93){return function(_0x36df22){if(!_0x36df22){_0x438342[_0x5cd8('0x19')](0x194);}return _0x36df22;};}function handleError(_0xfb40c4,_0x5080f3){_0x5080f3=_0x5080f3||0x1f4;return function(_0x3665ce){logger[_0x5cd8('0x26')](_0x3665ce[_0x5cd8('0x27')]);if(_0x3665ce['name']){delete _0x3665ce[_0x5cd8('0x28')];}_0xfb40c4[_0x5cd8('0x1a')](_0x5080f3)[_0x5cd8('0x29')](_0x3665ce);};}exports[_0x5cd8('0x2a')]=function(_0x201a6b,_0x4bc03a){var _0x359c7d={},_0x30f6f4={},_0x386d9e={'count':0x0,'rows':[]};var _0x49ebe0=_[_0x5cd8('0x2b')](db[_0x5cd8('0x2c')][_0x5cd8('0x2d')],function(_0x31b713){return{'name':_0x31b713[_0x5cd8('0x2e')],'type':_0x31b713['type'][_0x5cd8('0x2f')]};});_0x30f6f4['model']=_[_0x5cd8('0x2b')](_0x49ebe0,_0x5cd8('0x28'));_0x30f6f4[_0x5cd8('0x30')]=_[_0x5cd8('0x31')](_0x201a6b[_0x5cd8('0x30')]);_0x30f6f4['filters']=_['intersection'](_0x30f6f4[_0x5cd8('0x32')],_0x30f6f4[_0x5cd8('0x30')]);_0x359c7d[_0x5cd8('0x33')]=_[_0x5cd8('0x34')](_0x30f6f4[_0x5cd8('0x32')],qs[_0x5cd8('0x35')](_0x201a6b['query'][_0x5cd8('0x35')]));_0x359c7d[_0x5cd8('0x33')]=_0x359c7d[_0x5cd8('0x33')][_0x5cd8('0x36')]?_0x359c7d[_0x5cd8('0x33')]:_0x30f6f4[_0x5cd8('0x32')];if(!_0x201a6b['query'][_0x5cd8('0x37')](_0x5cd8('0x38'))){_0x359c7d[_0x5cd8('0x1e')]=qs[_0x5cd8('0x1e')](_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x1e')]);_0x359c7d[_0x5cd8('0x1d')]=qs[_0x5cd8('0x1d')](_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x1d')]);}_0x359c7d[_0x5cd8('0x39')]=qs[_0x5cd8('0x3a')](_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x3a')]);_0x359c7d[_0x5cd8('0x3b')]=qs[_0x5cd8('0x3c')](_[_0x5cd8('0x3d')](_0x201a6b[_0x5cd8('0x30')],_0x30f6f4[_0x5cd8('0x3c')]),_0x49ebe0);if(_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x3e')]){_0x359c7d['where']=_['merge'](_0x359c7d[_0x5cd8('0x3b')],{'$or':_[_0x5cd8('0x2b')](_0x49ebe0,function(_0x1fade0){if(_0x1fade0['type']!==_0x5cd8('0x3f')){var _0x53dfc7={};_0x53dfc7[_0x1fade0[_0x5cd8('0x28')]]={'$like':'%'+_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x3e')]+'%'};return _0x53dfc7;}})});}_0x359c7d=_['merge']({},_0x359c7d,_0x201a6b[_0x5cd8('0x40')]);var _0x50c789={'where':_0x359c7d['where']};return db[_0x5cd8('0x2c')]['count'](_0x50c789)['then'](function(_0x126d64){_0x386d9e[_0x5cd8('0x1c')]=_0x126d64;if(_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x41')]){_0x359c7d[_0x5cd8('0x42')]=[{'all':!![]}];}return db[_0x5cd8('0x2c')]['findAll'](_0x359c7d);})[_0x5cd8('0x21')](function(_0x7ca584){_0x386d9e[_0x5cd8('0x43')]=_0x7ca584;return _0x386d9e;})[_0x5cd8('0x21')](respondWithFilteredResult(_0x4bc03a,_0x359c7d))[_0x5cd8('0x44')](handleError(_0x4bc03a,null));};exports[_0x5cd8('0x45')]=function(_0x1d8f89,_0x44b7b4){var _0x3da1d9={'raw':!![],'where':{'id':_0x1d8f89[_0x5cd8('0x46')]['id']}},_0x1b4561={};_0x1b4561[_0x5cd8('0x32')]=_[_0x5cd8('0x31')](db['UserFaxInteraction'][_0x5cd8('0x2d')]);_0x1b4561['query']=_[_0x5cd8('0x31')](_0x1d8f89['query']);_0x1b4561[_0x5cd8('0x3c')]=_[_0x5cd8('0x34')](_0x1b4561[_0x5cd8('0x32')],_0x1b4561[_0x5cd8('0x30')]);_0x3da1d9[_0x5cd8('0x33')]=_['intersection'](_0x1b4561[_0x5cd8('0x32')],qs[_0x5cd8('0x35')](_0x1d8f89[_0x5cd8('0x30')]['fields']));_0x3da1d9[_0x5cd8('0x33')]=_0x3da1d9[_0x5cd8('0x33')]['length']?_0x3da1d9['attributes']:_0x1b4561['model'];if(_0x1d8f89[_0x5cd8('0x30')][_0x5cd8('0x41')]){_0x3da1d9[_0x5cd8('0x42')]=[{'all':!![]}];}_0x3da1d9=_[_0x5cd8('0x47')]({},_0x3da1d9,_0x1d8f89[_0x5cd8('0x40')]);return db[_0x5cd8('0x2c')][_0x5cd8('0x48')](_0x3da1d9)[_0x5cd8('0x21')](handleEntityNotFound(_0x44b7b4,null))[_0x5cd8('0x21')](respondWithResult(_0x44b7b4,null))[_0x5cd8('0x44')](handleError(_0x44b7b4,null));};exports['create']=function(_0x1f5cd6,_0x34e4ff){return db[_0x5cd8('0x2c')][_0x5cd8('0x49')](_0x1f5cd6[_0x5cd8('0x4a')],{})[_0x5cd8('0x21')](function(_0x376cd0){var _0x51db7b=_0x1f5cd6[_0x5cd8('0x4b')][_0x5cd8('0x23')]({'plain':!![]});if(!_0x51db7b)throw new Error(_0x5cd8('0x4c'));if(_0x51db7b[_0x5cd8('0x4d')]==='user'){var _0x20fa43=_0x376cd0[_0x5cd8('0x23')]({'plain':!![]});var _0x127dda=_0x5cd8('0x24');return db[_0x5cd8('0x4e')][_0x5cd8('0x48')]({'where':{'name':_0x127dda,'userProfileId':_0x51db7b[_0x5cd8('0x4f')]},'raw':!![]})['then'](function(_0x44519c){if(_0x44519c&&_0x44519c['autoAssociation']===0x0){return db['UserProfileResource'][_0x5cd8('0x49')]({'name':_0x20fa43['name'],'resourceId':_0x20fa43['id'],'type':_0x44519c[_0x5cd8('0x28')],'sectionId':_0x44519c['id']},{})['then'](function(){return _0x376cd0;});}else{return _0x376cd0;}})[_0x5cd8('0x44')](function(_0x2b7bbb){logger[_0x5cd8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b7bbb);throw _0x2b7bbb;});}return _0x376cd0;})[_0x5cd8('0x21')](respondWithResult(_0x34e4ff,0xc9))[_0x5cd8('0x44')](handleError(_0x34e4ff,null));};exports[_0x5cd8('0x50')]=function(_0x420c05,_0x594028){if(_0x420c05['body']['id']){delete _0x420c05[_0x5cd8('0x4a')]['id'];}return db[_0x5cd8('0x2c')]['find']({'where':{'id':_0x420c05['params']['id']}})[_0x5cd8('0x21')](handleEntityNotFound(_0x594028,null))[_0x5cd8('0x21')](saveUpdates(_0x420c05[_0x5cd8('0x4a')],null))[_0x5cd8('0x21')](respondWithResult(_0x594028,null))[_0x5cd8('0x44')](handleError(_0x594028,null));};exports[_0x5cd8('0x22')]=function(_0x1e2436,_0xea512d){return db['UserFaxInteraction'][_0x5cd8('0x48')]({'where':{'id':_0x1e2436[_0x5cd8('0x46')]['id']}})[_0x5cd8('0x21')](handleEntityNotFound(_0xea512d,null))['then'](removeEntity(_0xea512d,null))[_0x5cd8('0x44')](handleError(_0xea512d,null));}; \ No newline at end of file +var _0xdb5a=['Content-Range','apply','reject','save','update','then','UserFaxInteractions','UserProfileResource','error','stack','name','index','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','map','type','options','UserFaxInteraction','includeAll','include','findAll','rows','show','params','keys','filters','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','count','offset'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xdb5a,0x1af));var _0xadb5=function(_0x34cc41,_0x313cf8){_0x34cc41=_0x34cc41-0x0;var _0x101747=_0xdb5a[_0x34cc41];return _0x101747;};'use strict';var pdf=require(_0xadb5('0x0'));var emlformat=require(_0xadb5('0x1'));var rimraf=require(_0xadb5('0x2'));var zipdir=require(_0xadb5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadb5('0x4'));var moment=require('moment');var BPromise=require(_0xadb5('0x5'));var Mustache=require(_0xadb5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xadb5('0x7'));var ejs=require(_0xadb5('0x8'));var fs=require('fs');var _=require(_0xadb5('0x9'));var squel=require(_0xadb5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xadb5('0x7'));var querystring=require(_0xadb5('0xb'));var Papa=require('papaparse');var Redis=require(_0xadb5('0xc'));var authService=require(_0xadb5('0xd'));var qs=require(_0xadb5('0xe'));var as=require(_0xadb5('0xf'));var hardwareService=require(_0xadb5('0x10'));var logger=require('../../config/logger')(_0xadb5('0x11'));var utils=require(_0xadb5('0x12'));var config=require(_0xadb5('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf3cd36,_0x3e8e65){_0x3e8e65=_0x3e8e65||0xcc;return function(_0x4e1849){if(_0x4e1849){return _0xf3cd36['sendStatus'](_0x3e8e65);}return _0xf3cd36[_0xadb5('0x14')](_0x3e8e65)[_0xadb5('0x15')]();};}function respondWithResult(_0x256ed5,_0x30fe95){_0x30fe95=_0x30fe95||0xc8;return function(_0x4f4a28){if(_0x4f4a28){return _0x256ed5['status'](_0x30fe95)[_0xadb5('0x16')](_0x4f4a28);}};}function respondWithFilteredResult(_0x1c9237,_0x43a263){return function(_0x345742){if(_0x345742){var _0x5c279d=_0x345742[_0xadb5('0x17')],_0x3251ce=_0x43a263[_0xadb5('0x18')],_0x226da5=_0x43a263[_0xadb5('0x18')]+_0x43a263['limit'],_0x2ebb74;if(_0x226da5>=_0x5c279d){_0x226da5=_0x5c279d;_0x2ebb74=0xc8;}else{_0x2ebb74=0xce;}_0x1c9237['status'](_0x2ebb74);return _0x1c9237['set'](_0xadb5('0x19'),_0x3251ce+'-'+_0x226da5+'/'+_0x5c279d)['json'](_0x345742);}return null;};}function patchUpdates(_0x5ea742){return function(_0x454f64){try{jsonpatch[_0xadb5('0x1a')](_0x454f64,_0x5ea742,!![]);}catch(_0x5a949c){return BPromise[_0xadb5('0x1b')](_0x5a949c);}return _0x454f64[_0xadb5('0x1c')]();};}function saveUpdates(_0xea86b6,_0x53bfc4){return function(_0x15cf0a){if(_0x15cf0a){return _0x15cf0a[_0xadb5('0x1d')](_0xea86b6)[_0xadb5('0x1e')](function(_0x189a6a){return _0x189a6a;});}return null;};}function removeEntity(_0x572346,_0x2a7471){return function(_0x53f3c4){if(_0x53f3c4){return _0x53f3c4['destroy']()[_0xadb5('0x1e')](function(){var _0x5a2691=_0x53f3c4['get']({'plain':!![]});var _0x207192=_0xadb5('0x1f');return db[_0xadb5('0x20')]['destroy']({'where':{'type':_0x207192,'resourceId':_0x5a2691['id']}})[_0xadb5('0x1e')](function(){return _0x53f3c4;});})[_0xadb5('0x1e')](function(){_0x572346[_0xadb5('0x14')](0xcc)[_0xadb5('0x15')]();});}};}function handleEntityNotFound(_0x481f2a,_0x107ab2){return function(_0x3f022f){if(!_0x3f022f){_0x481f2a['sendStatus'](0x194);}return _0x3f022f;};}function handleError(_0x518a2c,_0x2038e9){_0x2038e9=_0x2038e9||0x1f4;return function(_0x1a99fe){logger[_0xadb5('0x21')](_0x1a99fe[_0xadb5('0x22')]);if(_0x1a99fe[_0xadb5('0x23')]){delete _0x1a99fe[_0xadb5('0x23')];}_0x518a2c['status'](_0x2038e9)['send'](_0x1a99fe);};}exports[_0xadb5('0x24')]=function(_0x3367af,_0x39b7ea){var _0x4f8252={},_0x575447={},_0x13ee39={'count':0x0,'rows':[]};var _0x291c5c=_['map'](db['UserFaxInteraction'][_0xadb5('0x25')],function(_0x351330){return{'name':_0x351330['fieldName'],'type':_0x351330['type']['key']};});_0x575447[_0xadb5('0x26')]=_['map'](_0x291c5c,_0xadb5('0x23'));_0x575447[_0xadb5('0x27')]=_['keys'](_0x3367af[_0xadb5('0x27')]);_0x575447['filters']=_[_0xadb5('0x28')](_0x575447[_0xadb5('0x26')],_0x575447['query']);_0x4f8252['attributes']=_[_0xadb5('0x28')](_0x575447[_0xadb5('0x26')],qs['fields'](_0x3367af[_0xadb5('0x27')][_0xadb5('0x29')]));_0x4f8252[_0xadb5('0x2a')]=_0x4f8252[_0xadb5('0x2a')][_0xadb5('0x2b')]?_0x4f8252[_0xadb5('0x2a')]:_0x575447['model'];if(!_0x3367af['query'][_0xadb5('0x2c')]('nolimit')){_0x4f8252[_0xadb5('0x2d')]=qs[_0xadb5('0x2d')](_0x3367af[_0xadb5('0x27')][_0xadb5('0x2d')]);_0x4f8252[_0xadb5('0x18')]=qs[_0xadb5('0x18')](_0x3367af[_0xadb5('0x27')]['offset']);}_0x4f8252[_0xadb5('0x2e')]=qs[_0xadb5('0x2f')](_0x3367af[_0xadb5('0x27')][_0xadb5('0x2f')]);_0x4f8252['where']=qs['filters'](_[_0xadb5('0x30')](_0x3367af['query'],_0x575447['filters']),_0x291c5c);if(_0x3367af[_0xadb5('0x27')][_0xadb5('0x31')]){_0x4f8252[_0xadb5('0x32')]=_[_0xadb5('0x33')](_0x4f8252[_0xadb5('0x32')],{'$or':_[_0xadb5('0x34')](_0x291c5c,function(_0x5044be){if(_0x5044be[_0xadb5('0x35')]!=='VIRTUAL'){var _0x314ea1={};_0x314ea1[_0x5044be[_0xadb5('0x23')]]={'$like':'%'+_0x3367af['query'][_0xadb5('0x31')]+'%'};return _0x314ea1;}})});}_0x4f8252=_['merge']({},_0x4f8252,_0x3367af[_0xadb5('0x36')]);var _0x2be007={'where':_0x4f8252[_0xadb5('0x32')]};return db[_0xadb5('0x37')][_0xadb5('0x17')](_0x2be007)[_0xadb5('0x1e')](function(_0x2856df){_0x13ee39[_0xadb5('0x17')]=_0x2856df;if(_0x3367af[_0xadb5('0x27')][_0xadb5('0x38')]){_0x4f8252[_0xadb5('0x39')]=[{'all':!![]}];}return db[_0xadb5('0x37')][_0xadb5('0x3a')](_0x4f8252);})[_0xadb5('0x1e')](function(_0x1b9b0c){_0x13ee39[_0xadb5('0x3b')]=_0x1b9b0c;return _0x13ee39;})[_0xadb5('0x1e')](respondWithFilteredResult(_0x39b7ea,_0x4f8252))['catch'](handleError(_0x39b7ea,null));};exports[_0xadb5('0x3c')]=function(_0x375daf,_0x196efe){var _0x2c9730={'raw':!![],'where':{'id':_0x375daf[_0xadb5('0x3d')]['id']}},_0x36e09d={};_0x36e09d['model']=_[_0xadb5('0x3e')](db[_0xadb5('0x37')]['rawAttributes']);_0x36e09d[_0xadb5('0x27')]=_['keys'](_0x375daf[_0xadb5('0x27')]);_0x36e09d[_0xadb5('0x3f')]=_[_0xadb5('0x28')](_0x36e09d[_0xadb5('0x26')],_0x36e09d[_0xadb5('0x27')]);_0x2c9730[_0xadb5('0x2a')]=_[_0xadb5('0x28')](_0x36e09d[_0xadb5('0x26')],qs['fields'](_0x375daf[_0xadb5('0x27')][_0xadb5('0x29')]));_0x2c9730[_0xadb5('0x2a')]=_0x2c9730['attributes']['length']?_0x2c9730[_0xadb5('0x2a')]:_0x36e09d['model'];if(_0x375daf[_0xadb5('0x27')][_0xadb5('0x38')]){_0x2c9730[_0xadb5('0x39')]=[{'all':!![]}];}_0x2c9730=_['merge']({},_0x2c9730,_0x375daf[_0xadb5('0x36')]);return db[_0xadb5('0x37')][_0xadb5('0x40')](_0x2c9730)[_0xadb5('0x1e')](handleEntityNotFound(_0x196efe,null))[_0xadb5('0x1e')](respondWithResult(_0x196efe,null))[_0xadb5('0x41')](handleError(_0x196efe,null));};exports[_0xadb5('0x42')]=function(_0x51acfc,_0x4c0e6b){return db[_0xadb5('0x37')][_0xadb5('0x42')](_0x51acfc[_0xadb5('0x43')],{})[_0xadb5('0x1e')](function(_0x1bf4b2){var _0x5a0786=_0x51acfc[_0xadb5('0x44')][_0xadb5('0x45')]({'plain':!![]});if(!_0x5a0786)throw new Error(_0xadb5('0x46'));if(_0x5a0786['role']==='user'){var _0x363425=_0x1bf4b2['get']({'plain':!![]});var _0x4a9b3e=_0xadb5('0x1f');return db[_0xadb5('0x47')]['find']({'where':{'name':_0x4a9b3e,'userProfileId':_0x5a0786[_0xadb5('0x48')]},'raw':!![]})['then'](function(_0x5bba06){if(_0x5bba06&&_0x5bba06[_0xadb5('0x49')]===0x0){return db[_0xadb5('0x20')][_0xadb5('0x42')]({'name':_0x363425['name'],'resourceId':_0x363425['id'],'type':_0x5bba06[_0xadb5('0x23')],'sectionId':_0x5bba06['id']},{})[_0xadb5('0x1e')](function(){return _0x1bf4b2;});}else{return _0x1bf4b2;}})[_0xadb5('0x41')](function(_0x244218){logger['error'](_0xadb5('0x4a'),_0x244218);throw _0x244218;});}return _0x1bf4b2;})[_0xadb5('0x1e')](respondWithResult(_0x4c0e6b,0xc9))[_0xadb5('0x41')](handleError(_0x4c0e6b,null));};exports[_0xadb5('0x1d')]=function(_0x129f42,_0x518f92){if(_0x129f42['body']['id']){delete _0x129f42[_0xadb5('0x43')]['id'];}return db[_0xadb5('0x37')][_0xadb5('0x40')]({'where':{'id':_0x129f42[_0xadb5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x518f92,null))[_0xadb5('0x1e')](saveUpdates(_0x129f42[_0xadb5('0x43')],null))[_0xadb5('0x1e')](respondWithResult(_0x518f92,null))[_0xadb5('0x41')](handleError(_0x518f92,null));};exports[_0xadb5('0x4b')]=function(_0x5f088e,_0x51c0dc){return db['UserFaxInteraction'][_0xadb5('0x40')]({'where':{'id':_0x5f088e[_0xadb5('0x3d')]['id']}})[_0xadb5('0x1e')](handleEntityNotFound(_0x51c0dc,null))[_0xadb5('0x1e')](removeEntity(_0x51c0dc,null))['catch'](handleError(_0x51c0dc,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index 4f6cc46..16c4eb2 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./UserFaxInteraction.attributes','exports','define','user_has_fax_interactions','lodash','../../config/logger'];(function(_0xf973b7,_0x46699f){var _0x499087=function(_0x45b42f){while(--_0x45b42f){_0xf973b7['push'](_0xf973b7['shift']());}};_0x499087(++_0x46699f);}(_0xb10b,0x12a));var _0xbb10=function(_0x26b00e,_0x245a09){_0x26b00e=_0x26b00e-0x0;var _0x3764c3=_0xb10b[_0x26b00e];return _0x3764c3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxInteraction',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','lodash','util'];(function(_0x163d61,_0x480ef2){var _0x222960=function(_0x3d9ba0){while(--_0x3d9ba0){_0x163d61['push'](_0x163d61['shift']());}};_0x222960(++_0x480ef2);}(_0xdb28,0x106));var _0x8db2=function(_0xc1b896,_0x612ac4){_0xc1b896=_0xc1b896-0x0;var _0x2cd0f9=_0xdb28[_0xc1b896];return _0x2cd0f9;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./UserFaxInteraction.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index 2e18354..8c94191 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 _0x41cb=['rpc','request','then','UserFaxInteraction,\x20%s,\x20%s','request\x20sent','error','message','info','result','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x116df7,_0x68407){var _0x3e8942=function(_0x2bf5b7){while(--_0x2bf5b7){_0x116df7['push'](_0x116df7['shift']());}};_0x3e8942(++_0x68407);}(_0x41cb,0x134));var _0xb41c=function(_0x361451,_0xfccb5c){_0x361451=_0x361451-0x0;var _0x1b235b=_0x41cb[_0x361451];return _0x1b235b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41c('0x0'));var db=require(_0xb41c('0x1'))['db'];var utils=require(_0xb41c('0x2'));var logger=require(_0xb41c('0x3'))(_0xb41c('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d189b,_0x13c589,_0x388a92){return new BPromise(function(_0xe03ff3,_0xb9d1e7){return client[_0xb41c('0x5')](_0x1d189b,_0x388a92)[_0xb41c('0x6')](function(_0x4b52c5){logger['info'](_0xb41c('0x7'),_0x13c589,'request\x20sent');logger['debug']('UserFaxInteraction,\x20%s,\x20%s,\x20%s',_0x13c589,_0xb41c('0x8'),JSON['stringify'](_0x4b52c5));if(_0x4b52c5[_0xb41c('0x9')]){if(_0x4b52c5[_0xb41c('0x9')]['code']===0x1f4){logger[_0xb41c('0x9')](_0xb41c('0x7'),_0x13c589,_0x4b52c5[_0xb41c('0x9')][_0xb41c('0xa')]);return _0xb9d1e7(_0x4b52c5[_0xb41c('0x9')][_0xb41c('0xa')]);}logger['error'](_0xb41c('0x7'),_0x13c589,_0x4b52c5[_0xb41c('0x9')][_0xb41c('0xa')]);return _0xe03ff3(_0x4b52c5[_0xb41c('0x9')]['message']);}else{logger[_0xb41c('0xb')](_0xb41c('0x7'),_0x13c589,_0xb41c('0x8'));_0xe03ff3(_0x4b52c5[_0xb41c('0xc')][_0xb41c('0xa')]);}})['catch'](function(_0x215cf3){logger['error'](_0xb41c('0x7'),_0x13c589,_0x215cf3);_0xb9d1e7(_0x215cf3);});});} \ No newline at end of file +var _0x192f=['../../config/environment','jayson/promise','client','request','then','UserFaxInteraction,\x20%s,\x20%s','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','../../config/logger','rpc'];(function(_0x1acc01,_0x5cb80c){var _0x5603f1=function(_0x5e7558){while(--_0x5e7558){_0x1acc01['push'](_0x1acc01['shift']());}};_0x5603f1(++_0x5cb80c);}(_0x192f,0x1ef));var _0xf192=function(_0x101dd5,_0x3d3e31){_0x101dd5=_0x101dd5-0x0;var _0x59296f=_0x192f[_0x101dd5];return _0x59296f;};'use strict';var _=require('lodash');var util=require(_0xf192('0x0'));var moment=require(_0xf192('0x1'));var BPromise=require(_0xf192('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf192('0x3'))(_0xf192('0x4'));var config=require(_0xf192('0x5'));var jayson=require(_0xf192('0x6'));var client=jayson[_0xf192('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f55de,_0x2b418c,_0x3aea03){return new BPromise(function(_0x2a0d04,_0x5ecb82){return client[_0xf192('0x8')](_0x4f55de,_0x3aea03)[_0xf192('0x9')](function(_0x593527){logger['info'](_0xf192('0xa'),_0x2b418c,'request\x20sent');logger[_0xf192('0xb')](_0xf192('0xc'),_0x2b418c,_0xf192('0xd'),JSON[_0xf192('0xe')](_0x593527));if(_0x593527[_0xf192('0xf')]){if(_0x593527[_0xf192('0xf')]['code']===0x1f4){logger['error'](_0xf192('0xa'),_0x2b418c,_0x593527[_0xf192('0xf')][_0xf192('0x10')]);return _0x5ecb82(_0x593527[_0xf192('0xf')][_0xf192('0x10')]);}logger[_0xf192('0xf')]('UserFaxInteraction,\x20%s,\x20%s',_0x2b418c,_0x593527['error'][_0xf192('0x10')]);return _0x2a0d04(_0x593527[_0xf192('0xf')][_0xf192('0x10')]);}else{logger[_0xf192('0x11')](_0xf192('0xa'),_0x2b418c,_0xf192('0xd'));_0x2a0d04(_0x593527[_0xf192('0x12')][_0xf192('0x10')]);}})[_0xf192('0x13')](function(_0x17cb5f){logger['error'](_0xf192('0xa'),_0x2b418c,_0x17cb5f);_0x5ecb82(_0x17cb5f);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 95c0d73..1fb8713 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 _0x3526=['../../components/interaction/service','./UserFaxInteraction.controller','get','index','/:id','show','post','isAuthenticated','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x678ac1,_0x2ab563){var _0x5ce3ab=function(_0x16d149){while(--_0x16d149){_0x678ac1['push'](_0x678ac1['shift']());}};_0x5ce3ab(++_0x2ab563);}(_0x3526,0x163));var _0x6352=function(_0x25a3ed,_0x704998){_0x25a3ed=_0x25a3ed-0x0;var _0x35978c=_0x3526[_0x25a3ed];return _0x35978c;};'use strict';var multer=require(_0x6352('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6352('0x1'));var express=require(_0x6352('0x2'));var router=express[_0x6352('0x3')]();var auth=require(_0x6352('0x4'));var interaction=require(_0x6352('0x5'));var config=require('../../config/environment');var controller=require(_0x6352('0x6'));router[_0x6352('0x7')]('/',auth['isAuthenticated'](),controller[_0x6352('0x8')]);router[_0x6352('0x7')](_0x6352('0x9'),auth['isAuthenticated'](),controller[_0x6352('0xa')]);router[_0x6352('0xb')]('/',auth[_0x6352('0xc')](),controller['create']);router['put']('/:id',auth[_0x6352('0xc')](),controller['update']);router['delete'](_0x6352('0x9'),auth[_0x6352('0xc')](),controller[_0x6352('0xd')]);module[_0x6352('0xe')]=router; \ No newline at end of file +var _0x5609=['../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','get','isAuthenticated','show','post','put','/:id','delete','exports','util','path','express','../../components/auth/service'];(function(_0x15fe32,_0x48b3b6){var _0x147cba=function(_0x4fb18d){while(--_0x4fb18d){_0x15fe32['push'](_0x15fe32['shift']());}};_0x147cba(++_0x48b3b6);}(_0x5609,0xdd));var _0x9560=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5609[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0x9560('0x0'));var path=require(_0x9560('0x1'));var timeout=require('connect-timeout');var express=require(_0x9560('0x2'));var router=express['Router']();var auth=require(_0x9560('0x3'));var interaction=require(_0x9560('0x4'));var config=require(_0x9560('0x5'));var controller=require(_0x9560('0x6'));router[_0x9560('0x7')]('/',auth[_0x9560('0x8')](),controller['index']);router[_0x9560('0x7')]('/:id',auth[_0x9560('0x8')](),controller[_0x9560('0x9')]);router[_0x9560('0xa')]('/',auth[_0x9560('0x8')](),controller['create']);router[_0x9560('0xb')](_0x9560('0xc'),auth[_0x9560('0x8')](),controller['update']);router[_0x9560('0xd')](_0x9560('0xc'),auth[_0x9560('0x8')](),controller['destroy']);module[_0x9560('0xe')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index e64be33..16985fd 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 _0x3e7f=['INTEGER','exports'];(function(_0x5cd9be,_0x12d0fa){var _0x3a93af=function(_0xe6756c){while(--_0xe6756c){_0x5cd9be['push'](_0x5cd9be['shift']());}};_0x3a93af(++_0x12d0fa);}(_0x3e7f,0xaf));var _0xf3e7=function(_0x5b09db,_0xff6a49){_0x5b09db=_0x5b09db-0x0;var _0x3a5475=_0x3e7f[_0x5b09db];return _0x3a5475;};'use strict';var Sequelize=require('sequelize');module[_0xf3e7('0x0')]={'MailInteractionId':{'type':Sequelize[_0xf3e7('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf3e7('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xf1ca=['INTEGER','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf1ca,0xa1));var _0xaf1c=function(_0xa22fd,_0x3463a3){_0xa22fd=_0xa22fd-0x0;var _0x5cc75d=_0xf1ca[_0xa22fd];return _0x5cc75d;};'use strict';var Sequelize=require('sequelize');module[_0xaf1c('0x0')]={'MailInteractionId':{'type':Sequelize[_0xaf1c('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index e1de4bc..a8178c9 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 _0x86cc=['api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','get','UserMailInteractions','UserProfileResource','error','stack','name','send','index','UserMailInteraction','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','type','merge','options','includeAll','include','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x29899f,_0xd8180d){var _0x239194=function(_0x3ed6c2){while(--_0x3ed6c2){_0x29899f['push'](_0x29899f['shift']());}};_0x239194(++_0xd8180d);}(_0x86cc,0x89));var _0xc86c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86cc[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc86c('0x0'));var emlformat=require(_0xc86c('0x1'));var rimraf=require(_0xc86c('0x2'));var zipdir=require(_0xc86c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc86c('0x4'));var moment=require(_0xc86c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc86c('0x6'));var util=require(_0xc86c('0x7'));var path=require('path');var sox=require(_0xc86c('0x8'));var csv=require(_0xc86c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc86c('0xa'));var squel=require(_0xc86c('0xb'));var crypto=require(_0xc86c('0xc'));var jsforce=require(_0xc86c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc86c('0x9'));var querystring=require(_0xc86c('0xe'));var Papa=require('papaparse');var Redis=require(_0xc86c('0xf'));var authService=require(_0xc86c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc86c('0x11'));var hardwareService=require(_0xc86c('0x12'));var logger=require('../../config/logger')(_0xc86c('0x13'));var utils=require('../../config/utils');var config=require(_0xc86c('0x14'));var licenseUtil=require(_0xc86c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c56ba,_0x2affef){_0x2affef=_0x2affef||0xcc;return function(_0x3a0959){if(_0x3a0959){return _0x5c56ba[_0xc86c('0x16')](_0x2affef);}return _0x5c56ba[_0xc86c('0x17')](_0x2affef)[_0xc86c('0x18')]();};}function respondWithResult(_0xd2644,_0x466680){_0x466680=_0x466680||0xc8;return function(_0x48947a){if(_0x48947a){return _0xd2644['status'](_0x466680)[_0xc86c('0x19')](_0x48947a);}};}function respondWithFilteredResult(_0x2a7572,_0x209f1c){return function(_0x2f1762){if(_0x2f1762){var _0x5e875c=_0x2f1762[_0xc86c('0x1a')],_0x8779af=_0x209f1c[_0xc86c('0x1b')],_0x14bb07=_0x209f1c['offset']+_0x209f1c[_0xc86c('0x1c')],_0xcb9cab;if(_0x14bb07>=_0x5e875c){_0x14bb07=_0x5e875c;_0xcb9cab=0xc8;}else{_0xcb9cab=0xce;}_0x2a7572[_0xc86c('0x17')](_0xcb9cab);return _0x2a7572[_0xc86c('0x1d')]('Content-Range',_0x8779af+'-'+_0x14bb07+'/'+_0x5e875c)['json'](_0x2f1762);}return null;};}function patchUpdates(_0x1065a3){return function(_0x26148e){try{jsonpatch[_0xc86c('0x1e')](_0x26148e,_0x1065a3,!![]);}catch(_0x3c2fb5){return BPromise[_0xc86c('0x1f')](_0x3c2fb5);}return _0x26148e['save']();};}function saveUpdates(_0x1665e8,_0x147794){return function(_0x17a011){if(_0x17a011){return _0x17a011[_0xc86c('0x20')](_0x1665e8)[_0xc86c('0x21')](function(_0xc98506){return _0xc98506;});}return null;};}function removeEntity(_0x4290ee,_0xcdfa4e){return function(_0x26b081){if(_0x26b081){return _0x26b081['destroy']()[_0xc86c('0x21')](function(){var _0x764e17=_0x26b081[_0xc86c('0x22')]({'plain':!![]});var _0x28a82e=_0xc86c('0x23');return db[_0xc86c('0x24')]['destroy']({'where':{'type':_0x28a82e,'resourceId':_0x764e17['id']}})[_0xc86c('0x21')](function(){return _0x26b081;});})[_0xc86c('0x21')](function(){_0x4290ee[_0xc86c('0x17')](0xcc)[_0xc86c('0x18')]();});}};}function handleEntityNotFound(_0x3596d9,_0x339572){return function(_0x393f78){if(!_0x393f78){_0x3596d9[_0xc86c('0x16')](0x194);}return _0x393f78;};}function handleError(_0x1719e5,_0x4d9c6d){_0x4d9c6d=_0x4d9c6d||0x1f4;return function(_0x1c20a1){logger[_0xc86c('0x25')](_0x1c20a1[_0xc86c('0x26')]);if(_0x1c20a1[_0xc86c('0x27')]){delete _0x1c20a1['name'];}_0x1719e5[_0xc86c('0x17')](_0x4d9c6d)[_0xc86c('0x28')](_0x1c20a1);};}exports[_0xc86c('0x29')]=function(_0x4b1fee,_0x33d59c){var _0x35c0c2={},_0x5d144f={},_0x49da66={'count':0x0,'rows':[]};var _0x3f2fb3=_['map'](db[_0xc86c('0x2a')][_0xc86c('0x2b')],function(_0xd276a9){return{'name':_0xd276a9[_0xc86c('0x2c')],'type':_0xd276a9['type'][_0xc86c('0x2d')]};});_0x5d144f[_0xc86c('0x2e')]=_['map'](_0x3f2fb3,_0xc86c('0x27'));_0x5d144f[_0xc86c('0x2f')]=_['keys'](_0x4b1fee[_0xc86c('0x2f')]);_0x5d144f['filters']=_[_0xc86c('0x30')](_0x5d144f[_0xc86c('0x2e')],_0x5d144f[_0xc86c('0x2f')]);_0x35c0c2[_0xc86c('0x31')]=_[_0xc86c('0x30')](_0x5d144f['model'],qs[_0xc86c('0x32')](_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x32')]));_0x35c0c2['attributes']=_0x35c0c2[_0xc86c('0x31')][_0xc86c('0x33')]?_0x35c0c2[_0xc86c('0x31')]:_0x5d144f[_0xc86c('0x2e')];if(!_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x34')](_0xc86c('0x35'))){_0x35c0c2[_0xc86c('0x1c')]=qs['limit'](_0x4b1fee['query'][_0xc86c('0x1c')]);_0x35c0c2[_0xc86c('0x1b')]=qs[_0xc86c('0x1b')](_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x1b')]);}_0x35c0c2[_0xc86c('0x36')]=qs[_0xc86c('0x37')](_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x37')]);_0x35c0c2[_0xc86c('0x38')]=qs['filters'](_[_0xc86c('0x39')](_0x4b1fee[_0xc86c('0x2f')],_0x5d144f[_0xc86c('0x3a')]),_0x3f2fb3);if(_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x3b')]){_0x35c0c2[_0xc86c('0x38')]=_['merge'](_0x35c0c2[_0xc86c('0x38')],{'$or':_[_0xc86c('0x3c')](_0x3f2fb3,function(_0x371a4b){if(_0x371a4b[_0xc86c('0x3d')]!=='VIRTUAL'){var _0x2f17d5={};_0x2f17d5[_0x371a4b[_0xc86c('0x27')]]={'$like':'%'+_0x4b1fee[_0xc86c('0x2f')]['filter']+'%'};return _0x2f17d5;}})});}_0x35c0c2=_[_0xc86c('0x3e')]({},_0x35c0c2,_0x4b1fee[_0xc86c('0x3f')]);var _0x252035={'where':_0x35c0c2[_0xc86c('0x38')]};return db['UserMailInteraction']['count'](_0x252035)[_0xc86c('0x21')](function(_0x53d5d){_0x49da66['count']=_0x53d5d;if(_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x40')]){_0x35c0c2[_0xc86c('0x41')]=[{'all':!![]}];}return db[_0xc86c('0x2a')]['findAll'](_0x35c0c2);})['then'](function(_0x400fd4){_0x49da66['rows']=_0x400fd4;return _0x49da66;})[_0xc86c('0x21')](respondWithFilteredResult(_0x33d59c,_0x35c0c2))[_0xc86c('0x42')](handleError(_0x33d59c,null));};exports[_0xc86c('0x43')]=function(_0x2be1d9,_0x5e9b77){var _0x2d38a5={'raw':!![],'where':{'id':_0x2be1d9[_0xc86c('0x44')]['id']}},_0x2a851c={};_0x2a851c[_0xc86c('0x2e')]=_[_0xc86c('0x45')](db[_0xc86c('0x2a')]['rawAttributes']);_0x2a851c[_0xc86c('0x2f')]=_['keys'](_0x2be1d9['query']);_0x2a851c[_0xc86c('0x3a')]=_[_0xc86c('0x30')](_0x2a851c[_0xc86c('0x2e')],_0x2a851c[_0xc86c('0x2f')]);_0x2d38a5[_0xc86c('0x31')]=_['intersection'](_0x2a851c[_0xc86c('0x2e')],qs['fields'](_0x2be1d9[_0xc86c('0x2f')][_0xc86c('0x32')]));_0x2d38a5[_0xc86c('0x31')]=_0x2d38a5['attributes']['length']?_0x2d38a5[_0xc86c('0x31')]:_0x2a851c[_0xc86c('0x2e')];if(_0x2be1d9[_0xc86c('0x2f')][_0xc86c('0x40')]){_0x2d38a5[_0xc86c('0x41')]=[{'all':!![]}];}_0x2d38a5=_['merge']({},_0x2d38a5,_0x2be1d9[_0xc86c('0x3f')]);return db[_0xc86c('0x2a')]['find'](_0x2d38a5)[_0xc86c('0x21')](handleEntityNotFound(_0x5e9b77,null))[_0xc86c('0x21')](respondWithResult(_0x5e9b77,null))[_0xc86c('0x42')](handleError(_0x5e9b77,null));};exports[_0xc86c('0x46')]=function(_0x4fab54,_0x2b120c){return db[_0xc86c('0x2a')]['create'](_0x4fab54[_0xc86c('0x47')],{})[_0xc86c('0x21')](function(_0xd3e78a){var _0xf03c72=_0x4fab54[_0xc86c('0x48')][_0xc86c('0x22')]({'plain':!![]});if(!_0xf03c72)throw new Error(_0xc86c('0x49'));if(_0xf03c72['role']===_0xc86c('0x48')){var _0x1f24ce=_0xd3e78a[_0xc86c('0x22')]({'plain':!![]});var _0x1625bf=_0xc86c('0x23');return db[_0xc86c('0x4a')]['find']({'where':{'name':_0x1625bf,'userProfileId':_0xf03c72['userProfileId']},'raw':!![]})['then'](function(_0x45bc4a){if(_0x45bc4a&&_0x45bc4a[_0xc86c('0x4b')]===0x0){return db['UserProfileResource'][_0xc86c('0x46')]({'name':_0x1f24ce[_0xc86c('0x27')],'resourceId':_0x1f24ce['id'],'type':_0x45bc4a[_0xc86c('0x27')],'sectionId':_0x45bc4a['id']},{})[_0xc86c('0x21')](function(){return _0xd3e78a;});}else{return _0xd3e78a;}})[_0xc86c('0x42')](function(_0x58c61a){logger[_0xc86c('0x25')](_0xc86c('0x4c'),_0x58c61a);throw _0x58c61a;});}return _0xd3e78a;})[_0xc86c('0x21')](respondWithResult(_0x2b120c,0xc9))[_0xc86c('0x42')](handleError(_0x2b120c,null));};exports[_0xc86c('0x20')]=function(_0x1ad08c,_0x16d57e){if(_0x1ad08c[_0xc86c('0x47')]['id']){delete _0x1ad08c[_0xc86c('0x47')]['id'];}return db['UserMailInteraction']['find']({'where':{'id':_0x1ad08c[_0xc86c('0x44')]['id']}})[_0xc86c('0x21')](handleEntityNotFound(_0x16d57e,null))[_0xc86c('0x21')](saveUpdates(_0x1ad08c['body'],null))[_0xc86c('0x21')](respondWithResult(_0x16d57e,null))['catch'](handleError(_0x16d57e,null));};exports[_0xc86c('0x4d')]=function(_0x337cf6,_0x24096b){return db['UserMailInteraction']['find']({'where':{'id':_0x337cf6[_0xc86c('0x44')]['id']}})[_0xc86c('0x21')](handleEntityNotFound(_0x24096b,null))[_0xc86c('0x21')](removeEntity(_0x24096b,null))[_0xc86c('0x42')](handleError(_0x24096b,null));}; \ No newline at end of file +var _0x0592=['key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserMailInteractions','UserProfileResource','error','stack','name','index','UserMailInteraction','fieldName','type'];(function(_0x339d7e,_0x58aa04){var _0x2f9fde=function(_0x1883a8){while(--_0x1883a8){_0x339d7e['push'](_0x339d7e['shift']());}};_0x2f9fde(++_0x58aa04);}(_0x0592,0x16c));var _0x2059=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0592[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x2059('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2059('0x1'));var zipdir=require(_0x2059('0x2'));var jsonpatch=require(_0x2059('0x3'));var rp=require(_0x2059('0x4'));var moment=require(_0x2059('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2059('0x6'));var util=require(_0x2059('0x7'));var path=require('path');var sox=require(_0x2059('0x8'));var csv=require(_0x2059('0x9'));var ejs=require(_0x2059('0xa'));var fs=require('fs');var _=require(_0x2059('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2059('0x9'));var querystring=require(_0x2059('0xc'));var Papa=require(_0x2059('0xd'));var Redis=require(_0x2059('0xe'));var authService=require(_0x2059('0xf'));var qs=require(_0x2059('0x10'));var as=require(_0x2059('0x11'));var hardwareService=require(_0x2059('0x12'));var logger=require(_0x2059('0x13'))(_0x2059('0x14'));var utils=require(_0x2059('0x15'));var config=require(_0x2059('0x16'));var licenseUtil=require(_0x2059('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33f0bc,_0x4337fb){_0x4337fb=_0x4337fb||0xcc;return function(_0x331f39){if(_0x331f39){return _0x33f0bc[_0x2059('0x18')](_0x4337fb);}return _0x33f0bc['status'](_0x4337fb)[_0x2059('0x19')]();};}function respondWithResult(_0x531d14,_0x281d94){_0x281d94=_0x281d94||0xc8;return function(_0x5d1007){if(_0x5d1007){return _0x531d14[_0x2059('0x1a')](_0x281d94)[_0x2059('0x1b')](_0x5d1007);}};}function respondWithFilteredResult(_0x4be0af,_0x27b310){return function(_0x1ab205){if(_0x1ab205){var _0x3e004d=_0x1ab205['count'],_0x18d35a=_0x27b310[_0x2059('0x1c')],_0xf16708=_0x27b310[_0x2059('0x1c')]+_0x27b310[_0x2059('0x1d')],_0x5717fc;if(_0xf16708>=_0x3e004d){_0xf16708=_0x3e004d;_0x5717fc=0xc8;}else{_0x5717fc=0xce;}_0x4be0af[_0x2059('0x1a')](_0x5717fc);return _0x4be0af['set'](_0x2059('0x1e'),_0x18d35a+'-'+_0xf16708+'/'+_0x3e004d)[_0x2059('0x1b')](_0x1ab205);}return null;};}function patchUpdates(_0x181f6c){return function(_0x5a5337){try{jsonpatch[_0x2059('0x1f')](_0x5a5337,_0x181f6c,!![]);}catch(_0x2a2ce2){return BPromise[_0x2059('0x20')](_0x2a2ce2);}return _0x5a5337[_0x2059('0x21')]();};}function saveUpdates(_0x19fd12,_0x46ae32){return function(_0xa7dfda){if(_0xa7dfda){return _0xa7dfda['update'](_0x19fd12)[_0x2059('0x22')](function(_0x1fa146){return _0x1fa146;});}return null;};}function removeEntity(_0x1f8a8f,_0x3590ce){return function(_0x284c56){if(_0x284c56){return _0x284c56[_0x2059('0x23')]()[_0x2059('0x22')](function(){var _0x376b31=_0x284c56[_0x2059('0x24')]({'plain':!![]});var _0x31259c=_0x2059('0x25');return db[_0x2059('0x26')][_0x2059('0x23')]({'where':{'type':_0x31259c,'resourceId':_0x376b31['id']}})[_0x2059('0x22')](function(){return _0x284c56;});})[_0x2059('0x22')](function(){_0x1f8a8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba098,_0x3e76aa){return function(_0x136c41){if(!_0x136c41){_0x3ba098[_0x2059('0x18')](0x194);}return _0x136c41;};}function handleError(_0x3b7adb,_0x50a3ef){_0x50a3ef=_0x50a3ef||0x1f4;return function(_0x26a89e){logger[_0x2059('0x27')](_0x26a89e[_0x2059('0x28')]);if(_0x26a89e[_0x2059('0x29')]){delete _0x26a89e[_0x2059('0x29')];}_0x3b7adb[_0x2059('0x1a')](_0x50a3ef)['send'](_0x26a89e);};}exports[_0x2059('0x2a')]=function(_0x56ae34,_0x408681){var _0x24e5d4={},_0x87f546={},_0x2c45ef={'count':0x0,'rows':[]};var _0x5d9c41=_['map'](db[_0x2059('0x2b')]['rawAttributes'],function(_0x2f70bf){return{'name':_0x2f70bf[_0x2059('0x2c')],'type':_0x2f70bf[_0x2059('0x2d')][_0x2059('0x2e')]};});_0x87f546[_0x2059('0x2f')]=_[_0x2059('0x30')](_0x5d9c41,_0x2059('0x29'));_0x87f546[_0x2059('0x31')]=_['keys'](_0x56ae34[_0x2059('0x31')]);_0x87f546[_0x2059('0x32')]=_[_0x2059('0x33')](_0x87f546[_0x2059('0x2f')],_0x87f546['query']);_0x24e5d4[_0x2059('0x34')]=_[_0x2059('0x33')](_0x87f546['model'],qs['fields'](_0x56ae34[_0x2059('0x31')][_0x2059('0x35')]));_0x24e5d4[_0x2059('0x34')]=_0x24e5d4[_0x2059('0x34')]['length']?_0x24e5d4[_0x2059('0x34')]:_0x87f546[_0x2059('0x2f')];if(!_0x56ae34[_0x2059('0x31')][_0x2059('0x36')]('nolimit')){_0x24e5d4[_0x2059('0x1d')]=qs[_0x2059('0x1d')](_0x56ae34[_0x2059('0x31')][_0x2059('0x1d')]);_0x24e5d4[_0x2059('0x1c')]=qs[_0x2059('0x1c')](_0x56ae34[_0x2059('0x31')][_0x2059('0x1c')]);}_0x24e5d4[_0x2059('0x37')]=qs[_0x2059('0x38')](_0x56ae34[_0x2059('0x31')][_0x2059('0x38')]);_0x24e5d4['where']=qs[_0x2059('0x32')](_[_0x2059('0x39')](_0x56ae34['query'],_0x87f546[_0x2059('0x32')]),_0x5d9c41);if(_0x56ae34[_0x2059('0x31')]['filter']){_0x24e5d4[_0x2059('0x3a')]=_['merge'](_0x24e5d4['where'],{'$or':_['map'](_0x5d9c41,function(_0x374d60){if(_0x374d60['type']!=='VIRTUAL'){var _0x1eb60b={};_0x1eb60b[_0x374d60[_0x2059('0x29')]]={'$like':'%'+_0x56ae34[_0x2059('0x31')][_0x2059('0x3b')]+'%'};return _0x1eb60b;}})});}_0x24e5d4=_[_0x2059('0x3c')]({},_0x24e5d4,_0x56ae34[_0x2059('0x3d')]);var _0x3cdf94={'where':_0x24e5d4['where']};return db[_0x2059('0x2b')][_0x2059('0x3e')](_0x3cdf94)['then'](function(_0x3a81bd){_0x2c45ef[_0x2059('0x3e')]=_0x3a81bd;if(_0x56ae34[_0x2059('0x31')][_0x2059('0x3f')]){_0x24e5d4[_0x2059('0x40')]=[{'all':!![]}];}return db[_0x2059('0x2b')][_0x2059('0x41')](_0x24e5d4);})[_0x2059('0x22')](function(_0x76bfbe){_0x2c45ef[_0x2059('0x42')]=_0x76bfbe;return _0x2c45ef;})[_0x2059('0x22')](respondWithFilteredResult(_0x408681,_0x24e5d4))[_0x2059('0x43')](handleError(_0x408681,null));};exports[_0x2059('0x44')]=function(_0x19e502,_0x52432d){var _0x551171={'raw':!![],'where':{'id':_0x19e502[_0x2059('0x45')]['id']}},_0x27254e={};_0x27254e['model']=_[_0x2059('0x46')](db['UserMailInteraction'][_0x2059('0x47')]);_0x27254e[_0x2059('0x31')]=_['keys'](_0x19e502[_0x2059('0x31')]);_0x27254e[_0x2059('0x32')]=_[_0x2059('0x33')](_0x27254e[_0x2059('0x2f')],_0x27254e['query']);_0x551171[_0x2059('0x34')]=_[_0x2059('0x33')](_0x27254e[_0x2059('0x2f')],qs[_0x2059('0x35')](_0x19e502[_0x2059('0x31')][_0x2059('0x35')]));_0x551171['attributes']=_0x551171['attributes'][_0x2059('0x48')]?_0x551171['attributes']:_0x27254e['model'];if(_0x19e502[_0x2059('0x31')][_0x2059('0x3f')]){_0x551171['include']=[{'all':!![]}];}_0x551171=_['merge']({},_0x551171,_0x19e502[_0x2059('0x3d')]);return db[_0x2059('0x2b')][_0x2059('0x49')](_0x551171)['then'](handleEntityNotFound(_0x52432d,null))['then'](respondWithResult(_0x52432d,null))[_0x2059('0x43')](handleError(_0x52432d,null));};exports[_0x2059('0x4a')]=function(_0x47077c,_0x577b79){return db[_0x2059('0x2b')][_0x2059('0x4a')](_0x47077c[_0x2059('0x4b')],{})[_0x2059('0x22')](function(_0x3d9068){var _0xc6312b=_0x47077c[_0x2059('0x4c')]['get']({'plain':!![]});if(!_0xc6312b)throw new Error(_0x2059('0x4d'));if(_0xc6312b[_0x2059('0x4e')]==='user'){var _0xedfe38=_0x3d9068[_0x2059('0x24')]({'plain':!![]});var _0x43be50='UserMailInteractions';return db['UserProfileSection'][_0x2059('0x49')]({'where':{'name':_0x43be50,'userProfileId':_0xc6312b[_0x2059('0x4f')]},'raw':!![]})[_0x2059('0x22')](function(_0x1e00f3){if(_0x1e00f3&&_0x1e00f3[_0x2059('0x50')]===0x0){return db[_0x2059('0x26')][_0x2059('0x4a')]({'name':_0xedfe38[_0x2059('0x29')],'resourceId':_0xedfe38['id'],'type':_0x1e00f3[_0x2059('0x29')],'sectionId':_0x1e00f3['id']},{})[_0x2059('0x22')](function(){return _0x3d9068;});}else{return _0x3d9068;}})[_0x2059('0x43')](function(_0x458c8a){logger[_0x2059('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x458c8a);throw _0x458c8a;});}return _0x3d9068;})[_0x2059('0x22')](respondWithResult(_0x577b79,0xc9))[_0x2059('0x43')](handleError(_0x577b79,null));};exports[_0x2059('0x51')]=function(_0xb0e74d,_0x32d79a){if(_0xb0e74d['body']['id']){delete _0xb0e74d[_0x2059('0x4b')]['id'];}return db[_0x2059('0x2b')][_0x2059('0x49')]({'where':{'id':_0xb0e74d[_0x2059('0x45')]['id']}})[_0x2059('0x22')](handleEntityNotFound(_0x32d79a,null))[_0x2059('0x22')](saveUpdates(_0xb0e74d['body'],null))[_0x2059('0x22')](respondWithResult(_0x32d79a,null))['catch'](handleError(_0x32d79a,null));};exports[_0x2059('0x23')]=function(_0xd6eebf,_0xb425a){return db['UserMailInteraction'][_0x2059('0x49')]({'where':{'id':_0xd6eebf[_0x2059('0x45')]['id']}})[_0x2059('0x22')](handleEntityNotFound(_0xb425a,null))[_0x2059('0x22')](removeEntity(_0xb425a,null))[_0x2059('0x43')](handleError(_0xb425a,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index cafb764..27824cc 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 _0x44f8=['../../config/logger','api','moment','bluebird','rimraf','define','UserMailInteraction','user_has_mail_interactions','lodash','util'];(function(_0x1a0404,_0x4d3114){var _0x499d19=function(_0x561c0e){while(--_0x561c0e){_0x1a0404['push'](_0x1a0404['shift']());}};_0x499d19(++_0x4d3114);}(_0x44f8,0x1de));var _0x844f=function(_0x15cab7,_0x51835a){_0x15cab7=_0x15cab7-0x0;var _0x1eba9c=_0x44f8[_0x15cab7];return _0x1eba9c;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var logger=require(_0x844f('0x2'))(_0x844f('0x3'));var moment=require(_0x844f('0x4'));var BPromise=require(_0x844f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x844f('0x6'));var config=require('../../config/environment');var attributes=require('./UserMailInteraction.attributes');module['exports']=function(_0xe654ca,_0x2cd42){return _0xe654ca[_0x844f('0x7')](_0x844f('0x8'),attributes,{'tableName':_0x844f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa195=['./UserMailInteraction.attributes','exports','define','UserMailInteraction','user_has_mail_interactions','lodash','util','api','moment','request-promise','rimraf'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0xa195,0x1b2));var _0x5a19=function(_0x2f3cee,_0x15ae32){_0x2f3cee=_0x2f3cee-0x0;var _0x2f1d56=_0xa195[_0x2f3cee];return _0x2f1d56;};'use strict';var _=require(_0x5a19('0x0'));var util=require(_0x5a19('0x1'));var logger=require('../../config/logger')(_0x5a19('0x2'));var moment=require(_0x5a19('0x3'));var BPromise=require('bluebird');var rp=require(_0x5a19('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a19('0x5'));var config=require('../../config/environment');var attributes=require(_0x5a19('0x6'));module[_0x5a19('0x7')]=function(_0x59873a,_0x3bdfd4){return _0x59873a[_0x5a19('0x8')](_0x5a19('0x9'),attributes,{'tableName':_0x5a19('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.rpc.js b/server/api/UserMailInteraction/UserMailInteraction.rpc.js index 49cb85c..5a7a636 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 _0x8200=['UserMailInteraction,\x20%s,\x20%s','request\x20sent','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x8200,0x18f));var _0x0820=function(_0x177644,_0x9ff3eb){_0x177644=_0x177644-0x0;var _0x398135=_0x8200[_0x177644];return _0x398135;};'use strict';var _=require(_0x0820('0x0'));var util=require(_0x0820('0x1'));var moment=require(_0x0820('0x2'));var BPromise=require(_0x0820('0x3'));var rs=require(_0x0820('0x4'));var fs=require('fs');var Redis=require(_0x0820('0x5'));var db=require(_0x0820('0x6'))['db'];var utils=require(_0x0820('0x7'));var logger=require(_0x0820('0x8'))('rpc');var config=require(_0x0820('0x9'));var jayson=require(_0x0820('0xa'));var client=jayson[_0x0820('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b56b1,_0x229670,_0x3c6e37){return new BPromise(function(_0x2ba761,_0x31893b){return client[_0x0820('0xc')](_0x1b56b1,_0x3c6e37)[_0x0820('0xd')](function(_0x2234f7){logger[_0x0820('0xe')](_0x0820('0xf'),_0x229670,_0x0820('0x10'));logger['debug'](_0x0820('0x11'),_0x229670,'request\x20sent',JSON[_0x0820('0x12')](_0x2234f7));if(_0x2234f7[_0x0820('0x13')]){if(_0x2234f7[_0x0820('0x13')]['code']===0x1f4){logger[_0x0820('0x13')](_0x0820('0xf'),_0x229670,_0x2234f7[_0x0820('0x13')][_0x0820('0x14')]);return _0x31893b(_0x2234f7[_0x0820('0x13')][_0x0820('0x14')]);}logger[_0x0820('0x13')](_0x0820('0xf'),_0x229670,_0x2234f7['error'][_0x0820('0x14')]);return _0x2ba761(_0x2234f7[_0x0820('0x13')][_0x0820('0x14')]);}else{logger[_0x0820('0xe')]('UserMailInteraction,\x20%s,\x20%s',_0x229670,'request\x20sent');_0x2ba761(_0x2234f7[_0x0820('0x15')]['message']);}})[_0x0820('0x16')](function(_0x157f8f){logger[_0x0820('0x13')](_0x0820('0xf'),_0x229670,_0x157f8f);_0x31893b(_0x157f8f);});});} \ No newline at end of file +var _0x4136=['then','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x1e09d9,_0x11b6d6){var _0x3eb0c0=function(_0x14cc93){while(--_0x14cc93){_0x1e09d9['push'](_0x1e09d9['shift']());}};_0x3eb0c0(++_0x11b6d6);}(_0x4136,0x1ee));var _0x6413=function(_0x49f944,_0x4302e4){_0x49f944=_0x49f944-0x0;var _0x1862f1=_0x4136[_0x49f944];return _0x1862f1;};'use strict';var _=require(_0x6413('0x0'));var util=require(_0x6413('0x1'));var moment=require(_0x6413('0x2'));var BPromise=require(_0x6413('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6413('0x4'));var db=require(_0x6413('0x5'))['db'];var utils=require(_0x6413('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6413('0x7'));var client=jayson[_0x6413('0x8')][_0x6413('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37ed72,_0x114d41,_0x8da0d1){return new BPromise(function(_0x38b624,_0x12bfb1){return client['request'](_0x37ed72,_0x8da0d1)[_0x6413('0xa')](function(_0x565ca7){logger[_0x6413('0xb')](_0x6413('0xc'),_0x114d41,_0x6413('0xd'));logger[_0x6413('0xe')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x114d41,_0x6413('0xd'),JSON[_0x6413('0xf')](_0x565ca7));if(_0x565ca7['error']){if(_0x565ca7[_0x6413('0x10')][_0x6413('0x11')]===0x1f4){logger[_0x6413('0x10')]('UserMailInteraction,\x20%s,\x20%s',_0x114d41,_0x565ca7['error'][_0x6413('0x12')]);return _0x12bfb1(_0x565ca7[_0x6413('0x10')]['message']);}logger[_0x6413('0x10')](_0x6413('0xc'),_0x114d41,_0x565ca7[_0x6413('0x10')][_0x6413('0x12')]);return _0x38b624(_0x565ca7[_0x6413('0x10')][_0x6413('0x12')]);}else{logger['info'](_0x6413('0xc'),_0x114d41,_0x6413('0xd'));_0x38b624(_0x565ca7[_0x6413('0x13')][_0x6413('0x12')]);}})[_0x6413('0x14')](function(_0x2ee471){logger[_0x6413('0x10')](_0x6413('0xc'),_0x114d41,_0x2ee471);_0x12bfb1(_0x2ee471);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index 0b80b0a..d23bdf7 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 _0x3eea=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','index','post','create','/:id','update','delete'];(function(_0x4cef81,_0x2cfe9c){var _0x5aab80=function(_0x57c349){while(--_0x57c349){_0x4cef81['push'](_0x4cef81['shift']());}};_0x5aab80(++_0x2cfe9c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x273680,_0x546b9d){_0x273680=_0x273680-0x0;var _0x1a4dc7=_0x3eea[_0x273680];return _0x1a4dc7;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var auth=require(_0xa3ee('0x5'));var interaction=require(_0xa3ee('0x6'));var config=require(_0xa3ee('0x7'));var controller=require(_0xa3ee('0x8'));router[_0xa3ee('0x9')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xb')]);router['get']('/:id',auth[_0xa3ee('0xa')](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0x11')]);module[_0xa3ee('0x12')]=router; \ No newline at end of file +var _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0xe5143f,_0x202789){var _0x207ad7=function(_0x258a89){while(--_0x258a89){_0xe5143f['push'](_0xe5143f['shift']());}};_0x207ad7(++_0x202789);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2eb2[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./UserMailInteraction.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 8a3c9eb..3f77aa6 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 _0x9adb=['sequelize','INTEGER'];(function(_0x55fa5c,_0x30bd41){var _0xea802f=function(_0x4bc014){while(--_0x4bc014){_0x55fa5c['push'](_0x55fa5c['shift']());}};_0xea802f(++_0x30bd41);}(_0x9adb,0x104));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb9ad('0x0'));module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0xb9ad('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xb9ad('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x3da0=['sequelize','exports','INTEGER'];(function(_0x3b18bd,_0xdff10f){var _0x132fcc=function(_0x3cb067){while(--_0x3cb067){_0x3b18bd['push'](_0x3b18bd['shift']());}};_0x132fcc(++_0xdff10f);}(_0x3da0,0x1e9));var _0x03da=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x3da0[_0x3207aa];return _0x51758f;};'use strict';var Sequelize=require(_0x03da('0x0'));module[_0x03da('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0x03da('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index a42effa..555d85b 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 _0x1591=['error','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserOpenchannelInteraction','UserProfileResource','destroy','end','sendStatus'];(function(_0x4b8ff0,_0x4e5481){var _0x2c18e4=function(_0x159df4){while(--_0x159df4){_0x4b8ff0['push'](_0x4b8ff0['shift']());}};_0x2c18e4(++_0x4e5481);}(_0x1591,0x128));var _0x1159=function(_0x209603,_0x351b88){_0x209603=_0x209603-0x0;var _0x3e06d4=_0x1591[_0x209603];return _0x3e06d4;};'use strict';var pdf=require(_0x1159('0x0'));var emlformat=require(_0x1159('0x1'));var rimraf=require(_0x1159('0x2'));var zipdir=require(_0x1159('0x3'));var jsonpatch=require(_0x1159('0x4'));var rp=require(_0x1159('0x5'));var moment=require(_0x1159('0x6'));var BPromise=require(_0x1159('0x7'));var Mustache=require(_0x1159('0x8'));var util=require(_0x1159('0x9'));var path=require(_0x1159('0xa'));var sox=require('sox');var csv=require(_0x1159('0xb'));var ejs=require(_0x1159('0xc'));var fs=require('fs');var _=require(_0x1159('0xd'));var squel=require('squel');var crypto=require(_0x1159('0xe'));var jsforce=require(_0x1159('0xf'));var deskjs=require(_0x1159('0x10'));var toCsv=require(_0x1159('0xb'));var querystring=require(_0x1159('0x11'));var Papa=require(_0x1159('0x12'));var Redis=require(_0x1159('0x13'));var authService=require(_0x1159('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1159('0x15'));var hardwareService=require(_0x1159('0x16'));var logger=require('../../config/logger')(_0x1159('0x17'));var utils=require(_0x1159('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1159('0x19'));var db=require(_0x1159('0x1a'))['db'];function respondWithStatusCode(_0x281706,_0x2e44fc){_0x2e44fc=_0x2e44fc||0xcc;return function(_0x2977d5){if(_0x2977d5){return _0x281706['sendStatus'](_0x2e44fc);}return _0x281706[_0x1159('0x1b')](_0x2e44fc)['end']();};}function respondWithResult(_0x450d19,_0x32039f){_0x32039f=_0x32039f||0xc8;return function(_0x18ff48){if(_0x18ff48){return _0x450d19[_0x1159('0x1b')](_0x32039f)[_0x1159('0x1c')](_0x18ff48);}};}function respondWithFilteredResult(_0x599958,_0x4d4772){return function(_0x15d173){if(_0x15d173){var _0x6b2a6b=_0x15d173[_0x1159('0x1d')],_0x1f004c=_0x4d4772[_0x1159('0x1e')],_0x49bab5=_0x4d4772['offset']+_0x4d4772[_0x1159('0x1f')],_0x348777;if(_0x49bab5>=_0x6b2a6b){_0x49bab5=_0x6b2a6b;_0x348777=0xc8;}else{_0x348777=0xce;}_0x599958[_0x1159('0x1b')](_0x348777);return _0x599958[_0x1159('0x20')](_0x1159('0x21'),_0x1f004c+'-'+_0x49bab5+'/'+_0x6b2a6b)[_0x1159('0x1c')](_0x15d173);}return null;};}function patchUpdates(_0x5ad707){return function(_0xd4e1d5){try{jsonpatch[_0x1159('0x22')](_0xd4e1d5,_0x5ad707,!![]);}catch(_0x2e8dda){return BPromise['reject'](_0x2e8dda);}return _0xd4e1d5[_0x1159('0x23')]();};}function saveUpdates(_0x3d466e,_0x2df54b){return function(_0x36e269){if(_0x36e269){return _0x36e269[_0x1159('0x24')](_0x3d466e)[_0x1159('0x25')](function(_0x23ea70){return _0x23ea70;});}return null;};}function removeEntity(_0x3b2cbb,_0x532e57){return function(_0x15ee54){if(_0x15ee54){return _0x15ee54['destroy']()[_0x1159('0x25')](function(){var _0x390ca3=_0x15ee54[_0x1159('0x26')]({'plain':!![]});var _0x5bb8ab=_0x1159('0x27');return db[_0x1159('0x28')][_0x1159('0x29')]({'where':{'type':_0x5bb8ab,'resourceId':_0x390ca3['id']}})[_0x1159('0x25')](function(){return _0x15ee54;});})[_0x1159('0x25')](function(){_0x3b2cbb[_0x1159('0x1b')](0xcc)[_0x1159('0x2a')]();});}};}function handleEntityNotFound(_0x5e3730,_0x46bf52){return function(_0x28dc30){if(!_0x28dc30){_0x5e3730[_0x1159('0x2b')](0x194);}return _0x28dc30;};}function handleError(_0x25d138,_0x455941){_0x455941=_0x455941||0x1f4;return function(_0x4004f1){logger[_0x1159('0x2c')](_0x4004f1['stack']);if(_0x4004f1[_0x1159('0x2d')]){delete _0x4004f1[_0x1159('0x2d')];}_0x25d138[_0x1159('0x1b')](_0x455941)[_0x1159('0x2e')](_0x4004f1);};}exports[_0x1159('0x2f')]=function(_0x375419,_0x3746ba){var _0x5b6956={},_0x4850a4={},_0xcf78de={'count':0x0,'rows':[]};var _0x3955ae=_[_0x1159('0x30')](db[_0x1159('0x27')][_0x1159('0x31')],function(_0x21640d){return{'name':_0x21640d['fieldName'],'type':_0x21640d[_0x1159('0x32')][_0x1159('0x33')]};});_0x4850a4[_0x1159('0x34')]=_[_0x1159('0x30')](_0x3955ae,_0x1159('0x2d'));_0x4850a4['query']=_['keys'](_0x375419[_0x1159('0x35')]);_0x4850a4[_0x1159('0x36')]=_[_0x1159('0x37')](_0x4850a4[_0x1159('0x34')],_0x4850a4['query']);_0x5b6956[_0x1159('0x38')]=_[_0x1159('0x37')](_0x4850a4[_0x1159('0x34')],qs[_0x1159('0x39')](_0x375419[_0x1159('0x35')]['fields']));_0x5b6956['attributes']=_0x5b6956[_0x1159('0x38')][_0x1159('0x3a')]?_0x5b6956[_0x1159('0x38')]:_0x4850a4['model'];if(!_0x375419[_0x1159('0x35')][_0x1159('0x3b')](_0x1159('0x3c'))){_0x5b6956[_0x1159('0x1f')]=qs[_0x1159('0x1f')](_0x375419[_0x1159('0x35')][_0x1159('0x1f')]);_0x5b6956[_0x1159('0x1e')]=qs['offset'](_0x375419[_0x1159('0x35')][_0x1159('0x1e')]);}_0x5b6956[_0x1159('0x3d')]=qs['sort'](_0x375419[_0x1159('0x35')][_0x1159('0x3e')]);_0x5b6956['where']=qs[_0x1159('0x36')](_[_0x1159('0x3f')](_0x375419[_0x1159('0x35')],_0x4850a4[_0x1159('0x36')]),_0x3955ae);if(_0x375419[_0x1159('0x35')][_0x1159('0x40')]){_0x5b6956['where']=_[_0x1159('0x41')](_0x5b6956[_0x1159('0x42')],{'$or':_[_0x1159('0x30')](_0x3955ae,function(_0x348668){if(_0x348668[_0x1159('0x32')]!==_0x1159('0x43')){var _0x24a0e6={};_0x24a0e6[_0x348668[_0x1159('0x2d')]]={'$like':'%'+_0x375419[_0x1159('0x35')][_0x1159('0x40')]+'%'};return _0x24a0e6;}})});}_0x5b6956=_[_0x1159('0x41')]({},_0x5b6956,_0x375419[_0x1159('0x44')]);var _0x495891={'where':_0x5b6956[_0x1159('0x42')]};return db[_0x1159('0x27')]['count'](_0x495891)[_0x1159('0x25')](function(_0x17e1da){_0xcf78de[_0x1159('0x1d')]=_0x17e1da;if(_0x375419[_0x1159('0x35')]['includeAll']){_0x5b6956[_0x1159('0x45')]=[{'all':!![]}];}return db[_0x1159('0x27')][_0x1159('0x46')](_0x5b6956);})[_0x1159('0x25')](function(_0x805cfc){_0xcf78de[_0x1159('0x47')]=_0x805cfc;return _0xcf78de;})[_0x1159('0x25')](respondWithFilteredResult(_0x3746ba,_0x5b6956))['catch'](handleError(_0x3746ba,null));};exports['show']=function(_0x44fb9f,_0x476954){var _0x3524e8={'raw':!![],'where':{'id':_0x44fb9f['params']['id']}},_0x55002={};_0x55002[_0x1159('0x34')]=_[_0x1159('0x48')](db[_0x1159('0x27')]['rawAttributes']);_0x55002[_0x1159('0x35')]=_['keys'](_0x44fb9f[_0x1159('0x35')]);_0x55002[_0x1159('0x36')]=_[_0x1159('0x37')](_0x55002['model'],_0x55002[_0x1159('0x35')]);_0x3524e8[_0x1159('0x38')]=_[_0x1159('0x37')](_0x55002[_0x1159('0x34')],qs[_0x1159('0x39')](_0x44fb9f[_0x1159('0x35')][_0x1159('0x39')]));_0x3524e8['attributes']=_0x3524e8[_0x1159('0x38')][_0x1159('0x3a')]?_0x3524e8[_0x1159('0x38')]:_0x55002['model'];if(_0x44fb9f[_0x1159('0x35')]['includeAll']){_0x3524e8['include']=[{'all':!![]}];}_0x3524e8=_['merge']({},_0x3524e8,_0x44fb9f[_0x1159('0x44')]);return db[_0x1159('0x27')][_0x1159('0x49')](_0x3524e8)[_0x1159('0x25')](handleEntityNotFound(_0x476954,null))[_0x1159('0x25')](respondWithResult(_0x476954,null))['catch'](handleError(_0x476954,null));};exports[_0x1159('0x4a')]=function(_0x4437c2,_0x1077fa){return db[_0x1159('0x27')][_0x1159('0x4a')](_0x4437c2[_0x1159('0x4b')],{})[_0x1159('0x25')](function(_0x2be994){var _0x144559=_0x4437c2[_0x1159('0x4c')]['get']({'plain':!![]});if(!_0x144559)throw new Error(_0x1159('0x4d'));if(_0x144559[_0x1159('0x4e')]==='user'){var _0x2df573=_0x2be994[_0x1159('0x26')]({'plain':!![]});var _0x85a96f='UserOpenchannelInteraction';return db[_0x1159('0x4f')][_0x1159('0x49')]({'where':{'name':_0x85a96f,'userProfileId':_0x144559[_0x1159('0x50')]},'raw':!![]})[_0x1159('0x25')](function(_0x584e32){if(_0x584e32&&_0x584e32[_0x1159('0x51')]===0x0){return db[_0x1159('0x28')]['create']({'name':_0x2df573[_0x1159('0x2d')],'resourceId':_0x2df573['id'],'type':_0x584e32[_0x1159('0x2d')],'sectionId':_0x584e32['id']},{})['then'](function(){return _0x2be994;});}else{return _0x2be994;}})[_0x1159('0x52')](function(_0x2d6e74){logger[_0x1159('0x2c')](_0x1159('0x53'),_0x2d6e74);throw _0x2d6e74;});}return _0x2be994;})[_0x1159('0x25')](respondWithResult(_0x1077fa,0xc9))['catch'](handleError(_0x1077fa,null));};exports['update']=function(_0x40702f,_0x1b6b44){if(_0x40702f[_0x1159('0x4b')]['id']){delete _0x40702f[_0x1159('0x4b')]['id'];}return db['UserOpenchannelInteraction'][_0x1159('0x49')]({'where':{'id':_0x40702f[_0x1159('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b6b44,null))['then'](saveUpdates(_0x40702f[_0x1159('0x4b')],null))[_0x1159('0x25')](respondWithResult(_0x1b6b44,null))[_0x1159('0x52')](handleError(_0x1b6b44,null));};exports[_0x1159('0x29')]=function(_0x2921cc,_0x3a6d03){return db['UserOpenchannelInteraction'][_0x1159('0x49')]({'where':{'id':_0x2921cc[_0x1159('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a6d03,null))[_0x1159('0x25')](removeEntity(_0x3a6d03,null))[_0x1159('0x52')](handleError(_0x3a6d03,null));}; \ No newline at end of file +var _0x79fd=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserOpenchannelInteraction','end','stack','name','send','map','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','role','user','userProfileId','UserProfileResource','error','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x79fd,0x1bd));var _0xd79f=function(_0x4d52a9,_0x56390b){_0x4d52a9=_0x4d52a9-0x0;var _0x260b49=_0x79fd[_0x4d52a9];return _0x260b49;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd79f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd79f('0x1'));var jsonpatch=require(_0xd79f('0x2'));var rp=require(_0xd79f('0x3'));var moment=require(_0xd79f('0x4'));var BPromise=require(_0xd79f('0x5'));var Mustache=require(_0xd79f('0x6'));var util=require(_0xd79f('0x7'));var path=require(_0xd79f('0x8'));var sox=require(_0xd79f('0x9'));var csv=require(_0xd79f('0xa'));var ejs=require(_0xd79f('0xb'));var fs=require('fs');var _=require(_0xd79f('0xc'));var squel=require(_0xd79f('0xd'));var crypto=require('crypto');var jsforce=require(_0xd79f('0xe'));var deskjs=require(_0xd79f('0xf'));var toCsv=require(_0xd79f('0xa'));var querystring=require(_0xd79f('0x10'));var Papa=require(_0xd79f('0x11'));var Redis=require(_0xd79f('0x12'));var authService=require(_0xd79f('0x13'));var qs=require(_0xd79f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd79f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd79f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd79f('0x17'));var db=require(_0xd79f('0x18'))['db'];function respondWithStatusCode(_0x26ec9c,_0x305678){_0x305678=_0x305678||0xcc;return function(_0x591a9e){if(_0x591a9e){return _0x26ec9c[_0xd79f('0x19')](_0x305678);}return _0x26ec9c['status'](_0x305678)['end']();};}function respondWithResult(_0x33a2ab,_0x48ac22){_0x48ac22=_0x48ac22||0xc8;return function(_0x59eace){if(_0x59eace){return _0x33a2ab[_0xd79f('0x1a')](_0x48ac22)[_0xd79f('0x1b')](_0x59eace);}};}function respondWithFilteredResult(_0x5b0b6f,_0x41ab5b){return function(_0x11db60){if(_0x11db60){var _0x5df802=_0x11db60['count'],_0x42aa00=_0x41ab5b[_0xd79f('0x1c')],_0xc58480=_0x41ab5b[_0xd79f('0x1c')]+_0x41ab5b[_0xd79f('0x1d')],_0x2561d3;if(_0xc58480>=_0x5df802){_0xc58480=_0x5df802;_0x2561d3=0xc8;}else{_0x2561d3=0xce;}_0x5b0b6f[_0xd79f('0x1a')](_0x2561d3);return _0x5b0b6f[_0xd79f('0x1e')](_0xd79f('0x1f'),_0x42aa00+'-'+_0xc58480+'/'+_0x5df802)['json'](_0x11db60);}return null;};}function patchUpdates(_0x319af5){return function(_0x5f2eff){try{jsonpatch[_0xd79f('0x20')](_0x5f2eff,_0x319af5,!![]);}catch(_0x508dd4){return BPromise[_0xd79f('0x21')](_0x508dd4);}return _0x5f2eff[_0xd79f('0x22')]();};}function saveUpdates(_0x45341f,_0x26f71d){return function(_0x478ea5){if(_0x478ea5){return _0x478ea5[_0xd79f('0x23')](_0x45341f)[_0xd79f('0x24')](function(_0x4a63e5){return _0x4a63e5;});}return null;};}function removeEntity(_0x59d249,_0x4abdbf){return function(_0x1c8f3b){if(_0x1c8f3b){return _0x1c8f3b[_0xd79f('0x25')]()[_0xd79f('0x24')](function(){var _0x51f5d2=_0x1c8f3b[_0xd79f('0x26')]({'plain':!![]});var _0xc7928f=_0xd79f('0x27');return db['UserProfileResource'][_0xd79f('0x25')]({'where':{'type':_0xc7928f,'resourceId':_0x51f5d2['id']}})[_0xd79f('0x24')](function(){return _0x1c8f3b;});})[_0xd79f('0x24')](function(){_0x59d249[_0xd79f('0x1a')](0xcc)[_0xd79f('0x28')]();});}};}function handleEntityNotFound(_0x204387,_0x609a44){return function(_0x52136a){if(!_0x52136a){_0x204387[_0xd79f('0x19')](0x194);}return _0x52136a;};}function handleError(_0x13bd59,_0x5ede33){_0x5ede33=_0x5ede33||0x1f4;return function(_0x39ef19){logger['error'](_0x39ef19[_0xd79f('0x29')]);if(_0x39ef19[_0xd79f('0x2a')]){delete _0x39ef19[_0xd79f('0x2a')];}_0x13bd59[_0xd79f('0x1a')](_0x5ede33)[_0xd79f('0x2b')](_0x39ef19);};}exports['index']=function(_0x2c5afe,_0x335ae2){var _0x70bb9d={},_0x3273f2={},_0x4a7346={'count':0x0,'rows':[]};var _0xfe9833=_[_0xd79f('0x2c')](db[_0xd79f('0x27')][_0xd79f('0x2d')],function(_0x42b70e){return{'name':_0x42b70e['fieldName'],'type':_0x42b70e[_0xd79f('0x2e')][_0xd79f('0x2f')]};});_0x3273f2[_0xd79f('0x30')]=_[_0xd79f('0x2c')](_0xfe9833,_0xd79f('0x2a'));_0x3273f2['query']=_[_0xd79f('0x31')](_0x2c5afe[_0xd79f('0x32')]);_0x3273f2['filters']=_['intersection'](_0x3273f2[_0xd79f('0x30')],_0x3273f2['query']);_0x70bb9d[_0xd79f('0x33')]=_[_0xd79f('0x34')](_0x3273f2[_0xd79f('0x30')],qs[_0xd79f('0x35')](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x35')]));_0x70bb9d[_0xd79f('0x33')]=_0x70bb9d['attributes'][_0xd79f('0x36')]?_0x70bb9d['attributes']:_0x3273f2['model'];if(!_0x2c5afe[_0xd79f('0x32')]['hasOwnProperty']('nolimit')){_0x70bb9d[_0xd79f('0x1d')]=qs[_0xd79f('0x1d')](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x1d')]);_0x70bb9d['offset']=qs['offset'](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x1c')]);}_0x70bb9d[_0xd79f('0x37')]=qs['sort'](_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x38')]);_0x70bb9d[_0xd79f('0x39')]=qs[_0xd79f('0x3a')](_[_0xd79f('0x3b')](_0x2c5afe[_0xd79f('0x32')],_0x3273f2[_0xd79f('0x3a')]),_0xfe9833);if(_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x3c')]){_0x70bb9d['where']=_[_0xd79f('0x3d')](_0x70bb9d['where'],{'$or':_[_0xd79f('0x2c')](_0xfe9833,function(_0x15b95c){if(_0x15b95c[_0xd79f('0x2e')]!=='VIRTUAL'){var _0x5cd640={};_0x5cd640[_0x15b95c[_0xd79f('0x2a')]]={'$like':'%'+_0x2c5afe[_0xd79f('0x32')][_0xd79f('0x3c')]+'%'};return _0x5cd640;}})});}_0x70bb9d=_['merge']({},_0x70bb9d,_0x2c5afe[_0xd79f('0x3e')]);var _0x796138={'where':_0x70bb9d['where']};return db[_0xd79f('0x27')][_0xd79f('0x3f')](_0x796138)['then'](function(_0x1f3e42){_0x4a7346[_0xd79f('0x3f')]=_0x1f3e42;if(_0x2c5afe['query'][_0xd79f('0x40')]){_0x70bb9d[_0xd79f('0x41')]=[{'all':!![]}];}return db['UserOpenchannelInteraction'][_0xd79f('0x42')](_0x70bb9d);})[_0xd79f('0x24')](function(_0x2431ab){_0x4a7346[_0xd79f('0x43')]=_0x2431ab;return _0x4a7346;})[_0xd79f('0x24')](respondWithFilteredResult(_0x335ae2,_0x70bb9d))[_0xd79f('0x44')](handleError(_0x335ae2,null));};exports[_0xd79f('0x45')]=function(_0xb105bb,_0x34cf5d){var _0x70c17a={'raw':!![],'where':{'id':_0xb105bb[_0xd79f('0x46')]['id']}},_0x1abfc3={};_0x1abfc3['model']=_[_0xd79f('0x31')](db[_0xd79f('0x27')][_0xd79f('0x2d')]);_0x1abfc3[_0xd79f('0x32')]=_[_0xd79f('0x31')](_0xb105bb[_0xd79f('0x32')]);_0x1abfc3[_0xd79f('0x3a')]=_['intersection'](_0x1abfc3['model'],_0x1abfc3[_0xd79f('0x32')]);_0x70c17a['attributes']=_[_0xd79f('0x34')](_0x1abfc3[_0xd79f('0x30')],qs[_0xd79f('0x35')](_0xb105bb[_0xd79f('0x32')][_0xd79f('0x35')]));_0x70c17a[_0xd79f('0x33')]=_0x70c17a['attributes'][_0xd79f('0x36')]?_0x70c17a['attributes']:_0x1abfc3[_0xd79f('0x30')];if(_0xb105bb[_0xd79f('0x32')][_0xd79f('0x40')]){_0x70c17a['include']=[{'all':!![]}];}_0x70c17a=_[_0xd79f('0x3d')]({},_0x70c17a,_0xb105bb[_0xd79f('0x3e')]);return db[_0xd79f('0x27')][_0xd79f('0x47')](_0x70c17a)[_0xd79f('0x24')](handleEntityNotFound(_0x34cf5d,null))[_0xd79f('0x24')](respondWithResult(_0x34cf5d,null))['catch'](handleError(_0x34cf5d,null));};exports[_0xd79f('0x48')]=function(_0x552bfa,_0x430377){return db[_0xd79f('0x27')][_0xd79f('0x48')](_0x552bfa[_0xd79f('0x49')],{})[_0xd79f('0x24')](function(_0x2e9a6b){var _0x4f9223=_0x552bfa['user'][_0xd79f('0x26')]({'plain':!![]});if(!_0x4f9223)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f9223[_0xd79f('0x4a')]===_0xd79f('0x4b')){var _0x52c324=_0x2e9a6b['get']({'plain':!![]});var _0x41e3d1='UserOpenchannelInteraction';return db['UserProfileSection'][_0xd79f('0x47')]({'where':{'name':_0x41e3d1,'userProfileId':_0x4f9223[_0xd79f('0x4c')]},'raw':!![]})['then'](function(_0x2d83f6){if(_0x2d83f6&&_0x2d83f6['autoAssociation']===0x0){return db[_0xd79f('0x4d')]['create']({'name':_0x52c324[_0xd79f('0x2a')],'resourceId':_0x52c324['id'],'type':_0x2d83f6['name'],'sectionId':_0x2d83f6['id']},{})[_0xd79f('0x24')](function(){return _0x2e9a6b;});}else{return _0x2e9a6b;}})[_0xd79f('0x44')](function(_0x2a7c3a){logger[_0xd79f('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a7c3a);throw _0x2a7c3a;});}return _0x2e9a6b;})['then'](respondWithResult(_0x430377,0xc9))['catch'](handleError(_0x430377,null));};exports[_0xd79f('0x23')]=function(_0x14f07b,_0x3bcff0){if(_0x14f07b['body']['id']){delete _0x14f07b[_0xd79f('0x49')]['id'];}return db[_0xd79f('0x27')][_0xd79f('0x47')]({'where':{'id':_0x14f07b[_0xd79f('0x46')]['id']}})[_0xd79f('0x24')](handleEntityNotFound(_0x3bcff0,null))[_0xd79f('0x24')](saveUpdates(_0x14f07b[_0xd79f('0x49')],null))['then'](respondWithResult(_0x3bcff0,null))[_0xd79f('0x44')](handleError(_0x3bcff0,null));};exports[_0xd79f('0x25')]=function(_0x54db72,_0xd266d9){return db['UserOpenchannelInteraction'][_0xd79f('0x47')]({'where':{'id':_0x54db72[_0xd79f('0x46')]['id']}})['then'](handleEntityNotFound(_0xd266d9,null))[_0xd79f('0x24')](removeEntity(_0xd266d9,null))[_0xd79f('0x44')](handleError(_0xd266d9,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index 2f11809..ca93a39 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 _0x6614=['rimraf','./UserOpenchannelInteraction.attributes','exports','define','UserOpenchannelInteraction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6614,0x1b2));var _0x4661=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x6614[_0x26cab7];return _0x31ba06;};'use strict';var _=require(_0x4661('0x0'));var util=require(_0x4661('0x1'));var logger=require(_0x4661('0x2'))(_0x4661('0x3'));var moment=require(_0x4661('0x4'));var BPromise=require(_0x4661('0x5'));var rp=require(_0x4661('0x6'));var fs=require('fs');var path=require(_0x4661('0x7'));var rimraf=require(_0x4661('0x8'));var config=require('../../config/environment');var attributes=require(_0x4661('0x9'));module[_0x4661('0xa')]=function(_0x2af48c,_0x25b243){return _0x2af48c[_0x4661('0xb')](_0x4661('0xc'),attributes,{'tableName':'user_has_openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f62=['user_has_openchannel_interactions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserOpenchannelInteraction.attributes','UserOpenchannelInteraction'];(function(_0x2351e5,_0x19f252){var _0x13d2c6=function(_0x4eb4bc){while(--_0x4eb4bc){_0x2351e5['push'](_0x2351e5['shift']());}};_0x13d2c6(++_0x19f252);}(_0x7f62,0x156));var _0x27f6=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0x7f62[_0x55ef8b];return _0x359c84;};'use strict';var _=require(_0x27f6('0x0'));var util=require(_0x27f6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x27f6('0x2'));var BPromise=require(_0x27f6('0x3'));var rp=require(_0x27f6('0x4'));var fs=require('fs');var path=require(_0x27f6('0x5'));var rimraf=require(_0x27f6('0x6'));var config=require(_0x27f6('0x7'));var attributes=require(_0x27f6('0x8'));module['exports']=function(_0xda306f,_0x112ec0){return _0xda306f['define'](_0x27f6('0x9'),attributes,{'tableName':_0x27f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js index 3a20a71..ebbf429 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 _0x5e1e=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x5e1e,0xe4));var _0xe5e1=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5e1e[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xe5e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe5e1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5e1('0x2'));var db=require(_0xe5e1('0x3'))['db'];var utils=require(_0xe5e1('0x4'));var logger=require(_0xe5e1('0x5'))(_0xe5e1('0x6'));var config=require(_0xe5e1('0x7'));var jayson=require(_0xe5e1('0x8'));var client=jayson[_0xe5e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18d438,_0x2d01d6,_0x585a31){return new BPromise(function(_0x221ea4,_0x327531){return client[_0xe5e1('0xa')](_0x18d438,_0x585a31)[_0xe5e1('0xb')](function(_0x1ffd69){logger[_0xe5e1('0xc')](_0xe5e1('0xd'),_0x2d01d6,_0xe5e1('0xe'));logger['debug']('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2d01d6,_0xe5e1('0xe'),JSON[_0xe5e1('0xf')](_0x1ffd69));if(_0x1ffd69[_0xe5e1('0x10')]){if(_0x1ffd69['error']['code']===0x1f4){logger['error'](_0xe5e1('0xd'),_0x2d01d6,_0x1ffd69[_0xe5e1('0x10')]['message']);return _0x327531(_0x1ffd69[_0xe5e1('0x10')]['message']);}logger[_0xe5e1('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x2d01d6,_0x1ffd69[_0xe5e1('0x10')]['message']);return _0x221ea4(_0x1ffd69[_0xe5e1('0x10')][_0xe5e1('0x11')]);}else{logger['info']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x2d01d6,'request\x20sent');_0x221ea4(_0x1ffd69[_0xe5e1('0x12')]['message']);}})['catch'](function(_0x3a0d6a){logger[_0xe5e1('0x10')](_0xe5e1('0xd'),_0x2d01d6,_0x3a0d6a);_0x327531(_0x3a0d6a);});});} \ No newline at end of file +var _0x2428=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserOpenchannelInteraction,\x20%s,\x20%s','error','message'];(function(_0x3ced99,_0x1101ed){var _0x528e12=function(_0x563284){while(--_0x563284){_0x3ced99['push'](_0x3ced99['shift']());}};_0x528e12(++_0x1101ed);}(_0x2428,0xd3));var _0x8242=function(_0x2ec06f,_0x560d3a){_0x2ec06f=_0x2ec06f-0x0;var _0x38d19c=_0x2428[_0x2ec06f];return _0x38d19c;};'use strict';var _=require('lodash');var util=require(_0x8242('0x0'));var moment=require(_0x8242('0x1'));var BPromise=require(_0x8242('0x2'));var rs=require(_0x8242('0x3'));var fs=require('fs');var Redis=require(_0x8242('0x4'));var db=require(_0x8242('0x5'))['db'];var utils=require(_0x8242('0x6'));var logger=require(_0x8242('0x7'))(_0x8242('0x8'));var config=require(_0x8242('0x9'));var jayson=require(_0x8242('0xa'));var client=jayson['client'][_0x8242('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11da5f,_0x3fb12e,_0x3712f3){return new BPromise(function(_0x1501e8,_0x4b9617){return client[_0x8242('0xc')](_0x11da5f,_0x3712f3)[_0x8242('0xd')](function(_0x12b115){logger[_0x8242('0xe')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x3fb12e,_0x8242('0xf'));logger[_0x8242('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3fb12e,_0x8242('0xf'),JSON['stringify'](_0x12b115));if(_0x12b115['error']){if(_0x12b115['error']['code']===0x1f4){logger['error'](_0x8242('0x11'),_0x3fb12e,_0x12b115[_0x8242('0x12')]['message']);return _0x4b9617(_0x12b115['error'][_0x8242('0x13')]);}logger[_0x8242('0x12')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x3fb12e,_0x12b115[_0x8242('0x12')]['message']);return _0x1501e8(_0x12b115[_0x8242('0x12')][_0x8242('0x13')]);}else{logger[_0x8242('0xe')](_0x8242('0x11'),_0x3fb12e,_0x8242('0xf'));_0x1501e8(_0x12b115[_0x8242('0x14')][_0x8242('0x13')]);}})['catch'](function(_0x4ad29d){logger[_0x8242('0x12')](_0x8242('0x11'),_0x3fb12e,_0x4ad29d);_0x4b9617(_0x4ad29d);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 84d382d..d11a97c 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 _0x9ef5=['multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','destroy','exports'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0x9ef5,0x190));var _0x59ef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9ef5[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x59ef('0x0'));var util=require(_0x59ef('0x1'));var path=require(_0x59ef('0x2'));var timeout=require(_0x59ef('0x3'));var express=require(_0x59ef('0x4'));var router=express[_0x59ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59ef('0x6'));var controller=require('./UserOpenchannelInteraction.controller');router[_0x59ef('0x7')]('/',auth[_0x59ef('0x8')](),controller['index']);router[_0x59ef('0x7')](_0x59ef('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x59ef('0xa')]('/',auth[_0x59ef('0x8')](),controller[_0x59ef('0xb')]);router[_0x59ef('0xc')](_0x59ef('0x9'),auth[_0x59ef('0x8')](),controller[_0x59ef('0xd')]);router['delete'](_0x59ef('0x9'),auth[_0x59ef('0x8')](),controller[_0x59ef('0xe')]);module[_0x59ef('0xf')]=router; \ No newline at end of file +var _0x4138=['../../config/environment','./UserOpenchannelInteraction.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xc9b877,_0x463ba9){var _0x1b77a0=function(_0x3a3917){while(--_0x3a3917){_0xc9b877['push'](_0xc9b877['shift']());}};_0x1b77a0(++_0x463ba9);}(_0x4138,0x93));var _0x8413=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4138[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x8413('0x0'));var util=require(_0x8413('0x1'));var path=require(_0x8413('0x2'));var timeout=require(_0x8413('0x3'));var express=require(_0x8413('0x4'));var router=express['Router']();var auth=require(_0x8413('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8413('0x6'));var controller=require(_0x8413('0x7'));router[_0x8413('0x8')]('/',auth[_0x8413('0x9')](),controller['index']);router[_0x8413('0x8')](_0x8413('0xa'),auth[_0x8413('0x9')](),controller[_0x8413('0xb')]);router['post']('/',auth[_0x8413('0x9')](),controller['create']);router[_0x8413('0xc')](_0x8413('0xa'),auth[_0x8413('0x9')](),controller[_0x8413('0xd')]);router[_0x8413('0xe')](_0x8413('0xa'),auth[_0x8413('0x9')](),controller[_0x8413('0xf')]);module[_0x8413('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 1c8b64d..2387d1f 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 _0xb984=['exports','INTEGER','sequelize'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb984,0x1a9));var _0x4b98=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb984[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x4b98('0x0'));module[_0x4b98('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x4b98('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x4b98('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x5598=['sequelize','exports','INTEGER'];(function(_0x324db7,_0x5b7b3f){var _0x20b62f=function(_0x5060fe){while(--_0x5060fe){_0x324db7['push'](_0x324db7['shift']());}};_0x20b62f(++_0x5b7b3f);}(_0x5598,0x111));var _0x8559=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x5598[_0x351509];return _0x4e9861;};'use strict';var Sequelize=require(_0x8559('0x0'));module[_0x8559('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x8559('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x8559('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index aff52fb..e7c96ad 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(_0xb2c521,_0x4f44bd){var _0x34a1ff=function(_0x5089ab){while(--_0x5089ab){_0xb2c521['push'](_0xb2c521['shift']());}};_0x34a1ff(++_0x4f44bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['update']=function(_0x53975a,_0x39d77d){if(_0x53975a[_0x0a9e('0x48')]['id']){delete _0x53975a[_0x0a9e('0x48')]['id'];}return db['UserSmsInteraction'][_0x0a9e('0x4e')]({'where':{'id':_0x53975a[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d77d,null))['then'](saveUpdates(_0x53975a[_0x0a9e('0x48')],null))['then'](respondWithResult(_0x39d77d,null))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports['destroy']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x2e5e62[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3c20b2,null))['then'](removeEntity(_0x3c20b2,null))['catch'](handleError(_0x3c20b2,null));}; \ No newline at end of file +var _0xa9e0=['destroy','then','UserSmsInteractions','UserProfileResource','stack','name','send','index','map','UserSmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4d916c,_0x5126de){var _0x1780fc=function(_0x482e7d){while(--_0x482e7d){_0x4d916c['push'](_0x4d916c['shift']());}};_0x1780fc(++_0x5126de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['update']=function(_0x53975a,_0x39d77d){if(_0x53975a[_0x0a9e('0x48')]['id']){delete _0x53975a[_0x0a9e('0x48')]['id'];}return db['UserSmsInteraction'][_0x0a9e('0x4e')]({'where':{'id':_0x53975a[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d77d,null))['then'](saveUpdates(_0x53975a[_0x0a9e('0x48')],null))['then'](respondWithResult(_0x39d77d,null))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports['destroy']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x2e5e62[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3c20b2,null))['then'](removeEntity(_0x3c20b2,null))['catch'](handleError(_0x3c20b2,null));}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.model.js b/server/api/UserSmsInteraction/UserSmsInteraction.model.js index 883f20a..27e7adc 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 _0xef46=['bluebird','request-promise','rimraf','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions','lodash','util','../../config/logger'];(function(_0x195060,_0x3b103a){var _0x42c980=function(_0x1460e9){while(--_0x1460e9){_0x195060['push'](_0x195060['shift']());}};_0x42c980(++_0x3b103a);}(_0xef46,0x75));var _0x6ef4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xef46[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x6ef4('0x0'));var util=require(_0x6ef4('0x1'));var logger=require(_0x6ef4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ef4('0x3'));var rp=require(_0x6ef4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ef4('0x5'));var config=require(_0x6ef4('0x6'));var attributes=require(_0x6ef4('0x7'));module[_0x6ef4('0x8')]=function(_0x5d582e,_0x31f8ad){return _0x5d582e[_0x6ef4('0x9')](_0x6ef4('0xa'),attributes,{'tableName':_0x6ef4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1de4=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x1de4,0x12b));var _0x41de=function(_0x413f1f,_0x2fc742){_0x413f1f=_0x413f1f-0x0;var _0x29372a=_0x1de4[_0x413f1f];return _0x29372a;};'use strict';var _=require(_0x41de('0x0'));var util=require(_0x41de('0x1'));var logger=require('../../config/logger')(_0x41de('0x2'));var moment=require('moment');var BPromise=require(_0x41de('0x3'));var rp=require(_0x41de('0x4'));var fs=require('fs');var path=require(_0x41de('0x5'));var rimraf=require(_0x41de('0x6'));var config=require(_0x41de('0x7'));var attributes=require(_0x41de('0x8'));module[_0x41de('0x9')]=function(_0x4c4371,_0xc295fd){return _0x4c4371[_0x41de('0xa')](_0x41de('0xb'),attributes,{'tableName':_0x41de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js index 6f1f613..69d20fa 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 _0x9a7e=['../../config/logger','client','http','request','then','info','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserSmsInteraction,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3ecc93,_0x572ff3){var _0x5bf899=function(_0x423df8){while(--_0x423df8){_0x3ecc93['push'](_0x3ecc93['shift']());}};_0x5bf899(++_0x572ff3);}(_0x9a7e,0x176));var _0xe9a7=function(_0x11f949,_0x2027a1){_0x11f949=_0x11f949-0x0;var _0x330bc1=_0x9a7e[_0x11f949];return _0x330bc1;};'use strict';var _=require(_0xe9a7('0x0'));var util=require(_0xe9a7('0x1'));var moment=require(_0xe9a7('0x2'));var BPromise=require(_0xe9a7('0x3'));var rs=require(_0xe9a7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9a7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe9a7('0x7')][_0xe9a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5db117,_0xd5a42d,_0x4c40f8){return new BPromise(function(_0x14ca09,_0xf1f14f){return client[_0xe9a7('0x9')](_0x5db117,_0x4c40f8)[_0xe9a7('0xa')](function(_0x3d5121){logger[_0xe9a7('0xb')]('UserSmsInteraction,\x20%s,\x20%s',_0xd5a42d,'request\x20sent');logger[_0xe9a7('0xc')](_0xe9a7('0xd'),_0xd5a42d,_0xe9a7('0xe'),JSON['stringify'](_0x3d5121));if(_0x3d5121[_0xe9a7('0xf')]){if(_0x3d5121[_0xe9a7('0xf')]['code']===0x1f4){logger[_0xe9a7('0xf')](_0xe9a7('0x10'),_0xd5a42d,_0x3d5121[_0xe9a7('0xf')]['message']);return _0xf1f14f(_0x3d5121[_0xe9a7('0xf')][_0xe9a7('0x11')]);}logger[_0xe9a7('0xf')](_0xe9a7('0x10'),_0xd5a42d,_0x3d5121[_0xe9a7('0xf')][_0xe9a7('0x11')]);return _0x14ca09(_0x3d5121['error'][_0xe9a7('0x11')]);}else{logger[_0xe9a7('0xb')](_0xe9a7('0x10'),_0xd5a42d,_0xe9a7('0xe'));_0x14ca09(_0x3d5121[_0xe9a7('0x12')][_0xe9a7('0x11')]);}})['catch'](function(_0x265203){logger[_0xe9a7('0xf')](_0xe9a7('0x10'),_0xd5a42d,_0x265203);_0xf1f14f(_0x265203);});});} \ No newline at end of file +var _0xa51a=['rpc','../../config/environment','jayson/promise','http','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2fbe5f,_0x4c5c13){var _0x21db60=function(_0x467893){while(--_0x467893){_0x2fbe5f['push'](_0x2fbe5f['shift']());}};_0x21db60(++_0x4c5c13);}(_0xa51a,0x14a));var _0xaa51=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa51a[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0xaa51('0x0'));var util=require('util');var moment=require(_0xaa51('0x1'));var BPromise=require(_0xaa51('0x2'));var rs=require(_0xaa51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa51('0x4'))['db'];var utils=require(_0xaa51('0x5'));var logger=require('../../config/logger')(_0xaa51('0x6'));var config=require(_0xaa51('0x7'));var jayson=require(_0xaa51('0x8'));var client=jayson['client'][_0xaa51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa9da,_0x372e9f,_0x144bda){return new BPromise(function(_0x2dbfbc,_0x3c2df8){return client['request'](_0x2aa9da,_0x144bda)['then'](function(_0x4aab35){logger['info'](_0xaa51('0xa'),_0x372e9f,_0xaa51('0xb'));logger[_0xaa51('0xc')](_0xaa51('0xd'),_0x372e9f,_0xaa51('0xb'),JSON[_0xaa51('0xe')](_0x4aab35));if(_0x4aab35[_0xaa51('0xf')]){if(_0x4aab35[_0xaa51('0xf')][_0xaa51('0x10')]===0x1f4){logger['error'](_0xaa51('0xa'),_0x372e9f,_0x4aab35[_0xaa51('0xf')][_0xaa51('0x11')]);return _0x3c2df8(_0x4aab35[_0xaa51('0xf')][_0xaa51('0x11')]);}logger[_0xaa51('0xf')](_0xaa51('0xa'),_0x372e9f,_0x4aab35[_0xaa51('0xf')]['message']);return _0x2dbfbc(_0x4aab35['error'][_0xaa51('0x11')]);}else{logger[_0xaa51('0x12')]('UserSmsInteraction,\x20%s,\x20%s',_0x372e9f,'request\x20sent');_0x2dbfbc(_0x4aab35[_0xaa51('0x13')]['message']);}})[_0xaa51('0x14')](function(_0x3878f8){logger[_0xaa51('0xf')](_0xaa51('0xa'),_0x372e9f,_0x3878f8);_0x3c2df8(_0x3878f8);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index d29641f..73eaa71 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 _0x4b97=['./UserSmsInteraction.controller','get','show','post','put','/:id','isAuthenticated','update','destroy','exports','multer','util','express','Router','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4b97,0x82));var _0x74b9=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4b97[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x74b9('0x0'));var util=require(_0x74b9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74b9('0x2'));var router=express[_0x74b9('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x74b9('0x4'));var controller=require(_0x74b9('0x5'));router[_0x74b9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x74b9('0x7')]);router[_0x74b9('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74b9('0x9')](_0x74b9('0xa'),auth[_0x74b9('0xb')](),controller[_0x74b9('0xc')]);router['delete'](_0x74b9('0xa'),auth[_0x74b9('0xb')](),controller[_0x74b9('0xd')]);module[_0x74b9('0xe')]=router; \ No newline at end of file +var _0xacad=['/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','index','isAuthenticated','show','create','put','update','delete'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xacad,0x133));var _0xdaca=function(_0x50408c,_0x486e25){_0x50408c=_0x50408c-0x0;var _0x4ff663=_0xacad[_0x50408c];return _0x4ff663;};'use strict';var multer=require(_0xdaca('0x0'));var util=require('util');var path=require(_0xdaca('0x1'));var timeout=require('connect-timeout');var express=require(_0xdaca('0x2'));var router=express[_0xdaca('0x3')]();var auth=require(_0xdaca('0x4'));var interaction=require(_0xdaca('0x5'));var config=require(_0xdaca('0x6'));var controller=require(_0xdaca('0x7'));router[_0xdaca('0x8')]('/',auth['isAuthenticated'](),controller[_0xdaca('0x9')]);router[_0xdaca('0x8')]('/:id',auth[_0xdaca('0xa')](),controller[_0xdaca('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdaca('0xc')]);router[_0xdaca('0xd')]('/:id',auth[_0xdaca('0xa')](),controller[_0xdaca('0xe')]);router[_0xdaca('0xf')](_0xdaca('0x10'),auth[_0xdaca('0xa')](),controller[_0xdaca('0x11')]);module[_0xdaca('0x12')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index 6036c85..de314f4 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 _0x921a=['sequelize','INTEGER'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x921a,0x1ce));var _0xa921=function(_0x87bd38,_0x49210a){_0x87bd38=_0x87bd38-0x0;var _0x1cd50f=_0x921a[_0x87bd38];return _0x1cd50f;};'use strict';var Sequelize=require(_0xa921('0x0'));module['exports']={'WhatsappInteractionId':{'type':Sequelize[_0xa921('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0xa0af=['exports','INTEGER','sequelize'];(function(_0x256239,_0x407308){var _0x3bb9bb=function(_0x46c307){while(--_0x46c307){_0x256239['push'](_0x256239['shift']());}};_0x3bb9bb(++_0x407308);}(_0xa0af,0x185));var _0xfa0a=function(_0x42556c,_0x2bc292){_0x42556c=_0x42556c-0x0;var _0x24e27d=_0xa0af[_0x42556c];return _0x24e27d;};'use strict';var Sequelize=require(_0xfa0a('0x0'));module[_0xfa0a('0x1')]={'WhatsappInteractionId':{'type':Sequelize[_0xfa0a('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xfa0a('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index 4a940e9..9a00a34 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 _0x6be4=['destroy','error','stack','name','send','index','UserWhatsappInteraction','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','user','get','UserProfileSection','find','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','UserWhatsappInteractions','UserProfileResource'];(function(_0x15e8b2,_0x12315d){var _0x207a4e=function(_0x2fb8f7){while(--_0x2fb8f7){_0x15e8b2['push'](_0x15e8b2['shift']());}};_0x207a4e(++_0x12315d);}(_0x6be4,0x74));var _0x46be=function(_0x16e092,_0x5d55fc){_0x16e092=_0x16e092-0x0;var _0x13e6b1=_0x6be4[_0x16e092];return _0x13e6b1;};'use strict';var pdf=require(_0x46be('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x46be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46be('0x2'));var rp=require(_0x46be('0x3'));var moment=require(_0x46be('0x4'));var BPromise=require(_0x46be('0x5'));var Mustache=require(_0x46be('0x6'));var util=require(_0x46be('0x7'));var path=require('path');var sox=require(_0x46be('0x8'));var csv=require(_0x46be('0x9'));var ejs=require(_0x46be('0xa'));var fs=require('fs');var _=require(_0x46be('0xb'));var squel=require('squel');var crypto=require(_0x46be('0xc'));var jsforce=require(_0x46be('0xd'));var deskjs=require(_0x46be('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x46be('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46be('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46be('0x11'));var logger=require('../../config/logger')(_0x46be('0x12'));var utils=require('../../config/utils');var config=require(_0x46be('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x46be('0x14'))['db'];function respondWithStatusCode(_0x5281e0,_0x16f592){_0x16f592=_0x16f592||0xcc;return function(_0x1f8754){if(_0x1f8754){return _0x5281e0[_0x46be('0x15')](_0x16f592);}return _0x5281e0[_0x46be('0x16')](_0x16f592)[_0x46be('0x17')]();};}function respondWithResult(_0x52fd06,_0x3e4e96){_0x3e4e96=_0x3e4e96||0xc8;return function(_0x3f9c38){if(_0x3f9c38){return _0x52fd06['status'](_0x3e4e96)[_0x46be('0x18')](_0x3f9c38);}};}function respondWithFilteredResult(_0x18d7e0,_0x158dde){return function(_0x57de98){if(_0x57de98){var _0x54df63=_0x57de98[_0x46be('0x19')],_0x2e3e74=_0x158dde[_0x46be('0x1a')],_0x27baeb=_0x158dde[_0x46be('0x1a')]+_0x158dde[_0x46be('0x1b')],_0xc05bd8;if(_0x27baeb>=_0x54df63){_0x27baeb=_0x54df63;_0xc05bd8=0xc8;}else{_0xc05bd8=0xce;}_0x18d7e0[_0x46be('0x16')](_0xc05bd8);return _0x18d7e0[_0x46be('0x1c')](_0x46be('0x1d'),_0x2e3e74+'-'+_0x27baeb+'/'+_0x54df63)[_0x46be('0x18')](_0x57de98);}return null;};}function patchUpdates(_0x3850ad){return function(_0x4e1ef8){try{jsonpatch['apply'](_0x4e1ef8,_0x3850ad,!![]);}catch(_0xd342dd){return BPromise[_0x46be('0x1e')](_0xd342dd);}return _0x4e1ef8[_0x46be('0x1f')]();};}function saveUpdates(_0xf01c21,_0x21ae97){return function(_0x310f5b){if(_0x310f5b){return _0x310f5b[_0x46be('0x20')](_0xf01c21)[_0x46be('0x21')](function(_0x1d52e4){return _0x1d52e4;});}return null;};}function removeEntity(_0x44129d,_0x141fac){return function(_0x426ce0){if(_0x426ce0){return _0x426ce0['destroy']()[_0x46be('0x21')](function(){var _0x5abd5d=_0x426ce0['get']({'plain':!![]});var _0x23755a=_0x46be('0x22');return db[_0x46be('0x23')][_0x46be('0x24')]({'where':{'type':_0x23755a,'resourceId':_0x5abd5d['id']}})[_0x46be('0x21')](function(){return _0x426ce0;});})[_0x46be('0x21')](function(){_0x44129d[_0x46be('0x16')](0xcc)[_0x46be('0x17')]();});}};}function handleEntityNotFound(_0x1f15e3,_0x4d1add){return function(_0x43eefe){if(!_0x43eefe){_0x1f15e3[_0x46be('0x15')](0x194);}return _0x43eefe;};}function handleError(_0x5dfb27,_0x3f2bd2){_0x3f2bd2=_0x3f2bd2||0x1f4;return function(_0x5bdf0b){logger[_0x46be('0x25')](_0x5bdf0b[_0x46be('0x26')]);if(_0x5bdf0b['name']){delete _0x5bdf0b[_0x46be('0x27')];}_0x5dfb27[_0x46be('0x16')](_0x3f2bd2)[_0x46be('0x28')](_0x5bdf0b);};}exports[_0x46be('0x29')]=function(_0x38bc77,_0x5cd483){var _0x4f3444={},_0x21259b={},_0xc87680={'count':0x0,'rows':[]};var _0x45fcc6=_['map'](db[_0x46be('0x2a')][_0x46be('0x2b')],function(_0x20787c){return{'name':_0x20787c['fieldName'],'type':_0x20787c['type']['key']};});_0x21259b[_0x46be('0x2c')]=_[_0x46be('0x2d')](_0x45fcc6,_0x46be('0x27'));_0x21259b['query']=_[_0x46be('0x2e')](_0x38bc77[_0x46be('0x2f')]);_0x21259b[_0x46be('0x30')]=_[_0x46be('0x31')](_0x21259b[_0x46be('0x2c')],_0x21259b[_0x46be('0x2f')]);_0x4f3444[_0x46be('0x32')]=_[_0x46be('0x31')](_0x21259b[_0x46be('0x2c')],qs[_0x46be('0x33')](_0x38bc77[_0x46be('0x2f')][_0x46be('0x33')]));_0x4f3444[_0x46be('0x32')]=_0x4f3444[_0x46be('0x32')][_0x46be('0x34')]?_0x4f3444[_0x46be('0x32')]:_0x21259b[_0x46be('0x2c')];if(!_0x38bc77['query']['hasOwnProperty'](_0x46be('0x35'))){_0x4f3444[_0x46be('0x1b')]=qs[_0x46be('0x1b')](_0x38bc77[_0x46be('0x2f')][_0x46be('0x1b')]);_0x4f3444[_0x46be('0x1a')]=qs[_0x46be('0x1a')](_0x38bc77['query']['offset']);}_0x4f3444[_0x46be('0x36')]=qs['sort'](_0x38bc77[_0x46be('0x2f')][_0x46be('0x37')]);_0x4f3444[_0x46be('0x38')]=qs[_0x46be('0x30')](_[_0x46be('0x39')](_0x38bc77[_0x46be('0x2f')],_0x21259b[_0x46be('0x30')]),_0x45fcc6);if(_0x38bc77['query'][_0x46be('0x3a')]){_0x4f3444[_0x46be('0x38')]=_[_0x46be('0x3b')](_0x4f3444[_0x46be('0x38')],{'$or':_[_0x46be('0x2d')](_0x45fcc6,function(_0x2f3c7f){if(_0x2f3c7f[_0x46be('0x3c')]!==_0x46be('0x3d')){var _0x5c6ab7={};_0x5c6ab7[_0x2f3c7f['name']]={'$like':'%'+_0x38bc77[_0x46be('0x2f')][_0x46be('0x3a')]+'%'};return _0x5c6ab7;}})});}_0x4f3444=_[_0x46be('0x3b')]({},_0x4f3444,_0x38bc77[_0x46be('0x3e')]);var _0x52082f={'where':_0x4f3444[_0x46be('0x38')]};return db['UserWhatsappInteraction'][_0x46be('0x19')](_0x52082f)[_0x46be('0x21')](function(_0x4d8e27){_0xc87680[_0x46be('0x19')]=_0x4d8e27;if(_0x38bc77[_0x46be('0x2f')]['includeAll']){_0x4f3444['include']=[{'all':!![]}];}return db['UserWhatsappInteraction'][_0x46be('0x3f')](_0x4f3444);})[_0x46be('0x21')](function(_0x4913e5){_0xc87680[_0x46be('0x40')]=_0x4913e5;return _0xc87680;})[_0x46be('0x21')](respondWithFilteredResult(_0x5cd483,_0x4f3444))[_0x46be('0x41')](handleError(_0x5cd483,null));};exports[_0x46be('0x42')]=function(_0xdbb92f,_0x25da6f){var _0x49a04c={'raw':!![],'where':{'id':_0xdbb92f[_0x46be('0x43')]['id']}},_0x1065db={};_0x1065db[_0x46be('0x2c')]=_[_0x46be('0x2e')](db[_0x46be('0x2a')]['rawAttributes']);_0x1065db['query']=_[_0x46be('0x2e')](_0xdbb92f[_0x46be('0x2f')]);_0x1065db['filters']=_[_0x46be('0x31')](_0x1065db['model'],_0x1065db[_0x46be('0x2f')]);_0x49a04c[_0x46be('0x32')]=_[_0x46be('0x31')](_0x1065db[_0x46be('0x2c')],qs[_0x46be('0x33')](_0xdbb92f['query'][_0x46be('0x33')]));_0x49a04c[_0x46be('0x32')]=_0x49a04c[_0x46be('0x32')][_0x46be('0x34')]?_0x49a04c['attributes']:_0x1065db['model'];if(_0xdbb92f[_0x46be('0x2f')][_0x46be('0x44')]){_0x49a04c[_0x46be('0x45')]=[{'all':!![]}];}_0x49a04c=_[_0x46be('0x3b')]({},_0x49a04c,_0xdbb92f[_0x46be('0x3e')]);return db[_0x46be('0x2a')]['find'](_0x49a04c)[_0x46be('0x21')](handleEntityNotFound(_0x25da6f,null))['then'](respondWithResult(_0x25da6f,null))[_0x46be('0x41')](handleError(_0x25da6f,null));};exports[_0x46be('0x46')]=function(_0x102574,_0x5c2ca3){return db[_0x46be('0x2a')]['create'](_0x102574['body'],{})['then'](function(_0x2bcd97){var _0x3e6e9f=_0x102574[_0x46be('0x47')][_0x46be('0x48')]({'plain':!![]});if(!_0x3e6e9f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e6e9f['role']===_0x46be('0x47')){var _0x5e2c9a=_0x2bcd97[_0x46be('0x48')]({'plain':!![]});var _0x1473fb=_0x46be('0x22');return db[_0x46be('0x49')][_0x46be('0x4a')]({'where':{'name':_0x1473fb,'userProfileId':_0x3e6e9f['userProfileId']},'raw':!![]})[_0x46be('0x21')](function(_0x237124){if(_0x237124&&_0x237124['autoAssociation']===0x0){return db[_0x46be('0x23')][_0x46be('0x46')]({'name':_0x5e2c9a[_0x46be('0x27')],'resourceId':_0x5e2c9a['id'],'type':_0x237124[_0x46be('0x27')],'sectionId':_0x237124['id']},{})[_0x46be('0x21')](function(){return _0x2bcd97;});}else{return _0x2bcd97;}})[_0x46be('0x41')](function(_0x3ed527){logger[_0x46be('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ed527);throw _0x3ed527;});}return _0x2bcd97;})[_0x46be('0x21')](respondWithResult(_0x5c2ca3,0xc9))[_0x46be('0x41')](handleError(_0x5c2ca3,null));};exports[_0x46be('0x20')]=function(_0x503965,_0x119ae5){if(_0x503965[_0x46be('0x4b')]['id']){delete _0x503965[_0x46be('0x4b')]['id'];}return db['UserWhatsappInteraction'][_0x46be('0x4a')]({'where':{'id':_0x503965[_0x46be('0x43')]['id']}})[_0x46be('0x21')](handleEntityNotFound(_0x119ae5,null))[_0x46be('0x21')](saveUpdates(_0x503965[_0x46be('0x4b')],null))[_0x46be('0x21')](respondWithResult(_0x119ae5,null))[_0x46be('0x41')](handleError(_0x119ae5,null));};exports[_0x46be('0x24')]=function(_0x3c9d32,_0x4317ea){return db['UserWhatsappInteraction']['find']({'where':{'id':_0x3c9d32[_0x46be('0x43')]['id']}})['then'](handleEntityNotFound(_0x4317ea,null))[_0x46be('0x21')](removeEntity(_0x4317ea,null))[_0x46be('0x41')](handleError(_0x4317ea,null));}; \ No newline at end of file +var _0xb9b4=['UserWhatsappInteraction','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','Content-Range','json','reject','save','then','destroy','get','UserWhatsappInteractions','end','error','name','send','map'];(function(_0x1ee6de,_0x46794e){var _0x4d9c17=function(_0x5ec731){while(--_0x5ec731){_0x1ee6de['push'](_0x1ee6de['shift']());}};_0x4d9c17(++_0x46794e);}(_0xb9b4,0x1a8));var _0x4b9b=function(_0x120578,_0x565b59){_0x120578=_0x120578-0x0;var _0x5a0bed=_0xb9b4[_0x120578];return _0x5a0bed;};'use strict';var pdf=require(_0x4b9b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b9b('0x2'));var rp=require('request-promise');var moment=require(_0x4b9b('0x3'));var BPromise=require(_0x4b9b('0x4'));var Mustache=require(_0x4b9b('0x5'));var util=require(_0x4b9b('0x6'));var path=require(_0x4b9b('0x7'));var sox=require(_0x4b9b('0x8'));var csv=require(_0x4b9b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4b9b('0xa'));var squel=require(_0x4b9b('0xb'));var crypto=require('crypto');var jsforce=require(_0x4b9b('0xc'));var deskjs=require(_0x4b9b('0xd'));var toCsv=require(_0x4b9b('0x9'));var querystring=require('querystring');var Papa=require(_0x4b9b('0xe'));var Redis=require(_0x4b9b('0xf'));var authService=require(_0x4b9b('0x10'));var qs=require(_0x4b9b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b9b('0x12'));var utils=require(_0x4b9b('0x13'));var config=require(_0x4b9b('0x14'));var licenseUtil=require(_0x4b9b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d87f6,_0x30051b){_0x30051b=_0x30051b||0xcc;return function(_0x5bc30b){if(_0x5bc30b){return _0x5d87f6[_0x4b9b('0x16')](_0x30051b);}return _0x5d87f6['status'](_0x30051b)['end']();};}function respondWithResult(_0xead097,_0x2e5338){_0x2e5338=_0x2e5338||0xc8;return function(_0x25140e){if(_0x25140e){return _0xead097[_0x4b9b('0x17')](_0x2e5338)['json'](_0x25140e);}};}function respondWithFilteredResult(_0x405a51,_0x5186a0){return function(_0x442656){if(_0x442656){var _0x3e342e=_0x442656['count'],_0x4b974c=_0x5186a0[_0x4b9b('0x18')],_0x5b9497=_0x5186a0[_0x4b9b('0x18')]+_0x5186a0['limit'],_0x3b1953;if(_0x5b9497>=_0x3e342e){_0x5b9497=_0x3e342e;_0x3b1953=0xc8;}else{_0x3b1953=0xce;}_0x405a51[_0x4b9b('0x17')](_0x3b1953);return _0x405a51['set'](_0x4b9b('0x19'),_0x4b974c+'-'+_0x5b9497+'/'+_0x3e342e)[_0x4b9b('0x1a')](_0x442656);}return null;};}function patchUpdates(_0x34572e){return function(_0x56489e){try{jsonpatch['apply'](_0x56489e,_0x34572e,!![]);}catch(_0x4f094f){return BPromise[_0x4b9b('0x1b')](_0x4f094f);}return _0x56489e[_0x4b9b('0x1c')]();};}function saveUpdates(_0x15c795,_0x2676fe){return function(_0x36293c){if(_0x36293c){return _0x36293c['update'](_0x15c795)[_0x4b9b('0x1d')](function(_0x535703){return _0x535703;});}return null;};}function removeEntity(_0x10cf74,_0xa05e03){return function(_0xfdbbf){if(_0xfdbbf){return _0xfdbbf[_0x4b9b('0x1e')]()[_0x4b9b('0x1d')](function(){var _0x13319e=_0xfdbbf[_0x4b9b('0x1f')]({'plain':!![]});var _0x10615d=_0x4b9b('0x20');return db['UserProfileResource'][_0x4b9b('0x1e')]({'where':{'type':_0x10615d,'resourceId':_0x13319e['id']}})[_0x4b9b('0x1d')](function(){return _0xfdbbf;});})['then'](function(){_0x10cf74[_0x4b9b('0x17')](0xcc)[_0x4b9b('0x21')]();});}};}function handleEntityNotFound(_0x435df5,_0xaacabe){return function(_0x7d4fdd){if(!_0x7d4fdd){_0x435df5['sendStatus'](0x194);}return _0x7d4fdd;};}function handleError(_0x2b184f,_0x2c5330){_0x2c5330=_0x2c5330||0x1f4;return function(_0x2a87e7){logger[_0x4b9b('0x22')](_0x2a87e7['stack']);if(_0x2a87e7[_0x4b9b('0x23')]){delete _0x2a87e7[_0x4b9b('0x23')];}_0x2b184f[_0x4b9b('0x17')](_0x2c5330)[_0x4b9b('0x24')](_0x2a87e7);};}exports['index']=function(_0xa11164,_0x33cc9e){var _0x107185={},_0xc65d0={},_0x514fbf={'count':0x0,'rows':[]};var _0x6065e7=_[_0x4b9b('0x25')](db[_0x4b9b('0x26')]['rawAttributes'],function(_0x2bd1e0){return{'name':_0x2bd1e0[_0x4b9b('0x27')],'type':_0x2bd1e0['type'][_0x4b9b('0x28')]};});_0xc65d0[_0x4b9b('0x29')]=_[_0x4b9b('0x25')](_0x6065e7,_0x4b9b('0x23'));_0xc65d0[_0x4b9b('0x2a')]=_[_0x4b9b('0x2b')](_0xa11164[_0x4b9b('0x2a')]);_0xc65d0['filters']=_[_0x4b9b('0x2c')](_0xc65d0[_0x4b9b('0x29')],_0xc65d0[_0x4b9b('0x2a')]);_0x107185['attributes']=_[_0x4b9b('0x2c')](_0xc65d0[_0x4b9b('0x29')],qs[_0x4b9b('0x2d')](_0xa11164[_0x4b9b('0x2a')]['fields']));_0x107185['attributes']=_0x107185[_0x4b9b('0x2e')][_0x4b9b('0x2f')]?_0x107185[_0x4b9b('0x2e')]:_0xc65d0[_0x4b9b('0x29')];if(!_0xa11164[_0x4b9b('0x2a')]['hasOwnProperty'](_0x4b9b('0x30'))){_0x107185[_0x4b9b('0x31')]=qs[_0x4b9b('0x31')](_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x31')]);_0x107185['offset']=qs[_0x4b9b('0x18')](_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x18')]);}_0x107185[_0x4b9b('0x32')]=qs['sort'](_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x33')]);_0x107185[_0x4b9b('0x34')]=qs[_0x4b9b('0x35')](_['pick'](_0xa11164[_0x4b9b('0x2a')],_0xc65d0[_0x4b9b('0x35')]),_0x6065e7);if(_0xa11164[_0x4b9b('0x2a')][_0x4b9b('0x36')]){_0x107185[_0x4b9b('0x34')]=_[_0x4b9b('0x37')](_0x107185[_0x4b9b('0x34')],{'$or':_['map'](_0x6065e7,function(_0x10516c){if(_0x10516c[_0x4b9b('0x38')]!==_0x4b9b('0x39')){var _0x4b7ba6={};_0x4b7ba6[_0x10516c[_0x4b9b('0x23')]]={'$like':'%'+_0xa11164[_0x4b9b('0x2a')]['filter']+'%'};return _0x4b7ba6;}})});}_0x107185=_[_0x4b9b('0x37')]({},_0x107185,_0xa11164[_0x4b9b('0x3a')]);var _0x585047={'where':_0x107185['where']};return db[_0x4b9b('0x26')]['count'](_0x585047)[_0x4b9b('0x1d')](function(_0x502e1f){_0x514fbf[_0x4b9b('0x3b')]=_0x502e1f;if(_0xa11164[_0x4b9b('0x2a')]['includeAll']){_0x107185[_0x4b9b('0x3c')]=[{'all':!![]}];}return db[_0x4b9b('0x26')][_0x4b9b('0x3d')](_0x107185);})['then'](function(_0x5a2b66){_0x514fbf[_0x4b9b('0x3e')]=_0x5a2b66;return _0x514fbf;})[_0x4b9b('0x1d')](respondWithFilteredResult(_0x33cc9e,_0x107185))[_0x4b9b('0x3f')](handleError(_0x33cc9e,null));};exports[_0x4b9b('0x40')]=function(_0x158d7d,_0x10cf99){var _0x5ed1b6={'raw':!![],'where':{'id':_0x158d7d[_0x4b9b('0x41')]['id']}},_0x4638d7={};_0x4638d7[_0x4b9b('0x29')]=_[_0x4b9b('0x2b')](db[_0x4b9b('0x26')][_0x4b9b('0x42')]);_0x4638d7[_0x4b9b('0x2a')]=_[_0x4b9b('0x2b')](_0x158d7d[_0x4b9b('0x2a')]);_0x4638d7[_0x4b9b('0x35')]=_[_0x4b9b('0x2c')](_0x4638d7['model'],_0x4638d7[_0x4b9b('0x2a')]);_0x5ed1b6[_0x4b9b('0x2e')]=_[_0x4b9b('0x2c')](_0x4638d7[_0x4b9b('0x29')],qs[_0x4b9b('0x2d')](_0x158d7d[_0x4b9b('0x2a')]['fields']));_0x5ed1b6[_0x4b9b('0x2e')]=_0x5ed1b6[_0x4b9b('0x2e')][_0x4b9b('0x2f')]?_0x5ed1b6[_0x4b9b('0x2e')]:_0x4638d7[_0x4b9b('0x29')];if(_0x158d7d[_0x4b9b('0x2a')][_0x4b9b('0x43')]){_0x5ed1b6[_0x4b9b('0x3c')]=[{'all':!![]}];}_0x5ed1b6=_['merge']({},_0x5ed1b6,_0x158d7d[_0x4b9b('0x3a')]);return db[_0x4b9b('0x26')][_0x4b9b('0x44')](_0x5ed1b6)[_0x4b9b('0x1d')](handleEntityNotFound(_0x10cf99,null))[_0x4b9b('0x1d')](respondWithResult(_0x10cf99,null))['catch'](handleError(_0x10cf99,null));};exports[_0x4b9b('0x45')]=function(_0x1f060e,_0x497b31){return db[_0x4b9b('0x26')][_0x4b9b('0x45')](_0x1f060e[_0x4b9b('0x46')],{})['then'](function(_0xde800c){var _0x52d7a6=_0x1f060e[_0x4b9b('0x47')][_0x4b9b('0x1f')]({'plain':!![]});if(!_0x52d7a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52d7a6['role']==='user'){var _0x45db0f=_0xde800c[_0x4b9b('0x1f')]({'plain':!![]});var _0x43dbad=_0x4b9b('0x20');return db[_0x4b9b('0x48')][_0x4b9b('0x44')]({'where':{'name':_0x43dbad,'userProfileId':_0x52d7a6[_0x4b9b('0x49')]},'raw':!![]})[_0x4b9b('0x1d')](function(_0xf73c0){if(_0xf73c0&&_0xf73c0['autoAssociation']===0x0){return db[_0x4b9b('0x4a')][_0x4b9b('0x45')]({'name':_0x45db0f['name'],'resourceId':_0x45db0f['id'],'type':_0xf73c0['name'],'sectionId':_0xf73c0['id']},{})[_0x4b9b('0x1d')](function(){return _0xde800c;});}else{return _0xde800c;}})['catch'](function(_0x2ed11a){logger['error'](_0x4b9b('0x4b'),_0x2ed11a);throw _0x2ed11a;});}return _0xde800c;})[_0x4b9b('0x1d')](respondWithResult(_0x497b31,0xc9))[_0x4b9b('0x3f')](handleError(_0x497b31,null));};exports[_0x4b9b('0x4c')]=function(_0x4b4e47,_0x3f81b7){if(_0x4b4e47['body']['id']){delete _0x4b4e47['body']['id'];}return db[_0x4b9b('0x26')]['find']({'where':{'id':_0x4b4e47[_0x4b9b('0x41')]['id']}})[_0x4b9b('0x1d')](handleEntityNotFound(_0x3f81b7,null))['then'](saveUpdates(_0x4b4e47['body'],null))[_0x4b9b('0x1d')](respondWithResult(_0x3f81b7,null))['catch'](handleError(_0x3f81b7,null));};exports[_0x4b9b('0x1e')]=function(_0x54b6a0,_0x9257c0){return db[_0x4b9b('0x26')]['find']({'where':{'id':_0x54b6a0[_0x4b9b('0x41')]['id']}})['then'](handleEntityNotFound(_0x9257c0,null))[_0x4b9b('0x1d')](removeEntity(_0x9257c0,null))[_0x4b9b('0x3f')](handleError(_0x9257c0,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index b96384e..98c9e77 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 _0xd201=['path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','UserWhatsappInteraction','user_has_whatsapp_interactions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2cb3cd,_0x500a27){var _0x36982f=function(_0x539ddb){while(--_0x539ddb){_0x2cb3cd['push'](_0x2cb3cd['shift']());}};_0x36982f(++_0x500a27);}(_0xd201,0x1ce));var _0x1d20=function(_0x40cd61,_0x36162c){_0x40cd61=_0x40cd61-0x0;var _0x120ce8=_0xd201[_0x40cd61];return _0x120ce8;};'use strict';var _=require('lodash');var util=require(_0x1d20('0x0'));var logger=require(_0x1d20('0x1'))(_0x1d20('0x2'));var moment=require(_0x1d20('0x3'));var BPromise=require(_0x1d20('0x4'));var rp=require(_0x1d20('0x5'));var fs=require('fs');var path=require(_0x1d20('0x6'));var rimraf=require(_0x1d20('0x7'));var config=require(_0x1d20('0x8'));var attributes=require(_0x1d20('0x9'));module[_0x1d20('0xa')]=function(_0x56f541,_0x307902){return _0x56f541['define'](_0x1d20('0xb'),attributes,{'tableName':_0x1d20('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb0=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./UserWhatsappInteraction.attributes','UserWhatsappInteraction'];(function(_0x67f6f,_0xe598d9){var _0x306716=function(_0x26b8bc){while(--_0x26b8bc){_0x67f6f['push'](_0x67f6f['shift']());}};_0x306716(++_0xe598d9);}(_0x2eb0,0x1d6));var _0x02eb=function(_0x148ff6,_0x377c0e){_0x148ff6=_0x148ff6-0x0;var _0x3aa3c8=_0x2eb0[_0x148ff6];return _0x3aa3c8;};'use strict';var _=require(_0x02eb('0x0'));var util=require(_0x02eb('0x1'));var logger=require(_0x02eb('0x2'))('api');var moment=require(_0x02eb('0x3'));var BPromise=require(_0x02eb('0x4'));var rp=require(_0x02eb('0x5'));var fs=require('fs');var path=require(_0x02eb('0x6'));var rimraf=require(_0x02eb('0x7'));var config=require('../../config/environment');var attributes=require(_0x02eb('0x8'));module['exports']=function(_0xcf6a8e,_0xb36eff){return _0xcf6a8e['define'](_0x02eb('0x9'),attributes,{'tableName':'user_has_whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js index 6c0f388..1da5767 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 _0xf66e=['http','request','then','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappInteraction,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9ae6e2,_0x3d04f6){var _0x522cb0=function(_0x98b800){while(--_0x98b800){_0x9ae6e2['push'](_0x9ae6e2['shift']());}};_0x522cb0(++_0x3d04f6);}(_0xf66e,0x1d4));var _0xef66=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf66e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xef66('0x0'));var util=require(_0xef66('0x1'));var moment=require(_0xef66('0x2'));var BPromise=require(_0xef66('0x3'));var rs=require(_0xef66('0x4'));var fs=require('fs');var Redis=require(_0xef66('0x5'));var db=require(_0xef66('0x6'))['db'];var utils=require(_0xef66('0x7'));var logger=require(_0xef66('0x8'))(_0xef66('0x9'));var config=require(_0xef66('0xa'));var jayson=require(_0xef66('0xb'));var client=jayson['client'][_0xef66('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cfb89,_0x7d6699,_0x114d9c){return new BPromise(function(_0x1b4237,_0x40e1c5){return client[_0xef66('0xd')](_0x2cfb89,_0x114d9c)[_0xef66('0xe')](function(_0x46ff31){logger['info']('UserWhatsappInteraction,\x20%s,\x20%s',_0x7d6699,_0xef66('0xf'));logger[_0xef66('0x10')](_0xef66('0x11'),_0x7d6699,_0xef66('0xf'),JSON[_0xef66('0x12')](_0x46ff31));if(_0x46ff31[_0xef66('0x13')]){if(_0x46ff31[_0xef66('0x13')]['code']===0x1f4){logger[_0xef66('0x13')](_0xef66('0x14'),_0x7d6699,_0x46ff31[_0xef66('0x13')][_0xef66('0x15')]);return _0x40e1c5(_0x46ff31['error'][_0xef66('0x15')]);}logger[_0xef66('0x13')](_0xef66('0x14'),_0x7d6699,_0x46ff31[_0xef66('0x13')][_0xef66('0x15')]);return _0x1b4237(_0x46ff31['error']['message']);}else{logger[_0xef66('0x16')](_0xef66('0x14'),_0x7d6699,_0xef66('0xf'));_0x1b4237(_0x46ff31['result']['message']);}})[_0xef66('0x17')](function(_0x2b5919){logger[_0xef66('0x13')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x7d6699,_0x2b5919);_0x40e1c5(_0x2b5919);});});} \ No newline at end of file +var _0xa8d6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','randomstring','../../config/logger'];(function(_0x5b5f75,_0x468d75){var _0x52fd79=function(_0x2d0fa0){while(--_0x2d0fa0){_0x5b5f75['push'](_0x5b5f75['shift']());}};_0x52fd79(++_0x468d75);}(_0xa8d6,0x18b));var _0x6a8d=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xa8d6[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6a8d('0x0'));var util=require(_0x6a8d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a8d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a8d('0x3'))(_0x6a8d('0x4'));var config=require(_0x6a8d('0x5'));var jayson=require(_0x6a8d('0x6'));var client=jayson[_0x6a8d('0x7')][_0x6a8d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b4bcd,_0x2dd18c,_0x6a09bd){return new BPromise(function(_0x6b4c2e,_0x382367){return client[_0x6a8d('0x9')](_0x3b4bcd,_0x6a09bd)[_0x6a8d('0xa')](function(_0x346d4b){logger[_0x6a8d('0xb')](_0x6a8d('0xc'),_0x2dd18c,'request\x20sent');logger[_0x6a8d('0xd')](_0x6a8d('0xe'),_0x2dd18c,'request\x20sent',JSON[_0x6a8d('0xf')](_0x346d4b));if(_0x346d4b[_0x6a8d('0x10')]){if(_0x346d4b['error']['code']===0x1f4){logger[_0x6a8d('0x10')](_0x6a8d('0xc'),_0x2dd18c,_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);return _0x382367(_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);}logger['error'](_0x6a8d('0xc'),_0x2dd18c,_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);return _0x6b4c2e(_0x346d4b[_0x6a8d('0x10')][_0x6a8d('0x11')]);}else{logger[_0x6a8d('0xb')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x2dd18c,_0x6a8d('0x12'));_0x6b4c2e(_0x346d4b[_0x6a8d('0x13')][_0x6a8d('0x11')]);}})[_0x6a8d('0x14')](function(_0x2a2004){logger[_0x6a8d('0x10')](_0x6a8d('0xc'),_0x2dd18c,_0x2a2004);_0x382367(_0x2a2004);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index 45d66cf..f68fe0f 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 _0x9bc3=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./UserWhatsappInteraction.controller','get'];(function(_0x1b4b94,_0x4793ac){var _0x5951c0=function(_0x553b97){while(--_0x553b97){_0x1b4b94['push'](_0x1b4b94['shift']());}};_0x5951c0(++_0x4793ac);}(_0x9bc3,0x137));var _0x39bc=function(_0x3d057c,_0x339ca1){_0x3d057c=_0x3d057c-0x0;var _0x2b861c=_0x9bc3[_0x3d057c];return _0x2b861c;};'use strict';var multer=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var path=require(_0x39bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x39bc('0x3'));var router=express[_0x39bc('0x4')]();var auth=require(_0x39bc('0x5'));var interaction=require(_0x39bc('0x6'));var config=require('../../config/environment');var controller=require(_0x39bc('0x7'));router[_0x39bc('0x8')]('/',auth[_0x39bc('0x9')](),controller[_0x39bc('0xa')]);router['get'](_0x39bc('0xb'),auth[_0x39bc('0x9')](),controller[_0x39bc('0xc')]);router[_0x39bc('0xd')]('/',auth[_0x39bc('0x9')](),controller[_0x39bc('0xe')]);router[_0x39bc('0xf')](_0x39bc('0xb'),auth['isAuthenticated'](),controller[_0x39bc('0x10')]);router[_0x39bc('0x11')](_0x39bc('0xb'),auth[_0x39bc('0x9')](),controller[_0x39bc('0x12')]);module[_0x39bc('0x13')]=router; \ No newline at end of file +var _0xc2e8=['multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','update','delete','destroy','exports'];(function(_0x5c1da0,_0x38529f){var _0x12bf5e=function(_0x2471fe){while(--_0x2471fe){_0x5c1da0['push'](_0x5c1da0['shift']());}};_0x12bf5e(++_0x38529f);}(_0xc2e8,0x70));var _0x8c2e=function(_0x59d375,_0x33e59c){_0x59d375=_0x59d375-0x0;var _0x570a20=_0xc2e8[_0x59d375];return _0x570a20;};'use strict';var multer=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c2e('0x2'));var router=express['Router']();var auth=require(_0x8c2e('0x3'));var interaction=require(_0x8c2e('0x4'));var config=require(_0x8c2e('0x5'));var controller=require('./UserWhatsappInteraction.controller');router[_0x8c2e('0x6')]('/',auth[_0x8c2e('0x7')](),controller[_0x8c2e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8c2e('0x7')](),controller[_0x8c2e('0x9')]);router[_0x8c2e('0xa')](_0x8c2e('0xb'),auth[_0x8c2e('0x7')](),controller[_0x8c2e('0xc')]);router[_0x8c2e('0xd')](_0x8c2e('0xb'),auth['isAuthenticated'](),controller[_0x8c2e('0xe')]);module[_0x8c2e('0xf')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 026a841..f01d014 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 _0xeabc=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','urlForward','browser'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xeabc,0x19f));var _0xceab=function(_0x2dcc56,_0x374a4f){_0x2dcc56=_0x2dcc56-0x0;var _0x422898=_0xeabc[_0x2dcc56];return _0x422898;};'use strict';var Sequelize=require(_0xceab('0x0'));module[_0xceab('0x1')]={'name':{'type':Sequelize[_0xceab('0x2')],'get':function(_0xf152b3){return this[_0xceab('0x3')]('action');}},'action':{'type':Sequelize[_0xceab('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xceab('0x5'),_0xceab('0x6'),_0xceab('0x7'),'jscripty',_0xceab('0x8'),_0xceab('0x9'),_0xceab('0xa'),_0xceab('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xceab('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xceab('0xd')},'data2':{'type':Sequelize[_0xceab('0x4')](0x1000),'comment':_0xceab('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xceab('0xf')},'data4':{'type':Sequelize[_0xceab('0x4')](0x1000)},'data5':{'type':Sequelize[_0xceab('0x4')](0x1000)},'data6':{'type':Sequelize[_0xceab('0x4')]},'data7':{'type':Sequelize[_0xceab('0x10')]}}; \ No newline at end of file +var _0xfd9f=['urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfd9f,0xa2));var _0xffd9=function(_0x1f41b9,_0x5661e5){_0x1f41b9=_0x1f41b9-0x0;var _0x1ede03=_0xfd9f[_0x1f41b9];return _0x1ede03;};'use strict';var Sequelize=require(_0xffd9('0x0'));module[_0xffd9('0x1')]={'name':{'type':Sequelize[_0xffd9('0x2')],'get':function(_0x50a0fa){return this[_0xffd9('0x3')](_0xffd9('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xffd9('0x5'),_0xffd9('0x6'),_0xffd9('0x7'),'jscripty',_0xffd9('0x8'),_0xffd9('0x9'),_0xffd9('0xa'),_0xffd9('0xb')]],'msg':_0xffd9('0xc')}},'comment':_0xffd9('0xc')},'data1':{'type':Sequelize[_0xffd9('0xd')](0x1000),'comment':_0xffd9('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xffd9('0xf')},'data3':{'type':Sequelize[_0xffd9('0xd')](0x1000),'comment':_0xffd9('0x10')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0xffd9('0xd')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c5a7c76..7378134 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 _0x9a14=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','Action','params','catch','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x299af8,_0x1cb852){var _0x361cbd=function(_0x2dcfbb){while(--_0x2dcfbb){_0x299af8['push'](_0x299af8['shift']());}};_0x361cbd(++_0x1cb852);}(_0x9a14,0xa8));var _0x49a1=function(_0x38ea20,_0x4e9081){_0x38ea20=_0x38ea20-0x0;var _0x508e50=_0x9a14[_0x38ea20];return _0x508e50;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49a1('0x0'));var zipdir=require(_0x49a1('0x1'));var jsonpatch=require(_0x49a1('0x2'));var rp=require(_0x49a1('0x3'));var moment=require(_0x49a1('0x4'));var BPromise=require(_0x49a1('0x5'));var Mustache=require(_0x49a1('0x6'));var util=require(_0x49a1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x49a1('0x8'));var squel=require(_0x49a1('0x9'));var crypto=require(_0x49a1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x49a1('0xb'));var toCsv=require(_0x49a1('0xc'));var querystring=require(_0x49a1('0xd'));var Papa=require('papaparse');var Redis=require(_0x49a1('0xe'));var authService=require(_0x49a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x49a1('0x10'));var hardwareService=require(_0x49a1('0x11'));var logger=require(_0x49a1('0x12'))(_0x49a1('0x13'));var utils=require(_0x49a1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x49a1('0x15'));var db=require(_0x49a1('0x16'))['db'];function respondWithStatusCode(_0x380db3,_0x58101a){_0x58101a=_0x58101a||0xcc;return function(_0x20138b){if(_0x20138b){return _0x380db3[_0x49a1('0x17')](_0x58101a);}return _0x380db3[_0x49a1('0x18')](_0x58101a)[_0x49a1('0x19')]();};}function respondWithResult(_0x35f2fd,_0x6bce27){_0x6bce27=_0x6bce27||0xc8;return function(_0x278713){if(_0x278713){return _0x35f2fd[_0x49a1('0x18')](_0x6bce27)[_0x49a1('0x1a')](_0x278713);}};}function respondWithFilteredResult(_0x39676e,_0x13fe24){return function(_0x5c6d06){if(_0x5c6d06){var _0x27dff1=_0x5c6d06[_0x49a1('0x1b')],_0x383bea=_0x13fe24[_0x49a1('0x1c')],_0x20aa5d=_0x13fe24['offset']+_0x13fe24[_0x49a1('0x1d')],_0x479ceb;if(_0x20aa5d>=_0x27dff1){_0x20aa5d=_0x27dff1;_0x479ceb=0xc8;}else{_0x479ceb=0xce;}_0x39676e['status'](_0x479ceb);return _0x39676e[_0x49a1('0x1e')](_0x49a1('0x1f'),_0x383bea+'-'+_0x20aa5d+'/'+_0x27dff1)['json'](_0x5c6d06);}return null;};}function patchUpdates(_0x3997e8){return function(_0x508f32){try{jsonpatch[_0x49a1('0x20')](_0x508f32,_0x3997e8,!![]);}catch(_0x468bac){return BPromise[_0x49a1('0x21')](_0x468bac);}return _0x508f32['save']();};}function saveUpdates(_0x15d7e6,_0x37b66f){return function(_0x37d888){if(_0x37d888){return _0x37d888[_0x49a1('0x22')](_0x15d7e6)[_0x49a1('0x23')](function(_0x115de3){return _0x115de3;});}return null;};}function removeEntity(_0x50aace,_0xe5c860){return function(_0x108d66){if(_0x108d66){return _0x108d66[_0x49a1('0x24')]()['then'](function(){_0x50aace[_0x49a1('0x18')](0xcc)[_0x49a1('0x19')]();});}};}function handleEntityNotFound(_0x28785d,_0x4b4bf3){return function(_0x4d13b7){if(!_0x4d13b7){_0x28785d[_0x49a1('0x17')](0x194);}return _0x4d13b7;};}function handleError(_0x1ed188,_0x2aff51){_0x2aff51=_0x2aff51||0x1f4;return function(_0x38c624){logger[_0x49a1('0x25')](_0x38c624[_0x49a1('0x26')]);if(_0x38c624[_0x49a1('0x27')]){delete _0x38c624['name'];}_0x1ed188[_0x49a1('0x18')](_0x2aff51)[_0x49a1('0x28')](_0x38c624);};}exports[_0x49a1('0x22')]=function(_0x2935d1,_0x20af10){if(_0x2935d1[_0x49a1('0x29')]['id']){delete _0x2935d1[_0x49a1('0x29')]['id'];}return db[_0x49a1('0x2a')]['find']({'where':{'id':_0x2935d1[_0x49a1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x20af10,null))['then'](saveUpdates(_0x2935d1['body'],null))[_0x49a1('0x23')](respondWithResult(_0x20af10,null))[_0x49a1('0x2c')](handleError(_0x20af10,null));};exports[_0x49a1('0x24')]=function(_0x55fab3,_0x542be7){return db[_0x49a1('0x2a')][_0x49a1('0x2d')]({'where':{'id':_0x55fab3[_0x49a1('0x2b')]['id']}})[_0x49a1('0x23')](handleEntityNotFound(_0x542be7,null))[_0x49a1('0x23')](removeEntity(_0x542be7,null))[_0x49a1('0x2c')](handleError(_0x542be7,null));}; \ No newline at end of file +var _0x598a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','update','then','sendStatus','error','name','Action','find','body','destroy','catch','html-pdf'];(function(_0xcbd79c,_0x387d8a){var _0x22277d=function(_0x35a795){while(--_0x35a795){_0xcbd79c['push'](_0xcbd79c['shift']());}};_0x22277d(++_0x387d8a);}(_0x598a,0xfb));var _0xa598=function(_0x48b955,_0x1a99b8){_0x48b955=_0x48b955-0x0;var _0x5317cb=_0x598a[_0x48b955];return _0x5317cb;};'use strict';var pdf=require(_0xa598('0x0'));var emlformat=require(_0xa598('0x1'));var rimraf=require(_0xa598('0x2'));var zipdir=require(_0xa598('0x3'));var jsonpatch=require(_0xa598('0x4'));var rp=require('request-promise');var moment=require(_0xa598('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa598('0x6'));var sox=require(_0xa598('0x7'));var csv=require(_0xa598('0x8'));var ejs=require(_0xa598('0x9'));var fs=require('fs');var _=require(_0xa598('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa598('0xb'));var deskjs=require(_0xa598('0xc'));var toCsv=require(_0xa598('0x8'));var querystring=require(_0xa598('0xd'));var Papa=require(_0xa598('0xe'));var Redis=require(_0xa598('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa598('0x10'));var hardwareService=require(_0xa598('0x11'));var logger=require(_0xa598('0x12'))(_0xa598('0x13'));var utils=require(_0xa598('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa598('0x15'));var db=require(_0xa598('0x16'))['db'];function respondWithStatusCode(_0x468710,_0x5041d4){_0x5041d4=_0x5041d4||0xcc;return function(_0xe8f905){if(_0xe8f905){return _0x468710['sendStatus'](_0x5041d4);}return _0x468710[_0xa598('0x17')](_0x5041d4)[_0xa598('0x18')]();};}function respondWithResult(_0xb3288a,_0x38afa9){_0x38afa9=_0x38afa9||0xc8;return function(_0x1949b5){if(_0x1949b5){return _0xb3288a[_0xa598('0x17')](_0x38afa9)[_0xa598('0x19')](_0x1949b5);}};}function respondWithFilteredResult(_0x41d3fe,_0x28534a){return function(_0x4b100b){if(_0x4b100b){var _0x88df86=_0x4b100b[_0xa598('0x1a')],_0x82a6cc=_0x28534a[_0xa598('0x1b')],_0x6e6ff5=_0x28534a[_0xa598('0x1b')]+_0x28534a[_0xa598('0x1c')],_0x27c34e;if(_0x6e6ff5>=_0x88df86){_0x6e6ff5=_0x88df86;_0x27c34e=0xc8;}else{_0x27c34e=0xce;}_0x41d3fe[_0xa598('0x17')](_0x27c34e);return _0x41d3fe[_0xa598('0x1d')]('Content-Range',_0x82a6cc+'-'+_0x6e6ff5+'/'+_0x88df86)[_0xa598('0x19')](_0x4b100b);}return null;};}function patchUpdates(_0x80e1ad){return function(_0x3fd5a4){try{jsonpatch[_0xa598('0x1e')](_0x3fd5a4,_0x80e1ad,!![]);}catch(_0x2ad4ff){return BPromise[_0xa598('0x1f')](_0x2ad4ff);}return _0x3fd5a4['save']();};}function saveUpdates(_0x56fc63,_0x2923d5){return function(_0x47e84d){if(_0x47e84d){return _0x47e84d[_0xa598('0x20')](_0x56fc63)[_0xa598('0x21')](function(_0x399f23){return _0x399f23;});}return null;};}function removeEntity(_0x2222b0,_0x261868){return function(_0x24f4f0){if(_0x24f4f0){return _0x24f4f0['destroy']()[_0xa598('0x21')](function(){_0x2222b0[_0xa598('0x17')](0xcc)[_0xa598('0x18')]();});}};}function handleEntityNotFound(_0x14643d,_0x802679){return function(_0x3c533a){if(!_0x3c533a){_0x14643d[_0xa598('0x22')](0x194);}return _0x3c533a;};}function handleError(_0xf366b1,_0x50c9d8){_0x50c9d8=_0x50c9d8||0x1f4;return function(_0x473d07){logger[_0xa598('0x23')](_0x473d07['stack']);if(_0x473d07['name']){delete _0x473d07[_0xa598('0x24')];}_0xf366b1['status'](_0x50c9d8)['send'](_0x473d07);};}exports[_0xa598('0x20')]=function(_0x5918f1,_0x34689e){if(_0x5918f1['body']['id']){delete _0x5918f1['body']['id'];}return db[_0xa598('0x25')][_0xa598('0x26')]({'where':{'id':_0x5918f1['params']['id']}})[_0xa598('0x21')](handleEntityNotFound(_0x34689e,null))[_0xa598('0x21')](saveUpdates(_0x5918f1[_0xa598('0x27')],null))[_0xa598('0x21')](respondWithResult(_0x34689e,null))['catch'](handleError(_0x34689e,null));};exports[_0xa598('0x28')]=function(_0x5ab302,_0x5d70aa){return db['Action'][_0xa598('0x26')]({'where':{'id':_0x5ab302['params']['id']}})[_0xa598('0x21')](handleEntityNotFound(_0x5d70aa,null))[_0xa598('0x21')](removeEntity(_0x5d70aa,null))[_0xa598('0x29')](handleError(_0x5d70aa,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d234331..956ce1c 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 _0x744f=['exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x1e9e1c,_0x428da5){var _0x53d0e7=function(_0x259ada){while(--_0x259ada){_0x1e9e1c['push'](_0x1e9e1c['shift']());}};_0x53d0e7(++_0x428da5);}(_0x744f,0xc8));var _0xf744=function(_0x1d7c31,_0x1c7d35){_0x1d7c31=_0x1d7c31-0x0;var _0xfbe999=_0x744f[_0x1d7c31];return _0xfbe999;};'use strict';var _=require(_0xf744('0x0'));var util=require(_0xf744('0x1'));var logger=require(_0xf744('0x2'))('api');var moment=require(_0xf744('0x3'));var BPromise=require(_0xf744('0x4'));var rp=require(_0xf744('0x5'));var fs=require('fs');var path=require(_0xf744('0x6'));var rimraf=require(_0xf744('0x7'));var config=require(_0xf744('0x8'));var attributes=require(_0xf744('0x9'));module[_0xf744('0xa')]=function(_0x1f5aca,_0x23d325){return _0x1f5aca[_0xf744('0xb')](_0xf744('0xc'),attributes,{'tableName':_0xf744('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7aeb=['bluebird','path','exports','Action','../../config/logger','api','moment'];(function(_0x45dd26,_0xdc6e79){var _0x4ba4b2=function(_0x2e74ce){while(--_0x2e74ce){_0x45dd26['push'](_0x45dd26['shift']());}};_0x4ba4b2(++_0xdc6e79);}(_0x7aeb,0xac));var _0xb7ae=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7aeb[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb7ae('0x0'))(_0xb7ae('0x1'));var moment=require(_0xb7ae('0x2'));var BPromise=require(_0xb7ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7ae('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xb7ae('0x5')]=function(_0x427a99,_0x41fe72){return _0x427a99['define'](_0xb7ae('0x6'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index a4830de..0e4269e 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 _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x75e7c4,_0x1cb7ae){var _0x536ff8=function(_0x27b2e7){while(--_0x27b2e7){_0x75e7c4['push'](_0x75e7c4['shift']());}};_0x536ff8(++_0x1cb7ae);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 5b27013..65527f9 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 _0xc6bb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','express'];(function(_0x5206fc,_0x2eec61){var _0x12acf6=function(_0x21c5aa){while(--_0x21c5aa){_0x5206fc['push'](_0x5206fc['shift']());}};_0x12acf6(++_0x2eec61);}(_0xc6bb,0x14e));var _0xbc6b=function(_0x2aecf5,_0x54c54e){_0x2aecf5=_0x2aecf5-0x0;var _0x55a6f8=_0xc6bb[_0x2aecf5];return _0x55a6f8;};'use strict';var multer=require(_0xbc6b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc6b('0x1'));var router=express[_0xbc6b('0x2')]();var auth=require(_0xbc6b('0x3'));var interaction=require(_0xbc6b('0x4'));var config=require(_0xbc6b('0x5'));var controller=require(_0xbc6b('0x6'));router[_0xbc6b('0x7')](_0xbc6b('0x8'),auth[_0xbc6b('0x9')](),controller[_0xbc6b('0xa')]);router[_0xbc6b('0xb')](_0xbc6b('0x8'),auth['isAuthenticated'](),controller[_0xbc6b('0xc')]);module[_0xbc6b('0xd')]=router; \ No newline at end of file +var _0x7d42=['/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','./action.controller','put'];(function(_0x239847,_0x3d6c44){var _0x253171=function(_0x3502a4){while(--_0x3502a4){_0x239847['push'](_0x239847['shift']());}};_0x253171(++_0x3d6c44);}(_0x7d42,0x17e));var _0x27d4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7d42[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x27d4('0x0'));var util=require(_0x27d4('0x1'));var path=require(_0x27d4('0x2'));var timeout=require(_0x27d4('0x3'));var express=require(_0x27d4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x27d4('0x5'));var config=require('../../config/environment');var controller=require(_0x27d4('0x6'));router[_0x27d4('0x7')](_0x27d4('0x8'),auth[_0x27d4('0x9')](),controller[_0x27d4('0xa')]);router[_0x27d4('0xb')]('/:id',auth[_0x27d4('0x9')](),controller[_0x27d4('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 91ed555..38798ae 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 _0xc9a6=['STRING','TEXT','sequelize','exports'];(function(_0x4cfd4d,_0x135ab4){var _0x5c7a28=function(_0x562665){while(--_0x562665){_0x4cfd4d['push'](_0x4cfd4d['shift']());}};_0x5c7a28(++_0x135ab4);}(_0xc9a6,0x19a));var _0x6c9a=function(_0x16b3c6,_0x3bd435){_0x16b3c6=_0x16b3c6-0x0;var _0x2671b8=_0xc9a6[_0x16b3c6];return _0x2671b8;};'use strict';var Sequelize=require(_0x6c9a('0x0'));module[_0x6c9a('0x1')]={'name':{'type':Sequelize[_0x6c9a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6c9a('0x2')]},'parent':{'type':Sequelize[_0x6c9a('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x6c9a('0x3')]},'joins':{'type':Sequelize[_0x6c9a('0x3')]}}; \ No newline at end of file +var _0xebed=['exports','STRING','TEXT','sequelize'];(function(_0x197878,_0x4c265c){var _0x2371e7=function(_0x4a81a3){while(--_0x4a81a3){_0x197878['push'](_0x197878['shift']());}};_0x2371e7(++_0x4c265c);}(_0xebed,0x163));var _0xdebe=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xebed[_0x55d8c5];return _0x225ae5;};'use strict';var Sequelize=require(_0xdebe('0x0'));module[_0xdebe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xdebe('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xdebe('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7a1b2a5..fa20a6e 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 _0xd317=['AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','operator','parentKey','No\x20available\x20data','output','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','ROUND(%s)','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','catch','body','preview','join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','getFields','length','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xd317,0x17e));var _0x7d31=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xd317[_0x4a7631];return _0x1a5a6f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d31('0x0'));var rimraf=require(_0x7d31('0x1'));var zipdir=require(_0x7d31('0x2'));var jsonpatch=require(_0x7d31('0x3'));var rp=require(_0x7d31('0x4'));var moment=require(_0x7d31('0x5'));var BPromise=require(_0x7d31('0x6'));var Mustache=require(_0x7d31('0x7'));var util=require(_0x7d31('0x8'));var path=require(_0x7d31('0x9'));var sox=require(_0x7d31('0xa'));var csv=require(_0x7d31('0xb'));var ejs=require(_0x7d31('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7d31('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d31('0xe'));var toCsv=require(_0x7d31('0xb'));var querystring=require(_0x7d31('0xf'));var Papa=require(_0x7d31('0x10'));var Redis=require(_0x7d31('0x11'));var authService=require(_0x7d31('0x12'));var qs=require(_0x7d31('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d31('0x14'));var logger=require(_0x7d31('0x15'))(_0x7d31('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d31('0x17'));var db=require(_0x7d31('0x18'))['db'];var dbH=require('../../mysqldb')[_0x7d31('0x19')];function respondWithStatusCode(_0xef0c39,_0xa3393a){_0xa3393a=_0xa3393a||0xcc;return function(_0x339af9){if(_0x339af9){return _0xef0c39[_0x7d31('0x1a')](_0xa3393a);}return _0xef0c39[_0x7d31('0x1b')](_0xa3393a)[_0x7d31('0x1c')]();};}function respondWithResult(_0x2a91c5,_0x95eeb3){_0x95eeb3=_0x95eeb3||0xc8;return function(_0x54fe7f){if(_0x54fe7f){return _0x2a91c5[_0x7d31('0x1b')](_0x95eeb3)['json'](_0x54fe7f);}};}function respondWithFilteredResult(_0xaea6f4,_0x432986){return function(_0x22172b){if(_0x22172b){var _0x5e7e1b=_0x22172b[_0x7d31('0x1d')],_0xdf67a6=_0x432986[_0x7d31('0x1e')],_0x596224=_0x432986[_0x7d31('0x1e')]+_0x432986[_0x7d31('0x1f')],_0xf6a4aa;if(_0x596224>=_0x5e7e1b){_0x596224=_0x5e7e1b;_0xf6a4aa=0xc8;}else{_0xf6a4aa=0xce;}_0xaea6f4[_0x7d31('0x1b')](_0xf6a4aa);return _0xaea6f4[_0x7d31('0x20')]('Content-Range',_0xdf67a6+'-'+_0x596224+'/'+_0x5e7e1b)[_0x7d31('0x21')](_0x22172b);}return null;};}function patchUpdates(_0x42d140){return function(_0x1025b0){try{jsonpatch[_0x7d31('0x22')](_0x1025b0,_0x42d140,!![]);}catch(_0x5efe26){return BPromise[_0x7d31('0x23')](_0x5efe26);}return _0x1025b0[_0x7d31('0x24')]();};}function saveUpdates(_0x3ccdc0,_0x1c4e01){return function(_0x8f38aa){if(_0x8f38aa){return _0x8f38aa[_0x7d31('0x25')](_0x3ccdc0)[_0x7d31('0x26')](function(_0x24c3ad){return _0x24c3ad;});}return null;};}function removeEntity(_0x46bf5f,_0x1905c3){return function(_0x26f76a){if(_0x26f76a){return _0x26f76a[_0x7d31('0x27')]()[_0x7d31('0x26')](function(){var _0x13663a=_0x26f76a['get']({'plain':!![]});var _0x1ce1dd=_0x7d31('0x28');return db[_0x7d31('0x29')][_0x7d31('0x27')]({'where':{'type':_0x1ce1dd,'resourceId':_0x13663a['id']}})[_0x7d31('0x26')](function(){return _0x26f76a;});})['then'](function(){_0x46bf5f[_0x7d31('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a541,_0x40d075){return function(_0x25d803){if(!_0x25d803){_0x16a541[_0x7d31('0x1a')](0x194);}return _0x25d803;};}function handleError(_0x196841,_0x2ff038){_0x2ff038=_0x2ff038||0x1f4;return function(_0x31e069){logger[_0x7d31('0x2a')](_0x31e069[_0x7d31('0x2b')]);if(_0x31e069['name']){delete _0x31e069[_0x7d31('0x2c')];}_0x196841['status'](_0x2ff038)[_0x7d31('0x2d')](_0x31e069);};}exports[_0x7d31('0x2e')]=function(_0x3cbb68,_0x662360){var _0x121e0e={},_0x10bf8c={},_0xfcf123={'count':0x0,'rows':[]};var _0xb17d0e=_[_0x7d31('0x2f')](db[_0x7d31('0x30')][_0x7d31('0x31')],function(_0x442e95){return{'name':_0x442e95['fieldName'],'type':_0x442e95[_0x7d31('0x32')][_0x7d31('0x33')]};});_0x10bf8c['model']=_[_0x7d31('0x2f')](_0xb17d0e,_0x7d31('0x2c'));_0x10bf8c[_0x7d31('0x34')]=_[_0x7d31('0x35')](_0x3cbb68['query']);_0x10bf8c[_0x7d31('0x36')]=_[_0x7d31('0x37')](_0x10bf8c[_0x7d31('0x38')],_0x10bf8c[_0x7d31('0x34')]);_0x121e0e[_0x7d31('0x39')]=_[_0x7d31('0x37')](_0x10bf8c[_0x7d31('0x38')],qs['fields'](_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x3a')]));_0x121e0e[_0x7d31('0x39')]=_0x121e0e[_0x7d31('0x39')]['length']?_0x121e0e['attributes']:_0x10bf8c[_0x7d31('0x38')];if(!_0x3cbb68['query']['hasOwnProperty'](_0x7d31('0x3b'))){_0x121e0e[_0x7d31('0x1f')]=qs['limit'](_0x3cbb68['query'][_0x7d31('0x1f')]);_0x121e0e[_0x7d31('0x1e')]=qs[_0x7d31('0x1e')](_0x3cbb68[_0x7d31('0x34')]['offset']);}_0x121e0e[_0x7d31('0x3c')]=qs[_0x7d31('0x3d')](_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x3d')]);_0x121e0e[_0x7d31('0x3e')]=qs[_0x7d31('0x36')](_[_0x7d31('0x3f')](_0x3cbb68[_0x7d31('0x34')],_0x10bf8c[_0x7d31('0x36')]),_0xb17d0e);if(_0x3cbb68[_0x7d31('0x34')]['filter']){_0x121e0e['where']=_['merge'](_0x121e0e[_0x7d31('0x3e')],{'$or':_[_0x7d31('0x2f')](_0xb17d0e,function(_0x36f38c){if(_0x36f38c[_0x7d31('0x32')]!==_0x7d31('0x40')){var _0x273c62={};_0x273c62[_0x36f38c['name']]={'$like':'%'+_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x41')]+'%'};return _0x273c62;}})});}_0x121e0e=_[_0x7d31('0x42')]({},_0x121e0e,_0x3cbb68[_0x7d31('0x43')]);var _0xebc65a={'where':_0x121e0e['where']};return db['AnalyticCustomReport'][_0x7d31('0x1d')](_0xebc65a)[_0x7d31('0x26')](function(_0x151cff){_0xfcf123[_0x7d31('0x1d')]=_0x151cff;if(_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x44')]){_0x121e0e['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7d31('0x45')](_0x121e0e);})[_0x7d31('0x26')](function(_0x3afd5b){_0xfcf123[_0x7d31('0x46')]=_0x3afd5b;return _0xfcf123;})[_0x7d31('0x26')](respondWithFilteredResult(_0x662360,_0x121e0e))['catch'](handleError(_0x662360,null));};exports['show']=function(_0x4cdf1a,_0x1ff2c9){var _0x47aab9={'raw':![],'where':{'id':_0x4cdf1a[_0x7d31('0x47')]['id']}},_0x46229d={};_0x46229d[_0x7d31('0x38')]=_[_0x7d31('0x35')](db[_0x7d31('0x30')][_0x7d31('0x31')]);_0x46229d['query']=_[_0x7d31('0x35')](_0x4cdf1a[_0x7d31('0x34')]);_0x46229d['filters']=_[_0x7d31('0x37')](_0x46229d[_0x7d31('0x38')],_0x46229d[_0x7d31('0x34')]);_0x47aab9[_0x7d31('0x39')]=_[_0x7d31('0x37')](_0x46229d[_0x7d31('0x38')],qs[_0x7d31('0x3a')](_0x4cdf1a[_0x7d31('0x34')][_0x7d31('0x3a')]));_0x47aab9['attributes']=_0x47aab9['attributes']['length']?_0x47aab9[_0x7d31('0x39')]:_0x46229d[_0x7d31('0x38')];if(_0x4cdf1a[_0x7d31('0x34')]['includeAll']){_0x47aab9['include']=[{'all':!![]}];}_0x47aab9=_[_0x7d31('0x42')]({},_0x47aab9,_0x4cdf1a['options']);return db['AnalyticCustomReport'][_0x7d31('0x48')](_0x47aab9)[_0x7d31('0x26')](handleEntityNotFound(_0x1ff2c9,null))['then'](respondWithResult(_0x1ff2c9,null))['catch'](handleError(_0x1ff2c9,null));};exports['create']=function(_0x124afe,_0x16cde7){return db[_0x7d31('0x30')][_0x7d31('0x49')](_0x124afe['body'],{})['then'](function(_0x1bece1){var _0x4ae526=_0x124afe[_0x7d31('0x4a')][_0x7d31('0x4b')]({'plain':!![]});if(!_0x4ae526)throw new Error(_0x7d31('0x4c'));if(_0x4ae526[_0x7d31('0x4d')]===_0x7d31('0x4a')){var _0x4f7869=_0x1bece1[_0x7d31('0x4b')]({'plain':!![]});var _0x12ef36='Reports';return db['UserProfileSection'][_0x7d31('0x48')]({'where':{'name':_0x12ef36,'userProfileId':_0x4ae526['userProfileId']},'raw':!![]})[_0x7d31('0x26')](function(_0x409a90){if(_0x409a90&&_0x409a90[_0x7d31('0x4e')]===0x0){return db['UserProfileResource'][_0x7d31('0x49')]({'name':_0x4f7869[_0x7d31('0x2c')],'resourceId':_0x4f7869['id'],'type':_0x7d31('0x28'),'sectionId':_0x409a90['id']},{})['then'](function(){return _0x1bece1;});}else{return _0x1bece1;}})[_0x7d31('0x4f')](function(_0xaa0db3){logger[_0x7d31('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaa0db3);throw _0xaa0db3;});}return _0x1bece1;})[_0x7d31('0x26')](respondWithResult(_0x16cde7,0xc9))[_0x7d31('0x4f')](handleError(_0x16cde7,null));};exports['update']=function(_0x3b7fb6,_0x300d56){if(_0x3b7fb6[_0x7d31('0x50')]['id']){delete _0x3b7fb6[_0x7d31('0x50')]['id'];}return db['AnalyticCustomReport'][_0x7d31('0x48')]({'where':{'id':_0x3b7fb6['params']['id']}})[_0x7d31('0x26')](handleEntityNotFound(_0x300d56,null))[_0x7d31('0x26')](saveUpdates(_0x3b7fb6[_0x7d31('0x50')],null))[_0x7d31('0x26')](respondWithResult(_0x300d56,null))['catch'](handleError(_0x300d56,null));};exports[_0x7d31('0x27')]=function(_0x4e7685,_0x282849){return db['AnalyticCustomReport'][_0x7d31('0x48')]({'where':{'id':_0x4e7685[_0x7d31('0x47')]['id']}})[_0x7d31('0x26')](handleEntityNotFound(_0x282849,null))[_0x7d31('0x26')](removeEntity(_0x282849,null))['catch'](handleError(_0x282849,null));};exports[_0x7d31('0x51')]=function(_0x14bf75,_0x5345ed){var _0x194631=0xa;var _0x1dc266=[_0x7d31('0x52'),'left_join',_0x7d31('0x53'),_0x7d31('0x54')];var _0x337dda={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7d31('0x55'),'MAX':_0x7d31('0x56'),'MIN':_0x7d31('0x57'),'AVG':_0x7d31('0x58'),'GROUP_CONCAT':_0x7d31('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7d31('0x5a')};var _0x1baaad={'SEC_TO_TIME':_0x7d31('0x5b'),'DATE':_0x7d31('0x5c'),'HOUR':_0x7d31('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7d31('0x5e')};var _0x2c21cf=function(_0x1894f5){return!_['includes']([_0x7d31('0x5f'),_0x7d31('0x60'),_0x7d31('0x61'),_0x7d31('0x62')],_0x1894f5);};var _0x157de3=function(_0x120f0b){if(!_0x120f0b||!_0x120f0b['rules']['length']){return'';}for(var _0x4c8c81='(',_0x809294=0x0;_0x809294<_0x120f0b['rules']['length'];_0x809294+=0x1){_0x809294>0x0&&(_0x4c8c81+='\x20'+_0x120f0b['operator']+'\x20');_0x4c8c81+=_0x120f0b[_0x7d31('0x63')][_0x809294][_0x7d31('0x64')]?_0x157de3(_0x120f0b['rules'][_0x809294][_0x7d31('0x64')]):_0x120f0b['rules'][_0x809294]['field']+'\x20'+_0x120f0b[_0x7d31('0x63')][_0x809294]['condition']+(_0x2c21cf(_0x120f0b[_0x7d31('0x63')][_0x809294][_0x7d31('0x65')])?'\x20'+_0x120f0b[_0x7d31('0x63')][_0x809294]['value']:'');}return _0x4c8c81+')';};var _0x2ba7a3={'where':{'id':_0x14bf75['params']['id']}},_0x5c74f0,_0x150d84,_0x18c045,_0x469b44,_0x3ec3ea;_0x2ba7a3=_[_0x7d31('0x42')]({},_0x2ba7a3,_0x14bf75[_0x7d31('0x43')]);return db[_0x7d31('0x30')][_0x7d31('0x48')](_0x2ba7a3)[_0x7d31('0x26')](function(_0x58f1f2){if(_0x58f1f2){_0x5c74f0=_0x58f1f2;return _0x58f1f2[_0x7d31('0x66')]();}return null;})[_0x7d31('0x26')](function(_0x537941){if(_0x537941){if(!_0x537941[_0x7d31('0x67')]){throw new db[(_0x7d31('0x68'))][(_0x7d31('0x69'))](_0x7d31('0x6a'),0x193);}_0x150d84=_0x537941;return db[_0x7d31('0x6b')][_0x7d31('0x45')]({'raw':!![]});}return null;})[_0x7d31('0x26')](function(_0x4f968c){if(_0x4f968c){_0x18c045=_[_0x7d31('0x6c')](_0x4f968c,'id');var _0x5675e3;var _0x17cfd0=squel[_0x7d31('0x6d')]();_0x17cfd0[_0x7d31('0x6e')](_0x5c74f0[_0x7d31('0x6f')]);for(var _0x163a50=0x0;_0x163a50<_0x150d84[_0x7d31('0x67')];_0x163a50+=0x1){_0x5675e3=_0x150d84[_0x163a50][_0x7d31('0x70')]?_0x18c045[_0x150d84[_0x163a50][_0x7d31('0x70')]]['metric']:_0x150d84[_0x163a50][_0x7d31('0x71')];_0x5675e3=_0x150d84[_0x163a50][_0x7d31('0x72')]?_[_0x7d31('0x73')](_0x337dda[_0x150d84[_0x163a50][_0x7d31('0x72')]],'%s',_0x5675e3):_0x5675e3;_0x5675e3=_0x150d84[_0x163a50][_0x7d31('0x74')]?_[_0x7d31('0x73')](_0x1baaad[_0x150d84[_0x163a50]['format']],'%s',_0x5675e3):_0x5675e3;if(_0x150d84[_0x163a50][_0x7d31('0x75')]){_0x17cfd0[_0x7d31('0x64')](_0x5675e3);}_0x150d84[_0x163a50][_0x7d31('0x76')]&&_0x17cfd0['order'](_0x5675e3,_0x150d84[_0x163a50][_0x7d31('0x76')]===_0x7d31('0x77')?![]:!![]);_0x17cfd0['field'](_0x5675e3,_0x150d84[_0x163a50][_0x7d31('0x78')]||_0x5675e3);}if(_0x5c74f0['joins']){_0x5c74f0[_0x7d31('0x79')]=JSON[_0x7d31('0x7a')](_0x5c74f0['joins']);for(var _0x43cc15=0x0;_0x43cc15<_0x5c74f0['joins'][_0x7d31('0x67')];_0x43cc15+=0x1){if(_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x32')]&&_[_0x7d31('0x7b')](_0x1dc266,_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['type'])&&_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['parentKey']&&_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['foreignTable']&&_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x7c')]){_0x17cfd0[_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['type']](_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['foreignTable'],null,util[_0x7d31('0x74')](_0x7d31('0x7d'),_0x5c74f0[_0x7d31('0x6f')],_0x5c74f0['joins'][_0x43cc15]['parentKey'],_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x7e')],_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x7c')]));}}}if(_0x5c74f0[_0x7d31('0x7f')]){_0x5c74f0[_0x7d31('0x7f')]=JSON['parse'](_0x5c74f0[_0x7d31('0x7f')]);_0x17cfd0['where'](_0x157de3(_0x5c74f0[_0x7d31('0x7f')][_0x7d31('0x64')]));}_0x3ec3ea=_0x17cfd0[_0x7d31('0x80')]();_0x17cfd0[_0x7d31('0x1f')](_0x194631);_0x17cfd0[_0x7d31('0x1e')](0x0);logger[_0x7d31('0x81')](_0x7d31('0x82'),_0x17cfd0[_0x7d31('0x83')]());return db[_0x7d31('0x84')]['query'](_0x17cfd0[_0x7d31('0x83')](),{'type':db['sequelize'][_0x7d31('0x85')][_0x7d31('0x86')]});}})['then'](respondWithResult(_0x5345ed,null))['catch'](handleError(_0x5345ed,null));};function runReport(_0x274738,_0xd00303,_0x45ecc6){var _0xa3ceb6=_0xd00303[_0x7d31('0x2c')];var _0x532d30=0xa;var _0x5aef71=['join',_0x7d31('0x87'),_0x7d31('0x53'),'cross_join'];var _0x90cfa={'SUM':_0x7d31('0x88'),'COUNT':_0x7d31('0x89'),'COUNT DISTINCT':_0x7d31('0x55'),'MAX':_0x7d31('0x56'),'MIN':_0x7d31('0x57'),'AVG':_0x7d31('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7d31('0x8a'),'GROUP_CONCAT DESC':_0x7d31('0x5a')};var _0xfd14ac={'SEC_TO_TIME':_0x7d31('0x5b'),'DATE':_0x7d31('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7d31('0x5e')};var _0x538fc1=function(_0x443502){return!_['includes']([_0x7d31('0x5f'),'IS\x20NOT\x20NULL',_0x7d31('0x61'),_0x7d31('0x62')],_0x443502);};var _0x3ac7de=function(_0x5834bf){if(!_0x5834bf||!_0x5834bf[_0x7d31('0x63')][_0x7d31('0x67')]){return'';}for(var _0x2ccfd2='(',_0x257472=0x0;_0x257472<_0x5834bf[_0x7d31('0x63')]['length'];_0x257472+=0x1){_0x257472>0x0&&(_0x2ccfd2+='\x20'+_0x5834bf[_0x7d31('0x8b')]+'\x20');_0x2ccfd2+=_0x5834bf[_0x7d31('0x63')][_0x257472]['group']?_0x3ac7de(_0x5834bf[_0x7d31('0x63')][_0x257472][_0x7d31('0x64')]):_0x5834bf[_0x7d31('0x63')][_0x257472][_0x7d31('0x71')]+'\x20'+_0x5834bf[_0x7d31('0x63')][_0x257472][_0x7d31('0x65')]+(_0x538fc1(_0x5834bf['rules'][_0x257472]['condition'])?'\x20'+_0x5834bf['rules'][_0x257472]['value']:'');}return _0x2ccfd2+')';};var _0x318a33={'where':{'id':_0x274738['id']}},_0x177d1c,_0xa7b2a,_0x36d17a,_0x3ac100,_0x3ece40;_0x318a33=_[_0x7d31('0x42')]({},_0x318a33,_0x45ecc6);return db['AnalyticCustomReport'][_0x7d31('0x48')](_0x318a33)[_0x7d31('0x26')](function(_0x9ff57d){if(_0x9ff57d){_0x177d1c=_0x9ff57d;return _0x9ff57d[_0x7d31('0x66')]();}return null;})[_0x7d31('0x26')](function(_0x15cd0b){if(_0x15cd0b){if(!_0x15cd0b[_0x7d31('0x67')]){throw new db[(_0x7d31('0x68'))][(_0x7d31('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa7b2a=_0x15cd0b;return db[_0x7d31('0x6b')][_0x7d31('0x45')]({'raw':!![]});}return null;})['then'](function(_0x2b4181){if(_0x2b4181){_0x36d17a=_[_0x7d31('0x6c')](_0x2b4181,'id');var _0x4b66db;var _0x34a87f=squel[_0x7d31('0x6d')]();_0x34a87f[_0x7d31('0x6e')](_0x177d1c[_0x7d31('0x6f')]);for(var _0x3d1ef1=0x0;_0x3d1ef1<_0xa7b2a[_0x7d31('0x67')];_0x3d1ef1+=0x1){_0x4b66db=_0xa7b2a[_0x3d1ef1]['MetricId']?_0x36d17a[_0xa7b2a[_0x3d1ef1][_0x7d31('0x70')]]['metric']:_0xa7b2a[_0x3d1ef1]['field'];_0x4b66db=_0xa7b2a[_0x3d1ef1][_0x7d31('0x72')]?_[_0x7d31('0x73')](_0x90cfa[_0xa7b2a[_0x3d1ef1][_0x7d31('0x72')]],'%s',_0x4b66db):_0x4b66db;_0x4b66db=_0xa7b2a[_0x3d1ef1][_0x7d31('0x74')]?_[_0x7d31('0x73')](_0xfd14ac[_0xa7b2a[_0x3d1ef1][_0x7d31('0x74')]],'%s',_0x4b66db):_0x4b66db;if(_0xa7b2a[_0x3d1ef1][_0x7d31('0x75')]){_0x34a87f[_0x7d31('0x64')](_0x4b66db);}_0xa7b2a[_0x3d1ef1]['orderBy']&&_0x34a87f[_0x7d31('0x3c')](_0x4b66db,_0xa7b2a[_0x3d1ef1][_0x7d31('0x76')]===_0x7d31('0x77')?![]:!![]);_0x34a87f[_0x7d31('0x71')](_0x4b66db,_0xa7b2a[_0x3d1ef1]['alias']||_0x4b66db);}if(_0x177d1c[_0x7d31('0x79')]){_0x177d1c[_0x7d31('0x79')]=JSON[_0x7d31('0x7a')](_0x177d1c['joins']);for(var _0x27cf08=0x0;_0x27cf08<_0x177d1c[_0x7d31('0x79')][_0x7d31('0x67')];_0x27cf08+=0x1){if(_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x32')]&&_['includes'](_0x5aef71,_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x32')])&&_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x8c')]&&_0x177d1c['joins'][_0x27cf08][_0x7d31('0x7e')]&&_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x7c')]){_0x34a87f[_0x177d1c[_0x7d31('0x79')][_0x27cf08]['type']](_0x177d1c[_0x7d31('0x79')][_0x27cf08]['foreignTable'],null,util['format'](_0x7d31('0x7d'),_0x177d1c[_0x7d31('0x6f')],_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x8c')],_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x7e')],_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x7c')]));}}}if(_0x177d1c[_0x7d31('0x7f')]){_0x177d1c[_0x7d31('0x7f')]=JSON[_0x7d31('0x7a')](_0x177d1c[_0x7d31('0x7f')]);_0x34a87f[_0x7d31('0x3e')](_0x3ac7de(_0x177d1c['conditions'][_0x7d31('0x64')]));}_0x3ece40=_0x34a87f['clone']();_0x34a87f['limit'](_0x532d30);_0x34a87f['offset'](0x0);logger[_0x7d31('0x81')](_0x7d31('0x82'),_0x34a87f[_0x7d31('0x83')]());return db[_0x7d31('0x84')][_0x7d31('0x34')](_0x34a87f[_0x7d31('0x83')](),{'type':db[_0x7d31('0x84')][_0x7d31('0x85')]['SELECT']});}})[_0x7d31('0x26')](function(_0x174eec){if(!_0x174eec[_0x7d31('0x67')]){throw new db[(_0x7d31('0x68'))][(_0x7d31('0x69'))](_0x7d31('0x8d'),0xcc);}if(_0xd00303[_0x7d31('0x8e')]==='web'){return null;}var _0x224a61=_[_0x7d31('0x42')](_0xd00303,{'name':_0xd00303[_0x7d31('0x8f')]||_0xd00303['name']||_0x177d1c[_0x7d31('0x2c')],'basename':_0xa3ceb6,'savename':util[_0x7d31('0x74')](_0x7d31('0x90'),_0xd00303[_0x7d31('0x2c')]||_0x177d1c['name'],require('randomstring')['generate'](0x4),_0xd00303[_0x7d31('0x8e')]||_0x7d31('0x91')),'reportId':_0x177d1c['id'],'reportType':_0x7d31('0x92')});return db[_0x7d31('0x93')][_0x7d31('0x49')](_0x224a61,{'raw':!![]});})[_0x7d31('0x26')](function(_0x2a460d){if(_0x177d1c[_0x7d31('0x6f')]===_0x7d31('0x94')){_0x3ece40[_0x7d31('0x3e')](_0x177d1c['table']+_0x7d31('0x95'),_0xd00303['startDate'],_0xd00303[_0x7d31('0x96')]);}else{_0x3ece40[_0x7d31('0x3e')](_0x177d1c[_0x7d31('0x6f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xd00303[_0x7d31('0x97')],_0xd00303[_0x7d31('0x96')]);}if(_0x2a460d){logger[_0x7d31('0x98')]('Run\x20Query:',_0x3ece40['toString']());require('child_process')[_0x7d31('0x99')](path[_0x7d31('0x52')](__dirname,_0x7d31('0x9a'),_0x2a460d[_0x7d31('0x8e')]),[_0x2a460d['id'],_0x3ece40[_0x7d31('0x83')](),path['join'](__dirname,_0x7d31('0x9b'),_0x2a460d[_0x7d31('0x9c')]),_0xa3ceb6]);return _0x2a460d;}else{var _0xc3591f=squel[_0x7d31('0x6d')]();_0xc3591f[_0x7d31('0x6e')]('('+_0x3ece40[_0x7d31('0x83')]()+')',_0x7d31('0x9d'));_0xc3591f[_0x7d31('0x71')](_0x7d31('0x9e'),_0x7d31('0x1d'));_0x3ece40['limit'](_0xd00303[_0x7d31('0x1f')]||_0x532d30);_0x3ece40[_0x7d31('0x1e')](_0xd00303[_0x7d31('0x1e')]||0x0);return dbH['sequelize']['query'](_0xc3591f[_0x7d31('0x83')](),{'type':dbH[_0x7d31('0x84')]['QueryTypes'][_0x7d31('0x86')]})['then'](function(_0x17e725){if(!_0x17e725[_0x7d31('0x67')]){_0x3ac100=0x0;}else{_0x3ac100=_0x17e725[0x0][_0x7d31('0x1d')]||0x0;}return dbH[_0x7d31('0x84')]['query'](_0x3ece40[_0x7d31('0x83')](),{'type':dbH['sequelize'][_0x7d31('0x85')]['SELECT']});})[_0x7d31('0x26')](function(_0x287bb3){return{'rows':_0x287bb3||[],'count':_0x3ac100};});}});}exports[_0x7d31('0x9f')]=function(_0x2fead0,_0x278a00){return runReport(_0x2fead0[_0x7d31('0x47')],_0x2fead0[_0x7d31('0x34')],_0x2fead0['options'])[_0x7d31('0x26')](respondWithResult(_0x278a00,null))[_0x7d31('0x4f')](handleError(_0x278a00,null));};exports[_0x7d31('0xa0')]=runReport;exports[_0x7d31('0x34')]=function(_0x1be394,_0x2bbd1a){var _0x3cb88f=0xa;var _0xa24871=[_0x7d31('0x52'),_0x7d31('0x87'),_0x7d31('0x53'),'cross_join'];var _0x4be041={'SUM':'SUM(%s)','COUNT':_0x7d31('0x89'),'COUNT DISTINCT':_0x7d31('0x55'),'MAX':'MAX(%s)','MIN':_0x7d31('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7d31('0x59'),'GROUP_CONCAT ASC':_0x7d31('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x178a15={'SEC_TO_TIME':_0x7d31('0x5b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x7d31('0xa1'),'UNIX_TIMESTAMP':_0x7d31('0x5e')};var _0x5ac312=function(_0x3016b9){return!_[_0x7d31('0x7b')]([_0x7d31('0x5f'),_0x7d31('0x60'),_0x7d31('0x61'),'IS\x20NOT\x20EMPTY'],_0x3016b9);};var _0x1cbcd0=function(_0x39c87c){if(!_0x39c87c||!_0x39c87c[_0x7d31('0x63')][_0x7d31('0x67')]){return'';}for(var _0x480566='(',_0x58e5fc=0x0;_0x58e5fc<_0x39c87c[_0x7d31('0x63')][_0x7d31('0x67')];_0x58e5fc+=0x1){_0x58e5fc>0x0&&(_0x480566+='\x20'+_0x39c87c[_0x7d31('0x8b')]+'\x20');_0x480566+=_0x39c87c['rules'][_0x58e5fc][_0x7d31('0x64')]?_0x1cbcd0(_0x39c87c['rules'][_0x58e5fc][_0x7d31('0x64')]):_0x39c87c[_0x7d31('0x63')][_0x58e5fc][_0x7d31('0x71')]+'\x20'+_0x39c87c[_0x7d31('0x63')][_0x58e5fc][_0x7d31('0x65')]+(_0x5ac312(_0x39c87c['rules'][_0x58e5fc][_0x7d31('0x65')])?'\x20'+_0x39c87c['rules'][_0x58e5fc][_0x7d31('0xa2')]:'');}return _0x480566+')';};var _0x3ece07={'where':{'id':_0x1be394[_0x7d31('0x47')]['id']}},_0x2ddfd1,_0x20515f,_0x5173a9,_0x4dafcb,_0x316d28;_0x3ece07=_['merge']({},_0x3ece07,_0x1be394[_0x7d31('0x43')]);return db['AnalyticCustomReport'][_0x7d31('0x48')](_0x3ece07)['then'](function(_0x4dc3c7){if(_0x4dc3c7){_0x2ddfd1=_0x4dc3c7;return _0x4dc3c7[_0x7d31('0x66')]();}return null;})[_0x7d31('0x26')](function(_0x15f66a){if(_0x15f66a){if(!_0x15f66a[_0x7d31('0x67')]){throw new db['Sequelize'][(_0x7d31('0x69'))](_0x7d31('0x6a'),0x193);}_0x20515f=_0x15f66a;return db[_0x7d31('0x6b')][_0x7d31('0x45')]({'raw':!![]});}return null;})[_0x7d31('0x26')](function(_0xa168a5){if(_0xa168a5){_0x5173a9=_[_0x7d31('0x6c')](_0xa168a5,'id');var _0x34c665;var _0xa92f8=squel[_0x7d31('0x6d')]();_0xa92f8['from'](_0x2ddfd1[_0x7d31('0x6f')]);for(var _0x1e2a4d=0x0;_0x1e2a4d<_0x20515f[_0x7d31('0x67')];_0x1e2a4d+=0x1){_0x34c665=_0x20515f[_0x1e2a4d][_0x7d31('0x70')]?_0x5173a9[_0x20515f[_0x1e2a4d]['MetricId']]['metric']:_0x20515f[_0x1e2a4d][_0x7d31('0x71')];_0x34c665=_0x20515f[_0x1e2a4d][_0x7d31('0x72')]?_[_0x7d31('0x73')](_0x4be041[_0x20515f[_0x1e2a4d][_0x7d31('0x72')]],'%s',_0x34c665):_0x34c665;_0x34c665=_0x20515f[_0x1e2a4d][_0x7d31('0x74')]?_['replace'](_0x178a15[_0x20515f[_0x1e2a4d][_0x7d31('0x74')]],'%s',_0x34c665):_0x34c665;if(_0x20515f[_0x1e2a4d][_0x7d31('0x75')]){_0xa92f8[_0x7d31('0x64')](_0x34c665);}_0x20515f[_0x1e2a4d][_0x7d31('0x76')]&&_0xa92f8[_0x7d31('0x3c')](_0x34c665,_0x20515f[_0x1e2a4d][_0x7d31('0x76')]===_0x7d31('0x77')?![]:!![]);_0xa92f8['field'](_0x34c665,_0x20515f[_0x1e2a4d][_0x7d31('0x78')]||_0x34c665);}if(_0x2ddfd1[_0x7d31('0x79')]){_0x2ddfd1[_0x7d31('0x79')]=JSON[_0x7d31('0x7a')](_0x2ddfd1[_0x7d31('0x79')]);for(var _0x59ec9c=0x0;_0x59ec9c<_0x2ddfd1[_0x7d31('0x79')]['length'];_0x59ec9c+=0x1){if(_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x32')]&&_[_0x7d31('0x7b')](_0xa24871,_0x2ddfd1['joins'][_0x59ec9c]['type'])&&_0x2ddfd1['joins'][_0x59ec9c]['parentKey']&&_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c]['foreignTable']&&_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7c')]){_0xa92f8[_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x32')]](_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7e')],null,util['format'](_0x7d31('0x7d'),_0x2ddfd1['table'],_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c]['parentKey'],_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7e')],_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7c')]));}}}if(_0x2ddfd1[_0x7d31('0x7f')]){_0x2ddfd1[_0x7d31('0x7f')]=JSON[_0x7d31('0x7a')](_0x2ddfd1[_0x7d31('0x7f')]);_0xa92f8[_0x7d31('0x3e')](_0x1cbcd0(_0x2ddfd1['conditions'][_0x7d31('0x64')]));}_0x316d28=_0xa92f8['clone']();_0xa92f8[_0x7d31('0x1f')](_0x3cb88f);_0xa92f8[_0x7d31('0x1e')](0x0);logger[_0x7d31('0x81')](_0x7d31('0x82'),_0xa92f8[_0x7d31('0x83')]());return db[_0x7d31('0x84')][_0x7d31('0x34')](_0xa92f8[_0x7d31('0x83')](),{'type':db[_0x7d31('0x84')][_0x7d31('0x85')]['SELECT']});}})['then'](function(){return{'sql':_0x316d28[_0x7d31('0x83')]()};})[_0x7d31('0x26')](respondWithResult(_0x2bbd1a,null))['catch'](handleError(_0x2bbd1a,null));}; \ No newline at end of file +var _0x0507=['custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','run','runReport','SUM(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','AnalyticCustomReport','includeAll','include','rows','catch','show','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','Please\x20insert\x20at\x20least\x20one\x20field','from','groupBy','clone','No\x20available\x20data','output','web','fullPath','generate'];(function(_0x11fc92,_0x4b1a76){var _0xc7373f=function(_0x3a51a2){while(--_0x3a51a2){_0x11fc92['push'](_0x11fc92['shift']());}};_0xc7373f(++_0x4b1a76);}(_0x0507,0xb8));var _0x7050=function(_0x45b196,_0x1486b4){_0x45b196=_0x45b196-0x0;var _0x247cbb=_0x0507[_0x45b196];return _0x247cbb;};'use strict';var pdf=require(_0x7050('0x0'));var emlformat=require(_0x7050('0x1'));var rimraf=require(_0x7050('0x2'));var zipdir=require(_0x7050('0x3'));var jsonpatch=require(_0x7050('0x4'));var rp=require(_0x7050('0x5'));var moment=require(_0x7050('0x6'));var BPromise=require(_0x7050('0x7'));var Mustache=require(_0x7050('0x8'));var util=require(_0x7050('0x9'));var path=require(_0x7050('0xa'));var sox=require(_0x7050('0xb'));var csv=require(_0x7050('0xc'));var ejs=require(_0x7050('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7050('0xe'));var crypto=require('crypto');var jsforce=require(_0x7050('0xf'));var deskjs=require(_0x7050('0x10'));var toCsv=require(_0x7050('0xc'));var querystring=require(_0x7050('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7050('0x12'));var qs=require(_0x7050('0x13'));var as=require(_0x7050('0x14'));var hardwareService=require(_0x7050('0x15'));var logger=require(_0x7050('0x16'))('api');var utils=require(_0x7050('0x17'));var config=require(_0x7050('0x18'));var licenseUtil=require(_0x7050('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7050('0x1a'))[_0x7050('0x1b')];function respondWithStatusCode(_0x17b8e7,_0x95b5b1){_0x95b5b1=_0x95b5b1||0xcc;return function(_0xe1a9cc){if(_0xe1a9cc){return _0x17b8e7[_0x7050('0x1c')](_0x95b5b1);}return _0x17b8e7['status'](_0x95b5b1)[_0x7050('0x1d')]();};}function respondWithResult(_0x236b8a,_0x457ceb){_0x457ceb=_0x457ceb||0xc8;return function(_0x86f42e){if(_0x86f42e){return _0x236b8a[_0x7050('0x1e')](_0x457ceb)['json'](_0x86f42e);}};}function respondWithFilteredResult(_0x2a43fb,_0x3f11e5){return function(_0xafe8c4){if(_0xafe8c4){var _0x157f2e=_0xafe8c4[_0x7050('0x1f')],_0x2b5959=_0x3f11e5['offset'],_0x2dbc7d=_0x3f11e5[_0x7050('0x20')]+_0x3f11e5[_0x7050('0x21')],_0x402588;if(_0x2dbc7d>=_0x157f2e){_0x2dbc7d=_0x157f2e;_0x402588=0xc8;}else{_0x402588=0xce;}_0x2a43fb['status'](_0x402588);return _0x2a43fb[_0x7050('0x22')](_0x7050('0x23'),_0x2b5959+'-'+_0x2dbc7d+'/'+_0x157f2e)[_0x7050('0x24')](_0xafe8c4);}return null;};}function patchUpdates(_0x2d8522){return function(_0x1c7fe1){try{jsonpatch[_0x7050('0x25')](_0x1c7fe1,_0x2d8522,!![]);}catch(_0x3a66bf){return BPromise[_0x7050('0x26')](_0x3a66bf);}return _0x1c7fe1[_0x7050('0x27')]();};}function saveUpdates(_0x1c9931,_0x424e5b){return function(_0x142a93){if(_0x142a93){return _0x142a93[_0x7050('0x28')](_0x1c9931)[_0x7050('0x29')](function(_0x160d21){return _0x160d21;});}return null;};}function removeEntity(_0x2594e5,_0x904e60){return function(_0x27896b){if(_0x27896b){return _0x27896b[_0x7050('0x2a')]()[_0x7050('0x29')](function(){var _0xafed3d=_0x27896b[_0x7050('0x2b')]({'plain':!![]});var _0x32ae81=_0x7050('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x32ae81,'resourceId':_0xafed3d['id']}})[_0x7050('0x29')](function(){return _0x27896b;});})[_0x7050('0x29')](function(){_0x2594e5[_0x7050('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a67c9,_0x38a399){return function(_0x70093){if(!_0x70093){_0x5a67c9[_0x7050('0x1c')](0x194);}return _0x70093;};}function handleError(_0x5e9ff1,_0x1365a9){_0x1365a9=_0x1365a9||0x1f4;return function(_0xdb0f06){logger[_0x7050('0x2d')](_0xdb0f06[_0x7050('0x2e')]);if(_0xdb0f06[_0x7050('0x2f')]){delete _0xdb0f06[_0x7050('0x2f')];}_0x5e9ff1[_0x7050('0x1e')](_0x1365a9)[_0x7050('0x30')](_0xdb0f06);};}exports['index']=function(_0x5a0712,_0x2684ce){var _0x50bddc={},_0x59d086={},_0xbc7899={'count':0x0,'rows':[]};var _0x132422=_[_0x7050('0x31')](db['AnalyticCustomReport'][_0x7050('0x32')],function(_0x1aa4cc){return{'name':_0x1aa4cc[_0x7050('0x33')],'type':_0x1aa4cc['type']['key']};});_0x59d086[_0x7050('0x34')]=_[_0x7050('0x31')](_0x132422,_0x7050('0x2f'));_0x59d086[_0x7050('0x35')]=_[_0x7050('0x36')](_0x5a0712[_0x7050('0x35')]);_0x59d086[_0x7050('0x37')]=_['intersection'](_0x59d086[_0x7050('0x34')],_0x59d086['query']);_0x50bddc[_0x7050('0x38')]=_[_0x7050('0x39')](_0x59d086[_0x7050('0x34')],qs[_0x7050('0x3a')](_0x5a0712[_0x7050('0x35')][_0x7050('0x3a')]));_0x50bddc['attributes']=_0x50bddc[_0x7050('0x38')][_0x7050('0x3b')]?_0x50bddc[_0x7050('0x38')]:_0x59d086[_0x7050('0x34')];if(!_0x5a0712[_0x7050('0x35')][_0x7050('0x3c')](_0x7050('0x3d'))){_0x50bddc[_0x7050('0x21')]=qs[_0x7050('0x21')](_0x5a0712[_0x7050('0x35')][_0x7050('0x21')]);_0x50bddc[_0x7050('0x20')]=qs[_0x7050('0x20')](_0x5a0712['query'][_0x7050('0x20')]);}_0x50bddc[_0x7050('0x3e')]=qs['sort'](_0x5a0712[_0x7050('0x35')][_0x7050('0x3f')]);_0x50bddc[_0x7050('0x40')]=qs[_0x7050('0x37')](_['pick'](_0x5a0712[_0x7050('0x35')],_0x59d086[_0x7050('0x37')]),_0x132422);if(_0x5a0712[_0x7050('0x35')][_0x7050('0x41')]){_0x50bddc[_0x7050('0x40')]=_[_0x7050('0x42')](_0x50bddc[_0x7050('0x40')],{'$or':_[_0x7050('0x31')](_0x132422,function(_0x303ca7){if(_0x303ca7[_0x7050('0x43')]!==_0x7050('0x44')){var _0x14943c={};_0x14943c[_0x303ca7[_0x7050('0x2f')]]={'$like':'%'+_0x5a0712[_0x7050('0x35')][_0x7050('0x41')]+'%'};return _0x14943c;}})});}_0x50bddc=_[_0x7050('0x42')]({},_0x50bddc,_0x5a0712['options']);var _0x2a9ae7={'where':_0x50bddc[_0x7050('0x40')]};return db[_0x7050('0x45')][_0x7050('0x1f')](_0x2a9ae7)['then'](function(_0x473a15){_0xbc7899['count']=_0x473a15;if(_0x5a0712[_0x7050('0x35')][_0x7050('0x46')]){_0x50bddc[_0x7050('0x47')]=[{'all':!![]}];}return db[_0x7050('0x45')]['findAll'](_0x50bddc);})[_0x7050('0x29')](function(_0x101976){_0xbc7899[_0x7050('0x48')]=_0x101976;return _0xbc7899;})['then'](respondWithFilteredResult(_0x2684ce,_0x50bddc))[_0x7050('0x49')](handleError(_0x2684ce,null));};exports[_0x7050('0x4a')]=function(_0x4497dc,_0x21ed0a){var _0x38ce94={'raw':![],'where':{'id':_0x4497dc['params']['id']}},_0x223c52={};_0x223c52[_0x7050('0x34')]=_[_0x7050('0x36')](db[_0x7050('0x45')][_0x7050('0x32')]);_0x223c52[_0x7050('0x35')]=_['keys'](_0x4497dc['query']);_0x223c52[_0x7050('0x37')]=_['intersection'](_0x223c52[_0x7050('0x34')],_0x223c52[_0x7050('0x35')]);_0x38ce94[_0x7050('0x38')]=_[_0x7050('0x39')](_0x223c52[_0x7050('0x34')],qs[_0x7050('0x3a')](_0x4497dc[_0x7050('0x35')][_0x7050('0x3a')]));_0x38ce94[_0x7050('0x38')]=_0x38ce94['attributes'][_0x7050('0x3b')]?_0x38ce94[_0x7050('0x38')]:_0x223c52[_0x7050('0x34')];if(_0x4497dc['query'][_0x7050('0x46')]){_0x38ce94[_0x7050('0x47')]=[{'all':!![]}];}_0x38ce94=_[_0x7050('0x42')]({},_0x38ce94,_0x4497dc[_0x7050('0x4b')]);return db[_0x7050('0x45')][_0x7050('0x4c')](_0x38ce94)[_0x7050('0x29')](handleEntityNotFound(_0x21ed0a,null))[_0x7050('0x29')](respondWithResult(_0x21ed0a,null))['catch'](handleError(_0x21ed0a,null));};exports[_0x7050('0x4d')]=function(_0x62508,_0x3c2c3a){return db[_0x7050('0x45')][_0x7050('0x4d')](_0x62508['body'],{})[_0x7050('0x29')](function(_0x40f8f6){var _0xfcbb72=_0x62508[_0x7050('0x4e')][_0x7050('0x2b')]({'plain':!![]});if(!_0xfcbb72)throw new Error(_0x7050('0x4f'));if(_0xfcbb72['role']===_0x7050('0x4e')){var _0x200ccb=_0x40f8f6[_0x7050('0x2b')]({'plain':!![]});var _0xcf102c='Reports';return db[_0x7050('0x50')][_0x7050('0x4c')]({'where':{'name':_0xcf102c,'userProfileId':_0xfcbb72[_0x7050('0x51')]},'raw':!![]})[_0x7050('0x29')](function(_0x1efb0b){if(_0x1efb0b&&_0x1efb0b[_0x7050('0x52')]===0x0){return db[_0x7050('0x53')]['create']({'name':_0x200ccb['name'],'resourceId':_0x200ccb['id'],'type':_0x7050('0x2c'),'sectionId':_0x1efb0b['id']},{})[_0x7050('0x29')](function(){return _0x40f8f6;});}else{return _0x40f8f6;}})['catch'](function(_0x25fb2a){logger[_0x7050('0x2d')](_0x7050('0x54'),_0x25fb2a);throw _0x25fb2a;});}return _0x40f8f6;})[_0x7050('0x29')](respondWithResult(_0x3c2c3a,0xc9))[_0x7050('0x49')](handleError(_0x3c2c3a,null));};exports[_0x7050('0x28')]=function(_0x493728,_0x43ed8c){if(_0x493728[_0x7050('0x55')]['id']){delete _0x493728[_0x7050('0x55')]['id'];}return db[_0x7050('0x45')]['find']({'where':{'id':_0x493728[_0x7050('0x56')]['id']}})['then'](handleEntityNotFound(_0x43ed8c,null))['then'](saveUpdates(_0x493728['body'],null))[_0x7050('0x29')](respondWithResult(_0x43ed8c,null))[_0x7050('0x49')](handleError(_0x43ed8c,null));};exports[_0x7050('0x2a')]=function(_0xf7ea22,_0x4e2506){return db[_0x7050('0x45')][_0x7050('0x4c')]({'where':{'id':_0xf7ea22[_0x7050('0x56')]['id']}})[_0x7050('0x29')](handleEntityNotFound(_0x4e2506,null))[_0x7050('0x29')](removeEntity(_0x4e2506,null))[_0x7050('0x49')](handleError(_0x4e2506,null));};exports[_0x7050('0x57')]=function(_0x578626,_0x3543af){var _0x4ba2c8=0xa;var _0x5a1072=[_0x7050('0x58'),_0x7050('0x59'),_0x7050('0x5a'),_0x7050('0x5b')];var _0x353d90={'SUM':'SUM(%s)','COUNT':_0x7050('0x5c'),'COUNT DISTINCT':_0x7050('0x5d'),'MAX':_0x7050('0x5e'),'MIN':_0x7050('0x5f'),'AVG':_0x7050('0x60'),'GROUP_CONCAT':_0x7050('0x61'),'GROUP_CONCAT ASC':_0x7050('0x62'),'GROUP_CONCAT DESC':_0x7050('0x63')};var _0x3bf2cd={'SEC_TO_TIME':_0x7050('0x64'),'DATE':_0x7050('0x65'),'HOUR':_0x7050('0x66'),'ROUND':_0x7050('0x67'),'UNIX_TIMESTAMP':_0x7050('0x68')};var _0x3f279b=function(_0x1e22a3){return!_[_0x7050('0x69')]([_0x7050('0x6a'),_0x7050('0x6b'),_0x7050('0x6c'),'IS\x20NOT\x20EMPTY'],_0x1e22a3);};var _0x4e0861=function(_0xa6820a){if(!_0xa6820a||!_0xa6820a[_0x7050('0x6d')]['length']){return'';}for(var _0x311715='(',_0x174ccc=0x0;_0x174ccc<_0xa6820a[_0x7050('0x6d')][_0x7050('0x3b')];_0x174ccc+=0x1){_0x174ccc>0x0&&(_0x311715+='\x20'+_0xa6820a[_0x7050('0x6e')]+'\x20');_0x311715+=_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x6f')]?_0x4e0861(_0xa6820a[_0x7050('0x6d')][_0x174ccc]['group']):_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x70')]+'\x20'+_0xa6820a[_0x7050('0x6d')][_0x174ccc]['condition']+(_0x3f279b(_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x71')])?'\x20'+_0xa6820a[_0x7050('0x6d')][_0x174ccc][_0x7050('0x72')]:'');}return _0x311715+')';};var _0x39ad6b={'where':{'id':_0x578626[_0x7050('0x56')]['id']}},_0x372af6,_0x16a4f5,_0x8583ac,_0x8ccfa6,_0xbdeacf;_0x39ad6b=_[_0x7050('0x42')]({},_0x39ad6b,_0x578626[_0x7050('0x4b')]);return db[_0x7050('0x45')][_0x7050('0x4c')](_0x39ad6b)[_0x7050('0x29')](function(_0x7f3d19){if(_0x7f3d19){_0x372af6=_0x7f3d19;return _0x7f3d19[_0x7050('0x73')]();}return null;})[_0x7050('0x29')](function(_0x3d0986){if(_0x3d0986){if(!_0x3d0986['length']){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x16a4f5=_0x3d0986;return db[_0x7050('0x76')][_0x7050('0x77')]({'raw':!![]});}return null;})[_0x7050('0x29')](function(_0x465f97){if(_0x465f97){_0x8583ac=_[_0x7050('0x78')](_0x465f97,'id');var _0x925800;var _0x166183=squel[_0x7050('0x79')]();_0x166183['from'](_0x372af6['table']);for(var _0x2c2635=0x0;_0x2c2635<_0x16a4f5['length'];_0x2c2635+=0x1){_0x925800=_0x16a4f5[_0x2c2635][_0x7050('0x7a')]?_0x8583ac[_0x16a4f5[_0x2c2635][_0x7050('0x7a')]][_0x7050('0x7b')]:_0x16a4f5[_0x2c2635][_0x7050('0x70')];_0x925800=_0x16a4f5[_0x2c2635][_0x7050('0x7c')]?_['replace'](_0x353d90[_0x16a4f5[_0x2c2635][_0x7050('0x7c')]],'%s',_0x925800):_0x925800;_0x925800=_0x16a4f5[_0x2c2635]['format']?_[_0x7050('0x7d')](_0x3bf2cd[_0x16a4f5[_0x2c2635][_0x7050('0x7e')]],'%s',_0x925800):_0x925800;if(_0x16a4f5[_0x2c2635]['groupBy']){_0x166183[_0x7050('0x6f')](_0x925800);}_0x16a4f5[_0x2c2635][_0x7050('0x7f')]&&_0x166183[_0x7050('0x3e')](_0x925800,_0x16a4f5[_0x2c2635][_0x7050('0x7f')]==='DESC'?![]:!![]);_0x166183[_0x7050('0x70')](_0x925800,_0x16a4f5[_0x2c2635][_0x7050('0x80')]||_0x925800);}if(_0x372af6[_0x7050('0x81')]){_0x372af6['joins']=JSON[_0x7050('0x82')](_0x372af6[_0x7050('0x81')]);for(var _0x694a72=0x0;_0x694a72<_0x372af6['joins'][_0x7050('0x3b')];_0x694a72+=0x1){if(_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x43')]&&_[_0x7050('0x69')](_0x5a1072,_0x372af6['joins'][_0x694a72][_0x7050('0x43')])&&_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x83')]&&_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x84')]&&_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x85')]){_0x166183[_0x372af6[_0x7050('0x81')][_0x694a72]['type']](_0x372af6['joins'][_0x694a72][_0x7050('0x84')],null,util[_0x7050('0x7e')](_0x7050('0x86'),_0x372af6[_0x7050('0x87')],_0x372af6[_0x7050('0x81')][_0x694a72]['parentKey'],_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x84')],_0x372af6[_0x7050('0x81')][_0x694a72][_0x7050('0x85')]));}}}if(_0x372af6[_0x7050('0x88')]){_0x372af6[_0x7050('0x88')]=JSON[_0x7050('0x82')](_0x372af6[_0x7050('0x88')]);_0x166183[_0x7050('0x40')](_0x4e0861(_0x372af6['conditions']['group']));}_0xbdeacf=_0x166183['clone']();_0x166183['limit'](_0x4ba2c8);_0x166183[_0x7050('0x20')](0x0);logger[_0x7050('0x89')](_0x7050('0x8a'),_0x166183['toString']());return db[_0x7050('0x8b')][_0x7050('0x35')](_0x166183[_0x7050('0x8c')](),{'type':db[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});}})['then'](respondWithResult(_0x3543af,null))[_0x7050('0x49')](handleError(_0x3543af,null));};function runReport(_0x5b5bfd,_0x7dead0,_0x5e795d){var _0x1c7fd7=_0x7dead0[_0x7050('0x2f')];var _0x1e1d92=0xa;var _0x503401=[_0x7050('0x58'),_0x7050('0x59'),_0x7050('0x5a'),_0x7050('0x5b')];var _0x37253d={'SUM':'SUM(%s)','COUNT':_0x7050('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7050('0x5f'),'AVG':_0x7050('0x60'),'GROUP_CONCAT':_0x7050('0x61'),'GROUP_CONCAT ASC':_0x7050('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x31e224={'SEC_TO_TIME':_0x7050('0x64'),'DATE':_0x7050('0x65'),'HOUR':_0x7050('0x66'),'ROUND':_0x7050('0x67'),'UNIX_TIMESTAMP':_0x7050('0x68')};var _0x2849d2=function(_0x196366){return!_['includes']([_0x7050('0x6a'),'IS\x20NOT\x20NULL',_0x7050('0x6c'),'IS\x20NOT\x20EMPTY'],_0x196366);};var _0x4cf5cd=function(_0xc43771){if(!_0xc43771||!_0xc43771[_0x7050('0x6d')][_0x7050('0x3b')]){return'';}for(var _0x22dbbf='(',_0x159bc1=0x0;_0x159bc1<_0xc43771['rules']['length'];_0x159bc1+=0x1){_0x159bc1>0x0&&(_0x22dbbf+='\x20'+_0xc43771['operator']+'\x20');_0x22dbbf+=_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x6f')]?_0x4cf5cd(_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x6f')]):_0xc43771[_0x7050('0x6d')][_0x159bc1]['field']+'\x20'+_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x71')]+(_0x2849d2(_0xc43771[_0x7050('0x6d')][_0x159bc1][_0x7050('0x71')])?'\x20'+_0xc43771['rules'][_0x159bc1]['value']:'');}return _0x22dbbf+')';};var _0x3ff85b={'where':{'id':_0x5b5bfd['id']}},_0x994828,_0x32a212,_0x123eb3,_0x524d52,_0x8f9cda;_0x3ff85b=_[_0x7050('0x42')]({},_0x3ff85b,_0x5e795d);return db['AnalyticCustomReport'][_0x7050('0x4c')](_0x3ff85b)['then'](function(_0x4eeabc){if(_0x4eeabc){_0x994828=_0x4eeabc;return _0x4eeabc[_0x7050('0x73')]();}return null;})[_0x7050('0x29')](function(_0x34f1ed){if(_0x34f1ed){if(!_0x34f1ed[_0x7050('0x3b')]){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))](_0x7050('0x8f'),0x193);}_0x32a212=_0x34f1ed;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x7050('0x29')](function(_0x4d25eb){if(_0x4d25eb){_0x123eb3=_['keyBy'](_0x4d25eb,'id');var _0x3122;var _0x9c84f8=squel[_0x7050('0x79')]();_0x9c84f8[_0x7050('0x90')](_0x994828[_0x7050('0x87')]);for(var _0x2583a7=0x0;_0x2583a7<_0x32a212[_0x7050('0x3b')];_0x2583a7+=0x1){_0x3122=_0x32a212[_0x2583a7][_0x7050('0x7a')]?_0x123eb3[_0x32a212[_0x2583a7][_0x7050('0x7a')]][_0x7050('0x7b')]:_0x32a212[_0x2583a7][_0x7050('0x70')];_0x3122=_0x32a212[_0x2583a7][_0x7050('0x7c')]?_[_0x7050('0x7d')](_0x37253d[_0x32a212[_0x2583a7][_0x7050('0x7c')]],'%s',_0x3122):_0x3122;_0x3122=_0x32a212[_0x2583a7][_0x7050('0x7e')]?_[_0x7050('0x7d')](_0x31e224[_0x32a212[_0x2583a7][_0x7050('0x7e')]],'%s',_0x3122):_0x3122;if(_0x32a212[_0x2583a7][_0x7050('0x91')]){_0x9c84f8[_0x7050('0x6f')](_0x3122);}_0x32a212[_0x2583a7][_0x7050('0x7f')]&&_0x9c84f8['order'](_0x3122,_0x32a212[_0x2583a7][_0x7050('0x7f')]==='DESC'?![]:!![]);_0x9c84f8[_0x7050('0x70')](_0x3122,_0x32a212[_0x2583a7][_0x7050('0x80')]||_0x3122);}if(_0x994828['joins']){_0x994828[_0x7050('0x81')]=JSON[_0x7050('0x82')](_0x994828[_0x7050('0x81')]);for(var _0x2a35a0=0x0;_0x2a35a0<_0x994828[_0x7050('0x81')][_0x7050('0x3b')];_0x2a35a0+=0x1){if(_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x43')]&&_[_0x7050('0x69')](_0x503401,_0x994828['joins'][_0x2a35a0][_0x7050('0x43')])&&_0x994828['joins'][_0x2a35a0][_0x7050('0x83')]&&_0x994828[_0x7050('0x81')][_0x2a35a0]['foreignTable']&&_0x994828['joins'][_0x2a35a0][_0x7050('0x85')]){_0x9c84f8[_0x994828['joins'][_0x2a35a0][_0x7050('0x43')]](_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x84')],null,util[_0x7050('0x7e')](_0x7050('0x86'),_0x994828[_0x7050('0x87')],_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x83')],_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x84')],_0x994828[_0x7050('0x81')][_0x2a35a0][_0x7050('0x85')]));}}}if(_0x994828[_0x7050('0x88')]){_0x994828[_0x7050('0x88')]=JSON[_0x7050('0x82')](_0x994828[_0x7050('0x88')]);_0x9c84f8[_0x7050('0x40')](_0x4cf5cd(_0x994828['conditions'][_0x7050('0x6f')]));}_0x8f9cda=_0x9c84f8[_0x7050('0x92')]();_0x9c84f8[_0x7050('0x21')](_0x1e1d92);_0x9c84f8[_0x7050('0x20')](0x0);logger[_0x7050('0x89')]('Limited\x20Query:',_0x9c84f8[_0x7050('0x8c')]());return db[_0x7050('0x8b')][_0x7050('0x35')](_0x9c84f8['toString'](),{'type':db[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});}})[_0x7050('0x29')](function(_0x16e5ec){if(!_0x16e5ec[_0x7050('0x3b')]){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))](_0x7050('0x93'),0xcc);}if(_0x7dead0[_0x7050('0x94')]===_0x7050('0x95')){return null;}var _0x5e7c99=_[_0x7050('0x42')](_0x7dead0,{'name':_0x7dead0[_0x7050('0x96')]||_0x7dead0[_0x7050('0x2f')]||_0x994828['name'],'basename':_0x1c7fd7,'savename':util[_0x7050('0x7e')]('%s-%s.%s',_0x7dead0[_0x7050('0x2f')]||_0x994828['name'],require('randomstring')[_0x7050('0x97')](0x4),_0x7dead0['output']||'csv'),'reportId':_0x994828['id'],'reportType':_0x7050('0x98')});return db['AnalyticExtractedReport'][_0x7050('0x4d')](_0x5e7c99,{'raw':!![]});})[_0x7050('0x29')](function(_0x437340){if(_0x994828[_0x7050('0x87')]===_0x7050('0x99')){_0x8f9cda['where'](_0x994828[_0x7050('0x87')]+_0x7050('0x9a'),_0x7dead0[_0x7050('0x9b')],_0x7dead0['endDate']);}else{_0x8f9cda['where'](_0x994828[_0x7050('0x87')]+_0x7050('0x9c'),_0x7dead0[_0x7050('0x9b')],_0x7dead0[_0x7050('0x9d')]);}if(_0x437340){logger[_0x7050('0x9e')](_0x7050('0x9f'),_0x8f9cda[_0x7050('0x8c')]());require(_0x7050('0xa0'))[_0x7050('0xa1')](path[_0x7050('0x58')](__dirname,_0x7050('0xa2'),_0x437340[_0x7050('0x94')]),[_0x437340['id'],_0x8f9cda[_0x7050('0x8c')](),path[_0x7050('0x58')](__dirname,'../../files/reports',_0x437340['savename']),_0x1c7fd7]);return _0x437340;}else{var _0x4c05a5=squel[_0x7050('0x79')]();_0x4c05a5['from']('('+_0x8f9cda[_0x7050('0x8c')]()+')',_0x7050('0xa3'));_0x4c05a5[_0x7050('0x70')](_0x7050('0xa4'),_0x7050('0x1f'));_0x8f9cda[_0x7050('0x21')](_0x7dead0['limit']||_0x1e1d92);_0x8f9cda['offset'](_0x7dead0[_0x7050('0x20')]||0x0);return dbH[_0x7050('0x8b')][_0x7050('0x35')](_0x4c05a5[_0x7050('0x8c')](),{'type':dbH['sequelize'][_0x7050('0x8d')][_0x7050('0x8e')]})[_0x7050('0x29')](function(_0x31508c){if(!_0x31508c[_0x7050('0x3b')]){_0x524d52=0x0;}else{_0x524d52=_0x31508c[0x0][_0x7050('0x1f')]||0x0;}return dbH[_0x7050('0x8b')][_0x7050('0x35')](_0x8f9cda[_0x7050('0x8c')](),{'type':dbH[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});})[_0x7050('0x29')](function(_0x32fa1d){return{'rows':_0x32fa1d||[],'count':_0x524d52};});}});}exports[_0x7050('0xa5')]=function(_0x5f4178,_0x2dad2b){return runReport(_0x5f4178[_0x7050('0x56')],_0x5f4178['query'],_0x5f4178[_0x7050('0x4b')])[_0x7050('0x29')](respondWithResult(_0x2dad2b,null))['catch'](handleError(_0x2dad2b,null));};exports[_0x7050('0xa6')]=runReport;exports[_0x7050('0x35')]=function(_0x4b557e,_0x28747b){var _0x2ce745=0xa;var _0x4d2c78=[_0x7050('0x58'),_0x7050('0x59'),_0x7050('0x5a'),_0x7050('0x5b')];var _0x7b4daf={'SUM':_0x7050('0xa7'),'COUNT':_0x7050('0x5c'),'COUNT DISTINCT':_0x7050('0x5d'),'MAX':_0x7050('0x5e'),'MIN':_0x7050('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7050('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x8989f2={'SEC_TO_TIME':_0x7050('0x64'),'DATE':_0x7050('0x65'),'HOUR':_0x7050('0x66'),'ROUND':_0x7050('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x143850=function(_0x337e8a){return!_['includes']([_0x7050('0x6a'),'IS\x20NOT\x20NULL',_0x7050('0x6c'),'IS\x20NOT\x20EMPTY'],_0x337e8a);};var _0x3d74ea=function(_0x13f51a){if(!_0x13f51a||!_0x13f51a[_0x7050('0x6d')][_0x7050('0x3b')]){return'';}for(var _0x3aed1b='(',_0x15e628=0x0;_0x15e628<_0x13f51a[_0x7050('0x6d')][_0x7050('0x3b')];_0x15e628+=0x1){_0x15e628>0x0&&(_0x3aed1b+='\x20'+_0x13f51a['operator']+'\x20');_0x3aed1b+=_0x13f51a[_0x7050('0x6d')][_0x15e628][_0x7050('0x6f')]?_0x3d74ea(_0x13f51a[_0x7050('0x6d')][_0x15e628][_0x7050('0x6f')]):_0x13f51a[_0x7050('0x6d')][_0x15e628]['field']+'\x20'+_0x13f51a['rules'][_0x15e628][_0x7050('0x71')]+(_0x143850(_0x13f51a['rules'][_0x15e628]['condition'])?'\x20'+_0x13f51a[_0x7050('0x6d')][_0x15e628]['value']:'');}return _0x3aed1b+')';};var _0x4d52fb={'where':{'id':_0x4b557e['params']['id']}},_0x5def99,_0x18a8ca,_0x3e5587,_0x223889,_0x3a9b84;_0x4d52fb=_['merge']({},_0x4d52fb,_0x4b557e[_0x7050('0x4b')]);return db[_0x7050('0x45')]['find'](_0x4d52fb)[_0x7050('0x29')](function(_0x487c20){if(_0x487c20){_0x5def99=_0x487c20;return _0x487c20[_0x7050('0x73')]();}return null;})['then'](function(_0x4d136f){if(_0x4d136f){if(!_0x4d136f[_0x7050('0x3b')]){throw new db[(_0x7050('0x74'))][(_0x7050('0x75'))](_0x7050('0x8f'),0x193);}_0x18a8ca=_0x4d136f;return db['AnalyticMetric'][_0x7050('0x77')]({'raw':!![]});}return null;})[_0x7050('0x29')](function(_0x2b8a3f){if(_0x2b8a3f){_0x3e5587=_[_0x7050('0x78')](_0x2b8a3f,'id');var _0x29a375;var _0x3aa4df=squel['select']();_0x3aa4df[_0x7050('0x90')](_0x5def99['table']);for(var _0x138224=0x0;_0x138224<_0x18a8ca[_0x7050('0x3b')];_0x138224+=0x1){_0x29a375=_0x18a8ca[_0x138224][_0x7050('0x7a')]?_0x3e5587[_0x18a8ca[_0x138224][_0x7050('0x7a')]]['metric']:_0x18a8ca[_0x138224][_0x7050('0x70')];_0x29a375=_0x18a8ca[_0x138224][_0x7050('0x7c')]?_['replace'](_0x7b4daf[_0x18a8ca[_0x138224][_0x7050('0x7c')]],'%s',_0x29a375):_0x29a375;_0x29a375=_0x18a8ca[_0x138224][_0x7050('0x7e')]?_[_0x7050('0x7d')](_0x8989f2[_0x18a8ca[_0x138224][_0x7050('0x7e')]],'%s',_0x29a375):_0x29a375;if(_0x18a8ca[_0x138224]['groupBy']){_0x3aa4df[_0x7050('0x6f')](_0x29a375);}_0x18a8ca[_0x138224][_0x7050('0x7f')]&&_0x3aa4df[_0x7050('0x3e')](_0x29a375,_0x18a8ca[_0x138224][_0x7050('0x7f')]==='DESC'?![]:!![]);_0x3aa4df[_0x7050('0x70')](_0x29a375,_0x18a8ca[_0x138224][_0x7050('0x80')]||_0x29a375);}if(_0x5def99[_0x7050('0x81')]){_0x5def99[_0x7050('0x81')]=JSON['parse'](_0x5def99[_0x7050('0x81')]);for(var _0x16aae8=0x0;_0x16aae8<_0x5def99[_0x7050('0x81')][_0x7050('0x3b')];_0x16aae8+=0x1){if(_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x43')]&&_[_0x7050('0x69')](_0x4d2c78,_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x43')])&&_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x83')]&&_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x84')]&&_0x5def99['joins'][_0x16aae8][_0x7050('0x85')]){_0x3aa4df[_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x43')]](_0x5def99[_0x7050('0x81')][_0x16aae8]['foreignTable'],null,util['format'](_0x7050('0x86'),_0x5def99[_0x7050('0x87')],_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x83')],_0x5def99[_0x7050('0x81')][_0x16aae8][_0x7050('0x84')],_0x5def99['joins'][_0x16aae8][_0x7050('0x85')]));}}}if(_0x5def99[_0x7050('0x88')]){_0x5def99[_0x7050('0x88')]=JSON[_0x7050('0x82')](_0x5def99[_0x7050('0x88')]);_0x3aa4df[_0x7050('0x40')](_0x3d74ea(_0x5def99['conditions'][_0x7050('0x6f')]));}_0x3a9b84=_0x3aa4df[_0x7050('0x92')]();_0x3aa4df[_0x7050('0x21')](_0x2ce745);_0x3aa4df[_0x7050('0x20')](0x0);logger['debug'](_0x7050('0x8a'),_0x3aa4df[_0x7050('0x8c')]());return db[_0x7050('0x8b')]['query'](_0x3aa4df[_0x7050('0x8c')](),{'type':db[_0x7050('0x8b')][_0x7050('0x8d')][_0x7050('0x8e')]});}})['then'](function(){return{'sql':_0x3a9b84[_0x7050('0x8c')]()};})[_0x7050('0x29')](respondWithResult(_0x28747b,null))[_0x7050('0x49')](handleError(_0x28747b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 625b8f2..15934ca 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 _0x9e1a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','analytics_custom_reports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9e1a,0x120));var _0xa9e1=function(_0x331ab8,_0x5e2dce){_0x331ab8=_0x331ab8-0x0;var _0x2edc2b=_0x9e1a[_0x331ab8];return _0x2edc2b;};'use strict';var _=require(_0xa9e1('0x0'));var util=require(_0xa9e1('0x1'));var logger=require(_0xa9e1('0x2'))(_0xa9e1('0x3'));var moment=require(_0xa9e1('0x4'));var BPromise=require(_0xa9e1('0x5'));var rp=require(_0xa9e1('0x6'));var fs=require('fs');var path=require(_0xa9e1('0x7'));var rimraf=require('rimraf');var config=require(_0xa9e1('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xa9e1('0x9')]=function(_0x1c49ca,_0x160a75){return _0x1c49ca[_0xa9e1('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xa9e1('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0175=['api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x2fe9f6,_0x549f77){var _0xaf71da=function(_0x1de2f8){while(--_0x1de2f8){_0x2fe9f6['push'](_0x2fe9f6['shift']());}};_0xaf71da(++_0x549f77);}(_0x0175,0x6d));var _0x5017=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x0175[_0x479650];return _0x26b288;};'use strict';var _=require(_0x5017('0x0'));var util=require(_0x5017('0x1'));var logger=require(_0x5017('0x2'))(_0x5017('0x3'));var moment=require('moment');var BPromise=require(_0x5017('0x4'));var rp=require(_0x5017('0x5'));var fs=require('fs');var path=require(_0x5017('0x6'));var rimraf=require(_0x5017('0x7'));var config=require(_0x5017('0x8'));var attributes=require(_0x5017('0x9'));module[_0x5017('0xa')]=function(_0xf5eda6,_0x1cebb9){return _0xf5eda6[_0x5017('0xb')](_0x5017('0xc'),attributes,{'tableName':_0x5017('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 5f4de32..2310c48 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 _0x6cf2=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b037f,_0x344924){var _0x592ece=function(_0x26bcb0){while(--_0x26bcb0){_0x4b037f['push'](_0x4b037f['shift']());}};_0x592ece(++_0x344924);}(_0x6cf2,0x1d3));var _0x26cf=function(_0x324354,_0x296cd9){_0x324354=_0x324354-0x0;var _0x5f1bc5=_0x6cf2[_0x324354];return _0x5f1bc5;};'use strict';var _=require('lodash');var util=require(_0x26cf('0x0'));var moment=require(_0x26cf('0x1'));var BPromise=require(_0x26cf('0x2'));var rs=require(_0x26cf('0x3'));var fs=require('fs');var Redis=require(_0x26cf('0x4'));var db=require(_0x26cf('0x5'))['db'];var utils=require(_0x26cf('0x6'));var logger=require(_0x26cf('0x7'))('rpc');var config=require(_0x26cf('0x8'));var jayson=require(_0x26cf('0x9'));var client=jayson[_0x26cf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34373b,_0x5daa86,_0x159b30){return new BPromise(function(_0x5cc804,_0x24604a){return client[_0x26cf('0xb')](_0x34373b,_0x159b30)['then'](function(_0x5ebad4){logger[_0x26cf('0xc')](_0x26cf('0xd'),_0x5daa86,_0x26cf('0xe'));logger[_0x26cf('0xf')](_0x26cf('0x10'),_0x5daa86,_0x26cf('0xe'),JSON[_0x26cf('0x11')](_0x5ebad4));if(_0x5ebad4[_0x26cf('0x12')]){if(_0x5ebad4[_0x26cf('0x12')][_0x26cf('0x13')]===0x1f4){logger[_0x26cf('0x12')](_0x26cf('0xd'),_0x5daa86,_0x5ebad4[_0x26cf('0x12')]['message']);return _0x24604a(_0x5ebad4['error'][_0x26cf('0x14')]);}logger[_0x26cf('0x12')](_0x26cf('0xd'),_0x5daa86,_0x5ebad4[_0x26cf('0x12')][_0x26cf('0x14')]);return _0x5cc804(_0x5ebad4[_0x26cf('0x12')][_0x26cf('0x14')]);}else{logger[_0x26cf('0xc')](_0x26cf('0xd'),_0x5daa86,_0x26cf('0xe'));_0x5cc804(_0x5ebad4[_0x26cf('0x15')][_0x26cf('0x14')]);}})['catch'](function(_0x2bc2c2){logger['error'](_0x26cf('0xd'),_0x5daa86,_0x2bc2c2);_0x24604a(_0x2bc2c2);});});} \ No newline at end of file +var _0xa143=['jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a34e0,_0x485210){var _0x5db53a=function(_0x452847){while(--_0x452847){_0x5a34e0['push'](_0x5a34e0['shift']());}};_0x5db53a(++_0x485210);}(_0xa143,0x115));var _0x3a14=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa143[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3a14('0x0'));var util=require(_0x3a14('0x1'));var moment=require(_0x3a14('0x2'));var BPromise=require(_0x3a14('0x3'));var rs=require(_0x3a14('0x4'));var fs=require('fs');var Redis=require(_0x3a14('0x5'));var db=require(_0x3a14('0x6'))['db'];var utils=require(_0x3a14('0x7'));var logger=require(_0x3a14('0x8'))(_0x3a14('0x9'));var config=require(_0x3a14('0xa'));var jayson=require(_0x3a14('0xb'));var client=jayson['client'][_0x3a14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c2f0c,_0x332857,_0x3fb806){return new BPromise(function(_0x698ed8,_0x2fafa0){return client[_0x3a14('0xd')](_0x2c2f0c,_0x3fb806)[_0x3a14('0xe')](function(_0x28d9ef){logger[_0x3a14('0xf')](_0x3a14('0x10'),_0x332857,_0x3a14('0x11'));logger[_0x3a14('0x12')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x332857,_0x3a14('0x11'),JSON[_0x3a14('0x13')](_0x28d9ef));if(_0x28d9ef['error']){if(_0x28d9ef[_0x3a14('0x14')]['code']===0x1f4){logger[_0x3a14('0x14')](_0x3a14('0x10'),_0x332857,_0x28d9ef[_0x3a14('0x14')][_0x3a14('0x15')]);return _0x2fafa0(_0x28d9ef[_0x3a14('0x14')]['message']);}logger[_0x3a14('0x14')](_0x3a14('0x10'),_0x332857,_0x28d9ef[_0x3a14('0x14')][_0x3a14('0x15')]);return _0x698ed8(_0x28d9ef[_0x3a14('0x14')][_0x3a14('0x15')]);}else{logger[_0x3a14('0xf')](_0x3a14('0x10'),_0x332857,'request\x20sent');_0x698ed8(_0x28d9ef[_0x3a14('0x16')]['message']);}})[_0x3a14('0x17')](function(_0x34ede5){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x332857,_0x34ede5);_0x2fafa0(_0x34ede5);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 255520b..3be9d82 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 _0x788e=['delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','preview','/:id/run','/:id/query','query','post','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x788e,0x152));var _0xe788=function(_0x4efcd5,_0x1aa03d){_0x4efcd5=_0x4efcd5-0x0;var _0xe8f2ea=_0x788e[_0x4efcd5];return _0xe8f2ea;};'use strict';var multer=require(_0xe788('0x0'));var util=require(_0xe788('0x1'));var path=require('path');var timeout=require(_0xe788('0x2'));var express=require('express');var router=express[_0xe788('0x3')]();var auth=require(_0xe788('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe788('0x5'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xe788('0x6')](),controller[_0xe788('0x7')]);router['get'](_0xe788('0x8'),auth['isAuthenticated'](),controller[_0xe788('0x9')]);router[_0xe788('0xa')]('/:id/preview',auth[_0xe788('0x6')](),controller[_0xe788('0xb')]);router[_0xe788('0xa')](_0xe788('0xc'),auth[_0xe788('0x6')](),controller['run']);router[_0xe788('0xa')](_0xe788('0xd'),auth[_0xe788('0x6')](),controller[_0xe788('0xe')]);router[_0xe788('0xf')]('/',auth[_0xe788('0x6')](),controller[_0xe788('0x10')]);router[_0xe788('0x11')](_0xe788('0x8'),auth[_0xe788('0x6')](),controller[_0xe788('0x12')]);router[_0xe788('0x13')]('/:id',auth[_0xe788('0x6')](),controller['destroy']);module[_0xe788('0x14')]=router; \ No newline at end of file +var _0x295b=['../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x16a4d1,_0x1926ad){var _0x4f4d61=function(_0x244f00){while(--_0x244f00){_0x16a4d1['push'](_0x16a4d1['shift']());}};_0x4f4d61(++_0x1926ad);}(_0x295b,0x14b));var _0xb295=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x295b[_0x4e7d25];return _0x526fe6;};'use strict';var multer=require(_0xb295('0x0'));var util=require('util');var path=require(_0xb295('0x1'));var timeout=require(_0xb295('0x2'));var express=require('express');var router=express[_0xb295('0x3')]();var auth=require(_0xb295('0x4'));var interaction=require(_0xb295('0x5'));var config=require(_0xb295('0x6'));var controller=require(_0xb295('0x7'));router['get']('/',auth[_0xb295('0x8')](),controller[_0xb295('0x9')]);router['get'](_0xb295('0xa'),auth['isAuthenticated'](),controller[_0xb295('0xb')]);router[_0xb295('0xc')](_0xb295('0xd'),auth[_0xb295('0x8')](),controller[_0xb295('0xe')]);router[_0xb295('0xc')](_0xb295('0xf'),auth[_0xb295('0x8')](),controller[_0xb295('0x10')]);router['get']('/:id/query',auth[_0xb295('0x8')](),controller[_0xb295('0x11')]);router[_0xb295('0x12')]('/',auth[_0xb295('0x8')](),controller['create']);router[_0xb295('0x13')](_0xb295('0xa'),auth['isAuthenticated'](),controller[_0xb295('0x14')]);router[_0xb295('0x15')](_0xb295('0xa'),auth[_0xb295('0x8')](),controller[_0xb295('0x16')]);module[_0xb295('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 062df9b..0af8a81 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 _0x4266=['sequelize','exports','STRING','TEXT'];(function(_0x5dc043,_0x25e5ca){var _0x256baf=function(_0x1e33cd){while(--_0x1e33cd){_0x5dc043['push'](_0x5dc043['shift']());}};_0x256baf(++_0x25e5ca);}(_0x4266,0xd4));var _0x6426=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4266[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x6426('0x0'));module[_0x6426('0x1')]={'name':{'type':Sequelize[_0x6426('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6426('0x2')]},'parent':{'type':Sequelize[_0x6426('0x2')]},'table':{'type':Sequelize[_0x6426('0x2')]},'conditions':{'type':Sequelize[_0x6426('0x3')]},'joins':{'type':Sequelize[_0x6426('0x3')]}}; \ No newline at end of file +var _0x42cf=['STRING','sequelize','exports'];(function(_0x51aec2,_0x2a0ac3){var _0x52aff4=function(_0x66e576){while(--_0x66e576){_0x51aec2['push'](_0x51aec2['shift']());}};_0x52aff4(++_0x2a0ac3);}(_0x42cf,0x16c));var _0xf42c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x42cf[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xf42c('0x0'));module[_0xf42c('0x1')]={'name':{'type':Sequelize[_0xf42c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf42c('0x2')]},'parent':{'type':Sequelize[_0xf42c('0x2')]},'table':{'type':Sequelize[_0xf42c('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 375a4c9..f95e67e 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 _0x4502=['output','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','COUNT(*)','count','run','right_join','GROUP_CONCAT(%s)','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','Reports','UserProfileSection','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','operator','SELECT','No\x20available\x20data','web','%s-%s.%s','randomstring','generate'];(function(_0x4fb6b6,_0x5eb1c7){var _0x3ea470=function(_0x26228c){while(--_0x26228c){_0x4fb6b6['push'](_0x4fb6b6['shift']());}};_0x3ea470(++_0x5eb1c7);}(_0x4502,0x157));var _0x2450=function(_0x50f55d,_0x34dd6e){_0x50f55d=_0x50f55d-0x0;var _0x109053=_0x4502[_0x50f55d];return _0x109053;};'use strict';var pdf=require(_0x2450('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2450('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2450('0x2'));var moment=require('moment');var BPromise=require(_0x2450('0x3'));var Mustache=require(_0x2450('0x4'));var util=require(_0x2450('0x5'));var path=require(_0x2450('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2450('0x7'));var squel=require(_0x2450('0x8'));var crypto=require('crypto');var jsforce=require(_0x2450('0x9'));var deskjs=require(_0x2450('0xa'));var toCsv=require(_0x2450('0xb'));var querystring=require(_0x2450('0xc'));var Papa=require(_0x2450('0xd'));var Redis=require(_0x2450('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2450('0xf'));var as=require(_0x2450('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2450('0x11'));var utils=require(_0x2450('0x12'));var config=require(_0x2450('0x13'));var licenseUtil=require(_0x2450('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2450('0x15'))[_0x2450('0x16')];function respondWithStatusCode(_0x20c2ce,_0x149762){_0x149762=_0x149762||0xcc;return function(_0x2aa48d){if(_0x2aa48d){return _0x20c2ce[_0x2450('0x17')](_0x149762);}return _0x20c2ce[_0x2450('0x18')](_0x149762)[_0x2450('0x19')]();};}function respondWithResult(_0x3c27e2,_0x1956e5){_0x1956e5=_0x1956e5||0xc8;return function(_0x20aae4){if(_0x20aae4){return _0x3c27e2[_0x2450('0x18')](_0x1956e5)['json'](_0x20aae4);}};}function respondWithFilteredResult(_0x1c9940,_0x18a5e6){return function(_0x591d8a){if(_0x591d8a){var _0x55b377=_0x591d8a['count'],_0x57f6fe=_0x18a5e6[_0x2450('0x1a')],_0x430f86=_0x18a5e6['offset']+_0x18a5e6[_0x2450('0x1b')],_0x497190;if(_0x430f86>=_0x55b377){_0x430f86=_0x55b377;_0x497190=0xc8;}else{_0x497190=0xce;}_0x1c9940[_0x2450('0x18')](_0x497190);return _0x1c9940['set'](_0x2450('0x1c'),_0x57f6fe+'-'+_0x430f86+'/'+_0x55b377)[_0x2450('0x1d')](_0x591d8a);}return null;};}function patchUpdates(_0x56d8d8){return function(_0x2b92da){try{jsonpatch[_0x2450('0x1e')](_0x2b92da,_0x56d8d8,!![]);}catch(_0x27af19){return BPromise[_0x2450('0x1f')](_0x27af19);}return _0x2b92da['save']();};}function saveUpdates(_0x5463b9,_0x4d6bf9){return function(_0x342ff5){if(_0x342ff5){return _0x342ff5['update'](_0x5463b9)[_0x2450('0x20')](function(_0x4efce2){return _0x4efce2;});}return null;};}function removeEntity(_0x3290f9,_0x82835f){return function(_0x1ee3dc){if(_0x1ee3dc){return _0x1ee3dc[_0x2450('0x21')]()[_0x2450('0x20')](function(){var _0x1564e8=_0x1ee3dc[_0x2450('0x22')]({'plain':!![]});var _0x533cb2='DefaultReports';return db[_0x2450('0x23')]['destroy']({'where':{'type':_0x533cb2,'resourceId':_0x1564e8['id']}})[_0x2450('0x20')](function(){return _0x1ee3dc;});})[_0x2450('0x20')](function(){_0x3290f9[_0x2450('0x18')](0xcc)[_0x2450('0x19')]();});}};}function handleEntityNotFound(_0xb96a9a,_0x225250){return function(_0x126855){if(!_0x126855){_0xb96a9a[_0x2450('0x17')](0x194);}return _0x126855;};}function handleError(_0x1ee4a8,_0x3d0898){_0x3d0898=_0x3d0898||0x1f4;return function(_0x427552){logger[_0x2450('0x24')](_0x427552[_0x2450('0x25')]);if(_0x427552[_0x2450('0x26')]){delete _0x427552['name'];}_0x1ee4a8[_0x2450('0x18')](_0x3d0898)[_0x2450('0x27')](_0x427552);};}exports[_0x2450('0x28')]=function(_0x48b4de,_0x42d8ee){var _0x3b3793={},_0xabf69e={},_0x344004={'count':0x0,'rows':[]};var _0x26f8c6=_[_0x2450('0x29')](db[_0x2450('0x2a')][_0x2450('0x2b')],function(_0x27b731){return{'name':_0x27b731[_0x2450('0x2c')],'type':_0x27b731[_0x2450('0x2d')][_0x2450('0x2e')]};});_0xabf69e[_0x2450('0x2f')]=_[_0x2450('0x29')](_0x26f8c6,_0x2450('0x26'));_0xabf69e[_0x2450('0x30')]=_[_0x2450('0x31')](_0x48b4de[_0x2450('0x30')]);_0xabf69e[_0x2450('0x32')]=_[_0x2450('0x33')](_0xabf69e[_0x2450('0x2f')],_0xabf69e[_0x2450('0x30')]);_0x3b3793[_0x2450('0x34')]=_[_0x2450('0x33')](_0xabf69e[_0x2450('0x2f')],qs[_0x2450('0x35')](_0x48b4de[_0x2450('0x30')][_0x2450('0x35')]));_0x3b3793['attributes']=_0x3b3793[_0x2450('0x34')][_0x2450('0x36')]?_0x3b3793[_0x2450('0x34')]:_0xabf69e[_0x2450('0x2f')];if(!_0x48b4de['query']['hasOwnProperty'](_0x2450('0x37'))){_0x3b3793[_0x2450('0x1b')]=qs[_0x2450('0x1b')](_0x48b4de['query'][_0x2450('0x1b')]);_0x3b3793[_0x2450('0x1a')]=qs['offset'](_0x48b4de[_0x2450('0x30')][_0x2450('0x1a')]);}_0x3b3793[_0x2450('0x38')]=qs['sort'](_0x48b4de['query'][_0x2450('0x39')]);_0x3b3793[_0x2450('0x3a')]=qs['filters'](_[_0x2450('0x3b')](_0x48b4de[_0x2450('0x30')],_0xabf69e[_0x2450('0x32')]),_0x26f8c6);if(_0x48b4de[_0x2450('0x30')][_0x2450('0x3c')]){_0x3b3793[_0x2450('0x3a')]=_[_0x2450('0x3d')](_0x3b3793[_0x2450('0x3a')],{'$or':_[_0x2450('0x29')](_0x26f8c6,function(_0x2c2892){if(_0x2c2892['type']!==_0x2450('0x3e')){var _0x357b18={};_0x357b18[_0x2c2892[_0x2450('0x26')]]={'$like':'%'+_0x48b4de[_0x2450('0x30')][_0x2450('0x3c')]+'%'};return _0x357b18;}})});}_0x3b3793=_[_0x2450('0x3d')]({},_0x3b3793,_0x48b4de[_0x2450('0x3f')]);var _0x24761f={'where':_0x3b3793['where']};return db[_0x2450('0x2a')]['count'](_0x24761f)[_0x2450('0x20')](function(_0x5eeab4){_0x344004['count']=_0x5eeab4;if(_0x48b4de['query'][_0x2450('0x40')]){_0x3b3793[_0x2450('0x41')]=[{'all':!![]}];}return db[_0x2450('0x2a')][_0x2450('0x42')](_0x3b3793);})[_0x2450('0x20')](function(_0x300bac){_0x344004[_0x2450('0x43')]=_0x300bac;return _0x344004;})['then'](respondWithFilteredResult(_0x42d8ee,_0x3b3793))[_0x2450('0x44')](handleError(_0x42d8ee,null));};exports[_0x2450('0x45')]=function(_0x752656,_0x3cab59){var _0x1a8ef2={'raw':!![],'where':{'id':_0x752656[_0x2450('0x46')]['id']}},_0x2223e4={};_0x2223e4['model']=_[_0x2450('0x31')](db[_0x2450('0x2a')][_0x2450('0x2b')]);_0x2223e4[_0x2450('0x30')]=_[_0x2450('0x31')](_0x752656[_0x2450('0x30')]);_0x2223e4[_0x2450('0x32')]=_[_0x2450('0x33')](_0x2223e4[_0x2450('0x2f')],_0x2223e4['query']);_0x1a8ef2[_0x2450('0x34')]=_[_0x2450('0x33')](_0x2223e4[_0x2450('0x2f')],qs[_0x2450('0x35')](_0x752656[_0x2450('0x30')][_0x2450('0x35')]));_0x1a8ef2[_0x2450('0x34')]=_0x1a8ef2[_0x2450('0x34')]['length']?_0x1a8ef2['attributes']:_0x2223e4[_0x2450('0x2f')];if(_0x752656[_0x2450('0x30')][_0x2450('0x40')]){_0x1a8ef2['include']=[{'all':!![]}];}_0x1a8ef2=_[_0x2450('0x3d')]({},_0x1a8ef2,_0x752656[_0x2450('0x3f')]);return db[_0x2450('0x2a')][_0x2450('0x47')](_0x1a8ef2)['then'](handleEntityNotFound(_0x3cab59,null))[_0x2450('0x20')](respondWithResult(_0x3cab59,null))[_0x2450('0x44')](handleError(_0x3cab59,null));};exports['create']=function(_0x3937fc,_0x287386){return db[_0x2450('0x2a')][_0x2450('0x48')](_0x3937fc[_0x2450('0x49')],{})['then'](function(_0x1f922e){var _0x1ffe7a=_0x3937fc[_0x2450('0x4a')][_0x2450('0x22')]({'plain':!![]});if(!_0x1ffe7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ffe7a[_0x2450('0x4b')]==='user'){var _0x2de1fd=_0x1f922e[_0x2450('0x22')]({'plain':!![]});var _0xd7ace8=_0x2450('0x4c');return db[_0x2450('0x4d')][_0x2450('0x47')]({'where':{'name':_0xd7ace8,'userProfileId':_0x1ffe7a['userProfileId']},'raw':!![]})['then'](function(_0x592c4b){if(_0x592c4b&&_0x592c4b['autoAssociation']===0x0){return db[_0x2450('0x23')][_0x2450('0x48')]({'name':_0x2de1fd[_0x2450('0x26')],'resourceId':_0x2de1fd['id'],'type':_0x2450('0x4e'),'sectionId':_0x592c4b['id']},{})[_0x2450('0x20')](function(){return _0x1f922e;});}else{return _0x1f922e;}})[_0x2450('0x44')](function(_0xedc1ec){logger[_0x2450('0x24')](_0x2450('0x4f'),_0xedc1ec);throw _0xedc1ec;});}return _0x1f922e;})[_0x2450('0x20')](respondWithResult(_0x287386,0xc9))[_0x2450('0x44')](handleError(_0x287386,null));};exports[_0x2450('0x50')]=function(_0x1babc5,_0x3ee6ef){if(_0x1babc5[_0x2450('0x49')]['id']){delete _0x1babc5[_0x2450('0x49')]['id'];}return db[_0x2450('0x2a')]['find']({'where':{'id':_0x1babc5[_0x2450('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ee6ef,null))[_0x2450('0x20')](saveUpdates(_0x1babc5[_0x2450('0x49')],null))['then'](respondWithResult(_0x3ee6ef,null))['catch'](handleError(_0x3ee6ef,null));};exports['destroy']=function(_0x332e5d,_0x468815){return db[_0x2450('0x2a')][_0x2450('0x47')]({'where':{'id':_0x332e5d['params']['id']}})[_0x2450('0x20')](handleEntityNotFound(_0x468815,null))['then'](removeEntity(_0x468815,null))[_0x2450('0x44')](handleError(_0x468815,null));};exports[_0x2450('0x51')]=function(_0xd05a59,_0x16e65c){var _0x15198a=0xa;var _0x933248=[_0x2450('0x52'),_0x2450('0x53'),'right_join','cross_join'];var _0x18fe7d={'SUM':_0x2450('0x54'),'COUNT':_0x2450('0x55'),'COUNT DISTINCT':_0x2450('0x56'),'MAX':'MAX(%s)','MIN':_0x2450('0x57'),'AVG':_0x2450('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2450('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2eea8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2450('0x5a'),'HOUR':_0x2450('0x5b'),'ROUND':_0x2450('0x5c'),'UNIX_TIMESTAMP':_0x2450('0x5d')};var _0x37eea4=function(_0x52b29a){return!_[_0x2450('0x5e')]([_0x2450('0x5f'),'IS\x20NOT\x20NULL',_0x2450('0x60'),_0x2450('0x61')],_0x52b29a);};var _0x3ddf34=function(_0x347085){if(!_0x347085||!_0x347085[_0x2450('0x62')][_0x2450('0x36')]){return'';}for(var _0x21f8d5='(',_0x1f9f8e=0x0;_0x1f9f8e<_0x347085[_0x2450('0x62')][_0x2450('0x36')];_0x1f9f8e+=0x1){_0x1f9f8e>0x0&&(_0x21f8d5+='\x20'+_0x347085['operator']+'\x20');_0x21f8d5+=_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x63')]?_0x3ddf34(_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x63')]):_0x347085[_0x2450('0x62')][_0x1f9f8e]['field']+'\x20'+_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x64')]+(_0x37eea4(_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x64')])?'\x20'+_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x65')]:'');}return _0x21f8d5+')';};var _0x3d208e={'where':{'id':_0xd05a59[_0x2450('0x46')]['id']}},_0x159fe1,_0x188034,_0x35f705,_0x426ba5,_0x434c44;_0x3d208e=_['merge']({},_0x3d208e,_0xd05a59[_0x2450('0x3f')]);return db[_0x2450('0x2a')]['find'](_0x3d208e)[_0x2450('0x20')](function(_0x3e8c93){if(_0x3e8c93){_0x159fe1=_0x3e8c93;return _0x3e8c93[_0x2450('0x66')]();}return null;})[_0x2450('0x20')](function(_0x38934a){if(_0x38934a){if(!_0x38934a[_0x2450('0x36')]){throw new db[(_0x2450('0x67'))][(_0x2450('0x68'))](_0x2450('0x69'),0x193);}_0x188034=_0x38934a;return db[_0x2450('0x6a')][_0x2450('0x42')]({'raw':!![]});}return null;})[_0x2450('0x20')](function(_0x4f8321){if(_0x4f8321){_0x35f705=_[_0x2450('0x6b')](_0x4f8321,'id');var _0x194cae;var _0x245530=squel[_0x2450('0x6c')]();_0x245530[_0x2450('0x6d')](_0x159fe1[_0x2450('0x6e')]);for(var _0x2a798b=0x0;_0x2a798b<_0x188034['length'];_0x2a798b+=0x1){_0x194cae=_0x188034[_0x2a798b][_0x2450('0x6f')]?_0x35f705[_0x188034[_0x2a798b][_0x2450('0x6f')]][_0x2450('0x70')]:_0x188034[_0x2a798b][_0x2450('0x71')];_0x194cae=_0x188034[_0x2a798b][_0x2450('0x72')]?_[_0x2450('0x73')](_0x18fe7d[_0x188034[_0x2a798b][_0x2450('0x72')]],'%s',_0x194cae):_0x194cae;_0x194cae=_0x188034[_0x2a798b][_0x2450('0x74')]?_[_0x2450('0x73')](_0x2eea8b[_0x188034[_0x2a798b]['format']],'%s',_0x194cae):_0x194cae;if(_0x188034[_0x2a798b][_0x2450('0x75')]){_0x245530[_0x2450('0x63')](_0x194cae);}_0x188034[_0x2a798b][_0x2450('0x76')]&&_0x245530['order'](_0x194cae,_0x188034[_0x2a798b][_0x2450('0x76')]===_0x2450('0x77')?![]:!![]);_0x245530[_0x2450('0x71')](_0x194cae,_0x188034[_0x2a798b][_0x2450('0x78')]||_0x194cae);}if(_0x159fe1[_0x2450('0x79')]){_0x159fe1[_0x2450('0x79')]=JSON[_0x2450('0x7a')](_0x159fe1[_0x2450('0x79')]);for(var _0x53d25f=0x0;_0x53d25f<_0x159fe1['joins']['length'];_0x53d25f+=0x1){if(_0x159fe1[_0x2450('0x79')][_0x53d25f]['type']&&_[_0x2450('0x5e')](_0x933248,_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x2d')])&&_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x7b')]&&_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x7c')]&&_0x159fe1[_0x2450('0x79')][_0x53d25f]['foreignKey']){_0x245530[_0x159fe1['joins'][_0x53d25f][_0x2450('0x2d')]](_0x159fe1['joins'][_0x53d25f]['foreignTable'],null,util[_0x2450('0x74')](_0x2450('0x7d'),_0x159fe1[_0x2450('0x6e')],_0x159fe1['joins'][_0x53d25f]['parentKey'],_0x159fe1['joins'][_0x53d25f][_0x2450('0x7c')],_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x7e')]));}}}if(_0x159fe1[_0x2450('0x7f')]){_0x159fe1['conditions']=JSON['parse'](_0x159fe1[_0x2450('0x7f')]);_0x245530[_0x2450('0x3a')](_0x3ddf34(_0x159fe1[_0x2450('0x7f')][_0x2450('0x63')]));}_0x434c44=_0x245530[_0x2450('0x80')]();_0x245530[_0x2450('0x1b')](_0x15198a);_0x245530[_0x2450('0x1a')](0x0);logger[_0x2450('0x81')](_0x2450('0x82'),_0x245530[_0x2450('0x83')]());return db['sequelize'][_0x2450('0x30')](_0x245530['toString'](),{'type':db[_0x2450('0x84')][_0x2450('0x85')]['SELECT']});}})[_0x2450('0x20')](respondWithResult(_0x16e65c,null))[_0x2450('0x44')](handleError(_0x16e65c,null));};function runReport(_0x2e8abd,_0x1f5be2,_0x4b7b10){var _0x474e24=_0x1f5be2['name'];var _0x450837=0xa;var _0x547dbc=[_0x2450('0x52'),_0x2450('0x53'),'right_join',_0x2450('0x86')];var _0x547033={'SUM':_0x2450('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2450('0x56'),'MAX':_0x2450('0x87'),'MIN':'MIN(%s)','AVG':_0x2450('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2450('0x59'),'GROUP_CONCAT DESC':_0x2450('0x88')};var _0x2cd421={'SEC_TO_TIME':_0x2450('0x89'),'DATE':_0x2450('0x5a'),'HOUR':_0x2450('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31aa83=function(_0x29f5c7){return!_['includes']([_0x2450('0x5f'),_0x2450('0x8a'),'IS\x20EMPTY',_0x2450('0x61')],_0x29f5c7);};var _0x518963=function(_0x4162cd){if(!_0x4162cd||!_0x4162cd[_0x2450('0x62')][_0x2450('0x36')]){return'';}for(var _0x3fd846='(',_0x6c4c59=0x0;_0x6c4c59<_0x4162cd[_0x2450('0x62')][_0x2450('0x36')];_0x6c4c59+=0x1){_0x6c4c59>0x0&&(_0x3fd846+='\x20'+_0x4162cd[_0x2450('0x8b')]+'\x20');_0x3fd846+=_0x4162cd[_0x2450('0x62')][_0x6c4c59][_0x2450('0x63')]?_0x518963(_0x4162cd[_0x2450('0x62')][_0x6c4c59]['group']):_0x4162cd[_0x2450('0x62')][_0x6c4c59]['field']+'\x20'+_0x4162cd[_0x2450('0x62')][_0x6c4c59][_0x2450('0x64')]+(_0x31aa83(_0x4162cd[_0x2450('0x62')][_0x6c4c59][_0x2450('0x64')])?'\x20'+_0x4162cd['rules'][_0x6c4c59][_0x2450('0x65')]:'');}return _0x3fd846+')';};var _0x28190c={'where':{'id':_0x2e8abd['id']}},_0x25025a,_0x264328,_0x23e677,_0x545898,_0xe91b81;_0x28190c=_[_0x2450('0x3d')]({},_0x28190c,_0x4b7b10);return db[_0x2450('0x2a')][_0x2450('0x47')](_0x28190c)[_0x2450('0x20')](function(_0x87d4df){if(_0x87d4df){_0x25025a=_0x87d4df;return _0x87d4df['getFields']();}return null;})[_0x2450('0x20')](function(_0x54bd70){if(_0x54bd70){if(!_0x54bd70[_0x2450('0x36')]){throw new db['Sequelize'][(_0x2450('0x68'))](_0x2450('0x69'),0x193);}_0x264328=_0x54bd70;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x2450('0x20')](function(_0x14bd00){if(_0x14bd00){_0x23e677=_[_0x2450('0x6b')](_0x14bd00,'id');var _0x447000;var _0x28c54e=squel['select']();_0x28c54e[_0x2450('0x6d')](_0x25025a['table']);for(var _0x551fdc=0x0;_0x551fdc<_0x264328['length'];_0x551fdc+=0x1){_0x447000=_0x264328[_0x551fdc][_0x2450('0x6f')]?_0x23e677[_0x264328[_0x551fdc]['MetricId']][_0x2450('0x70')]:_0x264328[_0x551fdc][_0x2450('0x71')];_0x447000=_0x264328[_0x551fdc][_0x2450('0x72')]?_[_0x2450('0x73')](_0x547033[_0x264328[_0x551fdc][_0x2450('0x72')]],'%s',_0x447000):_0x447000;_0x447000=_0x264328[_0x551fdc]['format']?_['replace'](_0x2cd421[_0x264328[_0x551fdc][_0x2450('0x74')]],'%s',_0x447000):_0x447000;if(_0x264328[_0x551fdc][_0x2450('0x75')]){_0x28c54e[_0x2450('0x63')](_0x447000);}_0x264328[_0x551fdc][_0x2450('0x76')]&&_0x28c54e[_0x2450('0x38')](_0x447000,_0x264328[_0x551fdc][_0x2450('0x76')]===_0x2450('0x77')?![]:!![]);_0x28c54e['field'](_0x447000,_0x264328[_0x551fdc][_0x2450('0x78')]||_0x447000);}if(_0x25025a[_0x2450('0x79')]){_0x25025a[_0x2450('0x79')]=JSON[_0x2450('0x7a')](_0x25025a[_0x2450('0x79')]);for(var _0x5c7aa4=0x0;_0x5c7aa4<_0x25025a['joins'][_0x2450('0x36')];_0x5c7aa4+=0x1){if(_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x2d')]&&_[_0x2450('0x5e')](_0x547dbc,_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x2d')])&&_0x25025a[_0x2450('0x79')][_0x5c7aa4]['parentKey']&&_0x25025a[_0x2450('0x79')][_0x5c7aa4]['foreignTable']&&_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x7e')]){_0x28c54e[_0x25025a[_0x2450('0x79')][_0x5c7aa4]['type']](_0x25025a['joins'][_0x5c7aa4][_0x2450('0x7c')],null,util[_0x2450('0x74')](_0x2450('0x7d'),_0x25025a['table'],_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x7b')],_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x7c')],_0x25025a[_0x2450('0x79')][_0x5c7aa4]['foreignKey']));}}}if(_0x25025a[_0x2450('0x7f')]){_0x25025a['conditions']=JSON['parse'](_0x25025a['conditions']);_0x28c54e['where'](_0x518963(_0x25025a['conditions'][_0x2450('0x63')]));}_0xe91b81=_0x28c54e[_0x2450('0x80')]();_0x28c54e['limit'](_0x450837);_0x28c54e['offset'](0x0);logger[_0x2450('0x81')](_0x2450('0x82'),_0x28c54e['toString']());return db[_0x2450('0x84')][_0x2450('0x30')](_0x28c54e['toString'](),{'type':db[_0x2450('0x84')]['QueryTypes'][_0x2450('0x8c')]});}})[_0x2450('0x20')](function(_0x279f77){if(!_0x279f77['length']){throw new db[(_0x2450('0x67'))][(_0x2450('0x68'))](_0x2450('0x8d'),0xcc);}if(_0x1f5be2['output']===_0x2450('0x8e')){return null;}var _0x79081e=_['merge'](_0x1f5be2,{'name':_0x1f5be2['fullPath']||_0x1f5be2[_0x2450('0x26')]||_0x25025a['name'],'basename':_0x474e24,'savename':util[_0x2450('0x74')](_0x2450('0x8f'),_0x1f5be2['name']||_0x25025a[_0x2450('0x26')],require(_0x2450('0x90'))[_0x2450('0x91')](0x4),_0x1f5be2[_0x2450('0x92')]||_0x2450('0x93')),'reportId':_0x25025a['id'],'reportType':'default'});return db[_0x2450('0x94')]['create'](_0x79081e,{'raw':!![]});})[_0x2450('0x20')](function(_0x33a419){if(_0x25025a['table']==='cdr'){_0xe91b81[_0x2450('0x3a')](_0x25025a[_0x2450('0x6e')]+_0x2450('0x95'),_0x1f5be2[_0x2450('0x96')],_0x1f5be2[_0x2450('0x97')]);}else{_0xe91b81[_0x2450('0x3a')](_0x25025a[_0x2450('0x6e')]+_0x2450('0x98'),_0x1f5be2[_0x2450('0x96')],_0x1f5be2[_0x2450('0x97')]);}if(_0x33a419){logger[_0x2450('0x99')](_0x2450('0x9a'),_0xe91b81[_0x2450('0x83')]());require(_0x2450('0x9b'))['fork'](path['join'](__dirname,_0x2450('0x9c'),_0x33a419[_0x2450('0x92')]),[_0x33a419['id'],_0xe91b81[_0x2450('0x83')](),path[_0x2450('0x52')](__dirname,'../../files/reports',_0x33a419[_0x2450('0x9d')]),_0x474e24]);return _0x33a419;}else{var _0x290f81=squel['select']();_0x290f81[_0x2450('0x6d')]('('+_0xe91b81[_0x2450('0x83')]()+')','countTable');_0x290f81[_0x2450('0x71')](_0x2450('0x9e'),_0x2450('0x9f'));_0xe91b81[_0x2450('0x1b')](_0x1f5be2['limit']||_0x450837);_0xe91b81['offset'](_0x1f5be2[_0x2450('0x1a')]||0x0);return dbH[_0x2450('0x84')][_0x2450('0x30')](_0x290f81[_0x2450('0x83')](),{'type':dbH['sequelize'][_0x2450('0x85')][_0x2450('0x8c')]})[_0x2450('0x20')](function(_0x2c029){if(!_0x2c029[_0x2450('0x36')]){_0x545898=0x0;}else{_0x545898=_0x2c029[0x0]['count']||0x0;}return dbH[_0x2450('0x84')]['query'](_0xe91b81[_0x2450('0x83')](),{'type':dbH['sequelize']['QueryTypes'][_0x2450('0x8c')]});})[_0x2450('0x20')](function(_0x18ce50){return{'rows':_0x18ce50||[],'count':_0x545898};});}});}exports[_0x2450('0xa0')]=function(_0x29f062,_0x44fe15){return runReport(_0x29f062[_0x2450('0x46')],_0x29f062[_0x2450('0x30')],_0x29f062[_0x2450('0x3f')])['then'](respondWithResult(_0x44fe15,null))[_0x2450('0x44')](handleError(_0x44fe15,null));};exports['runReport']=runReport;exports['query']=function(_0x382ea8,_0x5af79b){var _0x983a0e=0xa;var _0x1d3ec5=[_0x2450('0x52'),_0x2450('0x53'),_0x2450('0xa1'),_0x2450('0x86')];var _0x129878={'SUM':'SUM(%s)','COUNT':_0x2450('0x55'),'COUNT DISTINCT':_0x2450('0x56'),'MAX':_0x2450('0x87'),'MIN':_0x2450('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2450('0xa2'),'GROUP_CONCAT ASC':_0x2450('0x59'),'GROUP_CONCAT DESC':_0x2450('0x88')};var _0x411061={'SEC_TO_TIME':_0x2450('0x89'),'DATE':_0x2450('0x5a'),'HOUR':_0x2450('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1f1939=function(_0x4c3984){return!_[_0x2450('0x5e')]([_0x2450('0x5f'),_0x2450('0x8a'),'IS\x20EMPTY',_0x2450('0x61')],_0x4c3984);};var _0x52b40f=function(_0x225d1a){if(!_0x225d1a||!_0x225d1a[_0x2450('0x62')][_0x2450('0x36')]){return'';}for(var _0x5bc37b='(',_0x32e642=0x0;_0x32e642<_0x225d1a['rules'][_0x2450('0x36')];_0x32e642+=0x1){_0x32e642>0x0&&(_0x5bc37b+='\x20'+_0x225d1a['operator']+'\x20');_0x5bc37b+=_0x225d1a[_0x2450('0x62')][_0x32e642]['group']?_0x52b40f(_0x225d1a['rules'][_0x32e642][_0x2450('0x63')]):_0x225d1a[_0x2450('0x62')][_0x32e642][_0x2450('0x71')]+'\x20'+_0x225d1a[_0x2450('0x62')][_0x32e642][_0x2450('0x64')]+(_0x1f1939(_0x225d1a[_0x2450('0x62')][_0x32e642][_0x2450('0x64')])?'\x20'+_0x225d1a['rules'][_0x32e642][_0x2450('0x65')]:'');}return _0x5bc37b+')';};var _0x346abf={'where':{'id':_0x382ea8['params']['id']}},_0x2f61ee,_0x5b0892,_0x2eb5a6,_0x22102d,_0x40e6b2;_0x346abf=_[_0x2450('0x3d')]({},_0x346abf,_0x382ea8[_0x2450('0x3f')]);return db[_0x2450('0x2a')]['find'](_0x346abf)[_0x2450('0x20')](function(_0x26fc1d){if(_0x26fc1d){_0x2f61ee=_0x26fc1d;return _0x26fc1d[_0x2450('0x66')]();}return null;})[_0x2450('0x20')](function(_0x4f438d){if(_0x4f438d){if(!_0x4f438d['length']){throw new db[(_0x2450('0x67'))][(_0x2450('0x68'))](_0x2450('0x69'),0x193);}_0x5b0892=_0x4f438d;return db[_0x2450('0x6a')][_0x2450('0x42')]({'raw':!![]});}return null;})[_0x2450('0x20')](function(_0x2e64b){if(_0x2e64b){_0x2eb5a6=_['keyBy'](_0x2e64b,'id');var _0x4a28f5;var _0x318639=squel[_0x2450('0x6c')]();_0x318639[_0x2450('0x6d')](_0x2f61ee[_0x2450('0x6e')]);for(var _0x21d388=0x0;_0x21d388<_0x5b0892[_0x2450('0x36')];_0x21d388+=0x1){_0x4a28f5=_0x5b0892[_0x21d388]['MetricId']?_0x2eb5a6[_0x5b0892[_0x21d388][_0x2450('0x6f')]][_0x2450('0x70')]:_0x5b0892[_0x21d388][_0x2450('0x71')];_0x4a28f5=_0x5b0892[_0x21d388][_0x2450('0x72')]?_[_0x2450('0x73')](_0x129878[_0x5b0892[_0x21d388][_0x2450('0x72')]],'%s',_0x4a28f5):_0x4a28f5;_0x4a28f5=_0x5b0892[_0x21d388]['format']?_[_0x2450('0x73')](_0x411061[_0x5b0892[_0x21d388][_0x2450('0x74')]],'%s',_0x4a28f5):_0x4a28f5;if(_0x5b0892[_0x21d388][_0x2450('0x75')]){_0x318639['group'](_0x4a28f5);}_0x5b0892[_0x21d388][_0x2450('0x76')]&&_0x318639['order'](_0x4a28f5,_0x5b0892[_0x21d388][_0x2450('0x76')]===_0x2450('0x77')?![]:!![]);_0x318639[_0x2450('0x71')](_0x4a28f5,_0x5b0892[_0x21d388][_0x2450('0x78')]||_0x4a28f5);}if(_0x2f61ee[_0x2450('0x79')]){_0x2f61ee['joins']=JSON['parse'](_0x2f61ee[_0x2450('0x79')]);for(var _0x1ba8ae=0x0;_0x1ba8ae<_0x2f61ee[_0x2450('0x79')][_0x2450('0x36')];_0x1ba8ae+=0x1){if(_0x2f61ee['joins'][_0x1ba8ae][_0x2450('0x2d')]&&_[_0x2450('0x5e')](_0x1d3ec5,_0x2f61ee[_0x2450('0x79')][_0x1ba8ae]['type'])&&_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7b')]&&_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7c')]&&_0x2f61ee[_0x2450('0x79')][_0x1ba8ae]['foreignKey']){_0x318639[_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x2d')]](_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7c')],null,util[_0x2450('0x74')](_0x2450('0x7d'),_0x2f61ee[_0x2450('0x6e')],_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7b')],_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7c')],_0x2f61ee[_0x2450('0x79')][_0x1ba8ae]['foreignKey']));}}}if(_0x2f61ee[_0x2450('0x7f')]){_0x2f61ee[_0x2450('0x7f')]=JSON[_0x2450('0x7a')](_0x2f61ee[_0x2450('0x7f')]);_0x318639[_0x2450('0x3a')](_0x52b40f(_0x2f61ee[_0x2450('0x7f')][_0x2450('0x63')]));}_0x40e6b2=_0x318639[_0x2450('0x80')]();_0x318639[_0x2450('0x1b')](_0x983a0e);_0x318639['offset'](0x0);logger[_0x2450('0x81')](_0x2450('0x82'),_0x318639[_0x2450('0x83')]());return db[_0x2450('0x84')][_0x2450('0x30')](_0x318639[_0x2450('0x83')](),{'type':db[_0x2450('0x84')]['QueryTypes'][_0x2450('0x8c')]});}})[_0x2450('0x20')](function(){return{'sql':_0x40e6b2[_0x2450('0x83')]()};})[_0x2450('0x20')](respondWithResult(_0x5af79b,null))[_0x2450('0x44')](handleError(_0x5af79b,null));}; \ No newline at end of file +var _0xe437=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','SUM(%s)','AVG(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','AnalyticMetric','from','format','foreignTable','No\x20available\x20data','output','web','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','ROUND(%s)','keyBy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','DefaultReports','sendStatus','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0xce58df,_0x4b6850){var _0x57b86a=function(_0x4599cd){while(--_0x4599cd){_0xce58df['push'](_0xce58df['shift']());}};_0x57b86a(++_0x4b6850);}(_0xe437,0x69));var _0x7e43=function(_0x15ee3b,_0x5e1a1f){_0x15ee3b=_0x15ee3b-0x0;var _0x10b5c2=_0xe437[_0x15ee3b];return _0x10b5c2;};'use strict';var pdf=require(_0x7e43('0x0'));var emlformat=require(_0x7e43('0x1'));var rimraf=require(_0x7e43('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e43('0x3'));var rp=require(_0x7e43('0x4'));var moment=require(_0x7e43('0x5'));var BPromise=require(_0x7e43('0x6'));var Mustache=require(_0x7e43('0x7'));var util=require(_0x7e43('0x8'));var path=require(_0x7e43('0x9'));var sox=require(_0x7e43('0xa'));var csv=require('to-csv');var ejs=require(_0x7e43('0xb'));var fs=require('fs');var _=require(_0x7e43('0xc'));var squel=require(_0x7e43('0xd'));var crypto=require(_0x7e43('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7e43('0xf'));var toCsv=require(_0x7e43('0x10'));var querystring=require(_0x7e43('0x11'));var Papa=require(_0x7e43('0x12'));var Redis=require(_0x7e43('0x13'));var authService=require(_0x7e43('0x14'));var qs=require(_0x7e43('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e43('0x16'));var logger=require(_0x7e43('0x17'))(_0x7e43('0x18'));var utils=require(_0x7e43('0x19'));var config=require(_0x7e43('0x1a'));var licenseUtil=require(_0x7e43('0x1b'));var db=require(_0x7e43('0x1c'))['db'];var dbH=require(_0x7e43('0x1c'))['dbH'];function respondWithStatusCode(_0x107643,_0x5a6670){_0x5a6670=_0x5a6670||0xcc;return function(_0x53b301){if(_0x53b301){return _0x107643['sendStatus'](_0x5a6670);}return _0x107643['status'](_0x5a6670)[_0x7e43('0x1d')]();};}function respondWithResult(_0x57f727,_0x538b66){_0x538b66=_0x538b66||0xc8;return function(_0x6bad1b){if(_0x6bad1b){return _0x57f727[_0x7e43('0x1e')](_0x538b66)[_0x7e43('0x1f')](_0x6bad1b);}};}function respondWithFilteredResult(_0x3b0809,_0x543c24){return function(_0xd4fa2){if(_0xd4fa2){var _0x1f14f7=_0xd4fa2[_0x7e43('0x20')],_0x2a66ee=_0x543c24[_0x7e43('0x21')],_0x1362bf=_0x543c24['offset']+_0x543c24[_0x7e43('0x22')],_0x1d8277;if(_0x1362bf>=_0x1f14f7){_0x1362bf=_0x1f14f7;_0x1d8277=0xc8;}else{_0x1d8277=0xce;}_0x3b0809[_0x7e43('0x1e')](_0x1d8277);return _0x3b0809[_0x7e43('0x23')](_0x7e43('0x24'),_0x2a66ee+'-'+_0x1362bf+'/'+_0x1f14f7)[_0x7e43('0x1f')](_0xd4fa2);}return null;};}function patchUpdates(_0x2b9bc8){return function(_0x3ad016){try{jsonpatch[_0x7e43('0x25')](_0x3ad016,_0x2b9bc8,!![]);}catch(_0x4075c3){return BPromise['reject'](_0x4075c3);}return _0x3ad016[_0x7e43('0x26')]();};}function saveUpdates(_0x5b24f6,_0x912aa8){return function(_0x11c00f){if(_0x11c00f){return _0x11c00f['update'](_0x5b24f6)[_0x7e43('0x27')](function(_0xf1eb33){return _0xf1eb33;});}return null;};}function removeEntity(_0x424126,_0x4d9701){return function(_0xa1b15f){if(_0xa1b15f){return _0xa1b15f[_0x7e43('0x28')]()[_0x7e43('0x27')](function(){var _0x295b46=_0xa1b15f['get']({'plain':!![]});var _0x1c41d4=_0x7e43('0x29');return db['UserProfileResource'][_0x7e43('0x28')]({'where':{'type':_0x1c41d4,'resourceId':_0x295b46['id']}})[_0x7e43('0x27')](function(){return _0xa1b15f;});})[_0x7e43('0x27')](function(){_0x424126[_0x7e43('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a9c5,_0x5b1f73){return function(_0xbdea56){if(!_0xbdea56){_0x30a9c5[_0x7e43('0x2a')](0x194);}return _0xbdea56;};}function handleError(_0x55100c,_0x3ae37c){_0x3ae37c=_0x3ae37c||0x1f4;return function(_0x51725c){logger[_0x7e43('0x2b')](_0x51725c[_0x7e43('0x2c')]);if(_0x51725c[_0x7e43('0x2d')]){delete _0x51725c[_0x7e43('0x2d')];}_0x55100c['status'](_0x3ae37c)['send'](_0x51725c);};}exports[_0x7e43('0x2e')]=function(_0x106c52,_0x243ac4){var _0x8e2aad={},_0x136956={},_0x5dffc8={'count':0x0,'rows':[]};var _0x4e570d=_['map'](db[_0x7e43('0x2f')][_0x7e43('0x30')],function(_0x2ba47d){return{'name':_0x2ba47d['fieldName'],'type':_0x2ba47d[_0x7e43('0x31')][_0x7e43('0x32')]};});_0x136956[_0x7e43('0x33')]=_[_0x7e43('0x34')](_0x4e570d,_0x7e43('0x2d'));_0x136956[_0x7e43('0x35')]=_[_0x7e43('0x36')](_0x106c52[_0x7e43('0x35')]);_0x136956[_0x7e43('0x37')]=_[_0x7e43('0x38')](_0x136956[_0x7e43('0x33')],_0x136956[_0x7e43('0x35')]);_0x8e2aad[_0x7e43('0x39')]=_[_0x7e43('0x38')](_0x136956[_0x7e43('0x33')],qs[_0x7e43('0x3a')](_0x106c52[_0x7e43('0x35')]['fields']));_0x8e2aad[_0x7e43('0x39')]=_0x8e2aad['attributes']['length']?_0x8e2aad[_0x7e43('0x39')]:_0x136956[_0x7e43('0x33')];if(!_0x106c52[_0x7e43('0x35')][_0x7e43('0x3b')](_0x7e43('0x3c'))){_0x8e2aad[_0x7e43('0x22')]=qs[_0x7e43('0x22')](_0x106c52[_0x7e43('0x35')][_0x7e43('0x22')]);_0x8e2aad['offset']=qs[_0x7e43('0x21')](_0x106c52[_0x7e43('0x35')]['offset']);}_0x8e2aad[_0x7e43('0x3d')]=qs[_0x7e43('0x3e')](_0x106c52[_0x7e43('0x35')]['sort']);_0x8e2aad[_0x7e43('0x3f')]=qs['filters'](_[_0x7e43('0x40')](_0x106c52[_0x7e43('0x35')],_0x136956['filters']),_0x4e570d);if(_0x106c52['query'][_0x7e43('0x41')]){_0x8e2aad[_0x7e43('0x3f')]=_[_0x7e43('0x42')](_0x8e2aad[_0x7e43('0x3f')],{'$or':_[_0x7e43('0x34')](_0x4e570d,function(_0x2ee997){if(_0x2ee997[_0x7e43('0x31')]!==_0x7e43('0x43')){var _0x1885c3={};_0x1885c3[_0x2ee997[_0x7e43('0x2d')]]={'$like':'%'+_0x106c52[_0x7e43('0x35')][_0x7e43('0x41')]+'%'};return _0x1885c3;}})});}_0x8e2aad=_[_0x7e43('0x42')]({},_0x8e2aad,_0x106c52[_0x7e43('0x44')]);var _0x4c9065={'where':_0x8e2aad[_0x7e43('0x3f')]};return db['AnalyticDefaultReport'][_0x7e43('0x20')](_0x4c9065)['then'](function(_0x27775d){_0x5dffc8[_0x7e43('0x20')]=_0x27775d;if(_0x106c52[_0x7e43('0x35')][_0x7e43('0x45')]){_0x8e2aad[_0x7e43('0x46')]=[{'all':!![]}];}return db[_0x7e43('0x2f')][_0x7e43('0x47')](_0x8e2aad);})[_0x7e43('0x27')](function(_0xdd4699){_0x5dffc8['rows']=_0xdd4699;return _0x5dffc8;})[_0x7e43('0x27')](respondWithFilteredResult(_0x243ac4,_0x8e2aad))[_0x7e43('0x48')](handleError(_0x243ac4,null));};exports[_0x7e43('0x49')]=function(_0x32be32,_0x2f9764){var _0x16ff8f={'raw':!![],'where':{'id':_0x32be32['params']['id']}},_0x2551df={};_0x2551df[_0x7e43('0x33')]=_[_0x7e43('0x36')](db['AnalyticDefaultReport'][_0x7e43('0x30')]);_0x2551df[_0x7e43('0x35')]=_[_0x7e43('0x36')](_0x32be32[_0x7e43('0x35')]);_0x2551df[_0x7e43('0x37')]=_[_0x7e43('0x38')](_0x2551df['model'],_0x2551df[_0x7e43('0x35')]);_0x16ff8f[_0x7e43('0x39')]=_[_0x7e43('0x38')](_0x2551df[_0x7e43('0x33')],qs[_0x7e43('0x3a')](_0x32be32[_0x7e43('0x35')][_0x7e43('0x3a')]));_0x16ff8f[_0x7e43('0x39')]=_0x16ff8f[_0x7e43('0x39')][_0x7e43('0x4a')]?_0x16ff8f[_0x7e43('0x39')]:_0x2551df['model'];if(_0x32be32[_0x7e43('0x35')][_0x7e43('0x45')]){_0x16ff8f['include']=[{'all':!![]}];}_0x16ff8f=_[_0x7e43('0x42')]({},_0x16ff8f,_0x32be32[_0x7e43('0x44')]);return db[_0x7e43('0x2f')][_0x7e43('0x4b')](_0x16ff8f)[_0x7e43('0x27')](handleEntityNotFound(_0x2f9764,null))[_0x7e43('0x27')](respondWithResult(_0x2f9764,null))[_0x7e43('0x48')](handleError(_0x2f9764,null));};exports['create']=function(_0x2a0362,_0x11ab4a){return db[_0x7e43('0x2f')]['create'](_0x2a0362[_0x7e43('0x4c')],{})[_0x7e43('0x27')](function(_0x69e96){var _0x30e40f=_0x2a0362[_0x7e43('0x4d')][_0x7e43('0x4e')]({'plain':!![]});if(!_0x30e40f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30e40f[_0x7e43('0x4f')]===_0x7e43('0x4d')){var _0x5e4b90=_0x69e96[_0x7e43('0x4e')]({'plain':!![]});var _0x44b31b='Reports';return db[_0x7e43('0x50')][_0x7e43('0x4b')]({'where':{'name':_0x44b31b,'userProfileId':_0x30e40f[_0x7e43('0x51')]},'raw':!![]})[_0x7e43('0x27')](function(_0x223109){if(_0x223109&&_0x223109[_0x7e43('0x52')]===0x0){return db[_0x7e43('0x53')][_0x7e43('0x54')]({'name':_0x5e4b90[_0x7e43('0x2d')],'resourceId':_0x5e4b90['id'],'type':_0x7e43('0x29'),'sectionId':_0x223109['id']},{})[_0x7e43('0x27')](function(){return _0x69e96;});}else{return _0x69e96;}})[_0x7e43('0x48')](function(_0x238a96){logger[_0x7e43('0x2b')](_0x7e43('0x55'),_0x238a96);throw _0x238a96;});}return _0x69e96;})[_0x7e43('0x27')](respondWithResult(_0x11ab4a,0xc9))['catch'](handleError(_0x11ab4a,null));};exports[_0x7e43('0x56')]=function(_0xa8923d,_0x4ed1b1){if(_0xa8923d[_0x7e43('0x4c')]['id']){delete _0xa8923d[_0x7e43('0x4c')]['id'];}return db[_0x7e43('0x2f')][_0x7e43('0x4b')]({'where':{'id':_0xa8923d[_0x7e43('0x57')]['id']}})[_0x7e43('0x27')](handleEntityNotFound(_0x4ed1b1,null))[_0x7e43('0x27')](saveUpdates(_0xa8923d[_0x7e43('0x4c')],null))[_0x7e43('0x27')](respondWithResult(_0x4ed1b1,null))[_0x7e43('0x48')](handleError(_0x4ed1b1,null));};exports[_0x7e43('0x28')]=function(_0x234f19,_0x5012b0){return db[_0x7e43('0x2f')][_0x7e43('0x4b')]({'where':{'id':_0x234f19[_0x7e43('0x57')]['id']}})[_0x7e43('0x27')](handleEntityNotFound(_0x5012b0,null))[_0x7e43('0x27')](removeEntity(_0x5012b0,null))[_0x7e43('0x48')](handleError(_0x5012b0,null));};exports[_0x7e43('0x58')]=function(_0x538edc,_0x198815){var _0x59d77c=0xa;var _0x7c1bd=['join','left_join',_0x7e43('0x59'),_0x7e43('0x5a')];var _0x2a2744={'SUM':'SUM(%s)','COUNT':_0x7e43('0x5b'),'COUNT DISTINCT':_0x7e43('0x5c'),'MAX':_0x7e43('0x5d'),'MIN':_0x7e43('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7e43('0x5f'),'GROUP_CONCAT ASC':_0x7e43('0x60'),'GROUP_CONCAT DESC':_0x7e43('0x61')};var _0x905a48={'SEC_TO_TIME':_0x7e43('0x62'),'DATE':_0x7e43('0x63'),'HOUR':_0x7e43('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7e43('0x65')};var _0x4950c3=function(_0x5d6bcc){return!_[_0x7e43('0x66')]([_0x7e43('0x67'),_0x7e43('0x68'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5d6bcc);};var _0x1764b0=function(_0x3c5c3d){if(!_0x3c5c3d||!_0x3c5c3d[_0x7e43('0x69')][_0x7e43('0x4a')]){return'';}for(var _0x2578fe='(',_0x5e8db8=0x0;_0x5e8db8<_0x3c5c3d['rules'][_0x7e43('0x4a')];_0x5e8db8+=0x1){_0x5e8db8>0x0&&(_0x2578fe+='\x20'+_0x3c5c3d[_0x7e43('0x6a')]+'\x20');_0x2578fe+=_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6b')]?_0x1764b0(_0x3c5c3d['rules'][_0x5e8db8][_0x7e43('0x6b')]):_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6c')]+'\x20'+_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6d')]+(_0x4950c3(_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6d')])?'\x20'+_0x3c5c3d[_0x7e43('0x69')][_0x5e8db8][_0x7e43('0x6e')]:'');}return _0x2578fe+')';};var _0x2fa0c5={'where':{'id':_0x538edc[_0x7e43('0x57')]['id']}},_0x267f84,_0xdc06c,_0x1395ba,_0x79c520,_0x372ee4;_0x2fa0c5=_[_0x7e43('0x42')]({},_0x2fa0c5,_0x538edc['options']);return db[_0x7e43('0x2f')]['find'](_0x2fa0c5)['then'](function(_0x72ea82){if(_0x72ea82){_0x267f84=_0x72ea82;return _0x72ea82[_0x7e43('0x6f')]();}return null;})[_0x7e43('0x27')](function(_0x4473c7){if(_0x4473c7){if(!_0x4473c7[_0x7e43('0x4a')]){throw new db[(_0x7e43('0x70'))][(_0x7e43('0x71'))](_0x7e43('0x72'),0x193);}_0xdc06c=_0x4473c7;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x7e43('0x27')](function(_0x460186){if(_0x460186){_0x1395ba=_['keyBy'](_0x460186,'id');var _0x254adb;var _0x2e63f3=squel[_0x7e43('0x73')]();_0x2e63f3['from'](_0x267f84[_0x7e43('0x74')]);for(var _0x45e058=0x0;_0x45e058<_0xdc06c['length'];_0x45e058+=0x1){_0x254adb=_0xdc06c[_0x45e058]['MetricId']?_0x1395ba[_0xdc06c[_0x45e058][_0x7e43('0x75')]][_0x7e43('0x76')]:_0xdc06c[_0x45e058][_0x7e43('0x6c')];_0x254adb=_0xdc06c[_0x45e058]['function']?_['replace'](_0x2a2744[_0xdc06c[_0x45e058][_0x7e43('0x77')]],'%s',_0x254adb):_0x254adb;_0x254adb=_0xdc06c[_0x45e058]['format']?_[_0x7e43('0x78')](_0x905a48[_0xdc06c[_0x45e058]['format']],'%s',_0x254adb):_0x254adb;if(_0xdc06c[_0x45e058][_0x7e43('0x79')]){_0x2e63f3[_0x7e43('0x6b')](_0x254adb);}_0xdc06c[_0x45e058][_0x7e43('0x7a')]&&_0x2e63f3[_0x7e43('0x3d')](_0x254adb,_0xdc06c[_0x45e058][_0x7e43('0x7a')]===_0x7e43('0x7b')?![]:!![]);_0x2e63f3[_0x7e43('0x6c')](_0x254adb,_0xdc06c[_0x45e058][_0x7e43('0x7c')]||_0x254adb);}if(_0x267f84[_0x7e43('0x7d')]){_0x267f84[_0x7e43('0x7d')]=JSON[_0x7e43('0x7e')](_0x267f84[_0x7e43('0x7d')]);for(var _0x373b3a=0x0;_0x373b3a<_0x267f84[_0x7e43('0x7d')][_0x7e43('0x4a')];_0x373b3a+=0x1){if(_0x267f84['joins'][_0x373b3a][_0x7e43('0x31')]&&_[_0x7e43('0x66')](_0x7c1bd,_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x31')])&&_0x267f84['joins'][_0x373b3a][_0x7e43('0x7f')]&&_0x267f84[_0x7e43('0x7d')][_0x373b3a]['foreignTable']&&_0x267f84['joins'][_0x373b3a][_0x7e43('0x80')]){_0x2e63f3[_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x31')]](_0x267f84['joins'][_0x373b3a]['foreignTable'],null,util['format'](_0x7e43('0x81'),_0x267f84[_0x7e43('0x74')],_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x7f')],_0x267f84[_0x7e43('0x7d')][_0x373b3a]['foreignTable'],_0x267f84[_0x7e43('0x7d')][_0x373b3a][_0x7e43('0x80')]));}}}if(_0x267f84[_0x7e43('0x82')]){_0x267f84[_0x7e43('0x82')]=JSON[_0x7e43('0x7e')](_0x267f84['conditions']);_0x2e63f3[_0x7e43('0x3f')](_0x1764b0(_0x267f84[_0x7e43('0x82')][_0x7e43('0x6b')]));}_0x372ee4=_0x2e63f3[_0x7e43('0x83')]();_0x2e63f3['limit'](_0x59d77c);_0x2e63f3[_0x7e43('0x21')](0x0);logger[_0x7e43('0x84')](_0x7e43('0x85'),_0x2e63f3['toString']());return db['sequelize'][_0x7e43('0x35')](_0x2e63f3[_0x7e43('0x86')](),{'type':db[_0x7e43('0x87')][_0x7e43('0x88')][_0x7e43('0x89')]});}})[_0x7e43('0x27')](respondWithResult(_0x198815,null))[_0x7e43('0x48')](handleError(_0x198815,null));};function runReport(_0x55611a,_0xe80549,_0x1f02bc){var _0x490c50=_0xe80549[_0x7e43('0x2d')];var _0x58bd6c=0xa;var _0x1f9073=[_0x7e43('0x8a'),_0x7e43('0x8b'),_0x7e43('0x59'),_0x7e43('0x5a')];var _0x184180={'SUM':_0x7e43('0x8c'),'COUNT':_0x7e43('0x5b'),'COUNT DISTINCT':_0x7e43('0x5c'),'MAX':_0x7e43('0x5d'),'MIN':_0x7e43('0x5e'),'AVG':_0x7e43('0x8d'),'GROUP_CONCAT':_0x7e43('0x5f'),'GROUP_CONCAT ASC':_0x7e43('0x60'),'GROUP_CONCAT DESC':_0x7e43('0x61')};var _0x2c8ec5={'SEC_TO_TIME':_0x7e43('0x62'),'DATE':_0x7e43('0x63'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7e43('0x65')};var _0x16655f=function(_0x1c92ce){return!_['includes']([_0x7e43('0x67'),_0x7e43('0x68'),_0x7e43('0x8e'),_0x7e43('0x8f')],_0x1c92ce);};var _0x44e74d=function(_0x158444){if(!_0x158444||!_0x158444[_0x7e43('0x69')][_0x7e43('0x4a')]){return'';}for(var _0x40403d='(',_0x558b4f=0x0;_0x558b4f<_0x158444['rules']['length'];_0x558b4f+=0x1){_0x558b4f>0x0&&(_0x40403d+='\x20'+_0x158444[_0x7e43('0x6a')]+'\x20');_0x40403d+=_0x158444[_0x7e43('0x69')][_0x558b4f][_0x7e43('0x6b')]?_0x44e74d(_0x158444[_0x7e43('0x69')][_0x558b4f][_0x7e43('0x6b')]):_0x158444[_0x7e43('0x69')][_0x558b4f][_0x7e43('0x6c')]+'\x20'+_0x158444[_0x7e43('0x69')][_0x558b4f]['condition']+(_0x16655f(_0x158444['rules'][_0x558b4f][_0x7e43('0x6d')])?'\x20'+_0x158444['rules'][_0x558b4f]['value']:'');}return _0x40403d+')';};var _0x3c5c95={'where':{'id':_0x55611a['id']}},_0x4fef29,_0x2fc36d,_0x4c2b66,_0x35b603,_0x4ec1f4;_0x3c5c95=_[_0x7e43('0x42')]({},_0x3c5c95,_0x1f02bc);return db['AnalyticDefaultReport']['find'](_0x3c5c95)[_0x7e43('0x27')](function(_0x4589c1){if(_0x4589c1){_0x4fef29=_0x4589c1;return _0x4589c1['getFields']();}return null;})[_0x7e43('0x27')](function(_0x3497f6){if(_0x3497f6){if(!_0x3497f6[_0x7e43('0x4a')]){throw new db[(_0x7e43('0x70'))]['ValidationErrorItem'](_0x7e43('0x72'),0x193);}_0x2fc36d=_0x3497f6;return db[_0x7e43('0x90')]['findAll']({'raw':!![]});}return null;})[_0x7e43('0x27')](function(_0x5dbe90){if(_0x5dbe90){_0x4c2b66=_['keyBy'](_0x5dbe90,'id');var _0x4a5a7d;var _0xed4b31=squel['select']();_0xed4b31[_0x7e43('0x91')](_0x4fef29[_0x7e43('0x74')]);for(var _0x353e5a=0x0;_0x353e5a<_0x2fc36d[_0x7e43('0x4a')];_0x353e5a+=0x1){_0x4a5a7d=_0x2fc36d[_0x353e5a][_0x7e43('0x75')]?_0x4c2b66[_0x2fc36d[_0x353e5a]['MetricId']][_0x7e43('0x76')]:_0x2fc36d[_0x353e5a][_0x7e43('0x6c')];_0x4a5a7d=_0x2fc36d[_0x353e5a]['function']?_[_0x7e43('0x78')](_0x184180[_0x2fc36d[_0x353e5a][_0x7e43('0x77')]],'%s',_0x4a5a7d):_0x4a5a7d;_0x4a5a7d=_0x2fc36d[_0x353e5a][_0x7e43('0x92')]?_[_0x7e43('0x78')](_0x2c8ec5[_0x2fc36d[_0x353e5a][_0x7e43('0x92')]],'%s',_0x4a5a7d):_0x4a5a7d;if(_0x2fc36d[_0x353e5a][_0x7e43('0x79')]){_0xed4b31[_0x7e43('0x6b')](_0x4a5a7d);}_0x2fc36d[_0x353e5a][_0x7e43('0x7a')]&&_0xed4b31[_0x7e43('0x3d')](_0x4a5a7d,_0x2fc36d[_0x353e5a][_0x7e43('0x7a')]===_0x7e43('0x7b')?![]:!![]);_0xed4b31[_0x7e43('0x6c')](_0x4a5a7d,_0x2fc36d[_0x353e5a][_0x7e43('0x7c')]||_0x4a5a7d);}if(_0x4fef29[_0x7e43('0x7d')]){_0x4fef29[_0x7e43('0x7d')]=JSON[_0x7e43('0x7e')](_0x4fef29[_0x7e43('0x7d')]);for(var _0x485e3e=0x0;_0x485e3e<_0x4fef29[_0x7e43('0x7d')][_0x7e43('0x4a')];_0x485e3e+=0x1){if(_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x31')]&&_[_0x7e43('0x66')](_0x1f9073,_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x31')])&&_0x4fef29['joins'][_0x485e3e][_0x7e43('0x7f')]&&_0x4fef29['joins'][_0x485e3e][_0x7e43('0x93')]&&_0x4fef29[_0x7e43('0x7d')][_0x485e3e]['foreignKey']){_0xed4b31[_0x4fef29['joins'][_0x485e3e]['type']](_0x4fef29[_0x7e43('0x7d')][_0x485e3e]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4fef29[_0x7e43('0x74')],_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x7f')],_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x93')],_0x4fef29[_0x7e43('0x7d')][_0x485e3e][_0x7e43('0x80')]));}}}if(_0x4fef29[_0x7e43('0x82')]){_0x4fef29[_0x7e43('0x82')]=JSON[_0x7e43('0x7e')](_0x4fef29[_0x7e43('0x82')]);_0xed4b31[_0x7e43('0x3f')](_0x44e74d(_0x4fef29[_0x7e43('0x82')][_0x7e43('0x6b')]));}_0x4ec1f4=_0xed4b31['clone']();_0xed4b31['limit'](_0x58bd6c);_0xed4b31[_0x7e43('0x21')](0x0);logger[_0x7e43('0x84')](_0x7e43('0x85'),_0xed4b31['toString']());return db[_0x7e43('0x87')]['query'](_0xed4b31[_0x7e43('0x86')](),{'type':db['sequelize'][_0x7e43('0x88')]['SELECT']});}})[_0x7e43('0x27')](function(_0x2d7f2c){if(!_0x2d7f2c[_0x7e43('0x4a')]){throw new db[(_0x7e43('0x70'))][(_0x7e43('0x71'))](_0x7e43('0x94'),0xcc);}if(_0xe80549[_0x7e43('0x95')]===_0x7e43('0x96')){return null;}var _0x3ac714=_[_0x7e43('0x42')](_0xe80549,{'name':_0xe80549['fullPath']||_0xe80549[_0x7e43('0x2d')]||_0x4fef29[_0x7e43('0x2d')],'basename':_0x490c50,'savename':util['format']('%s-%s.%s',_0xe80549[_0x7e43('0x2d')]||_0x4fef29[_0x7e43('0x2d')],require(_0x7e43('0x97'))['generate'](0x4),_0xe80549[_0x7e43('0x95')]||_0x7e43('0x98')),'reportId':_0x4fef29['id'],'reportType':_0x7e43('0x99')});return db[_0x7e43('0x9a')][_0x7e43('0x54')](_0x3ac714,{'raw':!![]});})[_0x7e43('0x27')](function(_0xe44802){if(_0x4fef29['table']===_0x7e43('0x9b')){_0x4ec1f4[_0x7e43('0x3f')](_0x4fef29[_0x7e43('0x74')]+_0x7e43('0x9c'),_0xe80549[_0x7e43('0x9d')],_0xe80549[_0x7e43('0x9e')]);}else{_0x4ec1f4[_0x7e43('0x3f')](_0x4fef29[_0x7e43('0x74')]+_0x7e43('0x9f'),_0xe80549[_0x7e43('0x9d')],_0xe80549[_0x7e43('0x9e')]);}if(_0xe44802){logger[_0x7e43('0xa0')](_0x7e43('0xa1'),_0x4ec1f4[_0x7e43('0x86')]());require(_0x7e43('0xa2'))[_0x7e43('0xa3')](path['join'](__dirname,_0x7e43('0xa4'),_0xe44802[_0x7e43('0x95')]),[_0xe44802['id'],_0x4ec1f4['toString'](),path[_0x7e43('0x8a')](__dirname,_0x7e43('0xa5'),_0xe44802['savename']),_0x490c50]);return _0xe44802;}else{var _0x4908dc=squel[_0x7e43('0x73')]();_0x4908dc[_0x7e43('0x91')]('('+_0x4ec1f4[_0x7e43('0x86')]()+')','countTable');_0x4908dc['field'](_0x7e43('0xa6'),'count');_0x4ec1f4['limit'](_0xe80549['limit']||_0x58bd6c);_0x4ec1f4[_0x7e43('0x21')](_0xe80549[_0x7e43('0x21')]||0x0);return dbH[_0x7e43('0x87')][_0x7e43('0x35')](_0x4908dc[_0x7e43('0x86')](),{'type':dbH[_0x7e43('0x87')][_0x7e43('0x88')][_0x7e43('0x89')]})[_0x7e43('0x27')](function(_0x1a0b55){if(!_0x1a0b55[_0x7e43('0x4a')]){_0x35b603=0x0;}else{_0x35b603=_0x1a0b55[0x0]['count']||0x0;}return dbH[_0x7e43('0x87')][_0x7e43('0x35')](_0x4ec1f4[_0x7e43('0x86')](),{'type':dbH[_0x7e43('0x87')][_0x7e43('0x88')]['SELECT']});})[_0x7e43('0x27')](function(_0x3cc251){return{'rows':_0x3cc251||[],'count':_0x35b603};});}});}exports['run']=function(_0x479583,_0x58c5dc){return runReport(_0x479583[_0x7e43('0x57')],_0x479583[_0x7e43('0x35')],_0x479583[_0x7e43('0x44')])[_0x7e43('0x27')](respondWithResult(_0x58c5dc,null))[_0x7e43('0x48')](handleError(_0x58c5dc,null));};exports['runReport']=runReport;exports[_0x7e43('0x35')]=function(_0x14d0b0,_0x4633c1){var _0xcb9c1e=0xa;var _0xc78ac7=[_0x7e43('0x8a'),_0x7e43('0x8b'),_0x7e43('0x59'),_0x7e43('0x5a')];var _0x16e525={'SUM':_0x7e43('0x8c'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e43('0x5d'),'MIN':_0x7e43('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7e43('0x60'),'GROUP_CONCAT DESC':_0x7e43('0x61')};var _0x1fff7e={'SEC_TO_TIME':_0x7e43('0x62'),'DATE':_0x7e43('0x63'),'HOUR':_0x7e43('0x64'),'ROUND':_0x7e43('0xa7'),'UNIX_TIMESTAMP':_0x7e43('0x65')};var _0x36035e=function(_0x33954e){return!_[_0x7e43('0x66')]([_0x7e43('0x67'),_0x7e43('0x68'),_0x7e43('0x8e'),_0x7e43('0x8f')],_0x33954e);};var _0x451644=function(_0x5d9691){if(!_0x5d9691||!_0x5d9691[_0x7e43('0x69')][_0x7e43('0x4a')]){return'';}for(var _0x48bb8a='(',_0x4d7640=0x0;_0x4d7640<_0x5d9691[_0x7e43('0x69')][_0x7e43('0x4a')];_0x4d7640+=0x1){_0x4d7640>0x0&&(_0x48bb8a+='\x20'+_0x5d9691['operator']+'\x20');_0x48bb8a+=_0x5d9691[_0x7e43('0x69')][_0x4d7640][_0x7e43('0x6b')]?_0x451644(_0x5d9691['rules'][_0x4d7640][_0x7e43('0x6b')]):_0x5d9691[_0x7e43('0x69')][_0x4d7640]['field']+'\x20'+_0x5d9691[_0x7e43('0x69')][_0x4d7640]['condition']+(_0x36035e(_0x5d9691[_0x7e43('0x69')][_0x4d7640][_0x7e43('0x6d')])?'\x20'+_0x5d9691[_0x7e43('0x69')][_0x4d7640]['value']:'');}return _0x48bb8a+')';};var _0x15873b={'where':{'id':_0x14d0b0['params']['id']}},_0x305dc5,_0x499879,_0x50f723,_0x3e5dd8,_0x2eb825;_0x15873b=_[_0x7e43('0x42')]({},_0x15873b,_0x14d0b0[_0x7e43('0x44')]);return db[_0x7e43('0x2f')][_0x7e43('0x4b')](_0x15873b)[_0x7e43('0x27')](function(_0x9f9baa){if(_0x9f9baa){_0x305dc5=_0x9f9baa;return _0x9f9baa[_0x7e43('0x6f')]();}return null;})[_0x7e43('0x27')](function(_0x51d989){if(_0x51d989){if(!_0x51d989['length']){throw new db[(_0x7e43('0x70'))]['ValidationErrorItem'](_0x7e43('0x72'),0x193);}_0x499879=_0x51d989;return db['AnalyticMetric'][_0x7e43('0x47')]({'raw':!![]});}return null;})[_0x7e43('0x27')](function(_0x4cf11a){if(_0x4cf11a){_0x50f723=_[_0x7e43('0xa8')](_0x4cf11a,'id');var _0x18bad2;var _0x464f92=squel[_0x7e43('0x73')]();_0x464f92[_0x7e43('0x91')](_0x305dc5[_0x7e43('0x74')]);for(var _0x157092=0x0;_0x157092<_0x499879['length'];_0x157092+=0x1){_0x18bad2=_0x499879[_0x157092][_0x7e43('0x75')]?_0x50f723[_0x499879[_0x157092]['MetricId']][_0x7e43('0x76')]:_0x499879[_0x157092][_0x7e43('0x6c')];_0x18bad2=_0x499879[_0x157092][_0x7e43('0x77')]?_[_0x7e43('0x78')](_0x16e525[_0x499879[_0x157092][_0x7e43('0x77')]],'%s',_0x18bad2):_0x18bad2;_0x18bad2=_0x499879[_0x157092][_0x7e43('0x92')]?_[_0x7e43('0x78')](_0x1fff7e[_0x499879[_0x157092][_0x7e43('0x92')]],'%s',_0x18bad2):_0x18bad2;if(_0x499879[_0x157092][_0x7e43('0x79')]){_0x464f92[_0x7e43('0x6b')](_0x18bad2);}_0x499879[_0x157092][_0x7e43('0x7a')]&&_0x464f92[_0x7e43('0x3d')](_0x18bad2,_0x499879[_0x157092][_0x7e43('0x7a')]===_0x7e43('0x7b')?![]:!![]);_0x464f92[_0x7e43('0x6c')](_0x18bad2,_0x499879[_0x157092]['alias']||_0x18bad2);}if(_0x305dc5[_0x7e43('0x7d')]){_0x305dc5[_0x7e43('0x7d')]=JSON[_0x7e43('0x7e')](_0x305dc5[_0x7e43('0x7d')]);for(var _0x6005e1=0x0;_0x6005e1<_0x305dc5[_0x7e43('0x7d')][_0x7e43('0x4a')];_0x6005e1+=0x1){if(_0x305dc5[_0x7e43('0x7d')][_0x6005e1]['type']&&_[_0x7e43('0x66')](_0xc78ac7,_0x305dc5[_0x7e43('0x7d')][_0x6005e1][_0x7e43('0x31')])&&_0x305dc5[_0x7e43('0x7d')][_0x6005e1][_0x7e43('0x7f')]&&_0x305dc5[_0x7e43('0x7d')][_0x6005e1]['foreignTable']&&_0x305dc5['joins'][_0x6005e1][_0x7e43('0x80')]){_0x464f92[_0x305dc5['joins'][_0x6005e1][_0x7e43('0x31')]](_0x305dc5['joins'][_0x6005e1][_0x7e43('0x93')],null,util[_0x7e43('0x92')](_0x7e43('0x81'),_0x305dc5['table'],_0x305dc5['joins'][_0x6005e1][_0x7e43('0x7f')],_0x305dc5[_0x7e43('0x7d')][_0x6005e1][_0x7e43('0x93')],_0x305dc5[_0x7e43('0x7d')][_0x6005e1]['foreignKey']));}}}if(_0x305dc5[_0x7e43('0x82')]){_0x305dc5['conditions']=JSON[_0x7e43('0x7e')](_0x305dc5[_0x7e43('0x82')]);_0x464f92[_0x7e43('0x3f')](_0x451644(_0x305dc5[_0x7e43('0x82')]['group']));}_0x2eb825=_0x464f92['clone']();_0x464f92['limit'](_0xcb9c1e);_0x464f92['offset'](0x0);logger['debug']('Limited\x20Query:',_0x464f92[_0x7e43('0x86')]());return db[_0x7e43('0x87')][_0x7e43('0x35')](_0x464f92[_0x7e43('0x86')](),{'type':db[_0x7e43('0x87')][_0x7e43('0x88')][_0x7e43('0x89')]});}})['then'](function(){return{'sql':_0x2eb825[_0x7e43('0x86')]()};})[_0x7e43('0x27')](respondWithResult(_0x4633c1,null))[_0x7e43('0x48')](handleError(_0x4633c1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index deddda2..a698ed5 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 _0xf8b1=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','util','../../config/logger','api','moment','request-promise','path'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xf8b1,0x1c8));var _0x1f8b=function(_0x5cc940,_0x50f482){_0x5cc940=_0x5cc940-0x0;var _0x10af42=_0xf8b1[_0x5cc940];return _0x10af42;};'use strict';var _=require('lodash');var util=require(_0x1f8b('0x0'));var logger=require(_0x1f8b('0x1'))(_0x1f8b('0x2'));var moment=require(_0x1f8b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f8b('0x4'));var fs=require('fs');var path=require(_0x1f8b('0x5'));var rimraf=require(_0x1f8b('0x6'));var config=require(_0x1f8b('0x7'));var attributes=require(_0x1f8b('0x8'));module[_0x1f8b('0x9')]=function(_0x13a8f7,_0xb93ef9){return _0x13a8f7[_0x1f8b('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd99d=['analytics_default_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd99d,0x1ae));var _0xdd99=function(_0x289143,_0x277942){_0x289143=_0x289143-0x0;var _0x493931=_0xd99d[_0x289143];return _0x493931;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var logger=require(_0xdd99('0x1'))(_0xdd99('0x2'));var moment=require('moment');var BPromise=require(_0xdd99('0x3'));var rp=require(_0xdd99('0x4'));var fs=require('fs');var path=require(_0xdd99('0x5'));var rimraf=require(_0xdd99('0x6'));var config=require(_0xdd99('0x7'));var attributes=require(_0xdd99('0x8'));module[_0xdd99('0x9')]=function(_0x2537e5,_0x30b828){return _0x2537e5[_0xdd99('0xa')](_0xdd99('0xb'),attributes,{'tableName':_0xdd99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 6c3d6a7..fd3fa48 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 _0x2179=['AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x31bd89,_0x4a4c7e){var _0x277d96=function(_0x476714){while(--_0x476714){_0x31bd89['push'](_0x31bd89['shift']());}};_0x277d96(++_0x4a4c7e);}(_0x2179,0xc0));var _0x9217=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0x2179[_0x35f15b];return _0x262619;};'use strict';var _=require(_0x9217('0x0'));var util=require(_0x9217('0x1'));var moment=require(_0x9217('0x2'));var BPromise=require(_0x9217('0x3'));var rs=require(_0x9217('0x4'));var fs=require('fs');var Redis=require(_0x9217('0x5'));var db=require(_0x9217('0x6'))['db'];var utils=require(_0x9217('0x7'));var logger=require(_0x9217('0x8'))(_0x9217('0x9'));var config=require(_0x9217('0xa'));var jayson=require(_0x9217('0xb'));var client=jayson[_0x9217('0xc')][_0x9217('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ed3f7,_0x4b4344,_0x1a0b98){return new BPromise(function(_0x38127f,_0x23b2e7){return client[_0x9217('0xe')](_0x1ed3f7,_0x1a0b98)[_0x9217('0xf')](function(_0x5e7d99){logger['info'](_0x9217('0x10'),_0x4b4344,'request\x20sent');logger[_0x9217('0x11')](_0x9217('0x12'),_0x4b4344,_0x9217('0x13'),JSON['stringify'](_0x5e7d99));if(_0x5e7d99[_0x9217('0x14')]){if(_0x5e7d99[_0x9217('0x14')][_0x9217('0x15')]===0x1f4){logger[_0x9217('0x14')](_0x9217('0x10'),_0x4b4344,_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);return _0x23b2e7(_0x5e7d99[_0x9217('0x14')]['message']);}logger[_0x9217('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b4344,_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);return _0x38127f(_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);}else{logger[_0x9217('0x17')](_0x9217('0x10'),_0x4b4344,_0x9217('0x13'));_0x38127f(_0x5e7d99[_0x9217('0x18')][_0x9217('0x16')]);}})[_0x9217('0x19')](function(_0x3b367b){logger[_0x9217('0x14')](_0x9217('0x10'),_0x4b4344,_0x3b367b);_0x23b2e7(_0x3b367b);});});} \ No newline at end of file +var _0x7b37=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird'];(function(_0x34d38c,_0x4f1295){var _0x4be108=function(_0x263e0f){while(--_0x263e0f){_0x34d38c['push'](_0x34d38c['shift']());}};_0x4be108(++_0x4f1295);}(_0x7b37,0xd9));var _0x77b3=function(_0x36d14b,_0x1ba5eb){_0x36d14b=_0x36d14b-0x0;var _0x4be643=_0x7b37[_0x36d14b];return _0x4be643;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var moment=require('moment');var BPromise=require(_0x77b3('0x2'));var rs=require(_0x77b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77b3('0x5'))(_0x77b3('0x6'));var config=require(_0x77b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77b3('0x8')][_0x77b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515f06,_0x49aded,_0x2f896b){return new BPromise(function(_0x5b3fb4,_0x35becb){return client[_0x77b3('0xa')](_0x515f06,_0x2f896b)['then'](function(_0x46dc45){logger[_0x77b3('0xb')](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));logger[_0x77b3('0xe')](_0x77b3('0xf'),_0x49aded,_0x77b3('0xd'),JSON[_0x77b3('0x10')](_0x46dc45));if(_0x46dc45[_0x77b3('0x11')]){if(_0x46dc45[_0x77b3('0x11')]['code']===0x1f4){logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x35becb(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x5b3fb4(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}else{logger['info'](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));_0x5b3fb4(_0x46dc45[_0x77b3('0x13')][_0x77b3('0x12')]);}})['catch'](function(_0x224303){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x49aded,_0x224303);_0x35becb(_0x224303);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 65bd181..31ad0de 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 _0xd5f3=['../../components/auth/service','../../components/interaction/service','get','index','show','/:id/preview','isAuthenticated','run','/:id/query','query','post','create','put','update','delete','/:id','destroy','exports','path','express','Router'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd5f3,0xe4));var _0x3d5f=function(_0x28b2cd,_0x4052d7){_0x28b2cd=_0x28b2cd-0x0;var _0x2ab989=_0xd5f3[_0x28b2cd];return _0x2ab989;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3d5f('0x0'));var timeout=require('connect-timeout');var express=require(_0x3d5f('0x1'));var router=express[_0x3d5f('0x2')]();var auth=require(_0x3d5f('0x3'));var interaction=require(_0x3d5f('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x3d5f('0x5')]('/',auth['isAuthenticated'](),controller[_0x3d5f('0x6')]);router[_0x3d5f('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x3d5f('0x7')]);router[_0x3d5f('0x5')](_0x3d5f('0x8'),auth['isAuthenticated'](),controller['preview']);router[_0x3d5f('0x5')]('/:id/run',auth[_0x3d5f('0x9')](),controller[_0x3d5f('0xa')]);router['get'](_0x3d5f('0xb'),auth[_0x3d5f('0x9')](),controller[_0x3d5f('0xc')]);router[_0x3d5f('0xd')]('/',auth[_0x3d5f('0x9')](),controller[_0x3d5f('0xe')]);router[_0x3d5f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3d5f('0x10')]);router[_0x3d5f('0x11')](_0x3d5f('0x12'),auth[_0x3d5f('0x9')](),controller[_0x3d5f('0x13')]);module[_0x3d5f('0x14')]=router; \ No newline at end of file +var _0xae7d=['index','get','show','/:id/preview','preview','run','/:id/query','query','create','/:id','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xae7d,0x19b));var _0xdae7=function(_0x1c7168,_0xb55a8c){_0x1c7168=_0x1c7168-0x0;var _0x58054b=_0xae7d[_0x1c7168];return _0x58054b;};'use strict';var multer=require('multer');var util=require(_0xdae7('0x0'));var path=require('path');var timeout=require(_0xdae7('0x1'));var express=require(_0xdae7('0x2'));var router=express[_0xdae7('0x3')]();var auth=require(_0xdae7('0x4'));var interaction=require(_0xdae7('0x5'));var config=require(_0xdae7('0x6'));var controller=require(_0xdae7('0x7'));router['get']('/',auth[_0xdae7('0x8')](),controller[_0xdae7('0x9')]);router[_0xdae7('0xa')]('/:id',auth[_0xdae7('0x8')](),controller[_0xdae7('0xb')]);router['get'](_0xdae7('0xc'),auth['isAuthenticated'](),controller[_0xdae7('0xd')]);router[_0xdae7('0xa')]('/:id/run',auth[_0xdae7('0x8')](),controller[_0xdae7('0xe')]);router[_0xdae7('0xa')](_0xdae7('0xf'),auth[_0xdae7('0x8')](),controller[_0xdae7('0x10')]);router['post']('/',auth[_0xdae7('0x8')](),controller[_0xdae7('0x11')]);router['put'](_0xdae7('0x12'),auth[_0xdae7('0x8')](),controller[_0xdae7('0x13')]);router['delete']('/:id',auth[_0xdae7('0x8')](),controller['destroy']);module[_0xdae7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 60a95c0..a9bdadf 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 _0x7df2=['scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','xlsx','DATE','manual'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x7df2,0x1c5));var _0x27df=function(_0xc19f0e,_0xf15546){_0xc19f0e=_0xc19f0e-0x0;var _0x22fdd9=_0x7df2[_0xc19f0e];return _0x22fdd9;};'use strict';var Sequelize=require(_0x27df('0x0'));var moment=require(_0x27df('0x1'));module[_0x27df('0x2')]={'name':{'type':Sequelize[_0x27df('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x27df('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x27df('0x4')](_0x27df('0x5'),'pdf',_0x27df('0x6')),'allowNull':![],'defaultValue':_0x27df('0x5')},'savename':{'type':Sequelize[_0x27df('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x27df('0x7')]},'endDate':{'type':Sequelize[_0x27df('0x7')]},'status':{'type':Sequelize[_0x27df('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x27df('0x4')](_0x27df('0x8'),_0x27df('0x9')),'allowNull':![],'defaultValue':_0x27df('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x27df('0xa')]},'reportType':{'type':Sequelize[_0x27df('0x3')]}}; \ No newline at end of file +var _0x6546=['moment','STRING','csv','xlsx','DATE','manual','scheduled','UNSIGNED','sequelize'];(function(_0x2929a9,_0x344e5d){var _0x253bb1=function(_0x46530e){while(--_0x46530e){_0x2929a9['push'](_0x2929a9['shift']());}};_0x253bb1(++_0x344e5d);}(_0x6546,0x11f));var _0x6654=function(_0x195053,_0x1d22a6){_0x195053=_0x195053-0x0;var _0x556b3b=_0x6546[_0x195053];return _0x556b3b;};'use strict';var Sequelize=require(_0x6654('0x0'));var moment=require(_0x6654('0x1'));module['exports']={'name':{'type':Sequelize[_0x6654('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x6654('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x6654('0x3'),'pdf',_0x6654('0x4')),'allowNull':![],'defaultValue':_0x6654('0x3')},'savename':{'type':Sequelize[_0x6654('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6654('0x5')]},'endDate':{'type':Sequelize[_0x6654('0x5')]},'status':{'type':Sequelize[_0x6654('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x6654('0x6'),_0x6654('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6654('0x8')]},'reportType':{'type':Sequelize[_0x6654('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5d5ca88..16872ee 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 _0xc31e=['key','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','model','includeAll','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','existsSync','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type'];(function(_0x2b2a1f,_0x42a47){var _0x564766=function(_0x23abf9){while(--_0x23abf9){_0x2b2a1f['push'](_0x2b2a1f['shift']());}};_0x564766(++_0x42a47);}(_0xc31e,0xea));var _0xec31=function(_0x174170,_0x44c5cb){_0x174170=_0x174170-0x0;var _0x3f7057=_0xc31e[_0x174170];return _0x3f7057;};'use strict';var pdf=require(_0xec31('0x0'));var emlformat=require(_0xec31('0x1'));var rimraf=require(_0xec31('0x2'));var zipdir=require(_0xec31('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec31('0x4'));var moment=require(_0xec31('0x5'));var BPromise=require(_0xec31('0x6'));var Mustache=require('mustache');var util=require(_0xec31('0x7'));var path=require(_0xec31('0x8'));var sox=require(_0xec31('0x9'));var csv=require(_0xec31('0xa'));var ejs=require(_0xec31('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xec31('0xc'));var jsforce=require(_0xec31('0xd'));var deskjs=require(_0xec31('0xe'));var toCsv=require(_0xec31('0xa'));var querystring=require('querystring');var Papa=require(_0xec31('0xf'));var Redis=require(_0xec31('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xec31('0x11'));var as=require(_0xec31('0x12'));var hardwareService=require(_0xec31('0x13'));var logger=require(_0xec31('0x14'))(_0xec31('0x15'));var utils=require(_0xec31('0x16'));var config=require(_0xec31('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x565914,_0x47cf5f){_0x47cf5f=_0x47cf5f||0xcc;return function(_0x141ec3){if(_0x141ec3){return _0x565914[_0xec31('0x18')](_0x47cf5f);}return _0x565914['status'](_0x47cf5f)[_0xec31('0x19')]();};}function respondWithResult(_0x23e78a,_0x398c59){_0x398c59=_0x398c59||0xc8;return function(_0x466179){if(_0x466179){return _0x23e78a['status'](_0x398c59)[_0xec31('0x1a')](_0x466179);}};}function respondWithFilteredResult(_0x5a039b,_0x337d0d){return function(_0xa00c75){if(_0xa00c75){var _0x2bb506=_0xa00c75[_0xec31('0x1b')],_0x5a3259=_0x337d0d[_0xec31('0x1c')],_0x124eeb=_0x337d0d[_0xec31('0x1c')]+_0x337d0d[_0xec31('0x1d')],_0x4b5766;if(_0x124eeb>=_0x2bb506){_0x124eeb=_0x2bb506;_0x4b5766=0xc8;}else{_0x4b5766=0xce;}_0x5a039b[_0xec31('0x1e')](_0x4b5766);return _0x5a039b[_0xec31('0x1f')](_0xec31('0x20'),_0x5a3259+'-'+_0x124eeb+'/'+_0x2bb506)[_0xec31('0x1a')](_0xa00c75);}return null;};}function patchUpdates(_0x5da691){return function(_0x4344e9){try{jsonpatch['apply'](_0x4344e9,_0x5da691,!![]);}catch(_0x26bd99){return BPromise['reject'](_0x26bd99);}return _0x4344e9[_0xec31('0x21')]();};}function saveUpdates(_0x1fef3d,_0x5d561a){return function(_0x31e1b8){if(_0x31e1b8){return _0x31e1b8[_0xec31('0x22')](_0x1fef3d)['then'](function(_0x5e04dd){return _0x5e04dd;});}return null;};}function removeEntity(_0xbc509f,_0x2cb40e){return function(_0x18ce1f){if(_0x18ce1f){return _0x18ce1f[_0xec31('0x23')]()['then'](function(){var _0x5c2261=_0x18ce1f[_0xec31('0x24')]({'plain':!![]});var _0x4b7d88='ExtractedReports';return db[_0xec31('0x25')]['destroy']({'where':{'type':_0x4b7d88,'resourceId':_0x5c2261['id']}})[_0xec31('0x26')](function(){return _0x18ce1f;});})[_0xec31('0x26')](function(){_0xbc509f[_0xec31('0x1e')](0xcc)[_0xec31('0x19')]();});}};}function handleEntityNotFound(_0x1f43ff,_0x49452a){return function(_0x1be5fa){if(!_0x1be5fa){_0x1f43ff['sendStatus'](0x194);}return _0x1be5fa;};}function handleError(_0x24dba2,_0x158170){_0x158170=_0x158170||0x1f4;return function(_0xbac4b7){logger[_0xec31('0x27')](_0xbac4b7[_0xec31('0x28')]);if(_0xbac4b7[_0xec31('0x29')]){delete _0xbac4b7[_0xec31('0x29')];}_0x24dba2[_0xec31('0x1e')](_0x158170)[_0xec31('0x2a')](_0xbac4b7);};}exports[_0xec31('0x2b')]=function(_0xda5cfd,_0x567df2){var _0x383320={},_0x10a636={},_0x6be243={'count':0x0,'rows':[]};var _0x45f299=_['map'](db[_0xec31('0x2c')][_0xec31('0x2d')],function(_0x31b05b){return{'name':_0x31b05b[_0xec31('0x2e')],'type':_0x31b05b[_0xec31('0x2f')][_0xec31('0x30')]};});_0x10a636['model']=_[_0xec31('0x31')](_0x45f299,_0xec31('0x29'));_0x10a636[_0xec31('0x32')]=_[_0xec31('0x33')](_0xda5cfd[_0xec31('0x32')]);_0x10a636['filters']=_[_0xec31('0x34')](_0x10a636['model'],_0x10a636[_0xec31('0x32')]);_0x383320[_0xec31('0x35')]=_[_0xec31('0x34')](_0x10a636['model'],qs[_0xec31('0x36')](_0xda5cfd[_0xec31('0x32')][_0xec31('0x36')]));_0x383320[_0xec31('0x35')]=_0x383320[_0xec31('0x35')][_0xec31('0x37')]?_0x383320[_0xec31('0x35')]:_0x10a636['model'];if(!_0xda5cfd[_0xec31('0x32')][_0xec31('0x38')]('nolimit')){_0x383320[_0xec31('0x1d')]=qs[_0xec31('0x1d')](_0xda5cfd[_0xec31('0x32')]['limit']);_0x383320[_0xec31('0x1c')]=qs[_0xec31('0x1c')](_0xda5cfd[_0xec31('0x32')][_0xec31('0x1c')]);}_0x383320[_0xec31('0x39')]=qs[_0xec31('0x3a')](_0xda5cfd[_0xec31('0x32')][_0xec31('0x3a')]);_0x383320['where']=qs[_0xec31('0x3b')](_[_0xec31('0x3c')](_0xda5cfd[_0xec31('0x32')],_0x10a636[_0xec31('0x3b')]),_0x45f299);if(_0xda5cfd[_0xec31('0x32')]['filter']){_0x383320[_0xec31('0x3d')]=_[_0xec31('0x3e')](_0x383320['where'],{'$or':_['map'](_0x45f299,function(_0x44ad0a){if(_0x44ad0a['type']!==_0xec31('0x3f')){var _0x15f66a={};_0x15f66a[_0x44ad0a[_0xec31('0x29')]]={'$like':'%'+_0xda5cfd[_0xec31('0x32')][_0xec31('0x40')]+'%'};return _0x15f66a;}})});}_0x383320=_[_0xec31('0x3e')]({},_0x383320,_0xda5cfd[_0xec31('0x41')]);var _0x215852={'where':_0x383320[_0xec31('0x3d')]};return db[_0xec31('0x2c')][_0xec31('0x1b')](_0x215852)[_0xec31('0x26')](function(_0x9241dc){_0x6be243[_0xec31('0x1b')]=_0x9241dc;if(_0xda5cfd['query']['includeAll']){_0x383320[_0xec31('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xec31('0x43')](_0x383320);})['then'](function(_0x26b151){_0x6be243[_0xec31('0x44')]=_0x26b151;return _0x6be243;})[_0xec31('0x26')](respondWithFilteredResult(_0x567df2,_0x383320))[_0xec31('0x45')](handleError(_0x567df2,null));};exports[_0xec31('0x46')]=function(_0x5925aa,_0x39276b){var _0x596bb7={'raw':!![],'where':{'id':_0x5925aa[_0xec31('0x47')]['id']}},_0x1de7c4={};_0x1de7c4[_0xec31('0x48')]=_['keys'](db[_0xec31('0x2c')][_0xec31('0x2d')]);_0x1de7c4[_0xec31('0x32')]=_[_0xec31('0x33')](_0x5925aa[_0xec31('0x32')]);_0x1de7c4[_0xec31('0x3b')]=_[_0xec31('0x34')](_0x1de7c4['model'],_0x1de7c4[_0xec31('0x32')]);_0x596bb7[_0xec31('0x35')]=_[_0xec31('0x34')](_0x1de7c4['model'],qs[_0xec31('0x36')](_0x5925aa[_0xec31('0x32')][_0xec31('0x36')]));_0x596bb7[_0xec31('0x35')]=_0x596bb7['attributes'][_0xec31('0x37')]?_0x596bb7[_0xec31('0x35')]:_0x1de7c4[_0xec31('0x48')];if(_0x5925aa[_0xec31('0x32')][_0xec31('0x49')]){_0x596bb7[_0xec31('0x42')]=[{'all':!![]}];}_0x596bb7=_[_0xec31('0x3e')]({},_0x596bb7,_0x5925aa['options']);return db[_0xec31('0x2c')][_0xec31('0x4a')](_0x596bb7)[_0xec31('0x26')](handleEntityNotFound(_0x39276b,null))[_0xec31('0x26')](respondWithResult(_0x39276b,null))['catch'](handleError(_0x39276b,null));};exports[_0xec31('0x4b')]=function(_0xb4a642,_0x3f42d4){return db[_0xec31('0x2c')][_0xec31('0x4b')](_0xb4a642['body'],{})[_0xec31('0x26')](function(_0x3b9c9d){var _0x106df0=_0xb4a642[_0xec31('0x4c')][_0xec31('0x24')]({'plain':!![]});if(!_0x106df0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106df0[_0xec31('0x4d')]===_0xec31('0x4c')){var _0x4b97a3=_0x3b9c9d[_0xec31('0x24')]({'plain':!![]});var _0xcd34ad='ExtractedReports';return db[_0xec31('0x4e')][_0xec31('0x4a')]({'where':{'name':_0xcd34ad,'userProfileId':_0x106df0[_0xec31('0x4f')]},'raw':!![]})[_0xec31('0x26')](function(_0xf924d7){if(_0xf924d7&&_0xf924d7['autoAssociation']===0x0){return db['UserProfileResource'][_0xec31('0x4b')]({'name':_0x4b97a3['name'],'resourceId':_0x4b97a3['id'],'type':_0xf924d7[_0xec31('0x29')],'sectionId':_0xf924d7['id']},{})['then'](function(){return _0x3b9c9d;});}else{return _0x3b9c9d;}})[_0xec31('0x45')](function(_0x4a989e){logger[_0xec31('0x27')](_0xec31('0x50'),_0x4a989e);throw _0x4a989e;});}return _0x3b9c9d;})[_0xec31('0x26')](respondWithResult(_0x3f42d4,0xc9))[_0xec31('0x45')](handleError(_0x3f42d4,null));};exports[_0xec31('0x22')]=function(_0x15ee37,_0x1f9b1a){if(_0x15ee37['body']['id']){delete _0x15ee37['body']['id'];}return db[_0xec31('0x2c')]['find']({'where':{'id':_0x15ee37[_0xec31('0x47')]['id']}})[_0xec31('0x26')](handleEntityNotFound(_0x1f9b1a,null))[_0xec31('0x26')](saveUpdates(_0x15ee37[_0xec31('0x51')],null))[_0xec31('0x26')](respondWithResult(_0x1f9b1a,null))[_0xec31('0x45')](handleError(_0x1f9b1a,null));};exports['destroy']=function(_0x4c835c,_0x286501){return db['AnalyticExtractedReport'][_0xec31('0x4a')]({'where':{'id':_0x4c835c[_0xec31('0x47')]['id']}})[_0xec31('0x26')](handleEntityNotFound(_0x286501,null))['then'](removeEntity(_0x286501,null))[_0xec31('0x45')](handleError(_0x286501,null));};exports[_0xec31('0x52')]=function(_0x347cca,_0x45eddf,_0x18b918){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x347cca[_0xec31('0x47')]['id']},'attributes':['name','basename',_0xec31('0x53'),_0xec31('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x45eddf,null))[_0xec31('0x26')](function(_0x3f2595){if(_0x3f2595){if(!fs[_0xec31('0x55')](path[_0xec31('0x56')](config['root'],'server/files/reports',_0x3f2595['savename']))){throw new db[(_0xec31('0x57'))][(_0xec31('0x58'))](_0xec31('0x59'));}if(_0x347cca['query'][_0xec31('0x5a')]){return _0x45eddf[_0xec31('0x18')](0xc8);}return _0x45eddf[_0xec31('0x52')](path[_0xec31('0x56')](config[_0xec31('0x5b')],'server/files/reports',_0x3f2595[_0xec31('0x53')]),util[_0xec31('0x5c')](_0xec31('0x5d'),_0x3f2595['basename']||_0x3f2595[_0xec31('0x29')],_0x3f2595['output']['toLowerCase']()));}})[_0xec31('0x45')](handleError(_0x45eddf,null));}; \ No newline at end of file +var _0x4534=['root','format','%s.%s','toLowerCase','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','AnalyticExtractedReport','fieldName','model','map','query','intersection','fields','attributes','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4534,0x11e));var _0x4453=function(_0x2bbec7,_0x83c575){_0x2bbec7=_0x2bbec7-0x0;var _0x464a4d=_0x4534[_0x2bbec7];return _0x464a4d;};'use strict';var pdf=require(_0x4453('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4453('0x1'));var zipdir=require(_0x4453('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4453('0x3'));var moment=require(_0x4453('0x4'));var BPromise=require(_0x4453('0x5'));var Mustache=require(_0x4453('0x6'));var util=require('util');var path=require(_0x4453('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4453('0x8'));var squel=require(_0x4453('0x9'));var crypto=require(_0x4453('0xa'));var jsforce=require(_0x4453('0xb'));var deskjs=require(_0x4453('0xc'));var toCsv=require(_0x4453('0xd'));var querystring=require(_0x4453('0xe'));var Papa=require(_0x4453('0xf'));var Redis=require(_0x4453('0x10'));var authService=require(_0x4453('0x11'));var qs=require(_0x4453('0x12'));var as=require(_0x4453('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4453('0x14'))(_0x4453('0x15'));var utils=require(_0x4453('0x16'));var config=require(_0x4453('0x17'));var licenseUtil=require(_0x4453('0x18'));var db=require(_0x4453('0x19'))['db'];function respondWithStatusCode(_0xb04938,_0x51c4df){_0x51c4df=_0x51c4df||0xcc;return function(_0x4f0142){if(_0x4f0142){return _0xb04938[_0x4453('0x1a')](_0x51c4df);}return _0xb04938['status'](_0x51c4df)['end']();};}function respondWithResult(_0x4bc43e,_0x379f55){_0x379f55=_0x379f55||0xc8;return function(_0x5d08ed){if(_0x5d08ed){return _0x4bc43e[_0x4453('0x1b')](_0x379f55)['json'](_0x5d08ed);}};}function respondWithFilteredResult(_0x564fa3,_0x3b8933){return function(_0x2a9c56){if(_0x2a9c56){var _0x31cb4f=_0x2a9c56['count'],_0x443f07=_0x3b8933['offset'],_0x1d13cf=_0x3b8933[_0x4453('0x1c')]+_0x3b8933[_0x4453('0x1d')],_0xa94f7f;if(_0x1d13cf>=_0x31cb4f){_0x1d13cf=_0x31cb4f;_0xa94f7f=0xc8;}else{_0xa94f7f=0xce;}_0x564fa3[_0x4453('0x1b')](_0xa94f7f);return _0x564fa3[_0x4453('0x1e')](_0x4453('0x1f'),_0x443f07+'-'+_0x1d13cf+'/'+_0x31cb4f)[_0x4453('0x20')](_0x2a9c56);}return null;};}function patchUpdates(_0x56e324){return function(_0x82946a){try{jsonpatch[_0x4453('0x21')](_0x82946a,_0x56e324,!![]);}catch(_0x18d748){return BPromise[_0x4453('0x22')](_0x18d748);}return _0x82946a[_0x4453('0x23')]();};}function saveUpdates(_0x6be702,_0x52af14){return function(_0x3a221d){if(_0x3a221d){return _0x3a221d[_0x4453('0x24')](_0x6be702)[_0x4453('0x25')](function(_0x4d963c){return _0x4d963c;});}return null;};}function removeEntity(_0x4f3ed3,_0x249021){return function(_0x15ee4a){if(_0x15ee4a){return _0x15ee4a[_0x4453('0x26')]()['then'](function(){var _0x1c3f5e=_0x15ee4a[_0x4453('0x27')]({'plain':!![]});var _0x1ab06a='ExtractedReports';return db[_0x4453('0x28')][_0x4453('0x26')]({'where':{'type':_0x1ab06a,'resourceId':_0x1c3f5e['id']}})[_0x4453('0x25')](function(){return _0x15ee4a;});})[_0x4453('0x25')](function(){_0x4f3ed3[_0x4453('0x1b')](0xcc)[_0x4453('0x29')]();});}};}function handleEntityNotFound(_0x42bb2d,_0x281c05){return function(_0x5ce08d){if(!_0x5ce08d){_0x42bb2d[_0x4453('0x1a')](0x194);}return _0x5ce08d;};}function handleError(_0x32ff1a,_0xa5056d){_0xa5056d=_0xa5056d||0x1f4;return function(_0x4e77e5){logger[_0x4453('0x2a')](_0x4e77e5['stack']);if(_0x4e77e5['name']){delete _0x4e77e5[_0x4453('0x2b')];}_0x32ff1a[_0x4453('0x1b')](_0xa5056d)[_0x4453('0x2c')](_0x4e77e5);};}exports[_0x4453('0x2d')]=function(_0x28c8ab,_0xbebc2){var _0x272470={},_0x117e92={},_0x4dc9b5={'count':0x0,'rows':[]};var _0x3c6dc0=_['map'](db[_0x4453('0x2e')]['rawAttributes'],function(_0x295fa8){return{'name':_0x295fa8[_0x4453('0x2f')],'type':_0x295fa8['type']['key']};});_0x117e92[_0x4453('0x30')]=_[_0x4453('0x31')](_0x3c6dc0,_0x4453('0x2b'));_0x117e92['query']=_['keys'](_0x28c8ab[_0x4453('0x32')]);_0x117e92['filters']=_[_0x4453('0x33')](_0x117e92[_0x4453('0x30')],_0x117e92[_0x4453('0x32')]);_0x272470['attributes']=_[_0x4453('0x33')](_0x117e92[_0x4453('0x30')],qs[_0x4453('0x34')](_0x28c8ab['query']['fields']));_0x272470['attributes']=_0x272470[_0x4453('0x35')]['length']?_0x272470[_0x4453('0x35')]:_0x117e92[_0x4453('0x30')];if(!_0x28c8ab['query']['hasOwnProperty']('nolimit')){_0x272470['limit']=qs['limit'](_0x28c8ab['query'][_0x4453('0x1d')]);_0x272470[_0x4453('0x1c')]=qs['offset'](_0x28c8ab[_0x4453('0x32')][_0x4453('0x1c')]);}_0x272470['order']=qs[_0x4453('0x36')](_0x28c8ab['query'][_0x4453('0x36')]);_0x272470[_0x4453('0x37')]=qs[_0x4453('0x38')](_['pick'](_0x28c8ab[_0x4453('0x32')],_0x117e92[_0x4453('0x38')]),_0x3c6dc0);if(_0x28c8ab[_0x4453('0x32')][_0x4453('0x39')]){_0x272470[_0x4453('0x37')]=_[_0x4453('0x3a')](_0x272470[_0x4453('0x37')],{'$or':_[_0x4453('0x31')](_0x3c6dc0,function(_0x5c5950){if(_0x5c5950['type']!==_0x4453('0x3b')){var _0x4b9c22={};_0x4b9c22[_0x5c5950[_0x4453('0x2b')]]={'$like':'%'+_0x28c8ab['query'][_0x4453('0x39')]+'%'};return _0x4b9c22;}})});}_0x272470=_[_0x4453('0x3a')]({},_0x272470,_0x28c8ab[_0x4453('0x3c')]);var _0x3e3ae6={'where':_0x272470[_0x4453('0x37')]};return db[_0x4453('0x2e')][_0x4453('0x3d')](_0x3e3ae6)[_0x4453('0x25')](function(_0x11fff9){_0x4dc9b5['count']=_0x11fff9;if(_0x28c8ab[_0x4453('0x32')][_0x4453('0x3e')]){_0x272470['include']=[{'all':!![]}];}return db[_0x4453('0x2e')][_0x4453('0x3f')](_0x272470);})[_0x4453('0x25')](function(_0x359e03){_0x4dc9b5[_0x4453('0x40')]=_0x359e03;return _0x4dc9b5;})[_0x4453('0x25')](respondWithFilteredResult(_0xbebc2,_0x272470))[_0x4453('0x41')](handleError(_0xbebc2,null));};exports['show']=function(_0x2f2f1e,_0x1247de){var _0x212b20={'raw':!![],'where':{'id':_0x2f2f1e[_0x4453('0x42')]['id']}},_0x2271c7={};_0x2271c7[_0x4453('0x30')]=_['keys'](db[_0x4453('0x2e')][_0x4453('0x43')]);_0x2271c7[_0x4453('0x32')]=_['keys'](_0x2f2f1e[_0x4453('0x32')]);_0x2271c7[_0x4453('0x38')]=_['intersection'](_0x2271c7['model'],_0x2271c7[_0x4453('0x32')]);_0x212b20[_0x4453('0x35')]=_['intersection'](_0x2271c7[_0x4453('0x30')],qs[_0x4453('0x34')](_0x2f2f1e[_0x4453('0x32')][_0x4453('0x34')]));_0x212b20[_0x4453('0x35')]=_0x212b20[_0x4453('0x35')][_0x4453('0x44')]?_0x212b20[_0x4453('0x35')]:_0x2271c7[_0x4453('0x30')];if(_0x2f2f1e[_0x4453('0x32')][_0x4453('0x3e')]){_0x212b20[_0x4453('0x45')]=[{'all':!![]}];}_0x212b20=_[_0x4453('0x3a')]({},_0x212b20,_0x2f2f1e['options']);return db[_0x4453('0x2e')][_0x4453('0x46')](_0x212b20)[_0x4453('0x25')](handleEntityNotFound(_0x1247de,null))[_0x4453('0x25')](respondWithResult(_0x1247de,null))[_0x4453('0x41')](handleError(_0x1247de,null));};exports['create']=function(_0x29d1b4,_0x14381d){return db['AnalyticExtractedReport'][_0x4453('0x47')](_0x29d1b4[_0x4453('0x48')],{})[_0x4453('0x25')](function(_0x725505){var _0x1fd16d=_0x29d1b4[_0x4453('0x49')][_0x4453('0x27')]({'plain':!![]});if(!_0x1fd16d)throw new Error(_0x4453('0x4a'));if(_0x1fd16d[_0x4453('0x4b')]==='user'){var _0x4f9f09=_0x725505['get']({'plain':!![]});var _0x104844=_0x4453('0x4c');return db['UserProfileSection'][_0x4453('0x46')]({'where':{'name':_0x104844,'userProfileId':_0x1fd16d[_0x4453('0x4d')]},'raw':!![]})[_0x4453('0x25')](function(_0x3fd925){if(_0x3fd925&&_0x3fd925[_0x4453('0x4e')]===0x0){return db[_0x4453('0x28')][_0x4453('0x47')]({'name':_0x4f9f09[_0x4453('0x2b')],'resourceId':_0x4f9f09['id'],'type':_0x3fd925[_0x4453('0x2b')],'sectionId':_0x3fd925['id']},{})[_0x4453('0x25')](function(){return _0x725505;});}else{return _0x725505;}})['catch'](function(_0x10625e){logger[_0x4453('0x2a')](_0x4453('0x4f'),_0x10625e);throw _0x10625e;});}return _0x725505;})[_0x4453('0x25')](respondWithResult(_0x14381d,0xc9))[_0x4453('0x41')](handleError(_0x14381d,null));};exports[_0x4453('0x24')]=function(_0x346996,_0x1eb6da){if(_0x346996['body']['id']){delete _0x346996['body']['id'];}return db['AnalyticExtractedReport'][_0x4453('0x46')]({'where':{'id':_0x346996['params']['id']}})[_0x4453('0x25')](handleEntityNotFound(_0x1eb6da,null))['then'](saveUpdates(_0x346996[_0x4453('0x48')],null))[_0x4453('0x25')](respondWithResult(_0x1eb6da,null))['catch'](handleError(_0x1eb6da,null));};exports[_0x4453('0x26')]=function(_0x45be4d,_0x3d7c7a){return db[_0x4453('0x2e')][_0x4453('0x46')]({'where':{'id':_0x45be4d[_0x4453('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d7c7a,null))['then'](removeEntity(_0x3d7c7a,null))[_0x4453('0x41')](handleError(_0x3d7c7a,null));};exports[_0x4453('0x50')]=function(_0x3eb055,_0x3d54d7,_0x4061f8){return db[_0x4453('0x2e')][_0x4453('0x46')]({'where':{'id':_0x3eb055['params']['id']},'attributes':[_0x4453('0x2b'),_0x4453('0x51'),_0x4453('0x52'),_0x4453('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x3d54d7,null))['then'](function(_0x4641f1){if(_0x4641f1){if(!fs[_0x4453('0x54')](path['join'](config['root'],_0x4453('0x55'),_0x4641f1['savename']))){throw new db['Sequelize'][(_0x4453('0x56'))](_0x4453('0x57'));}if(_0x3eb055['query'][_0x4453('0x58')]){return _0x3d54d7[_0x4453('0x1a')](0xc8);}return _0x3d54d7['download'](path[_0x4453('0x59')](config[_0x4453('0x5a')],'server/files/reports',_0x4641f1[_0x4453('0x52')]),util[_0x4453('0x5b')](_0x4453('0x5c'),_0x4641f1[_0x4453('0x51')]||_0x4641f1[_0x4453('0x2b')],_0x4641f1[_0x4453('0x53')][_0x4453('0x5d')]()));}})[_0x4453('0x41')](handleError(_0x3d54d7,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index cd263c7..481546a 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 _0x80b8=['define','analytics_extracted_reports','util','../../config/logger','api','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x55882f,_0x5b012f){var _0xe58161=function(_0x142eb2){while(--_0x142eb2){_0x55882f['push'](_0x55882f['shift']());}};_0xe58161(++_0x5b012f);}(_0x80b8,0x1ec));var _0x880b=function(_0x4462a5,_0x19ca06){_0x4462a5=_0x4462a5-0x0;var _0x47df55=_0x80b8[_0x4462a5];return _0x47df55;};'use strict';var _=require('lodash');var util=require(_0x880b('0x0'));var logger=require(_0x880b('0x1'))(_0x880b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x880b('0x3'));var fs=require('fs');var path=require(_0x880b('0x4'));var rimraf=require(_0x880b('0x5'));var config=require('../../config/environment');var attributes=require(_0x880b('0x6'));module[_0x880b('0x7')]=function(_0x30f82c,_0x587726){return _0x30f82c[_0x880b('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x880b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f62=['analytics_extracted_reports','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','AnalyticExtractedReport'];(function(_0x1a6ca3,_0x5dc083){var _0x27ffc0=function(_0x2053dd){while(--_0x2053dd){_0x1a6ca3['push'](_0x1a6ca3['shift']());}};_0x27ffc0(++_0x5dc083);}(_0x3f62,0xab));var _0x23f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3f62[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x23f6('0x0'));var logger=require(_0x23f6('0x1'))(_0x23f6('0x2'));var moment=require(_0x23f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x23f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23f6('0x5'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x23f6('0x6')]=function(_0x1331bc,_0x2c402f){return _0x1331bc[_0x23f6('0x7')](_0x23f6('0x8'),attributes,{'tableName':_0x23f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index b2e317b..cf22375 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 _0x6131=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch'];(function(_0x4ca15e,_0x4a2091){var _0x3d7c69=function(_0x124f71){while(--_0x124f71){_0x4ca15e['push'](_0x4ca15e['shift']());}};_0x3d7c69(++_0x4a2091);}(_0x6131,0xd1));var _0x1613=function(_0x1e4504,_0x467774){_0x1e4504=_0x1e4504-0x0;var _0x31c5b5=_0x6131[_0x1e4504];return _0x31c5b5;};'use strict';var _=require('lodash');var util=require(_0x1613('0x0'));var moment=require(_0x1613('0x1'));var BPromise=require(_0x1613('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1613('0x3'));var db=require(_0x1613('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1613('0x5'))(_0x1613('0x6'));var config=require(_0x1613('0x7'));var jayson=require(_0x1613('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x322cdc,_0x154e09,_0x48b92b){return new BPromise(function(_0x4d9aaf,_0x327efe){return client['request'](_0x322cdc,_0x48b92b)[_0x1613('0x9')](function(_0x28a545){logger[_0x1613('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x154e09,_0x1613('0xb'));logger[_0x1613('0xc')](_0x1613('0xd'),_0x154e09,_0x1613('0xb'),JSON['stringify'](_0x28a545));if(_0x28a545[_0x1613('0xe')]){if(_0x28a545['error']['code']===0x1f4){logger[_0x1613('0xe')](_0x1613('0xf'),_0x154e09,_0x28a545[_0x1613('0xe')]['message']);return _0x327efe(_0x28a545[_0x1613('0xe')][_0x1613('0x10')]);}logger[_0x1613('0xe')](_0x1613('0xf'),_0x154e09,_0x28a545[_0x1613('0xe')][_0x1613('0x10')]);return _0x4d9aaf(_0x28a545[_0x1613('0xe')][_0x1613('0x10')]);}else{logger[_0x1613('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x154e09,'request\x20sent');_0x4d9aaf(_0x28a545[_0x1613('0x11')][_0x1613('0x10')]);}})[_0x1613('0x12')](function(_0x4986a1){logger[_0x1613('0xe')](_0x1613('0xf'),_0x154e09,_0x4986a1);_0x327efe(_0x4986a1);});});} \ No newline at end of file +var _0x1728=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message'];(function(_0x50db4f,_0x2b918c){var _0x16b18d=function(_0x2ddb7a){while(--_0x2ddb7a){_0x50db4f['push'](_0x50db4f['shift']());}};_0x16b18d(++_0x2b918c);}(_0x1728,0x1ce));var _0x8172=function(_0x32fd30,_0x2b11c2){_0x32fd30=_0x32fd30-0x0;var _0x68f611=_0x1728[_0x32fd30];return _0x68f611;};'use strict';var _=require(_0x8172('0x0'));var util=require(_0x8172('0x1'));var moment=require('moment');var BPromise=require(_0x8172('0x2'));var rs=require(_0x8172('0x3'));var fs=require('fs');var Redis=require(_0x8172('0x4'));var db=require(_0x8172('0x5'))['db'];var utils=require(_0x8172('0x6'));var logger=require('../../config/logger')(_0x8172('0x7'));var config=require(_0x8172('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8172('0x9')][_0x8172('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57b47a,_0x4275b6,_0x401f5c){return new BPromise(function(_0x3bb7a3,_0x426a57){return client['request'](_0x57b47a,_0x401f5c)[_0x8172('0xb')](function(_0x276af6){logger[_0x8172('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4275b6,_0x8172('0xd'));logger[_0x8172('0xe')](_0x8172('0xf'),_0x4275b6,_0x8172('0xd'),JSON[_0x8172('0x10')](_0x276af6));if(_0x276af6[_0x8172('0x11')]){if(_0x276af6['error'][_0x8172('0x12')]===0x1f4){logger[_0x8172('0x11')](_0x8172('0x13'),_0x4275b6,_0x276af6[_0x8172('0x11')][_0x8172('0x14')]);return _0x426a57(_0x276af6[_0x8172('0x11')][_0x8172('0x14')]);}logger[_0x8172('0x11')](_0x8172('0x13'),_0x4275b6,_0x276af6['error'][_0x8172('0x14')]);return _0x3bb7a3(_0x276af6[_0x8172('0x11')][_0x8172('0x14')]);}else{logger[_0x8172('0xc')](_0x8172('0x13'),_0x4275b6,_0x8172('0xd'));_0x3bb7a3(_0x276af6['result'][_0x8172('0x14')]);}})['catch'](function(_0x422941){logger[_0x8172('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4275b6,_0x422941);_0x426a57(_0x422941);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1635e26..aacfbd0 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 _0xc61f=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','download','post','create','put','update','delete'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xc61f,0x65));var _0xfc61=function(_0x262f42,_0x4a6ca0){_0x262f42=_0x262f42-0x0;var _0x2b0712=_0xc61f[_0x262f42];return _0x2b0712;};'use strict';var multer=require('multer');var util=require(_0xfc61('0x0'));var path=require(_0xfc61('0x1'));var timeout=require(_0xfc61('0x2'));var express=require(_0xfc61('0x3'));var router=express[_0xfc61('0x4')]();var auth=require(_0xfc61('0x5'));var interaction=require(_0xfc61('0x6'));var config=require(_0xfc61('0x7'));var controller=require(_0xfc61('0x8'));router[_0xfc61('0x9')]('/',auth[_0xfc61('0xa')](),controller['index']);router[_0xfc61('0x9')](_0xfc61('0xb'),auth[_0xfc61('0xa')](),controller[_0xfc61('0xc')]);router['get']('/:id/download',auth[_0xfc61('0xa')](),controller[_0xfc61('0xd')]);router[_0xfc61('0xe')]('/',auth[_0xfc61('0xa')](),controller[_0xfc61('0xf')]);router[_0xfc61('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfc61('0x11')]);router[_0xfc61('0x12')](_0xfc61('0xb'),auth['isAuthenticated'](),controller[_0xfc61('0x13')]);module['exports']=router; \ No newline at end of file +var _0x93e7=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','put','delete','destroy','exports','multer','path'];(function(_0x55ee1f,_0x540a70){var _0x24bedc=function(_0x4a6213){while(--_0x4a6213){_0x55ee1f['push'](_0x55ee1f['shift']());}};_0x24bedc(++_0x540a70);}(_0x93e7,0x9e));var _0x793e=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x93e7[_0x5ecadc];return _0x565037;};'use strict';var multer=require(_0x793e('0x0'));var util=require('util');var path=require(_0x793e('0x1'));var timeout=require(_0x793e('0x2'));var express=require('express');var router=express[_0x793e('0x3')]();var auth=require(_0x793e('0x4'));var interaction=require(_0x793e('0x5'));var config=require(_0x793e('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x793e('0x7')]('/',auth['isAuthenticated'](),controller[_0x793e('0x8')]);router['get'](_0x793e('0x9'),auth['isAuthenticated'](),controller[_0x793e('0xa')]);router[_0x793e('0x7')](_0x793e('0xb'),auth[_0x793e('0xc')](),controller[_0x793e('0xd')]);router[_0x793e('0xe')]('/',auth[_0x793e('0xc')](),controller[_0x793e('0xf')]);router[_0x793e('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x793e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x793e('0x12')]);module[_0x793e('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8c69027..48bf709 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x501bb9,_0x28c6f6){var _0x7238b3=function(_0x5bbabf){while(--_0x5bbabf){_0x501bb9['push'](_0x501bb9['shift']());}};_0x7238b3(++_0x28c6f6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x5fc3[_0x338f73];return _0x163fdf;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x23622b,_0x36b0fa){var _0x4d977f=function(_0x4ce9ee){while(--_0x4ce9ee){_0x23622b['push'](_0x23622b['shift']());}};_0x4d977f(++_0x36b0fa);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e8c3347..7810730 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 _0x796c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','count','include','findAll','rows','show','keys','fields','length','includeAll','find','catch','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4dc7dd,_0x52960d){var _0x227b79=function(_0x48befb){while(--_0x48befb){_0x4dc7dd['push'](_0x4dc7dd['shift']());}};_0x227b79(++_0x52960d);}(_0x796c,0x133));var _0xc796=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x796c[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0xc796('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc796('0x1'));var rp=require(_0xc796('0x2'));var moment=require('moment');var BPromise=require(_0xc796('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc796('0x4'));var sox=require(_0xc796('0x5'));var csv=require(_0xc796('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc796('0x7'));var squel=require(_0xc796('0x8'));var crypto=require(_0xc796('0x9'));var jsforce=require(_0xc796('0xa'));var deskjs=require(_0xc796('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc796('0xc'));var Papa=require(_0xc796('0xd'));var Redis=require(_0xc796('0xe'));var authService=require(_0xc796('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc796('0x10'));var hardwareService=require(_0xc796('0x11'));var logger=require(_0xc796('0x12'))(_0xc796('0x13'));var utils=require(_0xc796('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc796('0x15'))['db'];function respondWithStatusCode(_0xf9e6ce,_0x28b06c){_0x28b06c=_0x28b06c||0xcc;return function(_0x2907f7){if(_0x2907f7){return _0xf9e6ce[_0xc796('0x16')](_0x28b06c);}return _0xf9e6ce['status'](_0x28b06c)[_0xc796('0x17')]();};}function respondWithResult(_0x2319bb,_0x226028){_0x226028=_0x226028||0xc8;return function(_0x22bfdd){if(_0x22bfdd){return _0x2319bb['status'](_0x226028)[_0xc796('0x18')](_0x22bfdd);}};}function respondWithFilteredResult(_0x1bb4eb,_0x4f6b38){return function(_0x5e8622){if(_0x5e8622){var _0x3337f5=_0x5e8622['count'],_0x1130bf=_0x4f6b38[_0xc796('0x19')],_0x5ecdf0=_0x4f6b38[_0xc796('0x19')]+_0x4f6b38['limit'],_0x520cae;if(_0x5ecdf0>=_0x3337f5){_0x5ecdf0=_0x3337f5;_0x520cae=0xc8;}else{_0x520cae=0xce;}_0x1bb4eb[_0xc796('0x1a')](_0x520cae);return _0x1bb4eb[_0xc796('0x1b')](_0xc796('0x1c'),_0x1130bf+'-'+_0x5ecdf0+'/'+_0x3337f5)[_0xc796('0x18')](_0x5e8622);}return null;};}function patchUpdates(_0x378563){return function(_0x1b4324){try{jsonpatch[_0xc796('0x1d')](_0x1b4324,_0x378563,!![]);}catch(_0x76806b){return BPromise[_0xc796('0x1e')](_0x76806b);}return _0x1b4324[_0xc796('0x1f')]();};}function saveUpdates(_0x19df9b,_0x377725){return function(_0x539d82){if(_0x539d82){return _0x539d82[_0xc796('0x20')](_0x19df9b)[_0xc796('0x21')](function(_0x1d3baf){return _0x1d3baf;});}return null;};}function removeEntity(_0x17550d,_0x248452){return function(_0x572833){if(_0x572833){return _0x572833[_0xc796('0x22')]()[_0xc796('0x21')](function(){_0x17550d[_0xc796('0x1a')](0xcc)[_0xc796('0x17')]();});}};}function handleEntityNotFound(_0x28dc98,_0x16664a){return function(_0x555ed3){if(!_0x555ed3){_0x28dc98[_0xc796('0x16')](0x194);}return _0x555ed3;};}function handleError(_0x380398,_0x81f7f7){_0x81f7f7=_0x81f7f7||0x1f4;return function(_0x575141){logger[_0xc796('0x23')](_0x575141['stack']);if(_0x575141['name']){delete _0x575141[_0xc796('0x24')];}_0x380398[_0xc796('0x1a')](_0x81f7f7)[_0xc796('0x25')](_0x575141);};}exports[_0xc796('0x26')]=function(_0x1e18c3,_0x4c4660){var _0x1725d1={},_0x185ed5={},_0x4c4d51={'count':0x0,'rows':[]};var _0x444f97=_[_0xc796('0x27')](db[_0xc796('0x28')][_0xc796('0x29')],function(_0x46730c){return{'name':_0x46730c[_0xc796('0x2a')],'type':_0x46730c[_0xc796('0x2b')]['key']};});_0x185ed5[_0xc796('0x2c')]=_[_0xc796('0x27')](_0x444f97,_0xc796('0x24'));_0x185ed5[_0xc796('0x2d')]=_['keys'](_0x1e18c3['query']);_0x185ed5['filters']=_[_0xc796('0x2e')](_0x185ed5[_0xc796('0x2c')],_0x185ed5[_0xc796('0x2d')]);_0x1725d1[_0xc796('0x2f')]=_[_0xc796('0x2e')](_0x185ed5[_0xc796('0x2c')],qs['fields'](_0x1e18c3[_0xc796('0x2d')]['fields']));_0x1725d1[_0xc796('0x2f')]=_0x1725d1['attributes']['length']?_0x1725d1[_0xc796('0x2f')]:_0x185ed5['model'];if(!_0x1e18c3[_0xc796('0x2d')][_0xc796('0x30')](_0xc796('0x31'))){_0x1725d1[_0xc796('0x32')]=qs[_0xc796('0x32')](_0x1e18c3['query'][_0xc796('0x32')]);_0x1725d1[_0xc796('0x19')]=qs[_0xc796('0x19')](_0x1e18c3[_0xc796('0x2d')]['offset']);}_0x1725d1[_0xc796('0x33')]=qs[_0xc796('0x34')](_0x1e18c3['query'][_0xc796('0x34')]);_0x1725d1[_0xc796('0x35')]=qs[_0xc796('0x36')](_[_0xc796('0x37')](_0x1e18c3['query'],_0x185ed5[_0xc796('0x36')]),_0x444f97);if(_0x1e18c3[_0xc796('0x2d')][_0xc796('0x38')]){_0x1725d1[_0xc796('0x35')]=_[_0xc796('0x39')](_0x1725d1[_0xc796('0x35')],{'$or':_[_0xc796('0x27')](_0x444f97,function(_0xeac78c){if(_0xeac78c[_0xc796('0x2b')]!=='VIRTUAL'){var _0x4a3788={};_0x4a3788[_0xeac78c[_0xc796('0x24')]]={'$like':'%'+_0x1e18c3[_0xc796('0x2d')][_0xc796('0x38')]+'%'};return _0x4a3788;}})});}_0x1725d1=_[_0xc796('0x39')]({},_0x1725d1,_0x1e18c3[_0xc796('0x3a')]);var _0x2eaf6b={'where':_0x1725d1[_0xc796('0x35')]};return db[_0xc796('0x28')]['count'](_0x2eaf6b)[_0xc796('0x21')](function(_0xe6c17){_0x4c4d51[_0xc796('0x3b')]=_0xe6c17;if(_0x1e18c3[_0xc796('0x2d')]['includeAll']){_0x1725d1[_0xc796('0x3c')]=[{'all':!![]}];}return db[_0xc796('0x28')][_0xc796('0x3d')](_0x1725d1);})['then'](function(_0x2a7c6d){_0x4c4d51[_0xc796('0x3e')]=_0x2a7c6d;return _0x4c4d51;})[_0xc796('0x21')](respondWithFilteredResult(_0x4c4660,_0x1725d1))['catch'](handleError(_0x4c4660,null));};exports[_0xc796('0x3f')]=function(_0x362ed6,_0x4efbf2){var _0x15ab39={'raw':![],'where':{'id':_0x362ed6['params']['id']}},_0x152480={};_0x152480[_0xc796('0x2c')]=_[_0xc796('0x40')](db[_0xc796('0x28')][_0xc796('0x29')]);_0x152480[_0xc796('0x2d')]=_[_0xc796('0x40')](_0x362ed6[_0xc796('0x2d')]);_0x152480[_0xc796('0x36')]=_['intersection'](_0x152480[_0xc796('0x2c')],_0x152480['query']);_0x15ab39[_0xc796('0x2f')]=_[_0xc796('0x2e')](_0x152480[_0xc796('0x2c')],qs[_0xc796('0x41')](_0x362ed6['query']['fields']));_0x15ab39[_0xc796('0x2f')]=_0x15ab39[_0xc796('0x2f')][_0xc796('0x42')]?_0x15ab39[_0xc796('0x2f')]:_0x152480['model'];if(_0x362ed6['query'][_0xc796('0x43')]){_0x15ab39[_0xc796('0x3c')]=[{'all':!![]}];}_0x15ab39=_[_0xc796('0x39')]({},_0x15ab39,_0x362ed6[_0xc796('0x3a')]);return db[_0xc796('0x28')][_0xc796('0x44')](_0x15ab39)['then'](handleEntityNotFound(_0x4efbf2,null))[_0xc796('0x21')](respondWithResult(_0x4efbf2,null))[_0xc796('0x45')](handleError(_0x4efbf2,null));};exports[_0xc796('0x46')]=function(_0x33fec7,_0x30111e){return db[_0xc796('0x28')][_0xc796('0x46')](_0x33fec7[_0xc796('0x47')],{})[_0xc796('0x21')](respondWithResult(_0x30111e,0xc9))[_0xc796('0x45')](handleError(_0x30111e,null));};exports[_0xc796('0x48')]=function(_0x30ba94,_0x18b114){return db[_0xc796('0x28')][_0xc796('0x48')](_0x30ba94[_0xc796('0x47')],{'raw':![],'individualHooks':!![]})[_0xc796('0x21')](respondWithResult(_0x18b114,0xc9))[_0xc796('0x45')](handleError(_0x18b114,null));};exports[_0xc796('0x20')]=function(_0x207a9f,_0x49796){if(_0x207a9f[_0xc796('0x47')]['id']){delete _0x207a9f['body']['id'];}return db[_0xc796('0x28')][_0xc796('0x44')]({'where':{'id':_0x207a9f[_0xc796('0x49')]['id']}})[_0xc796('0x21')](handleEntityNotFound(_0x49796,null))['then'](saveUpdates(_0x207a9f[_0xc796('0x47')],null))[_0xc796('0x21')](respondWithResult(_0x49796,null))['catch'](handleError(_0x49796,null));};exports[_0xc796('0x22')]=function(_0x5de8b3,_0xdd1e4f){return db[_0xc796('0x28')]['find']({'where':{'id':_0x5de8b3[_0xc796('0x49')]['id']}})[_0xc796('0x21')](handleEntityNotFound(_0xdd1e4f,null))[_0xc796('0x21')](removeEntity(_0xdd1e4f,null))['catch'](handleError(_0xdd1e4f,null));};exports[_0xc796('0x4a')]=function(_0x4e3ff5,_0x22a783){return db[_0xc796('0x28')][_0xc796('0x22')]({'where':{'id':_0x4e3ff5[_0xc796('0x2d')][_0xc796('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xc796('0x21')](respondWithResult(_0x22a783,0xcc))[_0xc796('0x45')](handleError(_0x22a783,null));};exports[_0xc796('0x4c')]=function(_0x8e922d,_0x78d8fe,_0x7ce6a5){return db[_0xc796('0x4d')]['findOne']({'where':{'id':_0x8e922d[_0xc796('0x49')]['id']}})[_0xc796('0x21')](handleEntityNotFound(_0x78d8fe,null))[_0xc796('0x21')](function(_0x1e4171){if(_0x1e4171){return db[_0xc796('0x4e')][_0xc796('0x4f')](function(_0x5b9344){return db[_0xc796('0x28')][_0xc796('0x22')]({'where':{'CustomReportId':_0x8e922d[_0xc796('0x49')]['id']},'transaction':_0x5b9344})['then'](function(_0x21b960){var _0x2ed965=_[_0xc796('0x27')](_0x8e922d['body'],function(_0x3e1cd8){delete _0x3e1cd8['id'];_0x3e1cd8[_0xc796('0x50')]=_0x8e922d['params']['id'];return _0x3e1cd8;});return db[_0xc796('0x28')][_0xc796('0x48')](_0x2ed965,{'transaction':_0x5b9344});});})[_0xc796('0x21')](function(){return db[_0xc796('0x28')][_0xc796('0x3d')]({'where':{'CustomReportId':_0x8e922d[_0xc796('0x49')]['id']}});});}})['then'](respondWithResult(_0x78d8fe,null))['catch'](handleError(_0x78d8fe,null));}; \ No newline at end of file +var _0x1bde=['update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','include','findAll','show','length','includeAll','catch','create','body','bulkCreate','find','params','ids','AnalyticCustomReport','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x1bde,0xc4));var _0xe1bd=function(_0x32003d,_0x50ed19){_0x32003d=_0x32003d-0x0;var _0x4c09ee=_0x1bde[_0x32003d];return _0x4c09ee;};'use strict';var pdf=require(_0xe1bd('0x0'));var emlformat=require(_0xe1bd('0x1'));var rimraf=require(_0xe1bd('0x2'));var zipdir=require(_0xe1bd('0x3'));var jsonpatch=require(_0xe1bd('0x4'));var rp=require('request-promise');var moment=require(_0xe1bd('0x5'));var BPromise=require(_0xe1bd('0x6'));var Mustache=require(_0xe1bd('0x7'));var util=require(_0xe1bd('0x8'));var path=require('path');var sox=require(_0xe1bd('0x9'));var csv=require(_0xe1bd('0xa'));var ejs=require(_0xe1bd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xe1bd('0xd'));var deskjs=require(_0xe1bd('0xe'));var toCsv=require(_0xe1bd('0xa'));var querystring=require(_0xe1bd('0xf'));var Papa=require(_0xe1bd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1bd('0x11'));var logger=require(_0xe1bd('0x12'))(_0xe1bd('0x13'));var utils=require(_0xe1bd('0x14'));var config=require(_0xe1bd('0x15'));var licenseUtil=require(_0xe1bd('0x16'));var db=require(_0xe1bd('0x17'))['db'];function respondWithStatusCode(_0x17e745,_0x3588bb){_0x3588bb=_0x3588bb||0xcc;return function(_0xc6d47c){if(_0xc6d47c){return _0x17e745[_0xe1bd('0x18')](_0x3588bb);}return _0x17e745[_0xe1bd('0x19')](_0x3588bb)[_0xe1bd('0x1a')]();};}function respondWithResult(_0x1bd098,_0x57959e){_0x57959e=_0x57959e||0xc8;return function(_0x226d1b){if(_0x226d1b){return _0x1bd098['status'](_0x57959e)[_0xe1bd('0x1b')](_0x226d1b);}};}function respondWithFilteredResult(_0x4e4345,_0x5585d7){return function(_0x268a3d){if(_0x268a3d){var _0x3a2e65=_0x268a3d[_0xe1bd('0x1c')],_0x4d9e70=_0x5585d7[_0xe1bd('0x1d')],_0x403cc4=_0x5585d7[_0xe1bd('0x1d')]+_0x5585d7[_0xe1bd('0x1e')],_0x2a37b2;if(_0x403cc4>=_0x3a2e65){_0x403cc4=_0x3a2e65;_0x2a37b2=0xc8;}else{_0x2a37b2=0xce;}_0x4e4345[_0xe1bd('0x19')](_0x2a37b2);return _0x4e4345['set'](_0xe1bd('0x1f'),_0x4d9e70+'-'+_0x403cc4+'/'+_0x3a2e65)[_0xe1bd('0x1b')](_0x268a3d);}return null;};}function patchUpdates(_0xa38770){return function(_0x1cfe67){try{jsonpatch[_0xe1bd('0x20')](_0x1cfe67,_0xa38770,!![]);}catch(_0x157ea7){return BPromise[_0xe1bd('0x21')](_0x157ea7);}return _0x1cfe67[_0xe1bd('0x22')]();};}function saveUpdates(_0x35e520,_0x39b35f){return function(_0x3be5b9){if(_0x3be5b9){return _0x3be5b9[_0xe1bd('0x23')](_0x35e520)[_0xe1bd('0x24')](function(_0x1901c1){return _0x1901c1;});}return null;};}function removeEntity(_0xaa5dfa,_0x5a34c3){return function(_0x435980){if(_0x435980){return _0x435980[_0xe1bd('0x25')]()['then'](function(){_0xaa5dfa[_0xe1bd('0x19')](0xcc)[_0xe1bd('0x1a')]();});}};}function handleEntityNotFound(_0x3f9651,_0x39cccb){return function(_0x3dda79){if(!_0x3dda79){_0x3f9651[_0xe1bd('0x18')](0x194);}return _0x3dda79;};}function handleError(_0x39a211,_0x602736){_0x602736=_0x602736||0x1f4;return function(_0x5bdc70){logger[_0xe1bd('0x26')](_0x5bdc70[_0xe1bd('0x27')]);if(_0x5bdc70[_0xe1bd('0x28')]){delete _0x5bdc70[_0xe1bd('0x28')];}_0x39a211[_0xe1bd('0x19')](_0x602736)[_0xe1bd('0x29')](_0x5bdc70);};}exports[_0xe1bd('0x2a')]=function(_0x355d0d,_0x68ab31){var _0x4266de={},_0x4e0747={},_0x22ca30={'count':0x0,'rows':[]};var _0x434919=_[_0xe1bd('0x2b')](db[_0xe1bd('0x2c')][_0xe1bd('0x2d')],function(_0x1133b4){return{'name':_0x1133b4['fieldName'],'type':_0x1133b4[_0xe1bd('0x2e')][_0xe1bd('0x2f')]};});_0x4e0747[_0xe1bd('0x30')]=_[_0xe1bd('0x2b')](_0x434919,'name');_0x4e0747[_0xe1bd('0x31')]=_[_0xe1bd('0x32')](_0x355d0d[_0xe1bd('0x31')]);_0x4e0747[_0xe1bd('0x33')]=_[_0xe1bd('0x34')](_0x4e0747[_0xe1bd('0x30')],_0x4e0747[_0xe1bd('0x31')]);_0x4266de[_0xe1bd('0x35')]=_[_0xe1bd('0x34')](_0x4e0747[_0xe1bd('0x30')],qs['fields'](_0x355d0d['query'][_0xe1bd('0x36')]));_0x4266de['attributes']=_0x4266de[_0xe1bd('0x35')]['length']?_0x4266de[_0xe1bd('0x35')]:_0x4e0747[_0xe1bd('0x30')];if(!_0x355d0d['query'][_0xe1bd('0x37')](_0xe1bd('0x38'))){_0x4266de[_0xe1bd('0x1e')]=qs[_0xe1bd('0x1e')](_0x355d0d[_0xe1bd('0x31')][_0xe1bd('0x1e')]);_0x4266de[_0xe1bd('0x1d')]=qs[_0xe1bd('0x1d')](_0x355d0d[_0xe1bd('0x31')][_0xe1bd('0x1d')]);}_0x4266de[_0xe1bd('0x39')]=qs['sort'](_0x355d0d[_0xe1bd('0x31')]['sort']);_0x4266de['where']=qs[_0xe1bd('0x33')](_[_0xe1bd('0x3a')](_0x355d0d[_0xe1bd('0x31')],_0x4e0747[_0xe1bd('0x33')]),_0x434919);if(_0x355d0d[_0xe1bd('0x31')][_0xe1bd('0x3b')]){_0x4266de[_0xe1bd('0x3c')]=_[_0xe1bd('0x3d')](_0x4266de[_0xe1bd('0x3c')],{'$or':_[_0xe1bd('0x2b')](_0x434919,function(_0x1303d8){if(_0x1303d8[_0xe1bd('0x2e')]!=='VIRTUAL'){var _0x3ef58b={};_0x3ef58b[_0x1303d8[_0xe1bd('0x28')]]={'$like':'%'+_0x355d0d['query'][_0xe1bd('0x3b')]+'%'};return _0x3ef58b;}})});}_0x4266de=_[_0xe1bd('0x3d')]({},_0x4266de,_0x355d0d[_0xe1bd('0x3e')]);var _0x45c065={'where':_0x4266de[_0xe1bd('0x3c')]};return db[_0xe1bd('0x2c')][_0xe1bd('0x1c')](_0x45c065)[_0xe1bd('0x24')](function(_0x532b8d){_0x22ca30[_0xe1bd('0x1c')]=_0x532b8d;if(_0x355d0d[_0xe1bd('0x31')]['includeAll']){_0x4266de[_0xe1bd('0x3f')]=[{'all':!![]}];}return db[_0xe1bd('0x2c')][_0xe1bd('0x40')](_0x4266de);})['then'](function(_0x10e01e){_0x22ca30['rows']=_0x10e01e;return _0x22ca30;})[_0xe1bd('0x24')](respondWithFilteredResult(_0x68ab31,_0x4266de))['catch'](handleError(_0x68ab31,null));};exports[_0xe1bd('0x41')]=function(_0x5c501c,_0x3eba5e){var _0x4a6df1={'raw':![],'where':{'id':_0x5c501c['params']['id']}},_0x4bdfe1={};_0x4bdfe1[_0xe1bd('0x30')]=_[_0xe1bd('0x32')](db[_0xe1bd('0x2c')][_0xe1bd('0x2d')]);_0x4bdfe1['query']=_[_0xe1bd('0x32')](_0x5c501c['query']);_0x4bdfe1[_0xe1bd('0x33')]=_[_0xe1bd('0x34')](_0x4bdfe1['model'],_0x4bdfe1[_0xe1bd('0x31')]);_0x4a6df1['attributes']=_[_0xe1bd('0x34')](_0x4bdfe1[_0xe1bd('0x30')],qs[_0xe1bd('0x36')](_0x5c501c[_0xe1bd('0x31')]['fields']));_0x4a6df1[_0xe1bd('0x35')]=_0x4a6df1['attributes'][_0xe1bd('0x42')]?_0x4a6df1[_0xe1bd('0x35')]:_0x4bdfe1[_0xe1bd('0x30')];if(_0x5c501c[_0xe1bd('0x31')][_0xe1bd('0x43')]){_0x4a6df1[_0xe1bd('0x3f')]=[{'all':!![]}];}_0x4a6df1=_[_0xe1bd('0x3d')]({},_0x4a6df1,_0x5c501c['options']);return db['AnalyticFieldReport']['find'](_0x4a6df1)[_0xe1bd('0x24')](handleEntityNotFound(_0x3eba5e,null))[_0xe1bd('0x24')](respondWithResult(_0x3eba5e,null))[_0xe1bd('0x44')](handleError(_0x3eba5e,null));};exports['create']=function(_0x19bfe0,_0x2cb1d1){return db['AnalyticFieldReport'][_0xe1bd('0x45')](_0x19bfe0[_0xe1bd('0x46')],{})[_0xe1bd('0x24')](respondWithResult(_0x2cb1d1,0xc9))[_0xe1bd('0x44')](handleError(_0x2cb1d1,null));};exports[_0xe1bd('0x47')]=function(_0x4be840,_0x581984){return db[_0xe1bd('0x2c')]['bulkCreate'](_0x4be840[_0xe1bd('0x46')],{'raw':![],'individualHooks':!![]})[_0xe1bd('0x24')](respondWithResult(_0x581984,0xc9))['catch'](handleError(_0x581984,null));};exports['update']=function(_0x158477,_0x2adb60){if(_0x158477[_0xe1bd('0x46')]['id']){delete _0x158477[_0xe1bd('0x46')]['id'];}return db[_0xe1bd('0x2c')][_0xe1bd('0x48')]({'where':{'id':_0x158477[_0xe1bd('0x49')]['id']}})[_0xe1bd('0x24')](handleEntityNotFound(_0x2adb60,null))[_0xe1bd('0x24')](saveUpdates(_0x158477[_0xe1bd('0x46')],null))[_0xe1bd('0x24')](respondWithResult(_0x2adb60,null))[_0xe1bd('0x44')](handleError(_0x2adb60,null));};exports['destroy']=function(_0x4ae916,_0x518ee7){return db[_0xe1bd('0x2c')][_0xe1bd('0x48')]({'where':{'id':_0x4ae916[_0xe1bd('0x49')]['id']}})[_0xe1bd('0x24')](handleEntityNotFound(_0x518ee7,null))[_0xe1bd('0x24')](removeEntity(_0x518ee7,null))['catch'](handleError(_0x518ee7,null));};exports['bulkDestroy']=function(_0x3a3fbc,_0x540c34){return db['AnalyticFieldReport'][_0xe1bd('0x25')]({'where':{'id':_0x3a3fbc[_0xe1bd('0x31')][_0xe1bd('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xe1bd('0x24')](respondWithResult(_0x540c34,0xcc))[_0xe1bd('0x44')](handleError(_0x540c34,null));};exports['addFields']=function(_0x135675,_0x4f9b36,_0x313f21){return db[_0xe1bd('0x4b')][_0xe1bd('0x4c')]({'where':{'id':_0x135675[_0xe1bd('0x49')]['id']}})[_0xe1bd('0x24')](handleEntityNotFound(_0x4f9b36,null))[_0xe1bd('0x24')](function(_0x4340c7){if(_0x4340c7){return db['sequelize']['transaction'](function(_0x4ca6c4){return db['AnalyticFieldReport'][_0xe1bd('0x25')]({'where':{'CustomReportId':_0x135675[_0xe1bd('0x49')]['id']},'transaction':_0x4ca6c4})[_0xe1bd('0x24')](function(_0x4711bf){var _0x492cb5=_[_0xe1bd('0x2b')](_0x135675['body'],function(_0x48556c){delete _0x48556c['id'];_0x48556c['CustomReportId']=_0x135675[_0xe1bd('0x49')]['id'];return _0x48556c;});return db['AnalyticFieldReport'][_0xe1bd('0x47')](_0x492cb5,{'transaction':_0x4ca6c4});});})[_0xe1bd('0x24')](function(){return db[_0xe1bd('0x2c')]['findAll']({'where':{'CustomReportId':_0x135675[_0xe1bd('0x49')]['id']}});});}})[_0xe1bd('0x24')](respondWithResult(_0x4f9b36,null))['catch'](handleError(_0x4f9b36,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9867b66..640d39e 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 _0x35c8=['path','rimraf','./analyticFieldReport.attributes','define','analytics_report_fields','util','api','moment','bluebird'];(function(_0x35d279,_0x3d5688){var _0x12d836=function(_0x4baed9){while(--_0x4baed9){_0x35d279['push'](_0x35d279['shift']());}};_0x12d836(++_0x3d5688);}(_0x35c8,0xa7));var _0x835c=function(_0x55b4bf,_0x41f7a5){_0x55b4bf=_0x55b4bf-0x0;var _0x25c3d1=_0x35c8[_0x55b4bf];return _0x25c3d1;};'use strict';var _=require('lodash');var util=require(_0x835c('0x0'));var logger=require('../../config/logger')(_0x835c('0x1'));var moment=require(_0x835c('0x2'));var BPromise=require(_0x835c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x835c('0x4'));var rimraf=require(_0x835c('0x5'));var config=require('../../config/environment');var attributes=require(_0x835c('0x6'));module['exports']=function(_0x535034,_0x50bbca){return _0x535034[_0x835c('0x7')]('AnalyticFieldReport',attributes,{'tableName':_0x835c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd89c=['rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','api','bluebird','request-promise','path'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xd89c,0x1c8));var _0xcd89=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd89c[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xcd89('0x0'));var util=require(_0xcd89('0x1'));var logger=require('../../config/logger')(_0xcd89('0x2'));var moment=require('moment');var BPromise=require(_0xcd89('0x3'));var rp=require(_0xcd89('0x4'));var fs=require('fs');var path=require(_0xcd89('0x5'));var rimraf=require(_0xcd89('0x6'));var config=require(_0xcd89('0x7'));var attributes=require(_0xcd89('0x8'));module['exports']=function(_0x5354f4,_0x4c9c8c){return _0x5354f4[_0xcd89('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xcd89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index ece207e..8b2a85e 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 _0xa7f8=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x4f64bb,_0x2008e3){var _0x23facf=function(_0x281303){while(--_0x281303){_0x4f64bb['push'](_0x4f64bb['shift']());}};_0x23facf(++_0x2008e3);}(_0xa7f8,0xa7));var _0x8a7f=function(_0xb0acd8,_0x4cac86){_0xb0acd8=_0xb0acd8-0x0;var _0x491d41=_0xa7f8[_0xb0acd8];return _0x491d41;};'use strict';var _=require('lodash');var util=require(_0x8a7f('0x0'));var moment=require(_0x8a7f('0x1'));var BPromise=require(_0x8a7f('0x2'));var rs=require(_0x8a7f('0x3'));var fs=require('fs');var Redis=require(_0x8a7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a7f('0x5'));var logger=require(_0x8a7f('0x6'))(_0x8a7f('0x7'));var config=require(_0x8a7f('0x8'));var jayson=require(_0x8a7f('0x9'));var client=jayson[_0x8a7f('0xa')][_0x8a7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8f3ac,_0x3c4f50,_0x5ea5a8){return new BPromise(function(_0x519509,_0x279a35){return client[_0x8a7f('0xc')](_0x8f3ac,_0x5ea5a8)[_0x8a7f('0xd')](function(_0x14fafc){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x3c4f50,_0x8a7f('0xe'));logger[_0x8a7f('0xf')](_0x8a7f('0x10'),_0x3c4f50,_0x8a7f('0xe'),JSON['stringify'](_0x14fafc));if(_0x14fafc['error']){if(_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x12')]===0x1f4){logger[_0x8a7f('0x11')](_0x8a7f('0x13'),_0x3c4f50,_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);return _0x279a35(_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);}logger[_0x8a7f('0x11')](_0x8a7f('0x13'),_0x3c4f50,_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);return _0x519509(_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);}else{logger[_0x8a7f('0x15')](_0x8a7f('0x13'),_0x3c4f50,_0x8a7f('0xe'));_0x519509(_0x14fafc['result'][_0x8a7f('0x14')]);}})[_0x8a7f('0x16')](function(_0x480963){logger['error'](_0x8a7f('0x13'),_0x3c4f50,_0x480963);_0x279a35(_0x480963);});});} \ No newline at end of file +var _0xd112=['moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x1446fc,_0x13d287){var _0x184ce1=function(_0x607563){while(--_0x607563){_0x1446fc['push'](_0x1446fc['shift']());}};_0x184ce1(++_0x13d287);}(_0xd112,0x91));var _0x2d11=function(_0x26ce19,_0x56cb79){_0x26ce19=_0x26ce19-0x0;var _0x3b923e=_0xd112[_0x26ce19];return _0x3b923e;};'use strict';var _=require(_0x2d11('0x0'));var util=require(_0x2d11('0x1'));var moment=require(_0x2d11('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d11('0x3'));var db=require(_0x2d11('0x4'))['db'];var utils=require(_0x2d11('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d11('0x6'));var jayson=require(_0x2d11('0x7'));var client=jayson['client'][_0x2d11('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18c69c,_0x3f53dc,_0x1208e4){return new BPromise(function(_0xa9b3dc,_0x52eb5f){return client[_0x2d11('0x9')](_0x18c69c,_0x1208e4)[_0x2d11('0xa')](function(_0x317803){logger[_0x2d11('0xb')](_0x2d11('0xc'),_0x3f53dc,_0x2d11('0xd'));logger[_0x2d11('0xe')](_0x2d11('0xf'),_0x3f53dc,_0x2d11('0xd'),JSON[_0x2d11('0x10')](_0x317803));if(_0x317803[_0x2d11('0x11')]){if(_0x317803[_0x2d11('0x11')][_0x2d11('0x12')]===0x1f4){logger[_0x2d11('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f53dc,_0x317803[_0x2d11('0x11')][_0x2d11('0x13')]);return _0x52eb5f(_0x317803[_0x2d11('0x11')][_0x2d11('0x13')]);}logger['error'](_0x2d11('0xc'),_0x3f53dc,_0x317803[_0x2d11('0x11')]['message']);return _0xa9b3dc(_0x317803[_0x2d11('0x11')][_0x2d11('0x13')]);}else{logger[_0x2d11('0xb')](_0x2d11('0xc'),_0x3f53dc,'request\x20sent');_0xa9b3dc(_0x317803['result']['message']);}})[_0x2d11('0x14')](function(_0x7a7238){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3f53dc,_0x7a7238);_0x52eb5f(_0x7a7238);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 5b040a5..03afa73 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x1e6f9a,_0x37c6d8){var _0x2b65b0=function(_0xfc8c6){while(--_0xfc8c6){_0x1e6f9a['push'](_0x1e6f9a['shift']());}};_0x2b65b0(++_0x37c6d8);}(_0x7217,0x19e));var _0x7721=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x7217[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x531a94,_0xbf2864){var _0x4ad3e1=function(_0x5e98b4){while(--_0x5e98b4){_0x531a94['push'](_0x531a94['shift']());}};_0x4ad3e1(++_0xbf2864);}(_0x7217,0x19e));var _0x7721=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7217[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index d2569c3..c42e5a6 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 _0xdd4f=['sequelize','STRING','TEXT'];(function(_0x401902,_0x2cde5f){var _0x3fb43e=function(_0x31d8c2){while(--_0x31d8c2){_0x401902['push'](_0x401902['shift']());}};_0x3fb43e(++_0x2cde5f);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5f4cd7,_0x5add8){_0x5f4cd7=_0x5f4cd7-0x0;var _0x130f59=_0xdd4f[_0x5f4cd7];return _0x130f59;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xfdd4('0x1')]},'metric':{'type':Sequelize[_0xfdd4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc434=['STRING','name','TEXT','sequelize','exports'];(function(_0x45cb02,_0x1f26d4){var _0x333239=function(_0x41f9fa){while(--_0x41f9fa){_0x45cb02['push'](_0x45cb02['shift']());}};_0x333239(++_0x1f26d4);}(_0xc434,0x16b));var _0x4c43=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc434[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x4c43('0x0'));module[_0x4c43('0x1')]={'name':{'type':Sequelize[_0x4c43('0x2')],'allowNull':![],'unique':_0x4c43('0x3')},'table':{'type':Sequelize[_0x4c43('0x2')]},'metric':{'type':Sequelize[_0x4c43('0x4')]},'description':{'type':Sequelize[_0x4c43('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5a4e530..f30be4f 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 _0xf0cf=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','save','then','destroy','get','Metrics','UserProfileResource','error','name','send','AnalyticMetric','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','api'];(function(_0xd649c1,_0x328221){var _0x17a73f=function(_0x5aad7e){while(--_0x5aad7e){_0xd649c1['push'](_0xd649c1['shift']());}};_0x17a73f(++_0x328221);}(_0xf0cf,0x1e5));var _0xff0c=function(_0x3a59e6,_0x16069a){_0x3a59e6=_0x3a59e6-0x0;var _0x5550b1=_0xf0cf[_0x3a59e6];return _0x5550b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff0c('0x0'));var rimraf=require(_0xff0c('0x1'));var zipdir=require(_0xff0c('0x2'));var jsonpatch=require(_0xff0c('0x3'));var rp=require(_0xff0c('0x4'));var moment=require(_0xff0c('0x5'));var BPromise=require(_0xff0c('0x6'));var Mustache=require(_0xff0c('0x7'));var util=require(_0xff0c('0x8'));var path=require(_0xff0c('0x9'));var sox=require(_0xff0c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xff0c('0xb'));var jsforce=require(_0xff0c('0xc'));var deskjs=require(_0xff0c('0xd'));var toCsv=require(_0xff0c('0xe'));var querystring=require('querystring');var Papa=require(_0xff0c('0xf'));var Redis=require('ioredis');var authService=require(_0xff0c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff0c('0x11'));var logger=require('../../config/logger')(_0xff0c('0x12'));var utils=require(_0xff0c('0x13'));var config=require(_0xff0c('0x14'));var licenseUtil=require(_0xff0c('0x15'));var db=require(_0xff0c('0x16'))['db'];function respondWithStatusCode(_0x2101e1,_0x3ddbd0){_0x3ddbd0=_0x3ddbd0||0xcc;return function(_0x44068f){if(_0x44068f){return _0x2101e1[_0xff0c('0x17')](_0x3ddbd0);}return _0x2101e1[_0xff0c('0x18')](_0x3ddbd0)[_0xff0c('0x19')]();};}function respondWithResult(_0x64f5da,_0x14d93d){_0x14d93d=_0x14d93d||0xc8;return function(_0x17020a){if(_0x17020a){return _0x64f5da[_0xff0c('0x18')](_0x14d93d)[_0xff0c('0x1a')](_0x17020a);}};}function respondWithFilteredResult(_0x4f537c,_0x4487ba){return function(_0x37d3a1){if(_0x37d3a1){var _0x5d6c6d=_0x37d3a1[_0xff0c('0x1b')],_0xbe055b=_0x4487ba[_0xff0c('0x1c')],_0x2154f2=_0x4487ba['offset']+_0x4487ba['limit'],_0x2d3cd1;if(_0x2154f2>=_0x5d6c6d){_0x2154f2=_0x5d6c6d;_0x2d3cd1=0xc8;}else{_0x2d3cd1=0xce;}_0x4f537c['status'](_0x2d3cd1);return _0x4f537c['set']('Content-Range',_0xbe055b+'-'+_0x2154f2+'/'+_0x5d6c6d)[_0xff0c('0x1a')](_0x37d3a1);}return null;};}function patchUpdates(_0x144574){return function(_0x25aee6){try{jsonpatch[_0xff0c('0x1d')](_0x25aee6,_0x144574,!![]);}catch(_0x234c98){return BPromise['reject'](_0x234c98);}return _0x25aee6[_0xff0c('0x1e')]();};}function saveUpdates(_0x454057,_0x525502){return function(_0x55ffd4){if(_0x55ffd4){return _0x55ffd4['update'](_0x454057)[_0xff0c('0x1f')](function(_0x4ea3a){return _0x4ea3a;});}return null;};}function removeEntity(_0x14ef08,_0x50eb8e){return function(_0x253e18){if(_0x253e18){return _0x253e18[_0xff0c('0x20')]()['then'](function(){var _0x21f60a=_0x253e18[_0xff0c('0x21')]({'plain':!![]});var _0x2f3c7a=_0xff0c('0x22');return db[_0xff0c('0x23')][_0xff0c('0x20')]({'where':{'type':_0x2f3c7a,'resourceId':_0x21f60a['id']}})[_0xff0c('0x1f')](function(){return _0x253e18;});})[_0xff0c('0x1f')](function(){_0x14ef08[_0xff0c('0x18')](0xcc)[_0xff0c('0x19')]();});}};}function handleEntityNotFound(_0x3b0d88,_0x38fac1){return function(_0x113e21){if(!_0x113e21){_0x3b0d88['sendStatus'](0x194);}return _0x113e21;};}function handleError(_0x4782b5,_0x20a520){_0x20a520=_0x20a520||0x1f4;return function(_0x29c376){logger[_0xff0c('0x24')](_0x29c376['stack']);if(_0x29c376[_0xff0c('0x25')]){delete _0x29c376[_0xff0c('0x25')];}_0x4782b5['status'](_0x20a520)[_0xff0c('0x26')](_0x29c376);};}exports['index']=function(_0x2eb28a,_0x28f179){var _0xb680f5={},_0xe61ea7={},_0x25ed74={'count':0x0,'rows':[]};var _0x5f315b=_['map'](db[_0xff0c('0x27')]['rawAttributes'],function(_0x1077da){return{'name':_0x1077da['fieldName'],'type':_0x1077da[_0xff0c('0x28')][_0xff0c('0x29')]};});_0xe61ea7[_0xff0c('0x2a')]=_[_0xff0c('0x2b')](_0x5f315b,_0xff0c('0x25'));_0xe61ea7[_0xff0c('0x2c')]=_[_0xff0c('0x2d')](_0x2eb28a[_0xff0c('0x2c')]);_0xe61ea7[_0xff0c('0x2e')]=_['intersection'](_0xe61ea7[_0xff0c('0x2a')],_0xe61ea7[_0xff0c('0x2c')]);_0xb680f5[_0xff0c('0x2f')]=_[_0xff0c('0x30')](_0xe61ea7[_0xff0c('0x2a')],qs[_0xff0c('0x31')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x31')]));_0xb680f5[_0xff0c('0x2f')]=_0xb680f5[_0xff0c('0x2f')]['length']?_0xb680f5[_0xff0c('0x2f')]:_0xe61ea7[_0xff0c('0x2a')];if(!_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x32')]('nolimit')){_0xb680f5[_0xff0c('0x33')]=qs[_0xff0c('0x33')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x33')]);_0xb680f5[_0xff0c('0x1c')]=qs[_0xff0c('0x1c')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x1c')]);}_0xb680f5['order']=qs[_0xff0c('0x34')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x34')]);_0xb680f5['where']=qs[_0xff0c('0x2e')](_[_0xff0c('0x35')](_0x2eb28a[_0xff0c('0x2c')],_0xe61ea7[_0xff0c('0x2e')]),_0x5f315b);if(_0x2eb28a['query'][_0xff0c('0x36')]){_0xb680f5[_0xff0c('0x37')]=_[_0xff0c('0x38')](_0xb680f5['where'],{'$or':_[_0xff0c('0x2b')](_0x5f315b,function(_0x52b9fb){if(_0x52b9fb['type']!==_0xff0c('0x39')){var _0x21e5be={};_0x21e5be[_0x52b9fb[_0xff0c('0x25')]]={'$like':'%'+_0x2eb28a['query'][_0xff0c('0x36')]+'%'};return _0x21e5be;}})});}_0xb680f5=_[_0xff0c('0x38')]({},_0xb680f5,_0x2eb28a[_0xff0c('0x3a')]);var _0x4990f8={'where':_0xb680f5['where']};return db[_0xff0c('0x27')]['count'](_0x4990f8)[_0xff0c('0x1f')](function(_0x2ac71){_0x25ed74[_0xff0c('0x1b')]=_0x2ac71;if(_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x3b')]){_0xb680f5[_0xff0c('0x3c')]=[{'all':!![]}];}return db[_0xff0c('0x27')]['findAll'](_0xb680f5);})[_0xff0c('0x1f')](function(_0x273bd5){_0x25ed74[_0xff0c('0x3d')]=_0x273bd5;return _0x25ed74;})[_0xff0c('0x1f')](respondWithFilteredResult(_0x28f179,_0xb680f5))[_0xff0c('0x3e')](handleError(_0x28f179,null));};exports[_0xff0c('0x3f')]=function(_0x89f244,_0x45a729){var _0x28679f={'raw':!![],'where':{'id':_0x89f244[_0xff0c('0x40')]['id']}},_0x4be10b={};_0x4be10b['model']=_[_0xff0c('0x2d')](db[_0xff0c('0x27')]['rawAttributes']);_0x4be10b['query']=_[_0xff0c('0x2d')](_0x89f244[_0xff0c('0x2c')]);_0x4be10b[_0xff0c('0x2e')]=_[_0xff0c('0x30')](_0x4be10b[_0xff0c('0x2a')],_0x4be10b[_0xff0c('0x2c')]);_0x28679f[_0xff0c('0x2f')]=_[_0xff0c('0x30')](_0x4be10b[_0xff0c('0x2a')],qs['fields'](_0x89f244[_0xff0c('0x2c')]['fields']));_0x28679f['attributes']=_0x28679f[_0xff0c('0x2f')]['length']?_0x28679f[_0xff0c('0x2f')]:_0x4be10b['model'];if(_0x89f244[_0xff0c('0x2c')][_0xff0c('0x3b')]){_0x28679f[_0xff0c('0x3c')]=[{'all':!![]}];}_0x28679f=_[_0xff0c('0x38')]({},_0x28679f,_0x89f244[_0xff0c('0x3a')]);return db[_0xff0c('0x27')][_0xff0c('0x41')](_0x28679f)[_0xff0c('0x1f')](handleEntityNotFound(_0x45a729,null))[_0xff0c('0x1f')](respondWithResult(_0x45a729,null))['catch'](handleError(_0x45a729,null));};exports[_0xff0c('0x42')]=function(_0x5b9bb6,_0x1ee54d){return db[_0xff0c('0x27')][_0xff0c('0x42')](_0x5b9bb6[_0xff0c('0x43')],{})[_0xff0c('0x1f')](function(_0x408c96){var _0x4a96db=_0x5b9bb6[_0xff0c('0x44')][_0xff0c('0x21')]({'plain':!![]});if(!_0x4a96db)throw new Error(_0xff0c('0x45'));if(_0x4a96db['role']===_0xff0c('0x44')){var _0x43a432=_0x408c96[_0xff0c('0x21')]({'plain':!![]});var _0x130b60=_0xff0c('0x22');return db[_0xff0c('0x46')][_0xff0c('0x41')]({'where':{'name':_0x130b60,'userProfileId':_0x4a96db['userProfileId']},'raw':!![]})[_0xff0c('0x1f')](function(_0x319deb){if(_0x319deb&&_0x319deb['autoAssociation']===0x0){return db[_0xff0c('0x23')][_0xff0c('0x42')]({'name':_0x43a432[_0xff0c('0x25')],'resourceId':_0x43a432['id'],'type':_0x319deb[_0xff0c('0x25')],'sectionId':_0x319deb['id']},{})[_0xff0c('0x1f')](function(){return _0x408c96;});}else{return _0x408c96;}})[_0xff0c('0x3e')](function(_0x20be36){logger[_0xff0c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20be36);throw _0x20be36;});}return _0x408c96;})[_0xff0c('0x1f')](respondWithResult(_0x1ee54d,0xc9))[_0xff0c('0x3e')](handleError(_0x1ee54d,null));};exports[_0xff0c('0x47')]=function(_0x23610c,_0x44743c){if(_0x23610c[_0xff0c('0x43')]['id']){delete _0x23610c[_0xff0c('0x43')]['id'];}return db[_0xff0c('0x27')][_0xff0c('0x41')]({'where':{'id':_0x23610c[_0xff0c('0x40')]['id']}})['then'](handleEntityNotFound(_0x44743c,null))['then'](saveUpdates(_0x23610c[_0xff0c('0x43')],null))[_0xff0c('0x1f')](respondWithResult(_0x44743c,null))['catch'](handleError(_0x44743c,null));};exports[_0xff0c('0x20')]=function(_0x59d9fa,_0x184108){return db[_0xff0c('0x27')]['find']({'where':{'id':_0x59d9fa['params']['id']}})[_0xff0c('0x1f')](handleEntityNotFound(_0x184108,null))['then'](removeEntity(_0x184108,null))[_0xff0c('0x3e')](handleError(_0x184108,null));}; \ No newline at end of file +var _0x2723=['apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x20ce85,_0x2c4499){var _0x2f174d=function(_0x595460){while(--_0x595460){_0x20ce85['push'](_0x20ce85['shift']());}};_0x2f174d(++_0x2c4499);}(_0x2723,0x18e));var _0x3272=function(_0x4e7971,_0x4e9656){_0x4e7971=_0x4e7971-0x0;var _0x54a675=_0x2723[_0x4e7971];return _0x54a675;};'use strict';var pdf=require(_0x3272('0x0'));var emlformat=require(_0x3272('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3272('0x2'));var jsonpatch=require(_0x3272('0x3'));var rp=require(_0x3272('0x4'));var moment=require(_0x3272('0x5'));var BPromise=require(_0x3272('0x6'));var Mustache=require(_0x3272('0x7'));var util=require(_0x3272('0x8'));var path=require(_0x3272('0x9'));var sox=require(_0x3272('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3272('0xb'));var squel=require(_0x3272('0xc'));var crypto=require(_0x3272('0xd'));var jsforce=require(_0x3272('0xe'));var deskjs=require(_0x3272('0xf'));var toCsv=require(_0x3272('0x10'));var querystring=require('querystring');var Papa=require(_0x3272('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3272('0x12'));var as=require(_0x3272('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3272('0x14'))(_0x3272('0x15'));var utils=require('../../config/utils');var config=require(_0x3272('0x16'));var licenseUtil=require(_0x3272('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593ca0,_0x15c224){_0x15c224=_0x15c224||0xcc;return function(_0x496064){if(_0x496064){return _0x593ca0['sendStatus'](_0x15c224);}return _0x593ca0[_0x3272('0x18')](_0x15c224)[_0x3272('0x19')]();};}function respondWithResult(_0x25984b,_0x4b4537){_0x4b4537=_0x4b4537||0xc8;return function(_0x553cef){if(_0x553cef){return _0x25984b[_0x3272('0x18')](_0x4b4537)[_0x3272('0x1a')](_0x553cef);}};}function respondWithFilteredResult(_0x9b438,_0x38fef3){return function(_0x226b9f){if(_0x226b9f){var _0x3fd4e7=_0x226b9f[_0x3272('0x1b')],_0x534bfd=_0x38fef3['offset'],_0x56d03b=_0x38fef3[_0x3272('0x1c')]+_0x38fef3[_0x3272('0x1d')],_0xf44614;if(_0x56d03b>=_0x3fd4e7){_0x56d03b=_0x3fd4e7;_0xf44614=0xc8;}else{_0xf44614=0xce;}_0x9b438[_0x3272('0x18')](_0xf44614);return _0x9b438[_0x3272('0x1e')](_0x3272('0x1f'),_0x534bfd+'-'+_0x56d03b+'/'+_0x3fd4e7)[_0x3272('0x1a')](_0x226b9f);}return null;};}function patchUpdates(_0x191252){return function(_0x3222a9){try{jsonpatch[_0x3272('0x20')](_0x3222a9,_0x191252,!![]);}catch(_0x1392eb){return BPromise[_0x3272('0x21')](_0x1392eb);}return _0x3222a9[_0x3272('0x22')]();};}function saveUpdates(_0x2ee503,_0x170378){return function(_0x513c4d){if(_0x513c4d){return _0x513c4d[_0x3272('0x23')](_0x2ee503)[_0x3272('0x24')](function(_0x520ff0){return _0x520ff0;});}return null;};}function removeEntity(_0x532e89,_0x34d46f){return function(_0x3ed390){if(_0x3ed390){return _0x3ed390[_0x3272('0x25')]()[_0x3272('0x24')](function(){var _0x5a9aa0=_0x3ed390[_0x3272('0x26')]({'plain':!![]});var _0x17581a=_0x3272('0x27');return db[_0x3272('0x28')]['destroy']({'where':{'type':_0x17581a,'resourceId':_0x5a9aa0['id']}})[_0x3272('0x24')](function(){return _0x3ed390;});})['then'](function(){_0x532e89[_0x3272('0x18')](0xcc)[_0x3272('0x19')]();});}};}function handleEntityNotFound(_0x104184,_0x18ea1f){return function(_0x50c3d8){if(!_0x50c3d8){_0x104184[_0x3272('0x29')](0x194);}return _0x50c3d8;};}function handleError(_0x4b6cad,_0x2187a6){_0x2187a6=_0x2187a6||0x1f4;return function(_0x4b9b4b){logger[_0x3272('0x2a')](_0x4b9b4b[_0x3272('0x2b')]);if(_0x4b9b4b[_0x3272('0x2c')]){delete _0x4b9b4b[_0x3272('0x2c')];}_0x4b6cad[_0x3272('0x18')](_0x2187a6)[_0x3272('0x2d')](_0x4b9b4b);};}exports[_0x3272('0x2e')]=function(_0x3776eb,_0x47af9a){var _0x2fd0d2={},_0x2f2540={},_0x386370={'count':0x0,'rows':[]};var _0x2621d1=_[_0x3272('0x2f')](db['AnalyticMetric'][_0x3272('0x30')],function(_0x1d1ab3){return{'name':_0x1d1ab3[_0x3272('0x31')],'type':_0x1d1ab3[_0x3272('0x32')]['key']};});_0x2f2540['model']=_[_0x3272('0x2f')](_0x2621d1,_0x3272('0x2c'));_0x2f2540['query']=_[_0x3272('0x33')](_0x3776eb['query']);_0x2f2540[_0x3272('0x34')]=_[_0x3272('0x35')](_0x2f2540[_0x3272('0x36')],_0x2f2540[_0x3272('0x37')]);_0x2fd0d2[_0x3272('0x38')]=_[_0x3272('0x35')](_0x2f2540[_0x3272('0x36')],qs[_0x3272('0x39')](_0x3776eb[_0x3272('0x37')]['fields']));_0x2fd0d2['attributes']=_0x2fd0d2[_0x3272('0x38')][_0x3272('0x3a')]?_0x2fd0d2[_0x3272('0x38')]:_0x2f2540['model'];if(!_0x3776eb['query'][_0x3272('0x3b')](_0x3272('0x3c'))){_0x2fd0d2[_0x3272('0x1d')]=qs[_0x3272('0x1d')](_0x3776eb['query'][_0x3272('0x1d')]);_0x2fd0d2['offset']=qs[_0x3272('0x1c')](_0x3776eb['query'][_0x3272('0x1c')]);}_0x2fd0d2[_0x3272('0x3d')]=qs[_0x3272('0x3e')](_0x3776eb['query'][_0x3272('0x3e')]);_0x2fd0d2[_0x3272('0x3f')]=qs[_0x3272('0x34')](_[_0x3272('0x40')](_0x3776eb[_0x3272('0x37')],_0x2f2540[_0x3272('0x34')]),_0x2621d1);if(_0x3776eb[_0x3272('0x37')][_0x3272('0x41')]){_0x2fd0d2[_0x3272('0x3f')]=_[_0x3272('0x42')](_0x2fd0d2[_0x3272('0x3f')],{'$or':_[_0x3272('0x2f')](_0x2621d1,function(_0x5a2194){if(_0x5a2194[_0x3272('0x32')]!==_0x3272('0x43')){var _0x12657b={};_0x12657b[_0x5a2194[_0x3272('0x2c')]]={'$like':'%'+_0x3776eb[_0x3272('0x37')][_0x3272('0x41')]+'%'};return _0x12657b;}})});}_0x2fd0d2=_[_0x3272('0x42')]({},_0x2fd0d2,_0x3776eb[_0x3272('0x44')]);var _0x3f3fc4={'where':_0x2fd0d2[_0x3272('0x3f')]};return db[_0x3272('0x45')]['count'](_0x3f3fc4)[_0x3272('0x24')](function(_0x7abcb5){_0x386370[_0x3272('0x1b')]=_0x7abcb5;if(_0x3776eb[_0x3272('0x37')][_0x3272('0x46')]){_0x2fd0d2[_0x3272('0x47')]=[{'all':!![]}];}return db[_0x3272('0x45')][_0x3272('0x48')](_0x2fd0d2);})['then'](function(_0xe5c134){_0x386370[_0x3272('0x49')]=_0xe5c134;return _0x386370;})[_0x3272('0x24')](respondWithFilteredResult(_0x47af9a,_0x2fd0d2))['catch'](handleError(_0x47af9a,null));};exports[_0x3272('0x4a')]=function(_0x326a9c,_0x1f1864){var _0x10ce12={'raw':!![],'where':{'id':_0x326a9c[_0x3272('0x4b')]['id']}},_0x32f3de={};_0x32f3de[_0x3272('0x36')]=_[_0x3272('0x33')](db[_0x3272('0x45')]['rawAttributes']);_0x32f3de['query']=_[_0x3272('0x33')](_0x326a9c[_0x3272('0x37')]);_0x32f3de[_0x3272('0x34')]=_[_0x3272('0x35')](_0x32f3de[_0x3272('0x36')],_0x32f3de[_0x3272('0x37')]);_0x10ce12[_0x3272('0x38')]=_[_0x3272('0x35')](_0x32f3de[_0x3272('0x36')],qs[_0x3272('0x39')](_0x326a9c['query']['fields']));_0x10ce12[_0x3272('0x38')]=_0x10ce12[_0x3272('0x38')]['length']?_0x10ce12[_0x3272('0x38')]:_0x32f3de[_0x3272('0x36')];if(_0x326a9c[_0x3272('0x37')]['includeAll']){_0x10ce12['include']=[{'all':!![]}];}_0x10ce12=_['merge']({},_0x10ce12,_0x326a9c[_0x3272('0x44')]);return db[_0x3272('0x45')][_0x3272('0x4c')](_0x10ce12)[_0x3272('0x24')](handleEntityNotFound(_0x1f1864,null))[_0x3272('0x24')](respondWithResult(_0x1f1864,null))[_0x3272('0x4d')](handleError(_0x1f1864,null));};exports['create']=function(_0x53226b,_0x4224ed){return db[_0x3272('0x45')][_0x3272('0x4e')](_0x53226b[_0x3272('0x4f')],{})[_0x3272('0x24')](function(_0x470972){var _0xf5e8dd=_0x53226b[_0x3272('0x50')][_0x3272('0x26')]({'plain':!![]});if(!_0xf5e8dd)throw new Error(_0x3272('0x51'));if(_0xf5e8dd[_0x3272('0x52')]===_0x3272('0x50')){var _0x40c003=_0x470972['get']({'plain':!![]});var _0x87f91d=_0x3272('0x27');return db[_0x3272('0x53')][_0x3272('0x4c')]({'where':{'name':_0x87f91d,'userProfileId':_0xf5e8dd[_0x3272('0x54')]},'raw':!![]})[_0x3272('0x24')](function(_0x181e31){if(_0x181e31&&_0x181e31[_0x3272('0x55')]===0x0){return db['UserProfileResource'][_0x3272('0x4e')]({'name':_0x40c003[_0x3272('0x2c')],'resourceId':_0x40c003['id'],'type':_0x181e31[_0x3272('0x2c')],'sectionId':_0x181e31['id']},{})[_0x3272('0x24')](function(){return _0x470972;});}else{return _0x470972;}})[_0x3272('0x4d')](function(_0x11cd5b){logger[_0x3272('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11cd5b);throw _0x11cd5b;});}return _0x470972;})[_0x3272('0x24')](respondWithResult(_0x4224ed,0xc9))[_0x3272('0x4d')](handleError(_0x4224ed,null));};exports['update']=function(_0x32987a,_0x574500){if(_0x32987a['body']['id']){delete _0x32987a[_0x3272('0x4f')]['id'];}return db[_0x3272('0x45')][_0x3272('0x4c')]({'where':{'id':_0x32987a['params']['id']}})[_0x3272('0x24')](handleEntityNotFound(_0x574500,null))[_0x3272('0x24')](saveUpdates(_0x32987a['body'],null))[_0x3272('0x24')](respondWithResult(_0x574500,null))[_0x3272('0x4d')](handleError(_0x574500,null));};exports[_0x3272('0x25')]=function(_0x3df618,_0x3b35b8){return db[_0x3272('0x45')][_0x3272('0x4c')]({'where':{'id':_0x3df618[_0x3272('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b35b8,null))[_0x3272('0x24')](removeEntity(_0x3b35b8,null))[_0x3272('0x4d')](handleError(_0x3b35b8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 100a754..31953ce 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 _0x56d8=['AnalyticMetric','lodash','util','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x56d8,0x160));var _0x856d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x56d8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x856d('0x0'));var util=require(_0x856d('0x1'));var logger=require('../../config/logger')(_0x856d('0x2'));var moment=require(_0x856d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x856d('0x4'));var rimraf=require(_0x856d('0x5'));var config=require(_0x856d('0x6'));var attributes=require(_0x856d('0x7'));module['exports']=function(_0x3095be,_0xe2957d){return _0x3095be['define'](_0x856d('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0211=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x0211,0xa5));var _0x1021=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0211[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x1021('0x0'));var util=require(_0x1021('0x1'));var logger=require('../../config/logger')(_0x1021('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1021('0x3'));var fs=require('fs');var path=require(_0x1021('0x4'));var rimraf=require(_0x1021('0x5'));var config=require(_0x1021('0x6'));var attributes=require(_0x1021('0x7'));module[_0x1021('0x8')]=function(_0x221dc6,_0x4e08ca){return _0x221dc6['define'](_0x1021('0x9'),attributes,{'tableName':_0x1021('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 006f67d..45bf999 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 _0x239d=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x267f5b,_0x198056){var _0x5a2dc3=function(_0xfb3d78){while(--_0xfb3d78){_0x267f5b['push'](_0x267f5b['shift']());}};_0x5a2dc3(++_0x198056);}(_0x239d,0x91));var _0xd239=function(_0x2b734f,_0x426aa8){_0x2b734f=_0x2b734f-0x0;var _0xa9700=_0x239d[_0x2b734f];return _0xa9700;};'use strict';var _=require('lodash');var util=require(_0xd239('0x0'));var moment=require('moment');var BPromise=require(_0xd239('0x1'));var rs=require(_0xd239('0x2'));var fs=require('fs');var Redis=require(_0xd239('0x3'));var db=require(_0xd239('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd239('0x5'));var jayson=require(_0xd239('0x6'));var client=jayson[_0xd239('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf01ea7,_0x4b814f,_0x5a227f){return new BPromise(function(_0x48f30c,_0x5cd8e1){return client[_0xd239('0x8')](_0xf01ea7,_0x5a227f)[_0xd239('0x9')](function(_0x2805de){logger[_0xd239('0xa')](_0xd239('0xb'),_0x4b814f,_0xd239('0xc'));logger['debug'](_0xd239('0xd'),_0x4b814f,_0xd239('0xc'),JSON[_0xd239('0xe')](_0x2805de));if(_0x2805de[_0xd239('0xf')]){if(_0x2805de[_0xd239('0xf')][_0xd239('0x10')]===0x1f4){logger[_0xd239('0xf')](_0xd239('0xb'),_0x4b814f,_0x2805de['error'][_0xd239('0x11')]);return _0x5cd8e1(_0x2805de[_0xd239('0xf')]['message']);}logger[_0xd239('0xf')](_0xd239('0xb'),_0x4b814f,_0x2805de[_0xd239('0xf')][_0xd239('0x11')]);return _0x48f30c(_0x2805de['error'][_0xd239('0x11')]);}else{logger['info'](_0xd239('0xb'),_0x4b814f,_0xd239('0xc'));_0x48f30c(_0x2805de[_0xd239('0x12')][_0xd239('0x11')]);}})[_0xd239('0x13')](function(_0x51e8c9){logger[_0xd239('0xf')](_0xd239('0xb'),_0x4b814f,_0x51e8c9);_0x5cd8e1(_0x51e8c9);});});} \ No newline at end of file +var _0x6f91=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x686273,_0x456bed){var _0x34b0a6=function(_0x458a06){while(--_0x458a06){_0x686273['push'](_0x686273['shift']());}};_0x34b0a6(++_0x456bed);}(_0x6f91,0xac));var _0x16f9=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x6f91[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0x16f9('0x0'));var util=require(_0x16f9('0x1'));var moment=require(_0x16f9('0x2'));var BPromise=require(_0x16f9('0x3'));var rs=require(_0x16f9('0x4'));var fs=require('fs');var Redis=require(_0x16f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16f9('0x6'))(_0x16f9('0x7'));var config=require(_0x16f9('0x8'));var jayson=require(_0x16f9('0x9'));var client=jayson['client'][_0x16f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15ee4e,_0x4ddd49,_0x28207a){return new BPromise(function(_0x23935c,_0x4f33ca){return client[_0x16f9('0xb')](_0x15ee4e,_0x28207a)[_0x16f9('0xc')](function(_0x449d76){logger[_0x16f9('0xd')](_0x16f9('0xe'),_0x4ddd49,'request\x20sent');logger[_0x16f9('0xf')](_0x16f9('0x10'),_0x4ddd49,_0x16f9('0x11'),JSON[_0x16f9('0x12')](_0x449d76));if(_0x449d76['error']){if(_0x449d76[_0x16f9('0x13')][_0x16f9('0x14')]===0x1f4){logger[_0x16f9('0x13')](_0x16f9('0xe'),_0x4ddd49,_0x449d76['error']['message']);return _0x4f33ca(_0x449d76[_0x16f9('0x13')]['message']);}logger['error'](_0x16f9('0xe'),_0x4ddd49,_0x449d76['error'][_0x16f9('0x15')]);return _0x23935c(_0x449d76['error']['message']);}else{logger[_0x16f9('0xd')](_0x16f9('0xe'),_0x4ddd49,_0x16f9('0x11'));_0x23935c(_0x449d76['result'][_0x16f9('0x15')]);}})['catch'](function(_0x260252){logger[_0x16f9('0x13')](_0x16f9('0xe'),_0x4ddd49,_0x260252);_0x4f33ca(_0x260252);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 48cba4a..5724014 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x330ea6,_0x2dcfd1){var _0x5d1210=function(_0x1dcd53){while(--_0x1dcd53){_0x330ea6['push'](_0x330ea6['shift']());}};_0x5d1210(++_0x2dcfd1);}(_0x524e,0x15e));var _0xe524=function(_0x585e91,_0x570921){_0x585e91=_0x585e91-0x0;var _0xdd47ef=_0x524e[_0x585e91];return _0xdd47ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0xda19=['post','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x214db9,_0x203265){var _0x59601c=function(_0x586bf5){while(--_0x586bf5){_0x214db9['push'](_0x214db9['shift']());}};_0x59601c(++_0x203265);}(_0xda19,0xd5));var _0x9da1=function(_0x485f66,_0x17840c){_0x485f66=_0x485f66-0x0;var _0x1ba707=_0xda19[_0x485f66];return _0x1ba707;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9da1('0x9'),auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);module[_0x9da1('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 8fd393e..643c362 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 _0x5827=['exports','TEXT','sequelize'];(function(_0x58c608,_0x16f6df){var _0x4fb8aa=function(_0xcc6b8d){while(--_0xcc6b8d){_0x58c608['push'](_0x58c608['shift']());}};_0x4fb8aa(++_0x16f6df);}(_0x5827,0x149));var _0x7582=function(_0x21024d,_0x25a982){_0x21024d=_0x21024d-0x0;var _0x1f8aff=_0x5827[_0x21024d];return _0x1f8aff;};'use strict';var Sequelize=require(_0x7582('0x0'));module[_0x7582('0x1')]={'tree':{'type':Sequelize[_0x7582('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1bbf=['TEXT','sequelize','exports'];(function(_0x32db0f,_0x4e61f1){var _0x582328=function(_0x44bb85){while(--_0x44bb85){_0x32db0f['push'](_0x32db0f['shift']());}};_0x582328(++_0x4e61f1);}(_0x1bbf,0x1ed));var _0xf1bb=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x1bbf[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0xf1bb('0x0'));module[_0xf1bb('0x1')]={'tree':{'type':Sequelize[_0xf1bb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index fdfa14d..4889216 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 _0x1c8a=['set','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','AnalyticTreeReport','includeAll','include','findAll','show','params','options','create','body','find','catch','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','limit'];(function(_0x47f10a,_0x443364){var _0x18c116=function(_0x27f6b4){while(--_0x27f6b4){_0x47f10a['push'](_0x47f10a['shift']());}};_0x18c116(++_0x443364);}(_0x1c8a,0x6e));var _0xa1c8=function(_0x1716ac,_0x245897){_0x1716ac=_0x1716ac-0x0;var _0xa54aaa=_0x1c8a[_0x1716ac];return _0xa54aaa;};'use strict';var pdf=require(_0xa1c8('0x0'));var emlformat=require(_0xa1c8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa1c8('0x2'));var rp=require(_0xa1c8('0x3'));var moment=require(_0xa1c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa1c8('0x5'));var util=require(_0xa1c8('0x6'));var path=require('path');var sox=require(_0xa1c8('0x7'));var csv=require('to-csv');var ejs=require(_0xa1c8('0x8'));var fs=require('fs');var _=require(_0xa1c8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa1c8('0xa'));var toCsv=require(_0xa1c8('0xb'));var querystring=require(_0xa1c8('0xc'));var Papa=require(_0xa1c8('0xd'));var Redis=require(_0xa1c8('0xe'));var authService=require(_0xa1c8('0xf'));var qs=require(_0xa1c8('0x10'));var as=require(_0xa1c8('0x11'));var hardwareService=require(_0xa1c8('0x12'));var logger=require(_0xa1c8('0x13'))(_0xa1c8('0x14'));var utils=require(_0xa1c8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x16'));var db=require(_0xa1c8('0x17'))['db'];function respondWithStatusCode(_0x7a2a7d,_0x39f132){_0x39f132=_0x39f132||0xcc;return function(_0x1807a3){if(_0x1807a3){return _0x7a2a7d[_0xa1c8('0x18')](_0x39f132);}return _0x7a2a7d['status'](_0x39f132)[_0xa1c8('0x19')]();};}function respondWithResult(_0x334ca5,_0x1137e3){_0x1137e3=_0x1137e3||0xc8;return function(_0x2307b9){if(_0x2307b9){return _0x334ca5[_0xa1c8('0x1a')](_0x1137e3)[_0xa1c8('0x1b')](_0x2307b9);}};}function respondWithFilteredResult(_0x529465,_0xd2def7){return function(_0x454995){if(_0x454995){var _0x38e171=_0x454995[_0xa1c8('0x1c')],_0x1ecd2e=_0xd2def7['offset'],_0x4b9cf5=_0xd2def7['offset']+_0xd2def7[_0xa1c8('0x1d')],_0x4ee437;if(_0x4b9cf5>=_0x38e171){_0x4b9cf5=_0x38e171;_0x4ee437=0xc8;}else{_0x4ee437=0xce;}_0x529465[_0xa1c8('0x1a')](_0x4ee437);return _0x529465[_0xa1c8('0x1e')]('Content-Range',_0x1ecd2e+'-'+_0x4b9cf5+'/'+_0x38e171)[_0xa1c8('0x1b')](_0x454995);}return null;};}function patchUpdates(_0xa05cd1){return function(_0x138f07){try{jsonpatch['apply'](_0x138f07,_0xa05cd1,!![]);}catch(_0xb367c9){return BPromise['reject'](_0xb367c9);}return _0x138f07['save']();};}function saveUpdates(_0x116f24,_0x141d34){return function(_0x435f14){if(_0x435f14){return _0x435f14[_0xa1c8('0x1f')](_0x116f24)[_0xa1c8('0x20')](function(_0x5aac4b){return _0x5aac4b;});}return null;};}function removeEntity(_0x3bb7e6,_0x43a149){return function(_0x1b3379){if(_0x1b3379){return _0x1b3379[_0xa1c8('0x21')]()[_0xa1c8('0x20')](function(){_0x3bb7e6['status'](0xcc)[_0xa1c8('0x19')]();});}};}function handleEntityNotFound(_0x18fb2d,_0x235b63){return function(_0x1bd478){if(!_0x1bd478){_0x18fb2d['sendStatus'](0x194);}return _0x1bd478;};}function handleError(_0x9aa657,_0x136dc6){_0x136dc6=_0x136dc6||0x1f4;return function(_0x1035c6){logger[_0xa1c8('0x22')](_0x1035c6[_0xa1c8('0x23')]);if(_0x1035c6[_0xa1c8('0x24')]){delete _0x1035c6[_0xa1c8('0x24')];}_0x9aa657[_0xa1c8('0x1a')](_0x136dc6)[_0xa1c8('0x25')](_0x1035c6);};}exports[_0xa1c8('0x26')]=function(_0x41298b,_0x5abb24){var _0x43a04d={},_0x492d46={},_0x100322={'count':0x0,'rows':[]};var _0x59a869=_[_0xa1c8('0x27')](db['AnalyticTreeReport'][_0xa1c8('0x28')],function(_0x210f15){return{'name':_0x210f15['fieldName'],'type':_0x210f15['type'][_0xa1c8('0x29')]};});_0x492d46[_0xa1c8('0x2a')]=_[_0xa1c8('0x27')](_0x59a869,_0xa1c8('0x24'));_0x492d46[_0xa1c8('0x2b')]=_[_0xa1c8('0x2c')](_0x41298b[_0xa1c8('0x2b')]);_0x492d46[_0xa1c8('0x2d')]=_[_0xa1c8('0x2e')](_0x492d46[_0xa1c8('0x2a')],_0x492d46['query']);_0x43a04d[_0xa1c8('0x2f')]=_[_0xa1c8('0x2e')](_0x492d46[_0xa1c8('0x2a')],qs['fields'](_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x30')]));_0x43a04d[_0xa1c8('0x2f')]=_0x43a04d[_0xa1c8('0x2f')]['length']?_0x43a04d[_0xa1c8('0x2f')]:_0x492d46[_0xa1c8('0x2a')];if(!_0x41298b['query'][_0xa1c8('0x31')](_0xa1c8('0x32'))){_0x43a04d[_0xa1c8('0x1d')]=qs['limit'](_0x41298b['query'][_0xa1c8('0x1d')]);_0x43a04d['offset']=qs[_0xa1c8('0x33')](_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x33')]);}_0x43a04d[_0xa1c8('0x34')]=qs[_0xa1c8('0x35')](_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x35')]);_0x43a04d['where']=qs[_0xa1c8('0x2d')](_[_0xa1c8('0x36')](_0x41298b[_0xa1c8('0x2b')],_0x492d46[_0xa1c8('0x2d')]),_0x59a869);if(_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x37')]){_0x43a04d[_0xa1c8('0x38')]=_['merge'](_0x43a04d['where'],{'$or':_[_0xa1c8('0x27')](_0x59a869,function(_0x505ab6){if(_0x505ab6['type']!==_0xa1c8('0x39')){var _0x71ad4d={};_0x71ad4d[_0x505ab6[_0xa1c8('0x24')]]={'$like':'%'+_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x37')]+'%'};return _0x71ad4d;}})});}_0x43a04d=_[_0xa1c8('0x3a')]({},_0x43a04d,_0x41298b['options']);var _0xac48f0={'where':_0x43a04d[_0xa1c8('0x38')]};return db[_0xa1c8('0x3b')][_0xa1c8('0x1c')](_0xac48f0)['then'](function(_0x2ce4a1){_0x100322['count']=_0x2ce4a1;if(_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x3c')]){_0x43a04d[_0xa1c8('0x3d')]=[{'all':!![]}];}return db[_0xa1c8('0x3b')][_0xa1c8('0x3e')](_0x43a04d);})[_0xa1c8('0x20')](function(_0x1951c0){_0x100322['rows']=_0x1951c0;return _0x100322;})[_0xa1c8('0x20')](respondWithFilteredResult(_0x5abb24,_0x43a04d))['catch'](handleError(_0x5abb24,null));};exports[_0xa1c8('0x3f')]=function(_0x3d2b6f,_0x33762d){var _0x3154cc={'raw':!![],'where':{'id':_0x3d2b6f[_0xa1c8('0x40')]['id']}},_0x25cea0={};_0x25cea0[_0xa1c8('0x2a')]=_[_0xa1c8('0x2c')](db['AnalyticTreeReport'][_0xa1c8('0x28')]);_0x25cea0['query']=_[_0xa1c8('0x2c')](_0x3d2b6f['query']);_0x25cea0[_0xa1c8('0x2d')]=_[_0xa1c8('0x2e')](_0x25cea0[_0xa1c8('0x2a')],_0x25cea0[_0xa1c8('0x2b')]);_0x3154cc[_0xa1c8('0x2f')]=_[_0xa1c8('0x2e')](_0x25cea0['model'],qs[_0xa1c8('0x30')](_0x3d2b6f[_0xa1c8('0x2b')][_0xa1c8('0x30')]));_0x3154cc[_0xa1c8('0x2f')]=_0x3154cc['attributes']['length']?_0x3154cc[_0xa1c8('0x2f')]:_0x25cea0[_0xa1c8('0x2a')];if(_0x3d2b6f[_0xa1c8('0x2b')]['includeAll']){_0x3154cc['include']=[{'all':!![]}];}_0x3154cc=_[_0xa1c8('0x3a')]({},_0x3154cc,_0x3d2b6f[_0xa1c8('0x41')]);return db[_0xa1c8('0x3b')]['find'](_0x3154cc)[_0xa1c8('0x20')](handleEntityNotFound(_0x33762d,null))[_0xa1c8('0x20')](respondWithResult(_0x33762d,null))['catch'](handleError(_0x33762d,null));};exports['create']=function(_0x27f716,_0x4c9ad0){return db['AnalyticTreeReport'][_0xa1c8('0x42')](_0x27f716[_0xa1c8('0x43')],{})[_0xa1c8('0x20')](respondWithResult(_0x4c9ad0,0xc9))['catch'](handleError(_0x4c9ad0,null));};exports[_0xa1c8('0x1f')]=function(_0x469874,_0x3a24b7){if(_0x469874[_0xa1c8('0x43')]['id']){delete _0x469874[_0xa1c8('0x43')]['id'];}return db[_0xa1c8('0x3b')][_0xa1c8('0x44')]({'where':{'id':_0x469874[_0xa1c8('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a24b7,null))[_0xa1c8('0x20')](saveUpdates(_0x469874[_0xa1c8('0x43')],null))[_0xa1c8('0x20')](respondWithResult(_0x3a24b7,null))[_0xa1c8('0x45')](handleError(_0x3a24b7,null));};exports[_0xa1c8('0x21')]=function(_0x4886fb,_0x26f6df){return db[_0xa1c8('0x3b')]['find']({'where':{'id':_0x4886fb[_0xa1c8('0x40')]['id']}})['then'](handleEntityNotFound(_0x26f6df,null))['then'](removeEntity(_0x26f6df,null))['catch'](handleError(_0x26f6df,null));}; \ No newline at end of file +var _0x28ce=['order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','update','then','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x46b0e4,_0x2abe87){var _0x574ac0=function(_0x3e4f6c){while(--_0x3e4f6c){_0x46b0e4['push'](_0x46b0e4['shift']());}};_0x574ac0(++_0x2abe87);}(_0x28ce,0xa6));var _0xe28c=function(_0x235680,_0x2ef5f1){_0x235680=_0x235680-0x0;var _0x252f7e=_0x28ce[_0x235680];return _0x252f7e;};'use strict';var pdf=require(_0xe28c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe28c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe28c('0x2'));var rp=require(_0xe28c('0x3'));var moment=require(_0xe28c('0x4'));var BPromise=require(_0xe28c('0x5'));var Mustache=require(_0xe28c('0x6'));var util=require(_0xe28c('0x7'));var path=require(_0xe28c('0x8'));var sox=require(_0xe28c('0x9'));var csv=require(_0xe28c('0xa'));var ejs=require(_0xe28c('0xb'));var fs=require('fs');var _=require(_0xe28c('0xc'));var squel=require(_0xe28c('0xd'));var crypto=require(_0xe28c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe28c('0xf'));var toCsv=require(_0xe28c('0xa'));var querystring=require('querystring');var Papa=require(_0xe28c('0x10'));var Redis=require(_0xe28c('0x11'));var authService=require(_0xe28c('0x12'));var qs=require(_0xe28c('0x13'));var as=require(_0xe28c('0x14'));var hardwareService=require(_0xe28c('0x15'));var logger=require('../../config/logger')(_0xe28c('0x16'));var utils=require(_0xe28c('0x17'));var config=require(_0xe28c('0x18'));var licenseUtil=require(_0xe28c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfdaedc,_0x4bbaaa){_0x4bbaaa=_0x4bbaaa||0xcc;return function(_0x38977b){if(_0x38977b){return _0xfdaedc[_0xe28c('0x1a')](_0x4bbaaa);}return _0xfdaedc['status'](_0x4bbaaa)[_0xe28c('0x1b')]();};}function respondWithResult(_0x42fdb7,_0x350e6d){_0x350e6d=_0x350e6d||0xc8;return function(_0x28aa38){if(_0x28aa38){return _0x42fdb7['status'](_0x350e6d)[_0xe28c('0x1c')](_0x28aa38);}};}function respondWithFilteredResult(_0x5a1314,_0x10f357){return function(_0x2d1dd2){if(_0x2d1dd2){var _0x509045=_0x2d1dd2[_0xe28c('0x1d')],_0x40ebdf=_0x10f357[_0xe28c('0x1e')],_0x1a0d40=_0x10f357[_0xe28c('0x1e')]+_0x10f357[_0xe28c('0x1f')],_0x16e6aa;if(_0x1a0d40>=_0x509045){_0x1a0d40=_0x509045;_0x16e6aa=0xc8;}else{_0x16e6aa=0xce;}_0x5a1314[_0xe28c('0x20')](_0x16e6aa);return _0x5a1314[_0xe28c('0x21')](_0xe28c('0x22'),_0x40ebdf+'-'+_0x1a0d40+'/'+_0x509045)[_0xe28c('0x1c')](_0x2d1dd2);}return null;};}function patchUpdates(_0x3691c7){return function(_0x2e7f1e){try{jsonpatch['apply'](_0x2e7f1e,_0x3691c7,!![]);}catch(_0x222a70){return BPromise[_0xe28c('0x23')](_0x222a70);}return _0x2e7f1e['save']();};}function saveUpdates(_0x3c57a1,_0x3d6a1d){return function(_0x2aa243){if(_0x2aa243){return _0x2aa243[_0xe28c('0x24')](_0x3c57a1)['then'](function(_0x728eed){return _0x728eed;});}return null;};}function removeEntity(_0x59ba0c,_0xe9f9d1){return function(_0x43fbc8){if(_0x43fbc8){return _0x43fbc8['destroy']()[_0xe28c('0x25')](function(){_0x59ba0c['status'](0xcc)[_0xe28c('0x1b')]();});}};}function handleEntityNotFound(_0x4b2b51,_0x3b7419){return function(_0x1957cf){if(!_0x1957cf){_0x4b2b51[_0xe28c('0x1a')](0x194);}return _0x1957cf;};}function handleError(_0x41aa95,_0x1f5827){_0x1f5827=_0x1f5827||0x1f4;return function(_0x589f09){logger[_0xe28c('0x26')](_0x589f09[_0xe28c('0x27')]);if(_0x589f09[_0xe28c('0x28')]){delete _0x589f09['name'];}_0x41aa95['status'](_0x1f5827)[_0xe28c('0x29')](_0x589f09);};}exports['index']=function(_0x5729cd,_0x47a741){var _0x71dd2d={},_0x3d6cd5={},_0x5acd82={'count':0x0,'rows':[]};var _0x3e0194=_[_0xe28c('0x2a')](db[_0xe28c('0x2b')][_0xe28c('0x2c')],function(_0x48cc04){return{'name':_0x48cc04[_0xe28c('0x2d')],'type':_0x48cc04['type']['key']};});_0x3d6cd5[_0xe28c('0x2e')]=_['map'](_0x3e0194,_0xe28c('0x28'));_0x3d6cd5['query']=_[_0xe28c('0x2f')](_0x5729cd['query']);_0x3d6cd5[_0xe28c('0x30')]=_[_0xe28c('0x31')](_0x3d6cd5[_0xe28c('0x2e')],_0x3d6cd5[_0xe28c('0x32')]);_0x71dd2d['attributes']=_['intersection'](_0x3d6cd5['model'],qs[_0xe28c('0x33')](_0x5729cd[_0xe28c('0x32')][_0xe28c('0x33')]));_0x71dd2d[_0xe28c('0x34')]=_0x71dd2d['attributes'][_0xe28c('0x35')]?_0x71dd2d[_0xe28c('0x34')]:_0x3d6cd5[_0xe28c('0x2e')];if(!_0x5729cd[_0xe28c('0x32')][_0xe28c('0x36')](_0xe28c('0x37'))){_0x71dd2d[_0xe28c('0x1f')]=qs[_0xe28c('0x1f')](_0x5729cd[_0xe28c('0x32')]['limit']);_0x71dd2d['offset']=qs[_0xe28c('0x1e')](_0x5729cd[_0xe28c('0x32')][_0xe28c('0x1e')]);}_0x71dd2d[_0xe28c('0x38')]=qs[_0xe28c('0x39')](_0x5729cd[_0xe28c('0x32')][_0xe28c('0x39')]);_0x71dd2d[_0xe28c('0x3a')]=qs[_0xe28c('0x30')](_[_0xe28c('0x3b')](_0x5729cd[_0xe28c('0x32')],_0x3d6cd5['filters']),_0x3e0194);if(_0x5729cd['query'][_0xe28c('0x3c')]){_0x71dd2d[_0xe28c('0x3a')]=_[_0xe28c('0x3d')](_0x71dd2d['where'],{'$or':_['map'](_0x3e0194,function(_0x2c3987){if(_0x2c3987[_0xe28c('0x3e')]!=='VIRTUAL'){var _0x3aa093={};_0x3aa093[_0x2c3987[_0xe28c('0x28')]]={'$like':'%'+_0x5729cd['query'][_0xe28c('0x3c')]+'%'};return _0x3aa093;}})});}_0x71dd2d=_['merge']({},_0x71dd2d,_0x5729cd[_0xe28c('0x3f')]);var _0x14cec6={'where':_0x71dd2d['where']};return db['AnalyticTreeReport'][_0xe28c('0x1d')](_0x14cec6)['then'](function(_0x400758){_0x5acd82['count']=_0x400758;if(_0x5729cd[_0xe28c('0x32')][_0xe28c('0x40')]){_0x71dd2d[_0xe28c('0x41')]=[{'all':!![]}];}return db[_0xe28c('0x2b')][_0xe28c('0x42')](_0x71dd2d);})[_0xe28c('0x25')](function(_0x55156d){_0x5acd82[_0xe28c('0x43')]=_0x55156d;return _0x5acd82;})['then'](respondWithFilteredResult(_0x47a741,_0x71dd2d))[_0xe28c('0x44')](handleError(_0x47a741,null));};exports[_0xe28c('0x45')]=function(_0x551ee2,_0x121661){var _0x18292a={'raw':!![],'where':{'id':_0x551ee2[_0xe28c('0x46')]['id']}},_0x43f805={};_0x43f805[_0xe28c('0x2e')]=_[_0xe28c('0x2f')](db['AnalyticTreeReport']['rawAttributes']);_0x43f805[_0xe28c('0x32')]=_['keys'](_0x551ee2[_0xe28c('0x32')]);_0x43f805[_0xe28c('0x30')]=_[_0xe28c('0x31')](_0x43f805[_0xe28c('0x2e')],_0x43f805[_0xe28c('0x32')]);_0x18292a[_0xe28c('0x34')]=_[_0xe28c('0x31')](_0x43f805[_0xe28c('0x2e')],qs[_0xe28c('0x33')](_0x551ee2[_0xe28c('0x32')][_0xe28c('0x33')]));_0x18292a[_0xe28c('0x34')]=_0x18292a[_0xe28c('0x34')][_0xe28c('0x35')]?_0x18292a['attributes']:_0x43f805[_0xe28c('0x2e')];if(_0x551ee2['query'][_0xe28c('0x40')]){_0x18292a[_0xe28c('0x41')]=[{'all':!![]}];}_0x18292a=_['merge']({},_0x18292a,_0x551ee2[_0xe28c('0x3f')]);return db[_0xe28c('0x2b')][_0xe28c('0x47')](_0x18292a)[_0xe28c('0x25')](handleEntityNotFound(_0x121661,null))[_0xe28c('0x25')](respondWithResult(_0x121661,null))[_0xe28c('0x44')](handleError(_0x121661,null));};exports['create']=function(_0x1dbb8e,_0x1e197c){return db['AnalyticTreeReport']['create'](_0x1dbb8e[_0xe28c('0x48')],{})[_0xe28c('0x25')](respondWithResult(_0x1e197c,0xc9))[_0xe28c('0x44')](handleError(_0x1e197c,null));};exports[_0xe28c('0x24')]=function(_0x5a355a,_0x5c1c1d){if(_0x5a355a[_0xe28c('0x48')]['id']){delete _0x5a355a['body']['id'];}return db[_0xe28c('0x2b')][_0xe28c('0x47')]({'where':{'id':_0x5a355a['params']['id']}})[_0xe28c('0x25')](handleEntityNotFound(_0x5c1c1d,null))[_0xe28c('0x25')](saveUpdates(_0x5a355a[_0xe28c('0x48')],null))[_0xe28c('0x25')](respondWithResult(_0x5c1c1d,null))[_0xe28c('0x44')](handleError(_0x5c1c1d,null));};exports[_0xe28c('0x49')]=function(_0x3481fc,_0x152e10){return db[_0xe28c('0x2b')][_0xe28c('0x47')]({'where':{'id':_0x3481fc['params']['id']}})['then'](handleEntityNotFound(_0x152e10,null))['then'](removeEntity(_0x152e10,null))[_0xe28c('0x44')](handleError(_0x152e10,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 6f3abd0..53e3397 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 _0x5458=['../../config/environment','exports','define','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1533ff,_0x2a61ac){var _0x5f1ab4=function(_0x1f7a18){while(--_0x1f7a18){_0x1533ff['push'](_0x1533ff['shift']());}};_0x5f1ab4(++_0x2a61ac);}(_0x5458,0x1c7));var _0x8545=function(_0x5582d2,_0x5a87cf){_0x5582d2=_0x5582d2-0x0;var _0x47c2fe=_0x5458[_0x5582d2];return _0x47c2fe;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var logger=require(_0x8545('0x2'))('api');var moment=require(_0x8545('0x3'));var BPromise=require(_0x8545('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8545('0x5'));var rimraf=require(_0x8545('0x6'));var config=require(_0x8545('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x8545('0x8')]=function(_0x2bd13a,_0x10792f){return _0x2bd13a[_0x8545('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x8545('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb422=['analytics_report_trees','api','request-promise','rimraf','./analyticTreeReport.attributes','define'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0xb422,0x85));var _0x2b42=function(_0x1443d5,_0x21f839){_0x1443d5=_0x1443d5-0x0;var _0x3f8e34=_0xb422[_0x1443d5];return _0x3f8e34;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2b42('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b42('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b42('0x2'));var config=require('../../config/environment');var attributes=require(_0x2b42('0x3'));module['exports']=function(_0x406d93,_0x1a0fbe){return _0x406d93[_0x2b42('0x4')]('AnalyticTreeReport',attributes,{'tableName':_0x2b42('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 43b156d..e67f25f 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 _0xbfa3=['client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5f3206,_0x510e61){var _0x543552=function(_0x128e1a){while(--_0x128e1a){_0x5f3206['push'](_0x5f3206['shift']());}};_0x543552(++_0x510e61);}(_0xbfa3,0xd3));var _0x3bfa=function(_0x3effd3,_0x2d09de){_0x3effd3=_0x3effd3-0x0;var _0x461404=_0xbfa3[_0x3effd3];return _0x461404;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3bfa('0x0'));var BPromise=require(_0x3bfa('0x1'));var rs=require(_0x3bfa('0x2'));var fs=require('fs');var Redis=require(_0x3bfa('0x3'));var db=require(_0x3bfa('0x4'))['db'];var utils=require(_0x3bfa('0x5'));var logger=require(_0x3bfa('0x6'))('rpc');var config=require(_0x3bfa('0x7'));var jayson=require(_0x3bfa('0x8'));var client=jayson[_0x3bfa('0x9')][_0x3bfa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a11d2,_0x3767fa,_0x44ec04){return new BPromise(function(_0x4321ec,_0xf5a8ee){return client[_0x3bfa('0xb')](_0x3a11d2,_0x44ec04)['then'](function(_0x338c38){logger[_0x3bfa('0xc')](_0x3bfa('0xd'),_0x3767fa,'request\x20sent');logger['debug'](_0x3bfa('0xe'),_0x3767fa,_0x3bfa('0xf'),JSON[_0x3bfa('0x10')](_0x338c38));if(_0x338c38[_0x3bfa('0x11')]){if(_0x338c38['error'][_0x3bfa('0x12')]===0x1f4){logger['error'](_0x3bfa('0xd'),_0x3767fa,_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);return _0xf5a8ee(_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);}logger[_0x3bfa('0x11')](_0x3bfa('0xd'),_0x3767fa,_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);return _0x4321ec(_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);}else{logger[_0x3bfa('0xc')](_0x3bfa('0xd'),_0x3767fa,_0x3bfa('0xf'));_0x4321ec(_0x338c38[_0x3bfa('0x14')][_0x3bfa('0x13')]);}})[_0x3bfa('0x15')](function(_0x22c730){logger[_0x3bfa('0x11')](_0x3bfa('0xd'),_0x3767fa,_0x22c730);_0xf5a8ee(_0x22c730);});});} \ No newline at end of file +var _0x5305=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x4bb14e,_0x4be3d1){var _0x1c1568=function(_0x4e24db){while(--_0x4e24db){_0x4bb14e['push'](_0x4bb14e['shift']());}};_0x1c1568(++_0x4be3d1);}(_0x5305,0x1d1));var _0x5530=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5305[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x5530('0x0'));var util=require(_0x5530('0x1'));var moment=require(_0x5530('0x2'));var BPromise=require(_0x5530('0x3'));var rs=require(_0x5530('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5530('0x5'))['db'];var utils=require(_0x5530('0x6'));var logger=require('../../config/logger')(_0x5530('0x7'));var config=require(_0x5530('0x8'));var jayson=require(_0x5530('0x9'));var client=jayson[_0x5530('0xa')][_0x5530('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4d88,_0x69ecce,_0x97fc7a){return new BPromise(function(_0x249fc9,_0xbbd379){return client['request'](_0x5f4d88,_0x97fc7a)[_0x5530('0xc')](function(_0x3201ae){logger[_0x5530('0xd')](_0x5530('0xe'),_0x69ecce,_0x5530('0xf'));logger[_0x5530('0x10')](_0x5530('0x11'),_0x69ecce,_0x5530('0xf'),JSON['stringify'](_0x3201ae));if(_0x3201ae[_0x5530('0x12')]){if(_0x3201ae['error'][_0x5530('0x13')]===0x1f4){logger[_0x5530('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x69ecce,_0x3201ae[_0x5530('0x12')][_0x5530('0x14')]);return _0xbbd379(_0x3201ae['error'][_0x5530('0x14')]);}logger['error'](_0x5530('0xe'),_0x69ecce,_0x3201ae[_0x5530('0x12')][_0x5530('0x14')]);return _0x249fc9(_0x3201ae[_0x5530('0x12')]['message']);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x69ecce,_0x5530('0xf'));_0x249fc9(_0x3201ae[_0x5530('0x15')][_0x5530('0x14')]);}})[_0x5530('0x16')](function(_0x1a4131){logger['error'](_0x5530('0xe'),_0x69ecce,_0x1a4131);_0xbbd379(_0x1a4131);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e19af58..d2ffd1a 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 _0xdf4f=['post','create','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0xdf4f,0x1cd));var _0xfdf4=function(_0x1b2799,_0x55aa24){_0x1b2799=_0x1b2799-0x0;var _0x373bb8=_0xdf4f[_0x1b2799];return _0x373bb8;};'use strict';var multer=require(_0xfdf4('0x0'));var util=require(_0xfdf4('0x1'));var path=require('path');var timeout=require(_0xfdf4('0x2'));var express=require(_0xfdf4('0x3'));var router=express[_0xfdf4('0x4')]();var auth=require(_0xfdf4('0x5'));var interaction=require(_0xfdf4('0x6'));var config=require(_0xfdf4('0x7'));var controller=require(_0xfdf4('0x8'));router[_0xfdf4('0x9')]('/',auth[_0xfdf4('0xa')](),controller[_0xfdf4('0xb')]);router['get'](_0xfdf4('0xc'),auth[_0xfdf4('0xa')](),controller[_0xfdf4('0xd')]);router[_0xfdf4('0xe')]('/',auth[_0xfdf4('0xa')](),controller[_0xfdf4('0xf')]);router[_0xfdf4('0x10')](_0xfdf4('0xc'),auth[_0xfdf4('0xa')](),controller[_0xfdf4('0x11')]);router['delete'](_0xfdf4('0xc'),auth[_0xfdf4('0xa')](),controller[_0xfdf4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8576=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','put','/:id','delete','destroy'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8576,0x127));var _0x6857=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x8576[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6857('0x0'));var timeout=require(_0x6857('0x1'));var express=require('express');var router=express[_0x6857('0x2')]();var auth=require(_0x6857('0x3'));var interaction=require(_0x6857('0x4'));var config=require(_0x6857('0x5'));var controller=require(_0x6857('0x6'));router['get']('/',auth[_0x6857('0x7')](),controller[_0x6857('0x8')]);router['get']('/:id',auth[_0x6857('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6857('0x9')](_0x6857('0xa'),auth[_0x6857('0x7')](),controller['update']);router[_0x6857('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6857('0xc')]);module[_0x6857('0xd')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 506144b..85aa9ec 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 _0x7c71=['STRING','sequelize'];(function(_0x1b9bea,_0x5bfe0a){var _0x4de3be=function(_0x37215d){while(--_0x37215d){_0x1b9bea['push'](_0x1b9bea['shift']());}};_0x4de3be(++_0x5bfe0a);}(_0x7c71,0x71));var _0x17c7=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7c71[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0x17c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x17c7('0x1')]},'basename':{'type':Sequelize[_0x17c7('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa5a1=['STRING','sequelize','exports'];(function(_0x533913,_0x525f70){var _0x327c32=function(_0x49f4f9){while(--_0x49f4f9){_0x533913['push'](_0x533913['shift']());}};_0x327c32(++_0x525f70);}(_0xa5a1,0xc1));var _0x1a5a=function(_0x234ab7,_0x4e8666){_0x234ab7=_0x234ab7-0x0;var _0x1093ff=_0xa5a1[_0x234ab7];return _0x1093ff;};'use strict';var Sequelize=require(_0x1a5a('0x0'));module[_0x1a5a('0x1')]={'name':{'type':Sequelize[_0x1a5a('0x2')]},'basename':{'type':Sequelize[_0x1a5a('0x2')]},'type':{'type':Sequelize[_0x1a5a('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index bda6cf7..cfe8639 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 _0x92bf=['VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','createdAt','body','updatedAt','create','file','originalname','filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','Attachment','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map'];(function(_0x53d091,_0x5040f3){var _0x20e171=function(_0x212ac7){while(--_0x212ac7){_0x53d091['push'](_0x53d091['shift']());}};_0x20e171(++_0x5040f3);}(_0x92bf,0xc2));var _0xf92b=function(_0x178c41,_0x371118){_0x178c41=_0x178c41-0x0;var _0x5e9691=_0x92bf[_0x178c41];return _0x5e9691;};'use strict';var pdf=require(_0xf92b('0x0'));var emlformat=require(_0xf92b('0x1'));var rimraf=require(_0xf92b('0x2'));var zipdir=require(_0xf92b('0x3'));var jsonpatch=require(_0xf92b('0x4'));var rp=require(_0xf92b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf92b('0x6'));var util=require(_0xf92b('0x7'));var path=require(_0xf92b('0x8'));var sox=require(_0xf92b('0x9'));var csv=require('to-csv');var ejs=require(_0xf92b('0xa'));var fs=require('fs');var _=require(_0xf92b('0xb'));var squel=require('squel');var crypto=require(_0xf92b('0xc'));var jsforce=require(_0xf92b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf92b('0xe'));var querystring=require('querystring');var Papa=require(_0xf92b('0xf'));var Redis=require(_0xf92b('0x10'));var authService=require(_0xf92b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf92b('0x12'));var hardwareService=require(_0xf92b('0x13'));var logger=require(_0xf92b('0x14'))(_0xf92b('0x15'));var utils=require(_0xf92b('0x16'));var config=require(_0xf92b('0x17'));var licenseUtil=require(_0xf92b('0x18'));var db=require(_0xf92b('0x19'))['db'];function respondWithStatusCode(_0x10cba6,_0x2d44cc){_0x2d44cc=_0x2d44cc||0xcc;return function(_0x302227){if(_0x302227){return _0x10cba6['sendStatus'](_0x2d44cc);}return _0x10cba6[_0xf92b('0x1a')](_0x2d44cc)['end']();};}function respondWithResult(_0x327ab1,_0x32ad4b){_0x32ad4b=_0x32ad4b||0xc8;return function(_0x4d1ec9){if(_0x4d1ec9){return _0x327ab1[_0xf92b('0x1a')](_0x32ad4b)['json'](_0x4d1ec9);}};}function respondWithFilteredResult(_0x10e52d,_0x4d0a3a){return function(_0x268841){if(_0x268841){var _0x203865=_0x268841['count'],_0x5be49b=_0x4d0a3a[_0xf92b('0x1b')],_0x518e09=_0x4d0a3a[_0xf92b('0x1b')]+_0x4d0a3a[_0xf92b('0x1c')],_0x41efbd;if(_0x518e09>=_0x203865){_0x518e09=_0x203865;_0x41efbd=0xc8;}else{_0x41efbd=0xce;}_0x10e52d[_0xf92b('0x1a')](_0x41efbd);return _0x10e52d[_0xf92b('0x1d')](_0xf92b('0x1e'),_0x5be49b+'-'+_0x518e09+'/'+_0x203865)['json'](_0x268841);}return null;};}function patchUpdates(_0x362144){return function(_0x512716){try{jsonpatch['apply'](_0x512716,_0x362144,!![]);}catch(_0x2fd928){return BPromise[_0xf92b('0x1f')](_0x2fd928);}return _0x512716[_0xf92b('0x20')]();};}function saveUpdates(_0x3ba52e,_0x4a06fc){return function(_0x11ad0b){if(_0x11ad0b){return _0x11ad0b[_0xf92b('0x21')](_0x3ba52e)['then'](function(_0x3db47c){return _0x3db47c;});}return null;};}function removeEntity(_0x5e3296,_0x3dc660){return function(_0x2e9e7f){if(_0x2e9e7f){return _0x2e9e7f[_0xf92b('0x22')]()[_0xf92b('0x23')](function(){_0x5e3296['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x540e51,_0x5611f1){return function(_0x1232e4){if(!_0x1232e4){_0x540e51[_0xf92b('0x24')](0x194);}return _0x1232e4;};}function handleError(_0x3dc67a,_0x4c7c77){_0x4c7c77=_0x4c7c77||0x1f4;return function(_0x48d1eb){logger[_0xf92b('0x25')](_0x48d1eb[_0xf92b('0x26')]);if(_0x48d1eb[_0xf92b('0x27')]){delete _0x48d1eb['name'];}_0x3dc67a['status'](_0x4c7c77)[_0xf92b('0x28')](_0x48d1eb);};}exports['index']=function(_0x566504,_0x145e05){var _0x3ff9b0={},_0x28e129={},_0xf158e5={'count':0x0,'rows':[]};var _0x236930=_['map'](db[_0xf92b('0x29')][_0xf92b('0x2a')],function(_0x4330f6){return{'name':_0x4330f6[_0xf92b('0x2b')],'type':_0x4330f6[_0xf92b('0x2c')][_0xf92b('0x2d')]};});_0x28e129['model']=_['map'](_0x236930,_0xf92b('0x27'));_0x28e129[_0xf92b('0x2e')]=_[_0xf92b('0x2f')](_0x566504[_0xf92b('0x2e')]);_0x28e129['filters']=_[_0xf92b('0x30')](_0x28e129['model'],_0x28e129['query']);_0x3ff9b0[_0xf92b('0x31')]=_[_0xf92b('0x30')](_0x28e129[_0xf92b('0x32')],qs[_0xf92b('0x33')](_0x566504[_0xf92b('0x2e')]['fields']));_0x3ff9b0[_0xf92b('0x31')]=_0x3ff9b0['attributes'][_0xf92b('0x34')]?_0x3ff9b0[_0xf92b('0x31')]:_0x28e129['model'];if(!_0x566504[_0xf92b('0x2e')][_0xf92b('0x35')]('nolimit')){_0x3ff9b0[_0xf92b('0x1c')]=qs['limit'](_0x566504[_0xf92b('0x2e')][_0xf92b('0x1c')]);_0x3ff9b0['offset']=qs['offset'](_0x566504['query'][_0xf92b('0x1b')]);}_0x3ff9b0[_0xf92b('0x36')]=qs['sort'](_0x566504[_0xf92b('0x2e')][_0xf92b('0x37')]);_0x3ff9b0[_0xf92b('0x38')]=qs['filters'](_[_0xf92b('0x39')](_0x566504[_0xf92b('0x2e')],_0x28e129['filters']),_0x236930);if(_0x566504['query'][_0xf92b('0x3a')]){_0x3ff9b0[_0xf92b('0x38')]=_[_0xf92b('0x3b')](_0x3ff9b0[_0xf92b('0x38')],{'$or':_[_0xf92b('0x3c')](_0x236930,function(_0x64e717){if(_0x64e717[_0xf92b('0x2c')]!==_0xf92b('0x3d')){var _0x312c96={};_0x312c96[_0x64e717[_0xf92b('0x27')]]={'$like':'%'+_0x566504[_0xf92b('0x2e')]['filter']+'%'};return _0x312c96;}})});}_0x3ff9b0=_['merge']({},_0x3ff9b0,_0x566504[_0xf92b('0x3e')]);var _0x4b5fce={'where':_0x3ff9b0['where']};return db[_0xf92b('0x29')][_0xf92b('0x3f')](_0x4b5fce)[_0xf92b('0x23')](function(_0x4768b2){_0xf158e5['count']=_0x4768b2;if(_0x566504[_0xf92b('0x2e')][_0xf92b('0x40')]){_0x3ff9b0[_0xf92b('0x41')]=[{'all':!![]}];}return db[_0xf92b('0x29')][_0xf92b('0x42')](_0x3ff9b0);})[_0xf92b('0x23')](function(_0x38bd68){_0xf158e5[_0xf92b('0x43')]=_0x38bd68;return _0xf158e5;})['then'](respondWithFilteredResult(_0x145e05,_0x3ff9b0))[_0xf92b('0x44')](handleError(_0x145e05,null));};exports[_0xf92b('0x45')]=function(_0x242179,_0x306e3c){var _0x3d33fc={'raw':!![],'where':{'id':_0x242179[_0xf92b('0x46')]['id']}},_0x3d8f11={};_0x3d8f11[_0xf92b('0x32')]=_[_0xf92b('0x2f')](db['Attachment'][_0xf92b('0x2a')]);_0x3d8f11['query']=_[_0xf92b('0x2f')](_0x242179[_0xf92b('0x2e')]);_0x3d8f11['filters']=_[_0xf92b('0x30')](_0x3d8f11[_0xf92b('0x32')],_0x3d8f11['query']);_0x3d33fc[_0xf92b('0x31')]=_[_0xf92b('0x30')](_0x3d8f11[_0xf92b('0x32')],qs[_0xf92b('0x33')](_0x242179[_0xf92b('0x2e')][_0xf92b('0x33')]));_0x3d33fc[_0xf92b('0x31')]=_0x3d33fc['attributes'][_0xf92b('0x34')]?_0x3d33fc['attributes']:_0x3d8f11[_0xf92b('0x32')];if(_0x242179['query'][_0xf92b('0x40')]){_0x3d33fc[_0xf92b('0x41')]=[{'all':!![]}];}_0x3d33fc=_[_0xf92b('0x3b')]({},_0x3d33fc,_0x242179[_0xf92b('0x3e')]);return db[_0xf92b('0x29')]['find'](_0x3d33fc)[_0xf92b('0x23')](handleEntityNotFound(_0x306e3c,null))[_0xf92b('0x23')](respondWithResult(_0x306e3c,null))[_0xf92b('0x44')](handleError(_0x306e3c,null));};exports['clone']=function(_0x11d5d3,_0x45da7b){var _0x22b877={'where':{'id':_0x11d5d3[_0xf92b('0x46')]['id']}},_0x479876={};_0x479876[_0xf92b('0x32')]=_[_0xf92b('0x2f')](db[_0xf92b('0x29')][_0xf92b('0x2a')]);_0x22b877[_0xf92b('0x31')]=_[_0xf92b('0x30')](_0x479876[_0xf92b('0x32')],qs[_0xf92b('0x33')](_0x11d5d3[_0xf92b('0x2e')][_0xf92b('0x33')]));_0x22b877[_0xf92b('0x31')]=_0x22b877['attributes']['length']?_0x22b877[_0xf92b('0x31')]:_0x479876[_0xf92b('0x32')];if(_0x11d5d3[_0xf92b('0x2e')]['includeAll']){_0x22b877[_0xf92b('0x41')]=[{'all':!![]}];}_0x22b877=_[_0xf92b('0x3b')]({},_0x22b877,_0x11d5d3['options']);return db['Attachment'][_0xf92b('0x47')](_0x22b877)['then'](handleEntityNotFound(_0x45da7b,null))[_0xf92b('0x23')](function(_0x40a2f0){if(_0x40a2f0){var _0x24ebd5=_0x40a2f0['get']({'plain':!![]});_0x24ebd5=qs['omit'](_0x24ebd5,['id',_0xf92b('0x48'),'updatedAt']);_0x11d5d3['body']=_['omit'](_0x11d5d3[_0xf92b('0x49')],['id',_0xf92b('0x48'),_0xf92b('0x4a')]);return db[_0xf92b('0x29')][_0xf92b('0x4b')](_[_0xf92b('0x3b')](_0x24ebd5,_0x11d5d3[_0xf92b('0x49')]),{'include':_0x11d5d3['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xf92b('0x23')](respondWithResult(_0x45da7b,0xc9))[_0xf92b('0x44')](handleError(_0x45da7b,null));};exports[_0xf92b('0x21')]=function(_0x161ac7,_0xc6f387){if(_0x161ac7[_0xf92b('0x49')]['id']){delete _0x161ac7['body']['id'];}return db[_0xf92b('0x29')][_0xf92b('0x47')]({'where':{'id':_0x161ac7[_0xf92b('0x46')]['id']}})['then'](handleEntityNotFound(_0xc6f387,null))['then'](saveUpdates(_0x161ac7['body'],null))[_0xf92b('0x23')](respondWithResult(_0xc6f387,null))['catch'](handleError(_0xc6f387,null));};exports[_0xf92b('0x22')]=function(_0x25c4c6,_0x5d06fa){return db[_0xf92b('0x29')][_0xf92b('0x47')]({'where':{'id':_0x25c4c6['params']['id']}})['then'](handleEntityNotFound(_0x5d06fa,null))[_0xf92b('0x23')](removeEntity(_0x5d06fa,null))[_0xf92b('0x44')](handleError(_0x5d06fa,null));};exports['create']=function(_0x497953,_0x3415b6,_0x2843c0){_0x497953['body'][_0xf92b('0x27')]=_0x497953[_0xf92b('0x4c')][_0xf92b('0x4d')];_0x497953[_0xf92b('0x49')]['basename']=_0x497953[_0xf92b('0x4c')][_0xf92b('0x4e')];_0x497953[_0xf92b('0x49')][_0xf92b('0x2c')]=_0x497953[_0xf92b('0x4c')][_0xf92b('0x4f')];return db['Attachment'][_0xf92b('0x4b')](_0x497953[_0xf92b('0x49')])['then'](respondWithResult(_0x3415b6,0xc9))['catch'](handleError(_0x3415b6,null));};exports[_0xf92b('0x50')]=function(_0x13cab7,_0x556f9a,_0x1322ba){return db[_0xf92b('0x29')][_0xf92b('0x51')]({'where':{'id':_0x13cab7[_0xf92b('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x556f9a,null))[_0xf92b('0x23')](function(_0x13ba6b){if(_0x13ba6b){return _0x556f9a['download'](path[_0xf92b('0x52')](config[_0xf92b('0x53')],_0xf92b('0x54'),_0x13ba6b['basename']));}})[_0xf92b('0x44')](handleError(_0x556f9a,null));}; \ No newline at end of file +var _0x9583=['updatedAt','create','originalname','basename','file','filename','findOne','download','join','root','server/files/attachments/','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','clone','get','omit','createdAt','body'];(function(_0xc60c8d,_0x44d17c){var _0x440913=function(_0x268a4a){while(--_0x268a4a){_0xc60c8d['push'](_0xc60c8d['shift']());}};_0x440913(++_0x44d17c);}(_0x9583,0x16b));var _0x3958=function(_0x32b161,_0x1a6d39){_0x32b161=_0x32b161-0x0;var _0x3ed298=_0x9583[_0x32b161];return _0x3ed298;};'use strict';var pdf=require(_0x3958('0x0'));var emlformat=require(_0x3958('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3958('0x2'));var jsonpatch=require(_0x3958('0x3'));var rp=require(_0x3958('0x4'));var moment=require(_0x3958('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3958('0x6'));var path=require(_0x3958('0x7'));var sox=require(_0x3958('0x8'));var csv=require(_0x3958('0x9'));var ejs=require(_0x3958('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3958('0xb'));var jsforce=require(_0x3958('0xc'));var deskjs=require(_0x3958('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3958('0xe'));var authService=require(_0x3958('0xf'));var qs=require(_0x3958('0x10'));var as=require(_0x3958('0x11'));var hardwareService=require(_0x3958('0x12'));var logger=require(_0x3958('0x13'))(_0x3958('0x14'));var utils=require('../../config/utils');var config=require(_0x3958('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3958('0x16'))['db'];function respondWithStatusCode(_0x44f99a,_0x39a249){_0x39a249=_0x39a249||0xcc;return function(_0x2e0455){if(_0x2e0455){return _0x44f99a[_0x3958('0x17')](_0x39a249);}return _0x44f99a[_0x3958('0x18')](_0x39a249)[_0x3958('0x19')]();};}function respondWithResult(_0x3d601e,_0x4ae7d0){_0x4ae7d0=_0x4ae7d0||0xc8;return function(_0x42a822){if(_0x42a822){return _0x3d601e[_0x3958('0x18')](_0x4ae7d0)[_0x3958('0x1a')](_0x42a822);}};}function respondWithFilteredResult(_0x5446ba,_0x4f13a4){return function(_0x11a811){if(_0x11a811){var _0x2342aa=_0x11a811['count'],_0x2ccb5d=_0x4f13a4['offset'],_0x5a5b1a=_0x4f13a4[_0x3958('0x1b')]+_0x4f13a4[_0x3958('0x1c')],_0x5944d9;if(_0x5a5b1a>=_0x2342aa){_0x5a5b1a=_0x2342aa;_0x5944d9=0xc8;}else{_0x5944d9=0xce;}_0x5446ba[_0x3958('0x18')](_0x5944d9);return _0x5446ba[_0x3958('0x1d')](_0x3958('0x1e'),_0x2ccb5d+'-'+_0x5a5b1a+'/'+_0x2342aa)[_0x3958('0x1a')](_0x11a811);}return null;};}function patchUpdates(_0x39cb12){return function(_0x56bdaa){try{jsonpatch[_0x3958('0x1f')](_0x56bdaa,_0x39cb12,!![]);}catch(_0x4c22e8){return BPromise[_0x3958('0x20')](_0x4c22e8);}return _0x56bdaa[_0x3958('0x21')]();};}function saveUpdates(_0x30e583,_0x3efc5a){return function(_0x1ae889){if(_0x1ae889){return _0x1ae889[_0x3958('0x22')](_0x30e583)['then'](function(_0x2e0439){return _0x2e0439;});}return null;};}function removeEntity(_0x32b2e3,_0x437d4d){return function(_0x2f385a){if(_0x2f385a){return _0x2f385a[_0x3958('0x23')]()[_0x3958('0x24')](function(){_0x32b2e3[_0x3958('0x18')](0xcc)[_0x3958('0x19')]();});}};}function handleEntityNotFound(_0x4cdfdf,_0x587076){return function(_0x3b3008){if(!_0x3b3008){_0x4cdfdf['sendStatus'](0x194);}return _0x3b3008;};}function handleError(_0x1a2b53,_0x2b7ab5){_0x2b7ab5=_0x2b7ab5||0x1f4;return function(_0x237beb){logger[_0x3958('0x25')](_0x237beb[_0x3958('0x26')]);if(_0x237beb['name']){delete _0x237beb[_0x3958('0x27')];}_0x1a2b53[_0x3958('0x18')](_0x2b7ab5)[_0x3958('0x28')](_0x237beb);};}exports[_0x3958('0x29')]=function(_0x44c0f7,_0x1dc9be){var _0x4ffb8f={},_0x1be9d0={},_0x33fb7f={'count':0x0,'rows':[]};var _0x1d6da1=_[_0x3958('0x2a')](db[_0x3958('0x2b')]['rawAttributes'],function(_0x2de404){return{'name':_0x2de404[_0x3958('0x2c')],'type':_0x2de404[_0x3958('0x2d')][_0x3958('0x2e')]};});_0x1be9d0[_0x3958('0x2f')]=_[_0x3958('0x2a')](_0x1d6da1,_0x3958('0x27'));_0x1be9d0['query']=_[_0x3958('0x30')](_0x44c0f7[_0x3958('0x31')]);_0x1be9d0[_0x3958('0x32')]=_[_0x3958('0x33')](_0x1be9d0[_0x3958('0x2f')],_0x1be9d0['query']);_0x4ffb8f['attributes']=_['intersection'](_0x1be9d0['model'],qs[_0x3958('0x34')](_0x44c0f7['query']['fields']));_0x4ffb8f[_0x3958('0x35')]=_0x4ffb8f[_0x3958('0x35')][_0x3958('0x36')]?_0x4ffb8f[_0x3958('0x35')]:_0x1be9d0['model'];if(!_0x44c0f7[_0x3958('0x31')]['hasOwnProperty'](_0x3958('0x37'))){_0x4ffb8f[_0x3958('0x1c')]=qs['limit'](_0x44c0f7[_0x3958('0x31')]['limit']);_0x4ffb8f[_0x3958('0x1b')]=qs[_0x3958('0x1b')](_0x44c0f7[_0x3958('0x31')]['offset']);}_0x4ffb8f['order']=qs['sort'](_0x44c0f7[_0x3958('0x31')][_0x3958('0x38')]);_0x4ffb8f[_0x3958('0x39')]=qs[_0x3958('0x32')](_['pick'](_0x44c0f7[_0x3958('0x31')],_0x1be9d0[_0x3958('0x32')]),_0x1d6da1);if(_0x44c0f7[_0x3958('0x31')][_0x3958('0x3a')]){_0x4ffb8f[_0x3958('0x39')]=_[_0x3958('0x3b')](_0x4ffb8f['where'],{'$or':_['map'](_0x1d6da1,function(_0x32f43e){if(_0x32f43e[_0x3958('0x2d')]!==_0x3958('0x3c')){var _0x1a8713={};_0x1a8713[_0x32f43e[_0x3958('0x27')]]={'$like':'%'+_0x44c0f7[_0x3958('0x31')][_0x3958('0x3a')]+'%'};return _0x1a8713;}})});}_0x4ffb8f=_[_0x3958('0x3b')]({},_0x4ffb8f,_0x44c0f7[_0x3958('0x3d')]);var _0x30dd87={'where':_0x4ffb8f[_0x3958('0x39')]};return db[_0x3958('0x2b')]['count'](_0x30dd87)[_0x3958('0x24')](function(_0x1b9d24){_0x33fb7f[_0x3958('0x3e')]=_0x1b9d24;if(_0x44c0f7[_0x3958('0x31')]['includeAll']){_0x4ffb8f['include']=[{'all':!![]}];}return db[_0x3958('0x2b')][_0x3958('0x3f')](_0x4ffb8f);})[_0x3958('0x24')](function(_0x11db19){_0x33fb7f[_0x3958('0x40')]=_0x11db19;return _0x33fb7f;})[_0x3958('0x24')](respondWithFilteredResult(_0x1dc9be,_0x4ffb8f))[_0x3958('0x41')](handleError(_0x1dc9be,null));};exports[_0x3958('0x42')]=function(_0x28ceb5,_0x500254){var _0x1e9a10={'raw':!![],'where':{'id':_0x28ceb5[_0x3958('0x43')]['id']}},_0x43c6cf={};_0x43c6cf[_0x3958('0x2f')]=_['keys'](db[_0x3958('0x2b')][_0x3958('0x44')]);_0x43c6cf[_0x3958('0x31')]=_['keys'](_0x28ceb5[_0x3958('0x31')]);_0x43c6cf[_0x3958('0x32')]=_[_0x3958('0x33')](_0x43c6cf['model'],_0x43c6cf['query']);_0x1e9a10[_0x3958('0x35')]=_['intersection'](_0x43c6cf[_0x3958('0x2f')],qs[_0x3958('0x34')](_0x28ceb5['query'][_0x3958('0x34')]));_0x1e9a10[_0x3958('0x35')]=_0x1e9a10[_0x3958('0x35')][_0x3958('0x36')]?_0x1e9a10[_0x3958('0x35')]:_0x43c6cf['model'];if(_0x28ceb5[_0x3958('0x31')][_0x3958('0x45')]){_0x1e9a10[_0x3958('0x46')]=[{'all':!![]}];}_0x1e9a10=_[_0x3958('0x3b')]({},_0x1e9a10,_0x28ceb5[_0x3958('0x3d')]);return db['Attachment'][_0x3958('0x47')](_0x1e9a10)[_0x3958('0x24')](handleEntityNotFound(_0x500254,null))[_0x3958('0x24')](respondWithResult(_0x500254,null))[_0x3958('0x41')](handleError(_0x500254,null));};exports[_0x3958('0x48')]=function(_0x3d1b64,_0x503efb){var _0x3fb78f={'where':{'id':_0x3d1b64[_0x3958('0x43')]['id']}},_0x44815e={};_0x44815e[_0x3958('0x2f')]=_[_0x3958('0x30')](db[_0x3958('0x2b')][_0x3958('0x44')]);_0x3fb78f['attributes']=_[_0x3958('0x33')](_0x44815e['model'],qs[_0x3958('0x34')](_0x3d1b64[_0x3958('0x31')][_0x3958('0x34')]));_0x3fb78f[_0x3958('0x35')]=_0x3fb78f[_0x3958('0x35')]['length']?_0x3fb78f['attributes']:_0x44815e[_0x3958('0x2f')];if(_0x3d1b64[_0x3958('0x31')][_0x3958('0x45')]){_0x3fb78f[_0x3958('0x46')]=[{'all':!![]}];}_0x3fb78f=_['merge']({},_0x3fb78f,_0x3d1b64[_0x3958('0x3d')]);return db[_0x3958('0x2b')]['find'](_0x3fb78f)[_0x3958('0x24')](handleEntityNotFound(_0x503efb,null))[_0x3958('0x24')](function(_0x35a03f){if(_0x35a03f){var _0x35eb67=_0x35a03f[_0x3958('0x49')]({'plain':!![]});_0x35eb67=qs[_0x3958('0x4a')](_0x35eb67,['id',_0x3958('0x4b'),'updatedAt']);_0x3d1b64['body']=_['omit'](_0x3d1b64[_0x3958('0x4c')],['id','createdAt',_0x3958('0x4d')]);return db[_0x3958('0x2b')][_0x3958('0x4e')](_[_0x3958('0x3b')](_0x35eb67,_0x3d1b64['body']),{'include':_0x3d1b64[_0x3958('0x31')][_0x3958('0x45')]?[{'all':!![]}]:undefined});}})[_0x3958('0x24')](respondWithResult(_0x503efb,0xc9))[_0x3958('0x41')](handleError(_0x503efb,null));};exports[_0x3958('0x22')]=function(_0x44f217,_0x5a35c2){if(_0x44f217[_0x3958('0x4c')]['id']){delete _0x44f217[_0x3958('0x4c')]['id'];}return db['Attachment']['find']({'where':{'id':_0x44f217[_0x3958('0x43')]['id']}})[_0x3958('0x24')](handleEntityNotFound(_0x5a35c2,null))['then'](saveUpdates(_0x44f217['body'],null))[_0x3958('0x24')](respondWithResult(_0x5a35c2,null))[_0x3958('0x41')](handleError(_0x5a35c2,null));};exports[_0x3958('0x23')]=function(_0x27eef6,_0x4871de){return db['Attachment'][_0x3958('0x47')]({'where':{'id':_0x27eef6[_0x3958('0x43')]['id']}})[_0x3958('0x24')](handleEntityNotFound(_0x4871de,null))['then'](removeEntity(_0x4871de,null))['catch'](handleError(_0x4871de,null));};exports['create']=function(_0x32fe74,_0x3d19b9,_0x202cf9){_0x32fe74['body'][_0x3958('0x27')]=_0x32fe74['file'][_0x3958('0x4f')];_0x32fe74[_0x3958('0x4c')][_0x3958('0x50')]=_0x32fe74[_0x3958('0x51')][_0x3958('0x52')];_0x32fe74[_0x3958('0x4c')][_0x3958('0x2d')]=_0x32fe74[_0x3958('0x51')]['mimetype'];return db[_0x3958('0x2b')]['create'](_0x32fe74[_0x3958('0x4c')])[_0x3958('0x24')](respondWithResult(_0x3d19b9,0xc9))[_0x3958('0x41')](handleError(_0x3d19b9,null));};exports['download']=function(_0x3efe48,_0x1fb4ca,_0x31e3af){return db[_0x3958('0x2b')][_0x3958('0x53')]({'where':{'id':_0x3efe48[_0x3958('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1fb4ca,null))[_0x3958('0x24')](function(_0x508e47){if(_0x508e47){return _0x1fb4ca[_0x3958('0x54')](path[_0x3958('0x55')](config[_0x3958('0x56')],_0x3958('0x57'),_0x508e47[_0x3958('0x50')]));}})[_0x3958('0x41')](handleError(_0x1fb4ca,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 37fdac2..dd224ba 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 _0xf65d=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','attachments','lodash'];(function(_0x5b963e,_0x58c3c4){var _0xd70ead=function(_0x444928){while(--_0x444928){_0x5b963e['push'](_0x5b963e['shift']());}};_0xd70ead(++_0x58c3c4);}(_0xf65d,0x9f));var _0xdf65=function(_0x2a2385,_0x483814){_0x2a2385=_0x2a2385-0x0;var _0x2c75=_0xf65d[_0x2a2385];return _0x2c75;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('Attachment',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4959=['attachments','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Attachment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4959,0x9b));var _0x9495=function(_0x135f17,_0x598388){_0x135f17=_0x135f17-0x0;var _0x28ca45=_0x4959[_0x135f17];return _0x28ca45;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9495('0x0'))(_0x9495('0x1'));var moment=require(_0x9495('0x2'));var BPromise=require('bluebird');var rp=require(_0x9495('0x3'));var fs=require('fs');var path=require(_0x9495('0x4'));var rimraf=require(_0x9495('0x5'));var config=require(_0x9495('0x6'));var attributes=require('./attachment.attributes');module[_0x9495('0x7')]=function(_0x2225a0,_0x2c716d){return _0x2225a0[_0x9495('0x8')](_0x9495('0x9'),attributes,{'tableName':_0x9495('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 60a7e63..8f4bef6 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 _0xf047=['body','options','then','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Attachment','create'];(function(_0x554f80,_0x34e8f2){var _0x343538=function(_0x5169c4){while(--_0x5169c4){_0x554f80['push'](_0x554f80['shift']());}};_0x343538(++_0x34e8f2);}(_0xf047,0x17d));var _0x7f04=function(_0x1b3c51,_0x3d9de6){_0x1b3c51=_0x1b3c51-0x0;var _0x1a455f=_0xf047[_0x1b3c51];return _0x1a455f;};'use strict';var _=require(_0x7f04('0x0'));var util=require(_0x7f04('0x1'));var moment=require(_0x7f04('0x2'));var BPromise=require(_0x7f04('0x3'));var rs=require(_0x7f04('0x4'));var fs=require('fs');var Redis=require(_0x7f04('0x5'));var db=require(_0x7f04('0x6'))['db'];var utils=require(_0x7f04('0x7'));var logger=require('../../config/logger')(_0x7f04('0x8'));var config=require(_0x7f04('0x9'));var jayson=require(_0x7f04('0xa'));var client=jayson[_0x7f04('0xb')][_0x7f04('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52e21e,_0x443ab7,_0x208bb6){return new BPromise(function(_0x9a67f0,_0x369107){return client[_0x7f04('0xd')](_0x52e21e,_0x208bb6)['then'](function(_0x3fa68d){logger[_0x7f04('0xe')](_0x7f04('0xf'),_0x443ab7,_0x7f04('0x10'));logger[_0x7f04('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x443ab7,'request\x20sent',JSON[_0x7f04('0x12')](_0x3fa68d));if(_0x3fa68d[_0x7f04('0x13')]){if(_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x14')]===0x1f4){logger[_0x7f04('0x13')](_0x7f04('0xf'),_0x443ab7,_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);return _0x369107(_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);}logger[_0x7f04('0x13')]('Attachment,\x20%s,\x20%s',_0x443ab7,_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);return _0x9a67f0(_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);}else{logger[_0x7f04('0xe')](_0x7f04('0xf'),_0x443ab7,_0x7f04('0x10'));_0x9a67f0(_0x3fa68d['result'][_0x7f04('0x15')]);}})[_0x7f04('0x16')](function(_0x4f2689){logger[_0x7f04('0x13')](_0x7f04('0xf'),_0x443ab7,_0x4f2689);_0x369107(_0x4f2689);});});}exports['CreateAttachment']=function(_0x49e396){var _0x63e606=this;return new Promise(function(_0x56befc,_0x5adb17){return db[_0x7f04('0x17')][_0x7f04('0x18')](_0x49e396[_0x7f04('0x19')],{'raw':_0x49e396[_0x7f04('0x1a')]?_0x49e396[_0x7f04('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7f04('0x1b')](function(_0x36d0a8){logger[_0x7f04('0xe')](_0x7f04('0x1c'),_0x49e396);logger[_0x7f04('0x11')]('CreateAttachment',_0x49e396,JSON['stringify'](_0x36d0a8));_0x56befc(_0x36d0a8);})[_0x7f04('0x16')](function(_0x334ee5){logger[_0x7f04('0x13')](_0x7f04('0x1c'),_0x334ee5[_0x7f04('0x15')],_0x49e396);_0x5adb17(_0x63e606[_0x7f04('0x13')](0x1f4,_0x334ee5['message']));});});}; \ No newline at end of file +var _0x730d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create','body','options','info','CreateAttachment','lodash','moment','bluebird','randomstring'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x730d,0x11e));var _0xd730=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x730d[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xd730('0x0'));var util=require('util');var moment=require(_0xd730('0x1'));var BPromise=require(_0xd730('0x2'));var rs=require(_0xd730('0x3'));var fs=require('fs');var Redis=require(_0xd730('0x4'));var db=require(_0xd730('0x5'))['db'];var utils=require(_0xd730('0x6'));var logger=require(_0xd730('0x7'))(_0xd730('0x8'));var config=require('../../config/environment');var jayson=require(_0xd730('0x9'));var client=jayson[_0xd730('0xa')][_0xd730('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc46b9c,_0x5a1027,_0x375b99){return new BPromise(function(_0xfe9ae4,_0x1ef189){return client[_0xd730('0xc')](_0xc46b9c,_0x375b99)[_0xd730('0xd')](function(_0x49596e){logger['info']('Attachment,\x20%s,\x20%s',_0x5a1027,_0xd730('0xe'));logger[_0xd730('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5a1027,_0xd730('0xe'),JSON[_0xd730('0x10')](_0x49596e));if(_0x49596e[_0xd730('0x11')]){if(_0x49596e['error'][_0xd730('0x12')]===0x1f4){logger[_0xd730('0x11')](_0xd730('0x13'),_0x5a1027,_0x49596e[_0xd730('0x11')][_0xd730('0x14')]);return _0x1ef189(_0x49596e[_0xd730('0x11')][_0xd730('0x14')]);}logger['error'](_0xd730('0x13'),_0x5a1027,_0x49596e[_0xd730('0x11')]['message']);return _0xfe9ae4(_0x49596e[_0xd730('0x11')]['message']);}else{logger['info'](_0xd730('0x13'),_0x5a1027,_0xd730('0xe'));_0xfe9ae4(_0x49596e[_0xd730('0x15')][_0xd730('0x14')]);}})[_0xd730('0x16')](function(_0x443bcf){logger['error'](_0xd730('0x13'),_0x5a1027,_0x443bcf);_0x1ef189(_0x443bcf);});});}exports['CreateAttachment']=function(_0x46e6a1){var _0x403e17=this;return new Promise(function(_0x62bd1d,_0x4527ce){return db[_0xd730('0x17')][_0xd730('0x18')](_0x46e6a1[_0xd730('0x19')],{'raw':_0x46e6a1[_0xd730('0x1a')]?_0x46e6a1[_0xd730('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd730('0xd')](function(_0x3e965d){logger[_0xd730('0x1b')]('CreateAttachment',_0x46e6a1);logger[_0xd730('0xf')](_0xd730('0x1c'),_0x46e6a1,JSON[_0xd730('0x10')](_0x3e965d));_0x62bd1d(_0x3e965d);})[_0xd730('0x16')](function(_0x13cb64){logger[_0xd730('0x11')]('CreateAttachment',_0x13cb64[_0xd730('0x14')],_0x46e6a1);_0x4527ce(_0x403e17[_0xd730('0x11')](0x1f4,_0x13cb64[_0xd730('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 565a863..67af451 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 _0xc936=['exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','join','root','server/files/attachments/','format','%s-%s','originalname','post','file','create','put','delete','destroy'];(function(_0x3f5900,_0x16c0f4){var _0x53b040=function(_0x5b2e00){while(--_0x5b2e00){_0x3f5900['push'](_0x3f5900['shift']());}};_0x53b040(++_0x16c0f4);}(_0xc936,0x153));var _0x6c93=function(_0x3e802d,_0x255903){_0x3e802d=_0x3e802d-0x0;var _0x5e011e=_0xc936[_0x3e802d];return _0x5e011e;};'use strict';var multer=require('multer');var util=require(_0x6c93('0x0'));var path=require('path');var timeout=require(_0x6c93('0x1'));var express=require(_0x6c93('0x2'));var router=express[_0x6c93('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6c93('0x4'));var config=require(_0x6c93('0x5'));var controller=require('./attachment.controller');router[_0x6c93('0x6')]('/',auth[_0x6c93('0x7')](),controller['index']);router['get'](_0x6c93('0x8'),auth[_0x6c93('0x7')](),controller[_0x6c93('0x9')]);router[_0x6c93('0x6')](_0x6c93('0xa'),auth[_0x6c93('0x7')](),controller[_0x6c93('0xb')]);router['post'](_0x6c93('0xc'),auth[_0x6c93('0x7')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19493b,_0x1d17af,_0x53487e){_0x53487e(null,path[_0x6c93('0xd')](config[_0x6c93('0xe')],_0x6c93('0xf')));},'filename':function(_0x4a475f,_0x4cbe9a,_0x244681){_0x244681(null,util[_0x6c93('0x10')](_0x6c93('0x11'),Date['now'](),_0x4cbe9a[_0x6c93('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6c93('0x13')]('/',upload['single'](_0x6c93('0x14')),controller[_0x6c93('0x15')]);router[_0x6c93('0x16')](_0x6c93('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x6c93('0x17')]('/:id',auth[_0x6c93('0x7')](),controller[_0x6c93('0x18')]);module[_0x6c93('0x19')]=router; \ No newline at end of file +var _0x672d=['single','file','create','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','download','post','/:id/clone','clone','join','root','server/files/attachments/','format','%s-%s','now','replace'];(function(_0x36665f,_0x4f9488){var _0x481d25=function(_0x3779cc){while(--_0x3779cc){_0x36665f['push'](_0x36665f['shift']());}};_0x481d25(++_0x4f9488);}(_0x672d,0x181));var _0xd672=function(_0x4c4a94,_0x4fa642){_0x4c4a94=_0x4c4a94-0x0;var _0x4fb4a7=_0x672d[_0x4c4a94];return _0x4fb4a7;};'use strict';var multer=require(_0xd672('0x0'));var util=require('util');var path=require(_0xd672('0x1'));var timeout=require(_0xd672('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd672('0x3'));var config=require(_0xd672('0x4'));var controller=require('./attachment.controller');router[_0xd672('0x5')]('/',auth['isAuthenticated'](),controller[_0xd672('0x6')]);router[_0xd672('0x5')](_0xd672('0x7'),auth[_0xd672('0x8')](),controller[_0xd672('0x9')]);router[_0xd672('0x5')]('/:id/download',auth[_0xd672('0x8')](),controller[_0xd672('0xa')]);router[_0xd672('0xb')](_0xd672('0xc'),auth[_0xd672('0x8')](),controller[_0xd672('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ae10e,_0x10a391,_0x1a02d9){_0x1a02d9(null,path[_0xd672('0xe')](config[_0xd672('0xf')],_0xd672('0x10')));},'filename':function(_0x4f2338,_0x339813,_0x51f4db){_0x51f4db(null,util[_0xd672('0x11')](_0xd672('0x12'),Date[_0xd672('0x13')](),_0x339813['originalname'][_0xd672('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd672('0xb')]('/',upload[_0xd672('0x15')](_0xd672('0x16')),controller[_0xd672('0x17')]);router[_0xd672('0x18')]('/:id',auth[_0xd672('0x8')](),controller[_0xd672('0x19')]);router[_0xd672('0x1a')]('/:id',auth[_0xd672('0x8')](),controller[_0xd672('0x1b')]);module[_0xd672('0x1c')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index abb4dce..b6a9ee9 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 _0x3654=['disabled','blockedAt','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','profile','email','callback','/login','use','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','map','emails','admin','user','agent'];(function(_0x5f40d3,_0x23d963){var _0x1f9ea0=function(_0xe80242){while(--_0xe80242){_0x5f40d3['push'](_0x5f40d3['shift']());}};_0x1f9ea0(++_0x23d963);}(_0x3654,0x1d4));var _0x4365=function(_0x3cf2d9,_0x43df12){_0x3cf2d9=_0x3cf2d9-0x0;var _0x2682eb=_0x3654[_0x3cf2d9];return _0x2682eb;};'use strict';var _=require('lodash');var passport=require(_0x4365('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0x4365('0x1')];var moment=require('moment');var db=require(_0x4365('0x2'))['db'];var config=require(_0x4365('0x3'));var signToken=require(_0x4365('0x4'))[_0x4365('0x5')];var utils=require(_0x4365('0x6'));exports[_0x4365('0x7')]=passport['authenticate'](_0x4365('0x8'),{'failureRedirect':'/login','scope':[_0x4365('0x9'),_0x4365('0xa')],'session':![]});exports[_0x4365('0xb')]=passport['authenticate']('google',{'failureRedirect':_0x4365('0xc'),'session':![]});passport[_0x4365('0xd')](new GoogleStrategy({'clientID':config[_0x4365('0x8')]?config[_0x4365('0x8')][_0x4365('0xe')]:'id','clientSecret':config[_0x4365('0x8')]?config[_0x4365('0x8')][_0x4365('0xf')]:_0x4365('0x10'),'callbackURL':config[_0x4365('0x8')]?config[_0x4365('0x8')]['callbackURL']:''},function(_0x5d1471,_0x28c8d9,_0x4b9409,_0x5528d3){var _0x45a1e5,_0x34c62a;return db[_0x4365('0x11')][_0x4365('0x12')]({'where':{'id':0x1},'attributes':[_0x4365('0x13'),_0x4365('0x14')],'raw':!![]})[_0x4365('0x15')](function(_0x30ca69){_0x45a1e5=_0x30ca69;return db['User']['find']({'where':{'email':_[_0x4365('0x16')](_0x4b9409[_0x4365('0x17')],'value'),'role':{'$or':[_0x4365('0x18'),_0x4365('0x19'),_0x4365('0x1a')]}}});})['then'](function(_0x3c0adf){_0x34c62a=_0x3c0adf;if(_0x34c62a){if(_0x34c62a[_0x4365('0x1b')]){return _0x5528d3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x45a1e5['blockDuration']>0x0){if(_0x34c62a['blocked']){if(moment(_0x34c62a[_0x4365('0x1c')])['add'](_0x45a1e5['blockDuration'],'minutes')>moment()){return _0x5528d3(_0x4365('0x1d'));}else{return utils[_0x4365('0x1e')](_0x34c62a,0x0,![],null)['then'](function(){return utils[_0x4365('0x1f')](_0x34c62a);})[_0x4365('0x15')](function(){return _0x5528d3(null,_0x34c62a);});}}else{return utils[_0x4365('0x1f')](_0x34c62a)['then'](function(){return _0x5528d3(null,_0x34c62a);});}}else{return utils[_0x4365('0x1f')](_0x34c62a)['then'](function(){return _0x5528d3(null,_0x34c62a);});}}return _0x5528d3(_0x4365('0x1d'));})[_0x4365('0x20')](function(_0x24945c){_0x5528d3(_0x24945c);});})); \ No newline at end of file +var _0x59e0=['User','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','signToken','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','allowedLoginAttempts'];(function(_0x3a062d,_0x503f80){var _0x2c5410=function(_0x1a5d54){while(--_0x1a5d54){_0x3a062d['push'](_0x3a062d['shift']());}};_0x2c5410(++_0x503f80);}(_0x59e0,0x1e6));var _0x059e=function(_0x61ed56,_0x4d394a){_0x61ed56=_0x61ed56-0x0;var _0x224ba8=_0x59e0[_0x61ed56];return _0x224ba8;};'use strict';var _=require('lodash');var passport=require(_0x059e('0x0'));var GoogleStrategy=require(_0x059e('0x1'))[_0x059e('0x2')];var moment=require(_0x059e('0x3'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x059e('0x4')];var utils=require('../../config/utils');exports[_0x059e('0x5')]=passport[_0x059e('0x6')](_0x059e('0x7'),{'failureRedirect':_0x059e('0x8'),'scope':[_0x059e('0x9'),_0x059e('0xa')],'session':![]});exports[_0x059e('0xb')]=passport[_0x059e('0x6')](_0x059e('0x7'),{'failureRedirect':'/login','session':![]});passport[_0x059e('0xc')](new GoogleStrategy({'clientID':config[_0x059e('0x7')]?config[_0x059e('0x7')][_0x059e('0xd')]:'id','clientSecret':config[_0x059e('0x7')]?config['google'][_0x059e('0xe')]:_0x059e('0xf'),'callbackURL':config[_0x059e('0x7')]?config['google'][_0x059e('0x10')]:''},function(_0x288e0c,_0x48f1df,_0x414ff7,_0x3adcc9){var _0x49679a,_0x416eb7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x059e('0x11'),'blockDuration'],'raw':!![]})['then'](function(_0x9adcac){_0x49679a=_0x9adcac;return db[_0x059e('0x12')]['find']({'where':{'email':_['map'](_0x414ff7['emails'],'value'),'role':{'$or':[_0x059e('0x13'),_0x059e('0x14'),'agent']}}});})[_0x059e('0x15')](function(_0x362262){_0x416eb7=_0x362262;if(_0x416eb7){if(_0x416eb7[_0x059e('0x16')]){return _0x3adcc9(_0x059e('0x17'));}else if(_0x49679a[_0x059e('0x18')]>0x0){if(_0x416eb7['blocked']){if(moment(_0x416eb7[_0x059e('0x19')])['add'](_0x49679a['blockDuration'],'minutes')>moment()){return _0x3adcc9(_0x059e('0x17'));}else{return utils[_0x059e('0x1a')](_0x416eb7,0x0,![],null)['then'](function(){return utils[_0x059e('0x1b')](_0x416eb7);})[_0x059e('0x15')](function(){return _0x3adcc9(null,_0x416eb7);});}}else{return utils[_0x059e('0x1b')](_0x416eb7)[_0x059e('0x15')](function(){return _0x3adcc9(null,_0x416eb7);});}}else{return utils['getLicense'](_0x416eb7)[_0x059e('0x15')](function(){return _0x3adcc9(null,_0x416eb7);});}}return _0x3adcc9(_0x059e('0x17'));})['catch'](function(_0x5aab7d){_0x3adcc9(_0x5aab7d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index deea8ee..19e69c0 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 _0xd0b5=['Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x4ce1cd,_0x346e6e){_0x4ce1cd=_0x4ce1cd-0x0;var _0x5bd8e7=_0xd0b5[_0x4ce1cd];return _0x5bd8e7;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x5d0b('0x0')]();var controller=require(_0x5d0b('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x5d0b('0x2'));router[_0x5d0b('0x3')]('/',controller[_0x5d0b('0x4')]);router[_0x5d0b('0x3')](_0x5d0b('0x5'),controller[_0x5d0b('0x6')],authService[_0x5d0b('0x7')],userController[_0x5d0b('0x4')],authService[_0x5d0b('0x8')]);module[_0x5d0b('0x9')]=router; \ No newline at end of file +var _0xc3b0=['login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','get'];(function(_0x32540e,_0x33ac43){var _0x69befd=function(_0x30bcad){while(--_0x30bcad){_0x32540e['push'](_0x32540e['shift']());}};_0x69befd(++_0x33ac43);}(_0xc3b0,0x166));var _0x0c3b=function(_0x5a6bf5,_0x544768){_0x5a6bf5=_0x5a6bf5-0x0;var _0x1d1b78=_0xc3b0[_0x5a6bf5];return _0x1d1b78;};'use strict';var express=require(_0x0c3b('0x0'));var passport=require(_0x0c3b('0x1'));var router=express[_0x0c3b('0x2')]();var controller=require(_0x0c3b('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x0c3b('0x4')]('/',controller[_0x0c3b('0x5')]);router['get'](_0x0c3b('0x6'),controller[_0x0c3b('0x7')],authService[_0x0c3b('0x8')],userController['login'],authService[_0x0c3b('0x9')]);module[_0x0c3b('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 3848bf0..deeade0 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 _0x781d=['http','findOne','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','minutes','clearBlockUser','getLicense','catch','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','password','previousPasswords','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client'];(function(_0x592bd3,_0x225e7b){var _0x2af039=function(_0x7aae0a){while(--_0x7aae0a){_0x592bd3['push'](_0x592bd3['shift']());}};_0x2af039(++_0x225e7b);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var util=require(_0xd781('0x0'));var passport=require(_0xd781('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xd781('0x2'));var _=require(_0xd781('0x3'));var rs=require(_0xd781('0x4'));var moment=require(_0xd781('0x5'));var db=require(_0xd781('0x6'))['db'];var authService=require(_0xd781('0x7'));var utils=require(_0xd781('0x8'));var client=jayson[_0xd781('0x9')][_0xd781('0xa')]({'port':0x232b});function localAuthenticate(_0x2f98ee,_0x5a07f0,_0x133509,_0x1a242d){var _0x50610d,_0x248172;return db['Setting'][_0xd781('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd781('0xc')],'raw':!![]})[_0xd781('0xd')](function(_0x509ca7){_0x50610d=_0x509ca7;return _0x2f98ee[_0xd781('0xb')]({'attributes':['id',_0xd781('0xe'),'password','salt',_0xd781('0xf'),_0xd781('0x10'),_0xd781('0x11'),_0xd781('0x12'),_0xd781('0x13')],'where':{'name':_0x5a07f0,'role':{'$or':[_0xd781('0x14'),_0xd781('0x15'),_0xd781('0x16')]}}});})[_0xd781('0xd')](function(_0x12b1b2){if(!_0x12b1b2||_0x12b1b2&&_0x12b1b2[_0xd781('0xe')]!==_0x5a07f0){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x248172=_0x12b1b2;return _0x248172;}})[_0xd781('0xd')](function(){_0x248172[_0xd781('0x17')](_0x133509,function(_0x498674,_0x3a1f48){var _0x48bffc=_0x248172[_0xd781('0x13')]+0x1;if(_0x498674){return _0x1a242d(_0x498674);}else if(!_0x3a1f48){if(_0x248172[_0xd781('0x10')]){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else if(_0x50610d[_0xd781('0x19')]>0x0){if(_0x248172[_0xd781('0x11')]){if(_0x50610d[_0xd781('0xc')]>0x0){if(moment(_0x248172[_0xd781('0x12')])['add'](_0x50610d[_0xd781('0xc')],_0xd781('0x1a'))>moment()){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else{return utils[_0xd781('0x1b')](_0x248172,_0x48bffc,![],null)[_0xd781('0xd')](function(){return _0x1a242d(null,![],{'message':_0xd781('0x18')});});}}else{return _0x1a242d(null,![],{'message':_0xd781('0x18')});}}else{if(_0x48bffc>=_0x50610d[_0xd781('0x19')]){return utils['clearBlockUser'](_0x248172,0x0,!![],moment())[_0xd781('0xd')](function(){return _0x1a242d(null,![],{'message':_0xd781('0x18')});});}else{return utils[_0xd781('0x1b')](_0x248172,_0x48bffc,![],null)[_0xd781('0xd')](function(){return _0x1a242d(null,![],{'message':_0xd781('0x18')});});}}}else{return _0x1a242d(null,![],{'message':_0xd781('0x18')});}}else{if(_0x248172[_0xd781('0x10')]){return _0x1a242d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x50610d[_0xd781('0x19')]>0x0){if(_0x248172['blocked']){if(_0x50610d['blockDuration']>0x0){if(moment(_0x248172[_0xd781('0x12')])['add'](_0x50610d[_0xd781('0xc')],_0xd781('0x1a'))>moment()){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else{return utils[_0xd781('0x1b')](_0x248172,0x0,![],null)[_0xd781('0xd')](function(){return utils[_0xd781('0x1c')](_0x248172);})[_0xd781('0xd')](function(){return _0x1a242d(null,_0x248172);});}}else{return _0x1a242d(null,![],{'message':_0xd781('0x18')});}}else{return utils[_0xd781('0x1b')](_0x248172,0x0,![],null)['then'](function(){return utils['getLicense'](_0x248172);})[_0xd781('0xd')](function(){return _0x1a242d(null,_0x248172);})[_0xd781('0x1d')](function(_0xdad0b1){return _0x1a242d(null,![],_0xdad0b1);});}}else{if(_0x248172['blocked']){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else{return utils['getLicense'](_0x248172)['then'](function(){return _0x1a242d(null,_0x248172);});}}}});})[_0xd781('0x1d')](function(_0x54fe00){return _0x1a242d(null,![],_0x54fe00);});}function sendServiceMail(_0x3e868){return db[_0xd781('0x1e')]['find']({'where':{'service':!![]},'attributes':['id','name',_0xd781('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0xd781('0x20')}]})['then'](function(_0x21e802){if(!_0x21e802){throw new Error(_0xd781('0x21'));}var _0x556127={'tls':{'rejectUnauthorized':![]}};if(_0x21e802['Smtp'][_0xd781('0x22')]){_0x556127[_0xd781('0x22')]=_0x21e802[_0xd781('0x20')]['service'];}else{_0x556127['host']=_0x21e802[_0xd781('0x20')][_0xd781('0x23')];_0x556127[_0xd781('0x24')]=_0x21e802['Smtp']['port'];_0x556127[_0xd781('0x25')]=_0x21e802[_0xd781('0x20')]['secure'];}if(_0x21e802[_0xd781('0x20')][_0xd781('0x26')]){_0x556127['auth']={'user':_0x21e802[_0xd781('0x20')][_0xd781('0x15')],'pass':_0x21e802[_0xd781('0x20')][_0xd781('0x27')]};}var _0x51b711={'account':_0x556127,'message':_[_0xd781('0x28')]({'from':util[_0xd781('0x29')](_0xd781('0x2a'),_0x21e802[_0xd781('0xe')],_0x21e802['email']||_0x21e802[_0xd781('0x20')][_0xd781('0x15')])},_0x3e868)};return client['request'](_0xd781('0x2b'),_0x51b711);})['then'](function(_0x3e1603){if(_0x3e1603[_0xd781('0x2c')]){throw new Error(util['format'](_0xd781('0x2d'),_0x3e1603[_0xd781('0x2c')]['message']||JSON[_0xd781('0x2e')](_0x3e1603['error'])));}return!![];});}function handleError(_0x3bb1ee,_0x31d005,_0x48559a){return _0x3bb1ee[_0xd781('0x2f')](_0x31d005||0x1f4)[_0xd781('0x30')]({'message':_0x48559a?_0x48559a['message']||_0x48559a:''});}exports[_0xd781('0x31')]=function(_0x34528f,_0x281fcf,_0x58f763){passport[_0xd781('0x17')](_0xd781('0x32'),function(_0xff4cb2,_0x6c67f3,_0x2e8218){var _0x282d30=_0xff4cb2||_0x2e8218;if(_0x282d30){return handleError(_0x281fcf,0x191,_0x282d30);}if(!_0x6c67f3){return handleError(_0x281fcf,0x194,{'message':_0xd781('0x33')});}else{var _0x140567={'payload':{'id':_0x6c67f3['id'],'role':_0x6c67f3[_0xd781('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x140567)[_0xd781('0xd')](function(_0x5647ea){_0x281fcf[_0xd781('0x34')]({'id':_0x6c67f3['id'],'token':_0x5647ea,'statusCall':'','isAlreadyLogged':_0x6c67f3[_0xd781('0x35')]});});}})(_0x34528f,_0x281fcf,_0x58f763);};exports['forgot']=function(_0x1a5833,_0x3d49f4,_0x224488){if(!_0x1a5833[_0xd781('0x36')]['email']){return handleError(_0x3d49f4,0x1f4,{'message':_0xd781('0x37')});}var _0x515357=rs[_0xd781('0x38')]();_0x1a5833[_0xd781('0x36')]['email']=_0x1a5833['body'][_0xd781('0x1f')][_0xd781('0x39')]()[_0xd781('0x3a')]();var _0x23bbab;return db['Setting'][_0xd781('0xb')]({'where':{'id':0x1},'attributes':[_0xd781('0x19'),'blockDuration'],'raw':!![]})['then'](function(_0x263b3a){_0x23bbab=_0x263b3a;return db[_0xd781('0x3b')][_0xd781('0x3c')]({'where':{'email':_0x1a5833['body']['email']}});})[_0xd781('0xd')](function(_0x209b0f){if(!_0x209b0f){throw new Error(_0xd781('0x3d'));}if(_0x209b0f[_0xd781('0x10')]){throw new Error(_0xd781('0x3e'));}if(_0x209b0f[_0xd781('0x11')]){if(moment(_0x209b0f['blockedAt'])['add'](_0x23bbab[_0xd781('0xc')],_0xd781('0x1a'))>moment()){throw new Error(_0xd781('0x3f'));}else{_0x209b0f[_0xd781('0x11')]=![];_0x209b0f[_0xd781('0x12')]=null;}}_0x209b0f['resetPasswordToken']=_0x515357;_0x209b0f[_0xd781('0x40')]=Date[_0xd781('0x41')]()+0x36ee80;return _0x209b0f[_0xd781('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x1a5833[_0xd781('0x36')][_0xd781('0x1f')],'subject':_0xd781('0x43'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xd781('0x44')+_0xd781('0x45')+_0x1a5833['headers']['host']+_0xd781('0x46')+_0x515357+'\x0a\x0a'+_0xd781('0x47')});})[_0xd781('0xd')](function(){_0x3d49f4['status'](0xc8)[_0xd781('0x30')]({'message':_0xd781('0x48')});})[_0xd781('0x1d')](function(_0x39ecdb){return handleError(_0x3d49f4,0x1f4,_0x39ecdb);});};exports[_0xd781('0x49')]=function(_0x3828ad,_0x5e591a,_0x55eff9){return db[_0xd781('0x3b')][_0xd781('0x3c')]({'where':{'resetPasswordToken':_0x3828ad[_0xd781('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date[_0xd781('0x41')]()}}})[_0xd781('0xd')](function(_0x51dd6d){if(!_0x51dd6d){throw new Error(_0xd781('0x4b'));}return db[_0xd781('0x4c')][_0xd781('0xb')]({'attributes':['id',_0xd781('0x4d'),_0xd781('0x4e'),'passwordHistoryLimit']})[_0xd781('0xd')](function(_0x5ee0cb){if(_0x5ee0cb[_0xd781('0x4d')])authService['validatePasswordPattern'](_0x3828ad[_0xd781('0x36')][_0xd781('0x4f')]);if(!_0x5ee0cb['enforcePasswordHistory']||!_0x51dd6d[_0xd781('0x50')])return _0x51dd6d;authService['validatePasswordHistory'](_0x3828ad['body']['password'],_0x51dd6d[_0xd781('0x50')],_0x5ee0cb[_0xd781('0x51')]);return _0x51dd6d;})['then'](function(){_0x51dd6d[_0xd781('0x4f')]=_0x3828ad['body'][_0xd781('0x4f')];_0x51dd6d[_0xd781('0x52')]=null;_0x51dd6d[_0xd781('0x40')]=null;return _0x51dd6d[_0xd781('0x42')]();});})['then'](function(){_0x5e591a[_0xd781('0x2f')](0xc8)['send']({'message':_0xd781('0x53')});})['catch'](function(_0x3bf588){return handleError(_0x5e591a,0x1f4,_0x3bf588);});};passport[_0xd781('0x54')](new LocalStrategy({'usernameField':'name','passwordField':_0xd781('0x4f')},function(_0x11e486,_0xee40c9,_0x32fd9f){return localAuthenticate(db[_0xd781('0x3b')],_0x11e486,_0xee40c9,_0x32fd9f);})); \ No newline at end of file +var _0x8f9d=['catch','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','auth','merge','format','\x22%s\x22\x20<%s>','request','error','stringify','send','message','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','email','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','findOne','name','password','salt','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','loginAttempts','add','minutes','clearBlockUser','blocked','blockDuration','getLicense'];(function(_0x4bd632,_0x1cfa89){var _0xb49e18=function(_0x2d9057){while(--_0x2d9057){_0x4bd632['push'](_0x4bd632['shift']());}};_0xb49e18(++_0x1cfa89);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xd8f9('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd8f9('0x1'))['Strategy'];var jayson=require(_0xd8f9('0x2'));var _=require(_0xd8f9('0x3'));var rs=require(_0xd8f9('0x4'));var moment=require(_0xd8f9('0x5'));var db=require(_0xd8f9('0x6'))['db'];var authService=require(_0xd8f9('0x7'));var utils=require(_0xd8f9('0x8'));var client=jayson['client'][_0xd8f9('0x9')]({'port':0x232b});function localAuthenticate(_0x24dd1e,_0x25d417,_0x241aaa,_0xf6105){var _0x5c410f,_0x46babd;return db[_0xd8f9('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xd8f9('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x421aca){_0x5c410f=_0x421aca;return _0x24dd1e[_0xd8f9('0xc')]({'attributes':['id',_0xd8f9('0xd'),_0xd8f9('0xe'),_0xd8f9('0xf'),_0xd8f9('0x10'),_0xd8f9('0x11'),'blocked',_0xd8f9('0x12'),'loginAttempts'],'where':{'name':_0x25d417,'role':{'$or':[_0xd8f9('0x13'),_0xd8f9('0x14'),_0xd8f9('0x15')]}}});})['then'](function(_0x46468b){if(!_0x46468b||_0x46468b&&_0x46468b[_0xd8f9('0xd')]!==_0x25d417){throw new Error(_0xd8f9('0x16'));}else{_0x46babd=_0x46468b;return _0x46babd;}})[_0xd8f9('0x17')](function(){_0x46babd['authenticate'](_0x241aaa,function(_0x3529e9,_0x1525d6){var _0x234901=_0x46babd[_0xd8f9('0x18')]+0x1;if(_0x3529e9){return _0xf6105(_0x3529e9);}else if(!_0x1525d6){if(_0x46babd[_0xd8f9('0x11')]){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else if(_0x5c410f[_0xd8f9('0xb')]>0x0){if(_0x46babd['blocked']){if(_0x5c410f['blockDuration']>0x0){if(moment(_0x46babd[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5c410f['blockDuration'],_0xd8f9('0x1a'))>moment()){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd8f9('0x1b')](_0x46babd,_0x234901,![],null)['then'](function(){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x234901>=_0x5c410f[_0xd8f9('0xb')]){return utils['clearBlockUser'](_0x46babd,0x0,!![],moment())[_0xd8f9('0x17')](function(){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});});}else{return utils[_0xd8f9('0x1b')](_0x46babd,_0x234901,![],null)[_0xd8f9('0x17')](function(){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});});}}}else{return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}}else{if(_0x46babd['disabled']){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else if(_0x5c410f[_0xd8f9('0xb')]>0x0){if(_0x46babd[_0xd8f9('0x1c')]){if(_0x5c410f[_0xd8f9('0x1d')]>0x0){if(moment(_0x46babd[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5c410f['blockDuration'],_0xd8f9('0x1a'))>moment()){return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}else{return utils[_0xd8f9('0x1b')](_0x46babd,0x0,![],null)[_0xd8f9('0x17')](function(){return utils[_0xd8f9('0x1e')](_0x46babd);})['then'](function(){return _0xf6105(null,_0x46babd);});}}else{return _0xf6105(null,![],{'message':_0xd8f9('0x16')});}}else{return utils[_0xd8f9('0x1b')](_0x46babd,0x0,![],null)[_0xd8f9('0x17')](function(){return utils[_0xd8f9('0x1e')](_0x46babd);})[_0xd8f9('0x17')](function(){return _0xf6105(null,_0x46babd);})[_0xd8f9('0x1f')](function(_0x175123){return _0xf6105(null,![],_0x175123);});}}else{if(_0x46babd[_0xd8f9('0x1c')]){return _0xf6105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd8f9('0x1e')](_0x46babd)[_0xd8f9('0x17')](function(){return _0xf6105(null,_0x46babd);});}}}});})[_0xd8f9('0x1f')](function(_0x58a3ca){return _0xf6105(null,![],_0x58a3ca);});}function sendServiceMail(_0x5bd32e){return db['MailAccount'][_0xd8f9('0x20')]({'where':{'service':!![]},'attributes':['id',_0xd8f9('0xd'),'email'],'include':[{'model':db[_0xd8f9('0x21')],'as':_0xd8f9('0x22')}]})['then'](function(_0x4b0de7){if(!_0x4b0de7){throw new Error(_0xd8f9('0x23'));}var _0x2786db={'tls':{'rejectUnauthorized':![]}};if(_0x4b0de7['Smtp'][_0xd8f9('0x24')]){_0x2786db['service']=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x24')];}else{_0x2786db['host']=_0x4b0de7[_0xd8f9('0x22')]['host'];_0x2786db[_0xd8f9('0x25')]=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x25')];_0x2786db[_0xd8f9('0x26')]=_0x4b0de7[_0xd8f9('0x22')][_0xd8f9('0x26')];}if(_0x4b0de7[_0xd8f9('0x22')]['authentication']){_0x2786db[_0xd8f9('0x27')]={'user':_0x4b0de7['Smtp']['user'],'pass':_0x4b0de7['Smtp']['pass']};}var _0x3690d7={'account':_0x2786db,'message':_[_0xd8f9('0x28')]({'from':util[_0xd8f9('0x29')](_0xd8f9('0x2a'),_0x4b0de7[_0xd8f9('0xd')],_0x4b0de7['email']||_0x4b0de7['Smtp'][_0xd8f9('0x14')])},_0x5bd32e)};return client[_0xd8f9('0x2b')]('SendMail',_0x3690d7);})[_0xd8f9('0x17')](function(_0x204ead){if(_0x204ead[_0xd8f9('0x2c')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x204ead['error']['message']||JSON[_0xd8f9('0x2d')](_0x204ead[_0xd8f9('0x2c')])));}return!![];});}function handleError(_0x324541,_0x219c5f,_0x1d41e2){return _0x324541['status'](_0x219c5f||0x1f4)[_0xd8f9('0x2e')]({'message':_0x1d41e2?_0x1d41e2[_0xd8f9('0x2f')]||_0x1d41e2:''});}exports[_0xd8f9('0x30')]=function(_0xb9ba18,_0x2758e8,_0x16e1f8){passport[_0xd8f9('0x31')](_0xd8f9('0x32'),function(_0x36aa04,_0x1953af,_0x2a94d6){var _0x5d16b8=_0x36aa04||_0x2a94d6;if(_0x5d16b8){return handleError(_0x2758e8,0x191,_0x5d16b8);}if(!_0x1953af){return handleError(_0x2758e8,0x194,{'message':_0xd8f9('0x33')});}else{var _0x3cfd69={'payload':{'id':_0x1953af['id'],'role':_0x1953af[_0xd8f9('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xd8f9('0x34')](_0x3cfd69)['then'](function(_0x157dfd){_0x2758e8[_0xd8f9('0x35')]({'id':_0x1953af['id'],'token':_0x157dfd,'statusCall':'','isAlreadyLogged':_0x1953af[_0xd8f9('0x36')]});});}})(_0xb9ba18,_0x2758e8,_0x16e1f8);};exports[_0xd8f9('0x37')]=function(_0x1ab301,_0x23330a,_0x597357){if(!_0x1ab301['body']['email']){return handleError(_0x23330a,0x1f4,{'message':_0xd8f9('0x38')});}var _0x293179=rs[_0xd8f9('0x39')]();_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')]=_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')][_0xd8f9('0x3c')]()[_0xd8f9('0x3d')]();var _0x5ed1b7;return db['Setting'][_0xd8f9('0xc')]({'where':{'id':0x1},'attributes':[_0xd8f9('0xb'),_0xd8f9('0x1d')],'raw':!![]})['then'](function(_0x5ad80d){_0x5ed1b7=_0x5ad80d;return db[_0xd8f9('0x3e')][_0xd8f9('0x20')]({'where':{'email':_0x1ab301[_0xd8f9('0x3a')]['email']}});})[_0xd8f9('0x17')](function(_0x388188){if(!_0x388188){throw new Error(_0xd8f9('0x3f'));}if(_0x388188[_0xd8f9('0x11')]){throw new Error(_0xd8f9('0x40'));}if(_0x388188[_0xd8f9('0x1c')]){if(moment(_0x388188[_0xd8f9('0x12')])[_0xd8f9('0x19')](_0x5ed1b7[_0xd8f9('0x1d')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x388188['blocked']=![];_0x388188[_0xd8f9('0x12')]=null;}}_0x388188[_0xd8f9('0x41')]=_0x293179;_0x388188[_0xd8f9('0x42')]=Date[_0xd8f9('0x43')]()+0x36ee80;return _0x388188[_0xd8f9('0x44')]();})[_0xd8f9('0x17')](function(){return sendServiceMail({'to':_0x1ab301[_0xd8f9('0x3a')][_0xd8f9('0x3b')],'subject':_0xd8f9('0x45'),'text':_0xd8f9('0x46')+_0xd8f9('0x47')+_0xd8f9('0x48')+_0x1ab301[_0xd8f9('0x49')]['host']+_0xd8f9('0x4a')+_0x293179+'\x0a\x0a'+_0xd8f9('0x4b')});})[_0xd8f9('0x17')](function(){_0x23330a[_0xd8f9('0x4c')](0xc8)['send']({'message':_0xd8f9('0x4d')});})['catch'](function(_0x59952e){return handleError(_0x23330a,0x1f4,_0x59952e);});};exports[_0xd8f9('0x4e')]=function(_0x14e622,_0x1614aa,_0x1361c4){return db[_0xd8f9('0x3e')][_0xd8f9('0x20')]({'where':{'resetPasswordToken':_0x14e622[_0xd8f9('0x4f')][_0xd8f9('0x50')],'resetPasswordExpires':{'$gt':Date[_0xd8f9('0x43')]()}}})[_0xd8f9('0x17')](function(_0x54b5d4){if(!_0x54b5d4){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xd8f9('0xc')]({'attributes':['id',_0xd8f9('0x51'),'enforcePasswordHistory',_0xd8f9('0x52')]})[_0xd8f9('0x17')](function(_0x1101ce){if(_0x1101ce[_0xd8f9('0x51')])authService[_0xd8f9('0x53')](_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')]);if(!_0x1101ce[_0xd8f9('0x54')]||!_0x54b5d4['previousPasswords'])return _0x54b5d4;authService[_0xd8f9('0x55')](_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')],_0x54b5d4[_0xd8f9('0x56')],_0x1101ce[_0xd8f9('0x52')]);return _0x54b5d4;})[_0xd8f9('0x17')](function(){_0x54b5d4[_0xd8f9('0xe')]=_0x14e622[_0xd8f9('0x3a')][_0xd8f9('0xe')];_0x54b5d4[_0xd8f9('0x41')]=null;_0x54b5d4[_0xd8f9('0x42')]=null;return _0x54b5d4['save']();});})[_0xd8f9('0x17')](function(){_0x1614aa[_0xd8f9('0x4c')](0xc8)[_0xd8f9('0x2e')]({'message':_0xd8f9('0x57')});})['catch'](function(_0x2de50d){return handleError(_0x1614aa,0x1f4,_0x2de50d);});};passport[_0xd8f9('0x58')](new LocalStrategy({'usernameField':_0xd8f9('0xd'),'passwordField':'password'},function(_0x101bd3,_0x195a46,_0x2218da){return localAuthenticate(db[_0xd8f9('0x3e')],_0x101bd3,_0x195a46,_0x2218da);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 229b273..60b691b 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 _0x1fd5=['Router','post','login','/forgot','forgot','/reset/:token','reset','express'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x1fd5,0x67));var _0x51fd=function(_0x363041,_0xf03c55){_0x363041=_0x363041-0x0;var _0x28802c=_0x1fd5[_0x363041];return _0x28802c;};'use strict';var express=require(_0x51fd('0x0'));var router=express[_0x51fd('0x1')]();var controller=require('./authLocal.controller');router[_0x51fd('0x2')]('/',controller[_0x51fd('0x3')]);router[_0x51fd('0x2')](_0x51fd('0x4'),controller[_0x51fd('0x5')]);router['post'](_0x51fd('0x6'),controller[_0x51fd('0x7')]);module['exports']=router; \ No newline at end of file +var _0x6ec0=['post','login','forgot','/reset/:token','reset','express','./authLocal.controller'];(function(_0x4bfc70,_0x4ddbfd){var _0x32f0ee=function(_0x24a180){while(--_0x24a180){_0x4bfc70['push'](_0x4bfc70['shift']());}};_0x32f0ee(++_0x4ddbfd);}(_0x6ec0,0x9f));var _0x06ec=function(_0x276dda,_0x79c0ae){_0x276dda=_0x276dda-0x0;var _0x40a023=_0x6ec0[_0x276dda];return _0x40a023;};'use strict';var express=require(_0x06ec('0x0'));var router=express['Router']();var controller=require(_0x06ec('0x1'));router[_0x06ec('0x2')]('/',controller[_0x06ec('0x3')]);router[_0x06ec('0x2')]('/forgot',controller[_0x06ec('0x4')]);router[_0x06ec('0x2')](_0x06ec('0x5'),controller[_0x06ec('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 48ad8ff..888b251 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 _0xc702=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x56803f,_0x115491){var _0x68e081=function(_0x1e83ee){while(--_0x1e83ee){_0x56803f['push'](_0x56803f['shift']());}};_0x68e081(++_0x115491);}(_0xc702,0x1de));var _0x2c70=function(_0xba68f4,_0x360370){_0xba68f4=_0xba68f4-0x0;var _0x5d128a=_0xc702[_0xba68f4];return _0x5d128a;};'use strict';var Sequelize=require(_0x2c70('0x0'));module[_0x2c70('0x1')]={'name':{'type':Sequelize[_0x2c70('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2c70('0x2')]},'description':{'type':Sequelize[_0x2c70('0x2')]},'status':{'type':Sequelize[_0x2c70('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2c70('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xa7b7=['STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7b7,0x1d6));var _0x7a7b=function(_0x565556,_0x477373){_0x565556=_0x565556-0x0;var _0x1c06f8=_0xa7b7[_0x565556];return _0x1c06f8;};'use strict';var Sequelize=require(_0x7a7b('0x0'));module[_0x7a7b('0x1')]={'name':{'type':Sequelize[_0x7a7b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x7a7b('0x2')]},'description':{'type':Sequelize[_0x7a7b('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7a7b('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 8ac9a46..f99b55e 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(_0x4aa98b,_0x46f68c){var _0x29d7ba=function(_0x154939){while(--_0x154939){_0x4aa98b['push'](_0x4aa98b['shift']());}};_0x29d7ba(++_0x46f68c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x36595c,_0x3228ca){var _0x55a293=function(_0x4a9346){while(--_0x4a9346){_0x36595c['push'](_0x36595c['shift']());}};_0x55a293(++_0x3228ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index db0b2af..5f5fbf7 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 _0x081f=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','Automation','tools_automations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x081f,0x14a));var _0xf081=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0x081f[_0x22c684];return _0x39fcbb;};'use strict';var _=require(_0xf081('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf081('0x1'));var moment=require(_0xf081('0x2'));var BPromise=require(_0xf081('0x3'));var rp=require(_0xf081('0x4'));var fs=require('fs');var path=require(_0xf081('0x5'));var rimraf=require('rimraf');var config=require(_0xf081('0x6'));var attributes=require(_0xf081('0x7'));module['exports']=function(_0x5e625a,_0x41f401){return _0x5e625a['define'](_0xf081('0x8'),attributes,{'tableName':_0xf081('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee24=['Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0xee24,0x80));var _0x4ee2=function(_0x1e8ec3,_0x3f0312){_0x1e8ec3=_0x1e8ec3-0x0;var _0x2d5f70=_0xee24[_0x1e8ec3];return _0x2d5f70;};'use strict';var _=require(_0x4ee2('0x0'));var util=require(_0x4ee2('0x1'));var logger=require(_0x4ee2('0x2'))(_0x4ee2('0x3'));var moment=require(_0x4ee2('0x4'));var BPromise=require(_0x4ee2('0x5'));var rp=require(_0x4ee2('0x6'));var fs=require('fs');var path=require(_0x4ee2('0x7'));var rimraf=require(_0x4ee2('0x8'));var config=require(_0x4ee2('0x9'));var attributes=require(_0x4ee2('0xa'));module['exports']=function(_0x4a4675,_0x2f80d8){return _0x4a4675[_0x4ee2('0xb')](_0x4ee2('0xc'),attributes,{'tableName':_0x4ee2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 4c83d81..8a80204 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 _0xdb1a=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x48a4b5,_0x29339c){var _0x1b1684=function(_0x5d7503){while(--_0x5d7503){_0x48a4b5['push'](_0x48a4b5['shift']());}};_0x1b1684(++_0x29339c);}(_0xdb1a,0xca));var _0xadb1=function(_0xdf1491,_0x168f90){_0xdf1491=_0xdf1491-0x0;var _0x1f9522=_0xdb1a[_0xdf1491];return _0x1f9522;};'use strict';var _=require(_0xadb1('0x0'));var util=require(_0xadb1('0x1'));var moment=require(_0xadb1('0x2'));var BPromise=require(_0xadb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb1('0x4'));var db=require(_0xadb1('0x5'))['db'];var utils=require(_0xadb1('0x6'));var logger=require('../../config/logger')(_0xadb1('0x7'));var config=require(_0xadb1('0x8'));var jayson=require(_0xadb1('0x9'));var client=jayson[_0xadb1('0xa')][_0xadb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaedf13,_0x3f2d92,_0x240c91){return new BPromise(function(_0x2b4749,_0x17ccf3){return client[_0xadb1('0xc')](_0xaedf13,_0x240c91)[_0xadb1('0xd')](function(_0x9d0258){logger['info']('Automation,\x20%s,\x20%s',_0x3f2d92,_0xadb1('0xe'));logger[_0xadb1('0xf')](_0xadb1('0x10'),_0x3f2d92,_0xadb1('0xe'),JSON[_0xadb1('0x11')](_0x9d0258));if(_0x9d0258[_0xadb1('0x12')]){if(_0x9d0258['error'][_0xadb1('0x13')]===0x1f4){logger[_0xadb1('0x12')](_0xadb1('0x14'),_0x3f2d92,_0x9d0258[_0xadb1('0x12')]['message']);return _0x17ccf3(_0x9d0258[_0xadb1('0x12')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x3f2d92,_0x9d0258[_0xadb1('0x12')]['message']);return _0x2b4749(_0x9d0258[_0xadb1('0x12')][_0xadb1('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3f2d92,_0xadb1('0xe'));_0x2b4749(_0x9d0258[_0xadb1('0x16')][_0xadb1('0x15')]);}})['catch'](function(_0x200e77){logger['error'](_0xadb1('0x14'),_0x3f2d92,_0x200e77);_0x17ccf3(_0x200e77);});});} \ No newline at end of file +var _0x361b=['stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x21adf5,_0x1a4e48){var _0x555ada=function(_0x5e5a96){while(--_0x5e5a96){_0x21adf5['push'](_0x21adf5['shift']());}};_0x555ada(++_0x1a4e48);}(_0x361b,0x97));var _0xb361=function(_0x584f4f,_0x5a676d){_0x584f4f=_0x584f4f-0x0;var _0x48db23=_0x361b[_0x584f4f];return _0x48db23;};'use strict';var _=require(_0xb361('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb361('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb361('0x2'));var db=require(_0xb361('0x3'))['db'];var utils=require(_0xb361('0x4'));var logger=require(_0xb361('0x5'))(_0xb361('0x6'));var config=require(_0xb361('0x7'));var jayson=require(_0xb361('0x8'));var client=jayson[_0xb361('0x9')][_0xb361('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32a10f,_0x413f23,_0x4d9bae){return new BPromise(function(_0x553d93,_0x546a1c){return client[_0xb361('0xb')](_0x32a10f,_0x4d9bae)[_0xb361('0xc')](function(_0x46bec2){logger[_0xb361('0xd')]('Automation,\x20%s,\x20%s',_0x413f23,_0xb361('0xe'));logger[_0xb361('0xf')](_0xb361('0x10'),_0x413f23,_0xb361('0xe'),JSON[_0xb361('0x11')](_0x46bec2));if(_0x46bec2['error']){if(_0x46bec2[_0xb361('0x12')][_0xb361('0x13')]===0x1f4){logger['error'](_0xb361('0x14'),_0x413f23,_0x46bec2['error'][_0xb361('0x15')]);return _0x546a1c(_0x46bec2['error'][_0xb361('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x413f23,_0x46bec2[_0xb361('0x12')][_0xb361('0x15')]);return _0x553d93(_0x46bec2[_0xb361('0x12')][_0xb361('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x413f23,'request\x20sent');_0x553d93(_0x46bec2[_0xb361('0x16')][_0xb361('0x15')]);}})[_0xb361('0x17')](function(_0x114d23){logger[_0xb361('0x12')](_0xb361('0x14'),_0x413f23,_0x114d23);_0x546a1c(_0x114d23);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c222036..0a37e34 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 _0x01f7=['/:id/actions','getActions','post','create','addActions','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions'];(function(_0x4fd1ec,_0x17069b){var _0x284ab7=function(_0x1ba6a4){while(--_0x1ba6a4){_0x4fd1ec['push'](_0x4fd1ec['shift']());}};_0x284ab7(++_0x17069b);}(_0x01f7,0xe1));var _0x701f=function(_0x29d530,_0x5da0d7){_0x29d530=_0x29d530-0x0;var _0x242905=_0x01f7[_0x29d530];return _0x242905;};'use strict';var multer=require(_0x701f('0x0'));var util=require('util');var path=require(_0x701f('0x1'));var timeout=require(_0x701f('0x2'));var express=require(_0x701f('0x3'));var router=express[_0x701f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x701f('0x5'));var config=require(_0x701f('0x6'));var controller=require(_0x701f('0x7'));router[_0x701f('0x8')]('/',auth[_0x701f('0x9')](),controller[_0x701f('0xa')]);router[_0x701f('0x8')](_0x701f('0xb'),auth[_0x701f('0x9')](),controller[_0x701f('0xc')]);router[_0x701f('0x8')](_0x701f('0xd'),auth[_0x701f('0x9')](),controller[_0x701f('0xe')]);router[_0x701f('0x8')](_0x701f('0xf'),auth[_0x701f('0x9')](),controller[_0x701f('0x10')]);router[_0x701f('0x11')]('/',auth[_0x701f('0x9')](),controller[_0x701f('0x12')]);router[_0x701f('0x11')](_0x701f('0xd'),auth[_0x701f('0x9')](),controller['addConditions']);router[_0x701f('0x11')]('/:id/actions',auth[_0x701f('0x9')](),controller[_0x701f('0x13')]);router[_0x701f('0x14')](_0x701f('0xb'),auth['isAuthenticated'](),controller[_0x701f('0x15')]);router[_0x701f('0x16')](_0x701f('0xb'),auth[_0x701f('0x9')](),controller[_0x701f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf777=['/:id/actions','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/conditions','getConditions','getActions','post','create','addConditions'];(function(_0x766e06,_0x17423a){var _0x22f402=function(_0x57ad4f){while(--_0x57ad4f){_0x766e06['push'](_0x766e06['shift']());}};_0x22f402(++_0x17423a);}(_0xf777,0x1e9));var _0x7f77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf777[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var path=require(_0x7f77('0x2'));var timeout=require(_0x7f77('0x3'));var express=require(_0x7f77('0x4'));var router=express[_0x7f77('0x5')]();var auth=require(_0x7f77('0x6'));var interaction=require(_0x7f77('0x7'));var config=require(_0x7f77('0x8'));var controller=require('./automation.controller');router[_0x7f77('0x9')]('/',auth[_0x7f77('0xa')](),controller['index']);router[_0x7f77('0x9')]('/:id',auth[_0x7f77('0xa')](),controller['show']);router[_0x7f77('0x9')](_0x7f77('0xb'),auth[_0x7f77('0xa')](),controller[_0x7f77('0xc')]);router[_0x7f77('0x9')]('/:id/actions',auth['isAuthenticated'](),controller[_0x7f77('0xd')]);router[_0x7f77('0xe')]('/',auth[_0x7f77('0xa')](),controller[_0x7f77('0xf')]);router[_0x7f77('0xe')]('/:id/conditions',auth[_0x7f77('0xa')](),controller[_0x7f77('0x10')]);router[_0x7f77('0xe')](_0x7f77('0x11'),auth[_0x7f77('0xa')](),controller['addActions']);router['put'](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x13')]);router[_0x7f77('0x14')](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x15')]);module[_0x7f77('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 20e7dac..6589bbf 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 _0xf501=['name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING'];(function(_0x16167b,_0x2e64c4){var _0x357fab=function(_0xbab2ff){while(--_0xbab2ff){_0x16167b['push'](_0x16167b['shift']());}};_0x357fab(++_0x2e64c4);}(_0xf501,0xc0));var _0x1f50=function(_0x29c0dc,_0x1de8a3){_0x29c0dc=_0x29c0dc-0x0;var _0x2c3758=_0xf501[_0x29c0dc];return _0x2c3758;};'use strict';var Sequelize=require(_0x1f50('0x0'));module[_0x1f50('0x1')]={'name':{'type':Sequelize[_0x1f50('0x2')],'unique':_0x1f50('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1f50('0x4')),'allowNull':![],'defaultValue':_0x1f50('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1f50('0x5')],'defaultValue':0x0,'comment':_0x1f50('0x6')},'limitCalls':{'type':Sequelize[_0x1f50('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1f50('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1f50('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1f50('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'comment':_0x1f50('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1f50('0x10')},'dialTimezone':{'type':Sequelize[_0x1f50('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1f50('0x2')],'defaultValue':_0x1f50('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x1f50('0x12')](_0x1f50('0x13'),_0x1f50('0x14'),_0x1f50('0x15')),'defaultValue':_0x1f50('0x13')},'dialAMDActive':{'type':Sequelize[_0x1f50('0x5')],'defaultValue':0x0,'comment':_0x1f50('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0x1f50('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1f50('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f50('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1f50('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1f50('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1f50('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f50('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1f50('0x12')](_0x1f50('0x1c'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1f50('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f50('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f50('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x26')}}; \ No newline at end of file +var _0x5685=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3ec82f,_0x5c5787){var _0x5e81aa=function(_0x183518){while(--_0x183518){_0x3ec82f['push'](_0x3ec82f['shift']());}};_0x5e81aa(++_0x5c5787);}(_0x5685,0xf9));var _0x5568=function(_0x2afb28,_0x19e8b0){_0x2afb28=_0x2afb28-0x0;var _0x41d764=_0x5685[_0x2afb28];return _0x41d764;};'use strict';var Sequelize=require(_0x5568('0x0'));module[_0x5568('0x1')]={'name':{'type':Sequelize[_0x5568('0x2')],'unique':_0x5568('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x5568('0x4')),'allowNull':![],'defaultValue':_0x5568('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5568('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x5568('0x6')](0x4)[_0x5568('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5568('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5568('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5568('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5568('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5568('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'comment':_0x5568('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5568('0xd')},'dialTimezone':{'type':Sequelize[_0x5568('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5568('0x2')],'defaultValue':_0x5568('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x5568('0xf')](_0x5568('0x10'),_0x5568('0x11'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5568('0x5')],'defaultValue':0x0,'comment':_0x5568('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5568('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5568('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x5568('0x6')](0x9)[_0x5568('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5568('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5568('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5568('0x6')](0x9)[_0x5568('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5568('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5568('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5568('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5568('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5568('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5568('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5568('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5568('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5568('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5568('0x1a'),_0x5568('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5568('0x1c')},'dialCutDigit':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5568('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5568('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5568('0x6')](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5568('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5568('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5568('0x6')](0x5)[_0x5568('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5568('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2dee5aa..8572f26 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(_0x558f16,_0x55a2de){var _0xbc7352=function(_0x14d9e9){while(--_0x14d9e9){_0x558f16['push'](_0x558f16['shift']());}};_0xbc7352(++_0x55a2de);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x1849da,_0x2459c9){var _0x377831=function(_0x3fdfe2){while(--_0x3fdfe2){_0x1849da['push'](_0x1849da['shift']());}};_0x377831(++_0x2459c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 5eff625..90fe3b9 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 _0xe124=['api','request-promise','path','../../config/environment','exports','Campaign','campaigns','lodash','util','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe124,0x101));var _0x4e12=function(_0x5ba25f,_0x531f9f){_0x5ba25f=_0x5ba25f-0x0;var _0x355f70=_0xe124[_0x5ba25f];return _0x355f70;};'use strict';var _=require(_0x4e12('0x0'));var util=require(_0x4e12('0x1'));var logger=require(_0x4e12('0x2'))(_0x4e12('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e12('0x4'));var fs=require('fs');var path=require(_0x4e12('0x5'));var rimraf=require('rimraf');var config=require(_0x4e12('0x6'));var attributes=require('./campaign.attributes');module[_0x4e12('0x7')]=function(_0x120529,_0x16e10b){return _0x120529['define'](_0x4e12('0x8'),attributes,{'tableName':_0x4e12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1d5=['bluebird','request-promise','rimraf','./campaign.attributes','exports','Campaign','campaigns','lodash','util','api','moment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa1d5,0xa1));var _0x5a1d=function(_0x2c8904,_0x222507){_0x2c8904=_0x2c8904-0x0;var _0xac620f=_0xa1d5[_0x2c8904];return _0xac620f;};'use strict';var _=require(_0x5a1d('0x0'));var util=require(_0x5a1d('0x1'));var logger=require('../../config/logger')(_0x5a1d('0x2'));var moment=require(_0x5a1d('0x3'));var BPromise=require(_0x5a1d('0x4'));var rp=require(_0x5a1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x5a1d('0x7'));module[_0x5a1d('0x8')]=function(_0x8c8615,_0x350457){return _0x8c8615['define'](_0x5a1d('0x9'),attributes,{'tableName':_0x5a1d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 1d45542..70df8a5 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(_0x2f454b,_0x4f0132){var _0x3077ab=function(_0x4cd985){while(--_0x4cd985){_0x2f454b['push'](_0x2f454b['shift']());}};_0x3077ab(++_0x4f0132);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x5da6b4,_0x18694d){var _0x34ce85=function(_0x149978){while(--_0x149978){_0x5da6b4['push'](_0x5da6b4['shift']());}};_0x34ce85(++_0x18694d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7c8a78f..1b3e4fc 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 _0xe87a=['get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller'];(function(_0x444792,_0x40ec11){var _0x57aa27=function(_0x2b5cb6){while(--_0x2b5cb6){_0x444792['push'](_0x444792['shift']());}};_0x57aa27(++_0x40ec11);}(_0xe87a,0x19c));var _0xae87=function(_0x119f5c,_0x308a3e){_0x119f5c=_0x119f5c-0x0;var _0x399179=_0xe87a[_0x119f5c];return _0x399179;};'use strict';var multer=require(_0xae87('0x0'));var util=require('util');var path=require(_0xae87('0x1'));var timeout=require(_0xae87('0x2'));var express=require(_0xae87('0x3'));var router=express[_0xae87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xae87('0x5'));var config=require(_0xae87('0x6'));var controller=require(_0xae87('0x7'));router[_0xae87('0x8')]('/',auth[_0xae87('0x9')](),controller[_0xae87('0xa')]);router[_0xae87('0x8')](_0xae87('0xb'),auth['isAuthenticated'](),controller[_0xae87('0xc')]);router[_0xae87('0x8')](_0xae87('0xd'),auth[_0xae87('0x9')](),controller[_0xae87('0xe')]);router[_0xae87('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xae87('0xf')]);router[_0xae87('0x8')](_0xae87('0x10'),auth['isAuthenticated'](),controller[_0xae87('0x11')]);router[_0xae87('0x8')](_0xae87('0x12'),auth[_0xae87('0x9')](),controller[_0xae87('0x13')]);router[_0xae87('0x8')](_0xae87('0x14'),auth[_0xae87('0x9')](),controller[_0xae87('0x15')]);router[_0xae87('0x8')]('/:id/blacklists',auth[_0xae87('0x9')](),controller[_0xae87('0x16')]);router[_0xae87('0x17')]('/',auth[_0xae87('0x9')](),controller[_0xae87('0x18')]);router[_0xae87('0x17')](_0xae87('0x19'),auth['isAuthenticated'](),controller[_0xae87('0x1a')]);router[_0xae87('0x17')](_0xae87('0x14'),auth[_0xae87('0x9')](),controller[_0xae87('0x1b')]);router['post'](_0xae87('0x1c'),auth[_0xae87('0x9')](),controller['addBlackLists']);router['put'](_0xae87('0xb'),auth['isAuthenticated'](),controller[_0xae87('0x1d')]);router[_0xae87('0x1e')](_0xae87('0xb'),auth[_0xae87('0x9')](),controller[_0xae87('0x1f')]);router[_0xae87('0x1e')]('/:id/lists',auth['isAuthenticated'](),controller[_0xae87('0x20')]);router[_0xae87('0x1e')]('/:id/blacklists',auth[_0xae87('0x9')](),controller[_0xae87('0x21')]);module[_0xae87('0x22')]=router; \ No newline at end of file +var _0x4667=['destroy','removeLists','delete','/:id/blacklists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','update'];(function(_0x3f668b,_0x6ab15c){var _0x259a77=function(_0x5c56e1){while(--_0x5c56e1){_0x3f668b['push'](_0x3f668b['shift']());}};_0x259a77(++_0x6ab15c);}(_0x4667,0x12f));var _0x7466=function(_0x9b7ba,_0x38b333){_0x9b7ba=_0x9b7ba-0x0;var _0x184dc1=_0x4667[_0x9b7ba];return _0x184dc1;};'use strict';var multer=require(_0x7466('0x0'));var util=require(_0x7466('0x1'));var path=require('path');var timeout=require(_0x7466('0x2'));var express=require(_0x7466('0x3'));var router=express[_0x7466('0x4')]();var auth=require(_0x7466('0x5'));var interaction=require(_0x7466('0x6'));var config=require('../../config/environment');var controller=require(_0x7466('0x7'));router[_0x7466('0x8')]('/',auth[_0x7466('0x9')](),controller[_0x7466('0xa')]);router['get'](_0x7466('0xb'),auth[_0x7466('0x9')](),controller[_0x7466('0xc')]);router[_0x7466('0x8')]('/:id/hoppers',auth[_0x7466('0x9')](),controller['getHoppers']);router[_0x7466('0x8')]('/:id/hopper_histories',auth[_0x7466('0x9')](),controller[_0x7466('0xd')]);router[_0x7466('0x8')](_0x7466('0xe'),auth[_0x7466('0x9')](),controller['getHopperFinals']);router[_0x7466('0x8')](_0x7466('0xf'),auth['isAuthenticated'](),controller[_0x7466('0x10')]);router[_0x7466('0x8')](_0x7466('0x11'),auth[_0x7466('0x9')](),controller[_0x7466('0x12')]);router[_0x7466('0x8')]('/:id/blacklists',auth[_0x7466('0x9')](),controller[_0x7466('0x13')]);router['post']('/',auth[_0x7466('0x9')](),controller['create']);router[_0x7466('0x14')](_0x7466('0x15'),auth[_0x7466('0x9')](),controller[_0x7466('0x16')]);router[_0x7466('0x14')](_0x7466('0x11'),auth[_0x7466('0x9')](),controller[_0x7466('0x17')]);router[_0x7466('0x14')]('/:id/blacklists',auth[_0x7466('0x9')](),controller[_0x7466('0x18')]);router[_0x7466('0x19')]('/:id',auth[_0x7466('0x9')](),controller[_0x7466('0x1a')]);router['delete'](_0x7466('0xb'),auth[_0x7466('0x9')](),controller[_0x7466('0x1b')]);router['delete']('/:id/lists',auth[_0x7466('0x9')](),controller[_0x7466('0x1c')]);router[_0x7466('0x1d')](_0x7466('0x1e'),auth[_0x7466('0x9')](),controller[_0x7466('0x1f')]);module[_0x7466('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5933c5f..859d365 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 _0x5a5b=['key','exports','TEXT','STRING','getDataValue'];(function(_0x371c73,_0x142c25){var _0x25bc52=function(_0x4bc8f9){while(--_0x4bc8f9){_0x371c73['push'](_0x371c73['shift']());}};_0x25bc52(++_0x142c25);}(_0x5a5b,0x83));var _0xb5a5=function(_0x286066,_0x29be40){_0x286066=_0x286066-0x0;var _0x18f4bd=_0x5a5b[_0x286066];return _0x18f4bd;};'use strict';var Sequelize=require('sequelize');module[_0xb5a5('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xb5a5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb5a5('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb5a5('0x3')](_0xb5a5('0x4'));}}}; \ No newline at end of file +var _0x92d7=['exports','STRING','VIRTUAL','getDataValue','sequelize'];(function(_0x1af539,_0x2b31e5){var _0x305778=function(_0x3a7621){while(--_0x3a7621){_0x1af539['push'](_0x1af539['shift']());}};_0x305778(++_0x2b31e5);}(_0x92d7,0x10d));var _0x792d=function(_0x1a8347,_0xb15b3d){_0x1a8347=_0x1a8347-0x0;var _0x33b70b=_0x92d7[_0x1a8347];return _0x33b70b;};'use strict';var Sequelize=require(_0x792d('0x0'));module[_0x792d('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x792d('0x2')]},'name':{'type':Sequelize[_0x792d('0x3')],'get':function(){return this[_0x792d('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7d7a73a..d4414fb 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 _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x3ede7e,_0x4d9486){var _0x19490f=function(_0x3c887e){while(--_0x3c887e){_0x3ede7e['push'](_0x3ede7e['shift']());}};_0x19490f(++_0x4d9486);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ac101fb..c52917c 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 _0xa98d=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','request-promise','path','rimraf','./cannedAnswer.attributes'];(function(_0x4eb72c,_0x4246bc){var _0x51268b=function(_0x221711){while(--_0x221711){_0x4eb72c['push'](_0x4eb72c['shift']());}};_0x51268b(++_0x4246bc);}(_0xa98d,0x171));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xda98('0x0'));var util=require(_0xda98('0x1'));var logger=require(_0xda98('0x2'))(_0xda98('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda98('0x4'));var fs=require('fs');var path=require(_0xda98('0x5'));var rimraf=require(_0xda98('0x6'));var config=require('../../config/environment');var attributes=require(_0xda98('0x7'));module[_0xda98('0x8')]=function(_0x5c2333,_0x46389b){return _0x5c2333[_0xda98('0x9')](_0xda98('0xa'),attributes,{'tableName':_0xda98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xda98('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x74c3=['define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x39fd25,_0x1bd49d){var _0x37eb85=function(_0x4c3945){while(--_0x4c3945){_0x39fd25['push'](_0x39fd25['shift']());}};_0x37eb85(++_0x1bd49d);}(_0x74c3,0x94));var _0x374c=function(_0x5dea8a,_0x473eaa){_0x5dea8a=_0x5dea8a-0x0;var _0x47758b=_0x74c3[_0x5dea8a];return _0x47758b;};'use strict';var _=require(_0x374c('0x0'));var util=require(_0x374c('0x1'));var logger=require('../../config/logger')(_0x374c('0x2'));var moment=require(_0x374c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x374c('0x4'));var rimraf=require(_0x374c('0x5'));var config=require(_0x374c('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x374c('0x7')]=function(_0x5cdbe3,_0x56b272){return _0x5cdbe3[_0x374c('0x8')](_0x374c('0x9'),attributes,{'tableName':_0x374c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x374c('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 60bfd6a..094e112 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 _0x327e=['result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x512bdd,_0x822f9d){var _0xa1c840=function(_0x1f35bc){while(--_0x1f35bc){_0x512bdd['push'](_0x512bdd['shift']());}};_0xa1c840(++_0x822f9d);}(_0x327e,0x169));var _0xe327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x327e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe327('0x0'));var util=require('util');var moment=require(_0xe327('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe327('0x2'))['db'];var utils=require(_0xe327('0x3'));var logger=require(_0xe327('0x4'))(_0xe327('0x5'));var config=require(_0xe327('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x402736,_0x42b112,_0x210ecf){return new BPromise(function(_0x5cb17c,_0x381b83){return client['request'](_0x402736,_0x210ecf)[_0xe327('0x7')](function(_0x400413){logger[_0xe327('0x8')](_0xe327('0x9'),_0x42b112,'request\x20sent');logger[_0xe327('0xa')](_0xe327('0xb'),_0x42b112,_0xe327('0xc'),JSON[_0xe327('0xd')](_0x400413));if(_0x400413[_0xe327('0xe')]){if(_0x400413['error'][_0xe327('0xf')]===0x1f4){logger[_0xe327('0xe')](_0xe327('0x9'),_0x42b112,_0x400413['error']['message']);return _0x381b83(_0x400413[_0xe327('0xe')][_0xe327('0x10')]);}logger[_0xe327('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x42b112,_0x400413[_0xe327('0xe')]['message']);return _0x5cb17c(_0x400413[_0xe327('0xe')][_0xe327('0x10')]);}else{logger[_0xe327('0x8')](_0xe327('0x9'),_0x42b112,_0xe327('0xc'));_0x5cb17c(_0x400413[_0xe327('0x11')]['message']);}})['catch'](function(_0x1082ad){logger[_0xe327('0xe')](_0xe327('0x9'),_0x42b112,_0x1082ad);_0x381b83(_0x1082ad);});});} \ No newline at end of file +var _0x6b3d=['CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x6b3d,0xd1));var _0xd6b3=function(_0xc7a361,_0x204fd7){_0xc7a361=_0xc7a361-0x0;var _0x19f0c2=_0x6b3d[_0xc7a361];return _0x19f0c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6b3('0x0'));var BPromise=require('bluebird');var rs=require(_0xd6b3('0x1'));var fs=require('fs');var Redis=require(_0xd6b3('0x2'));var db=require(_0xd6b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6b3('0x4'))('rpc');var config=require(_0xd6b3('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd6b3('0x6')][_0xd6b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8a74a1,_0x411d6b,_0x55f9cb){return new BPromise(function(_0x4f2634,_0x4e6f25){return client[_0xd6b3('0x8')](_0x8a74a1,_0x55f9cb)[_0xd6b3('0x9')](function(_0x4f1035){logger[_0xd6b3('0xa')](_0xd6b3('0xb'),_0x411d6b,_0xd6b3('0xc'));logger[_0xd6b3('0xd')](_0xd6b3('0xe'),_0x411d6b,'request\x20sent',JSON[_0xd6b3('0xf')](_0x4f1035));if(_0x4f1035[_0xd6b3('0x10')]){if(_0x4f1035[_0xd6b3('0x10')][_0xd6b3('0x11')]===0x1f4){logger[_0xd6b3('0x10')](_0xd6b3('0xb'),_0x411d6b,_0x4f1035[_0xd6b3('0x10')]['message']);return _0x4e6f25(_0x4f1035[_0xd6b3('0x10')]['message']);}logger[_0xd6b3('0x10')](_0xd6b3('0xb'),_0x411d6b,_0x4f1035[_0xd6b3('0x10')][_0xd6b3('0x12')]);return _0x4f2634(_0x4f1035['error'][_0xd6b3('0x12')]);}else{logger['info'](_0xd6b3('0xb'),_0x411d6b,_0xd6b3('0xc'));_0x4f2634(_0x4f1035[_0xd6b3('0x13')][_0xd6b3('0x12')]);}})['catch'](function(_0x3fce69){logger['error'](_0xd6b3('0xb'),_0x411d6b,_0x3fce69);_0x4e6f25(_0x3fce69);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index dac8100..e9bb569 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 _0x4913=['util','path','express','Router','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x4913,0x170));var _0x3491=function(_0x244fe0,_0x238865){_0x244fe0=_0x244fe0-0x0;var _0x4ad059=_0x4913[_0x244fe0];return _0x4ad059;};'use strict';var multer=require('multer');var util=require(_0x3491('0x0'));var path=require(_0x3491('0x1'));var timeout=require('connect-timeout');var express=require(_0x3491('0x2'));var router=express[_0x3491('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3491('0x4'));var controller=require(_0x3491('0x5'));router[_0x3491('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3491('0x7'),auth[_0x3491('0x8')](),controller[_0x3491('0x9')]);router[_0x3491('0xa')]('/',auth[_0x3491('0x8')](),controller[_0x3491('0xb')]);router[_0x3491('0xc')](_0x3491('0x7'),auth[_0x3491('0x8')](),controller[_0x3491('0xd')]);router[_0x3491('0xe')](_0x3491('0x7'),auth[_0x3491('0x8')](),controller['destroy']);module[_0x3491('0xf')]=router; \ No newline at end of file +var _0x9028=['isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','show','post'];(function(_0x1e6eab,_0x216f5b){var _0x5f5517=function(_0x1acf8b){while(--_0x1acf8b){_0x1e6eab['push'](_0x1e6eab['shift']());}};_0x5f5517(++_0x216f5b);}(_0x9028,0x16d));var _0x8902=function(_0x5c6ba9,_0x5412c5){_0x5c6ba9=_0x5c6ba9-0x0;var _0x377b7a=_0x9028[_0x5c6ba9];return _0x377b7a;};'use strict';var multer=require(_0x8902('0x0'));var util=require(_0x8902('0x1'));var path=require('path');var timeout=require(_0x8902('0x2'));var express=require(_0x8902('0x3'));var router=express[_0x8902('0x4')]();var auth=require(_0x8902('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8902('0x6'));var controller=require(_0x8902('0x7'));router[_0x8902('0x8')]('/',auth['isAuthenticated'](),controller[_0x8902('0x9')]);router[_0x8902('0x8')](_0x8902('0xa'),auth['isAuthenticated'](),controller[_0x8902('0xb')]);router[_0x8902('0xc')]('/',auth[_0x8902('0xd')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8902('0xe')]);router[_0x8902('0xf')](_0x8902('0xa'),auth[_0x8902('0xd')](),controller[_0x8902('0x10')]);module[_0x8902('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6bdd8f5..69256a4 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 _0x9d9a=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0xf77be0,_0x359844){var _0x10d956=function(_0x19d1d2){while(--_0x19d1d2){_0xf77be0['push'](_0xf77be0['shift']());}};_0x10d956(++_0x359844);}(_0x9d9a,0x1e9));var _0xa9d9=function(_0x26d22d,_0x3ee820){_0x26d22d=_0x26d22d-0x0;var _0x2a9571=_0x9d9a[_0x26d22d];return _0x2a9571;};'use strict';var Sequelize=require(_0xa9d9('0x0'));module[_0xa9d9('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xa9d9('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xa9d9('0x3')]},'dst':{'type':Sequelize[_0xa9d9('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa9d9('0x3')]},'dstchannel':{'type':Sequelize[_0xa9d9('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xa9d9('0x3')]},'duration':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9d9('0x3')]},'amaflags':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa9d9('0x3')]},'uniqueid':{'type':Sequelize[_0xa9d9('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xa9d9('0x3')]},'peeraccount':{'type':Sequelize[_0xa9d9('0x3')]},'type':{'type':Sequelize[_0xa9d9('0x3')]},'tag':{'type':Sequelize[_0xa9d9('0x3')]}}; \ No newline at end of file +var _0x03d3=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x03d3,0x19c));var _0x303d=function(_0x55f4b4,_0xa50319){_0x55f4b4=_0x55f4b4-0x0;var _0x2f9b9d=_0x03d3[_0x55f4b4];return _0x2f9b9d;};'use strict';var Sequelize=require(_0x303d('0x0'));module[_0x303d('0x1')]={'calldate':{'type':Sequelize[_0x303d('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x303d('0x3')]},'src':{'type':Sequelize[_0x303d('0x3')]},'dst':{'type':Sequelize[_0x303d('0x3')]},'dcontext':{'type':Sequelize[_0x303d('0x3')]},'channel':{'type':Sequelize[_0x303d('0x3')]},'dstchannel':{'type':Sequelize[_0x303d('0x3')]},'lastapp':{'type':Sequelize[_0x303d('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x303d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x303d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x303d('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x303d('0x3')]},'uniqueid':{'type':Sequelize[_0x303d('0x3')]},'linkedid':{'type':Sequelize[_0x303d('0x3')]},'sequence':{'type':Sequelize[_0x303d('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x303d('0x3')]},'tag':{'type':Sequelize[_0x303d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9b9b125..9d31af4 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 _0xf266=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','then','destroy','stack','name','map','Cdr','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x1df3c9,_0x2f0860){var _0x2aa118=function(_0x505c81){while(--_0x505c81){_0x1df3c9['push'](_0x1df3c9['shift']());}};_0x2aa118(++_0x2f0860);}(_0xf266,0x108));var _0x6f26=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xf266[_0x125ff8];return _0x2d9ef;};'use strict';var pdf=require(_0x6f26('0x0'));var emlformat=require(_0x6f26('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6f26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f26('0x3'));var moment=require(_0x6f26('0x4'));var BPromise=require(_0x6f26('0x5'));var Mustache=require(_0x6f26('0x6'));var util=require(_0x6f26('0x7'));var path=require('path');var sox=require(_0x6f26('0x8'));var csv=require(_0x6f26('0x9'));var ejs=require(_0x6f26('0xa'));var fs=require('fs');var _=require(_0x6f26('0xb'));var squel=require(_0x6f26('0xc'));var crypto=require(_0x6f26('0xd'));var jsforce=require(_0x6f26('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6f26('0x9'));var querystring=require(_0x6f26('0xf'));var Papa=require(_0x6f26('0x10'));var Redis=require(_0x6f26('0x11'));var authService=require(_0x6f26('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6f26('0x13'));var hardwareService=require(_0x6f26('0x14'));var logger=require('../../config/logger')(_0x6f26('0x15'));var utils=require(_0x6f26('0x16'));var config=require(_0x6f26('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f26('0x18'))['db'];function respondWithStatusCode(_0x1fcb89,_0xe7e73f){_0xe7e73f=_0xe7e73f||0xcc;return function(_0x45e183){if(_0x45e183){return _0x1fcb89[_0x6f26('0x19')](_0xe7e73f);}return _0x1fcb89[_0x6f26('0x1a')](_0xe7e73f)['end']();};}function respondWithResult(_0xfb590e,_0x3760ce){_0x3760ce=_0x3760ce||0xc8;return function(_0x364371){if(_0x364371){return _0xfb590e[_0x6f26('0x1a')](_0x3760ce)[_0x6f26('0x1b')](_0x364371);}};}function respondWithFilteredResult(_0x57c6d2,_0x7d208d){return function(_0x21156c){if(_0x21156c){var _0x22129f=_0x21156c[_0x6f26('0x1c')],_0x37d639=_0x7d208d['offset'],_0x323b72=_0x7d208d[_0x6f26('0x1d')]+_0x7d208d[_0x6f26('0x1e')],_0x251ad5;if(_0x323b72>=_0x22129f){_0x323b72=_0x22129f;_0x251ad5=0xc8;}else{_0x251ad5=0xce;}_0x57c6d2[_0x6f26('0x1a')](_0x251ad5);return _0x57c6d2[_0x6f26('0x1f')]('Content-Range',_0x37d639+'-'+_0x323b72+'/'+_0x22129f)[_0x6f26('0x1b')](_0x21156c);}return null;};}function patchUpdates(_0x3649ee){return function(_0x36ad11){try{jsonpatch['apply'](_0x36ad11,_0x3649ee,!![]);}catch(_0x4c40a0){return BPromise[_0x6f26('0x20')](_0x4c40a0);}return _0x36ad11['save']();};}function saveUpdates(_0x1a6fc4,_0x7053eb){return function(_0x4ff12c){if(_0x4ff12c){return _0x4ff12c[_0x6f26('0x21')](_0x1a6fc4)[_0x6f26('0x22')](function(_0x254099){return _0x254099;});}return null;};}function removeEntity(_0x33d763,_0x423e68){return function(_0xe7c248){if(_0xe7c248){return _0xe7c248[_0x6f26('0x23')]()[_0x6f26('0x22')](function(){_0x33d763[_0x6f26('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148a75,_0x1f096a){return function(_0x1c603e){if(!_0x1c603e){_0x148a75[_0x6f26('0x19')](0x194);}return _0x1c603e;};}function handleError(_0x5ab5d3,_0x18e46c){_0x18e46c=_0x18e46c||0x1f4;return function(_0x2878f6){logger['error'](_0x2878f6[_0x6f26('0x24')]);if(_0x2878f6['name']){delete _0x2878f6[_0x6f26('0x25')];}_0x5ab5d3[_0x6f26('0x1a')](_0x18e46c)['send'](_0x2878f6);};}exports['index']=function(_0x53d10e,_0x39a2ae){var _0x2acdf7={},_0x18134f={},_0x142715={'count':0x0,'rows':[]};var _0x10587e=_[_0x6f26('0x26')](db[_0x6f26('0x27')][_0x6f26('0x28')],function(_0x2db578){return{'name':_0x2db578[_0x6f26('0x29')],'type':_0x2db578['type'][_0x6f26('0x2a')]};});_0x18134f[_0x6f26('0x2b')]=_[_0x6f26('0x26')](_0x10587e,_0x6f26('0x25'));_0x18134f['query']=_['keys'](_0x53d10e[_0x6f26('0x2c')]);_0x18134f[_0x6f26('0x2d')]=_[_0x6f26('0x2e')](_0x18134f[_0x6f26('0x2b')],_0x18134f[_0x6f26('0x2c')]);_0x2acdf7[_0x6f26('0x2f')]=_['intersection'](_0x18134f[_0x6f26('0x2b')],qs[_0x6f26('0x30')](_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x30')]));_0x2acdf7[_0x6f26('0x2f')]=_0x2acdf7[_0x6f26('0x2f')][_0x6f26('0x31')]?_0x2acdf7[_0x6f26('0x2f')]:_0x18134f[_0x6f26('0x2b')];if(!_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x32')](_0x6f26('0x33'))){_0x2acdf7[_0x6f26('0x1e')]=qs[_0x6f26('0x1e')](_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x1e')]);_0x2acdf7['offset']=qs[_0x6f26('0x1d')](_0x53d10e[_0x6f26('0x2c')]['offset']);}_0x2acdf7[_0x6f26('0x34')]=qs['sort'](_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x35')]);_0x2acdf7['where']=qs[_0x6f26('0x2d')](_[_0x6f26('0x36')](_0x53d10e[_0x6f26('0x2c')],_0x18134f[_0x6f26('0x2d')]),_0x10587e);if(_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x37')]){_0x2acdf7[_0x6f26('0x38')]=_[_0x6f26('0x39')](_0x2acdf7[_0x6f26('0x38')],{'$or':_[_0x6f26('0x26')](_0x10587e,function(_0x12f1a5){if(_0x12f1a5[_0x6f26('0x3a')]!=='VIRTUAL'){var _0x5068dd={};_0x5068dd[_0x12f1a5['name']]={'$like':'%'+_0x53d10e['query']['filter']+'%'};return _0x5068dd;}})});}_0x2acdf7=_['merge']({},_0x2acdf7,_0x53d10e[_0x6f26('0x3b')]);var _0x524d57={'where':_0x2acdf7[_0x6f26('0x38')]};return db['Cdr']['count'](_0x524d57)[_0x6f26('0x22')](function(_0x1b424e){_0x142715[_0x6f26('0x1c')]=_0x1b424e;if(_0x53d10e['query']['includeAll']){_0x2acdf7['include']=[{'all':!![]}];}return db['Cdr'][_0x6f26('0x3c')](_0x2acdf7);})[_0x6f26('0x22')](function(_0x2b9f0b){_0x142715[_0x6f26('0x3d')]=_0x2b9f0b;return _0x142715;})[_0x6f26('0x22')](respondWithFilteredResult(_0x39a2ae,_0x2acdf7))[_0x6f26('0x3e')](handleError(_0x39a2ae,null));};exports[_0x6f26('0x3f')]=function(_0x41d72,_0x266a31){var _0x9dfce9={'raw':!![],'where':{'id':_0x41d72[_0x6f26('0x40')]['id']}},_0x49466d={};_0x49466d['model']=_[_0x6f26('0x41')](db[_0x6f26('0x27')][_0x6f26('0x28')]);_0x49466d[_0x6f26('0x2c')]=_[_0x6f26('0x41')](_0x41d72[_0x6f26('0x2c')]);_0x49466d[_0x6f26('0x2d')]=_[_0x6f26('0x2e')](_0x49466d[_0x6f26('0x2b')],_0x49466d[_0x6f26('0x2c')]);_0x9dfce9[_0x6f26('0x2f')]=_[_0x6f26('0x2e')](_0x49466d['model'],qs['fields'](_0x41d72['query'][_0x6f26('0x30')]));_0x9dfce9[_0x6f26('0x2f')]=_0x9dfce9['attributes']['length']?_0x9dfce9['attributes']:_0x49466d['model'];if(_0x41d72[_0x6f26('0x2c')][_0x6f26('0x42')]){_0x9dfce9[_0x6f26('0x43')]=[{'all':!![]}];}_0x9dfce9=_[_0x6f26('0x39')]({},_0x9dfce9,_0x41d72['options']);return db[_0x6f26('0x27')][_0x6f26('0x44')](_0x9dfce9)[_0x6f26('0x22')](handleEntityNotFound(_0x266a31,null))[_0x6f26('0x22')](respondWithResult(_0x266a31,null))[_0x6f26('0x3e')](handleError(_0x266a31,null));};exports[_0x6f26('0x45')]=function(_0x7cd6a,_0x26c58e){return db[_0x6f26('0x27')]['create'](_0x7cd6a[_0x6f26('0x46')],{})['then'](respondWithResult(_0x26c58e,0xc9))[_0x6f26('0x3e')](handleError(_0x26c58e,null));};exports[_0x6f26('0x21')]=function(_0x536469,_0x1c5e98){if(_0x536469['body']['id']){delete _0x536469['body']['id'];}return db[_0x6f26('0x27')][_0x6f26('0x44')]({'where':{'id':_0x536469[_0x6f26('0x40')]['id']}})[_0x6f26('0x22')](handleEntityNotFound(_0x1c5e98,null))['then'](saveUpdates(_0x536469['body'],null))[_0x6f26('0x22')](respondWithResult(_0x1c5e98,null))['catch'](handleError(_0x1c5e98,null));};exports[_0x6f26('0x23')]=function(_0x4e45ed,_0x254f83){return db['Cdr']['find']({'where':{'id':_0x4e45ed[_0x6f26('0x40')]['id']}})[_0x6f26('0x22')](handleEntityNotFound(_0x254f83,null))[_0x6f26('0x22')](removeEntity(_0x254f83,null))[_0x6f26('0x3e')](handleError(_0x254f83,null));};exports[_0x6f26('0x47')]=function(_0x12d864,_0x1f2522){return db[_0x6f26('0x27')][_0x6f26('0x47')]()[_0x6f26('0x22')](respondWithResult(_0x1f2522,null))[_0x6f26('0x3e')](handleError(_0x1f2522,null));}; \ No newline at end of file +var _0xfcdc=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','name','index','map','Cdr','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge'];(function(_0xe66f4f,_0x2566da){var _0x47e05e=function(_0x1cbdd9){while(--_0x1cbdd9){_0xe66f4f['push'](_0xe66f4f['shift']());}};_0x47e05e(++_0x2566da);}(_0xfcdc,0x1ca));var _0xcfcd=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfcdc[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xcfcd('0x0'));var emlformat=require(_0xcfcd('0x1'));var rimraf=require(_0xcfcd('0x2'));var zipdir=require(_0xcfcd('0x3'));var jsonpatch=require(_0xcfcd('0x4'));var rp=require(_0xcfcd('0x5'));var moment=require('moment');var BPromise=require(_0xcfcd('0x6'));var Mustache=require('mustache');var util=require(_0xcfcd('0x7'));var path=require(_0xcfcd('0x8'));var sox=require('sox');var csv=require(_0xcfcd('0x9'));var ejs=require(_0xcfcd('0xa'));var fs=require('fs');var _=require(_0xcfcd('0xb'));var squel=require('squel');var crypto=require(_0xcfcd('0xc'));var jsforce=require(_0xcfcd('0xd'));var deskjs=require(_0xcfcd('0xe'));var toCsv=require(_0xcfcd('0x9'));var querystring=require(_0xcfcd('0xf'));var Papa=require(_0xcfcd('0x10'));var Redis=require(_0xcfcd('0x11'));var authService=require(_0xcfcd('0x12'));var qs=require(_0xcfcd('0x13'));var as=require(_0xcfcd('0x14'));var hardwareService=require(_0xcfcd('0x15'));var logger=require(_0xcfcd('0x16'))(_0xcfcd('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfcd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f0394,_0xd7af68){_0xd7af68=_0xd7af68||0xcc;return function(_0x7b2156){if(_0x7b2156){return _0x1f0394[_0xcfcd('0x19')](_0xd7af68);}return _0x1f0394[_0xcfcd('0x1a')](_0xd7af68)[_0xcfcd('0x1b')]();};}function respondWithResult(_0x17615d,_0x230f3d){_0x230f3d=_0x230f3d||0xc8;return function(_0xf33cf1){if(_0xf33cf1){return _0x17615d[_0xcfcd('0x1a')](_0x230f3d)[_0xcfcd('0x1c')](_0xf33cf1);}};}function respondWithFilteredResult(_0x342799,_0x1fcec9){return function(_0x3820c0){if(_0x3820c0){var _0x4bc862=_0x3820c0[_0xcfcd('0x1d')],_0x375664=_0x1fcec9[_0xcfcd('0x1e')],_0x333995=_0x1fcec9[_0xcfcd('0x1e')]+_0x1fcec9[_0xcfcd('0x1f')],_0x330407;if(_0x333995>=_0x4bc862){_0x333995=_0x4bc862;_0x330407=0xc8;}else{_0x330407=0xce;}_0x342799[_0xcfcd('0x1a')](_0x330407);return _0x342799['set'](_0xcfcd('0x20'),_0x375664+'-'+_0x333995+'/'+_0x4bc862)[_0xcfcd('0x1c')](_0x3820c0);}return null;};}function patchUpdates(_0x4f3f59){return function(_0x213107){try{jsonpatch[_0xcfcd('0x21')](_0x213107,_0x4f3f59,!![]);}catch(_0x85944e){return BPromise['reject'](_0x85944e);}return _0x213107[_0xcfcd('0x22')]();};}function saveUpdates(_0x3e5852,_0x325226){return function(_0x15ccca){if(_0x15ccca){return _0x15ccca[_0xcfcd('0x23')](_0x3e5852)[_0xcfcd('0x24')](function(_0x393e96){return _0x393e96;});}return null;};}function removeEntity(_0x345e3f,_0x2fecc5){return function(_0x4e4e08){if(_0x4e4e08){return _0x4e4e08[_0xcfcd('0x25')]()[_0xcfcd('0x24')](function(){_0x345e3f['status'](0xcc)[_0xcfcd('0x1b')]();});}};}function handleEntityNotFound(_0x43e437,_0x1e6dde){return function(_0xa87ea4){if(!_0xa87ea4){_0x43e437[_0xcfcd('0x19')](0x194);}return _0xa87ea4;};}function handleError(_0x1bd91f,_0x560d4f){_0x560d4f=_0x560d4f||0x1f4;return function(_0xdb56dd){logger[_0xcfcd('0x26')](_0xdb56dd['stack']);if(_0xdb56dd['name']){delete _0xdb56dd[_0xcfcd('0x27')];}_0x1bd91f[_0xcfcd('0x1a')](_0x560d4f)['send'](_0xdb56dd);};}exports[_0xcfcd('0x28')]=function(_0x1eb146,_0x2a8852){var _0x46b382={},_0x5cfff7={},_0xa44641={'count':0x0,'rows':[]};var _0x3782b0=_[_0xcfcd('0x29')](db[_0xcfcd('0x2a')]['rawAttributes'],function(_0x19b069){return{'name':_0x19b069[_0xcfcd('0x2b')],'type':_0x19b069[_0xcfcd('0x2c')][_0xcfcd('0x2d')]};});_0x5cfff7['model']=_[_0xcfcd('0x29')](_0x3782b0,_0xcfcd('0x27'));_0x5cfff7['query']=_['keys'](_0x1eb146[_0xcfcd('0x2e')]);_0x5cfff7['filters']=_[_0xcfcd('0x2f')](_0x5cfff7[_0xcfcd('0x30')],_0x5cfff7['query']);_0x46b382['attributes']=_[_0xcfcd('0x2f')](_0x5cfff7[_0xcfcd('0x30')],qs[_0xcfcd('0x31')](_0x1eb146['query'][_0xcfcd('0x31')]));_0x46b382['attributes']=_0x46b382[_0xcfcd('0x32')][_0xcfcd('0x33')]?_0x46b382[_0xcfcd('0x32')]:_0x5cfff7[_0xcfcd('0x30')];if(!_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x34')](_0xcfcd('0x35'))){_0x46b382[_0xcfcd('0x1f')]=qs[_0xcfcd('0x1f')](_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x1f')]);_0x46b382[_0xcfcd('0x1e')]=qs['offset'](_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x1e')]);}_0x46b382['order']=qs['sort'](_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x36')]);_0x46b382[_0xcfcd('0x37')]=qs[_0xcfcd('0x38')](_[_0xcfcd('0x39')](_0x1eb146['query'],_0x5cfff7[_0xcfcd('0x38')]),_0x3782b0);if(_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x3a')]){_0x46b382[_0xcfcd('0x37')]=_[_0xcfcd('0x3b')](_0x46b382[_0xcfcd('0x37')],{'$or':_[_0xcfcd('0x29')](_0x3782b0,function(_0x96a401){if(_0x96a401[_0xcfcd('0x2c')]!=='VIRTUAL'){var _0x44677d={};_0x44677d[_0x96a401['name']]={'$like':'%'+_0x1eb146['query'][_0xcfcd('0x3a')]+'%'};return _0x44677d;}})});}_0x46b382=_[_0xcfcd('0x3b')]({},_0x46b382,_0x1eb146[_0xcfcd('0x3c')]);var _0x5766d4={'where':_0x46b382[_0xcfcd('0x37')]};return db[_0xcfcd('0x2a')]['count'](_0x5766d4)['then'](function(_0x55ea8f){_0xa44641[_0xcfcd('0x1d')]=_0x55ea8f;if(_0x1eb146[_0xcfcd('0x2e')][_0xcfcd('0x3d')]){_0x46b382[_0xcfcd('0x3e')]=[{'all':!![]}];}return db[_0xcfcd('0x2a')][_0xcfcd('0x3f')](_0x46b382);})[_0xcfcd('0x24')](function(_0x2cc12e){_0xa44641[_0xcfcd('0x40')]=_0x2cc12e;return _0xa44641;})[_0xcfcd('0x24')](respondWithFilteredResult(_0x2a8852,_0x46b382))[_0xcfcd('0x41')](handleError(_0x2a8852,null));};exports[_0xcfcd('0x42')]=function(_0xb7e5b2,_0x26c7c5){var _0x5b6458={'raw':!![],'where':{'id':_0xb7e5b2[_0xcfcd('0x43')]['id']}},_0x10ed31={};_0x10ed31[_0xcfcd('0x30')]=_['keys'](db[_0xcfcd('0x2a')][_0xcfcd('0x44')]);_0x10ed31['query']=_[_0xcfcd('0x45')](_0xb7e5b2[_0xcfcd('0x2e')]);_0x10ed31[_0xcfcd('0x38')]=_[_0xcfcd('0x2f')](_0x10ed31[_0xcfcd('0x30')],_0x10ed31['query']);_0x5b6458[_0xcfcd('0x32')]=_[_0xcfcd('0x2f')](_0x10ed31[_0xcfcd('0x30')],qs[_0xcfcd('0x31')](_0xb7e5b2[_0xcfcd('0x2e')][_0xcfcd('0x31')]));_0x5b6458[_0xcfcd('0x32')]=_0x5b6458[_0xcfcd('0x32')][_0xcfcd('0x33')]?_0x5b6458['attributes']:_0x10ed31[_0xcfcd('0x30')];if(_0xb7e5b2[_0xcfcd('0x2e')][_0xcfcd('0x3d')]){_0x5b6458[_0xcfcd('0x3e')]=[{'all':!![]}];}_0x5b6458=_['merge']({},_0x5b6458,_0xb7e5b2[_0xcfcd('0x3c')]);return db['Cdr'][_0xcfcd('0x46')](_0x5b6458)[_0xcfcd('0x24')](handleEntityNotFound(_0x26c7c5,null))[_0xcfcd('0x24')](respondWithResult(_0x26c7c5,null))[_0xcfcd('0x41')](handleError(_0x26c7c5,null));};exports[_0xcfcd('0x47')]=function(_0x1a369e,_0x3980c2){return db[_0xcfcd('0x2a')][_0xcfcd('0x47')](_0x1a369e['body'],{})['then'](respondWithResult(_0x3980c2,0xc9))[_0xcfcd('0x41')](handleError(_0x3980c2,null));};exports[_0xcfcd('0x23')]=function(_0x1f010f,_0x2b957a){if(_0x1f010f['body']['id']){delete _0x1f010f[_0xcfcd('0x48')]['id'];}return db['Cdr'][_0xcfcd('0x46')]({'where':{'id':_0x1f010f[_0xcfcd('0x43')]['id']}})[_0xcfcd('0x24')](handleEntityNotFound(_0x2b957a,null))[_0xcfcd('0x24')](saveUpdates(_0x1f010f[_0xcfcd('0x48')],null))[_0xcfcd('0x24')](respondWithResult(_0x2b957a,null))[_0xcfcd('0x41')](handleError(_0x2b957a,null));};exports[_0xcfcd('0x25')]=function(_0xb70ef8,_0x13cc1c){return db[_0xcfcd('0x2a')][_0xcfcd('0x46')]({'where':{'id':_0xb70ef8['params']['id']}})[_0xcfcd('0x24')](handleEntityNotFound(_0x13cc1c,null))['then'](removeEntity(_0x13cc1c,null))[_0xcfcd('0x41')](handleError(_0x13cc1c,null));};exports[_0xcfcd('0x49')]=function(_0x10fda1,_0x353905){return db[_0xcfcd('0x2a')][_0xcfcd('0x49')]()[_0xcfcd('0x24')](respondWithResult(_0x353905,null))[_0xcfcd('0x41')](handleError(_0x353905,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9628719..34cf1e8 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 _0x430c=['bluebird','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','moment'];(function(_0x24565c,_0x19c020){var _0x3337ce=function(_0x4e88ef){while(--_0x4e88ef){_0x24565c['push'](_0x24565c['shift']());}};_0x3337ce(++_0x19c020);}(_0x430c,0x1a1));var _0xc430=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x430c[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x8')]},{'name':_0xc430('0x9'),'fields':[_0xc430('0x9')]},{'name':_0xc430('0xa'),'fields':[_0xc430('0xa')]},{'name':_0xc430('0xb'),'fields':['dst']},{'name':_0xc430('0xc'),'fields':[_0xc430('0xc')]},{'name':'uniqueid','fields':[_0xc430('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5fab=['request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x3b26cb,_0x56edae){var _0x2403d2=function(_0x41268c){while(--_0x41268c){_0x3b26cb['push'](_0x3b26cb['shift']());}};_0x2403d2(++_0x56edae);}(_0x5fab,0x177));var _0xb5fa=function(_0x6ffa12,_0x45a92a){_0x6ffa12=_0x6ffa12-0x0;var _0x17b047=_0x5fab[_0x6ffa12];return _0x17b047;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['accountcode']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['disposition']},{'name':'dst','fields':[_0xb5fa('0x10')]},{'name':_0xb5fa('0x11'),'fields':[_0xb5fa('0x11')]},{'name':_0xb5fa('0x12'),'fields':[_0xb5fa('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 55158fb..439c2a6 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 _0x030a=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2042cc,_0x2d9120){var _0x155c6a=function(_0x4e2cd1){while(--_0x4e2cd1){_0x2042cc['push'](_0x2042cc['shift']());}};_0x155c6a(++_0x2d9120);}(_0x030a,0x18c));var _0xa030=function(_0x1df9f4,_0x27c693){_0x1df9f4=_0x1df9f4-0x0;var _0x29f9c5=_0x030a[_0x1df9f4];return _0x29f9c5;};'use strict';var _=require(_0xa030('0x0'));var util=require(_0xa030('0x1'));var moment=require(_0xa030('0x2'));var BPromise=require(_0xa030('0x3'));var rs=require(_0xa030('0x4'));var fs=require('fs');var Redis=require(_0xa030('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa030('0x6'))(_0xa030('0x7'));var config=require(_0xa030('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51ec19,_0x42fbe6,_0x358a0f){return new BPromise(function(_0x15bb5c,_0x5ae668){return client['request'](_0x51ec19,_0x358a0f)[_0xa030('0xa')](function(_0x4ad427){logger[_0xa030('0xb')](_0xa030('0xc'),_0x42fbe6,_0xa030('0xd'));logger['debug'](_0xa030('0xe'),_0x42fbe6,_0xa030('0xd'),JSON[_0xa030('0xf')](_0x4ad427));if(_0x4ad427[_0xa030('0x10')]){if(_0x4ad427[_0xa030('0x10')][_0xa030('0x11')]===0x1f4){logger[_0xa030('0x10')]('Cdr,\x20%s,\x20%s',_0x42fbe6,_0x4ad427[_0xa030('0x10')][_0xa030('0x12')]);return _0x5ae668(_0x4ad427[_0xa030('0x10')][_0xa030('0x12')]);}logger[_0xa030('0x10')](_0xa030('0xc'),_0x42fbe6,_0x4ad427[_0xa030('0x10')][_0xa030('0x12')]);return _0x15bb5c(_0x4ad427[_0xa030('0x10')]['message']);}else{logger['info'](_0xa030('0xc'),_0x42fbe6,_0xa030('0xd'));_0x15bb5c(_0x4ad427[_0xa030('0x13')][_0xa030('0x12')]);}})[_0xa030('0x14')](function(_0x1bcd0c){logger[_0xa030('0x10')](_0xa030('0xc'),_0x42fbe6,_0x1bcd0c);_0x5ae668(_0x1bcd0c);});});} \ No newline at end of file +var _0x00a9=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x00a9,0xe8));var _0x900a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x00a9[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x900a('0x0'));var util=require(_0x900a('0x1'));var moment=require(_0x900a('0x2'));var BPromise=require('bluebird');var rs=require(_0x900a('0x3'));var fs=require('fs');var Redis=require(_0x900a('0x4'));var db=require(_0x900a('0x5'))['db'];var utils=require(_0x900a('0x6'));var logger=require(_0x900a('0x7'))(_0x900a('0x8'));var config=require(_0x900a('0x9'));var jayson=require(_0x900a('0xa'));var client=jayson[_0x900a('0xb')][_0x900a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fc710,_0x3920be,_0x2051b9){return new BPromise(function(_0x11a308,_0x5e2672){return client[_0x900a('0xd')](_0x3fc710,_0x2051b9)[_0x900a('0xe')](function(_0x580e6f){logger[_0x900a('0xf')](_0x900a('0x10'),_0x3920be,_0x900a('0x11'));logger['debug'](_0x900a('0x12'),_0x3920be,_0x900a('0x11'),JSON['stringify'](_0x580e6f));if(_0x580e6f[_0x900a('0x13')]){if(_0x580e6f[_0x900a('0x13')][_0x900a('0x14')]===0x1f4){logger[_0x900a('0x13')]('Cdr,\x20%s,\x20%s',_0x3920be,_0x580e6f[_0x900a('0x13')]['message']);return _0x5e2672(_0x580e6f[_0x900a('0x13')][_0x900a('0x15')]);}logger[_0x900a('0x13')](_0x900a('0x10'),_0x3920be,_0x580e6f[_0x900a('0x13')][_0x900a('0x15')]);return _0x11a308(_0x580e6f[_0x900a('0x13')][_0x900a('0x15')]);}else{logger['info'](_0x900a('0x10'),_0x3920be,_0x900a('0x11'));_0x11a308(_0x580e6f[_0x900a('0x16')][_0x900a('0x15')]);}})['catch'](function(_0x2ca193){logger['error'](_0x900a('0x10'),_0x3920be,_0x2ca193);_0x5e2672(_0x2ca193);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3c60e13..6122f5d 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 _0x7402=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','/describe','describe','/:id','show','put','destroy','exports'];(function(_0x139d3a,_0x23931e){var _0x345d6b=function(_0x3b1433){while(--_0x3b1433){_0x139d3a['push'](_0x139d3a['shift']());}};_0x345d6b(++_0x23931e);}(_0x7402,0x120));var _0x2740=function(_0x92d580,_0x4928fb){_0x92d580=_0x92d580-0x0;var _0x4ee344=_0x7402[_0x92d580];return _0x4ee344;};'use strict';var multer=require(_0x2740('0x0'));var util=require(_0x2740('0x1'));var path=require(_0x2740('0x2'));var timeout=require(_0x2740('0x3'));var express=require(_0x2740('0x4'));var router=express['Router']();var auth=require(_0x2740('0x5'));var interaction=require(_0x2740('0x6'));var config=require(_0x2740('0x7'));var controller=require(_0x2740('0x8'));router['get']('/',auth[_0x2740('0x9')](),controller[_0x2740('0xa')]);router['get'](_0x2740('0xb'),auth[_0x2740('0x9')](),controller[_0x2740('0xc')]);router['get'](_0x2740('0xd'),auth[_0x2740('0x9')](),controller[_0x2740('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2740('0xf')]('/:id',auth[_0x2740('0x9')](),controller['update']);router['delete'](_0x2740('0xd'),auth['isAuthenticated'](),controller[_0x2740('0x10')]);module[_0x2740('0x11')]=router; \ No newline at end of file +var _0xaf95=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xaf95,0x180));var _0x5af9=function(_0x2db4c1,_0x3d87fd){_0x2db4c1=_0x2db4c1-0x0;var _0x3fe1c3=_0xaf95[_0x2db4c1];return _0x3fe1c3;};'use strict';var multer=require(_0x5af9('0x0'));var util=require('util');var path=require(_0x5af9('0x1'));var timeout=require(_0x5af9('0x2'));var express=require(_0x5af9('0x3'));var router=express[_0x5af9('0x4')]();var auth=require(_0x5af9('0x5'));var interaction=require(_0x5af9('0x6'));var config=require(_0x5af9('0x7'));var controller=require(_0x5af9('0x8'));router[_0x5af9('0x9')]('/',auth[_0x5af9('0xa')](),controller[_0x5af9('0xb')]);router['get']('/describe',auth[_0x5af9('0xa')](),controller[_0x5af9('0xc')]);router[_0x5af9('0x9')](_0x5af9('0xd'),auth[_0x5af9('0xa')](),controller[_0x5af9('0xe')]);router[_0x5af9('0xf')]('/',auth[_0x5af9('0xa')](),controller['create']);router[_0x5af9('0x10')](_0x5af9('0xd'),auth[_0x5af9('0xa')](),controller['update']);router[_0x5af9('0x11')](_0x5af9('0xd'),auth[_0x5af9('0xa')](),controller[_0x5af9('0x12')]);module[_0x5af9('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 977d4a5..d79a9b8 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 _0x4963=['*,*,*,*','exports','STRING','noop'];(function(_0x1d67a0,_0x4bb12b){var _0x42f8af=function(_0x296376){while(--_0x296376){_0x1d67a0['push'](_0x1d67a0['shift']());}};_0x42f8af(++_0x4bb12b);}(_0x4963,0xd9));var _0x3496=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4963[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x3496('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3496('0x1')],'allowNull':![],'defaultValue':_0x3496('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3496('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3496('0x3')}}; \ No newline at end of file +var _0xaa3b=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x4c85e4,_0x24d438){var _0x424be6=function(_0x4f9e44){while(--_0x4f9e44){_0x4c85e4['push'](_0x4c85e4['shift']());}};_0x424be6(++_0x24d438);}(_0xaa3b,0xcb));var _0xbaa3=function(_0x413d74,_0x5bab1b){_0x413d74=_0x413d74-0x0;var _0x177f90=_0xaa3b[_0x413d74];return _0x177f90;};'use strict';var Sequelize=require(_0xbaa3('0x0'));module[_0xbaa3('0x1')]={'priority':{'type':Sequelize[_0xbaa3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbaa3('0x3')],'allowNull':![],'defaultValue':_0xbaa3('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbaa3('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f2b8072..76fa2aa 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 _0xe6c6=['model','ChatApplication','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show'];(function(_0x159c68,_0xc544c9){var _0x32792f=function(_0x3c4ed5){while(--_0x3c4ed5){_0x159c68['push'](_0x159c68['shift']());}};_0x32792f(++_0xc544c9);}(_0xe6c6,0x1ef));var _0x6e6c=function(_0x2d791e,_0x24490b){_0x2d791e=_0x2d791e-0x0;var _0x5108ee=_0xe6c6[_0x2d791e];return _0x5108ee;};'use strict';var pdf=require(_0x6e6c('0x0'));var emlformat=require(_0x6e6c('0x1'));var rimraf=require(_0x6e6c('0x2'));var zipdir=require(_0x6e6c('0x3'));var jsonpatch=require(_0x6e6c('0x4'));var rp=require('request-promise');var moment=require(_0x6e6c('0x5'));var BPromise=require(_0x6e6c('0x6'));var Mustache=require(_0x6e6c('0x7'));var util=require(_0x6e6c('0x8'));var path=require('path');var sox=require(_0x6e6c('0x9'));var csv=require('to-csv');var ejs=require(_0x6e6c('0xa'));var fs=require('fs');var _=require(_0x6e6c('0xb'));var squel=require(_0x6e6c('0xc'));var crypto=require(_0x6e6c('0xd'));var jsforce=require(_0x6e6c('0xe'));var deskjs=require(_0x6e6c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6e6c('0x10'));var Papa=require(_0x6e6c('0x11'));var Redis=require(_0x6e6c('0x12'));var authService=require(_0x6e6c('0x13'));var qs=require(_0x6e6c('0x14'));var as=require(_0x6e6c('0x15'));var hardwareService=require(_0x6e6c('0x16'));var logger=require(_0x6e6c('0x17'))(_0x6e6c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e6c('0x19'));var db=require(_0x6e6c('0x1a'))['db'];function respondWithStatusCode(_0x1b5509,_0xcfa3c8){_0xcfa3c8=_0xcfa3c8||0xcc;return function(_0xc623f9){if(_0xc623f9){return _0x1b5509[_0x6e6c('0x1b')](_0xcfa3c8);}return _0x1b5509[_0x6e6c('0x1c')](_0xcfa3c8)['end']();};}function respondWithResult(_0x305ea4,_0x2c96e0){_0x2c96e0=_0x2c96e0||0xc8;return function(_0x37d510){if(_0x37d510){return _0x305ea4['status'](_0x2c96e0)[_0x6e6c('0x1d')](_0x37d510);}};}function respondWithFilteredResult(_0x15168c,_0x1e2bec){return function(_0x4e43b5){if(_0x4e43b5){var _0xc930ae=_0x4e43b5['count'],_0x4996df=_0x1e2bec[_0x6e6c('0x1e')],_0x6ee309=_0x1e2bec['offset']+_0x1e2bec[_0x6e6c('0x1f')],_0x308d1a;if(_0x6ee309>=_0xc930ae){_0x6ee309=_0xc930ae;_0x308d1a=0xc8;}else{_0x308d1a=0xce;}_0x15168c[_0x6e6c('0x1c')](_0x308d1a);return _0x15168c[_0x6e6c('0x20')](_0x6e6c('0x21'),_0x4996df+'-'+_0x6ee309+'/'+_0xc930ae)[_0x6e6c('0x1d')](_0x4e43b5);}return null;};}function patchUpdates(_0x454137){return function(_0x1da29d){try{jsonpatch[_0x6e6c('0x22')](_0x1da29d,_0x454137,!![]);}catch(_0x1867c8){return BPromise[_0x6e6c('0x23')](_0x1867c8);}return _0x1da29d[_0x6e6c('0x24')]();};}function saveUpdates(_0x180375,_0x544158){return function(_0x208044){if(_0x208044){return _0x208044[_0x6e6c('0x25')](_0x180375)[_0x6e6c('0x26')](function(_0x2fe0df){return _0x2fe0df;});}return null;};}function removeEntity(_0x20a22d,_0x2e8955){return function(_0x1f0182){if(_0x1f0182){return _0x1f0182[_0x6e6c('0x27')]()[_0x6e6c('0x26')](function(){_0x20a22d[_0x6e6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a29c6,_0x1d55fb){return function(_0x5b2400){if(!_0x5b2400){_0x3a29c6['sendStatus'](0x194);}return _0x5b2400;};}function handleError(_0x4c726f,_0x8a3ed){_0x8a3ed=_0x8a3ed||0x1f4;return function(_0x1a4e26){logger[_0x6e6c('0x28')](_0x1a4e26[_0x6e6c('0x29')]);if(_0x1a4e26[_0x6e6c('0x2a')]){delete _0x1a4e26['name'];}_0x4c726f[_0x6e6c('0x1c')](_0x8a3ed)[_0x6e6c('0x2b')](_0x1a4e26);};}exports[_0x6e6c('0x2c')]=function(_0x31f98c,_0x1bcc72){var _0x340c15={'raw':!![],'where':{'id':_0x31f98c['params']['id']}},_0x2bc324={};_0x2bc324[_0x6e6c('0x2d')]=_['keys'](db[_0x6e6c('0x2e')]['rawAttributes']);_0x2bc324['query']=_[_0x6e6c('0x2f')](_0x31f98c[_0x6e6c('0x30')]);_0x2bc324['filters']=_[_0x6e6c('0x31')](_0x2bc324[_0x6e6c('0x2d')],_0x2bc324[_0x6e6c('0x30')]);_0x340c15[_0x6e6c('0x32')]=_[_0x6e6c('0x31')](_0x2bc324['model'],qs[_0x6e6c('0x33')](_0x31f98c[_0x6e6c('0x30')]['fields']));_0x340c15[_0x6e6c('0x32')]=_0x340c15['attributes'][_0x6e6c('0x34')]?_0x340c15[_0x6e6c('0x32')]:_0x2bc324['model'];if(_0x31f98c['query'][_0x6e6c('0x35')]){_0x340c15[_0x6e6c('0x36')]=[{'all':!![]}];}_0x340c15=_[_0x6e6c('0x37')]({},_0x340c15,_0x31f98c[_0x6e6c('0x38')]);return db[_0x6e6c('0x2e')][_0x6e6c('0x39')](_0x340c15)[_0x6e6c('0x26')](handleEntityNotFound(_0x1bcc72,null))[_0x6e6c('0x26')](respondWithResult(_0x1bcc72,null))[_0x6e6c('0x3a')](handleError(_0x1bcc72,null));};exports[_0x6e6c('0x25')]=function(_0x3aab63,_0x28a87d){if(_0x3aab63[_0x6e6c('0x3b')]['id']){delete _0x3aab63[_0x6e6c('0x3b')]['id'];}return db[_0x6e6c('0x2e')][_0x6e6c('0x39')]({'where':{'id':_0x3aab63['params']['id']}})[_0x6e6c('0x26')](handleEntityNotFound(_0x28a87d,null))['then'](saveUpdates(_0x3aab63[_0x6e6c('0x3b')],null))['then'](respondWithResult(_0x28a87d,null))[_0x6e6c('0x3a')](handleError(_0x28a87d,null));};exports['destroy']=function(_0x29f959,_0x3858b2){return db[_0x6e6c('0x2e')][_0x6e6c('0x39')]({'where':{'id':_0x29f959['params']['id']}})[_0x6e6c('0x26')](handleEntityNotFound(_0x3858b2,null))[_0x6e6c('0x26')](removeEntity(_0x3858b2,null))[_0x6e6c('0x3a')](handleError(_0x3858b2,null));}; \ No newline at end of file +var _0xabd3=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','merge','options','ChatApplication','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xabd3,0xa1));var _0x3abd=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xabd3[_0x41c381];return _0x427981;};'use strict';var pdf=require(_0x3abd('0x0'));var emlformat=require(_0x3abd('0x1'));var rimraf=require(_0x3abd('0x2'));var zipdir=require(_0x3abd('0x3'));var jsonpatch=require(_0x3abd('0x4'));var rp=require(_0x3abd('0x5'));var moment=require(_0x3abd('0x6'));var BPromise=require(_0x3abd('0x7'));var Mustache=require(_0x3abd('0x8'));var util=require('util');var path=require(_0x3abd('0x9'));var sox=require(_0x3abd('0xa'));var csv=require('to-csv');var ejs=require(_0x3abd('0xb'));var fs=require('fs');var _=require(_0x3abd('0xc'));var squel=require(_0x3abd('0xd'));var crypto=require(_0x3abd('0xe'));var jsforce=require(_0x3abd('0xf'));var deskjs=require(_0x3abd('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3abd('0x11'));var Redis=require(_0x3abd('0x12'));var authService=require(_0x3abd('0x13'));var qs=require(_0x3abd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3abd('0x15'));var logger=require(_0x3abd('0x16'))('api');var utils=require(_0x3abd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3abd('0x18'))['db'];function respondWithStatusCode(_0x2d9641,_0x409f34){_0x409f34=_0x409f34||0xcc;return function(_0x2f0014){if(_0x2f0014){return _0x2d9641[_0x3abd('0x19')](_0x409f34);}return _0x2d9641['status'](_0x409f34)[_0x3abd('0x1a')]();};}function respondWithResult(_0x38cb36,_0x5d2929){_0x5d2929=_0x5d2929||0xc8;return function(_0x546a90){if(_0x546a90){return _0x38cb36['status'](_0x5d2929)[_0x3abd('0x1b')](_0x546a90);}};}function respondWithFilteredResult(_0x33fc08,_0x451120){return function(_0x406e16){if(_0x406e16){var _0x30f4e1=_0x406e16[_0x3abd('0x1c')],_0x5ae55a=_0x451120[_0x3abd('0x1d')],_0x3e642e=_0x451120[_0x3abd('0x1d')]+_0x451120['limit'],_0x45381d;if(_0x3e642e>=_0x30f4e1){_0x3e642e=_0x30f4e1;_0x45381d=0xc8;}else{_0x45381d=0xce;}_0x33fc08['status'](_0x45381d);return _0x33fc08[_0x3abd('0x1e')](_0x3abd('0x1f'),_0x5ae55a+'-'+_0x3e642e+'/'+_0x30f4e1)[_0x3abd('0x1b')](_0x406e16);}return null;};}function patchUpdates(_0x4e863f){return function(_0x19710e){try{jsonpatch[_0x3abd('0x20')](_0x19710e,_0x4e863f,!![]);}catch(_0x314478){return BPromise[_0x3abd('0x21')](_0x314478);}return _0x19710e[_0x3abd('0x22')]();};}function saveUpdates(_0x496a5e,_0x2a2731){return function(_0xba2f51){if(_0xba2f51){return _0xba2f51[_0x3abd('0x23')](_0x496a5e)[_0x3abd('0x24')](function(_0x369b06){return _0x369b06;});}return null;};}function removeEntity(_0x2a9a39,_0x367eff){return function(_0x36ea11){if(_0x36ea11){return _0x36ea11[_0x3abd('0x25')]()[_0x3abd('0x24')](function(){_0x2a9a39[_0x3abd('0x26')](0xcc)[_0x3abd('0x1a')]();});}};}function handleEntityNotFound(_0xf48bf1,_0x2ad07a){return function(_0x4c50fa){if(!_0x4c50fa){_0xf48bf1[_0x3abd('0x19')](0x194);}return _0x4c50fa;};}function handleError(_0x31fa12,_0x52abd4){_0x52abd4=_0x52abd4||0x1f4;return function(_0x58bbaf){logger[_0x3abd('0x27')](_0x58bbaf[_0x3abd('0x28')]);if(_0x58bbaf[_0x3abd('0x29')]){delete _0x58bbaf['name'];}_0x31fa12[_0x3abd('0x26')](_0x52abd4)[_0x3abd('0x2a')](_0x58bbaf);};}exports['show']=function(_0x2f70b5,_0x5b6db0){var _0x5ace67={'raw':!![],'where':{'id':_0x2f70b5[_0x3abd('0x2b')]['id']}},_0x131c7d={};_0x131c7d[_0x3abd('0x2c')]=_[_0x3abd('0x2d')](db['ChatApplication'][_0x3abd('0x2e')]);_0x131c7d[_0x3abd('0x2f')]=_['keys'](_0x2f70b5[_0x3abd('0x2f')]);_0x131c7d['filters']=_['intersection'](_0x131c7d[_0x3abd('0x2c')],_0x131c7d[_0x3abd('0x2f')]);_0x5ace67[_0x3abd('0x30')]=_[_0x3abd('0x31')](_0x131c7d['model'],qs[_0x3abd('0x32')](_0x2f70b5['query']['fields']));_0x5ace67[_0x3abd('0x30')]=_0x5ace67['attributes'][_0x3abd('0x33')]?_0x5ace67[_0x3abd('0x30')]:_0x131c7d['model'];if(_0x2f70b5['query'][_0x3abd('0x34')]){_0x5ace67['include']=[{'all':!![]}];}_0x5ace67=_[_0x3abd('0x35')]({},_0x5ace67,_0x2f70b5[_0x3abd('0x36')]);return db[_0x3abd('0x37')][_0x3abd('0x38')](_0x5ace67)[_0x3abd('0x24')](handleEntityNotFound(_0x5b6db0,null))['then'](respondWithResult(_0x5b6db0,null))[_0x3abd('0x39')](handleError(_0x5b6db0,null));};exports['update']=function(_0x32fb4e,_0x9c53ce){if(_0x32fb4e['body']['id']){delete _0x32fb4e[_0x3abd('0x3a')]['id'];}return db['ChatApplication'][_0x3abd('0x38')]({'where':{'id':_0x32fb4e[_0x3abd('0x2b')]['id']}})[_0x3abd('0x24')](handleEntityNotFound(_0x9c53ce,null))[_0x3abd('0x24')](saveUpdates(_0x32fb4e[_0x3abd('0x3a')],null))['then'](respondWithResult(_0x9c53ce,null))[_0x3abd('0x39')](handleError(_0x9c53ce,null));};exports['destroy']=function(_0x20f533,_0x53963d){return db['ChatApplication']['find']({'where':{'id':_0x20f533[_0x3abd('0x2b')]['id']}})[_0x3abd('0x24')](handleEntityNotFound(_0x53963d,null))[_0x3abd('0x24')](removeEntity(_0x53963d,null))[_0x3abd('0x39')](handleError(_0x53963d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a7101ac..65da842 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1d45938..83f9792 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 _0x3a5e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','bluebird'];(function(_0x507abf,_0x102de1){var _0x93bddf=function(_0x1230d8){while(--_0x1230d8){_0x507abf['push'](_0x507abf['shift']());}};_0x93bddf(++_0x102de1);}(_0x3a5e,0xd9));var _0xe3a5=function(_0x40bb16,_0x29c57f){_0x40bb16=_0x40bb16-0x0;var _0x43fea2=_0x3a5e[_0x40bb16];return _0x43fea2;};'use strict';var _=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var moment=require('moment');var BPromise=require(_0xe3a5('0x2'));var rs=require(_0xe3a5('0x3'));var fs=require('fs');var Redis=require(_0xe3a5('0x4'));var db=require(_0xe3a5('0x5'))['db'];var utils=require(_0xe3a5('0x6'));var logger=require(_0xe3a5('0x7'))(_0xe3a5('0x8'));var config=require(_0xe3a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe3a5('0xa')][_0xe3a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf6b1,_0x298f2f,_0x101bfb){return new BPromise(function(_0x27606c,_0x27cd00){return client[_0xe3a5('0xc')](_0x3bf6b1,_0x101bfb)[_0xe3a5('0xd')](function(_0x58725e){logger[_0xe3a5('0xe')]('ChatApplication,\x20%s,\x20%s',_0x298f2f,'request\x20sent');logger[_0xe3a5('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x298f2f,_0xe3a5('0x10'),JSON[_0xe3a5('0x11')](_0x58725e));if(_0x58725e[_0xe3a5('0x12')]){if(_0x58725e[_0xe3a5('0x12')]['code']===0x1f4){logger[_0xe3a5('0x12')](_0xe3a5('0x13'),_0x298f2f,_0x58725e[_0xe3a5('0x12')][_0xe3a5('0x14')]);return _0x27cd00(_0x58725e['error']['message']);}logger[_0xe3a5('0x12')](_0xe3a5('0x13'),_0x298f2f,_0x58725e[_0xe3a5('0x12')][_0xe3a5('0x14')]);return _0x27606c(_0x58725e[_0xe3a5('0x12')][_0xe3a5('0x14')]);}else{logger[_0xe3a5('0xe')](_0xe3a5('0x13'),_0x298f2f,_0xe3a5('0x10'));_0x27606c(_0x58725e['result']['message']);}})[_0xe3a5('0x15')](function(_0x3b651c){logger[_0xe3a5('0x12')](_0xe3a5('0x13'),_0x298f2f,_0x3b651c);_0x27cd00(_0x3b651c);});});} \ No newline at end of file +var _0x9197=['info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5913d7,_0x3df32d){var _0xa64bd1=function(_0x436d0c){while(--_0x436d0c){_0x5913d7['push'](_0x5913d7['shift']());}};_0xa64bd1(++_0x3df32d);}(_0x9197,0x1c2));var _0x7919=function(_0x564094,_0x566b75){_0x564094=_0x564094-0x0;var _0x2c196d=_0x9197[_0x564094];return _0x2c196d;};'use strict';var _=require(_0x7919('0x0'));var util=require(_0x7919('0x1'));var moment=require(_0x7919('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7919('0x3'));var db=require(_0x7919('0x4'))['db'];var utils=require(_0x7919('0x5'));var logger=require(_0x7919('0x6'))('rpc');var config=require(_0x7919('0x7'));var jayson=require(_0x7919('0x8'));var client=jayson[_0x7919('0x9')][_0x7919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e06b1,_0x3a9aac,_0x40756f){return new BPromise(function(_0x456799,_0x1677bb){return client[_0x7919('0xb')](_0x4e06b1,_0x40756f)['then'](function(_0xe05fd3){logger[_0x7919('0xc')]('ChatApplication,\x20%s,\x20%s',_0x3a9aac,_0x7919('0xd'));logger['debug'](_0x7919('0xe'),_0x3a9aac,'request\x20sent',JSON[_0x7919('0xf')](_0xe05fd3));if(_0xe05fd3['error']){if(_0xe05fd3[_0x7919('0x10')][_0x7919('0x11')]===0x1f4){logger[_0x7919('0x10')](_0x7919('0x12'),_0x3a9aac,_0xe05fd3[_0x7919('0x10')][_0x7919('0x13')]);return _0x1677bb(_0xe05fd3[_0x7919('0x10')][_0x7919('0x13')]);}logger[_0x7919('0x10')]('ChatApplication,\x20%s,\x20%s',_0x3a9aac,_0xe05fd3[_0x7919('0x10')]['message']);return _0x456799(_0xe05fd3['error'][_0x7919('0x13')]);}else{logger[_0x7919('0xc')](_0x7919('0x12'),_0x3a9aac,_0x7919('0xd'));_0x456799(_0xe05fd3['result'][_0x7919('0x13')]);}})[_0x7919('0x14')](function(_0x34c695){logger[_0x7919('0x10')](_0x7919('0x12'),_0x3a9aac,_0x34c695);_0x1677bb(_0x34c695);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a30cab7..c340a2b 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 _0xf0ce=['./chatApplication.controller','get','/:id','show','put','isAuthenticated','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa43caf,_0x3270c8){var _0x531e78=function(_0x2b9cb2){while(--_0x2b9cb2){_0xa43caf['push'](_0xa43caf['shift']());}};_0x531e78(++_0x3270c8);}(_0xf0ce,0x1d9));var _0xef0c=function(_0x337b91,_0x3db561){_0x337b91=_0x337b91-0x0;var _0x20ed8b=_0xf0ce[_0x337b91];return _0x20ed8b;};'use strict';var multer=require('multer');var util=require(_0xef0c('0x0'));var path=require(_0xef0c('0x1'));var timeout=require(_0xef0c('0x2'));var express=require(_0xef0c('0x3'));var router=express['Router']();var auth=require(_0xef0c('0x4'));var interaction=require(_0xef0c('0x5'));var config=require(_0xef0c('0x6'));var controller=require(_0xef0c('0x7'));router[_0xef0c('0x8')](_0xef0c('0x9'),auth['isAuthenticated'](),controller[_0xef0c('0xa')]);router[_0xef0c('0xb')](_0xef0c('0x9'),auth[_0xef0c('0xc')](),controller['update']);router[_0xef0c('0xd')](_0xef0c('0x9'),auth[_0xef0c('0xc')](),controller['destroy']);module[_0xef0c('0xe')]=router; \ No newline at end of file +var _0xb2fc=['multer','util','path','express','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','show','put','update','delete','isAuthenticated','destroy','exports'];(function(_0x75e624,_0x576b2a){var _0x4b986e=function(_0x302120){while(--_0x302120){_0x75e624['push'](_0x75e624['shift']());}};_0x4b986e(++_0x576b2a);}(_0xb2fc,0x14a));var _0xcb2f=function(_0x5bb5e6,_0xfeff09){_0x5bb5e6=_0x5bb5e6-0x0;var _0x703993=_0xb2fc[_0x5bb5e6];return _0x703993;};'use strict';var multer=require(_0xcb2f('0x0'));var util=require(_0xcb2f('0x1'));var path=require(_0xcb2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb2f('0x3'));var router=express['Router']();var auth=require(_0xcb2f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcb2f('0x5'));var controller=require(_0xcb2f('0x6'));router['get'](_0xcb2f('0x7'),auth['isAuthenticated'](),controller[_0xcb2f('0x8')]);router[_0xcb2f('0x9')](_0xcb2f('0x7'),auth['isAuthenticated'](),controller[_0xcb2f('0xa')]);router[_0xcb2f('0xb')](_0xcb2f('0x7'),auth[_0xcb2f('0xc')](),controller[_0xcb2f('0xd')]);module[_0xcb2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 616af33..c306f4a 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 _0x44cb=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4336d2,_0x46754){var _0x586758=function(_0x1a0ecf){while(--_0x1a0ecf){_0x4336d2['push'](_0x4336d2['shift']());}};_0x586758(++_0x46754);}(_0x44cb,0x19e));var _0xb44c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x44cb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb44c('0x0'));module[_0xb44c('0x1')]={'name':{'type':Sequelize[_0xb44c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb44c('0x2')]},'write':{'type':Sequelize[_0xb44c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9fcf=['BOOLEAN','exports','STRING'];(function(_0x35a5d9,_0x19253f){var _0x1c001d=function(_0x47dd5e){while(--_0x47dd5e){_0x35a5d9['push'](_0x35a5d9['shift']());}};_0x1c001d(++_0x19253f);}(_0x9fcf,0x11e));var _0xf9fc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9fcf[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xf9fc('0x0')]={'name':{'type':Sequelize[_0xf9fc('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf9fc('0x1')]},'write':{'type':Sequelize[_0xf9fc('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b914218..8eeae2b 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 _0x75dc=['catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','send','map','ChatGroup','rawAttributes','key','model','name','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','find','create','body','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','keys','pick','hasOwnProperty','removeMembers','addMessage','ChatGroupId','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','http','request','then','info','ChatGroup,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x38b56e,_0x393912){var _0x1f05c1=function(_0x224cf8){while(--_0x224cf8){_0x38b56e['push'](_0x38b56e['shift']());}};_0x1f05c1(++_0x393912);}(_0x75dc,0x1d7));var _0xc75d=function(_0x1c441b,_0x113389){_0x1c441b=_0x1c441b-0x0;var _0x50b12c=_0x75dc[_0x1c441b];return _0x50b12c;};'use strict';var pdf=require(_0xc75d('0x0'));var emlformat=require(_0xc75d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc75d('0x2'));var moment=require(_0xc75d('0x3'));var BPromise=require(_0xc75d('0x4'));var Mustache=require(_0xc75d('0x5'));var util=require(_0xc75d('0x6'));var path=require(_0xc75d('0x7'));var sox=require('sox');var csv=require(_0xc75d('0x8'));var ejs=require(_0xc75d('0x9'));var fs=require('fs');var _=require(_0xc75d('0xa'));var squel=require('squel');var crypto=require(_0xc75d('0xb'));var jsforce=require(_0xc75d('0xc'));var deskjs=require(_0xc75d('0xd'));var toCsv=require(_0xc75d('0x8'));var querystring=require('querystring');var Papa=require(_0xc75d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc75d('0xf'));var as=require(_0xc75d('0x10'));var hardwareService=require(_0xc75d('0x11'));var logger=require(_0xc75d('0x12'))('api');var utils=require(_0xc75d('0x13'));var config=require(_0xc75d('0x14'));var licenseUtil=require(_0xc75d('0x15'));var db=require(_0xc75d('0x16'))['db'];config[_0xc75d('0x17')]=_[_0xc75d('0x18')](config[_0xc75d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc75d('0x19'))(new Redis(config[_0xc75d('0x17')]));require(_0xc75d('0x1a'))[_0xc75d('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc75d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x182f56,_0x174998,_0x1b0bfc,_0x1d49b9){return new BPromise(function(_0x331d68,_0x2bd581){var _0x4b8552=_0x1d49b9||client;return _0x4b8552[_0xc75d('0x1d')](_0x182f56,_0x1b0bfc)[_0xc75d('0x1e')](function(_0x2d8aeb){logger[_0xc75d('0x1f')](_0xc75d('0x20'),_0x174998,'request\x20sent');logger[_0xc75d('0x21')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x174998,'request\x20sent',JSON[_0xc75d('0x22')](_0x2d8aeb));if(_0x2d8aeb[_0xc75d('0x23')]){if(_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x24')]===0x1f4){logger[_0xc75d('0x23')]('ChatGroup,\x20%s,\x20%s',_0x174998,_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x25')]);return _0x2bd581(_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x25')]);}logger[_0xc75d('0x23')](_0xc75d('0x20'),_0x174998,_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x25')]);return _0x331d68(_0x2d8aeb['error'][_0xc75d('0x25')]);}else{logger[_0xc75d('0x1f')](_0xc75d('0x20'),_0x174998,_0xc75d('0x26'));_0x331d68(_0x2d8aeb['result'][_0xc75d('0x25')]);}})[_0xc75d('0x27')](function(_0xdb14e1){logger[_0xc75d('0x23')](_0xc75d('0x20'),_0x174998,_0xdb14e1);_0x2bd581(_0xdb14e1);});});}function respondWithStatusCode(_0x2e1687,_0x478787){_0x478787=_0x478787||0xcc;return function(_0x35d72b){if(_0x35d72b){return _0x2e1687[_0xc75d('0x28')](_0x478787);}return _0x2e1687['status'](_0x478787)['end']();};}function respondWithResult(_0x4b5c88,_0xd2b678){_0xd2b678=_0xd2b678||0xc8;return function(_0x452c51){if(_0x452c51){return _0x4b5c88[_0xc75d('0x29')](_0xd2b678)[_0xc75d('0x2a')](_0x452c51);}};}function respondWithFilteredResult(_0x6bee54,_0x47b7b2){return function(_0x56fe50){if(_0x56fe50){var _0x3d8329=_0x56fe50[_0xc75d('0x2b')],_0x17f45b=_0x47b7b2[_0xc75d('0x2c')],_0x50a7be=_0x47b7b2[_0xc75d('0x2c')]+_0x47b7b2['limit'],_0x2ba845;if(_0x50a7be>=_0x3d8329){_0x50a7be=_0x3d8329;_0x2ba845=0xc8;}else{_0x2ba845=0xce;}_0x6bee54[_0xc75d('0x29')](_0x2ba845);return _0x6bee54[_0xc75d('0x2d')](_0xc75d('0x2e'),_0x17f45b+'-'+_0x50a7be+'/'+_0x3d8329)['json'](_0x56fe50);}return null;};}function patchUpdates(_0x5e3b25){return function(_0x3794c3){try{jsonpatch[_0xc75d('0x2f')](_0x3794c3,_0x5e3b25,!![]);}catch(_0x5103d7){return BPromise[_0xc75d('0x30')](_0x5103d7);}return _0x3794c3[_0xc75d('0x31')]();};}function saveUpdates(_0x1d08a4,_0x211166){return function(_0x71df28){if(_0x71df28){return _0x71df28[_0xc75d('0x32')](_0x1d08a4)[_0xc75d('0x1e')](function(_0x29948b){return _0x29948b;});}return null;};}function removeEntity(_0x2a8f03,_0xcac4cc){return function(_0x232d17){if(_0x232d17){return _0x232d17[_0xc75d('0x33')]()[_0xc75d('0x1e')](function(){_0x2a8f03['status'](0xcc)[_0xc75d('0x34')]();});}};}function handleEntityNotFound(_0xa2294b,_0xfcf0f8){return function(_0xe52781){if(!_0xe52781){_0xa2294b['sendStatus'](0x194);}return _0xe52781;};}function handleError(_0x2521d8,_0x362695){_0x362695=_0x362695||0x1f4;return function(_0x3aa5a4){logger['error'](_0x3aa5a4['stack']);if(_0x3aa5a4['name']){delete _0x3aa5a4['name'];}_0x2521d8[_0xc75d('0x29')](_0x362695)[_0xc75d('0x35')](_0x3aa5a4);};}exports['index']=function(_0x10a440,_0x186f58){var _0x2de9cf={},_0x3817ac={},_0x2b2686={'count':0x0,'rows':[]};var _0x3bf55f=_[_0xc75d('0x36')](db[_0xc75d('0x37')][_0xc75d('0x38')],function(_0x46a4eb){return{'name':_0x46a4eb['fieldName'],'type':_0x46a4eb['type'][_0xc75d('0x39')]};});_0x3817ac[_0xc75d('0x3a')]=_[_0xc75d('0x36')](_0x3bf55f,_0xc75d('0x3b'));_0x3817ac[_0xc75d('0x3c')]=_['keys'](_0x10a440[_0xc75d('0x3c')]);_0x3817ac[_0xc75d('0x3d')]=_[_0xc75d('0x3e')](_0x3817ac[_0xc75d('0x3a')],_0x3817ac[_0xc75d('0x3c')]);_0x2de9cf['attributes']=_[_0xc75d('0x3e')](_0x3817ac[_0xc75d('0x3a')],qs['fields'](_0x10a440['query'][_0xc75d('0x3f')]));_0x2de9cf[_0xc75d('0x40')]=_0x2de9cf[_0xc75d('0x40')][_0xc75d('0x41')]?_0x2de9cf[_0xc75d('0x40')]:_0x3817ac[_0xc75d('0x3a')];if(!_0x10a440[_0xc75d('0x3c')]['hasOwnProperty'](_0xc75d('0x42'))){_0x2de9cf[_0xc75d('0x43')]=qs['limit'](_0x10a440['query'][_0xc75d('0x43')]);_0x2de9cf[_0xc75d('0x2c')]=qs[_0xc75d('0x2c')](_0x10a440['query'][_0xc75d('0x2c')]);}_0x2de9cf[_0xc75d('0x44')]=qs[_0xc75d('0x45')](_0x10a440[_0xc75d('0x3c')][_0xc75d('0x45')]);_0x2de9cf[_0xc75d('0x46')]=qs['filters'](_['pick'](_0x10a440[_0xc75d('0x3c')],_0x3817ac[_0xc75d('0x3d')]),_0x3bf55f);if(_0x10a440[_0xc75d('0x3c')][_0xc75d('0x47')]){_0x2de9cf[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x2de9cf[_0xc75d('0x46')],{'$or':_[_0xc75d('0x36')](_0x3bf55f,function(_0x2cf2b9){if(_0x2cf2b9[_0xc75d('0x49')]!==_0xc75d('0x4a')){var _0x2b9a39={};_0x2b9a39[_0x2cf2b9[_0xc75d('0x3b')]]={'$like':'%'+_0x10a440[_0xc75d('0x3c')][_0xc75d('0x47')]+'%'};return _0x2b9a39;}})});}_0x2de9cf=_[_0xc75d('0x48')]({},_0x2de9cf,_0x10a440[_0xc75d('0x4b')]);var _0x38e2d3={'where':_0x2de9cf[_0xc75d('0x46')]};return db['ChatGroup'][_0xc75d('0x2b')](_0x38e2d3)[_0xc75d('0x1e')](function(_0x40c979){_0x2b2686['count']=_0x40c979;if(_0x10a440['query'][_0xc75d('0x4c')]){_0x2de9cf['include']=[{'all':!![]}];}return db['ChatGroup'][_0xc75d('0x4d')](_0x2de9cf);})[_0xc75d('0x1e')](function(_0x22abba){_0x2b2686[_0xc75d('0x4e')]=_0x22abba;return _0x2b2686;})['then'](respondWithFilteredResult(_0x186f58,_0x2de9cf))[_0xc75d('0x27')](handleError(_0x186f58,null));};exports['show']=function(_0x1d2c6d,_0x17d063){var _0x47631f={'raw':!![],'where':{'id':_0x1d2c6d[_0xc75d('0x4f')]['id']}},_0x3fd1eb={};_0x3fd1eb[_0xc75d('0x3a')]=_['keys'](db['ChatGroup'][_0xc75d('0x38')]);_0x3fd1eb[_0xc75d('0x3c')]=_['keys'](_0x1d2c6d[_0xc75d('0x3c')]);_0x3fd1eb['filters']=_[_0xc75d('0x3e')](_0x3fd1eb[_0xc75d('0x3a')],_0x3fd1eb[_0xc75d('0x3c')]);_0x47631f[_0xc75d('0x40')]=_['intersection'](_0x3fd1eb[_0xc75d('0x3a')],qs['fields'](_0x1d2c6d[_0xc75d('0x3c')]['fields']));_0x47631f[_0xc75d('0x40')]=_0x47631f[_0xc75d('0x40')][_0xc75d('0x41')]?_0x47631f['attributes']:_0x3fd1eb[_0xc75d('0x3a')];if(_0x1d2c6d['query'][_0xc75d('0x4c')]){_0x47631f['include']=[{'all':!![]}];}_0x47631f=_[_0xc75d('0x48')]({},_0x47631f,_0x1d2c6d[_0xc75d('0x4b')]);return db[_0xc75d('0x37')][_0xc75d('0x50')](_0x47631f)['then'](handleEntityNotFound(_0x17d063,null))[_0xc75d('0x1e')](respondWithResult(_0x17d063,null))['catch'](handleError(_0x17d063,null));};exports[_0xc75d('0x51')]=function(_0x51c44f,_0x285f7a){return db[_0xc75d('0x37')][_0xc75d('0x51')](_0x51c44f[_0xc75d('0x52')],{})['then'](respondWithResult(_0x285f7a,0xc9))[_0xc75d('0x27')](handleError(_0x285f7a,null));};exports['update']=function(_0x4a4f4c,_0x56ff87){if(_0x4a4f4c[_0xc75d('0x52')]['id']){delete _0x4a4f4c[_0xc75d('0x52')]['id'];}return db['ChatGroup'][_0xc75d('0x50')]({'where':{'id':_0x4a4f4c[_0xc75d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x56ff87,null))[_0xc75d('0x1e')](saveUpdates(_0x4a4f4c[_0xc75d('0x52')],null))[_0xc75d('0x1e')](respondWithResult(_0x56ff87,null))['catch'](handleError(_0x56ff87,null));};exports['destroy']=function(_0x91413e,_0x283bdd){return db[_0xc75d('0x37')][_0xc75d('0x50')]({'where':{'id':_0x91413e[_0xc75d('0x4f')]['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x283bdd,null))[_0xc75d('0x1e')](removeEntity(_0x283bdd,null))['catch'](handleError(_0x283bdd,null));};exports['describe']=function(_0x1a6084,_0x27aef7){return db[_0xc75d('0x37')][_0xc75d('0x53')]()[_0xc75d('0x1e')](respondWithResult(_0x27aef7,null))[_0xc75d('0x27')](handleError(_0x27aef7,null));};exports['getUnread']=function(_0x304161,_0x390959,_0x45ac75){return db[_0xc75d('0x54')][_0xc75d('0x2b')]({'where':{'ChatGroupId':_0x304161[_0xc75d('0x4f')]['id'],'ToId':_0x304161['user']['id'],'read':![]}})[_0xc75d('0x1e')](function(_0x3667a8){return{'id':_[_0xc75d('0x55')](_0x304161[_0xc75d('0x4f')]['id']),'count':_0x3667a8};})['then'](respondWithResult(_0x390959,null))[_0xc75d('0x27')](handleError(_0x390959,null));};exports['addMembers']=function(_0x5b526a,_0x14d113,_0x42371b){return db[_0xc75d('0x37')]['find']({'where':{'id':_0x5b526a['params']['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x14d113,null))[_0xc75d('0x1e')](function(_0x4c5fe6){if(_0x4c5fe6){return _0x4c5fe6[_0xc75d('0x56')](_0x5b526a['body'][_0xc75d('0x57')],_[_0xc75d('0x58')](_0x5b526a['body'],[_0xc75d('0x57'),'id'])||{});}})[_0xc75d('0x1e')](respondWithResult(_0x14d113,null))[_0xc75d('0x27')](handleError(_0x14d113,null));};exports[_0xc75d('0x59')]=function(_0x15760e,_0x312710,_0x5ca1ec){var _0x59b394={};var _0x2250d1={};var _0x14a5f8;var _0x3acd3c;return db[_0xc75d('0x37')]['findOne']({'where':{'id':_0x15760e[_0xc75d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x312710,null))[_0xc75d('0x1e')](function(_0x4bd7a4){if(_0x4bd7a4){_0x14a5f8=_0x4bd7a4;_0x2250d1[_0xc75d('0x3a')]=_['keys'](db['User'][_0xc75d('0x38')]);_0x2250d1['query']=_[_0xc75d('0x5a')](_0x15760e['query']);_0x2250d1[_0xc75d('0x3d')]=_[_0xc75d('0x3e')](_0x2250d1[_0xc75d('0x3a')],_0x2250d1[_0xc75d('0x3c')]);_0x59b394['attributes']=_['intersection'](_0x2250d1[_0xc75d('0x3a')],qs['fields'](_0x15760e[_0xc75d('0x3c')]['fields']));_0x59b394[_0xc75d('0x40')]=_0x59b394[_0xc75d('0x40')][_0xc75d('0x41')]?_0x59b394['attributes']:_0x2250d1['model'];_0x59b394['order']=qs[_0xc75d('0x45')](_0x15760e[_0xc75d('0x3c')][_0xc75d('0x45')]);_0x59b394[_0xc75d('0x46')]=qs[_0xc75d('0x3d')](_[_0xc75d('0x5b')](_0x15760e['query'],_0x2250d1[_0xc75d('0x3d')]));if(_0x15760e[_0xc75d('0x3c')][_0xc75d('0x47')]){_0x59b394[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x59b394['where'],{'$or':_['map'](_0x59b394['attributes'],function(_0x4974ea){var _0xfeb784={};_0xfeb784[_0x4974ea]={'$like':'%'+_0x15760e[_0xc75d('0x3c')][_0xc75d('0x47')]+'%'};return _0xfeb784;})});}_0x59b394=_[_0xc75d('0x48')]({},_0x59b394,_0x15760e[_0xc75d('0x4b')]);return _0x14a5f8[_0xc75d('0x59')](_0x59b394);}})[_0xc75d('0x1e')](function(_0x36d664){if(_0x36d664){_0x3acd3c=_0x36d664['length'];if(!_0x15760e[_0xc75d('0x3c')][_0xc75d('0x5c')]('nolimit')){_0x59b394[_0xc75d('0x43')]=qs[_0xc75d('0x43')](_0x15760e['query'][_0xc75d('0x43')]);_0x59b394[_0xc75d('0x2c')]=qs['offset'](_0x15760e[_0xc75d('0x3c')][_0xc75d('0x2c')]);}return _0x14a5f8[_0xc75d('0x59')](_0x59b394);}})[_0xc75d('0x1e')](function(_0x2c3cda){if(_0x2c3cda){return _0x2c3cda?{'count':_0x3acd3c,'rows':_0x2c3cda}:null;}})['then'](respondWithResult(_0x312710,null))[_0xc75d('0x27')](handleError(_0x312710,null));};exports[_0xc75d('0x5d')]=function(_0x209661,_0x39afaa,_0x229c5e){return db[_0xc75d('0x37')][_0xc75d('0x50')]({'where':{'id':_0x209661[_0xc75d('0x4f')]['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x39afaa,null))[_0xc75d('0x1e')](function(_0x2ee660){if(_0x2ee660){return _0x2ee660[_0xc75d('0x5d')](_0x209661['query']['ids']);}})['then'](respondWithStatusCode(_0x39afaa,null))[_0xc75d('0x27')](handleError(_0x39afaa,null));};exports[_0xc75d('0x5e')]=function(_0x5ef27a,_0x4fe715,_0x41916e){if(_0x5ef27a[_0xc75d('0x52')]['id']){delete _0x5ef27a[_0xc75d('0x52')]['id'];}return db[_0xc75d('0x37')]['find']({'where':{'id':_0x5ef27a[_0xc75d('0x4f')]['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x4fe715,null))['then'](function(_0x42cbaf){if(_0x42cbaf){_0x5ef27a[_0xc75d('0x52')][_0xc75d('0x5f')]=_0x42cbaf['id'];return db[_0xc75d('0x54')][_0xc75d('0x51')](_0x5ef27a[_0xc75d('0x52')]);}})[_0xc75d('0x1e')](respondWithResult(_0x4fe715,null))['catch'](handleError(_0x4fe715,null));};exports['getMessages']=function(_0xfc33c0,_0x4b6068,_0x7535d8){var _0x30d877={};var _0x27e95a={};var _0x13c94d;var _0x28b112;return db[_0xc75d('0x37')][_0xc75d('0x60')]({'where':{'id':_0xfc33c0['params']['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x4b6068,null))[_0xc75d('0x1e')](function(_0xb559b1){if(_0xb559b1){_0x13c94d=_0xb559b1;_0x27e95a['model']=_['keys'](db[_0xc75d('0x54')]['rawAttributes']);_0x27e95a[_0xc75d('0x3c')]=_[_0xc75d('0x5a')](_0xfc33c0[_0xc75d('0x3c')]);_0x27e95a[_0xc75d('0x3d')]=_['intersection'](_0x27e95a['model'],_0x27e95a['query']);_0x30d877[_0xc75d('0x40')]=_[_0xc75d('0x3e')](_0x27e95a[_0xc75d('0x3a')],qs['fields'](_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x3f')]));_0x30d877[_0xc75d('0x40')]=_0x30d877['attributes'][_0xc75d('0x41')]?_0x30d877[_0xc75d('0x40')]:_0x27e95a['model'];_0x30d877[_0xc75d('0x44')]=qs[_0xc75d('0x45')](_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x45')]);_0x30d877[_0xc75d('0x46')]=qs[_0xc75d('0x3d')](_['pick'](_0xfc33c0[_0xc75d('0x3c')],_0x27e95a[_0xc75d('0x3d')]));if(_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x47')]){_0x30d877[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x30d877['where'],{'$or':_[_0xc75d('0x36')](_0x30d877['attributes'],function(_0x765f44){var _0x1c0c8c={};_0x1c0c8c[_0x765f44]={'$like':'%'+_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x47')]+'%'};return _0x1c0c8c;})});}if(_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x61')]){var _0x158ae0=_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x61')][_0xc75d('0x62')](',');var _0x1543ef={};_0x1543ef[_0x158ae0[0x0]]={'$gte':moment(_0x158ae0[0x1])[_0xc75d('0x63')](_0xc75d('0x64'))};_0x30d877[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x30d877[_0xc75d('0x46')],_0x1543ef);}_0x30d877=_[_0xc75d('0x48')]({},_0x30d877,_0xfc33c0[_0xc75d('0x4b')]);return _0x13c94d['getMessages'](_0x30d877);}})['then'](function(_0x21b915){if(_0x21b915){_0x28b112=_0x21b915['length'];if(!_0xfc33c0['query']['hasOwnProperty'](_0xc75d('0x42'))){_0x30d877['limit']=qs[_0xc75d('0x43')](_0xfc33c0['query'][_0xc75d('0x43')]);_0x30d877['offset']=qs['offset'](_0xfc33c0['query'][_0xc75d('0x2c')]);}return _0x13c94d[_0xc75d('0x65')](_0x30d877);}})[_0xc75d('0x1e')](function(_0x56a537){if(_0x56a537){return _0x56a537?{'count':_0x28b112,'rows':_0x56a537}:null;}})[_0xc75d('0x1e')](respondWithResult(_0x4b6068,null))['catch'](handleError(_0x4b6068,null));}; \ No newline at end of file +var _0xf0f4=['then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','set','apply','reject','save','update','stack','name','send','index','map','ChatGroup','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','count','include','findAll','params','includeAll','find','create','body','describe','getUnread','user','addMembers','ids','omit','findOne','User','length','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0xf0f4,0x182));var _0x4f0f=function(_0x198072,_0x1fa6d9){_0x198072=_0x198072-0x0;var _0xcd47cd=_0xf0f4[_0x198072];return _0xcd47cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f0f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f0f('0x1'));var rp=require(_0x4f0f('0x2'));var moment=require('moment');var BPromise=require(_0x4f0f('0x3'));var Mustache=require(_0x4f0f('0x4'));var util=require(_0x4f0f('0x5'));var path=require(_0x4f0f('0x6'));var sox=require(_0x4f0f('0x7'));var csv=require(_0x4f0f('0x8'));var ejs=require(_0x4f0f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f0f('0xa'));var crypto=require(_0x4f0f('0xb'));var jsforce=require(_0x4f0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4f0f('0x8'));var querystring=require(_0x4f0f('0xd'));var Papa=require(_0x4f0f('0xe'));var Redis=require(_0x4f0f('0xf'));var authService=require(_0x4f0f('0x10'));var qs=require(_0x4f0f('0x11'));var as=require(_0x4f0f('0x12'));var hardwareService=require(_0x4f0f('0x13'));var logger=require('../../config/logger')(_0x4f0f('0x14'));var utils=require(_0x4f0f('0x15'));var config=require(_0x4f0f('0x16'));var licenseUtil=require(_0x4f0f('0x17'));var db=require(_0x4f0f('0x18'))['db'];config[_0x4f0f('0x19')]=_[_0x4f0f('0x1a')](config[_0x4f0f('0x19')],{'host':_0x4f0f('0x1b'),'port':0x18eb});var socket=require(_0x4f0f('0x1c'))(new Redis(config[_0x4f0f('0x19')]));require('./chatGroup.socket')[_0x4f0f('0x1d')](socket);var jayson=require(_0x4f0f('0x1e'));var client=jayson[_0x4f0f('0x1f')][_0x4f0f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x51a713,_0xd9ad12,_0x46d7cf,_0x5783){return new BPromise(function(_0x1c0aa1,_0x4038fd){var _0x5f171b=_0x5783||client;return _0x5f171b[_0x4f0f('0x21')](_0x51a713,_0x46d7cf)[_0x4f0f('0x22')](function(_0x20423e){logger['info'](_0x4f0f('0x23'),_0xd9ad12,_0x4f0f('0x24'));logger[_0x4f0f('0x25')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xd9ad12,_0x4f0f('0x24'),JSON[_0x4f0f('0x26')](_0x20423e));if(_0x20423e[_0x4f0f('0x27')]){if(_0x20423e[_0x4f0f('0x27')][_0x4f0f('0x28')]===0x1f4){logger[_0x4f0f('0x27')]('ChatGroup,\x20%s,\x20%s',_0xd9ad12,_0x20423e[_0x4f0f('0x27')]['message']);return _0x4038fd(_0x20423e[_0x4f0f('0x27')][_0x4f0f('0x29')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0xd9ad12,_0x20423e[_0x4f0f('0x27')]['message']);return _0x1c0aa1(_0x20423e[_0x4f0f('0x27')][_0x4f0f('0x29')]);}else{logger[_0x4f0f('0x2a')](_0x4f0f('0x23'),_0xd9ad12,_0x4f0f('0x24'));_0x1c0aa1(_0x20423e[_0x4f0f('0x2b')]['message']);}})[_0x4f0f('0x2c')](function(_0xcdcd05){logger[_0x4f0f('0x27')](_0x4f0f('0x23'),_0xd9ad12,_0xcdcd05);_0x4038fd(_0xcdcd05);});});}function respondWithStatusCode(_0xe969c7,_0x3e6b72){_0x3e6b72=_0x3e6b72||0xcc;return function(_0x166ea6){if(_0x166ea6){return _0xe969c7[_0x4f0f('0x2d')](_0x3e6b72);}return _0xe969c7[_0x4f0f('0x2e')](_0x3e6b72)[_0x4f0f('0x2f')]();};}function respondWithResult(_0x37ae8f,_0x394303){_0x394303=_0x394303||0xc8;return function(_0x381329){if(_0x381329){return _0x37ae8f['status'](_0x394303)[_0x4f0f('0x30')](_0x381329);}};}function respondWithFilteredResult(_0x269563,_0x2ebabc){return function(_0x58ec43){if(_0x58ec43){var _0xa8a240=_0x58ec43['count'],_0x4e5f0d=_0x2ebabc['offset'],_0x449788=_0x2ebabc[_0x4f0f('0x31')]+_0x2ebabc['limit'],_0x1f4e1d;if(_0x449788>=_0xa8a240){_0x449788=_0xa8a240;_0x1f4e1d=0xc8;}else{_0x1f4e1d=0xce;}_0x269563[_0x4f0f('0x2e')](_0x1f4e1d);return _0x269563[_0x4f0f('0x32')]('Content-Range',_0x4e5f0d+'-'+_0x449788+'/'+_0xa8a240)[_0x4f0f('0x30')](_0x58ec43);}return null;};}function patchUpdates(_0xf7acac){return function(_0x8b2dad){try{jsonpatch[_0x4f0f('0x33')](_0x8b2dad,_0xf7acac,!![]);}catch(_0x4db575){return BPromise[_0x4f0f('0x34')](_0x4db575);}return _0x8b2dad[_0x4f0f('0x35')]();};}function saveUpdates(_0x3c4462,_0x1ce86e){return function(_0x5ea512){if(_0x5ea512){return _0x5ea512[_0x4f0f('0x36')](_0x3c4462)[_0x4f0f('0x22')](function(_0x1c85cb){return _0x1c85cb;});}return null;};}function removeEntity(_0x59a400,_0x3724fc){return function(_0x797230){if(_0x797230){return _0x797230['destroy']()[_0x4f0f('0x22')](function(){_0x59a400[_0x4f0f('0x2e')](0xcc)[_0x4f0f('0x2f')]();});}};}function handleEntityNotFound(_0x341c6c,_0x57e133){return function(_0x2231cb){if(!_0x2231cb){_0x341c6c[_0x4f0f('0x2d')](0x194);}return _0x2231cb;};}function handleError(_0x35611d,_0xa790fa){_0xa790fa=_0xa790fa||0x1f4;return function(_0x3e582a){logger[_0x4f0f('0x27')](_0x3e582a[_0x4f0f('0x37')]);if(_0x3e582a[_0x4f0f('0x38')]){delete _0x3e582a['name'];}_0x35611d[_0x4f0f('0x2e')](_0xa790fa)[_0x4f0f('0x39')](_0x3e582a);};}exports[_0x4f0f('0x3a')]=function(_0x3d2f46,_0x122d51){var _0x3e2cb6={},_0x1849ca={},_0x5db25a={'count':0x0,'rows':[]};var _0x59b7b2=_[_0x4f0f('0x3b')](db[_0x4f0f('0x3c')]['rawAttributes'],function(_0x171e41){return{'name':_0x171e41['fieldName'],'type':_0x171e41[_0x4f0f('0x3d')]['key']};});_0x1849ca[_0x4f0f('0x3e')]=_[_0x4f0f('0x3b')](_0x59b7b2,'name');_0x1849ca[_0x4f0f('0x3f')]=_[_0x4f0f('0x40')](_0x3d2f46[_0x4f0f('0x3f')]);_0x1849ca['filters']=_[_0x4f0f('0x41')](_0x1849ca[_0x4f0f('0x3e')],_0x1849ca[_0x4f0f('0x3f')]);_0x3e2cb6[_0x4f0f('0x42')]=_[_0x4f0f('0x41')](_0x1849ca[_0x4f0f('0x3e')],qs[_0x4f0f('0x43')](_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x43')]));_0x3e2cb6[_0x4f0f('0x42')]=_0x3e2cb6[_0x4f0f('0x42')]['length']?_0x3e2cb6[_0x4f0f('0x42')]:_0x1849ca[_0x4f0f('0x3e')];if(!_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x44')](_0x4f0f('0x45'))){_0x3e2cb6[_0x4f0f('0x46')]=qs[_0x4f0f('0x46')](_0x3d2f46['query'][_0x4f0f('0x46')]);_0x3e2cb6[_0x4f0f('0x31')]=qs[_0x4f0f('0x31')](_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x31')]);}_0x3e2cb6[_0x4f0f('0x47')]=qs['sort'](_0x3d2f46[_0x4f0f('0x3f')][_0x4f0f('0x48')]);_0x3e2cb6['where']=qs['filters'](_[_0x4f0f('0x49')](_0x3d2f46[_0x4f0f('0x3f')],_0x1849ca[_0x4f0f('0x4a')]),_0x59b7b2);if(_0x3d2f46['query'][_0x4f0f('0x4b')]){_0x3e2cb6['where']=_['merge'](_0x3e2cb6[_0x4f0f('0x4c')],{'$or':_[_0x4f0f('0x3b')](_0x59b7b2,function(_0x257d3e){if(_0x257d3e[_0x4f0f('0x3d')]!==_0x4f0f('0x4d')){var _0x159c29={};_0x159c29[_0x257d3e['name']]={'$like':'%'+_0x3d2f46['query'][_0x4f0f('0x4b')]+'%'};return _0x159c29;}})});}_0x3e2cb6=_[_0x4f0f('0x4e')]({},_0x3e2cb6,_0x3d2f46[_0x4f0f('0x4f')]);var _0x541dd0={'where':_0x3e2cb6[_0x4f0f('0x4c')]};return db[_0x4f0f('0x3c')][_0x4f0f('0x50')](_0x541dd0)['then'](function(_0x3a10f7){_0x5db25a['count']=_0x3a10f7;if(_0x3d2f46[_0x4f0f('0x3f')]['includeAll']){_0x3e2cb6[_0x4f0f('0x51')]=[{'all':!![]}];}return db[_0x4f0f('0x3c')][_0x4f0f('0x52')](_0x3e2cb6);})[_0x4f0f('0x22')](function(_0x56c354){_0x5db25a['rows']=_0x56c354;return _0x5db25a;})['then'](respondWithFilteredResult(_0x122d51,_0x3e2cb6))[_0x4f0f('0x2c')](handleError(_0x122d51,null));};exports['show']=function(_0x12e587,_0x32d298){var _0x18f968={'raw':!![],'where':{'id':_0x12e587[_0x4f0f('0x53')]['id']}},_0x204a1b={};_0x204a1b[_0x4f0f('0x3e')]=_[_0x4f0f('0x40')](db[_0x4f0f('0x3c')]['rawAttributes']);_0x204a1b[_0x4f0f('0x3f')]=_[_0x4f0f('0x40')](_0x12e587[_0x4f0f('0x3f')]);_0x204a1b[_0x4f0f('0x4a')]=_[_0x4f0f('0x41')](_0x204a1b[_0x4f0f('0x3e')],_0x204a1b[_0x4f0f('0x3f')]);_0x18f968[_0x4f0f('0x42')]=_[_0x4f0f('0x41')](_0x204a1b[_0x4f0f('0x3e')],qs['fields'](_0x12e587[_0x4f0f('0x3f')]['fields']));_0x18f968[_0x4f0f('0x42')]=_0x18f968[_0x4f0f('0x42')]['length']?_0x18f968[_0x4f0f('0x42')]:_0x204a1b[_0x4f0f('0x3e')];if(_0x12e587[_0x4f0f('0x3f')][_0x4f0f('0x54')]){_0x18f968[_0x4f0f('0x51')]=[{'all':!![]}];}_0x18f968=_[_0x4f0f('0x4e')]({},_0x18f968,_0x12e587[_0x4f0f('0x4f')]);return db[_0x4f0f('0x3c')][_0x4f0f('0x55')](_0x18f968)['then'](handleEntityNotFound(_0x32d298,null))[_0x4f0f('0x22')](respondWithResult(_0x32d298,null))[_0x4f0f('0x2c')](handleError(_0x32d298,null));};exports[_0x4f0f('0x56')]=function(_0x404000,_0xb12986){return db[_0x4f0f('0x3c')][_0x4f0f('0x56')](_0x404000['body'],{})['then'](respondWithResult(_0xb12986,0xc9))[_0x4f0f('0x2c')](handleError(_0xb12986,null));};exports[_0x4f0f('0x36')]=function(_0x374cd3,_0x2c99d9){if(_0x374cd3[_0x4f0f('0x57')]['id']){delete _0x374cd3[_0x4f0f('0x57')]['id'];}return db[_0x4f0f('0x3c')][_0x4f0f('0x55')]({'where':{'id':_0x374cd3[_0x4f0f('0x53')]['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x2c99d9,null))[_0x4f0f('0x22')](saveUpdates(_0x374cd3[_0x4f0f('0x57')],null))['then'](respondWithResult(_0x2c99d9,null))[_0x4f0f('0x2c')](handleError(_0x2c99d9,null));};exports['destroy']=function(_0x2dd87f,_0xb472c2){return db['ChatGroup']['find']({'where':{'id':_0x2dd87f['params']['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0xb472c2,null))[_0x4f0f('0x22')](removeEntity(_0xb472c2,null))[_0x4f0f('0x2c')](handleError(_0xb472c2,null));};exports['describe']=function(_0x5df4e0,_0x4b58ff){return db[_0x4f0f('0x3c')][_0x4f0f('0x58')]()[_0x4f0f('0x22')](respondWithResult(_0x4b58ff,null))[_0x4f0f('0x2c')](handleError(_0x4b58ff,null));};exports[_0x4f0f('0x59')]=function(_0x143e84,_0x25ec74,_0x4952b0){return db['ChatInternalMessage'][_0x4f0f('0x50')]({'where':{'ChatGroupId':_0x143e84[_0x4f0f('0x53')]['id'],'ToId':_0x143e84[_0x4f0f('0x5a')]['id'],'read':![]}})['then'](function(_0x41f8a9){return{'id':_['toInteger'](_0x143e84[_0x4f0f('0x53')]['id']),'count':_0x41f8a9};})['then'](respondWithResult(_0x25ec74,null))[_0x4f0f('0x2c')](handleError(_0x25ec74,null));};exports['addMembers']=function(_0x24d60a,_0x2ddac3,_0x4446e0){return db[_0x4f0f('0x3c')][_0x4f0f('0x55')]({'where':{'id':_0x24d60a[_0x4f0f('0x53')]['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x2ddac3,null))[_0x4f0f('0x22')](function(_0x5becd9){if(_0x5becd9){return _0x5becd9[_0x4f0f('0x5b')](_0x24d60a[_0x4f0f('0x57')][_0x4f0f('0x5c')],_[_0x4f0f('0x5d')](_0x24d60a['body'],[_0x4f0f('0x5c'),'id'])||{});}})[_0x4f0f('0x22')](respondWithResult(_0x2ddac3,null))['catch'](handleError(_0x2ddac3,null));};exports['getMembers']=function(_0x29532b,_0x32e9a7,_0x264550){var _0x1e5050={};var _0x1b67c9={};var _0x54367e;var _0x1ad24a;return db[_0x4f0f('0x3c')][_0x4f0f('0x5e')]({'where':{'id':_0x29532b['params']['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x32e9a7,null))[_0x4f0f('0x22')](function(_0x329283){if(_0x329283){_0x54367e=_0x329283;_0x1b67c9['model']=_[_0x4f0f('0x40')](db[_0x4f0f('0x5f')]['rawAttributes']);_0x1b67c9[_0x4f0f('0x3f')]=_[_0x4f0f('0x40')](_0x29532b[_0x4f0f('0x3f')]);_0x1b67c9[_0x4f0f('0x4a')]=_[_0x4f0f('0x41')](_0x1b67c9[_0x4f0f('0x3e')],_0x1b67c9['query']);_0x1e5050['attributes']=_['intersection'](_0x1b67c9['model'],qs['fields'](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x43')]));_0x1e5050[_0x4f0f('0x42')]=_0x1e5050[_0x4f0f('0x42')][_0x4f0f('0x60')]?_0x1e5050[_0x4f0f('0x42')]:_0x1b67c9[_0x4f0f('0x3e')];_0x1e5050[_0x4f0f('0x47')]=qs[_0x4f0f('0x48')](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x48')]);_0x1e5050[_0x4f0f('0x4c')]=qs[_0x4f0f('0x4a')](_[_0x4f0f('0x49')](_0x29532b[_0x4f0f('0x3f')],_0x1b67c9['filters']));if(_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x4b')]){_0x1e5050[_0x4f0f('0x4c')]=_[_0x4f0f('0x4e')](_0x1e5050[_0x4f0f('0x4c')],{'$or':_[_0x4f0f('0x3b')](_0x1e5050['attributes'],function(_0x21ff97){var _0x52211c={};_0x52211c[_0x21ff97]={'$like':'%'+_0x29532b[_0x4f0f('0x3f')]['filter']+'%'};return _0x52211c;})});}_0x1e5050=_[_0x4f0f('0x4e')]({},_0x1e5050,_0x29532b[_0x4f0f('0x4f')]);return _0x54367e[_0x4f0f('0x61')](_0x1e5050);}})['then'](function(_0xe37fb){if(_0xe37fb){_0x1ad24a=_0xe37fb[_0x4f0f('0x60')];if(!_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x44')](_0x4f0f('0x45'))){_0x1e5050['limit']=qs[_0x4f0f('0x46')](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x46')]);_0x1e5050[_0x4f0f('0x31')]=qs[_0x4f0f('0x31')](_0x29532b[_0x4f0f('0x3f')][_0x4f0f('0x31')]);}return _0x54367e[_0x4f0f('0x61')](_0x1e5050);}})['then'](function(_0xca74cc){if(_0xca74cc){return _0xca74cc?{'count':_0x1ad24a,'rows':_0xca74cc}:null;}})[_0x4f0f('0x22')](respondWithResult(_0x32e9a7,null))['catch'](handleError(_0x32e9a7,null));};exports[_0x4f0f('0x62')]=function(_0x33bc1e,_0x198096,_0x4da9d6){return db[_0x4f0f('0x3c')]['find']({'where':{'id':_0x33bc1e[_0x4f0f('0x53')]['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x198096,null))['then'](function(_0x1ca539){if(_0x1ca539){return _0x1ca539[_0x4f0f('0x62')](_0x33bc1e[_0x4f0f('0x3f')]['ids']);}})[_0x4f0f('0x22')](respondWithStatusCode(_0x198096,null))[_0x4f0f('0x2c')](handleError(_0x198096,null));};exports[_0x4f0f('0x63')]=function(_0x4a3efb,_0x1928df,_0x46bfb5){if(_0x4a3efb['body']['id']){delete _0x4a3efb['body']['id'];}return db[_0x4f0f('0x3c')][_0x4f0f('0x55')]({'where':{'id':_0x4a3efb['params']['id']}})[_0x4f0f('0x22')](handleEntityNotFound(_0x1928df,null))[_0x4f0f('0x22')](function(_0x229592){if(_0x229592){_0x4a3efb[_0x4f0f('0x57')][_0x4f0f('0x64')]=_0x229592['id'];return db['ChatInternalMessage']['create'](_0x4a3efb[_0x4f0f('0x57')]);}})['then'](respondWithResult(_0x1928df,null))[_0x4f0f('0x2c')](handleError(_0x1928df,null));};exports[_0x4f0f('0x65')]=function(_0x4331bb,_0x5d2077,_0x5aeb66){var _0x3bdd58={};var _0x3ddf77={};var _0x586029;var _0x126c15;return db[_0x4f0f('0x3c')][_0x4f0f('0x5e')]({'where':{'id':_0x4331bb[_0x4f0f('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d2077,null))['then'](function(_0x3c209a){if(_0x3c209a){_0x586029=_0x3c209a;_0x3ddf77[_0x4f0f('0x3e')]=_[_0x4f0f('0x40')](db['ChatInternalMessage'][_0x4f0f('0x66')]);_0x3ddf77['query']=_['keys'](_0x4331bb[_0x4f0f('0x3f')]);_0x3ddf77[_0x4f0f('0x4a')]=_[_0x4f0f('0x41')](_0x3ddf77[_0x4f0f('0x3e')],_0x3ddf77['query']);_0x3bdd58[_0x4f0f('0x42')]=_[_0x4f0f('0x41')](_0x3ddf77['model'],qs['fields'](_0x4331bb['query'][_0x4f0f('0x43')]));_0x3bdd58[_0x4f0f('0x42')]=_0x3bdd58['attributes'][_0x4f0f('0x60')]?_0x3bdd58[_0x4f0f('0x42')]:_0x3ddf77['model'];_0x3bdd58[_0x4f0f('0x47')]=qs[_0x4f0f('0x48')](_0x4331bb[_0x4f0f('0x3f')]['sort']);_0x3bdd58[_0x4f0f('0x4c')]=qs[_0x4f0f('0x4a')](_[_0x4f0f('0x49')](_0x4331bb[_0x4f0f('0x3f')],_0x3ddf77[_0x4f0f('0x4a')]));if(_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x4b')]){_0x3bdd58['where']=_[_0x4f0f('0x4e')](_0x3bdd58['where'],{'$or':_['map'](_0x3bdd58['attributes'],function(_0x5d8361){var _0x16b51c={};_0x16b51c[_0x5d8361]={'$like':'%'+_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x4b')]+'%'};return _0x16b51c;})});}if(_0x4331bb[_0x4f0f('0x3f')]['$gte']){var _0xdc77cf=_0x4331bb[_0x4f0f('0x3f')]['$gte']['split'](',');var _0x251cf0={};_0x251cf0[_0xdc77cf[0x0]]={'$gte':moment(_0xdc77cf[0x1])[_0x4f0f('0x67')](_0x4f0f('0x68'))};_0x3bdd58[_0x4f0f('0x4c')]=_[_0x4f0f('0x4e')](_0x3bdd58['where'],_0x251cf0);}_0x3bdd58=_[_0x4f0f('0x4e')]({},_0x3bdd58,_0x4331bb['options']);return _0x586029[_0x4f0f('0x65')](_0x3bdd58);}})[_0x4f0f('0x22')](function(_0x109e1b){if(_0x109e1b){_0x126c15=_0x109e1b['length'];if(!_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x44')](_0x4f0f('0x45'))){_0x3bdd58[_0x4f0f('0x46')]=qs[_0x4f0f('0x46')](_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x46')]);_0x3bdd58[_0x4f0f('0x31')]=qs[_0x4f0f('0x31')](_0x4331bb[_0x4f0f('0x3f')][_0x4f0f('0x31')]);}return _0x586029[_0x4f0f('0x65')](_0x3bdd58);}})['then'](function(_0x4501d8){if(_0x4501d8){return _0x4501d8?{'count':_0x126c15,'rows':_0x4501d8}:null;}})[_0x4f0f('0x22')](respondWithResult(_0x5d2077,null))['catch'](handleError(_0x5d2077,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 098c806..58eda97 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 _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x429c04,_0x50f461){var _0x430ff3=function(_0x461a0b){while(--_0x461a0b){_0x429c04['push'](_0x429c04['shift']());}};_0x430ff3(++_0x50f461);}(_0xdb28,0x106));var _0x8db2=function(_0x3a75ec,_0x331c6b){_0x3a75ec=_0x3a75ec-0x0;var _0x569250=_0xdb28[_0x3a75ec];return _0x569250;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x2032,0xd9));var _0x2203=function(_0x7dfa90,_0x6aa15c){_0x7dfa90=_0x7dfa90-0x0;var _0x2adb01=_0x2032[_0x7dfa90];return _0x2adb01;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 058f6ab..38fb20c 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 _0x90b5=['exports','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x5e0907,_0x12856d){var _0x364fd4=function(_0x193986){while(--_0x193986){_0x5e0907['push'](_0x5e0907['shift']());}};_0x364fd4(++_0x12856d);}(_0x90b5,0x139));var _0x590b=function(_0x51aee0,_0x253ba6){_0x51aee0=_0x51aee0-0x0;var _0x483ac7=_0x90b5[_0x51aee0];return _0x483ac7;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var logger=require(_0x590b('0x1'))(_0x590b('0x2'));var moment=require(_0x590b('0x3'));var BPromise=require(_0x590b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var attributes=require('./chatGroup.attributes');module[_0x590b('0x7')]=function(_0x2059e4,_0x88a5f9){return _0x2059e4['define'](_0x590b('0x8'),attributes,{'tableName':_0x590b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment'];(function(_0x2313e8,_0x332e97){var _0x482a35=function(_0xe736a0){while(--_0xe736a0){_0x2313e8['push'](_0x2313e8['shift']());}};_0x482a35(++_0x332e97);}(_0x8ce1,0x183));var _0x18ce=function(_0x98ea42,_0x2ad02e){_0x98ea42=_0x98ea42-0x0;var _0x37260e=_0x8ce1[_0x98ea42];return _0x37260e;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require(_0x18ce('0x7'));var rimraf=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var attributes=require(_0x18ce('0xa'));module[_0x18ce('0xb')]=function(_0x13ff9d,_0x36f8db){return _0x13ff9d[_0x18ce('0xc')](_0x18ce('0xd'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 2d2fd8c..e98170b 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 _0xec92=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x136567,_0x4c38cb){var _0x886cef=function(_0x2a2e17){while(--_0x2a2e17){_0x136567['push'](_0x136567['shift']());}};_0x886cef(++_0x4c38cb);}(_0xec92,0x107));var _0x2ec9=function(_0x557418,_0x51418f){_0x557418=_0x557418-0x0;var _0x3ffd0e=_0xec92[_0x557418];return _0x3ffd0e;};'use strict';var _=require(_0x2ec9('0x0'));var util=require(_0x2ec9('0x1'));var moment=require(_0x2ec9('0x2'));var BPromise=require(_0x2ec9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ec9('0x4'));var db=require(_0x2ec9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ec9('0x6'))(_0x2ec9('0x7'));var config=require(_0x2ec9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ec9('0x9')][_0x2ec9('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2ec9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ec9('0xc'))(new Redis(config['redis']));require(_0x2ec9('0xd'))[_0x2ec9('0xe')](socket);function respondWithRpcPromise(_0x43f768,_0x54aa88,_0x154d2b){return new BPromise(function(_0x19eb80,_0x2d98b7){return client[_0x2ec9('0xf')](_0x43f768,_0x154d2b)[_0x2ec9('0x10')](function(_0x5c0a31){logger['info']('ChatGroup,\x20%s,\x20%s',_0x54aa88,_0x2ec9('0x11'));logger[_0x2ec9('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x54aa88,_0x2ec9('0x11'),JSON[_0x2ec9('0x13')](_0x5c0a31));if(_0x5c0a31[_0x2ec9('0x14')]){if(_0x5c0a31[_0x2ec9('0x14')][_0x2ec9('0x15')]===0x1f4){logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x5c0a31[_0x2ec9('0x14')]['message']);return _0x2d98b7(_0x5c0a31['error'][_0x2ec9('0x17')]);}logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x5c0a31[_0x2ec9('0x14')][_0x2ec9('0x17')]);return _0x19eb80(_0x5c0a31['error']['message']);}else{logger[_0x2ec9('0x18')](_0x2ec9('0x16'),_0x54aa88,_0x2ec9('0x11'));_0x19eb80(_0x5c0a31[_0x2ec9('0x19')][_0x2ec9('0x17')]);}})[_0x2ec9('0x1a')](function(_0x3ca685){logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x3ca685);_0x2d98b7(_0x3ca685);});});} \ No newline at end of file +var _0x9ce9=['client','http','redis','localhost','./chatGroup.socket','register','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x9ce9,0xdd));var _0x99ce=function(_0x4cb213,_0x2b29d3){_0x4cb213=_0x4cb213-0x0;var _0x2a9c7b=_0x9ce9[_0x4cb213];return _0x2a9c7b;};'use strict';var _=require('lodash');var util=require(_0x99ce('0x0'));var moment=require(_0x99ce('0x1'));var BPromise=require(_0x99ce('0x2'));var rs=require(_0x99ce('0x3'));var fs=require('fs');var Redis=require(_0x99ce('0x4'));var db=require(_0x99ce('0x5'))['db'];var utils=require(_0x99ce('0x6'));var logger=require(_0x99ce('0x7'))(_0x99ce('0x8'));var config=require(_0x99ce('0x9'));var jayson=require(_0x99ce('0xa'));var client=jayson[_0x99ce('0xb')][_0x99ce('0xc')]({'port':0x232a});config[_0x99ce('0xd')]=_['defaults'](config[_0x99ce('0xd')],{'host':_0x99ce('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99ce('0xd')]));require(_0x99ce('0xf'))[_0x99ce('0x10')](socket);function respondWithRpcPromise(_0x5b9405,_0x30ca6c,_0x2b1c7d){return new BPromise(function(_0x19036c,_0x21c611){return client[_0x99ce('0x11')](_0x5b9405,_0x2b1c7d)[_0x99ce('0x12')](function(_0x56699d){logger['info']('ChatGroup,\x20%s,\x20%s',_0x30ca6c,_0x99ce('0x13'));logger[_0x99ce('0x14')](_0x99ce('0x15'),_0x30ca6c,_0x99ce('0x13'),JSON[_0x99ce('0x16')](_0x56699d));if(_0x56699d[_0x99ce('0x17')]){if(_0x56699d[_0x99ce('0x17')][_0x99ce('0x18')]===0x1f4){logger[_0x99ce('0x17')](_0x99ce('0x19'),_0x30ca6c,_0x56699d['error'][_0x99ce('0x1a')]);return _0x21c611(_0x56699d[_0x99ce('0x17')][_0x99ce('0x1a')]);}logger[_0x99ce('0x17')]('ChatGroup,\x20%s,\x20%s',_0x30ca6c,_0x56699d[_0x99ce('0x17')][_0x99ce('0x1a')]);return _0x19036c(_0x56699d[_0x99ce('0x17')]['message']);}else{logger[_0x99ce('0x1b')](_0x99ce('0x19'),_0x30ca6c,_0x99ce('0x13'));_0x19036c(_0x56699d[_0x99ce('0x1c')][_0x99ce('0x1a')]);}})['catch'](function(_0x57c156){logger[_0x99ce('0x17')](_0x99ce('0x19'),_0x30ca6c,_0x57c156);_0x21c611(_0x57c156);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5427fed..d85d858 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 _0x4cdc=['removeListener','register','length','chatGroup:','save','remove','update','emit'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x4cdc,0x6c));var _0xc4cd=function(_0x4d6dda,_0x23701d){_0x4d6dda=_0x4d6dda-0x0;var _0x546a80=_0x4cdc[_0x4d6dda];return _0x546a80;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc4cd('0x0'),_0xc4cd('0x1'),_0xc4cd('0x2')];function createListener(_0xdc7372,_0x917c64){return function(_0x5879ee){_0x917c64[_0xc4cd('0x3')](_0xdc7372,_0x5879ee);};}function removeListener(_0x438518,_0x2fe1fa){return function(){ChatGroupEvents[_0xc4cd('0x4')](_0x438518,_0x2fe1fa);};}exports[_0xc4cd('0x5')]=function(_0x298cc5){for(var _0x4c37b5=0x0,_0x1b03c9=events[_0xc4cd('0x6')];_0x4c37b5<_0x1b03c9;_0x4c37b5++){var _0x2fdc66=events[_0x4c37b5];var _0x209afb=createListener(_0xc4cd('0x7')+_0x2fdc66,_0x298cc5);ChatGroupEvents['on'](_0x2fdc66,_0x209afb);}}; \ No newline at end of file +var _0xb460=['update','emit','removeListener','register','chatGroup:','./chatGroup.events','save'];(function(_0x17fedc,_0xb5d047){var _0x1c3e1a=function(_0x41e5c2){while(--_0x41e5c2){_0x17fedc['push'](_0x17fedc['shift']());}};_0x1c3e1a(++_0xb5d047);}(_0xb460,0xe5));var _0x0b46=function(_0x22d9fc,_0x42e62d){_0x22d9fc=_0x22d9fc-0x0;var _0x38fae0=_0xb460[_0x22d9fc];return _0x38fae0;};'use strict';var ChatGroupEvents=require(_0x0b46('0x0'));var events=[_0x0b46('0x1'),'remove',_0x0b46('0x2')];function createListener(_0x5264b7,_0x553e3d){return function(_0x57980b){_0x553e3d[_0x0b46('0x3')](_0x5264b7,_0x57980b);};}function removeListener(_0x1d2646,_0x5d4162){return function(){ChatGroupEvents[_0x0b46('0x4')](_0x1d2646,_0x5d4162);};}exports[_0x0b46('0x5')]=function(_0x217c92){for(var _0x232249=0x0,_0x30f9d9=events['length'];_0x232249<_0x30f9d9;_0x232249++){var _0x3af5d7=events[_0x232249];var _0x51ffc4=createListener(_0x0b46('0x6')+_0x3af5d7,_0x217c92);ChatGroupEvents['on'](_0x3af5d7,_0x51ffc4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3fcff4c..6a8fb0e 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 _0x5d06=['connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','put','/:id','update','delete','destroy','removeMembers','exports','multer','util','path'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5d06,0x183));var _0x65d0=function(_0x5e7ff2,_0x581a89){_0x5e7ff2=_0x5e7ff2-0x0;var _0x245df0=_0x5d06[_0x5e7ff2];return _0x245df0;};'use strict';var multer=require(_0x65d0('0x0'));var util=require(_0x65d0('0x1'));var path=require(_0x65d0('0x2'));var timeout=require(_0x65d0('0x3'));var express=require('express');var router=express[_0x65d0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x65d0('0x5'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x65d0('0x6')]('/',auth[_0x65d0('0x7')](),controller['index']);router[_0x65d0('0x6')](_0x65d0('0x8'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x9')]);router[_0x65d0('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x65d0('0x6')](_0x65d0('0xa'),auth[_0x65d0('0x7')](),controller[_0x65d0('0xb')]);router['get'](_0x65d0('0xc'),auth['isAuthenticated'](),controller[_0x65d0('0xd')]);router[_0x65d0('0x6')](_0x65d0('0xe'),auth[_0x65d0('0x7')](),controller[_0x65d0('0xf')]);router['post']('/',auth[_0x65d0('0x7')](),controller[_0x65d0('0x10')]);router[_0x65d0('0x11')](_0x65d0('0xc'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x12')]);router[_0x65d0('0x11')](_0x65d0('0xe'),auth[_0x65d0('0x7')](),controller['addMessage']);router[_0x65d0('0x13')](_0x65d0('0x14'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x15')]);router[_0x65d0('0x16')](_0x65d0('0x14'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x17')]);router[_0x65d0('0x16')](_0x65d0('0xc'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x18')]);module[_0x65d0('0x19')]=router; \ No newline at end of file +var _0xd5a0=['describe','/:id','show','getMembers','getMessages','create','post','/:id/members','addMembers','/:id/messages','addMessage','update','delete','destroy','removeMembers','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe'];(function(_0x2623a3,_0x3828af){var _0x38dcc8=function(_0x134e0f){while(--_0x134e0f){_0x2623a3['push'](_0x2623a3['shift']());}};_0x38dcc8(++_0x3828af);}(_0xd5a0,0xb1));var _0x0d5a=function(_0x5c97a7,_0x3896d6){_0x5c97a7=_0x5c97a7-0x0;var _0x26be80=_0xd5a0[_0x5c97a7];return _0x26be80;};'use strict';var multer=require(_0x0d5a('0x0'));var util=require(_0x0d5a('0x1'));var path=require('path');var timeout=require(_0x0d5a('0x2'));var express=require('express');var router=express[_0x0d5a('0x3')]();var auth=require(_0x0d5a('0x4'));var interaction=require(_0x0d5a('0x5'));var config=require(_0x0d5a('0x6'));var controller=require(_0x0d5a('0x7'));router['get']('/',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x9')]);router[_0x0d5a('0xa')](_0x0d5a('0xb'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0xc')]);router[_0x0d5a('0xa')](_0x0d5a('0xd'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0xe')]);router[_0x0d5a('0xa')]('/:id/unread',auth[_0x0d5a('0x8')](),controller['getUnread']);router['get']('/:id/members',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0xf')]);router[_0x0d5a('0xa')]('/:id/messages',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x10')]);router['post']('/',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x11')]);router[_0x0d5a('0x12')](_0x0d5a('0x13'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x14')]);router[_0x0d5a('0x12')](_0x0d5a('0x15'),auth['isAuthenticated'](),controller[_0x0d5a('0x16')]);router['put'](_0x0d5a('0xd'),auth['isAuthenticated'](),controller[_0x0d5a('0x17')]);router[_0x0d5a('0x18')](_0x0d5a('0xd'),auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x19')]);router[_0x0d5a('0x18')]('/:id/members',auth[_0x0d5a('0x8')](),controller[_0x0d5a('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 43258e3..177818b 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 _0x9527=['BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','out','exports'];(function(_0x3bd229,_0x18a659){var _0x342bc2=function(_0x40f321){while(--_0x40f321){_0x3bd229['push'](_0x3bd229['shift']());}};_0x342bc2(++_0x18a659);}(_0x9527,0x182));var _0x7952=function(_0x44d9ae,_0xa18cc){_0x44d9ae=_0x44d9ae-0x0;var _0x359c3a=_0x9527[_0x44d9ae];return _0x359c3a;};'use strict';var Sequelize=require('sequelize');module[_0x7952('0x0')]={'closed':{'type':Sequelize[_0x7952('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7952('0x2')]},'ratingType':{'type':Sequelize[_0x7952('0x3')](_0x7952('0x4'),'thumb'),'defaultValue':_0x7952('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x7952('0x5')]},'mailTranscript':{'type':Sequelize[_0x7952('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7952('0x7')]},'disposition':{'type':Sequelize[_0x7952('0x6')]},'secondDisposition':{'type':Sequelize[_0x7952('0x6')]},'thirdDisposition':{'type':Sequelize[_0x7952('0x6')]},'note':{'type':Sequelize[_0x7952('0x6')]},'browserName':{'type':Sequelize[_0x7952('0x6')]},'browserVersion':{'type':Sequelize[_0x7952('0x6')]},'osName':{'type':Sequelize[_0x7952('0x6')]},'osVersion':{'type':Sequelize[_0x7952('0x6')]},'deviceModel':{'type':Sequelize[_0x7952('0x6')]},'deviceVendor':{'type':Sequelize[_0x7952('0x6')]},'deviceType':{'type':Sequelize[_0x7952('0x6')]},'referer':{'type':Sequelize[_0x7952('0x5')]},'customerIp':{'type':Sequelize[_0x7952('0x6')]},'formData':{'type':Sequelize[_0x7952('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x7952('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7952('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7952('0x3')]('in',_0x7952('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7952('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7952('0x5')]}}; \ No newline at end of file +var _0x9fe2=['STRING','DATE','out','exports','BOOLEAN','INTEGER','star','thumb','TEXT'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x9fe2,0x6f));var _0x29fe=function(_0x2a21e4,_0x2349f4){_0x2a21e4=_0x2a21e4-0x0;var _0x497ff8=_0x9fe2[_0x2a21e4];return _0x497ff8;};'use strict';var Sequelize=require('sequelize');module[_0x29fe('0x0')]={'closed':{'type':Sequelize[_0x29fe('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x29fe('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x29fe('0x3'),_0x29fe('0x4')),'defaultValue':_0x29fe('0x3')},'ratingMessage':{'type':Sequelize[_0x29fe('0x5')]},'pathTranscript':{'type':Sequelize[_0x29fe('0x5')]},'mailTranscript':{'type':Sequelize[_0x29fe('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x29fe('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x29fe('0x6')]},'thirdDisposition':{'type':Sequelize[_0x29fe('0x6')]},'note':{'type':Sequelize[_0x29fe('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x29fe('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x29fe('0x6')]},'deviceModel':{'type':Sequelize[_0x29fe('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x29fe('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x29fe('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x29fe('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x29fe('0x6')]},'customerPort':{'type':Sequelize[_0x29fe('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x29fe('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c70482a..d661b35 100644 --- a/server/api/chatInteraction/chatInteraction.controller.js +++ b/server/api/chatInteraction/chatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb22=['`\x20>\x200','Contact','operator','$substring','length','getFullTextValue','ContactId','buildExpression','union','User','UserId','type','text','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','contactName','DESC','t.id\x20IN\x20?','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ChatInteractionId','all','show','params','rawAttributes','fields','includeAll','options','create','body','destroy','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','attachmentDownload','findOne','Unauthorized','attachId','download','root','basename','close','mailTranscript','join','server/files/chat/upload/','format','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','addMessage','ChatMessage','ids','omit','include','findAll','rows','getMyMessages','includeAgent','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','lastName','Attachment','Account','Owner','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','info','result','sendStatus','status','end','json','offset','apply','reject','save','update','stack','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','fieldName','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','field','name','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','find','value','`\x20=\x200','having'];(function(_0x2df0ec,_0x3175c4){var _0x36677=function(_0x220659){while(--_0x220659){_0x2df0ec['push'](_0x2df0ec['shift']());}};_0x36677(++_0x3175c4);}(_0xcb22,0xc8));var _0x2cb2=function(_0x42b54e,_0x5a194f){_0x42b54e=_0x42b54e-0x0;var _0x3f17cd=_0xcb22[_0x42b54e];return _0x3f17cd;};'use strict';var pdf=require(_0x2cb2('0x0'));var emlformat=require(_0x2cb2('0x1'));var rimraf=require(_0x2cb2('0x2'));var zipdir=require(_0x2cb2('0x3'));var jsonpatch=require(_0x2cb2('0x4'));var rp=require(_0x2cb2('0x5'));var moment=require(_0x2cb2('0x6'));var BPromise=require(_0x2cb2('0x7'));var Mustache=require(_0x2cb2('0x8'));var util=require(_0x2cb2('0x9'));var path=require(_0x2cb2('0xa'));var sox=require('sox');var csv=require(_0x2cb2('0xb'));var ejs=require(_0x2cb2('0xc'));var fs=require('fs');var _=require(_0x2cb2('0xd'));var squel=require(_0x2cb2('0xe'));var crypto=require(_0x2cb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2cb2('0x10'));var toCsv=require(_0x2cb2('0xb'));var querystring=require('querystring');var Papa=require(_0x2cb2('0x11'));var Redis=require(_0x2cb2('0x12'));var authService=require(_0x2cb2('0x13'));var qs=require(_0x2cb2('0x14'));var as=require(_0x2cb2('0x15'));var hardwareService=require(_0x2cb2('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2cb2('0x17'));var config=require(_0x2cb2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2cb2('0x19')]=_['defaults'](config[_0x2cb2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2cb2('0x1a'))(new Redis(config[_0x2cb2('0x19')]));require('./chatInteraction.socket')[_0x2cb2('0x1b')](socket);var jayson=require(_0x2cb2('0x1c'));var client=jayson[_0x2cb2('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0x2cb2('0x1d')][_0x2cb2('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x58d9b4,_0x181ef1,_0x4aa895,_0xac72c4){return new BPromise(function(_0x26045d,_0x2594d9){var _0x22bf31=_0xac72c4||client;return _0x22bf31[_0x2cb2('0x1f')](_0x58d9b4,_0x4aa895)[_0x2cb2('0x20')](function(_0x5d306d){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x181ef1,'request\x20sent');logger[_0x2cb2('0x21')](_0x2cb2('0x22'),_0x181ef1,_0x2cb2('0x23'),JSON[_0x2cb2('0x24')](_0x5d306d));if(_0x5d306d['error']){if(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x26')]===0x1f4){logger[_0x2cb2('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x181ef1,_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);return _0x2594d9(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);}logger[_0x2cb2('0x25')](_0x2cb2('0x28'),_0x181ef1,_0x5d306d['error'][_0x2cb2('0x27')]);return _0x26045d(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);}else{logger[_0x2cb2('0x29')](_0x2cb2('0x28'),_0x181ef1,_0x2cb2('0x23'));_0x26045d(_0x5d306d[_0x2cb2('0x2a')][_0x2cb2('0x27')]);}})['catch'](function(_0x1c217c){logger[_0x2cb2('0x25')](_0x2cb2('0x28'),_0x181ef1,_0x1c217c);_0x2594d9(_0x1c217c);});});}function respondWithStatusCode(_0x3d9488,_0x121f18){_0x121f18=_0x121f18||0xcc;return function(_0x1c5228){if(_0x1c5228){return _0x3d9488[_0x2cb2('0x2b')](_0x121f18);}return _0x3d9488[_0x2cb2('0x2c')](_0x121f18)[_0x2cb2('0x2d')]();};}function respondWithResult(_0x4e4eff,_0x46db09){_0x46db09=_0x46db09||0xc8;return function(_0x4f5192){if(_0x4f5192){return _0x4e4eff[_0x2cb2('0x2c')](_0x46db09)[_0x2cb2('0x2e')](_0x4f5192);}};}function respondWithFilteredResult(_0x10aee3,_0x1e0040){return function(_0x1dd178){if(_0x1dd178){var _0x200067=_0x1dd178['count'],_0xb33189=_0x1e0040['offset'],_0x54d708=_0x1e0040[_0x2cb2('0x2f')]+_0x1e0040['limit'],_0x2173b4;if(_0x54d708>=_0x200067){_0x54d708=_0x200067;_0x2173b4=0xc8;}else{_0x2173b4=0xce;}_0x10aee3[_0x2cb2('0x2c')](_0x2173b4);return _0x10aee3['set']('Content-Range',_0xb33189+'-'+_0x54d708+'/'+_0x200067)[_0x2cb2('0x2e')](_0x1dd178);}return null;};}function patchUpdates(_0x3ef319){return function(_0xc83d3a){try{jsonpatch[_0x2cb2('0x30')](_0xc83d3a,_0x3ef319,!![]);}catch(_0x267cb1){return BPromise[_0x2cb2('0x31')](_0x267cb1);}return _0xc83d3a[_0x2cb2('0x32')]();};}function saveUpdates(_0x203688,_0x2313c6){return function(_0x53615d){if(_0x53615d){return _0x53615d[_0x2cb2('0x33')](_0x203688)[_0x2cb2('0x20')](function(_0x58dd17){return _0x58dd17;});}return null;};}function removeEntity(_0xf586e9,_0x290cbf){return function(_0xa65904){if(_0xa65904){return _0xa65904['destroy']()['then'](function(){_0xf586e9[_0x2cb2('0x2c')](0xcc)[_0x2cb2('0x2d')]();});}};}function handleEntityNotFound(_0x3f269e,_0x5a9a84){return function(_0x4068f6){if(!_0x4068f6){_0x3f269e[_0x2cb2('0x2b')](0x194);}return _0x4068f6;};}function handleError(_0x4eedd6,_0x506529){_0x506529=_0x506529||0x1f4;return function(_0xb45d6){logger[_0x2cb2('0x25')](_0xb45d6[_0x2cb2('0x34')]);if(_0xb45d6['name']){delete _0xb45d6['name'];}_0x4eedd6[_0x2cb2('0x2c')](_0x506529)[_0x2cb2('0x35')](_0xb45d6);};}function getInteractionUsers(_0x3ddd5d,_0xd62338){return new BPromise(function(_0x2966f7,_0x4e1b83){try{if(_0xd62338[_0x3ddd5d['id']]){_0x3ddd5d[_0x2cb2('0x36')]=_[_0x2cb2('0x37')](_0xd62338[_0x3ddd5d['id']],function(_0x10083e){return{'id':_0x10083e['id'],'fullname':_0x10083e['fullname']};});}}catch(_0x4bb342){_0x4e1b83(_0x4bb342);}_0x2966f7(_0x3ddd5d);});}function getInteractionTags(_0x2c6012,_0x328494){return new BPromise(function(_0x1d06d0,_0x3b94cd){try{if(_0x2c6012[_0x2cb2('0x38')]){_0x2c6012[_0x2cb2('0x39')]=[];_0x2c6012['TagIds'][_0x2cb2('0x3a')](',')[_0x2cb2('0x3b')](function(_0x3ef70a){_0x2c6012[_0x2cb2('0x39')][_0x2cb2('0x3c')](_0x328494[_0x3ef70a]);});}delete _0x2c6012[_0x2cb2('0x38')];}catch(_0x1e2dcf){_0x3b94cd(_0x1e2dcf);}_0x1d06d0(_0x2c6012);});}function updateChatInteraction(_0x5c63df,_0x42bca6,_0x49cf5c){return new BPromise(function(_0x1f20ef,_0x54036e){return getInteractionUsers(_0x5c63df,_0x49cf5c)[_0x2cb2('0x20')](function(_0x48b59f){return getInteractionTags(_0x48b59f,_0x42bca6);})[_0x2cb2('0x20')](function(_0x129a5e){_0x1f20ef(_0x129a5e);})[_0x2cb2('0x3d')](function(_0x4f66cc){_0x54036e(_0x4f66cc);});});}exports[_0x2cb2('0x3e')]=function(_0x39a6ff,_0x113957){var _0x44e3aa={},_0x1366d8={},_0x1ed33e={'count':0x0,'rows':[]};var _0x29eafc=_[_0x2cb2('0x37')](db[_0x2cb2('0x3f')]['rawAttributes'],function(_0x44bd32){return{'name':_0x44bd32[_0x2cb2('0x40')],'type':_0x44bd32['type']['key']};});_0x1366d8[_0x2cb2('0x41')]=_[_0x2cb2('0x37')](_0x29eafc,'name');_0x1366d8[_0x2cb2('0x42')]=_[_0x2cb2('0x43')](_0x39a6ff['query']);_0x1366d8['filters']=_[_0x2cb2('0x44')](_0x1366d8[_0x2cb2('0x41')],_0x1366d8['query']);_0x44e3aa[_0x2cb2('0x45')]=_[_0x2cb2('0x44')](_0x1366d8['model'],qs['fields'](_0x39a6ff['query']['fields']));_0x44e3aa[_0x2cb2('0x45')]=_0x44e3aa[_0x2cb2('0x45')]['length']?_0x44e3aa[_0x2cb2('0x45')]:_0x1366d8[_0x2cb2('0x41')];if(!_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x46')](_0x2cb2('0x47'))){_0x44e3aa['limit']=qs[_0x2cb2('0x48')](_0x39a6ff['query']['limit']);_0x44e3aa['offset']=qs['offset'](_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x2f')]);}_0x44e3aa[_0x2cb2('0x49')]=qs[_0x2cb2('0x4a')](_0x39a6ff['query'][_0x2cb2('0x4a')]);_0x44e3aa[_0x2cb2('0x4b')]=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x39a6ff['query'],_0x1366d8[_0x2cb2('0x4c')]),_0x29eafc);var _0x37a2ae=[];var _0x5477dd=squel['select']()[_0x2cb2('0x4e')]('id')[_0x2cb2('0x4e')](_0x2cb2('0x4f'))[_0x2cb2('0x4e')]('color')['from'](_0x2cb2('0x50'));var _0xed56af=squel[_0x2cb2('0x51')]()[_0x2cb2('0x4e')](_0x2cb2('0x52'))[_0x2cb2('0x4e')](_0x2cb2('0x53'))[_0x2cb2('0x4e')](_0x2cb2('0x54'))[_0x2cb2('0x55')](_0x2cb2('0x56'),'ui')[_0x2cb2('0x57')](_0x2cb2('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x35f6bd=squel['select']()[_0x2cb2('0x55')](_0x2cb2('0x59'),'i')[_0x2cb2('0x57')]('cm_contacts','c',_0x2cb2('0x5a'))[_0x2cb2('0x57')](_0x2cb2('0x58'),'o',_0x2cb2('0x5b'))[_0x2cb2('0x57')](_0x2cb2('0x5c'),'a',_0x2cb2('0x5d'))['left_join'](_0x2cb2('0x5e'),'me',_0x2cb2('0x5f'))['left_join'](_0x2cb2('0x60'),'it',_0x2cb2('0x61'))['left_join'](_0x2cb2('0x50'),'t',_0x2cb2('0x62'));var _0xdfb7ef=squel[_0x2cb2('0x63')]();var _0x45f08d=[];var _0x25eed4=squel[_0x2cb2('0x63')]();var _0x28a689;if(_0x39a6ff[_0x2cb2('0x42')]['search']){_0x28a689=as[_0x2cb2('0x64')](_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x65')]);var _0xc47399=_0x28a689[_0x2cb2('0x66')];for(var _0x5d09d6=0x0;_0x5d09d6<_0x28a689['conditions']['length'];_0x5d09d6++){var _0x55608e=_0x28a689['conditions'][_0x5d09d6];var _0x45b496='i';var _0x48f3ad=_[_0x2cb2('0x67')](_0x29eafc,[_0x2cb2('0x4f'),_0x55608e[_0x2cb2('0x4e')]]);if(!_0x48f3ad){switch(_0x55608e[_0x2cb2('0x4e')]){case'unreadMessages':if(_0x55608e[_0x2cb2('0x68')]==0x1){_0x35f6bd['having']('`'+_0x55608e[_0x2cb2('0x4e')]+_0x2cb2('0x69'));}else{_0x35f6bd[_0x2cb2('0x6a')]('`'+_0x55608e[_0x2cb2('0x4e')]+_0x2cb2('0x6b'));}break;case _0x2cb2('0x6c'):if(_0x55608e[_0x2cb2('0x6d')]===_0x2cb2('0x6e')){if(_0x55608e['value'][_0x2cb2('0x3a')]('\x20')[_0x2cb2('0x6f')]>0x1){_0xdfb7ef[_0xc47399]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2cb2('0x70')](_0x55608e[_0x2cb2('0x68')]),null);}else{var _0x484122='%'+_0x55608e[_0x2cb2('0x68')]+'%';_0xdfb7ef[_0xc47399]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x484122,_0x484122,_0x484122);}}else{_0x48f3ad=_['find'](_0x29eafc,[_0x2cb2('0x4f'),_0x2cb2('0x71')]);_0x55608e[_0x2cb2('0x4e')]=_0x2cb2('0x71');_0x46e03b=as[_0x2cb2('0x72')](_0x45b496,_0x48f3ad['type'],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b['text'],_0x46e03b[_0x2cb2('0x68')]['start'],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);}break;case'Tag':var _0x3a8813=_0x55608e[_0x2cb2('0x68')][_0x2cb2('0x3a')](',')[_0x2cb2('0x37')](function(_0x12c2df){return Number(_0x12c2df);});_0x3a8813['forEach'](function(_0x3796be){_0x25eed4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3796be+',%');});_0x45f08d=_[_0x2cb2('0x73')](_0x45f08d,_0x3a8813);break;case _0x2cb2('0x74'):if(_0x55608e[_0x2cb2('0x6d')]===_0x2cb2('0x6e')){_0xdfb7ef[_0xc47399]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x55608e['value']+'%',null);}else{_0x48f3ad=_['find'](_0x29eafc,[_0x2cb2('0x4f'),_0x2cb2('0x75')]);_0x55608e['field']='UserId';_0x46e03b=as[_0x2cb2('0x72')](_0x45b496,_0x48f3ad[_0x2cb2('0x76')],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b['value'][_0x2cb2('0x2d')]);}break;case'body':_0x46e03b=as['buildExpression']('me',null,_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);break;}}else{var _0x46e03b=as['buildExpression'](_0x45b496,_0x48f3ad[_0x2cb2('0x76')],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);}}}else{var _0x378c8d=_(_0x39a6ff['query'])[_0x2cb2('0x43')]()[_0x2cb2('0x37')](function(_0x34bfb8){return _[_0x2cb2('0x79')](_0x29eafc,['name',_0x34bfb8])?_0x34bfb8:undefined;})[_0x2cb2('0x7a')]()[_0x2cb2('0x68')]();if(!_[_0x2cb2('0x7b')](_0x378c8d)){_0x378c8d[_0x2cb2('0x3b')](function(_0x29b1d6){if(_0x29b1d6===_0x2cb2('0x7c')){_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x7d'),[][_0x2cb2('0x7e')](_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]));}else if(_0x29b1d6===_0x2cb2('0x7f')){var _0x204809=JSON['parse'](_0x39a6ff['query'][_0x29b1d6])[_0x2cb2('0x80')];var _0x5d6bd1=JSON['parse'](_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6])[_0x2cb2('0x81')];_0x35f6bd['where'](_0x2cb2('0x82'),_0x204809,_0x5d6bd1);}else{if(_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]===_0x2cb2('0x83')){_0x35f6bd[_0x2cb2('0x4b')]('i.'+_0x29b1d6+_0x2cb2('0x84'));}else{_0x35f6bd[_0x2cb2('0x4b')]('i.'+_0x29b1d6+_0x2cb2('0x85'),_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]);}}});}if(_0x39a6ff[_0x2cb2('0x42')]['read']){if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x86')]==0x1){_0x35f6bd['having'](_0x2cb2('0x87'));}else{_0x35f6bd[_0x2cb2('0x6a')](_0x2cb2('0x88'));}}if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x89')]){_0x45f08d=_['isArray'](_0x39a6ff['query'][_0x2cb2('0x89')])?_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x89')]:new Array(_0x39a6ff[_0x2cb2('0x42')]['tag']);_0x45f08d['forEach'](function(_0x2eafc8){_0x25eed4['or'](_0x2cb2('0x8a'),'%,'+_0x2eafc8+',%');});}if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x8b')]){var _0x1bef13=_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x8b')][_0x2cb2('0x8c')]('\x5c','\x5c\x5c')[_0x2cb2('0x8c')](/'/g,'\x27\x27');if(qs[_0x2cb2('0x8d')](_0x1bef13)){_0xdfb7ef['or'](_0x2cb2('0x8e'),_0x1bef13+'%');}else{_0xdfb7ef['or'](_0x2cb2('0x8f'),qs[_0x2cb2('0x70')](_0x1bef13))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1bef13+'%');}}}_0x35f6bd['where'](_0xdfb7ef);_0x35f6bd[_0x2cb2('0x90')](_0x2cb2('0x91'));var _0x2805f2={'type':db[_0x2cb2('0x92')][_0x2cb2('0x93')]['SELECT'],'raw':!![]};var _0x415d1c=_0x35f6bd['clone']();_0x415d1c[_0x2cb2('0x4e')](_0x2cb2('0x91'));_0x415d1c[_0x2cb2('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x44e3aa[_0x2cb2('0x49')]){_0x44e3aa[_0x2cb2('0x49')][_0x2cb2('0x3b')](function(_0x3cbc12){var _0x331c33=_0x3cbc12[0x0]===_0x2cb2('0x94')?_0x3cbc12[0x0]:'i.'+_0x3cbc12[0x0];_0x35f6bd[_0x2cb2('0x49')](_0x331c33,_0x3cbc12[0x1]===_0x2cb2('0x95')?![]:!![]);});}if(!_[_0x2cb2('0x7b')](_0x45f08d)){_0x35f6bd[_0x2cb2('0x6a')](_0x25eed4);_0x415d1c[_0x2cb2('0x4b')](_0x2cb2('0x96'),_0x45f08d);}BPromise['resolve']()[_0x2cb2('0x20')](function(){if(!_0x28a689){if(_0x39a6ff['query'][_0x2cb2('0x7c')]||_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x97')])return;_0x415d1c[_0x2cb2('0x4b')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x35f6bd['where'](_0x2cb2('0x98'));return;}if(_0x39a6ff[_0x2cb2('0x99')][_0x2cb2('0x9a')]!==_0x2cb2('0x9b'))return;return _0x39a6ff['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x2cb2('0x20')](function(_0x140b21){if(_[_0x2cb2('0x7b')](_0x140b21)){_0x415d1c['where'](_0x2cb2('0x9c'));_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x9c'));}else{_0x415d1c[_0x2cb2('0x4b')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x140b21,'id'));_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x7d'),_[_0x2cb2('0x37')](_0x140b21,'id'));}});})[_0x2cb2('0x20')](function(){if(_0x39a6ff[_0x2cb2('0x99')][_0x2cb2('0x9a')]===_0x2cb2('0x9b')&&!_0x28a689&&!_0x39a6ff[_0x2cb2('0x42')]['ChatWebsiteId'])return[];return db[_0x2cb2('0x9d')][_0x2cb2('0x42')](_0x415d1c['toString'](),_0x2805f2);})[_0x2cb2('0x20')](function(_0x1e8e03){_0x1ed33e[_0x2cb2('0x9e')]=_0x1e8e03[_0x2cb2('0x6f')];if(_0x1ed33e[_0x2cb2('0x9e')]===0x0)return[];return db[_0x2cb2('0x9d')][_0x2cb2('0x42')](_0x5477dd['toString'](),_0x2805f2)[_0x2cb2('0x20')](function(_0x2cf218){_0x37a2ae=_[_0x2cb2('0x9f')](_0x2cf218,'id');_0x2805f2=_[_0x2cb2('0xa0')](_0x2805f2,{'model':db[_0x2cb2('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39a6ff['query']['fields']){_0x44e3aa['attributes'][_0x2cb2('0x3b')](function(_0x145f37){_0x35f6bd[_0x2cb2('0x4e')]('i.'+_0x145f37);});}else{_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa1'),_0x2cb2('0xa2'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa3'),_0x2cb2('0xa4'));_0x35f6bd['field'](_0x2cb2('0xa5'),_0x2cb2('0xa6'));_0x35f6bd['field'](_0x2cb2('0xa7'),'contactName');_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa8'));_0x35f6bd[_0x2cb2('0x4e')]('c.firstName',_0x2cb2('0xa9'));_0x35f6bd['field'](_0x2cb2('0xaa'),_0x2cb2('0xab'));_0x35f6bd['field'](_0x2cb2('0xac'),_0x2cb2('0xad'));_0x35f6bd['field']('c.phone',_0x2cb2('0xae'));_0x35f6bd[_0x2cb2('0x4e')]('c.mobile',_0x2cb2('0xaf'));_0x35f6bd[_0x2cb2('0x4e')]('c.fax',_0x2cb2('0xb0'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb1'),_0x2cb2('0xb2'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb3'),'Owner.internal');_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb4'),'TagIds');}if(_0x44e3aa['limit'])_0x35f6bd[_0x2cb2('0x48')](_0x44e3aa[_0x2cb2('0x48')]);if(_0x44e3aa[_0x2cb2('0x2f')])_0x35f6bd[_0x2cb2('0x2f')](_0x44e3aa[_0x2cb2('0x2f')]);return db[_0x2cb2('0x9d')]['query'](_0x35f6bd[_0x2cb2('0xb5')](),_0x2805f2);})[_0x2cb2('0x20')](function(_0x1594f4){_0xed56af[_0x2cb2('0x4b')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x1594f4,'id'));return db['sequelize'][_0x2cb2('0x42')](_0xed56af['toString'](),_0x2805f2)[_0x2cb2('0x20')](function(_0x1a636e){var _0x23f137=_['groupBy'](_0x1a636e,_0x2cb2('0xb6'));var _0x447f32=[];_0x1594f4[_0x2cb2('0x3b')](function(_0x1e7a10){_0x447f32[_0x2cb2('0x3c')](updateChatInteraction(_0x1e7a10,_0x37a2ae,_0x23f137));});return BPromise[_0x2cb2('0xb7')](_0x447f32);});});})['then'](function(_0x32b1c9){_0x1ed33e['rows']=_0x32b1c9;return _0x1ed33e;})[_0x2cb2('0x20')](respondWithFilteredResult(_0x113957,_0x44e3aa))['catch'](handleError(_0x113957,null));};exports[_0x2cb2('0xb8')]=function(_0x3b5d00,_0x496f88){var _0x4ef03b={'raw':![],'where':{'id':_0x3b5d00[_0x2cb2('0xb9')]['id']}},_0x1c7ec8={};_0x1c7ec8['model']=_[_0x2cb2('0x43')](db[_0x2cb2('0x3f')][_0x2cb2('0xba')]);_0x1c7ec8[_0x2cb2('0x42')]=_['keys'](_0x3b5d00['query']);_0x1c7ec8[_0x2cb2('0x4c')]=_[_0x2cb2('0x44')](_0x1c7ec8[_0x2cb2('0x41')],_0x1c7ec8[_0x2cb2('0x42')]);_0x4ef03b['attributes']=_[_0x2cb2('0x44')](_0x1c7ec8[_0x2cb2('0x41')],qs[_0x2cb2('0xbb')](_0x3b5d00[_0x2cb2('0x42')][_0x2cb2('0xbb')]));_0x4ef03b[_0x2cb2('0x45')]=_0x4ef03b[_0x2cb2('0x45')][_0x2cb2('0x6f')]?_0x4ef03b[_0x2cb2('0x45')]:_0x1c7ec8['model'];if(_0x3b5d00[_0x2cb2('0x42')][_0x2cb2('0xbc')]){_0x4ef03b['include']=[{'all':!![]}];}_0x4ef03b=_[_0x2cb2('0xa0')]({},_0x4ef03b,_0x3b5d00[_0x2cb2('0xbd')]);return db[_0x2cb2('0x3f')]['find'](_0x4ef03b)[_0x2cb2('0x20')](handleEntityNotFound(_0x496f88,null))[_0x2cb2('0x20')](respondWithResult(_0x496f88,null))[_0x2cb2('0x3d')](handleError(_0x496f88,null));};exports['create']=function(_0x418e6b,_0x27f49b){return db[_0x2cb2('0x3f')][_0x2cb2('0xbe')](_0x418e6b[_0x2cb2('0xbf')],{})[_0x2cb2('0x20')](respondWithResult(_0x27f49b,0xc9))[_0x2cb2('0x3d')](handleError(_0x27f49b,null));};exports[_0x2cb2('0x33')]=function(_0x5e4299,_0x1959cc){if(_0x5e4299[_0x2cb2('0xbf')]['id']){delete _0x5e4299[_0x2cb2('0xbf')]['id'];}return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x5e4299['params']['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x1959cc,null))[_0x2cb2('0x20')](saveUpdates(_0x5e4299['body'],null))[_0x2cb2('0x20')](respondWithResult(_0x1959cc,null))[_0x2cb2('0x3d')](handleError(_0x1959cc,null));};exports[_0x2cb2('0xc0')]=function(_0x532a29,_0x2b70ec){return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x532a29[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0x2b70ec,null))[_0x2cb2('0x20')](removeEntity(_0x2b70ec,null))['catch'](handleError(_0x2b70ec,null));};exports['describe']=function(_0x1e4a07,_0x22f38){return db[_0x2cb2('0x3f')][_0x2cb2('0xc1')]()[_0x2cb2('0x20')](respondWithResult(_0x22f38,null))[_0x2cb2('0x3d')](handleError(_0x22f38,null));};exports[_0x2cb2('0xc2')]=function(_0x5c4488,_0x370911){var _0x5510a7=_0x5c4488[_0x2cb2('0xb9')]['id'];var _0x4bc0df;var _0x5d2c02;var _0xc660a;return db[_0x2cb2('0x3f')]['findOne']({'where':{'id':_0x5510a7}})[_0x2cb2('0x20')](function(_0x175520){_0x4bc0df=_0x175520;return db[_0x2cb2('0xc3')]['findOne']({'where':{'id':_0x175520[_0x2cb2('0x7c')]},'attributes':['id',_0x2cb2('0xc4'),_0x2cb2('0xc5')],'raw':!![]});})[_0x2cb2('0x20')](function(_0x10c3d4){if(_0x10c3d4&&_0x10c3d4[_0x2cb2('0xc4')]&&_0x10c3d4[_0x2cb2('0xc5')]){_0x5d2c02=_0x10c3d4;var _0x544030={'rejectUnauthorized':![],'method':_0x2cb2('0xc6'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x10c3d4[_0x2cb2('0xc4')]},'body':{'name':_0x2cb2('0xc7')+_0x5510a7},'redirect':_0x2cb2('0xc8'),'json':!![]};return rp(_0x544030);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x2cb2('0x20')](function(_0x4df22d){_0xc660a=_0x4df22d;if(_0xc660a['id']){var _0x35c15a={'body':_0xc660a[_0x2cb2('0xc9')],'ChatWebsiteId':_0x5d2c02['id'],'ChatInteractionId':_0x4bc0df['id'],'direction':_0x2cb2('0xca'),'UserId':_0x5c4488[_0x2cb2('0x99')]['id']};return db['ChatMessage'][_0x2cb2('0xbe')](_0x35c15a,{});}else{throw new db[(_0x2cb2('0x92'))]['ValidationError'](_0x2cb2('0xcb'));}})[_0x2cb2('0x20')](function(){return _0x4bc0df[_0x2cb2('0xcc')]({'vidaooSessionId':_0xc660a['id']});})[_0x2cb2('0x20')](respondWithResult(_0x370911,null))[_0x2cb2('0x3d')](handleError(_0x370911,null));};exports[_0x2cb2('0xcd')]=function(_0x2b180b,_0xb1cb6e){if(_0x2b180b[_0x2cb2('0xbf')]['id']){delete _0x2b180b[_0x2cb2('0xbf')]['id'];}return db[_0x2cb2('0x3f')]['find']({'where':{'id':_0x2b180b[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0xb1cb6e,null))[_0x2cb2('0x20')](saveUpdates(_0x2b180b[_0x2cb2('0xbf')],null))[_0x2cb2('0x20')](respondWithResult(_0xb1cb6e,null))[_0x2cb2('0x3d')](handleError(_0xb1cb6e,null));};exports[_0x2cb2('0xce')]=function(_0x277820,_0x41aadc,_0x15e9ea){if(_0x277820['body']['id']){delete _0x277820['body']['id'];}return db['ChatInteraction'][_0x2cb2('0x67')]({'where':{'id':_0x277820['params']['id']}})['then'](function(_0x52a75d){if(!_0x52a75d){logger[_0x2cb2('0x25')](_0x2cb2('0xcf'),_0x2cb2('0xce'),0x194,_0x2cb2('0xd0'));_0x41aadc[_0x2cb2('0x2b')](0x194);}else{if(_0x52a75d[_0x2cb2('0x75')]){throw new db[(_0x2cb2('0x92'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x52a75d;})['then'](function(_0xf6a024){if(_0xf6a024){return _0xf6a024['update']({'closed':_0x277820['body'][_0x2cb2('0xd1')],'disposition':_0x277820[_0x2cb2('0xbf')][_0x2cb2('0xd2')]})[_0x2cb2('0x20')](function(_0x519742){return _0x519742;});}})[_0x2cb2('0x20')](function(_0x3a9411){return respondWithRpcPromise(_0x2cb2('0xd3'),'abandon',_0x277820[_0x2cb2('0xbf')],client9004);})[_0x2cb2('0x20')](respondWithResult(_0x41aadc,null))[_0x2cb2('0x3d')](handleError(_0x41aadc,null));};exports['attachmentUpload']=function(_0x3e2423,_0x26384e,_0x2246d5){_0x3e2423[_0x2cb2('0xbf')][_0x2cb2('0x4f')]=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd5')];_0x3e2423[_0x2cb2('0xbf')]['basename']=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd6')];_0x3e2423['body']['type']=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd7')];return db['Attachment']['create'](_0x3e2423[_0x2cb2('0xbf')])[_0x2cb2('0x20')](respondWithResult(_0x26384e,0xc9))['catch'](handleError(_0x26384e,null));};exports[_0x2cb2('0xd8')]=function(_0x56e20b,_0x1c0545,_0x6f2b75){return db['ChatInteraction'][_0x2cb2('0xd9')]({'where':{'id':_0x56e20b[_0x2cb2('0xb9')]['id']},'raw':!![]})[_0x2cb2('0x20')](handleEntityNotFound(_0x1c0545,null))['then'](function(_0x217d7f){if(_0x217d7f){if(_0x217d7f[_0x2cb2('0xd1')]){return _0x1c0545[_0x2cb2('0x2c')](0x193)['json']({'status':0x193,'message':_0x2cb2('0xda')});}return db['Attachment'][_0x2cb2('0xd9')]({'where':{'id':_0x56e20b['query'][_0x2cb2('0xdb')]},'raw':!![]})[_0x2cb2('0x20')](handleEntityNotFound(_0x1c0545,null));}})[_0x2cb2('0x20')](function(_0x33b798){if(_0x33b798){return _0x1c0545[_0x2cb2('0xdc')](path['join'](config[_0x2cb2('0xdd')],'server/files/attachments/',_0x33b798[_0x2cb2('0xde')]));}})[_0x2cb2('0x3d')](handleError(_0x1c0545,null));};exports[_0x2cb2('0xdf')]=function(_0x23c295,_0x12ee0c){var _0x2037e5=null;var _0x44b109=null;var _0x29079c=null;var _0x3f3653=null;if(_0x23c295[_0x2cb2('0xbf')]['id']){delete _0x23c295['body']['id'];}if(_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')]){_0x3f3653=path[_0x2cb2('0xe1')](config['root'],_0x2cb2('0xe2'),util[_0x2cb2('0xe3')]('transcript-%s.txt',Date[_0x2cb2('0xe4')]()));_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe5')]=_0x3f3653;}return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x23c295[_0x2cb2('0xb9')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x2cb2('0xe6'),'include':[{'model':db[_0x2cb2('0x74')],'as':_0x2cb2('0x74')}]}]})['then'](handleEntityNotFound(_0x12ee0c,null))[_0x2cb2('0x20')](saveUpdates(_0x23c295['body'],null))['then'](function(_0x108222){if(_0x108222){_0x2037e5=_0x108222;return db['ChatWebsite'][_0x2cb2('0x67')]({'where':{'id':_0x2037e5['ChatWebsiteId']}});}})['then'](function(_0x12eeb0){if(_0x12eeb0){_0x29079c=_0x12eeb0;return db[_0x2cb2('0xe7')][_0x2cb2('0x67')]({'where':{'id':_0x2037e5[_0x2cb2('0x71')]}});}})[_0x2cb2('0x20')](function(_0x4b288d){if(_0x4b288d){_0x44b109=_0x4b288d;if(_0x3f3653){var _0x545722=null;for(var _0x439be6=0x1;_0x439be6<_0x2037e5[_0x2cb2('0xe6')]['length'];++_0x439be6){_0x545722=_0x2037e5[_0x2cb2('0xe6')][_0x439be6];var _0x4f4c96=_0x545722[_0x2cb2('0x75')]?util[_0x2cb2('0xe3')](_0x2cb2('0xe8'),_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');var _0x4520c2=_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xeb')]||util[_0x2cb2('0xe3')](_0x2cb2('0xe8'),_0x2cb2('0xec'),_0x545722[_0x2cb2('0x71')]);switch(_0x29079c[_0x2cb2('0xed')]){case'website_alias':_0x4f4c96=_0x545722['UserId']?util[_0x2cb2('0xe3')]('%s%d',_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');break;case _0x2cb2('0xee'):_0x4f4c96=_0x545722[_0x2cb2('0x75')]?_0x545722[_0x2cb2('0x74')][_0x2cb2('0xef')]||_0x545722['User']['fullname']:_0x2cb2('0xea');break;case _0x2cb2('0xf0'):_0x4f4c96=_0x545722[_0x2cb2('0x75')]?_0x545722['User'][_0x2cb2('0xf1')]:_0x2cb2('0xea');break;default:_0x4f4c96=_0x545722[_0x2cb2('0x75')]?util[_0x2cb2('0xe3')]('%s%d',_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');}var _0x10c0a3=util[_0x2cb2('0xe3')](_0x2cb2('0xf2'),moment(_0x545722[_0x2cb2('0x7f')])[_0x2cb2('0xe3')](_0x2cb2('0xf3')),_0x545722[_0x2cb2('0xf4')]==='in'?_0x4520c2:_0x4f4c96,_0x545722['body']);if(!_0x545722[_0x2cb2('0xf5')]){fs[_0x2cb2('0xf6')](_0x3f3653,_0x10c0a3);}}return db[_0x2cb2('0xf7')][_0x2cb2('0xd9')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x2cb2('0x20')](function(_0x1c6cc5){if(_0x1c6cc5&&_0x1c6cc5[_0x2cb2('0xf8')]&&_0x23c295['body']){var _0x153831={'tls':{'rejectUnauthorized':![]}};if(_0x1c6cc5['Smtp']['service']){_0x153831[_0x2cb2('0xf9')]=_0x1c6cc5[_0x2cb2('0xf8')]['service'];}else{_0x153831['host']=_0x1c6cc5['Smtp'][_0x2cb2('0xfa')];_0x153831[_0x2cb2('0xfb')]=_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0xfb')];_0x153831[_0x2cb2('0xfc')]=_0x1c6cc5['Smtp'][_0x2cb2('0xfc')];}if(_0x1c6cc5['Smtp'][_0x2cb2('0xfd')]){_0x153831[_0x2cb2('0xfe')]={'user':_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0x99')],'pass':_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0xff')]};}return respondWithRpcPromise('SendMail',_0x2cb2('0x100'),{'account':_0x153831,'message':{'from':util[_0x2cb2('0xe3')](_0x2cb2('0x101'),_0x1c6cc5[_0x2cb2('0x4f')],_0x1c6cc5['email']||_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0x99')]),'to':_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')],'subject':'Mail\x20Transcript','text':util[_0x2cb2('0xe3')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')]),'attachments':[{'path':_0x3f3653}]}})[_0x2cb2('0x20')](function(){return _0x2037e5;})[_0x2cb2('0x3d')](function(_0x1ea926){console[_0x2cb2('0x25')](_0x1ea926);});}else{return _0x2037e5;}})[_0x2cb2('0x20')](respondWithStatusCode(_0x12ee0c,0xc8))[_0x2cb2('0x3d')](handleError(_0x12ee0c,null));};exports[_0x2cb2('0x102')]=function(_0x5c736e,_0x3ace77,_0x2b73c0){return db[_0x2cb2('0x103')][_0x2cb2('0x67')]({'where':{'id':_0x5c736e[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x3ace77,null))[_0x2cb2('0x20')](function(_0x393186){if(_0x393186){return _0x393186['addMessage'](_0x5c736e[_0x2cb2('0xbf')][_0x2cb2('0x104')],_[_0x2cb2('0x105')](_0x5c736e[_0x2cb2('0xbf')],[_0x2cb2('0x104'),'id'])||{});}})[_0x2cb2('0x20')](respondWithResult(_0x3ace77,null))[_0x2cb2('0x3d')](handleError(_0x3ace77,null));};exports['getMessages']=function(_0x50570b,_0x481a34,_0x566a91){var _0x325fb4={'raw':![],'where':{}};var _0x347867={};var _0xdf04be={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x50570b[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x481a34,null))['then'](function(_0x111bd0){if(_0x111bd0){_0x347867[_0x2cb2('0x41')]=_[_0x2cb2('0x43')](db[_0x2cb2('0x103')][_0x2cb2('0xba')]);_0x347867['query']=_['keys'](_0x50570b[_0x2cb2('0x42')]);_0x347867[_0x2cb2('0x4c')]=_['intersection'](_0x347867[_0x2cb2('0x41')],_0x347867[_0x2cb2('0x42')]);_0x325fb4[_0x2cb2('0x45')]=_['intersection'](_0x347867[_0x2cb2('0x41')],qs[_0x2cb2('0xbb')](_0x50570b['query'][_0x2cb2('0xbb')]));_0x325fb4[_0x2cb2('0x45')]=_0x325fb4['attributes']['length']?_0x325fb4['attributes']:_0x347867[_0x2cb2('0x41')];if(!_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x46')](_0x2cb2('0x47'))){_0x325fb4['limit']=qs['limit'](_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x48')]);_0x325fb4[_0x2cb2('0x2f')]=qs[_0x2cb2('0x2f')](_0x50570b[_0x2cb2('0x42')]['offset']);}_0x325fb4[_0x2cb2('0x49')]=qs['sort'](_0x50570b['query'][_0x2cb2('0x4a')]);_0x325fb4['where']=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x50570b['query'],_0x347867[_0x2cb2('0x4c')]));_0x325fb4['where']['ChatInteractionId']=_0x111bd0['id'];if(_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x8b')]){_0x325fb4['where']=_[_0x2cb2('0xa0')](_0x325fb4[_0x2cb2('0x4b')],{'$or':_[_0x2cb2('0x37')](_0x325fb4['attributes'],function(_0xa38033){var _0x3e8d39={};_0x3e8d39[_0xa38033]={'$like':'%'+_0x50570b[_0x2cb2('0x42')]['filter']+'%'};return _0x3e8d39;})});}if(_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x80')]){var _0x4be72e=_0x50570b['query']['$gte'][_0x2cb2('0x3a')](',');var _0x323056={};_0x323056[_0x4be72e[0x0]]={'$gte':moment(_0x4be72e[0x1])[_0x2cb2('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x325fb4[_0x2cb2('0x4b')]=_[_0x2cb2('0xa0')](_0x325fb4[_0x2cb2('0x4b')],_0x323056);}_0x325fb4=_['merge']({},_0x325fb4,_0x50570b['options']);return db['ChatMessage']['count']({'where':_0x325fb4[_0x2cb2('0x4b')]})[_0x2cb2('0x20')](function(_0x4ea19a){_0xdf04be[_0x2cb2('0x9e')]=_0x4ea19a;if(_0x50570b[_0x2cb2('0x42')]['includeAll']){_0x325fb4[_0x2cb2('0x106')]=[{'all':!![]}];}return db['ChatMessage'][_0x2cb2('0x107')](_0x325fb4);})[_0x2cb2('0x20')](function(_0x152f99){_0xdf04be[_0x2cb2('0x108')]=_0x152f99;return _0xdf04be;});}})['then'](respondWithFilteredResult(_0x481a34,_0x325fb4))[_0x2cb2('0x3d')](handleError(_0x481a34,null));};exports[_0x2cb2('0x109')]=function(_0x274e78,_0x40ebc1,_0x53984e){var _0x4f7427={'where':{}},_0x1c4637={},_0x487d45={'count':0x0,'rows':[]};return db[_0x2cb2('0x3f')][_0x2cb2('0xd9')]({'where':{'id':_0x274e78[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0x40ebc1,null))[_0x2cb2('0x20')](function(_0x3a5398){if(_0x3a5398){_0x1c4637[_0x2cb2('0x41')]=_[_0x2cb2('0x43')](db[_0x2cb2('0x103')][_0x2cb2('0xba')]);_0x1c4637[_0x2cb2('0x42')]=_[_0x2cb2('0x43')](_0x274e78[_0x2cb2('0x42')]);_0x1c4637['filters']=_[_0x2cb2('0x44')](_0x1c4637[_0x2cb2('0x41')],_0x1c4637['query']);_0x4f7427['attributes']=_['intersection'](_0x1c4637[_0x2cb2('0x41')],qs['fields'](_0x274e78[_0x2cb2('0x42')]['fields']));_0x4f7427[_0x2cb2('0x45')]=_0x4f7427[_0x2cb2('0x45')][_0x2cb2('0x6f')]?_0x4f7427['attributes']:_0x1c4637['model'];if(!_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x46')]('nolimit')){_0x4f7427[_0x2cb2('0x48')]=qs[_0x2cb2('0x48')](_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x48')]);_0x4f7427[_0x2cb2('0x2f')]=qs[_0x2cb2('0x2f')](_0x274e78['query'][_0x2cb2('0x2f')]);}_0x4f7427[_0x2cb2('0x49')]=qs['sort'](_0x274e78['query'][_0x2cb2('0x4a')]);_0x4f7427['where']=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x274e78[_0x2cb2('0x42')],_0x1c4637[_0x2cb2('0x4c')]));_0x4f7427[_0x2cb2('0x4b')][_0x2cb2('0xb6')]=_0x3a5398['id'];if(_0x274e78[_0x2cb2('0x42')]['filter']){_0x4f7427[_0x2cb2('0x4b')]=_[_0x2cb2('0xa0')](_0x4f7427[_0x2cb2('0x4b')],{'$or':_[_0x2cb2('0x37')](_0x4f7427['attributes'],function(_0x4a55b7){var _0x113064={};_0x113064[_0x4a55b7]={'$like':'%'+_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x8b')]+'%'};return _0x113064;})});}_0x4f7427['where'][_0x2cb2('0xf5')]=![];if(_0x274e78['query']['id']){_0x4f7427[_0x2cb2('0x4b')]['id']={'$gt':_0x274e78[_0x2cb2('0x42')]['id']};}_0x4f7427=_[_0x2cb2('0xa0')]({},_0x4f7427,_0x274e78['options']);return db[_0x2cb2('0x103')]['count']({'where':_0x4f7427['where']})[_0x2cb2('0x20')](function(_0x596360){_0x487d45[_0x2cb2('0x9e')]=_0x596360;_0x4f7427[_0x2cb2('0x106')]=[];if(_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x10a')]){_0x4f7427['include']['push']({'model':db[_0x2cb2('0x74')],'as':_0x2cb2('0x74'),'attributes':['id','fullname',_0x2cb2('0xef')]});}if(_0x274e78['query'][_0x2cb2('0xbc')]){_0x4f7427[_0x2cb2('0x106')]=[{'all':!![]}];}return db[_0x2cb2('0x103')][_0x2cb2('0x107')](_0x4f7427);})['then'](function(_0x2435ca){_0x487d45[_0x2cb2('0x108')]=_0x2435ca;return _0x487d45;});}})[_0x2cb2('0x20')](respondWithFilteredResult(_0x40ebc1,_0x4f7427))['catch'](handleError(_0x40ebc1,null));};exports['addTags']=function(_0x559c76,_0x4f251b,_0x118d33){return db[_0x2cb2('0x3f')]['find']({'where':{'id':_0x559c76[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x4f251b,null))[_0x2cb2('0x20')](function(_0x39d2b9){if(_0x39d2b9){return _0x39d2b9[_0x2cb2('0x10b')](_0x559c76[_0x2cb2('0xbf')][_0x2cb2('0x104')],_[_0x2cb2('0x105')](_0x559c76[_0x2cb2('0xbf')],[_0x2cb2('0x104'),'id'])||{})[_0x2cb2('0x10c')](function(){return db[_0x2cb2('0x10d')][_0x2cb2('0x107')]({'attributes':['id','name',_0x2cb2('0x10e')],'where':{'id':_0x559c76[_0x2cb2('0xbf')][_0x2cb2('0x104')]}});})['then'](function(_0x3fc384){socket[_0x2cb2('0x10f')](_0x2cb2('0x110'),{'id':Number(_0x559c76['params']['id']),'tags':_0x3fc384||[]});return{'id':Number(_0x559c76['params']['id']),'tags':_0x3fc384||[]};});}})[_0x2cb2('0x20')](respondWithResult(_0x4f251b,null))[_0x2cb2('0x3d')](handleError(_0x4f251b,null));};exports['removeTags']=function(_0x1cafa2,_0x6f32e0,_0x9f6b0a){return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x1cafa2[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x6f32e0,null))[_0x2cb2('0x20')](function(_0x19ac39){if(_0x19ac39){return _0x19ac39[_0x2cb2('0x111')](_0x1cafa2[_0x2cb2('0x42')][_0x2cb2('0x104')]);}})[_0x2cb2('0x20')](respondWithStatusCode(_0x6f32e0,null))['catch'](handleError(_0x6f32e0,null));};exports[_0x2cb2('0xdc')]=function(_0x1761bd,_0x51cca2){var _0x22b8d6=moment()[_0x2cb2('0x112')]()[_0x2cb2('0xb5')]();var _0x4b0e7e=path[_0x2cb2('0xe1')](config[_0x2cb2('0xdd')],'server',_0x2cb2('0x113'),'tmp');var _0x34b75d=path[_0x2cb2('0xe1')](config[_0x2cb2('0xdd')],_0x2cb2('0x114'),_0x2cb2('0x113'),_0x2cb2('0x115'));var _0x478d06=path[_0x2cb2('0xe1')](_0x4b0e7e,_0x22b8d6);var _0x50f193=util[_0x2cb2('0xe3')](_0x2cb2('0x116'),_0x1761bd['params']['id'],_0x22b8d6);var _0xb2cd6f=path[_0x2cb2('0xe1')](_0x4b0e7e,_0x50f193);var _0x2d0641=[];_0x2d0641[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0x74')],'as':'User','attributes':['id',_0x2cb2('0xf1')],'raw':!![]});_0x2d0641[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0xe7')],'as':_0x2cb2('0x6c'),'attributes':['id','firstName',_0x2cb2('0x117')],'raw':!![]});if(_0x1761bd['query'][_0x2cb2('0x115')]){_0x2d0641['push']({'model':db[_0x2cb2('0x118')],'as':_0x2cb2('0x118'),'raw':!![]});}var _0x62931d=[{'model':db[_0x2cb2('0x103')],'as':_0x2cb2('0xe6'),'attributes':['id',_0x2cb2('0xbf'),_0x2cb2('0x7f'),_0x2cb2('0xf4'),_0x2cb2('0xf5'),_0x2cb2('0x86')],'include':_0x2d0641}];_0x62931d[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0xc3')],'as':_0x2cb2('0x119'),'attributes':['id',_0x2cb2('0x4f')]});_0x62931d[_0x2cb2('0x3c')]({'model':db['User'],'as':_0x2cb2('0x11a'),'attributes':['id',_0x2cb2('0xf1')]});return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x1761bd['params']['id']},'include':_0x62931d})[_0x2cb2('0x20')](handleEntityNotFound(_0x51cca2,null))[_0x2cb2('0x20')](function(_0x332988){if(_0x332988){var _0x1794da=_0x332988['get']({'plain':!![]});fs[_0x2cb2('0x11b')](_0x478d06);var _0xee97b3={'format':'A4','border':_0x2cb2('0x11c'),'header':{'height':_0x2cb2('0x11d'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x2cb2('0x11e'),'contents':{'default':util[_0x2cb2('0xe3')](_0x2cb2('0x11f'),util[_0x2cb2('0xe3')]('%s\x20#%d',_0x2cb2('0x120'),_0x1794da['id']),moment()[_0x2cb2('0xe3')](_0x2cb2('0x121'))[_0x2cb2('0xb5')]())}}};var _0x1e9dff={'channel':_0x2cb2('0x120'),'account':_0x1794da['Account']['name'],'agent':_0x1794da[_0x2cb2('0x11a')]?_0x1794da[_0x2cb2('0x11a')][_0x2cb2('0xf1')]:_0x2cb2('0x122'),'createdAt':moment(_0x1794da[_0x2cb2('0x7f')])['format'](_0x2cb2('0x123'))[_0x2cb2('0xb5')](),'closedAt':_0x1794da[_0x2cb2('0xd1')]?moment(_0x1794da[_0x2cb2('0x124')])['format'](_0x2cb2('0x123'))['toString']():'','disposition':_0x1794da[_0x2cb2('0xd2')],'chatInfo':{'browser':_0x1794da[_0x2cb2('0x125')],'os':_0x1794da[_0x2cb2('0x126')],'referer':_0x1794da[_0x2cb2('0x127')],'customerIp':_0x1794da['customerIp'],'customerPort':_0x1794da[_0x2cb2('0x128')]?_0x1794da[_0x2cb2('0x128')]:_0x2cb2('0x122')},'messages':_(_0x1794da[_0x2cb2('0xe6')])[_0x2cb2('0x129')]()[_0x2cb2('0x8b')]({'secret':![]})[_0x2cb2('0x37')](function(_0x5b468d){if(_0x5b468d[_0x2cb2('0x118')]){var _0x2c1e16=path[_0x2cb2('0xe1')](_0x34b75d,_0x5b468d['Attachment'][_0x2cb2('0xde')]);if(fs['existsSync'](_0x2c1e16)){fs[_0x2cb2('0x12a')](_0x2c1e16)[_0x2cb2('0x12b')](fs['createWriteStream'](path[_0x2cb2('0xe1')](_0x478d06,_0x5b468d[_0x2cb2('0x118')][_0x2cb2('0xde')])));}}return{'date':moment(_0x5b468d[_0x2cb2('0x7f')])[_0x2cb2('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2cb2('0xb5')](),'sender':_0x5b468d[_0x2cb2('0xf4')]===_0x2cb2('0xca')?_0x5b468d[_0x2cb2('0x74')]?_0x5b468d[_0x2cb2('0x74')][_0x2cb2('0xf1')]:'System':_0x5b468d[_0x2cb2('0x6c')]['firstName']+(_0x5b468d[_0x2cb2('0x6c')][_0x2cb2('0x117')]?'\x20'+_0x5b468d[_0x2cb2('0x6c')][_0x2cb2('0x117')]:''),'body':_0x5b468d['Attachment']?_0x5b468d[_0x2cb2('0x118')][_0x2cb2('0xde')]:_0x5b468d[_0x2cb2('0xbf')],'direction':_0x5b468d['direction']===_0x2cb2('0xca')?'A':'C','secret':_0x5b468d[_0x2cb2('0xf5')],'read':_0x5b468d['read'],'attachment':_0x5b468d[_0x2cb2('0x118')]};})[_0x2cb2('0x68')]()};return ejs['renderFile'](path['join'](config[_0x2cb2('0xdd')],'server','views',_0x2cb2('0x12c')),{'interaction':_0x1e9dff})[_0x2cb2('0x20')](function(_0x1d1b14){return new BPromise(function(_0x224e2d,_0x4a76ec){pdf[_0x2cb2('0xbe')](_0x1d1b14,_0xee97b3)[_0x2cb2('0x12d')](path[_0x2cb2('0xe1')](_0x478d06,_0x2cb2('0x12e')+_0x1794da['id']+'-'+_0x22b8d6+_0x2cb2('0x12f')),function(_0x2a02f3,_0x1fb1d7){if(_0x2a02f3)return _0x4a76ec(_0x2a02f3);_0x224e2d(_0x1fb1d7);});});})[_0x2cb2('0x20')](function(){return new BPromise(function(_0x218df6,_0x5cfeef){zipdir(_0x478d06,{'saveTo':_0xb2cd6f},function(_0x383474,_0x1b0f12){if(_0x383474)return _0x5cfeef(_0x383474);return _0x218df6(_0x1b0f12);});})['then'](function(){return new BPromise(function(_0x2bac6b,_0x4b57c8){rimraf(_0x478d06,function(_0x5c70eb){if(_0x5c70eb)_0x4b57c8(_0x5c70eb);return _0x2bac6b();});});})[_0x2cb2('0x20')](function(){return _0x51cca2['download'](_0xb2cd6f,_0x50f193,function(_0x1c5713){if(_0x1c5713){console[_0x2cb2('0x130')](_0x2cb2('0x131'),_0x1c5713);}else{fs[_0x2cb2('0x132')](_0xb2cd6f);}});});});}else{return _0x51cca2[_0x2cb2('0x2b')](0xc8);}})[_0x2cb2('0x3d')](handleError(_0x51cca2,null));}; \ No newline at end of file +var _0xe02a=['tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','merge','ChatInteraction','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','intersection','includeAll','include','create','body','params','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','join_url','ChatMessage','ValidationError','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','format','now','pathTranscript','ChatWebsite','CmContact','customer','Visitor','agentIdentifier','website_alias','%s%d','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','Contact','firstName','lastName','Messages','Account','Owner','mkdirSync','40px','30px','%s\x20#%d','YYYY-MM-DD','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','out','views','downloadInteraction.html','log','err','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','client','http','info','ChatInteraction,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','count','offset','set','apply','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','expr','parseSearch','search','conditions','find','value','having','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read'];(function(_0xc7b8d2,_0x10da03){var _0x38934d=function(_0x8a5089){while(--_0x8a5089){_0xc7b8d2['push'](_0xc7b8d2['shift']());}};_0x38934d(++_0x10da03);}(_0xe02a,0xa3));var _0xae02=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe02a[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0xae02('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae02('0x1'));var moment=require(_0xae02('0x2'));var BPromise=require(_0xae02('0x3'));var Mustache=require(_0xae02('0x4'));var util=require(_0xae02('0x5'));var path=require(_0xae02('0x6'));var sox=require(_0xae02('0x7'));var csv=require(_0xae02('0x8'));var ejs=require(_0xae02('0x9'));var fs=require('fs');var _=require(_0xae02('0xa'));var squel=require(_0xae02('0xb'));var crypto=require(_0xae02('0xc'));var jsforce=require(_0xae02('0xd'));var deskjs=require(_0xae02('0xe'));var toCsv=require(_0xae02('0x8'));var querystring=require(_0xae02('0xf'));var Papa=require(_0xae02('0x10'));var Redis=require(_0xae02('0x11'));var authService=require(_0xae02('0x12'));var qs=require(_0xae02('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae02('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xae02('0x15'));var config=require(_0xae02('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae02('0x17'))['db'];config[_0xae02('0x18')]=_[_0xae02('0x19')](config['redis'],{'host':_0xae02('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae02('0x18')]));require(_0xae02('0x1b'))[_0xae02('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xae02('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0xae02('0x1d')][_0xae02('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x29d574,_0x110ccb,_0x227c5a,_0x1872c2){return new BPromise(function(_0x24dead,_0x737da8){var _0x1bfa33=_0x1872c2||client;return _0x1bfa33['request'](_0x29d574,_0x227c5a)['then'](function(_0x28fd31){logger[_0xae02('0x1f')](_0xae02('0x20'),_0x110ccb,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x110ccb,'request\x20sent',JSON[_0xae02('0x21')](_0x28fd31));if(_0x28fd31[_0xae02('0x22')]){if(_0x28fd31[_0xae02('0x22')][_0xae02('0x23')]===0x1f4){logger[_0xae02('0x22')](_0xae02('0x20'),_0x110ccb,_0x28fd31[_0xae02('0x22')][_0xae02('0x24')]);return _0x737da8(_0x28fd31[_0xae02('0x22')][_0xae02('0x24')]);}logger[_0xae02('0x22')](_0xae02('0x20'),_0x110ccb,_0x28fd31[_0xae02('0x22')][_0xae02('0x24')]);return _0x24dead(_0x28fd31['error']['message']);}else{logger[_0xae02('0x1f')](_0xae02('0x20'),_0x110ccb,_0xae02('0x25'));_0x24dead(_0x28fd31[_0xae02('0x26')][_0xae02('0x24')]);}})['catch'](function(_0x261851){logger[_0xae02('0x22')](_0xae02('0x20'),_0x110ccb,_0x261851);_0x737da8(_0x261851);});});}function respondWithStatusCode(_0x3a3ebe,_0x23a32b){_0x23a32b=_0x23a32b||0xcc;return function(_0x374576){if(_0x374576){return _0x3a3ebe[_0xae02('0x27')](_0x23a32b);}return _0x3a3ebe[_0xae02('0x28')](_0x23a32b)[_0xae02('0x29')]();};}function respondWithResult(_0x123c25,_0xb4c47f){_0xb4c47f=_0xb4c47f||0xc8;return function(_0x29f9c7){if(_0x29f9c7){return _0x123c25['status'](_0xb4c47f)[_0xae02('0x2a')](_0x29f9c7);}};}function respondWithFilteredResult(_0xe8b9a4,_0x111af2){return function(_0x50c35e){if(_0x50c35e){var _0x536694=_0x50c35e[_0xae02('0x2b')],_0x2b3b08=_0x111af2[_0xae02('0x2c')],_0x10a8ad=_0x111af2[_0xae02('0x2c')]+_0x111af2['limit'],_0x1834c2;if(_0x10a8ad>=_0x536694){_0x10a8ad=_0x536694;_0x1834c2=0xc8;}else{_0x1834c2=0xce;}_0xe8b9a4[_0xae02('0x28')](_0x1834c2);return _0xe8b9a4[_0xae02('0x2d')]('Content-Range',_0x2b3b08+'-'+_0x10a8ad+'/'+_0x536694)[_0xae02('0x2a')](_0x50c35e);}return null;};}function patchUpdates(_0xb564aa){return function(_0xdf336d){try{jsonpatch[_0xae02('0x2e')](_0xdf336d,_0xb564aa,!![]);}catch(_0x4214aa){return BPromise['reject'](_0x4214aa);}return _0xdf336d[_0xae02('0x2f')]();};}function saveUpdates(_0x423682,_0x1e642e){return function(_0x1dd14d){if(_0x1dd14d){return _0x1dd14d[_0xae02('0x30')](_0x423682)[_0xae02('0x31')](function(_0x30882e){return _0x30882e;});}return null;};}function removeEntity(_0x5c8dc7,_0x2e92bc){return function(_0xf93fb0){if(_0xf93fb0){return _0xf93fb0['destroy']()[_0xae02('0x31')](function(){_0x5c8dc7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8348,_0x1d1c61){return function(_0x366244){if(!_0x366244){_0x3f8348[_0xae02('0x27')](0x194);}return _0x366244;};}function handleError(_0x30e729,_0x17bc44){_0x17bc44=_0x17bc44||0x1f4;return function(_0x4e6b55){logger[_0xae02('0x22')](_0x4e6b55[_0xae02('0x32')]);if(_0x4e6b55[_0xae02('0x33')]){delete _0x4e6b55[_0xae02('0x33')];}_0x30e729[_0xae02('0x28')](_0x17bc44)[_0xae02('0x34')](_0x4e6b55);};}function getInteractionUsers(_0x53b577,_0x22d9e1){return new BPromise(function(_0x2c8adc,_0x213991){try{if(_0x22d9e1[_0x53b577['id']]){_0x53b577[_0xae02('0x35')]=_[_0xae02('0x36')](_0x22d9e1[_0x53b577['id']],function(_0xd02747){return{'id':_0xd02747['id'],'fullname':_0xd02747[_0xae02('0x37')]};});}}catch(_0x15e61a){_0x213991(_0x15e61a);}_0x2c8adc(_0x53b577);});}function getInteractionTags(_0x156d2a,_0x4caabe){return new BPromise(function(_0x41ce30,_0x14930d){try{if(_0x156d2a[_0xae02('0x38')]){_0x156d2a[_0xae02('0x39')]=[];_0x156d2a[_0xae02('0x38')][_0xae02('0x3a')](',')['forEach'](function(_0x2007b5){_0x156d2a[_0xae02('0x39')][_0xae02('0x3b')](_0x4caabe[_0x2007b5]);});}delete _0x156d2a['TagIds'];}catch(_0x3685f1){_0x14930d(_0x3685f1);}_0x41ce30(_0x156d2a);});}function updateChatInteraction(_0x2e4c78,_0x47bb8b,_0x2b3217){return new BPromise(function(_0x249a76,_0x273eba){return getInteractionUsers(_0x2e4c78,_0x2b3217)['then'](function(_0x2614cf){return getInteractionTags(_0x2614cf,_0x47bb8b);})[_0xae02('0x31')](function(_0x37ffcd){_0x249a76(_0x37ffcd);})[_0xae02('0x3c')](function(_0x27f751){_0x273eba(_0x27f751);});});}exports['index']=function(_0x5db078,_0x1fdbaa){var _0x206275={},_0x22fa90={},_0x1238db={'count':0x0,'rows':[]};var _0x40ed68=_[_0xae02('0x36')](db['ChatInteraction'][_0xae02('0x3d')],function(_0x491b79){return{'name':_0x491b79[_0xae02('0x3e')],'type':_0x491b79[_0xae02('0x3f')][_0xae02('0x40')]};});_0x22fa90[_0xae02('0x41')]=_[_0xae02('0x36')](_0x40ed68,_0xae02('0x33'));_0x22fa90[_0xae02('0x42')]=_[_0xae02('0x43')](_0x5db078[_0xae02('0x42')]);_0x22fa90[_0xae02('0x44')]=_['intersection'](_0x22fa90['model'],_0x22fa90[_0xae02('0x42')]);_0x206275[_0xae02('0x45')]=_['intersection'](_0x22fa90[_0xae02('0x41')],qs[_0xae02('0x46')](_0x5db078[_0xae02('0x42')][_0xae02('0x46')]));_0x206275[_0xae02('0x45')]=_0x206275[_0xae02('0x45')][_0xae02('0x47')]?_0x206275[_0xae02('0x45')]:_0x22fa90[_0xae02('0x41')];if(!_0x5db078[_0xae02('0x42')][_0xae02('0x48')](_0xae02('0x49'))){_0x206275['limit']=qs[_0xae02('0x4a')](_0x5db078[_0xae02('0x42')]['limit']);_0x206275[_0xae02('0x2c')]=qs[_0xae02('0x2c')](_0x5db078[_0xae02('0x42')][_0xae02('0x2c')]);}_0x206275[_0xae02('0x4b')]=qs[_0xae02('0x4c')](_0x5db078['query'][_0xae02('0x4c')]);_0x206275[_0xae02('0x4d')]=qs[_0xae02('0x44')](_[_0xae02('0x4e')](_0x5db078['query'],_0x22fa90[_0xae02('0x44')]),_0x40ed68);var _0x51dabc=[];var _0x296044=squel[_0xae02('0x4f')]()[_0xae02('0x50')]('id')[_0xae02('0x50')](_0xae02('0x33'))['field'](_0xae02('0x51'))[_0xae02('0x52')](_0xae02('0x53'));var _0x219cf1=squel[_0xae02('0x4f')]()['field'](_0xae02('0x54'))[_0xae02('0x50')]('u.fullname')[_0xae02('0x50')](_0xae02('0x55'))[_0xae02('0x52')](_0xae02('0x56'),'ui')['left_join'](_0xae02('0x57'),'u',_0xae02('0x58'));var _0x4fc387=squel['select']()[_0xae02('0x52')](_0xae02('0x59'),'i')[_0xae02('0x5a')](_0xae02('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xae02('0x57'),'o',_0xae02('0x5c'))[_0xae02('0x5a')](_0xae02('0x5d'),'a',_0xae02('0x5e'))[_0xae02('0x5a')](_0xae02('0x5f'),'me',_0xae02('0x60'))[_0xae02('0x5a')](_0xae02('0x61'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x2b7648=squel[_0xae02('0x62')]();var _0x3d73f1=[];var _0x3d889a=squel[_0xae02('0x62')]();var _0x5c0c01;if(_0x5db078[_0xae02('0x42')]['search']){_0x5c0c01=as[_0xae02('0x63')](_0x5db078[_0xae02('0x42')][_0xae02('0x64')]);var _0x1999c2=_0x5c0c01['sqlOperator'];for(var _0x18dc6d=0x0;_0x18dc6d<_0x5c0c01['conditions']['length'];_0x18dc6d++){var _0x31cff3=_0x5c0c01[_0xae02('0x65')][_0x18dc6d];var _0x2d763c='i';var _0x2a0f2a=_[_0xae02('0x66')](_0x40ed68,[_0xae02('0x33'),_0x31cff3[_0xae02('0x50')]]);if(!_0x2a0f2a){switch(_0x31cff3[_0xae02('0x50')]){case'unreadMessages':if(_0x31cff3[_0xae02('0x67')]==0x1){_0x4fc387['having']('`'+_0x31cff3[_0xae02('0x50')]+'`\x20=\x200');}else{_0x4fc387[_0xae02('0x68')]('`'+_0x31cff3['field']+'`\x20>\x200');}break;case'Contact':if(_0x31cff3[_0xae02('0x69')]==='$substring'){if(_0x31cff3[_0xae02('0x67')][_0xae02('0x3a')]('\x20')[_0xae02('0x47')]>0x1){_0x2b7648[_0x1999c2](_0xae02('0x6a'),qs[_0xae02('0x6b')](_0x31cff3[_0xae02('0x67')]),null);}else{var _0x1dce81='%'+_0x31cff3[_0xae02('0x67')]+'%';_0x2b7648[_0x1999c2](_0xae02('0x6c'),_0x1dce81,_0x1dce81,_0x1dce81);}}else{_0x2a0f2a=_[_0xae02('0x66')](_0x40ed68,[_0xae02('0x33'),'ContactId']);_0x31cff3[_0xae02('0x50')]=_0xae02('0x6d');_0x17eddb=as[_0xae02('0x6e')](_0x2d763c,_0x2a0f2a[_0xae02('0x3f')],_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb[_0xae02('0x67')][_0xae02('0x6f')],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);}break;case'Tag':var _0x1c1473=_0x31cff3[_0xae02('0x67')][_0xae02('0x3a')](',')['map'](function(_0x45e6f9){return Number(_0x45e6f9);});_0x1c1473[_0xae02('0x70')](function(_0x4c4621){_0x3d889a['or'](_0xae02('0x71'),'%,'+_0x4c4621+',%');});_0x3d73f1=_['union'](_0x3d73f1,_0x1c1473);break;case _0xae02('0x72'):if(_0x31cff3[_0xae02('0x69')]===_0xae02('0x73')){_0x2b7648[_0x1999c2](_0xae02('0x74'),'%'+_0x31cff3[_0xae02('0x67')]+'%',null);}else{_0x2a0f2a=_[_0xae02('0x66')](_0x40ed68,[_0xae02('0x33'),_0xae02('0x75')]);_0x31cff3['field']=_0xae02('0x75');_0x17eddb=as[_0xae02('0x6e')](_0x2d763c,_0x2a0f2a[_0xae02('0x3f')],_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb['value'][_0xae02('0x6f')],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);}break;case'body':_0x17eddb=as['buildExpression']('me',null,_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb[_0xae02('0x67')]['start'],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);break;}}else{var _0x17eddb=as[_0xae02('0x6e')](_0x2d763c,_0x2a0f2a[_0xae02('0x3f')],_0x31cff3);_0x2b7648[_0x1999c2](_0x17eddb['text'],_0x17eddb[_0xae02('0x67')][_0xae02('0x6f')],_0x17eddb[_0xae02('0x67')][_0xae02('0x29')]);}}}else{var _0x2c2562=_(_0x5db078[_0xae02('0x42')])[_0xae02('0x43')]()[_0xae02('0x36')](function(_0x3caa80){return _[_0xae02('0x76')](_0x40ed68,[_0xae02('0x33'),_0x3caa80])?_0x3caa80:undefined;})[_0xae02('0x77')]()[_0xae02('0x67')]();if(!_[_0xae02('0x78')](_0x2c2562)){_0x2c2562[_0xae02('0x70')](function(_0xe7e0ee){if(_0xe7e0ee===_0xae02('0x79')){_0x4fc387[_0xae02('0x4d')](_0xae02('0x7a'),[]['concat'](_0x5db078[_0xae02('0x42')][_0xe7e0ee]));}else if(_0xe7e0ee===_0xae02('0x7b')){var _0x2f49a1=JSON[_0xae02('0x7c')](_0x5db078['query'][_0xe7e0ee])[_0xae02('0x7d')];var _0x4ae71d=JSON['parse'](_0x5db078[_0xae02('0x42')][_0xe7e0ee])[_0xae02('0x7e')];_0x4fc387['where'](_0xae02('0x7f'),_0x2f49a1,_0x4ae71d);}else{if(_0x5db078[_0xae02('0x42')][_0xe7e0ee]==='null'){_0x4fc387['where']('i.'+_0xe7e0ee+_0xae02('0x80'));}else{_0x4fc387[_0xae02('0x4d')]('i.'+_0xe7e0ee+_0xae02('0x81'),_0x5db078[_0xae02('0x42')][_0xe7e0ee]);}}});}if(_0x5db078['query'][_0xae02('0x82')]){if(_0x5db078[_0xae02('0x42')]['read']==0x1){_0x4fc387[_0xae02('0x68')]('`unreadMessages`\x20=\x200');}else{_0x4fc387['having']('`unreadMessages`\x20>\x200');}}if(_0x5db078[_0xae02('0x42')][_0xae02('0x83')]){_0x3d73f1=_[_0xae02('0x84')](_0x5db078[_0xae02('0x42')][_0xae02('0x83')])?_0x5db078[_0xae02('0x42')][_0xae02('0x83')]:new Array(_0x5db078[_0xae02('0x42')][_0xae02('0x83')]);_0x3d73f1[_0xae02('0x70')](function(_0x4d0e9b){_0x3d889a['or'](_0xae02('0x71'),'%,'+_0x4d0e9b+',%');});}if(_0x5db078['query'][_0xae02('0x85')]){var _0x2293b6=_0x5db078[_0xae02('0x42')][_0xae02('0x85')]['replace']('\x5c','\x5c\x5c')[_0xae02('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2293b6)){_0x2b7648['or'](_0xae02('0x87'),_0x2293b6+'%');}else{_0x2b7648['or'](_0xae02('0x88'),qs[_0xae02('0x6b')](_0x2293b6))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2293b6+'%');}}}_0x4fc387[_0xae02('0x4d')](_0x2b7648);_0x4fc387[_0xae02('0x89')]('i.id');var _0x13eb66={'type':db[_0xae02('0x8a')][_0xae02('0x8b')][_0xae02('0x8c')],'raw':!![]};var _0x252174=_0x4fc387['clone']();_0x252174[_0xae02('0x50')](_0xae02('0x8d'));_0x252174[_0xae02('0x50')](_0xae02('0x8e'),'unreadMessages');if(_0x206275[_0xae02('0x4b')]){_0x206275[_0xae02('0x4b')]['forEach'](function(_0x595aa9){var _0xef192e=_0x595aa9[0x0]==='contactName'?_0x595aa9[0x0]:'i.'+_0x595aa9[0x0];_0x4fc387[_0xae02('0x4b')](_0xef192e,_0x595aa9[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x3d73f1)){_0x4fc387[_0xae02('0x68')](_0x3d889a);_0x252174['where'](_0xae02('0x8f'),_0x3d73f1);}BPromise[_0xae02('0x90')]()[_0xae02('0x31')](function(){if(!_0x5c0c01){if(_0x5db078[_0xae02('0x42')][_0xae02('0x79')]||_0x5db078[_0xae02('0x42')]['journey'])return;_0x252174[_0xae02('0x4d')](_0xae02('0x91'));_0x4fc387[_0xae02('0x4d')](_0xae02('0x91'));return;}if(_0x5db078['user'][_0xae02('0x92')]!==_0xae02('0x93'))return;return _0x5db078[_0xae02('0x94')][_0xae02('0x95')]({'attributes':['id'],'raw':!![]})[_0xae02('0x31')](function(_0x37b926){if(_[_0xae02('0x78')](_0x37b926)){_0x252174['where'](_0xae02('0x96'));_0x4fc387[_0xae02('0x4d')](_0xae02('0x96'));}else{_0x252174[_0xae02('0x4d')](_0xae02('0x7a'),_[_0xae02('0x36')](_0x37b926,'id'));_0x4fc387[_0xae02('0x4d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xae02('0x36')](_0x37b926,'id'));}});})[_0xae02('0x31')](function(){if(_0x5db078[_0xae02('0x94')][_0xae02('0x92')]===_0xae02('0x93')&&!_0x5c0c01&&!_0x5db078[_0xae02('0x42')][_0xae02('0x79')])return[];return db['sequelize']['query'](_0x252174[_0xae02('0x97')](),_0x13eb66);})[_0xae02('0x31')](function(_0x4353eb){_0x1238db['count']=_0x4353eb['length'];if(_0x1238db[_0xae02('0x2b')]===0x0)return[];return db[_0xae02('0x98')][_0xae02('0x42')](_0x296044[_0xae02('0x97')](),_0x13eb66)[_0xae02('0x31')](function(_0x4b6ba9){_0x51dabc=_['keyBy'](_0x4b6ba9,'id');_0x13eb66=_[_0xae02('0x99')](_0x13eb66,{'model':db[_0xae02('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5db078['query'][_0xae02('0x46')]){_0x206275[_0xae02('0x45')]['forEach'](function(_0x37a5f9){_0x4fc387['field']('i.'+_0x37a5f9);});}else{_0x4fc387[_0xae02('0x50')](_0xae02('0x8e'),_0xae02('0x9b'));_0x4fc387[_0xae02('0x50')](_0xae02('0x9c'),_0xae02('0x9d'));_0x4fc387[_0xae02('0x50')](_0xae02('0x9e'),_0xae02('0x9f'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa0'),_0xae02('0xa1'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa2'));_0x4fc387['field'](_0xae02('0xa3'),'Contact.firstName');_0x4fc387[_0xae02('0x50')](_0xae02('0xa4'),_0xae02('0xa5'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa6'),_0xae02('0xa7'));_0x4fc387[_0xae02('0x50')](_0xae02('0xa8'),_0xae02('0xa9'));_0x4fc387['field'](_0xae02('0xaa'),_0xae02('0xab'));_0x4fc387[_0xae02('0x50')]('c.fax','Contact.fax');_0x4fc387[_0xae02('0x50')]('o.fullname',_0xae02('0xac'));_0x4fc387[_0xae02('0x50')]('o.internal',_0xae02('0xad'));_0x4fc387[_0xae02('0x50')](_0xae02('0xae'),_0xae02('0x38'));}if(_0x206275[_0xae02('0x4a')])_0x4fc387[_0xae02('0x4a')](_0x206275['limit']);if(_0x206275[_0xae02('0x2c')])_0x4fc387[_0xae02('0x2c')](_0x206275['offset']);return db[_0xae02('0x98')][_0xae02('0x42')](_0x4fc387[_0xae02('0x97')](),_0x13eb66);})[_0xae02('0x31')](function(_0x2843ac){_0x219cf1[_0xae02('0x4d')](_0xae02('0xaf'),_[_0xae02('0x36')](_0x2843ac,'id'));return db['sequelize'][_0xae02('0x42')](_0x219cf1[_0xae02('0x97')](),_0x13eb66)['then'](function(_0x82bb75){var _0x51c225=_[_0xae02('0xb0')](_0x82bb75,_0xae02('0xb1'));var _0x1291c5=[];_0x2843ac['forEach'](function(_0x5cfa84){_0x1291c5[_0xae02('0x3b')](updateChatInteraction(_0x5cfa84,_0x51dabc,_0x51c225));});return BPromise[_0xae02('0xb2')](_0x1291c5);});});})[_0xae02('0x31')](function(_0x2f4a06){_0x1238db['rows']=_0x2f4a06;return _0x1238db;})[_0xae02('0x31')](respondWithFilteredResult(_0x1fdbaa,_0x206275))['catch'](handleError(_0x1fdbaa,null));};exports[_0xae02('0xb3')]=function(_0x3db6c7,_0x57b525){var _0x31b00b={'raw':![],'where':{'id':_0x3db6c7['params']['id']}},_0x14f09={};_0x14f09[_0xae02('0x41')]=_[_0xae02('0x43')](db[_0xae02('0x9a')][_0xae02('0x3d')]);_0x14f09['query']=_[_0xae02('0x43')](_0x3db6c7['query']);_0x14f09[_0xae02('0x44')]=_['intersection'](_0x14f09[_0xae02('0x41')],_0x14f09['query']);_0x31b00b[_0xae02('0x45')]=_[_0xae02('0xb4')](_0x14f09[_0xae02('0x41')],qs[_0xae02('0x46')](_0x3db6c7[_0xae02('0x42')]['fields']));_0x31b00b[_0xae02('0x45')]=_0x31b00b[_0xae02('0x45')][_0xae02('0x47')]?_0x31b00b[_0xae02('0x45')]:_0x14f09[_0xae02('0x41')];if(_0x3db6c7[_0xae02('0x42')][_0xae02('0xb5')]){_0x31b00b[_0xae02('0xb6')]=[{'all':!![]}];}_0x31b00b=_[_0xae02('0x99')]({},_0x31b00b,_0x3db6c7['options']);return db[_0xae02('0x9a')]['find'](_0x31b00b)[_0xae02('0x31')](handleEntityNotFound(_0x57b525,null))[_0xae02('0x31')](respondWithResult(_0x57b525,null))[_0xae02('0x3c')](handleError(_0x57b525,null));};exports[_0xae02('0xb7')]=function(_0x5d8e59,_0x3514b8){return db[_0xae02('0x9a')]['create'](_0x5d8e59[_0xae02('0xb8')],{})[_0xae02('0x31')](respondWithResult(_0x3514b8,0xc9))[_0xae02('0x3c')](handleError(_0x3514b8,null));};exports[_0xae02('0x30')]=function(_0x102211,_0x171512){if(_0x102211['body']['id']){delete _0x102211['body']['id'];}return db['ChatInteraction'][_0xae02('0x66')]({'where':{'id':_0x102211[_0xae02('0xb9')]['id']}})['then'](handleEntityNotFound(_0x171512,null))[_0xae02('0x31')](saveUpdates(_0x102211[_0xae02('0xb8')],null))[_0xae02('0x31')](respondWithResult(_0x171512,null))[_0xae02('0x3c')](handleError(_0x171512,null));};exports[_0xae02('0xba')]=function(_0x2869cd,_0x5f1abf){return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x2869cd[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x5f1abf,null))['then'](removeEntity(_0x5f1abf,null))[_0xae02('0x3c')](handleError(_0x5f1abf,null));};exports[_0xae02('0xbb')]=function(_0x3aa598,_0x3b101d){return db[_0xae02('0x9a')][_0xae02('0xbb')]()[_0xae02('0x31')](respondWithResult(_0x3b101d,null))[_0xae02('0x3c')](handleError(_0x3b101d,null));};exports[_0xae02('0xbc')]=function(_0x4b5130,_0x2ae50e){var _0x97dd62=_0x4b5130[_0xae02('0xb9')]['id'];var _0x405dd9;var _0x55ebc1;var _0x1bc43b;return db[_0xae02('0x9a')][_0xae02('0xbd')]({'where':{'id':_0x97dd62}})[_0xae02('0x31')](function(_0xbe90f0){_0x405dd9=_0xbe90f0;return db['ChatWebsite'][_0xae02('0xbd')]({'where':{'id':_0xbe90f0[_0xae02('0x79')]},'attributes':['id',_0xae02('0xbe'),_0xae02('0xbf')],'raw':!![]});})[_0xae02('0x31')](function(_0x54740d){if(_0x54740d&&_0x54740d['vidaooApiKey']&&_0x54740d[_0xae02('0xbf')]){_0x55ebc1=_0x54740d;var _0x3c49b4={'rejectUnauthorized':![],'method':_0xae02('0xc0'),'uri':_0xae02('0xc1'),'headers':{'X-APIKEY':_0x54740d['vidaooApiKey']},'body':{'name':_0xae02('0xc2')+_0x97dd62},'redirect':'follow','json':!![]};return rp(_0x3c49b4);}else{throw new db[(_0xae02('0x8a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xae02('0x31')](function(_0x368ec3){_0x1bc43b=_0x368ec3;if(_0x1bc43b['id']){var _0x4e5922={'body':_0x1bc43b[_0xae02('0xc3')],'ChatWebsiteId':_0x55ebc1['id'],'ChatInteractionId':_0x405dd9['id'],'direction':'out','UserId':_0x4b5130[_0xae02('0x94')]['id']};return db[_0xae02('0xc4')][_0xae02('0xb7')](_0x4e5922,{});}else{throw new db[(_0xae02('0x8a'))][(_0xae02('0xc5'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x405dd9[_0xae02('0xc6')]({'vidaooSessionId':_0x1bc43b['id']});})['then'](respondWithResult(_0x2ae50e,null))[_0xae02('0x3c')](handleError(_0x2ae50e,null));};exports['customUpdate']=function(_0x1e0110,_0x1cf463){if(_0x1e0110[_0xae02('0xb8')]['id']){delete _0x1e0110[_0xae02('0xb8')]['id'];}return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x1e0110[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x1cf463,null))[_0xae02('0x31')](saveUpdates(_0x1e0110[_0xae02('0xb8')],null))[_0xae02('0x31')](respondWithResult(_0x1cf463,null))[_0xae02('0x3c')](handleError(_0x1cf463,null));};exports[_0xae02('0xc7')]=function(_0x1e7253,_0x4159c5,_0x100711){if(_0x1e7253[_0xae02('0xb8')]['id']){delete _0x1e7253[_0xae02('0xb8')]['id'];}return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x1e7253[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](function(_0x480587){if(!_0x480587){logger[_0xae02('0x22')](_0xae02('0xc8'),_0xae02('0xc7'),0x194,'entity\x20not\x20found');_0x4159c5[_0xae02('0x27')](0x194);}else{if(_0x480587[_0xae02('0x75')]){throw new db[(_0xae02('0x8a'))][(_0xae02('0xc5'))](_0xae02('0xc9'));}}return _0x480587;})[_0xae02('0x31')](function(_0x5f510e){if(_0x5f510e){return _0x5f510e[_0xae02('0x30')]({'closed':_0x1e7253[_0xae02('0xb8')][_0xae02('0xca')],'disposition':_0x1e7253[_0xae02('0xb8')][_0xae02('0xcb')]})['then'](function(_0xd8a3dd){return _0xd8a3dd;});}})[_0xae02('0x31')](function(_0x15c0c2){return respondWithRpcPromise(_0xae02('0xcc'),_0xae02('0xc7'),_0x1e7253['body'],client9004);})[_0xae02('0x31')](respondWithResult(_0x4159c5,null))['catch'](handleError(_0x4159c5,null));};exports['attachmentUpload']=function(_0x106a2c,_0x5cd8a3,_0xaeab78){_0x106a2c[_0xae02('0xb8')]['name']=_0x106a2c['file'][_0xae02('0xcd')];_0x106a2c['body'][_0xae02('0xce')]=_0x106a2c['file']['filename'];_0x106a2c[_0xae02('0xb8')]['type']=_0x106a2c['file'][_0xae02('0xcf')];return db[_0xae02('0xd0')][_0xae02('0xb7')](_0x106a2c[_0xae02('0xb8')])['then'](respondWithResult(_0x5cd8a3,0xc9))[_0xae02('0x3c')](handleError(_0x5cd8a3,null));};exports[_0xae02('0xd1')]=function(_0x5c906b,_0x372c5d,_0x2cc444){return db[_0xae02('0x9a')][_0xae02('0xbd')]({'where':{'id':_0x5c906b[_0xae02('0xb9')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x372c5d,null))[_0xae02('0x31')](function(_0x7b36b5){if(_0x7b36b5){if(_0x7b36b5[_0xae02('0xca')]){return _0x372c5d[_0xae02('0x28')](0x193)[_0xae02('0x2a')]({'status':0x193,'message':_0xae02('0xd2')});}return db['Attachment'][_0xae02('0xbd')]({'where':{'id':_0x5c906b[_0xae02('0x42')][_0xae02('0xd3')]},'raw':!![]})[_0xae02('0x31')](handleEntityNotFound(_0x372c5d,null));}})[_0xae02('0x31')](function(_0x432540){if(_0x432540){return _0x372c5d[_0xae02('0xd4')](path[_0xae02('0xd5')](config[_0xae02('0xd6')],_0xae02('0xd7'),_0x432540[_0xae02('0xce')]));}})[_0xae02('0x3c')](handleError(_0x372c5d,null));};exports['close']=function(_0x181eb6,_0x23ee54){var _0x49908b=null;var _0x91bb3b=null;var _0x2a1d58=null;var _0x7e10ca=null;if(_0x181eb6[_0xae02('0xb8')]['id']){delete _0x181eb6['body']['id'];}if(_0x181eb6[_0xae02('0xb8')]['mailTranscript']){_0x7e10ca=path[_0xae02('0xd5')](config[_0xae02('0xd6')],'server/files/chat/upload/',util[_0xae02('0xd8')]('transcript-%s.txt',Date[_0xae02('0xd9')]()));_0x181eb6[_0xae02('0xb8')][_0xae02('0xda')]=_0x7e10ca;}return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x181eb6['params']['id']},'include':[{'model':db[_0xae02('0xc4')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x23ee54,null))[_0xae02('0x31')](saveUpdates(_0x181eb6[_0xae02('0xb8')],null))[_0xae02('0x31')](function(_0x5440c9){if(_0x5440c9){_0x49908b=_0x5440c9;return db[_0xae02('0xdb')][_0xae02('0x66')]({'where':{'id':_0x49908b[_0xae02('0x79')]}});}})[_0xae02('0x31')](function(_0x10d772){if(_0x10d772){_0x2a1d58=_0x10d772;return db[_0xae02('0xdc')][_0xae02('0x66')]({'where':{'id':_0x49908b[_0xae02('0x6d')]}});}})[_0xae02('0x31')](function(_0x5101dd){if(_0x5101dd){_0x91bb3b=_0x5101dd;if(_0x7e10ca){var _0x18e4ea=null;for(var _0x3fa25d=0x1;_0x3fa25d<_0x49908b['Messages'][_0xae02('0x47')];++_0x3fa25d){_0x18e4ea=_0x49908b['Messages'][_0x3fa25d];var _0x361f50=_0x18e4ea[_0xae02('0x75')]?util[_0xae02('0xd8')]('%s%d',_0x2a1d58['agentAlias'],_0x18e4ea[_0xae02('0x75')]):'System';var _0x20d448=_0x181eb6[_0xae02('0xb8')][_0xae02('0xdd')]||util[_0xae02('0xd8')]('%s%d',_0xae02('0xde'),_0x18e4ea['ContactId']);switch(_0x2a1d58[_0xae02('0xdf')]){case _0xae02('0xe0'):_0x361f50=_0x18e4ea[_0xae02('0x75')]?util[_0xae02('0xd8')](_0xae02('0xe1'),_0x2a1d58[_0xae02('0xe2')],_0x18e4ea[_0xae02('0x75')]):_0xae02('0xe3');break;case _0xae02('0xe4'):_0x361f50=_0x18e4ea['UserId']?_0x18e4ea['User'][_0xae02('0xe5')]||_0x18e4ea['User'][_0xae02('0x37')]:'System';break;case _0xae02('0xe6'):_0x361f50=_0x18e4ea[_0xae02('0x75')]?_0x18e4ea['User'][_0xae02('0x37')]:_0xae02('0xe3');break;default:_0x361f50=_0x18e4ea[_0xae02('0x75')]?util[_0xae02('0xd8')](_0xae02('0xe1'),_0x2a1d58[_0xae02('0xe2')],_0x18e4ea['UserId']):_0xae02('0xe3');}var _0x1b53c8=util[_0xae02('0xd8')](_0xae02('0xe7'),moment(_0x18e4ea[_0xae02('0x7b')])['format'](_0xae02('0xe8')),_0x18e4ea[_0xae02('0xe9')]==='in'?_0x20d448:_0x361f50,_0x18e4ea[_0xae02('0xb8')]);if(!_0x18e4ea['secret']){fs['appendFileSync'](_0x7e10ca,_0x1b53c8);}}return db['MailAccount'][_0xae02('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0xae02('0xea')],'as':_0xae02('0xeb'),'raw':!![]}]});}}})['then'](function(_0x5d17d5){if(_0x5d17d5&&_0x5d17d5[_0xae02('0xeb')]&&_0x181eb6[_0xae02('0xb8')]){var _0xe675bd={'tls':{'rejectUnauthorized':![]}};if(_0x5d17d5[_0xae02('0xeb')][_0xae02('0xec')]){_0xe675bd[_0xae02('0xec')]=_0x5d17d5[_0xae02('0xeb')][_0xae02('0xec')];}else{_0xe675bd[_0xae02('0xed')]=_0x5d17d5['Smtp'][_0xae02('0xed')];_0xe675bd['port']=_0x5d17d5[_0xae02('0xeb')][_0xae02('0xee')];_0xe675bd[_0xae02('0xef')]=_0x5d17d5[_0xae02('0xeb')][_0xae02('0xef')];}if(_0x5d17d5[_0xae02('0xeb')]['authentication']){_0xe675bd[_0xae02('0xf0')]={'user':_0x5d17d5['Smtp']['user'],'pass':_0x5d17d5['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xae02('0xf1'),{'account':_0xe675bd,'message':{'from':util[_0xae02('0xd8')](_0xae02('0xf2'),_0x5d17d5['name'],_0x5d17d5[_0xae02('0xf3')]||_0x5d17d5[_0xae02('0xeb')][_0xae02('0x94')]),'to':_0x181eb6['body'][_0xae02('0xf4')],'subject':'Mail\x20Transcript','text':util[_0xae02('0xd8')](_0xae02('0xf5'),_0x181eb6['body'][_0xae02('0xf4')]),'attachments':[{'path':_0x7e10ca}]}})[_0xae02('0x31')](function(){return _0x49908b;})['catch'](function(_0x4549f9){console[_0xae02('0x22')](_0x4549f9);});}else{return _0x49908b;}})[_0xae02('0x31')](respondWithStatusCode(_0x23ee54,0xc8))['catch'](handleError(_0x23ee54,null));};exports[_0xae02('0xf6')]=function(_0x45f878,_0x1a8700,_0xeb137c){return db[_0xae02('0xc4')][_0xae02('0x66')]({'where':{'id':_0x45f878[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x1a8700,null))['then'](function(_0x549864){if(_0x549864){return _0x549864[_0xae02('0xf6')](_0x45f878[_0xae02('0xb8')][_0xae02('0xf7')],_[_0xae02('0xf8')](_0x45f878[_0xae02('0xb8')],[_0xae02('0xf7'),'id'])||{});}})[_0xae02('0x31')](respondWithResult(_0x1a8700,null))[_0xae02('0x3c')](handleError(_0x1a8700,null));};exports[_0xae02('0xf9')]=function(_0x2e2a0e,_0x46046b,_0x1e150f){var _0x1fa4fd={'raw':![],'where':{}};var _0x5b810e={};var _0x5a4277={'count':0x0,'rows':[]};return db[_0xae02('0x9a')]['findOne']({'where':{'id':_0x2e2a0e[_0xae02('0xb9')]['id']}})['then'](handleEntityNotFound(_0x46046b,null))[_0xae02('0x31')](function(_0x30ebe8){if(_0x30ebe8){_0x5b810e[_0xae02('0x41')]=_[_0xae02('0x43')](db['ChatMessage'][_0xae02('0x3d')]);_0x5b810e[_0xae02('0x42')]=_['keys'](_0x2e2a0e['query']);_0x5b810e['filters']=_[_0xae02('0xb4')](_0x5b810e[_0xae02('0x41')],_0x5b810e['query']);_0x1fa4fd['attributes']=_[_0xae02('0xb4')](_0x5b810e[_0xae02('0x41')],qs['fields'](_0x2e2a0e[_0xae02('0x42')][_0xae02('0x46')]));_0x1fa4fd[_0xae02('0x45')]=_0x1fa4fd['attributes']['length']?_0x1fa4fd[_0xae02('0x45')]:_0x5b810e[_0xae02('0x41')];if(!_0x2e2a0e['query'][_0xae02('0x48')](_0xae02('0x49'))){_0x1fa4fd[_0xae02('0x4a')]=qs[_0xae02('0x4a')](_0x2e2a0e['query'][_0xae02('0x4a')]);_0x1fa4fd[_0xae02('0x2c')]=qs[_0xae02('0x2c')](_0x2e2a0e['query'][_0xae02('0x2c')]);}_0x1fa4fd[_0xae02('0x4b')]=qs['sort'](_0x2e2a0e[_0xae02('0x42')][_0xae02('0x4c')]);_0x1fa4fd[_0xae02('0x4d')]=qs[_0xae02('0x44')](_[_0xae02('0x4e')](_0x2e2a0e[_0xae02('0x42')],_0x5b810e[_0xae02('0x44')]));_0x1fa4fd[_0xae02('0x4d')]['ChatInteractionId']=_0x30ebe8['id'];if(_0x2e2a0e[_0xae02('0x42')][_0xae02('0x85')]){_0x1fa4fd['where']=_[_0xae02('0x99')](_0x1fa4fd[_0xae02('0x4d')],{'$or':_[_0xae02('0x36')](_0x1fa4fd[_0xae02('0x45')],function(_0x1b85c5){var _0x22e461={};_0x22e461[_0x1b85c5]={'$like':'%'+_0x2e2a0e[_0xae02('0x42')]['filter']+'%'};return _0x22e461;})});}if(_0x2e2a0e[_0xae02('0x42')][_0xae02('0x7d')]){var _0x1309e2=_0x2e2a0e[_0xae02('0x42')][_0xae02('0x7d')][_0xae02('0x3a')](',');var _0x7ed84f={};_0x7ed84f[_0x1309e2[0x0]]={'$gte':moment(_0x1309e2[0x1])['format'](_0xae02('0xfa'))};_0x1fa4fd[_0xae02('0x4d')]=_[_0xae02('0x99')](_0x1fa4fd['where'],_0x7ed84f);}_0x1fa4fd=_['merge']({},_0x1fa4fd,_0x2e2a0e[_0xae02('0xfb')]);return db[_0xae02('0xc4')]['count']({'where':_0x1fa4fd[_0xae02('0x4d')]})[_0xae02('0x31')](function(_0x2c2efd){_0x5a4277[_0xae02('0x2b')]=_0x2c2efd;if(_0x2e2a0e[_0xae02('0x42')]['includeAll']){_0x1fa4fd[_0xae02('0xb6')]=[{'all':!![]}];}return db[_0xae02('0xc4')][_0xae02('0xfc')](_0x1fa4fd);})[_0xae02('0x31')](function(_0x44380f){_0x5a4277[_0xae02('0xfd')]=_0x44380f;return _0x5a4277;});}})[_0xae02('0x31')](respondWithFilteredResult(_0x46046b,_0x1fa4fd))[_0xae02('0x3c')](handleError(_0x46046b,null));};exports['getMyMessages']=function(_0x2dcafd,_0x6a3810,_0x4d4ffc){var _0x3f5881={'where':{}},_0x546517={},_0x25fae3={'count':0x0,'rows':[]};return db[_0xae02('0x9a')][_0xae02('0xbd')]({'where':{'id':_0x2dcafd[_0xae02('0xb9')]['id']}})['then'](handleEntityNotFound(_0x6a3810,null))['then'](function(_0x1a265c){if(_0x1a265c){_0x546517[_0xae02('0x41')]=_['keys'](db['ChatMessage'][_0xae02('0x3d')]);_0x546517[_0xae02('0x42')]=_['keys'](_0x2dcafd['query']);_0x546517[_0xae02('0x44')]=_[_0xae02('0xb4')](_0x546517[_0xae02('0x41')],_0x546517['query']);_0x3f5881[_0xae02('0x45')]=_[_0xae02('0xb4')](_0x546517[_0xae02('0x41')],qs[_0xae02('0x46')](_0x2dcafd['query'][_0xae02('0x46')]));_0x3f5881['attributes']=_0x3f5881[_0xae02('0x45')][_0xae02('0x47')]?_0x3f5881['attributes']:_0x546517[_0xae02('0x41')];if(!_0x2dcafd[_0xae02('0x42')][_0xae02('0x48')]('nolimit')){_0x3f5881['limit']=qs[_0xae02('0x4a')](_0x2dcafd[_0xae02('0x42')]['limit']);_0x3f5881['offset']=qs[_0xae02('0x2c')](_0x2dcafd[_0xae02('0x42')][_0xae02('0x2c')]);}_0x3f5881[_0xae02('0x4b')]=qs[_0xae02('0x4c')](_0x2dcafd['query'][_0xae02('0x4c')]);_0x3f5881[_0xae02('0x4d')]=qs['filters'](_['pick'](_0x2dcafd[_0xae02('0x42')],_0x546517[_0xae02('0x44')]));_0x3f5881[_0xae02('0x4d')]['ChatInteractionId']=_0x1a265c['id'];if(_0x2dcafd[_0xae02('0x42')][_0xae02('0x85')]){_0x3f5881[_0xae02('0x4d')]=_[_0xae02('0x99')](_0x3f5881[_0xae02('0x4d')],{'$or':_[_0xae02('0x36')](_0x3f5881[_0xae02('0x45')],function(_0x392885){var _0xfe939={};_0xfe939[_0x392885]={'$like':'%'+_0x2dcafd['query'][_0xae02('0x85')]+'%'};return _0xfe939;})});}_0x3f5881[_0xae02('0x4d')][_0xae02('0xfe')]=![];if(_0x2dcafd[_0xae02('0x42')]['id']){_0x3f5881[_0xae02('0x4d')]['id']={'$gt':_0x2dcafd[_0xae02('0x42')]['id']};}_0x3f5881=_[_0xae02('0x99')]({},_0x3f5881,_0x2dcafd[_0xae02('0xfb')]);return db['ChatMessage']['count']({'where':_0x3f5881['where']})[_0xae02('0x31')](function(_0x2a29dc){_0x25fae3[_0xae02('0x2b')]=_0x2a29dc;_0x3f5881[_0xae02('0xb6')]=[];if(_0x2dcafd[_0xae02('0x42')][_0xae02('0xff')]){_0x3f5881['include'][_0xae02('0x3b')]({'model':db[_0xae02('0x72')],'as':'User','attributes':['id',_0xae02('0x37'),_0xae02('0xe5')]});}if(_0x2dcafd[_0xae02('0x42')][_0xae02('0xb5')]){_0x3f5881[_0xae02('0xb6')]=[{'all':!![]}];}return db[_0xae02('0xc4')][_0xae02('0xfc')](_0x3f5881);})[_0xae02('0x31')](function(_0x51964b){_0x25fae3[_0xae02('0xfd')]=_0x51964b;return _0x25fae3;});}})['then'](respondWithFilteredResult(_0x6a3810,_0x3f5881))[_0xae02('0x3c')](handleError(_0x6a3810,null));};exports[_0xae02('0x100')]=function(_0x1d574b,_0x19c411,_0x42b3cd){return db[_0xae02('0x9a')]['find']({'where':{'id':_0x1d574b[_0xae02('0xb9')]['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x19c411,null))[_0xae02('0x31')](function(_0x2c0295){if(_0x2c0295){return _0x2c0295[_0xae02('0x101')](_0x1d574b['body']['ids'],_['omit'](_0x1d574b[_0xae02('0xb8')],[_0xae02('0xf7'),'id'])||{})[_0xae02('0x102')](function(){return db['Tag'][_0xae02('0xfc')]({'attributes':['id','name','color'],'where':{'id':_0x1d574b[_0xae02('0xb8')][_0xae02('0xf7')]}});})[_0xae02('0x31')](function(_0x49882d){socket[_0xae02('0x103')](_0xae02('0x104'),{'id':Number(_0x1d574b[_0xae02('0xb9')]['id']),'tags':_0x49882d||[]});return{'id':Number(_0x1d574b['params']['id']),'tags':_0x49882d||[]};});}})['then'](respondWithResult(_0x19c411,null))[_0xae02('0x3c')](handleError(_0x19c411,null));};exports[_0xae02('0x105')]=function(_0x460e0c,_0x48914b,_0x10c4d9){return db[_0xae02('0x9a')]['find']({'where':{'id':_0x460e0c['params']['id']}})[_0xae02('0x31')](handleEntityNotFound(_0x48914b,null))['then'](function(_0x7dab61){if(_0x7dab61){return _0x7dab61[_0xae02('0x105')](_0x460e0c[_0xae02('0x42')][_0xae02('0xf7')]);}})['then'](respondWithStatusCode(_0x48914b,null))['catch'](handleError(_0x48914b,null));};exports[_0xae02('0xd4')]=function(_0x33dd95,_0x188f0f){var _0x5b5cde=moment()[_0xae02('0x106')]()[_0xae02('0x97')]();var _0x10f384=path['join'](config['root'],_0xae02('0x107'),_0xae02('0x108'),_0xae02('0x109'));var _0x295f0d=path['join'](config[_0xae02('0xd6')],_0xae02('0x107'),_0xae02('0x108'),_0xae02('0x10a'));var _0x44cca2=path[_0xae02('0xd5')](_0x10f384,_0x5b5cde);var _0x7645ac=util[_0xae02('0xd8')]('transcript-%d-%s.zip',_0x33dd95[_0xae02('0xb9')]['id'],_0x5b5cde);var _0x192ed4=path[_0xae02('0xd5')](_0x10f384,_0x7645ac);var _0x3908c5=[];_0x3908c5[_0xae02('0x3b')]({'model':db[_0xae02('0x72')],'as':_0xae02('0x72'),'attributes':['id',_0xae02('0x37')],'raw':!![]});_0x3908c5[_0xae02('0x3b')]({'model':db[_0xae02('0xdc')],'as':_0xae02('0x10b'),'attributes':['id',_0xae02('0x10c'),_0xae02('0x10d')],'raw':!![]});if(_0x33dd95['query'][_0xae02('0x10a')]){_0x3908c5[_0xae02('0x3b')]({'model':db[_0xae02('0xd0')],'as':_0xae02('0xd0'),'raw':!![]});}var _0x52a89c=[{'model':db[_0xae02('0xc4')],'as':_0xae02('0x10e'),'attributes':['id',_0xae02('0xb8'),_0xae02('0x7b'),_0xae02('0xe9'),_0xae02('0xfe'),_0xae02('0x82')],'include':_0x3908c5}];_0x52a89c[_0xae02('0x3b')]({'model':db[_0xae02('0xdb')],'as':_0xae02('0x10f'),'attributes':['id',_0xae02('0x33')]});_0x52a89c[_0xae02('0x3b')]({'model':db[_0xae02('0x72')],'as':_0xae02('0x110'),'attributes':['id','fullname']});return db[_0xae02('0x9a')][_0xae02('0x66')]({'where':{'id':_0x33dd95[_0xae02('0xb9')]['id']},'include':_0x52a89c})[_0xae02('0x31')](handleEntityNotFound(_0x188f0f,null))['then'](function(_0x54ba29){if(_0x54ba29){var _0xd0c567=_0x54ba29['get']({'plain':!![]});fs[_0xae02('0x111')](_0x44cca2);var _0x114e2b={'format':'A4','border':'10px','header':{'height':_0xae02('0x112'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xae02('0x113'),'contents':{'default':util[_0xae02('0xd8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xae02('0xd8')](_0xae02('0x114'),'Chat',_0xd0c567['id']),moment()[_0xae02('0xd8')](_0xae02('0x115'))[_0xae02('0x97')]())}}};var _0x5a47a5={'channel':_0xae02('0x116'),'account':_0xd0c567[_0xae02('0x10f')][_0xae02('0x33')],'agent':_0xd0c567[_0xae02('0x110')]?_0xd0c567['Owner'][_0xae02('0x37')]:_0xae02('0x117'),'createdAt':moment(_0xd0c567[_0xae02('0x7b')])['format'](_0xae02('0xfa'))['toString'](),'closedAt':_0xd0c567[_0xae02('0xca')]?moment(_0xd0c567['closedAt'])[_0xae02('0xd8')](_0xae02('0xfa'))['toString']():'','disposition':_0xd0c567['disposition'],'chatInfo':{'browser':_0xd0c567[_0xae02('0x118')],'os':_0xd0c567[_0xae02('0x119')],'referer':_0xd0c567[_0xae02('0x11a')],'customerIp':_0xd0c567[_0xae02('0x11b')],'customerPort':_0xd0c567[_0xae02('0x11c')]?_0xd0c567[_0xae02('0x11c')]:_0xae02('0x117')},'messages':_(_0xd0c567[_0xae02('0x10e')])[_0xae02('0x11d')]()['filter']({'secret':![]})[_0xae02('0x36')](function(_0x47e543){if(_0x47e543['Attachment']){var _0x1338c3=path[_0xae02('0xd5')](_0x295f0d,_0x47e543['Attachment'][_0xae02('0xce')]);if(fs['existsSync'](_0x1338c3)){fs[_0xae02('0x11e')](_0x1338c3)[_0xae02('0x11f')](fs[_0xae02('0x120')](path['join'](_0x44cca2,_0x47e543[_0xae02('0xd0')][_0xae02('0xce')])));}}return{'date':moment(_0x47e543[_0xae02('0x7b')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x47e543[_0xae02('0xe9')]===_0xae02('0x121')?_0x47e543[_0xae02('0x72')]?_0x47e543['User']['fullname']:_0xae02('0xe3'):_0x47e543[_0xae02('0x10b')][_0xae02('0x10c')]+(_0x47e543['Contact'][_0xae02('0x10d')]?'\x20'+_0x47e543[_0xae02('0x10b')]['lastName']:''),'body':_0x47e543['Attachment']?_0x47e543[_0xae02('0xd0')]['basename']:_0x47e543[_0xae02('0xb8')],'direction':_0x47e543[_0xae02('0xe9')]===_0xae02('0x121')?'A':'C','secret':_0x47e543[_0xae02('0xfe')],'read':_0x47e543[_0xae02('0x82')],'attachment':_0x47e543[_0xae02('0xd0')]};})[_0xae02('0x67')]()};return ejs['renderFile'](path[_0xae02('0xd5')](config[_0xae02('0xd6')],'server',_0xae02('0x122'),_0xae02('0x123')),{'interaction':_0x5a47a5})['then'](function(_0x4ef68c){return new BPromise(function(_0x520861,_0x195c18){pdf[_0xae02('0xb7')](_0x4ef68c,_0x114e2b)['toFile'](path[_0xae02('0xd5')](_0x44cca2,'transcript-'+_0xd0c567['id']+'-'+_0x5b5cde+'.pdf'),function(_0x4e7a3d,_0x7bde6c){if(_0x4e7a3d)return _0x195c18(_0x4e7a3d);_0x520861(_0x7bde6c);});});})[_0xae02('0x31')](function(){return new BPromise(function(_0x5d0821,_0x52c5ac){zipdir(_0x44cca2,{'saveTo':_0x192ed4},function(_0x26aec9,_0x561cde){if(_0x26aec9)return _0x52c5ac(_0x26aec9);return _0x5d0821(_0x561cde);});})[_0xae02('0x31')](function(){return new BPromise(function(_0x5b5c33,_0x4b6e8b){rimraf(_0x44cca2,function(_0x5446f5){if(_0x5446f5)_0x4b6e8b(_0x5446f5);return _0x5b5c33();});});})[_0xae02('0x31')](function(){return _0x188f0f[_0xae02('0xd4')](_0x192ed4,_0x7645ac,function(_0x3eb5ca){if(_0x3eb5ca){console[_0xae02('0x124')](_0xae02('0x125'),_0x3eb5ca);}else{fs['unlinkSync'](_0x192ed4);}});});});}else{return _0x188f0f[_0xae02('0x27')](0xc8);}})['catch'](handleError(_0x188f0f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c14c58c..9ab4565 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 _0xfbdd=['unreadMessages','length','emit','catch','hook','events','ChatInteraction','../../mysqldb','ChatMessage','update','remove','getUsers','then','setDataValue','Users'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0xfbdd,0x17c));var _0xdfbd=function(_0x4d9a30,_0x3ea99e){_0x4d9a30=_0x4d9a30-0x0;var _0x23bb25=_0xfbdd[_0x4d9a30];return _0x23bb25;};'use strict';var EventEmitter=require(_0xdfbd('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xdfbd('0x1')];var ChatMessage=require(_0xdfbd('0x2'))['db'][_0xdfbd('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfbd('0x4'),'afterDestroy':_0xdfbd('0x5')};function emitEvent(_0x4237f8){return function(_0x410525,_0x50829e,_0x23fdb9){_0x410525[_0xdfbd('0x6')]({'attributes':['id'],'raw':!![]})[_0xdfbd('0x7')](function(_0x53e52f){_0x410525[_0xdfbd('0x8')](_0xdfbd('0x9'),_0x53e52f['map'](function(_0x3b40c4){return{'id':_0x3b40c4['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x410525['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdfbd('0x7')](function(_0x2417f0){_0x410525[_0xdfbd('0x8')](_0xdfbd('0xa'),_0x2417f0[_0xdfbd('0xb')]);ChatInteractionEvents[_0xdfbd('0xc')](_0x4237f8+':'+_0x410525['id'],_0x410525);ChatInteractionEvents[_0xdfbd('0xc')](_0x4237f8,_0x410525);_0x23fdb9(null);})[_0xdfbd('0xd')](_0x23fdb9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xdfbd('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xa2f9=['map','length','emit','catch','hook','exports','events','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x275a1f,_0x37cb10){var _0x163516=function(_0x2ea5c1){while(--_0x2ea5c1){_0x275a1f['push'](_0x275a1f['shift']());}};_0x163516(++_0x37cb10);}(_0xa2f9,0x132));var _0x9a2f=function(_0xe6fedd,_0x3c1278){_0xe6fedd=_0xe6fedd-0x0;var _0x3a6beb=_0xa2f9[_0xe6fedd];return _0x3a6beb;};'use strict';var EventEmitter=require(_0x9a2f('0x0'));var ChatInteraction=require(_0x9a2f('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x9a2f('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a2f('0x2'),'afterUpdate':_0x9a2f('0x3'),'afterDestroy':_0x9a2f('0x4')};function emitEvent(_0x2696e5){return function(_0x2745dd,_0x3da575,_0x45d24a){_0x2745dd[_0x9a2f('0x5')]({'attributes':['id'],'raw':!![]})[_0x9a2f('0x6')](function(_0x291609){_0x2745dd[_0x9a2f('0x7')](_0x9a2f('0x8'),_0x291609[_0x9a2f('0x9')](function(_0x2db83b){return{'id':_0x2db83b['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2745dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a2f('0x6')](function(_0x496d13){_0x2745dd[_0x9a2f('0x7')]('unreadMessages',_0x496d13[_0x9a2f('0xa')]);ChatInteractionEvents[_0x9a2f('0xb')](_0x2696e5+':'+_0x2745dd['id'],_0x2745dd);ChatInteractionEvents[_0x9a2f('0xb')](_0x2696e5,_0x2745dd);_0x45d24a(null);})[_0x9a2f('0xc')](_0x45d24a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x9a2f('0xd')](e,emitEvent(event));}}module[_0x9a2f('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d68416a..99febec 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 _0x4459=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x4459,0x1b7));var _0x9445=function(_0x5d823b,_0x5ec5f2){_0x5d823b=_0x5d823b-0x0;var _0x940f48=_0x4459[_0x5d823b];return _0x940f48;};'use strict';var _=require(_0x9445('0x0'));var util=require('util');var logger=require(_0x9445('0x1'))(_0x9445('0x2'));var moment=require(_0x9445('0x3'));var BPromise=require(_0x9445('0x4'));var rp=require(_0x9445('0x5'));var fs=require('fs');var path=require(_0x9445('0x6'));var rimraf=require(_0x9445('0x7'));var config=require(_0x9445('0x8'));var attributes=require(_0x9445('0x9'));module[_0x9445('0xa')]=function(_0x567bcd,_0x20d250){return _0x567bcd[_0x9445('0xb')](_0x9445('0xc'),attributes,{'tableName':_0x9445('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a001d,_0x5a1e85,_0x22b3eb){if(_0x3a001d[_0x9445('0xe')](_0x9445('0xf'))){_0x3a001d[_0x9445('0x10')]=moment()[_0x9445('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x22b3eb(null,_0x3a001d);}},'charset':_0x9445('0x12'),'collate':_0x9445('0x13')});}; \ No newline at end of file +var _0xf66b=['path','../../config/environment','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ebcbc,_0x3372b5){var _0x101372=function(_0x39411f){while(--_0x39411f){_0x1ebcbc['push'](_0x1ebcbc['shift']());}};_0x101372(++_0x3372b5);}(_0xf66b,0x162));var _0xbf66=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xf66b[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xbf66('0x0'));var util=require('util');var logger=require(_0xbf66('0x1'))(_0xbf66('0x2'));var moment=require(_0xbf66('0x3'));var BPromise=require(_0xbf66('0x4'));var rp=require(_0xbf66('0x5'));var fs=require('fs');var path=require(_0xbf66('0x6'));var rimraf=require('rimraf');var config=require(_0xbf66('0x7'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x2ea072,_0x1ffcb6){return _0x2ea072['define'](_0xbf66('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51e1c1,_0x499c74,_0x116439){if(_0x51e1c1[_0xbf66('0x9')]('closed')){_0x51e1c1[_0xbf66('0xa')]=moment()[_0xbf66('0xb')](_0xbf66('0xc'));}_0x116439(null,_0x51e1c1);}},'charset':_0xbf66('0xd'),'collate':_0xbf66('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 977668b..310e035 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 _0xa4fd=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','spread','debug','AddTags','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xa4fd,0x75));var _0xda4f=function(_0x3069f9,_0x25c8ad){_0x3069f9=_0x3069f9-0x0;var _0x324e73=_0xa4fd[_0x3069f9];return _0x324e73;};'use strict';var _=require(_0xda4f('0x0'));var util=require(_0xda4f('0x1'));var moment=require(_0xda4f('0x2'));var BPromise=require(_0xda4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda4f('0x5'))('rpc');var config=require(_0xda4f('0x6'));var jayson=require(_0xda4f('0x7'));var client=jayson[_0xda4f('0x8')][_0xda4f('0x9')]({'port':0x232a});config[_0xda4f('0xa')]=_[_0xda4f('0xb')](config[_0xda4f('0xa')],{'host':_0xda4f('0xc'),'port':0x18eb});var socket=require(_0xda4f('0xd'))(new Redis(config[_0xda4f('0xa')]));require('./chatInteraction.socket')[_0xda4f('0xe')](socket);function respondWithRpcPromise(_0x182310,_0x539066,_0x438c09){return new BPromise(function(_0x4224e2,_0x582f5d){return client[_0xda4f('0xf')](_0x182310,_0x438c09)[_0xda4f('0x10')](function(_0x2002b5){logger[_0xda4f('0x11')](_0xda4f('0x12'),_0x539066,_0xda4f('0x13'));logger['debug'](_0xda4f('0x14'),_0x539066,_0xda4f('0x13'),JSON['stringify'](_0x2002b5));if(_0x2002b5[_0xda4f('0x15')]){if(_0x2002b5[_0xda4f('0x15')][_0xda4f('0x16')]===0x1f4){logger[_0xda4f('0x15')](_0xda4f('0x12'),_0x539066,_0x2002b5['error'][_0xda4f('0x17')]);return _0x582f5d(_0x2002b5[_0xda4f('0x15')]['message']);}logger[_0xda4f('0x15')](_0xda4f('0x12'),_0x539066,_0x2002b5['error'][_0xda4f('0x17')]);return _0x4224e2(_0x2002b5[_0xda4f('0x15')][_0xda4f('0x17')]);}else{logger[_0xda4f('0x11')](_0xda4f('0x12'),_0x539066,_0xda4f('0x13'));_0x4224e2(_0x2002b5[_0xda4f('0x18')][_0xda4f('0x17')]);}})['catch'](function(_0x4515d2){logger[_0xda4f('0x15')](_0xda4f('0x12'),_0x539066,_0x4515d2);_0x582f5d(_0x4515d2);});});}exports[_0xda4f('0x19')]=function(_0x4b022c){var _0x262677=this;return new Promise(function(_0x473de0,_0x1a5caf){return db[_0xda4f('0x1a')][_0xda4f('0x1b')](_0x4b022c[_0xda4f('0x1c')],{'raw':_0x4b022c['options']?_0x4b022c[_0xda4f('0x1d')][_0xda4f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b022c[_0xda4f('0x1d')]?_0x4b022c['options'][_0xda4f('0x1f')]||null:null,'attributes':_0x4b022c['options']?_0x4b022c['options']['attributes']||null:null,'limit':_0x4b022c[_0xda4f('0x1d')]?_0x4b022c[_0xda4f('0x1d')][_0xda4f('0x20')]||null:null})[_0xda4f('0x10')](function(_0x2747af){logger[_0xda4f('0x11')](_0xda4f('0x19'),_0x4b022c);logger['debug'](_0xda4f('0x19'),_0x4b022c,JSON[_0xda4f('0x21')](_0x2747af));_0x473de0(_0x2747af);})['catch'](function(_0x5d73c5){logger[_0xda4f('0x15')](_0xda4f('0x19'),_0x5d73c5[_0xda4f('0x17')],_0x4b022c);_0x1a5caf(_0x262677[_0xda4f('0x15')](0x1f4,_0x5d73c5[_0xda4f('0x17')]));});});};exports[_0xda4f('0x22')]=function(_0x5a6158){return new Promise(function(_0xbbdc2a,_0x4e4f82){return db[_0xda4f('0x1a')][_0xda4f('0x23')]({'where':_0x5a6158['options']?_0x5a6158[_0xda4f('0x1d')]['where']||null:null})[_0xda4f('0x10')](function(_0xcbe272){if(_0xcbe272){return _0xcbe272[_0xda4f('0x24')](_0x5a6158['body'][_0xda4f('0x25')],_['omit'](_0x5a6158[_0xda4f('0x1c')],['ids','id'])||{});}})[_0xda4f('0x26')](function(_0x35e9e5){logger['info']('AddTags',_0x5a6158);logger[_0xda4f('0x27')](_0xda4f('0x28'),_0x5a6158,JSON[_0xda4f('0x21')](_0x35e9e5));_0xbbdc2a(_0x35e9e5);})[_0xda4f('0x29')](function(_0x16075e){logger[_0xda4f('0x15')](_0xda4f('0x28'),_0x16075e['message'],_0x5a6158);_0x4e4f82(_this[_0xda4f('0x15')](0x1f4,_0x16075e[_0xda4f('0x17')]));});});}; \ No newline at end of file +var _0x6799=['message','result','catch','options','attributes','limit','UpdateChatInteraction','stringify','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6799,0x1bb));var _0x9679=function(_0x27d9a7,_0x3ea47d){_0x27d9a7=_0x27d9a7-0x0;var _0x21c1fb=_0x6799[_0x27d9a7];return _0x21c1fb;};'use strict';var _=require(_0x9679('0x0'));var util=require(_0x9679('0x1'));var moment=require(_0x9679('0x2'));var BPromise=require(_0x9679('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9679('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9679('0x5'));var jayson=require(_0x9679('0x6'));var client=jayson[_0x9679('0x7')][_0x9679('0x8')]({'port':0x232a});config[_0x9679('0x9')]=_['defaults'](config[_0x9679('0x9')],{'host':_0x9679('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9679('0x9')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xa58b69,_0x42502e,_0x56fdd0){return new BPromise(function(_0x1296ce,_0x53ff24){return client[_0x9679('0xb')](_0xa58b69,_0x56fdd0)[_0x9679('0xc')](function(_0x5cbc0e){logger[_0x9679('0xd')](_0x9679('0xe'),_0x42502e,_0x9679('0xf'));logger[_0x9679('0x10')](_0x9679('0x11'),_0x42502e,_0x9679('0xf'),JSON['stringify'](_0x5cbc0e));if(_0x5cbc0e[_0x9679('0x12')]){if(_0x5cbc0e[_0x9679('0x12')]['code']===0x1f4){logger[_0x9679('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x42502e,_0x5cbc0e['error']['message']);return _0x53ff24(_0x5cbc0e[_0x9679('0x12')][_0x9679('0x13')]);}logger[_0x9679('0x12')](_0x9679('0xe'),_0x42502e,_0x5cbc0e[_0x9679('0x12')][_0x9679('0x13')]);return _0x1296ce(_0x5cbc0e['error'][_0x9679('0x13')]);}else{logger[_0x9679('0xd')](_0x9679('0xe'),_0x42502e,_0x9679('0xf'));_0x1296ce(_0x5cbc0e[_0x9679('0x14')][_0x9679('0x13')]);}})[_0x9679('0x15')](function(_0x292213){logger['error'](_0x9679('0xe'),_0x42502e,_0x292213);_0x53ff24(_0x292213);});});}exports['UpdateChatInteraction']=function(_0x13853b){var _0x18ebcd=this;return new Promise(function(_0x5947ab,_0x4f92e7){return db['ChatInteraction']['update'](_0x13853b['body'],{'raw':_0x13853b['options']?_0x13853b[_0x9679('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13853b['options']?_0x13853b[_0x9679('0x16')]['where']||null:null,'attributes':_0x13853b[_0x9679('0x16')]?_0x13853b['options'][_0x9679('0x17')]||null:null,'limit':_0x13853b['options']?_0x13853b['options'][_0x9679('0x18')]||null:null})['then'](function(_0x48e5d1){logger[_0x9679('0xd')](_0x9679('0x19'),_0x13853b);logger[_0x9679('0x10')](_0x9679('0x19'),_0x13853b,JSON[_0x9679('0x1a')](_0x48e5d1));_0x5947ab(_0x48e5d1);})[_0x9679('0x15')](function(_0x52739a){logger[_0x9679('0x12')](_0x9679('0x19'),_0x52739a[_0x9679('0x13')],_0x13853b);_0x4f92e7(_0x18ebcd[_0x9679('0x12')](0x1f4,_0x52739a[_0x9679('0x13')]));});});};exports['AddTagsToChatInteraction']=function(_0x316fa0){return new Promise(function(_0x33d246,_0x32c7fb){return db['ChatInteraction'][_0x9679('0x1b')]({'where':_0x316fa0[_0x9679('0x16')]?_0x316fa0[_0x9679('0x16')][_0x9679('0x1c')]||null:null})[_0x9679('0xc')](function(_0x4f30e9){if(_0x4f30e9){return _0x4f30e9[_0x9679('0x1d')](_0x316fa0['body'][_0x9679('0x1e')],_['omit'](_0x316fa0['body'],[_0x9679('0x1e'),'id'])||{});}})[_0x9679('0x1f')](function(_0x41a8a3){logger['info']('AddTags',_0x316fa0);logger[_0x9679('0x10')](_0x9679('0x20'),_0x316fa0,JSON['stringify'](_0x41a8a3));_0x33d246(_0x41a8a3);})['catch'](function(_0x37c6a9){logger[_0x9679('0x12')](_0x9679('0x20'),_0x37c6a9[_0x9679('0x13')],_0x316fa0);_0x32c7fb(_this[_0x9679('0x12')](0x1f4,_0x37c6a9[_0x9679('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d7295fa..6a922ae 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 _0x2a8b=['save','update','removeListener','length','chatInteraction:'];(function(_0x4a7145,_0x14c18b){var _0x9e46d5=function(_0x1602fe){while(--_0x1602fe){_0x4a7145['push'](_0x4a7145['shift']());}};_0x9e46d5(++_0x14c18b);}(_0x2a8b,0xaa));var _0xb2a8=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2a8b[_0x42245d];return _0x4b211a;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xb2a8('0x0'),'remove',_0xb2a8('0x1')];function createListener(_0x2a501c,_0x2e7022){return function(_0x4f66bf){_0x2e7022['emit'](_0x2a501c,_0x4f66bf);};}function removeListener(_0x345517,_0xe8f407){return function(){ChatInteractionEvents[_0xb2a8('0x2')](_0x345517,_0xe8f407);};}exports['register']=function(_0x16ac05){for(var _0xe6f03e=0x0,_0x31b063=events[_0xb2a8('0x3')];_0xe6f03e<_0x31b063;_0xe6f03e++){var _0x39d9ab=events[_0xe6f03e];var _0x5dc1e3=createListener(_0xb2a8('0x4')+_0x39d9ab,_0x16ac05);ChatInteractionEvents['on'](_0x39d9ab,_0x5dc1e3);}}; \ No newline at end of file +var _0x9753=['length','./chatInteraction.events','save','update','removeListener','register'];(function(_0x4e64a,_0x398271){var _0x3b6ac7=function(_0x3ca3a3){while(--_0x3ca3a3){_0x4e64a['push'](_0x4e64a['shift']());}};_0x3b6ac7(++_0x398271);}(_0x9753,0x1bd));var _0x3975=function(_0x4f484c,_0x9bccb4){_0x4f484c=_0x4f484c-0x0;var _0x276e95=_0x9753[_0x4f484c];return _0x276e95;};'use strict';var ChatInteractionEvents=require(_0x3975('0x0'));var events=[_0x3975('0x1'),'remove',_0x3975('0x2')];function createListener(_0x5c26a3,_0x33d042){return function(_0x321824){_0x33d042['emit'](_0x5c26a3,_0x321824);};}function removeListener(_0x265305,_0x3b82b0){return function(){ChatInteractionEvents[_0x3975('0x3')](_0x265305,_0x3b82b0);};}exports[_0x3975('0x4')]=function(_0x458d3b){for(var _0x245901=0x0,_0xf63932=events[_0x3975('0x5')];_0x245901<_0xf63932;_0x245901++){var _0x35c780=events[_0x245901];var _0x2a8cbd=createListener('chatInteraction:'+_0x35c780,_0x458d3b);ChatInteractionEvents['on'](_0x35c780,_0x2a8cbd);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f5ddf7e..f653699 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 _0x4937=['isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','getMyMessages','download','create','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','get','/describe','/:id'];(function(_0x41d7dd,_0x15f9c0){var _0x33e456=function(_0x35d175){while(--_0x35d175){_0x41d7dd['push'](_0x41d7dd['shift']());}};_0x33e456(++_0x15f9c0);}(_0x4937,0x152));var _0x7493=function(_0x591af8,_0xd5fab2){_0x591af8=_0x591af8-0x0;var _0x5fd305=_0x4937[_0x591af8];return _0x5fd305;};'use strict';var multer=require(_0x7493('0x0'));var util=require(_0x7493('0x1'));var path=require(_0x7493('0x2'));var timeout=require(_0x7493('0x3'));var express=require(_0x7493('0x4'));var router=express['Router']();var auth=require(_0x7493('0x5'));var interaction=require(_0x7493('0x6'));var config=require('../../config/environment');var controller=require(_0x7493('0x7'));router['get']('/',auth[_0x7493('0x8')](),controller['index']);router[_0x7493('0x9')](_0x7493('0xa'),auth[_0x7493('0x8')](),controller['describe']);router[_0x7493('0x9')](_0x7493('0xb'),auth[_0x7493('0xc')](),controller[_0x7493('0xd')]);router[_0x7493('0x9')]('/:id/attachment_download',auth[_0x7493('0xc')](),controller[_0x7493('0xe')]);router[_0x7493('0x9')](_0x7493('0xf'),auth[_0x7493('0x8')](),controller[_0x7493('0x10')]);router['get']('/:id/my_messages',auth[_0x7493('0xc')](),controller[_0x7493('0x11')]);router[_0x7493('0x9')]('/:id/download',auth[_0x7493('0x8')](),controller[_0x7493('0x12')]);router['post']('/',auth[_0x7493('0x8')](),controller[_0x7493('0x13')]);router[_0x7493('0x14')]('/:id/vidaoo',auth[_0x7493('0x8')](),controller[_0x7493('0x15')]);var upload=multer({'storage':multer[_0x7493('0x16')]({'destination':function(_0x49cf59,_0x70e856,_0x4230f5){_0x4230f5(null,path[_0x7493('0x17')](config[_0x7493('0x18')],_0x7493('0x19')));},'filename':function(_0x207185,_0x3967dd,_0x54d555){_0x54d555(null,util[_0x7493('0x1a')]('%s-%s',Date[_0x7493('0x1b')](),_0x3967dd[_0x7493('0x1c')][_0x7493('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7493('0x14')]('/:id/attachment_upload',upload[_0x7493('0x1e')](_0x7493('0x1f')),controller[_0x7493('0x20')]);router['post'](_0x7493('0xf'),auth[_0x7493('0xc')](),controller['addMessage']);router[_0x7493('0x14')]('/:id/tags',auth[_0x7493('0x8')](),interaction[_0x7493('0x21')]('chat',_0x7493('0x22')),controller[_0x7493('0x23')]);router[_0x7493('0x24')](_0x7493('0xb'),auth[_0x7493('0x8')](),interaction[_0x7493('0x21')](_0x7493('0x25'),_0x7493('0x26')),controller['update']);router['put'](_0x7493('0x27'),controller[_0x7493('0x28')]);router[_0x7493('0x24')](_0x7493('0x29'),auth[_0x7493('0xc')](),controller[_0x7493('0x2a')]);router['put'](_0x7493('0x2b'),controller[_0x7493('0x2c')]);router[_0x7493('0x2d')](_0x7493('0xb'),auth[_0x7493('0x8')](),interaction[_0x7493('0x21')](_0x7493('0x25'),_0x7493('0x2e')),controller['destroy']);router[_0x7493('0x2d')](_0x7493('0x2f'),auth[_0x7493('0x8')](),controller[_0x7493('0x30')]);module[_0x7493('0x31')]=router; \ No newline at end of file +var _0x269e=['delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','format','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close'];(function(_0x5a6842,_0x12167a){var _0x2bba7d=function(_0x582d67){while(--_0x582d67){_0x5a6842['push'](_0x5a6842['shift']());}};_0x2bba7d(++_0x12167a);}(_0x269e,0x171));var _0xe269=function(_0xe6ee2,_0x3333cd){_0xe6ee2=_0xe6ee2-0x0;var _0x1dd92e=_0x269e[_0xe6ee2];return _0x1dd92e;};'use strict';var multer=require(_0xe269('0x0'));var util=require(_0xe269('0x1'));var path=require('path');var timeout=require(_0xe269('0x2'));var express=require(_0xe269('0x3'));var router=express['Router']();var auth=require(_0xe269('0x4'));var interaction=require(_0xe269('0x5'));var config=require(_0xe269('0x6'));var controller=require(_0xe269('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe269('0x8')]);router[_0xe269('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe269('0xa')]);router['get'](_0xe269('0xb'),auth[_0xe269('0xc')](),controller[_0xe269('0xd')]);router['get']('/:id/attachment_download',auth[_0xe269('0xc')](),controller[_0xe269('0xe')]);router[_0xe269('0x9')](_0xe269('0xf'),auth[_0xe269('0x10')](),controller[_0xe269('0x11')]);router['get'](_0xe269('0x12'),auth[_0xe269('0xc')](),controller[_0xe269('0x13')]);router[_0xe269('0x9')](_0xe269('0x14'),auth['isAuthenticated'](),controller[_0xe269('0x15')]);router['post']('/',auth[_0xe269('0x10')](),controller['create']);router[_0xe269('0x16')](_0xe269('0x17'),auth[_0xe269('0x10')](),controller[_0xe269('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12869a,_0x2389e4,_0x3f5c33){_0x3f5c33(null,path[_0xe269('0x19')](config[_0xe269('0x1a')],'server/files/attachments/'));},'filename':function(_0x16a5eb,_0x42974d,_0x5f1d78){_0x5f1d78(null,util[_0xe269('0x1b')]('%s-%s',Date[_0xe269('0x1c')](),_0x42974d[_0xe269('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe269('0x16')](_0xe269('0x1e'),upload[_0xe269('0x1f')](_0xe269('0x20')),controller[_0xe269('0x21')]);router[_0xe269('0x16')](_0xe269('0xf'),auth[_0xe269('0xc')](),controller[_0xe269('0x22')]);router['post'](_0xe269('0x23'),auth[_0xe269('0x10')](),interaction[_0xe269('0x24')](_0xe269('0x25'),_0xe269('0x26')),controller[_0xe269('0x27')]);router[_0xe269('0x28')]('/:id',auth[_0xe269('0x10')](),interaction['tracked'](_0xe269('0x25'),_0xe269('0x29')),controller[_0xe269('0x2a')]);router[_0xe269('0x28')](_0xe269('0x2b'),controller['customUpdate']);router[_0xe269('0x28')]('/:id/abandon',auth[_0xe269('0xc')](),controller[_0xe269('0x2c')]);router[_0xe269('0x28')](_0xe269('0x2d'),controller[_0xe269('0x2e')]);router[_0xe269('0x2f')]('/:id',auth[_0xe269('0x10')](),interaction['tracked'](_0xe269('0x25'),_0xe269('0x30')),controller[_0xe269('0x31')]);router[_0xe269('0x2f')](_0xe269('0x23'),auth[_0xe269('0x10')](),controller[_0xe269('0x32')]);module[_0xe269('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4a437a2..eab30ab 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0xcb3c25,_0x1ad06c){var _0x2eedd7=function(_0x33a63d){while(--_0x33a63d){_0xcb3c25['push'](_0xcb3c25['shift']());}};_0x2eedd7(++_0x1ad06c);}(_0xdb28,0x106));var _0x8db2=function(_0x42bd6e,_0xee117){_0x42bd6e=_0x42bd6e-0x0;var _0x2d03a9=_0xdb28[_0x42bd6e];return _0x2d03a9;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file +var _0x0b0e=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2e2f84,_0x24e46f){_0x2e2f84=_0x2e2f84-0x0;var _0x448191=_0x0b0e[_0x2e2f84];return _0x448191;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d73aef9..8330309 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 _0x3101=['sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','merge','create','body','find','describe','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','internal','online','lastLoginAt','allowmessenger','VoiceQueues','get','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order'];(function(_0x5028d1,_0x3f5889){var _0x572596=function(_0x43e1d0){while(--_0x43e1d0){_0x5028d1['push'](_0x5028d1['shift']());}};_0x572596(++_0x3f5889);}(_0x3101,0x97));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1310('0x0'));var zipdir=require(_0x1310('0x1'));var jsonpatch=require(_0x1310('0x2'));var rp=require(_0x1310('0x3'));var moment=require(_0x1310('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1310('0x5'));var util=require('util');var path=require(_0x1310('0x6'));var sox=require(_0x1310('0x7'));var csv=require('to-csv');var ejs=require(_0x1310('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1310('0x9'));var crypto=require(_0x1310('0xa'));var jsforce=require(_0x1310('0xb'));var deskjs=require(_0x1310('0xc'));var toCsv=require(_0x1310('0xd'));var querystring=require(_0x1310('0xe'));var Papa=require(_0x1310('0xf'));var Redis=require(_0x1310('0x10'));var authService=require(_0x1310('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1310('0x12'));var hardwareService=require(_0x1310('0x13'));var logger=require(_0x1310('0x14'))(_0x1310('0x15'));var utils=require(_0x1310('0x16'));var config=require(_0x1310('0x17'));var licenseUtil=require(_0x1310('0x18'));var db=require(_0x1310('0x19'))['db'];config[_0x1310('0x1a')]=_['defaults'](config[_0x1310('0x1a')],{'host':_0x1310('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1310('0x1a')]));require(_0x1310('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d7301,_0x4c54b5){_0x4c54b5=_0x4c54b5||0xcc;return function(_0x3ff566){if(_0x3ff566){return _0x5d7301[_0x1310('0x1d')](_0x4c54b5);}return _0x5d7301[_0x1310('0x1e')](_0x4c54b5)[_0x1310('0x1f')]();};}function respondWithResult(_0x509eb2,_0x122f73){_0x122f73=_0x122f73||0xc8;return function(_0x2cff6e){if(_0x2cff6e){return _0x509eb2['status'](_0x122f73)[_0x1310('0x20')](_0x2cff6e);}};}function respondWithFilteredResult(_0x5a49d9,_0x4a9698){return function(_0x3972bb){if(_0x3972bb){var _0x358e30=_0x3972bb['count'],_0x4a5f0e=_0x4a9698[_0x1310('0x21')],_0x1c8dc4=_0x4a9698[_0x1310('0x21')]+_0x4a9698['limit'],_0x1150d7;if(_0x1c8dc4>=_0x358e30){_0x1c8dc4=_0x358e30;_0x1150d7=0xc8;}else{_0x1150d7=0xce;}_0x5a49d9[_0x1310('0x1e')](_0x1150d7);return _0x5a49d9[_0x1310('0x22')](_0x1310('0x23'),_0x4a5f0e+'-'+_0x1c8dc4+'/'+_0x358e30)[_0x1310('0x20')](_0x3972bb);}return null;};}function patchUpdates(_0x1392a8){return function(_0x45a845){try{jsonpatch[_0x1310('0x24')](_0x45a845,_0x1392a8,!![]);}catch(_0x39cd3e){return BPromise[_0x1310('0x25')](_0x39cd3e);}return _0x45a845[_0x1310('0x26')]();};}function saveUpdates(_0x1e2aa5,_0x24205d){return function(_0x1e94a5){if(_0x1e94a5){return _0x1e94a5[_0x1310('0x27')](_0x1e2aa5)['then'](function(_0x5c9d93){return _0x5c9d93;});}return null;};}function removeEntity(_0x30ac77,_0x3bbe22){return function(_0x8770a1){if(_0x8770a1){return _0x8770a1[_0x1310('0x28')]()[_0x1310('0x29')](function(){_0x30ac77[_0x1310('0x1e')](0xcc)[_0x1310('0x1f')]();});}};}function handleEntityNotFound(_0x4ca81d,_0x4d07af){return function(_0xbfb298){if(!_0xbfb298){_0x4ca81d[_0x1310('0x1d')](0x194);}return _0xbfb298;};}function handleError(_0x2ea75c,_0x202992){_0x202992=_0x202992||0x1f4;return function(_0xda4f0f){logger[_0x1310('0x2a')](_0xda4f0f[_0x1310('0x2b')]);if(_0xda4f0f[_0x1310('0x2c')]){delete _0xda4f0f[_0x1310('0x2c')];}_0x2ea75c[_0x1310('0x1e')](_0x202992)['send'](_0xda4f0f);};}exports['index']=function(_0x30e78b,_0xde1a75){var _0x6bf2fd={},_0x5593ea={},_0x211468={'count':0x0,'rows':[]};var _0x453655=_[_0x1310('0x2d')](db[_0x1310('0x2e')][_0x1310('0x2f')],function(_0x381824){return{'name':_0x381824['fieldName'],'type':_0x381824[_0x1310('0x30')][_0x1310('0x31')]};});_0x5593ea[_0x1310('0x32')]=_[_0x1310('0x2d')](_0x453655,_0x1310('0x2c'));_0x5593ea[_0x1310('0x33')]=_[_0x1310('0x34')](_0x30e78b[_0x1310('0x33')]);_0x5593ea[_0x1310('0x35')]=_['intersection'](_0x5593ea['model'],_0x5593ea[_0x1310('0x33')]);_0x6bf2fd[_0x1310('0x36')]=_[_0x1310('0x37')](_0x5593ea[_0x1310('0x32')],qs[_0x1310('0x38')](_0x30e78b[_0x1310('0x33')][_0x1310('0x38')]));_0x6bf2fd[_0x1310('0x36')]=_0x6bf2fd[_0x1310('0x36')][_0x1310('0x39')]?_0x6bf2fd[_0x1310('0x36')]:_0x5593ea[_0x1310('0x32')];if(!_0x30e78b[_0x1310('0x33')][_0x1310('0x3a')]('nolimit')){_0x6bf2fd[_0x1310('0x3b')]=qs[_0x1310('0x3b')](_0x30e78b[_0x1310('0x33')][_0x1310('0x3b')]);_0x6bf2fd[_0x1310('0x21')]=qs[_0x1310('0x21')](_0x30e78b[_0x1310('0x33')][_0x1310('0x21')]);}_0x6bf2fd[_0x1310('0x3c')]=qs[_0x1310('0x3d')](_0x30e78b['query'][_0x1310('0x3d')]);_0x6bf2fd['where']=qs['filters'](_[_0x1310('0x3e')](_0x30e78b[_0x1310('0x33')],_0x5593ea[_0x1310('0x35')]),_0x453655);if(_0x30e78b[_0x1310('0x33')][_0x1310('0x3f')]){_0x6bf2fd[_0x1310('0x40')]=_['merge'](_0x6bf2fd[_0x1310('0x40')],{'$or':_[_0x1310('0x2d')](_0x453655,function(_0x2b27ef){if(_0x2b27ef['type']!==_0x1310('0x41')){var _0x4e0d42={};_0x4e0d42[_0x2b27ef['name']]={'$like':'%'+_0x30e78b[_0x1310('0x33')][_0x1310('0x3f')]+'%'};return _0x4e0d42;}})});}_0x6bf2fd=_['merge']({},_0x6bf2fd,_0x30e78b[_0x1310('0x42')]);var _0x318a73={'where':_0x6bf2fd[_0x1310('0x40')]};return db['ChatInternalMessage'][_0x1310('0x43')](_0x318a73)[_0x1310('0x29')](function(_0x3ddc73){_0x211468[_0x1310('0x43')]=_0x3ddc73;if(_0x30e78b[_0x1310('0x33')][_0x1310('0x44')]){_0x6bf2fd[_0x1310('0x45')]=[{'all':!![]}];}return db[_0x1310('0x2e')][_0x1310('0x46')](_0x6bf2fd);})[_0x1310('0x29')](function(_0x2d2d30){_0x211468[_0x1310('0x47')]=_0x2d2d30;return _0x211468;})['then'](respondWithFilteredResult(_0xde1a75,_0x6bf2fd))[_0x1310('0x48')](handleError(_0xde1a75,null));};exports['show']=function(_0x5e7a5d,_0x527fb0){var _0x6ffbc3={'raw':!![],'where':{'id':_0x5e7a5d[_0x1310('0x49')]['id']}},_0x9dce28={};_0x9dce28[_0x1310('0x32')]=_['keys'](db[_0x1310('0x2e')][_0x1310('0x2f')]);_0x9dce28[_0x1310('0x33')]=_[_0x1310('0x34')](_0x5e7a5d[_0x1310('0x33')]);_0x9dce28['filters']=_['intersection'](_0x9dce28[_0x1310('0x32')],_0x9dce28['query']);_0x6ffbc3[_0x1310('0x36')]=_[_0x1310('0x37')](_0x9dce28[_0x1310('0x32')],qs[_0x1310('0x38')](_0x5e7a5d[_0x1310('0x33')]['fields']));_0x6ffbc3['attributes']=_0x6ffbc3[_0x1310('0x36')][_0x1310('0x39')]?_0x6ffbc3['attributes']:_0x9dce28[_0x1310('0x32')];if(_0x5e7a5d[_0x1310('0x33')][_0x1310('0x44')]){_0x6ffbc3[_0x1310('0x45')]=[{'all':!![]}];}_0x6ffbc3=_[_0x1310('0x4a')]({},_0x6ffbc3,_0x5e7a5d[_0x1310('0x42')]);return db[_0x1310('0x2e')]['find'](_0x6ffbc3)[_0x1310('0x29')](handleEntityNotFound(_0x527fb0,null))[_0x1310('0x29')](respondWithResult(_0x527fb0,null))[_0x1310('0x48')](handleError(_0x527fb0,null));};exports[_0x1310('0x4b')]=function(_0x1b44a9,_0x50b310){return db[_0x1310('0x2e')]['create'](_0x1b44a9[_0x1310('0x4c')],{})[_0x1310('0x29')](respondWithResult(_0x50b310,0xc9))[_0x1310('0x48')](handleError(_0x50b310,null));};exports[_0x1310('0x27')]=function(_0x168801,_0x3066eb){if(_0x168801[_0x1310('0x4c')]['id']){delete _0x168801[_0x1310('0x4c')]['id'];}return db[_0x1310('0x2e')][_0x1310('0x4d')]({'where':{'id':_0x168801[_0x1310('0x49')]['id']}})['then'](handleEntityNotFound(_0x3066eb,null))['then'](saveUpdates(_0x168801['body'],null))[_0x1310('0x29')](respondWithResult(_0x3066eb,null))[_0x1310('0x48')](handleError(_0x3066eb,null));};exports['destroy']=function(_0x3505fb,_0x5ecfa3){return db[_0x1310('0x2e')][_0x1310('0x4d')]({'where':{'id':_0x3505fb[_0x1310('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ecfa3,null))[_0x1310('0x29')](removeEntity(_0x5ecfa3,null))[_0x1310('0x48')](handleError(_0x5ecfa3,null));};exports[_0x1310('0x4e')]=function(_0x4adab2,_0xe19eb2){return db[_0x1310('0x2e')][_0x1310('0x4e')]()['then'](respondWithResult(_0xe19eb2,null))[_0x1310('0x48')](handleError(_0xe19eb2,null));};function wrapUser(_0x1b65da){return function(_0x21b044){var _0x5c5b26=_0x1b65da['get']({'plain':!![]});_0x5c5b26[_0x1310('0x4f')]=[];if(_0x21b044){_0x5c5b26['lastMessageAt']=_0x21b044[_0x1310('0x50')];_0x5c5b26[_0x1310('0x51')]=_0x21b044;}else{_0x5c5b26[_0x1310('0x52')]=moment(0x0)['format'](_0x1310('0x53'));_0x5c5b26[_0x1310('0x51')]={};}return _0x5c5b26;};}exports[_0x1310('0x54')]=function(_0x4c77d4,_0x45aa4b,_0x65c46e){var _0x5b9f7d=[];return db[_0x1310('0x55')][_0x1310('0x46')]({'where':{'role':[_0x1310('0x56'),'admin',_0x1310('0x57')]},'attributes':['id',_0x1310('0x58'),_0x1310('0x2c'),_0x1310('0x59'),'userpic',_0x1310('0x5a'),_0x1310('0x5b'),_0x1310('0x5c'),_0x1310('0x5d'),'showWebBar'],'order':qs[_0x1310('0x3d')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x1310('0x5e'),'attributes':['id',_0x1310('0x2c'),'type'],'through':{'attributes':[]}}]})[_0x1310('0x29')](function(_0x2c689e){if(_0x2c689e){var _0x2e69ff=_0x4c77d4[_0x1310('0x57')][_0x1310('0x5f')]({'plain':!![]});if(!_0x2e69ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e69ff[_0x1310('0x59')]===_0x1310('0x57')){return db['UserProfileSection']['find']({'where':{'name':_0x1310('0x60'),'userProfileId':_0x2e69ff[_0x1310('0x61')]},'raw':!![]})[_0x1310('0x29')](function(_0xbb25dd){if(_0xbb25dd){if(_0xbb25dd[_0x1310('0x62')]===0x0){return db[_0x1310('0x63')][_0x1310('0x46')]({'where':{'sectionId':_0xbb25dd['id']},'raw':!![]})[_0x1310('0x29')](function(_0x13a131){var _0x4d6520=[];if(_[_0x1310('0x64')](_0x13a131)){_0x4d6520=_['filter'](_0x2c689e,function(_0x14f8cf){if(_0x14f8cf[_0x1310('0x59')]!==_0x1310('0x56')){return _0x14f8cf;}});return _0x4d6520;}else{for(var _0x387cde=0x0;_0x387cde<_0x2c689e[_0x1310('0x39')];_0x387cde++){var _0x34c9bb=_0x2c689e[_0x387cde];if(_0x34c9bb[_0x1310('0x59')]===_0x1310('0x56')){var _0x31229e=_[_0x1310('0x4d')](_0x13a131,function(_0x2a8064){return _0x2a8064['resourceId']===_0x34c9bb['id'];});if(_0x31229e)_0x4d6520['push'](_0x34c9bb);}else{_0x4d6520[_0x1310('0x65')](_0x34c9bb);}}return _0x4d6520;}});}else{return _0x2c689e;}}else{var _0x3514d8=_[_0x1310('0x3f')](_0x2c689e,function(_0x153b0c){if(_0x153b0c[_0x1310('0x59')]!==_0x1310('0x56')){return _0x153b0c;}});return _0x3514d8;}});}else{return _0x2c689e;}}})[_0x1310('0x29')](function(_0x5e5192){var _0x33ef63=[];if(_0x5e5192){_0x5b9f7d=_0x5e5192;for(var _0x2e31fc=0x0;_0x2e31fc<_0x5e5192[_0x1310('0x39')];_0x2e31fc+=0x1){_0x5b9f7d[_0x2e31fc][_0x1310('0x4f')]=[];_0x33ef63[_0x1310('0x65')](db[_0x1310('0x2e')][_0x1310('0x4d')]({'where':{'FromId':[_0x4c77d4[_0x1310('0x57')]['id'],_0x5e5192[_0x2e31fc]['id']],'ToId':[_0x4c77d4[_0x1310('0x57')]['id'],_0x5e5192[_0x2e31fc]['id']],'ChatGroupId':null},'attributes':['id',_0x1310('0x50'),_0x1310('0x66'),'ToId',_0x1310('0x67'),_0x1310('0x4c')],'order':qs[_0x1310('0x3d')](_0x1310('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1310('0x29')](wrapUser(_0x5e5192[_0x2e31fc])));}return BPromise[_0x1310('0x69')](_0x33ef63);}return[];})[_0x1310('0x29')](function(_0x561378){return{'rows':_0x561378,'count':_0x561378[_0x1310('0x39')]};})[_0x1310('0x29')](respondWithResult(_0x45aa4b,null))[_0x1310('0x48')](handleError(_0x45aa4b,null));}; \ No newline at end of file +var _0xae99=['params','length','create','body','update','find','describe','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','userpic','internal','online','allowmessenger','showWebBar','sort','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','role','push','FromId','ToId','-createdAt','all','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae99,0x172));var _0x9ae9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae99[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9ae9('0x0'));var emlformat=require(_0x9ae9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9ae9('0x2'));var moment=require(_0x9ae9('0x3'));var BPromise=require(_0x9ae9('0x4'));var Mustache=require(_0x9ae9('0x5'));var util=require(_0x9ae9('0x6'));var path=require(_0x9ae9('0x7'));var sox=require(_0x9ae9('0x8'));var csv=require(_0x9ae9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9ae9('0xa'));var crypto=require('crypto');var jsforce=require(_0x9ae9('0xb'));var deskjs=require(_0x9ae9('0xc'));var toCsv=require(_0x9ae9('0x9'));var querystring=require('querystring');var Papa=require(_0x9ae9('0xd'));var Redis=require(_0x9ae9('0xe'));var authService=require(_0x9ae9('0xf'));var qs=require(_0x9ae9('0x10'));var as=require(_0x9ae9('0x11'));var hardwareService=require(_0x9ae9('0x12'));var logger=require(_0x9ae9('0x13'))(_0x9ae9('0x14'));var utils=require(_0x9ae9('0x15'));var config=require(_0x9ae9('0x16'));var licenseUtil=require(_0x9ae9('0x17'));var db=require(_0x9ae9('0x18'))['db'];config[_0x9ae9('0x19')]=_[_0x9ae9('0x1a')](config[_0x9ae9('0x19')],{'host':_0x9ae9('0x1b'),'port':0x18eb});var socket=require(_0x9ae9('0x1c'))(new Redis(config[_0x9ae9('0x19')]));require(_0x9ae9('0x1d'))[_0x9ae9('0x1e')](socket);function respondWithStatusCode(_0x273db3,_0x44fb18){_0x44fb18=_0x44fb18||0xcc;return function(_0x15a788){if(_0x15a788){return _0x273db3[_0x9ae9('0x1f')](_0x44fb18);}return _0x273db3[_0x9ae9('0x20')](_0x44fb18)['end']();};}function respondWithResult(_0x420271,_0x44418b){_0x44418b=_0x44418b||0xc8;return function(_0x3621d9){if(_0x3621d9){return _0x420271['status'](_0x44418b)[_0x9ae9('0x21')](_0x3621d9);}};}function respondWithFilteredResult(_0x4c816a,_0x30dee7){return function(_0x307650){if(_0x307650){var _0x240bf9=_0x307650[_0x9ae9('0x22')],_0x525ee0=_0x30dee7[_0x9ae9('0x23')],_0x415b90=_0x30dee7['offset']+_0x30dee7['limit'],_0x12c2f3;if(_0x415b90>=_0x240bf9){_0x415b90=_0x240bf9;_0x12c2f3=0xc8;}else{_0x12c2f3=0xce;}_0x4c816a[_0x9ae9('0x20')](_0x12c2f3);return _0x4c816a[_0x9ae9('0x24')]('Content-Range',_0x525ee0+'-'+_0x415b90+'/'+_0x240bf9)['json'](_0x307650);}return null;};}function patchUpdates(_0x181465){return function(_0xf3ae96){try{jsonpatch[_0x9ae9('0x25')](_0xf3ae96,_0x181465,!![]);}catch(_0x572890){return BPromise[_0x9ae9('0x26')](_0x572890);}return _0xf3ae96[_0x9ae9('0x27')]();};}function saveUpdates(_0x16595c,_0x37e53b){return function(_0x5f1c86){if(_0x5f1c86){return _0x5f1c86['update'](_0x16595c)[_0x9ae9('0x28')](function(_0x5b6755){return _0x5b6755;});}return null;};}function removeEntity(_0x49f7da,_0x81d6c){return function(_0x3411a3){if(_0x3411a3){return _0x3411a3[_0x9ae9('0x29')]()[_0x9ae9('0x28')](function(){_0x49f7da[_0x9ae9('0x20')](0xcc)[_0x9ae9('0x2a')]();});}};}function handleEntityNotFound(_0x6a688d,_0x4e9611){return function(_0x53cf8a){if(!_0x53cf8a){_0x6a688d[_0x9ae9('0x1f')](0x194);}return _0x53cf8a;};}function handleError(_0x5bd44e,_0x54cfc8){_0x54cfc8=_0x54cfc8||0x1f4;return function(_0x75d905){logger[_0x9ae9('0x2b')](_0x75d905[_0x9ae9('0x2c')]);if(_0x75d905[_0x9ae9('0x2d')]){delete _0x75d905[_0x9ae9('0x2d')];}_0x5bd44e[_0x9ae9('0x20')](_0x54cfc8)[_0x9ae9('0x2e')](_0x75d905);};}exports[_0x9ae9('0x2f')]=function(_0x3f806e,_0x56deb4){var _0x39fd86={},_0x45ac1f={},_0x5ef2af={'count':0x0,'rows':[]};var _0x868eea=_[_0x9ae9('0x30')](db[_0x9ae9('0x31')][_0x9ae9('0x32')],function(_0x1f31ed){return{'name':_0x1f31ed[_0x9ae9('0x33')],'type':_0x1f31ed[_0x9ae9('0x34')][_0x9ae9('0x35')]};});_0x45ac1f[_0x9ae9('0x36')]=_['map'](_0x868eea,'name');_0x45ac1f[_0x9ae9('0x37')]=_[_0x9ae9('0x38')](_0x3f806e[_0x9ae9('0x37')]);_0x45ac1f[_0x9ae9('0x39')]=_[_0x9ae9('0x3a')](_0x45ac1f[_0x9ae9('0x36')],_0x45ac1f[_0x9ae9('0x37')]);_0x39fd86['attributes']=_[_0x9ae9('0x3a')](_0x45ac1f[_0x9ae9('0x36')],qs['fields'](_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x3b')]));_0x39fd86[_0x9ae9('0x3c')]=_0x39fd86[_0x9ae9('0x3c')]['length']?_0x39fd86[_0x9ae9('0x3c')]:_0x45ac1f[_0x9ae9('0x36')];if(!_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x3d')](_0x9ae9('0x3e'))){_0x39fd86[_0x9ae9('0x3f')]=qs['limit'](_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x3f')]);_0x39fd86[_0x9ae9('0x23')]=qs[_0x9ae9('0x23')](_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x23')]);}_0x39fd86[_0x9ae9('0x40')]=qs['sort'](_0x3f806e[_0x9ae9('0x37')]['sort']);_0x39fd86[_0x9ae9('0x41')]=qs[_0x9ae9('0x39')](_[_0x9ae9('0x42')](_0x3f806e['query'],_0x45ac1f[_0x9ae9('0x39')]),_0x868eea);if(_0x3f806e['query']['filter']){_0x39fd86['where']=_[_0x9ae9('0x43')](_0x39fd86[_0x9ae9('0x41')],{'$or':_['map'](_0x868eea,function(_0x1bdb02){if(_0x1bdb02[_0x9ae9('0x34')]!==_0x9ae9('0x44')){var _0x27841c={};_0x27841c[_0x1bdb02[_0x9ae9('0x2d')]]={'$like':'%'+_0x3f806e['query'][_0x9ae9('0x45')]+'%'};return _0x27841c;}})});}_0x39fd86=_[_0x9ae9('0x43')]({},_0x39fd86,_0x3f806e['options']);var _0xfe39c1={'where':_0x39fd86[_0x9ae9('0x41')]};return db[_0x9ae9('0x31')]['count'](_0xfe39c1)[_0x9ae9('0x28')](function(_0x1f965c){_0x5ef2af[_0x9ae9('0x22')]=_0x1f965c;if(_0x3f806e[_0x9ae9('0x37')][_0x9ae9('0x46')]){_0x39fd86[_0x9ae9('0x47')]=[{'all':!![]}];}return db[_0x9ae9('0x31')]['findAll'](_0x39fd86);})[_0x9ae9('0x28')](function(_0x422227){_0x5ef2af[_0x9ae9('0x48')]=_0x422227;return _0x5ef2af;})['then'](respondWithFilteredResult(_0x56deb4,_0x39fd86))[_0x9ae9('0x49')](handleError(_0x56deb4,null));};exports['show']=function(_0x3f81f5,_0x47a75f){var _0x484f67={'raw':!![],'where':{'id':_0x3f81f5[_0x9ae9('0x4a')]['id']}},_0x5b6dc7={};_0x5b6dc7['model']=_['keys'](db[_0x9ae9('0x31')][_0x9ae9('0x32')]);_0x5b6dc7[_0x9ae9('0x37')]=_['keys'](_0x3f81f5[_0x9ae9('0x37')]);_0x5b6dc7[_0x9ae9('0x39')]=_[_0x9ae9('0x3a')](_0x5b6dc7[_0x9ae9('0x36')],_0x5b6dc7['query']);_0x484f67[_0x9ae9('0x3c')]=_['intersection'](_0x5b6dc7[_0x9ae9('0x36')],qs[_0x9ae9('0x3b')](_0x3f81f5[_0x9ae9('0x37')][_0x9ae9('0x3b')]));_0x484f67[_0x9ae9('0x3c')]=_0x484f67[_0x9ae9('0x3c')][_0x9ae9('0x4b')]?_0x484f67['attributes']:_0x5b6dc7[_0x9ae9('0x36')];if(_0x3f81f5[_0x9ae9('0x37')][_0x9ae9('0x46')]){_0x484f67['include']=[{'all':!![]}];}_0x484f67=_['merge']({},_0x484f67,_0x3f81f5['options']);return db[_0x9ae9('0x31')]['find'](_0x484f67)['then'](handleEntityNotFound(_0x47a75f,null))[_0x9ae9('0x28')](respondWithResult(_0x47a75f,null))[_0x9ae9('0x49')](handleError(_0x47a75f,null));};exports[_0x9ae9('0x4c')]=function(_0x2979b6,_0x2ab8a8){return db[_0x9ae9('0x31')]['create'](_0x2979b6[_0x9ae9('0x4d')],{})['then'](respondWithResult(_0x2ab8a8,0xc9))[_0x9ae9('0x49')](handleError(_0x2ab8a8,null));};exports[_0x9ae9('0x4e')]=function(_0x420577,_0x16237e){if(_0x420577[_0x9ae9('0x4d')]['id']){delete _0x420577[_0x9ae9('0x4d')]['id'];}return db[_0x9ae9('0x31')][_0x9ae9('0x4f')]({'where':{'id':_0x420577[_0x9ae9('0x4a')]['id']}})[_0x9ae9('0x28')](handleEntityNotFound(_0x16237e,null))[_0x9ae9('0x28')](saveUpdates(_0x420577[_0x9ae9('0x4d')],null))['then'](respondWithResult(_0x16237e,null))[_0x9ae9('0x49')](handleError(_0x16237e,null));};exports[_0x9ae9('0x29')]=function(_0x1f0c5e,_0x3e5d88){return db[_0x9ae9('0x31')]['find']({'where':{'id':_0x1f0c5e[_0x9ae9('0x4a')]['id']}})[_0x9ae9('0x28')](handleEntityNotFound(_0x3e5d88,null))[_0x9ae9('0x28')](removeEntity(_0x3e5d88,null))[_0x9ae9('0x49')](handleError(_0x3e5d88,null));};exports[_0x9ae9('0x50')]=function(_0x1db58b,_0xd9fae5){return db[_0x9ae9('0x31')][_0x9ae9('0x50')]()[_0x9ae9('0x28')](respondWithResult(_0xd9fae5,null))['catch'](handleError(_0xd9fae5,null));};function wrapUser(_0x516f79){return function(_0x210bb7){var _0x189e15=_0x516f79['get']({'plain':!![]});_0x189e15[_0x9ae9('0x51')]=[];if(_0x210bb7){_0x189e15[_0x9ae9('0x52')]=_0x210bb7[_0x9ae9('0x53')];_0x189e15['lastMessage']=_0x210bb7;}else{_0x189e15[_0x9ae9('0x52')]=moment(0x0)['format'](_0x9ae9('0x54'));_0x189e15['lastMessage']={};}return _0x189e15;};}exports[_0x9ae9('0x55')]=function(_0x2c53d9,_0x52bb6e,_0xddd5b){var _0x4cd45a=[];return db[_0x9ae9('0x56')][_0x9ae9('0x57')]({'where':{'role':[_0x9ae9('0x58'),'admin',_0x9ae9('0x59')]},'attributes':['id',_0x9ae9('0x5a'),_0x9ae9('0x2d'),'role',_0x9ae9('0x5b'),_0x9ae9('0x5c'),_0x9ae9('0x5d'),'lastLoginAt',_0x9ae9('0x5e'),_0x9ae9('0x5f')],'order':qs[_0x9ae9('0x60')]('-online'),'include':[{'model':db[_0x9ae9('0x61')],'as':'VoiceQueues','attributes':['id',_0x9ae9('0x2d'),_0x9ae9('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x2795cf){if(_0x2795cf){var _0x3849ed=_0x2c53d9[_0x9ae9('0x59')][_0x9ae9('0x62')]({'plain':!![]});if(!_0x3849ed)throw new Error(_0x9ae9('0x63'));if(_0x3849ed['role']===_0x9ae9('0x59')){return db[_0x9ae9('0x64')]['find']({'where':{'name':_0x9ae9('0x65'),'userProfileId':_0x3849ed['userProfileId']},'raw':!![]})[_0x9ae9('0x28')](function(_0x1718a8){if(_0x1718a8){if(_0x1718a8[_0x9ae9('0x66')]===0x0){return db[_0x9ae9('0x67')][_0x9ae9('0x57')]({'where':{'sectionId':_0x1718a8['id']},'raw':!![]})['then'](function(_0x18d0c0){var _0x6f7e40=[];if(_[_0x9ae9('0x68')](_0x18d0c0)){_0x6f7e40=_[_0x9ae9('0x45')](_0x2795cf,function(_0x44cec7){if(_0x44cec7[_0x9ae9('0x69')]!==_0x9ae9('0x58')){return _0x44cec7;}});return _0x6f7e40;}else{for(var _0x34711e=0x0;_0x34711e<_0x2795cf[_0x9ae9('0x4b')];_0x34711e++){var _0x3720c1=_0x2795cf[_0x34711e];if(_0x3720c1[_0x9ae9('0x69')]===_0x9ae9('0x58')){var _0x10dee6=_[_0x9ae9('0x4f')](_0x18d0c0,function(_0xc6ffde){return _0xc6ffde['resourceId']===_0x3720c1['id'];});if(_0x10dee6)_0x6f7e40['push'](_0x3720c1);}else{_0x6f7e40[_0x9ae9('0x6a')](_0x3720c1);}}return _0x6f7e40;}});}else{return _0x2795cf;}}else{var _0x5f5aad=_['filter'](_0x2795cf,function(_0x362d77){if(_0x362d77['role']!=='agent'){return _0x362d77;}});return _0x5f5aad;}});}else{return _0x2795cf;}}})[_0x9ae9('0x28')](function(_0x5be81c){var _0x1f606b=[];if(_0x5be81c){_0x4cd45a=_0x5be81c;for(var _0x581557=0x0;_0x581557<_0x5be81c[_0x9ae9('0x4b')];_0x581557+=0x1){_0x4cd45a[_0x581557][_0x9ae9('0x51')]=[];_0x1f606b[_0x9ae9('0x6a')](db[_0x9ae9('0x31')]['find']({'where':{'FromId':[_0x2c53d9[_0x9ae9('0x59')]['id'],_0x5be81c[_0x581557]['id']],'ToId':[_0x2c53d9[_0x9ae9('0x59')]['id'],_0x5be81c[_0x581557]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x9ae9('0x6b'),_0x9ae9('0x6c'),'read',_0x9ae9('0x4d')],'order':qs[_0x9ae9('0x60')](_0x9ae9('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9ae9('0x28')](wrapUser(_0x5be81c[_0x581557])));}return BPromise[_0x9ae9('0x6e')](_0x1f606b);}return[];})[_0x9ae9('0x28')](function(_0x49bf99){return{'rows':_0x49bf99,'count':_0x49bf99[_0x9ae9('0x4b')]};})['then'](respondWithResult(_0x52bb6e,null))[_0x9ae9('0x49')](handleError(_0x52bb6e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ea60513..0dab05e 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 _0x4c4e=['remove','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x4c4e,0x152));var _0xe4c4=function(_0x272d75,_0x11c64f){_0x272d75=_0x272d75-0x0;var _0x1f81b5=_0x4c4e[_0x272d75];return _0x1f81b5;};'use strict';var EventEmitter=require(_0xe4c4('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe4c4('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe4c4('0x2')](0x0);var events={'afterCreate':_0xe4c4('0x3'),'afterUpdate':'update','afterDestroy':_0xe4c4('0x4')};function emitEvent(_0x7d7655){return function(_0x1a4483,_0x4cd652,_0x2d3bb7){ChatInternalMessageEvents['emit'](_0x7d7655+':'+_0x1a4483['id'],_0x1a4483);ChatInternalMessageEvents[_0xe4c4('0x5')](_0x7d7655,_0x1a4483);_0x2d3bb7(null);};}for(var e in events){if(events[_0xe4c4('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe4c4('0x7')](e,emitEvent(event));}}module[_0xe4c4('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x873a=['hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','save','emit'];(function(_0xced98a,_0x5cb79a){var _0x2055db=function(_0x7c4807){while(--_0x7c4807){_0xced98a['push'](_0xced98a['shift']());}};_0x2055db(++_0x5cb79a);}(_0x873a,0x1c2));var _0xa873=function(_0x3d1d5c,_0xcf8251){_0x3d1d5c=_0x3d1d5c-0x0;var _0x472752=_0x873a[_0x3d1d5c];return _0x472752;};'use strict';var EventEmitter=require(_0xa873('0x0'));var ChatInternalMessage=require(_0xa873('0x1'))['db'][_0xa873('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa873('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x423a1a){return function(_0x46971d,_0x5a0d23,_0x3dc07e){ChatInternalMessageEvents[_0xa873('0x4')](_0x423a1a+':'+_0x46971d['id'],_0x46971d);ChatInternalMessageEvents['emit'](_0x423a1a,_0x46971d);_0x3dc07e(null);};}for(var e in events){if(events[_0xa873('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xa873('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 482aa03..16a3aa2 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x58f370,_0x5e55ea){var _0x2ceaad=function(_0x5ddf45){while(--_0x5ddf45){_0x58f370['push'](_0x58f370['shift']());}};_0x2ceaad(++_0x5e55ea);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xcb91[_0xc8a931];return _0x28bd27;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cb9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x319d02,_0x3b1360){var _0x261946=function(_0x1acb1a){while(--_0x1acb1a){_0x319d02['push'](_0x319d02['shift']());}};_0x261946(++_0x3b1360);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4c9bcdc..f2cfed9 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 _0xd4a6=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5e655f,_0x4e76cf){var _0x153d60=function(_0x3e6a20){while(--_0x3e6a20){_0x5e655f['push'](_0x5e655f['shift']());}};_0x153d60(++_0x4e76cf);}(_0xd4a6,0x11c));var _0x6d4a=function(_0x46ccd0,_0x2798b3){_0x46ccd0=_0x46ccd0-0x0;var _0x15f510=_0xd4a6[_0x46ccd0];return _0x15f510;};'use strict';var _=require(_0x6d4a('0x0'));var util=require(_0x6d4a('0x1'));var moment=require(_0x6d4a('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d4a('0x3'));var fs=require('fs');var Redis=require(_0x6d4a('0x4'));var db=require(_0x6d4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d4a('0x6'))(_0x6d4a('0x7'));var config=require(_0x6d4a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d4a('0x9')][_0x6d4a('0xa')]({'port':0x232a});config[_0x6d4a('0xb')]=_[_0x6d4a('0xc')](config['redis'],{'host':_0x6d4a('0xd'),'port':0x18eb});var socket=require(_0x6d4a('0xe'))(new Redis(config[_0x6d4a('0xb')]));require(_0x6d4a('0xf'))[_0x6d4a('0x10')](socket);function respondWithRpcPromise(_0x43c308,_0x1c3741,_0xbf6146){return new BPromise(function(_0x2ad586,_0x2c5fdb){return client[_0x6d4a('0x11')](_0x43c308,_0xbf6146)[_0x6d4a('0x12')](function(_0x1aa82b){logger[_0x6d4a('0x13')](_0x6d4a('0x14'),_0x1c3741,_0x6d4a('0x15'));logger[_0x6d4a('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1c3741,_0x6d4a('0x15'),JSON['stringify'](_0x1aa82b));if(_0x1aa82b[_0x6d4a('0x17')]){if(_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x18')]===0x1f4){logger['error'](_0x6d4a('0x14'),_0x1c3741,_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x19')]);return _0x2c5fdb(_0x1aa82b['error'][_0x6d4a('0x19')]);}logger['error'](_0x6d4a('0x14'),_0x1c3741,_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x19')]);return _0x2ad586(_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x19')]);}else{logger[_0x6d4a('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1c3741,_0x6d4a('0x15'));_0x2ad586(_0x1aa82b[_0x6d4a('0x1a')]['message']);}})[_0x6d4a('0x1b')](function(_0x783fb4){logger[_0x6d4a('0x17')](_0x6d4a('0x14'),_0x1c3741,_0x783fb4);_0x2c5fdb(_0x783fb4);});});} \ No newline at end of file +var _0x5f88=['request\x20sent','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3b6093,_0x6a80a5){var _0x3d3d2c=function(_0x5ed37a){while(--_0x5ed37a){_0x3b6093['push'](_0x3b6093['shift']());}};_0x3d3d2c(++_0x6a80a5);}(_0x5f88,0x132));var _0x85f8=function(_0x55b66f,_0x7d4602){_0x55b66f=_0x55b66f-0x0;var _0x1036e2=_0x5f88[_0x55b66f];return _0x1036e2;};'use strict';var _=require(_0x85f8('0x0'));var util=require(_0x85f8('0x1'));var moment=require(_0x85f8('0x2'));var BPromise=require(_0x85f8('0x3'));var rs=require(_0x85f8('0x4'));var fs=require('fs');var Redis=require(_0x85f8('0x5'));var db=require(_0x85f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x85f8('0x7'));var jayson=require(_0x85f8('0x8'));var client=jayson['client'][_0x85f8('0x9')]({'port':0x232a});config['redis']=_[_0x85f8('0xa')](config[_0x85f8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x85f8('0xc'))(new Redis(config[_0x85f8('0xb')]));require(_0x85f8('0xd'))[_0x85f8('0xe')](socket);function respondWithRpcPromise(_0x547232,_0x452584,_0x46ea88){return new BPromise(function(_0x4cab95,_0x154652){return client[_0x85f8('0xf')](_0x547232,_0x46ea88)[_0x85f8('0x10')](function(_0x28a739){logger[_0x85f8('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x452584,'request\x20sent');logger['debug'](_0x85f8('0x12'),_0x452584,_0x85f8('0x13'),JSON[_0x85f8('0x14')](_0x28a739));if(_0x28a739[_0x85f8('0x15')]){if(_0x28a739['error']['code']===0x1f4){logger[_0x85f8('0x15')](_0x85f8('0x16'),_0x452584,_0x28a739[_0x85f8('0x15')]['message']);return _0x154652(_0x28a739[_0x85f8('0x15')][_0x85f8('0x17')]);}logger['error'](_0x85f8('0x16'),_0x452584,_0x28a739[_0x85f8('0x15')][_0x85f8('0x17')]);return _0x4cab95(_0x28a739[_0x85f8('0x15')]['message']);}else{logger[_0x85f8('0x11')](_0x85f8('0x16'),_0x452584,'request\x20sent');_0x4cab95(_0x28a739[_0x85f8('0x18')][_0x85f8('0x17')]);}})['catch'](function(_0x563270){logger['error'](_0x85f8('0x16'),_0x452584,_0x563270);_0x154652(_0x563270);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ba76ea1..8e64f14 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 _0x02ef=['length','chatInternalMessage:','./chatInternalMessage.events','remove','emit','removeListener','register'];(function(_0x5972de,_0x2b786b){var _0x5d1f41=function(_0x3f2901){while(--_0x3f2901){_0x5972de['push'](_0x5972de['shift']());}};_0x5d1f41(++_0x2b786b);}(_0x02ef,0x11a));var _0xf02e=function(_0x4584f1,_0x566d68){_0x4584f1=_0x4584f1-0x0;var _0x34fe53=_0x02ef[_0x4584f1];return _0x34fe53;};'use strict';var ChatInternalMessageEvents=require(_0xf02e('0x0'));var events=['save',_0xf02e('0x1'),'update'];function createListener(_0x3acfe2,_0x1c228d){return function(_0x4c87bc){_0x1c228d[_0xf02e('0x2')](_0x3acfe2,_0x4c87bc);};}function removeListener(_0x4783f7,_0x1edc1c){return function(){ChatInternalMessageEvents[_0xf02e('0x3')](_0x4783f7,_0x1edc1c);};}exports[_0xf02e('0x4')]=function(_0x511257){for(var _0x332c29=0x0,_0x411cbe=events[_0xf02e('0x5')];_0x332c29<_0x411cbe;_0x332c29++){var _0x4682a6=events[_0x332c29];var _0x2b79b3=createListener(_0xf02e('0x6')+_0x4682a6,_0x511257);ChatInternalMessageEvents['on'](_0x4682a6,_0x2b79b3);}}; \ No newline at end of file +var _0x2285=['remove','update','emit','removeListener','register','length','chatInternalMessage:','save'];(function(_0x2db2aa,_0x32ce39){var _0x378415=function(_0x196bbc){while(--_0x196bbc){_0x2db2aa['push'](_0x2db2aa['shift']());}};_0x378415(++_0x32ce39);}(_0x2285,0x177));var _0x5228=function(_0x1dd7bf,_0x59a2b4){_0x1dd7bf=_0x1dd7bf-0x0;var _0x38bbca=_0x2285[_0x1dd7bf];return _0x38bbca;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x5228('0x0'),_0x5228('0x1'),_0x5228('0x2')];function createListener(_0x109405,_0x3d4b29){return function(_0x4f0eae){_0x3d4b29[_0x5228('0x3')](_0x109405,_0x4f0eae);};}function removeListener(_0x527cb3,_0x5bf024){return function(){ChatInternalMessageEvents[_0x5228('0x4')](_0x527cb3,_0x5bf024);};}exports[_0x5228('0x5')]=function(_0x322927){for(var _0x5ef1d3=0x0,_0x18b2db=events[_0x5228('0x6')];_0x5ef1d3<_0x18b2db;_0x5ef1d3++){var _0x192393=events[_0x5ef1d3];var _0x322b86=createListener(_0x5228('0x7')+_0x192393,_0x322927);ChatInternalMessageEvents['on'](_0x192393,_0x322b86);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 570b41c..2814a30 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x1272f2,_0x12e611){var _0x5085f5=function(_0xff6d6d){while(--_0xff6d6d){_0x1272f2['push'](_0x1272f2['shift']());}};_0x5085f5(++_0x12e611);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x4ac8bc,_0x444013){var _0x3158a1=function(_0x450635){while(--_0x450635){_0x4ac8bc['push'](_0x4ac8bc['shift']());}};_0x3158a1(++_0x444013);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xcb91[_0x231dda];return _0x3f88cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 4ab6eb8..a1b2e7e 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 _0xdabf=['TEXT','medium','BOOLEAN','out','STRING','exports'];(function(_0x457696,_0x27ef5f){var _0x4bd97b=function(_0x50361d){while(--_0x50361d){_0x457696['push'](_0x457696['shift']());}};_0x4bd97b(++_0x27ef5f);}(_0xdabf,0x6b));var _0xfdab=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdabf[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xfdab('0x0')]={'body':{'type':Sequelize[_0xfdab('0x1')](_0xfdab('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfdab('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfdab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfdab('0x4')),'defaultValue':_0xfdab('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xfdab('0x5')]},'providerResponse':{'type':Sequelize[_0xfdab('0x1')]}}; \ No newline at end of file +var _0xe1dc=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xe1dc,0x19e));var _0xce1d=function(_0x266eee,_0x3d2cca){_0x266eee=_0x266eee-0x0;var _0x10ac99=_0xe1dc[_0x266eee];return _0x10ac99;};'use strict';var Sequelize=require(_0xce1d('0x0'));module[_0xce1d('0x1')]={'body':{'type':Sequelize['TEXT'](_0xce1d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xce1d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce1d('0x4')]('in',_0xce1d('0x5')),'defaultValue':_0xce1d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xce1d('0x6')]},'providerName':{'type':Sequelize[_0xce1d('0x7')]},'providerResponse':{'type':Sequelize[_0xce1d('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index bc247be..89f668f 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 _0xf33c=['interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','offset','limit','set','Content-Range','json','apply','reject','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','where','pick','merge','filter','options','ChatMessage','count','includeAll','include','findAll','rows','params','length','find','create','body','update','describe','chat-interactions','accept','chat','read','format','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','formData','agent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf33c,0x177));var _0xcf33=function(_0x442420,_0xbfec70){_0x442420=_0x442420-0x0;var _0x2b0a06=_0xf33c[_0x442420];return _0x2b0a06;};'use strict';var pdf=require(_0xcf33('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf33('0x1'));var rp=require(_0xcf33('0x2'));var moment=require('moment');var BPromise=require(_0xcf33('0x3'));var Mustache=require('mustache');var util=require(_0xcf33('0x4'));var path=require(_0xcf33('0x5'));var sox=require(_0xcf33('0x6'));var csv=require('to-csv');var ejs=require(_0xcf33('0x7'));var fs=require('fs');var _=require(_0xcf33('0x8'));var squel=require(_0xcf33('0x9'));var crypto=require(_0xcf33('0xa'));var jsforce=require(_0xcf33('0xb'));var deskjs=require(_0xcf33('0xc'));var toCsv=require(_0xcf33('0xd'));var querystring=require(_0xcf33('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf33('0xf'));var authService=require(_0xcf33('0x10'));var qs=require(_0xcf33('0x11'));var as=require(_0xcf33('0x12'));var hardwareService=require(_0xcf33('0x13'));var logger=require(_0xcf33('0x14'))(_0xcf33('0x15'));var utils=require(_0xcf33('0x16'));var config=require(_0xcf33('0x17'));var licenseUtil=require(_0xcf33('0x18'));var db=require(_0xcf33('0x19'))['db'];config[_0xcf33('0x1a')]=_[_0xcf33('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf33('0x1a')]));require(_0xcf33('0x1c'))[_0xcf33('0x1d')](socket);var jayson=require(_0xcf33('0x1e'));var client=jayson[_0xcf33('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xcf33('0x1f')][_0xcf33('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1a8f19,_0x2595d6,_0x5acf6a,_0x5cf56a){return new BPromise(function(_0x1189e0,_0x193e10){var _0x3b70a1=_0x5cf56a||client;return _0x3b70a1[_0xcf33('0x21')](_0x1a8f19,_0x5acf6a)[_0xcf33('0x22')](function(_0x5f01f7){logger[_0xcf33('0x23')](_0xcf33('0x24'),_0x2595d6,'request\x20sent');logger[_0xcf33('0x25')](_0xcf33('0x26'),_0x2595d6,_0xcf33('0x27'),JSON['stringify'](_0x5f01f7));if(_0x5f01f7[_0xcf33('0x28')]){if(_0x5f01f7[_0xcf33('0x28')][_0xcf33('0x29')]===0x1f4){logger[_0xcf33('0x28')](_0xcf33('0x24'),_0x2595d6,_0x5f01f7['error'][_0xcf33('0x2a')]);return _0x193e10(_0x5f01f7[_0xcf33('0x28')]['message']);}logger[_0xcf33('0x28')](_0xcf33('0x24'),_0x2595d6,_0x5f01f7[_0xcf33('0x28')][_0xcf33('0x2a')]);return _0x1189e0(_0x5f01f7[_0xcf33('0x28')][_0xcf33('0x2a')]);}else{logger[_0xcf33('0x23')]('ChatMessage,\x20%s,\x20%s',_0x2595d6,_0xcf33('0x27'));_0x1189e0(_0x5f01f7[_0xcf33('0x2b')]['message']);}})[_0xcf33('0x2c')](function(_0x3164b7){logger[_0xcf33('0x28')](_0xcf33('0x24'),_0x2595d6,_0x3164b7);_0x193e10(_0x3164b7);});});}function respondWithStatusCode(_0x179dad,_0x33192e){_0x33192e=_0x33192e||0xcc;return function(_0xd187e0){if(_0xd187e0){return _0x179dad['sendStatus'](_0x33192e);}return _0x179dad[_0xcf33('0x2d')](_0x33192e)[_0xcf33('0x2e')]();};}function respondWithResult(_0x249f43,_0x326d46){_0x326d46=_0x326d46||0xc8;return function(_0x4998cd){if(_0x4998cd){return _0x249f43['status'](_0x326d46)['json'](_0x4998cd);}};}function respondWithFilteredResult(_0x29d524,_0x28ae74){return function(_0x310baa){if(_0x310baa){var _0x4318f1=_0x310baa['count'],_0x1f4512=_0x28ae74[_0xcf33('0x2f')],_0x162e4a=_0x28ae74[_0xcf33('0x2f')]+_0x28ae74[_0xcf33('0x30')],_0x312453;if(_0x162e4a>=_0x4318f1){_0x162e4a=_0x4318f1;_0x312453=0xc8;}else{_0x312453=0xce;}_0x29d524[_0xcf33('0x2d')](_0x312453);return _0x29d524[_0xcf33('0x31')](_0xcf33('0x32'),_0x1f4512+'-'+_0x162e4a+'/'+_0x4318f1)[_0xcf33('0x33')](_0x310baa);}return null;};}function patchUpdates(_0x204c5b){return function(_0x3a6924){try{jsonpatch[_0xcf33('0x34')](_0x3a6924,_0x204c5b,!![]);}catch(_0x47fd18){return BPromise[_0xcf33('0x35')](_0x47fd18);}return _0x3a6924['save']();};}function saveUpdates(_0x1fef45,_0x926e57){return function(_0x30e6be){if(_0x30e6be){return _0x30e6be['update'](_0x1fef45)[_0xcf33('0x22')](function(_0x4ce2a6){return _0x4ce2a6;});}return null;};}function removeEntity(_0x215c4a,_0x10c3b4){return function(_0x1fe7f2){if(_0x1fe7f2){return _0x1fe7f2[_0xcf33('0x36')]()[_0xcf33('0x22')](function(){_0x215c4a[_0xcf33('0x2d')](0xcc)[_0xcf33('0x2e')]();});}};}function handleEntityNotFound(_0x1dd706,_0x5e3284){return function(_0x37bab8){if(!_0x37bab8){_0x1dd706[_0xcf33('0x37')](0x194);}return _0x37bab8;};}function handleError(_0x38936f,_0x5ae741){_0x5ae741=_0x5ae741||0x1f4;return function(_0x3ab26b){logger[_0xcf33('0x28')](_0x3ab26b[_0xcf33('0x38')]);if(_0x3ab26b[_0xcf33('0x39')]){delete _0x3ab26b[_0xcf33('0x39')];}_0x38936f[_0xcf33('0x2d')](_0x5ae741)[_0xcf33('0x3a')](_0x3ab26b);};}exports[_0xcf33('0x3b')]=function(_0x1f1d0f,_0x8382){var _0x976d71={},_0x51af46={},_0x180d85={'count':0x0,'rows':[]};var _0x2ebeb9=_[_0xcf33('0x3c')](db['ChatMessage'][_0xcf33('0x3d')],function(_0x2c3290){return{'name':_0x2c3290[_0xcf33('0x3e')],'type':_0x2c3290[_0xcf33('0x3f')][_0xcf33('0x40')]};});_0x51af46[_0xcf33('0x41')]=_[_0xcf33('0x3c')](_0x2ebeb9,_0xcf33('0x39'));_0x51af46[_0xcf33('0x42')]=_[_0xcf33('0x43')](_0x1f1d0f['query']);_0x51af46[_0xcf33('0x44')]=_[_0xcf33('0x45')](_0x51af46['model'],_0x51af46['query']);_0x976d71[_0xcf33('0x46')]=_[_0xcf33('0x45')](_0x51af46[_0xcf33('0x41')],qs[_0xcf33('0x47')](_0x1f1d0f['query'][_0xcf33('0x47')]));_0x976d71['attributes']=_0x976d71[_0xcf33('0x46')]['length']?_0x976d71[_0xcf33('0x46')]:_0x51af46[_0xcf33('0x41')];if(!_0x1f1d0f[_0xcf33('0x42')]['hasOwnProperty'](_0xcf33('0x48'))){_0x976d71[_0xcf33('0x30')]=qs[_0xcf33('0x30')](_0x1f1d0f[_0xcf33('0x42')][_0xcf33('0x30')]);_0x976d71[_0xcf33('0x2f')]=qs[_0xcf33('0x2f')](_0x1f1d0f[_0xcf33('0x42')][_0xcf33('0x2f')]);}_0x976d71['order']=qs['sort'](_0x1f1d0f['query']['sort']);_0x976d71[_0xcf33('0x49')]=qs[_0xcf33('0x44')](_[_0xcf33('0x4a')](_0x1f1d0f[_0xcf33('0x42')],_0x51af46['filters']),_0x2ebeb9);if(_0x1f1d0f['query']['filter']){_0x976d71['where']=_[_0xcf33('0x4b')](_0x976d71[_0xcf33('0x49')],{'$or':_['map'](_0x2ebeb9,function(_0x5d8394){if(_0x5d8394[_0xcf33('0x3f')]!=='VIRTUAL'){var _0x1373c0={};_0x1373c0[_0x5d8394[_0xcf33('0x39')]]={'$like':'%'+_0x1f1d0f['query'][_0xcf33('0x4c')]+'%'};return _0x1373c0;}})});}_0x976d71=_[_0xcf33('0x4b')]({},_0x976d71,_0x1f1d0f[_0xcf33('0x4d')]);var _0x3d97c2={'where':_0x976d71['where']};return db[_0xcf33('0x4e')]['count'](_0x3d97c2)[_0xcf33('0x22')](function(_0x10d165){_0x180d85[_0xcf33('0x4f')]=_0x10d165;if(_0x1f1d0f[_0xcf33('0x42')][_0xcf33('0x50')]){_0x976d71[_0xcf33('0x51')]=[{'all':!![]}];}return db[_0xcf33('0x4e')][_0xcf33('0x52')](_0x976d71);})[_0xcf33('0x22')](function(_0x163867){_0x180d85[_0xcf33('0x53')]=_0x163867;return _0x180d85;})[_0xcf33('0x22')](respondWithFilteredResult(_0x8382,_0x976d71))[_0xcf33('0x2c')](handleError(_0x8382,null));};exports['show']=function(_0x23ea12,_0x3a71e1){var _0x2931a2={'raw':!![],'where':{'id':_0x23ea12[_0xcf33('0x54')]['id']}},_0x46e0c9={};_0x46e0c9[_0xcf33('0x41')]=_[_0xcf33('0x43')](db[_0xcf33('0x4e')][_0xcf33('0x3d')]);_0x46e0c9[_0xcf33('0x42')]=_[_0xcf33('0x43')](_0x23ea12[_0xcf33('0x42')]);_0x46e0c9[_0xcf33('0x44')]=_[_0xcf33('0x45')](_0x46e0c9[_0xcf33('0x41')],_0x46e0c9[_0xcf33('0x42')]);_0x2931a2[_0xcf33('0x46')]=_[_0xcf33('0x45')](_0x46e0c9[_0xcf33('0x41')],qs[_0xcf33('0x47')](_0x23ea12[_0xcf33('0x42')][_0xcf33('0x47')]));_0x2931a2['attributes']=_0x2931a2[_0xcf33('0x46')][_0xcf33('0x55')]?_0x2931a2['attributes']:_0x46e0c9[_0xcf33('0x41')];if(_0x23ea12[_0xcf33('0x42')]['includeAll']){_0x2931a2[_0xcf33('0x51')]=[{'all':!![]}];}_0x2931a2=_['merge']({},_0x2931a2,_0x23ea12['options']);return db[_0xcf33('0x4e')][_0xcf33('0x56')](_0x2931a2)[_0xcf33('0x22')](handleEntityNotFound(_0x3a71e1,null))[_0xcf33('0x22')](respondWithResult(_0x3a71e1,null))[_0xcf33('0x2c')](handleError(_0x3a71e1,null));};exports[_0xcf33('0x57')]=function(_0x1d8fec,_0x32e72a){return db[_0xcf33('0x4e')][_0xcf33('0x57')](_0x1d8fec[_0xcf33('0x58')],{})[_0xcf33('0x22')](respondWithResult(_0x32e72a,0xc9))[_0xcf33('0x2c')](handleError(_0x32e72a,null));};exports[_0xcf33('0x59')]=function(_0x25240c,_0x52ad8f){if(_0x25240c[_0xcf33('0x58')]['id']){delete _0x25240c['body']['id'];}return db[_0xcf33('0x4e')]['find']({'where':{'id':_0x25240c['params']['id']}})[_0xcf33('0x22')](handleEntityNotFound(_0x52ad8f,null))[_0xcf33('0x22')](saveUpdates(_0x25240c['body'],null))[_0xcf33('0x22')](respondWithResult(_0x52ad8f,null))['catch'](handleError(_0x52ad8f,null));};exports[_0xcf33('0x36')]=function(_0x2b110c,_0x6751c2){return db[_0xcf33('0x4e')][_0xcf33('0x56')]({'where':{'id':_0x2b110c[_0xcf33('0x54')]['id']}})[_0xcf33('0x22')](handleEntityNotFound(_0x6751c2,null))[_0xcf33('0x22')](removeEntity(_0x6751c2,null))[_0xcf33('0x2c')](handleError(_0x6751c2,null));};exports[_0xcf33('0x5a')]=function(_0x172eaf,_0x4d8294){return db[_0xcf33('0x4e')][_0xcf33('0x5a')]()[_0xcf33('0x22')](respondWithResult(_0x4d8294,null))[_0xcf33('0x2c')](handleError(_0x4d8294,null));};var interaction_log=require(_0xcf33('0x14'))(_0xcf33('0x5b'));exports[_0xcf33('0x5c')]=function(_0x3947da,_0x4c07c3,_0x1e5f5f){var _0x12c5a1={'channel':_0xcf33('0x5d')};if(_0x3947da[_0xcf33('0x58')]['id']){delete _0x3947da['body']['id'];}_0x3947da[_0xcf33('0x58')][_0xcf33('0x5e')]=!![];_0x3947da[_0xcf33('0x58')]['readAt']=moment()[_0xcf33('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3947da[_0xcf33('0x58')][_0xcf33('0x60')]=_0x3947da[_0xcf33('0x58')][_0xcf33('0x60')]||_0x3947da[_0xcf33('0x61')]['id'];return db[_0xcf33('0x4e')]['find']({'where':{'id':_0x3947da['params']['id'],'UserId':null},'include':[{'model':db[_0xcf33('0x62')],'as':_0xcf33('0x63')}]})[_0xcf33('0x22')](handleEntityNotFound(_0x4c07c3,null))[_0xcf33('0x22')](saveUpdates(_0x3947da[_0xcf33('0x58')],null))[_0xcf33('0x22')](function(_0x53b6af){if(_0x53b6af){_0x12c5a1[_0xcf33('0x2a')]=_0x53b6af[_0xcf33('0x64')]({'plain':!![]});return db[_0xcf33('0x65')][_0xcf33('0x56')]({'where':{'id':_0x53b6af[_0xcf33('0x66')]}});}return null;})[_0xcf33('0x22')](handleEntityNotFound(_0x4c07c3,null))[_0xcf33('0x22')](function(_0x448acf){if(_0x448acf){return _0x448acf['update']({'UserId':_0x3947da[_0xcf33('0x58')][_0xcf33('0x60')],'read1stAt':_[_0xcf33('0x67')](_0x448acf[_0xcf33('0x68')])?moment()['format'](_0xcf33('0x69')):undefined});}return null;})['then'](function(_0x167095){if(_0x167095){_0x12c5a1['interaction']=_0x167095[_0xcf33('0x64')]({'plain':!![]});interaction_log[_0xcf33('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3947da['user']['id'],_0x3947da['user'][_0xcf33('0x39')],_0x3947da[_0xcf33('0x61')][_0xcf33('0x6a')],_0x12c5a1['interaction']['id'],_0x3947da['body']?JSON['stringify'](_0x3947da[_0xcf33('0x58')]):'null');return respondWithRpcPromise(_0xcf33('0x6b'),_0xcf33('0x6c'),_0x12c5a1);}return null;})['then'](function(_0x57fa27){if(_0x57fa27){if(_0x3947da['body'][_0xcf33('0x6d')]){_0x12c5a1['message'][_0xcf33('0x6e')]=util[_0xcf33('0x5f')](_0xcf33('0x6f'),_0x3947da[_0xcf33('0x61')][_0xcf33('0x39')]);_0x12c5a1['message']['channel']=_0x12c5a1['channel'];_0x12c5a1[_0xcf33('0x2a')][_0xcf33('0x70')]=_0xcf33('0x5c');return respondWithRpcPromise('EventManager',_0xcf33('0x71'),{'event':_0xcf33('0x72'),'message':_[_0xcf33('0x4b')](_0x12c5a1[_0xcf33('0x2a')],JSON['parse'](_0x12c5a1['interaction'][_0xcf33('0x73')]))},client9002)[_0xcf33('0x22')](function(){return _0x12c5a1;});}return _0x12c5a1;}return null;})['then'](respondWithResult(_0x4c07c3,null))['catch'](handleError(_0x4c07c3,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['reject']=function(_0x152731,_0x3b92c5,_0x26123a){var _0x29aadb={'agent':{},'channel':_0xcf33('0x5d')};if(_0x152731[_0xcf33('0x58')]['id']){delete _0x152731[_0xcf33('0x58')]['id'];}_0x152731[_0xcf33('0x58')][_0xcf33('0x60')]=_0x152731[_0xcf33('0x58')][_0xcf33('0x60')]||_0x152731['user']['id'];_0x29aadb[_0xcf33('0x74')]['id']=_0x152731[_0xcf33('0x58')]['UserId'];return db[_0xcf33('0x4e')][_0xcf33('0x56')]({'where':{'id':_0x152731[_0xcf33('0x54')]['id'],'UserId':null}})[_0xcf33('0x22')](handleEntityNotFound(_0x3b92c5,null))[_0xcf33('0x22')](function(_0x127dc8){if(_0x127dc8){_0x29aadb['message']=_0x127dc8[_0xcf33('0x64')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x127dc8['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3b92c5,null))[_0xcf33('0x22')](function(_0x43225b){if(_0x43225b){_0x29aadb[_0xcf33('0x75')]=_0x43225b[_0xcf33('0x64')]({'plain':!![]});interaction_log[_0xcf33('0x23')](_0xcf33('0x76'),_0x152731['user']['id'],_0x152731[_0xcf33('0x61')][_0xcf33('0x39')],_0x152731['user'][_0xcf33('0x6a')],_0x29aadb['interaction']['id'],_0x152731[_0xcf33('0x58')]?JSON['stringify'](_0x152731[_0xcf33('0x58')]):'null');return respondWithRpcPromise(_0xcf33('0x77'),_0xcf33('0x78'),_0x29aadb);}return null;})[_0xcf33('0x22')](function(_0x13d176){if(_0x13d176){_0x13d176[_0xcf33('0x2a')][_0xcf33('0x6e')]=util['format'](_0xcf33('0x6f'),_0x152731[_0xcf33('0x61')][_0xcf33('0x39')]);_0x13d176[_0xcf33('0x2a')]['channel']=_0x29aadb[_0xcf33('0x79')];_0x13d176[_0xcf33('0x2a')][_0xcf33('0x70')]='reject';respondWithRpcPromise(_0xcf33('0x71'),_0xcf33('0x71'),{'event':_0xcf33('0x7a'),'message':_0x13d176[_0xcf33('0x2a')]},client9002);return _0x29aadb;}return null;})[_0xcf33('0x22')](respondWithResult(_0x3b92c5,null))['catch'](handleError(_0x3b92c5,null));}; \ No newline at end of file +var _0x8497=['[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','../../config/logger','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','destroy','name','map','rawAttributes','key','keys','model','intersection','fields','query','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','ChatMessage','params','include','find','create','body','describe','chat-interactions','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','update','isNil','read1stAt','format','interaction'];(function(_0x236ee4,_0x4e1a65){var _0x64e97f=function(_0x451976){while(--_0x451976){_0x236ee4['push'](_0x236ee4['shift']());}};_0x64e97f(++_0x4e1a65);}(_0x8497,0x157));var _0x7849=function(_0x15eba7,_0xe76fed){_0x15eba7=_0x15eba7-0x0;var _0x3c8522=_0x8497[_0x15eba7];return _0x3c8522;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7849('0x0'));var zipdir=require(_0x7849('0x1'));var jsonpatch=require(_0x7849('0x2'));var rp=require('request-promise');var moment=require(_0x7849('0x3'));var BPromise=require(_0x7849('0x4'));var Mustache=require(_0x7849('0x5'));var util=require('util');var path=require(_0x7849('0x6'));var sox=require(_0x7849('0x7'));var csv=require(_0x7849('0x8'));var ejs=require(_0x7849('0x9'));var fs=require('fs');var _=require(_0x7849('0xa'));var squel=require(_0x7849('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7849('0x8'));var querystring=require(_0x7849('0xc'));var Papa=require(_0x7849('0xd'));var Redis=require('ioredis');var authService=require(_0x7849('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7849('0xf'));var hardwareService=require(_0x7849('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7849('0x11'));var licenseUtil=require(_0x7849('0x12'));var db=require('../../mysqldb')['db'];config[_0x7849('0x13')]=_['defaults'](config['redis'],{'host':_0x7849('0x14'),'port':0x18eb});var socket=require(_0x7849('0x15'))(new Redis(config[_0x7849('0x13')]));require(_0x7849('0x16'))[_0x7849('0x17')](socket);var jayson=require(_0x7849('0x18'));var client=jayson[_0x7849('0x19')][_0x7849('0x1a')]({'port':0x232c});var client9002=jayson[_0x7849('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43ce8a,_0x55d2d0,_0x517a4e,_0x3a9860){return new BPromise(function(_0x18120c,_0x5b9439){var _0x5bfa89=_0x3a9860||client;return _0x5bfa89[_0x7849('0x1b')](_0x43ce8a,_0x517a4e)[_0x7849('0x1c')](function(_0x502e1e){logger[_0x7849('0x1d')](_0x7849('0x1e'),_0x55d2d0,'request\x20sent');logger[_0x7849('0x1f')](_0x7849('0x20'),_0x55d2d0,_0x7849('0x21'),JSON[_0x7849('0x22')](_0x502e1e));if(_0x502e1e[_0x7849('0x23')]){if(_0x502e1e[_0x7849('0x23')][_0x7849('0x24')]===0x1f4){logger[_0x7849('0x23')](_0x7849('0x1e'),_0x55d2d0,_0x502e1e['error'][_0x7849('0x25')]);return _0x5b9439(_0x502e1e[_0x7849('0x23')][_0x7849('0x25')]);}logger[_0x7849('0x23')](_0x7849('0x1e'),_0x55d2d0,_0x502e1e['error'][_0x7849('0x25')]);return _0x18120c(_0x502e1e[_0x7849('0x23')]['message']);}else{logger[_0x7849('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x55d2d0,_0x7849('0x21'));_0x18120c(_0x502e1e[_0x7849('0x26')][_0x7849('0x25')]);}})[_0x7849('0x27')](function(_0x3ce345){logger['error'](_0x7849('0x1e'),_0x55d2d0,_0x3ce345);_0x5b9439(_0x3ce345);});});}function respondWithStatusCode(_0x57946a,_0x4d093d){_0x4d093d=_0x4d093d||0xcc;return function(_0x4e15b2){if(_0x4e15b2){return _0x57946a[_0x7849('0x28')](_0x4d093d);}return _0x57946a[_0x7849('0x29')](_0x4d093d)[_0x7849('0x2a')]();};}function respondWithResult(_0x3914a6,_0x2691a2){_0x2691a2=_0x2691a2||0xc8;return function(_0x5b4e62){if(_0x5b4e62){return _0x3914a6[_0x7849('0x29')](_0x2691a2)[_0x7849('0x2b')](_0x5b4e62);}};}function respondWithFilteredResult(_0xffd778,_0x19e30c){return function(_0x409cd0){if(_0x409cd0){var _0x4051ad=_0x409cd0[_0x7849('0x2c')],_0x39a1dd=_0x19e30c['offset'],_0x22ba09=_0x19e30c[_0x7849('0x2d')]+_0x19e30c[_0x7849('0x2e')],_0x24543b;if(_0x22ba09>=_0x4051ad){_0x22ba09=_0x4051ad;_0x24543b=0xc8;}else{_0x24543b=0xce;}_0xffd778[_0x7849('0x29')](_0x24543b);return _0xffd778['set'](_0x7849('0x2f'),_0x39a1dd+'-'+_0x22ba09+'/'+_0x4051ad)[_0x7849('0x2b')](_0x409cd0);}return null;};}function patchUpdates(_0x54c298){return function(_0x597f83){try{jsonpatch['apply'](_0x597f83,_0x54c298,!![]);}catch(_0x152429){return BPromise[_0x7849('0x30')](_0x152429);}return _0x597f83['save']();};}function saveUpdates(_0x56570a,_0x804afc){return function(_0x1ced62){if(_0x1ced62){return _0x1ced62['update'](_0x56570a)[_0x7849('0x1c')](function(_0x5bba2b){return _0x5bba2b;});}return null;};}function removeEntity(_0x36f697,_0x44f7e0){return function(_0x42c827){if(_0x42c827){return _0x42c827[_0x7849('0x31')]()[_0x7849('0x1c')](function(){_0x36f697[_0x7849('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ea3c1,_0x534ca9){return function(_0x56a6aa){if(!_0x56a6aa){_0x4ea3c1[_0x7849('0x28')](0x194);}return _0x56a6aa;};}function handleError(_0x433286,_0x257ec6){_0x257ec6=_0x257ec6||0x1f4;return function(_0x9a5f62){logger[_0x7849('0x23')](_0x9a5f62['stack']);if(_0x9a5f62[_0x7849('0x32')]){delete _0x9a5f62['name'];}_0x433286['status'](_0x257ec6)['send'](_0x9a5f62);};}exports['index']=function(_0x5b2380,_0x507bd6){var _0x20626c={},_0x47d876={},_0x2f3822={'count':0x0,'rows':[]};var _0x55a896=_[_0x7849('0x33')](db['ChatMessage'][_0x7849('0x34')],function(_0x88bc84){return{'name':_0x88bc84['fieldName'],'type':_0x88bc84['type'][_0x7849('0x35')]};});_0x47d876['model']=_[_0x7849('0x33')](_0x55a896,_0x7849('0x32'));_0x47d876['query']=_[_0x7849('0x36')](_0x5b2380['query']);_0x47d876['filters']=_['intersection'](_0x47d876[_0x7849('0x37')],_0x47d876['query']);_0x20626c['attributes']=_[_0x7849('0x38')](_0x47d876[_0x7849('0x37')],qs[_0x7849('0x39')](_0x5b2380[_0x7849('0x3a')][_0x7849('0x39')]));_0x20626c[_0x7849('0x3b')]=_0x20626c[_0x7849('0x3b')][_0x7849('0x3c')]?_0x20626c[_0x7849('0x3b')]:_0x47d876[_0x7849('0x37')];if(!_0x5b2380[_0x7849('0x3a')][_0x7849('0x3d')]('nolimit')){_0x20626c[_0x7849('0x2e')]=qs[_0x7849('0x2e')](_0x5b2380[_0x7849('0x3a')][_0x7849('0x2e')]);_0x20626c[_0x7849('0x2d')]=qs['offset'](_0x5b2380[_0x7849('0x3a')][_0x7849('0x2d')]);}_0x20626c['order']=qs[_0x7849('0x3e')](_0x5b2380[_0x7849('0x3a')]['sort']);_0x20626c[_0x7849('0x3f')]=qs[_0x7849('0x40')](_['pick'](_0x5b2380[_0x7849('0x3a')],_0x47d876[_0x7849('0x40')]),_0x55a896);if(_0x5b2380['query'][_0x7849('0x41')]){_0x20626c[_0x7849('0x3f')]=_[_0x7849('0x42')](_0x20626c['where'],{'$or':_['map'](_0x55a896,function(_0x5c98af){if(_0x5c98af[_0x7849('0x43')]!==_0x7849('0x44')){var _0x4671ea={};_0x4671ea[_0x5c98af[_0x7849('0x32')]]={'$like':'%'+_0x5b2380[_0x7849('0x3a')][_0x7849('0x41')]+'%'};return _0x4671ea;}})});}_0x20626c=_[_0x7849('0x42')]({},_0x20626c,_0x5b2380[_0x7849('0x45')]);var _0x3a99a6={'where':_0x20626c[_0x7849('0x3f')]};return db['ChatMessage'][_0x7849('0x2c')](_0x3a99a6)[_0x7849('0x1c')](function(_0x1b1971){_0x2f3822[_0x7849('0x2c')]=_0x1b1971;if(_0x5b2380[_0x7849('0x3a')][_0x7849('0x46')]){_0x20626c['include']=[{'all':!![]}];}return db[_0x7849('0x47')]['findAll'](_0x20626c);})[_0x7849('0x1c')](function(_0x476e49){_0x2f3822['rows']=_0x476e49;return _0x2f3822;})[_0x7849('0x1c')](respondWithFilteredResult(_0x507bd6,_0x20626c))[_0x7849('0x27')](handleError(_0x507bd6,null));};exports['show']=function(_0x959c0d,_0xa9d60d){var _0x3c08af={'raw':!![],'where':{'id':_0x959c0d[_0x7849('0x48')]['id']}},_0x16f69a={};_0x16f69a['model']=_[_0x7849('0x36')](db[_0x7849('0x47')][_0x7849('0x34')]);_0x16f69a[_0x7849('0x3a')]=_[_0x7849('0x36')](_0x959c0d['query']);_0x16f69a['filters']=_['intersection'](_0x16f69a[_0x7849('0x37')],_0x16f69a[_0x7849('0x3a')]);_0x3c08af[_0x7849('0x3b')]=_[_0x7849('0x38')](_0x16f69a[_0x7849('0x37')],qs[_0x7849('0x39')](_0x959c0d[_0x7849('0x3a')][_0x7849('0x39')]));_0x3c08af['attributes']=_0x3c08af[_0x7849('0x3b')][_0x7849('0x3c')]?_0x3c08af[_0x7849('0x3b')]:_0x16f69a[_0x7849('0x37')];if(_0x959c0d[_0x7849('0x3a')][_0x7849('0x46')]){_0x3c08af[_0x7849('0x49')]=[{'all':!![]}];}_0x3c08af=_[_0x7849('0x42')]({},_0x3c08af,_0x959c0d['options']);return db[_0x7849('0x47')][_0x7849('0x4a')](_0x3c08af)[_0x7849('0x1c')](handleEntityNotFound(_0xa9d60d,null))[_0x7849('0x1c')](respondWithResult(_0xa9d60d,null))['catch'](handleError(_0xa9d60d,null));};exports[_0x7849('0x4b')]=function(_0x32b9d4,_0x4be974){return db[_0x7849('0x47')][_0x7849('0x4b')](_0x32b9d4[_0x7849('0x4c')],{})[_0x7849('0x1c')](respondWithResult(_0x4be974,0xc9))[_0x7849('0x27')](handleError(_0x4be974,null));};exports['update']=function(_0x45ca00,_0x5664d1){if(_0x45ca00[_0x7849('0x4c')]['id']){delete _0x45ca00[_0x7849('0x4c')]['id'];}return db[_0x7849('0x47')][_0x7849('0x4a')]({'where':{'id':_0x45ca00['params']['id']}})[_0x7849('0x1c')](handleEntityNotFound(_0x5664d1,null))['then'](saveUpdates(_0x45ca00[_0x7849('0x4c')],null))[_0x7849('0x1c')](respondWithResult(_0x5664d1,null))[_0x7849('0x27')](handleError(_0x5664d1,null));};exports[_0x7849('0x31')]=function(_0x3ea141,_0xabcae5){return db[_0x7849('0x47')][_0x7849('0x4a')]({'where':{'id':_0x3ea141[_0x7849('0x48')]['id']}})[_0x7849('0x1c')](handleEntityNotFound(_0xabcae5,null))[_0x7849('0x1c')](removeEntity(_0xabcae5,null))[_0x7849('0x27')](handleError(_0xabcae5,null));};exports[_0x7849('0x4d')]=function(_0x14cab3,_0x429869){return db[_0x7849('0x47')][_0x7849('0x4d')]()[_0x7849('0x1c')](respondWithResult(_0x429869,null))[_0x7849('0x27')](handleError(_0x429869,null));};var interaction_log=require('../../config/logger')(_0x7849('0x4e'));exports['accept']=function(_0x270fd1,_0x422e5a,_0x4bd788){var _0x4f1f63={'channel':_0x7849('0x4f')};if(_0x270fd1[_0x7849('0x4c')]['id']){delete _0x270fd1[_0x7849('0x4c')]['id'];}_0x270fd1[_0x7849('0x4c')]['read']=!![];_0x270fd1['body'][_0x7849('0x50')]=moment()['format'](_0x7849('0x51'));_0x270fd1['body'][_0x7849('0x52')]=_0x270fd1[_0x7849('0x4c')]['UserId']||_0x270fd1[_0x7849('0x53')]['id'];return db[_0x7849('0x47')]['find']({'where':{'id':_0x270fd1[_0x7849('0x48')]['id'],'UserId':null},'include':[{'model':db[_0x7849('0x54')],'as':_0x7849('0x55')}]})[_0x7849('0x1c')](handleEntityNotFound(_0x422e5a,null))[_0x7849('0x1c')](saveUpdates(_0x270fd1['body'],null))['then'](function(_0x588569){if(_0x588569){_0x4f1f63[_0x7849('0x25')]=_0x588569[_0x7849('0x56')]({'plain':!![]});return db[_0x7849('0x57')][_0x7849('0x4a')]({'where':{'id':_0x588569['ChatInteractionId']}});}return null;})[_0x7849('0x1c')](handleEntityNotFound(_0x422e5a,null))[_0x7849('0x1c')](function(_0x345e0f){if(_0x345e0f){return _0x345e0f[_0x7849('0x58')]({'UserId':_0x270fd1[_0x7849('0x4c')][_0x7849('0x52')],'read1stAt':_[_0x7849('0x59')](_0x345e0f[_0x7849('0x5a')])?moment()[_0x7849('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x20290a){if(_0x20290a){_0x4f1f63[_0x7849('0x5c')]=_0x20290a[_0x7849('0x56')]({'plain':!![]});interaction_log[_0x7849('0x1d')](_0x7849('0x5d'),_0x270fd1[_0x7849('0x53')]['id'],_0x270fd1[_0x7849('0x53')][_0x7849('0x32')],_0x270fd1['user'][_0x7849('0x5e')],_0x4f1f63[_0x7849('0x5c')]['id'],_0x270fd1[_0x7849('0x4c')]?JSON[_0x7849('0x22')](_0x270fd1[_0x7849('0x4c')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4f1f63);}return null;})['then'](function(_0x345002){if(_0x345002){if(_0x270fd1[_0x7849('0x4c')][_0x7849('0x5f')]){_0x4f1f63[_0x7849('0x25')][_0x7849('0x60')]=util[_0x7849('0x5b')](_0x7849('0x61'),_0x270fd1['user'][_0x7849('0x32')]);_0x4f1f63[_0x7849('0x25')][_0x7849('0x62')]=_0x4f1f63[_0x7849('0x62')];_0x4f1f63[_0x7849('0x25')][_0x7849('0x63')]=_0x7849('0x64');return respondWithRpcPromise(_0x7849('0x65'),_0x7849('0x65'),{'event':_0x7849('0x66'),'message':_[_0x7849('0x42')](_0x4f1f63[_0x7849('0x25')],JSON[_0x7849('0x67')](_0x4f1f63['interaction']['formData']))},client9002)[_0x7849('0x1c')](function(){return _0x4f1f63;});}return _0x4f1f63;}return null;})[_0x7849('0x1c')](respondWithResult(_0x422e5a,null))[_0x7849('0x27')](handleError(_0x422e5a,null));};var interaction_log=require(_0x7849('0x68'))(_0x7849('0x4e'));exports[_0x7849('0x30')]=function(_0x52306a,_0x437f42,_0x177043){var _0x22d338={'agent':{},'channel':'chat'};if(_0x52306a[_0x7849('0x4c')]['id']){delete _0x52306a[_0x7849('0x4c')]['id'];}_0x52306a[_0x7849('0x4c')][_0x7849('0x52')]=_0x52306a[_0x7849('0x4c')][_0x7849('0x52')]||_0x52306a[_0x7849('0x53')]['id'];_0x22d338['agent']['id']=_0x52306a[_0x7849('0x4c')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x52306a[_0x7849('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x437f42,null))[_0x7849('0x1c')](function(_0x2e619f){if(_0x2e619f){_0x22d338[_0x7849('0x25')]=_0x2e619f['get']({'plain':!![]});return db[_0x7849('0x57')][_0x7849('0x4a')]({'where':{'id':_0x2e619f[_0x7849('0x69')]}});}return null;})[_0x7849('0x1c')](handleEntityNotFound(_0x437f42,null))['then'](function(_0x38d985){if(_0x38d985){_0x22d338[_0x7849('0x5c')]=_0x38d985[_0x7849('0x56')]({'plain':!![]});interaction_log[_0x7849('0x1d')](_0x7849('0x6a'),_0x52306a[_0x7849('0x53')]['id'],_0x52306a[_0x7849('0x53')]['name'],_0x52306a[_0x7849('0x53')]['role'],_0x22d338[_0x7849('0x5c')]['id'],_0x52306a[_0x7849('0x4c')]?JSON[_0x7849('0x22')](_0x52306a[_0x7849('0x4c')]):_0x7849('0x6b'));return respondWithRpcPromise('RejectMessage',_0x7849('0x6c'),_0x22d338);}return null;})[_0x7849('0x1c')](function(_0x24cf1f){if(_0x24cf1f){_0x24cf1f[_0x7849('0x25')][_0x7849('0x60')]=util[_0x7849('0x5b')](_0x7849('0x61'),_0x52306a[_0x7849('0x53')][_0x7849('0x32')]);_0x24cf1f[_0x7849('0x25')]['channel']=_0x22d338[_0x7849('0x62')];_0x24cf1f[_0x7849('0x25')][_0x7849('0x63')]='reject';respondWithRpcPromise(_0x7849('0x65'),'EventManager',{'event':'rejectmessage','message':_0x24cf1f[_0x7849('0x25')]},client9002);return _0x22d338;}return null;})['then'](respondWithResult(_0x437f42,null))['catch'](handleError(_0x437f42,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index d37ba9e..7ed9b65 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 _0xb7b9=['hasOwnProperty','hook','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x206711,_0x4125b4){var _0x4fe02b=function(_0x27dc45){while(--_0x27dc45){_0x206711['push'](_0x206711['shift']());}};_0x4fe02b(++_0x4125b4);}(_0xb7b9,0x1a0));var _0x9b7b=function(_0x35c422,_0x2d29ad){_0x35c422=_0x35c422-0x0;var _0x20329e=_0xb7b9[_0x35c422];return _0x20329e;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x9b7b('0x0'))['db'][_0x9b7b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9b7b('0x2')](0x0);var events={'afterCreate':_0x9b7b('0x3'),'afterUpdate':_0x9b7b('0x4'),'afterDestroy':_0x9b7b('0x5')};function emitEvent(_0x176f44){return function(_0x14ccc6,_0x10a468,_0x27f6a3){ChatMessageEvents[_0x9b7b('0x6')](_0x176f44+':'+_0x14ccc6['id'],_0x14ccc6);ChatMessageEvents[_0x9b7b('0x6')](_0x176f44,_0x14ccc6);_0x27f6a3(null);};}for(var e in events){if(events[_0x9b7b('0x7')](e)){var event=events[e];ChatMessage[_0x9b7b('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x5c87=['events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x550a61,_0x1c5d8c){var _0x248bfc=function(_0x38d79e){while(--_0x38d79e){_0x550a61['push'](_0x550a61['shift']());}};_0x248bfc(++_0x1c5d8c);}(_0x5c87,0x1ae));var _0x75c8=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5c87[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require(_0x75c8('0x0'));var ChatMessage=require(_0x75c8('0x1'))['db'][_0x75c8('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x75c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x75c8('0x4'),'afterDestroy':_0x75c8('0x5')};function emitEvent(_0x53041e){return function(_0x38a1a5,_0x35bd14,_0x2ff63f){ChatMessageEvents[_0x75c8('0x6')](_0x53041e+':'+_0x38a1a5['id'],_0x38a1a5);ChatMessageEvents[_0x75c8('0x6')](_0x53041e,_0x38a1a5);_0x2ff63f(null);};}for(var e in events){if(events[_0x75c8('0x7')](e)){var event=events[e];ChatMessage[_0x75c8('0x8')](e,emitEvent(event));}}module[_0x75c8('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 76c6f31..fbaa2a0 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 _0xb586=['chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x3a5d69,_0x1e2796){var _0x281f97=function(_0x2a2dd7){while(--_0x2a2dd7){_0x3a5d69['push'](_0x3a5d69['shift']());}};_0x281f97(++_0x1e2796);}(_0xb586,0x17b));var _0x6b58=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0xb586[_0x53d172];return _0x1bd0a2;};'use strict';var _=require(_0x6b58('0x0'));var util=require(_0x6b58('0x1'));var logger=require(_0x6b58('0x2'))(_0x6b58('0x3'));var moment=require(_0x6b58('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b58('0x6'));var config=require(_0x6b58('0x7'));var attributes=require(_0x6b58('0x8'));module[_0x6b58('0x9')]=function(_0x2e6646,_0xe84ae5){return _0x2e6646[_0x6b58('0xa')]('ChatMessage',attributes,{'tableName':_0x6b58('0xb'),'paranoid':![],'indexes':[{'name':_0x6b58('0xc'),'fields':['body'],'type':_0x6b58('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d1c65,_0x11c2b8,_0x287161){var _0x2afcf5=_0x2e6646['models'];var _0x318103=_0x5d1c65[_0x6b58('0xe')]({'plain':!![]});if(_0x318103[_0x6b58('0xf')][_0x6b58('0x10')]()==='in'||_0x318103['direction'][_0x6b58('0x10')]()===_0x6b58('0x11')&&!_0x318103[_0x6b58('0x12')]&&!_[_0x6b58('0x13')](_0x318103[_0x6b58('0x14')])){_0x2afcf5[_0x6b58('0x15')][_0x6b58('0x16')]({'where':{'id':_0x318103[_0x6b58('0x17')]}})[_0x6b58('0x18')](function(_0x216e37){if(_0x216e37){_0x216e37[_0x6b58('0x19')]({'lastMsgAt':_0x318103[_0x6b58('0x1a')],'lastMsgDirection':_0x318103[_0x6b58('0xf')]['toLowerCase']()});}})['catch'](function(_0x13f9a1){console[_0x6b58('0x1b')](_0x13f9a1);});}_0x287161();}},'charset':_0x6b58('0x1c'),'collate':_0x6b58('0x1d')});}; \ No newline at end of file +var _0x926a=['error','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','secret','isNil','findOne','update','createdAt','catch'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0x926a,0x145));var _0xa926=function(_0x31f26e,_0xd520be){_0x31f26e=_0x31f26e-0x0;var _0x6a4a78=_0x926a[_0x31f26e];return _0x6a4a78;};'use strict';var _=require(_0xa926('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa926('0x1'));var BPromise=require('bluebird');var rp=require(_0xa926('0x2'));var fs=require('fs');var path=require(_0xa926('0x3'));var rimraf=require(_0xa926('0x4'));var config=require(_0xa926('0x5'));var attributes=require(_0xa926('0x6'));module['exports']=function(_0x47b3b8,_0x390fcf){return _0x47b3b8[_0xa926('0x7')]('ChatMessage',attributes,{'tableName':_0xa926('0x8'),'paranoid':![],'indexes':[{'name':_0xa926('0x9'),'fields':[_0xa926('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50773c,_0x1a7f38,_0x2b2742){var _0xb0b4fc=_0x47b3b8['models'];var _0x1cce01=_0x50773c[_0xa926('0xb')]({'plain':!![]});if(_0x1cce01[_0xa926('0xc')][_0xa926('0xd')]()==='in'||_0x1cce01[_0xa926('0xc')]['toLowerCase']()==='out'&&!_0x1cce01[_0xa926('0xe')]&&!_[_0xa926('0xf')](_0x1cce01['UserId'])){_0xb0b4fc['ChatInteraction'][_0xa926('0x10')]({'where':{'id':_0x1cce01['ChatInteractionId']}})['then'](function(_0xc0dedb){if(_0xc0dedb){_0xc0dedb[_0xa926('0x11')]({'lastMsgAt':_0x1cce01[_0xa926('0x12')],'lastMsgDirection':_0x1cce01[_0xa926('0xc')][_0xa926('0xd')]()});}})[_0xa926('0x13')](function(_0x44a188){console[_0xa926('0x14')](_0x44a188);});}_0x2b2742();}},'charset':_0xa926('0x15'),'collate':_0xa926('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 002139d..1944053 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 _0xe30f=['request\x20sent','stringify','error','code','message','info','result','catch','CreateChatMessage','create','options','raw','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2b5a1c,_0x5a4341){var _0x47f26a=function(_0x4c853c){while(--_0x4c853c){_0x2b5a1c['push'](_0x2b5a1c['shift']());}};_0x47f26a(++_0x5a4341);}(_0xe30f,0x11a));var _0xfe30=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe30f[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0xfe30('0x0'));var moment=require('moment');var BPromise=require(_0xfe30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe30('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe30('0x3'));var logger=require('../../config/logger')(_0xfe30('0x4'));var config=require(_0xfe30('0x5'));var jayson=require(_0xfe30('0x6'));var client=jayson[_0xfe30('0x7')][_0xfe30('0x8')]({'port':0x232a});config['redis']=_[_0xfe30('0x9')](config[_0xfe30('0xa')],{'host':_0xfe30('0xb'),'port':0x18eb});var socket=require(_0xfe30('0xc'))(new Redis(config['redis']));require(_0xfe30('0xd'))['register'](socket);function respondWithRpcPromise(_0x259bb2,_0x270271,_0x27eaa3){return new BPromise(function(_0x4d75ac,_0x1dfb9f){return client['request'](_0x259bb2,_0x27eaa3)[_0xfe30('0xe')](function(_0x3499f7){logger['info'](_0xfe30('0xf'),_0x270271,'request\x20sent');logger[_0xfe30('0x10')](_0xfe30('0x11'),_0x270271,_0xfe30('0x12'),JSON[_0xfe30('0x13')](_0x3499f7));if(_0x3499f7[_0xfe30('0x14')]){if(_0x3499f7[_0xfe30('0x14')][_0xfe30('0x15')]===0x1f4){logger['error'](_0xfe30('0xf'),_0x270271,_0x3499f7[_0xfe30('0x14')]['message']);return _0x1dfb9f(_0x3499f7[_0xfe30('0x14')]['message']);}logger[_0xfe30('0x14')](_0xfe30('0xf'),_0x270271,_0x3499f7[_0xfe30('0x14')][_0xfe30('0x16')]);return _0x4d75ac(_0x3499f7[_0xfe30('0x14')][_0xfe30('0x16')]);}else{logger[_0xfe30('0x17')]('ChatMessage,\x20%s,\x20%s',_0x270271,_0xfe30('0x12'));_0x4d75ac(_0x3499f7[_0xfe30('0x18')]['message']);}})[_0xfe30('0x19')](function(_0x1c2a66){logger['error']('ChatMessage,\x20%s,\x20%s',_0x270271,_0x1c2a66);_0x1dfb9f(_0x1c2a66);});});}exports[_0xfe30('0x1a')]=function(_0x4bb066){var _0x509a13=this;return new Promise(function(_0x8daa1d,_0x18798c){return db['ChatMessage'][_0xfe30('0x1b')](_0x4bb066['body'],{'raw':_0x4bb066[_0xfe30('0x1c')]?_0x4bb066['options'][_0xfe30('0x1d')]===undefined?!![]:![]:!![]})[_0xfe30('0xe')](function(_0x555f76){logger['info'](_0xfe30('0x1a'),_0x4bb066);logger[_0xfe30('0x10')](_0xfe30('0x1a'),_0x4bb066,JSON['stringify'](_0x555f76));_0x8daa1d(_0x555f76);})[_0xfe30('0x19')](function(_0x3623aa){logger[_0xfe30('0x14')](_0xfe30('0x1a'),_0x3623aa[_0xfe30('0x16')],_0x4bb066);_0x18798c(_0x509a13[_0xfe30('0x14')](0x1f4,_0x3623aa[_0xfe30('0x16')]));});});}; \ No newline at end of file +var _0xb7a9=['stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','ChatMessage','create','options','CreateChatMessage','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x26a4bc,_0x4b9dfe){var _0x1f29dd=function(_0x19f318){while(--_0x19f318){_0x26a4bc['push'](_0x26a4bc['shift']());}};_0x1f29dd(++_0x4b9dfe);}(_0xb7a9,0x1a3));var _0x9b7a=function(_0x4121cf,_0x225336){_0x4121cf=_0x4121cf-0x0;var _0xb88e5f=_0xb7a9[_0x4121cf];return _0xb88e5f;};'use strict';var _=require(_0x9b7a('0x0'));var util=require(_0x9b7a('0x1'));var moment=require(_0x9b7a('0x2'));var BPromise=require(_0x9b7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b7a('0x5'));var logger=require(_0x9b7a('0x6'))(_0x9b7a('0x7'));var config=require(_0x9b7a('0x8'));var jayson=require(_0x9b7a('0x9'));var client=jayson[_0x9b7a('0xa')][_0x9b7a('0xb')]({'port':0x232a});config[_0x9b7a('0xc')]=_[_0x9b7a('0xd')](config[_0x9b7a('0xc')],{'host':_0x9b7a('0xe'),'port':0x18eb});var socket=require(_0x9b7a('0xf'))(new Redis(config['redis']));require(_0x9b7a('0x10'))[_0x9b7a('0x11')](socket);function respondWithRpcPromise(_0x4500c4,_0x507d10,_0x31a7f6){return new BPromise(function(_0x16ad55,_0x5c1fe9){return client['request'](_0x4500c4,_0x31a7f6)[_0x9b7a('0x12')](function(_0x2f38db){logger[_0x9b7a('0x13')]('ChatMessage,\x20%s,\x20%s',_0x507d10,_0x9b7a('0x14'));logger[_0x9b7a('0x15')](_0x9b7a('0x16'),_0x507d10,_0x9b7a('0x14'),JSON[_0x9b7a('0x17')](_0x2f38db));if(_0x2f38db[_0x9b7a('0x18')]){if(_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x19')]===0x1f4){logger[_0x9b7a('0x18')](_0x9b7a('0x1a'),_0x507d10,_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x1b')]);return _0x5c1fe9(_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x1b')]);}logger[_0x9b7a('0x18')](_0x9b7a('0x1a'),_0x507d10,_0x2f38db[_0x9b7a('0x18')][_0x9b7a('0x1b')]);return _0x16ad55(_0x2f38db['error']['message']);}else{logger[_0x9b7a('0x13')](_0x9b7a('0x1a'),_0x507d10,'request\x20sent');_0x16ad55(_0x2f38db[_0x9b7a('0x1c')][_0x9b7a('0x1b')]);}})['catch'](function(_0x14f00d){logger[_0x9b7a('0x18')](_0x9b7a('0x1a'),_0x507d10,_0x14f00d);_0x5c1fe9(_0x14f00d);});});}exports['CreateChatMessage']=function(_0x57e8e7){var _0x1ddf81=this;return new Promise(function(_0x33c33a,_0x5d29b5){return db[_0x9b7a('0x1d')][_0x9b7a('0x1e')](_0x57e8e7['body'],{'raw':_0x57e8e7[_0x9b7a('0x1f')]?_0x57e8e7[_0x9b7a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x9b7a('0x12')](function(_0x2c1a26){logger[_0x9b7a('0x13')](_0x9b7a('0x20'),_0x57e8e7);logger[_0x9b7a('0x15')]('CreateChatMessage',_0x57e8e7,JSON['stringify'](_0x2c1a26));_0x33c33a(_0x2c1a26);})[_0x9b7a('0x21')](function(_0x5646bb){logger[_0x9b7a('0x18')](_0x9b7a('0x20'),_0x5646bb[_0x9b7a('0x1b')],_0x57e8e7);_0x5d29b5(_0x1ddf81[_0x9b7a('0x18')](0x1f4,_0x5646bb[_0x9b7a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 561331c..7854fb8 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 _0x687b=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x5db570,_0x4116d3){var _0x4ee280=function(_0x5afa1a){while(--_0x5afa1a){_0x5db570['push'](_0x5db570['shift']());}};_0x4ee280(++_0x4116d3);}(_0x687b,0x14a));var _0xb687=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0x687b[_0x59ab65];return _0x57db9b;};'use strict';var ChatMessageEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){ChatMessageEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);ChatMessageEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file +var _0x4c60=['chatMessage:','./chatMessage.events','save','remove','update','removeListener','register','length'];(function(_0xd33788,_0x317c5b){var _0x34d5b9=function(_0x5cc37b){while(--_0x5cc37b){_0xd33788['push'](_0xd33788['shift']());}};_0x34d5b9(++_0x317c5b);}(_0x4c60,0xc1));var _0x04c6=function(_0x4f2404,_0x50da08){_0x4f2404=_0x4f2404-0x0;var _0x262164=_0x4c60[_0x4f2404];return _0x262164;};'use strict';var ChatMessageEvents=require(_0x04c6('0x0'));var events=[_0x04c6('0x1'),_0x04c6('0x2'),_0x04c6('0x3')];function createListener(_0x5ba768,_0x2a1d36){return function(_0x5d9fa3){_0x2a1d36['emit'](_0x5ba768,_0x5d9fa3);};}function removeListener(_0x4ad4f1,_0x53ca7a){return function(){ChatMessageEvents[_0x04c6('0x4')](_0x4ad4f1,_0x53ca7a);};}exports[_0x04c6('0x5')]=function(_0x2054da){for(var _0x12bd5d=0x0,_0x2b9041=events[_0x04c6('0x6')];_0x12bd5d<_0x2b9041;_0x12bd5d++){var _0x8f9b13=events[_0x12bd5d];var _0x530a48=createListener(_0x04c6('0x7')+_0x8f9b13,_0x2054da);ChatMessageEvents['on'](_0x8f9b13,_0x530a48);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 9062964..364bab8 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 _0xe5f3=['create','put','update','/:id/accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','chatmessage:create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5f3,0xfb));var _0x3e5f=function(_0x30bd30,_0x2a4dcd){_0x30bd30=_0x30bd30-0x0;var _0x35f7b=_0xe5f3[_0x30bd30];return _0x35f7b;};'use strict';var multer=require(_0x3e5f('0x0'));var util=require(_0x3e5f('0x1'));var path=require('path');var timeout=require(_0x3e5f('0x2'));var express=require(_0x3e5f('0x3'));var router=express[_0x3e5f('0x4')]();var auth=require(_0x3e5f('0x5'));var interaction=require(_0x3e5f('0x6'));var config=require(_0x3e5f('0x7'));var controller=require(_0x3e5f('0x8'));router[_0x3e5f('0x9')]('/',auth[_0x3e5f('0xa')](),controller[_0x3e5f('0xb')]);router['get'](_0x3e5f('0xc'),auth[_0x3e5f('0xa')](),controller[_0x3e5f('0xd')]);router[_0x3e5f('0x9')](_0x3e5f('0xe'),auth[_0x3e5f('0xa')](),controller[_0x3e5f('0xf')]);router['post']('/',auth[_0x3e5f('0xa')](),interaction[_0x3e5f('0x10')](_0x3e5f('0x11'),_0x3e5f('0x12')),controller[_0x3e5f('0x13')]);router[_0x3e5f('0x14')]('/:id',controller[_0x3e5f('0x15')]);router['put'](_0x3e5f('0x16'),auth[_0x3e5f('0xa')](),controller['accept']);router[_0x3e5f('0x14')]('/:id/reject',auth[_0x3e5f('0xa')](),controller[_0x3e5f('0x17')]);router[_0x3e5f('0x18')](_0x3e5f('0xe'),auth[_0x3e5f('0xa')](),controller[_0x3e5f('0x19')]);module[_0x3e5f('0x1a')]=router; \ No newline at end of file +var _0x30c9=['path','connect-timeout','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x345215,_0x1f9713){var _0x30cab1=function(_0x5795fa){while(--_0x5795fa){_0x345215['push'](_0x345215['shift']());}};_0x30cab1(++_0x1f9713);}(_0x30c9,0x151));var _0x930c=function(_0x199d29,_0x446de7){_0x199d29=_0x199d29-0x0;var _0x2225b5=_0x30c9[_0x199d29];return _0x2225b5;};'use strict';var multer=require(_0x930c('0x0'));var util=require('util');var path=require(_0x930c('0x1'));var timeout=require(_0x930c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x930c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x930c('0x4'));var controller=require(_0x930c('0x5'));router[_0x930c('0x6')]('/',auth[_0x930c('0x7')](),controller[_0x930c('0x8')]);router[_0x930c('0x6')](_0x930c('0x9'),auth['isAuthenticated'](),controller[_0x930c('0xa')]);router[_0x930c('0x6')](_0x930c('0xb'),auth['isAuthenticated'](),controller[_0x930c('0xc')]);router[_0x930c('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x930c('0xe'),_0x930c('0xf')),controller[_0x930c('0x10')]);router[_0x930c('0x11')](_0x930c('0xb'),controller[_0x930c('0x12')]);router['put'](_0x930c('0x13'),auth[_0x930c('0x7')](),controller[_0x930c('0x14')]);router['put'](_0x930c('0x15'),auth[_0x930c('0x7')](),controller[_0x930c('0x16')]);router[_0x930c('0x17')](_0x930c('0xb'),auth['isAuthenticated'](),controller[_0x930c('0x18')]);module[_0x930c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 3b45ab5..0d1eb43 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 _0x3ced=['medium'];(function(_0x467672,_0x2e7b24){var _0xd5a08c=function(_0x19c519){while(--_0x19c519){_0x467672['push'](_0x467672['shift']());}};_0xd5a08c(++_0x2e7b24);}(_0x3ced,0x13d));var _0xd3ce=function(_0x337749,_0x5c527c){_0x337749=_0x337749-0x0;var _0x52c1ac=_0x3ced[_0x337749];return _0x52c1ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xd3ce('0x0')),'allowNull':![]}}; \ No newline at end of file +var _0xd3e2=['sequelize','exports','TEXT'];(function(_0x34b204,_0x175f04){var _0x321b29=function(_0x22fa4e){while(--_0x22fa4e){_0x34b204['push'](_0x34b204['shift']());}};_0x321b29(++_0x175f04);}(_0xd3e2,0xd2));var _0x2d3e=function(_0x5b54e3,_0xf0fac){_0x5b54e3=_0x5b54e3-0x0;var _0x72cd9b=_0xd3e2[_0x5b54e3];return _0x72cd9b;};'use strict';var Sequelize=require(_0x2d3e('0x0'));module[_0x2d3e('0x1')]={'body':{'type':Sequelize[_0x2d3e('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index cba5fcb..b7389fe 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 _0x8651=['fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','set','json','save','update','then','name','send','index','ChatOfflineMessage','rawAttributes'];(function(_0x20586d,_0x32ba4e){var _0x1395ab=function(_0x49d82a){while(--_0x49d82a){_0x20586d['push'](_0x20586d['shift']());}};_0x1395ab(++_0x32ba4e);}(_0x8651,0x142));var _0x1865=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x8651[_0x12fc8d];return _0x3f9d04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1865('0x0'));var rimraf=require(_0x1865('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1865('0x2'));var rp=require(_0x1865('0x3'));var moment=require(_0x1865('0x4'));var BPromise=require(_0x1865('0x5'));var Mustache=require(_0x1865('0x6'));var util=require(_0x1865('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1865('0x8'));var fs=require('fs');var _=require(_0x1865('0x9'));var squel=require(_0x1865('0xa'));var crypto=require(_0x1865('0xb'));var jsforce=require(_0x1865('0xc'));var deskjs=require(_0x1865('0xd'));var toCsv=require(_0x1865('0xe'));var querystring=require(_0x1865('0xf'));var Papa=require(_0x1865('0x10'));var Redis=require(_0x1865('0x11'));var authService=require(_0x1865('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1865('0x13'));var hardwareService=require(_0x1865('0x14'));var logger=require('../../config/logger')(_0x1865('0x15'));var utils=require('../../config/utils');var config=require(_0x1865('0x16'));var licenseUtil=require(_0x1865('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4975f3,_0x318bb){_0x318bb=_0x318bb||0xcc;return function(_0x2ffca4){if(_0x2ffca4){return _0x4975f3[_0x1865('0x18')](_0x318bb);}return _0x4975f3[_0x1865('0x19')](_0x318bb)[_0x1865('0x1a')]();};}function respondWithResult(_0x20593c,_0x1de292){_0x1de292=_0x1de292||0xc8;return function(_0x42a450){if(_0x42a450){return _0x20593c[_0x1865('0x19')](_0x1de292)['json'](_0x42a450);}};}function respondWithFilteredResult(_0x53ea6d,_0x1512f8){return function(_0x38cdb3){if(_0x38cdb3){var _0x42133d=_0x38cdb3['count'],_0x2295ab=_0x1512f8[_0x1865('0x1b')],_0x25d74f=_0x1512f8[_0x1865('0x1b')]+_0x1512f8['limit'],_0x804fa8;if(_0x25d74f>=_0x42133d){_0x25d74f=_0x42133d;_0x804fa8=0xc8;}else{_0x804fa8=0xce;}_0x53ea6d[_0x1865('0x19')](_0x804fa8);return _0x53ea6d[_0x1865('0x1c')]('Content-Range',_0x2295ab+'-'+_0x25d74f+'/'+_0x42133d)[_0x1865('0x1d')](_0x38cdb3);}return null;};}function patchUpdates(_0x281806){return function(_0x4e423a){try{jsonpatch['apply'](_0x4e423a,_0x281806,!![]);}catch(_0x16d186){return BPromise['reject'](_0x16d186);}return _0x4e423a[_0x1865('0x1e')]();};}function saveUpdates(_0x505b07,_0x2e5560){return function(_0x537ddb){if(_0x537ddb){return _0x537ddb[_0x1865('0x1f')](_0x505b07)[_0x1865('0x20')](function(_0x5e211f){return _0x5e211f;});}return null;};}function removeEntity(_0x5ab7fd,_0x4c385e){return function(_0x45588e){if(_0x45588e){return _0x45588e['destroy']()['then'](function(){_0x5ab7fd['status'](0xcc)[_0x1865('0x1a')]();});}};}function handleEntityNotFound(_0x8050b8,_0x2a5dad){return function(_0x19217f){if(!_0x19217f){_0x8050b8[_0x1865('0x18')](0x194);}return _0x19217f;};}function handleError(_0x4c7abe,_0x84bc19){_0x84bc19=_0x84bc19||0x1f4;return function(_0x404e1d){logger['error'](_0x404e1d['stack']);if(_0x404e1d['name']){delete _0x404e1d[_0x1865('0x21')];}_0x4c7abe[_0x1865('0x19')](_0x84bc19)[_0x1865('0x22')](_0x404e1d);};}exports[_0x1865('0x23')]=function(_0x5228a2,_0x37c27e){var _0x3c4207={},_0x41789e={},_0x2dcefb={'count':0x0,'rows':[]};var _0x18baea=_['map'](db[_0x1865('0x24')][_0x1865('0x25')],function(_0x4f799f){return{'name':_0x4f799f[_0x1865('0x26')],'type':_0x4f799f[_0x1865('0x27')][_0x1865('0x28')]};});_0x41789e[_0x1865('0x29')]=_[_0x1865('0x2a')](_0x18baea,_0x1865('0x21'));_0x41789e[_0x1865('0x2b')]=_['keys'](_0x5228a2['query']);_0x41789e[_0x1865('0x2c')]=_['intersection'](_0x41789e[_0x1865('0x29')],_0x41789e[_0x1865('0x2b')]);_0x3c4207[_0x1865('0x2d')]=_[_0x1865('0x2e')](_0x41789e[_0x1865('0x29')],qs[_0x1865('0x2f')](_0x5228a2['query'][_0x1865('0x2f')]));_0x3c4207[_0x1865('0x2d')]=_0x3c4207[_0x1865('0x2d')]['length']?_0x3c4207['attributes']:_0x41789e[_0x1865('0x29')];if(!_0x5228a2[_0x1865('0x2b')]['hasOwnProperty'](_0x1865('0x30'))){_0x3c4207[_0x1865('0x31')]=qs['limit'](_0x5228a2[_0x1865('0x2b')][_0x1865('0x31')]);_0x3c4207[_0x1865('0x1b')]=qs[_0x1865('0x1b')](_0x5228a2['query'][_0x1865('0x1b')]);}_0x3c4207[_0x1865('0x32')]=qs['sort'](_0x5228a2[_0x1865('0x2b')][_0x1865('0x33')]);_0x3c4207[_0x1865('0x34')]=qs[_0x1865('0x2c')](_[_0x1865('0x35')](_0x5228a2['query'],_0x41789e[_0x1865('0x2c')]),_0x18baea);if(_0x5228a2[_0x1865('0x2b')][_0x1865('0x36')]){_0x3c4207['where']=_[_0x1865('0x37')](_0x3c4207['where'],{'$or':_[_0x1865('0x2a')](_0x18baea,function(_0x2cd77b){if(_0x2cd77b[_0x1865('0x27')]!==_0x1865('0x38')){var _0x26a864={};_0x26a864[_0x2cd77b['name']]={'$like':'%'+_0x5228a2[_0x1865('0x2b')][_0x1865('0x36')]+'%'};return _0x26a864;}})});}_0x3c4207=_[_0x1865('0x37')]({},_0x3c4207,_0x5228a2[_0x1865('0x39')]);var _0x200aae={'where':_0x3c4207['where']};return db[_0x1865('0x24')][_0x1865('0x3a')](_0x200aae)[_0x1865('0x20')](function(_0x907e3b){_0x2dcefb[_0x1865('0x3a')]=_0x907e3b;if(_0x5228a2[_0x1865('0x2b')][_0x1865('0x3b')]){_0x3c4207[_0x1865('0x3c')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x1865('0x3d')](_0x3c4207);})[_0x1865('0x20')](function(_0x384d77){_0x2dcefb['rows']=_0x384d77;return _0x2dcefb;})['then'](respondWithFilteredResult(_0x37c27e,_0x3c4207))[_0x1865('0x3e')](handleError(_0x37c27e,null));};exports[_0x1865('0x3f')]=function(_0x54251b,_0x43947c){var _0x487f81={'raw':!![],'where':{'id':_0x54251b[_0x1865('0x40')]['id']}},_0x1113cf={};_0x1113cf['model']=_[_0x1865('0x41')](db[_0x1865('0x24')][_0x1865('0x25')]);_0x1113cf[_0x1865('0x2b')]=_[_0x1865('0x41')](_0x54251b['query']);_0x1113cf['filters']=_[_0x1865('0x2e')](_0x1113cf[_0x1865('0x29')],_0x1113cf['query']);_0x487f81['attributes']=_[_0x1865('0x2e')](_0x1113cf[_0x1865('0x29')],qs[_0x1865('0x2f')](_0x54251b[_0x1865('0x2b')][_0x1865('0x2f')]));_0x487f81['attributes']=_0x487f81[_0x1865('0x2d')][_0x1865('0x42')]?_0x487f81['attributes']:_0x1113cf['model'];if(_0x54251b['query'][_0x1865('0x3b')]){_0x487f81['include']=[{'all':!![]}];}_0x487f81=_[_0x1865('0x37')]({},_0x487f81,_0x54251b[_0x1865('0x39')]);return db[_0x1865('0x24')][_0x1865('0x43')](_0x487f81)[_0x1865('0x20')](handleEntityNotFound(_0x43947c,null))[_0x1865('0x20')](respondWithResult(_0x43947c,null))[_0x1865('0x3e')](handleError(_0x43947c,null));};exports[_0x1865('0x44')]=function(_0x5c943b,_0x465d39){return db['ChatOfflineMessage']['create'](_0x5c943b['body'],{})['then'](respondWithResult(_0x465d39,0xc9))[_0x1865('0x3e')](handleError(_0x465d39,null));};exports[_0x1865('0x1f')]=function(_0x3deda5,_0x5642bb){if(_0x3deda5[_0x1865('0x45')]['id']){delete _0x3deda5[_0x1865('0x45')]['id'];}return db[_0x1865('0x24')]['find']({'where':{'id':_0x3deda5['params']['id']}})[_0x1865('0x20')](handleEntityNotFound(_0x5642bb,null))[_0x1865('0x20')](saveUpdates(_0x3deda5[_0x1865('0x45')],null))[_0x1865('0x20')](respondWithResult(_0x5642bb,null))[_0x1865('0x3e')](handleError(_0x5642bb,null));};exports[_0x1865('0x46')]=function(_0x191c2a,_0x2fa6bb){return db[_0x1865('0x24')][_0x1865('0x43')]({'where':{'id':_0x191c2a[_0x1865('0x40')]['id']}})[_0x1865('0x20')](handleEntityNotFound(_0x2fa6bb,null))[_0x1865('0x20')](removeEntity(_0x2fa6bb,null))[_0x1865('0x3e')](handleError(_0x2fa6bb,null));};exports[_0x1865('0x47')]=function(_0x5c9fd1,_0x1653be){return db[_0x1865('0x24')][_0x1865('0x47')]()[_0x1865('0x20')](respondWithResult(_0x1653be,null))[_0x1865('0x3e')](handleError(_0x1653be,null));}; \ No newline at end of file +var _0x4808=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ChatOfflineMessage','includeAll','include','findAll','rows','show','fields','find','catch','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','stack','name','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','length'];(function(_0x3d1046,_0x1f03bc){var _0x37d1db=function(_0x1a5331){while(--_0x1a5331){_0x3d1046['push'](_0x3d1046['shift']());}};_0x37d1db(++_0x1f03bc);}(_0x4808,0x1cc));var _0x8480=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4808[_0x565c49];return _0x20ca34;};'use strict';var pdf=require(_0x8480('0x0'));var emlformat=require(_0x8480('0x1'));var rimraf=require(_0x8480('0x2'));var zipdir=require(_0x8480('0x3'));var jsonpatch=require(_0x8480('0x4'));var rp=require(_0x8480('0x5'));var moment=require(_0x8480('0x6'));var BPromise=require(_0x8480('0x7'));var Mustache=require(_0x8480('0x8'));var util=require(_0x8480('0x9'));var path=require(_0x8480('0xa'));var sox=require('sox');var csv=require(_0x8480('0xb'));var ejs=require(_0x8480('0xc'));var fs=require('fs');var _=require(_0x8480('0xd'));var squel=require(_0x8480('0xe'));var crypto=require(_0x8480('0xf'));var jsforce=require(_0x8480('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8480('0xb'));var querystring=require('querystring');var Papa=require(_0x8480('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8480('0x12'));var as=require(_0x8480('0x13'));var hardwareService=require(_0x8480('0x14'));var logger=require(_0x8480('0x15'))(_0x8480('0x16'));var utils=require(_0x8480('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8480('0x18'))['db'];function respondWithStatusCode(_0x1d592d,_0xf3afbc){_0xf3afbc=_0xf3afbc||0xcc;return function(_0x2cd226){if(_0x2cd226){return _0x1d592d[_0x8480('0x19')](_0xf3afbc);}return _0x1d592d['status'](_0xf3afbc)[_0x8480('0x1a')]();};}function respondWithResult(_0x3e09f0,_0x13a4bc){_0x13a4bc=_0x13a4bc||0xc8;return function(_0x5802a5){if(_0x5802a5){return _0x3e09f0[_0x8480('0x1b')](_0x13a4bc)[_0x8480('0x1c')](_0x5802a5);}};}function respondWithFilteredResult(_0x3b81b7,_0x48328b){return function(_0x4d6b59){if(_0x4d6b59){var _0x53ee62=_0x4d6b59[_0x8480('0x1d')],_0x3b0881=_0x48328b[_0x8480('0x1e')],_0x44ca0b=_0x48328b[_0x8480('0x1e')]+_0x48328b[_0x8480('0x1f')],_0x1ba07f;if(_0x44ca0b>=_0x53ee62){_0x44ca0b=_0x53ee62;_0x1ba07f=0xc8;}else{_0x1ba07f=0xce;}_0x3b81b7['status'](_0x1ba07f);return _0x3b81b7['set'](_0x8480('0x20'),_0x3b0881+'-'+_0x44ca0b+'/'+_0x53ee62)[_0x8480('0x1c')](_0x4d6b59);}return null;};}function patchUpdates(_0x4f7c81){return function(_0x38966c){try{jsonpatch['apply'](_0x38966c,_0x4f7c81,!![]);}catch(_0x119270){return BPromise[_0x8480('0x21')](_0x119270);}return _0x38966c[_0x8480('0x22')]();};}function saveUpdates(_0xd20acb,_0x4077cb){return function(_0x57bad4){if(_0x57bad4){return _0x57bad4['update'](_0xd20acb)[_0x8480('0x23')](function(_0x13298e){return _0x13298e;});}return null;};}function removeEntity(_0x2ad296,_0x5e96fd){return function(_0x3c3840){if(_0x3c3840){return _0x3c3840[_0x8480('0x24')]()[_0x8480('0x23')](function(){_0x2ad296['status'](0xcc)[_0x8480('0x1a')]();});}};}function handleEntityNotFound(_0xb74130,_0x218af7){return function(_0x5342f7){if(!_0x5342f7){_0xb74130['sendStatus'](0x194);}return _0x5342f7;};}function handleError(_0xaa7997,_0x5045f9){_0x5045f9=_0x5045f9||0x1f4;return function(_0x3b14e1){logger['error'](_0x3b14e1[_0x8480('0x25')]);if(_0x3b14e1[_0x8480('0x26')]){delete _0x3b14e1[_0x8480('0x26')];}_0xaa7997['status'](_0x5045f9)['send'](_0x3b14e1);};}exports[_0x8480('0x27')]=function(_0x521457,_0x171767){var _0x49dc7c={},_0x168874={},_0x4e3046={'count':0x0,'rows':[]};var _0xab138e=_[_0x8480('0x28')](db['ChatOfflineMessage'][_0x8480('0x29')],function(_0x4d742d){return{'name':_0x4d742d['fieldName'],'type':_0x4d742d[_0x8480('0x2a')][_0x8480('0x2b')]};});_0x168874[_0x8480('0x2c')]=_['map'](_0xab138e,_0x8480('0x26'));_0x168874['query']=_[_0x8480('0x2d')](_0x521457['query']);_0x168874[_0x8480('0x2e')]=_[_0x8480('0x2f')](_0x168874[_0x8480('0x2c')],_0x168874[_0x8480('0x30')]);_0x49dc7c[_0x8480('0x31')]=_['intersection'](_0x168874[_0x8480('0x2c')],qs['fields'](_0x521457[_0x8480('0x30')]['fields']));_0x49dc7c[_0x8480('0x31')]=_0x49dc7c['attributes'][_0x8480('0x32')]?_0x49dc7c['attributes']:_0x168874[_0x8480('0x2c')];if(!_0x521457[_0x8480('0x30')][_0x8480('0x33')](_0x8480('0x34'))){_0x49dc7c['limit']=qs[_0x8480('0x1f')](_0x521457[_0x8480('0x30')][_0x8480('0x1f')]);_0x49dc7c[_0x8480('0x1e')]=qs[_0x8480('0x1e')](_0x521457[_0x8480('0x30')][_0x8480('0x1e')]);}_0x49dc7c[_0x8480('0x35')]=qs['sort'](_0x521457[_0x8480('0x30')][_0x8480('0x36')]);_0x49dc7c[_0x8480('0x37')]=qs[_0x8480('0x2e')](_[_0x8480('0x38')](_0x521457[_0x8480('0x30')],_0x168874[_0x8480('0x2e')]),_0xab138e);if(_0x521457[_0x8480('0x30')][_0x8480('0x39')]){_0x49dc7c['where']=_['merge'](_0x49dc7c[_0x8480('0x37')],{'$or':_[_0x8480('0x28')](_0xab138e,function(_0x470df0){if(_0x470df0[_0x8480('0x2a')]!=='VIRTUAL'){var _0x431763={};_0x431763[_0x470df0[_0x8480('0x26')]]={'$like':'%'+_0x521457[_0x8480('0x30')][_0x8480('0x39')]+'%'};return _0x431763;}})});}_0x49dc7c=_[_0x8480('0x3a')]({},_0x49dc7c,_0x521457['options']);var _0x3cfe60={'where':_0x49dc7c[_0x8480('0x37')]};return db[_0x8480('0x3b')]['count'](_0x3cfe60)[_0x8480('0x23')](function(_0x5c52f6){_0x4e3046[_0x8480('0x1d')]=_0x5c52f6;if(_0x521457[_0x8480('0x30')][_0x8480('0x3c')]){_0x49dc7c[_0x8480('0x3d')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x8480('0x3e')](_0x49dc7c);})[_0x8480('0x23')](function(_0x5ca8de){_0x4e3046[_0x8480('0x3f')]=_0x5ca8de;return _0x4e3046;})[_0x8480('0x23')](respondWithFilteredResult(_0x171767,_0x49dc7c))['catch'](handleError(_0x171767,null));};exports[_0x8480('0x40')]=function(_0x6be22d,_0x4c38a1){var _0x158655={'raw':!![],'where':{'id':_0x6be22d['params']['id']}},_0x3e7a7c={};_0x3e7a7c['model']=_[_0x8480('0x2d')](db[_0x8480('0x3b')][_0x8480('0x29')]);_0x3e7a7c[_0x8480('0x30')]=_[_0x8480('0x2d')](_0x6be22d['query']);_0x3e7a7c[_0x8480('0x2e')]=_['intersection'](_0x3e7a7c[_0x8480('0x2c')],_0x3e7a7c[_0x8480('0x30')]);_0x158655[_0x8480('0x31')]=_[_0x8480('0x2f')](_0x3e7a7c[_0x8480('0x2c')],qs['fields'](_0x6be22d[_0x8480('0x30')][_0x8480('0x41')]));_0x158655['attributes']=_0x158655[_0x8480('0x31')][_0x8480('0x32')]?_0x158655[_0x8480('0x31')]:_0x3e7a7c[_0x8480('0x2c')];if(_0x6be22d[_0x8480('0x30')][_0x8480('0x3c')]){_0x158655[_0x8480('0x3d')]=[{'all':!![]}];}_0x158655=_[_0x8480('0x3a')]({},_0x158655,_0x6be22d['options']);return db['ChatOfflineMessage'][_0x8480('0x42')](_0x158655)[_0x8480('0x23')](handleEntityNotFound(_0x4c38a1,null))[_0x8480('0x23')](respondWithResult(_0x4c38a1,null))[_0x8480('0x43')](handleError(_0x4c38a1,null));};exports[_0x8480('0x44')]=function(_0x37b033,_0x1ac263){return db[_0x8480('0x3b')][_0x8480('0x44')](_0x37b033[_0x8480('0x45')],{})[_0x8480('0x23')](respondWithResult(_0x1ac263,0xc9))['catch'](handleError(_0x1ac263,null));};exports[_0x8480('0x46')]=function(_0x464747,_0x38e1e0){if(_0x464747[_0x8480('0x45')]['id']){delete _0x464747[_0x8480('0x45')]['id'];}return db[_0x8480('0x3b')][_0x8480('0x42')]({'where':{'id':_0x464747[_0x8480('0x47')]['id']}})[_0x8480('0x23')](handleEntityNotFound(_0x38e1e0,null))[_0x8480('0x23')](saveUpdates(_0x464747[_0x8480('0x45')],null))[_0x8480('0x23')](respondWithResult(_0x38e1e0,null))[_0x8480('0x43')](handleError(_0x38e1e0,null));};exports['destroy']=function(_0x45ee7c,_0x4c23d2){return db['ChatOfflineMessage']['find']({'where':{'id':_0x45ee7c[_0x8480('0x47')]['id']}})[_0x8480('0x23')](handleEntityNotFound(_0x4c23d2,null))['then'](removeEntity(_0x4c23d2,null))[_0x8480('0x43')](handleError(_0x4c23d2,null));};exports[_0x8480('0x48')]=function(_0xf6ae4e,_0x126f12){return db['ChatOfflineMessage'][_0x8480('0x48')]()[_0x8480('0x23')](respondWithResult(_0x126f12,null))['catch'](handleError(_0x126f12,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 723ff5e..da16c06 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 _0xb821=['../../config/logger','bluebird','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4863dc,_0xd6cecd){var _0x1e78a1=function(_0x563557){while(--_0x563557){_0x4863dc['push'](_0x4863dc['shift']());}};_0x1e78a1(++_0xd6cecd);}(_0xb821,0xa7));var _0x1b82=function(_0x227be5,_0x4452ac){_0x227be5=_0x227be5-0x0;var _0x50dcb1=_0xb821[_0x227be5];return _0x50dcb1;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1b82('0xa'),'collate':_0x1b82('0xb')});}; \ No newline at end of file +var _0x303a=['bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','lodash','../../config/logger','api','moment'];(function(_0x537773,_0x41d82b){var _0x35c0f0=function(_0x27da35){while(--_0x27da35){_0x537773['push'](_0x537773['shift']());}};_0x35c0f0(++_0x41d82b);}(_0x303a,0x1a0));var _0xa303=function(_0x55eb57,_0x1011e2){_0x55eb57=_0x55eb57-0x0;var _0x55ca29=_0x303a[_0x55eb57];return _0x55ca29;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index bc08697..92311d8 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 _0xe1ff=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3344f1,_0x54a676){var _0x50a21c=function(_0x2a2795){while(--_0x2a2795){_0x3344f1['push'](_0x3344f1['shift']());}};_0x50a21c(++_0x54a676);}(_0xe1ff,0xb7));var _0xfe1f=function(_0x551b64,_0x5402c2){_0x551b64=_0x551b64-0x0;var _0x445381=_0xe1ff[_0x551b64];return _0x445381;};'use strict';var _=require(_0xfe1f('0x0'));var util=require(_0xfe1f('0x1'));var moment=require(_0xfe1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe1f('0x3'));var fs=require('fs');var Redis=require(_0xfe1f('0x4'));var db=require(_0xfe1f('0x5'))['db'];var utils=require(_0xfe1f('0x6'));var logger=require('../../config/logger')(_0xfe1f('0x7'));var config=require(_0xfe1f('0x8'));var jayson=require(_0xfe1f('0x9'));var client=jayson[_0xfe1f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14da71,_0x1b28cd,_0x120222){return new BPromise(function(_0x10d422,_0xb01743){return client[_0xfe1f('0xb')](_0x14da71,_0x120222)[_0xfe1f('0xc')](function(_0x237b81){logger[_0xfe1f('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b28cd,'request\x20sent');logger[_0xfe1f('0xe')](_0xfe1f('0xf'),_0x1b28cd,_0xfe1f('0x10'),JSON['stringify'](_0x237b81));if(_0x237b81[_0xfe1f('0x11')]){if(_0x237b81[_0xfe1f('0x11')]['code']===0x1f4){logger[_0xfe1f('0x11')](_0xfe1f('0x12'),_0x1b28cd,_0x237b81[_0xfe1f('0x11')]['message']);return _0xb01743(_0x237b81[_0xfe1f('0x11')][_0xfe1f('0x13')]);}logger[_0xfe1f('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b28cd,_0x237b81[_0xfe1f('0x11')][_0xfe1f('0x13')]);return _0x10d422(_0x237b81[_0xfe1f('0x11')][_0xfe1f('0x13')]);}else{logger[_0xfe1f('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b28cd,_0xfe1f('0x10'));_0x10d422(_0x237b81['result'][_0xfe1f('0x13')]);}})[_0xfe1f('0x14')](function(_0x54f2b4){logger[_0xfe1f('0x11')](_0xfe1f('0x12'),_0x1b28cd,_0x54f2b4);_0xb01743(_0x54f2b4);});});} \ No newline at end of file +var _0xcdaa=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash'];(function(_0x4041a2,_0x175122){var _0x608ed0=function(_0x378828){while(--_0x378828){_0x4041a2['push'](_0x4041a2['shift']());}};_0x608ed0(++_0x175122);}(_0xcdaa,0xb3));var _0xacda=function(_0x38406a,_0x4e4e42){_0x38406a=_0x38406a-0x0;var _0x557292=_0xcdaa[_0x38406a];return _0x557292;};'use strict';var _=require(_0xacda('0x0'));var util=require('util');var moment=require(_0xacda('0x1'));var BPromise=require(_0xacda('0x2'));var rs=require(_0xacda('0x3'));var fs=require('fs');var Redis=require(_0xacda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xacda('0x5'));var logger=require(_0xacda('0x6'))('rpc');var config=require(_0xacda('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x201cf1,_0x5739bc,_0x31d0fa){return new BPromise(function(_0x269702,_0x41ad77){return client[_0xacda('0x8')](_0x201cf1,_0x31d0fa)[_0xacda('0x9')](function(_0x1713dc){logger[_0xacda('0xa')](_0xacda('0xb'),_0x5739bc,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5739bc,_0xacda('0xc'),JSON[_0xacda('0xd')](_0x1713dc));if(_0x1713dc['error']){if(_0x1713dc['error'][_0xacda('0xe')]===0x1f4){logger[_0xacda('0xf')](_0xacda('0xb'),_0x5739bc,_0x1713dc[_0xacda('0xf')][_0xacda('0x10')]);return _0x41ad77(_0x1713dc[_0xacda('0xf')]['message']);}logger[_0xacda('0xf')](_0xacda('0xb'),_0x5739bc,_0x1713dc[_0xacda('0xf')][_0xacda('0x10')]);return _0x269702(_0x1713dc['error'][_0xacda('0x10')]);}else{logger[_0xacda('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5739bc,'request\x20sent');_0x269702(_0x1713dc['result']['message']);}})[_0xacda('0x11')](function(_0x4a460b){logger[_0xacda('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5739bc,_0x4a460b);_0x41ad77(_0x4a460b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ed5580d..ce7d228 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 _0xbb76=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0x4350d3,_0x58b101){var _0x4a23ae=function(_0x4eb780){while(--_0x4eb780){_0x4350d3['push'](_0x4350d3['shift']());}};_0x4a23ae(++_0x58b101);}(_0xbb76,0x1e8));var _0x6bb7=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0xbb76[_0x55fb83];return _0x59a87a;};'use strict';var multer=require('multer');var util=require(_0x6bb7('0x0'));var path=require(_0x6bb7('0x1'));var timeout=require('connect-timeout');var express=require(_0x6bb7('0x2'));var router=express[_0x6bb7('0x3')]();var auth=require(_0x6bb7('0x4'));var interaction=require(_0x6bb7('0x5'));var config=require(_0x6bb7('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x6bb7('0x7')](),controller[_0x6bb7('0x8')]);router[_0x6bb7('0x9')](_0x6bb7('0xa'),auth[_0x6bb7('0x7')](),controller['describe']);router[_0x6bb7('0x9')](_0x6bb7('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6bb7('0x7')](),controller[_0x6bb7('0xc')]);router[_0x6bb7('0xd')](_0x6bb7('0xb'),auth[_0x6bb7('0x7')](),controller[_0x6bb7('0xe')]);router['delete'](_0x6bb7('0xb'),auth[_0x6bb7('0x7')](),controller[_0x6bb7('0xf')]);module[_0x6bb7('0x10')]=router; \ No newline at end of file +var _0x1de4=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x1de4,0xcb));var _0x41de=function(_0xeaa3bd,_0x166691){_0xeaa3bd=_0xeaa3bd-0x0;var _0x2e1174=_0x1de4[_0xeaa3bd];return _0x2e1174;};'use strict';var multer=require(_0x41de('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x41de('0x1'));var express=require(_0x41de('0x2'));var router=express[_0x41de('0x3')]();var auth=require(_0x41de('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x41de('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x41de('0x6')]('/',auth[_0x41de('0x7')](),controller['index']);router[_0x41de('0x6')](_0x41de('0x8'),auth[_0x41de('0x7')](),controller[_0x41de('0x9')]);router[_0x41de('0x6')](_0x41de('0xa'),auth[_0x41de('0x7')](),controller[_0x41de('0xb')]);router[_0x41de('0xc')]('/',auth[_0x41de('0x7')](),controller['create']);router['put'](_0x41de('0xa'),auth[_0x41de('0x7')](),controller[_0x41de('0xd')]);router[_0x41de('0xe')](_0x41de('0xa'),auth[_0x41de('0x7')](),controller[_0x41de('0xf')]);module[_0x41de('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1ea1fbb..b56c70a 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 _0x4af1=['STRING','INTEGER','sequelize','exports','ENUM','mouseOver','timeout'];(function(_0x2260e7,_0x784a7e){var _0x586c70=function(_0x588512){while(--_0x588512){_0x2260e7['push'](_0x2260e7['shift']());}};_0x586c70(++_0x784a7e);}(_0x4af1,0xe2));var _0x14af=function(_0x4b7809,_0x3f5749){_0x4b7809=_0x4b7809-0x0;var _0x5369af=_0x4af1[_0x4b7809];return _0x5369af;};'use strict';var Sequelize=require(_0x14af('0x0'));module[_0x14af('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x14af('0x2')](_0x14af('0x3'),_0x14af('0x4')),'defaultValue':_0x14af('0x3')},'selector':{'type':Sequelize[_0x14af('0x5')]},'timeout':{'type':Sequelize[_0x14af('0x6')]}}; \ No newline at end of file +var _0xc931=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x4773cf,_0x2aaf50){var _0x27eed0=function(_0x187ab2){while(--_0x187ab2){_0x4773cf['push'](_0x4773cf['shift']());}};_0x27eed0(++_0x2aaf50);}(_0xc931,0x92));var _0x1c93=function(_0x2db0d5,_0x21064c){_0x2db0d5=_0x2db0d5-0x0;var _0x26142f=_0xc931[_0x2db0d5];return _0x26142f;};'use strict';var Sequelize=require(_0x1c93('0x0'));module[_0x1c93('0x1')]={'name':{'type':Sequelize[_0x1c93('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1c93('0x3')](_0x1c93('0x4'),'timeout'),'defaultValue':_0x1c93('0x4')},'selector':{'type':Sequelize[_0x1c93('0x2')]},'timeout':{'type':Sequelize[_0x1c93('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index eacbca4..b0dee2d 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 _0xb48a=['offset','limit','set','apply','reject','save','update','then','error','name','send','show','params','keys','ChatProactiveAction','query','intersection','model','fields','attributes','length','include','options','find','create','body','catch','destroy','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x2ce43c,_0x283543){var _0x1c7b65=function(_0x4611d7){while(--_0x4611d7){_0x2ce43c['push'](_0x2ce43c['shift']());}};_0x1c7b65(++_0x283543);}(_0xb48a,0x8c));var _0xab48=function(_0x35da4a,_0x3e33ec){_0x35da4a=_0x35da4a-0x0;var _0x5d3674=_0xb48a[_0x35da4a];return _0x5d3674;};'use strict';var pdf=require(_0xab48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xab48('0x1'));var zipdir=require(_0xab48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab48('0x3'));var moment=require(_0xab48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab48('0x5'));var util=require(_0xab48('0x6'));var path=require('path');var sox=require(_0xab48('0x7'));var csv=require('to-csv');var ejs=require(_0xab48('0x8'));var fs=require('fs');var _=require(_0xab48('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab48('0xa'));var toCsv=require(_0xab48('0xb'));var querystring=require(_0xab48('0xc'));var Papa=require('papaparse');var Redis=require(_0xab48('0xd'));var authService=require(_0xab48('0xe'));var qs=require(_0xab48('0xf'));var as=require(_0xab48('0x10'));var hardwareService=require(_0xab48('0x11'));var logger=require(_0xab48('0x12'))(_0xab48('0x13'));var utils=require(_0xab48('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xab48('0x15'));var db=require(_0xab48('0x16'))['db'];function respondWithStatusCode(_0x8bf310,_0x4049b7){_0x4049b7=_0x4049b7||0xcc;return function(_0x1a49aa){if(_0x1a49aa){return _0x8bf310[_0xab48('0x17')](_0x4049b7);}return _0x8bf310[_0xab48('0x18')](_0x4049b7)[_0xab48('0x19')]();};}function respondWithResult(_0x304a74,_0x24387b){_0x24387b=_0x24387b||0xc8;return function(_0x1aa93a){if(_0x1aa93a){return _0x304a74[_0xab48('0x18')](_0x24387b)[_0xab48('0x1a')](_0x1aa93a);}};}function respondWithFilteredResult(_0x28ca2a,_0x319840){return function(_0x3117f6){if(_0x3117f6){var _0x57b102=_0x3117f6[_0xab48('0x1b')],_0x5d74e6=_0x319840[_0xab48('0x1c')],_0x1f5387=_0x319840['offset']+_0x319840[_0xab48('0x1d')],_0x20748a;if(_0x1f5387>=_0x57b102){_0x1f5387=_0x57b102;_0x20748a=0xc8;}else{_0x20748a=0xce;}_0x28ca2a[_0xab48('0x18')](_0x20748a);return _0x28ca2a[_0xab48('0x1e')]('Content-Range',_0x5d74e6+'-'+_0x1f5387+'/'+_0x57b102)[_0xab48('0x1a')](_0x3117f6);}return null;};}function patchUpdates(_0x46304c){return function(_0x1f7955){try{jsonpatch[_0xab48('0x1f')](_0x1f7955,_0x46304c,!![]);}catch(_0x174f22){return BPromise[_0xab48('0x20')](_0x174f22);}return _0x1f7955[_0xab48('0x21')]();};}function saveUpdates(_0x5df562,_0x47f792){return function(_0x62c105){if(_0x62c105){return _0x62c105[_0xab48('0x22')](_0x5df562)[_0xab48('0x23')](function(_0x42e404){return _0x42e404;});}return null;};}function removeEntity(_0x39ee7f,_0x7c3cda){return function(_0x1501a6){if(_0x1501a6){return _0x1501a6['destroy']()[_0xab48('0x23')](function(){_0x39ee7f[_0xab48('0x18')](0xcc)[_0xab48('0x19')]();});}};}function handleEntityNotFound(_0x5a3ef4,_0x13e2ff){return function(_0xb13ddb){if(!_0xb13ddb){_0x5a3ef4[_0xab48('0x17')](0x194);}return _0xb13ddb;};}function handleError(_0xb4bbf0,_0x5105e3){_0x5105e3=_0x5105e3||0x1f4;return function(_0x2953fe){logger[_0xab48('0x24')](_0x2953fe['stack']);if(_0x2953fe[_0xab48('0x25')]){delete _0x2953fe[_0xab48('0x25')];}_0xb4bbf0[_0xab48('0x18')](_0x5105e3)[_0xab48('0x26')](_0x2953fe);};}exports[_0xab48('0x27')]=function(_0x23879f,_0x24e944){var _0xefce6e={'raw':!![],'where':{'id':_0x23879f[_0xab48('0x28')]['id']}},_0x36747a={};_0x36747a['model']=_[_0xab48('0x29')](db[_0xab48('0x2a')]['rawAttributes']);_0x36747a[_0xab48('0x2b')]=_['keys'](_0x23879f[_0xab48('0x2b')]);_0x36747a['filters']=_[_0xab48('0x2c')](_0x36747a[_0xab48('0x2d')],_0x36747a[_0xab48('0x2b')]);_0xefce6e['attributes']=_[_0xab48('0x2c')](_0x36747a[_0xab48('0x2d')],qs['fields'](_0x23879f[_0xab48('0x2b')][_0xab48('0x2e')]));_0xefce6e[_0xab48('0x2f')]=_0xefce6e[_0xab48('0x2f')][_0xab48('0x30')]?_0xefce6e[_0xab48('0x2f')]:_0x36747a[_0xab48('0x2d')];if(_0x23879f[_0xab48('0x2b')]['includeAll']){_0xefce6e[_0xab48('0x31')]=[{'all':!![]}];}_0xefce6e=_['merge']({},_0xefce6e,_0x23879f[_0xab48('0x32')]);return db[_0xab48('0x2a')][_0xab48('0x33')](_0xefce6e)['then'](handleEntityNotFound(_0x24e944,null))[_0xab48('0x23')](respondWithResult(_0x24e944,null))['catch'](handleError(_0x24e944,null));};exports[_0xab48('0x34')]=function(_0x158a3d,_0x21343b){return db[_0xab48('0x2a')][_0xab48('0x34')](_0x158a3d[_0xab48('0x35')],{})[_0xab48('0x23')](respondWithResult(_0x21343b,0xc9))[_0xab48('0x36')](handleError(_0x21343b,null));};exports['update']=function(_0x1d7abb,_0x4c9931){if(_0x1d7abb[_0xab48('0x35')]['id']){delete _0x1d7abb[_0xab48('0x35')]['id'];}return db[_0xab48('0x2a')][_0xab48('0x33')]({'where':{'id':_0x1d7abb[_0xab48('0x28')]['id']}})[_0xab48('0x23')](handleEntityNotFound(_0x4c9931,null))[_0xab48('0x23')](saveUpdates(_0x1d7abb[_0xab48('0x35')],null))[_0xab48('0x23')](respondWithResult(_0x4c9931,null))['catch'](handleError(_0x4c9931,null));};exports[_0xab48('0x37')]=function(_0x4e4727,_0x1a75d5){return db['ChatProactiveAction'][_0xab48('0x33')]({'where':{'id':_0x4e4727[_0xab48('0x28')]['id']}})[_0xab48('0x23')](handleEntityNotFound(_0x1a75d5,null))[_0xab48('0x23')](removeEntity(_0x1a75d5,null))[_0xab48('0x36')](handleError(_0x1a75d5,null));}; \ No newline at end of file +var _0x6463=['destroy','then','sendStatus','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','Content-Range','save','update'];(function(_0x5d6f1f,_0x30261b){var _0x2ef073=function(_0x549769){while(--_0x549769){_0x5d6f1f['push'](_0x5d6f1f['shift']());}};_0x2ef073(++_0x30261b);}(_0x6463,0x14f));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3646('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3646('0x1'));var zipdir=require(_0x3646('0x2'));var jsonpatch=require(_0x3646('0x3'));var rp=require(_0x3646('0x4'));var moment=require(_0x3646('0x5'));var BPromise=require(_0x3646('0x6'));var Mustache=require(_0x3646('0x7'));var util=require(_0x3646('0x8'));var path=require(_0x3646('0x9'));var sox=require(_0x3646('0xa'));var csv=require(_0x3646('0xb'));var ejs=require(_0x3646('0xc'));var fs=require('fs');var _=require(_0x3646('0xd'));var squel=require(_0x3646('0xe'));var crypto=require(_0x3646('0xf'));var jsforce=require(_0x3646('0x10'));var deskjs=require(_0x3646('0x11'));var toCsv=require(_0x3646('0xb'));var querystring=require(_0x3646('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3646('0x13'));var qs=require(_0x3646('0x14'));var as=require(_0x3646('0x15'));var hardwareService=require(_0x3646('0x16'));var logger=require(_0x3646('0x17'))(_0x3646('0x18'));var utils=require(_0x3646('0x19'));var config=require(_0x3646('0x1a'));var licenseUtil=require(_0x3646('0x1b'));var db=require(_0x3646('0x1c'))['db'];function respondWithStatusCode(_0xcda7f0,_0x1aba0a){_0x1aba0a=_0x1aba0a||0xcc;return function(_0x3c4598){if(_0x3c4598){return _0xcda7f0['sendStatus'](_0x1aba0a);}return _0xcda7f0[_0x3646('0x1d')](_0x1aba0a)[_0x3646('0x1e')]();};}function respondWithResult(_0x5528c2,_0xf6b8f5){_0xf6b8f5=_0xf6b8f5||0xc8;return function(_0x4d8d9a){if(_0x4d8d9a){return _0x5528c2[_0x3646('0x1d')](_0xf6b8f5)[_0x3646('0x1f')](_0x4d8d9a);}};}function respondWithFilteredResult(_0x5078a6,_0x34e4f7){return function(_0x43960d){if(_0x43960d){var _0x4832a0=_0x43960d[_0x3646('0x20')],_0x22c0d8=_0x34e4f7['offset'],_0x4b5374=_0x34e4f7['offset']+_0x34e4f7[_0x3646('0x21')],_0x1fd0fe;if(_0x4b5374>=_0x4832a0){_0x4b5374=_0x4832a0;_0x1fd0fe=0xc8;}else{_0x1fd0fe=0xce;}_0x5078a6['status'](_0x1fd0fe);return _0x5078a6['set'](_0x3646('0x22'),_0x22c0d8+'-'+_0x4b5374+'/'+_0x4832a0)[_0x3646('0x1f')](_0x43960d);}return null;};}function patchUpdates(_0x2a834c){return function(_0x2611c2){try{jsonpatch['apply'](_0x2611c2,_0x2a834c,!![]);}catch(_0x11566d){return BPromise['reject'](_0x11566d);}return _0x2611c2[_0x3646('0x23')]();};}function saveUpdates(_0x20e60f,_0x49bf0c){return function(_0xb0b39d){if(_0xb0b39d){return _0xb0b39d[_0x3646('0x24')](_0x20e60f)['then'](function(_0x534b20){return _0x534b20;});}return null;};}function removeEntity(_0x3581c0,_0x4655b4){return function(_0x32b239){if(_0x32b239){return _0x32b239[_0x3646('0x25')]()[_0x3646('0x26')](function(){_0x3581c0[_0x3646('0x1d')](0xcc)[_0x3646('0x1e')]();});}};}function handleEntityNotFound(_0x1b7706,_0x1a281f){return function(_0x60ffee){if(!_0x60ffee){_0x1b7706[_0x3646('0x27')](0x194);}return _0x60ffee;};}function handleError(_0x19539a,_0x1aaf4d){_0x1aaf4d=_0x1aaf4d||0x1f4;return function(_0x1bc088){logger['error'](_0x1bc088[_0x3646('0x28')]);if(_0x1bc088[_0x3646('0x29')]){delete _0x1bc088['name'];}_0x19539a['status'](_0x1aaf4d)[_0x3646('0x2a')](_0x1bc088);};}exports[_0x3646('0x2b')]=function(_0x4f9347,_0x359dee){var _0x3033e2={'raw':!![],'where':{'id':_0x4f9347[_0x3646('0x2c')]['id']}},_0x119002={};_0x119002[_0x3646('0x2d')]=_[_0x3646('0x2e')](db[_0x3646('0x2f')][_0x3646('0x30')]);_0x119002['query']=_[_0x3646('0x2e')](_0x4f9347[_0x3646('0x31')]);_0x119002[_0x3646('0x32')]=_[_0x3646('0x33')](_0x119002[_0x3646('0x2d')],_0x119002['query']);_0x3033e2[_0x3646('0x34')]=_[_0x3646('0x33')](_0x119002[_0x3646('0x2d')],qs[_0x3646('0x35')](_0x4f9347['query'][_0x3646('0x35')]));_0x3033e2[_0x3646('0x34')]=_0x3033e2[_0x3646('0x34')][_0x3646('0x36')]?_0x3033e2[_0x3646('0x34')]:_0x119002[_0x3646('0x2d')];if(_0x4f9347[_0x3646('0x31')][_0x3646('0x37')]){_0x3033e2['include']=[{'all':!![]}];}_0x3033e2=_[_0x3646('0x38')]({},_0x3033e2,_0x4f9347[_0x3646('0x39')]);return db['ChatProactiveAction']['find'](_0x3033e2)[_0x3646('0x26')](handleEntityNotFound(_0x359dee,null))['then'](respondWithResult(_0x359dee,null))[_0x3646('0x3a')](handleError(_0x359dee,null));};exports[_0x3646('0x3b')]=function(_0x311d29,_0x3c7321){return db[_0x3646('0x2f')][_0x3646('0x3b')](_0x311d29['body'],{})[_0x3646('0x26')](respondWithResult(_0x3c7321,0xc9))[_0x3646('0x3a')](handleError(_0x3c7321,null));};exports[_0x3646('0x24')]=function(_0x5485bc,_0xd7cfc5){if(_0x5485bc[_0x3646('0x3c')]['id']){delete _0x5485bc[_0x3646('0x3c')]['id'];}return db[_0x3646('0x2f')]['find']({'where':{'id':_0x5485bc[_0x3646('0x2c')]['id']}})[_0x3646('0x26')](handleEntityNotFound(_0xd7cfc5,null))['then'](saveUpdates(_0x5485bc[_0x3646('0x3c')],null))[_0x3646('0x26')](respondWithResult(_0xd7cfc5,null))[_0x3646('0x3a')](handleError(_0xd7cfc5,null));};exports['destroy']=function(_0x519190,_0x21e7d0){return db[_0x3646('0x2f')][_0x3646('0x3d')]({'where':{'id':_0x519190[_0x3646('0x2c')]['id']}})[_0x3646('0x26')](handleEntityNotFound(_0x21e7d0,null))['then'](removeEntity(_0x21e7d0,null))[_0x3646('0x3a')](handleError(_0x21e7d0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 617e292..5c85a0c 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 _0x67d7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0xa81d9d,_0x154de3){var _0x1e81bd=function(_0x3a476f){while(--_0x3a476f){_0xa81d9d['push'](_0xa81d9d['shift']());}};_0x1e81bd(++_0x154de3);}(_0x67d7,0x11b));var _0x767d=function(_0x46ca3d,_0x360bad){_0x46ca3d=_0x46ca3d-0x0;var _0x3c195e=_0x67d7[_0x46ca3d];return _0x3c195e;};'use strict';var _=require(_0x767d('0x0'));var util=require(_0x767d('0x1'));var logger=require(_0x767d('0x2'))('api');var moment=require(_0x767d('0x3'));var BPromise=require(_0x767d('0x4'));var rp=require(_0x767d('0x5'));var fs=require('fs');var path=require(_0x767d('0x6'));var rimraf=require(_0x767d('0x7'));var config=require(_0x767d('0x8'));var attributes=require(_0x767d('0x9'));module[_0x767d('0xa')]=function(_0x78bbd3,_0x5089d6){return _0x78bbd3[_0x767d('0xb')]('ChatProactiveAction',attributes,{'tableName':_0x767d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0676=['api','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger'];(function(_0x2a818f,_0x4fcd91){var _0x3ffb31=function(_0x3f0754){while(--_0x3f0754){_0x2a818f['push'](_0x2a818f['shift']());}};_0x3ffb31(++_0x4fcd91);}(_0x0676,0x1d1));var _0x6067=function(_0x4f13fb,_0x3c7d1c){_0x4f13fb=_0x4f13fb-0x0;var _0x7a3072=_0x0676[_0x4f13fb];return _0x7a3072;};'use strict';var _=require(_0x6067('0x0'));var util=require(_0x6067('0x1'));var logger=require(_0x6067('0x2'))(_0x6067('0x3'));var moment=require(_0x6067('0x4'));var BPromise=require(_0x6067('0x5'));var rp=require(_0x6067('0x6'));var fs=require('fs');var path=require(_0x6067('0x7'));var rimraf=require(_0x6067('0x8'));var config=require('../../config/environment');var attributes=require(_0x6067('0x9'));module[_0x6067('0xa')]=function(_0x3b52c2,_0x7d9ca6){return _0x3b52c2[_0x6067('0xb')](_0x6067('0xc'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 0d42668..9af2a1f 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 _0x89b7=['client','then','request\x20sent','debug','error','ChatProactiveAction,\x20%s,\x20%s','message','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x56cb76,_0x18c69a){var _0x2da2a7=function(_0x178b66){while(--_0x178b66){_0x56cb76['push'](_0x56cb76['shift']());}};_0x2da2a7(++_0x18c69a);}(_0x89b7,0xe8));var _0x789b=function(_0x576297,_0xf0286a){_0x576297=_0x576297-0x0;var _0x4e8e98=_0x89b7[_0x576297];return _0x4e8e98;};'use strict';var _=require('lodash');var util=require(_0x789b('0x0'));var moment=require(_0x789b('0x1'));var BPromise=require(_0x789b('0x2'));var rs=require(_0x789b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x789b('0x4'))['db'];var utils=require(_0x789b('0x5'));var logger=require(_0x789b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x789b('0x7'));var client=jayson[_0x789b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e71ad,_0x4c9729,_0x5e4f5){return new BPromise(function(_0x3aba5d,_0x583272){return client['request'](_0x1e71ad,_0x5e4f5)[_0x789b('0x9')](function(_0x31637d){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4c9729,_0x789b('0xa'));logger[_0x789b('0xb')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4c9729,_0x789b('0xa'),JSON['stringify'](_0x31637d));if(_0x31637d[_0x789b('0xc')]){if(_0x31637d[_0x789b('0xc')]['code']===0x1f4){logger['error'](_0x789b('0xd'),_0x4c9729,_0x31637d[_0x789b('0xc')][_0x789b('0xe')]);return _0x583272(_0x31637d['error'][_0x789b('0xe')]);}logger[_0x789b('0xc')](_0x789b('0xd'),_0x4c9729,_0x31637d[_0x789b('0xc')]['message']);return _0x3aba5d(_0x31637d[_0x789b('0xc')]['message']);}else{logger[_0x789b('0xf')](_0x789b('0xd'),_0x4c9729,_0x789b('0xa'));_0x3aba5d(_0x31637d['result'][_0x789b('0xe')]);}})['catch'](function(_0x54ba79){logger[_0x789b('0xc')](_0x789b('0xd'),_0x4c9729,_0x54ba79);_0x583272(_0x54ba79);});});} \ No newline at end of file +var _0x73be=['../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x39610b,_0x1d20d4){var _0x413830=function(_0x5d1cac){while(--_0x5d1cac){_0x39610b['push'](_0x39610b['shift']());}};_0x413830(++_0x1d20d4);}(_0x73be,0x124));var _0xe73b=function(_0x377a1d,_0x20bb23){_0x377a1d=_0x377a1d-0x0;var _0x5bbf3f=_0x73be[_0x377a1d];return _0x5bbf3f;};'use strict';var _=require('lodash');var util=require(_0xe73b('0x0'));var moment=require(_0xe73b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe73b('0x2'));var db=require(_0xe73b('0x3'))['db'];var utils=require(_0xe73b('0x4'));var logger=require(_0xe73b('0x5'))(_0xe73b('0x6'));var config=require(_0xe73b('0x7'));var jayson=require(_0xe73b('0x8'));var client=jayson[_0xe73b('0x9')][_0xe73b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372adb,_0x59619d,_0x19fca5){return new BPromise(function(_0x5b3a5c,_0x24459f){return client[_0xe73b('0xb')](_0x372adb,_0x19fca5)['then'](function(_0x90e43a){logger['info'](_0xe73b('0xc'),_0x59619d,_0xe73b('0xd'));logger[_0xe73b('0xe')](_0xe73b('0xf'),_0x59619d,_0xe73b('0xd'),JSON[_0xe73b('0x10')](_0x90e43a));if(_0x90e43a[_0xe73b('0x11')]){if(_0x90e43a[_0xe73b('0x11')][_0xe73b('0x12')]===0x1f4){logger['error'](_0xe73b('0xc'),_0x59619d,_0x90e43a[_0xe73b('0x11')]['message']);return _0x24459f(_0x90e43a[_0xe73b('0x11')][_0xe73b('0x13')]);}logger[_0xe73b('0x11')](_0xe73b('0xc'),_0x59619d,_0x90e43a[_0xe73b('0x11')][_0xe73b('0x13')]);return _0x5b3a5c(_0x90e43a[_0xe73b('0x11')][_0xe73b('0x13')]);}else{logger[_0xe73b('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x59619d,_0xe73b('0xd'));_0x5b3a5c(_0x90e43a[_0xe73b('0x15')][_0xe73b('0x13')]);}})[_0xe73b('0x16')](function(_0x3bc4d4){logger[_0xe73b('0x11')](_0xe73b('0xc'),_0x59619d,_0x3bc4d4);_0x24459f(_0x3bc4d4);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 910be32..5631f68 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 _0x3291=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x205fe4,_0x1fed50){var _0x566247=function(_0x4eca64){while(--_0x4eca64){_0x205fe4['push'](_0x205fe4['shift']());}};_0x566247(++_0x1fed50);}(_0x3291,0x1cb));var _0x1329=function(_0x1a12ba,_0x34cbf8){_0x1a12ba=_0x1a12ba-0x0;var _0x18bead=_0x3291[_0x1a12ba];return _0x18bead;};'use strict';var multer=require(_0x1329('0x0'));var util=require(_0x1329('0x1'));var path=require(_0x1329('0x2'));var timeout=require('connect-timeout');var express=require(_0x1329('0x3'));var router=express[_0x1329('0x4')]();var auth=require(_0x1329('0x5'));var interaction=require(_0x1329('0x6'));var config=require(_0x1329('0x7'));var controller=require(_0x1329('0x8'));router['get']('/:id',auth[_0x1329('0x9')](),controller[_0x1329('0xa')]);router[_0x1329('0xb')]('/',auth[_0x1329('0x9')](),controller[_0x1329('0xc')]);router[_0x1329('0xd')](_0x1329('0xe'),auth[_0x1329('0x9')](),controller[_0x1329('0xf')]);router[_0x1329('0x10')]('/:id',auth[_0x1329('0x9')](),controller[_0x1329('0x11')]);module[_0x1329('0x12')]=router; \ No newline at end of file +var _0x1c88=['show','post','create','put','delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1c88,0x1a9));var _0x81c8=function(_0x129c27,_0x333c44){_0x129c27=_0x129c27-0x0;var _0x5a8017=_0x1c88[_0x129c27];return _0x5a8017;};'use strict';var multer=require(_0x81c8('0x0'));var util=require('util');var path=require(_0x81c8('0x1'));var timeout=require(_0x81c8('0x2'));var express=require(_0x81c8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x81c8('0x4'));var config=require(_0x81c8('0x5'));var controller=require(_0x81c8('0x6'));router[_0x81c8('0x7')](_0x81c8('0x8'),auth[_0x81c8('0x9')](),controller[_0x81c8('0xa')]);router[_0x81c8('0xb')]('/',auth[_0x81c8('0x9')](),controller[_0x81c8('0xc')]);router[_0x81c8('0xd')](_0x81c8('0x8'),auth[_0x81c8('0x9')](),controller['update']);router[_0x81c8('0xe')](_0x81c8('0x8'),auth[_0x81c8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 164a5ed..3e1df85 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 _0x8f67=['beepall','roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8f67,0xb1));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x78f6('0x1')],'unique':_0x78f6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x78f6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x78f6('0x4'),_0x78f6('0x5'),_0x78f6('0x6'))}}; \ No newline at end of file +var _0xac22=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x2e1af3,_0x2a077b){var _0x4150cd=function(_0x1e08f3){while(--_0x1e08f3){_0x2e1af3['push'](_0x2e1af3['shift']());}};_0x4150cd(++_0x2a077b);}(_0xac22,0x1da));var _0x2ac2=function(_0x2e65ad,_0x2c2d4b){_0x2e65ad=_0x2e65ad-0x0;var _0x4968ff=_0xac22[_0x2e65ad];return _0x4968ff;};'use strict';var Sequelize=require('sequelize');module[_0x2ac2('0x0')]={'name':{'type':Sequelize[_0x2ac2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2ac2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2ac2('0x3')](_0x2ac2('0x4'),_0x2ac2('0x5'),_0x2ac2('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f98e846..900e2b5 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 _0x2649=['merge','includeAll','include','findAll','show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','union','compact','value','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','get','destroy','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2649,0xe2));var _0x9264=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x2649[_0xcf5436];return _0xc4f5c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9264('0x0'));var rimraf=require(_0x9264('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9264('0x2'));var rp=require(_0x9264('0x3'));var moment=require(_0x9264('0x4'));var BPromise=require(_0x9264('0x5'));var Mustache=require('mustache');var util=require(_0x9264('0x6'));var path=require(_0x9264('0x7'));var sox=require('sox');var csv=require(_0x9264('0x8'));var ejs=require(_0x9264('0x9'));var fs=require('fs');var _=require(_0x9264('0xa'));var squel=require(_0x9264('0xb'));var crypto=require(_0x9264('0xc'));var jsforce=require(_0x9264('0xd'));var deskjs=require(_0x9264('0xe'));var toCsv=require(_0x9264('0x8'));var querystring=require(_0x9264('0xf'));var Papa=require(_0x9264('0x10'));var Redis=require(_0x9264('0x11'));var authService=require(_0x9264('0x12'));var qs=require(_0x9264('0x13'));var as=require(_0x9264('0x14'));var hardwareService=require(_0x9264('0x15'));var logger=require(_0x9264('0x16'))(_0x9264('0x17'));var utils=require(_0x9264('0x18'));var config=require(_0x9264('0x19'));var licenseUtil=require(_0x9264('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9264('0x1b')]=_[_0x9264('0x1c')](config['redis'],{'host':_0x9264('0x1d'),'port':0x18eb});var socket=require(_0x9264('0x1e'))(new Redis(config[_0x9264('0x1b')]));require(_0x9264('0x1f'))[_0x9264('0x20')](socket);var jayson=require(_0x9264('0x21'));var client=jayson['client'][_0x9264('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x35fbfc,_0x366dfc,_0x59533f,_0x2e0800){return new BPromise(function(_0x5b2373,_0x16c4d6){var _0x20cc0c=_0x2e0800||client;return _0x20cc0c[_0x9264('0x23')](_0x35fbfc,_0x59533f)[_0x9264('0x24')](function(_0x2902f6){logger[_0x9264('0x25')]('ChatQueue,\x20%s,\x20%s',_0x366dfc,_0x9264('0x26'));logger[_0x9264('0x27')](_0x9264('0x28'),_0x366dfc,'request\x20sent',JSON['stringify'](_0x2902f6));if(_0x2902f6['error']){if(_0x2902f6[_0x9264('0x29')]['code']===0x1f4){logger[_0x9264('0x29')](_0x9264('0x2a'),_0x366dfc,_0x2902f6['error'][_0x9264('0x2b')]);return _0x16c4d6(_0x2902f6[_0x9264('0x29')][_0x9264('0x2b')]);}logger[_0x9264('0x29')](_0x9264('0x2a'),_0x366dfc,_0x2902f6[_0x9264('0x29')][_0x9264('0x2b')]);return _0x5b2373(_0x2902f6[_0x9264('0x29')]['message']);}else{logger[_0x9264('0x25')](_0x9264('0x2a'),_0x366dfc,_0x9264('0x26'));_0x5b2373(_0x2902f6[_0x9264('0x2c')][_0x9264('0x2b')]);}})[_0x9264('0x2d')](function(_0x5964a8){logger[_0x9264('0x29')]('ChatQueue,\x20%s,\x20%s',_0x366dfc,_0x5964a8);_0x16c4d6(_0x5964a8);});});}function respondWithStatusCode(_0xc917c2,_0x9005b1){_0x9005b1=_0x9005b1||0xcc;return function(_0x25efde){if(_0x25efde){return _0xc917c2[_0x9264('0x2e')](_0x9005b1);}return _0xc917c2[_0x9264('0x2f')](_0x9005b1)[_0x9264('0x30')]();};}function respondWithResult(_0x4aa38,_0x947158){_0x947158=_0x947158||0xc8;return function(_0x55f07d){if(_0x55f07d){return _0x4aa38[_0x9264('0x2f')](_0x947158)[_0x9264('0x31')](_0x55f07d);}};}function respondWithFilteredResult(_0x432c28,_0x1e1f9d){return function(_0x104bf1){if(_0x104bf1){var _0x1c839b=_0x104bf1[_0x9264('0x32')],_0x21fe8a=_0x1e1f9d['offset'],_0x2900b0=_0x1e1f9d[_0x9264('0x33')]+_0x1e1f9d['limit'],_0x1c2673;if(_0x2900b0>=_0x1c839b){_0x2900b0=_0x1c839b;_0x1c2673=0xc8;}else{_0x1c2673=0xce;}_0x432c28['status'](_0x1c2673);return _0x432c28[_0x9264('0x34')](_0x9264('0x35'),_0x21fe8a+'-'+_0x2900b0+'/'+_0x1c839b)[_0x9264('0x31')](_0x104bf1);}return null;};}function patchUpdates(_0x258e9a){return function(_0x2e7c4e){try{jsonpatch[_0x9264('0x36')](_0x2e7c4e,_0x258e9a,!![]);}catch(_0x2d862b){return BPromise[_0x9264('0x37')](_0x2d862b);}return _0x2e7c4e[_0x9264('0x38')]();};}function saveUpdates(_0x3403de,_0x2f8a05){return function(_0x30754e){if(_0x30754e){return _0x30754e[_0x9264('0x39')](_0x3403de)[_0x9264('0x24')](function(_0x3c3662){return _0x3c3662;});}return null;};}function removeEntity(_0x771c81,_0x53e95c){return function(_0x372364){if(_0x372364){return _0x372364['destroy']()[_0x9264('0x24')](function(){var _0x3118c6=_0x372364[_0x9264('0x3a')]({'plain':!![]});var _0x5e6f72='ChatQueues';return db['UserProfileResource'][_0x9264('0x3b')]({'where':{'type':_0x5e6f72,'resourceId':_0x3118c6['id']}})['then'](function(){return _0x372364;});})['then'](function(){_0x771c81[_0x9264('0x2f')](0xcc)[_0x9264('0x30')]();});}};}function handleEntityNotFound(_0x1e1c78,_0x4350be){return function(_0x50a749){if(!_0x50a749){_0x1e1c78[_0x9264('0x2e')](0x194);}return _0x50a749;};}function handleError(_0x136112,_0x80da62){_0x80da62=_0x80da62||0x1f4;return function(_0xbd0058){logger['error'](_0xbd0058['stack']);if(_0xbd0058['name']){delete _0xbd0058[_0x9264('0x3c')];}_0x136112[_0x9264('0x2f')](_0x80da62)[_0x9264('0x3d')](_0xbd0058);};}exports[_0x9264('0x3e')]=function(_0x5a65a3,_0x420810){var _0x52553f={},_0x1e87ee={},_0x225ad3={'count':0x0,'rows':[]};var _0x230a77=_[_0x9264('0x3f')](db[_0x9264('0x40')][_0x9264('0x41')],function(_0x539c39){return{'name':_0x539c39[_0x9264('0x42')],'type':_0x539c39[_0x9264('0x43')][_0x9264('0x44')]};});_0x1e87ee[_0x9264('0x45')]=_[_0x9264('0x3f')](_0x230a77,_0x9264('0x3c'));_0x1e87ee[_0x9264('0x46')]=_[_0x9264('0x47')](_0x5a65a3[_0x9264('0x46')]);_0x1e87ee[_0x9264('0x48')]=_[_0x9264('0x49')](_0x1e87ee[_0x9264('0x45')],_0x1e87ee[_0x9264('0x46')]);_0x52553f[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x1e87ee[_0x9264('0x45')],qs[_0x9264('0x4b')](_0x5a65a3[_0x9264('0x46')][_0x9264('0x4b')]));_0x52553f[_0x9264('0x4a')]=_0x52553f[_0x9264('0x4a')][_0x9264('0x4c')]?_0x52553f['attributes']:_0x1e87ee[_0x9264('0x45')];if(!_0x5a65a3[_0x9264('0x46')]['hasOwnProperty'](_0x9264('0x4d'))){_0x52553f[_0x9264('0x4e')]=qs['limit'](_0x5a65a3['query'][_0x9264('0x4e')]);_0x52553f['offset']=qs[_0x9264('0x33')](_0x5a65a3['query'][_0x9264('0x33')]);}_0x52553f[_0x9264('0x4f')]=qs[_0x9264('0x50')](_0x5a65a3[_0x9264('0x46')][_0x9264('0x50')]);_0x52553f['where']=qs['filters'](_[_0x9264('0x51')](_0x5a65a3[_0x9264('0x46')],_0x1e87ee[_0x9264('0x48')]),_0x230a77);if(_0x5a65a3[_0x9264('0x46')][_0x9264('0x52')]){_0x52553f[_0x9264('0x53')]=_['merge'](_0x52553f['where'],{'$or':_[_0x9264('0x3f')](_0x230a77,function(_0x2aef87){if(_0x2aef87[_0x9264('0x43')]!=='VIRTUAL'){var _0x53411f={};_0x53411f[_0x2aef87[_0x9264('0x3c')]]={'$like':'%'+_0x5a65a3[_0x9264('0x46')][_0x9264('0x52')]+'%'};return _0x53411f;}})});}_0x52553f=_[_0x9264('0x54')]({},_0x52553f,_0x5a65a3['options']);var _0x3c5523={'where':_0x52553f[_0x9264('0x53')]};return db[_0x9264('0x40')][_0x9264('0x32')](_0x3c5523)['then'](function(_0x1b80b8){_0x225ad3[_0x9264('0x32')]=_0x1b80b8;if(_0x5a65a3[_0x9264('0x46')][_0x9264('0x55')]){_0x52553f[_0x9264('0x56')]=[{'all':!![]}];}return db[_0x9264('0x40')][_0x9264('0x57')](_0x52553f);})[_0x9264('0x24')](function(_0x16dec0){_0x225ad3['rows']=_0x16dec0;return _0x225ad3;})[_0x9264('0x24')](respondWithFilteredResult(_0x420810,_0x52553f))['catch'](handleError(_0x420810,null));};exports[_0x9264('0x58')]=function(_0x5a931f,_0x1cc162){var _0x1464c3={'raw':!![],'where':{'id':_0x5a931f['params']['id']}},_0x871295={};_0x871295[_0x9264('0x45')]=_[_0x9264('0x47')](db[_0x9264('0x40')]['rawAttributes']);_0x871295['query']=_['keys'](_0x5a931f['query']);_0x871295[_0x9264('0x48')]=_[_0x9264('0x49')](_0x871295['model'],_0x871295[_0x9264('0x46')]);_0x1464c3['attributes']=_[_0x9264('0x49')](_0x871295['model'],qs[_0x9264('0x4b')](_0x5a931f['query'][_0x9264('0x4b')]));_0x1464c3['attributes']=_0x1464c3[_0x9264('0x4a')]['length']?_0x1464c3['attributes']:_0x871295[_0x9264('0x45')];if(_0x5a931f['query'][_0x9264('0x55')]){_0x1464c3[_0x9264('0x56')]=[{'all':!![]}];}_0x1464c3=_['merge']({},_0x1464c3,_0x5a931f[_0x9264('0x59')]);return db[_0x9264('0x40')]['find'](_0x1464c3)[_0x9264('0x24')](handleEntityNotFound(_0x1cc162,null))['then'](respondWithResult(_0x1cc162,null))[_0x9264('0x2d')](handleError(_0x1cc162,null));};exports[_0x9264('0x5a')]=function(_0xa6d9de,_0x5f189d){return db[_0x9264('0x40')][_0x9264('0x5a')](_0xa6d9de[_0x9264('0x5b')],{})['then'](function(_0x421d99){var _0x2bfa3a=_0xa6d9de['user'][_0x9264('0x3a')]({'plain':!![]});if(!_0x2bfa3a)throw new Error(_0x9264('0x5c'));if(_0x2bfa3a[_0x9264('0x5d')]===_0x9264('0x5e')){var _0x55e93d=_0x421d99['get']({'plain':!![]});var _0x227ea8=_0x9264('0x5f');return db[_0x9264('0x60')][_0x9264('0x61')]({'where':{'name':_0x227ea8,'userProfileId':_0x2bfa3a[_0x9264('0x62')]},'raw':!![]})[_0x9264('0x24')](function(_0x42d1a4){if(_0x42d1a4&&_0x42d1a4['autoAssociation']===0x0){return db[_0x9264('0x63')]['create']({'name':_0x55e93d[_0x9264('0x3c')],'resourceId':_0x55e93d['id'],'type':_0x42d1a4[_0x9264('0x3c')],'sectionId':_0x42d1a4['id']},{})['then'](function(){return _0x421d99;});}else{return _0x421d99;}})['catch'](function(_0x28b33c){logger[_0x9264('0x29')](_0x9264('0x64'),_0x28b33c);throw _0x28b33c;});}return _0x421d99;})['then'](respondWithResult(_0x5f189d,0xc9))['catch'](handleError(_0x5f189d,null));};exports[_0x9264('0x39')]=function(_0x243712,_0x2e0997){if(_0x243712[_0x9264('0x5b')]['id']){delete _0x243712[_0x9264('0x5b')]['id'];}return db[_0x9264('0x40')]['find']({'where':{'id':_0x243712[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x2e0997,null))[_0x9264('0x24')](saveUpdates(_0x243712[_0x9264('0x5b')],null))['then'](respondWithResult(_0x2e0997,null))[_0x9264('0x2d')](handleError(_0x2e0997,null));};exports['destroy']=function(_0x28df80,_0x5ebc17){return db[_0x9264('0x40')][_0x9264('0x61')]({'where':{'id':_0x28df80[_0x9264('0x65')]['id']}})['then'](handleEntityNotFound(_0x5ebc17,null))['then'](removeEntity(_0x5ebc17,null))[_0x9264('0x2d')](handleError(_0x5ebc17,null));};exports[_0x9264('0x66')]=function(_0xd89e85,_0x1fa2d1){return db[_0x9264('0x40')]['describe']()[_0x9264('0x24')](respondWithResult(_0x1fa2d1,null))[_0x9264('0x2d')](handleError(_0x1fa2d1,null));};exports[_0x9264('0x67')]=function(_0x2fda25,_0x1d7a80,_0xd7b4fa){var _0x1e4b39={'raw':!![],'where':{}},_0x428998={},_0x124f41;return db[_0x9264('0x40')][_0x9264('0x68')]({'where':{'id':_0x2fda25[_0x9264('0x65')]['id']}})['then'](handleEntityNotFound(_0x1d7a80,null))[_0x9264('0x24')](function(_0x40ab3f){if(_0x40ab3f){_0x124f41=_0x40ab3f[_0x9264('0x3a')]({'plain':!![]});_0x428998[_0x9264('0x45')]=_[_0x9264('0x47')](db['UserChatQueue'][_0x9264('0x41')]);_0x428998[_0x9264('0x46')]=_['keys'](_0x2fda25['query']);_0x428998['filters']=_['intersection'](_0x428998[_0x9264('0x45')],_0x428998['query']);_0x1e4b39[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x428998[_0x9264('0x45')],qs[_0x9264('0x4b')](_0x2fda25['query'][_0x9264('0x4b')]));_0x1e4b39[_0x9264('0x4a')]=_0x1e4b39[_0x9264('0x4a')][_0x9264('0x4c')]?_0x1e4b39['attributes']:_0x428998[_0x9264('0x45')];if(!_0x2fda25[_0x9264('0x46')]['hasOwnProperty'](_0x9264('0x4d'))){_0x1e4b39[_0x9264('0x4e')]=qs['limit'](_0x2fda25[_0x9264('0x46')][_0x9264('0x4e')]);_0x1e4b39[_0x9264('0x33')]=qs[_0x9264('0x33')](_0x2fda25['query'][_0x9264('0x33')]);}_0x1e4b39[_0x9264('0x4f')]=qs[_0x9264('0x50')](_0x2fda25[_0x9264('0x46')]['sort']);_0x1e4b39[_0x9264('0x53')]=qs[_0x9264('0x48')](_['pick'](_0x2fda25['query'],_0x428998[_0x9264('0x48')]));_0x1e4b39[_0x9264('0x53')][_0x9264('0x69')]=_0x40ab3f['id'];if(_0x2fda25[_0x9264('0x46')]['filter']){_0x1e4b39[_0x9264('0x53')]=_['merge'](_0x1e4b39[_0x9264('0x53')],{'$or':_[_0x9264('0x3f')](_0x1e4b39[_0x9264('0x4a')],function(_0x3e73d7){var _0x569e17={};_0x569e17[_0x3e73d7]={'$like':'%'+_0x2fda25[_0x9264('0x46')][_0x9264('0x52')]+'%'};return _0x569e17;})});}_0x1e4b39=_['merge']({},_0x1e4b39,_0x2fda25['options']);return db[_0x9264('0x6a')][_0x9264('0x57')](_0x1e4b39);}})['then'](function(_0xa3318c){if(_0xa3318c){return db[_0x9264('0x6b')][_0x9264('0x6c')]({'where':{'id':_[_0x9264('0x3f')](_0xa3318c,_0x9264('0x6d')),'role':_0x9264('0x6e')},'attributes':['id','name',_0x9264('0x6f'),_0x9264('0x70'),'createdAt']});}})[_0x9264('0x24')](function(_0x3e887d){if(_0x3e887d){return{'count':_0x3e887d['count'],'rows':_['map'](_0x3e887d[_0x9264('0x71')],function(_0x1ac803){return{'membername':_0x1ac803[_0x9264('0x3c')],'UserId':_0x1ac803['id'],'queue_name':_0x124f41[_0x9264('0x3c')],'ChatQueueId':_0x124f41['id'],'interface':util[_0x9264('0x72')](_0x9264('0x73'),_0x9264('0x74'),_0x1ac803[_0x9264('0x3c')]),'penalty':0x0,'paused':_0x1ac803[_0x9264('0x6f')],'createdAt':_0x1ac803[_0x9264('0x75')],'updatedAt':_0x1ac803[_0x9264('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d7a80,_0x1e4b39))[_0x9264('0x2d')](handleError(_0x1d7a80,null));};exports[_0x9264('0x76')]=function(_0x30c273,_0x3b9f1c,_0x3d42b4){var _0x300c26={};var _0x1541e3={};var _0x40bade;var _0x403a76;return db[_0x9264('0x40')][_0x9264('0x68')]({'where':{'id':_0x30c273[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x3b9f1c,null))[_0x9264('0x24')](function(_0x570f77){if(_0x570f77){_0x40bade=_0x570f77;_0x1541e3[_0x9264('0x45')]=_[_0x9264('0x47')](db['Team']['rawAttributes']);_0x1541e3[_0x9264('0x46')]=_[_0x9264('0x47')](_0x30c273[_0x9264('0x46')]);_0x1541e3[_0x9264('0x48')]=_[_0x9264('0x49')](_0x1541e3['model'],_0x1541e3['query']);_0x300c26[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x1541e3[_0x9264('0x45')],qs['fields'](_0x30c273['query'][_0x9264('0x4b')]));_0x300c26[_0x9264('0x4a')]=_0x300c26[_0x9264('0x4a')]['length']?_0x300c26[_0x9264('0x4a')]:_0x1541e3[_0x9264('0x45')];_0x300c26[_0x9264('0x4f')]=qs['sort'](_0x30c273[_0x9264('0x46')][_0x9264('0x50')]);_0x300c26['where']=qs[_0x9264('0x48')](_[_0x9264('0x51')](_0x30c273[_0x9264('0x46')],_0x1541e3[_0x9264('0x48')]));if(_0x30c273[_0x9264('0x46')][_0x9264('0x52')]){_0x300c26[_0x9264('0x53')]=_[_0x9264('0x54')](_0x300c26[_0x9264('0x53')],{'$or':_[_0x9264('0x3f')](_0x300c26[_0x9264('0x4a')],function(_0xb95792){var _0x478929={};_0x478929[_0xb95792]={'$like':'%'+_0x30c273[_0x9264('0x46')][_0x9264('0x52')]+'%'};return _0x478929;})});}_0x300c26=_[_0x9264('0x54')]({},_0x300c26,_0x30c273[_0x9264('0x59')]);return _0x40bade[_0x9264('0x76')](_0x300c26);}})[_0x9264('0x24')](function(_0x173cdf){if(_0x173cdf){_0x403a76=_0x173cdf['length'];if(!_0x30c273['query']['hasOwnProperty'](_0x9264('0x4d'))){_0x300c26[_0x9264('0x4e')]=qs[_0x9264('0x4e')](_0x30c273[_0x9264('0x46')][_0x9264('0x4e')]);_0x300c26['offset']=qs[_0x9264('0x33')](_0x30c273['query']['offset']);}return _0x40bade[_0x9264('0x76')](_0x300c26);}})[_0x9264('0x24')](function(_0x4e9b61){if(_0x4e9b61){return _0x4e9b61?{'count':_0x403a76,'rows':_0x4e9b61}:null;}})[_0x9264('0x24')](respondWithResult(_0x3b9f1c,null))[_0x9264('0x2d')](handleError(_0x3b9f1c,null));};exports[_0x9264('0x77')]=function(_0xa40ce9,_0x4e875b,_0x595b95){var _0x5bcd38=_0xa40ce9[_0x9264('0x5b')][_0x9264('0x78')];return db[_0x9264('0x79')]['findAll']({'where':{'id':_0x5bcd38},'attributes':['id'],'include':[{'model':db[_0x9264('0x6b')],'as':_0x9264('0x7a'),'attributes':['id','name','online',_0x9264('0x7b'),_0x9264('0x7c')],'raw':!![]}]})[_0x9264('0x24')](function(_0x1e282d){if(_0x1e282d){var _0x1dbfea=_[_0x9264('0x7d')](_0x1e282d,function(_0x1fbeb2){var _0x26dcd4=_0x1fbeb2[_0x9264('0x3a')]({'plain':!![]});return _0x26dcd4[_0x9264('0x7a')];});return db[_0x9264('0x40')][_0x9264('0x61')]({'where':{'id':_0xa40ce9['params']['id']}})[_0x9264('0x24')](function(_0x482dd3){return db[_0x9264('0x7e')][_0x9264('0x7f')](function(_0x2616ec){return _0x482dd3[_0x9264('0x77')](_0x5bcd38,{'transaction':_0x2616ec})['then'](function(){return BPromise['each'](_0x1dbfea,function(_0x3169c9){return db[_0x9264('0x6a')][_0x9264('0x80')]({'where':{'UserId':_0x3169c9['id'],'ChatQueueId':_0xa40ce9[_0x9264('0x65')]['id']},'transaction':_0x2616ec});});})[_0x9264('0x24')](function(){_0x1dbfea[_0x9264('0x81')](function(_0x2a7a97){socket[_0x9264('0x82')]('userChatQueue:save',{'UserId':_0x2a7a97['id'],'ChatQueueId':_0x482dd3['id']});});});});});}})[_0x9264('0x24')](respondWithStatusCode(_0x4e875b,null))[_0x9264('0x2d')](handleError(_0x4e875b,null));};exports['removeTeams']=function(_0x3b1608,_0x4b0331,_0x500ab6){return db[_0x9264('0x79')][_0x9264('0x57')]({'where':{'id':_0x3b1608['query'][_0x9264('0x78')]},'attributes':['id'],'include':[{'model':db[_0x9264('0x6b')],'as':_0x9264('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x9264('0x24')](handleEntityNotFound(_0x4b0331,null))[_0x9264('0x24')](function(_0x44eba2){var _0x16e58d=_[_0x9264('0x3f')](_0x44eba2,'id');var _0x4b6652=[];var _0x56e75f=[];var _0x4854aa=squel['select']();_0x4854aa[_0x9264('0x83')](_0x9264('0x84'))[_0x9264('0x85')](_0x9264('0x86'),'tq')[_0x9264('0x87')](_0x9264('0x88'),'ut',_0x9264('0x89'))[_0x9264('0x53')]('ChatQueueId\x20=\x20?',_0x3b1608[_0x9264('0x65')]['id']);for(var _0x35e750=0x0;_0x35e750<_0x44eba2[_0x9264('0x4c')];_0x35e750+=0x1){let _0x4d415a=_0x44eba2[_0x35e750];for(var _0x2678ea=0x0;_0x2678ea<_0x4d415a['Agents']['length'];_0x2678ea+=0x1){let _0x2bd3be=_0x4d415a[_0x9264('0x7a')][_0x2678ea];var _0x43df7a=_0x4854aa[_0x9264('0x8a')]();_0x43df7a[_0x9264('0x53')](_0x9264('0x8b'),_0x2bd3be['id']);_0x56e75f[_0x9264('0x8c')](db['sequelize'][_0x9264('0x46')](_0x43df7a['toString'](),{'type':db[_0x9264('0x7e')][_0x9264('0x8d')]['SELECT']})[_0x9264('0x24')](function(_0x4019cf){if(_0x4019cf[_0x9264('0x4c')]===0x1){return _0x2bd3be['id'];}else{var _0xcad7be=_[_0x9264('0x8e')](_['map'](_0x4019cf,_0x9264('0x8f')),function(_0x3af2b9){return _[_0x9264('0x90')](_0x16e58d,_0x3af2b9);});if(_0xcad7be){return _0x2bd3be['id'];}}}));}}return BPromise['all'](_0x56e75f)[_0x9264('0x24')](function(_0x89df5a){_0x4b6652=_(_0x4b6652)[_0x9264('0x91')](_0x89df5a)[_0x9264('0x92')]()[_0x9264('0x93')]();return db[_0x9264('0x40')][_0x9264('0x61')]({'where':{'id':_0x3b1608[_0x9264('0x65')]['id']}})[_0x9264('0x24')](function(_0x53af59){return db[_0x9264('0x7e')][_0x9264('0x7f')](function(_0x9be369){return _0x53af59['removeTeams'](_0x3b1608[_0x9264('0x46')][_0x9264('0x78')],{'transaction':_0x9be369})[_0x9264('0x24')](function(){if(!_['isEmpty'](_0x4b6652)){return _0x53af59['removeAgents'](_0x4b6652,{'transaction':_0x9be369});}})['then'](function(){_0x4b6652[_0x9264('0x81')](function(_0xea814a){socket['emit'](_0x9264('0x94'),{'UserId':_0xea814a,'ChatQueueId':_0x53af59['id']});});});});});});})[_0x9264('0x24')](respondWithStatusCode(_0x4b0331,null))[_0x9264('0x2d')](handleError(_0x4b0331,null));};exports['addAgents']=function(_0x460d63,_0x3cdce1,_0x3a3fe7){return db['ChatQueue'][_0x9264('0x61')]({'where':{'id':_0x460d63[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x3cdce1,null))['then'](function(_0x390836){if(_0x390836){return _0x390836[_0x9264('0x95')](_0x460d63[_0x9264('0x5b')][_0x9264('0x78')],_[_0x9264('0x96')](_0x460d63[_0x9264('0x5b')],['ids','id'])||{})[_0x9264('0x97')](function(_0x3fc6f4){for(var _0x12327e=0x0;_0x12327e<_0x460d63[_0x9264('0x5b')]['ids'][_0x9264('0x4c')];_0x12327e+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x460d63[_0x9264('0x5b')][_0x9264('0x78')][_0x12327e],'ChatQueueId':_0x460d63[_0x9264('0x65')]['id']});}return _0x3fc6f4;});}})[_0x9264('0x24')](respondWithResult(_0x3cdce1,null))[_0x9264('0x2d')](handleError(_0x3cdce1,null));};exports['removeAgents']=function(_0x157dbd,_0x3e1b8d,_0x2d64f9){return db[_0x9264('0x40')]['find']({'where':{'id':_0x157dbd[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x3e1b8d,null))[_0x9264('0x24')](function(_0x1a9696){if(_0x1a9696){return _0x1a9696['removeAgents'](_0x157dbd[_0x9264('0x46')][_0x9264('0x78')])[_0x9264('0x24')](function(){if(_[_0x9264('0x98')](_0x157dbd['query'][_0x9264('0x78')])){for(var _0x49700c=0x0;_0x49700c<_0x157dbd[_0x9264('0x46')][_0x9264('0x78')]['length'];_0x49700c+=0x1){socket[_0x9264('0x82')](_0x9264('0x94'),{'UserId':Number(_0x157dbd[_0x9264('0x46')][_0x9264('0x78')][_0x49700c]),'ChatQueueId':Number(_0x157dbd[_0x9264('0x65')]['id'])});}}else{socket[_0x9264('0x82')]('userChatQueue:remove',{'UserId':Number(_0x157dbd[_0x9264('0x46')]['ids']),'ChatQueueId':Number(_0x157dbd[_0x9264('0x65')]['id'])});}});}})[_0x9264('0x24')](respondWithStatusCode(_0x3e1b8d,null))[_0x9264('0x2d')](handleError(_0x3e1b8d,null));};exports[_0x9264('0x99')]=function(_0x267180,_0x4faf11,_0x96c8f0){var _0x40873a={};var _0x4b1e73={};var _0x103763;var _0x1a7056;return db[_0x9264('0x40')]['findOne']({'where':{'id':_0x267180['params']['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x4faf11,null))[_0x9264('0x24')](function(_0x183b69){if(_0x183b69){_0x103763=_0x183b69;_0x4b1e73[_0x9264('0x45')]=_[_0x9264('0x47')](db['User'][_0x9264('0x41')]);_0x4b1e73[_0x9264('0x46')]=_[_0x9264('0x47')](_0x267180[_0x9264('0x46')]);_0x4b1e73['filters']=_['intersection'](_0x4b1e73[_0x9264('0x45')],_0x4b1e73['query']);_0x40873a[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x4b1e73['model'],qs[_0x9264('0x4b')](_0x267180[_0x9264('0x46')][_0x9264('0x4b')]));_0x40873a[_0x9264('0x4a')]=_0x40873a[_0x9264('0x4a')]['length']?_0x40873a['attributes']:_0x4b1e73[_0x9264('0x45')];_0x40873a[_0x9264('0x4f')]=qs[_0x9264('0x50')](_0x267180['query'][_0x9264('0x50')]);_0x40873a[_0x9264('0x53')]=qs[_0x9264('0x48')](_['pick'](_0x267180[_0x9264('0x46')],_0x4b1e73[_0x9264('0x48')]));if(_0x267180[_0x9264('0x46')][_0x9264('0x52')]){_0x40873a[_0x9264('0x53')]=_[_0x9264('0x54')](_0x40873a[_0x9264('0x53')],{'$or':_['map'](_0x40873a[_0x9264('0x4a')],function(_0xf3d559){var _0x5a62ab={};_0x5a62ab[_0xf3d559]={'$like':'%'+_0x267180[_0x9264('0x46')]['filter']+'%'};return _0x5a62ab;})});}_0x40873a=_[_0x9264('0x54')]({},_0x40873a,_0x267180[_0x9264('0x59')]);return _0x103763[_0x9264('0x99')](_0x40873a);}})['then'](function(_0x461f49){if(_0x461f49){_0x1a7056=_0x461f49[_0x9264('0x4c')];if(!_0x267180['query'][_0x9264('0x9a')]('nolimit')){_0x40873a[_0x9264('0x4e')]=qs[_0x9264('0x4e')](_0x267180[_0x9264('0x46')][_0x9264('0x4e')]);_0x40873a[_0x9264('0x33')]=qs['offset'](_0x267180['query'][_0x9264('0x33')]);}return _0x103763['getAgents'](_0x40873a);}})[_0x9264('0x24')](function(_0x20db81){if(_0x20db81){return _0x20db81?{'count':_0x1a7056,'rows':_0x20db81}:null;}})[_0x9264('0x24')](respondWithResult(_0x4faf11,null))['catch'](handleError(_0x4faf11,null));}; \ No newline at end of file +var _0x4db5=['desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ChatQueues','destroy','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','findAll','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','online','transaction','each','emit','userChatQueue:save','removeTeams','ids','Agents','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x24e186,_0x4e3ae9){var _0x45fac2=function(_0x50ba29){while(--_0x50ba29){_0x24e186['push'](_0x24e186['shift']());}};_0x45fac2(++_0x4e3ae9);}(_0x4db5,0x86));var _0x54db=function(_0x28216b,_0x58d947){_0x28216b=_0x28216b-0x0;var _0x3b4c6=_0x4db5[_0x28216b];return _0x3b4c6;};'use strict';var pdf=require(_0x54db('0x0'));var emlformat=require(_0x54db('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x54db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54db('0x3'));var moment=require(_0x54db('0x4'));var BPromise=require(_0x54db('0x5'));var Mustache=require('mustache');var util=require(_0x54db('0x6'));var path=require(_0x54db('0x7'));var sox=require(_0x54db('0x8'));var csv=require(_0x54db('0x9'));var ejs=require(_0x54db('0xa'));var fs=require('fs');var _=require(_0x54db('0xb'));var squel=require('squel');var crypto=require(_0x54db('0xc'));var jsforce=require(_0x54db('0xd'));var deskjs=require(_0x54db('0xe'));var toCsv=require('to-csv');var querystring=require(_0x54db('0xf'));var Papa=require(_0x54db('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x54db('0x11'))(_0x54db('0x12'));var utils=require('../../config/utils');var config=require(_0x54db('0x13'));var licenseUtil=require(_0x54db('0x14'));var db=require(_0x54db('0x15'))['db'];config[_0x54db('0x16')]=_[_0x54db('0x17')](config[_0x54db('0x16')],{'host':_0x54db('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x54db('0x19'))['register'](socket);var jayson=require(_0x54db('0x1a'));var client=jayson[_0x54db('0x1b')][_0x54db('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x32f2cb,_0x11f4df,_0x17948a,_0x26fa9e){return new BPromise(function(_0x393608,_0x29cf1f){var _0x172532=_0x26fa9e||client;return _0x172532[_0x54db('0x1d')](_0x32f2cb,_0x17948a)['then'](function(_0x29bc83){logger[_0x54db('0x1e')](_0x54db('0x1f'),_0x11f4df,'request\x20sent');logger['debug'](_0x54db('0x20'),_0x11f4df,_0x54db('0x21'),JSON[_0x54db('0x22')](_0x29bc83));if(_0x29bc83[_0x54db('0x23')]){if(_0x29bc83[_0x54db('0x23')]['code']===0x1f4){logger[_0x54db('0x23')](_0x54db('0x1f'),_0x11f4df,_0x29bc83[_0x54db('0x23')]['message']);return _0x29cf1f(_0x29bc83['error'][_0x54db('0x24')]);}logger[_0x54db('0x23')]('ChatQueue,\x20%s,\x20%s',_0x11f4df,_0x29bc83[_0x54db('0x23')][_0x54db('0x24')]);return _0x393608(_0x29bc83[_0x54db('0x23')]['message']);}else{logger[_0x54db('0x1e')](_0x54db('0x1f'),_0x11f4df,_0x54db('0x21'));_0x393608(_0x29bc83[_0x54db('0x25')][_0x54db('0x24')]);}})[_0x54db('0x26')](function(_0x19a0aa){logger['error'](_0x54db('0x1f'),_0x11f4df,_0x19a0aa);_0x29cf1f(_0x19a0aa);});});}function respondWithStatusCode(_0x3e16e1,_0x270c4){_0x270c4=_0x270c4||0xcc;return function(_0x1507c7){if(_0x1507c7){return _0x3e16e1[_0x54db('0x27')](_0x270c4);}return _0x3e16e1[_0x54db('0x28')](_0x270c4)[_0x54db('0x29')]();};}function respondWithResult(_0x58f89e,_0x10dad5){_0x10dad5=_0x10dad5||0xc8;return function(_0x4c045d){if(_0x4c045d){return _0x58f89e[_0x54db('0x28')](_0x10dad5)[_0x54db('0x2a')](_0x4c045d);}};}function respondWithFilteredResult(_0x58d59e,_0x5b79ab){return function(_0x516492){if(_0x516492){var _0x16b538=_0x516492[_0x54db('0x2b')],_0x4872ac=_0x5b79ab[_0x54db('0x2c')],_0x1ac9c5=_0x5b79ab[_0x54db('0x2c')]+_0x5b79ab[_0x54db('0x2d')],_0x266613;if(_0x1ac9c5>=_0x16b538){_0x1ac9c5=_0x16b538;_0x266613=0xc8;}else{_0x266613=0xce;}_0x58d59e[_0x54db('0x28')](_0x266613);return _0x58d59e[_0x54db('0x2e')](_0x54db('0x2f'),_0x4872ac+'-'+_0x1ac9c5+'/'+_0x16b538)[_0x54db('0x2a')](_0x516492);}return null;};}function patchUpdates(_0x35f801){return function(_0x55d97c){try{jsonpatch[_0x54db('0x30')](_0x55d97c,_0x35f801,!![]);}catch(_0x479209){return BPromise[_0x54db('0x31')](_0x479209);}return _0x55d97c[_0x54db('0x32')]();};}function saveUpdates(_0x51ff0f,_0x4f7663){return function(_0x1d97f2){if(_0x1d97f2){return _0x1d97f2[_0x54db('0x33')](_0x51ff0f)['then'](function(_0x5e9d27){return _0x5e9d27;});}return null;};}function removeEntity(_0x21247e,_0x2e0099){return function(_0x126782){if(_0x126782){return _0x126782['destroy']()[_0x54db('0x34')](function(){var _0x32016b=_0x126782[_0x54db('0x35')]({'plain':!![]});var _0x1f36cc=_0x54db('0x36');return db['UserProfileResource'][_0x54db('0x37')]({'where':{'type':_0x1f36cc,'resourceId':_0x32016b['id']}})['then'](function(){return _0x126782;});})['then'](function(){_0x21247e['status'](0xcc)[_0x54db('0x29')]();});}};}function handleEntityNotFound(_0x5d290d,_0x5aaccc){return function(_0x71e51b){if(!_0x71e51b){_0x5d290d[_0x54db('0x27')](0x194);}return _0x71e51b;};}function handleError(_0x1cbb65,_0x212c9a){_0x212c9a=_0x212c9a||0x1f4;return function(_0x155194){logger[_0x54db('0x23')](_0x155194['stack']);if(_0x155194[_0x54db('0x38')]){delete _0x155194[_0x54db('0x38')];}_0x1cbb65[_0x54db('0x28')](_0x212c9a)[_0x54db('0x39')](_0x155194);};}exports[_0x54db('0x3a')]=function(_0x6445b4,_0x370d1c){var _0x2263a2={},_0x17d2d7={},_0x519d3f={'count':0x0,'rows':[]};var _0xc961db=_['map'](db[_0x54db('0x3b')][_0x54db('0x3c')],function(_0x377507){return{'name':_0x377507[_0x54db('0x3d')],'type':_0x377507[_0x54db('0x3e')][_0x54db('0x3f')]};});_0x17d2d7['model']=_[_0x54db('0x40')](_0xc961db,_0x54db('0x38'));_0x17d2d7['query']=_[_0x54db('0x41')](_0x6445b4[_0x54db('0x42')]);_0x17d2d7[_0x54db('0x43')]=_[_0x54db('0x44')](_0x17d2d7['model'],_0x17d2d7[_0x54db('0x42')]);_0x2263a2[_0x54db('0x45')]=_['intersection'](_0x17d2d7['model'],qs[_0x54db('0x46')](_0x6445b4[_0x54db('0x42')][_0x54db('0x46')]));_0x2263a2[_0x54db('0x45')]=_0x2263a2[_0x54db('0x45')][_0x54db('0x47')]?_0x2263a2['attributes']:_0x17d2d7[_0x54db('0x48')];if(!_0x6445b4[_0x54db('0x42')][_0x54db('0x49')](_0x54db('0x4a'))){_0x2263a2[_0x54db('0x2d')]=qs[_0x54db('0x2d')](_0x6445b4[_0x54db('0x42')][_0x54db('0x2d')]);_0x2263a2[_0x54db('0x2c')]=qs[_0x54db('0x2c')](_0x6445b4[_0x54db('0x42')]['offset']);}_0x2263a2[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x6445b4['query'][_0x54db('0x4c')]);_0x2263a2[_0x54db('0x4d')]=qs[_0x54db('0x43')](_['pick'](_0x6445b4[_0x54db('0x42')],_0x17d2d7[_0x54db('0x43')]),_0xc961db);if(_0x6445b4[_0x54db('0x42')][_0x54db('0x4e')]){_0x2263a2[_0x54db('0x4d')]=_[_0x54db('0x4f')](_0x2263a2[_0x54db('0x4d')],{'$or':_['map'](_0xc961db,function(_0x5a6b30){if(_0x5a6b30[_0x54db('0x3e')]!=='VIRTUAL'){var _0x14c335={};_0x14c335[_0x5a6b30[_0x54db('0x38')]]={'$like':'%'+_0x6445b4[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0x14c335;}})});}_0x2263a2=_[_0x54db('0x4f')]({},_0x2263a2,_0x6445b4['options']);var _0x2159be={'where':_0x2263a2['where']};return db['ChatQueue'][_0x54db('0x2b')](_0x2159be)[_0x54db('0x34')](function(_0x14f12d){_0x519d3f[_0x54db('0x2b')]=_0x14f12d;if(_0x6445b4['query'][_0x54db('0x50')]){_0x2263a2[_0x54db('0x51')]=[{'all':!![]}];}return db[_0x54db('0x3b')]['findAll'](_0x2263a2);})[_0x54db('0x34')](function(_0x46aae4){_0x519d3f[_0x54db('0x52')]=_0x46aae4;return _0x519d3f;})[_0x54db('0x34')](respondWithFilteredResult(_0x370d1c,_0x2263a2))[_0x54db('0x26')](handleError(_0x370d1c,null));};exports[_0x54db('0x53')]=function(_0x1810db,_0x1e03a4){var _0x3459f9={'raw':!![],'where':{'id':_0x1810db[_0x54db('0x54')]['id']}},_0x21bd16={};_0x21bd16[_0x54db('0x48')]=_[_0x54db('0x41')](db[_0x54db('0x3b')][_0x54db('0x3c')]);_0x21bd16[_0x54db('0x42')]=_[_0x54db('0x41')](_0x1810db[_0x54db('0x42')]);_0x21bd16[_0x54db('0x43')]=_[_0x54db('0x44')](_0x21bd16['model'],_0x21bd16[_0x54db('0x42')]);_0x3459f9[_0x54db('0x45')]=_['intersection'](_0x21bd16['model'],qs[_0x54db('0x46')](_0x1810db[_0x54db('0x42')][_0x54db('0x46')]));_0x3459f9['attributes']=_0x3459f9['attributes'][_0x54db('0x47')]?_0x3459f9[_0x54db('0x45')]:_0x21bd16['model'];if(_0x1810db['query'][_0x54db('0x50')]){_0x3459f9[_0x54db('0x51')]=[{'all':!![]}];}_0x3459f9=_['merge']({},_0x3459f9,_0x1810db[_0x54db('0x55')]);return db[_0x54db('0x3b')][_0x54db('0x56')](_0x3459f9)[_0x54db('0x34')](handleEntityNotFound(_0x1e03a4,null))[_0x54db('0x34')](respondWithResult(_0x1e03a4,null))[_0x54db('0x26')](handleError(_0x1e03a4,null));};exports[_0x54db('0x57')]=function(_0x3933a0,_0x3a12ad){return db[_0x54db('0x3b')][_0x54db('0x57')](_0x3933a0[_0x54db('0x58')],{})[_0x54db('0x34')](function(_0x5ceee2){var _0x36117b=_0x3933a0[_0x54db('0x59')][_0x54db('0x35')]({'plain':!![]});if(!_0x36117b)throw new Error(_0x54db('0x5a'));if(_0x36117b[_0x54db('0x5b')]==='user'){var _0x55e0ab=_0x5ceee2['get']({'plain':!![]});var _0x1574e4='ChatQueues';return db['UserProfileSection'][_0x54db('0x56')]({'where':{'name':_0x1574e4,'userProfileId':_0x36117b['userProfileId']},'raw':!![]})[_0x54db('0x34')](function(_0xc9d8b8){if(_0xc9d8b8&&_0xc9d8b8[_0x54db('0x5c')]===0x0){return db[_0x54db('0x5d')][_0x54db('0x57')]({'name':_0x55e0ab[_0x54db('0x38')],'resourceId':_0x55e0ab['id'],'type':_0xc9d8b8[_0x54db('0x38')],'sectionId':_0xc9d8b8['id']},{})['then'](function(){return _0x5ceee2;});}else{return _0x5ceee2;}})[_0x54db('0x26')](function(_0x35fbca){logger[_0x54db('0x23')](_0x54db('0x5e'),_0x35fbca);throw _0x35fbca;});}return _0x5ceee2;})[_0x54db('0x34')](respondWithResult(_0x3a12ad,0xc9))[_0x54db('0x26')](handleError(_0x3a12ad,null));};exports[_0x54db('0x33')]=function(_0xd2f153,_0x15fa55){if(_0xd2f153['body']['id']){delete _0xd2f153[_0x54db('0x58')]['id'];}return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0xd2f153['params']['id']}})['then'](handleEntityNotFound(_0x15fa55,null))[_0x54db('0x34')](saveUpdates(_0xd2f153[_0x54db('0x58')],null))['then'](respondWithResult(_0x15fa55,null))[_0x54db('0x26')](handleError(_0x15fa55,null));};exports[_0x54db('0x37')]=function(_0x556a2c,_0x171431){return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x556a2c[_0x54db('0x54')]['id']}})['then'](handleEntityNotFound(_0x171431,null))['then'](removeEntity(_0x171431,null))['catch'](handleError(_0x171431,null));};exports[_0x54db('0x5f')]=function(_0x1a929d,_0x479647){return db['ChatQueue'][_0x54db('0x5f')]()[_0x54db('0x34')](respondWithResult(_0x479647,null))[_0x54db('0x26')](handleError(_0x479647,null));};exports['getMembers']=function(_0x4fc8a9,_0x58a3aa,_0x2bde52){var _0x4a33aa={'raw':!![],'where':{}},_0x1d5547={},_0x5c9333;return db[_0x54db('0x3b')][_0x54db('0x60')]({'where':{'id':_0x4fc8a9['params']['id']}})['then'](handleEntityNotFound(_0x58a3aa,null))['then'](function(_0x2784f2){if(_0x2784f2){_0x5c9333=_0x2784f2[_0x54db('0x35')]({'plain':!![]});_0x1d5547[_0x54db('0x48')]=_[_0x54db('0x41')](db[_0x54db('0x61')][_0x54db('0x3c')]);_0x1d5547['query']=_['keys'](_0x4fc8a9[_0x54db('0x42')]);_0x1d5547[_0x54db('0x43')]=_[_0x54db('0x44')](_0x1d5547['model'],_0x1d5547[_0x54db('0x42')]);_0x4a33aa[_0x54db('0x45')]=_[_0x54db('0x44')](_0x1d5547[_0x54db('0x48')],qs['fields'](_0x4fc8a9[_0x54db('0x42')][_0x54db('0x46')]));_0x4a33aa[_0x54db('0x45')]=_0x4a33aa['attributes'][_0x54db('0x47')]?_0x4a33aa[_0x54db('0x45')]:_0x1d5547['model'];if(!_0x4fc8a9['query'][_0x54db('0x49')](_0x54db('0x4a'))){_0x4a33aa['limit']=qs[_0x54db('0x2d')](_0x4fc8a9[_0x54db('0x42')][_0x54db('0x2d')]);_0x4a33aa[_0x54db('0x2c')]=qs[_0x54db('0x2c')](_0x4fc8a9[_0x54db('0x42')]['offset']);}_0x4a33aa[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x4fc8a9['query'][_0x54db('0x4c')]);_0x4a33aa[_0x54db('0x4d')]=qs[_0x54db('0x43')](_['pick'](_0x4fc8a9[_0x54db('0x42')],_0x1d5547['filters']));_0x4a33aa[_0x54db('0x4d')]['ChatQueueId']=_0x2784f2['id'];if(_0x4fc8a9['query']['filter']){_0x4a33aa[_0x54db('0x4d')]=_['merge'](_0x4a33aa[_0x54db('0x4d')],{'$or':_[_0x54db('0x40')](_0x4a33aa['attributes'],function(_0x301570){var _0x3e4ff8={};_0x3e4ff8[_0x301570]={'$like':'%'+_0x4fc8a9[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0x3e4ff8;})});}_0x4a33aa=_[_0x54db('0x4f')]({},_0x4a33aa,_0x4fc8a9[_0x54db('0x55')]);return db[_0x54db('0x61')][_0x54db('0x62')](_0x4a33aa);}})['then'](function(_0x3805b0){if(_0x3805b0){return db[_0x54db('0x63')][_0x54db('0x64')]({'where':{'id':_[_0x54db('0x40')](_0x3805b0,'UserId'),'role':_0x54db('0x65')},'attributes':['id','name',_0x54db('0x66'),_0x54db('0x67'),_0x54db('0x68')]});}})[_0x54db('0x34')](function(_0x4478b2){if(_0x4478b2){return{'count':_0x4478b2[_0x54db('0x2b')],'rows':_[_0x54db('0x40')](_0x4478b2[_0x54db('0x52')],function(_0xfd7be0){return{'membername':_0xfd7be0[_0x54db('0x38')],'UserId':_0xfd7be0['id'],'queue_name':_0x5c9333[_0x54db('0x38')],'ChatQueueId':_0x5c9333['id'],'interface':util[_0x54db('0x69')](_0x54db('0x6a'),_0x54db('0x6b'),_0xfd7be0[_0x54db('0x38')]),'penalty':0x0,'paused':_0xfd7be0[_0x54db('0x66')],'createdAt':_0xfd7be0[_0x54db('0x68')],'updatedAt':_0xfd7be0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x54db('0x34')](respondWithFilteredResult(_0x58a3aa,_0x4a33aa))[_0x54db('0x26')](handleError(_0x58a3aa,null));};exports[_0x54db('0x6c')]=function(_0x578f78,_0x46fdce,_0x3d9ccb){var _0x3a8d6b={};var _0x176f5f={};var _0x9217ef;var _0x253dec;return db[_0x54db('0x3b')][_0x54db('0x60')]({'where':{'id':_0x578f78[_0x54db('0x54')]['id']}})['then'](handleEntityNotFound(_0x46fdce,null))[_0x54db('0x34')](function(_0x274ec9){if(_0x274ec9){_0x9217ef=_0x274ec9;_0x176f5f[_0x54db('0x48')]=_['keys'](db[_0x54db('0x6d')][_0x54db('0x3c')]);_0x176f5f[_0x54db('0x42')]=_['keys'](_0x578f78[_0x54db('0x42')]);_0x176f5f[_0x54db('0x43')]=_[_0x54db('0x44')](_0x176f5f[_0x54db('0x48')],_0x176f5f[_0x54db('0x42')]);_0x3a8d6b[_0x54db('0x45')]=_[_0x54db('0x44')](_0x176f5f[_0x54db('0x48')],qs[_0x54db('0x46')](_0x578f78[_0x54db('0x42')][_0x54db('0x46')]));_0x3a8d6b['attributes']=_0x3a8d6b[_0x54db('0x45')][_0x54db('0x47')]?_0x3a8d6b[_0x54db('0x45')]:_0x176f5f[_0x54db('0x48')];_0x3a8d6b[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x578f78[_0x54db('0x42')][_0x54db('0x4c')]);_0x3a8d6b[_0x54db('0x4d')]=qs[_0x54db('0x43')](_['pick'](_0x578f78[_0x54db('0x42')],_0x176f5f[_0x54db('0x43')]));if(_0x578f78['query'][_0x54db('0x4e')]){_0x3a8d6b[_0x54db('0x4d')]=_[_0x54db('0x4f')](_0x3a8d6b['where'],{'$or':_['map'](_0x3a8d6b[_0x54db('0x45')],function(_0x2234e2){var _0xb2ac85={};_0xb2ac85[_0x2234e2]={'$like':'%'+_0x578f78[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0xb2ac85;})});}_0x3a8d6b=_[_0x54db('0x4f')]({},_0x3a8d6b,_0x578f78[_0x54db('0x55')]);return _0x9217ef[_0x54db('0x6c')](_0x3a8d6b);}})[_0x54db('0x34')](function(_0x51dbce){if(_0x51dbce){_0x253dec=_0x51dbce[_0x54db('0x47')];if(!_0x578f78[_0x54db('0x42')][_0x54db('0x49')](_0x54db('0x4a'))){_0x3a8d6b[_0x54db('0x2d')]=qs[_0x54db('0x2d')](_0x578f78[_0x54db('0x42')]['limit']);_0x3a8d6b[_0x54db('0x2c')]=qs['offset'](_0x578f78[_0x54db('0x42')][_0x54db('0x2c')]);}return _0x9217ef['getTeams'](_0x3a8d6b);}})[_0x54db('0x34')](function(_0x5416b0){if(_0x5416b0){return _0x5416b0?{'count':_0x253dec,'rows':_0x5416b0}:null;}})['then'](respondWithResult(_0x46fdce,null))[_0x54db('0x26')](handleError(_0x46fdce,null));};exports[_0x54db('0x6e')]=function(_0x41703e,_0x4a3dae,_0x21609f){var _0x22a482=_0x41703e[_0x54db('0x58')]['ids'];return db[_0x54db('0x6d')][_0x54db('0x62')]({'where':{'id':_0x22a482},'attributes':['id'],'include':[{'model':db[_0x54db('0x63')],'as':'Agents','attributes':['id',_0x54db('0x38'),_0x54db('0x6f'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x25b601){if(_0x25b601){var _0x1edd0f=_['flatMap'](_0x25b601,function(_0x4d2eed){var _0x4cdc52=_0x4d2eed['get']({'plain':!![]});return _0x4cdc52['Agents'];});return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x41703e[_0x54db('0x54')]['id']}})[_0x54db('0x34')](function(_0x47ba98){return db['sequelize'][_0x54db('0x70')](function(_0x338762){return _0x47ba98[_0x54db('0x6e')](_0x22a482,{'transaction':_0x338762})[_0x54db('0x34')](function(){return BPromise[_0x54db('0x71')](_0x1edd0f,function(_0x4c7883){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x4c7883['id'],'ChatQueueId':_0x41703e[_0x54db('0x54')]['id']},'transaction':_0x338762});});})[_0x54db('0x34')](function(){_0x1edd0f['forEach'](function(_0x178520){socket[_0x54db('0x72')](_0x54db('0x73'),{'UserId':_0x178520['id'],'ChatQueueId':_0x47ba98['id']});});});});});}})['then'](respondWithStatusCode(_0x4a3dae,null))[_0x54db('0x26')](handleError(_0x4a3dae,null));};exports[_0x54db('0x74')]=function(_0x49e850,_0x446279,_0x422770){return db[_0x54db('0x6d')][_0x54db('0x62')]({'where':{'id':_0x49e850[_0x54db('0x42')][_0x54db('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x54db('0x76'),'attributes':['id'],'raw':!![]}]})[_0x54db('0x34')](handleEntityNotFound(_0x446279,null))['then'](function(_0x2471b9){var _0xadfa74=_[_0x54db('0x40')](_0x2471b9,'id');var _0x19018f=[];var _0x53da41=[];var _0x56cd55=squel['select']();_0x56cd55[_0x54db('0x77')](_0x54db('0x78'))['from'](_0x54db('0x79'),'tq')[_0x54db('0x7a')](_0x54db('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x54db('0x4d')](_0x54db('0x7c'),_0x49e850['params']['id']);for(var _0x2e1af3=0x0;_0x2e1af3<_0x2471b9['length'];_0x2e1af3+=0x1){let _0x337d7a=_0x2471b9[_0x2e1af3];for(var _0x331d5c=0x0;_0x331d5c<_0x337d7a['Agents'][_0x54db('0x47')];_0x331d5c+=0x1){let _0x19cde2=_0x337d7a[_0x54db('0x76')][_0x331d5c];var _0x470007=_0x56cd55['clone']();_0x470007[_0x54db('0x4d')](_0x54db('0x7d'),_0x19cde2['id']);_0x53da41[_0x54db('0x7e')](db[_0x54db('0x7f')][_0x54db('0x42')](_0x470007[_0x54db('0x80')](),{'type':db[_0x54db('0x7f')][_0x54db('0x81')][_0x54db('0x82')]})['then'](function(_0xcf23d9){if(_0xcf23d9['length']===0x1){return _0x19cde2['id'];}else{var _0xd1547b=_[_0x54db('0x83')](_[_0x54db('0x40')](_0xcf23d9,_0x54db('0x84')),function(_0x5d26a6){return _[_0x54db('0x85')](_0xadfa74,_0x5d26a6);});if(_0xd1547b){return _0x19cde2['id'];}}}));}}return BPromise[_0x54db('0x86')](_0x53da41)[_0x54db('0x34')](function(_0x48a0fa){_0x19018f=_(_0x19018f)[_0x54db('0x87')](_0x48a0fa)[_0x54db('0x88')]()[_0x54db('0x89')]();return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x49e850['params']['id']}})['then'](function(_0x2f0d6b){return db['sequelize'][_0x54db('0x70')](function(_0x55881c){return _0x2f0d6b[_0x54db('0x74')](_0x49e850[_0x54db('0x42')][_0x54db('0x75')],{'transaction':_0x55881c})[_0x54db('0x34')](function(){if(!_[_0x54db('0x8a')](_0x19018f)){return _0x2f0d6b[_0x54db('0x8b')](_0x19018f,{'transaction':_0x55881c});}})[_0x54db('0x34')](function(){_0x19018f[_0x54db('0x8c')](function(_0x259a34){socket[_0x54db('0x72')](_0x54db('0x8d'),{'UserId':_0x259a34,'ChatQueueId':_0x2f0d6b['id']});});});});});});})[_0x54db('0x34')](respondWithStatusCode(_0x446279,null))['catch'](handleError(_0x446279,null));};exports[_0x54db('0x8e')]=function(_0x598bb1,_0x1f68b6,_0x3a8aa7){return db['ChatQueue']['find']({'where':{'id':_0x598bb1[_0x54db('0x54')]['id']}})[_0x54db('0x34')](handleEntityNotFound(_0x1f68b6,null))['then'](function(_0x27fcce){if(_0x27fcce){return _0x27fcce['addAgents'](_0x598bb1[_0x54db('0x58')][_0x54db('0x75')],_[_0x54db('0x8f')](_0x598bb1[_0x54db('0x58')],['ids','id'])||{})[_0x54db('0x90')](function(_0x40a39d){for(var _0x4ee93a=0x0;_0x4ee93a<_0x598bb1['body'][_0x54db('0x75')][_0x54db('0x47')];_0x4ee93a+=0x1){socket[_0x54db('0x72')](_0x54db('0x73'),{'UserId':_0x598bb1[_0x54db('0x58')][_0x54db('0x75')][_0x4ee93a],'ChatQueueId':_0x598bb1['params']['id']});}return _0x40a39d;});}})['then'](respondWithResult(_0x1f68b6,null))[_0x54db('0x26')](handleError(_0x1f68b6,null));};exports[_0x54db('0x8b')]=function(_0x23b70f,_0x27b331,_0x1f6b44){return db[_0x54db('0x3b')][_0x54db('0x56')]({'where':{'id':_0x23b70f[_0x54db('0x54')]['id']}})['then'](handleEntityNotFound(_0x27b331,null))[_0x54db('0x34')](function(_0x1d818d){if(_0x1d818d){return _0x1d818d[_0x54db('0x8b')](_0x23b70f['query'][_0x54db('0x75')])[_0x54db('0x34')](function(){if(_[_0x54db('0x91')](_0x23b70f[_0x54db('0x42')]['ids'])){for(var _0x4c3a81=0x0;_0x4c3a81<_0x23b70f[_0x54db('0x42')][_0x54db('0x75')][_0x54db('0x47')];_0x4c3a81+=0x1){socket[_0x54db('0x72')](_0x54db('0x8d'),{'UserId':Number(_0x23b70f[_0x54db('0x42')][_0x54db('0x75')][_0x4c3a81]),'ChatQueueId':Number(_0x23b70f[_0x54db('0x54')]['id'])});}}else{socket['emit'](_0x54db('0x8d'),{'UserId':Number(_0x23b70f['query']['ids']),'ChatQueueId':Number(_0x23b70f['params']['id'])});}});}})[_0x54db('0x34')](respondWithStatusCode(_0x27b331,null))[_0x54db('0x26')](handleError(_0x27b331,null));};exports[_0x54db('0x92')]=function(_0x230f28,_0x1140a4,_0x92427e){var _0x173879={};var _0x762ec7={};var _0x221d32;var _0x539262;return db[_0x54db('0x3b')][_0x54db('0x60')]({'where':{'id':_0x230f28['params']['id']}})[_0x54db('0x34')](handleEntityNotFound(_0x1140a4,null))[_0x54db('0x34')](function(_0x5c443b){if(_0x5c443b){_0x221d32=_0x5c443b;_0x762ec7[_0x54db('0x48')]=_['keys'](db[_0x54db('0x63')][_0x54db('0x3c')]);_0x762ec7[_0x54db('0x42')]=_[_0x54db('0x41')](_0x230f28[_0x54db('0x42')]);_0x762ec7[_0x54db('0x43')]=_[_0x54db('0x44')](_0x762ec7[_0x54db('0x48')],_0x762ec7['query']);_0x173879[_0x54db('0x45')]=_[_0x54db('0x44')](_0x762ec7[_0x54db('0x48')],qs[_0x54db('0x46')](_0x230f28['query'][_0x54db('0x46')]));_0x173879[_0x54db('0x45')]=_0x173879[_0x54db('0x45')]['length']?_0x173879['attributes']:_0x762ec7[_0x54db('0x48')];_0x173879[_0x54db('0x4b')]=qs[_0x54db('0x4c')](_0x230f28['query'][_0x54db('0x4c')]);_0x173879[_0x54db('0x4d')]=qs[_0x54db('0x43')](_[_0x54db('0x93')](_0x230f28[_0x54db('0x42')],_0x762ec7[_0x54db('0x43')]));if(_0x230f28[_0x54db('0x42')][_0x54db('0x4e')]){_0x173879[_0x54db('0x4d')]=_[_0x54db('0x4f')](_0x173879['where'],{'$or':_[_0x54db('0x40')](_0x173879['attributes'],function(_0x50e5c7){var _0x4a789d={};_0x4a789d[_0x50e5c7]={'$like':'%'+_0x230f28[_0x54db('0x42')][_0x54db('0x4e')]+'%'};return _0x4a789d;})});}_0x173879=_['merge']({},_0x173879,_0x230f28['options']);return _0x221d32[_0x54db('0x92')](_0x173879);}})[_0x54db('0x34')](function(_0x4e4c69){if(_0x4e4c69){_0x539262=_0x4e4c69[_0x54db('0x47')];if(!_0x230f28['query'][_0x54db('0x49')](_0x54db('0x4a'))){_0x173879['limit']=qs[_0x54db('0x2d')](_0x230f28['query'][_0x54db('0x2d')]);_0x173879[_0x54db('0x2c')]=qs[_0x54db('0x2c')](_0x230f28['query']['offset']);}return _0x221d32['getAgents'](_0x173879);}})[_0x54db('0x34')](function(_0x42c752){if(_0x42c752){return _0x42c752?{'count':_0x539262,'rows':_0x42c752}:null;}})[_0x54db('0x34')](respondWithResult(_0x1140a4,null))['catch'](handleError(_0x1140a4,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0469035..2073229 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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x34ed99,_0x3e346d){var _0x35d584=function(_0x2dd906){while(--_0x2dd906){_0x34ed99['push'](_0x34ed99['shift']());}};_0x35d584(++_0x3e346d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x36f91b,_0x1b5731){var _0x2ea9d7=function(_0x5e1538){while(--_0x5e1538){_0x36f91b['push'](_0x36f91b['shift']());}};_0x2ea9d7(++_0x1b5731);}(_0xb10b,0x12a));var _0xbb10=function(_0x315216,_0x15d0cc){_0x315216=_0x315216-0x0;var _0x4dfb84=_0xb10b[_0x315216];return _0x4dfb84;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 87a694a..37dedf9 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 _0xf9ae=['./chatQueue.attributes','exports','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1fd5e8,_0x13ccbf){var _0x2eb8cf=function(_0xd71e45){while(--_0xd71e45){_0x1fd5e8['push'](_0x1fd5e8['shift']());}};_0x2eb8cf(++_0x13ccbf);}(_0xf9ae,0x84));var _0xef9a=function(_0x55fd4e,_0x469ed3){_0x55fd4e=_0x55fd4e-0x0;var _0x14ae87=_0xf9ae[_0x55fd4e];return _0x14ae87;};'use strict';var _=require(_0xef9a('0x0'));var util=require('util');var logger=require(_0xef9a('0x1'))(_0xef9a('0x2'));var moment=require(_0xef9a('0x3'));var BPromise=require(_0xef9a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef9a('0x5'));var rimraf=require(_0xef9a('0x6'));var config=require(_0xef9a('0x7'));var attributes=require(_0xef9a('0x8'));module[_0xef9a('0x9')]=function(_0xc8558f,_0x279c6c){return _0xc8558f['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc88d=['request-promise','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x5555fd,_0x31b11c){var _0x174889=function(_0x1afb16){while(--_0x1afb16){_0x5555fd['push'](_0x5555fd['shift']());}};_0x174889(++_0x31b11c);}(_0xc88d,0xd3));var _0xdc88=function(_0x3c2f96,_0x13b4c3){_0x3c2f96=_0x3c2f96-0x0;var _0x61929f=_0xc88d[_0x3c2f96];return _0x61929f;};'use strict';var _=require(_0xdc88('0x0'));var util=require(_0xdc88('0x1'));var logger=require(_0xdc88('0x2'))(_0xdc88('0x3'));var moment=require(_0xdc88('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc88('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc88('0x6'));var attributes=require(_0xdc88('0x7'));module[_0xdc88('0x8')]=function(_0xa2dc30,_0x2e0133){return _0xa2dc30[_0xdc88('0x9')](_0xdc88('0xa'),attributes,{'tableName':_0xdc88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index bc73798..670b3ff 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 _0x5c82=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','options','where','attributes','limit','include','model','map','ShowChatQueue','find','raw','lodash','util'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x5c82,0x198));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25c8('0x0'));var util=require(_0x25c8('0x1'));var moment=require(_0x25c8('0x2'));var BPromise=require(_0x25c8('0x3'));var rs=require(_0x25c8('0x4'));var fs=require('fs');var Redis=require(_0x25c8('0x5'));var db=require(_0x25c8('0x6'))['db'];var utils=require(_0x25c8('0x7'));var logger=require(_0x25c8('0x8'))(_0x25c8('0x9'));var config=require(_0x25c8('0xa'));var jayson=require(_0x25c8('0xb'));var client=jayson[_0x25c8('0xc')][_0x25c8('0xd')]({'port':0x232a});config[_0x25c8('0xe')]=_[_0x25c8('0xf')](config[_0x25c8('0xe')],{'host':_0x25c8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x25c8('0x11')](socket);function respondWithRpcPromise(_0x5f056a,_0x40bfcf,_0x24ae74){return new BPromise(function(_0x5ad180,_0x3e915b){return client['request'](_0x5f056a,_0x24ae74)[_0x25c8('0x12')](function(_0x1f2a62){logger['info']('ChatQueue,\x20%s,\x20%s',_0x40bfcf,_0x25c8('0x13'));logger[_0x25c8('0x14')](_0x25c8('0x15'),_0x40bfcf,'request\x20sent',JSON[_0x25c8('0x16')](_0x1f2a62));if(_0x1f2a62[_0x25c8('0x17')]){if(_0x1f2a62[_0x25c8('0x17')][_0x25c8('0x18')]===0x1f4){logger[_0x25c8('0x17')](_0x25c8('0x19'),_0x40bfcf,_0x1f2a62[_0x25c8('0x17')][_0x25c8('0x1a')]);return _0x3e915b(_0x1f2a62[_0x25c8('0x17')][_0x25c8('0x1a')]);}logger[_0x25c8('0x17')]('ChatQueue,\x20%s,\x20%s',_0x40bfcf,_0x1f2a62['error'][_0x25c8('0x1a')]);return _0x5ad180(_0x1f2a62['error'][_0x25c8('0x1a')]);}else{logger[_0x25c8('0x1b')](_0x25c8('0x19'),_0x40bfcf,_0x25c8('0x13'));_0x5ad180(_0x1f2a62[_0x25c8('0x1c')][_0x25c8('0x1a')]);}})[_0x25c8('0x1d')](function(_0x4b67fa){logger['error'](_0x25c8('0x19'),_0x40bfcf,_0x4b67fa);_0x3e915b(_0x4b67fa);});});}exports[_0x25c8('0x1e')]=function(_0x49c60d){var _0x2a6bfe=this;return new Promise(function(_0x10d43b,_0x39c6e6){return db['ChatQueue']['findAll']({'raw':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d['options']['raw']===undefined?!![]:![]:!![],'where':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x20')]||null:null,'attributes':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x21')]||null:null,'limit':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x22')]||null:null,'include':_0x49c60d['options']?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x23')]?_['map'](_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x23')],function(_0x5dc5d5){return{'model':db[_0x5dc5d5[_0x25c8('0x24')]],'as':_0x5dc5d5['as'],'attributes':_0x5dc5d5['attributes'],'include':_0x5dc5d5['include']?_['map'](_0x5dc5d5[_0x25c8('0x23')],function(_0x44b03c){return{'model':db[_0x44b03c[_0x25c8('0x24')]],'as':_0x44b03c['as'],'attributes':_0x44b03c[_0x25c8('0x21')],'include':_0x44b03c[_0x25c8('0x23')]?_[_0x25c8('0x25')](_0x44b03c['include'],function(_0x47a996){return{'model':db[_0x47a996[_0x25c8('0x24')]],'as':_0x47a996['as'],'attributes':_0x47a996[_0x25c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x25c8('0x12')](function(_0x3b8eb5){logger['info'](_0x25c8('0x1e'),_0x49c60d);logger['debug'](_0x25c8('0x1e'),_0x49c60d,JSON[_0x25c8('0x16')](_0x3b8eb5));_0x10d43b(_0x3b8eb5);})[_0x25c8('0x1d')](function(_0x2eb8e2){logger[_0x25c8('0x17')](_0x25c8('0x1e'),_0x2eb8e2['message'],_0x49c60d);_0x39c6e6(_0x2a6bfe[_0x25c8('0x17')](0x1f4,_0x2eb8e2['message']));});});};exports[_0x25c8('0x26')]=function(_0x2b2a6a){var _0x20ed52=this;return new Promise(function(_0x4e9366,_0x50dc09){return db['ChatQueue'][_0x25c8('0x27')]({'raw':_0x2b2a6a[_0x25c8('0x1f')]?_0x2b2a6a[_0x25c8('0x1f')][_0x25c8('0x28')]===undefined?!![]:![]:!![],'where':_0x2b2a6a['options']?_0x2b2a6a['options'][_0x25c8('0x20')]||null:null,'attributes':_0x2b2a6a[_0x25c8('0x1f')]?_0x2b2a6a['options'][_0x25c8('0x21')]||null:null,'include':_0x2b2a6a[_0x25c8('0x1f')]?_0x2b2a6a['options']['include']?_[_0x25c8('0x25')](_0x2b2a6a[_0x25c8('0x1f')]['include'],function(_0x439143){return{'model':db[_0x439143['model']],'as':_0x439143['as'],'attributes':_0x439143['attributes'],'include':_0x439143[_0x25c8('0x23')]?_[_0x25c8('0x25')](_0x439143[_0x25c8('0x23')],function(_0x36daa4){return{'model':db[_0x36daa4[_0x25c8('0x24')]],'as':_0x36daa4['as'],'attributes':_0x36daa4[_0x25c8('0x21')],'include':_0x36daa4['include']?_[_0x25c8('0x25')](_0x36daa4[_0x25c8('0x23')],function(_0xb8ea63){return{'model':db[_0xb8ea63[_0x25c8('0x24')]],'as':_0xb8ea63['as'],'attributes':_0xb8ea63['attributes']};}):[]};}):[]};}):[]:[]})[_0x25c8('0x12')](function(_0x3caa18){logger['info'](_0x25c8('0x26'),_0x2b2a6a);logger['debug'](_0x25c8('0x26'),_0x2b2a6a,JSON['stringify'](_0x3caa18));_0x4e9366(_0x3caa18);})[_0x25c8('0x1d')](function(_0x517228){logger[_0x25c8('0x17')](_0x25c8('0x26'),_0x517228[_0x25c8('0x1a')],_0x2b2a6a);_0x50dc09(_0x20ed52['error'](0x1f4,_0x517228[_0x25c8('0x1a')]));});});}; \ No newline at end of file +var _0x8185=['register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x44c5a6,_0x56967e){var _0x209b67=function(_0x579797){while(--_0x579797){_0x44c5a6['push'](_0x44c5a6['shift']());}};_0x209b67(++_0x56967e);}(_0x8185,0xb8));var _0x5818=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8185[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var moment=require(_0x5818('0x2'));var BPromise=require('bluebird');var rs=require(_0x5818('0x3'));var fs=require('fs');var Redis=require(_0x5818('0x4'));var db=require(_0x5818('0x5'))['db'];var utils=require(_0x5818('0x6'));var logger=require(_0x5818('0x7'))('rpc');var config=require(_0x5818('0x8'));var jayson=require(_0x5818('0x9'));var client=jayson[_0x5818('0xa')][_0x5818('0xb')]({'port':0x232a});config[_0x5818('0xc')]=_[_0x5818('0xd')](config[_0x5818('0xc')],{'host':_0x5818('0xe'),'port':0x18eb});var socket=require(_0x5818('0xf'))(new Redis(config[_0x5818('0xc')]));require('./chatQueue.socket')[_0x5818('0x10')](socket);function respondWithRpcPromise(_0x1196f7,_0x5ec895,_0x3f18d7){return new BPromise(function(_0x1154bc,_0x54f7f2){return client['request'](_0x1196f7,_0x3f18d7)[_0x5818('0x11')](function(_0x21df2b){logger['info'](_0x5818('0x12'),_0x5ec895,_0x5818('0x13'));logger[_0x5818('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5ec895,_0x5818('0x13'),JSON[_0x5818('0x15')](_0x21df2b));if(_0x21df2b[_0x5818('0x16')]){if(_0x21df2b[_0x5818('0x16')][_0x5818('0x17')]===0x1f4){logger['error'](_0x5818('0x12'),_0x5ec895,_0x21df2b[_0x5818('0x16')][_0x5818('0x18')]);return _0x54f7f2(_0x21df2b[_0x5818('0x16')][_0x5818('0x18')]);}logger[_0x5818('0x16')](_0x5818('0x12'),_0x5ec895,_0x21df2b['error'][_0x5818('0x18')]);return _0x1154bc(_0x21df2b['error']['message']);}else{logger[_0x5818('0x19')]('ChatQueue,\x20%s,\x20%s',_0x5ec895,_0x5818('0x13'));_0x1154bc(_0x21df2b[_0x5818('0x1a')][_0x5818('0x18')]);}})[_0x5818('0x1b')](function(_0x4501dc){logger['error'](_0x5818('0x12'),_0x5ec895,_0x4501dc);_0x54f7f2(_0x4501dc);});});}exports[_0x5818('0x1c')]=function(_0x3e49ba){var _0x1d7873=this;return new Promise(function(_0xae2494,_0x381da6){return db[_0x5818('0x1d')][_0x5818('0x1e')]({'raw':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba[_0x5818('0x1f')][_0x5818('0x20')]===undefined?!![]:![]:!![],'where':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba['options'][_0x5818('0x21')]||null:null,'attributes':_0x3e49ba['options']?_0x3e49ba[_0x5818('0x1f')][_0x5818('0x22')]||null:null,'limit':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba[_0x5818('0x1f')]['limit']||null:null,'include':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba['options'][_0x5818('0x23')]?_[_0x5818('0x24')](_0x3e49ba[_0x5818('0x1f')][_0x5818('0x23')],function(_0x350fdf){return{'model':db[_0x350fdf['model']],'as':_0x350fdf['as'],'attributes':_0x350fdf[_0x5818('0x22')],'include':_0x350fdf[_0x5818('0x23')]?_[_0x5818('0x24')](_0x350fdf[_0x5818('0x23')],function(_0x504efd){return{'model':db[_0x504efd[_0x5818('0x25')]],'as':_0x504efd['as'],'attributes':_0x504efd[_0x5818('0x22')],'include':_0x504efd['include']?_[_0x5818('0x24')](_0x504efd[_0x5818('0x23')],function(_0x5e3a6f){return{'model':db[_0x5e3a6f['model']],'as':_0x5e3a6f['as'],'attributes':_0x5e3a6f[_0x5818('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5818('0x11')](function(_0x2ae9b7){logger['info'](_0x5818('0x1c'),_0x3e49ba);logger[_0x5818('0x14')]('GetChatQueue',_0x3e49ba,JSON[_0x5818('0x15')](_0x2ae9b7));_0xae2494(_0x2ae9b7);})['catch'](function(_0x2c110f){logger['error']('GetChatQueue',_0x2c110f['message'],_0x3e49ba);_0x381da6(_0x1d7873[_0x5818('0x16')](0x1f4,_0x2c110f[_0x5818('0x18')]));});});};exports[_0x5818('0x26')]=function(_0xf639fb){var _0x44c2ad=this;return new Promise(function(_0x28df75,_0x303901){return db[_0x5818('0x1d')][_0x5818('0x27')]({'raw':_0xf639fb[_0x5818('0x1f')]?_0xf639fb['options'][_0x5818('0x20')]===undefined?!![]:![]:!![],'where':_0xf639fb[_0x5818('0x1f')]?_0xf639fb[_0x5818('0x1f')][_0x5818('0x21')]||null:null,'attributes':_0xf639fb['options']?_0xf639fb['options']['attributes']||null:null,'include':_0xf639fb[_0x5818('0x1f')]?_0xf639fb[_0x5818('0x1f')]['include']?_[_0x5818('0x24')](_0xf639fb[_0x5818('0x1f')][_0x5818('0x23')],function(_0x5a8df1){return{'model':db[_0x5a8df1['model']],'as':_0x5a8df1['as'],'attributes':_0x5a8df1[_0x5818('0x22')],'include':_0x5a8df1[_0x5818('0x23')]?_[_0x5818('0x24')](_0x5a8df1['include'],function(_0x305987){return{'model':db[_0x305987[_0x5818('0x25')]],'as':_0x305987['as'],'attributes':_0x305987[_0x5818('0x22')],'include':_0x305987['include']?_[_0x5818('0x24')](_0x305987['include'],function(_0x3d54a0){return{'model':db[_0x3d54a0[_0x5818('0x25')]],'as':_0x3d54a0['as'],'attributes':_0x3d54a0[_0x5818('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ef890){logger[_0x5818('0x19')](_0x5818('0x26'),_0xf639fb);logger[_0x5818('0x14')](_0x5818('0x26'),_0xf639fb,JSON[_0x5818('0x15')](_0x1ef890));_0x28df75(_0x1ef890);})[_0x5818('0x1b')](function(_0xade866){logger['error'](_0x5818('0x26'),_0xade866[_0x5818('0x18')],_0xf639fb);_0x303901(_0x44c2ad[_0x5818('0x16')](0x1f4,_0xade866[_0x5818('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8dce480..3b39c6b 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x2f9f2f,_0x5624e4){var _0x256f71=function(_0x33558a){while(--_0x33558a){_0x2f9f2f['push'](_0x2f9f2f['shift']());}};_0x256f71(++_0x5624e4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x3b0cb8,_0x2016df){var _0x66d77c=function(_0xd04f0e){while(--_0xd04f0e){_0x3b0cb8['push'](_0x3b0cb8['shift']());}};_0x66d77c(++_0x2016df);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x0b0e[_0x20589d];return _0x422de9;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 376a783..bf4d81e 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 _0x8ef7=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','getMembers'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x8ef7,0x1de));var _0x78ef=function(_0xa2638,_0x516079){_0xa2638=_0xa2638-0x0;var _0x17c1aa=_0x8ef7[_0xa2638];return _0x17c1aa;};'use strict';var multer=require(_0x78ef('0x0'));var util=require(_0x78ef('0x1'));var path=require('path');var timeout=require(_0x78ef('0x2'));var express=require(_0x78ef('0x3'));var router=express[_0x78ef('0x4')]();var auth=require(_0x78ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x78ef('0x6'));var controller=require(_0x78ef('0x7'));router['get']('/',auth[_0x78ef('0x8')](),controller[_0x78ef('0x9')]);router[_0x78ef('0xa')](_0x78ef('0xb'),auth['isAuthenticated'](),controller[_0x78ef('0xc')]);router[_0x78ef('0xa')](_0x78ef('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x78ef('0xa')]('/:id/members',auth[_0x78ef('0x8')](),controller[_0x78ef('0xe')]);router[_0x78ef('0xa')](_0x78ef('0xf'),auth[_0x78ef('0x8')](),controller[_0x78ef('0x10')]);router[_0x78ef('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x78ef('0x11')]);router[_0x78ef('0x12')]('/',auth[_0x78ef('0x8')](),controller[_0x78ef('0x13')]);router[_0x78ef('0x12')]('/:id/teams',auth[_0x78ef('0x8')](),controller[_0x78ef('0x14')]);router[_0x78ef('0x12')](_0x78ef('0x15'),auth[_0x78ef('0x8')](),controller[_0x78ef('0x16')]);router[_0x78ef('0x17')](_0x78ef('0xd'),auth['isAuthenticated'](),controller[_0x78ef('0x18')]);router[_0x78ef('0x19')](_0x78ef('0xd'),auth[_0x78ef('0x8')](),controller['destroy']);router[_0x78ef('0x19')](_0x78ef('0xf'),auth[_0x78ef('0x8')](),controller[_0x78ef('0x1a')]);router[_0x78ef('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x78ef('0x1b')]);module[_0x78ef('0x1c')]=router; \ No newline at end of file +var _0xb488=['/:id','update','destroy','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','describe','get','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb488,0x11d));var _0x8b48=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb488[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x8b48('0x0'));var util=require(_0x8b48('0x1'));var path=require(_0x8b48('0x2'));var timeout=require(_0x8b48('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8b48('0x4'));var interaction=require(_0x8b48('0x5'));var config=require(_0x8b48('0x6'));var controller=require(_0x8b48('0x7'));router['get']('/',auth[_0x8b48('0x8')](),controller[_0x8b48('0x9')]);router['get']('/describe',auth[_0x8b48('0x8')](),controller[_0x8b48('0xa')]);router[_0x8b48('0xb')]('/:id',auth[_0x8b48('0x8')](),controller[_0x8b48('0xc')]);router[_0x8b48('0xb')](_0x8b48('0xd'),auth[_0x8b48('0x8')](),controller[_0x8b48('0xe')]);router[_0x8b48('0xb')](_0x8b48('0xf'),auth[_0x8b48('0x8')](),controller[_0x8b48('0x10')]);router['get'](_0x8b48('0x11'),auth[_0x8b48('0x8')](),controller['getAgents']);router[_0x8b48('0x12')]('/',auth[_0x8b48('0x8')](),controller[_0x8b48('0x13')]);router[_0x8b48('0x12')](_0x8b48('0xf'),auth[_0x8b48('0x8')](),controller[_0x8b48('0x14')]);router['post']('/:id/users',auth[_0x8b48('0x8')](),controller[_0x8b48('0x15')]);router[_0x8b48('0x16')](_0x8b48('0x17'),auth[_0x8b48('0x8')](),controller[_0x8b48('0x18')]);router['delete'](_0x8b48('0x17'),auth['isAuthenticated'](),controller[_0x8b48('0x19')]);router[_0x8b48('0x1a')]('/:id/teams',auth[_0x8b48('0x8')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x8b48('0x8')](),controller['removeAgents']);module[_0x8b48('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0daa594..43fcab4 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 _0x3293=['DATE','moment','STRING'];(function(_0x51632c,_0x53a26c){var _0x456af9=function(_0x1adff7){while(--_0x1adff7){_0x51632c['push'](_0x51632c['shift']());}};_0x456af9(++_0x53a26c);}(_0x3293,0x15a));var _0x3329=function(_0x173131,_0x3e1ac9){_0x173131=_0x173131-0x0;var _0x5e55d2=_0x3293[_0x173131];return _0x5e55d2;};'use strict';var moment=require(_0x3329('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3329('0x1')]},'joinAt':{'type':Sequelize[_0x3329('0x2')]},'leaveAt':{'type':Sequelize[_0x3329('0x2')]},'acceptAt':{'type':Sequelize[_0x3329('0x2')]},'exitAt':{'type':Sequelize[_0x3329('0x2')]},'reason':{'type':Sequelize[_0x3329('0x1')]}}; \ No newline at end of file +var _0x9de9=['STRING','DATE','moment','sequelize'];(function(_0x1e6aa5,_0x2723bb){var _0x4ed7c7=function(_0x1ed544){while(--_0x1ed544){_0x1e6aa5['push'](_0x1e6aa5['shift']());}};_0x4ed7c7(++_0x2723bb);}(_0x9de9,0x13e));var _0x99de=function(_0x540f05,_0x26ee7b){_0x540f05=_0x540f05-0x0;var _0x21f2d4=_0x9de9[_0x540f05];return _0x21f2d4;};'use strict';var moment=require(_0x99de('0x0'));var Sequelize=require(_0x99de('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x99de('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x99de('0x2')]},'joinAt':{'type':Sequelize[_0x99de('0x3')]},'leaveAt':{'type':Sequelize[_0x99de('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x99de('0x3')]},'reason':{'type':Sequelize[_0x99de('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 956af8a..3348126 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 _0x3676=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','set','apply','reject','update','then','destroy','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','describe','html-pdf'];(function(_0x428de3,_0x111848){var _0x534dd1=function(_0x3050ad){while(--_0x3050ad){_0x428de3['push'](_0x428de3['shift']());}};_0x534dd1(++_0x111848);}(_0x3676,0x11f));var _0x6367=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x3676[_0x193e28];return _0x20ef59;};'use strict';var pdf=require(_0x6367('0x0'));var emlformat=require(_0x6367('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6367('0x2'));var jsonpatch=require(_0x6367('0x3'));var rp=require('request-promise');var moment=require(_0x6367('0x4'));var BPromise=require(_0x6367('0x5'));var Mustache=require(_0x6367('0x6'));var util=require(_0x6367('0x7'));var path=require(_0x6367('0x8'));var sox=require(_0x6367('0x9'));var csv=require(_0x6367('0xa'));var ejs=require(_0x6367('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6367('0xc'));var crypto=require(_0x6367('0xd'));var jsforce=require(_0x6367('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6367('0xa'));var querystring=require(_0x6367('0xf'));var Papa=require(_0x6367('0x10'));var Redis=require(_0x6367('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6367('0x12'));var logger=require(_0x6367('0x13'))('api');var utils=require(_0x6367('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6367('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41aa16,_0x34cbd7){_0x34cbd7=_0x34cbd7||0xcc;return function(_0x499b3c){if(_0x499b3c){return _0x41aa16[_0x6367('0x16')](_0x34cbd7);}return _0x41aa16['status'](_0x34cbd7)['end']();};}function respondWithResult(_0x3b73b8,_0x107756){_0x107756=_0x107756||0xc8;return function(_0x32dfa7){if(_0x32dfa7){return _0x3b73b8[_0x6367('0x17')](_0x107756)[_0x6367('0x18')](_0x32dfa7);}};}function respondWithFilteredResult(_0x4bc109,_0x3a1e12){return function(_0x5347f3){if(_0x5347f3){var _0x2c078f=_0x5347f3[_0x6367('0x19')],_0x5c1520=_0x3a1e12[_0x6367('0x1a')],_0xa4c18=_0x3a1e12['offset']+_0x3a1e12['limit'],_0x245aac;if(_0xa4c18>=_0x2c078f){_0xa4c18=_0x2c078f;_0x245aac=0xc8;}else{_0x245aac=0xce;}_0x4bc109['status'](_0x245aac);return _0x4bc109[_0x6367('0x1b')]('Content-Range',_0x5c1520+'-'+_0xa4c18+'/'+_0x2c078f)[_0x6367('0x18')](_0x5347f3);}return null;};}function patchUpdates(_0x2c1f36){return function(_0x357749){try{jsonpatch[_0x6367('0x1c')](_0x357749,_0x2c1f36,!![]);}catch(_0x57fa75){return BPromise[_0x6367('0x1d')](_0x57fa75);}return _0x357749['save']();};}function saveUpdates(_0x4f95ea,_0x54b776){return function(_0x1671ff){if(_0x1671ff){return _0x1671ff[_0x6367('0x1e')](_0x4f95ea)[_0x6367('0x1f')](function(_0x38e5cc){return _0x38e5cc;});}return null;};}function removeEntity(_0x3934da,_0x965d64){return function(_0x4f65f2){if(_0x4f65f2){return _0x4f65f2[_0x6367('0x20')]()[_0x6367('0x1f')](function(){_0x3934da[_0x6367('0x17')](0xcc)[_0x6367('0x21')]();});}};}function handleEntityNotFound(_0x4e701c,_0x96f10d){return function(_0xe11167){if(!_0xe11167){_0x4e701c[_0x6367('0x16')](0x194);}return _0xe11167;};}function handleError(_0x2b2cdf,_0x521e46){_0x521e46=_0x521e46||0x1f4;return function(_0x31f8e5){logger[_0x6367('0x22')](_0x31f8e5['stack']);if(_0x31f8e5['name']){delete _0x31f8e5[_0x6367('0x23')];}_0x2b2cdf[_0x6367('0x17')](_0x521e46)[_0x6367('0x24')](_0x31f8e5);};}exports[_0x6367('0x25')]=function(_0x56ec68,_0x1e0acc){var _0x107f33={},_0xa69941={},_0x42234b={'count':0x0,'rows':[]};var _0x6b4fa7=_[_0x6367('0x26')](db[_0x6367('0x27')][_0x6367('0x28')],function(_0x38eb0e){return{'name':_0x38eb0e[_0x6367('0x29')],'type':_0x38eb0e[_0x6367('0x2a')][_0x6367('0x2b')]};});_0xa69941[_0x6367('0x2c')]=_['map'](_0x6b4fa7,'name');_0xa69941[_0x6367('0x2d')]=_[_0x6367('0x2e')](_0x56ec68['query']);_0xa69941[_0x6367('0x2f')]=_[_0x6367('0x30')](_0xa69941['model'],_0xa69941[_0x6367('0x2d')]);_0x107f33[_0x6367('0x31')]=_[_0x6367('0x30')](_0xa69941[_0x6367('0x2c')],qs['fields'](_0x56ec68[_0x6367('0x2d')]['fields']));_0x107f33[_0x6367('0x31')]=_0x107f33[_0x6367('0x31')][_0x6367('0x32')]?_0x107f33['attributes']:_0xa69941['model'];if(!_0x56ec68[_0x6367('0x2d')]['hasOwnProperty'](_0x6367('0x33'))){_0x107f33[_0x6367('0x34')]=qs[_0x6367('0x34')](_0x56ec68[_0x6367('0x2d')][_0x6367('0x34')]);_0x107f33[_0x6367('0x1a')]=qs[_0x6367('0x1a')](_0x56ec68[_0x6367('0x2d')][_0x6367('0x1a')]);}_0x107f33[_0x6367('0x35')]=qs[_0x6367('0x36')](_0x56ec68[_0x6367('0x2d')]['sort']);_0x107f33[_0x6367('0x37')]=qs[_0x6367('0x2f')](_[_0x6367('0x38')](_0x56ec68[_0x6367('0x2d')],_0xa69941[_0x6367('0x2f')]),_0x6b4fa7);if(_0x56ec68[_0x6367('0x2d')][_0x6367('0x39')]){_0x107f33[_0x6367('0x37')]=_[_0x6367('0x3a')](_0x107f33['where'],{'$or':_[_0x6367('0x26')](_0x6b4fa7,function(_0x130024){if(_0x130024[_0x6367('0x2a')]!==_0x6367('0x3b')){var _0x598abc={};_0x598abc[_0x130024['name']]={'$like':'%'+_0x56ec68[_0x6367('0x2d')][_0x6367('0x39')]+'%'};return _0x598abc;}})});}_0x107f33=_[_0x6367('0x3a')]({},_0x107f33,_0x56ec68[_0x6367('0x3c')]);var _0x362377={'where':_0x107f33[_0x6367('0x37')]};return db[_0x6367('0x27')][_0x6367('0x19')](_0x362377)[_0x6367('0x1f')](function(_0x1dfc83){_0x42234b['count']=_0x1dfc83;if(_0x56ec68[_0x6367('0x2d')][_0x6367('0x3d')]){_0x107f33[_0x6367('0x3e')]=[{'all':!![]}];}return db[_0x6367('0x27')][_0x6367('0x3f')](_0x107f33);})[_0x6367('0x1f')](function(_0x192412){_0x42234b['rows']=_0x192412;return _0x42234b;})[_0x6367('0x1f')](respondWithFilteredResult(_0x1e0acc,_0x107f33))[_0x6367('0x40')](handleError(_0x1e0acc,null));};exports[_0x6367('0x41')]=function(_0x3003f5,_0x22feac){var _0x35217a={'raw':!![],'where':{'id':_0x3003f5[_0x6367('0x42')]['id']}},_0x1152c9={};_0x1152c9[_0x6367('0x2c')]=_[_0x6367('0x2e')](db[_0x6367('0x27')][_0x6367('0x28')]);_0x1152c9[_0x6367('0x2d')]=_[_0x6367('0x2e')](_0x3003f5[_0x6367('0x2d')]);_0x1152c9['filters']=_[_0x6367('0x30')](_0x1152c9['model'],_0x1152c9['query']);_0x35217a[_0x6367('0x31')]=_['intersection'](_0x1152c9[_0x6367('0x2c')],qs[_0x6367('0x43')](_0x3003f5['query'][_0x6367('0x43')]));_0x35217a[_0x6367('0x31')]=_0x35217a[_0x6367('0x31')][_0x6367('0x32')]?_0x35217a[_0x6367('0x31')]:_0x1152c9[_0x6367('0x2c')];if(_0x3003f5[_0x6367('0x2d')][_0x6367('0x3d')]){_0x35217a[_0x6367('0x3e')]=[{'all':!![]}];}_0x35217a=_[_0x6367('0x3a')]({},_0x35217a,_0x3003f5[_0x6367('0x3c')]);return db[_0x6367('0x27')][_0x6367('0x44')](_0x35217a)[_0x6367('0x1f')](handleEntityNotFound(_0x22feac,null))[_0x6367('0x1f')](respondWithResult(_0x22feac,null))['catch'](handleError(_0x22feac,null));};exports[_0x6367('0x45')]=function(_0x9d89c5,_0x5715e2){return db[_0x6367('0x27')][_0x6367('0x45')](_0x9d89c5[_0x6367('0x46')],{})[_0x6367('0x1f')](respondWithResult(_0x5715e2,0xc9))[_0x6367('0x40')](handleError(_0x5715e2,null));};exports[_0x6367('0x1e')]=function(_0x3d95fc,_0x47211c){if(_0x3d95fc['body']['id']){delete _0x3d95fc[_0x6367('0x46')]['id'];}return db[_0x6367('0x27')][_0x6367('0x44')]({'where':{'id':_0x3d95fc[_0x6367('0x42')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x47211c,null))['then'](saveUpdates(_0x3d95fc[_0x6367('0x46')],null))[_0x6367('0x1f')](respondWithResult(_0x47211c,null))[_0x6367('0x40')](handleError(_0x47211c,null));};exports[_0x6367('0x20')]=function(_0x1a82a8,_0x22e856){return db[_0x6367('0x27')][_0x6367('0x44')]({'where':{'id':_0x1a82a8[_0x6367('0x42')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x22e856,null))[_0x6367('0x1f')](removeEntity(_0x22e856,null))[_0x6367('0x40')](handleError(_0x22e856,null));};exports[_0x6367('0x47')]=function(_0xd7658b,_0x4ca1e3){return db['ChatQueueReport']['describe']()[_0x6367('0x1f')](respondWithResult(_0x4ca1e3,null))[_0x6367('0x40')](handleError(_0x4ca1e3,null));}; \ No newline at end of file +var _0xcfe9=['keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','describe','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','key','model','query'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xcfe9,0x99));var _0x9cfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfe9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9cfe('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cfe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9cfe('0x2'));var moment=require('moment');var BPromise=require(_0x9cfe('0x3'));var Mustache=require(_0x9cfe('0x4'));var util=require(_0x9cfe('0x5'));var path=require(_0x9cfe('0x6'));var sox=require(_0x9cfe('0x7'));var csv=require(_0x9cfe('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cfe('0x9'));var squel=require(_0x9cfe('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9cfe('0x8'));var querystring=require('querystring');var Papa=require(_0x9cfe('0xb'));var Redis=require('ioredis');var authService=require(_0x9cfe('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cfe('0xd'));var logger=require(_0x9cfe('0xe'))(_0x9cfe('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9cfe('0x10'))['db'];function respondWithStatusCode(_0x41f34c,_0x1024e4){_0x1024e4=_0x1024e4||0xcc;return function(_0x26aa88){if(_0x26aa88){return _0x41f34c[_0x9cfe('0x11')](_0x1024e4);}return _0x41f34c['status'](_0x1024e4)['end']();};}function respondWithResult(_0x48ee4c,_0x117d0c){_0x117d0c=_0x117d0c||0xc8;return function(_0x89ed22){if(_0x89ed22){return _0x48ee4c[_0x9cfe('0x12')](_0x117d0c)[_0x9cfe('0x13')](_0x89ed22);}};}function respondWithFilteredResult(_0xccc8fa,_0x2479ea){return function(_0x1b05dc){if(_0x1b05dc){var _0x5aff85=_0x1b05dc[_0x9cfe('0x14')],_0x1e39b9=_0x2479ea[_0x9cfe('0x15')],_0x480023=_0x2479ea['offset']+_0x2479ea[_0x9cfe('0x16')],_0x5f38e4;if(_0x480023>=_0x5aff85){_0x480023=_0x5aff85;_0x5f38e4=0xc8;}else{_0x5f38e4=0xce;}_0xccc8fa['status'](_0x5f38e4);return _0xccc8fa['set']('Content-Range',_0x1e39b9+'-'+_0x480023+'/'+_0x5aff85)[_0x9cfe('0x13')](_0x1b05dc);}return null;};}function patchUpdates(_0x230696){return function(_0x5bf674){try{jsonpatch[_0x9cfe('0x17')](_0x5bf674,_0x230696,!![]);}catch(_0x22d176){return BPromise[_0x9cfe('0x18')](_0x22d176);}return _0x5bf674['save']();};}function saveUpdates(_0x21d7c4,_0x5a9dc5){return function(_0x502cfa){if(_0x502cfa){return _0x502cfa[_0x9cfe('0x19')](_0x21d7c4)[_0x9cfe('0x1a')](function(_0x9b9abf){return _0x9b9abf;});}return null;};}function removeEntity(_0x363cb8,_0x584afc){return function(_0xdec8ed){if(_0xdec8ed){return _0xdec8ed[_0x9cfe('0x1b')]()[_0x9cfe('0x1a')](function(){_0x363cb8[_0x9cfe('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36eb18,_0x120404){return function(_0x389c71){if(!_0x389c71){_0x36eb18[_0x9cfe('0x11')](0x194);}return _0x389c71;};}function handleError(_0x58f488,_0x203db9){_0x203db9=_0x203db9||0x1f4;return function(_0x54815a){logger[_0x9cfe('0x1c')](_0x54815a[_0x9cfe('0x1d')]);if(_0x54815a['name']){delete _0x54815a[_0x9cfe('0x1e')];}_0x58f488[_0x9cfe('0x12')](_0x203db9)[_0x9cfe('0x1f')](_0x54815a);};}exports[_0x9cfe('0x20')]=function(_0x249026,_0x5e3f5a){var _0x1e2ac1={},_0x4811e6={},_0x3aa431={'count':0x0,'rows':[]};var _0x43360c=_[_0x9cfe('0x21')](db[_0x9cfe('0x22')][_0x9cfe('0x23')],function(_0x43ecac){return{'name':_0x43ecac['fieldName'],'type':_0x43ecac['type'][_0x9cfe('0x24')]};});_0x4811e6[_0x9cfe('0x25')]=_[_0x9cfe('0x21')](_0x43360c,_0x9cfe('0x1e'));_0x4811e6[_0x9cfe('0x26')]=_[_0x9cfe('0x27')](_0x249026[_0x9cfe('0x26')]);_0x4811e6[_0x9cfe('0x28')]=_[_0x9cfe('0x29')](_0x4811e6[_0x9cfe('0x25')],_0x4811e6[_0x9cfe('0x26')]);_0x1e2ac1[_0x9cfe('0x2a')]=_[_0x9cfe('0x29')](_0x4811e6[_0x9cfe('0x25')],qs['fields'](_0x249026[_0x9cfe('0x26')][_0x9cfe('0x2b')]));_0x1e2ac1[_0x9cfe('0x2a')]=_0x1e2ac1[_0x9cfe('0x2a')][_0x9cfe('0x2c')]?_0x1e2ac1['attributes']:_0x4811e6[_0x9cfe('0x25')];if(!_0x249026[_0x9cfe('0x26')]['hasOwnProperty']('nolimit')){_0x1e2ac1['limit']=qs['limit'](_0x249026[_0x9cfe('0x26')][_0x9cfe('0x16')]);_0x1e2ac1[_0x9cfe('0x15')]=qs[_0x9cfe('0x15')](_0x249026['query']['offset']);}_0x1e2ac1[_0x9cfe('0x2d')]=qs[_0x9cfe('0x2e')](_0x249026[_0x9cfe('0x26')]['sort']);_0x1e2ac1[_0x9cfe('0x2f')]=qs[_0x9cfe('0x28')](_[_0x9cfe('0x30')](_0x249026['query'],_0x4811e6[_0x9cfe('0x28')]),_0x43360c);if(_0x249026[_0x9cfe('0x26')][_0x9cfe('0x31')]){_0x1e2ac1[_0x9cfe('0x2f')]=_[_0x9cfe('0x32')](_0x1e2ac1[_0x9cfe('0x2f')],{'$or':_[_0x9cfe('0x21')](_0x43360c,function(_0x2e3e3c){if(_0x2e3e3c[_0x9cfe('0x33')]!==_0x9cfe('0x34')){var _0x1808a1={};_0x1808a1[_0x2e3e3c['name']]={'$like':'%'+_0x249026[_0x9cfe('0x26')]['filter']+'%'};return _0x1808a1;}})});}_0x1e2ac1=_[_0x9cfe('0x32')]({},_0x1e2ac1,_0x249026['options']);var _0x101602={'where':_0x1e2ac1[_0x9cfe('0x2f')]};return db[_0x9cfe('0x22')][_0x9cfe('0x14')](_0x101602)[_0x9cfe('0x1a')](function(_0x328289){_0x3aa431[_0x9cfe('0x14')]=_0x328289;if(_0x249026[_0x9cfe('0x26')]['includeAll']){_0x1e2ac1[_0x9cfe('0x35')]=[{'all':!![]}];}return db[_0x9cfe('0x22')][_0x9cfe('0x36')](_0x1e2ac1);})[_0x9cfe('0x1a')](function(_0x144aa9){_0x3aa431[_0x9cfe('0x37')]=_0x144aa9;return _0x3aa431;})['then'](respondWithFilteredResult(_0x5e3f5a,_0x1e2ac1))[_0x9cfe('0x38')](handleError(_0x5e3f5a,null));};exports[_0x9cfe('0x39')]=function(_0x1ef784,_0x223a55){var _0x1a97e8={'raw':!![],'where':{'id':_0x1ef784['params']['id']}},_0x63d10c={};_0x63d10c[_0x9cfe('0x25')]=_[_0x9cfe('0x27')](db[_0x9cfe('0x22')]['rawAttributes']);_0x63d10c[_0x9cfe('0x26')]=_['keys'](_0x1ef784[_0x9cfe('0x26')]);_0x63d10c[_0x9cfe('0x28')]=_[_0x9cfe('0x29')](_0x63d10c[_0x9cfe('0x25')],_0x63d10c['query']);_0x1a97e8['attributes']=_[_0x9cfe('0x29')](_0x63d10c[_0x9cfe('0x25')],qs[_0x9cfe('0x2b')](_0x1ef784[_0x9cfe('0x26')][_0x9cfe('0x2b')]));_0x1a97e8['attributes']=_0x1a97e8[_0x9cfe('0x2a')][_0x9cfe('0x2c')]?_0x1a97e8[_0x9cfe('0x2a')]:_0x63d10c[_0x9cfe('0x25')];if(_0x1ef784[_0x9cfe('0x26')][_0x9cfe('0x3a')]){_0x1a97e8[_0x9cfe('0x35')]=[{'all':!![]}];}_0x1a97e8=_[_0x9cfe('0x32')]({},_0x1a97e8,_0x1ef784[_0x9cfe('0x3b')]);return db[_0x9cfe('0x22')][_0x9cfe('0x3c')](_0x1a97e8)[_0x9cfe('0x1a')](handleEntityNotFound(_0x223a55,null))['then'](respondWithResult(_0x223a55,null))['catch'](handleError(_0x223a55,null));};exports[_0x9cfe('0x3d')]=function(_0x9fc875,_0x2ce9dc){return db[_0x9cfe('0x22')]['create'](_0x9fc875[_0x9cfe('0x3e')],{})['then'](respondWithResult(_0x2ce9dc,0xc9))[_0x9cfe('0x38')](handleError(_0x2ce9dc,null));};exports[_0x9cfe('0x19')]=function(_0x99bdfe,_0x300719){if(_0x99bdfe[_0x9cfe('0x3e')]['id']){delete _0x99bdfe['body']['id'];}return db[_0x9cfe('0x22')]['find']({'where':{'id':_0x99bdfe['params']['id']}})[_0x9cfe('0x1a')](handleEntityNotFound(_0x300719,null))[_0x9cfe('0x1a')](saveUpdates(_0x99bdfe[_0x9cfe('0x3e')],null))[_0x9cfe('0x1a')](respondWithResult(_0x300719,null))[_0x9cfe('0x38')](handleError(_0x300719,null));};exports[_0x9cfe('0x1b')]=function(_0x141a44,_0x2d9d07){return db[_0x9cfe('0x22')][_0x9cfe('0x3c')]({'where':{'id':_0x141a44['params']['id']}})['then'](handleEntityNotFound(_0x2d9d07,null))[_0x9cfe('0x1a')](removeEntity(_0x2d9d07,null))['catch'](handleError(_0x2d9d07,null));};exports[_0x9cfe('0x3f')]=function(_0x4a0f96,_0xca2e16){return db['ChatQueueReport'][_0x9cfe('0x3f')]()[_0x9cfe('0x1a')](respondWithResult(_0xca2e16,null))[_0x9cfe('0x38')](handleError(_0xca2e16,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 1ad2ea5..215c33b 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 _0x8949=['ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatQueueReport.attributes','exports','define'];(function(_0x4b152f,_0x1bf5d8){var _0x38e7be=function(_0x2f942a){while(--_0x2f942a){_0x4b152f['push'](_0x4b152f['shift']());}};_0x38e7be(++_0x1bf5d8);}(_0x8949,0x1d7));var _0x9894=function(_0x5c1726,_0x27281a){_0x5c1726=_0x5c1726-0x0;var _0x20f183=_0x8949[_0x5c1726];return _0x20f183;};'use strict';var _=require('lodash');var util=require(_0x9894('0x0'));var logger=require(_0x9894('0x1'))('api');var moment=require(_0x9894('0x2'));var BPromise=require(_0x9894('0x3'));var rp=require(_0x9894('0x4'));var fs=require('fs');var path=require(_0x9894('0x5'));var rimraf=require(_0x9894('0x6'));var config=require('../../config/environment');var attributes=require(_0x9894('0x7'));module[_0x9894('0x8')]=function(_0x409e03,_0x523608){return _0x409e03[_0x9894('0x9')](_0x9894('0xa'),attributes,{'tableName':_0x9894('0xb'),'paranoid':![],'indexes':[{'name':_0x9894('0xc'),'fields':[_0x9894('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb182=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid'];(function(_0x34e865,_0x38bc20){var _0x4eb49c=function(_0x567f02){while(--_0x567f02){_0x34e865['push'](_0x34e865['shift']());}};_0x4eb49c(++_0x38bc20);}(_0xb182,0x17a));var _0x2b18=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0xb182[_0x316c42];return _0x2b38f7;};'use strict';var _=require(_0x2b18('0x0'));var util=require(_0x2b18('0x1'));var logger=require(_0x2b18('0x2'))(_0x2b18('0x3'));var moment=require(_0x2b18('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b18('0x5'));var fs=require('fs');var path=require(_0x2b18('0x6'));var rimraf=require(_0x2b18('0x7'));var config=require(_0x2b18('0x8'));var attributes=require(_0x2b18('0x9'));module[_0x2b18('0xa')]=function(_0x3fba45,_0x49b779){return _0x3fba45[_0x2b18('0xb')]('ChatQueueReport',attributes,{'tableName':_0x2b18('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2b18('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index f38a6e3..c8af2bc 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 _0xda76=['UpdateChatQueueReport','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatQueueReport','create','body','options','CreateChatQueueReport'];(function(_0x26e795,_0x4a69b3){var _0x3366c0=function(_0xab0d99){while(--_0xab0d99){_0x26e795['push'](_0x26e795['shift']());}};_0x3366c0(++_0x4a69b3);}(_0xda76,0x164));var _0x6da7=function(_0x3bf625,_0x250b9f){_0x3bf625=_0x3bf625-0x0;var _0x7f867f=_0xda76[_0x3bf625];return _0x7f867f;};'use strict';var _=require(_0x6da7('0x0'));var util=require(_0x6da7('0x1'));var moment=require(_0x6da7('0x2'));var BPromise=require(_0x6da7('0x3'));var rs=require(_0x6da7('0x4'));var fs=require('fs');var Redis=require(_0x6da7('0x5'));var db=require(_0x6da7('0x6'))['db'];var utils=require(_0x6da7('0x7'));var logger=require(_0x6da7('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6da7('0x9'));var client=jayson['client'][_0x6da7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8691,_0x2fe892,_0x411dd3){return new BPromise(function(_0x547cbb,_0x50f6fb){return client[_0x6da7('0xb')](_0x1b8691,_0x411dd3)[_0x6da7('0xc')](function(_0x10cc01){logger[_0x6da7('0xd')](_0x6da7('0xe'),_0x2fe892,_0x6da7('0xf'));logger[_0x6da7('0x10')](_0x6da7('0x11'),_0x2fe892,_0x6da7('0xf'),JSON[_0x6da7('0x12')](_0x10cc01));if(_0x10cc01[_0x6da7('0x13')]){if(_0x10cc01['error'][_0x6da7('0x14')]===0x1f4){logger[_0x6da7('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x2fe892,_0x10cc01[_0x6da7('0x13')]['message']);return _0x50f6fb(_0x10cc01['error'][_0x6da7('0x15')]);}logger['error'](_0x6da7('0xe'),_0x2fe892,_0x10cc01[_0x6da7('0x13')][_0x6da7('0x15')]);return _0x547cbb(_0x10cc01[_0x6da7('0x13')]['message']);}else{logger[_0x6da7('0xd')](_0x6da7('0xe'),_0x2fe892,_0x6da7('0xf'));_0x547cbb(_0x10cc01['result'][_0x6da7('0x15')]);}})[_0x6da7('0x16')](function(_0x40f5f8){logger[_0x6da7('0x13')](_0x6da7('0xe'),_0x2fe892,_0x40f5f8);_0x50f6fb(_0x40f5f8);});});}exports['CreateChatQueueReport']=function(_0x4dedcb){var _0x7e9c13=this;return new Promise(function(_0x4d24a8,_0x4557d0){return db[_0x6da7('0x17')][_0x6da7('0x18')](_0x4dedcb[_0x6da7('0x19')],{'raw':_0x4dedcb[_0x6da7('0x1a')]?_0x4dedcb[_0x6da7('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x6da7('0xc')](function(_0x1170d6){logger['info'](_0x6da7('0x1b'),_0x4dedcb);logger['debug'](_0x6da7('0x1b'),_0x4dedcb,JSON[_0x6da7('0x12')](_0x1170d6));_0x4d24a8(_0x1170d6);})['catch'](function(_0x57b375){logger['error'](_0x6da7('0x1b'),_0x57b375[_0x6da7('0x15')],_0x4dedcb);_0x4557d0(_0x7e9c13[_0x6da7('0x13')](0x1f4,_0x57b375[_0x6da7('0x15')]));});});};exports[_0x6da7('0x1c')]=function(_0x4cd2f4){var _0x5ba37f=this;return new Promise(function(_0x1dfbe7,_0x1700a4){return db[_0x6da7('0x17')]['update'](_0x4cd2f4[_0x6da7('0x19')],{'raw':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4['options'][_0x6da7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4['options']['where']||null:null,'attributes':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4['options'][_0x6da7('0x1e')]||null:null,'limit':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4[_0x6da7('0x1a')][_0x6da7('0x1f')]||null:null})['then'](function(_0x3299e1){logger[_0x6da7('0xd')]('UpdateChatQueueReport',_0x4cd2f4);logger[_0x6da7('0x10')](_0x6da7('0x1c'),_0x4cd2f4,JSON[_0x6da7('0x12')](_0x3299e1));_0x1dfbe7(_0x3299e1);})[_0x6da7('0x16')](function(_0xa7619f){logger[_0x6da7('0x13')](_0x6da7('0x1c'),_0xa7619f[_0x6da7('0x15')],_0x4cd2f4);_0x1700a4(_0x5ba37f[_0x6da7('0x13')](0x1f4,_0xa7619f[_0x6da7('0x15')]));});});}; \ No newline at end of file +var _0x3613=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatQueueReport','create','body','raw','CreateChatQueueReport','UpdateChatQueueReport','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0x3613,0x13f));var _0x3361=function(_0x553e5b,_0x28bfaa){_0x553e5b=_0x553e5b-0x0;var _0x11f1db=_0x3613[_0x553e5b];return _0x11f1db;};'use strict';var _=require(_0x3361('0x0'));var util=require(_0x3361('0x1'));var moment=require('moment');var BPromise=require(_0x3361('0x2'));var rs=require(_0x3361('0x3'));var fs=require('fs');var Redis=require(_0x3361('0x4'));var db=require(_0x3361('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3361('0x6'))(_0x3361('0x7'));var config=require('../../config/environment');var jayson=require(_0x3361('0x8'));var client=jayson[_0x3361('0x9')][_0x3361('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1628d7,_0x50c581,_0x507969){return new BPromise(function(_0x2114b7,_0x52975){return client['request'](_0x1628d7,_0x507969)[_0x3361('0xb')](function(_0x1bc0a7){logger[_0x3361('0xc')](_0x3361('0xd'),_0x50c581,_0x3361('0xe'));logger[_0x3361('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x50c581,_0x3361('0xe'),JSON[_0x3361('0x10')](_0x1bc0a7));if(_0x1bc0a7['error']){if(_0x1bc0a7[_0x3361('0x11')][_0x3361('0x12')]===0x1f4){logger[_0x3361('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x50c581,_0x1bc0a7[_0x3361('0x11')][_0x3361('0x13')]);return _0x52975(_0x1bc0a7[_0x3361('0x11')]['message']);}logger[_0x3361('0x11')](_0x3361('0xd'),_0x50c581,_0x1bc0a7[_0x3361('0x11')][_0x3361('0x13')]);return _0x2114b7(_0x1bc0a7[_0x3361('0x11')][_0x3361('0x13')]);}else{logger['info'](_0x3361('0xd'),_0x50c581,'request\x20sent');_0x2114b7(_0x1bc0a7[_0x3361('0x14')][_0x3361('0x13')]);}})[_0x3361('0x15')](function(_0x4c0879){logger['error'](_0x3361('0xd'),_0x50c581,_0x4c0879);_0x52975(_0x4c0879);});});}exports['CreateChatQueueReport']=function(_0x582ac2){var _0x1c53c4=this;return new Promise(function(_0x592613,_0x63429c){return db[_0x3361('0x16')][_0x3361('0x17')](_0x582ac2[_0x3361('0x18')],{'raw':_0x582ac2['options']?_0x582ac2['options'][_0x3361('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5a7759){logger[_0x3361('0xc')](_0x3361('0x1a'),_0x582ac2);logger[_0x3361('0xf')](_0x3361('0x1a'),_0x582ac2,JSON[_0x3361('0x10')](_0x5a7759));_0x592613(_0x5a7759);})[_0x3361('0x15')](function(_0x16708e){logger[_0x3361('0x11')](_0x3361('0x1a'),_0x16708e[_0x3361('0x13')],_0x582ac2);_0x63429c(_0x1c53c4[_0x3361('0x11')](0x1f4,_0x16708e[_0x3361('0x13')]));});});};exports[_0x3361('0x1b')]=function(_0x162fee){var _0x453a31=this;return new Promise(function(_0x13f7dc,_0x4dae14){return db[_0x3361('0x16')][_0x3361('0x1c')](_0x162fee['body'],{'raw':_0x162fee[_0x3361('0x1d')]?_0x162fee[_0x3361('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x162fee[_0x3361('0x1d')]?_0x162fee['options'][_0x3361('0x1e')]||null:null,'attributes':_0x162fee['options']?_0x162fee['options'][_0x3361('0x1f')]||null:null,'limit':_0x162fee[_0x3361('0x1d')]?_0x162fee[_0x3361('0x1d')][_0x3361('0x20')]||null:null})[_0x3361('0xb')](function(_0x26dd7a){logger[_0x3361('0xc')](_0x3361('0x1b'),_0x162fee);logger[_0x3361('0xf')](_0x3361('0x1b'),_0x162fee,JSON[_0x3361('0x10')](_0x26dd7a));_0x13f7dc(_0x26dd7a);})[_0x3361('0x15')](function(_0xb56214){logger[_0x3361('0x11')]('UpdateChatQueueReport',_0xb56214[_0x3361('0x13')],_0x162fee);_0x4dae14(_0x453a31[_0x3361('0x11')](0x1f4,_0xb56214[_0x3361('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bc82d2d..99147ab 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 _0x4cf9=['describe','/:id','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','isAuthenticated'];(function(_0x32f7ca,_0x32d77c){var _0x556d00=function(_0x4f33e6){while(--_0x4f33e6){_0x32f7ca['push'](_0x32f7ca['shift']());}};_0x556d00(++_0x32d77c);}(_0x4cf9,0x16f));var _0x94cf=function(_0x37039d,_0x45b79a){_0x37039d=_0x37039d-0x0;var _0x433e70=_0x4cf9[_0x37039d];return _0x433e70;};'use strict';var multer=require(_0x94cf('0x0'));var util=require(_0x94cf('0x1'));var path=require(_0x94cf('0x2'));var timeout=require(_0x94cf('0x3'));var express=require(_0x94cf('0x4'));var router=express[_0x94cf('0x5')]();var auth=require(_0x94cf('0x6'));var interaction=require(_0x94cf('0x7'));var config=require(_0x94cf('0x8'));var controller=require(_0x94cf('0x9'));router[_0x94cf('0xa')]('/',auth['isAuthenticated'](),controller[_0x94cf('0xb')]);router['get']('/describe',auth[_0x94cf('0xc')](),controller[_0x94cf('0xd')]);router[_0x94cf('0xa')](_0x94cf('0xe'),auth[_0x94cf('0xc')](),controller['show']);router[_0x94cf('0xf')]('/',auth[_0x94cf('0xc')](),controller['create']);router[_0x94cf('0x10')](_0x94cf('0xe'),auth[_0x94cf('0xc')](),controller[_0x94cf('0x11')]);router[_0x94cf('0x12')](_0x94cf('0xe'),auth[_0x94cf('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe0b8=['get','isAuthenticated','index','describe','show','post','create','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller'];(function(_0x3f136a,_0x46c695){var _0xef9409=function(_0x431edc){while(--_0x431edc){_0x3f136a['push'](_0x3f136a['shift']());}};_0xef9409(++_0x46c695);}(_0xe0b8,0x14d));var _0x8e0b=function(_0x7a5fee,_0x303e77){_0x7a5fee=_0x7a5fee-0x0;var _0x16ac13=_0xe0b8[_0x7a5fee];return _0x16ac13;};'use strict';var multer=require(_0x8e0b('0x0'));var util=require(_0x8e0b('0x1'));var path=require(_0x8e0b('0x2'));var timeout=require(_0x8e0b('0x3'));var express=require(_0x8e0b('0x4'));var router=express[_0x8e0b('0x5')]();var auth=require(_0x8e0b('0x6'));var interaction=require(_0x8e0b('0x7'));var config=require('../../config/environment');var controller=require(_0x8e0b('0x8'));router[_0x8e0b('0x9')]('/',auth[_0x8e0b('0xa')](),controller[_0x8e0b('0xb')]);router[_0x8e0b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8e0b('0xc')]);router['get']('/:id',auth[_0x8e0b('0xa')](),controller[_0x8e0b('0xd')]);router[_0x8e0b('0xe')]('/',auth[_0x8e0b('0xa')](),controller[_0x8e0b('0xf')]);router['put'](_0x8e0b('0x10'),auth[_0x8e0b('0xa')](),controller['update']);router[_0x8e0b('0x11')](_0x8e0b('0x10'),auth[_0x8e0b('0xa')](),controller['destroy']);module[_0x8e0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a74578e..e0b17c3 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 _0x9f51=['sequelize','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x4125a4,_0x35f11e){var _0x1a0f9c=function(_0x29daf8){while(--_0x29daf8){_0x4125a4['push'](_0x4125a4['shift']());}};_0x1a0f9c(++_0x35f11e);}(_0x9f51,0x137));var _0x19f5=function(_0x2bbd2d,_0x37c3c4){_0x2bbd2d=_0x2bbd2d-0x0;var _0x257dc9=_0x9f51[_0x2bbd2d];return _0x257dc9;};'use strict';var moment=require(_0x19f5('0x0'));var Sequelize=require(_0x19f5('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x19f5('0x2')](_0x19f5('0x3'),_0x19f5('0x4'),_0x19f5('0x5')),'allowNull':![],'defaultValue':_0x19f5('0x5')},'transferredAt':{'type':Sequelize[_0x19f5('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x19f5('0x7')]}}; \ No newline at end of file +var _0x8ee5=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ee5,0x108));var _0x58ee=function(_0x4c6ff7,_0x26b6b9){_0x4c6ff7=_0x4c6ff7-0x0;var _0xd94a98=_0x8ee5[_0x4c6ff7];return _0xd94a98;};'use strict';var moment=require(_0x58ee('0x0'));var Sequelize=require('sequelize');module[_0x58ee('0x1')]={'uniqueid':{'type':Sequelize[_0x58ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x58ee('0x3')](_0x58ee('0x4'),_0x58ee('0x5'),_0x58ee('0x6')),'allowNull':![],'defaultValue':_0x58ee('0x6')},'transferredAt':{'type':Sequelize[_0x58ee('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x58ee('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index f819296..c3564c4 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 _0x6df6=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','create','body','find','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x17c15a,_0x5c6c0f){var _0x43b519=function(_0x23fcf2){while(--_0x23fcf2){_0x17c15a['push'](_0x17c15a['shift']());}};_0x43b519(++_0x5c6c0f);}(_0x6df6,0x16b));var _0x66df=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x6df6[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0x66df('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x66df('0x1'));var zipdir=require(_0x66df('0x2'));var jsonpatch=require(_0x66df('0x3'));var rp=require(_0x66df('0x4'));var moment=require(_0x66df('0x5'));var BPromise=require(_0x66df('0x6'));var Mustache=require(_0x66df('0x7'));var util=require(_0x66df('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x66df('0x9'));var ejs=require(_0x66df('0xa'));var fs=require('fs');var _=require(_0x66df('0xb'));var squel=require(_0x66df('0xc'));var crypto=require(_0x66df('0xd'));var jsforce=require(_0x66df('0xe'));var deskjs=require(_0x66df('0xf'));var toCsv=require(_0x66df('0x9'));var querystring=require('querystring');var Papa=require(_0x66df('0x10'));var Redis=require(_0x66df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66df('0x12'));var as=require(_0x66df('0x13'));var hardwareService=require(_0x66df('0x14'));var logger=require('../../config/logger')(_0x66df('0x15'));var utils=require('../../config/utils');var config=require(_0x66df('0x16'));var licenseUtil=require(_0x66df('0x17'));var db=require(_0x66df('0x18'))['db'];function respondWithStatusCode(_0x6ceecc,_0xa1a212){_0xa1a212=_0xa1a212||0xcc;return function(_0x37b3c3){if(_0x37b3c3){return _0x6ceecc['sendStatus'](_0xa1a212);}return _0x6ceecc[_0x66df('0x19')](_0xa1a212)[_0x66df('0x1a')]();};}function respondWithResult(_0x491037,_0x5f42a0){_0x5f42a0=_0x5f42a0||0xc8;return function(_0x4f3796){if(_0x4f3796){return _0x491037[_0x66df('0x19')](_0x5f42a0)[_0x66df('0x1b')](_0x4f3796);}};}function respondWithFilteredResult(_0x1f491c,_0x5a5bd2){return function(_0x306423){if(_0x306423){var _0x22e2e9=_0x306423[_0x66df('0x1c')],_0x5d5379=_0x5a5bd2[_0x66df('0x1d')],_0x1d7e65=_0x5a5bd2['offset']+_0x5a5bd2['limit'],_0x54a0ed;if(_0x1d7e65>=_0x22e2e9){_0x1d7e65=_0x22e2e9;_0x54a0ed=0xc8;}else{_0x54a0ed=0xce;}_0x1f491c[_0x66df('0x19')](_0x54a0ed);return _0x1f491c[_0x66df('0x1e')]('Content-Range',_0x5d5379+'-'+_0x1d7e65+'/'+_0x22e2e9)[_0x66df('0x1b')](_0x306423);}return null;};}function patchUpdates(_0x45a1c7){return function(_0x235e59){try{jsonpatch['apply'](_0x235e59,_0x45a1c7,!![]);}catch(_0xbf9aca){return BPromise[_0x66df('0x1f')](_0xbf9aca);}return _0x235e59[_0x66df('0x20')]();};}function saveUpdates(_0x170d52,_0x18e57c){return function(_0x936493){if(_0x936493){return _0x936493[_0x66df('0x21')](_0x170d52)['then'](function(_0x2318d7){return _0x2318d7;});}return null;};}function removeEntity(_0xd4ffea,_0x59b1aa){return function(_0x3ea57c){if(_0x3ea57c){return _0x3ea57c['destroy']()[_0x66df('0x22')](function(){_0xd4ffea[_0x66df('0x19')](0xcc)[_0x66df('0x1a')]();});}};}function handleEntityNotFound(_0x3b6791,_0x57ee9f){return function(_0x5f0949){if(!_0x5f0949){_0x3b6791[_0x66df('0x23')](0x194);}return _0x5f0949;};}function handleError(_0x34a027,_0x5cd33b){_0x5cd33b=_0x5cd33b||0x1f4;return function(_0x1a1df1){logger[_0x66df('0x24')](_0x1a1df1[_0x66df('0x25')]);if(_0x1a1df1[_0x66df('0x26')]){delete _0x1a1df1[_0x66df('0x26')];}_0x34a027[_0x66df('0x19')](_0x5cd33b)[_0x66df('0x27')](_0x1a1df1);};}exports[_0x66df('0x28')]=function(_0x49b36a,_0x1769f8){var _0x4dada7={},_0x2941d9={},_0x289512={'count':0x0,'rows':[]};var _0xada5b7=_[_0x66df('0x29')](db[_0x66df('0x2a')][_0x66df('0x2b')],function(_0xf1e38a){return{'name':_0xf1e38a[_0x66df('0x2c')],'type':_0xf1e38a[_0x66df('0x2d')][_0x66df('0x2e')]};});_0x2941d9[_0x66df('0x2f')]=_[_0x66df('0x29')](_0xada5b7,_0x66df('0x26'));_0x2941d9[_0x66df('0x30')]=_[_0x66df('0x31')](_0x49b36a[_0x66df('0x30')]);_0x2941d9['filters']=_[_0x66df('0x32')](_0x2941d9[_0x66df('0x2f')],_0x2941d9[_0x66df('0x30')]);_0x4dada7['attributes']=_[_0x66df('0x32')](_0x2941d9[_0x66df('0x2f')],qs[_0x66df('0x33')](_0x49b36a[_0x66df('0x30')][_0x66df('0x33')]));_0x4dada7['attributes']=_0x4dada7[_0x66df('0x34')][_0x66df('0x35')]?_0x4dada7[_0x66df('0x34')]:_0x2941d9['model'];if(!_0x49b36a['query'][_0x66df('0x36')](_0x66df('0x37'))){_0x4dada7[_0x66df('0x38')]=qs[_0x66df('0x38')](_0x49b36a[_0x66df('0x30')][_0x66df('0x38')]);_0x4dada7['offset']=qs['offset'](_0x49b36a[_0x66df('0x30')][_0x66df('0x1d')]);}_0x4dada7['order']=qs[_0x66df('0x39')](_0x49b36a['query'][_0x66df('0x39')]);_0x4dada7[_0x66df('0x3a')]=qs[_0x66df('0x3b')](_[_0x66df('0x3c')](_0x49b36a['query'],_0x2941d9['filters']),_0xada5b7);if(_0x49b36a[_0x66df('0x30')][_0x66df('0x3d')]){_0x4dada7['where']=_['merge'](_0x4dada7[_0x66df('0x3a')],{'$or':_[_0x66df('0x29')](_0xada5b7,function(_0x848892){if(_0x848892['type']!==_0x66df('0x3e')){var _0x264e11={};_0x264e11[_0x848892['name']]={'$like':'%'+_0x49b36a[_0x66df('0x30')]['filter']+'%'};return _0x264e11;}})});}_0x4dada7=_[_0x66df('0x3f')]({},_0x4dada7,_0x49b36a[_0x66df('0x40')]);var _0x3770b2={'where':_0x4dada7[_0x66df('0x3a')]};return db['ChatTransferReport'][_0x66df('0x1c')](_0x3770b2)[_0x66df('0x22')](function(_0x2996d3){_0x289512[_0x66df('0x1c')]=_0x2996d3;if(_0x49b36a[_0x66df('0x30')][_0x66df('0x41')]){_0x4dada7[_0x66df('0x42')]=[{'all':!![]}];}return db[_0x66df('0x2a')][_0x66df('0x43')](_0x4dada7);})['then'](function(_0x33cc5e){_0x289512[_0x66df('0x44')]=_0x33cc5e;return _0x289512;})[_0x66df('0x22')](respondWithFilteredResult(_0x1769f8,_0x4dada7))['catch'](handleError(_0x1769f8,null));};exports['show']=function(_0x99814a,_0x3d0009){var _0x1832ac={'raw':!![],'where':{'id':_0x99814a[_0x66df('0x45')]['id']}},_0x3cc468={};_0x3cc468['model']=_[_0x66df('0x31')](db[_0x66df('0x2a')][_0x66df('0x2b')]);_0x3cc468[_0x66df('0x30')]=_[_0x66df('0x31')](_0x99814a['query']);_0x3cc468[_0x66df('0x3b')]=_[_0x66df('0x32')](_0x3cc468[_0x66df('0x2f')],_0x3cc468['query']);_0x1832ac[_0x66df('0x34')]=_[_0x66df('0x32')](_0x3cc468[_0x66df('0x2f')],qs[_0x66df('0x33')](_0x99814a['query'][_0x66df('0x33')]));_0x1832ac[_0x66df('0x34')]=_0x1832ac[_0x66df('0x34')][_0x66df('0x35')]?_0x1832ac[_0x66df('0x34')]:_0x3cc468['model'];if(_0x99814a[_0x66df('0x30')][_0x66df('0x41')]){_0x1832ac[_0x66df('0x42')]=[{'all':!![]}];}_0x1832ac=_[_0x66df('0x3f')]({},_0x1832ac,_0x99814a[_0x66df('0x40')]);return db['ChatTransferReport']['find'](_0x1832ac)[_0x66df('0x22')](handleEntityNotFound(_0x3d0009,null))[_0x66df('0x22')](respondWithResult(_0x3d0009,null))[_0x66df('0x46')](handleError(_0x3d0009,null));};exports[_0x66df('0x47')]=function(_0x201f5a,_0x10db38){return db['ChatTransferReport']['create'](_0x201f5a[_0x66df('0x48')],{})[_0x66df('0x22')](respondWithResult(_0x10db38,0xc9))[_0x66df('0x46')](handleError(_0x10db38,null));};exports['update']=function(_0x789ea0,_0x370e76){if(_0x789ea0[_0x66df('0x48')]['id']){delete _0x789ea0['body']['id'];}return db[_0x66df('0x2a')][_0x66df('0x49')]({'where':{'id':_0x789ea0[_0x66df('0x45')]['id']}})[_0x66df('0x22')](handleEntityNotFound(_0x370e76,null))[_0x66df('0x22')](saveUpdates(_0x789ea0['body'],null))[_0x66df('0x22')](respondWithResult(_0x370e76,null))[_0x66df('0x46')](handleError(_0x370e76,null));};exports[_0x66df('0x4a')]=function(_0x14ce1d,_0x567b32){return db[_0x66df('0x2a')][_0x66df('0x49')]({'where':{'id':_0x14ce1d[_0x66df('0x45')]['id']}})[_0x66df('0x22')](handleEntityNotFound(_0x567b32,null))[_0x66df('0x22')](removeEntity(_0x567b32,null))[_0x66df('0x46')](handleError(_0x567b32,null));};exports['describe']=function(_0x21d1f6,_0x39e408){return db['ChatTransferReport'][_0x66df('0x4b')]()[_0x66df('0x22')](respondWithResult(_0x39e408,null))[_0x66df('0x46')](handleError(_0x39e408,null));}; \ No newline at end of file +var _0x45af=['findAll','rows','catch','show','find','create','body','params','destroy','describe','html-pdf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','Content-Range','apply','reject','update','then','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x10ef93,_0xe1aa93){var _0x4055cd=function(_0x322bde){while(--_0x322bde){_0x10ef93['push'](_0x10ef93['shift']());}};_0x4055cd(++_0xe1aa93);}(_0x45af,0xeb));var _0xf45a=function(_0x5adfb6,_0x599b71){_0x5adfb6=_0x5adfb6-0x0;var _0x484361=_0x45af[_0x5adfb6];return _0x484361;};'use strict';var pdf=require(_0xf45a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf45a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf45a('0x2'));var moment=require(_0xf45a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf45a('0x4'));var util=require(_0xf45a('0x5'));var path=require('path');var sox=require(_0xf45a('0x6'));var csv=require(_0xf45a('0x7'));var ejs=require(_0xf45a('0x8'));var fs=require('fs');var _=require(_0xf45a('0x9'));var squel=require(_0xf45a('0xa'));var crypto=require('crypto');var jsforce=require(_0xf45a('0xb'));var deskjs=require(_0xf45a('0xc'));var toCsv=require(_0xf45a('0x7'));var querystring=require(_0xf45a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf45a('0xe'));var qs=require(_0xf45a('0xf'));var as=require(_0xf45a('0x10'));var hardwareService=require(_0xf45a('0x11'));var logger=require(_0xf45a('0x12'))(_0xf45a('0x13'));var utils=require(_0xf45a('0x14'));var config=require(_0xf45a('0x15'));var licenseUtil=require(_0xf45a('0x16'));var db=require(_0xf45a('0x17'))['db'];function respondWithStatusCode(_0x1cb2e2,_0x4fec4f){_0x4fec4f=_0x4fec4f||0xcc;return function(_0x5356d8){if(_0x5356d8){return _0x1cb2e2[_0xf45a('0x18')](_0x4fec4f);}return _0x1cb2e2[_0xf45a('0x19')](_0x4fec4f)[_0xf45a('0x1a')]();};}function respondWithResult(_0x16d3c8,_0x1ae581){_0x1ae581=_0x1ae581||0xc8;return function(_0x41203e){if(_0x41203e){return _0x16d3c8[_0xf45a('0x19')](_0x1ae581)[_0xf45a('0x1b')](_0x41203e);}};}function respondWithFilteredResult(_0x6c03d5,_0x365d94){return function(_0x3cc99a){if(_0x3cc99a){var _0x532104=_0x3cc99a[_0xf45a('0x1c')],_0x208320=_0x365d94['offset'],_0x441b43=_0x365d94['offset']+_0x365d94['limit'],_0x5eb7de;if(_0x441b43>=_0x532104){_0x441b43=_0x532104;_0x5eb7de=0xc8;}else{_0x5eb7de=0xce;}_0x6c03d5[_0xf45a('0x19')](_0x5eb7de);return _0x6c03d5['set'](_0xf45a('0x1d'),_0x208320+'-'+_0x441b43+'/'+_0x532104)[_0xf45a('0x1b')](_0x3cc99a);}return null;};}function patchUpdates(_0x13ef2d){return function(_0x1156d7){try{jsonpatch[_0xf45a('0x1e')](_0x1156d7,_0x13ef2d,!![]);}catch(_0x5436f4){return BPromise[_0xf45a('0x1f')](_0x5436f4);}return _0x1156d7['save']();};}function saveUpdates(_0x4bcce8,_0x276c74){return function(_0x7d38da){if(_0x7d38da){return _0x7d38da[_0xf45a('0x20')](_0x4bcce8)[_0xf45a('0x21')](function(_0x593437){return _0x593437;});}return null;};}function removeEntity(_0x4b5422,_0x13be85){return function(_0x287fc3){if(_0x287fc3){return _0x287fc3['destroy']()[_0xf45a('0x21')](function(){_0x4b5422[_0xf45a('0x19')](0xcc)[_0xf45a('0x1a')]();});}};}function handleEntityNotFound(_0x4c8967,_0xe9ee35){return function(_0x49c119){if(!_0x49c119){_0x4c8967[_0xf45a('0x18')](0x194);}return _0x49c119;};}function handleError(_0x2e1b10,_0x3b35c0){_0x3b35c0=_0x3b35c0||0x1f4;return function(_0x4cc61b){logger[_0xf45a('0x22')](_0x4cc61b[_0xf45a('0x23')]);if(_0x4cc61b[_0xf45a('0x24')]){delete _0x4cc61b[_0xf45a('0x24')];}_0x2e1b10[_0xf45a('0x19')](_0x3b35c0)['send'](_0x4cc61b);};}exports[_0xf45a('0x25')]=function(_0x26cd36,_0x244db5){var _0xa19511={},_0x11c876={},_0x2830e3={'count':0x0,'rows':[]};var _0x5ede73=_[_0xf45a('0x26')](db[_0xf45a('0x27')][_0xf45a('0x28')],function(_0x5eaa44){return{'name':_0x5eaa44[_0xf45a('0x29')],'type':_0x5eaa44[_0xf45a('0x2a')][_0xf45a('0x2b')]};});_0x11c876[_0xf45a('0x2c')]=_[_0xf45a('0x26')](_0x5ede73,_0xf45a('0x24'));_0x11c876['query']=_[_0xf45a('0x2d')](_0x26cd36[_0xf45a('0x2e')]);_0x11c876[_0xf45a('0x2f')]=_[_0xf45a('0x30')](_0x11c876['model'],_0x11c876['query']);_0xa19511['attributes']=_['intersection'](_0x11c876['model'],qs[_0xf45a('0x31')](_0x26cd36['query']['fields']));_0xa19511['attributes']=_0xa19511[_0xf45a('0x32')][_0xf45a('0x33')]?_0xa19511[_0xf45a('0x32')]:_0x11c876[_0xf45a('0x2c')];if(!_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x34')]('nolimit')){_0xa19511['limit']=qs[_0xf45a('0x35')](_0x26cd36[_0xf45a('0x2e')]['limit']);_0xa19511['offset']=qs[_0xf45a('0x36')](_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x36')]);}_0xa19511[_0xf45a('0x37')]=qs[_0xf45a('0x38')](_0x26cd36[_0xf45a('0x2e')]['sort']);_0xa19511[_0xf45a('0x39')]=qs['filters'](_[_0xf45a('0x3a')](_0x26cd36[_0xf45a('0x2e')],_0x11c876[_0xf45a('0x2f')]),_0x5ede73);if(_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x3b')]){_0xa19511[_0xf45a('0x39')]=_[_0xf45a('0x3c')](_0xa19511[_0xf45a('0x39')],{'$or':_['map'](_0x5ede73,function(_0x10cbe3){if(_0x10cbe3['type']!==_0xf45a('0x3d')){var _0x4ccfe7={};_0x4ccfe7[_0x10cbe3[_0xf45a('0x24')]]={'$like':'%'+_0x26cd36[_0xf45a('0x2e')]['filter']+'%'};return _0x4ccfe7;}})});}_0xa19511=_['merge']({},_0xa19511,_0x26cd36[_0xf45a('0x3e')]);var _0x5b8274={'where':_0xa19511[_0xf45a('0x39')]};return db[_0xf45a('0x27')][_0xf45a('0x1c')](_0x5b8274)[_0xf45a('0x21')](function(_0x20f0b0){_0x2830e3[_0xf45a('0x1c')]=_0x20f0b0;if(_0x26cd36[_0xf45a('0x2e')][_0xf45a('0x3f')]){_0xa19511[_0xf45a('0x40')]=[{'all':!![]}];}return db[_0xf45a('0x27')][_0xf45a('0x41')](_0xa19511);})[_0xf45a('0x21')](function(_0x47354c){_0x2830e3[_0xf45a('0x42')]=_0x47354c;return _0x2830e3;})[_0xf45a('0x21')](respondWithFilteredResult(_0x244db5,_0xa19511))[_0xf45a('0x43')](handleError(_0x244db5,null));};exports[_0xf45a('0x44')]=function(_0x528e0f,_0x4508f4){var _0x50bcd7={'raw':!![],'where':{'id':_0x528e0f['params']['id']}},_0x1e4792={};_0x1e4792[_0xf45a('0x2c')]=_[_0xf45a('0x2d')](db[_0xf45a('0x27')][_0xf45a('0x28')]);_0x1e4792[_0xf45a('0x2e')]=_[_0xf45a('0x2d')](_0x528e0f[_0xf45a('0x2e')]);_0x1e4792[_0xf45a('0x2f')]=_[_0xf45a('0x30')](_0x1e4792[_0xf45a('0x2c')],_0x1e4792['query']);_0x50bcd7[_0xf45a('0x32')]=_[_0xf45a('0x30')](_0x1e4792['model'],qs[_0xf45a('0x31')](_0x528e0f[_0xf45a('0x2e')]['fields']));_0x50bcd7['attributes']=_0x50bcd7[_0xf45a('0x32')]['length']?_0x50bcd7[_0xf45a('0x32')]:_0x1e4792['model'];if(_0x528e0f['query'][_0xf45a('0x3f')]){_0x50bcd7[_0xf45a('0x40')]=[{'all':!![]}];}_0x50bcd7=_[_0xf45a('0x3c')]({},_0x50bcd7,_0x528e0f[_0xf45a('0x3e')]);return db[_0xf45a('0x27')][_0xf45a('0x45')](_0x50bcd7)['then'](handleEntityNotFound(_0x4508f4,null))[_0xf45a('0x21')](respondWithResult(_0x4508f4,null))[_0xf45a('0x43')](handleError(_0x4508f4,null));};exports[_0xf45a('0x46')]=function(_0x920104,_0x584d8d){return db[_0xf45a('0x27')][_0xf45a('0x46')](_0x920104[_0xf45a('0x47')],{})['then'](respondWithResult(_0x584d8d,0xc9))[_0xf45a('0x43')](handleError(_0x584d8d,null));};exports[_0xf45a('0x20')]=function(_0x14928c,_0x42384e){if(_0x14928c[_0xf45a('0x47')]['id']){delete _0x14928c[_0xf45a('0x47')]['id'];}return db[_0xf45a('0x27')][_0xf45a('0x45')]({'where':{'id':_0x14928c[_0xf45a('0x48')]['id']}})[_0xf45a('0x21')](handleEntityNotFound(_0x42384e,null))[_0xf45a('0x21')](saveUpdates(_0x14928c[_0xf45a('0x47')],null))[_0xf45a('0x21')](respondWithResult(_0x42384e,null))[_0xf45a('0x43')](handleError(_0x42384e,null));};exports[_0xf45a('0x49')]=function(_0x1624cd,_0xfe04c2){return db[_0xf45a('0x27')][_0xf45a('0x45')]({'where':{'id':_0x1624cd[_0xf45a('0x48')]['id']}})[_0xf45a('0x21')](handleEntityNotFound(_0xfe04c2,null))[_0xf45a('0x21')](removeEntity(_0xfe04c2,null))[_0xf45a('0x43')](handleError(_0xfe04c2,null));};exports[_0xf45a('0x4a')]=function(_0x6ceb99,_0x41e2d7){return db['ChatTransferReport'][_0xf45a('0x4a')]()[_0xf45a('0x21')](respondWithResult(_0x41e2d7,null))[_0xf45a('0x43')](handleError(_0x41e2d7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1b8dec3..b8d1c70 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 _0x59b0=['api','moment','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x1ee79f,_0x357caa){var _0x19105b=function(_0x56152d){while(--_0x56152d){_0x1ee79f['push'](_0x1ee79f['shift']());}};_0x19105b(++_0x357caa);}(_0x59b0,0x190));var _0x059b=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x59b0[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require(_0x059b('0x0'));var util=require(_0x059b('0x1'));var logger=require(_0x059b('0x2'))(_0x059b('0x3'));var moment=require(_0x059b('0x4'));var BPromise=require(_0x059b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x059b('0x6'));var rimraf=require('rimraf');var config=require(_0x059b('0x7'));var attributes=require(_0x059b('0x8'));module[_0x059b('0x9')]=function(_0x556b87,_0x3071ae){return _0x556b87['define'](_0x059b('0xa'),attributes,{'tableName':_0x059b('0xb'),'paranoid':![],'indexes':[{'name':_0x059b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe555=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','request-promise','path'];(function(_0x5d72cb,_0x5613bf){var _0xd0a100=function(_0x78914a){while(--_0x78914a){_0x5d72cb['push'](_0x5d72cb['shift']());}};_0xd0a100(++_0x5613bf);}(_0xe555,0x158));var _0x5e55=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0xe555[_0x16051a];return _0x35d20d;};'use strict';var _=require(_0x5e55('0x0'));var util=require(_0x5e55('0x1'));var logger=require('../../config/logger')(_0x5e55('0x2'));var moment=require(_0x5e55('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e55('0x4'));var fs=require('fs');var path=require(_0x5e55('0x5'));var rimraf=require(_0x5e55('0x6'));var config=require(_0x5e55('0x7'));var attributes=require(_0x5e55('0x8'));module[_0x5e55('0x9')]=function(_0x292965,_0x114bc5){return _0x292965[_0x5e55('0xa')](_0x5e55('0xb'),attributes,{'tableName':_0x5e55('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5e55('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 1a146ff..ff94a80 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 _0xfd7e=['lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2e2ab1,_0x3f1f55){var _0x437e4e=function(_0x10592a){while(--_0x10592a){_0x2e2ab1['push'](_0x2e2ab1['shift']());}};_0x437e4e(++_0x3f1f55);}(_0xfd7e,0xf2));var _0xefd7=function(_0x2a3dff,_0x336483){_0x2a3dff=_0x2a3dff-0x0;var _0x4ed2ab=_0xfd7e[_0x2a3dff];return _0x4ed2ab;};'use strict';var _=require(_0xefd7('0x0'));var util=require(_0xefd7('0x1'));var moment=require(_0xefd7('0x2'));var BPromise=require(_0xefd7('0x3'));var rs=require(_0xefd7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xefd7('0x5'))(_0xefd7('0x6'));var config=require(_0xefd7('0x7'));var jayson=require(_0xefd7('0x8'));var client=jayson[_0xefd7('0x9')][_0xefd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b34b6,_0x1e7564,_0x5c9a3c){return new BPromise(function(_0x166a2a,_0x3a088b){return client[_0xefd7('0xb')](_0x5b34b6,_0x5c9a3c)[_0xefd7('0xc')](function(_0x43ee03){logger[_0xefd7('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x1e7564,'request\x20sent');logger[_0xefd7('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1e7564,_0xefd7('0xf'),JSON[_0xefd7('0x10')](_0x43ee03));if(_0x43ee03[_0xefd7('0x11')]){if(_0x43ee03['error']['code']===0x1f4){logger[_0xefd7('0x11')](_0xefd7('0x12'),_0x1e7564,_0x43ee03[_0xefd7('0x11')]['message']);return _0x3a088b(_0x43ee03['error'][_0xefd7('0x13')]);}logger[_0xefd7('0x11')](_0xefd7('0x12'),_0x1e7564,_0x43ee03['error'][_0xefd7('0x13')]);return _0x166a2a(_0x43ee03[_0xefd7('0x11')][_0xefd7('0x13')]);}else{logger[_0xefd7('0xd')](_0xefd7('0x12'),_0x1e7564,'request\x20sent');_0x166a2a(_0x43ee03[_0xefd7('0x14')][_0xefd7('0x13')]);}})[_0xefd7('0x15')](function(_0x416140){logger[_0xefd7('0x11')](_0xefd7('0x12'),_0x1e7564,_0x416140);_0x3a088b(_0x416140);});});} \ No newline at end of file +var _0x772d=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x414a33,_0x5bf179){var _0x1922bd=function(_0xa5ca9c){while(--_0xa5ca9c){_0x414a33['push'](_0x414a33['shift']());}};_0x1922bd(++_0x5bf179);}(_0x772d,0x1a6));var _0xd772=function(_0x58c531,_0x126bc6){_0x58c531=_0x58c531-0x0;var _0xddcc4a=_0x772d[_0x58c531];return _0xddcc4a;};'use strict';var _=require(_0xd772('0x0'));var util=require('util');var moment=require(_0xd772('0x1'));var BPromise=require(_0xd772('0x2'));var rs=require(_0xd772('0x3'));var fs=require('fs');var Redis=require(_0xd772('0x4'));var db=require(_0xd772('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd772('0x6'));var config=require(_0xd772('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd772('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c0fd0,_0xc320ff,_0x103036){return new BPromise(function(_0x4dd6ca,_0x4e4549){return client['request'](_0x5c0fd0,_0x103036)[_0xd772('0x9')](function(_0x2d0386){logger[_0xd772('0xa')](_0xd772('0xb'),_0xc320ff,_0xd772('0xc'));logger['debug'](_0xd772('0xd'),_0xc320ff,_0xd772('0xc'),JSON[_0xd772('0xe')](_0x2d0386));if(_0x2d0386['error']){if(_0x2d0386[_0xd772('0xf')]['code']===0x1f4){logger[_0xd772('0xf')](_0xd772('0xb'),_0xc320ff,_0x2d0386[_0xd772('0xf')]['message']);return _0x4e4549(_0x2d0386[_0xd772('0xf')][_0xd772('0x10')]);}logger[_0xd772('0xf')](_0xd772('0xb'),_0xc320ff,_0x2d0386[_0xd772('0xf')][_0xd772('0x10')]);return _0x4dd6ca(_0x2d0386[_0xd772('0xf')][_0xd772('0x10')]);}else{logger['info'](_0xd772('0xb'),_0xc320ff,_0xd772('0xc'));_0x4dd6ca(_0x2d0386[_0xd772('0x11')][_0xd772('0x10')]);}})[_0xd772('0x12')](function(_0x1732d3){logger['error'](_0xd772('0xb'),_0xc320ff,_0x1732d3);_0x4e4549(_0x1732d3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 216539b..8b4029d 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x47ad3d,_0x44bc69){var _0x4c2e05=function(_0x1d6e08){while(--_0x1d6e08){_0x47ad3d['push'](_0x47ad3d['shift']());}};_0x4c2e05(++_0x44bc69);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x0b0e[_0x32b30c];return _0xcfc212;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x263d7d,_0x4fe765){var _0x510b6d=function(_0x5e2f98){while(--_0x5e2f98){_0x263d7d['push'](_0x263d7d['shift']());}};_0x510b6d(++_0x4fe765);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb7e7[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4d07896..b91e05e 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 _0xabce=['star','TEXT','stringify','name','text','getDataValue','parse','onlineForm','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb'];(function(_0x47e873,_0x1bbf6c){var _0x28185e=function(_0x3dc66d){while(--_0x3dc66d){_0x47e873['push'](_0x47e873['shift']());}};_0x28185e(++_0x1bbf6c);}(_0xabce,0x103));var _0xeabc=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xabce[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require(_0xeabc('0x0'));var rs=require(_0xeabc('0x1'));module[_0xeabc('0x2')]={'name':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x4')},'mapKeyOffline':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![],'defaultValue':_0xeabc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabc('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xeabc('0x3')]},'animation':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xeabc('0x9')](_0xeabc('0xa'),_0xeabc('0xb')),'defaultValue':_0xeabc('0xa')},'header_online':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xc')},'start_chat_button':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xd')},'offline_chat_button':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xe')},'header_offline':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x13')},'closingMessageButton':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xe')},'skipMessageButton':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x14')},'conditionAgreement':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xeabc('0x15')},'ratingType':{'type':Sequelize[_0xeabc('0x9')]('star',_0xeabc('0x16')),'defaultValue':_0xeabc('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xeabc('0x18')],'defaultValue':function(){return JSON[_0xeabc('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xeabc('0x1a'),'type':_0xeabc('0x1b'),'required':!![]},'props':{'title':_0xeabc('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xeabc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xeabc('0x4'),'type':_0xeabc('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xeabc('0x1c')]('onlineForm')?JSON[_0xeabc('0x1d')](this['getDataValue'](_0xeabc('0x1e'))):{};},'set':function(_0x4d4e29){return this[_0xeabc('0x1f')](_0xeabc('0x1e'),JSON[_0xeabc('0x19')](_0x4d4e29));}},'offlineForm':{'type':Sequelize[_0xeabc('0x18')],'defaultValue':function(){return JSON[_0xeabc('0x19')]({'items':[{'type':_0xeabc('0x20'),'props':{'title':_0xeabc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xeabc('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0xeabc('0x22'),'helpText':_0xeabc('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xeabc('0x24'))?JSON[_0xeabc('0x1d')](this[_0xeabc('0x1c')](_0xeabc('0x24'))):{};},'set':function(_0x149170){return this[_0xeabc('0x1f')](_0xeabc('0x24'),JSON[_0xeabc('0x19')](_0x149170));}},'token':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xeabc('0x3')]},'forwardOffline':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xeabc('0x3')]},'waitingTitle':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x25')},'waitingMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x26')},'offlineMessageBody':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xeabc('0x14')},'sendUnmanaged':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xeabc('0x18')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xeabc('0x18')],'defaultValue':function(){return _0xeabc('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xeabc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xeabc('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x2b')},'defaultTitle':{'type':Sequelize[_0xeabc('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabc('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xeabc('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeabc('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d48f4){if(!_0x3d48f4)this['setDataValue'](_0xeabc('0x2d'),null);this[_0xeabc('0x1f')](_0xeabc('0x2e'),_0x3d48f4);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x4a25=['ENUM','star','thumb','TEXT','stringify','input','text','name','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4a25,0x1d4));var _0x54a2=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x4a25[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0x54a2('0x0'));var rs=require('randomstring');module[_0x54a2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'unique':_0x54a2('0x3')},'description':{'type':Sequelize[_0x54a2('0x2')]},'mapKey':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x4')},'key':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'defaultValue':_0x54a2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54a2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x54a2('0x2')]},'animation':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x54a2('0x9'),_0x54a2('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0xc')},'offline_chat_button':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0xd')},'header_offline':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0xe')},'download_transcript':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x54a2('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x12')},'noteTitle':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x13')},'placeholderMessage':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x15')},'ratingType':{'type':Sequelize[_0x54a2('0x16')](_0x54a2('0x17'),_0x54a2('0x18')),'defaultValue':_0x54a2('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x54a2('0x19')],'defaultValue':function(){return JSON[_0x54a2('0x1a')]({'items':[{'type':_0x54a2('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x54a2('0x1c'),'required':!![]},'props':{'title':_0x54a2('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x54a2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x54a2('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x54a2('0x1e')](_0x54a2('0x1f'))?JSON[_0x54a2('0x20')](this[_0x54a2('0x1e')](_0x54a2('0x1f'))):{};},'set':function(_0x3bedac){return this['setDataValue'](_0x54a2('0x1f'),JSON[_0x54a2('0x1a')](_0x3bedac));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x54a2('0x1a')]({'items':[{'type':_0x54a2('0x1b'),'props':{'title':_0x54a2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x54a2('0x4'),'type':_0x54a2('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x54a2('0x21')},'props':{'title':_0x54a2('0x21'),'helpText':_0x54a2('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x54a2('0x1e')](_0x54a2('0x23'))?JSON[_0x54a2('0x20')](this[_0x54a2('0x1e')](_0x54a2('0x23'))):{};},'set':function(_0x17ba86){return this['setDataValue'](_0x54a2('0x23'),JSON['stringify'](_0x17ba86));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x54a2('0x24')]();}},'autoclose':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x54a2('0x2')]},'forwardOffline':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x54a2('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x26')},'offlineMessageBody':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x54a2('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x54a2('0x19')]},'showAgentAvatar':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x54a2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x54a2('0x29');}},'notificationSound':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x54a2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x54a2('0x2')]},'customerAvatar':{'type':Sequelize[_0x54a2('0x19')]},'showCustomerAvatar':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x54a2('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x54a2('0x2')],'allowNull':![],'defaultValue':_0x54a2('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x54a2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':_0x54a2('0x2c')},'systemAvatar':{'type':Sequelize[_0x54a2('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x54a2('0xf')],'comment':_0x54a2('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![],'comment':_0x54a2('0x2e'),'set':function(_0x39e4c8){if(!_0x39e4c8)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x54a2('0x2f')](_0x54a2('0x30'),_0x39e4c8);}},'vidaooEscalation':{'type':Sequelize[_0x54a2('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x54a2('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index dfd17ef..d27ad4b 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 _0x50eb=['Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','replace','alignment','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','fromKey','getOfflineMessages','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','ChatWebsites','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','filename','addAvatar','file','addCustomerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ChatApplication','Applications','List','account','applications','list','asc','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','%s\x20%s\x20%s','vendor','type','threadId','externalUrl','ChatInteraction','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','notify','offline','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','color','tag'];(function(_0xe03929,_0x413582){var _0x2d1153=function(_0x11dcb3){while(--_0x11dcb3){_0xe03929['push'](_0xe03929['shift']());}};_0x2d1153(++_0x413582);}(_0x50eb,0x14f));var _0xb50e=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x50eb[_0x26462c];return _0x509a42;};'use strict';var pdf=require(_0xb50e('0x0'));var emlformat=require(_0xb50e('0x1'));var rimraf=require(_0xb50e('0x2'));var zipdir=require(_0xb50e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb50e('0x4'));var moment=require(_0xb50e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb50e('0x6'));var util=require(_0xb50e('0x7'));var path=require(_0xb50e('0x8'));var sox=require(_0xb50e('0x9'));var csv=require(_0xb50e('0xa'));var ejs=require(_0xb50e('0xb'));var fs=require('fs');var _=require(_0xb50e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb50e('0xd'));var toCsv=require(_0xb50e('0xa'));var querystring=require(_0xb50e('0xe'));var Papa=require(_0xb50e('0xf'));var Redis=require(_0xb50e('0x10'));var authService=require(_0xb50e('0x11'));var qs=require(_0xb50e('0x12'));var as=require(_0xb50e('0x13'));var hardwareService=require(_0xb50e('0x14'));var logger=require(_0xb50e('0x15'))(_0xb50e('0x16'));var utils=require(_0xb50e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb50e('0x18'));var db=require(_0xb50e('0x19'))['db'];config[_0xb50e('0x1a')]=_[_0xb50e('0x1b')](config[_0xb50e('0x1a')],{'host':_0xb50e('0x1c'),'port':0x18eb});var socket=require(_0xb50e('0x1d'))(new Redis(config['redis']));require(_0xb50e('0x1e'))[_0xb50e('0x1f')](socket);var jayson=require(_0xb50e('0x20'));var client=jayson['client'][_0xb50e('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xb50e('0x21')]({'port':0x232a});var client9003=jayson['client'][_0xb50e('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x5b5a1c,_0x15dd3c,_0x1b6cea,_0x546498){return new BPromise(function(_0x4ecf39,_0x3ca1de){var _0x44046e=_0x546498||client;return _0x44046e[_0xb50e('0x22')](_0x5b5a1c,_0x1b6cea)[_0xb50e('0x23')](function(_0x5521ef){logger[_0xb50e('0x24')](_0xb50e('0x25'),_0x15dd3c,_0xb50e('0x26'));logger[_0xb50e('0x27')](_0xb50e('0x28'),_0x15dd3c,_0xb50e('0x26'),JSON[_0xb50e('0x29')](_0x5521ef));if(_0x5521ef[_0xb50e('0x2a')]){if(_0x5521ef[_0xb50e('0x2a')][_0xb50e('0x2b')]===0x1f4){logger[_0xb50e('0x2a')](_0xb50e('0x25'),_0x15dd3c,_0x5521ef[_0xb50e('0x2a')][_0xb50e('0x2c')]);return _0x3ca1de(_0x5521ef['error'][_0xb50e('0x2c')]);}logger[_0xb50e('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x15dd3c,_0x5521ef['error'][_0xb50e('0x2c')]);return _0x4ecf39(_0x5521ef[_0xb50e('0x2a')][_0xb50e('0x2c')]);}else{logger[_0xb50e('0x24')](_0xb50e('0x25'),_0x15dd3c,_0xb50e('0x26'));_0x4ecf39(_0x5521ef[_0xb50e('0x2d')][_0xb50e('0x2c')]);}})['catch'](function(_0x55bb24){logger[_0xb50e('0x2a')](_0xb50e('0x25'),_0x15dd3c,_0x55bb24);_0x3ca1de(_0x55bb24);});});}function respondWithStatusCode(_0x185768,_0x2d1fce){_0x2d1fce=_0x2d1fce||0xcc;return function(_0x27a379){if(_0x27a379){return _0x185768[_0xb50e('0x2e')](_0x2d1fce);}return _0x185768[_0xb50e('0x2f')](_0x2d1fce)[_0xb50e('0x30')]();};}function respondWithResult(_0x365418,_0x57cc75){_0x57cc75=_0x57cc75||0xc8;return function(_0x3e0d3a){if(_0x3e0d3a){return _0x365418[_0xb50e('0x2f')](_0x57cc75)[_0xb50e('0x31')](_0x3e0d3a);}};}function respondWithFilteredResult(_0x547832,_0x289c68){return function(_0x3e357f){if(_0x3e357f){var _0x27a665=_0x3e357f[_0xb50e('0x32')],_0x4dea99=_0x289c68[_0xb50e('0x33')],_0x2f42cb=_0x289c68[_0xb50e('0x33')]+_0x289c68[_0xb50e('0x34')],_0x31b1b1;if(_0x2f42cb>=_0x27a665){_0x2f42cb=_0x27a665;_0x31b1b1=0xc8;}else{_0x31b1b1=0xce;}_0x547832[_0xb50e('0x2f')](_0x31b1b1);return _0x547832[_0xb50e('0x35')](_0xb50e('0x36'),_0x4dea99+'-'+_0x2f42cb+'/'+_0x27a665)[_0xb50e('0x31')](_0x3e357f);}return null;};}function patchUpdates(_0x392c72){return function(_0xd010b4){try{jsonpatch[_0xb50e('0x37')](_0xd010b4,_0x392c72,!![]);}catch(_0x22393f){return BPromise[_0xb50e('0x38')](_0x22393f);}return _0xd010b4[_0xb50e('0x39')]();};}function saveUpdates(_0x246f3c,_0x2266e2){return function(_0x2a3a3c){if(_0x2a3a3c){return _0x2a3a3c[_0xb50e('0x3a')](_0x246f3c)[_0xb50e('0x23')](function(_0x21b51e){return _0x21b51e;});}return null;};}function removeEntity(_0x50891c,_0x423f62){return function(_0x575dc0){if(_0x575dc0){return _0x575dc0[_0xb50e('0x3b')]()[_0xb50e('0x23')](function(){var _0x555fcc=_0x575dc0['get']({'plain':!![]});var _0x33cd91=_0xb50e('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0x33cd91,'resourceId':_0x555fcc['id']}})[_0xb50e('0x23')](function(){return _0x575dc0;});})['then'](function(){_0x50891c[_0xb50e('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc412,_0x38b9a1){return function(_0x1b3e5c){if(!_0x1b3e5c){_0xc412['sendStatus'](0x194);}return _0x1b3e5c;};}function handleError(_0x1fa005,_0x3f51bf){_0x3f51bf=_0x3f51bf||0x1f4;return function(_0xcbfa5e){logger[_0xb50e('0x2a')](_0xcbfa5e['stack']);if(_0xcbfa5e['name']){delete _0xcbfa5e['name'];}_0x1fa005[_0xb50e('0x2f')](_0x3f51bf)[_0xb50e('0x3d')](_0xcbfa5e);};}exports[_0xb50e('0x3e')]=function(_0x5e95be,_0x245075){var _0xedd068={'include':[{'model':db[_0xb50e('0x3f')],'as':_0xb50e('0x40')}]},_0x1b7567={},_0x377d96={'count':0x0,'rows':[]};var _0x58fbe5=_['map'](db[_0xb50e('0x41')][_0xb50e('0x42')],function(_0x39a1bf){return{'name':_0x39a1bf[_0xb50e('0x43')],'type':_0x39a1bf['type'][_0xb50e('0x44')]};});_0x1b7567[_0xb50e('0x45')]=_[_0xb50e('0x46')](_0x58fbe5,'name');_0x1b7567['query']=_['keys'](_0x5e95be[_0xb50e('0x47')]);_0x1b7567[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x1b7567[_0xb50e('0x45')],_0x1b7567[_0xb50e('0x47')]);_0xedd068['attributes']=_[_0xb50e('0x49')](_0x1b7567[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x5e95be['query'][_0xb50e('0x4a')]));_0xedd068['attributes']=_0xedd068[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0xedd068['attributes']:_0x1b7567[_0xb50e('0x45')];if(!_0x5e95be['query'][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0xedd068[_0xb50e('0x34')]=qs['limit'](_0x5e95be[_0xb50e('0x47')][_0xb50e('0x34')]);_0xedd068['offset']=qs['offset'](_0x5e95be[_0xb50e('0x47')][_0xb50e('0x33')]);}_0xedd068['order']=qs['sort'](_0x5e95be[_0xb50e('0x47')][_0xb50e('0x4f')]);_0xedd068[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x5e95be[_0xb50e('0x47')],_0x1b7567['filters']),_0x58fbe5);if(_0x5e95be[_0xb50e('0x47')]['filter']){_0xedd068[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0xedd068[_0xb50e('0x50')],{'$or':_['map'](_0x58fbe5,function(_0x26d011){if(_0x26d011['type']!==_0xb50e('0x53')){var _0x23cb65={};_0x23cb65[_0x26d011[_0xb50e('0x54')]]={'$like':'%'+_0x5e95be['query'][_0xb50e('0x55')]+'%'};return _0x23cb65;}})});}_0xedd068=_[_0xb50e('0x52')]({},_0xedd068,_0x5e95be[_0xb50e('0x56')]);var _0xae8144={'where':_0xedd068[_0xb50e('0x50')]};return db[_0xb50e('0x41')][_0xb50e('0x32')](_0xae8144)[_0xb50e('0x23')](function(_0x5c7813){_0x377d96[_0xb50e('0x32')]=_0x5c7813;if(_0x5e95be['query'][_0xb50e('0x57')]){_0xedd068[_0xb50e('0x58')]=[{'all':!![]}];}return db[_0xb50e('0x41')][_0xb50e('0x59')](_0xedd068);})[_0xb50e('0x23')](function(_0x1b17ee){_0x377d96[_0xb50e('0x5a')]=_0x1b17ee;return _0x377d96;})[_0xb50e('0x23')](respondWithFilteredResult(_0x245075,_0xedd068))[_0xb50e('0x5b')](handleError(_0x245075,null));};exports[_0xb50e('0x5c')]=function(_0x8f7c4a,_0x1a6388){var _0x464f83={'raw':![],'where':{'id':_0x8f7c4a[_0xb50e('0x5d')]['id']},'include':[{'model':db[_0xb50e('0x3f')],'as':_0xb50e('0x40')}]},_0x4d7891={};_0x4d7891['model']=_[_0xb50e('0x5e')](db[_0xb50e('0x41')][_0xb50e('0x42')]);_0x4d7891[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x8f7c4a[_0xb50e('0x47')]);_0x4d7891[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x4d7891['model'],_0x4d7891[_0xb50e('0x47')]);_0x464f83['attributes']=_[_0xb50e('0x49')](_0x4d7891[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x8f7c4a[_0xb50e('0x47')][_0xb50e('0x4a')]));_0x464f83[_0xb50e('0x4b')]=_0x464f83[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0x464f83[_0xb50e('0x4b')]:_0x4d7891[_0xb50e('0x45')];if(_0x8f7c4a[_0xb50e('0x47')][_0xb50e('0x57')]){_0x464f83[_0xb50e('0x58')]=[{'all':!![]}];}_0x464f83=_[_0xb50e('0x52')]({},_0x464f83,_0x8f7c4a[_0xb50e('0x56')]);return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x464f83)[_0xb50e('0x23')](handleEntityNotFound(_0x1a6388,null))[_0xb50e('0x23')](respondWithResult(_0x1a6388,null))[_0xb50e('0x5b')](handleError(_0x1a6388,null));};exports[_0xb50e('0x60')]=function(_0xcde960,_0x2cf2e8){return db[_0xb50e('0x41')][_0xb50e('0x60')](_0xcde960[_0xb50e('0x61')],{})[_0xb50e('0x23')](function(_0x36ba93){var _0x51d2b3=_0xcde960['user']['get']({'plain':!![]});if(!_0x51d2b3)throw new Error(_0xb50e('0x62'));if(_0x51d2b3[_0xb50e('0x63')]===_0xb50e('0x64')){var _0x290cf1=_0x36ba93[_0xb50e('0x65')]({'plain':!![]});var _0x54823b=_0xb50e('0x3c');return db['UserProfileSection'][_0xb50e('0x5f')]({'where':{'name':_0x54823b,'userProfileId':_0x51d2b3[_0xb50e('0x66')]},'raw':!![]})[_0xb50e('0x23')](function(_0x4d869e){if(_0x4d869e&&_0x4d869e[_0xb50e('0x67')]===0x0){return db['UserProfileResource'][_0xb50e('0x60')]({'name':_0x290cf1[_0xb50e('0x54')],'resourceId':_0x290cf1['id'],'type':_0x4d869e[_0xb50e('0x54')],'sectionId':_0x4d869e['id']},{})[_0xb50e('0x23')](function(){return _0x36ba93;});}else{return _0x36ba93;}})[_0xb50e('0x5b')](function(_0x33990d){logger[_0xb50e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33990d);throw _0x33990d;});}return _0x36ba93;})[_0xb50e('0x23')](respondWithResult(_0x2cf2e8,0xc9))[_0xb50e('0x5b')](handleError(_0x2cf2e8,null));};exports[_0xb50e('0x3a')]=function(_0x51eb37,_0x3891bb){if(_0x51eb37[_0xb50e('0x61')]['id']){delete _0x51eb37[_0xb50e('0x61')]['id'];}return db[_0xb50e('0x41')]['find']({'where':{'id':_0x51eb37[_0xb50e('0x5d')]['id']},'include':[{'model':db[_0xb50e('0x3f')],'as':_0xb50e('0x40')}]})[_0xb50e('0x23')](handleEntityNotFound(_0x3891bb,null))[_0xb50e('0x23')](saveUpdates(_0x51eb37[_0xb50e('0x61')],null))[_0xb50e('0x23')](respondWithResult(_0x3891bb,null))['catch'](handleError(_0x3891bb,null));};exports[_0xb50e('0x3b')]=function(_0x5204b6,_0x556c25){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x5204b6[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x556c25,null))[_0xb50e('0x23')](removeEntity(_0x556c25,null))[_0xb50e('0x5b')](handleError(_0x556c25,null));};exports[_0xb50e('0x68')]=function(_0x3ad872,_0x1ba5f2){return db['ChatWebsite'][_0xb50e('0x68')]()[_0xb50e('0x23')](respondWithResult(_0x1ba5f2,null))[_0xb50e('0x5b')](handleError(_0x1ba5f2,null));};exports[_0xb50e('0x69')]=function(_0x1783e1,_0x527834,_0x13f910){if(_0x1783e1[_0xb50e('0x61')]['id']){delete _0x1783e1[_0xb50e('0x61')]['id'];}return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x1783e1[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x527834,null))[_0xb50e('0x23')](function(_0x1f8dce){if(_0x1f8dce){_0x1783e1['body'][_0xb50e('0x6a')]=_0x1f8dce['id'];return db[_0xb50e('0x6b')]['create'](_0x1783e1[_0xb50e('0x61')]);}})[_0xb50e('0x23')](respondWithResult(_0x527834,null))[_0xb50e('0x5b')](handleError(_0x527834,null));};exports[_0xb50e('0x6c')]=function(_0x1bcc6d,_0x1384d9,_0x5a8f8c){var _0x43d9ed={'raw':![],'where':{}};var _0x38e124={};var _0x2e7ac0={'count':0x0,'rows':[]};return db[_0xb50e('0x41')]['findOne']({'where':{'id':_0x1bcc6d[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x1384d9,null))[_0xb50e('0x23')](function(_0x14ec49){if(_0x14ec49){_0x38e124['model']=_[_0xb50e('0x5e')](db['Disposition'][_0xb50e('0x42')]);_0x38e124[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x1bcc6d[_0xb50e('0x47')]);_0x38e124[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x38e124['model'],_0x38e124[_0xb50e('0x47')]);_0x43d9ed[_0xb50e('0x4b')]=_['intersection'](_0x38e124[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x1bcc6d['query'][_0xb50e('0x4a')]));_0x43d9ed[_0xb50e('0x4b')]=_0x43d9ed[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0x43d9ed[_0xb50e('0x4b')]:_0x38e124[_0xb50e('0x45')];if(!_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0x43d9ed[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x1bcc6d['query']['limit']);_0x43d9ed[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x33')]);}_0x43d9ed[_0xb50e('0x6d')]=qs[_0xb50e('0x4f')](_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x43d9ed[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_['pick'](_0x1bcc6d[_0xb50e('0x47')],_0x38e124[_0xb50e('0x48')]));_0x43d9ed[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x14ec49['id'];if(_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x55')]){_0x43d9ed['where']=_[_0xb50e('0x52')](_0x43d9ed['where'],{'$or':_[_0xb50e('0x46')](_0x43d9ed[_0xb50e('0x4b')],function(_0x29ca1e){var _0x1254f3={};_0x1254f3[_0x29ca1e]={'$like':'%'+_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x1254f3;})});}_0x43d9ed=_[_0xb50e('0x52')]({},_0x43d9ed,_0x1bcc6d[_0xb50e('0x56')]);return db[_0xb50e('0x6b')][_0xb50e('0x32')]({'where':_0x43d9ed[_0xb50e('0x50')]})[_0xb50e('0x23')](function(_0xa78b30){_0x2e7ac0['count']=_0xa78b30;if(_0x1bcc6d['query'][_0xb50e('0x57')]){_0x43d9ed[_0xb50e('0x58')]=[{'all':!![]}];}return db[_0xb50e('0x6b')][_0xb50e('0x59')](_0x43d9ed);})['then'](function(_0xc16d33){_0x2e7ac0[_0xb50e('0x5a')]=_0xc16d33;return _0x2e7ac0;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x1384d9,_0x43d9ed))[_0xb50e('0x5b')](handleError(_0x1384d9,null));};exports[_0xb50e('0x6e')]=function(_0xbd18f7,_0x59d21d,_0x2c7541){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0xbd18f7[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x59d21d,null))[_0xb50e('0x23')](function(_0x6ed6ec){if(_0x6ed6ec){return _0x6ed6ec[_0xb50e('0x6e')](_0xbd18f7[_0xb50e('0x47')][_0xb50e('0x6f')]);}})[_0xb50e('0x23')](respondWithStatusCode(_0x59d21d,null))[_0xb50e('0x5b')](handleError(_0x59d21d,null));};exports[_0xb50e('0x70')]=function(_0x41ebfd,_0x30a15b,_0x3a6448){if(_0x41ebfd['body']['id']){delete _0x41ebfd[_0xb50e('0x61')]['id'];}return db['ChatWebsite'][_0xb50e('0x5f')]({'where':{'id':_0x41ebfd['params']['id']}})['then'](handleEntityNotFound(_0x30a15b,null))[_0xb50e('0x23')](function(_0x2d8618){if(_0x2d8618){_0x41ebfd[_0xb50e('0x61')][_0xb50e('0x6a')]=_0x2d8618['id'];return db[_0xb50e('0x71')][_0xb50e('0x60')](_0x41ebfd[_0xb50e('0x61')]);}})[_0xb50e('0x23')](respondWithResult(_0x30a15b,null))['catch'](handleError(_0x30a15b,null));};exports[_0xb50e('0x72')]=function(_0x35168d,_0x5d4620,_0x272545){var _0xa6cbec={'raw':![],'where':{}};var _0x5ceed2={};var _0x525114={'count':0x0,'rows':[]};return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x35168d[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x5d4620,null))[_0xb50e('0x23')](function(_0x461644){if(_0x461644){_0x5ceed2[_0xb50e('0x45')]=_['keys'](db['CannedAnswer'][_0xb50e('0x42')]);_0x5ceed2[_0xb50e('0x47')]=_['keys'](_0x35168d[_0xb50e('0x47')]);_0x5ceed2[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x5ceed2['model'],_0x5ceed2[_0xb50e('0x47')]);_0xa6cbec[_0xb50e('0x4b')]=_[_0xb50e('0x49')](_0x5ceed2[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x35168d[_0xb50e('0x47')][_0xb50e('0x4a')]));_0xa6cbec[_0xb50e('0x4b')]=_0xa6cbec[_0xb50e('0x4b')]['length']?_0xa6cbec[_0xb50e('0x4b')]:_0x5ceed2[_0xb50e('0x45')];if(!_0x35168d[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0xa6cbec[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x35168d[_0xb50e('0x47')]['limit']);_0xa6cbec['offset']=qs[_0xb50e('0x33')](_0x35168d['query'][_0xb50e('0x33')]);}_0xa6cbec[_0xb50e('0x6d')]=qs['sort'](_0x35168d['query'][_0xb50e('0x4f')]);_0xa6cbec[_0xb50e('0x50')]=qs['filters'](_['pick'](_0x35168d[_0xb50e('0x47')],_0x5ceed2[_0xb50e('0x48')]));_0xa6cbec[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x461644['id'];if(_0x35168d[_0xb50e('0x47')][_0xb50e('0x55')]){_0xa6cbec[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0xa6cbec[_0xb50e('0x50')],{'$or':_['map'](_0xa6cbec[_0xb50e('0x4b')],function(_0x5f1ca3){var _0x49e8fc={};_0x49e8fc[_0x5f1ca3]={'$like':'%'+_0x35168d[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x49e8fc;})});}_0xa6cbec=_[_0xb50e('0x52')]({},_0xa6cbec,_0x35168d[_0xb50e('0x56')]);return db[_0xb50e('0x71')][_0xb50e('0x32')]({'where':_0xa6cbec[_0xb50e('0x50')]})[_0xb50e('0x23')](function(_0x5b085a){_0x525114['count']=_0x5b085a;if(_0x35168d[_0xb50e('0x47')][_0xb50e('0x57')]){_0xa6cbec[_0xb50e('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb50e('0x59')](_0xa6cbec);})['then'](function(_0x3f09bd){_0x525114[_0xb50e('0x5a')]=_0x3f09bd;return _0x525114;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x5d4620,_0xa6cbec))[_0xb50e('0x5b')](handleError(_0x5d4620,null));};exports[_0xb50e('0x74')]=function(_0x383042,_0x11d8e2,_0x471b76){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x383042[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x11d8e2,null))['then'](function(_0x302985){if(_0x302985){return _0x302985['removeAnswers'](_0x383042[_0xb50e('0x47')][_0xb50e('0x6f')]);}})[_0xb50e('0x23')](respondWithStatusCode(_0x11d8e2,null))[_0xb50e('0x5b')](handleError(_0x11d8e2,null));};exports['addLogo']=function(_0x2982c2,_0x417d24,_0x108fad){_0x2982c2[_0xb50e('0x61')]['sitepic']=_0x2982c2['file'][_0xb50e('0x75')];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x2982c2[_0xb50e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x417d24,null))['then'](saveUpdates(_0x2982c2[_0xb50e('0x61')],null))[_0xb50e('0x23')](respondWithResult(_0x417d24,null))[_0xb50e('0x5b')](handleError(_0x417d24,null));};exports[_0xb50e('0x76')]=function(_0x3709a3,_0x1c3e6b,_0x2bb000){_0x3709a3[_0xb50e('0x61')]['agentAvatar']=_0x3709a3[_0xb50e('0x77')][_0xb50e('0x75')];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x3709a3[_0xb50e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c3e6b,null))[_0xb50e('0x23')](saveUpdates(_0x3709a3[_0xb50e('0x61')],null))['then'](respondWithResult(_0x1c3e6b,null))[_0xb50e('0x5b')](handleError(_0x1c3e6b,null));};exports[_0xb50e('0x78')]=function(_0x402228,_0x2c10e3,_0x46ce78){_0x402228[_0xb50e('0x61')]['customerAvatar']=_0x402228[_0xb50e('0x77')][_0xb50e('0x75')];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x402228[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x2c10e3,null))[_0xb50e('0x23')](saveUpdates(_0x402228[_0xb50e('0x61')],null))[_0xb50e('0x23')](respondWithResult(_0x2c10e3,null))[_0xb50e('0x5b')](handleError(_0x2c10e3,null));};exports['addSystemAvatar']=function(_0x184fd6,_0x50f1a9,_0x1c8d6f){_0x184fd6['body'][_0xb50e('0x79')]=_0x184fd6['file']['filename'];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x184fd6[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x50f1a9,null))[_0xb50e('0x23')](saveUpdates(_0x184fd6[_0xb50e('0x61')],null))['then'](respondWithResult(_0x50f1a9,null))[_0xb50e('0x5b')](handleError(_0x50f1a9,null));};exports[_0xb50e('0x7a')]=function(_0x12bbee,_0x443798,_0x501f77){var _0x3d3980=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x7d'));var _0x47e3e0={'where':{'id':_0x12bbee[_0xb50e('0x5d')]['id']},'attributes':['id',_0xb50e('0x7e')],'raw':!![]};var _0x50295a=![];return require(_0xb50e('0x18'))[_0xb50e('0x7f')]()['then'](function(_0x13a4f8){if(_0x13a4f8){_0x50295a=_0x13a4f8[_0xb50e('0x80')];}})[_0xb50e('0x23')](function(){return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x47e3e0);})['then'](handleEntityNotFound(_0x443798,null))[_0xb50e('0x23')](function(_0x54ee1f){if(_0x54ee1f){if(!_[_0xb50e('0x81')](_0x54ee1f[_0xb50e('0x7e')])){if(fs['existsSync'](path['join'](config[_0xb50e('0x7c')],'server/files/images/logos/',_0x54ee1f['sitepic']))&&_0x50295a){_0x3d3980=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x82'),_0x54ee1f[_0xb50e('0x7e')]);}}return _0x443798[_0xb50e('0x83')](_0x3d3980);}})['catch'](handleError(_0x443798,null));};exports[_0xb50e('0x84')]=function(_0x34a455,_0x5d2c9f,_0x584716){var _0x53149c=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x85'));var _0x56526f={'where':{'id':_0x34a455[_0xb50e('0x5d')]['id']},'attributes':['id',_0xb50e('0x86')],'raw':!![]};return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x56526f)[_0xb50e('0x23')](handleEntityNotFound(_0x5d2c9f,null))['then'](function(_0x52f5f7){if(_0x52f5f7){if(!_[_0xb50e('0x81')](_0x52f5f7[_0xb50e('0x86')])){if(fs[_0xb50e('0x87')](path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0x52f5f7['agentAvatar']))){_0x53149c=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],'server/files/images/avatars/',_0x52f5f7['agentAvatar']);}}return _0x5d2c9f[_0xb50e('0x83')](_0x53149c);}})[_0xb50e('0x5b')](handleError(_0x5d2c9f,null));};exports[_0xb50e('0x89')]=function(_0x2e4273,_0x18cf21,_0x417626){var _0x3791a9=path['join'](config[_0xb50e('0x7c')],_0xb50e('0x8a'));var _0x3f5afd={'where':{'id':_0x2e4273['params']['id']},'attributes':['id',_0xb50e('0x8b'),_0xb50e('0x8c')],'raw':!![]};return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x3f5afd)[_0xb50e('0x23')](handleEntityNotFound(_0x18cf21,null))[_0xb50e('0x23')](function(_0x3db34c){if(_0x3db34c){if(!_[_0xb50e('0x81')](_0x3db34c[_0xb50e('0x8b')])){if(fs[_0xb50e('0x87')](path['join'](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0x3db34c[_0xb50e('0x8b')]))&&_0x3db34c[_0xb50e('0x8c')]){_0x3791a9=path['join'](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0x3db34c['customerAvatar']);}}return _0x18cf21['download'](_0x3791a9);}})[_0xb50e('0x5b')](handleError(_0x18cf21,null));};exports[_0xb50e('0x8d')]=function(_0x8b13ca,_0x34fa9a,_0x902bf5){var _0x1330ff=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x8e'));var _0x16085a={'where':{'id':_0x8b13ca[_0xb50e('0x5d')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x16085a)[_0xb50e('0x23')](handleEntityNotFound(_0x34fa9a,null))['then'](function(_0xdab550){if(_0xdab550){if(!_['isNil'](_0xdab550[_0xb50e('0x79')])){if(fs[_0xb50e('0x87')](path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0xdab550[_0xb50e('0x79')]))){_0x1330ff=path['join'](config['root'],'server/files/images/avatars/',_0xdab550[_0xb50e('0x79')]);}}return _0x34fa9a[_0xb50e('0x83')](_0x1330ff);}})[_0xb50e('0x5b')](handleError(_0x34fa9a,null));};exports['notify']=function(_0x260353,_0x3e5833,_0x4f7741){var _0x17bc9e=require('user-agent-parser');var _0x34750d=new _0x17bc9e();var _0x590df9=_0x34750d[_0xb50e('0x8f')](_0x260353[_0xb50e('0x90')][_0xb50e('0x91')])[_0xb50e('0x92')]();var _0x22c6d6={'body':_0x260353[_0xb50e('0x61')],'channel':_0xb50e('0x93')};var _0x448ace=[];var _0x33948f=[];var _0x15c526={};var _0x8b6509=![];return db[_0xb50e('0x94')]['describe']()['then'](function(_0x3a4a5f){if(!_0x3a4a5f){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))](_0xb50e('0x97'));}_0x448ace=_[_0xb50e('0x98')](_[_0xb50e('0x5e')](_0x3a4a5f),['createdAt','updatedAt']);_0x33948f=_[_0xb50e('0x98')](_['keys'](_0x3a4a5f),[_0xb50e('0x99'),_0xb50e('0x9a'),_0xb50e('0x9b'),_0xb50e('0x9c')]);if(_0x260353[_0xb50e('0x61')]['id']){delete _0x260353[_0xb50e('0x61')]['id'];}if(_[_0xb50e('0x81')](_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')])){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))]('from\x20is\x20mandatory');}if(_[_0xb50e('0x81')](_0x260353[_0xb50e('0x61')][_0xb50e('0x61')])||_0x260353[_0xb50e('0x61')]['body']===''){throw new db[(_0xb50e('0x95'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb50e('0x81')](_0x260353['body']['mapKey'])){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33948f);}if(!_[_0xb50e('0x9e')](_0x33948f,_0x260353[_0xb50e('0x61')][_0xb50e('0x9f')])){throw new db[(_0xb50e('0x95'))]['ValidationError'](_0xb50e('0xa0')+_0x33948f);}_0x15c526[_0x260353[_0xb50e('0x61')]['mapKey']]=_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')];})['then'](function(){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x260353[_0xb50e('0x5d')]['id']},'include':[{'model':db[_0xb50e('0xa1')],'as':'List','include':[{'model':db[_0xb50e('0x94')],'as':'Contacts','where':_0x15c526,'limit':0x1,'order':[[_0xb50e('0x9a'),'DESC']]}]},{'model':db[_0xb50e('0xa2')],'as':_0xb50e('0xa3')}]});})[_0xb50e('0x23')](handleEntityNotFound(_0x3e5833,null))[_0xb50e('0x23')](function(_0x32ec81){if(_0x32ec81&&_0x32ec81[_0xb50e('0xa4')]){_0x22c6d6[_0xb50e('0xa5')]=_0x32ec81;_0x22c6d6[_0xb50e('0xa6')]=_0x32ec81[_0xb50e('0xa3')];_0x22c6d6[_0xb50e('0xa7')]=_0x32ec81[_0xb50e('0xa4')];_0x22c6d6[_0xb50e('0xa6')]=_['orderBy'](_0x22c6d6[_0xb50e('0xa6')],['priority'],[_0xb50e('0xa8')]);if(_0x22c6d6['account']['Applications']){delete _0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xa3')];}if(_0x22c6d6[_0xb50e('0xa5')]['List']&&_0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xa4')][_0xb50e('0xa9')]['length']){return _0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xa4')][_0xb50e('0xa9')][0x0];}var _0x2b4667=_[_0xb50e('0x1b')](_0x260353[_0xb50e('0x61')],{'firstName':_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')],'ListId':_0x32ec81[_0xb50e('0x9c')]});_0x2b4667[_0x260353['body'][_0xb50e('0x9f')]]=_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')];return db['CmContact'][_0xb50e('0x60')](_0x2b4667,{'fields':_0x448ace,'raw':!![]});}})[_0xb50e('0x23')](handleEntityNotFound(_0x3e5833,null))[_0xb50e('0x23')](function(_0x44b7fe){_0x22c6d6[_0xb50e('0xaa')]=_0x44b7fe;var _0x4605f9=_0x260353[_0xb50e('0x61')][_0xb50e('0xab')];if(_0x260353['headers']['cf-connecting-ip']){_0x4605f9=_0x260353['headers'][_0xb50e('0xac')];}else if(_0x260353[_0xb50e('0x90')][_0xb50e('0xad')]){_0x4605f9=_['first'](_0x260353[_0xb50e('0x90')][_0xb50e('0xad')][_0xb50e('0xae')](','));}if(_0x44b7fe){var _0x366501={'ContactId':_0x44b7fe['id'],'ChatWebsiteId':_0x260353[_0xb50e('0x5d')]['id'],'from':(_0x44b7fe[_0xb50e('0xaf')]||'')+'\x20'+(_0x44b7fe[_0xb50e('0xb0')]||''),'customerIp':_0x4605f9,'customerPort':_0x260353[_0xb50e('0x90')][_0xb50e('0xb1')]?_0x260353['headers']['x-real-port']:null,'referer':_0x260353[_0xb50e('0x61')][_0xb50e('0xb2')],'browserName':_0x590df9[_0xb50e('0xb3')][_0xb50e('0x54')]&&_0x590df9[_0xb50e('0xb3')][_0xb50e('0xb4')]?util['format'](_0xb50e('0xb5'),_0x590df9[_0xb50e('0xb3')][_0xb50e('0x54')],_0x590df9[_0xb50e('0xb3')][_0xb50e('0xb4')]):_0xb50e('0xb6'),'browserVersion':_0x590df9[_0xb50e('0xb3')]['version']||_0xb50e('0xb6'),'osName':util[_0xb50e('0xb7')](_0xb50e('0xb5'),_0x590df9['os'][_0xb50e('0x54')],_0x590df9['os'][_0xb50e('0xb4')]),'osVersion':_0x590df9['os'][_0xb50e('0xb4')],'deviceModel':_0x590df9[_0xb50e('0xb8')][_0xb50e('0x45')]&&_0x590df9[_0xb50e('0xb8')]['vendor']?util[_0xb50e('0xb7')](_0xb50e('0xb9'),_0x590df9[_0xb50e('0xb8')][_0xb50e('0x45')],_0x590df9['device'][_0xb50e('0xba')],_0x590df9[_0xb50e('0xb8')]['type']):null,'deviceVendor':_0x590df9[_0xb50e('0xb8')]['vendor'],'deviceType':_0x590df9[_0xb50e('0xb8')][_0xb50e('0xbb')],'formData':JSON[_0xb50e('0x29')](_0x260353[_0xb50e('0x61')])};var _0x2112f2={'ChatWebsiteId':_0x260353[_0xb50e('0x5d')]['id'],'closed':![]};if(_0x260353[_0xb50e('0x61')][_0xb50e('0xbc')]){_0x2112f2[_0xb50e('0xbc')]=_0x260353[_0xb50e('0x61')][_0xb50e('0xbc')];return db['ChatInteraction']['find']({'where':_0x2112f2})[_0xb50e('0x23')](function(_0x107623){if(_0x107623){return[_0x107623,![]];}_0x366501['threadId']=_0x260353['body']['threadId'];_0x366501[_0xb50e('0xbd')]=_0x260353['body']['externalUrl'];return db[_0xb50e('0xbe')][_0xb50e('0x60')](_0x366501)['then'](function(_0x5d5dbd){return[_0x5d5dbd,!![]];});});}_0x2112f2['ContactId']=_0x44b7fe['id'];if(_0x260353['body'][_0xb50e('0xbf')]&&_0x260353[_0xb50e('0x61')][_0xb50e('0xbf')]['id']){_0x2112f2['id']=_0x260353[_0xb50e('0x61')][_0xb50e('0xbf')]['id'];return db['ChatInteraction'][_0xb50e('0x5f')]({'where':_0x2112f2})['then'](function(_0x1d402d){if(_0x1d402d){return[_0x1d402d,![]];}return db[_0xb50e('0xbe')][_0xb50e('0x60')](_0x366501)['then'](function(_0x562a4c){return[_0x562a4c,!![]];});});}return db[_0xb50e('0xbe')][_0xb50e('0x60')](_0x366501)[_0xb50e('0x23')](function(_0x2ec1ba){return[_0x2ec1ba,!![]];});}})[_0xb50e('0xc0')](function(_0x54ffb8,_0x3e68e0){if(_0x54ffb8){_0x8b6509=_0x3e68e0;if(!_0x3e68e0){var _0xef32c4={'from':(_0x22c6d6[_0xb50e('0xaa')][_0xb50e('0xaf')]||'')+'\x20'+(_0x22c6d6[_0xb50e('0xaa')][_0xb50e('0xb0')]||'')};if(_0x260353['body'][_0xb50e('0xbc')]&&_0x260353['body'][_0xb50e('0xc1')]&&_0x260353[_0xb50e('0x61')]['threadId']!=_0x260353[_0xb50e('0x61')][_0xb50e('0xc1')]){_0xef32c4[_0xb50e('0xbc')]=_0x260353[_0xb50e('0x61')]['messageId'];}return _0x54ffb8[_0xb50e('0x3a')](_0xef32c4);}else{return _0x54ffb8;}}})['then'](function(_0x273419){_0x22c6d6[_0xb50e('0xbf')]=_0x273419['get']({'plain':!![]});_0x22c6d6[_0xb50e('0xbf')][_0xb50e('0xc2')]=_0x8b6509;if(_0x22c6d6['interaction']['created']){if(_0x22c6d6['account'][_0xb50e('0xc3')]){_0x22c6d6[_0xb50e('0xa6')][_0xb50e('0xc4')]({'id':0x0,'priority':_0x22c6d6['applications']['length']+0x1,'app':_0xb50e('0xc5'),'appdata':'unmanaged','interval':_0xb50e('0xc6')});}}return db[_0xb50e('0xc7')][_0xb50e('0x60')]({'body':_0x260353[_0xb50e('0x61')][_0xb50e('0x61')],'ChatWebsiteId':_0x260353[_0xb50e('0x5d')]['id'],'ChatInteractionId':_0x273419['id'],'direction':'in','ContactId':_0x22c6d6['contact']['id'],'AttachmentId':_0x260353[_0xb50e('0x61')][_0xb50e('0xc8')]});})[_0xb50e('0x23')](function(_0x425073){_0x22c6d6[_0xb50e('0x2c')]=_0x425073;if(_0x22c6d6['interaction'][_0xb50e('0xc9')]){return db[_0xb50e('0xca')][_0xb50e('0x5f')]({'attributes':['id',_0xb50e('0x54')],'where':{'id':_0x22c6d6[_0xb50e('0xbf')][_0xb50e('0xc9')]}})['then'](function(_0x3cd9bd){if(_0x3cd9bd){_0x22c6d6[_0xb50e('0xa6')][_0xb50e('0xcb')]({'id':0x0,'priority':0x0,'app':_0xb50e('0xcc'),'appdata':_0x3cd9bd[_0xb50e('0x54')]+','+(_0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xcd')]||0xa),'interval':_0xb50e('0xc6')});_0x22c6d6['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xb50e('0xce'),_0x22c6d6);});}return respondWithRpcPromise(_0xb50e('0xcf'),_0xb50e('0xce'),_0x22c6d6);})['then'](function(_0x4258d8){respondWithRpcPromise(_0xb50e('0xd0'),_0xb50e('0xd0'),{'event':_0xb50e('0xd1'),'message':_0x4258d8},client9002);return _0x4258d8;})['then'](respondWithResult(_0x3e5833,null))[_0xb50e('0x5b')](handleError(_0x3e5833,null));};exports[_0xb50e('0xd2')]=function(_0x2cbe73,_0x3c9b8c,_0x1e674d){var _0x9a510d,_0xeebc55,_0x4a77ce;var _0x3d46b4=[];var _0x5d36a5=[];var _0x501ca9={};return db[_0xb50e('0x94')][_0xb50e('0x68')]()[_0xb50e('0x23')](function(_0x516433){if(!_0x516433){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))](_0xb50e('0x97'));}_0x5d36a5=_[_0xb50e('0x98')](_['keys'](_0x516433),[_0xb50e('0x99'),_0xb50e('0x9a')]);_0x3d46b4=_[_0xb50e('0x98')](_['keys'](_0x516433),[_0xb50e('0x99'),'updatedAt','CompanyId',_0xb50e('0x9c')]);if(_0x2cbe73['body']['id']){delete _0x2cbe73[_0xb50e('0x61')]['id'];}if(_['isNil'](_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x9d')])){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)[_0xb50e('0x3d')](new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))](_0xb50e('0xd3')));}if(_[_0xb50e('0x81')](_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x61')])||_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x61')]===''){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)[_0xb50e('0x3d')](new db['Sequelize'][(_0xb50e('0x96'))](_0xb50e('0xd4')));}if(_[_0xb50e('0x81')](_0x2cbe73[_0xb50e('0x61')][_0xb50e('0xd5')])){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)[_0xb50e('0x3d')](new db['Sequelize'][(_0xb50e('0x96'))](_0xb50e('0xd6')+_0x3d46b4));}if(!_['includes'](_0x3d46b4,_0x2cbe73[_0xb50e('0x61')][_0xb50e('0xd5')])){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)['send'](new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d46b4));}_0x501ca9[_0x2cbe73[_0xb50e('0x61')]['mapKeyOffline']]=_0x2cbe73['body'][_0xb50e('0x9d')];})[_0xb50e('0x23')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2cbe73[_0xb50e('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List'}]});})[_0xb50e('0x23')](handleEntityNotFound(_0x3c9b8c,null))[_0xb50e('0x23')](function(_0x5a6c5e){if(_0x5a6c5e&&_0x5a6c5e[_0xb50e('0xa4')]){_0xeebc55=_0x5a6c5e;var _0x5d9822=_[_0xb50e('0x1b')](_0x2cbe73[_0xb50e('0x61')],{'firstName':_0x2cbe73['body'][_0xb50e('0x9d')],'phone':_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x9d')],'ListId':_0x5a6c5e[_0xb50e('0x9c')]});_0x5d9822[_0x2cbe73[_0xb50e('0x61')]['mapKeyOffline']]=_0x2cbe73['body'][_0xb50e('0x9d')];return db['CmContact'][_0xb50e('0xd7')]({'where':_0x501ca9,'defaults':_0x5d9822});}})['spread'](function(_0x1f6cb1){if(_0x1f6cb1){_0x4a77ce=_0x1f6cb1;var _0x5d5803=fs[_0xb50e('0xd8')](path['join'](config[_0xb50e('0x7c')],_0xb50e('0xd9')),'utf8');var _0x5d25c4=ejs[_0xb50e('0xda')](_0x5d5803,{'body':_[_0xb50e('0xdb')](_0x2cbe73[_0xb50e('0x61')]['body']),'bodyTitle':_0xeebc55[_0xb50e('0xdc')]});return db[_0xb50e('0xdd')][_0xb50e('0x60')]({'body':_0x5d25c4,'ContactId':_0x1f6cb1['id'],'ChatWebsiteId':_0xeebc55['id']});}})[_0xb50e('0x23')](function(_0x49bf9e){if(_0x49bf9e){_0x9a510d=_0x49bf9e;return db['MailAccount'][_0xb50e('0x73')]({'where':{'service':!![]},'include':[{'model':db[_0xb50e('0xde')],'as':_0xb50e('0xdf'),'raw':!![]}]});}})[_0xb50e('0x23')](function(_0x43681b){if(_0x43681b&&_0x43681b['Smtp']&&_0xeebc55['forwardOfflineAddress']){var _0x5e69b2={'tls':{'rejectUnauthorized':![]}};if(_0x43681b['Smtp'][_0xb50e('0xe0')]){_0x5e69b2['service']=_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe0')];}else{_0x5e69b2[_0xb50e('0xe1')]=_0x43681b['Smtp'][_0xb50e('0xe1')];_0x5e69b2['port']=_0x43681b['Smtp'][_0xb50e('0xe2')];_0x5e69b2[_0xb50e('0xe3')]=_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe3')];}if(_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe4')]){_0x5e69b2[_0xb50e('0xe5')]={'user':_0x43681b[_0xb50e('0xdf')]['user'],'pass':_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe6')]};}return respondWithRpcPromise('SendMail',_0xb50e('0xe7'),{'account':_0x5e69b2,'message':{'from':util[_0xb50e('0xb7')](_0xb50e('0xe8'),_0x43681b[_0xb50e('0x54')],_0x43681b[_0xb50e('0xe9')]||_0x43681b[_0xb50e('0xdf')][_0xb50e('0x64')]),'to':_0xeebc55[_0xb50e('0xea')],'subject':_0xeebc55[_0xb50e('0xeb')],'text':_0x9a510d[_0xb50e('0x61')]}},client9003)[_0xb50e('0x23')](function(){return _0x9a510d;})[_0xb50e('0x5b')](function(_0x458e06){console[_0xb50e('0x2a')](_0x458e06);});}})[_0xb50e('0x23')](function(){if(_0x9a510d){return _0x9a510d;}})['then'](respondWithResult(_0x3c9b8c,null))[_0xb50e('0x5b')](handleError(_0x3c9b8c,null));};exports[_0xb50e('0xec')]=function(_0x1d7536,_0xc3e051,_0x375adf){return db[_0xb50e('0xbe')][_0xb50e('0x5f')]({'where':{'id':_0x1d7536['params']['id']}})['then'](handleEntityNotFound(_0xc3e051,null))[_0xb50e('0x23')](function(_0x2a4f4e){if(_0x2a4f4e){return _0x2a4f4e[_0xb50e('0xec')](_0x1d7536[_0xb50e('0x61')][_0xb50e('0x6f')],_[_0xb50e('0xed')](_0x1d7536[_0xb50e('0x61')],[_0xb50e('0x6f'),'id'])||{});}})[_0xb50e('0x23')](respondWithResult(_0xc3e051,null))[_0xb50e('0x5b')](handleError(_0xc3e051,null));};exports[_0xb50e('0xee')]=function(_0x50ac48,_0x3acdc4,_0x3b9b48){var _0x9a313a={'raw':![],'where':{}};var _0x2f29e8={};var _0x1af3be={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb50e('0x73')]({'where':{'id':_0x50ac48['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x3acdc4,null))[_0xb50e('0x23')](function(_0x544636){if(_0x544636){_0x2f29e8[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0xbe')]['rawAttributes']);_0x2f29e8[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x50ac48[_0xb50e('0x47')]);_0x2f29e8['filters']=_[_0xb50e('0x49')](_0x2f29e8['model'],_0x2f29e8[_0xb50e('0x47')]);_0x9a313a[_0xb50e('0x4b')]=_[_0xb50e('0x49')](_0x2f29e8[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x50ac48['query']['fields']));_0x9a313a[_0xb50e('0x4b')]=_0x9a313a[_0xb50e('0x4b')]['length']?_0x9a313a['attributes']:_0x2f29e8[_0xb50e('0x45')];if(!_0x50ac48['query'][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0x9a313a[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x50ac48[_0xb50e('0x47')]['limit']);_0x9a313a[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x50ac48[_0xb50e('0x47')]['offset']);}_0x9a313a[_0xb50e('0x6d')]=qs[_0xb50e('0x4f')](_0x50ac48[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x9a313a[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x50ac48['query'],_0x2f29e8[_0xb50e('0x48')]));_0x9a313a[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x544636['id'];if(_0x50ac48['query'][_0xb50e('0x55')]){_0x9a313a[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0x9a313a[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0x9a313a[_0xb50e('0x4b')],function(_0x575b4a){var _0x264e86={};_0x264e86[_0x575b4a]={'$like':'%'+_0x50ac48[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x264e86;})});}_0x9a313a=_['merge']({},_0x9a313a,_0x50ac48[_0xb50e('0x56')]);return db[_0xb50e('0xbe')][_0xb50e('0x32')]({'where':_0x9a313a[_0xb50e('0x50')]})['then'](function(_0x41d405){_0x1af3be[_0xb50e('0x32')]=_0x41d405;if(_0x50ac48[_0xb50e('0x47')][_0xb50e('0x57')]){_0x9a313a[_0xb50e('0x58')]=[{'model':db['CmContact'],'as':_0xb50e('0xef'),'required':![]},{'model':db[_0xb50e('0xca')],'as':_0xb50e('0xf0'),'attributes':['name',_0xb50e('0xf1'),_0xb50e('0xf2')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xb50e('0xf3')],'where':_0x50ac48[_0xb50e('0x47')][_0xb50e('0xf4')]?{'id':_0x50ac48['query']['tag']}:undefined,'required':_0x50ac48[_0xb50e('0x47')][_0xb50e('0xf4')]?!![]:![]}];}return db[_0xb50e('0xbe')][_0xb50e('0x59')](_0x9a313a);})[_0xb50e('0x23')](function(_0x74509f){_0x1af3be[_0xb50e('0x5a')]=_0x74509f;return _0x1af3be;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x3acdc4,_0x9a313a))[_0xb50e('0x5b')](handleError(_0x3acdc4,null));};function iftimePromise(_0x5ee806,_0x46c532){return respondWithRpcPromise(_0xb50e('0xf5'),_0xb50e('0xf6'),{'command':_0x46c532[_0xb50e('0xf7')]?util[_0xb50e('0xb7')](_0xb50e('0xf8'),_0x5ee806[_0xb50e('0xf9')],_0x46c532['timezone']):util[_0xb50e('0xb7')](_0xb50e('0xfa'),_0x5ee806[_0xb50e('0xf9')])},client9002)[_0xb50e('0x23')](function(_0x5b59d4){var _0xfdb1c4=_0x5b59d4&&_0x5b59d4[_0xb50e('0xfb')](_0xb50e('0xfc'))>=0x0?!![]:![];logger['info'](_0xb50e('0xfd'),_0x46c532['id'],_0x5ee806['id'],_0x5ee806[_0xb50e('0xf9')],_0xfdb1c4?_0xb50e('0xfe'):'OFFLINE',_0x46c532[_0xb50e('0xf7')]?_0x46c532[_0xb50e('0xf7')]:'No\x20timezone');return _0xfdb1c4;})[_0xb50e('0x5b')](function(_0x4665ec){logger[_0xb50e('0x2a')](_0xb50e('0xfd'),_0x46c532['id'],_0x5ee806['id'],_0x5ee806[_0xb50e('0xf9')],util[_0xb50e('0xff')](_0x4665ec,{'showHidden':![],'depth':null}),_0x46c532[_0xb50e('0xf7')]?_0x46c532[_0xb50e('0xf7')]:_0xb50e('0x100'));return![];});}exports[_0xb50e('0xf6')]=function(_0x3c9957,_0x22d2c4,_0x1cfd6c){var _0x1c981a=0x0;var _0x5b5a88=0x0;var _0x285d33=![];var _0x95e577;var _0x5b0333;return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x3c9957[_0xb50e('0x5d')]['id']},'include':[{'model':db['Interval'],'as':_0xb50e('0x101'),'include':[{'model':db[_0xb50e('0x101')],'as':_0xb50e('0x102'),'attributes':['id',_0xb50e('0xf9')],'raw':!![]}]}]})[_0xb50e('0x23')](handleEntityNotFound(_0x22d2c4,null))[_0xb50e('0x23')](function(_0x178f59){if(_0x178f59){_0x95e577=_0x178f59;return _0x178f59[_0xb50e('0x103')]({'raw':!![]});}})[_0xb50e('0x23')](function(_0x2eeaf6){if(_0x95e577){if(_0x2eeaf6){_0x5b0333=_0x2eeaf6;}}return require(_0xb50e('0x18'))[_0xb50e('0x7f')]();})['then'](function(_0x277abb){if(_0x277abb){_0x5b5a88=_0x277abb[_0xb50e('0x104')];_0x285d33=_0x277abb[_0xb50e('0x80')];}})['then'](function(){return db[_0xb50e('0xbe')][_0xb50e('0x32')]({'where':{'closed':![]}});})[_0xb50e('0x23')](function(_0x57fec4){_0x1c981a=_0x57fec4;if(_0x5b5a88&&_0x57fec4>_0x5b5a88){return db[_0xb50e('0x105')]['findOne']({'where':{'id':0x1}})[_0xb50e('0x23')](function(_0x23f99d){if(_0x23f99d){_0x23f99d[_0xb50e('0x106')](_0xb50e('0x107'));}});}})['then'](function(){if(_0x95e577['Interval']&&_0x95e577[_0xb50e('0x101')][_0xb50e('0x102')]){var _0x196800=[];for(var _0x4bc4aa=0x0;_0x4bc4aa<_0x95e577[_0xb50e('0x101')]['Intervals'][_0xb50e('0x4c')];_0x4bc4aa++){var _0x46406c=_0x95e577['Interval'][_0xb50e('0x102')][_0x4bc4aa][_0xb50e('0x65')]({'plain':!![]});_0x196800['push'](iftimePromise(_0x46406c,_0x95e577));}return BPromise['all'](_0x196800)[_0xb50e('0x23')](function(_0x24a19b){return _['some'](_0x24a19b);});}else{return!![];}})[_0xb50e('0x23')](function(_0xad4275){var _0x5134f6=fs[_0xb50e('0xd8')](path['join'](config[_0xb50e('0x7c')],_0xb50e('0x108')),'utf8');var _0x459626={'remote':_0x95e577['remote'],'query':querystring[_0xb50e('0x29')](_[_0xb50e('0x52')](_0x95e577[_0xb50e('0x65')]({'plain':!![]}),{'customerIp':_0x3c9957[_0xb50e('0x90')][_0xb50e('0xad')]||_0x3c9957[_0xb50e('0x90')][_0xb50e('0x109')]||_0x3c9957[_0xb50e('0x10a')][_0xb50e('0x10b')]||_0x3c9957['ip'],'referer':_0x3c9957[_0xb50e('0x90')][_0xb50e('0xb2')],'openedInteractions':_0x1c981a,'maxInteractions':_0x5b5a88,'virtual':_0x285d33[_0xb50e('0x104')],'online':_0xad4275,'custom':_0x285d33}))[_0xb50e('0x10c')](/'/g,'\x5c\x27')};_0x22d2c4[_0xb50e('0x3d')](ejs[_0xb50e('0xda')](Mustache[_0xb50e('0xda')](_0x5134f6,_0x459626),{'proactiveActions':_0x5b0333,'alignment':_0x95e577[_0xb50e('0x10d')],'verticalAlignment':_0x95e577['verticalAlignment'],'div_color':_0x95e577[_0xb50e('0xf3')],'text_color':_0x95e577['textColor']}));})[_0xb50e('0x5b')](handleError(_0x22d2c4,null));};exports['addApplications']=function(_0x54362e,_0x77759e,_0x325f4d){return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x54362e[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x77759e,null))[_0xb50e('0x23')](function(_0x372794){if(_0x372794){return db[_0xb50e('0x10e')][_0xb50e('0x10f')](function(_0x2470e8){return db[_0xb50e('0xa2')]['destroy']({'where':{'ChatWebsiteId':_0x54362e[_0xb50e('0x5d')]['id']},'transaction':_0x2470e8})[_0xb50e('0x23')](function(_0x34a2cb){var _0xb3c80d=_['map'](_0x54362e[_0xb50e('0x61')],function(_0x48b749){_0x48b749[_0xb50e('0x6a')]=_0x54362e[_0xb50e('0x5d')]['id'];return _0x48b749;});return db['ChatApplication'][_0xb50e('0x110')](_0xb3c80d,{'transaction':_0x2470e8});});})['then'](function(){return db['ChatApplication'][_0xb50e('0x111')]({'where':{'ChatWebsiteId':_0x54362e[_0xb50e('0x5d')]['id']},'order':_0xb50e('0x112')});});}})[_0xb50e('0x23')](respondWithResult(_0x77759e,null))[_0xb50e('0x5b')](handleError(_0x77759e,null));};exports[_0xb50e('0x113')]=function(_0x226f82,_0x52ecb7,_0x1ec6a2){var _0xed582b={};var _0x5cbf1a={};var _0x124b21;var _0x5f4a3c;return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x226f82[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x52ecb7,null))['then'](function(_0x4acc8c){if(_0x4acc8c){_0x124b21=_0x4acc8c;_0x5cbf1a[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0xa2')][_0xb50e('0x42')]);_0x5cbf1a[_0xb50e('0x47')]=_['keys'](_0x226f82['query']);_0x5cbf1a[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x5cbf1a['model'],_0x5cbf1a['query']);_0xed582b[_0xb50e('0x4b')]=_['intersection'](_0x5cbf1a[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x226f82['query'][_0xb50e('0x4a')]));_0xed582b[_0xb50e('0x4b')]=_0xed582b[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0xed582b[_0xb50e('0x4b')]:_0x5cbf1a[_0xb50e('0x45')];_0xed582b['order']=qs[_0xb50e('0x4f')](_0x226f82[_0xb50e('0x47')][_0xb50e('0x4f')]);_0xed582b['where']=qs[_0xb50e('0x48')](_['pick'](_0x226f82[_0xb50e('0x47')],_0x5cbf1a[_0xb50e('0x48')]));if(_0x226f82['query'][_0xb50e('0x55')]){_0xed582b[_0xb50e('0x50')]=_['merge'](_0xed582b[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0xed582b[_0xb50e('0x4b')],function(_0x3567bb){var _0xb99809={};_0xb99809[_0x3567bb]={'$like':'%'+_0x226f82[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0xb99809;})});}_0xed582b=_[_0xb50e('0x52')]({},_0xed582b,_0x226f82['options']);return _0x124b21['getApplications'](_0xed582b);}})['then'](function(_0x5d7495){if(_0x5d7495){_0x5f4a3c=_0x5d7495[_0xb50e('0x4c')];if(!_0x226f82[_0xb50e('0x47')]['hasOwnProperty'](_0xb50e('0x4e'))){_0xed582b['limit']=qs['limit'](_0x226f82['query'][_0xb50e('0x34')]);_0xed582b[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x226f82['query']['offset']);}return _0x124b21['getApplications'](_0xed582b);}})[_0xb50e('0x23')](function(_0x44f997){if(_0x44f997){return _0x44f997?{'count':_0x5f4a3c,'rows':_0x44f997}:null;}})[_0xb50e('0x23')](respondWithResult(_0x52ecb7,null))['catch'](handleError(_0x52ecb7,null));};exports['addProactiveActions']=function(_0x1bdba2,_0x4fe552,_0x3d5361){return db['chatProactiveAction'][_0xb50e('0x5f')]({'where':{'id':_0x1bdba2[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x4fe552,null))[_0xb50e('0x23')](function(_0x4e1302){if(_0x4e1302){return _0x4e1302[_0xb50e('0x114')](_0x1bdba2[_0xb50e('0x61')][_0xb50e('0x6f')],_[_0xb50e('0xed')](_0x1bdba2[_0xb50e('0x61')],[_0xb50e('0x6f'),'id'])||{});}})[_0xb50e('0x23')](respondWithResult(_0x4fe552,null))[_0xb50e('0x5b')](handleError(_0x4fe552,null));};exports[_0xb50e('0x103')]=function(_0x5b04d7,_0x390331,_0xc830b0){var _0xb4e811={};var _0x3f5260={};var _0x1d8e93;var _0x347028;return db[_0xb50e('0x41')]['findOne']({'where':{'id':_0x5b04d7['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x390331,null))[_0xb50e('0x23')](function(_0x8e5727){if(_0x8e5727){_0x1d8e93=_0x8e5727;_0x3f5260[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0x115')][_0xb50e('0x42')]);_0x3f5260[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x5b04d7[_0xb50e('0x47')]);_0x3f5260[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x3f5260[_0xb50e('0x45')],_0x3f5260[_0xb50e('0x47')]);_0xb4e811[_0xb50e('0x4b')]=_[_0xb50e('0x49')](_0x3f5260[_0xb50e('0x45')],qs['fields'](_0x5b04d7['query'][_0xb50e('0x4a')]));_0xb4e811[_0xb50e('0x4b')]=_0xb4e811[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0xb4e811[_0xb50e('0x4b')]:_0x3f5260['model'];_0xb4e811['order']=qs[_0xb50e('0x4f')](_0x5b04d7['query'][_0xb50e('0x4f')]);_0xb4e811[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x5b04d7[_0xb50e('0x47')],_0x3f5260[_0xb50e('0x48')]));if(_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x55')]){_0xb4e811['where']=_['merge'](_0xb4e811[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0xb4e811[_0xb50e('0x4b')],function(_0x5cb46b){var _0x4fa538={};_0x4fa538[_0x5cb46b]={'$like':'%'+_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x4fa538;})});}_0xb4e811=_['merge']({},_0xb4e811,_0x5b04d7[_0xb50e('0x56')]);return _0x1d8e93[_0xb50e('0x103')](_0xb4e811);}})[_0xb50e('0x23')](function(_0x45e640){if(_0x45e640){_0x347028=_0x45e640[_0xb50e('0x4c')];if(!_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0xb4e811[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x5b04d7['query'][_0xb50e('0x34')]);_0xb4e811[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x33')]);}return _0x1d8e93[_0xb50e('0x103')](_0xb4e811);}})[_0xb50e('0x23')](function(_0x494158){if(_0x494158){return _0x494158?{'count':_0x347028,'rows':_0x494158}:null;}})[_0xb50e('0x23')](respondWithResult(_0x390331,null))['catch'](handleError(_0x390331,null));};exports[_0xb50e('0x116')]=function(_0x213604,_0x258f37,_0x25a2f9){var _0x4706ee=_0x213604['query']['online']===_0xb50e('0x117')?_0xb50e('0x118'):_0xb50e('0x119');return db['ChatWebsite']['find']({'attributes':['id',_0x4706ee],'where':{'id':_0x213604[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x258f37,null))['then'](function(_0x1b27d8){if(_0x1b27d8){var _0x440ef4=_0x1b27d8[_0x4706ee];var _0x388094=_0x440ef4&&_0x440ef4['items']?_0x440ef4['items']:[];_0x258f37[_0xb50e('0x3d')]({'fromKey':_[_0xb50e('0x81')](_0x440ef4[_0xb50e('0x11a')])?undefined:_0x440ef4[_0xb50e('0x11a')],'count':_0x388094['length'],'rows':_0x388094});}})[_0xb50e('0x5b')](handleError(_0x258f37,null));};exports[_0xb50e('0x11b')]=function(_0x30dfa6,_0x3da235,_0x4d8a57){var _0x59c273={'raw':![],'where':{}};var _0x2feb6b={};var _0x2a14a0={'count':0x0,'rows':[]};return db[_0xb50e('0x41')]['findOne']({'where':{'id':_0x30dfa6['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x3da235,null))[_0xb50e('0x23')](function(_0x53a45b){if(_0x53a45b){_0x2feb6b[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db['ChatOfflineMessage'][_0xb50e('0x42')]);_0x2feb6b['query']=_[_0xb50e('0x5e')](_0x30dfa6[_0xb50e('0x47')]);_0x2feb6b['filters']=_['intersection'](_0x2feb6b['model'],_0x2feb6b[_0xb50e('0x47')]);_0x59c273['attributes']=_[_0xb50e('0x49')](_0x2feb6b[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x4a')]));_0x59c273[_0xb50e('0x4b')]=_0x59c273[_0xb50e('0x4b')]['length']?_0x59c273[_0xb50e('0x4b')]:_0x2feb6b[_0xb50e('0x45')];if(!_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x4d')]('nolimit')){_0x59c273[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x30dfa6['query'][_0xb50e('0x34')]);_0x59c273[_0xb50e('0x33')]=qs['offset'](_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x33')]);}_0x59c273['order']=qs[_0xb50e('0x4f')](_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x59c273['where']=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x30dfa6['query'],_0x2feb6b[_0xb50e('0x48')]));_0x59c273[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x53a45b['id'];if(_0x30dfa6['query'][_0xb50e('0x55')]){_0x59c273[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0x59c273[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0x59c273['attributes'],function(_0x829918){var _0x24c7aa={};_0x24c7aa[_0x829918]={'$like':'%'+_0x30dfa6['query'][_0xb50e('0x55')]+'%'};return _0x24c7aa;})});}_0x59c273=_[_0xb50e('0x52')]({},_0x59c273,_0x30dfa6[_0xb50e('0x56')]);return db['ChatOfflineMessage']['count']({'where':_0x59c273[_0xb50e('0x50')]})[_0xb50e('0x23')](function(_0x2d6f6b){_0x2a14a0[_0xb50e('0x32')]=_0x2d6f6b;if(_0x30dfa6['query']['includeAll']){_0x59c273[_0xb50e('0x58')]=[{'all':!![]}];}else{_0x59c273[_0xb50e('0x58')]=[{'model':db[_0xb50e('0x94')],'as':_0xb50e('0xef'),'required':![]}];}return db[_0xb50e('0xdd')][_0xb50e('0x59')](_0x59c273);})['then'](function(_0x197b31){_0x2a14a0[_0xb50e('0x5a')]=_0x197b31;return _0x2a14a0;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x3da235,_0x59c273))['catch'](handleError(_0x3da235,null));};exports[_0xb50e('0x11c')]=function(_0x357384,_0x4d2055,_0x5ac65a){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x357384['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x4d2055,null))[_0xb50e('0x23')](function(_0x15b3aa){if(_0x15b3aa){return _0x15b3aa[_0xb50e('0x11c')](_0x357384[_0xb50e('0x61')][_0xb50e('0x6f')],_[_0xb50e('0xed')](_0x357384[_0xb50e('0x61')],['ids','id'])||{})[_0xb50e('0xc0')](function(_0x648dc1){for(var _0x89fdb2=0x0;_0x89fdb2<_0x357384[_0xb50e('0x61')][_0xb50e('0x6f')]['length'];_0x89fdb2+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x357384[_0xb50e('0x61')][_0xb50e('0x6f')][_0x89fdb2],'ChatWebsiteId':_0x357384[_0xb50e('0x5d')]['id']});}return _0x648dc1;});}})[_0xb50e('0x23')](respondWithResult(_0x4d2055,null))[_0xb50e('0x5b')](handleError(_0x4d2055,null));};exports[_0xb50e('0x11d')]=function(_0x1cf485,_0x1aa1b1,_0x5a2ef3){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x1cf485[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x1aa1b1,null))[_0xb50e('0x23')](function(_0x2f9779){if(_0x2f9779){return _0x2f9779[_0xb50e('0x11d')](_0x1cf485[_0xb50e('0x47')]['ids'])[_0xb50e('0x23')](function(){if(_[_0xb50e('0x11e')](_0x1cf485['query'][_0xb50e('0x6f')])){for(var _0xe15a36=0x0;_0xe15a36<_0x1cf485[_0xb50e('0x47')][_0xb50e('0x6f')][_0xb50e('0x4c')];_0xe15a36+=0x1){socket[_0xb50e('0x11f')](_0xb50e('0x120'),{'UserId':Number(_0x1cf485[_0xb50e('0x47')]['ids'][_0xe15a36]),'ChatWebsiteId':Number(_0x1cf485[_0xb50e('0x5d')]['id'])});}}else{socket[_0xb50e('0x11f')]('userChatWebsite:remove',{'UserId':Number(_0x1cf485[_0xb50e('0x47')]['ids']),'ChatWebsiteId':Number(_0x1cf485['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1aa1b1,null))['catch'](handleError(_0x1aa1b1,null));};exports[_0xb50e('0x121')]=function(_0x2bc943,_0x424955,_0x399d09){var _0x1b8816={};var _0x555179={};var _0x1a5a17;var _0x11bdb1;return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x2bc943[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x424955,null))[_0xb50e('0x23')](function(_0x12e63b){if(_0x12e63b){_0x1a5a17=_0x12e63b;_0x555179[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0xca')][_0xb50e('0x42')]);_0x555179[_0xb50e('0x47')]=_['keys'](_0x2bc943[_0xb50e('0x47')]);_0x555179[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x555179[_0xb50e('0x45')],_0x555179[_0xb50e('0x47')]);_0x1b8816[_0xb50e('0x4b')]=_['intersection'](_0x555179['model'],qs[_0xb50e('0x4a')](_0x2bc943[_0xb50e('0x47')]['fields']));_0x1b8816['attributes']=_0x1b8816[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0x1b8816[_0xb50e('0x4b')]:_0x555179[_0xb50e('0x45')];_0x1b8816[_0xb50e('0x6d')]=qs['sort'](_0x2bc943[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x1b8816[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x2bc943[_0xb50e('0x47')],_0x555179[_0xb50e('0x48')]));if(_0x2bc943[_0xb50e('0x47')][_0xb50e('0x55')]){_0x1b8816[_0xb50e('0x50')]=_['merge'](_0x1b8816[_0xb50e('0x50')],{'$or':_['map'](_0x1b8816[_0xb50e('0x4b')],function(_0x54fd2a){var _0x2d1d60={};_0x2d1d60[_0x54fd2a]={'$like':'%'+_0x2bc943['query'][_0xb50e('0x55')]+'%'};return _0x2d1d60;})});}_0x1b8816=_['merge']({},_0x1b8816,_0x2bc943[_0xb50e('0x56')]);return _0x1a5a17['getAgents'](_0x1b8816);}})[_0xb50e('0x23')](function(_0x10d825){if(_0x10d825){_0x11bdb1=_0x10d825[_0xb50e('0x4c')];if(!_0x2bc943[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0x1b8816[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x2bc943['query'][_0xb50e('0x34')]);_0x1b8816[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x2bc943[_0xb50e('0x47')][_0xb50e('0x33')]);}return _0x1a5a17['getAgents'](_0x1b8816);}})[_0xb50e('0x23')](function(_0x3a9dc1){if(_0x3a9dc1){return _0x3a9dc1?{'count':_0x11bdb1,'rows':_0x3a9dc1}:null;}})['then'](respondWithResult(_0x424955,null))[_0xb50e('0x5b')](handleError(_0x424955,null));}; \ No newline at end of file +var _0xac3a=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','ChatWebsiteId','Disposition','getDispositions','findOne','length','removeDispositions','ids','CannedAnswer','hasOwnProperty','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','custom','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','updatedAt','difference','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','ChatApplication','Applications','applications','list','orderBy','asc','account','Contacts','contact','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','no\x20available\x20attributes','createdAt','ListId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','getInteractions','Owner','fullname','internal','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','utf8','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color','textColor','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','get','ChatWebsites','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac3a,0x1e0));var _0xaac3=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0xac3a[_0x1627ae];return _0x34b38f;};'use strict';var pdf=require(_0xaac3('0x0'));var emlformat=require(_0xaac3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaac3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaac3('0x3'));var util=require(_0xaac3('0x4'));var path=require(_0xaac3('0x5'));var sox=require('sox');var csv=require(_0xaac3('0x6'));var ejs=require(_0xaac3('0x7'));var fs=require('fs');var _=require(_0xaac3('0x8'));var squel=require(_0xaac3('0x9'));var crypto=require(_0xaac3('0xa'));var jsforce=require(_0xaac3('0xb'));var deskjs=require(_0xaac3('0xc'));var toCsv=require(_0xaac3('0x6'));var querystring=require(_0xaac3('0xd'));var Papa=require(_0xaac3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac3('0xf'));var hardwareService=require(_0xaac3('0x10'));var logger=require(_0xaac3('0x11'))('api');var utils=require(_0xaac3('0x12'));var config=require(_0xaac3('0x13'));var licenseUtil=require(_0xaac3('0x14'));var db=require(_0xaac3('0x15'))['db'];config[_0xaac3('0x16')]=_[_0xaac3('0x17')](config[_0xaac3('0x16')],{'host':_0xaac3('0x18'),'port':0x18eb});var socket=require(_0xaac3('0x19'))(new Redis(config[_0xaac3('0x16')]));require(_0xaac3('0x1a'))[_0xaac3('0x1b')](socket);var jayson=require(_0xaac3('0x1c'));var client=jayson[_0xaac3('0x1d')][_0xaac3('0x1e')]({'port':0x232c});var client9002=jayson[_0xaac3('0x1d')][_0xaac3('0x1e')]({'port':0x232a});var client9003=jayson[_0xaac3('0x1d')][_0xaac3('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x22ea8c,_0x2d73cb,_0x17b70a,_0x276735){return new BPromise(function(_0x356f14,_0x1e0112){var _0x34fee4=_0x276735||client;return _0x34fee4['request'](_0x22ea8c,_0x17b70a)['then'](function(_0xf595ff){logger['info'](_0xaac3('0x1f'),_0x2d73cb,_0xaac3('0x20'));logger[_0xaac3('0x21')](_0xaac3('0x22'),_0x2d73cb,_0xaac3('0x20'),JSON['stringify'](_0xf595ff));if(_0xf595ff[_0xaac3('0x23')]){if(_0xf595ff['error'][_0xaac3('0x24')]===0x1f4){logger[_0xaac3('0x23')](_0xaac3('0x1f'),_0x2d73cb,_0xf595ff[_0xaac3('0x23')][_0xaac3('0x25')]);return _0x1e0112(_0xf595ff[_0xaac3('0x23')]['message']);}logger[_0xaac3('0x23')](_0xaac3('0x1f'),_0x2d73cb,_0xf595ff[_0xaac3('0x23')][_0xaac3('0x25')]);return _0x356f14(_0xf595ff[_0xaac3('0x23')]['message']);}else{logger[_0xaac3('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x2d73cb,'request\x20sent');_0x356f14(_0xf595ff[_0xaac3('0x27')]['message']);}})['catch'](function(_0x5ce187){logger[_0xaac3('0x23')](_0xaac3('0x1f'),_0x2d73cb,_0x5ce187);_0x1e0112(_0x5ce187);});});}function respondWithStatusCode(_0x372fa5,_0x84fca0){_0x84fca0=_0x84fca0||0xcc;return function(_0x20d22d){if(_0x20d22d){return _0x372fa5[_0xaac3('0x28')](_0x84fca0);}return _0x372fa5[_0xaac3('0x29')](_0x84fca0)[_0xaac3('0x2a')]();};}function respondWithResult(_0x232fa1,_0x50988c){_0x50988c=_0x50988c||0xc8;return function(_0x3fd7d0){if(_0x3fd7d0){return _0x232fa1[_0xaac3('0x29')](_0x50988c)[_0xaac3('0x2b')](_0x3fd7d0);}};}function respondWithFilteredResult(_0x381ca4,_0xe438c8){return function(_0x6d5646){if(_0x6d5646){var _0x217a12=_0x6d5646[_0xaac3('0x2c')],_0x54ac88=_0xe438c8['offset'],_0x24502a=_0xe438c8[_0xaac3('0x2d')]+_0xe438c8['limit'],_0x5ad10b;if(_0x24502a>=_0x217a12){_0x24502a=_0x217a12;_0x5ad10b=0xc8;}else{_0x5ad10b=0xce;}_0x381ca4[_0xaac3('0x29')](_0x5ad10b);return _0x381ca4[_0xaac3('0x2e')](_0xaac3('0x2f'),_0x54ac88+'-'+_0x24502a+'/'+_0x217a12)['json'](_0x6d5646);}return null;};}function patchUpdates(_0x3894d9){return function(_0x2a5b07){try{jsonpatch[_0xaac3('0x30')](_0x2a5b07,_0x3894d9,!![]);}catch(_0x31d1f5){return BPromise[_0xaac3('0x31')](_0x31d1f5);}return _0x2a5b07[_0xaac3('0x32')]();};}function saveUpdates(_0x593f1a,_0x2020d5){return function(_0xd50ed8){if(_0xd50ed8){return _0xd50ed8['update'](_0x593f1a)[_0xaac3('0x33')](function(_0x143388){return _0x143388;});}return null;};}function removeEntity(_0x3b2ac1,_0x2f4b33){return function(_0x5904a6){if(_0x5904a6){return _0x5904a6['destroy']()[_0xaac3('0x33')](function(){var _0x5dce26=_0x5904a6[_0xaac3('0x34')]({'plain':!![]});var _0xb42b5b=_0xaac3('0x35');return db[_0xaac3('0x36')][_0xaac3('0x37')]({'where':{'type':_0xb42b5b,'resourceId':_0x5dce26['id']}})[_0xaac3('0x33')](function(){return _0x5904a6;});})[_0xaac3('0x33')](function(){_0x3b2ac1[_0xaac3('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fcc4e,_0x36f0d8){return function(_0xa6de4f){if(!_0xa6de4f){_0x3fcc4e[_0xaac3('0x28')](0x194);}return _0xa6de4f;};}function handleError(_0x535434,_0x5cdfa9){_0x5cdfa9=_0x5cdfa9||0x1f4;return function(_0x402463){logger[_0xaac3('0x23')](_0x402463['stack']);if(_0x402463[_0xaac3('0x38')]){delete _0x402463[_0xaac3('0x38')];}_0x535434['status'](_0x5cdfa9)[_0xaac3('0x39')](_0x402463);};}exports[_0xaac3('0x3a')]=function(_0x3e5bcf,_0xbaa9f4){var _0x2cd260={'include':[{'model':db[_0xaac3('0x3b')],'as':_0xaac3('0x3c')}]},_0x9711de={},_0x5245f8={'count':0x0,'rows':[]};var _0x25fd67=_[_0xaac3('0x3d')](db[_0xaac3('0x3e')][_0xaac3('0x3f')],function(_0x188dd6){return{'name':_0x188dd6[_0xaac3('0x40')],'type':_0x188dd6[_0xaac3('0x41')][_0xaac3('0x42')]};});_0x9711de['model']=_['map'](_0x25fd67,'name');_0x9711de[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x3e5bcf[_0xaac3('0x43')]);_0x9711de[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x9711de[_0xaac3('0x47')],_0x9711de['query']);_0x2cd260['attributes']=_['intersection'](_0x9711de['model'],qs['fields'](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x48')]));_0x2cd260[_0xaac3('0x49')]=_0x2cd260[_0xaac3('0x49')]['length']?_0x2cd260['attributes']:_0x9711de[_0xaac3('0x47')];if(!_0x3e5bcf['query']['hasOwnProperty'](_0xaac3('0x4a'))){_0x2cd260['limit']=qs[_0xaac3('0x4b')](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x2cd260[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x2d')]);}_0x2cd260[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x2cd260['where']=qs[_0xaac3('0x45')](_['pick'](_0x3e5bcf[_0xaac3('0x43')],_0x9711de[_0xaac3('0x45')]),_0x25fd67);if(_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x2cd260[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x2cd260[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x25fd67,function(_0x5cbb72){if(_0x5cbb72[_0xaac3('0x41')]!=='VIRTUAL'){var _0x443ec3={};_0x443ec3[_0x5cbb72[_0xaac3('0x38')]]={'$like':'%'+_0x3e5bcf[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x443ec3;}})});}_0x2cd260=_[_0xaac3('0x50')]({},_0x2cd260,_0x3e5bcf[_0xaac3('0x51')]);var _0x27b530={'where':_0x2cd260['where']};return db[_0xaac3('0x3e')][_0xaac3('0x2c')](_0x27b530)['then'](function(_0x203b32){_0x5245f8[_0xaac3('0x2c')]=_0x203b32;if(_0x3e5bcf['query'][_0xaac3('0x52')]){_0x2cd260[_0xaac3('0x53')]=[{'all':!![]}];}return db[_0xaac3('0x3e')][_0xaac3('0x54')](_0x2cd260);})[_0xaac3('0x33')](function(_0x29f481){_0x5245f8[_0xaac3('0x55')]=_0x29f481;return _0x5245f8;})[_0xaac3('0x33')](respondWithFilteredResult(_0xbaa9f4,_0x2cd260))['catch'](handleError(_0xbaa9f4,null));};exports[_0xaac3('0x56')]=function(_0x335f04,_0x47765c){var _0x224865={'raw':![],'where':{'id':_0x335f04[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x3b')],'as':_0xaac3('0x3c')}]},_0x207b41={};_0x207b41[_0xaac3('0x47')]=_[_0xaac3('0x44')](db['ChatWebsite'][_0xaac3('0x3f')]);_0x207b41[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x335f04[_0xaac3('0x43')]);_0x207b41[_0xaac3('0x45')]=_['intersection'](_0x207b41[_0xaac3('0x47')],_0x207b41[_0xaac3('0x43')]);_0x224865[_0xaac3('0x49')]=_['intersection'](_0x207b41[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x335f04[_0xaac3('0x43')][_0xaac3('0x48')]));_0x224865[_0xaac3('0x49')]=_0x224865[_0xaac3('0x49')]['length']?_0x224865['attributes']:_0x207b41['model'];if(_0x335f04[_0xaac3('0x43')][_0xaac3('0x52')]){_0x224865[_0xaac3('0x53')]=[{'all':!![]}];}_0x224865=_[_0xaac3('0x50')]({},_0x224865,_0x335f04[_0xaac3('0x51')]);return db[_0xaac3('0x3e')][_0xaac3('0x58')](_0x224865)['then'](handleEntityNotFound(_0x47765c,null))[_0xaac3('0x33')](respondWithResult(_0x47765c,null))[_0xaac3('0x59')](handleError(_0x47765c,null));};exports[_0xaac3('0x5a')]=function(_0x49caef,_0xda323){return db[_0xaac3('0x3e')]['create'](_0x49caef['body'],{})[_0xaac3('0x33')](function(_0x2a7244){var _0x347db7=_0x49caef['user'][_0xaac3('0x34')]({'plain':!![]});if(!_0x347db7)throw new Error(_0xaac3('0x5b'));if(_0x347db7[_0xaac3('0x5c')]===_0xaac3('0x5d')){var _0x179a2d=_0x2a7244[_0xaac3('0x34')]({'plain':!![]});var _0x28e618=_0xaac3('0x35');return db[_0xaac3('0x5e')][_0xaac3('0x58')]({'where':{'name':_0x28e618,'userProfileId':_0x347db7['userProfileId']},'raw':!![]})[_0xaac3('0x33')](function(_0x42e43e){if(_0x42e43e&&_0x42e43e[_0xaac3('0x5f')]===0x0){return db[_0xaac3('0x36')][_0xaac3('0x5a')]({'name':_0x179a2d['name'],'resourceId':_0x179a2d['id'],'type':_0x42e43e[_0xaac3('0x38')],'sectionId':_0x42e43e['id']},{})[_0xaac3('0x33')](function(){return _0x2a7244;});}else{return _0x2a7244;}})[_0xaac3('0x59')](function(_0x5e7208){logger[_0xaac3('0x23')](_0xaac3('0x60'),_0x5e7208);throw _0x5e7208;});}return _0x2a7244;})[_0xaac3('0x33')](respondWithResult(_0xda323,0xc9))[_0xaac3('0x59')](handleError(_0xda323,null));};exports[_0xaac3('0x61')]=function(_0x523f04,_0xc712bd){if(_0x523f04['body']['id']){delete _0x523f04[_0xaac3('0x62')]['id'];}return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x523f04[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x3b')],'as':_0xaac3('0x3c')}]})[_0xaac3('0x33')](handleEntityNotFound(_0xc712bd,null))['then'](saveUpdates(_0x523f04[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0xc712bd,null))[_0xaac3('0x59')](handleError(_0xc712bd,null));};exports[_0xaac3('0x37')]=function(_0x422aba,_0x2dd934){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x422aba[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x2dd934,null))[_0xaac3('0x33')](removeEntity(_0x2dd934,null))[_0xaac3('0x59')](handleError(_0x2dd934,null));};exports[_0xaac3('0x63')]=function(_0x151ea5,_0x368cd4){return db[_0xaac3('0x3e')][_0xaac3('0x63')]()[_0xaac3('0x33')](respondWithResult(_0x368cd4,null))[_0xaac3('0x59')](handleError(_0x368cd4,null));};exports['addDisposition']=function(_0x40370c,_0x196f3d,_0x3a93c3){if(_0x40370c[_0xaac3('0x62')]['id']){delete _0x40370c[_0xaac3('0x62')]['id'];}return db['ChatWebsite'][_0xaac3('0x58')]({'where':{'id':_0x40370c[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x196f3d,null))[_0xaac3('0x33')](function(_0x23fdaf){if(_0x23fdaf){_0x40370c[_0xaac3('0x62')][_0xaac3('0x64')]=_0x23fdaf['id'];return db[_0xaac3('0x65')][_0xaac3('0x5a')](_0x40370c[_0xaac3('0x62')]);}})['then'](respondWithResult(_0x196f3d,null))[_0xaac3('0x59')](handleError(_0x196f3d,null));};exports[_0xaac3('0x66')]=function(_0x54ad73,_0x351157,_0x20ca1e){var _0x296e85={'raw':![],'where':{}};var _0x17714a={};var _0x57f72e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xaac3('0x67')]({'where':{'id':_0x54ad73['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x351157,null))['then'](function(_0x57f8a4){if(_0x57f8a4){_0x17714a[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0x65')][_0xaac3('0x3f')]);_0x17714a['query']=_[_0xaac3('0x44')](_0x54ad73['query']);_0x17714a[_0xaac3('0x45')]=_['intersection'](_0x17714a[_0xaac3('0x47')],_0x17714a['query']);_0x296e85[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x17714a[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x54ad73['query'][_0xaac3('0x48')]));_0x296e85['attributes']=_0x296e85[_0xaac3('0x49')][_0xaac3('0x68')]?_0x296e85[_0xaac3('0x49')]:_0x17714a[_0xaac3('0x47')];if(!_0x54ad73[_0xaac3('0x43')]['hasOwnProperty'](_0xaac3('0x4a'))){_0x296e85[_0xaac3('0x4b')]=qs['limit'](_0x54ad73['query'][_0xaac3('0x4b')]);_0x296e85['offset']=qs['offset'](_0x54ad73[_0xaac3('0x43')][_0xaac3('0x2d')]);}_0x296e85['order']=qs['sort'](_0x54ad73[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x296e85[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_['pick'](_0x54ad73['query'],_0x17714a[_0xaac3('0x45')]));_0x296e85[_0xaac3('0x4f')][_0xaac3('0x64')]=_0x57f8a4['id'];if(_0x54ad73['query']['filter']){_0x296e85[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x296e85[_0xaac3('0x4f')],{'$or':_['map'](_0x296e85[_0xaac3('0x49')],function(_0x31af19){var _0x47d47e={};_0x47d47e[_0x31af19]={'$like':'%'+_0x54ad73[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x47d47e;})});}_0x296e85=_[_0xaac3('0x50')]({},_0x296e85,_0x54ad73['options']);return db[_0xaac3('0x65')][_0xaac3('0x2c')]({'where':_0x296e85['where']})['then'](function(_0x50f41e){_0x57f72e['count']=_0x50f41e;if(_0x54ad73[_0xaac3('0x43')][_0xaac3('0x52')]){_0x296e85['include']=[{'all':!![]}];}return db[_0xaac3('0x65')][_0xaac3('0x54')](_0x296e85);})[_0xaac3('0x33')](function(_0x1fb303){_0x57f72e[_0xaac3('0x55')]=_0x1fb303;return _0x57f72e;});}})['then'](respondWithFilteredResult(_0x351157,_0x296e85))[_0xaac3('0x59')](handleError(_0x351157,null));};exports[_0xaac3('0x69')]=function(_0x2eb1f8,_0x50731f,_0x59be20){return db[_0xaac3('0x3e')]['find']({'where':{'id':_0x2eb1f8['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x50731f,null))['then'](function(_0x3163fd){if(_0x3163fd){return _0x3163fd['removeDispositions'](_0x2eb1f8[_0xaac3('0x43')][_0xaac3('0x6a')]);}})[_0xaac3('0x33')](respondWithStatusCode(_0x50731f,null))['catch'](handleError(_0x50731f,null));};exports['addAnswer']=function(_0xffb3be,_0x134bee,_0x1e0d7e){if(_0xffb3be[_0xaac3('0x62')]['id']){delete _0xffb3be[_0xaac3('0x62')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0xffb3be[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x134bee,null))[_0xaac3('0x33')](function(_0x4635d4){if(_0x4635d4){_0xffb3be[_0xaac3('0x62')][_0xaac3('0x64')]=_0x4635d4['id'];return db['CannedAnswer'][_0xaac3('0x5a')](_0xffb3be[_0xaac3('0x62')]);}})[_0xaac3('0x33')](respondWithResult(_0x134bee,null))[_0xaac3('0x59')](handleError(_0x134bee,null));};exports['getAnswers']=function(_0xe8e156,_0x2b85d3,_0x2b5f05){var _0x557c76={'raw':![],'where':{}};var _0x3621be={};var _0x5c4a31={'count':0x0,'rows':[]};return db[_0xaac3('0x3e')][_0xaac3('0x67')]({'where':{'id':_0xe8e156[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b85d3,null))[_0xaac3('0x33')](function(_0x15f147){if(_0x15f147){_0x3621be[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0x6b')][_0xaac3('0x3f')]);_0x3621be[_0xaac3('0x43')]=_['keys'](_0xe8e156[_0xaac3('0x43')]);_0x3621be[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x3621be[_0xaac3('0x47')],_0x3621be['query']);_0x557c76[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x3621be[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0xe8e156[_0xaac3('0x43')][_0xaac3('0x48')]));_0x557c76['attributes']=_0x557c76['attributes']['length']?_0x557c76[_0xaac3('0x49')]:_0x3621be[_0xaac3('0x47')];if(!_0xe8e156[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x557c76[_0xaac3('0x4b')]=qs['limit'](_0xe8e156[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x557c76[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0xe8e156[_0xaac3('0x43')]['offset']);}_0x557c76[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0xe8e156[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x557c76['where']=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0xe8e156[_0xaac3('0x43')],_0x3621be[_0xaac3('0x45')]));_0x557c76[_0xaac3('0x4f')]['ChatWebsiteId']=_0x15f147['id'];if(_0xe8e156['query'][_0xaac3('0x4e')]){_0x557c76[_0xaac3('0x4f')]=_['merge'](_0x557c76[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x557c76['attributes'],function(_0x1b9da6){var _0x5789e8={};_0x5789e8[_0x1b9da6]={'$like':'%'+_0xe8e156[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x5789e8;})});}_0x557c76=_[_0xaac3('0x50')]({},_0x557c76,_0xe8e156[_0xaac3('0x51')]);return db['CannedAnswer']['count']({'where':_0x557c76[_0xaac3('0x4f')]})[_0xaac3('0x33')](function(_0x545e82){_0x5c4a31[_0xaac3('0x2c')]=_0x545e82;if(_0xe8e156['query'][_0xaac3('0x52')]){_0x557c76['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xaac3('0x54')](_0x557c76);})['then'](function(_0xc5bb4){_0x5c4a31[_0xaac3('0x55')]=_0xc5bb4;return _0x5c4a31;});}})[_0xaac3('0x33')](respondWithFilteredResult(_0x2b85d3,_0x557c76))[_0xaac3('0x59')](handleError(_0x2b85d3,null));};exports['removeAnswers']=function(_0xf069f0,_0x508fde,_0x988ac0){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0xf069f0[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x508fde,null))[_0xaac3('0x33')](function(_0x3f04e8){if(_0x3f04e8){return _0x3f04e8[_0xaac3('0x6e')](_0xf069f0[_0xaac3('0x43')][_0xaac3('0x6a')]);}})[_0xaac3('0x33')](respondWithStatusCode(_0x508fde,null))[_0xaac3('0x59')](handleError(_0x508fde,null));};exports[_0xaac3('0x6f')]=function(_0x36e987,_0x79fc06,_0x1b794a){_0x36e987['body'][_0xaac3('0x70')]=_0x36e987[_0xaac3('0x71')][_0xaac3('0x72')];return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x36e987[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x79fc06,null))[_0xaac3('0x33')](saveUpdates(_0x36e987[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0x79fc06,null))[_0xaac3('0x59')](handleError(_0x79fc06,null));};exports[_0xaac3('0x73')]=function(_0xc41e19,_0x103633,_0x15dedc){_0xc41e19['body'][_0xaac3('0x74')]=_0xc41e19['file'][_0xaac3('0x72')];return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0xc41e19['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x103633,null))[_0xaac3('0x33')](saveUpdates(_0xc41e19[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0x103633,null))['catch'](handleError(_0x103633,null));};exports[_0xaac3('0x75')]=function(_0x418066,_0x3ffee1,_0x37d8f8){_0x418066[_0xaac3('0x62')]['customerAvatar']=_0x418066[_0xaac3('0x71')][_0xaac3('0x72')];return db[_0xaac3('0x3e')]['find']({'where':{'id':_0x418066['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x3ffee1,null))[_0xaac3('0x33')](saveUpdates(_0x418066['body'],null))['then'](respondWithResult(_0x3ffee1,null))[_0xaac3('0x59')](handleError(_0x3ffee1,null));};exports[_0xaac3('0x76')]=function(_0x188ca6,_0x11889b,_0x5a239d){_0x188ca6[_0xaac3('0x62')][_0xaac3('0x77')]=_0x188ca6[_0xaac3('0x71')][_0xaac3('0x72')];return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x188ca6[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x11889b,null))[_0xaac3('0x33')](saveUpdates(_0x188ca6[_0xaac3('0x62')],null))[_0xaac3('0x33')](respondWithResult(_0x11889b,null))[_0xaac3('0x59')](handleError(_0x11889b,null));};exports[_0xaac3('0x78')]=function(_0x4e3527,_0x4143d9,_0x1d2a99){var _0x2ed74f=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],'server/files/images/logos/default_logo.svg');var _0x1c84be={'where':{'id':_0x4e3527[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x70')],'raw':!![]};var _0x2d26f8=![];return require(_0xaac3('0x14'))['getLicense']()[_0xaac3('0x33')](function(_0x4022b7){if(_0x4022b7){_0x2d26f8=_0x4022b7[_0xaac3('0x7b')];}})[_0xaac3('0x33')](function(){return db[_0xaac3('0x3e')]['find'](_0x1c84be);})[_0xaac3('0x33')](handleEntityNotFound(_0x4143d9,null))[_0xaac3('0x33')](function(_0x1d62d0){if(_0x1d62d0){if(!_['isNil'](_0x1d62d0[_0xaac3('0x70')])){if(fs[_0xaac3('0x7c')](path[_0xaac3('0x79')](config['root'],_0xaac3('0x7d'),_0x1d62d0[_0xaac3('0x70')]))&&_0x2d26f8){_0x2ed74f=path[_0xaac3('0x79')](config['root'],_0xaac3('0x7d'),_0x1d62d0[_0xaac3('0x70')]);}}return _0x4143d9['download'](_0x2ed74f);}})[_0xaac3('0x59')](handleError(_0x4143d9,null));};exports[_0xaac3('0x7e')]=function(_0x5293eb,_0x43b197,_0x6db209){var _0x1a0c3a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x7f'));var _0x53136f={'where':{'id':_0x5293eb[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x74')],'raw':!![]};return db[_0xaac3('0x3e')][_0xaac3('0x58')](_0x53136f)[_0xaac3('0x33')](handleEntityNotFound(_0x43b197,null))[_0xaac3('0x33')](function(_0x1b6f3d){if(_0x1b6f3d){if(!_[_0xaac3('0x80')](_0x1b6f3d['agentAvatar'])){if(fs[_0xaac3('0x7c')](path[_0xaac3('0x79')](config['root'],_0xaac3('0x81'),_0x1b6f3d[_0xaac3('0x74')]))){_0x1a0c3a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x81'),_0x1b6f3d[_0xaac3('0x74')]);}}return _0x43b197['download'](_0x1a0c3a);}})[_0xaac3('0x59')](handleError(_0x43b197,null));};exports['getCustomerAvatar']=function(_0x3a04fa,_0x219aa3,_0x4a1c5c){var _0x21671a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x82'));var _0x1d34f9={'where':{'id':_0x3a04fa[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x83'),_0xaac3('0x84')],'raw':!![]};return db[_0xaac3('0x3e')][_0xaac3('0x58')](_0x1d34f9)['then'](handleEntityNotFound(_0x219aa3,null))['then'](function(_0x4fe484){if(_0x4fe484){if(!_['isNil'](_0x4fe484[_0xaac3('0x83')])){if(fs['existsSync'](path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x81'),_0x4fe484['customerAvatar']))&&_0x4fe484['showCustomerAvatar']){_0x21671a=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0x81'),_0x4fe484['customerAvatar']);}}return _0x219aa3[_0xaac3('0x85')](_0x21671a);}})[_0xaac3('0x59')](handleError(_0x219aa3,null));};exports[_0xaac3('0x86')]=function(_0x5d0337,_0x71fc00,_0x20a002){var _0x37e2d4=path[_0xaac3('0x79')](config['root'],_0xaac3('0x87'));var _0x52dea3={'where':{'id':_0x5d0337[_0xaac3('0x57')]['id']},'attributes':['id',_0xaac3('0x77')],'raw':!![]};return db['ChatWebsite'][_0xaac3('0x58')](_0x52dea3)[_0xaac3('0x33')](handleEntityNotFound(_0x71fc00,null))[_0xaac3('0x33')](function(_0x2f9de0){if(_0x2f9de0){if(!_['isNil'](_0x2f9de0['systemAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0xaac3('0x81'),_0x2f9de0['systemAvatar']))){_0x37e2d4=path[_0xaac3('0x79')](config[_0xaac3('0x7a')],'server/files/images/avatars/',_0x2f9de0['systemAvatar']);}}return _0x71fc00['download'](_0x37e2d4);}})[_0xaac3('0x59')](handleError(_0x71fc00,null));};exports[_0xaac3('0x88')]=function(_0x3d446b,_0x163951,_0x336ff7){var _0xbd0447=require(_0xaac3('0x89'));var _0x51d645=new _0xbd0447();var _0x544c8b=_0x51d645[_0xaac3('0x8a')](_0x3d446b[_0xaac3('0x8b')][_0xaac3('0x8c')])[_0xaac3('0x8d')]();var _0x2dac1c={'body':_0x3d446b['body'],'channel':_0xaac3('0x8e')};var _0x5dc062=[];var _0x12c0a7=[];var _0x5ea77a={};var _0x1bdc7a=![];return db[_0xaac3('0x8f')]['describe']()['then'](function(_0x1e5d09){if(!_0x1e5d09){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))]('no\x20available\x20attributes');}_0x5dc062=_['difference'](_[_0xaac3('0x44')](_0x1e5d09),['createdAt',_0xaac3('0x92')]);_0x12c0a7=_[_0xaac3('0x93')](_['keys'](_0x1e5d09),['createdAt',_0xaac3('0x92'),_0xaac3('0x94'),'ListId']);if(_0x3d446b['body']['id']){delete _0x3d446b[_0xaac3('0x62')]['id'];}if(_[_0xaac3('0x80')](_0x3d446b[_0xaac3('0x62')]['from'])){throw new db['Sequelize']['ValidationError'](_0xaac3('0x95'));}if(_[_0xaac3('0x80')](_0x3d446b[_0xaac3('0x62')][_0xaac3('0x62')])||_0x3d446b[_0xaac3('0x62')][_0xaac3('0x62')]===''){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))](_0xaac3('0x96'));}if(_['isNil'](_0x3d446b['body'][_0xaac3('0x97')])){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))](_0xaac3('0x98')+_0x12c0a7);}if(!_[_0xaac3('0x99')](_0x12c0a7,_0x3d446b[_0xaac3('0x62')][_0xaac3('0x97')])){throw new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))](_0xaac3('0x9a')+_0x12c0a7);}_0x5ea77a[_0x3d446b[_0xaac3('0x62')]['mapKey']]=_0x3d446b['body'][_0xaac3('0x9b')];})[_0xaac3('0x33')](function(){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x3d446b[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x9c')],'as':_0xaac3('0x9d'),'include':[{'model':db[_0xaac3('0x8f')],'as':'Contacts','where':_0x5ea77a,'limit':0x1,'order':[['updatedAt',_0xaac3('0x9e')]]}]},{'model':db[_0xaac3('0x9f')],'as':_0xaac3('0xa0')}]});})[_0xaac3('0x33')](handleEntityNotFound(_0x163951,null))['then'](function(_0x592063){if(_0x592063&&_0x592063[_0xaac3('0x9d')]){_0x2dac1c['account']=_0x592063;_0x2dac1c[_0xaac3('0xa1')]=_0x592063[_0xaac3('0xa0')];_0x2dac1c[_0xaac3('0xa2')]=_0x592063['List'];_0x2dac1c[_0xaac3('0xa1')]=_[_0xaac3('0xa3')](_0x2dac1c[_0xaac3('0xa1')],['priority'],[_0xaac3('0xa4')]);if(_0x2dac1c[_0xaac3('0xa5')][_0xaac3('0xa0')]){delete _0x2dac1c[_0xaac3('0xa5')][_0xaac3('0xa0')];}if(_0x2dac1c[_0xaac3('0xa5')][_0xaac3('0x9d')]&&_0x2dac1c['account'][_0xaac3('0x9d')][_0xaac3('0xa6')]['length']){return _0x2dac1c[_0xaac3('0xa5')][_0xaac3('0x9d')]['Contacts'][0x0];}var _0x37db57=_['defaults'](_0x3d446b[_0xaac3('0x62')],{'firstName':_0x3d446b[_0xaac3('0x62')][_0xaac3('0x9b')],'ListId':_0x592063['ListId']});_0x37db57[_0x3d446b[_0xaac3('0x62')]['mapKey']]=_0x3d446b[_0xaac3('0x62')][_0xaac3('0x9b')];return db[_0xaac3('0x8f')][_0xaac3('0x5a')](_0x37db57,{'fields':_0x5dc062,'raw':!![]});}})[_0xaac3('0x33')](handleEntityNotFound(_0x163951,null))[_0xaac3('0x33')](function(_0x24a84a){_0x2dac1c[_0xaac3('0xa7')]=_0x24a84a;var _0x8f4e95=_0x3d446b[_0xaac3('0x62')]['customerIp'];if(_0x3d446b[_0xaac3('0x8b')]['cf-connecting-ip']){_0x8f4e95=_0x3d446b[_0xaac3('0x8b')]['cf-connecting-ip'];}else if(_0x3d446b['headers']['x-forwarded-for']){_0x8f4e95=_['first'](_0x3d446b[_0xaac3('0x8b')]['x-forwarded-for'][_0xaac3('0xa8')](','));}if(_0x24a84a){var _0x1e54a5={'ContactId':_0x24a84a['id'],'ChatWebsiteId':_0x3d446b['params']['id'],'from':(_0x24a84a[_0xaac3('0xa9')]||'')+'\x20'+(_0x24a84a[_0xaac3('0xaa')]||''),'customerIp':_0x8f4e95,'customerPort':_0x3d446b[_0xaac3('0x8b')][_0xaac3('0xab')]?_0x3d446b[_0xaac3('0x8b')][_0xaac3('0xab')]:null,'referer':_0x3d446b['body'][_0xaac3('0xac')],'browserName':_0x544c8b[_0xaac3('0xad')]['name']&&_0x544c8b[_0xaac3('0xad')][_0xaac3('0xae')]?util[_0xaac3('0xaf')](_0xaac3('0xb0'),_0x544c8b[_0xaac3('0xad')]['name'],_0x544c8b[_0xaac3('0xad')][_0xaac3('0xae')]):'unknown','browserVersion':_0x544c8b[_0xaac3('0xad')][_0xaac3('0xae')]||'unknown','osName':util[_0xaac3('0xaf')](_0xaac3('0xb0'),_0x544c8b['os'][_0xaac3('0x38')],_0x544c8b['os'][_0xaac3('0xae')]),'osVersion':_0x544c8b['os'][_0xaac3('0xae')],'deviceModel':_0x544c8b['device'][_0xaac3('0x47')]&&_0x544c8b[_0xaac3('0xb1')][_0xaac3('0xb2')]?util[_0xaac3('0xaf')]('%s\x20%s\x20%s',_0x544c8b[_0xaac3('0xb1')]['model'],_0x544c8b[_0xaac3('0xb1')][_0xaac3('0xb2')],_0x544c8b[_0xaac3('0xb1')][_0xaac3('0x41')]):null,'deviceVendor':_0x544c8b[_0xaac3('0xb1')][_0xaac3('0xb2')],'deviceType':_0x544c8b[_0xaac3('0xb1')][_0xaac3('0x41')],'formData':JSON[_0xaac3('0xb3')](_0x3d446b['body'])};var _0x148a7f={'ChatWebsiteId':_0x3d446b[_0xaac3('0x57')]['id'],'closed':![]};if(_0x3d446b['body'][_0xaac3('0xb4')]){_0x148a7f[_0xaac3('0xb4')]=_0x3d446b['body'][_0xaac3('0xb4')];return db[_0xaac3('0xb5')][_0xaac3('0x58')]({'where':_0x148a7f})['then'](function(_0x224fef){if(_0x224fef){return[_0x224fef,![]];}_0x1e54a5[_0xaac3('0xb4')]=_0x3d446b['body'][_0xaac3('0xb4')];_0x1e54a5[_0xaac3('0xb6')]=_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb6')];return db[_0xaac3('0xb5')][_0xaac3('0x5a')](_0x1e54a5)[_0xaac3('0x33')](function(_0x10e7ad){return[_0x10e7ad,!![]];});});}_0x148a7f['ContactId']=_0x24a84a['id'];if(_0x3d446b['body'][_0xaac3('0xb7')]&&_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb7')]['id']){_0x148a7f['id']=_0x3d446b['body'][_0xaac3('0xb7')]['id'];return db[_0xaac3('0xb5')][_0xaac3('0x58')]({'where':_0x148a7f})[_0xaac3('0x33')](function(_0x452801){if(_0x452801){return[_0x452801,![]];}return db[_0xaac3('0xb5')]['create'](_0x1e54a5)[_0xaac3('0x33')](function(_0x185b5c){return[_0x185b5c,!![]];});});}return db[_0xaac3('0xb5')][_0xaac3('0x5a')](_0x1e54a5)[_0xaac3('0x33')](function(_0x48acf1){return[_0x48acf1,!![]];});}})[_0xaac3('0xb8')](function(_0x570c78,_0x4822f7){if(_0x570c78){_0x1bdc7a=_0x4822f7;if(!_0x4822f7){var _0xd5b5a={'from':(_0x2dac1c[_0xaac3('0xa7')][_0xaac3('0xa9')]||'')+'\x20'+(_0x2dac1c[_0xaac3('0xa7')]['lastName']||'')};if(_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb4')]&&_0x3d446b['body'][_0xaac3('0xb9')]&&_0x3d446b[_0xaac3('0x62')][_0xaac3('0xb4')]!=_0x3d446b['body'][_0xaac3('0xb9')]){_0xd5b5a[_0xaac3('0xb4')]=_0x3d446b['body'][_0xaac3('0xb9')];}return _0x570c78['update'](_0xd5b5a);}else{return _0x570c78;}}})[_0xaac3('0x33')](function(_0x3a3ce8){_0x2dac1c[_0xaac3('0xb7')]=_0x3a3ce8['get']({'plain':!![]});_0x2dac1c['interaction'][_0xaac3('0xba')]=_0x1bdc7a;if(_0x2dac1c['interaction'][_0xaac3('0xba')]){if(_0x2dac1c[_0xaac3('0xa5')]['autoclose']){_0x2dac1c['applications'][_0xaac3('0xbb')]({'id':0x0,'priority':_0x2dac1c[_0xaac3('0xa1')][_0xaac3('0x68')]+0x1,'app':_0xaac3('0xbc'),'appdata':_0xaac3('0xbd'),'interval':_0xaac3('0xbe')});}}return db[_0xaac3('0xbf')][_0xaac3('0x5a')]({'body':_0x3d446b[_0xaac3('0x62')][_0xaac3('0x62')],'ChatWebsiteId':_0x3d446b[_0xaac3('0x57')]['id'],'ChatInteractionId':_0x3a3ce8['id'],'direction':'in','ContactId':_0x2dac1c[_0xaac3('0xa7')]['id'],'AttachmentId':_0x3d446b[_0xaac3('0x62')][_0xaac3('0xc0')]});})[_0xaac3('0x33')](function(_0x16ff69){_0x2dac1c[_0xaac3('0x25')]=_0x16ff69;if(_0x2dac1c['interaction'][_0xaac3('0xc1')]){return db[_0xaac3('0xc2')][_0xaac3('0x58')]({'attributes':['id',_0xaac3('0x38')],'where':{'id':_0x2dac1c[_0xaac3('0xb7')]['UserId']}})[_0xaac3('0x33')](function(_0x5963ef){if(_0x5963ef){_0x2dac1c[_0xaac3('0xa1')][_0xaac3('0xc3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5963ef[_0xaac3('0x38')]+','+(_0x2dac1c[_0xaac3('0xa5')][_0xaac3('0xc4')]||0xa),'interval':_0xaac3('0xbe')});_0x2dac1c['forcedOwnership']=!![];}return respondWithRpcPromise(_0xaac3('0xc5'),_0xaac3('0xc6'),_0x2dac1c);});}return respondWithRpcPromise('Start',_0xaac3('0xc6'),_0x2dac1c);})[_0xaac3('0x33')](function(_0x23738b){respondWithRpcPromise(_0xaac3('0xc7'),_0xaac3('0xc7'),{'event':_0xaac3('0x88'),'message':_0x23738b},client9002);return _0x23738b;})['then'](respondWithResult(_0x163951,null))[_0xaac3('0x59')](handleError(_0x163951,null));};exports[_0xaac3('0xc8')]=function(_0x487b2a,_0x2f8f0b,_0x4bcd05){var _0x308b7a,_0x5256e7,_0xef623e;var _0x4e64fd=[];var _0x3c3d23=[];var _0x68eeff={};return db[_0xaac3('0x8f')][_0xaac3('0x63')]()['then'](function(_0x4f0076){if(!_0x4f0076){throw new db['Sequelize']['ValidationError'](_0xaac3('0xc9'));}_0x3c3d23=_[_0xaac3('0x93')](_[_0xaac3('0x44')](_0x4f0076),[_0xaac3('0xca'),_0xaac3('0x92')]);_0x4e64fd=_[_0xaac3('0x93')](_[_0xaac3('0x44')](_0x4f0076),[_0xaac3('0xca'),_0xaac3('0x92'),'CompanyId',_0xaac3('0xcb')]);if(_0x487b2a[_0xaac3('0x62')]['id']){delete _0x487b2a[_0xaac3('0x62')]['id'];}if(_[_0xaac3('0x80')](_0x487b2a['body'][_0xaac3('0x9b')])){throw _0x2f8f0b[_0xaac3('0x29')](0x1f4)[_0xaac3('0x39')](new db[(_0xaac3('0x90'))]['ValidationError'](_0xaac3('0x95')));}if(_[_0xaac3('0x80')](_0x487b2a[_0xaac3('0x62')]['body'])||_0x487b2a[_0xaac3('0x62')][_0xaac3('0x62')]===''){throw _0x2f8f0b['status'](0x1f4)[_0xaac3('0x39')](new db[(_0xaac3('0x90'))][(_0xaac3('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x487b2a[_0xaac3('0x62')]['mapKeyOffline'])){throw _0x2f8f0b[_0xaac3('0x29')](0x1f4)[_0xaac3('0x39')](new db['Sequelize']['ValidationError'](_0xaac3('0xcc')+_0x4e64fd));}if(!_[_0xaac3('0x99')](_0x4e64fd,_0x487b2a['body'][_0xaac3('0xcd')])){throw _0x2f8f0b[_0xaac3('0x29')](0x1f4)[_0xaac3('0x39')](new db[(_0xaac3('0x90'))]['ValidationError'](_0xaac3('0xce')+_0x4e64fd));}_0x68eeff[_0x487b2a[_0xaac3('0x62')]['mapKeyOffline']]=_0x487b2a['body'][_0xaac3('0x9b')];})['then'](function(){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x487b2a[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0x9c')],'as':'List'}]});})['then'](handleEntityNotFound(_0x2f8f0b,null))[_0xaac3('0x33')](function(_0x1df3a9){if(_0x1df3a9&&_0x1df3a9[_0xaac3('0x9d')]){_0x5256e7=_0x1df3a9;var _0x5c0295=_[_0xaac3('0x17')](_0x487b2a[_0xaac3('0x62')],{'firstName':_0x487b2a[_0xaac3('0x62')][_0xaac3('0x9b')],'phone':_0x487b2a['body'][_0xaac3('0x9b')],'ListId':_0x1df3a9['ListId']});_0x5c0295[_0x487b2a[_0xaac3('0x62')][_0xaac3('0xcd')]]=_0x487b2a[_0xaac3('0x62')]['from'];return db[_0xaac3('0x8f')][_0xaac3('0xcf')]({'where':_0x68eeff,'defaults':_0x5c0295});}})[_0xaac3('0xb8')](function(_0x357d08){if(_0x357d08){_0xef623e=_0x357d08;var _0xa1b1d2=fs['readFileSync'](path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0xd0')),'utf8');var _0x50e467=ejs[_0xaac3('0xd1')](_0xa1b1d2,{'body':_[_0xaac3('0xd2')](_0x487b2a[_0xaac3('0x62')]['body']),'bodyTitle':_0x5256e7[_0xaac3('0xd3')]});return db['ChatOfflineMessage'][_0xaac3('0x5a')]({'body':_0x50e467,'ContactId':_0x357d08['id'],'ChatWebsiteId':_0x5256e7['id']});}})['then'](function(_0x4f7309){if(_0x4f7309){_0x308b7a=_0x4f7309;return db[_0xaac3('0xd4')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x5cdcfb){if(_0x5cdcfb&&_0x5cdcfb[_0xaac3('0xd5')]&&_0x5256e7[_0xaac3('0xd6')]){var _0x1f959d={'tls':{'rejectUnauthorized':![]}};if(_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xd7')]){_0x1f959d['service']=_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xd7')];}else{_0x1f959d[_0xaac3('0xd8')]=_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xd8')];_0x1f959d[_0xaac3('0xd9')]=_0x5cdcfb[_0xaac3('0xd5')]['port'];_0x1f959d[_0xaac3('0xda')]=_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xda')];}if(_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0xdb')]){_0x1f959d[_0xaac3('0xdc')]={'user':_0x5cdcfb[_0xaac3('0xd5')][_0xaac3('0x5d')],'pass':_0x5cdcfb['Smtp'][_0xaac3('0xdd')]};}return respondWithRpcPromise('SendMail',_0xaac3('0xde'),{'account':_0x1f959d,'message':{'from':util[_0xaac3('0xaf')](_0xaac3('0xdf'),_0x5cdcfb[_0xaac3('0x38')],_0x5cdcfb[_0xaac3('0xe0')]||_0x5cdcfb[_0xaac3('0xd5')]['user']),'to':_0x5256e7['forwardOfflineAddress'],'subject':_0x5256e7[_0xaac3('0xe1')],'text':_0x308b7a[_0xaac3('0x62')]}},client9003)[_0xaac3('0x33')](function(){return _0x308b7a;})[_0xaac3('0x59')](function(_0x254bd6){console[_0xaac3('0x23')](_0x254bd6);});}})[_0xaac3('0x33')](function(){if(_0x308b7a){return _0x308b7a;}})[_0xaac3('0x33')](respondWithResult(_0x2f8f0b,null))[_0xaac3('0x59')](handleError(_0x2f8f0b,null));};exports[_0xaac3('0xe2')]=function(_0x53dbac,_0x26e18d,_0x5e14bf){return db[_0xaac3('0xb5')]['find']({'where':{'id':_0x53dbac[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x26e18d,null))['then'](function(_0x19e985){if(_0x19e985){return _0x19e985[_0xaac3('0xe2')](_0x53dbac[_0xaac3('0x62')][_0xaac3('0x6a')],_['omit'](_0x53dbac[_0xaac3('0x62')],[_0xaac3('0x6a'),'id'])||{});}})[_0xaac3('0x33')](respondWithResult(_0x26e18d,null))['catch'](handleError(_0x26e18d,null));};exports[_0xaac3('0xe3')]=function(_0x284b25,_0x48b9d1,_0x336fd0){var _0x1aed43={'raw':![],'where':{}};var _0x386918={};var _0x14804a={'count':0x0,'rows':[]};return db[_0xaac3('0x3e')]['findOne']({'where':{'id':_0x284b25[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x48b9d1,null))[_0xaac3('0x33')](function(_0x884796){if(_0x884796){_0x386918[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0xb5')]['rawAttributes']);_0x386918['query']=_[_0xaac3('0x44')](_0x284b25['query']);_0x386918[_0xaac3('0x45')]=_['intersection'](_0x386918[_0xaac3('0x47')],_0x386918[_0xaac3('0x43')]);_0x1aed43['attributes']=_['intersection'](_0x386918[_0xaac3('0x47')],qs['fields'](_0x284b25[_0xaac3('0x43')]['fields']));_0x1aed43[_0xaac3('0x49')]=_0x1aed43[_0xaac3('0x49')]['length']?_0x1aed43[_0xaac3('0x49')]:_0x386918[_0xaac3('0x47')];if(!_0x284b25[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x1aed43['limit']=qs[_0xaac3('0x4b')](_0x284b25['query'][_0xaac3('0x4b')]);_0x1aed43['offset']=qs[_0xaac3('0x2d')](_0x284b25[_0xaac3('0x43')]['offset']);}_0x1aed43['order']=qs[_0xaac3('0x4d')](_0x284b25[_0xaac3('0x43')]['sort']);_0x1aed43['where']=qs[_0xaac3('0x45')](_['pick'](_0x284b25[_0xaac3('0x43')],_0x386918[_0xaac3('0x45')]));_0x1aed43[_0xaac3('0x4f')][_0xaac3('0x64')]=_0x884796['id'];if(_0x284b25[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x1aed43[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x1aed43['where'],{'$or':_['map'](_0x1aed43[_0xaac3('0x49')],function(_0x49f69e){var _0x358580={};_0x358580[_0x49f69e]={'$like':'%'+_0x284b25[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x358580;})});}_0x1aed43=_['merge']({},_0x1aed43,_0x284b25[_0xaac3('0x51')]);return db[_0xaac3('0xb5')][_0xaac3('0x2c')]({'where':_0x1aed43[_0xaac3('0x4f')]})[_0xaac3('0x33')](function(_0x4cb68d){_0x14804a[_0xaac3('0x2c')]=_0x4cb68d;if(_0x284b25[_0xaac3('0x43')][_0xaac3('0x52')]){_0x1aed43[_0xaac3('0x53')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xaac3('0xc2')],'as':_0xaac3('0xe4'),'attributes':['name',_0xaac3('0xe5'),_0xaac3('0xe6')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaac3('0x38'),'color'],'where':_0x284b25['query'][_0xaac3('0xe7')]?{'id':_0x284b25[_0xaac3('0x43')][_0xaac3('0xe7')]}:undefined,'required':_0x284b25[_0xaac3('0x43')]['tag']?!![]:![]}];}return db[_0xaac3('0xb5')][_0xaac3('0x54')](_0x1aed43);})[_0xaac3('0x33')](function(_0x399849){_0x14804a[_0xaac3('0x55')]=_0x399849;return _0x14804a;});}})[_0xaac3('0x33')](respondWithFilteredResult(_0x48b9d1,_0x1aed43))[_0xaac3('0x59')](handleError(_0x48b9d1,null));};function iftimePromise(_0x2e9799,_0x59d444){return respondWithRpcPromise('Command',_0xaac3('0xe8'),{'command':_0x59d444[_0xaac3('0xe9')]?util[_0xaac3('0xaf')](_0xaac3('0xea'),_0x2e9799[_0xaac3('0xeb')],_0x59d444[_0xaac3('0xe9')]):util[_0xaac3('0xaf')]('iftime\x20%s',_0x2e9799[_0xaac3('0xeb')])},client9002)[_0xaac3('0x33')](function(_0x457da3){var _0x581c54=_0x457da3&&_0x457da3[_0xaac3('0xec')](_0xaac3('0xed'))>=0x0?!![]:![];logger[_0xaac3('0x26')](_0xaac3('0xee'),_0x59d444['id'],_0x2e9799['id'],_0x2e9799['interval'],_0x581c54?_0xaac3('0xef'):_0xaac3('0xf0'),_0x59d444[_0xaac3('0xe9')]?_0x59d444['timezone']:_0xaac3('0xf1'));return _0x581c54;})[_0xaac3('0x59')](function(_0x37521e){logger[_0xaac3('0x23')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x59d444['id'],_0x2e9799['id'],_0x2e9799[_0xaac3('0xeb')],util[_0xaac3('0xf2')](_0x37521e,{'showHidden':![],'depth':null}),_0x59d444[_0xaac3('0xe9')]?_0x59d444[_0xaac3('0xe9')]:_0xaac3('0xf1'));return![];});}exports['getSnippet']=function(_0x19d597,_0x2bb4e4,_0x52b6c3){var _0x444baa=0x0;var _0x54bada=0x0;var _0x2b72e8=![];var _0x540196;var _0x69b9b9;return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x19d597[_0xaac3('0x57')]['id']},'include':[{'model':db[_0xaac3('0xf3')],'as':_0xaac3('0xf3'),'include':[{'model':db[_0xaac3('0xf3')],'as':_0xaac3('0xf4'),'attributes':['id',_0xaac3('0xeb')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2bb4e4,null))['then'](function(_0x15e10b){if(_0x15e10b){_0x540196=_0x15e10b;return _0x15e10b[_0xaac3('0xf5')]({'raw':!![]});}})[_0xaac3('0x33')](function(_0x4517a9){if(_0x540196){if(_0x4517a9){_0x69b9b9=_0x4517a9;}}return require(_0xaac3('0x14'))[_0xaac3('0xf6')]();})[_0xaac3('0x33')](function(_0x524917){if(_0x524917){_0x54bada=_0x524917[_0xaac3('0xf7')];_0x2b72e8=_0x524917[_0xaac3('0x7b')];}})[_0xaac3('0x33')](function(){return db[_0xaac3('0xb5')][_0xaac3('0x2c')]({'where':{'closed':![]}});})[_0xaac3('0x33')](function(_0x5256db){_0x444baa=_0x5256db;if(_0x54bada&&_0x5256db>_0x54bada){return db['License']['findOne']({'where':{'id':0x1}})[_0xaac3('0x33')](function(_0x79bfb9){if(_0x79bfb9){_0x79bfb9[_0xaac3('0xf8')](_0xaac3('0xf9'));}});}})[_0xaac3('0x33')](function(){if(_0x540196[_0xaac3('0xf3')]&&_0x540196[_0xaac3('0xf3')][_0xaac3('0xf4')]){var _0x591f1c=[];for(var _0x53c74d=0x0;_0x53c74d<_0x540196[_0xaac3('0xf3')][_0xaac3('0xf4')][_0xaac3('0x68')];_0x53c74d++){var _0x4ab979=_0x540196[_0xaac3('0xf3')]['Intervals'][_0x53c74d]['get']({'plain':!![]});_0x591f1c[_0xaac3('0xbb')](iftimePromise(_0x4ab979,_0x540196));}return BPromise[_0xaac3('0xfa')](_0x591f1c)[_0xaac3('0x33')](function(_0x3a1119){return _[_0xaac3('0xfb')](_0x3a1119);});}else{return!![];}})[_0xaac3('0x33')](function(_0x120b71){var _0x1ec7a1=fs[_0xaac3('0xfc')](path[_0xaac3('0x79')](config[_0xaac3('0x7a')],_0xaac3('0xfd')),_0xaac3('0xfe'));var _0x38cf20={'remote':_0x540196[_0xaac3('0xff')],'query':querystring[_0xaac3('0xb3')](_[_0xaac3('0x50')](_0x540196[_0xaac3('0x34')]({'plain':!![]}),{'customerIp':_0x19d597['headers'][_0xaac3('0x100')]||_0x19d597[_0xaac3('0x8b')][_0xaac3('0x101')]||_0x19d597[_0xaac3('0x102')][_0xaac3('0x103')]||_0x19d597['ip'],'referer':_0x19d597[_0xaac3('0x8b')][_0xaac3('0xac')],'openedInteractions':_0x444baa,'maxInteractions':_0x54bada,'virtual':_0x2b72e8[_0xaac3('0xf7')],'online':_0x120b71,'custom':_0x2b72e8}))[_0xaac3('0x104')](/'/g,'\x5c\x27')};_0x2bb4e4['send'](ejs[_0xaac3('0xd1')](Mustache[_0xaac3('0xd1')](_0x1ec7a1,_0x38cf20),{'proactiveActions':_0x69b9b9,'alignment':_0x540196[_0xaac3('0x105')],'verticalAlignment':_0x540196[_0xaac3('0x106')],'div_color':_0x540196[_0xaac3('0x107')],'text_color':_0x540196[_0xaac3('0x108')]}));})[_0xaac3('0x59')](handleError(_0x2bb4e4,null));};exports['addApplications']=function(_0x3acbc9,_0x5e159a,_0x7a0020){return db[_0xaac3('0x3e')]['findOne']({'where':{'id':_0x3acbc9[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e159a,null))[_0xaac3('0x33')](function(_0x1724b2){if(_0x1724b2){return db['sequelize']['transaction'](function(_0x464d8b){return db[_0xaac3('0x9f')][_0xaac3('0x37')]({'where':{'ChatWebsiteId':_0x3acbc9[_0xaac3('0x57')]['id']},'transaction':_0x464d8b})[_0xaac3('0x33')](function(_0xcf2172){var _0x2f0331=_[_0xaac3('0x3d')](_0x3acbc9[_0xaac3('0x62')],function(_0x27911c){_0x27911c[_0xaac3('0x64')]=_0x3acbc9['params']['id'];return _0x27911c;});return db[_0xaac3('0x9f')][_0xaac3('0x109')](_0x2f0331,{'transaction':_0x464d8b});});})[_0xaac3('0x33')](function(){return db['ChatApplication'][_0xaac3('0x10a')]({'where':{'ChatWebsiteId':_0x3acbc9['params']['id']},'order':'priority'});});}})[_0xaac3('0x33')](respondWithResult(_0x5e159a,null))[_0xaac3('0x59')](handleError(_0x5e159a,null));};exports[_0xaac3('0x10b')]=function(_0x4b297a,_0x56fb32,_0x550ad7){var _0x576529={};var _0x7a08b4={};var _0x5dfcf7;var _0x57e189;return db[_0xaac3('0x3e')][_0xaac3('0x67')]({'where':{'id':_0x4b297a[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x56fb32,null))[_0xaac3('0x33')](function(_0x1c4f24){if(_0x1c4f24){_0x5dfcf7=_0x1c4f24;_0x7a08b4[_0xaac3('0x47')]=_['keys'](db[_0xaac3('0x9f')]['rawAttributes']);_0x7a08b4[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x4b297a['query']);_0x7a08b4[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x7a08b4[_0xaac3('0x47')],_0x7a08b4['query']);_0x576529[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x7a08b4['model'],qs[_0xaac3('0x48')](_0x4b297a[_0xaac3('0x43')][_0xaac3('0x48')]));_0x576529[_0xaac3('0x49')]=_0x576529[_0xaac3('0x49')]['length']?_0x576529[_0xaac3('0x49')]:_0x7a08b4[_0xaac3('0x47')];_0x576529[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0x4b297a['query'][_0xaac3('0x4d')]);_0x576529[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0x4b297a[_0xaac3('0x43')],_0x7a08b4[_0xaac3('0x45')]));if(_0x4b297a[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x576529[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x576529[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x576529[_0xaac3('0x49')],function(_0x185204){var _0xca3ff9={};_0xca3ff9[_0x185204]={'$like':'%'+_0x4b297a['query']['filter']+'%'};return _0xca3ff9;})});}_0x576529=_[_0xaac3('0x50')]({},_0x576529,_0x4b297a[_0xaac3('0x51')]);return _0x5dfcf7[_0xaac3('0x10b')](_0x576529);}})[_0xaac3('0x33')](function(_0x3a448f){if(_0x3a448f){_0x57e189=_0x3a448f[_0xaac3('0x68')];if(!_0x4b297a[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x576529['limit']=qs[_0xaac3('0x4b')](_0x4b297a['query'][_0xaac3('0x4b')]);_0x576529[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x4b297a[_0xaac3('0x43')][_0xaac3('0x2d')]);}return _0x5dfcf7[_0xaac3('0x10b')](_0x576529);}})[_0xaac3('0x33')](function(_0x43b0f8){if(_0x43b0f8){return _0x43b0f8?{'count':_0x57e189,'rows':_0x43b0f8}:null;}})[_0xaac3('0x33')](respondWithResult(_0x56fb32,null))[_0xaac3('0x59')](handleError(_0x56fb32,null));};exports['addProactiveActions']=function(_0x6b05cc,_0x426d96,_0x4a7ed0){return db[_0xaac3('0x10c')][_0xaac3('0x58')]({'where':{'id':_0x6b05cc['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x426d96,null))['then'](function(_0x4ce68d){if(_0x4ce68d){return _0x4ce68d['addProactiveActions'](_0x6b05cc['body'][_0xaac3('0x6a')],_[_0xaac3('0x10d')](_0x6b05cc[_0xaac3('0x62')],['ids','id'])||{});}})['then'](respondWithResult(_0x426d96,null))[_0xaac3('0x59')](handleError(_0x426d96,null));};exports[_0xaac3('0xf5')]=function(_0x512a22,_0x287f14,_0x5f4306){var _0x54c1a2={};var _0x351390={};var _0x3578f9;var _0x58e306;return db['ChatWebsite'][_0xaac3('0x67')]({'where':{'id':_0x512a22[_0xaac3('0x57')]['id']}})['then'](handleEntityNotFound(_0x287f14,null))['then'](function(_0x2420a6){if(_0x2420a6){_0x3578f9=_0x2420a6;_0x351390[_0xaac3('0x47')]=_[_0xaac3('0x44')](db[_0xaac3('0x10e')]['rawAttributes']);_0x351390[_0xaac3('0x43')]=_[_0xaac3('0x44')](_0x512a22['query']);_0x351390[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x351390['model'],_0x351390[_0xaac3('0x43')]);_0x54c1a2['attributes']=_['intersection'](_0x351390[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x512a22[_0xaac3('0x43')][_0xaac3('0x48')]));_0x54c1a2[_0xaac3('0x49')]=_0x54c1a2[_0xaac3('0x49')][_0xaac3('0x68')]?_0x54c1a2[_0xaac3('0x49')]:_0x351390[_0xaac3('0x47')];_0x54c1a2[_0xaac3('0x4c')]=qs[_0xaac3('0x4d')](_0x512a22[_0xaac3('0x43')]['sort']);_0x54c1a2[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0x512a22[_0xaac3('0x43')],_0x351390[_0xaac3('0x45')]));if(_0x512a22['query'][_0xaac3('0x4e')]){_0x54c1a2[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x54c1a2[_0xaac3('0x4f')],{'$or':_[_0xaac3('0x3d')](_0x54c1a2[_0xaac3('0x49')],function(_0x1801c4){var _0x127380={};_0x127380[_0x1801c4]={'$like':'%'+_0x512a22[_0xaac3('0x43')][_0xaac3('0x4e')]+'%'};return _0x127380;})});}_0x54c1a2=_['merge']({},_0x54c1a2,_0x512a22['options']);return _0x3578f9[_0xaac3('0xf5')](_0x54c1a2);}})[_0xaac3('0x33')](function(_0x1db78f){if(_0x1db78f){_0x58e306=_0x1db78f['length'];if(!_0x512a22['query']['hasOwnProperty'](_0xaac3('0x4a'))){_0x54c1a2[_0xaac3('0x4b')]=qs[_0xaac3('0x4b')](_0x512a22['query'][_0xaac3('0x4b')]);_0x54c1a2[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x512a22[_0xaac3('0x43')][_0xaac3('0x2d')]);}return _0x3578f9['getProactiveActions'](_0x54c1a2);}})[_0xaac3('0x33')](function(_0x4108d3){if(_0x4108d3){return _0x4108d3?{'count':_0x58e306,'rows':_0x4108d3}:null;}})['then'](respondWithResult(_0x287f14,null))[_0xaac3('0x59')](handleError(_0x287f14,null));};exports[_0xaac3('0x10f')]=function(_0x5c26e6,_0x28b732,_0x5092ae){var _0x1bde76=_0x5c26e6[_0xaac3('0x43')][_0xaac3('0x110')]===_0xaac3('0x111')?_0xaac3('0x112'):_0xaac3('0x113');return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'attributes':['id',_0x1bde76],'where':{'id':_0x5c26e6[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x28b732,null))[_0xaac3('0x33')](function(_0x4a4068){if(_0x4a4068){var _0x3af2ad=_0x4a4068[_0x1bde76];var _0x57c843=_0x3af2ad&&_0x3af2ad[_0xaac3('0x114')]?_0x3af2ad['items']:[];_0x28b732[_0xaac3('0x39')]({'fromKey':_[_0xaac3('0x80')](_0x3af2ad[_0xaac3('0x115')])?undefined:_0x3af2ad[_0xaac3('0x115')],'count':_0x57c843[_0xaac3('0x68')],'rows':_0x57c843});}})[_0xaac3('0x59')](handleError(_0x28b732,null));};exports[_0xaac3('0x116')]=function(_0x1cae3d,_0x1957cb,_0x5284fd){var _0x173da8={'raw':![],'where':{}};var _0x40352f={};var _0x56c14e={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1cae3d['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x1957cb,null))[_0xaac3('0x33')](function(_0xb9d16d){if(_0xb9d16d){_0x40352f[_0xaac3('0x47')]=_['keys'](db[_0xaac3('0x117')][_0xaac3('0x3f')]);_0x40352f[_0xaac3('0x43')]=_['keys'](_0x1cae3d[_0xaac3('0x43')]);_0x40352f[_0xaac3('0x45')]=_[_0xaac3('0x46')](_0x40352f[_0xaac3('0x47')],_0x40352f[_0xaac3('0x43')]);_0x173da8[_0xaac3('0x49')]=_['intersection'](_0x40352f[_0xaac3('0x47')],qs[_0xaac3('0x48')](_0x1cae3d[_0xaac3('0x43')]['fields']));_0x173da8[_0xaac3('0x49')]=_0x173da8[_0xaac3('0x49')]['length']?_0x173da8['attributes']:_0x40352f[_0xaac3('0x47')];if(!_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x6c')]('nolimit')){_0x173da8['limit']=qs[_0xaac3('0x4b')](_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x173da8[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x2d')]);}_0x173da8['order']=qs[_0xaac3('0x4d')](_0x1cae3d['query'][_0xaac3('0x4d')]);_0x173da8[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_[_0xaac3('0x6d')](_0x1cae3d['query'],_0x40352f[_0xaac3('0x45')]));_0x173da8[_0xaac3('0x4f')][_0xaac3('0x64')]=_0xb9d16d['id'];if(_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x173da8[_0xaac3('0x4f')]=_[_0xaac3('0x50')](_0x173da8[_0xaac3('0x4f')],{'$or':_['map'](_0x173da8['attributes'],function(_0x4cb8c8){var _0x3674cf={};_0x3674cf[_0x4cb8c8]={'$like':'%'+_0x1cae3d['query']['filter']+'%'};return _0x3674cf;})});}_0x173da8=_[_0xaac3('0x50')]({},_0x173da8,_0x1cae3d[_0xaac3('0x51')]);return db[_0xaac3('0x117')]['count']({'where':_0x173da8['where']})['then'](function(_0x54e186){_0x56c14e[_0xaac3('0x2c')]=_0x54e186;if(_0x1cae3d[_0xaac3('0x43')][_0xaac3('0x52')]){_0x173da8[_0xaac3('0x53')]=[{'all':!![]}];}else{_0x173da8[_0xaac3('0x53')]=[{'model':db[_0xaac3('0x8f')],'as':_0xaac3('0x118'),'required':![]}];}return db[_0xaac3('0x117')]['findAll'](_0x173da8);})['then'](function(_0x91e30e){_0x56c14e['rows']=_0x91e30e;return _0x56c14e;});}})[_0xaac3('0x33')](respondWithFilteredResult(_0x1957cb,_0x173da8))[_0xaac3('0x59')](handleError(_0x1957cb,null));};exports['addAgents']=function(_0x49300f,_0x27eaff,_0x1f7aee){return db[_0xaac3('0x3e')]['find']({'where':{'id':_0x49300f['params']['id']}})['then'](handleEntityNotFound(_0x27eaff,null))[_0xaac3('0x33')](function(_0x327115){if(_0x327115){return _0x327115[_0xaac3('0x119')](_0x49300f[_0xaac3('0x62')][_0xaac3('0x6a')],_[_0xaac3('0x10d')](_0x49300f['body'],[_0xaac3('0x6a'),'id'])||{})[_0xaac3('0xb8')](function(_0x3182fc){for(var _0x584701=0x0;_0x584701<_0x49300f[_0xaac3('0x62')]['ids'][_0xaac3('0x68')];_0x584701+=0x1){socket['emit'](_0xaac3('0x11a'),{'UserId':_0x49300f[_0xaac3('0x62')][_0xaac3('0x6a')][_0x584701],'ChatWebsiteId':_0x49300f[_0xaac3('0x57')]['id']});}return _0x3182fc;});}})['then'](respondWithResult(_0x27eaff,null))['catch'](handleError(_0x27eaff,null));};exports[_0xaac3('0x11b')]=function(_0x49ca7c,_0x45c707,_0x269fb9){return db[_0xaac3('0x3e')][_0xaac3('0x58')]({'where':{'id':_0x49ca7c['params']['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x45c707,null))[_0xaac3('0x33')](function(_0x5d705a){if(_0x5d705a){return _0x5d705a[_0xaac3('0x11b')](_0x49ca7c['query']['ids'])[_0xaac3('0x33')](function(){if(_[_0xaac3('0x11c')](_0x49ca7c[_0xaac3('0x43')][_0xaac3('0x6a')])){for(var _0xf85909=0x0;_0xf85909<_0x49ca7c[_0xaac3('0x43')]['ids'][_0xaac3('0x68')];_0xf85909+=0x1){socket[_0xaac3('0x11d')](_0xaac3('0x11e'),{'UserId':Number(_0x49ca7c[_0xaac3('0x43')][_0xaac3('0x6a')][_0xf85909]),'ChatWebsiteId':Number(_0x49ca7c[_0xaac3('0x57')]['id'])});}}else{socket['emit'](_0xaac3('0x11e'),{'UserId':Number(_0x49ca7c['query'][_0xaac3('0x6a')]),'ChatWebsiteId':Number(_0x49ca7c[_0xaac3('0x57')]['id'])});}});}})[_0xaac3('0x33')](respondWithStatusCode(_0x45c707,null))[_0xaac3('0x59')](handleError(_0x45c707,null));};exports[_0xaac3('0x11f')]=function(_0x4d51a8,_0x5656ef,_0x321217){var _0x58fca8={};var _0x3d47f2={};var _0x4aab5c;var _0x53050c;return db[_0xaac3('0x3e')][_0xaac3('0x67')]({'where':{'id':_0x4d51a8[_0xaac3('0x57')]['id']}})[_0xaac3('0x33')](handleEntityNotFound(_0x5656ef,null))['then'](function(_0x3c71d9){if(_0x3c71d9){_0x4aab5c=_0x3c71d9;_0x3d47f2[_0xaac3('0x47')]=_[_0xaac3('0x44')](db['User'][_0xaac3('0x3f')]);_0x3d47f2['query']=_[_0xaac3('0x44')](_0x4d51a8[_0xaac3('0x43')]);_0x3d47f2[_0xaac3('0x45')]=_['intersection'](_0x3d47f2[_0xaac3('0x47')],_0x3d47f2['query']);_0x58fca8[_0xaac3('0x49')]=_[_0xaac3('0x46')](_0x3d47f2[_0xaac3('0x47')],qs['fields'](_0x4d51a8[_0xaac3('0x43')]['fields']));_0x58fca8[_0xaac3('0x49')]=_0x58fca8[_0xaac3('0x49')]['length']?_0x58fca8['attributes']:_0x3d47f2[_0xaac3('0x47')];_0x58fca8['order']=qs[_0xaac3('0x4d')](_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x4d')]);_0x58fca8[_0xaac3('0x4f')]=qs[_0xaac3('0x45')](_['pick'](_0x4d51a8[_0xaac3('0x43')],_0x3d47f2['filters']));if(_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x4e')]){_0x58fca8[_0xaac3('0x4f')]=_['merge'](_0x58fca8[_0xaac3('0x4f')],{'$or':_['map'](_0x58fca8[_0xaac3('0x49')],function(_0x184814){var _0x192923={};_0x192923[_0x184814]={'$like':'%'+_0x4d51a8['query'][_0xaac3('0x4e')]+'%'};return _0x192923;})});}_0x58fca8=_[_0xaac3('0x50')]({},_0x58fca8,_0x4d51a8[_0xaac3('0x51')]);return _0x4aab5c['getAgents'](_0x58fca8);}})['then'](function(_0x365006){if(_0x365006){_0x53050c=_0x365006[_0xaac3('0x68')];if(!_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x6c')](_0xaac3('0x4a'))){_0x58fca8[_0xaac3('0x4b')]=qs[_0xaac3('0x4b')](_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x4b')]);_0x58fca8[_0xaac3('0x2d')]=qs[_0xaac3('0x2d')](_0x4d51a8[_0xaac3('0x43')][_0xaac3('0x2d')]);}return _0x4aab5c['getAgents'](_0x58fca8);}})[_0xaac3('0x33')](function(_0x4c7773){if(_0x4c7773){return _0x4c7773?{'count':_0x53050c,'rows':_0x4c7773}:null;}})['then'](respondWithResult(_0x5656ef,null))['catch'](handleError(_0x5656ef,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3b60342..38e7ef5 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 _0xc694=['ChatWebsite','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xc694,0x11e));var _0x4c69=function(_0x47fd17,_0x4f7037){_0x47fd17=_0x47fd17-0x0;var _0x353a4b=_0xc694[_0x47fd17];return _0x353a4b;};'use strict';var EventEmitter=require(_0x4c69('0x0'));var ChatWebsite=require(_0x4c69('0x1'))['db'][_0x4c69('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c69('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1f26a1){return function(_0x32ea21,_0x479bf8,_0x18ab56){ChatWebsiteEvents[_0x4c69('0x4')](_0x1f26a1+':'+_0x32ea21['id'],_0x32ea21);ChatWebsiteEvents[_0x4c69('0x4')](_0x1f26a1,_0x32ea21);_0x18ab56(null);};}for(var e in events){if(events[_0x4c69('0x5')](e)){var event=events[e];ChatWebsite[_0x4c69('0x6')](e,emitEvent(event));}}module[_0x4c69('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xbe22=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xbe22,0x1c1));var _0x2be2=function(_0x203c68,_0x7497d3){_0x203c68=_0x203c68-0x0;var _0x112d8f=_0xbe22[_0x203c68];return _0x112d8f;};'use strict';var EventEmitter=require(_0x2be2('0x0'));var ChatWebsite=require(_0x2be2('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2be2('0x2'),'afterUpdate':_0x2be2('0x3'),'afterDestroy':_0x2be2('0x4')};function emitEvent(_0x409a41){return function(_0x1729d7,_0x250c97,_0x3693e2){ChatWebsiteEvents[_0x2be2('0x5')](_0x409a41+':'+_0x1729d7['id'],_0x1729d7);ChatWebsiteEvents[_0x2be2('0x5')](_0x409a41,_0x1729d7);_0x3693e2(null);};}for(var e in events){if(events[_0x2be2('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x2be2('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e7c91fb..cc78240 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 _0x41bb=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','chat_websites','lodash','util','api'];(function(_0x1fe054,_0x1aea87){var _0x476ea9=function(_0x39308b){while(--_0x39308b){_0x1fe054['push'](_0x1fe054['shift']());}};_0x476ea9(++_0x1aea87);}(_0x41bb,0xc5));var _0xb41b=function(_0x501cb2,_0x57ee0a){_0x501cb2=_0x501cb2-0x0;var _0x3f596d=_0x41bb[_0x501cb2];return _0x3f596d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('ChatWebsite',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d9b=['rimraf','./chatWebsite.attributes','ChatWebsite','chat_websites','util','../../config/logger','moment','request-promise','path'];(function(_0x3fdb6b,_0x5891f9){var _0x1ad287=function(_0x476783){while(--_0x476783){_0x3fdb6b['push'](_0x3fdb6b['shift']());}};_0x1ad287(++_0x5891f9);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x952ea0,_0x4fd4a6){_0x952ea0=_0x952ea0-0x0;var _0x40555f=_0x9d9b[_0x952ea0];return _0x40555f;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('api');var moment=require(_0xb9d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9d9('0x3'));var fs=require('fs');var path=require(_0xb9d9('0x4'));var rimraf=require(_0xb9d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9d9('0x6'));module['exports']=function(_0x1b1f3c,_0x32cf18){return _0x1b1f3c['define'](_0xb9d9('0x7'),attributes,{'tableName':_0xb9d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index d659ff2..54d591b 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 _0x2a07=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x52b37a,_0x100dee){var _0x2c1790=function(_0x325b73){while(--_0x325b73){_0x52b37a['push'](_0x52b37a['shift']());}};_0x2c1790(++_0x100dee);}(_0x2a07,0x74));var _0x72a0=function(_0x3879f5,_0x5b4fe8){_0x3879f5=_0x3879f5-0x0;var _0x27ee90=_0x2a07[_0x3879f5];return _0x27ee90;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});config[_0x72a0('0xd')]=_[_0x72a0('0xe')](config[_0x72a0('0xd')],{'host':_0x72a0('0xf'),'port':0x18eb});var socket=require(_0x72a0('0x10'))(new Redis(config[_0x72a0('0xd')]));require(_0x72a0('0x11'))[_0x72a0('0x12')](socket);function respondWithRpcPromise(_0x5c1d1e,_0x169dc2,_0x1109f7){return new BPromise(function(_0x54abf6,_0x46fb8a){return client[_0x72a0('0x13')](_0x5c1d1e,_0x1109f7)[_0x72a0('0x14')](function(_0x44d7cf){logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));logger[_0x72a0('0x17')](_0x72a0('0x18'),_0x169dc2,_0x72a0('0x16'),JSON[_0x72a0('0x19')](_0x44d7cf));if(_0x44d7cf[_0x72a0('0x1a')]){if(_0x44d7cf[_0x72a0('0x1a')]['code']===0x1f4){logger['error'](_0x72a0('0x1b'),_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x46fb8a(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}logger[_0x72a0('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x54abf6(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}else{logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));_0x54abf6(_0x44d7cf[_0x72a0('0x1d')][_0x72a0('0x1c')]);}})['catch'](function(_0x144bfc){logger[_0x72a0('0x1a')](_0x72a0('0x1b'),_0x169dc2,_0x144bfc);_0x46fb8a(_0x144bfc);});});} \ No newline at end of file +var _0x5f66=['debug','request\x20sent','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','then','ChatWebsite,\x20%s,\x20%s'];(function(_0x129124,_0x13adc4){var _0x3dd47e=function(_0xb9deec){while(--_0xb9deec){_0x129124['push'](_0x129124['shift']());}};_0x3dd47e(++_0x13adc4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b5bbf21..137e4cb 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x455580,_0x5cd4dd){var _0x7aabc2=function(_0x10bf94){while(--_0x10bf94){_0x455580['push'](_0x455580['shift']());}};_0x7aabc2(++_0x5cd4dd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56d5f8,_0x26b8f7){_0x56d5f8=_0x56d5f8-0x0;var _0x1afb43=_0x5f2f[_0x56d5f8];return _0x1afb43;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4c5eaf,_0x8364ab){var _0x7cc2e5=function(_0x1b44c7){while(--_0x1b44c7){_0x4c5eaf['push'](_0x4c5eaf['shift']());}};_0x7cc2e5(++_0x8364ab);}(_0x7a54,0x106));var _0x47a5=function(_0x28dbee,_0x19e994){_0x28dbee=_0x28dbee-0x0;var _0xe14ac3=_0x7a54[_0x28dbee];return _0xe14ac3;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e964e52..0e395fa 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 _0xca28=['show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','root','format','originalname','single','addLogo','diskStorage','%s-%s','now','/:id/avatar','file','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x2fa0ca,_0x38ce9e){var _0x3aa878=function(_0x3a5c21){while(--_0x3a5c21){_0x2fa0ca['push'](_0x2fa0ca['shift']());}};_0x3aa878(++_0x38ce9e);}(_0xca28,0x102));var _0x8ca2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xca28[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x8ca2('0x0'));var util=require(_0x8ca2('0x1'));var path=require(_0x8ca2('0x2'));var timeout=require(_0x8ca2('0x3'));var express=require(_0x8ca2('0x4'));var router=express['Router']();var auth=require(_0x8ca2('0x5'));var interaction=require(_0x8ca2('0x6'));var config=require(_0x8ca2('0x7'));var controller=require('./chatWebsite.controller');router[_0x8ca2('0x8')]('/',auth['isAuthenticated'](),controller[_0x8ca2('0x9')]);router[_0x8ca2('0x8')](_0x8ca2('0xa'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0xc')]);router[_0x8ca2('0x8')](_0x8ca2('0xd'),auth['isAuthenticated'](),controller[_0x8ca2('0xe')]);router[_0x8ca2('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8ca2('0xf')]);router[_0x8ca2('0x8')](_0x8ca2('0x10'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x11')]);router[_0x8ca2('0x8')](_0x8ca2('0x12'),controller[_0x8ca2('0x13')]);router[_0x8ca2('0x8')]('/:id/avatar',controller[_0x8ca2('0x14')]);router[_0x8ca2('0x8')](_0x8ca2('0x15'),controller[_0x8ca2('0x16')]);router[_0x8ca2('0x8')](_0x8ca2('0x17'),controller[_0x8ca2('0x18')]);router[_0x8ca2('0x8')](_0x8ca2('0x19'),auth[_0x8ca2('0xb')](),controller['getInteractions']);router[_0x8ca2('0x8')](_0x8ca2('0x1a'),controller[_0x8ca2('0x1b')]);router[_0x8ca2('0x8')](_0x8ca2('0x1c'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x1d')]);router[_0x8ca2('0x8')](_0x8ca2('0x1e'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x1f')]);router['get']('/:id/fields',controller[_0x8ca2('0x20')]);router[_0x8ca2('0x8')](_0x8ca2('0x21'),auth['isAuthenticated'](),controller[_0x8ca2('0x22')]);router[_0x8ca2('0x8')]('/:id/users',auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x23')]);router[_0x8ca2('0x24')]('/',auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x25')]);router[_0x8ca2('0x24')](_0x8ca2('0x26'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x27')]);router['post'](_0x8ca2('0x10'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d3a81,_0x2f9cd9,_0x3786c6){_0x3786c6(null,path[_0x8ca2('0x29')](config[_0x8ca2('0x2a')],'server/files/images/logos/'));},'filename':function(_0x4190b6,_0x4a7cfe,_0x2079f6){_0x2079f6(null,util[_0x8ca2('0x2b')]('%s-%s',Date['now'](),_0x4a7cfe[_0x8ca2('0x2c')]));}})});router[_0x8ca2('0x24')]('/:id/logo',upload[_0x8ca2('0x2d')]('file'),controller[_0x8ca2('0x2e')]);var upload=multer({'storage':multer[_0x8ca2('0x2f')]({'destination':function(_0x2f60b8,_0x1c0bee,_0x5ca328){_0x5ca328(null,path['join'](config[_0x8ca2('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x2b56b4,_0xcbee18,_0x4c31f9){_0x4c31f9(null,util[_0x8ca2('0x2b')](_0x8ca2('0x30'),Date[_0x8ca2('0x31')](),_0xcbee18[_0x8ca2('0x2c')]));}})});router[_0x8ca2('0x24')](_0x8ca2('0x32'),upload[_0x8ca2('0x2d')](_0x8ca2('0x33')),controller[_0x8ca2('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4939f8,_0x394fe6,_0x503916){_0x503916(null,path[_0x8ca2('0x29')](config[_0x8ca2('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x2a3b86,_0x2e2071,_0x2da917){_0x2da917(null,util[_0x8ca2('0x2b')](_0x8ca2('0x30'),Date[_0x8ca2('0x31')](),_0x2e2071[_0x8ca2('0x2c')]));}})});router['post'](_0x8ca2('0x15'),upload['single'](_0x8ca2('0x33')),controller[_0x8ca2('0x35')]);var upload=multer({'storage':multer[_0x8ca2('0x2f')]({'destination':function(_0x4f5449,_0x159a13,_0x5f51b1){_0x5f51b1(null,path[_0x8ca2('0x29')](config[_0x8ca2('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x15ee87,_0x4d6e86,_0x49e125){_0x49e125(null,util[_0x8ca2('0x2b')](_0x8ca2('0x30'),Date[_0x8ca2('0x31')](),_0x4d6e86[_0x8ca2('0x2c')]));}})});router[_0x8ca2('0x24')](_0x8ca2('0x17'),upload['single']('file'),controller[_0x8ca2('0x36')]);router[_0x8ca2('0x24')](_0x8ca2('0x37'),controller[_0x8ca2('0x38')]);router[_0x8ca2('0x24')](_0x8ca2('0x39'),controller[_0x8ca2('0x3a')]);router[_0x8ca2('0x24')]('/:id/interactions',auth[_0x8ca2('0xb')](),controller['addInteraction']);router['post'](_0x8ca2('0x1c'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x3b')]);router[_0x8ca2('0x24')](_0x8ca2('0x1e'),auth[_0x8ca2('0xb')](),controller['addProactiveActions']);router[_0x8ca2('0x24')](_0x8ca2('0x3c'),auth['isAuthenticated'](),controller[_0x8ca2('0x3d')]);router[_0x8ca2('0x3e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8ca2('0x3f')](_0x8ca2('0xd'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x40')]);router[_0x8ca2('0x3f')](_0x8ca2('0x26'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x41')]);router['delete'](_0x8ca2('0x10'),auth[_0x8ca2('0xb')](),controller['removeAnswers']);router[_0x8ca2('0x3f')](_0x8ca2('0x3c'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x42')]);module[_0x8ca2('0x43')]=router; \ No newline at end of file +var _0xb76a=['/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','create','addDisposition','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','/:id/proactive_actions'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xb76a,0x1e4));var _0xab76=function(_0x306366,_0x3840bd){_0x306366=_0x306366-0x0;var _0x4cd167=_0xb76a[_0x306366];return _0x4cd167;};'use strict';var multer=require(_0xab76('0x0'));var util=require(_0xab76('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xab76('0x2'));var router=express[_0xab76('0x3')]();var auth=require(_0xab76('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xab76('0x5'));var controller=require(_0xab76('0x6'));router[_0xab76('0x7')]('/',auth[_0xab76('0x8')](),controller[_0xab76('0x9')]);router[_0xab76('0x7')](_0xab76('0xa'),auth[_0xab76('0x8')](),controller[_0xab76('0xb')]);router[_0xab76('0x7')](_0xab76('0xc'),auth[_0xab76('0x8')](),controller[_0xab76('0xd')]);router[_0xab76('0x7')](_0xab76('0xe'),auth[_0xab76('0x8')](),controller[_0xab76('0xf')]);router['get'](_0xab76('0x10'),auth['isAuthenticated'](),controller[_0xab76('0x11')]);router[_0xab76('0x7')](_0xab76('0x12'),controller[_0xab76('0x13')]);router[_0xab76('0x7')]('/:id/avatar',controller[_0xab76('0x14')]);router[_0xab76('0x7')](_0xab76('0x15'),controller[_0xab76('0x16')]);router['get'](_0xab76('0x17'),controller[_0xab76('0x18')]);router[_0xab76('0x7')](_0xab76('0x19'),auth[_0xab76('0x8')](),controller[_0xab76('0x1a')]);router[_0xab76('0x7')](_0xab76('0x1b'),controller[_0xab76('0x1c')]);router[_0xab76('0x7')](_0xab76('0x1d'),auth[_0xab76('0x8')](),controller[_0xab76('0x1e')]);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xab76('0x1f')]);router[_0xab76('0x7')](_0xab76('0x20'),controller[_0xab76('0x21')]);router[_0xab76('0x7')](_0xab76('0x22'),auth['isAuthenticated'](),controller[_0xab76('0x23')]);router['get']('/:id/users',auth[_0xab76('0x8')](),controller['getAgents']);router['post']('/',auth[_0xab76('0x8')](),controller[_0xab76('0x24')]);router['post'](_0xab76('0xe'),auth[_0xab76('0x8')](),controller[_0xab76('0x25')]);router[_0xab76('0x26')](_0xab76('0x10'),auth['isAuthenticated'](),controller[_0xab76('0x27')]);var upload=multer({'storage':multer[_0xab76('0x28')]({'destination':function(_0x28162d,_0xe3db99,_0xf9a25b){_0xf9a25b(null,path[_0xab76('0x29')](config[_0xab76('0x2a')],_0xab76('0x2b')));},'filename':function(_0x50e8c9,_0x11a1a5,_0x550ff3){_0x550ff3(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x11a1a5[_0xab76('0x2e')]));}})});router['post']('/:id/logo',upload[_0xab76('0x2f')](_0xab76('0x30')),controller[_0xab76('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ce7fc,_0x1547e4,_0x33900b){_0x33900b(null,path['join'](config['root'],_0xab76('0x32')));},'filename':function(_0x3ccb6f,_0x40bcd9,_0x2cc2bc){_0x2cc2bc(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x40bcd9[_0xab76('0x2e')]));}})});router[_0xab76('0x26')]('/:id/avatar',upload[_0xab76('0x2f')](_0xab76('0x30')),controller[_0xab76('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5309e9,_0x538e47,_0x284cbc){_0x284cbc(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x57e27b,_0x4a2836,_0x26af56){_0x26af56(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x4a2836['originalname']));}})});router['post'](_0xab76('0x15'),upload['single']('file'),controller[_0xab76('0x34')]);var upload=multer({'storage':multer[_0xab76('0x28')]({'destination':function(_0x3afb6b,_0x757549,_0x39e265){_0x39e265(null,path[_0xab76('0x29')](config['root'],_0xab76('0x32')));},'filename':function(_0x3fdaa7,_0x41f5d9,_0x2b5cd8){_0x2b5cd8(null,util[_0xab76('0x2c')]('%s-%s',Date[_0xab76('0x2d')](),_0x41f5d9[_0xab76('0x2e')]));}})});router[_0xab76('0x26')](_0xab76('0x17'),upload[_0xab76('0x2f')](_0xab76('0x30')),controller[_0xab76('0x35')]);router[_0xab76('0x26')](_0xab76('0x36'),controller[_0xab76('0x37')]);router[_0xab76('0x26')](_0xab76('0x38'),controller[_0xab76('0x39')]);router[_0xab76('0x26')](_0xab76('0x19'),auth[_0xab76('0x8')](),controller['addInteraction']);router[_0xab76('0x26')](_0xab76('0x1d'),auth['isAuthenticated'](),controller[_0xab76('0x3a')]);router[_0xab76('0x26')](_0xab76('0x3b'),auth[_0xab76('0x8')](),controller['addProactiveActions']);router[_0xab76('0x26')](_0xab76('0x3c'),auth[_0xab76('0x8')](),controller[_0xab76('0x3d')]);router[_0xab76('0x3e')](_0xab76('0xc'),auth['isAuthenticated'](),controller[_0xab76('0x3f')]);router[_0xab76('0x40')](_0xab76('0xc'),auth[_0xab76('0x8')](),controller['destroy']);router[_0xab76('0x40')](_0xab76('0xe'),auth[_0xab76('0x8')](),controller[_0xab76('0x41')]);router[_0xab76('0x40')]('/:id/canned_answers',auth[_0xab76('0x8')](),controller[_0xab76('0x42')]);router[_0xab76('0x40')](_0xab76('0x3c'),auth[_0xab76('0x8')](),controller[_0xab76('0x43')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index a9c0fea..4918e7e 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 _0x49c1=['STRING','ENUM','AmazonAWS','sequelize'];(function(_0xc8d501,_0xa143cb){var _0x4489a9=function(_0x4fa0f8){while(--_0x4fa0f8){_0xc8d501['push'](_0xc8d501['shift']());}};_0x4489a9(++_0xa143cb);}(_0x49c1,0xef));var _0x149c=function(_0x41f6c3,_0xc1da57){_0x41f6c3=_0x41f6c3-0x0;var _0x2ff7ec=_0x49c1[_0x41f6c3];return _0x2ff7ec;};'use strict';var Sequelize=require(_0x149c('0x0'));module['exports']={'name':{'type':Sequelize[_0x149c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x149c('0x2')](_0x149c('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x149c('0x1')]},'data2':{'type':Sequelize[_0x149c('0x1')]}}; \ No newline at end of file +var _0xf88f=['exports','STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x8693d1,_0x2b3e74){var _0x537cb4=function(_0x3a7f19){while(--_0x3a7f19){_0x8693d1['push'](_0x8693d1['shift']());}};_0x537cb4(++_0x2b3e74);}(_0xf88f,0x1bb));var _0xff88=function(_0x2fc258,_0x342ab0){_0x2fc258=_0x2fc258-0x0;var _0x46b5f4=_0xf88f[_0x2fc258];return _0x46b5f4;};'use strict';var Sequelize=require(_0xff88('0x0'));module[_0xff88('0x1')]={'name':{'type':Sequelize[_0xff88('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xff88('0x3')](_0xff88('0x4'),_0xff88('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xff88('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 7ea1f7e..089f423 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 _0xc6a9=['count','offset','set','apply','then','destroy','error','stack','name','send','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json'];(function(_0x536317,_0x517263){var _0x49a24b=function(_0x526f86){while(--_0x526f86){_0x536317['push'](_0x536317['shift']());}};_0x49a24b(++_0x517263);}(_0xc6a9,0x140));var _0x9c6a=function(_0x3fc31d,_0x432bc9){_0x3fc31d=_0x3fc31d-0x0;var _0x31bb91=_0xc6a9[_0x3fc31d];return _0x31bb91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9c6a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c6a('0x1'));var moment=require(_0x9c6a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9c6a('0x3'));var util=require(_0x9c6a('0x4'));var path=require(_0x9c6a('0x5'));var sox=require(_0x9c6a('0x6'));var csv=require(_0x9c6a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9c6a('0x8'));var squel=require(_0x9c6a('0x9'));var crypto=require(_0x9c6a('0xa'));var jsforce=require(_0x9c6a('0xb'));var deskjs=require(_0x9c6a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c6a('0xd'));var Redis=require('ioredis');var authService=require(_0x9c6a('0xe'));var qs=require(_0x9c6a('0xf'));var as=require(_0x9c6a('0x10'));var hardwareService=require(_0x9c6a('0x11'));var logger=require(_0x9c6a('0x12'))(_0x9c6a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c6a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25b2ca,_0x333a2e){_0x333a2e=_0x333a2e||0xcc;return function(_0x1dca30){if(_0x1dca30){return _0x25b2ca[_0x9c6a('0x15')](_0x333a2e);}return _0x25b2ca[_0x9c6a('0x16')](_0x333a2e)[_0x9c6a('0x17')]();};}function respondWithResult(_0x2b5708,_0x4ff7b3){_0x4ff7b3=_0x4ff7b3||0xc8;return function(_0x21481e){if(_0x21481e){return _0x2b5708['status'](_0x4ff7b3)[_0x9c6a('0x18')](_0x21481e);}};}function respondWithFilteredResult(_0x465fab,_0x92bc48){return function(_0x312baf){if(_0x312baf){var _0x2f6940=_0x312baf[_0x9c6a('0x19')],_0x373a72=_0x92bc48[_0x9c6a('0x1a')],_0x25afdc=_0x92bc48[_0x9c6a('0x1a')]+_0x92bc48['limit'],_0x366faf;if(_0x25afdc>=_0x2f6940){_0x25afdc=_0x2f6940;_0x366faf=0xc8;}else{_0x366faf=0xce;}_0x465fab[_0x9c6a('0x16')](_0x366faf);return _0x465fab[_0x9c6a('0x1b')]('Content-Range',_0x373a72+'-'+_0x25afdc+'/'+_0x2f6940)[_0x9c6a('0x18')](_0x312baf);}return null;};}function patchUpdates(_0x319de8){return function(_0x2ebe00){try{jsonpatch[_0x9c6a('0x1c')](_0x2ebe00,_0x319de8,!![]);}catch(_0x514ab5){return BPromise['reject'](_0x514ab5);}return _0x2ebe00['save']();};}function saveUpdates(_0x184a81,_0x8c9158){return function(_0x18166d){if(_0x18166d){return _0x18166d['update'](_0x184a81)[_0x9c6a('0x1d')](function(_0x5aee08){return _0x5aee08;});}return null;};}function removeEntity(_0x39eed8,_0x299453){return function(_0x15f52e){if(_0x15f52e){return _0x15f52e[_0x9c6a('0x1e')]()[_0x9c6a('0x1d')](function(){_0x39eed8[_0x9c6a('0x16')](0xcc)[_0x9c6a('0x17')]();});}};}function handleEntityNotFound(_0x4c0649,_0x35cc76){return function(_0x42993a){if(!_0x42993a){_0x4c0649[_0x9c6a('0x15')](0x194);}return _0x42993a;};}function handleError(_0x441ead,_0x16be17){_0x16be17=_0x16be17||0x1f4;return function(_0x4819da){logger[_0x9c6a('0x1f')](_0x4819da[_0x9c6a('0x20')]);if(_0x4819da['name']){delete _0x4819da[_0x9c6a('0x21')];}_0x441ead[_0x9c6a('0x16')](_0x16be17)[_0x9c6a('0x22')](_0x4819da);};}exports[_0x9c6a('0x23')]=function(_0x223d56,_0x2e5222){var _0x47742e={},_0x9f14e8={},_0x1594ee={'count':0x0,'rows':[]};var _0x3c5ea6=_[_0x9c6a('0x24')](db[_0x9c6a('0x25')][_0x9c6a('0x26')],function(_0x233ea6){return{'name':_0x233ea6['fieldName'],'type':_0x233ea6[_0x9c6a('0x27')][_0x9c6a('0x28')]};});_0x9f14e8[_0x9c6a('0x29')]=_[_0x9c6a('0x24')](_0x3c5ea6,_0x9c6a('0x21'));_0x9f14e8[_0x9c6a('0x2a')]=_[_0x9c6a('0x2b')](_0x223d56[_0x9c6a('0x2a')]);_0x9f14e8[_0x9c6a('0x2c')]=_['intersection'](_0x9f14e8[_0x9c6a('0x29')],_0x9f14e8[_0x9c6a('0x2a')]);_0x47742e['attributes']=_['intersection'](_0x9f14e8[_0x9c6a('0x29')],qs[_0x9c6a('0x2d')](_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x2d')]));_0x47742e[_0x9c6a('0x2e')]=_0x47742e[_0x9c6a('0x2e')][_0x9c6a('0x2f')]?_0x47742e['attributes']:_0x9f14e8['model'];if(!_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x30')]('nolimit')){_0x47742e[_0x9c6a('0x31')]=qs['limit'](_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x31')]);_0x47742e[_0x9c6a('0x1a')]=qs[_0x9c6a('0x1a')](_0x223d56['query'][_0x9c6a('0x1a')]);}_0x47742e[_0x9c6a('0x32')]=qs[_0x9c6a('0x33')](_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x33')]);_0x47742e[_0x9c6a('0x34')]=qs[_0x9c6a('0x2c')](_['pick'](_0x223d56[_0x9c6a('0x2a')],_0x9f14e8[_0x9c6a('0x2c')]),_0x3c5ea6);if(_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x35')]){_0x47742e[_0x9c6a('0x34')]=_[_0x9c6a('0x36')](_0x47742e[_0x9c6a('0x34')],{'$or':_[_0x9c6a('0x24')](_0x3c5ea6,function(_0x419557){if(_0x419557[_0x9c6a('0x27')]!==_0x9c6a('0x37')){var _0x122170={};_0x122170[_0x419557[_0x9c6a('0x21')]]={'$like':'%'+_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x35')]+'%'};return _0x122170;}})});}_0x47742e=_[_0x9c6a('0x36')]({},_0x47742e,_0x223d56[_0x9c6a('0x38')]);var _0x2b18e8={'where':_0x47742e[_0x9c6a('0x34')]};return db[_0x9c6a('0x25')]['count'](_0x2b18e8)[_0x9c6a('0x1d')](function(_0x37610d){_0x1594ee[_0x9c6a('0x19')]=_0x37610d;if(_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x39')]){_0x47742e[_0x9c6a('0x3a')]=[{'all':!![]}];}return db['CloudProvider'][_0x9c6a('0x3b')](_0x47742e);})[_0x9c6a('0x1d')](function(_0x1cd773){_0x1594ee[_0x9c6a('0x3c')]=_0x1cd773;return _0x1594ee;})['then'](respondWithFilteredResult(_0x2e5222,_0x47742e))[_0x9c6a('0x3d')](handleError(_0x2e5222,null));};exports[_0x9c6a('0x3e')]=function(_0x417772,_0x23b32a){var _0x574e21={'raw':!![],'where':{'id':_0x417772[_0x9c6a('0x3f')]['id']}},_0x179b63={};_0x179b63['model']=_[_0x9c6a('0x2b')](db[_0x9c6a('0x25')]['rawAttributes']);_0x179b63[_0x9c6a('0x2a')]=_[_0x9c6a('0x2b')](_0x417772[_0x9c6a('0x2a')]);_0x179b63[_0x9c6a('0x2c')]=_['intersection'](_0x179b63['model'],_0x179b63['query']);_0x574e21[_0x9c6a('0x2e')]=_[_0x9c6a('0x40')](_0x179b63['model'],qs[_0x9c6a('0x2d')](_0x417772[_0x9c6a('0x2a')][_0x9c6a('0x2d')]));_0x574e21[_0x9c6a('0x2e')]=_0x574e21[_0x9c6a('0x2e')]['length']?_0x574e21[_0x9c6a('0x2e')]:_0x179b63[_0x9c6a('0x29')];if(_0x417772[_0x9c6a('0x2a')][_0x9c6a('0x39')]){_0x574e21[_0x9c6a('0x3a')]=[{'all':!![]}];}_0x574e21=_['merge']({},_0x574e21,_0x417772[_0x9c6a('0x38')]);return db[_0x9c6a('0x25')][_0x9c6a('0x41')](_0x574e21)[_0x9c6a('0x1d')](handleEntityNotFound(_0x23b32a,null))[_0x9c6a('0x1d')](respondWithResult(_0x23b32a,null))[_0x9c6a('0x3d')](handleError(_0x23b32a,null));};exports[_0x9c6a('0x42')]=function(_0x433085,_0x433ba5){return db[_0x9c6a('0x25')]['create'](_0x433085[_0x9c6a('0x43')],{})[_0x9c6a('0x1d')](respondWithResult(_0x433ba5,0xc9))[_0x9c6a('0x3d')](handleError(_0x433ba5,null));};exports[_0x9c6a('0x44')]=function(_0x57a107,_0x19d1aa){if(_0x57a107[_0x9c6a('0x43')]['id']){delete _0x57a107[_0x9c6a('0x43')]['id'];}return db[_0x9c6a('0x25')][_0x9c6a('0x41')]({'where':{'id':_0x57a107[_0x9c6a('0x3f')]['id']}})[_0x9c6a('0x1d')](handleEntityNotFound(_0x19d1aa,null))['then'](saveUpdates(_0x57a107[_0x9c6a('0x43')],null))[_0x9c6a('0x1d')](respondWithResult(_0x19d1aa,null))[_0x9c6a('0x3d')](handleError(_0x19d1aa,null));};exports['destroy']=function(_0x41eb65,_0x46a959){return db[_0x9c6a('0x25')][_0x9c6a('0x41')]({'where':{'id':_0x41eb65[_0x9c6a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x46a959,null))['then'](removeEntity(_0x46a959,null))['catch'](handleError(_0x46a959,null));}; \ No newline at end of file +var _0x8703=['html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x8703,0x92));var _0x3870=function(_0x567f6d,_0xdd7051){_0x567f6d=_0x567f6d-0x0;var _0x312205=_0x8703[_0x567f6d];return _0x312205;};'use strict';var pdf=require(_0x3870('0x0'));var emlformat=require(_0x3870('0x1'));var rimraf=require(_0x3870('0x2'));var zipdir=require(_0x3870('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3870('0x4'));var moment=require('moment');var BPromise=require(_0x3870('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3870('0x6'));var sox=require(_0x3870('0x7'));var csv=require(_0x3870('0x8'));var ejs=require(_0x3870('0x9'));var fs=require('fs');var _=require(_0x3870('0xa'));var squel=require(_0x3870('0xb'));var crypto=require('crypto');var jsforce=require(_0x3870('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3870('0xd'));var Redis=require(_0x3870('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3870('0xf'));var as=require(_0x3870('0x10'));var hardwareService=require(_0x3870('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3870('0x12'));var config=require(_0x3870('0x13'));var licenseUtil=require(_0x3870('0x14'));var db=require(_0x3870('0x15'))['db'];function respondWithStatusCode(_0x32fe51,_0x5b24e4){_0x5b24e4=_0x5b24e4||0xcc;return function(_0x1b9dce){if(_0x1b9dce){return _0x32fe51[_0x3870('0x16')](_0x5b24e4);}return _0x32fe51['status'](_0x5b24e4)['end']();};}function respondWithResult(_0x5e6091,_0x13fd34){_0x13fd34=_0x13fd34||0xc8;return function(_0x133f60){if(_0x133f60){return _0x5e6091[_0x3870('0x17')](_0x13fd34)[_0x3870('0x18')](_0x133f60);}};}function respondWithFilteredResult(_0x4581df,_0x4db130){return function(_0x32d53d){if(_0x32d53d){var _0xfbd263=_0x32d53d[_0x3870('0x19')],_0x5bbd3a=_0x4db130[_0x3870('0x1a')],_0x573321=_0x4db130[_0x3870('0x1a')]+_0x4db130[_0x3870('0x1b')],_0x201ef9;if(_0x573321>=_0xfbd263){_0x573321=_0xfbd263;_0x201ef9=0xc8;}else{_0x201ef9=0xce;}_0x4581df[_0x3870('0x17')](_0x201ef9);return _0x4581df[_0x3870('0x1c')]('Content-Range',_0x5bbd3a+'-'+_0x573321+'/'+_0xfbd263)[_0x3870('0x18')](_0x32d53d);}return null;};}function patchUpdates(_0x4cf1fd){return function(_0xb62fc3){try{jsonpatch[_0x3870('0x1d')](_0xb62fc3,_0x4cf1fd,!![]);}catch(_0x476533){return BPromise[_0x3870('0x1e')](_0x476533);}return _0xb62fc3['save']();};}function saveUpdates(_0x13a8f,_0x2f2e5c){return function(_0x4f342c){if(_0x4f342c){return _0x4f342c[_0x3870('0x1f')](_0x13a8f)['then'](function(_0x10d3b2){return _0x10d3b2;});}return null;};}function removeEntity(_0x42194c,_0x4d518e){return function(_0xa4c053){if(_0xa4c053){return _0xa4c053[_0x3870('0x20')]()[_0x3870('0x21')](function(){_0x42194c['status'](0xcc)[_0x3870('0x22')]();});}};}function handleEntityNotFound(_0x26b5bd,_0x2a77f7){return function(_0x5a156e){if(!_0x5a156e){_0x26b5bd[_0x3870('0x16')](0x194);}return _0x5a156e;};}function handleError(_0x1c6a6d,_0x500b34){_0x500b34=_0x500b34||0x1f4;return function(_0x34010e){logger[_0x3870('0x23')](_0x34010e[_0x3870('0x24')]);if(_0x34010e['name']){delete _0x34010e[_0x3870('0x25')];}_0x1c6a6d['status'](_0x500b34)[_0x3870('0x26')](_0x34010e);};}exports[_0x3870('0x27')]=function(_0x465bec,_0x5ccd55){var _0x3f7e51={},_0x572ae4={},_0x467bb4={'count':0x0,'rows':[]};var _0x4897c8=_[_0x3870('0x28')](db[_0x3870('0x29')][_0x3870('0x2a')],function(_0x313900){return{'name':_0x313900[_0x3870('0x2b')],'type':_0x313900[_0x3870('0x2c')]['key']};});_0x572ae4[_0x3870('0x2d')]=_[_0x3870('0x28')](_0x4897c8,'name');_0x572ae4[_0x3870('0x2e')]=_[_0x3870('0x2f')](_0x465bec[_0x3870('0x2e')]);_0x572ae4[_0x3870('0x30')]=_['intersection'](_0x572ae4[_0x3870('0x2d')],_0x572ae4[_0x3870('0x2e')]);_0x3f7e51[_0x3870('0x31')]=_[_0x3870('0x32')](_0x572ae4[_0x3870('0x2d')],qs[_0x3870('0x33')](_0x465bec['query'][_0x3870('0x33')]));_0x3f7e51[_0x3870('0x31')]=_0x3f7e51[_0x3870('0x31')][_0x3870('0x34')]?_0x3f7e51[_0x3870('0x31')]:_0x572ae4[_0x3870('0x2d')];if(!_0x465bec[_0x3870('0x2e')][_0x3870('0x35')](_0x3870('0x36'))){_0x3f7e51[_0x3870('0x1b')]=qs['limit'](_0x465bec[_0x3870('0x2e')]['limit']);_0x3f7e51[_0x3870('0x1a')]=qs[_0x3870('0x1a')](_0x465bec[_0x3870('0x2e')]['offset']);}_0x3f7e51[_0x3870('0x37')]=qs['sort'](_0x465bec[_0x3870('0x2e')][_0x3870('0x38')]);_0x3f7e51[_0x3870('0x39')]=qs['filters'](_[_0x3870('0x3a')](_0x465bec[_0x3870('0x2e')],_0x572ae4[_0x3870('0x30')]),_0x4897c8);if(_0x465bec[_0x3870('0x2e')]['filter']){_0x3f7e51[_0x3870('0x39')]=_[_0x3870('0x3b')](_0x3f7e51[_0x3870('0x39')],{'$or':_['map'](_0x4897c8,function(_0x3b8c2b){if(_0x3b8c2b[_0x3870('0x2c')]!==_0x3870('0x3c')){var _0x53511e={};_0x53511e[_0x3b8c2b['name']]={'$like':'%'+_0x465bec[_0x3870('0x2e')][_0x3870('0x3d')]+'%'};return _0x53511e;}})});}_0x3f7e51=_[_0x3870('0x3b')]({},_0x3f7e51,_0x465bec[_0x3870('0x3e')]);var _0x2dbfa6={'where':_0x3f7e51[_0x3870('0x39')]};return db[_0x3870('0x29')][_0x3870('0x19')](_0x2dbfa6)['then'](function(_0x3d68fd){_0x467bb4[_0x3870('0x19')]=_0x3d68fd;if(_0x465bec[_0x3870('0x2e')][_0x3870('0x3f')]){_0x3f7e51[_0x3870('0x40')]=[{'all':!![]}];}return db[_0x3870('0x29')][_0x3870('0x41')](_0x3f7e51);})[_0x3870('0x21')](function(_0xb749ff){_0x467bb4[_0x3870('0x42')]=_0xb749ff;return _0x467bb4;})[_0x3870('0x21')](respondWithFilteredResult(_0x5ccd55,_0x3f7e51))[_0x3870('0x43')](handleError(_0x5ccd55,null));};exports[_0x3870('0x44')]=function(_0xa38410,_0x49b7ff){var _0x3427e3={'raw':!![],'where':{'id':_0xa38410[_0x3870('0x45')]['id']}},_0x5ea01c={};_0x5ea01c[_0x3870('0x2d')]=_[_0x3870('0x2f')](db[_0x3870('0x29')][_0x3870('0x2a')]);_0x5ea01c['query']=_[_0x3870('0x2f')](_0xa38410['query']);_0x5ea01c[_0x3870('0x30')]=_[_0x3870('0x32')](_0x5ea01c[_0x3870('0x2d')],_0x5ea01c['query']);_0x3427e3[_0x3870('0x31')]=_['intersection'](_0x5ea01c[_0x3870('0x2d')],qs['fields'](_0xa38410[_0x3870('0x2e')][_0x3870('0x33')]));_0x3427e3['attributes']=_0x3427e3[_0x3870('0x31')][_0x3870('0x34')]?_0x3427e3['attributes']:_0x5ea01c[_0x3870('0x2d')];if(_0xa38410['query'][_0x3870('0x3f')]){_0x3427e3[_0x3870('0x40')]=[{'all':!![]}];}_0x3427e3=_[_0x3870('0x3b')]({},_0x3427e3,_0xa38410[_0x3870('0x3e')]);return db[_0x3870('0x29')][_0x3870('0x46')](_0x3427e3)[_0x3870('0x21')](handleEntityNotFound(_0x49b7ff,null))['then'](respondWithResult(_0x49b7ff,null))[_0x3870('0x43')](handleError(_0x49b7ff,null));};exports['create']=function(_0x288d6f,_0x382645){return db[_0x3870('0x29')][_0x3870('0x47')](_0x288d6f[_0x3870('0x48')],{})[_0x3870('0x21')](respondWithResult(_0x382645,0xc9))[_0x3870('0x43')](handleError(_0x382645,null));};exports[_0x3870('0x1f')]=function(_0x2c7ea9,_0x48b258){if(_0x2c7ea9[_0x3870('0x48')]['id']){delete _0x2c7ea9[_0x3870('0x48')]['id'];}return db[_0x3870('0x29')]['find']({'where':{'id':_0x2c7ea9[_0x3870('0x45')]['id']}})[_0x3870('0x21')](handleEntityNotFound(_0x48b258,null))[_0x3870('0x21')](saveUpdates(_0x2c7ea9[_0x3870('0x48')],null))[_0x3870('0x21')](respondWithResult(_0x48b258,null))[_0x3870('0x43')](handleError(_0x48b258,null));};exports[_0x3870('0x20')]=function(_0x277260,_0x3d6645){return db['CloudProvider'][_0x3870('0x46')]({'where':{'id':_0x277260[_0x3870('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d6645,null))[_0x3870('0x21')](removeEntity(_0x3d6645,null))['catch'](handleError(_0x3d6645,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4e52bf5..0e75756 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 _0xc078=['bluebird','request-promise','path','rimraf','../../config/environment','define','CloudProvider','lodash','util','../../config/logger','api'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc078,0xac));var _0x8c07=function(_0x63ac67,_0x57a99c){_0x63ac67=_0x63ac67-0x0;var _0x20214c=_0xc078[_0x63ac67];return _0x20214c;};'use strict';var _=require(_0x8c07('0x0'));var util=require(_0x8c07('0x1'));var logger=require(_0x8c07('0x2'))(_0x8c07('0x3'));var moment=require('moment');var BPromise=require(_0x8c07('0x4'));var rp=require(_0x8c07('0x5'));var fs=require('fs');var path=require(_0x8c07('0x6'));var rimraf=require(_0x8c07('0x7'));var config=require(_0x8c07('0x8'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x3ffcb0,_0x2913d7){return _0x3ffcb0[_0x8c07('0x9')](_0x8c07('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aa0=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider','lodash','util','../../config/logger'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x8aa0,0x189));var _0x08aa=function(_0x2af7f0,_0x449088){_0x2af7f0=_0x2af7f0-0x0;var _0x31aea4=_0x8aa0[_0x2af7f0];return _0x31aea4;};'use strict';var _=require(_0x08aa('0x0'));var util=require(_0x08aa('0x1'));var logger=require(_0x08aa('0x2'))(_0x08aa('0x3'));var moment=require('moment');var BPromise=require(_0x08aa('0x4'));var rp=require(_0x08aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08aa('0x6'));var config=require(_0x08aa('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x08aa('0x8')]=function(_0x3ab0bf,_0x28ca71){return _0x3ab0bf[_0x08aa('0x9')](_0x08aa('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index eadf82d..c21354c 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 _0x22d3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0x3e48d2,_0x2ab41a){var _0x51af56=function(_0x295f85){while(--_0x295f85){_0x3e48d2['push'](_0x3e48d2['shift']());}};_0x51af56(++_0x2ab41a);}(_0x22d3,0x1a2));var _0x322d=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x22d3[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x322d('0x0'));var util=require(_0x322d('0x1'));var moment=require('moment');var BPromise=require(_0x322d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x322d('0x3'));var db=require(_0x322d('0x4'))['db'];var utils=require(_0x322d('0x5'));var logger=require(_0x322d('0x6'))(_0x322d('0x7'));var config=require(_0x322d('0x8'));var jayson=require(_0x322d('0x9'));var client=jayson[_0x322d('0xa')][_0x322d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d616e,_0x2a9bf1,_0x49b6f3){return new BPromise(function(_0x1d4e48,_0x3893e3){return client[_0x322d('0xc')](_0x2d616e,_0x49b6f3)['then'](function(_0x40ead0){logger[_0x322d('0xd')](_0x322d('0xe'),_0x2a9bf1,_0x322d('0xf'));logger[_0x322d('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x2a9bf1,_0x322d('0xf'),JSON['stringify'](_0x40ead0));if(_0x40ead0['error']){if(_0x40ead0[_0x322d('0x11')]['code']===0x1f4){logger[_0x322d('0x11')]('CloudProvider,\x20%s,\x20%s',_0x2a9bf1,_0x40ead0['error']['message']);return _0x3893e3(_0x40ead0[_0x322d('0x11')]['message']);}logger[_0x322d('0x11')](_0x322d('0xe'),_0x2a9bf1,_0x40ead0[_0x322d('0x11')][_0x322d('0x12')]);return _0x1d4e48(_0x40ead0[_0x322d('0x11')]['message']);}else{logger[_0x322d('0xd')](_0x322d('0xe'),_0x2a9bf1,'request\x20sent');_0x1d4e48(_0x40ead0[_0x322d('0x13')][_0x322d('0x12')]);}})[_0x322d('0x14')](function(_0x200984){logger[_0x322d('0x11')](_0x322d('0xe'),_0x2a9bf1,_0x200984);_0x3893e3(_0x200984);});});} \ No newline at end of file +var _0x7df4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7df4,0x1a3));var _0x47df=function(_0x2995bf,_0x4e094d){_0x2995bf=_0x2995bf-0x0;var _0x290529=_0x7df4[_0x2995bf];return _0x290529;};'use strict';var _=require(_0x47df('0x0'));var util=require(_0x47df('0x1'));var moment=require(_0x47df('0x2'));var BPromise=require(_0x47df('0x3'));var rs=require(_0x47df('0x4'));var fs=require('fs');var Redis=require(_0x47df('0x5'));var db=require(_0x47df('0x6'))['db'];var utils=require(_0x47df('0x7'));var logger=require(_0x47df('0x8'))(_0x47df('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x47df('0xa')][_0x47df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x496ef0,_0x12be8d,_0x1ddb8e){return new BPromise(function(_0x51b107,_0xa2c5e1){return client['request'](_0x496ef0,_0x1ddb8e)[_0x47df('0xc')](function(_0x47ce38){logger[_0x47df('0xd')](_0x47df('0xe'),_0x12be8d,_0x47df('0xf'));logger[_0x47df('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x12be8d,_0x47df('0xf'),JSON[_0x47df('0x11')](_0x47ce38));if(_0x47ce38[_0x47df('0x12')]){if(_0x47ce38[_0x47df('0x12')]['code']===0x1f4){logger[_0x47df('0x12')](_0x47df('0xe'),_0x12be8d,_0x47ce38[_0x47df('0x12')]['message']);return _0xa2c5e1(_0x47ce38['error'][_0x47df('0x13')]);}logger['error'](_0x47df('0xe'),_0x12be8d,_0x47ce38[_0x47df('0x12')][_0x47df('0x13')]);return _0x51b107(_0x47ce38[_0x47df('0x12')]['message']);}else{logger['info'](_0x47df('0xe'),_0x12be8d,_0x47df('0xf'));_0x51b107(_0x47ce38[_0x47df('0x14')][_0x47df('0x13')]);}})[_0x47df('0x15')](function(_0x27056b){logger[_0x47df('0x12')](_0x47df('0xe'),_0x12be8d,_0x27056b);_0xa2c5e1(_0x27056b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 637ff55..a9eb823 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 _0xa6b4=['get','/:id','post','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xa6b4,0x1d7));var _0x4a6b=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0xa6b4[_0x20b29c];return _0x20d81b;};'use strict';var multer=require(_0x4a6b('0x0'));var util=require(_0x4a6b('0x1'));var path=require('path');var timeout=require(_0x4a6b('0x2'));var express=require(_0x4a6b('0x3'));var router=express[_0x4a6b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4a6b('0x5'));var config=require(_0x4a6b('0x6'));var controller=require(_0x4a6b('0x7'));router['get']('/',auth[_0x4a6b('0x8')](),controller['index']);router[_0x4a6b('0x9')](_0x4a6b('0xa'),auth[_0x4a6b('0x8')](),controller['show']);router[_0x4a6b('0xb')]('/',auth[_0x4a6b('0x8')](),controller['create']);router[_0x4a6b('0xc')](_0x4a6b('0xa'),auth[_0x4a6b('0x8')](),controller['update']);router[_0x4a6b('0xd')](_0x4a6b('0xa'),auth[_0x4a6b('0x8')](),controller[_0x4a6b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5ada=['multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x5ada,0xa2));var _0xa5ad=function(_0x459d30,_0x4e010e){_0x459d30=_0x459d30-0x0;var _0x49526c=_0x5ada[_0x459d30];return _0x49526c;};'use strict';var multer=require(_0xa5ad('0x0'));var util=require(_0xa5ad('0x1'));var path=require('path');var timeout=require(_0xa5ad('0x2'));var express=require(_0xa5ad('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa5ad('0x4'));var config=require(_0xa5ad('0x5'));var controller=require(_0xa5ad('0x6'));router[_0xa5ad('0x7')]('/',auth[_0xa5ad('0x8')](),controller[_0xa5ad('0x9')]);router[_0xa5ad('0x7')]('/:id',auth[_0xa5ad('0x8')](),controller[_0xa5ad('0xa')]);router[_0xa5ad('0xb')]('/',auth['isAuthenticated'](),controller[_0xa5ad('0xc')]);router[_0xa5ad('0xd')]('/:id',auth[_0xa5ad('0x8')](),controller['update']);router[_0xa5ad('0xe')](_0xa5ad('0xf'),auth[_0xa5ad('0x8')](),controller[_0xa5ad('0x10')]);module[_0xa5ad('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 20a95c6..e7a8a4b 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 _0x95a5=['sequelize','exports','STRING'];(function(_0x31c37f,_0xbe56ab){var _0xe79a1b=function(_0x143f27){while(--_0x143f27){_0x31c37f['push'](_0x31c37f['shift']());}};_0xe79a1b(++_0xbe56ab);}(_0x95a5,0x1ce));var _0x595a=function(_0x59cf40,_0x4ed36f){_0x59cf40=_0x59cf40-0x0;var _0x48eb49=_0x95a5[_0x59cf40];return _0x48eb49;};'use strict';var Sequelize=require(_0x595a('0x0'));module[_0x595a('0x1')]={'name':{'type':Sequelize[_0x595a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x595a('0x2')]},'companyId':{'type':Sequelize[_0x595a('0x2')]},'website':{'type':Sequelize[_0x595a('0x2')]},'phone':{'type':Sequelize[_0x595a('0x2')]},'fax':{'type':Sequelize[_0x595a('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x595a('0x2')]},'postalCode':{'type':Sequelize[_0x595a('0x2')]},'city':{'type':Sequelize[_0x595a('0x2')]},'country':{'type':Sequelize[_0x595a('0x2')]},'email':{'type':Sequelize[_0x595a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x595a('0x2')]},'sStreet':{'type':Sequelize[_0x595a('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x595a('0x2')]},'sCountry':{'type':Sequelize[_0x595a('0x2')]},'description':{'type':Sequelize[_0x595a('0x2')]}}; \ No newline at end of file +var _0x88b9=['exports','name','STRING'];(function(_0x533f98,_0x2e45f7){var _0x4d3ccc=function(_0x490ff7){while(--_0x490ff7){_0x533f98['push'](_0x533f98['shift']());}};_0x4d3ccc(++_0x2e45f7);}(_0x88b9,0x13e));var _0x988b=function(_0x1292fd,_0x2c45c1){_0x1292fd=_0x1292fd-0x0;var _0x57fdfd=_0x88b9[_0x1292fd];return _0x57fdfd;};'use strict';var Sequelize=require('sequelize');module[_0x988b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x988b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x988b('0x2')]},'companyId':{'type':Sequelize[_0x988b('0x2')]},'website':{'type':Sequelize[_0x988b('0x2')]},'phone':{'type':Sequelize[_0x988b('0x2')]},'fax':{'type':Sequelize[_0x988b('0x2')]},'type':{'type':Sequelize[_0x988b('0x2')]},'street':{'type':Sequelize[_0x988b('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x988b('0x2')]},'country':{'type':Sequelize[_0x988b('0x2')]},'email':{'type':Sequelize[_0x988b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x988b('0x2')]},'sStreet':{'type':Sequelize[_0x988b('0x2')]},'sPostalCode':{'type':Sequelize[_0x988b('0x2')]},'sCity':{'type':Sequelize[_0x988b('0x2')]},'sCountry':{'type':Sequelize[_0x988b('0x2')]},'description':{'type':Sequelize[_0x988b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2863d37..2df175f 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 _0x1838=['params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','pick','options','getContacts','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','map','filter','count','includeAll','include','findAll','rows','catch','show'];(function(_0x264551,_0x4ecdbf){var _0x2c72a5=function(_0x4ec311){while(--_0x4ec311){_0x264551['push'](_0x264551['shift']());}};_0x2c72a5(++_0x4ecdbf);}(_0x1838,0x15a));var _0x8183=function(_0x4ea041,_0x4e56f4){_0x4ea041=_0x4ea041-0x0;var _0x871435=_0x1838[_0x4ea041];return _0x871435;};'use strict';var pdf=require(_0x8183('0x0'));var emlformat=require(_0x8183('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8183('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8183('0x3'));var moment=require(_0x8183('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8183('0x5'));var util=require(_0x8183('0x6'));var path=require(_0x8183('0x7'));var sox=require(_0x8183('0x8'));var csv=require(_0x8183('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8183('0xa'));var squel=require('squel');var crypto=require(_0x8183('0xb'));var jsforce=require(_0x8183('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8183('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8183('0xe'));var as=require(_0x8183('0xf'));var hardwareService=require(_0x8183('0x10'));var logger=require(_0x8183('0x11'))(_0x8183('0x12'));var utils=require('../../config/utils');var config=require(_0x8183('0x13'));var licenseUtil=require(_0x8183('0x14'));var db=require(_0x8183('0x15'))['db'];function respondWithStatusCode(_0x41fe17,_0x5a29bf){_0x5a29bf=_0x5a29bf||0xcc;return function(_0x3e6e2a){if(_0x3e6e2a){return _0x41fe17[_0x8183('0x16')](_0x5a29bf);}return _0x41fe17[_0x8183('0x17')](_0x5a29bf)[_0x8183('0x18')]();};}function respondWithResult(_0x3b0cd3,_0xb32e03){_0xb32e03=_0xb32e03||0xc8;return function(_0x4aa76c){if(_0x4aa76c){return _0x3b0cd3[_0x8183('0x17')](_0xb32e03)['json'](_0x4aa76c);}};}function respondWithFilteredResult(_0x5d36f1,_0x9b87f2){return function(_0x225df2){if(_0x225df2){var _0x4f9dd5=_0x225df2['count'],_0x2896ad=_0x9b87f2[_0x8183('0x19')],_0x79880a=_0x9b87f2['offset']+_0x9b87f2['limit'],_0x57e84b;if(_0x79880a>=_0x4f9dd5){_0x79880a=_0x4f9dd5;_0x57e84b=0xc8;}else{_0x57e84b=0xce;}_0x5d36f1[_0x8183('0x17')](_0x57e84b);return _0x5d36f1[_0x8183('0x1a')]('Content-Range',_0x2896ad+'-'+_0x79880a+'/'+_0x4f9dd5)['json'](_0x225df2);}return null;};}function patchUpdates(_0x31b9a7){return function(_0x200e27){try{jsonpatch[_0x8183('0x1b')](_0x200e27,_0x31b9a7,!![]);}catch(_0x3de969){return BPromise['reject'](_0x3de969);}return _0x200e27[_0x8183('0x1c')]();};}function saveUpdates(_0x1c377d,_0x5c0db9){return function(_0xc06c13){if(_0xc06c13){return _0xc06c13[_0x8183('0x1d')](_0x1c377d)[_0x8183('0x1e')](function(_0x5610f5){return _0x5610f5;});}return null;};}function removeEntity(_0x5440fc,_0x32fa7c){return function(_0x41949a){if(_0x41949a){return _0x41949a[_0x8183('0x1f')]()[_0x8183('0x1e')](function(){var _0x4e5dc4=_0x41949a[_0x8183('0x20')]({'plain':!![]});var _0x13828d=_0x8183('0x21');return db[_0x8183('0x22')][_0x8183('0x1f')]({'where':{'type':_0x13828d,'resourceId':_0x4e5dc4['id']}})[_0x8183('0x1e')](function(){return _0x41949a;});})[_0x8183('0x1e')](function(){_0x5440fc[_0x8183('0x17')](0xcc)[_0x8183('0x18')]();});}};}function handleEntityNotFound(_0x23f5c4,_0x4ad8a3){return function(_0xbc7df8){if(!_0xbc7df8){_0x23f5c4['sendStatus'](0x194);}return _0xbc7df8;};}function handleError(_0x13e34e,_0x2780e4){_0x2780e4=_0x2780e4||0x1f4;return function(_0x4f0d24){logger[_0x8183('0x23')](_0x4f0d24['stack']);if(_0x4f0d24[_0x8183('0x24')]){delete _0x4f0d24[_0x8183('0x24')];}_0x13e34e['status'](_0x2780e4)[_0x8183('0x25')](_0x4f0d24);};}exports[_0x8183('0x26')]=function(_0x494ea5,_0x29ca36){var _0xb96090={},_0x240a2b={},_0x4db90d={'count':0x0,'rows':[]};return db[_0x8183('0x27')][_0x8183('0x28')]()['then'](function(_0x431e25){_0x240a2b[_0x8183('0x29')]=_[_0x8183('0x2a')](_0x431e25);_0x240a2b[_0x8183('0x2b')]=_[_0x8183('0x2a')](_0x494ea5[_0x8183('0x2b')]);_0x240a2b['filters']=_[_0x8183('0x2c')](_0x240a2b[_0x8183('0x29')],_0x240a2b[_0x8183('0x2b')]);_0xb96090['attributes']=_[_0x8183('0x2c')](_0x240a2b['model'],qs['fields'](_0x494ea5['query']['fields']));_0xb96090[_0x8183('0x2d')]=_0xb96090[_0x8183('0x2d')][_0x8183('0x2e')]?_0xb96090[_0x8183('0x2d')]:_0x240a2b['model'];if(!_0x494ea5[_0x8183('0x2b')][_0x8183('0x2f')](_0x8183('0x30'))){_0xb96090[_0x8183('0x31')]=qs[_0x8183('0x31')](_0x494ea5[_0x8183('0x2b')][_0x8183('0x31')]);_0xb96090[_0x8183('0x19')]=qs[_0x8183('0x19')](_0x494ea5['query']['offset']);}_0xb96090[_0x8183('0x32')]=qs[_0x8183('0x33')](_0x494ea5[_0x8183('0x2b')][_0x8183('0x33')]);_0xb96090[_0x8183('0x34')]=qs[_0x8183('0x35')](_['pick'](_0x494ea5['query'],_0x240a2b[_0x8183('0x35')]),_0x431e25);if(_0x494ea5[_0x8183('0x2b')]['filter']){_0xb96090[_0x8183('0x34')]=_[_0x8183('0x36')](_0xb96090['where'],{'$or':_[_0x8183('0x37')](_0xb96090['attributes'],function(_0x5e0c16){var _0x444a7a={};_0x444a7a[_0x5e0c16]={'$like':'%'+_0x494ea5[_0x8183('0x2b')][_0x8183('0x38')]+'%'};return _0x444a7a;})});}_0xb96090=_[_0x8183('0x36')]({},_0xb96090,_0x494ea5['options']);var _0x6218af={'where':_0xb96090[_0x8183('0x34')]};return db['CmCompany'][_0x8183('0x39')](_0x6218af)[_0x8183('0x1e')](function(_0x57135e){_0x4db90d[_0x8183('0x39')]=_0x57135e;if(_0x494ea5[_0x8183('0x2b')][_0x8183('0x3a')]){_0xb96090[_0x8183('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x8183('0x3c')](_0xb96090);})[_0x8183('0x1e')](function(_0x1cfa21){_0x4db90d[_0x8183('0x3d')]=_0x1cfa21;return _0x4db90d;})[_0x8183('0x1e')](respondWithFilteredResult(_0x29ca36,_0xb96090))[_0x8183('0x3e')](handleError(_0x29ca36,null));})['catch'](handleError(_0x29ca36,null));};exports[_0x8183('0x3f')]=function(_0x1c750d,_0x47e4ff){var _0x151410={'raw':![],'where':{'id':_0x1c750d[_0x8183('0x40')]['id']}},_0xc658d9={};_0xc658d9[_0x8183('0x29')]=_[_0x8183('0x2a')](db[_0x8183('0x27')][_0x8183('0x41')]);_0xc658d9[_0x8183('0x2b')]=_[_0x8183('0x2a')](_0x1c750d[_0x8183('0x2b')]);_0xc658d9[_0x8183('0x35')]=_[_0x8183('0x2c')](_0xc658d9[_0x8183('0x29')],_0xc658d9['query']);_0x151410[_0x8183('0x2d')]=_[_0x8183('0x2c')](_0xc658d9['model'],qs['fields'](_0x1c750d[_0x8183('0x2b')][_0x8183('0x42')]));_0x151410[_0x8183('0x2d')]=_0x151410[_0x8183('0x2d')][_0x8183('0x2e')]?_0x151410[_0x8183('0x2d')]:_0xc658d9['model'];if(_0x1c750d['query'][_0x8183('0x3a')]){_0x151410[_0x8183('0x3b')]=[{'all':!![]}];}_0x151410=_[_0x8183('0x36')]({},_0x151410,_0x1c750d['options']);return db[_0x8183('0x27')][_0x8183('0x43')](_0x151410)[_0x8183('0x1e')](handleEntityNotFound(_0x47e4ff,null))[_0x8183('0x1e')](respondWithResult(_0x47e4ff,null))[_0x8183('0x3e')](handleError(_0x47e4ff,null));};exports[_0x8183('0x44')]=function(_0x337100,_0x3be866){return db[_0x8183('0x27')][_0x8183('0x44')](_0x337100[_0x8183('0x45')],{})[_0x8183('0x1e')](function(_0x4b0576){var _0x406530=_0x337100[_0x8183('0x46')]['get']({'plain':!![]});if(!_0x406530)throw new Error(_0x8183('0x47'));if(_0x406530['role']===_0x8183('0x46')){var _0x504e40=_0x4b0576[_0x8183('0x20')]({'plain':!![]});var _0x5a0db4=_0x8183('0x21');return db['UserProfileSection']['find']({'where':{'name':_0x5a0db4,'userProfileId':_0x406530[_0x8183('0x48')]},'raw':!![]})[_0x8183('0x1e')](function(_0x5477a3){if(_0x5477a3&&_0x5477a3[_0x8183('0x49')]===0x0){return db['UserProfileResource'][_0x8183('0x44')]({'name':_0x504e40[_0x8183('0x24')],'resourceId':_0x504e40['id'],'type':_0x5477a3['name'],'sectionId':_0x5477a3['id']},{})[_0x8183('0x1e')](function(){return _0x4b0576;});}else{return _0x4b0576;}})[_0x8183('0x3e')](function(_0x3f5504){logger[_0x8183('0x23')](_0x8183('0x4a'),_0x3f5504);throw _0x3f5504;});}return _0x4b0576;})[_0x8183('0x1e')](respondWithResult(_0x3be866,0xc9))[_0x8183('0x3e')](handleError(_0x3be866,null));};exports[_0x8183('0x1d')]=function(_0x2c0c2f,_0x18642c){if(_0x2c0c2f[_0x8183('0x45')]['id']){delete _0x2c0c2f[_0x8183('0x45')]['id'];}return db[_0x8183('0x27')][_0x8183('0x43')]({'where':{'id':_0x2c0c2f['params']['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x18642c,null))[_0x8183('0x1e')](saveUpdates(_0x2c0c2f[_0x8183('0x45')],null))[_0x8183('0x1e')](respondWithResult(_0x18642c,null))[_0x8183('0x3e')](handleError(_0x18642c,null));};exports[_0x8183('0x1f')]=function(_0x1016f4,_0x51c552){return db[_0x8183('0x27')]['find']({'where':{'id':_0x1016f4['params']['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x51c552,null))[_0x8183('0x1e')](removeEntity(_0x51c552,null))[_0x8183('0x3e')](handleError(_0x51c552,null));};exports['describe']=function(_0x236575,_0x366256){return db[_0x8183('0x27')][_0x8183('0x28')]()[_0x8183('0x1e')](respondWithResult(_0x366256,null))[_0x8183('0x3e')](handleError(_0x366256,null));};exports[_0x8183('0x4b')]=function(_0x5055d1,_0x482f62,_0x47c64d){return db[_0x8183('0x4c')][_0x8183('0x43')]({'where':{'id':_0x5055d1[_0x8183('0x40')]['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x482f62,null))[_0x8183('0x1e')](function(_0x4adb7f){if(_0x4adb7f){return _0x4adb7f[_0x8183('0x4b')](_0x5055d1[_0x8183('0x45')][_0x8183('0x4d')],_[_0x8183('0x4e')](_0x5055d1[_0x8183('0x45')],[_0x8183('0x4d'),'id'])||{});}})[_0x8183('0x1e')](respondWithResult(_0x482f62,null))[_0x8183('0x3e')](handleError(_0x482f62,null));};exports['getContacts']=function(_0x111826,_0x633a55,_0x3e6500){var _0x12db3f={};var _0x1afb82={};var _0x516bd7;var _0x54fa0c;return db[_0x8183('0x27')]['findOne']({'where':{'id':_0x111826[_0x8183('0x40')]['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x633a55,null))[_0x8183('0x1e')](function(_0x47dcf8){if(_0x47dcf8){_0x516bd7=_0x47dcf8;_0x1afb82[_0x8183('0x29')]=_[_0x8183('0x2a')](db['CmContact'][_0x8183('0x41')]);_0x1afb82[_0x8183('0x2b')]=_['keys'](_0x111826[_0x8183('0x2b')]);_0x1afb82[_0x8183('0x35')]=_[_0x8183('0x2c')](_0x1afb82[_0x8183('0x29')],_0x1afb82['query']);_0x12db3f[_0x8183('0x2d')]=_['intersection'](_0x1afb82[_0x8183('0x29')],qs['fields'](_0x111826[_0x8183('0x2b')][_0x8183('0x42')]));_0x12db3f['attributes']=_0x12db3f['attributes'][_0x8183('0x2e')]?_0x12db3f[_0x8183('0x2d')]:_0x1afb82[_0x8183('0x29')];_0x12db3f[_0x8183('0x32')]=qs[_0x8183('0x33')](_0x111826[_0x8183('0x2b')][_0x8183('0x33')]);_0x12db3f[_0x8183('0x34')]=qs[_0x8183('0x35')](_[_0x8183('0x4f')](_0x111826[_0x8183('0x2b')],_0x1afb82[_0x8183('0x35')]));if(_0x111826[_0x8183('0x2b')][_0x8183('0x38')]){_0x12db3f['where']=_[_0x8183('0x36')](_0x12db3f[_0x8183('0x34')],{'$or':_[_0x8183('0x37')](_0x12db3f[_0x8183('0x2d')],function(_0x49576c){var _0xe87971={};_0xe87971[_0x49576c]={'$like':'%'+_0x111826[_0x8183('0x2b')]['filter']+'%'};return _0xe87971;})});}_0x12db3f=_[_0x8183('0x36')]({},_0x12db3f,_0x111826[_0x8183('0x50')]);return _0x516bd7[_0x8183('0x51')](_0x12db3f);}})[_0x8183('0x1e')](function(_0x3ba56d){if(_0x3ba56d){_0x54fa0c=_0x3ba56d[_0x8183('0x2e')];if(!_0x111826[_0x8183('0x2b')][_0x8183('0x2f')](_0x8183('0x30'))){_0x12db3f[_0x8183('0x31')]=qs[_0x8183('0x31')](_0x111826[_0x8183('0x2b')][_0x8183('0x31')]);_0x12db3f[_0x8183('0x19')]=qs[_0x8183('0x19')](_0x111826[_0x8183('0x2b')][_0x8183('0x19')]);}return _0x516bd7[_0x8183('0x51')](_0x12db3f);}})[_0x8183('0x1e')](function(_0x288ef0){if(_0x288ef0){return _0x288ef0?{'count':_0x54fa0c,'rows':_0x288ef0}:null;}})[_0x8183('0x1e')](respondWithResult(_0x633a55,null))[_0x8183('0x3e')](handleError(_0x633a55,null));}; \ No newline at end of file +var _0xf983=['addContacts','CmContact','ids','omit','getContacts','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','stack','name','index','CmCompany','describe','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','role','Companies','UserProfileSection','userProfileId','UserProfileResource','error','update','params'];(function(_0x3c7c71,_0x421b97){var _0x516c12=function(_0x34b991){while(--_0x34b991){_0x3c7c71['push'](_0x3c7c71['shift']());}};_0x516c12(++_0x421b97);}(_0xf983,0x1b0));var _0x3f98=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xf983[_0x19b84f];return _0x18067b;};'use strict';var pdf=require(_0x3f98('0x0'));var emlformat=require(_0x3f98('0x1'));var rimraf=require(_0x3f98('0x2'));var zipdir=require(_0x3f98('0x3'));var jsonpatch=require(_0x3f98('0x4'));var rp=require(_0x3f98('0x5'));var moment=require(_0x3f98('0x6'));var BPromise=require(_0x3f98('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f98('0x8'));var sox=require(_0x3f98('0x9'));var csv=require(_0x3f98('0xa'));var ejs=require(_0x3f98('0xb'));var fs=require('fs');var _=require(_0x3f98('0xc'));var squel=require(_0x3f98('0xd'));var crypto=require(_0x3f98('0xe'));var jsforce=require(_0x3f98('0xf'));var deskjs=require(_0x3f98('0x10'));var toCsv=require(_0x3f98('0xa'));var querystring=require(_0x3f98('0x11'));var Papa=require('papaparse');var Redis=require(_0x3f98('0x12'));var authService=require(_0x3f98('0x13'));var qs=require(_0x3f98('0x14'));var as=require(_0x3f98('0x15'));var hardwareService=require(_0x3f98('0x16'));var logger=require('../../config/logger')(_0x3f98('0x17'));var utils=require(_0x3f98('0x18'));var config=require(_0x3f98('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2597b2,_0x1313a9){_0x1313a9=_0x1313a9||0xcc;return function(_0x26cd84){if(_0x26cd84){return _0x2597b2[_0x3f98('0x1a')](_0x1313a9);}return _0x2597b2[_0x3f98('0x1b')](_0x1313a9)[_0x3f98('0x1c')]();};}function respondWithResult(_0x376228,_0x1bb5c7){_0x1bb5c7=_0x1bb5c7||0xc8;return function(_0x59f5c5){if(_0x59f5c5){return _0x376228[_0x3f98('0x1b')](_0x1bb5c7)[_0x3f98('0x1d')](_0x59f5c5);}};}function respondWithFilteredResult(_0x4f19f1,_0x5454c8){return function(_0x52b3e0){if(_0x52b3e0){var _0x2edb3a=_0x52b3e0[_0x3f98('0x1e')],_0x2ec340=_0x5454c8[_0x3f98('0x1f')],_0x353149=_0x5454c8['offset']+_0x5454c8[_0x3f98('0x20')],_0x19a170;if(_0x353149>=_0x2edb3a){_0x353149=_0x2edb3a;_0x19a170=0xc8;}else{_0x19a170=0xce;}_0x4f19f1[_0x3f98('0x1b')](_0x19a170);return _0x4f19f1['set'](_0x3f98('0x21'),_0x2ec340+'-'+_0x353149+'/'+_0x2edb3a)[_0x3f98('0x1d')](_0x52b3e0);}return null;};}function patchUpdates(_0x243cc9){return function(_0x58865b){try{jsonpatch['apply'](_0x58865b,_0x243cc9,!![]);}catch(_0x21ff06){return BPromise[_0x3f98('0x22')](_0x21ff06);}return _0x58865b[_0x3f98('0x23')]();};}function saveUpdates(_0x492d52,_0xe4765e){return function(_0x30c8c5){if(_0x30c8c5){return _0x30c8c5['update'](_0x492d52)[_0x3f98('0x24')](function(_0x12a829){return _0x12a829;});}return null;};}function removeEntity(_0x58e57a,_0xbfd5e4){return function(_0x58a2d0){if(_0x58a2d0){return _0x58a2d0[_0x3f98('0x25')]()[_0x3f98('0x24')](function(){var _0x1f2155=_0x58a2d0['get']({'plain':!![]});var _0x20c172='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x20c172,'resourceId':_0x1f2155['id']}})['then'](function(){return _0x58a2d0;});})[_0x3f98('0x24')](function(){_0x58e57a[_0x3f98('0x1b')](0xcc)[_0x3f98('0x1c')]();});}};}function handleEntityNotFound(_0x80d328,_0x2c7b61){return function(_0x12c58e){if(!_0x12c58e){_0x80d328['sendStatus'](0x194);}return _0x12c58e;};}function handleError(_0x1e50df,_0x49765d){_0x49765d=_0x49765d||0x1f4;return function(_0x3e01bf){logger['error'](_0x3e01bf[_0x3f98('0x26')]);if(_0x3e01bf[_0x3f98('0x27')]){delete _0x3e01bf[_0x3f98('0x27')];}_0x1e50df[_0x3f98('0x1b')](_0x49765d)['send'](_0x3e01bf);};}exports[_0x3f98('0x28')]=function(_0x54ae13,_0x27948d){var _0x33d594={},_0x4cab9a={},_0x527e23={'count':0x0,'rows':[]};return db[_0x3f98('0x29')][_0x3f98('0x2a')]()[_0x3f98('0x24')](function(_0x581788){_0x4cab9a[_0x3f98('0x2b')]=_['keys'](_0x581788);_0x4cab9a[_0x3f98('0x2c')]=_[_0x3f98('0x2d')](_0x54ae13['query']);_0x4cab9a['filters']=_['intersection'](_0x4cab9a[_0x3f98('0x2b')],_0x4cab9a[_0x3f98('0x2c')]);_0x33d594[_0x3f98('0x2e')]=_[_0x3f98('0x2f')](_0x4cab9a[_0x3f98('0x2b')],qs[_0x3f98('0x30')](_0x54ae13[_0x3f98('0x2c')][_0x3f98('0x30')]));_0x33d594['attributes']=_0x33d594[_0x3f98('0x2e')][_0x3f98('0x31')]?_0x33d594[_0x3f98('0x2e')]:_0x4cab9a[_0x3f98('0x2b')];if(!_0x54ae13[_0x3f98('0x2c')]['hasOwnProperty']('nolimit')){_0x33d594[_0x3f98('0x20')]=qs[_0x3f98('0x20')](_0x54ae13[_0x3f98('0x2c')][_0x3f98('0x20')]);_0x33d594[_0x3f98('0x1f')]=qs[_0x3f98('0x1f')](_0x54ae13['query'][_0x3f98('0x1f')]);}_0x33d594[_0x3f98('0x32')]=qs[_0x3f98('0x33')](_0x54ae13['query']['sort']);_0x33d594[_0x3f98('0x34')]=qs[_0x3f98('0x35')](_['pick'](_0x54ae13[_0x3f98('0x2c')],_0x4cab9a[_0x3f98('0x35')]),_0x581788);if(_0x54ae13['query'][_0x3f98('0x36')]){_0x33d594['where']=_[_0x3f98('0x37')](_0x33d594['where'],{'$or':_[_0x3f98('0x38')](_0x33d594[_0x3f98('0x2e')],function(_0x828adb){var _0x989d24={};_0x989d24[_0x828adb]={'$like':'%'+_0x54ae13[_0x3f98('0x2c')][_0x3f98('0x36')]+'%'};return _0x989d24;})});}_0x33d594=_[_0x3f98('0x37')]({},_0x33d594,_0x54ae13[_0x3f98('0x39')]);var _0x1a1672={'where':_0x33d594[_0x3f98('0x34')]};return db[_0x3f98('0x29')][_0x3f98('0x1e')](_0x1a1672)[_0x3f98('0x24')](function(_0x461c80){_0x527e23[_0x3f98('0x1e')]=_0x461c80;if(_0x54ae13['query'][_0x3f98('0x3a')]){_0x33d594[_0x3f98('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x3f98('0x3c')](_0x33d594);})[_0x3f98('0x24')](function(_0x1276be){_0x527e23[_0x3f98('0x3d')]=_0x1276be;return _0x527e23;})[_0x3f98('0x24')](respondWithFilteredResult(_0x27948d,_0x33d594))['catch'](handleError(_0x27948d,null));})[_0x3f98('0x3e')](handleError(_0x27948d,null));};exports[_0x3f98('0x3f')]=function(_0x5dfb05,_0x414dab){var _0x256113={'raw':![],'where':{'id':_0x5dfb05['params']['id']}},_0xe68efc={};_0xe68efc[_0x3f98('0x2b')]=_[_0x3f98('0x2d')](db['CmCompany'][_0x3f98('0x40')]);_0xe68efc['query']=_['keys'](_0x5dfb05[_0x3f98('0x2c')]);_0xe68efc['filters']=_[_0x3f98('0x2f')](_0xe68efc[_0x3f98('0x2b')],_0xe68efc[_0x3f98('0x2c')]);_0x256113[_0x3f98('0x2e')]=_[_0x3f98('0x2f')](_0xe68efc[_0x3f98('0x2b')],qs[_0x3f98('0x30')](_0x5dfb05['query'][_0x3f98('0x30')]));_0x256113[_0x3f98('0x2e')]=_0x256113[_0x3f98('0x2e')]['length']?_0x256113[_0x3f98('0x2e')]:_0xe68efc[_0x3f98('0x2b')];if(_0x5dfb05['query'][_0x3f98('0x3a')]){_0x256113[_0x3f98('0x3b')]=[{'all':!![]}];}_0x256113=_[_0x3f98('0x37')]({},_0x256113,_0x5dfb05[_0x3f98('0x39')]);return db[_0x3f98('0x29')][_0x3f98('0x41')](_0x256113)[_0x3f98('0x24')](handleEntityNotFound(_0x414dab,null))[_0x3f98('0x24')](respondWithResult(_0x414dab,null))['catch'](handleError(_0x414dab,null));};exports['create']=function(_0x58d39e,_0x1259c0){return db[_0x3f98('0x29')][_0x3f98('0x42')](_0x58d39e[_0x3f98('0x43')],{})['then'](function(_0x406146){var _0x54589c=_0x58d39e[_0x3f98('0x44')][_0x3f98('0x45')]({'plain':!![]});if(!_0x54589c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54589c[_0x3f98('0x46')]==='user'){var _0x1cbf7c=_0x406146[_0x3f98('0x45')]({'plain':!![]});var _0x413ae6=_0x3f98('0x47');return db[_0x3f98('0x48')][_0x3f98('0x41')]({'where':{'name':_0x413ae6,'userProfileId':_0x54589c[_0x3f98('0x49')]},'raw':!![]})[_0x3f98('0x24')](function(_0x509b5d){if(_0x509b5d&&_0x509b5d['autoAssociation']===0x0){return db[_0x3f98('0x4a')][_0x3f98('0x42')]({'name':_0x1cbf7c[_0x3f98('0x27')],'resourceId':_0x1cbf7c['id'],'type':_0x509b5d[_0x3f98('0x27')],'sectionId':_0x509b5d['id']},{})[_0x3f98('0x24')](function(){return _0x406146;});}else{return _0x406146;}})[_0x3f98('0x3e')](function(_0x3d90b7){logger[_0x3f98('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d90b7);throw _0x3d90b7;});}return _0x406146;})[_0x3f98('0x24')](respondWithResult(_0x1259c0,0xc9))[_0x3f98('0x3e')](handleError(_0x1259c0,null));};exports[_0x3f98('0x4c')]=function(_0x2aaff4,_0x34ac95){if(_0x2aaff4[_0x3f98('0x43')]['id']){delete _0x2aaff4[_0x3f98('0x43')]['id'];}return db['CmCompany'][_0x3f98('0x41')]({'where':{'id':_0x2aaff4[_0x3f98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34ac95,null))['then'](saveUpdates(_0x2aaff4['body'],null))['then'](respondWithResult(_0x34ac95,null))['catch'](handleError(_0x34ac95,null));};exports[_0x3f98('0x25')]=function(_0x3f53f3,_0x55a32c){return db['CmCompany']['find']({'where':{'id':_0x3f53f3[_0x3f98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x55a32c,null))[_0x3f98('0x24')](removeEntity(_0x55a32c,null))[_0x3f98('0x3e')](handleError(_0x55a32c,null));};exports[_0x3f98('0x2a')]=function(_0x38fa5c,_0x53ae2e){return db['CmCompany'][_0x3f98('0x2a')]()[_0x3f98('0x24')](respondWithResult(_0x53ae2e,null))[_0x3f98('0x3e')](handleError(_0x53ae2e,null));};exports[_0x3f98('0x4e')]=function(_0x3bf403,_0x34ed33,_0x43ba92){return db[_0x3f98('0x4f')][_0x3f98('0x41')]({'where':{'id':_0x3bf403[_0x3f98('0x4d')]['id']}})[_0x3f98('0x24')](handleEntityNotFound(_0x34ed33,null))[_0x3f98('0x24')](function(_0x74dd2d){if(_0x74dd2d){return _0x74dd2d[_0x3f98('0x4e')](_0x3bf403['body'][_0x3f98('0x50')],_[_0x3f98('0x51')](_0x3bf403[_0x3f98('0x43')],[_0x3f98('0x50'),'id'])||{});}})['then'](respondWithResult(_0x34ed33,null))['catch'](handleError(_0x34ed33,null));};exports[_0x3f98('0x52')]=function(_0x37237b,_0x24ed19,_0x121c11){var _0x1e0c78={};var _0x501132={};var _0x1c3437;var _0x3ec82e;return db[_0x3f98('0x29')]['findOne']({'where':{'id':_0x37237b[_0x3f98('0x4d')]['id']}})[_0x3f98('0x24')](handleEntityNotFound(_0x24ed19,null))['then'](function(_0x3669d7){if(_0x3669d7){_0x1c3437=_0x3669d7;_0x501132[_0x3f98('0x2b')]=_[_0x3f98('0x2d')](db[_0x3f98('0x4f')][_0x3f98('0x40')]);_0x501132[_0x3f98('0x2c')]=_[_0x3f98('0x2d')](_0x37237b[_0x3f98('0x2c')]);_0x501132['filters']=_['intersection'](_0x501132[_0x3f98('0x2b')],_0x501132['query']);_0x1e0c78['attributes']=_[_0x3f98('0x2f')](_0x501132[_0x3f98('0x2b')],qs[_0x3f98('0x30')](_0x37237b[_0x3f98('0x2c')]['fields']));_0x1e0c78[_0x3f98('0x2e')]=_0x1e0c78['attributes']['length']?_0x1e0c78['attributes']:_0x501132[_0x3f98('0x2b')];_0x1e0c78['order']=qs[_0x3f98('0x33')](_0x37237b[_0x3f98('0x2c')][_0x3f98('0x33')]);_0x1e0c78['where']=qs[_0x3f98('0x35')](_['pick'](_0x37237b['query'],_0x501132[_0x3f98('0x35')]));if(_0x37237b[_0x3f98('0x2c')][_0x3f98('0x36')]){_0x1e0c78[_0x3f98('0x34')]=_[_0x3f98('0x37')](_0x1e0c78[_0x3f98('0x34')],{'$or':_['map'](_0x1e0c78[_0x3f98('0x2e')],function(_0x2c8cd1){var _0x2f91f0={};_0x2f91f0[_0x2c8cd1]={'$like':'%'+_0x37237b[_0x3f98('0x2c')][_0x3f98('0x36')]+'%'};return _0x2f91f0;})});}_0x1e0c78=_['merge']({},_0x1e0c78,_0x37237b[_0x3f98('0x39')]);return _0x1c3437[_0x3f98('0x52')](_0x1e0c78);}})[_0x3f98('0x24')](function(_0x5cb2ef){if(_0x5cb2ef){_0x3ec82e=_0x5cb2ef['length'];if(!_0x37237b[_0x3f98('0x2c')][_0x3f98('0x53')](_0x3f98('0x54'))){_0x1e0c78[_0x3f98('0x20')]=qs[_0x3f98('0x20')](_0x37237b['query'][_0x3f98('0x20')]);_0x1e0c78['offset']=qs[_0x3f98('0x1f')](_0x37237b['query'][_0x3f98('0x1f')]);}return _0x1c3437[_0x3f98('0x52')](_0x1e0c78);}})[_0x3f98('0x24')](function(_0x192e6f){if(_0x192e6f){return _0x192e6f?{'count':_0x3ec82e,'rows':_0x192e6f}:null;}})['then'](respondWithResult(_0x24ed19,null))['catch'](handleError(_0x24ed19,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index f221d69..6a8ee88 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 _0xd67b=['bluebird','path','../../config/environment','exports','define','CmCompany','cm_companies','util','api','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd67b,0x133));var _0xbd67=function(_0x254222,_0x13208e){_0x254222=_0x254222-0x0;var _0x3721bd=_0xd67b[_0x254222];return _0x3721bd;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./cmCompany.attributes');module[_0xbd67('0x6')]=function(_0xa5c384,_0x2ad142){return _0xa5c384[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':_0xbd67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dee=['../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x5eb072,_0x319fb3){var _0x4bddbb=function(_0x2fefc4){while(--_0x2fefc4){_0x5eb072['push'](_0x5eb072['shift']());}};_0x4bddbb(++_0x319fb3);}(_0x0dee,0xf7));var _0xe0de=function(_0x56d8bc,_0x112e9b){_0x56d8bc=_0x56d8bc-0x0;var _0x240932=_0x0dee[_0x56d8bc];return _0x240932;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var logger=require('../../config/logger')(_0xe0de('0x2'));var moment=require('moment');var BPromise=require(_0xe0de('0x3'));var rp=require(_0xe0de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0de('0x5'));var config=require(_0xe0de('0x6'));var attributes=require(_0xe0de('0x7'));module['exports']=function(_0x2fc94c,_0x4957d7){return _0x2fc94c[_0xe0de('0x8')](_0xe0de('0x9'),attributes,{'tableName':_0xe0de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 0732d2a..0977944 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 _0x6f68=['../../mysqldb','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x7c83a6,_0x2ec988){var _0x4cd245=function(_0x649baf){while(--_0x649baf){_0x7c83a6['push'](_0x7c83a6['shift']());}};_0x4cd245(++_0x2ec988);}(_0x6f68,0x1c6));var _0x86f6=function(_0x2f3de9,_0x277836){_0x2f3de9=_0x2f3de9-0x0;var _0x2be67a=_0x6f68[_0x2f3de9];return _0x2be67a;};'use strict';var _=require(_0x86f6('0x0'));var util=require(_0x86f6('0x1'));var moment=require(_0x86f6('0x2'));var BPromise=require(_0x86f6('0x3'));var rs=require(_0x86f6('0x4'));var fs=require('fs');var Redis=require(_0x86f6('0x5'));var db=require(_0x86f6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x86f6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x347582,_0x42ab8a,_0x474e87){return new BPromise(function(_0x50112a,_0x6531c4){return client[_0x86f6('0x8')](_0x347582,_0x474e87)[_0x86f6('0x9')](function(_0x2a3f66){logger[_0x86f6('0xa')](_0x86f6('0xb'),_0x42ab8a,_0x86f6('0xc'));logger[_0x86f6('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x42ab8a,_0x86f6('0xc'),JSON[_0x86f6('0xe')](_0x2a3f66));if(_0x2a3f66[_0x86f6('0xf')]){if(_0x2a3f66[_0x86f6('0xf')][_0x86f6('0x10')]===0x1f4){logger[_0x86f6('0xf')]('CmCompany,\x20%s,\x20%s',_0x42ab8a,_0x2a3f66['error']['message']);return _0x6531c4(_0x2a3f66[_0x86f6('0xf')][_0x86f6('0x11')]);}logger[_0x86f6('0xf')]('CmCompany,\x20%s,\x20%s',_0x42ab8a,_0x2a3f66[_0x86f6('0xf')]['message']);return _0x50112a(_0x2a3f66['error']['message']);}else{logger[_0x86f6('0xa')](_0x86f6('0xb'),_0x42ab8a,'request\x20sent');_0x50112a(_0x2a3f66[_0x86f6('0x12')][_0x86f6('0x11')]);}})[_0x86f6('0x13')](function(_0x59c116){logger[_0x86f6('0xf')](_0x86f6('0xb'),_0x42ab8a,_0x59c116);_0x6531c4(_0x59c116);});});} \ No newline at end of file +var _0x8faf=['debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x8faf,0x1a0));var _0xf8fa=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x8faf[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xf8fa('0x0'));var util=require(_0xf8fa('0x1'));var moment=require(_0xf8fa('0x2'));var BPromise=require(_0xf8fa('0x3'));var rs=require(_0xf8fa('0x4'));var fs=require('fs');var Redis=require(_0xf8fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8fa('0x6'));var logger=require(_0xf8fa('0x7'))(_0xf8fa('0x8'));var config=require('../../config/environment');var jayson=require(_0xf8fa('0x9'));var client=jayson[_0xf8fa('0xa')][_0xf8fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x104a1b,_0x4f1f47,_0x2db9a2){return new BPromise(function(_0x1d1a36,_0x368f44){return client[_0xf8fa('0xc')](_0x104a1b,_0x2db9a2)[_0xf8fa('0xd')](function(_0x47b96f){logger['info'](_0xf8fa('0xe'),_0x4f1f47,_0xf8fa('0xf'));logger[_0xf8fa('0x10')](_0xf8fa('0x11'),_0x4f1f47,'request\x20sent',JSON['stringify'](_0x47b96f));if(_0x47b96f[_0xf8fa('0x12')]){if(_0x47b96f['error'][_0xf8fa('0x13')]===0x1f4){logger[_0xf8fa('0x12')]('CmCompany,\x20%s,\x20%s',_0x4f1f47,_0x47b96f[_0xf8fa('0x12')][_0xf8fa('0x14')]);return _0x368f44(_0x47b96f['error'][_0xf8fa('0x14')]);}logger[_0xf8fa('0x12')](_0xf8fa('0xe'),_0x4f1f47,_0x47b96f[_0xf8fa('0x12')][_0xf8fa('0x14')]);return _0x1d1a36(_0x47b96f[_0xf8fa('0x12')][_0xf8fa('0x14')]);}else{logger[_0xf8fa('0x15')]('CmCompany,\x20%s,\x20%s',_0x4f1f47,_0xf8fa('0xf'));_0x1d1a36(_0x47b96f[_0xf8fa('0x16')][_0xf8fa('0x14')]);}})[_0xf8fa('0x17')](function(_0x3e1a0c){logger[_0xf8fa('0x12')](_0xf8fa('0xe'),_0x4f1f47,_0x3e1a0c);_0x368f44(_0x3e1a0c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 283d4f6..bd7e937 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 _0xe3da=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','/:id/contacts','getContacts','post','addContacts'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var auth=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['describe']);router[_0xae3d('0xa')](_0xae3d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xae3d('0xa')](_0xae3d('0xf'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xb')](),controller['create']);router[_0xae3d('0x11')]('/:id/contacts',auth[_0xae3d('0xb')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router[_0xae3d('0x15')](_0xae3d('0xe'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x16')]);module[_0xae3d('0x17')]=router; \ No newline at end of file +var _0x25e7=['get','/:id','show','/:id/contacts','getContacts','post','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','isAuthenticated','describe'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x25e7,0x1d6));var _0x725e=function(_0x295354,_0x2d43a8){_0x295354=_0x295354-0x0;var _0x371c48=_0x25e7[_0x295354];return _0x371c48;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var auth=require(_0x725e('0x6'));var interaction=require(_0x725e('0x7'));var config=require(_0x725e('0x8'));var controller=require(_0x725e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x725e('0xa')]);router['get']('/describe',auth[_0x725e('0xb')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller[_0x725e('0xf')]);router[_0x725e('0xd')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller[_0x725e('0x11')]);router[_0x725e('0x12')]('/',auth[_0x725e('0xb')](),controller['create']);router['post'](_0x725e('0x10'),auth[_0x725e('0xb')](),controller['addContacts']);router['put'](_0x725e('0xe'),auth[_0x725e('0xb')](),controller['update']);router[_0x725e('0x13')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller['destroy']);module[_0x725e('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 556d456..b970718 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 _0x16ca=['TEXT','INTEGER','UNSIGNED','NOW','lodash','sequelize','exports','STRING'];(function(_0xfea01e,_0x25d2e5){var _0x5d17e8=function(_0x2c2aca){while(--_0x2c2aca){_0xfea01e['push'](_0xfea01e['shift']());}};_0x5d17e8(++_0x25d2e5);}(_0x16ca,0x1b4));var _0xa16c=function(_0x138d18,_0x7a67b9){_0x138d18=_0x138d18-0x0;var _0x51bf13=_0x16ca[_0x138d18];return _0x51bf13;};'use strict';var _=require(_0xa16c('0x0'));var Sequelize=require(_0xa16c('0x1'));module[_0xa16c('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa16c('0x3')]},'postalCode':{'type':Sequelize[_0xa16c('0x3')]},'city':{'type':Sequelize[_0xa16c('0x3')]},'country':{'type':Sequelize[_0xa16c('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa16c('0x3')]},'description':{'type':Sequelize[_0xa16c('0x4')]},'phone':{'type':Sequelize[_0xa16c('0x3')]},'mobile':{'type':Sequelize[_0xa16c('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa16c('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa16c('0x3')]},'fb_data':{'type':Sequelize[_0xa16c('0x3')]},'twitter':{'type':Sequelize[_0xa16c('0x3')]},'skype':{'type':Sequelize[_0xa16c('0x3')]},'teams':{'type':Sequelize[_0xa16c('0x3')]},'viber':{'type':Sequelize[_0xa16c('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xa16c('0x3')]},'UserId':{'type':Sequelize[_0xa16c('0x5')]},'priority':{'type':Sequelize[_0xa16c('0x5')](0x2)[_0xa16c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xa16c('0x7')]}}; \ No newline at end of file +var _0x591e=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x2f8000,_0x37c02b){var _0x25cfee=function(_0x56aca2){while(--_0x56aca2){_0x2f8000['push'](_0x2f8000['shift']());}};_0x25cfee(++_0x37c02b);}(_0x591e,0x1a0));var _0xe591=function(_0x4fe87e,_0x149993){_0x4fe87e=_0x4fe87e-0x0;var _0x2c3b88=_0x591e[_0x4fe87e];return _0x2c3b88;};'use strict';var _=require(_0xe591('0x0'));var Sequelize=require(_0xe591('0x1'));module[_0xe591('0x2')]={'firstName':{'type':Sequelize[_0xe591('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xe591('0x3')]},'city':{'type':Sequelize[_0xe591('0x3')]},'country':{'type':Sequelize[_0xe591('0x3')]},'dateOfBirth':{'type':Sequelize[_0xe591('0x3')]},'description':{'type':Sequelize[_0xe591('0x4')]},'phone':{'type':Sequelize[_0xe591('0x3')]},'mobile':{'type':Sequelize[_0xe591('0x3')]},'fax':{'type':Sequelize[_0xe591('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xe591('0x3')]},'facebook':{'type':Sequelize[_0xe591('0x3')]},'fb_data':{'type':Sequelize[_0xe591('0x3')]},'twitter':{'type':Sequelize[_0xe591('0x3')]},'skype':{'type':Sequelize[_0xe591('0x3')]},'teams':{'type':Sequelize[_0xe591('0x3')]},'viber':{'type':Sequelize[_0xe591('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xe591('0x3')]},'telegram':{'type':Sequelize[_0xe591('0x3')]},'UserId':{'type':Sequelize[_0xe591('0x5')]},'priority':{'type':Sequelize[_0xe591('0x5')](0x2)[_0xe591('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe591('0x7')],'defaultValue':Sequelize[_0xe591('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f8285e9..781880b 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 _0x3d4f=['conditions','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','fieldType','buildExpression','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','c.ListId\x20IS\x20NULL','map','toString','sequelize','keyBy','c.firstName','c.lastName','c.phone','c.fax','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','push','rows','find','params','tags','startsWith','columnName','displayName','findAll','alias','custom','values','merge','body','get','mergeWith','isArray','info','CmHopper','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','OpenchannelQueueReport','SmsQueueReport','catch','join','create','bulkCreate','each','duplicates','findOrCreate','spread','show','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','toParam','text','phone','Tag','rawAttributes','pick','options','getTags','setTags','getHoppers','ContactId','includeAll','include','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','0777','child_process','fork','File\x20uploaded\x20correctly!','upload','createReadStream','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','end','json','count','offset','limit','apply','reject','save','then','sendStatus','error','send','index','CmContact','describe','length','keys','CmCustomField','findOne','trimStart','cf_','all','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','select','field','name','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator'];(function(_0x5754d7,_0x5077dc){var _0x485fe0=function(_0x32deb6){while(--_0x32deb6){_0x5754d7['push'](_0x5754d7['shift']());}};_0x485fe0(++_0x5077dc);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x321730,_0x1fb230){_0x321730=_0x321730-0x0;var _0x4344eb=_0x3d4f[_0x321730];return _0x4344eb;};'use strict';var pdf=require(_0xf3d4('0x0'));var emlformat=require(_0xf3d4('0x1'));var rimraf=require(_0xf3d4('0x2'));var zipdir=require(_0xf3d4('0x3'));var jsonpatch=require(_0xf3d4('0x4'));var rp=require(_0xf3d4('0x5'));var moment=require('moment');var BPromise=require(_0xf3d4('0x6'));var Mustache=require('mustache');var util=require(_0xf3d4('0x7'));var path=require(_0xf3d4('0x8'));var sox=require('sox');var csv=require(_0xf3d4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf3d4('0xa'));var squel=require(_0xf3d4('0xb'));var crypto=require(_0xf3d4('0xc'));var jsforce=require(_0xf3d4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf3d4('0x9'));var querystring=require(_0xf3d4('0xe'));var Papa=require(_0xf3d4('0xf'));var Redis=require('ioredis');var authService=require(_0xf3d4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf3d4('0x11'));var hardwareService=require(_0xf3d4('0x12'));var logger=require(_0xf3d4('0x13'))(_0xf3d4('0x14'));var utils=require(_0xf3d4('0x15'));var config=require(_0xf3d4('0x16'));var licenseUtil=require(_0xf3d4('0x17'));var db=require(_0xf3d4('0x18'))['db'];config[_0xf3d4('0x19')]=_[_0xf3d4('0x1a')](config[_0xf3d4('0x19')],{'host':_0xf3d4('0x1b'),'port':0x18eb});var socket=require(_0xf3d4('0x1c'))(new Redis(config[_0xf3d4('0x19')]));require(_0xf3d4('0x1d'))[_0xf3d4('0x1e')](socket);function respondWithStatusCode(_0x2d51f3,_0x5a18c2){_0x5a18c2=_0x5a18c2||0xcc;return function(_0x4f2c56){if(_0x4f2c56){return _0x2d51f3['sendStatus'](_0x5a18c2);}return _0x2d51f3[_0xf3d4('0x1f')](_0x5a18c2)[_0xf3d4('0x20')]();};}function respondWithResult(_0x2af4da,_0x80b9ee){_0x80b9ee=_0x80b9ee||0xc8;return function(_0x248c5f){if(_0x248c5f){return _0x2af4da[_0xf3d4('0x1f')](_0x80b9ee)[_0xf3d4('0x21')](_0x248c5f);}};}function respondWithFilteredResult(_0x463d29,_0x34f458){return function(_0x2f3464){if(_0x2f3464){var _0x4a7c41=_0x2f3464[_0xf3d4('0x22')],_0x1f2d81=_0x34f458[_0xf3d4('0x23')],_0x4cd885=_0x34f458[_0xf3d4('0x23')]+_0x34f458[_0xf3d4('0x24')],_0x548c07;if(_0x4cd885>=_0x4a7c41){_0x4cd885=_0x4a7c41;_0x548c07=0xc8;}else{_0x548c07=0xce;}_0x463d29[_0xf3d4('0x1f')](_0x548c07);return _0x463d29['set']('Content-Range',_0x1f2d81+'-'+_0x4cd885+'/'+_0x4a7c41)[_0xf3d4('0x21')](_0x2f3464);}return null;};}function patchUpdates(_0x5239fa){return function(_0x4be87c){try{jsonpatch[_0xf3d4('0x25')](_0x4be87c,_0x5239fa,!![]);}catch(_0x4efbd6){return BPromise[_0xf3d4('0x26')](_0x4efbd6);}return _0x4be87c[_0xf3d4('0x27')]();};}function saveUpdates(_0x218c1f,_0x3de2d1){return function(_0x18134d){if(_0x18134d){return _0x18134d['update'](_0x218c1f)[_0xf3d4('0x28')](function(_0x24a8b1){return _0x24a8b1;});}return null;};}function removeEntity(_0x17ebab,_0x394271){return function(_0x359358){if(_0x359358){return _0x359358['destroy']()[_0xf3d4('0x28')](function(){_0x17ebab[_0xf3d4('0x1f')](0xcc)[_0xf3d4('0x20')]();});}};}function handleEntityNotFound(_0x983b3a,_0x58e881){return function(_0x58d978){if(!_0x58d978){_0x983b3a[_0xf3d4('0x29')](0x194);}return _0x58d978;};}function handleError(_0x4c560a,_0x344256){_0x344256=_0x344256||0x1f4;return function(_0x5f481f){logger[_0xf3d4('0x2a')](_0x5f481f['stack']);if(_0x5f481f['name']){delete _0x5f481f['name'];}_0x4c560a[_0xf3d4('0x1f')](_0x344256)[_0xf3d4('0x2b')](_0x5f481f);};}exports[_0xf3d4('0x2c')]=function(_0x12f10d,_0x597e1d){var _0x290413={},_0x28bc02={},_0x50d697={'count':0x0,'rows':[]};return db[_0xf3d4('0x2d')][_0xf3d4('0x2e')]()[_0xf3d4('0x28')](function(_0x9d2ab8){var _0x5070cd=[];for(var _0x1aa9d9=0x0;_0x1aa9d90x1){_0x1ae8c2['or'](_0xf3d4('0x66'),qs[_0xf3d4('0x67')](_0x5626db),null);}else{if(qs['isNumeric'](_0x5626db)){_0x1ae8c2['or'](_0xf3d4('0x68'),_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x69'),_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x6a'),_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x6b'),_0x5626db+'%');}else if(qs[_0xf3d4('0x6c')](_0x5626db)){_0x1ae8c2['or'](_0xf3d4('0x6d'),_0x5626db+'%');}else{_0x1ae8c2['or'](_0xf3d4('0x6e'),'%'+_0x5626db+'%');_0x1ae8c2['or']('c.lastName\x20LIKE\x20?','%'+_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x6d'),'%'+_0x5626db+'%');}}}}_0x349425[_0xf3d4('0x40')](_0x1ae8c2);_0x349425[_0xf3d4('0x6f')](_0xf3d4('0x70'));var _0x49977b={'type':db[_0xf3d4('0x71')][_0xf3d4('0x72')][_0xf3d4('0x73')],'raw':!![]};var _0x2ae427=_0x349425[_0xf3d4('0x74')]()[_0xf3d4('0x42')](_0xf3d4('0x70'));if(_0x290413['order']){_0x290413[_0xf3d4('0x75')][_0xf3d4('0x54')](function(_0x528517){_0x349425['order']('c.'+_0x528517[0x0],_0x528517[0x1]===_0xf3d4('0x76')?![]:!![]);});}if(!_[_0xf3d4('0x5f')](_0x5acb5a)){_0x349425[_0xf3d4('0x77')](_0x1eb231);_0x2ae427[_0xf3d4('0x40')](_0xf3d4('0x78'),_0x5acb5a);}BPromise[_0xf3d4('0x79')]()[_0xf3d4('0x28')](function(){if(!_0x38ffb8)return;if(_0x12f10d[_0xf3d4('0x7a')][_0xf3d4('0x7b')]!==_0xf3d4('0x7c'))return;if(!_['some'](_0x38ffb8['conditions'],[_0xf3d4('0x42'),_0xf3d4('0x57')])){return _0x12f10d[_0xf3d4('0x7a')]['getLists']({'attributes':['id'],'raw':!![]})[_0xf3d4('0x28')](function(_0x4ee6cf){if(_[_0xf3d4('0x5f')](_0x4ee6cf)){_0x2ae427[_0xf3d4('0x40')]('c.ListId\x20IS\x20NULL');_0x349425[_0xf3d4('0x40')](_0xf3d4('0x7d'));}else{_0x2ae427[_0xf3d4('0x40')](_0xf3d4('0x61'),_[_0xf3d4('0x7e')](_0x4ee6cf,'id'));_0x349425[_0xf3d4('0x40')](_0xf3d4('0x61'),_[_0xf3d4('0x7e')](_0x4ee6cf,'id'));}});}})[_0xf3d4('0x28')](function(){if(_0x12f10d[_0xf3d4('0x7a')][_0xf3d4('0x7b')]==='agent'&&!_0x38ffb8&&!_0x12f10d['query'][_0xf3d4('0x60')])return[];return db['sequelize']['query'](_0x2ae427[_0xf3d4('0x7f')](),_0x49977b);})[_0xf3d4('0x28')](function(_0x36859f){_0x50d697[_0xf3d4('0x22')]=_0x36859f['length'];if(_0x50d697[_0xf3d4('0x22')]===0x0)return[];return db[_0xf3d4('0x80')][_0xf3d4('0x38')](_0x57f86b[_0xf3d4('0x7f')](),_0x49977b)['then'](function(_0x3240d5){_0x1830b7=_[_0xf3d4('0x81')](_0x3240d5,'id');_0x49977b=_['merge'](_0x49977b,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12f10d[_0xf3d4('0x38')][_0xf3d4('0x3b')]){_0x290413[_0xf3d4('0x3c')][_0xf3d4('0x54')](function(_0x22ec25){_0x349425[_0xf3d4('0x42')]('c.'+_0x22ec25);});}else{_0x349425[_0xf3d4('0x42')](_0xf3d4('0x70'));_0x349425[_0xf3d4('0x42')](_0xf3d4('0x82'));_0x349425[_0xf3d4('0x42')](_0xf3d4('0x83'));_0x349425[_0xf3d4('0x42')](_0xf3d4('0x84'));_0x349425['field']('c.mobile');_0x349425['field'](_0xf3d4('0x85'));_0x349425[_0xf3d4('0x42')]('c.email');_0x349425['field']('c.ListId');_0x349425[_0xf3d4('0x42')](_0xf3d4('0x86'));_0x349425[_0xf3d4('0x42')]('c.deletedAt');_0x349425[_0xf3d4('0x42')](_0xf3d4('0x87'));_0x349425['field'](_0xf3d4('0x88'),_0xf3d4('0x89'));}if(_0x290413[_0xf3d4('0x24')])_0x349425[_0xf3d4('0x24')](_0x290413[_0xf3d4('0x24')]);if(_0x290413[_0xf3d4('0x23')])_0x349425[_0xf3d4('0x23')](_0x290413[_0xf3d4('0x23')]);return db[_0xf3d4('0x80')][_0xf3d4('0x38')](_0x349425[_0xf3d4('0x7f')](),_0x49977b);});})[_0xf3d4('0x28')](function(_0x2a4523){_0x2a4523[_0xf3d4('0x54')](function(_0x5ae972){if(_0x5ae972[_0xf3d4('0x89')]){_0x5ae972['Tags']=[];_0x5ae972[_0xf3d4('0x89')][_0xf3d4('0x53')](',')[_0xf3d4('0x54')](function(_0x322a76){_0x5ae972[_0xf3d4('0x8a')][_0xf3d4('0x8b')](_0x1830b7[_0x322a76]);});}delete _0x5ae972['TagIds'];});_0x50d697[_0xf3d4('0x8c')]=_0x2a4523;return _0x50d697;})['then'](respondWithFilteredResult(_0x597e1d,_0x290413));})['catch'](handleError(_0x597e1d,null));};exports['destroy']=function(_0xfbda09,_0x1694ad){return db[_0xf3d4('0x2d')][_0xf3d4('0x8d')]({'where':{'id':_0xfbda09[_0xf3d4('0x8e')]['id']}})[_0xf3d4('0x28')](handleEntityNotFound(_0x1694ad,null))['then'](removeEntity(_0x1694ad,null))['catch'](handleError(_0x1694ad,null));};exports[_0xf3d4('0x2e')]=function(_0x138759,_0x524a02){return db[_0xf3d4('0x2d')]['describe']()[_0xf3d4('0x28')](function(_0x3b0c20){delete _0x3b0c20[_0xf3d4('0x8f')];for(var _0x464953=0x0;_0x464953=_0x1b36bb){_0x13df98=_0x1b36bb;_0x222f33=0xc8;}else{_0x222f33=0xce;}_0x2a2783[_0x7eed('0x1f')](_0x222f33);return _0x2a2783[_0x7eed('0x20')](_0x7eed('0x21'),_0x3ab3e2+'-'+_0x13df98+'/'+_0x1b36bb)['json'](_0x5143db);}return null;};}function patchUpdates(_0x390012){return function(_0x5e9835){try{jsonpatch[_0x7eed('0x22')](_0x5e9835,_0x390012,!![]);}catch(_0x50f58c){return BPromise[_0x7eed('0x23')](_0x50f58c);}return _0x5e9835[_0x7eed('0x24')]();};}function saveUpdates(_0x578cf2,_0x51e60e){return function(_0x5201ca){if(_0x5201ca){return _0x5201ca[_0x7eed('0x25')](_0x578cf2)[_0x7eed('0x26')](function(_0x1a2736){return _0x1a2736;});}return null;};}function removeEntity(_0xf50d35,_0xfe3c86){return function(_0x811eeb){if(_0x811eeb){return _0x811eeb[_0x7eed('0x27')]()[_0x7eed('0x26')](function(){_0xf50d35[_0x7eed('0x1f')](0xcc)[_0x7eed('0x28')]();});}};}function handleEntityNotFound(_0x2fc47f,_0x20420f){return function(_0x291b7c){if(!_0x291b7c){_0x2fc47f[_0x7eed('0x1b')](0x194);}return _0x291b7c;};}function handleError(_0x19c47d,_0x79d72){_0x79d72=_0x79d72||0x1f4;return function(_0x10ac28){logger[_0x7eed('0x29')](_0x10ac28[_0x7eed('0x2a')]);if(_0x10ac28[_0x7eed('0x2b')]){delete _0x10ac28[_0x7eed('0x2b')];}_0x19c47d[_0x7eed('0x1f')](_0x79d72)[_0x7eed('0x2c')](_0x10ac28);};}exports[_0x7eed('0x2d')]=function(_0x38faff,_0x37ace1){var _0x4016ca={},_0x1a1a71={},_0x941863={'count':0x0,'rows':[]};return db[_0x7eed('0x2e')][_0x7eed('0x2f')]()[_0x7eed('0x26')](function(_0x6233d2){var _0xc3d47e=[];for(var _0x2c66a5=0x0;_0x2c66a50x1){_0x29df53['or'](_0x7eed('0x6b'),qs['getFullTextValue'](_0x5912c8),null);}else{if(qs[_0x7eed('0x6c')](_0x5912c8)){_0x29df53['or']('c.id\x20LIKE\x20?',_0x5912c8+'%');_0x29df53['or'](_0x7eed('0x6d'),_0x5912c8+'%');_0x29df53['or'](_0x7eed('0x6e'),_0x5912c8+'%');_0x29df53['or']('c.fax\x20LIKE\x20?',_0x5912c8+'%');}else if(qs[_0x7eed('0x6f')](_0x5912c8)){_0x29df53['or']('c.email\x20LIKE\x20?',_0x5912c8+'%');}else{_0x29df53['or'](_0x7eed('0x70'),'%'+_0x5912c8+'%');_0x29df53['or']('c.lastName\x20LIKE\x20?','%'+_0x5912c8+'%');_0x29df53['or']('c.email\x20LIKE\x20?','%'+_0x5912c8+'%');}}}}_0x2740e5[_0x7eed('0x41')](_0x29df53);_0x2740e5['group'](_0x7eed('0x71'));var _0x2bae8e={'type':db[_0x7eed('0x72')][_0x7eed('0x73')][_0x7eed('0x74')],'raw':!![]};var _0x3b64f1=_0x2740e5[_0x7eed('0x75')]()[_0x7eed('0x44')](_0x7eed('0x71'));if(_0x4016ca[_0x7eed('0x3f')]){_0x4016ca[_0x7eed('0x3f')]['forEach'](function(_0x4c7379){_0x2740e5[_0x7eed('0x3f')]('c.'+_0x4c7379[0x0],_0x4c7379[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7eed('0x66')](_0x36ec51)){_0x2740e5[_0x7eed('0x76')](_0x3a1fd8);_0x3b64f1[_0x7eed('0x41')](_0x7eed('0x77'),_0x36ec51);}BPromise[_0x7eed('0x78')]()[_0x7eed('0x26')](function(){if(!_0x5a8ec1)return;if(_0x38faff[_0x7eed('0x79')][_0x7eed('0x7a')]!==_0x7eed('0x7b'))return;if(!_[_0x7eed('0x7c')](_0x5a8ec1[_0x7eed('0x54')],['field','User'])){return _0x38faff['user'][_0x7eed('0x7d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d129d){if(_[_0x7eed('0x66')](_0x4d129d)){_0x3b64f1[_0x7eed('0x41')](_0x7eed('0x7e'));_0x2740e5['where'](_0x7eed('0x7e'));}else{_0x3b64f1[_0x7eed('0x41')](_0x7eed('0x7f'),_[_0x7eed('0x56')](_0x4d129d,'id'));_0x2740e5[_0x7eed('0x41')]('c.ListId\x20IN\x20?',_[_0x7eed('0x56')](_0x4d129d,'id'));}});}})['then'](function(){if(_0x38faff[_0x7eed('0x79')][_0x7eed('0x7a')]===_0x7eed('0x7b')&&!_0x5a8ec1&&!_0x38faff['query'][_0x7eed('0x67')])return[];return db[_0x7eed('0x80')][_0x7eed('0x39')](_0x3b64f1['toString'](),_0x2bae8e);})[_0x7eed('0x26')](function(_0x13c7c4){_0x941863[_0x7eed('0x1c')]=_0x13c7c4[_0x7eed('0x35')];if(_0x941863[_0x7eed('0x1c')]===0x0)return[];return db['sequelize'][_0x7eed('0x39')](_0x1ca060[_0x7eed('0x81')](),_0x2bae8e)[_0x7eed('0x26')](function(_0x1a8ef5){_0x5e8c17=_[_0x7eed('0x82')](_0x1a8ef5,'id');_0x2bae8e=_[_0x7eed('0x83')](_0x2bae8e,{'model':db[_0x7eed('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x38faff[_0x7eed('0x39')][_0x7eed('0x3d')]){_0x4016ca[_0x7eed('0x3c')][_0x7eed('0x57')](function(_0xa3f4a2){_0x2740e5[_0x7eed('0x44')]('c.'+_0xa3f4a2);});}else{_0x2740e5['field'](_0x7eed('0x71'));_0x2740e5[_0x7eed('0x44')]('c.firstName');_0x2740e5[_0x7eed('0x44')](_0x7eed('0x84'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x85'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x86'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x87'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x88'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x89'));_0x2740e5['field'](_0x7eed('0x8a'));_0x2740e5['field'](_0x7eed('0x8b'));_0x2740e5['field'](_0x7eed('0x8c'));_0x2740e5[_0x7eed('0x44')](_0x7eed('0x8d'),_0x7eed('0x8e'));}if(_0x4016ca[_0x7eed('0x1e')])_0x2740e5['limit'](_0x4016ca[_0x7eed('0x1e')]);if(_0x4016ca['offset'])_0x2740e5[_0x7eed('0x1d')](_0x4016ca[_0x7eed('0x1d')]);return db['sequelize'][_0x7eed('0x39')](_0x2740e5[_0x7eed('0x81')](),_0x2bae8e);});})['then'](function(_0x45a202){_0x45a202['forEach'](function(_0x2a2581){if(_0x2a2581[_0x7eed('0x8e')]){_0x2a2581[_0x7eed('0x8f')]=[];_0x2a2581[_0x7eed('0x8e')][_0x7eed('0x55')](',')[_0x7eed('0x57')](function(_0x4af05d){_0x2a2581['Tags'][_0x7eed('0x33')](_0x5e8c17[_0x4af05d]);});}delete _0x2a2581['TagIds'];});_0x941863['rows']=_0x45a202;return _0x941863;})[_0x7eed('0x26')](respondWithFilteredResult(_0x37ace1,_0x4016ca));})[_0x7eed('0x90')](handleError(_0x37ace1,null));};exports[_0x7eed('0x27')]=function(_0x2202c9,_0x5bd733){return db[_0x7eed('0x2e')][_0x7eed('0x91')]({'where':{'id':_0x2202c9['params']['id']}})[_0x7eed('0x26')](handleEntityNotFound(_0x5bd733,null))['then'](removeEntity(_0x5bd733,null))[_0x7eed('0x90')](handleError(_0x5bd733,null));};exports[_0x7eed('0x2f')]=function(_0x52fea8,_0x455d8c){return db['CmContact']['describe']()['then'](function(_0x16c920){delete _0x16c920[_0x7eed('0x92')];for(var _0x57cebf=0x0;_0x57cebf{}\s\\|]/g,'-');_0x47e5cf(null,util[_0x9da1('0x1d')](_0x9da1('0x1e'),path['basename'](_0xe56279['originalname'],path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])));}})});router[_0x9da1('0x13')]('/csv',upload[_0x9da1('0x21')](_0x9da1('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x9da1('0x23')]({'destination':function(_0x3f5680,_0x534210,_0x2fd49c){_0x2fd49c(null,path[_0x9da1('0x18')](config['root'],_0x9da1('0x1a')));},'filename':function(_0x1d6af5,_0x55cd3d,_0x5c09ed){_0x55cd3d[_0x9da1('0x1b')]=_0x55cd3d[_0x9da1('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c09ed(null,util[_0x9da1('0x1d')]('%s-%s%s',path['basename'](_0x55cd3d['originalname'],path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])));}})});router['post'](_0x9da1('0x24'),upload['single'](_0x9da1('0x22')),controller[_0x9da1('0x25')]);router['post'](_0x9da1('0x26'),auth[_0x9da1('0x7')](),controller['import']);router[_0x9da1('0x27')](_0x9da1('0x28'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x29')]);router['delete']('/:id',auth[_0x9da1('0x7')](),controller[_0x9da1('0x2a')]);module[_0x9da1('0x2b')]=router; \ No newline at end of file +var _0xb4c7=['diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','/upload','upload','import','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','describe','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/merge','merge','post','create','/create_many','bulkCreate'];(function(_0x1c655c,_0x256c23){var _0x5306be=function(_0xbef573){while(--_0xbef573){_0x1c655c['push'](_0x1c655c['shift']());}};_0x5306be(++_0x256c23);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x333b35,_0x158a04){_0x333b35=_0x333b35-0x0;var _0x3fa8fa=_0xb4c7[_0x333b35];return _0x3fa8fa;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0x9')]('/:id',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0x9')](_0x7b4c('0xf'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x10')]);router[_0x7b4c('0x9')](_0x7b4c('0x11'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x12')]);router['get']('/:id/hopper_histories',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x13')]);router[_0x7b4c('0x9')](_0x7b4c('0x14'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x15')]);router[_0x7b4c('0x9')](_0x7b4c('0x16'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x17')]);router['post'](_0x7b4c('0x18'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x19')]);router[_0x7b4c('0x1a')]('/',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x1b')]);router[_0x7b4c('0x1a')](_0x7b4c('0x1c'),auth['isAuthenticated'](),controller[_0x7b4c('0x1d')]);router[_0x7b4c('0x1a')](_0x7b4c('0xf'),auth[_0x7b4c('0xd')](),controller['setTags']);var upload=multer({'storage':multer[_0x7b4c('0x1e')]({'destination':function(_0x3d314d,_0x32110e,_0x380b79){_0x380b79(null,path[_0x7b4c('0x1f')](config[_0x7b4c('0x20')],_0x7b4c('0x21')));},'filename':function(_0x445281,_0x3556d8,_0x55e3df){_0x3556d8[_0x7b4c('0x22')]=_0x3556d8[_0x7b4c('0x22')][_0x7b4c('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x55e3df(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x3556d8[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x3556d8[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path['extname'](_0x3556d8[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x29'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2c')]);var upload=multer({'storage':multer[_0x7b4c('0x1e')]({'destination':function(_0x459eb4,_0x1f311e,_0x1a69db){_0x1a69db(null,path[_0x7b4c('0x1f')](config[_0x7b4c('0x20')],_0x7b4c('0x21')));},'filename':function(_0x501f75,_0x27f361,_0x3ab614){_0x27f361[_0x7b4c('0x22')]=_0x27f361[_0x7b4c('0x22')][_0x7b4c('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ab614(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x27f361[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x2d'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2e')]);router['post']('/upload/:id',auth['isAuthenticated'](),controller[_0x7b4c('0x2f')]);router[_0x7b4c('0x30')](_0x7b4c('0x31'),auth[_0x7b4c('0xd')](),controller['update']);router[_0x7b4c('0x32')](_0x7b4c('0x31'),auth['isAuthenticated'](),controller[_0x7b4c('0x33')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 93e466b..17a9f2a 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 _0xb39f=['INTEGER','STRING','sequelize','exports'];(function(_0x15caa5,_0x206c67){var _0x1200c7=function(_0x209813){while(--_0x209813){_0x15caa5['push'](_0x15caa5['shift']());}};_0x1200c7(++_0x206c67);}(_0xb39f,0x1e6));var _0xfb39=function(_0x32766c,_0x1bde10){_0x32766c=_0x32766c-0x0;var _0x1ecfc5=_0xb39f[_0x32766c];return _0x1ecfc5;};'use strict';var Sequelize=require(_0xfb39('0x0'));module[_0xfb39('0x1')]={'CmContactId':{'type':Sequelize[_0xfb39('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xfb39('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xfb39('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x8411=['PHONE','INTEGER','STRING'];(function(_0xccdad1,_0x235d5f){var _0xc73634=function(_0x4bb149){while(--_0x4bb149){_0xccdad1['push'](_0xccdad1['shift']());}};_0xc73634(++_0x235d5f);}(_0x8411,0x118));var _0x1841=function(_0xaf9a7e,_0x14e9cf){_0xaf9a7e=_0xaf9a7e-0x0;var _0x23d47c=_0x8411[_0xaf9a7e];return _0x23d47c;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x1841('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1841('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x1841('0x2')},'OrderBy':{'type':Sequelize[_0x1841('0x0')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index f20b70f..adea20a 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 _0xb1d2=['stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','CmContactHasItems','UserProfileResource','error'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb1d2,0x116));var _0x2b1d=function(_0x7dd8e,_0x192960){_0x7dd8e=_0x7dd8e-0x0;var _0x449bca=_0xb1d2[_0x7dd8e];return _0x449bca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2b1d('0x0'));var zipdir=require(_0x2b1d('0x1'));var jsonpatch=require(_0x2b1d('0x2'));var rp=require(_0x2b1d('0x3'));var moment=require(_0x2b1d('0x4'));var BPromise=require(_0x2b1d('0x5'));var Mustache=require(_0x2b1d('0x6'));var util=require(_0x2b1d('0x7'));var path=require('path');var sox=require(_0x2b1d('0x8'));var csv=require(_0x2b1d('0x9'));var ejs=require(_0x2b1d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2b1d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b1d('0xc'));var Papa=require(_0x2b1d('0xd'));var Redis=require(_0x2b1d('0xe'));var authService=require(_0x2b1d('0xf'));var qs=require(_0x2b1d('0x10'));var as=require(_0x2b1d('0x11'));var hardwareService=require(_0x2b1d('0x12'));var logger=require(_0x2b1d('0x13'))(_0x2b1d('0x14'));var utils=require(_0x2b1d('0x15'));var config=require(_0x2b1d('0x16'));var licenseUtil=require(_0x2b1d('0x17'));var db=require(_0x2b1d('0x18'))['db'];function respondWithStatusCode(_0x1dd47f,_0x2e3f88){_0x2e3f88=_0x2e3f88||0xcc;return function(_0x2f329d){if(_0x2f329d){return _0x1dd47f[_0x2b1d('0x19')](_0x2e3f88);}return _0x1dd47f[_0x2b1d('0x1a')](_0x2e3f88)[_0x2b1d('0x1b')]();};}function respondWithResult(_0x278af0,_0x569de7){_0x569de7=_0x569de7||0xc8;return function(_0x406461){if(_0x406461){return _0x278af0[_0x2b1d('0x1a')](_0x569de7)[_0x2b1d('0x1c')](_0x406461);}};}function respondWithFilteredResult(_0x14dc4e,_0x59697a){return function(_0x36ece8){if(_0x36ece8){var _0x1395fc=_0x36ece8[_0x2b1d('0x1d')],_0x6fd65=_0x59697a[_0x2b1d('0x1e')],_0x32ce84=_0x59697a[_0x2b1d('0x1e')]+_0x59697a[_0x2b1d('0x1f')],_0x41be75;if(_0x32ce84>=_0x1395fc){_0x32ce84=_0x1395fc;_0x41be75=0xc8;}else{_0x41be75=0xce;}_0x14dc4e[_0x2b1d('0x1a')](_0x41be75);return _0x14dc4e[_0x2b1d('0x20')](_0x2b1d('0x21'),_0x6fd65+'-'+_0x32ce84+'/'+_0x1395fc)[_0x2b1d('0x1c')](_0x36ece8);}return null;};}function patchUpdates(_0x12ab07){return function(_0x3a6219){try{jsonpatch[_0x2b1d('0x22')](_0x3a6219,_0x12ab07,!![]);}catch(_0x43c6db){return BPromise['reject'](_0x43c6db);}return _0x3a6219['save']();};}function saveUpdates(_0x88dc70,_0x193718){return function(_0x543eac){if(_0x543eac){return _0x543eac[_0x2b1d('0x23')](_0x88dc70)[_0x2b1d('0x24')](function(_0xaa265c){return _0xaa265c;});}return null;};}function removeEntity(_0x39edb1,_0x5e4922){return function(_0x21a308){if(_0x21a308){return _0x21a308[_0x2b1d('0x25')]()[_0x2b1d('0x24')](function(){var _0x5ba126=_0x21a308[_0x2b1d('0x26')]({'plain':!![]});var _0x184d0b=_0x2b1d('0x27');return db[_0x2b1d('0x28')]['destroy']({'where':{'type':_0x184d0b,'resourceId':_0x5ba126['id']}})[_0x2b1d('0x24')](function(){return _0x21a308;});})['then'](function(){_0x39edb1['status'](0xcc)[_0x2b1d('0x1b')]();});}};}function handleEntityNotFound(_0x5d7e0f,_0x21f724){return function(_0x7b6d7){if(!_0x7b6d7){_0x5d7e0f[_0x2b1d('0x19')](0x194);}return _0x7b6d7;};}function handleError(_0x5af59f,_0x6e2c56){_0x6e2c56=_0x6e2c56||0x1f4;return function(_0x56d5a4){logger[_0x2b1d('0x29')](_0x56d5a4[_0x2b1d('0x2a')]);if(_0x56d5a4['name']){delete _0x56d5a4[_0x2b1d('0x2b')];}_0x5af59f[_0x2b1d('0x1a')](_0x6e2c56)[_0x2b1d('0x2c')](_0x56d5a4);};}exports[_0x2b1d('0x2d')]=function(_0x221c1b,_0x2044f2){var _0x37d94c={},_0x3385a6={},_0x497c01={'count':0x0,'rows':[]};var _0x1cbafc=_[_0x2b1d('0x2e')](db[_0x2b1d('0x2f')][_0x2b1d('0x30')],function(_0x16dd26){return{'name':_0x16dd26[_0x2b1d('0x31')],'type':_0x16dd26[_0x2b1d('0x32')][_0x2b1d('0x33')]};});_0x3385a6[_0x2b1d('0x34')]=_[_0x2b1d('0x2e')](_0x1cbafc,'name');_0x3385a6['query']=_[_0x2b1d('0x35')](_0x221c1b['query']);_0x3385a6[_0x2b1d('0x36')]=_[_0x2b1d('0x37')](_0x3385a6['model'],_0x3385a6[_0x2b1d('0x38')]);_0x37d94c[_0x2b1d('0x39')]=_[_0x2b1d('0x37')](_0x3385a6[_0x2b1d('0x34')],qs[_0x2b1d('0x3a')](_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x3a')]));_0x37d94c['attributes']=_0x37d94c[_0x2b1d('0x39')][_0x2b1d('0x3b')]?_0x37d94c[_0x2b1d('0x39')]:_0x3385a6[_0x2b1d('0x34')];if(!_0x221c1b['query'][_0x2b1d('0x3c')]('nolimit')){_0x37d94c[_0x2b1d('0x1f')]=qs['limit'](_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x1f')]);_0x37d94c[_0x2b1d('0x1e')]=qs[_0x2b1d('0x1e')](_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x1e')]);}_0x37d94c['order']=qs['sort'](_0x221c1b['query']['sort']);_0x37d94c[_0x2b1d('0x3d')]=qs[_0x2b1d('0x36')](_['pick'](_0x221c1b[_0x2b1d('0x38')],_0x3385a6['filters']),_0x1cbafc);if(_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x3e')]){_0x37d94c[_0x2b1d('0x3d')]=_[_0x2b1d('0x3f')](_0x37d94c[_0x2b1d('0x3d')],{'$or':_[_0x2b1d('0x2e')](_0x1cbafc,function(_0x698e3a){if(_0x698e3a[_0x2b1d('0x32')]!==_0x2b1d('0x40')){var _0x4b5a92={};_0x4b5a92[_0x698e3a[_0x2b1d('0x2b')]]={'$like':'%'+_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x3e')]+'%'};return _0x4b5a92;}})});}_0x37d94c=_[_0x2b1d('0x3f')]({},_0x37d94c,_0x221c1b['options']);var _0x40a57c={'where':_0x37d94c['where']};return db['CmContactHasItem'][_0x2b1d('0x1d')](_0x40a57c)['then'](function(_0x442550){_0x497c01[_0x2b1d('0x1d')]=_0x442550;if(_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x41')]){_0x37d94c[_0x2b1d('0x42')]=[{'all':!![]}];}return db[_0x2b1d('0x2f')]['findAll'](_0x37d94c);})[_0x2b1d('0x24')](function(_0x6d3cfd){_0x497c01[_0x2b1d('0x43')]=_0x6d3cfd;return _0x497c01;})[_0x2b1d('0x24')](respondWithFilteredResult(_0x2044f2,_0x37d94c))[_0x2b1d('0x44')](handleError(_0x2044f2,null));};exports[_0x2b1d('0x45')]=function(_0x2cffba,_0x32b76e){var _0xc5f351={'raw':!![],'where':{'id':_0x2cffba[_0x2b1d('0x46')]['id']}},_0x14dacf={};_0x14dacf[_0x2b1d('0x34')]=_[_0x2b1d('0x35')](db[_0x2b1d('0x2f')][_0x2b1d('0x30')]);_0x14dacf[_0x2b1d('0x38')]=_[_0x2b1d('0x35')](_0x2cffba[_0x2b1d('0x38')]);_0x14dacf['filters']=_['intersection'](_0x14dacf[_0x2b1d('0x34')],_0x14dacf[_0x2b1d('0x38')]);_0xc5f351[_0x2b1d('0x39')]=_[_0x2b1d('0x37')](_0x14dacf[_0x2b1d('0x34')],qs['fields'](_0x2cffba[_0x2b1d('0x38')][_0x2b1d('0x3a')]));_0xc5f351[_0x2b1d('0x39')]=_0xc5f351[_0x2b1d('0x39')][_0x2b1d('0x3b')]?_0xc5f351[_0x2b1d('0x39')]:_0x14dacf[_0x2b1d('0x34')];if(_0x2cffba['query'][_0x2b1d('0x41')]){_0xc5f351[_0x2b1d('0x42')]=[{'all':!![]}];}_0xc5f351=_['merge']({},_0xc5f351,_0x2cffba[_0x2b1d('0x47')]);return db[_0x2b1d('0x2f')][_0x2b1d('0x48')](_0xc5f351)[_0x2b1d('0x24')](handleEntityNotFound(_0x32b76e,null))[_0x2b1d('0x24')](respondWithResult(_0x32b76e,null))['catch'](handleError(_0x32b76e,null));};exports[_0x2b1d('0x49')]=function(_0x470803,_0x5aa834){return db[_0x2b1d('0x2f')][_0x2b1d('0x49')](_0x470803[_0x2b1d('0x4a')],{})[_0x2b1d('0x24')](function(_0x6b9452){var _0x3ac09b=_0x470803[_0x2b1d('0x4b')][_0x2b1d('0x26')]({'plain':!![]});if(!_0x3ac09b)throw new Error(_0x2b1d('0x4c'));if(_0x3ac09b[_0x2b1d('0x4d')]==='user'){var _0x4759c4=_0x6b9452[_0x2b1d('0x26')]({'plain':!![]});var _0x3c540d=_0x2b1d('0x27');return db[_0x2b1d('0x4e')]['find']({'where':{'name':_0x3c540d,'userProfileId':_0x3ac09b['userProfileId']},'raw':!![]})['then'](function(_0x2c33c5){if(_0x2c33c5&&_0x2c33c5[_0x2b1d('0x4f')]===0x0){return db[_0x2b1d('0x28')][_0x2b1d('0x49')]({'name':_0x4759c4[_0x2b1d('0x2b')],'resourceId':_0x4759c4['id'],'type':_0x2c33c5[_0x2b1d('0x2b')],'sectionId':_0x2c33c5['id']},{})[_0x2b1d('0x24')](function(){return _0x6b9452;});}else{return _0x6b9452;}})[_0x2b1d('0x44')](function(_0x53b12a){logger[_0x2b1d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53b12a);throw _0x53b12a;});}return _0x6b9452;})[_0x2b1d('0x24')](respondWithResult(_0x5aa834,0xc9))['catch'](handleError(_0x5aa834,null));};exports[_0x2b1d('0x23')]=function(_0x3399ce,_0x17ad97){if(_0x3399ce['body']['id']){delete _0x3399ce[_0x2b1d('0x4a')]['id'];}return db[_0x2b1d('0x2f')][_0x2b1d('0x48')]({'where':{'id':_0x3399ce['params']['id']}})[_0x2b1d('0x24')](handleEntityNotFound(_0x17ad97,null))['then'](saveUpdates(_0x3399ce[_0x2b1d('0x4a')],null))[_0x2b1d('0x24')](respondWithResult(_0x17ad97,null))[_0x2b1d('0x44')](handleError(_0x17ad97,null));};exports[_0x2b1d('0x25')]=function(_0x2dd2e8,_0x3ee77b){return db['CmContactHasItem']['find']({'where':{'id':_0x2dd2e8[_0x2b1d('0x46')]['id']}})[_0x2b1d('0x24')](handleEntityNotFound(_0x3ee77b,null))[_0x2b1d('0x24')](removeEntity(_0x3ee77b,null))[_0x2b1d('0x44')](handleError(_0x3ee77b,null));}; \ No newline at end of file +var _0xcabe=['rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','CmContactHasItems','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x12fde3,_0x4800c6){var _0x521038=function(_0x2ea066){while(--_0x2ea066){_0x12fde3['push'](_0x12fde3['shift']());}};_0x521038(++_0x4800c6);}(_0xcabe,0x1ad));var _0xecab=function(_0x55dd53,_0x2cf521){_0x55dd53=_0x55dd53-0x0;var _0xb8a42b=_0xcabe[_0x55dd53];return _0xb8a42b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xecab('0x0'));var rimraf=require(_0xecab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecab('0x2'));var rp=require('request-promise');var moment=require(_0xecab('0x3'));var BPromise=require(_0xecab('0x4'));var Mustache=require(_0xecab('0x5'));var util=require(_0xecab('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xecab('0x7'));var ejs=require(_0xecab('0x8'));var fs=require('fs');var _=require(_0xecab('0x9'));var squel=require(_0xecab('0xa'));var crypto=require(_0xecab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xecab('0xc'));var toCsv=require(_0xecab('0x7'));var querystring=require('querystring');var Papa=require(_0xecab('0xd'));var Redis=require(_0xecab('0xe'));var authService=require(_0xecab('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xecab('0x10'));var hardwareService=require(_0xecab('0x11'));var logger=require(_0xecab('0x12'))('api');var utils=require(_0xecab('0x13'));var config=require(_0xecab('0x14'));var licenseUtil=require(_0xecab('0x15'));var db=require(_0xecab('0x16'))['db'];function respondWithStatusCode(_0xcb4da4,_0x1fbc55){_0x1fbc55=_0x1fbc55||0xcc;return function(_0x32df44){if(_0x32df44){return _0xcb4da4[_0xecab('0x17')](_0x1fbc55);}return _0xcb4da4[_0xecab('0x18')](_0x1fbc55)[_0xecab('0x19')]();};}function respondWithResult(_0x5246cf,_0x49fbfd){_0x49fbfd=_0x49fbfd||0xc8;return function(_0x522e7b){if(_0x522e7b){return _0x5246cf['status'](_0x49fbfd)[_0xecab('0x1a')](_0x522e7b);}};}function respondWithFilteredResult(_0x4b9b35,_0x52378d){return function(_0x320567){if(_0x320567){var _0x1e2a57=_0x320567[_0xecab('0x1b')],_0x2b646c=_0x52378d[_0xecab('0x1c')],_0x1d2b34=_0x52378d[_0xecab('0x1c')]+_0x52378d[_0xecab('0x1d')],_0x5e9cab;if(_0x1d2b34>=_0x1e2a57){_0x1d2b34=_0x1e2a57;_0x5e9cab=0xc8;}else{_0x5e9cab=0xce;}_0x4b9b35[_0xecab('0x18')](_0x5e9cab);return _0x4b9b35['set'](_0xecab('0x1e'),_0x2b646c+'-'+_0x1d2b34+'/'+_0x1e2a57)[_0xecab('0x1a')](_0x320567);}return null;};}function patchUpdates(_0x157d8f){return function(_0x544fbf){try{jsonpatch[_0xecab('0x1f')](_0x544fbf,_0x157d8f,!![]);}catch(_0x4da1bf){return BPromise[_0xecab('0x20')](_0x4da1bf);}return _0x544fbf[_0xecab('0x21')]();};}function saveUpdates(_0x4bb615,_0x2e23e0){return function(_0x289729){if(_0x289729){return _0x289729[_0xecab('0x22')](_0x4bb615)['then'](function(_0x8ae825){return _0x8ae825;});}return null;};}function removeEntity(_0x29c826,_0x12a93e){return function(_0x752df0){if(_0x752df0){return _0x752df0[_0xecab('0x23')]()[_0xecab('0x24')](function(){var _0x38bc9e=_0x752df0[_0xecab('0x25')]({'plain':!![]});var _0x4e473e=_0xecab('0x26');return db['UserProfileResource'][_0xecab('0x23')]({'where':{'type':_0x4e473e,'resourceId':_0x38bc9e['id']}})[_0xecab('0x24')](function(){return _0x752df0;});})[_0xecab('0x24')](function(){_0x29c826[_0xecab('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4939,_0x57fc3d){return function(_0x3305bc){if(!_0x3305bc){_0x4e4939['sendStatus'](0x194);}return _0x3305bc;};}function handleError(_0x516c46,_0x3d8d62){_0x3d8d62=_0x3d8d62||0x1f4;return function(_0xc9c3a4){logger[_0xecab('0x27')](_0xc9c3a4[_0xecab('0x28')]);if(_0xc9c3a4[_0xecab('0x29')]){delete _0xc9c3a4[_0xecab('0x29')];}_0x516c46[_0xecab('0x18')](_0x3d8d62)[_0xecab('0x2a')](_0xc9c3a4);};}exports[_0xecab('0x2b')]=function(_0x4cb031,_0x291dfe){var _0x4b3dfb={},_0x1e3b00={},_0x11208e={'count':0x0,'rows':[]};var _0x10d741=_[_0xecab('0x2c')](db[_0xecab('0x2d')][_0xecab('0x2e')],function(_0x506e05){return{'name':_0x506e05[_0xecab('0x2f')],'type':_0x506e05[_0xecab('0x30')][_0xecab('0x31')]};});_0x1e3b00[_0xecab('0x32')]=_[_0xecab('0x2c')](_0x10d741,_0xecab('0x29'));_0x1e3b00[_0xecab('0x33')]=_['keys'](_0x4cb031[_0xecab('0x33')]);_0x1e3b00['filters']=_[_0xecab('0x34')](_0x1e3b00[_0xecab('0x32')],_0x1e3b00[_0xecab('0x33')]);_0x4b3dfb[_0xecab('0x35')]=_[_0xecab('0x34')](_0x1e3b00[_0xecab('0x32')],qs[_0xecab('0x36')](_0x4cb031[_0xecab('0x33')][_0xecab('0x36')]));_0x4b3dfb[_0xecab('0x35')]=_0x4b3dfb[_0xecab('0x35')][_0xecab('0x37')]?_0x4b3dfb['attributes']:_0x1e3b00['model'];if(!_0x4cb031[_0xecab('0x33')][_0xecab('0x38')]('nolimit')){_0x4b3dfb[_0xecab('0x1d')]=qs[_0xecab('0x1d')](_0x4cb031[_0xecab('0x33')][_0xecab('0x1d')]);_0x4b3dfb[_0xecab('0x1c')]=qs['offset'](_0x4cb031[_0xecab('0x33')][_0xecab('0x1c')]);}_0x4b3dfb[_0xecab('0x39')]=qs[_0xecab('0x3a')](_0x4cb031[_0xecab('0x33')][_0xecab('0x3a')]);_0x4b3dfb[_0xecab('0x3b')]=qs[_0xecab('0x3c')](_[_0xecab('0x3d')](_0x4cb031[_0xecab('0x33')],_0x1e3b00[_0xecab('0x3c')]),_0x10d741);if(_0x4cb031[_0xecab('0x33')][_0xecab('0x3e')]){_0x4b3dfb[_0xecab('0x3b')]=_[_0xecab('0x3f')](_0x4b3dfb[_0xecab('0x3b')],{'$or':_[_0xecab('0x2c')](_0x10d741,function(_0x2ef3ec){if(_0x2ef3ec['type']!==_0xecab('0x40')){var _0x1b8e3e={};_0x1b8e3e[_0x2ef3ec[_0xecab('0x29')]]={'$like':'%'+_0x4cb031['query'][_0xecab('0x3e')]+'%'};return _0x1b8e3e;}})});}_0x4b3dfb=_[_0xecab('0x3f')]({},_0x4b3dfb,_0x4cb031[_0xecab('0x41')]);var _0x27a4b0={'where':_0x4b3dfb['where']};return db[_0xecab('0x2d')][_0xecab('0x1b')](_0x27a4b0)['then'](function(_0x217be9){_0x11208e[_0xecab('0x1b')]=_0x217be9;if(_0x4cb031[_0xecab('0x33')][_0xecab('0x42')]){_0x4b3dfb[_0xecab('0x43')]=[{'all':!![]}];}return db[_0xecab('0x2d')][_0xecab('0x44')](_0x4b3dfb);})['then'](function(_0x5e6c6b){_0x11208e[_0xecab('0x45')]=_0x5e6c6b;return _0x11208e;})['then'](respondWithFilteredResult(_0x291dfe,_0x4b3dfb))[_0xecab('0x46')](handleError(_0x291dfe,null));};exports[_0xecab('0x47')]=function(_0x4ab62c,_0x2c1391){var _0x3d4d5e={'raw':!![],'where':{'id':_0x4ab62c[_0xecab('0x48')]['id']}},_0x2dd6ef={};_0x2dd6ef[_0xecab('0x32')]=_[_0xecab('0x49')](db[_0xecab('0x2d')][_0xecab('0x2e')]);_0x2dd6ef[_0xecab('0x33')]=_[_0xecab('0x49')](_0x4ab62c[_0xecab('0x33')]);_0x2dd6ef[_0xecab('0x3c')]=_['intersection'](_0x2dd6ef['model'],_0x2dd6ef['query']);_0x3d4d5e[_0xecab('0x35')]=_['intersection'](_0x2dd6ef[_0xecab('0x32')],qs[_0xecab('0x36')](_0x4ab62c[_0xecab('0x33')][_0xecab('0x36')]));_0x3d4d5e['attributes']=_0x3d4d5e[_0xecab('0x35')][_0xecab('0x37')]?_0x3d4d5e['attributes']:_0x2dd6ef[_0xecab('0x32')];if(_0x4ab62c[_0xecab('0x33')][_0xecab('0x42')]){_0x3d4d5e[_0xecab('0x43')]=[{'all':!![]}];}_0x3d4d5e=_[_0xecab('0x3f')]({},_0x3d4d5e,_0x4ab62c[_0xecab('0x41')]);return db[_0xecab('0x2d')][_0xecab('0x4a')](_0x3d4d5e)[_0xecab('0x24')](handleEntityNotFound(_0x2c1391,null))[_0xecab('0x24')](respondWithResult(_0x2c1391,null))[_0xecab('0x46')](handleError(_0x2c1391,null));};exports['create']=function(_0x3228ce,_0x18c355){return db[_0xecab('0x2d')][_0xecab('0x4b')](_0x3228ce[_0xecab('0x4c')],{})[_0xecab('0x24')](function(_0x4ba5fa){var _0x204156=_0x3228ce[_0xecab('0x4d')][_0xecab('0x25')]({'plain':!![]});if(!_0x204156)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x204156[_0xecab('0x4e')]===_0xecab('0x4d')){var _0x2188b9=_0x4ba5fa[_0xecab('0x25')]({'plain':!![]});var _0x5b6b50=_0xecab('0x26');return db[_0xecab('0x4f')][_0xecab('0x4a')]({'where':{'name':_0x5b6b50,'userProfileId':_0x204156['userProfileId']},'raw':!![]})['then'](function(_0x25a785){if(_0x25a785&&_0x25a785[_0xecab('0x50')]===0x0){return db[_0xecab('0x51')][_0xecab('0x4b')]({'name':_0x2188b9[_0xecab('0x29')],'resourceId':_0x2188b9['id'],'type':_0x25a785[_0xecab('0x29')],'sectionId':_0x25a785['id']},{})[_0xecab('0x24')](function(){return _0x4ba5fa;});}else{return _0x4ba5fa;}})[_0xecab('0x46')](function(_0x28c5ee){logger['error'](_0xecab('0x52'),_0x28c5ee);throw _0x28c5ee;});}return _0x4ba5fa;})[_0xecab('0x24')](respondWithResult(_0x18c355,0xc9))[_0xecab('0x46')](handleError(_0x18c355,null));};exports['update']=function(_0x171245,_0x53ea05){if(_0x171245[_0xecab('0x4c')]['id']){delete _0x171245[_0xecab('0x4c')]['id'];}return db[_0xecab('0x2d')]['find']({'where':{'id':_0x171245[_0xecab('0x48')]['id']}})['then'](handleEntityNotFound(_0x53ea05,null))[_0xecab('0x24')](saveUpdates(_0x171245[_0xecab('0x4c')],null))['then'](respondWithResult(_0x53ea05,null))[_0xecab('0x46')](handleError(_0x53ea05,null));};exports[_0xecab('0x23')]=function(_0x3d8029,_0x26a955){return db['CmContactHasItem'][_0xecab('0x4a')]({'where':{'id':_0x3d8029[_0xecab('0x48')]['id']}})['then'](handleEntityNotFound(_0x26a955,null))['then'](removeEntity(_0x26a955,null))[_0xecab('0x46')](handleError(_0x26a955,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e573945..9d16131 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 _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x50efb1,_0x2b41fe){_0x50efb1=_0x50efb1-0x0;var _0x1f7cec=_0xb4c7[_0x50efb1];return _0x1f7cec;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('CmContactHasItem',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef17=['./cmContactHasItem.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0xef17,0x136));var _0x7ef1=function(_0x3f00bd,_0x506dee){_0x3f00bd=_0x3f00bd-0x0;var _0x24d2ec=_0xef17[_0x3f00bd];return _0x24d2ec;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var logger=require(_0x7ef1('0x2'))(_0x7ef1('0x3'));var moment=require(_0x7ef1('0x4'));var BPromise=require(_0x7ef1('0x5'));var rp=require(_0x7ef1('0x6'));var fs=require('fs');var path=require(_0x7ef1('0x7'));var rimraf=require(_0x7ef1('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ef1('0x9'));module['exports']=function(_0x138ed1,_0x498596){return _0x138ed1[_0x7ef1('0xa')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 5915b54..3110ba6 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 _0x8d4d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e6a39,_0x33c624){var _0x5e9c96=function(_0x5da9a7){while(--_0x5da9a7){_0x4e6a39['push'](_0x4e6a39['shift']());}};_0x5e9c96(++_0x33c624);}(_0x8d4d,0x177));var _0xd8d4=function(_0x3c0bd9,_0x5015a1){_0x3c0bd9=_0x3c0bd9-0x0;var _0x464ad2=_0x8d4d[_0x3c0bd9];return _0x464ad2;};'use strict';var _=require('lodash');var util=require(_0xd8d4('0x0'));var moment=require('moment');var BPromise=require(_0xd8d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8d4('0x2'));var db=require(_0xd8d4('0x3'))['db'];var utils=require(_0xd8d4('0x4'));var logger=require(_0xd8d4('0x5'))(_0xd8d4('0x6'));var config=require(_0xd8d4('0x7'));var jayson=require(_0xd8d4('0x8'));var client=jayson[_0xd8d4('0x9')][_0xd8d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33fca1,_0x5c3627,_0x91c6a5){return new BPromise(function(_0x13266a,_0x373dc3){return client['request'](_0x33fca1,_0x91c6a5)['then'](function(_0x47ec8a){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x5c3627,_0xd8d4('0xb'));logger['debug'](_0xd8d4('0xc'),_0x5c3627,'request\x20sent',JSON[_0xd8d4('0xd')](_0x47ec8a));if(_0x47ec8a[_0xd8d4('0xe')]){if(_0x47ec8a[_0xd8d4('0xe')]['code']===0x1f4){logger['error'](_0xd8d4('0xf'),_0x5c3627,_0x47ec8a['error'][_0xd8d4('0x10')]);return _0x373dc3(_0x47ec8a[_0xd8d4('0xe')][_0xd8d4('0x10')]);}logger['error'](_0xd8d4('0xf'),_0x5c3627,_0x47ec8a['error'][_0xd8d4('0x10')]);return _0x13266a(_0x47ec8a[_0xd8d4('0xe')][_0xd8d4('0x10')]);}else{logger['info'](_0xd8d4('0xf'),_0x5c3627,_0xd8d4('0xb'));_0x13266a(_0x47ec8a[_0xd8d4('0x11')][_0xd8d4('0x10')]);}})[_0xd8d4('0x12')](function(_0x44700a){logger['error'](_0xd8d4('0xf'),_0x5c3627,_0x44700a);_0x373dc3(_0x44700a);});});} \ No newline at end of file +var _0xd406=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x1a82b8,_0x23613a){var _0x4e53d6=function(_0x371c1b){while(--_0x371c1b){_0x1a82b8['push'](_0x1a82b8['shift']());}};_0x4e53d6(++_0x23613a);}(_0xd406,0x90));var _0x6d40=function(_0x5e77b0,_0x177c6e){_0x5e77b0=_0x5e77b0-0x0;var _0x8773d3=_0xd406[_0x5e77b0];return _0x8773d3;};'use strict';var _=require(_0x6d40('0x0'));var util=require(_0x6d40('0x1'));var moment=require(_0x6d40('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d40('0x3'));var fs=require('fs');var Redis=require(_0x6d40('0x4'));var db=require(_0x6d40('0x5'))['db'];var utils=require(_0x6d40('0x6'));var logger=require(_0x6d40('0x7'))('rpc');var config=require(_0x6d40('0x8'));var jayson=require(_0x6d40('0x9'));var client=jayson[_0x6d40('0xa')][_0x6d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aa973,_0x23f6fd,_0x598bc6){return new BPromise(function(_0x5bdeac,_0x5419d9){return client[_0x6d40('0xc')](_0x5aa973,_0x598bc6)['then'](function(_0x2929cc){logger[_0x6d40('0xd')](_0x6d40('0xe'),_0x23f6fd,_0x6d40('0xf'));logger['debug'](_0x6d40('0x10'),_0x23f6fd,_0x6d40('0xf'),JSON[_0x6d40('0x11')](_0x2929cc));if(_0x2929cc['error']){if(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x13')]===0x1f4){logger[_0x6d40('0x12')](_0x6d40('0xe'),_0x23f6fd,_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);return _0x5419d9(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);}logger['error'](_0x6d40('0xe'),_0x23f6fd,_0x2929cc['error']['message']);return _0x5bdeac(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);}else{logger[_0x6d40('0xd')](_0x6d40('0xe'),_0x23f6fd,'request\x20sent');_0x5bdeac(_0x2929cc[_0x6d40('0x15')][_0x6d40('0x14')]);}})[_0x6d40('0x16')](function(_0x458c5c){logger[_0x6d40('0x12')](_0x6d40('0xe'),_0x23f6fd,_0x458c5c);_0x5419d9(_0x458c5c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 0365a2c..cc4b986 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 _0xcc5a=['./cmContactHasItem.controller','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x276232,_0x20b6b8){var _0x427024=function(_0x2e7ff8){while(--_0x2e7ff8){_0x276232['push'](_0x276232['shift']());}};_0x427024(++_0x20b6b8);}(_0xcc5a,0x1a2));var _0xacc5=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xcc5a[_0x500c0];return _0xdd146f;};'use strict';var multer=require(_0xacc5('0x0'));var util=require(_0xacc5('0x1'));var path=require(_0xacc5('0x2'));var timeout=require(_0xacc5('0x3'));var express=require('express');var router=express[_0xacc5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xacc5('0x5'));var config=require(_0xacc5('0x6'));var controller=require(_0xacc5('0x7'));router['get']('/',auth[_0xacc5('0x8')](),controller[_0xacc5('0x9')]);router['get'](_0xacc5('0xa'),auth[_0xacc5('0x8')](),controller[_0xacc5('0xb')]);router[_0xacc5('0xc')]('/',auth[_0xacc5('0x8')](),controller[_0xacc5('0xd')]);router[_0xacc5('0xe')]('/:id',auth[_0xacc5('0x8')](),controller[_0xacc5('0xf')]);router['delete'](_0xacc5('0xa'),auth[_0xacc5('0x8')](),controller['destroy']);module[_0xacc5('0x10')]=router; \ No newline at end of file +var _0x773f=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5a15b0,_0x536bb2){var _0x2b4e64=function(_0x59869e){while(--_0x59869e){_0x5a15b0['push'](_0x5a15b0['shift']());}};_0x2b4e64(++_0x536bb2);}(_0x773f,0xeb));var _0xf773=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x773f[_0x4d7a61];return _0x186f73;};'use strict';var multer=require(_0xf773('0x0'));var util=require(_0xf773('0x1'));var path=require('path');var timeout=require(_0xf773('0x2'));var express=require(_0xf773('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf773('0x4'));var config=require(_0xf773('0x5'));var controller=require(_0xf773('0x6'));router[_0xf773('0x7')]('/',auth[_0xf773('0x8')](),controller['index']);router[_0xf773('0x7')](_0xf773('0x9'),auth[_0xf773('0x8')](),controller[_0xf773('0xa')]);router[_0xf773('0xb')]('/',auth['isAuthenticated'](),controller[_0xf773('0xc')]);router[_0xf773('0xd')](_0xf773('0x9'),auth[_0xf773('0x8')](),controller[_0xf773('0xe')]);router[_0xf773('0xf')](_0xf773('0x9'),auth[_0xf773('0x8')](),controller[_0xf773('0x10')]);module[_0xf773('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index ad39ab8..d06c79e 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 _0x5326=['STRING','sequelize','exports'];(function(_0x3bc9bc,_0x18fef1){var _0x52f33e=function(_0x4a95c5){while(--_0x4a95c5){_0x3bc9bc['push'](_0x3bc9bc['shift']());}};_0x52f33e(++_0x18fef1);}(_0x5326,0x112));var _0x6532=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x5326[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0x6532('0x0'));module[_0x6532('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x6532('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xbc18=['sequelize','exports','INTEGER','STRING'];(function(_0x143620,_0x113d45){var _0x40341b=function(_0x608aa3){while(--_0x608aa3){_0x143620['push'](_0x143620['shift']());}};_0x40341b(++_0x113d45);}(_0xbc18,0x1cc));var _0x8bc1=function(_0x5947f8,_0x305779){_0x5947f8=_0x5947f8-0x0;var _0x43888e=_0xbc18[_0x5947f8];return _0x43888e;};'use strict';var Sequelize=require(_0x8bc1('0x0'));module[_0x8bc1('0x1')]={'CmContactId':{'type':Sequelize[_0x8bc1('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x8bc1('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index dd2dfc0..1794d58 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 _0xb7ac=['type','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','CmContactHasPhone','findAll','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','save','then','destroy','get','CmContactHasPhones','UserProfileResource','error','name','send','rawAttributes'];(function(_0x599e0a,_0x3162d9){var _0x3ac3e0=function(_0x4aad77){while(--_0x4aad77){_0x599e0a['push'](_0x599e0a['shift']());}};_0x3ac3e0(++_0x3162d9);}(_0xb7ac,0x1e2));var _0xcb7a=function(_0x521581,_0x1c7e7f){_0x521581=_0x521581-0x0;var _0x3626d5=_0xb7ac[_0x521581];return _0x3626d5;};'use strict';var pdf=require(_0xcb7a('0x0'));var emlformat=require(_0xcb7a('0x1'));var rimraf=require(_0xcb7a('0x2'));var zipdir=require(_0xcb7a('0x3'));var jsonpatch=require(_0xcb7a('0x4'));var rp=require(_0xcb7a('0x5'));var moment=require('moment');var BPromise=require(_0xcb7a('0x6'));var Mustache=require(_0xcb7a('0x7'));var util=require('util');var path=require(_0xcb7a('0x8'));var sox=require(_0xcb7a('0x9'));var csv=require(_0xcb7a('0xa'));var ejs=require(_0xcb7a('0xb'));var fs=require('fs');var _=require(_0xcb7a('0xc'));var squel=require(_0xcb7a('0xd'));var crypto=require('crypto');var jsforce=require(_0xcb7a('0xe'));var deskjs=require(_0xcb7a('0xf'));var toCsv=require(_0xcb7a('0xa'));var querystring=require(_0xcb7a('0x10'));var Papa=require('papaparse');var Redis=require(_0xcb7a('0x11'));var authService=require(_0xcb7a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcb7a('0x13'));var hardwareService=require(_0xcb7a('0x14'));var logger=require('../../config/logger')(_0xcb7a('0x15'));var utils=require(_0xcb7a('0x16'));var config=require(_0xcb7a('0x17'));var licenseUtil=require(_0xcb7a('0x18'));var db=require(_0xcb7a('0x19'))['db'];function respondWithStatusCode(_0x41e6be,_0xd3da02){_0xd3da02=_0xd3da02||0xcc;return function(_0x2108b7){if(_0x2108b7){return _0x41e6be[_0xcb7a('0x1a')](_0xd3da02);}return _0x41e6be[_0xcb7a('0x1b')](_0xd3da02)[_0xcb7a('0x1c')]();};}function respondWithResult(_0x463258,_0x1e735a){_0x1e735a=_0x1e735a||0xc8;return function(_0x3b8c2a){if(_0x3b8c2a){return _0x463258[_0xcb7a('0x1b')](_0x1e735a)[_0xcb7a('0x1d')](_0x3b8c2a);}};}function respondWithFilteredResult(_0x4231cf,_0x46c2fd){return function(_0x497728){if(_0x497728){var _0x1575f7=_0x497728[_0xcb7a('0x1e')],_0x1e1825=_0x46c2fd[_0xcb7a('0x1f')],_0x3413b3=_0x46c2fd[_0xcb7a('0x1f')]+_0x46c2fd['limit'],_0x477a76;if(_0x3413b3>=_0x1575f7){_0x3413b3=_0x1575f7;_0x477a76=0xc8;}else{_0x477a76=0xce;}_0x4231cf[_0xcb7a('0x1b')](_0x477a76);return _0x4231cf['set']('Content-Range',_0x1e1825+'-'+_0x3413b3+'/'+_0x1575f7)[_0xcb7a('0x1d')](_0x497728);}return null;};}function patchUpdates(_0x35a955){return function(_0xa687d){try{jsonpatch[_0xcb7a('0x20')](_0xa687d,_0x35a955,!![]);}catch(_0x41a3f8){return BPromise['reject'](_0x41a3f8);}return _0xa687d[_0xcb7a('0x21')]();};}function saveUpdates(_0x43302c,_0x67955c){return function(_0x279114){if(_0x279114){return _0x279114['update'](_0x43302c)[_0xcb7a('0x22')](function(_0x32ddb6){return _0x32ddb6;});}return null;};}function removeEntity(_0x2936b4,_0x2b0eaa){return function(_0x51b439){if(_0x51b439){return _0x51b439[_0xcb7a('0x23')]()[_0xcb7a('0x22')](function(){var _0x3b5f45=_0x51b439[_0xcb7a('0x24')]({'plain':!![]});var _0x35a080=_0xcb7a('0x25');return db[_0xcb7a('0x26')]['destroy']({'where':{'type':_0x35a080,'resourceId':_0x3b5f45['id']}})[_0xcb7a('0x22')](function(){return _0x51b439;});})[_0xcb7a('0x22')](function(){_0x2936b4[_0xcb7a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309b9c,_0x586e76){return function(_0x173fc4){if(!_0x173fc4){_0x309b9c['sendStatus'](0x194);}return _0x173fc4;};}function handleError(_0x2c755f,_0xf50410){_0xf50410=_0xf50410||0x1f4;return function(_0x2a64c6){logger[_0xcb7a('0x27')](_0x2a64c6['stack']);if(_0x2a64c6[_0xcb7a('0x28')]){delete _0x2a64c6[_0xcb7a('0x28')];}_0x2c755f[_0xcb7a('0x1b')](_0xf50410)[_0xcb7a('0x29')](_0x2a64c6);};}exports['index']=function(_0x35343,_0x1362c2){var _0x480b43={},_0x4aff78={},_0x5c634d={'count':0x0,'rows':[]};var _0x1491c0=_['map'](db['CmContactHasPhone'][_0xcb7a('0x2a')],function(_0x526797){return{'name':_0x526797['fieldName'],'type':_0x526797[_0xcb7a('0x2b')]['key']};});_0x4aff78[_0xcb7a('0x2c')]=_[_0xcb7a('0x2d')](_0x1491c0,_0xcb7a('0x28'));_0x4aff78[_0xcb7a('0x2e')]=_['keys'](_0x35343[_0xcb7a('0x2e')]);_0x4aff78[_0xcb7a('0x2f')]=_[_0xcb7a('0x30')](_0x4aff78[_0xcb7a('0x2c')],_0x4aff78[_0xcb7a('0x2e')]);_0x480b43[_0xcb7a('0x31')]=_[_0xcb7a('0x30')](_0x4aff78[_0xcb7a('0x2c')],qs[_0xcb7a('0x32')](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x32')]));_0x480b43['attributes']=_0x480b43[_0xcb7a('0x31')][_0xcb7a('0x33')]?_0x480b43[_0xcb7a('0x31')]:_0x4aff78[_0xcb7a('0x2c')];if(!_0x35343[_0xcb7a('0x2e')]['hasOwnProperty'](_0xcb7a('0x34'))){_0x480b43[_0xcb7a('0x35')]=qs[_0xcb7a('0x35')](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x35')]);_0x480b43[_0xcb7a('0x1f')]=qs['offset'](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x1f')]);}_0x480b43[_0xcb7a('0x36')]=qs[_0xcb7a('0x37')](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x37')]);_0x480b43[_0xcb7a('0x38')]=qs[_0xcb7a('0x2f')](_[_0xcb7a('0x39')](_0x35343[_0xcb7a('0x2e')],_0x4aff78[_0xcb7a('0x2f')]),_0x1491c0);if(_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x3a')]){_0x480b43[_0xcb7a('0x38')]=_[_0xcb7a('0x3b')](_0x480b43[_0xcb7a('0x38')],{'$or':_['map'](_0x1491c0,function(_0x1c104a){if(_0x1c104a[_0xcb7a('0x2b')]!=='VIRTUAL'){var _0x80d627={};_0x80d627[_0x1c104a['name']]={'$like':'%'+_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x3a')]+'%'};return _0x80d627;}})});}_0x480b43=_['merge']({},_0x480b43,_0x35343['options']);var _0x14dd26={'where':_0x480b43[_0xcb7a('0x38')]};return db[_0xcb7a('0x3c')]['count'](_0x14dd26)[_0xcb7a('0x22')](function(_0x2beeb2){_0x5c634d[_0xcb7a('0x1e')]=_0x2beeb2;if(_0x35343[_0xcb7a('0x2e')]['includeAll']){_0x480b43['include']=[{'all':!![]}];}return db[_0xcb7a('0x3c')][_0xcb7a('0x3d')](_0x480b43);})['then'](function(_0x465bfb){_0x5c634d['rows']=_0x465bfb;return _0x5c634d;})[_0xcb7a('0x22')](respondWithFilteredResult(_0x1362c2,_0x480b43))[_0xcb7a('0x3e')](handleError(_0x1362c2,null));};exports['show']=function(_0x130dc0,_0x554210){var _0x3fd5b3={'raw':!![],'where':{'id':_0x130dc0[_0xcb7a('0x3f')]['id']}},_0x229388={};_0x229388[_0xcb7a('0x2c')]=_['keys'](db[_0xcb7a('0x3c')]['rawAttributes']);_0x229388[_0xcb7a('0x2e')]=_[_0xcb7a('0x40')](_0x130dc0[_0xcb7a('0x2e')]);_0x229388[_0xcb7a('0x2f')]=_[_0xcb7a('0x30')](_0x229388[_0xcb7a('0x2c')],_0x229388['query']);_0x3fd5b3[_0xcb7a('0x31')]=_['intersection'](_0x229388['model'],qs['fields'](_0x130dc0['query']['fields']));_0x3fd5b3['attributes']=_0x3fd5b3[_0xcb7a('0x31')][_0xcb7a('0x33')]?_0x3fd5b3[_0xcb7a('0x31')]:_0x229388[_0xcb7a('0x2c')];if(_0x130dc0[_0xcb7a('0x2e')]['includeAll']){_0x3fd5b3['include']=[{'all':!![]}];}_0x3fd5b3=_[_0xcb7a('0x3b')]({},_0x3fd5b3,_0x130dc0[_0xcb7a('0x41')]);return db['CmContactHasPhone'][_0xcb7a('0x42')](_0x3fd5b3)[_0xcb7a('0x22')](handleEntityNotFound(_0x554210,null))['then'](respondWithResult(_0x554210,null))[_0xcb7a('0x3e')](handleError(_0x554210,null));};exports[_0xcb7a('0x43')]=function(_0x23111b,_0x47df58){return db[_0xcb7a('0x3c')][_0xcb7a('0x43')](_0x23111b[_0xcb7a('0x44')],{})[_0xcb7a('0x22')](function(_0x53c23f){var _0x4f5bdd=_0x23111b[_0xcb7a('0x45')]['get']({'plain':!![]});if(!_0x4f5bdd)throw new Error(_0xcb7a('0x46'));if(_0x4f5bdd['role']===_0xcb7a('0x45')){var _0x1c168e=_0x53c23f[_0xcb7a('0x24')]({'plain':!![]});var _0x5b5b33=_0xcb7a('0x25');return db[_0xcb7a('0x47')][_0xcb7a('0x42')]({'where':{'name':_0x5b5b33,'userProfileId':_0x4f5bdd[_0xcb7a('0x48')]},'raw':!![]})['then'](function(_0x3dcbec){if(_0x3dcbec&&_0x3dcbec[_0xcb7a('0x49')]===0x0){return db[_0xcb7a('0x26')][_0xcb7a('0x43')]({'name':_0x1c168e['name'],'resourceId':_0x1c168e['id'],'type':_0x3dcbec['name'],'sectionId':_0x3dcbec['id']},{})[_0xcb7a('0x22')](function(){return _0x53c23f;});}else{return _0x53c23f;}})[_0xcb7a('0x3e')](function(_0x47b0c7){logger[_0xcb7a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47b0c7);throw _0x47b0c7;});}return _0x53c23f;})[_0xcb7a('0x22')](respondWithResult(_0x47df58,0xc9))['catch'](handleError(_0x47df58,null));};exports[_0xcb7a('0x4a')]=function(_0x3efd96,_0x25adc5){if(_0x3efd96['body']['id']){delete _0x3efd96[_0xcb7a('0x44')]['id'];}return db[_0xcb7a('0x3c')][_0xcb7a('0x42')]({'where':{'id':_0x3efd96[_0xcb7a('0x3f')]['id']}})[_0xcb7a('0x22')](handleEntityNotFound(_0x25adc5,null))[_0xcb7a('0x22')](saveUpdates(_0x3efd96[_0xcb7a('0x44')],null))[_0xcb7a('0x22')](respondWithResult(_0x25adc5,null))[_0xcb7a('0x3e')](handleError(_0x25adc5,null));};exports[_0xcb7a('0x23')]=function(_0x3c32b4,_0x3ba1f3){return db[_0xcb7a('0x3c')]['find']({'where':{'id':_0x3c32b4[_0xcb7a('0x3f')]['id']}})[_0xcb7a('0x22')](handleEntityNotFound(_0x3ba1f3,null))[_0xcb7a('0x22')](removeEntity(_0x3ba1f3,null))[_0xcb7a('0x3e')](handleError(_0x3ba1f3,null));}; \ No newline at end of file +var _0xb911=['length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','CmContactHasPhones','end','error','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xb911,0x1a4));var _0x1b91=function(_0x59b439,_0x4e16b6){_0x59b439=_0x59b439-0x0;var _0x74d02b=_0xb911[_0x59b439];return _0x74d02b;};'use strict';var pdf=require(_0x1b91('0x0'));var emlformat=require(_0x1b91('0x1'));var rimraf=require(_0x1b91('0x2'));var zipdir=require(_0x1b91('0x3'));var jsonpatch=require(_0x1b91('0x4'));var rp=require(_0x1b91('0x5'));var moment=require('moment');var BPromise=require(_0x1b91('0x6'));var Mustache=require(_0x1b91('0x7'));var util=require('util');var path=require(_0x1b91('0x8'));var sox=require(_0x1b91('0x9'));var csv=require(_0x1b91('0xa'));var ejs=require(_0x1b91('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b91('0xc'));var crypto=require(_0x1b91('0xd'));var jsforce=require(_0x1b91('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1b91('0xa'));var querystring=require(_0x1b91('0xf'));var Papa=require(_0x1b91('0x10'));var Redis=require(_0x1b91('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1b91('0x12'));var as=require(_0x1b91('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1b91('0x14'));var config=require(_0x1b91('0x15'));var licenseUtil=require(_0x1b91('0x16'));var db=require(_0x1b91('0x17'))['db'];function respondWithStatusCode(_0x38b6e1,_0x462e9a){_0x462e9a=_0x462e9a||0xcc;return function(_0x3a2d47){if(_0x3a2d47){return _0x38b6e1[_0x1b91('0x18')](_0x462e9a);}return _0x38b6e1[_0x1b91('0x19')](_0x462e9a)['end']();};}function respondWithResult(_0x326318,_0x1641f8){_0x1641f8=_0x1641f8||0xc8;return function(_0x2cac1d){if(_0x2cac1d){return _0x326318[_0x1b91('0x19')](_0x1641f8)[_0x1b91('0x1a')](_0x2cac1d);}};}function respondWithFilteredResult(_0x2fd073,_0x148372){return function(_0x5b571c){if(_0x5b571c){var _0x5b6898=_0x5b571c[_0x1b91('0x1b')],_0x315268=_0x148372['offset'],_0x2fa998=_0x148372[_0x1b91('0x1c')]+_0x148372[_0x1b91('0x1d')],_0x5e5214;if(_0x2fa998>=_0x5b6898){_0x2fa998=_0x5b6898;_0x5e5214=0xc8;}else{_0x5e5214=0xce;}_0x2fd073[_0x1b91('0x19')](_0x5e5214);return _0x2fd073['set'](_0x1b91('0x1e'),_0x315268+'-'+_0x2fa998+'/'+_0x5b6898)[_0x1b91('0x1a')](_0x5b571c);}return null;};}function patchUpdates(_0x4d6570){return function(_0x3bdccb){try{jsonpatch[_0x1b91('0x1f')](_0x3bdccb,_0x4d6570,!![]);}catch(_0x1069d9){return BPromise[_0x1b91('0x20')](_0x1069d9);}return _0x3bdccb[_0x1b91('0x21')]();};}function saveUpdates(_0xe85452,_0x33a3e1){return function(_0x58c04e){if(_0x58c04e){return _0x58c04e['update'](_0xe85452)[_0x1b91('0x22')](function(_0x3ded5d){return _0x3ded5d;});}return null;};}function removeEntity(_0x4b6e08,_0x4e6989){return function(_0x10d3cd){if(_0x10d3cd){return _0x10d3cd['destroy']()[_0x1b91('0x22')](function(){var _0x3cc583=_0x10d3cd['get']({'plain':!![]});var _0x54e38f=_0x1b91('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x54e38f,'resourceId':_0x3cc583['id']}})[_0x1b91('0x22')](function(){return _0x10d3cd;});})['then'](function(){_0x4b6e08[_0x1b91('0x19')](0xcc)[_0x1b91('0x24')]();});}};}function handleEntityNotFound(_0x3e06c1,_0x53178a){return function(_0x2b8b79){if(!_0x2b8b79){_0x3e06c1[_0x1b91('0x18')](0x194);}return _0x2b8b79;};}function handleError(_0x553f28,_0x4aa7fa){_0x4aa7fa=_0x4aa7fa||0x1f4;return function(_0x43cdb4){logger[_0x1b91('0x25')](_0x43cdb4[_0x1b91('0x26')]);if(_0x43cdb4[_0x1b91('0x27')]){delete _0x43cdb4[_0x1b91('0x27')];}_0x553f28[_0x1b91('0x19')](_0x4aa7fa)[_0x1b91('0x28')](_0x43cdb4);};}exports[_0x1b91('0x29')]=function(_0x5150d0,_0x7fe5fb){var _0xa56229={},_0x5f1df0={},_0x2565ae={'count':0x0,'rows':[]};var _0x22e215=_[_0x1b91('0x2a')](db[_0x1b91('0x2b')][_0x1b91('0x2c')],function(_0x141257){return{'name':_0x141257[_0x1b91('0x2d')],'type':_0x141257[_0x1b91('0x2e')]['key']};});_0x5f1df0['model']=_[_0x1b91('0x2a')](_0x22e215,'name');_0x5f1df0[_0x1b91('0x2f')]=_[_0x1b91('0x30')](_0x5150d0['query']);_0x5f1df0[_0x1b91('0x31')]=_[_0x1b91('0x32')](_0x5f1df0['model'],_0x5f1df0[_0x1b91('0x2f')]);_0xa56229['attributes']=_['intersection'](_0x5f1df0[_0x1b91('0x33')],qs['fields'](_0x5150d0['query'][_0x1b91('0x34')]));_0xa56229[_0x1b91('0x35')]=_0xa56229[_0x1b91('0x35')][_0x1b91('0x36')]?_0xa56229['attributes']:_0x5f1df0[_0x1b91('0x33')];if(!_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x37')]('nolimit')){_0xa56229[_0x1b91('0x1d')]=qs['limit'](_0x5150d0['query'][_0x1b91('0x1d')]);_0xa56229[_0x1b91('0x1c')]=qs[_0x1b91('0x1c')](_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x1c')]);}_0xa56229['order']=qs[_0x1b91('0x38')](_0x5150d0['query'][_0x1b91('0x38')]);_0xa56229['where']=qs[_0x1b91('0x31')](_['pick'](_0x5150d0[_0x1b91('0x2f')],_0x5f1df0['filters']),_0x22e215);if(_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x39')]){_0xa56229[_0x1b91('0x3a')]=_[_0x1b91('0x3b')](_0xa56229[_0x1b91('0x3a')],{'$or':_[_0x1b91('0x2a')](_0x22e215,function(_0x59cc1f){if(_0x59cc1f['type']!==_0x1b91('0x3c')){var _0x1dbc0b={};_0x1dbc0b[_0x59cc1f[_0x1b91('0x27')]]={'$like':'%'+_0x5150d0[_0x1b91('0x2f')][_0x1b91('0x39')]+'%'};return _0x1dbc0b;}})});}_0xa56229=_['merge']({},_0xa56229,_0x5150d0[_0x1b91('0x3d')]);var _0x1be855={'where':_0xa56229[_0x1b91('0x3a')]};return db['CmContactHasPhone'][_0x1b91('0x1b')](_0x1be855)['then'](function(_0x347426){_0x2565ae[_0x1b91('0x1b')]=_0x347426;if(_0x5150d0[_0x1b91('0x2f')]['includeAll']){_0xa56229[_0x1b91('0x3e')]=[{'all':!![]}];}return db[_0x1b91('0x2b')][_0x1b91('0x3f')](_0xa56229);})[_0x1b91('0x22')](function(_0x518a09){_0x2565ae['rows']=_0x518a09;return _0x2565ae;})['then'](respondWithFilteredResult(_0x7fe5fb,_0xa56229))[_0x1b91('0x40')](handleError(_0x7fe5fb,null));};exports[_0x1b91('0x41')]=function(_0x2b7a62,_0x24a798){var _0x5e8a38={'raw':!![],'where':{'id':_0x2b7a62[_0x1b91('0x42')]['id']}},_0x893fc2={};_0x893fc2['model']=_[_0x1b91('0x30')](db[_0x1b91('0x2b')][_0x1b91('0x2c')]);_0x893fc2['query']=_[_0x1b91('0x30')](_0x2b7a62[_0x1b91('0x2f')]);_0x893fc2[_0x1b91('0x31')]=_[_0x1b91('0x32')](_0x893fc2[_0x1b91('0x33')],_0x893fc2[_0x1b91('0x2f')]);_0x5e8a38['attributes']=_[_0x1b91('0x32')](_0x893fc2['model'],qs[_0x1b91('0x34')](_0x2b7a62['query'][_0x1b91('0x34')]));_0x5e8a38[_0x1b91('0x35')]=_0x5e8a38[_0x1b91('0x35')][_0x1b91('0x36')]?_0x5e8a38[_0x1b91('0x35')]:_0x893fc2[_0x1b91('0x33')];if(_0x2b7a62['query'][_0x1b91('0x43')]){_0x5e8a38[_0x1b91('0x3e')]=[{'all':!![]}];}_0x5e8a38=_[_0x1b91('0x3b')]({},_0x5e8a38,_0x2b7a62[_0x1b91('0x3d')]);return db[_0x1b91('0x2b')][_0x1b91('0x44')](_0x5e8a38)[_0x1b91('0x22')](handleEntityNotFound(_0x24a798,null))[_0x1b91('0x22')](respondWithResult(_0x24a798,null))[_0x1b91('0x40')](handleError(_0x24a798,null));};exports[_0x1b91('0x45')]=function(_0x58241d,_0x152982){return db[_0x1b91('0x2b')]['create'](_0x58241d[_0x1b91('0x46')],{})[_0x1b91('0x22')](function(_0x590155){var _0x156e46=_0x58241d[_0x1b91('0x47')][_0x1b91('0x48')]({'plain':!![]});if(!_0x156e46)throw new Error(_0x1b91('0x49'));if(_0x156e46['role']==='user'){var _0x968217=_0x590155[_0x1b91('0x48')]({'plain':!![]});var _0xf0a048=_0x1b91('0x23');return db[_0x1b91('0x4a')][_0x1b91('0x44')]({'where':{'name':_0xf0a048,'userProfileId':_0x156e46[_0x1b91('0x4b')]},'raw':!![]})['then'](function(_0x3e5bc0){if(_0x3e5bc0&&_0x3e5bc0['autoAssociation']===0x0){return db[_0x1b91('0x4c')]['create']({'name':_0x968217['name'],'resourceId':_0x968217['id'],'type':_0x3e5bc0[_0x1b91('0x27')],'sectionId':_0x3e5bc0['id']},{})[_0x1b91('0x22')](function(){return _0x590155;});}else{return _0x590155;}})[_0x1b91('0x40')](function(_0x2369bc){logger[_0x1b91('0x25')](_0x1b91('0x4d'),_0x2369bc);throw _0x2369bc;});}return _0x590155;})[_0x1b91('0x22')](respondWithResult(_0x152982,0xc9))['catch'](handleError(_0x152982,null));};exports['update']=function(_0x4b824e,_0x391021){if(_0x4b824e[_0x1b91('0x46')]['id']){delete _0x4b824e[_0x1b91('0x46')]['id'];}return db[_0x1b91('0x2b')]['find']({'where':{'id':_0x4b824e[_0x1b91('0x42')]['id']}})['then'](handleEntityNotFound(_0x391021,null))[_0x1b91('0x22')](saveUpdates(_0x4b824e[_0x1b91('0x46')],null))[_0x1b91('0x22')](respondWithResult(_0x391021,null))[_0x1b91('0x40')](handleError(_0x391021,null));};exports[_0x1b91('0x4e')]=function(_0x3216ba,_0x3bb26d){return db['CmContactHasPhone'][_0x1b91('0x44')]({'where':{'id':_0x3216ba['params']['id']}})[_0x1b91('0x22')](handleEntityNotFound(_0x3bb26d,null))[_0x1b91('0x22')](removeEntity(_0x3bb26d,null))[_0x1b91('0x40')](handleError(_0x3bb26d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 66a5b86..1a00bcf 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 _0x63c9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmContactHasPhone.attributes','exports','define','cm_contact_has_phones'];(function(_0x3840cc,_0x375936){var _0xfe3d26=function(_0x49bde3){while(--_0x49bde3){_0x3840cc['push'](_0x3840cc['shift']());}};_0xfe3d26(++_0x375936);}(_0x63c9,0x140));var _0x963c=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x63c9[_0x1b7368];return _0x25d54c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x963c('0x0'))(_0x963c('0x1'));var moment=require(_0x963c('0x2'));var BPromise=require(_0x963c('0x3'));var rp=require(_0x963c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x963c('0x5'));var config=require('../../config/environment');var attributes=require(_0x963c('0x6'));module[_0x963c('0x7')]=function(_0x2c2ebe,_0x3e5757){return _0x2c2ebe[_0x963c('0x8')]('CmContactHasPhone',attributes,{'tableName':_0x963c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4534=['api','bluebird','request-promise','path','rimraf','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger'];(function(_0x28efc5,_0x14d3e6){var _0x140266=function(_0xb702a7){while(--_0xb702a7){_0x28efc5['push'](_0x28efc5['shift']());}};_0x140266(++_0x14d3e6);}(_0x4534,0x141));var _0x4453=function(_0x40ff15,_0x5cb6b9){_0x40ff15=_0x40ff15-0x0;var _0x4fde1e=_0x4534[_0x40ff15];return _0x4fde1e;};'use strict';var _=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var logger=require(_0x4453('0x2'))(_0x4453('0x3'));var moment=require('moment');var BPromise=require(_0x4453('0x4'));var rp=require(_0x4453('0x5'));var fs=require('fs');var path=require(_0x4453('0x6'));var rimraf=require(_0x4453('0x7'));var config=require('../../config/environment');var attributes=require('./cmContactHasPhone.attributes');module[_0x4453('0x8')]=function(_0x456815,_0x25bf80){return _0x456815[_0x4453('0x9')](_0x4453('0xa'),attributes,{'tableName':_0x4453('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index ea66ced..8c8f78a 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 _0x9fc3=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','CmContactHasPhone,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x2b57fc,_0x4b3658){var _0x5bf238=function(_0x21661a){while(--_0x21661a){_0x2b57fc['push'](_0x2b57fc['shift']());}};_0x5bf238(++_0x4b3658);}(_0x9fc3,0xcb));var _0x39fc=function(_0x49718d,_0x560049){_0x49718d=_0x49718d-0x0;var _0x55e136=_0x9fc3[_0x49718d];return _0x55e136;};'use strict';var _=require(_0x39fc('0x0'));var util=require(_0x39fc('0x1'));var moment=require(_0x39fc('0x2'));var BPromise=require(_0x39fc('0x3'));var rs=require(_0x39fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39fc('0x5'));var logger=require(_0x39fc('0x6'))('rpc');var config=require(_0x39fc('0x7'));var jayson=require(_0x39fc('0x8'));var client=jayson[_0x39fc('0x9')][_0x39fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39d163,_0x3d017c,_0x4e70fa){return new BPromise(function(_0x108460,_0x55652d){return client[_0x39fc('0xb')](_0x39d163,_0x4e70fa)[_0x39fc('0xc')](function(_0x372503){logger[_0x39fc('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x3d017c,_0x39fc('0xe'));logger[_0x39fc('0xf')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x3d017c,_0x39fc('0xe'),JSON[_0x39fc('0x10')](_0x372503));if(_0x372503[_0x39fc('0x11')]){if(_0x372503['error']['code']===0x1f4){logger[_0x39fc('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x3d017c,_0x372503[_0x39fc('0x11')][_0x39fc('0x12')]);return _0x55652d(_0x372503[_0x39fc('0x11')]['message']);}logger[_0x39fc('0x11')](_0x39fc('0x13'),_0x3d017c,_0x372503[_0x39fc('0x11')]['message']);return _0x108460(_0x372503[_0x39fc('0x11')][_0x39fc('0x12')]);}else{logger['info']('CmContactHasPhone,\x20%s,\x20%s',_0x3d017c,'request\x20sent');_0x108460(_0x372503[_0x39fc('0x14')][_0x39fc('0x12')]);}})['catch'](function(_0x2d1d2f){logger[_0x39fc('0x11')](_0x39fc('0x13'),_0x3d017c,_0x2d1d2f);_0x55652d(_0x2d1d2f);});});} \ No newline at end of file +var _0x80fa=['request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasPhone,\x20%s,\x20%s'];(function(_0x2b6665,_0x329301){var _0x2e1757=function(_0x114260){while(--_0x114260){_0x2b6665['push'](_0x2b6665['shift']());}};_0x2e1757(++_0x329301);}(_0x80fa,0xd9));var _0xa80f=function(_0x2b1ff8,_0x3736ac){_0x2b1ff8=_0x2b1ff8-0x0;var _0x10f83a=_0x80fa[_0x2b1ff8];return _0x10f83a;};'use strict';var _=require(_0xa80f('0x0'));var util=require('util');var moment=require(_0xa80f('0x1'));var BPromise=require(_0xa80f('0x2'));var rs=require(_0xa80f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa80f('0x4'))['db'];var utils=require(_0xa80f('0x5'));var logger=require('../../config/logger')(_0xa80f('0x6'));var config=require(_0xa80f('0x7'));var jayson=require(_0xa80f('0x8'));var client=jayson[_0xa80f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4826dc,_0x7a5c59,_0x1eb9ef){return new BPromise(function(_0x10fc96,_0x5b20a7){return client[_0xa80f('0xa')](_0x4826dc,_0x1eb9ef)[_0xa80f('0xb')](function(_0x41d8f7){logger[_0xa80f('0xc')](_0xa80f('0xd'),_0x7a5c59,_0xa80f('0xe'));logger[_0xa80f('0xf')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x7a5c59,'request\x20sent',JSON[_0xa80f('0x10')](_0x41d8f7));if(_0x41d8f7[_0xa80f('0x11')]){if(_0x41d8f7[_0xa80f('0x11')][_0xa80f('0x12')]===0x1f4){logger[_0xa80f('0x11')](_0xa80f('0xd'),_0x7a5c59,_0x41d8f7[_0xa80f('0x11')][_0xa80f('0x13')]);return _0x5b20a7(_0x41d8f7[_0xa80f('0x11')]['message']);}logger[_0xa80f('0x11')](_0xa80f('0xd'),_0x7a5c59,_0x41d8f7[_0xa80f('0x11')][_0xa80f('0x13')]);return _0x10fc96(_0x41d8f7[_0xa80f('0x11')]['message']);}else{logger[_0xa80f('0xc')](_0xa80f('0xd'),_0x7a5c59,_0xa80f('0xe'));_0x10fc96(_0x41d8f7['result'][_0xa80f('0x13')]);}})[_0xa80f('0x14')](function(_0x130ab7){logger['error'](_0xa80f('0xd'),_0x7a5c59,_0x130ab7);_0x5b20a7(_0x130ab7);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index e3000e4..33d9cf3 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 _0xc125=['Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xc125,0xdf));var _0x5c12=function(_0x1593fa,_0x283485){_0x1593fa=_0x1593fa-0x0;var _0x4ac051=_0xc125[_0x1593fa];return _0x4ac051;};'use strict';var multer=require(_0x5c12('0x0'));var util=require(_0x5c12('0x1'));var path=require(_0x5c12('0x2'));var timeout=require(_0x5c12('0x3'));var express=require(_0x5c12('0x4'));var router=express[_0x5c12('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5c12('0x6'));var config=require(_0x5c12('0x7'));var controller=require(_0x5c12('0x8'));router[_0x5c12('0x9')]('/',auth[_0x5c12('0xa')](),controller[_0x5c12('0xb')]);router[_0x5c12('0x9')](_0x5c12('0xc'),auth[_0x5c12('0xa')](),controller[_0x5c12('0xd')]);router[_0x5c12('0xe')]('/',auth[_0x5c12('0xa')](),controller[_0x5c12('0xf')]);router[_0x5c12('0x10')](_0x5c12('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5c12('0xc'),auth[_0x5c12('0xa')](),controller[_0x5c12('0x11')]);module[_0x5c12('0x12')]=router; \ No newline at end of file +var _0x19de=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x39a26a,_0x5bf466){var _0x338c39=function(_0x4fcf66){while(--_0x4fcf66){_0x39a26a['push'](_0x39a26a['shift']());}};_0x338c39(++_0x5bf466);}(_0x19de,0x18f));var _0xe19d=function(_0x3c6723,_0x533039){_0x3c6723=_0x3c6723-0x0;var _0x4002fe=_0x19de[_0x3c6723];return _0x4002fe;};'use strict';var multer=require(_0xe19d('0x0'));var util=require(_0xe19d('0x1'));var path=require(_0xe19d('0x2'));var timeout=require('connect-timeout');var express=require(_0xe19d('0x3'));var router=express[_0xe19d('0x4')]();var auth=require(_0xe19d('0x5'));var interaction=require(_0xe19d('0x6'));var config=require(_0xe19d('0x7'));var controller=require('./cmContactHasPhone.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe19d('0x8')]);router[_0xe19d('0x9')](_0xe19d('0xa'),auth['isAuthenticated'](),controller[_0xe19d('0xb')]);router['post']('/',auth[_0xe19d('0xc')](),controller[_0xe19d('0xd')]);router[_0xe19d('0xe')]('/:id',auth[_0xe19d('0xc')](),controller[_0xe19d('0xf')]);router[_0xe19d('0x10')](_0xe19d('0xa'),auth[_0xe19d('0xc')](),controller[_0xe19d('0x11')]);module[_0xe19d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4874b57..0eae279 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 _0xb647=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xb647,0xdb));var _0x7b64=function(_0x491b1c,_0x23f04d){_0x491b1c=_0x491b1c-0x0;var _0x1a8c97=_0xb647[_0x491b1c];return _0x1a8c97;};'use strict';var Sequelize=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));module[_0x7b64('0x2')]={'name':{'type':Sequelize[_0x7b64('0x3')],'get':function(_0x38de52){return this[_0x7b64('0x4')](_0x7b64('0x5'));}},'alias':{'type':Sequelize[_0x7b64('0x6')],'allowNull':![],'set':function(_0x54eee8){this[_0x7b64('0x7')]('alias',_0x54eee8?_0x54eee8:this[_0x7b64('0x4')](_0x7b64('0x8')));}},'type':{'type':Sequelize[_0x7b64('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x7b64('0x9')](_0x7b64('0xa')),'get':function(){if(this[_0x7b64('0x4')](_0x7b64('0xb'))===_0x7b64('0xc')){return JSON[_0x7b64('0xd')](this['getDataValue'](_0x7b64('0xe')));}else{return this['getDataValue'](_0x7b64('0xe'));}},'set':function(_0x4c8014){if(Array['isArray'](_0x4c8014)){this[_0x7b64('0x7')](_0x7b64('0xe'),JSON['stringify'](_0x4c8014));}else{this[_0x7b64('0x7')](_0x7b64('0xe'),_0x4c8014);}}},'required':{'type':Sequelize[_0x7b64('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7b64('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7b64('0x10')](_0x7b64('0x11'))}}; \ No newline at end of file +var _0xd8b1=['type','select','values','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','long','getDataValue'];(function(_0x546039,_0xf8d1b6){var _0x3f82db=function(_0x137a68){while(--_0x137a68){_0x546039['push'](_0x546039['shift']());}};_0x3f82db(++_0xf8d1b6);}(_0xd8b1,0x105));var _0x1d8b=function(_0x5bca84,_0x109d41){_0x5bca84=_0x5bca84-0x0;var _0x45bc04=_0xd8b1[_0x5bca84];return _0x45bc04;};'use strict';var Sequelize=require(_0x1d8b('0x0'));var _=require(_0x1d8b('0x1'));module[_0x1d8b('0x2')]={'name':{'type':Sequelize[_0x1d8b('0x3')],'get':function(_0x20c6dd){return this['getDataValue'](_0x1d8b('0x4'));}},'alias':{'type':Sequelize[_0x1d8b('0x5')],'allowNull':![],'set':function(_0x531170){this[_0x1d8b('0x6')]('alias',_0x531170?_0x531170:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x1d8b('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x1d8b('0x7')),'get':function(){if(this[_0x1d8b('0x8')](_0x1d8b('0x9'))===_0x1d8b('0xa')){return JSON['parse'](this['getDataValue'](_0x1d8b('0xb')));}else{return this['getDataValue']('values');}},'set':function(_0x321de3){if(Array['isArray'](_0x321de3)){this[_0x1d8b('0x6')]('values',JSON[_0x1d8b('0xc')](_0x321de3));}else{this[_0x1d8b('0x6')](_0x1d8b('0xb'),_0x321de3);}}},'required':{'type':Sequelize[_0x1d8b('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1d8b('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1d8b('0xe')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6b5773f..21e7ab8 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 _0x2738=['model','differenceBy','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','body','find','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','CmCustomField','fieldName','key'];(function(_0xe950e6,_0x1a947d){var _0x31f86f=function(_0x3be80e){while(--_0x3be80e){_0xe950e6['push'](_0xe950e6['shift']());}};_0x31f86f(++_0x1a947d);}(_0x2738,0x1db));var _0x8273=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x2738[_0xda464c];return _0x19e222;};'use strict';var pdf=require(_0x8273('0x0'));var emlformat=require(_0x8273('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8273('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8273('0x3'));var moment=require(_0x8273('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8273('0x5'));var util=require(_0x8273('0x6'));var path=require(_0x8273('0x7'));var sox=require(_0x8273('0x8'));var csv=require(_0x8273('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8273('0xa'));var squel=require(_0x8273('0xb'));var crypto=require(_0x8273('0xc'));var jsforce=require(_0x8273('0xd'));var deskjs=require(_0x8273('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8273('0xf'));var Papa=require(_0x8273('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8273('0x11'));var as=require(_0x8273('0x12'));var hardwareService=require(_0x8273('0x13'));var logger=require(_0x8273('0x14'))(_0x8273('0x15'));var utils=require(_0x8273('0x16'));var config=require(_0x8273('0x17'));var licenseUtil=require(_0x8273('0x18'));var db=require(_0x8273('0x19'))['db'];function respondWithStatusCode(_0x4de700,_0x57dcf2){_0x57dcf2=_0x57dcf2||0xcc;return function(_0x5d7b71){if(_0x5d7b71){return _0x4de700['sendStatus'](_0x57dcf2);}return _0x4de700[_0x8273('0x1a')](_0x57dcf2)['end']();};}function respondWithResult(_0x56ddfa,_0xa3edfa){_0xa3edfa=_0xa3edfa||0xc8;return function(_0x1dd503){if(_0x1dd503){return _0x56ddfa[_0x8273('0x1a')](_0xa3edfa)[_0x8273('0x1b')](_0x1dd503);}};}function respondWithFilteredResult(_0x51d778,_0x2be9bd){return function(_0x69b147){if(_0x69b147){var _0x59a6a1=_0x69b147[_0x8273('0x1c')],_0x2a0ae4=_0x2be9bd[_0x8273('0x1d')],_0x34e858=_0x2be9bd['offset']+_0x2be9bd[_0x8273('0x1e')],_0x5e7b3e;if(_0x34e858>=_0x59a6a1){_0x34e858=_0x59a6a1;_0x5e7b3e=0xc8;}else{_0x5e7b3e=0xce;}_0x51d778[_0x8273('0x1a')](_0x5e7b3e);return _0x51d778['set'](_0x8273('0x1f'),_0x2a0ae4+'-'+_0x34e858+'/'+_0x59a6a1)[_0x8273('0x1b')](_0x69b147);}return null;};}function patchUpdates(_0x10ae39){return function(_0x536703){try{jsonpatch[_0x8273('0x20')](_0x536703,_0x10ae39,!![]);}catch(_0x5c58f5){return BPromise[_0x8273('0x21')](_0x5c58f5);}return _0x536703['save']();};}function saveUpdates(_0x506667,_0x3c3d9a){return function(_0x561626){if(_0x561626){return _0x561626[_0x8273('0x22')](_0x506667)[_0x8273('0x23')](function(_0x4b192d){return _0x4b192d;});}return null;};}function removeEntity(_0x435a6e,_0x1da05b){return function(_0x192214){if(_0x192214){return _0x192214[_0x8273('0x24')]()[_0x8273('0x23')](function(){_0x435a6e['status'](0xcc)[_0x8273('0x25')]();});}};}function handleEntityNotFound(_0x4a5cf7,_0x7825d5){return function(_0x1e3690){if(!_0x1e3690){_0x4a5cf7[_0x8273('0x26')](0x194);}return _0x1e3690;};}function handleError(_0x14a5e5,_0x2adcdc){_0x2adcdc=_0x2adcdc||0x1f4;return function(_0x231f33){logger[_0x8273('0x27')](_0x231f33['stack']);if(_0x231f33[_0x8273('0x28')]){delete _0x231f33[_0x8273('0x28')];}_0x14a5e5['status'](_0x2adcdc)[_0x8273('0x29')](_0x231f33);};}exports[_0x8273('0x2a')]=function(_0x550129,_0x15e0aa){var _0x5927f0={},_0x57174f={},_0x4f6d8e={'count':0x0,'rows':[]};var _0x160a7d=_[_0x8273('0x2b')](db[_0x8273('0x2c')]['rawAttributes'],function(_0x51031f){return{'name':_0x51031f[_0x8273('0x2d')],'type':_0x51031f['type'][_0x8273('0x2e')]};});_0x57174f[_0x8273('0x2f')]=_[_0x8273('0x30')](_[_0x8273('0x2b')](_0x160a7d,_0x8273('0x28')),[_0x8273('0x28')]);_0x57174f[_0x8273('0x31')]=_[_0x8273('0x32')](_0x550129[_0x8273('0x31')]);_0x57174f[_0x8273('0x33')]=_[_0x8273('0x34')](_0x57174f[_0x8273('0x2f')],_0x57174f[_0x8273('0x31')]);_0x5927f0['attributes']=_[_0x8273('0x34')](_0x57174f[_0x8273('0x2f')],qs[_0x8273('0x35')](_0x550129[_0x8273('0x31')]['fields']));_0x5927f0[_0x8273('0x36')]=_0x5927f0[_0x8273('0x36')][_0x8273('0x37')]?_0x5927f0[_0x8273('0x36')]:_0x57174f['model'];if(!_0x550129[_0x8273('0x31')]['hasOwnProperty'](_0x8273('0x38'))){_0x5927f0[_0x8273('0x1e')]=qs[_0x8273('0x1e')](_0x550129[_0x8273('0x31')][_0x8273('0x1e')]);_0x5927f0[_0x8273('0x1d')]=qs[_0x8273('0x1d')](_0x550129['query']['offset']);}_0x5927f0['order']=qs[_0x8273('0x39')](_0x550129[_0x8273('0x31')][_0x8273('0x39')]);_0x5927f0[_0x8273('0x3a')]=qs[_0x8273('0x33')](_['pick'](_0x550129['query'],_0x57174f['filters']),_0x160a7d);if(_0x550129[_0x8273('0x31')][_0x8273('0x3b')]){_0x5927f0[_0x8273('0x3a')]=_[_0x8273('0x3c')](_0x5927f0['where'],{'$or':_[_0x8273('0x2b')](_0x160a7d,function(_0x4225cf){if(_0x4225cf[_0x8273('0x3d')]!==_0x8273('0x3e')){var _0x2b9922={};_0x2b9922[_0x4225cf['name']]={'$like':'%'+_0x550129[_0x8273('0x31')][_0x8273('0x3b')]+'%'};return _0x2b9922;}})});}_0x5927f0=_[_0x8273('0x3c')]({},_0x5927f0,_0x550129['options']);var _0x102ac3={'where':_0x5927f0[_0x8273('0x3a')]};return db[_0x8273('0x2c')][_0x8273('0x1c')](_0x102ac3)[_0x8273('0x23')](function(_0x15783d){_0x4f6d8e[_0x8273('0x1c')]=_0x15783d;if(_0x550129[_0x8273('0x31')][_0x8273('0x3f')]){_0x5927f0[_0x8273('0x40')]=[{'all':!![]}];}return db[_0x8273('0x2c')][_0x8273('0x41')](_0x5927f0);})[_0x8273('0x23')](function(_0x3ef8a5){_0x4f6d8e['rows']=_0x3ef8a5;return _0x4f6d8e;})[_0x8273('0x23')](respondWithFilteredResult(_0x15e0aa,_0x5927f0))[_0x8273('0x42')](handleError(_0x15e0aa,null));};exports[_0x8273('0x43')]=function(_0x1dca6a,_0x2f2cc4){var _0x34bce={'raw':!![],'where':{'id':_0x1dca6a[_0x8273('0x44')]['id']}},_0xea918b={};_0xea918b[_0x8273('0x2f')]=_[_0x8273('0x32')](db[_0x8273('0x2c')][_0x8273('0x45')]);_0xea918b[_0x8273('0x31')]=_[_0x8273('0x32')](_0x1dca6a[_0x8273('0x31')]);_0xea918b[_0x8273('0x33')]=_[_0x8273('0x34')](_0xea918b[_0x8273('0x2f')],_0xea918b[_0x8273('0x31')]);_0x34bce[_0x8273('0x36')]=_[_0x8273('0x34')](_0xea918b[_0x8273('0x2f')],qs[_0x8273('0x35')](_0x1dca6a['query'][_0x8273('0x35')]));_0x34bce[_0x8273('0x36')]=_0x34bce['attributes'][_0x8273('0x37')]?_0x34bce['attributes']:_0xea918b[_0x8273('0x2f')];if(_0x1dca6a[_0x8273('0x31')]['includeAll']){_0x34bce[_0x8273('0x40')]=[{'all':!![]}];}_0x34bce=_['merge']({},_0x34bce,_0x1dca6a[_0x8273('0x46')]);return db[_0x8273('0x2c')]['find'](_0x34bce)[_0x8273('0x23')](handleEntityNotFound(_0x2f2cc4,null))[_0x8273('0x23')](respondWithResult(_0x2f2cc4,null))['catch'](handleError(_0x2f2cc4,null));};exports[_0x8273('0x22')]=function(_0x44e0db,_0x22cc28){if(_0x44e0db[_0x8273('0x47')]['id']){delete _0x44e0db[_0x8273('0x47')]['id'];}return db[_0x8273('0x2c')][_0x8273('0x48')]({'where':{'id':_0x44e0db['params']['id']}})['then'](handleEntityNotFound(_0x22cc28,null))[_0x8273('0x23')](saveUpdates(_0x44e0db[_0x8273('0x47')],null))[_0x8273('0x23')](respondWithResult(_0x22cc28,null))['catch'](handleError(_0x22cc28,null));};exports['destroy']=function(_0x21ee13,_0x163e9d){return db[_0x8273('0x2c')][_0x8273('0x48')]({'where':{'id':_0x21ee13[_0x8273('0x44')]['id']}})['then'](handleEntityNotFound(_0x163e9d,null))[_0x8273('0x23')](removeEntity(_0x163e9d,null))['catch'](handleError(_0x163e9d,null));};exports[_0x8273('0x49')]=function(_0x505dd5,_0x24f397){var _0x22d0f6;return db[_0x8273('0x4a')][_0x8273('0x4b')](function(_0x3157da){return db[_0x8273('0x2c')][_0x8273('0x49')](_0x505dd5[_0x8273('0x47')],{'transaction':_0x3157da})[_0x8273('0x23')](function(_0x16161d){_0x22d0f6=_0x16161d;var _0x1b1dce={'type':db[_0x8273('0x4c')]['TEXT'],'transaction':_0x3157da};switch(_0x505dd5['body'][_0x8273('0x3d')]){case _0x8273('0x4d'):_0x1b1dce['type']=db['Sequelize'][_0x8273('0x4e')];break;case _0x8273('0x4f'):_0x1b1dce[_0x8273('0x3d')]=db[_0x8273('0x4c')][_0x8273('0x50')];break;case _0x8273('0x51'):_0x1b1dce[_0x8273('0x3d')]=db[_0x8273('0x4c')][_0x8273('0x52')];_0x1b1dce['defaultValue']=![];break;default:}return db[_0x8273('0x4a')][_0x8273('0x53')][_0x8273('0x54')]('cm_contacts',util[_0x8273('0x55')](_0x8273('0x56'),_0x22d0f6['id']),_0x1b1dce);})[_0x8273('0x23')](function(){return _0x22d0f6;});})['then'](respondWithResult(_0x24f397,0xc9))[_0x8273('0x42')](handleError(_0x24f397,null));}; \ No newline at end of file +var _0x8f2d=['rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x19ba07,_0x4610e5){_0x19ba07=_0x19ba07-0x0;var _0x20504e=_0x8f2d[_0x19ba07];return _0x20504e;};'use strict';var pdf=require(_0xd8f2('0x0'));var emlformat=require(_0xd8f2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8f2('0x2'));var jsonpatch=require(_0xd8f2('0x3'));var rp=require(_0xd8f2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8f2('0x5'));var util=require(_0xd8f2('0x6'));var path=require(_0xd8f2('0x7'));var sox=require(_0xd8f2('0x8'));var csv=require(_0xd8f2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd8f2('0xa'));var squel=require(_0xd8f2('0xb'));var crypto=require(_0xd8f2('0xc'));var jsforce=require(_0xd8f2('0xd'));var deskjs=require(_0xd8f2('0xe'));var toCsv=require(_0xd8f2('0x9'));var querystring=require('querystring');var Papa=require(_0xd8f2('0xf'));var Redis=require(_0xd8f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd8f2('0x11'));var as=require(_0xd8f2('0x12'));var hardwareService=require(_0xd8f2('0x13'));var logger=require(_0xd8f2('0x14'))(_0xd8f2('0x15'));var utils=require(_0xd8f2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd8f2('0x17'));var db=require(_0xd8f2('0x18'))['db'];function respondWithStatusCode(_0x4092b7,_0xf6fa79){_0xf6fa79=_0xf6fa79||0xcc;return function(_0x44a4b2){if(_0x44a4b2){return _0x4092b7[_0xd8f2('0x19')](_0xf6fa79);}return _0x4092b7['status'](_0xf6fa79)[_0xd8f2('0x1a')]();};}function respondWithResult(_0x30d8fd,_0x161e5f){_0x161e5f=_0x161e5f||0xc8;return function(_0x19257f){if(_0x19257f){return _0x30d8fd[_0xd8f2('0x1b')](_0x161e5f)['json'](_0x19257f);}};}function respondWithFilteredResult(_0x15525d,_0x37e347){return function(_0x495feb){if(_0x495feb){var _0x18847c=_0x495feb[_0xd8f2('0x1c')],_0x44f566=_0x37e347[_0xd8f2('0x1d')],_0x1dd9a0=_0x37e347[_0xd8f2('0x1d')]+_0x37e347['limit'],_0x25b4e2;if(_0x1dd9a0>=_0x18847c){_0x1dd9a0=_0x18847c;_0x25b4e2=0xc8;}else{_0x25b4e2=0xce;}_0x15525d[_0xd8f2('0x1b')](_0x25b4e2);return _0x15525d[_0xd8f2('0x1e')](_0xd8f2('0x1f'),_0x44f566+'-'+_0x1dd9a0+'/'+_0x18847c)[_0xd8f2('0x20')](_0x495feb);}return null;};}function patchUpdates(_0x105cc9){return function(_0x5686b0){try{jsonpatch['apply'](_0x5686b0,_0x105cc9,!![]);}catch(_0x4c28ae){return BPromise[_0xd8f2('0x21')](_0x4c28ae);}return _0x5686b0[_0xd8f2('0x22')]();};}function saveUpdates(_0x584852,_0x49ba82){return function(_0x36ce0a){if(_0x36ce0a){return _0x36ce0a[_0xd8f2('0x23')](_0x584852)[_0xd8f2('0x24')](function(_0x556890){return _0x556890;});}return null;};}function removeEntity(_0x56bef4,_0x366a9c){return function(_0xc8dc4f){if(_0xc8dc4f){return _0xc8dc4f[_0xd8f2('0x25')]()[_0xd8f2('0x24')](function(){_0x56bef4['status'](0xcc)[_0xd8f2('0x1a')]();});}};}function handleEntityNotFound(_0x5f5211,_0x3eeb92){return function(_0x1728d9){if(!_0x1728d9){_0x5f5211['sendStatus'](0x194);}return _0x1728d9;};}function handleError(_0x4104cd,_0xb76272){_0xb76272=_0xb76272||0x1f4;return function(_0x216cf2){logger[_0xd8f2('0x26')](_0x216cf2[_0xd8f2('0x27')]);if(_0x216cf2[_0xd8f2('0x28')]){delete _0x216cf2[_0xd8f2('0x28')];}_0x4104cd[_0xd8f2('0x1b')](_0xb76272)[_0xd8f2('0x29')](_0x216cf2);};}exports[_0xd8f2('0x2a')]=function(_0x517f7d,_0xbb33c6){var _0x346acc={},_0x1fb618={},_0x42eeac={'count':0x0,'rows':[]};var _0x3410ae=_[_0xd8f2('0x2b')](db[_0xd8f2('0x2c')][_0xd8f2('0x2d')],function(_0xf5ac2b){return{'name':_0xf5ac2b['fieldName'],'type':_0xf5ac2b[_0xd8f2('0x2e')][_0xd8f2('0x2f')]};});_0x1fb618['model']=_['differenceBy'](_[_0xd8f2('0x2b')](_0x3410ae,_0xd8f2('0x28')),[_0xd8f2('0x28')]);_0x1fb618[_0xd8f2('0x30')]=_[_0xd8f2('0x31')](_0x517f7d['query']);_0x1fb618[_0xd8f2('0x32')]=_[_0xd8f2('0x33')](_0x1fb618[_0xd8f2('0x34')],_0x1fb618[_0xd8f2('0x30')]);_0x346acc[_0xd8f2('0x35')]=_[_0xd8f2('0x33')](_0x1fb618[_0xd8f2('0x34')],qs[_0xd8f2('0x36')](_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x36')]));_0x346acc['attributes']=_0x346acc[_0xd8f2('0x35')][_0xd8f2('0x37')]?_0x346acc['attributes']:_0x1fb618[_0xd8f2('0x34')];if(!_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x38')](_0xd8f2('0x39'))){_0x346acc['limit']=qs['limit'](_0x517f7d[_0xd8f2('0x30')]['limit']);_0x346acc['offset']=qs[_0xd8f2('0x1d')](_0x517f7d['query'][_0xd8f2('0x1d')]);}_0x346acc['order']=qs[_0xd8f2('0x3a')](_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x3a')]);_0x346acc[_0xd8f2('0x3b')]=qs[_0xd8f2('0x32')](_[_0xd8f2('0x3c')](_0x517f7d['query'],_0x1fb618[_0xd8f2('0x32')]),_0x3410ae);if(_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x3d')]){_0x346acc[_0xd8f2('0x3b')]=_[_0xd8f2('0x3e')](_0x346acc[_0xd8f2('0x3b')],{'$or':_[_0xd8f2('0x2b')](_0x3410ae,function(_0x343637){if(_0x343637['type']!==_0xd8f2('0x3f')){var _0x57d462={};_0x57d462[_0x343637['name']]={'$like':'%'+_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x3d')]+'%'};return _0x57d462;}})});}_0x346acc=_[_0xd8f2('0x3e')]({},_0x346acc,_0x517f7d[_0xd8f2('0x40')]);var _0x2ec57c={'where':_0x346acc[_0xd8f2('0x3b')]};return db[_0xd8f2('0x2c')][_0xd8f2('0x1c')](_0x2ec57c)[_0xd8f2('0x24')](function(_0x2fd147){_0x42eeac[_0xd8f2('0x1c')]=_0x2fd147;if(_0x517f7d[_0xd8f2('0x30')][_0xd8f2('0x41')]){_0x346acc[_0xd8f2('0x42')]=[{'all':!![]}];}return db[_0xd8f2('0x2c')]['findAll'](_0x346acc);})[_0xd8f2('0x24')](function(_0x6482bf){_0x42eeac[_0xd8f2('0x43')]=_0x6482bf;return _0x42eeac;})[_0xd8f2('0x24')](respondWithFilteredResult(_0xbb33c6,_0x346acc))[_0xd8f2('0x44')](handleError(_0xbb33c6,null));};exports[_0xd8f2('0x45')]=function(_0x395cd7,_0x229517){var _0xeab58={'raw':!![],'where':{'id':_0x395cd7[_0xd8f2('0x46')]['id']}},_0x39a48c={};_0x39a48c[_0xd8f2('0x34')]=_['keys'](db[_0xd8f2('0x2c')][_0xd8f2('0x2d')]);_0x39a48c[_0xd8f2('0x30')]=_['keys'](_0x395cd7[_0xd8f2('0x30')]);_0x39a48c['filters']=_[_0xd8f2('0x33')](_0x39a48c[_0xd8f2('0x34')],_0x39a48c[_0xd8f2('0x30')]);_0xeab58[_0xd8f2('0x35')]=_[_0xd8f2('0x33')](_0x39a48c[_0xd8f2('0x34')],qs[_0xd8f2('0x36')](_0x395cd7['query'][_0xd8f2('0x36')]));_0xeab58['attributes']=_0xeab58[_0xd8f2('0x35')][_0xd8f2('0x37')]?_0xeab58[_0xd8f2('0x35')]:_0x39a48c[_0xd8f2('0x34')];if(_0x395cd7[_0xd8f2('0x30')][_0xd8f2('0x41')]){_0xeab58[_0xd8f2('0x42')]=[{'all':!![]}];}_0xeab58=_[_0xd8f2('0x3e')]({},_0xeab58,_0x395cd7['options']);return db[_0xd8f2('0x2c')][_0xd8f2('0x47')](_0xeab58)[_0xd8f2('0x24')](handleEntityNotFound(_0x229517,null))[_0xd8f2('0x24')](respondWithResult(_0x229517,null))[_0xd8f2('0x44')](handleError(_0x229517,null));};exports[_0xd8f2('0x23')]=function(_0x402070,_0x37f470){if(_0x402070[_0xd8f2('0x48')]['id']){delete _0x402070[_0xd8f2('0x48')]['id'];}return db['CmCustomField'][_0xd8f2('0x47')]({'where':{'id':_0x402070[_0xd8f2('0x46')]['id']}})[_0xd8f2('0x24')](handleEntityNotFound(_0x37f470,null))[_0xd8f2('0x24')](saveUpdates(_0x402070[_0xd8f2('0x48')],null))['then'](respondWithResult(_0x37f470,null))[_0xd8f2('0x44')](handleError(_0x37f470,null));};exports[_0xd8f2('0x25')]=function(_0x146111,_0x28bc2c){return db[_0xd8f2('0x2c')]['find']({'where':{'id':_0x146111[_0xd8f2('0x46')]['id']}})[_0xd8f2('0x24')](handleEntityNotFound(_0x28bc2c,null))[_0xd8f2('0x24')](removeEntity(_0x28bc2c,null))[_0xd8f2('0x44')](handleError(_0x28bc2c,null));};exports[_0xd8f2('0x49')]=function(_0xae3b0b,_0x1ef256){var _0x264cf7;return db[_0xd8f2('0x4a')][_0xd8f2('0x4b')](function(_0x4d7a77){return db[_0xd8f2('0x2c')]['create'](_0xae3b0b['body'],{'transaction':_0x4d7a77})['then'](function(_0xa44c09){_0x264cf7=_0xa44c09;var _0x10ec76={'type':db[_0xd8f2('0x4c')][_0xd8f2('0x4d')],'transaction':_0x4d7a77};switch(_0xae3b0b[_0xd8f2('0x48')][_0xd8f2('0x2e')]){case _0xd8f2('0x4e'):_0x10ec76[_0xd8f2('0x2e')]=db[_0xd8f2('0x4c')][_0xd8f2('0x4d')];break;case _0xd8f2('0x4f'):_0x10ec76[_0xd8f2('0x2e')]=db['Sequelize'][_0xd8f2('0x50')];break;case _0xd8f2('0x51'):_0x10ec76[_0xd8f2('0x2e')]=db[_0xd8f2('0x4c')]['BOOLEAN'];_0x10ec76[_0xd8f2('0x52')]=![];break;default:}return db['sequelize'][_0xd8f2('0x53')]['addColumn'](_0xd8f2('0x54'),util[_0xd8f2('0x55')]('cf_%d',_0x264cf7['id']),_0x10ec76);})[_0xd8f2('0x24')](function(){return _0x264cf7;});})[_0xd8f2('0x24')](respondWithResult(_0x1ef256,0xc9))['catch'](handleError(_0x1ef256,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index efa98b3..79c2e8b 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 _0x6b16=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','../../config/logger','moment','bluebird','request-promise'];(function(_0x4ffafb,_0x20171a){var _0x4ab472=function(_0x1afc75){while(--_0x1afc75){_0x4ffafb['push'](_0x4ffafb['shift']());}};_0x4ab472(++_0x20171a);}(_0x6b16,0x188));var _0x66b1=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0x6b16[_0x4b9978];return _0x42f0e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66b1('0x0'))('api');var moment=require(_0x66b1('0x1'));var BPromise=require(_0x66b1('0x2'));var rp=require(_0x66b1('0x3'));var fs=require('fs');var path=require(_0x66b1('0x4'));var rimraf=require(_0x66b1('0x5'));var config=require(_0x66b1('0x6'));var attributes=require(_0x66b1('0x7'));module[_0x66b1('0x8')]=function(_0x3181c8,_0x1c8dfc){return _0x3181c8[_0x66b1('0x9')](_0x66b1('0xa'),attributes,{'tableName':_0x66b1('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0b0=['lodash','util','api','moment','bluebird','path','rimraf','exports','define','CmCustomField','cm_custom_fields'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0xf0b0,0xd1));var _0x0f0b=function(_0x564e08,_0x401fb5){_0x564e08=_0x564e08-0x0;var _0x38ffcc=_0xf0b0[_0x564e08];return _0x38ffcc;};'use strict';var _=require(_0x0f0b('0x0'));var util=require(_0x0f0b('0x1'));var logger=require('../../config/logger')(_0x0f0b('0x2'));var moment=require(_0x0f0b('0x3'));var BPromise=require(_0x0f0b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f0b('0x5'));var rimraf=require(_0x0f0b('0x6'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x0f0b('0x7')]=function(_0x20b774,_0x4f2a16){return _0x20b774[_0x0f0b('0x8')](_0x0f0b('0x9'),attributes,{'tableName':_0x0f0b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index c3628d7..d7dabe9 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','util'];(function(_0x4e6e09,_0x1b3e98){var _0x5846e9=function(_0xdc30df){while(--_0xdc30df){_0x4e6e09['push'](_0x4e6e09['shift']());}};_0x5846e9(++_0x1b3e98);}(_0xedd9,0xfc));var _0x9edd=function(_0x54a3cc,_0x480b4b){_0x54a3cc=_0x54a3cc-0x0;var _0x18d0aa=_0xedd9[_0x54a3cc];return _0x18d0aa;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('CmCustomField,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x44b5d9,_0xe28bb1){var _0x25d599=function(_0x33d5ed){while(--_0x33d5ed){_0x44b5d9['push'](_0x44b5d9['shift']());}};_0x25d599(++_0xe28bb1);}(_0x99e9,0xb4));var _0x999e=function(_0x19a9a5,_0x2bf8b2){_0x19a9a5=_0x19a9a5-0x0;var _0x5306fe=_0x99e9[_0x19a9a5];return _0x5306fe;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('CmCustomField,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 879d45b..9c051ee 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 _0xec0e=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xec0e,0xcc));var _0xeec0=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0xec0e[_0x5fe7ce];return _0x3b5793;};'use strict';var multer=require('multer');var util=require(_0xeec0('0x0'));var path=require('path');var timeout=require(_0xeec0('0x1'));var express=require(_0xeec0('0x2'));var router=express['Router']();var auth=require(_0xeec0('0x3'));var interaction=require(_0xeec0('0x4'));var config=require('../../config/environment');var controller=require(_0xeec0('0x5'));router[_0xeec0('0x6')]('/',auth[_0xeec0('0x7')](),controller[_0xeec0('0x8')]);router[_0xeec0('0x6')](_0xeec0('0x9'),auth['isAuthenticated'](),controller[_0xeec0('0xa')]);router[_0xeec0('0xb')]('/',auth[_0xeec0('0x7')](),controller[_0xeec0('0xc')]);router[_0xeec0('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xeec0('0xe')]('/:id',auth[_0xeec0('0x7')](),controller[_0xeec0('0xf')]);module[_0xeec0('0x10')]=router; \ No newline at end of file +var _0x02c4=['path','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports'];(function(_0x156627,_0x23eae2){var _0x54ef92=function(_0x5a580e){while(--_0x5a580e){_0x156627['push'](_0x156627['shift']());}};_0x54ef92(++_0x23eae2);}(_0x02c4,0xb4));var _0x402c=function(_0x281061,_0x207316){_0x281061=_0x281061-0x0;var _0x3cc8a6=_0x02c4[_0x281061];return _0x3cc8a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x402c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x402c('0x1')]();var auth=require(_0x402c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x402c('0x3'));var controller=require(_0x402c('0x4'));router[_0x402c('0x5')]('/',auth[_0x402c('0x6')](),controller[_0x402c('0x7')]);router[_0x402c('0x5')](_0x402c('0x8'),auth['isAuthenticated'](),controller[_0x402c('0x9')]);router[_0x402c('0xa')]('/',auth[_0x402c('0x6')](),controller['create']);router[_0x402c('0xb')](_0x402c('0x8'),auth[_0x402c('0x6')](),controller[_0x402c('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x402c('0xd')]);module[_0x402c('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 35785a0..4d1764e 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 _0x7217=['moment','exports','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue'];(function(_0x45a5e6,_0x22a92c){var _0x2d2ed2=function(_0x4b89b4){while(--_0x4b89b4){_0x45a5e6['push'](_0x45a5e6['shift']());}};_0x2d2ed2(++_0x22a92c);}(_0x7217,0x19e));var _0x7721=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7217[_0x4b7b62];return _0x2280df;};'use strict';var moment=require(_0x7721('0x0'));var Sequelize=require('sequelize');module[_0x7721('0x1')]={'phone':{'type':Sequelize[_0x7721('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7721('0x4')],'defaultValue':moment()[_0x7721('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7721('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7721('0x4')]},'priority':{'type':Sequelize[_0x7721('0x6')](0x2)[_0x7721('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7721('0x6')],'unique':_0x7721('0x8')},'ListId':{'type':Sequelize[_0x7721('0x6')],'unique':_0x7721('0x8')},'UserId':{'type':Sequelize[_0x7721('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x7721('0x6')],'unique':_0x7721('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x55ca=['DATE','format','INTEGER','BOOLEAN','STRING','contactListQueue','moment','sequelize'];(function(_0x33bf49,_0x1c0415){var _0x858820=function(_0x1fcbee){while(--_0x1fcbee){_0x33bf49['push'](_0x33bf49['shift']());}};_0x858820(++_0x1c0415);}(_0x55ca,0x126));var _0xa55c=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x55ca[_0x234ce7];return _0x57c561;};'use strict';var moment=require(_0xa55c('0x0'));var Sequelize=require(_0xa55c('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa55c('0x2')],'defaultValue':moment()[_0xa55c('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa55c('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa55c('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa55c('0x4')],'unique':_0xa55c('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa55c('0x7')},'CampaignId':{'type':Sequelize[_0xa55c('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa55c('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 8912202..eea2e5e 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 _0x4fad=['params','rawAttributes','includeAll','create','body','find','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','describe','getVoiceQueues','outbound','preview','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','dialOrderByScheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Company','CmList','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','map','CmHopper','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$in','$notIn','$like','$overlap','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','offset','order','where','filter','type','merge','options','include','findAll','rows','catch','show'];(function(_0x10037f,_0x14c8ad){var _0x1efeb0=function(_0x3f1b1f){while(--_0x3f1b1f){_0x10037f['push'](_0x10037f['shift']());}};_0x1efeb0(++_0x14c8ad);}(_0x4fad,0xcb));var _0xd4fa=function(_0x4a5aed,_0x5dc60d){_0x4a5aed=_0x4a5aed-0x0;var _0x555005=_0x4fad[_0x4a5aed];return _0x555005;};'use strict';var pdf=require(_0xd4fa('0x0'));var emlformat=require(_0xd4fa('0x1'));var rimraf=require(_0xd4fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4fa('0x3'));var rp=require(_0xd4fa('0x4'));var moment=require(_0xd4fa('0x5'));var BPromise=require(_0xd4fa('0x6'));var Mustache=require(_0xd4fa('0x7'));var util=require(_0xd4fa('0x8'));var path=require(_0xd4fa('0x9'));var sox=require(_0xd4fa('0xa'));var csv=require('to-csv');var ejs=require(_0xd4fa('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd4fa('0xc'));var crypto=require(_0xd4fa('0xd'));var jsforce=require(_0xd4fa('0xe'));var deskjs=require(_0xd4fa('0xf'));var toCsv=require(_0xd4fa('0x10'));var querystring=require('querystring');var Papa=require(_0xd4fa('0x11'));var Redis=require(_0xd4fa('0x12'));var authService=require(_0xd4fa('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4fa('0x14'));var hardwareService=require(_0xd4fa('0x15'));var logger=require(_0xd4fa('0x16'))(_0xd4fa('0x17'));var utils=require('../../config/utils');var config=require(_0xd4fa('0x18'));var licenseUtil=require(_0xd4fa('0x19'));var db=require(_0xd4fa('0x1a'))['db'];function respondWithStatusCode(_0x50f53d,_0x2b04b3){_0x2b04b3=_0x2b04b3||0xcc;return function(_0x2fe7b7){if(_0x2fe7b7){return _0x50f53d[_0xd4fa('0x1b')](_0x2b04b3);}return _0x50f53d[_0xd4fa('0x1c')](_0x2b04b3)[_0xd4fa('0x1d')]();};}function respondWithResult(_0x3b2e05,_0x4801a2){_0x4801a2=_0x4801a2||0xc8;return function(_0x29e101){if(_0x29e101){return _0x3b2e05[_0xd4fa('0x1c')](_0x4801a2)[_0xd4fa('0x1e')](_0x29e101);}};}function respondWithFilteredResult(_0x2e267a,_0x42af5a){return function(_0x28c589){if(_0x28c589){var _0xa8bb45=_0x28c589[_0xd4fa('0x1f')],_0x49c0c6=_0x42af5a['offset'],_0x37bc80=_0x42af5a['offset']+_0x42af5a[_0xd4fa('0x20')],_0x3a3b8c;if(_0x37bc80>=_0xa8bb45){_0x37bc80=_0xa8bb45;_0x3a3b8c=0xc8;}else{_0x3a3b8c=0xce;}_0x2e267a['status'](_0x3a3b8c);return _0x2e267a['set'](_0xd4fa('0x21'),_0x49c0c6+'-'+_0x37bc80+'/'+_0xa8bb45)[_0xd4fa('0x1e')](_0x28c589);}return null;};}function patchUpdates(_0x29789b){return function(_0x9a213e){try{jsonpatch['apply'](_0x9a213e,_0x29789b,!![]);}catch(_0x3ea869){return BPromise[_0xd4fa('0x22')](_0x3ea869);}return _0x9a213e['save']();};}function saveUpdates(_0xbf7dcf,_0x580f05){return function(_0x485db5){if(_0x485db5){return _0x485db5[_0xd4fa('0x23')](_0xbf7dcf)[_0xd4fa('0x24')](function(_0x31a90c){return _0x31a90c;});}return null;};}function removeEntity(_0x396ac7,_0x586af0){return function(_0x13d59a){if(_0x13d59a){return _0x13d59a[_0xd4fa('0x25')]()[_0xd4fa('0x24')](function(){_0x396ac7[_0xd4fa('0x1c')](0xcc)[_0xd4fa('0x1d')]();});}};}function handleEntityNotFound(_0x4b24cb,_0x2a9d07){return function(_0x14ea6e){if(!_0x14ea6e){_0x4b24cb['sendStatus'](0x194);}return _0x14ea6e;};}function handleError(_0x162459,_0x41d948){_0x41d948=_0x41d948||0x1f4;return function(_0x1de4c7){logger[_0xd4fa('0x26')](_0x1de4c7[_0xd4fa('0x27')]);if(_0x1de4c7[_0xd4fa('0x28')]){delete _0x1de4c7[_0xd4fa('0x28')];}_0x162459[_0xd4fa('0x1c')](_0x41d948)[_0xd4fa('0x29')](_0x1de4c7);};}exports['index']=function(_0x17bdbf,_0x499eda){var _0x21f817={},_0x136d2c={},_0x59446d={'count':0x0,'rows':[]};var _0x35c4bd=_[_0xd4fa('0x2a')](db[_0xd4fa('0x2b')]['rawAttributes'],function(_0x18d550){return{'name':_0x18d550[_0xd4fa('0x2c')],'type':_0x18d550['type'][_0xd4fa('0x2d')]};});_0x136d2c[_0xd4fa('0x2e')]=_['map'](_0x35c4bd,_0xd4fa('0x28'));_0x136d2c[_0xd4fa('0x2f')]=_[_0xd4fa('0x30')](_0x17bdbf[_0xd4fa('0x2f')]);_0x136d2c[_0xd4fa('0x31')]=_[_0xd4fa('0x32')](_0x136d2c[_0xd4fa('0x2e')],_0x136d2c[_0xd4fa('0x2f')]);_0x136d2c['filters']=_[_0xd4fa('0x33')](_0x136d2c[_0xd4fa('0x31')],[_0xd4fa('0x34'),_0xd4fa('0x35'),'$gt',_0xd4fa('0x36'),_0xd4fa('0x37'),_0xd4fa('0x38'),_0xd4fa('0x39'),'$eq','$not','$between','$notBetween',_0xd4fa('0x3a'),_0xd4fa('0x3b'),'$like','$notLike','$iLike','$notILike',_0xd4fa('0x3c'),_0xd4fa('0x3d'),'$contains',_0xd4fa('0x3e'),_0xd4fa('0x3f')]);_0x21f817['attributes']=_[_0xd4fa('0x32')](_0x136d2c['model'],qs[_0xd4fa('0x40')](_0x17bdbf['query'][_0xd4fa('0x40')]));_0x21f817[_0xd4fa('0x41')]=_0x21f817[_0xd4fa('0x41')][_0xd4fa('0x42')]?_0x21f817[_0xd4fa('0x41')]:_0x136d2c['model'];if(!_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x43')](_0xd4fa('0x44'))){_0x21f817[_0xd4fa('0x20')]=qs[_0xd4fa('0x20')](_0x17bdbf[_0xd4fa('0x2f')]['limit']);_0x21f817[_0xd4fa('0x45')]=qs[_0xd4fa('0x45')](_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x45')]);}_0x21f817[_0xd4fa('0x46')]=qs['sort'](_0x17bdbf[_0xd4fa('0x2f')]['sort']);_0x21f817[_0xd4fa('0x47')]=qs[_0xd4fa('0x31')](_['pick'](_0x17bdbf['query'],_0x136d2c['filters']),_0x35c4bd);if(_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x48')]){_0x21f817[_0xd4fa('0x47')]=_['merge'](_0x21f817[_0xd4fa('0x47')],{'$or':_[_0xd4fa('0x2a')](_0x35c4bd,function(_0x3551f2){if(_0x3551f2[_0xd4fa('0x49')]!=='VIRTUAL'){var _0x4c02d7={};_0x4c02d7[_0x3551f2[_0xd4fa('0x28')]]={'$like':'%'+_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x48')]+'%'};return _0x4c02d7;}})});}_0x21f817=_[_0xd4fa('0x4a')]({},_0x21f817,_0x17bdbf[_0xd4fa('0x4b')]);var _0x5abe55={'where':_0x21f817[_0xd4fa('0x47')]};return db[_0xd4fa('0x2b')][_0xd4fa('0x1f')](_0x5abe55)[_0xd4fa('0x24')](function(_0xd59d99){_0x59446d[_0xd4fa('0x1f')]=_0xd59d99;if(_0x17bdbf[_0xd4fa('0x2f')]['includeAll']){_0x21f817[_0xd4fa('0x4c')]=[{'all':!![]}];}return db[_0xd4fa('0x2b')][_0xd4fa('0x4d')](_0x21f817);})[_0xd4fa('0x24')](function(_0x544721){_0x59446d[_0xd4fa('0x4e')]=_0x544721;return _0x59446d;})[_0xd4fa('0x24')](respondWithFilteredResult(_0x499eda,_0x21f817))[_0xd4fa('0x4f')](handleError(_0x499eda,null));};exports[_0xd4fa('0x50')]=function(_0x38bf31,_0x26fff2){var _0x1f6438={'raw':!![],'where':{'id':_0x38bf31[_0xd4fa('0x51')]['id']}},_0x2f6a19={};_0x2f6a19[_0xd4fa('0x2e')]=_[_0xd4fa('0x30')](db[_0xd4fa('0x2b')][_0xd4fa('0x52')]);_0x2f6a19[_0xd4fa('0x2f')]=_[_0xd4fa('0x30')](_0x38bf31['query']);_0x2f6a19[_0xd4fa('0x31')]=_[_0xd4fa('0x32')](_0x2f6a19[_0xd4fa('0x2e')],_0x2f6a19['query']);_0x1f6438[_0xd4fa('0x41')]=_[_0xd4fa('0x32')](_0x2f6a19[_0xd4fa('0x2e')],qs['fields'](_0x38bf31['query'][_0xd4fa('0x40')]));_0x1f6438['attributes']=_0x1f6438[_0xd4fa('0x41')]['length']?_0x1f6438[_0xd4fa('0x41')]:_0x2f6a19['model'];if(_0x38bf31[_0xd4fa('0x2f')][_0xd4fa('0x53')]){_0x1f6438[_0xd4fa('0x4c')]=[{'all':!![]}];}_0x1f6438=_[_0xd4fa('0x4a')]({},_0x1f6438,_0x38bf31[_0xd4fa('0x4b')]);return db[_0xd4fa('0x2b')]['find'](_0x1f6438)['then'](handleEntityNotFound(_0x26fff2,null))[_0xd4fa('0x24')](respondWithResult(_0x26fff2,null))[_0xd4fa('0x4f')](handleError(_0x26fff2,null));};exports[_0xd4fa('0x54')]=function(_0x220c81,_0x3e5de0){return db[_0xd4fa('0x2b')][_0xd4fa('0x54')](_0x220c81[_0xd4fa('0x55')],{})['then'](respondWithResult(_0x3e5de0,0xc9))[_0xd4fa('0x4f')](handleError(_0x3e5de0,null));};exports[_0xd4fa('0x23')]=function(_0x44c028,_0x1bf33b){if(_0x44c028[_0xd4fa('0x55')]['id']){delete _0x44c028[_0xd4fa('0x55')]['id'];}return db[_0xd4fa('0x2b')][_0xd4fa('0x56')]({'where':{'id':_0x44c028[_0xd4fa('0x51')]['id']}})[_0xd4fa('0x24')](handleEntityNotFound(_0x1bf33b,null))['then'](saveUpdates(_0x44c028['body'],null))[_0xd4fa('0x24')](respondWithResult(_0x1bf33b,null))[_0xd4fa('0x4f')](handleError(_0x1bf33b,null));};exports['describe']=function(_0x272656,_0x2036fa){return db[_0xd4fa('0x2b')]['describe']()['then'](respondWithResult(_0x2036fa,null))[_0xd4fa('0x4f')](handleError(_0x2036fa,null));};exports[_0xd4fa('0x25')]=function(_0x224fd6,_0x36aaf7){var _0x2c0ab7;return db[_0xd4fa('0x2b')][_0xd4fa('0x56')]({'where':{'id':_0x224fd6['params']['id']}})[_0xd4fa('0x24')](handleEntityNotFound(_0x36aaf7,null))[_0xd4fa('0x24')](function(_0x444174){if(_0x444174){return _0x444174[_0xd4fa('0x25')]()['then'](function(_0xa81c3e){return _0xa81c3e;});}})[_0xd4fa('0x24')](function(_0x36ef6e){_0x2c0ab7=_0x36ef6e;if(_0x36ef6e){if(_0x36ef6e[_0xd4fa('0x57')]||_0x36ef6e[_0xd4fa('0x58')]){return db[_0x36ef6e[_0xd4fa('0x57')]?_0xd4fa('0x59'):_0xd4fa('0x5a')]['find']({'where':{'id':_0x36ef6e['VoiceQueueId']?_0x36ef6e[_0xd4fa('0x57')]:_0x36ef6e[_0xd4fa('0x58')]},'attributes':['id',_0xd4fa('0x28')],'raw':!![]});}}})[_0xd4fa('0x24')](function(_0x101113){var _0x3b3e43={};if(_0x101113){_[_0xd4fa('0x4a')](_0x3b3e43,_[_0xd4fa('0x5b')](_0x2c0ab7[_0xd4fa('0x5c')],[_0xd4fa('0x5d'),_0xd4fa('0x5e'),'id']));_0x3b3e43[_0xd4fa('0x5f')]=0x15;_0x3b3e43[_0xd4fa('0x60')]='deleted';_0x3b3e43['campaign']=_0x101113[_0xd4fa('0x28')];_0x3b3e43['membername']=_0x224fd6[_0xd4fa('0x61')]['name'];_0x3b3e43[_0xd4fa('0x62')]=_0x224fd6[_0xd4fa('0x61')]['id'];_0x3b3e43[_0xd4fa('0x63')]=!![];_0x3b3e43['deletedat']=moment()[_0xd4fa('0x64')](_0xd4fa('0x65'));_0x3b3e43[_0xd4fa('0x66')]=_0x2c0ab7[_0xd4fa('0x67')];_0x3b3e43['campaigntype']=_0x2c0ab7[_0xd4fa('0x57')]?'queue':_0xd4fa('0x68');return db[_0xd4fa('0x69')][_0xd4fa('0x56')]({'where':{'id':_0x3b3e43[_0xd4fa('0x6a')]},'attributes':[_0xd4fa('0x6b'),_0xd4fa('0x6c')]})[_0xd4fa('0x24')](function(_0x515b78){if(!_[_0xd4fa('0x6d')](_0x36aaf7)&&!_[_0xd4fa('0x6d')](_0x515b78['firstName'])){_0x3b3e43[_0xd4fa('0x6e')]=_0x515b78['firstName'];if(!_[_0xd4fa('0x6d')](_0x515b78['lastName'])){_0x3b3e43[_0xd4fa('0x6e')]+='\x20'+_0x515b78[_0xd4fa('0x6c')];}}})[_0xd4fa('0x6f')](function(){return db[_0xd4fa('0x70')][_0xd4fa('0x54')](_0x3b3e43);});}})['then'](function(){return _0x36aaf7[_0xd4fa('0x1c')](0xcc)[_0xd4fa('0x1d')]();})[_0xd4fa('0x4f')](handleError(_0x36aaf7,null));};exports[_0xd4fa('0x71')]=function(_0x56dae7,_0x917628,_0x10417f){var _0x356f83=[];return db[_0xd4fa('0x69')][_0xd4fa('0x72')]()[_0xd4fa('0x24')](function(_0x213be3){_0x356f83=_[_0xd4fa('0x30')](_0x213be3);return _0x56dae7[_0xd4fa('0x61')][_0xd4fa('0x73')]({'where':{'type':_0xd4fa('0x74'),'dialActive':!![],'dialMethod':_0xd4fa('0x75')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x26de56){if(_0x26de56&&_0x26de56[_0xd4fa('0x42')]){return db['sequelize'][_0xd4fa('0x76')](function(_0x5e46df){var _0x54a22f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd4fa('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xd4fa('0x2a')](_0x26de56,'id')},'$or':[{'UserId':null},{'UserId':_0x56dae7[_0xd4fa('0x61')]['id']}]};var _0x4b98d6=[];if(_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x77')]&&_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x77')]===_0xd4fa('0x78')){if(!_[_0xd4fa('0x79')](_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')])){_0x54a22f['id']={'$in':_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')]};}_0x4b98d6=[[_0xd4fa('0x7b'),_0xd4fa('0x7c')],[_0xd4fa('0x7d'),_0x26de56[0x0]['dialOrderByScheduledAt']===_0xd4fa('0x7c')?'DESC':_0xd4fa('0x7c')],db['sequelize']['literal'](_0xd4fa('0x7e')),['id',_0xd4fa('0x7f')]];}else{if(!_[_0xd4fa('0x79')](_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')])){_0x54a22f['id']={'$notIn':_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')]};}_0x4b98d6=[[_0xd4fa('0x7b'),_0xd4fa('0x7f')],[_0xd4fa('0x7d'),_0x26de56[0x0][_0xd4fa('0x80')]],db[_0xd4fa('0x81')][_0xd4fa('0x82')](_0xd4fa('0x83')),['id',_0xd4fa('0x7c')]];}return db[_0xd4fa('0x2b')][_0xd4fa('0x84')]({'attributes':['id',_0xd4fa('0x85')],'where':_0x54a22f,'order':_0x4b98d6,'transaction':_0x5e46df,'lock':_0x5e46df[_0xd4fa('0x86')][_0xd4fa('0x87')],'include':[{'model':db[_0xd4fa('0x69')],'as':'Contact','attributes':_0x356f83,'include':[{'model':db['CmCompany'],'as':_0xd4fa('0x88'),'attributes':['id','name']}]},{'model':db[_0xd4fa('0x89')],'as':'List','attributes':['id',_0xd4fa('0x28')]},{'model':db[_0xd4fa('0x59')],'as':_0xd4fa('0x8a'),'attributes':['id',_0xd4fa('0x28'),'dialActive']}]})['then'](function(_0x2cca20){if(_0x2cca20){return _0x2cca20[_0xd4fa('0x23')]({'UserId':_0x56dae7['user']['id']},{'transaction':_0x5e46df});}});});}})['then'](handleEntityNotFound(_0x917628,null))[_0xd4fa('0x24')](respondWithResult(_0x917628,null))['catch'](handleError(_0x917628,null));};exports[_0xd4fa('0x8b')]=function(_0x284042,_0x18ac91,_0x3bb82c){return _0x284042[_0xd4fa('0x61')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xd4fa('0x75')},'attributes':['id'],'raw':!![]})[_0xd4fa('0x24')](function(_0x179261){if(_0x179261&&_0x179261[_0xd4fa('0x42')]){return db['CmHopper'][_0xd4fa('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd4fa('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x179261,'id')},'$or':[{'UserId':null},{'UserId':_0x284042[_0xd4fa('0x61')]['id']}]}});}return 0x0;})['then'](function(_0x23e7a8){if(!_[_0xd4fa('0x6d')](_0x23e7a8)&&_[_0xd4fa('0x8c')](_0x23e7a8)){return _0x18ac91[_0xd4fa('0x1c')](0xc8)[_0xd4fa('0x1e')]({'contacts':_0x23e7a8});}else{logger[_0xd4fa('0x26')](_0xd4fa('0x8d'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x18ac91['sendStatus'](0x194);}})[_0xd4fa('0x4f')](handleError(_0x18ac91,null));}; \ No newline at end of file +var _0x6836=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','intersection','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmContact','outbound','preview','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','DESC','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','List','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel'];(function(_0x119324,_0xbf2937){var _0x5dfbad=function(_0x281dd9){while(--_0x281dd9){_0x119324['push'](_0x119324['shift']());}};_0x5dfbad(++_0xbf2937);}(_0x6836,0x1c0));var _0x6683=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6836[_0xaa0309];return _0x5de7ce;};'use strict';var pdf=require(_0x6683('0x0'));var emlformat=require(_0x6683('0x1'));var rimraf=require(_0x6683('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6683('0x3'));var rp=require('request-promise');var moment=require(_0x6683('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6683('0x5'));var util=require('util');var path=require(_0x6683('0x6'));var sox=require(_0x6683('0x7'));var csv=require(_0x6683('0x8'));var ejs=require(_0x6683('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6683('0xa'));var crypto=require(_0x6683('0xb'));var jsforce=require(_0x6683('0xc'));var deskjs=require(_0x6683('0xd'));var toCsv=require(_0x6683('0x8'));var querystring=require(_0x6683('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6683('0xf'));var qs=require(_0x6683('0x10'));var as=require(_0x6683('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6683('0x12'))('api');var utils=require(_0x6683('0x13'));var config=require(_0x6683('0x14'));var licenseUtil=require(_0x6683('0x15'));var db=require(_0x6683('0x16'))['db'];function respondWithStatusCode(_0x3479a3,_0x205647){_0x205647=_0x205647||0xcc;return function(_0x4181e2){if(_0x4181e2){return _0x3479a3[_0x6683('0x17')](_0x205647);}return _0x3479a3['status'](_0x205647)[_0x6683('0x18')]();};}function respondWithResult(_0x1bf449,_0x4ccb6){_0x4ccb6=_0x4ccb6||0xc8;return function(_0x28985f){if(_0x28985f){return _0x1bf449[_0x6683('0x19')](_0x4ccb6)['json'](_0x28985f);}};}function respondWithFilteredResult(_0x2a6c74,_0x44e850){return function(_0x3df040){if(_0x3df040){var _0x11fdef=_0x3df040[_0x6683('0x1a')],_0xee9bd4=_0x44e850[_0x6683('0x1b')],_0x1a689d=_0x44e850[_0x6683('0x1b')]+_0x44e850['limit'],_0x286695;if(_0x1a689d>=_0x11fdef){_0x1a689d=_0x11fdef;_0x286695=0xc8;}else{_0x286695=0xce;}_0x2a6c74[_0x6683('0x19')](_0x286695);return _0x2a6c74[_0x6683('0x1c')](_0x6683('0x1d'),_0xee9bd4+'-'+_0x1a689d+'/'+_0x11fdef)[_0x6683('0x1e')](_0x3df040);}return null;};}function patchUpdates(_0x4a8b4b){return function(_0x2dabc1){try{jsonpatch[_0x6683('0x1f')](_0x2dabc1,_0x4a8b4b,!![]);}catch(_0x410692){return BPromise[_0x6683('0x20')](_0x410692);}return _0x2dabc1[_0x6683('0x21')]();};}function saveUpdates(_0x2d3775,_0x1fa733){return function(_0x162b40){if(_0x162b40){return _0x162b40[_0x6683('0x22')](_0x2d3775)[_0x6683('0x23')](function(_0x38e166){return _0x38e166;});}return null;};}function removeEntity(_0x248177,_0x34680f){return function(_0x3b63e7){if(_0x3b63e7){return _0x3b63e7[_0x6683('0x24')]()[_0x6683('0x23')](function(){_0x248177['status'](0xcc)[_0x6683('0x18')]();});}};}function handleEntityNotFound(_0x33cdd3,_0x49c1ce){return function(_0x3250e5){if(!_0x3250e5){_0x33cdd3[_0x6683('0x17')](0x194);}return _0x3250e5;};}function handleError(_0x457b3c,_0x4bed19){_0x4bed19=_0x4bed19||0x1f4;return function(_0x3b005e){logger[_0x6683('0x25')](_0x3b005e[_0x6683('0x26')]);if(_0x3b005e[_0x6683('0x27')]){delete _0x3b005e['name'];}_0x457b3c[_0x6683('0x19')](_0x4bed19)[_0x6683('0x28')](_0x3b005e);};}exports[_0x6683('0x29')]=function(_0x234d8f,_0x4ec957){var _0x2342cc={},_0xf3fd29={},_0x2324ba={'count':0x0,'rows':[]};var _0x1874d8=_[_0x6683('0x2a')](db[_0x6683('0x2b')][_0x6683('0x2c')],function(_0xda3a48){return{'name':_0xda3a48[_0x6683('0x2d')],'type':_0xda3a48['type'][_0x6683('0x2e')]};});_0xf3fd29[_0x6683('0x2f')]=_['map'](_0x1874d8,_0x6683('0x27'));_0xf3fd29[_0x6683('0x30')]=_['keys'](_0x234d8f[_0x6683('0x30')]);_0xf3fd29['filters']=_[_0x6683('0x31')](_0xf3fd29[_0x6683('0x2f')],_0xf3fd29[_0x6683('0x30')]);_0xf3fd29[_0x6683('0x32')]=_['concat'](_0xf3fd29[_0x6683('0x32')],[_0x6683('0x33'),_0x6683('0x34'),_0x6683('0x35'),_0x6683('0x36'),_0x6683('0x37'),_0x6683('0x38'),_0x6683('0x39'),_0x6683('0x3a'),_0x6683('0x3b'),_0x6683('0x3c'),_0x6683('0x3d'),_0x6683('0x3e'),_0x6683('0x3f'),_0x6683('0x40'),'$notLike',_0x6683('0x41'),'$notILike','$like',_0x6683('0x42'),_0x6683('0x43'),_0x6683('0x44'),_0x6683('0x45')]);_0x2342cc[_0x6683('0x46')]=_[_0x6683('0x31')](_0xf3fd29[_0x6683('0x2f')],qs[_0x6683('0x47')](_0x234d8f['query'][_0x6683('0x47')]));_0x2342cc[_0x6683('0x46')]=_0x2342cc[_0x6683('0x46')]['length']?_0x2342cc['attributes']:_0xf3fd29[_0x6683('0x2f')];if(!_0x234d8f['query'][_0x6683('0x48')](_0x6683('0x49'))){_0x2342cc['limit']=qs[_0x6683('0x4a')](_0x234d8f[_0x6683('0x30')][_0x6683('0x4a')]);_0x2342cc[_0x6683('0x1b')]=qs[_0x6683('0x1b')](_0x234d8f[_0x6683('0x30')][_0x6683('0x1b')]);}_0x2342cc['order']=qs[_0x6683('0x4b')](_0x234d8f[_0x6683('0x30')][_0x6683('0x4b')]);_0x2342cc['where']=qs['filters'](_[_0x6683('0x4c')](_0x234d8f[_0x6683('0x30')],_0xf3fd29['filters']),_0x1874d8);if(_0x234d8f[_0x6683('0x30')][_0x6683('0x4d')]){_0x2342cc[_0x6683('0x4e')]=_['merge'](_0x2342cc['where'],{'$or':_[_0x6683('0x2a')](_0x1874d8,function(_0x38e148){if(_0x38e148[_0x6683('0x4f')]!==_0x6683('0x50')){var _0x1f12c2={};_0x1f12c2[_0x38e148[_0x6683('0x27')]]={'$like':'%'+_0x234d8f[_0x6683('0x30')][_0x6683('0x4d')]+'%'};return _0x1f12c2;}})});}_0x2342cc=_['merge']({},_0x2342cc,_0x234d8f[_0x6683('0x51')]);var _0x5b6c45={'where':_0x2342cc[_0x6683('0x4e')]};return db[_0x6683('0x2b')]['count'](_0x5b6c45)['then'](function(_0x37cbf9){_0x2324ba[_0x6683('0x1a')]=_0x37cbf9;if(_0x234d8f[_0x6683('0x30')][_0x6683('0x52')]){_0x2342cc[_0x6683('0x53')]=[{'all':!![]}];}return db[_0x6683('0x2b')][_0x6683('0x54')](_0x2342cc);})['then'](function(_0x44c747){_0x2324ba[_0x6683('0x55')]=_0x44c747;return _0x2324ba;})[_0x6683('0x23')](respondWithFilteredResult(_0x4ec957,_0x2342cc))[_0x6683('0x56')](handleError(_0x4ec957,null));};exports[_0x6683('0x57')]=function(_0x4401e1,_0x445248){var _0x32aaff={'raw':!![],'where':{'id':_0x4401e1[_0x6683('0x58')]['id']}},_0x2225c6={};_0x2225c6[_0x6683('0x2f')]=_[_0x6683('0x59')](db[_0x6683('0x2b')][_0x6683('0x2c')]);_0x2225c6[_0x6683('0x30')]=_[_0x6683('0x59')](_0x4401e1[_0x6683('0x30')]);_0x2225c6['filters']=_['intersection'](_0x2225c6['model'],_0x2225c6[_0x6683('0x30')]);_0x32aaff[_0x6683('0x46')]=_[_0x6683('0x31')](_0x2225c6['model'],qs[_0x6683('0x47')](_0x4401e1[_0x6683('0x30')][_0x6683('0x47')]));_0x32aaff['attributes']=_0x32aaff[_0x6683('0x46')][_0x6683('0x5a')]?_0x32aaff['attributes']:_0x2225c6['model'];if(_0x4401e1['query']['includeAll']){_0x32aaff[_0x6683('0x53')]=[{'all':!![]}];}_0x32aaff=_[_0x6683('0x5b')]({},_0x32aaff,_0x4401e1[_0x6683('0x51')]);return db[_0x6683('0x2b')][_0x6683('0x5c')](_0x32aaff)[_0x6683('0x23')](handleEntityNotFound(_0x445248,null))[_0x6683('0x23')](respondWithResult(_0x445248,null))['catch'](handleError(_0x445248,null));};exports[_0x6683('0x5d')]=function(_0x2da3d7,_0x1af201){return db[_0x6683('0x2b')][_0x6683('0x5d')](_0x2da3d7['body'],{})[_0x6683('0x23')](respondWithResult(_0x1af201,0xc9))[_0x6683('0x56')](handleError(_0x1af201,null));};exports[_0x6683('0x22')]=function(_0xbc0395,_0x2b6407){if(_0xbc0395[_0x6683('0x5e')]['id']){delete _0xbc0395[_0x6683('0x5e')]['id'];}return db[_0x6683('0x2b')][_0x6683('0x5c')]({'where':{'id':_0xbc0395[_0x6683('0x58')]['id']}})[_0x6683('0x23')](handleEntityNotFound(_0x2b6407,null))[_0x6683('0x23')](saveUpdates(_0xbc0395[_0x6683('0x5e')],null))[_0x6683('0x23')](respondWithResult(_0x2b6407,null))[_0x6683('0x56')](handleError(_0x2b6407,null));};exports[_0x6683('0x5f')]=function(_0x479688,_0x25baed){return db['CmHopper'][_0x6683('0x5f')]()['then'](respondWithResult(_0x25baed,null))[_0x6683('0x56')](handleError(_0x25baed,null));};exports[_0x6683('0x24')]=function(_0x4f7412,_0x2d8aef){var _0x4ebf56;return db[_0x6683('0x2b')][_0x6683('0x5c')]({'where':{'id':_0x4f7412[_0x6683('0x58')]['id']}})[_0x6683('0x23')](handleEntityNotFound(_0x2d8aef,null))[_0x6683('0x23')](function(_0x29b054){if(_0x29b054){return _0x29b054[_0x6683('0x24')]()['then'](function(_0x31ef45){return _0x31ef45;});}})[_0x6683('0x23')](function(_0x2dd088){_0x4ebf56=_0x2dd088;if(_0x2dd088){if(_0x2dd088[_0x6683('0x60')]||_0x2dd088[_0x6683('0x61')]){return db[_0x2dd088[_0x6683('0x60')]?_0x6683('0x62'):_0x6683('0x63')][_0x6683('0x5c')]({'where':{'id':_0x2dd088[_0x6683('0x60')]?_0x2dd088[_0x6683('0x60')]:_0x2dd088['CampaignId']},'attributes':['id',_0x6683('0x27')],'raw':!![]});}}})[_0x6683('0x23')](function(_0x4a1d2b){var _0x2d57e1={};if(_0x4a1d2b){_[_0x6683('0x5b')](_0x2d57e1,_[_0x6683('0x64')](_0x4ebf56[_0x6683('0x65')],[_0x6683('0x66'),_0x6683('0x67'),'id']));_0x2d57e1[_0x6683('0x68')]=0x15;_0x2d57e1[_0x6683('0x69')]=_0x6683('0x6a');_0x2d57e1[_0x6683('0x6b')]=_0x4a1d2b[_0x6683('0x27')];_0x2d57e1[_0x6683('0x6c')]=_0x4f7412[_0x6683('0x6d')][_0x6683('0x27')];_0x2d57e1['UserId']=_0x4f7412[_0x6683('0x6d')]['id'];_0x2d57e1[_0x6683('0x6a')]=!![];_0x2d57e1[_0x6683('0x6e')]=moment()[_0x6683('0x6f')](_0x6683('0x70'));_0x2d57e1['calleridnum']=_0x4ebf56[_0x6683('0x71')];_0x2d57e1[_0x6683('0x72')]=_0x4ebf56[_0x6683('0x60')]?_0x6683('0x73'):'ivr';return db['CmContact'][_0x6683('0x5c')]({'where':{'id':_0x2d57e1[_0x6683('0x74')]},'attributes':[_0x6683('0x75'),_0x6683('0x76')]})[_0x6683('0x23')](function(_0x379d34){if(!_[_0x6683('0x77')](_0x2d8aef)&&!_[_0x6683('0x77')](_0x379d34[_0x6683('0x75')])){_0x2d57e1[_0x6683('0x78')]=_0x379d34[_0x6683('0x75')];if(!_[_0x6683('0x77')](_0x379d34[_0x6683('0x76')])){_0x2d57e1[_0x6683('0x78')]+='\x20'+_0x379d34[_0x6683('0x76')];}}})[_0x6683('0x79')](function(){return db[_0x6683('0x7a')][_0x6683('0x5d')](_0x2d57e1);});}})[_0x6683('0x23')](function(){return _0x2d8aef[_0x6683('0x19')](0xcc)['end']();})['catch'](handleError(_0x2d8aef,null));};exports['getPreview']=function(_0xea68f2,_0x17c75d,_0x3f6d55){var _0x5caf2b=[];return db[_0x6683('0x7b')][_0x6683('0x5f')]()['then'](function(_0xba00a4){_0x5caf2b=_[_0x6683('0x59')](_0xba00a4);return _0xea68f2['user']['getVoiceQueues']({'where':{'type':_0x6683('0x7c'),'dialActive':!![],'dialMethod':_0x6683('0x7d')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x6683('0x23')](function(_0x5d6220){if(_0x5d6220&&_0x5d6220[_0x6683('0x5a')]){return db['sequelize'][_0x6683('0x7e')](function(_0x5da435){var _0x3d3bbe={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6683('0x70'))},'VoiceQueueId':{'$in':_[_0x6683('0x2a')](_0x5d6220,'id')},'$or':[{'UserId':null},{'UserId':_0xea68f2[_0x6683('0x6d')]['id']}]};var _0x4ba4c6=[];if(_0xea68f2['body'][_0x6683('0x7f')]&&_0xea68f2[_0x6683('0x5e')][_0x6683('0x7f')]===_0x6683('0x80')){if(!_[_0x6683('0x81')](_0xea68f2[_0x6683('0x5e')][_0x6683('0x82')])){_0x3d3bbe['id']={'$in':_0xea68f2[_0x6683('0x5e')]['hopperIds']};}_0x4ba4c6=[[_0x6683('0x83'),'ASC'],[_0x6683('0x84'),_0x5d6220[0x0][_0x6683('0x85')]==='ASC'?_0x6683('0x86'):_0x6683('0x87')],db[_0x6683('0x88')][_0x6683('0x89')](_0x6683('0x8a')),['id',_0x6683('0x86')]];}else{if(!_[_0x6683('0x81')](_0xea68f2[_0x6683('0x5e')]['hopperIds'])){_0x3d3bbe['id']={'$notIn':_0xea68f2['body']['hopperIds']};}_0x4ba4c6=[[_0x6683('0x83'),'DESC'],[_0x6683('0x84'),_0x5d6220[0x0][_0x6683('0x85')]],db[_0x6683('0x88')]['literal'](_0x6683('0x8b')),['id','ASC']];}return db[_0x6683('0x2b')][_0x6683('0x8c')]({'attributes':['id',_0x6683('0x8d')],'where':_0x3d3bbe,'order':_0x4ba4c6,'transaction':_0x5da435,'lock':_0x5da435[_0x6683('0x8e')][_0x6683('0x8f')],'include':[{'model':db['CmContact'],'as':_0x6683('0x90'),'attributes':_0x5caf2b,'include':[{'model':db[_0x6683('0x91')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x6683('0x92'),'attributes':['id',_0x6683('0x27')]},{'model':db[_0x6683('0x62')],'as':_0x6683('0x93'),'attributes':['id','name',_0x6683('0x94')]}]})[_0x6683('0x23')](function(_0x378bc8){if(_0x378bc8){return _0x378bc8[_0x6683('0x22')]({'UserId':_0xea68f2['user']['id']},{'transaction':_0x5da435});}});});}})[_0x6683('0x23')](handleEntityNotFound(_0x17c75d,null))['then'](respondWithResult(_0x17c75d,null))[_0x6683('0x56')](handleError(_0x17c75d,null));};exports[_0x6683('0x95')]=function(_0x1a1576,_0x32390e,_0x111d91){return _0x1a1576[_0x6683('0x6d')][_0x6683('0x96')]({'where':{'type':_0x6683('0x7c'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6683('0x23')](function(_0x144f0a){if(_0x144f0a&&_0x144f0a[_0x6683('0x5a')]){return db[_0x6683('0x2b')][_0x6683('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6683('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x144f0a,'id')},'$or':[{'UserId':null},{'UserId':_0x1a1576[_0x6683('0x6d')]['id']}]}});}return 0x0;})[_0x6683('0x23')](function(_0x16027f){if(!_[_0x6683('0x77')](_0x16027f)&&_[_0x6683('0x97')](_0x16027f)){return _0x32390e[_0x6683('0x19')](0xc8)[_0x6683('0x1e')]({'contacts':_0x16027f});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x6683('0x95'),0x194,_0x6683('0x98'));_0x32390e['sendStatus'](0x194);}})[_0x6683('0x56')](handleError(_0x32390e,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c7732ad..1086937 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 _0x524a=['define','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./cmHopper.attributes','exports'];(function(_0x3eb818,_0x4aecf5){var _0x4857a8=function(_0x66def3){while(--_0x66def3){_0x3eb818['push'](_0x3eb818['shift']());}};_0x4857a8(++_0x4aecf5);}(_0x524a,0x123));var _0xa524=function(_0x5e6c3b,_0x62105e){_0x5e6c3b=_0x5e6c3b-0x0;var _0x33bbf5=_0x524a[_0x5e6c3b];return _0x33bbf5;};'use strict';var _=require(_0xa524('0x0'));var util=require('util');var logger=require(_0xa524('0x1'))('api');var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rp=require(_0xa524('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa524('0x5'));var config=require('../../config/environment');var attributes=require(_0xa524('0x6'));module[_0xa524('0x7')]=function(_0x2f5769,_0x5edf75){return _0x2f5769[_0xa524('0x8')]('CmHopper',attributes,{'tableName':_0xa524('0x9'),'paranoid':![],'indexes':[{'name':_0xa524('0xa'),'fields':[_0xa524('0xa')]},{'name':_0xa524('0xb'),'fields':[_0xa524('0xb')]},{'name':_0xa524('0xc'),'fields':[_0xa524('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b7e=['define','scheduledat','phone','priority','lodash','util','../../config/logger','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x264c84,_0x598700){var _0x1fd84c=function(_0x271c3d){while(--_0x271c3d){_0x264c84['push'](_0x264c84['shift']());}};_0x1fd84c(++_0x598700);}(_0x0b7e,0x185));var _0xe0b7=function(_0x1c3765,_0xc3b431){_0x1c3765=_0x1c3765-0x0;var _0x3ab003=_0x0b7e[_0x1c3765];return _0x3ab003;};'use strict';var _=require(_0xe0b7('0x0'));var util=require(_0xe0b7('0x1'));var logger=require(_0xe0b7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe0b7('0x3'));var config=require(_0xe0b7('0x4'));var attributes=require(_0xe0b7('0x5'));module[_0xe0b7('0x6')]=function(_0x44610e,_0x36b75a){return _0x44610e[_0xe0b7('0x7')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xe0b7('0x8'),'fields':[_0xe0b7('0x8')]},{'name':'phone','fields':[_0xe0b7('0x9')]},{'name':_0xe0b7('0xa'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b7f5172..3c8f7a1 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 _0x8931=['body','update','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','includes','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','destroy','findAll','COUNT','sequelize','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','CmHopper,\x20%s,\x20%s','message','result','GetCmHopper','CmHopper','raw','options','limit','include','map','model','attributes','catch','ShowCmHopper','find','where','CreateCmHopper','create'];(function(_0x23c32c,_0x25c512){var _0x5b023f=function(_0x599fda){while(--_0x599fda){_0x23c32c['push'](_0x23c32c['shift']());}};_0x5b023f(++_0x25c512);}(_0x8931,0x197));var _0x1893=function(_0x3bdc72,_0x32881e){_0x3bdc72=_0x3bdc72-0x0;var _0x1e78c8=_0x8931[_0x3bdc72];return _0x1e78c8;};'use strict';var _=require(_0x1893('0x0'));var util=require(_0x1893('0x1'));var moment=require(_0x1893('0x2'));var BPromise=require(_0x1893('0x3'));var rs=require(_0x1893('0x4'));var fs=require('fs');var Redis=require(_0x1893('0x5'));var db=require(_0x1893('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1893('0x7'))(_0x1893('0x8'));var config=require('../../config/environment');var jayson=require(_0x1893('0x9'));var client=jayson['client'][_0x1893('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18dd88,_0x2cf19f,_0x142927){return new BPromise(function(_0x3f19ae,_0x381984){return client[_0x1893('0xb')](_0x18dd88,_0x142927)[_0x1893('0xc')](function(_0xfe7f5){logger[_0x1893('0xd')]('CmHopper,\x20%s,\x20%s',_0x2cf19f,_0x1893('0xe'));logger[_0x1893('0xf')](_0x1893('0x10'),_0x2cf19f,'request\x20sent',JSON[_0x1893('0x11')](_0xfe7f5));if(_0xfe7f5['error']){if(_0xfe7f5[_0x1893('0x12')]['code']===0x1f4){logger[_0x1893('0x12')](_0x1893('0x13'),_0x2cf19f,_0xfe7f5[_0x1893('0x12')][_0x1893('0x14')]);return _0x381984(_0xfe7f5[_0x1893('0x12')][_0x1893('0x14')]);}logger[_0x1893('0x12')]('CmHopper,\x20%s,\x20%s',_0x2cf19f,_0xfe7f5[_0x1893('0x12')][_0x1893('0x14')]);return _0x3f19ae(_0xfe7f5[_0x1893('0x12')]['message']);}else{logger[_0x1893('0xd')](_0x1893('0x13'),_0x2cf19f,_0x1893('0xe'));_0x3f19ae(_0xfe7f5[_0x1893('0x15')]['message']);}})['catch'](function(_0x833e7a){logger['error'](_0x1893('0x13'),_0x2cf19f,_0x833e7a);_0x381984(_0x833e7a);});});}exports[_0x1893('0x16')]=function(_0x4a55f6){var _0x5bba8c=this;return new Promise(function(_0x4df8d3,_0x105a5d){return db[_0x1893('0x17')]['findAll']({'raw':_0x4a55f6['options']?_0x4a55f6['options'][_0x1893('0x18')]===undefined?!![]:![]:!![],'where':_0x4a55f6['options']?_0x4a55f6['options']['where']||null:null,'attributes':_0x4a55f6[_0x1893('0x19')]?_0x4a55f6[_0x1893('0x19')]['attributes']||null:null,'limit':_0x4a55f6[_0x1893('0x19')]?_0x4a55f6['options'][_0x1893('0x1a')]||null:null,'include':_0x4a55f6[_0x1893('0x19')]?_0x4a55f6['options'][_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x4a55f6[_0x1893('0x19')]['include'],function(_0x4a24aa){return{'model':db[_0x4a24aa['model']],'as':_0x4a24aa['as'],'attributes':_0x4a24aa['attributes'],'include':_0x4a24aa[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x4a24aa[_0x1893('0x1b')],function(_0x42b533){return{'model':db[_0x42b533[_0x1893('0x1d')]],'as':_0x42b533['as'],'attributes':_0x42b533['attributes'],'include':_0x42b533[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x42b533['include'],function(_0x8a619f){return{'model':db[_0x8a619f[_0x1893('0x1d')]],'as':_0x8a619f['as'],'attributes':_0x8a619f[_0x1893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0x4158e4){logger[_0x1893('0xd')](_0x1893('0x16'),_0x4a55f6);logger['debug'](_0x1893('0x16'),_0x4a55f6,JSON[_0x1893('0x11')](_0x4158e4));_0x4df8d3(_0x4158e4);})[_0x1893('0x1f')](function(_0x446394){logger[_0x1893('0x12')]('GetCmHopper',_0x446394[_0x1893('0x14')],_0x4a55f6);_0x105a5d(_0x5bba8c[_0x1893('0x12')](0x1f4,_0x446394[_0x1893('0x14')]));});});};exports[_0x1893('0x20')]=function(_0x46563c){var _0x5a757c=this;return new Promise(function(_0x5a6de5,_0x3ee13c){return db[_0x1893('0x17')][_0x1893('0x21')]({'raw':_0x46563c[_0x1893('0x19')]?_0x46563c['options']['raw']===undefined?!![]:![]:!![],'where':_0x46563c[_0x1893('0x19')]?_0x46563c['options'][_0x1893('0x22')]||null:null,'attributes':_0x46563c[_0x1893('0x19')]?_0x46563c['options'][_0x1893('0x1e')]||null:null,'include':_0x46563c[_0x1893('0x19')]?_0x46563c[_0x1893('0x19')]['include']?_[_0x1893('0x1c')](_0x46563c[_0x1893('0x19')][_0x1893('0x1b')],function(_0x58feaf){return{'model':db[_0x58feaf[_0x1893('0x1d')]],'as':_0x58feaf['as'],'attributes':_0x58feaf['attributes'],'include':_0x58feaf[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x58feaf['include'],function(_0x32eeb1){return{'model':db[_0x32eeb1[_0x1893('0x1d')]],'as':_0x32eeb1['as'],'attributes':_0x32eeb1[_0x1893('0x1e')],'include':_0x32eeb1['include']?_[_0x1893('0x1c')](_0x32eeb1[_0x1893('0x1b')],function(_0x15a34b){return{'model':db[_0x15a34b['model']],'as':_0x15a34b['as'],'attributes':_0x15a34b['attributes']};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0xdd8a47){logger[_0x1893('0xd')](_0x1893('0x20'),_0x46563c);logger[_0x1893('0xf')](_0x1893('0x20'),_0x46563c,JSON[_0x1893('0x11')](_0xdd8a47));_0x5a6de5(_0xdd8a47);})[_0x1893('0x1f')](function(_0x1a586e){logger[_0x1893('0x12')]('ShowCmHopper',_0x1a586e[_0x1893('0x14')],_0x46563c);_0x3ee13c(_0x5a757c[_0x1893('0x12')](0x1f4,_0x1a586e['message']));});});};exports[_0x1893('0x23')]=function(_0x367c8b){var _0x4021c1=this;return new Promise(function(_0x2631b9,_0x4ecd7f){return db[_0x1893('0x17')][_0x1893('0x24')](_0x367c8b[_0x1893('0x25')],{'raw':_0x367c8b[_0x1893('0x19')]?_0x367c8b[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![]})[_0x1893('0xc')](function(_0x17d007){logger[_0x1893('0xd')](_0x1893('0x23'),_0x367c8b);logger['debug'](_0x1893('0x23'),_0x367c8b,JSON[_0x1893('0x11')](_0x17d007));_0x2631b9(_0x17d007);})['catch'](function(_0x353f4e){logger['error'](_0x1893('0x23'),_0x353f4e['message'],_0x367c8b);_0x4ecd7f(_0x4021c1['error'](0x1f4,_0x353f4e[_0x1893('0x14')]));});});};exports['UpdateCmHopper']=function(_0x2aac1f){var _0x1b3f20=this;return new Promise(function(_0x39e745,_0x1c18ca){return db[_0x1893('0x17')][_0x1893('0x26')](_0x2aac1f[_0x1893('0x25')],{'raw':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')][_0x1893('0x22')]||null:null,'attributes':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')]['attributes']||null:null,'limit':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')][_0x1893('0x1a')]||null:null})[_0x1893('0xc')](function(_0x359c9e){logger[_0x1893('0xd')](_0x1893('0x27'),_0x2aac1f);logger[_0x1893('0xf')](_0x1893('0x27'),_0x2aac1f,JSON['stringify'](_0x359c9e));_0x39e745(_0x359c9e);})[_0x1893('0x1f')](function(_0x2325ee){logger[_0x1893('0x12')](_0x1893('0x27'),_0x2325ee[_0x1893('0x14')],_0x2aac1f);_0x1c18ca(_0x1b3f20['error'](0x1f4,_0x2325ee[_0x1893('0x14')]));});});};exports[_0x1893('0x28')]=function(_0xaa2904){var _0x3efb55=this;return new Promise(function(_0x3f112d,_0x55d8e5){return db[_0x1893('0x17')]['destroy']({'where':_0xaa2904[_0x1893('0x19')]?_0xaa2904[_0x1893('0x19')][_0x1893('0x22')]||null:null})[_0x1893('0xc')](function(_0x3e66e5){logger[_0x1893('0xd')]('DestroyCmHopper',_0xaa2904);logger[_0x1893('0xf')](_0x1893('0x28'),_0xaa2904,JSON[_0x1893('0x11')](_0x3e66e5));_0x3f112d(_0x3e66e5);})[_0x1893('0x1f')](function(_0x372c30){logger[_0x1893('0x12')]('DestroyCmHopper',_0x372c30[_0x1893('0x14')],_0xaa2904);_0x55d8e5(_0x3efb55[_0x1893('0x12')](0x1f4,_0x372c30[_0x1893('0x14')]));});});};exports[_0x1893('0x29')]=function(_0x4c570e){var _0x2c7388=this;return new Promise(function(_0x23b9b2,_0x6aca0b){return db[_0x1893('0x2a')][_0x1893('0x2b')]()[_0x1893('0xc')](function(_0x16c319){return db['sequelize'][_0x1893('0x2c')](function(_0x255b92){return db[_0x1893('0x17')]['findAll']({'where':_0x4c570e[_0x1893('0x19')]?_0x4c570e['options']['where']||null:null,'attributes':_0x4c570e[_0x1893('0x19')]?_0x4c570e[_0x1893('0x19')][_0x1893('0x1e')]||null:null,'limit':_0x4c570e[_0x1893('0x19')]?_0x4c570e['options'][_0x1893('0x1a')]||null:null,'order':_0x4c570e[_0x1893('0x19')]?_0x4c570e[_0x1893('0x19')][_0x1893('0x2d')]||null:null,'transaction':_0x255b92,'lock':_0x255b92[_0x1893('0x2e')][_0x1893('0x2f')],'include':[{'model':db[_0x1893('0x2a')],'as':_0x1893('0x30'),'attributes':_[_0x1893('0x31')](_0x16c319)},{'model':db[_0x1893('0x32')],'as':_0x1893('0x33'),'attributes':['id',_0x1893('0x34'),_0x1893('0x35')]}]})['then'](function(_0x453379){var _0x12444d=[];var _0x1318f8=[];for(var _0x3e2d23=0x0;_0x3e2d23<_0x453379[_0x1893('0x36')];_0x3e2d23+=0x1){if(!_0x1318f8[_0x1893('0x37')](_0x453379[_0x3e2d23][_0x1893('0x38')])){_0x1318f8[_0x1893('0x39')](_0x453379[_0x3e2d23]['UserId']);_0x12444d[_0x1893('0x39')](_0x453379[_0x3e2d23][_0x1893('0x26')](_0x4c570e[_0x1893('0x25')],{'transaction':_0x255b92}));}}return BPromise[_0x1893('0x3a')](_0x12444d);});})[_0x1893('0xc')](function(_0x5de062){logger[_0x1893('0xd')](_0x1893('0x29'),_0x4c570e);logger[_0x1893('0xf')](_0x1893('0x29'),_0x4c570e,JSON[_0x1893('0x11')](_0x5de062));_0x23b9b2(_0x5de062);})['catch'](function(_0x50f72a){logger[_0x1893('0x12')]('GetContactDialer',_0x50f72a[_0x1893('0x14')],_0x4c570e);_0x6aca0b(_0x2c7388[_0x1893('0x12')](0x1f4,_0x50f72a[_0x1893('0x14')]));});});});};exports[_0x1893('0x3b')]=function(_0x3049bd){var _0xa01bc2=this;return new Promise(function(_0x7afb3a,_0x4ef446){return db['sequelize']['transaction'](function(_0x3c9e60){return db[_0x1893('0x3c')]['create'](_0x3049bd['body'],{'raw':_0x3049bd[_0x1893('0x19')]?_0x3049bd[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3c9e60})[_0x1893('0xc')](function(){return db[_0x1893('0x17')][_0x1893('0x3d')]({'where':_0x3049bd['options']?_0x3049bd['options'][_0x1893('0x22')]||null:null,'transaction':_0x3c9e60});});})[_0x1893('0xc')](function(_0x3ef175){logger[_0x1893('0xd')](_0x1893('0x3b'),_0x3049bd);logger[_0x1893('0xf')](_0x1893('0x3b'),_0x3049bd,JSON['stringify'](_0x3ef175));_0x7afb3a(_0x3ef175);})['catch'](function(_0x38b361){logger[_0x1893('0x12')](_0x1893('0x3b'),_0x38b361[_0x1893('0x14')],_0x3049bd);_0x4ef446(_0xa01bc2['error'](0x1f4,_0x38b361['message']));});});};exports['CountReScheduled']=function(_0x293e99){var _0x519826=this;return new Promise(function(_0x1f3c58,_0x437bf4){return db[_0x1893('0x17')][_0x1893('0x3e')]({'raw':_0x293e99['options']?_0x293e99[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![],'where':_0x293e99[_0x1893('0x19')]?_0x293e99['options'][_0x1893('0x22')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1893('0x3f'),db['sequelize']['fn']('IF',db[_0x1893('0x40')][_0x1893('0x41')]('`scheduledat`\x20>=\x20'+util[_0x1893('0x42')](_0x1893('0x43'),moment()['format'](_0x1893('0x44')))+_0x1893('0x45')))),_0x1893('0x46')]]})[_0x1893('0xc')](function(_0x5f3721){logger['info'](_0x1893('0x47'),_0x293e99);logger[_0x1893('0xf')](_0x1893('0x47'),_0x293e99,JSON[_0x1893('0x11')](_0x5f3721));_0x1f3c58(_0x5f3721);})[_0x1893('0x1f')](function(_0x336a52){logger[_0x1893('0x12')](_0x1893('0x47'),_0x336a52[_0x1893('0x14')],_0x293e99);_0x437bf4(_0x519826[_0x1893('0x12')](0x1f4,_0x336a52[_0x1893('0x14')]));});});};exports[_0x1893('0x48')]=function(_0x292e38){var _0x23785d=this;return new Promise(function(_0x2bd8bb,_0x748b8a){return db[_0x1893('0x2a')][_0x1893('0x2b')]()[_0x1893('0xc')](function(_0x12accb){return db[_0x1893('0x40')][_0x1893('0x2c')](function(_0x1af025){return db[_0x1893('0x17')][_0x1893('0x3e')]({'where':_0x292e38['options']?_0x292e38['options']['where']||null:null,'attributes':_0x292e38[_0x1893('0x19')]?_0x292e38[_0x1893('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x292e38[_0x1893('0x19')]?_0x292e38['options'][_0x1893('0x2d')]||null:null,'group':db[_0x1893('0x17')]['UserId'],'transaction':_0x1af025,'lock':_0x1af025[_0x1893('0x2e')][_0x1893('0x2f')],'include':_0x292e38[_0x1893('0x19')]?_0x292e38[_0x1893('0x19')][_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x292e38[_0x1893('0x19')]['include'],function(_0x136e30){return{'model':db[_0x136e30['model']],'as':_0x136e30['as'],'attributes':_0x136e30[_0x1893('0x1e')],'include':_0x136e30['include']?_[_0x1893('0x1c')](_0x136e30['include'],function(_0x41f7a9){return{'model':db[_0x41f7a9[_0x1893('0x1d')]],'as':_0x41f7a9['as'],'attributes':_0x41f7a9[_0x1893('0x1e')],'include':_0x41f7a9[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x41f7a9[_0x1893('0x1b')],function(_0x28cd41){return{'model':db[_0x28cd41['model']],'as':_0x28cd41['as'],'attributes':_0x28cd41[_0x1893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0x3f2672){var _0xf47abc=[];for(var _0x1a0fc9=0x0;_0x1a0fc9<_0x3f2672['length'];_0x1a0fc9+=0x1){_0xf47abc['push'](_0x3f2672[_0x1a0fc9][_0x1893('0x26')](_0x292e38[_0x1893('0x25')],{'transaction':_0x1af025}));}return BPromise['all'](_0xf47abc);});})[_0x1893('0xc')](function(_0x16ce87){logger['info'](_0x1893('0x48'),_0x292e38);logger['debug'](_0x1893('0x48'),_0x292e38,JSON[_0x1893('0x11')](_0x16ce87));_0x2bd8bb(_0x16ce87);})[_0x1893('0x1f')](function(_0x16221c){logger[_0x1893('0x12')]('GetContactRecallMe',_0x16221c[_0x1893('0x14')],_0x292e38);_0x748b8a(_0x23785d['error'](0x1f4,_0x16221c['message']));});});});};exports[_0x1893('0x49')]=function(_0x253f91){var _0x26bfff=this;return new Promise(function(_0x57b7bc,_0x135187){db[_0x1893('0x2a')][_0x1893('0x2b')]()[_0x1893('0xc')](function(_0x9c0117){return db[_0x1893('0x17')][_0x1893('0x3e')]({'raw':_0x253f91['options']?_0x253f91[_0x1893('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x253f91[_0x1893('0x19')]?_0x253f91['options'][_0x1893('0x22')]||null:null,'attributes':_0x253f91[_0x1893('0x19')]?_0x253f91['options'][_0x1893('0x1e')]||null:null,'limit':_0x253f91['options']?_0x253f91[_0x1893('0x19')][_0x1893('0x1a')]||null:null,'include':_0x253f91[_0x1893('0x19')]?_0x253f91[_0x1893('0x19')][_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x253f91['options'][_0x1893('0x1b')],function(_0x9fd661){return{'model':db[_0x9fd661[_0x1893('0x1d')]],'as':_0x9fd661['as'],'attributes':_0x9fd661['as']===_0x1893('0x30')?_[_0x1893('0x31')](_0x9c0117):_0x9fd661['attributes'],'include':_0x9fd661[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x9fd661['include'],function(_0x435243){return{'model':db[_0x435243[_0x1893('0x1d')]],'as':_0x435243['as'],'attributes':_0x435243[_0x1893('0x1e')],'include':_0x435243[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x435243[_0x1893('0x1b')],function(_0xeec0cf){return{'model':db[_0xeec0cf[_0x1893('0x1d')]],'as':_0xeec0cf['as'],'attributes':_0xeec0cf[_0x1893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0x503ee4){logger[_0x1893('0xd')](_0x1893('0x16'),_0x253f91);logger['debug'](_0x1893('0x16'),_0x253f91,JSON[_0x1893('0x11')](_0x503ee4));_0x57b7bc(_0x503ee4);})[_0x1893('0x1f')](function(_0x3ecdd2){logger['error'](_0x1893('0x16'),_0x3ecdd2[_0x1893('0x14')],_0x253f91);_0x135187(_0x26bfff['error'](0x1f4,_0x3ecdd2['message']));});});});}; \ No newline at end of file +var _0xf70d=['debug','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','findAll','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','update','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','model','map','GetCmHopper'];(function(_0xf8e1e1,_0x19ff90){var _0x187bc2=function(_0xf01c76){while(--_0xf01c76){_0xf8e1e1['push'](_0xf8e1e1['shift']());}};_0x187bc2(++_0x19ff90);}(_0xf70d,0x6f));var _0xdf70=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xf70d[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0xdf70('0x0'));var util=require(_0xdf70('0x1'));var moment=require(_0xdf70('0x2'));var BPromise=require(_0xdf70('0x3'));var rs=require(_0xdf70('0x4'));var fs=require('fs');var Redis=require(_0xdf70('0x5'));var db=require(_0xdf70('0x6'))['db'];var utils=require(_0xdf70('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xdf70('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdf70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x362019,_0x1f48f4,_0x38dcf5){return new BPromise(function(_0x5e65f4,_0x2c88a1){return client[_0xdf70('0xa')](_0x362019,_0x38dcf5)[_0xdf70('0xb')](function(_0x349094){logger[_0xdf70('0xc')](_0xdf70('0xd'),_0x1f48f4,_0xdf70('0xe'));logger['debug'](_0xdf70('0xf'),_0x1f48f4,'request\x20sent',JSON[_0xdf70('0x10')](_0x349094));if(_0x349094[_0xdf70('0x11')]){if(_0x349094[_0xdf70('0x11')][_0xdf70('0x12')]===0x1f4){logger[_0xdf70('0x11')]('CmHopper,\x20%s,\x20%s',_0x1f48f4,_0x349094['error']['message']);return _0x2c88a1(_0x349094[_0xdf70('0x11')][_0xdf70('0x13')]);}logger[_0xdf70('0x11')]('CmHopper,\x20%s,\x20%s',_0x1f48f4,_0x349094[_0xdf70('0x11')][_0xdf70('0x13')]);return _0x5e65f4(_0x349094[_0xdf70('0x11')][_0xdf70('0x13')]);}else{logger[_0xdf70('0xc')]('CmHopper,\x20%s,\x20%s',_0x1f48f4,_0xdf70('0xe'));_0x5e65f4(_0x349094[_0xdf70('0x14')][_0xdf70('0x13')]);}})[_0xdf70('0x15')](function(_0x555def){logger['error'](_0xdf70('0xd'),_0x1f48f4,_0x555def);_0x2c88a1(_0x555def);});});}exports['GetCmHopper']=function(_0x2af9d8){var _0x4cb730=this;return new Promise(function(_0x1c3042,_0xbc88b3){return db['CmHopper']['findAll']({'raw':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8['options'][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8[_0xdf70('0x16')][_0xdf70('0x18')]||null:null,'attributes':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8[_0xdf70('0x16')][_0xdf70('0x19')]||null:null,'limit':_0x2af9d8['options']?_0x2af9d8['options'][_0xdf70('0x1a')]||null:null,'include':_0x2af9d8[_0xdf70('0x16')]?_0x2af9d8[_0xdf70('0x16')][_0xdf70('0x1b')]?_['map'](_0x2af9d8['options'][_0xdf70('0x1b')],function(_0x2b113e){return{'model':db[_0x2b113e[_0xdf70('0x1c')]],'as':_0x2b113e['as'],'attributes':_0x2b113e[_0xdf70('0x19')],'include':_0x2b113e['include']?_['map'](_0x2b113e[_0xdf70('0x1b')],function(_0x374836){return{'model':db[_0x374836[_0xdf70('0x1c')]],'as':_0x374836['as'],'attributes':_0x374836['attributes'],'include':_0x374836[_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x374836[_0xdf70('0x1b')],function(_0x41ee39){return{'model':db[_0x41ee39[_0xdf70('0x1c')]],'as':_0x41ee39['as'],'attributes':_0x41ee39[_0xdf70('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdf70('0xb')](function(_0x182ea1){logger[_0xdf70('0xc')](_0xdf70('0x1e'),_0x2af9d8);logger[_0xdf70('0x1f')](_0xdf70('0x1e'),_0x2af9d8,JSON['stringify'](_0x182ea1));_0x1c3042(_0x182ea1);})[_0xdf70('0x15')](function(_0x266c6c){logger[_0xdf70('0x11')]('GetCmHopper',_0x266c6c['message'],_0x2af9d8);_0xbc88b3(_0x4cb730[_0xdf70('0x11')](0x1f4,_0x266c6c[_0xdf70('0x13')]));});});};exports[_0xdf70('0x20')]=function(_0x9da800){var _0x4234cc=this;return new Promise(function(_0x75958f,_0x5eedc9){return db[_0xdf70('0x21')][_0xdf70('0x22')]({'raw':_0x9da800[_0xdf70('0x16')]?_0x9da800[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x9da800['options']?_0x9da800['options'][_0xdf70('0x18')]||null:null,'attributes':_0x9da800[_0xdf70('0x16')]?_0x9da800['options']['attributes']||null:null,'include':_0x9da800[_0xdf70('0x16')]?_0x9da800[_0xdf70('0x16')][_0xdf70('0x1b')]?_['map'](_0x9da800['options'][_0xdf70('0x1b')],function(_0x5b67d6){return{'model':db[_0x5b67d6[_0xdf70('0x1c')]],'as':_0x5b67d6['as'],'attributes':_0x5b67d6[_0xdf70('0x19')],'include':_0x5b67d6[_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x5b67d6[_0xdf70('0x1b')],function(_0x574b19){return{'model':db[_0x574b19[_0xdf70('0x1c')]],'as':_0x574b19['as'],'attributes':_0x574b19[_0xdf70('0x19')],'include':_0x574b19[_0xdf70('0x1b')]?_['map'](_0x574b19[_0xdf70('0x1b')],function(_0x379619){return{'model':db[_0x379619['model']],'as':_0x379619['as'],'attributes':_0x379619[_0xdf70('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e7ab){logger['info']('ShowCmHopper',_0x9da800);logger[_0xdf70('0x1f')](_0xdf70('0x20'),_0x9da800,JSON[_0xdf70('0x10')](_0x18e7ab));_0x75958f(_0x18e7ab);})[_0xdf70('0x15')](function(_0x552e2b){logger[_0xdf70('0x11')](_0xdf70('0x20'),_0x552e2b[_0xdf70('0x13')],_0x9da800);_0x5eedc9(_0x4234cc[_0xdf70('0x11')](0x1f4,_0x552e2b[_0xdf70('0x13')]));});});};exports[_0xdf70('0x23')]=function(_0x9d1317){var _0xa6bfab=this;return new Promise(function(_0x3911e4,_0x300b2a){return db[_0xdf70('0x21')][_0xdf70('0x24')](_0x9d1317[_0xdf70('0x25')],{'raw':_0x9d1317[_0xdf70('0x16')]?_0x9d1317['options'][_0xdf70('0x17')]===undefined?!![]:![]:!![]})[_0xdf70('0xb')](function(_0x27f03b){logger['info'](_0xdf70('0x23'),_0x9d1317);logger[_0xdf70('0x1f')]('CreateCmHopper',_0x9d1317,JSON['stringify'](_0x27f03b));_0x3911e4(_0x27f03b);})[_0xdf70('0x15')](function(_0x32c145){logger['error'](_0xdf70('0x23'),_0x32c145[_0xdf70('0x13')],_0x9d1317);_0x300b2a(_0xa6bfab[_0xdf70('0x11')](0x1f4,_0x32c145['message']));});});};exports['UpdateCmHopper']=function(_0x2daa02){var _0x104475=this;return new Promise(function(_0x15aac8,_0x29433e){return db[_0xdf70('0x21')]['update'](_0x2daa02[_0xdf70('0x25')],{'raw':_0x2daa02['options']?_0x2daa02[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2daa02[_0xdf70('0x16')]?_0x2daa02[_0xdf70('0x16')]['where']||null:null,'attributes':_0x2daa02['options']?_0x2daa02[_0xdf70('0x16')]['attributes']||null:null,'limit':_0x2daa02[_0xdf70('0x16')]?_0x2daa02[_0xdf70('0x16')][_0xdf70('0x1a')]||null:null})[_0xdf70('0xb')](function(_0x2c3a82){logger[_0xdf70('0xc')](_0xdf70('0x26'),_0x2daa02);logger[_0xdf70('0x1f')](_0xdf70('0x26'),_0x2daa02,JSON[_0xdf70('0x10')](_0x2c3a82));_0x15aac8(_0x2c3a82);})[_0xdf70('0x15')](function(_0x4cfbe2){logger[_0xdf70('0x11')](_0xdf70('0x26'),_0x4cfbe2['message'],_0x2daa02);_0x29433e(_0x104475[_0xdf70('0x11')](0x1f4,_0x4cfbe2['message']));});});};exports[_0xdf70('0x27')]=function(_0xa7853){var _0x16834e=this;return new Promise(function(_0x140a55,_0x5d0efb){return db[_0xdf70('0x21')][_0xdf70('0x28')]({'where':_0xa7853[_0xdf70('0x16')]?_0xa7853['options'][_0xdf70('0x18')]||null:null})[_0xdf70('0xb')](function(_0x446e57){logger[_0xdf70('0xc')](_0xdf70('0x27'),_0xa7853);logger[_0xdf70('0x1f')]('DestroyCmHopper',_0xa7853,JSON[_0xdf70('0x10')](_0x446e57));_0x140a55(_0x446e57);})[_0xdf70('0x15')](function(_0x2645b0){logger['error'](_0xdf70('0x27'),_0x2645b0[_0xdf70('0x13')],_0xa7853);_0x5d0efb(_0x16834e['error'](0x1f4,_0x2645b0[_0xdf70('0x13')]));});});};exports[_0xdf70('0x29')]=function(_0x435ddd){var _0x3227bd=this;return new Promise(function(_0x461eb3,_0x1cfa64){return db[_0xdf70('0x2a')]['describe']()['then'](function(_0x4c74f1){return db[_0xdf70('0x2b')][_0xdf70('0x2c')](function(_0x269d45){return db[_0xdf70('0x21')][_0xdf70('0x2d')]({'where':_0x435ddd['options']?_0x435ddd[_0xdf70('0x16')]['where']||null:null,'attributes':_0x435ddd[_0xdf70('0x16')]?_0x435ddd['options']['attributes']||null:null,'limit':_0x435ddd[_0xdf70('0x16')]?_0x435ddd[_0xdf70('0x16')][_0xdf70('0x1a')]||null:null,'order':_0x435ddd['options']?_0x435ddd['options']['order']||null:null,'transaction':_0x269d45,'lock':_0x269d45[_0xdf70('0x2e')][_0xdf70('0x2f')],'include':[{'model':db[_0xdf70('0x2a')],'as':'Contact','attributes':_[_0xdf70('0x30')](_0x4c74f1)},{'model':db[_0xdf70('0x31')],'as':_0xdf70('0x32'),'attributes':['id',_0xdf70('0x33'),_0xdf70('0x34')]}]})['then'](function(_0x173e1f){var _0x56b2c1=[];var _0x2b558d=[];for(var _0x4220ed=0x0;_0x4220ed<_0x173e1f[_0xdf70('0x35')];_0x4220ed+=0x1){if(!_0x2b558d['includes'](_0x173e1f[_0x4220ed][_0xdf70('0x36')])){_0x2b558d[_0xdf70('0x37')](_0x173e1f[_0x4220ed][_0xdf70('0x36')]);_0x56b2c1[_0xdf70('0x37')](_0x173e1f[_0x4220ed]['update'](_0x435ddd[_0xdf70('0x25')],{'transaction':_0x269d45}));}}return BPromise[_0xdf70('0x38')](_0x56b2c1);});})[_0xdf70('0xb')](function(_0x38266e){logger['info'](_0xdf70('0x29'),_0x435ddd);logger[_0xdf70('0x1f')](_0xdf70('0x29'),_0x435ddd,JSON[_0xdf70('0x10')](_0x38266e));_0x461eb3(_0x38266e);})[_0xdf70('0x15')](function(_0x5790d0){logger['error']('GetContactDialer',_0x5790d0[_0xdf70('0x13')],_0x435ddd);_0x1cfa64(_0x3227bd['error'](0x1f4,_0x5790d0[_0xdf70('0x13')]));});});});};exports[_0xdf70('0x39')]=function(_0x4f6132){var _0x11a544=this;return new Promise(function(_0x18c21c,_0x41bbb1){return db['sequelize'][_0xdf70('0x2c')](function(_0x39e131){return db['CmHopperFinal'][_0xdf70('0x24')](_0x4f6132[_0xdf70('0x25')],{'raw':_0x4f6132[_0xdf70('0x16')]?_0x4f6132[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'transaction':_0x39e131})[_0xdf70('0xb')](function(){return db['CmHopper'][_0xdf70('0x28')]({'where':_0x4f6132[_0xdf70('0x16')]?_0x4f6132['options'][_0xdf70('0x18')]||null:null,'transaction':_0x39e131});});})[_0xdf70('0xb')](function(_0x53d88a){logger[_0xdf70('0xc')](_0xdf70('0x39'),_0x4f6132);logger[_0xdf70('0x1f')](_0xdf70('0x39'),_0x4f6132,JSON[_0xdf70('0x10')](_0x53d88a));_0x18c21c(_0x53d88a);})[_0xdf70('0x15')](function(_0x34999d){logger['error'](_0xdf70('0x39'),_0x34999d[_0xdf70('0x13')],_0x4f6132);_0x41bbb1(_0x11a544['error'](0x1f4,_0x34999d['message']));});});};exports[_0xdf70('0x3a')]=function(_0x14551a){var _0x463625=this;return new Promise(function(_0x540b05,_0x45c2b0){return db[_0xdf70('0x21')]['findAll']({'raw':_0x14551a['options']?_0x14551a[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x14551a[_0xdf70('0x16')]?_0x14551a['options']['where']||null:null,'attributes':[[db[_0xdf70('0x2b')]['fn'](_0xdf70('0x3b'),db[_0xdf70('0x2b')]['fn']('IF',db['sequelize'][_0xdf70('0x3c')](_0xdf70('0x3d')+util[_0xdf70('0x3e')](_0xdf70('0x3f'),moment()[_0xdf70('0x3e')](_0xdf70('0x40')))+_0xdf70('0x41')))),'contactsRescheduled']]})[_0xdf70('0xb')](function(_0xa94197){logger[_0xdf70('0xc')](_0xdf70('0x3a'),_0x14551a);logger[_0xdf70('0x1f')](_0xdf70('0x3a'),_0x14551a,JSON[_0xdf70('0x10')](_0xa94197));_0x540b05(_0xa94197);})[_0xdf70('0x15')](function(_0x1fab05){logger[_0xdf70('0x11')](_0xdf70('0x3a'),_0x1fab05['message'],_0x14551a);_0x45c2b0(_0x463625[_0xdf70('0x11')](0x1f4,_0x1fab05['message']));});});};exports[_0xdf70('0x42')]=function(_0x4d243a){var _0x21ef2d=this;return new Promise(function(_0x296b41,_0x34fe2f){return db[_0xdf70('0x2a')][_0xdf70('0x43')]()[_0xdf70('0xb')](function(_0x924dcf){return db[_0xdf70('0x2b')][_0xdf70('0x2c')](function(_0x2de670){return db['CmHopper'][_0xdf70('0x2d')]({'where':_0x4d243a[_0xdf70('0x16')]?_0x4d243a['options'][_0xdf70('0x18')]||null:null,'attributes':_0x4d243a[_0xdf70('0x16')]?_0x4d243a[_0xdf70('0x16')][_0xdf70('0x19')]||null:null,'limit':0x1,'order':_0x4d243a[_0xdf70('0x16')]?_0x4d243a['options']['order']||null:null,'group':db[_0xdf70('0x21')][_0xdf70('0x36')],'transaction':_0x2de670,'lock':_0x2de670[_0xdf70('0x2e')][_0xdf70('0x2f')],'include':_0x4d243a[_0xdf70('0x16')]?_0x4d243a[_0xdf70('0x16')][_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x4d243a[_0xdf70('0x16')][_0xdf70('0x1b')],function(_0x2242c0){return{'model':db[_0x2242c0[_0xdf70('0x1c')]],'as':_0x2242c0['as'],'attributes':_0x2242c0[_0xdf70('0x19')],'include':_0x2242c0[_0xdf70('0x1b')]?_['map'](_0x2242c0[_0xdf70('0x1b')],function(_0x4ead3d){return{'model':db[_0x4ead3d['model']],'as':_0x4ead3d['as'],'attributes':_0x4ead3d['attributes'],'include':_0x4ead3d[_0xdf70('0x1b')]?_['map'](_0x4ead3d[_0xdf70('0x1b')],function(_0x16e52a){return{'model':db[_0x16e52a[_0xdf70('0x1c')]],'as':_0x16e52a['as'],'attributes':_0x16e52a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf70('0xb')](function(_0x4c73b5){var _0x397471=[];for(var _0x41f139=0x0;_0x41f139<_0x4c73b5[_0xdf70('0x35')];_0x41f139+=0x1){_0x397471[_0xdf70('0x37')](_0x4c73b5[_0x41f139][_0xdf70('0x44')](_0x4d243a[_0xdf70('0x25')],{'transaction':_0x2de670}));}return BPromise[_0xdf70('0x38')](_0x397471);});})[_0xdf70('0xb')](function(_0x1fec75){logger[_0xdf70('0xc')]('GetContactRecallMe',_0x4d243a);logger['debug'](_0xdf70('0x42'),_0x4d243a,JSON['stringify'](_0x1fec75));_0x296b41(_0x1fec75);})[_0xdf70('0x15')](function(_0x58716f){logger[_0xdf70('0x11')]('GetContactRecallMe',_0x58716f['message'],_0x4d243a);_0x34fe2f(_0x21ef2d[_0xdf70('0x11')](0x1f4,_0x58716f[_0xdf70('0x13')]));});});});};exports[_0xdf70('0x45')]=function(_0x327f55){var _0x1d8b4c=this;return new Promise(function(_0x3fced7,_0x554042){db[_0xdf70('0x2a')][_0xdf70('0x43')]()['then'](function(_0x379035){return db['CmHopper']['findAll']({'raw':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')][_0xdf70('0x17')]===undefined?!![]:![]:!![],'where':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')][_0xdf70('0x18')]||null:null,'attributes':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')][_0xdf70('0x19')]||null:null,'limit':_0x327f55[_0xdf70('0x16')]?_0x327f55[_0xdf70('0x16')]['limit']||null:null,'include':_0x327f55[_0xdf70('0x16')]?_0x327f55['options'][_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x327f55[_0xdf70('0x16')][_0xdf70('0x1b')],function(_0x1c5ed7){return{'model':db[_0x1c5ed7['model']],'as':_0x1c5ed7['as'],'attributes':_0x1c5ed7['as']===_0xdf70('0x46')?_[_0xdf70('0x30')](_0x379035):_0x1c5ed7[_0xdf70('0x19')],'include':_0x1c5ed7[_0xdf70('0x1b')]?_[_0xdf70('0x1d')](_0x1c5ed7[_0xdf70('0x1b')],function(_0x122f7d){return{'model':db[_0x122f7d[_0xdf70('0x1c')]],'as':_0x122f7d['as'],'attributes':_0x122f7d[_0xdf70('0x19')],'include':_0x122f7d[_0xdf70('0x1b')]?_['map'](_0x122f7d[_0xdf70('0x1b')],function(_0x1a86c3){return{'model':db[_0x1a86c3[_0xdf70('0x1c')]],'as':_0x1a86c3['as'],'attributes':_0x1a86c3[_0xdf70('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdf70('0xb')](function(_0x164a05){logger[_0xdf70('0xc')]('GetCmHopper',_0x327f55);logger[_0xdf70('0x1f')](_0xdf70('0x1e'),_0x327f55,JSON[_0xdf70('0x10')](_0x164a05));_0x3fced7(_0x164a05);})[_0xdf70('0x15')](function(_0x3bf0ac){logger[_0xdf70('0x11')](_0xdf70('0x1e'),_0x3bf0ac[_0xdf70('0x13')],_0x327f55);_0x554042(_0x1d8b4c['error'](0x1f4,_0x3bf0ac[_0xdf70('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a8e351d..deb0204 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 _0x958a=['express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','delete','exports','multer','util','connect-timeout'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x958a,0x128));var _0xa958=function(_0x130001,_0x586139){_0x130001=_0x130001-0x0;var _0x1d3d99=_0x958a[_0x130001];return _0x1d3d99;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var auth=require(_0xa958('0x5'));var interaction=require(_0xa958('0x6'));var config=require('../../config/environment');var controller=require(_0xa958('0x7'));router['get']('/',auth[_0xa958('0x8')](),controller[_0xa958('0x9')]);router[_0xa958('0xa')](_0xa958('0xb'),auth[_0xa958('0x8')](),controller[_0xa958('0xc')]);router[_0xa958('0xa')]('/opencontacts',auth['isAuthenticated'](),controller[_0xa958('0xd')]);router[_0xa958('0xa')](_0xa958('0xe'),auth[_0xa958('0x8')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')]('/',auth[_0xa958('0x8')](),controller[_0xa958('0x11')]);router[_0xa958('0x10')](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x13')]);router[_0xa958('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa958('0x15')](_0xa958('0xe'),auth[_0xa958('0x8')](),controller['destroy']);module[_0xa958('0x16')]=router; \ No newline at end of file +var _0x2deb=['isAuthenticated','getOpenContacts','show','post','/preview','getPreview','/:id','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','index','get','/describe','describe'];(function(_0x48c85d,_0x5c90b2){var _0x194214=function(_0x308964){while(--_0x308964){_0x48c85d['push'](_0x48c85d['shift']());}};_0x194214(++_0x5c90b2);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var path=require(_0xb2de('0x2'));var timeout=require(_0xb2de('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb2de('0x4'));var interaction=require(_0xb2de('0x5'));var config=require(_0xb2de('0x6'));var controller=require(_0xb2de('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb2de('0x8')]);router[_0xb2de('0x9')](_0xb2de('0xa'),auth['isAuthenticated'](),controller[_0xb2de('0xb')]);router[_0xb2de('0x9')]('/opencontacts',auth[_0xb2de('0xc')](),controller[_0xb2de('0xd')]);router[_0xb2de('0x9')]('/:id',auth[_0xb2de('0xc')](),controller[_0xb2de('0xe')]);router[_0xb2de('0xf')]('/',auth[_0xb2de('0xc')](),controller['create']);router['post'](_0xb2de('0x10'),auth[_0xb2de('0xc')](),controller[_0xb2de('0x11')]);router['put'](_0xb2de('0x12'),auth[_0xb2de('0xc')](),controller[_0xb2de('0x13')]);router['delete'](_0xb2de('0x12'),auth['isAuthenticated'](),controller[_0xb2de('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 82d0027..722f085 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 _0xc1a0=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0xe4f129,_0x19fc53){var _0x16758b=function(_0x5b4e89){while(--_0x5b4e89){_0xe4f129['push'](_0xe4f129['shift']());}};_0x16758b(++_0x19fc53);}(_0xc1a0,0xde));var _0x0c1a=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xc1a0[_0x303c30];return _0x43161b;};'use strict';var moment=require(_0x0c1a('0x0'));var Sequelize=require('sequelize');module[_0x0c1a('0x1')]={'CmHopperId':{'type':Sequelize[_0x0c1a('0x2')]},'phone':{'type':Sequelize[_0x0c1a('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0c1a('0x4')],'defaultValue':moment()[_0x0c1a('0x5')](_0x0c1a('0x6'))},'countbusyretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x96af=['INTEGER','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x4c81b4,_0x1931f){var _0x2e4fa6=function(_0x47d79e){while(--_0x47d79e){_0x4c81b4['push'](_0x4c81b4['shift']());}};_0x2e4fa6(++_0x1931f);}(_0x96af,0x76));var _0xf96a=function(_0x1fd5eb,_0x235203){_0x1fd5eb=_0x1fd5eb-0x0;var _0x102365=_0x96af[_0x1fd5eb];return _0x102365;};'use strict';var moment=require(_0xf96a('0x0'));var Sequelize=require(_0xf96a('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xf96a('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xf96a('0x3'))},'countbusyretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf96a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 2113a21..5da82ba 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 _0xe225=['end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','VIRTUAL','merge','where','CmHopperAdditionalPhone','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','get','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x6dcba,_0x1335a0){var _0x386f3c=function(_0xb5d73a){while(--_0xb5d73a){_0x6dcba['push'](_0x6dcba['shift']());}};_0x386f3c(++_0x1335a0);}(_0xe225,0x1bd));var _0x5e22=function(_0x1f047e,_0x23b312){_0x1f047e=_0x1f047e-0x0;var _0x206db5=_0xe225[_0x1f047e];return _0x206db5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5e22('0x0'));var rimraf=require(_0x5e22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e22('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5e22('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5e22('0x4'));var ejs=require(_0x5e22('0x5'));var fs=require('fs');var _=require(_0x5e22('0x6'));var squel=require(_0x5e22('0x7'));var crypto=require(_0x5e22('0x8'));var jsforce=require(_0x5e22('0x9'));var deskjs=require(_0x5e22('0xa'));var toCsv=require(_0x5e22('0x4'));var querystring=require(_0x5e22('0xb'));var Papa=require(_0x5e22('0xc'));var Redis=require(_0x5e22('0xd'));var authService=require(_0x5e22('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5e22('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e22('0x10'))(_0x5e22('0x11'));var utils=require(_0x5e22('0x12'));var config=require(_0x5e22('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e22('0x14'))['db'];function respondWithStatusCode(_0x5e8b51,_0x3f96be){_0x3f96be=_0x3f96be||0xcc;return function(_0x3dd24c){if(_0x3dd24c){return _0x5e8b51[_0x5e22('0x15')](_0x3f96be);}return _0x5e8b51[_0x5e22('0x16')](_0x3f96be)[_0x5e22('0x17')]();};}function respondWithResult(_0x598d29,_0x1eb276){_0x1eb276=_0x1eb276||0xc8;return function(_0x4795ae){if(_0x4795ae){return _0x598d29[_0x5e22('0x16')](_0x1eb276)[_0x5e22('0x18')](_0x4795ae);}};}function respondWithFilteredResult(_0x1e9eff,_0xbae23a){return function(_0x34de3d){if(_0x34de3d){var _0x32bce1=_0x34de3d[_0x5e22('0x19')],_0x11b0cf=_0xbae23a[_0x5e22('0x1a')],_0x3fa607=_0xbae23a['offset']+_0xbae23a['limit'],_0x3de7c2;if(_0x3fa607>=_0x32bce1){_0x3fa607=_0x32bce1;_0x3de7c2=0xc8;}else{_0x3de7c2=0xce;}_0x1e9eff[_0x5e22('0x16')](_0x3de7c2);return _0x1e9eff['set'](_0x5e22('0x1b'),_0x11b0cf+'-'+_0x3fa607+'/'+_0x32bce1)[_0x5e22('0x18')](_0x34de3d);}return null;};}function patchUpdates(_0x823f3a){return function(_0xe3ed1e){try{jsonpatch[_0x5e22('0x1c')](_0xe3ed1e,_0x823f3a,!![]);}catch(_0x1de5a2){return BPromise[_0x5e22('0x1d')](_0x1de5a2);}return _0xe3ed1e[_0x5e22('0x1e')]();};}function saveUpdates(_0x280988,_0x26509c){return function(_0x4a54a4){if(_0x4a54a4){return _0x4a54a4[_0x5e22('0x1f')](_0x280988)[_0x5e22('0x20')](function(_0xf6515a){return _0xf6515a;});}return null;};}function removeEntity(_0x303f19,_0x1b5d41){return function(_0x310978){if(_0x310978){return _0x310978[_0x5e22('0x21')]()[_0x5e22('0x20')](function(){var _0x29f733=_0x310978['get']({'plain':!![]});var _0x2a5411='CmHopperAdditionalPhones';return db[_0x5e22('0x22')][_0x5e22('0x21')]({'where':{'type':_0x2a5411,'resourceId':_0x29f733['id']}})[_0x5e22('0x20')](function(){return _0x310978;});})[_0x5e22('0x20')](function(){_0x303f19[_0x5e22('0x16')](0xcc)[_0x5e22('0x17')]();});}};}function handleEntityNotFound(_0x482825,_0x41b396){return function(_0x8c7950){if(!_0x8c7950){_0x482825[_0x5e22('0x15')](0x194);}return _0x8c7950;};}function handleError(_0xf7c5e6,_0x10c67c){_0x10c67c=_0x10c67c||0x1f4;return function(_0x3ba9db){logger[_0x5e22('0x23')](_0x3ba9db['stack']);if(_0x3ba9db['name']){delete _0x3ba9db[_0x5e22('0x24')];}_0xf7c5e6[_0x5e22('0x16')](_0x10c67c)[_0x5e22('0x25')](_0x3ba9db);};}exports['index']=function(_0x1a0bb7,_0x5a4ad1){var _0x50d048={},_0x3bd85d={},_0x12dfcf={'count':0x0,'rows':[]};var _0x5e4bb9=_[_0x5e22('0x26')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x490597){return{'name':_0x490597[_0x5e22('0x27')],'type':_0x490597[_0x5e22('0x28')][_0x5e22('0x29')]};});_0x3bd85d['model']=_[_0x5e22('0x26')](_0x5e4bb9,_0x5e22('0x24'));_0x3bd85d[_0x5e22('0x2a')]=_[_0x5e22('0x2b')](_0x1a0bb7[_0x5e22('0x2a')]);_0x3bd85d[_0x5e22('0x2c')]=_[_0x5e22('0x2d')](_0x3bd85d['model'],_0x3bd85d[_0x5e22('0x2a')]);_0x50d048[_0x5e22('0x2e')]=_[_0x5e22('0x2d')](_0x3bd85d[_0x5e22('0x2f')],qs[_0x5e22('0x30')](_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x30')]));_0x50d048[_0x5e22('0x2e')]=_0x50d048[_0x5e22('0x2e')]['length']?_0x50d048[_0x5e22('0x2e')]:_0x3bd85d[_0x5e22('0x2f')];if(!_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x31')](_0x5e22('0x32'))){_0x50d048[_0x5e22('0x33')]=qs[_0x5e22('0x33')](_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x33')]);_0x50d048['offset']=qs[_0x5e22('0x1a')](_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x1a')]);}_0x50d048['order']=qs[_0x5e22('0x34')](_0x1a0bb7[_0x5e22('0x2a')]['sort']);_0x50d048['where']=qs[_0x5e22('0x2c')](_[_0x5e22('0x35')](_0x1a0bb7[_0x5e22('0x2a')],_0x3bd85d[_0x5e22('0x2c')]),_0x5e4bb9);if(_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x36')]){_0x50d048['where']=_['merge'](_0x50d048['where'],{'$or':_[_0x5e22('0x26')](_0x5e4bb9,function(_0x5a3a3c){if(_0x5a3a3c[_0x5e22('0x28')]!==_0x5e22('0x37')){var _0x5b8b5c={};_0x5b8b5c[_0x5a3a3c[_0x5e22('0x24')]]={'$like':'%'+_0x1a0bb7['query'][_0x5e22('0x36')]+'%'};return _0x5b8b5c;}})});}_0x50d048=_[_0x5e22('0x38')]({},_0x50d048,_0x1a0bb7['options']);var _0x352f77={'where':_0x50d048[_0x5e22('0x39')]};return db[_0x5e22('0x3a')][_0x5e22('0x19')](_0x352f77)['then'](function(_0x58d289){_0x12dfcf[_0x5e22('0x19')]=_0x58d289;if(_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x3b')]){_0x50d048['include']=[{'all':!![]}];}return db[_0x5e22('0x3a')][_0x5e22('0x3c')](_0x50d048);})['then'](function(_0x49616a){_0x12dfcf[_0x5e22('0x3d')]=_0x49616a;return _0x12dfcf;})[_0x5e22('0x20')](respondWithFilteredResult(_0x5a4ad1,_0x50d048))[_0x5e22('0x3e')](handleError(_0x5a4ad1,null));};exports[_0x5e22('0x3f')]=function(_0x536d73,_0x59c399){var _0x25278a={'raw':!![],'where':{'id':_0x536d73[_0x5e22('0x40')]['id']}},_0x1beb82={};_0x1beb82['model']=_[_0x5e22('0x2b')](db[_0x5e22('0x3a')][_0x5e22('0x41')]);_0x1beb82[_0x5e22('0x2a')]=_['keys'](_0x536d73[_0x5e22('0x2a')]);_0x1beb82[_0x5e22('0x2c')]=_['intersection'](_0x1beb82['model'],_0x1beb82[_0x5e22('0x2a')]);_0x25278a['attributes']=_[_0x5e22('0x2d')](_0x1beb82['model'],qs[_0x5e22('0x30')](_0x536d73[_0x5e22('0x2a')][_0x5e22('0x30')]));_0x25278a['attributes']=_0x25278a[_0x5e22('0x2e')]['length']?_0x25278a[_0x5e22('0x2e')]:_0x1beb82[_0x5e22('0x2f')];if(_0x536d73['query']['includeAll']){_0x25278a[_0x5e22('0x42')]=[{'all':!![]}];}_0x25278a=_[_0x5e22('0x38')]({},_0x25278a,_0x536d73[_0x5e22('0x43')]);return db['CmHopperAdditionalPhone'][_0x5e22('0x44')](_0x25278a)[_0x5e22('0x20')](handleEntityNotFound(_0x59c399,null))[_0x5e22('0x20')](respondWithResult(_0x59c399,null))[_0x5e22('0x3e')](handleError(_0x59c399,null));};exports[_0x5e22('0x45')]=function(_0xe8ffa,_0x329a17){return db['CmHopperAdditionalPhone'][_0x5e22('0x45')](_0xe8ffa[_0x5e22('0x46')],{})['then'](function(_0x3cb7de){var _0x5e7a90=_0xe8ffa[_0x5e22('0x47')][_0x5e22('0x48')]({'plain':!![]});if(!_0x5e7a90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e7a90[_0x5e22('0x49')]===_0x5e22('0x47')){var _0x1fd024=_0x3cb7de[_0x5e22('0x48')]({'plain':!![]});var _0x2d00fd=_0x5e22('0x4a');return db[_0x5e22('0x4b')][_0x5e22('0x44')]({'where':{'name':_0x2d00fd,'userProfileId':_0x5e7a90[_0x5e22('0x4c')]},'raw':!![]})[_0x5e22('0x20')](function(_0x57b3fa){if(_0x57b3fa&&_0x57b3fa[_0x5e22('0x4d')]===0x0){return db[_0x5e22('0x22')][_0x5e22('0x45')]({'name':_0x1fd024[_0x5e22('0x24')],'resourceId':_0x1fd024['id'],'type':_0x57b3fa[_0x5e22('0x24')],'sectionId':_0x57b3fa['id']},{})['then'](function(){return _0x3cb7de;});}else{return _0x3cb7de;}})[_0x5e22('0x3e')](function(_0x16c8b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16c8b3);throw _0x16c8b3;});}return _0x3cb7de;})[_0x5e22('0x20')](respondWithResult(_0x329a17,0xc9))[_0x5e22('0x3e')](handleError(_0x329a17,null));};exports[_0x5e22('0x1f')]=function(_0x4d10d0,_0x44aab7){if(_0x4d10d0[_0x5e22('0x46')]['id']){delete _0x4d10d0[_0x5e22('0x46')]['id'];}return db[_0x5e22('0x3a')][_0x5e22('0x44')]({'where':{'id':_0x4d10d0[_0x5e22('0x40')]['id']}})['then'](handleEntityNotFound(_0x44aab7,null))[_0x5e22('0x20')](saveUpdates(_0x4d10d0[_0x5e22('0x46')],null))['then'](respondWithResult(_0x44aab7,null))['catch'](handleError(_0x44aab7,null));};exports[_0x5e22('0x21')]=function(_0x1aeb34,_0x428c97){return db[_0x5e22('0x3a')]['find']({'where':{'id':_0x1aeb34[_0x5e22('0x40')]['id']}})['then'](handleEntityNotFound(_0x428c97,null))[_0x5e22('0x20')](removeEntity(_0x428c97,null))[_0x5e22('0x3e')](handleError(_0x428c97,null));}; \ No newline at end of file +var _0x9aac=['ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','get','CmHopperAdditionalPhones','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','rows','show','params','includeAll','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x52e795,_0x49ffc4){var _0x4baca=function(_0x3b5bd5){while(--_0x3b5bd5){_0x52e795['push'](_0x52e795['shift']());}};_0x4baca(++_0x49ffc4);}(_0x9aac,0x135));var _0xc9aa=function(_0xfaf211,_0xa2b41a){_0xfaf211=_0xfaf211-0x0;var _0x31a98b=_0x9aac[_0xfaf211];return _0x31a98b;};'use strict';var pdf=require(_0xc9aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc9aa('0x1'));var zipdir=require(_0xc9aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9aa('0x3'));var moment=require('moment');var BPromise=require(_0xc9aa('0x4'));var Mustache=require('mustache');var util=require(_0xc9aa('0x5'));var path=require(_0xc9aa('0x6'));var sox=require('sox');var csv=require(_0xc9aa('0x7'));var ejs=require(_0xc9aa('0x8'));var fs=require('fs');var _=require(_0xc9aa('0x9'));var squel=require('squel');var crypto=require(_0xc9aa('0xa'));var jsforce=require(_0xc9aa('0xb'));var deskjs=require(_0xc9aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc9aa('0xd'));var Papa=require(_0xc9aa('0xe'));var Redis=require(_0xc9aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9aa('0x11'))(_0xc9aa('0x12'));var utils=require(_0xc9aa('0x13'));var config=require(_0xc9aa('0x14'));var licenseUtil=require(_0xc9aa('0x15'));var db=require(_0xc9aa('0x16'))['db'];function respondWithStatusCode(_0x21e9c3,_0x2b38da){_0x2b38da=_0x2b38da||0xcc;return function(_0xfc9acd){if(_0xfc9acd){return _0x21e9c3[_0xc9aa('0x17')](_0x2b38da);}return _0x21e9c3[_0xc9aa('0x18')](_0x2b38da)[_0xc9aa('0x19')]();};}function respondWithResult(_0x39331d,_0x406422){_0x406422=_0x406422||0xc8;return function(_0x2b5708){if(_0x2b5708){return _0x39331d[_0xc9aa('0x18')](_0x406422)[_0xc9aa('0x1a')](_0x2b5708);}};}function respondWithFilteredResult(_0x53834b,_0x129cc1){return function(_0x4ed0c1){if(_0x4ed0c1){var _0x5b351f=_0x4ed0c1[_0xc9aa('0x1b')],_0x477ca5=_0x129cc1['offset'],_0x553805=_0x129cc1[_0xc9aa('0x1c')]+_0x129cc1[_0xc9aa('0x1d')],_0x13ed6c;if(_0x553805>=_0x5b351f){_0x553805=_0x5b351f;_0x13ed6c=0xc8;}else{_0x13ed6c=0xce;}_0x53834b[_0xc9aa('0x18')](_0x13ed6c);return _0x53834b['set'](_0xc9aa('0x1e'),_0x477ca5+'-'+_0x553805+'/'+_0x5b351f)[_0xc9aa('0x1a')](_0x4ed0c1);}return null;};}function patchUpdates(_0x2f29e2){return function(_0x22ad7f){try{jsonpatch[_0xc9aa('0x1f')](_0x22ad7f,_0x2f29e2,!![]);}catch(_0x25be52){return BPromise['reject'](_0x25be52);}return _0x22ad7f[_0xc9aa('0x20')]();};}function saveUpdates(_0x55037f,_0x2c634a){return function(_0x5b5ffc){if(_0x5b5ffc){return _0x5b5ffc[_0xc9aa('0x21')](_0x55037f)['then'](function(_0x15da53){return _0x15da53;});}return null;};}function removeEntity(_0x3f8bfd,_0x214c09){return function(_0x465f52){if(_0x465f52){return _0x465f52['destroy']()[_0xc9aa('0x22')](function(){var _0x122d0c=_0x465f52[_0xc9aa('0x23')]({'plain':!![]});var _0x1b4246=_0xc9aa('0x24');return db['UserProfileResource'][_0xc9aa('0x25')]({'where':{'type':_0x1b4246,'resourceId':_0x122d0c['id']}})[_0xc9aa('0x22')](function(){return _0x465f52;});})[_0xc9aa('0x22')](function(){_0x3f8bfd[_0xc9aa('0x18')](0xcc)[_0xc9aa('0x19')]();});}};}function handleEntityNotFound(_0x13cb3f,_0xee06f1){return function(_0x4dab46){if(!_0x4dab46){_0x13cb3f[_0xc9aa('0x17')](0x194);}return _0x4dab46;};}function handleError(_0x40e628,_0x557b18){_0x557b18=_0x557b18||0x1f4;return function(_0x48c5df){logger[_0xc9aa('0x26')](_0x48c5df[_0xc9aa('0x27')]);if(_0x48c5df[_0xc9aa('0x28')]){delete _0x48c5df[_0xc9aa('0x28')];}_0x40e628[_0xc9aa('0x18')](_0x557b18)[_0xc9aa('0x29')](_0x48c5df);};}exports[_0xc9aa('0x2a')]=function(_0x5865b5,_0x1d1215){var _0x3446aa={},_0x25d3e5={},_0x1bfb09={'count':0x0,'rows':[]};var _0x2934be=_[_0xc9aa('0x2b')](db[_0xc9aa('0x2c')]['rawAttributes'],function(_0x16b293){return{'name':_0x16b293[_0xc9aa('0x2d')],'type':_0x16b293[_0xc9aa('0x2e')][_0xc9aa('0x2f')]};});_0x25d3e5[_0xc9aa('0x30')]=_[_0xc9aa('0x2b')](_0x2934be,_0xc9aa('0x28'));_0x25d3e5[_0xc9aa('0x31')]=_[_0xc9aa('0x32')](_0x5865b5[_0xc9aa('0x31')]);_0x25d3e5[_0xc9aa('0x33')]=_['intersection'](_0x25d3e5['model'],_0x25d3e5[_0xc9aa('0x31')]);_0x3446aa['attributes']=_[_0xc9aa('0x34')](_0x25d3e5[_0xc9aa('0x30')],qs[_0xc9aa('0x35')](_0x5865b5['query'][_0xc9aa('0x35')]));_0x3446aa[_0xc9aa('0x36')]=_0x3446aa['attributes'][_0xc9aa('0x37')]?_0x3446aa[_0xc9aa('0x36')]:_0x25d3e5['model'];if(!_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x38')](_0xc9aa('0x39'))){_0x3446aa[_0xc9aa('0x1d')]=qs['limit'](_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x1d')]);_0x3446aa['offset']=qs[_0xc9aa('0x1c')](_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x1c')]);}_0x3446aa[_0xc9aa('0x3a')]=qs[_0xc9aa('0x3b')](_0x5865b5[_0xc9aa('0x31')]['sort']);_0x3446aa['where']=qs[_0xc9aa('0x33')](_[_0xc9aa('0x3c')](_0x5865b5[_0xc9aa('0x31')],_0x25d3e5[_0xc9aa('0x33')]),_0x2934be);if(_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x3d')]){_0x3446aa[_0xc9aa('0x3e')]=_['merge'](_0x3446aa[_0xc9aa('0x3e')],{'$or':_[_0xc9aa('0x2b')](_0x2934be,function(_0x213e45){if(_0x213e45[_0xc9aa('0x2e')]!=='VIRTUAL'){var _0x5b91cf={};_0x5b91cf[_0x213e45['name']]={'$like':'%'+_0x5865b5[_0xc9aa('0x31')][_0xc9aa('0x3d')]+'%'};return _0x5b91cf;}})});}_0x3446aa=_[_0xc9aa('0x3f')]({},_0x3446aa,_0x5865b5[_0xc9aa('0x40')]);var _0x14f27e={'where':_0x3446aa[_0xc9aa('0x3e')]};return db[_0xc9aa('0x2c')]['count'](_0x14f27e)[_0xc9aa('0x22')](function(_0x2bf707){_0x1bfb09[_0xc9aa('0x1b')]=_0x2bf707;if(_0x5865b5[_0xc9aa('0x31')]['includeAll']){_0x3446aa['include']=[{'all':!![]}];}return db[_0xc9aa('0x2c')]['findAll'](_0x3446aa);})[_0xc9aa('0x22')](function(_0x3581ae){_0x1bfb09[_0xc9aa('0x41')]=_0x3581ae;return _0x1bfb09;})[_0xc9aa('0x22')](respondWithFilteredResult(_0x1d1215,_0x3446aa))['catch'](handleError(_0x1d1215,null));};exports[_0xc9aa('0x42')]=function(_0x59006b,_0x2990f0){var _0x4692e3={'raw':!![],'where':{'id':_0x59006b[_0xc9aa('0x43')]['id']}},_0x407d74={};_0x407d74[_0xc9aa('0x30')]=_['keys'](db[_0xc9aa('0x2c')]['rawAttributes']);_0x407d74[_0xc9aa('0x31')]=_[_0xc9aa('0x32')](_0x59006b[_0xc9aa('0x31')]);_0x407d74[_0xc9aa('0x33')]=_[_0xc9aa('0x34')](_0x407d74[_0xc9aa('0x30')],_0x407d74[_0xc9aa('0x31')]);_0x4692e3['attributes']=_['intersection'](_0x407d74[_0xc9aa('0x30')],qs['fields'](_0x59006b[_0xc9aa('0x31')]['fields']));_0x4692e3[_0xc9aa('0x36')]=_0x4692e3[_0xc9aa('0x36')][_0xc9aa('0x37')]?_0x4692e3[_0xc9aa('0x36')]:_0x407d74[_0xc9aa('0x30')];if(_0x59006b[_0xc9aa('0x31')][_0xc9aa('0x44')]){_0x4692e3[_0xc9aa('0x45')]=[{'all':!![]}];}_0x4692e3=_[_0xc9aa('0x3f')]({},_0x4692e3,_0x59006b[_0xc9aa('0x40')]);return db[_0xc9aa('0x2c')][_0xc9aa('0x46')](_0x4692e3)['then'](handleEntityNotFound(_0x2990f0,null))[_0xc9aa('0x22')](respondWithResult(_0x2990f0,null))[_0xc9aa('0x47')](handleError(_0x2990f0,null));};exports[_0xc9aa('0x48')]=function(_0x505f37,_0x503730){return db['CmHopperAdditionalPhone']['create'](_0x505f37['body'],{})['then'](function(_0x53f5f1){var _0x44c5db=_0x505f37[_0xc9aa('0x49')][_0xc9aa('0x23')]({'plain':!![]});if(!_0x44c5db)throw new Error(_0xc9aa('0x4a'));if(_0x44c5db[_0xc9aa('0x4b')]===_0xc9aa('0x49')){var _0x4324d2=_0x53f5f1[_0xc9aa('0x23')]({'plain':!![]});var _0x4b8173=_0xc9aa('0x24');return db[_0xc9aa('0x4c')][_0xc9aa('0x46')]({'where':{'name':_0x4b8173,'userProfileId':_0x44c5db['userProfileId']},'raw':!![]})[_0xc9aa('0x22')](function(_0x2965ae){if(_0x2965ae&&_0x2965ae[_0xc9aa('0x4d')]===0x0){return db[_0xc9aa('0x4e')]['create']({'name':_0x4324d2['name'],'resourceId':_0x4324d2['id'],'type':_0x2965ae[_0xc9aa('0x28')],'sectionId':_0x2965ae['id']},{})[_0xc9aa('0x22')](function(){return _0x53f5f1;});}else{return _0x53f5f1;}})[_0xc9aa('0x47')](function(_0x1c78cb){logger[_0xc9aa('0x26')](_0xc9aa('0x4f'),_0x1c78cb);throw _0x1c78cb;});}return _0x53f5f1;})[_0xc9aa('0x22')](respondWithResult(_0x503730,0xc9))['catch'](handleError(_0x503730,null));};exports['update']=function(_0x15f8ce,_0x4ed597){if(_0x15f8ce[_0xc9aa('0x50')]['id']){delete _0x15f8ce[_0xc9aa('0x50')]['id'];}return db[_0xc9aa('0x2c')][_0xc9aa('0x46')]({'where':{'id':_0x15f8ce['params']['id']}})['then'](handleEntityNotFound(_0x4ed597,null))[_0xc9aa('0x22')](saveUpdates(_0x15f8ce[_0xc9aa('0x50')],null))['then'](respondWithResult(_0x4ed597,null))[_0xc9aa('0x47')](handleError(_0x4ed597,null));};exports[_0xc9aa('0x25')]=function(_0x14170d,_0x3c995b){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x14170d[_0xc9aa('0x43')]['id']}})[_0xc9aa('0x22')](handleEntityNotFound(_0x3c995b,null))[_0xc9aa('0x22')](removeEntity(_0x3c995b,null))[_0xc9aa('0x47')](handleError(_0x3c995b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d11f96a..17e547f 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 _0xe778=['path','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0xe778,0x171));var _0x8e77=function(_0x3c2749,_0x5a0fd3){_0x3c2749=_0x3c2749-0x0;var _0x3fe1eb=_0xe778[_0x3c2749];return _0x3fe1eb;};'use strict';var _=require('lodash');var util=require(_0x8e77('0x0'));var logger=require(_0x8e77('0x1'))('api');var moment=require(_0x8e77('0x2'));var BPromise=require(_0x8e77('0x3'));var rp=require(_0x8e77('0x4'));var fs=require('fs');var path=require(_0x8e77('0x5'));var rimraf=require(_0x8e77('0x6'));var config=require(_0x8e77('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x8e77('0x8')]=function(_0x144eae,_0x24f123){return _0x144eae['define'](_0x8e77('0x9'),attributes,{'tableName':_0x8e77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd54e=['./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd54e,0x161));var _0xed54=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd54e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xed54('0x0'));var util=require('util');var logger=require(_0xed54('0x1'))(_0xed54('0x2'));var moment=require(_0xed54('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xed54('0x4'));var rimraf=require(_0xed54('0x5'));var config=require(_0xed54('0x6'));var attributes=require(_0xed54('0x7'));module['exports']=function(_0x120a87,_0x45a4fe){return _0x120a87[_0xed54('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xed54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index b4aafc6..760c526 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 _0x11a1=['countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','OrderBy','ASC','countbusyretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','add','scheduledat','minutes','countnoanswerretry','countagentrejectretry','createdAt','updatedAt','phone','isNil','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','moment','../../config/utils','rpc','../../config/environment','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x11a1,0x196));var _0x111a=function(_0x312200,_0x49f7c1){_0x312200=_0x312200-0x0;var _0x3abf41=_0x11a1[_0x312200];return _0x3abf41;};'use strict';var _=require(_0x111a('0x0'));var util=require('util');var moment=require(_0x111a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x111a('0x2'));var logger=require('../../config/logger')(_0x111a('0x3'));var config=require(_0x111a('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x111a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3f5abb,_0x3209c4,_0x3b57ff){return new BPromise(function(_0x221a8a,_0x252bc6){return client[_0x111a('0x6')](_0x3f5abb,_0x3b57ff)[_0x111a('0x7')](function(_0x10dad8){logger[_0x111a('0x8')](_0x111a('0x9'),_0x3209c4,_0x111a('0xa'));logger[_0x111a('0xb')](_0x111a('0xc'),_0x3209c4,_0x111a('0xa'),JSON[_0x111a('0xd')](_0x10dad8));if(_0x10dad8[_0x111a('0xe')]){if(_0x10dad8[_0x111a('0xe')][_0x111a('0xf')]===0x1f4){logger[_0x111a('0xe')](_0x111a('0x9'),_0x3209c4,_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);return _0x252bc6(_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);}logger[_0x111a('0xe')](_0x111a('0x9'),_0x3209c4,_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);return _0x221a8a(_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);}else{logger[_0x111a('0x8')](_0x111a('0x9'),_0x3209c4,_0x111a('0xa'));_0x221a8a(_0x10dad8[_0x111a('0x11')][_0x111a('0x10')]);}})[_0x111a('0x12')](function(_0x164a80){logger['error'](_0x111a('0x9'),_0x3209c4,_0x164a80);_0x252bc6(_0x164a80);});});}exports['VerifyAdditionalPhones']=function(_0x312347){var _0x5d413f=this;return new Promise(function(_0x2e005f,_0x4680eb){return db[_0x111a('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x312347[_0x111a('0x14')][_0x111a('0x15')],'ListId':_0x312347['body']['ListId'],'VoiceQueueId':_0x312347[_0x111a('0x14')]['VoiceQueueId']===undefined?null:_0x312347['body'][_0x111a('0x16')],'CampaignId':_0x312347[_0x111a('0x14')][_0x111a('0x17')]===undefined?null:_0x312347[_0x111a('0x14')][_0x111a('0x17')]}})[_0x111a('0x7')](function(_0x54fa62){if(_0x54fa62!=null){return db[_0x111a('0x18')][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x54fa62['id'],'OrderBy':{'$gt':_0x54fa62['OrderBy']}},'order':[['OrderBy','ASC']]})[_0x111a('0x7')](function(_0x57acf8){var _0x45d460=0x0;if(_0x57acf8){if(_0x57acf8['countbusyretry']+_0x57acf8[_0x111a('0x1a')]+_0x57acf8['countnoanswerretry']+_0x57acf8[_0x111a('0x1b')]+_0x57acf8[_0x111a('0x1c')]+_0x57acf8[_0x111a('0x1d')]+_0x57acf8[_0x111a('0x1e')]+_0x57acf8['countagentrejectretry']<_0x312347['entity'][_0x111a('0x1f')])_0x45d460=0x1;_0x2e005f({'additional':_0x45d460});}else{return db[_0x111a('0x18')][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x54fa62['id']},'order':[[_0x111a('0x20'),_0x111a('0x21')]]})['then'](function(_0x264d1f){var _0x547083=0x0;if(_0x264d1f){if(_0x264d1f[_0x111a('0x22')]+_0x264d1f[_0x111a('0x1a')]+_0x264d1f['countnoanswerretry']+_0x264d1f[_0x111a('0x1b')]+_0x264d1f[_0x111a('0x1c')]+_0x264d1f[_0x111a('0x1d')]+_0x264d1f[_0x111a('0x1e')]+_0x264d1f['countagentrejectretry']<_0x312347[_0x111a('0x23')][_0x111a('0x1f')])_0x547083=0x1;_0x2e005f({'additional':_0x547083});}else{_0x2e005f({'additional':0x0});}})[_0x111a('0x12')](function(_0xc6aff2){logger[_0x111a('0xe')](_0x111a('0x24'),_0xc6aff2[_0x111a('0x10')],_0x312347);_0x4680eb(_0x5d413f[_0x111a('0xe')](0x1f4,_0xc6aff2[_0x111a('0x10')]));});}})['catch'](function(_0x4933be){logger['error'](_0x111a('0x24'),_0x4933be[_0x111a('0x10')],_0x312347);_0x4680eb(_0x5d413f[_0x111a('0xe')](0x1f4,_0x4933be[_0x111a('0x10')]));});}else _0x2e005f({'additional':0x0});});});};exports[_0x111a('0x25')]=function(_0x6f1d50){var _0x8b9cd6=this;return new Promise(function(_0x3f98d1,_0x7c0946){return db[_0x111a('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x6f1d50[_0x111a('0x14')]['ContactId'],'ListId':_0x6f1d50[_0x111a('0x14')]['ListId'],'VoiceQueueId':_0x6f1d50['body'][_0x111a('0x16')]===undefined?null:_0x6f1d50[_0x111a('0x14')]['VoiceQueueId'],'CampaignId':_0x6f1d50[_0x111a('0x14')]['CampaignId']===undefined?null:_0x6f1d50[_0x111a('0x14')][_0x111a('0x17')]}})['then'](function(_0x515ad3){if(_0x515ad3!=null){return db['CmHopperAdditionalPhone'][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x515ad3['id'],'OrderBy':{'$gt':_0x515ad3[_0x111a('0x20')]}},'order':[[_0x111a('0x20'),_0x111a('0x21')]]})['then'](function(_0x1485a3){if(_0x1485a3)return activateAdditionalPhone(_0x515ad3,_0x6f1d50['body'],_0x1485a3,_0x6f1d50[_0x111a('0x26')],_0x6f1d50[_0x111a('0x27')])[_0x111a('0x7')](function(_0x49fa59){_0x3f98d1(_0x49fa59);});else{return db[_0x111a('0x18')][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x515ad3['id']},'order':[[_0x111a('0x20'),_0x111a('0x21')]]})[_0x111a('0x7')](function(_0x5c6005){if(_0x5c6005)return activateAdditionalPhone(_0x515ad3,_0x6f1d50[_0x111a('0x14')],_0x5c6005,_0x6f1d50['duration'],_0x6f1d50['waitTime'])[_0x111a('0x7')](function(_0xe7c117){_0x3f98d1(_0xe7c117);});else{_0x3f98d1({'id':_0x515ad3['id'],'phone':''});}})['catch'](function(_0x3a8ed7){logger[_0x111a('0xe')](_0x111a('0x24'),_0x3a8ed7['message'],_0x6f1d50);_0x7c0946(_0x8b9cd6[_0x111a('0xe')](0x1f4,_0x3a8ed7[_0x111a('0x10')]));});}})[_0x111a('0x12')](function(_0x43cab8){logger[_0x111a('0xe')]('VerifyAdditionalPhones',_0x43cab8[_0x111a('0x10')],_0x6f1d50);_0x7c0946(_0x8b9cd6[_0x111a('0xe')](0x1f4,_0x43cab8[_0x111a('0x10')]));});}else _0x3f98d1(0x1);});});};function activateAdditionalPhone(_0x30df52,_0x180b96,_0x2f1f7f,_0x1c037a,_0x23fa02){return new Promise(function(_0x23b915,_0x1e4b6b){logger[_0x111a('0x8')](_0x111a('0x24'),_0x2f1f7f);var _0x1ca6e1;if(moment()>moment(_0x2f1f7f['scheduledat'])){_0x1ca6e1=moment()[_0x111a('0x28')](_0x23fa02||0x3,'minutes');}else{if(_0x2f1f7f[_0x111a('0x20')]==0x0){_0x1ca6e1=moment(_0x2f1f7f[_0x111a('0x29')]);}else{_0x1ca6e1=moment()[_0x111a('0x28')](_0x23fa02||0x3,_0x111a('0x2a'));}}var _0xf6699f={'phone':_0x30df52['phone'],'active':0x0,'OrderBy':_['isNil'](_0x30df52[_0x111a('0x20')])?0x0:_0x30df52[_0x111a('0x20')],'scheduledat':moment()['add'](_0x1c037a||0x1,'minutes'),'countbusyretry':_0x180b96[_0x111a('0x22')],'countcongestionretry':_0x180b96[_0x111a('0x1a')],'countnoanswerretry':_0x180b96[_0x111a('0x2b')],'countnosuchnumberretry':_0x180b96[_0x111a('0x1b')],'countdropretry':_0x180b96[_0x111a('0x1c')],'countabandonedretry':_0x180b96[_0x111a('0x1d')],'countmachineretry':_0x180b96[_0x111a('0x1e')],'countagentrejectretry':_0x180b96[_0x111a('0x2c')],'createdAt':_0x180b96[_0x111a('0x2d')],'updatedAt':_0x180b96[_0x111a('0x2e')]};var _0x4244e7={'CmHopperId':_0x30df52['id'],'phone':_0x2f1f7f[_0x111a('0x2f')],'active':0x0,'OrderBy':_[_0x111a('0x30')](_0x2f1f7f[_0x111a('0x20')])?0x0:_0x2f1f7f[_0x111a('0x20')],'scheduledat':_0x1ca6e1,'countbusyretry':_0x2f1f7f[_0x111a('0x22')],'countcongestionretry':_0x2f1f7f['countcongestionretry'],'countnoanswerretry':_0x2f1f7f['countnoanswerretry'],'countnosuchnumberretry':_0x180b96[_0x111a('0x1b')],'countdropretry':_0x180b96['countdropretry'],'countabandonedretry':_0x180b96[_0x111a('0x1d')],'countmachineretry':_0x180b96[_0x111a('0x1e')],'countagentrejectretry':_0x180b96[_0x111a('0x2c')],'createdAt':_0x2f1f7f[_0x111a('0x2d')],'updatedAt':_0x2f1f7f[_0x111a('0x2e')]};logger[_0x111a('0x8')]('hopperToAdd',_0xf6699f);logger['info']('additionalToHop',_0x4244e7);return db[_0x111a('0x31')][_0x111a('0x32')](function(_0x4ad93e){return db[_0x111a('0x18')][_0x111a('0x33')](_0xf6699f,{'where':{'id':_0x2f1f7f['id']}},{'transaction':_0x4ad93e})[_0x111a('0x7')](function(){return db[_0x111a('0x13')]['update'](_0x4244e7,{'where':{'id':_0x30df52['id']}},{'transaction':_0x4ad93e});});})[_0x111a('0x7')](function(_0x5b2bf4){_0x23b915({'id':_0x30df52['id'],'phone':_0x2f1f7f[_0x111a('0x2f')]});})[_0x111a('0x12')](function(_0x47555a){logger[_0x111a('0xe')](_0x111a('0x24'),_0x47555a[_0x111a('0x10')],req);_0x1e4b6b(_this[_0x111a('0xe')](0x1f4,_0x47555a[_0x111a('0x10')]));});});}exports[_0x111a('0x34')]=function(_0x395815){var _0x361fe7=this;return new Promise(function(_0x2192b1,_0x57ad10){return db[_0x111a('0x13')][_0x111a('0x33')](_0x395815[_0x111a('0x14')][_0x111a('0x35')],{'where':{'id':_0x395815[_0x111a('0x14')]['id']}})[_0x111a('0x7')](function(_0x14895c){_0x2192b1(_0x14895c);})[_0x111a('0x12')](function(_0x45a3cf){logger[_0x111a('0xe')]('IncrementPreviewCounters',_0x45a3cf[_0x111a('0x10')],_0x395815);_0x57ad10(_0x361fe7[_0x111a('0xe')](0x1f4,_0x45a3cf[_0x111a('0x10')]));});});}; \ No newline at end of file +var _0x49a8=['result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countmachineretry','countagentrejectretry','SwapAdditionalPhones','waitTime','add','minutes','scheduledat','phone','isNil','countdropretry','createdAt','hopperToAdd','additionalToHop','sequelize','transaction','update','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x28ba30,_0x12c005){var _0x281812=function(_0x12702e){while(--_0x12702e){_0x28ba30['push'](_0x28ba30['shift']());}};_0x281812(++_0x12c005);}(_0x49a8,0xfb));var _0x849a=function(_0x5a1ef6,_0x369ee4){_0x5a1ef6=_0x5a1ef6-0x0;var _0x2af4d9=_0x49a8[_0x5a1ef6];return _0x2af4d9;};'use strict';var _=require(_0x849a('0x0'));var util=require(_0x849a('0x1'));var moment=require('moment');var BPromise=require(_0x849a('0x2'));var rs=require(_0x849a('0x3'));var fs=require('fs');var Redis=require(_0x849a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x849a('0x5'));var logger=require(_0x849a('0x6'))('rpc');var config=require(_0x849a('0x7'));var jayson=require(_0x849a('0x8'));var client=jayson['client'][_0x849a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6be379,_0x2c3793,_0x559966){return new BPromise(function(_0x42082d,_0x48f972){return client[_0x849a('0xa')](_0x6be379,_0x559966)[_0x849a('0xb')](function(_0x4d3cc7){logger['info'](_0x849a('0xc'),_0x2c3793,_0x849a('0xd'));logger[_0x849a('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x2c3793,_0x849a('0xd'),JSON[_0x849a('0xf')](_0x4d3cc7));if(_0x4d3cc7[_0x849a('0x10')]){if(_0x4d3cc7[_0x849a('0x10')]['code']===0x1f4){logger['error'](_0x849a('0xc'),_0x2c3793,_0x4d3cc7['error'][_0x849a('0x11')]);return _0x48f972(_0x4d3cc7[_0x849a('0x10')][_0x849a('0x11')]);}logger[_0x849a('0x10')](_0x849a('0xc'),_0x2c3793,_0x4d3cc7['error'][_0x849a('0x11')]);return _0x42082d(_0x4d3cc7[_0x849a('0x10')][_0x849a('0x11')]);}else{logger[_0x849a('0x12')](_0x849a('0xc'),_0x2c3793,_0x849a('0xd'));_0x42082d(_0x4d3cc7[_0x849a('0x13')][_0x849a('0x11')]);}})[_0x849a('0x14')](function(_0x151a36){logger['error'](_0x849a('0xc'),_0x2c3793,_0x151a36);_0x48f972(_0x151a36);});});}exports[_0x849a('0x15')]=function(_0x2faf73){var _0x40d38a=this;return new Promise(function(_0x11d7c6,_0x5daf6d){return db[_0x849a('0x16')][_0x849a('0x17')]({'raw':!![],'where':{'ContactId':_0x2faf73[_0x849a('0x18')]['ContactId'],'ListId':_0x2faf73['body'][_0x849a('0x19')],'VoiceQueueId':_0x2faf73[_0x849a('0x18')][_0x849a('0x1a')]===undefined?null:_0x2faf73[_0x849a('0x18')][_0x849a('0x1a')],'CampaignId':_0x2faf73[_0x849a('0x18')][_0x849a('0x1b')]===undefined?null:_0x2faf73['body'][_0x849a('0x1b')]}})[_0x849a('0xb')](function(_0x7bdfe0){if(_0x7bdfe0!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x7bdfe0['id'],'OrderBy':{'$gt':_0x7bdfe0['OrderBy']}},'order':[[_0x849a('0x1c'),_0x849a('0x1d')]]})[_0x849a('0xb')](function(_0x13baa6){var _0x5ad702=0x0;if(_0x13baa6){if(_0x13baa6[_0x849a('0x1e')]+_0x13baa6[_0x849a('0x1f')]+_0x13baa6[_0x849a('0x20')]+_0x13baa6[_0x849a('0x21')]+_0x13baa6['countdropretry']+_0x13baa6[_0x849a('0x22')]+_0x13baa6['countmachineretry']+_0x13baa6['countagentrejectretry']<_0x2faf73[_0x849a('0x23')][_0x849a('0x24')])_0x5ad702=0x1;_0x11d7c6({'additional':_0x5ad702});}else{return db[_0x849a('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x7bdfe0['id']},'order':[[_0x849a('0x1c'),'ASC']]})[_0x849a('0xb')](function(_0x2de570){var _0x48c679=0x0;if(_0x2de570){if(_0x2de570[_0x849a('0x1e')]+_0x2de570[_0x849a('0x1f')]+_0x2de570['countnoanswerretry']+_0x2de570['countnosuchnumberretry']+_0x2de570['countdropretry']+_0x2de570[_0x849a('0x22')]+_0x2de570[_0x849a('0x26')]+_0x2de570[_0x849a('0x27')]<_0x2faf73['entity']['dialGlobalMaxRetry'])_0x48c679=0x1;_0x11d7c6({'additional':_0x48c679});}else{_0x11d7c6({'additional':0x0});}})['catch'](function(_0x1bcafe){logger[_0x849a('0x10')](_0x849a('0x15'),_0x1bcafe[_0x849a('0x11')],_0x2faf73);_0x5daf6d(_0x40d38a['error'](0x1f4,_0x1bcafe[_0x849a('0x11')]));});}})[_0x849a('0x14')](function(_0x4d099c){logger[_0x849a('0x10')]('VerifyAdditionalPhones',_0x4d099c['message'],_0x2faf73);_0x5daf6d(_0x40d38a[_0x849a('0x10')](0x1f4,_0x4d099c[_0x849a('0x11')]));});}else _0x11d7c6({'additional':0x0});});});};exports[_0x849a('0x28')]=function(_0x187cc4){var _0x54886a=this;return new Promise(function(_0x5196a3,_0x10f66b){return db[_0x849a('0x16')][_0x849a('0x17')]({'raw':!![],'where':{'ContactId':_0x187cc4['body']['ContactId'],'ListId':_0x187cc4['body'][_0x849a('0x19')],'VoiceQueueId':_0x187cc4[_0x849a('0x18')][_0x849a('0x1a')]===undefined?null:_0x187cc4['body'][_0x849a('0x1a')],'CampaignId':_0x187cc4['body']['CampaignId']===undefined?null:_0x187cc4['body'][_0x849a('0x1b')]}})['then'](function(_0x409ed9){if(_0x409ed9!=null){return db[_0x849a('0x25')][_0x849a('0x17')]({'raw':!![],'where':{'CmHopperId':_0x409ed9['id'],'OrderBy':{'$gt':_0x409ed9[_0x849a('0x1c')]}},'order':[['OrderBy',_0x849a('0x1d')]]})[_0x849a('0xb')](function(_0x191773){if(_0x191773)return activateAdditionalPhone(_0x409ed9,_0x187cc4[_0x849a('0x18')],_0x191773,_0x187cc4['duration'],_0x187cc4['waitTime'])[_0x849a('0xb')](function(_0x166be8){_0x5196a3(_0x166be8);});else{return db[_0x849a('0x25')][_0x849a('0x17')]({'raw':!![],'where':{'CmHopperId':_0x409ed9['id']},'order':[['OrderBy','ASC']]})[_0x849a('0xb')](function(_0x295d20){if(_0x295d20)return activateAdditionalPhone(_0x409ed9,_0x187cc4['body'],_0x295d20,_0x187cc4['duration'],_0x187cc4[_0x849a('0x29')])['then'](function(_0x421475){_0x5196a3(_0x421475);});else{_0x5196a3({'id':_0x409ed9['id'],'phone':''});}})['catch'](function(_0x351f4e){logger['error'](_0x849a('0x15'),_0x351f4e[_0x849a('0x11')],_0x187cc4);_0x10f66b(_0x54886a[_0x849a('0x10')](0x1f4,_0x351f4e[_0x849a('0x11')]));});}})[_0x849a('0x14')](function(_0x5e0d53){logger[_0x849a('0x10')]('VerifyAdditionalPhones',_0x5e0d53[_0x849a('0x11')],_0x187cc4);_0x10f66b(_0x54886a['error'](0x1f4,_0x5e0d53['message']));});}else _0x5196a3(0x1);});});};function activateAdditionalPhone(_0x6e69f1,_0x281839,_0x4ce9eb,_0x4767fd,_0x3c7e79){return new Promise(function(_0x560415,_0xd3837d){logger[_0x849a('0x12')](_0x849a('0x15'),_0x4ce9eb);var _0x24b066;if(moment()>moment(_0x4ce9eb['scheduledat'])){_0x24b066=moment()[_0x849a('0x2a')](_0x3c7e79||0x3,_0x849a('0x2b'));}else{if(_0x4ce9eb[_0x849a('0x1c')]==0x0){_0x24b066=moment(_0x4ce9eb[_0x849a('0x2c')]);}else{_0x24b066=moment()['add'](_0x3c7e79||0x3,_0x849a('0x2b'));}}var _0x10c431={'phone':_0x6e69f1[_0x849a('0x2d')],'active':0x0,'OrderBy':_[_0x849a('0x2e')](_0x6e69f1[_0x849a('0x1c')])?0x0:_0x6e69f1[_0x849a('0x1c')],'scheduledat':moment()[_0x849a('0x2a')](_0x4767fd||0x1,_0x849a('0x2b')),'countbusyretry':_0x281839[_0x849a('0x1e')],'countcongestionretry':_0x281839[_0x849a('0x1f')],'countnoanswerretry':_0x281839[_0x849a('0x20')],'countnosuchnumberretry':_0x281839[_0x849a('0x21')],'countdropretry':_0x281839[_0x849a('0x2f')],'countabandonedretry':_0x281839[_0x849a('0x22')],'countmachineretry':_0x281839[_0x849a('0x26')],'countagentrejectretry':_0x281839[_0x849a('0x27')],'createdAt':_0x281839['createdAt'],'updatedAt':_0x281839['updatedAt']};var _0x1016d5={'CmHopperId':_0x6e69f1['id'],'phone':_0x4ce9eb[_0x849a('0x2d')],'active':0x0,'OrderBy':_[_0x849a('0x2e')](_0x4ce9eb[_0x849a('0x1c')])?0x0:_0x4ce9eb[_0x849a('0x1c')],'scheduledat':_0x24b066,'countbusyretry':_0x4ce9eb[_0x849a('0x1e')],'countcongestionretry':_0x4ce9eb['countcongestionretry'],'countnoanswerretry':_0x4ce9eb[_0x849a('0x20')],'countnosuchnumberretry':_0x281839['countnosuchnumberretry'],'countdropretry':_0x281839[_0x849a('0x2f')],'countabandonedretry':_0x281839[_0x849a('0x22')],'countmachineretry':_0x281839[_0x849a('0x26')],'countagentrejectretry':_0x281839[_0x849a('0x27')],'createdAt':_0x4ce9eb[_0x849a('0x30')],'updatedAt':_0x4ce9eb['updatedAt']};logger[_0x849a('0x12')](_0x849a('0x31'),_0x10c431);logger[_0x849a('0x12')](_0x849a('0x32'),_0x1016d5);return db[_0x849a('0x33')][_0x849a('0x34')](function(_0x291d14){return db[_0x849a('0x25')][_0x849a('0x35')](_0x10c431,{'where':{'id':_0x4ce9eb['id']}},{'transaction':_0x291d14})[_0x849a('0xb')](function(){return db[_0x849a('0x16')][_0x849a('0x35')](_0x1016d5,{'where':{'id':_0x6e69f1['id']}},{'transaction':_0x291d14});});})[_0x849a('0xb')](function(_0x45c6af){_0x560415({'id':_0x6e69f1['id'],'phone':_0x4ce9eb['phone']});})[_0x849a('0x14')](function(_0x2aada8){logger[_0x849a('0x10')](_0x849a('0x15'),_0x2aada8[_0x849a('0x11')],req);_0xd3837d(_this['error'](0x1f4,_0x2aada8['message']));});});}exports['IncrementPreviewCounters']=function(_0x3e7e3c){var _0x5396e8=this;return new Promise(function(_0x4d2dd6,_0x1a1c27){return db[_0x849a('0x16')][_0x849a('0x35')](_0x3e7e3c['body']['field'],{'where':{'id':_0x3e7e3c['body']['id']}})[_0x849a('0xb')](function(_0x1354df){_0x4d2dd6(_0x1354df);})[_0x849a('0x14')](function(_0x5d1763){logger[_0x849a('0x10')]('IncrementPreviewCounters',_0x5d1763['message'],_0x3e7e3c);_0x1a1c27(_0x5396e8[_0x849a('0x10')](0x1f4,_0x5d1763[_0x849a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4d82c96..7bcea24 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 _0xc021=['../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc021,0x15d));var _0x1c02=function(_0x2d0d74,_0x13e63c){_0x2d0d74=_0x2d0d74-0x0;var _0x4ac25a=_0xc021[_0x2d0d74];return _0x4ac25a;};'use strict';var multer=require(_0x1c02('0x0'));var util=require(_0x1c02('0x1'));var path=require(_0x1c02('0x2'));var timeout=require(_0x1c02('0x3'));var express=require(_0x1c02('0x4'));var router=express[_0x1c02('0x5')]();var auth=require(_0x1c02('0x6'));var interaction=require(_0x1c02('0x7'));var config=require(_0x1c02('0x8'));var controller=require(_0x1c02('0x9'));router[_0x1c02('0xa')]('/',auth[_0x1c02('0xb')](),controller[_0x1c02('0xc')]);router[_0x1c02('0xa')](_0x1c02('0xd'),auth[_0x1c02('0xb')](),controller[_0x1c02('0xe')]);router[_0x1c02('0xf')]('/',auth[_0x1c02('0xb')](),controller[_0x1c02('0x10')]);router[_0x1c02('0x11')](_0x1c02('0xd'),auth[_0x1c02('0xb')](),controller[_0x1c02('0x12')]);router[_0x1c02('0x13')](_0x1c02('0xd'),auth[_0x1c02('0xb')](),controller[_0x1c02('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe4ce=['create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','/:id','show','post'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xe4ce,0x131));var _0xee4c=function(_0x2c9a3e,_0x34f121){_0x2c9a3e=_0x2c9a3e-0x0;var _0x57a7d6=_0xe4ce[_0x2c9a3e];return _0x57a7d6;};'use strict';var multer=require('multer');var util=require(_0xee4c('0x0'));var path=require(_0xee4c('0x1'));var timeout=require(_0xee4c('0x2'));var express=require(_0xee4c('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xee4c('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xee4c('0x5')]('/',auth[_0xee4c('0x6')](),controller['index']);router[_0xee4c('0x5')](_0xee4c('0x7'),auth[_0xee4c('0x6')](),controller[_0xee4c('0x8')]);router[_0xee4c('0x9')]('/',auth[_0xee4c('0x6')](),controller[_0xee4c('0xa')]);router[_0xee4c('0xb')](_0xee4c('0x7'),auth[_0xee4c('0x6')](),controller[_0xee4c('0xc')]);router['delete'](_0xee4c('0x7'),auth['isAuthenticated'](),controller[_0xee4c('0xd')]);module[_0xee4c('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5612241..2401f03 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 _0x652f=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x57f499,_0x40dbd0){var _0x377c66=function(_0x311149){while(--_0x311149){_0x57f499['push'](_0x57f499['shift']());}};_0x377c66(++_0x40dbd0);}(_0x652f,0x1bf));var _0xf652=function(_0x4f56d7,_0x21f141){_0x4f56d7=_0x4f56d7-0x0;var _0x55be0b=_0x652f[_0x4f56d7];return _0x55be0b;};'use strict';var moment=require(_0xf652('0x0'));var Sequelize=require(_0xf652('0x1'));module[_0xf652('0x2')]={'phone':{'type':Sequelize[_0xf652('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf652('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xf652('0x5')},'VoiceQueueId':{'type':Sequelize[_0xf652('0x4')],'unique':_0xf652('0x5')}}; \ No newline at end of file +var _0x15b3=['sequelize','exports','STRING','contactListQueue','INTEGER','moment'];(function(_0x46f2a2,_0x59b5a4){var _0x1ea996=function(_0x90ce2e){while(--_0x90ce2e){_0x46f2a2['push'](_0x46f2a2['shift']());}};_0x1ea996(++_0x59b5a4);}(_0x15b3,0x167));var _0x315b=function(_0x536dba,_0x60c16d){_0x536dba=_0x536dba-0x0;var _0x2f17cf=_0x15b3[_0x536dba];return _0x2f17cf;};'use strict';var moment=require(_0x315b('0x0'));var Sequelize=require(_0x315b('0x1'));module[_0x315b('0x2')]={'phone':{'type':Sequelize[_0x315b('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x315b('0x4')},'VoiceQueueId':{'type':Sequelize[_0x315b('0x5')],'unique':_0x315b('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b1ecb0a..5214920 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 _0x64bd=['util','sox','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','findAll','catch','show','params','length','includeAll','include','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x64bd,0x110));var _0xd64b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64bd[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd64b('0x0'));var emlformat=require(_0xd64b('0x1'));var rimraf=require(_0xd64b('0x2'));var zipdir=require(_0xd64b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd64b('0x4'));var moment=require(_0xd64b('0x5'));var BPromise=require(_0xd64b('0x6'));var Mustache=require(_0xd64b('0x7'));var util=require(_0xd64b('0x8'));var path=require('path');var sox=require(_0xd64b('0x9'));var csv=require('to-csv');var ejs=require(_0xd64b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd64b('0xb'));var crypto=require(_0xd64b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd64b('0xd'));var Papa=require(_0xd64b('0xe'));var Redis=require('ioredis');var authService=require(_0xd64b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd64b('0x10'));var hardwareService=require(_0xd64b('0x11'));var logger=require(_0xd64b('0x12'))('api');var utils=require(_0xd64b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd64b('0x14'));var db=require(_0xd64b('0x15'))['db'];function respondWithStatusCode(_0x58b799,_0x8d1250){_0x8d1250=_0x8d1250||0xcc;return function(_0x5ac1e8){if(_0x5ac1e8){return _0x58b799[_0xd64b('0x16')](_0x8d1250);}return _0x58b799[_0xd64b('0x17')](_0x8d1250)[_0xd64b('0x18')]();};}function respondWithResult(_0x2d95ee,_0x8cd0e3){_0x8cd0e3=_0x8cd0e3||0xc8;return function(_0x35261d){if(_0x35261d){return _0x2d95ee[_0xd64b('0x17')](_0x8cd0e3)[_0xd64b('0x19')](_0x35261d);}};}function respondWithFilteredResult(_0x2d2263,_0x1d4137){return function(_0x39e4a5){if(_0x39e4a5){var _0x4ae728=_0x39e4a5[_0xd64b('0x1a')],_0x2f7350=_0x1d4137['offset'],_0x282c93=_0x1d4137[_0xd64b('0x1b')]+_0x1d4137[_0xd64b('0x1c')],_0x4341d8;if(_0x282c93>=_0x4ae728){_0x282c93=_0x4ae728;_0x4341d8=0xc8;}else{_0x4341d8=0xce;}_0x2d2263[_0xd64b('0x17')](_0x4341d8);return _0x2d2263[_0xd64b('0x1d')](_0xd64b('0x1e'),_0x2f7350+'-'+_0x282c93+'/'+_0x4ae728)[_0xd64b('0x19')](_0x39e4a5);}return null;};}function patchUpdates(_0x133805){return function(_0xdc222d){try{jsonpatch[_0xd64b('0x1f')](_0xdc222d,_0x133805,!![]);}catch(_0x579719){return BPromise[_0xd64b('0x20')](_0x579719);}return _0xdc222d['save']();};}function saveUpdates(_0x59fccb,_0x16299f){return function(_0x4be8a8){if(_0x4be8a8){return _0x4be8a8[_0xd64b('0x21')](_0x59fccb)[_0xd64b('0x22')](function(_0x661d0f){return _0x661d0f;});}return null;};}function removeEntity(_0x4c05e2,_0x3df18f){return function(_0x310a0f){if(_0x310a0f){return _0x310a0f['destroy']()['then'](function(){_0x4c05e2[_0xd64b('0x17')](0xcc)[_0xd64b('0x18')]();});}};}function handleEntityNotFound(_0x441c1c,_0x157897){return function(_0x3fbfc8){if(!_0x3fbfc8){_0x441c1c[_0xd64b('0x16')](0x194);}return _0x3fbfc8;};}function handleError(_0x547977,_0x8647f8){_0x8647f8=_0x8647f8||0x1f4;return function(_0x43ca56){logger[_0xd64b('0x23')](_0x43ca56[_0xd64b('0x24')]);if(_0x43ca56[_0xd64b('0x25')]){delete _0x43ca56[_0xd64b('0x25')];}_0x547977[_0xd64b('0x17')](_0x8647f8)['send'](_0x43ca56);};}exports[_0xd64b('0x26')]=function(_0x532f91,_0x34c98f){var _0x4b3f53={},_0x127640={},_0xcf21cc={'count':0x0,'rows':[]};var _0x3eedf6=_[_0xd64b('0x27')](db[_0xd64b('0x28')][_0xd64b('0x29')],function(_0x47acbf){return{'name':_0x47acbf[_0xd64b('0x2a')],'type':_0x47acbf[_0xd64b('0x2b')]['key']};});_0x127640[_0xd64b('0x2c')]=_[_0xd64b('0x27')](_0x3eedf6,'name');_0x127640[_0xd64b('0x2d')]=_[_0xd64b('0x2e')](_0x532f91['query']);_0x127640['filters']=_[_0xd64b('0x2f')](_0x127640[_0xd64b('0x2c')],_0x127640[_0xd64b('0x2d')]);_0x4b3f53[_0xd64b('0x30')]=_[_0xd64b('0x2f')](_0x127640[_0xd64b('0x2c')],qs[_0xd64b('0x31')](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x31')]));_0x4b3f53[_0xd64b('0x30')]=_0x4b3f53[_0xd64b('0x30')]['length']?_0x4b3f53['attributes']:_0x127640['model'];if(!_0x532f91[_0xd64b('0x2d')][_0xd64b('0x32')](_0xd64b('0x33'))){_0x4b3f53[_0xd64b('0x1c')]=qs[_0xd64b('0x1c')](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x1c')]);_0x4b3f53[_0xd64b('0x1b')]=qs['offset'](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x1b')]);}_0x4b3f53[_0xd64b('0x34')]=qs[_0xd64b('0x35')](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x35')]);_0x4b3f53['where']=qs[_0xd64b('0x36')](_[_0xd64b('0x37')](_0x532f91[_0xd64b('0x2d')],_0x127640[_0xd64b('0x36')]),_0x3eedf6);if(_0x532f91[_0xd64b('0x2d')]['filter']){_0x4b3f53[_0xd64b('0x38')]=_[_0xd64b('0x39')](_0x4b3f53[_0xd64b('0x38')],{'$or':_[_0xd64b('0x27')](_0x3eedf6,function(_0x1fe8e8){if(_0x1fe8e8[_0xd64b('0x2b')]!=='VIRTUAL'){var _0x1a047d={};_0x1a047d[_0x1fe8e8['name']]={'$like':'%'+_0x532f91[_0xd64b('0x2d')][_0xd64b('0x3a')]+'%'};return _0x1a047d;}})});}_0x4b3f53=_['merge']({},_0x4b3f53,_0x532f91[_0xd64b('0x3b')]);var _0x53d2c7={'where':_0x4b3f53[_0xd64b('0x38')]};return db['CmHopperBlack']['count'](_0x53d2c7)['then'](function(_0x2da7e1){_0xcf21cc[_0xd64b('0x1a')]=_0x2da7e1;if(_0x532f91['query']['includeAll']){_0x4b3f53['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xd64b('0x3c')](_0x4b3f53);})[_0xd64b('0x22')](function(_0x4f1465){_0xcf21cc['rows']=_0x4f1465;return _0xcf21cc;})[_0xd64b('0x22')](respondWithFilteredResult(_0x34c98f,_0x4b3f53))[_0xd64b('0x3d')](handleError(_0x34c98f,null));};exports[_0xd64b('0x3e')]=function(_0x4268fc,_0x2cdb86){var _0x9e20d0={'raw':!![],'where':{'id':_0x4268fc[_0xd64b('0x3f')]['id']}},_0x3b79e8={};_0x3b79e8[_0xd64b('0x2c')]=_['keys'](db[_0xd64b('0x28')]['rawAttributes']);_0x3b79e8[_0xd64b('0x2d')]=_[_0xd64b('0x2e')](_0x4268fc[_0xd64b('0x2d')]);_0x3b79e8[_0xd64b('0x36')]=_[_0xd64b('0x2f')](_0x3b79e8[_0xd64b('0x2c')],_0x3b79e8[_0xd64b('0x2d')]);_0x9e20d0[_0xd64b('0x30')]=_['intersection'](_0x3b79e8[_0xd64b('0x2c')],qs[_0xd64b('0x31')](_0x4268fc['query'][_0xd64b('0x31')]));_0x9e20d0[_0xd64b('0x30')]=_0x9e20d0[_0xd64b('0x30')][_0xd64b('0x40')]?_0x9e20d0[_0xd64b('0x30')]:_0x3b79e8[_0xd64b('0x2c')];if(_0x4268fc[_0xd64b('0x2d')][_0xd64b('0x41')]){_0x9e20d0[_0xd64b('0x42')]=[{'all':!![]}];}_0x9e20d0=_[_0xd64b('0x39')]({},_0x9e20d0,_0x4268fc[_0xd64b('0x3b')]);return db[_0xd64b('0x28')][_0xd64b('0x43')](_0x9e20d0)[_0xd64b('0x22')](handleEntityNotFound(_0x2cdb86,null))[_0xd64b('0x22')](respondWithResult(_0x2cdb86,null))[_0xd64b('0x3d')](handleError(_0x2cdb86,null));};exports['update']=function(_0x58d529,_0x37bfc3){if(_0x58d529[_0xd64b('0x44')]['id']){delete _0x58d529['body']['id'];}return db['CmHopperBlack'][_0xd64b('0x43')]({'where':{'id':_0x58d529['params']['id']}})['then'](handleEntityNotFound(_0x37bfc3,null))[_0xd64b('0x22')](saveUpdates(_0x58d529[_0xd64b('0x44')],null))[_0xd64b('0x22')](respondWithResult(_0x37bfc3,null))[_0xd64b('0x3d')](handleError(_0x37bfc3,null));};exports['destroy']=function(_0x52c467,_0xe7076a){return db[_0xd64b('0x28')]['find']({'where':{'id':_0x52c467[_0xd64b('0x3f')]['id']}})[_0xd64b('0x22')](handleEntityNotFound(_0xe7076a,null))[_0xd64b('0x22')](removeEntity(_0xe7076a,null))[_0xd64b('0x3d')](handleError(_0xe7076a,null));};exports[_0xd64b('0x45')]=function(_0x809463,_0x4141ba){return db[_0xd64b('0x28')][_0xd64b('0x45')]()[_0xd64b('0x22')](respondWithResult(_0x4141ba,null))[_0xd64b('0x3d')](handleError(_0x4141ba,null));}; \ No newline at end of file +var _0x8a79=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x8a79,0x174));var _0x98a7=function(_0x3586be,_0x162dd6){_0x3586be=_0x3586be-0x0;var _0x55b20b=_0x8a79[_0x3586be];return _0x55b20b;};'use strict';var pdf=require(_0x98a7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x98a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98a7('0x2'));var rp=require(_0x98a7('0x3'));var moment=require(_0x98a7('0x4'));var BPromise=require(_0x98a7('0x5'));var Mustache=require(_0x98a7('0x6'));var util=require(_0x98a7('0x7'));var path=require('path');var sox=require(_0x98a7('0x8'));var csv=require(_0x98a7('0x9'));var ejs=require(_0x98a7('0xa'));var fs=require('fs');var _=require(_0x98a7('0xb'));var squel=require(_0x98a7('0xc'));var crypto=require('crypto');var jsforce=require(_0x98a7('0xd'));var deskjs=require(_0x98a7('0xe'));var toCsv=require(_0x98a7('0x9'));var querystring=require(_0x98a7('0xf'));var Papa=require(_0x98a7('0x10'));var Redis=require(_0x98a7('0x11'));var authService=require(_0x98a7('0x12'));var qs=require(_0x98a7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98a7('0x14'));var logger=require('../../config/logger')(_0x98a7('0x15'));var utils=require(_0x98a7('0x16'));var config=require(_0x98a7('0x17'));var licenseUtil=require(_0x98a7('0x18'));var db=require(_0x98a7('0x19'))['db'];function respondWithStatusCode(_0x4bcb18,_0x416221){_0x416221=_0x416221||0xcc;return function(_0x22a247){if(_0x22a247){return _0x4bcb18[_0x98a7('0x1a')](_0x416221);}return _0x4bcb18[_0x98a7('0x1b')](_0x416221)[_0x98a7('0x1c')]();};}function respondWithResult(_0xa80c49,_0x3eda2f){_0x3eda2f=_0x3eda2f||0xc8;return function(_0x13978b){if(_0x13978b){return _0xa80c49[_0x98a7('0x1b')](_0x3eda2f)['json'](_0x13978b);}};}function respondWithFilteredResult(_0x45cf52,_0x159f26){return function(_0x238f87){if(_0x238f87){var _0x40e763=_0x238f87['count'],_0x157d18=_0x159f26[_0x98a7('0x1d')],_0x53d8be=_0x159f26[_0x98a7('0x1d')]+_0x159f26[_0x98a7('0x1e')],_0x24f743;if(_0x53d8be>=_0x40e763){_0x53d8be=_0x40e763;_0x24f743=0xc8;}else{_0x24f743=0xce;}_0x45cf52[_0x98a7('0x1b')](_0x24f743);return _0x45cf52[_0x98a7('0x1f')](_0x98a7('0x20'),_0x157d18+'-'+_0x53d8be+'/'+_0x40e763)[_0x98a7('0x21')](_0x238f87);}return null;};}function patchUpdates(_0x4da8cb){return function(_0xdb73ee){try{jsonpatch[_0x98a7('0x22')](_0xdb73ee,_0x4da8cb,!![]);}catch(_0x442c13){return BPromise[_0x98a7('0x23')](_0x442c13);}return _0xdb73ee[_0x98a7('0x24')]();};}function saveUpdates(_0x5c6352,_0x369b5b){return function(_0x279e8b){if(_0x279e8b){return _0x279e8b[_0x98a7('0x25')](_0x5c6352)['then'](function(_0x287a58){return _0x287a58;});}return null;};}function removeEntity(_0x11b8bc,_0x1e50f0){return function(_0x308479){if(_0x308479){return _0x308479[_0x98a7('0x26')]()[_0x98a7('0x27')](function(){_0x11b8bc[_0x98a7('0x1b')](0xcc)[_0x98a7('0x1c')]();});}};}function handleEntityNotFound(_0x2bf330,_0x43b281){return function(_0x64cbb8){if(!_0x64cbb8){_0x2bf330['sendStatus'](0x194);}return _0x64cbb8;};}function handleError(_0x328446,_0x12b902){_0x12b902=_0x12b902||0x1f4;return function(_0x201541){logger[_0x98a7('0x28')](_0x201541[_0x98a7('0x29')]);if(_0x201541[_0x98a7('0x2a')]){delete _0x201541[_0x98a7('0x2a')];}_0x328446[_0x98a7('0x1b')](_0x12b902)[_0x98a7('0x2b')](_0x201541);};}exports[_0x98a7('0x2c')]=function(_0x3ad899,_0x14525c){var _0x257443={},_0x855f9b={},_0xafa305={'count':0x0,'rows':[]};var _0x374e90=_[_0x98a7('0x2d')](db[_0x98a7('0x2e')][_0x98a7('0x2f')],function(_0x2b9d5e){return{'name':_0x2b9d5e[_0x98a7('0x30')],'type':_0x2b9d5e[_0x98a7('0x31')]['key']};});_0x855f9b[_0x98a7('0x32')]=_[_0x98a7('0x2d')](_0x374e90,_0x98a7('0x2a'));_0x855f9b[_0x98a7('0x33')]=_[_0x98a7('0x34')](_0x3ad899[_0x98a7('0x33')]);_0x855f9b['filters']=_[_0x98a7('0x35')](_0x855f9b[_0x98a7('0x32')],_0x855f9b[_0x98a7('0x33')]);_0x257443[_0x98a7('0x36')]=_[_0x98a7('0x35')](_0x855f9b[_0x98a7('0x32')],qs[_0x98a7('0x37')](_0x3ad899['query'][_0x98a7('0x37')]));_0x257443[_0x98a7('0x36')]=_0x257443['attributes'][_0x98a7('0x38')]?_0x257443['attributes']:_0x855f9b[_0x98a7('0x32')];if(!_0x3ad899['query'][_0x98a7('0x39')](_0x98a7('0x3a'))){_0x257443[_0x98a7('0x1e')]=qs['limit'](_0x3ad899[_0x98a7('0x33')][_0x98a7('0x1e')]);_0x257443[_0x98a7('0x1d')]=qs['offset'](_0x3ad899['query']['offset']);}_0x257443[_0x98a7('0x3b')]=qs[_0x98a7('0x3c')](_0x3ad899[_0x98a7('0x33')][_0x98a7('0x3c')]);_0x257443[_0x98a7('0x3d')]=qs[_0x98a7('0x3e')](_['pick'](_0x3ad899[_0x98a7('0x33')],_0x855f9b['filters']),_0x374e90);if(_0x3ad899[_0x98a7('0x33')][_0x98a7('0x3f')]){_0x257443[_0x98a7('0x3d')]=_[_0x98a7('0x40')](_0x257443[_0x98a7('0x3d')],{'$or':_[_0x98a7('0x2d')](_0x374e90,function(_0x34c623){if(_0x34c623[_0x98a7('0x31')]!=='VIRTUAL'){var _0x4a0da9={};_0x4a0da9[_0x34c623[_0x98a7('0x2a')]]={'$like':'%'+_0x3ad899[_0x98a7('0x33')]['filter']+'%'};return _0x4a0da9;}})});}_0x257443=_[_0x98a7('0x40')]({},_0x257443,_0x3ad899[_0x98a7('0x41')]);var _0x2b95ad={'where':_0x257443['where']};return db[_0x98a7('0x2e')][_0x98a7('0x42')](_0x2b95ad)[_0x98a7('0x27')](function(_0xe26d5b){_0xafa305[_0x98a7('0x42')]=_0xe26d5b;if(_0x3ad899[_0x98a7('0x33')][_0x98a7('0x43')]){_0x257443[_0x98a7('0x44')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x98a7('0x45')](_0x257443);})[_0x98a7('0x27')](function(_0x5b4c54){_0xafa305[_0x98a7('0x46')]=_0x5b4c54;return _0xafa305;})[_0x98a7('0x27')](respondWithFilteredResult(_0x14525c,_0x257443))[_0x98a7('0x47')](handleError(_0x14525c,null));};exports[_0x98a7('0x48')]=function(_0x5b5390,_0x1433ff){var _0x6977a5={'raw':!![],'where':{'id':_0x5b5390[_0x98a7('0x49')]['id']}},_0x4dd0c2={};_0x4dd0c2['model']=_[_0x98a7('0x34')](db[_0x98a7('0x2e')][_0x98a7('0x2f')]);_0x4dd0c2[_0x98a7('0x33')]=_['keys'](_0x5b5390[_0x98a7('0x33')]);_0x4dd0c2[_0x98a7('0x3e')]=_[_0x98a7('0x35')](_0x4dd0c2[_0x98a7('0x32')],_0x4dd0c2['query']);_0x6977a5['attributes']=_[_0x98a7('0x35')](_0x4dd0c2['model'],qs[_0x98a7('0x37')](_0x5b5390['query']['fields']));_0x6977a5[_0x98a7('0x36')]=_0x6977a5[_0x98a7('0x36')][_0x98a7('0x38')]?_0x6977a5[_0x98a7('0x36')]:_0x4dd0c2[_0x98a7('0x32')];if(_0x5b5390[_0x98a7('0x33')][_0x98a7('0x43')]){_0x6977a5[_0x98a7('0x44')]=[{'all':!![]}];}_0x6977a5=_['merge']({},_0x6977a5,_0x5b5390[_0x98a7('0x41')]);return db[_0x98a7('0x2e')]['find'](_0x6977a5)[_0x98a7('0x27')](handleEntityNotFound(_0x1433ff,null))[_0x98a7('0x27')](respondWithResult(_0x1433ff,null))[_0x98a7('0x47')](handleError(_0x1433ff,null));};exports[_0x98a7('0x25')]=function(_0x3a6e1d,_0x157486){if(_0x3a6e1d[_0x98a7('0x4a')]['id']){delete _0x3a6e1d[_0x98a7('0x4a')]['id'];}return db[_0x98a7('0x2e')][_0x98a7('0x4b')]({'where':{'id':_0x3a6e1d[_0x98a7('0x49')]['id']}})['then'](handleEntityNotFound(_0x157486,null))[_0x98a7('0x27')](saveUpdates(_0x3a6e1d['body'],null))[_0x98a7('0x27')](respondWithResult(_0x157486,null))['catch'](handleError(_0x157486,null));};exports[_0x98a7('0x26')]=function(_0x22984a,_0x4f621e){return db[_0x98a7('0x2e')][_0x98a7('0x4b')]({'where':{'id':_0x22984a['params']['id']}})[_0x98a7('0x27')](handleEntityNotFound(_0x4f621e,null))[_0x98a7('0x27')](removeEntity(_0x4f621e,null))['catch'](handleError(_0x4f621e,null));};exports[_0x98a7('0x4c')]=function(_0x40d27a,_0x2fde82){return db[_0x98a7('0x2e')][_0x98a7('0x4c')]()['then'](respondWithResult(_0x2fde82,null))[_0x98a7('0x47')](handleError(_0x2fde82,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5694d56..23f1b53 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 _0xfc1e=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','../../config/logger','moment','bluebird','request-promise'];(function(_0x25206c,_0xb23c50){var _0x355931=function(_0x2513dd){while(--_0x2513dd){_0x25206c['push'](_0x25206c['shift']());}};_0x355931(++_0xb23c50);}(_0xfc1e,0x146));var _0xefc1=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xfc1e[_0x287a47];return _0x3fb726;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xefc1('0x0'))('api');var moment=require(_0xefc1('0x1'));var BPromise=require(_0xefc1('0x2'));var rp=require(_0xefc1('0x3'));var fs=require('fs');var path=require(_0xefc1('0x4'));var rimraf=require(_0xefc1('0x5'));var config=require(_0xefc1('0x6'));var attributes=require(_0xefc1('0x7'));module[_0xefc1('0x8')]=function(_0x1d9666,_0x3182d9){return _0x1d9666[_0xefc1('0x9')](_0xefc1('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x039e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x039e,0x8f));var _0xe039=function(_0x393b6b,_0x21f9dd){_0x393b6b=_0x393b6b-0x0;var _0x47d112=_0x039e[_0x393b6b];return _0x47d112;};'use strict';var _=require(_0xe039('0x0'));var util=require('util');var logger=require(_0xe039('0x1'))(_0xe039('0x2'));var moment=require(_0xe039('0x3'));var BPromise=require(_0xe039('0x4'));var rp=require(_0xe039('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe039('0x6'));var config=require('../../config/environment');var attributes=require(_0xe039('0x7'));module[_0xe039('0x8')]=function(_0x976d73,_0x3761e9){return _0x976d73[_0xe039('0x9')](_0xe039('0xa'),attributes,{'tableName':_0xe039('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 5e419ec..70b0ff3 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 _0x5455=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','limit','include','map','attributes','model','then','UpdateCmHopperBlack','update','body','destroy','DestroyCmHopperBlack'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5455,0x18c));var _0x5545=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5455[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x5545('0x0'));var util=require(_0x5545('0x1'));var moment=require(_0x5545('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5545('0x3'));var db=require(_0x5545('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5545('0x5'))(_0x5545('0x6'));var config=require(_0x5545('0x7'));var jayson=require(_0x5545('0x8'));var client=jayson[_0x5545('0x9')][_0x5545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55063d,_0x504fcd,_0xc5d51a){return new BPromise(function(_0x9d950d,_0x2da206){return client['request'](_0x55063d,_0xc5d51a)['then'](function(_0x4c8746){logger[_0x5545('0xb')](_0x5545('0xc'),_0x504fcd,_0x5545('0xd'));logger[_0x5545('0xe')](_0x5545('0xf'),_0x504fcd,'request\x20sent',JSON[_0x5545('0x10')](_0x4c8746));if(_0x4c8746['error']){if(_0x4c8746['error']['code']===0x1f4){logger['error'](_0x5545('0xc'),_0x504fcd,_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);return _0x2da206(_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);}logger[_0x5545('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x504fcd,_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);return _0x9d950d(_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);}else{logger[_0x5545('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x504fcd,_0x5545('0xd'));_0x9d950d(_0x4c8746['result'][_0x5545('0x12')]);}})[_0x5545('0x13')](function(_0x1994f8){logger[_0x5545('0x11')](_0x5545('0xc'),_0x504fcd,_0x1994f8);_0x2da206(_0x1994f8);});});}exports[_0x5545('0x14')]=function(_0x58c74b){var _0xc27f51=this;return new Promise(function(_0x1d7565,_0x85da25){return db[_0x5545('0x15')]['findAll']({'raw':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x17')]===undefined?!![]:![]:!![],'where':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x18')]||null:null,'attributes':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')]['attributes']||null:null,'limit':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x19')]||null:null,'include':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x1a')]?_[_0x5545('0x1b')](_0x58c74b['options'][_0x5545('0x1a')],function(_0x18c9f0){return{'model':db[_0x18c9f0['model']],'as':_0x18c9f0['as'],'attributes':_0x18c9f0[_0x5545('0x1c')],'include':_0x18c9f0[_0x5545('0x1a')]?_['map'](_0x18c9f0[_0x5545('0x1a')],function(_0xc3d917){return{'model':db[_0xc3d917[_0x5545('0x1d')]],'as':_0xc3d917['as'],'attributes':_0xc3d917[_0x5545('0x1c')],'include':_0xc3d917[_0x5545('0x1a')]?_[_0x5545('0x1b')](_0xc3d917[_0x5545('0x1a')],function(_0xc34887){return{'model':db[_0xc34887['model']],'as':_0xc34887['as'],'attributes':_0xc34887[_0x5545('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5545('0x1e')](function(_0x482ecb){logger[_0x5545('0xb')](_0x5545('0x14'),_0x58c74b);logger['debug'](_0x5545('0x14'),_0x58c74b,JSON[_0x5545('0x10')](_0x482ecb));_0x1d7565(_0x482ecb);})[_0x5545('0x13')](function(_0xcc516d){logger['error'](_0x5545('0x14'),_0xcc516d[_0x5545('0x12')],_0x58c74b);_0x85da25(_0xc27f51['error'](0x1f4,_0xcc516d[_0x5545('0x12')]));});});};exports[_0x5545('0x1f')]=function(_0x47516b){var _0x5dd85d=this;return new Promise(function(_0x217c0c,_0x3abdec){return db[_0x5545('0x15')][_0x5545('0x20')](_0x47516b[_0x5545('0x21')],{'raw':_0x47516b[_0x5545('0x16')]?_0x47516b[_0x5545('0x16')][_0x5545('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47516b['options']?_0x47516b[_0x5545('0x16')][_0x5545('0x18')]||null:null,'attributes':_0x47516b[_0x5545('0x16')]?_0x47516b[_0x5545('0x16')][_0x5545('0x1c')]||null:null,'limit':_0x47516b[_0x5545('0x16')]?_0x47516b[_0x5545('0x16')][_0x5545('0x19')]||null:null})[_0x5545('0x1e')](function(_0x5c5e47){logger[_0x5545('0xb')](_0x5545('0x1f'),_0x47516b);logger[_0x5545('0xe')](_0x5545('0x1f'),_0x47516b,JSON['stringify'](_0x5c5e47));_0x217c0c(_0x5c5e47);})[_0x5545('0x13')](function(_0x5dd338){logger[_0x5545('0x11')](_0x5545('0x1f'),_0x5dd338[_0x5545('0x12')],_0x47516b);_0x3abdec(_0x5dd85d[_0x5545('0x11')](0x1f4,_0x5dd338[_0x5545('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x198a81){var _0x19ac51=this;return new Promise(function(_0x3cb83c,_0x15d78b){return db[_0x5545('0x15')][_0x5545('0x22')]({'where':_0x198a81[_0x5545('0x16')]?_0x198a81[_0x5545('0x16')][_0x5545('0x18')]||null:null})['then'](function(_0x2b0c62){logger[_0x5545('0xb')](_0x5545('0x23'),_0x198a81);logger['debug'](_0x5545('0x23'),_0x198a81,JSON[_0x5545('0x10')](_0x2b0c62));_0x3cb83c(_0x2b0c62);})[_0x5545('0x13')](function(_0xadec82){logger[_0x5545('0x11')]('DestroyCmHopperBlack',_0xadec82[_0x5545('0x12')],_0x198a81);_0x15d78b(_0x19ac51[_0x5545('0x11')](0x1f4,_0xadec82[_0x5545('0x12')]));});});}; \ No newline at end of file +var _0xf160=['options','raw','where','attributes','limit','include','model','GetCmHopperBlack','catch','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf160,0xab));var _0x0f16=function(_0x327209,_0x48a379){_0x327209=_0x327209-0x0;var _0x57f4b1=_0xf160[_0x327209];return _0x57f4b1;};'use strict';var _=require(_0x0f16('0x0'));var util=require(_0x0f16('0x1'));var moment=require(_0x0f16('0x2'));var BPromise=require(_0x0f16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f16('0x4'));var db=require(_0x0f16('0x5'))['db'];var utils=require(_0x0f16('0x6'));var logger=require(_0x0f16('0x7'))(_0x0f16('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f16('0x9'));var client=jayson[_0x0f16('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x70196,_0x242510,_0x3b98f5){return new BPromise(function(_0x4a9c65,_0x2c63e8){return client[_0x0f16('0xb')](_0x70196,_0x3b98f5)[_0x0f16('0xc')](function(_0x52a108){logger[_0x0f16('0xd')](_0x0f16('0xe'),_0x242510,_0x0f16('0xf'));logger[_0x0f16('0x10')](_0x0f16('0x11'),_0x242510,_0x0f16('0xf'),JSON[_0x0f16('0x12')](_0x52a108));if(_0x52a108[_0x0f16('0x13')]){if(_0x52a108[_0x0f16('0x13')][_0x0f16('0x14')]===0x1f4){logger[_0x0f16('0x13')](_0x0f16('0xe'),_0x242510,_0x52a108[_0x0f16('0x13')][_0x0f16('0x15')]);return _0x2c63e8(_0x52a108[_0x0f16('0x13')]['message']);}logger[_0x0f16('0x13')](_0x0f16('0xe'),_0x242510,_0x52a108[_0x0f16('0x13')][_0x0f16('0x15')]);return _0x4a9c65(_0x52a108['error'][_0x0f16('0x15')]);}else{logger[_0x0f16('0xd')](_0x0f16('0xe'),_0x242510,_0x0f16('0xf'));_0x4a9c65(_0x52a108[_0x0f16('0x16')][_0x0f16('0x15')]);}})['catch'](function(_0x439d4f){logger[_0x0f16('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x242510,_0x439d4f);_0x2c63e8(_0x439d4f);});});}exports['GetCmHopperBlack']=function(_0x9d08e1){var _0x5eeefe=this;return new Promise(function(_0x22c09d,_0x3efe4d){return db['CmHopperBlack'][_0x0f16('0x17')]({'raw':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x19')]===undefined?!![]:![]:!![],'where':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x1a')]||null:null,'attributes':_0x9d08e1['options']?_0x9d08e1['options'][_0x0f16('0x1b')]||null:null,'limit':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1['options'][_0x0f16('0x1c')]||null:null,'include':_0x9d08e1[_0x0f16('0x18')]?_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x1d')]?_['map'](_0x9d08e1[_0x0f16('0x18')][_0x0f16('0x1d')],function(_0x4cf965){return{'model':db[_0x4cf965[_0x0f16('0x1e')]],'as':_0x4cf965['as'],'attributes':_0x4cf965[_0x0f16('0x1b')],'include':_0x4cf965[_0x0f16('0x1d')]?_['map'](_0x4cf965[_0x0f16('0x1d')],function(_0x1b8e1){return{'model':db[_0x1b8e1[_0x0f16('0x1e')]],'as':_0x1b8e1['as'],'attributes':_0x1b8e1[_0x0f16('0x1b')],'include':_0x1b8e1[_0x0f16('0x1d')]?_['map'](_0x1b8e1[_0x0f16('0x1d')],function(_0x550b6a){return{'model':db[_0x550b6a[_0x0f16('0x1e')]],'as':_0x550b6a['as'],'attributes':_0x550b6a[_0x0f16('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0f16('0xc')](function(_0x277284){logger[_0x0f16('0xd')](_0x0f16('0x1f'),_0x9d08e1);logger[_0x0f16('0x10')]('GetCmHopperBlack',_0x9d08e1,JSON[_0x0f16('0x12')](_0x277284));_0x22c09d(_0x277284);})[_0x0f16('0x20')](function(_0x8ca624){logger[_0x0f16('0x13')]('GetCmHopperBlack',_0x8ca624[_0x0f16('0x15')],_0x9d08e1);_0x3efe4d(_0x5eeefe[_0x0f16('0x13')](0x1f4,_0x8ca624[_0x0f16('0x15')]));});});};exports[_0x0f16('0x21')]=function(_0x94dccc){var _0x3769e5=this;return new Promise(function(_0x18659c,_0x3c3e48){return db[_0x0f16('0x22')][_0x0f16('0x23')](_0x94dccc[_0x0f16('0x24')],{'raw':_0x94dccc[_0x0f16('0x18')]?_0x94dccc['options'][_0x0f16('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x94dccc['options']?_0x94dccc['options'][_0x0f16('0x1a')]||null:null,'attributes':_0x94dccc[_0x0f16('0x18')]?_0x94dccc[_0x0f16('0x18')]['attributes']||null:null,'limit':_0x94dccc[_0x0f16('0x18')]?_0x94dccc[_0x0f16('0x18')][_0x0f16('0x1c')]||null:null})['then'](function(_0x4b2800){logger[_0x0f16('0xd')](_0x0f16('0x21'),_0x94dccc);logger['debug'](_0x0f16('0x21'),_0x94dccc,JSON['stringify'](_0x4b2800));_0x18659c(_0x4b2800);})[_0x0f16('0x20')](function(_0x5512f6){logger[_0x0f16('0x13')](_0x0f16('0x21'),_0x5512f6['message'],_0x94dccc);_0x3c3e48(_0x3769e5[_0x0f16('0x13')](0x1f4,_0x5512f6[_0x0f16('0x15')]));});});};exports[_0x0f16('0x25')]=function(_0x3a4304){var _0x20028b=this;return new Promise(function(_0x136199,_0x2255e7){return db['CmHopperBlack'][_0x0f16('0x26')]({'where':_0x3a4304[_0x0f16('0x18')]?_0x3a4304['options']['where']||null:null})[_0x0f16('0xc')](function(_0x3ec7f8){logger[_0x0f16('0xd')]('DestroyCmHopperBlack',_0x3a4304);logger[_0x0f16('0x10')]('DestroyCmHopperBlack',_0x3a4304,JSON[_0x0f16('0x12')](_0x3ec7f8));_0x136199(_0x3ec7f8);})[_0x0f16('0x20')](function(_0x427cc3){logger['error'](_0x0f16('0x25'),_0x427cc3['message'],_0x3a4304);_0x2255e7(_0x20028b[_0x0f16('0x13')](0x1f4,_0x427cc3['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e812c2b..551f788 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 _0xb903=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id','exports','multer','util','path'];(function(_0x3f874b,_0xcec5e8){var _0x4fdcdc=function(_0x428c0a){while(--_0x428c0a){_0x3f874b['push'](_0x3f874b['shift']());}};_0x4fdcdc(++_0xcec5e8);}(_0xb903,0x185));var _0x3b90=function(_0x565097,_0x357d16){_0x565097=_0x565097-0x0;var _0xc22d81=_0xb903[_0x565097];return _0xc22d81;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var auth=require(_0x3b90('0x5'));var interaction=require(_0x3b90('0x6'));var config=require(_0x3b90('0x7'));var controller=require(_0x3b90('0x8'));router[_0x3b90('0x9')]('/',auth[_0x3b90('0xa')](),controller['index']);router[_0x3b90('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router[_0x3b90('0x9')](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['destroy']);module[_0x3b90('0xd')]=router; \ No newline at end of file +var _0x24ca=['describe','/:id','show','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x3ebcc4,_0x42bc04){var _0x37ff23=function(_0x32e0fe){while(--_0x32e0fe){_0x3ebcc4['push'](_0x3ebcc4['shift']());}};_0x37ff23(++_0x42bc04);}(_0x24ca,0x1bc));var _0xa24c=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x24ca[_0xf2662b];return _0x257dc7;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);module[_0xa24c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index abe2196..6410934 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 _0x3f32=['BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','diff','seconds','dispositionat'];(function(_0x4d975b,_0x416926){var _0x47f833=function(_0x307834){while(--_0x307834){_0x4d975b['push'](_0x4d975b['shift']());}};_0x47f833(++_0x416926);}(_0x3f32,0x160));var _0x23f3=function(_0x335bb1,_0x5aa97e){_0x335bb1=_0x335bb1-0x0;var _0x4c2fc7=_0x3f32[_0x335bb1];return _0x4c2fc7;};'use strict';var Sequelize=require(_0x23f3('0x0'));var moment=require(_0x23f3('0x1'));module[_0x23f3('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x23f3('0x3')]},'scheduledat':{'type':Sequelize[_0x23f3('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x23f3('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x23f3('0x3')]},'originatecalleridname':{'type':Sequelize[_0x23f3('0x3')]},'calleridnum':{'type':Sequelize[_0x23f3('0x3')]},'calleridname':{'type':Sequelize[_0x23f3('0x3')]},'starttime':{'type':Sequelize[_0x23f3('0x4')]},'responsetime':{'type':Sequelize[_0x23f3('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x23f3('0x4')]},'ringtime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x23f3('0x3')]},'campaign':{'type':Sequelize[_0x23f3('0x3')]},'campaigntype':{'type':Sequelize[_0x23f3('0x3')]},'membername':{'type':Sequelize[_0x23f3('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x23f3('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x23f3('0x3')]},'dispositionat':{'type':Sequelize[_0x23f3('0x4')],'set':function(_0x57783e){var _0xe91e09=this[_0x23f3('0x6')](_0x23f3('0x7'));if(_0xe91e09&&_0x57783e){this[_0x23f3('0x8')]('followuptime',moment(_0x57783e)[_0x23f3('0x9')](moment(_0xe91e09),_0x23f3('0xa')));}return this[_0x23f3('0x8')](_0x23f3('0xb'),_0x57783e);}},'amd':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x23f3('0x4')]},'callback':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x23f3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x23f3('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x23f3('0x4')]},'recallme':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x23f3('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8fcd=['exports','INTEGER','STRING','DATE','getDataValue','endtime','diff','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x53767b,_0x3aa30b){var _0x29f67b=function(_0xd1d3e8){while(--_0xd1d3e8){_0x53767b['push'](_0x53767b['shift']());}};_0x29f67b(++_0x3aa30b);}(_0x8fcd,0x13d));var _0xd8fc=function(_0x7e043a,_0x310c32){_0x7e043a=_0x7e043a-0x0;var _0x40ce67=_0x8fcd[_0x7e043a];return _0x40ce67;};'use strict';var Sequelize=require(_0xd8fc('0x0'));var moment=require(_0xd8fc('0x1'));module[_0xd8fc('0x2')]={'state':{'type':Sequelize[_0xd8fc('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd8fc('0x4')]},'scheduledat':{'type':Sequelize[_0xd8fc('0x5')]},'countbusyretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd8fc('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xd8fc('0x4')]},'calleridnum':{'type':Sequelize[_0xd8fc('0x4')]},'calleridname':{'type':Sequelize[_0xd8fc('0x4')]},'starttime':{'type':Sequelize[_0xd8fc('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd8fc('0x5')]},'endtime':{'type':Sequelize[_0xd8fc('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd8fc('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd8fc('0x4')]},'membername':{'type':Sequelize[_0xd8fc('0x4')]},'reason':{'type':Sequelize[_0xd8fc('0x4')]},'disposition':{'type':Sequelize[_0xd8fc('0x4')]},'secondDisposition':{'type':Sequelize[_0xd8fc('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd8fc('0x4')]},'dispositionat':{'type':Sequelize[_0xd8fc('0x5')],'set':function(_0x39f60b){var _0x2d8bfe=this[_0xd8fc('0x6')](_0xd8fc('0x7'));if(_0x2d8bfe&&_0x39f60b){this['setDataValue']('followuptime',moment(_0x39f60b)[_0xd8fc('0x8')](moment(_0x2d8bfe),'seconds'));}return this['setDataValue'](_0xd8fc('0x9'),_0x39f60b);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd8fc('0x5')]},'callback':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd8fc('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd8fc('0x5')]},'deleted':{'type':Sequelize[_0xd8fc('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd8fc('0x5')]},'recallme':{'type':Sequelize[_0xd8fc('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd8fc('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd8fc('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index f05b3eb..c85558c 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 _0x01fe=['Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','state\x20=\x204','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','CmHopperFinal','findAll','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','moveContactsIvrCampaignHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01fe,0x102));var _0xe01f=function(_0x5b043d,_0xa4f184){_0x5b043d=_0x5b043d-0x0;var _0x32a0c1=_0x01fe[_0x5b043d];return _0x32a0c1;};'use strict';var pdf=require(_0xe01f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe01f('0x1'));var zipdir=require(_0xe01f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe01f('0x3'));var BPromise=require(_0xe01f('0x4'));var Mustache=require(_0xe01f('0x5'));var util=require(_0xe01f('0x6'));var path=require('path');var sox=require(_0xe01f('0x7'));var csv=require('to-csv');var ejs=require(_0xe01f('0x8'));var fs=require('fs');var _=require(_0xe01f('0x9'));var squel=require(_0xe01f('0xa'));var crypto=require(_0xe01f('0xb'));var jsforce=require(_0xe01f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe01f('0xd'));var querystring=require(_0xe01f('0xe'));var Papa=require('papaparse');var Redis=require(_0xe01f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe01f('0x10'));var as=require(_0xe01f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe01f('0x12'))('api');var utils=require(_0xe01f('0x13'));var config=require(_0xe01f('0x14'));var licenseUtil=require(_0xe01f('0x15'));var db=require(_0xe01f('0x16'))['db'];function respondWithStatusCode(_0x2d3162,_0x94e3d8){_0x94e3d8=_0x94e3d8||0xcc;return function(_0x81aef3){if(_0x81aef3){return _0x2d3162[_0xe01f('0x17')](_0x94e3d8);}return _0x2d3162['status'](_0x94e3d8)[_0xe01f('0x18')]();};}function respondWithResult(_0x3a9b4b,_0x2d55c8){_0x2d55c8=_0x2d55c8||0xc8;return function(_0x3cb8ac){if(_0x3cb8ac){return _0x3a9b4b[_0xe01f('0x19')](_0x2d55c8)[_0xe01f('0x1a')](_0x3cb8ac);}};}function respondWithFilteredResult(_0x664fbb,_0x5e5e30){return function(_0x53d3a1){if(_0x53d3a1){var _0x5e3877=_0x53d3a1[_0xe01f('0x1b')],_0x12540b=_0x5e5e30[_0xe01f('0x1c')],_0x14b05d=_0x5e5e30[_0xe01f('0x1c')]+_0x5e5e30[_0xe01f('0x1d')],_0x88606f;if(_0x14b05d>=_0x5e3877){_0x14b05d=_0x5e3877;_0x88606f=0xc8;}else{_0x88606f=0xce;}_0x664fbb[_0xe01f('0x19')](_0x88606f);return _0x664fbb[_0xe01f('0x1e')](_0xe01f('0x1f'),_0x12540b+'-'+_0x14b05d+'/'+_0x5e3877)['json'](_0x53d3a1);}return null;};}function patchUpdates(_0x23e52a){return function(_0x5ca305){try{jsonpatch[_0xe01f('0x20')](_0x5ca305,_0x23e52a,!![]);}catch(_0x138fdf){return BPromise[_0xe01f('0x21')](_0x138fdf);}return _0x5ca305[_0xe01f('0x22')]();};}function saveUpdates(_0x5e9523,_0x32a6b9){return function(_0xb9343e){if(_0xb9343e){return _0xb9343e[_0xe01f('0x23')](_0x5e9523)[_0xe01f('0x24')](function(_0x369b7e){return _0x369b7e;});}return null;};}function removeEntity(_0x3c34fa,_0x570d48){return function(_0x1faeb8){if(_0x1faeb8){return _0x1faeb8[_0xe01f('0x25')]()[_0xe01f('0x24')](function(){_0x3c34fa[_0xe01f('0x19')](0xcc)[_0xe01f('0x18')]();});}};}function handleEntityNotFound(_0x38efcc,_0x1ea55b){return function(_0x51b683){if(!_0x51b683){_0x38efcc[_0xe01f('0x17')](0x194);}return _0x51b683;};}function handleError(_0x4b44b6,_0x4d54ce){_0x4d54ce=_0x4d54ce||0x1f4;return function(_0x3138d3){logger[_0xe01f('0x26')](_0x3138d3[_0xe01f('0x27')]);if(_0x3138d3[_0xe01f('0x28')]){delete _0x3138d3['name'];}_0x4b44b6[_0xe01f('0x19')](_0x4d54ce)[_0xe01f('0x29')](_0x3138d3);};}exports['index']=function(_0x378c93,_0x5b9c5e){var _0x1b77c8={},_0x387044={},_0x13dcd4={'count':0x0,'rows':[]};var _0x4b85b8=_[_0xe01f('0x2a')](db['CmHopperFinal'][_0xe01f('0x2b')],function(_0x232ad1){return{'name':_0x232ad1[_0xe01f('0x2c')],'type':_0x232ad1[_0xe01f('0x2d')][_0xe01f('0x2e')]};});_0x387044[_0xe01f('0x2f')]=_[_0xe01f('0x2a')](_0x4b85b8,_0xe01f('0x28'));_0x387044[_0xe01f('0x30')]=_['keys'](_0x378c93[_0xe01f('0x30')]);_0x387044['filters']=_[_0xe01f('0x31')](_0x387044[_0xe01f('0x2f')],_0x387044['query']);_0x1b77c8[_0xe01f('0x32')]=_[_0xe01f('0x31')](_0x387044[_0xe01f('0x2f')],qs['fields'](_0x378c93[_0xe01f('0x30')][_0xe01f('0x33')]));_0x1b77c8[_0xe01f('0x32')]=_0x1b77c8[_0xe01f('0x32')][_0xe01f('0x34')]?_0x1b77c8['attributes']:_0x387044['model'];if(!_0x378c93['query'][_0xe01f('0x35')]('nolimit')){_0x1b77c8[_0xe01f('0x1d')]=qs[_0xe01f('0x1d')](_0x378c93[_0xe01f('0x30')][_0xe01f('0x1d')]);_0x1b77c8[_0xe01f('0x1c')]=qs[_0xe01f('0x1c')](_0x378c93[_0xe01f('0x30')][_0xe01f('0x1c')]);}_0x1b77c8['order']=qs['sort'](_0x378c93[_0xe01f('0x30')][_0xe01f('0x36')]);_0x1b77c8[_0xe01f('0x37')]=qs[_0xe01f('0x38')](_['pick'](_0x378c93[_0xe01f('0x30')],_0x387044[_0xe01f('0x38')]),_0x4b85b8);if(_0x378c93[_0xe01f('0x30')]['filter']){_0x1b77c8[_0xe01f('0x37')]=_[_0xe01f('0x39')](_0x1b77c8[_0xe01f('0x37')],{'$or':_[_0xe01f('0x2a')](_0x4b85b8,function(_0xddb14b){if(_0xddb14b[_0xe01f('0x2d')]!==_0xe01f('0x3a')){var _0x2b102c={};_0x2b102c[_0xddb14b[_0xe01f('0x28')]]={'$like':'%'+_0x378c93[_0xe01f('0x30')][_0xe01f('0x3b')]+'%'};return _0x2b102c;}})});}_0x1b77c8=_[_0xe01f('0x39')]({},_0x1b77c8,_0x378c93[_0xe01f('0x3c')]);var _0x268184={'where':_0x1b77c8[_0xe01f('0x37')]};return db['CmHopperFinal'][_0xe01f('0x1b')](_0x268184)[_0xe01f('0x24')](function(_0x1deac7){_0x13dcd4[_0xe01f('0x1b')]=_0x1deac7;if(_0x378c93['query'][_0xe01f('0x3d')]){_0x1b77c8[_0xe01f('0x3e')]=[{'all':!![]}];}return db[_0xe01f('0x3f')][_0xe01f('0x40')](_0x1b77c8);})[_0xe01f('0x24')](function(_0x31dc11){_0x13dcd4['rows']=_0x31dc11;return _0x13dcd4;})[_0xe01f('0x24')](respondWithFilteredResult(_0x5b9c5e,_0x1b77c8))[_0xe01f('0x41')](handleError(_0x5b9c5e,null));};exports[_0xe01f('0x42')]=function(_0x41d9fa,_0x20421f){var _0x18c42e={'raw':!![],'where':{'id':_0x41d9fa[_0xe01f('0x43')]['id']}},_0x861971={};_0x861971[_0xe01f('0x2f')]=_['keys'](db['CmHopperFinal'][_0xe01f('0x2b')]);_0x861971[_0xe01f('0x30')]=_['keys'](_0x41d9fa[_0xe01f('0x30')]);_0x861971[_0xe01f('0x38')]=_[_0xe01f('0x31')](_0x861971['model'],_0x861971[_0xe01f('0x30')]);_0x18c42e[_0xe01f('0x32')]=_['intersection'](_0x861971['model'],qs['fields'](_0x41d9fa[_0xe01f('0x30')]['fields']));_0x18c42e[_0xe01f('0x32')]=_0x18c42e['attributes'][_0xe01f('0x34')]?_0x18c42e[_0xe01f('0x32')]:_0x861971[_0xe01f('0x2f')];if(_0x41d9fa[_0xe01f('0x30')][_0xe01f('0x3d')]){_0x18c42e[_0xe01f('0x3e')]=[{'all':!![]}];}_0x18c42e=_[_0xe01f('0x39')]({},_0x18c42e,_0x41d9fa[_0xe01f('0x3c')]);return db[_0xe01f('0x3f')][_0xe01f('0x44')](_0x18c42e)[_0xe01f('0x24')](handleEntityNotFound(_0x20421f,null))['then'](respondWithResult(_0x20421f,null))[_0xe01f('0x41')](handleError(_0x20421f,null));};exports[_0xe01f('0x45')]=function(_0x448507,_0x3c3d64){return db[_0xe01f('0x3f')]['describe']()[_0xe01f('0x24')](respondWithResult(_0x3c3d64,null))['catch'](handleError(_0x3c3d64,null));};exports['update']=function(_0x25437f,_0x393879){if(_0x25437f[_0xe01f('0x46')][_0xe01f('0x47')]){delete _0x25437f[_0xe01f('0x46')]['uniqueid'];}return db[_0xe01f('0x3f')][_0xe01f('0x44')]({'where':{'uniqueid':_0x25437f[_0xe01f('0x43')]['id']}})[_0xe01f('0x24')](handleEntityNotFound(_0x393879,null))[_0xe01f('0x24')](saveUpdates(_0x25437f[_0xe01f('0x46')],null))[_0xe01f('0x24')](respondWithResult(_0x393879,null))['catch'](handleError(_0x393879,null));};exports[_0xe01f('0x48')]=function(_0x51e5c6,_0x17580b,_0x204464){return db['CmHopperFinal'][_0xe01f('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x51e5c6[_0xe01f('0x43')]['id']},'attributes':[[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xe01f('0x4b')],[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x4d')))),_0xe01f('0x4e')],[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x4f')))),_0xe01f('0x50')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x52')))),_0xe01f('0x53')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0xe01f('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xe01f('0x54')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x55')))),_0xe01f('0x56')],[db['sequelize']['fn'](_0xe01f('0x4a'),db['sequelize']['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x57')))),_0xe01f('0x58')]]})[_0xe01f('0x24')](handleEntityNotFound(_0x17580b,null))[_0xe01f('0x24')](respondWithResult(_0x17580b,null))[_0xe01f('0x41')](handleError(_0x17580b,null));};exports[_0xe01f('0x59')]=function(_0x3dc61a,_0x5a33e,_0x5d51e5){return db[_0xe01f('0x3f')][_0xe01f('0x40')]({'raw':![],'where':{'CampaignId':_0x3dc61a['params']['id']},'attributes':[[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x5a')))),'noSuchContacts'],[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x4d')))),_0xe01f('0x4e')],[db[_0xe01f('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x4f')))),'busyContacts'],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db['sequelize']['literal'](_0xe01f('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x52')))),_0xe01f('0x53')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0xe01f('0x56')],[db['sequelize']['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xe01f('0x24')](handleEntityNotFound(_0x5a33e,null))['then'](respondWithResult(_0x5a33e,null))[_0xe01f('0x41')](handleError(_0x5a33e,null));};exports[_0xe01f('0x5b')]=function(_0x5e24be,_0x427d5f,_0x42d607){return db[_0xe01f('0x5c')][_0xe01f('0x44')]({'where':{'id':_0x5e24be[_0xe01f('0x43')]['id']}})['then'](handleEntityNotFound(_0x427d5f,null))[_0xe01f('0x24')](function(_0x1c9cbf){var _0x5cd7bd;if(_0x1c9cbf){_0x5cd7bd=squel[_0xe01f('0x5d')]()[_0xe01f('0x5e')](_0xe01f('0x5f'))[_0xe01f('0x60')]([_0xe01f('0x61'),_0xe01f('0x62'),_0xe01f('0x63'),_0xe01f('0x64'),_0xe01f('0x65'),_0xe01f('0x66'),_0xe01f('0x67')],squel[_0xe01f('0x68')]()['field'](_0xe01f('0x69'),_0xe01f('0x61'))[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x62'))['field'](_0xe01f('0x6c'),'ContactId')[_0xe01f('0x6a')](_0xe01f('0x6d'),_0xe01f('0x64'))['field'](_0xe01f('0x6e'),_0xe01f('0x65'))[_0xe01f('0x6a')](_0xe01f('0x6b'),'createdAt')[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x67'))[_0xe01f('0x6f')](_0xe01f('0x70'))[_0xe01f('0x37')]('VoiceQueueId\x20=\x20?',_0x5e24be['params']['id'][_0xe01f('0x71')]())[_0xe01f('0x37')](_0xe01f('0x72'),_0x5e24be['body']['state'][_0xe01f('0x71')]())[_0xe01f('0x37')](_0xe01f('0x73'))[_0xe01f('0x37')](_0xe01f('0x74'),squel[_0xe01f('0x68')]()[_0xe01f('0x6a')](_0xe01f('0x61'))[_0xe01f('0x6f')]('cm_hopper')[_0xe01f('0x37')](_0xe01f('0x75'),_0x5e24be[_0xe01f('0x43')]['id'][_0xe01f('0x71')]()))[_0xe01f('0x37')](_0xe01f('0x74'),squel[_0xe01f('0x68')]()[_0xe01f('0x6a')](_0xe01f('0x76'))[_0xe01f('0x6f')]('cm_hopper_final')[_0xe01f('0x37')](_0xe01f('0x75'),_0x5e24be['params']['id'][_0xe01f('0x71')]())[_0xe01f('0x37')]('state\x20=\x204'))['group']('ContactId'))['toString']();return db[_0xe01f('0x49')][_0xe01f('0x30')](_0x5cd7bd);}return[];})['then'](respondWithResult(_0x427d5f,null))[_0xe01f('0x41')](handleError(_0x427d5f,null));};exports[_0xe01f('0x77')]=function(_0x3ca351,_0x58ddd0,_0x29869b){return db[_0xe01f('0x78')][_0xe01f('0x44')]({'where':{'id':_0x3ca351[_0xe01f('0x43')]['id']}})[_0xe01f('0x24')](handleEntityNotFound(_0x58ddd0,null))['then'](function(_0x256f4b){var _0x753543;if(_0x256f4b){_0x753543=squel[_0xe01f('0x5d')]()[_0xe01f('0x5e')](_0xe01f('0x5f'))['fromQuery']([_0xe01f('0x61'),_0xe01f('0x62'),'ContactId',_0xe01f('0x64'),_0xe01f('0x79'),_0xe01f('0x66'),_0xe01f('0x67')],squel[_0xe01f('0x68')]()[_0xe01f('0x6a')](_0xe01f('0x69'),'phone')[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x62'))[_0xe01f('0x6a')](_0xe01f('0x6c'),_0xe01f('0x63'))[_0xe01f('0x6a')](_0xe01f('0x6d'),_0xe01f('0x64'))[_0xe01f('0x6a')](_0xe01f('0x7a'),_0xe01f('0x79'))[_0xe01f('0x6a')]('NOW()','createdAt')[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x67'))[_0xe01f('0x6f')](_0xe01f('0x70'))[_0xe01f('0x37')](_0xe01f('0x7b'),_0x3ca351[_0xe01f('0x43')]['id']['toString']())[_0xe01f('0x37')]('state\x20=\x20?',_0x3ca351[_0xe01f('0x46')][_0xe01f('0x7c')][_0xe01f('0x71')]())['where'](_0xe01f('0x73'))[_0xe01f('0x37')](_0xe01f('0x74'),squel[_0xe01f('0x68')]()[_0xe01f('0x6a')]('phone')['from']('cm_hopper')[_0xe01f('0x37')](_0xe01f('0x7b'),_0x3ca351[_0xe01f('0x43')]['id']['toString']()))[_0xe01f('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xe01f('0x6a')](_0xe01f('0x76'))[_0xe01f('0x6f')](_0xe01f('0x70'))[_0xe01f('0x37')](_0xe01f('0x7b'),_0x3ca351['params']['id'][_0xe01f('0x71')]())['where'](_0xe01f('0x7d')))['group'](_0xe01f('0x63')))[_0xe01f('0x71')]();return db['sequelize'][_0xe01f('0x30')](_0x753543);}return[];})[_0xe01f('0x24')](respondWithResult(_0x58ddd0,null))['catch'](handleError(_0x58ddd0,null));};exports['checkContactHopper']=function(_0x49d44b,_0x4f56e8,_0xb43191){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x49d44b['body']['VoiceQueueId'],'CampaignId':_0x49d44b[_0xe01f('0x46')][_0xe01f('0x79')],'ContactId':_0x49d44b[_0xe01f('0x46')][_0xe01f('0x63')]}})[_0xe01f('0x24')](handleEntityNotFound(_0x4f56e8,null))[_0xe01f('0x24')](function(_0xb8a43d){if(_0xb8a43d){return _0xb8a43d;}return null;})[_0xe01f('0x24')](respondWithResult(_0x4f56e8,null))[_0xe01f('0x41')](handleError(_0x4f56e8,null));}; \ No newline at end of file +var _0xda55=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','params','keys','fields','find','catch','describe','body','uniqueid','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','from','state\x20=\x204','moveContactsIvrCampaignHopperFinal','fromQuery','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xf4b5ec,_0x558d12){var _0x38cbc0=function(_0x7d62c9){while(--_0x7d62c9){_0xf4b5ec['push'](_0xf4b5ec['shift']());}};_0x38cbc0(++_0x558d12);}(_0xda55,0x6d));var _0x5da5=function(_0x475bec,_0x21dd89){_0x475bec=_0x475bec-0x0;var _0x28636b=_0xda55[_0x475bec];return _0x28636b;};'use strict';var pdf=require(_0x5da5('0x0'));var emlformat=require(_0x5da5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5da5('0x2'));var rp=require(_0x5da5('0x3'));var moment=require(_0x5da5('0x4'));var BPromise=require(_0x5da5('0x5'));var Mustache=require(_0x5da5('0x6'));var util=require('util');var path=require(_0x5da5('0x7'));var sox=require('sox');var csv=require(_0x5da5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5da5('0x9'));var squel=require(_0x5da5('0xa'));var crypto=require(_0x5da5('0xb'));var jsforce=require(_0x5da5('0xc'));var deskjs=require(_0x5da5('0xd'));var toCsv=require(_0x5da5('0x8'));var querystring=require(_0x5da5('0xe'));var Papa=require(_0x5da5('0xf'));var Redis=require('ioredis');var authService=require(_0x5da5('0x10'));var qs=require(_0x5da5('0x11'));var as=require(_0x5da5('0x12'));var hardwareService=require(_0x5da5('0x13'));var logger=require(_0x5da5('0x14'))(_0x5da5('0x15'));var utils=require(_0x5da5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5da5('0x17'));var db=require(_0x5da5('0x18'))['db'];function respondWithStatusCode(_0x4f813b,_0x37aeb0){_0x37aeb0=_0x37aeb0||0xcc;return function(_0x31366e){if(_0x31366e){return _0x4f813b[_0x5da5('0x19')](_0x37aeb0);}return _0x4f813b[_0x5da5('0x1a')](_0x37aeb0)[_0x5da5('0x1b')]();};}function respondWithResult(_0x440b8f,_0x481562){_0x481562=_0x481562||0xc8;return function(_0x489b60){if(_0x489b60){return _0x440b8f['status'](_0x481562)[_0x5da5('0x1c')](_0x489b60);}};}function respondWithFilteredResult(_0x126fc8,_0x13c701){return function(_0x665ce8){if(_0x665ce8){var _0x11bd3=_0x665ce8[_0x5da5('0x1d')],_0x134afa=_0x13c701[_0x5da5('0x1e')],_0x3aff51=_0x13c701[_0x5da5('0x1e')]+_0x13c701[_0x5da5('0x1f')],_0x4a952a;if(_0x3aff51>=_0x11bd3){_0x3aff51=_0x11bd3;_0x4a952a=0xc8;}else{_0x4a952a=0xce;}_0x126fc8[_0x5da5('0x1a')](_0x4a952a);return _0x126fc8[_0x5da5('0x20')]('Content-Range',_0x134afa+'-'+_0x3aff51+'/'+_0x11bd3)[_0x5da5('0x1c')](_0x665ce8);}return null;};}function patchUpdates(_0x3766ee){return function(_0x3d3d26){try{jsonpatch[_0x5da5('0x21')](_0x3d3d26,_0x3766ee,!![]);}catch(_0xf023af){return BPromise['reject'](_0xf023af);}return _0x3d3d26[_0x5da5('0x22')]();};}function saveUpdates(_0x3372fc,_0x42a3cb){return function(_0x560ea7){if(_0x560ea7){return _0x560ea7[_0x5da5('0x23')](_0x3372fc)[_0x5da5('0x24')](function(_0x20c8a6){return _0x20c8a6;});}return null;};}function removeEntity(_0x2e68d5,_0xec69f2){return function(_0x436960){if(_0x436960){return _0x436960['destroy']()[_0x5da5('0x24')](function(){_0x2e68d5['status'](0xcc)[_0x5da5('0x1b')]();});}};}function handleEntityNotFound(_0x716ab7,_0x2dd138){return function(_0x5d983c){if(!_0x5d983c){_0x716ab7[_0x5da5('0x19')](0x194);}return _0x5d983c;};}function handleError(_0x236bf3,_0x39dd93){_0x39dd93=_0x39dd93||0x1f4;return function(_0x21e795){logger['error'](_0x21e795['stack']);if(_0x21e795['name']){delete _0x21e795[_0x5da5('0x25')];}_0x236bf3['status'](_0x39dd93)['send'](_0x21e795);};}exports[_0x5da5('0x26')]=function(_0x3974d8,_0x5740a7){var _0x1798ae={},_0x1ab83e={},_0x558b12={'count':0x0,'rows':[]};var _0x3b815e=_[_0x5da5('0x27')](db[_0x5da5('0x28')][_0x5da5('0x29')],function(_0x766ed9){return{'name':_0x766ed9['fieldName'],'type':_0x766ed9[_0x5da5('0x2a')][_0x5da5('0x2b')]};});_0x1ab83e[_0x5da5('0x2c')]=_[_0x5da5('0x27')](_0x3b815e,'name');_0x1ab83e['query']=_['keys'](_0x3974d8[_0x5da5('0x2d')]);_0x1ab83e[_0x5da5('0x2e')]=_[_0x5da5('0x2f')](_0x1ab83e[_0x5da5('0x2c')],_0x1ab83e['query']);_0x1798ae['attributes']=_[_0x5da5('0x2f')](_0x1ab83e['model'],qs['fields'](_0x3974d8[_0x5da5('0x2d')]['fields']));_0x1798ae[_0x5da5('0x30')]=_0x1798ae[_0x5da5('0x30')][_0x5da5('0x31')]?_0x1798ae[_0x5da5('0x30')]:_0x1ab83e[_0x5da5('0x2c')];if(!_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x32')](_0x5da5('0x33'))){_0x1798ae['limit']=qs[_0x5da5('0x1f')](_0x3974d8['query'][_0x5da5('0x1f')]);_0x1798ae[_0x5da5('0x1e')]=qs[_0x5da5('0x1e')](_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x1e')]);}_0x1798ae[_0x5da5('0x34')]=qs[_0x5da5('0x35')](_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x35')]);_0x1798ae[_0x5da5('0x36')]=qs[_0x5da5('0x2e')](_[_0x5da5('0x37')](_0x3974d8[_0x5da5('0x2d')],_0x1ab83e['filters']),_0x3b815e);if(_0x3974d8[_0x5da5('0x2d')]['filter']){_0x1798ae[_0x5da5('0x36')]=_[_0x5da5('0x38')](_0x1798ae[_0x5da5('0x36')],{'$or':_[_0x5da5('0x27')](_0x3b815e,function(_0x59c92e){if(_0x59c92e[_0x5da5('0x2a')]!==_0x5da5('0x39')){var _0x22e26a={};_0x22e26a[_0x59c92e['name']]={'$like':'%'+_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x3a')]+'%'};return _0x22e26a;}})});}_0x1798ae=_['merge']({},_0x1798ae,_0x3974d8[_0x5da5('0x3b')]);var _0xa90d5={'where':_0x1798ae[_0x5da5('0x36')]};return db[_0x5da5('0x28')][_0x5da5('0x1d')](_0xa90d5)[_0x5da5('0x24')](function(_0x52a902){_0x558b12[_0x5da5('0x1d')]=_0x52a902;if(_0x3974d8[_0x5da5('0x2d')][_0x5da5('0x3c')]){_0x1798ae[_0x5da5('0x3d')]=[{'all':!![]}];}return db[_0x5da5('0x28')]['findAll'](_0x1798ae);})[_0x5da5('0x24')](function(_0x21ffa1){_0x558b12['rows']=_0x21ffa1;return _0x558b12;})[_0x5da5('0x24')](respondWithFilteredResult(_0x5740a7,_0x1798ae))['catch'](handleError(_0x5740a7,null));};exports['show']=function(_0x1da9ef,_0x21c579){var _0x2f6026={'raw':!![],'where':{'id':_0x1da9ef[_0x5da5('0x3e')]['id']}},_0x29d9a7={};_0x29d9a7[_0x5da5('0x2c')]=_[_0x5da5('0x3f')](db[_0x5da5('0x28')][_0x5da5('0x29')]);_0x29d9a7[_0x5da5('0x2d')]=_[_0x5da5('0x3f')](_0x1da9ef[_0x5da5('0x2d')]);_0x29d9a7[_0x5da5('0x2e')]=_[_0x5da5('0x2f')](_0x29d9a7[_0x5da5('0x2c')],_0x29d9a7[_0x5da5('0x2d')]);_0x2f6026[_0x5da5('0x30')]=_[_0x5da5('0x2f')](_0x29d9a7[_0x5da5('0x2c')],qs[_0x5da5('0x40')](_0x1da9ef['query']['fields']));_0x2f6026[_0x5da5('0x30')]=_0x2f6026[_0x5da5('0x30')]['length']?_0x2f6026[_0x5da5('0x30')]:_0x29d9a7[_0x5da5('0x2c')];if(_0x1da9ef[_0x5da5('0x2d')][_0x5da5('0x3c')]){_0x2f6026[_0x5da5('0x3d')]=[{'all':!![]}];}_0x2f6026=_[_0x5da5('0x38')]({},_0x2f6026,_0x1da9ef[_0x5da5('0x3b')]);return db[_0x5da5('0x28')][_0x5da5('0x41')](_0x2f6026)[_0x5da5('0x24')](handleEntityNotFound(_0x21c579,null))['then'](respondWithResult(_0x21c579,null))[_0x5da5('0x42')](handleError(_0x21c579,null));};exports['describe']=function(_0x4c6bbf,_0x2a0fb6){return db[_0x5da5('0x28')][_0x5da5('0x43')]()[_0x5da5('0x24')](respondWithResult(_0x2a0fb6,null))[_0x5da5('0x42')](handleError(_0x2a0fb6,null));};exports[_0x5da5('0x23')]=function(_0x5aa561,_0x216d06){if(_0x5aa561['body']['uniqueid']){delete _0x5aa561[_0x5da5('0x44')][_0x5da5('0x45')];}return db['CmHopperFinal'][_0x5da5('0x41')]({'where':{'uniqueid':_0x5aa561[_0x5da5('0x3e')]['id']}})[_0x5da5('0x24')](handleEntityNotFound(_0x216d06,null))[_0x5da5('0x24')](saveUpdates(_0x5aa561[_0x5da5('0x44')],null))['then'](respondWithResult(_0x216d06,null))[_0x5da5('0x42')](handleError(_0x216d06,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x535b22,_0x361f5f,_0x57eca7){return db[_0x5da5('0x28')][_0x5da5('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x535b22[_0x5da5('0x3e')]['id']},'attributes':[[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db['sequelize']['literal'](_0x5da5('0x49')))),_0x5da5('0x4a')],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db['sequelize'][_0x5da5('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')]['literal'](_0x5da5('0x4c')))),_0x5da5('0x4d')],[db[_0x5da5('0x47')]['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x4e')))),_0x5da5('0x4f')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x50')))),_0x5da5('0x51')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x52')))),_0x5da5('0x53')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db['sequelize']['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x5da5('0x54')]]})[_0x5da5('0x24')](handleEntityNotFound(_0x361f5f,null))[_0x5da5('0x24')](respondWithResult(_0x361f5f,null))[_0x5da5('0x42')](handleError(_0x361f5f,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x2a4b26,_0x3eeff3,_0x34b4b0){return db['CmHopperFinal'][_0x5da5('0x46')]({'raw':![],'where':{'CampaignId':_0x2a4b26['params']['id']},'attributes':[[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x49')))),_0x5da5('0x4a')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x55')))),_0x5da5('0x56')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x4c')))),_0x5da5('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5da5('0x4f')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db['sequelize'][_0x5da5('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5da5('0x51')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x52')))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x47')]['fn']('IF',db[_0x5da5('0x47')][_0x5da5('0x4b')](_0x5da5('0x57')))),_0x5da5('0x58')],[db[_0x5da5('0x47')]['fn'](_0x5da5('0x48'),db[_0x5da5('0x47')]['fn']('IF',db['sequelize'][_0x5da5('0x4b')](_0x5da5('0x59')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x3eeff3,null))[_0x5da5('0x24')](respondWithResult(_0x3eeff3,null))['catch'](handleError(_0x3eeff3,null));};exports[_0x5da5('0x5a')]=function(_0x4f7e64,_0x2adeab,_0x784515){return db[_0x5da5('0x5b')][_0x5da5('0x41')]({'where':{'id':_0x4f7e64[_0x5da5('0x3e')]['id']}})[_0x5da5('0x24')](handleEntityNotFound(_0x2adeab,null))[_0x5da5('0x24')](function(_0x1bffae){var _0x12ef38;if(_0x1bffae){_0x12ef38=squel[_0x5da5('0x5c')]()[_0x5da5('0x5d')](_0x5da5('0x5e'))['fromQuery'](['phone',_0x5da5('0x5f'),_0x5da5('0x60'),_0x5da5('0x61'),_0x5da5('0x62'),'createdAt','updatedAt'],squel['select']()[_0x5da5('0x63')](_0x5da5('0x64'),_0x5da5('0x65'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x5f'))[_0x5da5('0x63')](_0x5da5('0x67'),_0x5da5('0x60'))[_0x5da5('0x63')](_0x5da5('0x68'),_0x5da5('0x61'))[_0x5da5('0x63')](_0x5da5('0x69'),_0x5da5('0x62'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6a'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6b'))['from'](_0x5da5('0x6c'))[_0x5da5('0x36')](_0x5da5('0x6d'),_0x4f7e64[_0x5da5('0x3e')]['id']['toString']())['where'](_0x5da5('0x6e'),_0x4f7e64['body'][_0x5da5('0x6f')][_0x5da5('0x70')]())[_0x5da5('0x36')](_0x5da5('0x71'))[_0x5da5('0x36')](_0x5da5('0x72'),squel[_0x5da5('0x73')]()[_0x5da5('0x63')](_0x5da5('0x65'))['from'](_0x5da5('0x5e'))['where'](_0x5da5('0x6d'),_0x4f7e64[_0x5da5('0x3e')]['id']['toString']()))[_0x5da5('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5da5('0x73')]()['field'](_0x5da5('0x74'))[_0x5da5('0x75')](_0x5da5('0x6c'))[_0x5da5('0x36')](_0x5da5('0x6d'),_0x4f7e64[_0x5da5('0x3e')]['id'][_0x5da5('0x70')]())[_0x5da5('0x36')](_0x5da5('0x76')))['group'](_0x5da5('0x60')))[_0x5da5('0x70')]();return db['sequelize']['query'](_0x12ef38);}return[];})[_0x5da5('0x24')](respondWithResult(_0x2adeab,null))[_0x5da5('0x42')](handleError(_0x2adeab,null));};exports[_0x5da5('0x77')]=function(_0xcc15e9,_0x4e9104,_0x1ba732){return db['Campaign'][_0x5da5('0x41')]({'where':{'id':_0xcc15e9['params']['id']}})['then'](handleEntityNotFound(_0x4e9104,null))[_0x5da5('0x24')](function(_0x5372f2){var _0x54ad39;if(_0x5372f2){_0x54ad39=squel[_0x5da5('0x5c')]()[_0x5da5('0x5d')](_0x5da5('0x5e'))[_0x5da5('0x78')]([_0x5da5('0x65'),_0x5da5('0x5f'),_0x5da5('0x60'),_0x5da5('0x61'),'CampaignId',_0x5da5('0x6a'),_0x5da5('0x6b')],squel[_0x5da5('0x73')]()[_0x5da5('0x63')](_0x5da5('0x64'),_0x5da5('0x65'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x5f'))[_0x5da5('0x63')](_0x5da5('0x67'),_0x5da5('0x60'))[_0x5da5('0x63')](_0x5da5('0x68'),_0x5da5('0x61'))[_0x5da5('0x63')](_0x5da5('0x79'),_0x5da5('0x7a'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6a'))[_0x5da5('0x63')](_0x5da5('0x66'),_0x5da5('0x6b'))['from'](_0x5da5('0x6c'))[_0x5da5('0x36')]('CampaignId\x20=\x20?',_0xcc15e9[_0x5da5('0x3e')]['id']['toString']())[_0x5da5('0x36')](_0x5da5('0x6e'),_0xcc15e9[_0x5da5('0x44')][_0x5da5('0x6f')][_0x5da5('0x70')]())[_0x5da5('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5da5('0x36')](_0x5da5('0x72'),squel['select']()[_0x5da5('0x63')](_0x5da5('0x65'))['from'](_0x5da5('0x5e'))[_0x5da5('0x36')](_0x5da5('0x7b'),_0xcc15e9[_0x5da5('0x3e')]['id'][_0x5da5('0x70')]()))[_0x5da5('0x36')](_0x5da5('0x72'),squel[_0x5da5('0x73')]()[_0x5da5('0x63')](_0x5da5('0x74'))['from'](_0x5da5('0x6c'))[_0x5da5('0x36')](_0x5da5('0x7b'),_0xcc15e9[_0x5da5('0x3e')]['id'][_0x5da5('0x70')]())[_0x5da5('0x36')](_0x5da5('0x76')))['group']('ContactId'))[_0x5da5('0x70')]();return db['sequelize']['query'](_0x54ad39);}return[];})[_0x5da5('0x24')](respondWithResult(_0x4e9104,null))['catch'](handleError(_0x4e9104,null));};exports[_0x5da5('0x7c')]=function(_0x59295f,_0xdc3a74,_0x2bb795){return db[_0x5da5('0x7d')][_0x5da5('0x7e')]({'where':{'VoiceQueueId':_0x59295f['body'][_0x5da5('0x62')],'CampaignId':_0x59295f[_0x5da5('0x44')][_0x5da5('0x7a')],'ContactId':_0x59295f[_0x5da5('0x44')][_0x5da5('0x60')]}})[_0x5da5('0x24')](handleEntityNotFound(_0xdc3a74,null))[_0x5da5('0x24')](function(_0x11bb6c){if(_0x11bb6c){return _0x11bb6c;}return null;})['then'](respondWithResult(_0xdc3a74,null))[_0x5da5('0x42')](handleError(_0xdc3a74,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index e363357..2720130 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 _0x5aa2=['uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x161820,_0x3fdcd7){var _0x59df65=function(_0x48614c){while(--_0x48614c){_0x161820['push'](_0x161820['shift']());}};_0x59df65(++_0x3fdcd7);}(_0x5aa2,0x1e1));var _0x25aa=function(_0x336fad,_0x11eb94){_0x336fad=_0x336fad-0x0;var _0x415fd0=_0x5aa2[_0x336fad];return _0x415fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x25aa('0x0'))(_0x25aa('0x1'));var moment=require(_0x25aa('0x2'));var BPromise=require('bluebird');var rp=require(_0x25aa('0x3'));var fs=require('fs');var path=require(_0x25aa('0x4'));var rimraf=require(_0x25aa('0x5'));var config=require(_0x25aa('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x25aa('0x7')]=function(_0x546be6,_0x4773e3){return _0x546be6['define'](_0x25aa('0x8'),attributes,{'tableName':_0x25aa('0x9'),'paranoid':![],'indexes':[{'name':_0x25aa('0xa'),'fields':[_0x25aa('0xa')]},{'name':_0x25aa('0xb'),'fields':[_0x25aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fd4=['rimraf','../../config/environment','CmHopperFinal','cm_hopper_final','calleridnum','util','bluebird'];(function(_0x14c4f2,_0x4df4b1){var _0x255998=function(_0xb6209b){while(--_0xb6209b){_0x14c4f2['push'](_0x14c4f2['shift']());}};_0x255998(++_0x4df4b1);}(_0x3fd4,0x14e));var _0x43fd=function(_0x4d5cc4,_0x1ebc39){_0x4d5cc4=_0x4d5cc4-0x0;var _0x246885=_0x3fd4[_0x4d5cc4];return _0x246885;};'use strict';var _=require('lodash');var util=require(_0x43fd('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x43fd('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x43fd('0x2'));var config=require(_0x43fd('0x3'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x5cb247,_0x5c19e6){return _0x5cb247['define'](_0x43fd('0x4'),attributes,{'tableName':_0x43fd('0x5'),'paranoid':![],'indexes':[{'name':_0x43fd('0x6'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ac3be9d..c6f21ce 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 _0xdb0f=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','body','options','raw','debug','util','bluebird','randomstring','ioredis'];(function(_0x48c938,_0x14ac2c){var _0x5625b2=function(_0x3edffd){while(--_0x3edffd){_0x48c938['push'](_0x48c938['shift']());}};_0x5625b2(++_0x14ac2c);}(_0xdb0f,0xcc));var _0xfdb0=function(_0x2ecea0,_0x36a83d){_0x2ecea0=_0x2ecea0-0x0;var _0x17ab22=_0xdb0f[_0x2ecea0];return _0x17ab22;};'use strict';var _=require('lodash');var util=require(_0xfdb0('0x0'));var moment=require('moment');var BPromise=require(_0xfdb0('0x1'));var rs=require(_0xfdb0('0x2'));var fs=require('fs');var Redis=require(_0xfdb0('0x3'));var db=require(_0xfdb0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfdb0('0x5'))(_0xfdb0('0x6'));var config=require(_0xfdb0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfdb0('0x8')][_0xfdb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360094,_0x965bdc,_0x1637d9){return new BPromise(function(_0x3aed3c,_0xfa801c){return client[_0xfdb0('0xa')](_0x360094,_0x1637d9)[_0xfdb0('0xb')](function(_0x4040ed){logger[_0xfdb0('0xc')](_0xfdb0('0xd'),_0x965bdc,_0xfdb0('0xe'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x965bdc,_0xfdb0('0xe'),JSON[_0xfdb0('0xf')](_0x4040ed));if(_0x4040ed['error']){if(_0x4040ed[_0xfdb0('0x10')]['code']===0x1f4){logger[_0xfdb0('0x10')](_0xfdb0('0xd'),_0x965bdc,_0x4040ed[_0xfdb0('0x10')][_0xfdb0('0x11')]);return _0xfa801c(_0x4040ed[_0xfdb0('0x10')][_0xfdb0('0x11')]);}logger[_0xfdb0('0x10')](_0xfdb0('0xd'),_0x965bdc,_0x4040ed['error'][_0xfdb0('0x11')]);return _0x3aed3c(_0x4040ed['error'][_0xfdb0('0x11')]);}else{logger[_0xfdb0('0xc')](_0xfdb0('0xd'),_0x965bdc,'request\x20sent');_0x3aed3c(_0x4040ed[_0xfdb0('0x12')][_0xfdb0('0x11')]);}})[_0xfdb0('0x13')](function(_0x4aa08f){logger[_0xfdb0('0x10')](_0xfdb0('0xd'),_0x965bdc,_0x4aa08f);_0xfa801c(_0x4aa08f);});});}exports[_0xfdb0('0x14')]=function(_0x431c7c){var _0x5c58e5=this;return new Promise(function(_0x3fea14,_0x1c4417){return db[_0xfdb0('0x15')]['create'](_0x431c7c[_0xfdb0('0x16')],{'raw':_0x431c7c[_0xfdb0('0x17')]?_0x431c7c[_0xfdb0('0x17')][_0xfdb0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2295a4){logger['info'](_0xfdb0('0x14'),_0x431c7c);logger[_0xfdb0('0x19')](_0xfdb0('0x14'),_0x431c7c,JSON[_0xfdb0('0xf')](_0x2295a4));_0x3fea14(_0x2295a4);})['catch'](function(_0x19b442){logger[_0xfdb0('0x10')](_0xfdb0('0x14'),_0x19b442[_0xfdb0('0x11')],_0x431c7c);_0x1c4417(_0x5c58e5['error'](0x1f4,_0x19b442[_0xfdb0('0x11')]));});});}; \ No newline at end of file +var _0xa055=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal'];(function(_0x4e7703,_0x4473a1){var _0x552e03=function(_0x14f7f0){while(--_0x14f7f0){_0x4e7703['push'](_0x4e7703['shift']());}};_0x552e03(++_0x4473a1);}(_0xa055,0xd2));var _0x5a05=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xa055[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x5a05('0x0'));var util=require('util');var moment=require(_0x5a05('0x1'));var BPromise=require(_0x5a05('0x2'));var rs=require(_0x5a05('0x3'));var fs=require('fs');var Redis=require(_0x5a05('0x4'));var db=require(_0x5a05('0x5'))['db'];var utils=require(_0x5a05('0x6'));var logger=require(_0x5a05('0x7'))(_0x5a05('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a05('0x9'));var client=jayson[_0x5a05('0xa')][_0x5a05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x230991,_0x25d438,_0x1af462){return new BPromise(function(_0x5976ce,_0x5cacc3){return client[_0x5a05('0xc')](_0x230991,_0x1af462)[_0x5a05('0xd')](function(_0x5917ad){logger[_0x5a05('0xe')](_0x5a05('0xf'),_0x25d438,_0x5a05('0x10'));logger[_0x5a05('0x11')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x25d438,_0x5a05('0x10'),JSON[_0x5a05('0x12')](_0x5917ad));if(_0x5917ad[_0x5a05('0x13')]){if(_0x5917ad[_0x5a05('0x13')][_0x5a05('0x14')]===0x1f4){logger['error'](_0x5a05('0xf'),_0x25d438,_0x5917ad['error'][_0x5a05('0x15')]);return _0x5cacc3(_0x5917ad[_0x5a05('0x13')][_0x5a05('0x15')]);}logger[_0x5a05('0x13')](_0x5a05('0xf'),_0x25d438,_0x5917ad['error'][_0x5a05('0x15')]);return _0x5976ce(_0x5917ad[_0x5a05('0x13')][_0x5a05('0x15')]);}else{logger[_0x5a05('0xe')](_0x5a05('0xf'),_0x25d438,_0x5a05('0x10'));_0x5976ce(_0x5917ad[_0x5a05('0x16')][_0x5a05('0x15')]);}})[_0x5a05('0x17')](function(_0x5be547){logger['error'](_0x5a05('0xf'),_0x25d438,_0x5be547);_0x5cacc3(_0x5be547);});});}exports['CreateCmHopperFinal']=function(_0x5a72b5){var _0x377964=this;return new Promise(function(_0x5639fc,_0x2eaf9c){return db[_0x5a05('0x18')][_0x5a05('0x19')](_0x5a72b5[_0x5a05('0x1a')],{'raw':_0x5a72b5[_0x5a05('0x1b')]?_0x5a72b5['options'][_0x5a05('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x244d17){logger['info'](_0x5a05('0x1d'),_0x5a72b5);logger['debug'](_0x5a05('0x1d'),_0x5a72b5,JSON['stringify'](_0x244d17));_0x5639fc(_0x244d17);})['catch'](function(_0x1db0d1){logger[_0x5a05('0x13')](_0x5a05('0x1d'),_0x1db0d1[_0x5a05('0x15')],_0x5a72b5);_0x2eaf9c(_0x377964[_0x5a05('0x13')](0x1f4,_0x1db0d1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 45b1a66..660e38f 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 _0x3ff0=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0x82d00a,_0x3e9191){var _0x439160=function(_0x3ce5a2){while(--_0x3ce5a2){_0x82d00a['push'](_0x82d00a['shift']());}};_0x439160(++_0x3e9191);}(_0x3ff0,0x6f));var _0x03ff=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x3ff0[_0x480bc8];return _0x28c245;};'use strict';var multer=require('multer');var util=require(_0x03ff('0x0'));var path=require(_0x03ff('0x1'));var timeout=require(_0x03ff('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x03ff('0x3'));var interaction=require(_0x03ff('0x4'));var config=require(_0x03ff('0x5'));var controller=require(_0x03ff('0x6'));router['get']('/',auth[_0x03ff('0x7')](),controller[_0x03ff('0x8')]);router[_0x03ff('0x9')](_0x03ff('0xa'),auth[_0x03ff('0x7')](),controller['describe']);router[_0x03ff('0x9')](_0x03ff('0xb'),auth['isAuthenticated'](),controller[_0x03ff('0xc')]);router[_0x03ff('0x9')](_0x03ff('0xd'),auth[_0x03ff('0x7')](),controller[_0x03ff('0xe')]);router[_0x03ff('0x9')]('/campaign/countAttributes/:id',auth[_0x03ff('0x7')](),controller[_0x03ff('0xf')]);router[_0x03ff('0x10')](_0x03ff('0x11'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x12')]);router[_0x03ff('0x10')](_0x03ff('0x13'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x14')]);router[_0x03ff('0x10')](_0x03ff('0x15'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x16')]);router[_0x03ff('0x17')](_0x03ff('0xb'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x18')]);module[_0x03ff('0x19')]=router; \ No newline at end of file +var _0x1dff=['/:id','show','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x1dff,0xed));var _0xf1df=function(_0x2fdaca,_0x1333a7){_0x2fdaca=_0x2fdaca-0x0;var _0x3028a6=_0x1dff[_0x2fdaca];return _0x3028a6;};'use strict';var multer=require('multer');var util=require(_0xf1df('0x0'));var path=require('path');var timeout=require(_0xf1df('0x1'));var express=require(_0xf1df('0x2'));var router=express[_0xf1df('0x3')]();var auth=require(_0xf1df('0x4'));var interaction=require(_0xf1df('0x5'));var config=require(_0xf1df('0x6'));var controller=require(_0xf1df('0x7'));router['get']('/',auth[_0xf1df('0x8')](),controller[_0xf1df('0x9')]);router[_0xf1df('0xa')](_0xf1df('0xb'),auth[_0xf1df('0x8')](),controller[_0xf1df('0xc')]);router[_0xf1df('0xa')](_0xf1df('0xd'),auth[_0xf1df('0x8')](),controller[_0xf1df('0xe')]);router[_0xf1df('0xa')]('/voice/queue/countAttributes/:id',auth[_0xf1df('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xf1df('0xa')]('/campaign/countAttributes/:id',auth[_0xf1df('0x8')](),controller[_0xf1df('0xf')]);router['post'](_0xf1df('0x10'),auth[_0xf1df('0x8')](),controller[_0xf1df('0x11')]);router[_0xf1df('0x12')](_0xf1df('0x13'),auth[_0xf1df('0x8')](),controller[_0xf1df('0x14')]);router[_0xf1df('0x12')](_0xf1df('0x15'),auth['isAuthenticated'](),controller[_0xf1df('0x16')]);router[_0xf1df('0x17')](_0xf1df('0xd'),auth[_0xf1df('0x8')](),controller['update']);module[_0xf1df('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 8f0cd3f..170bb56 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 _0x7870=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x7870,0x118));var _0x0787=function(_0x5249db,_0xdec49){_0x5249db=_0x5249db-0x0;var _0x1c941b=_0x7870[_0x5249db];return _0x1c941b;};'use strict';var Sequelize=require('sequelize');module[_0x0787('0x0')]={'state':{'type':Sequelize[_0x0787('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0787('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0787('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0787('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0787('0x2')]},'calleridnum':{'type':Sequelize[_0x0787('0x2')]},'calleridname':{'type':Sequelize[_0x0787('0x2')]},'starttime':{'type':Sequelize[_0x0787('0x3')]},'responsetime':{'type':Sequelize[_0x0787('0x3')]},'answertime':{'type':Sequelize[_0x0787('0x3')]},'droptime':{'type':Sequelize[_0x0787('0x3')]},'endtime':{'type':Sequelize[_0x0787('0x3')]},'ringtime':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0787('0x2')]},'campaign':{'type':Sequelize[_0x0787('0x2')]},'campaigntype':{'type':Sequelize[_0x0787('0x2')]},'membername':{'type':Sequelize[_0x0787('0x2')]},'reason':{'type':Sequelize[_0x0787('0x2')]},'amd':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0787('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0787('0x3')]},'recallme':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x72e8=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x32336b,_0x4a7dae){var _0x449eaa=function(_0x2af318){while(--_0x2af318){_0x32336b['push'](_0x32336b['shift']());}};_0x449eaa(++_0x4a7dae);}(_0x72e8,0x113));var _0x872e=function(_0x5405b2,_0x3b9314){_0x5405b2=_0x5405b2-0x0;var _0x56e99e=_0x72e8[_0x5405b2];return _0x56e99e;};'use strict';var Sequelize=require('sequelize');module[_0x872e('0x0')]={'state':{'type':Sequelize[_0x872e('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x872e('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x872e('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x872e('0x2')]},'calleridname':{'type':Sequelize[_0x872e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x872e('0x3')]},'answertime':{'type':Sequelize[_0x872e('0x3')]},'droptime':{'type':Sequelize[_0x872e('0x3')]},'endtime':{'type':Sequelize[_0x872e('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x872e('0x2')]},'campaign':{'type':Sequelize[_0x872e('0x2')]},'campaigntype':{'type':Sequelize[_0x872e('0x2')]},'membername':{'type':Sequelize[_0x872e('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x872e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x872e('0x3')]},'recallme':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x872e('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x872e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 69f3f48..2f43849 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 _0x2cd2=['sox','to-csv','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','set','reject','save','then','destroy','end','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','merge','options','count','includeAll','include','findAll','params','find','create','body','catch','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1d4e21,_0x4e8096){var _0x178fef=function(_0x515879){while(--_0x515879){_0x1d4e21['push'](_0x1d4e21['shift']());}};_0x178fef(++_0x4e8096);}(_0x2cd2,0x82));var _0x22cd=function(_0x3e0e7f,_0x5d275e){_0x3e0e7f=_0x3e0e7f-0x0;var _0x19d625=_0x2cd2[_0x3e0e7f];return _0x19d625;};'use strict';var pdf=require(_0x22cd('0x0'));var emlformat=require(_0x22cd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x22cd('0x2'));var jsonpatch=require(_0x22cd('0x3'));var rp=require('request-promise');var moment=require(_0x22cd('0x4'));var BPromise=require(_0x22cd('0x5'));var Mustache=require(_0x22cd('0x6'));var util=require(_0x22cd('0x7'));var path=require('path');var sox=require(_0x22cd('0x8'));var csv=require(_0x22cd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x22cd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x22cd('0x9'));var querystring=require(_0x22cd('0xb'));var Papa=require(_0x22cd('0xc'));var Redis=require(_0x22cd('0xd'));var authService=require(_0x22cd('0xe'));var qs=require(_0x22cd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22cd('0x10'))(_0x22cd('0x11'));var utils=require(_0x22cd('0x12'));var config=require(_0x22cd('0x13'));var licenseUtil=require(_0x22cd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28abd3,_0x326d16){_0x326d16=_0x326d16||0xcc;return function(_0xb8ceaa){if(_0xb8ceaa){return _0x28abd3[_0x22cd('0x15')](_0x326d16);}return _0x28abd3['status'](_0x326d16)['end']();};}function respondWithResult(_0x3c722b,_0x324ac6){_0x324ac6=_0x324ac6||0xc8;return function(_0x2b0867){if(_0x2b0867){return _0x3c722b[_0x22cd('0x16')](_0x324ac6)[_0x22cd('0x17')](_0x2b0867);}};}function respondWithFilteredResult(_0x15df26,_0x587e70){return function(_0x6c35d){if(_0x6c35d){var _0x554aa3=_0x6c35d['count'],_0x406fda=_0x587e70['offset'],_0x1ece86=_0x587e70[_0x22cd('0x18')]+_0x587e70['limit'],_0x41a3f5;if(_0x1ece86>=_0x554aa3){_0x1ece86=_0x554aa3;_0x41a3f5=0xc8;}else{_0x41a3f5=0xce;}_0x15df26[_0x22cd('0x16')](_0x41a3f5);return _0x15df26[_0x22cd('0x19')]('Content-Range',_0x406fda+'-'+_0x1ece86+'/'+_0x554aa3)[_0x22cd('0x17')](_0x6c35d);}return null;};}function patchUpdates(_0x4fb863){return function(_0x1f70a7){try{jsonpatch['apply'](_0x1f70a7,_0x4fb863,!![]);}catch(_0x1e80ef){return BPromise[_0x22cd('0x1a')](_0x1e80ef);}return _0x1f70a7[_0x22cd('0x1b')]();};}function saveUpdates(_0x3da1c7,_0x1572ed){return function(_0x545c44){if(_0x545c44){return _0x545c44['update'](_0x3da1c7)[_0x22cd('0x1c')](function(_0x108833){return _0x108833;});}return null;};}function removeEntity(_0x26d740,_0x576331){return function(_0x260997){if(_0x260997){return _0x260997[_0x22cd('0x1d')]()[_0x22cd('0x1c')](function(){_0x26d740['status'](0xcc)[_0x22cd('0x1e')]();});}};}function handleEntityNotFound(_0x2e7c00,_0x4da80c){return function(_0x127cc4){if(!_0x127cc4){_0x2e7c00['sendStatus'](0x194);}return _0x127cc4;};}function handleError(_0x4bbe37,_0x1ee636){_0x1ee636=_0x1ee636||0x1f4;return function(_0x1d1d91){logger[_0x22cd('0x1f')](_0x1d1d91[_0x22cd('0x20')]);if(_0x1d1d91[_0x22cd('0x21')]){delete _0x1d1d91[_0x22cd('0x21')];}_0x4bbe37['status'](_0x1ee636)[_0x22cd('0x22')](_0x1d1d91);};}exports[_0x22cd('0x23')]=function(_0x2bbf3a,_0x24f2f7){var _0x865f4b={},_0x334cc8={},_0x2a0642={'count':0x0,'rows':[]};var _0x26effe=_['map'](db[_0x22cd('0x24')][_0x22cd('0x25')],function(_0x2f929d){return{'name':_0x2f929d[_0x22cd('0x26')],'type':_0x2f929d['type'][_0x22cd('0x27')]};});_0x334cc8[_0x22cd('0x28')]=_[_0x22cd('0x29')](_0x26effe,_0x22cd('0x21'));_0x334cc8[_0x22cd('0x2a')]=_[_0x22cd('0x2b')](_0x2bbf3a[_0x22cd('0x2a')]);_0x334cc8[_0x22cd('0x2c')]=_[_0x22cd('0x2d')](_0x334cc8['model'],_0x334cc8['query']);_0x865f4b[_0x22cd('0x2e')]=_[_0x22cd('0x2d')](_0x334cc8['model'],qs[_0x22cd('0x2f')](_0x2bbf3a[_0x22cd('0x2a')]['fields']));_0x865f4b['attributes']=_0x865f4b[_0x22cd('0x2e')][_0x22cd('0x30')]?_0x865f4b[_0x22cd('0x2e')]:_0x334cc8[_0x22cd('0x28')];if(!_0x2bbf3a[_0x22cd('0x2a')][_0x22cd('0x31')](_0x22cd('0x32'))){_0x865f4b[_0x22cd('0x33')]=qs[_0x22cd('0x33')](_0x2bbf3a[_0x22cd('0x2a')]['limit']);_0x865f4b[_0x22cd('0x18')]=qs[_0x22cd('0x18')](_0x2bbf3a['query'][_0x22cd('0x18')]);}_0x865f4b[_0x22cd('0x34')]=qs[_0x22cd('0x35')](_0x2bbf3a[_0x22cd('0x2a')]['sort']);_0x865f4b['where']=qs[_0x22cd('0x2c')](_['pick'](_0x2bbf3a[_0x22cd('0x2a')],_0x334cc8[_0x22cd('0x2c')]),_0x26effe);if(_0x2bbf3a[_0x22cd('0x2a')]['filter']){_0x865f4b[_0x22cd('0x36')]=_['merge'](_0x865f4b[_0x22cd('0x36')],{'$or':_['map'](_0x26effe,function(_0x481c91){if(_0x481c91['type']!==_0x22cd('0x37')){var _0x2d0e84={};_0x2d0e84[_0x481c91[_0x22cd('0x21')]]={'$like':'%'+_0x2bbf3a['query']['filter']+'%'};return _0x2d0e84;}})});}_0x865f4b=_[_0x22cd('0x38')]({},_0x865f4b,_0x2bbf3a[_0x22cd('0x39')]);var _0x3404fd={'where':_0x865f4b[_0x22cd('0x36')]};return db[_0x22cd('0x24')][_0x22cd('0x3a')](_0x3404fd)[_0x22cd('0x1c')](function(_0xbb1928){_0x2a0642['count']=_0xbb1928;if(_0x2bbf3a[_0x22cd('0x2a')][_0x22cd('0x3b')]){_0x865f4b[_0x22cd('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x22cd('0x3d')](_0x865f4b);})[_0x22cd('0x1c')](function(_0x2b4797){_0x2a0642['rows']=_0x2b4797;return _0x2a0642;})[_0x22cd('0x1c')](respondWithFilteredResult(_0x24f2f7,_0x865f4b))['catch'](handleError(_0x24f2f7,null));};exports['show']=function(_0x24582e,_0x52d2b0){var _0x4ed128={'raw':!![],'where':{'id':_0x24582e[_0x22cd('0x3e')]['id']}},_0x1605f8={};_0x1605f8[_0x22cd('0x28')]=_[_0x22cd('0x2b')](db[_0x22cd('0x24')][_0x22cd('0x25')]);_0x1605f8[_0x22cd('0x2a')]=_[_0x22cd('0x2b')](_0x24582e[_0x22cd('0x2a')]);_0x1605f8['filters']=_[_0x22cd('0x2d')](_0x1605f8[_0x22cd('0x28')],_0x1605f8[_0x22cd('0x2a')]);_0x4ed128[_0x22cd('0x2e')]=_[_0x22cd('0x2d')](_0x1605f8[_0x22cd('0x28')],qs['fields'](_0x24582e[_0x22cd('0x2a')][_0x22cd('0x2f')]));_0x4ed128[_0x22cd('0x2e')]=_0x4ed128[_0x22cd('0x2e')][_0x22cd('0x30')]?_0x4ed128[_0x22cd('0x2e')]:_0x1605f8[_0x22cd('0x28')];if(_0x24582e[_0x22cd('0x2a')][_0x22cd('0x3b')]){_0x4ed128[_0x22cd('0x3c')]=[{'all':!![]}];}_0x4ed128=_[_0x22cd('0x38')]({},_0x4ed128,_0x24582e['options']);return db['CmHopperHistory'][_0x22cd('0x3f')](_0x4ed128)['then'](handleEntityNotFound(_0x52d2b0,null))['then'](respondWithResult(_0x52d2b0,null))['catch'](handleError(_0x52d2b0,null));};exports[_0x22cd('0x40')]=function(_0x5d777c,_0x4b4206){return db[_0x22cd('0x24')][_0x22cd('0x40')](_0x5d777c[_0x22cd('0x41')],{})[_0x22cd('0x1c')](respondWithResult(_0x4b4206,0xc9))[_0x22cd('0x42')](handleError(_0x4b4206,null));};exports['describe']=function(_0xcf159c,_0x4dabed){return db[_0x22cd('0x24')][_0x22cd('0x43')]()['then'](respondWithResult(_0x4dabed,null))[_0x22cd('0x42')](handleError(_0x4dabed,null));};exports['update']=function(_0x30830e,_0x5da1ec){if(_0x30830e[_0x22cd('0x41')][_0x22cd('0x44')]){delete _0x30830e[_0x22cd('0x41')]['uniqueid'];}return db[_0x22cd('0x24')][_0x22cd('0x3f')]({'where':{'uniqueid':_0x30830e[_0x22cd('0x3e')]['id']}})[_0x22cd('0x1c')](handleEntityNotFound(_0x5da1ec,null))[_0x22cd('0x1c')](saveUpdates(_0x30830e[_0x22cd('0x41')],null))[_0x22cd('0x1c')](respondWithResult(_0x5da1ec,null))['catch'](handleError(_0x5da1ec,null));}; \ No newline at end of file +var _0x721d=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','describe','uniqueid','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','then','destroy','error','name','index','map','CmHopperHistory','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x721d,0x1ce));var _0xd721=function(_0x184118,_0xfa5f7){_0x184118=_0x184118-0x0;var _0x2582bf=_0x721d[_0x184118];return _0x2582bf;};'use strict';var pdf=require(_0xd721('0x0'));var emlformat=require(_0xd721('0x1'));var rimraf=require(_0xd721('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd721('0x3'));var rp=require(_0xd721('0x4'));var moment=require('moment');var BPromise=require(_0xd721('0x5'));var Mustache=require(_0xd721('0x6'));var util=require(_0xd721('0x7'));var path=require('path');var sox=require(_0xd721('0x8'));var csv=require('to-csv');var ejs=require(_0xd721('0x9'));var fs=require('fs');var _=require(_0xd721('0xa'));var squel=require(_0xd721('0xb'));var crypto=require(_0xd721('0xc'));var jsforce=require(_0xd721('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd721('0xe'));var querystring=require(_0xd721('0xf'));var Papa=require(_0xd721('0x10'));var Redis=require(_0xd721('0x11'));var authService=require(_0xd721('0x12'));var qs=require(_0xd721('0x13'));var as=require(_0xd721('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd721('0x15'))(_0xd721('0x16'));var utils=require(_0xd721('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd721('0x18'));var db=require(_0xd721('0x19'))['db'];function respondWithStatusCode(_0x5e85b7,_0x4f8293){_0x4f8293=_0x4f8293||0xcc;return function(_0x218f95){if(_0x218f95){return _0x5e85b7[_0xd721('0x1a')](_0x4f8293);}return _0x5e85b7[_0xd721('0x1b')](_0x4f8293)['end']();};}function respondWithResult(_0x10638e,_0x434059){_0x434059=_0x434059||0xc8;return function(_0x4d79e4){if(_0x4d79e4){return _0x10638e['status'](_0x434059)[_0xd721('0x1c')](_0x4d79e4);}};}function respondWithFilteredResult(_0x113954,_0x180d53){return function(_0xf2c7f6){if(_0xf2c7f6){var _0x5f3775=_0xf2c7f6[_0xd721('0x1d')],_0x42e85c=_0x180d53[_0xd721('0x1e')],_0xf527c4=_0x180d53['offset']+_0x180d53['limit'],_0x3e1273;if(_0xf527c4>=_0x5f3775){_0xf527c4=_0x5f3775;_0x3e1273=0xc8;}else{_0x3e1273=0xce;}_0x113954['status'](_0x3e1273);return _0x113954['set'](_0xd721('0x1f'),_0x42e85c+'-'+_0xf527c4+'/'+_0x5f3775)[_0xd721('0x1c')](_0xf2c7f6);}return null;};}function patchUpdates(_0x20674c){return function(_0x384ce0){try{jsonpatch[_0xd721('0x20')](_0x384ce0,_0x20674c,!![]);}catch(_0x2213a3){return BPromise['reject'](_0x2213a3);}return _0x384ce0[_0xd721('0x21')]();};}function saveUpdates(_0x2f0302,_0x198789){return function(_0x4fa791){if(_0x4fa791){return _0x4fa791['update'](_0x2f0302)[_0xd721('0x22')](function(_0x39ddda){return _0x39ddda;});}return null;};}function removeEntity(_0x13f4d3,_0x1f313f){return function(_0x2b0ff7){if(_0x2b0ff7){return _0x2b0ff7[_0xd721('0x23')]()[_0xd721('0x22')](function(){_0x13f4d3[_0xd721('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba94e,_0x5d80eb){return function(_0x4b2fa1){if(!_0x4b2fa1){_0x4ba94e['sendStatus'](0x194);}return _0x4b2fa1;};}function handleError(_0x38c725,_0x5b3ce4){_0x5b3ce4=_0x5b3ce4||0x1f4;return function(_0x88d3e3){logger[_0xd721('0x24')](_0x88d3e3['stack']);if(_0x88d3e3[_0xd721('0x25')]){delete _0x88d3e3[_0xd721('0x25')];}_0x38c725[_0xd721('0x1b')](_0x5b3ce4)['send'](_0x88d3e3);};}exports[_0xd721('0x26')]=function(_0x1e492e,_0x4c6fdf){var _0x74ce87={},_0x429a41={},_0x9f4e49={'count':0x0,'rows':[]};var _0x335b3f=_[_0xd721('0x27')](db[_0xd721('0x28')]['rawAttributes'],function(_0x2f09cb){return{'name':_0x2f09cb[_0xd721('0x29')],'type':_0x2f09cb['type'][_0xd721('0x2a')]};});_0x429a41[_0xd721('0x2b')]=_[_0xd721('0x27')](_0x335b3f,'name');_0x429a41[_0xd721('0x2c')]=_[_0xd721('0x2d')](_0x1e492e[_0xd721('0x2c')]);_0x429a41[_0xd721('0x2e')]=_[_0xd721('0x2f')](_0x429a41[_0xd721('0x2b')],_0x429a41['query']);_0x74ce87['attributes']=_[_0xd721('0x2f')](_0x429a41[_0xd721('0x2b')],qs[_0xd721('0x30')](_0x1e492e[_0xd721('0x2c')][_0xd721('0x30')]));_0x74ce87['attributes']=_0x74ce87[_0xd721('0x31')][_0xd721('0x32')]?_0x74ce87[_0xd721('0x31')]:_0x429a41[_0xd721('0x2b')];if(!_0x1e492e[_0xd721('0x2c')][_0xd721('0x33')](_0xd721('0x34'))){_0x74ce87[_0xd721('0x35')]=qs[_0xd721('0x35')](_0x1e492e[_0xd721('0x2c')][_0xd721('0x35')]);_0x74ce87[_0xd721('0x1e')]=qs[_0xd721('0x1e')](_0x1e492e[_0xd721('0x2c')]['offset']);}_0x74ce87['order']=qs['sort'](_0x1e492e['query'][_0xd721('0x36')]);_0x74ce87[_0xd721('0x37')]=qs[_0xd721('0x2e')](_['pick'](_0x1e492e[_0xd721('0x2c')],_0x429a41['filters']),_0x335b3f);if(_0x1e492e[_0xd721('0x2c')][_0xd721('0x38')]){_0x74ce87[_0xd721('0x37')]=_[_0xd721('0x39')](_0x74ce87[_0xd721('0x37')],{'$or':_[_0xd721('0x27')](_0x335b3f,function(_0x5a51db){if(_0x5a51db[_0xd721('0x3a')]!==_0xd721('0x3b')){var _0xefd951={};_0xefd951[_0x5a51db['name']]={'$like':'%'+_0x1e492e[_0xd721('0x2c')][_0xd721('0x38')]+'%'};return _0xefd951;}})});}_0x74ce87=_[_0xd721('0x39')]({},_0x74ce87,_0x1e492e[_0xd721('0x3c')]);var _0x596390={'where':_0x74ce87[_0xd721('0x37')]};return db[_0xd721('0x28')][_0xd721('0x1d')](_0x596390)[_0xd721('0x22')](function(_0x2aa68b){_0x9f4e49[_0xd721('0x1d')]=_0x2aa68b;if(_0x1e492e[_0xd721('0x2c')][_0xd721('0x3d')]){_0x74ce87[_0xd721('0x3e')]=[{'all':!![]}];}return db[_0xd721('0x28')][_0xd721('0x3f')](_0x74ce87);})[_0xd721('0x22')](function(_0x703264){_0x9f4e49[_0xd721('0x40')]=_0x703264;return _0x9f4e49;})[_0xd721('0x22')](respondWithFilteredResult(_0x4c6fdf,_0x74ce87))[_0xd721('0x41')](handleError(_0x4c6fdf,null));};exports[_0xd721('0x42')]=function(_0x1b1e7f,_0x192207){var _0x36d274={'raw':!![],'where':{'id':_0x1b1e7f[_0xd721('0x43')]['id']}},_0x1d1a3f={};_0x1d1a3f[_0xd721('0x2b')]=_[_0xd721('0x2d')](db[_0xd721('0x28')][_0xd721('0x44')]);_0x1d1a3f[_0xd721('0x2c')]=_['keys'](_0x1b1e7f[_0xd721('0x2c')]);_0x1d1a3f['filters']=_[_0xd721('0x2f')](_0x1d1a3f[_0xd721('0x2b')],_0x1d1a3f[_0xd721('0x2c')]);_0x36d274[_0xd721('0x31')]=_['intersection'](_0x1d1a3f['model'],qs[_0xd721('0x30')](_0x1b1e7f[_0xd721('0x2c')][_0xd721('0x30')]));_0x36d274[_0xd721('0x31')]=_0x36d274['attributes'][_0xd721('0x32')]?_0x36d274['attributes']:_0x1d1a3f['model'];if(_0x1b1e7f[_0xd721('0x2c')][_0xd721('0x3d')]){_0x36d274[_0xd721('0x3e')]=[{'all':!![]}];}_0x36d274=_[_0xd721('0x39')]({},_0x36d274,_0x1b1e7f['options']);return db['CmHopperHistory']['find'](_0x36d274)[_0xd721('0x22')](handleEntityNotFound(_0x192207,null))[_0xd721('0x22')](respondWithResult(_0x192207,null))[_0xd721('0x41')](handleError(_0x192207,null));};exports[_0xd721('0x45')]=function(_0x58c09e,_0x4475f2){return db[_0xd721('0x28')][_0xd721('0x45')](_0x58c09e[_0xd721('0x46')],{})[_0xd721('0x22')](respondWithResult(_0x4475f2,0xc9))[_0xd721('0x41')](handleError(_0x4475f2,null));};exports[_0xd721('0x47')]=function(_0x554e42,_0x266eef){return db[_0xd721('0x28')][_0xd721('0x47')]()[_0xd721('0x22')](respondWithResult(_0x266eef,null))['catch'](handleError(_0x266eef,null));};exports['update']=function(_0x171d7a,_0x25d0dd){if(_0x171d7a[_0xd721('0x46')][_0xd721('0x48')]){delete _0x171d7a['body']['uniqueid'];}return db[_0xd721('0x28')][_0xd721('0x49')]({'where':{'uniqueid':_0x171d7a[_0xd721('0x43')]['id']}})[_0xd721('0x22')](handleEntityNotFound(_0x25d0dd,null))[_0xd721('0x22')](saveUpdates(_0x171d7a['body'],null))[_0xd721('0x22')](respondWithResult(_0x25d0dd,null))['catch'](handleError(_0x25d0dd,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9a522fe..e45bf87 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 _0xe96f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0xe96f,0x186));var _0xfe96=function(_0x4a45af,_0x4b5d03){_0x4a45af=_0x4a45af-0x0;var _0xbefe22=_0xe96f[_0x4a45af];return _0xbefe22;};'use strict';var _=require(_0xfe96('0x0'));var util=require(_0xfe96('0x1'));var logger=require(_0xfe96('0x2'))('api');var moment=require(_0xfe96('0x3'));var BPromise=require(_0xfe96('0x4'));var rp=require(_0xfe96('0x5'));var fs=require('fs');var path=require(_0xfe96('0x6'));var rimraf=require(_0xfe96('0x7'));var config=require(_0xfe96('0x8'));var attributes=require(_0xfe96('0x9'));module[_0xfe96('0xa')]=function(_0x58bce2,_0x392ea0){return _0x58bce2['define']('CmHopperHistory',attributes,{'tableName':_0xfe96('0xb'),'paranoid':![],'indexes':[{'name':_0xfe96('0xc'),'fields':[_0xfe96('0xc')]},{'name':'uniqueid','fields':[_0xfe96('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb287=['define','cm_hopper_history','endtime','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb287,0xd4));var _0x7b28=function(_0x47fc45,_0x408b58){_0x47fc45=_0x47fc45-0x0;var _0x12a96b=_0xb287[_0x47fc45];return _0x12a96b;};'use strict';var _=require('lodash');var util=require(_0x7b28('0x0'));var logger=require(_0x7b28('0x1'))('api');var moment=require(_0x7b28('0x2'));var BPromise=require(_0x7b28('0x3'));var rp=require(_0x7b28('0x4'));var fs=require('fs');var path=require(_0x7b28('0x5'));var rimraf=require(_0x7b28('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b28('0x7'));module[_0x7b28('0x8')]=function(_0x5986e8,_0x41dc4e){return _0x5986e8[_0x7b28('0x9')]('CmHopperHistory',attributes,{'tableName':_0x7b28('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7b28('0xb')]},{'name':_0x7b28('0xc'),'fields':[_0x7b28('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8083fde..586b5e1 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 _0x629a=['col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','where','sequelize','COUNT'];(function(_0x910681,_0x555d54){var _0x254007=function(_0x4ff5ff){while(--_0x4ff5ff){_0x910681['push'](_0x910681['shift']());}};_0x254007(++_0x555d54);}(_0x629a,0x16d));var _0xa629=function(_0x2c26dc,_0x15ced0){_0x2c26dc=_0x2c26dc-0x0;var _0x3e0c4c=_0x629a[_0x2c26dc];return _0x3e0c4c;};'use strict';var _=require('lodash');var util=require(_0xa629('0x0'));var moment=require(_0xa629('0x1'));var BPromise=require(_0xa629('0x2'));var rs=require(_0xa629('0x3'));var fs=require('fs');var Redis=require(_0xa629('0x4'));var db=require(_0xa629('0x5'))['db'];var utils=require(_0xa629('0x6'));var logger=require(_0xa629('0x7'))('rpc');var config=require(_0xa629('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa629('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5082d8,_0x19e9a2,_0x3b9b09){return new BPromise(function(_0x2e40e1,_0x387523){return client['request'](_0x5082d8,_0x3b9b09)[_0xa629('0xa')](function(_0x23dda0){logger[_0xa629('0xb')](_0xa629('0xc'),_0x19e9a2,'request\x20sent');logger[_0xa629('0xd')](_0xa629('0xe'),_0x19e9a2,_0xa629('0xf'),JSON[_0xa629('0x10')](_0x23dda0));if(_0x23dda0['error']){if(_0x23dda0[_0xa629('0x11')][_0xa629('0x12')]===0x1f4){logger['error'](_0xa629('0xc'),_0x19e9a2,_0x23dda0[_0xa629('0x11')]['message']);return _0x387523(_0x23dda0[_0xa629('0x11')][_0xa629('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x19e9a2,_0x23dda0['error'][_0xa629('0x13')]);return _0x2e40e1(_0x23dda0[_0xa629('0x11')][_0xa629('0x13')]);}else{logger[_0xa629('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x19e9a2,_0xa629('0xf'));_0x2e40e1(_0x23dda0[_0xa629('0x14')][_0xa629('0x13')]);}})[_0xa629('0x15')](function(_0x55e1fc){logger['error'](_0xa629('0xc'),_0x19e9a2,_0x55e1fc);_0x387523(_0x55e1fc);});});}exports[_0xa629('0x16')]=function(_0x4123e4){var _0x31cf77=this;return new Promise(function(_0x28bf96,_0x5116dd){return db[_0xa629('0x17')][_0xa629('0x18')](_0x4123e4['body'],{'raw':_0x4123e4[_0xa629('0x19')]?_0x4123e4['options'][_0xa629('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1c0129){logger[_0xa629('0xb')](_0xa629('0x16'),_0x4123e4);logger[_0xa629('0xd')](_0xa629('0x16'),_0x4123e4,JSON[_0xa629('0x10')](_0x1c0129));_0x28bf96(_0x1c0129);})['catch'](function(_0x1ad2ed){logger[_0xa629('0x11')](_0xa629('0x16'),_0x1ad2ed[_0xa629('0x13')],_0x4123e4);_0x5116dd(_0x31cf77[_0xa629('0x11')](0x1f4,_0x1ad2ed[_0xa629('0x13')]));});});};exports[_0xa629('0x1b')]=function(_0x3607b3){var _0x25fa63=this;return new Promise(function(_0x176210,_0x2fc0d1){return db[_0xa629('0x17')]['findAll']({'raw':_0x3607b3[_0xa629('0x19')]?_0x3607b3[_0xa629('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3607b3[_0xa629('0x19')]?_0x3607b3['options'][_0xa629('0x1c')]||null:null,'attributes':[[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')][_0xa629('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x21')))),_0xa629('0x22')],[db['sequelize']['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x23')))),_0xa629('0x24')],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x25')))),_0xa629('0x26')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x27'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xa629('0x27'),db[_0xa629('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa629('0x28')))),_0xa629('0x29')]]})['then'](function(_0x35272a){logger[_0xa629('0xb')](_0xa629('0x1b'),_0x3607b3);logger[_0xa629('0xd')](_0xa629('0x1b'),_0x3607b3,JSON[_0xa629('0x10')](_0x35272a));_0x176210(_0x35272a);})[_0xa629('0x15')](function(_0x4dec11){logger[_0xa629('0x11')]('AvgHandleTime',_0x4dec11[_0xa629('0x13')],_0x3607b3);_0x2fc0d1(_0x25fa63[_0xa629('0x11')](0x1f4,_0x4dec11[_0xa629('0x13')]));});});};exports[_0xa629('0x2a')]=function(_0x1600e2){var _0x13b731=this;return new Promise(function(_0x3c5d93,_0x34be1a){return db[_0xa629('0x17')]['findAll']({'raw':_0x1600e2['options']?_0x1600e2[_0xa629('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1600e2['options']?_0x1600e2[_0xa629('0x19')][_0xa629('0x1c')]||null:null,'attributes':[[_0xa629('0x2b'),_0xa629('0x2c')],[db[_0xa629('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x2e')))),_0xa629('0x2f')],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xa629('0x30')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xa629('0x31')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0xa629('0x32')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x33')))),_0xa629('0x34')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa629('0x35')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x36')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x37')))),_0xa629('0x38')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x39')))),'outboundRejectCallsDay'],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x3a')))),_0xa629('0x3b')],[db[_0xa629('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x3d')))),_0xa629('0x3e')]],'group':[_0xa629('0x2b')]})[_0xa629('0xa')](function(_0x36ad49){logger[_0xa629('0xb')]('GetVoiceQueueHopperHistory',_0x1600e2);logger[_0xa629('0xd')](_0xa629('0x2a'),_0x1600e2,JSON[_0xa629('0x10')](_0x36ad49));_0x3c5d93(_0x36ad49);})['catch'](function(_0xd90d2a){logger['error']('GetVoiceQueueHopperHistory',_0xd90d2a['message'],_0x1600e2);_0x34be1a(_0x13b731[_0xa629('0x11')](0x1f4,_0xd90d2a[_0xa629('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x4d93bb){var _0x1f13e5=this;return new Promise(function(_0x35de65,_0x3747c8){return db[_0xa629('0x17')]['findAll']({'raw':_0x4d93bb[_0xa629('0x19')]?_0x4d93bb[_0xa629('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4d93bb['options']?_0x4d93bb['options']['where']||null:null,'attributes':[[_0xa629('0x2b'),_0xa629('0x2c')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')][_0xa629('0x1f')]('id')),_0xa629('0x3f')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x21')))),_0xa629('0x40')]],'group':[_0xa629('0x2b')]})[_0xa629('0xa')](function(_0x31acfc){logger['info'](_0xa629('0x41'),_0x4d93bb);logger[_0xa629('0xd')](_0xa629('0x41'),_0x4d93bb,JSON[_0xa629('0x10')](_0x31acfc));_0x35de65(_0x31acfc);})[_0xa629('0x15')](function(_0x40e415){logger[_0xa629('0x11')]('GetCampaignHopperHistory',_0x40e415['message'],_0x4d93bb);_0x3747c8(_0x1f13e5[_0xa629('0x11')](0x1f4,_0x40e415['message']));});});}; \ No newline at end of file +var _0xc375=['result','CmHopperHistory','body','options','raw','CreateCmHopperHistory','debug','catch','AvgHandleTime','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc375,0xb9));var _0x5c37=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0xc375[_0x128450];return _0x4d80ed;};'use strict';var _=require(_0x5c37('0x0'));var util=require(_0x5c37('0x1'));var moment=require(_0x5c37('0x2'));var BPromise=require(_0x5c37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c37('0x4'));var db=require(_0x5c37('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c37('0x6'));var config=require(_0x5c37('0x7'));var jayson=require(_0x5c37('0x8'));var client=jayson[_0x5c37('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35ac84,_0x2e00e3,_0x401a7e){return new BPromise(function(_0x3474e4,_0x4c53f4){return client[_0x5c37('0xa')](_0x35ac84,_0x401a7e)[_0x5c37('0xb')](function(_0x851610){logger[_0x5c37('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x2e00e3,'request\x20sent');logger['debug'](_0x5c37('0xd'),_0x2e00e3,_0x5c37('0xe'),JSON[_0x5c37('0xf')](_0x851610));if(_0x851610[_0x5c37('0x10')]){if(_0x851610[_0x5c37('0x10')]['code']===0x1f4){logger[_0x5c37('0x10')](_0x5c37('0x11'),_0x2e00e3,_0x851610[_0x5c37('0x10')]['message']);return _0x4c53f4(_0x851610['error'][_0x5c37('0x12')]);}logger[_0x5c37('0x10')](_0x5c37('0x11'),_0x2e00e3,_0x851610[_0x5c37('0x10')][_0x5c37('0x12')]);return _0x3474e4(_0x851610[_0x5c37('0x10')]['message']);}else{logger[_0x5c37('0xc')](_0x5c37('0x11'),_0x2e00e3,'request\x20sent');_0x3474e4(_0x851610[_0x5c37('0x13')][_0x5c37('0x12')]);}})['catch'](function(_0x35af58){logger[_0x5c37('0x10')](_0x5c37('0x11'),_0x2e00e3,_0x35af58);_0x4c53f4(_0x35af58);});});}exports['CreateCmHopperHistory']=function(_0x373b88){var _0x22b3e8=this;return new Promise(function(_0x1394f1,_0x2c2a3a){return db[_0x5c37('0x14')]['create'](_0x373b88[_0x5c37('0x15')],{'raw':_0x373b88[_0x5c37('0x16')]?_0x373b88[_0x5c37('0x16')][_0x5c37('0x17')]===undefined?!![]:![]:!![]})[_0x5c37('0xb')](function(_0xb6c374){logger[_0x5c37('0xc')](_0x5c37('0x18'),_0x373b88);logger[_0x5c37('0x19')]('CreateCmHopperHistory',_0x373b88,JSON[_0x5c37('0xf')](_0xb6c374));_0x1394f1(_0xb6c374);})[_0x5c37('0x1a')](function(_0x4cfa54){logger[_0x5c37('0x10')](_0x5c37('0x18'),_0x4cfa54['message'],_0x373b88);_0x2c2a3a(_0x22b3e8[_0x5c37('0x10')](0x1f4,_0x4cfa54[_0x5c37('0x12')]));});});};exports[_0x5c37('0x1b')]=function(_0x2323d0){var _0xa0895a=this;return new Promise(function(_0x1f6b1e,_0x1281d5){return db['CmHopperHistory']['findAll']({'raw':_0x2323d0[_0x5c37('0x16')]?_0x2323d0[_0x5c37('0x16')][_0x5c37('0x17')]===undefined?!![]:![]:!![],'where':_0x2323d0['options']?_0x2323d0[_0x5c37('0x16')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')][_0x5c37('0x1e')]('id')),_0x5c37('0x1f')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x5c37('0x21')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal'](_0x5c37('0x22')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x23')))),_0x5c37('0x24')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x5c37('0x25')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x26'),db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x27')))),_0x5c37('0x28')]]})[_0x5c37('0xb')](function(_0x187238){logger['info'](_0x5c37('0x1b'),_0x2323d0);logger[_0x5c37('0x19')](_0x5c37('0x1b'),_0x2323d0,JSON[_0x5c37('0xf')](_0x187238));_0x1f6b1e(_0x187238);})[_0x5c37('0x1a')](function(_0x2572f6){logger[_0x5c37('0x10')](_0x5c37('0x1b'),_0x2572f6['message'],_0x2323d0);_0x1281d5(_0xa0895a['error'](0x1f4,_0x2572f6[_0x5c37('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4627d0){var _0x364fb6=this;return new Promise(function(_0x415e4e,_0x175ef5){return db[_0x5c37('0x14')][_0x5c37('0x29')]({'raw':_0x4627d0['options']?_0x4627d0['options'][_0x5c37('0x17')]===undefined?!![]:![]:!![],'where':_0x4627d0[_0x5c37('0x16')]?_0x4627d0['options'][_0x5c37('0x2a')]||null:null,'attributes':[[_0x5c37('0x2b'),_0x5c37('0x2c')],[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x2d')))),_0x5c37('0x2e')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x5c37('0x2f')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x30')))),_0x5c37('0x31')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db['sequelize'][_0x5c37('0x20')](_0x5c37('0x32')))),_0x5c37('0x33')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x34')))),_0x5c37('0x35')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x5c37('0x36')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x5c37('0x37')],[db[_0x5c37('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x38')))),_0x5c37('0x39')],[db['sequelize']['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')]['literal'](_0x5c37('0x3a')))),_0x5c37('0x3b')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db[_0x5c37('0x1d')][_0x5c37('0x20')](_0x5c37('0x3d')))),_0x5c37('0x3b')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5c37('0x3e')))),_0x5c37('0x3f')]],'group':[_0x5c37('0x2b')]})[_0x5c37('0xb')](function(_0x478279){logger['info'](_0x5c37('0x40'),_0x4627d0);logger[_0x5c37('0x19')](_0x5c37('0x40'),_0x4627d0,JSON[_0x5c37('0xf')](_0x478279));_0x415e4e(_0x478279);})[_0x5c37('0x1a')](function(_0x4c209b){logger[_0x5c37('0x10')](_0x5c37('0x40'),_0x4c209b['message'],_0x4627d0);_0x175ef5(_0x364fb6[_0x5c37('0x10')](0x1f4,_0x4c209b[_0x5c37('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x12190e){var _0x35aced=this;return new Promise(function(_0x2c6f58,_0x272073){return db[_0x5c37('0x14')][_0x5c37('0x29')]({'raw':_0x12190e['options']?_0x12190e[_0x5c37('0x16')][_0x5c37('0x17')]===undefined?!![]:![]:!![],'where':_0x12190e['options']?_0x12190e['options']['where']||null:null,'attributes':[['campaign',_0x5c37('0x2c')],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['col']('id')),'ivrTotalCallsDays'],[db[_0x5c37('0x1d')]['fn'](_0x5c37('0x1c'),db[_0x5c37('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5c37('0x41')))),_0x5c37('0x42')]],'group':[_0x5c37('0x2b')]})['then'](function(_0x3999f7){logger[_0x5c37('0xc')]('GetCampaignHopperHistory',_0x12190e);logger[_0x5c37('0x19')]('GetCampaignHopperHistory',_0x12190e,JSON[_0x5c37('0xf')](_0x3999f7));_0x2c6f58(_0x3999f7);})['catch'](function(_0xc03d04){logger[_0x5c37('0x10')](_0x5c37('0x43'),_0xc03d04['message'],_0x12190e);_0x272073(_0x35aced[_0x5c37('0x10')](0x1f4,_0xc03d04[_0x5c37('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e7b4519..ad7259b 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 _0xd61c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','multer','util','path'];(function(_0x395c56,_0x3d667f){var _0x435770=function(_0x3667e9){while(--_0x3667e9){_0x395c56['push'](_0x395c56['shift']());}};_0x435770(++_0x3d667f);}(_0xd61c,0xb1));var _0xcd61=function(_0x2bb257,_0x2aef80){_0x2bb257=_0x2bb257-0x0;var _0x17b5a4=_0xd61c[_0x2bb257];return _0x17b5a4;};'use strict';var multer=require(_0xcd61('0x0'));var util=require(_0xcd61('0x1'));var path=require(_0xcd61('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd61('0x3'));var router=express['Router']();var auth=require(_0xcd61('0x4'));var interaction=require(_0xcd61('0x5'));var config=require(_0xcd61('0x6'));var controller=require(_0xcd61('0x7'));router[_0xcd61('0x8')]('/',auth[_0xcd61('0x9')](),controller[_0xcd61('0xa')]);router[_0xcd61('0x8')](_0xcd61('0xb'),auth[_0xcd61('0x9')](),controller['describe']);router[_0xcd61('0x8')]('/:id',auth[_0xcd61('0x9')](),controller[_0xcd61('0xc')]);router[_0xcd61('0xd')]('/',auth['isAuthenticated'](),controller[_0xcd61('0xe')]);router[_0xcd61('0xf')](_0xcd61('0x10'),auth[_0xcd61('0x9')](),controller[_0xcd61('0x11')]);module['exports']=router; \ No newline at end of file +var _0xea7e=['path','express','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','exports','util'];(function(_0x549f1b,_0x41108a){var _0x2acb5c=function(_0x268130){while(--_0x268130){_0x549f1b['push'](_0x549f1b['shift']());}};_0x2acb5c(++_0x41108a);}(_0xea7e,0x143));var _0xeea7=function(_0x428518,_0x565c03){_0x428518=_0x428518-0x0;var _0x1d0328=_0xea7e[_0x428518];return _0x1d0328;};'use strict';var multer=require('multer');var util=require(_0xeea7('0x0'));var path=require(_0xeea7('0x1'));var timeout=require('connect-timeout');var express=require(_0xeea7('0x2'));var router=express[_0xeea7('0x3')]();var auth=require(_0xeea7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeea7('0x5'));var controller=require(_0xeea7('0x6'));router[_0xeea7('0x7')]('/',auth[_0xeea7('0x8')](),controller[_0xeea7('0x9')]);router[_0xeea7('0x7')](_0xeea7('0xa'),auth[_0xeea7('0x8')](),controller[_0xeea7('0xb')]);router[_0xeea7('0x7')](_0xeea7('0xc'),auth['isAuthenticated'](),controller[_0xeea7('0xd')]);router[_0xeea7('0xe')]('/',auth[_0xeea7('0x8')](),controller['create']);router[_0xeea7('0xf')](_0xeea7('0xc'),auth['isAuthenticated'](),controller[_0xeea7('0x10')]);module[_0xeea7('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 02085f9..afca050 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 _0x3b61=['exports','STRING','sequelize'];(function(_0xebb615,_0x3efdb9){var _0x38063e=function(_0x2fa613){while(--_0x2fa613){_0xebb615['push'](_0xebb615['shift']());}};_0x38063e(++_0x3efdb9);}(_0x3b61,0x1a9));var _0x13b6=function(_0x186817,_0x2ab481){_0x186817=_0x186817-0x0;var _0x279a2e=_0x3b61[_0x186817];return _0x279a2e;};'use strict';var Sequelize=require(_0x13b6('0x0'));module[_0x13b6('0x1')]={'name':{'type':Sequelize[_0x13b6('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x13b6('0x2')]}}; \ No newline at end of file +var _0x5872=['exports','STRING','sequelize'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x5872,0x1a0));var _0x2587=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x5872[_0x5d30b4];return _0x1acfb8;};'use strict';var Sequelize=require(_0x2587('0x0'));module[_0x2587('0x1')]={'name':{'type':Sequelize[_0x2587('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2587('0x2')]},'dialPrefix':{'type':Sequelize[_0x2587('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ed4e33e..2cc5af2 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 _0x9807=['findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ListId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addContacts','CmContact','tags','isArray','length','join','each','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','raw','getContacts','getContactsCsv','pick','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','addColumn','cm_contacts','cf_%s','getCustomFields'];(function(_0x59aa57,_0x2852ce){var _0x5d51e9=function(_0x1d0864){while(--_0x1d0864){_0x59aa57['push'](_0x59aa57['shift']());}};_0x5d51e9(++_0x2852ce);}(_0x9807,0x9d));var _0x7980=function(_0x3b451e,_0xad047f){_0x3b451e=_0x3b451e-0x0;var _0x58f055=_0x9807[_0x3b451e];return _0x58f055;};'use strict';var pdf=require(_0x7980('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7980('0x1'));var zipdir=require(_0x7980('0x2'));var jsonpatch=require(_0x7980('0x3'));var rp=require(_0x7980('0x4'));var moment=require('moment');var BPromise=require(_0x7980('0x5'));var Mustache=require(_0x7980('0x6'));var util=require(_0x7980('0x7'));var path=require(_0x7980('0x8'));var sox=require(_0x7980('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7980('0xa'));var squel=require(_0x7980('0xb'));var crypto=require(_0x7980('0xc'));var jsforce=require(_0x7980('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7980('0xe'));var querystring=require(_0x7980('0xf'));var Papa=require(_0x7980('0x10'));var Redis=require(_0x7980('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7980('0x12'));var as=require(_0x7980('0x13'));var hardwareService=require(_0x7980('0x14'));var logger=require(_0x7980('0x15'))('api');var utils=require(_0x7980('0x16'));var config=require(_0x7980('0x17'));var licenseUtil=require(_0x7980('0x18'));var db=require(_0x7980('0x19'))['db'];config[_0x7980('0x1a')]=_[_0x7980('0x1b')](config['redis'],{'host':_0x7980('0x1c'),'port':0x18eb});var socket=require(_0x7980('0x1d'))(new Redis(config['redis']));require('./cmList.socket')[_0x7980('0x1e')](socket);function respondWithStatusCode(_0x1097ad,_0x20c42e){_0x20c42e=_0x20c42e||0xcc;return function(_0x1f90b1){if(_0x1f90b1){return _0x1097ad[_0x7980('0x1f')](_0x20c42e);}return _0x1097ad['status'](_0x20c42e)['end']();};}function respondWithResult(_0x54edc2,_0x29f773){_0x29f773=_0x29f773||0xc8;return function(_0x455cc7){if(_0x455cc7){return _0x54edc2[_0x7980('0x20')](_0x29f773)[_0x7980('0x21')](_0x455cc7);}};}function respondWithFilteredResult(_0x369d7b,_0x3f0b13){return function(_0x374f92){if(_0x374f92){var _0x2d3ca2=_0x374f92['count'],_0x46c1fb=_0x3f0b13[_0x7980('0x22')],_0x4eb091=_0x3f0b13['offset']+_0x3f0b13[_0x7980('0x23')],_0xa832d6;if(_0x4eb091>=_0x2d3ca2){_0x4eb091=_0x2d3ca2;_0xa832d6=0xc8;}else{_0xa832d6=0xce;}_0x369d7b[_0x7980('0x20')](_0xa832d6);return _0x369d7b[_0x7980('0x24')](_0x7980('0x25'),_0x46c1fb+'-'+_0x4eb091+'/'+_0x2d3ca2)[_0x7980('0x21')](_0x374f92);}return null;};}function patchUpdates(_0x50a913){return function(_0xa9a931){try{jsonpatch[_0x7980('0x26')](_0xa9a931,_0x50a913,!![]);}catch(_0x36d311){return BPromise[_0x7980('0x27')](_0x36d311);}return _0xa9a931['save']();};}function saveUpdates(_0x12b6ea,_0x378d2b){return function(_0x203010){if(_0x203010){return _0x203010['update'](_0x12b6ea)[_0x7980('0x28')](function(_0x49f6da){return _0x49f6da;});}return null;};}function removeEntity(_0x3dca2d,_0x34ca32){return function(_0x23bbaa){if(_0x23bbaa){return _0x23bbaa[_0x7980('0x29')]()[_0x7980('0x28')](function(){var _0x158a3c=_0x23bbaa['get']({'plain':!![]});var _0x2cc069=_0x7980('0x2a');return db[_0x7980('0x2b')][_0x7980('0x29')]({'where':{'type':_0x2cc069,'resourceId':_0x158a3c['id']}})[_0x7980('0x28')](function(){return _0x23bbaa;});})[_0x7980('0x28')](function(){_0x3dca2d[_0x7980('0x20')](0xcc)[_0x7980('0x2c')]();});}};}function handleEntityNotFound(_0x46e39b,_0x5f48cb){return function(_0x52ce9f){if(!_0x52ce9f){_0x46e39b['sendStatus'](0x194);}return _0x52ce9f;};}function handleError(_0x2af179,_0x424e73){_0x424e73=_0x424e73||0x1f4;return function(_0x30cc09){logger[_0x7980('0x2d')](_0x30cc09[_0x7980('0x2e')]);if(_0x30cc09[_0x7980('0x2f')]){delete _0x30cc09[_0x7980('0x2f')];}_0x2af179[_0x7980('0x20')](_0x424e73)[_0x7980('0x30')](_0x30cc09);};}exports[_0x7980('0x31')]=function(_0x5b5dd9,_0x57236){var _0x577cad={},_0x5874c1={},_0x52f7c1={'count':0x0,'rows':[]};var _0x3b27aa=_[_0x7980('0x32')](db[_0x7980('0x33')][_0x7980('0x34')],function(_0x4ccb0c){return{'name':_0x4ccb0c[_0x7980('0x35')],'type':_0x4ccb0c[_0x7980('0x36')][_0x7980('0x37')]};});_0x5874c1['model']=_[_0x7980('0x32')](_0x3b27aa,'name');_0x5874c1[_0x7980('0x38')]=_[_0x7980('0x39')](_0x5b5dd9[_0x7980('0x38')]);_0x5874c1[_0x7980('0x3a')]=_[_0x7980('0x3b')](_0x5874c1[_0x7980('0x3c')],_0x5874c1[_0x7980('0x38')]);_0x577cad['attributes']=_[_0x7980('0x3b')](_0x5874c1['model'],qs[_0x7980('0x3d')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x3d')]));_0x577cad[_0x7980('0x3e')]=_0x577cad[_0x7980('0x3e')]['length']?_0x577cad['attributes']:_0x5874c1[_0x7980('0x3c')];if(!_0x5b5dd9[_0x7980('0x38')][_0x7980('0x3f')](_0x7980('0x40'))){_0x577cad['limit']=qs[_0x7980('0x23')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x23')]);_0x577cad[_0x7980('0x22')]=qs[_0x7980('0x22')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x22')]);}_0x577cad['order']=qs[_0x7980('0x41')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x41')]);_0x577cad['where']=qs[_0x7980('0x3a')](_['pick'](_0x5b5dd9[_0x7980('0x38')],_0x5874c1[_0x7980('0x3a')]),_0x3b27aa);if(_0x5b5dd9[_0x7980('0x38')]['filter']){_0x577cad[_0x7980('0x42')]=_['merge'](_0x577cad['where'],{'$or':_[_0x7980('0x32')](_0x3b27aa,function(_0x24ee51){if(_0x24ee51[_0x7980('0x36')]!=='VIRTUAL'){var _0x154b28={};_0x154b28[_0x24ee51[_0x7980('0x2f')]]={'$like':'%'+_0x5b5dd9[_0x7980('0x38')][_0x7980('0x43')]+'%'};return _0x154b28;}})});}_0x577cad=_[_0x7980('0x44')]({},_0x577cad,_0x5b5dd9[_0x7980('0x45')]);var _0x2721b7={'where':_0x577cad['where']};return db[_0x7980('0x33')]['count'](_0x2721b7)['then'](function(_0x41462a){_0x52f7c1[_0x7980('0x46')]=_0x41462a;if(_0x5b5dd9[_0x7980('0x38')][_0x7980('0x47')]){_0x577cad[_0x7980('0x48')]=[{'all':!![]}];}return db[_0x7980('0x33')][_0x7980('0x49')](_0x577cad);})[_0x7980('0x28')](function(_0x4003f1){_0x52f7c1[_0x7980('0x4a')]=_0x4003f1;return _0x52f7c1;})[_0x7980('0x28')](respondWithFilteredResult(_0x57236,_0x577cad))['catch'](handleError(_0x57236,null));};exports[_0x7980('0x4b')]=function(_0x63f61,_0x5941ee){var _0x33f947={'raw':![],'where':{'id':_0x63f61['params']['id']}},_0x4218e0={};_0x4218e0[_0x7980('0x3c')]=_[_0x7980('0x39')](db[_0x7980('0x33')][_0x7980('0x34')]);_0x4218e0['query']=_[_0x7980('0x39')](_0x63f61[_0x7980('0x38')]);_0x4218e0[_0x7980('0x3a')]=_['intersection'](_0x4218e0[_0x7980('0x3c')],_0x4218e0[_0x7980('0x38')]);_0x33f947[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x4218e0[_0x7980('0x3c')],qs[_0x7980('0x3d')](_0x63f61[_0x7980('0x38')][_0x7980('0x3d')]));_0x33f947['attributes']=_0x33f947[_0x7980('0x3e')]['length']?_0x33f947[_0x7980('0x3e')]:_0x4218e0[_0x7980('0x3c')];if(_0x63f61['query']['includeAll']){_0x33f947[_0x7980('0x48')]=[{'all':!![]}];}_0x33f947=_[_0x7980('0x44')]({},_0x33f947,_0x63f61[_0x7980('0x45')]);return db[_0x7980('0x33')][_0x7980('0x4c')](_0x33f947)[_0x7980('0x28')](handleEntityNotFound(_0x5941ee,null))['then'](respondWithResult(_0x5941ee,null))[_0x7980('0x4d')](handleError(_0x5941ee,null));};exports['create']=function(_0x3011c3,_0x2865be){return db[_0x7980('0x33')][_0x7980('0x4e')](_0x3011c3[_0x7980('0x4f')],{})[_0x7980('0x28')](function(_0x1f3ef5){var _0x26399f=_0x3011c3[_0x7980('0x50')][_0x7980('0x51')]({'plain':!![]});if(!_0x26399f)throw new Error(_0x7980('0x52'));if(_0x26399f['role']==='user'){var _0x1f7442=_0x1f3ef5[_0x7980('0x51')]({'plain':!![]});var _0x3297c5=_0x7980('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x3297c5,'userProfileId':_0x26399f[_0x7980('0x53')]},'raw':!![]})[_0x7980('0x28')](function(_0x24a336){if(_0x24a336&&_0x24a336[_0x7980('0x54')]===0x0){return db[_0x7980('0x2b')][_0x7980('0x4e')]({'name':_0x1f7442['name'],'resourceId':_0x1f7442['id'],'type':_0x24a336[_0x7980('0x2f')],'sectionId':_0x24a336['id']},{})['then'](function(){return _0x1f3ef5;});}else{return _0x1f3ef5;}})[_0x7980('0x4d')](function(_0x148b11){logger[_0x7980('0x2d')](_0x7980('0x55'),_0x148b11);throw _0x148b11;});}return _0x1f3ef5;})[_0x7980('0x28')](respondWithResult(_0x2865be,0xc9))[_0x7980('0x4d')](handleError(_0x2865be,null));};exports[_0x7980('0x56')]=function(_0x206f25,_0x524b77){if(_0x206f25['body']['id']){delete _0x206f25['body']['id'];}return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x206f25['params']['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x524b77,null))[_0x7980('0x28')](saveUpdates(_0x206f25[_0x7980('0x4f')],null))[_0x7980('0x28')](respondWithResult(_0x524b77,null))[_0x7980('0x4d')](handleError(_0x524b77,null));};exports['destroy']=function(_0x137717,_0x34b937){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x137717[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x34b937,null))[_0x7980('0x28')](removeEntity(_0x34b937,null))['catch'](handleError(_0x34b937,null));};exports[_0x7980('0x58')]=function(_0x335b34,_0x433b55){return db[_0x7980('0x33')][_0x7980('0x58')]()[_0x7980('0x28')](respondWithResult(_0x433b55,null))['catch'](handleError(_0x433b55,null));};exports['addDisposition']=function(_0x4715fc,_0x2c18d5,_0x4e2da7){if(_0x4715fc[_0x7980('0x4f')]['id']){delete _0x4715fc[_0x7980('0x4f')]['id'];}return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x4715fc[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x2c18d5,null))[_0x7980('0x28')](function(_0x1b5f74){if(_0x1b5f74){_0x4715fc['body'][_0x7980('0x59')]=_0x1b5f74['id'];return db[_0x7980('0x5a')][_0x7980('0x4e')](_0x4715fc[_0x7980('0x4f')]);}})[_0x7980('0x28')](respondWithResult(_0x2c18d5,null))[_0x7980('0x4d')](handleError(_0x2c18d5,null));};exports[_0x7980('0x5b')]=function(_0x11d56e,_0x57686c,_0x5efe4f){var _0x304242={'raw':![],'where':{}};var _0xd9bedc={};var _0x3b4bb8={'count':0x0,'rows':[]};return db['CmList'][_0x7980('0x5c')]({'where':{'id':_0x11d56e[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x57686c,null))[_0x7980('0x28')](function(_0x41d22d){if(_0x41d22d){_0xd9bedc[_0x7980('0x3c')]=_[_0x7980('0x39')](db['Disposition'][_0x7980('0x34')]);_0xd9bedc[_0x7980('0x38')]=_[_0x7980('0x39')](_0x11d56e[_0x7980('0x38')]);_0xd9bedc['filters']=_[_0x7980('0x3b')](_0xd9bedc[_0x7980('0x3c')],_0xd9bedc['query']);_0x304242['attributes']=_['intersection'](_0xd9bedc[_0x7980('0x3c')],qs[_0x7980('0x3d')](_0x11d56e[_0x7980('0x38')][_0x7980('0x3d')]));_0x304242['attributes']=_0x304242[_0x7980('0x3e')]['length']?_0x304242['attributes']:_0xd9bedc[_0x7980('0x3c')];if(!_0x11d56e[_0x7980('0x38')][_0x7980('0x3f')](_0x7980('0x40'))){_0x304242[_0x7980('0x23')]=qs[_0x7980('0x23')](_0x11d56e[_0x7980('0x38')][_0x7980('0x23')]);_0x304242[_0x7980('0x22')]=qs[_0x7980('0x22')](_0x11d56e[_0x7980('0x38')][_0x7980('0x22')]);}_0x304242[_0x7980('0x5d')]=qs[_0x7980('0x41')](_0x11d56e['query'][_0x7980('0x41')]);_0x304242['where']=qs['filters'](_['pick'](_0x11d56e[_0x7980('0x38')],_0xd9bedc[_0x7980('0x3a')]));_0x304242[_0x7980('0x42')][_0x7980('0x59')]=_0x41d22d['id'];if(_0x11d56e['query'][_0x7980('0x43')]){_0x304242[_0x7980('0x42')]=_[_0x7980('0x44')](_0x304242[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0x304242[_0x7980('0x3e')],function(_0x196fc){var _0x399ab4={};_0x399ab4[_0x196fc]={'$like':'%'+_0x11d56e['query'][_0x7980('0x43')]+'%'};return _0x399ab4;})});}_0x304242=_[_0x7980('0x44')]({},_0x304242,_0x11d56e[_0x7980('0x45')]);return db[_0x7980('0x5a')][_0x7980('0x46')]({'where':_0x304242[_0x7980('0x42')]})[_0x7980('0x28')](function(_0x1c708c){_0x3b4bb8[_0x7980('0x46')]=_0x1c708c;if(_0x11d56e[_0x7980('0x38')][_0x7980('0x47')]){_0x304242[_0x7980('0x48')]=[{'all':!![]}];}return db['Disposition'][_0x7980('0x49')](_0x304242);})[_0x7980('0x28')](function(_0x32802a){_0x3b4bb8['rows']=_0x32802a;return _0x3b4bb8;});}})['then'](respondWithFilteredResult(_0x57686c,_0x304242))[_0x7980('0x4d')](handleError(_0x57686c,null));};exports[_0x7980('0x5e')]=function(_0x585059,_0x645d55,_0x4f43b0){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x585059[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x645d55,null))[_0x7980('0x28')](function(_0x938d6e){if(_0x938d6e){return _0x938d6e[_0x7980('0x5e')](_0x585059[_0x7980('0x38')][_0x7980('0x5f')]);}})[_0x7980('0x28')](respondWithStatusCode(_0x645d55,null))['catch'](handleError(_0x645d55,null));};exports[_0x7980('0x60')]=function(_0x1d69b3,_0x5ce9ff,_0x5e653f){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x1d69b3[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x5ce9ff,null))['then'](function(_0x5665f5){if(_0x5665f5){var _0x386f56=[];var _0x341a22={'success':[],'errors':[]};return db[_0x7980('0x61')][_0x7980('0x58')]()[_0x7980('0x28')](function(_0x313d48){if(_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')]&&_[_0x7980('0x63')](_0x1d69b3['body'][_0x7980('0x62')])){if(_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')][_0x7980('0x64')]){_0x1d69b3['body'][_0x7980('0x62')]=_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')][_0x7980('0x65')](';')+';';}else{_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')]=null;}}else{_0x1d69b3[_0x7980('0x4f')]['tags']=null;}if(_0x1d69b3['body']&&_['isArray'](_0x1d69b3[_0x7980('0x4f')])){for(var _0x1defa5=0x0;_0x1defa5<_0x1d69b3[_0x7980('0x4f')][_0x7980('0x64')];_0x1defa5+=0x1){_0x1d69b3[_0x7980('0x4f')][_0x1defa5][_0x7980('0x59')]=_0x1d69b3[_0x7980('0x57')]['id'];_0x386f56['push'](_0x1d69b3['body'][_0x1defa5]);}return BPromise[_0x7980('0x66')](_0x386f56,function(_0x294345){return db[_0x7980('0x61')][_0x7980('0x4e')](_[_0x7980('0x67')](_0x294345,[_0x7980('0x5f'),'id'])||{},{'fields':_[_0x7980('0x39')](_0x313d48),'raw':!![]})[_0x7980('0x28')](function(_0x4551b7){_0x341a22[_0x7980('0x68')][_0x7980('0x69')](_0x4551b7[_0x7980('0x6a')]);})[_0x7980('0x4d')](function(_0x7c49bd){_0x341a22[_0x7980('0x6b')]['push']({'data':_0x294345,'error':_0x7c49bd[_0x7980('0x6c')]});});})['then'](function(_0x5989eb){return _0x341a22;})[_0x7980('0x4d')](function(_0x4c2546){return _0x4c2546;});}else{_0x5ce9ff[_0x7980('0x20')](0x190)[_0x7980('0x21')]({'message':_0x7980('0x6d')});}});}})[_0x7980('0x28')](respondWithResult(_0x5ce9ff,null))[_0x7980('0x4d')](handleError(_0x5ce9ff,null));};exports['getContacts']=function(_0x296e23,_0x466ce0,_0x1a4421){var _0x4490ae;return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x296e23[_0x7980('0x57')]['id']},'include':[{'model':db[_0x7980('0x6e')],'as':'CustomFields'}]})[_0x7980('0x28')](handleEntityNotFound(_0x466ce0,null))[_0x7980('0x28')](function(_0xf85c11){if(_0xf85c11){_0x4490ae=_0xf85c11;return db[_0x7980('0x61')][_0x7980('0x34')];}})[_0x7980('0x28')](function(_0x29af83){if(_0x29af83){var _0xb38c8={};var _0x422e0d={};_0x422e0d[_0x7980('0x3c')]=_[_0x7980('0x6f')](_[_0x7980('0x39')](_0x29af83),_[_0x7980('0x32')](_0x4490ae[_0x7980('0x70')],function(_0x46849b){return util[_0x7980('0x71')]('cf_%d',_0x46849b['id']);}));_0x422e0d['query']=_[_0x7980('0x39')](_0x296e23[_0x7980('0x38')]);_0x422e0d['filters']=_[_0x7980('0x3b')](_0x422e0d[_0x7980('0x3c')],_0x422e0d[_0x7980('0x38')]);_0xb38c8[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x422e0d['model'],qs[_0x7980('0x3d')](_0x296e23[_0x7980('0x38')][_0x7980('0x3d')]));_0xb38c8['attributes']=_0xb38c8['attributes'][_0x7980('0x64')]?_0xb38c8['attributes']:_0x422e0d[_0x7980('0x3c')];if(!_0x296e23[_0x7980('0x38')][_0x7980('0x3f')](_0x7980('0x40'))){_0xb38c8['limit']=qs[_0x7980('0x23')](_0x296e23[_0x7980('0x38')]['limit']);_0xb38c8['offset']=qs[_0x7980('0x22')](_0x296e23[_0x7980('0x38')][_0x7980('0x22')]);}_0xb38c8[_0x7980('0x5d')]=qs[_0x7980('0x41')](_0x296e23['query']['sort']);_0xb38c8[_0x7980('0x42')]=qs[_0x7980('0x3a')](_['pick'](_0x296e23['query'],_0x422e0d[_0x7980('0x3a')]));_0xb38c8[_0x7980('0x72')]=!![];if(_0x296e23[_0x7980('0x38')][_0x7980('0x43')]){_0xb38c8[_0x7980('0x42')]=_[_0x7980('0x44')](_0xb38c8[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0xb38c8[_0x7980('0x3e')],function(_0x12ead9){var _0x47b28a={};_0x47b28a[_0x12ead9]={'$like':'%'+_0x296e23[_0x7980('0x38')]['filter']+'%'};return _0x47b28a;})});}_0xb38c8=_[_0x7980('0x44')]({},_0xb38c8,_0x296e23[_0x7980('0x45')]);return _0x4490ae[_0x7980('0x73')](_0xb38c8);}})[_0x7980('0x28')](respondWithResult(_0x466ce0,null))[_0x7980('0x4d')](handleError(_0x466ce0,null));};exports[_0x7980('0x74')]=function(_0x5573d2,_0x417a09,_0x224b38){var _0xa8b3a3;return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x5573d2[_0x7980('0x57')]['id']},'include':[{'model':db[_0x7980('0x6e')],'as':_0x7980('0x70')}]})[_0x7980('0x28')](handleEntityNotFound(_0x417a09,null))['then'](function(_0x2c5e48){if(_0x2c5e48){_0xa8b3a3=_0x2c5e48;return db[_0x7980('0x61')][_0x7980('0x34')];}})[_0x7980('0x28')](function(_0x2cfe53){if(_0x2cfe53){var _0x3927e8={};var _0x1ad17d={};_0x1ad17d[_0x7980('0x3c')]=_[_0x7980('0x6f')](_[_0x7980('0x39')](_0x2cfe53),_[_0x7980('0x32')](_0xa8b3a3[_0x7980('0x70')],function(_0x584612){return util[_0x7980('0x71')]('cf_%d',_0x584612['id']);}));_0x1ad17d[_0x7980('0x38')]=_[_0x7980('0x39')](_0x5573d2[_0x7980('0x38')]);_0x1ad17d['filters']=_[_0x7980('0x3b')](_0x1ad17d[_0x7980('0x3c')],_0x1ad17d[_0x7980('0x38')]);_0x3927e8[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x1ad17d[_0x7980('0x3c')],qs[_0x7980('0x3d')](_0x5573d2['query']['fields']));_0x3927e8[_0x7980('0x3e')]=_0x3927e8[_0x7980('0x3e')][_0x7980('0x64')]?_0x3927e8['attributes']:_0x1ad17d[_0x7980('0x3c')];if(!_0x5573d2['query']['hasOwnProperty'](_0x7980('0x40'))){_0x3927e8['limit']=qs[_0x7980('0x23')](_0x5573d2[_0x7980('0x38')][_0x7980('0x23')]);_0x3927e8[_0x7980('0x22')]=qs['offset'](_0x5573d2['query']['offset']);}_0x3927e8[_0x7980('0x5d')]=qs[_0x7980('0x41')](_0x5573d2[_0x7980('0x38')][_0x7980('0x41')]);_0x3927e8[_0x7980('0x42')]=qs[_0x7980('0x3a')](_[_0x7980('0x75')](_0x5573d2[_0x7980('0x38')],_0x1ad17d[_0x7980('0x3a')]));_0x3927e8['raw']=!![];if(_0x5573d2[_0x7980('0x38')][_0x7980('0x43')]){_0x3927e8['where']=_[_0x7980('0x44')](_0x3927e8[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0x3927e8['attributes'],function(_0x107d11){var _0x1d59e0={};_0x1d59e0[_0x107d11]={'$like':'%'+_0x5573d2[_0x7980('0x38')][_0x7980('0x43')]+'%'};return _0x1d59e0;})});}_0x3927e8=_[_0x7980('0x44')]({},_0x3927e8,_0x5573d2['options']);return _0xa8b3a3[_0x7980('0x73')](_0x3927e8);}})[_0x7980('0x28')](function(_0x3ac005){if(!_[_0x7980('0x76')](_0x3ac005)){var _0x128f91=toCsv(_0x3ac005);var _0x1c95ac=Date[_0x7980('0x77')]();fs[_0x7980('0x78')](util[_0x7980('0x71')](_0x7980('0x79'),_0xa8b3a3['id'],_0x1c95ac),_0x128f91);_0x417a09[_0x7980('0x7a')](_0x7980('0x7b'),_0x7980('0x7c')+util[_0x7980('0x71')](_0x7980('0x7d'),_0xa8b3a3['id'],_0x1c95ac));_0x417a09[_0x7980('0x7a')]('Content-type',_0x7980('0x7e'));return _0x417a09[_0x7980('0x7f')](util[_0x7980('0x71')](_0x7980('0x79'),_0xa8b3a3['id'],_0x1c95ac));}else{return _0x417a09[_0x7980('0x1f')](0xcc);}})[_0x7980('0x4d')](handleError(_0x417a09,null));};exports['addCustomField']=function(_0x26f53f,_0x5a4b60,_0x39f2f6){var _0x4c211e;delete _0x26f53f['body']['id'];return db[_0x7980('0x33')][_0x7980('0x5c')]({'where':{'id':_0x26f53f[_0x7980('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a4b60,null))[_0x7980('0x28')](function(_0x4488dc){if(_0x4488dc){return db[_0x7980('0x80')][_0x7980('0x81')](function(_0x3a2a02){return db[_0x7980('0x6e')]['create'](_0x26f53f[_0x7980('0x4f')],{'transaction':_0x3a2a02})[_0x7980('0x28')](function(_0x3cf976){_0x4c211e=_0x3cf976;return _0x4488dc[_0x7980('0x82')](_0x3cf976,{'transaction':_0x3a2a02});})[_0x7980('0x28')](function(){var _0x59bced={'type':db[_0x7980('0x83')][_0x7980('0x84')],'transaction':_0x3a2a02};switch(_0x26f53f[_0x7980('0x4f')][_0x7980('0x36')]){case _0x7980('0x85'):_0x59bced['type']=db[_0x7980('0x83')]['TEXT'];break;case _0x7980('0x86'):_0x59bced[_0x7980('0x36')]=db['Sequelize'][_0x7980('0x87')];break;case'switch':_0x59bced[_0x7980('0x36')]=db[_0x7980('0x83')][_0x7980('0x88')];_0x59bced['defaultValue']=![];break;default:}return db[_0x7980('0x80')]['queryInterface'][_0x7980('0x89')](_0x7980('0x8a'),util[_0x7980('0x71')](_0x7980('0x8b'),_0x4c211e['id']),_0x59bced);})[_0x7980('0x28')](function(){return _0x4c211e;});});}})[_0x7980('0x28')](respondWithResult(_0x5a4b60,null))['catch'](handleError(_0x5a4b60,null));};exports[_0x7980('0x8c')]=function(_0xf09aaa,_0x5bdad6,_0x197d6d){var _0x11bbe7={};var _0x3a8649={};var _0x2d5ccd;var _0x4d9368;return db[_0x7980('0x33')][_0x7980('0x5c')]({'where':{'id':_0xf09aaa['params']['id']}})['then'](handleEntityNotFound(_0x5bdad6,null))['then'](function(_0x2ce9cf){if(_0x2ce9cf){_0x2d5ccd=_0x2ce9cf;_0x3a8649[_0x7980('0x3c')]=_[_0x7980('0x39')](db[_0x7980('0x6e')][_0x7980('0x34')]);_0x3a8649[_0x7980('0x38')]=_[_0x7980('0x39')](_0xf09aaa[_0x7980('0x38')]);_0x3a8649[_0x7980('0x3a')]=_[_0x7980('0x3b')](_0x3a8649[_0x7980('0x3c')],_0x3a8649[_0x7980('0x38')]);_0x11bbe7[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x3a8649['model'],qs[_0x7980('0x3d')](_0xf09aaa[_0x7980('0x38')][_0x7980('0x3d')]));_0x11bbe7['attributes']=_0x11bbe7['attributes']['length']?_0x11bbe7[_0x7980('0x3e')]:_0x3a8649['model'];_0x11bbe7['order']=qs[_0x7980('0x41')](_0xf09aaa[_0x7980('0x38')][_0x7980('0x41')]);_0x11bbe7[_0x7980('0x42')]=qs['filters'](_[_0x7980('0x75')](_0xf09aaa[_0x7980('0x38')],_0x3a8649[_0x7980('0x3a')]));_0x11bbe7[_0x7980('0x42')]=_[_0x7980('0x44')](_0x11bbe7[_0x7980('0x42')],{'$or':[{'ListId':_0x2ce9cf['id']},{'ListId':null}]});if(_0xf09aaa['query'][_0x7980('0x43')]){_0x11bbe7['where']=_[_0x7980('0x44')](_0x11bbe7[_0x7980('0x42')],{'$or':_['map'](_0x11bbe7[_0x7980('0x3e')],function(_0x1d6375){var _0x1b1087={};_0x1b1087[_0x1d6375]={'$like':'%'+_0xf09aaa[_0x7980('0x38')][_0x7980('0x43')]+'%'};return _0x1b1087;})});}_0x11bbe7=_[_0x7980('0x44')]({},_0x11bbe7,_0xf09aaa['options']);return db[_0x7980('0x6e')][_0x7980('0x8d')](_0x11bbe7);}})['then'](respondWithResult(_0x5bdad6,null))[_0x7980('0x4d')](handleError(_0x5bdad6,null));};exports[_0x7980('0x8e')]=function(_0x4759dc,_0xbbbf83,_0x5a22aa){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x4759dc[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0xbbbf83,null))[_0x7980('0x28')](function(_0x4edf5b){if(_0x4edf5b){return _0x4edf5b[_0x7980('0x8e')](_0x4759dc['body'][_0x7980('0x5f')],_[_0x7980('0x67')](_0x4759dc[_0x7980('0x4f')],[_0x7980('0x5f'),'id'])||{})[_0x7980('0x8f')](function(_0x4c1957){for(var _0x1cef0e=0x0;_0x1cef0e<_0x4759dc[_0x7980('0x4f')][_0x7980('0x5f')][_0x7980('0x64')];_0x1cef0e+=0x1){socket[_0x7980('0x90')]('userCmList:save',{'UserId':_0x4759dc[_0x7980('0x4f')][_0x7980('0x5f')][_0x1cef0e],'CmListId':_0x4759dc['params']['id']});}return _0x4c1957;});}})[_0x7980('0x28')](respondWithResult(_0xbbbf83,null))[_0x7980('0x4d')](handleError(_0xbbbf83,null));};exports[_0x7980('0x91')]=function(_0x362feb,_0x713c8c,_0x3a60c0){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x362feb[_0x7980('0x57')]['id']}})['then'](handleEntityNotFound(_0x713c8c,null))['then'](function(_0x39d922){if(_0x39d922){return _0x39d922[_0x7980('0x91')](_0x362feb['query'][_0x7980('0x5f')])['then'](function(){if(_[_0x7980('0x63')](_0x362feb[_0x7980('0x38')][_0x7980('0x5f')])){for(var _0x2b1c53=0x0;_0x2b1c53<_0x362feb[_0x7980('0x38')][_0x7980('0x5f')][_0x7980('0x64')];_0x2b1c53+=0x1){socket[_0x7980('0x90')]('userCmList:remove',{'UserId':Number(_0x362feb['query']['ids'][_0x2b1c53]),'CmListId':Number(_0x362feb[_0x7980('0x57')]['id'])});}}else{socket[_0x7980('0x90')](_0x7980('0x92'),{'UserId':Number(_0x362feb[_0x7980('0x38')]['ids']),'CmListId':Number(_0x362feb[_0x7980('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x713c8c,null))[_0x7980('0x4d')](handleError(_0x713c8c,null));};exports[_0x7980('0x93')]=function(_0x2a2b1a,_0x4f8efd,_0x3b1cef){var _0x401940={};var _0x4da947={};var _0x2cac56;var _0x5e2d6b;return db[_0x7980('0x33')]['findOne']({'where':{'id':_0x2a2b1a[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x4f8efd,null))[_0x7980('0x28')](function(_0x156cb1){if(_0x156cb1){_0x2cac56=_0x156cb1;_0x4da947['model']=_['keys'](db[_0x7980('0x94')]['rawAttributes']);_0x4da947[_0x7980('0x38')]=_[_0x7980('0x39')](_0x2a2b1a[_0x7980('0x38')]);_0x4da947['filters']=_['intersection'](_0x4da947[_0x7980('0x3c')],_0x4da947['query']);_0x401940[_0x7980('0x3e')]=_['intersection'](_0x4da947['model'],qs[_0x7980('0x3d')](_0x2a2b1a[_0x7980('0x38')][_0x7980('0x3d')]));_0x401940[_0x7980('0x3e')]=_0x401940[_0x7980('0x3e')][_0x7980('0x64')]?_0x401940[_0x7980('0x3e')]:_0x4da947[_0x7980('0x3c')];_0x401940['order']=qs['sort'](_0x2a2b1a['query'][_0x7980('0x41')]);_0x401940['where']=qs[_0x7980('0x3a')](_[_0x7980('0x75')](_0x2a2b1a[_0x7980('0x38')],_0x4da947[_0x7980('0x3a')]));if(_0x2a2b1a['query'][_0x7980('0x43')]){_0x401940['where']=_[_0x7980('0x44')](_0x401940[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0x401940[_0x7980('0x3e')],function(_0x11f7fb){var _0x93c1de={};_0x93c1de[_0x11f7fb]={'$like':'%'+_0x2a2b1a[_0x7980('0x38')]['filter']+'%'};return _0x93c1de;})});}_0x401940=_[_0x7980('0x44')]({},_0x401940,_0x2a2b1a['options']);return _0x2cac56[_0x7980('0x93')](_0x401940);}})[_0x7980('0x28')](function(_0x53f3ee){if(_0x53f3ee){_0x5e2d6b=_0x53f3ee[_0x7980('0x64')];if(!_0x2a2b1a[_0x7980('0x38')]['hasOwnProperty'](_0x7980('0x40'))){_0x401940[_0x7980('0x23')]=qs[_0x7980('0x23')](_0x2a2b1a[_0x7980('0x38')][_0x7980('0x23')]);_0x401940[_0x7980('0x22')]=qs[_0x7980('0x22')](_0x2a2b1a[_0x7980('0x38')][_0x7980('0x22')]);}return _0x2cac56['getAgents'](_0x401940);}})[_0x7980('0x28')](function(_0x436982){if(_0x436982){return _0x436982?{'count':_0x5e2d6b,'rows':_0x436982}:null;}})[_0x7980('0x28')](respondWithResult(_0x4f8efd,null))[_0x7980('0x4d')](handleError(_0x4f8efd,null));}; \ No newline at end of file +var _0xea31=['pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','ids','CmContact','tags','isArray','length','join','each','omit','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','nolimit','limit','sort','where'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xea31,0x17f));var _0x1ea3=function(_0x20208d,_0x1bde33){_0x20208d=_0x20208d-0x0;var _0x4f7367=_0xea31[_0x20208d];return _0x4f7367;};'use strict';var pdf=require(_0x1ea3('0x0'));var emlformat=require(_0x1ea3('0x1'));var rimraf=require(_0x1ea3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ea3('0x3'));var rp=require(_0x1ea3('0x4'));var moment=require(_0x1ea3('0x5'));var BPromise=require(_0x1ea3('0x6'));var Mustache=require('mustache');var util=require(_0x1ea3('0x7'));var path=require(_0x1ea3('0x8'));var sox=require(_0x1ea3('0x9'));var csv=require(_0x1ea3('0xa'));var ejs=require(_0x1ea3('0xb'));var fs=require('fs');var _=require(_0x1ea3('0xc'));var squel=require('squel');var crypto=require(_0x1ea3('0xd'));var jsforce=require(_0x1ea3('0xe'));var deskjs=require(_0x1ea3('0xf'));var toCsv=require(_0x1ea3('0xa'));var querystring=require(_0x1ea3('0x10'));var Papa=require(_0x1ea3('0x11'));var Redis=require(_0x1ea3('0x12'));var authService=require(_0x1ea3('0x13'));var qs=require(_0x1ea3('0x14'));var as=require(_0x1ea3('0x15'));var hardwareService=require(_0x1ea3('0x16'));var logger=require('../../config/logger')(_0x1ea3('0x17'));var utils=require(_0x1ea3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ea3('0x19'));var db=require('../../mysqldb')['db'];config[_0x1ea3('0x1a')]=_[_0x1ea3('0x1b')](config['redis'],{'host':_0x1ea3('0x1c'),'port':0x18eb});var socket=require(_0x1ea3('0x1d'))(new Redis(config[_0x1ea3('0x1a')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x4bce10,_0x51e47f){_0x51e47f=_0x51e47f||0xcc;return function(_0x41cfb5){if(_0x41cfb5){return _0x4bce10['sendStatus'](_0x51e47f);}return _0x4bce10[_0x1ea3('0x1e')](_0x51e47f)[_0x1ea3('0x1f')]();};}function respondWithResult(_0x22ac8c,_0x4d6af9){_0x4d6af9=_0x4d6af9||0xc8;return function(_0x19a7ae){if(_0x19a7ae){return _0x22ac8c['status'](_0x4d6af9)[_0x1ea3('0x20')](_0x19a7ae);}};}function respondWithFilteredResult(_0x5a6961,_0x5a89ec){return function(_0x315144){if(_0x315144){var _0x5f00cf=_0x315144[_0x1ea3('0x21')],_0x4354dd=_0x5a89ec[_0x1ea3('0x22')],_0x431d6a=_0x5a89ec[_0x1ea3('0x22')]+_0x5a89ec['limit'],_0x320d28;if(_0x431d6a>=_0x5f00cf){_0x431d6a=_0x5f00cf;_0x320d28=0xc8;}else{_0x320d28=0xce;}_0x5a6961[_0x1ea3('0x1e')](_0x320d28);return _0x5a6961[_0x1ea3('0x23')](_0x1ea3('0x24'),_0x4354dd+'-'+_0x431d6a+'/'+_0x5f00cf)['json'](_0x315144);}return null;};}function patchUpdates(_0x3b7582){return function(_0x5e59ba){try{jsonpatch[_0x1ea3('0x25')](_0x5e59ba,_0x3b7582,!![]);}catch(_0x2dbf0a){return BPromise['reject'](_0x2dbf0a);}return _0x5e59ba[_0x1ea3('0x26')]();};}function saveUpdates(_0x52f3f7,_0x12dcc8){return function(_0x4c5561){if(_0x4c5561){return _0x4c5561[_0x1ea3('0x27')](_0x52f3f7)['then'](function(_0x100d11){return _0x100d11;});}return null;};}function removeEntity(_0xfd39ea,_0x126fd1){return function(_0x1496ee){if(_0x1496ee){return _0x1496ee[_0x1ea3('0x28')]()[_0x1ea3('0x29')](function(){var _0x466381=_0x1496ee[_0x1ea3('0x2a')]({'plain':!![]});var _0x2a3c8c='Lists';return db[_0x1ea3('0x2b')][_0x1ea3('0x28')]({'where':{'type':_0x2a3c8c,'resourceId':_0x466381['id']}})[_0x1ea3('0x29')](function(){return _0x1496ee;});})[_0x1ea3('0x29')](function(){_0xfd39ea[_0x1ea3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257f39,_0x535fd0){return function(_0x368a10){if(!_0x368a10){_0x257f39['sendStatus'](0x194);}return _0x368a10;};}function handleError(_0x49379c,_0x3e9ade){_0x3e9ade=_0x3e9ade||0x1f4;return function(_0x135347){logger[_0x1ea3('0x2c')](_0x135347[_0x1ea3('0x2d')]);if(_0x135347[_0x1ea3('0x2e')]){delete _0x135347[_0x1ea3('0x2e')];}_0x49379c[_0x1ea3('0x1e')](_0x3e9ade)[_0x1ea3('0x2f')](_0x135347);};}exports[_0x1ea3('0x30')]=function(_0x581729,_0x2d44d6){var _0x3694a6={},_0x5ad487={},_0x991781={'count':0x0,'rows':[]};var _0x59efa3=_[_0x1ea3('0x31')](db[_0x1ea3('0x32')][_0x1ea3('0x33')],function(_0x13da46){return{'name':_0x13da46['fieldName'],'type':_0x13da46[_0x1ea3('0x34')][_0x1ea3('0x35')]};});_0x5ad487[_0x1ea3('0x36')]=_[_0x1ea3('0x31')](_0x59efa3,'name');_0x5ad487['query']=_[_0x1ea3('0x37')](_0x581729[_0x1ea3('0x38')]);_0x5ad487['filters']=_['intersection'](_0x5ad487[_0x1ea3('0x36')],_0x5ad487['query']);_0x3694a6[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x5ad487['model'],qs[_0x1ea3('0x3b')](_0x581729[_0x1ea3('0x38')]['fields']));_0x3694a6['attributes']=_0x3694a6[_0x1ea3('0x39')]['length']?_0x3694a6[_0x1ea3('0x39')]:_0x5ad487[_0x1ea3('0x36')];if(!_0x581729[_0x1ea3('0x38')]['hasOwnProperty'](_0x1ea3('0x3c'))){_0x3694a6[_0x1ea3('0x3d')]=qs[_0x1ea3('0x3d')](_0x581729[_0x1ea3('0x38')]['limit']);_0x3694a6['offset']=qs['offset'](_0x581729[_0x1ea3('0x38')]['offset']);}_0x3694a6['order']=qs[_0x1ea3('0x3e')](_0x581729[_0x1ea3('0x38')][_0x1ea3('0x3e')]);_0x3694a6[_0x1ea3('0x3f')]=qs['filters'](_[_0x1ea3('0x40')](_0x581729['query'],_0x5ad487[_0x1ea3('0x41')]),_0x59efa3);if(_0x581729[_0x1ea3('0x38')][_0x1ea3('0x42')]){_0x3694a6[_0x1ea3('0x3f')]=_['merge'](_0x3694a6[_0x1ea3('0x3f')],{'$or':_[_0x1ea3('0x31')](_0x59efa3,function(_0x2bfb45){if(_0x2bfb45[_0x1ea3('0x34')]!==_0x1ea3('0x43')){var _0x1e4b25={};_0x1e4b25[_0x2bfb45[_0x1ea3('0x2e')]]={'$like':'%'+_0x581729['query'][_0x1ea3('0x42')]+'%'};return _0x1e4b25;}})});}_0x3694a6=_[_0x1ea3('0x44')]({},_0x3694a6,_0x581729[_0x1ea3('0x45')]);var _0xedd0d2={'where':_0x3694a6[_0x1ea3('0x3f')]};return db['CmList'][_0x1ea3('0x21')](_0xedd0d2)[_0x1ea3('0x29')](function(_0x1fe3be){_0x991781[_0x1ea3('0x21')]=_0x1fe3be;if(_0x581729[_0x1ea3('0x38')][_0x1ea3('0x46')]){_0x3694a6['include']=[{'all':!![]}];}return db['CmList'][_0x1ea3('0x47')](_0x3694a6);})['then'](function(_0x6224f6){_0x991781[_0x1ea3('0x48')]=_0x6224f6;return _0x991781;})[_0x1ea3('0x29')](respondWithFilteredResult(_0x2d44d6,_0x3694a6))[_0x1ea3('0x49')](handleError(_0x2d44d6,null));};exports[_0x1ea3('0x4a')]=function(_0x590464,_0x35fd46){var _0x124e8b={'raw':![],'where':{'id':_0x590464[_0x1ea3('0x4b')]['id']}},_0x445855={};_0x445855[_0x1ea3('0x36')]=_[_0x1ea3('0x37')](db[_0x1ea3('0x32')][_0x1ea3('0x33')]);_0x445855[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x590464['query']);_0x445855[_0x1ea3('0x41')]=_['intersection'](_0x445855[_0x1ea3('0x36')],_0x445855[_0x1ea3('0x38')]);_0x124e8b[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x445855[_0x1ea3('0x36')],qs['fields'](_0x590464[_0x1ea3('0x38')]['fields']));_0x124e8b[_0x1ea3('0x39')]=_0x124e8b['attributes']['length']?_0x124e8b[_0x1ea3('0x39')]:_0x445855['model'];if(_0x590464[_0x1ea3('0x38')][_0x1ea3('0x46')]){_0x124e8b[_0x1ea3('0x4c')]=[{'all':!![]}];}_0x124e8b=_[_0x1ea3('0x44')]({},_0x124e8b,_0x590464[_0x1ea3('0x45')]);return db[_0x1ea3('0x32')][_0x1ea3('0x4d')](_0x124e8b)[_0x1ea3('0x29')](handleEntityNotFound(_0x35fd46,null))[_0x1ea3('0x29')](respondWithResult(_0x35fd46,null))[_0x1ea3('0x49')](handleError(_0x35fd46,null));};exports['create']=function(_0x4a7673,_0x4af2d1){return db['CmList']['create'](_0x4a7673[_0x1ea3('0x4e')],{})[_0x1ea3('0x29')](function(_0x516e49){var _0x5f596d=_0x4a7673[_0x1ea3('0x4f')]['get']({'plain':!![]});if(!_0x5f596d)throw new Error(_0x1ea3('0x50'));if(_0x5f596d[_0x1ea3('0x51')]===_0x1ea3('0x4f')){var _0x142c71=_0x516e49['get']({'plain':!![]});var _0x5e05ca=_0x1ea3('0x52');return db[_0x1ea3('0x53')][_0x1ea3('0x4d')]({'where':{'name':_0x5e05ca,'userProfileId':_0x5f596d[_0x1ea3('0x54')]},'raw':!![]})[_0x1ea3('0x29')](function(_0x4acdea){if(_0x4acdea&&_0x4acdea[_0x1ea3('0x55')]===0x0){return db[_0x1ea3('0x2b')][_0x1ea3('0x56')]({'name':_0x142c71[_0x1ea3('0x2e')],'resourceId':_0x142c71['id'],'type':_0x4acdea['name'],'sectionId':_0x4acdea['id']},{})[_0x1ea3('0x29')](function(){return _0x516e49;});}else{return _0x516e49;}})[_0x1ea3('0x49')](function(_0x16d58c){logger['error'](_0x1ea3('0x57'),_0x16d58c);throw _0x16d58c;});}return _0x516e49;})[_0x1ea3('0x29')](respondWithResult(_0x4af2d1,0xc9))[_0x1ea3('0x49')](handleError(_0x4af2d1,null));};exports['update']=function(_0x59170c,_0x2f3f41){if(_0x59170c['body']['id']){delete _0x59170c[_0x1ea3('0x4e')]['id'];}return db[_0x1ea3('0x32')]['find']({'where':{'id':_0x59170c[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x2f3f41,null))[_0x1ea3('0x29')](saveUpdates(_0x59170c[_0x1ea3('0x4e')],null))['then'](respondWithResult(_0x2f3f41,null))['catch'](handleError(_0x2f3f41,null));};exports[_0x1ea3('0x28')]=function(_0x32dcd6,_0x433027){return db['CmList'][_0x1ea3('0x4d')]({'where':{'id':_0x32dcd6[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x433027,null))[_0x1ea3('0x29')](removeEntity(_0x433027,null))['catch'](handleError(_0x433027,null));};exports[_0x1ea3('0x58')]=function(_0x108721,_0x2a6d18){return db[_0x1ea3('0x32')]['describe']()['then'](respondWithResult(_0x2a6d18,null))[_0x1ea3('0x49')](handleError(_0x2a6d18,null));};exports[_0x1ea3('0x59')]=function(_0x1a47f8,_0x1b6a6f,_0x2f0fd6){if(_0x1a47f8[_0x1ea3('0x4e')]['id']){delete _0x1a47f8[_0x1ea3('0x4e')]['id'];}return db[_0x1ea3('0x32')][_0x1ea3('0x4d')]({'where':{'id':_0x1a47f8[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x1b6a6f,null))['then'](function(_0x5e108e){if(_0x5e108e){_0x1a47f8[_0x1ea3('0x4e')][_0x1ea3('0x5a')]=_0x5e108e['id'];return db[_0x1ea3('0x5b')][_0x1ea3('0x56')](_0x1a47f8[_0x1ea3('0x4e')]);}})[_0x1ea3('0x29')](respondWithResult(_0x1b6a6f,null))[_0x1ea3('0x49')](handleError(_0x1b6a6f,null));};exports[_0x1ea3('0x5c')]=function(_0x1b9cc4,_0x3d4811,_0x3e7811){var _0x1b42ae={'raw':![],'where':{}};var _0x2e053f={};var _0x4a5b74={'count':0x0,'rows':[]};return db[_0x1ea3('0x32')][_0x1ea3('0x5d')]({'where':{'id':_0x1b9cc4[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x3d4811,null))['then'](function(_0x57eeea){if(_0x57eeea){_0x2e053f['model']=_[_0x1ea3('0x37')](db[_0x1ea3('0x5b')][_0x1ea3('0x33')]);_0x2e053f[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x1b9cc4[_0x1ea3('0x38')]);_0x2e053f[_0x1ea3('0x41')]=_['intersection'](_0x2e053f[_0x1ea3('0x36')],_0x2e053f['query']);_0x1b42ae[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x2e053f[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x3b')]));_0x1b42ae['attributes']=_0x1b42ae[_0x1ea3('0x39')]['length']?_0x1b42ae[_0x1ea3('0x39')]:_0x2e053f[_0x1ea3('0x36')];if(!_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x5e')](_0x1ea3('0x3c'))){_0x1b42ae['limit']=qs[_0x1ea3('0x3d')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x3d')]);_0x1b42ae[_0x1ea3('0x22')]=qs[_0x1ea3('0x22')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x22')]);}_0x1b42ae[_0x1ea3('0x5f')]=qs[_0x1ea3('0x3e')](_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x3e')]);_0x1b42ae['where']=qs[_0x1ea3('0x41')](_['pick'](_0x1b9cc4[_0x1ea3('0x38')],_0x2e053f[_0x1ea3('0x41')]));_0x1b42ae[_0x1ea3('0x3f')][_0x1ea3('0x5a')]=_0x57eeea['id'];if(_0x1b9cc4['query'][_0x1ea3('0x42')]){_0x1b42ae[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x1b42ae['where'],{'$or':_['map'](_0x1b42ae[_0x1ea3('0x39')],function(_0x1493c6){var _0x405a8b={};_0x405a8b[_0x1493c6]={'$like':'%'+_0x1b9cc4[_0x1ea3('0x38')][_0x1ea3('0x42')]+'%'};return _0x405a8b;})});}_0x1b42ae=_[_0x1ea3('0x44')]({},_0x1b42ae,_0x1b9cc4[_0x1ea3('0x45')]);return db[_0x1ea3('0x5b')]['count']({'where':_0x1b42ae[_0x1ea3('0x3f')]})[_0x1ea3('0x29')](function(_0x1090d9){_0x4a5b74[_0x1ea3('0x21')]=_0x1090d9;if(_0x1b9cc4[_0x1ea3('0x38')]['includeAll']){_0x1b42ae[_0x1ea3('0x4c')]=[{'all':!![]}];}return db[_0x1ea3('0x5b')]['findAll'](_0x1b42ae);})[_0x1ea3('0x29')](function(_0x4e8443){_0x4a5b74[_0x1ea3('0x48')]=_0x4e8443;return _0x4a5b74;});}})[_0x1ea3('0x29')](respondWithFilteredResult(_0x3d4811,_0x1b42ae))[_0x1ea3('0x49')](handleError(_0x3d4811,null));};exports['removeDispositions']=function(_0x2e2d84,_0x2990bc,_0x34e720){return db['CmList'][_0x1ea3('0x4d')]({'where':{'id':_0x2e2d84[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x2990bc,null))[_0x1ea3('0x29')](function(_0x45a2dc){if(_0x45a2dc){return _0x45a2dc[_0x1ea3('0x60')](_0x2e2d84[_0x1ea3('0x38')][_0x1ea3('0x61')]);}})[_0x1ea3('0x29')](respondWithStatusCode(_0x2990bc,null))[_0x1ea3('0x49')](handleError(_0x2990bc,null));};exports['addContacts']=function(_0x289b44,_0x382846,_0x55303d){return db[_0x1ea3('0x32')][_0x1ea3('0x4d')]({'where':{'id':_0x289b44[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x382846,null))[_0x1ea3('0x29')](function(_0x439589){if(_0x439589){var _0x5455b9=[];var _0x50f512={'success':[],'errors':[]};return db[_0x1ea3('0x62')][_0x1ea3('0x58')]()[_0x1ea3('0x29')](function(_0x203aa3){if(_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')]&&_[_0x1ea3('0x64')](_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')])){if(_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')][_0x1ea3('0x65')]){_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x63')]=_0x289b44[_0x1ea3('0x4e')]['tags'][_0x1ea3('0x66')](';')+';';}else{_0x289b44['body'][_0x1ea3('0x63')]=null;}}else{_0x289b44['body'][_0x1ea3('0x63')]=null;}if(_0x289b44[_0x1ea3('0x4e')]&&_[_0x1ea3('0x64')](_0x289b44[_0x1ea3('0x4e')])){for(var _0x4854c2=0x0;_0x4854c2<_0x289b44[_0x1ea3('0x4e')][_0x1ea3('0x65')];_0x4854c2+=0x1){_0x289b44[_0x1ea3('0x4e')][_0x4854c2][_0x1ea3('0x5a')]=_0x289b44[_0x1ea3('0x4b')]['id'];_0x5455b9['push'](_0x289b44[_0x1ea3('0x4e')][_0x4854c2]);}return BPromise[_0x1ea3('0x67')](_0x5455b9,function(_0x57baaf){return db[_0x1ea3('0x62')][_0x1ea3('0x56')](_[_0x1ea3('0x68')](_0x57baaf,[_0x1ea3('0x61'),'id'])||{},{'fields':_[_0x1ea3('0x37')](_0x203aa3),'raw':!![]})['then'](function(_0x3d0f02){_0x50f512['success'][_0x1ea3('0x69')](_0x3d0f02[_0x1ea3('0x6a')]);})['catch'](function(_0x142c01){_0x50f512['errors'][_0x1ea3('0x69')]({'data':_0x57baaf,'error':_0x142c01[_0x1ea3('0x6b')]});});})['then'](function(_0x311f5d){return _0x50f512;})['catch'](function(_0xeafec6){return _0xeafec6;});}else{_0x382846[_0x1ea3('0x1e')](0x190)[_0x1ea3('0x20')]({'message':_0x1ea3('0x6c')});}});}})[_0x1ea3('0x29')](respondWithResult(_0x382846,null))[_0x1ea3('0x49')](handleError(_0x382846,null));};exports[_0x1ea3('0x6d')]=function(_0x16f934,_0x9d028d,_0x149a17){var _0x43119b;return db[_0x1ea3('0x32')]['find']({'where':{'id':_0x16f934['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x1ea3('0x6e')}]})['then'](handleEntityNotFound(_0x9d028d,null))['then'](function(_0x53d892){if(_0x53d892){_0x43119b=_0x53d892;return db[_0x1ea3('0x62')][_0x1ea3('0x33')];}})[_0x1ea3('0x29')](function(_0x26145e){if(_0x26145e){var _0x1fd293={};var _0x38c6ca={};_0x38c6ca[_0x1ea3('0x36')]=_[_0x1ea3('0x6f')](_[_0x1ea3('0x37')](_0x26145e),_[_0x1ea3('0x31')](_0x43119b['CustomFields'],function(_0x2e736d){return util['format'](_0x1ea3('0x70'),_0x2e736d['id']);}));_0x38c6ca[_0x1ea3('0x38')]=_['keys'](_0x16f934[_0x1ea3('0x38')]);_0x38c6ca[_0x1ea3('0x41')]=_[_0x1ea3('0x3a')](_0x38c6ca[_0x1ea3('0x36')],_0x38c6ca[_0x1ea3('0x38')]);_0x1fd293[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x38c6ca[_0x1ea3('0x36')],qs['fields'](_0x16f934['query'][_0x1ea3('0x3b')]));_0x1fd293[_0x1ea3('0x39')]=_0x1fd293['attributes'][_0x1ea3('0x65')]?_0x1fd293['attributes']:_0x38c6ca['model'];if(!_0x16f934[_0x1ea3('0x38')][_0x1ea3('0x5e')]('nolimit')){_0x1fd293[_0x1ea3('0x3d')]=qs['limit'](_0x16f934[_0x1ea3('0x38')]['limit']);_0x1fd293['offset']=qs[_0x1ea3('0x22')](_0x16f934[_0x1ea3('0x38')]['offset']);}_0x1fd293[_0x1ea3('0x5f')]=qs[_0x1ea3('0x3e')](_0x16f934[_0x1ea3('0x38')][_0x1ea3('0x3e')]);_0x1fd293[_0x1ea3('0x3f')]=qs[_0x1ea3('0x41')](_['pick'](_0x16f934['query'],_0x38c6ca['filters']));_0x1fd293[_0x1ea3('0x71')]=!![];if(_0x16f934[_0x1ea3('0x38')][_0x1ea3('0x42')]){_0x1fd293[_0x1ea3('0x3f')]=_['merge'](_0x1fd293[_0x1ea3('0x3f')],{'$or':_['map'](_0x1fd293['attributes'],function(_0x173327){var _0x3ebdfb={};_0x3ebdfb[_0x173327]={'$like':'%'+_0x16f934['query'][_0x1ea3('0x42')]+'%'};return _0x3ebdfb;})});}_0x1fd293=_[_0x1ea3('0x44')]({},_0x1fd293,_0x16f934[_0x1ea3('0x45')]);return _0x43119b[_0x1ea3('0x6d')](_0x1fd293);}})[_0x1ea3('0x29')](respondWithResult(_0x9d028d,null))[_0x1ea3('0x49')](handleError(_0x9d028d,null));};exports[_0x1ea3('0x72')]=function(_0x4ba07e,_0x5c4367,_0xf63ba1){var _0x1dcaeb;return db[_0x1ea3('0x32')]['find']({'where':{'id':_0x4ba07e[_0x1ea3('0x4b')]['id']},'include':[{'model':db[_0x1ea3('0x73')],'as':_0x1ea3('0x6e')}]})[_0x1ea3('0x29')](handleEntityNotFound(_0x5c4367,null))['then'](function(_0x139b7a){if(_0x139b7a){_0x1dcaeb=_0x139b7a;return db['CmContact'][_0x1ea3('0x33')];}})[_0x1ea3('0x29')](function(_0x47e1ca){if(_0x47e1ca){var _0x4c93a8={};var _0x3e78c3={};_0x3e78c3[_0x1ea3('0x36')]=_['concat'](_[_0x1ea3('0x37')](_0x47e1ca),_['map'](_0x1dcaeb[_0x1ea3('0x6e')],function(_0x46605a){return util['format'](_0x1ea3('0x70'),_0x46605a['id']);}));_0x3e78c3[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x4ba07e['query']);_0x3e78c3[_0x1ea3('0x41')]=_[_0x1ea3('0x3a')](_0x3e78c3['model'],_0x3e78c3[_0x1ea3('0x38')]);_0x4c93a8[_0x1ea3('0x39')]=_['intersection'](_0x3e78c3[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x4ba07e['query'][_0x1ea3('0x3b')]));_0x4c93a8[_0x1ea3('0x39')]=_0x4c93a8[_0x1ea3('0x39')]['length']?_0x4c93a8['attributes']:_0x3e78c3[_0x1ea3('0x36')];if(!_0x4ba07e[_0x1ea3('0x38')]['hasOwnProperty'](_0x1ea3('0x3c'))){_0x4c93a8['limit']=qs[_0x1ea3('0x3d')](_0x4ba07e['query'][_0x1ea3('0x3d')]);_0x4c93a8[_0x1ea3('0x22')]=qs[_0x1ea3('0x22')](_0x4ba07e['query'][_0x1ea3('0x22')]);}_0x4c93a8[_0x1ea3('0x5f')]=qs['sort'](_0x4ba07e[_0x1ea3('0x38')]['sort']);_0x4c93a8['where']=qs[_0x1ea3('0x41')](_[_0x1ea3('0x40')](_0x4ba07e[_0x1ea3('0x38')],_0x3e78c3['filters']));_0x4c93a8[_0x1ea3('0x71')]=!![];if(_0x4ba07e[_0x1ea3('0x38')][_0x1ea3('0x42')]){_0x4c93a8[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x4c93a8['where'],{'$or':_[_0x1ea3('0x31')](_0x4c93a8[_0x1ea3('0x39')],function(_0x3c463b){var _0x3c155b={};_0x3c155b[_0x3c463b]={'$like':'%'+_0x4ba07e[_0x1ea3('0x38')][_0x1ea3('0x42')]+'%'};return _0x3c155b;})});}_0x4c93a8=_['merge']({},_0x4c93a8,_0x4ba07e[_0x1ea3('0x45')]);return _0x1dcaeb[_0x1ea3('0x6d')](_0x4c93a8);}})['then'](function(_0x5188f5){if(!_[_0x1ea3('0x74')](_0x5188f5)){var _0x31f1f4=toCsv(_0x5188f5);var _0xc1178=Date[_0x1ea3('0x75')]();fs['writeFileSync'](util[_0x1ea3('0x76')](_0x1ea3('0x77'),_0x1dcaeb['id'],_0xc1178),_0x31f1f4);_0x5c4367[_0x1ea3('0x78')](_0x1ea3('0x79'),_0x1ea3('0x7a')+util[_0x1ea3('0x76')]('list_%d_%s.csv',_0x1dcaeb['id'],_0xc1178));_0x5c4367[_0x1ea3('0x78')](_0x1ea3('0x7b'),_0x1ea3('0x7c'));return _0x5c4367[_0x1ea3('0x7d')](util[_0x1ea3('0x76')](_0x1ea3('0x77'),_0x1dcaeb['id'],_0xc1178));}else{return _0x5c4367[_0x1ea3('0x7e')](0xcc);}})[_0x1ea3('0x49')](handleError(_0x5c4367,null));};exports[_0x1ea3('0x7f')]=function(_0x240374,_0x117c19,_0x354352){var _0x23b1ea;delete _0x240374['body']['id'];return db[_0x1ea3('0x32')][_0x1ea3('0x5d')]({'where':{'id':_0x240374['params']['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x117c19,null))[_0x1ea3('0x29')](function(_0x4010ee){if(_0x4010ee){return db[_0x1ea3('0x80')][_0x1ea3('0x81')](function(_0x200c8a){return db[_0x1ea3('0x73')][_0x1ea3('0x56')](_0x240374['body'],{'transaction':_0x200c8a})[_0x1ea3('0x29')](function(_0x52a626){_0x23b1ea=_0x52a626;return _0x4010ee[_0x1ea3('0x82')](_0x52a626,{'transaction':_0x200c8a});})[_0x1ea3('0x29')](function(){var _0x16324b={'type':db[_0x1ea3('0x83')][_0x1ea3('0x84')],'transaction':_0x200c8a};switch(_0x240374[_0x1ea3('0x4e')][_0x1ea3('0x34')]){case _0x1ea3('0x85'):_0x16324b[_0x1ea3('0x34')]=db[_0x1ea3('0x83')][_0x1ea3('0x84')];break;case _0x1ea3('0x86'):_0x16324b[_0x1ea3('0x34')]=db[_0x1ea3('0x83')][_0x1ea3('0x87')];break;case'switch':_0x16324b[_0x1ea3('0x34')]=db[_0x1ea3('0x83')]['BOOLEAN'];_0x16324b[_0x1ea3('0x88')]=![];break;default:}return db[_0x1ea3('0x80')]['queryInterface'][_0x1ea3('0x89')](_0x1ea3('0x8a'),util['format'](_0x1ea3('0x8b'),_0x23b1ea['id']),_0x16324b);})['then'](function(){return _0x23b1ea;});});}})[_0x1ea3('0x29')](respondWithResult(_0x117c19,null))['catch'](handleError(_0x117c19,null));};exports[_0x1ea3('0x8c')]=function(_0x5905eb,_0x1f5eb9,_0x1a4c9a){var _0x4cf8fa={};var _0xbc082={};var _0x1cea1c;var _0x1eaee0;return db[_0x1ea3('0x32')][_0x1ea3('0x5d')]({'where':{'id':_0x5905eb[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x1f5eb9,null))[_0x1ea3('0x29')](function(_0xa67dc8){if(_0xa67dc8){_0x1cea1c=_0xa67dc8;_0xbc082[_0x1ea3('0x36')]=_[_0x1ea3('0x37')](db[_0x1ea3('0x73')][_0x1ea3('0x33')]);_0xbc082[_0x1ea3('0x38')]=_['keys'](_0x5905eb[_0x1ea3('0x38')]);_0xbc082[_0x1ea3('0x41')]=_['intersection'](_0xbc082[_0x1ea3('0x36')],_0xbc082[_0x1ea3('0x38')]);_0x4cf8fa[_0x1ea3('0x39')]=_['intersection'](_0xbc082[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x5905eb['query'][_0x1ea3('0x3b')]));_0x4cf8fa[_0x1ea3('0x39')]=_0x4cf8fa[_0x1ea3('0x39')][_0x1ea3('0x65')]?_0x4cf8fa[_0x1ea3('0x39')]:_0xbc082['model'];_0x4cf8fa[_0x1ea3('0x5f')]=qs[_0x1ea3('0x3e')](_0x5905eb[_0x1ea3('0x38')]['sort']);_0x4cf8fa[_0x1ea3('0x3f')]=qs[_0x1ea3('0x41')](_[_0x1ea3('0x40')](_0x5905eb['query'],_0xbc082[_0x1ea3('0x41')]));_0x4cf8fa[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x4cf8fa[_0x1ea3('0x3f')],{'$or':[{'ListId':_0xa67dc8['id']},{'ListId':null}]});if(_0x5905eb[_0x1ea3('0x38')]['filter']){_0x4cf8fa['where']=_[_0x1ea3('0x44')](_0x4cf8fa['where'],{'$or':_[_0x1ea3('0x31')](_0x4cf8fa[_0x1ea3('0x39')],function(_0x2a8623){var _0x3f8210={};_0x3f8210[_0x2a8623]={'$like':'%'+_0x5905eb[_0x1ea3('0x38')][_0x1ea3('0x42')]+'%'};return _0x3f8210;})});}_0x4cf8fa=_[_0x1ea3('0x44')]({},_0x4cf8fa,_0x5905eb[_0x1ea3('0x45')]);return db[_0x1ea3('0x73')]['findAndCountAll'](_0x4cf8fa);}})[_0x1ea3('0x29')](respondWithResult(_0x1f5eb9,null))[_0x1ea3('0x49')](handleError(_0x1f5eb9,null));};exports[_0x1ea3('0x8d')]=function(_0x2f975f,_0x2afb6b,_0x519588){return db[_0x1ea3('0x32')][_0x1ea3('0x4d')]({'where':{'id':_0x2f975f[_0x1ea3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2afb6b,null))[_0x1ea3('0x29')](function(_0x2234e3){if(_0x2234e3){return _0x2234e3[_0x1ea3('0x8d')](_0x2f975f[_0x1ea3('0x4e')]['ids'],_['omit'](_0x2f975f[_0x1ea3('0x4e')],[_0x1ea3('0x61'),'id'])||{})[_0x1ea3('0x8e')](function(_0x17f8cc){for(var _0x3460db=0x0;_0x3460db<_0x2f975f[_0x1ea3('0x4e')][_0x1ea3('0x61')][_0x1ea3('0x65')];_0x3460db+=0x1){socket['emit'](_0x1ea3('0x8f'),{'UserId':_0x2f975f[_0x1ea3('0x4e')][_0x1ea3('0x61')][_0x3460db],'CmListId':_0x2f975f[_0x1ea3('0x4b')]['id']});}return _0x17f8cc;});}})[_0x1ea3('0x29')](respondWithResult(_0x2afb6b,null))[_0x1ea3('0x49')](handleError(_0x2afb6b,null));};exports[_0x1ea3('0x90')]=function(_0x31a733,_0x5f2044,_0x1728ed){return db['CmList'][_0x1ea3('0x4d')]({'where':{'id':_0x31a733[_0x1ea3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5f2044,null))[_0x1ea3('0x29')](function(_0x37e3bf){if(_0x37e3bf){return _0x37e3bf[_0x1ea3('0x90')](_0x31a733[_0x1ea3('0x38')][_0x1ea3('0x61')])['then'](function(){if(_[_0x1ea3('0x64')](_0x31a733['query'][_0x1ea3('0x61')])){for(var _0xea05b8=0x0;_0xea05b8<_0x31a733['query'][_0x1ea3('0x61')][_0x1ea3('0x65')];_0xea05b8+=0x1){socket[_0x1ea3('0x91')](_0x1ea3('0x92'),{'UserId':Number(_0x31a733[_0x1ea3('0x38')][_0x1ea3('0x61')][_0xea05b8]),'CmListId':Number(_0x31a733[_0x1ea3('0x4b')]['id'])});}}else{socket[_0x1ea3('0x91')](_0x1ea3('0x92'),{'UserId':Number(_0x31a733[_0x1ea3('0x38')][_0x1ea3('0x61')]),'CmListId':Number(_0x31a733['params']['id'])});}});}})[_0x1ea3('0x29')](respondWithStatusCode(_0x5f2044,null))['catch'](handleError(_0x5f2044,null));};exports[_0x1ea3('0x93')]=function(_0x4388dd,_0x58de04,_0x5e2b47){var _0x411950={};var _0x1f0b53={};var _0x1dcea7;var _0x50cf09;return db['CmList'][_0x1ea3('0x5d')]({'where':{'id':_0x4388dd[_0x1ea3('0x4b')]['id']}})[_0x1ea3('0x29')](handleEntityNotFound(_0x58de04,null))['then'](function(_0x27bee3){if(_0x27bee3){_0x1dcea7=_0x27bee3;_0x1f0b53[_0x1ea3('0x36')]=_[_0x1ea3('0x37')](db[_0x1ea3('0x94')][_0x1ea3('0x33')]);_0x1f0b53[_0x1ea3('0x38')]=_[_0x1ea3('0x37')](_0x4388dd[_0x1ea3('0x38')]);_0x1f0b53[_0x1ea3('0x41')]=_['intersection'](_0x1f0b53[_0x1ea3('0x36')],_0x1f0b53['query']);_0x411950[_0x1ea3('0x39')]=_[_0x1ea3('0x3a')](_0x1f0b53[_0x1ea3('0x36')],qs[_0x1ea3('0x3b')](_0x4388dd[_0x1ea3('0x38')]['fields']));_0x411950[_0x1ea3('0x39')]=_0x411950['attributes'][_0x1ea3('0x65')]?_0x411950[_0x1ea3('0x39')]:_0x1f0b53[_0x1ea3('0x36')];_0x411950['order']=qs[_0x1ea3('0x3e')](_0x4388dd[_0x1ea3('0x38')]['sort']);_0x411950[_0x1ea3('0x3f')]=qs[_0x1ea3('0x41')](_[_0x1ea3('0x40')](_0x4388dd[_0x1ea3('0x38')],_0x1f0b53[_0x1ea3('0x41')]));if(_0x4388dd['query']['filter']){_0x411950[_0x1ea3('0x3f')]=_[_0x1ea3('0x44')](_0x411950['where'],{'$or':_['map'](_0x411950[_0x1ea3('0x39')],function(_0x2d8154){var _0xac4eef={};_0xac4eef[_0x2d8154]={'$like':'%'+_0x4388dd[_0x1ea3('0x38')]['filter']+'%'};return _0xac4eef;})});}_0x411950=_[_0x1ea3('0x44')]({},_0x411950,_0x4388dd[_0x1ea3('0x45')]);return _0x1dcea7[_0x1ea3('0x93')](_0x411950);}})['then'](function(_0x13824d){if(_0x13824d){_0x50cf09=_0x13824d['length'];if(!_0x4388dd[_0x1ea3('0x38')][_0x1ea3('0x5e')](_0x1ea3('0x3c'))){_0x411950[_0x1ea3('0x3d')]=qs[_0x1ea3('0x3d')](_0x4388dd['query']['limit']);_0x411950['offset']=qs[_0x1ea3('0x22')](_0x4388dd['query']['offset']);}return _0x1dcea7['getAgents'](_0x411950);}})[_0x1ea3('0x29')](function(_0x3849df){if(_0x3849df){return _0x3849df?{'count':_0x50cf09,'rows':_0x3849df}:null;}})['then'](respondWithResult(_0x58de04,null))[_0x1ea3('0x49')](handleError(_0x58de04,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c493ebd..a4fb711 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 _0x8716=['../../mysqldb','CmList','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x354b05,_0x4069f6){var _0x25f30c=function(_0x47d2ef){while(--_0x47d2ef){_0x354b05['push'](_0x354b05['shift']());}};_0x25f30c(++_0x4069f6);}(_0x8716,0x68));var _0x6871=function(_0x562762,_0x26862a){_0x562762=_0x562762-0x0;var _0x141a0e=_0x8716[_0x562762];return _0x141a0e;};'use strict';var EventEmitter=require('events');var CmList=require(_0x6871('0x0'))['db'][_0x6871('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x6871('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6871('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2226c1){return function(_0x1f00ee,_0x416e94,_0x2b4e84){CmListEvents[_0x6871('0x4')](_0x2226c1+':'+_0x1f00ee['id'],_0x1f00ee);CmListEvents['emit'](_0x2226c1,_0x1f00ee);_0x2b4e84(null);};}for(var e in events){if(events[_0x6871('0x5')](e)){var event=events[e];CmList[_0x6871('0x6')](e,emitEvent(event));}}module[_0x6871('0x7')]=CmListEvents; \ No newline at end of file +var _0x3d8f=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2df0bf,_0x13990c){var _0x5c46a3=function(_0x5716ea){while(--_0x5716ea){_0x2df0bf['push'](_0x2df0bf['shift']());}};_0x5c46a3(++_0x13990c);}(_0x3d8f,0x168));var _0xf3d8=function(_0x270b95,_0x5df63b){_0x270b95=_0x270b95-0x0;var _0x2fc44f=_0x3d8f[_0x270b95];return _0x2fc44f;};'use strict';var EventEmitter=require(_0xf3d8('0x0'));var CmList=require(_0xf3d8('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf3d8('0x2'),'afterUpdate':_0xf3d8('0x3'),'afterDestroy':_0xf3d8('0x4')};function emitEvent(_0x2fc617){return function(_0x46a60d,_0xd20f3d,_0x3308d3){CmListEvents[_0xf3d8('0x5')](_0x2fc617+':'+_0x46a60d['id'],_0x46a60d);CmListEvents[_0xf3d8('0x5')](_0x2fc617,_0x46a60d);_0x3308d3(null);};}for(var e in events){if(events[_0xf3d8('0x6')](e)){var event=events[e];CmList[_0xf3d8('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a14adf5..3adc395 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 _0x9d31=['exports','define','CmList','cm_lists','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./cmList.attributes'];(function(_0x53aaf8,_0x863bcb){var _0x1fedb1=function(_0x5696f4){while(--_0x5696f4){_0x53aaf8['push'](_0x53aaf8['shift']());}};_0x1fedb1(++_0x863bcb);}(_0x9d31,0x162));var _0x19d3=function(_0x16eb21,_0x40e4bf){_0x16eb21=_0x16eb21-0x0;var _0x49b96c=_0x9d31[_0x16eb21];return _0x49b96c;};'use strict';var _=require(_0x19d3('0x0'));var util=require('util');var logger=require(_0x19d3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x19d3('0x2'));var rp=require(_0x19d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19d3('0x4'));var attributes=require(_0x19d3('0x5'));module[_0x19d3('0x6')]=function(_0x3d5951,_0x89d7f1){return _0x3d5951[_0x19d3('0x7')](_0x19d3('0x8'),attributes,{'tableName':_0x19d3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x679d=['exports','define','CmList','cm_lists','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x13f33c,_0x1abe88){var _0x14ce90=function(_0x3471ce){while(--_0x3471ce){_0x13f33c['push'](_0x13f33c['shift']());}};_0x14ce90(++_0x1abe88);}(_0x679d,0x126));var _0xd679=function(_0x54c3e9,_0x29c5d8){_0x54c3e9=_0x54c3e9-0x0;var _0x3e987d=_0x679d[_0x54c3e9];return _0x3e987d;};'use strict';var _=require('lodash');var util=require(_0xd679('0x0'));var logger=require(_0xd679('0x1'))('api');var moment=require(_0xd679('0x2'));var BPromise=require(_0xd679('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd679('0x4'));var config=require(_0xd679('0x5'));var attributes=require('./cmList.attributes');module[_0xd679('0x6')]=function(_0x1dce01,_0x8debbb){return _0x1dce01[_0xd679('0x7')](_0xd679('0x8'),attributes,{'tableName':_0xd679('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 759be09..7ab420a 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 _0x8bce=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1636f1,_0x4f71e0){var _0xb99439=function(_0x41a40b){while(--_0x41a40b){_0x1636f1['push'](_0x1636f1['shift']());}};_0xb99439(++_0x4f71e0);}(_0x8bce,0xa3));var _0xe8bc=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x8bce[_0x1e9424];return _0x1bd96c;};'use strict';var _=require(_0xe8bc('0x0'));var util=require(_0xe8bc('0x1'));var moment=require(_0xe8bc('0x2'));var BPromise=require(_0xe8bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8bc('0x4'));var db=require(_0xe8bc('0x5'))['db'];var utils=require(_0xe8bc('0x6'));var logger=require('../../config/logger')(_0xe8bc('0x7'));var config=require(_0xe8bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8bc('0x9')][_0xe8bc('0xa')]({'port':0x232a});config[_0xe8bc('0xb')]=_[_0xe8bc('0xc')](config[_0xe8bc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8bc('0xd'))(new Redis(config[_0xe8bc('0xb')]));require(_0xe8bc('0xe'))[_0xe8bc('0xf')](socket);function respondWithRpcPromise(_0x333c1b,_0x42c4cf,_0x45022a){return new BPromise(function(_0x36c4bf,_0x40942f){return client[_0xe8bc('0x10')](_0x333c1b,_0x45022a)[_0xe8bc('0x11')](function(_0x1de5f4){logger['info'](_0xe8bc('0x12'),_0x42c4cf,_0xe8bc('0x13'));logger[_0xe8bc('0x14')](_0xe8bc('0x15'),_0x42c4cf,_0xe8bc('0x13'),JSON['stringify'](_0x1de5f4));if(_0x1de5f4[_0xe8bc('0x16')]){if(_0x1de5f4['error'][_0xe8bc('0x17')]===0x1f4){logger[_0xe8bc('0x16')]('CmList,\x20%s,\x20%s',_0x42c4cf,_0x1de5f4[_0xe8bc('0x16')][_0xe8bc('0x18')]);return _0x40942f(_0x1de5f4['error'][_0xe8bc('0x18')]);}logger['error']('CmList,\x20%s,\x20%s',_0x42c4cf,_0x1de5f4[_0xe8bc('0x16')][_0xe8bc('0x18')]);return _0x36c4bf(_0x1de5f4['error'][_0xe8bc('0x18')]);}else{logger[_0xe8bc('0x19')]('CmList,\x20%s,\x20%s',_0x42c4cf,_0xe8bc('0x13'));_0x36c4bf(_0x1de5f4[_0xe8bc('0x1a')][_0xe8bc('0x18')]);}})['catch'](function(_0x36a9e1){logger[_0xe8bc('0x16')](_0xe8bc('0x12'),_0x42c4cf,_0x36a9e1);_0x40942f(_0x36a9e1);});});} \ No newline at end of file +var _0x5a0b=['client','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x4c264c,_0x2e1a49){var _0x1fe579=function(_0xbaf12){while(--_0xbaf12){_0x4c264c['push'](_0x4c264c['shift']());}};_0x1fe579(++_0x2e1a49);}(_0x5a0b,0x178));var _0xb5a0=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x5a0b[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0xb5a0('0x0'));var util=require('util');var moment=require(_0xb5a0('0x1'));var BPromise=require(_0xb5a0('0x2'));var rs=require(_0xb5a0('0x3'));var fs=require('fs');var Redis=require(_0xb5a0('0x4'));var db=require(_0xb5a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb5a0('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5a0('0x7'));var client=jayson[_0xb5a0('0x8')]['http']({'port':0x232a});config['redis']=_[_0xb5a0('0x9')](config[_0xb5a0('0xa')],{'host':_0xb5a0('0xb'),'port':0x18eb});var socket=require(_0xb5a0('0xc'))(new Redis(config[_0xb5a0('0xa')]));require(_0xb5a0('0xd'))[_0xb5a0('0xe')](socket);function respondWithRpcPromise(_0x352db6,_0xdb3406,_0x201e34){return new BPromise(function(_0x3fb1d4,_0xab921d){return client[_0xb5a0('0xf')](_0x352db6,_0x201e34)['then'](function(_0x4f704a){logger[_0xb5a0('0x10')](_0xb5a0('0x11'),_0xdb3406,_0xb5a0('0x12'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0xdb3406,'request\x20sent',JSON['stringify'](_0x4f704a));if(_0x4f704a['error']){if(_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x14')]===0x1f4){logger[_0xb5a0('0x13')]('CmList,\x20%s,\x20%s',_0xdb3406,_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x15')]);return _0xab921d(_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x15')]);}logger['error'](_0xb5a0('0x11'),_0xdb3406,_0x4f704a['error'][_0xb5a0('0x15')]);return _0x3fb1d4(_0x4f704a[_0xb5a0('0x13')][_0xb5a0('0x15')]);}else{logger[_0xb5a0('0x10')](_0xb5a0('0x11'),_0xdb3406,_0xb5a0('0x12'));_0x3fb1d4(_0x4f704a[_0xb5a0('0x16')][_0xb5a0('0x15')]);}})[_0xb5a0('0x17')](function(_0x79e3f5){logger[_0xb5a0('0x13')](_0xb5a0('0x11'),_0xdb3406,_0x79e3f5);_0xab921d(_0x79e3f5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 9592dca..c64d8f1 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 _0x49c4=['cmList:','./cmList.events','remove','update','emit','register','length'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x49c4,0x9b));var _0x449c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x49c4[_0x4b055c];return _0x4b62bb;};'use strict';var CmListEvents=require(_0x449c('0x0'));var events=['save',_0x449c('0x1'),_0x449c('0x2')];function createListener(_0x17bf65,_0x1d60ee){return function(_0x2646ac){_0x1d60ee[_0x449c('0x3')](_0x17bf65,_0x2646ac);};}function removeListener(_0x23314e,_0x5b564c){return function(){CmListEvents['removeListener'](_0x23314e,_0x5b564c);};}exports[_0x449c('0x4')]=function(_0x442e56){for(var _0x12586c=0x0,_0x2db09a=events[_0x449c('0x5')];_0x12586c<_0x2db09a;_0x12586c++){var _0x43cb0e=events[_0x12586c];var _0x3e6354=createListener(_0x449c('0x6')+_0x43cb0e,_0x442e56);CmListEvents['on'](_0x43cb0e,_0x3e6354);}}; \ No newline at end of file +var _0x0960=['update','emit','removeListener','register','cmList:','./cmList.events','save'];(function(_0x6ace36,_0x2baad7){var _0x170e54=function(_0x5ba594){while(--_0x5ba594){_0x6ace36['push'](_0x6ace36['shift']());}};_0x170e54(++_0x2baad7);}(_0x0960,0xc2));var _0x0096=function(_0x2914c4,_0x3ff3e3){_0x2914c4=_0x2914c4-0x0;var _0x72ed2e=_0x0960[_0x2914c4];return _0x72ed2e;};'use strict';var CmListEvents=require(_0x0096('0x0'));var events=[_0x0096('0x1'),'remove',_0x0096('0x2')];function createListener(_0x1078f3,_0x41a86e){return function(_0x136f7a){_0x41a86e[_0x0096('0x3')](_0x1078f3,_0x136f7a);};}function removeListener(_0xd0d4c6,_0x3ee9fb){return function(){CmListEvents[_0x0096('0x4')](_0xd0d4c6,_0x3ee9fb);};}exports[_0x0096('0x5')]=function(_0x6ea572){for(var _0x59b3cc=0x0,_0x81cc41=events['length'];_0x59b3cc<_0x81cc41;_0x59b3cc++){var _0x1d35f1=events[_0x59b3cc];var _0x44e168=createListener(_0x0096('0x6')+_0x1d35f1,_0x6ea572);CmListEvents['on'](_0x1d35f1,_0x44e168);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 2c2a5d0..a7bf8bc 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 711e95c..cd0e34b 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(_0x37296b,_0x2e9820){var _0x561567=function(_0x18d20a){while(--_0x18d20a){_0x37296b['push'](_0x37296b['shift']());}};_0x561567(++_0x2e9820);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x5ea4cb,_0x44bce8){var _0xea2224=function(_0x1f1e99){while(--_0x1f1e99){_0x5ea4cb['push'](_0x5ea4cb['shift']());}};_0xea2224(++_0x44bce8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 2d10fb2..956291f 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 _0xe4f5=['update','then','end','sendStatus','stack','name','send','body','Condition','find','catch','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','save'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0xe4f5,0x101));var _0x5e4f=function(_0x4ab202,_0x41d3a5){_0x4ab202=_0x4ab202-0x0;var _0x22dcf7=_0xe4f5[_0x4ab202];return _0x22dcf7;};'use strict';var pdf=require(_0x5e4f('0x0'));var emlformat=require(_0x5e4f('0x1'));var rimraf=require(_0x5e4f('0x2'));var zipdir=require(_0x5e4f('0x3'));var jsonpatch=require(_0x5e4f('0x4'));var rp=require(_0x5e4f('0x5'));var moment=require(_0x5e4f('0x6'));var BPromise=require(_0x5e4f('0x7'));var Mustache=require(_0x5e4f('0x8'));var util=require(_0x5e4f('0x9'));var path=require(_0x5e4f('0xa'));var sox=require('sox');var csv=require(_0x5e4f('0xb'));var ejs=require(_0x5e4f('0xc'));var fs=require('fs');var _=require(_0x5e4f('0xd'));var squel=require(_0x5e4f('0xe'));var crypto=require(_0x5e4f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5e4f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5e4f('0x11'));var Papa=require(_0x5e4f('0x12'));var Redis=require(_0x5e4f('0x13'));var authService=require(_0x5e4f('0x14'));var qs=require(_0x5e4f('0x15'));var as=require(_0x5e4f('0x16'));var hardwareService=require(_0x5e4f('0x17'));var logger=require(_0x5e4f('0x18'))(_0x5e4f('0x19'));var utils=require(_0x5e4f('0x1a'));var config=require(_0x5e4f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e4f('0x1c'))['db'];function respondWithStatusCode(_0x5efed3,_0x1e99e6){_0x1e99e6=_0x1e99e6||0xcc;return function(_0x55fa5a){if(_0x55fa5a){return _0x5efed3['sendStatus'](_0x1e99e6);}return _0x5efed3[_0x5e4f('0x1d')](_0x1e99e6)['end']();};}function respondWithResult(_0x31f4cf,_0x48603a){_0x48603a=_0x48603a||0xc8;return function(_0x2c3d8a){if(_0x2c3d8a){return _0x31f4cf['status'](_0x48603a)[_0x5e4f('0x1e')](_0x2c3d8a);}};}function respondWithFilteredResult(_0x447539,_0x1b0340){return function(_0x122e2e){if(_0x122e2e){var _0x5ba386=_0x122e2e['count'],_0x3fbca4=_0x1b0340[_0x5e4f('0x1f')],_0x441639=_0x1b0340[_0x5e4f('0x1f')]+_0x1b0340[_0x5e4f('0x20')],_0x3421f0;if(_0x441639>=_0x5ba386){_0x441639=_0x5ba386;_0x3421f0=0xc8;}else{_0x3421f0=0xce;}_0x447539[_0x5e4f('0x1d')](_0x3421f0);return _0x447539[_0x5e4f('0x21')](_0x5e4f('0x22'),_0x3fbca4+'-'+_0x441639+'/'+_0x5ba386)[_0x5e4f('0x1e')](_0x122e2e);}return null;};}function patchUpdates(_0x146426){return function(_0x3c6328){try{jsonpatch['apply'](_0x3c6328,_0x146426,!![]);}catch(_0x38951a){return BPromise[_0x5e4f('0x23')](_0x38951a);}return _0x3c6328[_0x5e4f('0x24')]();};}function saveUpdates(_0x4456ca,_0x495983){return function(_0x4197ec){if(_0x4197ec){return _0x4197ec[_0x5e4f('0x25')](_0x4456ca)[_0x5e4f('0x26')](function(_0x55f98b){return _0x55f98b;});}return null;};}function removeEntity(_0x51054f,_0x3e6fff){return function(_0x2a2c53){if(_0x2a2c53){return _0x2a2c53['destroy']()[_0x5e4f('0x26')](function(){_0x51054f[_0x5e4f('0x1d')](0xcc)[_0x5e4f('0x27')]();});}};}function handleEntityNotFound(_0xcc58fc,_0x539e75){return function(_0x33ca1a){if(!_0x33ca1a){_0xcc58fc[_0x5e4f('0x28')](0x194);}return _0x33ca1a;};}function handleError(_0x3c82fe,_0x501a95){_0x501a95=_0x501a95||0x1f4;return function(_0x1ec64c){logger['error'](_0x1ec64c[_0x5e4f('0x29')]);if(_0x1ec64c[_0x5e4f('0x2a')]){delete _0x1ec64c[_0x5e4f('0x2a')];}_0x3c82fe[_0x5e4f('0x1d')](_0x501a95)[_0x5e4f('0x2b')](_0x1ec64c);};}exports[_0x5e4f('0x25')]=function(_0xb4cac3,_0x5751c9){if(_0xb4cac3[_0x5e4f('0x2c')]['id']){delete _0xb4cac3['body']['id'];}return db[_0x5e4f('0x2d')][_0x5e4f('0x2e')]({'where':{'id':_0xb4cac3['params']['id']}})['then'](handleEntityNotFound(_0x5751c9,null))[_0x5e4f('0x26')](saveUpdates(_0xb4cac3[_0x5e4f('0x2c')],null))[_0x5e4f('0x26')](respondWithResult(_0x5751c9,null))[_0x5e4f('0x2f')](handleError(_0x5751c9,null));};exports['destroy']=function(_0xb41298,_0x3ff77c){return db['Condition']['find']({'where':{'id':_0xb41298[_0x5e4f('0x30')]['id']}})[_0x5e4f('0x26')](handleEntityNotFound(_0x3ff77c,null))['then'](removeEntity(_0x3ff77c,null))[_0x5e4f('0x2f')](handleError(_0x3ff77c,null));}; \ No newline at end of file +var _0x1dfa=['sox','to-csv','ejs','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','body','Condition','params','catch','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x511cd1,_0x29148e){var _0x44a79a=function(_0x5dbe1d){while(--_0x5dbe1d){_0x511cd1['push'](_0x511cd1['shift']());}};_0x44a79a(++_0x29148e);}(_0x1dfa,0xba));var _0xa1df=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x1dfa[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0xa1df('0x0'));var emlformat=require(_0xa1df('0x1'));var rimraf=require(_0xa1df('0x2'));var zipdir=require(_0xa1df('0x3'));var jsonpatch=require(_0xa1df('0x4'));var rp=require(_0xa1df('0x5'));var moment=require(_0xa1df('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa1df('0x7'));var util=require(_0xa1df('0x8'));var path=require(_0xa1df('0x9'));var sox=require(_0xa1df('0xa'));var csv=require(_0xa1df('0xb'));var ejs=require(_0xa1df('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1df('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa1df('0xe'));var toCsv=require(_0xa1df('0xb'));var querystring=require('querystring');var Papa=require(_0xa1df('0xf'));var Redis=require('ioredis');var authService=require(_0xa1df('0x10'));var qs=require(_0xa1df('0x11'));var as=require(_0xa1df('0x12'));var hardwareService=require(_0xa1df('0x13'));var logger=require(_0xa1df('0x14'))(_0xa1df('0x15'));var utils=require(_0xa1df('0x16'));var config=require(_0xa1df('0x17'));var licenseUtil=require(_0xa1df('0x18'));var db=require(_0xa1df('0x19'))['db'];function respondWithStatusCode(_0x55a544,_0x1cfa33){_0x1cfa33=_0x1cfa33||0xcc;return function(_0x3b059d){if(_0x3b059d){return _0x55a544[_0xa1df('0x1a')](_0x1cfa33);}return _0x55a544['status'](_0x1cfa33)[_0xa1df('0x1b')]();};}function respondWithResult(_0x27fbe3,_0x22b666){_0x22b666=_0x22b666||0xc8;return function(_0x617f26){if(_0x617f26){return _0x27fbe3[_0xa1df('0x1c')](_0x22b666)[_0xa1df('0x1d')](_0x617f26);}};}function respondWithFilteredResult(_0xee8aab,_0x4901bc){return function(_0x5a9e64){if(_0x5a9e64){var _0x40836c=_0x5a9e64[_0xa1df('0x1e')],_0x217eac=_0x4901bc[_0xa1df('0x1f')],_0x598273=_0x4901bc[_0xa1df('0x1f')]+_0x4901bc['limit'],_0x744e15;if(_0x598273>=_0x40836c){_0x598273=_0x40836c;_0x744e15=0xc8;}else{_0x744e15=0xce;}_0xee8aab[_0xa1df('0x1c')](_0x744e15);return _0xee8aab[_0xa1df('0x20')](_0xa1df('0x21'),_0x217eac+'-'+_0x598273+'/'+_0x40836c)[_0xa1df('0x1d')](_0x5a9e64);}return null;};}function patchUpdates(_0xf26bb6){return function(_0x20a266){try{jsonpatch[_0xa1df('0x22')](_0x20a266,_0xf26bb6,!![]);}catch(_0x148104){return BPromise[_0xa1df('0x23')](_0x148104);}return _0x20a266[_0xa1df('0x24')]();};}function saveUpdates(_0x3377cb,_0x12ccec){return function(_0x4f6292){if(_0x4f6292){return _0x4f6292[_0xa1df('0x25')](_0x3377cb)['then'](function(_0x380ceb){return _0x380ceb;});}return null;};}function removeEntity(_0x29083d,_0xd8d435){return function(_0x3906b6){if(_0x3906b6){return _0x3906b6[_0xa1df('0x26')]()[_0xa1df('0x27')](function(){_0x29083d['status'](0xcc)[_0xa1df('0x1b')]();});}};}function handleEntityNotFound(_0x1f2049,_0x4a4c4b){return function(_0x3cd8bd){if(!_0x3cd8bd){_0x1f2049['sendStatus'](0x194);}return _0x3cd8bd;};}function handleError(_0x3f7594,_0x325727){_0x325727=_0x325727||0x1f4;return function(_0x57d407){logger[_0xa1df('0x28')](_0x57d407[_0xa1df('0x29')]);if(_0x57d407[_0xa1df('0x2a')]){delete _0x57d407[_0xa1df('0x2a')];}_0x3f7594['status'](_0x325727)[_0xa1df('0x2b')](_0x57d407);};}exports['update']=function(_0x42eddd,_0x5e730e){if(_0x42eddd[_0xa1df('0x2c')]['id']){delete _0x42eddd['body']['id'];}return db[_0xa1df('0x2d')]['find']({'where':{'id':_0x42eddd[_0xa1df('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5e730e,null))[_0xa1df('0x27')](saveUpdates(_0x42eddd[_0xa1df('0x2c')],null))[_0xa1df('0x27')](respondWithResult(_0x5e730e,null))[_0xa1df('0x2f')](handleError(_0x5e730e,null));};exports[_0xa1df('0x26')]=function(_0xd3e1cb,_0x4ecb01){return db[_0xa1df('0x2d')][_0xa1df('0x30')]({'where':{'id':_0xd3e1cb[_0xa1df('0x2e')]['id']}})[_0xa1df('0x27')](handleEntityNotFound(_0x4ecb01,null))['then'](removeEntity(_0x4ecb01,null))[_0xa1df('0x2f')](handleError(_0x4ecb01,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c2f683f..f535593 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 _0x7706=['define','Condition','tools_conditions','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x85f135,_0x355440){var _0x24b738=function(_0x2de45f){while(--_0x2de45f){_0x85f135['push'](_0x85f135['shift']());}};_0x24b738(++_0x355440);}(_0x7706,0x15f));var _0x6770=function(_0x3f31a4,_0x73154a){_0x3f31a4=_0x3f31a4-0x0;var _0x384263=_0x7706[_0x3f31a4];return _0x384263;};'use strict';var _=require(_0x6770('0x0'));var util=require('util');var logger=require(_0x6770('0x1'))(_0x6770('0x2'));var moment=require(_0x6770('0x3'));var BPromise=require('bluebird');var rp=require(_0x6770('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6770('0x5'));var config=require(_0x6770('0x6'));var attributes=require(_0x6770('0x7'));module[_0x6770('0x8')]=function(_0x1febc5,_0x4011fc){return _0x1febc5[_0x6770('0x9')](_0x6770('0xa'),attributes,{'tableName':_0x6770('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99b0=['exports','define','Condition','tools_conditions','../../config/logger','api','moment','bluebird','request-promise','path','./condition.attributes'];(function(_0x55bae0,_0x2140ec){var _0x2ef9e6=function(_0x1a1b51){while(--_0x1a1b51){_0x55bae0['push'](_0x55bae0['shift']());}};_0x2ef9e6(++_0x2140ec);}(_0x99b0,0x101));var _0x099b=function(_0x4faee0,_0x1301c8){_0x4faee0=_0x4faee0-0x0;var _0x297989=_0x99b0[_0x4faee0];return _0x297989;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x099b('0x0'))(_0x099b('0x1'));var moment=require(_0x099b('0x2'));var BPromise=require(_0x099b('0x3'));var rp=require(_0x099b('0x4'));var fs=require('fs');var path=require(_0x099b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x099b('0x6'));module[_0x099b('0x7')]=function(_0x16aed1,_0x2d878c){return _0x16aed1[_0x099b('0x8')](_0x099b('0x9'),attributes,{'tableName':_0x099b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 525f42a..6eb6fd6 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 _0xe22e=['request','then','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0xe22e,0x12c));var _0xee22=function(_0x394b23,_0x36d244){_0x394b23=_0x394b23-0x0;var _0xccfc8b=_0xe22e[_0x394b23];return _0xccfc8b;};'use strict';var _=require(_0xee22('0x0'));var util=require(_0xee22('0x1'));var moment=require(_0xee22('0x2'));var BPromise=require(_0xee22('0x3'));var rs=require(_0xee22('0x4'));var fs=require('fs');var Redis=require(_0xee22('0x5'));var db=require(_0xee22('0x6'))['db'];var utils=require(_0xee22('0x7'));var logger=require(_0xee22('0x8'))(_0xee22('0x9'));var config=require('../../config/environment');var jayson=require(_0xee22('0xa'));var client=jayson['client'][_0xee22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd3c1d1,_0x1cd621,_0x1d2cb1){return new BPromise(function(_0x4ad0d6,_0x5250d9){return client[_0xee22('0xc')](_0xd3c1d1,_0x1d2cb1)[_0xee22('0xd')](function(_0xf68916){logger['info'](_0xee22('0xe'),_0x1cd621,'request\x20sent');logger[_0xee22('0xf')](_0xee22('0x10'),_0x1cd621,_0xee22('0x11'),JSON[_0xee22('0x12')](_0xf68916));if(_0xf68916[_0xee22('0x13')]){if(_0xf68916[_0xee22('0x13')][_0xee22('0x14')]===0x1f4){logger[_0xee22('0x13')](_0xee22('0xe'),_0x1cd621,_0xf68916[_0xee22('0x13')][_0xee22('0x15')]);return _0x5250d9(_0xf68916[_0xee22('0x13')][_0xee22('0x15')]);}logger['error'](_0xee22('0xe'),_0x1cd621,_0xf68916[_0xee22('0x13')]['message']);return _0x4ad0d6(_0xf68916[_0xee22('0x13')][_0xee22('0x15')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x1cd621,'request\x20sent');_0x4ad0d6(_0xf68916[_0xee22('0x16')][_0xee22('0x15')]);}})[_0xee22('0x17')](function(_0x1b0407){logger[_0xee22('0x13')](_0xee22('0xe'),_0x1cd621,_0x1b0407);_0x5250d9(_0x1b0407);});});} \ No newline at end of file +var _0x9e1d=['Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x208ffe,_0x1e391e){var _0x5e3d8d=function(_0x3c0e69){while(--_0x3c0e69){_0x208ffe['push'](_0x208ffe['shift']());}};_0x5e3d8d(++_0x1e391e);}(_0x9e1d,0x1d1));var _0xd9e1=function(_0x28a9e6,_0x9ef07d){_0x28a9e6=_0x28a9e6-0x0;var _0x58f9e2=_0x9e1d[_0x28a9e6];return _0x58f9e2;};'use strict';var _=require('lodash');var util=require(_0xd9e1('0x0'));var moment=require(_0xd9e1('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9e1('0x2'));var fs=require('fs');var Redis=require(_0xd9e1('0x3'));var db=require(_0xd9e1('0x4'))['db'];var utils=require(_0xd9e1('0x5'));var logger=require(_0xd9e1('0x6'))('rpc');var config=require(_0xd9e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd9e1('0x8')][_0xd9e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fea4,_0xe5ca14,_0x411e9f){return new BPromise(function(_0x372072,_0x4d344c){return client['request'](_0x20fea4,_0x411e9f)[_0xd9e1('0xa')](function(_0x5c3000){logger[_0xd9e1('0xb')](_0xd9e1('0xc'),_0xe5ca14,_0xd9e1('0xd'));logger[_0xd9e1('0xe')](_0xd9e1('0xf'),_0xe5ca14,_0xd9e1('0xd'),JSON['stringify'](_0x5c3000));if(_0x5c3000[_0xd9e1('0x10')]){if(_0x5c3000[_0xd9e1('0x10')][_0xd9e1('0x11')]===0x1f4){logger[_0xd9e1('0x10')](_0xd9e1('0xc'),_0xe5ca14,_0x5c3000[_0xd9e1('0x10')]['message']);return _0x4d344c(_0x5c3000[_0xd9e1('0x10')][_0xd9e1('0x12')]);}logger[_0xd9e1('0x10')]('Condition,\x20%s,\x20%s',_0xe5ca14,_0x5c3000[_0xd9e1('0x10')]['message']);return _0x372072(_0x5c3000[_0xd9e1('0x10')][_0xd9e1('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xe5ca14,_0xd9e1('0xd'));_0x372072(_0x5c3000[_0xd9e1('0x13')][_0xd9e1('0x12')]);}})['catch'](function(_0x43345c){logger[_0xd9e1('0x10')](_0xd9e1('0xc'),_0xe5ca14,_0x43345c);_0x4d344c(_0x43345c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0edd5cb..d32e953 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 _0x2d9f=['../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2d9f,0x158));var _0xf2d9=function(_0xebbc39,_0x427a35){_0xebbc39=_0xebbc39-0x0;var _0x5892df=_0x2d9f[_0xebbc39];return _0x5892df;};'use strict';var multer=require('multer');var util=require(_0xf2d9('0x0'));var path=require(_0xf2d9('0x1'));var timeout=require(_0xf2d9('0x2'));var express=require('express');var router=express[_0xf2d9('0x3')]();var auth=require(_0xf2d9('0x4'));var interaction=require(_0xf2d9('0x5'));var config=require(_0xf2d9('0x6'));var controller=require('./condition.controller');router[_0xf2d9('0x7')](_0xf2d9('0x8'),auth[_0xf2d9('0x9')](),controller[_0xf2d9('0xa')]);router[_0xf2d9('0xb')](_0xf2d9('0x8'),auth['isAuthenticated'](),controller[_0xf2d9('0xc')]);module[_0xf2d9('0xd')]=router; \ No newline at end of file +var _0x82ab=['util','path','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','/:id','delete','isAuthenticated','destroy','exports'];(function(_0x102261,_0x35e5ef){var _0x12c351=function(_0x481253){while(--_0x481253){_0x102261['push'](_0x102261['shift']());}};_0x12c351(++_0x35e5ef);}(_0x82ab,0x84));var _0xb82a=function(_0x588783,_0x550af0){_0x588783=_0x588783-0x0;var _0x146ed6=_0x82ab[_0x588783];return _0x146ed6;};'use strict';var multer=require('multer');var util=require(_0xb82a('0x0'));var path=require(_0xb82a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb82a('0x2'));var router=express[_0xb82a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb82a('0x4'));var config=require(_0xb82a('0x5'));var controller=require(_0xb82a('0x6'));router['put'](_0xb82a('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xb82a('0x8')](_0xb82a('0x7'),auth[_0xb82a('0x9')](),controller[_0xb82a('0xa')]);module[_0xb82a('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1e12a76..0a8d1ba 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 _0xaf9b=['sequelize','STRING','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x169d72,_0x59cf29){_0x169d72=_0x169d72-0x0;var _0x388a89=_0xaf9b[_0x169d72];return _0x388a89;};'use strict';var Sequelize=require(_0xbaf9('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaf9('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xbaf9('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbaf9('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x949d=['STRING','name','sequelize','exports'];(function(_0x5e86cb,_0x388c1b){var _0x41e845=function(_0x1c3a26){while(--_0x1c3a26){_0x5e86cb['push'](_0x5e86cb['shift']());}};_0x41e845(++_0x388c1b);}(_0x949d,0x162));var _0xd949=function(_0x342322,_0x139b36){_0x342322=_0x342322-0x0;var _0x3cee3b=_0x949d[_0x342322];return _0x3cee3b;};'use strict';var Sequelize=require(_0xd949('0x0'));module[_0xd949('0x1')]={'name':{'type':Sequelize[_0xd949('0x2')],'allowNull':![],'unique':_0xd949('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 46cb268..38e3992 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 _0x202a=['end','json','count','offset','limit','set','apply','save','update','then','ContactItemTypes','UserProfileResource','name','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xa4b8d6,_0x5487ad){var _0x8edd17=function(_0x41f454){while(--_0x41f454){_0xa4b8d6['push'](_0xa4b8d6['shift']());}};_0x8edd17(++_0x5487ad);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa202('0x0'));var rimraf=require(_0xa202('0x1'));var zipdir=require(_0xa202('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa202('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa202('0x4'));var path=require(_0xa202('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa202('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa202('0x7'));var deskjs=require(_0xa202('0x8'));var toCsv=require(_0xa202('0x9'));var querystring=require(_0xa202('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa202('0xb'));var qs=require(_0xa202('0xc'));var as=require(_0xa202('0xd'));var hardwareService=require(_0xa202('0xe'));var logger=require('../../config/logger')(_0xa202('0xf'));var utils=require('../../config/utils');var config=require(_0xa202('0x10'));var licenseUtil=require(_0xa202('0x11'));var db=require(_0xa202('0x12'))['db'];function respondWithStatusCode(_0x5bef49,_0x16164b){_0x16164b=_0x16164b||0xcc;return function(_0xdd992){if(_0xdd992){return _0x5bef49[_0xa202('0x13')](_0x16164b);}return _0x5bef49[_0xa202('0x14')](_0x16164b)[_0xa202('0x15')]();};}function respondWithResult(_0x29969e,_0x598d8e){_0x598d8e=_0x598d8e||0xc8;return function(_0x13510c){if(_0x13510c){return _0x29969e[_0xa202('0x14')](_0x598d8e)[_0xa202('0x16')](_0x13510c);}};}function respondWithFilteredResult(_0x28953b,_0x2e1790){return function(_0x5dc065){if(_0x5dc065){var _0x331df8=_0x5dc065[_0xa202('0x17')],_0x30b18b=_0x2e1790[_0xa202('0x18')],_0x1221a2=_0x2e1790['offset']+_0x2e1790[_0xa202('0x19')],_0x3fcc66;if(_0x1221a2>=_0x331df8){_0x1221a2=_0x331df8;_0x3fcc66=0xc8;}else{_0x3fcc66=0xce;}_0x28953b['status'](_0x3fcc66);return _0x28953b[_0xa202('0x1a')]('Content-Range',_0x30b18b+'-'+_0x1221a2+'/'+_0x331df8)[_0xa202('0x16')](_0x5dc065);}return null;};}function patchUpdates(_0x33b91f){return function(_0x130c45){try{jsonpatch[_0xa202('0x1b')](_0x130c45,_0x33b91f,!![]);}catch(_0x391e82){return BPromise['reject'](_0x391e82);}return _0x130c45[_0xa202('0x1c')]();};}function saveUpdates(_0x6132f1,_0x353440){return function(_0x468575){if(_0x468575){return _0x468575[_0xa202('0x1d')](_0x6132f1)['then'](function(_0x55c9a5){return _0x55c9a5;});}return null;};}function removeEntity(_0x7b47e5,_0x46cfa4){return function(_0x44801a){if(_0x44801a){return _0x44801a['destroy']()[_0xa202('0x1e')](function(){var _0x192d3c=_0x44801a['get']({'plain':!![]});var _0x565685=_0xa202('0x1f');return db[_0xa202('0x20')]['destroy']({'where':{'type':_0x565685,'resourceId':_0x192d3c['id']}})[_0xa202('0x1e')](function(){return _0x44801a;});})['then'](function(){_0x7b47e5['status'](0xcc)[_0xa202('0x15')]();});}};}function handleEntityNotFound(_0x268ee9,_0x397553){return function(_0x2f0779){if(!_0x2f0779){_0x268ee9[_0xa202('0x13')](0x194);}return _0x2f0779;};}function handleError(_0x1d6704,_0x587832){_0x587832=_0x587832||0x1f4;return function(_0x571571){logger['error'](_0x571571['stack']);if(_0x571571[_0xa202('0x21')]){delete _0x571571[_0xa202('0x21')];}_0x1d6704[_0xa202('0x14')](_0x587832)['send'](_0x571571);};}exports[_0xa202('0x22')]=function(_0x390633,_0xf73ab4){var _0x2cc2af={},_0x3eed2c={},_0x2f97f7={'count':0x0,'rows':[]};var _0x41b09b=_[_0xa202('0x23')](db[_0xa202('0x24')][_0xa202('0x25')],function(_0x213749){return{'name':_0x213749[_0xa202('0x26')],'type':_0x213749[_0xa202('0x27')][_0xa202('0x28')]};});_0x3eed2c[_0xa202('0x29')]=_[_0xa202('0x23')](_0x41b09b,'name');_0x3eed2c[_0xa202('0x2a')]=_[_0xa202('0x2b')](_0x390633[_0xa202('0x2a')]);_0x3eed2c[_0xa202('0x2c')]=_[_0xa202('0x2d')](_0x3eed2c[_0xa202('0x29')],_0x3eed2c['query']);_0x2cc2af[_0xa202('0x2e')]=_[_0xa202('0x2d')](_0x3eed2c['model'],qs[_0xa202('0x2f')](_0x390633[_0xa202('0x2a')]['fields']));_0x2cc2af['attributes']=_0x2cc2af['attributes'][_0xa202('0x30')]?_0x2cc2af[_0xa202('0x2e')]:_0x3eed2c[_0xa202('0x29')];if(!_0x390633[_0xa202('0x2a')][_0xa202('0x31')]('nolimit')){_0x2cc2af[_0xa202('0x19')]=qs['limit'](_0x390633[_0xa202('0x2a')][_0xa202('0x19')]);_0x2cc2af[_0xa202('0x18')]=qs['offset'](_0x390633[_0xa202('0x2a')]['offset']);}_0x2cc2af['order']=qs[_0xa202('0x32')](_0x390633[_0xa202('0x2a')]['sort']);_0x2cc2af[_0xa202('0x33')]=qs['filters'](_['pick'](_0x390633[_0xa202('0x2a')],_0x3eed2c[_0xa202('0x2c')]),_0x41b09b);if(_0x390633['query'][_0xa202('0x34')]){_0x2cc2af[_0xa202('0x33')]=_[_0xa202('0x35')](_0x2cc2af['where'],{'$or':_[_0xa202('0x23')](_0x41b09b,function(_0x2fdce3){if(_0x2fdce3[_0xa202('0x27')]!==_0xa202('0x36')){var _0xd58df9={};_0xd58df9[_0x2fdce3[_0xa202('0x21')]]={'$like':'%'+_0x390633[_0xa202('0x2a')][_0xa202('0x34')]+'%'};return _0xd58df9;}})});}_0x2cc2af=_[_0xa202('0x35')]({},_0x2cc2af,_0x390633[_0xa202('0x37')]);var _0x387764={'where':_0x2cc2af[_0xa202('0x33')]};return db['ContactItemType']['count'](_0x387764)[_0xa202('0x1e')](function(_0x1b2d05){_0x2f97f7[_0xa202('0x17')]=_0x1b2d05;if(_0x390633[_0xa202('0x2a')][_0xa202('0x38')]){_0x2cc2af[_0xa202('0x39')]=[{'all':!![]}];}return db[_0xa202('0x24')][_0xa202('0x3a')](_0x2cc2af);})[_0xa202('0x1e')](function(_0x1cd615){_0x2f97f7['rows']=_0x1cd615;return _0x2f97f7;})[_0xa202('0x1e')](respondWithFilteredResult(_0xf73ab4,_0x2cc2af))[_0xa202('0x3b')](handleError(_0xf73ab4,null));};exports['show']=function(_0x48a546,_0x4f783c){var _0x130be0={'raw':!![],'where':{'id':_0x48a546[_0xa202('0x3c')]['id']}},_0x3dfeb5={};_0x3dfeb5[_0xa202('0x29')]=_['keys'](db[_0xa202('0x24')][_0xa202('0x25')]);_0x3dfeb5[_0xa202('0x2a')]=_[_0xa202('0x2b')](_0x48a546['query']);_0x3dfeb5[_0xa202('0x2c')]=_[_0xa202('0x2d')](_0x3dfeb5[_0xa202('0x29')],_0x3dfeb5['query']);_0x130be0[_0xa202('0x2e')]=_[_0xa202('0x2d')](_0x3dfeb5[_0xa202('0x29')],qs[_0xa202('0x2f')](_0x48a546[_0xa202('0x2a')][_0xa202('0x2f')]));_0x130be0[_0xa202('0x2e')]=_0x130be0[_0xa202('0x2e')][_0xa202('0x30')]?_0x130be0[_0xa202('0x2e')]:_0x3dfeb5[_0xa202('0x29')];if(_0x48a546[_0xa202('0x2a')]['includeAll']){_0x130be0[_0xa202('0x39')]=[{'all':!![]}];}_0x130be0=_[_0xa202('0x35')]({},_0x130be0,_0x48a546[_0xa202('0x37')]);return db[_0xa202('0x24')][_0xa202('0x3d')](_0x130be0)[_0xa202('0x1e')](handleEntityNotFound(_0x4f783c,null))[_0xa202('0x1e')](respondWithResult(_0x4f783c,null))[_0xa202('0x3b')](handleError(_0x4f783c,null));};exports['create']=function(_0x232941,_0x1a7d62){return db[_0xa202('0x24')]['create'](_0x232941[_0xa202('0x3e')],{})[_0xa202('0x1e')](function(_0xc72f62){var _0x55cfc5=_0x232941[_0xa202('0x3f')][_0xa202('0x40')]({'plain':!![]});if(!_0x55cfc5)throw new Error(_0xa202('0x41'));if(_0x55cfc5[_0xa202('0x42')]===_0xa202('0x3f')){var _0x1e8c0e=_0xc72f62[_0xa202('0x40')]({'plain':!![]});var _0x3f972b=_0xa202('0x1f');return db[_0xa202('0x43')][_0xa202('0x3d')]({'where':{'name':_0x3f972b,'userProfileId':_0x55cfc5['userProfileId']},'raw':!![]})[_0xa202('0x1e')](function(_0x3b8dc4){if(_0x3b8dc4&&_0x3b8dc4[_0xa202('0x44')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e8c0e[_0xa202('0x21')],'resourceId':_0x1e8c0e['id'],'type':_0x3b8dc4[_0xa202('0x21')],'sectionId':_0x3b8dc4['id']},{})['then'](function(){return _0xc72f62;});}else{return _0xc72f62;}})[_0xa202('0x3b')](function(_0xfa1a43){logger['error'](_0xa202('0x45'),_0xfa1a43);throw _0xfa1a43;});}return _0xc72f62;})[_0xa202('0x1e')](respondWithResult(_0x1a7d62,0xc9))[_0xa202('0x3b')](handleError(_0x1a7d62,null));};exports[_0xa202('0x1d')]=function(_0x522786,_0x205bf2){if(_0x522786['body']['id']){delete _0x522786['body']['id'];}return db[_0xa202('0x24')]['find']({'where':{'id':_0x522786['params']['id']}})[_0xa202('0x1e')](handleEntityNotFound(_0x205bf2,null))['then'](saveUpdates(_0x522786['body'],null))[_0xa202('0x1e')](respondWithResult(_0x205bf2,null))[_0xa202('0x3b')](handleError(_0x205bf2,null));};exports[_0xa202('0x46')]=function(_0xbc4bd8,_0x49cb4e){return db[_0xa202('0x24')][_0xa202('0x3d')]({'where':{'id':_0xbc4bd8['params']['id']}})[_0xa202('0x1e')](handleEntityNotFound(_0x49cb4e,null))[_0xa202('0x1e')](removeEntity(_0x49cb4e,null))[_0xa202('0x3b')](handleError(_0x49cb4e,null));}; \ No newline at end of file +var _0x3714=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','send','map','ContactItemType','rawAttributes','fieldName','type','model','name','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3714,0x95));var _0x4371=function(_0x514bc7,_0xcf329e){_0x514bc7=_0x514bc7-0x0;var _0x1c5236=_0x3714[_0x514bc7];return _0x1c5236;};'use strict';var pdf=require(_0x4371('0x0'));var emlformat=require(_0x4371('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4371('0x2'));var jsonpatch=require(_0x4371('0x3'));var rp=require(_0x4371('0x4'));var moment=require('moment');var BPromise=require(_0x4371('0x5'));var Mustache=require(_0x4371('0x6'));var util=require(_0x4371('0x7'));var path=require('path');var sox=require(_0x4371('0x8'));var csv=require('to-csv');var ejs=require(_0x4371('0x9'));var fs=require('fs');var _=require(_0x4371('0xa'));var squel=require('squel');var crypto=require(_0x4371('0xb'));var jsforce=require(_0x4371('0xc'));var deskjs=require(_0x4371('0xd'));var toCsv=require(_0x4371('0xe'));var querystring=require('querystring');var Papa=require(_0x4371('0xf'));var Redis=require('ioredis');var authService=require(_0x4371('0x10'));var qs=require(_0x4371('0x11'));var as=require(_0x4371('0x12'));var hardwareService=require(_0x4371('0x13'));var logger=require('../../config/logger')(_0x4371('0x14'));var utils=require(_0x4371('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4371('0x16'));var db=require(_0x4371('0x17'))['db'];function respondWithStatusCode(_0x1d5806,_0x293b9c){_0x293b9c=_0x293b9c||0xcc;return function(_0x55972){if(_0x55972){return _0x1d5806[_0x4371('0x18')](_0x293b9c);}return _0x1d5806[_0x4371('0x19')](_0x293b9c)[_0x4371('0x1a')]();};}function respondWithResult(_0x3decc7,_0x1d19ea){_0x1d19ea=_0x1d19ea||0xc8;return function(_0xf2c4e0){if(_0xf2c4e0){return _0x3decc7['status'](_0x1d19ea)[_0x4371('0x1b')](_0xf2c4e0);}};}function respondWithFilteredResult(_0x112f26,_0x41447c){return function(_0x482082){if(_0x482082){var _0x1adca6=_0x482082[_0x4371('0x1c')],_0xe404d9=_0x41447c[_0x4371('0x1d')],_0x27f864=_0x41447c[_0x4371('0x1d')]+_0x41447c[_0x4371('0x1e')],_0xa229c4;if(_0x27f864>=_0x1adca6){_0x27f864=_0x1adca6;_0xa229c4=0xc8;}else{_0xa229c4=0xce;}_0x112f26[_0x4371('0x19')](_0xa229c4);return _0x112f26[_0x4371('0x1f')](_0x4371('0x20'),_0xe404d9+'-'+_0x27f864+'/'+_0x1adca6)[_0x4371('0x1b')](_0x482082);}return null;};}function patchUpdates(_0x322fa5){return function(_0x5c7c42){try{jsonpatch[_0x4371('0x21')](_0x5c7c42,_0x322fa5,!![]);}catch(_0x2f3ba7){return BPromise[_0x4371('0x22')](_0x2f3ba7);}return _0x5c7c42[_0x4371('0x23')]();};}function saveUpdates(_0x2ad3cf,_0x4c40fe){return function(_0x592700){if(_0x592700){return _0x592700['update'](_0x2ad3cf)[_0x4371('0x24')](function(_0x5bdfbc){return _0x5bdfbc;});}return null;};}function removeEntity(_0x9d8623,_0x17dde7){return function(_0x3b89a8){if(_0x3b89a8){return _0x3b89a8[_0x4371('0x25')]()[_0x4371('0x24')](function(){var _0x344a3d=_0x3b89a8[_0x4371('0x26')]({'plain':!![]});var _0x345d87=_0x4371('0x27');return db[_0x4371('0x28')][_0x4371('0x25')]({'where':{'type':_0x345d87,'resourceId':_0x344a3d['id']}})[_0x4371('0x24')](function(){return _0x3b89a8;});})[_0x4371('0x24')](function(){_0x9d8623[_0x4371('0x19')](0xcc)[_0x4371('0x1a')]();});}};}function handleEntityNotFound(_0x4f40a0,_0x1c6dca){return function(_0x54647d){if(!_0x54647d){_0x4f40a0[_0x4371('0x18')](0x194);}return _0x54647d;};}function handleError(_0x2ab6c8,_0x3e9586){_0x3e9586=_0x3e9586||0x1f4;return function(_0x179045){logger[_0x4371('0x29')](_0x179045[_0x4371('0x2a')]);if(_0x179045['name']){delete _0x179045['name'];}_0x2ab6c8[_0x4371('0x19')](_0x3e9586)[_0x4371('0x2b')](_0x179045);};}exports['index']=function(_0x108945,_0x3fad2c){var _0x2e7cd7={},_0x3acddd={},_0x2c22e4={'count':0x0,'rows':[]};var _0x3ab621=_[_0x4371('0x2c')](db[_0x4371('0x2d')][_0x4371('0x2e')],function(_0x1e2563){return{'name':_0x1e2563[_0x4371('0x2f')],'type':_0x1e2563[_0x4371('0x30')]['key']};});_0x3acddd[_0x4371('0x31')]=_[_0x4371('0x2c')](_0x3ab621,_0x4371('0x32'));_0x3acddd['query']=_['keys'](_0x108945[_0x4371('0x33')]);_0x3acddd['filters']=_[_0x4371('0x34')](_0x3acddd[_0x4371('0x31')],_0x3acddd[_0x4371('0x33')]);_0x2e7cd7[_0x4371('0x35')]=_[_0x4371('0x34')](_0x3acddd[_0x4371('0x31')],qs[_0x4371('0x36')](_0x108945[_0x4371('0x33')]['fields']));_0x2e7cd7[_0x4371('0x35')]=_0x2e7cd7[_0x4371('0x35')][_0x4371('0x37')]?_0x2e7cd7[_0x4371('0x35')]:_0x3acddd['model'];if(!_0x108945[_0x4371('0x33')]['hasOwnProperty'](_0x4371('0x38'))){_0x2e7cd7[_0x4371('0x1e')]=qs[_0x4371('0x1e')](_0x108945['query'][_0x4371('0x1e')]);_0x2e7cd7['offset']=qs['offset'](_0x108945['query'][_0x4371('0x1d')]);}_0x2e7cd7[_0x4371('0x39')]=qs['sort'](_0x108945[_0x4371('0x33')][_0x4371('0x3a')]);_0x2e7cd7['where']=qs[_0x4371('0x3b')](_['pick'](_0x108945[_0x4371('0x33')],_0x3acddd[_0x4371('0x3b')]),_0x3ab621);if(_0x108945['query'][_0x4371('0x3c')]){_0x2e7cd7[_0x4371('0x3d')]=_[_0x4371('0x3e')](_0x2e7cd7[_0x4371('0x3d')],{'$or':_[_0x4371('0x2c')](_0x3ab621,function(_0x1ce699){if(_0x1ce699['type']!==_0x4371('0x3f')){var _0x2521dd={};_0x2521dd[_0x1ce699[_0x4371('0x32')]]={'$like':'%'+_0x108945[_0x4371('0x33')][_0x4371('0x3c')]+'%'};return _0x2521dd;}})});}_0x2e7cd7=_[_0x4371('0x3e')]({},_0x2e7cd7,_0x108945['options']);var _0x4664e9={'where':_0x2e7cd7[_0x4371('0x3d')]};return db[_0x4371('0x2d')][_0x4371('0x1c')](_0x4664e9)[_0x4371('0x24')](function(_0x41f4f1){_0x2c22e4[_0x4371('0x1c')]=_0x41f4f1;if(_0x108945[_0x4371('0x33')][_0x4371('0x40')]){_0x2e7cd7[_0x4371('0x41')]=[{'all':!![]}];}return db[_0x4371('0x2d')][_0x4371('0x42')](_0x2e7cd7);})['then'](function(_0x2f9ca1){_0x2c22e4[_0x4371('0x43')]=_0x2f9ca1;return _0x2c22e4;})[_0x4371('0x24')](respondWithFilteredResult(_0x3fad2c,_0x2e7cd7))[_0x4371('0x44')](handleError(_0x3fad2c,null));};exports['show']=function(_0x3d80be,_0x176daf){var _0x629b81={'raw':!![],'where':{'id':_0x3d80be[_0x4371('0x45')]['id']}},_0x187b6f={};_0x187b6f[_0x4371('0x31')]=_[_0x4371('0x46')](db['ContactItemType'][_0x4371('0x2e')]);_0x187b6f[_0x4371('0x33')]=_[_0x4371('0x46')](_0x3d80be[_0x4371('0x33')]);_0x187b6f[_0x4371('0x3b')]=_['intersection'](_0x187b6f[_0x4371('0x31')],_0x187b6f[_0x4371('0x33')]);_0x629b81[_0x4371('0x35')]=_[_0x4371('0x34')](_0x187b6f[_0x4371('0x31')],qs[_0x4371('0x36')](_0x3d80be['query'][_0x4371('0x36')]));_0x629b81[_0x4371('0x35')]=_0x629b81['attributes'][_0x4371('0x37')]?_0x629b81[_0x4371('0x35')]:_0x187b6f[_0x4371('0x31')];if(_0x3d80be[_0x4371('0x33')][_0x4371('0x40')]){_0x629b81['include']=[{'all':!![]}];}_0x629b81=_[_0x4371('0x3e')]({},_0x629b81,_0x3d80be[_0x4371('0x47')]);return db[_0x4371('0x2d')][_0x4371('0x48')](_0x629b81)[_0x4371('0x24')](handleEntityNotFound(_0x176daf,null))['then'](respondWithResult(_0x176daf,null))[_0x4371('0x44')](handleError(_0x176daf,null));};exports[_0x4371('0x49')]=function(_0x489490,_0x2aa000){return db[_0x4371('0x2d')]['create'](_0x489490[_0x4371('0x4a')],{})[_0x4371('0x24')](function(_0x4868e5){var _0x10f8eb=_0x489490[_0x4371('0x4b')][_0x4371('0x26')]({'plain':!![]});if(!_0x10f8eb)throw new Error(_0x4371('0x4c'));if(_0x10f8eb[_0x4371('0x4d')]==='user'){var _0x13d8d9=_0x4868e5['get']({'plain':!![]});var _0x1c52b6='ContactItemTypes';return db[_0x4371('0x4e')][_0x4371('0x48')]({'where':{'name':_0x1c52b6,'userProfileId':_0x10f8eb['userProfileId']},'raw':!![]})[_0x4371('0x24')](function(_0x3d9b7c){if(_0x3d9b7c&&_0x3d9b7c[_0x4371('0x4f')]===0x0){return db[_0x4371('0x28')][_0x4371('0x49')]({'name':_0x13d8d9[_0x4371('0x32')],'resourceId':_0x13d8d9['id'],'type':_0x3d9b7c['name'],'sectionId':_0x3d9b7c['id']},{})[_0x4371('0x24')](function(){return _0x4868e5;});}else{return _0x4868e5;}})['catch'](function(_0x89ad72){logger[_0x4371('0x29')](_0x4371('0x50'),_0x89ad72);throw _0x89ad72;});}return _0x4868e5;})['then'](respondWithResult(_0x2aa000,0xc9))['catch'](handleError(_0x2aa000,null));};exports[_0x4371('0x51')]=function(_0xa8f474,_0x575cc5){if(_0xa8f474[_0x4371('0x4a')]['id']){delete _0xa8f474[_0x4371('0x4a')]['id'];}return db[_0x4371('0x2d')][_0x4371('0x48')]({'where':{'id':_0xa8f474['params']['id']}})[_0x4371('0x24')](handleEntityNotFound(_0x575cc5,null))[_0x4371('0x24')](saveUpdates(_0xa8f474[_0x4371('0x4a')],null))[_0x4371('0x24')](respondWithResult(_0x575cc5,null))[_0x4371('0x44')](handleError(_0x575cc5,null));};exports[_0x4371('0x25')]=function(_0x5c2b93,_0x4827de){return db[_0x4371('0x2d')]['find']({'where':{'id':_0x5c2b93['params']['id']}})[_0x4371('0x24')](handleEntityNotFound(_0x4827de,null))[_0x4371('0x24')](removeEntity(_0x4827de,null))[_0x4371('0x44')](handleError(_0x4827de,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e074a7f..3664aba 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 _0x7919=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ContactItemType','lodash','util','../../config/logger','api','moment'];(function(_0x1e348d,_0x208dc8){var _0x4281a9=function(_0xd40e56){while(--_0xd40e56){_0x1e348d['push'](_0x1e348d['shift']());}};_0x4281a9(++_0x208dc8);}(_0x7919,0xeb));var _0x9791=function(_0x46ab29,_0x3e9e6c){_0x46ab29=_0x46ab29-0x0;var _0x2829d7=_0x7919[_0x46ab29];return _0x2829d7;};'use strict';var _=require(_0x9791('0x0'));var util=require(_0x9791('0x1'));var logger=require(_0x9791('0x2'))(_0x9791('0x3'));var moment=require(_0x9791('0x4'));var BPromise=require(_0x9791('0x5'));var rp=require(_0x9791('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9791('0x7'));var config=require(_0x9791('0x8'));var attributes=require('./contactItemType.attributes');module[_0x9791('0x9')]=function(_0x3cf497,_0x2a404d){return _0x3cf497[_0x9791('0xa')](_0x9791('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7b=['moment','bluebird','request-promise','path','../../config/environment','exports','define','tools_contact_item_types','util','../../config/logger','api'];(function(_0x8559d4,_0x4d4346){var _0x54c7d5=function(_0x439e2f){while(--_0x439e2f){_0x8559d4['push'](_0x8559d4['shift']());}};_0x54c7d5(++_0x4d4346);}(_0x6f7b,0x168));var _0xb6f7=function(_0x9d0c17,_0x26ec54){_0x9d0c17=_0x9d0c17-0x0;var _0x41b13c=_0x6f7b[_0x9d0c17];return _0x41b13c;};'use strict';var _=require('lodash');var util=require(_0xb6f7('0x0'));var logger=require(_0xb6f7('0x1'))(_0xb6f7('0x2'));var moment=require(_0xb6f7('0x3'));var BPromise=require(_0xb6f7('0x4'));var rp=require(_0xb6f7('0x5'));var fs=require('fs');var path=require(_0xb6f7('0x6'));var rimraf=require('rimraf');var config=require(_0xb6f7('0x7'));var attributes=require('./contactItemType.attributes');module[_0xb6f7('0x8')]=function(_0x25cec3,_0x59b2d9){return _0x25cec3[_0xb6f7('0x9')]('ContactItemType',attributes,{'tableName':_0xb6f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 557ca43..b87a712 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 _0x2750=['jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1cb8ed,_0x25a00d){var _0x1ed770=function(_0x1480b4){while(--_0x1480b4){_0x1cb8ed['push'](_0x1cb8ed['shift']());}};_0x1ed770(++_0x25a00d);}(_0x2750,0x13b));var _0x0275=function(_0x5ea1d1,_0x5a761d){_0x5ea1d1=_0x5ea1d1-0x0;var _0x45f000=_0x2750[_0x5ea1d1];return _0x45f000;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('ContactItemType,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('ContactItemType,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file +var _0x180f=['result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5bff30,_0x2cf912){var _0x2b420e=function(_0x5e96a4){while(--_0x5e96a4){_0x5bff30['push'](_0x5bff30['shift']());}};_0x2b420e(++_0x2cf912);}(_0x180f,0xf3));var _0xf180=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x180f[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0xf180('0x0'));var util=require(_0xf180('0x1'));var moment=require('moment');var BPromise=require(_0xf180('0x2'));var rs=require(_0xf180('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf180('0x4'))['db'];var utils=require(_0xf180('0x5'));var logger=require(_0xf180('0x6'))(_0xf180('0x7'));var config=require(_0xf180('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf180('0x9')][_0xf180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513113,_0x47d87b,_0x1d6ca7){return new BPromise(function(_0x303412,_0x342a02){return client[_0xf180('0xb')](_0x513113,_0x1d6ca7)[_0xf180('0xc')](function(_0x4390be){logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,_0xf180('0xf'));logger['debug'](_0xf180('0x10'),_0x47d87b,_0xf180('0xf'),JSON[_0xf180('0x11')](_0x4390be));if(_0x4390be[_0xf180('0x12')]){if(_0x4390be[_0xf180('0x12')][_0xf180('0x13')]===0x1f4){logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x342a02(_0x4390be[_0xf180('0x12')]['message']);}logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x303412(_0x4390be['error'][_0xf180('0x14')]);}else{logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,'request\x20sent');_0x303412(_0x4390be[_0xf180('0x15')][_0xf180('0x14')]);}})['catch'](function(_0x115b86){logger[_0xf180('0x12')]('ContactItemType,\x20%s,\x20%s',_0x47d87b,_0x115b86);_0x342a02(_0x115b86);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 8c71da4..b62eadd 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 _0x9d07=['./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4776c2,_0x1f29d4){var _0x6b63c1=function(_0x553bbd){while(--_0x553bbd){_0x4776c2['push'](_0x4776c2['shift']());}};_0x6b63c1(++_0x1f29d4);}(_0x9d07,0x1ec));var _0x79d0=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9d07[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x79d0('0x0'));var util=require(_0x79d0('0x1'));var path=require(_0x79d0('0x2'));var timeout=require(_0x79d0('0x3'));var express=require(_0x79d0('0x4'));var router=express[_0x79d0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x79d0('0x6'));var config=require(_0x79d0('0x7'));var controller=require(_0x79d0('0x8'));router[_0x79d0('0x9')]('/',auth[_0x79d0('0xa')](),controller[_0x79d0('0xb')]);router['get'](_0x79d0('0xc'),auth[_0x79d0('0xa')](),controller[_0x79d0('0xd')]);router[_0x79d0('0xe')]('/',auth[_0x79d0('0xa')](),controller[_0x79d0('0xf')]);router[_0x79d0('0x10')](_0x79d0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x79d0('0x11')](_0x79d0('0xc'),auth[_0x79d0('0xa')](),controller[_0x79d0('0x12')]);module[_0x79d0('0x13')]=router; \ No newline at end of file +var _0xbac4=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xbac4,0x104));var _0x4bac=function(_0x1634bd,_0x287910){_0x1634bd=_0x1634bd-0x0;var _0x4b27bf=_0xbac4[_0x1634bd];return _0x4b27bf;};'use strict';var multer=require(_0x4bac('0x0'));var util=require('util');var path=require(_0x4bac('0x1'));var timeout=require(_0x4bac('0x2'));var express=require('express');var router=express[_0x4bac('0x3')]();var auth=require(_0x4bac('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4bac('0x5'));var controller=require(_0x4bac('0x6'));router[_0x4bac('0x7')]('/',auth[_0x4bac('0x8')](),controller['index']);router[_0x4bac('0x7')](_0x4bac('0x9'),auth[_0x4bac('0x8')](),controller['show']);router[_0x4bac('0xa')]('/',auth['isAuthenticated'](),controller[_0x4bac('0xb')]);router[_0x4bac('0xc')](_0x4bac('0x9'),auth[_0x4bac('0x8')](),controller[_0x4bac('0xd')]);router[_0x4bac('0xe')](_0x4bac('0x9'),auth[_0x4bac('0x8')](),controller[_0x4bac('0xf')]);module[_0x4bac('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d6a19c0..deb8480 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 _0x241a=['STRING','name','sequelize'];(function(_0x296acd,_0x4b9279){var _0x121252=function(_0x21fb68){while(--_0x21fb68){_0x296acd['push'](_0x296acd['shift']());}};_0x121252(++_0x4b9279);}(_0x241a,0x13d));var _0xa241=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x241a[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xa241('0x0'));module['exports']={'name':{'type':Sequelize[_0xa241('0x1')],'allowNull':![],'unique':_0xa241('0x2')},'description':{'type':Sequelize[_0xa241('0x1')]}}; \ No newline at end of file +var _0x66da=['exports','STRING','name','sequelize'];(function(_0x479ceb,_0x42f840){var _0x555976=function(_0x218d13){while(--_0x218d13){_0x479ceb['push'](_0x479ceb['shift']());}};_0x555976(++_0x42f840);}(_0x66da,0x16f));var _0xa66d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x66da[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xa66d('0x0'));module[_0xa66d('0x1')]={'name':{'type':Sequelize[_0xa66d('0x2')],'allowNull':![],'unique':_0xa66d('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ccc27d4..0430d6c 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 _0xdd4d=['error','name','send','index','map','Dashboard','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','show','params','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','create','update','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','filter','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','destroy','then','get','CustomDashboards','UserProfileResource'];(function(_0xead5f0,_0x30581c){var _0x73c2a6=function(_0x27f32d){while(--_0x27f32d){_0xead5f0['push'](_0xead5f0['shift']());}};_0x73c2a6(++_0x30581c);}(_0xdd4d,0x1ab));var _0xddd4=function(_0x5db8f1,_0x222d11){_0x5db8f1=_0x5db8f1-0x0;var _0xacc47e=_0xdd4d[_0x5db8f1];return _0xacc47e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xddd4('0x0'));var rimraf=require(_0xddd4('0x1'));var zipdir=require(_0xddd4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddd4('0x3'));var moment=require(_0xddd4('0x4'));var BPromise=require(_0xddd4('0x5'));var Mustache=require(_0xddd4('0x6'));var util=require(_0xddd4('0x7'));var path=require(_0xddd4('0x8'));var sox=require(_0xddd4('0x9'));var csv=require(_0xddd4('0xa'));var ejs=require(_0xddd4('0xb'));var fs=require('fs');var _=require(_0xddd4('0xc'));var squel=require(_0xddd4('0xd'));var crypto=require(_0xddd4('0xe'));var jsforce=require(_0xddd4('0xf'));var deskjs=require(_0xddd4('0x10'));var toCsv=require(_0xddd4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xddd4('0x11'));var as=require(_0xddd4('0x12'));var hardwareService=require(_0xddd4('0x13'));var logger=require(_0xddd4('0x14'))(_0xddd4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xddd4('0x16'));var db=require(_0xddd4('0x17'))['db'];config[_0xddd4('0x18')]=_[_0xddd4('0x19')](config[_0xddd4('0x18')],{'host':_0xddd4('0x1a'),'port':0x18eb});var socket=require(_0xddd4('0x1b'))(new Redis(config[_0xddd4('0x18')]));require(_0xddd4('0x1c'))[_0xddd4('0x1d')](socket);function respondWithStatusCode(_0x3a88db,_0x141dfd){_0x141dfd=_0x141dfd||0xcc;return function(_0x4cdc5c){if(_0x4cdc5c){return _0x3a88db[_0xddd4('0x1e')](_0x141dfd);}return _0x3a88db['status'](_0x141dfd)[_0xddd4('0x1f')]();};}function respondWithResult(_0x8167b8,_0x4804b4){_0x4804b4=_0x4804b4||0xc8;return function(_0x3970cd){if(_0x3970cd){return _0x8167b8[_0xddd4('0x20')](_0x4804b4)[_0xddd4('0x21')](_0x3970cd);}};}function respondWithFilteredResult(_0x428ade,_0xe06383){return function(_0x3be5d2){if(_0x3be5d2){var _0x3ae643=_0x3be5d2[_0xddd4('0x22')],_0x50c72a=_0xe06383['offset'],_0x3a34c4=_0xe06383[_0xddd4('0x23')]+_0xe06383[_0xddd4('0x24')],_0x4152bf;if(_0x3a34c4>=_0x3ae643){_0x3a34c4=_0x3ae643;_0x4152bf=0xc8;}else{_0x4152bf=0xce;}_0x428ade['status'](_0x4152bf);return _0x428ade['set'](_0xddd4('0x25'),_0x50c72a+'-'+_0x3a34c4+'/'+_0x3ae643)[_0xddd4('0x21')](_0x3be5d2);}return null;};}function patchUpdates(_0x20f4e8){return function(_0x5e3bbd){try{jsonpatch['apply'](_0x5e3bbd,_0x20f4e8,!![]);}catch(_0x581847){return BPromise[_0xddd4('0x26')](_0x581847);}return _0x5e3bbd[_0xddd4('0x27')]();};}function saveUpdates(_0x4d1a8c,_0xbb98fe){return function(_0x3c2c89){if(_0x3c2c89){return _0x3c2c89['update'](_0x4d1a8c)['then'](function(_0x2ce9c2){return _0x2ce9c2;});}return null;};}function removeEntity(_0xbeea25,_0x370e9c){return function(_0x5f169a){if(_0x5f169a){return _0x5f169a[_0xddd4('0x28')]()[_0xddd4('0x29')](function(){var _0x2e5dc0=_0x5f169a[_0xddd4('0x2a')]({'plain':!![]});var _0x951137=_0xddd4('0x2b');return db[_0xddd4('0x2c')][_0xddd4('0x28')]({'where':{'type':_0x951137,'resourceId':_0x2e5dc0['id']}})[_0xddd4('0x29')](function(){return _0x5f169a;});})[_0xddd4('0x29')](function(){_0xbeea25[_0xddd4('0x20')](0xcc)[_0xddd4('0x1f')]();});}};}function handleEntityNotFound(_0x28abd8,_0x5f2025){return function(_0x101fff){if(!_0x101fff){_0x28abd8[_0xddd4('0x1e')](0x194);}return _0x101fff;};}function handleError(_0x2f3948,_0x198a8e){_0x198a8e=_0x198a8e||0x1f4;return function(_0x2df959){logger[_0xddd4('0x2d')](_0x2df959['stack']);if(_0x2df959[_0xddd4('0x2e')]){delete _0x2df959[_0xddd4('0x2e')];}_0x2f3948['status'](_0x198a8e)[_0xddd4('0x2f')](_0x2df959);};}exports[_0xddd4('0x30')]=function(_0xc2aa56,_0x2c2b53){var _0x46c795={},_0x5f4e9b={},_0x12d274={'count':0x0,'rows':[]};var _0x4bde60=_[_0xddd4('0x31')](db[_0xddd4('0x32')][_0xddd4('0x33')],function(_0x24d7a4){return{'name':_0x24d7a4['fieldName'],'type':_0x24d7a4[_0xddd4('0x34')][_0xddd4('0x35')]};});_0x5f4e9b[_0xddd4('0x36')]=_[_0xddd4('0x31')](_0x4bde60,_0xddd4('0x2e'));_0x5f4e9b['query']=_[_0xddd4('0x37')](_0xc2aa56[_0xddd4('0x38')]);_0x5f4e9b[_0xddd4('0x39')]=_['intersection'](_0x5f4e9b[_0xddd4('0x36')],_0x5f4e9b[_0xddd4('0x38')]);_0x46c795[_0xddd4('0x3a')]=_[_0xddd4('0x3b')](_0x5f4e9b[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x3c')]));_0x46c795[_0xddd4('0x3a')]=_0x46c795[_0xddd4('0x3a')][_0xddd4('0x3d')]?_0x46c795[_0xddd4('0x3a')]:_0x5f4e9b[_0xddd4('0x36')];if(!_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x3e')]('nolimit')){_0x46c795[_0xddd4('0x24')]=qs[_0xddd4('0x24')](_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x24')]);_0x46c795[_0xddd4('0x23')]=qs[_0xddd4('0x23')](_0xc2aa56[_0xddd4('0x38')]['offset']);}_0x46c795[_0xddd4('0x3f')]=qs[_0xddd4('0x40')](_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x40')]);_0x46c795[_0xddd4('0x41')]=qs[_0xddd4('0x39')](_[_0xddd4('0x42')](_0xc2aa56[_0xddd4('0x38')],_0x5f4e9b['filters']),_0x4bde60);if(_0xc2aa56[_0xddd4('0x38')]['filter']){_0x46c795[_0xddd4('0x41')]=_['merge'](_0x46c795['where'],{'$or':_[_0xddd4('0x31')](_0x4bde60,function(_0x1f4dbb){if(_0x1f4dbb[_0xddd4('0x34')]!==_0xddd4('0x43')){var _0x38f5ce={};_0x38f5ce[_0x1f4dbb[_0xddd4('0x2e')]]={'$like':'%'+_0xc2aa56[_0xddd4('0x38')]['filter']+'%'};return _0x38f5ce;}})});}_0x46c795=_[_0xddd4('0x44')]({},_0x46c795,_0xc2aa56[_0xddd4('0x45')]);var _0x57018a={'where':_0x46c795[_0xddd4('0x41')]};return db[_0xddd4('0x32')]['count'](_0x57018a)['then'](function(_0x3854b9){_0x12d274[_0xddd4('0x22')]=_0x3854b9;if(_0xc2aa56['query'][_0xddd4('0x46')]){_0x46c795[_0xddd4('0x47')]=[{'all':!![]}];}return db[_0xddd4('0x32')][_0xddd4('0x48')](_0x46c795);})['then'](function(_0x3609af){_0x12d274['rows']=_0x3609af;return _0x12d274;})[_0xddd4('0x29')](respondWithFilteredResult(_0x2c2b53,_0x46c795))['catch'](handleError(_0x2c2b53,null));};exports[_0xddd4('0x49')]=function(_0x1c71db,_0x356933){var _0x13ae1c={'raw':![],'where':{'id':_0x1c71db[_0xddd4('0x4a')]['id']}},_0x2c3840={};_0x2c3840[_0xddd4('0x36')]=_[_0xddd4('0x37')](db[_0xddd4('0x32')]['rawAttributes']);_0x2c3840[_0xddd4('0x38')]=_[_0xddd4('0x37')](_0x1c71db[_0xddd4('0x38')]);_0x2c3840[_0xddd4('0x39')]=_['intersection'](_0x2c3840[_0xddd4('0x36')],_0x2c3840[_0xddd4('0x38')]);_0x13ae1c['attributes']=_[_0xddd4('0x3b')](_0x2c3840[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0x1c71db[_0xddd4('0x38')][_0xddd4('0x3c')]));_0x13ae1c['attributes']=_0x13ae1c[_0xddd4('0x3a')]['length']?_0x13ae1c[_0xddd4('0x3a')]:_0x2c3840[_0xddd4('0x36')];if(_0x1c71db[_0xddd4('0x38')]['includeAll']){_0x13ae1c[_0xddd4('0x47')]=[{'all':!![]}];}_0x13ae1c=_['merge']({},_0x13ae1c,_0x1c71db[_0xddd4('0x45')]);return db['Dashboard']['find'](_0x13ae1c)[_0xddd4('0x29')](handleEntityNotFound(_0x356933,null))['then'](respondWithResult(_0x356933,null))['catch'](handleError(_0x356933,null));};exports['create']=function(_0x212e9c,_0x66005){return db[_0xddd4('0x32')]['create'](_0x212e9c[_0xddd4('0x4b')],{})[_0xddd4('0x29')](function(_0x20b6bb){var _0x5327fe=_0x212e9c['user'][_0xddd4('0x2a')]({'plain':!![]});if(!_0x5327fe)throw new Error(_0xddd4('0x4c'));if(_0x5327fe[_0xddd4('0x4d')]===_0xddd4('0x4e')){var _0x591a30=_0x20b6bb[_0xddd4('0x2a')]({'plain':!![]});var _0x708550=_0xddd4('0x2b');return db[_0xddd4('0x4f')]['find']({'where':{'name':_0x708550,'userProfileId':_0x5327fe[_0xddd4('0x50')]},'raw':!![]})['then'](function(_0x3d200a){if(_0x3d200a&&_0x3d200a[_0xddd4('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x591a30[_0xddd4('0x2e')],'resourceId':_0x591a30['id'],'type':_0x3d200a[_0xddd4('0x2e')],'sectionId':_0x3d200a['id']},{})['then'](function(){return _0x20b6bb;});}else{return _0x20b6bb;}})[_0xddd4('0x52')](function(_0x158cfd){logger[_0xddd4('0x2d')](_0xddd4('0x53'),_0x158cfd);throw _0x158cfd;});}return _0x20b6bb;})['then'](respondWithResult(_0x66005,0xc9))[_0xddd4('0x52')](handleError(_0x66005,null));};exports[_0xddd4('0x54')]=function(_0x1e4fa1,_0x428998){var _0x35e489={'where':{'id':_0x1e4fa1[_0xddd4('0x4a')]['id']}},_0x461b39={};_0x461b39[_0xddd4('0x36')]=_[_0xddd4('0x37')](db[_0xddd4('0x32')][_0xddd4('0x33')]);_0x35e489[_0xddd4('0x3a')]=_[_0xddd4('0x3b')](_0x461b39[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0x1e4fa1[_0xddd4('0x38')][_0xddd4('0x3c')]));_0x35e489[_0xddd4('0x3a')]=_0x35e489[_0xddd4('0x3a')]['length']?_0x35e489[_0xddd4('0x3a')]:_0x461b39[_0xddd4('0x36')];if(_0x1e4fa1[_0xddd4('0x38')][_0xddd4('0x46')]){_0x35e489[_0xddd4('0x47')]=[{'all':!![]}];}_0x35e489=_[_0xddd4('0x44')]({},_0x35e489,_0x1e4fa1[_0xddd4('0x45')]);return db['Dashboard'][_0xddd4('0x55')](_0x35e489)[_0xddd4('0x29')](handleEntityNotFound(_0x428998,null))[_0xddd4('0x29')](function(_0x52453f){if(_0x52453f){var _0x4554ab=_0x52453f['get']({'plain':!![]});_0x4554ab=qs[_0xddd4('0x56')](_0x4554ab,['id',_0xddd4('0x57'),_0xddd4('0x58')]);_0x1e4fa1[_0xddd4('0x4b')]=_[_0xddd4('0x56')](_0x1e4fa1[_0xddd4('0x4b')],['id',_0xddd4('0x57'),_0xddd4('0x58')]);return db[_0xddd4('0x32')][_0xddd4('0x59')](_[_0xddd4('0x44')](_0x4554ab,_0x1e4fa1[_0xddd4('0x4b')]),{'include':_0x1e4fa1[_0xddd4('0x38')][_0xddd4('0x46')]?[{'all':!![]}]:undefined})[_0xddd4('0x29')](function(_0x27f9ac){var _0x3a24ff=_0x1e4fa1[_0xddd4('0x4e')][_0xddd4('0x2a')]({'plain':!![]});if(!_0x3a24ff)throw new Error(_0xddd4('0x4c'));if(_0x3a24ff[_0xddd4('0x4d')]===_0xddd4('0x4e')){var _0x35c523=_0x27f9ac[_0xddd4('0x2a')]({'plain':!![]});var _0x44c95a='CustomDashboards';return db[_0xddd4('0x4f')][_0xddd4('0x55')]({'where':{'name':_0x44c95a,'userProfileId':_0x3a24ff[_0xddd4('0x50')]},'raw':!![]})['then'](function(_0xea5f3f){if(_0xea5f3f&&_0xea5f3f[_0xddd4('0x51')]===0x0){return db[_0xddd4('0x2c')][_0xddd4('0x59')]({'name':_0x35c523[_0xddd4('0x2e')],'resourceId':_0x35c523['id'],'type':_0xea5f3f[_0xddd4('0x2e')],'sectionId':_0xea5f3f['id']},{})[_0xddd4('0x29')](function(){return _0x27f9ac;});}else{return _0x27f9ac;}})[_0xddd4('0x52')](function(_0x1bef57){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bef57);throw _0x1bef57;});}return _0x27f9ac;});}})[_0xddd4('0x29')](respondWithResult(_0x428998,0xc9))['catch'](handleError(_0x428998,null));};exports[_0xddd4('0x5a')]=function(_0x41920a,_0x21d114){if(_0x41920a[_0xddd4('0x4b')]['id']){delete _0x41920a[_0xddd4('0x4b')]['id'];}return db['Dashboard'][_0xddd4('0x55')]({'where':{'id':_0x41920a[_0xddd4('0x4a')]['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x21d114,null))[_0xddd4('0x29')](saveUpdates(_0x41920a[_0xddd4('0x4b')],null))[_0xddd4('0x29')](respondWithResult(_0x21d114,null))['catch'](handleError(_0x21d114,null));};exports[_0xddd4('0x28')]=function(_0x5e3ffb,_0x4c13c8){return db[_0xddd4('0x32')][_0xddd4('0x55')]({'where':{'id':_0x5e3ffb['params']['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x4c13c8,null))['then'](removeEntity(_0x4c13c8,null))['catch'](handleError(_0x4c13c8,null));};function widgetAttributes(_0x4fd058){try{switch(_0x4fd058[_0xddd4('0x34')]){case'iframe':return[{'name':_0xddd4('0x5b'),'value':_0x4fd058[_0xddd4('0x5b')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0][_0xddd4('0x5d')]:undefined)||'https://'}];case'custom':return[{'name':_0xddd4('0x5e'),'value':_0x4fd058[_0xddd4('0x5e')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058[_0xddd4('0x5c')][0x0]['value']:undefined)||''}];case _0xddd4('0x5f'):return[{'name':'attrHourFormat','value':_0x4fd058['attrHourFormat']||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0]['value']:undefined)||_0xddd4('0x60')},{'name':_0xddd4('0x61'),'value':_0x4fd058[_0xddd4('0x61')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1]['value']:undefined)||_0xddd4('0x62')},{'name':'attrFontSize','value':_0x4fd058[_0xddd4('0x63')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058['attrs'][0x2]?_0x4fd058[_0xddd4('0x5c')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xddd4('0x64'),'value':_0x4fd058[_0xddd4('0x64')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058[_0xddd4('0x5c')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x4fd058[_0xddd4('0x65')]||(_0x4fd058['attrs']&&_0x4fd058[_0xddd4('0x5c')][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1][_0xddd4('0x5d')]:undefined)||[]},{'name':_0xddd4('0x63'),'value':_0x4fd058[_0xddd4('0x63')]||(_0x4fd058['attrs']&&_0x4fd058[_0xddd4('0x5c')][0x2]?_0x4fd058[_0xddd4('0x5c')][0x2][_0xddd4('0x5d')]:undefined)||0x14}];case _0xddd4('0x66'):case _0xddd4('0x67'):return[{'name':_0xddd4('0x68'),'value':_0x4fd058['attrSerie1']||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0][_0xddd4('0x5d')]:undefined)||_0xddd4('0x69')},{'name':_0xddd4('0x6a'),'value':_0x4fd058[_0xddd4('0x6a')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058['attrs'][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1]['value']:undefined)||null},{'name':_0xddd4('0x6b'),'value':_0x4fd058['attrSerie3']||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x2]?_0x4fd058[_0xddd4('0x5c')][0x2]['value']:undefined)||null},{'name':_0xddd4('0x65'),'value':_0x4fd058[_0xddd4('0x65')]||(_0x4fd058['attrs']&&_0x4fd058[_0xddd4('0x5c')][0x3]?_0x4fd058[_0xddd4('0x5c')][0x3][_0xddd4('0x5d')]:undefined)||[]}];case _0xddd4('0x6c'):return[{'name':'attrReport','type':_0x4fd058[_0xddd4('0x6d')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0][_0xddd4('0x34')]:undefined)||null,'value':_0x4fd058['attrReport']||(_0x4fd058['attrs']&&_0x4fd058['attrs'][0x0]?_0x4fd058[_0xddd4('0x5c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4fd058[_0xddd4('0x6e')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1][_0xddd4('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x3faf7f){logger[_0xddd4('0x2d')](_0xddd4('0x6f'),JSON[_0xddd4('0x70')](_0x3faf7f));return[];}}exports['addItem']=function(_0x47815f,_0x12c241,_0x364c70){if(_0x47815f[_0xddd4('0x4b')]['id']){delete _0x47815f[_0xddd4('0x4b')]['id'];}return db['Dashboard'][_0xddd4('0x55')]({'where':{'id':_0x47815f['params']['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x12c241,null))['then'](function(_0x5b2350){if(_0x5b2350){_0x47815f[_0xddd4('0x4b')][_0xddd4('0x71')]=_0x5b2350['id'];_0x47815f[_0xddd4('0x4b')][_0xddd4('0x5c')]=widgetAttributes(_0x47815f[_0xddd4('0x4b')]);return db[_0xddd4('0x72')]['create'](_0x47815f[_0xddd4('0x4b')]);}})[_0xddd4('0x29')](respondWithResult(_0x12c241,null))[_0xddd4('0x52')](handleError(_0x12c241,null));};exports[_0xddd4('0x73')]=function(_0x262451,_0x11d6da,_0x50df9d){var _0x4316b5={};var _0x2424f6={};var _0x60354;var _0x2fda15;return db[_0xddd4('0x32')]['findOne']({'where':{'id':_0x262451[_0xddd4('0x4a')]['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x11d6da,null))[_0xddd4('0x29')](function(_0x2120df){if(_0x2120df){_0x60354=_0x2120df;_0x2424f6['model']=_[_0xddd4('0x37')](db[_0xddd4('0x72')][_0xddd4('0x33')]);_0x2424f6[_0xddd4('0x38')]=_[_0xddd4('0x37')](_0x262451[_0xddd4('0x38')]);_0x2424f6[_0xddd4('0x39')]=_[_0xddd4('0x3b')](_0x2424f6[_0xddd4('0x36')],_0x2424f6[_0xddd4('0x38')]);_0x4316b5[_0xddd4('0x3a')]=_[_0xddd4('0x3b')](_0x2424f6[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0x262451['query'][_0xddd4('0x3c')]));_0x4316b5[_0xddd4('0x3a')]=_0x4316b5[_0xddd4('0x3a')][_0xddd4('0x3d')]?_0x4316b5[_0xddd4('0x3a')]:_0x2424f6['model'];_0x4316b5[_0xddd4('0x3f')]=qs[_0xddd4('0x40')](_0x262451[_0xddd4('0x38')][_0xddd4('0x40')]);_0x4316b5[_0xddd4('0x41')]=qs[_0xddd4('0x39')](_[_0xddd4('0x42')](_0x262451[_0xddd4('0x38')],_0x2424f6[_0xddd4('0x39')]));if(_0x262451['query'][_0xddd4('0x74')]){_0x4316b5['where']=_[_0xddd4('0x44')](_0x4316b5[_0xddd4('0x41')],{'$or':_['map'](_0x4316b5[_0xddd4('0x3a')],function(_0x4a0020){var _0x5cb4f8={};_0x5cb4f8[_0x4a0020]={'$like':'%'+_0x262451[_0xddd4('0x38')][_0xddd4('0x74')]+'%'};return _0x5cb4f8;})});}_0x4316b5=_['merge']({},_0x4316b5,_0x262451[_0xddd4('0x45')]);return _0x60354['getItems'](_0x4316b5);}})[_0xddd4('0x29')](function(_0xe98503){if(_0xe98503){_0x2fda15=_0xe98503[_0xddd4('0x3d')];if(!_0x262451[_0xddd4('0x38')][_0xddd4('0x3e')](_0xddd4('0x75'))){_0x4316b5['limit']=qs[_0xddd4('0x24')](_0x262451['query'][_0xddd4('0x24')]);_0x4316b5['offset']=qs[_0xddd4('0x23')](_0x262451[_0xddd4('0x38')][_0xddd4('0x23')]);}return _0x60354[_0xddd4('0x73')](_0x4316b5);}})['then'](function(_0x3b662e){if(_0x3b662e){return _0x3b662e?{'count':_0x2fda15,'rows':_0x3b662e}:null;}})[_0xddd4('0x29')](respondWithResult(_0x11d6da,null))[_0xddd4('0x52')](handleError(_0x11d6da,null));}; \ No newline at end of file +var _0x31c3=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','UserProfileResource','clone','omit','updatedAt','createdAt','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','end','sendStatus','error','name','send','index','map','Dashboard','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2f24f0,_0x119ae1){var _0x553d71=function(_0x4da78b){while(--_0x4da78b){_0x2f24f0['push'](_0x2f24f0['shift']());}};_0x553d71(++_0x119ae1);}(_0x31c3,0xb6));var _0x331c=function(_0xea217b,_0xdf2b4f){_0xea217b=_0xea217b-0x0;var _0x5b8c40=_0x31c3[_0xea217b];return _0x5b8c40;};'use strict';var pdf=require(_0x331c('0x0'));var emlformat=require(_0x331c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x331c('0x2'));var jsonpatch=require(_0x331c('0x3'));var rp=require(_0x331c('0x4'));var moment=require(_0x331c('0x5'));var BPromise=require(_0x331c('0x6'));var Mustache=require(_0x331c('0x7'));var util=require(_0x331c('0x8'));var path=require(_0x331c('0x9'));var sox=require(_0x331c('0xa'));var csv=require(_0x331c('0xb'));var ejs=require(_0x331c('0xc'));var fs=require('fs');var _=require(_0x331c('0xd'));var squel=require(_0x331c('0xe'));var crypto=require(_0x331c('0xf'));var jsforce=require(_0x331c('0x10'));var deskjs=require(_0x331c('0x11'));var toCsv=require(_0x331c('0xb'));var querystring=require(_0x331c('0x12'));var Papa=require('papaparse');var Redis=require(_0x331c('0x13'));var authService=require(_0x331c('0x14'));var qs=require(_0x331c('0x15'));var as=require(_0x331c('0x16'));var hardwareService=require(_0x331c('0x17'));var logger=require('../../config/logger')(_0x331c('0x18'));var utils=require(_0x331c('0x19'));var config=require(_0x331c('0x1a'));var licenseUtil=require(_0x331c('0x1b'));var db=require(_0x331c('0x1c'))['db'];config[_0x331c('0x1d')]=_[_0x331c('0x1e')](config[_0x331c('0x1d')],{'host':_0x331c('0x1f'),'port':0x18eb});var socket=require(_0x331c('0x20'))(new Redis(config['redis']));require('./dashboard.socket')[_0x331c('0x21')](socket);function respondWithStatusCode(_0x34b3a1,_0x4c25f2){_0x4c25f2=_0x4c25f2||0xcc;return function(_0x5220d9){if(_0x5220d9){return _0x34b3a1['sendStatus'](_0x4c25f2);}return _0x34b3a1[_0x331c('0x22')](_0x4c25f2)['end']();};}function respondWithResult(_0x1a4842,_0x4c6a2b){_0x4c6a2b=_0x4c6a2b||0xc8;return function(_0x117916){if(_0x117916){return _0x1a4842['status'](_0x4c6a2b)[_0x331c('0x23')](_0x117916);}};}function respondWithFilteredResult(_0xc186d4,_0x1b1bed){return function(_0x3dfabb){if(_0x3dfabb){var _0x19e2cb=_0x3dfabb[_0x331c('0x24')],_0x8b8319=_0x1b1bed[_0x331c('0x25')],_0x23c314=_0x1b1bed[_0x331c('0x25')]+_0x1b1bed[_0x331c('0x26')],_0x30a840;if(_0x23c314>=_0x19e2cb){_0x23c314=_0x19e2cb;_0x30a840=0xc8;}else{_0x30a840=0xce;}_0xc186d4['status'](_0x30a840);return _0xc186d4['set'](_0x331c('0x27'),_0x8b8319+'-'+_0x23c314+'/'+_0x19e2cb)[_0x331c('0x23')](_0x3dfabb);}return null;};}function patchUpdates(_0x58e1c3){return function(_0x29296b){try{jsonpatch[_0x331c('0x28')](_0x29296b,_0x58e1c3,!![]);}catch(_0x3dd538){return BPromise[_0x331c('0x29')](_0x3dd538);}return _0x29296b['save']();};}function saveUpdates(_0x2a480f,_0x382241){return function(_0x1f96cf){if(_0x1f96cf){return _0x1f96cf[_0x331c('0x2a')](_0x2a480f)[_0x331c('0x2b')](function(_0x4f13ee){return _0x4f13ee;});}return null;};}function removeEntity(_0x37287f,_0x6288de){return function(_0x4acdea){if(_0x4acdea){return _0x4acdea[_0x331c('0x2c')]()[_0x331c('0x2b')](function(){var _0x177cf8=_0x4acdea[_0x331c('0x2d')]({'plain':!![]});var _0x46003e='CustomDashboards';return db['UserProfileResource'][_0x331c('0x2c')]({'where':{'type':_0x46003e,'resourceId':_0x177cf8['id']}})[_0x331c('0x2b')](function(){return _0x4acdea;});})['then'](function(){_0x37287f[_0x331c('0x22')](0xcc)[_0x331c('0x2e')]();});}};}function handleEntityNotFound(_0x3eae2c,_0x20b0b8){return function(_0x1549e9){if(!_0x1549e9){_0x3eae2c[_0x331c('0x2f')](0x194);}return _0x1549e9;};}function handleError(_0x5ad70f,_0x175d43){_0x175d43=_0x175d43||0x1f4;return function(_0x4154b7){logger[_0x331c('0x30')](_0x4154b7['stack']);if(_0x4154b7[_0x331c('0x31')]){delete _0x4154b7[_0x331c('0x31')];}_0x5ad70f[_0x331c('0x22')](_0x175d43)[_0x331c('0x32')](_0x4154b7);};}exports[_0x331c('0x33')]=function(_0x4686bb,_0x4a36ee){var _0x4830bd={},_0x471758={},_0x522736={'count':0x0,'rows':[]};var _0x11006e=_[_0x331c('0x34')](db[_0x331c('0x35')]['rawAttributes'],function(_0x2701d0){return{'name':_0x2701d0[_0x331c('0x36')],'type':_0x2701d0[_0x331c('0x37')][_0x331c('0x38')]};});_0x471758['model']=_[_0x331c('0x34')](_0x11006e,_0x331c('0x31'));_0x471758[_0x331c('0x39')]=_['keys'](_0x4686bb[_0x331c('0x39')]);_0x471758[_0x331c('0x3a')]=_[_0x331c('0x3b')](_0x471758[_0x331c('0x3c')],_0x471758['query']);_0x4830bd['attributes']=_[_0x331c('0x3b')](_0x471758[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x4686bb[_0x331c('0x39')][_0x331c('0x3d')]));_0x4830bd[_0x331c('0x3e')]=_0x4830bd[_0x331c('0x3e')][_0x331c('0x3f')]?_0x4830bd[_0x331c('0x3e')]:_0x471758[_0x331c('0x3c')];if(!_0x4686bb['query'][_0x331c('0x40')](_0x331c('0x41'))){_0x4830bd[_0x331c('0x26')]=qs['limit'](_0x4686bb[_0x331c('0x39')][_0x331c('0x26')]);_0x4830bd[_0x331c('0x25')]=qs[_0x331c('0x25')](_0x4686bb[_0x331c('0x39')][_0x331c('0x25')]);}_0x4830bd[_0x331c('0x42')]=qs[_0x331c('0x43')](_0x4686bb[_0x331c('0x39')][_0x331c('0x43')]);_0x4830bd[_0x331c('0x44')]=qs[_0x331c('0x3a')](_[_0x331c('0x45')](_0x4686bb[_0x331c('0x39')],_0x471758['filters']),_0x11006e);if(_0x4686bb[_0x331c('0x39')][_0x331c('0x46')]){_0x4830bd['where']=_[_0x331c('0x47')](_0x4830bd[_0x331c('0x44')],{'$or':_[_0x331c('0x34')](_0x11006e,function(_0x118a40){if(_0x118a40[_0x331c('0x37')]!==_0x331c('0x48')){var _0x182a72={};_0x182a72[_0x118a40[_0x331c('0x31')]]={'$like':'%'+_0x4686bb[_0x331c('0x39')]['filter']+'%'};return _0x182a72;}})});}_0x4830bd=_['merge']({},_0x4830bd,_0x4686bb[_0x331c('0x49')]);var _0x401f6c={'where':_0x4830bd[_0x331c('0x44')]};return db[_0x331c('0x35')]['count'](_0x401f6c)[_0x331c('0x2b')](function(_0xfeed19){_0x522736[_0x331c('0x24')]=_0xfeed19;if(_0x4686bb[_0x331c('0x39')][_0x331c('0x4a')]){_0x4830bd[_0x331c('0x4b')]=[{'all':!![]}];}return db[_0x331c('0x35')][_0x331c('0x4c')](_0x4830bd);})[_0x331c('0x2b')](function(_0x2b4e3f){_0x522736[_0x331c('0x4d')]=_0x2b4e3f;return _0x522736;})[_0x331c('0x2b')](respondWithFilteredResult(_0x4a36ee,_0x4830bd))['catch'](handleError(_0x4a36ee,null));};exports[_0x331c('0x4e')]=function(_0x132796,_0x151dfc){var _0x1ca26a={'raw':![],'where':{'id':_0x132796[_0x331c('0x4f')]['id']}},_0x16b979={};_0x16b979[_0x331c('0x3c')]=_[_0x331c('0x50')](db[_0x331c('0x35')][_0x331c('0x51')]);_0x16b979['query']=_[_0x331c('0x50')](_0x132796['query']);_0x16b979[_0x331c('0x3a')]=_['intersection'](_0x16b979[_0x331c('0x3c')],_0x16b979['query']);_0x1ca26a[_0x331c('0x3e')]=_[_0x331c('0x3b')](_0x16b979[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x132796['query'][_0x331c('0x3d')]));_0x1ca26a[_0x331c('0x3e')]=_0x1ca26a[_0x331c('0x3e')][_0x331c('0x3f')]?_0x1ca26a[_0x331c('0x3e')]:_0x16b979[_0x331c('0x3c')];if(_0x132796[_0x331c('0x39')]['includeAll']){_0x1ca26a['include']=[{'all':!![]}];}_0x1ca26a=_['merge']({},_0x1ca26a,_0x132796[_0x331c('0x49')]);return db[_0x331c('0x35')][_0x331c('0x52')](_0x1ca26a)[_0x331c('0x2b')](handleEntityNotFound(_0x151dfc,null))[_0x331c('0x2b')](respondWithResult(_0x151dfc,null))[_0x331c('0x53')](handleError(_0x151dfc,null));};exports['create']=function(_0x323833,_0x224ab3){return db[_0x331c('0x35')][_0x331c('0x54')](_0x323833[_0x331c('0x55')],{})[_0x331c('0x2b')](function(_0x3e1f81){var _0x31674d=_0x323833['user'][_0x331c('0x2d')]({'plain':!![]});if(!_0x31674d)throw new Error(_0x331c('0x56'));if(_0x31674d[_0x331c('0x57')]==='user'){var _0x2e5842=_0x3e1f81[_0x331c('0x2d')]({'plain':!![]});var _0x3ec427=_0x331c('0x58');return db['UserProfileSection'][_0x331c('0x52')]({'where':{'name':_0x3ec427,'userProfileId':_0x31674d[_0x331c('0x59')]},'raw':!![]})['then'](function(_0x1f5e89){if(_0x1f5e89&&_0x1f5e89[_0x331c('0x5a')]===0x0){return db[_0x331c('0x5b')][_0x331c('0x54')]({'name':_0x2e5842[_0x331c('0x31')],'resourceId':_0x2e5842['id'],'type':_0x1f5e89[_0x331c('0x31')],'sectionId':_0x1f5e89['id']},{})['then'](function(){return _0x3e1f81;});}else{return _0x3e1f81;}})[_0x331c('0x53')](function(_0x55fed0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55fed0);throw _0x55fed0;});}return _0x3e1f81;})[_0x331c('0x2b')](respondWithResult(_0x224ab3,0xc9))[_0x331c('0x53')](handleError(_0x224ab3,null));};exports[_0x331c('0x5c')]=function(_0x285eec,_0x1aa3fa){var _0x38ea3f={'where':{'id':_0x285eec[_0x331c('0x4f')]['id']}},_0x472a1b={};_0x472a1b[_0x331c('0x3c')]=_[_0x331c('0x50')](db[_0x331c('0x35')]['rawAttributes']);_0x38ea3f[_0x331c('0x3e')]=_[_0x331c('0x3b')](_0x472a1b[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x285eec['query']['fields']));_0x38ea3f[_0x331c('0x3e')]=_0x38ea3f[_0x331c('0x3e')][_0x331c('0x3f')]?_0x38ea3f[_0x331c('0x3e')]:_0x472a1b[_0x331c('0x3c')];if(_0x285eec['query']['includeAll']){_0x38ea3f['include']=[{'all':!![]}];}_0x38ea3f=_[_0x331c('0x47')]({},_0x38ea3f,_0x285eec['options']);return db[_0x331c('0x35')][_0x331c('0x52')](_0x38ea3f)[_0x331c('0x2b')](handleEntityNotFound(_0x1aa3fa,null))['then'](function(_0x1ac2c5){if(_0x1ac2c5){var _0x27d23c=_0x1ac2c5[_0x331c('0x2d')]({'plain':!![]});_0x27d23c=qs[_0x331c('0x5d')](_0x27d23c,['id','createdAt',_0x331c('0x5e')]);_0x285eec['body']=_[_0x331c('0x5d')](_0x285eec[_0x331c('0x55')],['id',_0x331c('0x5f'),_0x331c('0x5e')]);return db[_0x331c('0x35')][_0x331c('0x54')](_[_0x331c('0x47')](_0x27d23c,_0x285eec[_0x331c('0x55')]),{'include':_0x285eec[_0x331c('0x39')][_0x331c('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x190693){var _0x649094=_0x285eec[_0x331c('0x60')][_0x331c('0x2d')]({'plain':!![]});if(!_0x649094)throw new Error(_0x331c('0x56'));if(_0x649094[_0x331c('0x57')]==='user'){var _0x3522c6=_0x190693['get']({'plain':!![]});var _0x43a300='CustomDashboards';return db[_0x331c('0x61')][_0x331c('0x52')]({'where':{'name':_0x43a300,'userProfileId':_0x649094[_0x331c('0x59')]},'raw':!![]})[_0x331c('0x2b')](function(_0x4ad2c2){if(_0x4ad2c2&&_0x4ad2c2[_0x331c('0x5a')]===0x0){return db[_0x331c('0x5b')][_0x331c('0x54')]({'name':_0x3522c6[_0x331c('0x31')],'resourceId':_0x3522c6['id'],'type':_0x4ad2c2[_0x331c('0x31')],'sectionId':_0x4ad2c2['id']},{})['then'](function(){return _0x190693;});}else{return _0x190693;}})[_0x331c('0x53')](function(_0x4ee58d){logger[_0x331c('0x30')](_0x331c('0x62'),_0x4ee58d);throw _0x4ee58d;});}return _0x190693;});}})[_0x331c('0x2b')](respondWithResult(_0x1aa3fa,0xc9))[_0x331c('0x53')](handleError(_0x1aa3fa,null));};exports[_0x331c('0x2a')]=function(_0x2c9895,_0xc0a130){if(_0x2c9895[_0x331c('0x55')]['id']){delete _0x2c9895['body']['id'];}return db['Dashboard'][_0x331c('0x52')]({'where':{'id':_0x2c9895[_0x331c('0x4f')]['id']}})[_0x331c('0x2b')](handleEntityNotFound(_0xc0a130,null))[_0x331c('0x2b')](saveUpdates(_0x2c9895['body'],null))[_0x331c('0x2b')](respondWithResult(_0xc0a130,null))['catch'](handleError(_0xc0a130,null));};exports[_0x331c('0x2c')]=function(_0x1b47f0,_0x33263c){return db[_0x331c('0x35')][_0x331c('0x52')]({'where':{'id':_0x1b47f0['params']['id']}})['then'](handleEntityNotFound(_0x33263c,null))['then'](removeEntity(_0x33263c,null))[_0x331c('0x53')](handleError(_0x33263c,null));};function widgetAttributes(_0x11db7b){try{switch(_0x11db7b['type']){case _0x331c('0x63'):return[{'name':_0x331c('0x64'),'value':_0x11db7b['attrUrl']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x66')]:undefined)||_0x331c('0x67')}];case'custom':return[{'name':'attrPath','value':_0x11db7b['attrPath']||(_0x11db7b['attrs']&&_0x11db7b['attrs'][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x66')]:undefined)||''}];case _0x331c('0x68'):return[{'name':_0x331c('0x69'),'value':_0x11db7b['attrHourFormat']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x0]?_0x11db7b['attrs'][0x0][_0x331c('0x66')]:undefined)||_0x331c('0x6a')},{'name':_0x331c('0x6b'),'value':_0x11db7b[_0x331c('0x6b')]||(_0x11db7b['attrs']&&_0x11db7b[_0x331c('0x65')][0x1]?_0x11db7b[_0x331c('0x65')][0x1][_0x331c('0x66')]:undefined)||_0x331c('0x6c')},{'name':_0x331c('0x6d'),'value':_0x11db7b[_0x331c('0x6d')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x2]?_0x11db7b[_0x331c('0x65')][0x2][_0x331c('0x66')]:undefined)||0xc}];case'counter':return[{'name':_0x331c('0x6e'),'value':_0x11db7b['attrMetric']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b['attrs'][0x0]['value']:undefined)||_0x331c('0x6f')},{'name':_0x331c('0x70'),'value':_0x11db7b['attrVoiceQueues']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x1]?_0x11db7b['attrs'][0x1][_0x331c('0x66')]:undefined)||[]},{'name':'attrFontSize','value':_0x11db7b['attrFontSize']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x2]?_0x11db7b['attrs'][0x2][_0x331c('0x66')]:undefined)||0x14}];case _0x331c('0x71'):case _0x331c('0x72'):return[{'name':_0x331c('0x73'),'value':_0x11db7b[_0x331c('0x73')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b[_0x331c('0x65')][0x0]['value']:undefined)||_0x331c('0x6f')},{'name':_0x331c('0x74'),'value':_0x11db7b[_0x331c('0x74')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x1]?_0x11db7b['attrs'][0x1]['value']:undefined)||null},{'name':_0x331c('0x75'),'value':_0x11db7b[_0x331c('0x75')]||(_0x11db7b['attrs']&&_0x11db7b[_0x331c('0x65')][0x2]?_0x11db7b[_0x331c('0x65')][0x2]['value']:undefined)||null},{'name':_0x331c('0x70'),'value':_0x11db7b['attrVoiceQueues']||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b['attrs'][0x3]?_0x11db7b[_0x331c('0x65')][0x3][_0x331c('0x66')]:undefined)||[]}];case'web-report':return[{'name':_0x331c('0x76'),'type':_0x11db7b[_0x331c('0x77')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x37')]:undefined)||null,'value':_0x11db7b[_0x331c('0x76')]||(_0x11db7b[_0x331c('0x65')]&&_0x11db7b[_0x331c('0x65')][0x0]?_0x11db7b[_0x331c('0x65')][0x0][_0x331c('0x66')]:undefined)||null},{'name':_0x331c('0x78'),'value':_0x11db7b['attrRefresh']||(_0x11db7b['attrs']&&_0x11db7b[_0x331c('0x65')][0x1]?_0x11db7b[_0x331c('0x65')][0x1][_0x331c('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x374031){logger[_0x331c('0x30')](_0x331c('0x79'),JSON[_0x331c('0x7a')](_0x374031));return[];}}exports['addItem']=function(_0x32bf27,_0x2b956f,_0x370c46){if(_0x32bf27[_0x331c('0x55')]['id']){delete _0x32bf27[_0x331c('0x55')]['id'];}return db[_0x331c('0x35')][_0x331c('0x52')]({'where':{'id':_0x32bf27['params']['id']}})['then'](handleEntityNotFound(_0x2b956f,null))[_0x331c('0x2b')](function(_0x16b274){if(_0x16b274){_0x32bf27[_0x331c('0x55')][_0x331c('0x7b')]=_0x16b274['id'];_0x32bf27[_0x331c('0x55')][_0x331c('0x65')]=widgetAttributes(_0x32bf27['body']);return db[_0x331c('0x7c')]['create'](_0x32bf27[_0x331c('0x55')]);}})['then'](respondWithResult(_0x2b956f,null))[_0x331c('0x53')](handleError(_0x2b956f,null));};exports[_0x331c('0x7d')]=function(_0x181c1d,_0x3cfebd,_0x3deac0){var _0x598c05={};var _0x5b68bb={};var _0x2cb80e;var _0x4c7547;return db[_0x331c('0x35')][_0x331c('0x7e')]({'where':{'id':_0x181c1d[_0x331c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3cfebd,null))['then'](function(_0x1c9a9a){if(_0x1c9a9a){_0x2cb80e=_0x1c9a9a;_0x5b68bb[_0x331c('0x3c')]=_['keys'](db[_0x331c('0x7c')]['rawAttributes']);_0x5b68bb[_0x331c('0x39')]=_[_0x331c('0x50')](_0x181c1d[_0x331c('0x39')]);_0x5b68bb[_0x331c('0x3a')]=_[_0x331c('0x3b')](_0x5b68bb['model'],_0x5b68bb[_0x331c('0x39')]);_0x598c05[_0x331c('0x3e')]=_['intersection'](_0x5b68bb[_0x331c('0x3c')],qs[_0x331c('0x3d')](_0x181c1d['query'][_0x331c('0x3d')]));_0x598c05[_0x331c('0x3e')]=_0x598c05[_0x331c('0x3e')]['length']?_0x598c05['attributes']:_0x5b68bb[_0x331c('0x3c')];_0x598c05[_0x331c('0x42')]=qs[_0x331c('0x43')](_0x181c1d[_0x331c('0x39')][_0x331c('0x43')]);_0x598c05[_0x331c('0x44')]=qs['filters'](_[_0x331c('0x45')](_0x181c1d['query'],_0x5b68bb['filters']));if(_0x181c1d[_0x331c('0x39')]['filter']){_0x598c05[_0x331c('0x44')]=_[_0x331c('0x47')](_0x598c05[_0x331c('0x44')],{'$or':_[_0x331c('0x34')](_0x598c05['attributes'],function(_0x377250){var _0x390ca8={};_0x390ca8[_0x377250]={'$like':'%'+_0x181c1d[_0x331c('0x39')][_0x331c('0x46')]+'%'};return _0x390ca8;})});}_0x598c05=_['merge']({},_0x598c05,_0x181c1d['options']);return _0x2cb80e['getItems'](_0x598c05);}})[_0x331c('0x2b')](function(_0x56494e){if(_0x56494e){_0x4c7547=_0x56494e[_0x331c('0x3f')];if(!_0x181c1d['query']['hasOwnProperty'](_0x331c('0x41'))){_0x598c05[_0x331c('0x26')]=qs[_0x331c('0x26')](_0x181c1d[_0x331c('0x39')][_0x331c('0x26')]);_0x598c05[_0x331c('0x25')]=qs[_0x331c('0x25')](_0x181c1d[_0x331c('0x39')][_0x331c('0x25')]);}return _0x2cb80e[_0x331c('0x7d')](_0x598c05);}})[_0x331c('0x2b')](function(_0x56852c){if(_0x56852c){return _0x56852c?{'count':_0x4c7547,'rows':_0x56852c}:null;}})[_0x331c('0x2b')](respondWithResult(_0x3cfebd,null))[_0x331c('0x53')](handleError(_0x3cfebd,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 206d325..111b774 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 _0xac91=['hasOwnProperty','hook','Dashboard','save','update','remove','emit'];(function(_0x4d2b3f,_0x408d7e){var _0x47bef1=function(_0x42dc60){while(--_0x42dc60){_0x4d2b3f['push'](_0x4d2b3f['shift']());}};_0x47bef1(++_0x408d7e);}(_0xac91,0x14b));var _0x1ac9=function(_0x1e1e6c,_0x1100fd){_0x1e1e6c=_0x1e1e6c-0x0;var _0x3197d0=_0xac91[_0x1e1e6c];return _0x3197d0;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x1ac9('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ac9('0x1'),'afterUpdate':_0x1ac9('0x2'),'afterDestroy':_0x1ac9('0x3')};function emitEvent(_0x2aace4){return function(_0x2e6c84,_0x52b390,_0x543f9c){DashboardEvents[_0x1ac9('0x4')](_0x2aace4+':'+_0x2e6c84['id'],_0x2e6c84);DashboardEvents[_0x1ac9('0x4')](_0x2aace4,_0x2e6c84);_0x543f9c(null);};}for(var e in events){if(events[_0x1ac9('0x5')](e)){var event=events[e];Dashboard[_0x1ac9('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x7218=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x8edf84,_0x416b35){var _0x2fc32c=function(_0x4b62dc){while(--_0x4b62dc){_0x8edf84['push'](_0x8edf84['shift']());}};_0x2fc32c(++_0x416b35);}(_0x7218,0x14f));var _0x8721=function(_0x555201,_0x4e7d9e){_0x555201=_0x555201-0x0;var _0x359681=_0x7218[_0x555201];return _0x359681;};'use strict';var EventEmitter=require(_0x8721('0x0'));var Dashboard=require(_0x8721('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8721('0x2')](0x0);var events={'afterCreate':_0x8721('0x3'),'afterUpdate':_0x8721('0x4'),'afterDestroy':_0x8721('0x5')};function emitEvent(_0x37dd05){return function(_0x361c4d,_0x278fc6,_0x5b82a0){DashboardEvents['emit'](_0x37dd05+':'+_0x361c4d['id'],_0x361c4d);DashboardEvents[_0x8721('0x6')](_0x37dd05,_0x361c4d);_0x5b82a0(null);};}for(var e in events){if(events[_0x8721('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x8721('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 43775e0..1b9e577 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 _0xfc38=['exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x48503b,_0x34e3bb){var _0x3146b7=function(_0xecfd00){while(--_0xecfd00){_0x48503b['push'](_0x48503b['shift']());}};_0x3146b7(++_0x34e3bb);}(_0xfc38,0x1f3));var _0x8fc3=function(_0x4bdb48,_0x2c0e55){_0x4bdb48=_0x4bdb48-0x0;var _0x513199=_0xfc38[_0x4bdb48];return _0x513199;};'use strict';var _=require(_0x8fc3('0x0'));var util=require(_0x8fc3('0x1'));var logger=require(_0x8fc3('0x2'))(_0x8fc3('0x3'));var moment=require(_0x8fc3('0x4'));var BPromise=require(_0x8fc3('0x5'));var rp=require(_0x8fc3('0x6'));var fs=require('fs');var path=require(_0x8fc3('0x7'));var rimraf=require(_0x8fc3('0x8'));var config=require(_0x8fc3('0x9'));var attributes=require(_0x8fc3('0xa'));module[_0x8fc3('0xb')]=function(_0x29ebab,_0x3bc1ae){return _0x29ebab[_0x8fc3('0xc')](_0x8fc3('0xd'),attributes,{'tableName':_0x8fc3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2304=['exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x4f3409,_0x47f818){var _0x39383c=function(_0x3fdf6b){while(--_0x3fdf6b){_0x4f3409['push'](_0x4f3409['shift']());}};_0x39383c(++_0x47f818);}(_0x2304,0xe1));var _0x4230=function(_0x2523ca,_0xd01aec){_0x2523ca=_0x2523ca-0x0;var _0x478dd7=_0x2304[_0x2523ca];return _0x478dd7;};'use strict';var _=require(_0x4230('0x0'));var util=require(_0x4230('0x1'));var logger=require(_0x4230('0x2'))(_0x4230('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4230('0x4'));var fs=require('fs');var path=require(_0x4230('0x5'));var rimraf=require(_0x4230('0x6'));var config=require(_0x4230('0x7'));var attributes=require(_0x4230('0x8'));module[_0x4230('0x9')]=function(_0x517636,_0x50bba2){return _0x517636[_0x4230('0xa')](_0x4230('0xb'),attributes,{'tableName':_0x4230('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index bb5a07c..346d35c 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 _0x9669=['defaults','localhost','socket.io-emitter','./dashboard.socket','request','request\x20sent','debug','stringify','error','message','Dashboard,\x20%s,\x20%s','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis'];(function(_0x27b237,_0x3cce1f){var _0x316b41=function(_0x1487ac){while(--_0x1487ac){_0x27b237['push'](_0x27b237['shift']());}};_0x316b41(++_0x3cce1f);}(_0x9669,0x6e));var _0x9966=function(_0x498f6b,_0x18bfd4){_0x498f6b=_0x498f6b-0x0;var _0x4f2d35=_0x9669[_0x498f6b];return _0x4f2d35;};'use strict';var _=require('lodash');var util=require(_0x9966('0x0'));var moment=require('moment');var BPromise=require(_0x9966('0x1'));var rs=require(_0x9966('0x2'));var fs=require('fs');var Redis=require(_0x9966('0x3'));var db=require(_0x9966('0x4'))['db'];var utils=require(_0x9966('0x5'));var logger=require('../../config/logger')(_0x9966('0x6'));var config=require(_0x9966('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9966('0x8')]['http']({'port':0x232a});config[_0x9966('0x9')]=_[_0x9966('0xa')](config[_0x9966('0x9')],{'host':_0x9966('0xb'),'port':0x18eb});var socket=require(_0x9966('0xc'))(new Redis(config['redis']));require(_0x9966('0xd'))['register'](socket);function respondWithRpcPromise(_0x499d0f,_0xec316d,_0x3cf2c7){return new BPromise(function(_0x306dc7,_0x4b126b){return client[_0x9966('0xe')](_0x499d0f,_0x3cf2c7)['then'](function(_0x5a21a9){logger['info']('Dashboard,\x20%s,\x20%s',_0xec316d,_0x9966('0xf'));logger[_0x9966('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xec316d,_0x9966('0xf'),JSON[_0x9966('0x11')](_0x5a21a9));if(_0x5a21a9[_0x9966('0x12')]){if(_0x5a21a9[_0x9966('0x12')]['code']===0x1f4){logger[_0x9966('0x12')]('Dashboard,\x20%s,\x20%s',_0xec316d,_0x5a21a9[_0x9966('0x12')][_0x9966('0x13')]);return _0x4b126b(_0x5a21a9[_0x9966('0x12')][_0x9966('0x13')]);}logger[_0x9966('0x12')](_0x9966('0x14'),_0xec316d,_0x5a21a9[_0x9966('0x12')][_0x9966('0x13')]);return _0x306dc7(_0x5a21a9['error'][_0x9966('0x13')]);}else{logger[_0x9966('0x15')](_0x9966('0x14'),_0xec316d,_0x9966('0xf'));_0x306dc7(_0x5a21a9[_0x9966('0x16')]['message']);}})[_0x9966('0x17')](function(_0x5c7217){logger[_0x9966('0x12')](_0x9966('0x14'),_0xec316d,_0x5c7217);_0x4b126b(_0x5c7217);});});} \ No newline at end of file +var _0x345e=['http','redis','localhost','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x345e,0x12e));var _0xe345=function(_0x2e92c2,_0x381855){_0x2e92c2=_0x2e92c2-0x0;var _0x37105f=_0x345e[_0x2e92c2];return _0x37105f;};'use strict';var _=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var moment=require(_0xe345('0x2'));var BPromise=require(_0xe345('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe345('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe345('0x5'))(_0xe345('0x6'));var config=require(_0xe345('0x7'));var jayson=require(_0xe345('0x8'));var client=jayson[_0xe345('0x9')][_0xe345('0xa')]({'port':0x232a});config[_0xe345('0xb')]=_['defaults'](config['redis'],{'host':_0xe345('0xc'),'port':0x18eb});var socket=require(_0xe345('0xd'))(new Redis(config[_0xe345('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x24f463,_0x12ef58,_0x5b2526){return new BPromise(function(_0x438411,_0x4a59ee){return client[_0xe345('0xe')](_0x24f463,_0x5b2526)[_0xe345('0xf')](function(_0x2e0fc5){logger[_0xe345('0x10')](_0xe345('0x11'),_0x12ef58,_0xe345('0x12'));logger[_0xe345('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x12ef58,_0xe345('0x12'),JSON[_0xe345('0x14')](_0x2e0fc5));if(_0x2e0fc5['error']){if(_0x2e0fc5[_0xe345('0x15')][_0xe345('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x12ef58,_0x2e0fc5[_0xe345('0x15')]['message']);return _0x4a59ee(_0x2e0fc5[_0xe345('0x15')]['message']);}logger[_0xe345('0x15')](_0xe345('0x11'),_0x12ef58,_0x2e0fc5[_0xe345('0x15')][_0xe345('0x17')]);return _0x438411(_0x2e0fc5[_0xe345('0x15')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x12ef58,_0xe345('0x12'));_0x438411(_0x2e0fc5[_0xe345('0x18')][_0xe345('0x17')]);}})[_0xe345('0x19')](function(_0x3485b0){logger['error'](_0xe345('0x11'),_0x12ef58,_0x3485b0);_0x4a59ee(_0x3485b0);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index acb34b3..63e674e 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 _0x01e9=['./dashboard.events','save','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01e9,0x1e5));var _0x901e=function(_0x33396c,_0x3f6dbb){_0x33396c=_0x33396c-0x0;var _0x24c2e7=_0x01e9[_0x33396c];return _0x24c2e7;};'use strict';var DashboardEvents=require(_0x901e('0x0'));var events=[_0x901e('0x1'),'remove','update'];function createListener(_0xb97d7a,_0x97b758){return function(_0x2a657c){_0x97b758[_0x901e('0x2')](_0xb97d7a,_0x2a657c);};}function removeListener(_0x960b8f,_0x150dcd){return function(){DashboardEvents['removeListener'](_0x960b8f,_0x150dcd);};}exports[_0x901e('0x3')]=function(_0x4d7b92){for(var _0x5391ce=0x0,_0x2d9ac5=events[_0x901e('0x4')];_0x5391ce<_0x2d9ac5;_0x5391ce++){var _0x520aaf=events[_0x5391ce];var _0x100713=createListener('dashboard:'+_0x520aaf,_0x4d7b92);DashboardEvents['on'](_0x520aaf,_0x100713);}}; \ No newline at end of file +var _0x0d69=['emit','removeListener','length','dashboard:','./dashboard.events','update'];(function(_0x37d8ae,_0x17e484){var _0x4de500=function(_0x538a36){while(--_0x538a36){_0x37d8ae['push'](_0x37d8ae['shift']());}};_0x4de500(++_0x17e484);}(_0x0d69,0x1c6));var _0x90d6=function(_0x1d2ec9,_0x4228ee){_0x1d2ec9=_0x1d2ec9-0x0;var _0x38345d=_0x0d69[_0x1d2ec9];return _0x38345d;};'use strict';var DashboardEvents=require(_0x90d6('0x0'));var events=['save','remove',_0x90d6('0x1')];function createListener(_0x3ef486,_0x48a1fe){return function(_0x29ec0c){_0x48a1fe[_0x90d6('0x2')](_0x3ef486,_0x29ec0c);};}function removeListener(_0x5aadff,_0x390a23){return function(){DashboardEvents[_0x90d6('0x3')](_0x5aadff,_0x390a23);};}exports['register']=function(_0x4d22cf){for(var _0x1c6409=0x0,_0x297d4d=events[_0x90d6('0x4')];_0x1c6409<_0x297d4d;_0x1c6409++){var _0x3c5dea=events[_0x1c6409];var _0x4e27c5=createListener(_0x90d6('0x5')+_0x3c5dea,_0x4d22cf);DashboardEvents['on'](_0x3c5dea,_0x4e27c5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 69b9085..b382e71 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x49f0b8,_0x2b6744){var _0x9d9709=function(_0x4a7bbf){while(--_0x4a7bbf){_0x49f0b8['push'](_0x49f0b8['shift']());}};_0x9d9709(++_0x2b6744);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb7e7[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0df4e04..cd0927c 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 _0x2d32=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify'];(function(_0x4cfa0e,_0x56774a){var _0x5be705=function(_0x580156){while(--_0x580156){_0x4cfa0e['push'](_0x4cfa0e['shift']());}};_0x5be705(++_0x56774a);}(_0x2d32,0xd5));var _0x22d3=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x2d32[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0x22d3('0x0'));var squel=require(_0x22d3('0x1'));var _=require(_0x22d3('0x2'));module[_0x22d3('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x22d3('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22d3('0x5')](_0x22d3('0x6')),'get':function(){try{return JSON[_0x22d3('0x7')](this['getDataValue'](_0x22d3('0x8')));}catch(_0x59e7e8){return[];}},'set':function(_0x216bb2){try{this[_0x22d3('0x9')](_0x22d3('0x8'),JSON[_0x22d3('0xa')](_0x216bb2));}catch(_0x32e042){this[_0x22d3('0x9')](_0x22d3('0x8'),JSON[_0x22d3('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x22d3('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22d3('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22d3('0xb')]},'col':{'type':Sequelize[_0x22d3('0xb')]},'background':{'type':Sequelize[_0x22d3('0x4')],'allowNull':![],'defaultValue':_0x22d3('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x22d3('0x4')],'allowNull':![],'defaultValue':_0x22d3('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e12=['#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x22773a,_0x585053){var _0x210bf0=function(_0x32e91b){while(--_0x32e91b){_0x22773a['push'](_0x22773a['shift']());}};_0x210bf0(++_0x585053);}(_0x6e12,0x10b));var _0x26e1=function(_0x5442a,_0x58be09){_0x5442a=_0x5442a-0x0;var _0x10b231=_0x6e12[_0x5442a];return _0x10b231;};'use strict';var Sequelize=require(_0x26e1('0x0'));var squel=require(_0x26e1('0x1'));var _=require(_0x26e1('0x2'));module[_0x26e1('0x3')]={'title':{'type':Sequelize[_0x26e1('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x26e1('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x26e1('0x5')]('long'),'get':function(){try{return JSON[_0x26e1('0x6')](this[_0x26e1('0x7')](_0x26e1('0x8')));}catch(_0x3848a6){return[];}},'set':function(_0x1e97f1){try{this['setDataValue'](_0x26e1('0x8'),JSON[_0x26e1('0x9')](_0x1e97f1));}catch(_0x4e7558){this[_0x26e1('0xa')](_0x26e1('0x8'),JSON[_0x26e1('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x26e1('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x26e1('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x26e1('0xb')]},'col':{'type':Sequelize[_0x26e1('0xb')]},'background':{'type':Sequelize[_0x26e1('0x4')],'allowNull':![],'defaultValue':_0x26e1('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x26e1('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 938b68d..735818e 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 _0x5e58=['sendStatus','end','status','count','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x3f10c5,_0x18607c){var _0x98dfa3=function(_0x343904){while(--_0x343904){_0x3f10c5['push'](_0x3f10c5['shift']());}};_0x98dfa3(++_0x18607c);}(_0x5e58,0xf4));var _0x85e5=function(_0x37d718,_0x4b5779){_0x37d718=_0x37d718-0x0;var _0x1b650a=_0x5e58[_0x37d718];return _0x1b650a;};'use strict';var pdf=require(_0x85e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x85e5('0x1'));var zipdir=require(_0x85e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85e5('0x3'));var moment=require(_0x85e5('0x4'));var BPromise=require(_0x85e5('0x5'));var Mustache=require(_0x85e5('0x6'));var util=require(_0x85e5('0x7'));var path=require(_0x85e5('0x8'));var sox=require(_0x85e5('0x9'));var csv=require(_0x85e5('0xa'));var ejs=require(_0x85e5('0xb'));var fs=require('fs');var _=require(_0x85e5('0xc'));var squel=require(_0x85e5('0xd'));var crypto=require(_0x85e5('0xe'));var jsforce=require(_0x85e5('0xf'));var deskjs=require(_0x85e5('0x10'));var toCsv=require(_0x85e5('0xa'));var querystring=require(_0x85e5('0x11'));var Papa=require(_0x85e5('0x12'));var Redis=require('ioredis');var authService=require(_0x85e5('0x13'));var qs=require(_0x85e5('0x14'));var as=require(_0x85e5('0x15'));var hardwareService=require(_0x85e5('0x16'));var logger=require('../../config/logger')(_0x85e5('0x17'));var utils=require(_0x85e5('0x18'));var config=require(_0x85e5('0x19'));var licenseUtil=require(_0x85e5('0x1a'));var db=require(_0x85e5('0x1b'))['db'];config[_0x85e5('0x1c')]=_[_0x85e5('0x1d')](config[_0x85e5('0x1c')],{'host':_0x85e5('0x1e'),'port':0x18eb});var socket=require(_0x85e5('0x1f'))(new Redis(config[_0x85e5('0x1c')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x539d51,_0x44b6ac){_0x44b6ac=_0x44b6ac||0xcc;return function(_0x62ac25){if(_0x62ac25){return _0x539d51[_0x85e5('0x20')](_0x44b6ac);}return _0x539d51['status'](_0x44b6ac)[_0x85e5('0x21')]();};}function respondWithResult(_0x19cac0,_0x251e70){_0x251e70=_0x251e70||0xc8;return function(_0x2e3d23){if(_0x2e3d23){return _0x19cac0[_0x85e5('0x22')](_0x251e70)['json'](_0x2e3d23);}};}function respondWithFilteredResult(_0x16d9fd,_0x1bc9d7){return function(_0xa0e7a6){if(_0xa0e7a6){var _0x1b39c9=_0xa0e7a6[_0x85e5('0x23')],_0x4e4d98=_0x1bc9d7[_0x85e5('0x24')],_0x2b650b=_0x1bc9d7[_0x85e5('0x24')]+_0x1bc9d7[_0x85e5('0x25')],_0x3cb350;if(_0x2b650b>=_0x1b39c9){_0x2b650b=_0x1b39c9;_0x3cb350=0xc8;}else{_0x3cb350=0xce;}_0x16d9fd[_0x85e5('0x22')](_0x3cb350);return _0x16d9fd['set']('Content-Range',_0x4e4d98+'-'+_0x2b650b+'/'+_0x1b39c9)[_0x85e5('0x26')](_0xa0e7a6);}return null;};}function patchUpdates(_0x5d4337){return function(_0x9a92f1){try{jsonpatch[_0x85e5('0x27')](_0x9a92f1,_0x5d4337,!![]);}catch(_0xce399){return BPromise[_0x85e5('0x28')](_0xce399);}return _0x9a92f1[_0x85e5('0x29')]();};}function saveUpdates(_0x4e5a5a,_0x5247de){return function(_0x2f9fd3){if(_0x2f9fd3){return _0x2f9fd3[_0x85e5('0x2a')](_0x4e5a5a)[_0x85e5('0x2b')](function(_0x2af583){return _0x2af583;});}return null;};}function removeEntity(_0x5dfa61,_0x3709f6){return function(_0x45e76b){if(_0x45e76b){return _0x45e76b[_0x85e5('0x2c')]()[_0x85e5('0x2b')](function(){_0x5dfa61[_0x85e5('0x22')](0xcc)[_0x85e5('0x21')]();});}};}function handleEntityNotFound(_0x56a6b5,_0x5d7a82){return function(_0x351cb6){if(!_0x351cb6){_0x56a6b5[_0x85e5('0x20')](0x194);}return _0x351cb6;};}function handleError(_0x4ffd51,_0x5deadd){_0x5deadd=_0x5deadd||0x1f4;return function(_0x27e5a1){logger[_0x85e5('0x2d')](_0x27e5a1[_0x85e5('0x2e')]);if(_0x27e5a1[_0x85e5('0x2f')]){delete _0x27e5a1[_0x85e5('0x2f')];}_0x4ffd51['status'](_0x5deadd)['send'](_0x27e5a1);};}exports[_0x85e5('0x30')]=function(_0x20d660,_0x3237cb){var _0x383daf={'raw':![],'where':{'id':_0x20d660[_0x85e5('0x31')]['id']}},_0x342ce9={};_0x342ce9[_0x85e5('0x32')]=_[_0x85e5('0x33')](db[_0x85e5('0x34')][_0x85e5('0x35')]);_0x342ce9['query']=_[_0x85e5('0x33')](_0x20d660[_0x85e5('0x36')]);_0x342ce9[_0x85e5('0x37')]=_[_0x85e5('0x38')](_0x342ce9['model'],_0x342ce9[_0x85e5('0x36')]);_0x383daf[_0x85e5('0x39')]=_[_0x85e5('0x38')](_0x342ce9[_0x85e5('0x32')],qs[_0x85e5('0x3a')](_0x20d660[_0x85e5('0x36')]['fields']));_0x383daf[_0x85e5('0x39')]=_0x383daf[_0x85e5('0x39')][_0x85e5('0x3b')]?_0x383daf['attributes']:_0x342ce9[_0x85e5('0x32')];if(_0x20d660[_0x85e5('0x36')]['includeAll']){_0x383daf[_0x85e5('0x3c')]=[{'all':!![]}];}_0x383daf=_[_0x85e5('0x3d')]({},_0x383daf,_0x20d660[_0x85e5('0x3e')]);return db[_0x85e5('0x34')]['find'](_0x383daf)[_0x85e5('0x2b')](handleEntityNotFound(_0x3237cb,null))[_0x85e5('0x2b')](respondWithResult(_0x3237cb,null))['catch'](handleError(_0x3237cb,null));};exports['destroy']=function(_0x1ec461,_0x337087){return db[_0x85e5('0x34')][_0x85e5('0x3f')]({'where':{'id':_0x1ec461[_0x85e5('0x31')]['id']}})[_0x85e5('0x2b')](handleEntityNotFound(_0x337087,null))[_0x85e5('0x2b')](removeEntity(_0x337087,null))[_0x85e5('0x40')](handleError(_0x337087,null));};function widgetAttributes(_0x303dd9){try{switch(_0x303dd9['type']){case'iframe':return[{'name':_0x85e5('0x41'),'value':_0x303dd9[_0x85e5('0x41')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||_0x85e5('0x44')}];case _0x85e5('0x45'):return[{'name':_0x85e5('0x46'),'value':_0x303dd9[_0x85e5('0x46')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0]['value']:undefined)||''}];case _0x85e5('0x47'):return[{'name':'attrHourFormat','value':_0x303dd9[_0x85e5('0x48')]||(_0x303dd9['attrs']&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||_0x85e5('0x49')},{'name':'attrTimezone','value':_0x303dd9[_0x85e5('0x4a')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x1]?_0x303dd9['attrs'][0x1]['value']:undefined)||_0x85e5('0x4b')},{'name':_0x85e5('0x4c'),'value':_0x303dd9[_0x85e5('0x4c')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x2]?_0x303dd9[_0x85e5('0x42')][0x2][_0x85e5('0x43')]:undefined)||0xc}];case _0x85e5('0x4d'):return[{'name':'attrMetric','value':_0x303dd9[_0x85e5('0x4e')]||(_0x303dd9['attrs']&&_0x303dd9['attrs'][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||_0x85e5('0x4f')},{'name':_0x85e5('0x50'),'value':_0x303dd9[_0x85e5('0x50')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9['attrs'][0x1]?_0x303dd9[_0x85e5('0x42')][0x1][_0x85e5('0x43')]:undefined)||[]},{'name':_0x85e5('0x4c'),'value':_0x303dd9[_0x85e5('0x4c')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x2]?_0x303dd9[_0x85e5('0x42')][0x2][_0x85e5('0x43')]:undefined)||0x14}];case'multibar-chart':case _0x85e5('0x51'):return[{'name':_0x85e5('0x52'),'value':_0x303dd9[_0x85e5('0x52')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||'total'},{'name':_0x85e5('0x53'),'value':_0x303dd9[_0x85e5('0x53')]||(_0x303dd9['attrs']&&_0x303dd9[_0x85e5('0x42')][0x1]?_0x303dd9['attrs'][0x1]['value']:undefined)||null},{'name':_0x85e5('0x54'),'value':_0x303dd9[_0x85e5('0x54')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x2]?_0x303dd9[_0x85e5('0x42')][0x2][_0x85e5('0x43')]:undefined)||null},{'name':_0x85e5('0x50'),'value':_0x303dd9['attrVoiceQueues']||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x3]?_0x303dd9[_0x85e5('0x42')][0x3][_0x85e5('0x43')]:undefined)||[]}];case'web-report':return[{'name':_0x85e5('0x55'),'type':_0x303dd9['reportType']||(_0x303dd9['attrs']&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x56')]:undefined)||null,'value':_0x303dd9['attrReport']||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||null},{'name':_0x85e5('0x57'),'value':_0x303dd9[_0x85e5('0x57')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x1]?_0x303dd9[_0x85e5('0x42')][0x1][_0x85e5('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x4ec70c){logger[_0x85e5('0x2d')](_0x85e5('0x58'),JSON[_0x85e5('0x59')](_0x4ec70c));return[];}}exports['create']=function(_0x423dcf,_0x3ca59a){if(_0x423dcf['body']){_0x423dcf['body'][_0x85e5('0x42')]=widgetAttributes(_0x423dcf[_0x85e5('0x5a')]);}return db[_0x85e5('0x34')][_0x85e5('0x5b')](_0x423dcf[_0x85e5('0x5a')],{})[_0x85e5('0x2b')](respondWithResult(_0x3ca59a,0xc9))[_0x85e5('0x40')](handleError(_0x3ca59a,null));};exports[_0x85e5('0x2a')]=function(_0x23180b,_0x2401be){if(_0x23180b['body']['id']){delete _0x23180b[_0x85e5('0x5a')]['id'];}_0x23180b[_0x85e5('0x5a')][_0x85e5('0x42')]=widgetAttributes(_0x23180b[_0x85e5('0x5a')]);return db[_0x85e5('0x34')][_0x85e5('0x3f')]({'where':{'id':_0x23180b[_0x85e5('0x31')]['id']}})[_0x85e5('0x2b')](handleEntityNotFound(_0x2401be,null))['then'](saveUpdates(_0x23180b[_0x85e5('0x5a')],null))[_0x85e5('0x2b')](respondWithResult(_0x2401be,null))[_0x85e5('0x40')](handleError(_0x2401be,null));}; \ No newline at end of file +var _0x29f8=['./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','params','DashboardItem','query','keys','filters','intersection','model','fields','attributes','length','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x29f8,0x140));var _0x829f=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x29f8[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x829f('0x0'));var emlformat=require(_0x829f('0x1'));var rimraf=require(_0x829f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x829f('0x3'));var BPromise=require(_0x829f('0x4'));var Mustache=require(_0x829f('0x5'));var util=require(_0x829f('0x6'));var path=require('path');var sox=require(_0x829f('0x7'));var csv=require(_0x829f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x829f('0x9'));var crypto=require(_0x829f('0xa'));var jsforce=require(_0x829f('0xb'));var deskjs=require(_0x829f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x829f('0xd'));var Papa=require('papaparse');var Redis=require(_0x829f('0xe'));var authService=require(_0x829f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x829f('0x10'))(_0x829f('0x11'));var utils=require('../../config/utils');var config=require(_0x829f('0x12'));var licenseUtil=require(_0x829f('0x13'));var db=require('../../mysqldb')['db'];config[_0x829f('0x14')]=_[_0x829f('0x15')](config[_0x829f('0x14')],{'host':_0x829f('0x16'),'port':0x18eb});var socket=require(_0x829f('0x17'))(new Redis(config[_0x829f('0x14')]));require(_0x829f('0x18'))[_0x829f('0x19')](socket);function respondWithStatusCode(_0x2509d8,_0x58cb57){_0x58cb57=_0x58cb57||0xcc;return function(_0x3a910c){if(_0x3a910c){return _0x2509d8[_0x829f('0x1a')](_0x58cb57);}return _0x2509d8[_0x829f('0x1b')](_0x58cb57)[_0x829f('0x1c')]();};}function respondWithResult(_0xe84373,_0x3f39e0){_0x3f39e0=_0x3f39e0||0xc8;return function(_0x3f3ab5){if(_0x3f3ab5){return _0xe84373[_0x829f('0x1b')](_0x3f39e0)[_0x829f('0x1d')](_0x3f3ab5);}};}function respondWithFilteredResult(_0x26385e,_0x2d1caa){return function(_0xa26225){if(_0xa26225){var _0x477ca1=_0xa26225['count'],_0x396aa4=_0x2d1caa['offset'],_0x2f3486=_0x2d1caa[_0x829f('0x1e')]+_0x2d1caa[_0x829f('0x1f')],_0x5e2710;if(_0x2f3486>=_0x477ca1){_0x2f3486=_0x477ca1;_0x5e2710=0xc8;}else{_0x5e2710=0xce;}_0x26385e['status'](_0x5e2710);return _0x26385e[_0x829f('0x20')](_0x829f('0x21'),_0x396aa4+'-'+_0x2f3486+'/'+_0x477ca1)[_0x829f('0x1d')](_0xa26225);}return null;};}function patchUpdates(_0x26b430){return function(_0x48dd96){try{jsonpatch[_0x829f('0x22')](_0x48dd96,_0x26b430,!![]);}catch(_0x217786){return BPromise[_0x829f('0x23')](_0x217786);}return _0x48dd96[_0x829f('0x24')]();};}function saveUpdates(_0x17d4d0,_0xd429a0){return function(_0x2eb913){if(_0x2eb913){return _0x2eb913[_0x829f('0x25')](_0x17d4d0)[_0x829f('0x26')](function(_0x5cb36a){return _0x5cb36a;});}return null;};}function removeEntity(_0x134c71,_0x3310b3){return function(_0x11d976){if(_0x11d976){return _0x11d976[_0x829f('0x27')]()[_0x829f('0x26')](function(){_0x134c71[_0x829f('0x1b')](0xcc)[_0x829f('0x1c')]();});}};}function handleEntityNotFound(_0x107b0c,_0x30d79f){return function(_0x4a1995){if(!_0x4a1995){_0x107b0c[_0x829f('0x1a')](0x194);}return _0x4a1995;};}function handleError(_0xee9e41,_0x584b48){_0x584b48=_0x584b48||0x1f4;return function(_0x3dc39c){logger[_0x829f('0x28')](_0x3dc39c['stack']);if(_0x3dc39c[_0x829f('0x29')]){delete _0x3dc39c[_0x829f('0x29')];}_0xee9e41['status'](_0x584b48)[_0x829f('0x2a')](_0x3dc39c);};}exports[_0x829f('0x2b')]=function(_0x224241,_0x54bf45){var _0x510342={'raw':![],'where':{'id':_0x224241[_0x829f('0x2c')]['id']}},_0x5b032a={};_0x5b032a['model']=_['keys'](db[_0x829f('0x2d')]['rawAttributes']);_0x5b032a[_0x829f('0x2e')]=_[_0x829f('0x2f')](_0x224241['query']);_0x5b032a[_0x829f('0x30')]=_[_0x829f('0x31')](_0x5b032a[_0x829f('0x32')],_0x5b032a['query']);_0x510342['attributes']=_[_0x829f('0x31')](_0x5b032a[_0x829f('0x32')],qs[_0x829f('0x33')](_0x224241['query']['fields']));_0x510342['attributes']=_0x510342[_0x829f('0x34')][_0x829f('0x35')]?_0x510342[_0x829f('0x34')]:_0x5b032a[_0x829f('0x32')];if(_0x224241[_0x829f('0x2e')]['includeAll']){_0x510342[_0x829f('0x36')]=[{'all':!![]}];}_0x510342=_[_0x829f('0x37')]({},_0x510342,_0x224241[_0x829f('0x38')]);return db['DashboardItem']['find'](_0x510342)['then'](handleEntityNotFound(_0x54bf45,null))[_0x829f('0x26')](respondWithResult(_0x54bf45,null))[_0x829f('0x39')](handleError(_0x54bf45,null));};exports['destroy']=function(_0x44fc84,_0x3c3b5a){return db['DashboardItem'][_0x829f('0x3a')]({'where':{'id':_0x44fc84[_0x829f('0x2c')]['id']}})[_0x829f('0x26')](handleEntityNotFound(_0x3c3b5a,null))[_0x829f('0x26')](removeEntity(_0x3c3b5a,null))['catch'](handleError(_0x3c3b5a,null));};function widgetAttributes(_0x5a2298){try{switch(_0x5a2298[_0x829f('0x3b')]){case _0x829f('0x3c'):return[{'name':_0x829f('0x3d'),'value':_0x5a2298[_0x829f('0x3d')]||(_0x5a2298['attrs']&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298['attrs'][0x0][_0x829f('0x3f')]:undefined)||'https://'}];case _0x829f('0x40'):return[{'name':_0x829f('0x41'),'value':_0x5a2298[_0x829f('0x41')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3f')]:undefined)||''}];case _0x829f('0x42'):return[{'name':_0x829f('0x43'),'value':_0x5a2298['attrHourFormat']||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298['attrs'][0x0]['value']:undefined)||_0x829f('0x44')},{'name':_0x829f('0x45'),'value':_0x5a2298['attrTimezone']||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x1]?_0x5a2298['attrs'][0x1][_0x829f('0x3f')]:undefined)||_0x829f('0x46')},{'name':_0x829f('0x47'),'value':_0x5a2298['attrFontSize']||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x2]?_0x5a2298[_0x829f('0x3e')][0x2][_0x829f('0x3f')]:undefined)||0xc}];case'counter':return[{'name':_0x829f('0x48'),'value':_0x5a2298[_0x829f('0x48')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3f')]:undefined)||_0x829f('0x49')},{'name':_0x829f('0x4a'),'value':_0x5a2298['attrVoiceQueues']||(_0x5a2298['attrs']&&_0x5a2298[_0x829f('0x3e')][0x1]?_0x5a2298['attrs'][0x1][_0x829f('0x3f')]:undefined)||[]},{'name':_0x829f('0x47'),'value':_0x5a2298[_0x829f('0x47')]||(_0x5a2298['attrs']&&_0x5a2298['attrs'][0x2]?_0x5a2298[_0x829f('0x3e')][0x2][_0x829f('0x3f')]:undefined)||0x14}];case _0x829f('0x4b'):case _0x829f('0x4c'):return[{'name':_0x829f('0x4d'),'value':_0x5a2298[_0x829f('0x4d')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3f')]:undefined)||_0x829f('0x49')},{'name':_0x829f('0x4e'),'value':_0x5a2298[_0x829f('0x4e')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x1]?_0x5a2298[_0x829f('0x3e')][0x1][_0x829f('0x3f')]:undefined)||null},{'name':_0x829f('0x4f'),'value':_0x5a2298[_0x829f('0x4f')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x2]?_0x5a2298[_0x829f('0x3e')][0x2][_0x829f('0x3f')]:undefined)||null},{'name':_0x829f('0x4a'),'value':_0x5a2298[_0x829f('0x4a')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x3]?_0x5a2298[_0x829f('0x3e')][0x3][_0x829f('0x3f')]:undefined)||[]}];case'web-report':return[{'name':_0x829f('0x50'),'type':_0x5a2298[_0x829f('0x51')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298['attrs'][0x0]?_0x5a2298[_0x829f('0x3e')][0x0][_0x829f('0x3b')]:undefined)||null,'value':_0x5a2298[_0x829f('0x50')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x0]?_0x5a2298[_0x829f('0x3e')][0x0]['value']:undefined)||null},{'name':_0x829f('0x52'),'value':_0x5a2298[_0x829f('0x52')]||(_0x5a2298[_0x829f('0x3e')]&&_0x5a2298[_0x829f('0x3e')][0x1]?_0x5a2298[_0x829f('0x3e')][0x1][_0x829f('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x597c46){logger['error']('widgetAttributes:\x20%s',JSON[_0x829f('0x53')](_0x597c46));return[];}}exports[_0x829f('0x54')]=function(_0x3fcd4c,_0x4144d0){if(_0x3fcd4c[_0x829f('0x55')]){_0x3fcd4c['body']['attrs']=widgetAttributes(_0x3fcd4c[_0x829f('0x55')]);}return db[_0x829f('0x2d')]['create'](_0x3fcd4c['body'],{})[_0x829f('0x26')](respondWithResult(_0x4144d0,0xc9))[_0x829f('0x39')](handleError(_0x4144d0,null));};exports['update']=function(_0x348678,_0x573528){if(_0x348678[_0x829f('0x55')]['id']){delete _0x348678[_0x829f('0x55')]['id'];}_0x348678['body'][_0x829f('0x3e')]=widgetAttributes(_0x348678[_0x829f('0x55')]);return db['DashboardItem'][_0x829f('0x3a')]({'where':{'id':_0x348678[_0x829f('0x2c')]['id']}})[_0x829f('0x26')](handleEntityNotFound(_0x573528,null))[_0x829f('0x26')](saveUpdates(_0x348678[_0x829f('0x55')],null))[_0x829f('0x26')](respondWithResult(_0x573528,null))[_0x829f('0x39')](handleError(_0x573528,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index dcf797c..eeba44b 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 _0x7fcb=['hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x7fcb,0xd5));var _0xb7fc=function(_0x83560f,_0x3d005f){_0x83560f=_0x83560f-0x0;var _0x5d4a9f=_0x7fcb[_0x83560f];return _0x5d4a9f;};'use strict';var EventEmitter=require(_0xb7fc('0x0'));var DashboardItem=require(_0xb7fc('0x1'))['db'][_0xb7fc('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb7fc('0x3')](0x0);var events={'afterCreate':_0xb7fc('0x4'),'afterUpdate':_0xb7fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58ea9c){return function(_0x4be25e,_0x423730,_0x1ac79d){DashboardItemEvents[_0xb7fc('0x6')](_0x58ea9c+':'+_0x4be25e['id'],_0x4be25e);DashboardItemEvents[_0xb7fc('0x6')](_0x58ea9c,_0x4be25e);_0x1ac79d(null);};}for(var e in events){if(events[_0xb7fc('0x7')](e)){var event=events[e];DashboardItem[_0xb7fc('0x8')](e,emitEvent(event));}}module[_0xb7fc('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xaa2c=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0xaa2c,0x1a3));var _0xcaa2=function(_0x5a7e61,_0x1d66ae){_0x5a7e61=_0x5a7e61-0x0;var _0x5a7b41=_0xaa2c[_0x5a7e61];return _0x5a7b41;};'use strict';var EventEmitter=require(_0xcaa2('0x0'));var DashboardItem=require(_0xcaa2('0x1'))['db'][_0xcaa2('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcaa2('0x3')](0x0);var events={'afterCreate':_0xcaa2('0x4'),'afterUpdate':_0xcaa2('0x5'),'afterDestroy':_0xcaa2('0x6')};function emitEvent(_0x2c1c0a){return function(_0x576982,_0x440e5c,_0x5a113c){DashboardItemEvents['emit'](_0x2c1c0a+':'+_0x576982['id'],_0x576982);DashboardItemEvents[_0xcaa2('0x7')](_0x2c1c0a,_0x576982);_0x5a113c(null);};}for(var e in events){if(events[_0xcaa2('0x8')](e)){var event=events[e];DashboardItem[_0xcaa2('0x9')](e,emitEvent(event));}}module[_0xcaa2('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5b70888..8cbae75 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 _0x0f47=['DashboardItem','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x2ce806,_0x4309f8){var _0x688a03=function(_0x26f058){while(--_0x26f058){_0x2ce806['push'](_0x2ce806['shift']());}};_0x688a03(++_0x4309f8);}(_0x0f47,0x19f));var _0x70f4=function(_0x24bd74,_0x103f43){_0x24bd74=_0x24bd74-0x0;var _0x2720e1=_0x0f47[_0x24bd74];return _0x2720e1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x70f4('0x0'));var BPromise=require(_0x70f4('0x1'));var rp=require(_0x70f4('0x2'));var fs=require('fs');var path=require(_0x70f4('0x3'));var rimraf=require(_0x70f4('0x4'));var config=require(_0x70f4('0x5'));var attributes=require(_0x70f4('0x6'));module[_0x70f4('0x7')]=function(_0x4edaf2,_0x51e773){return _0x4edaf2['define'](_0x70f4('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec43=['DashboardItem','dashboard_items','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x2630b8,_0x31bc27){var _0x1e222c=function(_0x28102f){while(--_0x28102f){_0x2630b8['push'](_0x2630b8['shift']());}};_0x1e222c(++_0x31bc27);}(_0xec43,0xc2));var _0x3ec4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec43[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x3ec4('0x0'));var logger=require(_0x3ec4('0x1'))(_0x3ec4('0x2'));var moment=require('moment');var BPromise=require(_0x3ec4('0x3'));var rp=require(_0x3ec4('0x4'));var fs=require('fs');var path=require(_0x3ec4('0x5'));var rimraf=require(_0x3ec4('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ec4('0x7'));module[_0x3ec4('0x8')]=function(_0x32ec9d,_0x548daa){return _0x32ec9d[_0x3ec4('0x9')](_0x3ec4('0xa'),attributes,{'tableName':_0x3ec4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 09c99a4..1b1f3fd 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 _0xdeef=['DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x4283e9,_0x55c057){var _0x4e4c67=function(_0x3c700c){while(--_0x3c700c){_0x4283e9['push'](_0x4283e9['shift']());}};_0x4e4c67(++_0x55c057);}(_0xdeef,0xb6));var _0xfdee=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0xdeef[_0x12d917];return _0x576d1a;};'use strict';var _=require(_0xfdee('0x0'));var util=require(_0xfdee('0x1'));var moment=require(_0xfdee('0x2'));var BPromise=require(_0xfdee('0x3'));var rs=require(_0xfdee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdee('0x5'))['db'];var utils=require(_0xfdee('0x6'));var logger=require(_0xfdee('0x7'))('rpc');var config=require(_0xfdee('0x8'));var jayson=require(_0xfdee('0x9'));var client=jayson[_0xfdee('0xa')][_0xfdee('0xb')]({'port':0x232a});config[_0xfdee('0xc')]=_['defaults'](config['redis'],{'host':_0xfdee('0xd'),'port':0x18eb});var socket=require(_0xfdee('0xe'))(new Redis(config[_0xfdee('0xc')]));require(_0xfdee('0xf'))[_0xfdee('0x10')](socket);function respondWithRpcPromise(_0x294a6b,_0x411127,_0x56c8cb){return new BPromise(function(_0x40a942,_0x1eee69){return client[_0xfdee('0x11')](_0x294a6b,_0x56c8cb)[_0xfdee('0x12')](function(_0x53d004){logger[_0xfdee('0x13')](_0xfdee('0x14'),_0x411127,'request\x20sent');logger['debug'](_0xfdee('0x15'),_0x411127,_0xfdee('0x16'),JSON[_0xfdee('0x17')](_0x53d004));if(_0x53d004['error']){if(_0x53d004[_0xfdee('0x18')][_0xfdee('0x19')]===0x1f4){logger[_0xfdee('0x18')](_0xfdee('0x14'),_0x411127,_0x53d004[_0xfdee('0x18')]['message']);return _0x1eee69(_0x53d004[_0xfdee('0x18')][_0xfdee('0x1a')]);}logger[_0xfdee('0x18')]('DashboardItem,\x20%s,\x20%s',_0x411127,_0x53d004[_0xfdee('0x18')]['message']);return _0x40a942(_0x53d004[_0xfdee('0x18')][_0xfdee('0x1a')]);}else{logger[_0xfdee('0x13')](_0xfdee('0x14'),_0x411127,_0xfdee('0x16'));_0x40a942(_0x53d004[_0xfdee('0x1b')][_0xfdee('0x1a')]);}})[_0xfdee('0x1c')](function(_0x39a9be){logger[_0xfdee('0x18')](_0xfdee('0x14'),_0x411127,_0x39a9be);_0x1eee69(_0x39a9be);});});} \ No newline at end of file +var _0x4a25=['redis','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','defaults'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0x4a25,0x1f3));var _0x54a2=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x4a25[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x54a2('0x1'));var fs=require('fs');var Redis=require(_0x54a2('0x2'));var db=require(_0x54a2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54a2('0x4'));var config=require('../../config/environment');var jayson=require(_0x54a2('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x54a2('0x6')](config[_0x54a2('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x54a2('0x8'))(new Redis(config['redis']));require(_0x54a2('0x9'))[_0x54a2('0xa')](socket);function respondWithRpcPromise(_0x1f9428,_0x364d11,_0x15ccb4){return new BPromise(function(_0x119c9d,_0x48cda6){return client[_0x54a2('0xb')](_0x1f9428,_0x15ccb4)['then'](function(_0x1c9a2f){logger[_0x54a2('0xc')](_0x54a2('0xd'),_0x364d11,_0x54a2('0xe'));logger['debug'](_0x54a2('0xf'),_0x364d11,_0x54a2('0xe'),JSON[_0x54a2('0x10')](_0x1c9a2f));if(_0x1c9a2f[_0x54a2('0x11')]){if(_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x12')]===0x1f4){logger['error'](_0x54a2('0xd'),_0x364d11,_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x13')]);return _0x48cda6(_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x13')]);}logger['error'](_0x54a2('0xd'),_0x364d11,_0x1c9a2f[_0x54a2('0x11')]['message']);return _0x119c9d(_0x1c9a2f[_0x54a2('0x11')][_0x54a2('0x13')]);}else{logger[_0x54a2('0xc')](_0x54a2('0xd'),_0x364d11,_0x54a2('0xe'));_0x119c9d(_0x1c9a2f[_0x54a2('0x14')][_0x54a2('0x13')]);}})[_0x54a2('0x15')](function(_0x13c172){logger[_0x54a2('0x11')](_0x54a2('0xd'),_0x364d11,_0x13c172);_0x48cda6(_0x13c172);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8007a23..cc7b5c9 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 _0x4ece=['remove','removeListener','length','dashboardItem:','save'];(function(_0x37a9a5,_0x4130c8){var _0x5e3b37=function(_0x1f741a){while(--_0x1f741a){_0x37a9a5['push'](_0x37a9a5['shift']());}};_0x5e3b37(++_0x4130c8);}(_0x4ece,0x185));var _0xe4ec=function(_0x18219f,_0x72691){_0x18219f=_0x18219f-0x0;var _0x2e8027=_0x4ece[_0x18219f];return _0x2e8027;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xe4ec('0x0'),_0xe4ec('0x1'),'update'];function createListener(_0x570d37,_0x16f8e2){return function(_0x20ed2c){_0x16f8e2['emit'](_0x570d37,_0x20ed2c);};}function removeListener(_0x250ce5,_0x44e41f){return function(){DashboardItemEvents[_0xe4ec('0x2')](_0x250ce5,_0x44e41f);};}exports['register']=function(_0x223bd5){for(var _0x49bf1e=0x0,_0x2560c2=events[_0xe4ec('0x3')];_0x49bf1e<_0x2560c2;_0x49bf1e++){var _0xe48c71=events[_0x49bf1e];var _0x6cf432=createListener(_0xe4ec('0x4')+_0xe48c71,_0x223bd5);DashboardItemEvents['on'](_0xe48c71,_0x6cf432);}}; \ No newline at end of file +var _0x47df=['length','./dashboardItem.events','remove','emit','removeListener','register'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x47df,0xfd));var _0xf47d=function(_0x572344,_0x42143d){_0x572344=_0x572344-0x0;var _0x2e71e6=_0x47df[_0x572344];return _0x2e71e6;};'use strict';var DashboardItemEvents=require(_0xf47d('0x0'));var events=['save',_0xf47d('0x1'),'update'];function createListener(_0x760380,_0x1414f3){return function(_0x1a78c7){_0x1414f3[_0xf47d('0x2')](_0x760380,_0x1a78c7);};}function removeListener(_0x199d2,_0x527334){return function(){DashboardItemEvents[_0xf47d('0x3')](_0x199d2,_0x527334);};}exports[_0xf47d('0x4')]=function(_0x23ec63){for(var _0x40da6c=0x0,_0x1a974a=events[_0xf47d('0x5')];_0x40da6c<_0x1a974a;_0x40da6c++){var _0x45af04=events[_0x40da6c];var _0xfa2264=createListener('dashboardItem:'+_0x45af04,_0x23ec63);DashboardItemEvents['on'](_0x45af04,_0xfa2264);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ac1cb64..1ae1415 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 _0xc4aa=['connect-timeout','express','Router','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x5717e6,_0x1dfead){var _0x1808df=function(_0x5d1264){while(--_0x5d1264){_0x5717e6['push'](_0x5717e6['shift']());}};_0x1808df(++_0x1dfead);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')](_0xac4a('0x8'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0xb')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router['put']('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router[_0xac4a('0xe')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);module[_0xac4a('0x10')]=router; \ No newline at end of file +var _0x1cb9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path'];(function(_0x40669e,_0x50ffc4){var _0x4becf3=function(_0x4f7799){while(--_0x4f7799){_0x40669e['push'](_0x40669e['shift']());}};_0x4becf3(++_0x50ffc4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x50b3de,_0x2adc80){_0x50b3de=_0x50b3de-0x0;var _0x299940=_0x1cb9[_0x50b3de];return _0x299940;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./dashboardItem.controller');router[_0x91cb('0x7')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x9')](),controller['create']);router[_0x91cb('0xc')]('/:id',auth[_0x91cb('0x9')](),controller['update']);router[_0x91cb('0xd')](_0x91cb('0x8'),auth[_0x91cb('0x9')](),controller[_0x91cb('0xe')]);module[_0x91cb('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 1f87776..f681422 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 _0xaa26=['STRING','ENUM','first','second','third','sequelize'];(function(_0xce32a5,_0x1c0524){var _0x5be2f9=function(_0x2f2745){while(--_0x2f2745){_0xce32a5['push'](_0xce32a5['shift']());}};_0x5be2f9(++_0x1c0524);}(_0xaa26,0x107));var _0x6aa2=function(_0x2943a0,_0x1e54f4){_0x2943a0=_0x2943a0-0x0;var _0x68f82e=_0xaa26[_0x2943a0];return _0x68f82e;};'use strict';var Sequelize=require(_0x6aa2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6aa2('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6aa2('0x2')](_0x6aa2('0x3'),_0x6aa2('0x4'),_0x6aa2('0x5')),'allowNull':![],'defaultValue':_0x6aa2('0x3')},'description':{'type':Sequelize[_0x6aa2('0x1')]}}; \ No newline at end of file +var _0xd288=['third','ENUM','first','second'];(function(_0x3f9e9a,_0x251c42){var _0x171f3e=function(_0x2f423c){while(--_0x2f423c){_0x3f9e9a['push'](_0x3f9e9a['shift']());}};_0x171f3e(++_0x251c42);}(_0xd288,0xa1));var _0x8d28=function(_0x19c4b4,_0x496d39){_0x19c4b4=_0x19c4b4-0x0;var _0xd175bc=_0xd288[_0x19c4b4];return _0xd175bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x8d28('0x0')](_0x8d28('0x1'),_0x8d28('0x2'),_0x8d28('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a4bf057..bd23216 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 _0x139f=['moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','params','options','catch','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x21c504,_0x3e00c6){var _0x51b5c3=function(_0x5b3f42){while(--_0x5b3f42){_0x21c504['push'](_0x21c504['shift']());}};_0x51b5c3(++_0x3e00c6);}(_0x139f,0x19b));var _0xf139=function(_0x19e73a,_0x387aa3){_0x19e73a=_0x19e73a-0x0;var _0x319171=_0x139f[_0x19e73a];return _0x319171;};'use strict';var pdf=require(_0xf139('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf139('0x1'));var jsonpatch=require(_0xf139('0x2'));var rp=require(_0xf139('0x3'));var moment=require(_0xf139('0x4'));var BPromise=require(_0xf139('0x5'));var Mustache=require(_0xf139('0x6'));var util=require(_0xf139('0x7'));var path=require('path');var sox=require(_0xf139('0x8'));var csv=require('to-csv');var ejs=require(_0xf139('0x9'));var fs=require('fs');var _=require(_0xf139('0xa'));var squel=require('squel');var crypto=require(_0xf139('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf139('0xc'));var toCsv=require(_0xf139('0xd'));var querystring=require(_0xf139('0xe'));var Papa=require(_0xf139('0xf'));var Redis=require(_0xf139('0x10'));var authService=require(_0xf139('0x11'));var qs=require(_0xf139('0x12'));var as=require(_0xf139('0x13'));var hardwareService=require(_0xf139('0x14'));var logger=require(_0xf139('0x15'))(_0xf139('0x16'));var utils=require(_0xf139('0x17'));var config=require(_0xf139('0x18'));var licenseUtil=require(_0xf139('0x19'));var db=require(_0xf139('0x1a'))['db'];function respondWithStatusCode(_0x214501,_0x51d968){_0x51d968=_0x51d968||0xcc;return function(_0x3b4372){if(_0x3b4372){return _0x214501[_0xf139('0x1b')](_0x51d968);}return _0x214501[_0xf139('0x1c')](_0x51d968)['end']();};}function respondWithResult(_0x4713ac,_0x4792f5){_0x4792f5=_0x4792f5||0xc8;return function(_0x51a929){if(_0x51a929){return _0x4713ac[_0xf139('0x1c')](_0x4792f5)[_0xf139('0x1d')](_0x51a929);}};}function respondWithFilteredResult(_0x255a2c,_0x55ad25){return function(_0x3a9f30){if(_0x3a9f30){var _0xcdfd63=_0x3a9f30['count'],_0x3907f1=_0x55ad25[_0xf139('0x1e')],_0x45a883=_0x55ad25[_0xf139('0x1e')]+_0x55ad25[_0xf139('0x1f')],_0x43fa00;if(_0x45a883>=_0xcdfd63){_0x45a883=_0xcdfd63;_0x43fa00=0xc8;}else{_0x43fa00=0xce;}_0x255a2c['status'](_0x43fa00);return _0x255a2c['set'](_0xf139('0x20'),_0x3907f1+'-'+_0x45a883+'/'+_0xcdfd63)['json'](_0x3a9f30);}return null;};}function patchUpdates(_0x5535f3){return function(_0x15de99){try{jsonpatch['apply'](_0x15de99,_0x5535f3,!![]);}catch(_0x5f381e){return BPromise[_0xf139('0x21')](_0x5f381e);}return _0x15de99[_0xf139('0x22')]();};}function saveUpdates(_0x3ea1cc,_0x48913f){return function(_0x391917){if(_0x391917){return _0x391917[_0xf139('0x23')](_0x3ea1cc)[_0xf139('0x24')](function(_0x2fb248){return _0x2fb248;});}return null;};}function removeEntity(_0x28443a,_0x3af0c3){return function(_0x4a4dce){if(_0x4a4dce){return _0x4a4dce[_0xf139('0x25')]()[_0xf139('0x24')](function(){var _0x884d44=_0x4a4dce[_0xf139('0x26')]({'plain':!![]});var _0x3b5887=_0xf139('0x27');return db[_0xf139('0x28')][_0xf139('0x25')]({'where':{'type':_0x3b5887,'resourceId':_0x884d44['id']}})[_0xf139('0x24')](function(){return _0x4a4dce;});})[_0xf139('0x24')](function(){_0x28443a[_0xf139('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfdc7,_0x22b980){return function(_0x274e38){if(!_0x274e38){_0x2bfdc7[_0xf139('0x1b')](0x194);}return _0x274e38;};}function handleError(_0x33063d,_0x37daa6){_0x37daa6=_0x37daa6||0x1f4;return function(_0x24c0bd){logger[_0xf139('0x29')](_0x24c0bd['stack']);if(_0x24c0bd[_0xf139('0x2a')]){delete _0x24c0bd['name'];}_0x33063d[_0xf139('0x1c')](_0x37daa6)[_0xf139('0x2b')](_0x24c0bd);};}exports['index']=function(_0x1959ff,_0x1db1f6){var _0x424b07={},_0x439136={},_0x24767c={'count':0x0,'rows':[]};var _0x5068e0=_[_0xf139('0x2c')](db[_0xf139('0x2d')][_0xf139('0x2e')],function(_0xcb0267){return{'name':_0xcb0267[_0xf139('0x2f')],'type':_0xcb0267[_0xf139('0x30')][_0xf139('0x31')]};});_0x439136[_0xf139('0x32')]=_[_0xf139('0x2c')](_0x5068e0,_0xf139('0x2a'));_0x439136[_0xf139('0x33')]=_[_0xf139('0x34')](_0x1959ff['query']);_0x439136[_0xf139('0x35')]=_['intersection'](_0x439136[_0xf139('0x32')],_0x439136[_0xf139('0x33')]);_0x424b07[_0xf139('0x36')]=_[_0xf139('0x37')](_0x439136[_0xf139('0x32')],qs[_0xf139('0x38')](_0x1959ff[_0xf139('0x33')][_0xf139('0x38')]));_0x424b07['attributes']=_0x424b07['attributes'][_0xf139('0x39')]?_0x424b07[_0xf139('0x36')]:_0x439136[_0xf139('0x32')];if(!_0x1959ff['query'][_0xf139('0x3a')](_0xf139('0x3b'))){_0x424b07['limit']=qs[_0xf139('0x1f')](_0x1959ff[_0xf139('0x33')][_0xf139('0x1f')]);_0x424b07[_0xf139('0x1e')]=qs[_0xf139('0x1e')](_0x1959ff[_0xf139('0x33')][_0xf139('0x1e')]);}_0x424b07[_0xf139('0x3c')]=qs[_0xf139('0x3d')](_0x1959ff[_0xf139('0x33')]['sort']);_0x424b07['where']=qs[_0xf139('0x35')](_[_0xf139('0x3e')](_0x1959ff[_0xf139('0x33')],_0x439136[_0xf139('0x35')]),_0x5068e0);if(_0x1959ff[_0xf139('0x33')][_0xf139('0x3f')]){_0x424b07[_0xf139('0x40')]=_[_0xf139('0x41')](_0x424b07[_0xf139('0x40')],{'$or':_['map'](_0x5068e0,function(_0x470a96){if(_0x470a96['type']!=='VIRTUAL'){var _0x2c79bd={};_0x2c79bd[_0x470a96['name']]={'$like':'%'+_0x1959ff[_0xf139('0x33')][_0xf139('0x3f')]+'%'};return _0x2c79bd;}})});}_0x424b07=_[_0xf139('0x41')]({},_0x424b07,_0x1959ff['options']);var _0xcf2cf7={'where':_0x424b07[_0xf139('0x40')]};return db[_0xf139('0x2d')][_0xf139('0x42')](_0xcf2cf7)[_0xf139('0x24')](function(_0x14277a){_0x24767c[_0xf139('0x42')]=_0x14277a;if(_0x1959ff[_0xf139('0x33')][_0xf139('0x43')]){_0x424b07[_0xf139('0x44')]=[{'all':!![]}];}return db[_0xf139('0x2d')][_0xf139('0x45')](_0x424b07);})[_0xf139('0x24')](function(_0x5c0713){_0x24767c[_0xf139('0x46')]=_0x5c0713;return _0x24767c;})[_0xf139('0x24')](respondWithFilteredResult(_0x1db1f6,_0x424b07))['catch'](handleError(_0x1db1f6,null));};exports['show']=function(_0x345bcc,_0x12a263){var _0x5cdaf0={'raw':!![],'where':{'id':_0x345bcc[_0xf139('0x47')]['id']}},_0x4ec179={};_0x4ec179[_0xf139('0x32')]=_['keys'](db[_0xf139('0x2d')][_0xf139('0x2e')]);_0x4ec179[_0xf139('0x33')]=_[_0xf139('0x34')](_0x345bcc[_0xf139('0x33')]);_0x4ec179[_0xf139('0x35')]=_[_0xf139('0x37')](_0x4ec179['model'],_0x4ec179[_0xf139('0x33')]);_0x5cdaf0[_0xf139('0x36')]=_[_0xf139('0x37')](_0x4ec179[_0xf139('0x32')],qs[_0xf139('0x38')](_0x345bcc['query'][_0xf139('0x38')]));_0x5cdaf0[_0xf139('0x36')]=_0x5cdaf0[_0xf139('0x36')]['length']?_0x5cdaf0[_0xf139('0x36')]:_0x4ec179[_0xf139('0x32')];if(_0x345bcc[_0xf139('0x33')][_0xf139('0x43')]){_0x5cdaf0['include']=[{'all':!![]}];}_0x5cdaf0=_['merge']({},_0x5cdaf0,_0x345bcc[_0xf139('0x48')]);return db[_0xf139('0x2d')]['find'](_0x5cdaf0)['then'](handleEntityNotFound(_0x12a263,null))[_0xf139('0x24')](respondWithResult(_0x12a263,null))[_0xf139('0x49')](handleError(_0x12a263,null));};exports[_0xf139('0x4a')]=function(_0x5a1e4d,_0xee8431){return db[_0xf139('0x2d')]['create'](_0x5a1e4d[_0xf139('0x4b')],{})[_0xf139('0x24')](function(_0x5e491b){var _0x2741d3=_0x5a1e4d[_0xf139('0x4c')][_0xf139('0x26')]({'plain':!![]});if(!_0x2741d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2741d3[_0xf139('0x4d')]===_0xf139('0x4c')){var _0xcbd7dd=_0x5e491b[_0xf139('0x26')]({'plain':!![]});var _0xa7e3c6=_0xf139('0x27');return db[_0xf139('0x4e')][_0xf139('0x4f')]({'where':{'name':_0xa7e3c6,'userProfileId':_0x2741d3[_0xf139('0x50')]},'raw':!![]})['then'](function(_0x43faa8){if(_0x43faa8&&_0x43faa8[_0xf139('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0xcbd7dd[_0xf139('0x2a')],'resourceId':_0xcbd7dd['id'],'type':_0x43faa8[_0xf139('0x2a')],'sectionId':_0x43faa8['id']},{})[_0xf139('0x24')](function(){return _0x5e491b;});}else{return _0x5e491b;}})[_0xf139('0x49')](function(_0x1f9117){logger[_0xf139('0x29')](_0xf139('0x52'),_0x1f9117);throw _0x1f9117;});}return _0x5e491b;})['then'](respondWithResult(_0xee8431,0xc9))[_0xf139('0x49')](handleError(_0xee8431,null));};exports[_0xf139('0x23')]=function(_0x237a23,_0x10bfc9){if(_0x237a23[_0xf139('0x4b')]['id']){delete _0x237a23['body']['id'];}return db[_0xf139('0x2d')][_0xf139('0x4f')]({'where':{'id':_0x237a23[_0xf139('0x47')]['id']}})[_0xf139('0x24')](handleEntityNotFound(_0x10bfc9,null))[_0xf139('0x24')](saveUpdates(_0x237a23['body'],null))[_0xf139('0x24')](respondWithResult(_0x10bfc9,null))[_0xf139('0x49')](handleError(_0x10bfc9,null));};exports[_0xf139('0x25')]=function(_0x5d53bb,_0x1e3330){return db['Disposition'][_0xf139('0x4f')]({'where':{'id':_0x5d53bb[_0xf139('0x47')]['id']}})[_0xf139('0x24')](handleEntityNotFound(_0x1e3330,null))[_0xf139('0x24')](removeEntity(_0x1e3330,null))[_0xf139('0x49')](handleError(_0x1e3330,null));}; \ No newline at end of file +var _0xdab8=['error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','Dispositions'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xdab8,0x126));var _0x8dab=function(_0x282429,_0x155c34){_0x282429=_0x282429-0x0;var _0x6784e0=_0xdab8[_0x282429];return _0x6784e0;};'use strict';var pdf=require(_0x8dab('0x0'));var emlformat=require(_0x8dab('0x1'));var rimraf=require(_0x8dab('0x2'));var zipdir=require(_0x8dab('0x3'));var jsonpatch=require(_0x8dab('0x4'));var rp=require('request-promise');var moment=require(_0x8dab('0x5'));var BPromise=require(_0x8dab('0x6'));var Mustache=require('mustache');var util=require(_0x8dab('0x7'));var path=require(_0x8dab('0x8'));var sox=require('sox');var csv=require(_0x8dab('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8dab('0xa'));var crypto=require(_0x8dab('0xb'));var jsforce=require(_0x8dab('0xc'));var deskjs=require(_0x8dab('0xd'));var toCsv=require(_0x8dab('0x9'));var querystring=require(_0x8dab('0xe'));var Papa=require('papaparse');var Redis=require(_0x8dab('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8dab('0x10'));var hardwareService=require(_0x8dab('0x11'));var logger=require(_0x8dab('0x12'))(_0x8dab('0x13'));var utils=require(_0x8dab('0x14'));var config=require(_0x8dab('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dab('0x16'))['db'];function respondWithStatusCode(_0x155286,_0x2515dd){_0x2515dd=_0x2515dd||0xcc;return function(_0x10e471){if(_0x10e471){return _0x155286['sendStatus'](_0x2515dd);}return _0x155286['status'](_0x2515dd)[_0x8dab('0x17')]();};}function respondWithResult(_0x4eb86f,_0x586bc1){_0x586bc1=_0x586bc1||0xc8;return function(_0x3215cf){if(_0x3215cf){return _0x4eb86f[_0x8dab('0x18')](_0x586bc1)['json'](_0x3215cf);}};}function respondWithFilteredResult(_0x4167ca,_0x463ebd){return function(_0x15453d){if(_0x15453d){var _0xfc62a7=_0x15453d[_0x8dab('0x19')],_0x25ff72=_0x463ebd[_0x8dab('0x1a')],_0x3364af=_0x463ebd[_0x8dab('0x1a')]+_0x463ebd[_0x8dab('0x1b')],_0x26bfb7;if(_0x3364af>=_0xfc62a7){_0x3364af=_0xfc62a7;_0x26bfb7=0xc8;}else{_0x26bfb7=0xce;}_0x4167ca[_0x8dab('0x18')](_0x26bfb7);return _0x4167ca[_0x8dab('0x1c')](_0x8dab('0x1d'),_0x25ff72+'-'+_0x3364af+'/'+_0xfc62a7)[_0x8dab('0x1e')](_0x15453d);}return null;};}function patchUpdates(_0x3f8521){return function(_0x248e43){try{jsonpatch[_0x8dab('0x1f')](_0x248e43,_0x3f8521,!![]);}catch(_0x1234fb){return BPromise[_0x8dab('0x20')](_0x1234fb);}return _0x248e43[_0x8dab('0x21')]();};}function saveUpdates(_0x4b07cf,_0xc8695e){return function(_0x1a15c6){if(_0x1a15c6){return _0x1a15c6[_0x8dab('0x22')](_0x4b07cf)[_0x8dab('0x23')](function(_0x39f61b){return _0x39f61b;});}return null;};}function removeEntity(_0x584762,_0x1fde0d){return function(_0x2c71af){if(_0x2c71af){return _0x2c71af[_0x8dab('0x24')]()['then'](function(){var _0x418764=_0x2c71af['get']({'plain':!![]});var _0x7ff0ce=_0x8dab('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x7ff0ce,'resourceId':_0x418764['id']}})[_0x8dab('0x23')](function(){return _0x2c71af;});})['then'](function(){_0x584762[_0x8dab('0x18')](0xcc)[_0x8dab('0x17')]();});}};}function handleEntityNotFound(_0x11c5d3,_0x324cde){return function(_0x8db300){if(!_0x8db300){_0x11c5d3['sendStatus'](0x194);}return _0x8db300;};}function handleError(_0xc044e8,_0x2b0cea){_0x2b0cea=_0x2b0cea||0x1f4;return function(_0x5839ea){logger[_0x8dab('0x26')](_0x5839ea[_0x8dab('0x27')]);if(_0x5839ea[_0x8dab('0x28')]){delete _0x5839ea['name'];}_0xc044e8[_0x8dab('0x18')](_0x2b0cea)[_0x8dab('0x29')](_0x5839ea);};}exports[_0x8dab('0x2a')]=function(_0x355e54,_0x31c314){var _0x4c2ff4={},_0x2f90a9={},_0x1d9519={'count':0x0,'rows':[]};var _0x5ceaea=_[_0x8dab('0x2b')](db[_0x8dab('0x2c')][_0x8dab('0x2d')],function(_0x102b41){return{'name':_0x102b41['fieldName'],'type':_0x102b41[_0x8dab('0x2e')][_0x8dab('0x2f')]};});_0x2f90a9[_0x8dab('0x30')]=_[_0x8dab('0x2b')](_0x5ceaea,'name');_0x2f90a9['query']=_[_0x8dab('0x31')](_0x355e54['query']);_0x2f90a9[_0x8dab('0x32')]=_[_0x8dab('0x33')](_0x2f90a9['model'],_0x2f90a9[_0x8dab('0x34')]);_0x4c2ff4['attributes']=_['intersection'](_0x2f90a9[_0x8dab('0x30')],qs['fields'](_0x355e54[_0x8dab('0x34')][_0x8dab('0x35')]));_0x4c2ff4['attributes']=_0x4c2ff4[_0x8dab('0x36')][_0x8dab('0x37')]?_0x4c2ff4[_0x8dab('0x36')]:_0x2f90a9['model'];if(!_0x355e54[_0x8dab('0x34')][_0x8dab('0x38')](_0x8dab('0x39'))){_0x4c2ff4[_0x8dab('0x1b')]=qs['limit'](_0x355e54[_0x8dab('0x34')][_0x8dab('0x1b')]);_0x4c2ff4[_0x8dab('0x1a')]=qs[_0x8dab('0x1a')](_0x355e54[_0x8dab('0x34')][_0x8dab('0x1a')]);}_0x4c2ff4[_0x8dab('0x3a')]=qs[_0x8dab('0x3b')](_0x355e54['query'][_0x8dab('0x3b')]);_0x4c2ff4['where']=qs['filters'](_[_0x8dab('0x3c')](_0x355e54['query'],_0x2f90a9[_0x8dab('0x32')]),_0x5ceaea);if(_0x355e54['query'][_0x8dab('0x3d')]){_0x4c2ff4[_0x8dab('0x3e')]=_[_0x8dab('0x3f')](_0x4c2ff4[_0x8dab('0x3e')],{'$or':_[_0x8dab('0x2b')](_0x5ceaea,function(_0x2d7681){if(_0x2d7681[_0x8dab('0x2e')]!==_0x8dab('0x40')){var _0x4f74bd={};_0x4f74bd[_0x2d7681['name']]={'$like':'%'+_0x355e54['query'][_0x8dab('0x3d')]+'%'};return _0x4f74bd;}})});}_0x4c2ff4=_['merge']({},_0x4c2ff4,_0x355e54[_0x8dab('0x41')]);var _0x5d6f3f={'where':_0x4c2ff4[_0x8dab('0x3e')]};return db[_0x8dab('0x2c')]['count'](_0x5d6f3f)[_0x8dab('0x23')](function(_0x3aff6e){_0x1d9519[_0x8dab('0x19')]=_0x3aff6e;if(_0x355e54[_0x8dab('0x34')][_0x8dab('0x42')]){_0x4c2ff4[_0x8dab('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x8dab('0x44')](_0x4c2ff4);})[_0x8dab('0x23')](function(_0x36d8c5){_0x1d9519[_0x8dab('0x45')]=_0x36d8c5;return _0x1d9519;})[_0x8dab('0x23')](respondWithFilteredResult(_0x31c314,_0x4c2ff4))[_0x8dab('0x46')](handleError(_0x31c314,null));};exports[_0x8dab('0x47')]=function(_0x3c2a7c,_0x184292){var _0x587a06={'raw':!![],'where':{'id':_0x3c2a7c['params']['id']}},_0xaaf629={};_0xaaf629[_0x8dab('0x30')]=_['keys'](db[_0x8dab('0x2c')][_0x8dab('0x2d')]);_0xaaf629[_0x8dab('0x34')]=_[_0x8dab('0x31')](_0x3c2a7c[_0x8dab('0x34')]);_0xaaf629['filters']=_[_0x8dab('0x33')](_0xaaf629['model'],_0xaaf629['query']);_0x587a06[_0x8dab('0x36')]=_[_0x8dab('0x33')](_0xaaf629[_0x8dab('0x30')],qs[_0x8dab('0x35')](_0x3c2a7c[_0x8dab('0x34')][_0x8dab('0x35')]));_0x587a06[_0x8dab('0x36')]=_0x587a06[_0x8dab('0x36')][_0x8dab('0x37')]?_0x587a06['attributes']:_0xaaf629[_0x8dab('0x30')];if(_0x3c2a7c[_0x8dab('0x34')]['includeAll']){_0x587a06['include']=[{'all':!![]}];}_0x587a06=_[_0x8dab('0x3f')]({},_0x587a06,_0x3c2a7c['options']);return db[_0x8dab('0x2c')][_0x8dab('0x48')](_0x587a06)[_0x8dab('0x23')](handleEntityNotFound(_0x184292,null))[_0x8dab('0x23')](respondWithResult(_0x184292,null))[_0x8dab('0x46')](handleError(_0x184292,null));};exports[_0x8dab('0x49')]=function(_0x208d40,_0x16d1ac){return db['Disposition'][_0x8dab('0x49')](_0x208d40[_0x8dab('0x4a')],{})[_0x8dab('0x23')](function(_0x5d98e0){var _0x177233=_0x208d40[_0x8dab('0x4b')][_0x8dab('0x4c')]({'plain':!![]});if(!_0x177233)throw new Error(_0x8dab('0x4d'));if(_0x177233['role']===_0x8dab('0x4b')){var _0x50724c=_0x5d98e0[_0x8dab('0x4c')]({'plain':!![]});var _0x430d8c=_0x8dab('0x25');return db['UserProfileSection'][_0x8dab('0x48')]({'where':{'name':_0x430d8c,'userProfileId':_0x177233[_0x8dab('0x4e')]},'raw':!![]})[_0x8dab('0x23')](function(_0x2af28a){if(_0x2af28a&&_0x2af28a[_0x8dab('0x4f')]===0x0){return db[_0x8dab('0x50')][_0x8dab('0x49')]({'name':_0x50724c['name'],'resourceId':_0x50724c['id'],'type':_0x2af28a[_0x8dab('0x28')],'sectionId':_0x2af28a['id']},{})[_0x8dab('0x23')](function(){return _0x5d98e0;});}else{return _0x5d98e0;}})[_0x8dab('0x46')](function(_0x5dadbe){logger[_0x8dab('0x26')](_0x8dab('0x51'),_0x5dadbe);throw _0x5dadbe;});}return _0x5d98e0;})[_0x8dab('0x23')](respondWithResult(_0x16d1ac,0xc9))[_0x8dab('0x46')](handleError(_0x16d1ac,null));};exports[_0x8dab('0x22')]=function(_0x139505,_0x4f0924){if(_0x139505[_0x8dab('0x4a')]['id']){delete _0x139505[_0x8dab('0x4a')]['id'];}return db[_0x8dab('0x2c')][_0x8dab('0x48')]({'where':{'id':_0x139505[_0x8dab('0x52')]['id']}})[_0x8dab('0x23')](handleEntityNotFound(_0x4f0924,null))['then'](saveUpdates(_0x139505[_0x8dab('0x4a')],null))[_0x8dab('0x23')](respondWithResult(_0x4f0924,null))[_0x8dab('0x46')](handleError(_0x4f0924,null));};exports['destroy']=function(_0x20145e,_0x5d62bb){return db['Disposition']['find']({'where':{'id':_0x20145e[_0x8dab('0x52')]['id']}})[_0x8dab('0x23')](handleEntityNotFound(_0x5d62bb,null))[_0x8dab('0x23')](removeEntity(_0x5d62bb,null))[_0x8dab('0x46')](handleError(_0x5d62bb,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f4adaa4..f98e3f6 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 _0x6347=['moment','bluebird','request-promise','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api'];(function(_0x111123,_0x3bd52e){var _0x2c0ba7=function(_0x2a5823){while(--_0x2a5823){_0x111123['push'](_0x111123['shift']());}};_0x2c0ba7(++_0x3bd52e);}(_0x6347,0x1c9));var _0x7634=function(_0x109927,_0x23c1b6){_0x109927=_0x109927-0x0;var _0x218e1a=_0x6347[_0x109927];return _0x218e1a;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require('../../config/logger')(_0x7634('0x2'));var moment=require(_0x7634('0x3'));var BPromise=require(_0x7634('0x4'));var rp=require(_0x7634('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7634('0x6'));var config=require('../../config/environment');var attributes=require(_0x7634('0x7'));module[_0x7634('0x8')]=function(_0x56d2ad,_0x58d043){return _0x56d2ad[_0x7634('0x9')](_0x7634('0xa'),attributes,{'tableName':_0x7634('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7634('0xc'),'fields':[_0x7634('0xd'),_0x7634('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x7634('0xd'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name',_0x7634('0xf')]},{'unique':!![],'name':_0x7634('0x10'),'fields':[_0x7634('0xd'),_0x7634('0x11')]},{'unique':!![],'name':_0x7634('0x12'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x7634('0x13'),'fields':[_0x7634('0xd'),_0x7634('0x14')]},{'unique':!![],'name':_0x7634('0x15'),'fields':[_0x7634('0xd'),_0x7634('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd43e=['bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xd43e,0x88));var _0xed43=function(_0x1edb0c,_0x58602b){_0x1edb0c=_0x1edb0c-0x0;var _0x4de44a=_0xd43e[_0x1edb0c];return _0x4de44a;};'use strict';var _=require(_0xed43('0x0'));var util=require('util');var logger=require(_0xed43('0x1'))(_0xed43('0x2'));var moment=require(_0xed43('0x3'));var BPromise=require(_0xed43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed43('0x5'));var config=require(_0xed43('0x6'));var attributes=require(_0xed43('0x7'));module[_0xed43('0x8')]=function(_0x52425d,_0x1d4276){return _0x52425d[_0xed43('0x9')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xed43('0xa'),_0xed43('0xb')]},{'unique':!![],'name':_0xed43('0xc'),'fields':[_0xed43('0xa'),_0xed43('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0xed43('0xa'),_0xed43('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0xed43('0xa'),_0xed43('0xf')]},{'unique':!![],'name':_0xed43('0x10'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0xed43('0x11'),'fields':[_0xed43('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0xed43('0x12'),'fields':[_0xed43('0xa'),_0xed43('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 36c9b79..4be0491 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 _0x688a=['rpc','../../config/environment','client','request','then','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x688a,0x184));var _0xa688=function(_0xdcfb73,_0x374b50){_0xdcfb73=_0xdcfb73-0x0;var _0x41224b=_0x688a[_0xdcfb73];return _0x41224b;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var moment=require(_0xa688('0x2'));var BPromise=require(_0xa688('0x3'));var rs=require(_0xa688('0x4'));var fs=require('fs');var Redis=require(_0xa688('0x5'));var db=require(_0xa688('0x6'))['db'];var utils=require(_0xa688('0x7'));var logger=require('../../config/logger')(_0xa688('0x8'));var config=require(_0xa688('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa688('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4757a6,_0x19e232,_0x1502d0){return new BPromise(function(_0xfd7339,_0x5a84df){return client[_0xa688('0xb')](_0x4757a6,_0x1502d0)[_0xa688('0xc')](function(_0x2eb6d3){logger['info'](_0xa688('0xd'),_0x19e232,'request\x20sent');logger[_0xa688('0xe')](_0xa688('0xf'),_0x19e232,_0xa688('0x10'),JSON['stringify'](_0x2eb6d3));if(_0x2eb6d3['error']){if(_0x2eb6d3[_0xa688('0x11')][_0xa688('0x12')]===0x1f4){logger[_0xa688('0x11')](_0xa688('0xd'),_0x19e232,_0x2eb6d3[_0xa688('0x11')]['message']);return _0x5a84df(_0x2eb6d3[_0xa688('0x11')][_0xa688('0x13')]);}logger[_0xa688('0x11')](_0xa688('0xd'),_0x19e232,_0x2eb6d3[_0xa688('0x11')]['message']);return _0xfd7339(_0x2eb6d3[_0xa688('0x11')][_0xa688('0x13')]);}else{logger[_0xa688('0x14')](_0xa688('0xd'),_0x19e232,_0xa688('0x10'));_0xfd7339(_0x2eb6d3['result'][_0xa688('0x13')]);}})[_0xa688('0x15')](function(_0x396740){logger[_0xa688('0x11')](_0xa688('0xd'),_0x19e232,_0x396740);_0x5a84df(_0x396740);});});} \ No newline at end of file +var _0x4a94=['../../mysqldb','../../config/environment','jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x255da2,_0x2a1988){var _0xbce46c=function(_0x19b8df){while(--_0x19b8df){_0x255da2['push'](_0x255da2['shift']());}};_0xbce46c(++_0x2a1988);}(_0x4a94,0x175));var _0x44a9=function(_0x52ac40,_0x299d1b){_0x52ac40=_0x52ac40-0x0;var _0x37a06d=_0x4a94[_0x52ac40];return _0x37a06d;};'use strict';var _=require(_0x44a9('0x0'));var util=require(_0x44a9('0x1'));var moment=require(_0x44a9('0x2'));var BPromise=require(_0x44a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44a9('0x4'));var db=require(_0x44a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x44a9('0x6'));var jayson=require(_0x44a9('0x7'));var client=jayson['client'][_0x44a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x420b67,_0x1a6266,_0x43c64e){return new BPromise(function(_0x5ae14d,_0x2e190f){return client[_0x44a9('0x9')](_0x420b67,_0x43c64e)[_0x44a9('0xa')](function(_0x5877ee){logger['info'](_0x44a9('0xb'),_0x1a6266,_0x44a9('0xc'));logger[_0x44a9('0xd')](_0x44a9('0xe'),_0x1a6266,_0x44a9('0xc'),JSON[_0x44a9('0xf')](_0x5877ee));if(_0x5877ee[_0x44a9('0x10')]){if(_0x5877ee[_0x44a9('0x10')][_0x44a9('0x11')]===0x1f4){logger[_0x44a9('0x10')](_0x44a9('0xb'),_0x1a6266,_0x5877ee[_0x44a9('0x10')][_0x44a9('0x12')]);return _0x2e190f(_0x5877ee['error'][_0x44a9('0x12')]);}logger[_0x44a9('0x10')](_0x44a9('0xb'),_0x1a6266,_0x5877ee[_0x44a9('0x10')]['message']);return _0x5ae14d(_0x5877ee[_0x44a9('0x10')][_0x44a9('0x12')]);}else{logger['info'](_0x44a9('0xb'),_0x1a6266,_0x44a9('0xc'));_0x5ae14d(_0x5877ee[_0x44a9('0x13')]['message']);}})[_0x44a9('0x14')](function(_0x24c32c){logger[_0x44a9('0x10')](_0x44a9('0xb'),_0x1a6266,_0x24c32c);_0x2e190f(_0x24c32c);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index afb7ac1..2d6ed10 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 _0xd317=['../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','util','connect-timeout','express'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xd317,0x1dd));var _0x7d31=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xd317[_0x251d9c];return _0x16ae64;};'use strict';var multer=require('multer');var util=require(_0x7d31('0x0'));var path=require('path');var timeout=require(_0x7d31('0x1'));var express=require(_0x7d31('0x2'));var router=express['Router']();var auth=require(_0x7d31('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7d31('0x4'));var controller=require(_0x7d31('0x5'));router['get']('/',auth[_0x7d31('0x6')](),controller[_0x7d31('0x7')]);router[_0x7d31('0x8')](_0x7d31('0x9'),auth[_0x7d31('0x6')](),controller[_0x7d31('0xa')]);router[_0x7d31('0xb')]('/',auth['isAuthenticated'](),controller[_0x7d31('0xc')]);router[_0x7d31('0xd')](_0x7d31('0x9'),auth[_0x7d31('0x6')](),controller['update']);router['delete'](_0x7d31('0x9'),auth['isAuthenticated'](),controller[_0x7d31('0xe')]);module['exports']=router; \ No newline at end of file +var _0xce65=['../../config/environment','./disposition.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x247909,_0x2a8478){var _0x394343=function(_0x26e70f){while(--_0x26e70f){_0x247909['push'](_0x247909['shift']());}};_0x394343(++_0x2a8478);}(_0xce65,0x71));var _0x5ce6=function(_0x2e0f64,_0x17743b){_0x2e0f64=_0x2e0f64-0x0;var _0x40ec93=_0xce65[_0x2e0f64];return _0x40ec93;};'use strict';var multer=require('multer');var util=require(_0x5ce6('0x0'));var path=require(_0x5ce6('0x1'));var timeout=require(_0x5ce6('0x2'));var express=require(_0x5ce6('0x3'));var router=express[_0x5ce6('0x4')]();var auth=require(_0x5ce6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ce6('0x6'));var controller=require(_0x5ce6('0x7'));router['get']('/',auth[_0x5ce6('0x8')](),controller[_0x5ce6('0x9')]);router['get'](_0x5ce6('0xa'),auth[_0x5ce6('0x8')](),controller[_0x5ce6('0xb')]);router[_0x5ce6('0xc')]('/',auth[_0x5ce6('0x8')](),controller[_0x5ce6('0xd')]);router[_0x5ce6('0xe')]('/:id',auth[_0x5ce6('0x8')](),controller[_0x5ce6('0xf')]);router[_0x5ce6('0x10')](_0x5ce6('0xa'),auth[_0x5ce6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 66dd28f..aeb21c1 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 _0xdb72=['exports','yes','xCALLY\x20Motion\x20Fax','STRING','ENUM','2400','4800','7200','14400','9600','12000','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0xdb72,0x1ce));var _0x2db7=function(_0x31659b,_0x3f07a1){_0x31659b=_0x31659b-0x0;var _0x48b140=_0xdb72[_0x31659b];return _0x48b140;};'use strict';var Sequelize=require('sequelize');module[_0x2db7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x2db7('0x1'),'no'),'defaultValue':_0x2db7('0x1')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x2db7('0x2')},'localstationid':{'type':Sequelize[_0x2db7('0x3')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x2db7('0x4')](_0x2db7('0x5'),_0x2db7('0x6'),_0x2db7('0x7'),'9600','12000',_0x2db7('0x8')),'defaultValue':_0x2db7('0x6')},'maxrate':{'type':Sequelize[_0x2db7('0x4')]('2400',_0x2db7('0x6'),'7200',_0x2db7('0x9'),_0x2db7('0xa'),_0x2db7('0x8')),'defaultValue':_0x2db7('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x2db7('0xb')},'gateway':{'type':Sequelize[_0x2db7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x2db7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x2db7('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2db7('0x4')](_0x2db7('0xd'),'IAX',_0x2db7('0xe'),_0x2db7('0xf')),'defaultValue':_0x2db7('0xd')},'key':{'type':Sequelize[_0x2db7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2db7('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2db7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![],'comment':_0x2db7('0x12'),'set':function(_0x8a65f9){if(!_0x8a65f9)this[_0x2db7('0x13')](_0x2db7('0x14'),null);this[_0x2db7('0x13')](_0x2db7('0x15'),_0x8a65f9);}}}; \ No newline at end of file +var _0x6de1=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','9600','12000','14400','2400','7200','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x56e111,_0x5927c0){var _0x321326=function(_0x558684){while(--_0x558684){_0x56e111['push'](_0x56e111['shift']());}};_0x321326(++_0x5927c0);}(_0x6de1,0x182));var _0x16de=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x6de1[_0x26a4ea];return _0x1b669e;};'use strict';var Sequelize=require(_0x16de('0x0'));module[_0x16de('0x1')]={'name':{'type':Sequelize[_0x16de('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x16de('0x2')]},'ecm':{'type':Sequelize[_0x16de('0x3')](_0x16de('0x4'),'no'),'defaultValue':_0x16de('0x4')},'headerinfo':{'type':Sequelize[_0x16de('0x2')],'defaultValue':_0x16de('0x5')},'localstationid':{'type':Sequelize[_0x16de('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x16de('0x3')]('2400',_0x16de('0x6'),'7200',_0x16de('0x7'),_0x16de('0x8'),_0x16de('0x9')),'defaultValue':_0x16de('0x6')},'maxrate':{'type':Sequelize[_0x16de('0x3')](_0x16de('0xa'),_0x16de('0x6'),_0x16de('0xb'),_0x16de('0x7'),_0x16de('0x8'),_0x16de('0x9')),'defaultValue':_0x16de('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x16de('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x16de('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x16de('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x16de('0x3')](_0x16de('0xd'),_0x16de('0xe'),_0x16de('0xf'),_0x16de('0x10')),'defaultValue':_0x16de('0xd')},'key':{'type':Sequelize[_0x16de('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x16de('0x11');}},'notificationSound':{'type':Sequelize[_0x16de('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x16de('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x16de('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x16de('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x16de('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x16de('0x14'),'set':function(_0xc91018){if(!_0xc91018)this[_0x16de('0x15')](_0x16de('0x16'),null);this[_0x16de('0x15')](_0x16de('0x17'),_0xc91018);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 48ee9ae..27c91a3 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 _0xcebf=['SendFax','path','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','http','client','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','stack','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','map','name','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','bulkCreate','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues'];(function(_0xe96931,_0x2f59d7){var _0x332f08=function(_0x400f8c){while(--_0x400f8c){_0xe96931['push'](_0xe96931['shift']());}};_0x332f08(++_0x2f59d7);}(_0xcebf,0x1a0));var _0xfceb=function(_0x122027,_0x5b5148){_0x122027=_0x122027-0x0;var _0x1c020c=_0xcebf[_0x122027];return _0x1c020c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfceb('0x0'));var rimraf=require(_0xfceb('0x1'));var zipdir=require(_0xfceb('0x2'));var jsonpatch=require(_0xfceb('0x3'));var rp=require(_0xfceb('0x4'));var moment=require(_0xfceb('0x5'));var BPromise=require(_0xfceb('0x6'));var Mustache=require(_0xfceb('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfceb('0x8'));var csv=require(_0xfceb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfceb('0xa'));var squel=require(_0xfceb('0xb'));var crypto=require(_0xfceb('0xc'));var jsforce=require(_0xfceb('0xd'));var deskjs=require(_0xfceb('0xe'));var toCsv=require(_0xfceb('0x9'));var querystring=require('querystring');var Papa=require(_0xfceb('0xf'));var Redis=require(_0xfceb('0x10'));var authService=require(_0xfceb('0x11'));var qs=require(_0xfceb('0x12'));var as=require(_0xfceb('0x13'));var hardwareService=require(_0xfceb('0x14'));var logger=require(_0xfceb('0x15'))(_0xfceb('0x16'));var utils=require(_0xfceb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfceb('0x18'));var db=require(_0xfceb('0x19'))['db'];config['redis']=_[_0xfceb('0x1a')](config[_0xfceb('0x1b')],{'host':_0xfceb('0x1c'),'port':0x18eb});var socket=require(_0xfceb('0x1d'))(new Redis(config[_0xfceb('0x1b')]));require('./faxAccount.socket')[_0xfceb('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfceb('0x1f')]({'port':0x232c});var client9002=jayson[_0xfceb('0x20')][_0xfceb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x156c2b,_0x271875,_0x6cfd42,_0x120a91){return new BPromise(function(_0x1ae6ee,_0x247b34){var _0x52fc29=_0x120a91||client;return _0x52fc29[_0xfceb('0x21')](_0x156c2b,_0x6cfd42)[_0xfceb('0x22')](function(_0x2734a9){logger[_0xfceb('0x23')]('FaxAccount,\x20%s,\x20%s',_0x271875,'request\x20sent');logger[_0xfceb('0x24')](_0xfceb('0x25'),_0x271875,_0xfceb('0x26'),JSON[_0xfceb('0x27')](_0x2734a9));if(_0x2734a9[_0xfceb('0x28')]){if(_0x2734a9[_0xfceb('0x28')]['code']===0x1f4){logger['error'](_0xfceb('0x29'),_0x271875,_0x2734a9[_0xfceb('0x28')][_0xfceb('0x2a')]);return _0x247b34(_0x2734a9['error']['message']);}logger[_0xfceb('0x28')](_0xfceb('0x29'),_0x271875,_0x2734a9[_0xfceb('0x28')][_0xfceb('0x2a')]);return _0x1ae6ee(_0x2734a9['error'][_0xfceb('0x2a')]);}else{logger[_0xfceb('0x23')](_0xfceb('0x29'),_0x271875,_0xfceb('0x26'));_0x1ae6ee(_0x2734a9['result'][_0xfceb('0x2a')]);}})[_0xfceb('0x2b')](function(_0x1c02fc){logger[_0xfceb('0x28')]('FaxAccount,\x20%s,\x20%s',_0x271875,_0x1c02fc);_0x247b34(_0x1c02fc);});});}function respondWithStatusCode(_0x2f8c84,_0x358f7e){_0x358f7e=_0x358f7e||0xcc;return function(_0x13568a){if(_0x13568a){return _0x2f8c84[_0xfceb('0x2c')](_0x358f7e);}return _0x2f8c84[_0xfceb('0x2d')](_0x358f7e)[_0xfceb('0x2e')]();};}function respondWithResult(_0x1064b5,_0x540edf){_0x540edf=_0x540edf||0xc8;return function(_0x3a3c7b){if(_0x3a3c7b){return _0x1064b5['status'](_0x540edf)[_0xfceb('0x2f')](_0x3a3c7b);}};}function respondWithFilteredResult(_0x30fc93,_0x4b39d1){return function(_0x19ed53){if(_0x19ed53){var _0x3fd367=_0x19ed53[_0xfceb('0x30')],_0x4e0f18=_0x4b39d1[_0xfceb('0x31')],_0x573acb=_0x4b39d1['offset']+_0x4b39d1['limit'],_0x3f8145;if(_0x573acb>=_0x3fd367){_0x573acb=_0x3fd367;_0x3f8145=0xc8;}else{_0x3f8145=0xce;}_0x30fc93['status'](_0x3f8145);return _0x30fc93[_0xfceb('0x32')](_0xfceb('0x33'),_0x4e0f18+'-'+_0x573acb+'/'+_0x3fd367)['json'](_0x19ed53);}return null;};}function patchUpdates(_0x5be86f){return function(_0xba02ea){try{jsonpatch[_0xfceb('0x34')](_0xba02ea,_0x5be86f,!![]);}catch(_0xd40228){return BPromise[_0xfceb('0x35')](_0xd40228);}return _0xba02ea[_0xfceb('0x36')]();};}function saveUpdates(_0x2ba659,_0x424f25){return function(_0x274557){if(_0x274557){return _0x274557[_0xfceb('0x37')](_0x2ba659)[_0xfceb('0x22')](function(_0x12f2dc){return _0x12f2dc;});}return null;};}function removeEntity(_0x35aa12,_0x164202){return function(_0x4af878){if(_0x4af878){return _0x4af878[_0xfceb('0x38')]()[_0xfceb('0x22')](function(){var _0x25a65b=_0x4af878[_0xfceb('0x39')]({'plain':!![]});var _0x33a0cc=_0xfceb('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x33a0cc,'resourceId':_0x25a65b['id']}})[_0xfceb('0x22')](function(){return _0x4af878;});})['then'](function(){_0x35aa12['status'](0xcc)[_0xfceb('0x2e')]();});}};}function handleEntityNotFound(_0xaa76b4,_0x5ad808){return function(_0x4ddb24){if(!_0x4ddb24){_0xaa76b4[_0xfceb('0x2c')](0x194);}return _0x4ddb24;};}function handleError(_0x4dd051,_0x8dbacd){_0x8dbacd=_0x8dbacd||0x1f4;return function(_0x3efdc8){logger[_0xfceb('0x28')](_0x3efdc8[_0xfceb('0x3b')]);if(_0x3efdc8['name']){delete _0x3efdc8['name'];}_0x4dd051[_0xfceb('0x2d')](_0x8dbacd)[_0xfceb('0x3c')](_0x3efdc8);};}exports[_0xfceb('0x3d')]=function(_0x4ab6f9,_0x5e4bbd){var _0x4f679c={'include':[{'model':db['Pause'],'as':_0xfceb('0x3e')}]},_0x3a74e8={},_0x2eb2fa={'count':0x0,'rows':[]};var _0xa4d17=_['map'](db[_0xfceb('0x3f')][_0xfceb('0x40')],function(_0x3a9850){return{'name':_0x3a9850['fieldName'],'type':_0x3a9850[_0xfceb('0x41')][_0xfceb('0x42')]};});_0x3a74e8[_0xfceb('0x43')]=_[_0xfceb('0x44')](_0xa4d17,_0xfceb('0x45'));_0x3a74e8[_0xfceb('0x46')]=_['keys'](_0x4ab6f9[_0xfceb('0x46')]);_0x3a74e8[_0xfceb('0x47')]=_[_0xfceb('0x48')](_0x3a74e8[_0xfceb('0x43')],_0x3a74e8[_0xfceb('0x46')]);_0x4f679c[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x3a74e8[_0xfceb('0x43')],qs['fields'](_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x4a')]));_0x4f679c[_0xfceb('0x49')]=_0x4f679c[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x4f679c[_0xfceb('0x49')]:_0x3a74e8[_0xfceb('0x43')];if(!_0x4ab6f9[_0xfceb('0x46')]['hasOwnProperty'](_0xfceb('0x4c'))){_0x4f679c[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x4ab6f9[_0xfceb('0x46')]['limit']);_0x4f679c['offset']=qs[_0xfceb('0x31')](_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x31')]);}_0x4f679c[_0xfceb('0x4e')]=qs['sort'](_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x4f679c[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_[_0xfceb('0x51')](_0x4ab6f9['query'],_0x3a74e8[_0xfceb('0x47')]),_0xa4d17);if(_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x52')]){_0x4f679c['where']=_[_0xfceb('0x53')](_0x4f679c[_0xfceb('0x50')],{'$or':_[_0xfceb('0x44')](_0xa4d17,function(_0xf24b32){if(_0xf24b32[_0xfceb('0x41')]!==_0xfceb('0x54')){var _0x276447={};_0x276447[_0xf24b32['name']]={'$like':'%'+_0x4ab6f9[_0xfceb('0x46')]['filter']+'%'};return _0x276447;}})});}_0x4f679c=_[_0xfceb('0x53')]({},_0x4f679c,_0x4ab6f9[_0xfceb('0x55')]);var _0x4957c4={'where':_0x4f679c[_0xfceb('0x50')]};return db[_0xfceb('0x3f')]['count'](_0x4957c4)['then'](function(_0x2ba1c3){_0x2eb2fa[_0xfceb('0x30')]=_0x2ba1c3;if(_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x56')]){_0x4f679c[_0xfceb('0x57')]=[{'all':!![]}];}return db[_0xfceb('0x3f')][_0xfceb('0x58')](_0x4f679c);})[_0xfceb('0x22')](function(_0x35168e){_0x2eb2fa[_0xfceb('0x59')]=_0x35168e;return _0x2eb2fa;})['then'](respondWithFilteredResult(_0x5e4bbd,_0x4f679c))[_0xfceb('0x2b')](handleError(_0x5e4bbd,null));};exports[_0xfceb('0x5a')]=function(_0x1010cf,_0x565688){var _0x58014e={'raw':![],'where':{'id':_0x1010cf[_0xfceb('0x5b')]['id']},'include':[{'model':db[_0xfceb('0x5c')],'as':_0xfceb('0x3e')}]},_0x4068e={};_0x4068e[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db[_0xfceb('0x3f')]['rawAttributes']);_0x4068e[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x1010cf[_0xfceb('0x46')]);_0x4068e[_0xfceb('0x47')]=_[_0xfceb('0x48')](_0x4068e[_0xfceb('0x43')],_0x4068e[_0xfceb('0x46')]);_0x58014e[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x4068e[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x1010cf[_0xfceb('0x46')]['fields']));_0x58014e[_0xfceb('0x49')]=_0x58014e[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x58014e[_0xfceb('0x49')]:_0x4068e[_0xfceb('0x43')];if(_0x1010cf[_0xfceb('0x46')][_0xfceb('0x56')]){_0x58014e[_0xfceb('0x57')]=[{'all':!![]}];}_0x58014e=_['merge']({},_0x58014e,_0x1010cf[_0xfceb('0x55')]);return db['FaxAccount'][_0xfceb('0x5e')](_0x58014e)[_0xfceb('0x22')](handleEntityNotFound(_0x565688,null))[_0xfceb('0x22')](respondWithResult(_0x565688,null))[_0xfceb('0x2b')](handleError(_0x565688,null));};exports[_0xfceb('0x5f')]=function(_0x43623e,_0x894d74){return db[_0xfceb('0x3f')][_0xfceb('0x5f')](_0x43623e['body'],{})[_0xfceb('0x22')](function(_0x3ae094){var _0x1d01e7=_0x43623e[_0xfceb('0x60')][_0xfceb('0x39')]({'plain':!![]});if(!_0x1d01e7)throw new Error(_0xfceb('0x61'));if(_0x1d01e7[_0xfceb('0x62')]===_0xfceb('0x60')){var _0x342a08=_0x3ae094['get']({'plain':!![]});var _0x2f2c34=_0xfceb('0x3a');return db[_0xfceb('0x63')]['find']({'where':{'name':_0x2f2c34,'userProfileId':_0x1d01e7[_0xfceb('0x64')]},'raw':!![]})[_0xfceb('0x22')](function(_0x9a6992){if(_0x9a6992&&_0x9a6992[_0xfceb('0x65')]===0x0){return db[_0xfceb('0x66')]['create']({'name':_0x342a08[_0xfceb('0x45')],'resourceId':_0x342a08['id'],'type':_0x9a6992['name'],'sectionId':_0x9a6992['id']},{})[_0xfceb('0x22')](function(){return _0x3ae094;});}else{return _0x3ae094;}})[_0xfceb('0x2b')](function(_0x44b5d4){logger[_0xfceb('0x28')](_0xfceb('0x67'),_0x44b5d4);throw _0x44b5d4;});}return _0x3ae094;})['then'](respondWithResult(_0x894d74,0xc9))[_0xfceb('0x2b')](handleError(_0x894d74,null));};exports['update']=function(_0x5bdbdd,_0x5b570b){if(_0x5bdbdd[_0xfceb('0x68')]['id']){delete _0x5bdbdd[_0xfceb('0x68')]['id'];}return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x5bdbdd[_0xfceb('0x5b')]['id']},'include':[{'model':db[_0xfceb('0x5c')],'as':_0xfceb('0x3e')}]})[_0xfceb('0x22')](handleEntityNotFound(_0x5b570b,null))['then'](saveUpdates(_0x5bdbdd['body'],null))['then'](respondWithResult(_0x5b570b,null))[_0xfceb('0x2b')](handleError(_0x5b570b,null));};exports[_0xfceb('0x38')]=function(_0x3bd4a8,_0x105bb1){return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x3bd4a8[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x105bb1,null))['then'](removeEntity(_0x105bb1,null))[_0xfceb('0x2b')](handleError(_0x105bb1,null));};exports['describe']=function(_0x378981,_0x3cd585){return db['FaxAccount'][_0xfceb('0x69')]()[_0xfceb('0x22')](respondWithResult(_0x3cd585,null))[_0xfceb('0x2b')](handleError(_0x3cd585,null));};exports[_0xfceb('0x6a')]=function(_0x29307f,_0x46accc,_0x321761){if(_0x29307f[_0xfceb('0x68')]['id']){delete _0x29307f[_0xfceb('0x68')]['id'];}return db[_0xfceb('0x3f')]['find']({'where':{'id':_0x29307f['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x46accc,null))['then'](function(_0x52b76b){if(_0x52b76b){_0x29307f[_0xfceb('0x68')][_0xfceb('0x6b')]=_0x52b76b['id'];return db[_0xfceb('0x6c')][_0xfceb('0x5f')](_0x29307f[_0xfceb('0x68')]);}})[_0xfceb('0x22')](respondWithResult(_0x46accc,null))['catch'](handleError(_0x46accc,null));};exports[_0xfceb('0x6d')]=function(_0xe991fa,_0x2fc135,_0x3c39ce){var _0x4cb00c={'raw':![],'where':{}};var _0x59a9f3={};var _0x59cb05={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')]['findOne']({'where':{'id':_0xe991fa[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x2fc135,null))[_0xfceb('0x22')](function(_0x48f1d6){if(_0x48f1d6){_0x59a9f3[_0xfceb('0x43')]=_['keys'](db[_0xfceb('0x6c')][_0xfceb('0x40')]);_0x59a9f3[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0xe991fa['query']);_0x59a9f3[_0xfceb('0x47')]=_['intersection'](_0x59a9f3[_0xfceb('0x43')],_0x59a9f3[_0xfceb('0x46')]);_0x4cb00c[_0xfceb('0x49')]=_['intersection'](_0x59a9f3['model'],qs['fields'](_0xe991fa[_0xfceb('0x46')]['fields']));_0x4cb00c[_0xfceb('0x49')]=_0x4cb00c[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x4cb00c['attributes']:_0x59a9f3[_0xfceb('0x43')];if(!_0xe991fa[_0xfceb('0x46')]['hasOwnProperty'](_0xfceb('0x4c'))){_0x4cb00c[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0xe991fa[_0xfceb('0x46')]['limit']);_0x4cb00c[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0xe991fa[_0xfceb('0x46')]['offset']);}_0x4cb00c['order']=qs[_0xfceb('0x4f')](_0xe991fa[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x4cb00c['where']=qs[_0xfceb('0x47')](_[_0xfceb('0x51')](_0xe991fa[_0xfceb('0x46')],_0x59a9f3[_0xfceb('0x47')]));_0x4cb00c['where'][_0xfceb('0x6b')]=_0x48f1d6['id'];if(_0xe991fa[_0xfceb('0x46')][_0xfceb('0x52')]){_0x4cb00c[_0xfceb('0x50')]=_[_0xfceb('0x53')](_0x4cb00c['where'],{'$or':_[_0xfceb('0x44')](_0x4cb00c[_0xfceb('0x49')],function(_0x1ba13a){var _0x257ef6={};_0x257ef6[_0x1ba13a]={'$like':'%'+_0xe991fa['query']['filter']+'%'};return _0x257ef6;})});}_0x4cb00c=_[_0xfceb('0x53')]({},_0x4cb00c,_0xe991fa[_0xfceb('0x55')]);return db[_0xfceb('0x6c')][_0xfceb('0x30')]({'where':_0x4cb00c['where']})['then'](function(_0x1fea21){_0x59cb05[_0xfceb('0x30')]=_0x1fea21;if(_0xe991fa['query'][_0xfceb('0x56')]){_0x4cb00c[_0xfceb('0x57')]=[{'all':!![]}];}return db[_0xfceb('0x6c')][_0xfceb('0x58')](_0x4cb00c);})[_0xfceb('0x22')](function(_0x2606de){_0x59cb05['rows']=_0x2606de;return _0x59cb05;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0x2fc135,_0x4cb00c))[_0xfceb('0x2b')](handleError(_0x2fc135,null));};exports[_0xfceb('0x6e')]=function(_0x35755,_0xb96141,_0x3dd6e8){return db[_0xfceb('0x3f')]['find']({'where':{'id':_0x35755[_0xfceb('0x5b')]['id']}})['then'](handleEntityNotFound(_0xb96141,null))['then'](function(_0x37856a){if(_0x37856a){return _0x37856a['removeDispositions'](_0x35755['query'][_0xfceb('0x6f')]);}})['then'](respondWithStatusCode(_0xb96141,null))[_0xfceb('0x2b')](handleError(_0xb96141,null));};exports[_0xfceb('0x70')]=function(_0x1a7ad1,_0x162e5e,_0x2460b6){if(_0x1a7ad1[_0xfceb('0x68')]['id']){delete _0x1a7ad1['body']['id'];}return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x1a7ad1[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x162e5e,null))['then'](function(_0x3c1f62){if(_0x3c1f62){_0x1a7ad1[_0xfceb('0x68')][_0xfceb('0x6b')]=_0x3c1f62['id'];return db[_0xfceb('0x71')][_0xfceb('0x5f')](_0x1a7ad1['body']);}})['then'](respondWithResult(_0x162e5e,null))[_0xfceb('0x2b')](handleError(_0x162e5e,null));};exports[_0xfceb('0x72')]=function(_0x1510a4,_0xd78aa1,_0x54f912){var _0x411bd2={'raw':![],'where':{}};var _0x1f0e55={};var _0x3b832f={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x1510a4['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0xd78aa1,null))[_0xfceb('0x22')](function(_0x5b8f08){if(_0x5b8f08){_0x1f0e55[_0xfceb('0x43')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x1f0e55[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x1510a4[_0xfceb('0x46')]);_0x1f0e55[_0xfceb('0x47')]=_[_0xfceb('0x48')](_0x1f0e55['model'],_0x1f0e55[_0xfceb('0x46')]);_0x411bd2['attributes']=_[_0xfceb('0x48')](_0x1f0e55[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x1510a4[_0xfceb('0x46')][_0xfceb('0x4a')]));_0x411bd2[_0xfceb('0x49')]=_0x411bd2[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x411bd2[_0xfceb('0x49')]:_0x1f0e55[_0xfceb('0x43')];if(!_0x1510a4['query'][_0xfceb('0x74')](_0xfceb('0x4c'))){_0x411bd2['limit']=qs[_0xfceb('0x4d')](_0x1510a4[_0xfceb('0x46')][_0xfceb('0x4d')]);_0x411bd2['offset']=qs[_0xfceb('0x31')](_0x1510a4['query'][_0xfceb('0x31')]);}_0x411bd2[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x1510a4[_0xfceb('0x46')]['sort']);_0x411bd2[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_[_0xfceb('0x51')](_0x1510a4[_0xfceb('0x46')],_0x1f0e55[_0xfceb('0x47')]));_0x411bd2['where']['FaxAccountId']=_0x5b8f08['id'];if(_0x1510a4[_0xfceb('0x46')][_0xfceb('0x52')]){_0x411bd2[_0xfceb('0x50')]=_[_0xfceb('0x53')](_0x411bd2[_0xfceb('0x50')],{'$or':_[_0xfceb('0x44')](_0x411bd2[_0xfceb('0x49')],function(_0x11da3b){var _0x12c335={};_0x12c335[_0x11da3b]={'$like':'%'+_0x1510a4[_0xfceb('0x46')][_0xfceb('0x52')]+'%'};return _0x12c335;})});}_0x411bd2=_['merge']({},_0x411bd2,_0x1510a4[_0xfceb('0x55')]);return db['CannedAnswer'][_0xfceb('0x30')]({'where':_0x411bd2[_0xfceb('0x50')]})[_0xfceb('0x22')](function(_0x3efe7d){_0x3b832f[_0xfceb('0x30')]=_0x3efe7d;if(_0x1510a4[_0xfceb('0x46')][_0xfceb('0x56')]){_0x411bd2['include']=[{'all':!![]}];}return db[_0xfceb('0x71')][_0xfceb('0x58')](_0x411bd2);})[_0xfceb('0x22')](function(_0x595326){_0x3b832f[_0xfceb('0x59')]=_0x595326;return _0x3b832f;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0xd78aa1,_0x411bd2))[_0xfceb('0x2b')](handleError(_0xd78aa1,null));};exports['removeAnswers']=function(_0x52b458,_0x327607,_0xf87254){return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x52b458['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x327607,null))['then'](function(_0x5558bb){if(_0x5558bb){return _0x5558bb[_0xfceb('0x75')](_0x52b458[_0xfceb('0x46')][_0xfceb('0x6f')]);}})[_0xfceb('0x22')](respondWithStatusCode(_0x327607,null))['catch'](handleError(_0x327607,null));};exports[_0xfceb('0x76')]=function(_0x495072,_0x47cf73,_0x2a81){return db['FaxInteraction'][_0xfceb('0x5e')]({'where':{'id':_0x495072[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x47cf73,null))[_0xfceb('0x22')](function(_0x27784f){if(_0x27784f){return _0x27784f[_0xfceb('0x76')](_0x495072[_0xfceb('0x68')][_0xfceb('0x6f')],_[_0xfceb('0x77')](_0x495072[_0xfceb('0x68')],[_0xfceb('0x6f'),'id'])||{});}})[_0xfceb('0x22')](respondWithResult(_0x47cf73,null))[_0xfceb('0x2b')](handleError(_0x47cf73,null));};exports[_0xfceb('0x78')]=function(_0x4042b4,_0x5d4d6d,_0xc147dd){var _0x58f479={'raw':![],'where':{}};var _0x56bf66={};var _0x3ef94f={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x4042b4[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x5d4d6d,null))[_0xfceb('0x22')](function(_0x469d48){if(_0x469d48){_0x56bf66[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db['FaxInteraction'][_0xfceb('0x40')]);_0x56bf66[_0xfceb('0x46')]=_['keys'](_0x4042b4['query']);_0x56bf66[_0xfceb('0x47')]=_['intersection'](_0x56bf66[_0xfceb('0x43')],_0x56bf66[_0xfceb('0x46')]);_0x58f479[_0xfceb('0x49')]=_['intersection'](_0x56bf66[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x4042b4[_0xfceb('0x46')][_0xfceb('0x4a')]));_0x58f479[_0xfceb('0x49')]=_0x58f479[_0xfceb('0x49')]['length']?_0x58f479['attributes']:_0x56bf66[_0xfceb('0x43')];if(!_0x4042b4[_0xfceb('0x46')][_0xfceb('0x74')](_0xfceb('0x4c'))){_0x58f479[_0xfceb('0x4d')]=qs['limit'](_0x4042b4['query'][_0xfceb('0x4d')]);_0x58f479['offset']=qs['offset'](_0x4042b4['query'][_0xfceb('0x31')]);}_0x58f479[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x4042b4[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x58f479[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_['pick'](_0x4042b4[_0xfceb('0x46')],_0x56bf66['filters']));_0x58f479[_0xfceb('0x50')][_0xfceb('0x6b')]=_0x469d48['id'];if(_0x4042b4[_0xfceb('0x46')]['filter']){_0x58f479['where']=_[_0xfceb('0x53')](_0x58f479[_0xfceb('0x50')],{'$or':_[_0xfceb('0x44')](_0x58f479[_0xfceb('0x49')],function(_0x3a911a){var _0x5e5ffc={};_0x5e5ffc[_0x3a911a]={'$like':'%'+_0x4042b4[_0xfceb('0x46')]['filter']+'%'};return _0x5e5ffc;})});}_0x58f479=_[_0xfceb('0x53')]({},_0x58f479,_0x4042b4[_0xfceb('0x55')]);return db[_0xfceb('0x79')]['count']({'where':_0x58f479[_0xfceb('0x50')]})['then'](function(_0x10144f){_0x3ef94f[_0xfceb('0x30')]=_0x10144f;if(_0x4042b4['query'][_0xfceb('0x56')]){_0x58f479[_0xfceb('0x57')]=[{'model':db[_0xfceb('0x7a')],'as':_0xfceb('0x7b'),'required':![]},{'model':db[_0xfceb('0x7c')],'as':_0xfceb('0x7d'),'attributes':[_0xfceb('0x45'),_0xfceb('0x7e'),'internal'],'required':![]},{'model':db[_0xfceb('0x7f')],'as':_0xfceb('0x80'),'attributes':['id','name',_0xfceb('0x81')],'where':_0x4042b4[_0xfceb('0x46')][_0xfceb('0x82')]?{'id':_0x4042b4[_0xfceb('0x46')][_0xfceb('0x82')]}:undefined,'required':_0x4042b4['query'][_0xfceb('0x82')]?!![]:![]}];}return db[_0xfceb('0x79')][_0xfceb('0x58')](_0x58f479);})[_0xfceb('0x22')](function(_0x1037f3){_0x3ef94f[_0xfceb('0x59')]=_0x1037f3;return _0x3ef94f;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0x5d4d6d,_0x58f479))[_0xfceb('0x2b')](handleError(_0x5d4d6d,null));};exports[_0xfceb('0x83')]=function(_0x51da8,_0x55d18a,_0x1ac43a){return db[_0xfceb('0x3f')]['findOne']({'where':{'id':_0x51da8[_0xfceb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x55d18a,null))[_0xfceb('0x22')](function(_0x14e019){if(_0x14e019){return db[_0xfceb('0x84')][_0xfceb('0x85')](function(_0x25a4ad){return db[_0xfceb('0x86')][_0xfceb('0x38')]({'where':{'FaxAccountId':_0x51da8[_0xfceb('0x5b')]['id']},'transaction':_0x25a4ad})['then'](function(_0x27bbde){var _0x173c36=_[_0xfceb('0x44')](_0x51da8[_0xfceb('0x68')],function(_0x45e778){_0x45e778[_0xfceb('0x6b')]=_0x51da8[_0xfceb('0x5b')]['id'];return _0x45e778;});return db[_0xfceb('0x86')]['bulkCreate'](_0x173c36,{'transaction':_0x25a4ad});});})['then'](function(){return db[_0xfceb('0x86')][_0xfceb('0x87')]({'where':{'FaxAccountId':_0x51da8['params']['id']},'order':'priority'});});}})[_0xfceb('0x22')](respondWithResult(_0x55d18a,null))[_0xfceb('0x2b')](handleError(_0x55d18a,null));};exports[_0xfceb('0x88')]=function(_0x53d028,_0x22b147,_0x346785){var _0x4bf376={};var _0x3347f6={};var _0x522e80;var _0x1ae6b5;return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x53d028['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x22b147,null))[_0xfceb('0x22')](function(_0xeead8){if(_0xeead8){_0x522e80=_0xeead8;_0x3347f6[_0xfceb('0x43')]=_['keys'](db[_0xfceb('0x86')][_0xfceb('0x40')]);_0x3347f6[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x53d028[_0xfceb('0x46')]);_0x3347f6['filters']=_[_0xfceb('0x48')](_0x3347f6[_0xfceb('0x43')],_0x3347f6['query']);_0x4bf376[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x3347f6['model'],qs[_0xfceb('0x4a')](_0x53d028['query'][_0xfceb('0x4a')]));_0x4bf376[_0xfceb('0x49')]=_0x4bf376['attributes'][_0xfceb('0x4b')]?_0x4bf376[_0xfceb('0x49')]:_0x3347f6[_0xfceb('0x43')];_0x4bf376['order']=qs[_0xfceb('0x4f')](_0x53d028[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x4bf376[_0xfceb('0x50')]=qs['filters'](_[_0xfceb('0x51')](_0x53d028[_0xfceb('0x46')],_0x3347f6[_0xfceb('0x47')]));if(_0x53d028[_0xfceb('0x46')]['filter']){_0x4bf376[_0xfceb('0x50')]=_[_0xfceb('0x53')](_0x4bf376['where'],{'$or':_[_0xfceb('0x44')](_0x4bf376[_0xfceb('0x49')],function(_0x26d6c8){var _0x41410f={};_0x41410f[_0x26d6c8]={'$like':'%'+_0x53d028[_0xfceb('0x46')]['filter']+'%'};return _0x41410f;})});}_0x4bf376=_[_0xfceb('0x53')]({},_0x4bf376,_0x53d028['options']);return _0x522e80[_0xfceb('0x88')](_0x4bf376);}})[_0xfceb('0x22')](function(_0x252a7f){if(_0x252a7f){_0x1ae6b5=_0x252a7f[_0xfceb('0x4b')];if(!_0x53d028[_0xfceb('0x46')][_0xfceb('0x74')]('nolimit')){_0x4bf376[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x53d028['query'][_0xfceb('0x4d')]);_0x4bf376[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0x53d028[_0xfceb('0x46')][_0xfceb('0x31')]);}return _0x522e80[_0xfceb('0x88')](_0x4bf376);}})[_0xfceb('0x22')](function(_0x2ecddd){if(_0x2ecddd){return _0x2ecddd?{'count':_0x1ae6b5,'rows':_0x2ecddd}:null;}})[_0xfceb('0x22')](respondWithResult(_0x22b147,null))['catch'](handleError(_0x22b147,null));};function Extension(_0x3a49f6,_0xad6902,_0x28f48a,_0x2d1b65){this[_0xfceb('0x89')]='from-voip-provider';this[_0xfceb('0x8a')]=_0x3a49f6[_0xfceb('0x8b')];this[_0xfceb('0x8c')]=_0x2d1b65;this[_0xfceb('0x41')]=_0xfceb('0x8d');this['description']=_0xfceb('0x8e');this[_0xfceb('0x6b')]=_0x3a49f6['id'];this[_0xfceb('0x8f')]=_0xad6902;this[_0xfceb('0x90')]=_0x28f48a;}function createExtensionsReciveFax(_0x2da93d){var _0x5022b2=0x1;var _0x144473=[];_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,'',_0xfceb('0x92')));_0x5022b2+=0x1;_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,_0xfceb('0x93'),_0xfceb('0x94')));_0x5022b2+=0x1;for(var _0x3b3a72 in _0x2da93d){if(_0x2da93d['hasOwnProperty'](_0x3b3a72)&&(_0x3b3a72===_0xfceb('0x95')||_0x3b3a72==='localstationid'||_0x3b3a72==='gateway'||_0x3b3a72===_0xfceb('0x96')||_0x3b3a72===_0xfceb('0x97')||_0x3b3a72===_0xfceb('0x98')||_0x3b3a72==='minrate'||_0x3b3a72===_0xfceb('0x99')||_0x3b3a72===_0xfceb('0x9a'))){_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,'FAXOPT('+_0x3b3a72+')='+_0x2da93d[_0x3b3a72],'Set'));_0x5022b2+=0x1;}}_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,'6',_0xfceb('0x9b')));_0x5022b2+=0x1;_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,_0xfceb('0x9c'),_0xfceb('0x9d')));_0x5022b2=0x0;return _0x144473;}exports[_0xfceb('0x9e')]=function(_0x5a70ff,_0x28e4b2,_0x261021){var _0x3119c6;return db['sequelize'][_0xfceb('0x85')](function(_0x39d1ee){return db[_0xfceb('0x3f')][_0xfceb('0x5f')](_0x5a70ff['body'],{'transaction':_0x39d1ee})['then'](function(_0x2d807f){_0x3119c6=_0x2d807f[_0xfceb('0x39')]({'plain':!![]});return db[_0xfceb('0x9f')]['bulkCreate'](createExtensionsReciveFax(_0x3119c6),{'transaction':_0x39d1ee});});})['then'](function(){return _0x3119c6;})[_0xfceb('0x22')](respondWithResult(_0x28e4b2,null))[_0xfceb('0x2b')](handleError(_0x28e4b2,null));};exports[_0xfceb('0xa0')]=function(_0x25842c,_0x3b76a8,_0xede941){var _0x5ba127;return db[_0xfceb('0x84')][_0xfceb('0x85')](function(_0x138691){return db[_0xfceb('0x3f')][_0xfceb('0x37')](_0x25842c[_0xfceb('0x68')],{'where':{'id':_0x25842c[_0xfceb('0x68')]['id']},'transaction':_0x138691})[_0xfceb('0x22')](function(_0x1fb3d4){return db[_0xfceb('0x9f')][_0xfceb('0x38')]({'where':{'FaxAccountId':_0x25842c[_0xfceb('0x68')]['id']},'transaction':_0x138691})[_0xfceb('0x22')](function(_0x25cc34){return db['VoiceExtension'][_0xfceb('0xa1')](createExtensionsReciveFax(_['omit'](_0x25842c[_0xfceb('0x68')],['tech',_0xfceb('0x42'),'createdAt',_0xfceb('0xa2'),_0xfceb('0xa3'),_0xfceb('0xa4')])),{'transaction':_0x138691});});});})[_0xfceb('0x22')](function(){return db[_0xfceb('0x3f')][_0xfceb('0xa5')](_0x25842c['body']['id']);})[_0xfceb('0x22')](respondWithResult(_0x3b76a8,null))[_0xfceb('0x2b')](handleError(_0x3b76a8,null));};exports[_0xfceb('0xa6')]=function(_0x2c63f0,_0x1bbd97,_0x37dece){var _0xf26e99={'raw':!![],'where':{}};var _0x3d2926={};var _0x31b4db={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x2c63f0[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x1bbd97,null))[_0xfceb('0x22')](function(_0xbd3b98){if(_0xbd3b98){_0x3d2926[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db[_0xfceb('0xa7')][_0xfceb('0x40')]);_0x3d2926[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x2c63f0['query']);_0x3d2926['filters']=_[_0xfceb('0x48')](_0x3d2926[_0xfceb('0x43')],_0x3d2926[_0xfceb('0x46')]);_0xf26e99[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x3d2926[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x2c63f0['query'][_0xfceb('0x4a')]));_0xf26e99[_0xfceb('0x49')]=_0xf26e99[_0xfceb('0x49')][_0xfceb('0x4b')]?_0xf26e99[_0xfceb('0x49')]:_0x3d2926[_0xfceb('0x43')];if(!_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x74')](_0xfceb('0x4c'))){_0xf26e99[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x4d')]);_0xf26e99[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x31')]);}_0xf26e99[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x4f')]);_0xf26e99[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_['pick'](_0x2c63f0[_0xfceb('0x46')],_0x3d2926[_0xfceb('0x47')]));_0xf26e99['where'][_0xfceb('0x6b')]=_0xbd3b98['id'];if(_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x52')]){_0xf26e99['where']=_['merge'](_0xf26e99['where'],{'$or':_[_0xfceb('0x44')](_0xf26e99['attributes'],function(_0x17298e){var _0x762bea={};_0x762bea[_0x17298e]={'$like':'%'+_0x2c63f0[_0xfceb('0x46')]['filter']+'%'};return _0x762bea;})});}if(_0x2c63f0[_0xfceb('0x46')]['$gte']){var _0x30d6a9=_0x2c63f0[_0xfceb('0x46')][_0xfceb('0xa8')][_0xfceb('0xa9')](',');var _0x5a2938={};_0x5a2938[_0x30d6a9[0x0]]={'$gte':moment(_0x30d6a9[0x1])[_0xfceb('0xaa')](_0xfceb('0xab'))};_0xf26e99['where']=_[_0xfceb('0x53')](_0xf26e99[_0xfceb('0x50')],_0x5a2938);}_0xf26e99=_['merge']({},_0xf26e99,_0x2c63f0[_0xfceb('0x55')]);return db['FaxMessage']['count']({'where':_0xf26e99[_0xfceb('0x50')]})[_0xfceb('0x22')](function(_0x63f1f3){_0x31b4db[_0xfceb('0x30')]=_0x63f1f3;if(_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x56')]){_0xf26e99['include']=[{'all':!![]}];}return db[_0xfceb('0xa7')][_0xfceb('0x58')](_0xf26e99);})[_0xfceb('0x22')](function(_0xe789a2){_0x31b4db['rows']=_0xe789a2;return _0x31b4db;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0x1bbd97,_0xf26e99))['catch'](handleError(_0x1bbd97,null));};exports[_0xfceb('0x3c')]=function(_0x58904a,_0x345fd5,_0x9bcc85){var _0xc64446,_0x4958b2={},_0x3fd46c;if(_0x58904a[_0xfceb('0x68')]['to']){_0x3fd46c=_0x58904a[_0xfceb('0x68')]['to'][0x0];}return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x58904a[_0xfceb('0x5b')]['id']},'include':[{'model':db[_0xfceb('0xac')],'as':_0xfceb('0xad'),'include':[{'model':db['CmContact'],'as':_0xfceb('0xae'),'where':{'fax':_0x3fd46c},'limit':0x1,'order':[['updatedAt',_0xfceb('0xaf')]]}]}]})['then'](handleEntityNotFound(_0x345fd5,null))[_0xfceb('0x22')](function(_0x4688be){_0xc64446=_0x4688be;if(_0x58904a['body'][_0xfceb('0xb0')]&&_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][_0xfceb('0x4b')]){for(var _0x4f08ad=0x0;_0x4f08ad<_0x58904a['body']['attachments'][_0xfceb('0x4b')];_0x4f08ad+=0x1){_0x58904a[_0xfceb('0x68')]['attachments'][_0x4f08ad]={'filename':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][_0x4f08ad][_0xfceb('0x45')],'id':_0x58904a['body'][_0xfceb('0xb0')][_0x4f08ad]['id'],'path':path[_0xfceb('0xb1')](config[_0xfceb('0xb2')],_0xfceb('0xb3'),_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][_0x4f08ad][_0xfceb('0xb4')])};}}return respondWithRpcPromise('CheckAfterSend',_0xfceb('0xb5'),{'FaxAccountId':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x5b')]['id'])?undefined:_0x58904a[_0xfceb('0x5b')]['id'],'path':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['path'])?undefined:_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['path'],'fax':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x68')]['to'][0x0])?undefined:_0x58904a[_0xfceb('0x68')]['to'][0x0]},client9002);})[_0xfceb('0x22')](function(){if(_0xc64446){if(_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x68')]['from'])){_0x58904a[_0xfceb('0x68')][_0xfceb('0xb7')]=util['format']('\x22%s\x22\x20<%s>',_0xc64446[_0xfceb('0x45')],_0xc64446[_0xfceb('0xb8')]);}if(_0xc64446['List']){if(_0xc64446[_0xfceb('0xad')][_0xfceb('0xae')][_0xfceb('0x4b')]){return _0xc64446['List']['Contacts'][0x0];}else{return db[_0xfceb('0x7a')]['create'](_[_0xfceb('0x1a')](_0x58904a[_0xfceb('0x68')],{'firstName':_0x58904a['body']['to'][0x0],'phone':_0x58904a[_0xfceb('0x68')]['to'][0x0],'fax':_0x58904a[_0xfceb('0x68')]['to'][0x0],'ListId':_0xc64446['ListId']}));}}else{throw new Error(_0xfceb('0xb9'));}}else{throw new Error(_0xfceb('0xba'));}})['then'](function(_0x429c7c){if(_0x429c7c){return db['FaxInteraction'][_0xfceb('0x5e')]({'where':{'ContactId':_0x429c7c['id'],'closed':![],'FaxAccountId':_0xc64446['id']}})[_0xfceb('0x22')](function(_0x23960e){if(_0x23960e){return[_0x23960e,![]];}return db[_0xfceb('0x79')][_0xfceb('0x5f')]({'UserId':_0x58904a[_0xfceb('0x60')]['id'],'ContactId':_0x429c7c['id'],'FaxAccountId':_0xc64446['id'],'fax':_0x58904a[_0xfceb('0x68')]['to'][0x0],'firstMsgDirection':_0xfceb('0xbb'),'Messages':[_[_0xfceb('0x53')](_0x58904a[_0xfceb('0x68')],{'read':![],'body':_0x58904a['body'][_0xfceb('0xb0')][0x0][_0xfceb('0xbc')],'FaxAccountId':_0xc64446['id'],'UserId':_0x58904a[_0xfceb('0x60')]['id'],'ContactId':_0x429c7c['id'],'AttachmentId':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xfceb('0xa7')],'as':_0xfceb('0xbd')}]})[_0xfceb('0x22')](function(_0x6dfab4){return[_0x6dfab4,!![]];});});}else{throw new Error(_0xfceb('0xbe'));}})[_0xfceb('0xbf')](function(_0x3d871c,_0x7006fd){if(_0x7006fd){return _0x3d871c;}return db[_0xfceb('0xa7')][_0xfceb('0x5f')]({'direction':'out','read':![],'body':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0][_0xfceb('0xbc')],'FaxAccountId':_0xc64446['id'],'FaxInteractionId':_0x3d871c['id'],'UserId':_0x58904a[_0xfceb('0x60')]['id'],'ContactId':_0x3d871c['ContactId'],'AttachmentId':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['id']})[_0xfceb('0x22')](function(_0x1b10f6){_0x3d871c[_0xfceb('0xc0')][_0xfceb('0xbd')]=[];_0x3d871c['dataValues'][_0xfceb('0xbd')]['push'](_0x1b10f6['dataValues']);return _0x3d871c;});})[_0xfceb('0x22')](function(_0x4cdbed){respondWithRpcPromise('SendFax',_0xfceb('0xc1'),{'FaxAccountId':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x5b')]['id'])?undefined:_0x58904a[_0xfceb('0x5b')]['id'],'path':_['isNil'](_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0][_0xfceb('0xc2')])?undefined:_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0][_0xfceb('0xc2')],'fax':_[_0xfceb('0xb6')](_0x58904a['body']['to'][0x0])?undefined:_0x58904a[_0xfceb('0x68')]['to'][0x0],'AttachmentId':_0x58904a['body'][_0xfceb('0xb0')][0x0]['id']},client9002)[_0xfceb('0x22')](function(_0x50dca3){logger['info'](_0xfceb('0xc3'),_0x50dca3);})[_0xfceb('0x2b')](function(_0x46a484){logger[_0xfceb('0x23')](_0xfceb('0xc3'),_0x46a484);});return _0x4cdbed;})['then'](respondWithResult(_0x345fd5,null))['catch'](handleError(_0x345fd5,null));};exports['addAgents']=function(_0x53e1c0,_0x2a8243,_0x2e3feb){return db['FaxAccount']['find']({'where':{'id':_0x53e1c0[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x2a8243,null))[_0xfceb('0x22')](function(_0x30bf30){if(_0x30bf30){return _0x30bf30[_0xfceb('0xc4')](_0x53e1c0[_0xfceb('0x68')][_0xfceb('0x6f')],_['omit'](_0x53e1c0[_0xfceb('0x68')],[_0xfceb('0x6f'),'id'])||{})[_0xfceb('0xbf')](function(_0x1eec98){for(var _0x4d63c8=0x0;_0x4d63c8<_0x53e1c0['body'][_0xfceb('0x6f')]['length'];_0x4d63c8+=0x1){socket['emit'](_0xfceb('0xc5'),{'UserId':_0x53e1c0['body'][_0xfceb('0x6f')][_0x4d63c8],'FaxAccountId':_0x53e1c0[_0xfceb('0x5b')]['id']});}return _0x1eec98;});}})[_0xfceb('0x22')](respondWithResult(_0x2a8243,null))[_0xfceb('0x2b')](handleError(_0x2a8243,null));};exports[_0xfceb('0xc6')]=function(_0x1c9163,_0x114a04,_0x4efbd4){return db['FaxAccount'][_0xfceb('0x5e')]({'where':{'id':_0x1c9163[_0xfceb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x114a04,null))['then'](function(_0x2f0fca){if(_0x2f0fca){return _0x2f0fca[_0xfceb('0xc6')](_0x1c9163[_0xfceb('0x46')]['ids'])[_0xfceb('0x22')](function(){if(_[_0xfceb('0xc7')](_0x1c9163[_0xfceb('0x46')][_0xfceb('0x6f')])){for(var _0x104424=0x0;_0x104424<_0x1c9163[_0xfceb('0x46')]['ids']['length'];_0x104424+=0x1){socket[_0xfceb('0xc8')](_0xfceb('0xc9'),{'UserId':Number(_0x1c9163['query'][_0xfceb('0x6f')][_0x104424]),'FaxAccountId':Number(_0x1c9163['params']['id'])});}}else{socket[_0xfceb('0xc8')](_0xfceb('0xc9'),{'UserId':Number(_0x1c9163[_0xfceb('0x46')][_0xfceb('0x6f')]),'FaxAccountId':Number(_0x1c9163[_0xfceb('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x114a04,null))[_0xfceb('0x2b')](handleError(_0x114a04,null));};exports[_0xfceb('0xca')]=function(_0x430d6f,_0x259b5a,_0x27630a){var _0x5d143b={};var _0x2186a9={};var _0x22f760;var _0xfd949a;return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x430d6f['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x259b5a,null))[_0xfceb('0x22')](function(_0x40a84b){if(_0x40a84b){_0x22f760=_0x40a84b;_0x2186a9[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db['User'][_0xfceb('0x40')]);_0x2186a9['query']=_[_0xfceb('0x5d')](_0x430d6f[_0xfceb('0x46')]);_0x2186a9['filters']=_[_0xfceb('0x48')](_0x2186a9[_0xfceb('0x43')],_0x2186a9[_0xfceb('0x46')]);_0x5d143b[_0xfceb('0x49')]=_['intersection'](_0x2186a9['model'],qs[_0xfceb('0x4a')](_0x430d6f['query'][_0xfceb('0x4a')]));_0x5d143b[_0xfceb('0x49')]=_0x5d143b['attributes']['length']?_0x5d143b[_0xfceb('0x49')]:_0x2186a9['model'];_0x5d143b[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x430d6f[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x5d143b[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_['pick'](_0x430d6f['query'],_0x2186a9[_0xfceb('0x47')]));if(_0x430d6f['query'][_0xfceb('0x52')]){_0x5d143b['where']=_['merge'](_0x5d143b['where'],{'$or':_[_0xfceb('0x44')](_0x5d143b['attributes'],function(_0x1ab026){var _0x28cc53={};_0x28cc53[_0x1ab026]={'$like':'%'+_0x430d6f[_0xfceb('0x46')][_0xfceb('0x52')]+'%'};return _0x28cc53;})});}_0x5d143b=_[_0xfceb('0x53')]({},_0x5d143b,_0x430d6f[_0xfceb('0x55')]);return _0x22f760[_0xfceb('0xca')](_0x5d143b);}})['then'](function(_0x242c48){if(_0x242c48){_0xfd949a=_0x242c48['length'];if(!_0x430d6f[_0xfceb('0x46')]['hasOwnProperty'](_0xfceb('0x4c'))){_0x5d143b[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x430d6f['query'][_0xfceb('0x4d')]);_0x5d143b[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0x430d6f[_0xfceb('0x46')]['offset']);}return _0x22f760[_0xfceb('0xca')](_0x5d143b);}})[_0xfceb('0x22')](function(_0x3899f1){if(_0x3899f1){return _0x3899f1?{'count':_0xfd949a,'rows':_0x3899f1}:null;}})[_0xfceb('0x22')](respondWithResult(_0x259b5a,null))[_0xfceb('0x2b')](handleError(_0x259b5a,null));}; \ No newline at end of file +var _0xcba7=['updatedAt','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','List\x20not\x20found','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','http','client','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','keys','query','filters','attributes','model','fields','length','nolimit','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','sort','removeDispositions','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','Tags','color','tag','addApplications','FaxApplication','findAndCountAll','getApplications','from-voip-provider','localstationid','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','sequelize','transaction','VoiceExtension','bulkCreate','updateAccountApplications','omit','tech','key','createdAt'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcba7,0x199));var _0x7cba=function(_0x20b1a7,_0x2f2ece){_0x20b1a7=_0x20b1a7-0x0;var _0x4d3a1a=_0xcba7[_0x20b1a7];return _0x4d3a1a;};'use strict';var pdf=require(_0x7cba('0x0'));var emlformat=require(_0x7cba('0x1'));var rimraf=require(_0x7cba('0x2'));var zipdir=require(_0x7cba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cba('0x4'));var moment=require(_0x7cba('0x5'));var BPromise=require(_0x7cba('0x6'));var Mustache=require('mustache');var util=require(_0x7cba('0x7'));var path=require(_0x7cba('0x8'));var sox=require(_0x7cba('0x9'));var csv=require(_0x7cba('0xa'));var ejs=require(_0x7cba('0xb'));var fs=require('fs');var _=require(_0x7cba('0xc'));var squel=require(_0x7cba('0xd'));var crypto=require(_0x7cba('0xe'));var jsforce=require(_0x7cba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7cba('0xa'));var querystring=require(_0x7cba('0x10'));var Papa=require(_0x7cba('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7cba('0x12'));var as=require(_0x7cba('0x13'));var hardwareService=require(_0x7cba('0x14'));var logger=require(_0x7cba('0x15'))('api');var utils=require(_0x7cba('0x16'));var config=require(_0x7cba('0x17'));var licenseUtil=require(_0x7cba('0x18'));var db=require(_0x7cba('0x19'))['db'];config[_0x7cba('0x1a')]=_[_0x7cba('0x1b')](config[_0x7cba('0x1a')],{'host':_0x7cba('0x1c'),'port':0x18eb});var socket=require(_0x7cba('0x1d'))(new Redis(config[_0x7cba('0x1a')]));require(_0x7cba('0x1e'))[_0x7cba('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7cba('0x20')]({'port':0x232c});var client9002=jayson[_0x7cba('0x21')][_0x7cba('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2b52a4,_0x38b935,_0x28dfd1,_0x384768){return new BPromise(function(_0x40c869,_0xa64089){var _0x39761b=_0x384768||client;return _0x39761b['request'](_0x2b52a4,_0x28dfd1)[_0x7cba('0x22')](function(_0x587c41){logger['info'](_0x7cba('0x23'),_0x38b935,_0x7cba('0x24'));logger[_0x7cba('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x38b935,_0x7cba('0x24'),JSON['stringify'](_0x587c41));if(_0x587c41[_0x7cba('0x26')]){if(_0x587c41['error']['code']===0x1f4){logger[_0x7cba('0x26')](_0x7cba('0x23'),_0x38b935,_0x587c41[_0x7cba('0x26')][_0x7cba('0x27')]);return _0xa64089(_0x587c41[_0x7cba('0x26')]['message']);}logger[_0x7cba('0x26')]('FaxAccount,\x20%s,\x20%s',_0x38b935,_0x587c41[_0x7cba('0x26')][_0x7cba('0x27')]);return _0x40c869(_0x587c41[_0x7cba('0x26')][_0x7cba('0x27')]);}else{logger[_0x7cba('0x28')](_0x7cba('0x23'),_0x38b935,_0x7cba('0x24'));_0x40c869(_0x587c41[_0x7cba('0x29')][_0x7cba('0x27')]);}})['catch'](function(_0x4e5974){logger[_0x7cba('0x26')]('FaxAccount,\x20%s,\x20%s',_0x38b935,_0x4e5974);_0xa64089(_0x4e5974);});});}function respondWithStatusCode(_0x4af3ab,_0x3c9dc0){_0x3c9dc0=_0x3c9dc0||0xcc;return function(_0x369b14){if(_0x369b14){return _0x4af3ab[_0x7cba('0x2a')](_0x3c9dc0);}return _0x4af3ab[_0x7cba('0x2b')](_0x3c9dc0)['end']();};}function respondWithResult(_0x35a10b,_0x5bdc3f){_0x5bdc3f=_0x5bdc3f||0xc8;return function(_0x5d9ce3){if(_0x5d9ce3){return _0x35a10b[_0x7cba('0x2b')](_0x5bdc3f)[_0x7cba('0x2c')](_0x5d9ce3);}};}function respondWithFilteredResult(_0x34a121,_0x336dcb){return function(_0x2f4f15){if(_0x2f4f15){var _0x213f3a=_0x2f4f15['count'],_0x296196=_0x336dcb[_0x7cba('0x2d')],_0x334a86=_0x336dcb['offset']+_0x336dcb[_0x7cba('0x2e')],_0x2d7d3c;if(_0x334a86>=_0x213f3a){_0x334a86=_0x213f3a;_0x2d7d3c=0xc8;}else{_0x2d7d3c=0xce;}_0x34a121[_0x7cba('0x2b')](_0x2d7d3c);return _0x34a121[_0x7cba('0x2f')](_0x7cba('0x30'),_0x296196+'-'+_0x334a86+'/'+_0x213f3a)[_0x7cba('0x2c')](_0x2f4f15);}return null;};}function patchUpdates(_0xdcfb3f){return function(_0x442c25){try{jsonpatch[_0x7cba('0x31')](_0x442c25,_0xdcfb3f,!![]);}catch(_0x4e9e93){return BPromise[_0x7cba('0x32')](_0x4e9e93);}return _0x442c25['save']();};}function saveUpdates(_0x2bad82,_0x13fdbd){return function(_0x3d29d1){if(_0x3d29d1){return _0x3d29d1[_0x7cba('0x33')](_0x2bad82)[_0x7cba('0x22')](function(_0x41661f){return _0x41661f;});}return null;};}function removeEntity(_0x59783f,_0x52866e){return function(_0x33bfd2){if(_0x33bfd2){return _0x33bfd2[_0x7cba('0x34')]()[_0x7cba('0x22')](function(){var _0x51061b=_0x33bfd2['get']({'plain':!![]});var _0x15da45='FaxAccounts';return db[_0x7cba('0x35')][_0x7cba('0x34')]({'where':{'type':_0x15da45,'resourceId':_0x51061b['id']}})[_0x7cba('0x22')](function(){return _0x33bfd2;});})[_0x7cba('0x22')](function(){_0x59783f[_0x7cba('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddcdc0,_0x2d964f){return function(_0x4687ac){if(!_0x4687ac){_0xddcdc0['sendStatus'](0x194);}return _0x4687ac;};}function handleError(_0x4c91af,_0x1dc306){_0x1dc306=_0x1dc306||0x1f4;return function(_0x5c4558){logger[_0x7cba('0x26')](_0x5c4558[_0x7cba('0x36')]);if(_0x5c4558['name']){delete _0x5c4558[_0x7cba('0x37')];}_0x4c91af[_0x7cba('0x2b')](_0x1dc306)[_0x7cba('0x38')](_0x5c4558);};}exports[_0x7cba('0x39')]=function(_0x45b688,_0x18f4c7){var _0x2b91c7={'include':[{'model':db[_0x7cba('0x3a')],'as':_0x7cba('0x3b')}]},_0x113e01={},_0x5a1b00={'count':0x0,'rows':[]};var _0x3937f0=_[_0x7cba('0x3c')](db[_0x7cba('0x3d')][_0x7cba('0x3e')],function(_0x29d901){return{'name':_0x29d901[_0x7cba('0x3f')],'type':_0x29d901[_0x7cba('0x40')]['key']};});_0x113e01['model']=_['map'](_0x3937f0,'name');_0x113e01['query']=_[_0x7cba('0x41')](_0x45b688[_0x7cba('0x42')]);_0x113e01[_0x7cba('0x43')]=_['intersection'](_0x113e01['model'],_0x113e01[_0x7cba('0x42')]);_0x2b91c7[_0x7cba('0x44')]=_['intersection'](_0x113e01[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0x45b688[_0x7cba('0x42')][_0x7cba('0x46')]));_0x2b91c7[_0x7cba('0x44')]=_0x2b91c7['attributes'][_0x7cba('0x47')]?_0x2b91c7[_0x7cba('0x44')]:_0x113e01[_0x7cba('0x45')];if(!_0x45b688[_0x7cba('0x42')]['hasOwnProperty'](_0x7cba('0x48'))){_0x2b91c7['limit']=qs[_0x7cba('0x2e')](_0x45b688[_0x7cba('0x42')][_0x7cba('0x2e')]);_0x2b91c7[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x45b688[_0x7cba('0x42')][_0x7cba('0x2d')]);}_0x2b91c7['order']=qs['sort'](_0x45b688[_0x7cba('0x42')]['sort']);_0x2b91c7['where']=qs[_0x7cba('0x43')](_[_0x7cba('0x49')](_0x45b688[_0x7cba('0x42')],_0x113e01[_0x7cba('0x43')]),_0x3937f0);if(_0x45b688[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x2b91c7[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x2b91c7[_0x7cba('0x4b')],{'$or':_[_0x7cba('0x3c')](_0x3937f0,function(_0x371443){if(_0x371443['type']!=='VIRTUAL'){var _0x5239be={};_0x5239be[_0x371443[_0x7cba('0x37')]]={'$like':'%'+_0x45b688['query'][_0x7cba('0x4a')]+'%'};return _0x5239be;}})});}_0x2b91c7=_[_0x7cba('0x4c')]({},_0x2b91c7,_0x45b688[_0x7cba('0x4d')]);var _0x2545dd={'where':_0x2b91c7[_0x7cba('0x4b')]};return db['FaxAccount'][_0x7cba('0x4e')](_0x2545dd)[_0x7cba('0x22')](function(_0x5b077f){_0x5a1b00[_0x7cba('0x4e')]=_0x5b077f;if(_0x45b688[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x2b91c7['include']=[{'all':!![]}];}return db['FaxAccount'][_0x7cba('0x50')](_0x2b91c7);})[_0x7cba('0x22')](function(_0xa43d7d){_0x5a1b00[_0x7cba('0x51')]=_0xa43d7d;return _0x5a1b00;})['then'](respondWithFilteredResult(_0x18f4c7,_0x2b91c7))[_0x7cba('0x52')](handleError(_0x18f4c7,null));};exports[_0x7cba('0x53')]=function(_0x2cbdd7,_0x250ee9){var _0x318865={'raw':![],'where':{'id':_0x2cbdd7[_0x7cba('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x7cba('0x3b')}]},_0x4aa094={};_0x4aa094[_0x7cba('0x45')]=_[_0x7cba('0x41')](db['FaxAccount'][_0x7cba('0x3e')]);_0x4aa094[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x2cbdd7['query']);_0x4aa094[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0x4aa094[_0x7cba('0x45')],_0x4aa094['query']);_0x318865[_0x7cba('0x44')]=_['intersection'](_0x4aa094['model'],qs[_0x7cba('0x46')](_0x2cbdd7[_0x7cba('0x42')][_0x7cba('0x46')]));_0x318865['attributes']=_0x318865[_0x7cba('0x44')][_0x7cba('0x47')]?_0x318865[_0x7cba('0x44')]:_0x4aa094['model'];if(_0x2cbdd7['query']['includeAll']){_0x318865[_0x7cba('0x56')]=[{'all':!![]}];}_0x318865=_[_0x7cba('0x4c')]({},_0x318865,_0x2cbdd7['options']);return db['FaxAccount'][_0x7cba('0x57')](_0x318865)[_0x7cba('0x22')](handleEntityNotFound(_0x250ee9,null))['then'](respondWithResult(_0x250ee9,null))[_0x7cba('0x52')](handleError(_0x250ee9,null));};exports[_0x7cba('0x58')]=function(_0x105993,_0x45b0ab){return db[_0x7cba('0x3d')][_0x7cba('0x58')](_0x105993[_0x7cba('0x59')],{})[_0x7cba('0x22')](function(_0x274982){var _0x2c1e2f=_0x105993[_0x7cba('0x5a')]['get']({'plain':!![]});if(!_0x2c1e2f)throw new Error(_0x7cba('0x5b'));if(_0x2c1e2f[_0x7cba('0x5c')]==='user'){var _0x45847e=_0x274982[_0x7cba('0x5d')]({'plain':!![]});var _0x2b7704='FaxAccounts';return db[_0x7cba('0x5e')]['find']({'where':{'name':_0x2b7704,'userProfileId':_0x2c1e2f[_0x7cba('0x5f')]},'raw':!![]})['then'](function(_0x3d21a2){if(_0x3d21a2&&_0x3d21a2[_0x7cba('0x60')]===0x0){return db[_0x7cba('0x35')][_0x7cba('0x58')]({'name':_0x45847e[_0x7cba('0x37')],'resourceId':_0x45847e['id'],'type':_0x3d21a2[_0x7cba('0x37')],'sectionId':_0x3d21a2['id']},{})[_0x7cba('0x22')](function(){return _0x274982;});}else{return _0x274982;}})['catch'](function(_0x297d10){logger[_0x7cba('0x26')](_0x7cba('0x61'),_0x297d10);throw _0x297d10;});}return _0x274982;})[_0x7cba('0x22')](respondWithResult(_0x45b0ab,0xc9))[_0x7cba('0x52')](handleError(_0x45b0ab,null));};exports['update']=function(_0x5d7eeb,_0x10a90a){if(_0x5d7eeb[_0x7cba('0x59')]['id']){delete _0x5d7eeb[_0x7cba('0x59')]['id'];}return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x5d7eeb[_0x7cba('0x54')]['id']},'include':[{'model':db[_0x7cba('0x3a')],'as':_0x7cba('0x3b')}]})[_0x7cba('0x22')](handleEntityNotFound(_0x10a90a,null))[_0x7cba('0x22')](saveUpdates(_0x5d7eeb[_0x7cba('0x59')],null))[_0x7cba('0x22')](respondWithResult(_0x10a90a,null))[_0x7cba('0x52')](handleError(_0x10a90a,null));};exports[_0x7cba('0x34')]=function(_0x41d7b9,_0x1969cc){return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x41d7b9['params']['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x1969cc,null))[_0x7cba('0x22')](removeEntity(_0x1969cc,null))['catch'](handleError(_0x1969cc,null));};exports[_0x7cba('0x62')]=function(_0xa7db5e,_0x79d95d){return db[_0x7cba('0x3d')]['describe']()[_0x7cba('0x22')](respondWithResult(_0x79d95d,null))[_0x7cba('0x52')](handleError(_0x79d95d,null));};exports[_0x7cba('0x63')]=function(_0x2649f6,_0x30fac5,_0x38064d){if(_0x2649f6['body']['id']){delete _0x2649f6[_0x7cba('0x59')]['id'];}return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x2649f6[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x30fac5,null))[_0x7cba('0x22')](function(_0x38ce3d){if(_0x38ce3d){_0x2649f6[_0x7cba('0x59')][_0x7cba('0x64')]=_0x38ce3d['id'];return db[_0x7cba('0x65')][_0x7cba('0x58')](_0x2649f6[_0x7cba('0x59')]);}})[_0x7cba('0x22')](respondWithResult(_0x30fac5,null))[_0x7cba('0x52')](handleError(_0x30fac5,null));};exports[_0x7cba('0x66')]=function(_0x31489d,_0x389a56,_0x43559e){var _0x56108c={'raw':![],'where':{}};var _0x24cac9={};var _0x23f680={'count':0x0,'rows':[]};return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0x31489d[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x389a56,null))['then'](function(_0x280cf2){if(_0x280cf2){_0x24cac9[_0x7cba('0x45')]=_[_0x7cba('0x41')](db[_0x7cba('0x65')][_0x7cba('0x3e')]);_0x24cac9[_0x7cba('0x42')]=_['keys'](_0x31489d['query']);_0x24cac9[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0x24cac9[_0x7cba('0x45')],_0x24cac9[_0x7cba('0x42')]);_0x56108c[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0x24cac9[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0x31489d[_0x7cba('0x42')][_0x7cba('0x46')]));_0x56108c[_0x7cba('0x44')]=_0x56108c['attributes']['length']?_0x56108c[_0x7cba('0x44')]:_0x24cac9[_0x7cba('0x45')];if(!_0x31489d[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x56108c[_0x7cba('0x2e')]=qs[_0x7cba('0x2e')](_0x31489d['query'][_0x7cba('0x2e')]);_0x56108c[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x31489d[_0x7cba('0x42')][_0x7cba('0x2d')]);}_0x56108c[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0x31489d[_0x7cba('0x42')]['sort']);_0x56108c[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_[_0x7cba('0x49')](_0x31489d[_0x7cba('0x42')],_0x24cac9[_0x7cba('0x43')]));_0x56108c[_0x7cba('0x4b')][_0x7cba('0x64')]=_0x280cf2['id'];if(_0x31489d[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x56108c[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x56108c['where'],{'$or':_[_0x7cba('0x3c')](_0x56108c[_0x7cba('0x44')],function(_0x34b225){var _0x47f6a1={};_0x47f6a1[_0x34b225]={'$like':'%'+_0x31489d[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x47f6a1;})});}_0x56108c=_[_0x7cba('0x4c')]({},_0x56108c,_0x31489d[_0x7cba('0x4d')]);return db[_0x7cba('0x65')]['count']({'where':_0x56108c[_0x7cba('0x4b')]})[_0x7cba('0x22')](function(_0x2289c2){_0x23f680[_0x7cba('0x4e')]=_0x2289c2;if(_0x31489d[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x56108c['include']=[{'all':!![]}];}return db[_0x7cba('0x65')][_0x7cba('0x50')](_0x56108c);})['then'](function(_0x30ab3e){_0x23f680[_0x7cba('0x51')]=_0x30ab3e;return _0x23f680;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x389a56,_0x56108c))[_0x7cba('0x52')](handleError(_0x389a56,null));};exports[_0x7cba('0x6b')]=function(_0x799ef1,_0x53731d,_0x426cb6){return db['FaxAccount']['find']({'where':{'id':_0x799ef1[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x53731d,null))['then'](function(_0x1b9341){if(_0x1b9341){return _0x1b9341[_0x7cba('0x6b')](_0x799ef1[_0x7cba('0x42')]['ids']);}})[_0x7cba('0x22')](respondWithStatusCode(_0x53731d,null))[_0x7cba('0x52')](handleError(_0x53731d,null));};exports['addAnswer']=function(_0x14eedb,_0x58e5bb,_0x3e0edf){if(_0x14eedb[_0x7cba('0x59')]['id']){delete _0x14eedb[_0x7cba('0x59')]['id'];}return db[_0x7cba('0x3d')]['find']({'where':{'id':_0x14eedb[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x58e5bb,null))[_0x7cba('0x22')](function(_0x43a3ea){if(_0x43a3ea){_0x14eedb[_0x7cba('0x59')][_0x7cba('0x64')]=_0x43a3ea['id'];return db[_0x7cba('0x6c')][_0x7cba('0x58')](_0x14eedb['body']);}})[_0x7cba('0x22')](respondWithResult(_0x58e5bb,null))['catch'](handleError(_0x58e5bb,null));};exports['getAnswers']=function(_0x5bd2a2,_0x566015,_0x25375b){var _0x47c618={'raw':![],'where':{}};var _0xe7acf9={};var _0x2d5ee0={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7cba('0x67')]({'where':{'id':_0x5bd2a2['params']['id']}})['then'](handleEntityNotFound(_0x566015,null))[_0x7cba('0x22')](function(_0x385ee3){if(_0x385ee3){_0xe7acf9['model']=_['keys'](db['CannedAnswer'][_0x7cba('0x3e')]);_0xe7acf9[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x5bd2a2[_0x7cba('0x42')]);_0xe7acf9[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0xe7acf9[_0x7cba('0x45')],_0xe7acf9[_0x7cba('0x42')]);_0x47c618[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0xe7acf9[_0x7cba('0x45')],qs['fields'](_0x5bd2a2[_0x7cba('0x42')]['fields']));_0x47c618[_0x7cba('0x44')]=_0x47c618[_0x7cba('0x44')][_0x7cba('0x47')]?_0x47c618[_0x7cba('0x44')]:_0xe7acf9[_0x7cba('0x45')];if(!_0x5bd2a2[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x47c618[_0x7cba('0x2e')]=qs[_0x7cba('0x2e')](_0x5bd2a2['query'][_0x7cba('0x2e')]);_0x47c618[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x5bd2a2['query'][_0x7cba('0x2d')]);}_0x47c618[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0x5bd2a2['query']['sort']);_0x47c618[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_['pick'](_0x5bd2a2[_0x7cba('0x42')],_0xe7acf9['filters']));_0x47c618[_0x7cba('0x4b')]['FaxAccountId']=_0x385ee3['id'];if(_0x5bd2a2[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x47c618[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x47c618['where'],{'$or':_[_0x7cba('0x3c')](_0x47c618[_0x7cba('0x44')],function(_0x16b58d){var _0x5c8e5a={};_0x5c8e5a[_0x16b58d]={'$like':'%'+_0x5bd2a2['query']['filter']+'%'};return _0x5c8e5a;})});}_0x47c618=_[_0x7cba('0x4c')]({},_0x47c618,_0x5bd2a2[_0x7cba('0x4d')]);return db[_0x7cba('0x6c')][_0x7cba('0x4e')]({'where':_0x47c618[_0x7cba('0x4b')]})[_0x7cba('0x22')](function(_0x3be288){_0x2d5ee0[_0x7cba('0x4e')]=_0x3be288;if(_0x5bd2a2[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x47c618[_0x7cba('0x56')]=[{'all':!![]}];}return db[_0x7cba('0x6c')][_0x7cba('0x50')](_0x47c618);})[_0x7cba('0x22')](function(_0x4453bb){_0x2d5ee0['rows']=_0x4453bb;return _0x2d5ee0;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x566015,_0x47c618))[_0x7cba('0x52')](handleError(_0x566015,null));};exports[_0x7cba('0x6d')]=function(_0xf73b4c,_0x5af350,_0x33f456){return db[_0x7cba('0x3d')]['find']({'where':{'id':_0xf73b4c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x5af350,null))[_0x7cba('0x22')](function(_0x40e1a0){if(_0x40e1a0){return _0x40e1a0[_0x7cba('0x6d')](_0xf73b4c[_0x7cba('0x42')][_0x7cba('0x6e')]);}})[_0x7cba('0x22')](respondWithStatusCode(_0x5af350,null))['catch'](handleError(_0x5af350,null));};exports[_0x7cba('0x6f')]=function(_0x361e4e,_0x15c8f6,_0x5243b8){return db[_0x7cba('0x70')][_0x7cba('0x57')]({'where':{'id':_0x361e4e[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x15c8f6,null))[_0x7cba('0x22')](function(_0x5b0f87){if(_0x5b0f87){return _0x5b0f87['addInteraction'](_0x361e4e[_0x7cba('0x59')][_0x7cba('0x6e')],_['omit'](_0x361e4e[_0x7cba('0x59')],['ids','id'])||{});}})[_0x7cba('0x22')](respondWithResult(_0x15c8f6,null))[_0x7cba('0x52')](handleError(_0x15c8f6,null));};exports[_0x7cba('0x71')]=function(_0x14046d,_0x3efb71,_0x7e7ec3){var _0x2fcf0e={'raw':![],'where':{}};var _0x4dc337={};var _0x2ca57f={'count':0x0,'rows':[]};return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0x14046d[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x3efb71,null))[_0x7cba('0x22')](function(_0x1b04f8){if(_0x1b04f8){_0x4dc337['model']=_['keys'](db[_0x7cba('0x70')][_0x7cba('0x3e')]);_0x4dc337[_0x7cba('0x42')]=_['keys'](_0x14046d[_0x7cba('0x42')]);_0x4dc337['filters']=_['intersection'](_0x4dc337[_0x7cba('0x45')],_0x4dc337[_0x7cba('0x42')]);_0x2fcf0e[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0x4dc337['model'],qs[_0x7cba('0x46')](_0x14046d['query'][_0x7cba('0x46')]));_0x2fcf0e[_0x7cba('0x44')]=_0x2fcf0e[_0x7cba('0x44')][_0x7cba('0x47')]?_0x2fcf0e['attributes']:_0x4dc337[_0x7cba('0x45')];if(!_0x14046d['query'][_0x7cba('0x68')](_0x7cba('0x48'))){_0x2fcf0e[_0x7cba('0x2e')]=qs['limit'](_0x14046d[_0x7cba('0x42')]['limit']);_0x2fcf0e[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x14046d[_0x7cba('0x42')][_0x7cba('0x2d')]);}_0x2fcf0e[_0x7cba('0x69')]=qs['sort'](_0x14046d[_0x7cba('0x42')]['sort']);_0x2fcf0e[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_['pick'](_0x14046d[_0x7cba('0x42')],_0x4dc337[_0x7cba('0x43')]));_0x2fcf0e[_0x7cba('0x4b')][_0x7cba('0x64')]=_0x1b04f8['id'];if(_0x14046d[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x2fcf0e['where']=_[_0x7cba('0x4c')](_0x2fcf0e['where'],{'$or':_['map'](_0x2fcf0e[_0x7cba('0x44')],function(_0x16872){var _0x5a3940={};_0x5a3940[_0x16872]={'$like':'%'+_0x14046d[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x5a3940;})});}_0x2fcf0e=_[_0x7cba('0x4c')]({},_0x2fcf0e,_0x14046d[_0x7cba('0x4d')]);return db[_0x7cba('0x70')]['count']({'where':_0x2fcf0e[_0x7cba('0x4b')]})['then'](function(_0x5597d1){_0x2ca57f[_0x7cba('0x4e')]=_0x5597d1;if(_0x14046d[_0x7cba('0x42')][_0x7cba('0x4f')]){_0x2fcf0e[_0x7cba('0x56')]=[{'model':db['CmContact'],'as':_0x7cba('0x72'),'required':![]},{'model':db[_0x7cba('0x73')],'as':_0x7cba('0x74'),'attributes':[_0x7cba('0x37'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x7cba('0x75'),'attributes':['id',_0x7cba('0x37'),_0x7cba('0x76')],'where':_0x14046d['query'][_0x7cba('0x77')]?{'id':_0x14046d['query'][_0x7cba('0x77')]}:undefined,'required':_0x14046d[_0x7cba('0x42')][_0x7cba('0x77')]?!![]:![]}];}return db[_0x7cba('0x70')][_0x7cba('0x50')](_0x2fcf0e);})[_0x7cba('0x22')](function(_0x440b53){_0x2ca57f[_0x7cba('0x51')]=_0x440b53;return _0x2ca57f;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x3efb71,_0x2fcf0e))[_0x7cba('0x52')](handleError(_0x3efb71,null));};exports[_0x7cba('0x78')]=function(_0x179160,_0x226368,_0x409378){return db['FaxAccount'][_0x7cba('0x67')]({'where':{'id':_0x179160[_0x7cba('0x54')]['id']}})['then'](handleEntityNotFound(_0x226368,null))[_0x7cba('0x22')](function(_0x3724f1){if(_0x3724f1){return db['sequelize']['transaction'](function(_0x230e06){return db[_0x7cba('0x79')][_0x7cba('0x34')]({'where':{'FaxAccountId':_0x179160[_0x7cba('0x54')]['id']},'transaction':_0x230e06})[_0x7cba('0x22')](function(_0x55e054){var _0x2e1ff8=_[_0x7cba('0x3c')](_0x179160['body'],function(_0x228b59){_0x228b59[_0x7cba('0x64')]=_0x179160[_0x7cba('0x54')]['id'];return _0x228b59;});return db['FaxApplication']['bulkCreate'](_0x2e1ff8,{'transaction':_0x230e06});});})[_0x7cba('0x22')](function(){return db[_0x7cba('0x79')][_0x7cba('0x7a')]({'where':{'FaxAccountId':_0x179160['params']['id']},'order':'priority'});});}})[_0x7cba('0x22')](respondWithResult(_0x226368,null))[_0x7cba('0x52')](handleError(_0x226368,null));};exports[_0x7cba('0x7b')]=function(_0x241a68,_0x45bd00,_0x2a19d5){var _0x57d0f6={};var _0x4e8a71={};var _0x428a86;var _0x56df50;return db[_0x7cba('0x3d')]['findOne']({'where':{'id':_0x241a68[_0x7cba('0x54')]['id']}})['then'](handleEntityNotFound(_0x45bd00,null))['then'](function(_0x3dabe4){if(_0x3dabe4){_0x428a86=_0x3dabe4;_0x4e8a71['model']=_[_0x7cba('0x41')](db[_0x7cba('0x79')][_0x7cba('0x3e')]);_0x4e8a71[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x241a68['query']);_0x4e8a71['filters']=_[_0x7cba('0x55')](_0x4e8a71[_0x7cba('0x45')],_0x4e8a71['query']);_0x57d0f6[_0x7cba('0x44')]=_[_0x7cba('0x55')](_0x4e8a71[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0x241a68[_0x7cba('0x42')][_0x7cba('0x46')]));_0x57d0f6['attributes']=_0x57d0f6[_0x7cba('0x44')]['length']?_0x57d0f6[_0x7cba('0x44')]:_0x4e8a71['model'];_0x57d0f6[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0x241a68[_0x7cba('0x42')][_0x7cba('0x6a')]);_0x57d0f6[_0x7cba('0x4b')]=qs[_0x7cba('0x43')](_['pick'](_0x241a68[_0x7cba('0x42')],_0x4e8a71[_0x7cba('0x43')]));if(_0x241a68[_0x7cba('0x42')]['filter']){_0x57d0f6[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x57d0f6['where'],{'$or':_['map'](_0x57d0f6[_0x7cba('0x44')],function(_0x23880f){var _0x3ae95f={};_0x3ae95f[_0x23880f]={'$like':'%'+_0x241a68[_0x7cba('0x42')]['filter']+'%'};return _0x3ae95f;})});}_0x57d0f6=_[_0x7cba('0x4c')]({},_0x57d0f6,_0x241a68[_0x7cba('0x4d')]);return _0x428a86[_0x7cba('0x7b')](_0x57d0f6);}})[_0x7cba('0x22')](function(_0x44af9d){if(_0x44af9d){_0x56df50=_0x44af9d[_0x7cba('0x47')];if(!_0x241a68['query'][_0x7cba('0x68')](_0x7cba('0x48'))){_0x57d0f6['limit']=qs[_0x7cba('0x2e')](_0x241a68[_0x7cba('0x42')]['limit']);_0x57d0f6[_0x7cba('0x2d')]=qs['offset'](_0x241a68[_0x7cba('0x42')][_0x7cba('0x2d')]);}return _0x428a86[_0x7cba('0x7b')](_0x57d0f6);}})[_0x7cba('0x22')](function(_0x3c36f5){if(_0x3c36f5){return _0x3c36f5?{'count':_0x56df50,'rows':_0x3c36f5}:null;}})[_0x7cba('0x22')](respondWithResult(_0x45bd00,null))[_0x7cba('0x52')](handleError(_0x45bd00,null));};function Extension(_0x13a166,_0x5c6784,_0x594294,_0x336292){this['context']=_0x7cba('0x7c');this['exten']=_0x13a166[_0x7cba('0x7d')];this['app']=_0x336292;this[_0x7cba('0x40')]=_0x7cba('0x7e');this[_0x7cba('0x7f')]=_0x7cba('0x80');this['FaxAccountId']=_0x13a166['id'];this['priority']=_0x5c6784;this[_0x7cba('0x81')]=_0x594294;}function createExtensionsReciveFax(_0x3d5e0f){var _0x1e1f33=0x1;var _0x5e1318=[];_0x5e1318[_0x7cba('0x82')](new Extension(_0x3d5e0f,_0x1e1f33,'','Answer'));_0x1e1f33+=0x1;_0x5e1318[_0x7cba('0x82')](new Extension(_0x3d5e0f,_0x1e1f33,_0x7cba('0x83'),_0x7cba('0x84')));_0x1e1f33+=0x1;for(var _0x5e5f9c in _0x3d5e0f){if(_0x3d5e0f['hasOwnProperty'](_0x5e5f9c)&&(_0x5e5f9c===_0x7cba('0x85')||_0x5e5f9c===_0x7cba('0x7d')||_0x5e5f9c===_0x7cba('0x86')||_0x5e5f9c===_0x7cba('0x87')||_0x5e5f9c===_0x7cba('0x88')||_0x5e5f9c==='maxrate'||_0x5e5f9c===_0x7cba('0x89')||_0x5e5f9c===_0x7cba('0x8a')||_0x5e5f9c==='t38timeout')){_0x5e1318['push'](new Extension(_0x3d5e0f,_0x1e1f33,_0x7cba('0x8b')+_0x5e5f9c+')='+_0x3d5e0f[_0x5e5f9c],_0x7cba('0x84')));_0x1e1f33+=0x1;}}_0x5e1318[_0x7cba('0x82')](new Extension(_0x3d5e0f,_0x1e1f33,'6',_0x7cba('0x8c')));_0x1e1f33+=0x1;_0x5e1318['push'](new Extension(_0x3d5e0f,_0x1e1f33,_0x7cba('0x8d'),_0x7cba('0x8e')));_0x1e1f33=0x0;return _0x5e1318;}exports['addAccountApplications']=function(_0x3a33f6,_0x37224d,_0x35a9a6){var _0x2085e5;return db[_0x7cba('0x8f')][_0x7cba('0x90')](function(_0x52b8be){return db[_0x7cba('0x3d')]['create'](_0x3a33f6[_0x7cba('0x59')],{'transaction':_0x52b8be})['then'](function(_0x390f7a){_0x2085e5=_0x390f7a['get']({'plain':!![]});return db[_0x7cba('0x91')][_0x7cba('0x92')](createExtensionsReciveFax(_0x2085e5),{'transaction':_0x52b8be});});})['then'](function(){return _0x2085e5;})['then'](respondWithResult(_0x37224d,null))[_0x7cba('0x52')](handleError(_0x37224d,null));};exports[_0x7cba('0x93')]=function(_0x52a489,_0x34aef3,_0x5147ff){var _0x3882f1;return db[_0x7cba('0x8f')][_0x7cba('0x90')](function(_0x26832c){return db[_0x7cba('0x3d')][_0x7cba('0x33')](_0x52a489[_0x7cba('0x59')],{'where':{'id':_0x52a489['body']['id']},'transaction':_0x26832c})[_0x7cba('0x22')](function(_0x3a7906){return db[_0x7cba('0x91')]['destroy']({'where':{'FaxAccountId':_0x52a489[_0x7cba('0x59')]['id']},'transaction':_0x26832c})['then'](function(_0xf60ff3){return db[_0x7cba('0x91')][_0x7cba('0x92')](createExtensionsReciveFax(_[_0x7cba('0x94')](_0x52a489['body'],[_0x7cba('0x95'),_0x7cba('0x96'),_0x7cba('0x97'),_0x7cba('0x98'),'TrunkId','ListId'])),{'transaction':_0x26832c});});});})[_0x7cba('0x22')](function(){return db['FaxAccount'][_0x7cba('0x99')](_0x52a489[_0x7cba('0x59')]['id']);})['then'](respondWithResult(_0x34aef3,null))[_0x7cba('0x52')](handleError(_0x34aef3,null));};exports[_0x7cba('0x9a')]=function(_0xb8466c,_0x42450e,_0x3c17eb){var _0x50a910={'raw':!![],'where':{}};var _0x53755c={};var _0x45ada2={'count':0x0,'rows':[]};return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0xb8466c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x42450e,null))[_0x7cba('0x22')](function(_0x278563){if(_0x278563){_0x53755c['model']=_[_0x7cba('0x41')](db[_0x7cba('0x9b')][_0x7cba('0x3e')]);_0x53755c[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0xb8466c[_0x7cba('0x42')]);_0x53755c['filters']=_[_0x7cba('0x55')](_0x53755c['model'],_0x53755c[_0x7cba('0x42')]);_0x50a910['attributes']=_['intersection'](_0x53755c[_0x7cba('0x45')],qs[_0x7cba('0x46')](_0xb8466c['query'][_0x7cba('0x46')]));_0x50a910['attributes']=_0x50a910['attributes'][_0x7cba('0x47')]?_0x50a910[_0x7cba('0x44')]:_0x53755c[_0x7cba('0x45')];if(!_0xb8466c[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x50a910[_0x7cba('0x2e')]=qs[_0x7cba('0x2e')](_0xb8466c[_0x7cba('0x42')]['limit']);_0x50a910[_0x7cba('0x2d')]=qs['offset'](_0xb8466c['query'][_0x7cba('0x2d')]);}_0x50a910[_0x7cba('0x69')]=qs[_0x7cba('0x6a')](_0xb8466c[_0x7cba('0x42')][_0x7cba('0x6a')]);_0x50a910['where']=qs[_0x7cba('0x43')](_[_0x7cba('0x49')](_0xb8466c[_0x7cba('0x42')],_0x53755c['filters']));_0x50a910[_0x7cba('0x4b')][_0x7cba('0x64')]=_0x278563['id'];if(_0xb8466c[_0x7cba('0x42')][_0x7cba('0x4a')]){_0x50a910[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x50a910[_0x7cba('0x4b')],{'$or':_['map'](_0x50a910[_0x7cba('0x44')],function(_0x4d5b25){var _0x141bac={};_0x141bac[_0x4d5b25]={'$like':'%'+_0xb8466c[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x141bac;})});}if(_0xb8466c[_0x7cba('0x42')][_0x7cba('0x9c')]){var _0x42590a=_0xb8466c[_0x7cba('0x42')]['$gte'][_0x7cba('0x9d')](',');var _0x247755={};_0x247755[_0x42590a[0x0]]={'$gte':moment(_0x42590a[0x1])['format'](_0x7cba('0x9e'))};_0x50a910[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x50a910[_0x7cba('0x4b')],_0x247755);}_0x50a910=_['merge']({},_0x50a910,_0xb8466c[_0x7cba('0x4d')]);return db[_0x7cba('0x9b')][_0x7cba('0x4e')]({'where':_0x50a910[_0x7cba('0x4b')]})[_0x7cba('0x22')](function(_0x47537f){_0x45ada2['count']=_0x47537f;if(_0xb8466c['query']['includeAll']){_0x50a910[_0x7cba('0x56')]=[{'all':!![]}];}return db[_0x7cba('0x9b')][_0x7cba('0x50')](_0x50a910);})['then'](function(_0x4b4760){_0x45ada2[_0x7cba('0x51')]=_0x4b4760;return _0x45ada2;});}})[_0x7cba('0x22')](respondWithFilteredResult(_0x42450e,_0x50a910))[_0x7cba('0x52')](handleError(_0x42450e,null));};exports[_0x7cba('0x38')]=function(_0x30bf1e,_0x5a5fa5,_0x48862c){var _0x2a2db6,_0x2e0445={},_0x2dbbaf;if(_0x30bf1e[_0x7cba('0x59')]['to']){_0x2dbbaf=_0x30bf1e[_0x7cba('0x59')]['to'][0x0];}return db['FaxAccount'][_0x7cba('0x57')]({'where':{'id':_0x30bf1e[_0x7cba('0x54')]['id']},'include':[{'model':db[_0x7cba('0x9f')],'as':_0x7cba('0xa0'),'include':[{'model':db[_0x7cba('0xa1')],'as':'Contacts','where':{'fax':_0x2dbbaf},'limit':0x1,'order':[[_0x7cba('0x98'),_0x7cba('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x5a5fa5,null))[_0x7cba('0x22')](function(_0xae351a){_0x2a2db6=_0xae351a;if(_0x30bf1e['body'][_0x7cba('0xa3')]&&_0x30bf1e[_0x7cba('0x59')]['attachments'][_0x7cba('0x47')]){for(var _0x2a6b67=0x0;_0x2a6b67<_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][_0x7cba('0x47')];_0x2a6b67+=0x1){_0x30bf1e[_0x7cba('0x59')]['attachments'][_0x2a6b67]={'filename':_0x30bf1e['body'][_0x7cba('0xa3')][_0x2a6b67][_0x7cba('0x37')],'id':_0x30bf1e['body'][_0x7cba('0xa3')][_0x2a6b67]['id'],'path':path[_0x7cba('0xa4')](config[_0x7cba('0xa5')],_0x7cba('0xa6'),_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][_0x2a6b67][_0x7cba('0xa7')])};}}return respondWithRpcPromise(_0x7cba('0xa8'),_0x7cba('0xa8'),{'FaxAccountId':_['isNil'](_0x30bf1e[_0x7cba('0x54')]['id'])?undefined:_0x30bf1e[_0x7cba('0x54')]['id'],'path':_[_0x7cba('0xa9')](_0x30bf1e['body'][_0x7cba('0xa3')][0x0]['path'])?undefined:_0x30bf1e[_0x7cba('0x59')]['attachments'][0x0]['path'],'fax':_[_0x7cba('0xa9')](_0x30bf1e[_0x7cba('0x59')]['to'][0x0])?undefined:_0x30bf1e[_0x7cba('0x59')]['to'][0x0]},client9002);})[_0x7cba('0x22')](function(){if(_0x2a2db6){if(_[_0x7cba('0xa9')](_0x30bf1e['body'][_0x7cba('0xaa')])){_0x30bf1e['body'][_0x7cba('0xaa')]=util[_0x7cba('0xab')](_0x7cba('0xac'),_0x2a2db6[_0x7cba('0x37')],_0x2a2db6['fax']);}if(_0x2a2db6[_0x7cba('0xa0')]){if(_0x2a2db6[_0x7cba('0xa0')]['Contacts'][_0x7cba('0x47')]){return _0x2a2db6[_0x7cba('0xa0')]['Contacts'][0x0];}else{return db['CmContact'][_0x7cba('0x58')](_[_0x7cba('0x1b')](_0x30bf1e[_0x7cba('0x59')],{'firstName':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'phone':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'fax':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'ListId':_0x2a2db6['ListId']}));}}else{throw new Error(_0x7cba('0xad'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x7cba('0x22')](function(_0x337f6c){if(_0x337f6c){return db[_0x7cba('0x70')][_0x7cba('0x57')]({'where':{'ContactId':_0x337f6c['id'],'closed':![],'FaxAccountId':_0x2a2db6['id']}})['then'](function(_0xcca374){if(_0xcca374){return[_0xcca374,![]];}return db[_0x7cba('0x70')][_0x7cba('0x58')]({'UserId':_0x30bf1e['user']['id'],'ContactId':_0x337f6c['id'],'FaxAccountId':_0x2a2db6['id'],'fax':_0x30bf1e[_0x7cba('0x59')]['to'][0x0],'firstMsgDirection':_0x7cba('0xae'),'Messages':[_['merge'](_0x30bf1e[_0x7cba('0x59')],{'read':![],'body':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0][_0x7cba('0xaf')],'FaxAccountId':_0x2a2db6['id'],'UserId':_0x30bf1e[_0x7cba('0x5a')]['id'],'ContactId':_0x337f6c['id'],'AttachmentId':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0x7cba('0x9b')],'as':'Messages'}]})[_0x7cba('0x22')](function(_0x115e08){return[_0x115e08,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7cba('0xb0')](function(_0x73e441,_0x68d14b){if(_0x68d14b){return _0x73e441;}return db[_0x7cba('0x9b')][_0x7cba('0x58')]({'direction':_0x7cba('0xae'),'read':![],'body':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0][_0x7cba('0xaf')],'FaxAccountId':_0x2a2db6['id'],'FaxInteractionId':_0x73e441['id'],'UserId':_0x30bf1e[_0x7cba('0x5a')]['id'],'ContactId':_0x73e441[_0x7cba('0xb1')],'AttachmentId':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['id']})[_0x7cba('0x22')](function(_0x8b5a36){_0x73e441[_0x7cba('0xb2')][_0x7cba('0xb3')]=[];_0x73e441[_0x7cba('0xb2')][_0x7cba('0xb3')][_0x7cba('0x82')](_0x8b5a36[_0x7cba('0xb2')]);return _0x73e441;});})[_0x7cba('0x22')](function(_0x36b43a){respondWithRpcPromise(_0x7cba('0xb4'),_0x7cba('0xb4'),{'FaxAccountId':_[_0x7cba('0xa9')](_0x30bf1e[_0x7cba('0x54')]['id'])?undefined:_0x30bf1e[_0x7cba('0x54')]['id'],'path':_[_0x7cba('0xa9')](_0x30bf1e['body'][_0x7cba('0xa3')][0x0][_0x7cba('0x8')])?undefined:_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['path'],'fax':_[_0x7cba('0xa9')](_0x30bf1e[_0x7cba('0x59')]['to'][0x0])?undefined:_0x30bf1e['body']['to'][0x0],'AttachmentId':_0x30bf1e[_0x7cba('0x59')][_0x7cba('0xa3')][0x0]['id']},client9002)[_0x7cba('0x22')](function(_0x360ea9){logger[_0x7cba('0x28')](_0x7cba('0xb5'),_0x360ea9);})[_0x7cba('0x52')](function(_0x1cb9bc){logger[_0x7cba('0x28')](_0x7cba('0xb5'),_0x1cb9bc);});return _0x36b43a;})[_0x7cba('0x22')](respondWithResult(_0x5a5fa5,null))[_0x7cba('0x52')](handleError(_0x5a5fa5,null));};exports['addAgents']=function(_0x40d60c,_0x5e44d2,_0x550972){return db['FaxAccount']['find']({'where':{'id':_0x40d60c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x5e44d2,null))[_0x7cba('0x22')](function(_0x36b83f){if(_0x36b83f){return _0x36b83f[_0x7cba('0xb6')](_0x40d60c['body']['ids'],_[_0x7cba('0x94')](_0x40d60c[_0x7cba('0x59')],['ids','id'])||{})[_0x7cba('0xb0')](function(_0x7d7449){for(var _0x59bff7=0x0;_0x59bff7<_0x40d60c[_0x7cba('0x59')][_0x7cba('0x6e')][_0x7cba('0x47')];_0x59bff7+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x40d60c[_0x7cba('0x59')][_0x7cba('0x6e')][_0x59bff7],'FaxAccountId':_0x40d60c['params']['id']});}return _0x7d7449;});}})[_0x7cba('0x22')](respondWithResult(_0x5e44d2,null))['catch'](handleError(_0x5e44d2,null));};exports[_0x7cba('0xb7')]=function(_0x6d61c,_0x12e1ff,_0x3b11e1){return db[_0x7cba('0x3d')][_0x7cba('0x57')]({'where':{'id':_0x6d61c[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x12e1ff,null))['then'](function(_0x3cd4d4){if(_0x3cd4d4){return _0x3cd4d4[_0x7cba('0xb7')](_0x6d61c['query']['ids'])[_0x7cba('0x22')](function(){if(_['isArray'](_0x6d61c[_0x7cba('0x42')][_0x7cba('0x6e')])){for(var _0x3bf606=0x0;_0x3bf606<_0x6d61c[_0x7cba('0x42')]['ids'][_0x7cba('0x47')];_0x3bf606+=0x1){socket[_0x7cba('0xb8')](_0x7cba('0xb9'),{'UserId':Number(_0x6d61c[_0x7cba('0x42')][_0x7cba('0x6e')][_0x3bf606]),'FaxAccountId':Number(_0x6d61c[_0x7cba('0x54')]['id'])});}}else{socket[_0x7cba('0xb8')](_0x7cba('0xb9'),{'UserId':Number(_0x6d61c[_0x7cba('0x42')][_0x7cba('0x6e')]),'FaxAccountId':Number(_0x6d61c[_0x7cba('0x54')]['id'])});}});}})[_0x7cba('0x22')](respondWithStatusCode(_0x12e1ff,null))[_0x7cba('0x52')](handleError(_0x12e1ff,null));};exports['getAgents']=function(_0x24f90f,_0x5e93d9,_0x575436){var _0x38ce78={};var _0x41f6b2={};var _0x205d5b;var _0x419c99;return db[_0x7cba('0x3d')][_0x7cba('0x67')]({'where':{'id':_0x24f90f[_0x7cba('0x54')]['id']}})[_0x7cba('0x22')](handleEntityNotFound(_0x5e93d9,null))[_0x7cba('0x22')](function(_0x5d18c7){if(_0x5d18c7){_0x205d5b=_0x5d18c7;_0x41f6b2[_0x7cba('0x45')]=_[_0x7cba('0x41')](db[_0x7cba('0x73')][_0x7cba('0x3e')]);_0x41f6b2[_0x7cba('0x42')]=_[_0x7cba('0x41')](_0x24f90f[_0x7cba('0x42')]);_0x41f6b2[_0x7cba('0x43')]=_[_0x7cba('0x55')](_0x41f6b2[_0x7cba('0x45')],_0x41f6b2['query']);_0x38ce78[_0x7cba('0x44')]=_['intersection'](_0x41f6b2[_0x7cba('0x45')],qs['fields'](_0x24f90f[_0x7cba('0x42')][_0x7cba('0x46')]));_0x38ce78[_0x7cba('0x44')]=_0x38ce78[_0x7cba('0x44')][_0x7cba('0x47')]?_0x38ce78[_0x7cba('0x44')]:_0x41f6b2[_0x7cba('0x45')];_0x38ce78[_0x7cba('0x69')]=qs['sort'](_0x24f90f[_0x7cba('0x42')]['sort']);_0x38ce78['where']=qs[_0x7cba('0x43')](_['pick'](_0x24f90f['query'],_0x41f6b2[_0x7cba('0x43')]));if(_0x24f90f['query'][_0x7cba('0x4a')]){_0x38ce78[_0x7cba('0x4b')]=_[_0x7cba('0x4c')](_0x38ce78[_0x7cba('0x4b')],{'$or':_[_0x7cba('0x3c')](_0x38ce78[_0x7cba('0x44')],function(_0x5e02f2){var _0x23512b={};_0x23512b[_0x5e02f2]={'$like':'%'+_0x24f90f[_0x7cba('0x42')][_0x7cba('0x4a')]+'%'};return _0x23512b;})});}_0x38ce78=_['merge']({},_0x38ce78,_0x24f90f[_0x7cba('0x4d')]);return _0x205d5b[_0x7cba('0xba')](_0x38ce78);}})[_0x7cba('0x22')](function(_0x55e2f3){if(_0x55e2f3){_0x419c99=_0x55e2f3[_0x7cba('0x47')];if(!_0x24f90f[_0x7cba('0x42')][_0x7cba('0x68')](_0x7cba('0x48'))){_0x38ce78[_0x7cba('0x2e')]=qs['limit'](_0x24f90f[_0x7cba('0x42')]['limit']);_0x38ce78[_0x7cba('0x2d')]=qs['offset'](_0x24f90f['query'][_0x7cba('0x2d')]);}return _0x205d5b[_0x7cba('0xba')](_0x38ce78);}})[_0x7cba('0x22')](function(_0x352b1e){if(_0x352b1e){return _0x352b1e?{'count':_0x419c99,'rows':_0x352b1e}:null;}})[_0x7cba('0x22')](respondWithResult(_0x5e93d9,null))[_0x7cba('0x52')](handleError(_0x5e93d9,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 66366c3..f21fbbb 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 _0xfe05=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount'];(function(_0x2eaa85,_0x30a631){var _0x58c38b=function(_0x536734){while(--_0x536734){_0x2eaa85['push'](_0x2eaa85['shift']());}};_0x58c38b(++_0x30a631);}(_0xfe05,0x18d));var _0x5fe0=function(_0x39cf4b,_0x4b8ffe){_0x39cf4b=_0x39cf4b-0x0;var _0x484814=_0xfe05[_0x39cf4b];return _0x484814;};'use strict';var EventEmitter=require(_0x5fe0('0x0'));var FaxAccount=require(_0x5fe0('0x1'))['db'][_0x5fe0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fe0('0x3'),'afterUpdate':_0x5fe0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4677e6){return function(_0x1d8189,_0x42982d,_0x17716e){FaxAccountEvents[_0x5fe0('0x5')](_0x4677e6+':'+_0x1d8189['id'],_0x1d8189);FaxAccountEvents[_0x5fe0('0x5')](_0x4677e6,_0x1d8189);_0x17716e(null);};}for(var e in events){if(events[_0x5fe0('0x6')](e)){var event=events[e];FaxAccount[_0x5fe0('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x42a3=['hook','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x580869,_0x540760){var _0x3bfc5d=function(_0x1ee282){while(--_0x1ee282){_0x580869['push'](_0x580869['shift']());}};_0x3bfc5d(++_0x540760);}(_0x42a3,0x18d));var _0x342a=function(_0x28f03f,_0x2f4363){_0x28f03f=_0x28f03f-0x0;var _0x434899=_0x42a3[_0x28f03f];return _0x434899;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x342a('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x342a('0x1')](0x0);var events={'afterCreate':_0x342a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3725e1){return function(_0x507ea2,_0xa8989c,_0x90522e){FaxAccountEvents['emit'](_0x3725e1+':'+_0x507ea2['id'],_0x507ea2);FaxAccountEvents[_0x342a('0x3')](_0x3725e1,_0x507ea2);_0x90522e(null);};}for(var e in events){if(events[_0x342a('0x4')](e)){var event=events[e];FaxAccount[_0x342a('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 77f2465..e2051a0 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 _0xe3ad=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x16ef2f,_0x31822a){var _0x15a84f=function(_0x4e44f2){while(--_0x4e44f2){_0x16ef2f['push'](_0x16ef2f['shift']());}};_0x15a84f(++_0x31822a);}(_0xe3ad,0x84));var _0xde3a=function(_0x24aeb1,_0x1fac39){_0x24aeb1=_0x24aeb1-0x0;var _0x3f9d9a=_0xe3ad[_0x24aeb1];return _0x3f9d9a;};'use strict';var _=require(_0xde3a('0x0'));var util=require(_0xde3a('0x1'));var logger=require('../../config/logger')(_0xde3a('0x2'));var moment=require('moment');var BPromise=require(_0xde3a('0x3'));var rp=require(_0xde3a('0x4'));var fs=require('fs');var path=require(_0xde3a('0x5'));var rimraf=require(_0xde3a('0x6'));var config=require(_0xde3a('0x7'));var attributes=require(_0xde3a('0x8'));module[_0xde3a('0x9')]=function(_0x8a01d9,_0x4b210d){return _0x8a01d9[_0xde3a('0xa')]('FaxAccount',attributes,{'tableName':_0xde3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x888f=['exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x4de226,_0xf589ec){var _0x2fb276=function(_0x3f99ed){while(--_0x3f99ed){_0x4de226['push'](_0x4de226['shift']());}};_0x2fb276(++_0xf589ec);}(_0x888f,0x17e));var _0xf888=function(_0x4aaa7b,_0x4f368a){_0x4aaa7b=_0x4aaa7b-0x0;var _0x458deb=_0x888f[_0x4aaa7b];return _0x458deb;};'use strict';var _=require(_0xf888('0x0'));var util=require('util');var logger=require(_0xf888('0x1'))(_0xf888('0x2'));var moment=require(_0xf888('0x3'));var BPromise=require(_0xf888('0x4'));var rp=require(_0xf888('0x5'));var fs=require('fs');var path=require(_0xf888('0x6'));var rimraf=require(_0xf888('0x7'));var config=require(_0xf888('0x8'));var attributes=require(_0xf888('0x9'));module[_0xf888('0xa')]=function(_0x284915,_0x3ec591){return _0x284915[_0xf888('0xb')](_0xf888('0xc'),attributes,{'tableName':_0xf888('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 127c316..06d458f 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 _0x2607=['register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','limit','include','map','model','attributes','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','Contacts','DESC','FaxApplication','Applications','List','list','priority','asc','account','length','contact','fax','FaxInteraction','create','Contact\x20not\x20found','spread','applications','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket'];(function(_0x512783,_0x466592){var _0x3fbc96=function(_0x1600f9){while(--_0x1600f9){_0x512783['push'](_0x512783['shift']());}};_0x3fbc96(++_0x466592);}(_0x2607,0x14b));var _0x7260=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x2607[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require('lodash');var util=require(_0x7260('0x0'));var moment=require('moment');var BPromise=require(_0x7260('0x1'));var rs=require(_0x7260('0x2'));var fs=require('fs');var Redis=require(_0x7260('0x3'));var db=require(_0x7260('0x4'))['db'];var utils=require(_0x7260('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7260('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7260('0x7')]({'port':0x232c});config[_0x7260('0x8')]=_[_0x7260('0x9')](config[_0x7260('0x8')],{'host':_0x7260('0xa'),'port':0x18eb});var socket=require(_0x7260('0xb'))(new Redis(config[_0x7260('0x8')]));require(_0x7260('0xc'))[_0x7260('0xd')](socket);function respondWithRpcPromise(_0x3a3239,_0x18c7bc,_0x14764d){return new BPromise(function(_0x1e3921,_0x17e7d7){return client[_0x7260('0xe')](_0x3a3239,_0x14764d)[_0x7260('0xf')](function(_0x1db90f){logger['info'](_0x7260('0x10'),_0x18c7bc,_0x7260('0x11'));logger[_0x7260('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x18c7bc,'request\x20sent',JSON[_0x7260('0x13')](_0x1db90f));if(_0x1db90f[_0x7260('0x14')]){if(_0x1db90f[_0x7260('0x14')][_0x7260('0x15')]===0x1f4){logger[_0x7260('0x14')](_0x7260('0x10'),_0x18c7bc,_0x1db90f['error']['message']);return _0x17e7d7(_0x1db90f[_0x7260('0x14')][_0x7260('0x16')]);}logger[_0x7260('0x14')](_0x7260('0x10'),_0x18c7bc,_0x1db90f[_0x7260('0x14')][_0x7260('0x16')]);return _0x1e3921(_0x1db90f[_0x7260('0x14')][_0x7260('0x16')]);}else{logger[_0x7260('0x17')]('FaxAccount,\x20%s,\x20%s',_0x18c7bc,_0x7260('0x11'));_0x1e3921(_0x1db90f[_0x7260('0x18')][_0x7260('0x16')]);}})[_0x7260('0x19')](function(_0x41007a){logger[_0x7260('0x14')](_0x7260('0x10'),_0x18c7bc,_0x41007a);_0x17e7d7(_0x41007a);});});}exports[_0x7260('0x1a')]=function(_0x170bb5){var _0x121d79=this;return new Promise(function(_0x9cc070,_0x22828f){return db[_0x7260('0x1b')][_0x7260('0x1c')]({'raw':_0x170bb5[_0x7260('0x1d')]?_0x170bb5['options'][_0x7260('0x1e')]===undefined?!![]:![]:!![],'where':_0x170bb5[_0x7260('0x1d')]?_0x170bb5['options']['where']||null:null,'attributes':_0x170bb5[_0x7260('0x1d')]?_0x170bb5['options']['attributes']||null:null,'limit':_0x170bb5[_0x7260('0x1d')]?_0x170bb5[_0x7260('0x1d')][_0x7260('0x1f')]||null:null,'include':_0x170bb5['options']?_0x170bb5[_0x7260('0x1d')][_0x7260('0x20')]?_[_0x7260('0x21')](_0x170bb5[_0x7260('0x1d')][_0x7260('0x20')],function(_0x2db63a){return{'model':db[_0x2db63a[_0x7260('0x22')]],'as':_0x2db63a['as'],'attributes':_0x2db63a[_0x7260('0x23')],'include':_0x2db63a[_0x7260('0x20')]?_['map'](_0x2db63a[_0x7260('0x20')],function(_0x3370d4){return{'model':db[_0x3370d4[_0x7260('0x22')]],'as':_0x3370d4['as'],'attributes':_0x3370d4[_0x7260('0x23')],'include':_0x3370d4[_0x7260('0x20')]?_['map'](_0x3370d4['include'],function(_0x7291a6){return{'model':db[_0x7291a6['model']],'as':_0x7291a6['as'],'attributes':_0x7291a6[_0x7260('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7260('0xf')](function(_0x30769b){logger[_0x7260('0x17')](_0x7260('0x1a'),_0x170bb5);logger[_0x7260('0x12')](_0x7260('0x1a'),_0x170bb5,JSON['stringify'](_0x30769b));_0x9cc070(_0x30769b);})[_0x7260('0x19')](function(_0x2ed35d){logger[_0x7260('0x14')](_0x7260('0x1a'),_0x2ed35d['message'],_0x170bb5);_0x22828f(_0x121d79[_0x7260('0x14')](0x1f4,_0x2ed35d[_0x7260('0x16')]));});});};exports[_0x7260('0x24')]=function(_0x22d66f,_0x2ae215,_0x16aeb5){var _0x193b4f=this;return new Promise(function(_0x21e5e4,_0x76583){var _0xe5cacc={'body':_0x22d66f[_0x7260('0x25')],'channel':'fax'};var _0xa52714=[];var _0x2e5b3d=[];var _0xde0bb9={};return db[_0x7260('0x26')][_0x7260('0x27')]()[_0x7260('0xf')](function(_0x39f10d){if(!_0x39f10d){throw new db[(_0x7260('0x28'))]['ValidationError'](_0x7260('0x29'));}_0xa52714=_['difference'](_['keys'](_0x39f10d),[_0x7260('0x2a'),_0x7260('0x2b')]);_0x2e5b3d=_['difference'](_['keys'](_0x39f10d),[_0x7260('0x2a'),_0x7260('0x2b'),_0x7260('0x2c'),_0x7260('0x2d')]);if(_0x22d66f[_0x7260('0x25')]['id']){delete _0x22d66f[_0x7260('0x25')]['id'];}if(_['isNil'](_0x22d66f[_0x7260('0x25')][_0x7260('0x2e')])){throw new db[(_0x7260('0x28'))][(_0x7260('0x2f'))](_0x7260('0x30'));}if(_[_0x7260('0x31')](_0x22d66f[_0x7260('0x25')][_0x7260('0x25')])||_0x22d66f['body']['body']===''){throw new db[(_0x7260('0x28'))]['ValidationError'](_0x7260('0x32'));}if(_[_0x7260('0x31')](_0x22d66f[_0x7260('0x25')][_0x7260('0x33')])){throw new db[(_0x7260('0x28'))]['ValidationError'](_0x7260('0x34')+_0x2e5b3d);}if(!_['includes'](_0x2e5b3d,_0x22d66f[_0x7260('0x25')][_0x7260('0x33')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e5b3d);}_0xde0bb9[_0x22d66f[_0x7260('0x25')][_0x7260('0x33')]]=_0x22d66f[_0x7260('0x25')][_0x7260('0x2e')];})[_0x7260('0xf')](function(){return db['FaxAccount'][_0x7260('0x35')]({'where':{'id':_0x22d66f['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x7260('0x36'),'where':_0xde0bb9,'limit':0x1,'order':[[_0x7260('0x2b'),_0x7260('0x37')]]}]},{'model':db[_0x7260('0x38')],'as':_0x7260('0x39')}]});})['then'](function(_0x4b9964){if(_0x4b9964&&_0x4b9964[_0x7260('0x3a')]){var _0xa0208b=_0x4b9964['get']({'plain':!![]});_0xe5cacc['account']=_0xa0208b;_0xe5cacc['applications']=_0xa0208b['Applications'];_0xe5cacc[_0x7260('0x3b')]=_0xa0208b[_0x7260('0x3a')];_0xe5cacc['applications']=_['orderBy'](_0xe5cacc['applications'],[_0x7260('0x3c')],[_0x7260('0x3d')]);if(_0xe5cacc[_0x7260('0x3e')]['Applications']){delete _0xe5cacc[_0x7260('0x3e')]['Applications'];}if(_0xe5cacc[_0x7260('0x3e')][_0x7260('0x3a')]&&_0xe5cacc['account'][_0x7260('0x3a')][_0x7260('0x36')][_0x7260('0x3f')]){return _0xe5cacc[_0x7260('0x3e')][_0x7260('0x3a')][_0x7260('0x36')][0x0];}var _0x15278b=_[_0x7260('0x9')](_0x22d66f['body'],{'firstName':_0x22d66f[_0x7260('0x25')]['from'],'ListId':_0xa0208b[_0x7260('0x2d')]});_0x15278b[_0x22d66f[_0x7260('0x25')][_0x7260('0x33')]]=_0x22d66f['body'][_0x7260('0x2e')];return db[_0x7260('0x26')]['create'](_0x15278b,{'fields':_0xa52714,'raw':!![]});}})[_0x7260('0xf')](function(_0xdfb09c){_0xe5cacc[_0x7260('0x40')]=_0xdfb09c;if(_0xdfb09c){var _0x5f4ef8={'ContactId':_0xdfb09c['id'],'FaxAccountId':_0x22d66f['account']['id'],'fax':_0xdfb09c[_0x7260('0x41')]};return db[_0x7260('0x42')]['find']({'where':{'ContactId':_0xdfb09c['id'],'closed':![],'FaxAccountId':_0x22d66f[_0x7260('0x3e')]['id']}})[_0x7260('0xf')](function(_0x54b621){if(_0x54b621){return[_0x54b621,![]];}return db['FaxInteraction'][_0x7260('0x43')](_0x5f4ef8)['then'](function(_0x4b0027){return[_0x4b0027,!![]];});});}else{throw new Error(_0x7260('0x44'));}})[_0x7260('0x45')](function(_0x2d1ab2,_0x3324e4){var _0x299ae7=_0x2d1ab2['get']({'plain':!![]});if(_0x3324e4){if(_0xe5cacc[_0x7260('0x3e')]['autoclose']){_0xe5cacc[_0x7260('0x46')]['push']({'id':0x0,'priority':_0xe5cacc[_0x7260('0x46')][_0x7260('0x3f')]+0x1,'app':_0x7260('0x47'),'appdata':_0x7260('0x48'),'interval':_0x7260('0x49')});}_0x299ae7[_0x7260('0x4a')]=!![];}else{_0x299ae7[_0x7260('0x4a')]=![];}_0xe5cacc[_0x7260('0x4b')]=_0x299ae7;return db[_0x7260('0x4c')]['create']({'body':_0x22d66f['body'][_0x7260('0x25')],'FaxAccountId':_0x22d66f[_0x7260('0x3e')]['id'],'FaxInteractionId':_0x2d1ab2['id'],'direction':'in','ContactId':_0x2d1ab2[_0x7260('0x4d')],'AttachmentId':_0x22d66f[_0x7260('0x25')]['AttachmentId']});})[_0x7260('0xf')](function(_0x1640d7){_0xe5cacc['message']=_0x1640d7;if(_0xe5cacc[_0x7260('0x4b')][_0x7260('0x4e')]){return db[_0x7260('0x4f')][_0x7260('0x35')]({'attributes':['id','name'],'where':{'id':_0xe5cacc[_0x7260('0x4b')]['UserId']}})[_0x7260('0xf')](function(_0x1e88dd){if(_0x1e88dd){_0xe5cacc[_0x7260('0x46')][_0x7260('0x50')]({'id':0x0,'priority':0x0,'app':_0x7260('0x51'),'appdata':_0x1e88dd[_0x7260('0x52')]+','+(_0xe5cacc['account'][_0x7260('0x53')]||0xa),'interval':_0x7260('0x49')});}return respondWithRpcPromise(_0x7260('0x54'),'startRouting',_0xe5cacc);});}return respondWithRpcPromise('Start',_0x7260('0x55'),_0xe5cacc);})[_0x7260('0xf')](function(_0x304475){_0x21e5e4(_0x304475);})[_0x7260('0x19')](function(_0x2bc3e5){_0x76583(_0x193b4f['error'](0x1f4,_0x2bc3e5['message']));});});}; \ No newline at end of file +var _0x9182=['map','include','attributes','model','info','debug','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','createdAt','updatedAt','keys','CompanyId','ListId','body','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','Applications','get','applications','orderBy','priority','length','Contacts','from','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxAccount','FaxAccount','findAll','options','raw','limit'];(function(_0x82487b,_0x343602){var _0x29037f=function(_0x4fff15){while(--_0x4fff15){_0x82487b['push'](_0x82487b['shift']());}};_0x29037f(++_0x343602);}(_0x9182,0xe1));var _0x2918=function(_0x3bc864,_0x324957){_0x3bc864=_0x3bc864-0x0;var _0x1d0dd2=_0x9182[_0x3bc864];return _0x1d0dd2;};'use strict';var _=require(_0x2918('0x0'));var util=require(_0x2918('0x1'));var moment=require(_0x2918('0x2'));var BPromise=require(_0x2918('0x3'));var rs=require(_0x2918('0x4'));var fs=require('fs');var Redis=require(_0x2918('0x5'));var db=require(_0x2918('0x6'))['db'];var utils=require(_0x2918('0x7'));var logger=require(_0x2918('0x8'))('rpc');var config=require(_0x2918('0x9'));var jayson=require(_0x2918('0xa'));var client=jayson['client'][_0x2918('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0x2918('0xc')],{'host':_0x2918('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2918('0xc')]));require('./faxAccount.socket')[_0x2918('0xe')](socket);function respondWithRpcPromise(_0x2c8100,_0x397cd2,_0x4c69cd){return new BPromise(function(_0x5df10b,_0x29b637){return client[_0x2918('0xf')](_0x2c8100,_0x4c69cd)[_0x2918('0x10')](function(_0x417923){logger['info'](_0x2918('0x11'),_0x397cd2,_0x2918('0x12'));logger['debug'](_0x2918('0x13'),_0x397cd2,_0x2918('0x12'),JSON[_0x2918('0x14')](_0x417923));if(_0x417923['error']){if(_0x417923[_0x2918('0x15')][_0x2918('0x16')]===0x1f4){logger['error'](_0x2918('0x11'),_0x397cd2,_0x417923['error'][_0x2918('0x17')]);return _0x29b637(_0x417923['error'][_0x2918('0x17')]);}logger[_0x2918('0x15')]('FaxAccount,\x20%s,\x20%s',_0x397cd2,_0x417923[_0x2918('0x15')][_0x2918('0x17')]);return _0x5df10b(_0x417923['error'][_0x2918('0x17')]);}else{logger['info'](_0x2918('0x11'),_0x397cd2,_0x2918('0x12'));_0x5df10b(_0x417923['result'][_0x2918('0x17')]);}})['catch'](function(_0x80ded2){logger[_0x2918('0x15')](_0x2918('0x11'),_0x397cd2,_0x80ded2);_0x29b637(_0x80ded2);});});}exports[_0x2918('0x18')]=function(_0x2cd399){var _0xfb960=this;return new Promise(function(_0x1ace42,_0x39c690){return db[_0x2918('0x19')][_0x2918('0x1a')]({'raw':_0x2cd399[_0x2918('0x1b')]?_0x2cd399[_0x2918('0x1b')][_0x2918('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cd399['options']?_0x2cd399['options']['where']||null:null,'attributes':_0x2cd399['options']?_0x2cd399[_0x2918('0x1b')]['attributes']||null:null,'limit':_0x2cd399[_0x2918('0x1b')]?_0x2cd399[_0x2918('0x1b')][_0x2918('0x1d')]||null:null,'include':_0x2cd399['options']?_0x2cd399[_0x2918('0x1b')]['include']?_[_0x2918('0x1e')](_0x2cd399['options'][_0x2918('0x1f')],function(_0x3d827d){return{'model':db[_0x3d827d['model']],'as':_0x3d827d['as'],'attributes':_0x3d827d[_0x2918('0x20')],'include':_0x3d827d['include']?_['map'](_0x3d827d[_0x2918('0x1f')],function(_0x59b9d1){return{'model':db[_0x59b9d1[_0x2918('0x21')]],'as':_0x59b9d1['as'],'attributes':_0x59b9d1['attributes'],'include':_0x59b9d1['include']?_['map'](_0x59b9d1[_0x2918('0x1f')],function(_0x36ccf8){return{'model':db[_0x36ccf8['model']],'as':_0x36ccf8['as'],'attributes':_0x36ccf8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2918('0x10')](function(_0x4ba408){logger[_0x2918('0x22')]('GetFaxAccount',_0x2cd399);logger[_0x2918('0x23')](_0x2918('0x18'),_0x2cd399,JSON[_0x2918('0x14')](_0x4ba408));_0x1ace42(_0x4ba408);})['catch'](function(_0x2e8a8b){logger[_0x2918('0x15')](_0x2918('0x18'),_0x2e8a8b['message'],_0x2cd399);_0x39c690(_0xfb960['error'](0x1f4,_0x2e8a8b['message']));});});};exports[_0x2918('0x24')]=function(_0x48f4bb,_0x3ccec2,_0x6445d4){var _0x5df82e=this;return new Promise(function(_0x46007b,_0x38c68f){var _0x308d1e={'body':_0x48f4bb['body'],'channel':_0x2918('0x25')};var _0x1b5e46=[];var _0x55c63c=[];var _0x5c1308={};return db[_0x2918('0x26')][_0x2918('0x27')]()[_0x2918('0x10')](function(_0x2d816b){if(!_0x2d816b){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))]('no\x20available\x20attributes');}_0x1b5e46=_['difference'](_['keys'](_0x2d816b),[_0x2918('0x2a'),_0x2918('0x2b')]);_0x55c63c=_['difference'](_[_0x2918('0x2c')](_0x2d816b),['createdAt','updatedAt',_0x2918('0x2d'),_0x2918('0x2e')]);if(_0x48f4bb['body']['id']){delete _0x48f4bb[_0x2918('0x2f')]['id'];}if(_[_0x2918('0x30')](_0x48f4bb[_0x2918('0x2f')]['from'])){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x48f4bb[_0x2918('0x2f')]['body'])||_0x48f4bb[_0x2918('0x2f')][_0x2918('0x2f')]===''){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))](_0x2918('0x31'));}if(_[_0x2918('0x30')](_0x48f4bb[_0x2918('0x2f')][_0x2918('0x32')])){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))](_0x2918('0x33')+_0x55c63c);}if(!_['includes'](_0x55c63c,_0x48f4bb[_0x2918('0x2f')][_0x2918('0x32')])){throw new db[(_0x2918('0x28'))][(_0x2918('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55c63c);}_0x5c1308[_0x48f4bb['body'][_0x2918('0x32')]]=_0x48f4bb[_0x2918('0x2f')]['from'];})['then'](function(){return db[_0x2918('0x19')]['find']({'where':{'id':_0x48f4bb[_0x2918('0x34')]['id']},'include':[{'model':db[_0x2918('0x35')],'as':_0x2918('0x36'),'include':[{'model':db[_0x2918('0x26')],'as':'Contacts','where':_0x5c1308,'limit':0x1,'order':[[_0x2918('0x2b'),_0x2918('0x37')]]}]},{'model':db['FaxApplication'],'as':_0x2918('0x38')}]});})['then'](function(_0x2cc8ff){if(_0x2cc8ff&&_0x2cc8ff[_0x2918('0x36')]){var _0xb109eb=_0x2cc8ff[_0x2918('0x39')]({'plain':!![]});_0x308d1e[_0x2918('0x34')]=_0xb109eb;_0x308d1e[_0x2918('0x3a')]=_0xb109eb[_0x2918('0x38')];_0x308d1e['list']=_0xb109eb['List'];_0x308d1e[_0x2918('0x3a')]=_[_0x2918('0x3b')](_0x308d1e[_0x2918('0x3a')],[_0x2918('0x3c')],['asc']);if(_0x308d1e[_0x2918('0x34')]['Applications']){delete _0x308d1e[_0x2918('0x34')]['Applications'];}if(_0x308d1e[_0x2918('0x34')][_0x2918('0x36')]&&_0x308d1e[_0x2918('0x34')][_0x2918('0x36')]['Contacts'][_0x2918('0x3d')]){return _0x308d1e['account']['List'][_0x2918('0x3e')][0x0];}var _0x5e7bd0=_['defaults'](_0x48f4bb[_0x2918('0x2f')],{'firstName':_0x48f4bb['body'][_0x2918('0x3f')],'ListId':_0xb109eb[_0x2918('0x2e')]});_0x5e7bd0[_0x48f4bb['body'][_0x2918('0x32')]]=_0x48f4bb[_0x2918('0x2f')][_0x2918('0x3f')];return db[_0x2918('0x26')][_0x2918('0x40')](_0x5e7bd0,{'fields':_0x1b5e46,'raw':!![]});}})[_0x2918('0x10')](function(_0x2fd56e){_0x308d1e[_0x2918('0x41')]=_0x2fd56e;if(_0x2fd56e){var _0x426abc={'ContactId':_0x2fd56e['id'],'FaxAccountId':_0x48f4bb[_0x2918('0x34')]['id'],'fax':_0x2fd56e[_0x2918('0x25')]};return db[_0x2918('0x42')][_0x2918('0x43')]({'where':{'ContactId':_0x2fd56e['id'],'closed':![],'FaxAccountId':_0x48f4bb['account']['id']}})[_0x2918('0x10')](function(_0x34f3d9){if(_0x34f3d9){return[_0x34f3d9,![]];}return db[_0x2918('0x42')][_0x2918('0x40')](_0x426abc)[_0x2918('0x10')](function(_0x4aabad){return[_0x4aabad,!![]];});});}else{throw new Error(_0x2918('0x44'));}})[_0x2918('0x45')](function(_0x577b1a,_0x52333c){var _0x4df366=_0x577b1a[_0x2918('0x39')]({'plain':!![]});if(_0x52333c){if(_0x308d1e[_0x2918('0x34')][_0x2918('0x46')]){_0x308d1e[_0x2918('0x3a')]['push']({'id':0x0,'priority':_0x308d1e['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x2918('0x47')});}_0x4df366['created']=!![];}else{_0x4df366[_0x2918('0x48')]=![];}_0x308d1e[_0x2918('0x49')]=_0x4df366;return db[_0x2918('0x4a')][_0x2918('0x40')]({'body':_0x48f4bb['body'][_0x2918('0x2f')],'FaxAccountId':_0x48f4bb[_0x2918('0x34')]['id'],'FaxInteractionId':_0x577b1a['id'],'direction':'in','ContactId':_0x577b1a[_0x2918('0x4b')],'AttachmentId':_0x48f4bb[_0x2918('0x2f')][_0x2918('0x4c')]});})[_0x2918('0x10')](function(_0x31fd05){_0x308d1e[_0x2918('0x17')]=_0x31fd05;if(_0x308d1e[_0x2918('0x49')]['UserId']){return db[_0x2918('0x4d')][_0x2918('0x43')]({'attributes':['id',_0x2918('0x4e')],'where':{'id':_0x308d1e['interaction'][_0x2918('0x4f')]}})[_0x2918('0x10')](function(_0x35f9ea){if(_0x35f9ea){_0x308d1e['applications'][_0x2918('0x50')]({'id':0x0,'priority':0x0,'app':_0x2918('0x51'),'appdata':_0x35f9ea[_0x2918('0x4e')]+','+(_0x308d1e[_0x2918('0x34')][_0x2918('0x52')]||0xa),'interval':_0x2918('0x47')});}return respondWithRpcPromise(_0x2918('0x53'),_0x2918('0x54'),_0x308d1e);});}return respondWithRpcPromise(_0x2918('0x53'),_0x2918('0x54'),_0x308d1e);})['then'](function(_0x5f2a61){_0x46007b(_0x5f2a61);})['catch'](function(_0x90526e){_0x38c68f(_0x5df82e[_0x2918('0x15')](0x1f4,_0x90526e[_0x2918('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3e11a21..03133cf 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 _0x33af=['emit','removeListener','register','length','faxAccount:','save','update'];(function(_0x269d31,_0x4e648c){var _0xc1ad85=function(_0x2471f7){while(--_0x2471f7){_0x269d31['push'](_0x269d31['shift']());}};_0xc1ad85(++_0x4e648c);}(_0x33af,0xec));var _0xf33a=function(_0xc09b83,_0x4a8f7c){_0xc09b83=_0xc09b83-0x0;var _0x986879=_0x33af[_0xc09b83];return _0x986879;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){FaxAccountEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);FaxAccountEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file +var _0xf61e=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x2641e5,_0x165b4b){var _0x3831f2=function(_0x50a8c6){while(--_0x50a8c6){_0x2641e5['push'](_0x2641e5['shift']());}};_0x3831f2(++_0x165b4b);}(_0xf61e,0x191));var _0xef61=function(_0x4d7e98,_0x26cb62){_0x4d7e98=_0x4d7e98-0x0;var _0xe06c8a=_0xf61e[_0x4d7e98];return _0xe06c8a;};'use strict';var FaxAccountEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){FaxAccountEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);FaxAccountEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 522916e..f654236 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 _0x1f58=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','put','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x48b1b8,_0x277108){var _0x2cf332=function(_0x20b3c4){while(--_0x20b3c4){_0x48b1b8['push'](_0x48b1b8['shift']());}};_0x2cf332(++_0x277108);}(_0x1f58,0x146));var _0x81f5=function(_0x45aa09,_0x1465b5){_0x45aa09=_0x45aa09-0x0;var _0x34803b=_0x1f58[_0x45aa09];return _0x34803b;};'use strict';var multer=require(_0x81f5('0x0'));var util=require(_0x81f5('0x1'));var path=require(_0x81f5('0x2'));var timeout=require(_0x81f5('0x3'));var express=require(_0x81f5('0x4'));var router=express['Router']();var auth=require(_0x81f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x81f5('0x6'));var controller=require(_0x81f5('0x7'));router[_0x81f5('0x8')]('/',auth[_0x81f5('0x9')](),controller[_0x81f5('0xa')]);router[_0x81f5('0x8')](_0x81f5('0xb'),auth[_0x81f5('0x9')](),controller[_0x81f5('0xc')]);router[_0x81f5('0x8')](_0x81f5('0xd'),auth['isAuthenticated'](),controller[_0x81f5('0xe')]);router[_0x81f5('0x8')](_0x81f5('0xf'),auth['isAuthenticated'](),controller[_0x81f5('0x10')]);router[_0x81f5('0x8')](_0x81f5('0x11'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x12')]);router[_0x81f5('0x8')](_0x81f5('0x13'),auth['isAuthenticated'](),controller[_0x81f5('0x14')]);router[_0x81f5('0x8')](_0x81f5('0x15'),auth[_0x81f5('0x9')](),controller['getApplications']);router['get'](_0x81f5('0x16'),auth['isAuthenticated'](),controller[_0x81f5('0x17')]);router['get'](_0x81f5('0x18'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x19')]);router[_0x81f5('0x1a')]('/',auth[_0x81f5('0x9')](),controller[_0x81f5('0x1b')]);router[_0x81f5('0x1a')](_0x81f5('0xf'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x1c')]);router[_0x81f5('0x1a')](_0x81f5('0x11'),auth[_0x81f5('0x9')](),controller['addAnswer']);router[_0x81f5('0x1a')](_0x81f5('0x13'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x1d')]);router[_0x81f5('0x1a')](_0x81f5('0x15'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x1e')]);router[_0x81f5('0x1a')]('/addaccountapplications',auth[_0x81f5('0x9')](),controller[_0x81f5('0x1f')]);router[_0x81f5('0x1a')](_0x81f5('0x20'),auth['isAuthenticated'](),controller[_0x81f5('0x21')]);router['post']('/:id/send',auth[_0x81f5('0x9')](),controller[_0x81f5('0x22')]);router[_0x81f5('0x1a')](_0x81f5('0x18'),auth[_0x81f5('0x9')](),controller['addAgents']);router[_0x81f5('0x23')](_0x81f5('0xd'),auth[_0x81f5('0x9')](),controller['update']);router[_0x81f5('0x24')]('/:id',auth[_0x81f5('0x9')](),controller['destroy']);router[_0x81f5('0x24')](_0x81f5('0xf'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x25')]);router[_0x81f5('0x24')](_0x81f5('0x11'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x26')]);router[_0x81f5('0x24')]('/:id/users',auth[_0x81f5('0x9')](),controller[_0x81f5('0x27')]);module[_0x81f5('0x28')]=router; \ No newline at end of file +var _0x0a22=['/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x2f5128,_0x39e88a){var _0x1e367a=function(_0x5d141b){while(--_0x5d141b){_0x2f5128['push'](_0x2f5128['shift']());}};_0x1e367a(++_0x39e88a);}(_0x0a22,0x108));var _0x20a2=function(_0x5b3e63,_0x53686e){_0x5b3e63=_0x5b3e63-0x0;var _0x2e8e4d=_0x0a22[_0x5b3e63];return _0x2e8e4d;};'use strict';var multer=require('multer');var util=require(_0x20a2('0x0'));var path=require('path');var timeout=require(_0x20a2('0x1'));var express=require(_0x20a2('0x2'));var router=express[_0x20a2('0x3')]();var auth=require(_0x20a2('0x4'));var interaction=require(_0x20a2('0x5'));var config=require(_0x20a2('0x6'));var controller=require(_0x20a2('0x7'));router[_0x20a2('0x8')]('/',auth[_0x20a2('0x9')](),controller[_0x20a2('0xa')]);router[_0x20a2('0x8')](_0x20a2('0xb'),auth[_0x20a2('0x9')](),controller[_0x20a2('0xc')]);router[_0x20a2('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x20a2('0x8')](_0x20a2('0xd'),auth['isAuthenticated'](),controller[_0x20a2('0xe')]);router['get'](_0x20a2('0xf'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x10')]);router[_0x20a2('0x8')](_0x20a2('0x11'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x12')]);router['get'](_0x20a2('0x13'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x14')]);router[_0x20a2('0x8')](_0x20a2('0x15'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x16')]);router[_0x20a2('0x8')](_0x20a2('0x17'),auth['isAuthenticated'](),controller[_0x20a2('0x18')]);router[_0x20a2('0x19')]('/',auth[_0x20a2('0x9')](),controller[_0x20a2('0x1a')]);router[_0x20a2('0x19')](_0x20a2('0xd'),auth['isAuthenticated'](),controller[_0x20a2('0x1b')]);router['post'](_0x20a2('0xf'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x1c')]);router[_0x20a2('0x19')](_0x20a2('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x20a2('0x13'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x1d')]);router[_0x20a2('0x19')]('/addaccountapplications',auth[_0x20a2('0x9')](),controller['addAccountApplications']);router[_0x20a2('0x19')](_0x20a2('0x1e'),auth[_0x20a2('0x9')](),controller['updateAccountApplications']);router[_0x20a2('0x19')](_0x20a2('0x1f'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x20')]);router['post']('/:id/users',auth[_0x20a2('0x9')](),controller[_0x20a2('0x21')]);router[_0x20a2('0x22')](_0x20a2('0x23'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x24')]);router[_0x20a2('0x25')](_0x20a2('0x23'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x26')]);router[_0x20a2('0x25')](_0x20a2('0xd'),auth[_0x20a2('0x9')](),controller[_0x20a2('0x27')]);router[_0x20a2('0x25')](_0x20a2('0xf'),auth[_0x20a2('0x9')](),controller['removeAnswers']);router['delete'](_0x20a2('0x17'),auth[_0x20a2('0x9')](),controller['removeAgents']);module[_0x20a2('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index bd3df24..510d6ac 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 _0xdba3=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x3f0c02,_0x1b3caa){var _0x38ae01=function(_0x5436f9){while(--_0x5436f9){_0x3f0c02['push'](_0x3f0c02['shift']());}};_0x38ae01(++_0x1b3caa);}(_0xdba3,0x19f));var _0x3dba=function(_0x40d40d,_0x3a5baf){_0x40d40d=_0x40d40d-0x0;var _0x367eb3=_0xdba3[_0x40d40d];return _0x367eb3;};'use strict';var Sequelize=require(_0x3dba('0x0'));module[_0x3dba('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3dba('0x2')],'allowNull':![],'defaultValue':_0x3dba('0x3')},'appdata':{'type':Sequelize[_0x3dba('0x4')]()},'description':{'type':Sequelize[_0x3dba('0x2')]},'interval':{'type':Sequelize[_0x3dba('0x2')],'defaultValue':_0x3dba('0x5')}}; \ No newline at end of file +var _0x1c77=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x31263b,_0x651893){var _0x56005e=function(_0x3b78a1){while(--_0x3b78a1){_0x31263b['push'](_0x31263b['shift']());}};_0x56005e(++_0x651893);}(_0x1c77,0xed));var _0x71c7=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x1c77[_0x18e52b];return _0x3d3062;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'priority':{'type':Sequelize[_0x71c7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x71c7('0x2')],'allowNull':![],'defaultValue':_0x71c7('0x3')},'appdata':{'type':Sequelize[_0x71c7('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x71c7('0x2')],'defaultValue':_0x71c7('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 664beac..8b13e73 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 _0xdd06=['moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','destroy','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x1d9054,_0x48019d){var _0x423d68=function(_0x8a5f40){while(--_0x8a5f40){_0x1d9054['push'](_0x1d9054['shift']());}};_0x423d68(++_0x48019d);}(_0xdd06,0xce));var _0x6dd0=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0xdd06[_0x550151];return _0x1ba3cb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6dd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6dd0('0x1'));var jsonpatch=require(_0x6dd0('0x2'));var rp=require(_0x6dd0('0x3'));var moment=require(_0x6dd0('0x4'));var BPromise=require(_0x6dd0('0x5'));var Mustache=require('mustache');var util=require(_0x6dd0('0x6'));var path=require(_0x6dd0('0x7'));var sox=require(_0x6dd0('0x8'));var csv=require('to-csv');var ejs=require(_0x6dd0('0x9'));var fs=require('fs');var _=require(_0x6dd0('0xa'));var squel=require(_0x6dd0('0xb'));var crypto=require(_0x6dd0('0xc'));var jsforce=require(_0x6dd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6dd0('0xe'));var querystring=require(_0x6dd0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6dd0('0x10'));var qs=require(_0x6dd0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dd0('0x12'));var logger=require(_0x6dd0('0x13'))(_0x6dd0('0x14'));var utils=require(_0x6dd0('0x15'));var config=require(_0x6dd0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6dd0('0x17'))['db'];function respondWithStatusCode(_0x5040d2,_0x1e6b85){_0x1e6b85=_0x1e6b85||0xcc;return function(_0x4f4247){if(_0x4f4247){return _0x5040d2[_0x6dd0('0x18')](_0x1e6b85);}return _0x5040d2[_0x6dd0('0x19')](_0x1e6b85)[_0x6dd0('0x1a')]();};}function respondWithResult(_0x4c29df,_0x4ec77b){_0x4ec77b=_0x4ec77b||0xc8;return function(_0x553cfc){if(_0x553cfc){return _0x4c29df['status'](_0x4ec77b)[_0x6dd0('0x1b')](_0x553cfc);}};}function respondWithFilteredResult(_0x35da76,_0x594d8d){return function(_0x4f7535){if(_0x4f7535){var _0x3accdf=_0x4f7535[_0x6dd0('0x1c')],_0x1c98f5=_0x594d8d[_0x6dd0('0x1d')],_0x24ff25=_0x594d8d[_0x6dd0('0x1d')]+_0x594d8d[_0x6dd0('0x1e')],_0x3eb30b;if(_0x24ff25>=_0x3accdf){_0x24ff25=_0x3accdf;_0x3eb30b=0xc8;}else{_0x3eb30b=0xce;}_0x35da76[_0x6dd0('0x19')](_0x3eb30b);return _0x35da76[_0x6dd0('0x1f')]('Content-Range',_0x1c98f5+'-'+_0x24ff25+'/'+_0x3accdf)[_0x6dd0('0x1b')](_0x4f7535);}return null;};}function patchUpdates(_0x44dbb8){return function(_0x5ba067){try{jsonpatch['apply'](_0x5ba067,_0x44dbb8,!![]);}catch(_0x429a2b){return BPromise[_0x6dd0('0x20')](_0x429a2b);}return _0x5ba067[_0x6dd0('0x21')]();};}function saveUpdates(_0x524968,_0x13e7b2){return function(_0x491f1a){if(_0x491f1a){return _0x491f1a['update'](_0x524968)[_0x6dd0('0x22')](function(_0x5b5e65){return _0x5b5e65;});}return null;};}function removeEntity(_0x232089,_0x45af2f){return function(_0x41d3e6){if(_0x41d3e6){return _0x41d3e6[_0x6dd0('0x23')]()[_0x6dd0('0x22')](function(){_0x232089[_0x6dd0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308a42,_0x5a453a){return function(_0x1d1213){if(!_0x1d1213){_0x308a42[_0x6dd0('0x18')](0x194);}return _0x1d1213;};}function handleError(_0x119d0b,_0x503138){_0x503138=_0x503138||0x1f4;return function(_0x578a2f){logger[_0x6dd0('0x24')](_0x578a2f['stack']);if(_0x578a2f['name']){delete _0x578a2f[_0x6dd0('0x25')];}_0x119d0b['status'](_0x503138)[_0x6dd0('0x26')](_0x578a2f);};}exports[_0x6dd0('0x27')]=function(_0x9e06e,_0x15bbdd){var _0x11689e={},_0x388e7e={},_0x2766d4={'count':0x0,'rows':[]};var _0x1eaf71=_[_0x6dd0('0x28')](db[_0x6dd0('0x29')][_0x6dd0('0x2a')],function(_0x1beefe){return{'name':_0x1beefe[_0x6dd0('0x2b')],'type':_0x1beefe[_0x6dd0('0x2c')][_0x6dd0('0x2d')]};});_0x388e7e[_0x6dd0('0x2e')]=_[_0x6dd0('0x28')](_0x1eaf71,_0x6dd0('0x25'));_0x388e7e[_0x6dd0('0x2f')]=_[_0x6dd0('0x30')](_0x9e06e['query']);_0x388e7e[_0x6dd0('0x31')]=_[_0x6dd0('0x32')](_0x388e7e[_0x6dd0('0x2e')],_0x388e7e[_0x6dd0('0x2f')]);_0x11689e[_0x6dd0('0x33')]=_[_0x6dd0('0x32')](_0x388e7e[_0x6dd0('0x2e')],qs['fields'](_0x9e06e['query']['fields']));_0x11689e[_0x6dd0('0x33')]=_0x11689e[_0x6dd0('0x33')][_0x6dd0('0x34')]?_0x11689e[_0x6dd0('0x33')]:_0x388e7e[_0x6dd0('0x2e')];if(!_0x9e06e['query']['hasOwnProperty']('nolimit')){_0x11689e['limit']=qs[_0x6dd0('0x1e')](_0x9e06e['query'][_0x6dd0('0x1e')]);_0x11689e[_0x6dd0('0x1d')]=qs[_0x6dd0('0x1d')](_0x9e06e[_0x6dd0('0x2f')][_0x6dd0('0x1d')]);}_0x11689e[_0x6dd0('0x35')]=qs[_0x6dd0('0x36')](_0x9e06e['query']['sort']);_0x11689e[_0x6dd0('0x37')]=qs[_0x6dd0('0x31')](_['pick'](_0x9e06e[_0x6dd0('0x2f')],_0x388e7e[_0x6dd0('0x31')]),_0x1eaf71);if(_0x9e06e['query'][_0x6dd0('0x38')]){_0x11689e[_0x6dd0('0x37')]=_[_0x6dd0('0x39')](_0x11689e['where'],{'$or':_[_0x6dd0('0x28')](_0x1eaf71,function(_0xd61f50){if(_0xd61f50[_0x6dd0('0x2c')]!==_0x6dd0('0x3a')){var _0x361091={};_0x361091[_0xd61f50[_0x6dd0('0x25')]]={'$like':'%'+_0x9e06e['query'][_0x6dd0('0x38')]+'%'};return _0x361091;}})});}_0x11689e=_[_0x6dd0('0x39')]({},_0x11689e,_0x9e06e[_0x6dd0('0x3b')]);var _0x300b83={'where':_0x11689e['where']};return db[_0x6dd0('0x29')][_0x6dd0('0x1c')](_0x300b83)['then'](function(_0x42ee46){_0x2766d4['count']=_0x42ee46;if(_0x9e06e['query'][_0x6dd0('0x3c')]){_0x11689e[_0x6dd0('0x3d')]=[{'all':!![]}];}return db[_0x6dd0('0x29')][_0x6dd0('0x3e')](_0x11689e);})[_0x6dd0('0x22')](function(_0xb34b1){_0x2766d4[_0x6dd0('0x3f')]=_0xb34b1;return _0x2766d4;})['then'](respondWithFilteredResult(_0x15bbdd,_0x11689e))[_0x6dd0('0x40')](handleError(_0x15bbdd,null));};exports['show']=function(_0x4eadd9,_0x250ded){var _0xdb70ce={'raw':!![],'where':{'id':_0x4eadd9[_0x6dd0('0x41')]['id']}},_0x2cf43d={};_0x2cf43d[_0x6dd0('0x2e')]=_[_0x6dd0('0x30')](db[_0x6dd0('0x29')][_0x6dd0('0x2a')]);_0x2cf43d['query']=_['keys'](_0x4eadd9[_0x6dd0('0x2f')]);_0x2cf43d[_0x6dd0('0x31')]=_[_0x6dd0('0x32')](_0x2cf43d[_0x6dd0('0x2e')],_0x2cf43d[_0x6dd0('0x2f')]);_0xdb70ce[_0x6dd0('0x33')]=_[_0x6dd0('0x32')](_0x2cf43d[_0x6dd0('0x2e')],qs['fields'](_0x4eadd9[_0x6dd0('0x2f')][_0x6dd0('0x42')]));_0xdb70ce[_0x6dd0('0x33')]=_0xdb70ce[_0x6dd0('0x33')][_0x6dd0('0x34')]?_0xdb70ce[_0x6dd0('0x33')]:_0x2cf43d[_0x6dd0('0x2e')];if(_0x4eadd9[_0x6dd0('0x2f')]['includeAll']){_0xdb70ce[_0x6dd0('0x3d')]=[{'all':!![]}];}_0xdb70ce=_[_0x6dd0('0x39')]({},_0xdb70ce,_0x4eadd9[_0x6dd0('0x3b')]);return db[_0x6dd0('0x29')][_0x6dd0('0x43')](_0xdb70ce)['then'](handleEntityNotFound(_0x250ded,null))[_0x6dd0('0x22')](respondWithResult(_0x250ded,null))[_0x6dd0('0x40')](handleError(_0x250ded,null));};exports[_0x6dd0('0x44')]=function(_0x26f83e,_0x2135ca){return db[_0x6dd0('0x29')][_0x6dd0('0x44')](_0x26f83e[_0x6dd0('0x45')],{})[_0x6dd0('0x22')](respondWithResult(_0x2135ca,0xc9))[_0x6dd0('0x40')](handleError(_0x2135ca,null));};exports['update']=function(_0x290a43,_0x272626){if(_0x290a43[_0x6dd0('0x45')]['id']){delete _0x290a43[_0x6dd0('0x45')]['id'];}return db[_0x6dd0('0x29')][_0x6dd0('0x43')]({'where':{'id':_0x290a43[_0x6dd0('0x41')]['id']}})[_0x6dd0('0x22')](handleEntityNotFound(_0x272626,null))[_0x6dd0('0x22')](saveUpdates(_0x290a43['body'],null))[_0x6dd0('0x22')](respondWithResult(_0x272626,null))[_0x6dd0('0x40')](handleError(_0x272626,null));};exports[_0x6dd0('0x23')]=function(_0x129247,_0x2f3ae8){return db['FaxApplication'][_0x6dd0('0x43')]({'where':{'id':_0x129247[_0x6dd0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f3ae8,null))[_0x6dd0('0x22')](removeEntity(_0x2f3ae8,null))['catch'](handleError(_0x2f3ae8,null));}; \ No newline at end of file +var _0x77e5=['FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','reject','save','update','destroy','then','error','stack','name','index','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x77e5,0x1b8));var _0x577e=function(_0x4a9001,_0xb56957){_0x4a9001=_0x4a9001-0x0;var _0x436053=_0x77e5[_0x4a9001];return _0x436053;};'use strict';var pdf=require(_0x577e('0x0'));var emlformat=require(_0x577e('0x1'));var rimraf=require(_0x577e('0x2'));var zipdir=require(_0x577e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x577e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x577e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x577e('0x6'));var ejs=require(_0x577e('0x7'));var fs=require('fs');var _=require(_0x577e('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x577e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x577e('0x6'));var querystring=require(_0x577e('0xa'));var Papa=require(_0x577e('0xb'));var Redis=require('ioredis');var authService=require(_0x577e('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x577e('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x577e('0xe'))(_0x577e('0xf'));var utils=require(_0x577e('0x10'));var config=require(_0x577e('0x11'));var licenseUtil=require(_0x577e('0x12'));var db=require(_0x577e('0x13'))['db'];function respondWithStatusCode(_0x5187df,_0x417dca){_0x417dca=_0x417dca||0xcc;return function(_0x52123d){if(_0x52123d){return _0x5187df[_0x577e('0x14')](_0x417dca);}return _0x5187df['status'](_0x417dca)[_0x577e('0x15')]();};}function respondWithResult(_0x4c636e,_0x265176){_0x265176=_0x265176||0xc8;return function(_0x300c53){if(_0x300c53){return _0x4c636e[_0x577e('0x16')](_0x265176)['json'](_0x300c53);}};}function respondWithFilteredResult(_0x5ca069,_0x404062){return function(_0x277f74){if(_0x277f74){var _0x28edc7=_0x277f74[_0x577e('0x17')],_0x2dfa20=_0x404062[_0x577e('0x18')],_0x53111a=_0x404062[_0x577e('0x18')]+_0x404062['limit'],_0xce3937;if(_0x53111a>=_0x28edc7){_0x53111a=_0x28edc7;_0xce3937=0xc8;}else{_0xce3937=0xce;}_0x5ca069[_0x577e('0x16')](_0xce3937);return _0x5ca069[_0x577e('0x19')]('Content-Range',_0x2dfa20+'-'+_0x53111a+'/'+_0x28edc7)['json'](_0x277f74);}return null;};}function patchUpdates(_0x12db90){return function(_0x4d31cc){try{jsonpatch['apply'](_0x4d31cc,_0x12db90,!![]);}catch(_0x477eb5){return BPromise[_0x577e('0x1a')](_0x477eb5);}return _0x4d31cc[_0x577e('0x1b')]();};}function saveUpdates(_0x16dcd7,_0x4aff16){return function(_0x62ecbf){if(_0x62ecbf){return _0x62ecbf[_0x577e('0x1c')](_0x16dcd7)['then'](function(_0x28886b){return _0x28886b;});}return null;};}function removeEntity(_0x257f22,_0x2cb29d){return function(_0x2edd4a){if(_0x2edd4a){return _0x2edd4a[_0x577e('0x1d')]()[_0x577e('0x1e')](function(){_0x257f22['status'](0xcc)[_0x577e('0x15')]();});}};}function handleEntityNotFound(_0x452cb6,_0x3bd614){return function(_0x4ff634){if(!_0x4ff634){_0x452cb6[_0x577e('0x14')](0x194);}return _0x4ff634;};}function handleError(_0xc46eba,_0x30557d){_0x30557d=_0x30557d||0x1f4;return function(_0x2d3dfa){logger[_0x577e('0x1f')](_0x2d3dfa[_0x577e('0x20')]);if(_0x2d3dfa[_0x577e('0x21')]){delete _0x2d3dfa[_0x577e('0x21')];}_0xc46eba[_0x577e('0x16')](_0x30557d)['send'](_0x2d3dfa);};}exports[_0x577e('0x22')]=function(_0x3f73f0,_0xedad02){var _0xd74582={},_0x55392c={},_0x1888fa={'count':0x0,'rows':[]};var _0x44f988=_[_0x577e('0x23')](db[_0x577e('0x24')][_0x577e('0x25')],function(_0x52cd6b){return{'name':_0x52cd6b[_0x577e('0x26')],'type':_0x52cd6b[_0x577e('0x27')][_0x577e('0x28')]};});_0x55392c[_0x577e('0x29')]=_[_0x577e('0x23')](_0x44f988,_0x577e('0x21'));_0x55392c[_0x577e('0x2a')]=_[_0x577e('0x2b')](_0x3f73f0['query']);_0x55392c['filters']=_['intersection'](_0x55392c[_0x577e('0x29')],_0x55392c['query']);_0xd74582[_0x577e('0x2c')]=_['intersection'](_0x55392c['model'],qs[_0x577e('0x2d')](_0x3f73f0[_0x577e('0x2a')][_0x577e('0x2d')]));_0xd74582[_0x577e('0x2c')]=_0xd74582[_0x577e('0x2c')][_0x577e('0x2e')]?_0xd74582[_0x577e('0x2c')]:_0x55392c[_0x577e('0x29')];if(!_0x3f73f0[_0x577e('0x2a')][_0x577e('0x2f')](_0x577e('0x30'))){_0xd74582[_0x577e('0x31')]=qs['limit'](_0x3f73f0[_0x577e('0x2a')][_0x577e('0x31')]);_0xd74582[_0x577e('0x18')]=qs[_0x577e('0x18')](_0x3f73f0['query']['offset']);}_0xd74582[_0x577e('0x32')]=qs[_0x577e('0x33')](_0x3f73f0[_0x577e('0x2a')][_0x577e('0x33')]);_0xd74582[_0x577e('0x34')]=qs[_0x577e('0x35')](_[_0x577e('0x36')](_0x3f73f0[_0x577e('0x2a')],_0x55392c[_0x577e('0x35')]),_0x44f988);if(_0x3f73f0[_0x577e('0x2a')]['filter']){_0xd74582[_0x577e('0x34')]=_[_0x577e('0x37')](_0xd74582[_0x577e('0x34')],{'$or':_['map'](_0x44f988,function(_0xb4d27){if(_0xb4d27[_0x577e('0x27')]!==_0x577e('0x38')){var _0x3d6e2e={};_0x3d6e2e[_0xb4d27['name']]={'$like':'%'+_0x3f73f0[_0x577e('0x2a')][_0x577e('0x39')]+'%'};return _0x3d6e2e;}})});}_0xd74582=_[_0x577e('0x37')]({},_0xd74582,_0x3f73f0[_0x577e('0x3a')]);var _0x5142fa={'where':_0xd74582['where']};return db[_0x577e('0x24')][_0x577e('0x17')](_0x5142fa)[_0x577e('0x1e')](function(_0x2dd470){_0x1888fa[_0x577e('0x17')]=_0x2dd470;if(_0x3f73f0[_0x577e('0x2a')][_0x577e('0x3b')]){_0xd74582[_0x577e('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0x577e('0x3d')](_0xd74582);})[_0x577e('0x1e')](function(_0x16e8a6){_0x1888fa[_0x577e('0x3e')]=_0x16e8a6;return _0x1888fa;})[_0x577e('0x1e')](respondWithFilteredResult(_0xedad02,_0xd74582))[_0x577e('0x3f')](handleError(_0xedad02,null));};exports[_0x577e('0x40')]=function(_0x370023,_0x480a7b){var _0x441e6f={'raw':!![],'where':{'id':_0x370023['params']['id']}},_0x3c0183={};_0x3c0183[_0x577e('0x29')]=_[_0x577e('0x2b')](db[_0x577e('0x24')][_0x577e('0x25')]);_0x3c0183[_0x577e('0x2a')]=_[_0x577e('0x2b')](_0x370023[_0x577e('0x2a')]);_0x3c0183['filters']=_['intersection'](_0x3c0183[_0x577e('0x29')],_0x3c0183[_0x577e('0x2a')]);_0x441e6f[_0x577e('0x2c')]=_['intersection'](_0x3c0183[_0x577e('0x29')],qs[_0x577e('0x2d')](_0x370023['query']['fields']));_0x441e6f[_0x577e('0x2c')]=_0x441e6f[_0x577e('0x2c')]['length']?_0x441e6f[_0x577e('0x2c')]:_0x3c0183[_0x577e('0x29')];if(_0x370023[_0x577e('0x2a')][_0x577e('0x3b')]){_0x441e6f[_0x577e('0x3c')]=[{'all':!![]}];}_0x441e6f=_[_0x577e('0x37')]({},_0x441e6f,_0x370023[_0x577e('0x3a')]);return db[_0x577e('0x24')][_0x577e('0x41')](_0x441e6f)[_0x577e('0x1e')](handleEntityNotFound(_0x480a7b,null))['then'](respondWithResult(_0x480a7b,null))[_0x577e('0x3f')](handleError(_0x480a7b,null));};exports['create']=function(_0x2d1791,_0x18ef0f){return db['FaxApplication']['create'](_0x2d1791['body'],{})[_0x577e('0x1e')](respondWithResult(_0x18ef0f,0xc9))[_0x577e('0x3f')](handleError(_0x18ef0f,null));};exports[_0x577e('0x1c')]=function(_0x24b5b9,_0x3079b4){if(_0x24b5b9['body']['id']){delete _0x24b5b9[_0x577e('0x42')]['id'];}return db['FaxApplication'][_0x577e('0x41')]({'where':{'id':_0x24b5b9[_0x577e('0x43')]['id']}})['then'](handleEntityNotFound(_0x3079b4,null))['then'](saveUpdates(_0x24b5b9['body'],null))['then'](respondWithResult(_0x3079b4,null))[_0x577e('0x3f')](handleError(_0x3079b4,null));};exports[_0x577e('0x1d')]=function(_0x3b0680,_0x9dae91){return db['FaxApplication'][_0x577e('0x41')]({'where':{'id':_0x3b0680[_0x577e('0x43')]['id']}})[_0x577e('0x1e')](handleEntityNotFound(_0x9dae91,null))[_0x577e('0x1e')](removeEntity(_0x9dae91,null))[_0x577e('0x3f')](handleError(_0x9dae91,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index a6ab462..4e471c9 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 _0x19a1=['path','rimraf','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird'];(function(_0x394cf5,_0x93f10b){var _0xc0022c=function(_0x5ac0f9){while(--_0x5ac0f9){_0x394cf5['push'](_0x394cf5['shift']());}};_0xc0022c(++_0x93f10b);}(_0x19a1,0x17c));var _0x119a=function(_0x18bfdb,_0x241d43){_0x18bfdb=_0x18bfdb-0x0;var _0x44334c=_0x19a1[_0x18bfdb];return _0x44334c;};'use strict';var _=require(_0x119a('0x0'));var util=require(_0x119a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x119a('0x2'));var BPromise=require(_0x119a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x119a('0x4'));var rimraf=require(_0x119a('0x5'));var config=require('../../config/environment');var attributes=require(_0x119a('0x6'));module[_0x119a('0x7')]=function(_0x576c64,_0x4444eb){return _0x576c64['define'](_0x119a('0x8'),attributes,{'tableName':_0x119a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x119a('0xa'),'collate':_0x119a('0xb')});}; \ No newline at end of file +var _0x6e80=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','utf8mb4','lodash','util','../../config/logger'];(function(_0x360705,_0x4d9ac0){var _0x192d04=function(_0x17ec8d){while(--_0x17ec8d){_0x360705['push'](_0x360705['shift']());}};_0x192d04(++_0x4d9ac0);}(_0x6e80,0xb8));var _0x06e8=function(_0x14d9de,_0x374859){_0x14d9de=_0x14d9de-0x0;var _0x23dd45=_0x6e80[_0x14d9de];return _0x23dd45;};'use strict';var _=require(_0x06e8('0x0'));var util=require(_0x06e8('0x1'));var logger=require(_0x06e8('0x2'))(_0x06e8('0x3'));var moment=require(_0x06e8('0x4'));var BPromise=require(_0x06e8('0x5'));var rp=require(_0x06e8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06e8('0x7'));var config=require(_0x06e8('0x8'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x288892,_0x4207be){return _0x288892[_0x06e8('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x06e8('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5e36cda..262ba21 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 _0x4204=['http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x3b86d9,_0x40080d){var _0x4fd075=function(_0x2af0f5){while(--_0x2af0f5){_0x3b86d9['push'](_0x3b86d9['shift']());}};_0x4fd075(++_0x40080d);}(_0x4204,0x19b));var _0x4420=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x4204[_0x365e54];return _0x13317a;};'use strict';var _=require(_0x4420('0x0'));var util=require('util');var moment=require(_0x4420('0x1'));var BPromise=require(_0x4420('0x2'));var rs=require(_0x4420('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4420('0x4'))['db'];var utils=require(_0x4420('0x5'));var logger=require(_0x4420('0x6'))(_0x4420('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4420('0x8')][_0x4420('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18a7ff,_0x4dfc92,_0x313608){return new BPromise(function(_0x3ae53b,_0x50b066){return client['request'](_0x18a7ff,_0x313608)[_0x4420('0xa')](function(_0x4106d3){logger[_0x4420('0xb')](_0x4420('0xc'),_0x4dfc92,_0x4420('0xd'));logger[_0x4420('0xe')](_0x4420('0xf'),_0x4dfc92,'request\x20sent',JSON[_0x4420('0x10')](_0x4106d3));if(_0x4106d3[_0x4420('0x11')]){if(_0x4106d3[_0x4420('0x11')][_0x4420('0x12')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4dfc92,_0x4106d3[_0x4420('0x11')][_0x4420('0x13')]);return _0x50b066(_0x4106d3[_0x4420('0x11')][_0x4420('0x13')]);}logger['error'](_0x4420('0xc'),_0x4dfc92,_0x4106d3['error'][_0x4420('0x13')]);return _0x3ae53b(_0x4106d3[_0x4420('0x11')][_0x4420('0x13')]);}else{logger[_0x4420('0xb')]('FaxApplication,\x20%s,\x20%s',_0x4dfc92,_0x4420('0xd'));_0x3ae53b(_0x4106d3[_0x4420('0x14')][_0x4420('0x13')]);}})[_0x4420('0x15')](function(_0x53a549){logger['error'](_0x4420('0xc'),_0x4dfc92,_0x53a549);_0x50b066(_0x53a549);});});}exports[_0x4420('0x16')]=function(_0x37535b){var _0x1ff7c5=this;return new Promise(function(_0x883de5,_0x890f86){return db[_0x4420('0x17')][_0x4420('0x18')](_0x37535b['body'],{'raw':_0x37535b[_0x4420('0x19')]?_0x37535b[_0x4420('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37535b['options']?_0x37535b[_0x4420('0x19')][_0x4420('0x1a')]||null:null,'attributes':_0x37535b[_0x4420('0x19')]?_0x37535b[_0x4420('0x19')][_0x4420('0x1b')]||null:null,'limit':_0x37535b['options']?_0x37535b['options']['limit']||null:null})['then'](function(_0x340160){logger['info'](_0x4420('0x16'),_0x37535b);logger[_0x4420('0xe')]('UpdateFaxApplication',_0x37535b,JSON[_0x4420('0x10')](_0x340160));_0x883de5(_0x340160);})[_0x4420('0x15')](function(_0x428e63){logger[_0x4420('0x11')]('UpdateFaxApplication',_0x428e63[_0x4420('0x13')],_0x37535b);_0x890f86(_0x1ff7c5[_0x4420('0x11')](0x1f4,_0x428e63[_0x4420('0x13')]));});});}; \ No newline at end of file +var _0x2b47=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','body','options','raw','where','attributes','limit','lodash','util'];(function(_0x36241f,_0xe539cd){var _0x1bbe6d=function(_0x536bac){while(--_0x536bac){_0x36241f['push'](_0x36241f['shift']());}};_0x1bbe6d(++_0xe539cd);}(_0x2b47,0x99));var _0x72b4=function(_0x133498,_0x502216){_0x133498=_0x133498-0x0;var _0x10f5c5=_0x2b47[_0x133498];return _0x10f5c5;};'use strict';var _=require(_0x72b4('0x0'));var util=require(_0x72b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x72b4('0x2'));var fs=require('fs');var Redis=require(_0x72b4('0x3'));var db=require(_0x72b4('0x4'))['db'];var utils=require(_0x72b4('0x5'));var logger=require(_0x72b4('0x6'))(_0x72b4('0x7'));var config=require(_0x72b4('0x8'));var jayson=require(_0x72b4('0x9'));var client=jayson[_0x72b4('0xa')][_0x72b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2304cd,_0x4d1f45,_0x25895f){return new BPromise(function(_0x5d70e6,_0x112782){return client[_0x72b4('0xc')](_0x2304cd,_0x25895f)[_0x72b4('0xd')](function(_0x46b5e1){logger[_0x72b4('0xe')](_0x72b4('0xf'),_0x4d1f45,_0x72b4('0x10'));logger[_0x72b4('0x11')](_0x72b4('0x12'),_0x4d1f45,_0x72b4('0x10'),JSON[_0x72b4('0x13')](_0x46b5e1));if(_0x46b5e1[_0x72b4('0x14')]){if(_0x46b5e1['error']['code']===0x1f4){logger[_0x72b4('0x14')](_0x72b4('0xf'),_0x4d1f45,_0x46b5e1[_0x72b4('0x14')]['message']);return _0x112782(_0x46b5e1[_0x72b4('0x14')][_0x72b4('0x15')]);}logger[_0x72b4('0x14')](_0x72b4('0xf'),_0x4d1f45,_0x46b5e1[_0x72b4('0x14')]['message']);return _0x5d70e6(_0x46b5e1['error'][_0x72b4('0x15')]);}else{logger[_0x72b4('0xe')](_0x72b4('0xf'),_0x4d1f45,_0x72b4('0x10'));_0x5d70e6(_0x46b5e1[_0x72b4('0x16')][_0x72b4('0x15')]);}})[_0x72b4('0x17')](function(_0x1de88b){logger[_0x72b4('0x14')]('FaxApplication,\x20%s,\x20%s',_0x4d1f45,_0x1de88b);_0x112782(_0x1de88b);});});}exports[_0x72b4('0x18')]=function(_0x2df1d1){var _0x3afd94=this;return new Promise(function(_0x2d155b,_0x141539){return db['FaxApplication']['update'](_0x2df1d1[_0x72b4('0x19')],{'raw':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1[_0x72b4('0x1a')][_0x72b4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1[_0x72b4('0x1a')][_0x72b4('0x1c')]||null:null,'attributes':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1[_0x72b4('0x1a')][_0x72b4('0x1d')]||null:null,'limit':_0x2df1d1[_0x72b4('0x1a')]?_0x2df1d1['options'][_0x72b4('0x1e')]||null:null})['then'](function(_0x2ed0d6){logger['info'](_0x72b4('0x18'),_0x2df1d1);logger[_0x72b4('0x11')]('UpdateFaxApplication',_0x2df1d1,JSON[_0x72b4('0x13')](_0x2ed0d6));_0x2d155b(_0x2ed0d6);})['catch'](function(_0x1f4d70){logger[_0x72b4('0x14')]('UpdateFaxApplication',_0x1f4d70[_0x72b4('0x15')],_0x2df1d1);_0x141539(_0x3afd94[_0x72b4('0x14')](0x1f4,_0x1f4d70[_0x72b4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d6704b0..998c21f 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 _0xe14b=['show','put','update','destroy','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x121248,_0x28a8f4){var _0x393138=function(_0x177681){while(--_0x177681){_0x121248['push'](_0x121248['shift']());}};_0x393138(++_0x28a8f4);}(_0xe14b,0x93));var _0xbe14=function(_0x2cae76,_0x17ae3f){_0x2cae76=_0x2cae76-0x0;var _0x5ee036=_0xe14b[_0x2cae76];return _0x5ee036;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xb')]);router['delete']('/:id',auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);module['exports']=router; \ No newline at end of file +var _0x7fbe=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x3d0fb4,_0x4e5464){var _0xea699f=function(_0x3f863d){while(--_0x3f863d){_0x3d0fb4['push'](_0x3d0fb4['shift']());}};_0xea699f(++_0x4e5464);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3c4856,_0x98f049){_0x3c4856=_0x3c4856-0x0;var _0xba2cac=_0x7fbe[_0x3c4856];return _0xba2cac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['show']);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x11')]);module[_0xe7fb('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4e83745..ea75609 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 _0x9efe=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x4cd052,_0x37c7f8){var _0x28bc96=function(_0x3f1072){while(--_0x3f1072){_0x4cd052['push'](_0x4cd052['shift']());}};_0x28bc96(++_0x37c7f8);}(_0x9efe,0xca));var _0xe9ef=function(_0x136e11,_0x29bd0b){_0x136e11=_0x136e11-0x0;var _0x36d346=_0x9efe[_0x136e11];return _0x36d346;};'use strict';var Sequelize=require('sequelize');module[_0xe9ef('0x0')]={'closed':{'type':Sequelize[_0xe9ef('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe9ef('0x2')]},'disposition':{'type':Sequelize[_0xe9ef('0x3')]},'secondDisposition':{'type':Sequelize[_0xe9ef('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe9ef('0x3')]},'read1stAt':{'type':Sequelize[_0xe9ef('0x2')]},'fax':{'type':Sequelize[_0xe9ef('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe9ef('0x4')]('in',_0xe9ef('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe9ef('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe9ef('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x12e9=['ENUM','out','BOOLEAN','STRING','DATE'];(function(_0x386e27,_0x1124fc){var _0x1539b6=function(_0x5427a5){while(--_0x5427a5){_0x386e27['push'](_0x386e27['shift']());}};_0x1539b6(++_0x1124fc);}(_0x12e9,0x66));var _0x912e=function(_0x297adf,_0x4c1375){_0x297adf=_0x297adf-0x0;var _0x148a7b=_0x12e9[_0x297adf];return _0x148a7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x912e('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x912e('0x1')]},'secondDisposition':{'type':Sequelize[_0x912e('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x912e('0x1')]},'read1stAt':{'type':Sequelize[_0x912e('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x912e('0x3')]('in',_0x912e('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x912e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x912e('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 27ef1ee..fd04604 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 _0x0713=['Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','error','stack','name','send','fullname','TagIds','forEach','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','key','model','keys','query','attributes','length','nolimit','order','sort','filters','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','fax_interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','intersection','fields','includeAll','include','options','create','update','params','describe','addMessage','FaxMessage','ids','omit','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','color','emit','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip'];(function(_0x2a2c5e,_0x1417a0){var _0x3c72ae=function(_0x329eb1){while(--_0x329eb1){_0x2a2c5e['push'](_0x2a2c5e['shift']());}};_0x3c72ae(++_0x1417a0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];config['redis']=_['defaults'](config[_0x3071('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3071('0x1c'))(new Redis(config[_0x3071('0x1b')]));require('./faxInteraction.socket')[_0x3071('0x1d')](socket);function respondWithStatusCode(_0x4e1219,_0x2fc15d){_0x2fc15d=_0x2fc15d||0xcc;return function(_0x45c93b){if(_0x45c93b){return _0x4e1219[_0x3071('0x1e')](_0x2fc15d);}return _0x4e1219[_0x3071('0x1f')](_0x2fc15d)[_0x3071('0x20')]();};}function respondWithResult(_0x2a6a4b,_0x157a47){_0x157a47=_0x157a47||0xc8;return function(_0x11bdc9){if(_0x11bdc9){return _0x2a6a4b[_0x3071('0x1f')](_0x157a47)[_0x3071('0x21')](_0x11bdc9);}};}function respondWithFilteredResult(_0x5f3c22,_0x224996){return function(_0x17dbda){if(_0x17dbda){var _0x1068d9=_0x17dbda[_0x3071('0x22')],_0x108a83=_0x224996[_0x3071('0x23')],_0x3acf0e=_0x224996['offset']+_0x224996[_0x3071('0x24')],_0x17aee2;if(_0x3acf0e>=_0x1068d9){_0x3acf0e=_0x1068d9;_0x17aee2=0xc8;}else{_0x17aee2=0xce;}_0x5f3c22[_0x3071('0x1f')](_0x17aee2);return _0x5f3c22[_0x3071('0x25')]('Content-Range',_0x108a83+'-'+_0x3acf0e+'/'+_0x1068d9)[_0x3071('0x21')](_0x17dbda);}return null;};}function patchUpdates(_0x5cd80d){return function(_0x833074){try{jsonpatch[_0x3071('0x26')](_0x833074,_0x5cd80d,!![]);}catch(_0x3762d8){return BPromise[_0x3071('0x27')](_0x3762d8);}return _0x833074[_0x3071('0x28')]();};}function saveUpdates(_0x34c50e,_0x3c5cef){return function(_0x211b4f){if(_0x211b4f){return _0x211b4f['update'](_0x34c50e)['then'](function(_0x2ce48a){return _0x2ce48a;});}return null;};}function removeEntity(_0xb05b1d,_0x412652){return function(_0x13df9f){if(_0x13df9f){return _0x13df9f[_0x3071('0x29')]()[_0x3071('0x2a')](function(){_0xb05b1d[_0x3071('0x1f')](0xcc)[_0x3071('0x20')]();});}};}function handleEntityNotFound(_0x1de5fb,_0x4c7130){return function(_0x2e5f93){if(!_0x2e5f93){_0x1de5fb[_0x3071('0x1e')](0x194);}return _0x2e5f93;};}function handleError(_0x177138,_0x4d5c4b){_0x4d5c4b=_0x4d5c4b||0x1f4;return function(_0x4fb1ca){logger[_0x3071('0x2b')](_0x4fb1ca[_0x3071('0x2c')]);if(_0x4fb1ca[_0x3071('0x2d')]){delete _0x4fb1ca[_0x3071('0x2d')];}_0x177138[_0x3071('0x1f')](_0x4d5c4b)[_0x3071('0x2e')](_0x4fb1ca);};}function getInteractionUsers(_0x3921a1,_0x32f1b4){return new BPromise(function(_0x292205,_0x254fc8){try{if(_0x32f1b4[_0x3921a1['id']]){_0x3921a1['Users']=_['map'](_0x32f1b4[_0x3921a1['id']],function(_0x9e26d1){return{'id':_0x9e26d1['id'],'fullname':_0x9e26d1[_0x3071('0x2f')]};});}}catch(_0x6ddf96){_0x254fc8(_0x6ddf96);}_0x292205(_0x3921a1);});}function getInteractionTags(_0x40be95,_0x3f6d90){return new BPromise(function(_0x29538c,_0x32b6b1){try{if(_0x40be95[_0x3071('0x30')]){_0x40be95['Tags']=[];_0x40be95['TagIds']['split'](',')[_0x3071('0x31')](function(_0x392800){_0x40be95['Tags'][_0x3071('0x32')](_0x3f6d90[_0x392800]);});}delete _0x40be95[_0x3071('0x30')];}catch(_0x25250e){_0x32b6b1(_0x25250e);}_0x29538c(_0x40be95);});}function updateFaxInteraction(_0x13ae2c,_0x5e1d2b,_0x218a82){return new BPromise(function(_0x1525df,_0x602719){return getInteractionUsers(_0x13ae2c,_0x218a82)[_0x3071('0x2a')](function(_0x148096){return getInteractionTags(_0x148096,_0x5e1d2b);})[_0x3071('0x2a')](function(_0x3c55c){_0x1525df(_0x3c55c);})[_0x3071('0x33')](function(_0x596cc3){_0x602719(_0x596cc3);});});}exports[_0x3071('0x34')]=function(_0x54e52f,_0x4fb1ec){var _0x1a1a64={},_0xa3a7ae={},_0x54d9c3={'count':0x0,'rows':[]};var _0x2e85c8=_[_0x3071('0x35')](db[_0x3071('0x36')][_0x3071('0x37')],function(_0xc60572){return{'name':_0xc60572[_0x3071('0x38')],'type':_0xc60572['type'][_0x3071('0x39')]};});_0xa3a7ae[_0x3071('0x3a')]=_['map'](_0x2e85c8,_0x3071('0x2d'));_0xa3a7ae['query']=_[_0x3071('0x3b')](_0x54e52f[_0x3071('0x3c')]);_0xa3a7ae['filters']=_['intersection'](_0xa3a7ae[_0x3071('0x3a')],_0xa3a7ae[_0x3071('0x3c')]);_0x1a1a64[_0x3071('0x3d')]=_['intersection'](_0xa3a7ae[_0x3071('0x3a')],qs['fields'](_0x54e52f[_0x3071('0x3c')]['fields']));_0x1a1a64[_0x3071('0x3d')]=_0x1a1a64[_0x3071('0x3d')][_0x3071('0x3e')]?_0x1a1a64[_0x3071('0x3d')]:_0xa3a7ae[_0x3071('0x3a')];if(!_0x54e52f['query']['hasOwnProperty'](_0x3071('0x3f'))){_0x1a1a64[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x54e52f[_0x3071('0x3c')]['limit']);_0x1a1a64[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x54e52f[_0x3071('0x3c')][_0x3071('0x23')]);}_0x1a1a64[_0x3071('0x40')]=qs[_0x3071('0x41')](_0x54e52f['query'][_0x3071('0x41')]);_0x1a1a64['where']=qs['filters'](_['pick'](_0x54e52f['query'],_0xa3a7ae[_0x3071('0x42')]),_0x2e85c8);var _0x1be8b6=[];var _0x67b2fb=squel[_0x3071('0x43')]()[_0x3071('0x44')]('id')[_0x3071('0x44')](_0x3071('0x2d'))[_0x3071('0x44')]('color')[_0x3071('0x45')](_0x3071('0x46'));var _0x44a879=squel[_0x3071('0x43')]()[_0x3071('0x44')]('u.id')['field'](_0x3071('0x47'))[_0x3071('0x44')](_0x3071('0x48'))[_0x3071('0x45')](_0x3071('0x49'),'ui')['left_join'](_0x3071('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x18a773=squel['select']()['from'](_0x3071('0x4b'),'i')['left_join'](_0x3071('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3071('0x4d')](_0x3071('0x4a'),'o',_0x3071('0x4e'))[_0x3071('0x4d')]('fax_accounts','a',_0x3071('0x4f'))['left_join'](_0x3071('0x50'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x3071('0x4d')](_0x3071('0x51'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x3071('0x4d')](_0x3071('0x46'),'t',_0x3071('0x52'));var _0x38bcc2=squel[_0x3071('0x53')]();var _0x2622b4=[];var _0x145378=squel['expr']();var _0x2c6e4c;if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x54')]){_0x2c6e4c=as[_0x3071('0x55')](_0x54e52f['query'][_0x3071('0x54')]);var _0x2aea37=_0x2c6e4c[_0x3071('0x56')];for(var _0x2307dd=0x0;_0x2307dd<_0x2c6e4c[_0x3071('0x57')][_0x3071('0x3e')];_0x2307dd++){var _0x3ab6d4=_0x2c6e4c[_0x3071('0x57')][_0x2307dd];var _0xbf014e='i';var _0x886f7=_[_0x3071('0x58')](_0x2e85c8,[_0x3071('0x2d'),_0x3ab6d4[_0x3071('0x44')]]);if(!_0x886f7){switch(_0x3ab6d4[_0x3071('0x44')]){case _0x3071('0x59'):if(_0x3ab6d4[_0x3071('0x5a')]==0x1){_0x18a773['having']('`'+_0x3ab6d4['field']+_0x3071('0x5b'));}else{_0x18a773['having']('`'+_0x3ab6d4[_0x3071('0x44')]+_0x3071('0x5c'));}break;case _0x3071('0x5d'):if(_0x3ab6d4['operator']===_0x3071('0x5e')){if(_0x3ab6d4[_0x3071('0x5a')]['split']('\x20')['length']>0x1){_0x38bcc2[_0x2aea37](_0x3071('0x5f'),qs[_0x3071('0x60')](_0x3ab6d4[_0x3071('0x5a')]),null);}else{var _0x3206c3='%'+_0x3ab6d4['value']+'%';_0x38bcc2[_0x2aea37](_0x3071('0x61'),_0x3206c3,_0x3206c3,_0x3206c3);}}else{_0x886f7=_[_0x3071('0x58')](_0x2e85c8,[_0x3071('0x2d'),_0x3071('0x62')]);_0x3ab6d4[_0x3071('0x44')]='ContactId';_0x466835=as[_0x3071('0x63')](_0xbf014e,_0x886f7[_0x3071('0x64')],_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835[_0x3071('0x65')],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')][_0x3071('0x20')]);}break;case'Tag':var _0x4d6ed0=_0x3ab6d4[_0x3071('0x5a')]['split'](',')[_0x3071('0x35')](function(_0x26ba8a){return Number(_0x26ba8a);});_0x4d6ed0['forEach'](function(_0x19dc95){_0x145378['or'](_0x3071('0x67'),'%,'+_0x19dc95+',%');});_0x2622b4=_['union'](_0x2622b4,_0x4d6ed0);break;case _0x3071('0x68'):if(_0x3ab6d4[_0x3071('0x69')]===_0x3071('0x5e')){_0x38bcc2[_0x2aea37](_0x3071('0x6a'),'%'+_0x3ab6d4[_0x3071('0x5a')]+'%',null);}else{_0x886f7=_['find'](_0x2e85c8,[_0x3071('0x2d'),_0x3071('0x6b')]);_0x3ab6d4[_0x3071('0x44')]='UserId';_0x466835=as[_0x3071('0x63')](_0xbf014e,_0x886f7[_0x3071('0x64')],_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835[_0x3071('0x65')],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')][_0x3071('0x20')]);}break;case _0x3071('0x6c'):_0x466835=as[_0x3071('0x63')]('me',null,_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835['text'],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')][_0x3071('0x20')]);break;}}else{var _0x466835=as[_0x3071('0x63')](_0xbf014e,_0x886f7[_0x3071('0x64')],_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835[_0x3071('0x65')],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')]['end']);}}}else{var _0x320fe6=_(_0x54e52f[_0x3071('0x3c')])[_0x3071('0x3b')]()[_0x3071('0x35')](function(_0x429a03){return _[_0x3071('0x6d')](_0x2e85c8,[_0x3071('0x2d'),_0x429a03])?_0x429a03:undefined;})[_0x3071('0x6e')]()['value']();if(!_[_0x3071('0x6f')](_0x320fe6)){_0x320fe6[_0x3071('0x31')](function(_0x59ba87){if(_0x59ba87==='FaxAccountId'){_0x18a773[_0x3071('0x70')](_0x3071('0x71'),[][_0x3071('0x72')](_0x54e52f[_0x3071('0x3c')][_0x59ba87]));}else if(_0x59ba87==='createdAt'){var _0x52955a=JSON[_0x3071('0x73')](_0x54e52f['query'][_0x59ba87])['$gte'];var _0x5113fc=JSON['parse'](_0x54e52f[_0x3071('0x3c')][_0x59ba87])[_0x3071('0x74')];_0x18a773[_0x3071('0x70')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x52955a,_0x5113fc);}else{if(_0x54e52f[_0x3071('0x3c')][_0x59ba87]===_0x3071('0x75')){_0x18a773[_0x3071('0x70')]('i.'+_0x59ba87+_0x3071('0x76'));}else{_0x18a773['where']('i.'+_0x59ba87+_0x3071('0x77'),_0x54e52f[_0x3071('0x3c')][_0x59ba87]);}}});}if(_0x54e52f['query'][_0x3071('0x78')]){if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x78')]==0x1){_0x18a773[_0x3071('0x79')](_0x3071('0x7a'));}else{_0x18a773[_0x3071('0x79')](_0x3071('0x7b'));}}if(_0x54e52f['query']['tag']){_0x2622b4=_[_0x3071('0x7c')](_0x54e52f[_0x3071('0x3c')][_0x3071('0x7d')])?_0x54e52f['query']['tag']:new Array(_0x54e52f[_0x3071('0x3c')][_0x3071('0x7d')]);_0x2622b4[_0x3071('0x31')](function(_0x3e733c){_0x145378['or'](_0x3071('0x67'),'%,'+_0x3e733c+',%');});}if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x7e')]){var _0x268657=_0x54e52f['query'][_0x3071('0x7e')]['replace']('\x5c','\x5c\x5c')[_0x3071('0x7f')](/'/g,'\x27\x27');if(qs[_0x3071('0x80')](_0x268657)){_0x38bcc2['or'](_0x3071('0x81'),_0x268657+'%')['or'](_0x3071('0x82'),_0x268657+'%');}_0x38bcc2['or'](_0x3071('0x83'),_0x268657+'%');}}_0x18a773[_0x3071('0x70')](_0x38bcc2);_0x18a773[_0x3071('0x84')](_0x3071('0x85'));var _0x4fa372={'type':db[_0x3071('0x86')][_0x3071('0x87')][_0x3071('0x88')],'raw':!![]};var _0x4f06c0=_0x18a773[_0x3071('0x89')]();_0x4f06c0[_0x3071('0x44')](_0x3071('0x85'));_0x4f06c0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3071('0x59'));if(_0x1a1a64['order']){_0x1a1a64[_0x3071('0x40')][_0x3071('0x31')](function(_0x40d987){var _0x23bc22=_0x40d987[0x0]===_0x3071('0x8a')?_0x40d987[0x0]:'i.'+_0x40d987[0x0];_0x18a773[_0x3071('0x40')](_0x23bc22,_0x40d987[0x1]===_0x3071('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x2622b4)){_0x18a773[_0x3071('0x79')](_0x145378);_0x4f06c0[_0x3071('0x70')](_0x3071('0x8c'),_0x2622b4);}BPromise[_0x3071('0x8d')]()[_0x3071('0x2a')](function(){if(!_0x2c6e4c){if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x8e')]||_0x54e52f[_0x3071('0x3c')]['journey'])return;_0x4f06c0[_0x3071('0x70')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x18a773[_0x3071('0x70')](_0x3071('0x8f'));return;}if(_0x54e52f[_0x3071('0x90')][_0x3071('0x91')]!==_0x3071('0x92'))return;return _0x54e52f[_0x3071('0x90')][_0x3071('0x93')]({'attributes':['id'],'raw':!![]})[_0x3071('0x2a')](function(_0x77df0){if(_[_0x3071('0x6f')](_0x77df0)){_0x4f06c0['where'](_0x3071('0x94'));_0x18a773[_0x3071('0x70')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4f06c0[_0x3071('0x70')](_0x3071('0x71'),_[_0x3071('0x35')](_0x77df0,'id'));_0x18a773[_0x3071('0x70')](_0x3071('0x71'),_['map'](_0x77df0,'id'));}});})['then'](function(){if(_0x54e52f[_0x3071('0x90')]['role']===_0x3071('0x92')&&!_0x2c6e4c&&!_0x54e52f[_0x3071('0x3c')][_0x3071('0x8e')])return[];return db[_0x3071('0x95')][_0x3071('0x3c')](_0x4f06c0[_0x3071('0x96')](),_0x4fa372);})['then'](function(_0x290d1c){_0x54d9c3[_0x3071('0x22')]=_0x290d1c[_0x3071('0x3e')];if(_0x54d9c3[_0x3071('0x22')]===0x0)return[];return db['sequelize'][_0x3071('0x3c')](_0x67b2fb[_0x3071('0x96')](),_0x4fa372)['then'](function(_0x3adaa2){_0x1be8b6=_[_0x3071('0x97')](_0x3adaa2,'id');_0x4fa372=_[_0x3071('0x98')](_0x4fa372,{'model':db[_0x3071('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54e52f[_0x3071('0x3c')]['fields']){_0x1a1a64[_0x3071('0x3d')]['forEach'](function(_0x34b88b){_0x18a773[_0x3071('0x44')]('i.'+_0x34b88b);});}else{_0x18a773[_0x3071('0x44')](_0x3071('0x99'),_0x3071('0x59'));_0x18a773[_0x3071('0x44')](_0x3071('0x9a'),_0x3071('0x9b'));_0x18a773['field'](_0x3071('0x9c'),_0x3071('0x9d'));_0x18a773[_0x3071('0x44')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3071('0x8a'));_0x18a773['field'](_0x3071('0x9e'));_0x18a773[_0x3071('0x44')](_0x3071('0x9f'),'Contact.firstName');_0x18a773[_0x3071('0x44')](_0x3071('0xa0'),_0x3071('0xa1'));_0x18a773[_0x3071('0x44')](_0x3071('0xa2'),_0x3071('0xa3'));_0x18a773[_0x3071('0x44')](_0x3071('0xa4'),_0x3071('0xa5'));_0x18a773['field'](_0x3071('0xa6'),_0x3071('0xa7'));_0x18a773[_0x3071('0x44')]('c.fax','Contact.fax');_0x18a773['field']('o.fullname','Owner.fullname');_0x18a773[_0x3071('0x44')](_0x3071('0xa8'),'Owner.internal');_0x18a773[_0x3071('0x44')](_0x3071('0xa9'),_0x3071('0x30'));}if(_0x1a1a64['limit'])_0x18a773['limit'](_0x1a1a64[_0x3071('0x24')]);if(_0x1a1a64[_0x3071('0x23')])_0x18a773[_0x3071('0x23')](_0x1a1a64[_0x3071('0x23')]);return db[_0x3071('0x95')][_0x3071('0x3c')](_0x18a773[_0x3071('0x96')](),_0x4fa372);})['then'](function(_0x58b62c){_0x44a879[_0x3071('0x70')](_0x3071('0xaa'),_[_0x3071('0x35')](_0x58b62c,'id'));return db[_0x3071('0x95')]['query'](_0x44a879[_0x3071('0x96')](),_0x4fa372)[_0x3071('0x2a')](function(_0x23fa38){var _0x1102b4=_[_0x3071('0xab')](_0x23fa38,_0x3071('0xac'));var _0x234f62=[];_0x58b62c[_0x3071('0x31')](function(_0x50b5d7){_0x234f62[_0x3071('0x32')](updateFaxInteraction(_0x50b5d7,_0x1be8b6,_0x1102b4));});return BPromise[_0x3071('0xad')](_0x234f62);});});})[_0x3071('0x2a')](function(_0x9dba3){_0x54d9c3[_0x3071('0xae')]=_0x9dba3;return _0x54d9c3;})['then'](respondWithFilteredResult(_0x4fb1ec,_0x1a1a64))[_0x3071('0x33')](handleError(_0x4fb1ec,null));};exports['show']=function(_0x546a69,_0x12a888){var _0x3108ea={'raw':![],'where':{'id':_0x546a69['params']['id']}},_0xb54605={};_0xb54605[_0x3071('0x3a')]=_[_0x3071('0x3b')](db[_0x3071('0x36')][_0x3071('0x37')]);_0xb54605[_0x3071('0x3c')]=_['keys'](_0x546a69['query']);_0xb54605[_0x3071('0x42')]=_[_0x3071('0xaf')](_0xb54605['model'],_0xb54605[_0x3071('0x3c')]);_0x3108ea[_0x3071('0x3d')]=_[_0x3071('0xaf')](_0xb54605[_0x3071('0x3a')],qs[_0x3071('0xb0')](_0x546a69['query'][_0x3071('0xb0')]));_0x3108ea['attributes']=_0x3108ea[_0x3071('0x3d')][_0x3071('0x3e')]?_0x3108ea['attributes']:_0xb54605[_0x3071('0x3a')];if(_0x546a69['query'][_0x3071('0xb1')]){_0x3108ea[_0x3071('0xb2')]=[{'all':!![]}];}_0x3108ea=_[_0x3071('0x98')]({},_0x3108ea,_0x546a69[_0x3071('0xb3')]);return db['FaxInteraction'][_0x3071('0x58')](_0x3108ea)['then'](handleEntityNotFound(_0x12a888,null))[_0x3071('0x2a')](respondWithResult(_0x12a888,null))['catch'](handleError(_0x12a888,null));};exports[_0x3071('0xb4')]=function(_0x3ce867,_0x4a1081){return db[_0x3071('0x36')][_0x3071('0xb4')](_0x3ce867['body'],{})[_0x3071('0x2a')](respondWithResult(_0x4a1081,0xc9))[_0x3071('0x33')](handleError(_0x4a1081,null));};exports[_0x3071('0xb5')]=function(_0x28c8a3,_0x80f1be){if(_0x28c8a3[_0x3071('0x6c')]['id']){delete _0x28c8a3[_0x3071('0x6c')]['id'];}return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x28c8a3[_0x3071('0xb6')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x80f1be,null))[_0x3071('0x2a')](saveUpdates(_0x28c8a3[_0x3071('0x6c')],null))[_0x3071('0x2a')](respondWithResult(_0x80f1be,null))[_0x3071('0x33')](handleError(_0x80f1be,null));};exports['destroy']=function(_0x1aff4e,_0x1a4a26){return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x1aff4e[_0x3071('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1a4a26,null))['then'](removeEntity(_0x1a4a26,null))[_0x3071('0x33')](handleError(_0x1a4a26,null));};exports[_0x3071('0xb7')]=function(_0x50a0de,_0x3ae8cb){return db[_0x3071('0x36')]['describe']()[_0x3071('0x2a')](respondWithResult(_0x3ae8cb,null))[_0x3071('0x33')](handleError(_0x3ae8cb,null));};exports[_0x3071('0xb8')]=function(_0x3c91d6,_0x30ed66,_0x62fbbc){return db[_0x3071('0xb9')][_0x3071('0x58')]({'where':{'id':_0x3c91d6[_0x3071('0xb6')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x30ed66,null))['then'](function(_0xc2a5aa){if(_0xc2a5aa){return _0xc2a5aa['addMessage'](_0x3c91d6[_0x3071('0x6c')][_0x3071('0xba')],_[_0x3071('0xbb')](_0x3c91d6[_0x3071('0x6c')],['ids','id'])||{});}})['then'](respondWithResult(_0x30ed66,null))['catch'](handleError(_0x30ed66,null));};exports[_0x3071('0xbc')]=function(_0x44ae03,_0x31143d,_0x2e729c){var _0x578c17={'raw':![],'where':{}};var _0x35aef4={};var _0x7c3473={'count':0x0,'rows':[]};return db[_0x3071('0x36')]['findOne']({'where':{'id':_0x44ae03['params']['id']}})['then'](handleEntityNotFound(_0x31143d,null))['then'](function(_0x18d792){if(_0x18d792){_0x35aef4[_0x3071('0x3a')]=_['keys'](db[_0x3071('0xb9')][_0x3071('0x37')]);_0x35aef4[_0x3071('0x3c')]=_[_0x3071('0x3b')](_0x44ae03[_0x3071('0x3c')]);_0x35aef4['filters']=_[_0x3071('0xaf')](_0x35aef4[_0x3071('0x3a')],_0x35aef4[_0x3071('0x3c')]);_0x578c17[_0x3071('0x3d')]=_['intersection'](_0x35aef4[_0x3071('0x3a')],qs['fields'](_0x44ae03[_0x3071('0x3c')][_0x3071('0xb0')]));_0x578c17[_0x3071('0x3d')]=_0x578c17['attributes'][_0x3071('0x3e')]?_0x578c17[_0x3071('0x3d')]:_0x35aef4[_0x3071('0x3a')];if(!_0x44ae03[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x3f'))){_0x578c17[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x44ae03[_0x3071('0x3c')][_0x3071('0x24')]);_0x578c17['offset']=qs['offset'](_0x44ae03[_0x3071('0x3c')][_0x3071('0x23')]);}_0x578c17[_0x3071('0x40')]=qs[_0x3071('0x41')](_0x44ae03['query']['sort']);_0x578c17[_0x3071('0x70')]=qs[_0x3071('0x42')](_['pick'](_0x44ae03[_0x3071('0x3c')],_0x35aef4[_0x3071('0x42')]));_0x578c17[_0x3071('0x70')]['FaxInteractionId']=_0x18d792['id'];if(_0x44ae03['query']['filter']){_0x578c17[_0x3071('0x70')]=_[_0x3071('0x98')](_0x578c17[_0x3071('0x70')],{'$or':_['map'](_0x578c17['attributes'],function(_0x1ef8db){var _0x12020a={};_0x12020a[_0x1ef8db]={'$like':'%'+_0x44ae03[_0x3071('0x3c')][_0x3071('0x7e')]+'%'};return _0x12020a;})});}if(_0x44ae03[_0x3071('0x3c')]['$gte']){var _0x3422d8=_0x44ae03['query'][_0x3071('0xbd')][_0x3071('0xbe')](',');var _0x294316={};_0x294316[_0x3422d8[0x0]]={'$gte':moment(_0x3422d8[0x1])[_0x3071('0xbf')](_0x3071('0xc0'))};_0x578c17['where']=_[_0x3071('0x98')](_0x578c17[_0x3071('0x70')],_0x294316);}_0x578c17=_[_0x3071('0x98')]({},_0x578c17,_0x44ae03[_0x3071('0xb3')]);return db[_0x3071('0xb9')][_0x3071('0x22')]({'where':_0x578c17[_0x3071('0x70')]})[_0x3071('0x2a')](function(_0xc6bc56){_0x7c3473[_0x3071('0x22')]=_0xc6bc56;if(_0x44ae03[_0x3071('0x3c')]['includeAll']){_0x578c17[_0x3071('0xb2')]=[{'all':!![]}];}return db[_0x3071('0xb9')][_0x3071('0xc1')](_0x578c17);})[_0x3071('0x2a')](function(_0x52c77d){_0x7c3473[_0x3071('0xae')]=_0x52c77d;return _0x7c3473;});}})['then'](respondWithFilteredResult(_0x31143d,_0x578c17))[_0x3071('0x33')](handleError(_0x31143d,null));};exports[_0x3071('0xc2')]=function(_0x148924,_0xfe896c,_0x3aa03f){return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x148924['params']['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0xfe896c,null))['then'](function(_0x5dc2bf){if(_0x5dc2bf){return _0x5dc2bf[_0x3071('0xc3')](_0x148924[_0x3071('0x6c')]['ids'],_[_0x3071('0xbb')](_0x148924['body'],[_0x3071('0xba'),'id'])||{})[_0x3071('0xc4')](function(){return db[_0x3071('0xc5')][_0x3071('0xc1')]({'attributes':['id',_0x3071('0x2d'),_0x3071('0xc6')],'where':{'id':_0x148924[_0x3071('0x6c')][_0x3071('0xba')]}});})[_0x3071('0x2a')](function(_0x2fbd71){socket[_0x3071('0xc7')]('faxInteractionTags:save',{'id':Number(_0x148924[_0x3071('0xb6')]['id']),'tags':_0x2fbd71||[]});return{'id':Number(_0x148924[_0x3071('0xb6')]['id']),'tags':_0x2fbd71||[]};});}})[_0x3071('0x2a')](respondWithResult(_0xfe896c,null))['catch'](handleError(_0xfe896c,null));};exports[_0x3071('0xc8')]=function(_0x5137ff,_0x313a27,_0x293561){return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x5137ff['params']['id']}})['then'](handleEntityNotFound(_0x313a27,null))['then'](function(_0x2a77b4){if(_0x2a77b4){return _0x2a77b4['removeTags'](_0x5137ff['query'][_0x3071('0xba')]);}})['then'](respondWithStatusCode(_0x313a27,null))[_0x3071('0x33')](handleError(_0x313a27,null));};exports[_0x3071('0xc9')]=function(_0x229afe,_0x567ea9){var _0x16b566=moment()['unix']()['toString']();var _0x129567=path[_0x3071('0xca')](config[_0x3071('0xcb')],_0x3071('0xcc'),_0x3071('0xcd'),_0x3071('0xce'));var _0x3d396d=path['join'](config[_0x3071('0xcb')],_0x3071('0xcc'),_0x3071('0xcd'),_0x3071('0xcf'));var _0x2d30a3=path[_0x3071('0xca')](_0x129567,_0x16b566);var _0x12e47e=util[_0x3071('0xbf')](_0x3071('0xd0'),_0x229afe['params']['id'],_0x16b566);var _0x12765c=path[_0x3071('0xca')](_0x129567,_0x12e47e);var _0x32a43f=[];_0x32a43f[_0x3071('0x32')]({'model':db[_0x3071('0xd1')],'as':_0x3071('0xd1'),'raw':!![]});var _0x1feacb=[{'model':db['FaxMessage'],'as':_0x3071('0xd2'),'attributes':['id','body',_0x3071('0xd3')],'include':_0x32a43f}];return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x229afe['params']['id']},'include':_0x1feacb})['then'](handleEntityNotFound(_0x567ea9,null))['then'](function(_0x475047){if(_0x475047&&_0x475047[_0x3071('0xd2')]){var _0x22fdcc=_0x475047['get']({'plain':!![]});fs[_0x3071('0xd4')](_0x2d30a3);for(var _0x6351d6=0x0;_0x6351d6<_0x22fdcc[_0x3071('0xd2')][_0x3071('0x3e')];_0x6351d6++){var _0x3e788f=_0x22fdcc[_0x3071('0xd2')][_0x6351d6][_0x3071('0xd1')];if(_0x3e788f){var _0x1befe3=path[_0x3071('0xca')](_0x3d396d,_0x3e788f['basename']);if(fs[_0x3071('0xd5')](_0x1befe3)){fs[_0x3071('0xd6')](_0x1befe3)[_0x3071('0xd7')](fs['createWriteStream'](path[_0x3071('0xca')](_0x2d30a3,_0x3e788f[_0x3071('0xd8')])));}}}return BPromise[_0x3071('0x8d')]()[_0x3071('0x2a')](function(){return new BPromise(function(_0x3b5619,_0x1cc091){zipdir(_0x2d30a3,{'saveTo':_0x12765c},function(_0x3a47fd,_0x10a0c3){if(_0x3a47fd)return _0x1cc091(_0x3a47fd);return _0x3b5619(_0x10a0c3);});})[_0x3071('0x2a')](function(){return new BPromise(function(_0xf1d426,_0x242313){rimraf(_0x2d30a3,function(_0x1dd796){if(_0x1dd796)_0x242313(_0x1dd796);return _0xf1d426();});});})['then'](function(){return _0x567ea9[_0x3071('0xc9')](_0x12765c,_0x12e47e,function(_0x3e9573){if(_0x3e9573){console['log']('err',_0x3e9573);}else{fs['unlinkSync'](_0x12765c);}});});});}else{return _0x567ea9['sendStatus'](0xc8);}})[_0x3071('0x33')](handleError(_0x567ea9,null));}; \ No newline at end of file +var _0xf3cd=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','fields','includeAll','include','options','create','update','params','describe','addMessage','omit','ids','findOne','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','color','faxInteractionTags:save','removeTags','unix','root','server','files','tmp','join','transcript-%d-%s.zip','push','Attachment','Messages','basename','createReadStream','createWriteStream','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','map','TagIds','Tags','split','catch','FaxInteraction','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','contactName','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname'];(function(_0x2b2b3f,_0x3944ed){var _0x5803fe=function(_0x225585){while(--_0x225585){_0x2b2b3f['push'](_0x2b2b3f['shift']());}};_0x5803fe(++_0x3944ed);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xf3cd[_0x46a38b];return _0x346e75;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x1a')]=_[_0xdf3c('0x1b')](config[_0xdf3c('0x1a')],{'host':_0xdf3c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf3c('0x1a')]));require(_0xdf3c('0x1d'))[_0xdf3c('0x1e')](socket);function respondWithStatusCode(_0x5e0047,_0x18aafa){_0x18aafa=_0x18aafa||0xcc;return function(_0x38b01d){if(_0x38b01d){return _0x5e0047[_0xdf3c('0x1f')](_0x18aafa);}return _0x5e0047[_0xdf3c('0x20')](_0x18aafa)[_0xdf3c('0x21')]();};}function respondWithResult(_0x1a7a5a,_0x305ea5){_0x305ea5=_0x305ea5||0xc8;return function(_0x92008b){if(_0x92008b){return _0x1a7a5a[_0xdf3c('0x20')](_0x305ea5)[_0xdf3c('0x22')](_0x92008b);}};}function respondWithFilteredResult(_0x54cdd4,_0x13b0e6){return function(_0x465e7d){if(_0x465e7d){var _0xf1da1f=_0x465e7d[_0xdf3c('0x23')],_0x18d4ec=_0x13b0e6[_0xdf3c('0x24')],_0x1e2690=_0x13b0e6[_0xdf3c('0x24')]+_0x13b0e6[_0xdf3c('0x25')],_0x113b56;if(_0x1e2690>=_0xf1da1f){_0x1e2690=_0xf1da1f;_0x113b56=0xc8;}else{_0x113b56=0xce;}_0x54cdd4[_0xdf3c('0x20')](_0x113b56);return _0x54cdd4[_0xdf3c('0x26')](_0xdf3c('0x27'),_0x18d4ec+'-'+_0x1e2690+'/'+_0xf1da1f)['json'](_0x465e7d);}return null;};}function patchUpdates(_0x4d620f){return function(_0x3aa254){try{jsonpatch['apply'](_0x3aa254,_0x4d620f,!![]);}catch(_0x15776c){return BPromise[_0xdf3c('0x28')](_0x15776c);}return _0x3aa254[_0xdf3c('0x29')]();};}function saveUpdates(_0x38b319,_0x33652f){return function(_0x36ba1c){if(_0x36ba1c){return _0x36ba1c['update'](_0x38b319)[_0xdf3c('0x2a')](function(_0x213d75){return _0x213d75;});}return null;};}function removeEntity(_0x13e3ca,_0x24754a){return function(_0x40032a){if(_0x40032a){return _0x40032a[_0xdf3c('0x2b')]()[_0xdf3c('0x2a')](function(){_0x13e3ca[_0xdf3c('0x20')](0xcc)[_0xdf3c('0x21')]();});}};}function handleEntityNotFound(_0x1adee4,_0x4c076c){return function(_0xd284d7){if(!_0xd284d7){_0x1adee4[_0xdf3c('0x1f')](0x194);}return _0xd284d7;};}function handleError(_0x4b57a4,_0xdc8962){_0xdc8962=_0xdc8962||0x1f4;return function(_0x59659e){logger['error'](_0x59659e['stack']);if(_0x59659e[_0xdf3c('0x2c')]){delete _0x59659e[_0xdf3c('0x2c')];}_0x4b57a4['status'](_0xdc8962)['send'](_0x59659e);};}function getInteractionUsers(_0x37ecfd,_0x1f2ce4){return new BPromise(function(_0xd3cfcb,_0x1ccdd4){try{if(_0x1f2ce4[_0x37ecfd['id']]){_0x37ecfd['Users']=_[_0xdf3c('0x2d')](_0x1f2ce4[_0x37ecfd['id']],function(_0x2a2d94){return{'id':_0x2a2d94['id'],'fullname':_0x2a2d94['fullname']};});}}catch(_0x51e0a4){_0x1ccdd4(_0x51e0a4);}_0xd3cfcb(_0x37ecfd);});}function getInteractionTags(_0x1f1d8a,_0x46f0e3){return new BPromise(function(_0x36937e,_0x540f3a){try{if(_0x1f1d8a[_0xdf3c('0x2e')]){_0x1f1d8a[_0xdf3c('0x2f')]=[];_0x1f1d8a[_0xdf3c('0x2e')][_0xdf3c('0x30')](',')['forEach'](function(_0xda0de0){_0x1f1d8a[_0xdf3c('0x2f')]['push'](_0x46f0e3[_0xda0de0]);});}delete _0x1f1d8a[_0xdf3c('0x2e')];}catch(_0x3daeda){_0x540f3a(_0x3daeda);}_0x36937e(_0x1f1d8a);});}function updateFaxInteraction(_0x217a65,_0x2287f,_0x5d705d){return new BPromise(function(_0x33632f,_0x360d5c){return getInteractionUsers(_0x217a65,_0x5d705d)[_0xdf3c('0x2a')](function(_0x3b9ce8){return getInteractionTags(_0x3b9ce8,_0x2287f);})['then'](function(_0x474564){_0x33632f(_0x474564);})[_0xdf3c('0x31')](function(_0x5ddd21){_0x360d5c(_0x5ddd21);});});}exports['index']=function(_0x12cc19,_0x588d02){var _0x216115={},_0x5e8130={},_0x57faba={'count':0x0,'rows':[]};var _0x52f0c3=_[_0xdf3c('0x2d')](db[_0xdf3c('0x32')][_0xdf3c('0x33')],function(_0x29b5b7){return{'name':_0x29b5b7['fieldName'],'type':_0x29b5b7['type'][_0xdf3c('0x34')]};});_0x5e8130['model']=_[_0xdf3c('0x2d')](_0x52f0c3,_0xdf3c('0x2c'));_0x5e8130[_0xdf3c('0x35')]=_[_0xdf3c('0x36')](_0x12cc19[_0xdf3c('0x35')]);_0x5e8130[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x5e8130[_0xdf3c('0x39')],_0x5e8130[_0xdf3c('0x35')]);_0x216115['attributes']=_[_0xdf3c('0x38')](_0x5e8130['model'],qs['fields'](_0x12cc19[_0xdf3c('0x35')]['fields']));_0x216115[_0xdf3c('0x3a')]=_0x216115['attributes'][_0xdf3c('0x3b')]?_0x216115[_0xdf3c('0x3a')]:_0x5e8130[_0xdf3c('0x39')];if(!_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x3c')](_0xdf3c('0x3d'))){_0x216115[_0xdf3c('0x25')]=qs[_0xdf3c('0x25')](_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x25')]);_0x216115[_0xdf3c('0x24')]=qs[_0xdf3c('0x24')](_0x12cc19['query']['offset']);}_0x216115[_0xdf3c('0x3e')]=qs['sort'](_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x3f')]);_0x216115[_0xdf3c('0x40')]=qs[_0xdf3c('0x37')](_['pick'](_0x12cc19['query'],_0x5e8130[_0xdf3c('0x37')]),_0x52f0c3);var _0x33edab=[];var _0x106975=squel['select']()[_0xdf3c('0x41')]('id')[_0xdf3c('0x41')](_0xdf3c('0x2c'))[_0xdf3c('0x41')]('color')[_0xdf3c('0x42')](_0xdf3c('0x43'));var _0xe0e167=squel[_0xdf3c('0x44')]()[_0xdf3c('0x41')]('u.id')[_0xdf3c('0x41')](_0xdf3c('0x45'))[_0xdf3c('0x41')](_0xdf3c('0x46'))[_0xdf3c('0x42')](_0xdf3c('0x47'),'ui')['left_join']('users','u',_0xdf3c('0x48'));var _0x2be86d=squel['select']()['from'](_0xdf3c('0x49'),'i')[_0xdf3c('0x4a')](_0xdf3c('0x4b'),'c',_0xdf3c('0x4c'))[_0xdf3c('0x4a')](_0xdf3c('0x4d'),'o',_0xdf3c('0x4e'))[_0xdf3c('0x4a')](_0xdf3c('0x4f'),'a','a.id\x20=\x20i.FaxAccountId')[_0xdf3c('0x4a')](_0xdf3c('0x50'),'me',_0xdf3c('0x51'))[_0xdf3c('0x4a')](_0xdf3c('0x52'),'it',_0xdf3c('0x53'))[_0xdf3c('0x4a')]('tools_tags','t',_0xdf3c('0x54'));var _0x5c1dca=squel[_0xdf3c('0x55')]();var _0x47b101=[];var _0x41b78c=squel[_0xdf3c('0x55')]();var _0x2ec575;if(_0x12cc19[_0xdf3c('0x35')]['search']){_0x2ec575=as['parseSearch'](_0x12cc19['query'][_0xdf3c('0x56')]);var _0x5f5726=_0x2ec575[_0xdf3c('0x57')];for(var _0x3b92d6=0x0;_0x3b92d6<_0x2ec575[_0xdf3c('0x58')][_0xdf3c('0x3b')];_0x3b92d6++){var _0x3b17d9=_0x2ec575['conditions'][_0x3b92d6];var _0x4e7250='i';var _0x2371aa=_[_0xdf3c('0x59')](_0x52f0c3,['name',_0x3b17d9[_0xdf3c('0x41')]]);if(!_0x2371aa){switch(_0x3b17d9[_0xdf3c('0x41')]){case _0xdf3c('0x5a'):if(_0x3b17d9[_0xdf3c('0x5b')]==0x1){_0x2be86d[_0xdf3c('0x5c')]('`'+_0x3b17d9[_0xdf3c('0x41')]+_0xdf3c('0x5d'));}else{_0x2be86d['having']('`'+_0x3b17d9['field']+_0xdf3c('0x5e'));}break;case _0xdf3c('0x5f'):if(_0x3b17d9[_0xdf3c('0x60')]===_0xdf3c('0x61')){if(_0x3b17d9[_0xdf3c('0x5b')][_0xdf3c('0x30')]('\x20')[_0xdf3c('0x3b')]>0x1){_0x5c1dca[_0x5f5726](_0xdf3c('0x62'),qs[_0xdf3c('0x63')](_0x3b17d9[_0xdf3c('0x5b')]),null);}else{var _0x393ad2='%'+_0x3b17d9['value']+'%';_0x5c1dca[_0x5f5726](_0xdf3c('0x64'),_0x393ad2,_0x393ad2,_0x393ad2);}}else{_0x2371aa=_['find'](_0x52f0c3,['name','ContactId']);_0x3b17d9['field']='ContactId';_0x283be2=as[_0xdf3c('0x65')](_0x4e7250,_0x2371aa[_0xdf3c('0x66')],_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2['text'],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x67')],_0x283be2['value'][_0xdf3c('0x21')]);}break;case _0xdf3c('0x68'):var _0x10e9d5=_0x3b17d9[_0xdf3c('0x5b')][_0xdf3c('0x30')](',')[_0xdf3c('0x2d')](function(_0xb54629){return Number(_0xb54629);});_0x10e9d5[_0xdf3c('0x69')](function(_0x42efa2){_0x41b78c['or'](_0xdf3c('0x6a'),'%,'+_0x42efa2+',%');});_0x47b101=_[_0xdf3c('0x6b')](_0x47b101,_0x10e9d5);break;case'User':if(_0x3b17d9[_0xdf3c('0x60')]===_0xdf3c('0x61')){_0x5c1dca[_0x5f5726](_0xdf3c('0x6c'),'%'+_0x3b17d9['value']+'%',null);}else{_0x2371aa=_[_0xdf3c('0x59')](_0x52f0c3,[_0xdf3c('0x2c'),_0xdf3c('0x6d')]);_0x3b17d9['field']=_0xdf3c('0x6d');_0x283be2=as[_0xdf3c('0x65')](_0x4e7250,_0x2371aa['type'],_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2[_0xdf3c('0x6e')],_0x283be2['value'][_0xdf3c('0x67')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x21')]);}break;case _0xdf3c('0x6f'):_0x283be2=as[_0xdf3c('0x65')]('me',null,_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2[_0xdf3c('0x6e')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x67')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x21')]);break;}}else{var _0x283be2=as[_0xdf3c('0x65')](_0x4e7250,_0x2371aa[_0xdf3c('0x66')],_0x3b17d9);_0x5c1dca[_0x5f5726](_0x283be2[_0xdf3c('0x6e')],_0x283be2[_0xdf3c('0x5b')][_0xdf3c('0x67')],_0x283be2[_0xdf3c('0x5b')]['end']);}}}else{var _0x4dade5=_(_0x12cc19[_0xdf3c('0x35')])[_0xdf3c('0x36')]()[_0xdf3c('0x2d')](function(_0x596282){return _[_0xdf3c('0x70')](_0x52f0c3,['name',_0x596282])?_0x596282:undefined;})['compact']()[_0xdf3c('0x5b')]();if(!_[_0xdf3c('0x71')](_0x4dade5)){_0x4dade5[_0xdf3c('0x69')](function(_0x373a3e){if(_0x373a3e===_0xdf3c('0x72')){_0x2be86d[_0xdf3c('0x40')](_0xdf3c('0x73'),[][_0xdf3c('0x74')](_0x12cc19[_0xdf3c('0x35')][_0x373a3e]));}else if(_0x373a3e===_0xdf3c('0x75')){var _0x1cce9a=JSON[_0xdf3c('0x76')](_0x12cc19[_0xdf3c('0x35')][_0x373a3e])['$gte'];var _0x3febac=JSON[_0xdf3c('0x76')](_0x12cc19[_0xdf3c('0x35')][_0x373a3e])[_0xdf3c('0x77')];_0x2be86d[_0xdf3c('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1cce9a,_0x3febac);}else{if(_0x12cc19[_0xdf3c('0x35')][_0x373a3e]===_0xdf3c('0x78')){_0x2be86d[_0xdf3c('0x40')]('i.'+_0x373a3e+_0xdf3c('0x79'));}else{_0x2be86d[_0xdf3c('0x40')]('i.'+_0x373a3e+_0xdf3c('0x7a'),_0x12cc19[_0xdf3c('0x35')][_0x373a3e]);}}});}if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x7b')]){if(_0x12cc19[_0xdf3c('0x35')]['read']==0x1){_0x2be86d[_0xdf3c('0x5c')](_0xdf3c('0x7c'));}else{_0x2be86d[_0xdf3c('0x5c')](_0xdf3c('0x7d'));}}if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x7e')]){_0x47b101=_[_0xdf3c('0x7f')](_0x12cc19['query'][_0xdf3c('0x7e')])?_0x12cc19[_0xdf3c('0x35')]['tag']:new Array(_0x12cc19['query'][_0xdf3c('0x7e')]);_0x47b101[_0xdf3c('0x69')](function(_0x3064de){_0x41b78c['or'](_0xdf3c('0x6a'),'%,'+_0x3064de+',%');});}if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x80')]){var _0x207720=_0x12cc19[_0xdf3c('0x35')]['filter'][_0xdf3c('0x81')]('\x5c','\x5c\x5c')[_0xdf3c('0x81')](/'/g,'\x27\x27');if(qs[_0xdf3c('0x82')](_0x207720)){_0x5c1dca['or']('i.id\x20LIKE\x20?',_0x207720+'%')['or'](_0xdf3c('0x83'),_0x207720+'%');}_0x5c1dca['or'](_0xdf3c('0x84'),_0x207720+'%');}}_0x2be86d[_0xdf3c('0x40')](_0x5c1dca);_0x2be86d['group'](_0xdf3c('0x85'));var _0xa42441={'type':db[_0xdf3c('0x86')][_0xdf3c('0x87')][_0xdf3c('0x88')],'raw':!![]};var _0x12f737=_0x2be86d['clone']();_0x12f737['field']('i.id');_0x12f737['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdf3c('0x5a'));if(_0x216115[_0xdf3c('0x3e')]){_0x216115[_0xdf3c('0x3e')]['forEach'](function(_0x522613){var _0x28528e=_0x522613[0x0]===_0xdf3c('0x89')?_0x522613[0x0]:'i.'+_0x522613[0x0];_0x2be86d['order'](_0x28528e,_0x522613[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdf3c('0x71')](_0x47b101)){_0x2be86d['having'](_0x41b78c);_0x12f737[_0xdf3c('0x40')]('t.id\x20IN\x20?',_0x47b101);}BPromise[_0xdf3c('0x8a')]()[_0xdf3c('0x2a')](function(){if(!_0x2ec575){if(_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x72')]||_0x12cc19['query']['journey'])return;_0x12f737[_0xdf3c('0x40')](_0xdf3c('0x8b'));_0x2be86d[_0xdf3c('0x40')](_0xdf3c('0x8b'));return;}if(_0x12cc19[_0xdf3c('0x8c')][_0xdf3c('0x8d')]!=='agent')return;return _0x12cc19[_0xdf3c('0x8c')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xdf3c('0x2a')](function(_0x9c761a){if(_[_0xdf3c('0x71')](_0x9c761a)){_0x12f737[_0xdf3c('0x40')](_0xdf3c('0x8e'));_0x2be86d['where'](_0xdf3c('0x8e'));}else{_0x12f737[_0xdf3c('0x40')](_0xdf3c('0x73'),_['map'](_0x9c761a,'id'));_0x2be86d['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x9c761a,'id'));}});})[_0xdf3c('0x2a')](function(){if(_0x12cc19[_0xdf3c('0x8c')][_0xdf3c('0x8d')]===_0xdf3c('0x8f')&&!_0x2ec575&&!_0x12cc19[_0xdf3c('0x35')][_0xdf3c('0x72')])return[];return db['sequelize'][_0xdf3c('0x35')](_0x12f737['toString'](),_0xa42441);})[_0xdf3c('0x2a')](function(_0x389708){_0x57faba[_0xdf3c('0x23')]=_0x389708[_0xdf3c('0x3b')];if(_0x57faba[_0xdf3c('0x23')]===0x0)return[];return db[_0xdf3c('0x90')][_0xdf3c('0x35')](_0x106975[_0xdf3c('0x91')](),_0xa42441)[_0xdf3c('0x2a')](function(_0x3674e9){_0x33edab=_[_0xdf3c('0x92')](_0x3674e9,'id');_0xa42441=_[_0xdf3c('0x93')](_0xa42441,{'model':db[_0xdf3c('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12cc19[_0xdf3c('0x35')]['fields']){_0x216115[_0xdf3c('0x3a')][_0xdf3c('0x69')](function(_0x1e2982){_0x2be86d[_0xdf3c('0x41')]('i.'+_0x1e2982);});}else{_0x2be86d['field'](_0xdf3c('0x94'),_0xdf3c('0x5a'));_0x2be86d['field']('a.key',_0xdf3c('0x95'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x96'),_0xdf3c('0x97'));_0x2be86d[_0xdf3c('0x41')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xdf3c('0x89'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x98'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x99'),_0xdf3c('0x9a'));_0x2be86d['field'](_0xdf3c('0x9b'),_0xdf3c('0x9c'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x9d'),_0xdf3c('0x9e'));_0x2be86d['field']('c.phone','Contact.phone');_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0x9f'),_0xdf3c('0xa0'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa1'),_0xdf3c('0xa2'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa3'),'Owner.fullname');_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa4'),_0xdf3c('0xa5'));_0x2be86d[_0xdf3c('0x41')](_0xdf3c('0xa6'),_0xdf3c('0x2e'));}if(_0x216115['limit'])_0x2be86d[_0xdf3c('0x25')](_0x216115[_0xdf3c('0x25')]);if(_0x216115['offset'])_0x2be86d['offset'](_0x216115[_0xdf3c('0x24')]);return db['sequelize'][_0xdf3c('0x35')](_0x2be86d[_0xdf3c('0x91')](),_0xa42441);})['then'](function(_0x2b4084){_0xe0e167[_0xdf3c('0x40')](_0xdf3c('0xa7'),_[_0xdf3c('0x2d')](_0x2b4084,'id'));return db[_0xdf3c('0x90')][_0xdf3c('0x35')](_0xe0e167['toString'](),_0xa42441)[_0xdf3c('0x2a')](function(_0x8d8394){var _0x32eade=_[_0xdf3c('0xa8')](_0x8d8394,_0xdf3c('0xa9'));var _0x3a1eda=[];_0x2b4084[_0xdf3c('0x69')](function(_0x48b892){_0x3a1eda['push'](updateFaxInteraction(_0x48b892,_0x33edab,_0x32eade));});return BPromise[_0xdf3c('0xaa')](_0x3a1eda);});});})[_0xdf3c('0x2a')](function(_0x1f6f9b){_0x57faba['rows']=_0x1f6f9b;return _0x57faba;})[_0xdf3c('0x2a')](respondWithFilteredResult(_0x588d02,_0x216115))['catch'](handleError(_0x588d02,null));};exports['show']=function(_0x205b45,_0x17fb53){var _0x57b01a={'raw':![],'where':{'id':_0x205b45['params']['id']}},_0x2b851b={};_0x2b851b[_0xdf3c('0x39')]=_['keys'](db[_0xdf3c('0x32')][_0xdf3c('0x33')]);_0x2b851b[_0xdf3c('0x35')]=_[_0xdf3c('0x36')](_0x205b45[_0xdf3c('0x35')]);_0x2b851b[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x2b851b[_0xdf3c('0x39')],_0x2b851b[_0xdf3c('0x35')]);_0x57b01a[_0xdf3c('0x3a')]=_[_0xdf3c('0x38')](_0x2b851b[_0xdf3c('0x39')],qs[_0xdf3c('0xab')](_0x205b45[_0xdf3c('0x35')]['fields']));_0x57b01a[_0xdf3c('0x3a')]=_0x57b01a[_0xdf3c('0x3a')][_0xdf3c('0x3b')]?_0x57b01a['attributes']:_0x2b851b[_0xdf3c('0x39')];if(_0x205b45[_0xdf3c('0x35')][_0xdf3c('0xac')]){_0x57b01a[_0xdf3c('0xad')]=[{'all':!![]}];}_0x57b01a=_[_0xdf3c('0x93')]({},_0x57b01a,_0x205b45[_0xdf3c('0xae')]);return db[_0xdf3c('0x32')][_0xdf3c('0x59')](_0x57b01a)[_0xdf3c('0x2a')](handleEntityNotFound(_0x17fb53,null))[_0xdf3c('0x2a')](respondWithResult(_0x17fb53,null))[_0xdf3c('0x31')](handleError(_0x17fb53,null));};exports['create']=function(_0x3bc3c9,_0x85ec3e){return db[_0xdf3c('0x32')][_0xdf3c('0xaf')](_0x3bc3c9[_0xdf3c('0x6f')],{})[_0xdf3c('0x2a')](respondWithResult(_0x85ec3e,0xc9))[_0xdf3c('0x31')](handleError(_0x85ec3e,null));};exports[_0xdf3c('0xb0')]=function(_0x467ffd,_0x260c63){if(_0x467ffd[_0xdf3c('0x6f')]['id']){delete _0x467ffd[_0xdf3c('0x6f')]['id'];}return db['FaxInteraction'][_0xdf3c('0x59')]({'where':{'id':_0x467ffd[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x260c63,null))[_0xdf3c('0x2a')](saveUpdates(_0x467ffd[_0xdf3c('0x6f')],null))[_0xdf3c('0x2a')](respondWithResult(_0x260c63,null))[_0xdf3c('0x31')](handleError(_0x260c63,null));};exports['destroy']=function(_0x396b19,_0x87c93a){return db[_0xdf3c('0x32')][_0xdf3c('0x59')]({'where':{'id':_0x396b19['params']['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x87c93a,null))[_0xdf3c('0x2a')](removeEntity(_0x87c93a,null))['catch'](handleError(_0x87c93a,null));};exports[_0xdf3c('0xb2')]=function(_0x4a1bc4,_0x418021){return db[_0xdf3c('0x32')]['describe']()[_0xdf3c('0x2a')](respondWithResult(_0x418021,null))[_0xdf3c('0x31')](handleError(_0x418021,null));};exports[_0xdf3c('0xb3')]=function(_0x4c0742,_0x4ffd52,_0x243ad5){return db['FaxMessage'][_0xdf3c('0x59')]({'where':{'id':_0x4c0742[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x4ffd52,null))[_0xdf3c('0x2a')](function(_0x5047ab){if(_0x5047ab){return _0x5047ab[_0xdf3c('0xb3')](_0x4c0742[_0xdf3c('0x6f')]['ids'],_[_0xdf3c('0xb4')](_0x4c0742['body'],[_0xdf3c('0xb5'),'id'])||{});}})[_0xdf3c('0x2a')](respondWithResult(_0x4ffd52,null))['catch'](handleError(_0x4ffd52,null));};exports['getMessages']=function(_0x243fbf,_0x4e01ca,_0x37ed69){var _0x306930={'raw':![],'where':{}};var _0x987666={};var _0x34234c={'count':0x0,'rows':[]};return db[_0xdf3c('0x32')][_0xdf3c('0xb6')]({'where':{'id':_0x243fbf[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x4e01ca,null))[_0xdf3c('0x2a')](function(_0x3d8ff0){if(_0x3d8ff0){_0x987666[_0xdf3c('0x39')]=_['keys'](db[_0xdf3c('0xb7')][_0xdf3c('0x33')]);_0x987666['query']=_[_0xdf3c('0x36')](_0x243fbf[_0xdf3c('0x35')]);_0x987666[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x987666[_0xdf3c('0x39')],_0x987666[_0xdf3c('0x35')]);_0x306930['attributes']=_[_0xdf3c('0x38')](_0x987666['model'],qs[_0xdf3c('0xab')](_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0xab')]));_0x306930[_0xdf3c('0x3a')]=_0x306930[_0xdf3c('0x3a')][_0xdf3c('0x3b')]?_0x306930['attributes']:_0x987666[_0xdf3c('0x39')];if(!_0x243fbf[_0xdf3c('0x35')]['hasOwnProperty'](_0xdf3c('0x3d'))){_0x306930[_0xdf3c('0x25')]=qs[_0xdf3c('0x25')](_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x25')]);_0x306930[_0xdf3c('0x24')]=qs[_0xdf3c('0x24')](_0x243fbf[_0xdf3c('0x35')]['offset']);}_0x306930['order']=qs[_0xdf3c('0x3f')](_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x3f')]);_0x306930[_0xdf3c('0x40')]=qs['filters'](_['pick'](_0x243fbf[_0xdf3c('0x35')],_0x987666['filters']));_0x306930[_0xdf3c('0x40')]['FaxInteractionId']=_0x3d8ff0['id'];if(_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x80')]){_0x306930[_0xdf3c('0x40')]=_['merge'](_0x306930[_0xdf3c('0x40')],{'$or':_[_0xdf3c('0x2d')](_0x306930['attributes'],function(_0x50a21b){var _0x45114b={};_0x45114b[_0x50a21b]={'$like':'%'+_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0x80')]+'%'};return _0x45114b;})});}if(_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0xb8')]){var _0x294682=_0x243fbf[_0xdf3c('0x35')]['$gte']['split'](',');var _0xb47a73={};_0xb47a73[_0x294682[0x0]]={'$gte':moment(_0x294682[0x1])[_0xdf3c('0xb9')](_0xdf3c('0xba'))};_0x306930[_0xdf3c('0x40')]=_[_0xdf3c('0x93')](_0x306930[_0xdf3c('0x40')],_0xb47a73);}_0x306930=_[_0xdf3c('0x93')]({},_0x306930,_0x243fbf[_0xdf3c('0xae')]);return db[_0xdf3c('0xb7')][_0xdf3c('0x23')]({'where':_0x306930[_0xdf3c('0x40')]})[_0xdf3c('0x2a')](function(_0x10f2bf){_0x34234c[_0xdf3c('0x23')]=_0x10f2bf;if(_0x243fbf[_0xdf3c('0x35')][_0xdf3c('0xac')]){_0x306930[_0xdf3c('0xad')]=[{'all':!![]}];}return db[_0xdf3c('0xb7')][_0xdf3c('0xbb')](_0x306930);})['then'](function(_0x4c6615){_0x34234c[_0xdf3c('0xbc')]=_0x4c6615;return _0x34234c;});}})['then'](respondWithFilteredResult(_0x4e01ca,_0x306930))['catch'](handleError(_0x4e01ca,null));};exports[_0xdf3c('0xbd')]=function(_0x5b3f84,_0x38895b,_0x3cef21){return db['FaxInteraction']['find']({'where':{'id':_0x5b3f84['params']['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x38895b,null))[_0xdf3c('0x2a')](function(_0x11de00){if(_0x11de00){return _0x11de00['setTags'](_0x5b3f84[_0xdf3c('0x6f')]['ids'],_[_0xdf3c('0xb4')](_0x5b3f84['body'],['ids','id'])||{})[_0xdf3c('0xbe')](function(){return db[_0xdf3c('0x68')][_0xdf3c('0xbb')]({'attributes':['id',_0xdf3c('0x2c'),_0xdf3c('0xbf')],'where':{'id':_0x5b3f84[_0xdf3c('0x6f')]['ids']}});})['then'](function(_0x128a4e){socket['emit'](_0xdf3c('0xc0'),{'id':Number(_0x5b3f84[_0xdf3c('0xb1')]['id']),'tags':_0x128a4e||[]});return{'id':Number(_0x5b3f84[_0xdf3c('0xb1')]['id']),'tags':_0x128a4e||[]};});}})[_0xdf3c('0x2a')](respondWithResult(_0x38895b,null))[_0xdf3c('0x31')](handleError(_0x38895b,null));};exports[_0xdf3c('0xc1')]=function(_0x7b3f53,_0x5a52a0,_0x4f35c8){return db[_0xdf3c('0x32')][_0xdf3c('0x59')]({'where':{'id':_0x7b3f53[_0xdf3c('0xb1')]['id']}})[_0xdf3c('0x2a')](handleEntityNotFound(_0x5a52a0,null))['then'](function(_0xe14463){if(_0xe14463){return _0xe14463[_0xdf3c('0xc1')](_0x7b3f53[_0xdf3c('0x35')][_0xdf3c('0xb5')]);}})[_0xdf3c('0x2a')](respondWithStatusCode(_0x5a52a0,null))[_0xdf3c('0x31')](handleError(_0x5a52a0,null));};exports['download']=function(_0x38ed5d,_0x4545ce){var _0x52cd34=moment()[_0xdf3c('0xc2')]()[_0xdf3c('0x91')]();var _0xe5f939=path['join'](config[_0xdf3c('0xc3')],_0xdf3c('0xc4'),_0xdf3c('0xc5'),_0xdf3c('0xc6'));var _0x3100fa=path[_0xdf3c('0xc7')](config[_0xdf3c('0xc3')],_0xdf3c('0xc4'),_0xdf3c('0xc5'),'attachments');var _0xbb75c2=path['join'](_0xe5f939,_0x52cd34);var _0x24dd51=util[_0xdf3c('0xb9')](_0xdf3c('0xc8'),_0x38ed5d[_0xdf3c('0xb1')]['id'],_0x52cd34);var _0x90c66=path[_0xdf3c('0xc7')](_0xe5f939,_0x24dd51);var _0x1e2f88=[];_0x1e2f88[_0xdf3c('0xc9')]({'model':db[_0xdf3c('0xca')],'as':_0xdf3c('0xca'),'raw':!![]});var _0x3a90f4=[{'model':db['FaxMessage'],'as':_0xdf3c('0xcb'),'attributes':['id',_0xdf3c('0x6f'),'createdAt'],'include':_0x1e2f88}];return db[_0xdf3c('0x32')][_0xdf3c('0x59')]({'where':{'id':_0x38ed5d[_0xdf3c('0xb1')]['id']},'include':_0x3a90f4})[_0xdf3c('0x2a')](handleEntityNotFound(_0x4545ce,null))['then'](function(_0x2670ef){if(_0x2670ef&&_0x2670ef[_0xdf3c('0xcb')]){var _0xd2cdb=_0x2670ef['get']({'plain':!![]});fs['mkdirSync'](_0xbb75c2);for(var _0x5af92b=0x0;_0x5af92b<_0xd2cdb[_0xdf3c('0xcb')][_0xdf3c('0x3b')];_0x5af92b++){var _0x403ac5=_0xd2cdb[_0xdf3c('0xcb')][_0x5af92b][_0xdf3c('0xca')];if(_0x403ac5){var _0x33132b=path[_0xdf3c('0xc7')](_0x3100fa,_0x403ac5[_0xdf3c('0xcc')]);if(fs['existsSync'](_0x33132b)){fs[_0xdf3c('0xcd')](_0x33132b)['pipe'](fs[_0xdf3c('0xce')](path[_0xdf3c('0xc7')](_0xbb75c2,_0x403ac5[_0xdf3c('0xcc')])));}}}return BPromise[_0xdf3c('0x8a')]()[_0xdf3c('0x2a')](function(){return new BPromise(function(_0x440c7c,_0x4e5569){zipdir(_0xbb75c2,{'saveTo':_0x90c66},function(_0xbe2280,_0x116ac9){if(_0xbe2280)return _0x4e5569(_0xbe2280);return _0x440c7c(_0x116ac9);});})['then'](function(){return new BPromise(function(_0x28337a,_0x270353){rimraf(_0xbb75c2,function(_0x5926b6){if(_0x5926b6)_0x270353(_0x5926b6);return _0x28337a();});});})[_0xdf3c('0x2a')](function(){return _0x4545ce['download'](_0x90c66,_0x24dd51,function(_0x32adba){if(_0x32adba){console['log'](_0xdf3c('0xcf'),_0x32adba);}else{fs[_0xdf3c('0xd0')](_0x90c66);}});});});}else{return _0x4545ce[_0xdf3c('0x1f')](0xc8);}})[_0xdf3c('0x31')](handleError(_0x4545ce,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6056b17..5e007a9 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x50a0cf,_0x362b89){var _0x296786=function(_0x1155a9){while(--_0x1155a9){_0x50a0cf['push'](_0x50a0cf['shift']());}};_0x296786(++_0x362b89);}(_0xadb5,0xad));var _0x5adb=function(_0xb862c,_0x4391eb){_0xb862c=_0xb862c-0x0;var _0x2dbbe8=_0xadb5[_0xb862c];return _0x2dbbe8;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b7d3cce..71e06bb 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 _0x66eb=['define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes'];(function(_0x59acb8,_0x24933c){var _0x5bf100=function(_0x3a3142){while(--_0x3a3142){_0x59acb8['push'](_0x59acb8['shift']());}};_0x5bf100(++_0x24933c);}(_0x66eb,0xc8));var _0xb66e=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0x66eb[_0x16539a];return _0x200796;};'use strict';var _=require(_0xb66e('0x0'));var util=require(_0xb66e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb66e('0x2'));var BPromise=require(_0xb66e('0x3'));var rp=require(_0xb66e('0x4'));var fs=require('fs');var path=require(_0xb66e('0x5'));var rimraf=require(_0xb66e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb66e('0x7'));module['exports']=function(_0x5f1d3a,_0x221a8d){return _0x5f1d3a[_0xb66e('0x8')](_0xb66e('0x9'),attributes,{'tableName':_0xb66e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fc727,_0x48665d,_0x5aff3b){if(_0x3fc727[_0xb66e('0xb')](_0xb66e('0xc'))){_0x3fc727[_0xb66e('0xd')]=moment()[_0xb66e('0xe')](_0xb66e('0xf'));}_0x5aff3b(null,_0x3fc727);}}});}; \ No newline at end of file +var _0xd43e=['format','bluebird','request-promise','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x584268,_0x316063){var _0xe262a8=function(_0x190a3c){while(--_0x190a3c){_0x584268['push'](_0x584268['shift']());}};_0xe262a8(++_0x316063);}(_0xd43e,0xc7));var _0xed43=function(_0x472276,_0xa37f3b){_0x472276=_0x472276-0x0;var _0xdd2b80=_0xd43e[_0x472276];return _0xdd2b80;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xed43('0x0'));var rp=require(_0xed43('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed43('0x2'));var config=require('../../config/environment');var attributes=require(_0xed43('0x3'));module['exports']=function(_0x5bcea,_0xc0e3b6){return _0x5bcea[_0xed43('0x4')](_0xed43('0x5'),attributes,{'tableName':_0xed43('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3173a3,_0x31afff,_0x208e8f){if(_0x3173a3[_0xed43('0x7')](_0xed43('0x8'))){_0x3173a3[_0xed43('0x9')]=moment()[_0xed43('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x208e8f(null,_0x3173a3);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 5c5fc47..48b3eb1 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 _0xd82b=['redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','then','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x15b20b,_0x3acc56){var _0x5b222f=function(_0x56b945){while(--_0x56b945){_0x15b20b['push'](_0x15b20b['shift']());}};_0x5b222f(++_0x3acc56);}(_0xd82b,0x1a3));var _0xbd82=function(_0x1d80a0,_0x7da8b0){_0x1d80a0=_0x1d80a0-0x0;var _0x15ef20=_0xd82b[_0x1d80a0];return _0x15ef20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbd82('0x0'));var BPromise=require(_0xbd82('0x1'));var rs=require(_0xbd82('0x2'));var fs=require('fs');var Redis=require(_0xbd82('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd82('0x4'));var logger=require(_0xbd82('0x5'))(_0xbd82('0x6'));var config=require(_0xbd82('0x7'));var jayson=require(_0xbd82('0x8'));var client=jayson[_0xbd82('0x9')][_0xbd82('0xa')]({'port':0x232a});config[_0xbd82('0xb')]=_[_0xbd82('0xc')](config[_0xbd82('0xb')],{'host':_0xbd82('0xd'),'port':0x18eb});var socket=require(_0xbd82('0xe'))(new Redis(config[_0xbd82('0xb')]));require(_0xbd82('0xf'))['register'](socket);function respondWithRpcPromise(_0x195a2c,_0x4d3405,_0x5ce5d0){return new BPromise(function(_0x3019f7,_0x1b3cfe){return client[_0xbd82('0x10')](_0x195a2c,_0x5ce5d0)['then'](function(_0x1107f5){logger[_0xbd82('0x11')](_0xbd82('0x12'),_0x4d3405,_0xbd82('0x13'));logger[_0xbd82('0x14')](_0xbd82('0x15'),_0x4d3405,_0xbd82('0x13'),JSON['stringify'](_0x1107f5));if(_0x1107f5[_0xbd82('0x16')]){if(_0x1107f5['error'][_0xbd82('0x17')]===0x1f4){logger[_0xbd82('0x16')](_0xbd82('0x12'),_0x4d3405,_0x1107f5[_0xbd82('0x16')]['message']);return _0x1b3cfe(_0x1107f5['error'][_0xbd82('0x18')]);}logger[_0xbd82('0x16')](_0xbd82('0x12'),_0x4d3405,_0x1107f5['error'][_0xbd82('0x18')]);return _0x3019f7(_0x1107f5[_0xbd82('0x16')][_0xbd82('0x18')]);}else{logger[_0xbd82('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x4d3405,'request\x20sent');_0x3019f7(_0x1107f5['result'][_0xbd82('0x18')]);}})[_0xbd82('0x19')](function(_0x276fc8){logger['error'](_0xbd82('0x12'),_0x4d3405,_0x276fc8);_0x1b3cfe(_0x276fc8);});});}exports['UpdateFaxInteraction']=function(_0x5eda7e){var _0x55c9d0=this;return new Promise(function(_0x235e3c,_0x1ea7ff){return db[_0xbd82('0x1a')][_0xbd82('0x1b')](_0x5eda7e[_0xbd82('0x1c')],{'raw':_0x5eda7e['options']?_0x5eda7e[_0xbd82('0x1d')][_0xbd82('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eda7e['options']?_0x5eda7e['options'][_0xbd82('0x1f')]||null:null,'attributes':_0x5eda7e[_0xbd82('0x1d')]?_0x5eda7e['options'][_0xbd82('0x20')]||null:null,'limit':_0x5eda7e[_0xbd82('0x1d')]?_0x5eda7e['options'][_0xbd82('0x21')]||null:null})[_0xbd82('0x22')](function(_0x211498){logger['info']('UpdateFaxInteraction',_0x5eda7e);logger[_0xbd82('0x14')](_0xbd82('0x23'),_0x5eda7e,JSON[_0xbd82('0x24')](_0x211498));_0x235e3c(_0x211498);})[_0xbd82('0x19')](function(_0x327b5f){logger[_0xbd82('0x16')](_0xbd82('0x23'),_0x327b5f[_0xbd82('0x18')],_0x5eda7e);_0x1ea7ff(_0x55c9d0['error'](0x1f4,_0x327b5f['message']));});});};exports[_0xbd82('0x25')]=function(_0x2aa301){return new Promise(function(_0x3a5060,_0x4eff29){return db[_0xbd82('0x1a')][_0xbd82('0x26')]({'where':_0x2aa301['options']?_0x2aa301[_0xbd82('0x1d')][_0xbd82('0x1f')]||null:null})['then'](function(_0x14232e){if(_0x14232e){return _0x14232e['addTags'](_0x2aa301[_0xbd82('0x1c')][_0xbd82('0x27')],_[_0xbd82('0x28')](_0x2aa301[_0xbd82('0x1c')],['ids','id'])||{});}})[_0xbd82('0x29')](function(_0x396c9e){logger[_0xbd82('0x11')](_0xbd82('0x2a'),_0x2aa301);logger[_0xbd82('0x14')](_0xbd82('0x2a'),_0x2aa301,JSON[_0xbd82('0x24')](_0x396c9e));_0x3a5060(_0x396c9e);})['catch'](function(_0x410272){logger[_0xbd82('0x16')](_0xbd82('0x2a'),_0x410272[_0xbd82('0x18')],_0x2aa301);_0x4eff29(_this[_0xbd82('0x16')](0x1f4,_0x410272[_0xbd82('0x18')]));});});}; \ No newline at end of file +var _0x169f=['redis','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','debug','AddTagsToFaxInteraction','find','omit','spread','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter'];(function(_0x516fa6,_0x4ebdd5){var _0x2d4aa5=function(_0x566903){while(--_0x566903){_0x516fa6['push'](_0x516fa6['shift']());}};_0x2d4aa5(++_0x4ebdd5);}(_0x169f,0x152));var _0xf169=function(_0x46a529,_0x11018a){_0x46a529=_0x46a529-0x0;var _0x1b169e=_0x169f[_0x46a529];return _0x1b169e;};'use strict';var _=require(_0xf169('0x0'));var util=require('util');var moment=require(_0xf169('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf169('0x2'));var db=require(_0xf169('0x3'))['db'];var utils=require(_0xf169('0x4'));var logger=require(_0xf169('0x5'))(_0xf169('0x6'));var config=require(_0xf169('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf169('0x8')][_0xf169('0x9')]({'port':0x232a});config['redis']=_[_0xf169('0xa')](config['redis'],{'host':_0xf169('0xb'),'port':0x18eb});var socket=require(_0xf169('0xc'))(new Redis(config[_0xf169('0xd')]));require(_0xf169('0xe'))[_0xf169('0xf')](socket);function respondWithRpcPromise(_0x52f7bc,_0x3c8c10,_0x1036f9){return new BPromise(function(_0x2087b1,_0x1e7d04){return client['request'](_0x52f7bc,_0x1036f9)[_0xf169('0x10')](function(_0x1a0596){logger[_0xf169('0x11')](_0xf169('0x12'),_0x3c8c10,_0xf169('0x13'));logger['debug'](_0xf169('0x14'),_0x3c8c10,'request\x20sent',JSON[_0xf169('0x15')](_0x1a0596));if(_0x1a0596['error']){if(_0x1a0596[_0xf169('0x16')][_0xf169('0x17')]===0x1f4){logger[_0xf169('0x16')](_0xf169('0x12'),_0x3c8c10,_0x1a0596[_0xf169('0x16')][_0xf169('0x18')]);return _0x1e7d04(_0x1a0596[_0xf169('0x16')]['message']);}logger[_0xf169('0x16')](_0xf169('0x12'),_0x3c8c10,_0x1a0596[_0xf169('0x16')]['message']);return _0x2087b1(_0x1a0596[_0xf169('0x16')][_0xf169('0x18')]);}else{logger[_0xf169('0x11')](_0xf169('0x12'),_0x3c8c10,_0xf169('0x13'));_0x2087b1(_0x1a0596[_0xf169('0x19')][_0xf169('0x18')]);}})[_0xf169('0x1a')](function(_0x22acc7){logger[_0xf169('0x16')](_0xf169('0x12'),_0x3c8c10,_0x22acc7);_0x1e7d04(_0x22acc7);});});}exports[_0xf169('0x1b')]=function(_0x3bade3){var _0x56bb2f=this;return new Promise(function(_0x2e10a1,_0x5f4dfb){return db[_0xf169('0x1c')]['update'](_0x3bade3[_0xf169('0x1d')],{'raw':_0x3bade3[_0xf169('0x1e')]?_0x3bade3['options'][_0xf169('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bade3['options']?_0x3bade3[_0xf169('0x1e')][_0xf169('0x20')]||null:null,'attributes':_0x3bade3[_0xf169('0x1e')]?_0x3bade3['options']['attributes']||null:null,'limit':_0x3bade3[_0xf169('0x1e')]?_0x3bade3[_0xf169('0x1e')]['limit']||null:null})[_0xf169('0x10')](function(_0x4b35df){logger[_0xf169('0x11')](_0xf169('0x1b'),_0x3bade3);logger[_0xf169('0x21')](_0xf169('0x1b'),_0x3bade3,JSON[_0xf169('0x15')](_0x4b35df));_0x2e10a1(_0x4b35df);})[_0xf169('0x1a')](function(_0x1867d7){logger[_0xf169('0x16')](_0xf169('0x1b'),_0x1867d7[_0xf169('0x18')],_0x3bade3);_0x5f4dfb(_0x56bb2f[_0xf169('0x16')](0x1f4,_0x1867d7[_0xf169('0x18')]));});});};exports[_0xf169('0x22')]=function(_0x6809f9){return new Promise(function(_0x38069b,_0x2124a7){return db['FaxInteraction'][_0xf169('0x23')]({'where':_0x6809f9[_0xf169('0x1e')]?_0x6809f9[_0xf169('0x1e')][_0xf169('0x20')]||null:null})['then'](function(_0x2f2669){if(_0x2f2669){return _0x2f2669['addTags'](_0x6809f9['body']['ids'],_[_0xf169('0x24')](_0x6809f9['body'],['ids','id'])||{});}})[_0xf169('0x25')](function(_0x28278a){logger['info'](_0xf169('0x26'),_0x6809f9);logger[_0xf169('0x21')](_0xf169('0x26'),_0x6809f9,JSON['stringify'](_0x28278a));_0x38069b(_0x28278a);})[_0xf169('0x1a')](function(_0x38864b){logger[_0xf169('0x16')](_0xf169('0x26'),_0x38864b[_0xf169('0x18')],_0x6809f9);_0x2124a7(_this[_0xf169('0x16')](0x1f4,_0x38864b[_0xf169('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0911caf..27f183f 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 _0x111b=['removeListener','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x89972b,_0x344bd7){var _0x2f8b07=function(_0x4343c4){while(--_0x4343c4){_0x89972b['push'](_0x89972b['shift']());}};_0x2f8b07(++_0x344bd7);}(_0x111b,0xec));var _0xb111=function(_0x3e685b,_0x13b2ea){_0x3e685b=_0x3e685b-0x0;var _0x1bf8cd=_0x111b[_0x3e685b];return _0x1bf8cd;};'use strict';var FaxInteractionEvents=require(_0xb111('0x0'));var events=[_0xb111('0x1'),_0xb111('0x2'),'update'];function createListener(_0x2e6d62,_0x50f1e4){return function(_0x2fe29b){_0x50f1e4[_0xb111('0x3')](_0x2e6d62,_0x2fe29b);};}function removeListener(_0x122546,_0x237d0f){return function(){FaxInteractionEvents[_0xb111('0x4')](_0x122546,_0x237d0f);};}exports['register']=function(_0x26746b){for(var _0x4f61a2=0x0,_0x542755=events['length'];_0x4f61a2<_0x542755;_0x4f61a2++){var _0x530055=events[_0x4f61a2];var _0x4a1a52=createListener(_0xb111('0x5')+_0x530055,_0x26746b);FaxInteractionEvents['on'](_0x530055,_0x4a1a52);}}; \ No newline at end of file +var _0xcf62=['emit','register','length','./faxInteraction.events','save'];(function(_0xb9bf98,_0x5cb609){var _0x35e5ac=function(_0x594349){while(--_0x594349){_0xb9bf98['push'](_0xb9bf98['shift']());}};_0x35e5ac(++_0x5cb609);}(_0xcf62,0x102));var _0x2cf6=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xcf62[_0x599f41];return _0x2e4d58;};'use strict';var FaxInteractionEvents=require(_0x2cf6('0x0'));var events=[_0x2cf6('0x1'),'remove','update'];function createListener(_0x361e69,_0x2c01bd){return function(_0x47d9e0){_0x2c01bd[_0x2cf6('0x2')](_0x361e69,_0x47d9e0);};}function removeListener(_0x1c8a96,_0x54495e){return function(){FaxInteractionEvents['removeListener'](_0x1c8a96,_0x54495e);};}exports[_0x2cf6('0x3')]=function(_0x1d924a){for(var _0x3a047a=0x0,_0x3b6743=events[_0x2cf6('0x4')];_0x3a047a<_0x3b6743;_0x3a047a++){var _0x435a75=events[_0x3a047a];var _0x1b935f=createListener('faxInteraction:'+_0x435a75,_0x1d924a);FaxInteractionEvents['on'](_0x435a75,_0x1b935f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7991036..a45d99c 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 _0x4fc2=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','destroy','removeTags'];(function(_0x55fe9b,_0x1623d5){var _0x507b78=function(_0x9f98f9){while(--_0x9f98f9){_0x55fe9b['push'](_0x55fe9b['shift']());}};_0x507b78(++_0x1623d5);}(_0x4fc2,0x111));var _0x24fc=function(_0x1c1780,_0x93cb2){_0x1c1780=_0x1c1780-0x0;var _0x5eb4ae=_0x4fc2[_0x1c1780];return _0x5eb4ae;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/describe',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x8')](_0x24fc('0x10'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x12')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x13')]);router[_0x24fc('0x12')]('/:id/messages',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x12')](_0x24fc('0x15'),auth[_0x24fc('0xa')](),interaction[_0x24fc('0x16')]('fax',_0x24fc('0x17')),controller[_0x24fc('0x18')]);router[_0x24fc('0x19')](_0x24fc('0xc'),auth['isAuthenticated'](),interaction[_0x24fc('0x16')]('fax',_0x24fc('0x1a')),controller[_0x24fc('0x1b')]);router[_0x24fc('0x1c')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),interaction['tracked'](_0x24fc('0x1d'),_0x24fc('0x1e')),controller[_0x24fc('0x1f')]);router[_0x24fc('0x1c')]('/:id/tags',auth[_0x24fc('0xa')](),controller[_0x24fc('0x20')]);module[_0x24fc('0x21')]=router; \ No newline at end of file +var _0xbaf0=['removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','destroy','/:id/tags'];(function(_0x2cc7b1,_0x3ba41c){var _0x106ac2=function(_0x1e06ed){while(--_0x1e06ed){_0x2cc7b1['push'](_0x2cc7b1['shift']());}};_0x106ac2(++_0x3ba41c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0x9')](),controller['create']);router['post'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x14')]);router[_0x0baf('0x13')]('/:id/tags',auth[_0x0baf('0x9')](),interaction['tracked'](_0x0baf('0x15'),_0x0baf('0x16')),controller[_0x0baf('0x17')]);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),interaction['tracked']('fax',_0x0baf('0x19')),controller[_0x0baf('0x1a')]);router[_0x0baf('0x1b')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),interaction[_0x0baf('0x1c')]('fax',_0x0baf('0x1d')),controller[_0x0baf('0x1e')]);router[_0x0baf('0x1b')](_0x0baf('0x1f'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 108f342..014c1b1 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 _0x8c57=['DATE','sequelize','TEXT','medium','out'];(function(_0x24e9da,_0x111d80){var _0x1a7aea=function(_0x1657ba){while(--_0x1657ba){_0x24e9da['push'](_0x24e9da['shift']());}};_0x1a7aea(++_0x111d80);}(_0x8c57,0x1f0));var _0x78c5=function(_0x420791,_0x595f73){_0x420791=_0x420791-0x0;var _0xd471bf=_0x8c57[_0x420791];return _0xd471bf;};'use strict';var Sequelize=require(_0x78c5('0x0'));module['exports']={'body':{'type':Sequelize[_0x78c5('0x1')](_0x78c5('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x78c5('0x3')),'defaultValue':_0x78c5('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x78c5('0x4')]}}; \ No newline at end of file +var _0xf0a9=['TEXT','medium','DATE','sequelize','exports'];(function(_0xe8d150,_0x460e8){var _0x413143=function(_0xd3aec1){while(--_0xd3aec1){_0xe8d150['push'](_0xe8d150['shift']());}};_0x413143(++_0x460e8);}(_0xf0a9,0x6c));var _0x9f0a=function(_0x3080ff,_0x50e859){_0x3080ff=_0x3080ff-0x0;var _0x4f75cc=_0xf0a9[_0x3080ff];return _0x4f75cc;};'use strict';var Sequelize=require(_0x9f0a('0x0'));module[_0x9f0a('0x1')]={'body':{'type':Sequelize[_0x9f0a('0x2')](_0x9f0a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x9f0a('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 09f2324..c963ab4 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 _0x6b87=['offset','set','Content-Range','json','apply','update','destroy','stack','name','send','index','map','FaxMessage','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','body','describe','fax-interactions','readAt','format','UserId','user','CmContact','get','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','manual','channel','accept','EventManager','reject','fax','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','interface','SIP/%s','event','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','join','files','attachments','download','basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','count'];(function(_0x1d3ece,_0x34d973){var _0x29ad4e=function(_0x17b567){while(--_0x17b567){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x29ad4e(++_0x34d973);}(_0x6b87,0x15f));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x76b8('0x0'));var rimraf=require(_0x76b8('0x1'));var zipdir=require(_0x76b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76b8('0x3'));var moment=require(_0x76b8('0x4'));var BPromise=require(_0x76b8('0x5'));var Mustache=require('mustache');var util=require(_0x76b8('0x6'));var path=require(_0x76b8('0x7'));var sox=require(_0x76b8('0x8'));var csv=require(_0x76b8('0x9'));var ejs=require(_0x76b8('0xa'));var fs=require('fs');var _=require(_0x76b8('0xb'));var squel=require(_0x76b8('0xc'));var crypto=require(_0x76b8('0xd'));var jsforce=require(_0x76b8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x76b8('0xf'));var Redis=require(_0x76b8('0x10'));var authService=require(_0x76b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x76b8('0x12'));var hardwareService=require(_0x76b8('0x13'));var logger=require(_0x76b8('0x14'))(_0x76b8('0x15'));var utils=require(_0x76b8('0x16'));var config=require(_0x76b8('0x17'));var licenseUtil=require(_0x76b8('0x18'));var db=require(_0x76b8('0x19'))['db'];config[_0x76b8('0x1a')]=_['defaults'](config['redis'],{'host':_0x76b8('0x1b'),'port':0x18eb});var socket=require(_0x76b8('0x1c'))(new Redis(config[_0x76b8('0x1a')]));require(_0x76b8('0x1d'))[_0x76b8('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x76b8('0x1f')][_0x76b8('0x20')]({'port':0x232c});var client9002=jayson[_0x76b8('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13fba5,_0x1a0454,_0x533a75,_0x3f51de){return new BPromise(function(_0x54aa4b,_0x206553){var _0x535166=_0x3f51de||client;return _0x535166['request'](_0x13fba5,_0x533a75)[_0x76b8('0x21')](function(_0xe9deeb){logger[_0x76b8('0x22')]('FaxMessage,\x20%s,\x20%s',_0x1a0454,_0x76b8('0x23'));logger[_0x76b8('0x24')](_0x76b8('0x25'),_0x1a0454,_0x76b8('0x23'),JSON[_0x76b8('0x26')](_0xe9deeb));if(_0xe9deeb[_0x76b8('0x27')]){if(_0xe9deeb[_0x76b8('0x27')][_0x76b8('0x28')]===0x1f4){logger[_0x76b8('0x27')](_0x76b8('0x29'),_0x1a0454,_0xe9deeb[_0x76b8('0x27')][_0x76b8('0x2a')]);return _0x206553(_0xe9deeb['error'][_0x76b8('0x2a')]);}logger[_0x76b8('0x27')](_0x76b8('0x29'),_0x1a0454,_0xe9deeb['error'][_0x76b8('0x2a')]);return _0x54aa4b(_0xe9deeb[_0x76b8('0x27')][_0x76b8('0x2a')]);}else{logger[_0x76b8('0x22')]('FaxMessage,\x20%s,\x20%s',_0x1a0454,_0x76b8('0x23'));_0x54aa4b(_0xe9deeb['result'][_0x76b8('0x2a')]);}})[_0x76b8('0x2b')](function(_0x407a99){logger[_0x76b8('0x27')](_0x76b8('0x29'),_0x1a0454,_0x407a99);_0x206553(_0x407a99);});});}function respondWithStatusCode(_0x1a979e,_0x594c80){_0x594c80=_0x594c80||0xcc;return function(_0x2c28cf){if(_0x2c28cf){return _0x1a979e[_0x76b8('0x2c')](_0x594c80);}return _0x1a979e[_0x76b8('0x2d')](_0x594c80)[_0x76b8('0x2e')]();};}function respondWithResult(_0x18dbdd,_0x2410e4){_0x2410e4=_0x2410e4||0xc8;return function(_0x1d3221){if(_0x1d3221){return _0x18dbdd['status'](_0x2410e4)['json'](_0x1d3221);}};}function respondWithFilteredResult(_0x67c2f9,_0x37be1d){return function(_0x206e64){if(_0x206e64){var _0x2868ae=_0x206e64[_0x76b8('0x2f')],_0x214fad=_0x37be1d['offset'],_0x5df583=_0x37be1d[_0x76b8('0x30')]+_0x37be1d['limit'],_0x4e68a5;if(_0x5df583>=_0x2868ae){_0x5df583=_0x2868ae;_0x4e68a5=0xc8;}else{_0x4e68a5=0xce;}_0x67c2f9[_0x76b8('0x2d')](_0x4e68a5);return _0x67c2f9[_0x76b8('0x31')](_0x76b8('0x32'),_0x214fad+'-'+_0x5df583+'/'+_0x2868ae)[_0x76b8('0x33')](_0x206e64);}return null;};}function patchUpdates(_0x53717a){return function(_0x143fce){try{jsonpatch[_0x76b8('0x34')](_0x143fce,_0x53717a,!![]);}catch(_0x43b393){return BPromise['reject'](_0x43b393);}return _0x143fce['save']();};}function saveUpdates(_0x3d8a7e,_0x1b648d){return function(_0xc9ea01){if(_0xc9ea01){return _0xc9ea01[_0x76b8('0x35')](_0x3d8a7e)[_0x76b8('0x21')](function(_0x441537){return _0x441537;});}return null;};}function removeEntity(_0x1ce3cc,_0x5dfa0e){return function(_0x5f17b6){if(_0x5f17b6){return _0x5f17b6[_0x76b8('0x36')]()[_0x76b8('0x21')](function(){_0x1ce3cc[_0x76b8('0x2d')](0xcc)[_0x76b8('0x2e')]();});}};}function handleEntityNotFound(_0x2721ae,_0x31d38f){return function(_0x4d953e){if(!_0x4d953e){_0x2721ae[_0x76b8('0x2c')](0x194);}return _0x4d953e;};}function handleError(_0x302c0f,_0x22010c){_0x22010c=_0x22010c||0x1f4;return function(_0x1afa7f){logger['error'](_0x1afa7f[_0x76b8('0x37')]);if(_0x1afa7f[_0x76b8('0x38')]){delete _0x1afa7f[_0x76b8('0x38')];}_0x302c0f['status'](_0x22010c)[_0x76b8('0x39')](_0x1afa7f);};}exports[_0x76b8('0x3a')]=function(_0x278af2,_0xa11468){var _0x543dfd={},_0xed98a0={},_0x596655={'count':0x0,'rows':[]};var _0xc23949=_[_0x76b8('0x3b')](db[_0x76b8('0x3c')]['rawAttributes'],function(_0x9745ea){return{'name':_0x9745ea['fieldName'],'type':_0x9745ea[_0x76b8('0x3d')]['key']};});_0xed98a0[_0x76b8('0x3e')]=_[_0x76b8('0x3b')](_0xc23949,'name');_0xed98a0[_0x76b8('0x3f')]=_[_0x76b8('0x40')](_0x278af2[_0x76b8('0x3f')]);_0xed98a0[_0x76b8('0x41')]=_[_0x76b8('0x42')](_0xed98a0[_0x76b8('0x3e')],_0xed98a0['query']);_0x543dfd['attributes']=_['intersection'](_0xed98a0[_0x76b8('0x3e')],qs[_0x76b8('0x43')](_0x278af2[_0x76b8('0x3f')]['fields']));_0x543dfd['attributes']=_0x543dfd[_0x76b8('0x44')][_0x76b8('0x45')]?_0x543dfd['attributes']:_0xed98a0[_0x76b8('0x3e')];if(!_0x278af2[_0x76b8('0x3f')][_0x76b8('0x46')](_0x76b8('0x47'))){_0x543dfd[_0x76b8('0x48')]=qs[_0x76b8('0x48')](_0x278af2[_0x76b8('0x3f')][_0x76b8('0x48')]);_0x543dfd['offset']=qs[_0x76b8('0x30')](_0x278af2['query'][_0x76b8('0x30')]);}_0x543dfd[_0x76b8('0x49')]=qs[_0x76b8('0x4a')](_0x278af2['query'][_0x76b8('0x4a')]);_0x543dfd[_0x76b8('0x4b')]=qs[_0x76b8('0x41')](_[_0x76b8('0x4c')](_0x278af2[_0x76b8('0x3f')],_0xed98a0[_0x76b8('0x41')]),_0xc23949);if(_0x278af2[_0x76b8('0x3f')][_0x76b8('0x4d')]){_0x543dfd['where']=_[_0x76b8('0x4e')](_0x543dfd['where'],{'$or':_[_0x76b8('0x3b')](_0xc23949,function(_0x4eefe9){if(_0x4eefe9['type']!==_0x76b8('0x4f')){var _0x5f0b39={};_0x5f0b39[_0x4eefe9[_0x76b8('0x38')]]={'$like':'%'+_0x278af2[_0x76b8('0x3f')][_0x76b8('0x4d')]+'%'};return _0x5f0b39;}})});}_0x543dfd=_[_0x76b8('0x4e')]({},_0x543dfd,_0x278af2['options']);var _0x287fdb={'where':_0x543dfd[_0x76b8('0x4b')]};return db[_0x76b8('0x3c')][_0x76b8('0x2f')](_0x287fdb)[_0x76b8('0x21')](function(_0x488bef){_0x596655['count']=_0x488bef;if(_0x278af2[_0x76b8('0x3f')][_0x76b8('0x50')]){_0x543dfd[_0x76b8('0x51')]=[{'all':!![]}];}return db[_0x76b8('0x3c')][_0x76b8('0x52')](_0x543dfd);})[_0x76b8('0x21')](function(_0x43f44c){_0x596655[_0x76b8('0x53')]=_0x43f44c;return _0x596655;})[_0x76b8('0x21')](respondWithFilteredResult(_0xa11468,_0x543dfd))[_0x76b8('0x2b')](handleError(_0xa11468,null));};exports[_0x76b8('0x54')]=function(_0x488774,_0x1aec16){var _0x18e137={'raw':!![],'where':{'id':_0x488774[_0x76b8('0x55')]['id']}},_0x2454dd={};_0x2454dd['model']=_['keys'](db[_0x76b8('0x3c')][_0x76b8('0x56')]);_0x2454dd[_0x76b8('0x3f')]=_[_0x76b8('0x40')](_0x488774[_0x76b8('0x3f')]);_0x2454dd[_0x76b8('0x41')]=_[_0x76b8('0x42')](_0x2454dd[_0x76b8('0x3e')],_0x2454dd['query']);_0x18e137[_0x76b8('0x44')]=_[_0x76b8('0x42')](_0x2454dd[_0x76b8('0x3e')],qs[_0x76b8('0x43')](_0x488774[_0x76b8('0x3f')][_0x76b8('0x43')]));_0x18e137['attributes']=_0x18e137[_0x76b8('0x44')]['length']?_0x18e137[_0x76b8('0x44')]:_0x2454dd[_0x76b8('0x3e')];if(_0x488774[_0x76b8('0x3f')][_0x76b8('0x50')]){_0x18e137[_0x76b8('0x51')]=[{'all':!![]}];}_0x18e137=_[_0x76b8('0x4e')]({},_0x18e137,_0x488774[_0x76b8('0x57')]);return db[_0x76b8('0x3c')][_0x76b8('0x58')](_0x18e137)[_0x76b8('0x21')](handleEntityNotFound(_0x1aec16,null))['then'](respondWithResult(_0x1aec16,null))[_0x76b8('0x2b')](handleError(_0x1aec16,null));};exports[_0x76b8('0x35')]=function(_0x47e26f,_0x4a8ae9){if(_0x47e26f['body']['id']){delete _0x47e26f[_0x76b8('0x59')]['id'];}return db[_0x76b8('0x3c')][_0x76b8('0x58')]({'where':{'id':_0x47e26f[_0x76b8('0x55')]['id']}})[_0x76b8('0x21')](handleEntityNotFound(_0x4a8ae9,null))[_0x76b8('0x21')](saveUpdates(_0x47e26f[_0x76b8('0x59')],null))[_0x76b8('0x21')](respondWithResult(_0x4a8ae9,null))[_0x76b8('0x2b')](handleError(_0x4a8ae9,null));};exports['destroy']=function(_0x48ef9d,_0x1f8d81){return db['FaxMessage'][_0x76b8('0x58')]({'where':{'id':_0x48ef9d[_0x76b8('0x55')]['id']}})[_0x76b8('0x21')](handleEntityNotFound(_0x1f8d81,null))[_0x76b8('0x21')](removeEntity(_0x1f8d81,null))[_0x76b8('0x2b')](handleError(_0x1f8d81,null));};exports[_0x76b8('0x5a')]=function(_0x17a016,_0x3b4098){return db['FaxMessage'][_0x76b8('0x5a')]()[_0x76b8('0x21')](respondWithResult(_0x3b4098,null))[_0x76b8('0x2b')](handleError(_0x3b4098,null));};var interaction_log=require('../../config/logger')(_0x76b8('0x5b'));exports['accept']=function(_0x272397,_0x245e62,_0x46e351){var _0x19c5ec={'channel':'fax'};if(_0x272397[_0x76b8('0x59')]['id']){delete _0x272397[_0x76b8('0x59')]['id'];}_0x272397['body']['read']=!![];_0x272397[_0x76b8('0x59')][_0x76b8('0x5c')]=moment()[_0x76b8('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x272397[_0x76b8('0x59')][_0x76b8('0x5e')]=_0x272397[_0x76b8('0x59')][_0x76b8('0x5e')]||_0x272397[_0x76b8('0x5f')]['id'];return db[_0x76b8('0x3c')]['find']({'where':{'id':_0x272397[_0x76b8('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x76b8('0x60')],'as':'Contact'}]})[_0x76b8('0x21')](handleEntityNotFound(_0x245e62,null))[_0x76b8('0x21')](saveUpdates(_0x272397[_0x76b8('0x59')],null))[_0x76b8('0x21')](function(_0x12af66){if(_0x12af66){_0x19c5ec['message']=_0x12af66[_0x76b8('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x76b8('0x58')]({'where':{'id':_0x12af66[_0x76b8('0x62')]}});}return null;})[_0x76b8('0x21')](handleEntityNotFound(_0x245e62,null))['then'](function(_0x14d6c7){if(_0x14d6c7){return _0x14d6c7[_0x76b8('0x35')]({'UserId':_0x272397[_0x76b8('0x59')][_0x76b8('0x5e')],'read1stAt':_[_0x76b8('0x63')](_0x14d6c7[_0x76b8('0x64')])?moment()['format'](_0x76b8('0x65')):undefined});}return null;})[_0x76b8('0x21')](function(_0x31e17d){if(_0x31e17d){_0x19c5ec['interaction']=_0x31e17d[_0x76b8('0x61')]({'plain':!![]});interaction_log[_0x76b8('0x22')](_0x76b8('0x66'),_0x272397[_0x76b8('0x5f')]['id'],_0x272397[_0x76b8('0x5f')][_0x76b8('0x38')],_0x272397[_0x76b8('0x5f')][_0x76b8('0x67')],_0x19c5ec[_0x76b8('0x68')]['id'],_0x272397['body']?JSON['stringify'](_0x272397[_0x76b8('0x59')]):'null');return respondWithRpcPromise(_0x76b8('0x69'),_0x76b8('0x6a'),_0x19c5ec);}return null;})['then'](function(_0x11af2a){if(_0x11af2a){if(_0x272397[_0x76b8('0x59')][_0x76b8('0x6b')]){_0x19c5ec[_0x76b8('0x2a')]['interface']=util[_0x76b8('0x5d')]('SIP/%s',_0x272397[_0x76b8('0x5f')]['name']);_0x19c5ec[_0x76b8('0x2a')][_0x76b8('0x6c')]=_0x19c5ec[_0x76b8('0x6c')];_0x19c5ec['message']['event']=_0x76b8('0x6d');return respondWithRpcPromise('EventManager',_0x76b8('0x6e'),{'event':'acceptmessage','message':_0x19c5ec['message']},client9002)[_0x76b8('0x21')](function(){return _0x19c5ec;});}return _0x19c5ec;}return null;})[_0x76b8('0x21')](respondWithResult(_0x245e62,null))[_0x76b8('0x2b')](handleError(_0x245e62,null));};var interaction_log=require('../../config/logger')(_0x76b8('0x5b'));exports[_0x76b8('0x6f')]=function(_0x479455,_0x7171f1,_0x197748){var _0x6c13b7={'agent':{},'channel':_0x76b8('0x70')};if(_0x479455[_0x76b8('0x59')]['id']){delete _0x479455[_0x76b8('0x59')]['id'];}_0x479455[_0x76b8('0x59')][_0x76b8('0x5e')]=_0x479455[_0x76b8('0x59')][_0x76b8('0x5e')]||_0x479455[_0x76b8('0x5f')]['id'];_0x6c13b7[_0x76b8('0x71')]['id']=_0x479455[_0x76b8('0x59')][_0x76b8('0x5e')];return db[_0x76b8('0x3c')][_0x76b8('0x58')]({'where':{'id':_0x479455[_0x76b8('0x55')]['id'],'UserId':null}})[_0x76b8('0x21')](handleEntityNotFound(_0x7171f1,null))[_0x76b8('0x21')](function(_0x6d27bc){if(_0x6d27bc){_0x6c13b7[_0x76b8('0x2a')]=_0x6d27bc['get']({'plain':!![]});return db[_0x76b8('0x72')][_0x76b8('0x58')]({'where':{'id':_0x6d27bc[_0x76b8('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x7171f1,null))[_0x76b8('0x21')](function(_0x2b8405){if(_0x2b8405){_0x6c13b7[_0x76b8('0x68')]=_0x2b8405[_0x76b8('0x61')]({'plain':!![]});interaction_log[_0x76b8('0x22')](_0x76b8('0x73'),_0x479455[_0x76b8('0x5f')]['id'],_0x479455[_0x76b8('0x5f')][_0x76b8('0x38')],_0x479455[_0x76b8('0x5f')][_0x76b8('0x67')],_0x6c13b7['interaction']['id'],_0x479455[_0x76b8('0x59')]?JSON['stringify'](_0x479455['body']):_0x76b8('0x74'));return respondWithRpcPromise(_0x76b8('0x75'),'rejectMessage',_0x6c13b7);}return null;})[_0x76b8('0x21')](function(_0x3f321c){if(_0x3f321c){_0x3f321c[_0x76b8('0x2a')][_0x76b8('0x76')]=util['format'](_0x76b8('0x77'),_0x479455[_0x76b8('0x5f')][_0x76b8('0x38')]);_0x3f321c[_0x76b8('0x2a')][_0x76b8('0x6c')]=_0x6c13b7[_0x76b8('0x6c')];_0x3f321c['message'][_0x76b8('0x78')]=_0x76b8('0x6f');respondWithRpcPromise(_0x76b8('0x6e'),_0x76b8('0x6e'),{'event':_0x76b8('0x79'),'message':_0x3f321c[_0x76b8('0x2a')]},client9002);return _0x6c13b7;}return null;})[_0x76b8('0x21')](respondWithResult(_0x7171f1,null))['catch'](handleError(_0x7171f1,null));};exports[_0x76b8('0x7a')]=function(_0x2313df,_0x321069){var _0x71cae;return db['FaxMessage'][_0x76b8('0x7a')](_0x2313df['body'],{})[_0x76b8('0x21')](function(_0x286039){_0x71cae=_0x286039;return db['CmContact'][_0x76b8('0x7b')]({'where':{'id':_0x71cae['ContactId']}});})[_0x76b8('0x21')](function(_0x5babcf){if(_['isNil'](_0x5babcf)){return;}else{_0x71cae[_0x76b8('0x70')]=_0x5babcf[_0x76b8('0x70')];return db[_0x76b8('0x7c')][_0x76b8('0x7b')]({'where':{'id':_0x71cae[_0x76b8('0x7d')]}});}})[_0x76b8('0x21')](function(_0x3556ab){return respondWithRpcPromise('SendFax',_0x76b8('0x7e'),{'FaxAccountId':_['isNil'](_0x2313df[_0x76b8('0x59')])?undefined:_0x2313df[_0x76b8('0x59')][_0x76b8('0x7f')],'path':_[_0x76b8('0x63')](_0x3556ab)?undefined:util[_0x76b8('0x5d')]('/var/opt/motion2/server/files/attachments/%s',_0x3556ab['basename']),'fax':_[_0x76b8('0x63')](_0x71cae['fax'])?undefined:_0x71cae[_0x76b8('0x70')],'AttachmentId':_0x71cae[_0x76b8('0x7d')]},client9002);})[_0x76b8('0x21')](respondWithResult(_0x321069,0xc9))[_0x76b8('0x2b')](handleError(_0x321069,null));};exports['download']=function(_0x5800d8,_0x415a9e){var _0x56fa5b=path[_0x76b8('0x80')](config['root'],'server',_0x76b8('0x81'),_0x76b8('0x82'));return db['FaxMessage'][_0x76b8('0x58')]({'where':{'id':_0x5800d8[_0x76b8('0x55')]['id']},'include':[{'model':db['Attachment'],'as':_0x76b8('0x7c')}]})['then'](handleEntityNotFound(_0x415a9e,null))[_0x76b8('0x21')](function(_0xb91ddb){if(_0xb91ddb){return _0x415a9e[_0x76b8('0x83')](path[_0x76b8('0x80')](_0x56fa5b,_0xb91ddb[_0x76b8('0x7c')][_0x76b8('0x84')]));}})[_0x76b8('0x2b')](handleError(_0x415a9e,null));}; \ No newline at end of file +var _0xc44b=['[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','download','html-pdf','rimraf','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','show','params','intersection','find','describe','fax-interactions','accept','fax','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','FaxInteractionId','isNil','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent'];(function(_0x2fd914,_0x1d0801){var _0x5c53eb=function(_0x247386){while(--_0x247386){_0x2fd914['push'](_0x2fd914['shift']());}};_0x5c53eb(++_0x1d0801);}(_0xc44b,0x9a));var _0xbc44=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0xc44b[_0x10a904];return _0x53815a;};'use strict';var pdf=require(_0xbc44('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbc44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc44('0x2'));var moment=require('moment');var BPromise=require(_0xbc44('0x3'));var Mustache=require(_0xbc44('0x4'));var util=require('util');var path=require(_0xbc44('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbc44('0x6'));var fs=require('fs');var _=require(_0xbc44('0x7'));var squel=require(_0xbc44('0x8'));var crypto=require(_0xbc44('0x9'));var jsforce=require(_0xbc44('0xa'));var deskjs=require(_0xbc44('0xb'));var toCsv=require(_0xbc44('0xc'));var querystring=require(_0xbc44('0xd'));var Papa=require(_0xbc44('0xe'));var Redis=require(_0xbc44('0xf'));var authService=require(_0xbc44('0x10'));var qs=require(_0xbc44('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc44('0x12'));var logger=require(_0xbc44('0x13'))(_0xbc44('0x14'));var utils=require(_0xbc44('0x15'));var config=require(_0xbc44('0x16'));var licenseUtil=require(_0xbc44('0x17'));var db=require(_0xbc44('0x18'))['db'];config[_0xbc44('0x19')]=_['defaults'](config[_0xbc44('0x19')],{'host':_0xbc44('0x1a'),'port':0x18eb});var socket=require(_0xbc44('0x1b'))(new Redis(config[_0xbc44('0x19')]));require(_0xbc44('0x1c'))[_0xbc44('0x1d')](socket);var jayson=require(_0xbc44('0x1e'));var client=jayson[_0xbc44('0x1f')][_0xbc44('0x20')]({'port':0x232c});var client9002=jayson[_0xbc44('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4825b2,_0x5a6aaa,_0x33e46d,_0x40dba2){return new BPromise(function(_0x40eae7,_0x3b60e9){var _0x4c6f65=_0x40dba2||client;return _0x4c6f65[_0xbc44('0x21')](_0x4825b2,_0x33e46d)[_0xbc44('0x22')](function(_0xc53a1a){logger['info'](_0xbc44('0x23'),_0x5a6aaa,_0xbc44('0x24'));logger['debug'](_0xbc44('0x25'),_0x5a6aaa,_0xbc44('0x24'),JSON[_0xbc44('0x26')](_0xc53a1a));if(_0xc53a1a[_0xbc44('0x27')]){if(_0xc53a1a['error']['code']===0x1f4){logger[_0xbc44('0x27')](_0xbc44('0x23'),_0x5a6aaa,_0xc53a1a[_0xbc44('0x27')][_0xbc44('0x28')]);return _0x3b60e9(_0xc53a1a['error']['message']);}logger[_0xbc44('0x27')](_0xbc44('0x23'),_0x5a6aaa,_0xc53a1a['error'][_0xbc44('0x28')]);return _0x40eae7(_0xc53a1a[_0xbc44('0x27')][_0xbc44('0x28')]);}else{logger[_0xbc44('0x29')](_0xbc44('0x23'),_0x5a6aaa,_0xbc44('0x24'));_0x40eae7(_0xc53a1a['result'][_0xbc44('0x28')]);}})[_0xbc44('0x2a')](function(_0x38b46f){logger['error'](_0xbc44('0x23'),_0x5a6aaa,_0x38b46f);_0x3b60e9(_0x38b46f);});});}function respondWithStatusCode(_0x313225,_0x41a918){_0x41a918=_0x41a918||0xcc;return function(_0x34ec88){if(_0x34ec88){return _0x313225[_0xbc44('0x2b')](_0x41a918);}return _0x313225[_0xbc44('0x2c')](_0x41a918)['end']();};}function respondWithResult(_0x4c687a,_0x294104){_0x294104=_0x294104||0xc8;return function(_0x4e52ba){if(_0x4e52ba){return _0x4c687a[_0xbc44('0x2c')](_0x294104)[_0xbc44('0x2d')](_0x4e52ba);}};}function respondWithFilteredResult(_0x1c3750,_0x4a6d8f){return function(_0x4db891){if(_0x4db891){var _0x6f859e=_0x4db891[_0xbc44('0x2e')],_0x1101fc=_0x4a6d8f[_0xbc44('0x2f')],_0x3fb2f1=_0x4a6d8f[_0xbc44('0x2f')]+_0x4a6d8f[_0xbc44('0x30')],_0x1cd9d2;if(_0x3fb2f1>=_0x6f859e){_0x3fb2f1=_0x6f859e;_0x1cd9d2=0xc8;}else{_0x1cd9d2=0xce;}_0x1c3750[_0xbc44('0x2c')](_0x1cd9d2);return _0x1c3750[_0xbc44('0x31')](_0xbc44('0x32'),_0x1101fc+'-'+_0x3fb2f1+'/'+_0x6f859e)['json'](_0x4db891);}return null;};}function patchUpdates(_0x562bc5){return function(_0x10c5d2){try{jsonpatch[_0xbc44('0x33')](_0x10c5d2,_0x562bc5,!![]);}catch(_0x2cec34){return BPromise[_0xbc44('0x34')](_0x2cec34);}return _0x10c5d2[_0xbc44('0x35')]();};}function saveUpdates(_0x47b8f0,_0x462721){return function(_0x2aefc7){if(_0x2aefc7){return _0x2aefc7[_0xbc44('0x36')](_0x47b8f0)[_0xbc44('0x22')](function(_0x15088d){return _0x15088d;});}return null;};}function removeEntity(_0x320dd7,_0x1e6a8a){return function(_0x327b16){if(_0x327b16){return _0x327b16[_0xbc44('0x37')]()[_0xbc44('0x22')](function(){_0x320dd7['status'](0xcc)[_0xbc44('0x38')]();});}};}function handleEntityNotFound(_0x55fc78,_0x347f4c){return function(_0xa2380b){if(!_0xa2380b){_0x55fc78['sendStatus'](0x194);}return _0xa2380b;};}function handleError(_0x1be02d,_0x5de4){_0x5de4=_0x5de4||0x1f4;return function(_0x1942e3){logger[_0xbc44('0x27')](_0x1942e3[_0xbc44('0x39')]);if(_0x1942e3[_0xbc44('0x3a')]){delete _0x1942e3['name'];}_0x1be02d[_0xbc44('0x2c')](_0x5de4)[_0xbc44('0x3b')](_0x1942e3);};}exports[_0xbc44('0x3c')]=function(_0x16faba,_0x44bc18){var _0x2d6ad1={},_0x56704b={},_0x5717db={'count':0x0,'rows':[]};var _0x5a1a55=_['map'](db['FaxMessage'][_0xbc44('0x3d')],function(_0x44cf65){return{'name':_0x44cf65[_0xbc44('0x3e')],'type':_0x44cf65[_0xbc44('0x3f')][_0xbc44('0x40')]};});_0x56704b[_0xbc44('0x41')]=_[_0xbc44('0x42')](_0x5a1a55,_0xbc44('0x3a'));_0x56704b[_0xbc44('0x43')]=_[_0xbc44('0x44')](_0x16faba[_0xbc44('0x43')]);_0x56704b[_0xbc44('0x45')]=_['intersection'](_0x56704b['model'],_0x56704b[_0xbc44('0x43')]);_0x2d6ad1['attributes']=_['intersection'](_0x56704b[_0xbc44('0x41')],qs[_0xbc44('0x46')](_0x16faba[_0xbc44('0x43')]['fields']));_0x2d6ad1[_0xbc44('0x47')]=_0x2d6ad1[_0xbc44('0x47')][_0xbc44('0x48')]?_0x2d6ad1[_0xbc44('0x47')]:_0x56704b[_0xbc44('0x41')];if(!_0x16faba['query'][_0xbc44('0x49')](_0xbc44('0x4a'))){_0x2d6ad1[_0xbc44('0x30')]=qs[_0xbc44('0x30')](_0x16faba[_0xbc44('0x43')]['limit']);_0x2d6ad1[_0xbc44('0x2f')]=qs[_0xbc44('0x2f')](_0x16faba[_0xbc44('0x43')][_0xbc44('0x2f')]);}_0x2d6ad1[_0xbc44('0x4b')]=qs[_0xbc44('0x4c')](_0x16faba[_0xbc44('0x43')][_0xbc44('0x4c')]);_0x2d6ad1[_0xbc44('0x4d')]=qs[_0xbc44('0x45')](_[_0xbc44('0x4e')](_0x16faba[_0xbc44('0x43')],_0x56704b[_0xbc44('0x45')]),_0x5a1a55);if(_0x16faba[_0xbc44('0x43')][_0xbc44('0x4f')]){_0x2d6ad1[_0xbc44('0x4d')]=_[_0xbc44('0x50')](_0x2d6ad1[_0xbc44('0x4d')],{'$or':_[_0xbc44('0x42')](_0x5a1a55,function(_0x7d592d){if(_0x7d592d['type']!==_0xbc44('0x51')){var _0x3e8199={};_0x3e8199[_0x7d592d[_0xbc44('0x3a')]]={'$like':'%'+_0x16faba['query'][_0xbc44('0x4f')]+'%'};return _0x3e8199;}})});}_0x2d6ad1=_['merge']({},_0x2d6ad1,_0x16faba[_0xbc44('0x52')]);var _0x3dc6fd={'where':_0x2d6ad1[_0xbc44('0x4d')]};return db[_0xbc44('0x53')][_0xbc44('0x2e')](_0x3dc6fd)[_0xbc44('0x22')](function(_0x1f8e7d){_0x5717db[_0xbc44('0x2e')]=_0x1f8e7d;if(_0x16faba[_0xbc44('0x43')][_0xbc44('0x54')]){_0x2d6ad1[_0xbc44('0x55')]=[{'all':!![]}];}return db[_0xbc44('0x53')][_0xbc44('0x56')](_0x2d6ad1);})[_0xbc44('0x22')](function(_0x323a35){_0x5717db[_0xbc44('0x57')]=_0x323a35;return _0x5717db;})[_0xbc44('0x22')](respondWithFilteredResult(_0x44bc18,_0x2d6ad1))[_0xbc44('0x2a')](handleError(_0x44bc18,null));};exports[_0xbc44('0x58')]=function(_0x2782b1,_0x27d4ac){var _0x14d1a9={'raw':!![],'where':{'id':_0x2782b1[_0xbc44('0x59')]['id']}},_0x2ee72a={};_0x2ee72a['model']=_['keys'](db[_0xbc44('0x53')]['rawAttributes']);_0x2ee72a[_0xbc44('0x43')]=_['keys'](_0x2782b1['query']);_0x2ee72a[_0xbc44('0x45')]=_[_0xbc44('0x5a')](_0x2ee72a[_0xbc44('0x41')],_0x2ee72a[_0xbc44('0x43')]);_0x14d1a9[_0xbc44('0x47')]=_[_0xbc44('0x5a')](_0x2ee72a[_0xbc44('0x41')],qs[_0xbc44('0x46')](_0x2782b1[_0xbc44('0x43')][_0xbc44('0x46')]));_0x14d1a9[_0xbc44('0x47')]=_0x14d1a9['attributes']['length']?_0x14d1a9[_0xbc44('0x47')]:_0x2ee72a['model'];if(_0x2782b1[_0xbc44('0x43')][_0xbc44('0x54')]){_0x14d1a9['include']=[{'all':!![]}];}_0x14d1a9=_[_0xbc44('0x50')]({},_0x14d1a9,_0x2782b1[_0xbc44('0x52')]);return db['FaxMessage'][_0xbc44('0x5b')](_0x14d1a9)[_0xbc44('0x22')](handleEntityNotFound(_0x27d4ac,null))[_0xbc44('0x22')](respondWithResult(_0x27d4ac,null))[_0xbc44('0x2a')](handleError(_0x27d4ac,null));};exports[_0xbc44('0x36')]=function(_0x46d720,_0x45e8ae){if(_0x46d720['body']['id']){delete _0x46d720['body']['id'];}return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x46d720[_0xbc44('0x59')]['id']}})['then'](handleEntityNotFound(_0x45e8ae,null))[_0xbc44('0x22')](saveUpdates(_0x46d720['body'],null))[_0xbc44('0x22')](respondWithResult(_0x45e8ae,null))['catch'](handleError(_0x45e8ae,null));};exports['destroy']=function(_0x4ac09d,_0x847e37){return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x4ac09d[_0xbc44('0x59')]['id']}})['then'](handleEntityNotFound(_0x847e37,null))['then'](removeEntity(_0x847e37,null))[_0xbc44('0x2a')](handleError(_0x847e37,null));};exports[_0xbc44('0x5c')]=function(_0x33c15e,_0x2e6701){return db[_0xbc44('0x53')]['describe']()[_0xbc44('0x22')](respondWithResult(_0x2e6701,null))[_0xbc44('0x2a')](handleError(_0x2e6701,null));};var interaction_log=require(_0xbc44('0x13'))(_0xbc44('0x5d'));exports[_0xbc44('0x5e')]=function(_0x1bf7c7,_0x2bb6e3,_0x51c3ac){var _0x442a8f={'channel':_0xbc44('0x5f')};if(_0x1bf7c7[_0xbc44('0x60')]['id']){delete _0x1bf7c7[_0xbc44('0x60')]['id'];}_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x61')]=!![];_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x62')]=moment()[_0xbc44('0x63')](_0xbc44('0x64'));_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x65')]=_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x65')]||_0x1bf7c7[_0xbc44('0x66')]['id'];return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x1bf7c7[_0xbc44('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xbc44('0x22')](handleEntityNotFound(_0x2bb6e3,null))[_0xbc44('0x22')](saveUpdates(_0x1bf7c7['body'],null))[_0xbc44('0x22')](function(_0x19020c){if(_0x19020c){_0x442a8f[_0xbc44('0x28')]=_0x19020c['get']({'plain':!![]});return db[_0xbc44('0x67')]['find']({'where':{'id':_0x19020c[_0xbc44('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x2bb6e3,null))['then'](function(_0x62a89e){if(_0x62a89e){return _0x62a89e[_0xbc44('0x36')]({'UserId':_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x65')],'read1stAt':_[_0xbc44('0x69')](_0x62a89e['read1stAt'])?moment()[_0xbc44('0x63')](_0xbc44('0x64')):undefined});}return null;})['then'](function(_0x14b9f7){if(_0x14b9f7){_0x442a8f['interaction']=_0x14b9f7[_0xbc44('0x6a')]({'plain':!![]});interaction_log[_0xbc44('0x29')](_0xbc44('0x6b'),_0x1bf7c7[_0xbc44('0x66')]['id'],_0x1bf7c7[_0xbc44('0x66')][_0xbc44('0x3a')],_0x1bf7c7[_0xbc44('0x66')][_0xbc44('0x6c')],_0x442a8f[_0xbc44('0x6d')]['id'],_0x1bf7c7['body']?JSON[_0xbc44('0x26')](_0x1bf7c7[_0xbc44('0x60')]):'null');return respondWithRpcPromise(_0xbc44('0x6e'),_0xbc44('0x6f'),_0x442a8f);}return null;})[_0xbc44('0x22')](function(_0x19433a){if(_0x19433a){if(_0x1bf7c7[_0xbc44('0x60')][_0xbc44('0x70')]){_0x442a8f[_0xbc44('0x28')][_0xbc44('0x71')]=util[_0xbc44('0x63')](_0xbc44('0x72'),_0x1bf7c7[_0xbc44('0x66')][_0xbc44('0x3a')]);_0x442a8f[_0xbc44('0x28')][_0xbc44('0x73')]=_0x442a8f['channel'];_0x442a8f[_0xbc44('0x28')][_0xbc44('0x74')]=_0xbc44('0x5e');return respondWithRpcPromise('EventManager',_0xbc44('0x75'),{'event':_0xbc44('0x76'),'message':_0x442a8f[_0xbc44('0x28')]},client9002)['then'](function(){return _0x442a8f;});}return _0x442a8f;}return null;})[_0xbc44('0x22')](respondWithResult(_0x2bb6e3,null))[_0xbc44('0x2a')](handleError(_0x2bb6e3,null));};var interaction_log=require(_0xbc44('0x13'))('fax-interactions');exports[_0xbc44('0x34')]=function(_0x203bd3,_0x2280a8,_0x293981){var _0x1c58f8={'agent':{},'channel':_0xbc44('0x5f')};if(_0x203bd3[_0xbc44('0x60')]['id']){delete _0x203bd3[_0xbc44('0x60')]['id'];}_0x203bd3['body'][_0xbc44('0x65')]=_0x203bd3[_0xbc44('0x60')][_0xbc44('0x65')]||_0x203bd3[_0xbc44('0x66')]['id'];_0x1c58f8[_0xbc44('0x77')]['id']=_0x203bd3['body']['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x203bd3['params']['id'],'UserId':null}})[_0xbc44('0x22')](handleEntityNotFound(_0x2280a8,null))[_0xbc44('0x22')](function(_0x18c97b){if(_0x18c97b){_0x1c58f8['message']=_0x18c97b[_0xbc44('0x6a')]({'plain':!![]});return db['FaxInteraction'][_0xbc44('0x5b')]({'where':{'id':_0x18c97b[_0xbc44('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x2280a8,null))[_0xbc44('0x22')](function(_0x211175){if(_0x211175){_0x1c58f8[_0xbc44('0x6d')]=_0x211175[_0xbc44('0x6a')]({'plain':!![]});interaction_log[_0xbc44('0x29')](_0xbc44('0x78'),_0x203bd3[_0xbc44('0x66')]['id'],_0x203bd3['user'][_0xbc44('0x3a')],_0x203bd3[_0xbc44('0x66')][_0xbc44('0x6c')],_0x1c58f8['interaction']['id'],_0x203bd3['body']?JSON[_0xbc44('0x26')](_0x203bd3[_0xbc44('0x60')]):_0xbc44('0x79'));return respondWithRpcPromise('RejectMessage',_0xbc44('0x7a'),_0x1c58f8);}return null;})[_0xbc44('0x22')](function(_0x4ace4f){if(_0x4ace4f){_0x4ace4f['message']['interface']=util[_0xbc44('0x63')](_0xbc44('0x72'),_0x203bd3[_0xbc44('0x66')][_0xbc44('0x3a')]);_0x4ace4f[_0xbc44('0x28')][_0xbc44('0x73')]=_0x1c58f8[_0xbc44('0x73')];_0x4ace4f['message'][_0xbc44('0x74')]=_0xbc44('0x34');respondWithRpcPromise(_0xbc44('0x75'),_0xbc44('0x75'),{'event':'rejectmessage','message':_0x4ace4f[_0xbc44('0x28')]},client9002);return _0x1c58f8;}return null;})[_0xbc44('0x22')](respondWithResult(_0x2280a8,null))[_0xbc44('0x2a')](handleError(_0x2280a8,null));};exports[_0xbc44('0x7b')]=function(_0x48af6b,_0x26cafd){var _0x408f05;return db[_0xbc44('0x53')][_0xbc44('0x7b')](_0x48af6b['body'],{})[_0xbc44('0x22')](function(_0x42c9cf){_0x408f05=_0x42c9cf;return db[_0xbc44('0x7c')][_0xbc44('0x7d')]({'where':{'id':_0x408f05[_0xbc44('0x7e')]}});})['then'](function(_0x2af020){if(_[_0xbc44('0x69')](_0x2af020)){return;}else{_0x408f05[_0xbc44('0x5f')]=_0x2af020[_0xbc44('0x5f')];return db[_0xbc44('0x7f')][_0xbc44('0x7d')]({'where':{'id':_0x408f05[_0xbc44('0x80')]}});}})[_0xbc44('0x22')](function(_0x3499bb){return respondWithRpcPromise(_0xbc44('0x81'),'SendFax',{'FaxAccountId':_[_0xbc44('0x69')](_0x48af6b[_0xbc44('0x60')])?undefined:_0x48af6b['body']['FaxAccountId'],'path':_[_0xbc44('0x69')](_0x3499bb)?undefined:util[_0xbc44('0x63')](_0xbc44('0x82'),_0x3499bb[_0xbc44('0x83')]),'fax':_['isNil'](_0x408f05[_0xbc44('0x5f')])?undefined:_0x408f05['fax'],'AttachmentId':_0x408f05[_0xbc44('0x80')]},client9002);})[_0xbc44('0x22')](respondWithResult(_0x26cafd,0xc9))[_0xbc44('0x2a')](handleError(_0x26cafd,null));};exports['download']=function(_0x475e3d,_0x308391){var _0x172f3f=path[_0xbc44('0x84')](config['root'],_0xbc44('0x85'),_0xbc44('0x86'),_0xbc44('0x87'));return db[_0xbc44('0x53')][_0xbc44('0x5b')]({'where':{'id':_0x475e3d[_0xbc44('0x59')]['id']},'include':[{'model':db[_0xbc44('0x7f')],'as':_0xbc44('0x7f')}]})[_0xbc44('0x22')](handleEntityNotFound(_0x308391,null))[_0xbc44('0x22')](function(_0x424bc1){if(_0x424bc1){return _0x308391[_0xbc44('0x88')](path[_0xbc44('0x84')](_0x172f3f,_0x424bc1[_0xbc44('0x7f')][_0xbc44('0x83')]));}})[_0xbc44('0x2a')](handleError(_0x308391,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index bf97c0e..7f763d6 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(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x55ca,0x126));var _0xa55c=function(_0x389318,_0x13a53d){_0x389318=_0x389318-0x0;var _0x7919e3=_0x55ca[_0x389318];return _0x7919e3;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x2f2fd0,_0x3c980d){var _0x44f94f=function(_0x1fb033){while(--_0x1fb033){_0x2f2fd0['push'](_0x2f2fd0['shift']());}};_0x44f94f(++_0x3c980d);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 94abbbf..9de7c5c 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 _0x667c=['secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','out'];(function(_0x517fa8,_0x3adce0){var _0x5409f4=function(_0x501e80){while(--_0x501e80){_0x517fa8['push'](_0x517fa8['shift']());}};_0x5409f4(++_0x3adce0);}(_0x667c,0xeb));var _0xc667=function(_0x308847,_0x4be3e9){_0x308847=_0x308847-0x0;var _0xdd93a5=_0x667c[_0x308847];return _0xdd93a5;};'use strict';var _=require('lodash');var util=require(_0xc667('0x0'));var logger=require(_0xc667('0x1'))(_0xc667('0x2'));var moment=require('moment');var BPromise=require(_0xc667('0x3'));var rp=require(_0xc667('0x4'));var fs=require('fs');var path=require(_0xc667('0x5'));var rimraf=require('rimraf');var config=require(_0xc667('0x6'));var attributes=require(_0xc667('0x7'));module[_0xc667('0x8')]=function(_0x109f87,_0x3c836e){return _0x109f87['define'](_0xc667('0x9'),attributes,{'tableName':_0xc667('0xa'),'paranoid':![],'indexes':[{'name':_0xc667('0xb'),'fields':['body'],'type':_0xc667('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe6d9e3,_0x4220f5,_0x577b44){var _0x360ebd=_0x109f87[_0xc667('0xd')];var _0x1379b7=_0xe6d9e3[_0xc667('0xe')]({'plain':!![]});if(_0x1379b7[_0xc667('0xf')]['toLowerCase']()==='in'||_0x1379b7[_0xc667('0xf')]['toLowerCase']()===_0xc667('0x10')&&!_0x1379b7[_0xc667('0x11')]&&!_['isNil'](_0x1379b7['UserId'])){_0x360ebd[_0xc667('0x12')][_0xc667('0x13')]({'where':{'id':_0x1379b7[_0xc667('0x14')]}})[_0xc667('0x15')](function(_0x4c9590){if(_0x4c9590){_0x4c9590[_0xc667('0x16')]({'lastMsgAt':_0x1379b7[_0xc667('0x17')],'lastMsgDirection':_0x1379b7[_0xc667('0xf')][_0xc667('0x18')]()});}})[_0xc667('0x19')](function(_0xac4515){console[_0xc667('0x1a')](_0xac4515);});}_0x577b44();}},'charset':'utf8mb4','collate':_0xc667('0x1b')});}; \ No newline at end of file +var _0xcfa3=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcfa3,0x10a));var _0x3cfa=function(_0x42de63,_0x246b7f){_0x42de63=_0x42de63-0x0;var _0x3cb936=_0xcfa3[_0x42de63];return _0x3cb936;};'use strict';var _=require(_0x3cfa('0x0'));var util=require(_0x3cfa('0x1'));var logger=require(_0x3cfa('0x2'))(_0x3cfa('0x3'));var moment=require(_0x3cfa('0x4'));var BPromise=require(_0x3cfa('0x5'));var rp=require(_0x3cfa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cfa('0x7'));var config=require(_0x3cfa('0x8'));var attributes=require('./faxMessage.attributes');module[_0x3cfa('0x9')]=function(_0x6ae714,_0x425c94){return _0x6ae714['define']('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x3cfa('0xa'),'fields':['body'],'type':_0x3cfa('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bf79c,_0x57c6fd,_0x5584c4){var _0x36f38c=_0x6ae714[_0x3cfa('0xc')];var _0x504998=_0x1bf79c[_0x3cfa('0xd')]({'plain':!![]});if(_0x504998[_0x3cfa('0xe')][_0x3cfa('0xf')]()==='in'||_0x504998['direction'][_0x3cfa('0xf')]()===_0x3cfa('0x10')&&!_0x504998['secret']&&!_[_0x3cfa('0x11')](_0x504998[_0x3cfa('0x12')])){_0x36f38c['FaxInteraction'][_0x3cfa('0x13')]({'where':{'id':_0x504998[_0x3cfa('0x14')]}})[_0x3cfa('0x15')](function(_0x4c9a74){if(_0x4c9a74){_0x4c9a74[_0x3cfa('0x16')]({'lastMsgAt':_0x504998[_0x3cfa('0x17')],'lastMsgDirection':_0x504998['direction']['toLowerCase']()});}})['catch'](function(_0x4c4b80){console[_0x3cfa('0x18')](_0x4c4b80);});}_0x5584c4();}},'charset':_0x3cfa('0x19'),'collate':_0x3cfa('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 33bc9e5..14eae76 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 _0x922a=['defaults','localhost','socket.io-emitter','request','then','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','redis'];(function(_0x2f87cc,_0x133b96){var _0x257c39=function(_0x42c7ae){while(--_0x42c7ae){_0x2f87cc['push'](_0x2f87cc['shift']());}};_0x257c39(++_0x133b96);}(_0x922a,0x13a));var _0xa922=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x922a[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xa922('0x0'));var util=require('util');var moment=require(_0xa922('0x1'));var BPromise=require(_0xa922('0x2'));var rs=require(_0xa922('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa922('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa922('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa922('0x6'));var client=jayson[_0xa922('0x7')][_0xa922('0x8')]({'port':0x232a});config[_0xa922('0x9')]=_[_0xa922('0xa')](config[_0xa922('0x9')],{'host':_0xa922('0xb'),'port':0x18eb});var socket=require(_0xa922('0xc'))(new Redis(config[_0xa922('0x9')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2d6d00,_0x2d8198,_0x36afa5){return new BPromise(function(_0x26e7f9,_0x2b16f9){return client[_0xa922('0xd')](_0x2d6d00,_0x36afa5)[_0xa922('0xe')](function(_0x10e6d4){logger[_0xa922('0xf')]('FaxMessage,\x20%s,\x20%s',_0x2d8198,'request\x20sent');logger[_0xa922('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2d8198,_0xa922('0x11'),JSON[_0xa922('0x12')](_0x10e6d4));if(_0x10e6d4[_0xa922('0x13')]){if(_0x10e6d4[_0xa922('0x13')][_0xa922('0x14')]===0x1f4){logger[_0xa922('0x13')](_0xa922('0x15'),_0x2d8198,_0x10e6d4[_0xa922('0x13')]['message']);return _0x2b16f9(_0x10e6d4[_0xa922('0x13')][_0xa922('0x16')]);}logger[_0xa922('0x13')]('FaxMessage,\x20%s,\x20%s',_0x2d8198,_0x10e6d4[_0xa922('0x13')][_0xa922('0x16')]);return _0x26e7f9(_0x10e6d4[_0xa922('0x13')][_0xa922('0x16')]);}else{logger[_0xa922('0xf')](_0xa922('0x15'),_0x2d8198,_0xa922('0x11'));_0x26e7f9(_0x10e6d4[_0xa922('0x17')][_0xa922('0x16')]);}})[_0xa922('0x18')](function(_0x3bb343){logger['error'](_0xa922('0x15'),_0x2d8198,_0x3bb343);_0x2b16f9(_0x3bb343);});});}exports['CreateFaxMessage']=function(_0x4f42c8){var _0xb107ee=this;return new Promise(function(_0x4be75c,_0x3bab89){return db[_0xa922('0x19')][_0xa922('0x1a')](_0x4f42c8[_0xa922('0x1b')],{'raw':_0x4f42c8[_0xa922('0x1c')]?_0x4f42c8[_0xa922('0x1c')][_0xa922('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x35e851){logger[_0xa922('0xf')](_0xa922('0x1e'),_0x4f42c8);logger[_0xa922('0x10')](_0xa922('0x1e'),_0x4f42c8,JSON['stringify'](_0x35e851));_0x4be75c(_0x35e851);})[_0xa922('0x18')](function(_0x5d1524){logger[_0xa922('0x13')](_0xa922('0x1e'),_0x5d1524[_0xa922('0x16')],_0x4f42c8);_0x3bab89(_0xb107ee['error'](0x1f4,_0x5d1524[_0xa922('0x16')]));});});};exports[_0xa922('0x1f')]=function(_0x15c3d1){var _0x6ba310=this;return new Promise(function(_0x5df84f,_0x3f249b){return db['FaxMessage'][_0xa922('0x20')](_0x15c3d1[_0xa922('0x1b')],{'raw':_0x15c3d1[_0xa922('0x1c')]?_0x15c3d1[_0xa922('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15c3d1[_0xa922('0x1c')]?_0x15c3d1[_0xa922('0x1c')][_0xa922('0x21')]||null:null,'attributes':_0x15c3d1[_0xa922('0x1c')]?_0x15c3d1[_0xa922('0x1c')][_0xa922('0x22')]||null:null,'limit':_0x15c3d1['options']?_0x15c3d1['options'][_0xa922('0x23')]||null:null})['then'](function(_0x1ee659){logger[_0xa922('0xf')](_0xa922('0x1f'),_0x15c3d1);logger[_0xa922('0x10')](_0xa922('0x1f'),_0x15c3d1,JSON[_0xa922('0x12')](_0x1ee659));_0x5df84f(_0x1ee659);})['catch'](function(_0x294913){logger[_0xa922('0x13')](_0xa922('0x1f'),_0x294913[_0xa922('0x16')],_0x15c3d1);_0x3f249b(_0x6ba310[_0xa922('0x13')](0x1f4,_0x294913[_0xa922('0x16')]));});});}; \ No newline at end of file +var _0x6ea0=['debug','UpdateFaxMessage','FaxMessage','update','where','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','create','body','options','raw','CreateFaxMessage'];(function(_0x564352,_0x4d23ad){var _0x5d7f4b=function(_0x169e4c){while(--_0x169e4c){_0x564352['push'](_0x564352['shift']());}};_0x5d7f4b(++_0x4d23ad);}(_0x6ea0,0x1e7));var _0x06ea=function(_0x1429a9,_0x48bca8){_0x1429a9=_0x1429a9-0x0;var _0x2aac84=_0x6ea0[_0x1429a9];return _0x2aac84;};'use strict';var _=require(_0x06ea('0x0'));var util=require(_0x06ea('0x1'));var moment=require('moment');var BPromise=require(_0x06ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06ea('0x3'));var db=require(_0x06ea('0x4'))['db'];var utils=require(_0x06ea('0x5'));var logger=require(_0x06ea('0x6'))(_0x06ea('0x7'));var config=require(_0x06ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06ea('0x9')][_0x06ea('0xa')]({'port':0x232a});config['redis']=_[_0x06ea('0xb')](config[_0x06ea('0xc')],{'host':_0x06ea('0xd'),'port':0x18eb});var socket=require(_0x06ea('0xe'))(new Redis(config[_0x06ea('0xc')]));require('./faxMessage.socket')[_0x06ea('0xf')](socket);function respondWithRpcPromise(_0x44fb60,_0x25f09a,_0x22948e){return new BPromise(function(_0x479f4f,_0x2322ad){return client['request'](_0x44fb60,_0x22948e)[_0x06ea('0x10')](function(_0x52e300){logger['info'](_0x06ea('0x11'),_0x25f09a,'request\x20sent');logger['debug'](_0x06ea('0x12'),_0x25f09a,_0x06ea('0x13'),JSON[_0x06ea('0x14')](_0x52e300));if(_0x52e300[_0x06ea('0x15')]){if(_0x52e300[_0x06ea('0x15')][_0x06ea('0x16')]===0x1f4){logger[_0x06ea('0x15')](_0x06ea('0x11'),_0x25f09a,_0x52e300[_0x06ea('0x15')]['message']);return _0x2322ad(_0x52e300[_0x06ea('0x15')]['message']);}logger[_0x06ea('0x15')](_0x06ea('0x11'),_0x25f09a,_0x52e300['error'][_0x06ea('0x17')]);return _0x479f4f(_0x52e300[_0x06ea('0x15')]['message']);}else{logger[_0x06ea('0x18')]('FaxMessage,\x20%s,\x20%s',_0x25f09a,_0x06ea('0x13'));_0x479f4f(_0x52e300['result']['message']);}})[_0x06ea('0x19')](function(_0x3b7727){logger[_0x06ea('0x15')](_0x06ea('0x11'),_0x25f09a,_0x3b7727);_0x2322ad(_0x3b7727);});});}exports['CreateFaxMessage']=function(_0x238708){var _0x1f3acd=this;return new Promise(function(_0x43a39a,_0x3b73ed){return db['FaxMessage'][_0x06ea('0x1a')](_0x238708[_0x06ea('0x1b')],{'raw':_0x238708[_0x06ea('0x1c')]?_0x238708[_0x06ea('0x1c')][_0x06ea('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x359bbf){logger[_0x06ea('0x18')](_0x06ea('0x1e'),_0x238708);logger[_0x06ea('0x1f')](_0x06ea('0x1e'),_0x238708,JSON[_0x06ea('0x14')](_0x359bbf));_0x43a39a(_0x359bbf);})[_0x06ea('0x19')](function(_0x49a477){logger[_0x06ea('0x15')](_0x06ea('0x1e'),_0x49a477['message'],_0x238708);_0x3b73ed(_0x1f3acd[_0x06ea('0x15')](0x1f4,_0x49a477[_0x06ea('0x17')]));});});};exports[_0x06ea('0x20')]=function(_0x22f02f){var _0x3e4219=this;return new Promise(function(_0x1adb1e,_0x4fec06){return db[_0x06ea('0x21')][_0x06ea('0x22')](_0x22f02f[_0x06ea('0x1b')],{'raw':_0x22f02f[_0x06ea('0x1c')]?_0x22f02f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22f02f['options']?_0x22f02f['options'][_0x06ea('0x23')]||null:null,'attributes':_0x22f02f[_0x06ea('0x1c')]?_0x22f02f[_0x06ea('0x1c')][_0x06ea('0x24')]||null:null,'limit':_0x22f02f['options']?_0x22f02f[_0x06ea('0x1c')]['limit']||null:null})[_0x06ea('0x10')](function(_0xbc5165){logger[_0x06ea('0x18')](_0x06ea('0x20'),_0x22f02f);logger[_0x06ea('0x1f')](_0x06ea('0x20'),_0x22f02f,JSON[_0x06ea('0x14')](_0xbc5165));_0x1adb1e(_0xbc5165);})['catch'](function(_0x5432ef){logger[_0x06ea('0x15')](_0x06ea('0x20'),_0x5432ef[_0x06ea('0x17')],_0x22f02f);_0x4fec06(_0x3e4219[_0x06ea('0x15')](0x1f4,_0x5432ef['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 07b9548..aba3b84 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 9da6e51..087d705 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 _0x7427=['show','/:id/download','post','fax','put','update','accept','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2a92e6,_0x1cb374){var _0x3f0dfe=function(_0x3fcd15){while(--_0x3fcd15){_0x2a92e6['push'](_0x2a92e6['shift']());}};_0x3f0dfe(++_0x1cb374);}(_0x7427,0x111));var _0x7742=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x7427[_0x4a599b];return _0x2d53d3;};'use strict';var multer=require(_0x7742('0x0'));var util=require(_0x7742('0x1'));var path=require(_0x7742('0x2'));var timeout=require(_0x7742('0x3'));var express=require('express');var router=express[_0x7742('0x4')]();var auth=require(_0x7742('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7742('0x6'));var controller=require(_0x7742('0x7'));router[_0x7742('0x8')]('/',auth[_0x7742('0x9')](),controller[_0x7742('0xa')]);router['get']('/describe',auth[_0x7742('0x9')](),controller[_0x7742('0xb')]);router[_0x7742('0x8')](_0x7742('0xc'),auth[_0x7742('0x9')](),controller[_0x7742('0xd')]);router[_0x7742('0x8')](_0x7742('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x7742('0xf')]('/',auth[_0x7742('0x9')](),interaction['tracked'](_0x7742('0x10'),'faxmessage:create'),controller['create']);router[_0x7742('0x11')](_0x7742('0xc'),auth['isAuthenticated'](),controller[_0x7742('0x12')]);router[_0x7742('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x7742('0x13')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x7742('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7742('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd5fe=['destroy','exports','multer','util','connect-timeout','Router','../../config/environment','./faxMessage.controller','index','get','/describe','isAuthenticated','describe','download','tracked','fax','faxmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x4f192b,_0xc909cf){var _0x2d5f3e=function(_0x177708){while(--_0x177708){_0x4f192b['push'](_0x4f192b['shift']());}};_0x2d5f3e(++_0xc909cf);}(_0xd5fe,0x1ab));var _0xed5f=function(_0x4360c4,_0x2f8209){_0x4360c4=_0x4360c4-0x0;var _0x3168c8=_0xd5fe[_0x4360c4];return _0x3168c8;};'use strict';var multer=require(_0xed5f('0x0'));var util=require(_0xed5f('0x1'));var path=require('path');var timeout=require(_0xed5f('0x2'));var express=require('express');var router=express[_0xed5f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed5f('0x4'));var controller=require(_0xed5f('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xed5f('0x6')]);router[_0xed5f('0x7')](_0xed5f('0x8'),auth[_0xed5f('0x9')](),controller[_0xed5f('0xa')]);router[_0xed5f('0x7')]('/:id',auth[_0xed5f('0x9')](),controller['show']);router[_0xed5f('0x7')]('/:id/download',auth[_0xed5f('0x9')](),controller[_0xed5f('0xb')]);router['post']('/',auth[_0xed5f('0x9')](),interaction[_0xed5f('0xc')](_0xed5f('0xd'),_0xed5f('0xe')),controller['create']);router[_0xed5f('0xf')](_0xed5f('0x10'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x11')]);router['put'](_0xed5f('0x12'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x13')]);router[_0xed5f('0xf')](_0xed5f('0x14'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x15')]);router[_0xed5f('0x16')](_0xed5f('0x10'),auth[_0xed5f('0x9')](),controller[_0xed5f('0x17')]);module[_0xed5f('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1a255d5..a8fc4ba 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 _0xa1b9=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x5cb962,_0xb4634d){var _0x41a789=function(_0x310936){while(--_0x310936){_0x5cb962['push'](_0x5cb962['shift']());}};_0x41a789(++_0xb4634d);}(_0xa1b9,0x71));var _0x9a1b=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa1b9[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x9a1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a1b('0x1')],'unique':_0x9a1b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a1b('0x1')]},'timeout':{'type':Sequelize[_0x9a1b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a1b('0x4')](_0x9a1b('0x5'),_0x9a1b('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9a1b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xebb1=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xebb1,0x1d8));var _0x1ebb=function(_0x2e577e,_0x4e117a){_0x2e577e=_0x2e577e-0x0;var _0x3be25c=_0xebb1[_0x2e577e];return _0x3be25c;};'use strict';var Sequelize=require(_0x1ebb('0x0'));module[_0x1ebb('0x1')]={'name':{'type':Sequelize[_0x1ebb('0x2')],'unique':_0x1ebb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1ebb('0x4')](_0x1ebb('0x5'),'beepall',_0x1ebb('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 59df5a3..b21f677 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 _0xece1=['userFaxQueue:remove','addAgents','spread','userFaxQueue:save','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','count','offset','limit','update','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','rawAttributes','length','includeAll','options','find','user','role','UserProfileSection','userProfileId','body','describe','getMembers','findOne','UserFaxQueue','nolimit','sort','FaxQueueId','findAll','User','findAndCountAll','UserId','faxPause','updatedAt','format','getTeams','Team','addTeams','ids','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xece1,0x8a));var _0x1ece=function(_0x41d364,_0xdfdc1a){_0x41d364=_0x41d364-0x0;var _0x5ace98=_0xece1[_0x41d364];return _0x5ace98;};'use strict';var pdf=require(_0x1ece('0x0'));var emlformat=require(_0x1ece('0x1'));var rimraf=require(_0x1ece('0x2'));var zipdir=require(_0x1ece('0x3'));var jsonpatch=require(_0x1ece('0x4'));var rp=require(_0x1ece('0x5'));var moment=require(_0x1ece('0x6'));var BPromise=require(_0x1ece('0x7'));var Mustache=require(_0x1ece('0x8'));var util=require(_0x1ece('0x9'));var path=require(_0x1ece('0xa'));var sox=require(_0x1ece('0xb'));var csv=require(_0x1ece('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ece('0xd'));var squel=require(_0x1ece('0xe'));var crypto=require('crypto');var jsforce=require(_0x1ece('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1ece('0xc'));var querystring=require(_0x1ece('0x10'));var Papa=require(_0x1ece('0x11'));var Redis=require('ioredis');var authService=require(_0x1ece('0x12'));var qs=require(_0x1ece('0x13'));var as=require(_0x1ece('0x14'));var hardwareService=require(_0x1ece('0x15'));var logger=require(_0x1ece('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1ece('0x17'));var licenseUtil=require(_0x1ece('0x18'));var db=require(_0x1ece('0x19'))['db'];config[_0x1ece('0x1a')]=_[_0x1ece('0x1b')](config[_0x1ece('0x1a')],{'host':_0x1ece('0x1c'),'port':0x18eb});var socket=require(_0x1ece('0x1d'))(new Redis(config[_0x1ece('0x1a')]));require(_0x1ece('0x1e'))[_0x1ece('0x1f')](socket);function respondWithStatusCode(_0x215721,_0x4c5355){_0x4c5355=_0x4c5355||0xcc;return function(_0x49b6fb){if(_0x49b6fb){return _0x215721[_0x1ece('0x20')](_0x4c5355);}return _0x215721['status'](_0x4c5355)[_0x1ece('0x21')]();};}function respondWithResult(_0x2dd7b4,_0x1bef40){_0x1bef40=_0x1bef40||0xc8;return function(_0x201feb){if(_0x201feb){return _0x2dd7b4[_0x1ece('0x22')](_0x1bef40)[_0x1ece('0x23')](_0x201feb);}};}function respondWithFilteredResult(_0x4b6e5a,_0x2393e9){return function(_0x4d46fc){if(_0x4d46fc){var _0x11d0c5=_0x4d46fc[_0x1ece('0x24')],_0x34e9ba=_0x2393e9['offset'],_0x86367=_0x2393e9[_0x1ece('0x25')]+_0x2393e9[_0x1ece('0x26')],_0x10d222;if(_0x86367>=_0x11d0c5){_0x86367=_0x11d0c5;_0x10d222=0xc8;}else{_0x10d222=0xce;}_0x4b6e5a[_0x1ece('0x22')](_0x10d222);return _0x4b6e5a['set']('Content-Range',_0x34e9ba+'-'+_0x86367+'/'+_0x11d0c5)[_0x1ece('0x23')](_0x4d46fc);}return null;};}function patchUpdates(_0x28641d){return function(_0xce3fd5){try{jsonpatch['apply'](_0xce3fd5,_0x28641d,!![]);}catch(_0x1a695b){return BPromise['reject'](_0x1a695b);}return _0xce3fd5['save']();};}function saveUpdates(_0x1f7584,_0x444d5b){return function(_0x1bea02){if(_0x1bea02){return _0x1bea02[_0x1ece('0x27')](_0x1f7584)['then'](function(_0x7190a0){return _0x7190a0;});}return null;};}function removeEntity(_0xec3ebf,_0x2eefe0){return function(_0x1004d6){if(_0x1004d6){return _0x1004d6[_0x1ece('0x28')]()[_0x1ece('0x29')](function(){var _0x32ea00=_0x1004d6[_0x1ece('0x2a')]({'plain':!![]});var _0x26d477=_0x1ece('0x2b');return db[_0x1ece('0x2c')][_0x1ece('0x28')]({'where':{'type':_0x26d477,'resourceId':_0x32ea00['id']}})[_0x1ece('0x29')](function(){return _0x1004d6;});})[_0x1ece('0x29')](function(){_0xec3ebf[_0x1ece('0x22')](0xcc)[_0x1ece('0x21')]();});}};}function handleEntityNotFound(_0x3cbe93,_0x271bfa){return function(_0x1f3b57){if(!_0x1f3b57){_0x3cbe93[_0x1ece('0x20')](0x194);}return _0x1f3b57;};}function handleError(_0x1a6844,_0x397713){_0x397713=_0x397713||0x1f4;return function(_0x52f86a){logger[_0x1ece('0x2d')](_0x52f86a[_0x1ece('0x2e')]);if(_0x52f86a[_0x1ece('0x2f')]){delete _0x52f86a[_0x1ece('0x2f')];}_0x1a6844['status'](_0x397713)[_0x1ece('0x30')](_0x52f86a);};}exports[_0x1ece('0x31')]=function(_0x388c8b,_0x47261f){var _0x24ef47={},_0x382dae={},_0x198521={'count':0x0,'rows':[]};var _0x3bb310=_[_0x1ece('0x32')](db[_0x1ece('0x33')]['rawAttributes'],function(_0x3aa227){return{'name':_0x3aa227['fieldName'],'type':_0x3aa227[_0x1ece('0x34')]['key']};});_0x382dae[_0x1ece('0x35')]=_[_0x1ece('0x32')](_0x3bb310,'name');_0x382dae[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x388c8b['query']);_0x382dae[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x382dae[_0x1ece('0x35')],_0x382dae[_0x1ece('0x36')]);_0x24ef47[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x382dae[_0x1ece('0x35')],qs[_0x1ece('0x3b')](_0x388c8b[_0x1ece('0x36')]['fields']));_0x24ef47['attributes']=_0x24ef47[_0x1ece('0x3a')]['length']?_0x24ef47[_0x1ece('0x3a')]:_0x382dae[_0x1ece('0x35')];if(!_0x388c8b[_0x1ece('0x36')][_0x1ece('0x3c')]('nolimit')){_0x24ef47[_0x1ece('0x26')]=qs[_0x1ece('0x26')](_0x388c8b['query'][_0x1ece('0x26')]);_0x24ef47[_0x1ece('0x25')]=qs['offset'](_0x388c8b[_0x1ece('0x36')][_0x1ece('0x25')]);}_0x24ef47[_0x1ece('0x3d')]=qs['sort'](_0x388c8b[_0x1ece('0x36')]['sort']);_0x24ef47[_0x1ece('0x3e')]=qs[_0x1ece('0x38')](_[_0x1ece('0x3f')](_0x388c8b['query'],_0x382dae['filters']),_0x3bb310);if(_0x388c8b[_0x1ece('0x36')][_0x1ece('0x40')]){_0x24ef47[_0x1ece('0x3e')]=_[_0x1ece('0x41')](_0x24ef47['where'],{'$or':_[_0x1ece('0x32')](_0x3bb310,function(_0x365751){if(_0x365751[_0x1ece('0x34')]!==_0x1ece('0x42')){var _0x407604={};_0x407604[_0x365751[_0x1ece('0x2f')]]={'$like':'%'+_0x388c8b[_0x1ece('0x36')][_0x1ece('0x40')]+'%'};return _0x407604;}})});}_0x24ef47=_[_0x1ece('0x41')]({},_0x24ef47,_0x388c8b['options']);var _0x4475e4={'where':_0x24ef47[_0x1ece('0x3e')]};return db[_0x1ece('0x33')][_0x1ece('0x24')](_0x4475e4)['then'](function(_0x4a6b27){_0x198521[_0x1ece('0x24')]=_0x4a6b27;if(_0x388c8b[_0x1ece('0x36')]['includeAll']){_0x24ef47[_0x1ece('0x43')]=[{'all':!![]}];}return db[_0x1ece('0x33')]['findAll'](_0x24ef47);})['then'](function(_0x1e50b3){_0x198521[_0x1ece('0x44')]=_0x1e50b3;return _0x198521;})[_0x1ece('0x29')](respondWithFilteredResult(_0x47261f,_0x24ef47))[_0x1ece('0x45')](handleError(_0x47261f,null));};exports[_0x1ece('0x46')]=function(_0x439b06,_0x142b26){var _0x28ab8e={'raw':!![],'where':{'id':_0x439b06[_0x1ece('0x47')]['id']}},_0x9a2768={};_0x9a2768[_0x1ece('0x35')]=_[_0x1ece('0x37')](db[_0x1ece('0x33')][_0x1ece('0x48')]);_0x9a2768[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x439b06['query']);_0x9a2768[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x9a2768[_0x1ece('0x35')],_0x9a2768[_0x1ece('0x36')]);_0x28ab8e[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x9a2768[_0x1ece('0x35')],qs[_0x1ece('0x3b')](_0x439b06[_0x1ece('0x36')][_0x1ece('0x3b')]));_0x28ab8e[_0x1ece('0x3a')]=_0x28ab8e[_0x1ece('0x3a')][_0x1ece('0x49')]?_0x28ab8e[_0x1ece('0x3a')]:_0x9a2768[_0x1ece('0x35')];if(_0x439b06[_0x1ece('0x36')][_0x1ece('0x4a')]){_0x28ab8e['include']=[{'all':!![]}];}_0x28ab8e=_[_0x1ece('0x41')]({},_0x28ab8e,_0x439b06[_0x1ece('0x4b')]);return db[_0x1ece('0x33')][_0x1ece('0x4c')](_0x28ab8e)[_0x1ece('0x29')](handleEntityNotFound(_0x142b26,null))[_0x1ece('0x29')](respondWithResult(_0x142b26,null))[_0x1ece('0x45')](handleError(_0x142b26,null));};exports['create']=function(_0x2f4412,_0x21114e){return db[_0x1ece('0x33')]['create'](_0x2f4412['body'],{})[_0x1ece('0x29')](function(_0x5e001d){var _0x14401c=_0x2f4412[_0x1ece('0x4d')][_0x1ece('0x2a')]({'plain':!![]});if(!_0x14401c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14401c[_0x1ece('0x4e')]==='user'){var _0x1bcf82=_0x5e001d[_0x1ece('0x2a')]({'plain':!![]});var _0x20c4c1='FaxQueues';return db[_0x1ece('0x4f')][_0x1ece('0x4c')]({'where':{'name':_0x20c4c1,'userProfileId':_0x14401c[_0x1ece('0x50')]},'raw':!![]})[_0x1ece('0x29')](function(_0x3e1bed){if(_0x3e1bed&&_0x3e1bed['autoAssociation']===0x0){return db[_0x1ece('0x2c')]['create']({'name':_0x1bcf82[_0x1ece('0x2f')],'resourceId':_0x1bcf82['id'],'type':_0x3e1bed[_0x1ece('0x2f')],'sectionId':_0x3e1bed['id']},{})[_0x1ece('0x29')](function(){return _0x5e001d;});}else{return _0x5e001d;}})[_0x1ece('0x45')](function(_0x1a6775){logger[_0x1ece('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a6775);throw _0x1a6775;});}return _0x5e001d;})[_0x1ece('0x29')](respondWithResult(_0x21114e,0xc9))[_0x1ece('0x45')](handleError(_0x21114e,null));};exports['update']=function(_0x3c0053,_0x336c7b){if(_0x3c0053['body']['id']){delete _0x3c0053[_0x1ece('0x51')]['id'];}return db[_0x1ece('0x33')][_0x1ece('0x4c')]({'where':{'id':_0x3c0053['params']['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x336c7b,null))['then'](saveUpdates(_0x3c0053['body'],null))['then'](respondWithResult(_0x336c7b,null))['catch'](handleError(_0x336c7b,null));};exports[_0x1ece('0x28')]=function(_0x4afbd1,_0x1b6491){return db['FaxQueue']['find']({'where':{'id':_0x4afbd1['params']['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x1b6491,null))['then'](removeEntity(_0x1b6491,null))[_0x1ece('0x45')](handleError(_0x1b6491,null));};exports[_0x1ece('0x52')]=function(_0xf422bf,_0x2a76fa){return db[_0x1ece('0x33')]['describe']()['then'](respondWithResult(_0x2a76fa,null))[_0x1ece('0x45')](handleError(_0x2a76fa,null));};exports[_0x1ece('0x53')]=function(_0x54bf5c,_0xc555fc,_0x19ecd0){var _0x20a2d6={'raw':!![],'where':{}},_0x2737bd={},_0x14964f;return db[_0x1ece('0x33')][_0x1ece('0x54')]({'where':{'id':_0x54bf5c[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0xc555fc,null))[_0x1ece('0x29')](function(_0x496304){if(_0x496304){_0x14964f=_0x496304[_0x1ece('0x2a')]({'plain':!![]});_0x2737bd['model']=_[_0x1ece('0x37')](db[_0x1ece('0x55')][_0x1ece('0x48')]);_0x2737bd[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x54bf5c['query']);_0x2737bd[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x2737bd['model'],_0x2737bd[_0x1ece('0x36')]);_0x20a2d6[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x2737bd['model'],qs[_0x1ece('0x3b')](_0x54bf5c['query'][_0x1ece('0x3b')]));_0x20a2d6[_0x1ece('0x3a')]=_0x20a2d6[_0x1ece('0x3a')][_0x1ece('0x49')]?_0x20a2d6['attributes']:_0x2737bd[_0x1ece('0x35')];if(!_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x3c')](_0x1ece('0x56'))){_0x20a2d6['limit']=qs[_0x1ece('0x26')](_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x26')]);_0x20a2d6[_0x1ece('0x25')]=qs['offset'](_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x25')]);}_0x20a2d6['order']=qs['sort'](_0x54bf5c['query'][_0x1ece('0x57')]);_0x20a2d6[_0x1ece('0x3e')]=qs[_0x1ece('0x38')](_[_0x1ece('0x3f')](_0x54bf5c[_0x1ece('0x36')],_0x2737bd[_0x1ece('0x38')]));_0x20a2d6['where'][_0x1ece('0x58')]=_0x496304['id'];if(_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x40')]){_0x20a2d6[_0x1ece('0x3e')]=_[_0x1ece('0x41')](_0x20a2d6[_0x1ece('0x3e')],{'$or':_[_0x1ece('0x32')](_0x20a2d6[_0x1ece('0x3a')],function(_0x25b952){var _0x3e386e={};_0x3e386e[_0x25b952]={'$like':'%'+_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x40')]+'%'};return _0x3e386e;})});}_0x20a2d6=_[_0x1ece('0x41')]({},_0x20a2d6,_0x54bf5c[_0x1ece('0x4b')]);return db['UserFaxQueue'][_0x1ece('0x59')](_0x20a2d6);}})['then'](function(_0x1b249a){if(_0x1b249a){return db[_0x1ece('0x5a')][_0x1ece('0x5b')]({'where':{'id':_[_0x1ece('0x32')](_0x1b249a,_0x1ece('0x5c')),'role':'agent'},'attributes':['id','name',_0x1ece('0x5d'),_0x1ece('0x5e'),'createdAt']});}})['then'](function(_0x5bde23){if(_0x5bde23){return{'count':_0x5bde23[_0x1ece('0x24')],'rows':_['map'](_0x5bde23[_0x1ece('0x44')],function(_0x1d58e5){return{'membername':_0x1d58e5[_0x1ece('0x2f')],'UserId':_0x1d58e5['id'],'queue_name':_0x14964f[_0x1ece('0x2f')],'FaxQueueId':_0x14964f['id'],'interface':util[_0x1ece('0x5f')]('%s/%s','SIP',_0x1d58e5['name']),'penalty':0x0,'paused':_0x1d58e5['faxPause'],'createdAt':_0x1d58e5['createdAt'],'updatedAt':_0x1d58e5[_0x1ece('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1ece('0x29')](respondWithFilteredResult(_0xc555fc,_0x20a2d6))[_0x1ece('0x45')](handleError(_0xc555fc,null));};exports[_0x1ece('0x60')]=function(_0x14e35e,_0x333de7,_0xe5a9c2){var _0x2b8a8b={};var _0x3f463c={};var _0x2135ea;var _0xf2a7ed;return db[_0x1ece('0x33')][_0x1ece('0x54')]({'where':{'id':_0x14e35e[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x333de7,null))['then'](function(_0x261b63){if(_0x261b63){_0x2135ea=_0x261b63;_0x3f463c[_0x1ece('0x35')]=_['keys'](db[_0x1ece('0x61')][_0x1ece('0x48')]);_0x3f463c[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x14e35e['query']);_0x3f463c[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x3f463c[_0x1ece('0x35')],_0x3f463c['query']);_0x2b8a8b[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x3f463c['model'],qs[_0x1ece('0x3b')](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x3b')]));_0x2b8a8b[_0x1ece('0x3a')]=_0x2b8a8b[_0x1ece('0x3a')][_0x1ece('0x49')]?_0x2b8a8b['attributes']:_0x3f463c['model'];_0x2b8a8b[_0x1ece('0x3d')]=qs[_0x1ece('0x57')](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x57')]);_0x2b8a8b['where']=qs[_0x1ece('0x38')](_['pick'](_0x14e35e[_0x1ece('0x36')],_0x3f463c[_0x1ece('0x38')]));if(_0x14e35e[_0x1ece('0x36')][_0x1ece('0x40')]){_0x2b8a8b[_0x1ece('0x3e')]=_['merge'](_0x2b8a8b['where'],{'$or':_['map'](_0x2b8a8b[_0x1ece('0x3a')],function(_0x289ce1){var _0x388d3d={};_0x388d3d[_0x289ce1]={'$like':'%'+_0x14e35e[_0x1ece('0x36')]['filter']+'%'};return _0x388d3d;})});}_0x2b8a8b=_['merge']({},_0x2b8a8b,_0x14e35e[_0x1ece('0x4b')]);return _0x2135ea[_0x1ece('0x60')](_0x2b8a8b);}})['then'](function(_0x3931c7){if(_0x3931c7){_0xf2a7ed=_0x3931c7[_0x1ece('0x49')];if(!_0x14e35e[_0x1ece('0x36')][_0x1ece('0x3c')]('nolimit')){_0x2b8a8b[_0x1ece('0x26')]=qs['limit'](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x26')]);_0x2b8a8b['offset']=qs['offset'](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x25')]);}return _0x2135ea['getTeams'](_0x2b8a8b);}})[_0x1ece('0x29')](function(_0x252df6){if(_0x252df6){return _0x252df6?{'count':_0xf2a7ed,'rows':_0x252df6}:null;}})[_0x1ece('0x29')](respondWithResult(_0x333de7,null))[_0x1ece('0x45')](handleError(_0x333de7,null));};exports[_0x1ece('0x62')]=function(_0x4b2561,_0x380a63,_0x2a55ff){var _0x2fa9b8=_0x4b2561[_0x1ece('0x51')][_0x1ece('0x63')];return db[_0x1ece('0x61')][_0x1ece('0x59')]({'where':{'id':_0x2fa9b8},'attributes':['id'],'include':[{'model':db[_0x1ece('0x5a')],'as':'Agents','attributes':['id',_0x1ece('0x2f'),'online',_0x1ece('0x64'),_0x1ece('0x65')],'raw':!![]}]})['then'](function(_0x1717e0){if(_0x1717e0){var _0x5c71a2=_['flatMap'](_0x1717e0,function(_0x5cc5e2){var _0x3bb765=_0x5cc5e2[_0x1ece('0x2a')]({'plain':!![]});return _0x3bb765[_0x1ece('0x66')];});return db[_0x1ece('0x33')][_0x1ece('0x4c')]({'where':{'id':_0x4b2561[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](function(_0x501a47){return db[_0x1ece('0x67')][_0x1ece('0x68')](function(_0x35b29f){return _0x501a47[_0x1ece('0x62')](_0x2fa9b8,{'transaction':_0x35b29f})[_0x1ece('0x29')](function(){return BPromise[_0x1ece('0x69')](_0x5c71a2,function(_0xf93409){return db[_0x1ece('0x55')][_0x1ece('0x6a')]({'where':{'UserId':_0xf93409['id'],'FaxQueueId':_0x4b2561[_0x1ece('0x47')]['id']},'transaction':_0x35b29f});});})[_0x1ece('0x29')](function(){_0x5c71a2['forEach'](function(_0x4b345f){socket[_0x1ece('0x6b')]('userFaxQueue:save',{'UserId':_0x4b345f['id'],'FaxQueueId':_0x501a47['id']});});});});});}})[_0x1ece('0x29')](respondWithStatusCode(_0x380a63,null))[_0x1ece('0x45')](handleError(_0x380a63,null));};exports[_0x1ece('0x6c')]=function(_0x2f542d,_0x5ed5e0,_0xe36d48){return db[_0x1ece('0x61')][_0x1ece('0x59')]({'where':{'id':_0x2f542d[_0x1ece('0x36')][_0x1ece('0x63')]},'attributes':['id'],'include':[{'model':db[_0x1ece('0x5a')],'as':_0x1ece('0x66'),'attributes':['id'],'raw':!![]}]})[_0x1ece('0x29')](handleEntityNotFound(_0x5ed5e0,null))[_0x1ece('0x29')](function(_0x36dcd3){var _0x5d91d4=_[_0x1ece('0x32')](_0x36dcd3,'id');var _0x4667ff=[];var _0x306f42=[];var _0x2b6ca3=squel[_0x1ece('0x6d')]();_0x2b6ca3[_0x1ece('0x6e')]('tq.TeamId')[_0x1ece('0x6f')](_0x1ece('0x70'),'tq')['join'](_0x1ece('0x71'),'ut',_0x1ece('0x72'))['where'](_0x1ece('0x73'),_0x2f542d[_0x1ece('0x47')]['id']);for(var _0x2fe7aa=0x0;_0x2fe7aa<_0x36dcd3[_0x1ece('0x49')];_0x2fe7aa+=0x1){let _0x5b79d2=_0x36dcd3[_0x2fe7aa];for(var _0x5e9d12=0x0;_0x5e9d12<_0x5b79d2[_0x1ece('0x66')][_0x1ece('0x49')];_0x5e9d12+=0x1){let _0x496505=_0x5b79d2[_0x1ece('0x66')][_0x5e9d12];var _0x317544=_0x2b6ca3['clone']();_0x317544['where']('ut.UserId\x20=\x20?',_0x496505['id']);_0x306f42['push'](db[_0x1ece('0x67')][_0x1ece('0x36')](_0x317544[_0x1ece('0x74')](),{'type':db[_0x1ece('0x67')][_0x1ece('0x75')][_0x1ece('0x76')]})['then'](function(_0xf05c0f){if(_0xf05c0f[_0x1ece('0x49')]===0x1){return _0x496505['id'];}else{var _0x2f8c7b=_[_0x1ece('0x77')](_[_0x1ece('0x32')](_0xf05c0f,_0x1ece('0x78')),function(_0x1c6a4f){return _[_0x1ece('0x79')](_0x5d91d4,_0x1c6a4f);});if(_0x2f8c7b){return _0x496505['id'];}}}));}}return BPromise['all'](_0x306f42)['then'](function(_0x388e52){_0x4667ff=_(_0x4667ff)[_0x1ece('0x7a')](_0x388e52)[_0x1ece('0x7b')]()[_0x1ece('0x7c')]();return db['FaxQueue'][_0x1ece('0x4c')]({'where':{'id':_0x2f542d[_0x1ece('0x47')]['id']}})['then'](function(_0x2f29d4){return db[_0x1ece('0x67')][_0x1ece('0x68')](function(_0x401c53){return _0x2f29d4[_0x1ece('0x6c')](_0x2f542d[_0x1ece('0x36')][_0x1ece('0x63')],{'transaction':_0x401c53})[_0x1ece('0x29')](function(){if(!_[_0x1ece('0x7d')](_0x4667ff)){return _0x2f29d4[_0x1ece('0x7e')](_0x4667ff,{'transaction':_0x401c53});}})[_0x1ece('0x29')](function(){_0x4667ff[_0x1ece('0x7f')](function(_0x4cb3cf){socket[_0x1ece('0x6b')](_0x1ece('0x80'),{'UserId':_0x4cb3cf,'FaxQueueId':_0x2f29d4['id']});});});});});});})[_0x1ece('0x29')](respondWithStatusCode(_0x5ed5e0,null))[_0x1ece('0x45')](handleError(_0x5ed5e0,null));};exports[_0x1ece('0x81')]=function(_0x333f53,_0x331a4e,_0x4585b6){return db['FaxQueue'][_0x1ece('0x4c')]({'where':{'id':_0x333f53[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x331a4e,null))[_0x1ece('0x29')](function(_0x4534e9){if(_0x4534e9){return _0x4534e9[_0x1ece('0x81')](_0x333f53['body'][_0x1ece('0x63')],_['omit'](_0x333f53[_0x1ece('0x51')],[_0x1ece('0x63'),'id'])||{})[_0x1ece('0x82')](function(_0xe84df8){for(var _0x26f45c=0x0;_0x26f45c<_0x333f53[_0x1ece('0x51')][_0x1ece('0x63')][_0x1ece('0x49')];_0x26f45c+=0x1){socket['emit'](_0x1ece('0x83'),{'UserId':_0x333f53[_0x1ece('0x51')][_0x1ece('0x63')][_0x26f45c],'FaxQueueId':_0x333f53[_0x1ece('0x47')]['id']});}return _0xe84df8;});}})[_0x1ece('0x29')](respondWithResult(_0x331a4e,null))[_0x1ece('0x45')](handleError(_0x331a4e,null));};exports[_0x1ece('0x7e')]=function(_0x389369,_0x53c6dd,_0x7d314b){return db[_0x1ece('0x33')][_0x1ece('0x4c')]({'where':{'id':_0x389369['params']['id']}})['then'](handleEntityNotFound(_0x53c6dd,null))[_0x1ece('0x29')](function(_0x45b4a8){if(_0x45b4a8){return _0x45b4a8[_0x1ece('0x7e')](_0x389369[_0x1ece('0x36')]['ids'])[_0x1ece('0x29')](function(){if(_['isArray'](_0x389369[_0x1ece('0x36')]['ids'])){for(var _0x17f053=0x0;_0x17f053<_0x389369[_0x1ece('0x36')][_0x1ece('0x63')]['length'];_0x17f053+=0x1){socket[_0x1ece('0x6b')](_0x1ece('0x80'),{'UserId':Number(_0x389369[_0x1ece('0x36')][_0x1ece('0x63')][_0x17f053]),'FaxQueueId':Number(_0x389369[_0x1ece('0x47')]['id'])});}}else{socket[_0x1ece('0x6b')](_0x1ece('0x80'),{'UserId':Number(_0x389369[_0x1ece('0x36')][_0x1ece('0x63')]),'FaxQueueId':Number(_0x389369[_0x1ece('0x47')]['id'])});}});}})[_0x1ece('0x29')](respondWithStatusCode(_0x53c6dd,null))[_0x1ece('0x45')](handleError(_0x53c6dd,null));};exports[_0x1ece('0x84')]=function(_0x32e6bb,_0x299f0f,_0xdf3ffc){var _0x276bae={};var _0x137e2d={};var _0x590189;var _0xa81bf6;return db[_0x1ece('0x33')][_0x1ece('0x54')]({'where':{'id':_0x32e6bb[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x299f0f,null))['then'](function(_0x57a7de){if(_0x57a7de){_0x590189=_0x57a7de;_0x137e2d[_0x1ece('0x35')]=_['keys'](db[_0x1ece('0x5a')][_0x1ece('0x48')]);_0x137e2d[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x32e6bb[_0x1ece('0x36')]);_0x137e2d[_0x1ece('0x38')]=_['intersection'](_0x137e2d['model'],_0x137e2d['query']);_0x276bae[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x137e2d[_0x1ece('0x35')],qs[_0x1ece('0x3b')](_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x3b')]));_0x276bae[_0x1ece('0x3a')]=_0x276bae[_0x1ece('0x3a')]['length']?_0x276bae[_0x1ece('0x3a')]:_0x137e2d[_0x1ece('0x35')];_0x276bae[_0x1ece('0x3d')]=qs[_0x1ece('0x57')](_0x32e6bb['query'][_0x1ece('0x57')]);_0x276bae[_0x1ece('0x3e')]=qs[_0x1ece('0x38')](_[_0x1ece('0x3f')](_0x32e6bb[_0x1ece('0x36')],_0x137e2d['filters']));if(_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x40')]){_0x276bae[_0x1ece('0x3e')]=_[_0x1ece('0x41')](_0x276bae[_0x1ece('0x3e')],{'$or':_[_0x1ece('0x32')](_0x276bae[_0x1ece('0x3a')],function(_0x146422){var _0x53e6bd={};_0x53e6bd[_0x146422]={'$like':'%'+_0x32e6bb[_0x1ece('0x36')]['filter']+'%'};return _0x53e6bd;})});}_0x276bae=_[_0x1ece('0x41')]({},_0x276bae,_0x32e6bb[_0x1ece('0x4b')]);return _0x590189['getAgents'](_0x276bae);}})[_0x1ece('0x29')](function(_0x1cdaf4){if(_0x1cdaf4){_0xa81bf6=_0x1cdaf4['length'];if(!_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x3c')]('nolimit')){_0x276bae['limit']=qs[_0x1ece('0x26')](_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x26')]);_0x276bae[_0x1ece('0x25')]=qs[_0x1ece('0x25')](_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x25')]);}return _0x590189[_0x1ece('0x84')](_0x276bae);}})[_0x1ece('0x29')](function(_0x8197cb){if(_0x8197cb){return _0x8197cb?{'count':_0xa81bf6,'rows':_0x8197cb}:null;}})[_0x1ece('0x29')](respondWithResult(_0x299f0f,null))[_0x1ece('0x45')](handleError(_0x299f0f,null));}; \ No newline at end of file +var _0x75fb=['find','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','forEach','emit','addAgents','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','json','count','limit','Content-Range','apply','reject','save','destroy','then','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','index','FaxQueue','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','rawAttributes','options'];(function(_0x1bd411,_0x2b2ca2){var _0x5dcc9f=function(_0x12d987){while(--_0x12d987){_0x1bd411['push'](_0x1bd411['shift']());}};_0x5dcc9f(++_0x2b2ca2);}(_0x75fb,0x162));var _0xb75f=function(_0x1f0ad7,_0x93ceb8){_0x1f0ad7=_0x1f0ad7-0x0;var _0x50a1ef=_0x75fb[_0x1f0ad7];return _0x50a1ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb75f('0x0'));var rimraf=require(_0xb75f('0x1'));var zipdir=require(_0xb75f('0x2'));var jsonpatch=require(_0xb75f('0x3'));var rp=require('request-promise');var moment=require(_0xb75f('0x4'));var BPromise=require(_0xb75f('0x5'));var Mustache=require(_0xb75f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb75f('0x7'));var csv=require(_0xb75f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb75f('0x9'));var squel=require(_0xb75f('0xa'));var crypto=require(_0xb75f('0xb'));var jsforce=require(_0xb75f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb75f('0x8'));var querystring=require(_0xb75f('0xd'));var Papa=require(_0xb75f('0xe'));var Redis=require(_0xb75f('0xf'));var authService=require(_0xb75f('0x10'));var qs=require(_0xb75f('0x11'));var as=require(_0xb75f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb75f('0x13'))(_0xb75f('0x14'));var utils=require(_0xb75f('0x15'));var config=require(_0xb75f('0x16'));var licenseUtil=require(_0xb75f('0x17'));var db=require(_0xb75f('0x18'))['db'];config[_0xb75f('0x19')]=_[_0xb75f('0x1a')](config[_0xb75f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb75f('0x1b'))(new Redis(config[_0xb75f('0x19')]));require(_0xb75f('0x1c'))[_0xb75f('0x1d')](socket);function respondWithStatusCode(_0x1e0ea1,_0x267f93){_0x267f93=_0x267f93||0xcc;return function(_0x45aa59){if(_0x45aa59){return _0x1e0ea1['sendStatus'](_0x267f93);}return _0x1e0ea1[_0xb75f('0x1e')](_0x267f93)[_0xb75f('0x1f')]();};}function respondWithResult(_0x4e255b,_0x193124){_0x193124=_0x193124||0xc8;return function(_0x4ba187){if(_0x4ba187){return _0x4e255b[_0xb75f('0x1e')](_0x193124)[_0xb75f('0x20')](_0x4ba187);}};}function respondWithFilteredResult(_0x2e2ad2,_0xf9c3e1){return function(_0x4d7cba){if(_0x4d7cba){var _0x509902=_0x4d7cba[_0xb75f('0x21')],_0x3f84cc=_0xf9c3e1['offset'],_0x299a48=_0xf9c3e1['offset']+_0xf9c3e1[_0xb75f('0x22')],_0x3420e7;if(_0x299a48>=_0x509902){_0x299a48=_0x509902;_0x3420e7=0xc8;}else{_0x3420e7=0xce;}_0x2e2ad2[_0xb75f('0x1e')](_0x3420e7);return _0x2e2ad2['set'](_0xb75f('0x23'),_0x3f84cc+'-'+_0x299a48+'/'+_0x509902)[_0xb75f('0x20')](_0x4d7cba);}return null;};}function patchUpdates(_0x15d79f){return function(_0x584e94){try{jsonpatch[_0xb75f('0x24')](_0x584e94,_0x15d79f,!![]);}catch(_0x17b077){return BPromise[_0xb75f('0x25')](_0x17b077);}return _0x584e94[_0xb75f('0x26')]();};}function saveUpdates(_0x1fb513,_0x20ce2f){return function(_0x5b4412){if(_0x5b4412){return _0x5b4412['update'](_0x1fb513)['then'](function(_0x99fa11){return _0x99fa11;});}return null;};}function removeEntity(_0x241880,_0x4e8f0a){return function(_0x5eda92){if(_0x5eda92){return _0x5eda92[_0xb75f('0x27')]()[_0xb75f('0x28')](function(){var _0x405fa1=_0x5eda92[_0xb75f('0x29')]({'plain':!![]});var _0x4dfea7=_0xb75f('0x2a');return db[_0xb75f('0x2b')][_0xb75f('0x27')]({'where':{'type':_0x4dfea7,'resourceId':_0x405fa1['id']}})[_0xb75f('0x28')](function(){return _0x5eda92;});})['then'](function(){_0x241880[_0xb75f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc85ac3,_0x560716){return function(_0x2c94d6){if(!_0x2c94d6){_0xc85ac3[_0xb75f('0x2c')](0x194);}return _0x2c94d6;};}function handleError(_0x31e19b,_0x182c3b){_0x182c3b=_0x182c3b||0x1f4;return function(_0xa03b0e){logger[_0xb75f('0x2d')](_0xa03b0e[_0xb75f('0x2e')]);if(_0xa03b0e[_0xb75f('0x2f')]){delete _0xa03b0e[_0xb75f('0x2f')];}_0x31e19b[_0xb75f('0x1e')](_0x182c3b)[_0xb75f('0x30')](_0xa03b0e);};}exports[_0xb75f('0x31')]=function(_0xf61c32,_0x2565f8){var _0x5171cd={},_0x59a882={},_0x48ba68={'count':0x0,'rows':[]};var _0x3282c9=_['map'](db[_0xb75f('0x32')]['rawAttributes'],function(_0x4bdbc6){return{'name':_0x4bdbc6['fieldName'],'type':_0x4bdbc6['type'][_0xb75f('0x33')]};});_0x59a882[_0xb75f('0x34')]=_[_0xb75f('0x35')](_0x3282c9,_0xb75f('0x2f'));_0x59a882[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0xf61c32[_0xb75f('0x36')]);_0x59a882[_0xb75f('0x38')]=_[_0xb75f('0x39')](_0x59a882[_0xb75f('0x34')],_0x59a882[_0xb75f('0x36')]);_0x5171cd['attributes']=_[_0xb75f('0x39')](_0x59a882[_0xb75f('0x34')],qs[_0xb75f('0x3a')](_0xf61c32[_0xb75f('0x36')][_0xb75f('0x3a')]));_0x5171cd['attributes']=_0x5171cd[_0xb75f('0x3b')][_0xb75f('0x3c')]?_0x5171cd[_0xb75f('0x3b')]:_0x59a882[_0xb75f('0x34')];if(!_0xf61c32[_0xb75f('0x36')][_0xb75f('0x3d')](_0xb75f('0x3e'))){_0x5171cd['limit']=qs[_0xb75f('0x22')](_0xf61c32['query'][_0xb75f('0x22')]);_0x5171cd[_0xb75f('0x3f')]=qs['offset'](_0xf61c32[_0xb75f('0x36')][_0xb75f('0x3f')]);}_0x5171cd['order']=qs[_0xb75f('0x40')](_0xf61c32['query'][_0xb75f('0x40')]);_0x5171cd[_0xb75f('0x41')]=qs['filters'](_[_0xb75f('0x42')](_0xf61c32['query'],_0x59a882[_0xb75f('0x38')]),_0x3282c9);if(_0xf61c32[_0xb75f('0x36')][_0xb75f('0x43')]){_0x5171cd[_0xb75f('0x41')]=_[_0xb75f('0x44')](_0x5171cd[_0xb75f('0x41')],{'$or':_['map'](_0x3282c9,function(_0x3b90da){if(_0x3b90da[_0xb75f('0x45')]!=='VIRTUAL'){var _0x497240={};_0x497240[_0x3b90da[_0xb75f('0x2f')]]={'$like':'%'+_0xf61c32[_0xb75f('0x36')][_0xb75f('0x43')]+'%'};return _0x497240;}})});}_0x5171cd=_[_0xb75f('0x44')]({},_0x5171cd,_0xf61c32['options']);var _0x5f4f16={'where':_0x5171cd[_0xb75f('0x41')]};return db[_0xb75f('0x32')]['count'](_0x5f4f16)[_0xb75f('0x28')](function(_0x54b472){_0x48ba68[_0xb75f('0x21')]=_0x54b472;if(_0xf61c32[_0xb75f('0x36')][_0xb75f('0x46')]){_0x5171cd[_0xb75f('0x47')]=[{'all':!![]}];}return db[_0xb75f('0x32')][_0xb75f('0x48')](_0x5171cd);})[_0xb75f('0x28')](function(_0x31a401){_0x48ba68[_0xb75f('0x49')]=_0x31a401;return _0x48ba68;})[_0xb75f('0x28')](respondWithFilteredResult(_0x2565f8,_0x5171cd))[_0xb75f('0x4a')](handleError(_0x2565f8,null));};exports[_0xb75f('0x4b')]=function(_0x3e8d27,_0x288867){var _0x5f3e91={'raw':!![],'where':{'id':_0x3e8d27['params']['id']}},_0x4615fd={};_0x4615fd[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x32')][_0xb75f('0x4c')]);_0x4615fd[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0x3e8d27[_0xb75f('0x36')]);_0x4615fd['filters']=_['intersection'](_0x4615fd['model'],_0x4615fd['query']);_0x5f3e91[_0xb75f('0x3b')]=_[_0xb75f('0x39')](_0x4615fd['model'],qs[_0xb75f('0x3a')](_0x3e8d27[_0xb75f('0x36')][_0xb75f('0x3a')]));_0x5f3e91[_0xb75f('0x3b')]=_0x5f3e91[_0xb75f('0x3b')][_0xb75f('0x3c')]?_0x5f3e91[_0xb75f('0x3b')]:_0x4615fd[_0xb75f('0x34')];if(_0x3e8d27[_0xb75f('0x36')][_0xb75f('0x46')]){_0x5f3e91[_0xb75f('0x47')]=[{'all':!![]}];}_0x5f3e91=_['merge']({},_0x5f3e91,_0x3e8d27[_0xb75f('0x4d')]);return db[_0xb75f('0x32')][_0xb75f('0x4e')](_0x5f3e91)[_0xb75f('0x28')](handleEntityNotFound(_0x288867,null))['then'](respondWithResult(_0x288867,null))[_0xb75f('0x4a')](handleError(_0x288867,null));};exports['create']=function(_0x1e9b6c,_0x7b9907){return db[_0xb75f('0x32')]['create'](_0x1e9b6c['body'],{})[_0xb75f('0x28')](function(_0x25aba7){var _0x2a66f1=_0x1e9b6c[_0xb75f('0x4f')][_0xb75f('0x29')]({'plain':!![]});if(!_0x2a66f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a66f1['role']===_0xb75f('0x4f')){var _0x391cce=_0x25aba7[_0xb75f('0x29')]({'plain':!![]});var _0x4bae9d=_0xb75f('0x2a');return db['UserProfileSection'][_0xb75f('0x4e')]({'where':{'name':_0x4bae9d,'userProfileId':_0x2a66f1[_0xb75f('0x50')]},'raw':!![]})[_0xb75f('0x28')](function(_0x1e7cbf){if(_0x1e7cbf&&_0x1e7cbf[_0xb75f('0x51')]===0x0){return db[_0xb75f('0x2b')][_0xb75f('0x52')]({'name':_0x391cce[_0xb75f('0x2f')],'resourceId':_0x391cce['id'],'type':_0x1e7cbf[_0xb75f('0x2f')],'sectionId':_0x1e7cbf['id']},{})['then'](function(){return _0x25aba7;});}else{return _0x25aba7;}})[_0xb75f('0x4a')](function(_0x19aba3){logger[_0xb75f('0x2d')](_0xb75f('0x53'),_0x19aba3);throw _0x19aba3;});}return _0x25aba7;})[_0xb75f('0x28')](respondWithResult(_0x7b9907,0xc9))[_0xb75f('0x4a')](handleError(_0x7b9907,null));};exports[_0xb75f('0x54')]=function(_0x2ce823,_0x31eb8a){if(_0x2ce823['body']['id']){delete _0x2ce823[_0xb75f('0x55')]['id'];}return db[_0xb75f('0x32')][_0xb75f('0x4e')]({'where':{'id':_0x2ce823[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x31eb8a,null))[_0xb75f('0x28')](saveUpdates(_0x2ce823['body'],null))[_0xb75f('0x28')](respondWithResult(_0x31eb8a,null))['catch'](handleError(_0x31eb8a,null));};exports[_0xb75f('0x27')]=function(_0x39bdc1,_0x44d59e){return db[_0xb75f('0x32')][_0xb75f('0x4e')]({'where':{'id':_0x39bdc1['params']['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x44d59e,null))['then'](removeEntity(_0x44d59e,null))['catch'](handleError(_0x44d59e,null));};exports[_0xb75f('0x57')]=function(_0x19d4c5,_0x4138fa){return db['FaxQueue'][_0xb75f('0x57')]()[_0xb75f('0x28')](respondWithResult(_0x4138fa,null))['catch'](handleError(_0x4138fa,null));};exports[_0xb75f('0x58')]=function(_0x5cf577,_0x4982ee,_0x2330b4){var _0x1ea06c={'raw':!![],'where':{}},_0x38ef02={},_0x11d019;return db[_0xb75f('0x32')][_0xb75f('0x59')]({'where':{'id':_0x5cf577[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x4982ee,null))[_0xb75f('0x28')](function(_0x5a7185){if(_0x5a7185){_0x11d019=_0x5a7185[_0xb75f('0x29')]({'plain':!![]});_0x38ef02[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x5a')][_0xb75f('0x4c')]);_0x38ef02[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0x5cf577[_0xb75f('0x36')]);_0x38ef02[_0xb75f('0x38')]=_[_0xb75f('0x39')](_0x38ef02['model'],_0x38ef02['query']);_0x1ea06c[_0xb75f('0x3b')]=_['intersection'](_0x38ef02[_0xb75f('0x34')],qs[_0xb75f('0x3a')](_0x5cf577['query'][_0xb75f('0x3a')]));_0x1ea06c[_0xb75f('0x3b')]=_0x1ea06c[_0xb75f('0x3b')][_0xb75f('0x3c')]?_0x1ea06c[_0xb75f('0x3b')]:_0x38ef02[_0xb75f('0x34')];if(!_0x5cf577[_0xb75f('0x36')]['hasOwnProperty']('nolimit')){_0x1ea06c[_0xb75f('0x22')]=qs[_0xb75f('0x22')](_0x5cf577[_0xb75f('0x36')]['limit']);_0x1ea06c[_0xb75f('0x3f')]=qs[_0xb75f('0x3f')](_0x5cf577[_0xb75f('0x36')][_0xb75f('0x3f')]);}_0x1ea06c[_0xb75f('0x5b')]=qs[_0xb75f('0x40')](_0x5cf577[_0xb75f('0x36')][_0xb75f('0x40')]);_0x1ea06c['where']=qs['filters'](_[_0xb75f('0x42')](_0x5cf577[_0xb75f('0x36')],_0x38ef02[_0xb75f('0x38')]));_0x1ea06c[_0xb75f('0x41')][_0xb75f('0x5c')]=_0x5a7185['id'];if(_0x5cf577['query'][_0xb75f('0x43')]){_0x1ea06c[_0xb75f('0x41')]=_['merge'](_0x1ea06c['where'],{'$or':_['map'](_0x1ea06c[_0xb75f('0x3b')],function(_0x23843e){var _0x9f8d4d={};_0x9f8d4d[_0x23843e]={'$like':'%'+_0x5cf577['query'][_0xb75f('0x43')]+'%'};return _0x9f8d4d;})});}_0x1ea06c=_[_0xb75f('0x44')]({},_0x1ea06c,_0x5cf577[_0xb75f('0x4d')]);return db[_0xb75f('0x5a')][_0xb75f('0x48')](_0x1ea06c);}})[_0xb75f('0x28')](function(_0x29da7e){if(_0x29da7e){return db[_0xb75f('0x5d')][_0xb75f('0x5e')]({'where':{'id':_[_0xb75f('0x35')](_0x29da7e,_0xb75f('0x5f')),'role':_0xb75f('0x60')},'attributes':['id',_0xb75f('0x2f'),_0xb75f('0x61'),_0xb75f('0x62'),_0xb75f('0x63')]});}})[_0xb75f('0x28')](function(_0xef327b){if(_0xef327b){return{'count':_0xef327b[_0xb75f('0x21')],'rows':_['map'](_0xef327b[_0xb75f('0x49')],function(_0x81f4fc){return{'membername':_0x81f4fc['name'],'UserId':_0x81f4fc['id'],'queue_name':_0x11d019[_0xb75f('0x2f')],'FaxQueueId':_0x11d019['id'],'interface':util['format']('%s/%s',_0xb75f('0x64'),_0x81f4fc[_0xb75f('0x2f')]),'penalty':0x0,'paused':_0x81f4fc[_0xb75f('0x61')],'createdAt':_0x81f4fc[_0xb75f('0x63')],'updatedAt':_0x81f4fc[_0xb75f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb75f('0x28')](respondWithFilteredResult(_0x4982ee,_0x1ea06c))['catch'](handleError(_0x4982ee,null));};exports[_0xb75f('0x65')]=function(_0x315ddf,_0x322535,_0x4453ea){var _0x5803d1={};var _0x329057={};var _0x16f1ad;var _0x585cd9;return db[_0xb75f('0x32')][_0xb75f('0x59')]({'where':{'id':_0x315ddf[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x322535,null))[_0xb75f('0x28')](function(_0x4cbade){if(_0x4cbade){_0x16f1ad=_0x4cbade;_0x329057[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x66')]['rawAttributes']);_0x329057['query']=_[_0xb75f('0x37')](_0x315ddf[_0xb75f('0x36')]);_0x329057[_0xb75f('0x38')]=_[_0xb75f('0x39')](_0x329057[_0xb75f('0x34')],_0x329057['query']);_0x5803d1[_0xb75f('0x3b')]=_['intersection'](_0x329057[_0xb75f('0x34')],qs['fields'](_0x315ddf['query']['fields']));_0x5803d1[_0xb75f('0x3b')]=_0x5803d1[_0xb75f('0x3b')]['length']?_0x5803d1[_0xb75f('0x3b')]:_0x329057[_0xb75f('0x34')];_0x5803d1['order']=qs[_0xb75f('0x40')](_0x315ddf[_0xb75f('0x36')][_0xb75f('0x40')]);_0x5803d1[_0xb75f('0x41')]=qs[_0xb75f('0x38')](_['pick'](_0x315ddf['query'],_0x329057[_0xb75f('0x38')]));if(_0x315ddf[_0xb75f('0x36')]['filter']){_0x5803d1[_0xb75f('0x41')]=_[_0xb75f('0x44')](_0x5803d1[_0xb75f('0x41')],{'$or':_[_0xb75f('0x35')](_0x5803d1[_0xb75f('0x3b')],function(_0x39b66b){var _0x3226fb={};_0x3226fb[_0x39b66b]={'$like':'%'+_0x315ddf['query'][_0xb75f('0x43')]+'%'};return _0x3226fb;})});}_0x5803d1=_[_0xb75f('0x44')]({},_0x5803d1,_0x315ddf[_0xb75f('0x4d')]);return _0x16f1ad[_0xb75f('0x65')](_0x5803d1);}})[_0xb75f('0x28')](function(_0x140f6e){if(_0x140f6e){_0x585cd9=_0x140f6e[_0xb75f('0x3c')];if(!_0x315ddf['query'][_0xb75f('0x3d')]('nolimit')){_0x5803d1[_0xb75f('0x22')]=qs[_0xb75f('0x22')](_0x315ddf['query'][_0xb75f('0x22')]);_0x5803d1[_0xb75f('0x3f')]=qs['offset'](_0x315ddf[_0xb75f('0x36')]['offset']);}return _0x16f1ad[_0xb75f('0x65')](_0x5803d1);}})['then'](function(_0x500606){if(_0x500606){return _0x500606?{'count':_0x585cd9,'rows':_0x500606}:null;}})[_0xb75f('0x28')](respondWithResult(_0x322535,null))[_0xb75f('0x4a')](handleError(_0x322535,null));};exports['addTeams']=function(_0x49bd25,_0x229588,_0x1d1482){var _0x8642b=_0x49bd25[_0xb75f('0x55')]['ids'];return db[_0xb75f('0x66')][_0xb75f('0x48')]({'where':{'id':_0x8642b},'attributes':['id'],'include':[{'model':db[_0xb75f('0x5d')],'as':_0xb75f('0x67'),'attributes':['id',_0xb75f('0x2f'),_0xb75f('0x68'),_0xb75f('0x69'),_0xb75f('0x6a')],'raw':!![]}]})[_0xb75f('0x28')](function(_0x82d5d){if(_0x82d5d){var _0x37a9db=_[_0xb75f('0x6b')](_0x82d5d,function(_0x4ada70){var _0x40d728=_0x4ada70[_0xb75f('0x29')]({'plain':!![]});return _0x40d728['Agents'];});return db[_0xb75f('0x32')]['find']({'where':{'id':_0x49bd25[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](function(_0x501da8){return db[_0xb75f('0x6c')][_0xb75f('0x6d')](function(_0x34a0e0){return _0x501da8[_0xb75f('0x6e')](_0x8642b,{'transaction':_0x34a0e0})[_0xb75f('0x28')](function(){return BPromise['each'](_0x37a9db,function(_0xc2b3e9){return db[_0xb75f('0x5a')][_0xb75f('0x6f')]({'where':{'UserId':_0xc2b3e9['id'],'FaxQueueId':_0x49bd25[_0xb75f('0x56')]['id']},'transaction':_0x34a0e0});});})[_0xb75f('0x28')](function(){_0x37a9db['forEach'](function(_0x31ef62){socket['emit'](_0xb75f('0x70'),{'UserId':_0x31ef62['id'],'FaxQueueId':_0x501da8['id']});});});});});}})['then'](respondWithStatusCode(_0x229588,null))['catch'](handleError(_0x229588,null));};exports[_0xb75f('0x71')]=function(_0x3a0e97,_0x254f6d,_0x50ed45){return db[_0xb75f('0x66')]['findAll']({'where':{'id':_0x3a0e97[_0xb75f('0x36')][_0xb75f('0x72')]},'attributes':['id'],'include':[{'model':db[_0xb75f('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x254f6d,null))[_0xb75f('0x28')](function(_0x96fa3d){var _0x4aa428=_[_0xb75f('0x35')](_0x96fa3d,'id');var _0xec5b6d=[];var _0x35d2df=[];var _0x257998=squel[_0xb75f('0x73')]();_0x257998['field'](_0xb75f('0x74'))[_0xb75f('0x75')](_0xb75f('0x76'),'tq')[_0xb75f('0x77')](_0xb75f('0x78'),'ut',_0xb75f('0x79'))['where'](_0xb75f('0x7a'),_0x3a0e97['params']['id']);for(var _0x2ca3e5=0x0;_0x2ca3e5<_0x96fa3d[_0xb75f('0x3c')];_0x2ca3e5+=0x1){let _0x45ae68=_0x96fa3d[_0x2ca3e5];for(var _0x2cce55=0x0;_0x2cce55<_0x45ae68[_0xb75f('0x67')][_0xb75f('0x3c')];_0x2cce55+=0x1){let _0x81e439=_0x45ae68[_0xb75f('0x67')][_0x2cce55];var _0x2799c7=_0x257998[_0xb75f('0x7b')]();_0x2799c7[_0xb75f('0x41')](_0xb75f('0x7c'),_0x81e439['id']);_0x35d2df[_0xb75f('0x7d')](db[_0xb75f('0x6c')]['query'](_0x2799c7[_0xb75f('0x7e')](),{'type':db['sequelize'][_0xb75f('0x7f')][_0xb75f('0x80')]})[_0xb75f('0x28')](function(_0x4b1d04){if(_0x4b1d04['length']===0x1){return _0x81e439['id'];}else{var _0x5179b2=_[_0xb75f('0x81')](_['map'](_0x4b1d04,_0xb75f('0x82')),function(_0x4a1689){return _[_0xb75f('0x83')](_0x4aa428,_0x4a1689);});if(_0x5179b2){return _0x81e439['id'];}}}));}}return BPromise[_0xb75f('0x84')](_0x35d2df)[_0xb75f('0x28')](function(_0x50de8b){_0xec5b6d=_(_0xec5b6d)[_0xb75f('0x85')](_0x50de8b)[_0xb75f('0x86')]()[_0xb75f('0x87')]();return db[_0xb75f('0x32')]['find']({'where':{'id':_0x3a0e97[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](function(_0x43cae3){return db[_0xb75f('0x6c')][_0xb75f('0x6d')](function(_0x3acddf){return _0x43cae3[_0xb75f('0x71')](_0x3a0e97[_0xb75f('0x36')][_0xb75f('0x72')],{'transaction':_0x3acddf})[_0xb75f('0x28')](function(){if(!_['isEmpty'](_0xec5b6d)){return _0x43cae3[_0xb75f('0x88')](_0xec5b6d,{'transaction':_0x3acddf});}})[_0xb75f('0x28')](function(){_0xec5b6d[_0xb75f('0x89')](function(_0x4706d8){socket[_0xb75f('0x8a')]('userFaxQueue:remove',{'UserId':_0x4706d8,'FaxQueueId':_0x43cae3['id']});});});});});});})[_0xb75f('0x28')](respondWithStatusCode(_0x254f6d,null))[_0xb75f('0x4a')](handleError(_0x254f6d,null));};exports['addAgents']=function(_0x112d1d,_0x329ec3,_0x5480ce){return db[_0xb75f('0x32')][_0xb75f('0x4e')]({'where':{'id':_0x112d1d[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x329ec3,null))[_0xb75f('0x28')](function(_0x578203){if(_0x578203){return _0x578203[_0xb75f('0x8b')](_0x112d1d[_0xb75f('0x55')][_0xb75f('0x72')],_['omit'](_0x112d1d[_0xb75f('0x55')],['ids','id'])||{})[_0xb75f('0x8c')](function(_0x927449){for(var _0x22cdda=0x0;_0x22cdda<_0x112d1d[_0xb75f('0x55')][_0xb75f('0x72')][_0xb75f('0x3c')];_0x22cdda+=0x1){socket[_0xb75f('0x8a')]('userFaxQueue:save',{'UserId':_0x112d1d[_0xb75f('0x55')]['ids'][_0x22cdda],'FaxQueueId':_0x112d1d[_0xb75f('0x56')]['id']});}return _0x927449;});}})[_0xb75f('0x28')](respondWithResult(_0x329ec3,null))[_0xb75f('0x4a')](handleError(_0x329ec3,null));};exports['removeAgents']=function(_0x5a6189,_0x3746b8,_0x2078f2){return db['FaxQueue']['find']({'where':{'id':_0x5a6189[_0xb75f('0x56')]['id']}})['then'](handleEntityNotFound(_0x3746b8,null))['then'](function(_0x3f6528){if(_0x3f6528){return _0x3f6528[_0xb75f('0x88')](_0x5a6189['query'][_0xb75f('0x72')])['then'](function(){if(_[_0xb75f('0x8d')](_0x5a6189['query'][_0xb75f('0x72')])){for(var _0x1ca91b=0x0;_0x1ca91b<_0x5a6189[_0xb75f('0x36')][_0xb75f('0x72')][_0xb75f('0x3c')];_0x1ca91b+=0x1){socket[_0xb75f('0x8a')](_0xb75f('0x8e'),{'UserId':Number(_0x5a6189[_0xb75f('0x36')][_0xb75f('0x72')][_0x1ca91b]),'FaxQueueId':Number(_0x5a6189[_0xb75f('0x56')]['id'])});}}else{socket['emit'](_0xb75f('0x8e'),{'UserId':Number(_0x5a6189[_0xb75f('0x36')][_0xb75f('0x72')]),'FaxQueueId':Number(_0x5a6189[_0xb75f('0x56')]['id'])});}});}})[_0xb75f('0x28')](respondWithStatusCode(_0x3746b8,null))[_0xb75f('0x4a')](handleError(_0x3746b8,null));};exports[_0xb75f('0x8f')]=function(_0x130030,_0x2e356d,_0x1ef094){var _0x4ed25e={};var _0xb3707={};var _0x361988;var _0x220649;return db[_0xb75f('0x32')][_0xb75f('0x59')]({'where':{'id':_0x130030[_0xb75f('0x56')]['id']}})[_0xb75f('0x28')](handleEntityNotFound(_0x2e356d,null))['then'](function(_0x48d672){if(_0x48d672){_0x361988=_0x48d672;_0xb3707[_0xb75f('0x34')]=_[_0xb75f('0x37')](db[_0xb75f('0x5d')][_0xb75f('0x4c')]);_0xb3707[_0xb75f('0x36')]=_[_0xb75f('0x37')](_0x130030[_0xb75f('0x36')]);_0xb3707[_0xb75f('0x38')]=_['intersection'](_0xb3707[_0xb75f('0x34')],_0xb3707['query']);_0x4ed25e['attributes']=_['intersection'](_0xb3707['model'],qs[_0xb75f('0x3a')](_0x130030['query'][_0xb75f('0x3a')]));_0x4ed25e[_0xb75f('0x3b')]=_0x4ed25e[_0xb75f('0x3b')]['length']?_0x4ed25e[_0xb75f('0x3b')]:_0xb3707['model'];_0x4ed25e[_0xb75f('0x5b')]=qs[_0xb75f('0x40')](_0x130030[_0xb75f('0x36')]['sort']);_0x4ed25e[_0xb75f('0x41')]=qs[_0xb75f('0x38')](_[_0xb75f('0x42')](_0x130030[_0xb75f('0x36')],_0xb3707[_0xb75f('0x38')]));if(_0x130030['query']['filter']){_0x4ed25e['where']=_['merge'](_0x4ed25e[_0xb75f('0x41')],{'$or':_[_0xb75f('0x35')](_0x4ed25e[_0xb75f('0x3b')],function(_0x26269e){var _0x45cc4f={};_0x45cc4f[_0x26269e]={'$like':'%'+_0x130030['query'][_0xb75f('0x43')]+'%'};return _0x45cc4f;})});}_0x4ed25e=_[_0xb75f('0x44')]({},_0x4ed25e,_0x130030['options']);return _0x361988[_0xb75f('0x8f')](_0x4ed25e);}})[_0xb75f('0x28')](function(_0x24b35e){if(_0x24b35e){_0x220649=_0x24b35e[_0xb75f('0x3c')];if(!_0x130030['query'][_0xb75f('0x3d')](_0xb75f('0x3e'))){_0x4ed25e['limit']=qs[_0xb75f('0x22')](_0x130030[_0xb75f('0x36')][_0xb75f('0x22')]);_0x4ed25e[_0xb75f('0x3f')]=qs[_0xb75f('0x3f')](_0x130030['query'][_0xb75f('0x3f')]);}return _0x361988[_0xb75f('0x8f')](_0x4ed25e);}})[_0xb75f('0x28')](function(_0x5b9555){if(_0x5b9555){return _0x5b9555?{'count':_0x220649,'rows':_0x5b9555}:null;}})[_0xb75f('0x28')](respondWithResult(_0x2e356d,null))[_0xb75f('0x4a')](handleError(_0x2e356d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 59d2f5e..4c3842a 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 _0xe929=['hasOwnProperty','hook','FaxQueue','setMaxListeners','save','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe929,0x104));var _0x9e92=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xe929[_0xd2d54];return _0x78b113;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x9e92('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9e92('0x1')](0x0);var events={'afterCreate':_0x9e92('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x568421){return function(_0x46ef31,_0x243d69,_0x14c8bb){FaxQueueEvents[_0x9e92('0x3')](_0x568421+':'+_0x46ef31['id'],_0x46ef31);FaxQueueEvents[_0x9e92('0x3')](_0x568421,_0x46ef31);_0x14c8bb(null);};}for(var e in events){if(events[_0x9e92('0x4')](e)){var event=events[e];FaxQueue[_0x9e92('0x5')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x8453=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','FaxQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8453,0x19c));var _0x3845=function(_0x5d317f,_0x543f51){_0x5d317f=_0x5d317f-0x0;var _0x5d5e13=_0x8453[_0x5d317f];return _0x5d5e13;};'use strict';var EventEmitter=require(_0x3845('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x3845('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3845('0x2')](0x0);var events={'afterCreate':_0x3845('0x3'),'afterUpdate':_0x3845('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d8f90){return function(_0x1ab25e,_0x4353bb,_0x34bb4e){FaxQueueEvents[_0x3845('0x5')](_0x4d8f90+':'+_0x1ab25e['id'],_0x1ab25e);FaxQueueEvents['emit'](_0x4d8f90,_0x1ab25e);_0x34bb4e(null);};}for(var e in events){if(events[_0x3845('0x6')](e)){var event=events[e];FaxQueue[_0x3845('0x7')](e,emitEvent(event));}}module[_0x3845('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 649eb08..75456f2 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 _0xbcca=['rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1e823f,_0x4cd41a){var _0x192774=function(_0x2a7d79){while(--_0x2a7d79){_0x1e823f['push'](_0x1e823f['shift']());}};_0x192774(++_0x4cd41a);}(_0xbcca,0x1b3));var _0xabcc=function(_0x438d2a,_0x17c514){_0x438d2a=_0x438d2a-0x0;var _0x31d5d7=_0xbcca[_0x438d2a];return _0x31d5d7;};'use strict';var _=require('lodash');var util=require(_0xabcc('0x0'));var logger=require(_0xabcc('0x1'))('api');var moment=require(_0xabcc('0x2'));var BPromise=require(_0xabcc('0x3'));var rp=require(_0xabcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabcc('0x5'));var config=require(_0xabcc('0x6'));var attributes=require(_0xabcc('0x7'));module['exports']=function(_0x1b6a85,_0x464afd){return _0x1b6a85[_0xabcc('0x8')](_0xabcc('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f3e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','FaxQueue','fax_queues'];(function(_0x21203d,_0x284bde){var _0x575987=function(_0x41fbc3){while(--_0x41fbc3){_0x21203d['push'](_0x21203d['shift']());}};_0x575987(++_0x284bde);}(_0x1f3e,0x12c));var _0xe1f3=function(_0x179c3a,_0x14b012){_0x179c3a=_0x179c3a-0x0;var _0x1af0a0=_0x1f3e[_0x179c3a];return _0x1af0a0;};'use strict';var _=require('lodash');var util=require(_0xe1f3('0x0'));var logger=require(_0xe1f3('0x1'))('api');var moment=require(_0xe1f3('0x2'));var BPromise=require(_0xe1f3('0x3'));var rp=require(_0xe1f3('0x4'));var fs=require('fs');var path=require(_0xe1f3('0x5'));var rimraf=require(_0xe1f3('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xe1f3('0x7')]=function(_0x242eba,_0x516191){return _0x242eba['define'](_0xe1f3('0x8'),attributes,{'tableName':_0xe1f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ac0f078..35ab514 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 _0x0b34=['limit','map','include','model','attributes','stringify','ShowFaxQueue','find','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b34,0x1e9));var _0x40b3=function(_0x3ea7c7,_0x5daae9){_0x3ea7c7=_0x3ea7c7-0x0;var _0x6f78e4=_0x0b34[_0x3ea7c7];return _0x6f78e4;};'use strict';var _=require(_0x40b3('0x0'));var util=require(_0x40b3('0x1'));var moment=require(_0x40b3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40b3('0x3'));var db=require(_0x40b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x40b3('0x5'));var config=require('../../config/environment');var jayson=require(_0x40b3('0x6'));var client=jayson[_0x40b3('0x7')]['http']({'port':0x232a});config[_0x40b3('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x40b3('0x9'))(new Redis(config[_0x40b3('0x8')]));require(_0x40b3('0xa'))[_0x40b3('0xb')](socket);function respondWithRpcPromise(_0x2a3842,_0x2dd090,_0x3d01fb){return new BPromise(function(_0x4dca7c,_0x296544){return client[_0x40b3('0xc')](_0x2a3842,_0x3d01fb)[_0x40b3('0xd')](function(_0x5c5d68){logger[_0x40b3('0xe')](_0x40b3('0xf'),_0x2dd090,_0x40b3('0x10'));logger[_0x40b3('0x11')](_0x40b3('0x12'),_0x2dd090,'request\x20sent',JSON['stringify'](_0x5c5d68));if(_0x5c5d68[_0x40b3('0x13')]){if(_0x5c5d68[_0x40b3('0x13')]['code']===0x1f4){logger[_0x40b3('0x13')](_0x40b3('0xf'),_0x2dd090,_0x5c5d68[_0x40b3('0x13')][_0x40b3('0x14')]);return _0x296544(_0x5c5d68[_0x40b3('0x13')]['message']);}logger['error'](_0x40b3('0xf'),_0x2dd090,_0x5c5d68[_0x40b3('0x13')][_0x40b3('0x14')]);return _0x4dca7c(_0x5c5d68['error'][_0x40b3('0x14')]);}else{logger[_0x40b3('0xe')](_0x40b3('0xf'),_0x2dd090,_0x40b3('0x10'));_0x4dca7c(_0x5c5d68[_0x40b3('0x15')][_0x40b3('0x14')]);}})[_0x40b3('0x16')](function(_0x5351ff){logger[_0x40b3('0x13')](_0x40b3('0xf'),_0x2dd090,_0x5351ff);_0x296544(_0x5351ff);});});}exports[_0x40b3('0x17')]=function(_0x494be9){var _0x21f992=this;return new Promise(function(_0x195ffd,_0x3a889c){return db[_0x40b3('0x18')][_0x40b3('0x19')]({'raw':_0x494be9[_0x40b3('0x1a')]?_0x494be9['options'][_0x40b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x494be9['options']?_0x494be9[_0x40b3('0x1a')][_0x40b3('0x1c')]||null:null,'attributes':_0x494be9[_0x40b3('0x1a')]?_0x494be9[_0x40b3('0x1a')]['attributes']||null:null,'limit':_0x494be9[_0x40b3('0x1a')]?_0x494be9[_0x40b3('0x1a')][_0x40b3('0x1d')]||null:null,'include':_0x494be9[_0x40b3('0x1a')]?_0x494be9[_0x40b3('0x1a')]['include']?_[_0x40b3('0x1e')](_0x494be9[_0x40b3('0x1a')][_0x40b3('0x1f')],function(_0x40f725){return{'model':db[_0x40f725[_0x40b3('0x20')]],'as':_0x40f725['as'],'attributes':_0x40f725[_0x40b3('0x21')],'include':_0x40f725[_0x40b3('0x1f')]?_[_0x40b3('0x1e')](_0x40f725[_0x40b3('0x1f')],function(_0x23e36b){return{'model':db[_0x23e36b[_0x40b3('0x20')]],'as':_0x23e36b['as'],'attributes':_0x23e36b[_0x40b3('0x21')],'include':_0x23e36b[_0x40b3('0x1f')]?_[_0x40b3('0x1e')](_0x23e36b[_0x40b3('0x1f')],function(_0x2cee99){return{'model':db[_0x2cee99[_0x40b3('0x20')]],'as':_0x2cee99['as'],'attributes':_0x2cee99[_0x40b3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32bfa6){logger[_0x40b3('0xe')](_0x40b3('0x17'),_0x494be9);logger[_0x40b3('0x11')](_0x40b3('0x17'),_0x494be9,JSON[_0x40b3('0x22')](_0x32bfa6));_0x195ffd(_0x32bfa6);})[_0x40b3('0x16')](function(_0x47a52a){logger['error'](_0x40b3('0x17'),_0x47a52a['message'],_0x494be9);_0x3a889c(_0x21f992['error'](0x1f4,_0x47a52a['message']));});});};exports[_0x40b3('0x23')]=function(_0x447762){var _0x3d72fc=this;return new Promise(function(_0x52b6e5,_0x140481){return db[_0x40b3('0x18')][_0x40b3('0x24')]({'raw':_0x447762[_0x40b3('0x1a')]?_0x447762[_0x40b3('0x1a')][_0x40b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x447762['options']?_0x447762[_0x40b3('0x1a')][_0x40b3('0x1c')]||null:null,'attributes':_0x447762[_0x40b3('0x1a')]?_0x447762[_0x40b3('0x1a')][_0x40b3('0x21')]||null:null,'include':_0x447762[_0x40b3('0x1a')]?_0x447762[_0x40b3('0x1a')]['include']?_[_0x40b3('0x1e')](_0x447762['options'][_0x40b3('0x1f')],function(_0x2ede9c){return{'model':db[_0x2ede9c[_0x40b3('0x20')]],'as':_0x2ede9c['as'],'attributes':_0x2ede9c[_0x40b3('0x21')],'include':_0x2ede9c[_0x40b3('0x1f')]?_['map'](_0x2ede9c[_0x40b3('0x1f')],function(_0x24400c){return{'model':db[_0x24400c[_0x40b3('0x20')]],'as':_0x24400c['as'],'attributes':_0x24400c[_0x40b3('0x21')],'include':_0x24400c['include']?_[_0x40b3('0x1e')](_0x24400c[_0x40b3('0x1f')],function(_0x2cc703){return{'model':db[_0x2cc703['model']],'as':_0x2cc703['as'],'attributes':_0x2cc703[_0x40b3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37d0c3){logger[_0x40b3('0xe')](_0x40b3('0x23'),_0x447762);logger[_0x40b3('0x11')](_0x40b3('0x23'),_0x447762,JSON[_0x40b3('0x22')](_0x37d0c3));_0x52b6e5(_0x37d0c3);})[_0x40b3('0x16')](function(_0x27a8e9){logger[_0x40b3('0x13')](_0x40b3('0x23'),_0x27a8e9[_0x40b3('0x14')],_0x447762);_0x140481(_0x3d72fc[_0x40b3('0x13')](0x1f4,_0x27a8e9['message']));});});}; \ No newline at end of file +var _0x1ed8=['find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','include','model','attributes','map','then','debug','ShowFaxQueue'];(function(_0xcd38d3,_0x3731b4){var _0x42d5b1=function(_0x480260){while(--_0x480260){_0xcd38d3['push'](_0xcd38d3['shift']());}};_0x42d5b1(++_0x3731b4);}(_0x1ed8,0xc9));var _0x81ed=function(_0x40970d,_0x2bb0ab){_0x40970d=_0x40970d-0x0;var _0x23b827=_0x1ed8[_0x40970d];return _0x23b827;};'use strict';var _=require('lodash');var util=require(_0x81ed('0x0'));var moment=require(_0x81ed('0x1'));var BPromise=require(_0x81ed('0x2'));var rs=require(_0x81ed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81ed('0x4'))['db'];var utils=require(_0x81ed('0x5'));var logger=require('../../config/logger')(_0x81ed('0x6'));var config=require(_0x81ed('0x7'));var jayson=require(_0x81ed('0x8'));var client=jayson['client'][_0x81ed('0x9')]({'port':0x232a});config[_0x81ed('0xa')]=_[_0x81ed('0xb')](config[_0x81ed('0xa')],{'host':_0x81ed('0xc'),'port':0x18eb});var socket=require(_0x81ed('0xd'))(new Redis(config['redis']));require(_0x81ed('0xe'))[_0x81ed('0xf')](socket);function respondWithRpcPromise(_0x17f5a4,_0x313bf6,_0x1e3131){return new BPromise(function(_0x5510eb,_0x1a2066){return client[_0x81ed('0x10')](_0x17f5a4,_0x1e3131)['then'](function(_0x15a53a){logger[_0x81ed('0x11')](_0x81ed('0x12'),_0x313bf6,_0x81ed('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x313bf6,_0x81ed('0x13'),JSON[_0x81ed('0x14')](_0x15a53a));if(_0x15a53a[_0x81ed('0x15')]){if(_0x15a53a['error'][_0x81ed('0x16')]===0x1f4){logger[_0x81ed('0x15')](_0x81ed('0x12'),_0x313bf6,_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);return _0x1a2066(_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);}logger[_0x81ed('0x15')]('FaxQueue,\x20%s,\x20%s',_0x313bf6,_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);return _0x5510eb(_0x15a53a[_0x81ed('0x15')][_0x81ed('0x17')]);}else{logger[_0x81ed('0x11')](_0x81ed('0x12'),_0x313bf6,_0x81ed('0x13'));_0x5510eb(_0x15a53a[_0x81ed('0x18')]['message']);}})[_0x81ed('0x19')](function(_0x2e9606){logger['error']('FaxQueue,\x20%s,\x20%s',_0x313bf6,_0x2e9606);_0x1a2066(_0x2e9606);});});}exports[_0x81ed('0x1a')]=function(_0x5caa89){var _0x40d51d=this;return new Promise(function(_0x209352,_0x3956c7){return db[_0x81ed('0x1b')][_0x81ed('0x1c')]({'raw':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')][_0x81ed('0x1e')]===undefined?!![]:![]:!![],'where':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')][_0x81ed('0x1f')]||null:null,'attributes':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')]['attributes']||null:null,'limit':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')]['limit']||null:null,'include':_0x5caa89[_0x81ed('0x1d')]?_0x5caa89[_0x81ed('0x1d')]['include']?_['map'](_0x5caa89['options'][_0x81ed('0x20')],function(_0x454107){return{'model':db[_0x454107[_0x81ed('0x21')]],'as':_0x454107['as'],'attributes':_0x454107[_0x81ed('0x22')],'include':_0x454107[_0x81ed('0x20')]?_[_0x81ed('0x23')](_0x454107['include'],function(_0x37527f){return{'model':db[_0x37527f[_0x81ed('0x21')]],'as':_0x37527f['as'],'attributes':_0x37527f['attributes'],'include':_0x37527f['include']?_[_0x81ed('0x23')](_0x37527f[_0x81ed('0x20')],function(_0x3740d3){return{'model':db[_0x3740d3[_0x81ed('0x21')]],'as':_0x3740d3['as'],'attributes':_0x3740d3[_0x81ed('0x22')]};}):[]};}):[]};}):[]:[]})[_0x81ed('0x24')](function(_0x367452){logger[_0x81ed('0x11')](_0x81ed('0x1a'),_0x5caa89);logger[_0x81ed('0x25')](_0x81ed('0x1a'),_0x5caa89,JSON['stringify'](_0x367452));_0x209352(_0x367452);})[_0x81ed('0x19')](function(_0xfa8a82){logger[_0x81ed('0x15')](_0x81ed('0x1a'),_0xfa8a82['message'],_0x5caa89);_0x3956c7(_0x40d51d[_0x81ed('0x15')](0x1f4,_0xfa8a82['message']));});});};exports[_0x81ed('0x26')]=function(_0x2d9cc0){var _0x476e81=this;return new Promise(function(_0x56093a,_0x26a1ce){return db['FaxQueue'][_0x81ed('0x27')]({'raw':_0x2d9cc0['options']?_0x2d9cc0[_0x81ed('0x1d')][_0x81ed('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d9cc0['options']?_0x2d9cc0['options']['where']||null:null,'attributes':_0x2d9cc0['options']?_0x2d9cc0[_0x81ed('0x1d')][_0x81ed('0x22')]||null:null,'include':_0x2d9cc0[_0x81ed('0x1d')]?_0x2d9cc0[_0x81ed('0x1d')][_0x81ed('0x20')]?_[_0x81ed('0x23')](_0x2d9cc0[_0x81ed('0x1d')]['include'],function(_0x1d74f8){return{'model':db[_0x1d74f8['model']],'as':_0x1d74f8['as'],'attributes':_0x1d74f8[_0x81ed('0x22')],'include':_0x1d74f8[_0x81ed('0x20')]?_[_0x81ed('0x23')](_0x1d74f8['include'],function(_0x169dd5){return{'model':db[_0x169dd5['model']],'as':_0x169dd5['as'],'attributes':_0x169dd5['attributes'],'include':_0x169dd5[_0x81ed('0x20')]?_['map'](_0x169dd5[_0x81ed('0x20')],function(_0x41eb85){return{'model':db[_0x41eb85[_0x81ed('0x21')]],'as':_0x41eb85['as'],'attributes':_0x41eb85[_0x81ed('0x22')]};}):[]};}):[]};}):[]:[]})[_0x81ed('0x24')](function(_0x450f7b){logger[_0x81ed('0x11')]('ShowFaxQueue',_0x2d9cc0);logger['debug'](_0x81ed('0x26'),_0x2d9cc0,JSON[_0x81ed('0x14')](_0x450f7b));_0x56093a(_0x450f7b);})[_0x81ed('0x19')](function(_0x5e49e5){logger[_0x81ed('0x15')]('ShowFaxQueue',_0x5e49e5['message'],_0x2d9cc0);_0x26a1ce(_0x476e81[_0x81ed('0x15')](0x1f4,_0x5e49e5[_0x81ed('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a82aec1..8769c71 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 _0xef7b=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x4a96ca,_0x44d785){var _0x4601ea=function(_0x48b24b){while(--_0x48b24b){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x4601ea(++_0x44d785);}(_0xef7b,0x161));var _0xbef7=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0xef7b[_0x3b90ab];return _0x206e92;};'use strict';var FaxQueueEvents=require(_0xbef7('0x0'));var events=[_0xbef7('0x1'),_0xbef7('0x2'),_0xbef7('0x3')];function createListener(_0x2c046e,_0x27a560){return function(_0x32c4c6){_0x27a560[_0xbef7('0x4')](_0x2c046e,_0x32c4c6);};}function removeListener(_0x2edac1,_0x3170eb){return function(){FaxQueueEvents[_0xbef7('0x5')](_0x2edac1,_0x3170eb);};}exports['register']=function(_0x114501){for(var _0x1f440d=0x0,_0x44e5b3=events[_0xbef7('0x6')];_0x1f440d<_0x44e5b3;_0x1f440d++){var _0x1d535a=events[_0x1f440d];var _0x402b3b=createListener(_0xbef7('0x7')+_0x1d535a,_0x114501);FaxQueueEvents['on'](_0x1d535a,_0x402b3b);}}; \ No newline at end of file +var _0xed37=['removeListener','register','length','faxQueue:','save','remove','update'];(function(_0x12fa10,_0x5e9810){var _0x14ce72=function(_0x1828ac){while(--_0x1828ac){_0x12fa10['push'](_0x12fa10['shift']());}};_0x14ce72(++_0x5e9810);}(_0xed37,0x66));var _0x7ed3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xed37[_0x3ab51d];return _0x29a04e;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x7ed3('0x0'),_0x7ed3('0x1'),_0x7ed3('0x2')];function createListener(_0x365ffa,_0x35c03a){return function(_0x96f176){_0x35c03a['emit'](_0x365ffa,_0x96f176);};}function removeListener(_0x10b4a4,_0x64b818){return function(){FaxQueueEvents[_0x7ed3('0x3')](_0x10b4a4,_0x64b818);};}exports[_0x7ed3('0x4')]=function(_0x1c8d9d){for(var _0x38acf3=0x0,_0x881a8e=events[_0x7ed3('0x5')];_0x38acf3<_0x881a8e;_0x38acf3++){var _0x3f7b83=events[_0x38acf3];var _0x4a58e5=createListener(_0x7ed3('0x6')+_0x3f7b83,_0x1c8d9d);FaxQueueEvents['on'](_0x3f7b83,_0x4a58e5);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 22d5fbd..9dec0c6 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x339dd4,_0x4c1563){var _0x10992f=function(_0x44a770){while(--_0x44a770){_0x339dd4['push'](_0x339dd4['shift']());}};_0x10992f(++_0x4c1563);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x207abf,_0x33cf2e){_0x207abf=_0x207abf-0x0;var _0x481744=_0xb10b[_0x207abf];return _0x481744;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2276b95..edf8750 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 _0xa93c=['STRING','DATE','moment','sequelize'];(function(_0x11fb34,_0x14675b){var _0x160715=function(_0x44e959){while(--_0x44e959){_0x11fb34['push'](_0x11fb34['shift']());}};_0x160715(++_0x14675b);}(_0xa93c,0x192));var _0xca93=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0xa93c[_0x552fce];return _0x3e27a2;};'use strict';var moment=require(_0xca93('0x0'));var Sequelize=require(_0xca93('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xca93('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xca93('0x2')]},'joinAt':{'type':Sequelize[_0xca93('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xca93('0x3')]},'exitAt':{'type':Sequelize[_0xca93('0x3')]},'reason':{'type':Sequelize[_0xca93('0x2')]}}; \ No newline at end of file +var _0x8b33=['exports','STRING','DATE','sequelize'];(function(_0x139983,_0x484503){var _0x404b84=function(_0x255da4){while(--_0x255da4){_0x139983['push'](_0x139983['shift']());}};_0x404b84(++_0x484503);}(_0x8b33,0xf3));var _0x38b3=function(_0x492eae,_0x4917f0){_0x492eae=_0x492eae-0x0;var _0x30de1c=_0x8b33[_0x492eae];return _0x30de1c;};'use strict';var moment=require('moment');var Sequelize=require(_0x38b3('0x0'));module[_0x38b3('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x38b3('0x2')]},'joinAt':{'type':Sequelize[_0x38b3('0x3')]},'leaveAt':{'type':Sequelize[_0x38b3('0x3')]},'acceptAt':{'type':Sequelize[_0x38b3('0x3')]},'exitAt':{'type':Sequelize[_0x38b3('0x3')]},'reason':{'type':Sequelize[_0x38b3('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 820be03..0e50db0 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 _0x93ef=['map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','type','model'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0x93ef,0x64));var _0xf93e=function(_0x1425c7,_0x53d2dd){_0x1425c7=_0x1425c7-0x0;var _0x15ee43=_0x93ef[_0x1425c7];return _0x15ee43;};'use strict';var pdf=require(_0xf93e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf93e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf93e('0x2'));var rp=require(_0xf93e('0x3'));var moment=require(_0xf93e('0x4'));var BPromise=require(_0xf93e('0x5'));var Mustache=require(_0xf93e('0x6'));var util=require(_0xf93e('0x7'));var path=require('path');var sox=require(_0xf93e('0x8'));var csv=require(_0xf93e('0x9'));var ejs=require(_0xf93e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf93e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf93e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf93e('0xd'));var Papa=require('papaparse');var Redis=require(_0xf93e('0xe'));var authService=require(_0xf93e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf93e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf93e('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf93e('0x12'));var licenseUtil=require(_0xf93e('0x13'));var db=require(_0xf93e('0x14'))['db'];function respondWithStatusCode(_0x5d572e,_0x412a7e){_0x412a7e=_0x412a7e||0xcc;return function(_0x278290){if(_0x278290){return _0x5d572e[_0xf93e('0x15')](_0x412a7e);}return _0x5d572e[_0xf93e('0x16')](_0x412a7e)[_0xf93e('0x17')]();};}function respondWithResult(_0x87bc,_0x2406c8){_0x2406c8=_0x2406c8||0xc8;return function(_0x589c1a){if(_0x589c1a){return _0x87bc[_0xf93e('0x16')](_0x2406c8)[_0xf93e('0x18')](_0x589c1a);}};}function respondWithFilteredResult(_0x46358c,_0x5843b8){return function(_0x5e3f6b){if(_0x5e3f6b){var _0x3d587d=_0x5e3f6b[_0xf93e('0x19')],_0x4034ee=_0x5843b8[_0xf93e('0x1a')],_0x40101e=_0x5843b8[_0xf93e('0x1a')]+_0x5843b8[_0xf93e('0x1b')],_0xbc37a1;if(_0x40101e>=_0x3d587d){_0x40101e=_0x3d587d;_0xbc37a1=0xc8;}else{_0xbc37a1=0xce;}_0x46358c[_0xf93e('0x16')](_0xbc37a1);return _0x46358c[_0xf93e('0x1c')](_0xf93e('0x1d'),_0x4034ee+'-'+_0x40101e+'/'+_0x3d587d)[_0xf93e('0x18')](_0x5e3f6b);}return null;};}function patchUpdates(_0x3917fb){return function(_0x49039b){try{jsonpatch[_0xf93e('0x1e')](_0x49039b,_0x3917fb,!![]);}catch(_0x2f4656){return BPromise[_0xf93e('0x1f')](_0x2f4656);}return _0x49039b[_0xf93e('0x20')]();};}function saveUpdates(_0x44b511,_0x22ad80){return function(_0xaace8d){if(_0xaace8d){return _0xaace8d['update'](_0x44b511)[_0xf93e('0x21')](function(_0x42be0e){return _0x42be0e;});}return null;};}function removeEntity(_0x20f69d,_0x57184f){return function(_0x401527){if(_0x401527){return _0x401527[_0xf93e('0x22')]()[_0xf93e('0x21')](function(){_0x20f69d[_0xf93e('0x16')](0xcc)[_0xf93e('0x17')]();});}};}function handleEntityNotFound(_0x1cb56,_0x30aec8){return function(_0x3b69dc){if(!_0x3b69dc){_0x1cb56[_0xf93e('0x15')](0x194);}return _0x3b69dc;};}function handleError(_0x3a21cc,_0x5f29fa){_0x5f29fa=_0x5f29fa||0x1f4;return function(_0x55c521){logger[_0xf93e('0x23')](_0x55c521[_0xf93e('0x24')]);if(_0x55c521[_0xf93e('0x25')]){delete _0x55c521[_0xf93e('0x25')];}_0x3a21cc['status'](_0x5f29fa)[_0xf93e('0x26')](_0x55c521);};}exports[_0xf93e('0x27')]=function(_0x49c558,_0x24c663){var _0x250ce7={},_0x1c51e3={},_0x58a01e={'count':0x0,'rows':[]};var _0x491b47=_['map'](db[_0xf93e('0x28')][_0xf93e('0x29')],function(_0x377a49){return{'name':_0x377a49['fieldName'],'type':_0x377a49[_0xf93e('0x2a')]['key']};});_0x1c51e3[_0xf93e('0x2b')]=_[_0xf93e('0x2c')](_0x491b47,_0xf93e('0x25'));_0x1c51e3[_0xf93e('0x2d')]=_[_0xf93e('0x2e')](_0x49c558[_0xf93e('0x2d')]);_0x1c51e3[_0xf93e('0x2f')]=_[_0xf93e('0x30')](_0x1c51e3[_0xf93e('0x2b')],_0x1c51e3[_0xf93e('0x2d')]);_0x250ce7[_0xf93e('0x31')]=_['intersection'](_0x1c51e3[_0xf93e('0x2b')],qs[_0xf93e('0x32')](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x32')]));_0x250ce7['attributes']=_0x250ce7[_0xf93e('0x31')][_0xf93e('0x33')]?_0x250ce7[_0xf93e('0x31')]:_0x1c51e3['model'];if(!_0x49c558[_0xf93e('0x2d')]['hasOwnProperty'](_0xf93e('0x34'))){_0x250ce7[_0xf93e('0x1b')]=qs['limit'](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x1b')]);_0x250ce7[_0xf93e('0x1a')]=qs[_0xf93e('0x1a')](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x1a')]);}_0x250ce7[_0xf93e('0x35')]=qs[_0xf93e('0x36')](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x36')]);_0x250ce7[_0xf93e('0x37')]=qs[_0xf93e('0x2f')](_[_0xf93e('0x38')](_0x49c558[_0xf93e('0x2d')],_0x1c51e3['filters']),_0x491b47);if(_0x49c558[_0xf93e('0x2d')][_0xf93e('0x39')]){_0x250ce7['where']=_[_0xf93e('0x3a')](_0x250ce7[_0xf93e('0x37')],{'$or':_[_0xf93e('0x2c')](_0x491b47,function(_0x2956bf){if(_0x2956bf[_0xf93e('0x2a')]!==_0xf93e('0x3b')){var _0x5d0901={};_0x5d0901[_0x2956bf[_0xf93e('0x25')]]={'$like':'%'+_0x49c558[_0xf93e('0x2d')][_0xf93e('0x39')]+'%'};return _0x5d0901;}})});}_0x250ce7=_[_0xf93e('0x3a')]({},_0x250ce7,_0x49c558[_0xf93e('0x3c')]);var _0x1e3b06={'where':_0x250ce7['where']};return db[_0xf93e('0x28')][_0xf93e('0x19')](_0x1e3b06)[_0xf93e('0x21')](function(_0x409e14){_0x58a01e['count']=_0x409e14;if(_0x49c558['query'][_0xf93e('0x3d')]){_0x250ce7[_0xf93e('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xf93e('0x3f')](_0x250ce7);})[_0xf93e('0x21')](function(_0x86bade){_0x58a01e['rows']=_0x86bade;return _0x58a01e;})[_0xf93e('0x21')](respondWithFilteredResult(_0x24c663,_0x250ce7))[_0xf93e('0x40')](handleError(_0x24c663,null));};exports[_0xf93e('0x41')]=function(_0x56a3d1,_0x3c8f3d){var _0x358990={'raw':!![],'where':{'id':_0x56a3d1[_0xf93e('0x42')]['id']}},_0x1adb29={};_0x1adb29[_0xf93e('0x2b')]=_['keys'](db[_0xf93e('0x28')][_0xf93e('0x29')]);_0x1adb29[_0xf93e('0x2d')]=_[_0xf93e('0x2e')](_0x56a3d1[_0xf93e('0x2d')]);_0x1adb29['filters']=_[_0xf93e('0x30')](_0x1adb29[_0xf93e('0x2b')],_0x1adb29[_0xf93e('0x2d')]);_0x358990[_0xf93e('0x31')]=_[_0xf93e('0x30')](_0x1adb29[_0xf93e('0x2b')],qs['fields'](_0x56a3d1['query'][_0xf93e('0x32')]));_0x358990[_0xf93e('0x31')]=_0x358990[_0xf93e('0x31')][_0xf93e('0x33')]?_0x358990[_0xf93e('0x31')]:_0x1adb29[_0xf93e('0x2b')];if(_0x56a3d1[_0xf93e('0x2d')][_0xf93e('0x3d')]){_0x358990[_0xf93e('0x3e')]=[{'all':!![]}];}_0x358990=_[_0xf93e('0x3a')]({},_0x358990,_0x56a3d1['options']);return db[_0xf93e('0x28')][_0xf93e('0x43')](_0x358990)[_0xf93e('0x21')](handleEntityNotFound(_0x3c8f3d,null))[_0xf93e('0x21')](respondWithResult(_0x3c8f3d,null))[_0xf93e('0x40')](handleError(_0x3c8f3d,null));};exports[_0xf93e('0x44')]=function(_0x592440,_0x5973fe){return db['FaxQueueReport'][_0xf93e('0x44')](_0x592440[_0xf93e('0x45')],{})[_0xf93e('0x21')](respondWithResult(_0x5973fe,0xc9))[_0xf93e('0x40')](handleError(_0x5973fe,null));};exports[_0xf93e('0x46')]=function(_0x59cd41,_0x51dc67){if(_0x59cd41['body']['id']){delete _0x59cd41['body']['id'];}return db[_0xf93e('0x28')][_0xf93e('0x43')]({'where':{'id':_0x59cd41[_0xf93e('0x42')]['id']}})[_0xf93e('0x21')](handleEntityNotFound(_0x51dc67,null))['then'](saveUpdates(_0x59cd41[_0xf93e('0x45')],null))[_0xf93e('0x21')](respondWithResult(_0x51dc67,null))[_0xf93e('0x40')](handleError(_0x51dc67,null));};exports[_0xf93e('0x22')]=function(_0x55cc32,_0x1b3584){return db['FaxQueueReport']['find']({'where':{'id':_0x55cc32[_0xf93e('0x42')]['id']}})[_0xf93e('0x21')](handleEntityNotFound(_0x1b3584,null))[_0xf93e('0x21')](removeEntity(_0x1b3584,null))[_0xf93e('0x40')](handleError(_0x1b3584,null));};exports[_0xf93e('0x47')]=function(_0x23e9c3,_0x2432c7){return db[_0xf93e('0x28')]['describe']()[_0xf93e('0x21')](respondWithResult(_0x2432c7,null))[_0xf93e('0x40')](handleError(_0x2432c7,null));}; \ No newline at end of file +var _0x0476=['reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','FaxQueueReport','includeAll','include','rows','catch','params','keys','length','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x5288f7,_0x10b7ed){var _0x841e7e=function(_0xd95c29){while(--_0xd95c29){_0x5288f7['push'](_0x5288f7['shift']());}};_0x841e7e(++_0x10b7ed);}(_0x0476,0x1e3));var _0x6047=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x0476[_0x350343];return _0x9afc1c;};'use strict';var pdf=require(_0x6047('0x0'));var emlformat=require(_0x6047('0x1'));var rimraf=require(_0x6047('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6047('0x3'));var rp=require(_0x6047('0x4'));var moment=require(_0x6047('0x5'));var BPromise=require(_0x6047('0x6'));var Mustache=require(_0x6047('0x7'));var util=require(_0x6047('0x8'));var path=require(_0x6047('0x9'));var sox=require(_0x6047('0xa'));var csv=require(_0x6047('0xb'));var ejs=require(_0x6047('0xc'));var fs=require('fs');var _=require(_0x6047('0xd'));var squel=require(_0x6047('0xe'));var crypto=require(_0x6047('0xf'));var jsforce=require(_0x6047('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6047('0xb'));var querystring=require(_0x6047('0x11'));var Papa=require('papaparse');var Redis=require(_0x6047('0x12'));var authService=require(_0x6047('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6047('0x14'));var logger=require(_0x6047('0x15'))(_0x6047('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6047('0x17'));var db=require(_0x6047('0x18'))['db'];function respondWithStatusCode(_0x3a883e,_0x5dcabb){_0x5dcabb=_0x5dcabb||0xcc;return function(_0x129008){if(_0x129008){return _0x3a883e[_0x6047('0x19')](_0x5dcabb);}return _0x3a883e[_0x6047('0x1a')](_0x5dcabb)[_0x6047('0x1b')]();};}function respondWithResult(_0x2c979c,_0x41f704){_0x41f704=_0x41f704||0xc8;return function(_0x393fea){if(_0x393fea){return _0x2c979c[_0x6047('0x1a')](_0x41f704)[_0x6047('0x1c')](_0x393fea);}};}function respondWithFilteredResult(_0x1638ad,_0x3456f7){return function(_0x2a639d){if(_0x2a639d){var _0x405cb8=_0x2a639d[_0x6047('0x1d')],_0x5d6073=_0x3456f7[_0x6047('0x1e')],_0x5e88e7=_0x3456f7[_0x6047('0x1e')]+_0x3456f7[_0x6047('0x1f')],_0x11d9bf;if(_0x5e88e7>=_0x405cb8){_0x5e88e7=_0x405cb8;_0x11d9bf=0xc8;}else{_0x11d9bf=0xce;}_0x1638ad[_0x6047('0x1a')](_0x11d9bf);return _0x1638ad[_0x6047('0x20')](_0x6047('0x21'),_0x5d6073+'-'+_0x5e88e7+'/'+_0x405cb8)[_0x6047('0x1c')](_0x2a639d);}return null;};}function patchUpdates(_0x3fb253){return function(_0x4595ee){try{jsonpatch[_0x6047('0x22')](_0x4595ee,_0x3fb253,!![]);}catch(_0x4c9d43){return BPromise[_0x6047('0x23')](_0x4c9d43);}return _0x4595ee[_0x6047('0x24')]();};}function saveUpdates(_0x55ee16,_0x45b1d1){return function(_0x195893){if(_0x195893){return _0x195893[_0x6047('0x25')](_0x55ee16)[_0x6047('0x26')](function(_0x1999dc){return _0x1999dc;});}return null;};}function removeEntity(_0x1e02eb,_0x86178f){return function(_0xf51d97){if(_0xf51d97){return _0xf51d97['destroy']()[_0x6047('0x26')](function(){_0x1e02eb[_0x6047('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x476449,_0x26ddca){return function(_0x3d2190){if(!_0x3d2190){_0x476449[_0x6047('0x19')](0x194);}return _0x3d2190;};}function handleError(_0x5ed390,_0x4d95da){_0x4d95da=_0x4d95da||0x1f4;return function(_0x52bfe2){logger[_0x6047('0x27')](_0x52bfe2[_0x6047('0x28')]);if(_0x52bfe2[_0x6047('0x29')]){delete _0x52bfe2['name'];}_0x5ed390[_0x6047('0x1a')](_0x4d95da)['send'](_0x52bfe2);};}exports[_0x6047('0x2a')]=function(_0x4341b2,_0x13ab38){var _0x38f5c0={},_0x53d52e={},_0x46a994={'count':0x0,'rows':[]};var _0x317c70=_[_0x6047('0x2b')](db['FaxQueueReport'][_0x6047('0x2c')],function(_0xdd1e73){return{'name':_0xdd1e73[_0x6047('0x2d')],'type':_0xdd1e73[_0x6047('0x2e')][_0x6047('0x2f')]};});_0x53d52e['model']=_[_0x6047('0x2b')](_0x317c70,_0x6047('0x29'));_0x53d52e[_0x6047('0x30')]=_['keys'](_0x4341b2[_0x6047('0x30')]);_0x53d52e[_0x6047('0x31')]=_[_0x6047('0x32')](_0x53d52e[_0x6047('0x33')],_0x53d52e[_0x6047('0x30')]);_0x38f5c0['attributes']=_[_0x6047('0x32')](_0x53d52e['model'],qs[_0x6047('0x34')](_0x4341b2[_0x6047('0x30')]['fields']));_0x38f5c0[_0x6047('0x35')]=_0x38f5c0['attributes']['length']?_0x38f5c0[_0x6047('0x35')]:_0x53d52e[_0x6047('0x33')];if(!_0x4341b2[_0x6047('0x30')][_0x6047('0x36')]('nolimit')){_0x38f5c0[_0x6047('0x1f')]=qs[_0x6047('0x1f')](_0x4341b2[_0x6047('0x30')][_0x6047('0x1f')]);_0x38f5c0[_0x6047('0x1e')]=qs[_0x6047('0x1e')](_0x4341b2[_0x6047('0x30')][_0x6047('0x1e')]);}_0x38f5c0['order']=qs[_0x6047('0x37')](_0x4341b2['query'][_0x6047('0x37')]);_0x38f5c0[_0x6047('0x38')]=qs[_0x6047('0x31')](_[_0x6047('0x39')](_0x4341b2[_0x6047('0x30')],_0x53d52e[_0x6047('0x31')]),_0x317c70);if(_0x4341b2[_0x6047('0x30')][_0x6047('0x3a')]){_0x38f5c0[_0x6047('0x38')]=_['merge'](_0x38f5c0[_0x6047('0x38')],{'$or':_[_0x6047('0x2b')](_0x317c70,function(_0x3abddb){if(_0x3abddb[_0x6047('0x2e')]!=='VIRTUAL'){var _0x2e1464={};_0x2e1464[_0x3abddb[_0x6047('0x29')]]={'$like':'%'+_0x4341b2[_0x6047('0x30')]['filter']+'%'};return _0x2e1464;}})});}_0x38f5c0=_[_0x6047('0x3b')]({},_0x38f5c0,_0x4341b2['options']);var _0x4f0603={'where':_0x38f5c0['where']};return db[_0x6047('0x3c')][_0x6047('0x1d')](_0x4f0603)['then'](function(_0x7e187f){_0x46a994['count']=_0x7e187f;if(_0x4341b2[_0x6047('0x30')][_0x6047('0x3d')]){_0x38f5c0[_0x6047('0x3e')]=[{'all':!![]}];}return db[_0x6047('0x3c')]['findAll'](_0x38f5c0);})[_0x6047('0x26')](function(_0x3aa801){_0x46a994[_0x6047('0x3f')]=_0x3aa801;return _0x46a994;})[_0x6047('0x26')](respondWithFilteredResult(_0x13ab38,_0x38f5c0))[_0x6047('0x40')](handleError(_0x13ab38,null));};exports['show']=function(_0x25ad1a,_0x5a7f4c){var _0x222ac5={'raw':!![],'where':{'id':_0x25ad1a[_0x6047('0x41')]['id']}},_0x47fbc3={};_0x47fbc3[_0x6047('0x33')]=_[_0x6047('0x42')](db[_0x6047('0x3c')]['rawAttributes']);_0x47fbc3[_0x6047('0x30')]=_[_0x6047('0x42')](_0x25ad1a['query']);_0x47fbc3[_0x6047('0x31')]=_['intersection'](_0x47fbc3[_0x6047('0x33')],_0x47fbc3[_0x6047('0x30')]);_0x222ac5[_0x6047('0x35')]=_[_0x6047('0x32')](_0x47fbc3['model'],qs[_0x6047('0x34')](_0x25ad1a[_0x6047('0x30')][_0x6047('0x34')]));_0x222ac5[_0x6047('0x35')]=_0x222ac5[_0x6047('0x35')][_0x6047('0x43')]?_0x222ac5[_0x6047('0x35')]:_0x47fbc3['model'];if(_0x25ad1a[_0x6047('0x30')][_0x6047('0x3d')]){_0x222ac5[_0x6047('0x3e')]=[{'all':!![]}];}_0x222ac5=_[_0x6047('0x3b')]({},_0x222ac5,_0x25ad1a[_0x6047('0x44')]);return db[_0x6047('0x3c')][_0x6047('0x45')](_0x222ac5)[_0x6047('0x26')](handleEntityNotFound(_0x5a7f4c,null))['then'](respondWithResult(_0x5a7f4c,null))[_0x6047('0x40')](handleError(_0x5a7f4c,null));};exports[_0x6047('0x46')]=function(_0xf5d68e,_0x48c591){return db['FaxQueueReport'][_0x6047('0x46')](_0xf5d68e[_0x6047('0x47')],{})[_0x6047('0x26')](respondWithResult(_0x48c591,0xc9))[_0x6047('0x40')](handleError(_0x48c591,null));};exports[_0x6047('0x25')]=function(_0x27d524,_0xfc1e63){if(_0x27d524[_0x6047('0x47')]['id']){delete _0x27d524[_0x6047('0x47')]['id'];}return db[_0x6047('0x3c')][_0x6047('0x45')]({'where':{'id':_0x27d524[_0x6047('0x41')]['id']}})[_0x6047('0x26')](handleEntityNotFound(_0xfc1e63,null))['then'](saveUpdates(_0x27d524[_0x6047('0x47')],null))[_0x6047('0x26')](respondWithResult(_0xfc1e63,null))[_0x6047('0x40')](handleError(_0xfc1e63,null));};exports[_0x6047('0x48')]=function(_0x2a5824,_0x48b9ed){return db[_0x6047('0x3c')]['find']({'where':{'id':_0x2a5824[_0x6047('0x41')]['id']}})['then'](handleEntityNotFound(_0x48b9ed,null))[_0x6047('0x26')](removeEntity(_0x48b9ed,null))[_0x6047('0x40')](handleError(_0x48b9ed,null));};exports['describe']=function(_0x182999,_0x325419){return db['FaxQueueReport'][_0x6047('0x49')]()[_0x6047('0x26')](respondWithResult(_0x325419,null))[_0x6047('0x40')](handleError(_0x325419,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e202a4c..3ede153 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 _0x807c=['FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define'];(function(_0x34bbd5,_0x3c810a){var _0x46244f=function(_0x5884b9){while(--_0x5884b9){_0x34bbd5['push'](_0x34bbd5['shift']());}};_0x46244f(++_0x3c810a);}(_0x807c,0x6b));var _0xc807=function(_0x215dfe,_0x1e4c2d){_0x215dfe=_0x215dfe-0x0;var _0x191cc0=_0x807c[_0x215dfe];return _0x191cc0;};'use strict';var _=require(_0xc807('0x0'));var util=require(_0xc807('0x1'));var logger=require('../../config/logger')(_0xc807('0x2'));var moment=require(_0xc807('0x3'));var BPromise=require('bluebird');var rp=require(_0xc807('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc807('0x5'));var config=require(_0xc807('0x6'));var attributes=require(_0xc807('0x7'));module[_0xc807('0x8')]=function(_0x4e8ff1,_0xf331be){return _0x4e8ff1[_0xc807('0x9')](_0xc807('0xa'),attributes,{'tableName':_0xc807('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc807('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3035=['rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','util','api','moment','path'];(function(_0x3ac7b9,_0x87900c){var _0x44f569=function(_0x28f8e4){while(--_0x28f8e4){_0x3ac7b9['push'](_0x3ac7b9['shift']());}};_0x44f569(++_0x87900c);}(_0x3035,0x16e));var _0x5303=function(_0x14f0aa,_0x381620){_0x14f0aa=_0x14f0aa-0x0;var _0x5006f0=_0x3035[_0x14f0aa];return _0x5006f0;};'use strict';var _=require('lodash');var util=require(_0x5303('0x0'));var logger=require('../../config/logger')(_0x5303('0x1'));var moment=require(_0x5303('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5303('0x3'));var rimraf=require(_0x5303('0x4'));var config=require('../../config/environment');var attributes=require(_0x5303('0x5'));module[_0x5303('0x6')]=function(_0x6d26a5,_0x4a766b){return _0x6d26a5[_0x5303('0x7')](_0x5303('0x8'),attributes,{'tableName':_0x5303('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8e539b7..01c1386 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 _0x5b7a=['../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','body','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x98c949,_0x23c676){var _0x35a92f=function(_0x202ef4){while(--_0x202ef4){_0x98c949['push'](_0x98c949['shift']());}};_0x35a92f(++_0x23c676);}(_0x5b7a,0xf1));var _0xa5b7=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5b7a[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require(_0xa5b7('0x0'));var moment=require(_0xa5b7('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5b7('0x2'));var fs=require('fs');var Redis=require(_0xa5b7('0x3'));var db=require(_0xa5b7('0x4'))['db'];var utils=require(_0xa5b7('0x5'));var logger=require(_0xa5b7('0x6'))('rpc');var config=require(_0xa5b7('0x7'));var jayson=require(_0xa5b7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c72f4,_0x156e5b,_0x519773){return new BPromise(function(_0x284e34,_0xe5ce32){return client[_0xa5b7('0x9')](_0x5c72f4,_0x519773)[_0xa5b7('0xa')](function(_0xe55feb){logger[_0xa5b7('0xb')](_0xa5b7('0xc'),_0x156e5b,_0xa5b7('0xd'));logger[_0xa5b7('0xe')](_0xa5b7('0xf'),_0x156e5b,'request\x20sent',JSON[_0xa5b7('0x10')](_0xe55feb));if(_0xe55feb[_0xa5b7('0x11')]){if(_0xe55feb['error'][_0xa5b7('0x12')]===0x1f4){logger[_0xa5b7('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x156e5b,_0xe55feb[_0xa5b7('0x11')]['message']);return _0xe5ce32(_0xe55feb['error'][_0xa5b7('0x13')]);}logger[_0xa5b7('0x11')](_0xa5b7('0xc'),_0x156e5b,_0xe55feb[_0xa5b7('0x11')][_0xa5b7('0x13')]);return _0x284e34(_0xe55feb['error']['message']);}else{logger[_0xa5b7('0xb')](_0xa5b7('0xc'),_0x156e5b,_0xa5b7('0xd'));_0x284e34(_0xe55feb[_0xa5b7('0x14')]['message']);}})[_0xa5b7('0x15')](function(_0x2803a7){logger[_0xa5b7('0x11')](_0xa5b7('0xc'),_0x156e5b,_0x2803a7);_0xe5ce32(_0x2803a7);});});}exports[_0xa5b7('0x16')]=function(_0x5d5b3b){var _0xb60936=this;return new Promise(function(_0x2ff513,_0x4c26d6){return db[_0xa5b7('0x17')]['create'](_0x5d5b3b['body'],{'raw':_0x5d5b3b[_0xa5b7('0x18')]?_0x5d5b3b[_0xa5b7('0x18')][_0xa5b7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1fa020){logger[_0xa5b7('0xb')](_0xa5b7('0x16'),_0x5d5b3b);logger['debug'](_0xa5b7('0x16'),_0x5d5b3b,JSON[_0xa5b7('0x10')](_0x1fa020));_0x2ff513(_0x1fa020);})[_0xa5b7('0x15')](function(_0x2e63d9){logger[_0xa5b7('0x11')](_0xa5b7('0x16'),_0x2e63d9['message'],_0x5d5b3b);_0x4c26d6(_0xb60936[_0xa5b7('0x11')](0x1f4,_0x2e63d9[_0xa5b7('0x13')]));});});};exports[_0xa5b7('0x1a')]=function(_0x43523b){var _0xc6ba21=this;return new Promise(function(_0x477069,_0x5bef35){return db[_0xa5b7('0x17')]['update'](_0x43523b[_0xa5b7('0x1b')],{'raw':_0x43523b['options']?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43523b[_0xa5b7('0x18')]?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x1c')]||null:null,'attributes':_0x43523b[_0xa5b7('0x18')]?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x1d')]||null:null,'limit':_0x43523b[_0xa5b7('0x18')]?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x1e')]||null:null})[_0xa5b7('0xa')](function(_0xe9645e){logger['info']('UpdateFaxQueueReport',_0x43523b);logger[_0xa5b7('0xe')]('UpdateFaxQueueReport',_0x43523b,JSON[_0xa5b7('0x10')](_0xe9645e));_0x477069(_0xe9645e);})[_0xa5b7('0x15')](function(_0x2d579e){logger[_0xa5b7('0x11')]('UpdateFaxQueueReport',_0x2d579e[_0xa5b7('0x13')],_0x43523b);_0x5bef35(_0xc6ba21[_0xa5b7('0x11')](0x1f4,_0x2d579e[_0xa5b7('0x13')]));});});}; \ No newline at end of file +var _0x9a1b=['update','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','stringify','UpdateFaxQueueReport'];(function(_0x1477fd,_0x331b40){var _0x770335=function(_0x1fb278){while(--_0x1fb278){_0x1477fd['push'](_0x1477fd['shift']());}};_0x770335(++_0x331b40);}(_0x9a1b,0xf9));var _0xb9a1=function(_0x388fba,_0x2da98c){_0x388fba=_0x388fba-0x0;var _0x134d03=_0x9a1b[_0x388fba];return _0x134d03;};'use strict';var _=require(_0xb9a1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb9a1('0x1'));var rs=require(_0xb9a1('0x2'));var fs=require('fs');var Redis=require(_0xb9a1('0x3'));var db=require(_0xb9a1('0x4'))['db'];var utils=require(_0xb9a1('0x5'));var logger=require(_0xb9a1('0x6'))('rpc');var config=require(_0xb9a1('0x7'));var jayson=require(_0xb9a1('0x8'));var client=jayson[_0xb9a1('0x9')][_0xb9a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57d2be,_0x567bb5,_0x4b1b29){return new BPromise(function(_0x18d40d,_0x573ac5){return client['request'](_0x57d2be,_0x4b1b29)[_0xb9a1('0xb')](function(_0x3eb6fa){logger[_0xb9a1('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x567bb5,_0xb9a1('0xd'));logger['debug'](_0xb9a1('0xe'),_0x567bb5,'request\x20sent',JSON['stringify'](_0x3eb6fa));if(_0x3eb6fa['error']){if(_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x10')]===0x1f4){logger[_0xb9a1('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x567bb5,_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x11')]);return _0x573ac5(_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x11')]);}logger['error'](_0xb9a1('0x12'),_0x567bb5,_0x3eb6fa[_0xb9a1('0xf')][_0xb9a1('0x11')]);return _0x18d40d(_0x3eb6fa['error']['message']);}else{logger[_0xb9a1('0xc')](_0xb9a1('0x12'),_0x567bb5,'request\x20sent');_0x18d40d(_0x3eb6fa[_0xb9a1('0x13')][_0xb9a1('0x11')]);}})[_0xb9a1('0x14')](function(_0x336c62){logger[_0xb9a1('0xf')](_0xb9a1('0x12'),_0x567bb5,_0x336c62);_0x573ac5(_0x336c62);});});}exports['CreateFaxQueueReport']=function(_0x5e39c5){var _0xd189a1=this;return new Promise(function(_0x3e20df,_0x4fd92d){return db[_0xb9a1('0x15')][_0xb9a1('0x16')](_0x5e39c5[_0xb9a1('0x17')],{'raw':_0x5e39c5[_0xb9a1('0x18')]?_0x5e39c5[_0xb9a1('0x18')][_0xb9a1('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1305f2){logger[_0xb9a1('0xc')](_0xb9a1('0x1a'),_0x5e39c5);logger[_0xb9a1('0x1b')](_0xb9a1('0x1a'),_0x5e39c5,JSON[_0xb9a1('0x1c')](_0x1305f2));_0x3e20df(_0x1305f2);})[_0xb9a1('0x14')](function(_0x404bd7){logger[_0xb9a1('0xf')](_0xb9a1('0x1a'),_0x404bd7[_0xb9a1('0x11')],_0x5e39c5);_0x4fd92d(_0xd189a1[_0xb9a1('0xf')](0x1f4,_0x404bd7['message']));});});};exports[_0xb9a1('0x1d')]=function(_0x48e0da){var _0x560e80=this;return new Promise(function(_0x25723d,_0x761374){return db[_0xb9a1('0x15')][_0xb9a1('0x1e')](_0x48e0da['body'],{'raw':_0x48e0da['options']?_0x48e0da[_0xb9a1('0x18')][_0xb9a1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48e0da[_0xb9a1('0x18')]?_0x48e0da[_0xb9a1('0x18')]['where']||null:null,'attributes':_0x48e0da[_0xb9a1('0x18')]?_0x48e0da['options']['attributes']||null:null,'limit':_0x48e0da[_0xb9a1('0x18')]?_0x48e0da[_0xb9a1('0x18')]['limit']||null:null})['then'](function(_0x446f68){logger[_0xb9a1('0xc')](_0xb9a1('0x1d'),_0x48e0da);logger[_0xb9a1('0x1b')](_0xb9a1('0x1d'),_0x48e0da,JSON[_0xb9a1('0x1c')](_0x446f68));_0x25723d(_0x446f68);})[_0xb9a1('0x14')](function(_0x4d978b){logger[_0xb9a1('0xf')](_0xb9a1('0x1d'),_0x4d978b[_0xb9a1('0x11')],_0x48e0da);_0x761374(_0x560e80[_0xb9a1('0xf')](0x1f4,_0x4d978b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 73cd16b..e8996d8 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 _0x02db=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','describe'];(function(_0x148018,_0x36e54a){var _0x516627=function(_0x50c816){while(--_0x50c816){_0x148018['push'](_0x148018['shift']());}};_0x516627(++_0x36e54a);}(_0x02db,0x1a8));var _0xb02d=function(_0x515c5b,_0x3f6632){_0x515c5b=_0x515c5b-0x0;var _0x112f20=_0x02db[_0x515c5b];return _0x112f20;};'use strict';var multer=require(_0xb02d('0x0'));var util=require(_0xb02d('0x1'));var path=require(_0xb02d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb02d('0x3'));var router=express[_0xb02d('0x4')]();var auth=require(_0xb02d('0x5'));var interaction=require(_0xb02d('0x6'));var config=require(_0xb02d('0x7'));var controller=require(_0xb02d('0x8'));router[_0xb02d('0x9')]('/',auth['isAuthenticated'](),controller[_0xb02d('0xa')]);router[_0xb02d('0x9')](_0xb02d('0xb'),auth['isAuthenticated'](),controller[_0xb02d('0xc')]);router['get'](_0xb02d('0xd'),auth[_0xb02d('0xe')](),controller[_0xb02d('0xf')]);router[_0xb02d('0x10')]('/',auth['isAuthenticated'](),controller[_0xb02d('0x11')]);router[_0xb02d('0x12')](_0xb02d('0xd'),auth['isAuthenticated'](),controller[_0xb02d('0x13')]);router[_0xb02d('0x14')](_0xb02d('0xd'),auth[_0xb02d('0xe')](),controller[_0xb02d('0x15')]);module[_0xb02d('0x16')]=router; \ No newline at end of file +var _0x0711=['/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxQueueReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x30f3da,_0x43498d){var _0x474453=function(_0x489c40){while(--_0x489c40){_0x30f3da['push'](_0x30f3da['shift']());}};_0x474453(++_0x43498d);}(_0x0711,0x124));var _0x1071=function(_0xab949f,_0x13de04){_0xab949f=_0xab949f-0x0;var _0x28ae21=_0x0711[_0xab949f];return _0x28ae21;};'use strict';var multer=require(_0x1071('0x0'));var util=require(_0x1071('0x1'));var path=require(_0x1071('0x2'));var timeout=require(_0x1071('0x3'));var express=require(_0x1071('0x4'));var router=express[_0x1071('0x5')]();var auth=require(_0x1071('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1071('0x7'));router[_0x1071('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1071('0x8')](_0x1071('0x9'),auth[_0x1071('0xa')](),controller[_0x1071('0xb')]);router[_0x1071('0x8')](_0x1071('0xc'),auth['isAuthenticated'](),controller[_0x1071('0xd')]);router['post']('/',auth[_0x1071('0xa')](),controller['create']);router['put'](_0x1071('0xc'),auth['isAuthenticated'](),controller[_0x1071('0xe')]);router['delete'](_0x1071('0xc'),auth[_0x1071('0xa')](),controller[_0x1071('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index bf54599..7831a0b 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 _0xc7d3=['ENUM','account','agent','queue','NOW','moment','exports'];(function(_0x5918ca,_0x3eaf77){var _0x19180b=function(_0xa1a973){while(--_0xa1a973){_0x5918ca['push'](_0x5918ca['shift']());}};_0x19180b(++_0x3eaf77);}(_0xc7d3,0x140));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x3c7d('0x0'));var Sequelize=require('sequelize');module[_0x3c7d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3c7d('0x2')](_0x3c7d('0x3'),_0x3c7d('0x4'),'queue'),'allowNull':![],'defaultValue':_0x3c7d('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x3c7d('0x6')]}}; \ No newline at end of file +var _0x647b=['ENUM','account','queue','NOW','moment','STRING'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x647b,0x8e));var _0xb647=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x647b[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xb647('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb647('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb647('0x2')](_0xb647('0x3'),'agent',_0xb647('0x4')),'allowNull':![],'defaultValue':_0xb647('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb647('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6ba8a1a..daaba83 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 _0xf50b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','body','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x129f2f,_0xe330aa){var _0x53504a=function(_0x566052){while(--_0x566052){_0x129f2f['push'](_0x129f2f['shift']());}};_0x53504a(++_0xe330aa);}(_0xf50b,0xc8));var _0xbf50=function(_0x3f18db,_0x5399b7){_0x3f18db=_0x3f18db-0x0;var _0x374b23=_0xf50b[_0x3f18db];return _0x374b23;};'use strict';var pdf=require(_0xbf50('0x0'));var emlformat=require(_0xbf50('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbf50('0x2'));var jsonpatch=require(_0xbf50('0x3'));var rp=require(_0xbf50('0x4'));var moment=require(_0xbf50('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbf50('0x6'));var util=require('util');var path=require(_0xbf50('0x7'));var sox=require(_0xbf50('0x8'));var csv=require(_0xbf50('0x9'));var ejs=require(_0xbf50('0xa'));var fs=require('fs');var _=require(_0xbf50('0xb'));var squel=require(_0xbf50('0xc'));var crypto=require(_0xbf50('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf50('0xe'));var toCsv=require(_0xbf50('0x9'));var querystring=require(_0xbf50('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbf50('0x10'));var qs=require(_0xbf50('0x11'));var as=require(_0xbf50('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf50('0x13'))(_0xbf50('0x14'));var utils=require(_0xbf50('0x15'));var config=require(_0xbf50('0x16'));var licenseUtil=require(_0xbf50('0x17'));var db=require(_0xbf50('0x18'))['db'];function respondWithStatusCode(_0xca370a,_0x520aaa){_0x520aaa=_0x520aaa||0xcc;return function(_0x3f472d){if(_0x3f472d){return _0xca370a[_0xbf50('0x19')](_0x520aaa);}return _0xca370a[_0xbf50('0x1a')](_0x520aaa)[_0xbf50('0x1b')]();};}function respondWithResult(_0x151dd6,_0x5b12e9){_0x5b12e9=_0x5b12e9||0xc8;return function(_0x554d70){if(_0x554d70){return _0x151dd6['status'](_0x5b12e9)[_0xbf50('0x1c')](_0x554d70);}};}function respondWithFilteredResult(_0x5df099,_0x1d09b2){return function(_0x242a58){if(_0x242a58){var _0x47719b=_0x242a58[_0xbf50('0x1d')],_0x531729=_0x1d09b2[_0xbf50('0x1e')],_0xfa5164=_0x1d09b2[_0xbf50('0x1e')]+_0x1d09b2['limit'],_0x5be8ae;if(_0xfa5164>=_0x47719b){_0xfa5164=_0x47719b;_0x5be8ae=0xc8;}else{_0x5be8ae=0xce;}_0x5df099[_0xbf50('0x1a')](_0x5be8ae);return _0x5df099[_0xbf50('0x1f')](_0xbf50('0x20'),_0x531729+'-'+_0xfa5164+'/'+_0x47719b)[_0xbf50('0x1c')](_0x242a58);}return null;};}function patchUpdates(_0x2639d3){return function(_0x4ec323){try{jsonpatch[_0xbf50('0x21')](_0x4ec323,_0x2639d3,!![]);}catch(_0x1912b8){return BPromise[_0xbf50('0x22')](_0x1912b8);}return _0x4ec323[_0xbf50('0x23')]();};}function saveUpdates(_0x21763f,_0x5a30db){return function(_0x3805e9){if(_0x3805e9){return _0x3805e9[_0xbf50('0x24')](_0x21763f)[_0xbf50('0x25')](function(_0x3424de){return _0x3424de;});}return null;};}function removeEntity(_0x3c3839,_0x2d4854){return function(_0x352fa2){if(_0x352fa2){return _0x352fa2['destroy']()[_0xbf50('0x25')](function(){_0x3c3839[_0xbf50('0x1a')](0xcc)[_0xbf50('0x1b')]();});}};}function handleEntityNotFound(_0x7ef69e,_0x4852ad){return function(_0x3648bf){if(!_0x3648bf){_0x7ef69e[_0xbf50('0x19')](0x194);}return _0x3648bf;};}function handleError(_0x31f9a8,_0x3ddde3){_0x3ddde3=_0x3ddde3||0x1f4;return function(_0x1f1579){logger[_0xbf50('0x26')](_0x1f1579['stack']);if(_0x1f1579[_0xbf50('0x27')]){delete _0x1f1579[_0xbf50('0x27')];}_0x31f9a8[_0xbf50('0x1a')](_0x3ddde3)['send'](_0x1f1579);};}exports['index']=function(_0x2a44c4,_0x53be2e){var _0x3ca677={},_0x53707f={},_0x464366={'count':0x0,'rows':[]};var _0x47b714=_[_0xbf50('0x28')](db[_0xbf50('0x29')][_0xbf50('0x2a')],function(_0x46e3fd){return{'name':_0x46e3fd[_0xbf50('0x2b')],'type':_0x46e3fd[_0xbf50('0x2c')]['key']};});_0x53707f[_0xbf50('0x2d')]=_[_0xbf50('0x28')](_0x47b714,_0xbf50('0x27'));_0x53707f[_0xbf50('0x2e')]=_[_0xbf50('0x2f')](_0x2a44c4[_0xbf50('0x2e')]);_0x53707f[_0xbf50('0x30')]=_[_0xbf50('0x31')](_0x53707f['model'],_0x53707f[_0xbf50('0x2e')]);_0x3ca677[_0xbf50('0x32')]=_[_0xbf50('0x31')](_0x53707f[_0xbf50('0x2d')],qs['fields'](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x33')]));_0x3ca677[_0xbf50('0x32')]=_0x3ca677[_0xbf50('0x32')][_0xbf50('0x34')]?_0x3ca677[_0xbf50('0x32')]:_0x53707f[_0xbf50('0x2d')];if(!_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x35')](_0xbf50('0x36'))){_0x3ca677[_0xbf50('0x37')]=qs['limit'](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x37')]);_0x3ca677['offset']=qs[_0xbf50('0x1e')](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x1e')]);}_0x3ca677[_0xbf50('0x38')]=qs['sort'](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x39')]);_0x3ca677[_0xbf50('0x3a')]=qs[_0xbf50('0x30')](_[_0xbf50('0x3b')](_0x2a44c4['query'],_0x53707f[_0xbf50('0x30')]),_0x47b714);if(_0x2a44c4[_0xbf50('0x2e')]['filter']){_0x3ca677['where']=_[_0xbf50('0x3c')](_0x3ca677[_0xbf50('0x3a')],{'$or':_[_0xbf50('0x28')](_0x47b714,function(_0x104bd2){if(_0x104bd2['type']!==_0xbf50('0x3d')){var _0x486722={};_0x486722[_0x104bd2[_0xbf50('0x27')]]={'$like':'%'+_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x3e')]+'%'};return _0x486722;}})});}_0x3ca677=_[_0xbf50('0x3c')]({},_0x3ca677,_0x2a44c4[_0xbf50('0x3f')]);var _0x2c88a1={'where':_0x3ca677[_0xbf50('0x3a')]};return db[_0xbf50('0x29')][_0xbf50('0x1d')](_0x2c88a1)[_0xbf50('0x25')](function(_0x5542a4){_0x464366['count']=_0x5542a4;if(_0x2a44c4['query'][_0xbf50('0x40')]){_0x3ca677['include']=[{'all':!![]}];}return db[_0xbf50('0x29')]['findAll'](_0x3ca677);})[_0xbf50('0x25')](function(_0x26d93a){_0x464366[_0xbf50('0x41')]=_0x26d93a;return _0x464366;})['then'](respondWithFilteredResult(_0x53be2e,_0x3ca677))[_0xbf50('0x42')](handleError(_0x53be2e,null));};exports[_0xbf50('0x43')]=function(_0x1c9843,_0x297e8e){var _0x540c1f={'raw':!![],'where':{'id':_0x1c9843[_0xbf50('0x44')]['id']}},_0x325f63={};_0x325f63[_0xbf50('0x2d')]=_[_0xbf50('0x2f')](db[_0xbf50('0x29')][_0xbf50('0x2a')]);_0x325f63[_0xbf50('0x2e')]=_[_0xbf50('0x2f')](_0x1c9843[_0xbf50('0x2e')]);_0x325f63[_0xbf50('0x30')]=_[_0xbf50('0x31')](_0x325f63[_0xbf50('0x2d')],_0x325f63[_0xbf50('0x2e')]);_0x540c1f[_0xbf50('0x32')]=_[_0xbf50('0x31')](_0x325f63['model'],qs[_0xbf50('0x33')](_0x1c9843[_0xbf50('0x2e')]['fields']));_0x540c1f['attributes']=_0x540c1f[_0xbf50('0x32')][_0xbf50('0x34')]?_0x540c1f['attributes']:_0x325f63[_0xbf50('0x2d')];if(_0x1c9843[_0xbf50('0x2e')][_0xbf50('0x40')]){_0x540c1f[_0xbf50('0x45')]=[{'all':!![]}];}_0x540c1f=_[_0xbf50('0x3c')]({},_0x540c1f,_0x1c9843['options']);return db[_0xbf50('0x29')]['find'](_0x540c1f)[_0xbf50('0x25')](handleEntityNotFound(_0x297e8e,null))['then'](respondWithResult(_0x297e8e,null))['catch'](handleError(_0x297e8e,null));};exports['create']=function(_0x3e44f3,_0x5c38f1){return db[_0xbf50('0x29')]['create'](_0x3e44f3[_0xbf50('0x46')],{})[_0xbf50('0x25')](respondWithResult(_0x5c38f1,0xc9))[_0xbf50('0x42')](handleError(_0x5c38f1,null));};exports[_0xbf50('0x24')]=function(_0x502d3e,_0x384d09){if(_0x502d3e[_0xbf50('0x46')]['id']){delete _0x502d3e['body']['id'];}return db[_0xbf50('0x29')][_0xbf50('0x47')]({'where':{'id':_0x502d3e[_0xbf50('0x44')]['id']}})[_0xbf50('0x25')](handleEntityNotFound(_0x384d09,null))[_0xbf50('0x25')](saveUpdates(_0x502d3e[_0xbf50('0x46')],null))['then'](respondWithResult(_0x384d09,null))['catch'](handleError(_0x384d09,null));};exports[_0xbf50('0x48')]=function(_0x379c3c,_0x59ba45){return db['FaxTransferReport']['find']({'where':{'id':_0x379c3c['params']['id']}})[_0xbf50('0x25')](handleEntityNotFound(_0x59ba45,null))[_0xbf50('0x25')](removeEntity(_0x59ba45,null))['catch'](handleError(_0x59ba45,null));};exports[_0xbf50('0x49')]=function(_0x5e8800,_0x4ec7bc){return db[_0xbf50('0x29')][_0xbf50('0x49')]()[_0xbf50('0x25')](respondWithResult(_0x4ec7bc,null))['catch'](handleError(_0x4ec7bc,null));}; \ No newline at end of file +var _0xa23f=['json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','map','FaxTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa23f,0x7c));var _0xfa23=function(_0x4cdac7,_0x4110a6){_0x4cdac7=_0x4cdac7-0x0;var _0x217b1d=_0xa23f[_0x4cdac7];return _0x217b1d;};'use strict';var pdf=require(_0xfa23('0x0'));var emlformat=require(_0xfa23('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa23('0x2'));var rp=require(_0xfa23('0x3'));var moment=require(_0xfa23('0x4'));var BPromise=require(_0xfa23('0x5'));var Mustache=require('mustache');var util=require(_0xfa23('0x6'));var path=require('path');var sox=require(_0xfa23('0x7'));var csv=require(_0xfa23('0x8'));var ejs=require(_0xfa23('0x9'));var fs=require('fs');var _=require(_0xfa23('0xa'));var squel=require('squel');var crypto=require(_0xfa23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa23('0xc'));var toCsv=require(_0xfa23('0x8'));var querystring=require(_0xfa23('0xd'));var Papa=require(_0xfa23('0xe'));var Redis=require(_0xfa23('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa23('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa23('0x11'))('api');var utils=require(_0xfa23('0x12'));var config=require(_0xfa23('0x13'));var licenseUtil=require(_0xfa23('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5ffe,_0x42380){_0x42380=_0x42380||0xcc;return function(_0x46f991){if(_0x46f991){return _0x1e5ffe['sendStatus'](_0x42380);}return _0x1e5ffe['status'](_0x42380)[_0xfa23('0x15')]();};}function respondWithResult(_0x23712b,_0x3f50f0){_0x3f50f0=_0x3f50f0||0xc8;return function(_0x36252c){if(_0x36252c){return _0x23712b['status'](_0x3f50f0)[_0xfa23('0x16')](_0x36252c);}};}function respondWithFilteredResult(_0xb7d11a,_0x2095a5){return function(_0x9611e0){if(_0x9611e0){var _0x542d9a=_0x9611e0[_0xfa23('0x17')],_0x1c4882=_0x2095a5[_0xfa23('0x18')],_0x39729e=_0x2095a5['offset']+_0x2095a5['limit'],_0x3ca6be;if(_0x39729e>=_0x542d9a){_0x39729e=_0x542d9a;_0x3ca6be=0xc8;}else{_0x3ca6be=0xce;}_0xb7d11a['status'](_0x3ca6be);return _0xb7d11a[_0xfa23('0x19')](_0xfa23('0x1a'),_0x1c4882+'-'+_0x39729e+'/'+_0x542d9a)['json'](_0x9611e0);}return null;};}function patchUpdates(_0x9effe6){return function(_0x2c456b){try{jsonpatch[_0xfa23('0x1b')](_0x2c456b,_0x9effe6,!![]);}catch(_0x54bb04){return BPromise[_0xfa23('0x1c')](_0x54bb04);}return _0x2c456b[_0xfa23('0x1d')]();};}function saveUpdates(_0x47c323,_0x16e4f9){return function(_0x2a900c){if(_0x2a900c){return _0x2a900c[_0xfa23('0x1e')](_0x47c323)[_0xfa23('0x1f')](function(_0x2ce89a){return _0x2ce89a;});}return null;};}function removeEntity(_0x10ef95,_0x31eedb){return function(_0x485838){if(_0x485838){return _0x485838[_0xfa23('0x20')]()[_0xfa23('0x1f')](function(){_0x10ef95[_0xfa23('0x21')](0xcc)[_0xfa23('0x15')]();});}};}function handleEntityNotFound(_0x542cde,_0x4500a2){return function(_0x511a93){if(!_0x511a93){_0x542cde[_0xfa23('0x22')](0x194);}return _0x511a93;};}function handleError(_0x1abb42,_0x2481e9){_0x2481e9=_0x2481e9||0x1f4;return function(_0x26bdce){logger[_0xfa23('0x23')](_0x26bdce[_0xfa23('0x24')]);if(_0x26bdce[_0xfa23('0x25')]){delete _0x26bdce[_0xfa23('0x25')];}_0x1abb42['status'](_0x2481e9)[_0xfa23('0x26')](_0x26bdce);};}exports['index']=function(_0x1ae38a,_0x5de208){var _0x4ea972={},_0x35b493={},_0x1a9a90={'count':0x0,'rows':[]};var _0xbf9d19=_[_0xfa23('0x27')](db[_0xfa23('0x28')][_0xfa23('0x29')],function(_0x3c9d9d){return{'name':_0x3c9d9d['fieldName'],'type':_0x3c9d9d[_0xfa23('0x2a')]['key']};});_0x35b493[_0xfa23('0x2b')]=_[_0xfa23('0x27')](_0xbf9d19,'name');_0x35b493[_0xfa23('0x2c')]=_[_0xfa23('0x2d')](_0x1ae38a[_0xfa23('0x2c')]);_0x35b493[_0xfa23('0x2e')]=_[_0xfa23('0x2f')](_0x35b493[_0xfa23('0x2b')],_0x35b493[_0xfa23('0x2c')]);_0x4ea972[_0xfa23('0x30')]=_[_0xfa23('0x2f')](_0x35b493['model'],qs[_0xfa23('0x31')](_0x1ae38a['query'][_0xfa23('0x31')]));_0x4ea972[_0xfa23('0x30')]=_0x4ea972[_0xfa23('0x30')][_0xfa23('0x32')]?_0x4ea972[_0xfa23('0x30')]:_0x35b493[_0xfa23('0x2b')];if(!_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x33')](_0xfa23('0x34'))){_0x4ea972['limit']=qs[_0xfa23('0x35')](_0x1ae38a['query'][_0xfa23('0x35')]);_0x4ea972[_0xfa23('0x18')]=qs[_0xfa23('0x18')](_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x18')]);}_0x4ea972[_0xfa23('0x36')]=qs[_0xfa23('0x37')](_0x1ae38a['query'][_0xfa23('0x37')]);_0x4ea972[_0xfa23('0x38')]=qs[_0xfa23('0x2e')](_[_0xfa23('0x39')](_0x1ae38a['query'],_0x35b493['filters']),_0xbf9d19);if(_0x1ae38a['query'][_0xfa23('0x3a')]){_0x4ea972[_0xfa23('0x38')]=_['merge'](_0x4ea972[_0xfa23('0x38')],{'$or':_[_0xfa23('0x27')](_0xbf9d19,function(_0x9d0ca0){if(_0x9d0ca0['type']!==_0xfa23('0x3b')){var _0x59361e={};_0x59361e[_0x9d0ca0[_0xfa23('0x25')]]={'$like':'%'+_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x3a')]+'%'};return _0x59361e;}})});}_0x4ea972=_[_0xfa23('0x3c')]({},_0x4ea972,_0x1ae38a[_0xfa23('0x3d')]);var _0x80827f={'where':_0x4ea972['where']};return db[_0xfa23('0x28')][_0xfa23('0x17')](_0x80827f)[_0xfa23('0x1f')](function(_0x245f49){_0x1a9a90['count']=_0x245f49;if(_0x1ae38a[_0xfa23('0x2c')][_0xfa23('0x3e')]){_0x4ea972[_0xfa23('0x3f')]=[{'all':!![]}];}return db[_0xfa23('0x28')][_0xfa23('0x40')](_0x4ea972);})[_0xfa23('0x1f')](function(_0x493d36){_0x1a9a90[_0xfa23('0x41')]=_0x493d36;return _0x1a9a90;})['then'](respondWithFilteredResult(_0x5de208,_0x4ea972))['catch'](handleError(_0x5de208,null));};exports[_0xfa23('0x42')]=function(_0x1117ef,_0x5937e0){var _0x603fd9={'raw':!![],'where':{'id':_0x1117ef[_0xfa23('0x43')]['id']}},_0x20c88c={};_0x20c88c['model']=_[_0xfa23('0x2d')](db[_0xfa23('0x28')][_0xfa23('0x29')]);_0x20c88c['query']=_['keys'](_0x1117ef[_0xfa23('0x2c')]);_0x20c88c['filters']=_[_0xfa23('0x2f')](_0x20c88c[_0xfa23('0x2b')],_0x20c88c[_0xfa23('0x2c')]);_0x603fd9['attributes']=_[_0xfa23('0x2f')](_0x20c88c[_0xfa23('0x2b')],qs[_0xfa23('0x31')](_0x1117ef[_0xfa23('0x2c')]['fields']));_0x603fd9[_0xfa23('0x30')]=_0x603fd9[_0xfa23('0x30')][_0xfa23('0x32')]?_0x603fd9['attributes']:_0x20c88c['model'];if(_0x1117ef[_0xfa23('0x2c')]['includeAll']){_0x603fd9[_0xfa23('0x3f')]=[{'all':!![]}];}_0x603fd9=_[_0xfa23('0x3c')]({},_0x603fd9,_0x1117ef[_0xfa23('0x3d')]);return db[_0xfa23('0x28')][_0xfa23('0x44')](_0x603fd9)[_0xfa23('0x1f')](handleEntityNotFound(_0x5937e0,null))['then'](respondWithResult(_0x5937e0,null))[_0xfa23('0x45')](handleError(_0x5937e0,null));};exports[_0xfa23('0x46')]=function(_0x36a795,_0x714255){return db[_0xfa23('0x28')][_0xfa23('0x46')](_0x36a795['body'],{})[_0xfa23('0x1f')](respondWithResult(_0x714255,0xc9))[_0xfa23('0x45')](handleError(_0x714255,null));};exports[_0xfa23('0x1e')]=function(_0x2f6a37,_0x107d27){if(_0x2f6a37['body']['id']){delete _0x2f6a37[_0xfa23('0x47')]['id'];}return db[_0xfa23('0x28')][_0xfa23('0x44')]({'where':{'id':_0x2f6a37['params']['id']}})[_0xfa23('0x1f')](handleEntityNotFound(_0x107d27,null))[_0xfa23('0x1f')](saveUpdates(_0x2f6a37[_0xfa23('0x47')],null))[_0xfa23('0x1f')](respondWithResult(_0x107d27,null))[_0xfa23('0x45')](handleError(_0x107d27,null));};exports[_0xfa23('0x20')]=function(_0x709755,_0x50bae3){return db[_0xfa23('0x28')]['find']({'where':{'id':_0x709755[_0xfa23('0x43')]['id']}})[_0xfa23('0x1f')](handleEntityNotFound(_0x50bae3,null))[_0xfa23('0x1f')](removeEntity(_0x50bae3,null))[_0xfa23('0x45')](handleError(_0x50bae3,null));};exports[_0xfa23('0x48')]=function(_0x1eb83b,_0x4c6962){return db[_0xfa23('0x28')][_0xfa23('0x48')]()[_0xfa23('0x1f')](respondWithResult(_0x4c6962,null))[_0xfa23('0x45')](handleError(_0x4c6962,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1f24a51..7e34395 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 _0x07db=['api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x4febcd,_0x141f0c){var _0x253421=function(_0x4768dc){while(--_0x4768dc){_0x4febcd['push'](_0x4febcd['shift']());}};_0x253421(++_0x141f0c);}(_0x07db,0x165));var _0xb07d=function(_0x3df93e,_0x5af13a){_0x3df93e=_0x3df93e-0x0;var _0x2d4f2a=_0x07db[_0x3df93e];return _0x2d4f2a;};'use strict';var _=require(_0xb07d('0x0'));var util=require(_0xb07d('0x1'));var logger=require(_0xb07d('0x2'))(_0xb07d('0x3'));var moment=require(_0xb07d('0x4'));var BPromise=require(_0xb07d('0x5'));var rp=require(_0xb07d('0x6'));var fs=require('fs');var path=require(_0xb07d('0x7'));var rimraf=require(_0xb07d('0x8'));var config=require('../../config/environment');var attributes=require(_0xb07d('0x9'));module[_0xb07d('0xa')]=function(_0x42118d,_0xdbd24c){return _0x42118d[_0xb07d('0xb')](_0xb07d('0xc'),attributes,{'tableName':_0xb07d('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb07d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc62=['../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4e96a4,_0x36117c){var _0x3623d7=function(_0x27b790){while(--_0x27b790){_0x4e96a4['push'](_0x4e96a4['shift']());}};_0x3623d7(++_0x36117c);}(_0xbc62,0x125));var _0x2bc6=function(_0x3cacb2,_0x195f34){_0x3cacb2=_0x3cacb2-0x0;var _0xe7c64b=_0xbc62[_0x3cacb2];return _0xe7c64b;};'use strict';var _=require('lodash');var util=require(_0x2bc6('0x0'));var logger=require(_0x2bc6('0x1'))(_0x2bc6('0x2'));var moment=require(_0x2bc6('0x3'));var BPromise=require(_0x2bc6('0x4'));var rp=require(_0x2bc6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bc6('0x6'));var config=require(_0x2bc6('0x7'));var attributes=require(_0x2bc6('0x8'));module[_0x2bc6('0x9')]=function(_0x275905,_0x5d689c){return _0x275905['define'](_0x2bc6('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x2bc6('0xb'),'fields':[_0x2bc6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 54309a4..cc15b52 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 _0x90eb=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x195a1e,_0x33ad18){var _0x1dd18b=function(_0x15b935){while(--_0x15b935){_0x195a1e['push'](_0x195a1e['shift']());}};_0x1dd18b(++_0x33ad18);}(_0x90eb,0x15c));var _0xb90e=function(_0x577ad0,_0x51a803){_0x577ad0=_0x577ad0-0x0;var _0x441988=_0x90eb[_0x577ad0];return _0x441988;};'use strict';var _=require(_0xb90e('0x0'));var util=require(_0xb90e('0x1'));var moment=require(_0xb90e('0x2'));var BPromise=require(_0xb90e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb90e('0x4'));var db=require(_0xb90e('0x5'))['db'];var utils=require(_0xb90e('0x6'));var logger=require(_0xb90e('0x7'))(_0xb90e('0x8'));var config=require(_0xb90e('0x9'));var jayson=require(_0xb90e('0xa'));var client=jayson[_0xb90e('0xb')][_0xb90e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d54e7,_0x566671,_0x1534b5){return new BPromise(function(_0x64c147,_0x8e3309){return client['request'](_0x3d54e7,_0x1534b5)[_0xb90e('0xd')](function(_0x447bff){logger['info'](_0xb90e('0xe'),_0x566671,_0xb90e('0xf'));logger[_0xb90e('0x10')](_0xb90e('0x11'),_0x566671,_0xb90e('0xf'),JSON[_0xb90e('0x12')](_0x447bff));if(_0x447bff[_0xb90e('0x13')]){if(_0x447bff['error'][_0xb90e('0x14')]===0x1f4){logger[_0xb90e('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x566671,_0x447bff['error'][_0xb90e('0x15')]);return _0x8e3309(_0x447bff[_0xb90e('0x13')][_0xb90e('0x15')]);}logger[_0xb90e('0x13')](_0xb90e('0xe'),_0x566671,_0x447bff[_0xb90e('0x13')][_0xb90e('0x15')]);return _0x64c147(_0x447bff[_0xb90e('0x13')][_0xb90e('0x15')]);}else{logger[_0xb90e('0x16')](_0xb90e('0xe'),_0x566671,_0xb90e('0xf'));_0x64c147(_0x447bff[_0xb90e('0x17')][_0xb90e('0x15')]);}})[_0xb90e('0x18')](function(_0x3b739e){logger[_0xb90e('0x13')](_0xb90e('0xe'),_0x566671,_0x3b739e);_0x8e3309(_0x3b739e);});});} \ No newline at end of file +var _0x0c91=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x340f94,_0x102081){var _0x2967fa=function(_0x2bbcb1){while(--_0x2bbcb1){_0x340f94['push'](_0x340f94['shift']());}};_0x2967fa(++_0x102081);}(_0x0c91,0xbe));var _0x10c9=function(_0x4ce816,_0x2db941){_0x4ce816=_0x4ce816-0x0;var _0x46a499=_0x0c91[_0x4ce816];return _0x46a499;};'use strict';var _=require(_0x10c9('0x0'));var util=require(_0x10c9('0x1'));var moment=require(_0x10c9('0x2'));var BPromise=require(_0x10c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10c9('0x4'));var db=require(_0x10c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x10c9('0x6'));var config=require('../../config/environment');var jayson=require(_0x10c9('0x7'));var client=jayson[_0x10c9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13efc0,_0x48368b,_0x5afb28){return new BPromise(function(_0x28924e,_0x5c7280){return client[_0x10c9('0x9')](_0x13efc0,_0x5afb28)[_0x10c9('0xa')](function(_0x4a6975){logger[_0x10c9('0xb')](_0x10c9('0xc'),_0x48368b,'request\x20sent');logger['debug'](_0x10c9('0xd'),_0x48368b,_0x10c9('0xe'),JSON[_0x10c9('0xf')](_0x4a6975));if(_0x4a6975['error']){if(_0x4a6975[_0x10c9('0x10')][_0x10c9('0x11')]===0x1f4){logger[_0x10c9('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x48368b,_0x4a6975[_0x10c9('0x10')][_0x10c9('0x12')]);return _0x5c7280(_0x4a6975[_0x10c9('0x10')][_0x10c9('0x12')]);}logger['error'](_0x10c9('0xc'),_0x48368b,_0x4a6975[_0x10c9('0x10')]['message']);return _0x28924e(_0x4a6975[_0x10c9('0x10')][_0x10c9('0x12')]);}else{logger[_0x10c9('0xb')](_0x10c9('0xc'),_0x48368b,_0x10c9('0xe'));_0x28924e(_0x4a6975[_0x10c9('0x13')]['message']);}})[_0x10c9('0x14')](function(_0x3cb2f4){logger['error'](_0x10c9('0xc'),_0x48368b,_0x3cb2f4);_0x5c7280(_0x3cb2f4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b494ef9..2752436 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 _0xabb1=['create','/:id','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','show','post'];(function(_0x36b90,_0x33ed75){var _0x368418=function(_0x56eb0b){while(--_0x56eb0b){_0x36b90['push'](_0x36b90['shift']());}};_0x368418(++_0x33ed75);}(_0xabb1,0x72));var _0x1abb=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xabb1[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x1abb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1abb('0x1'));var express=require(_0x1abb('0x2'));var router=express[_0x1abb('0x3')]();var auth=require(_0x1abb('0x4'));var interaction=require(_0x1abb('0x5'));var config=require(_0x1abb('0x6'));var controller=require(_0x1abb('0x7'));router['get']('/',auth[_0x1abb('0x8')](),controller[_0x1abb('0x9')]);router[_0x1abb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x1abb('0xb')]);router[_0x1abb('0xa')]('/:id',auth[_0x1abb('0x8')](),controller[_0x1abb('0xc')]);router[_0x1abb('0xd')]('/',auth[_0x1abb('0x8')](),controller[_0x1abb('0xe')]);router['put'](_0x1abb('0xf'),auth[_0x1abb('0x8')](),controller['update']);router['delete'](_0x1abb('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x82f4=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x51dc83,_0x5226f0){var _0x1b1389=function(_0x15f51a){while(--_0x15f51a){_0x51dc83['push'](_0x51dc83['shift']());}};_0x1b1389(++_0x5226f0);}(_0x82f4,0x84));var _0x482f=function(_0x4fce3a,_0x31dd65){_0x4fce3a=_0x4fce3a-0x0;var _0xab350c=_0x82f4[_0x4fce3a];return _0xab350c;};'use strict';var multer=require(_0x482f('0x0'));var util=require('util');var path=require(_0x482f('0x1'));var timeout=require(_0x482f('0x2'));var express=require(_0x482f('0x3'));var router=express[_0x482f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x482f('0x5'));var config=require(_0x482f('0x6'));var controller=require(_0x482f('0x7'));router[_0x482f('0x8')]('/',auth[_0x482f('0x9')](),controller[_0x482f('0xa')]);router[_0x482f('0x8')](_0x482f('0xb'),auth[_0x482f('0x9')](),controller[_0x482f('0xc')]);router[_0x482f('0x8')](_0x482f('0xd'),auth[_0x482f('0x9')](),controller[_0x482f('0xe')]);router[_0x482f('0xf')]('/',auth[_0x482f('0x9')](),controller['create']);router[_0x482f('0x10')](_0x482f('0xd'),auth[_0x482f('0x9')](),controller[_0x482f('0x11')]);router[_0x482f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x482f('0x13')]);module[_0x482f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 8330547..22c552b 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 _0x77ce=['/:id','show','/:id/configurations','getConfigurations','getFields','post','create','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x31b5ce,_0x440908){var _0x44cd44=function(_0x358abe){while(--_0x358abe){_0x31b5ce['push'](_0x31b5ce['shift']());}};_0x44cd44(++_0x440908);}(_0x77ce,0x14e));var _0xe77c=function(_0x5d0db2,_0x29d33f){_0x5d0db2=_0x5d0db2-0x0;var _0x2d6bdf=_0x77ce[_0x5d0db2];return _0x2d6bdf;};'use strict';var multer=require(_0xe77c('0x0'));var util=require(_0xe77c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe77c('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe77c('0x3'));var config=require(_0xe77c('0x4'));var controller=require(_0xe77c('0x5'));router[_0xe77c('0x6')]('/',auth[_0xe77c('0x7')](),controller['index']);router[_0xe77c('0x6')](_0xe77c('0x8'),auth[_0xe77c('0x7')](),controller[_0xe77c('0x9')]);router[_0xe77c('0x6')](_0xe77c('0xa'),auth[_0xe77c('0x7')](),controller[_0xe77c('0xb')]);router[_0xe77c('0x6')]('/:id/fields',auth[_0xe77c('0x7')](),controller[_0xe77c('0xc')]);router[_0xe77c('0xd')]('/',auth['isAuthenticated'](),controller[_0xe77c('0xe')]);router[_0xe77c('0xd')](_0xe77c('0xa'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xe77c('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xe77c('0xf')]('/:id',auth[_0xe77c('0x7')](),controller[_0xe77c('0x10')]);module[_0xe77c('0x11')]=router; \ No newline at end of file +var _0xd718=['isAuthenticated','index','/:id','show','getFields','create','post','addConfiguration','put','delete','multer','util','express','Router','../../components/interaction/service','./intDeskAccount.controller','get'];(function(_0x1a3013,_0x2fdfc0){var _0x5918f4=function(_0x3f2e92){while(--_0x3f2e92){_0x1a3013['push'](_0x1a3013['shift']());}};_0x5918f4(++_0x2fdfc0);}(_0xd718,0x16f));var _0x8d71=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xd718[_0x1fd675];return _0x16b554;};'use strict';var multer=require(_0x8d71('0x0'));var util=require(_0x8d71('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d71('0x2'));var router=express[_0x8d71('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d71('0x4'));var config=require('../../config/environment');var controller=require(_0x8d71('0x5'));router[_0x8d71('0x6')]('/',auth[_0x8d71('0x7')](),controller[_0x8d71('0x8')]);router[_0x8d71('0x6')](_0x8d71('0x9'),auth[_0x8d71('0x7')](),controller[_0x8d71('0xa')]);router['get']('/:id/configurations',auth[_0x8d71('0x7')](),controller['getConfigurations']);router[_0x8d71('0x6')]('/:id/fields',auth[_0x8d71('0x7')](),controller[_0x8d71('0xb')]);router['post']('/',auth[_0x8d71('0x7')](),controller[_0x8d71('0xc')]);router[_0x8d71('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8d71('0xe')]);router[_0x8d71('0xf')]('/:id',auth[_0x8d71('0x7')](),controller['update']);router[_0x8d71('0x10')](_0x8d71('0x9'),auth[_0x8d71('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 858202c..06729cd 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 _0x288a=['newTab','integrationTab','exports','STRING','basic','ENUM'];(function(_0x35a374,_0x39f242){var _0x19d95d=function(_0x2dc2d2){while(--_0x2dc2d2){_0x35a374['push'](_0x35a374['shift']());}};_0x19d95d(++_0x39f242);}(_0x288a,0x188));var _0xa288=function(_0x4aef8b,_0x37d29c){_0x4aef8b=_0x4aef8b-0x0;var _0x2316ba=_0x288a[_0x4aef8b];return _0x2316ba;};'use strict';var Sequelize=require('sequelize');module[_0xa288('0x0')]={'name':{'type':Sequelize[_0xa288('0x1')]},'description':{'type':Sequelize[_0xa288('0x1')]},'username':{'type':Sequelize[_0xa288('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xa288('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xa288('0x1')]},'consumerKey':{'type':Sequelize[_0xa288('0x1')]},'consumerSecret':{'type':Sequelize[_0xa288('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa288('0x1')]},'serverUrl':{'type':Sequelize[_0xa288('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa288('0x3')]('integrationTab',_0xa288('0x4')),'defaultValue':_0xa288('0x5')}}; \ No newline at end of file +var _0x0c8d=['newTab','exports','STRING','integrationTab'];(function(_0x2b8162,_0x1355d8){var _0x4c08db=function(_0x1e2432){while(--_0x1e2432){_0x2b8162['push'](_0x2b8162['shift']());}};_0x4c08db(++_0x1355d8);}(_0x0c8d,0x79));var _0xd0c8=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x0c8d[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require('sequelize');module[_0xd0c8('0x0')]={'name':{'type':Sequelize[_0xd0c8('0x1')]},'description':{'type':Sequelize[_0xd0c8('0x1')]},'username':{'type':Sequelize[_0xd0c8('0x1')]},'remoteUri':{'type':Sequelize[_0xd0c8('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xd0c8('0x1')]},'consumerSecret':{'type':Sequelize[_0xd0c8('0x1')]},'token':{'type':Sequelize[_0xd0c8('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd0c8('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd0c8('0x2'),_0xd0c8('0x3')),'defaultValue':_0xd0c8('0x2')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 71d5090..02df4e2 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 _0xd3af=['query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','create','body','update','find','findOne','DeskConfiguration','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerKey','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','status','end','json','count','offset','limit','set','apply','reject','save','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type'];(function(_0x2f1d9f,_0x200218){var _0x34f096=function(_0x3cf68e){while(--_0x3cf68e){_0x2f1d9f['push'](_0x2f1d9f['shift']());}};_0x34f096(++_0x200218);}(_0xd3af,0x1a9));var _0xfd3a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd3af[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0xfd3a('0x0'));var emlformat=require(_0xfd3a('0x1'));var rimraf=require(_0xfd3a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd3a('0x3'));var rp=require(_0xfd3a('0x4'));var moment=require(_0xfd3a('0x5'));var BPromise=require(_0xfd3a('0x6'));var Mustache=require(_0xfd3a('0x7'));var util=require(_0xfd3a('0x8'));var path=require('path');var sox=require(_0xfd3a('0x9'));var csv=require(_0xfd3a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd3a('0xb'));var squel=require(_0xfd3a('0xc'));var crypto=require(_0xfd3a('0xd'));var jsforce=require(_0xfd3a('0xe'));var deskjs=require(_0xfd3a('0xf'));var toCsv=require(_0xfd3a('0xa'));var querystring=require(_0xfd3a('0x10'));var Papa=require(_0xfd3a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd3a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfd3a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfd3a('0x14'));var db=require(_0xfd3a('0x15'))['db'];var integrations=require(_0xfd3a('0x16'));var jayson=require(_0xfd3a('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2d79,_0x6c718a,_0x5921af,_0x1dd8c6){return new BPromise(function(_0x500896,_0x510419){var _0x5a5c32=_0x1dd8c6||client;return _0x5a5c32[_0xfd3a('0x18')](_0x1f2d79,_0x5921af)[_0xfd3a('0x19')](function(_0x50a183){logger[_0xfd3a('0x1a')]('DeskAccount,\x20%s,\x20%s',_0x6c718a,_0xfd3a('0x1b'));logger[_0xfd3a('0x1c')](_0xfd3a('0x1d'),_0x6c718a,_0xfd3a('0x1b'),JSON[_0xfd3a('0x1e')](_0x50a183));if(_0x50a183[_0xfd3a('0x1f')]){if(_0x50a183['error'][_0xfd3a('0x20')]===0x1f4){logger[_0xfd3a('0x1f')](_0xfd3a('0x21'),_0x6c718a,_0x50a183[_0xfd3a('0x1f')][_0xfd3a('0x22')]);return _0x510419(_0x50a183['error'][_0xfd3a('0x22')]);}logger[_0xfd3a('0x1f')](_0xfd3a('0x21'),_0x6c718a,_0x50a183[_0xfd3a('0x1f')][_0xfd3a('0x22')]);return _0x500896(_0x50a183[_0xfd3a('0x1f')]['message']);}else{logger[_0xfd3a('0x1a')](_0xfd3a('0x21'),_0x6c718a,'request\x20sent');_0x500896(_0x50a183['result'][_0xfd3a('0x22')]);}})[_0xfd3a('0x23')](function(_0x3c2689){logger[_0xfd3a('0x1f')](_0xfd3a('0x21'),_0x6c718a,_0x3c2689);_0x510419(_0x3c2689);});});}function respondWithStatusCode(_0x2b8475,_0x90fe2){_0x90fe2=_0x90fe2||0xcc;return function(_0x9b2e2c){if(_0x9b2e2c){return _0x2b8475['sendStatus'](_0x90fe2);}return _0x2b8475[_0xfd3a('0x24')](_0x90fe2)[_0xfd3a('0x25')]();};}function respondWithResult(_0x302511,_0x7d5595){_0x7d5595=_0x7d5595||0xc8;return function(_0x459a5e){if(_0x459a5e){return _0x302511['status'](_0x7d5595)[_0xfd3a('0x26')](_0x459a5e);}};}function respondWithFilteredResult(_0xce0a28,_0x4cc93e){return function(_0x347750){if(_0x347750){var _0x2f0bf7=_0x347750[_0xfd3a('0x27')],_0x257aa0=_0x4cc93e[_0xfd3a('0x28')],_0x105dfa=_0x4cc93e['offset']+_0x4cc93e[_0xfd3a('0x29')],_0x3317e8;if(_0x105dfa>=_0x2f0bf7){_0x105dfa=_0x2f0bf7;_0x3317e8=0xc8;}else{_0x3317e8=0xce;}_0xce0a28[_0xfd3a('0x24')](_0x3317e8);return _0xce0a28[_0xfd3a('0x2a')]('Content-Range',_0x257aa0+'-'+_0x105dfa+'/'+_0x2f0bf7)[_0xfd3a('0x26')](_0x347750);}return null;};}function patchUpdates(_0x10c794){return function(_0xe19f0a){try{jsonpatch[_0xfd3a('0x2b')](_0xe19f0a,_0x10c794,!![]);}catch(_0x4ed35d){return BPromise[_0xfd3a('0x2c')](_0x4ed35d);}return _0xe19f0a[_0xfd3a('0x2d')]();};}function saveUpdates(_0x199939,_0x4f9725){return function(_0x338ed1){if(_0x338ed1){return _0x338ed1['update'](_0x199939)['then'](function(_0x1591e1){return _0x1591e1;});}return null;};}function removeEntity(_0x113d97,_0xc093cf){return function(_0xe7c06c){if(_0xe7c06c){return _0xe7c06c[_0xfd3a('0x2e')]()[_0xfd3a('0x19')](function(){_0x113d97[_0xfd3a('0x24')](0xcc)[_0xfd3a('0x25')]();});}};}function handleEntityNotFound(_0x1fcbec,_0x3a3f73){return function(_0x328564){if(!_0x328564){_0x1fcbec['sendStatus'](0x194);}return _0x328564;};}function handleError(_0xcb536,_0xc54a5d){_0xc54a5d=_0xc54a5d||0x1f4;return function(_0x26c201){logger[_0xfd3a('0x1f')](_0x26c201['stack']);if(_0x26c201[_0xfd3a('0x2f')]){delete _0x26c201[_0xfd3a('0x2f')];}_0xcb536[_0xfd3a('0x24')](_0xc54a5d)[_0xfd3a('0x30')](_0x26c201);};}exports[_0xfd3a('0x31')]=function(_0x49f1b6,_0x2dcd19){var _0x2e649a={},_0xc38eba={},_0x556635={'count':0x0,'rows':[]};var _0x2d0a75=_[_0xfd3a('0x32')](db[_0xfd3a('0x33')][_0xfd3a('0x34')],function(_0x399297){return{'name':_0x399297[_0xfd3a('0x35')],'type':_0x399297[_0xfd3a('0x36')]['key']};});_0xc38eba['model']=_[_0xfd3a('0x32')](_0x2d0a75,_0xfd3a('0x2f'));_0xc38eba[_0xfd3a('0x37')]=_['keys'](_0x49f1b6[_0xfd3a('0x37')]);_0xc38eba[_0xfd3a('0x38')]=_['intersection'](_0xc38eba[_0xfd3a('0x39')],_0xc38eba[_0xfd3a('0x37')]);_0x2e649a[_0xfd3a('0x3a')]=_[_0xfd3a('0x3b')](_0xc38eba[_0xfd3a('0x39')],qs['fields'](_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x3c')]));_0x2e649a[_0xfd3a('0x3a')]=_0x2e649a['attributes'][_0xfd3a('0x3d')]?_0x2e649a[_0xfd3a('0x3a')]:_0xc38eba['model'];if(!_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x3e')](_0xfd3a('0x3f'))){_0x2e649a[_0xfd3a('0x29')]=qs[_0xfd3a('0x29')](_0x49f1b6[_0xfd3a('0x37')]['limit']);_0x2e649a[_0xfd3a('0x28')]=qs[_0xfd3a('0x28')](_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x28')]);}_0x2e649a[_0xfd3a('0x40')]=qs['sort'](_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x41')]);_0x2e649a[_0xfd3a('0x42')]=qs[_0xfd3a('0x38')](_[_0xfd3a('0x43')](_0x49f1b6['query'],_0xc38eba['filters']),_0x2d0a75);if(_0x49f1b6['query'][_0xfd3a('0x44')]){_0x2e649a['where']=_[_0xfd3a('0x45')](_0x2e649a[_0xfd3a('0x42')],{'$or':_['map'](_0x2d0a75,function(_0x1a287a){if(_0x1a287a[_0xfd3a('0x36')]!=='VIRTUAL'){var _0x9db25e={};_0x9db25e[_0x1a287a[_0xfd3a('0x2f')]]={'$like':'%'+_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x44')]+'%'};return _0x9db25e;}})});}_0x2e649a=_[_0xfd3a('0x45')]({},_0x2e649a,_0x49f1b6[_0xfd3a('0x46')]);var _0x4e7924={'where':_0x2e649a[_0xfd3a('0x42')]};return db[_0xfd3a('0x33')][_0xfd3a('0x27')](_0x4e7924)[_0xfd3a('0x19')](function(_0x2086a4){_0x556635[_0xfd3a('0x27')]=_0x2086a4;if(_0x49f1b6['query'][_0xfd3a('0x47')]){_0x2e649a[_0xfd3a('0x48')]=[{'all':!![]}];}return db[_0xfd3a('0x33')][_0xfd3a('0x49')](_0x2e649a);})[_0xfd3a('0x19')](function(_0x6ddd0e){_0x556635[_0xfd3a('0x4a')]=_0x6ddd0e;return _0x556635;})[_0xfd3a('0x19')](respondWithFilteredResult(_0x2dcd19,_0x2e649a))[_0xfd3a('0x23')](handleError(_0x2dcd19,null));};exports[_0xfd3a('0x4b')]=function(_0x4912dc,_0x3aec18){var _0x562292={'raw':![],'where':{'id':_0x4912dc[_0xfd3a('0x4c')]['id']}},_0x535646={};_0x535646[_0xfd3a('0x39')]=_[_0xfd3a('0x4d')](db[_0xfd3a('0x33')][_0xfd3a('0x34')]);_0x535646[_0xfd3a('0x37')]=_[_0xfd3a('0x4d')](_0x4912dc['query']);_0x535646[_0xfd3a('0x38')]=_['intersection'](_0x535646[_0xfd3a('0x39')],_0x535646[_0xfd3a('0x37')]);_0x562292[_0xfd3a('0x3a')]=_[_0xfd3a('0x3b')](_0x535646[_0xfd3a('0x39')],qs['fields'](_0x4912dc[_0xfd3a('0x37')]['fields']));_0x562292[_0xfd3a('0x3a')]=_0x562292[_0xfd3a('0x3a')][_0xfd3a('0x3d')]?_0x562292[_0xfd3a('0x3a')]:_0x535646[_0xfd3a('0x39')];if(_0x4912dc[_0xfd3a('0x37')][_0xfd3a('0x47')]){_0x562292[_0xfd3a('0x48')]=[{'all':!![]}];}_0x562292=_[_0xfd3a('0x45')]({},_0x562292,_0x4912dc[_0xfd3a('0x46')]);return db[_0xfd3a('0x33')]['find'](_0x562292)[_0xfd3a('0x19')](handleEntityNotFound(_0x3aec18,null))[_0xfd3a('0x19')](respondWithResult(_0x3aec18,null))[_0xfd3a('0x23')](handleError(_0x3aec18,null));};exports[_0xfd3a('0x4e')]=function(_0x3ecb64,_0x5e9a86){return db['DeskAccount'][_0xfd3a('0x4e')](_0x3ecb64[_0xfd3a('0x4f')],{})[_0xfd3a('0x19')](respondWithResult(_0x5e9a86,0xc9))['catch'](handleError(_0x5e9a86,null));};exports[_0xfd3a('0x50')]=function(_0x46b5e6,_0x32e73a){if(_0x46b5e6[_0xfd3a('0x4f')]['id']){delete _0x46b5e6[_0xfd3a('0x4f')]['id'];}return db[_0xfd3a('0x33')][_0xfd3a('0x51')]({'where':{'id':_0x46b5e6['params']['id']}})[_0xfd3a('0x19')](handleEntityNotFound(_0x32e73a,null))[_0xfd3a('0x19')](saveUpdates(_0x46b5e6[_0xfd3a('0x4f')],null))[_0xfd3a('0x19')](respondWithResult(_0x32e73a,null))[_0xfd3a('0x23')](handleError(_0x32e73a,null));};exports['destroy']=function(_0x1e819b,_0x37620f){return db[_0xfd3a('0x33')][_0xfd3a('0x51')]({'where':{'id':_0x1e819b[_0xfd3a('0x4c')]['id']}})[_0xfd3a('0x19')](handleEntityNotFound(_0x37620f,null))[_0xfd3a('0x19')](removeEntity(_0x37620f,null))['catch'](handleError(_0x37620f,null));};exports['getConfigurations']=function(_0x5d53fc,_0x264d71,_0x2eb7d2){var _0x35bc0d={};var _0xa9f154={};var _0x4da413;var _0xcd1a3;return db['DeskAccount'][_0xfd3a('0x52')]({'where':{'id':_0x5d53fc[_0xfd3a('0x4c')]['id']}})[_0xfd3a('0x19')](handleEntityNotFound(_0x264d71,null))[_0xfd3a('0x19')](function(_0xa02b78){if(_0xa02b78){_0x4da413=_0xa02b78;_0xa9f154[_0xfd3a('0x39')]=_[_0xfd3a('0x4d')](db[_0xfd3a('0x53')]['rawAttributes']);_0xa9f154['query']=_[_0xfd3a('0x4d')](_0x5d53fc[_0xfd3a('0x37')]);_0xa9f154[_0xfd3a('0x38')]=_[_0xfd3a('0x3b')](_0xa9f154[_0xfd3a('0x39')],_0xa9f154['query']);_0x35bc0d[_0xfd3a('0x3a')]=_[_0xfd3a('0x3b')](_0xa9f154[_0xfd3a('0x39')],qs[_0xfd3a('0x3c')](_0x5d53fc[_0xfd3a('0x37')][_0xfd3a('0x3c')]));_0x35bc0d['attributes']=_0x35bc0d[_0xfd3a('0x3a')]['length']?_0x35bc0d[_0xfd3a('0x3a')]:_0xa9f154['model'];_0x35bc0d[_0xfd3a('0x40')]=qs[_0xfd3a('0x41')](_0x5d53fc['query'][_0xfd3a('0x41')]);_0x35bc0d[_0xfd3a('0x42')]=qs[_0xfd3a('0x38')](_[_0xfd3a('0x43')](_0x5d53fc[_0xfd3a('0x37')],_0xa9f154[_0xfd3a('0x38')]));if(_0x5d53fc['query'][_0xfd3a('0x44')]){_0x35bc0d['where']=_[_0xfd3a('0x45')](_0x35bc0d[_0xfd3a('0x42')],{'$or':_[_0xfd3a('0x32')](_0x35bc0d['attributes'],function(_0x1088a9){var _0x5d08d2={};_0x5d08d2[_0x1088a9]={'$like':'%'+_0x5d53fc['query'][_0xfd3a('0x44')]+'%'};return _0x5d08d2;})});}_0x35bc0d=_[_0xfd3a('0x45')]({},_0x35bc0d,_0x5d53fc[_0xfd3a('0x46')]);return _0x4da413[_0xfd3a('0x54')](_0x35bc0d);}})[_0xfd3a('0x19')](function(_0x24e684){if(_0x24e684){_0xcd1a3=_0x24e684[_0xfd3a('0x3d')];if(!_0x5d53fc[_0xfd3a('0x37')][_0xfd3a('0x3e')](_0xfd3a('0x3f'))){_0x35bc0d['limit']=qs[_0xfd3a('0x29')](_0x5d53fc['query'][_0xfd3a('0x29')]);_0x35bc0d['offset']=qs[_0xfd3a('0x28')](_0x5d53fc[_0xfd3a('0x37')]['offset']);}return _0x4da413[_0xfd3a('0x54')](_0x35bc0d);}})[_0xfd3a('0x19')](function(_0x318035){if(_0x318035){return _0x318035?{'count':_0xcd1a3,'rows':_0x318035}:null;}})[_0xfd3a('0x19')](respondWithResult(_0x264d71,null))[_0xfd3a('0x23')](handleError(_0x264d71,null));};exports[_0xfd3a('0x55')]=function(_0x154534,_0x46656f,_0x55d1b8){if(_0x154534['body']['id']){delete _0x154534[_0xfd3a('0x4f')]['id'];}return db[_0xfd3a('0x33')][_0xfd3a('0x52')]({'where':{'id':_0x154534[_0xfd3a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46656f,null))['then'](function(_0x23029b){if(_0x23029b){_0x154534['body']['AccountId']=_0x23029b['id'];_0x154534[_0xfd3a('0x4f')]['Subjects']=integrations[_0xfd3a('0x56')](_0x154534[_0xfd3a('0x4f')][_0xfd3a('0x57')],_0x154534['body'][_0xfd3a('0x36')]);_0x154534[_0xfd3a('0x4f')][_0xfd3a('0x58')]=integrations[_0xfd3a('0x59')](_0x154534[_0xfd3a('0x4f')][_0xfd3a('0x57')],_0x154534['body'][_0xfd3a('0x36')]);return db[_0xfd3a('0x53')][_0xfd3a('0x4e')](_0x154534[_0xfd3a('0x4f')],{'include':[{'model':db[_0xfd3a('0x5a')],'as':_0xfd3a('0x5b')},{'model':db[_0xfd3a('0x5a')],'as':_0xfd3a('0x58')}]});}return null;})[_0xfd3a('0x19')](respondWithResult(_0x46656f,null))['catch'](handleError(_0x46656f,null));};exports[_0xfd3a('0x5c')]=function(_0x137671,_0x50add2,_0x233316){var _0x5369a3=[{'name':_0xfd3a('0x5d'),'label':_0xfd3a('0x5d'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xabf231='';return db[_0xfd3a('0x33')][_0xfd3a('0x52')]({'where':{'id':_0x137671[_0xfd3a('0x4c')]['id']},'attributes':['id',_0xfd3a('0x5e'),_0xfd3a('0x5f'),'username',_0xfd3a('0x60'),_0xfd3a('0x61'),'consumerSecret','token',_0xfd3a('0x62')]})[_0xfd3a('0x19')](handleEntityNotFound(_0x50add2,null))[_0xfd3a('0x19')](function(_0x3ec29c){if(_0x3ec29c){_0xabf231=_0x3ec29c[_0xfd3a('0x5e')];var _0xbf2ccf=_0xabf231[_0xfd3a('0x63')](-0x1);if(_0xbf2ccf==='/'){_0xabf231=_0xabf231[_0xfd3a('0x64')](0x0,_0xabf231[_0xfd3a('0x65')](_0xbf2ccf));}var _0x55c1cb={'method':_0xfd3a('0x66'),'uri':util[_0xfd3a('0x67')]('%s/custom_fields',_0xabf231),'headers':{'Content-Type':'application/json','Accept':_0xfd3a('0x68')},'json':!![]};if(_0x3ec29c[_0xfd3a('0x5f')]===_0xfd3a('0x69')){_0x55c1cb[_0xfd3a('0x6a')][_0xfd3a('0x6b')]=util[_0xfd3a('0x67')](_0xfd3a('0x6c'),new Buffer(util[_0xfd3a('0x67')](_0xfd3a('0x6d'),_0x3ec29c[_0xfd3a('0x6e')],_0x3ec29c[_0xfd3a('0x60')]))[_0xfd3a('0x6f')](_0xfd3a('0x70')));}return rp(_0x55c1cb)[_0xfd3a('0x19')](function(_0x58df5b){return _0x5369a3[_0xfd3a('0x71')](_[_0xfd3a('0x32')](_0x58df5b['_embedded']['entries'],function(_0x1abff1){return{'id':_0x1abff1[_0xfd3a('0x2f')],'name':_0x1abff1[_0xfd3a('0x2f')],'type':_0x1abff1['type'],'active':_0x1abff1[_0xfd3a('0x72')],'label':_0x1abff1[_0xfd3a('0x73')],'custom':!![]};}));});}})[_0xfd3a('0x19')](function(_0x324d4d){return{'count':_0x324d4d[_0xfd3a('0x3d')],'rows':_0x324d4d};})[_0xfd3a('0x19')](respondWithResult(_0x50add2,null))[_0xfd3a('0x23')](function(_0x4b8dd6){var _0x1a9ea5=_0x137671[_0xfd3a('0x37')][_0xfd3a('0x74')]?0x1f4:_0x4b8dd6[_0xfd3a('0x75')]||0x1f4;logger[_0xfd3a('0x1f')](_0xfd3a('0x76'),_0xfd3a('0x5c'),_0x1a9ea5,JSON[_0xfd3a('0x1e')](_0x4b8dd6));delete _0x4b8dd6[_0xfd3a('0x2f')];if(_0x1a9ea5===0x191){_0x1a9ea5=0x190;}_0x50add2[_0xfd3a('0x24')](_0x1a9ea5)[_0xfd3a('0x30')](_0x137671[_0xfd3a('0x37')][_0xfd3a('0x74')]?{'message':_0xfd3a('0x77'),'statusCode':_0x4b8dd6[_0xfd3a('0x75')]}:_0x4b8dd6);});}; \ No newline at end of file +var _0xf42f=['%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','show','params','keys','length','create','body','find','findOne','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format'];(function(_0x1afc08,_0x2a8b3f){var _0x367e12=function(_0x55f719){while(--_0x55f719){_0x1afc08['push'](_0x1afc08['shift']());}};_0x367e12(++_0x2a8b3f);}(_0xf42f,0x8d));var _0xff42=function(_0x45ee3b,_0x2f868e){_0x45ee3b=_0x45ee3b-0x0;var _0x523ba6=_0xf42f[_0x45ee3b];return _0x523ba6;};'use strict';var pdf=require(_0xff42('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff42('0x1'));var zipdir=require(_0xff42('0x2'));var jsonpatch=require(_0xff42('0x3'));var rp=require(_0xff42('0x4'));var moment=require(_0xff42('0x5'));var BPromise=require(_0xff42('0x6'));var Mustache=require(_0xff42('0x7'));var util=require(_0xff42('0x8'));var path=require('path');var sox=require(_0xff42('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xff42('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff42('0xb'));var Papa=require(_0xff42('0xc'));var Redis=require('ioredis');var authService=require(_0xff42('0xd'));var qs=require(_0xff42('0xe'));var as=require(_0xff42('0xf'));var hardwareService=require(_0xff42('0x10'));var logger=require(_0xff42('0x11'))(_0xff42('0x12'));var utils=require(_0xff42('0x13'));var config=require(_0xff42('0x14'));var licenseUtil=require(_0xff42('0x15'));var db=require(_0xff42('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xff42('0x17'));var client=jayson[_0xff42('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c0ed,_0x1679ad,_0x354065,_0x2f38c9){return new BPromise(function(_0x58dd7d,_0x144bf1){var _0x310faa=_0x2f38c9||client;return _0x310faa[_0xff42('0x19')](_0x25c0ed,_0x354065)['then'](function(_0x571861){logger[_0xff42('0x1a')](_0xff42('0x1b'),_0x1679ad,_0xff42('0x1c'));logger['debug'](_0xff42('0x1d'),_0x1679ad,_0xff42('0x1c'),JSON['stringify'](_0x571861));if(_0x571861[_0xff42('0x1e')]){if(_0x571861['error'][_0xff42('0x1f')]===0x1f4){logger['error'](_0xff42('0x1b'),_0x1679ad,_0x571861[_0xff42('0x1e')][_0xff42('0x20')]);return _0x144bf1(_0x571861['error'][_0xff42('0x20')]);}logger[_0xff42('0x1e')](_0xff42('0x1b'),_0x1679ad,_0x571861['error'][_0xff42('0x20')]);return _0x58dd7d(_0x571861[_0xff42('0x1e')][_0xff42('0x20')]);}else{logger[_0xff42('0x1a')](_0xff42('0x1b'),_0x1679ad,_0xff42('0x1c'));_0x58dd7d(_0x571861['result']['message']);}})[_0xff42('0x21')](function(_0x37635f){logger[_0xff42('0x1e')](_0xff42('0x1b'),_0x1679ad,_0x37635f);_0x144bf1(_0x37635f);});});}function respondWithStatusCode(_0x513734,_0x16556f){_0x16556f=_0x16556f||0xcc;return function(_0x1c8a60){if(_0x1c8a60){return _0x513734[_0xff42('0x22')](_0x16556f);}return _0x513734['status'](_0x16556f)[_0xff42('0x23')]();};}function respondWithResult(_0x22f85d,_0x5668b1){_0x5668b1=_0x5668b1||0xc8;return function(_0x50ad03){if(_0x50ad03){return _0x22f85d[_0xff42('0x24')](_0x5668b1)[_0xff42('0x25')](_0x50ad03);}};}function respondWithFilteredResult(_0x7c0efa,_0x387282){return function(_0x4e0ced){if(_0x4e0ced){var _0x4a6408=_0x4e0ced['count'],_0x4cee70=_0x387282[_0xff42('0x26')],_0x45e18a=_0x387282[_0xff42('0x26')]+_0x387282[_0xff42('0x27')],_0x4d63ba;if(_0x45e18a>=_0x4a6408){_0x45e18a=_0x4a6408;_0x4d63ba=0xc8;}else{_0x4d63ba=0xce;}_0x7c0efa[_0xff42('0x24')](_0x4d63ba);return _0x7c0efa[_0xff42('0x28')](_0xff42('0x29'),_0x4cee70+'-'+_0x45e18a+'/'+_0x4a6408)[_0xff42('0x25')](_0x4e0ced);}return null;};}function patchUpdates(_0x5b08ce){return function(_0x1a7081){try{jsonpatch['apply'](_0x1a7081,_0x5b08ce,!![]);}catch(_0x1ed108){return BPromise[_0xff42('0x2a')](_0x1ed108);}return _0x1a7081[_0xff42('0x2b')]();};}function saveUpdates(_0x5ce640,_0x4e97ac){return function(_0xad73b6){if(_0xad73b6){return _0xad73b6[_0xff42('0x2c')](_0x5ce640)[_0xff42('0x2d')](function(_0x40bf48){return _0x40bf48;});}return null;};}function removeEntity(_0x5d179d,_0x3c0138){return function(_0x500efb){if(_0x500efb){return _0x500efb[_0xff42('0x2e')]()[_0xff42('0x2d')](function(){_0x5d179d[_0xff42('0x24')](0xcc)[_0xff42('0x23')]();});}};}function handleEntityNotFound(_0x50e7d0,_0xe9dc0f){return function(_0x3a2112){if(!_0x3a2112){_0x50e7d0['sendStatus'](0x194);}return _0x3a2112;};}function handleError(_0xe5ebf0,_0x29b019){_0x29b019=_0x29b019||0x1f4;return function(_0x25e96d){logger[_0xff42('0x1e')](_0x25e96d[_0xff42('0x2f')]);if(_0x25e96d[_0xff42('0x30')]){delete _0x25e96d[_0xff42('0x30')];}_0xe5ebf0['status'](_0x29b019)[_0xff42('0x31')](_0x25e96d);};}exports[_0xff42('0x32')]=function(_0x480a49,_0x321661){var _0x32d8dc={},_0x34280b={},_0x21b5c0={'count':0x0,'rows':[]};var _0x347573=_[_0xff42('0x33')](db[_0xff42('0x34')][_0xff42('0x35')],function(_0x168287){return{'name':_0x168287[_0xff42('0x36')],'type':_0x168287[_0xff42('0x37')][_0xff42('0x38')]};});_0x34280b[_0xff42('0x39')]=_[_0xff42('0x33')](_0x347573,'name');_0x34280b[_0xff42('0x3a')]=_['keys'](_0x480a49[_0xff42('0x3a')]);_0x34280b[_0xff42('0x3b')]=_[_0xff42('0x3c')](_0x34280b['model'],_0x34280b['query']);_0x32d8dc[_0xff42('0x3d')]=_['intersection'](_0x34280b[_0xff42('0x39')],qs[_0xff42('0x3e')](_0x480a49[_0xff42('0x3a')][_0xff42('0x3e')]));_0x32d8dc[_0xff42('0x3d')]=_0x32d8dc[_0xff42('0x3d')]['length']?_0x32d8dc[_0xff42('0x3d')]:_0x34280b[_0xff42('0x39')];if(!_0x480a49[_0xff42('0x3a')][_0xff42('0x3f')]('nolimit')){_0x32d8dc[_0xff42('0x27')]=qs[_0xff42('0x27')](_0x480a49[_0xff42('0x3a')][_0xff42('0x27')]);_0x32d8dc[_0xff42('0x26')]=qs[_0xff42('0x26')](_0x480a49[_0xff42('0x3a')][_0xff42('0x26')]);}_0x32d8dc[_0xff42('0x40')]=qs[_0xff42('0x41')](_0x480a49[_0xff42('0x3a')][_0xff42('0x41')]);_0x32d8dc[_0xff42('0x42')]=qs[_0xff42('0x3b')](_[_0xff42('0x43')](_0x480a49[_0xff42('0x3a')],_0x34280b[_0xff42('0x3b')]),_0x347573);if(_0x480a49[_0xff42('0x3a')]['filter']){_0x32d8dc[_0xff42('0x42')]=_[_0xff42('0x44')](_0x32d8dc[_0xff42('0x42')],{'$or':_['map'](_0x347573,function(_0x5123be){if(_0x5123be[_0xff42('0x37')]!==_0xff42('0x45')){var _0x61840e={};_0x61840e[_0x5123be[_0xff42('0x30')]]={'$like':'%'+_0x480a49[_0xff42('0x3a')][_0xff42('0x46')]+'%'};return _0x61840e;}})});}_0x32d8dc=_[_0xff42('0x44')]({},_0x32d8dc,_0x480a49[_0xff42('0x47')]);var _0x53b723={'where':_0x32d8dc[_0xff42('0x42')]};return db['DeskAccount'][_0xff42('0x48')](_0x53b723)[_0xff42('0x2d')](function(_0x3335e1){_0x21b5c0[_0xff42('0x48')]=_0x3335e1;if(_0x480a49[_0xff42('0x3a')][_0xff42('0x49')]){_0x32d8dc[_0xff42('0x4a')]=[{'all':!![]}];}return db[_0xff42('0x34')]['findAll'](_0x32d8dc);})[_0xff42('0x2d')](function(_0x72f4b8){_0x21b5c0['rows']=_0x72f4b8;return _0x21b5c0;})[_0xff42('0x2d')](respondWithFilteredResult(_0x321661,_0x32d8dc))[_0xff42('0x21')](handleError(_0x321661,null));};exports[_0xff42('0x4b')]=function(_0x40dcf0,_0x868b10){var _0x4f98ec={'raw':![],'where':{'id':_0x40dcf0[_0xff42('0x4c')]['id']}},_0x483732={};_0x483732[_0xff42('0x39')]=_['keys'](db[_0xff42('0x34')][_0xff42('0x35')]);_0x483732[_0xff42('0x3a')]=_[_0xff42('0x4d')](_0x40dcf0[_0xff42('0x3a')]);_0x483732[_0xff42('0x3b')]=_[_0xff42('0x3c')](_0x483732[_0xff42('0x39')],_0x483732[_0xff42('0x3a')]);_0x4f98ec[_0xff42('0x3d')]=_[_0xff42('0x3c')](_0x483732[_0xff42('0x39')],qs['fields'](_0x40dcf0[_0xff42('0x3a')][_0xff42('0x3e')]));_0x4f98ec[_0xff42('0x3d')]=_0x4f98ec['attributes'][_0xff42('0x4e')]?_0x4f98ec[_0xff42('0x3d')]:_0x483732['model'];if(_0x40dcf0[_0xff42('0x3a')][_0xff42('0x49')]){_0x4f98ec['include']=[{'all':!![]}];}_0x4f98ec=_[_0xff42('0x44')]({},_0x4f98ec,_0x40dcf0[_0xff42('0x47')]);return db[_0xff42('0x34')]['find'](_0x4f98ec)[_0xff42('0x2d')](handleEntityNotFound(_0x868b10,null))[_0xff42('0x2d')](respondWithResult(_0x868b10,null))[_0xff42('0x21')](handleError(_0x868b10,null));};exports[_0xff42('0x4f')]=function(_0x48f67e,_0x201633){return db[_0xff42('0x34')]['create'](_0x48f67e[_0xff42('0x50')],{})[_0xff42('0x2d')](respondWithResult(_0x201633,0xc9))[_0xff42('0x21')](handleError(_0x201633,null));};exports[_0xff42('0x2c')]=function(_0x58ce0a,_0x1d1fb1){if(_0x58ce0a[_0xff42('0x50')]['id']){delete _0x58ce0a[_0xff42('0x50')]['id'];}return db[_0xff42('0x34')][_0xff42('0x51')]({'where':{'id':_0x58ce0a[_0xff42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d1fb1,null))[_0xff42('0x2d')](saveUpdates(_0x58ce0a[_0xff42('0x50')],null))[_0xff42('0x2d')](respondWithResult(_0x1d1fb1,null))[_0xff42('0x21')](handleError(_0x1d1fb1,null));};exports[_0xff42('0x2e')]=function(_0x4ce485,_0x18d886){return db[_0xff42('0x34')][_0xff42('0x51')]({'where':{'id':_0x4ce485[_0xff42('0x4c')]['id']}})[_0xff42('0x2d')](handleEntityNotFound(_0x18d886,null))[_0xff42('0x2d')](removeEntity(_0x18d886,null))['catch'](handleError(_0x18d886,null));};exports['getConfigurations']=function(_0x1e70a4,_0x3ed968,_0x30af05){var _0x52617d={};var _0x599969={};var _0x1376d0;var _0x3aa700;return db[_0xff42('0x34')][_0xff42('0x52')]({'where':{'id':_0x1e70a4[_0xff42('0x4c')]['id']}})[_0xff42('0x2d')](handleEntityNotFound(_0x3ed968,null))[_0xff42('0x2d')](function(_0xc73f0c){if(_0xc73f0c){_0x1376d0=_0xc73f0c;_0x599969[_0xff42('0x39')]=_[_0xff42('0x4d')](db['DeskConfiguration']['rawAttributes']);_0x599969[_0xff42('0x3a')]=_['keys'](_0x1e70a4[_0xff42('0x3a')]);_0x599969['filters']=_[_0xff42('0x3c')](_0x599969[_0xff42('0x39')],_0x599969[_0xff42('0x3a')]);_0x52617d[_0xff42('0x3d')]=_['intersection'](_0x599969['model'],qs[_0xff42('0x3e')](_0x1e70a4[_0xff42('0x3a')][_0xff42('0x3e')]));_0x52617d['attributes']=_0x52617d[_0xff42('0x3d')]['length']?_0x52617d[_0xff42('0x3d')]:_0x599969['model'];_0x52617d[_0xff42('0x40')]=qs['sort'](_0x1e70a4['query'][_0xff42('0x41')]);_0x52617d['where']=qs[_0xff42('0x3b')](_[_0xff42('0x43')](_0x1e70a4[_0xff42('0x3a')],_0x599969[_0xff42('0x3b')]));if(_0x1e70a4['query'][_0xff42('0x46')]){_0x52617d[_0xff42('0x42')]=_[_0xff42('0x44')](_0x52617d[_0xff42('0x42')],{'$or':_[_0xff42('0x33')](_0x52617d[_0xff42('0x3d')],function(_0x3be1d9){var _0x2a9d3c={};_0x2a9d3c[_0x3be1d9]={'$like':'%'+_0x1e70a4[_0xff42('0x3a')]['filter']+'%'};return _0x2a9d3c;})});}_0x52617d=_[_0xff42('0x44')]({},_0x52617d,_0x1e70a4[_0xff42('0x47')]);return _0x1376d0['getConfigurations'](_0x52617d);}})[_0xff42('0x2d')](function(_0x1399d5){if(_0x1399d5){_0x3aa700=_0x1399d5[_0xff42('0x4e')];if(!_0x1e70a4['query'][_0xff42('0x3f')](_0xff42('0x53'))){_0x52617d['limit']=qs['limit'](_0x1e70a4[_0xff42('0x3a')][_0xff42('0x27')]);_0x52617d[_0xff42('0x26')]=qs[_0xff42('0x26')](_0x1e70a4[_0xff42('0x3a')]['offset']);}return _0x1376d0['getConfigurations'](_0x52617d);}})[_0xff42('0x2d')](function(_0x541d8e){if(_0x541d8e){return _0x541d8e?{'count':_0x3aa700,'rows':_0x541d8e}:null;}})[_0xff42('0x2d')](respondWithResult(_0x3ed968,null))['catch'](handleError(_0x3ed968,null));};exports[_0xff42('0x54')]=function(_0x434a9e,_0x1bbf4e,_0x2d6e27){if(_0x434a9e[_0xff42('0x50')]['id']){delete _0x434a9e[_0xff42('0x50')]['id'];}return db[_0xff42('0x34')][_0xff42('0x52')]({'where':{'id':_0x434a9e[_0xff42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1bbf4e,null))[_0xff42('0x2d')](function(_0x52af96){if(_0x52af96){_0x434a9e[_0xff42('0x50')]['AccountId']=_0x52af96['id'];_0x434a9e[_0xff42('0x50')][_0xff42('0x55')]=integrations[_0xff42('0x56')](_0x434a9e['body'][_0xff42('0x57')],_0x434a9e[_0xff42('0x50')][_0xff42('0x37')]);_0x434a9e[_0xff42('0x50')][_0xff42('0x58')]=integrations[_0xff42('0x59')](_0x434a9e['body']['channel'],_0x434a9e[_0xff42('0x50')]['type']);return db[_0xff42('0x5a')][_0xff42('0x4f')](_0x434a9e[_0xff42('0x50')],{'include':[{'model':db[_0xff42('0x5b')],'as':'Subjects'},{'model':db[_0xff42('0x5b')],'as':_0xff42('0x58')}]});}return null;})['then'](respondWithResult(_0x1bbf4e,null))['catch'](handleError(_0x1bbf4e,null));};exports[_0xff42('0x5c')]=function(_0x1ed366,_0x4d2fd0,_0x477030){var _0x33c07e=[{'name':_0xff42('0x5d'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xa68446='';return db[_0xff42('0x34')]['findOne']({'where':{'id':_0x1ed366[_0xff42('0x4c')]['id']},'attributes':['id',_0xff42('0x5e'),_0xff42('0x5f'),_0xff42('0x60'),'password',_0xff42('0x61'),'consumerSecret',_0xff42('0x62'),_0xff42('0x63')]})[_0xff42('0x2d')](handleEntityNotFound(_0x4d2fd0,null))[_0xff42('0x2d')](function(_0x4f8f16){if(_0x4f8f16){_0xa68446=_0x4f8f16[_0xff42('0x5e')];var _0x245e4f=_0xa68446[_0xff42('0x64')](-0x1);if(_0x245e4f==='/'){_0xa68446=_0xa68446[_0xff42('0x65')](0x0,_0xa68446[_0xff42('0x66')](_0x245e4f));}var _0x59239c={'method':_0xff42('0x67'),'uri':util[_0xff42('0x68')](_0xff42('0x69'),_0xa68446),'headers':{'Content-Type':_0xff42('0x6a'),'Accept':_0xff42('0x6a')},'json':!![]};if(_0x4f8f16[_0xff42('0x5f')]===_0xff42('0x6b')){_0x59239c[_0xff42('0x6c')][_0xff42('0x6d')]=util['format'](_0xff42('0x6e'),new Buffer(util['format'](_0xff42('0x6f'),_0x4f8f16[_0xff42('0x60')],_0x4f8f16[_0xff42('0x70')]))[_0xff42('0x71')]('base64'));}return rp(_0x59239c)[_0xff42('0x2d')](function(_0x198dbb){return _0x33c07e[_0xff42('0x72')](_['map'](_0x198dbb[_0xff42('0x73')][_0xff42('0x74')],function(_0x53257e){return{'id':_0x53257e[_0xff42('0x30')],'name':_0x53257e[_0xff42('0x30')],'type':_0x53257e[_0xff42('0x37')],'active':_0x53257e[_0xff42('0x75')],'label':_0x53257e['label'],'custom':!![]};}));});}})['then'](function(_0x8da052){return{'count':_0x8da052[_0xff42('0x4e')],'rows':_0x8da052};})[_0xff42('0x2d')](respondWithResult(_0x4d2fd0,null))[_0xff42('0x21')](function(_0x25871c){var _0x1fed0d=_0x1ed366[_0xff42('0x3a')][_0xff42('0x76')]?0x1f4:_0x25871c[_0xff42('0x77')]||0x1f4;logger[_0xff42('0x1e')](_0xff42('0x78'),_0xff42('0x5c'),_0x1fed0d,JSON[_0xff42('0x79')](_0x25871c));delete _0x25871c[_0xff42('0x30')];if(_0x1fed0d===0x191){_0x1fed0d=0x190;}_0x4d2fd0[_0xff42('0x24')](_0x1fed0d)[_0xff42('0x31')](_0x1ed366[_0xff42('0x3a')]['test']?{'message':_0xff42('0x7a'),'statusCode':_0x25871c[_0xff42('0x77')]}:_0x25871c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 12901b4..8229cfe 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 _0x519f=['define','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1e781c,_0x3c33e3){var _0x5a1156=function(_0x4b9e2c){while(--_0x4b9e2c){_0x1e781c['push'](_0x1e781c['shift']());}};_0x5a1156(++_0x3c33e3);}(_0x519f,0xab));var _0xf519=function(_0x42ab78,_0x1a1bf7){_0x42ab78=_0x42ab78-0x0;var _0x1f59de=_0x519f[_0x42ab78];return _0x1f59de;};'use strict';var _=require(_0xf519('0x0'));var util=require('util');var logger=require(_0xf519('0x1'))(_0xf519('0x2'));var moment=require(_0xf519('0x3'));var BPromise=require(_0xf519('0x4'));var rp=require(_0xf519('0x5'));var fs=require('fs');var path=require(_0xf519('0x6'));var rimraf=require(_0xf519('0x7'));var config=require(_0xf519('0x8'));var attributes=require(_0xf519('0x9'));var integrations=require(_0xf519('0xa'));module['exports']=function(_0x471b37,_0x169e3e){return _0x471b37[_0xf519('0xb')]('DeskAccount',attributes,{'tableName':_0xf519('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7f9=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x13167f,_0x323f1a){var _0x4a55b4=function(_0x1fc773){while(--_0x1fc773){_0x13167f['push'](_0x13167f['shift']());}};_0x4a55b4(++_0x323f1a);}(_0xf7f9,0x1aa));var _0x9f7f=function(_0x508af7,_0x3341cd){_0x508af7=_0x508af7-0x0;var _0x5733e8=_0xf7f9[_0x508af7];return _0x5733e8;};'use strict';var _=require(_0x9f7f('0x0'));var util=require('util');var logger=require(_0x9f7f('0x1'))(_0x9f7f('0x2'));var moment=require('moment');var BPromise=require(_0x9f7f('0x3'));var rp=require(_0x9f7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f7f('0x5'));var config=require(_0x9f7f('0x6'));var attributes=require(_0x9f7f('0x7'));var integrations=require(_0x9f7f('0x8'));module['exports']=function(_0x193dc3,_0x315437){return _0x193dc3[_0x9f7f('0x9')](_0x9f7f('0xa'),attributes,{'tableName':_0x9f7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index a62a4b7..2d3ed2e 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 _0x9ca9=['moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','map','include','model','debug','ShowDeskAccount','catch','lodash','util'];(function(_0x305ad3,_0x244a36){var _0x3df215=function(_0xe102aa){while(--_0xe102aa){_0x305ad3['push'](_0x305ad3['shift']());}};_0x3df215(++_0x244a36);}(_0x9ca9,0x196));var _0x99ca=function(_0x352ad0,_0x3f701a){_0x352ad0=_0x352ad0-0x0;var _0x466925=_0x9ca9[_0x352ad0];return _0x466925;};'use strict';var _=require(_0x99ca('0x0'));var util=require(_0x99ca('0x1'));var moment=require(_0x99ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x99ca('0x3'));var fs=require('fs');var Redis=require(_0x99ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99ca('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x99ca('0x6'));var jayson=require(_0x99ca('0x7'));var client=jayson[_0x99ca('0x8')][_0x99ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3696cd,_0x14ca26,_0x556647){return new BPromise(function(_0x58405f,_0x51e217){return client[_0x99ca('0xa')](_0x3696cd,_0x556647)[_0x99ca('0xb')](function(_0x158cd2){logger[_0x99ca('0xc')]('DeskAccount,\x20%s,\x20%s',_0x14ca26,_0x99ca('0xd'));logger['debug'](_0x99ca('0xe'),_0x14ca26,_0x99ca('0xd'),JSON[_0x99ca('0xf')](_0x158cd2));if(_0x158cd2['error']){if(_0x158cd2[_0x99ca('0x10')][_0x99ca('0x11')]===0x1f4){logger[_0x99ca('0x10')](_0x99ca('0x12'),_0x14ca26,_0x158cd2[_0x99ca('0x10')][_0x99ca('0x13')]);return _0x51e217(_0x158cd2[_0x99ca('0x10')][_0x99ca('0x13')]);}logger['error'](_0x99ca('0x12'),_0x14ca26,_0x158cd2[_0x99ca('0x10')]['message']);return _0x58405f(_0x158cd2[_0x99ca('0x10')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x14ca26,'request\x20sent');_0x58405f(_0x158cd2[_0x99ca('0x14')]['message']);}})['catch'](function(_0x3e5c27){logger[_0x99ca('0x10')](_0x99ca('0x12'),_0x14ca26,_0x3e5c27);_0x51e217(_0x3e5c27);});});}exports[_0x99ca('0x15')]=function(_0x430e06){var _0x6d948f=this;return new Promise(function(_0xee2726,_0x3bf310){return db[_0x99ca('0x16')][_0x99ca('0x17')]({'raw':_0x430e06[_0x99ca('0x18')]?_0x430e06[_0x99ca('0x18')][_0x99ca('0x19')]===undefined?!![]:![]:!![],'where':_0x430e06['options']?_0x430e06[_0x99ca('0x18')]['where']||null:null,'attributes':_0x430e06[_0x99ca('0x18')]?_0x430e06['options'][_0x99ca('0x1a')]||null:null,'limit':_0x430e06[_0x99ca('0x18')]?_0x430e06[_0x99ca('0x18')][_0x99ca('0x1b')]||null:null,'include':_0x430e06['options']?_0x430e06['options']['include']?_[_0x99ca('0x1c')](_0x430e06['options'][_0x99ca('0x1d')],function(_0x343b18){return{'model':db[_0x343b18['model']],'as':_0x343b18['as'],'attributes':_0x343b18[_0x99ca('0x1a')],'include':_0x343b18[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x343b18[_0x99ca('0x1d')],function(_0x3eb3ca){return{'model':db[_0x3eb3ca[_0x99ca('0x1e')]],'as':_0x3eb3ca['as'],'attributes':_0x3eb3ca['attributes'],'include':_0x3eb3ca[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x3eb3ca[_0x99ca('0x1d')],function(_0x3f002e){return{'model':db[_0x3f002e['model']],'as':_0x3f002e['as'],'attributes':_0x3f002e[_0x99ca('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99ca('0xb')](function(_0x20774e){logger[_0x99ca('0xc')]('GetDeskAccount',_0x430e06);logger[_0x99ca('0x1f')](_0x99ca('0x15'),_0x430e06,JSON[_0x99ca('0xf')](_0x20774e));_0xee2726(_0x20774e);})['catch'](function(_0x31cf75){logger['error']('GetDeskAccount',_0x31cf75[_0x99ca('0x13')],_0x430e06);_0x3bf310(_0x6d948f[_0x99ca('0x10')](0x1f4,_0x31cf75[_0x99ca('0x13')]));});});};exports[_0x99ca('0x20')]=function(_0x4f6aa6){var _0x2ef5fe=this;return new Promise(function(_0x56782b,_0x5c7bae){return db['DeskAccount']['find']({'raw':_0x4f6aa6[_0x99ca('0x18')]?_0x4f6aa6['options'][_0x99ca('0x19')]===undefined?!![]:![]:!![],'where':_0x4f6aa6[_0x99ca('0x18')]?_0x4f6aa6['options']['where']||null:null,'attributes':_0x4f6aa6[_0x99ca('0x18')]?_0x4f6aa6['options'][_0x99ca('0x1a')]||null:null,'include':_0x4f6aa6['options']?_0x4f6aa6['options'][_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x4f6aa6['options']['include'],function(_0x24beef){return{'model':db[_0x24beef['model']],'as':_0x24beef['as'],'attributes':_0x24beef[_0x99ca('0x1a')],'include':_0x24beef[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x24beef['include'],function(_0x13706c){return{'model':db[_0x13706c['model']],'as':_0x13706c['as'],'attributes':_0x13706c[_0x99ca('0x1a')],'include':_0x13706c[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x13706c[_0x99ca('0x1d')],function(_0x2454a0){return{'model':db[_0x2454a0[_0x99ca('0x1e')]],'as':_0x2454a0['as'],'attributes':_0x2454a0[_0x99ca('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99ca('0xb')](function(_0x2a3434){logger['info'](_0x99ca('0x20'),_0x4f6aa6);logger[_0x99ca('0x1f')](_0x99ca('0x20'),_0x4f6aa6,JSON['stringify'](_0x2a3434));_0x56782b(_0x2a3434);})[_0x99ca('0x21')](function(_0x5eb993){logger[_0x99ca('0x10')](_0x99ca('0x20'),_0x5eb993[_0x99ca('0x13')],_0x4f6aa6);_0x5c7bae(_0x2ef5fe['error'](0x1f4,_0x5eb993[_0x99ca('0x13')]));});});}; \ No newline at end of file +var _0x32f2=['code','DeskAccount,\x20%s,\x20%s','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','request','then','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4004da,_0x346a26){var _0x44cab5=function(_0x3483cf){while(--_0x3483cf){_0x4004da['push'](_0x4004da['shift']());}};_0x44cab5(++_0x346a26);}(_0x32f2,0x1b7));var _0x232f=function(_0x536c6b,_0x59a85c){_0x536c6b=_0x536c6b-0x0;var _0x43499d=_0x32f2[_0x536c6b];return _0x43499d;};'use strict';var _=require(_0x232f('0x0'));var util=require(_0x232f('0x1'));var moment=require(_0x232f('0x2'));var BPromise=require(_0x232f('0x3'));var rs=require(_0x232f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x232f('0x5'));var logger=require('../../config/logger')(_0x232f('0x6'));var config=require('../../config/environment');var jayson=require(_0x232f('0x7'));var client=jayson['client'][_0x232f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x546c98,_0x15f71d,_0x5b0040){return new BPromise(function(_0x4b04fd,_0x5c2b4e){return client[_0x232f('0x9')](_0x546c98,_0x5b0040)[_0x232f('0xa')](function(_0x58d278){logger['info']('DeskAccount,\x20%s,\x20%s',_0x15f71d,'request\x20sent');logger[_0x232f('0xb')](_0x232f('0xc'),_0x15f71d,_0x232f('0xd'),JSON[_0x232f('0xe')](_0x58d278));if(_0x58d278[_0x232f('0xf')]){if(_0x58d278['error'][_0x232f('0x10')]===0x1f4){logger[_0x232f('0xf')](_0x232f('0x11'),_0x15f71d,_0x58d278['error'][_0x232f('0x12')]);return _0x5c2b4e(_0x58d278[_0x232f('0xf')][_0x232f('0x12')]);}logger[_0x232f('0xf')]('DeskAccount,\x20%s,\x20%s',_0x15f71d,_0x58d278['error'][_0x232f('0x12')]);return _0x4b04fd(_0x58d278[_0x232f('0xf')]['message']);}else{logger[_0x232f('0x13')]('DeskAccount,\x20%s,\x20%s',_0x15f71d,_0x232f('0xd'));_0x4b04fd(_0x58d278[_0x232f('0x14')][_0x232f('0x12')]);}})[_0x232f('0x15')](function(_0x296238){logger[_0x232f('0xf')](_0x232f('0x11'),_0x15f71d,_0x296238);_0x5c2b4e(_0x296238);});});}exports[_0x232f('0x16')]=function(_0x502344){var _0x30107d=this;return new Promise(function(_0x16188e,_0xfd72f2){return db[_0x232f('0x17')][_0x232f('0x18')]({'raw':_0x502344[_0x232f('0x19')]?_0x502344[_0x232f('0x19')][_0x232f('0x1a')]===undefined?!![]:![]:!![],'where':_0x502344['options']?_0x502344[_0x232f('0x19')][_0x232f('0x1b')]||null:null,'attributes':_0x502344['options']?_0x502344['options'][_0x232f('0x1c')]||null:null,'limit':_0x502344[_0x232f('0x19')]?_0x502344['options'][_0x232f('0x1d')]||null:null,'include':_0x502344['options']?_0x502344[_0x232f('0x19')]['include']?_['map'](_0x502344['options'][_0x232f('0x1e')],function(_0x227ac7){return{'model':db[_0x227ac7[_0x232f('0x1f')]],'as':_0x227ac7['as'],'attributes':_0x227ac7[_0x232f('0x1c')],'include':_0x227ac7['include']?_[_0x232f('0x20')](_0x227ac7['include'],function(_0x362be7){return{'model':db[_0x362be7['model']],'as':_0x362be7['as'],'attributes':_0x362be7[_0x232f('0x1c')],'include':_0x362be7[_0x232f('0x1e')]?_[_0x232f('0x20')](_0x362be7[_0x232f('0x1e')],function(_0x2acfd9){return{'model':db[_0x2acfd9[_0x232f('0x1f')]],'as':_0x2acfd9['as'],'attributes':_0x2acfd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x232f('0xa')](function(_0x1ba6c7){logger['info'](_0x232f('0x16'),_0x502344);logger[_0x232f('0xb')](_0x232f('0x16'),_0x502344,JSON['stringify'](_0x1ba6c7));_0x16188e(_0x1ba6c7);})[_0x232f('0x15')](function(_0x3753e3){logger[_0x232f('0xf')](_0x232f('0x16'),_0x3753e3[_0x232f('0x12')],_0x502344);_0xfd72f2(_0x30107d[_0x232f('0xf')](0x1f4,_0x3753e3['message']));});});};exports[_0x232f('0x21')]=function(_0x56f29d){var _0x39db7c=this;return new Promise(function(_0x5d0c72,_0x36bacd){return db[_0x232f('0x17')][_0x232f('0x22')]({'raw':_0x56f29d[_0x232f('0x19')]?_0x56f29d[_0x232f('0x19')][_0x232f('0x1a')]===undefined?!![]:![]:!![],'where':_0x56f29d['options']?_0x56f29d[_0x232f('0x19')]['where']||null:null,'attributes':_0x56f29d['options']?_0x56f29d[_0x232f('0x19')][_0x232f('0x1c')]||null:null,'include':_0x56f29d[_0x232f('0x19')]?_0x56f29d[_0x232f('0x19')][_0x232f('0x1e')]?_[_0x232f('0x20')](_0x56f29d[_0x232f('0x19')][_0x232f('0x1e')],function(_0x40e704){return{'model':db[_0x40e704[_0x232f('0x1f')]],'as':_0x40e704['as'],'attributes':_0x40e704[_0x232f('0x1c')],'include':_0x40e704[_0x232f('0x1e')]?_[_0x232f('0x20')](_0x40e704[_0x232f('0x1e')],function(_0x3a3614){return{'model':db[_0x3a3614[_0x232f('0x1f')]],'as':_0x3a3614['as'],'attributes':_0x3a3614[_0x232f('0x1c')],'include':_0x3a3614[_0x232f('0x1e')]?_[_0x232f('0x20')](_0x3a3614['include'],function(_0x2925d8){return{'model':db[_0x2925d8[_0x232f('0x1f')]],'as':_0x2925d8['as'],'attributes':_0x2925d8[_0x232f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x232f('0xa')](function(_0xd1e83){logger[_0x232f('0x13')](_0x232f('0x21'),_0x56f29d);logger[_0x232f('0xb')](_0x232f('0x21'),_0x56f29d,JSON['stringify'](_0xd1e83));_0x5d0c72(_0xd1e83);})[_0x232f('0x15')](function(_0x311b6b){logger[_0x232f('0xf')]('ShowDeskAccount',_0x311b6b['message'],_0x56f29d);_0x36bacd(_0x39db7c[_0x232f('0xf')](0x1f4,_0x311b6b[_0x232f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a45fe34..6a18981 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 _0x9fe7=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','exports','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9fe7,0x1df));var _0x79fe=function(_0x6bd69c,_0x27c4d4){_0x6bd69c=_0x6bd69c-0x0;var _0x1a237c=_0x9fe7[_0x6bd69c];return _0x1a237c;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var auth=require(_0x79fe('0x4'));var interaction=require(_0x79fe('0x5'));var config=require('../../config/environment');var controller=require(_0x79fe('0x6'));router[_0x79fe('0x7')]('/',auth[_0x79fe('0x8')](),controller['index']);router[_0x79fe('0x7')](_0x79fe('0x9'),auth[_0x79fe('0x8')](),controller['show']);router[_0x79fe('0x7')](_0x79fe('0xa'),auth[_0x79fe('0x8')](),controller[_0x79fe('0xb')]);router[_0x79fe('0x7')]('/:id/subjects',auth[_0x79fe('0x8')](),controller[_0x79fe('0xc')]);router['get'](_0x79fe('0xd'),auth[_0x79fe('0x8')](),controller[_0x79fe('0xe')]);router[_0x79fe('0x7')]('/:id/tags',auth[_0x79fe('0x8')](),controller[_0x79fe('0xf')]);router[_0x79fe('0x10')]('/',auth[_0x79fe('0x8')](),controller[_0x79fe('0x11')]);router[_0x79fe('0x10')](_0x79fe('0x12'),auth[_0x79fe('0x8')](),controller['setTags']);router[_0x79fe('0x13')](_0x79fe('0x9'),auth[_0x79fe('0x8')](),controller[_0x79fe('0x14')]);router[_0x79fe('0x15')](_0x79fe('0x9'),auth['isAuthenticated'](),controller[_0x79fe('0x16')]);module[_0x79fe('0x17')]=router; \ No newline at end of file +var _0x0a6b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','delete','destroy','exports','multer','express'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x10f1eb,_0x35d3b5){_0x10f1eb=_0x10f1eb-0x0;var _0x322079=_0x0a6b[_0x10f1eb];return _0x322079;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var auth=require(_0xb0a6('0x2'));var interaction=require(_0xb0a6('0x3'));var config=require(_0xb0a6('0x4'));var controller=require('./intDeskConfiguration.controller');router[_0xb0a6('0x5')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0x6')]);router[_0xb0a6('0x5')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x8')]);router[_0xb0a6('0x5')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xb0a6('0x5')](_0xb0a6('0x9'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xa')]);router['get'](_0xb0a6('0xb'),auth[_0xb0a6('0x7')](),controller['getDescriptions']);router[_0xb0a6('0x5')](_0xb0a6('0xc'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xd')]);router[_0xb0a6('0xe')]('/',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xf')]);router[_0xb0a6('0xe')](_0xb0a6('0xc'),auth[_0xb0a6('0x7')](),controller['setTags']);router[_0xb0a6('0x10')]('/:id',auth[_0xb0a6('0x7')](),controller['update']);router[_0xb0a6('0x11')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x12')]);module[_0xb0a6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7f07347..f7054fe 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 _0xda98=['sequelize','exports','STRING'];(function(_0x45eb00,_0x4ffd60){var _0x281c1e=function(_0xdd8aae){while(--_0xdd8aae){_0x45eb00['push'](_0x45eb00['shift']());}};_0x281c1e(++_0x4ffd60);}(_0xda98,0x189));var _0x8da9=function(_0x45ce1a,_0x4f8ea5){_0x45ce1a=_0x45ce1a-0x0;var _0x4926d8=_0xda98[_0x45ce1a];return _0x4926d8;};'use strict';var Sequelize=require(_0x8da9('0x0'));module[_0x8da9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8da9('0x2')]}}; \ No newline at end of file +var _0xf1da=['STRING'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf1da,0x1a7));var _0xaf1d=function(_0x3c2a24,_0x5c67a0){_0x3c2a24=_0x3c2a24-0x0;var _0x1b29e1=_0xf1da[_0x3c2a24];return _0x1b29e1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaf1d('0x0')]},'description':{'type':Sequelize[_0xaf1d('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 6f99451..201bcc0 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 _0xa810=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','apply','save','update','destroy','end','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','DeskConfiguration','count','findAll','rows','show','includeAll','include','find','create','body','params','findOne','rawAttributes','sort','getFields','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x16211f,_0x46fac4){var _0x4eaba4=function(_0x2c30ab){while(--_0x2c30ab){_0x16211f['push'](_0x16211f['shift']());}};_0x4eaba4(++_0x46fac4);}(_0xa810,0x10b));var _0x0a81=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xa810[_0x2e04ef];return _0x5722b0;};'use strict';var pdf=require(_0x0a81('0x0'));var emlformat=require(_0x0a81('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0a81('0x2'));var jsonpatch=require(_0x0a81('0x3'));var rp=require(_0x0a81('0x4'));var moment=require(_0x0a81('0x5'));var BPromise=require(_0x0a81('0x6'));var Mustache=require(_0x0a81('0x7'));var util=require('util');var path=require(_0x0a81('0x8'));var sox=require(_0x0a81('0x9'));var csv=require(_0x0a81('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a81('0xb'));var squel=require(_0x0a81('0xc'));var crypto=require('crypto');var jsforce=require(_0x0a81('0xd'));var deskjs=require(_0x0a81('0xe'));var toCsv=require(_0x0a81('0xa'));var querystring=require(_0x0a81('0xf'));var Papa=require(_0x0a81('0x10'));var Redis=require(_0x0a81('0x11'));var authService=require(_0x0a81('0x12'));var qs=require(_0x0a81('0x13'));var as=require(_0x0a81('0x14'));var hardwareService=require(_0x0a81('0x15'));var logger=require(_0x0a81('0x16'))('api');var utils=require(_0x0a81('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0a81('0x18'));var db=require(_0x0a81('0x19'))['db'];var jayson=require(_0x0a81('0x1a'));var client=jayson[_0x0a81('0x1b')][_0x0a81('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xd48db4,_0x2b0036,_0x25da1e,_0x574dd0){return new BPromise(function(_0x1acdf7,_0x3778f2){var _0x4669a1=_0x574dd0||client;return _0x4669a1['request'](_0xd48db4,_0x25da1e)[_0x0a81('0x1d')](function(_0x767e19){logger['info'](_0x0a81('0x1e'),_0x2b0036,_0x0a81('0x1f'));logger['debug'](_0x0a81('0x20'),_0x2b0036,'request\x20sent',JSON['stringify'](_0x767e19));if(_0x767e19[_0x0a81('0x21')]){if(_0x767e19[_0x0a81('0x21')][_0x0a81('0x22')]===0x1f4){logger['error'](_0x0a81('0x1e'),_0x2b0036,_0x767e19[_0x0a81('0x21')][_0x0a81('0x23')]);return _0x3778f2(_0x767e19[_0x0a81('0x21')]['message']);}logger[_0x0a81('0x21')](_0x0a81('0x1e'),_0x2b0036,_0x767e19[_0x0a81('0x21')][_0x0a81('0x23')]);return _0x1acdf7(_0x767e19[_0x0a81('0x21')][_0x0a81('0x23')]);}else{logger[_0x0a81('0x24')](_0x0a81('0x1e'),_0x2b0036,_0x0a81('0x1f'));_0x1acdf7(_0x767e19[_0x0a81('0x25')][_0x0a81('0x23')]);}})[_0x0a81('0x26')](function(_0x2f6403){logger['error'](_0x0a81('0x1e'),_0x2b0036,_0x2f6403);_0x3778f2(_0x2f6403);});});}function respondWithStatusCode(_0x35e1dc,_0x274b7f){_0x274b7f=_0x274b7f||0xcc;return function(_0x1eadc4){if(_0x1eadc4){return _0x35e1dc[_0x0a81('0x27')](_0x274b7f);}return _0x35e1dc[_0x0a81('0x28')](_0x274b7f)['end']();};}function respondWithResult(_0x234865,_0x21e441){_0x21e441=_0x21e441||0xc8;return function(_0xf897d7){if(_0xf897d7){return _0x234865[_0x0a81('0x28')](_0x21e441)[_0x0a81('0x29')](_0xf897d7);}};}function respondWithFilteredResult(_0x38e857,_0x5a3e6f){return function(_0x40541d){if(_0x40541d){var _0x6bc94d=_0x40541d['count'],_0x126c31=_0x5a3e6f[_0x0a81('0x2a')],_0x23a03e=_0x5a3e6f[_0x0a81('0x2a')]+_0x5a3e6f[_0x0a81('0x2b')],_0x5c5bb4;if(_0x23a03e>=_0x6bc94d){_0x23a03e=_0x6bc94d;_0x5c5bb4=0xc8;}else{_0x5c5bb4=0xce;}_0x38e857[_0x0a81('0x28')](_0x5c5bb4);return _0x38e857[_0x0a81('0x2c')]('Content-Range',_0x126c31+'-'+_0x23a03e+'/'+_0x6bc94d)[_0x0a81('0x29')](_0x40541d);}return null;};}function patchUpdates(_0x47a8c0){return function(_0x676d2a){try{jsonpatch[_0x0a81('0x2d')](_0x676d2a,_0x47a8c0,!![]);}catch(_0x47602d){return BPromise['reject'](_0x47602d);}return _0x676d2a[_0x0a81('0x2e')]();};}function saveUpdates(_0x48f824,_0x24a36e){return function(_0x3d1f73){if(_0x3d1f73){return _0x3d1f73[_0x0a81('0x2f')](_0x48f824)['then'](function(_0xb3060c){return _0xb3060c;});}return null;};}function removeEntity(_0x4c3d59,_0xf8f278){return function(_0x585f24){if(_0x585f24){return _0x585f24[_0x0a81('0x30')]()['then'](function(){_0x4c3d59[_0x0a81('0x28')](0xcc)[_0x0a81('0x31')]();});}};}function handleEntityNotFound(_0x2182a0,_0x1df2da){return function(_0x3b6a04){if(!_0x3b6a04){_0x2182a0['sendStatus'](0x194);}return _0x3b6a04;};}function handleError(_0x3562d9,_0x5b4766){_0x5b4766=_0x5b4766||0x1f4;return function(_0x4ec538){logger[_0x0a81('0x21')](_0x4ec538[_0x0a81('0x32')]);if(_0x4ec538[_0x0a81('0x33')]){delete _0x4ec538[_0x0a81('0x33')];}_0x3562d9[_0x0a81('0x28')](_0x5b4766)[_0x0a81('0x34')](_0x4ec538);};}exports[_0x0a81('0x35')]=function(_0x17d2af,_0x3a25aa){var _0x2055da={},_0x5403ef={},_0x493330={'count':0x0,'rows':[]};var _0x1fd960=_[_0x0a81('0x36')](db['DeskConfiguration']['rawAttributes'],function(_0x37c171){return{'name':_0x37c171[_0x0a81('0x37')],'type':_0x37c171[_0x0a81('0x38')][_0x0a81('0x39')]};});_0x5403ef['model']=_[_0x0a81('0x36')](_0x1fd960,_0x0a81('0x33'));_0x5403ef[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x17d2af[_0x0a81('0x3a')]);_0x5403ef[_0x0a81('0x3c')]=_['intersection'](_0x5403ef[_0x0a81('0x3d')],_0x5403ef[_0x0a81('0x3a')]);_0x2055da[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x5403ef['model'],qs[_0x0a81('0x40')](_0x17d2af['query'][_0x0a81('0x40')]));_0x2055da[_0x0a81('0x3e')]=_0x2055da[_0x0a81('0x3e')][_0x0a81('0x41')]?_0x2055da['attributes']:_0x5403ef[_0x0a81('0x3d')];if(!_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x42')](_0x0a81('0x43'))){_0x2055da['limit']=qs[_0x0a81('0x2b')](_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x2b')]);_0x2055da['offset']=qs[_0x0a81('0x2a')](_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x2a')]);}_0x2055da[_0x0a81('0x44')]=qs['sort'](_0x17d2af['query']['sort']);_0x2055da[_0x0a81('0x45')]=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x17d2af[_0x0a81('0x3a')],_0x5403ef[_0x0a81('0x3c')]),_0x1fd960);if(_0x17d2af['query'][_0x0a81('0x47')]){_0x2055da[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x2055da['where'],{'$or':_[_0x0a81('0x36')](_0x1fd960,function(_0x2181bc){if(_0x2181bc[_0x0a81('0x38')]!=='VIRTUAL'){var _0x4996c7={};_0x4996c7[_0x2181bc[_0x0a81('0x33')]]={'$like':'%'+_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x47')]+'%'};return _0x4996c7;}})});}_0x2055da=_[_0x0a81('0x48')]({},_0x2055da,_0x17d2af[_0x0a81('0x49')]);var _0xea5921={'where':_0x2055da[_0x0a81('0x45')]};return db[_0x0a81('0x4a')][_0x0a81('0x4b')](_0xea5921)[_0x0a81('0x1d')](function(_0x3103e9){_0x493330[_0x0a81('0x4b')]=_0x3103e9;if(_0x17d2af[_0x0a81('0x3a')]['includeAll']){_0x2055da['include']=[{'all':!![]}];}return db[_0x0a81('0x4a')][_0x0a81('0x4c')](_0x2055da);})[_0x0a81('0x1d')](function(_0x5155f3){_0x493330[_0x0a81('0x4d')]=_0x5155f3;return _0x493330;})['then'](respondWithFilteredResult(_0x3a25aa,_0x2055da))[_0x0a81('0x26')](handleError(_0x3a25aa,null));};exports[_0x0a81('0x4e')]=function(_0x13aeba,_0x319abf){var _0xd509e8={'raw':![],'where':{'id':_0x13aeba['params']['id']}},_0x2a650c={};_0x2a650c['model']=_['keys'](db[_0x0a81('0x4a')]['rawAttributes']);_0x2a650c[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x13aeba['query']);_0x2a650c[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x2a650c['model'],_0x2a650c[_0x0a81('0x3a')]);_0xd509e8['attributes']=_[_0x0a81('0x3f')](_0x2a650c[_0x0a81('0x3d')],qs[_0x0a81('0x40')](_0x13aeba[_0x0a81('0x3a')][_0x0a81('0x40')]));_0xd509e8[_0x0a81('0x3e')]=_0xd509e8[_0x0a81('0x3e')]['length']?_0xd509e8[_0x0a81('0x3e')]:_0x2a650c[_0x0a81('0x3d')];if(_0x13aeba['query'][_0x0a81('0x4f')]){_0xd509e8[_0x0a81('0x50')]=[{'all':!![]}];}_0xd509e8=_[_0x0a81('0x48')]({},_0xd509e8,_0x13aeba[_0x0a81('0x49')]);return db[_0x0a81('0x4a')][_0x0a81('0x51')](_0xd509e8)['then'](handleEntityNotFound(_0x319abf,null))[_0x0a81('0x1d')](respondWithResult(_0x319abf,null))[_0x0a81('0x26')](handleError(_0x319abf,null));};exports[_0x0a81('0x52')]=function(_0x36d721,_0x22a18a){return db[_0x0a81('0x4a')][_0x0a81('0x52')](_0x36d721[_0x0a81('0x53')],{})['then'](respondWithResult(_0x22a18a,0xc9))[_0x0a81('0x26')](handleError(_0x22a18a,null));};exports[_0x0a81('0x2f')]=function(_0x544b15,_0x5be290){if(_0x544b15['body']['id']){delete _0x544b15[_0x0a81('0x53')]['id'];}return db['DeskConfiguration'][_0x0a81('0x51')]({'where':{'id':_0x544b15[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x5be290,null))[_0x0a81('0x1d')](saveUpdates(_0x544b15[_0x0a81('0x53')],null))[_0x0a81('0x1d')](respondWithResult(_0x5be290,null))['catch'](handleError(_0x5be290,null));};exports[_0x0a81('0x30')]=function(_0x5f0222,_0x17e88e){return db[_0x0a81('0x4a')][_0x0a81('0x51')]({'where':{'id':_0x5f0222['params']['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x17e88e,null))['then'](removeEntity(_0x17e88e,null))['catch'](handleError(_0x17e88e,null));};exports['getFields']=function(_0x12de46,_0x4f2c6e,_0x1b9ff2){var _0x47d741={};var _0x28632c={};var _0x3f30f8;var _0x235369;return db[_0x0a81('0x4a')][_0x0a81('0x55')]({'where':{'id':_0x12de46[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x4f2c6e,null))[_0x0a81('0x1d')](function(_0x33da6f){if(_0x33da6f){_0x3f30f8=_0x33da6f;_0x28632c[_0x0a81('0x3d')]=_['keys'](db['DeskField'][_0x0a81('0x56')]);_0x28632c['query']=_[_0x0a81('0x3b')](_0x12de46[_0x0a81('0x3a')]);_0x28632c['filters']=_['intersection'](_0x28632c[_0x0a81('0x3d')],_0x28632c['query']);_0x47d741[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x28632c[_0x0a81('0x3d')],qs[_0x0a81('0x40')](_0x12de46[_0x0a81('0x3a')][_0x0a81('0x40')]));_0x47d741[_0x0a81('0x3e')]=_0x47d741['attributes'][_0x0a81('0x41')]?_0x47d741[_0x0a81('0x3e')]:_0x28632c[_0x0a81('0x3d')];_0x47d741[_0x0a81('0x44')]=qs[_0x0a81('0x57')](_0x12de46[_0x0a81('0x3a')][_0x0a81('0x57')]);_0x47d741['where']=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x12de46[_0x0a81('0x3a')],_0x28632c['filters']));if(_0x12de46[_0x0a81('0x3a')][_0x0a81('0x47')]){_0x47d741['where']=_['merge'](_0x47d741[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x47d741['attributes'],function(_0x1aef72){var _0x4bb1dc={};_0x4bb1dc[_0x1aef72]={'$like':'%'+_0x12de46[_0x0a81('0x3a')][_0x0a81('0x47')]+'%'};return _0x4bb1dc;})});}_0x47d741=_[_0x0a81('0x48')]({},_0x47d741,_0x12de46['options']);return _0x3f30f8[_0x0a81('0x58')](_0x47d741);}})[_0x0a81('0x1d')](function(_0x48f1de){if(_0x48f1de){_0x235369=_0x48f1de['length'];if(!_0x12de46[_0x0a81('0x3a')]['hasOwnProperty']('nolimit')){_0x47d741[_0x0a81('0x2b')]=qs['limit'](_0x12de46['query'][_0x0a81('0x2b')]);_0x47d741[_0x0a81('0x2a')]=qs[_0x0a81('0x2a')](_0x12de46['query']['offset']);}return _0x3f30f8[_0x0a81('0x58')](_0x47d741);}})[_0x0a81('0x1d')](function(_0x472cac){if(_0x472cac){return _0x472cac?{'count':_0x235369,'rows':_0x472cac}:null;}})['then'](respondWithResult(_0x4f2c6e,null))[_0x0a81('0x26')](handleError(_0x4f2c6e,null));};exports['getSubjects']=function(_0x34b269,_0x19868c,_0x44d636){var _0x1fc075={};var _0x27d2af={};var _0x5bb7ab;var _0x520bf9;return db[_0x0a81('0x4a')]['findOne']({'where':{'id':_0x34b269[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x19868c,null))[_0x0a81('0x1d')](function(_0x2acb81){if(_0x2acb81){_0x5bb7ab=_0x2acb81;_0x27d2af[_0x0a81('0x3d')]=_[_0x0a81('0x3b')](db[_0x0a81('0x59')]['rawAttributes']);_0x27d2af[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x34b269[_0x0a81('0x3a')]);_0x27d2af[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x27d2af[_0x0a81('0x3d')],_0x27d2af[_0x0a81('0x3a')]);_0x1fc075[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x27d2af[_0x0a81('0x3d')],qs['fields'](_0x34b269[_0x0a81('0x3a')]['fields']));_0x1fc075[_0x0a81('0x3e')]=_0x1fc075[_0x0a81('0x3e')][_0x0a81('0x41')]?_0x1fc075[_0x0a81('0x3e')]:_0x27d2af[_0x0a81('0x3d')];_0x1fc075[_0x0a81('0x44')]=qs[_0x0a81('0x57')](_0x34b269['query'][_0x0a81('0x57')]);_0x1fc075[_0x0a81('0x45')]=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x34b269[_0x0a81('0x3a')],_0x27d2af[_0x0a81('0x3c')]));if(_0x34b269[_0x0a81('0x3a')]['filter']){_0x1fc075[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x1fc075[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x1fc075[_0x0a81('0x3e')],function(_0x1a6171){var _0x1fadf1={};_0x1fadf1[_0x1a6171]={'$like':'%'+_0x34b269['query'][_0x0a81('0x47')]+'%'};return _0x1fadf1;})});}_0x1fc075=_['merge']({},_0x1fc075,_0x34b269[_0x0a81('0x49')]);return _0x5bb7ab['getSubjects'](_0x1fc075);}})[_0x0a81('0x1d')](function(_0x5c3b6d){if(_0x5c3b6d){_0x520bf9=_0x5c3b6d[_0x0a81('0x41')];if(!_0x34b269[_0x0a81('0x3a')][_0x0a81('0x42')](_0x0a81('0x43'))){_0x1fc075[_0x0a81('0x2b')]=qs[_0x0a81('0x2b')](_0x34b269['query'][_0x0a81('0x2b')]);_0x1fc075[_0x0a81('0x2a')]=qs['offset'](_0x34b269[_0x0a81('0x3a')][_0x0a81('0x2a')]);}return _0x5bb7ab[_0x0a81('0x5a')](_0x1fc075);}})[_0x0a81('0x1d')](function(_0x3c2f82){if(_0x3c2f82){return _0x3c2f82?{'count':_0x520bf9,'rows':_0x3c2f82}:null;}})[_0x0a81('0x1d')](respondWithResult(_0x19868c,null))[_0x0a81('0x26')](handleError(_0x19868c,null));};exports[_0x0a81('0x5b')]=function(_0x5a5a68,_0x2caacd,_0x2a6b4){var _0x15bdf1={};var _0x48f0c4={};var _0x27407e;var _0x141f41;return db[_0x0a81('0x4a')][_0x0a81('0x55')]({'where':{'id':_0x5a5a68['params']['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x2caacd,null))[_0x0a81('0x1d')](function(_0x4dcc98){if(_0x4dcc98){_0x27407e=_0x4dcc98;_0x48f0c4[_0x0a81('0x3d')]=_[_0x0a81('0x3b')](db['DeskField']['rawAttributes']);_0x48f0c4[_0x0a81('0x3a')]=_['keys'](_0x5a5a68[_0x0a81('0x3a')]);_0x48f0c4[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x48f0c4[_0x0a81('0x3d')],_0x48f0c4[_0x0a81('0x3a')]);_0x15bdf1['attributes']=_[_0x0a81('0x3f')](_0x48f0c4[_0x0a81('0x3d')],qs['fields'](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x40')]));_0x15bdf1[_0x0a81('0x3e')]=_0x15bdf1['attributes'][_0x0a81('0x41')]?_0x15bdf1[_0x0a81('0x3e')]:_0x48f0c4[_0x0a81('0x3d')];_0x15bdf1[_0x0a81('0x44')]=qs['sort'](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x57')]);_0x15bdf1[_0x0a81('0x45')]=qs['filters'](_['pick'](_0x5a5a68[_0x0a81('0x3a')],_0x48f0c4['filters']));if(_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x47')]){_0x15bdf1[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x15bdf1[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x15bdf1[_0x0a81('0x3e')],function(_0x4c2d85){var _0x534a59={};_0x534a59[_0x4c2d85]={'$like':'%'+_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x47')]+'%'};return _0x534a59;})});}_0x15bdf1=_['merge']({},_0x15bdf1,_0x5a5a68[_0x0a81('0x49')]);return _0x27407e[_0x0a81('0x5b')](_0x15bdf1);}})['then'](function(_0x5beedc){if(_0x5beedc){_0x141f41=_0x5beedc['length'];if(!_0x5a5a68['query'][_0x0a81('0x42')]('nolimit')){_0x15bdf1['limit']=qs['limit'](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x2b')]);_0x15bdf1['offset']=qs[_0x0a81('0x2a')](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x2a')]);}return _0x27407e[_0x0a81('0x5b')](_0x15bdf1);}})['then'](function(_0x756ff4){if(_0x756ff4){return _0x756ff4?{'count':_0x141f41,'rows':_0x756ff4}:null;}})[_0x0a81('0x1d')](respondWithResult(_0x2caacd,null))[_0x0a81('0x26')](handleError(_0x2caacd,null));};exports[_0x0a81('0x5c')]=function(_0x245e96,_0x180029,_0x49f9b1){var _0x1f8148={};var _0x12342e={};var _0x2a3594;var _0x4b6171;return db[_0x0a81('0x4a')]['findOne']({'where':{'id':_0x245e96[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x180029,null))['then'](function(_0x528b0c){if(_0x528b0c){_0x2a3594=_0x528b0c;_0x12342e[_0x0a81('0x3d')]=_[_0x0a81('0x3b')](db[_0x0a81('0x5d')][_0x0a81('0x56')]);_0x12342e[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x245e96['query']);_0x12342e[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x12342e[_0x0a81('0x3d')],_0x12342e[_0x0a81('0x3a')]);_0x1f8148[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x12342e['model'],qs[_0x0a81('0x40')](_0x245e96['query'][_0x0a81('0x40')]));_0x1f8148[_0x0a81('0x3e')]=_0x1f8148[_0x0a81('0x3e')][_0x0a81('0x41')]?_0x1f8148[_0x0a81('0x3e')]:_0x12342e[_0x0a81('0x3d')];_0x1f8148[_0x0a81('0x44')]=qs['sort'](_0x245e96[_0x0a81('0x3a')][_0x0a81('0x57')]);_0x1f8148['where']=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x245e96[_0x0a81('0x3a')],_0x12342e['filters']));if(_0x245e96[_0x0a81('0x3a')][_0x0a81('0x47')]){_0x1f8148[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x1f8148[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x1f8148['attributes'],function(_0x12edb9){var _0x374423={};_0x374423[_0x12edb9]={'$like':'%'+_0x245e96[_0x0a81('0x3a')]['filter']+'%'};return _0x374423;})});}_0x1f8148=_[_0x0a81('0x48')]({},_0x1f8148,_0x245e96['options']);return _0x2a3594[_0x0a81('0x5c')](_0x1f8148);}})[_0x0a81('0x1d')](function(_0x472884){if(_0x472884){_0x4b6171=_0x472884[_0x0a81('0x41')];if(!_0x245e96[_0x0a81('0x3a')][_0x0a81('0x42')](_0x0a81('0x43'))){_0x1f8148[_0x0a81('0x2b')]=qs['limit'](_0x245e96['query'][_0x0a81('0x2b')]);_0x1f8148['offset']=qs[_0x0a81('0x2a')](_0x245e96['query'][_0x0a81('0x2a')]);}return _0x2a3594[_0x0a81('0x5c')](_0x1f8148);}})[_0x0a81('0x1d')](function(_0x43724c){if(_0x43724c){return _0x43724c?{'count':_0x4b6171,'rows':_0x43724c}:null;}})[_0x0a81('0x1d')](respondWithResult(_0x180029,null))[_0x0a81('0x26')](handleError(_0x180029,null));};exports['setTags']=function(_0x43dfe0,_0x17cfdf,_0x2fba74){if(_0x43dfe0[_0x0a81('0x53')]['id']){delete _0x43dfe0['body']['id'];}return db[_0x0a81('0x4a')][_0x0a81('0x55')]({'where':{'id':_0x43dfe0[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x17cfdf,null))[_0x0a81('0x1d')](function(_0x5a618f){if(_0x5a618f){return _0x5a618f[_0x0a81('0x5e')](_0x43dfe0[_0x0a81('0x53')][_0x0a81('0x5f')]||[]);}return null;})[_0x0a81('0x1d')](respondWithResult(_0x17cfdf,null))[_0x0a81('0x26')](handleError(_0x17cfdf,null));}; \ No newline at end of file +var _0x0027=['save','update','destroy','end','stack','name','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','type','VIRTUAL','merge','options','count','include','findAll','rows','params','includeAll','create','body','find','findOne','DeskField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','ids','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','status','json','offset','set','apply','reject'];(function(_0x22a15e,_0x25fbc4){var _0x3e459f=function(_0x28a114){while(--_0x28a114){_0x22a15e['push'](_0x22a15e['shift']());}};_0x3e459f(++_0x25fbc4);}(_0x0027,0x190));var _0x7002=function(_0x33da0b,_0x5cbe95){_0x33da0b=_0x33da0b-0x0;var _0x3ecfef=_0x0027[_0x33da0b];return _0x3ecfef;};'use strict';var pdf=require(_0x7002('0x0'));var emlformat=require(_0x7002('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7002('0x2'));var rp=require(_0x7002('0x3'));var moment=require(_0x7002('0x4'));var BPromise=require(_0x7002('0x5'));var Mustache=require(_0x7002('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7002('0x7'));var csv=require(_0x7002('0x8'));var ejs=require(_0x7002('0x9'));var fs=require('fs');var _=require(_0x7002('0xa'));var squel=require(_0x7002('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7002('0xc'));var toCsv=require(_0x7002('0x8'));var querystring=require(_0x7002('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7002('0xe'));var hardwareService=require(_0x7002('0xf'));var logger=require(_0x7002('0x10'))('api');var utils=require(_0x7002('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7002('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7002('0x13'));var client=jayson[_0x7002('0x14')][_0x7002('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2247f5,_0x3c33c8,_0x1ff8eb,_0x1d7d38){return new BPromise(function(_0x354f4b,_0x3a50a0){var _0x37ac64=_0x1d7d38||client;return _0x37ac64[_0x7002('0x16')](_0x2247f5,_0x1ff8eb)[_0x7002('0x17')](function(_0x55837c){logger['info'](_0x7002('0x18'),_0x3c33c8,'request\x20sent');logger[_0x7002('0x19')](_0x7002('0x1a'),_0x3c33c8,_0x7002('0x1b'),JSON['stringify'](_0x55837c));if(_0x55837c['error']){if(_0x55837c[_0x7002('0x1c')][_0x7002('0x1d')]===0x1f4){logger[_0x7002('0x1c')](_0x7002('0x18'),_0x3c33c8,_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);return _0x3a50a0(_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);}logger[_0x7002('0x1c')](_0x7002('0x18'),_0x3c33c8,_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);return _0x354f4b(_0x55837c[_0x7002('0x1c')][_0x7002('0x1e')]);}else{logger[_0x7002('0x1f')](_0x7002('0x18'),_0x3c33c8,_0x7002('0x1b'));_0x354f4b(_0x55837c[_0x7002('0x20')][_0x7002('0x1e')]);}})[_0x7002('0x21')](function(_0x4fc4ea){logger[_0x7002('0x1c')](_0x7002('0x18'),_0x3c33c8,_0x4fc4ea);_0x3a50a0(_0x4fc4ea);});});}function respondWithStatusCode(_0x2e0faf,_0x39c2ff){_0x39c2ff=_0x39c2ff||0xcc;return function(_0xa9c7b0){if(_0xa9c7b0){return _0x2e0faf['sendStatus'](_0x39c2ff);}return _0x2e0faf[_0x7002('0x22')](_0x39c2ff)['end']();};}function respondWithResult(_0x235f69,_0x17a617){_0x17a617=_0x17a617||0xc8;return function(_0x1ac5d6){if(_0x1ac5d6){return _0x235f69['status'](_0x17a617)[_0x7002('0x23')](_0x1ac5d6);}};}function respondWithFilteredResult(_0x5d7b4e,_0x2f5b45){return function(_0x14a8ba){if(_0x14a8ba){var _0x211180=_0x14a8ba['count'],_0x55ec83=_0x2f5b45[_0x7002('0x24')],_0x12c3a6=_0x2f5b45[_0x7002('0x24')]+_0x2f5b45['limit'],_0x5d3d7c;if(_0x12c3a6>=_0x211180){_0x12c3a6=_0x211180;_0x5d3d7c=0xc8;}else{_0x5d3d7c=0xce;}_0x5d7b4e[_0x7002('0x22')](_0x5d3d7c);return _0x5d7b4e[_0x7002('0x25')]('Content-Range',_0x55ec83+'-'+_0x12c3a6+'/'+_0x211180)['json'](_0x14a8ba);}return null;};}function patchUpdates(_0x53ccf5){return function(_0x6732f6){try{jsonpatch[_0x7002('0x26')](_0x6732f6,_0x53ccf5,!![]);}catch(_0x7ef746){return BPromise[_0x7002('0x27')](_0x7ef746);}return _0x6732f6[_0x7002('0x28')]();};}function saveUpdates(_0x16bfd0,_0x13dfd6){return function(_0x9ceb56){if(_0x9ceb56){return _0x9ceb56[_0x7002('0x29')](_0x16bfd0)['then'](function(_0x40ab4b){return _0x40ab4b;});}return null;};}function removeEntity(_0x13a072,_0x33e432){return function(_0x393ba1){if(_0x393ba1){return _0x393ba1[_0x7002('0x2a')]()[_0x7002('0x17')](function(){_0x13a072[_0x7002('0x22')](0xcc)[_0x7002('0x2b')]();});}};}function handleEntityNotFound(_0x2966cd,_0x4c01d8){return function(_0x35af4b){if(!_0x35af4b){_0x2966cd['sendStatus'](0x194);}return _0x35af4b;};}function handleError(_0x3ce897,_0x330eda){_0x330eda=_0x330eda||0x1f4;return function(_0x53ccea){logger[_0x7002('0x1c')](_0x53ccea[_0x7002('0x2c')]);if(_0x53ccea[_0x7002('0x2d')]){delete _0x53ccea['name'];}_0x3ce897[_0x7002('0x22')](_0x330eda)['send'](_0x53ccea);};}exports['index']=function(_0x5b9406,_0x29bf53){var _0x2b7f05={},_0x52df95={},_0x1f1659={'count':0x0,'rows':[]};var _0x1aa968=_[_0x7002('0x2e')](db[_0x7002('0x2f')][_0x7002('0x30')],function(_0x495cd1){return{'name':_0x495cd1[_0x7002('0x31')],'type':_0x495cd1['type'][_0x7002('0x32')]};});_0x52df95[_0x7002('0x33')]=_[_0x7002('0x2e')](_0x1aa968,_0x7002('0x2d'));_0x52df95[_0x7002('0x34')]=_[_0x7002('0x35')](_0x5b9406[_0x7002('0x34')]);_0x52df95[_0x7002('0x36')]=_[_0x7002('0x37')](_0x52df95[_0x7002('0x33')],_0x52df95[_0x7002('0x34')]);_0x2b7f05['attributes']=_[_0x7002('0x37')](_0x52df95['model'],qs['fields'](_0x5b9406[_0x7002('0x34')][_0x7002('0x38')]));_0x2b7f05[_0x7002('0x39')]=_0x2b7f05[_0x7002('0x39')][_0x7002('0x3a')]?_0x2b7f05[_0x7002('0x39')]:_0x52df95['model'];if(!_0x5b9406[_0x7002('0x34')]['hasOwnProperty'](_0x7002('0x3b'))){_0x2b7f05[_0x7002('0x3c')]=qs[_0x7002('0x3c')](_0x5b9406[_0x7002('0x34')][_0x7002('0x3c')]);_0x2b7f05['offset']=qs[_0x7002('0x24')](_0x5b9406[_0x7002('0x34')][_0x7002('0x24')]);}_0x2b7f05[_0x7002('0x3d')]=qs[_0x7002('0x3e')](_0x5b9406['query'][_0x7002('0x3e')]);_0x2b7f05['where']=qs[_0x7002('0x36')](_['pick'](_0x5b9406['query'],_0x52df95[_0x7002('0x36')]),_0x1aa968);if(_0x5b9406['query'][_0x7002('0x3f')]){_0x2b7f05['where']=_['merge'](_0x2b7f05[_0x7002('0x40')],{'$or':_[_0x7002('0x2e')](_0x1aa968,function(_0x504a01){if(_0x504a01[_0x7002('0x41')]!==_0x7002('0x42')){var _0x47a900={};_0x47a900[_0x504a01[_0x7002('0x2d')]]={'$like':'%'+_0x5b9406[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x47a900;}})});}_0x2b7f05=_[_0x7002('0x43')]({},_0x2b7f05,_0x5b9406[_0x7002('0x44')]);var _0x4d71ec={'where':_0x2b7f05[_0x7002('0x40')]};return db[_0x7002('0x2f')][_0x7002('0x45')](_0x4d71ec)[_0x7002('0x17')](function(_0x4b9292){_0x1f1659[_0x7002('0x45')]=_0x4b9292;if(_0x5b9406[_0x7002('0x34')]['includeAll']){_0x2b7f05[_0x7002('0x46')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7002('0x47')](_0x2b7f05);})[_0x7002('0x17')](function(_0x44c159){_0x1f1659[_0x7002('0x48')]=_0x44c159;return _0x1f1659;})['then'](respondWithFilteredResult(_0x29bf53,_0x2b7f05))[_0x7002('0x21')](handleError(_0x29bf53,null));};exports['show']=function(_0x5d4d8d,_0x20c0bc){var _0x47fd20={'raw':![],'where':{'id':_0x5d4d8d[_0x7002('0x49')]['id']}},_0x995f08={};_0x995f08['model']=_[_0x7002('0x35')](db['DeskConfiguration'][_0x7002('0x30')]);_0x995f08[_0x7002('0x34')]=_['keys'](_0x5d4d8d[_0x7002('0x34')]);_0x995f08['filters']=_[_0x7002('0x37')](_0x995f08[_0x7002('0x33')],_0x995f08['query']);_0x47fd20[_0x7002('0x39')]=_['intersection'](_0x995f08[_0x7002('0x33')],qs[_0x7002('0x38')](_0x5d4d8d[_0x7002('0x34')]['fields']));_0x47fd20[_0x7002('0x39')]=_0x47fd20['attributes'][_0x7002('0x3a')]?_0x47fd20[_0x7002('0x39')]:_0x995f08['model'];if(_0x5d4d8d[_0x7002('0x34')][_0x7002('0x4a')]){_0x47fd20[_0x7002('0x46')]=[{'all':!![]}];}_0x47fd20=_[_0x7002('0x43')]({},_0x47fd20,_0x5d4d8d[_0x7002('0x44')]);return db[_0x7002('0x2f')]['find'](_0x47fd20)[_0x7002('0x17')](handleEntityNotFound(_0x20c0bc,null))['then'](respondWithResult(_0x20c0bc,null))[_0x7002('0x21')](handleError(_0x20c0bc,null));};exports[_0x7002('0x4b')]=function(_0x258000,_0x5b377f){return db[_0x7002('0x2f')][_0x7002('0x4b')](_0x258000[_0x7002('0x4c')],{})[_0x7002('0x17')](respondWithResult(_0x5b377f,0xc9))[_0x7002('0x21')](handleError(_0x5b377f,null));};exports[_0x7002('0x29')]=function(_0x3282a9,_0x5a406d){if(_0x3282a9[_0x7002('0x4c')]['id']){delete _0x3282a9[_0x7002('0x4c')]['id'];}return db[_0x7002('0x2f')]['find']({'where':{'id':_0x3282a9[_0x7002('0x49')]['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x5a406d,null))[_0x7002('0x17')](saveUpdates(_0x3282a9[_0x7002('0x4c')],null))[_0x7002('0x17')](respondWithResult(_0x5a406d,null))['catch'](handleError(_0x5a406d,null));};exports[_0x7002('0x2a')]=function(_0x365c9a,_0x3edc79){return db[_0x7002('0x2f')][_0x7002('0x4d')]({'where':{'id':_0x365c9a['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x3edc79,null))[_0x7002('0x17')](removeEntity(_0x3edc79,null))['catch'](handleError(_0x3edc79,null));};exports['getFields']=function(_0x18e476,_0x869896,_0x5cda75){var _0x5def3f={};var _0x4060f1={};var _0x32b12c;var _0x28a8a9;return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x18e476['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x869896,null))[_0x7002('0x17')](function(_0x2a3cc5){if(_0x2a3cc5){_0x32b12c=_0x2a3cc5;_0x4060f1[_0x7002('0x33')]=_[_0x7002('0x35')](db[_0x7002('0x4f')][_0x7002('0x30')]);_0x4060f1['query']=_[_0x7002('0x35')](_0x18e476['query']);_0x4060f1['filters']=_[_0x7002('0x37')](_0x4060f1[_0x7002('0x33')],_0x4060f1[_0x7002('0x34')]);_0x5def3f[_0x7002('0x39')]=_[_0x7002('0x37')](_0x4060f1[_0x7002('0x33')],qs['fields'](_0x18e476[_0x7002('0x34')][_0x7002('0x38')]));_0x5def3f['attributes']=_0x5def3f[_0x7002('0x39')][_0x7002('0x3a')]?_0x5def3f[_0x7002('0x39')]:_0x4060f1[_0x7002('0x33')];_0x5def3f['order']=qs['sort'](_0x18e476['query'][_0x7002('0x3e')]);_0x5def3f['where']=qs[_0x7002('0x36')](_[_0x7002('0x50')](_0x18e476[_0x7002('0x34')],_0x4060f1[_0x7002('0x36')]));if(_0x18e476[_0x7002('0x34')][_0x7002('0x3f')]){_0x5def3f[_0x7002('0x40')]=_['merge'](_0x5def3f['where'],{'$or':_[_0x7002('0x2e')](_0x5def3f[_0x7002('0x39')],function(_0x588dff){var _0x417c92={};_0x417c92[_0x588dff]={'$like':'%'+_0x18e476[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x417c92;})});}_0x5def3f=_[_0x7002('0x43')]({},_0x5def3f,_0x18e476[_0x7002('0x44')]);return _0x32b12c[_0x7002('0x51')](_0x5def3f);}})[_0x7002('0x17')](function(_0x3f38a1){if(_0x3f38a1){_0x28a8a9=_0x3f38a1[_0x7002('0x3a')];if(!_0x18e476['query'][_0x7002('0x52')]('nolimit')){_0x5def3f[_0x7002('0x3c')]=qs['limit'](_0x18e476[_0x7002('0x34')]['limit']);_0x5def3f[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x18e476['query'][_0x7002('0x24')]);}return _0x32b12c[_0x7002('0x51')](_0x5def3f);}})[_0x7002('0x17')](function(_0x3bac8d){if(_0x3bac8d){return _0x3bac8d?{'count':_0x28a8a9,'rows':_0x3bac8d}:null;}})[_0x7002('0x17')](respondWithResult(_0x869896,null))[_0x7002('0x21')](handleError(_0x869896,null));};exports[_0x7002('0x53')]=function(_0x35134c,_0x24955f,_0x1dae87){var _0x5ecdbc={};var _0x197aae={};var _0x3f683c;var _0x2dfbd0;return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x35134c['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x24955f,null))[_0x7002('0x17')](function(_0x50ace0){if(_0x50ace0){_0x3f683c=_0x50ace0;_0x197aae[_0x7002('0x33')]=_[_0x7002('0x35')](db[_0x7002('0x4f')]['rawAttributes']);_0x197aae[_0x7002('0x34')]=_[_0x7002('0x35')](_0x35134c[_0x7002('0x34')]);_0x197aae[_0x7002('0x36')]=_[_0x7002('0x37')](_0x197aae[_0x7002('0x33')],_0x197aae[_0x7002('0x34')]);_0x5ecdbc[_0x7002('0x39')]=_['intersection'](_0x197aae[_0x7002('0x33')],qs['fields'](_0x35134c['query'][_0x7002('0x38')]));_0x5ecdbc['attributes']=_0x5ecdbc[_0x7002('0x39')]['length']?_0x5ecdbc[_0x7002('0x39')]:_0x197aae[_0x7002('0x33')];_0x5ecdbc[_0x7002('0x3d')]=qs[_0x7002('0x3e')](_0x35134c['query'][_0x7002('0x3e')]);_0x5ecdbc[_0x7002('0x40')]=qs[_0x7002('0x36')](_['pick'](_0x35134c[_0x7002('0x34')],_0x197aae[_0x7002('0x36')]));if(_0x35134c[_0x7002('0x34')][_0x7002('0x3f')]){_0x5ecdbc[_0x7002('0x40')]=_['merge'](_0x5ecdbc['where'],{'$or':_[_0x7002('0x2e')](_0x5ecdbc[_0x7002('0x39')],function(_0x4ba0fd){var _0x252eaf={};_0x252eaf[_0x4ba0fd]={'$like':'%'+_0x35134c[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x252eaf;})});}_0x5ecdbc=_[_0x7002('0x43')]({},_0x5ecdbc,_0x35134c[_0x7002('0x44')]);return _0x3f683c[_0x7002('0x53')](_0x5ecdbc);}})[_0x7002('0x17')](function(_0x21bce1){if(_0x21bce1){_0x2dfbd0=_0x21bce1[_0x7002('0x3a')];if(!_0x35134c[_0x7002('0x34')][_0x7002('0x52')](_0x7002('0x3b'))){_0x5ecdbc['limit']=qs[_0x7002('0x3c')](_0x35134c['query'][_0x7002('0x3c')]);_0x5ecdbc[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x35134c[_0x7002('0x34')]['offset']);}return _0x3f683c[_0x7002('0x53')](_0x5ecdbc);}})[_0x7002('0x17')](function(_0x3f1ea9){if(_0x3f1ea9){return _0x3f1ea9?{'count':_0x2dfbd0,'rows':_0x3f1ea9}:null;}})['then'](respondWithResult(_0x24955f,null))[_0x7002('0x21')](handleError(_0x24955f,null));};exports[_0x7002('0x54')]=function(_0x547516,_0x33e73a,_0x46662b){var _0xeed4e={};var _0x54ed52={};var _0x288402;var _0x26021b;return db[_0x7002('0x2f')]['findOne']({'where':{'id':_0x547516[_0x7002('0x49')]['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x33e73a,null))[_0x7002('0x17')](function(_0x2ad6f9){if(_0x2ad6f9){_0x288402=_0x2ad6f9;_0x54ed52[_0x7002('0x33')]=_['keys'](db['DeskField'][_0x7002('0x30')]);_0x54ed52[_0x7002('0x34')]=_[_0x7002('0x35')](_0x547516['query']);_0x54ed52[_0x7002('0x36')]=_[_0x7002('0x37')](_0x54ed52[_0x7002('0x33')],_0x54ed52[_0x7002('0x34')]);_0xeed4e[_0x7002('0x39')]=_[_0x7002('0x37')](_0x54ed52[_0x7002('0x33')],qs[_0x7002('0x38')](_0x547516[_0x7002('0x34')][_0x7002('0x38')]));_0xeed4e['attributes']=_0xeed4e['attributes'][_0x7002('0x3a')]?_0xeed4e[_0x7002('0x39')]:_0x54ed52[_0x7002('0x33')];_0xeed4e[_0x7002('0x3d')]=qs[_0x7002('0x3e')](_0x547516['query']['sort']);_0xeed4e[_0x7002('0x40')]=qs['filters'](_[_0x7002('0x50')](_0x547516[_0x7002('0x34')],_0x54ed52[_0x7002('0x36')]));if(_0x547516[_0x7002('0x34')][_0x7002('0x3f')]){_0xeed4e[_0x7002('0x40')]=_[_0x7002('0x43')](_0xeed4e[_0x7002('0x40')],{'$or':_[_0x7002('0x2e')](_0xeed4e[_0x7002('0x39')],function(_0x4cc7c4){var _0x4e5489={};_0x4e5489[_0x4cc7c4]={'$like':'%'+_0x547516['query'][_0x7002('0x3f')]+'%'};return _0x4e5489;})});}_0xeed4e=_[_0x7002('0x43')]({},_0xeed4e,_0x547516[_0x7002('0x44')]);return _0x288402[_0x7002('0x54')](_0xeed4e);}})[_0x7002('0x17')](function(_0x21c67e){if(_0x21c67e){_0x26021b=_0x21c67e['length'];if(!_0x547516['query'][_0x7002('0x52')](_0x7002('0x3b'))){_0xeed4e[_0x7002('0x3c')]=qs[_0x7002('0x3c')](_0x547516['query'][_0x7002('0x3c')]);_0xeed4e[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x547516['query'][_0x7002('0x24')]);}return _0x288402['getDescriptions'](_0xeed4e);}})[_0x7002('0x17')](function(_0x2ff092){if(_0x2ff092){return _0x2ff092?{'count':_0x26021b,'rows':_0x2ff092}:null;}})[_0x7002('0x17')](respondWithResult(_0x33e73a,null))[_0x7002('0x21')](handleError(_0x33e73a,null));};exports[_0x7002('0x55')]=function(_0x13edb7,_0x569347,_0x5ddbd3){var _0x416050={};var _0x53fda4={};var _0x33d459;var _0x2f61db;return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x13edb7['params']['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x569347,null))[_0x7002('0x17')](function(_0x380e1e){if(_0x380e1e){_0x33d459=_0x380e1e;_0x53fda4['model']=_[_0x7002('0x35')](db[_0x7002('0x56')]['rawAttributes']);_0x53fda4[_0x7002('0x34')]=_['keys'](_0x13edb7[_0x7002('0x34')]);_0x53fda4['filters']=_[_0x7002('0x37')](_0x53fda4[_0x7002('0x33')],_0x53fda4[_0x7002('0x34')]);_0x416050[_0x7002('0x39')]=_['intersection'](_0x53fda4['model'],qs[_0x7002('0x38')](_0x13edb7[_0x7002('0x34')][_0x7002('0x38')]));_0x416050[_0x7002('0x39')]=_0x416050['attributes'][_0x7002('0x3a')]?_0x416050[_0x7002('0x39')]:_0x53fda4[_0x7002('0x33')];_0x416050['order']=qs[_0x7002('0x3e')](_0x13edb7[_0x7002('0x34')]['sort']);_0x416050[_0x7002('0x40')]=qs[_0x7002('0x36')](_[_0x7002('0x50')](_0x13edb7[_0x7002('0x34')],_0x53fda4[_0x7002('0x36')]));if(_0x13edb7[_0x7002('0x34')][_0x7002('0x3f')]){_0x416050[_0x7002('0x40')]=_[_0x7002('0x43')](_0x416050[_0x7002('0x40')],{'$or':_[_0x7002('0x2e')](_0x416050[_0x7002('0x39')],function(_0x422e6){var _0x1498e7={};_0x1498e7[_0x422e6]={'$like':'%'+_0x13edb7[_0x7002('0x34')][_0x7002('0x3f')]+'%'};return _0x1498e7;})});}_0x416050=_['merge']({},_0x416050,_0x13edb7[_0x7002('0x44')]);return _0x33d459[_0x7002('0x55')](_0x416050);}})['then'](function(_0x4b226b){if(_0x4b226b){_0x2f61db=_0x4b226b[_0x7002('0x3a')];if(!_0x13edb7['query'][_0x7002('0x52')](_0x7002('0x3b'))){_0x416050['limit']=qs[_0x7002('0x3c')](_0x13edb7[_0x7002('0x34')][_0x7002('0x3c')]);_0x416050[_0x7002('0x24')]=qs[_0x7002('0x24')](_0x13edb7[_0x7002('0x34')][_0x7002('0x24')]);}return _0x33d459[_0x7002('0x55')](_0x416050);}})[_0x7002('0x17')](function(_0x3d12d7){if(_0x3d12d7){return _0x3d12d7?{'count':_0x2f61db,'rows':_0x3d12d7}:null;}})[_0x7002('0x17')](respondWithResult(_0x569347,null))[_0x7002('0x21')](handleError(_0x569347,null));};exports['setTags']=function(_0x58c081,_0x455bbd,_0x4dbda1){if(_0x58c081[_0x7002('0x4c')]['id']){delete _0x58c081[_0x7002('0x4c')]['id'];}return db[_0x7002('0x2f')][_0x7002('0x4e')]({'where':{'id':_0x58c081[_0x7002('0x49')]['id']}})[_0x7002('0x17')](handleEntityNotFound(_0x455bbd,null))[_0x7002('0x17')](function(_0x5526ba){if(_0x5526ba){return _0x5526ba['setTags'](_0x58c081[_0x7002('0x4c')][_0x7002('0x57')]||[]);}return null;})['then'](respondWithResult(_0x455bbd,null))[_0x7002('0x21')](handleError(_0x455bbd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2363ea5..7f55440 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 _0x025b=['DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define'];(function(_0x5dbac8,_0x2a86b3){var _0x4f5535=function(_0x674318){while(--_0x674318){_0x5dbac8['push'](_0x5dbac8['shift']());}};_0x4f5535(++_0x2a86b3);}(_0x025b,0x122));var _0xb025=function(_0x1819ec,_0x42cbc4){_0x1819ec=_0x1819ec-0x0;var _0x467785=_0x025b[_0x1819ec];return _0x467785;};'use strict';var _=require(_0xb025('0x0'));var util=require(_0xb025('0x1'));var logger=require('../../config/logger')(_0xb025('0x2'));var moment=require(_0xb025('0x3'));var BPromise=require(_0xb025('0x4'));var rp=require(_0xb025('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb025('0x6'));var config=require(_0xb025('0x7'));var attributes=require(_0xb025('0x8'));module['exports']=function(_0x138e2b,_0x28b877){return _0x138e2b[_0xb025('0x9')](_0xb025('0xa'),attributes,{'tableName':_0xb025('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0ef=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util'];(function(_0x2324f0,_0x17b511){var _0x468e66=function(_0x6f42ee){while(--_0x6f42ee){_0x2324f0['push'](_0x2324f0['shift']());}};_0x468e66(++_0x17b511);}(_0xb0ef,0xbf));var _0xfb0e=function(_0x198ecb,_0x41412e){_0x198ecb=_0x198ecb-0x0;var _0x2e3893=_0xb0ef[_0x198ecb];return _0x2e3893;};'use strict';var _=require('lodash');var util=require(_0xfb0e('0x0'));var logger=require(_0xfb0e('0x1'))(_0xfb0e('0x2'));var moment=require(_0xfb0e('0x3'));var BPromise=require(_0xfb0e('0x4'));var rp=require(_0xfb0e('0x5'));var fs=require('fs');var path=require(_0xfb0e('0x6'));var rimraf=require(_0xfb0e('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb0e('0x8'));module[_0xfb0e('0x9')]=function(_0x4877b8,_0x5a703d){return _0x4877b8['define'](_0xfb0e('0xa'),attributes,{'tableName':_0xfb0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 896d354..5fabac4 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 _0x847d=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x29bf63,_0x25c17a){var _0x409e51=function(_0x5212f3){while(--_0x5212f3){_0x29bf63['push'](_0x29bf63['shift']());}};_0x409e51(++_0x25c17a);}(_0x847d,0x14a));var _0xd847=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x847d[_0x2a56ad];return _0x425175;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var moment=require(_0xd847('0x1'));var BPromise=require(_0xd847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd847('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd847('0x4'));var logger=require(_0xd847('0x5'))('rpc');var config=require(_0xd847('0x6'));var jayson=require(_0xd847('0x7'));var client=jayson[_0xd847('0x8')][_0xd847('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3349,_0x20dbfd,_0x19fdb5){return new BPromise(function(_0x2bb22b,_0x235e82){return client[_0xd847('0xa')](_0x5f3349,_0x19fdb5)[_0xd847('0xb')](function(_0x17cb36){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x20dbfd,'request\x20sent');logger['debug'](_0xd847('0xc'),_0x20dbfd,_0xd847('0xd'),JSON[_0xd847('0xe')](_0x17cb36));if(_0x17cb36['error']){if(_0x17cb36['error'][_0xd847('0xf')]===0x1f4){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x235e82(_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);}logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x2bb22b(_0x17cb36['error'][_0xd847('0x12')]);}else{logger[_0xd847('0x13')](_0xd847('0x11'),_0x20dbfd,_0xd847('0xd'));_0x2bb22b(_0x17cb36[_0xd847('0x14')]['message']);}})[_0xd847('0x15')](function(_0x3e1e1c){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x3e1e1c);_0x235e82(_0x3e1e1c);});});} \ No newline at end of file +var _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x376620,_0x520359){var _0x574e88=function(_0x13d858){while(--_0x13d858){_0x376620['push'](_0x376620['shift']());}};_0x574e88(++_0x520359);}(_0x96cc,0x16c));var _0xc96c=function(_0x20d916,_0x4bfa65){_0x20d916=_0x20d916-0x0;var _0x366417=_0x96cc[_0x20d916];return _0x366417;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e2d843c..b07a568 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 _0xb5a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','post','create','/:id','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0xb5a4,0x11a));var _0x4b5a=function(_0x2183fe,_0x19afa8){_0x2183fe=_0x2183fe-0x0;var _0x42ae9f=_0xb5a4[_0x2183fe];return _0x42ae9f;};'use strict';var multer=require(_0x4b5a('0x0'));var util=require(_0x4b5a('0x1'));var path=require(_0x4b5a('0x2'));var timeout=require(_0x4b5a('0x3'));var express=require(_0x4b5a('0x4'));var router=express[_0x4b5a('0x5')]();var auth=require(_0x4b5a('0x6'));var interaction=require(_0x4b5a('0x7'));var config=require(_0x4b5a('0x8'));var controller=require(_0x4b5a('0x9'));router[_0x4b5a('0xa')]('/',auth['isAuthenticated'](),controller[_0x4b5a('0xb')]);router['get']('/:id',auth[_0x4b5a('0xc')](),controller['show']);router[_0x4b5a('0xd')]('/',auth[_0x4b5a('0xc')](),controller[_0x4b5a('0xe')]);router['put'](_0x4b5a('0xf'),auth[_0x4b5a('0xc')](),controller[_0x4b5a('0x10')]);router['delete'](_0x4b5a('0xf'),auth[_0x4b5a('0xc')](),controller['destroy']);module[_0x4b5a('0x11')]=router; \ No newline at end of file +var _0x0152=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','multer'];(function(_0x3bb761,_0x4cb8ce){var _0x453e3f=function(_0x4cb828){while(--_0x4cb828){_0x3bb761['push'](_0x3bb761['shift']());}};_0x453e3f(++_0x4cb8ce);}(_0x0152,0x186));var _0x2015=function(_0x494b71,_0x4125c0){_0x494b71=_0x494b71-0x0;var _0x43acf0=_0x0152[_0x494b71];return _0x43acf0;};'use strict';var multer=require(_0x2015('0x0'));var util=require(_0x2015('0x1'));var path=require(_0x2015('0x2'));var timeout=require(_0x2015('0x3'));var express=require(_0x2015('0x4'));var router=express['Router']();var auth=require(_0x2015('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2015('0x6'));var controller=require(_0x2015('0x7'));router[_0x2015('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2015('0x9'),auth[_0x2015('0xa')](),controller[_0x2015('0xb')]);router[_0x2015('0xc')]('/',auth['isAuthenticated'](),controller[_0x2015('0xd')]);router[_0x2015('0xe')](_0x2015('0x9'),auth[_0x2015('0xa')](),controller[_0x2015('0xf')]);router['delete'](_0x2015('0x9'),auth[_0x2015('0xa')](),controller[_0x2015('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 4288ebe..f3e6652 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 _0x2886=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2a7e9d,_0x156371){var _0x4c57d3=function(_0x5a8247){while(--_0x5a8247){_0x2a7e9d['push'](_0x2a7e9d['shift']());}};_0x4c57d3(++_0x156371);}(_0x2886,0x112));var _0x6288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2886[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6288('0x0'));module[_0x6288('0x1')]={'type':{'type':Sequelize[_0x6288('0x2')](_0x6288('0x3'),_0x6288('0x4'),_0x6288('0x5'),_0x6288('0x6')),'defaultValue':_0x6288('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6288('0x2')]('string',_0x6288('0x4'),_0x6288('0x5'))},'keyContent':{'type':Sequelize[_0x6288('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6288('0x7')]},'customField':{'type':Sequelize[_0x6288('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6288('0x7')]}}; \ No newline at end of file +var _0xa092=['string','customVariable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xa092,0x1d9));var _0x2a09=function(_0x55c947,_0x5e20a8){_0x55c947=_0x55c947-0x0;var _0x2556b3=_0xa092[_0x55c947];return _0x2556b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2a09('0x0')](_0x2a09('0x1'),'variable',_0x2a09('0x2'),_0x2a09('0x3')),'defaultValue':_0x2a09('0x1')},'content':{'type':Sequelize[_0x2a09('0x4')]},'key':{'type':Sequelize[_0x2a09('0x4')]},'keyType':{'type':Sequelize[_0x2a09('0x0')](_0x2a09('0x1'),'variable',_0x2a09('0x2'))},'keyContent':{'type':Sequelize[_0x2a09('0x4')]},'idField':{'type':Sequelize[_0x2a09('0x4')]},'nameField':{'type':Sequelize[_0x2a09('0x4')]},'customField':{'type':Sequelize[_0x2a09('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a09('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a8ad109..7352e14 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 _0xe0ac=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x159c53,_0x3aa541){var _0x4a2dda=function(_0x124ac0){while(--_0x124ac0){_0x159c53['push'](_0x159c53['shift']());}};_0x4a2dda(++_0x3aa541);}(_0xe0ac,0x15b));var _0xce0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0ac[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xce0a('0x0'));var zipdir=require(_0xce0a('0x1'));var jsonpatch=require(_0xce0a('0x2'));var rp=require(_0xce0a('0x3'));var moment=require(_0xce0a('0x4'));var BPromise=require(_0xce0a('0x5'));var Mustache=require('mustache');var util=require(_0xce0a('0x6'));var path=require(_0xce0a('0x7'));var sox=require(_0xce0a('0x8'));var csv=require(_0xce0a('0x9'));var ejs=require(_0xce0a('0xa'));var fs=require('fs');var _=require(_0xce0a('0xb'));var squel=require(_0xce0a('0xc'));var crypto=require(_0xce0a('0xd'));var jsforce=require(_0xce0a('0xe'));var deskjs=require(_0xce0a('0xf'));var toCsv=require(_0xce0a('0x9'));var querystring=require(_0xce0a('0x10'));var Papa=require(_0xce0a('0x11'));var Redis=require(_0xce0a('0x12'));var authService=require(_0xce0a('0x13'));var qs=require(_0xce0a('0x14'));var as=require(_0xce0a('0x15'));var hardwareService=require(_0xce0a('0x16'));var logger=require('../../config/logger')(_0xce0a('0x17'));var utils=require('../../config/utils');var config=require(_0xce0a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0a('0x19'))['db'];function respondWithStatusCode(_0x2da732,_0x2de21b){_0x2de21b=_0x2de21b||0xcc;return function(_0x20fde3){if(_0x20fde3){return _0x2da732[_0xce0a('0x1a')](_0x2de21b);}return _0x2da732['status'](_0x2de21b)[_0xce0a('0x1b')]();};}function respondWithResult(_0x130944,_0x389a21){_0x389a21=_0x389a21||0xc8;return function(_0x1a99b7){if(_0x1a99b7){return _0x130944[_0xce0a('0x1c')](_0x389a21)[_0xce0a('0x1d')](_0x1a99b7);}};}function respondWithFilteredResult(_0x559a07,_0x3d809f){return function(_0xae6bd9){if(_0xae6bd9){var _0x4ce32f=_0xae6bd9[_0xce0a('0x1e')],_0x4a19b9=_0x3d809f[_0xce0a('0x1f')],_0x3d1a92=_0x3d809f[_0xce0a('0x1f')]+_0x3d809f[_0xce0a('0x20')],_0x2f84e7;if(_0x3d1a92>=_0x4ce32f){_0x3d1a92=_0x4ce32f;_0x2f84e7=0xc8;}else{_0x2f84e7=0xce;}_0x559a07[_0xce0a('0x1c')](_0x2f84e7);return _0x559a07[_0xce0a('0x21')](_0xce0a('0x22'),_0x4a19b9+'-'+_0x3d1a92+'/'+_0x4ce32f)['json'](_0xae6bd9);}return null;};}function patchUpdates(_0x44e05a){return function(_0x2ae62e){try{jsonpatch[_0xce0a('0x23')](_0x2ae62e,_0x44e05a,!![]);}catch(_0x4f2a5f){return BPromise['reject'](_0x4f2a5f);}return _0x2ae62e[_0xce0a('0x24')]();};}function saveUpdates(_0x1a5e6c,_0x459090){return function(_0x382942){if(_0x382942){return _0x382942[_0xce0a('0x25')](_0x1a5e6c)[_0xce0a('0x26')](function(_0x2db3a1){return _0x2db3a1;});}return null;};}function removeEntity(_0x3c3103,_0x24af7b){return function(_0x183a8f){if(_0x183a8f){return _0x183a8f['destroy']()[_0xce0a('0x26')](function(){_0x3c3103['status'](0xcc)[_0xce0a('0x1b')]();});}};}function handleEntityNotFound(_0xfe629c,_0x2f1b31){return function(_0x47b28f){if(!_0x47b28f){_0xfe629c[_0xce0a('0x1a')](0x194);}return _0x47b28f;};}function handleError(_0xfb0ef3,_0x3ac649){_0x3ac649=_0x3ac649||0x1f4;return function(_0x4a4f67){logger[_0xce0a('0x27')](_0x4a4f67[_0xce0a('0x28')]);if(_0x4a4f67['name']){delete _0x4a4f67[_0xce0a('0x29')];}_0xfb0ef3[_0xce0a('0x1c')](_0x3ac649)[_0xce0a('0x2a')](_0x4a4f67);};}exports[_0xce0a('0x2b')]=function(_0x267128,_0x5a3097){var _0x28eba8={},_0x23b29c={},_0x2792c5={'count':0x0,'rows':[]};var _0x89161a=_[_0xce0a('0x2c')](db[_0xce0a('0x2d')][_0xce0a('0x2e')],function(_0x27ddad){return{'name':_0x27ddad['fieldName'],'type':_0x27ddad['type'][_0xce0a('0x2f')]};});_0x23b29c['model']=_[_0xce0a('0x2c')](_0x89161a,_0xce0a('0x29'));_0x23b29c[_0xce0a('0x30')]=_[_0xce0a('0x31')](_0x267128[_0xce0a('0x30')]);_0x23b29c[_0xce0a('0x32')]=_[_0xce0a('0x33')](_0x23b29c[_0xce0a('0x34')],_0x23b29c['query']);_0x28eba8[_0xce0a('0x35')]=_['intersection'](_0x23b29c[_0xce0a('0x34')],qs['fields'](_0x267128[_0xce0a('0x30')][_0xce0a('0x36')]));_0x28eba8['attributes']=_0x28eba8['attributes']['length']?_0x28eba8[_0xce0a('0x35')]:_0x23b29c[_0xce0a('0x34')];if(!_0x267128[_0xce0a('0x30')][_0xce0a('0x37')](_0xce0a('0x38'))){_0x28eba8['limit']=qs[_0xce0a('0x20')](_0x267128[_0xce0a('0x30')][_0xce0a('0x20')]);_0x28eba8[_0xce0a('0x1f')]=qs[_0xce0a('0x1f')](_0x267128['query'][_0xce0a('0x1f')]);}_0x28eba8[_0xce0a('0x39')]=qs['sort'](_0x267128[_0xce0a('0x30')]['sort']);_0x28eba8[_0xce0a('0x3a')]=qs[_0xce0a('0x32')](_['pick'](_0x267128['query'],_0x23b29c[_0xce0a('0x32')]),_0x89161a);if(_0x267128[_0xce0a('0x30')][_0xce0a('0x3b')]){_0x28eba8[_0xce0a('0x3a')]=_[_0xce0a('0x3c')](_0x28eba8[_0xce0a('0x3a')],{'$or':_[_0xce0a('0x2c')](_0x89161a,function(_0x4f6821){if(_0x4f6821[_0xce0a('0x3d')]!==_0xce0a('0x3e')){var _0x1d55fa={};_0x1d55fa[_0x4f6821[_0xce0a('0x29')]]={'$like':'%'+_0x267128[_0xce0a('0x30')][_0xce0a('0x3b')]+'%'};return _0x1d55fa;}})});}_0x28eba8=_[_0xce0a('0x3c')]({},_0x28eba8,_0x267128['options']);var _0x1166a3={'where':_0x28eba8['where']};return db[_0xce0a('0x2d')][_0xce0a('0x1e')](_0x1166a3)[_0xce0a('0x26')](function(_0x26a605){_0x2792c5[_0xce0a('0x1e')]=_0x26a605;if(_0x267128[_0xce0a('0x30')][_0xce0a('0x3f')]){_0x28eba8[_0xce0a('0x40')]=[{'all':!![]}];}return db[_0xce0a('0x2d')][_0xce0a('0x41')](_0x28eba8);})[_0xce0a('0x26')](function(_0x315833){_0x2792c5[_0xce0a('0x42')]=_0x315833;return _0x2792c5;})[_0xce0a('0x26')](respondWithFilteredResult(_0x5a3097,_0x28eba8))[_0xce0a('0x43')](handleError(_0x5a3097,null));};exports[_0xce0a('0x44')]=function(_0x283bfa,_0x17f898){var _0x2f504d={'raw':!![],'where':{'id':_0x283bfa['params']['id']}},_0x5bc3eb={};_0x5bc3eb[_0xce0a('0x34')]=_[_0xce0a('0x31')](db['DeskField']['rawAttributes']);_0x5bc3eb[_0xce0a('0x30')]=_[_0xce0a('0x31')](_0x283bfa[_0xce0a('0x30')]);_0x5bc3eb[_0xce0a('0x32')]=_['intersection'](_0x5bc3eb['model'],_0x5bc3eb[_0xce0a('0x30')]);_0x2f504d['attributes']=_['intersection'](_0x5bc3eb[_0xce0a('0x34')],qs[_0xce0a('0x36')](_0x283bfa[_0xce0a('0x30')][_0xce0a('0x36')]));_0x2f504d[_0xce0a('0x35')]=_0x2f504d['attributes']['length']?_0x2f504d[_0xce0a('0x35')]:_0x5bc3eb[_0xce0a('0x34')];if(_0x283bfa[_0xce0a('0x30')][_0xce0a('0x3f')]){_0x2f504d[_0xce0a('0x40')]=[{'all':!![]}];}_0x2f504d=_[_0xce0a('0x3c')]({},_0x2f504d,_0x283bfa['options']);return db['DeskField'][_0xce0a('0x45')](_0x2f504d)[_0xce0a('0x26')](handleEntityNotFound(_0x17f898,null))[_0xce0a('0x26')](respondWithResult(_0x17f898,null))[_0xce0a('0x43')](handleError(_0x17f898,null));};exports['create']=function(_0x5824c0,_0x41e0fb){return db[_0xce0a('0x2d')]['create'](_0x5824c0[_0xce0a('0x46')],{})[_0xce0a('0x26')](respondWithResult(_0x41e0fb,0xc9))['catch'](handleError(_0x41e0fb,null));};exports[_0xce0a('0x25')]=function(_0x53584c,_0x2894af){if(_0x53584c['body']['id']){delete _0x53584c['body']['id'];}return db[_0xce0a('0x2d')]['find']({'where':{'id':_0x53584c[_0xce0a('0x47')]['id']}})[_0xce0a('0x26')](handleEntityNotFound(_0x2894af,null))[_0xce0a('0x26')](saveUpdates(_0x53584c[_0xce0a('0x46')],null))[_0xce0a('0x26')](respondWithResult(_0x2894af,null))[_0xce0a('0x43')](handleError(_0x2894af,null));};exports[_0xce0a('0x48')]=function(_0x24bdb8,_0x462279){return db[_0xce0a('0x2d')]['find']({'where':{'id':_0x24bdb8[_0xce0a('0x47')]['id']}})[_0xce0a('0x26')](handleEntityNotFound(_0x462279,null))['then'](removeEntity(_0x462279,null))[_0xce0a('0x43')](handleError(_0x462279,null));}; \ No newline at end of file +var _0x0310=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','DeskField','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3f569c,_0x1ba524){var _0x55adb8=function(_0x1de13f){while(--_0x1de13f){_0x3f569c['push'](_0x3f569c['shift']());}};_0x55adb8(++_0x1ba524);}(_0x0310,0x115));var _0x0031=function(_0x107eae,_0xc0012c){_0x107eae=_0x107eae-0x0;var _0x4ee4b3=_0x0310[_0x107eae];return _0x4ee4b3;};'use strict';var pdf=require(_0x0031('0x0'));var emlformat=require(_0x0031('0x1'));var rimraf=require(_0x0031('0x2'));var zipdir=require(_0x0031('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0031('0x4'));var moment=require('moment');var BPromise=require(_0x0031('0x5'));var Mustache=require('mustache');var util=require(_0x0031('0x6'));var path=require('path');var sox=require(_0x0031('0x7'));var csv=require('to-csv');var ejs=require(_0x0031('0x8'));var fs=require('fs');var _=require(_0x0031('0x9'));var squel=require(_0x0031('0xa'));var crypto=require(_0x0031('0xb'));var jsforce=require(_0x0031('0xc'));var deskjs=require(_0x0031('0xd'));var toCsv=require(_0x0031('0xe'));var querystring=require(_0x0031('0xf'));var Papa=require(_0x0031('0x10'));var Redis=require(_0x0031('0x11'));var authService=require(_0x0031('0x12'));var qs=require(_0x0031('0x13'));var as=require(_0x0031('0x14'));var hardwareService=require(_0x0031('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0031('0x16'));var config=require(_0x0031('0x17'));var licenseUtil=require(_0x0031('0x18'));var db=require(_0x0031('0x19'))['db'];function respondWithStatusCode(_0x48fe40,_0x16014b){_0x16014b=_0x16014b||0xcc;return function(_0x324cfb){if(_0x324cfb){return _0x48fe40[_0x0031('0x1a')](_0x16014b);}return _0x48fe40[_0x0031('0x1b')](_0x16014b)[_0x0031('0x1c')]();};}function respondWithResult(_0x168e46,_0x489ab6){_0x489ab6=_0x489ab6||0xc8;return function(_0x4ca6a5){if(_0x4ca6a5){return _0x168e46[_0x0031('0x1b')](_0x489ab6)[_0x0031('0x1d')](_0x4ca6a5);}};}function respondWithFilteredResult(_0x27e7bb,_0x1ab90a){return function(_0x3c7ee4){if(_0x3c7ee4){var _0x543b0d=_0x3c7ee4[_0x0031('0x1e')],_0x1ac1bb=_0x1ab90a[_0x0031('0x1f')],_0x35b73d=_0x1ab90a[_0x0031('0x1f')]+_0x1ab90a[_0x0031('0x20')],_0x3e21e9;if(_0x35b73d>=_0x543b0d){_0x35b73d=_0x543b0d;_0x3e21e9=0xc8;}else{_0x3e21e9=0xce;}_0x27e7bb[_0x0031('0x1b')](_0x3e21e9);return _0x27e7bb[_0x0031('0x21')](_0x0031('0x22'),_0x1ac1bb+'-'+_0x35b73d+'/'+_0x543b0d)['json'](_0x3c7ee4);}return null;};}function patchUpdates(_0xc75d1a){return function(_0x4c145a){try{jsonpatch['apply'](_0x4c145a,_0xc75d1a,!![]);}catch(_0x3fb6a7){return BPromise[_0x0031('0x23')](_0x3fb6a7);}return _0x4c145a['save']();};}function saveUpdates(_0x5a0cd8,_0xd7b89d){return function(_0x33c9e0){if(_0x33c9e0){return _0x33c9e0[_0x0031('0x24')](_0x5a0cd8)['then'](function(_0x2612eb){return _0x2612eb;});}return null;};}function removeEntity(_0x4a8fc3,_0x3533de){return function(_0x25d2ba){if(_0x25d2ba){return _0x25d2ba[_0x0031('0x25')]()[_0x0031('0x26')](function(){_0x4a8fc3[_0x0031('0x1b')](0xcc)[_0x0031('0x1c')]();});}};}function handleEntityNotFound(_0xcd0369,_0x369604){return function(_0x5b58fc){if(!_0x5b58fc){_0xcd0369[_0x0031('0x1a')](0x194);}return _0x5b58fc;};}function handleError(_0x323078,_0x13dff3){_0x13dff3=_0x13dff3||0x1f4;return function(_0x23e84c){logger[_0x0031('0x27')](_0x23e84c['stack']);if(_0x23e84c[_0x0031('0x28')]){delete _0x23e84c['name'];}_0x323078[_0x0031('0x1b')](_0x13dff3)['send'](_0x23e84c);};}exports[_0x0031('0x29')]=function(_0x47a1e9,_0x5a6cc3){var _0x5c1951={},_0x512f25={},_0x253221={'count':0x0,'rows':[]};var _0x4c1d2e=_[_0x0031('0x2a')](db['DeskField'][_0x0031('0x2b')],function(_0x289282){return{'name':_0x289282[_0x0031('0x2c')],'type':_0x289282[_0x0031('0x2d')][_0x0031('0x2e')]};});_0x512f25['model']=_['map'](_0x4c1d2e,'name');_0x512f25['query']=_[_0x0031('0x2f')](_0x47a1e9[_0x0031('0x30')]);_0x512f25[_0x0031('0x31')]=_[_0x0031('0x32')](_0x512f25[_0x0031('0x33')],_0x512f25[_0x0031('0x30')]);_0x5c1951[_0x0031('0x34')]=_['intersection'](_0x512f25[_0x0031('0x33')],qs['fields'](_0x47a1e9[_0x0031('0x30')][_0x0031('0x35')]));_0x5c1951[_0x0031('0x34')]=_0x5c1951['attributes']['length']?_0x5c1951['attributes']:_0x512f25[_0x0031('0x33')];if(!_0x47a1e9[_0x0031('0x30')][_0x0031('0x36')](_0x0031('0x37'))){_0x5c1951[_0x0031('0x20')]=qs[_0x0031('0x20')](_0x47a1e9['query'][_0x0031('0x20')]);_0x5c1951['offset']=qs[_0x0031('0x1f')](_0x47a1e9[_0x0031('0x30')][_0x0031('0x1f')]);}_0x5c1951[_0x0031('0x38')]=qs['sort'](_0x47a1e9[_0x0031('0x30')][_0x0031('0x39')]);_0x5c1951[_0x0031('0x3a')]=qs[_0x0031('0x31')](_['pick'](_0x47a1e9[_0x0031('0x30')],_0x512f25[_0x0031('0x31')]),_0x4c1d2e);if(_0x47a1e9['query'][_0x0031('0x3b')]){_0x5c1951['where']=_['merge'](_0x5c1951[_0x0031('0x3a')],{'$or':_[_0x0031('0x2a')](_0x4c1d2e,function(_0x1722b6){if(_0x1722b6[_0x0031('0x2d')]!==_0x0031('0x3c')){var _0x25698d={};_0x25698d[_0x1722b6[_0x0031('0x28')]]={'$like':'%'+_0x47a1e9[_0x0031('0x30')][_0x0031('0x3b')]+'%'};return _0x25698d;}})});}_0x5c1951=_[_0x0031('0x3d')]({},_0x5c1951,_0x47a1e9[_0x0031('0x3e')]);var _0x456faf={'where':_0x5c1951[_0x0031('0x3a')]};return db['DeskField'][_0x0031('0x1e')](_0x456faf)[_0x0031('0x26')](function(_0x426329){_0x253221[_0x0031('0x1e')]=_0x426329;if(_0x47a1e9[_0x0031('0x30')][_0x0031('0x3f')]){_0x5c1951['include']=[{'all':!![]}];}return db[_0x0031('0x40')][_0x0031('0x41')](_0x5c1951);})['then'](function(_0x32e0f9){_0x253221[_0x0031('0x42')]=_0x32e0f9;return _0x253221;})['then'](respondWithFilteredResult(_0x5a6cc3,_0x5c1951))[_0x0031('0x43')](handleError(_0x5a6cc3,null));};exports[_0x0031('0x44')]=function(_0x24f867,_0x4e7826){var _0x432775={'raw':!![],'where':{'id':_0x24f867[_0x0031('0x45')]['id']}},_0x1231f6={};_0x1231f6[_0x0031('0x33')]=_[_0x0031('0x2f')](db['DeskField'][_0x0031('0x2b')]);_0x1231f6[_0x0031('0x30')]=_[_0x0031('0x2f')](_0x24f867['query']);_0x1231f6[_0x0031('0x31')]=_[_0x0031('0x32')](_0x1231f6[_0x0031('0x33')],_0x1231f6[_0x0031('0x30')]);_0x432775[_0x0031('0x34')]=_['intersection'](_0x1231f6['model'],qs['fields'](_0x24f867[_0x0031('0x30')]['fields']));_0x432775[_0x0031('0x34')]=_0x432775[_0x0031('0x34')]['length']?_0x432775[_0x0031('0x34')]:_0x1231f6[_0x0031('0x33')];if(_0x24f867[_0x0031('0x30')][_0x0031('0x3f')]){_0x432775[_0x0031('0x46')]=[{'all':!![]}];}_0x432775=_[_0x0031('0x3d')]({},_0x432775,_0x24f867['options']);return db[_0x0031('0x40')][_0x0031('0x47')](_0x432775)[_0x0031('0x26')](handleEntityNotFound(_0x4e7826,null))['then'](respondWithResult(_0x4e7826,null))[_0x0031('0x43')](handleError(_0x4e7826,null));};exports['create']=function(_0x21dd9e,_0x42c444){return db[_0x0031('0x40')][_0x0031('0x48')](_0x21dd9e['body'],{})[_0x0031('0x26')](respondWithResult(_0x42c444,0xc9))[_0x0031('0x43')](handleError(_0x42c444,null));};exports[_0x0031('0x24')]=function(_0x4acd69,_0x261a13){if(_0x4acd69[_0x0031('0x49')]['id']){delete _0x4acd69[_0x0031('0x49')]['id'];}return db[_0x0031('0x40')][_0x0031('0x47')]({'where':{'id':_0x4acd69[_0x0031('0x45')]['id']}})[_0x0031('0x26')](handleEntityNotFound(_0x261a13,null))[_0x0031('0x26')](saveUpdates(_0x4acd69['body'],null))['then'](respondWithResult(_0x261a13,null))[_0x0031('0x43')](handleError(_0x261a13,null));};exports[_0x0031('0x25')]=function(_0x34ee2f,_0x3b715b){return db['DeskField']['find']({'where':{'id':_0x34ee2f[_0x0031('0x45')]['id']}})[_0x0031('0x26')](handleEntityNotFound(_0x3b715b,null))[_0x0031('0x26')](removeEntity(_0x3b715b,null))[_0x0031('0x43')](handleError(_0x3b715b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6e04645..cf4e1e9 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 _0xad8a=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x18c892,_0x4bbe86){var _0x42ccc1=function(_0xbf9cdd){while(--_0xbf9cdd){_0x18c892['push'](_0x18c892['shift']());}};_0x42ccc1(++_0x4bbe86);}(_0xad8a,0x12a));var _0xaad8=function(_0x24b160,_0x4de6e2){_0x24b160=_0x24b160-0x0;var _0x2d91b6=_0xad8a[_0x24b160];return _0x2d91b6;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var logger=require(_0xaad8('0x2'))(_0xaad8('0x3'));var moment=require(_0xaad8('0x4'));var BPromise=require(_0xaad8('0x5'));var rp=require(_0xaad8('0x6'));var fs=require('fs');var path=require(_0xaad8('0x7'));var rimraf=require(_0xaad8('0x8'));var config=require(_0xaad8('0x9'));var attributes=require(_0xaad8('0xa'));module[_0xaad8('0xb')]=function(_0x262bc0,_0xb310e2){return _0x262bc0[_0xaad8('0xc')](_0xaad8('0xd'),attributes,{'tableName':_0xaad8('0xe'),'paranoid':![],'indexes':[{'name':_0xaad8('0xf'),'fields':[_0xaad8('0x10'),_0xaad8('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8496=['util','moment','bluebird','../../config/environment','define','DeskField','int_desk_fields','idField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8496,0x168));var _0x6849=function(_0x40f034,_0x1c2974){_0x40f034=_0x40f034-0x0;var _0x2fd246=_0x8496[_0x40f034];return _0x2fd246;};'use strict';var _=require('lodash');var util=require(_0x6849('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6849('0x1'));var BPromise=require(_0x6849('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6849('0x3'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x57dc32,_0x1c95ba){return _0x57dc32[_0x6849('0x4')](_0x6849('0x5'),attributes,{'tableName':_0x6849('0x6'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x6849('0x7'),_0x6849('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index b8a48ea..ebe2294 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 _0xbda8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x37aa0a,_0x332bb0){var _0x1414be=function(_0x15231f){while(--_0x15231f){_0x37aa0a['push'](_0x37aa0a['shift']());}};_0x1414be(++_0x332bb0);}(_0xbda8,0x112));var _0x8bda=function(_0x11f8cb,_0x576a48){_0x11f8cb=_0x11f8cb-0x0;var _0x31a29a=_0xbda8[_0x11f8cb];return _0x31a29a;};'use strict';var _=require(_0x8bda('0x0'));var util=require(_0x8bda('0x1'));var moment=require(_0x8bda('0x2'));var BPromise=require(_0x8bda('0x3'));var rs=require(_0x8bda('0x4'));var fs=require('fs');var Redis=require(_0x8bda('0x5'));var db=require(_0x8bda('0x6'))['db'];var utils=require(_0x8bda('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bda('0x8'));var jayson=require(_0x8bda('0x9'));var client=jayson[_0x8bda('0xa')][_0x8bda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c72bf,_0x53135f,_0x43d854){return new BPromise(function(_0x7176a7,_0x9b6fbc){return client[_0x8bda('0xc')](_0x2c72bf,_0x43d854)[_0x8bda('0xd')](function(_0x5a3a29){logger[_0x8bda('0xe')]('DeskField,\x20%s,\x20%s',_0x53135f,'request\x20sent');logger[_0x8bda('0xf')](_0x8bda('0x10'),_0x53135f,'request\x20sent',JSON[_0x8bda('0x11')](_0x5a3a29));if(_0x5a3a29[_0x8bda('0x12')]){if(_0x5a3a29[_0x8bda('0x12')][_0x8bda('0x13')]===0x1f4){logger['error'](_0x8bda('0x14'),_0x53135f,_0x5a3a29['error'][_0x8bda('0x15')]);return _0x9b6fbc(_0x5a3a29['error'][_0x8bda('0x15')]);}logger[_0x8bda('0x12')]('DeskField,\x20%s,\x20%s',_0x53135f,_0x5a3a29[_0x8bda('0x12')]['message']);return _0x7176a7(_0x5a3a29['error'][_0x8bda('0x15')]);}else{logger['info'](_0x8bda('0x14'),_0x53135f,_0x8bda('0x16'));_0x7176a7(_0x5a3a29[_0x8bda('0x17')][_0x8bda('0x15')]);}})[_0x8bda('0x18')](function(_0x514c19){logger['error']('DeskField,\x20%s,\x20%s',_0x53135f,_0x514c19);_0x9b6fbc(_0x514c19);});});} \ No newline at end of file +var _0xaec2=['../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xaec2,0xd7));var _0x2aec=function(_0x5f76e3,_0x977880){_0x5f76e3=_0x5f76e3-0x0;var _0x4a5558=_0xaec2[_0x5f76e3];return _0x4a5558;};'use strict';var _=require('lodash');var util=require(_0x2aec('0x0'));var moment=require(_0x2aec('0x1'));var BPromise=require('bluebird');var rs=require(_0x2aec('0x2'));var fs=require('fs');var Redis=require(_0x2aec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2aec('0x4'));var config=require(_0x2aec('0x5'));var jayson=require(_0x2aec('0x6'));var client=jayson[_0x2aec('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587245,_0x3f59ea,_0x225a34){return new BPromise(function(_0x423c30,_0x1a7d94){return client[_0x2aec('0x8')](_0x587245,_0x225a34)['then'](function(_0x2b89e2){logger[_0x2aec('0x9')](_0x2aec('0xa'),_0x3f59ea,_0x2aec('0xb'));logger[_0x2aec('0xc')](_0x2aec('0xd'),_0x3f59ea,'request\x20sent',JSON[_0x2aec('0xe')](_0x2b89e2));if(_0x2b89e2[_0x2aec('0xf')]){if(_0x2b89e2[_0x2aec('0xf')][_0x2aec('0x10')]===0x1f4){logger[_0x2aec('0xf')]('DeskField,\x20%s,\x20%s',_0x3f59ea,_0x2b89e2[_0x2aec('0xf')][_0x2aec('0x11')]);return _0x1a7d94(_0x2b89e2['error'][_0x2aec('0x11')]);}logger[_0x2aec('0xf')](_0x2aec('0xa'),_0x3f59ea,_0x2b89e2[_0x2aec('0xf')][_0x2aec('0x11')]);return _0x423c30(_0x2b89e2['error'][_0x2aec('0x11')]);}else{logger[_0x2aec('0x9')](_0x2aec('0xa'),_0x3f59ea,_0x2aec('0xb'));_0x423c30(_0x2b89e2[_0x2aec('0x12')][_0x2aec('0x11')]);}})[_0x2aec('0x13')](function(_0x48cece){logger[_0x2aec('0xf')](_0x2aec('0xa'),_0x3f59ea,_0x48cece);_0x1a7d94(_0x48cece);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 00f8372..9d64f59 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x14dd29,_0x4aed73){var _0x9bf416=function(_0x4f1b4b){while(--_0x4f1b4b){_0x14dd29['push'](_0x14dd29['shift']());}};_0x9bf416(++_0x4aed73);}(_0x4fc2,0x111));var _0x24fc=function(_0x38a778,_0x8eceb){_0x38a778=_0x38a778-0x0;var _0x21b920=_0x4fc2[_0x38a778];return _0x21b920;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x10')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);router[_0x24fc('0x13')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4fc2=['getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x370f27,_0x27ed48){var _0x1e5000=function(_0x3f02dd){while(--_0x3f02dd){_0x370f27['push'](_0x370f27['shift']());}};_0x1e5000(++_0x27ed48);}(_0x4fc2,0x111));var _0x24fc=function(_0x1ea888,_0x187788){_0x1ea888=_0x1ea888-0x0;var _0x46f41f=_0x4fc2[_0x1ea888];return _0x46f41f;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x10')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);router[_0x24fc('0x13')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 95f2b09..4eae8a4 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 _0x6593=['sequelize','STRING'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x6593,0xd6));var _0x3659=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0x6593[_0x574d9b];return _0x31d2a5;};'use strict';var Sequelize=require(_0x3659('0x0'));module['exports']={'name':{'type':Sequelize[_0x3659('0x1')]},'username':{'type':Sequelize[_0x3659('0x1')]},'password':{'type':Sequelize[_0x3659('0x1')]},'remoteUri':{'type':Sequelize[_0x3659('0x1')]},'tenantId':{'type':Sequelize[_0x3659('0x1')]},'clientId':{'type':Sequelize[_0x3659('0x1')]},'clientSecret':{'type':Sequelize[_0x3659('0x1')]},'serverUrl':{'type':Sequelize[_0x3659('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3659('0x1')]}}; \ No newline at end of file +var _0x507c=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x507c,0x111));var _0xc507=function(_0x466ea0,_0x39edf9){_0x466ea0=_0x466ea0-0x0;var _0x40b1d1=_0x507c[_0x466ea0];return _0x40b1d1;};'use strict';var Sequelize=require(_0xc507('0x0'));module['exports']={'name':{'type':Sequelize[_0xc507('0x1')]},'username':{'type':Sequelize[_0xc507('0x1')]},'password':{'type':Sequelize[_0xc507('0x1')]},'remoteUri':{'type':Sequelize[_0xc507('0x1')]},'tenantId':{'type':Sequelize[_0xc507('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc507('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 19ae608..603fdb9 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 _0x2a07=['description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','entitlementidname','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','password','tenantId','remoteUri','slice','lastIndexOf','format','POST','/oauth2/token','clientId','username','clientSecret','access_token','GET','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','substring','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','fields','options','create','body','findOne','Dynamics365Configuration','pick','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','Incident','title'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x2a07,0x74));var _0x72a0=function(_0x3ed98d,_0x2f4af7){_0x3ed98d=_0x3ed98d-0x0;var _0x2b81e0=_0x2a07[_0x3ed98d];return _0x2b81e0;};'use strict';var pdf=require(_0x72a0('0x0'));var emlformat=require(_0x72a0('0x1'));var rimraf=require(_0x72a0('0x2'));var zipdir=require(_0x72a0('0x3'));var jsonpatch=require(_0x72a0('0x4'));var rp=require('request-promise');var moment=require(_0x72a0('0x5'));var BPromise=require(_0x72a0('0x6'));var Mustache=require(_0x72a0('0x7'));var util=require(_0x72a0('0x8'));var path=require(_0x72a0('0x9'));var sox=require(_0x72a0('0xa'));var csv=require(_0x72a0('0xb'));var ejs=require(_0x72a0('0xc'));var fs=require('fs');var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xb'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];var integrations=require(_0x72a0('0x1c'));var jayson=require(_0x72a0('0x1d'));var client=jayson[_0x72a0('0x1e')][_0x72a0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x324cbd,_0xe73b5e,_0x5e0b5f,_0x4930c5){return new BPromise(function(_0xe103dc,_0x3cd89f){var _0x19eaf9=_0x4930c5||client;return _0x19eaf9[_0x72a0('0x20')](_0x324cbd,_0x5e0b5f)[_0x72a0('0x21')](function(_0x3f3d62){logger['info'](_0x72a0('0x22'),_0xe73b5e,_0x72a0('0x23'));logger[_0x72a0('0x24')](_0x72a0('0x25'),_0xe73b5e,_0x72a0('0x23'),JSON['stringify'](_0x3f3d62));if(_0x3f3d62[_0x72a0('0x26')]){if(_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x27')]===0x1f4){logger['error'](_0x72a0('0x22'),_0xe73b5e,_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x28')]);return _0x3cd89f(_0x3f3d62[_0x72a0('0x26')]['message']);}logger[_0x72a0('0x26')]('Dynamics365Account,\x20%s,\x20%s',_0xe73b5e,_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x28')]);return _0xe103dc(_0x3f3d62[_0x72a0('0x26')]['message']);}else{logger[_0x72a0('0x29')](_0x72a0('0x22'),_0xe73b5e,_0x72a0('0x23'));_0xe103dc(_0x3f3d62[_0x72a0('0x2a')]['message']);}})[_0x72a0('0x2b')](function(_0x390464){logger[_0x72a0('0x26')](_0x72a0('0x22'),_0xe73b5e,_0x390464);_0x3cd89f(_0x390464);});});}function respondWithStatusCode(_0x3022b0,_0x174b1b){_0x174b1b=_0x174b1b||0xcc;return function(_0x5c4daf){if(_0x5c4daf){return _0x3022b0['sendStatus'](_0x174b1b);}return _0x3022b0[_0x72a0('0x2c')](_0x174b1b)[_0x72a0('0x2d')]();};}function respondWithResult(_0x123df4,_0x1504ed){_0x1504ed=_0x1504ed||0xc8;return function(_0xf5cb49){if(_0xf5cb49){return _0x123df4[_0x72a0('0x2c')](_0x1504ed)[_0x72a0('0x2e')](_0xf5cb49);}};}function respondWithFilteredResult(_0x15922a,_0xee99e2){return function(_0x12dcc9){if(_0x12dcc9){var _0x4f9718=_0x12dcc9[_0x72a0('0x2f')],_0x304b92=_0xee99e2[_0x72a0('0x30')],_0x553641=_0xee99e2[_0x72a0('0x30')]+_0xee99e2[_0x72a0('0x31')],_0xc22d18;if(_0x553641>=_0x4f9718){_0x553641=_0x4f9718;_0xc22d18=0xc8;}else{_0xc22d18=0xce;}_0x15922a[_0x72a0('0x2c')](_0xc22d18);return _0x15922a[_0x72a0('0x32')](_0x72a0('0x33'),_0x304b92+'-'+_0x553641+'/'+_0x4f9718)['json'](_0x12dcc9);}return null;};}function patchUpdates(_0x41efc1){return function(_0x17e955){try{jsonpatch[_0x72a0('0x34')](_0x17e955,_0x41efc1,!![]);}catch(_0xfbe9b3){return BPromise[_0x72a0('0x35')](_0xfbe9b3);}return _0x17e955[_0x72a0('0x36')]();};}function saveUpdates(_0x3a5e54,_0x592401){return function(_0x30878e){if(_0x30878e){return _0x30878e[_0x72a0('0x37')](_0x3a5e54)[_0x72a0('0x21')](function(_0x197591){return _0x197591;});}return null;};}function removeEntity(_0x89d598,_0x469c07){return function(_0x7c5d43){if(_0x7c5d43){return _0x7c5d43[_0x72a0('0x38')]()['then'](function(){_0x89d598[_0x72a0('0x2c')](0xcc)[_0x72a0('0x2d')]();});}};}function handleEntityNotFound(_0x2959af,_0x560ec3){return function(_0x2ae61c){if(!_0x2ae61c){_0x2959af['sendStatus'](0x194);}return _0x2ae61c;};}function handleError(_0x4b2b44,_0x277d8f){_0x277d8f=_0x277d8f||0x1f4;return function(_0x1d02c4){logger[_0x72a0('0x26')](_0x1d02c4[_0x72a0('0x39')]);if(_0x1d02c4[_0x72a0('0x3a')]){delete _0x1d02c4[_0x72a0('0x3a')];}_0x4b2b44[_0x72a0('0x2c')](_0x277d8f)[_0x72a0('0x3b')](_0x1d02c4);};}exports[_0x72a0('0x3c')]=function(_0x2ee3f8,_0x3ff191){var _0x5b6326={},_0x265d96={},_0x5eb8f1={'count':0x0,'rows':[]};var _0x1d0fa8=_[_0x72a0('0x3d')](db[_0x72a0('0x3e')][_0x72a0('0x3f')],function(_0xbb1f4){return{'name':_0xbb1f4[_0x72a0('0x40')],'type':_0xbb1f4[_0x72a0('0x41')][_0x72a0('0x42')]};});_0x265d96[_0x72a0('0x43')]=_['map'](_0x1d0fa8,'name');_0x265d96[_0x72a0('0x44')]=_[_0x72a0('0x45')](_0x2ee3f8[_0x72a0('0x44')]);_0x265d96[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x265d96['model'],_0x265d96[_0x72a0('0x44')]);_0x5b6326[_0x72a0('0x48')]=_['intersection'](_0x265d96[_0x72a0('0x43')],qs['fields'](_0x2ee3f8['query']['fields']));_0x5b6326[_0x72a0('0x48')]=_0x5b6326['attributes'][_0x72a0('0x49')]?_0x5b6326[_0x72a0('0x48')]:_0x265d96[_0x72a0('0x43')];if(!_0x2ee3f8[_0x72a0('0x44')]['hasOwnProperty']('nolimit')){_0x5b6326['limit']=qs['limit'](_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x31')]);_0x5b6326['offset']=qs[_0x72a0('0x30')](_0x2ee3f8[_0x72a0('0x44')]['offset']);}_0x5b6326[_0x72a0('0x4a')]=qs[_0x72a0('0x4b')](_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x4b')]);_0x5b6326[_0x72a0('0x4c')]=qs[_0x72a0('0x46')](_['pick'](_0x2ee3f8[_0x72a0('0x44')],_0x265d96['filters']),_0x1d0fa8);if(_0x2ee3f8[_0x72a0('0x44')]['filter']){_0x5b6326[_0x72a0('0x4c')]=_[_0x72a0('0x4d')](_0x5b6326['where'],{'$or':_[_0x72a0('0x3d')](_0x1d0fa8,function(_0x506d65){if(_0x506d65[_0x72a0('0x41')]!==_0x72a0('0x4e')){var _0x13254c={};_0x13254c[_0x506d65['name']]={'$like':'%'+_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x4f')]+'%'};return _0x13254c;}})});}_0x5b6326=_[_0x72a0('0x4d')]({},_0x5b6326,_0x2ee3f8['options']);var _0x5f1fcc={'where':_0x5b6326[_0x72a0('0x4c')]};return db['Dynamics365Account'][_0x72a0('0x2f')](_0x5f1fcc)[_0x72a0('0x21')](function(_0x1d2e44){_0x5eb8f1[_0x72a0('0x2f')]=_0x1d2e44;if(_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x50')]){_0x5b6326[_0x72a0('0x51')]=[{'all':!![]}];}return db[_0x72a0('0x3e')][_0x72a0('0x52')](_0x5b6326);})['then'](function(_0x4fae3d){_0x5eb8f1[_0x72a0('0x53')]=_0x4fae3d;return _0x5eb8f1;})[_0x72a0('0x21')](respondWithFilteredResult(_0x3ff191,_0x5b6326))[_0x72a0('0x2b')](handleError(_0x3ff191,null));};exports[_0x72a0('0x54')]=function(_0x304400,_0x2de809){var _0x4a72fd={'raw':![],'where':{'id':_0x304400[_0x72a0('0x55')]['id']}},_0x4f9091={};_0x4f9091[_0x72a0('0x43')]=_[_0x72a0('0x45')](db[_0x72a0('0x3e')][_0x72a0('0x3f')]);_0x4f9091[_0x72a0('0x44')]=_[_0x72a0('0x45')](_0x304400[_0x72a0('0x44')]);_0x4f9091[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x4f9091['model'],_0x4f9091[_0x72a0('0x44')]);_0x4a72fd[_0x72a0('0x48')]=_[_0x72a0('0x47')](_0x4f9091[_0x72a0('0x43')],qs[_0x72a0('0x56')](_0x304400['query'][_0x72a0('0x56')]));_0x4a72fd['attributes']=_0x4a72fd['attributes'][_0x72a0('0x49')]?_0x4a72fd[_0x72a0('0x48')]:_0x4f9091[_0x72a0('0x43')];if(_0x304400[_0x72a0('0x44')][_0x72a0('0x50')]){_0x4a72fd['include']=[{'all':!![]}];}_0x4a72fd=_[_0x72a0('0x4d')]({},_0x4a72fd,_0x304400[_0x72a0('0x57')]);return db['Dynamics365Account']['find'](_0x4a72fd)[_0x72a0('0x21')](handleEntityNotFound(_0x2de809,null))[_0x72a0('0x21')](respondWithResult(_0x2de809,null))[_0x72a0('0x2b')](handleError(_0x2de809,null));};exports[_0x72a0('0x58')]=function(_0x18b4b3,_0x3813ca){return db[_0x72a0('0x3e')][_0x72a0('0x58')](_0x18b4b3['body'],{})[_0x72a0('0x21')](respondWithResult(_0x3813ca,0xc9))['catch'](handleError(_0x3813ca,null));};exports['update']=function(_0x591dbc,_0x1f30e0){if(_0x591dbc[_0x72a0('0x59')]['id']){delete _0x591dbc['body']['id'];}return db[_0x72a0('0x3e')]['find']({'where':{'id':_0x591dbc[_0x72a0('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f30e0,null))['then'](saveUpdates(_0x591dbc[_0x72a0('0x59')],null))[_0x72a0('0x21')](respondWithResult(_0x1f30e0,null))['catch'](handleError(_0x1f30e0,null));};exports[_0x72a0('0x38')]=function(_0x4bb670,_0x106ec1){return db['Dynamics365Account']['find']({'where':{'id':_0x4bb670[_0x72a0('0x55')]['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x106ec1,null))[_0x72a0('0x21')](removeEntity(_0x106ec1,null))['catch'](handleError(_0x106ec1,null));};exports['getConfigurations']=function(_0xe49c8e,_0x48f178,_0x44b171){var _0x36d604={};var _0x1cea02={};var _0x4b03ab;var _0x11a750;return db[_0x72a0('0x3e')][_0x72a0('0x5a')]({'where':{'id':_0xe49c8e[_0x72a0('0x55')]['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x48f178,null))[_0x72a0('0x21')](function(_0x32a0bb){if(_0x32a0bb){_0x4b03ab=_0x32a0bb;_0x1cea02[_0x72a0('0x43')]=_['keys'](db[_0x72a0('0x5b')]['rawAttributes']);_0x1cea02['query']=_['keys'](_0xe49c8e['query']);_0x1cea02[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x1cea02[_0x72a0('0x43')],_0x1cea02['query']);_0x36d604[_0x72a0('0x48')]=_['intersection'](_0x1cea02[_0x72a0('0x43')],qs[_0x72a0('0x56')](_0xe49c8e['query'][_0x72a0('0x56')]));_0x36d604[_0x72a0('0x48')]=_0x36d604[_0x72a0('0x48')][_0x72a0('0x49')]?_0x36d604['attributes']:_0x1cea02[_0x72a0('0x43')];_0x36d604['order']=qs[_0x72a0('0x4b')](_0xe49c8e[_0x72a0('0x44')][_0x72a0('0x4b')]);_0x36d604['where']=qs[_0x72a0('0x46')](_[_0x72a0('0x5c')](_0xe49c8e[_0x72a0('0x44')],_0x1cea02[_0x72a0('0x46')]));if(_0xe49c8e[_0x72a0('0x44')]['filter']){_0x36d604['where']=_[_0x72a0('0x4d')](_0x36d604['where'],{'$or':_[_0x72a0('0x3d')](_0x36d604['attributes'],function(_0x3c7fa6){var _0xd9ae1a={};_0xd9ae1a[_0x3c7fa6]={'$like':'%'+_0xe49c8e['query'][_0x72a0('0x4f')]+'%'};return _0xd9ae1a;})});}_0x36d604=_[_0x72a0('0x4d')]({},_0x36d604,_0xe49c8e[_0x72a0('0x57')]);return _0x4b03ab['getConfigurations'](_0x36d604);}})[_0x72a0('0x21')](function(_0x48649e){if(_0x48649e){_0x11a750=_0x48649e[_0x72a0('0x49')];if(!_0xe49c8e[_0x72a0('0x44')]['hasOwnProperty'](_0x72a0('0x5d'))){_0x36d604['limit']=qs['limit'](_0xe49c8e['query'][_0x72a0('0x31')]);_0x36d604['offset']=qs[_0x72a0('0x30')](_0xe49c8e['query'][_0x72a0('0x30')]);}return _0x4b03ab[_0x72a0('0x5e')](_0x36d604);}})[_0x72a0('0x21')](function(_0x5b81d7){if(_0x5b81d7){return _0x5b81d7?{'count':_0x11a750,'rows':_0x5b81d7}:null;}})[_0x72a0('0x21')](respondWithResult(_0x48f178,null))[_0x72a0('0x2b')](handleError(_0x48f178,null));};exports[_0x72a0('0x5f')]=function(_0x28551a,_0x2c46dc,_0x58ef97){if(_0x28551a[_0x72a0('0x59')]['id']){delete _0x28551a[_0x72a0('0x59')]['id'];}return db[_0x72a0('0x3e')][_0x72a0('0x5a')]({'where':{'id':_0x28551a['params']['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x2c46dc,null))[_0x72a0('0x21')](function(_0x4ebce5){if(_0x4ebce5){_0x28551a[_0x72a0('0x59')]['AccountId']=_0x4ebce5['id'];_0x28551a[_0x72a0('0x59')][_0x72a0('0x60')]=integrations[_0x72a0('0x61')](_0x28551a[_0x72a0('0x59')][_0x72a0('0x62')],_0x28551a[_0x72a0('0x59')][_0x72a0('0x41')]);_0x28551a['body']['Descriptions']=integrations['getDescriptions'](_0x28551a[_0x72a0('0x59')][_0x72a0('0x62')],_0x28551a[_0x72a0('0x59')][_0x72a0('0x41')]);return db[_0x72a0('0x5b')][_0x72a0('0x58')](_0x28551a['body'],{'include':[{'model':db[_0x72a0('0x63')],'as':_0x72a0('0x60')},{'model':db[_0x72a0('0x63')],'as':_0x72a0('0x64')}]});}return null;})[_0x72a0('0x21')](respondWithResult(_0x2c46dc,null))[_0x72a0('0x2b')](handleError(_0x2c46dc,null));};exports[_0x72a0('0x65')]=function(_0x5d5dd8,_0x1e36b0,_0x9fc964){var _0x130c90=_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0x66')];var _0x26e270=_0x130c90==='incident'?_0x72a0('0x67'):'PhoneCall';var _0x35fc2c='';var _0x1a51bb='';var _0x134c7d='';var _0x3d5edb='';var _0xed6c1b='';var _0x546646='';var _0x361f8f='';var _0x46a306='';var _0x4e52e4=[_0x72a0('0x68'),_0x72a0('0x69'),_0x72a0('0x6a'),_0x72a0('0x6b'),'caseorigincode',_0x72a0('0x6c'),_0x72a0('0x6d'),_0x72a0('0x6e'),_0x72a0('0x6f'),_0x72a0('0x70')];var _0xfef0b1=[_0x72a0('0x71'),_0x72a0('0x72'),_0x72a0('0x73'),_0x72a0('0x74'),_0x72a0('0x75'),_0x72a0('0x76'),'contractdetailidname',_0x72a0('0x77'),_0x72a0('0x78'),_0x72a0('0x79'),_0x72a0('0x7a'),_0x72a0('0x7b'),_0x72a0('0x7c'),_0x72a0('0x7d'),_0x72a0('0x7e'),'customeridname',_0x72a0('0x7f'),'customeridyominame','emailaddress',_0x72a0('0x80'),'entityimage_timestamp','entityimage_url',_0x72a0('0x81'),'exchangerate',_0x72a0('0x82'),_0x72a0('0x83'),_0x72a0('0x84'),'influencescore',_0x72a0('0x85'),_0x72a0('0x86'),_0x72a0('0x87'),_0x72a0('0x88'),_0x72a0('0x89'),'modifiedbyname',_0x72a0('0x8a'),_0x72a0('0x8b'),_0x72a0('0x8c'),'modifiedonbehalfbyyominame',_0x72a0('0x8d'),_0x72a0('0x8e'),_0x72a0('0x8f'),'onholdtime',_0x72a0('0x90'),_0x72a0('0x91'),_0x72a0('0x92'),_0x72a0('0x93'),_0x72a0('0x94'),_0x72a0('0x95'),_0x72a0('0x96'),_0x72a0('0x97'),_0x72a0('0x98'),'productserialnumber',_0x72a0('0x99'),_0x72a0('0x9a'),_0x72a0('0x9b'),_0x72a0('0x9c'),_0x72a0('0x9d'),'sentimentvalue',_0x72a0('0x9e'),_0x72a0('0x9f'),_0x72a0('0xa0'),_0x72a0('0xa1'),'statuscode',_0x72a0('0xa2'),_0x72a0('0xa3'),_0x72a0('0xa4'),'transactioncurrencyidname','traversedpath',_0x72a0('0xa5'),_0x72a0('0xa6')];var _0x17776e=_0x4e52e4[_0x72a0('0xa7')](_0xfef0b1);return db[_0x72a0('0x3e')]['findOne']({'where':{'id':_0x5d5dd8['params']['id']},'attributes':['id','username',_0x72a0('0xa8'),'remoteUri',_0x72a0('0xa9'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x1e36b0,null))['then'](function(_0x33c9dd){if(_0x33c9dd){_0x46a306=_0x33c9dd[_0x72a0('0xaa')];var _0x153802=_0x46a306[_0x72a0('0xab')](-0x1);if(_0x153802==='/'){_0x46a306=_0x46a306['substring'](0x0,_0x46a306[_0x72a0('0xac')](_0x153802));}_0x361f8f=util[_0x72a0('0xad')]('%s/api/data/v9.0/',_0x46a306);var _0xda549d={'method':_0x72a0('0xae'),'uri':'https://login.microsoftonline.com/'+_0x33c9dd[_0x72a0('0xa9')]+_0x72a0('0xaf'),'form':{'client_id':_0x33c9dd[_0x72a0('0xb0')],'resource':_0x46a306,'username':_0x33c9dd[_0x72a0('0xb1')],'password':_0x33c9dd['password'],'grant_type':'password','client_secret':_0x33c9dd[_0x72a0('0xb2')]},'json':!![]};return rp(_0xda549d);}})[_0x72a0('0x21')](function(_0x358f96){_0x546646=_0x358f96[_0x72a0('0xb3')];var _0x2ac5b0={'method':_0x72a0('0xb4'),'uri':encodeURI(_0x361f8f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x26e270+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x546646,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x2ac5b0);})[_0x72a0('0x21')](function(_0x57550f){var _0x40f2e2=_0x57550f[_0x72a0('0xb6')][0x0];var _0xec7717=_0x40f2e2[_0x72a0('0xb7')];var _0x328c84={'method':_0x72a0('0xb4'),'uri':_0x361f8f+_0x72a0('0xb8')+_0xec7717+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x72a0('0xb9')+_0x546646,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x328c84);})[_0x72a0('0x21')](function(_0x5a0aa3){_0x35fc2c=_0x5a0aa3;_0x1a51bb=_0x35fc2c[_0x72a0('0xba')];_0x1a51bb=_[_0x72a0('0xbb')](_0x1a51bb,function(_0x346e03){return!_0x17776e[_0x72a0('0xbc')](_0x346e03[_0x72a0('0xbd')]);});var _0x49374f=[];var _0xc16765=[];_0x1a51bb[_0x72a0('0xbe')](function(_0x1f6d7d){if(_0x1f6d7d[_0x72a0('0xbf')]){var _0xfe62a1=_0x1f6d7d[_0x72a0('0xbf')]['substring'](_0x1f6d7d[_0x72a0('0xbf')][_0x72a0('0xac')]('.')+0x1);if(_0xfe62a1===_0x72a0('0xc0')){_0x49374f[_0x72a0('0xc1')](getSelectList(_0x361f8f,_0x130c90,_0xc16765,_0x35fc2c[_0x72a0('0xb7')],_0x1f6d7d[_0x72a0('0xb7')],_0x546646));}}});return Promise[_0x72a0('0xc2')](_0x49374f);})[_0x72a0('0x21')](function(_0x2c99f9){_0x134c7d=_0x2c99f9[0x0];var _0x49b0e8=[];var _0x2a2eaa=[];_0x1a51bb['forEach'](function(_0x1dcbcc){if(!_[_0x72a0('0xc3')](_0x1dcbcc[_0x72a0('0xbf')])){var _0x276cca=_0x1dcbcc[_0x72a0('0xbf')][_0x72a0('0xc4')](_0x1dcbcc['@odata.type']['lastIndexOf']('.')+0x1);if(_0x276cca===_0x72a0('0xc5')){_0x49b0e8[_0x72a0('0xc1')](getBooleanList(_0x361f8f,_0x130c90,_0x2a2eaa,_0x35fc2c[_0x72a0('0xb7')],_0x1dcbcc[_0x72a0('0xb7')],_0x546646));}}});return Promise[_0x72a0('0xc2')](_0x49b0e8);})[_0x72a0('0x21')](function(_0x3a8386){_0x3d5edb=_0x3a8386[0x0];var _0x1e7d8b=[];var _0xbad206=[];_0x1a51bb[_0x72a0('0xbe')](function(_0x227901){if(_0x227901[_0x72a0('0xbf')]){var _0x1fb03c=_0x227901[_0x72a0('0xbf')][_0x72a0('0xc4')](_0x227901['@odata.type'][_0x72a0('0xac')]('.')+0x1);if(_0x1fb03c==='StringAttributeMetadata'||_0x1fb03c===_0x72a0('0xc6')||_0x1fb03c==='BigIntAttributeMetadata'||_0x1fb03c===_0x72a0('0xc7')||_0x1fb03c==='MemoAttributeMetadata'||_0x1fb03c===_0x72a0('0xc8')||_0x1fb03c===_0x72a0('0xc9')||_0x1fb03c===_0x72a0('0xca')||_0x1fb03c===_0x72a0('0xcb')||_0x1fb03c===_0x72a0('0xcc')){_0x1e7d8b[_0x72a0('0xc1')](getInputList(_0x361f8f,_0x130c90,_0x1fb03c,_0xbad206,_0x35fc2c['MetadataId'],_0x227901[_0x72a0('0xb7')],_0x546646));}}});return Promise['all'](_0x1e7d8b);})[_0x72a0('0x21')](function(_0xf9e86a){_0xed6c1b=_0xf9e86a[0x0];var _0x10c1e2=_0x134c7d[_0x72a0('0xa7')](_0x3d5edb)[_0x72a0('0xa7')](_0xed6c1b);var _0x2ded38={'count':_0x10c1e2['length'],'rows':_0x10c1e2};return _0x2ded38;})[_0x72a0('0x21')](respondWithResult(_0x1e36b0,null))[_0x72a0('0x2b')](function(_0x431223){var _0x2130db=_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0xcd')]?0x1f4:_0x431223[_0x72a0('0xce')]||0x1f4;logger[_0x72a0('0x26')](_0x431223[_0x72a0('0x39')]);delete _0x431223['name'];if(_0x2130db===0x191){_0x2130db=0x190;}_0x1e36b0[_0x72a0('0x2c')](_0x2130db)[_0x72a0('0x3b')](_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0xcd')]?{'message':_0x72a0('0xcf'),'statusCode':_0x431223[_0x72a0('0xce')]}:_0x431223);});};function getSelectList(_0xd630ef,_0x67aef2,_0x4be4ed,_0x5d1e58,_0x485f13,_0x48f253){var _0x528f71={'method':'GET','uri':_0xd630ef+_0x72a0('0xb8')+_0x5d1e58+')/Attributes('+_0x485f13+_0x72a0('0xd0')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x72a0('0xb9')+_0x48f253,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x528f71)[_0x72a0('0x21')](function(_0x22fea4){var _0x501e72=[];var _0x19c6c3=_0x22fea4['OptionSet'][_0x72a0('0xd1')];_0x19c6c3[_0x72a0('0xbe')](function(_0x5ed10f){_0x501e72[_0x72a0('0xc1')]({'name':_0x5ed10f['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':String(_0x5ed10f[_0x72a0('0xd4')])});});var _0x3b0c66={'id':_0x67aef2+'_'+_0x22fea4['LogicalName'],'name':_0x22fea4[_0x72a0('0xd5')]['UserLocalizedLabel'][_0x72a0('0xd3')],'custom':![],'options':_0x501e72};_0x4be4ed[_0x72a0('0xc1')](_0x3b0c66);return _0x4be4ed;});}function getBooleanList(_0x3ec3dd,_0x4389a6,_0x47012a,_0x2e7e17,_0x495e78,_0x38fb73){var _0x308f02={'method':'GET','uri':_0x3ec3dd+_0x72a0('0xb8')+_0x2e7e17+_0x72a0('0xd6')+_0x495e78+_0x72a0('0xd7'),'headers':{'Authorization':_0x72a0('0xb9')+_0x38fb73,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x308f02)[_0x72a0('0x21')](function(_0x23d348){var _0x1a78c2=[];_0x1a78c2[_0x72a0('0xc1')]({'name':_0x23d348[_0x72a0('0xd8')][_0x72a0('0xd9')]['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':_0x72a0('0xda')},{'name':_0x23d348[_0x72a0('0xd8')][_0x72a0('0xdb')]['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':'false'});var _0x19013b={'id':_0x4389a6+'_'+_0x23d348[_0x72a0('0xbd')],'name':_0x23d348[_0x72a0('0xd5')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1a78c2};_0x47012a[_0x72a0('0xc1')](_0x19013b);return _0x47012a;});}function getInputList(_0x4592d1,_0x2c6a75,_0x5877f9,_0x4cd5b3,_0x1beace,_0x49b82a,_0x42b58d){var _0x1c0d20={'method':_0x72a0('0xb4'),'uri':_0x4592d1+_0x72a0('0xb8')+_0x1beace+_0x72a0('0xd6')+_0x49b82a+_0x72a0('0xdc')+_0x5877f9+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x72a0('0xb9')+_0x42b58d,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x1c0d20)[_0x72a0('0x21')](function(_0x4533a2){var _0x343c6a={'id':_0x2c6a75+'_'+_0x4533a2[_0x72a0('0xbd')],'name':_0x4533a2[_0x72a0('0xd5')][_0x72a0('0xd2')]?_0x4533a2[_0x72a0('0xd5')]['UserLocalizedLabel'][_0x72a0('0xd3')]:_0x4533a2[_0x72a0('0xbd')],'custom':![],'options':[]};_0x4cd5b3[_0x72a0('0xc1')](_0x343c6a);return _0x4cd5b3;});} \ No newline at end of file +var _0xafc4=['contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','ticketnumber','traversedpath','versionnumber','concat','username','remoteUri','tenantId','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','password','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','GET','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','map','type','options','where','Dynamics365Account','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits'];(function(_0x1bfadd,_0x316162){var _0x24ca92=function(_0x2bad3e){while(--_0x2bad3e){_0x1bfadd['push'](_0x1bfadd['shift']());}};_0x24ca92(++_0x316162);}(_0xafc4,0x69));var _0x4afc=function(_0x4d6daf,_0xfa4335){_0x4d6daf=_0x4d6daf-0x0;var _0xe65459=_0xafc4[_0x4d6daf];return _0xe65459;};'use strict';var pdf=require(_0x4afc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4afc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afc('0x2'));var rp=require(_0x4afc('0x3'));var moment=require(_0x4afc('0x4'));var BPromise=require(_0x4afc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4afc('0x6'));var csv=require(_0x4afc('0x7'));var ejs=require(_0x4afc('0x8'));var fs=require('fs');var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x7'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];var integrations=require(_0x4afc('0x16'));var jayson=require(_0x4afc('0x17'));var client=jayson[_0x4afc('0x18')][_0x4afc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1ad8fd,_0x23b03e,_0x5effb4,_0x26f3f1){return new BPromise(function(_0x429fd8,_0x2c636b){var _0x1e2c31=_0x26f3f1||client;return _0x1e2c31['request'](_0x1ad8fd,_0x5effb4)['then'](function(_0x2452ae){logger['info'](_0x4afc('0x1a'),_0x23b03e,_0x4afc('0x1b'));logger[_0x4afc('0x1c')](_0x4afc('0x1d'),_0x23b03e,_0x4afc('0x1b'),JSON[_0x4afc('0x1e')](_0x2452ae));if(_0x2452ae[_0x4afc('0x1f')]){if(_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x20')]===0x1f4){logger[_0x4afc('0x1f')](_0x4afc('0x1a'),_0x23b03e,_0x2452ae['error'][_0x4afc('0x21')]);return _0x2c636b(_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x21')]);}logger[_0x4afc('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x23b03e,_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x21')]);return _0x429fd8(_0x2452ae[_0x4afc('0x1f')][_0x4afc('0x21')]);}else{logger[_0x4afc('0x22')](_0x4afc('0x1a'),_0x23b03e,_0x4afc('0x1b'));_0x429fd8(_0x2452ae['result'][_0x4afc('0x21')]);}})[_0x4afc('0x23')](function(_0x57f37c){logger[_0x4afc('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x23b03e,_0x57f37c);_0x2c636b(_0x57f37c);});});}function respondWithStatusCode(_0x1aa676,_0x2a0314){_0x2a0314=_0x2a0314||0xcc;return function(_0x1e454e){if(_0x1e454e){return _0x1aa676[_0x4afc('0x24')](_0x2a0314);}return _0x1aa676[_0x4afc('0x25')](_0x2a0314)[_0x4afc('0x26')]();};}function respondWithResult(_0x40a0db,_0x383a71){_0x383a71=_0x383a71||0xc8;return function(_0x2bb837){if(_0x2bb837){return _0x40a0db[_0x4afc('0x25')](_0x383a71)[_0x4afc('0x27')](_0x2bb837);}};}function respondWithFilteredResult(_0x359c07,_0x35f5b3){return function(_0x55842c){if(_0x55842c){var _0xc3952e=_0x55842c['count'],_0x244f6c=_0x35f5b3['offset'],_0x2d6112=_0x35f5b3[_0x4afc('0x28')]+_0x35f5b3[_0x4afc('0x29')],_0x4e254d;if(_0x2d6112>=_0xc3952e){_0x2d6112=_0xc3952e;_0x4e254d=0xc8;}else{_0x4e254d=0xce;}_0x359c07['status'](_0x4e254d);return _0x359c07[_0x4afc('0x2a')](_0x4afc('0x2b'),_0x244f6c+'-'+_0x2d6112+'/'+_0xc3952e)['json'](_0x55842c);}return null;};}function patchUpdates(_0x514278){return function(_0x52e3dd){try{jsonpatch[_0x4afc('0x2c')](_0x52e3dd,_0x514278,!![]);}catch(_0x34434a){return BPromise[_0x4afc('0x2d')](_0x34434a);}return _0x52e3dd[_0x4afc('0x2e')]();};}function saveUpdates(_0xc1d91,_0x28cd3e){return function(_0x566389){if(_0x566389){return _0x566389[_0x4afc('0x2f')](_0xc1d91)[_0x4afc('0x30')](function(_0x1ba6b5){return _0x1ba6b5;});}return null;};}function removeEntity(_0x2f178c,_0x2b115d){return function(_0xf95893){if(_0xf95893){return _0xf95893[_0x4afc('0x31')]()[_0x4afc('0x30')](function(){_0x2f178c['status'](0xcc)[_0x4afc('0x26')]();});}};}function handleEntityNotFound(_0x51660d,_0x539b61){return function(_0x324a12){if(!_0x324a12){_0x51660d[_0x4afc('0x24')](0x194);}return _0x324a12;};}function handleError(_0x266f7f,_0x3d4ab5){_0x3d4ab5=_0x3d4ab5||0x1f4;return function(_0x3ec6fa){logger[_0x4afc('0x1f')](_0x3ec6fa['stack']);if(_0x3ec6fa[_0x4afc('0x32')]){delete _0x3ec6fa[_0x4afc('0x32')];}_0x266f7f[_0x4afc('0x25')](_0x3d4ab5)[_0x4afc('0x33')](_0x3ec6fa);};}exports[_0x4afc('0x34')]=function(_0x2f9d1c,_0x48f0c6){var _0x22eea2={},_0x2ddce1={},_0x91565d={'count':0x0,'rows':[]};var _0x283bc2=_['map'](db['Dynamics365Account'][_0x4afc('0x35')],function(_0x22bd75){return{'name':_0x22bd75[_0x4afc('0x36')],'type':_0x22bd75['type']['key']};});_0x2ddce1[_0x4afc('0x37')]=_['map'](_0x283bc2,'name');_0x2ddce1[_0x4afc('0x38')]=_[_0x4afc('0x39')](_0x2f9d1c[_0x4afc('0x38')]);_0x2ddce1[_0x4afc('0x3a')]=_[_0x4afc('0x3b')](_0x2ddce1[_0x4afc('0x37')],_0x2ddce1[_0x4afc('0x38')]);_0x22eea2[_0x4afc('0x3c')]=_[_0x4afc('0x3b')](_0x2ddce1[_0x4afc('0x37')],qs[_0x4afc('0x3d')](_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x3d')]));_0x22eea2[_0x4afc('0x3c')]=_0x22eea2[_0x4afc('0x3c')]['length']?_0x22eea2[_0x4afc('0x3c')]:_0x2ddce1[_0x4afc('0x37')];if(!_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x3e')](_0x4afc('0x3f'))){_0x22eea2[_0x4afc('0x29')]=qs[_0x4afc('0x29')](_0x2f9d1c['query']['limit']);_0x22eea2['offset']=qs[_0x4afc('0x28')](_0x2f9d1c[_0x4afc('0x38')]['offset']);}_0x22eea2[_0x4afc('0x40')]=qs[_0x4afc('0x41')](_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x41')]);_0x22eea2['where']=qs[_0x4afc('0x3a')](_[_0x4afc('0x42')](_0x2f9d1c[_0x4afc('0x38')],_0x2ddce1[_0x4afc('0x3a')]),_0x283bc2);if(_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x43')]){_0x22eea2['where']=_[_0x4afc('0x44')](_0x22eea2['where'],{'$or':_[_0x4afc('0x45')](_0x283bc2,function(_0x33117f){if(_0x33117f[_0x4afc('0x46')]!=='VIRTUAL'){var _0x57acad={};_0x57acad[_0x33117f[_0x4afc('0x32')]]={'$like':'%'+_0x2f9d1c[_0x4afc('0x38')][_0x4afc('0x43')]+'%'};return _0x57acad;}})});}_0x22eea2=_[_0x4afc('0x44')]({},_0x22eea2,_0x2f9d1c[_0x4afc('0x47')]);var _0x3970ba={'where':_0x22eea2[_0x4afc('0x48')]};return db[_0x4afc('0x49')]['count'](_0x3970ba)[_0x4afc('0x30')](function(_0xb1e91e){_0x91565d['count']=_0xb1e91e;if(_0x2f9d1c[_0x4afc('0x38')]['includeAll']){_0x22eea2[_0x4afc('0x4a')]=[{'all':!![]}];}return db[_0x4afc('0x49')][_0x4afc('0x4b')](_0x22eea2);})['then'](function(_0xd0f517){_0x91565d[_0x4afc('0x4c')]=_0xd0f517;return _0x91565d;})[_0x4afc('0x30')](respondWithFilteredResult(_0x48f0c6,_0x22eea2))[_0x4afc('0x23')](handleError(_0x48f0c6,null));};exports[_0x4afc('0x4d')]=function(_0x19a0ac,_0x5d9d90){var _0x4e470d={'raw':![],'where':{'id':_0x19a0ac[_0x4afc('0x4e')]['id']}},_0x4f4e46={};_0x4f4e46[_0x4afc('0x37')]=_[_0x4afc('0x39')](db[_0x4afc('0x49')][_0x4afc('0x35')]);_0x4f4e46[_0x4afc('0x38')]=_[_0x4afc('0x39')](_0x19a0ac[_0x4afc('0x38')]);_0x4f4e46[_0x4afc('0x3a')]=_[_0x4afc('0x3b')](_0x4f4e46['model'],_0x4f4e46[_0x4afc('0x38')]);_0x4e470d['attributes']=_['intersection'](_0x4f4e46[_0x4afc('0x37')],qs['fields'](_0x19a0ac[_0x4afc('0x38')][_0x4afc('0x3d')]));_0x4e470d[_0x4afc('0x3c')]=_0x4e470d[_0x4afc('0x3c')]['length']?_0x4e470d[_0x4afc('0x3c')]:_0x4f4e46['model'];if(_0x19a0ac[_0x4afc('0x38')][_0x4afc('0x4f')]){_0x4e470d[_0x4afc('0x4a')]=[{'all':!![]}];}_0x4e470d=_[_0x4afc('0x44')]({},_0x4e470d,_0x19a0ac[_0x4afc('0x47')]);return db[_0x4afc('0x49')][_0x4afc('0x50')](_0x4e470d)[_0x4afc('0x30')](handleEntityNotFound(_0x5d9d90,null))[_0x4afc('0x30')](respondWithResult(_0x5d9d90,null))[_0x4afc('0x23')](handleError(_0x5d9d90,null));};exports[_0x4afc('0x51')]=function(_0x3915d5,_0x507bfc){return db[_0x4afc('0x49')][_0x4afc('0x51')](_0x3915d5[_0x4afc('0x52')],{})[_0x4afc('0x30')](respondWithResult(_0x507bfc,0xc9))[_0x4afc('0x23')](handleError(_0x507bfc,null));};exports[_0x4afc('0x2f')]=function(_0x2fd538,_0x10c254){if(_0x2fd538[_0x4afc('0x52')]['id']){delete _0x2fd538[_0x4afc('0x52')]['id'];}return db[_0x4afc('0x49')][_0x4afc('0x50')]({'where':{'id':_0x2fd538[_0x4afc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10c254,null))[_0x4afc('0x30')](saveUpdates(_0x2fd538['body'],null))[_0x4afc('0x30')](respondWithResult(_0x10c254,null))[_0x4afc('0x23')](handleError(_0x10c254,null));};exports[_0x4afc('0x31')]=function(_0x2d9f3d,_0x518d6f){return db['Dynamics365Account'][_0x4afc('0x50')]({'where':{'id':_0x2d9f3d[_0x4afc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x518d6f,null))[_0x4afc('0x30')](removeEntity(_0x518d6f,null))[_0x4afc('0x23')](handleError(_0x518d6f,null));};exports[_0x4afc('0x53')]=function(_0x2ac06a,_0x329550,_0x13e825){var _0x154797={};var _0x13891d={};var _0x24e1d3;var _0x3369a8;return db[_0x4afc('0x49')][_0x4afc('0x54')]({'where':{'id':_0x2ac06a[_0x4afc('0x4e')]['id']}})[_0x4afc('0x30')](handleEntityNotFound(_0x329550,null))['then'](function(_0x42c65e){if(_0x42c65e){_0x24e1d3=_0x42c65e;_0x13891d[_0x4afc('0x37')]=_[_0x4afc('0x39')](db[_0x4afc('0x55')][_0x4afc('0x35')]);_0x13891d[_0x4afc('0x38')]=_[_0x4afc('0x39')](_0x2ac06a['query']);_0x13891d[_0x4afc('0x3a')]=_[_0x4afc('0x3b')](_0x13891d['model'],_0x13891d['query']);_0x154797[_0x4afc('0x3c')]=_[_0x4afc('0x3b')](_0x13891d[_0x4afc('0x37')],qs[_0x4afc('0x3d')](_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x3d')]));_0x154797[_0x4afc('0x3c')]=_0x154797[_0x4afc('0x3c')][_0x4afc('0x56')]?_0x154797[_0x4afc('0x3c')]:_0x13891d['model'];_0x154797['order']=qs[_0x4afc('0x41')](_0x2ac06a[_0x4afc('0x38')]['sort']);_0x154797[_0x4afc('0x48')]=qs[_0x4afc('0x3a')](_['pick'](_0x2ac06a['query'],_0x13891d[_0x4afc('0x3a')]));if(_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x43')]){_0x154797['where']=_[_0x4afc('0x44')](_0x154797['where'],{'$or':_['map'](_0x154797[_0x4afc('0x3c')],function(_0x37b5aa){var _0x53f9ca={};_0x53f9ca[_0x37b5aa]={'$like':'%'+_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x43')]+'%'};return _0x53f9ca;})});}_0x154797=_[_0x4afc('0x44')]({},_0x154797,_0x2ac06a[_0x4afc('0x47')]);return _0x24e1d3[_0x4afc('0x53')](_0x154797);}})[_0x4afc('0x30')](function(_0x4a616e){if(_0x4a616e){_0x3369a8=_0x4a616e[_0x4afc('0x56')];if(!_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x3e')]('nolimit')){_0x154797['limit']=qs['limit'](_0x2ac06a[_0x4afc('0x38')][_0x4afc('0x29')]);_0x154797[_0x4afc('0x28')]=qs['offset'](_0x2ac06a[_0x4afc('0x38')]['offset']);}return _0x24e1d3['getConfigurations'](_0x154797);}})['then'](function(_0x299849){if(_0x299849){return _0x299849?{'count':_0x3369a8,'rows':_0x299849}:null;}})[_0x4afc('0x30')](respondWithResult(_0x329550,null))[_0x4afc('0x23')](handleError(_0x329550,null));};exports['addConfiguration']=function(_0x1e56b7,_0x45cfea,_0x18ab12){if(_0x1e56b7['body']['id']){delete _0x1e56b7[_0x4afc('0x52')]['id'];}return db[_0x4afc('0x49')][_0x4afc('0x54')]({'where':{'id':_0x1e56b7[_0x4afc('0x4e')]['id']}})[_0x4afc('0x30')](handleEntityNotFound(_0x45cfea,null))['then'](function(_0x549e31){if(_0x549e31){_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x57')]=_0x549e31['id'];_0x1e56b7[_0x4afc('0x52')]['Subjects']=integrations[_0x4afc('0x58')](_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x59')],_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x46')]);_0x1e56b7['body'][_0x4afc('0x5a')]=integrations[_0x4afc('0x5b')](_0x1e56b7['body'][_0x4afc('0x59')],_0x1e56b7[_0x4afc('0x52')][_0x4afc('0x46')]);return db['Dynamics365Configuration'][_0x4afc('0x51')](_0x1e56b7[_0x4afc('0x52')],{'include':[{'model':db[_0x4afc('0x5c')],'as':_0x4afc('0x5d')},{'model':db[_0x4afc('0x5c')],'as':_0x4afc('0x5a')}]});}return null;})[_0x4afc('0x30')](respondWithResult(_0x45cfea,null))[_0x4afc('0x23')](handleError(_0x45cfea,null));};exports['getFields']=function(_0x457b2c,_0x5e3290,_0x5a0a78){var _0x2e0f15=_0x457b2c[_0x4afc('0x38')][_0x4afc('0x5e')];var _0x5908f0=_0x2e0f15==='incident'?_0x4afc('0x5f'):_0x4afc('0x60');var _0xa3f8b7='';var _0xb34abf='';var _0x15fb26='';var _0x264f65='';var _0x4701ca='';var _0x198ec9='';var _0x5fd3e1='';var _0x396cb5='';var _0x3e846f=[_0x4afc('0x61'),_0x4afc('0x62'),_0x4afc('0x63'),_0x4afc('0x64'),_0x4afc('0x65'),'subject',_0x4afc('0x66'),_0x4afc('0x67'),_0x4afc('0x68'),_0x4afc('0x69')];var _0x19c06a=[_0x4afc('0x6a'),_0x4afc('0x6b'),_0x4afc('0x6c'),_0x4afc('0x6d'),'contactidname',_0x4afc('0x6e'),_0x4afc('0x6f'),_0x4afc('0x70'),_0x4afc('0x71'),'createdbyexternalpartyyominame',_0x4afc('0x72'),_0x4afc('0x73'),_0x4afc('0x74'),_0x4afc('0x75'),_0x4afc('0x76'),_0x4afc('0x77'),_0x4afc('0x78'),_0x4afc('0x79'),_0x4afc('0x7a'),_0x4afc('0x7b'),'entityimage_timestamp',_0x4afc('0x7c'),_0x4afc('0x7d'),'exchangerate',_0x4afc('0x7e'),_0x4afc('0x7f'),_0x4afc('0x80'),'influencescore',_0x4afc('0x81'),_0x4afc('0x82'),_0x4afc('0x83'),_0x4afc('0x84'),'modifiedbyexternalpartyyominame',_0x4afc('0x85'),_0x4afc('0x86'),'modifiedon',_0x4afc('0x87'),_0x4afc('0x88'),_0x4afc('0x89'),'msdyn_iotalertname','numberofchildincidents',_0x4afc('0x8a'),_0x4afc('0x8b'),_0x4afc('0x8c'),_0x4afc('0x8d'),_0x4afc('0x8e'),_0x4afc('0x8f'),_0x4afc('0x90'),_0x4afc('0x91'),_0x4afc('0x92'),_0x4afc('0x93'),_0x4afc('0x94'),_0x4afc('0x95'),_0x4afc('0x96'),_0x4afc('0x97'),_0x4afc('0x98'),_0x4afc('0x99'),'sentimentvalue',_0x4afc('0x9a'),_0x4afc('0x9b'),'socialprofileidname',_0x4afc('0x9c'),'statuscode','subjectidname',_0x4afc('0x9d'),'timezoneruleversionnumber','transactioncurrencyidname',_0x4afc('0x9e'),'utcconversiontimezonecode',_0x4afc('0x9f')];var _0x492301=_0x3e846f[_0x4afc('0xa0')](_0x19c06a);return db[_0x4afc('0x49')][_0x4afc('0x54')]({'where':{'id':_0x457b2c[_0x4afc('0x4e')]['id']},'attributes':['id',_0x4afc('0xa1'),'password',_0x4afc('0xa2'),_0x4afc('0xa3'),'clientId','clientSecret']})[_0x4afc('0x30')](handleEntityNotFound(_0x5e3290,null))[_0x4afc('0x30')](function(_0x373e9c){if(_0x373e9c){_0x396cb5=_0x373e9c[_0x4afc('0xa2')];var _0x4596ed=_0x396cb5['slice'](-0x1);if(_0x4596ed==='/'){_0x396cb5=_0x396cb5[_0x4afc('0xa4')](0x0,_0x396cb5[_0x4afc('0xa5')](_0x4596ed));}_0x5fd3e1=util[_0x4afc('0xa6')](_0x4afc('0xa7'),_0x396cb5);var _0x58fe0d={'method':_0x4afc('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x373e9c[_0x4afc('0xa3')]+_0x4afc('0xa9'),'form':{'client_id':_0x373e9c[_0x4afc('0xaa')],'resource':_0x396cb5,'username':_0x373e9c[_0x4afc('0xa1')],'password':_0x373e9c[_0x4afc('0xab')],'grant_type':_0x4afc('0xab'),'client_secret':_0x373e9c[_0x4afc('0xac')]},'json':!![]};return rp(_0x58fe0d);}})[_0x4afc('0x30')](function(_0x34473d){_0x198ec9=_0x34473d[_0x4afc('0xad')];var _0x27dd60={'method':'GET','uri':encodeURI(_0x5fd3e1+_0x4afc('0xae')+_0x5908f0+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x198ec9,'If-None-Match':null,'OData-Version':_0x4afc('0xaf')},'json':!![]};return rp(_0x27dd60);})['then'](function(_0x50198d){var _0x681c5e=_0x50198d['value'][0x0];var _0x512f92=_0x681c5e[_0x4afc('0xb0')];var _0x489c9d={'method':_0x4afc('0xb1'),'uri':_0x5fd3e1+_0x4afc('0xb2')+_0x512f92+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x4afc('0xb3')+_0x198ec9,'If-None-Match':null,'OData-Version':_0x4afc('0xaf')},'json':!![]};return rp(_0x489c9d);})['then'](function(_0x3a9836){_0xa3f8b7=_0x3a9836;_0xb34abf=_0xa3f8b7[_0x4afc('0xb4')];_0xb34abf=_[_0x4afc('0xb5')](_0xb34abf,function(_0x4c900a){return!_0x492301[_0x4afc('0xb6')](_0x4c900a[_0x4afc('0xb7')]);});var _0x40c7c8=[];var _0x16eb6d=[];_0xb34abf[_0x4afc('0xb8')](function(_0xbdeb7d){if(_0xbdeb7d['@odata.type']){var _0x4daf24=_0xbdeb7d[_0x4afc('0xb9')][_0x4afc('0xa4')](_0xbdeb7d['@odata.type'][_0x4afc('0xa5')]('.')+0x1);if(_0x4daf24===_0x4afc('0xba')){_0x40c7c8['push'](getSelectList(_0x5fd3e1,_0x2e0f15,_0x16eb6d,_0xa3f8b7[_0x4afc('0xb0')],_0xbdeb7d[_0x4afc('0xb0')],_0x198ec9));}}});return Promise[_0x4afc('0xbb')](_0x40c7c8);})[_0x4afc('0x30')](function(_0x2585b3){_0x15fb26=_0x2585b3[0x0];var _0x4b1bbc=[];var _0x413579=[];_0xb34abf[_0x4afc('0xb8')](function(_0x213a30){if(!_[_0x4afc('0xbc')](_0x213a30[_0x4afc('0xb9')])){var _0x492dac=_0x213a30[_0x4afc('0xb9')][_0x4afc('0xa4')](_0x213a30[_0x4afc('0xb9')]['lastIndexOf']('.')+0x1);if(_0x492dac===_0x4afc('0xbd')){_0x4b1bbc[_0x4afc('0xbe')](getBooleanList(_0x5fd3e1,_0x2e0f15,_0x413579,_0xa3f8b7['MetadataId'],_0x213a30['MetadataId'],_0x198ec9));}}});return Promise['all'](_0x4b1bbc);})[_0x4afc('0x30')](function(_0xbd4a65){_0x264f65=_0xbd4a65[0x0];var _0x4c81c1=[];var _0x271311=[];_0xb34abf[_0x4afc('0xb8')](function(_0x53b3df){if(_0x53b3df[_0x4afc('0xb9')]){var _0x37a056=_0x53b3df[_0x4afc('0xb9')][_0x4afc('0xa4')](_0x53b3df[_0x4afc('0xb9')][_0x4afc('0xa5')]('.')+0x1);if(_0x37a056===_0x4afc('0xbf')||_0x37a056===_0x4afc('0xc0')||_0x37a056===_0x4afc('0xc1')||_0x37a056==='IntegerAttributeMetadata'||_0x37a056===_0x4afc('0xc2')||_0x37a056===_0x4afc('0xc3')||_0x37a056===_0x4afc('0xc4')||_0x37a056===_0x4afc('0xc5')||_0x37a056==='StateAttributeMetadata'||_0x37a056===_0x4afc('0xc6')){_0x4c81c1[_0x4afc('0xbe')](getInputList(_0x5fd3e1,_0x2e0f15,_0x37a056,_0x271311,_0xa3f8b7['MetadataId'],_0x53b3df['MetadataId'],_0x198ec9));}}});return Promise['all'](_0x4c81c1);})[_0x4afc('0x30')](function(_0x3a6d98){_0x4701ca=_0x3a6d98[0x0];var _0x429040=_0x15fb26['concat'](_0x264f65)[_0x4afc('0xa0')](_0x4701ca);var _0x1015f3={'count':_0x429040[_0x4afc('0x56')],'rows':_0x429040};return _0x1015f3;})['then'](respondWithResult(_0x5e3290,null))[_0x4afc('0x23')](function(_0x54c4e2){var _0x58dbd0=_0x457b2c[_0x4afc('0x38')][_0x4afc('0xc7')]?0x1f4:_0x54c4e2[_0x4afc('0xc8')]||0x1f4;logger['error'](_0x54c4e2[_0x4afc('0xc9')]);delete _0x54c4e2[_0x4afc('0x32')];if(_0x58dbd0===0x191){_0x58dbd0=0x190;}_0x5e3290[_0x4afc('0x25')](_0x58dbd0)[_0x4afc('0x33')](_0x457b2c[_0x4afc('0x38')][_0x4afc('0xc7')]?{'message':_0x4afc('0xca'),'statusCode':_0x54c4e2[_0x4afc('0xc8')]}:_0x54c4e2);});};function getSelectList(_0x44a404,_0x4b4267,_0x497f33,_0x35aac1,_0x13f446,_0x9748d5){var _0x2b3bbb={'method':'GET','uri':_0x44a404+_0x4afc('0xb2')+_0x35aac1+')/Attributes('+_0x13f446+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x4afc('0xb3')+_0x9748d5,'If-None-Match':null,'OData-Version':_0x4afc('0xaf')},'json':!![]};return rp(_0x2b3bbb)[_0x4afc('0x30')](function(_0x3e26e9){var _0x3e523b=[];var _0x20eb80=_0x3e26e9[_0x4afc('0xcb')][_0x4afc('0xcc')];_0x20eb80[_0x4afc('0xb8')](function(_0x2d4960){_0x3e523b[_0x4afc('0xbe')]({'name':_0x2d4960[_0x4afc('0xcd')][_0x4afc('0xce')]['Label'],'value':String(_0x2d4960[_0x4afc('0xcf')])});});var _0x2a0a47={'id':_0x4b4267+'_'+_0x3e26e9[_0x4afc('0xb7')],'name':_0x3e26e9[_0x4afc('0xd0')]['UserLocalizedLabel'][_0x4afc('0xcd')],'custom':![],'options':_0x3e523b};_0x497f33[_0x4afc('0xbe')](_0x2a0a47);return _0x497f33;});}function getBooleanList(_0x503621,_0x3cab80,_0x287099,_0x44b48a,_0x46f5c1,_0x504eae){var _0x42f066={'method':_0x4afc('0xb1'),'uri':_0x503621+_0x4afc('0xb2')+_0x44b48a+')/Attributes('+_0x46f5c1+_0x4afc('0xd1'),'headers':{'Authorization':_0x4afc('0xb3')+_0x504eae,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x42f066)[_0x4afc('0x30')](function(_0x5bff57){var _0x626769=[];_0x626769[_0x4afc('0xbe')]({'name':_0x5bff57[_0x4afc('0xcb')][_0x4afc('0xd2')][_0x4afc('0xcd')][_0x4afc('0xce')][_0x4afc('0xcd')],'value':_0x4afc('0xd3')},{'name':_0x5bff57['OptionSet']['FalseOption'][_0x4afc('0xcd')][_0x4afc('0xce')][_0x4afc('0xcd')],'value':'false'});var _0xd283a7={'id':_0x3cab80+'_'+_0x5bff57[_0x4afc('0xb7')],'name':_0x5bff57['DisplayName'][_0x4afc('0xce')][_0x4afc('0xcd')],'custom':![],'options':_0x626769};_0x287099[_0x4afc('0xbe')](_0xd283a7);return _0x287099;});}function getInputList(_0x5ca9fe,_0x150da,_0x43a30c,_0x24dbd2,_0x53d197,_0x10f93a,_0x3a5ddc){var _0x2e09f7={'method':_0x4afc('0xb1'),'uri':_0x5ca9fe+_0x4afc('0xb2')+_0x53d197+_0x4afc('0xd4')+_0x10f93a+_0x4afc('0xd5')+_0x43a30c+_0x4afc('0xd6'),'headers':{'Authorization':_0x4afc('0xb3')+_0x3a5ddc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e09f7)[_0x4afc('0x30')](function(_0x3af1ce){var _0x33638a={'id':_0x150da+'_'+_0x3af1ce['LogicalName'],'name':_0x3af1ce['DisplayName'][_0x4afc('0xce')]?_0x3af1ce[_0x4afc('0xd0')][_0x4afc('0xce')][_0x4afc('0xcd')]:_0x3af1ce[_0x4afc('0xb7')],'custom':![],'options':[]};_0x24dbd2[_0x4afc('0xbe')](_0x33638a);return _0x24dbd2;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 0ab1f3a..6d9dafe 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 _0x5c44=['int_dynamics365_accounts','util','../../config/logger','api','moment','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x4361b6,_0x414635){var _0x4c6878=function(_0x54cfb6){while(--_0x54cfb6){_0x4361b6['push'](_0x4361b6['shift']());}};_0x4c6878(++_0x414635);}(_0x5c44,0x181));var _0x45c4=function(_0x278e78,_0x5a8b2d){_0x278e78=_0x278e78-0x0;var _0x4c1ed2=_0x5c44[_0x278e78];return _0x4c1ed2;};'use strict';var _=require('lodash');var util=require(_0x45c4('0x0'));var logger=require(_0x45c4('0x1'))(_0x45c4('0x2'));var moment=require(_0x45c4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x45c4('0x4'));var attributes=require(_0x45c4('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x36e917,_0xf42c93){return _0x36e917[_0x45c4('0x6')]('Dynamics365Account',attributes,{'tableName':_0x45c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3ae=['../../components/integrations/configuration','define','int_dynamics365_accounts','util','../../config/logger','moment','bluebird','path','rimraf','./intDynamics365Account.attributes'];(function(_0xdfcfd,_0x40fcb0){var _0x395eaa=function(_0x451c69){while(--_0x451c69){_0xdfcfd['push'](_0xdfcfd['shift']());}};_0x395eaa(++_0x40fcb0);}(_0xa3ae,0x125));var _0xea3a=function(_0x40798d,_0x3d4bbb){_0x40798d=_0x40798d-0x0;var _0x6a942=_0xa3ae[_0x40798d];return _0x6a942;};'use strict';var _=require('lodash');var util=require(_0xea3a('0x0'));var logger=require(_0xea3a('0x1'))('api');var moment=require(_0xea3a('0x2'));var BPromise=require(_0xea3a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea3a('0x4'));var rimraf=require(_0xea3a('0x5'));var config=require('../../config/environment');var attributes=require(_0xea3a('0x6'));var integrations=require(_0xea3a('0x7'));module['exports']=function(_0x56eaf3,_0xa40fc){return _0x56eaf3[_0xea3a('0x8')]('Dynamics365Account',attributes,{'tableName':_0xea3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 464a595..d6fc1d2 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 _0x4a03=['message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','find','ShowDynamics365Account','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4a03,0x16e));var _0x34a0=function(_0x4b9f7d,_0x33fe55){_0x4b9f7d=_0x4b9f7d-0x0;var _0x2ec5e7=_0x4a03[_0x4b9f7d];return _0x2ec5e7;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x491fe8,_0x44d6be,_0x2cf483){return new BPromise(function(_0x592827,_0xb182cc){return client[_0x34a0('0xa')](_0x491fe8,_0x2cf483)[_0x34a0('0xb')](function(_0x176571){logger[_0x34a0('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x44d6be,_0x34a0('0xd'));logger[_0x34a0('0xe')](_0x34a0('0xf'),_0x44d6be,_0x34a0('0xd'),JSON[_0x34a0('0x10')](_0x176571));if(_0x176571[_0x34a0('0x11')]){if(_0x176571[_0x34a0('0x11')][_0x34a0('0x12')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x44d6be,_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);return _0xb182cc(_0x176571['error'][_0x34a0('0x13')]);}logger[_0x34a0('0x11')](_0x34a0('0x14'),_0x44d6be,_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);return _0x592827(_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);}else{logger[_0x34a0('0xc')](_0x34a0('0x14'),_0x44d6be,_0x34a0('0xd'));_0x592827(_0x176571[_0x34a0('0x15')][_0x34a0('0x13')]);}})[_0x34a0('0x16')](function(_0x4134f0){logger[_0x34a0('0x11')](_0x34a0('0x14'),_0x44d6be,_0x4134f0);_0xb182cc(_0x4134f0);});});}exports[_0x34a0('0x17')]=function(_0x224cca){var _0xe380c8=this;return new Promise(function(_0x2c5325,_0x4fab3a){return db[_0x34a0('0x18')][_0x34a0('0x19')]({'raw':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1b')]===undefined?!![]:![]:!![],'where':_0x224cca[_0x34a0('0x1a')]?_0x224cca['options'][_0x34a0('0x1c')]||null:null,'attributes':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1d')]||null:null,'limit':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')]['limit']||null:null,'include':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1e')],function(_0x5354c7){return{'model':db[_0x5354c7[_0x34a0('0x20')]],'as':_0x5354c7['as'],'attributes':_0x5354c7[_0x34a0('0x1d')],'include':_0x5354c7['include']?_[_0x34a0('0x1f')](_0x5354c7[_0x34a0('0x1e')],function(_0x4fdbc3){return{'model':db[_0x4fdbc3[_0x34a0('0x20')]],'as':_0x4fdbc3['as'],'attributes':_0x4fdbc3[_0x34a0('0x1d')],'include':_0x4fdbc3[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x4fdbc3[_0x34a0('0x1e')],function(_0x5c49be){return{'model':db[_0x5c49be[_0x34a0('0x20')]],'as':_0x5c49be['as'],'attributes':_0x5c49be[_0x34a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x34a0('0xb')](function(_0x159b33){logger[_0x34a0('0xc')](_0x34a0('0x17'),_0x224cca);logger['debug']('GetDynamics365Account',_0x224cca,JSON[_0x34a0('0x10')](_0x159b33));_0x2c5325(_0x159b33);})['catch'](function(_0x333ecf){logger[_0x34a0('0x11')](_0x34a0('0x17'),_0x333ecf[_0x34a0('0x13')],_0x224cca);_0x4fab3a(_0xe380c8[_0x34a0('0x11')](0x1f4,_0x333ecf[_0x34a0('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x31bd8e){var _0x13ddbe=this;return new Promise(function(_0x6190d0,_0x134451){return db[_0x34a0('0x18')][_0x34a0('0x21')]({'raw':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1b')]===undefined?!![]:![]:!![],'where':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1c')]||null:null,'attributes':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')]['attributes']||null:null,'include':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1e')]?_['map'](_0x31bd8e[_0x34a0('0x1a')]['include'],function(_0x26d9b8){return{'model':db[_0x26d9b8[_0x34a0('0x20')]],'as':_0x26d9b8['as'],'attributes':_0x26d9b8[_0x34a0('0x1d')],'include':_0x26d9b8[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x26d9b8[_0x34a0('0x1e')],function(_0x4cb7fd){return{'model':db[_0x4cb7fd[_0x34a0('0x20')]],'as':_0x4cb7fd['as'],'attributes':_0x4cb7fd['attributes'],'include':_0x4cb7fd[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x4cb7fd[_0x34a0('0x1e')],function(_0x5ecab4){return{'model':db[_0x5ecab4[_0x34a0('0x20')]],'as':_0x5ecab4['as'],'attributes':_0x5ecab4[_0x34a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x34a0('0xb')](function(_0x1f629c){logger['info']('ShowDynamics365Account',_0x31bd8e);logger[_0x34a0('0xe')](_0x34a0('0x22'),_0x31bd8e,JSON['stringify'](_0x1f629c));_0x6190d0(_0x1f629c);})[_0x34a0('0x16')](function(_0x135192){logger['error']('ShowDynamics365Account',_0x135192['message'],_0x31bd8e);_0x134451(_0x13ddbe['error'](0x1f4,_0x135192[_0x34a0('0x13')]));});});}; \ No newline at end of file +var _0xb7ac=['info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x441847,_0x21da34){var _0x5b109c=function(_0x1ec126){while(--_0x1ec126){_0x441847['push'](_0x441847['shift']());}};_0x5b109c(++_0x21da34);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x106da7,_0x57ec80){_0x106da7=_0x106da7-0x0;var _0x3da9e3=_0xb7ac[_0x106da7];return _0x3da9e3;};'use strict';var _=require(_0xcb7a('0x0'));var util=require(_0xcb7a('0x1'));var moment=require(_0xcb7a('0x2'));var BPromise=require(_0xcb7a('0x3'));var rs=require(_0xcb7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb7a('0x6'))(_0xcb7a('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb7a('0x8'));var client=jayson[_0xcb7a('0x9')][_0xcb7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe4a9,_0x5c31b1,_0x2fb36a){return new BPromise(function(_0x170859,_0x555ea7){return client[_0xcb7a('0xb')](_0x4fe4a9,_0x2fb36a)[_0xcb7a('0xc')](function(_0x41ad34){logger[_0xcb7a('0xd')](_0xcb7a('0xe'),_0x5c31b1,_0xcb7a('0xf'));logger['debug'](_0xcb7a('0x10'),_0x5c31b1,_0xcb7a('0xf'),JSON[_0xcb7a('0x11')](_0x41ad34));if(_0x41ad34['error']){if(_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x13')]===0x1f4){logger['error'](_0xcb7a('0xe'),_0x5c31b1,_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x14')]);return _0x555ea7(_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x14')]);}logger[_0xcb7a('0x12')](_0xcb7a('0xe'),_0x5c31b1,_0x41ad34[_0xcb7a('0x12')][_0xcb7a('0x14')]);return _0x170859(_0x41ad34['error'][_0xcb7a('0x14')]);}else{logger['info'](_0xcb7a('0xe'),_0x5c31b1,_0xcb7a('0xf'));_0x170859(_0x41ad34[_0xcb7a('0x15')][_0xcb7a('0x14')]);}})['catch'](function(_0x2bb2e9){logger[_0xcb7a('0x12')](_0xcb7a('0xe'),_0x5c31b1,_0x2bb2e9);_0x555ea7(_0x2bb2e9);});});}exports[_0xcb7a('0x16')]=function(_0x118dde){var _0x28be52=this;return new Promise(function(_0x119bb2,_0x5a83b9){return db[_0xcb7a('0x17')][_0xcb7a('0x18')]({'raw':_0x118dde[_0xcb7a('0x19')]?_0x118dde[_0xcb7a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x118dde['options']?_0x118dde['options'][_0xcb7a('0x1a')]||null:null,'attributes':_0x118dde['options']?_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1b')]||null:null,'limit':_0x118dde[_0xcb7a('0x19')]?_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1c')]||null:null,'include':_0x118dde[_0xcb7a('0x19')]?_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x118dde[_0xcb7a('0x19')][_0xcb7a('0x1d')],function(_0x5a29a7){return{'model':db[_0x5a29a7['model']],'as':_0x5a29a7['as'],'attributes':_0x5a29a7['attributes'],'include':_0x5a29a7[_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x5a29a7[_0xcb7a('0x1d')],function(_0x28682a){return{'model':db[_0x28682a['model']],'as':_0x28682a['as'],'attributes':_0x28682a[_0xcb7a('0x1b')],'include':_0x28682a[_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x28682a[_0xcb7a('0x1d')],function(_0x558c42){return{'model':db[_0x558c42[_0xcb7a('0x1f')]],'as':_0x558c42['as'],'attributes':_0x558c42[_0xcb7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b7fc8){logger[_0xcb7a('0xd')](_0xcb7a('0x16'),_0x118dde);logger[_0xcb7a('0x20')](_0xcb7a('0x16'),_0x118dde,JSON['stringify'](_0x3b7fc8));_0x119bb2(_0x3b7fc8);})[_0xcb7a('0x21')](function(_0x59c56a){logger[_0xcb7a('0x12')]('GetDynamics365Account',_0x59c56a['message'],_0x118dde);_0x5a83b9(_0x28be52[_0xcb7a('0x12')](0x1f4,_0x59c56a[_0xcb7a('0x14')]));});});};exports[_0xcb7a('0x22')]=function(_0x1303d9){var _0x32b861=this;return new Promise(function(_0x55e6a4,_0x2ded00){return db[_0xcb7a('0x17')][_0xcb7a('0x23')]({'raw':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x24')]===undefined?!![]:![]:!![],'where':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x1a')]||null:null,'attributes':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x1b')]||null:null,'include':_0x1303d9[_0xcb7a('0x19')]?_0x1303d9['options'][_0xcb7a('0x1d')]?_['map'](_0x1303d9[_0xcb7a('0x19')][_0xcb7a('0x1d')],function(_0x1d3e24){return{'model':db[_0x1d3e24[_0xcb7a('0x1f')]],'as':_0x1d3e24['as'],'attributes':_0x1d3e24['attributes'],'include':_0x1d3e24[_0xcb7a('0x1d')]?_['map'](_0x1d3e24[_0xcb7a('0x1d')],function(_0x3c333f){return{'model':db[_0x3c333f[_0xcb7a('0x1f')]],'as':_0x3c333f['as'],'attributes':_0x3c333f['attributes'],'include':_0x3c333f[_0xcb7a('0x1d')]?_[_0xcb7a('0x1e')](_0x3c333f['include'],function(_0x2ede2f){return{'model':db[_0x2ede2f[_0xcb7a('0x1f')]],'as':_0x2ede2f['as'],'attributes':_0x2ede2f[_0xcb7a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcb7a('0xc')](function(_0x48bcf8){logger[_0xcb7a('0xd')](_0xcb7a('0x22'),_0x1303d9);logger[_0xcb7a('0x20')]('ShowDynamics365Account',_0x1303d9,JSON[_0xcb7a('0x11')](_0x48bcf8));_0x55e6a4(_0x48bcf8);})[_0xcb7a('0x21')](function(_0x4636d7){logger[_0xcb7a('0x12')](_0xcb7a('0x22'),_0x4636d7[_0xcb7a('0x14')],_0x1303d9);_0x2ded00(_0x32b861['error'](0x1f4,_0x4636d7[_0xcb7a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8b55e42..3490175 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 _0x3959=['create','/:id','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3959,0x67));var _0x9395=function(_0x17676d,_0x455155){_0x17676d=_0x17676d-0x0;var _0x29bd4a=_0x3959[_0x17676d];return _0x29bd4a;};'use strict';var multer=require('multer');var util=require(_0x9395('0x0'));var path=require(_0x9395('0x1'));var timeout=require(_0x9395('0x2'));var express=require(_0x9395('0x3'));var router=express['Router']();var auth=require(_0x9395('0x4'));var interaction=require(_0x9395('0x5'));var config=require(_0x9395('0x6'));var controller=require(_0x9395('0x7'));router[_0x9395('0x8')]('/',auth[_0x9395('0x9')](),controller['index']);router[_0x9395('0x8')]('/:id',auth[_0x9395('0x9')](),controller[_0x9395('0xa')]);router[_0x9395('0x8')](_0x9395('0xb'),auth[_0x9395('0x9')](),controller[_0x9395('0xc')]);router[_0x9395('0x8')](_0x9395('0xd'),auth[_0x9395('0x9')](),controller[_0x9395('0xe')]);router['get'](_0x9395('0xf'),auth[_0x9395('0x9')](),controller['getDescriptions']);router[_0x9395('0x10')]('/',auth[_0x9395('0x9')](),controller[_0x9395('0x11')]);router['put'](_0x9395('0x12'),auth[_0x9395('0x9')](),controller['update']);router[_0x9395('0x13')](_0x9395('0x12'),auth[_0x9395('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaa01=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa01,0x10d));var _0x1aa0=function(_0x44dfe5,_0x47dea7){_0x44dfe5=_0x44dfe5-0x0;var _0x49de7d=_0xaa01[_0x44dfe5];return _0x49de7d;};'use strict';var multer=require(_0x1aa0('0x0'));var util=require(_0x1aa0('0x1'));var path=require(_0x1aa0('0x2'));var timeout=require(_0x1aa0('0x3'));var express=require(_0x1aa0('0x4'));var router=express[_0x1aa0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1aa0('0x6'));var controller=require(_0x1aa0('0x7'));router[_0x1aa0('0x8')]('/',auth[_0x1aa0('0x9')](),controller[_0x1aa0('0xa')]);router[_0x1aa0('0x8')](_0x1aa0('0xb'),auth[_0x1aa0('0x9')](),controller[_0x1aa0('0xc')]);router[_0x1aa0('0x8')](_0x1aa0('0xd'),auth[_0x1aa0('0x9')](),controller['getFields']);router[_0x1aa0('0x8')](_0x1aa0('0xe'),auth['isAuthenticated'](),controller[_0x1aa0('0xf')]);router[_0x1aa0('0x8')](_0x1aa0('0x10'),auth[_0x1aa0('0x9')](),controller['getDescriptions']);router[_0x1aa0('0x11')]('/',auth['isAuthenticated'](),controller[_0x1aa0('0x12')]);router[_0x1aa0('0x13')](_0x1aa0('0xb'),auth[_0x1aa0('0x9')](),controller[_0x1aa0('0x14')]);router['delete']('/:id',auth[_0x1aa0('0x9')](),controller[_0x1aa0('0x15')]);module[_0x1aa0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 5be9d55..79e7935 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 _0x53b6=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0x5776b1,_0x67df5c){var _0x44d1a9=function(_0x361245){while(--_0x361245){_0x5776b1['push'](_0x5776b1['shift']());}};_0x44d1a9(++_0x67df5c);}(_0x53b6,0xca));var _0x653b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x53b6[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x653b('0x0'));module[_0x653b('0x1')]={'name':{'type':Sequelize[_0x653b('0x2')]},'description':{'type':Sequelize[_0x653b('0x2')]},'ticketType':{'type':Sequelize[_0x653b('0x3')](_0x653b('0x4'),_0x653b('0x5')),'defaultValue':_0x653b('0x4')}}; \ No newline at end of file +var _0x6250=['incident','phonecall','sequelize','STRING','ENUM'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x6250,0x1dd));var _0x0625=function(_0x333ae8,_0xf0464b){_0x333ae8=_0x333ae8-0x0;var _0xcc0696=_0x6250[_0x333ae8];return _0xcc0696;};'use strict';var Sequelize=require(_0x0625('0x0'));module['exports']={'name':{'type':Sequelize[_0x0625('0x1')]},'description':{'type':Sequelize[_0x0625('0x1')]},'ticketType':{'type':Sequelize[_0x0625('0x2')](_0x0625('0x3'),_0x0625('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4c88b99..c0914e4 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 _0xa63e=['request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','stack','name','send','map','Dynamics365Configuration','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','show','params','rawAttributes','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','options','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0xa63e,0x145));var _0xea63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa63e[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xea63('0x0'));var emlformat=require(_0xea63('0x1'));var rimraf=require(_0xea63('0x2'));var zipdir=require(_0xea63('0x3'));var jsonpatch=require(_0xea63('0x4'));var rp=require(_0xea63('0x5'));var moment=require(_0xea63('0x6'));var BPromise=require(_0xea63('0x7'));var Mustache=require(_0xea63('0x8'));var util=require(_0xea63('0x9'));var path=require(_0xea63('0xa'));var sox=require(_0xea63('0xb'));var csv=require(_0xea63('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xea63('0xd'));var squel=require(_0xea63('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea63('0xf'));var toCsv=require(_0xea63('0xc'));var querystring=require(_0xea63('0x10'));var Papa=require('papaparse');var Redis=require(_0xea63('0x11'));var authService=require(_0xea63('0x12'));var qs=require(_0xea63('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea63('0x14'));var logger=require(_0xea63('0x15'))(_0xea63('0x16'));var utils=require(_0xea63('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea63('0x18'))['db'];var jayson=require(_0xea63('0x19'));var client=jayson[_0xea63('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x218073,_0x2e1f5a,_0x3a0da2,_0x93aef2){return new BPromise(function(_0x570f11,_0x315b82){var _0x20a875=_0x93aef2||client;return _0x20a875[_0xea63('0x1b')](_0x218073,_0x3a0da2)[_0xea63('0x1c')](function(_0x5da66f){logger[_0xea63('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2e1f5a,_0xea63('0x1e'));logger['debug'](_0xea63('0x1f'),_0x2e1f5a,_0xea63('0x1e'),JSON['stringify'](_0x5da66f));if(_0x5da66f[_0xea63('0x20')]){if(_0x5da66f['error'][_0xea63('0x21')]===0x1f4){logger[_0xea63('0x20')](_0xea63('0x22'),_0x2e1f5a,_0x5da66f[_0xea63('0x20')]['message']);return _0x315b82(_0x5da66f['error'][_0xea63('0x23')]);}logger[_0xea63('0x20')](_0xea63('0x22'),_0x2e1f5a,_0x5da66f[_0xea63('0x20')][_0xea63('0x23')]);return _0x570f11(_0x5da66f[_0xea63('0x20')][_0xea63('0x23')]);}else{logger[_0xea63('0x1d')](_0xea63('0x22'),_0x2e1f5a,_0xea63('0x1e'));_0x570f11(_0x5da66f[_0xea63('0x24')][_0xea63('0x23')]);}})[_0xea63('0x25')](function(_0x16e98b){logger[_0xea63('0x20')](_0xea63('0x22'),_0x2e1f5a,_0x16e98b);_0x315b82(_0x16e98b);});});}function respondWithStatusCode(_0x330e06,_0x278630){_0x278630=_0x278630||0xcc;return function(_0x242d02){if(_0x242d02){return _0x330e06[_0xea63('0x26')](_0x278630);}return _0x330e06[_0xea63('0x27')](_0x278630)[_0xea63('0x28')]();};}function respondWithResult(_0x5b5d50,_0x156091){_0x156091=_0x156091||0xc8;return function(_0xab07d){if(_0xab07d){return _0x5b5d50[_0xea63('0x27')](_0x156091)[_0xea63('0x29')](_0xab07d);}};}function respondWithFilteredResult(_0x54a600,_0x342d7a){return function(_0x395bbb){if(_0x395bbb){var _0x41fdcd=_0x395bbb[_0xea63('0x2a')],_0x206a7f=_0x342d7a[_0xea63('0x2b')],_0x280653=_0x342d7a['offset']+_0x342d7a['limit'],_0x2823f0;if(_0x280653>=_0x41fdcd){_0x280653=_0x41fdcd;_0x2823f0=0xc8;}else{_0x2823f0=0xce;}_0x54a600[_0xea63('0x27')](_0x2823f0);return _0x54a600[_0xea63('0x2c')]('Content-Range',_0x206a7f+'-'+_0x280653+'/'+_0x41fdcd)[_0xea63('0x29')](_0x395bbb);}return null;};}function patchUpdates(_0x3f58ad){return function(_0x11716b){try{jsonpatch[_0xea63('0x2d')](_0x11716b,_0x3f58ad,!![]);}catch(_0x413738){return BPromise[_0xea63('0x2e')](_0x413738);}return _0x11716b[_0xea63('0x2f')]();};}function saveUpdates(_0x3a00fc,_0x244297){return function(_0x257307){if(_0x257307){return _0x257307[_0xea63('0x30')](_0x3a00fc)[_0xea63('0x1c')](function(_0x14458a){return _0x14458a;});}return null;};}function removeEntity(_0x10f88b,_0x5352d3){return function(_0x1c579f){if(_0x1c579f){return _0x1c579f[_0xea63('0x31')]()[_0xea63('0x1c')](function(){_0x10f88b[_0xea63('0x27')](0xcc)[_0xea63('0x28')]();});}};}function handleEntityNotFound(_0x1a93ab,_0x389e09){return function(_0x3574f0){if(!_0x3574f0){_0x1a93ab[_0xea63('0x26')](0x194);}return _0x3574f0;};}function handleError(_0x20aaf,_0x342970){_0x342970=_0x342970||0x1f4;return function(_0x48c2aa){logger[_0xea63('0x20')](_0x48c2aa[_0xea63('0x32')]);if(_0x48c2aa[_0xea63('0x33')]){delete _0x48c2aa['name'];}_0x20aaf[_0xea63('0x27')](_0x342970)[_0xea63('0x34')](_0x48c2aa);};}exports['index']=function(_0x2d9ccc,_0x213f85){var _0x3ad52c={},_0x51770e={},_0x50bf93={'count':0x0,'rows':[]};var _0x182599=_[_0xea63('0x35')](db[_0xea63('0x36')]['rawAttributes'],function(_0x5de989){return{'name':_0x5de989['fieldName'],'type':_0x5de989[_0xea63('0x37')][_0xea63('0x38')]};});_0x51770e[_0xea63('0x39')]=_[_0xea63('0x35')](_0x182599,_0xea63('0x33'));_0x51770e['query']=_[_0xea63('0x3a')](_0x2d9ccc[_0xea63('0x3b')]);_0x51770e[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x51770e[_0xea63('0x39')],_0x51770e[_0xea63('0x3b')]);_0x3ad52c[_0xea63('0x3e')]=_['intersection'](_0x51770e[_0xea63('0x39')],qs[_0xea63('0x3f')](_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x3f')]));_0x3ad52c[_0xea63('0x3e')]=_0x3ad52c[_0xea63('0x3e')][_0xea63('0x40')]?_0x3ad52c['attributes']:_0x51770e['model'];if(!_0x2d9ccc[_0xea63('0x3b')]['hasOwnProperty'](_0xea63('0x41'))){_0x3ad52c[_0xea63('0x42')]=qs['limit'](_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x42')]);_0x3ad52c['offset']=qs['offset'](_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x2b')]);}_0x3ad52c[_0xea63('0x43')]=qs[_0xea63('0x44')](_0x2d9ccc['query'][_0xea63('0x44')]);_0x3ad52c['where']=qs['filters'](_[_0xea63('0x45')](_0x2d9ccc['query'],_0x51770e[_0xea63('0x3c')]),_0x182599);if(_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x46')]){_0x3ad52c['where']=_['merge'](_0x3ad52c[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0x182599,function(_0x4c4e31){if(_0x4c4e31['type']!==_0xea63('0x48')){var _0x567044={};_0x567044[_0x4c4e31[_0xea63('0x33')]]={'$like':'%'+_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x46')]+'%'};return _0x567044;}})});}_0x3ad52c=_[_0xea63('0x49')]({},_0x3ad52c,_0x2d9ccc['options']);var _0x17c873={'where':_0x3ad52c[_0xea63('0x47')]};return db['Dynamics365Configuration'][_0xea63('0x2a')](_0x17c873)['then'](function(_0x1612f9){_0x50bf93['count']=_0x1612f9;if(_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x4a')]){_0x3ad52c['include']=[{'all':!![]}];}return db[_0xea63('0x36')][_0xea63('0x4b')](_0x3ad52c);})[_0xea63('0x1c')](function(_0x4246d0){_0x50bf93['rows']=_0x4246d0;return _0x50bf93;})['then'](respondWithFilteredResult(_0x213f85,_0x3ad52c))['catch'](handleError(_0x213f85,null));};exports[_0xea63('0x4c')]=function(_0xeb3883,_0x209713){var _0x4ed277={'raw':![],'where':{'id':_0xeb3883[_0xea63('0x4d')]['id']}},_0x1ffc3d={};_0x1ffc3d[_0xea63('0x39')]=_['keys'](db[_0xea63('0x36')][_0xea63('0x4e')]);_0x1ffc3d[_0xea63('0x3b')]=_['keys'](_0xeb3883[_0xea63('0x3b')]);_0x1ffc3d[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x1ffc3d[_0xea63('0x39')],_0x1ffc3d[_0xea63('0x3b')]);_0x4ed277[_0xea63('0x3e')]=_['intersection'](_0x1ffc3d[_0xea63('0x39')],qs[_0xea63('0x3f')](_0xeb3883['query'][_0xea63('0x3f')]));_0x4ed277['attributes']=_0x4ed277[_0xea63('0x3e')][_0xea63('0x40')]?_0x4ed277[_0xea63('0x3e')]:_0x1ffc3d[_0xea63('0x39')];if(_0xeb3883[_0xea63('0x3b')][_0xea63('0x4a')]){_0x4ed277['include']=[{'all':!![]}];}_0x4ed277=_[_0xea63('0x49')]({},_0x4ed277,_0xeb3883['options']);return db['Dynamics365Configuration'][_0xea63('0x4f')](_0x4ed277)[_0xea63('0x1c')](handleEntityNotFound(_0x209713,null))[_0xea63('0x1c')](respondWithResult(_0x209713,null))[_0xea63('0x25')](handleError(_0x209713,null));};exports[_0xea63('0x50')]=function(_0x468c91,_0x5bd97e){return db[_0xea63('0x36')][_0xea63('0x50')](_0x468c91['body'],{})['then'](respondWithResult(_0x5bd97e,0xc9))[_0xea63('0x25')](handleError(_0x5bd97e,null));};exports[_0xea63('0x30')]=function(_0x2da3fa,_0x568aba){if(_0x2da3fa[_0xea63('0x51')]['id']){delete _0x2da3fa[_0xea63('0x51')]['id'];}return db[_0xea63('0x36')][_0xea63('0x4f')]({'where':{'id':_0x2da3fa[_0xea63('0x4d')]['id']}})[_0xea63('0x1c')](handleEntityNotFound(_0x568aba,null))[_0xea63('0x1c')](saveUpdates(_0x2da3fa[_0xea63('0x51')],null))['then'](respondWithResult(_0x568aba,null))['catch'](handleError(_0x568aba,null));};exports[_0xea63('0x31')]=function(_0x469fc3,_0x1dacc1){return db[_0xea63('0x36')][_0xea63('0x4f')]({'where':{'id':_0x469fc3[_0xea63('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1dacc1,null))['then'](removeEntity(_0x1dacc1,null))[_0xea63('0x25')](handleError(_0x1dacc1,null));};exports[_0xea63('0x52')]=function(_0x34a156,_0x365eeb,_0x43397f){var _0x1fce3a={};var _0x11e386={};var _0x300fd5;var _0x235a3e;return db[_0xea63('0x36')][_0xea63('0x53')]({'where':{'id':_0x34a156['params']['id']}})['then'](handleEntityNotFound(_0x365eeb,null))[_0xea63('0x1c')](function(_0x73f4bd){if(_0x73f4bd){_0x300fd5=_0x73f4bd;_0x11e386[_0xea63('0x39')]=_[_0xea63('0x3a')](db['Dynamics365Field'][_0xea63('0x4e')]);_0x11e386[_0xea63('0x3b')]=_[_0xea63('0x3a')](_0x34a156[_0xea63('0x3b')]);_0x11e386[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x11e386[_0xea63('0x39')],_0x11e386[_0xea63('0x3b')]);_0x1fce3a['attributes']=_[_0xea63('0x3d')](_0x11e386[_0xea63('0x39')],qs['fields'](_0x34a156['query'][_0xea63('0x3f')]));_0x1fce3a['attributes']=_0x1fce3a[_0xea63('0x3e')][_0xea63('0x40')]?_0x1fce3a[_0xea63('0x3e')]:_0x11e386[_0xea63('0x39')];_0x1fce3a['order']=qs['sort'](_0x34a156[_0xea63('0x3b')][_0xea63('0x44')]);_0x1fce3a['where']=qs[_0xea63('0x3c')](_[_0xea63('0x45')](_0x34a156[_0xea63('0x3b')],_0x11e386['filters']));if(_0x34a156[_0xea63('0x3b')][_0xea63('0x46')]){_0x1fce3a['where']=_[_0xea63('0x49')](_0x1fce3a[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0x1fce3a[_0xea63('0x3e')],function(_0xa70b0c){var _0x4f98ee={};_0x4f98ee[_0xa70b0c]={'$like':'%'+_0x34a156[_0xea63('0x3b')]['filter']+'%'};return _0x4f98ee;})});}_0x1fce3a=_[_0xea63('0x49')]({},_0x1fce3a,_0x34a156['options']);return _0x300fd5[_0xea63('0x52')](_0x1fce3a);}})[_0xea63('0x1c')](function(_0x5a4d07){if(_0x5a4d07){_0x235a3e=_0x5a4d07[_0xea63('0x40')];if(!_0x34a156['query'][_0xea63('0x54')](_0xea63('0x41'))){_0x1fce3a[_0xea63('0x42')]=qs[_0xea63('0x42')](_0x34a156['query'][_0xea63('0x42')]);_0x1fce3a[_0xea63('0x2b')]=qs['offset'](_0x34a156['query'][_0xea63('0x2b')]);}return _0x300fd5[_0xea63('0x52')](_0x1fce3a);}})[_0xea63('0x1c')](function(_0x6c4b5d){if(_0x6c4b5d){return _0x6c4b5d?{'count':_0x235a3e,'rows':_0x6c4b5d}:null;}})[_0xea63('0x1c')](respondWithResult(_0x365eeb,null))[_0xea63('0x25')](handleError(_0x365eeb,null));};exports[_0xea63('0x55')]=function(_0x2d649d,_0xd934b2,_0x52c84a){var _0x3cd8a0={};var _0x2cda08={};var _0x36d720;var _0x1fc7ca;return db[_0xea63('0x36')][_0xea63('0x53')]({'where':{'id':_0x2d649d[_0xea63('0x4d')]['id']}})[_0xea63('0x1c')](handleEntityNotFound(_0xd934b2,null))['then'](function(_0xb9b1ed){if(_0xb9b1ed){_0x36d720=_0xb9b1ed;_0x2cda08['model']=_['keys'](db['Dynamics365Field'][_0xea63('0x4e')]);_0x2cda08[_0xea63('0x3b')]=_['keys'](_0x2d649d[_0xea63('0x3b')]);_0x2cda08[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x2cda08[_0xea63('0x39')],_0x2cda08[_0xea63('0x3b')]);_0x3cd8a0[_0xea63('0x3e')]=_[_0xea63('0x3d')](_0x2cda08[_0xea63('0x39')],qs[_0xea63('0x3f')](_0x2d649d[_0xea63('0x3b')][_0xea63('0x3f')]));_0x3cd8a0[_0xea63('0x3e')]=_0x3cd8a0[_0xea63('0x3e')][_0xea63('0x40')]?_0x3cd8a0[_0xea63('0x3e')]:_0x2cda08[_0xea63('0x39')];_0x3cd8a0[_0xea63('0x43')]=qs[_0xea63('0x44')](_0x2d649d[_0xea63('0x3b')][_0xea63('0x44')]);_0x3cd8a0[_0xea63('0x47')]=qs[_0xea63('0x3c')](_['pick'](_0x2d649d['query'],_0x2cda08[_0xea63('0x3c')]));if(_0x2d649d[_0xea63('0x3b')][_0xea63('0x46')]){_0x3cd8a0[_0xea63('0x47')]=_['merge'](_0x3cd8a0[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0x3cd8a0[_0xea63('0x3e')],function(_0x3091c7){var _0x17fe60={};_0x17fe60[_0x3091c7]={'$like':'%'+_0x2d649d['query'][_0xea63('0x46')]+'%'};return _0x17fe60;})});}_0x3cd8a0=_['merge']({},_0x3cd8a0,_0x2d649d[_0xea63('0x56')]);return _0x36d720['getSubjects'](_0x3cd8a0);}})[_0xea63('0x1c')](function(_0xac79ee){if(_0xac79ee){_0x1fc7ca=_0xac79ee[_0xea63('0x40')];if(!_0x2d649d['query'][_0xea63('0x54')]('nolimit')){_0x3cd8a0[_0xea63('0x42')]=qs[_0xea63('0x42')](_0x2d649d[_0xea63('0x3b')]['limit']);_0x3cd8a0[_0xea63('0x2b')]=qs[_0xea63('0x2b')](_0x2d649d[_0xea63('0x3b')][_0xea63('0x2b')]);}return _0x36d720[_0xea63('0x55')](_0x3cd8a0);}})[_0xea63('0x1c')](function(_0x4d6e28){if(_0x4d6e28){return _0x4d6e28?{'count':_0x1fc7ca,'rows':_0x4d6e28}:null;}})['then'](respondWithResult(_0xd934b2,null))[_0xea63('0x25')](handleError(_0xd934b2,null));};exports[_0xea63('0x57')]=function(_0x811044,_0x3953c3,_0x228dbd){var _0xf32046={};var _0x3250f1={};var _0x95d564;var _0x50461d;return db[_0xea63('0x36')][_0xea63('0x53')]({'where':{'id':_0x811044['params']['id']}})[_0xea63('0x1c')](handleEntityNotFound(_0x3953c3,null))[_0xea63('0x1c')](function(_0x43f46d){if(_0x43f46d){_0x95d564=_0x43f46d;_0x3250f1[_0xea63('0x39')]=_[_0xea63('0x3a')](db['Dynamics365Field'][_0xea63('0x4e')]);_0x3250f1[_0xea63('0x3b')]=_[_0xea63('0x3a')](_0x811044[_0xea63('0x3b')]);_0x3250f1[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x3250f1[_0xea63('0x39')],_0x3250f1[_0xea63('0x3b')]);_0xf32046[_0xea63('0x3e')]=_[_0xea63('0x3d')](_0x3250f1['model'],qs[_0xea63('0x3f')](_0x811044[_0xea63('0x3b')]['fields']));_0xf32046[_0xea63('0x3e')]=_0xf32046['attributes'][_0xea63('0x40')]?_0xf32046[_0xea63('0x3e')]:_0x3250f1[_0xea63('0x39')];_0xf32046[_0xea63('0x43')]=qs[_0xea63('0x44')](_0x811044[_0xea63('0x3b')][_0xea63('0x44')]);_0xf32046['where']=qs['filters'](_[_0xea63('0x45')](_0x811044[_0xea63('0x3b')],_0x3250f1[_0xea63('0x3c')]));if(_0x811044['query'][_0xea63('0x46')]){_0xf32046[_0xea63('0x47')]=_['merge'](_0xf32046[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0xf32046[_0xea63('0x3e')],function(_0x400ac6){var _0x18cdb2={};_0x18cdb2[_0x400ac6]={'$like':'%'+_0x811044[_0xea63('0x3b')][_0xea63('0x46')]+'%'};return _0x18cdb2;})});}_0xf32046=_['merge']({},_0xf32046,_0x811044[_0xea63('0x56')]);return _0x95d564[_0xea63('0x57')](_0xf32046);}})[_0xea63('0x1c')](function(_0x552e95){if(_0x552e95){_0x50461d=_0x552e95[_0xea63('0x40')];if(!_0x811044[_0xea63('0x3b')][_0xea63('0x54')](_0xea63('0x41'))){_0xf32046[_0xea63('0x42')]=qs[_0xea63('0x42')](_0x811044[_0xea63('0x3b')][_0xea63('0x42')]);_0xf32046['offset']=qs[_0xea63('0x2b')](_0x811044[_0xea63('0x3b')][_0xea63('0x2b')]);}return _0x95d564[_0xea63('0x57')](_0xf32046);}})[_0xea63('0x1c')](function(_0x10066b){if(_0x10066b){return _0x10066b?{'count':_0x50461d,'rows':_0x10066b}:null;}})[_0xea63('0x1c')](respondWithResult(_0x3953c3,null))[_0xea63('0x25')](handleError(_0x3953c3,null));}; \ No newline at end of file +var _0x4c8c=['path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','rows','params','keys','includeAll','options','create','body','update','find','findOne','Dynamics365Field','getFields','getSubjects','getDescriptions','html-pdf','eml-format','request-promise','mustache'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x4c8c,0x1f4));var _0xc4c8=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x4c8c[_0x673722];return _0x21249c;};'use strict';var pdf=require(_0xc4c8('0x0'));var emlformat=require(_0xc4c8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4c8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc4c8('0x3'));var util=require('util');var path=require(_0xc4c8('0x4'));var sox=require(_0xc4c8('0x5'));var csv=require(_0xc4c8('0x6'));var ejs=require(_0xc4c8('0x7'));var fs=require('fs');var _=require(_0xc4c8('0x8'));var squel=require('squel');var crypto=require(_0xc4c8('0x9'));var jsforce=require(_0xc4c8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc4c8('0x6'));var querystring=require(_0xc4c8('0xb'));var Papa=require(_0xc4c8('0xc'));var Redis=require(_0xc4c8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc4c8('0xe'));var as=require(_0xc4c8('0xf'));var hardwareService=require(_0xc4c8('0x10'));var logger=require(_0xc4c8('0x11'))(_0xc4c8('0x12'));var utils=require(_0xc4c8('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc4c8('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc4c8('0x15')][_0xc4c8('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1278e0,_0x3427b5,_0x466a16,_0x3a4451){return new BPromise(function(_0x48ec57,_0x1e49ed){var _0x579fb0=_0x3a4451||client;return _0x579fb0[_0xc4c8('0x17')](_0x1278e0,_0x466a16)[_0xc4c8('0x18')](function(_0x4d61b0){logger[_0xc4c8('0x19')](_0xc4c8('0x1a'),_0x3427b5,'request\x20sent');logger[_0xc4c8('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3427b5,_0xc4c8('0x1c'),JSON['stringify'](_0x4d61b0));if(_0x4d61b0[_0xc4c8('0x1d')]){if(_0x4d61b0[_0xc4c8('0x1d')][_0xc4c8('0x1e')]===0x1f4){logger['error'](_0xc4c8('0x1a'),_0x3427b5,_0x4d61b0['error'][_0xc4c8('0x1f')]);return _0x1e49ed(_0x4d61b0[_0xc4c8('0x1d')]['message']);}logger[_0xc4c8('0x1d')](_0xc4c8('0x1a'),_0x3427b5,_0x4d61b0['error'][_0xc4c8('0x1f')]);return _0x48ec57(_0x4d61b0[_0xc4c8('0x1d')][_0xc4c8('0x1f')]);}else{logger[_0xc4c8('0x19')](_0xc4c8('0x1a'),_0x3427b5,_0xc4c8('0x1c'));_0x48ec57(_0x4d61b0['result'][_0xc4c8('0x1f')]);}})[_0xc4c8('0x20')](function(_0x4c2678){logger[_0xc4c8('0x1d')](_0xc4c8('0x1a'),_0x3427b5,_0x4c2678);_0x1e49ed(_0x4c2678);});});}function respondWithStatusCode(_0x1ffff3,_0x1f48e2){_0x1f48e2=_0x1f48e2||0xcc;return function(_0xd6f8eb){if(_0xd6f8eb){return _0x1ffff3['sendStatus'](_0x1f48e2);}return _0x1ffff3[_0xc4c8('0x21')](_0x1f48e2)[_0xc4c8('0x22')]();};}function respondWithResult(_0x1f5e36,_0x22c22b){_0x22c22b=_0x22c22b||0xc8;return function(_0x39b42c){if(_0x39b42c){return _0x1f5e36[_0xc4c8('0x21')](_0x22c22b)[_0xc4c8('0x23')](_0x39b42c);}};}function respondWithFilteredResult(_0x5a5b33,_0x3d9851){return function(_0x2ca4ab){if(_0x2ca4ab){var _0x220131=_0x2ca4ab[_0xc4c8('0x24')],_0xa28304=_0x3d9851[_0xc4c8('0x25')],_0x31eb61=_0x3d9851[_0xc4c8('0x25')]+_0x3d9851[_0xc4c8('0x26')],_0x474785;if(_0x31eb61>=_0x220131){_0x31eb61=_0x220131;_0x474785=0xc8;}else{_0x474785=0xce;}_0x5a5b33[_0xc4c8('0x21')](_0x474785);return _0x5a5b33[_0xc4c8('0x27')](_0xc4c8('0x28'),_0xa28304+'-'+_0x31eb61+'/'+_0x220131)[_0xc4c8('0x23')](_0x2ca4ab);}return null;};}function patchUpdates(_0x216e22){return function(_0x22839b){try{jsonpatch[_0xc4c8('0x29')](_0x22839b,_0x216e22,!![]);}catch(_0x466f42){return BPromise[_0xc4c8('0x2a')](_0x466f42);}return _0x22839b[_0xc4c8('0x2b')]();};}function saveUpdates(_0x5067b4,_0x346ad9){return function(_0x13749e){if(_0x13749e){return _0x13749e['update'](_0x5067b4)[_0xc4c8('0x18')](function(_0xeae8d3){return _0xeae8d3;});}return null;};}function removeEntity(_0xf759f3,_0x46c17c){return function(_0xf5f7a5){if(_0xf5f7a5){return _0xf5f7a5[_0xc4c8('0x2c')]()[_0xc4c8('0x18')](function(){_0xf759f3[_0xc4c8('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5648e8,_0x288a13){return function(_0x2e1516){if(!_0x2e1516){_0x5648e8['sendStatus'](0x194);}return _0x2e1516;};}function handleError(_0x555805,_0x1cb70c){_0x1cb70c=_0x1cb70c||0x1f4;return function(_0xcb815f){logger[_0xc4c8('0x1d')](_0xcb815f[_0xc4c8('0x2d')]);if(_0xcb815f[_0xc4c8('0x2e')]){delete _0xcb815f[_0xc4c8('0x2e')];}_0x555805[_0xc4c8('0x21')](_0x1cb70c)[_0xc4c8('0x2f')](_0xcb815f);};}exports[_0xc4c8('0x30')]=function(_0x13039c,_0xcbd6d6){var _0x2fa9ab={},_0x47c363={},_0x45c7de={'count':0x0,'rows':[]};var _0x26b08a=_[_0xc4c8('0x31')](db[_0xc4c8('0x32')][_0xc4c8('0x33')],function(_0x1b6919){return{'name':_0x1b6919['fieldName'],'type':_0x1b6919['type']['key']};});_0x47c363[_0xc4c8('0x34')]=_[_0xc4c8('0x31')](_0x26b08a,_0xc4c8('0x2e'));_0x47c363[_0xc4c8('0x35')]=_['keys'](_0x13039c[_0xc4c8('0x35')]);_0x47c363[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0x47c363[_0xc4c8('0x34')],_0x47c363['query']);_0x2fa9ab[_0xc4c8('0x38')]=_[_0xc4c8('0x37')](_0x47c363[_0xc4c8('0x34')],qs['fields'](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x39')]));_0x2fa9ab['attributes']=_0x2fa9ab[_0xc4c8('0x38')][_0xc4c8('0x3a')]?_0x2fa9ab[_0xc4c8('0x38')]:_0x47c363[_0xc4c8('0x34')];if(!_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x2fa9ab['limit']=qs['limit'](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x26')]);_0x2fa9ab['offset']=qs[_0xc4c8('0x25')](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x25')]);}_0x2fa9ab[_0xc4c8('0x3d')]=qs[_0xc4c8('0x3e')](_0x13039c[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x2fa9ab[_0xc4c8('0x3f')]=qs[_0xc4c8('0x36')](_[_0xc4c8('0x40')](_0x13039c[_0xc4c8('0x35')],_0x47c363['filters']),_0x26b08a);if(_0x13039c['query'][_0xc4c8('0x41')]){_0x2fa9ab[_0xc4c8('0x3f')]=_[_0xc4c8('0x42')](_0x2fa9ab[_0xc4c8('0x3f')],{'$or':_[_0xc4c8('0x31')](_0x26b08a,function(_0x1886f6){if(_0x1886f6[_0xc4c8('0x43')]!=='VIRTUAL'){var _0x5b6ff2={};_0x5b6ff2[_0x1886f6[_0xc4c8('0x2e')]]={'$like':'%'+_0x13039c[_0xc4c8('0x35')]['filter']+'%'};return _0x5b6ff2;}})});}_0x2fa9ab=_[_0xc4c8('0x42')]({},_0x2fa9ab,_0x13039c['options']);var _0x2ba25a={'where':_0x2fa9ab[_0xc4c8('0x3f')]};return db['Dynamics365Configuration'][_0xc4c8('0x24')](_0x2ba25a)[_0xc4c8('0x18')](function(_0xe6bea3){_0x45c7de[_0xc4c8('0x24')]=_0xe6bea3;if(_0x13039c['query']['includeAll']){_0x2fa9ab[_0xc4c8('0x44')]=[{'all':!![]}];}return db[_0xc4c8('0x32')][_0xc4c8('0x45')](_0x2fa9ab);})[_0xc4c8('0x18')](function(_0x284b2f){_0x45c7de[_0xc4c8('0x46')]=_0x284b2f;return _0x45c7de;})[_0xc4c8('0x18')](respondWithFilteredResult(_0xcbd6d6,_0x2fa9ab))[_0xc4c8('0x20')](handleError(_0xcbd6d6,null));};exports['show']=function(_0x1310f0,_0x17cd0c){var _0x2a986e={'raw':![],'where':{'id':_0x1310f0[_0xc4c8('0x47')]['id']}},_0x1c3afa={};_0x1c3afa[_0xc4c8('0x34')]=_[_0xc4c8('0x48')](db['Dynamics365Configuration']['rawAttributes']);_0x1c3afa[_0xc4c8('0x35')]=_['keys'](_0x1310f0[_0xc4c8('0x35')]);_0x1c3afa[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0x1c3afa[_0xc4c8('0x34')],_0x1c3afa['query']);_0x2a986e['attributes']=_[_0xc4c8('0x37')](_0x1c3afa[_0xc4c8('0x34')],qs['fields'](_0x1310f0[_0xc4c8('0x35')][_0xc4c8('0x39')]));_0x2a986e[_0xc4c8('0x38')]=_0x2a986e[_0xc4c8('0x38')][_0xc4c8('0x3a')]?_0x2a986e[_0xc4c8('0x38')]:_0x1c3afa['model'];if(_0x1310f0[_0xc4c8('0x35')][_0xc4c8('0x49')]){_0x2a986e[_0xc4c8('0x44')]=[{'all':!![]}];}_0x2a986e=_[_0xc4c8('0x42')]({},_0x2a986e,_0x1310f0[_0xc4c8('0x4a')]);return db[_0xc4c8('0x32')]['find'](_0x2a986e)[_0xc4c8('0x18')](handleEntityNotFound(_0x17cd0c,null))[_0xc4c8('0x18')](respondWithResult(_0x17cd0c,null))[_0xc4c8('0x20')](handleError(_0x17cd0c,null));};exports[_0xc4c8('0x4b')]=function(_0x388e6c,_0x25cee6){return db[_0xc4c8('0x32')]['create'](_0x388e6c[_0xc4c8('0x4c')],{})[_0xc4c8('0x18')](respondWithResult(_0x25cee6,0xc9))['catch'](handleError(_0x25cee6,null));};exports[_0xc4c8('0x4d')]=function(_0x9fc971,_0x3ec4a1){if(_0x9fc971[_0xc4c8('0x4c')]['id']){delete _0x9fc971[_0xc4c8('0x4c')]['id'];}return db[_0xc4c8('0x32')][_0xc4c8('0x4e')]({'where':{'id':_0x9fc971['params']['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0x3ec4a1,null))[_0xc4c8('0x18')](saveUpdates(_0x9fc971[_0xc4c8('0x4c')],null))['then'](respondWithResult(_0x3ec4a1,null))[_0xc4c8('0x20')](handleError(_0x3ec4a1,null));};exports[_0xc4c8('0x2c')]=function(_0x52bb31,_0x14da25){return db[_0xc4c8('0x32')]['find']({'where':{'id':_0x52bb31[_0xc4c8('0x47')]['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0x14da25,null))['then'](removeEntity(_0x14da25,null))[_0xc4c8('0x20')](handleError(_0x14da25,null));};exports['getFields']=function(_0x2eaced,_0x4abec8,_0xd069dc){var _0x2faefd={};var _0x26cfb6={};var _0x11b40c;var _0x5acb17;return db[_0xc4c8('0x32')][_0xc4c8('0x4f')]({'where':{'id':_0x2eaced[_0xc4c8('0x47')]['id']}})['then'](handleEntityNotFound(_0x4abec8,null))['then'](function(_0x3bebb2){if(_0x3bebb2){_0x11b40c=_0x3bebb2;_0x26cfb6['model']=_[_0xc4c8('0x48')](db[_0xc4c8('0x50')]['rawAttributes']);_0x26cfb6['query']=_[_0xc4c8('0x48')](_0x2eaced[_0xc4c8('0x35')]);_0x26cfb6['filters']=_['intersection'](_0x26cfb6['model'],_0x26cfb6[_0xc4c8('0x35')]);_0x2faefd['attributes']=_[_0xc4c8('0x37')](_0x26cfb6[_0xc4c8('0x34')],qs[_0xc4c8('0x39')](_0x2eaced[_0xc4c8('0x35')]['fields']));_0x2faefd['attributes']=_0x2faefd[_0xc4c8('0x38')][_0xc4c8('0x3a')]?_0x2faefd[_0xc4c8('0x38')]:_0x26cfb6[_0xc4c8('0x34')];_0x2faefd['order']=qs['sort'](_0x2eaced[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x2faefd[_0xc4c8('0x3f')]=qs['filters'](_[_0xc4c8('0x40')](_0x2eaced[_0xc4c8('0x35')],_0x26cfb6[_0xc4c8('0x36')]));if(_0x2eaced[_0xc4c8('0x35')][_0xc4c8('0x41')]){_0x2faefd[_0xc4c8('0x3f')]=_[_0xc4c8('0x42')](_0x2faefd[_0xc4c8('0x3f')],{'$or':_[_0xc4c8('0x31')](_0x2faefd[_0xc4c8('0x38')],function(_0x3b8271){var _0x30e0e5={};_0x30e0e5[_0x3b8271]={'$like':'%'+_0x2eaced[_0xc4c8('0x35')]['filter']+'%'};return _0x30e0e5;})});}_0x2faefd=_[_0xc4c8('0x42')]({},_0x2faefd,_0x2eaced['options']);return _0x11b40c['getFields'](_0x2faefd);}})[_0xc4c8('0x18')](function(_0x229abb){if(_0x229abb){_0x5acb17=_0x229abb[_0xc4c8('0x3a')];if(!_0x2eaced[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x2faefd['limit']=qs[_0xc4c8('0x26')](_0x2eaced['query'][_0xc4c8('0x26')]);_0x2faefd[_0xc4c8('0x25')]=qs[_0xc4c8('0x25')](_0x2eaced[_0xc4c8('0x35')]['offset']);}return _0x11b40c[_0xc4c8('0x51')](_0x2faefd);}})[_0xc4c8('0x18')](function(_0x561158){if(_0x561158){return _0x561158?{'count':_0x5acb17,'rows':_0x561158}:null;}})['then'](respondWithResult(_0x4abec8,null))[_0xc4c8('0x20')](handleError(_0x4abec8,null));};exports[_0xc4c8('0x52')]=function(_0x36950a,_0x47ac8a,_0x270689){var _0x3c7e15={};var _0xf6e1ef={};var _0x1cf764;var _0x2a9a1d;return db[_0xc4c8('0x32')][_0xc4c8('0x4f')]({'where':{'id':_0x36950a[_0xc4c8('0x47')]['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0x47ac8a,null))[_0xc4c8('0x18')](function(_0x5278fb){if(_0x5278fb){_0x1cf764=_0x5278fb;_0xf6e1ef[_0xc4c8('0x34')]=_[_0xc4c8('0x48')](db[_0xc4c8('0x50')][_0xc4c8('0x33')]);_0xf6e1ef[_0xc4c8('0x35')]=_['keys'](_0x36950a[_0xc4c8('0x35')]);_0xf6e1ef[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0xf6e1ef['model'],_0xf6e1ef[_0xc4c8('0x35')]);_0x3c7e15[_0xc4c8('0x38')]=_['intersection'](_0xf6e1ef['model'],qs[_0xc4c8('0x39')](_0x36950a['query'][_0xc4c8('0x39')]));_0x3c7e15[_0xc4c8('0x38')]=_0x3c7e15[_0xc4c8('0x38')]['length']?_0x3c7e15['attributes']:_0xf6e1ef[_0xc4c8('0x34')];_0x3c7e15[_0xc4c8('0x3d')]=qs[_0xc4c8('0x3e')](_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x3c7e15[_0xc4c8('0x3f')]=qs[_0xc4c8('0x36')](_[_0xc4c8('0x40')](_0x36950a[_0xc4c8('0x35')],_0xf6e1ef[_0xc4c8('0x36')]));if(_0x36950a[_0xc4c8('0x35')]['filter']){_0x3c7e15['where']=_[_0xc4c8('0x42')](_0x3c7e15[_0xc4c8('0x3f')],{'$or':_[_0xc4c8('0x31')](_0x3c7e15[_0xc4c8('0x38')],function(_0x5e70ce){var _0x51f9b4={};_0x51f9b4[_0x5e70ce]={'$like':'%'+_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x41')]+'%'};return _0x51f9b4;})});}_0x3c7e15=_[_0xc4c8('0x42')]({},_0x3c7e15,_0x36950a[_0xc4c8('0x4a')]);return _0x1cf764[_0xc4c8('0x52')](_0x3c7e15);}})[_0xc4c8('0x18')](function(_0x3e33cd){if(_0x3e33cd){_0x2a9a1d=_0x3e33cd['length'];if(!_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x3c7e15[_0xc4c8('0x26')]=qs[_0xc4c8('0x26')](_0x36950a['query']['limit']);_0x3c7e15['offset']=qs['offset'](_0x36950a[_0xc4c8('0x35')][_0xc4c8('0x25')]);}return _0x1cf764[_0xc4c8('0x52')](_0x3c7e15);}})[_0xc4c8('0x18')](function(_0x28dfb0){if(_0x28dfb0){return _0x28dfb0?{'count':_0x2a9a1d,'rows':_0x28dfb0}:null;}})['then'](respondWithResult(_0x47ac8a,null))[_0xc4c8('0x20')](handleError(_0x47ac8a,null));};exports['getDescriptions']=function(_0x3fb7e7,_0xfbed02,_0x2fe931){var _0x1a5505={};var _0x2c9961={};var _0x27d651;var _0x3d41db;return db[_0xc4c8('0x32')][_0xc4c8('0x4f')]({'where':{'id':_0x3fb7e7[_0xc4c8('0x47')]['id']}})[_0xc4c8('0x18')](handleEntityNotFound(_0xfbed02,null))[_0xc4c8('0x18')](function(_0x3023cf){if(_0x3023cf){_0x27d651=_0x3023cf;_0x2c9961[_0xc4c8('0x34')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x2c9961[_0xc4c8('0x35')]=_[_0xc4c8('0x48')](_0x3fb7e7[_0xc4c8('0x35')]);_0x2c9961[_0xc4c8('0x36')]=_[_0xc4c8('0x37')](_0x2c9961[_0xc4c8('0x34')],_0x2c9961[_0xc4c8('0x35')]);_0x1a5505[_0xc4c8('0x38')]=_[_0xc4c8('0x37')](_0x2c9961['model'],qs['fields'](_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x39')]));_0x1a5505[_0xc4c8('0x38')]=_0x1a5505['attributes'][_0xc4c8('0x3a')]?_0x1a5505['attributes']:_0x2c9961[_0xc4c8('0x34')];_0x1a5505[_0xc4c8('0x3d')]=qs['sort'](_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x3e')]);_0x1a5505[_0xc4c8('0x3f')]=qs[_0xc4c8('0x36')](_[_0xc4c8('0x40')](_0x3fb7e7[_0xc4c8('0x35')],_0x2c9961[_0xc4c8('0x36')]));if(_0x3fb7e7['query'][_0xc4c8('0x41')]){_0x1a5505[_0xc4c8('0x3f')]=_['merge'](_0x1a5505['where'],{'$or':_[_0xc4c8('0x31')](_0x1a5505[_0xc4c8('0x38')],function(_0x387198){var _0x5e0a06={};_0x5e0a06[_0x387198]={'$like':'%'+_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x41')]+'%'};return _0x5e0a06;})});}_0x1a5505=_['merge']({},_0x1a5505,_0x3fb7e7[_0xc4c8('0x4a')]);return _0x27d651[_0xc4c8('0x53')](_0x1a5505);}})[_0xc4c8('0x18')](function(_0x2d36bd){if(_0x2d36bd){_0x3d41db=_0x2d36bd[_0xc4c8('0x3a')];if(!_0x3fb7e7[_0xc4c8('0x35')][_0xc4c8('0x3b')](_0xc4c8('0x3c'))){_0x1a5505[_0xc4c8('0x26')]=qs[_0xc4c8('0x26')](_0x3fb7e7['query'][_0xc4c8('0x26')]);_0x1a5505[_0xc4c8('0x25')]=qs[_0xc4c8('0x25')](_0x3fb7e7[_0xc4c8('0x35')]['offset']);}return _0x27d651[_0xc4c8('0x53')](_0x1a5505);}})[_0xc4c8('0x18')](function(_0x440e0c){if(_0x440e0c){return _0x440e0c?{'count':_0x3d41db,'rows':_0x440e0c}:null;}})[_0xc4c8('0x18')](respondWithResult(_0xfbed02,null))[_0xc4c8('0x20')](handleError(_0xfbed02,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a9832cd..dc3b6ab 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 _0x7fa6=['rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api'];(function(_0x5c4093,_0x1d22bc){var _0x1532d3=function(_0x8d9b67){while(--_0x8d9b67){_0x5c4093['push'](_0x5c4093['shift']());}};_0x1532d3(++_0x1d22bc);}(_0x7fa6,0x178));var _0x67fa=function(_0x1822b3,_0x177315){_0x1822b3=_0x1822b3-0x0;var _0x1f5fac=_0x7fa6[_0x1822b3];return _0x1f5fac;};'use strict';var _=require(_0x67fa('0x0'));var util=require(_0x67fa('0x1'));var logger=require(_0x67fa('0x2'))(_0x67fa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x67fa('0x4'));var config=require(_0x67fa('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x67fa('0x6')]=function(_0x4508e6,_0x32ad0c){return _0x4508e6[_0x67fa('0x7')](_0x67fa('0x8'),attributes,{'tableName':_0x67fa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc411=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x41a804,_0xcde371){var _0x26870d=function(_0x46fb2a){while(--_0x46fb2a){_0x41a804['push'](_0x41a804['shift']());}};_0x26870d(++_0xcde371);}(_0xc411,0xca));var _0x1c41=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xc411[_0x2132a3];return _0x21890c;};'use strict';var _=require(_0x1c41('0x0'));var util=require(_0x1c41('0x1'));var logger=require(_0x1c41('0x2'))(_0x1c41('0x3'));var moment=require(_0x1c41('0x4'));var BPromise=require(_0x1c41('0x5'));var rp=require(_0x1c41('0x6'));var fs=require('fs');var path=require(_0x1c41('0x7'));var rimraf=require(_0x1c41('0x8'));var config=require(_0x1c41('0x9'));var attributes=require(_0x1c41('0xa'));module['exports']=function(_0x404972,_0x8a65f0){return _0x404972[_0x1c41('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x1c41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 9e346ad..cc9ecfd 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 _0xbbd1=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x1dfc1f,_0x5a77a4){var _0x11eca2=function(_0x3e256f){while(--_0x3e256f){_0x1dfc1f['push'](_0x1dfc1f['shift']());}};_0x11eca2(++_0x5a77a4);}(_0xbbd1,0x1c7));var _0x1bbd=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xbbd1[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require('lodash');var util=require(_0x1bbd('0x0'));var moment=require(_0x1bbd('0x1'));var BPromise=require(_0x1bbd('0x2'));var rs=require(_0x1bbd('0x3'));var fs=require('fs');var Redis=require(_0x1bbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bbd('0x5'));var logger=require('../../config/logger')(_0x1bbd('0x6'));var config=require(_0x1bbd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1bbd('0x8')][_0x1bbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2be901,_0x2f8e2d,_0x5e5388){return new BPromise(function(_0x5097c0,_0x2ce686){return client['request'](_0x2be901,_0x5e5388)[_0x1bbd('0xa')](function(_0x5e6b05){logger['info'](_0x1bbd('0xb'),_0x2f8e2d,_0x1bbd('0xc'));logger['debug'](_0x1bbd('0xd'),_0x2f8e2d,'request\x20sent',JSON[_0x1bbd('0xe')](_0x5e6b05));if(_0x5e6b05['error']){if(_0x5e6b05[_0x1bbd('0xf')][_0x1bbd('0x10')]===0x1f4){logger[_0x1bbd('0xf')](_0x1bbd('0xb'),_0x2f8e2d,_0x5e6b05['error']['message']);return _0x2ce686(_0x5e6b05[_0x1bbd('0xf')][_0x1bbd('0x11')]);}logger[_0x1bbd('0xf')](_0x1bbd('0xb'),_0x2f8e2d,_0x5e6b05[_0x1bbd('0xf')][_0x1bbd('0x11')]);return _0x5097c0(_0x5e6b05[_0x1bbd('0xf')]['message']);}else{logger['info'](_0x1bbd('0xb'),_0x2f8e2d,'request\x20sent');_0x5097c0(_0x5e6b05['result'][_0x1bbd('0x11')]);}})[_0x1bbd('0x12')](function(_0xe45cd3){logger[_0x1bbd('0xf')](_0x1bbd('0xb'),_0x2f8e2d,_0xe45cd3);_0x2ce686(_0xe45cd3);});});} \ No newline at end of file +var _0x1ffb=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd547cd,_0x3ad91f){var _0x1e3cff=function(_0x313e02){while(--_0x313e02){_0xd547cd['push'](_0xd547cd['shift']());}};_0x1e3cff(++_0x3ad91f);}(_0x1ffb,0x116));var _0xb1ff=function(_0x136171,_0x5b3018){_0x136171=_0x136171-0x0;var _0x5f5a32=_0x1ffb[_0x136171];return _0x5f5a32;};'use strict';var _=require(_0xb1ff('0x0'));var util=require(_0xb1ff('0x1'));var moment=require(_0xb1ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1ff('0x3'));var fs=require('fs');var Redis=require(_0xb1ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1ff('0x5'));var logger=require(_0xb1ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb1ff('0x7'));var client=jayson['client'][_0xb1ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x331a00,_0x16e04d,_0x4693c7){return new BPromise(function(_0x123757,_0x4b51c5){return client[_0xb1ff('0x9')](_0x331a00,_0x4693c7)['then'](function(_0x41ffbf){logger[_0xb1ff('0xa')](_0xb1ff('0xb'),_0x16e04d,_0xb1ff('0xc'));logger[_0xb1ff('0xd')](_0xb1ff('0xe'),_0x16e04d,_0xb1ff('0xc'),JSON[_0xb1ff('0xf')](_0x41ffbf));if(_0x41ffbf['error']){if(_0x41ffbf[_0xb1ff('0x10')][_0xb1ff('0x11')]===0x1f4){logger[_0xb1ff('0x10')](_0xb1ff('0xb'),_0x16e04d,_0x41ffbf[_0xb1ff('0x10')][_0xb1ff('0x12')]);return _0x4b51c5(_0x41ffbf['error']['message']);}logger[_0xb1ff('0x10')](_0xb1ff('0xb'),_0x16e04d,_0x41ffbf[_0xb1ff('0x10')]['message']);return _0x123757(_0x41ffbf[_0xb1ff('0x10')][_0xb1ff('0x12')]);}else{logger[_0xb1ff('0xa')](_0xb1ff('0xb'),_0x16e04d,'request\x20sent');_0x123757(_0x41ffbf[_0xb1ff('0x13')][_0xb1ff('0x12')]);}})[_0xb1ff('0x14')](function(_0x1a25df){logger[_0xb1ff('0x10')](_0xb1ff('0xb'),_0x16e04d,_0x1a25df);_0x4b51c5(_0x1a25df);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8c150fc..328c2bd 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 _0x422f=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x129422,_0x4af03c){var _0x3f7f3a=function(_0x1b1fcd){while(--_0x1b1fcd){_0x129422['push'](_0x129422['shift']());}};_0x3f7f3a(++_0x4af03c);}(_0x422f,0x1c7));var _0xf422=function(_0x13c4a6,_0x4041d9){_0x13c4a6=_0x13c4a6-0x0;var _0x5b1eeb=_0x422f[_0x13c4a6];return _0x5b1eeb;};'use strict';var multer=require('multer');var util=require(_0xf422('0x0'));var path=require('path');var timeout=require(_0xf422('0x1'));var express=require(_0xf422('0x2'));var router=express['Router']();var auth=require(_0xf422('0x3'));var interaction=require(_0xf422('0x4'));var config=require(_0xf422('0x5'));var controller=require(_0xf422('0x6'));router[_0xf422('0x7')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0x9')]);router[_0xf422('0x7')](_0xf422('0xa'),auth['isAuthenticated'](),controller[_0xf422('0xb')]);router[_0xf422('0xc')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0xd')]);router[_0xf422('0xe')]('/:id',auth[_0xf422('0x8')](),controller['update']);router['delete'](_0xf422('0xa'),auth[_0xf422('0x8')](),controller[_0xf422('0xf')]);module[_0xf422('0x10')]=router; \ No newline at end of file +var _0xac55=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2b4357,_0x46dc10){var _0xa37053=function(_0x584355){while(--_0x584355){_0x2b4357['push'](_0x2b4357['shift']());}};_0xa37053(++_0x46dc10);}(_0xac55,0x1c8));var _0x5ac5=function(_0x2bfb9a,_0x3af255){_0x2bfb9a=_0x2bfb9a-0x0;var _0x39b027=_0xac55[_0x2bfb9a];return _0x39b027;};'use strict';var multer=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var path=require(_0x5ac5('0x2'));var timeout=require(_0x5ac5('0x3'));var express=require('express');var router=express[_0x5ac5('0x4')]();var auth=require(_0x5ac5('0x5'));var interaction=require(_0x5ac5('0x6'));var config=require(_0x5ac5('0x7'));var controller=require(_0x5ac5('0x8'));router[_0x5ac5('0x9')]('/',auth[_0x5ac5('0xa')](),controller['index']);router['get'](_0x5ac5('0xb'),auth[_0x5ac5('0xa')](),controller[_0x5ac5('0xc')]);router[_0x5ac5('0xd')]('/',auth[_0x5ac5('0xa')](),controller[_0x5ac5('0xe')]);router[_0x5ac5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5ac5('0x10')]);router[_0x5ac5('0x11')]('/:id',auth[_0x5ac5('0xa')](),controller[_0x5ac5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7ec9087..170e469 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 _0x0234=['customVariable','STRING','BOOLEAN','exports','ENUM'];(function(_0x195f8e,_0x3d4c64){var _0x561a89=function(_0x5831c0){while(--_0x5831c0){_0x195f8e['push'](_0x195f8e['shift']());}};_0x561a89(++_0x3d4c64);}(_0x0234,0xfd));var _0x4023=function(_0xd73239,_0x488346){_0xd73239=_0xd73239-0x0;var _0x41cee6=_0x0234[_0xd73239];return _0x41cee6;};'use strict';var Sequelize=require('sequelize');module[_0x4023('0x0')]={'type':{'type':Sequelize[_0x4023('0x1')]('string','variable',_0x4023('0x2'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4023('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4023('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x4023('0x3')]},'idField':{'type':Sequelize[_0x4023('0x3')]},'nameField':{'type':Sequelize[_0x4023('0x3')]},'customField':{'type':Sequelize[_0x4023('0x4')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4023('0x3')]}}; \ No newline at end of file +var _0x7314=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x52942e,_0x274744){var _0x2c18ba=function(_0x1cd3f1){while(--_0x1cd3f1){_0x52942e['push'](_0x52942e['shift']());}};_0x2c18ba(++_0x274744);}(_0x7314,0x100));var _0x4731=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7314[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4731('0x0'));module[_0x4731('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4731('0x2'),_0x4731('0x3'),_0x4731('0x4'),'keyValue'),'defaultValue':_0x4731('0x2')},'content':{'type':Sequelize[_0x4731('0x5')]},'key':{'type':Sequelize[_0x4731('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4731('0x2'),_0x4731('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4731('0x5')]},'idField':{'type':Sequelize[_0x4731('0x5')]},'nameField':{'type':Sequelize[_0x4731('0x5')]},'customField':{'type':Sequelize[_0x4731('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0a93d00..711545c 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 _0xb1f2=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Field','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','params','keys','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x539ef0,_0x432d23){var _0x1a6862=function(_0x705a9a){while(--_0x705a9a){_0x539ef0['push'](_0x539ef0['shift']());}};_0x1a6862(++_0x432d23);}(_0xb1f2,0x165));var _0x2b1f=function(_0x3444ed,_0x519b37){_0x3444ed=_0x3444ed-0x0;var _0x16a19c=_0xb1f2[_0x3444ed];return _0x16a19c;};'use strict';var pdf=require(_0x2b1f('0x0'));var emlformat=require(_0x2b1f('0x1'));var rimraf=require(_0x2b1f('0x2'));var zipdir=require(_0x2b1f('0x3'));var jsonpatch=require(_0x2b1f('0x4'));var rp=require(_0x2b1f('0x5'));var moment=require(_0x2b1f('0x6'));var BPromise=require(_0x2b1f('0x7'));var Mustache=require(_0x2b1f('0x8'));var util=require(_0x2b1f('0x9'));var path=require(_0x2b1f('0xa'));var sox=require(_0x2b1f('0xb'));var csv=require(_0x2b1f('0xc'));var ejs=require(_0x2b1f('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b1f('0xe'));var jsforce=require(_0x2b1f('0xf'));var deskjs=require(_0x2b1f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2b1f('0x11'));var Papa=require(_0x2b1f('0x12'));var Redis=require(_0x2b1f('0x13'));var authService=require(_0x2b1f('0x14'));var qs=require(_0x2b1f('0x15'));var as=require(_0x2b1f('0x16'));var hardwareService=require(_0x2b1f('0x17'));var logger=require(_0x2b1f('0x18'))(_0x2b1f('0x19'));var utils=require(_0x2b1f('0x1a'));var config=require(_0x2b1f('0x1b'));var licenseUtil=require(_0x2b1f('0x1c'));var db=require(_0x2b1f('0x1d'))['db'];function respondWithStatusCode(_0x25e4e2,_0x34f204){_0x34f204=_0x34f204||0xcc;return function(_0x1f632d){if(_0x1f632d){return _0x25e4e2['sendStatus'](_0x34f204);}return _0x25e4e2[_0x2b1f('0x1e')](_0x34f204)['end']();};}function respondWithResult(_0x2d09b9,_0x55c660){_0x55c660=_0x55c660||0xc8;return function(_0x56f846){if(_0x56f846){return _0x2d09b9[_0x2b1f('0x1e')](_0x55c660)['json'](_0x56f846);}};}function respondWithFilteredResult(_0x1e36c8,_0x35fa4d){return function(_0x92340){if(_0x92340){var _0x234881=_0x92340['count'],_0x442350=_0x35fa4d['offset'],_0x1515c8=_0x35fa4d[_0x2b1f('0x1f')]+_0x35fa4d[_0x2b1f('0x20')],_0x1ee44b;if(_0x1515c8>=_0x234881){_0x1515c8=_0x234881;_0x1ee44b=0xc8;}else{_0x1ee44b=0xce;}_0x1e36c8['status'](_0x1ee44b);return _0x1e36c8[_0x2b1f('0x21')](_0x2b1f('0x22'),_0x442350+'-'+_0x1515c8+'/'+_0x234881)[_0x2b1f('0x23')](_0x92340);}return null;};}function patchUpdates(_0x109ff8){return function(_0x4572f4){try{jsonpatch[_0x2b1f('0x24')](_0x4572f4,_0x109ff8,!![]);}catch(_0x367bb1){return BPromise[_0x2b1f('0x25')](_0x367bb1);}return _0x4572f4[_0x2b1f('0x26')]();};}function saveUpdates(_0x567ffd,_0x4b7f51){return function(_0x1abbbd){if(_0x1abbbd){return _0x1abbbd[_0x2b1f('0x27')](_0x567ffd)[_0x2b1f('0x28')](function(_0xa18b2d){return _0xa18b2d;});}return null;};}function removeEntity(_0x536ba9,_0x2a0c1c){return function(_0x257857){if(_0x257857){return _0x257857[_0x2b1f('0x29')]()[_0x2b1f('0x28')](function(){_0x536ba9[_0x2b1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0fdd,_0x165495){return function(_0x111196){if(!_0x111196){_0x3b0fdd[_0x2b1f('0x2a')](0x194);}return _0x111196;};}function handleError(_0x86fcec,_0x5286a1){_0x5286a1=_0x5286a1||0x1f4;return function(_0x49f3fe){logger[_0x2b1f('0x2b')](_0x49f3fe[_0x2b1f('0x2c')]);if(_0x49f3fe[_0x2b1f('0x2d')]){delete _0x49f3fe[_0x2b1f('0x2d')];}_0x86fcec[_0x2b1f('0x1e')](_0x5286a1)[_0x2b1f('0x2e')](_0x49f3fe);};}exports['index']=function(_0x3fdfb7,_0x15760b){var _0x3d1bc4={},_0x3028d7={},_0x33b7a8={'count':0x0,'rows':[]};var _0x563866=_[_0x2b1f('0x2f')](db[_0x2b1f('0x30')][_0x2b1f('0x31')],function(_0x25ab51){return{'name':_0x25ab51['fieldName'],'type':_0x25ab51[_0x2b1f('0x32')]['key']};});_0x3028d7['model']=_['map'](_0x563866,_0x2b1f('0x2d'));_0x3028d7[_0x2b1f('0x33')]=_['keys'](_0x3fdfb7[_0x2b1f('0x33')]);_0x3028d7[_0x2b1f('0x34')]=_[_0x2b1f('0x35')](_0x3028d7['model'],_0x3028d7[_0x2b1f('0x33')]);_0x3d1bc4['attributes']=_[_0x2b1f('0x35')](_0x3028d7[_0x2b1f('0x36')],qs['fields'](_0x3fdfb7['query'][_0x2b1f('0x37')]));_0x3d1bc4[_0x2b1f('0x38')]=_0x3d1bc4[_0x2b1f('0x38')][_0x2b1f('0x39')]?_0x3d1bc4['attributes']:_0x3028d7[_0x2b1f('0x36')];if(!_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3a')]('nolimit')){_0x3d1bc4[_0x2b1f('0x20')]=qs['limit'](_0x3fdfb7['query'][_0x2b1f('0x20')]);_0x3d1bc4[_0x2b1f('0x1f')]=qs['offset'](_0x3fdfb7['query']['offset']);}_0x3d1bc4[_0x2b1f('0x3b')]=qs['sort'](_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3c')]);_0x3d1bc4[_0x2b1f('0x3d')]=qs[_0x2b1f('0x34')](_[_0x2b1f('0x3e')](_0x3fdfb7['query'],_0x3028d7[_0x2b1f('0x34')]),_0x563866);if(_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3f')]){_0x3d1bc4['where']=_[_0x2b1f('0x40')](_0x3d1bc4[_0x2b1f('0x3d')],{'$or':_['map'](_0x563866,function(_0x4c7cb2){if(_0x4c7cb2['type']!=='VIRTUAL'){var _0x1f38a7={};_0x1f38a7[_0x4c7cb2[_0x2b1f('0x2d')]]={'$like':'%'+_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3f')]+'%'};return _0x1f38a7;}})});}_0x3d1bc4=_['merge']({},_0x3d1bc4,_0x3fdfb7[_0x2b1f('0x41')]);var _0x593896={'where':_0x3d1bc4['where']};return db['Dynamics365Field'][_0x2b1f('0x42')](_0x593896)[_0x2b1f('0x28')](function(_0x5b938a){_0x33b7a8[_0x2b1f('0x42')]=_0x5b938a;if(_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x43')]){_0x3d1bc4[_0x2b1f('0x44')]=[{'all':!![]}];}return db[_0x2b1f('0x30')][_0x2b1f('0x45')](_0x3d1bc4);})[_0x2b1f('0x28')](function(_0x262ec1){_0x33b7a8['rows']=_0x262ec1;return _0x33b7a8;})[_0x2b1f('0x28')](respondWithFilteredResult(_0x15760b,_0x3d1bc4))['catch'](handleError(_0x15760b,null));};exports['show']=function(_0x4d9f3c,_0x419f33){var _0x28f769={'raw':!![],'where':{'id':_0x4d9f3c[_0x2b1f('0x46')]['id']}},_0x5b3186={};_0x5b3186[_0x2b1f('0x36')]=_[_0x2b1f('0x47')](db[_0x2b1f('0x30')][_0x2b1f('0x31')]);_0x5b3186['query']=_['keys'](_0x4d9f3c[_0x2b1f('0x33')]);_0x5b3186['filters']=_[_0x2b1f('0x35')](_0x5b3186['model'],_0x5b3186[_0x2b1f('0x33')]);_0x28f769[_0x2b1f('0x38')]=_[_0x2b1f('0x35')](_0x5b3186[_0x2b1f('0x36')],qs[_0x2b1f('0x37')](_0x4d9f3c[_0x2b1f('0x33')][_0x2b1f('0x37')]));_0x28f769[_0x2b1f('0x38')]=_0x28f769[_0x2b1f('0x38')][_0x2b1f('0x39')]?_0x28f769[_0x2b1f('0x38')]:_0x5b3186[_0x2b1f('0x36')];if(_0x4d9f3c['query']['includeAll']){_0x28f769[_0x2b1f('0x44')]=[{'all':!![]}];}_0x28f769=_[_0x2b1f('0x40')]({},_0x28f769,_0x4d9f3c[_0x2b1f('0x41')]);return db[_0x2b1f('0x30')]['find'](_0x28f769)['then'](handleEntityNotFound(_0x419f33,null))[_0x2b1f('0x28')](respondWithResult(_0x419f33,null))[_0x2b1f('0x48')](handleError(_0x419f33,null));};exports[_0x2b1f('0x49')]=function(_0x51c8d1,_0x9cbbc9){return db[_0x2b1f('0x30')]['create'](_0x51c8d1['body'],{})[_0x2b1f('0x28')](respondWithResult(_0x9cbbc9,0xc9))['catch'](handleError(_0x9cbbc9,null));};exports[_0x2b1f('0x27')]=function(_0xcae09d,_0x584fe8){if(_0xcae09d[_0x2b1f('0x4a')]['id']){delete _0xcae09d[_0x2b1f('0x4a')]['id'];}return db[_0x2b1f('0x30')][_0x2b1f('0x4b')]({'where':{'id':_0xcae09d[_0x2b1f('0x46')]['id']}})['then'](handleEntityNotFound(_0x584fe8,null))[_0x2b1f('0x28')](saveUpdates(_0xcae09d[_0x2b1f('0x4a')],null))[_0x2b1f('0x28')](respondWithResult(_0x584fe8,null))['catch'](handleError(_0x584fe8,null));};exports[_0x2b1f('0x29')]=function(_0x4dd51c,_0x1e75ef){return db[_0x2b1f('0x30')][_0x2b1f('0x4b')]({'where':{'id':_0x4dd51c[_0x2b1f('0x46')]['id']}})[_0x2b1f('0x28')](handleEntityNotFound(_0x1e75ef,null))['then'](removeEntity(_0x1e75ef,null))['catch'](handleError(_0x1e75ef,null));}; \ No newline at end of file +var _0xa8f0=['show','params','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','reject','save','update','destroy','error','stack','send','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','Dynamics365Field','then','includeAll','include','catch'];(function(_0x2f32ef,_0x33e644){var _0x40a218=function(_0x49e1ff){while(--_0x49e1ff){_0x2f32ef['push'](_0x2f32ef['shift']());}};_0x40a218(++_0x33e644);}(_0xa8f0,0x123));var _0x0a8f=function(_0x1510c5,_0xde9022){_0x1510c5=_0x1510c5-0x0;var _0x433a86=_0xa8f0[_0x1510c5];return _0x433a86;};'use strict';var pdf=require(_0x0a8f('0x0'));var emlformat=require(_0x0a8f('0x1'));var rimraf=require(_0x0a8f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a8f('0x3'));var rp=require(_0x0a8f('0x4'));var moment=require(_0x0a8f('0x5'));var BPromise=require(_0x0a8f('0x6'));var Mustache=require(_0x0a8f('0x7'));var util=require(_0x0a8f('0x8'));var path=require(_0x0a8f('0x9'));var sox=require(_0x0a8f('0xa'));var csv=require(_0x0a8f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a8f('0xc'));var squel=require('squel');var crypto=require(_0x0a8f('0xd'));var jsforce=require(_0x0a8f('0xe'));var deskjs=require(_0x0a8f('0xf'));var toCsv=require(_0x0a8f('0xb'));var querystring=require(_0x0a8f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a8f('0x11'));var qs=require(_0x0a8f('0x12'));var as=require(_0x0a8f('0x13'));var hardwareService=require(_0x0a8f('0x14'));var logger=require(_0x0a8f('0x15'))('api');var utils=require(_0x0a8f('0x16'));var config=require(_0x0a8f('0x17'));var licenseUtil=require(_0x0a8f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ba5da,_0x197ca3){_0x197ca3=_0x197ca3||0xcc;return function(_0x323b78){if(_0x323b78){return _0x4ba5da[_0x0a8f('0x19')](_0x197ca3);}return _0x4ba5da[_0x0a8f('0x1a')](_0x197ca3)[_0x0a8f('0x1b')]();};}function respondWithResult(_0x39fcff,_0x260910){_0x260910=_0x260910||0xc8;return function(_0x180a70){if(_0x180a70){return _0x39fcff[_0x0a8f('0x1a')](_0x260910)['json'](_0x180a70);}};}function respondWithFilteredResult(_0x29c6fb,_0x195f48){return function(_0x73e614){if(_0x73e614){var _0xdcdc72=_0x73e614[_0x0a8f('0x1c')],_0x24e8c9=_0x195f48['offset'],_0xfe1492=_0x195f48[_0x0a8f('0x1d')]+_0x195f48[_0x0a8f('0x1e')],_0x445828;if(_0xfe1492>=_0xdcdc72){_0xfe1492=_0xdcdc72;_0x445828=0xc8;}else{_0x445828=0xce;}_0x29c6fb[_0x0a8f('0x1a')](_0x445828);return _0x29c6fb[_0x0a8f('0x1f')]('Content-Range',_0x24e8c9+'-'+_0xfe1492+'/'+_0xdcdc72)['json'](_0x73e614);}return null;};}function patchUpdates(_0x4e4c0a){return function(_0x582cf8){try{jsonpatch['apply'](_0x582cf8,_0x4e4c0a,!![]);}catch(_0x165b02){return BPromise[_0x0a8f('0x20')](_0x165b02);}return _0x582cf8[_0x0a8f('0x21')]();};}function saveUpdates(_0x4b23d0,_0x3a98b0){return function(_0x1d1e33){if(_0x1d1e33){return _0x1d1e33[_0x0a8f('0x22')](_0x4b23d0)['then'](function(_0x29b278){return _0x29b278;});}return null;};}function removeEntity(_0x2695e1,_0x5c530f){return function(_0x55c3d8){if(_0x55c3d8){return _0x55c3d8[_0x0a8f('0x23')]()['then'](function(){_0x2695e1[_0x0a8f('0x1a')](0xcc)[_0x0a8f('0x1b')]();});}};}function handleEntityNotFound(_0x46e786,_0x442b34){return function(_0x58f8a0){if(!_0x58f8a0){_0x46e786['sendStatus'](0x194);}return _0x58f8a0;};}function handleError(_0x3e421a,_0x150e77){_0x150e77=_0x150e77||0x1f4;return function(_0x507981){logger[_0x0a8f('0x24')](_0x507981[_0x0a8f('0x25')]);if(_0x507981['name']){delete _0x507981['name'];}_0x3e421a[_0x0a8f('0x1a')](_0x150e77)[_0x0a8f('0x26')](_0x507981);};}exports['index']=function(_0x55cf7a,_0xa6cebf){var _0x1b8b61={},_0x2f413e={},_0x202f92={'count':0x0,'rows':[]};var _0x3ae2bb=_['map'](db['Dynamics365Field']['rawAttributes'],function(_0x49f39f){return{'name':_0x49f39f['fieldName'],'type':_0x49f39f[_0x0a8f('0x27')][_0x0a8f('0x28')]};});_0x2f413e['model']=_['map'](_0x3ae2bb,_0x0a8f('0x29'));_0x2f413e[_0x0a8f('0x2a')]=_[_0x0a8f('0x2b')](_0x55cf7a[_0x0a8f('0x2a')]);_0x2f413e[_0x0a8f('0x2c')]=_[_0x0a8f('0x2d')](_0x2f413e[_0x0a8f('0x2e')],_0x2f413e[_0x0a8f('0x2a')]);_0x1b8b61['attributes']=_[_0x0a8f('0x2d')](_0x2f413e[_0x0a8f('0x2e')],qs[_0x0a8f('0x2f')](_0x55cf7a[_0x0a8f('0x2a')]['fields']));_0x1b8b61[_0x0a8f('0x30')]=_0x1b8b61['attributes']['length']?_0x1b8b61[_0x0a8f('0x30')]:_0x2f413e[_0x0a8f('0x2e')];if(!_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x31')](_0x0a8f('0x32'))){_0x1b8b61[_0x0a8f('0x1e')]=qs['limit'](_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x1e')]);_0x1b8b61[_0x0a8f('0x1d')]=qs[_0x0a8f('0x1d')](_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x1d')]);}_0x1b8b61['order']=qs[_0x0a8f('0x33')](_0x55cf7a['query']['sort']);_0x1b8b61['where']=qs[_0x0a8f('0x2c')](_[_0x0a8f('0x34')](_0x55cf7a[_0x0a8f('0x2a')],_0x2f413e['filters']),_0x3ae2bb);if(_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x35')]){_0x1b8b61[_0x0a8f('0x36')]=_[_0x0a8f('0x37')](_0x1b8b61['where'],{'$or':_[_0x0a8f('0x38')](_0x3ae2bb,function(_0x13eefd){if(_0x13eefd[_0x0a8f('0x27')]!==_0x0a8f('0x39')){var _0x3792ed={};_0x3792ed[_0x13eefd[_0x0a8f('0x29')]]={'$like':'%'+_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x35')]+'%'};return _0x3792ed;}})});}_0x1b8b61=_['merge']({},_0x1b8b61,_0x55cf7a[_0x0a8f('0x3a')]);var _0x1a29ca={'where':_0x1b8b61[_0x0a8f('0x36')]};return db[_0x0a8f('0x3b')][_0x0a8f('0x1c')](_0x1a29ca)[_0x0a8f('0x3c')](function(_0x5d844e){_0x202f92[_0x0a8f('0x1c')]=_0x5d844e;if(_0x55cf7a[_0x0a8f('0x2a')][_0x0a8f('0x3d')]){_0x1b8b61[_0x0a8f('0x3e')]=[{'all':!![]}];}return db[_0x0a8f('0x3b')]['findAll'](_0x1b8b61);})[_0x0a8f('0x3c')](function(_0x351241){_0x202f92['rows']=_0x351241;return _0x202f92;})[_0x0a8f('0x3c')](respondWithFilteredResult(_0xa6cebf,_0x1b8b61))[_0x0a8f('0x3f')](handleError(_0xa6cebf,null));};exports[_0x0a8f('0x40')]=function(_0x2be45c,_0x4c1cb8){var _0x1790b2={'raw':!![],'where':{'id':_0x2be45c[_0x0a8f('0x41')]['id']}},_0xfe67cb={};_0xfe67cb[_0x0a8f('0x2e')]=_[_0x0a8f('0x2b')](db[_0x0a8f('0x3b')][_0x0a8f('0x42')]);_0xfe67cb[_0x0a8f('0x2a')]=_[_0x0a8f('0x2b')](_0x2be45c[_0x0a8f('0x2a')]);_0xfe67cb[_0x0a8f('0x2c')]=_[_0x0a8f('0x2d')](_0xfe67cb[_0x0a8f('0x2e')],_0xfe67cb[_0x0a8f('0x2a')]);_0x1790b2[_0x0a8f('0x30')]=_[_0x0a8f('0x2d')](_0xfe67cb[_0x0a8f('0x2e')],qs[_0x0a8f('0x2f')](_0x2be45c[_0x0a8f('0x2a')][_0x0a8f('0x2f')]));_0x1790b2['attributes']=_0x1790b2[_0x0a8f('0x30')][_0x0a8f('0x43')]?_0x1790b2[_0x0a8f('0x30')]:_0xfe67cb[_0x0a8f('0x2e')];if(_0x2be45c[_0x0a8f('0x2a')][_0x0a8f('0x3d')]){_0x1790b2['include']=[{'all':!![]}];}_0x1790b2=_[_0x0a8f('0x37')]({},_0x1790b2,_0x2be45c[_0x0a8f('0x3a')]);return db[_0x0a8f('0x3b')][_0x0a8f('0x44')](_0x1790b2)['then'](handleEntityNotFound(_0x4c1cb8,null))['then'](respondWithResult(_0x4c1cb8,null))['catch'](handleError(_0x4c1cb8,null));};exports[_0x0a8f('0x45')]=function(_0x14ba79,_0x143829){return db['Dynamics365Field']['create'](_0x14ba79[_0x0a8f('0x46')],{})[_0x0a8f('0x3c')](respondWithResult(_0x143829,0xc9))[_0x0a8f('0x3f')](handleError(_0x143829,null));};exports['update']=function(_0x53fe2b,_0xb6e247){if(_0x53fe2b[_0x0a8f('0x46')]['id']){delete _0x53fe2b[_0x0a8f('0x46')]['id'];}return db[_0x0a8f('0x3b')]['find']({'where':{'id':_0x53fe2b['params']['id']}})[_0x0a8f('0x3c')](handleEntityNotFound(_0xb6e247,null))[_0x0a8f('0x3c')](saveUpdates(_0x53fe2b[_0x0a8f('0x46')],null))[_0x0a8f('0x3c')](respondWithResult(_0xb6e247,null))[_0x0a8f('0x3f')](handleError(_0xb6e247,null));};exports['destroy']=function(_0xc86c0a,_0x4a211c){return db[_0x0a8f('0x3b')]['find']({'where':{'id':_0xc86c0a[_0x0a8f('0x41')]['id']}})[_0x0a8f('0x3c')](handleEntityNotFound(_0x4a211c,null))[_0x0a8f('0x3c')](removeEntity(_0x4a211c,null))[_0x0a8f('0x3f')](handleError(_0x4a211c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 93a843f..b37108e 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 _0xe73c=['rimraf','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0x54e761,_0x3375a8){var _0x19eb4d=function(_0xaefa57){while(--_0xaefa57){_0x54e761['push'](_0x54e761['shift']());}};_0x19eb4d(++_0x3375a8);}(_0xe73c,0xa3));var _0xce73=function(_0x23dfe1,_0x63bde7){_0x23dfe1=_0x23dfe1-0x0;var _0x65807e=_0xe73c[_0x23dfe1];return _0x65807e;};'use strict';var _=require(_0xce73('0x0'));var util=require(_0xce73('0x1'));var logger=require(_0xce73('0x2'))(_0xce73('0x3'));var moment=require('moment');var BPromise=require(_0xce73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce73('0x5'));var config=require(_0xce73('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0xce73('0x7')]=function(_0x5ef3fd,_0x2daaae){return _0x5ef3fd[_0xce73('0x8')]('Dynamics365Field',attributes,{'tableName':_0xce73('0x9'),'paranoid':![],'indexes':[{'name':_0xce73('0xa'),'fields':[_0xce73('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9aed=['idField','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x9aed,0x79));var _0xd9ae=function(_0x484ed3,_0xe74b3e){_0x484ed3=_0x484ed3-0x0;var _0x4c6a7a=_0x9aed[_0x484ed3];return _0x4c6a7a;};'use strict';var _=require(_0xd9ae('0x0'));var util=require(_0xd9ae('0x1'));var logger=require('../../config/logger')(_0xd9ae('0x2'));var moment=require(_0xd9ae('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9ae('0x4'));var fs=require('fs');var path=require(_0xd9ae('0x5'));var rimraf=require(_0xd9ae('0x6'));var config=require(_0xd9ae('0x7'));var attributes=require(_0xd9ae('0x8'));module['exports']=function(_0x18746d,_0x29abe5){return _0x18746d[_0xd9ae('0x9')](_0xd9ae('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xd9ae('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index dd657b6..ec01412 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 _0x32f4=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x48c612,_0x432076){var _0x5f0583=function(_0x2ebc92){while(--_0x2ebc92){_0x48c612['push'](_0x48c612['shift']());}};_0x5f0583(++_0x432076);}(_0x32f4,0x154));var _0x432f=function(_0x5df41f,_0x5b4d75){_0x5df41f=_0x5df41f-0x0;var _0x4a3a8c=_0x32f4[_0x5df41f];return _0x4a3a8c;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file +var _0xfd2e=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xfd2e,0x6e));var _0xefd2=function(_0x5f0644,_0x217385){_0x5f0644=_0x5f0644-0x0;var _0x29e6eb=_0xfd2e[_0x5f0644];return _0x29e6eb;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var moment=require(_0xefd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefd2('0x3'))['db'];var utils=require(_0xefd2('0x4'));var logger=require(_0xefd2('0x5'))(_0xefd2('0x6'));var config=require(_0xefd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516aab,_0x51fab0,_0x43d90b){return new BPromise(function(_0x50dd63,_0x440d11){return client[_0xefd2('0x9')](_0x516aab,_0x43d90b)[_0xefd2('0xa')](function(_0xded765){logger[_0xefd2('0xb')](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));logger['debug'](_0xefd2('0xe'),_0x51fab0,_0xefd2('0xd'),JSON[_0xefd2('0xf')](_0xded765));if(_0xded765[_0xefd2('0x10')]){if(_0xded765[_0xefd2('0x10')][_0xefd2('0x11')]===0x1f4){logger[_0xefd2('0x10')](_0xefd2('0xc'),_0x51fab0,_0xded765['error']['message']);return _0x440d11(_0xded765[_0xefd2('0x10')]['message']);}logger['error'](_0xefd2('0xc'),_0x51fab0,_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);return _0x50dd63(_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);}else{logger['info'](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));_0x50dd63(_0xded765[_0xefd2('0x13')][_0xefd2('0x12')]);}})[_0xefd2('0x14')](function(_0x471e3b){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x51fab0,_0x471e3b);_0x440d11(_0x471e3b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 64c2bd3..d5f3a2c 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 _0xe270=['post','put','update','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe270,0x81));var _0x0e27=function(_0x13fa94,_0x2bd312){_0x13fa94=_0x13fa94-0x0;var _0x31bca3=_0xe270[_0x13fa94];return _0x31bca3;};'use strict';var multer=require(_0x0e27('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e27('0x1'));var express=require(_0x0e27('0x2'));var router=express[_0x0e27('0x3')]();var auth=require(_0x0e27('0x4'));var interaction=require(_0x0e27('0x5'));var config=require(_0x0e27('0x6'));var controller=require(_0x0e27('0x7'));router[_0x0e27('0x8')]('/',auth[_0x0e27('0x9')](),controller[_0x0e27('0xa')]);router[_0x0e27('0x8')](_0x0e27('0xb'),auth[_0x0e27('0x9')](),controller[_0x0e27('0xc')]);router[_0x0e27('0x8')](_0x0e27('0xd'),auth['isAuthenticated'](),controller[_0x0e27('0xe')]);router['get'](_0x0e27('0xf'),auth[_0x0e27('0x9')](),controller[_0x0e27('0x10')]);router['post']('/',auth[_0x0e27('0x9')](),controller[_0x0e27('0x11')]);router[_0x0e27('0x12')](_0x0e27('0xd'),auth[_0x0e27('0x9')](),controller['addConfiguration']);router[_0x0e27('0x13')](_0x0e27('0xb'),auth[_0x0e27('0x9')](),controller[_0x0e27('0x14')]);router['delete'](_0x0e27('0xb'),auth[_0x0e27('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x44a9=['update','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x44a9,0x1dc));var _0x944a=function(_0x458ce4,_0x260c18){_0x458ce4=_0x458ce4-0x0;var _0x500527=_0x44a9[_0x458ce4];return _0x500527;};'use strict';var multer=require(_0x944a('0x0'));var util=require('util');var path=require(_0x944a('0x1'));var timeout=require(_0x944a('0x2'));var express=require('express');var router=express[_0x944a('0x3')]();var auth=require(_0x944a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x944a('0x5'));var controller=require(_0x944a('0x6'));router['get']('/',auth[_0x944a('0x7')](),controller[_0x944a('0x8')]);router[_0x944a('0x9')](_0x944a('0xa'),auth[_0x944a('0x7')](),controller[_0x944a('0xb')]);router[_0x944a('0x9')]('/:id/configurations',auth[_0x944a('0x7')](),controller[_0x944a('0xc')]);router[_0x944a('0x9')](_0x944a('0xd'),auth[_0x944a('0x7')](),controller['getFields']);router[_0x944a('0xe')]('/',auth[_0x944a('0x7')](),controller[_0x944a('0xf')]);router[_0x944a('0xe')](_0x944a('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x944a('0x11')](_0x944a('0xa'),auth[_0x944a('0x7')](),controller[_0x944a('0x12')]);router['delete'](_0x944a('0xa'),auth[_0x944a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d9d3895..626c7e9 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 _0x4c17=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5d28cb,_0x248511){var _0x297c51=function(_0x439266){while(--_0x439266){_0x5d28cb['push'](_0x5d28cb['shift']());}};_0x297c51(++_0x248511);}(_0x4c17,0x12d));var _0x74c1=function(_0x497c75,_0x3ac07a){_0x497c75=_0x497c75-0x0;var _0x23a542=_0x4c17[_0x497c75];return _0x23a542;};'use strict';var Sequelize=require(_0x74c1('0x0'));module[_0x74c1('0x1')]={'name':{'type':Sequelize[_0x74c1('0x2')]},'description':{'type':Sequelize[_0x74c1('0x2')]},'username':{'type':Sequelize[_0x74c1('0x2')],'unique':_0x74c1('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74c1('0x2')],'unique':_0x74c1('0x4')},'serverUrl':{'type':Sequelize[_0x74c1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x73b9=['remoteUri','sequelize','exports','STRING','username'];(function(_0x126a77,_0x253795){var _0x4a73ea=function(_0x1cec18){while(--_0x1cec18){_0x126a77['push'](_0x126a77['shift']());}};_0x4a73ea(++_0x253795);}(_0x73b9,0xc4));var _0x973b=function(_0x2835ae,_0x112c51){_0x2835ae=_0x2835ae-0x0;var _0x47d350=_0x73b9[_0x2835ae];return _0x47d350;};'use strict';var Sequelize=require(_0x973b('0x0'));module[_0x973b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x973b('0x2')]},'username':{'type':Sequelize[_0x973b('0x2')],'unique':_0x973b('0x3')},'apiKey':{'type':Sequelize[_0x973b('0x2')]},'remoteUri':{'type':Sequelize[_0x973b('0x2')],'unique':_0x973b('0x4')},'serverUrl':{'type':Sequelize[_0x973b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index e346058..d7a1518 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 _0xccd8=['map','FreshdeskAccount','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','rows','show','options','create','body','find','params','getConfigurations','FreshdeskConfiguration','rawAttributes','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','subject','description','priority','source','ticket_type','group','company','includes','default','custom_dropdown','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','count','offset','limit','set','then','destroy','name','send','index'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xccd8,0x12c));var _0x8ccd=function(_0x3caf7f,_0x2ee0da){_0x3caf7f=_0x3caf7f-0x0;var _0x8fc9b5=_0xccd8[_0x3caf7f];return _0x8fc9b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ccd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ccd('0x1'));var moment=require('moment');var BPromise=require(_0x8ccd('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8ccd('0x3'));var sox=require(_0x8ccd('0x4'));var csv=require(_0x8ccd('0x5'));var ejs=require(_0x8ccd('0x6'));var fs=require('fs');var _=require(_0x8ccd('0x7'));var squel=require(_0x8ccd('0x8'));var crypto=require(_0x8ccd('0x9'));var jsforce=require(_0x8ccd('0xa'));var deskjs=require(_0x8ccd('0xb'));var toCsv=require(_0x8ccd('0x5'));var querystring=require(_0x8ccd('0xc'));var Papa=require(_0x8ccd('0xd'));var Redis=require(_0x8ccd('0xe'));var authService=require(_0x8ccd('0xf'));var qs=require(_0x8ccd('0x10'));var as=require(_0x8ccd('0x11'));var hardwareService=require(_0x8ccd('0x12'));var logger=require(_0x8ccd('0x13'))(_0x8ccd('0x14'));var utils=require(_0x8ccd('0x15'));var config=require(_0x8ccd('0x16'));var licenseUtil=require(_0x8ccd('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8ccd('0x18'));var jayson=require(_0x8ccd('0x19'));var client=jayson['client'][_0x8ccd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3edcf2,_0x2419b7,_0x4a03b1,_0x2c501d){return new BPromise(function(_0xae8b13,_0x232b88){var _0x2e1abc=_0x2c501d||client;return _0x2e1abc['request'](_0x3edcf2,_0x4a03b1)['then'](function(_0x2fc107){logger[_0x8ccd('0x1b')](_0x8ccd('0x1c'),_0x2419b7,_0x8ccd('0x1d'));logger['debug'](_0x8ccd('0x1e'),_0x2419b7,_0x8ccd('0x1d'),JSON['stringify'](_0x2fc107));if(_0x2fc107[_0x8ccd('0x1f')]){if(_0x2fc107['error'][_0x8ccd('0x20')]===0x1f4){logger[_0x8ccd('0x1f')](_0x8ccd('0x1c'),_0x2419b7,_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);return _0x232b88(_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);}logger[_0x8ccd('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x2419b7,_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);return _0xae8b13(_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);}else{logger['info'](_0x8ccd('0x1c'),_0x2419b7,_0x8ccd('0x1d'));_0xae8b13(_0x2fc107[_0x8ccd('0x22')][_0x8ccd('0x21')]);}})[_0x8ccd('0x23')](function(_0x597d9a){logger[_0x8ccd('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x2419b7,_0x597d9a);_0x232b88(_0x597d9a);});});}function respondWithStatusCode(_0x39be1f,_0x15bc08){_0x15bc08=_0x15bc08||0xcc;return function(_0x3b16d1){if(_0x3b16d1){return _0x39be1f['sendStatus'](_0x15bc08);}return _0x39be1f['status'](_0x15bc08)[_0x8ccd('0x24')]();};}function respondWithResult(_0xe79da4,_0x108de9){_0x108de9=_0x108de9||0xc8;return function(_0x145644){if(_0x145644){return _0xe79da4[_0x8ccd('0x25')](_0x108de9)[_0x8ccd('0x26')](_0x145644);}};}function respondWithFilteredResult(_0x4fef38,_0x4dc829){return function(_0xa641f1){if(_0xa641f1){var _0xfdd3a7=_0xa641f1[_0x8ccd('0x27')],_0x59838e=_0x4dc829[_0x8ccd('0x28')],_0x3f9a79=_0x4dc829[_0x8ccd('0x28')]+_0x4dc829[_0x8ccd('0x29')],_0x1d5a75;if(_0x3f9a79>=_0xfdd3a7){_0x3f9a79=_0xfdd3a7;_0x1d5a75=0xc8;}else{_0x1d5a75=0xce;}_0x4fef38[_0x8ccd('0x25')](_0x1d5a75);return _0x4fef38[_0x8ccd('0x2a')]('Content-Range',_0x59838e+'-'+_0x3f9a79+'/'+_0xfdd3a7)[_0x8ccd('0x26')](_0xa641f1);}return null;};}function patchUpdates(_0x51b652){return function(_0x562950){try{jsonpatch['apply'](_0x562950,_0x51b652,!![]);}catch(_0x451252){return BPromise['reject'](_0x451252);}return _0x562950['save']();};}function saveUpdates(_0x28893f,_0x292686){return function(_0xb9bdbf){if(_0xb9bdbf){return _0xb9bdbf['update'](_0x28893f)[_0x8ccd('0x2b')](function(_0xa03012){return _0xa03012;});}return null;};}function removeEntity(_0x136983,_0x4e1b60){return function(_0x103646){if(_0x103646){return _0x103646[_0x8ccd('0x2c')]()[_0x8ccd('0x2b')](function(){_0x136983[_0x8ccd('0x25')](0xcc)[_0x8ccd('0x24')]();});}};}function handleEntityNotFound(_0x19104c,_0x4ddeec){return function(_0x2fe9d2){if(!_0x2fe9d2){_0x19104c['sendStatus'](0x194);}return _0x2fe9d2;};}function handleError(_0x599ed9,_0x2e8fdc){_0x2e8fdc=_0x2e8fdc||0x1f4;return function(_0x4ac98c){logger[_0x8ccd('0x1f')](_0x4ac98c['stack']);if(_0x4ac98c[_0x8ccd('0x2d')]){delete _0x4ac98c[_0x8ccd('0x2d')];}_0x599ed9[_0x8ccd('0x25')](_0x2e8fdc)[_0x8ccd('0x2e')](_0x4ac98c);};}exports[_0x8ccd('0x2f')]=function(_0x2abdbb,_0x43d7d7){var _0x205735={},_0x3fbdf1={},_0x5e826a={'count':0x0,'rows':[]};var _0x151cd9=_[_0x8ccd('0x30')](db[_0x8ccd('0x31')]['rawAttributes'],function(_0x5eb342){return{'name':_0x5eb342[_0x8ccd('0x32')],'type':_0x5eb342[_0x8ccd('0x33')]['key']};});_0x3fbdf1[_0x8ccd('0x34')]=_[_0x8ccd('0x30')](_0x151cd9,_0x8ccd('0x2d'));_0x3fbdf1['query']=_[_0x8ccd('0x35')](_0x2abdbb['query']);_0x3fbdf1[_0x8ccd('0x36')]=_[_0x8ccd('0x37')](_0x3fbdf1[_0x8ccd('0x34')],_0x3fbdf1[_0x8ccd('0x38')]);_0x205735[_0x8ccd('0x39')]=_['intersection'](_0x3fbdf1[_0x8ccd('0x34')],qs[_0x8ccd('0x3a')](_0x2abdbb['query']['fields']));_0x205735[_0x8ccd('0x39')]=_0x205735[_0x8ccd('0x39')][_0x8ccd('0x3b')]?_0x205735[_0x8ccd('0x39')]:_0x3fbdf1['model'];if(!_0x2abdbb[_0x8ccd('0x38')][_0x8ccd('0x3c')](_0x8ccd('0x3d'))){_0x205735[_0x8ccd('0x29')]=qs[_0x8ccd('0x29')](_0x2abdbb[_0x8ccd('0x38')][_0x8ccd('0x29')]);_0x205735[_0x8ccd('0x28')]=qs[_0x8ccd('0x28')](_0x2abdbb['query'][_0x8ccd('0x28')]);}_0x205735[_0x8ccd('0x3e')]=qs[_0x8ccd('0x3f')](_0x2abdbb[_0x8ccd('0x38')]['sort']);_0x205735[_0x8ccd('0x40')]=qs[_0x8ccd('0x36')](_['pick'](_0x2abdbb[_0x8ccd('0x38')],_0x3fbdf1[_0x8ccd('0x36')]),_0x151cd9);if(_0x2abdbb['query']['filter']){_0x205735[_0x8ccd('0x40')]=_[_0x8ccd('0x41')](_0x205735[_0x8ccd('0x40')],{'$or':_[_0x8ccd('0x30')](_0x151cd9,function(_0x5df542){if(_0x5df542[_0x8ccd('0x33')]!=='VIRTUAL'){var _0x1e764c={};_0x1e764c[_0x5df542[_0x8ccd('0x2d')]]={'$like':'%'+_0x2abdbb['query'][_0x8ccd('0x42')]+'%'};return _0x1e764c;}})});}_0x205735=_['merge']({},_0x205735,_0x2abdbb['options']);var _0x3f46ca={'where':_0x205735['where']};return db['FreshdeskAccount'][_0x8ccd('0x27')](_0x3f46ca)['then'](function(_0x4eda3a){_0x5e826a[_0x8ccd('0x27')]=_0x4eda3a;if(_0x2abdbb[_0x8ccd('0x38')]['includeAll']){_0x205735[_0x8ccd('0x43')]=[{'all':!![]}];}return db[_0x8ccd('0x31')]['findAll'](_0x205735);})[_0x8ccd('0x2b')](function(_0x2d0a0c){_0x5e826a[_0x8ccd('0x44')]=_0x2d0a0c;return _0x5e826a;})[_0x8ccd('0x2b')](respondWithFilteredResult(_0x43d7d7,_0x205735))[_0x8ccd('0x23')](handleError(_0x43d7d7,null));};exports[_0x8ccd('0x45')]=function(_0x36b0ab,_0x350535){var _0x16b88b={'raw':![],'where':{'id':_0x36b0ab['params']['id']}},_0x5a1fbb={};_0x5a1fbb[_0x8ccd('0x34')]=_[_0x8ccd('0x35')](db[_0x8ccd('0x31')]['rawAttributes']);_0x5a1fbb['query']=_[_0x8ccd('0x35')](_0x36b0ab[_0x8ccd('0x38')]);_0x5a1fbb[_0x8ccd('0x36')]=_[_0x8ccd('0x37')](_0x5a1fbb['model'],_0x5a1fbb[_0x8ccd('0x38')]);_0x16b88b[_0x8ccd('0x39')]=_['intersection'](_0x5a1fbb['model'],qs[_0x8ccd('0x3a')](_0x36b0ab[_0x8ccd('0x38')]['fields']));_0x16b88b['attributes']=_0x16b88b[_0x8ccd('0x39')][_0x8ccd('0x3b')]?_0x16b88b[_0x8ccd('0x39')]:_0x5a1fbb[_0x8ccd('0x34')];if(_0x36b0ab['query']['includeAll']){_0x16b88b[_0x8ccd('0x43')]=[{'all':!![]}];}_0x16b88b=_[_0x8ccd('0x41')]({},_0x16b88b,_0x36b0ab[_0x8ccd('0x46')]);return db['FreshdeskAccount']['find'](_0x16b88b)[_0x8ccd('0x2b')](handleEntityNotFound(_0x350535,null))[_0x8ccd('0x2b')](respondWithResult(_0x350535,null))['catch'](handleError(_0x350535,null));};exports[_0x8ccd('0x47')]=function(_0x444699,_0x16f900){return db[_0x8ccd('0x31')]['create'](_0x444699[_0x8ccd('0x48')],{})[_0x8ccd('0x2b')](respondWithResult(_0x16f900,0xc9))[_0x8ccd('0x23')](handleError(_0x16f900,null));};exports['update']=function(_0x2ed10c,_0x3f2447){if(_0x2ed10c[_0x8ccd('0x48')]['id']){delete _0x2ed10c[_0x8ccd('0x48')]['id'];}return db[_0x8ccd('0x31')][_0x8ccd('0x49')]({'where':{'id':_0x2ed10c[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x3f2447,null))[_0x8ccd('0x2b')](saveUpdates(_0x2ed10c[_0x8ccd('0x48')],null))[_0x8ccd('0x2b')](respondWithResult(_0x3f2447,null))[_0x8ccd('0x23')](handleError(_0x3f2447,null));};exports[_0x8ccd('0x2c')]=function(_0x1ddb5a,_0x192f5b){return db[_0x8ccd('0x31')][_0x8ccd('0x49')]({'where':{'id':_0x1ddb5a[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x192f5b,null))['then'](removeEntity(_0x192f5b,null))[_0x8ccd('0x23')](handleError(_0x192f5b,null));};exports[_0x8ccd('0x4b')]=function(_0x59dc0d,_0x4a957d,_0x44db47){var _0x2890ed={};var _0x17460a={};var _0x2df37c;var _0x13aa41;return db[_0x8ccd('0x31')]['findOne']({'where':{'id':_0x59dc0d[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x4a957d,null))[_0x8ccd('0x2b')](function(_0xe2a04c){if(_0xe2a04c){_0x2df37c=_0xe2a04c;_0x17460a[_0x8ccd('0x34')]=_[_0x8ccd('0x35')](db[_0x8ccd('0x4c')][_0x8ccd('0x4d')]);_0x17460a['query']=_[_0x8ccd('0x35')](_0x59dc0d[_0x8ccd('0x38')]);_0x17460a[_0x8ccd('0x36')]=_[_0x8ccd('0x37')](_0x17460a[_0x8ccd('0x34')],_0x17460a[_0x8ccd('0x38')]);_0x2890ed[_0x8ccd('0x39')]=_[_0x8ccd('0x37')](_0x17460a['model'],qs[_0x8ccd('0x3a')](_0x59dc0d[_0x8ccd('0x38')][_0x8ccd('0x3a')]));_0x2890ed[_0x8ccd('0x39')]=_0x2890ed[_0x8ccd('0x39')][_0x8ccd('0x3b')]?_0x2890ed[_0x8ccd('0x39')]:_0x17460a[_0x8ccd('0x34')];_0x2890ed[_0x8ccd('0x3e')]=qs['sort'](_0x59dc0d['query'][_0x8ccd('0x3f')]);_0x2890ed['where']=qs[_0x8ccd('0x36')](_[_0x8ccd('0x4e')](_0x59dc0d[_0x8ccd('0x38')],_0x17460a[_0x8ccd('0x36')]));if(_0x59dc0d['query'][_0x8ccd('0x42')]){_0x2890ed[_0x8ccd('0x40')]=_[_0x8ccd('0x41')](_0x2890ed['where'],{'$or':_[_0x8ccd('0x30')](_0x2890ed[_0x8ccd('0x39')],function(_0x3cf809){var _0x421a5e={};_0x421a5e[_0x3cf809]={'$like':'%'+_0x59dc0d['query']['filter']+'%'};return _0x421a5e;})});}_0x2890ed=_[_0x8ccd('0x41')]({},_0x2890ed,_0x59dc0d[_0x8ccd('0x46')]);return _0x2df37c[_0x8ccd('0x4b')](_0x2890ed);}})[_0x8ccd('0x2b')](function(_0x2dae86){if(_0x2dae86){_0x13aa41=_0x2dae86[_0x8ccd('0x3b')];if(!_0x59dc0d[_0x8ccd('0x38')][_0x8ccd('0x3c')](_0x8ccd('0x3d'))){_0x2890ed['limit']=qs[_0x8ccd('0x29')](_0x59dc0d[_0x8ccd('0x38')][_0x8ccd('0x29')]);_0x2890ed[_0x8ccd('0x28')]=qs[_0x8ccd('0x28')](_0x59dc0d[_0x8ccd('0x38')]['offset']);}return _0x2df37c[_0x8ccd('0x4b')](_0x2890ed);}})[_0x8ccd('0x2b')](function(_0x2bbd73){if(_0x2bbd73){return _0x2bbd73?{'count':_0x13aa41,'rows':_0x2bbd73}:null;}})[_0x8ccd('0x2b')](respondWithResult(_0x4a957d,null))[_0x8ccd('0x23')](handleError(_0x4a957d,null));};exports[_0x8ccd('0x4f')]=function(_0x39fb6f,_0x17261a,_0x2dddd1){if(_0x39fb6f[_0x8ccd('0x48')]['id']){delete _0x39fb6f['body']['id'];}return db[_0x8ccd('0x31')][_0x8ccd('0x50')]({'where':{'id':_0x39fb6f[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x17261a,null))['then'](function(_0x504e32){if(_0x504e32){_0x39fb6f['body'][_0x8ccd('0x51')]=_0x504e32['id'];_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x52')]=integrations[_0x8ccd('0x53')](_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x54')],_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x33')]);_0x39fb6f[_0x8ccd('0x48')]['Descriptions']=integrations[_0x8ccd('0x55')](_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x54')],_0x39fb6f['body']['type']);return db[_0x8ccd('0x4c')][_0x8ccd('0x47')](_0x39fb6f[_0x8ccd('0x48')],{'include':[{'model':db[_0x8ccd('0x56')],'as':_0x8ccd('0x52')},{'model':db[_0x8ccd('0x56')],'as':_0x8ccd('0x57')}]});}return null;})[_0x8ccd('0x2b')](respondWithResult(_0x17261a,null))['catch'](handleError(_0x17261a,null));};exports[_0x8ccd('0x58')]=function(_0x4f0a17,_0xb461e6,_0x37bf90){var _0x5e4a2f='';return db[_0x8ccd('0x31')]['findOne']({'where':{'id':_0x4f0a17[_0x8ccd('0x4a')]['id']},'attributes':['id',_0x8ccd('0x59'),_0x8ccd('0x5a')]})[_0x8ccd('0x2b')](handleEntityNotFound(_0xb461e6,null))['then'](function(_0x2ccd58){if(_0x2ccd58){_0x5e4a2f=_0x2ccd58[_0x8ccd('0x59')];var _0x101cf9=_0x5e4a2f[_0x8ccd('0x5b')](-0x1);if(_0x101cf9==='/'){_0x5e4a2f=_0x5e4a2f[_0x8ccd('0x5c')](0x0,_0x5e4a2f['lastIndexOf'](_0x101cf9));}return rp({'method':_0x8ccd('0x5d'),'uri':util['format'](_0x8ccd('0x5e'),_0x5e4a2f,_0x8ccd('0x5f')),'headers':{'Authorization':util[_0x8ccd('0x60')](_0x8ccd('0x61'),new Buffer(util[_0x8ccd('0x60')](_0x8ccd('0x62'),_0x2ccd58['apiKey']))[_0x8ccd('0x63')]('base64'))},'json':!![]});}})[_0x8ccd('0x2b')](function(_0x41389d){if(_0x41389d){var _0x2d3d92=['requester',_0x8ccd('0x64'),'agent',_0x8ccd('0x65'),'status',_0x8ccd('0x66'),'group',_0x8ccd('0x67'),_0x8ccd('0x68'),_0x8ccd('0x69'),_0x8ccd('0x6a')];_['remove'](_0x41389d,function(_0x336e96){return _0x2d3d92[_0x8ccd('0x6b')](_0x336e96[_0x8ccd('0x2d')])||!_0x336e96[_0x8ccd('0x6c')]&&_0x336e96['type']!=='custom_text'&&_0x336e96['type']!==_0x8ccd('0x6d');});return{'count':_0x41389d[_0x8ccd('0x3b')],'rows':_[_0x8ccd('0x30')](_0x41389d,function(_0x56a539){return{'id':_0x56a539[_0x8ccd('0x2d')],'name':_0x56a539['label'],'custom':!_0x56a539['default'],'options':_0x56a539[_0x8ccd('0x6e')]?_[_0x8ccd('0x30')](_0x56a539[_0x8ccd('0x6e')],function(_0x443d57){return{'name':_[_0x8ccd('0x6f')](_0x443d57),'value':_0x443d57};}):[]};})};}})[_0x8ccd('0x2b')](respondWithResult(_0xb461e6,null))[_0x8ccd('0x23')](function(_0x3583dc){var _0x50dfa4=_0x4f0a17[_0x8ccd('0x38')]['test']?0x1f4:_0x3583dc['statusCode']||0x1f4;logger['error'](_0x8ccd('0x70'),_0x8ccd('0x58'),_0x50dfa4,JSON[_0x8ccd('0x71')](_0x3583dc));delete _0x3583dc[_0x8ccd('0x2d')];if(_0x50dfa4===0x191){_0x50dfa4=0x190;}_0xb461e6[_0x8ccd('0x25')](_0x50dfa4)[_0x8ccd('0x2e')](_0x4f0a17[_0x8ccd('0x38')][_0x8ccd('0x72')]?{'message':_0x8ccd('0x73'),'statusCode':_0x3583dc['statusCode']}:_0x3583dc);});}; \ No newline at end of file +var _0x78a0=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','map','VIRTUAL','filter','merge','options','findAll','rows','show','params','include','find','catch','create','body','findOne','FreshdeskConfiguration','pick','getConfigurations','addConfiguration','AccountId','channel','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','ticket_type','group','company','remove','default','custom_dropdown','choices','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','request','then','info'];(function(_0x5222e9,_0x146f5a){var _0x3e4bfc=function(_0x5d03d3){while(--_0x5d03d3){_0x5222e9['push'](_0x5222e9['shift']());}};_0x3e4bfc(++_0x146f5a);}(_0x78a0,0x1d1));var _0x078a=function(_0x3e9b06,_0x417393){_0x3e9b06=_0x3e9b06-0x0;var _0x442af8=_0x78a0[_0x3e9b06];return _0x442af8;};'use strict';var pdf=require(_0x078a('0x0'));var emlformat=require(_0x078a('0x1'));var rimraf=require(_0x078a('0x2'));var zipdir=require(_0x078a('0x3'));var jsonpatch=require(_0x078a('0x4'));var rp=require(_0x078a('0x5'));var moment=require(_0x078a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x078a('0x7'));var util=require(_0x078a('0x8'));var path=require('path');var sox=require(_0x078a('0x9'));var csv=require(_0x078a('0xa'));var ejs=require(_0x078a('0xb'));var fs=require('fs');var _=require(_0x078a('0xc'));var squel=require(_0x078a('0xd'));var crypto=require(_0x078a('0xe'));var jsforce=require(_0x078a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x078a('0xa'));var querystring=require(_0x078a('0x10'));var Papa=require(_0x078a('0x11'));var Redis=require(_0x078a('0x12'));var authService=require(_0x078a('0x13'));var qs=require(_0x078a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x078a('0x15'));var logger=require(_0x078a('0x16'))(_0x078a('0x17'));var utils=require('../../config/utils');var config=require(_0x078a('0x18'));var licenseUtil=require(_0x078a('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x078a('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x078a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x268e3d,_0xbfdf8d,_0x3a8df3,_0xeeab60){return new BPromise(function(_0x4f9a93,_0x1f6007){var _0x3b83fc=_0xeeab60||client;return _0x3b83fc[_0x078a('0x1c')](_0x268e3d,_0x3a8df3)[_0x078a('0x1d')](function(_0x468ec8){logger[_0x078a('0x1e')](_0x078a('0x1f'),_0xbfdf8d,_0x078a('0x20'));logger[_0x078a('0x21')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xbfdf8d,_0x078a('0x20'),JSON[_0x078a('0x22')](_0x468ec8));if(_0x468ec8[_0x078a('0x23')]){if(_0x468ec8[_0x078a('0x23')][_0x078a('0x24')]===0x1f4){logger[_0x078a('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0xbfdf8d,_0x468ec8['error'][_0x078a('0x25')]);return _0x1f6007(_0x468ec8[_0x078a('0x23')][_0x078a('0x25')]);}logger[_0x078a('0x23')](_0x078a('0x1f'),_0xbfdf8d,_0x468ec8[_0x078a('0x23')][_0x078a('0x25')]);return _0x4f9a93(_0x468ec8[_0x078a('0x23')][_0x078a('0x25')]);}else{logger['info'](_0x078a('0x1f'),_0xbfdf8d,_0x078a('0x20'));_0x4f9a93(_0x468ec8[_0x078a('0x26')][_0x078a('0x25')]);}})['catch'](function(_0x2899a8){logger[_0x078a('0x23')](_0x078a('0x1f'),_0xbfdf8d,_0x2899a8);_0x1f6007(_0x2899a8);});});}function respondWithStatusCode(_0x2bb024,_0x548db3){_0x548db3=_0x548db3||0xcc;return function(_0x1330bb){if(_0x1330bb){return _0x2bb024[_0x078a('0x27')](_0x548db3);}return _0x2bb024['status'](_0x548db3)[_0x078a('0x28')]();};}function respondWithResult(_0x16f45a,_0x2618dd){_0x2618dd=_0x2618dd||0xc8;return function(_0x340195){if(_0x340195){return _0x16f45a[_0x078a('0x29')](_0x2618dd)['json'](_0x340195);}};}function respondWithFilteredResult(_0x4007be,_0x419449){return function(_0xf9398c){if(_0xf9398c){var _0x45519b=_0xf9398c[_0x078a('0x2a')],_0xbdef6b=_0x419449[_0x078a('0x2b')],_0x48fab1=_0x419449[_0x078a('0x2b')]+_0x419449[_0x078a('0x2c')],_0x28b372;if(_0x48fab1>=_0x45519b){_0x48fab1=_0x45519b;_0x28b372=0xc8;}else{_0x28b372=0xce;}_0x4007be[_0x078a('0x29')](_0x28b372);return _0x4007be[_0x078a('0x2d')](_0x078a('0x2e'),_0xbdef6b+'-'+_0x48fab1+'/'+_0x45519b)['json'](_0xf9398c);}return null;};}function patchUpdates(_0x1b7c03){return function(_0x287ce9){try{jsonpatch[_0x078a('0x2f')](_0x287ce9,_0x1b7c03,!![]);}catch(_0x404ba5){return BPromise[_0x078a('0x30')](_0x404ba5);}return _0x287ce9[_0x078a('0x31')]();};}function saveUpdates(_0x846518,_0x4b7adc){return function(_0x43aa03){if(_0x43aa03){return _0x43aa03[_0x078a('0x32')](_0x846518)['then'](function(_0x469815){return _0x469815;});}return null;};}function removeEntity(_0x540ee4,_0xb96219){return function(_0x1244b5){if(_0x1244b5){return _0x1244b5[_0x078a('0x33')]()['then'](function(){_0x540ee4[_0x078a('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41442a,_0x58172c){return function(_0x3fca75){if(!_0x3fca75){_0x41442a[_0x078a('0x27')](0x194);}return _0x3fca75;};}function handleError(_0x23ff8c,_0x174553){_0x174553=_0x174553||0x1f4;return function(_0x4ceac8){logger[_0x078a('0x23')](_0x4ceac8[_0x078a('0x34')]);if(_0x4ceac8[_0x078a('0x35')]){delete _0x4ceac8[_0x078a('0x35')];}_0x23ff8c[_0x078a('0x29')](_0x174553)['send'](_0x4ceac8);};}exports[_0x078a('0x36')]=function(_0x2ec592,_0x421dc7){var _0x30c68a={},_0x463e3c={},_0x17970b={'count':0x0,'rows':[]};var _0x46efab=_['map'](db[_0x078a('0x37')][_0x078a('0x38')],function(_0x2b2e5f){return{'name':_0x2b2e5f[_0x078a('0x39')],'type':_0x2b2e5f[_0x078a('0x3a')][_0x078a('0x3b')]};});_0x463e3c[_0x078a('0x3c')]=_['map'](_0x46efab,_0x078a('0x35'));_0x463e3c[_0x078a('0x3d')]=_[_0x078a('0x3e')](_0x2ec592[_0x078a('0x3d')]);_0x463e3c[_0x078a('0x3f')]=_['intersection'](_0x463e3c[_0x078a('0x3c')],_0x463e3c['query']);_0x30c68a[_0x078a('0x40')]=_[_0x078a('0x41')](_0x463e3c[_0x078a('0x3c')],qs[_0x078a('0x42')](_0x2ec592[_0x078a('0x3d')][_0x078a('0x42')]));_0x30c68a[_0x078a('0x40')]=_0x30c68a[_0x078a('0x40')][_0x078a('0x43')]?_0x30c68a[_0x078a('0x40')]:_0x463e3c[_0x078a('0x3c')];if(!_0x2ec592['query'][_0x078a('0x44')](_0x078a('0x45'))){_0x30c68a[_0x078a('0x2c')]=qs['limit'](_0x2ec592[_0x078a('0x3d')][_0x078a('0x2c')]);_0x30c68a[_0x078a('0x2b')]=qs[_0x078a('0x2b')](_0x2ec592[_0x078a('0x3d')][_0x078a('0x2b')]);}_0x30c68a[_0x078a('0x46')]=qs[_0x078a('0x47')](_0x2ec592[_0x078a('0x3d')][_0x078a('0x47')]);_0x30c68a[_0x078a('0x48')]=qs[_0x078a('0x3f')](_['pick'](_0x2ec592['query'],_0x463e3c[_0x078a('0x3f')]),_0x46efab);if(_0x2ec592[_0x078a('0x3d')]['filter']){_0x30c68a['where']=_['merge'](_0x30c68a[_0x078a('0x48')],{'$or':_[_0x078a('0x49')](_0x46efab,function(_0x2b4964){if(_0x2b4964[_0x078a('0x3a')]!==_0x078a('0x4a')){var _0x26e63b={};_0x26e63b[_0x2b4964[_0x078a('0x35')]]={'$like':'%'+_0x2ec592[_0x078a('0x3d')][_0x078a('0x4b')]+'%'};return _0x26e63b;}})});}_0x30c68a=_[_0x078a('0x4c')]({},_0x30c68a,_0x2ec592[_0x078a('0x4d')]);var _0x29d471={'where':_0x30c68a[_0x078a('0x48')]};return db[_0x078a('0x37')][_0x078a('0x2a')](_0x29d471)[_0x078a('0x1d')](function(_0x3ae446){_0x17970b[_0x078a('0x2a')]=_0x3ae446;if(_0x2ec592[_0x078a('0x3d')]['includeAll']){_0x30c68a['include']=[{'all':!![]}];}return db[_0x078a('0x37')][_0x078a('0x4e')](_0x30c68a);})['then'](function(_0xa56a6e){_0x17970b[_0x078a('0x4f')]=_0xa56a6e;return _0x17970b;})['then'](respondWithFilteredResult(_0x421dc7,_0x30c68a))['catch'](handleError(_0x421dc7,null));};exports[_0x078a('0x50')]=function(_0x555aa1,_0x223d5e){var _0x48ad86={'raw':![],'where':{'id':_0x555aa1[_0x078a('0x51')]['id']}},_0x36e871={};_0x36e871['model']=_[_0x078a('0x3e')](db[_0x078a('0x37')]['rawAttributes']);_0x36e871['query']=_['keys'](_0x555aa1[_0x078a('0x3d')]);_0x36e871[_0x078a('0x3f')]=_[_0x078a('0x41')](_0x36e871[_0x078a('0x3c')],_0x36e871[_0x078a('0x3d')]);_0x48ad86[_0x078a('0x40')]=_[_0x078a('0x41')](_0x36e871[_0x078a('0x3c')],qs[_0x078a('0x42')](_0x555aa1[_0x078a('0x3d')][_0x078a('0x42')]));_0x48ad86['attributes']=_0x48ad86[_0x078a('0x40')][_0x078a('0x43')]?_0x48ad86[_0x078a('0x40')]:_0x36e871[_0x078a('0x3c')];if(_0x555aa1[_0x078a('0x3d')]['includeAll']){_0x48ad86[_0x078a('0x52')]=[{'all':!![]}];}_0x48ad86=_['merge']({},_0x48ad86,_0x555aa1[_0x078a('0x4d')]);return db[_0x078a('0x37')][_0x078a('0x53')](_0x48ad86)[_0x078a('0x1d')](handleEntityNotFound(_0x223d5e,null))['then'](respondWithResult(_0x223d5e,null))[_0x078a('0x54')](handleError(_0x223d5e,null));};exports[_0x078a('0x55')]=function(_0x49de7a,_0x1da1e2){return db[_0x078a('0x37')][_0x078a('0x55')](_0x49de7a['body'],{})['then'](respondWithResult(_0x1da1e2,0xc9))[_0x078a('0x54')](handleError(_0x1da1e2,null));};exports['update']=function(_0x5e852d,_0x5e0a6c){if(_0x5e852d[_0x078a('0x56')]['id']){delete _0x5e852d[_0x078a('0x56')]['id'];}return db[_0x078a('0x37')][_0x078a('0x53')]({'where':{'id':_0x5e852d[_0x078a('0x51')]['id']}})[_0x078a('0x1d')](handleEntityNotFound(_0x5e0a6c,null))[_0x078a('0x1d')](saveUpdates(_0x5e852d[_0x078a('0x56')],null))[_0x078a('0x1d')](respondWithResult(_0x5e0a6c,null))['catch'](handleError(_0x5e0a6c,null));};exports[_0x078a('0x33')]=function(_0x412301,_0x1791e8){return db[_0x078a('0x37')][_0x078a('0x53')]({'where':{'id':_0x412301['params']['id']}})[_0x078a('0x1d')](handleEntityNotFound(_0x1791e8,null))[_0x078a('0x1d')](removeEntity(_0x1791e8,null))[_0x078a('0x54')](handleError(_0x1791e8,null));};exports['getConfigurations']=function(_0x4d206a,_0x27f04c,_0x3a7d0f){var _0x77584={};var _0x19a9e2={};var _0xb05ea7;var _0x5a7a37;return db[_0x078a('0x37')][_0x078a('0x57')]({'where':{'id':_0x4d206a[_0x078a('0x51')]['id']}})[_0x078a('0x1d')](handleEntityNotFound(_0x27f04c,null))[_0x078a('0x1d')](function(_0x404eab){if(_0x404eab){_0xb05ea7=_0x404eab;_0x19a9e2[_0x078a('0x3c')]=_[_0x078a('0x3e')](db[_0x078a('0x58')]['rawAttributes']);_0x19a9e2[_0x078a('0x3d')]=_[_0x078a('0x3e')](_0x4d206a[_0x078a('0x3d')]);_0x19a9e2['filters']=_[_0x078a('0x41')](_0x19a9e2[_0x078a('0x3c')],_0x19a9e2['query']);_0x77584['attributes']=_[_0x078a('0x41')](_0x19a9e2[_0x078a('0x3c')],qs['fields'](_0x4d206a[_0x078a('0x3d')][_0x078a('0x42')]));_0x77584[_0x078a('0x40')]=_0x77584['attributes'][_0x078a('0x43')]?_0x77584[_0x078a('0x40')]:_0x19a9e2[_0x078a('0x3c')];_0x77584[_0x078a('0x46')]=qs['sort'](_0x4d206a[_0x078a('0x3d')][_0x078a('0x47')]);_0x77584[_0x078a('0x48')]=qs[_0x078a('0x3f')](_[_0x078a('0x59')](_0x4d206a[_0x078a('0x3d')],_0x19a9e2[_0x078a('0x3f')]));if(_0x4d206a['query']['filter']){_0x77584[_0x078a('0x48')]=_[_0x078a('0x4c')](_0x77584[_0x078a('0x48')],{'$or':_[_0x078a('0x49')](_0x77584[_0x078a('0x40')],function(_0xbd8904){var _0x49b6a7={};_0x49b6a7[_0xbd8904]={'$like':'%'+_0x4d206a[_0x078a('0x3d')]['filter']+'%'};return _0x49b6a7;})});}_0x77584=_['merge']({},_0x77584,_0x4d206a[_0x078a('0x4d')]);return _0xb05ea7[_0x078a('0x5a')](_0x77584);}})[_0x078a('0x1d')](function(_0x442444){if(_0x442444){_0x5a7a37=_0x442444[_0x078a('0x43')];if(!_0x4d206a[_0x078a('0x3d')][_0x078a('0x44')]('nolimit')){_0x77584[_0x078a('0x2c')]=qs['limit'](_0x4d206a[_0x078a('0x3d')]['limit']);_0x77584[_0x078a('0x2b')]=qs[_0x078a('0x2b')](_0x4d206a[_0x078a('0x3d')]['offset']);}return _0xb05ea7['getConfigurations'](_0x77584);}})[_0x078a('0x1d')](function(_0x195b4f){if(_0x195b4f){return _0x195b4f?{'count':_0x5a7a37,'rows':_0x195b4f}:null;}})[_0x078a('0x1d')](respondWithResult(_0x27f04c,null))[_0x078a('0x54')](handleError(_0x27f04c,null));};exports[_0x078a('0x5b')]=function(_0x939b50,_0x4a7d2b,_0x40cf9e){if(_0x939b50[_0x078a('0x56')]['id']){delete _0x939b50[_0x078a('0x56')]['id'];}return db['FreshdeskAccount'][_0x078a('0x57')]({'where':{'id':_0x939b50[_0x078a('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a7d2b,null))['then'](function(_0x510ae5){if(_0x510ae5){_0x939b50['body'][_0x078a('0x5c')]=_0x510ae5['id'];_0x939b50[_0x078a('0x56')]['Subjects']=integrations['getSubjects'](_0x939b50[_0x078a('0x56')][_0x078a('0x5d')],_0x939b50[_0x078a('0x56')][_0x078a('0x3a')]);_0x939b50[_0x078a('0x56')]['Descriptions']=integrations['getDescriptions'](_0x939b50[_0x078a('0x56')]['channel'],_0x939b50['body'][_0x078a('0x3a')]);return db[_0x078a('0x58')]['create'](_0x939b50[_0x078a('0x56')],{'include':[{'model':db[_0x078a('0x5e')],'as':_0x078a('0x5f')},{'model':db[_0x078a('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4a7d2b,null))[_0x078a('0x54')](handleError(_0x4a7d2b,null));};exports[_0x078a('0x60')]=function(_0x3e1ab0,_0x10ec0b,_0x53c963){var _0x80bdf7='';return db[_0x078a('0x37')][_0x078a('0x57')]({'where':{'id':_0x3e1ab0[_0x078a('0x51')]['id']},'attributes':['id',_0x078a('0x61'),_0x078a('0x62')]})['then'](handleEntityNotFound(_0x10ec0b,null))[_0x078a('0x1d')](function(_0xb302d1){if(_0xb302d1){_0x80bdf7=_0xb302d1['remoteUri'];var _0x16a111=_0x80bdf7[_0x078a('0x63')](-0x1);if(_0x16a111==='/'){_0x80bdf7=_0x80bdf7[_0x078a('0x64')](0x0,_0x80bdf7[_0x078a('0x65')](_0x16a111));}return rp({'method':'GET','uri':util['format'](_0x078a('0x66'),_0x80bdf7,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x078a('0x67')](_0x078a('0x68'),new Buffer(util['format'](_0x078a('0x69'),_0xb302d1[_0x078a('0x62')]))[_0x078a('0x6a')](_0x078a('0x6b')))},'json':!![]});}})[_0x078a('0x1d')](function(_0x79b2bb){if(_0x79b2bb){var _0x2d71f3=[_0x078a('0x6c'),_0x078a('0x6d'),_0x078a('0x6e'),_0x078a('0x6f'),'status',_0x078a('0x70'),'group','source',_0x078a('0x71'),_0x078a('0x72'),_0x078a('0x73')];_[_0x078a('0x74')](_0x79b2bb,function(_0xd49d40){return _0x2d71f3['includes'](_0xd49d40[_0x078a('0x35')])||!_0xd49d40[_0x078a('0x75')]&&_0xd49d40['type']!=='custom_text'&&_0xd49d40[_0x078a('0x3a')]!==_0x078a('0x76');});return{'count':_0x79b2bb[_0x078a('0x43')],'rows':_[_0x078a('0x49')](_0x79b2bb,function(_0x527f71){return{'id':_0x527f71[_0x078a('0x35')],'name':_0x527f71['label'],'custom':!_0x527f71[_0x078a('0x75')],'options':_0x527f71[_0x078a('0x77')]?_[_0x078a('0x49')](_0x527f71['choices'],function(_0x405091){return{'name':_['capitalize'](_0x405091),'value':_0x405091};}):[]};})};}})['then'](respondWithResult(_0x10ec0b,null))[_0x078a('0x54')](function(_0x1921eb){var _0x319738=_0x3e1ab0[_0x078a('0x3d')]['test']?0x1f4:_0x1921eb['statusCode']||0x1f4;logger[_0x078a('0x23')](_0x078a('0x78'),_0x078a('0x60'),_0x319738,JSON[_0x078a('0x22')](_0x1921eb));delete _0x1921eb[_0x078a('0x35')];if(_0x319738===0x191){_0x319738=0x190;}_0x10ec0b[_0x078a('0x29')](_0x319738)[_0x078a('0x79')](_0x3e1ab0['query']['test']?{'message':_0x078a('0x7a'),'statusCode':_0x1921eb[_0x078a('0x7b')]}:_0x1921eb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 41b4850..068a3a8 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 _0x70ec=['api','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x3b1a26,_0x348b1a){var _0x1d07d4=function(_0x3e17d8){while(--_0x3e17d8){_0x3b1a26['push'](_0x3b1a26['shift']());}};_0x1d07d4(++_0x348b1a);}(_0x70ec,0x18a));var _0xc70e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x70ec[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc70e('0x0'));var util=require(_0xc70e('0x1'));var logger=require('../../config/logger')(_0xc70e('0x2'));var moment=require('moment');var BPromise=require(_0xc70e('0x3'));var rp=require(_0xc70e('0x4'));var fs=require('fs');var path=require(_0xc70e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc70e('0x6'));var integrations=require(_0xc70e('0x7'));module[_0xc70e('0x8')]=function(_0x5a5e9b,_0x308eeb){return _0x5a5e9b[_0xc70e('0x9')](_0xc70e('0xa'),attributes,{'tableName':_0xc70e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb332=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x4bbfd5,_0x5a63ea){var _0x3d1b55=function(_0x206715){while(--_0x206715){_0x4bbfd5['push'](_0x4bbfd5['shift']());}};_0x3d1b55(++_0x5a63ea);}(_0xb332,0x1ef));var _0x2b33=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xb332[_0x25efdf];return _0x22c495;};'use strict';var _=require(_0x2b33('0x0'));var util=require(_0x2b33('0x1'));var logger=require(_0x2b33('0x2'))(_0x2b33('0x3'));var moment=require('moment');var BPromise=require(_0x2b33('0x4'));var rp=require(_0x2b33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b33('0x6'));var config=require(_0x2b33('0x7'));var attributes=require(_0x2b33('0x8'));var integrations=require(_0x2b33('0x9'));module[_0x2b33('0xa')]=function(_0x51b866,_0x58b48e){return _0x51b866[_0x2b33('0xb')](_0x2b33('0xc'),attributes,{'tableName':_0x2b33('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 7c0025a..dd9a8b6 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 _0xd706=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','where','lodash'];(function(_0x1a2108,_0x36d48a){var _0x364027=function(_0x3556db){while(--_0x3556db){_0x1a2108['push'](_0x1a2108['shift']());}};_0x364027(++_0x36d48a);}(_0xd706,0x1df));var _0x6d70=function(_0xcf282d,_0x4fa3f2){_0xcf282d=_0xcf282d-0x0;var _0x273811=_0xd706[_0xcf282d];return _0x273811;};'use strict';var _=require(_0x6d70('0x0'));var util=require(_0x6d70('0x1'));var moment=require(_0x6d70('0x2'));var BPromise=require(_0x6d70('0x3'));var rs=require(_0x6d70('0x4'));var fs=require('fs');var Redis=require(_0x6d70('0x5'));var db=require(_0x6d70('0x6'))['db'];var utils=require(_0x6d70('0x7'));var logger=require(_0x6d70('0x8'))(_0x6d70('0x9'));var config=require(_0x6d70('0xa'));var jayson=require(_0x6d70('0xb'));var client=jayson[_0x6d70('0xc')][_0x6d70('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e7376,_0x46c3ab,_0x12d764){return new BPromise(function(_0x564d57,_0x51bc72){return client[_0x6d70('0xe')](_0x1e7376,_0x12d764)[_0x6d70('0xf')](function(_0x5f41f7){logger[_0x6d70('0x10')](_0x6d70('0x11'),_0x46c3ab,'request\x20sent');logger[_0x6d70('0x12')](_0x6d70('0x13'),_0x46c3ab,_0x6d70('0x14'),JSON[_0x6d70('0x15')](_0x5f41f7));if(_0x5f41f7['error']){if(_0x5f41f7['error'][_0x6d70('0x16')]===0x1f4){logger[_0x6d70('0x17')]('FreshdeskAccount,\x20%s,\x20%s',_0x46c3ab,_0x5f41f7['error']['message']);return _0x51bc72(_0x5f41f7[_0x6d70('0x17')][_0x6d70('0x18')]);}logger[_0x6d70('0x17')](_0x6d70('0x11'),_0x46c3ab,_0x5f41f7['error'][_0x6d70('0x18')]);return _0x564d57(_0x5f41f7[_0x6d70('0x17')]['message']);}else{logger[_0x6d70('0x10')](_0x6d70('0x11'),_0x46c3ab,'request\x20sent');_0x564d57(_0x5f41f7[_0x6d70('0x19')][_0x6d70('0x18')]);}})[_0x6d70('0x1a')](function(_0x117891){logger[_0x6d70('0x17')](_0x6d70('0x11'),_0x46c3ab,_0x117891);_0x51bc72(_0x117891);});});}exports['GetFreshdeskAccount']=function(_0x55cffc){var _0x4e5bba=this;return new Promise(function(_0xc89a90,_0x20bb6b){return db[_0x6d70('0x1b')][_0x6d70('0x1c')]({'raw':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc[_0x6d70('0x1d')][_0x6d70('0x1e')]===undefined?!![]:![]:!![],'where':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc['options']['where']||null:null,'attributes':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc['options'][_0x6d70('0x1f')]||null:null,'limit':_0x55cffc['options']?_0x55cffc[_0x6d70('0x1d')][_0x6d70('0x20')]||null:null,'include':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc['options'][_0x6d70('0x21')]?_[_0x6d70('0x22')](_0x55cffc[_0x6d70('0x1d')]['include'],function(_0x4491c2){return{'model':db[_0x4491c2['model']],'as':_0x4491c2['as'],'attributes':_0x4491c2['attributes'],'include':_0x4491c2[_0x6d70('0x21')]?_[_0x6d70('0x22')](_0x4491c2[_0x6d70('0x21')],function(_0x49c1f8){return{'model':db[_0x49c1f8[_0x6d70('0x23')]],'as':_0x49c1f8['as'],'attributes':_0x49c1f8[_0x6d70('0x1f')],'include':_0x49c1f8['include']?_[_0x6d70('0x22')](_0x49c1f8['include'],function(_0x23fc24){return{'model':db[_0x23fc24[_0x6d70('0x23')]],'as':_0x23fc24['as'],'attributes':_0x23fc24[_0x6d70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d70('0xf')](function(_0x5847e8){logger[_0x6d70('0x10')](_0x6d70('0x24'),_0x55cffc);logger[_0x6d70('0x12')](_0x6d70('0x24'),_0x55cffc,JSON[_0x6d70('0x15')](_0x5847e8));_0xc89a90(_0x5847e8);})['catch'](function(_0x526bcd){logger[_0x6d70('0x17')](_0x6d70('0x24'),_0x526bcd[_0x6d70('0x18')],_0x55cffc);_0x20bb6b(_0x4e5bba[_0x6d70('0x17')](0x1f4,_0x526bcd[_0x6d70('0x18')]));});});};exports[_0x6d70('0x25')]=function(_0xd33e92){var _0x11058e=this;return new Promise(function(_0x4b9edb,_0x451dc1){return db[_0x6d70('0x1b')][_0x6d70('0x26')]({'raw':_0xd33e92['options']?_0xd33e92[_0x6d70('0x1d')][_0x6d70('0x1e')]===undefined?!![]:![]:!![],'where':_0xd33e92[_0x6d70('0x1d')]?_0xd33e92[_0x6d70('0x1d')][_0x6d70('0x27')]||null:null,'attributes':_0xd33e92[_0x6d70('0x1d')]?_0xd33e92['options'][_0x6d70('0x1f')]||null:null,'include':_0xd33e92['options']?_0xd33e92['options']['include']?_[_0x6d70('0x22')](_0xd33e92['options'][_0x6d70('0x21')],function(_0x505765){return{'model':db[_0x505765[_0x6d70('0x23')]],'as':_0x505765['as'],'attributes':_0x505765[_0x6d70('0x1f')],'include':_0x505765['include']?_[_0x6d70('0x22')](_0x505765[_0x6d70('0x21')],function(_0xc23592){return{'model':db[_0xc23592[_0x6d70('0x23')]],'as':_0xc23592['as'],'attributes':_0xc23592['attributes'],'include':_0xc23592['include']?_[_0x6d70('0x22')](_0xc23592[_0x6d70('0x21')],function(_0x50a60c){return{'model':db[_0x50a60c[_0x6d70('0x23')]],'as':_0x50a60c['as'],'attributes':_0x50a60c[_0x6d70('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5718d1){logger[_0x6d70('0x10')](_0x6d70('0x25'),_0xd33e92);logger[_0x6d70('0x12')](_0x6d70('0x25'),_0xd33e92,JSON['stringify'](_0x5718d1));_0x4b9edb(_0x5718d1);})[_0x6d70('0x1a')](function(_0x304805){logger[_0x6d70('0x17')](_0x6d70('0x25'),_0x304805[_0x6d70('0x18')],_0xd33e92);_0x451dc1(_0x11058e[_0x6d70('0x17')](0x1f4,_0x304805[_0x6d70('0x18')]));});});}; \ No newline at end of file +var _0xa17e=['jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','map','attributes','model','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d4325,_0x39df8c){var _0x31bb2f=function(_0x1f24e0){while(--_0x1f24e0){_0x4d4325['push'](_0x4d4325['shift']());}};_0x31bb2f(++_0x39df8c);}(_0xa17e,0x8a));var _0xea17=function(_0x51cf44,_0x33ffcd){_0x51cf44=_0x51cf44-0x0;var _0x4f14d6=_0xa17e[_0x51cf44];return _0x4f14d6;};'use strict';var _=require(_0xea17('0x0'));var util=require(_0xea17('0x1'));var moment=require(_0xea17('0x2'));var BPromise=require(_0xea17('0x3'));var rs=require(_0xea17('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea17('0x5'))['db'];var utils=require(_0xea17('0x6'));var logger=require(_0xea17('0x7'))(_0xea17('0x8'));var config=require(_0xea17('0x9'));var jayson=require(_0xea17('0xa'));var client=jayson[_0xea17('0xb')][_0xea17('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x84cd52,_0x350899,_0x3ce7ac){return new BPromise(function(_0x567e6c,_0x520fdf){return client['request'](_0x84cd52,_0x3ce7ac)[_0xea17('0xd')](function(_0x24484e){logger['info'](_0xea17('0xe'),_0x350899,_0xea17('0xf'));logger[_0xea17('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x350899,'request\x20sent',JSON[_0xea17('0x11')](_0x24484e));if(_0x24484e[_0xea17('0x12')]){if(_0x24484e[_0xea17('0x12')][_0xea17('0x13')]===0x1f4){logger[_0xea17('0x12')](_0xea17('0xe'),_0x350899,_0x24484e[_0xea17('0x12')][_0xea17('0x14')]);return _0x520fdf(_0x24484e[_0xea17('0x12')][_0xea17('0x14')]);}logger[_0xea17('0x12')](_0xea17('0xe'),_0x350899,_0x24484e[_0xea17('0x12')][_0xea17('0x14')]);return _0x567e6c(_0x24484e[_0xea17('0x12')]['message']);}else{logger['info'](_0xea17('0xe'),_0x350899,_0xea17('0xf'));_0x567e6c(_0x24484e[_0xea17('0x15')]['message']);}})[_0xea17('0x16')](function(_0x122766){logger[_0xea17('0x12')](_0xea17('0xe'),_0x350899,_0x122766);_0x520fdf(_0x122766);});});}exports['GetFreshdeskAccount']=function(_0x4938a4){var _0x4c84bf=this;return new Promise(function(_0x2acb4d,_0x5783a4){return db['FreshdeskAccount'][_0xea17('0x17')]({'raw':_0x4938a4['options']?_0x4938a4[_0xea17('0x18')][_0xea17('0x19')]===undefined?!![]:![]:!![],'where':_0x4938a4[_0xea17('0x18')]?_0x4938a4['options'][_0xea17('0x1a')]||null:null,'attributes':_0x4938a4['options']?_0x4938a4['options']['attributes']||null:null,'limit':_0x4938a4[_0xea17('0x18')]?_0x4938a4[_0xea17('0x18')][_0xea17('0x1b')]||null:null,'include':_0x4938a4['options']?_0x4938a4[_0xea17('0x18')][_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x4938a4['options'][_0xea17('0x1c')],function(_0x50a2b7){return{'model':db[_0x50a2b7['model']],'as':_0x50a2b7['as'],'attributes':_0x50a2b7[_0xea17('0x1e')],'include':_0x50a2b7[_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x50a2b7[_0xea17('0x1c')],function(_0x459c41){return{'model':db[_0x459c41[_0xea17('0x1f')]],'as':_0x459c41['as'],'attributes':_0x459c41[_0xea17('0x1e')],'include':_0x459c41[_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x459c41[_0xea17('0x1c')],function(_0x5f22dd){return{'model':db[_0x5f22dd[_0xea17('0x1f')]],'as':_0x5f22dd['as'],'attributes':_0x5f22dd[_0xea17('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xea17('0xd')](function(_0x316602){logger['info'](_0xea17('0x20'),_0x4938a4);logger['debug'](_0xea17('0x20'),_0x4938a4,JSON['stringify'](_0x316602));_0x2acb4d(_0x316602);})['catch'](function(_0x35fd8a){logger[_0xea17('0x12')]('GetFreshdeskAccount',_0x35fd8a[_0xea17('0x14')],_0x4938a4);_0x5783a4(_0x4c84bf['error'](0x1f4,_0x35fd8a[_0xea17('0x14')]));});});};exports[_0xea17('0x21')]=function(_0x42d2a6){var _0x3dbaac=this;return new Promise(function(_0x59c3f7,_0x379826){return db[_0xea17('0x22')][_0xea17('0x23')]({'raw':_0x42d2a6['options']?_0x42d2a6[_0xea17('0x18')][_0xea17('0x19')]===undefined?!![]:![]:!![],'where':_0x42d2a6[_0xea17('0x18')]?_0x42d2a6[_0xea17('0x18')][_0xea17('0x1a')]||null:null,'attributes':_0x42d2a6[_0xea17('0x18')]?_0x42d2a6[_0xea17('0x18')]['attributes']||null:null,'include':_0x42d2a6[_0xea17('0x18')]?_0x42d2a6[_0xea17('0x18')][_0xea17('0x1c')]?_[_0xea17('0x1d')](_0x42d2a6['options'][_0xea17('0x1c')],function(_0x5ee366){return{'model':db[_0x5ee366[_0xea17('0x1f')]],'as':_0x5ee366['as'],'attributes':_0x5ee366[_0xea17('0x1e')],'include':_0x5ee366['include']?_[_0xea17('0x1d')](_0x5ee366[_0xea17('0x1c')],function(_0x169226){return{'model':db[_0x169226[_0xea17('0x1f')]],'as':_0x169226['as'],'attributes':_0x169226[_0xea17('0x1e')],'include':_0x169226['include']?_[_0xea17('0x1d')](_0x169226[_0xea17('0x1c')],function(_0x6877ff){return{'model':db[_0x6877ff['model']],'as':_0x6877ff['as'],'attributes':_0x6877ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xea17('0xd')](function(_0x43f8c4){logger[_0xea17('0x24')]('ShowFreshdeskAccount',_0x42d2a6);logger[_0xea17('0x10')](_0xea17('0x21'),_0x42d2a6,JSON[_0xea17('0x11')](_0x43f8c4));_0x59c3f7(_0x43f8c4);})['catch'](function(_0x2dbf37){logger['error']('ShowFreshdeskAccount',_0x2dbf37[_0xea17('0x14')],_0x42d2a6);_0x379826(_0x3dbaac[_0xea17('0x12')](0x1f4,_0x2dbf37[_0xea17('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1105594..22a94ae 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 _0xd803=['isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x4141c9,_0x5c2f69){var _0xc44dbd=function(_0x11671a){while(--_0x11671a){_0x4141c9['push'](_0x4141c9['shift']());}};_0xc44dbd(++_0x5c2f69);}(_0xd803,0x114));var _0x3d80=function(_0x42f94d,_0x515205){_0x42f94d=_0x42f94d-0x0;var _0x38e5ff=_0xd803[_0x42f94d];return _0x38e5ff;};'use strict';var multer=require(_0x3d80('0x0'));var util=require(_0x3d80('0x1'));var path=require(_0x3d80('0x2'));var timeout=require(_0x3d80('0x3'));var express=require('express');var router=express[_0x3d80('0x4')]();var auth=require(_0x3d80('0x5'));var interaction=require(_0x3d80('0x6'));var config=require(_0x3d80('0x7'));var controller=require(_0x3d80('0x8'));router[_0x3d80('0x9')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0xb')]);router[_0x3d80('0x9')](_0x3d80('0xc'),auth[_0x3d80('0xa')](),controller[_0x3d80('0xd')]);router[_0x3d80('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x3d80('0x9')](_0x3d80('0xe'),auth['isAuthenticated'](),controller[_0x3d80('0xf')]);router[_0x3d80('0x9')](_0x3d80('0x10'),auth['isAuthenticated'](),controller[_0x3d80('0x11')]);router[_0x3d80('0x9')](_0x3d80('0x12'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x13')]);router[_0x3d80('0x14')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0x15')]);router['post'](_0x3d80('0x12'),auth[_0x3d80('0xa')](),controller['setTags']);router[_0x3d80('0x16')](_0x3d80('0xc'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x17')]);router['delete'](_0x3d80('0xc'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x18')]);module[_0x3d80('0x19')]=router; \ No newline at end of file +var _0xacb1=['put','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','getTags','post','create'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xacb1,0x9a));var _0x1acb=function(_0x34bda4,_0x25daa5){_0x34bda4=_0x34bda4-0x0;var _0xbefec8=_0xacb1[_0x34bda4];return _0xbefec8;};'use strict';var multer=require(_0x1acb('0x0'));var util=require(_0x1acb('0x1'));var path=require('path');var timeout=require(_0x1acb('0x2'));var express=require('express');var router=express[_0x1acb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1acb('0x4'));var config=require(_0x1acb('0x5'));var controller=require(_0x1acb('0x6'));router[_0x1acb('0x7')]('/',auth[_0x1acb('0x8')](),controller[_0x1acb('0x9')]);router['get'](_0x1acb('0xa'),auth[_0x1acb('0x8')](),controller['show']);router[_0x1acb('0x7')](_0x1acb('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1acb('0x7')]('/:id/subjects',auth[_0x1acb('0x8')](),controller[_0x1acb('0xc')]);router[_0x1acb('0x7')](_0x1acb('0xd'),auth[_0x1acb('0x8')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x1acb('0xe')]);router[_0x1acb('0xf')]('/',auth['isAuthenticated'](),controller[_0x1acb('0x10')]);router[_0x1acb('0xf')]('/:id/tags',auth[_0x1acb('0x8')](),controller['setTags']);router[_0x1acb('0x11')](_0x1acb('0xa'),auth[_0x1acb('0x8')](),controller['update']);router['delete'](_0x1acb('0xa'),auth[_0x1acb('0x8')](),controller['destroy']);module[_0x1acb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index bd55039..5a263c2 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 _0xe265=['STRING'];(function(_0x804304,_0x3b18a0){var _0x1153a5=function(_0x553456){while(--_0x553456){_0x804304['push'](_0x804304['shift']());}};_0x1153a5(++_0x3b18a0);}(_0xe265,0x183));var _0x5e26=function(_0x5dd535,_0x2b6d67){_0x5dd535=_0x5dd535-0x0;var _0x3da6eb=_0xe265[_0x5dd535];return _0x3da6eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5e26('0x0')]},'description':{'type':Sequelize[_0x5e26('0x0')]}}; \ No newline at end of file +var _0x5e9c=['sequelize','STRING'];(function(_0x1e937a,_0x332c6b){var _0x55c2e9=function(_0xb13833){while(--_0xb13833){_0x1e937a['push'](_0x1e937a['shift']());}};_0x55c2e9(++_0x332c6b);}(_0x5e9c,0x116));var _0xc5e9=function(_0x52fd54,_0x3b834d){_0x52fd54=_0x52fd54-0x0;var _0x4229ce=_0x5e9c[_0x52fd54];return _0x4229ce;};'use strict';var Sequelize=require(_0xc5e9('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5e9('0x1')]},'description':{'type':Sequelize[_0xc5e9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b0c63aa..10d6777 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 _0x0892=['sendStatus','end','json','offset','limit','status','set','apply','reject','save','update','destroy','stack','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','findOne','FreshdeskField','options','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5652c2,_0x393cf3){var _0x3d2980=function(_0x3ad9d7){while(--_0x3ad9d7){_0x5652c2['push'](_0x5652c2['shift']());}};_0x3d2980(++_0x393cf3);}(_0x0892,0x103));var _0x2089=function(_0x148890,_0x104e72){_0x148890=_0x148890-0x0;var _0x460886=_0x0892[_0x148890];return _0x460886;};'use strict';var pdf=require(_0x2089('0x0'));var emlformat=require(_0x2089('0x1'));var rimraf=require(_0x2089('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2089('0x3'));var rp=require(_0x2089('0x4'));var moment=require(_0x2089('0x5'));var BPromise=require(_0x2089('0x6'));var Mustache=require(_0x2089('0x7'));var util=require(_0x2089('0x8'));var path=require(_0x2089('0x9'));var sox=require(_0x2089('0xa'));var csv=require(_0x2089('0xb'));var ejs=require(_0x2089('0xc'));var fs=require('fs');var _=require(_0x2089('0xd'));var squel=require('squel');var crypto=require(_0x2089('0xe'));var jsforce=require(_0x2089('0xf'));var deskjs=require(_0x2089('0x10'));var toCsv=require(_0x2089('0xb'));var querystring=require('querystring');var Papa=require(_0x2089('0x11'));var Redis=require(_0x2089('0x12'));var authService=require(_0x2089('0x13'));var qs=require(_0x2089('0x14'));var as=require(_0x2089('0x15'));var hardwareService=require(_0x2089('0x16'));var logger=require('../../config/logger')(_0x2089('0x17'));var utils=require(_0x2089('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2089('0x19'));var db=require(_0x2089('0x1a'))['db'];var jayson=require(_0x2089('0x1b'));var client=jayson[_0x2089('0x1c')][_0x2089('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23e24b,_0xc0809,_0x46df22,_0x5b4001){return new BPromise(function(_0x304bec,_0x381319){var _0x572b7b=_0x5b4001||client;return _0x572b7b[_0x2089('0x1e')](_0x23e24b,_0x46df22)[_0x2089('0x1f')](function(_0x400961){logger[_0x2089('0x20')](_0x2089('0x21'),_0xc0809,_0x2089('0x22'));logger[_0x2089('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xc0809,_0x2089('0x22'),JSON[_0x2089('0x24')](_0x400961));if(_0x400961[_0x2089('0x25')]){if(_0x400961['error'][_0x2089('0x26')]===0x1f4){logger['error'](_0x2089('0x21'),_0xc0809,_0x400961[_0x2089('0x25')]['message']);return _0x381319(_0x400961[_0x2089('0x25')][_0x2089('0x27')]);}logger[_0x2089('0x25')](_0x2089('0x21'),_0xc0809,_0x400961[_0x2089('0x25')][_0x2089('0x27')]);return _0x304bec(_0x400961[_0x2089('0x25')][_0x2089('0x27')]);}else{logger[_0x2089('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xc0809,_0x2089('0x22'));_0x304bec(_0x400961[_0x2089('0x28')][_0x2089('0x27')]);}})['catch'](function(_0x3f1295){logger[_0x2089('0x25')](_0x2089('0x21'),_0xc0809,_0x3f1295);_0x381319(_0x3f1295);});});}function respondWithStatusCode(_0x2a9daf,_0x3027da){_0x3027da=_0x3027da||0xcc;return function(_0x1a6ee2){if(_0x1a6ee2){return _0x2a9daf[_0x2089('0x29')](_0x3027da);}return _0x2a9daf['status'](_0x3027da)[_0x2089('0x2a')]();};}function respondWithResult(_0x40323f,_0x2d39ce){_0x2d39ce=_0x2d39ce||0xc8;return function(_0x466a27){if(_0x466a27){return _0x40323f['status'](_0x2d39ce)[_0x2089('0x2b')](_0x466a27);}};}function respondWithFilteredResult(_0x26cc97,_0x346011){return function(_0x223970){if(_0x223970){var _0x23d285=_0x223970['count'],_0x44fb39=_0x346011[_0x2089('0x2c')],_0x1a5bc5=_0x346011[_0x2089('0x2c')]+_0x346011[_0x2089('0x2d')],_0x53f744;if(_0x1a5bc5>=_0x23d285){_0x1a5bc5=_0x23d285;_0x53f744=0xc8;}else{_0x53f744=0xce;}_0x26cc97[_0x2089('0x2e')](_0x53f744);return _0x26cc97[_0x2089('0x2f')]('Content-Range',_0x44fb39+'-'+_0x1a5bc5+'/'+_0x23d285)[_0x2089('0x2b')](_0x223970);}return null;};}function patchUpdates(_0x4a553a){return function(_0x45dc2c){try{jsonpatch[_0x2089('0x30')](_0x45dc2c,_0x4a553a,!![]);}catch(_0x3978f2){return BPromise[_0x2089('0x31')](_0x3978f2);}return _0x45dc2c[_0x2089('0x32')]();};}function saveUpdates(_0x275e8a,_0x36b42f){return function(_0x5292ad){if(_0x5292ad){return _0x5292ad[_0x2089('0x33')](_0x275e8a)['then'](function(_0x52f3a6){return _0x52f3a6;});}return null;};}function removeEntity(_0x255403,_0x287382){return function(_0xe50f0d){if(_0xe50f0d){return _0xe50f0d[_0x2089('0x34')]()[_0x2089('0x1f')](function(){_0x255403[_0x2089('0x2e')](0xcc)[_0x2089('0x2a')]();});}};}function handleEntityNotFound(_0x3e7929,_0x5a5fe4){return function(_0x2dca2d){if(!_0x2dca2d){_0x3e7929[_0x2089('0x29')](0x194);}return _0x2dca2d;};}function handleError(_0xaaf751,_0xe7e1e9){_0xe7e1e9=_0xe7e1e9||0x1f4;return function(_0x1dd109){logger['error'](_0x1dd109[_0x2089('0x35')]);if(_0x1dd109['name']){delete _0x1dd109['name'];}_0xaaf751[_0x2089('0x2e')](_0xe7e1e9)[_0x2089('0x36')](_0x1dd109);};}exports[_0x2089('0x37')]=function(_0x492ea2,_0x2fb3fd){var _0x569a70={},_0x19b31c={},_0x3981f9={'count':0x0,'rows':[]};var _0x601b2f=_[_0x2089('0x38')](db[_0x2089('0x39')]['rawAttributes'],function(_0x2d5ce1){return{'name':_0x2d5ce1[_0x2089('0x3a')],'type':_0x2d5ce1[_0x2089('0x3b')][_0x2089('0x3c')]};});_0x19b31c[_0x2089('0x3d')]=_['map'](_0x601b2f,_0x2089('0x3e'));_0x19b31c[_0x2089('0x3f')]=_[_0x2089('0x40')](_0x492ea2[_0x2089('0x3f')]);_0x19b31c[_0x2089('0x41')]=_['intersection'](_0x19b31c['model'],_0x19b31c[_0x2089('0x3f')]);_0x569a70[_0x2089('0x42')]=_[_0x2089('0x43')](_0x19b31c[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x492ea2[_0x2089('0x3f')][_0x2089('0x44')]));_0x569a70[_0x2089('0x42')]=_0x569a70[_0x2089('0x42')][_0x2089('0x45')]?_0x569a70[_0x2089('0x42')]:_0x19b31c[_0x2089('0x3d')];if(!_0x492ea2[_0x2089('0x3f')][_0x2089('0x46')](_0x2089('0x47'))){_0x569a70[_0x2089('0x2d')]=qs['limit'](_0x492ea2['query'][_0x2089('0x2d')]);_0x569a70[_0x2089('0x2c')]=qs[_0x2089('0x2c')](_0x492ea2[_0x2089('0x3f')]['offset']);}_0x569a70[_0x2089('0x48')]=qs[_0x2089('0x49')](_0x492ea2['query']['sort']);_0x569a70[_0x2089('0x4a')]=qs[_0x2089('0x41')](_[_0x2089('0x4b')](_0x492ea2[_0x2089('0x3f')],_0x19b31c[_0x2089('0x41')]),_0x601b2f);if(_0x492ea2[_0x2089('0x3f')][_0x2089('0x4c')]){_0x569a70[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0x569a70['where'],{'$or':_['map'](_0x601b2f,function(_0x3e92bd){if(_0x3e92bd['type']!==_0x2089('0x4e')){var _0x1dc911={};_0x1dc911[_0x3e92bd[_0x2089('0x3e')]]={'$like':'%'+_0x492ea2[_0x2089('0x3f')][_0x2089('0x4c')]+'%'};return _0x1dc911;}})});}_0x569a70=_[_0x2089('0x4d')]({},_0x569a70,_0x492ea2['options']);var _0x586296={'where':_0x569a70[_0x2089('0x4a')]};return db[_0x2089('0x39')][_0x2089('0x4f')](_0x586296)[_0x2089('0x1f')](function(_0x3d2169){_0x3981f9['count']=_0x3d2169;if(_0x492ea2['query']['includeAll']){_0x569a70[_0x2089('0x50')]=[{'all':!![]}];}return db[_0x2089('0x39')]['findAll'](_0x569a70);})[_0x2089('0x1f')](function(_0x15ad67){_0x3981f9[_0x2089('0x51')]=_0x15ad67;return _0x3981f9;})[_0x2089('0x1f')](respondWithFilteredResult(_0x2fb3fd,_0x569a70))[_0x2089('0x52')](handleError(_0x2fb3fd,null));};exports[_0x2089('0x53')]=function(_0x56b25c,_0x5dd804){var _0x15a6ca={'raw':![],'where':{'id':_0x56b25c[_0x2089('0x54')]['id']}},_0x37c6c4={};_0x37c6c4[_0x2089('0x3d')]=_[_0x2089('0x40')](db[_0x2089('0x39')][_0x2089('0x55')]);_0x37c6c4[_0x2089('0x3f')]=_['keys'](_0x56b25c['query']);_0x37c6c4[_0x2089('0x41')]=_[_0x2089('0x43')](_0x37c6c4[_0x2089('0x3d')],_0x37c6c4[_0x2089('0x3f')]);_0x15a6ca[_0x2089('0x42')]=_[_0x2089('0x43')](_0x37c6c4[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x56b25c[_0x2089('0x3f')]['fields']));_0x15a6ca[_0x2089('0x42')]=_0x15a6ca[_0x2089('0x42')][_0x2089('0x45')]?_0x15a6ca[_0x2089('0x42')]:_0x37c6c4[_0x2089('0x3d')];if(_0x56b25c[_0x2089('0x3f')][_0x2089('0x56')]){_0x15a6ca[_0x2089('0x50')]=[{'all':!![]}];}_0x15a6ca=_[_0x2089('0x4d')]({},_0x15a6ca,_0x56b25c['options']);return db[_0x2089('0x39')][_0x2089('0x57')](_0x15a6ca)['then'](handleEntityNotFound(_0x5dd804,null))[_0x2089('0x1f')](respondWithResult(_0x5dd804,null))[_0x2089('0x52')](handleError(_0x5dd804,null));};exports[_0x2089('0x58')]=function(_0x591146,_0x3c27a0){return db[_0x2089('0x39')][_0x2089('0x58')](_0x591146[_0x2089('0x59')],{})['then'](respondWithResult(_0x3c27a0,0xc9))[_0x2089('0x52')](handleError(_0x3c27a0,null));};exports['update']=function(_0x4e7690,_0x23e4d5){if(_0x4e7690[_0x2089('0x59')]['id']){delete _0x4e7690[_0x2089('0x59')]['id'];}return db[_0x2089('0x39')][_0x2089('0x57')]({'where':{'id':_0x4e7690[_0x2089('0x54')]['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x23e4d5,null))[_0x2089('0x1f')](saveUpdates(_0x4e7690[_0x2089('0x59')],null))['then'](respondWithResult(_0x23e4d5,null))[_0x2089('0x52')](handleError(_0x23e4d5,null));};exports[_0x2089('0x34')]=function(_0x1afaa4,_0x4cc557){return db[_0x2089('0x39')][_0x2089('0x57')]({'where':{'id':_0x1afaa4[_0x2089('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cc557,null))[_0x2089('0x1f')](removeEntity(_0x4cc557,null))['catch'](handleError(_0x4cc557,null));};exports['getFields']=function(_0x3fbc19,_0x3a64a7,_0xb96ad3){var _0x5b0fb5={};var _0xf66389={};var _0x500bbe;var _0x5c0342;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x3fbc19['params']['id']}})['then'](handleEntityNotFound(_0x3a64a7,null))[_0x2089('0x1f')](function(_0x57f234){if(_0x57f234){_0x500bbe=_0x57f234;_0xf66389[_0x2089('0x3d')]=_[_0x2089('0x40')](db[_0x2089('0x5b')][_0x2089('0x55')]);_0xf66389[_0x2089('0x3f')]=_[_0x2089('0x40')](_0x3fbc19['query']);_0xf66389[_0x2089('0x41')]=_[_0x2089('0x43')](_0xf66389[_0x2089('0x3d')],_0xf66389[_0x2089('0x3f')]);_0x5b0fb5['attributes']=_[_0x2089('0x43')](_0xf66389[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x3fbc19[_0x2089('0x3f')][_0x2089('0x44')]));_0x5b0fb5[_0x2089('0x42')]=_0x5b0fb5[_0x2089('0x42')][_0x2089('0x45')]?_0x5b0fb5[_0x2089('0x42')]:_0xf66389[_0x2089('0x3d')];_0x5b0fb5['order']=qs[_0x2089('0x49')](_0x3fbc19[_0x2089('0x3f')][_0x2089('0x49')]);_0x5b0fb5['where']=qs[_0x2089('0x41')](_[_0x2089('0x4b')](_0x3fbc19['query'],_0xf66389[_0x2089('0x41')]));if(_0x3fbc19[_0x2089('0x3f')][_0x2089('0x4c')]){_0x5b0fb5[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0x5b0fb5[_0x2089('0x4a')],{'$or':_[_0x2089('0x38')](_0x5b0fb5[_0x2089('0x42')],function(_0x5e31b0){var _0x1c0f13={};_0x1c0f13[_0x5e31b0]={'$like':'%'+_0x3fbc19[_0x2089('0x3f')][_0x2089('0x4c')]+'%'};return _0x1c0f13;})});}_0x5b0fb5=_[_0x2089('0x4d')]({},_0x5b0fb5,_0x3fbc19[_0x2089('0x5c')]);return _0x500bbe[_0x2089('0x5d')](_0x5b0fb5);}})[_0x2089('0x1f')](function(_0x1c9538){if(_0x1c9538){_0x5c0342=_0x1c9538[_0x2089('0x45')];if(!_0x3fbc19[_0x2089('0x3f')]['hasOwnProperty']('nolimit')){_0x5b0fb5[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x3fbc19[_0x2089('0x3f')]['limit']);_0x5b0fb5[_0x2089('0x2c')]=qs['offset'](_0x3fbc19[_0x2089('0x3f')][_0x2089('0x2c')]);}return _0x500bbe['getFields'](_0x5b0fb5);}})[_0x2089('0x1f')](function(_0x6807ec){if(_0x6807ec){return _0x6807ec?{'count':_0x5c0342,'rows':_0x6807ec}:null;}})[_0x2089('0x1f')](respondWithResult(_0x3a64a7,null))[_0x2089('0x52')](handleError(_0x3a64a7,null));};exports[_0x2089('0x5e')]=function(_0x11b6b5,_0x207800,_0x208327){var _0xe3217={};var _0x5694a={};var _0x49a985;var _0x49cdf5;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x11b6b5['params']['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x207800,null))[_0x2089('0x1f')](function(_0x3e9499){if(_0x3e9499){_0x49a985=_0x3e9499;_0x5694a[_0x2089('0x3d')]=_[_0x2089('0x40')](db['FreshdeskField'][_0x2089('0x55')]);_0x5694a['query']=_[_0x2089('0x40')](_0x11b6b5[_0x2089('0x3f')]);_0x5694a[_0x2089('0x41')]=_[_0x2089('0x43')](_0x5694a['model'],_0x5694a[_0x2089('0x3f')]);_0xe3217['attributes']=_[_0x2089('0x43')](_0x5694a['model'],qs[_0x2089('0x44')](_0x11b6b5['query'][_0x2089('0x44')]));_0xe3217[_0x2089('0x42')]=_0xe3217[_0x2089('0x42')][_0x2089('0x45')]?_0xe3217[_0x2089('0x42')]:_0x5694a[_0x2089('0x3d')];_0xe3217['order']=qs['sort'](_0x11b6b5[_0x2089('0x3f')][_0x2089('0x49')]);_0xe3217[_0x2089('0x4a')]=qs['filters'](_[_0x2089('0x4b')](_0x11b6b5['query'],_0x5694a[_0x2089('0x41')]));if(_0x11b6b5[_0x2089('0x3f')][_0x2089('0x4c')]){_0xe3217[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0xe3217[_0x2089('0x4a')],{'$or':_['map'](_0xe3217[_0x2089('0x42')],function(_0x308f2a){var _0x3dd5d9={};_0x3dd5d9[_0x308f2a]={'$like':'%'+_0x11b6b5['query']['filter']+'%'};return _0x3dd5d9;})});}_0xe3217=_[_0x2089('0x4d')]({},_0xe3217,_0x11b6b5[_0x2089('0x5c')]);return _0x49a985[_0x2089('0x5e')](_0xe3217);}})[_0x2089('0x1f')](function(_0x4fbf6a){if(_0x4fbf6a){_0x49cdf5=_0x4fbf6a[_0x2089('0x45')];if(!_0x11b6b5['query']['hasOwnProperty'](_0x2089('0x47'))){_0xe3217[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x11b6b5[_0x2089('0x3f')][_0x2089('0x2d')]);_0xe3217[_0x2089('0x2c')]=qs[_0x2089('0x2c')](_0x11b6b5[_0x2089('0x3f')][_0x2089('0x2c')]);}return _0x49a985['getSubjects'](_0xe3217);}})[_0x2089('0x1f')](function(_0x12a772){if(_0x12a772){return _0x12a772?{'count':_0x49cdf5,'rows':_0x12a772}:null;}})[_0x2089('0x1f')](respondWithResult(_0x207800,null))['catch'](handleError(_0x207800,null));};exports[_0x2089('0x5f')]=function(_0x5854eb,_0x4f97d3,_0x168ce4){var _0x2169a2={};var _0x43a803={};var _0x4b1856;var _0x1dcdc7;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x5854eb['params']['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x4f97d3,null))[_0x2089('0x1f')](function(_0x96a5b6){if(_0x96a5b6){_0x4b1856=_0x96a5b6;_0x43a803[_0x2089('0x3d')]=_['keys'](db[_0x2089('0x5b')][_0x2089('0x55')]);_0x43a803['query']=_[_0x2089('0x40')](_0x5854eb[_0x2089('0x3f')]);_0x43a803['filters']=_['intersection'](_0x43a803[_0x2089('0x3d')],_0x43a803[_0x2089('0x3f')]);_0x2169a2[_0x2089('0x42')]=_['intersection'](_0x43a803[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x5854eb[_0x2089('0x3f')]['fields']));_0x2169a2['attributes']=_0x2169a2[_0x2089('0x42')][_0x2089('0x45')]?_0x2169a2[_0x2089('0x42')]:_0x43a803[_0x2089('0x3d')];_0x2169a2[_0x2089('0x48')]=qs[_0x2089('0x49')](_0x5854eb[_0x2089('0x3f')][_0x2089('0x49')]);_0x2169a2[_0x2089('0x4a')]=qs[_0x2089('0x41')](_[_0x2089('0x4b')](_0x5854eb[_0x2089('0x3f')],_0x43a803[_0x2089('0x41')]));if(_0x5854eb[_0x2089('0x3f')][_0x2089('0x4c')]){_0x2169a2[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0x2169a2[_0x2089('0x4a')],{'$or':_[_0x2089('0x38')](_0x2169a2['attributes'],function(_0x45c807){var _0x1833b1={};_0x1833b1[_0x45c807]={'$like':'%'+_0x5854eb['query'][_0x2089('0x4c')]+'%'};return _0x1833b1;})});}_0x2169a2=_[_0x2089('0x4d')]({},_0x2169a2,_0x5854eb[_0x2089('0x5c')]);return _0x4b1856[_0x2089('0x5f')](_0x2169a2);}})[_0x2089('0x1f')](function(_0x29ef9d){if(_0x29ef9d){_0x1dcdc7=_0x29ef9d['length'];if(!_0x5854eb[_0x2089('0x3f')][_0x2089('0x46')](_0x2089('0x47'))){_0x2169a2[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x5854eb[_0x2089('0x3f')][_0x2089('0x2d')]);_0x2169a2[_0x2089('0x2c')]=qs['offset'](_0x5854eb[_0x2089('0x3f')][_0x2089('0x2c')]);}return _0x4b1856[_0x2089('0x5f')](_0x2169a2);}})[_0x2089('0x1f')](function(_0x56e01a){if(_0x56e01a){return _0x56e01a?{'count':_0x1dcdc7,'rows':_0x56e01a}:null;}})[_0x2089('0x1f')](respondWithResult(_0x4f97d3,null))[_0x2089('0x52')](handleError(_0x4f97d3,null));};exports[_0x2089('0x60')]=function(_0x35dc25,_0x26cbc4,_0x44a1af){var _0x1a1c20={};var _0x23739b={};var _0x5328bf;var _0x436eb3;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x35dc25['params']['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x26cbc4,null))[_0x2089('0x1f')](function(_0x1bc7d1){if(_0x1bc7d1){_0x5328bf=_0x1bc7d1;_0x23739b[_0x2089('0x3d')]=_[_0x2089('0x40')](db[_0x2089('0x61')]['rawAttributes']);_0x23739b[_0x2089('0x3f')]=_['keys'](_0x35dc25['query']);_0x23739b[_0x2089('0x41')]=_[_0x2089('0x43')](_0x23739b[_0x2089('0x3d')],_0x23739b[_0x2089('0x3f')]);_0x1a1c20['attributes']=_[_0x2089('0x43')](_0x23739b[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x35dc25['query'][_0x2089('0x44')]));_0x1a1c20[_0x2089('0x42')]=_0x1a1c20[_0x2089('0x42')][_0x2089('0x45')]?_0x1a1c20['attributes']:_0x23739b[_0x2089('0x3d')];_0x1a1c20[_0x2089('0x48')]=qs[_0x2089('0x49')](_0x35dc25[_0x2089('0x3f')][_0x2089('0x49')]);_0x1a1c20[_0x2089('0x4a')]=qs[_0x2089('0x41')](_['pick'](_0x35dc25[_0x2089('0x3f')],_0x23739b['filters']));if(_0x35dc25[_0x2089('0x3f')]['filter']){_0x1a1c20[_0x2089('0x4a')]=_['merge'](_0x1a1c20[_0x2089('0x4a')],{'$or':_[_0x2089('0x38')](_0x1a1c20['attributes'],function(_0x2cef53){var _0xeb5aff={};_0xeb5aff[_0x2cef53]={'$like':'%'+_0x35dc25[_0x2089('0x3f')][_0x2089('0x4c')]+'%'};return _0xeb5aff;})});}_0x1a1c20=_[_0x2089('0x4d')]({},_0x1a1c20,_0x35dc25['options']);return _0x5328bf[_0x2089('0x60')](_0x1a1c20);}})[_0x2089('0x1f')](function(_0x310a8e){if(_0x310a8e){_0x436eb3=_0x310a8e[_0x2089('0x45')];if(!_0x35dc25['query'][_0x2089('0x46')](_0x2089('0x47'))){_0x1a1c20[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x35dc25[_0x2089('0x3f')][_0x2089('0x2d')]);_0x1a1c20[_0x2089('0x2c')]=qs['offset'](_0x35dc25['query'][_0x2089('0x2c')]);}return _0x5328bf[_0x2089('0x60')](_0x1a1c20);}})[_0x2089('0x1f')](function(_0x1d47b1){if(_0x1d47b1){return _0x1d47b1?{'count':_0x436eb3,'rows':_0x1d47b1}:null;}})[_0x2089('0x1f')](respondWithResult(_0x26cbc4,null))[_0x2089('0x52')](handleError(_0x26cbc4,null));};exports['setTags']=function(_0x4b8b02,_0x412d12,_0x1396f3){if(_0x4b8b02[_0x2089('0x59')]['id']){delete _0x4b8b02['body']['id'];}return db['FreshdeskConfiguration'][_0x2089('0x5a')]({'where':{'id':_0x4b8b02[_0x2089('0x54')]['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x412d12,null))[_0x2089('0x1f')](function(_0x1ad39f){if(_0x1ad39f){return _0x1ad39f[_0x2089('0x62')](_0x4b8b02['body'][_0x2089('0x63')]||[]);}return null;})['then'](respondWithResult(_0x412d12,null))[_0x2089('0x52')](handleError(_0x412d12,null));}; \ No newline at end of file +var _0xe3b0=['find','create','update','body','getFields','FreshdeskField','order','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','index','map','FreshdeskConfiguration','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes'];(function(_0x441033,_0x28eefb){var _0x1283f4=function(_0x5863ad){while(--_0x5863ad){_0x441033['push'](_0x441033['shift']());}};_0x1283f4(++_0x28eefb);}(_0xe3b0,0x133));var _0x0e3b=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xe3b0[_0x4017b0];return _0x5ed4f7;};'use strict';var pdf=require(_0x0e3b('0x0'));var emlformat=require(_0x0e3b('0x1'));var rimraf=require(_0x0e3b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e3b('0x3'));var rp=require(_0x0e3b('0x4'));var moment=require(_0x0e3b('0x5'));var BPromise=require(_0x0e3b('0x6'));var Mustache=require('mustache');var util=require(_0x0e3b('0x7'));var path=require(_0x0e3b('0x8'));var sox=require(_0x0e3b('0x9'));var csv=require(_0x0e3b('0xa'));var ejs=require(_0x0e3b('0xb'));var fs=require('fs');var _=require(_0x0e3b('0xc'));var squel=require(_0x0e3b('0xd'));var crypto=require(_0x0e3b('0xe'));var jsforce=require(_0x0e3b('0xf'));var deskjs=require(_0x0e3b('0x10'));var toCsv=require(_0x0e3b('0xa'));var querystring=require(_0x0e3b('0x11'));var Papa=require('papaparse');var Redis=require(_0x0e3b('0x12'));var authService=require(_0x0e3b('0x13'));var qs=require(_0x0e3b('0x14'));var as=require(_0x0e3b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e3b('0x16'))(_0x0e3b('0x17'));var utils=require(_0x0e3b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0e3b('0x19'));var db=require(_0x0e3b('0x1a'))['db'];var jayson=require(_0x0e3b('0x1b'));var client=jayson[_0x0e3b('0x1c')][_0x0e3b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5747c2,_0x1d7854,_0x4bf704,_0x55c634){return new BPromise(function(_0x4aa81f,_0x68a7ac){var _0x12088b=_0x55c634||client;return _0x12088b[_0x0e3b('0x1e')](_0x5747c2,_0x4bf704)[_0x0e3b('0x1f')](function(_0x424e3e){logger[_0x0e3b('0x20')](_0x0e3b('0x21'),_0x1d7854,_0x0e3b('0x22'));logger[_0x0e3b('0x23')](_0x0e3b('0x24'),_0x1d7854,_0x0e3b('0x22'),JSON[_0x0e3b('0x25')](_0x424e3e));if(_0x424e3e[_0x0e3b('0x26')]){if(_0x424e3e[_0x0e3b('0x26')][_0x0e3b('0x27')]===0x1f4){logger['error'](_0x0e3b('0x21'),_0x1d7854,_0x424e3e['error'][_0x0e3b('0x28')]);return _0x68a7ac(_0x424e3e['error'][_0x0e3b('0x28')]);}logger[_0x0e3b('0x26')](_0x0e3b('0x21'),_0x1d7854,_0x424e3e['error'][_0x0e3b('0x28')]);return _0x4aa81f(_0x424e3e['error']['message']);}else{logger[_0x0e3b('0x20')](_0x0e3b('0x21'),_0x1d7854,'request\x20sent');_0x4aa81f(_0x424e3e[_0x0e3b('0x29')][_0x0e3b('0x28')]);}})[_0x0e3b('0x2a')](function(_0x25ccb3){logger[_0x0e3b('0x26')](_0x0e3b('0x21'),_0x1d7854,_0x25ccb3);_0x68a7ac(_0x25ccb3);});});}function respondWithStatusCode(_0x125ba2,_0x458785){_0x458785=_0x458785||0xcc;return function(_0x3c72f2){if(_0x3c72f2){return _0x125ba2[_0x0e3b('0x2b')](_0x458785);}return _0x125ba2[_0x0e3b('0x2c')](_0x458785)[_0x0e3b('0x2d')]();};}function respondWithResult(_0x5d0620,_0xad8ae5){_0xad8ae5=_0xad8ae5||0xc8;return function(_0x35e528){if(_0x35e528){return _0x5d0620['status'](_0xad8ae5)[_0x0e3b('0x2e')](_0x35e528);}};}function respondWithFilteredResult(_0x599320,_0x570cde){return function(_0x4d3a27){if(_0x4d3a27){var _0x154f28=_0x4d3a27[_0x0e3b('0x2f')],_0x51aecf=_0x570cde[_0x0e3b('0x30')],_0x2a3221=_0x570cde[_0x0e3b('0x30')]+_0x570cde[_0x0e3b('0x31')],_0x4ebbe;if(_0x2a3221>=_0x154f28){_0x2a3221=_0x154f28;_0x4ebbe=0xc8;}else{_0x4ebbe=0xce;}_0x599320[_0x0e3b('0x2c')](_0x4ebbe);return _0x599320[_0x0e3b('0x32')](_0x0e3b('0x33'),_0x51aecf+'-'+_0x2a3221+'/'+_0x154f28)[_0x0e3b('0x2e')](_0x4d3a27);}return null;};}function patchUpdates(_0x3b0c58){return function(_0x331921){try{jsonpatch[_0x0e3b('0x34')](_0x331921,_0x3b0c58,!![]);}catch(_0x5532f0){return BPromise[_0x0e3b('0x35')](_0x5532f0);}return _0x331921[_0x0e3b('0x36')]();};}function saveUpdates(_0x3340c3,_0x521252){return function(_0x5a25e8){if(_0x5a25e8){return _0x5a25e8['update'](_0x3340c3)[_0x0e3b('0x1f')](function(_0x4249b1){return _0x4249b1;});}return null;};}function removeEntity(_0x26615e,_0x58bed5){return function(_0x1e0ce1){if(_0x1e0ce1){return _0x1e0ce1[_0x0e3b('0x37')]()[_0x0e3b('0x1f')](function(){_0x26615e[_0x0e3b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1492fd,_0x1c0674){return function(_0x11972f){if(!_0x11972f){_0x1492fd['sendStatus'](0x194);}return _0x11972f;};}function handleError(_0xea07ec,_0x2a0743){_0x2a0743=_0x2a0743||0x1f4;return function(_0x576253){logger['error'](_0x576253['stack']);if(_0x576253[_0x0e3b('0x38')]){delete _0x576253['name'];}_0xea07ec['status'](_0x2a0743)['send'](_0x576253);};}exports[_0x0e3b('0x39')]=function(_0x2d8165,_0x3b2a4c){var _0x4b831d={},_0x43073d={},_0x22f92f={'count':0x0,'rows':[]};var _0x290141=_[_0x0e3b('0x3a')](db[_0x0e3b('0x3b')]['rawAttributes'],function(_0x260110){return{'name':_0x260110['fieldName'],'type':_0x260110[_0x0e3b('0x3c')]['key']};});_0x43073d['model']=_[_0x0e3b('0x3a')](_0x290141,'name');_0x43073d[_0x0e3b('0x3d')]=_[_0x0e3b('0x3e')](_0x2d8165[_0x0e3b('0x3d')]);_0x43073d[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x43073d['model'],_0x43073d['query']);_0x4b831d[_0x0e3b('0x41')]=_['intersection'](_0x43073d['model'],qs[_0x0e3b('0x42')](_0x2d8165[_0x0e3b('0x3d')]['fields']));_0x4b831d[_0x0e3b('0x41')]=_0x4b831d['attributes'][_0x0e3b('0x43')]?_0x4b831d[_0x0e3b('0x41')]:_0x43073d[_0x0e3b('0x44')];if(!_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x4b831d[_0x0e3b('0x31')]=qs[_0x0e3b('0x31')](_0x2d8165[_0x0e3b('0x3d')]['limit']);_0x4b831d[_0x0e3b('0x30')]=qs[_0x0e3b('0x30')](_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x30')]);}_0x4b831d['order']=qs[_0x0e3b('0x47')](_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x4b831d[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_[_0x0e3b('0x49')](_0x2d8165[_0x0e3b('0x3d')],_0x43073d[_0x0e3b('0x3f')]),_0x290141);if(_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x4a')]){_0x4b831d['where']=_[_0x0e3b('0x4b')](_0x4b831d[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x290141,function(_0x4a38a2){if(_0x4a38a2[_0x0e3b('0x3c')]!==_0x0e3b('0x4c')){var _0x3f77a4={};_0x3f77a4[_0x4a38a2[_0x0e3b('0x38')]]={'$like':'%'+_0x2d8165[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x3f77a4;}})});}_0x4b831d=_[_0x0e3b('0x4b')]({},_0x4b831d,_0x2d8165[_0x0e3b('0x4d')]);var _0x57b506={'where':_0x4b831d[_0x0e3b('0x48')]};return db[_0x0e3b('0x3b')][_0x0e3b('0x2f')](_0x57b506)[_0x0e3b('0x1f')](function(_0x13647a){_0x22f92f[_0x0e3b('0x2f')]=_0x13647a;if(_0x2d8165['query'][_0x0e3b('0x4e')]){_0x4b831d[_0x0e3b('0x4f')]=[{'all':!![]}];}return db[_0x0e3b('0x3b')][_0x0e3b('0x50')](_0x4b831d);})[_0x0e3b('0x1f')](function(_0x252765){_0x22f92f[_0x0e3b('0x51')]=_0x252765;return _0x22f92f;})[_0x0e3b('0x1f')](respondWithFilteredResult(_0x3b2a4c,_0x4b831d))[_0x0e3b('0x2a')](handleError(_0x3b2a4c,null));};exports[_0x0e3b('0x52')]=function(_0x5c0c9a,_0x313440){var _0x14a22d={'raw':![],'where':{'id':_0x5c0c9a[_0x0e3b('0x53')]['id']}},_0x426297={};_0x426297[_0x0e3b('0x44')]=_[_0x0e3b('0x3e')](db[_0x0e3b('0x3b')][_0x0e3b('0x54')]);_0x426297[_0x0e3b('0x3d')]=_['keys'](_0x5c0c9a[_0x0e3b('0x3d')]);_0x426297['filters']=_['intersection'](_0x426297[_0x0e3b('0x44')],_0x426297[_0x0e3b('0x3d')]);_0x14a22d['attributes']=_[_0x0e3b('0x40')](_0x426297['model'],qs[_0x0e3b('0x42')](_0x5c0c9a[_0x0e3b('0x3d')][_0x0e3b('0x42')]));_0x14a22d[_0x0e3b('0x41')]=_0x14a22d[_0x0e3b('0x41')][_0x0e3b('0x43')]?_0x14a22d[_0x0e3b('0x41')]:_0x426297[_0x0e3b('0x44')];if(_0x5c0c9a['query'][_0x0e3b('0x4e')]){_0x14a22d[_0x0e3b('0x4f')]=[{'all':!![]}];}_0x14a22d=_['merge']({},_0x14a22d,_0x5c0c9a[_0x0e3b('0x4d')]);return db[_0x0e3b('0x3b')][_0x0e3b('0x55')](_0x14a22d)[_0x0e3b('0x1f')](handleEntityNotFound(_0x313440,null))['then'](respondWithResult(_0x313440,null))['catch'](handleError(_0x313440,null));};exports[_0x0e3b('0x56')]=function(_0x9dfef,_0x342b5f){return db[_0x0e3b('0x3b')]['create'](_0x9dfef['body'],{})[_0x0e3b('0x1f')](respondWithResult(_0x342b5f,0xc9))[_0x0e3b('0x2a')](handleError(_0x342b5f,null));};exports[_0x0e3b('0x57')]=function(_0x11961e,_0x12ddb2){if(_0x11961e[_0x0e3b('0x58')]['id']){delete _0x11961e[_0x0e3b('0x58')]['id'];}return db['FreshdeskConfiguration'][_0x0e3b('0x55')]({'where':{'id':_0x11961e[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x12ddb2,null))[_0x0e3b('0x1f')](saveUpdates(_0x11961e['body'],null))['then'](respondWithResult(_0x12ddb2,null))['catch'](handleError(_0x12ddb2,null));};exports[_0x0e3b('0x37')]=function(_0x1e13f5,_0x4ae405){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1e13f5[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x4ae405,null))['then'](removeEntity(_0x4ae405,null))[_0x0e3b('0x2a')](handleError(_0x4ae405,null));};exports[_0x0e3b('0x59')]=function(_0x4655c6,_0x3252cc,_0x19be15){var _0x38c5ae={};var _0x333855={};var _0x2a5102;var _0x559014;return db[_0x0e3b('0x3b')]['findOne']({'where':{'id':_0x4655c6[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x3252cc,null))[_0x0e3b('0x1f')](function(_0x138f7a){if(_0x138f7a){_0x2a5102=_0x138f7a;_0x333855[_0x0e3b('0x44')]=_[_0x0e3b('0x3e')](db[_0x0e3b('0x5a')][_0x0e3b('0x54')]);_0x333855['query']=_[_0x0e3b('0x3e')](_0x4655c6[_0x0e3b('0x3d')]);_0x333855['filters']=_['intersection'](_0x333855[_0x0e3b('0x44')],_0x333855['query']);_0x38c5ae[_0x0e3b('0x41')]=_[_0x0e3b('0x40')](_0x333855[_0x0e3b('0x44')],qs[_0x0e3b('0x42')](_0x4655c6[_0x0e3b('0x3d')]['fields']));_0x38c5ae[_0x0e3b('0x41')]=_0x38c5ae['attributes']['length']?_0x38c5ae['attributes']:_0x333855[_0x0e3b('0x44')];_0x38c5ae[_0x0e3b('0x5b')]=qs['sort'](_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x38c5ae[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_['pick'](_0x4655c6['query'],_0x333855[_0x0e3b('0x3f')]));if(_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x4a')]){_0x38c5ae[_0x0e3b('0x48')]=_['merge'](_0x38c5ae['where'],{'$or':_[_0x0e3b('0x3a')](_0x38c5ae[_0x0e3b('0x41')],function(_0x5513a2){var _0x5f6919={};_0x5f6919[_0x5513a2]={'$like':'%'+_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x5f6919;})});}_0x38c5ae=_[_0x0e3b('0x4b')]({},_0x38c5ae,_0x4655c6[_0x0e3b('0x4d')]);return _0x2a5102[_0x0e3b('0x59')](_0x38c5ae);}})['then'](function(_0xeaf9c0){if(_0xeaf9c0){_0x559014=_0xeaf9c0[_0x0e3b('0x43')];if(!_0x4655c6['query'][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x38c5ae['limit']=qs['limit'](_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x31')]);_0x38c5ae['offset']=qs[_0x0e3b('0x30')](_0x4655c6[_0x0e3b('0x3d')][_0x0e3b('0x30')]);}return _0x2a5102[_0x0e3b('0x59')](_0x38c5ae);}})[_0x0e3b('0x1f')](function(_0x16ea24){if(_0x16ea24){return _0x16ea24?{'count':_0x559014,'rows':_0x16ea24}:null;}})['then'](respondWithResult(_0x3252cc,null))[_0x0e3b('0x2a')](handleError(_0x3252cc,null));};exports[_0x0e3b('0x5c')]=function(_0x2e7ade,_0x19868c,_0x314b38){var _0x3be4e3={};var _0x382361={};var _0xd6d6e4;var _0x3b76e3;return db[_0x0e3b('0x3b')][_0x0e3b('0x5d')]({'where':{'id':_0x2e7ade[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x19868c,null))[_0x0e3b('0x1f')](function(_0x405260){if(_0x405260){_0xd6d6e4=_0x405260;_0x382361[_0x0e3b('0x44')]=_[_0x0e3b('0x3e')](db['FreshdeskField'][_0x0e3b('0x54')]);_0x382361[_0x0e3b('0x3d')]=_['keys'](_0x2e7ade[_0x0e3b('0x3d')]);_0x382361[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x382361[_0x0e3b('0x44')],_0x382361[_0x0e3b('0x3d')]);_0x3be4e3[_0x0e3b('0x41')]=_['intersection'](_0x382361[_0x0e3b('0x44')],qs[_0x0e3b('0x42')](_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x42')]));_0x3be4e3[_0x0e3b('0x41')]=_0x3be4e3[_0x0e3b('0x41')][_0x0e3b('0x43')]?_0x3be4e3[_0x0e3b('0x41')]:_0x382361[_0x0e3b('0x44')];_0x3be4e3[_0x0e3b('0x5b')]=qs[_0x0e3b('0x47')](_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x3be4e3[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_[_0x0e3b('0x49')](_0x2e7ade['query'],_0x382361[_0x0e3b('0x3f')]));if(_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x4a')]){_0x3be4e3[_0x0e3b('0x48')]=_[_0x0e3b('0x4b')](_0x3be4e3[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x3be4e3[_0x0e3b('0x41')],function(_0x28aff9){var _0x55a849={};_0x55a849[_0x28aff9]={'$like':'%'+_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x55a849;})});}_0x3be4e3=_[_0x0e3b('0x4b')]({},_0x3be4e3,_0x2e7ade[_0x0e3b('0x4d')]);return _0xd6d6e4[_0x0e3b('0x5c')](_0x3be4e3);}})['then'](function(_0x518fc2){if(_0x518fc2){_0x3b76e3=_0x518fc2[_0x0e3b('0x43')];if(!_0x2e7ade[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x3be4e3['limit']=qs[_0x0e3b('0x31')](_0x2e7ade['query']['limit']);_0x3be4e3[_0x0e3b('0x30')]=qs[_0x0e3b('0x30')](_0x2e7ade['query']['offset']);}return _0xd6d6e4[_0x0e3b('0x5c')](_0x3be4e3);}})[_0x0e3b('0x1f')](function(_0x114017){if(_0x114017){return _0x114017?{'count':_0x3b76e3,'rows':_0x114017}:null;}})['then'](respondWithResult(_0x19868c,null))[_0x0e3b('0x2a')](handleError(_0x19868c,null));};exports[_0x0e3b('0x5e')]=function(_0x5bcb5c,_0x283e18,_0x477bb2){var _0x3da1a6={};var _0x1c88bc={};var _0x4ec30b;var _0x81cde6;return db[_0x0e3b('0x3b')][_0x0e3b('0x5d')]({'where':{'id':_0x5bcb5c[_0x0e3b('0x53')]['id']}})['then'](handleEntityNotFound(_0x283e18,null))[_0x0e3b('0x1f')](function(_0x2d219e){if(_0x2d219e){_0x4ec30b=_0x2d219e;_0x1c88bc['model']=_[_0x0e3b('0x3e')](db[_0x0e3b('0x5a')][_0x0e3b('0x54')]);_0x1c88bc[_0x0e3b('0x3d')]=_[_0x0e3b('0x3e')](_0x5bcb5c['query']);_0x1c88bc[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x1c88bc['model'],_0x1c88bc[_0x0e3b('0x3d')]);_0x3da1a6[_0x0e3b('0x41')]=_[_0x0e3b('0x40')](_0x1c88bc['model'],qs[_0x0e3b('0x42')](_0x5bcb5c[_0x0e3b('0x3d')]['fields']));_0x3da1a6['attributes']=_0x3da1a6[_0x0e3b('0x41')][_0x0e3b('0x43')]?_0x3da1a6[_0x0e3b('0x41')]:_0x1c88bc['model'];_0x3da1a6[_0x0e3b('0x5b')]=qs['sort'](_0x5bcb5c['query']['sort']);_0x3da1a6[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_['pick'](_0x5bcb5c[_0x0e3b('0x3d')],_0x1c88bc[_0x0e3b('0x3f')]));if(_0x5bcb5c['query'][_0x0e3b('0x4a')]){_0x3da1a6[_0x0e3b('0x48')]=_['merge'](_0x3da1a6[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x3da1a6['attributes'],function(_0x20e8d4){var _0x341fb9={};_0x341fb9[_0x20e8d4]={'$like':'%'+_0x5bcb5c[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x341fb9;})});}_0x3da1a6=_['merge']({},_0x3da1a6,_0x5bcb5c[_0x0e3b('0x4d')]);return _0x4ec30b[_0x0e3b('0x5e')](_0x3da1a6);}})['then'](function(_0xa91cab){if(_0xa91cab){_0x81cde6=_0xa91cab[_0x0e3b('0x43')];if(!_0x5bcb5c[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x3da1a6[_0x0e3b('0x31')]=qs['limit'](_0x5bcb5c[_0x0e3b('0x3d')][_0x0e3b('0x31')]);_0x3da1a6['offset']=qs['offset'](_0x5bcb5c['query'][_0x0e3b('0x30')]);}return _0x4ec30b[_0x0e3b('0x5e')](_0x3da1a6);}})['then'](function(_0x1eb82e){if(_0x1eb82e){return _0x1eb82e?{'count':_0x81cde6,'rows':_0x1eb82e}:null;}})[_0x0e3b('0x1f')](respondWithResult(_0x283e18,null))['catch'](handleError(_0x283e18,null));};exports['getTags']=function(_0x20d569,_0x731aeb,_0x11192d){var _0x45c218={};var _0x5ee208={};var _0xb5d25d;var _0x2362cd;return db['FreshdeskConfiguration'][_0x0e3b('0x5d')]({'where':{'id':_0x20d569['params']['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x731aeb,null))[_0x0e3b('0x1f')](function(_0x1c23e1){if(_0x1c23e1){_0xb5d25d=_0x1c23e1;_0x5ee208[_0x0e3b('0x44')]=_['keys'](db[_0x0e3b('0x5f')][_0x0e3b('0x54')]);_0x5ee208['query']=_[_0x0e3b('0x3e')](_0x20d569[_0x0e3b('0x3d')]);_0x5ee208[_0x0e3b('0x3f')]=_[_0x0e3b('0x40')](_0x5ee208['model'],_0x5ee208[_0x0e3b('0x3d')]);_0x45c218['attributes']=_[_0x0e3b('0x40')](_0x5ee208[_0x0e3b('0x44')],qs[_0x0e3b('0x42')](_0x20d569['query'][_0x0e3b('0x42')]));_0x45c218[_0x0e3b('0x41')]=_0x45c218['attributes'][_0x0e3b('0x43')]?_0x45c218['attributes']:_0x5ee208[_0x0e3b('0x44')];_0x45c218[_0x0e3b('0x5b')]=qs[_0x0e3b('0x47')](_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x47')]);_0x45c218[_0x0e3b('0x48')]=qs[_0x0e3b('0x3f')](_[_0x0e3b('0x49')](_0x20d569['query'],_0x5ee208[_0x0e3b('0x3f')]));if(_0x20d569['query'][_0x0e3b('0x4a')]){_0x45c218[_0x0e3b('0x48')]=_[_0x0e3b('0x4b')](_0x45c218[_0x0e3b('0x48')],{'$or':_[_0x0e3b('0x3a')](_0x45c218[_0x0e3b('0x41')],function(_0x5afe62){var _0x521d08={};_0x521d08[_0x5afe62]={'$like':'%'+_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x4a')]+'%'};return _0x521d08;})});}_0x45c218=_[_0x0e3b('0x4b')]({},_0x45c218,_0x20d569[_0x0e3b('0x4d')]);return _0xb5d25d[_0x0e3b('0x60')](_0x45c218);}})['then'](function(_0x462966){if(_0x462966){_0x2362cd=_0x462966[_0x0e3b('0x43')];if(!_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x45')](_0x0e3b('0x46'))){_0x45c218[_0x0e3b('0x31')]=qs[_0x0e3b('0x31')](_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x31')]);_0x45c218[_0x0e3b('0x30')]=qs[_0x0e3b('0x30')](_0x20d569[_0x0e3b('0x3d')][_0x0e3b('0x30')]);}return _0xb5d25d[_0x0e3b('0x60')](_0x45c218);}})['then'](function(_0x33ac19){if(_0x33ac19){return _0x33ac19?{'count':_0x2362cd,'rows':_0x33ac19}:null;}})[_0x0e3b('0x1f')](respondWithResult(_0x731aeb,null))[_0x0e3b('0x2a')](handleError(_0x731aeb,null));};exports[_0x0e3b('0x61')]=function(_0x9493f5,_0x284907,_0xc2ec37){if(_0x9493f5[_0x0e3b('0x58')]['id']){delete _0x9493f5['body']['id'];}return db[_0x0e3b('0x3b')]['findOne']({'where':{'id':_0x9493f5[_0x0e3b('0x53')]['id']}})[_0x0e3b('0x1f')](handleEntityNotFound(_0x284907,null))['then'](function(_0x1146b9){if(_0x1146b9){return _0x1146b9[_0x0e3b('0x61')](_0x9493f5[_0x0e3b('0x58')]['ids']||[]);}return null;})['then'](respondWithResult(_0x284907,null))[_0x0e3b('0x2a')](handleError(_0x284907,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7157de3..8503c26 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 _0x3ee7=['FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','path','exports'];(function(_0xa6caeb,_0x5df242){var _0x4ad557=function(_0xa9a7d7){while(--_0xa9a7d7){_0xa6caeb['push'](_0xa6caeb['shift']());}};_0x4ad557(++_0x5df242);}(_0x3ee7,0x1c9));var _0x73ee=function(_0x614ef4,_0x28a060){_0x614ef4=_0x614ef4-0x0;var _0x35e8e2=_0x3ee7[_0x614ef4];return _0x35e8e2;};'use strict';var _=require('lodash');var util=require(_0x73ee('0x0'));var logger=require(_0x73ee('0x1'))(_0x73ee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ee('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x73ee('0x4')]=function(_0x2343ee,_0x4d4791){return _0x2343ee['define'](_0x73ee('0x5'),attributes,{'tableName':_0x73ee('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2138=['FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x506821,_0x21393b){var _0x188741=function(_0x3dc88c){while(--_0x3dc88c){_0x506821['push'](_0x506821['shift']());}};_0x188741(++_0x21393b);}(_0x2138,0xe6));var _0x8213=function(_0x265a38,_0x26f553){_0x265a38=_0x265a38-0x0;var _0x510102=_0x2138[_0x265a38];return _0x510102;};'use strict';var _=require('lodash');var util=require(_0x8213('0x0'));var logger=require(_0x8213('0x1'))(_0x8213('0x2'));var moment=require(_0x8213('0x3'));var BPromise=require('bluebird');var rp=require(_0x8213('0x4'));var fs=require('fs');var path=require(_0x8213('0x5'));var rimraf=require(_0x8213('0x6'));var config=require('../../config/environment');var attributes=require(_0x8213('0x7'));module[_0x8213('0x8')]=function(_0x7daabb,_0x4671fb){return _0x7daabb[_0x8213('0x9')](_0x8213('0xa'),attributes,{'tableName':_0x8213('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 7868a11..48ea362 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 _0x207b=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','lodash'];(function(_0x499f6d,_0x2ac461){var _0x51e405=function(_0x1f34f){while(--_0x1f34f){_0x499f6d['push'](_0x499f6d['shift']());}};_0x51e405(++_0x2ac461);}(_0x207b,0x168));var _0xb207=function(_0x4b1753,_0x5b814c){_0x4b1753=_0x4b1753-0x0;var _0x3434f9=_0x207b[_0x4b1753];return _0x3434f9;};'use strict';var _=require(_0xb207('0x0'));var util=require('util');var moment=require(_0xb207('0x1'));var BPromise=require(_0xb207('0x2'));var rs=require(_0xb207('0x3'));var fs=require('fs');var Redis=require(_0xb207('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb207('0x5'));var config=require(_0xb207('0x6'));var jayson=require(_0xb207('0x7'));var client=jayson[_0xb207('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e7ac4,_0x226996,_0xfe1fae){return new BPromise(function(_0x3da872,_0x41bee5){return client['request'](_0x5e7ac4,_0xfe1fae)[_0xb207('0x9')](function(_0x567173){logger[_0xb207('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x226996,'request\x20sent');logger[_0xb207('0xb')](_0xb207('0xc'),_0x226996,'request\x20sent',JSON['stringify'](_0x567173));if(_0x567173['error']){if(_0x567173[_0xb207('0xd')][_0xb207('0xe')]===0x1f4){logger['error'](_0xb207('0xf'),_0x226996,_0x567173[_0xb207('0xd')][_0xb207('0x10')]);return _0x41bee5(_0x567173['error']['message']);}logger[_0xb207('0xd')](_0xb207('0xf'),_0x226996,_0x567173['error']['message']);return _0x3da872(_0x567173[_0xb207('0xd')][_0xb207('0x10')]);}else{logger[_0xb207('0xa')](_0xb207('0xf'),_0x226996,_0xb207('0x11'));_0x3da872(_0x567173['result'][_0xb207('0x10')]);}})[_0xb207('0x12')](function(_0x5dc20c){logger[_0xb207('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x226996,_0x5dc20c);_0x41bee5(_0x5dc20c);});});} \ No newline at end of file +var _0xf574=['info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xf574,0x173));var _0x4f57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf574[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4f57('0x0'));var util=require('util');var moment=require(_0x4f57('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f57('0x2'))['db'];var utils=require(_0x4f57('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x4f57('0x4'));var jayson=require(_0x4f57('0x5'));var client=jayson['client'][_0x4f57('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xdf7859,_0x237a5f,_0x5ed61b){return new BPromise(function(_0xdf5e80,_0x46b820){return client[_0x4f57('0x7')](_0xdf7859,_0x5ed61b)[_0x4f57('0x8')](function(_0x238869){logger[_0x4f57('0x9')](_0x4f57('0xa'),_0x237a5f,'request\x20sent');logger[_0x4f57('0xb')](_0x4f57('0xc'),_0x237a5f,'request\x20sent',JSON[_0x4f57('0xd')](_0x238869));if(_0x238869['error']){if(_0x238869[_0x4f57('0xe')][_0x4f57('0xf')]===0x1f4){logger['error'](_0x4f57('0xa'),_0x237a5f,_0x238869[_0x4f57('0xe')][_0x4f57('0x10')]);return _0x46b820(_0x238869[_0x4f57('0xe')][_0x4f57('0x10')]);}logger['error'](_0x4f57('0xa'),_0x237a5f,_0x238869['error'][_0x4f57('0x10')]);return _0xdf5e80(_0x238869['error']['message']);}else{logger[_0x4f57('0x9')](_0x4f57('0xa'),_0x237a5f,_0x4f57('0x11'));_0xdf5e80(_0x238869[_0x4f57('0x12')]['message']);}})[_0x4f57('0x13')](function(_0x3e033b){logger[_0x4f57('0xe')](_0x4f57('0xa'),_0x237a5f,_0x3e033b);_0x46b820(_0x3e033b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 199c55b..a2931a6 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x1a31ef,_0x45f37d){var _0x199b4e=function(_0x5112ed){while(--_0x5112ed){_0x1a31ef['push'](_0x1a31ef['shift']());}};_0x199b4e(++_0x45f37d);}(_0x008c,0x188));var _0xc008=function(_0x7e3f06,_0x426f70){_0x7e3f06=_0x7e3f06-0x0;var _0x12b8ff=_0x008c[_0x7e3f06];return _0x12b8ff;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x2f454b,_0x4f0132){var _0x3077ab=function(_0x4cd985){while(--_0x4cd985){_0x2f454b['push'](_0x2f454b['shift']());}};_0x3077ab(++_0x4f0132);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0263e01..bb1dd13 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 _0x0a62=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a62,0x119));var _0x20a6=function(_0x18b000,_0x513c1b){_0x18b000=_0x18b000-0x0;var _0xfb7686=_0x0a62[_0x18b000];return _0xfb7686;};'use strict';var Sequelize=require(_0x20a6('0x0'));module[_0x20a6('0x1')]={'type':{'type':Sequelize[_0x20a6('0x2')](_0x20a6('0x3'),_0x20a6('0x4'),_0x20a6('0x5'),_0x20a6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x20a6('0x7')]},'keyType':{'type':Sequelize[_0x20a6('0x2')]('string',_0x20a6('0x4'),_0x20a6('0x5'))},'keyContent':{'type':Sequelize[_0x20a6('0x7')]},'idField':{'type':Sequelize[_0x20a6('0x7')]},'nameField':{'type':Sequelize[_0x20a6('0x7')]},'customField':{'type':Sequelize[_0x20a6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ef0=['sequelize','exports','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x1a9772,_0x54a384){var _0x346e7e=function(_0x5cae0c){while(--_0x5cae0c){_0x1a9772['push'](_0x1a9772['shift']());}};_0x346e7e(++_0x54a384);}(_0x0ef0,0x80));var _0x00ef=function(_0x1fbf82,_0x5a47f3){_0x1fbf82=_0x1fbf82-0x0;var _0x2374a5=_0x0ef0[_0x1fbf82];return _0x2374a5;};'use strict';var Sequelize=require(_0x00ef('0x0'));module[_0x00ef('0x1')]={'type':{'type':Sequelize['ENUM'](_0x00ef('0x2'),_0x00ef('0x3'),_0x00ef('0x4'),_0x00ef('0x5')),'defaultValue':_0x00ef('0x2')},'content':{'type':Sequelize[_0x00ef('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x00ef('0x2'),_0x00ef('0x3'),_0x00ef('0x4'))},'keyContent':{'type':Sequelize[_0x00ef('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x00ef('0x6')]},'customField':{'type':Sequelize[_0x00ef('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00ef('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3137cc3..40fd67a 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 _0x643d=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','update','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x789218,_0x462ef6){var _0x2ead51=function(_0x555260){while(--_0x555260){_0x789218['push'](_0x789218['shift']());}};_0x2ead51(++_0x462ef6);}(_0x643d,0x1df));var _0xd643=function(_0x5c86d3,_0x1dd4b4){_0x5c86d3=_0x5c86d3-0x0;var _0x1f36c9=_0x643d[_0x5c86d3];return _0x1f36c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd643('0x0'));var rimraf=require(_0xd643('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd643('0x2'));var moment=require(_0xd643('0x3'));var BPromise=require(_0xd643('0x4'));var Mustache=require(_0xd643('0x5'));var util=require('util');var path=require(_0xd643('0x6'));var sox=require(_0xd643('0x7'));var csv=require(_0xd643('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd643('0x9'));var squel=require(_0xd643('0xa'));var crypto=require(_0xd643('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd643('0xc'));var toCsv=require(_0xd643('0x8'));var querystring=require('querystring');var Papa=require(_0xd643('0xd'));var Redis=require(_0xd643('0xe'));var authService=require(_0xd643('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd643('0x10'));var hardwareService=require(_0xd643('0x11'));var logger=require('../../config/logger')(_0xd643('0x12'));var utils=require(_0xd643('0x13'));var config=require(_0xd643('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbca92,_0x3c5ac3){_0x3c5ac3=_0x3c5ac3||0xcc;return function(_0x31ddf3){if(_0x31ddf3){return _0xbca92['sendStatus'](_0x3c5ac3);}return _0xbca92[_0xd643('0x15')](_0x3c5ac3)[_0xd643('0x16')]();};}function respondWithResult(_0x2b8816,_0x58699d){_0x58699d=_0x58699d||0xc8;return function(_0xeb392){if(_0xeb392){return _0x2b8816['status'](_0x58699d)[_0xd643('0x17')](_0xeb392);}};}function respondWithFilteredResult(_0x3e4ed1,_0x4b582d){return function(_0x49bfd4){if(_0x49bfd4){var _0x320f42=_0x49bfd4['count'],_0x10dc9a=_0x4b582d[_0xd643('0x18')],_0x1e97be=_0x4b582d[_0xd643('0x18')]+_0x4b582d['limit'],_0x4d4715;if(_0x1e97be>=_0x320f42){_0x1e97be=_0x320f42;_0x4d4715=0xc8;}else{_0x4d4715=0xce;}_0x3e4ed1['status'](_0x4d4715);return _0x3e4ed1[_0xd643('0x19')](_0xd643('0x1a'),_0x10dc9a+'-'+_0x1e97be+'/'+_0x320f42)['json'](_0x49bfd4);}return null;};}function patchUpdates(_0x50a54e){return function(_0xeedc12){try{jsonpatch[_0xd643('0x1b')](_0xeedc12,_0x50a54e,!![]);}catch(_0x3242f3){return BPromise[_0xd643('0x1c')](_0x3242f3);}return _0xeedc12[_0xd643('0x1d')]();};}function saveUpdates(_0x4ae93a,_0x307683){return function(_0x504dd1){if(_0x504dd1){return _0x504dd1['update'](_0x4ae93a)[_0xd643('0x1e')](function(_0x1edf77){return _0x1edf77;});}return null;};}function removeEntity(_0x3a8161,_0x489815){return function(_0x2a1b19){if(_0x2a1b19){return _0x2a1b19[_0xd643('0x1f')]()[_0xd643('0x1e')](function(){_0x3a8161['status'](0xcc)[_0xd643('0x16')]();});}};}function handleEntityNotFound(_0x479b61,_0x4c65c8){return function(_0x2f3fbe){if(!_0x2f3fbe){_0x479b61[_0xd643('0x20')](0x194);}return _0x2f3fbe;};}function handleError(_0x4c24c0,_0x23a055){_0x23a055=_0x23a055||0x1f4;return function(_0x2c1b02){logger[_0xd643('0x21')](_0x2c1b02[_0xd643('0x22')]);if(_0x2c1b02['name']){delete _0x2c1b02['name'];}_0x4c24c0[_0xd643('0x15')](_0x23a055)[_0xd643('0x23')](_0x2c1b02);};}exports[_0xd643('0x24')]=function(_0x208fca,_0x5a486b){var _0x1347a0={},_0x5780c0={},_0x55f021={'count':0x0,'rows':[]};var _0xa406eb=_[_0xd643('0x25')](db[_0xd643('0x26')][_0xd643('0x27')],function(_0x39b368){return{'name':_0x39b368[_0xd643('0x28')],'type':_0x39b368[_0xd643('0x29')][_0xd643('0x2a')]};});_0x5780c0[_0xd643('0x2b')]=_[_0xd643('0x25')](_0xa406eb,_0xd643('0x2c'));_0x5780c0[_0xd643('0x2d')]=_['keys'](_0x208fca[_0xd643('0x2d')]);_0x5780c0[_0xd643('0x2e')]=_['intersection'](_0x5780c0['model'],_0x5780c0['query']);_0x1347a0['attributes']=_[_0xd643('0x2f')](_0x5780c0['model'],qs[_0xd643('0x30')](_0x208fca[_0xd643('0x2d')][_0xd643('0x30')]));_0x1347a0[_0xd643('0x31')]=_0x1347a0[_0xd643('0x31')][_0xd643('0x32')]?_0x1347a0[_0xd643('0x31')]:_0x5780c0[_0xd643('0x2b')];if(!_0x208fca[_0xd643('0x2d')][_0xd643('0x33')](_0xd643('0x34'))){_0x1347a0['limit']=qs[_0xd643('0x35')](_0x208fca[_0xd643('0x2d')][_0xd643('0x35')]);_0x1347a0[_0xd643('0x18')]=qs[_0xd643('0x18')](_0x208fca['query']['offset']);}_0x1347a0[_0xd643('0x36')]=qs[_0xd643('0x37')](_0x208fca[_0xd643('0x2d')]['sort']);_0x1347a0['where']=qs[_0xd643('0x2e')](_[_0xd643('0x38')](_0x208fca[_0xd643('0x2d')],_0x5780c0[_0xd643('0x2e')]),_0xa406eb);if(_0x208fca[_0xd643('0x2d')]['filter']){_0x1347a0['where']=_['merge'](_0x1347a0[_0xd643('0x39')],{'$or':_[_0xd643('0x25')](_0xa406eb,function(_0x270ff4){if(_0x270ff4[_0xd643('0x29')]!==_0xd643('0x3a')){var _0x537680={};_0x537680[_0x270ff4[_0xd643('0x2c')]]={'$like':'%'+_0x208fca['query'][_0xd643('0x3b')]+'%'};return _0x537680;}})});}_0x1347a0=_[_0xd643('0x3c')]({},_0x1347a0,_0x208fca[_0xd643('0x3d')]);var _0x1a6000={'where':_0x1347a0[_0xd643('0x39')]};return db['FreshdeskField'][_0xd643('0x3e')](_0x1a6000)[_0xd643('0x1e')](function(_0x12e68b){_0x55f021[_0xd643('0x3e')]=_0x12e68b;if(_0x208fca[_0xd643('0x2d')][_0xd643('0x3f')]){_0x1347a0['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xd643('0x40')](_0x1347a0);})[_0xd643('0x1e')](function(_0xa5709a){_0x55f021[_0xd643('0x41')]=_0xa5709a;return _0x55f021;})[_0xd643('0x1e')](respondWithFilteredResult(_0x5a486b,_0x1347a0))[_0xd643('0x42')](handleError(_0x5a486b,null));};exports[_0xd643('0x43')]=function(_0x373a5e,_0x2bffe5){var _0x7c651b={'raw':!![],'where':{'id':_0x373a5e[_0xd643('0x44')]['id']}},_0x246b82={};_0x246b82[_0xd643('0x2b')]=_[_0xd643('0x45')](db[_0xd643('0x26')][_0xd643('0x27')]);_0x246b82['query']=_[_0xd643('0x45')](_0x373a5e['query']);_0x246b82['filters']=_[_0xd643('0x2f')](_0x246b82[_0xd643('0x2b')],_0x246b82[_0xd643('0x2d')]);_0x7c651b[_0xd643('0x31')]=_[_0xd643('0x2f')](_0x246b82[_0xd643('0x2b')],qs[_0xd643('0x30')](_0x373a5e['query'][_0xd643('0x30')]));_0x7c651b['attributes']=_0x7c651b[_0xd643('0x31')][_0xd643('0x32')]?_0x7c651b['attributes']:_0x246b82[_0xd643('0x2b')];if(_0x373a5e[_0xd643('0x2d')][_0xd643('0x3f')]){_0x7c651b[_0xd643('0x46')]=[{'all':!![]}];}_0x7c651b=_['merge']({},_0x7c651b,_0x373a5e[_0xd643('0x3d')]);return db[_0xd643('0x26')][_0xd643('0x47')](_0x7c651b)[_0xd643('0x1e')](handleEntityNotFound(_0x2bffe5,null))[_0xd643('0x1e')](respondWithResult(_0x2bffe5,null))[_0xd643('0x42')](handleError(_0x2bffe5,null));};exports[_0xd643('0x48')]=function(_0x27348e,_0xfb9a72){return db['FreshdeskField']['create'](_0x27348e['body'],{})['then'](respondWithResult(_0xfb9a72,0xc9))[_0xd643('0x42')](handleError(_0xfb9a72,null));};exports[_0xd643('0x49')]=function(_0x4631a6,_0x48b1f8){if(_0x4631a6[_0xd643('0x4a')]['id']){delete _0x4631a6['body']['id'];}return db['FreshdeskField'][_0xd643('0x47')]({'where':{'id':_0x4631a6[_0xd643('0x44')]['id']}})['then'](handleEntityNotFound(_0x48b1f8,null))['then'](saveUpdates(_0x4631a6[_0xd643('0x4a')],null))[_0xd643('0x1e')](respondWithResult(_0x48b1f8,null))[_0xd643('0x42')](handleError(_0x48b1f8,null));};exports[_0xd643('0x1f')]=function(_0x531ebe,_0x387968){return db[_0xd643('0x26')][_0xd643('0x47')]({'where':{'id':_0x531ebe[_0xd643('0x44')]['id']}})[_0xd643('0x1e')](handleEntityNotFound(_0x387968,null))[_0xd643('0x1e')](removeEntity(_0x387968,null))[_0xd643('0x42')](handleError(_0x387968,null));}; \ No newline at end of file +var _0x8a91=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x8a91,0x125));var _0x18a9=function(_0x2fde9a,_0x3a8404){_0x2fde9a=_0x2fde9a-0x0;var _0xf6dba1=_0x8a91[_0x2fde9a];return _0xf6dba1;};'use strict';var pdf=require(_0x18a9('0x0'));var emlformat=require(_0x18a9('0x1'));var rimraf=require(_0x18a9('0x2'));var zipdir=require(_0x18a9('0x3'));var jsonpatch=require(_0x18a9('0x4'));var rp=require(_0x18a9('0x5'));var moment=require(_0x18a9('0x6'));var BPromise=require(_0x18a9('0x7'));var Mustache=require(_0x18a9('0x8'));var util=require(_0x18a9('0x9'));var path=require(_0x18a9('0xa'));var sox=require(_0x18a9('0xb'));var csv=require(_0x18a9('0xc'));var ejs=require(_0x18a9('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x18a9('0xe'));var crypto=require('crypto');var jsforce=require(_0x18a9('0xf'));var deskjs=require(_0x18a9('0x10'));var toCsv=require(_0x18a9('0xc'));var querystring=require('querystring');var Papa=require(_0x18a9('0x11'));var Redis=require(_0x18a9('0x12'));var authService=require(_0x18a9('0x13'));var qs=require(_0x18a9('0x14'));var as=require(_0x18a9('0x15'));var hardwareService=require(_0x18a9('0x16'));var logger=require(_0x18a9('0x17'))(_0x18a9('0x18'));var utils=require(_0x18a9('0x19'));var config=require(_0x18a9('0x1a'));var licenseUtil=require(_0x18a9('0x1b'));var db=require(_0x18a9('0x1c'))['db'];function respondWithStatusCode(_0x2d29e4,_0x3c7fce){_0x3c7fce=_0x3c7fce||0xcc;return function(_0x2992a3){if(_0x2992a3){return _0x2d29e4['sendStatus'](_0x3c7fce);}return _0x2d29e4['status'](_0x3c7fce)['end']();};}function respondWithResult(_0x374cbe,_0xfc7083){_0xfc7083=_0xfc7083||0xc8;return function(_0x1f9281){if(_0x1f9281){return _0x374cbe[_0x18a9('0x1d')](_0xfc7083)[_0x18a9('0x1e')](_0x1f9281);}};}function respondWithFilteredResult(_0x2d0c62,_0x3c355e){return function(_0xe71734){if(_0xe71734){var _0x1ea861=_0xe71734[_0x18a9('0x1f')],_0x3cb277=_0x3c355e['offset'],_0x4cd1b2=_0x3c355e['offset']+_0x3c355e[_0x18a9('0x20')],_0x14d921;if(_0x4cd1b2>=_0x1ea861){_0x4cd1b2=_0x1ea861;_0x14d921=0xc8;}else{_0x14d921=0xce;}_0x2d0c62[_0x18a9('0x1d')](_0x14d921);return _0x2d0c62[_0x18a9('0x21')](_0x18a9('0x22'),_0x3cb277+'-'+_0x4cd1b2+'/'+_0x1ea861)['json'](_0xe71734);}return null;};}function patchUpdates(_0x2e3ce4){return function(_0x35a145){try{jsonpatch[_0x18a9('0x23')](_0x35a145,_0x2e3ce4,!![]);}catch(_0x11e8e7){return BPromise[_0x18a9('0x24')](_0x11e8e7);}return _0x35a145[_0x18a9('0x25')]();};}function saveUpdates(_0x13cd00,_0x4df8d2){return function(_0x267167){if(_0x267167){return _0x267167[_0x18a9('0x26')](_0x13cd00)[_0x18a9('0x27')](function(_0x2c9829){return _0x2c9829;});}return null;};}function removeEntity(_0xd47ea9,_0x48d98c){return function(_0x43b39b){if(_0x43b39b){return _0x43b39b[_0x18a9('0x28')]()[_0x18a9('0x27')](function(){_0xd47ea9[_0x18a9('0x1d')](0xcc)[_0x18a9('0x29')]();});}};}function handleEntityNotFound(_0x27dc8f,_0x30afe0){return function(_0xe07fd6){if(!_0xe07fd6){_0x27dc8f[_0x18a9('0x2a')](0x194);}return _0xe07fd6;};}function handleError(_0x2c8316,_0x2adaa8){_0x2adaa8=_0x2adaa8||0x1f4;return function(_0x5a6df6){logger[_0x18a9('0x2b')](_0x5a6df6[_0x18a9('0x2c')]);if(_0x5a6df6[_0x18a9('0x2d')]){delete _0x5a6df6['name'];}_0x2c8316['status'](_0x2adaa8)[_0x18a9('0x2e')](_0x5a6df6);};}exports[_0x18a9('0x2f')]=function(_0x4d49c5,_0xbf02f4){var _0x4da733={},_0x38028b={},_0xdead9e={'count':0x0,'rows':[]};var _0x428a4e=_[_0x18a9('0x30')](db[_0x18a9('0x31')][_0x18a9('0x32')],function(_0x5888a7){return{'name':_0x5888a7[_0x18a9('0x33')],'type':_0x5888a7[_0x18a9('0x34')]['key']};});_0x38028b[_0x18a9('0x35')]=_[_0x18a9('0x30')](_0x428a4e,'name');_0x38028b[_0x18a9('0x36')]=_['keys'](_0x4d49c5[_0x18a9('0x36')]);_0x38028b['filters']=_[_0x18a9('0x37')](_0x38028b['model'],_0x38028b[_0x18a9('0x36')]);_0x4da733[_0x18a9('0x38')]=_[_0x18a9('0x37')](_0x38028b['model'],qs['fields'](_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x39')]));_0x4da733[_0x18a9('0x38')]=_0x4da733[_0x18a9('0x38')][_0x18a9('0x3a')]?_0x4da733[_0x18a9('0x38')]:_0x38028b[_0x18a9('0x35')];if(!_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x3b')](_0x18a9('0x3c'))){_0x4da733[_0x18a9('0x20')]=qs['limit'](_0x4d49c5['query'][_0x18a9('0x20')]);_0x4da733[_0x18a9('0x3d')]=qs['offset'](_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x3d')]);}_0x4da733[_0x18a9('0x3e')]=qs[_0x18a9('0x3f')](_0x4d49c5['query'][_0x18a9('0x3f')]);_0x4da733['where']=qs[_0x18a9('0x40')](_[_0x18a9('0x41')](_0x4d49c5[_0x18a9('0x36')],_0x38028b[_0x18a9('0x40')]),_0x428a4e);if(_0x4d49c5['query'][_0x18a9('0x42')]){_0x4da733[_0x18a9('0x43')]=_[_0x18a9('0x44')](_0x4da733['where'],{'$or':_[_0x18a9('0x30')](_0x428a4e,function(_0x56d208){if(_0x56d208[_0x18a9('0x34')]!==_0x18a9('0x45')){var _0x1538b8={};_0x1538b8[_0x56d208[_0x18a9('0x2d')]]={'$like':'%'+_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x42')]+'%'};return _0x1538b8;}})});}_0x4da733=_[_0x18a9('0x44')]({},_0x4da733,_0x4d49c5['options']);var _0x2a04fa={'where':_0x4da733[_0x18a9('0x43')]};return db[_0x18a9('0x31')][_0x18a9('0x1f')](_0x2a04fa)['then'](function(_0x249f2d){_0xdead9e['count']=_0x249f2d;if(_0x4d49c5[_0x18a9('0x36')][_0x18a9('0x46')]){_0x4da733['include']=[{'all':!![]}];}return db[_0x18a9('0x31')][_0x18a9('0x47')](_0x4da733);})[_0x18a9('0x27')](function(_0x17884b){_0xdead9e['rows']=_0x17884b;return _0xdead9e;})[_0x18a9('0x27')](respondWithFilteredResult(_0xbf02f4,_0x4da733))[_0x18a9('0x48')](handleError(_0xbf02f4,null));};exports['show']=function(_0x46b95d,_0x28869e){var _0x2b3be2={'raw':!![],'where':{'id':_0x46b95d[_0x18a9('0x49')]['id']}},_0x3792df={};_0x3792df[_0x18a9('0x35')]=_[_0x18a9('0x4a')](db[_0x18a9('0x31')][_0x18a9('0x32')]);_0x3792df['query']=_[_0x18a9('0x4a')](_0x46b95d[_0x18a9('0x36')]);_0x3792df[_0x18a9('0x40')]=_[_0x18a9('0x37')](_0x3792df[_0x18a9('0x35')],_0x3792df[_0x18a9('0x36')]);_0x2b3be2[_0x18a9('0x38')]=_['intersection'](_0x3792df[_0x18a9('0x35')],qs[_0x18a9('0x39')](_0x46b95d['query'][_0x18a9('0x39')]));_0x2b3be2['attributes']=_0x2b3be2[_0x18a9('0x38')]['length']?_0x2b3be2['attributes']:_0x3792df[_0x18a9('0x35')];if(_0x46b95d[_0x18a9('0x36')][_0x18a9('0x46')]){_0x2b3be2['include']=[{'all':!![]}];}_0x2b3be2=_['merge']({},_0x2b3be2,_0x46b95d[_0x18a9('0x4b')]);return db[_0x18a9('0x31')][_0x18a9('0x4c')](_0x2b3be2)[_0x18a9('0x27')](handleEntityNotFound(_0x28869e,null))['then'](respondWithResult(_0x28869e,null))[_0x18a9('0x48')](handleError(_0x28869e,null));};exports[_0x18a9('0x4d')]=function(_0x30bccc,_0x4c3f38){return db[_0x18a9('0x31')]['create'](_0x30bccc['body'],{})[_0x18a9('0x27')](respondWithResult(_0x4c3f38,0xc9))[_0x18a9('0x48')](handleError(_0x4c3f38,null));};exports[_0x18a9('0x26')]=function(_0x234bcd,_0xf993ed){if(_0x234bcd[_0x18a9('0x4e')]['id']){delete _0x234bcd[_0x18a9('0x4e')]['id'];}return db[_0x18a9('0x31')][_0x18a9('0x4c')]({'where':{'id':_0x234bcd['params']['id']}})[_0x18a9('0x27')](handleEntityNotFound(_0xf993ed,null))[_0x18a9('0x27')](saveUpdates(_0x234bcd[_0x18a9('0x4e')],null))['then'](respondWithResult(_0xf993ed,null))[_0x18a9('0x48')](handleError(_0xf993ed,null));};exports[_0x18a9('0x28')]=function(_0x18a071,_0x578e8b){return db[_0x18a9('0x31')][_0x18a9('0x4c')]({'where':{'id':_0x18a071[_0x18a9('0x49')]['id']}})[_0x18a9('0x27')](handleEntityNotFound(_0x578e8b,null))['then'](removeEntity(_0x578e8b,null))['catch'](handleError(_0x578e8b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 875409e..dc66f41 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 _0x8181=['freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x8181,0xff));var _0x1818=function(_0x224eae,_0x151746){_0x224eae=_0x224eae-0x0;var _0x4b4278=_0x8181[_0x224eae];return _0x4b4278;};'use strict';var _=require(_0x1818('0x0'));var util=require(_0x1818('0x1'));var logger=require(_0x1818('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1818('0x3'));var fs=require('fs');var path=require(_0x1818('0x4'));var rimraf=require(_0x1818('0x5'));var config=require(_0x1818('0x6'));var attributes=require(_0x1818('0x7'));module['exports']=function(_0x3fa177,_0x323178){return _0x3fa177['define'](_0x1818('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x1818('0x9'),'fields':[_0x1818('0xa'),_0x1818('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a1f=['api','moment','request-promise','path','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','util','../../config/logger'];(function(_0x54b080,_0x52b431){var _0x59406d=function(_0x16e99b){while(--_0x16e99b){_0x54b080['push'](_0x54b080['shift']());}};_0x59406d(++_0x52b431);}(_0x6a1f,0x11c));var _0xf6a1=function(_0x1fe850,_0x31a1a0){_0x1fe850=_0x1fe850-0x0;var _0x244af3=_0x6a1f[_0x1fe850];return _0x244af3;};'use strict';var _=require('lodash');var util=require(_0xf6a1('0x0'));var logger=require(_0xf6a1('0x1'))(_0xf6a1('0x2'));var moment=require(_0xf6a1('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6a1('0x4'));var fs=require('fs');var path=require(_0xf6a1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6a1('0x6'));module[_0xf6a1('0x7')]=function(_0x353267,_0x4f7670){return _0x353267[_0xf6a1('0x8')](_0xf6a1('0x9'),attributes,{'tableName':_0xf6a1('0xa'),'paranoid':![],'indexes':[{'name':_0xf6a1('0xb'),'fields':['idField',_0xf6a1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index cf67d7a..bed32f0 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xfbe81b,_0x21e0b5){var _0x350fc9=function(_0x103fa7){while(--_0x103fa7){_0xfbe81b['push'](_0xfbe81b['shift']());}};_0x350fc9(++_0x21e0b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x557ba5,_0x55735b){_0x557ba5=_0x557ba5-0x0;var _0x4c7d96=_0xb10b[_0x557ba5];return _0x4c7d96;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x500c8e,_0x359cc9){_0x500c8e=_0x500c8e-0x0;var _0x516713=_0x7a54[_0x500c8e];return _0x516713;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 60df11b..db59bbf 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 _0xdf8c=['/:id','isAuthenticated','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x115cdc,_0x2533b9){var _0x43259f=function(_0x3a621b){while(--_0x3a621b){_0x115cdc['push'](_0x115cdc['shift']());}};_0x43259f(++_0x2533b9);}(_0xdf8c,0xdd));var _0xcdf8=function(_0xb6b21,_0x190507){_0xb6b21=_0xb6b21-0x0;var _0x2c9a27=_0xdf8c[_0xb6b21];return _0x2c9a27;};'use strict';var multer=require(_0xcdf8('0x0'));var util=require(_0xcdf8('0x1'));var path=require('path');var timeout=require(_0xcdf8('0x2'));var express=require(_0xcdf8('0x3'));var router=express[_0xcdf8('0x4')]();var auth=require(_0xcdf8('0x5'));var interaction=require(_0xcdf8('0x6'));var config=require(_0xcdf8('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xcdf8('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdf8('0x9')]);router['get'](_0xcdf8('0xa'),auth[_0xcdf8('0xb')](),controller['show']);router[_0xcdf8('0x8')](_0xcdf8('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xcdf8('0x8')](_0xcdf8('0xd'),auth[_0xcdf8('0xb')](),controller['getFields']);router[_0xcdf8('0xe')]('/',auth[_0xcdf8('0xb')](),controller[_0xcdf8('0xf')]);router[_0xcdf8('0xe')](_0xcdf8('0xc'),auth[_0xcdf8('0xb')](),controller[_0xcdf8('0x10')]);router['put'](_0xcdf8('0xa'),auth[_0xcdf8('0xb')](),controller[_0xcdf8('0x11')]);router[_0xcdf8('0x12')](_0xcdf8('0xa'),auth[_0xcdf8('0xb')](),controller[_0xcdf8('0x13')]);module[_0xcdf8('0x14')]=router; \ No newline at end of file +var _0x09a2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x1e8581,_0x246c10){var _0x4b0e9e=function(_0x482c15){while(--_0x482c15){_0x1e8581['push'](_0x1e8581['shift']());}};_0x4b0e9e(++_0x246c10);}(_0x09a2,0xfd));var _0x209a=function(_0x1ed807,_0x953de3){_0x1ed807=_0x1ed807-0x0;var _0x52e8fb=_0x09a2[_0x1ed807];return _0x52e8fb;};'use strict';var multer=require(_0x209a('0x0'));var util=require(_0x209a('0x1'));var path=require(_0x209a('0x2'));var timeout=require(_0x209a('0x3'));var express=require(_0x209a('0x4'));var router=express[_0x209a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x209a('0x6'));var controller=require(_0x209a('0x7'));router[_0x209a('0x8')]('/',auth[_0x209a('0x9')](),controller[_0x209a('0xa')]);router[_0x209a('0x8')]('/:id',auth[_0x209a('0x9')](),controller[_0x209a('0xb')]);router[_0x209a('0x8')](_0x209a('0xc'),auth['isAuthenticated'](),controller[_0x209a('0xd')]);router[_0x209a('0x8')](_0x209a('0xe'),auth['isAuthenticated'](),controller[_0x209a('0xf')]);router[_0x209a('0x10')]('/',auth[_0x209a('0x9')](),controller[_0x209a('0x11')]);router['post'](_0x209a('0xc'),auth[_0x209a('0x9')](),controller[_0x209a('0x12')]);router[_0x209a('0x13')](_0x209a('0x14'),auth['isAuthenticated'](),controller[_0x209a('0x15')]);router[_0x209a('0x16')](_0x209a('0x14'),auth[_0x209a('0x9')](),controller[_0x209a('0x17')]);module[_0x209a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3760565..2b4348d 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 _0x4cb7=['exports','STRING','username','sequelize'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x4cb7,0xfb));var _0x74cb=function(_0x3da77f,_0x1f4360){_0x3da77f=_0x3da77f-0x0;var _0x1813dc=_0x4cb7[_0x3da77f];return _0x1813dc;};'use strict';var Sequelize=require(_0x74cb('0x0'));module[_0x74cb('0x1')]={'name':{'type':Sequelize[_0x74cb('0x2')]},'description':{'type':Sequelize[_0x74cb('0x2')]},'username':{'type':Sequelize[_0x74cb('0x2')],'unique':_0x74cb('0x3')},'apiKey':{'type':Sequelize[_0x74cb('0x2')]},'remoteUri':{'type':Sequelize[_0x74cb('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x74cb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeebe=['username','exports','STRING'];(function(_0x7c1ad2,_0x1f1784){var _0x188eb=function(_0x1ca798){while(--_0x1ca798){_0x7c1ad2['push'](_0x7c1ad2['shift']());}};_0x188eb(++_0x1f1784);}(_0xeebe,0x1de));var _0xeeeb=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xeebe[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');module[_0xeeeb('0x0')]={'name':{'type':Sequelize[_0xeeeb('0x1')]},'description':{'type':Sequelize[_0xeeeb('0x1')]},'username':{'type':Sequelize[_0xeeeb('0x1')],'unique':_0xeeeb('0x2')},'apiKey':{'type':Sequelize[_0xeeeb('0x1')]},'remoteUri':{'type':Sequelize[_0xeeeb('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xeeeb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 923c284..8b9cb8d 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 _0xf45e=['key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','FreshsalesConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','GET','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','offset','limit','Content-Range','apply','save','update','destroy','end','stack','name','index','FreshsalesAccount','fieldName','type'];(function(_0xda5177,_0x33fd4d){var _0x5c0280=function(_0x12b081){while(--_0x12b081){_0xda5177['push'](_0xda5177['shift']());}};_0x5c0280(++_0x33fd4d);}(_0xf45e,0x115));var _0xef45=function(_0x3979d9,_0x490446){_0x3979d9=_0x3979d9-0x0;var _0x165dd1=_0xf45e[_0x3979d9];return _0x165dd1;};'use strict';var pdf=require(_0xef45('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xef45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef45('0x2'));var rp=require(_0xef45('0x3'));var moment=require(_0xef45('0x4'));var BPromise=require(_0xef45('0x5'));var Mustache=require(_0xef45('0x6'));var util=require(_0xef45('0x7'));var path=require(_0xef45('0x8'));var sox=require(_0xef45('0x9'));var csv=require(_0xef45('0xa'));var ejs=require(_0xef45('0xb'));var fs=require('fs');var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0xa'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];var integrations=require(_0xef45('0x1c'));var jayson=require(_0xef45('0x1d'));var client=jayson[_0xef45('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5215fb,_0x3a1286,_0x47fd96,_0x2ae89a){return new BPromise(function(_0xb0fc43,_0x37c207){var _0x536e46=_0x2ae89a||client;return _0x536e46['request'](_0x5215fb,_0x47fd96)[_0xef45('0x1f')](function(_0x5530e6){logger[_0xef45('0x20')](_0xef45('0x21'),_0x3a1286,_0xef45('0x22'));logger[_0xef45('0x23')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3a1286,'request\x20sent',JSON[_0xef45('0x24')](_0x5530e6));if(_0x5530e6[_0xef45('0x25')]){if(_0x5530e6[_0xef45('0x25')][_0xef45('0x26')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3a1286,_0x5530e6[_0xef45('0x25')][_0xef45('0x27')]);return _0x37c207(_0x5530e6[_0xef45('0x25')][_0xef45('0x27')]);}logger[_0xef45('0x25')](_0xef45('0x21'),_0x3a1286,_0x5530e6[_0xef45('0x25')]['message']);return _0xb0fc43(_0x5530e6[_0xef45('0x25')][_0xef45('0x27')]);}else{logger[_0xef45('0x20')](_0xef45('0x21'),_0x3a1286,_0xef45('0x22'));_0xb0fc43(_0x5530e6['result'][_0xef45('0x27')]);}})['catch'](function(_0x4aabb7){logger[_0xef45('0x25')](_0xef45('0x21'),_0x3a1286,_0x4aabb7);_0x37c207(_0x4aabb7);});});}function respondWithStatusCode(_0xbb859b,_0x7817d0){_0x7817d0=_0x7817d0||0xcc;return function(_0x839eff){if(_0x839eff){return _0xbb859b[_0xef45('0x28')](_0x7817d0);}return _0xbb859b[_0xef45('0x29')](_0x7817d0)['end']();};}function respondWithResult(_0x208b35,_0x5f0593){_0x5f0593=_0x5f0593||0xc8;return function(_0x38b470){if(_0x38b470){return _0x208b35[_0xef45('0x29')](_0x5f0593)['json'](_0x38b470);}};}function respondWithFilteredResult(_0x46e423,_0x2c356d){return function(_0x479e3c){if(_0x479e3c){var _0x1096af=_0x479e3c['count'],_0x4f8c9b=_0x2c356d[_0xef45('0x2a')],_0x550e18=_0x2c356d[_0xef45('0x2a')]+_0x2c356d[_0xef45('0x2b')],_0x5670e9;if(_0x550e18>=_0x1096af){_0x550e18=_0x1096af;_0x5670e9=0xc8;}else{_0x5670e9=0xce;}_0x46e423[_0xef45('0x29')](_0x5670e9);return _0x46e423['set'](_0xef45('0x2c'),_0x4f8c9b+'-'+_0x550e18+'/'+_0x1096af)['json'](_0x479e3c);}return null;};}function patchUpdates(_0x2525da){return function(_0x4fc137){try{jsonpatch[_0xef45('0x2d')](_0x4fc137,_0x2525da,!![]);}catch(_0x5bfd2d){return BPromise['reject'](_0x5bfd2d);}return _0x4fc137[_0xef45('0x2e')]();};}function saveUpdates(_0x3e45de,_0x390a7a){return function(_0x3ef7ba){if(_0x3ef7ba){return _0x3ef7ba[_0xef45('0x2f')](_0x3e45de)['then'](function(_0x5551ce){return _0x5551ce;});}return null;};}function removeEntity(_0x59030b,_0x164429){return function(_0x315bca){if(_0x315bca){return _0x315bca[_0xef45('0x30')]()[_0xef45('0x1f')](function(){_0x59030b[_0xef45('0x29')](0xcc)[_0xef45('0x31')]();});}};}function handleEntityNotFound(_0x1a44fb,_0x53515c){return function(_0x51db4b){if(!_0x51db4b){_0x1a44fb[_0xef45('0x28')](0x194);}return _0x51db4b;};}function handleError(_0x4d3558,_0x2aa6bb){_0x2aa6bb=_0x2aa6bb||0x1f4;return function(_0x5116b0){logger[_0xef45('0x25')](_0x5116b0[_0xef45('0x32')]);if(_0x5116b0[_0xef45('0x33')]){delete _0x5116b0[_0xef45('0x33')];}_0x4d3558[_0xef45('0x29')](_0x2aa6bb)['send'](_0x5116b0);};}exports[_0xef45('0x34')]=function(_0x331fdb,_0x9df07e){var _0x485d52={},_0x552335={},_0x787387={'count':0x0,'rows':[]};var _0x2bef2f=_['map'](db[_0xef45('0x35')]['rawAttributes'],function(_0x589c17){return{'name':_0x589c17[_0xef45('0x36')],'type':_0x589c17[_0xef45('0x37')][_0xef45('0x38')]};});_0x552335['model']=_[_0xef45('0x39')](_0x2bef2f,_0xef45('0x33'));_0x552335[_0xef45('0x3a')]=_[_0xef45('0x3b')](_0x331fdb['query']);_0x552335['filters']=_[_0xef45('0x3c')](_0x552335[_0xef45('0x3d')],_0x552335[_0xef45('0x3a')]);_0x485d52[_0xef45('0x3e')]=_[_0xef45('0x3c')](_0x552335[_0xef45('0x3d')],qs[_0xef45('0x3f')](_0x331fdb[_0xef45('0x3a')]['fields']));_0x485d52['attributes']=_0x485d52[_0xef45('0x3e')][_0xef45('0x40')]?_0x485d52[_0xef45('0x3e')]:_0x552335[_0xef45('0x3d')];if(!_0x331fdb[_0xef45('0x3a')][_0xef45('0x41')](_0xef45('0x42'))){_0x485d52[_0xef45('0x2b')]=qs[_0xef45('0x2b')](_0x331fdb[_0xef45('0x3a')][_0xef45('0x2b')]);_0x485d52[_0xef45('0x2a')]=qs[_0xef45('0x2a')](_0x331fdb[_0xef45('0x3a')][_0xef45('0x2a')]);}_0x485d52[_0xef45('0x43')]=qs['sort'](_0x331fdb[_0xef45('0x3a')][_0xef45('0x44')]);_0x485d52[_0xef45('0x45')]=qs[_0xef45('0x46')](_['pick'](_0x331fdb[_0xef45('0x3a')],_0x552335['filters']),_0x2bef2f);if(_0x331fdb[_0xef45('0x3a')]['filter']){_0x485d52[_0xef45('0x45')]=_[_0xef45('0x47')](_0x485d52[_0xef45('0x45')],{'$or':_[_0xef45('0x39')](_0x2bef2f,function(_0x4072dc){if(_0x4072dc[_0xef45('0x37')]!==_0xef45('0x48')){var _0x526a99={};_0x526a99[_0x4072dc[_0xef45('0x33')]]={'$like':'%'+_0x331fdb[_0xef45('0x3a')][_0xef45('0x49')]+'%'};return _0x526a99;}})});}_0x485d52=_[_0xef45('0x47')]({},_0x485d52,_0x331fdb[_0xef45('0x4a')]);var _0x151be9={'where':_0x485d52[_0xef45('0x45')]};return db[_0xef45('0x35')][_0xef45('0x4b')](_0x151be9)[_0xef45('0x1f')](function(_0x92ca6a){_0x787387[_0xef45('0x4b')]=_0x92ca6a;if(_0x331fdb[_0xef45('0x3a')][_0xef45('0x4c')]){_0x485d52[_0xef45('0x4d')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xef45('0x4e')](_0x485d52);})[_0xef45('0x1f')](function(_0x1189c0){_0x787387['rows']=_0x1189c0;return _0x787387;})['then'](respondWithFilteredResult(_0x9df07e,_0x485d52))['catch'](handleError(_0x9df07e,null));};exports[_0xef45('0x4f')]=function(_0x18143c,_0x12c74c){var _0x34e9d5={'raw':![],'where':{'id':_0x18143c[_0xef45('0x50')]['id']}},_0x36c3cf={};_0x36c3cf['model']=_[_0xef45('0x3b')](db[_0xef45('0x35')][_0xef45('0x51')]);_0x36c3cf['query']=_['keys'](_0x18143c[_0xef45('0x3a')]);_0x36c3cf[_0xef45('0x46')]=_['intersection'](_0x36c3cf[_0xef45('0x3d')],_0x36c3cf[_0xef45('0x3a')]);_0x34e9d5[_0xef45('0x3e')]=_[_0xef45('0x3c')](_0x36c3cf[_0xef45('0x3d')],qs[_0xef45('0x3f')](_0x18143c[_0xef45('0x3a')][_0xef45('0x3f')]));_0x34e9d5[_0xef45('0x3e')]=_0x34e9d5[_0xef45('0x3e')][_0xef45('0x40')]?_0x34e9d5[_0xef45('0x3e')]:_0x36c3cf[_0xef45('0x3d')];if(_0x18143c[_0xef45('0x3a')]['includeAll']){_0x34e9d5[_0xef45('0x4d')]=[{'all':!![]}];}_0x34e9d5=_[_0xef45('0x47')]({},_0x34e9d5,_0x18143c[_0xef45('0x4a')]);return db['FreshsalesAccount'][_0xef45('0x52')](_0x34e9d5)[_0xef45('0x1f')](handleEntityNotFound(_0x12c74c,null))[_0xef45('0x1f')](respondWithResult(_0x12c74c,null))[_0xef45('0x53')](handleError(_0x12c74c,null));};exports['create']=function(_0x14bf49,_0x1e34d8){return db[_0xef45('0x35')][_0xef45('0x54')](_0x14bf49[_0xef45('0x55')],{})[_0xef45('0x1f')](respondWithResult(_0x1e34d8,0xc9))[_0xef45('0x53')](handleError(_0x1e34d8,null));};exports[_0xef45('0x2f')]=function(_0x2622bc,_0x295fd6){if(_0x2622bc[_0xef45('0x55')]['id']){delete _0x2622bc[_0xef45('0x55')]['id'];}return db['FreshsalesAccount'][_0xef45('0x52')]({'where':{'id':_0x2622bc[_0xef45('0x50')]['id']}})[_0xef45('0x1f')](handleEntityNotFound(_0x295fd6,null))[_0xef45('0x1f')](saveUpdates(_0x2622bc[_0xef45('0x55')],null))[_0xef45('0x1f')](respondWithResult(_0x295fd6,null))['catch'](handleError(_0x295fd6,null));};exports['destroy']=function(_0x9cb7e1,_0x4a002a){return db[_0xef45('0x35')][_0xef45('0x52')]({'where':{'id':_0x9cb7e1[_0xef45('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a002a,null))[_0xef45('0x1f')](removeEntity(_0x4a002a,null))[_0xef45('0x53')](handleError(_0x4a002a,null));};exports['getConfigurations']=function(_0x2539a7,_0x5cf6c2,_0x5cd0cb){var _0x2cd705={};var _0x4f78ac={};var _0x189f22;var _0x3fbc26;return db[_0xef45('0x35')]['findOne']({'where':{'id':_0x2539a7[_0xef45('0x50')]['id']}})[_0xef45('0x1f')](handleEntityNotFound(_0x5cf6c2,null))['then'](function(_0xe92f2b){if(_0xe92f2b){_0x189f22=_0xe92f2b;_0x4f78ac[_0xef45('0x3d')]=_[_0xef45('0x3b')](db[_0xef45('0x56')][_0xef45('0x51')]);_0x4f78ac[_0xef45('0x3a')]=_[_0xef45('0x3b')](_0x2539a7[_0xef45('0x3a')]);_0x4f78ac['filters']=_[_0xef45('0x3c')](_0x4f78ac['model'],_0x4f78ac['query']);_0x2cd705[_0xef45('0x3e')]=_['intersection'](_0x4f78ac[_0xef45('0x3d')],qs[_0xef45('0x3f')](_0x2539a7['query'][_0xef45('0x3f')]));_0x2cd705[_0xef45('0x3e')]=_0x2cd705[_0xef45('0x3e')][_0xef45('0x40')]?_0x2cd705[_0xef45('0x3e')]:_0x4f78ac[_0xef45('0x3d')];_0x2cd705['order']=qs[_0xef45('0x44')](_0x2539a7[_0xef45('0x3a')][_0xef45('0x44')]);_0x2cd705[_0xef45('0x45')]=qs[_0xef45('0x46')](_['pick'](_0x2539a7[_0xef45('0x3a')],_0x4f78ac['filters']));if(_0x2539a7[_0xef45('0x3a')][_0xef45('0x49')]){_0x2cd705['where']=_[_0xef45('0x47')](_0x2cd705[_0xef45('0x45')],{'$or':_[_0xef45('0x39')](_0x2cd705['attributes'],function(_0x5f31c7){var _0x14deef={};_0x14deef[_0x5f31c7]={'$like':'%'+_0x2539a7[_0xef45('0x3a')][_0xef45('0x49')]+'%'};return _0x14deef;})});}_0x2cd705=_['merge']({},_0x2cd705,_0x2539a7[_0xef45('0x4a')]);return _0x189f22[_0xef45('0x57')](_0x2cd705);}})['then'](function(_0xb7784f){if(_0xb7784f){_0x3fbc26=_0xb7784f['length'];if(!_0x2539a7[_0xef45('0x3a')][_0xef45('0x41')](_0xef45('0x42'))){_0x2cd705[_0xef45('0x2b')]=qs[_0xef45('0x2b')](_0x2539a7[_0xef45('0x3a')][_0xef45('0x2b')]);_0x2cd705[_0xef45('0x2a')]=qs['offset'](_0x2539a7[_0xef45('0x3a')][_0xef45('0x2a')]);}return _0x189f22[_0xef45('0x57')](_0x2cd705);}})[_0xef45('0x1f')](function(_0x269728){if(_0x269728){return _0x269728?{'count':_0x3fbc26,'rows':_0x269728}:null;}})[_0xef45('0x1f')](respondWithResult(_0x5cf6c2,null))[_0xef45('0x53')](handleError(_0x5cf6c2,null));};exports[_0xef45('0x58')]=function(_0x444d39,_0x41952f,_0xbf9898){if(_0x444d39['body']['id']){delete _0x444d39[_0xef45('0x55')]['id'];}return db[_0xef45('0x35')][_0xef45('0x59')]({'where':{'id':_0x444d39[_0xef45('0x50')]['id']}})[_0xef45('0x1f')](handleEntityNotFound(_0x41952f,null))['then'](function(_0x21bf7c){if(_0x21bf7c){_0x444d39[_0xef45('0x55')]['AccountId']=_0x21bf7c['id'];_0x444d39['body'][_0xef45('0x5a')]=integrations[_0xef45('0x5b')](_0x444d39['body']['channel'],_0x444d39['body'][_0xef45('0x37')]);_0x444d39[_0xef45('0x55')]['Descriptions']=integrations['getDescriptions'](_0x444d39[_0xef45('0x55')]['channel'],_0x444d39[_0xef45('0x55')][_0xef45('0x37')]);return db[_0xef45('0x56')][_0xef45('0x54')](_0x444d39[_0xef45('0x55')],{'include':[{'model':db[_0xef45('0x5c')],'as':_0xef45('0x5a')},{'model':db['FreshsalesField'],'as':_0xef45('0x5d')}]});}return null;})[_0xef45('0x1f')](respondWithResult(_0x41952f,null))[_0xef45('0x53')](handleError(_0x41952f,null));};exports[_0xef45('0x5e')]=function(_0x3505d7,_0x3c7a0f,_0x50905b){var _0x5207a1='';var _0x18e5b9='';return db[_0xef45('0x35')][_0xef45('0x59')]({'where':{'id':_0x3505d7[_0xef45('0x50')]['id']},'attributes':['id',_0xef45('0x5f'),_0xef45('0x60'),_0xef45('0x61')]})[_0xef45('0x1f')](handleEntityNotFound(_0x3c7a0f,null))['then'](function(_0x31b0a3){if(_0x31b0a3){_0x18e5b9=_0x31b0a3[_0xef45('0x5f')];_0x5207a1=_0x31b0a3[_0xef45('0x60')];var _0x388283=_0x31b0a3[_0xef45('0x60')][_0xef45('0x62')](-0x1);if(_0x388283==='/'){_0x5207a1=_0x5207a1[_0xef45('0x63')](0x0,_0x5207a1['lastIndexOf'](_0x388283));}return rp({'method':_0xef45('0x64'),'uri':util['format'](_0xef45('0x65'),_0x5207a1,_0xef45('0x66')),'headers':{'Authorization':'Token\x20token='+_0x31b0a3[_0xef45('0x61')]},'json':!![]});}})[_0xef45('0x1f')](function(_0x1439b7){if(_0x1439b7){var _0x4d2c50=_0x1439b7[_0xef45('0x67')];var _0x5b7b0a=![];var _0x4232e4=null;for(_0x4232e4=0x0;_0x4232e4<_0x4d2c50[_0xef45('0x40')];_0x4232e4++){if(_0x4d2c50[_0x4232e4][_0xef45('0x68')]===_0x18e5b9){_0x5b7b0a=!![];}}if(_0x5b7b0a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xef45('0x69')});}}})['then'](respondWithResult(_0x3c7a0f,null))[_0xef45('0x53')](function(_0x32034a){var _0xcdcc33=_0x3505d7['query'][_0xef45('0x6a')]?0x1f4:_0x32034a[_0xef45('0x6b')]||0x1f4;logger[_0xef45('0x25')](_0xef45('0x6c'),_0xef45('0x5e'),_0xcdcc33,JSON['stringify'](_0x32034a));delete _0x32034a[_0xef45('0x33')];if(_0xcdcc33===0x191){_0xcdcc33=0x190;}_0x3c7a0f[_0xef45('0x29')](_0xcdcc33)[_0xef45('0x6d')](_0x3505d7[_0xef45('0x3a')][_0xef45('0x6a')]?{'message':_0xef45('0x6e'),'statusCode':_0x32034a[_0xef45('0x6b')]}:_0x32034a);});}; \ No newline at end of file +var _0x9bde=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','set','apply','update','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','destroy','getConfigurations','FreshsalesConfiguration','order','findOne','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test'];(function(_0x67d2b,_0xc3be07){var _0x23e7c1=function(_0x290c5e){while(--_0x290c5e){_0x67d2b['push'](_0x67d2b['shift']());}};_0x23e7c1(++_0xc3be07);}(_0x9bde,0xe1));var _0xe9bd=function(_0x31cc9c,_0x5effee){_0x31cc9c=_0x31cc9c-0x0;var _0x2f8c76=_0x9bde[_0x31cc9c];return _0x2f8c76;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var licenseUtil=require(_0xe9bd('0x18'));var db=require(_0xe9bd('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe9bd('0x1a'));var client=jayson['client'][_0xe9bd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x429e88,_0x3435b4,_0x51109f,_0x47ba5e){return new BPromise(function(_0x46a95e,_0x248818){var _0x3a9e5f=_0x47ba5e||client;return _0x3a9e5f[_0xe9bd('0x1c')](_0x429e88,_0x51109f)[_0xe9bd('0x1d')](function(_0x389e7b){logger[_0xe9bd('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x3435b4,_0xe9bd('0x1f'));logger[_0xe9bd('0x20')](_0xe9bd('0x21'),_0x3435b4,'request\x20sent',JSON[_0xe9bd('0x22')](_0x389e7b));if(_0x389e7b[_0xe9bd('0x23')]){if(_0x389e7b[_0xe9bd('0x23')][_0xe9bd('0x24')]===0x1f4){logger['error'](_0xe9bd('0x25'),_0x3435b4,_0x389e7b['error'][_0xe9bd('0x26')]);return _0x248818(_0x389e7b['error'][_0xe9bd('0x26')]);}logger[_0xe9bd('0x23')](_0xe9bd('0x25'),_0x3435b4,_0x389e7b[_0xe9bd('0x23')][_0xe9bd('0x26')]);return _0x46a95e(_0x389e7b[_0xe9bd('0x23')][_0xe9bd('0x26')]);}else{logger['info'](_0xe9bd('0x25'),_0x3435b4,_0xe9bd('0x1f'));_0x46a95e(_0x389e7b['result'][_0xe9bd('0x26')]);}})['catch'](function(_0x238ab1){logger[_0xe9bd('0x23')](_0xe9bd('0x25'),_0x3435b4,_0x238ab1);_0x248818(_0x238ab1);});});}function respondWithStatusCode(_0xf02209,_0x5bc4bf){_0x5bc4bf=_0x5bc4bf||0xcc;return function(_0x24cf25){if(_0x24cf25){return _0xf02209[_0xe9bd('0x27')](_0x5bc4bf);}return _0xf02209[_0xe9bd('0x28')](_0x5bc4bf)[_0xe9bd('0x29')]();};}function respondWithResult(_0x2641be,_0xb52d45){_0xb52d45=_0xb52d45||0xc8;return function(_0x399f3c){if(_0x399f3c){return _0x2641be[_0xe9bd('0x28')](_0xb52d45)[_0xe9bd('0x2a')](_0x399f3c);}};}function respondWithFilteredResult(_0x5987af,_0x3c211a){return function(_0x38fdfa){if(_0x38fdfa){var _0x5ba1d6=_0x38fdfa[_0xe9bd('0x2b')],_0x3b13b7=_0x3c211a[_0xe9bd('0x2c')],_0xc25248=_0x3c211a[_0xe9bd('0x2c')]+_0x3c211a['limit'],_0x119672;if(_0xc25248>=_0x5ba1d6){_0xc25248=_0x5ba1d6;_0x119672=0xc8;}else{_0x119672=0xce;}_0x5987af['status'](_0x119672);return _0x5987af[_0xe9bd('0x2d')]('Content-Range',_0x3b13b7+'-'+_0xc25248+'/'+_0x5ba1d6)[_0xe9bd('0x2a')](_0x38fdfa);}return null;};}function patchUpdates(_0x1f2c0e){return function(_0x27f80c){try{jsonpatch[_0xe9bd('0x2e')](_0x27f80c,_0x1f2c0e,!![]);}catch(_0x4057df){return BPromise['reject'](_0x4057df);}return _0x27f80c['save']();};}function saveUpdates(_0x7f2c5,_0x3b6682){return function(_0x3f96a0){if(_0x3f96a0){return _0x3f96a0[_0xe9bd('0x2f')](_0x7f2c5)[_0xe9bd('0x1d')](function(_0x1f0f9e){return _0x1f0f9e;});}return null;};}function removeEntity(_0x3c31ee,_0x66213a){return function(_0x45703e){if(_0x45703e){return _0x45703e['destroy']()[_0xe9bd('0x1d')](function(){_0x3c31ee[_0xe9bd('0x28')](0xcc)[_0xe9bd('0x29')]();});}};}function handleEntityNotFound(_0x5117bc,_0x524e08){return function(_0x25eeab){if(!_0x25eeab){_0x5117bc[_0xe9bd('0x27')](0x194);}return _0x25eeab;};}function handleError(_0x601649,_0x3ed60a){_0x3ed60a=_0x3ed60a||0x1f4;return function(_0x1dda43){logger[_0xe9bd('0x23')](_0x1dda43[_0xe9bd('0x30')]);if(_0x1dda43[_0xe9bd('0x31')]){delete _0x1dda43[_0xe9bd('0x31')];}_0x601649[_0xe9bd('0x28')](_0x3ed60a)[_0xe9bd('0x32')](_0x1dda43);};}exports[_0xe9bd('0x33')]=function(_0x2ad46e,_0x199477){var _0xc50476={},_0x8ff624={},_0x264ba0={'count':0x0,'rows':[]};var _0x147da5=_['map'](db[_0xe9bd('0x34')][_0xe9bd('0x35')],function(_0x56b4a5){return{'name':_0x56b4a5[_0xe9bd('0x36')],'type':_0x56b4a5[_0xe9bd('0x37')]['key']};});_0x8ff624['model']=_[_0xe9bd('0x38')](_0x147da5,_0xe9bd('0x31'));_0x8ff624['query']=_[_0xe9bd('0x39')](_0x2ad46e[_0xe9bd('0x3a')]);_0x8ff624[_0xe9bd('0x3b')]=_['intersection'](_0x8ff624[_0xe9bd('0x3c')],_0x8ff624['query']);_0xc50476[_0xe9bd('0x3d')]=_[_0xe9bd('0x3e')](_0x8ff624[_0xe9bd('0x3c')],qs[_0xe9bd('0x3f')](_0x2ad46e['query'][_0xe9bd('0x3f')]));_0xc50476[_0xe9bd('0x3d')]=_0xc50476[_0xe9bd('0x3d')][_0xe9bd('0x40')]?_0xc50476[_0xe9bd('0x3d')]:_0x8ff624[_0xe9bd('0x3c')];if(!_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x41')](_0xe9bd('0x42'))){_0xc50476[_0xe9bd('0x43')]=qs['limit'](_0x2ad46e['query'][_0xe9bd('0x43')]);_0xc50476['offset']=qs[_0xe9bd('0x2c')](_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x2c')]);}_0xc50476['order']=qs[_0xe9bd('0x44')](_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x44')]);_0xc50476['where']=qs[_0xe9bd('0x3b')](_[_0xe9bd('0x45')](_0x2ad46e[_0xe9bd('0x3a')],_0x8ff624[_0xe9bd('0x3b')]),_0x147da5);if(_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x46')]){_0xc50476[_0xe9bd('0x47')]=_[_0xe9bd('0x48')](_0xc50476[_0xe9bd('0x47')],{'$or':_[_0xe9bd('0x38')](_0x147da5,function(_0x3817ab){if(_0x3817ab[_0xe9bd('0x37')]!==_0xe9bd('0x49')){var _0x2a9e09={};_0x2a9e09[_0x3817ab[_0xe9bd('0x31')]]={'$like':'%'+_0x2ad46e['query']['filter']+'%'};return _0x2a9e09;}})});}_0xc50476=_[_0xe9bd('0x48')]({},_0xc50476,_0x2ad46e[_0xe9bd('0x4a')]);var _0x1fe93a={'where':_0xc50476['where']};return db['FreshsalesAccount'][_0xe9bd('0x2b')](_0x1fe93a)[_0xe9bd('0x1d')](function(_0x165942){_0x264ba0[_0xe9bd('0x2b')]=_0x165942;if(_0x2ad46e[_0xe9bd('0x3a')][_0xe9bd('0x4b')]){_0xc50476[_0xe9bd('0x4c')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xe9bd('0x4d')](_0xc50476);})['then'](function(_0x36726e){_0x264ba0[_0xe9bd('0x4e')]=_0x36726e;return _0x264ba0;})[_0xe9bd('0x1d')](respondWithFilteredResult(_0x199477,_0xc50476))[_0xe9bd('0x4f')](handleError(_0x199477,null));};exports[_0xe9bd('0x50')]=function(_0x4b7b67,_0x3317d6){var _0x3e5d44={'raw':![],'where':{'id':_0x4b7b67['params']['id']}},_0xe14fa4={};_0xe14fa4[_0xe9bd('0x3c')]=_[_0xe9bd('0x39')](db[_0xe9bd('0x34')]['rawAttributes']);_0xe14fa4[_0xe9bd('0x3a')]=_[_0xe9bd('0x39')](_0x4b7b67[_0xe9bd('0x3a')]);_0xe14fa4[_0xe9bd('0x3b')]=_[_0xe9bd('0x3e')](_0xe14fa4['model'],_0xe14fa4[_0xe9bd('0x3a')]);_0x3e5d44['attributes']=_[_0xe9bd('0x3e')](_0xe14fa4[_0xe9bd('0x3c')],qs[_0xe9bd('0x3f')](_0x4b7b67[_0xe9bd('0x3a')][_0xe9bd('0x3f')]));_0x3e5d44['attributes']=_0x3e5d44[_0xe9bd('0x3d')]['length']?_0x3e5d44[_0xe9bd('0x3d')]:_0xe14fa4[_0xe9bd('0x3c')];if(_0x4b7b67['query']['includeAll']){_0x3e5d44[_0xe9bd('0x4c')]=[{'all':!![]}];}_0x3e5d44=_['merge']({},_0x3e5d44,_0x4b7b67[_0xe9bd('0x4a')]);return db['FreshsalesAccount'][_0xe9bd('0x51')](_0x3e5d44)[_0xe9bd('0x1d')](handleEntityNotFound(_0x3317d6,null))['then'](respondWithResult(_0x3317d6,null))[_0xe9bd('0x4f')](handleError(_0x3317d6,null));};exports['create']=function(_0x3aeda2,_0x2d9a94){return db[_0xe9bd('0x34')]['create'](_0x3aeda2[_0xe9bd('0x52')],{})[_0xe9bd('0x1d')](respondWithResult(_0x2d9a94,0xc9))[_0xe9bd('0x4f')](handleError(_0x2d9a94,null));};exports[_0xe9bd('0x2f')]=function(_0x56b777,_0x56362e){if(_0x56b777[_0xe9bd('0x52')]['id']){delete _0x56b777['body']['id'];}return db[_0xe9bd('0x34')][_0xe9bd('0x51')]({'where':{'id':_0x56b777[_0xe9bd('0x53')]['id']}})[_0xe9bd('0x1d')](handleEntityNotFound(_0x56362e,null))[_0xe9bd('0x1d')](saveUpdates(_0x56b777[_0xe9bd('0x52')],null))[_0xe9bd('0x1d')](respondWithResult(_0x56362e,null))[_0xe9bd('0x4f')](handleError(_0x56362e,null));};exports[_0xe9bd('0x54')]=function(_0x3be526,_0x1fd5bf){return db[_0xe9bd('0x34')]['find']({'where':{'id':_0x3be526['params']['id']}})['then'](handleEntityNotFound(_0x1fd5bf,null))[_0xe9bd('0x1d')](removeEntity(_0x1fd5bf,null))['catch'](handleError(_0x1fd5bf,null));};exports[_0xe9bd('0x55')]=function(_0xdd1301,_0x90db01,_0x6232e5){var _0x1c9328={};var _0xaf6ffd={};var _0x3bb2ba;var _0x46797c;return db[_0xe9bd('0x34')]['findOne']({'where':{'id':_0xdd1301[_0xe9bd('0x53')]['id']}})[_0xe9bd('0x1d')](handleEntityNotFound(_0x90db01,null))[_0xe9bd('0x1d')](function(_0x3f848d){if(_0x3f848d){_0x3bb2ba=_0x3f848d;_0xaf6ffd['model']=_[_0xe9bd('0x39')](db[_0xe9bd('0x56')][_0xe9bd('0x35')]);_0xaf6ffd['query']=_[_0xe9bd('0x39')](_0xdd1301[_0xe9bd('0x3a')]);_0xaf6ffd[_0xe9bd('0x3b')]=_[_0xe9bd('0x3e')](_0xaf6ffd['model'],_0xaf6ffd['query']);_0x1c9328[_0xe9bd('0x3d')]=_[_0xe9bd('0x3e')](_0xaf6ffd[_0xe9bd('0x3c')],qs[_0xe9bd('0x3f')](_0xdd1301['query']['fields']));_0x1c9328[_0xe9bd('0x3d')]=_0x1c9328[_0xe9bd('0x3d')][_0xe9bd('0x40')]?_0x1c9328[_0xe9bd('0x3d')]:_0xaf6ffd[_0xe9bd('0x3c')];_0x1c9328[_0xe9bd('0x57')]=qs['sort'](_0xdd1301[_0xe9bd('0x3a')]['sort']);_0x1c9328[_0xe9bd('0x47')]=qs[_0xe9bd('0x3b')](_[_0xe9bd('0x45')](_0xdd1301[_0xe9bd('0x3a')],_0xaf6ffd['filters']));if(_0xdd1301[_0xe9bd('0x3a')][_0xe9bd('0x46')]){_0x1c9328[_0xe9bd('0x47')]=_['merge'](_0x1c9328[_0xe9bd('0x47')],{'$or':_[_0xe9bd('0x38')](_0x1c9328[_0xe9bd('0x3d')],function(_0x3e3e05){var _0x43dabe={};_0x43dabe[_0x3e3e05]={'$like':'%'+_0xdd1301[_0xe9bd('0x3a')][_0xe9bd('0x46')]+'%'};return _0x43dabe;})});}_0x1c9328=_[_0xe9bd('0x48')]({},_0x1c9328,_0xdd1301[_0xe9bd('0x4a')]);return _0x3bb2ba[_0xe9bd('0x55')](_0x1c9328);}})[_0xe9bd('0x1d')](function(_0x37d07a){if(_0x37d07a){_0x46797c=_0x37d07a['length'];if(!_0xdd1301[_0xe9bd('0x3a')][_0xe9bd('0x41')]('nolimit')){_0x1c9328[_0xe9bd('0x43')]=qs[_0xe9bd('0x43')](_0xdd1301['query']['limit']);_0x1c9328[_0xe9bd('0x2c')]=qs[_0xe9bd('0x2c')](_0xdd1301['query']['offset']);}return _0x3bb2ba['getConfigurations'](_0x1c9328);}})[_0xe9bd('0x1d')](function(_0x55cb4b){if(_0x55cb4b){return _0x55cb4b?{'count':_0x46797c,'rows':_0x55cb4b}:null;}})['then'](respondWithResult(_0x90db01,null))['catch'](handleError(_0x90db01,null));};exports['addConfiguration']=function(_0x1fc88d,_0x46da33,_0x2ed5f2){if(_0x1fc88d['body']['id']){delete _0x1fc88d[_0xe9bd('0x52')]['id'];}return db[_0xe9bd('0x34')][_0xe9bd('0x58')]({'where':{'id':_0x1fc88d[_0xe9bd('0x53')]['id']}})['then'](handleEntityNotFound(_0x46da33,null))[_0xe9bd('0x1d')](function(_0x10ef2b){if(_0x10ef2b){_0x1fc88d[_0xe9bd('0x52')]['AccountId']=_0x10ef2b['id'];_0x1fc88d['body'][_0xe9bd('0x59')]=integrations[_0xe9bd('0x5a')](_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x5b')],_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x37')]);_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x5c')]=integrations['getDescriptions'](_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x5b')],_0x1fc88d[_0xe9bd('0x52')][_0xe9bd('0x37')]);return db[_0xe9bd('0x56')]['create'](_0x1fc88d[_0xe9bd('0x52')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0xe9bd('0x5d')],'as':_0xe9bd('0x5c')}]});}return null;})['then'](respondWithResult(_0x46da33,null))[_0xe9bd('0x4f')](handleError(_0x46da33,null));};exports[_0xe9bd('0x5e')]=function(_0x1c6644,_0x292faf,_0x582cf3){var _0x3c1ab9='';var _0x41fb41='';return db['FreshsalesAccount'][_0xe9bd('0x58')]({'where':{'id':_0x1c6644[_0xe9bd('0x53')]['id']},'attributes':['id',_0xe9bd('0x5f'),_0xe9bd('0x60'),_0xe9bd('0x61')]})[_0xe9bd('0x1d')](handleEntityNotFound(_0x292faf,null))[_0xe9bd('0x1d')](function(_0x5e127b){if(_0x5e127b){_0x41fb41=_0x5e127b[_0xe9bd('0x5f')];_0x3c1ab9=_0x5e127b[_0xe9bd('0x60')];var _0x178574=_0x5e127b[_0xe9bd('0x60')][_0xe9bd('0x62')](-0x1);if(_0x178574==='/'){_0x3c1ab9=_0x3c1ab9[_0xe9bd('0x63')](0x0,_0x3c1ab9[_0xe9bd('0x64')](_0x178574));}return rp({'method':_0xe9bd('0x65'),'uri':util[_0xe9bd('0x66')]('%s%s',_0x3c1ab9,_0xe9bd('0x67')),'headers':{'Authorization':_0xe9bd('0x68')+_0x5e127b[_0xe9bd('0x61')]},'json':!![]});}})[_0xe9bd('0x1d')](function(_0x383e0c){if(_0x383e0c){var _0x7354df=_0x383e0c[_0xe9bd('0x69')];var _0x4b9c08=![];var _0x18519d=null;for(_0x18519d=0x0;_0x18519d<_0x7354df[_0xe9bd('0x40')];_0x18519d++){if(_0x7354df[_0x18519d]['email']===_0x41fb41){_0x4b9c08=!![];}}if(_0x4b9c08){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe9bd('0x6a')});}}})[_0xe9bd('0x1d')](respondWithResult(_0x292faf,null))[_0xe9bd('0x4f')](function(_0x2083c4){var _0x242110=_0x1c6644[_0xe9bd('0x3a')][_0xe9bd('0x6b')]?0x1f4:_0x2083c4['statusCode']||0x1f4;logger['error'](_0xe9bd('0x6c'),_0xe9bd('0x5e'),_0x242110,JSON[_0xe9bd('0x22')](_0x2083c4));delete _0x2083c4[_0xe9bd('0x31')];if(_0x242110===0x191){_0x242110=0x190;}_0x292faf[_0xe9bd('0x28')](_0x242110)[_0xe9bd('0x32')](_0x1c6644[_0xe9bd('0x3a')]['test']?{'message':_0xe9bd('0x6d'),'statusCode':_0x2083c4[_0xe9bd('0x6e')]}:_0x2083c4);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index bd58976..b8bf003 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger'];(function(_0x198a8e,_0x2f1270){var _0x2399e0=function(_0x256144){while(--_0x256144){_0x198a8e['push'](_0x198a8e['shift']());}};_0x2399e0(++_0x2f1270);}(_0xb10b,0x12a));var _0xbb10=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0xb10b[_0x29bfbe];return _0x230663;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));var integrations=require(_0xbb10('0x9'));module['exports']=function(_0x328583,_0x3cdd53){return _0x328583['define'](_0xbb10('0xa'),attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7764=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5b567e,_0x146470){var _0x4ba29f=function(_0x503f66){while(--_0x503f66){_0x5b567e['push'](_0x5b567e['shift']());}};_0x4ba29f(++_0x146470);}(_0x7764,0x120));var _0x4776=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x7764[_0xb7b878];return _0x3c84b9;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var logger=require(_0x4776('0x2'))(_0x4776('0x3'));var moment=require(_0x4776('0x4'));var BPromise=require(_0x4776('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4776('0x6'));var rimraf=require('rimraf');var config=require(_0x4776('0x7'));var attributes=require(_0x4776('0x8'));var integrations=require(_0x4776('0x9'));module[_0x4776('0xa')]=function(_0x1a1413,_0x3e2d79){return _0x1a1413['define'](_0x4776('0xb'),attributes,{'tableName':_0x4776('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 8e5bef6..d6c9508 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 _0xd5a2=['error','code','message','catch','FreshsalesAccount','findAll','options','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x13629f,_0x2fe7d0){_0x13629f=_0x13629f-0x0;var _0x78ec3c=_0xd5a2[_0x13629f];return _0x78ec3c;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var moment=require(_0x2d5a('0x1'));var BPromise=require(_0x2d5a('0x2'));var rs=require(_0x2d5a('0x3'));var fs=require('fs');var Redis=require(_0x2d5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d5a('0x5'));var logger=require(_0x2d5a('0x6'))(_0x2d5a('0x7'));var config=require(_0x2d5a('0x8'));var jayson=require(_0x2d5a('0x9'));var client=jayson[_0x2d5a('0xa')][_0x2d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae103,_0x1cdfc4,_0x7eb4c3){return new BPromise(function(_0x79898c,_0x4d5c52){return client['request'](_0x1ae103,_0x7eb4c3)[_0x2d5a('0xc')](function(_0x562b6a){logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,'request\x20sent');logger[_0x2d5a('0xf')](_0x2d5a('0x10'),_0x1cdfc4,_0x2d5a('0x11'),JSON[_0x2d5a('0x12')](_0x562b6a));if(_0x562b6a[_0x2d5a('0x13')]){if(_0x562b6a['error'][_0x2d5a('0x14')]===0x1f4){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x4d5c52(_0x562b6a['error'][_0x2d5a('0x15')]);}logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x79898c(_0x562b6a[_0x2d5a('0x13')][_0x2d5a('0x15')]);}else{logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,_0x2d5a('0x11'));_0x79898c(_0x562b6a['result'][_0x2d5a('0x15')]);}})[_0x2d5a('0x16')](function(_0x38de62){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x38de62);_0x4d5c52(_0x38de62);});});}exports['GetFreshsalesAccount']=function(_0x454c53){var _0x50f723=this;return new Promise(function(_0x34ae77,_0x29692e){return db[_0x2d5a('0x17')][_0x2d5a('0x18')]({'raw':_0x454c53['options']?_0x454c53['options']['raw']===undefined?!![]:![]:!![],'where':_0x454c53['options']?_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1a')]||null:null,'attributes':_0x454c53['options']?_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1b')]||null:null,'limit':_0x454c53[_0x2d5a('0x19')]?_0x454c53[_0x2d5a('0x19')]['limit']||null:null,'include':_0x454c53[_0x2d5a('0x19')]?_0x454c53['options'][_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1c')],function(_0x5f1c75){return{'model':db[_0x5f1c75['model']],'as':_0x5f1c75['as'],'attributes':_0x5f1c75['attributes'],'include':_0x5f1c75[_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x5f1c75[_0x2d5a('0x1c')],function(_0x304b9a){return{'model':db[_0x304b9a[_0x2d5a('0x1e')]],'as':_0x304b9a['as'],'attributes':_0x304b9a[_0x2d5a('0x1b')],'include':_0x304b9a['include']?_[_0x2d5a('0x1d')](_0x304b9a[_0x2d5a('0x1c')],function(_0x24f733){return{'model':db[_0x24f733[_0x2d5a('0x1e')]],'as':_0x24f733['as'],'attributes':_0x24f733[_0x2d5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d5a('0xc')](function(_0x4fb606){logger['info'](_0x2d5a('0x1f'),_0x454c53);logger[_0x2d5a('0xf')]('GetFreshsalesAccount',_0x454c53,JSON[_0x2d5a('0x12')](_0x4fb606));_0x34ae77(_0x4fb606);})[_0x2d5a('0x16')](function(_0x199686){logger[_0x2d5a('0x13')](_0x2d5a('0x1f'),_0x199686[_0x2d5a('0x15')],_0x454c53);_0x29692e(_0x50f723[_0x2d5a('0x13')](0x1f4,_0x199686[_0x2d5a('0x15')]));});});};exports[_0x2d5a('0x20')]=function(_0x3e8fda){var _0xf62d6e=this;return new Promise(function(_0x3a55ff,_0x598b61){return db[_0x2d5a('0x17')][_0x2d5a('0x21')]({'raw':_0x3e8fda['options']?_0x3e8fda[_0x2d5a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3e8fda['options']?_0x3e8fda['options']['where']||null:null,'attributes':_0x3e8fda[_0x2d5a('0x19')]?_0x3e8fda['options'][_0x2d5a('0x1b')]||null:null,'include':_0x3e8fda[_0x2d5a('0x19')]?_0x3e8fda['options'][_0x2d5a('0x1c')]?_['map'](_0x3e8fda[_0x2d5a('0x19')][_0x2d5a('0x1c')],function(_0x69f4f){return{'model':db[_0x69f4f['model']],'as':_0x69f4f['as'],'attributes':_0x69f4f[_0x2d5a('0x1b')],'include':_0x69f4f[_0x2d5a('0x1c')]?_['map'](_0x69f4f[_0x2d5a('0x1c')],function(_0x4f0792){return{'model':db[_0x4f0792[_0x2d5a('0x1e')]],'as':_0x4f0792['as'],'attributes':_0x4f0792[_0x2d5a('0x1b')],'include':_0x4f0792[_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x4f0792[_0x2d5a('0x1c')],function(_0x3e166f){return{'model':db[_0x3e166f[_0x2d5a('0x1e')]],'as':_0x3e166f['as'],'attributes':_0x3e166f[_0x2d5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d5a('0xc')](function(_0x31955b){logger[_0x2d5a('0xd')]('ShowFreshsalesAccount',_0x3e8fda);logger[_0x2d5a('0xf')]('ShowFreshsalesAccount',_0x3e8fda,JSON['stringify'](_0x31955b));_0x3a55ff(_0x31955b);})[_0x2d5a('0x16')](function(_0x33c16e){logger[_0x2d5a('0x13')](_0x2d5a('0x20'),_0x33c16e[_0x2d5a('0x15')],_0x3e8fda);_0x598b61(_0xf62d6e[_0x2d5a('0x13')](0x1f4,_0x33c16e['message']));});});}; \ No newline at end of file +var _0x1893=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowFreshsalesAccount','find','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x45bf96,_0x56010f){var _0x1f86f4=function(_0x2f87c4){while(--_0x2f87c4){_0x45bf96['push'](_0x45bf96['shift']());}};_0x1f86f4(++_0x56010f);}(_0x1893,0xa2));var _0x3189=function(_0x3882e4,_0x2cd2cd){_0x3882e4=_0x3882e4-0x0;var _0x359fea=_0x1893[_0x3882e4];return _0x359fea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});}exports[_0x3189('0x15')]=function(_0xf8aed7){var _0x22c7ba=this;return new Promise(function(_0x9905c4,_0x4c4d9b){return db[_0x3189('0x16')][_0x3189('0x17')]({'raw':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1b')]||null:null,'limit':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')]['limit']||null:null,'include':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0xf8aed7[_0x3189('0x18')][_0x3189('0x1c')],function(_0x1cbe33){return{'model':db[_0x1cbe33[_0x3189('0x1e')]],'as':_0x1cbe33['as'],'attributes':_0x1cbe33['attributes'],'include':_0x1cbe33['include']?_[_0x3189('0x1d')](_0x1cbe33[_0x3189('0x1c')],function(_0x1dc1c8){return{'model':db[_0x1dc1c8[_0x3189('0x1e')]],'as':_0x1dc1c8['as'],'attributes':_0x1dc1c8[_0x3189('0x1b')],'include':_0x1dc1c8[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x1dc1c8[_0x3189('0x1c')],function(_0x17b540){return{'model':db[_0x17b540[_0x3189('0x1e')]],'as':_0x17b540['as'],'attributes':_0x17b540['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5aa34a){logger[_0x3189('0x14')](_0x3189('0x15'),_0xf8aed7);logger[_0x3189('0xe')](_0x3189('0x15'),_0xf8aed7,JSON[_0x3189('0x10')](_0x5aa34a));_0x9905c4(_0x5aa34a);})[_0x3189('0x1f')](function(_0x4d453a){logger[_0x3189('0x11')](_0x3189('0x15'),_0x4d453a['message'],_0xf8aed7);_0x4c4d9b(_0x22c7ba[_0x3189('0x11')](0x1f4,_0x4d453a[_0x3189('0x13')]));});});};exports[_0x3189('0x20')]=function(_0x5c7a36){var _0x168dc2=this;return new Promise(function(_0x32bba1,_0x23798e){return db['FreshsalesAccount'][_0x3189('0x21')]({'raw':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options']['attributes']||null:null,'include':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x5c7a36[_0x3189('0x18')][_0x3189('0x1c')],function(_0x231d72){return{'model':db[_0x231d72[_0x3189('0x1e')]],'as':_0x231d72['as'],'attributes':_0x231d72[_0x3189('0x1b')],'include':_0x231d72[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x231d72['include'],function(_0x453e4b){return{'model':db[_0x453e4b[_0x3189('0x1e')]],'as':_0x453e4b['as'],'attributes':_0x453e4b[_0x3189('0x1b')],'include':_0x453e4b[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x453e4b[_0x3189('0x1c')],function(_0xd1ee0){return{'model':db[_0xd1ee0['model']],'as':_0xd1ee0['as'],'attributes':_0xd1ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3189('0x22')](function(_0x580064){logger[_0x3189('0x14')](_0x3189('0x20'),_0x5c7a36);logger['debug'](_0x3189('0x20'),_0x5c7a36,JSON[_0x3189('0x10')](_0x580064));_0x32bba1(_0x580064);})[_0x3189('0x1f')](function(_0x254135){logger['error'](_0x3189('0x20'),_0x254135['message'],_0x5c7a36);_0x23798e(_0x168dc2['error'](0x1f4,_0x254135[_0x3189('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5d1338e..86d05fc 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 _0x525d=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post'];(function(_0xf3187c,_0x2a34ff){var _0x595314=function(_0x3fc1cc){while(--_0x3fc1cc){_0xf3187c['push'](_0xf3187c['shift']());}};_0x595314(++_0x2a34ff);}(_0x525d,0x159));var _0xd525=function(_0x3246cd,_0x586736){_0x3246cd=_0x3246cd-0x0;var _0x569ed2=_0x525d[_0x3246cd];return _0x569ed2;};'use strict';var multer=require(_0xd525('0x0'));var util=require(_0xd525('0x1'));var path=require(_0xd525('0x2'));var timeout=require(_0xd525('0x3'));var express=require(_0xd525('0x4'));var router=express[_0xd525('0x5')]();var auth=require(_0xd525('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd525('0x7'));var controller=require(_0xd525('0x8'));router[_0xd525('0x9')]('/',auth[_0xd525('0xa')](),controller[_0xd525('0xb')]);router[_0xd525('0x9')]('/:id',auth[_0xd525('0xa')](),controller[_0xd525('0xc')]);router[_0xd525('0x9')](_0xd525('0xd'),auth['isAuthenticated'](),controller[_0xd525('0xe')]);router['get'](_0xd525('0xf'),auth[_0xd525('0xa')](),controller[_0xd525('0x10')]);router[_0xd525('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd525('0x11')]);router[_0xd525('0x12')]('/',auth[_0xd525('0xa')](),controller[_0xd525('0x13')]);router[_0xd525('0x14')](_0xd525('0x15'),auth['isAuthenticated'](),controller[_0xd525('0x16')]);router[_0xd525('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xd525('0x18')]);module[_0xd525('0x19')]=router; \ No newline at end of file +var _0x3940=['update','delete','multer','util','path','express','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x4bf2eb,_0x1a03d){var _0x3b11bd=function(_0x5de53f){while(--_0x5de53f){_0x4bf2eb['push'](_0x4bf2eb['shift']());}};_0x3b11bd(++_0x1a03d);}(_0x3940,0x1bc));var _0x0394=function(_0x2d5ddf,_0x5313db){_0x2d5ddf=_0x2d5ddf-0x0;var _0x5f9c70=_0x3940[_0x2d5ddf];return _0x5f9c70;};'use strict';var multer=require(_0x0394('0x0'));var util=require(_0x0394('0x1'));var path=require(_0x0394('0x2'));var timeout=require('connect-timeout');var express=require(_0x0394('0x3'));var router=express[_0x0394('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0394('0x5'));var config=require('../../config/environment');var controller=require(_0x0394('0x6'));router[_0x0394('0x7')]('/',auth[_0x0394('0x8')](),controller['index']);router[_0x0394('0x7')](_0x0394('0x9'),auth[_0x0394('0x8')](),controller[_0x0394('0xa')]);router[_0x0394('0x7')](_0x0394('0xb'),auth[_0x0394('0x8')](),controller[_0x0394('0xc')]);router[_0x0394('0x7')](_0x0394('0xd'),auth[_0x0394('0x8')](),controller[_0x0394('0xe')]);router[_0x0394('0x7')]('/:id/fields',auth[_0x0394('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0394('0x9'),auth[_0x0394('0x8')](),controller[_0x0394('0xf')]);router[_0x0394('0x10')](_0x0394('0x9'),auth[_0x0394('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index e6c24a1..1a1a128 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 _0x5373=['sequelize','exports','STRING'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x5373,0x174));var _0x3537=function(_0x35dbc7,_0x57c508){_0x35dbc7=_0x35dbc7-0x0;var _0x39cdba=_0x5373[_0x35dbc7];return _0x39cdba;};'use strict';var Sequelize=require(_0x3537('0x0'));module[_0x3537('0x1')]={'name':{'type':Sequelize[_0x3537('0x2')]},'description':{'type':Sequelize[_0x3537('0x2')]}}; \ No newline at end of file +var _0xa23f=['exports','STRING','sequelize'];(function(_0xf683b7,_0x11cebf){var _0x286d96=function(_0x44972e){while(--_0x44972e){_0xf683b7['push'](_0xf683b7['shift']());}};_0x286d96(++_0x11cebf);}(_0xa23f,0x92));var _0xfa23=function(_0x3e2bc4,_0xfbef5e){_0x3e2bc4=_0x3e2bc4-0x0;var _0x15f557=_0xa23f[_0x3e2bc4];return _0x15f557;};'use strict';var Sequelize=require(_0xfa23('0x0'));module[_0xfa23('0x1')]={'name':{'type':Sequelize[_0xfa23('0x2')]},'description':{'type':Sequelize[_0xfa23('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 4de8024..a8d9252 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 _0x7217=['then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','includeAll','include','show','keys','length','find','catch','create','body','params','getSubjects','nolimit','findOne','getDescriptions','getFields','FreshsalesField','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x532cd0,_0x1170f3){var _0x4535bb=function(_0x46750d){while(--_0x46750d){_0x532cd0['push'](_0x532cd0['shift']());}};_0x4535bb(++_0x1170f3);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7721('0x1c')][_0x7721('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x57ff6d,_0x109900,_0x30da54,_0x3f01c5){return new BPromise(function(_0x2e9752,_0x5069da){var _0x3cbce8=_0x3f01c5||client;return _0x3cbce8[_0x7721('0x1e')](_0x57ff6d,_0x30da54)['then'](function(_0x4e199a){logger['info'](_0x7721('0x1f'),_0x109900,_0x7721('0x20'));logger[_0x7721('0x21')](_0x7721('0x22'),_0x109900,'request\x20sent',JSON[_0x7721('0x23')](_0x4e199a));if(_0x4e199a['error']){if(_0x4e199a[_0x7721('0x24')]['code']===0x1f4){logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);return _0x5069da(_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);}logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);return _0x2e9752(_0x4e199a['error'][_0x7721('0x25')]);}else{logger[_0x7721('0x26')](_0x7721('0x1f'),_0x109900,_0x7721('0x20'));_0x2e9752(_0x4e199a['result'][_0x7721('0x25')]);}})['catch'](function(_0xb9e9dd){logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0xb9e9dd);_0x5069da(_0xb9e9dd);});});}function respondWithStatusCode(_0x1caad8,_0x121cc4){_0x121cc4=_0x121cc4||0xcc;return function(_0x395b15){if(_0x395b15){return _0x1caad8[_0x7721('0x27')](_0x121cc4);}return _0x1caad8['status'](_0x121cc4)[_0x7721('0x28')]();};}function respondWithResult(_0x1abedb,_0x125564){_0x125564=_0x125564||0xc8;return function(_0x1f67c7){if(_0x1f67c7){return _0x1abedb[_0x7721('0x29')](_0x125564)[_0x7721('0x2a')](_0x1f67c7);}};}function respondWithFilteredResult(_0x424e05,_0xf753f1){return function(_0x40f367){if(_0x40f367){var _0x52316e=_0x40f367[_0x7721('0x2b')],_0x258ddf=_0xf753f1[_0x7721('0x2c')],_0x5b0551=_0xf753f1[_0x7721('0x2c')]+_0xf753f1[_0x7721('0x2d')],_0x499b87;if(_0x5b0551>=_0x52316e){_0x5b0551=_0x52316e;_0x499b87=0xc8;}else{_0x499b87=0xce;}_0x424e05[_0x7721('0x29')](_0x499b87);return _0x424e05[_0x7721('0x2e')](_0x7721('0x2f'),_0x258ddf+'-'+_0x5b0551+'/'+_0x52316e)[_0x7721('0x2a')](_0x40f367);}return null;};}function patchUpdates(_0x5c54f0){return function(_0x471651){try{jsonpatch[_0x7721('0x30')](_0x471651,_0x5c54f0,!![]);}catch(_0x497f9f){return BPromise['reject'](_0x497f9f);}return _0x471651[_0x7721('0x31')]();};}function saveUpdates(_0x220bbf,_0x48f329){return function(_0x46f772){if(_0x46f772){return _0x46f772[_0x7721('0x32')](_0x220bbf)[_0x7721('0x33')](function(_0x58d54b){return _0x58d54b;});}return null;};}function removeEntity(_0x3d9a32,_0x1ff31b){return function(_0x1492d4){if(_0x1492d4){return _0x1492d4[_0x7721('0x34')]()[_0x7721('0x33')](function(){_0x3d9a32['status'](0xcc)[_0x7721('0x28')]();});}};}function handleEntityNotFound(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(!_0x5c5b33){_0x3e4e56[_0x7721('0x27')](0x194);}return _0x5c5b33;};}function handleError(_0x213a2e,_0x498654){_0x498654=_0x498654||0x1f4;return function(_0x217592){logger['error'](_0x217592[_0x7721('0x35')]);if(_0x217592[_0x7721('0x36')]){delete _0x217592[_0x7721('0x36')];}_0x213a2e[_0x7721('0x29')](_0x498654)[_0x7721('0x37')](_0x217592);};}exports[_0x7721('0x38')]=function(_0x2f1fe0,_0x15545a){var _0x25bdd9={},_0x3a2eb7={},_0x385454={'count':0x0,'rows':[]};var _0x5c806d=_[_0x7721('0x39')](db['FreshsalesConfiguration'][_0x7721('0x3a')],function(_0x35614c){return{'name':_0x35614c[_0x7721('0x3b')],'type':_0x35614c[_0x7721('0x3c')][_0x7721('0x3d')]};});_0x3a2eb7[_0x7721('0x3e')]=_['map'](_0x5c806d,'name');_0x3a2eb7['query']=_['keys'](_0x2f1fe0[_0x7721('0x3f')]);_0x3a2eb7[_0x7721('0x40')]=_[_0x7721('0x41')](_0x3a2eb7[_0x7721('0x3e')],_0x3a2eb7['query']);_0x25bdd9[_0x7721('0x42')]=_['intersection'](_0x3a2eb7[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x2f1fe0['query'][_0x7721('0x43')]));_0x25bdd9[_0x7721('0x42')]=_0x25bdd9['attributes']['length']?_0x25bdd9[_0x7721('0x42')]:_0x3a2eb7[_0x7721('0x3e')];if(!_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x44')]('nolimit')){_0x25bdd9[_0x7721('0x2d')]=qs[_0x7721('0x2d')](_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x2d')]);_0x25bdd9[_0x7721('0x2c')]=qs['offset'](_0x2f1fe0[_0x7721('0x3f')]['offset']);}_0x25bdd9[_0x7721('0x45')]=qs['sort'](_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x46')]);_0x25bdd9[_0x7721('0x47')]=qs['filters'](_[_0x7721('0x48')](_0x2f1fe0[_0x7721('0x3f')],_0x3a2eb7[_0x7721('0x40')]),_0x5c806d);if(_0x2f1fe0['query'][_0x7721('0x49')]){_0x25bdd9[_0x7721('0x47')]=_[_0x7721('0x4a')](_0x25bdd9[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x5c806d,function(_0x57d09b){if(_0x57d09b[_0x7721('0x3c')]!=='VIRTUAL'){var _0x479698={};_0x479698[_0x57d09b[_0x7721('0x36')]]={'$like':'%'+_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x479698;}})});}_0x25bdd9=_[_0x7721('0x4a')]({},_0x25bdd9,_0x2f1fe0[_0x7721('0x4b')]);var _0x15181b={'where':_0x25bdd9[_0x7721('0x47')]};return db[_0x7721('0x4c')][_0x7721('0x2b')](_0x15181b)[_0x7721('0x33')](function(_0x5460cd){_0x385454['count']=_0x5460cd;if(_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x4d')]){_0x25bdd9[_0x7721('0x4e')]=[{'all':!![]}];}return db[_0x7721('0x4c')]['findAll'](_0x25bdd9);})[_0x7721('0x33')](function(_0x2d5a88){_0x385454['rows']=_0x2d5a88;return _0x385454;})[_0x7721('0x33')](respondWithFilteredResult(_0x15545a,_0x25bdd9))['catch'](handleError(_0x15545a,null));};exports[_0x7721('0x4f')]=function(_0x5c6922,_0x334f23){var _0x196be4={'raw':![],'where':{'id':_0x5c6922['params']['id']}},_0xf17c40={};_0xf17c40[_0x7721('0x3e')]=_[_0x7721('0x50')](db['FreshsalesConfiguration'][_0x7721('0x3a')]);_0xf17c40[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x5c6922['query']);_0xf17c40[_0x7721('0x40')]=_['intersection'](_0xf17c40[_0x7721('0x3e')],_0xf17c40[_0x7721('0x3f')]);_0x196be4[_0x7721('0x42')]=_[_0x7721('0x41')](_0xf17c40[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x5c6922[_0x7721('0x3f')][_0x7721('0x43')]));_0x196be4[_0x7721('0x42')]=_0x196be4[_0x7721('0x42')][_0x7721('0x51')]?_0x196be4[_0x7721('0x42')]:_0xf17c40[_0x7721('0x3e')];if(_0x5c6922[_0x7721('0x3f')][_0x7721('0x4d')]){_0x196be4['include']=[{'all':!![]}];}_0x196be4=_[_0x7721('0x4a')]({},_0x196be4,_0x5c6922[_0x7721('0x4b')]);return db[_0x7721('0x4c')][_0x7721('0x52')](_0x196be4)[_0x7721('0x33')](handleEntityNotFound(_0x334f23,null))[_0x7721('0x33')](respondWithResult(_0x334f23,null))[_0x7721('0x53')](handleError(_0x334f23,null));};exports['create']=function(_0x234bee,_0x17036e){return db[_0x7721('0x4c')][_0x7721('0x54')](_0x234bee[_0x7721('0x55')],{})[_0x7721('0x33')](respondWithResult(_0x17036e,0xc9))[_0x7721('0x53')](handleError(_0x17036e,null));};exports[_0x7721('0x32')]=function(_0x11b300,_0x3b968d){if(_0x11b300[_0x7721('0x55')]['id']){delete _0x11b300['body']['id'];}return db[_0x7721('0x4c')][_0x7721('0x52')]({'where':{'id':_0x11b300[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x3b968d,null))[_0x7721('0x33')](saveUpdates(_0x11b300[_0x7721('0x55')],null))[_0x7721('0x33')](respondWithResult(_0x3b968d,null))[_0x7721('0x53')](handleError(_0x3b968d,null));};exports[_0x7721('0x34')]=function(_0x287452,_0x39962f){return db[_0x7721('0x4c')][_0x7721('0x52')]({'where':{'id':_0x287452[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x39962f,null))['then'](removeEntity(_0x39962f,null))['catch'](handleError(_0x39962f,null));};exports['getSubjects']=function(_0x885a3a,_0x4f2fe6,_0x4a46db){var _0x57348c={};var _0x5d7036={};var _0x47925a;var _0x219181;return db[_0x7721('0x4c')]['findOne']({'where':{'id':_0x885a3a[_0x7721('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f2fe6,null))['then'](function(_0x484b8e){if(_0x484b8e){_0x47925a=_0x484b8e;_0x5d7036[_0x7721('0x3e')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x5d7036[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x885a3a[_0x7721('0x3f')]);_0x5d7036['filters']=_[_0x7721('0x41')](_0x5d7036[_0x7721('0x3e')],_0x5d7036[_0x7721('0x3f')]);_0x57348c[_0x7721('0x42')]=_[_0x7721('0x41')](_0x5d7036[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x885a3a[_0x7721('0x3f')][_0x7721('0x43')]));_0x57348c[_0x7721('0x42')]=_0x57348c[_0x7721('0x42')][_0x7721('0x51')]?_0x57348c[_0x7721('0x42')]:_0x5d7036[_0x7721('0x3e')];_0x57348c[_0x7721('0x45')]=qs['sort'](_0x885a3a[_0x7721('0x3f')][_0x7721('0x46')]);_0x57348c[_0x7721('0x47')]=qs[_0x7721('0x40')](_['pick'](_0x885a3a[_0x7721('0x3f')],_0x5d7036[_0x7721('0x40')]));if(_0x885a3a['query'][_0x7721('0x49')]){_0x57348c['where']=_[_0x7721('0x4a')](_0x57348c[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x57348c[_0x7721('0x42')],function(_0x3d2b7d){var _0x158aae={};_0x158aae[_0x3d2b7d]={'$like':'%'+_0x885a3a[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x158aae;})});}_0x57348c=_[_0x7721('0x4a')]({},_0x57348c,_0x885a3a['options']);return _0x47925a[_0x7721('0x57')](_0x57348c);}})[_0x7721('0x33')](function(_0x112033){if(_0x112033){_0x219181=_0x112033[_0x7721('0x51')];if(!_0x885a3a[_0x7721('0x3f')][_0x7721('0x44')](_0x7721('0x58'))){_0x57348c['limit']=qs[_0x7721('0x2d')](_0x885a3a[_0x7721('0x3f')]['limit']);_0x57348c[_0x7721('0x2c')]=qs['offset'](_0x885a3a[_0x7721('0x3f')][_0x7721('0x2c')]);}return _0x47925a[_0x7721('0x57')](_0x57348c);}})[_0x7721('0x33')](function(_0x1e2436){if(_0x1e2436){return _0x1e2436?{'count':_0x219181,'rows':_0x1e2436}:null;}})[_0x7721('0x33')](respondWithResult(_0x4f2fe6,null))[_0x7721('0x53')](handleError(_0x4f2fe6,null));};exports['getDescriptions']=function(_0xbcedbd,_0x1d252a,_0x280b1d){var _0x5f08cc={};var _0x5cef5a={};var _0x515fb9;var _0x5d3561;return db['FreshsalesConfiguration'][_0x7721('0x59')]({'where':{'id':_0xbcedbd[_0x7721('0x56')]['id']}})['then'](handleEntityNotFound(_0x1d252a,null))[_0x7721('0x33')](function(_0x42f6e9){if(_0x42f6e9){_0x515fb9=_0x42f6e9;_0x5cef5a[_0x7721('0x3e')]=_[_0x7721('0x50')](db['FreshsalesField'][_0x7721('0x3a')]);_0x5cef5a[_0x7721('0x3f')]=_[_0x7721('0x50')](_0xbcedbd[_0x7721('0x3f')]);_0x5cef5a[_0x7721('0x40')]=_['intersection'](_0x5cef5a[_0x7721('0x3e')],_0x5cef5a[_0x7721('0x3f')]);_0x5f08cc[_0x7721('0x42')]=_['intersection'](_0x5cef5a['model'],qs[_0x7721('0x43')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x43')]));_0x5f08cc[_0x7721('0x42')]=_0x5f08cc[_0x7721('0x42')]['length']?_0x5f08cc['attributes']:_0x5cef5a[_0x7721('0x3e')];_0x5f08cc[_0x7721('0x45')]=qs[_0x7721('0x46')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x46')]);_0x5f08cc[_0x7721('0x47')]=qs[_0x7721('0x40')](_['pick'](_0xbcedbd[_0x7721('0x3f')],_0x5cef5a[_0x7721('0x40')]));if(_0xbcedbd[_0x7721('0x3f')]['filter']){_0x5f08cc[_0x7721('0x47')]=_[_0x7721('0x4a')](_0x5f08cc[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x5f08cc['attributes'],function(_0x4d4d6a){var _0x37f8f8={};_0x37f8f8[_0x4d4d6a]={'$like':'%'+_0xbcedbd[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x37f8f8;})});}_0x5f08cc=_[_0x7721('0x4a')]({},_0x5f08cc,_0xbcedbd[_0x7721('0x4b')]);return _0x515fb9[_0x7721('0x5a')](_0x5f08cc);}})['then'](function(_0x3855d5){if(_0x3855d5){_0x5d3561=_0x3855d5[_0x7721('0x51')];if(!_0xbcedbd[_0x7721('0x3f')]['hasOwnProperty'](_0x7721('0x58'))){_0x5f08cc[_0x7721('0x2d')]=qs[_0x7721('0x2d')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x2d')]);_0x5f08cc['offset']=qs[_0x7721('0x2c')](_0xbcedbd['query'][_0x7721('0x2c')]);}return _0x515fb9[_0x7721('0x5a')](_0x5f08cc);}})[_0x7721('0x33')](function(_0x7f0598){if(_0x7f0598){return _0x7f0598?{'count':_0x5d3561,'rows':_0x7f0598}:null;}})[_0x7721('0x33')](respondWithResult(_0x1d252a,null))[_0x7721('0x53')](handleError(_0x1d252a,null));};exports[_0x7721('0x5b')]=function(_0x123049,_0x2ec5f8,_0x3b78f5){var _0x2c74d8={};var _0x55d209={};var _0x19fad6;var _0x19f451;return db[_0x7721('0x4c')]['findOne']({'where':{'id':_0x123049[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x2ec5f8,null))[_0x7721('0x33')](function(_0xc9761e){if(_0xc9761e){_0x19fad6=_0xc9761e;_0x55d209[_0x7721('0x3e')]=_['keys'](db[_0x7721('0x5c')][_0x7721('0x3a')]);_0x55d209[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x123049[_0x7721('0x3f')]);_0x55d209[_0x7721('0x40')]=_['intersection'](_0x55d209[_0x7721('0x3e')],_0x55d209[_0x7721('0x3f')]);_0x2c74d8['attributes']=_[_0x7721('0x41')](_0x55d209['model'],qs[_0x7721('0x43')](_0x123049[_0x7721('0x3f')]['fields']));_0x2c74d8[_0x7721('0x42')]=_0x2c74d8['attributes']['length']?_0x2c74d8['attributes']:_0x55d209[_0x7721('0x3e')];_0x2c74d8[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x123049['query']['sort']);_0x2c74d8['where']=qs[_0x7721('0x40')](_[_0x7721('0x48')](_0x123049[_0x7721('0x3f')],_0x55d209[_0x7721('0x40')]));if(_0x123049[_0x7721('0x3f')][_0x7721('0x49')]){_0x2c74d8['where']=_[_0x7721('0x4a')](_0x2c74d8[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x2c74d8[_0x7721('0x42')],function(_0x977255){var _0x1a0232={};_0x1a0232[_0x977255]={'$like':'%'+_0x123049[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x1a0232;})});}_0x2c74d8=_[_0x7721('0x4a')]({},_0x2c74d8,_0x123049[_0x7721('0x4b')]);return _0x19fad6[_0x7721('0x5b')](_0x2c74d8);}})[_0x7721('0x33')](function(_0x58429d){if(_0x58429d){_0x19f451=_0x58429d['length'];if(!_0x123049[_0x7721('0x3f')][_0x7721('0x44')]('nolimit')){_0x2c74d8[_0x7721('0x2d')]=qs['limit'](_0x123049['query'][_0x7721('0x2d')]);_0x2c74d8['offset']=qs['offset'](_0x123049[_0x7721('0x3f')][_0x7721('0x2c')]);}return _0x19fad6[_0x7721('0x5b')](_0x2c74d8);}})[_0x7721('0x33')](function(_0x6b611){if(_0x6b611){return _0x6b611?{'count':_0x19f451,'rows':_0x6b611}:null;}})['then'](respondWithResult(_0x2ec5f8,null))[_0x7721('0x53')](handleError(_0x2ec5f8,null));}; \ No newline at end of file +var _0x53ec=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','type','VIRTUAL','filter','FreshsalesConfiguration','count','includeAll','include','rows','catch','show','length','options','find','create','body','params','getSubjects','FreshsalesField','merge','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map'];(function(_0x4617bc,_0x5d5300){var _0x1c3ea5=function(_0x54ca55){while(--_0x54ca55){_0x4617bc['push'](_0x4617bc['shift']());}};_0x1c3ea5(++_0x5d5300);}(_0x53ec,0x192));var _0xc53e=function(_0x510912,_0x91f943){_0x510912=_0x510912-0x0;var _0x23f357=_0x53ec[_0x510912];return _0x23f357;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74c9,_0x1c06cd,_0x19a772,_0x7cd798){return new BPromise(function(_0x3d2e17,_0x358ef3){var _0x382e87=_0x7cd798||client;return _0x382e87[_0xc53e('0x19')](_0x4e74c9,_0x19a772)[_0xc53e('0x1a')](function(_0x455e4d){logger[_0xc53e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x1c06cd,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x455e4d));if(_0x455e4d[_0xc53e('0x20')]){if(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger[_0xc53e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0x455e4d['error'][_0xc53e('0x22')]);return _0x358ef3(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x3d2e17(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x1b')](_0xc53e('0x23'),_0x1c06cd,_0xc53e('0x1c'));_0x3d2e17(_0x455e4d[_0xc53e('0x24')]['message']);}})['catch'](function(_0x531ede){logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x531ede);_0x358ef3(_0x531ede);});});}function respondWithStatusCode(_0x7591c1,_0x4015c8){_0x4015c8=_0x4015c8||0xcc;return function(_0x180811){if(_0x180811){return _0x7591c1['sendStatus'](_0x4015c8);}return _0x7591c1['status'](_0x4015c8)[_0xc53e('0x25')]();};}function respondWithResult(_0x496167,_0x1ae55e){_0x1ae55e=_0x1ae55e||0xc8;return function(_0x3a5ce8){if(_0x3a5ce8){return _0x496167[_0xc53e('0x26')](_0x1ae55e)[_0xc53e('0x27')](_0x3a5ce8);}};}function respondWithFilteredResult(_0x63c5dc,_0x4df8cf){return function(_0x398e7a){if(_0x398e7a){var _0x4b9f6a=_0x398e7a['count'],_0x4d9a68=_0x4df8cf[_0xc53e('0x28')],_0x5c65d3=_0x4df8cf['offset']+_0x4df8cf[_0xc53e('0x29')],_0x3c5056;if(_0x5c65d3>=_0x4b9f6a){_0x5c65d3=_0x4b9f6a;_0x3c5056=0xc8;}else{_0x3c5056=0xce;}_0x63c5dc['status'](_0x3c5056);return _0x63c5dc['set'](_0xc53e('0x2a'),_0x4d9a68+'-'+_0x5c65d3+'/'+_0x4b9f6a)[_0xc53e('0x27')](_0x398e7a);}return null;};}function patchUpdates(_0x42dec1){return function(_0x2fa20b){try{jsonpatch[_0xc53e('0x2b')](_0x2fa20b,_0x42dec1,!![]);}catch(_0xf97d78){return BPromise[_0xc53e('0x2c')](_0xf97d78);}return _0x2fa20b[_0xc53e('0x2d')]();};}function saveUpdates(_0x4ace0b,_0x437893){return function(_0x311835){if(_0x311835){return _0x311835[_0xc53e('0x2e')](_0x4ace0b)['then'](function(_0x4057f9){return _0x4057f9;});}return null;};}function removeEntity(_0x495756,_0x4572e){return function(_0x2467f4){if(_0x2467f4){return _0x2467f4['destroy']()['then'](function(){_0x495756[_0xc53e('0x26')](0xcc)[_0xc53e('0x25')]();});}};}function handleEntityNotFound(_0x3f4547,_0x30d037){return function(_0x1b95c2){if(!_0x1b95c2){_0x3f4547[_0xc53e('0x2f')](0x194);}return _0x1b95c2;};}function handleError(_0x40a8db,_0x168d25){_0x168d25=_0x168d25||0x1f4;return function(_0x4ffddc){logger[_0xc53e('0x20')](_0x4ffddc[_0xc53e('0x30')]);if(_0x4ffddc[_0xc53e('0x31')]){delete _0x4ffddc[_0xc53e('0x31')];}_0x40a8db[_0xc53e('0x26')](_0x168d25)[_0xc53e('0x32')](_0x4ffddc);};}exports[_0xc53e('0x33')]=function(_0x16942c,_0x215abe){var _0x595efb={},_0x3e395c={},_0x48d7d0={'count':0x0,'rows':[]};var _0x1059f3=_[_0xc53e('0x34')](db['FreshsalesConfiguration'][_0xc53e('0x35')],function(_0x154f8b){return{'name':_0x154f8b[_0xc53e('0x36')],'type':_0x154f8b['type'][_0xc53e('0x37')]};});_0x3e395c[_0xc53e('0x38')]=_[_0xc53e('0x34')](_0x1059f3,_0xc53e('0x31'));_0x3e395c[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x16942c[_0xc53e('0x39')]);_0x3e395c['filters']=_[_0xc53e('0x3b')](_0x3e395c[_0xc53e('0x38')],_0x3e395c[_0xc53e('0x39')]);_0x595efb['attributes']=_[_0xc53e('0x3b')](_0x3e395c['model'],qs[_0xc53e('0x3c')](_0x16942c[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x595efb[_0xc53e('0x3d')]=_0x595efb[_0xc53e('0x3d')]['length']?_0x595efb[_0xc53e('0x3d')]:_0x3e395c[_0xc53e('0x38')];if(!_0x16942c['query']['hasOwnProperty']('nolimit')){_0x595efb['limit']=qs[_0xc53e('0x29')](_0x16942c[_0xc53e('0x39')]['limit']);_0x595efb[_0xc53e('0x28')]=qs['offset'](_0x16942c['query']['offset']);}_0x595efb[_0xc53e('0x3e')]=qs['sort'](_0x16942c['query'][_0xc53e('0x3f')]);_0x595efb['where']=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x16942c['query'],_0x3e395c[_0xc53e('0x40')]),_0x1059f3);if(_0x16942c[_0xc53e('0x39')]['filter']){_0x595efb[_0xc53e('0x42')]=_['merge'](_0x595efb['where'],{'$or':_['map'](_0x1059f3,function(_0x4efee5){if(_0x4efee5[_0xc53e('0x43')]!==_0xc53e('0x44')){var _0x3b2834={};_0x3b2834[_0x4efee5['name']]={'$like':'%'+_0x16942c[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x3b2834;}})});}_0x595efb=_['merge']({},_0x595efb,_0x16942c['options']);var _0x3ea11a={'where':_0x595efb[_0xc53e('0x42')]};return db[_0xc53e('0x46')]['count'](_0x3ea11a)[_0xc53e('0x1a')](function(_0x1fb82c){_0x48d7d0[_0xc53e('0x47')]=_0x1fb82c;if(_0x16942c[_0xc53e('0x39')][_0xc53e('0x48')]){_0x595efb[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x46')]['findAll'](_0x595efb);})[_0xc53e('0x1a')](function(_0x39c467){_0x48d7d0[_0xc53e('0x4a')]=_0x39c467;return _0x48d7d0;})['then'](respondWithFilteredResult(_0x215abe,_0x595efb))[_0xc53e('0x4b')](handleError(_0x215abe,null));};exports[_0xc53e('0x4c')]=function(_0x4458c8,_0x15e744){var _0xa7d256={'raw':![],'where':{'id':_0x4458c8['params']['id']}},_0x17cea5={};_0x17cea5[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db[_0xc53e('0x46')]['rawAttributes']);_0x17cea5[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4458c8[_0xc53e('0x39')]);_0x17cea5[_0xc53e('0x40')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],_0x17cea5[_0xc53e('0x39')]);_0xa7d256[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],qs['fields'](_0x4458c8[_0xc53e('0x39')][_0xc53e('0x3c')]));_0xa7d256[_0xc53e('0x3d')]=_0xa7d256[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0xa7d256['attributes']:_0x17cea5['model'];if(_0x4458c8[_0xc53e('0x39')]['includeAll']){_0xa7d256[_0xc53e('0x49')]=[{'all':!![]}];}_0xa7d256=_['merge']({},_0xa7d256,_0x4458c8[_0xc53e('0x4e')]);return db[_0xc53e('0x46')][_0xc53e('0x4f')](_0xa7d256)['then'](handleEntityNotFound(_0x15e744,null))[_0xc53e('0x1a')](respondWithResult(_0x15e744,null))[_0xc53e('0x4b')](handleError(_0x15e744,null));};exports[_0xc53e('0x50')]=function(_0x4843ce,_0x2f7df2){return db['FreshsalesConfiguration'][_0xc53e('0x50')](_0x4843ce[_0xc53e('0x51')],{})['then'](respondWithResult(_0x2f7df2,0xc9))[_0xc53e('0x4b')](handleError(_0x2f7df2,null));};exports[_0xc53e('0x2e')]=function(_0x5bba72,_0x44f7cc){if(_0x5bba72[_0xc53e('0x51')]['id']){delete _0x5bba72[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x46')][_0xc53e('0x4f')]({'where':{'id':_0x5bba72[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x44f7cc,null))[_0xc53e('0x1a')](saveUpdates(_0x5bba72[_0xc53e('0x51')],null))[_0xc53e('0x1a')](respondWithResult(_0x44f7cc,null))[_0xc53e('0x4b')](handleError(_0x44f7cc,null));};exports['destroy']=function(_0x8364f6,_0x4a2543){return db[_0xc53e('0x46')]['find']({'where':{'id':_0x8364f6[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x4a2543,null))['then'](removeEntity(_0x4a2543,null))[_0xc53e('0x4b')](handleError(_0x4a2543,null));};exports[_0xc53e('0x53')]=function(_0x9c0112,_0x432a91,_0x53083b){var _0x41c46c={};var _0x335427={};var _0x4ae0d4;var _0x5ea1da;return db[_0xc53e('0x46')]['findOne']({'where':{'id':_0x9c0112['params']['id']}})['then'](handleEntityNotFound(_0x432a91,null))[_0xc53e('0x1a')](function(_0x5f5dad){if(_0x5f5dad){_0x4ae0d4=_0x5f5dad;_0x335427[_0xc53e('0x38')]=_['keys'](db[_0xc53e('0x54')][_0xc53e('0x35')]);_0x335427[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x9c0112[_0xc53e('0x39')]);_0x335427['filters']=_['intersection'](_0x335427[_0xc53e('0x38')],_0x335427[_0xc53e('0x39')]);_0x41c46c[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x335427[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x41c46c[_0xc53e('0x3d')]=_0x41c46c[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x41c46c[_0xc53e('0x3d')]:_0x335427[_0xc53e('0x38')];_0x41c46c['order']=qs[_0xc53e('0x3f')](_0x9c0112['query'][_0xc53e('0x3f')]);_0x41c46c[_0xc53e('0x42')]=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x9c0112[_0xc53e('0x39')],_0x335427[_0xc53e('0x40')]));if(_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]){_0x41c46c['where']=_['merge'](_0x41c46c['where'],{'$or':_[_0xc53e('0x34')](_0x41c46c[_0xc53e('0x3d')],function(_0x37ac78){var _0x25e4b6={};_0x25e4b6[_0x37ac78]={'$like':'%'+_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x25e4b6;})});}_0x41c46c=_[_0xc53e('0x55')]({},_0x41c46c,_0x9c0112['options']);return _0x4ae0d4['getSubjects'](_0x41c46c);}})['then'](function(_0x40c8ba){if(_0x40c8ba){_0x5ea1da=_0x40c8ba[_0xc53e('0x4d')];if(!_0x9c0112['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x41c46c[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x29')]);_0x41c46c['offset']=qs['offset'](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0x4ae0d4[_0xc53e('0x53')](_0x41c46c);}})[_0xc53e('0x1a')](function(_0x29ee08){if(_0x29ee08){return _0x29ee08?{'count':_0x5ea1da,'rows':_0x29ee08}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x432a91,null))['catch'](handleError(_0x432a91,null));};exports[_0xc53e('0x58')]=function(_0x15f6cb,_0x1c15a3,_0x3f3dc2){var _0x4d2609={};var _0xdd851e={};var _0xef9095;var _0x26e3ba;return db[_0xc53e('0x46')][_0xc53e('0x59')]({'where':{'id':_0x15f6cb[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c15a3,null))[_0xc53e('0x1a')](function(_0x134018){if(_0x134018){_0xef9095=_0x134018;_0xdd851e[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db['FreshsalesField']['rawAttributes']);_0xdd851e[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x15f6cb[_0xc53e('0x39')]);_0xdd851e[_0xc53e('0x40')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],_0xdd851e['query']);_0x4d2609[_0xc53e('0x3d')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],qs['fields'](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x4d2609['attributes']=_0x4d2609[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x4d2609['attributes']:_0xdd851e['model'];_0x4d2609[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x15f6cb['query']['sort']);_0x4d2609[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x15f6cb['query'],_0xdd851e[_0xc53e('0x40')]));if(_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x45')]){_0x4d2609[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x4d2609[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x4d2609[_0xc53e('0x3d')],function(_0x258be8){var _0x2cd553={};_0x2cd553[_0x258be8]={'$like':'%'+_0x15f6cb['query'][_0xc53e('0x45')]+'%'};return _0x2cd553;})});}_0x4d2609=_['merge']({},_0x4d2609,_0x15f6cb[_0xc53e('0x4e')]);return _0xef9095[_0xc53e('0x58')](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x2c027c){if(_0x2c027c){_0x26e3ba=_0x2c027c[_0xc53e('0x4d')];if(!_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x4d2609[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x15f6cb['query'][_0xc53e('0x29')]);_0x4d2609['offset']=qs[_0xc53e('0x28')](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0xef9095['getDescriptions'](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x340db2){if(_0x340db2){return _0x340db2?{'count':_0x26e3ba,'rows':_0x340db2}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x1c15a3,null))[_0xc53e('0x4b')](handleError(_0x1c15a3,null));};exports[_0xc53e('0x5a')]=function(_0x508671,_0x2601ba,_0x48e337){var _0x56c66f={};var _0x42b53b={};var _0xe1a82c;var _0x25469e;return db['FreshsalesConfiguration'][_0xc53e('0x59')]({'where':{'id':_0x508671[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2601ba,null))[_0xc53e('0x1a')](function(_0x4699b7){if(_0x4699b7){_0xe1a82c=_0x4699b7;_0x42b53b['model']=_['keys'](db[_0xc53e('0x54')]['rawAttributes']);_0x42b53b[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x508671[_0xc53e('0x39')]);_0x42b53b['filters']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],_0x42b53b[_0xc53e('0x39')]);_0x56c66f['attributes']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x56c66f['attributes']=_0x56c66f[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x56c66f[_0xc53e('0x3d')]:_0x42b53b[_0xc53e('0x38')];_0x56c66f[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3f')]);_0x56c66f[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x508671[_0xc53e('0x39')],_0x42b53b[_0xc53e('0x40')]));if(_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]){_0x56c66f[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x56c66f[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x56c66f['attributes'],function(_0x3a54ef){var _0x190509={};_0x190509[_0x3a54ef]={'$like':'%'+_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x190509;})});}_0x56c66f=_['merge']({},_0x56c66f,_0x508671[_0xc53e('0x4e')]);return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x92c9bc){if(_0x92c9bc){_0x25469e=_0x92c9bc['length'];if(!_0x508671[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x56c66f[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x508671[_0xc53e('0x39')][_0xc53e('0x29')]);_0x56c66f['offset']=qs[_0xc53e('0x28')](_0x508671['query'][_0xc53e('0x28')]);}return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc?{'count':_0x25469e,'rows':_0x4c6ddc}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x2601ba,null))[_0xc53e('0x4b')](handleError(_0x2601ba,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 41e7d34..d837fc5 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 _0x4a83=['path','rimraf','../../config/environment','exports','define','util','../../config/logger','api','moment'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x4a83,0x125));var _0x34a8=function(_0x35d1ba,_0x195d56){_0x35d1ba=_0x35d1ba-0x0;var _0x3b26bb=_0x4a83[_0x35d1ba];return _0x3b26bb;};'use strict';var _=require('lodash');var util=require(_0x34a8('0x0'));var logger=require(_0x34a8('0x1'))(_0x34a8('0x2'));var moment=require(_0x34a8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34a8('0x4'));var rimraf=require(_0x34a8('0x5'));var config=require(_0x34a8('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x34a8('0x7')]=function(_0x33bc73,_0xa51ac4){return _0x33bc73[_0x34a8('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bdb=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','moment'];(function(_0x2b7913,_0x56ca38){var _0x5e07f6=function(_0x99eba4){while(--_0x99eba4){_0x2b7913['push'](_0x2b7913['shift']());}};_0x5e07f6(++_0x56ca38);}(_0x2bdb,0x105));var _0xb2bd=function(_0x4ee075,_0x1eb092){_0x4ee075=_0x4ee075-0x0;var _0x4dfb79=_0x2bdb[_0x4ee075];return _0x4dfb79;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var logger=require(_0xb2bd('0x1'))('api');var moment=require(_0xb2bd('0x2'));var BPromise=require(_0xb2bd('0x3'));var rp=require(_0xb2bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var attributes=require(_0xb2bd('0x7'));module[_0xb2bd('0x8')]=function(_0x461137,_0x2ef40b){return _0x461137[_0xb2bd('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0xb2bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 79efccb..6bce4e8 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x3799ed,_0x5f28ca){_0x3799ed=_0x3799ed-0x0;var _0x4d31a6=_0xac4a[_0x3799ed];return _0x4d31a6;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xffda=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3ac919,_0x3b0588){var _0x425be6=function(_0x533915){while(--_0x533915){_0x3ac919['push'](_0x3ac919['shift']());}};_0x425be6(++_0x3b0588);}(_0xffda,0x73));var _0xaffd=function(_0x2c968a,_0x91d0d){_0x2c968a=_0x2c968a-0x0;var _0x4430d0=_0xffda[_0x2c968a];return _0x4430d0;};'use strict';var _=require(_0xaffd('0x0'));var util=require(_0xaffd('0x1'));var moment=require(_0xaffd('0x2'));var BPromise=require(_0xaffd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaffd('0x4'));var db=require(_0xaffd('0x5'))['db'];var utils=require(_0xaffd('0x6'));var logger=require('../../config/logger')(_0xaffd('0x7'));var config=require('../../config/environment');var jayson=require(_0xaffd('0x8'));var client=jayson[_0xaffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca99e,_0x39b2e5,_0x12865c){return new BPromise(function(_0x3647e1,_0x514b76){return client[_0xaffd('0xa')](_0x4ca99e,_0x12865c)[_0xaffd('0xb')](function(_0x505908){logger['info'](_0xaffd('0xc'),_0x39b2e5,_0xaffd('0xd'));logger[_0xaffd('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x39b2e5,_0xaffd('0xd'),JSON[_0xaffd('0xf')](_0x505908));if(_0x505908['error']){if(_0x505908[_0xaffd('0x10')][_0xaffd('0x11')]===0x1f4){logger[_0xaffd('0x10')](_0xaffd('0xc'),_0x39b2e5,_0x505908[_0xaffd('0x10')]['message']);return _0x514b76(_0x505908[_0xaffd('0x10')]['message']);}logger['error'](_0xaffd('0xc'),_0x39b2e5,_0x505908[_0xaffd('0x10')][_0xaffd('0x12')]);return _0x3647e1(_0x505908['error'][_0xaffd('0x12')]);}else{logger[_0xaffd('0x13')](_0xaffd('0xc'),_0x39b2e5,_0xaffd('0xd'));_0x3647e1(_0x505908[_0xaffd('0x14')][_0xaffd('0x12')]);}})[_0xaffd('0x15')](function(_0x3ddf0c){logger['error'](_0xaffd('0xc'),_0x39b2e5,_0x3ddf0c);_0x514b76(_0x3ddf0c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index de7c091..ec34df7 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 _0x8cae=['path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','show','post','delete','destroy','exports','multer'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8cae,0x1bf));var _0xe8ca=function(_0x444c35,_0x2d3a46){_0x444c35=_0x444c35-0x0;var _0x63506c=_0x8cae[_0x444c35];return _0x63506c;};'use strict';var multer=require(_0xe8ca('0x0'));var util=require('util');var path=require(_0xe8ca('0x1'));var timeout=require(_0xe8ca('0x2'));var express=require(_0xe8ca('0x3'));var router=express[_0xe8ca('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe8ca('0x5'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xe8ca('0x6')](),controller[_0xe8ca('0x7')]);router[_0xe8ca('0x8')]('/:id',auth[_0xe8ca('0x6')](),controller[_0xe8ca('0x9')]);router[_0xe8ca('0xa')]('/',auth[_0xe8ca('0x6')](),controller['create']);router['put']('/:id',auth[_0xe8ca('0x6')](),controller['update']);router[_0xe8ca('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe8ca('0xc')]);module[_0xe8ca('0xd')]=router; \ No newline at end of file +var _0x724a=['isAuthenticated','show','post','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x51ccb3,_0x53d1c0){var _0x33a19c=function(_0x2782b3){while(--_0x2782b3){_0x51ccb3['push'](_0x51ccb3['shift']());}};_0x33a19c(++_0x53d1c0);}(_0x724a,0x177));var _0xa724=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x724a[_0x3cae69];return _0x3128eb;};'use strict';var multer=require(_0xa724('0x0'));var util=require(_0xa724('0x1'));var path=require(_0xa724('0x2'));var timeout=require('connect-timeout');var express=require(_0xa724('0x3'));var router=express['Router']();var auth=require(_0xa724('0x4'));var interaction=require(_0xa724('0x5'));var config=require(_0xa724('0x6'));var controller=require('./intFreshsalesField.controller');router[_0xa724('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa724('0x7')](_0xa724('0x8'),auth[_0xa724('0x9')](),controller[_0xa724('0xa')]);router[_0xa724('0xb')]('/',auth[_0xa724('0x9')](),controller['create']);router[_0xa724('0xc')](_0xa724('0x8'),auth[_0xa724('0x9')](),controller[_0xa724('0xd')]);router[_0xa724('0xe')](_0xa724('0x8'),auth[_0xa724('0x9')](),controller[_0xa724('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d789551..ff769c4 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 _0x8a11=['string','customVariable','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x1e47bf,_0x28087d){var _0x4bbc38=function(_0x33a766){while(--_0x33a766){_0x1e47bf['push'](_0x1e47bf['shift']());}};_0x4bbc38(++_0x28087d);}(_0x8a11,0x196));var _0x18a1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8a11[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x18a1('0x0'));module[_0x18a1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x18a1('0x2'),'variable',_0x18a1('0x3'),'keyValue'),'defaultValue':_0x18a1('0x2')},'content':{'type':Sequelize[_0x18a1('0x4')]},'key':{'type':Sequelize[_0x18a1('0x4')]},'keyType':{'type':Sequelize[_0x18a1('0x5')](_0x18a1('0x2'),_0x18a1('0x6'),_0x18a1('0x3'))},'keyContent':{'type':Sequelize[_0x18a1('0x4')]},'idField':{'type':Sequelize[_0x18a1('0x4')]},'nameField':{'type':Sequelize[_0x18a1('0x4')]},'customField':{'type':Sequelize[_0x18a1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18a1('0x4')]}}; \ No newline at end of file +var _0xde78=['ENUM','variable','customVariable','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde78,0x166));var _0x8de7=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xde78[_0x54defc];return _0x1955d3;};'use strict';var Sequelize=require(_0x8de7('0x0'));module[_0x8de7('0x1')]={'type':{'type':Sequelize[_0x8de7('0x2')]('string',_0x8de7('0x3'),_0x8de7('0x4'),'keyValue'),'defaultValue':_0x8de7('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8de7('0x6')]},'keyType':{'type':Sequelize[_0x8de7('0x2')](_0x8de7('0x5'),_0x8de7('0x3'),_0x8de7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8de7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8de7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 8c42226..73225b0 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 _0xe905=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format'];(function(_0x294dc1,_0x26228d){var _0x5028ea=function(_0x171a1b){while(--_0x171a1b){_0x294dc1['push'](_0x294dc1['shift']());}};_0x5028ea(++_0x26228d);}(_0xe905,0x1bb));var _0x5e90=function(_0x4e73aa,_0x56a024){_0x4e73aa=_0x4e73aa-0x0;var _0x4c4e00=_0xe905[_0x4e73aa];return _0x4c4e00;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5e90('0x0'));var rimraf=require(_0x5e90('0x1'));var zipdir=require(_0x5e90('0x2'));var jsonpatch=require(_0x5e90('0x3'));var rp=require(_0x5e90('0x4'));var moment=require(_0x5e90('0x5'));var BPromise=require(_0x5e90('0x6'));var Mustache=require(_0x5e90('0x7'));var util=require(_0x5e90('0x8'));var path=require('path');var sox=require(_0x5e90('0x9'));var csv=require(_0x5e90('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5e90('0xb'));var crypto=require(_0x5e90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e90('0xa'));var querystring=require(_0x5e90('0xd'));var Papa=require('papaparse');var Redis=require(_0x5e90('0xe'));var authService=require(_0x5e90('0xf'));var qs=require(_0x5e90('0x10'));var as=require(_0x5e90('0x11'));var hardwareService=require(_0x5e90('0x12'));var logger=require(_0x5e90('0x13'))(_0x5e90('0x14'));var utils=require('../../config/utils');var config=require(_0x5e90('0x15'));var licenseUtil=require(_0x5e90('0x16'));var db=require(_0x5e90('0x17'))['db'];function respondWithStatusCode(_0x36d0c4,_0x147468){_0x147468=_0x147468||0xcc;return function(_0xef1faa){if(_0xef1faa){return _0x36d0c4[_0x5e90('0x18')](_0x147468);}return _0x36d0c4[_0x5e90('0x19')](_0x147468)[_0x5e90('0x1a')]();};}function respondWithResult(_0x1435d1,_0x1ae711){_0x1ae711=_0x1ae711||0xc8;return function(_0x42cb30){if(_0x42cb30){return _0x1435d1[_0x5e90('0x19')](_0x1ae711)[_0x5e90('0x1b')](_0x42cb30);}};}function respondWithFilteredResult(_0x10706c,_0x389d33){return function(_0x9c537c){if(_0x9c537c){var _0x34fa76=_0x9c537c[_0x5e90('0x1c')],_0x20a2dc=_0x389d33['offset'],_0xc08573=_0x389d33[_0x5e90('0x1d')]+_0x389d33['limit'],_0x458981;if(_0xc08573>=_0x34fa76){_0xc08573=_0x34fa76;_0x458981=0xc8;}else{_0x458981=0xce;}_0x10706c[_0x5e90('0x19')](_0x458981);return _0x10706c[_0x5e90('0x1e')](_0x5e90('0x1f'),_0x20a2dc+'-'+_0xc08573+'/'+_0x34fa76)[_0x5e90('0x1b')](_0x9c537c);}return null;};}function patchUpdates(_0x29d496){return function(_0x22a8cb){try{jsonpatch[_0x5e90('0x20')](_0x22a8cb,_0x29d496,!![]);}catch(_0x202430){return BPromise[_0x5e90('0x21')](_0x202430);}return _0x22a8cb[_0x5e90('0x22')]();};}function saveUpdates(_0x2f22c9,_0x3b3649){return function(_0x109df3){if(_0x109df3){return _0x109df3['update'](_0x2f22c9)['then'](function(_0x3c7cf6){return _0x3c7cf6;});}return null;};}function removeEntity(_0xa694ff,_0x1d8cff){return function(_0x8593fc){if(_0x8593fc){return _0x8593fc[_0x5e90('0x23')]()[_0x5e90('0x24')](function(){_0xa694ff[_0x5e90('0x19')](0xcc)[_0x5e90('0x1a')]();});}};}function handleEntityNotFound(_0x478aa7,_0x44ada6){return function(_0x2e26e2){if(!_0x2e26e2){_0x478aa7[_0x5e90('0x18')](0x194);}return _0x2e26e2;};}function handleError(_0x5bf941,_0x5a69c4){_0x5a69c4=_0x5a69c4||0x1f4;return function(_0x223613){logger[_0x5e90('0x25')](_0x223613['stack']);if(_0x223613[_0x5e90('0x26')]){delete _0x223613['name'];}_0x5bf941[_0x5e90('0x19')](_0x5a69c4)[_0x5e90('0x27')](_0x223613);};}exports['index']=function(_0x2a7053,_0xce4cf4){var _0x2b42a1={},_0x1aaab3={},_0x2b0ca2={'count':0x0,'rows':[]};var _0x4a4efc=_[_0x5e90('0x28')](db[_0x5e90('0x29')][_0x5e90('0x2a')],function(_0x2a59d0){return{'name':_0x2a59d0[_0x5e90('0x2b')],'type':_0x2a59d0[_0x5e90('0x2c')][_0x5e90('0x2d')]};});_0x1aaab3[_0x5e90('0x2e')]=_['map'](_0x4a4efc,'name');_0x1aaab3[_0x5e90('0x2f')]=_[_0x5e90('0x30')](_0x2a7053[_0x5e90('0x2f')]);_0x1aaab3['filters']=_['intersection'](_0x1aaab3[_0x5e90('0x2e')],_0x1aaab3[_0x5e90('0x2f')]);_0x2b42a1[_0x5e90('0x31')]=_['intersection'](_0x1aaab3[_0x5e90('0x2e')],qs[_0x5e90('0x32')](_0x2a7053[_0x5e90('0x2f')]['fields']));_0x2b42a1[_0x5e90('0x31')]=_0x2b42a1[_0x5e90('0x31')][_0x5e90('0x33')]?_0x2b42a1[_0x5e90('0x31')]:_0x1aaab3['model'];if(!_0x2a7053[_0x5e90('0x2f')][_0x5e90('0x34')](_0x5e90('0x35'))){_0x2b42a1[_0x5e90('0x36')]=qs[_0x5e90('0x36')](_0x2a7053[_0x5e90('0x2f')]['limit']);_0x2b42a1['offset']=qs['offset'](_0x2a7053['query'][_0x5e90('0x1d')]);}_0x2b42a1[_0x5e90('0x37')]=qs[_0x5e90('0x38')](_0x2a7053[_0x5e90('0x2f')]['sort']);_0x2b42a1['where']=qs[_0x5e90('0x39')](_['pick'](_0x2a7053[_0x5e90('0x2f')],_0x1aaab3[_0x5e90('0x39')]),_0x4a4efc);if(_0x2a7053['query'][_0x5e90('0x3a')]){_0x2b42a1[_0x5e90('0x3b')]=_[_0x5e90('0x3c')](_0x2b42a1[_0x5e90('0x3b')],{'$or':_[_0x5e90('0x28')](_0x4a4efc,function(_0x36c3c8){if(_0x36c3c8[_0x5e90('0x2c')]!==_0x5e90('0x3d')){var _0x39d897={};_0x39d897[_0x36c3c8['name']]={'$like':'%'+_0x2a7053[_0x5e90('0x2f')][_0x5e90('0x3a')]+'%'};return _0x39d897;}})});}_0x2b42a1=_[_0x5e90('0x3c')]({},_0x2b42a1,_0x2a7053[_0x5e90('0x3e')]);var _0x5d9d6d={'where':_0x2b42a1[_0x5e90('0x3b')]};return db[_0x5e90('0x29')]['count'](_0x5d9d6d)['then'](function(_0x2fdf89){_0x2b0ca2['count']=_0x2fdf89;if(_0x2a7053[_0x5e90('0x2f')][_0x5e90('0x3f')]){_0x2b42a1[_0x5e90('0x40')]=[{'all':!![]}];}return db[_0x5e90('0x29')][_0x5e90('0x41')](_0x2b42a1);})[_0x5e90('0x24')](function(_0x2295bd){_0x2b0ca2[_0x5e90('0x42')]=_0x2295bd;return _0x2b0ca2;})[_0x5e90('0x24')](respondWithFilteredResult(_0xce4cf4,_0x2b42a1))[_0x5e90('0x43')](handleError(_0xce4cf4,null));};exports[_0x5e90('0x44')]=function(_0x193d3b,_0x3e8b40){var _0x5daa1b={'raw':!![],'where':{'id':_0x193d3b[_0x5e90('0x45')]['id']}},_0x3c075c={};_0x3c075c[_0x5e90('0x2e')]=_[_0x5e90('0x30')](db['FreshsalesField'][_0x5e90('0x2a')]);_0x3c075c['query']=_[_0x5e90('0x30')](_0x193d3b[_0x5e90('0x2f')]);_0x3c075c['filters']=_[_0x5e90('0x46')](_0x3c075c[_0x5e90('0x2e')],_0x3c075c[_0x5e90('0x2f')]);_0x5daa1b['attributes']=_[_0x5e90('0x46')](_0x3c075c['model'],qs[_0x5e90('0x32')](_0x193d3b['query'][_0x5e90('0x32')]));_0x5daa1b[_0x5e90('0x31')]=_0x5daa1b[_0x5e90('0x31')][_0x5e90('0x33')]?_0x5daa1b[_0x5e90('0x31')]:_0x3c075c[_0x5e90('0x2e')];if(_0x193d3b[_0x5e90('0x2f')][_0x5e90('0x3f')]){_0x5daa1b[_0x5e90('0x40')]=[{'all':!![]}];}_0x5daa1b=_[_0x5e90('0x3c')]({},_0x5daa1b,_0x193d3b[_0x5e90('0x3e')]);return db[_0x5e90('0x29')][_0x5e90('0x47')](_0x5daa1b)[_0x5e90('0x24')](handleEntityNotFound(_0x3e8b40,null))[_0x5e90('0x24')](respondWithResult(_0x3e8b40,null))[_0x5e90('0x43')](handleError(_0x3e8b40,null));};exports[_0x5e90('0x48')]=function(_0x37e940,_0x4561cc){return db[_0x5e90('0x29')]['create'](_0x37e940['body'],{})[_0x5e90('0x24')](respondWithResult(_0x4561cc,0xc9))[_0x5e90('0x43')](handleError(_0x4561cc,null));};exports['update']=function(_0x53f9ac,_0x44b241){if(_0x53f9ac[_0x5e90('0x49')]['id']){delete _0x53f9ac[_0x5e90('0x49')]['id'];}return db[_0x5e90('0x29')][_0x5e90('0x47')]({'where':{'id':_0x53f9ac['params']['id']}})[_0x5e90('0x24')](handleEntityNotFound(_0x44b241,null))[_0x5e90('0x24')](saveUpdates(_0x53f9ac[_0x5e90('0x49')],null))[_0x5e90('0x24')](respondWithResult(_0x44b241,null))['catch'](handleError(_0x44b241,null));};exports[_0x5e90('0x23')]=function(_0x3e28d4,_0x4152af){return db[_0x5e90('0x29')][_0x5e90('0x47')]({'where':{'id':_0x3e28d4[_0x5e90('0x45')]['id']}})[_0x5e90('0x24')](handleEntityNotFound(_0x4152af,null))[_0x5e90('0x24')](removeEntity(_0x4152af,null))[_0x5e90('0x43')](handleError(_0x4152af,null));}; \ No newline at end of file +var _0x7c51=['end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','rows','catch','show','keys','include','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x5e6f01,_0x555e50){var _0x26635c=function(_0x3a2dd3){while(--_0x3a2dd3){_0x5e6f01['push'](_0x5e6f01['shift']());}};_0x26635c(++_0x555e50);}(_0x7c51,0x1ae));var _0x17c5=function(_0x433848,_0x1fe400){_0x433848=_0x433848-0x0;var _0x3cb88a=_0x7c51[_0x433848];return _0x3cb88a;};'use strict';var pdf=require(_0x17c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17c5('0x1'));var zipdir=require(_0x17c5('0x2'));var jsonpatch=require(_0x17c5('0x3'));var rp=require(_0x17c5('0x4'));var moment=require(_0x17c5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x17c5('0x6'));var path=require(_0x17c5('0x7'));var sox=require(_0x17c5('0x8'));var csv=require(_0x17c5('0x9'));var ejs=require(_0x17c5('0xa'));var fs=require('fs');var _=require(_0x17c5('0xb'));var squel=require(_0x17c5('0xc'));var crypto=require(_0x17c5('0xd'));var jsforce=require(_0x17c5('0xe'));var deskjs=require(_0x17c5('0xf'));var toCsv=require(_0x17c5('0x9'));var querystring=require(_0x17c5('0x10'));var Papa=require('papaparse');var Redis=require(_0x17c5('0x11'));var authService=require(_0x17c5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x17c5('0x13'));var hardwareService=require(_0x17c5('0x14'));var logger=require('../../config/logger')(_0x17c5('0x15'));var utils=require(_0x17c5('0x16'));var config=require(_0x17c5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x17c5('0x18'))['db'];function respondWithStatusCode(_0x10ef5b,_0x208354){_0x208354=_0x208354||0xcc;return function(_0x2f54a1){if(_0x2f54a1){return _0x10ef5b['sendStatus'](_0x208354);}return _0x10ef5b[_0x17c5('0x19')](_0x208354)[_0x17c5('0x1a')]();};}function respondWithResult(_0x486993,_0x512dc8){_0x512dc8=_0x512dc8||0xc8;return function(_0x3fbf9d){if(_0x3fbf9d){return _0x486993[_0x17c5('0x19')](_0x512dc8)['json'](_0x3fbf9d);}};}function respondWithFilteredResult(_0x39b568,_0x2eb9bd){return function(_0x383d29){if(_0x383d29){var _0x17d4fe=_0x383d29[_0x17c5('0x1b')],_0x3e3feb=_0x2eb9bd['offset'],_0x1c0eac=_0x2eb9bd[_0x17c5('0x1c')]+_0x2eb9bd[_0x17c5('0x1d')],_0x52794f;if(_0x1c0eac>=_0x17d4fe){_0x1c0eac=_0x17d4fe;_0x52794f=0xc8;}else{_0x52794f=0xce;}_0x39b568[_0x17c5('0x19')](_0x52794f);return _0x39b568[_0x17c5('0x1e')](_0x17c5('0x1f'),_0x3e3feb+'-'+_0x1c0eac+'/'+_0x17d4fe)['json'](_0x383d29);}return null;};}function patchUpdates(_0x166394){return function(_0xf436f3){try{jsonpatch['apply'](_0xf436f3,_0x166394,!![]);}catch(_0x4ad64a){return BPromise[_0x17c5('0x20')](_0x4ad64a);}return _0xf436f3[_0x17c5('0x21')]();};}function saveUpdates(_0x1e3f69,_0x4cdc9b){return function(_0x897ec5){if(_0x897ec5){return _0x897ec5[_0x17c5('0x22')](_0x1e3f69)[_0x17c5('0x23')](function(_0x2d99e1){return _0x2d99e1;});}return null;};}function removeEntity(_0x36beb8,_0x160f90){return function(_0x1c7f74){if(_0x1c7f74){return _0x1c7f74[_0x17c5('0x24')]()['then'](function(){_0x36beb8[_0x17c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2211d3,_0x334ec9){return function(_0x238c96){if(!_0x238c96){_0x2211d3[_0x17c5('0x25')](0x194);}return _0x238c96;};}function handleError(_0x39ca33,_0x26adeb){_0x26adeb=_0x26adeb||0x1f4;return function(_0x3c5034){logger[_0x17c5('0x26')](_0x3c5034[_0x17c5('0x27')]);if(_0x3c5034['name']){delete _0x3c5034[_0x17c5('0x28')];}_0x39ca33['status'](_0x26adeb)[_0x17c5('0x29')](_0x3c5034);};}exports[_0x17c5('0x2a')]=function(_0x5e1b16,_0x97f322){var _0x490057={},_0x48b05e={},_0x50fa78={'count':0x0,'rows':[]};var _0x5ee439=_['map'](db[_0x17c5('0x2b')][_0x17c5('0x2c')],function(_0x59ce76){return{'name':_0x59ce76[_0x17c5('0x2d')],'type':_0x59ce76[_0x17c5('0x2e')][_0x17c5('0x2f')]};});_0x48b05e[_0x17c5('0x30')]=_['map'](_0x5ee439,_0x17c5('0x28'));_0x48b05e[_0x17c5('0x31')]=_['keys'](_0x5e1b16[_0x17c5('0x31')]);_0x48b05e[_0x17c5('0x32')]=_[_0x17c5('0x33')](_0x48b05e[_0x17c5('0x30')],_0x48b05e[_0x17c5('0x31')]);_0x490057[_0x17c5('0x34')]=_[_0x17c5('0x33')](_0x48b05e[_0x17c5('0x30')],qs['fields'](_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x35')]));_0x490057[_0x17c5('0x34')]=_0x490057[_0x17c5('0x34')][_0x17c5('0x36')]?_0x490057[_0x17c5('0x34')]:_0x48b05e[_0x17c5('0x30')];if(!_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x37')](_0x17c5('0x38'))){_0x490057[_0x17c5('0x1d')]=qs[_0x17c5('0x1d')](_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x1d')]);_0x490057[_0x17c5('0x1c')]=qs[_0x17c5('0x1c')](_0x5e1b16[_0x17c5('0x31')]['offset']);}_0x490057[_0x17c5('0x39')]=qs[_0x17c5('0x3a')](_0x5e1b16['query'][_0x17c5('0x3a')]);_0x490057[_0x17c5('0x3b')]=qs['filters'](_[_0x17c5('0x3c')](_0x5e1b16[_0x17c5('0x31')],_0x48b05e[_0x17c5('0x32')]),_0x5ee439);if(_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x3d')]){_0x490057['where']=_['merge'](_0x490057[_0x17c5('0x3b')],{'$or':_[_0x17c5('0x3e')](_0x5ee439,function(_0x4a56e0){if(_0x4a56e0[_0x17c5('0x2e')]!==_0x17c5('0x3f')){var _0x251fb0={};_0x251fb0[_0x4a56e0[_0x17c5('0x28')]]={'$like':'%'+_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x3d')]+'%'};return _0x251fb0;}})});}_0x490057=_[_0x17c5('0x40')]({},_0x490057,_0x5e1b16[_0x17c5('0x41')]);var _0x49e03b={'where':_0x490057[_0x17c5('0x3b')]};return db[_0x17c5('0x2b')][_0x17c5('0x1b')](_0x49e03b)[_0x17c5('0x23')](function(_0x1aad4b){_0x50fa78[_0x17c5('0x1b')]=_0x1aad4b;if(_0x5e1b16[_0x17c5('0x31')][_0x17c5('0x42')]){_0x490057['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x490057);})[_0x17c5('0x23')](function(_0x50c4e3){_0x50fa78[_0x17c5('0x43')]=_0x50c4e3;return _0x50fa78;})[_0x17c5('0x23')](respondWithFilteredResult(_0x97f322,_0x490057))[_0x17c5('0x44')](handleError(_0x97f322,null));};exports[_0x17c5('0x45')]=function(_0x2ae59c,_0x15d8c7){var _0x59b2a2={'raw':!![],'where':{'id':_0x2ae59c['params']['id']}},_0x276cc8={};_0x276cc8[_0x17c5('0x30')]=_['keys'](db[_0x17c5('0x2b')]['rawAttributes']);_0x276cc8[_0x17c5('0x31')]=_[_0x17c5('0x46')](_0x2ae59c[_0x17c5('0x31')]);_0x276cc8[_0x17c5('0x32')]=_[_0x17c5('0x33')](_0x276cc8['model'],_0x276cc8[_0x17c5('0x31')]);_0x59b2a2[_0x17c5('0x34')]=_[_0x17c5('0x33')](_0x276cc8[_0x17c5('0x30')],qs[_0x17c5('0x35')](_0x2ae59c['query'][_0x17c5('0x35')]));_0x59b2a2[_0x17c5('0x34')]=_0x59b2a2['attributes'][_0x17c5('0x36')]?_0x59b2a2[_0x17c5('0x34')]:_0x276cc8['model'];if(_0x2ae59c[_0x17c5('0x31')][_0x17c5('0x42')]){_0x59b2a2[_0x17c5('0x47')]=[{'all':!![]}];}_0x59b2a2=_['merge']({},_0x59b2a2,_0x2ae59c[_0x17c5('0x41')]);return db[_0x17c5('0x2b')][_0x17c5('0x48')](_0x59b2a2)[_0x17c5('0x23')](handleEntityNotFound(_0x15d8c7,null))[_0x17c5('0x23')](respondWithResult(_0x15d8c7,null))[_0x17c5('0x44')](handleError(_0x15d8c7,null));};exports[_0x17c5('0x49')]=function(_0x1eb147,_0x29c988){return db['FreshsalesField'][_0x17c5('0x49')](_0x1eb147[_0x17c5('0x4a')],{})[_0x17c5('0x23')](respondWithResult(_0x29c988,0xc9))[_0x17c5('0x44')](handleError(_0x29c988,null));};exports['update']=function(_0xb0043b,_0x247f97){if(_0xb0043b['body']['id']){delete _0xb0043b[_0x17c5('0x4a')]['id'];}return db[_0x17c5('0x2b')][_0x17c5('0x48')]({'where':{'id':_0xb0043b[_0x17c5('0x4b')]['id']}})[_0x17c5('0x23')](handleEntityNotFound(_0x247f97,null))['then'](saveUpdates(_0xb0043b['body'],null))[_0x17c5('0x23')](respondWithResult(_0x247f97,null))[_0x17c5('0x44')](handleError(_0x247f97,null));};exports[_0x17c5('0x24')]=function(_0x4d5fc7,_0x88f00f){return db['FreshsalesField'][_0x17c5('0x48')]({'where':{'id':_0x4d5fc7[_0x17c5('0x4b')]['id']}})[_0x17c5('0x23')](handleEntityNotFound(_0x88f00f,null))[_0x17c5('0x23')](removeEntity(_0x88f00f,null))[_0x17c5('0x44')](handleError(_0x88f00f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b01d85e..f7d54ba 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 _0xa192=['idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields'];(function(_0x41fce0,_0x421155){var _0x30f479=function(_0x2745bb){while(--_0x2745bb){_0x41fce0['push'](_0x41fce0['shift']());}};_0x30f479(++_0x421155);}(_0xa192,0x12e));var _0x2a19=function(_0x134e18,_0xa05184){_0x134e18=_0x134e18-0x0;var _0x4a8260=_0xa192[_0x134e18];return _0x4a8260;};'use strict';var _=require('lodash');var util=require(_0x2a19('0x0'));var logger=require(_0x2a19('0x1'))('api');var moment=require(_0x2a19('0x2'));var BPromise=require(_0x2a19('0x3'));var rp=require(_0x2a19('0x4'));var fs=require('fs');var path=require(_0x2a19('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a19('0x6'));module[_0x2a19('0x7')]=function(_0x1e99be,_0x117bcd){return _0x1e99be['define'](_0x2a19('0x8'),attributes,{'tableName':_0x2a19('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x2a19('0xa'),_0x2a19('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cb=['bluebird','request-promise','path','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0xd34ef3,_0x10bc8c){var _0x991cba=function(_0x11d952){while(--_0x11d952){_0xd34ef3['push'](_0xd34ef3['shift']());}};_0x991cba(++_0x10bc8c);}(_0xf3cb,0x175));var _0xbf3c=function(_0x226402,_0x36aac7){_0x226402=_0x226402-0x0;var _0x260b25=_0xf3cb[_0x226402];return _0x260b25;};'use strict';var _=require(_0xbf3c('0x0'));var util=require('util');var logger=require(_0xbf3c('0x1'))(_0xbf3c('0x2'));var moment=require(_0xbf3c('0x3'));var BPromise=require(_0xbf3c('0x4'));var rp=require(_0xbf3c('0x5'));var fs=require('fs');var path=require(_0xbf3c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xbf3c('0x7')]=function(_0x250fbb,_0x489cb0){return _0x250fbb[_0xbf3c('0x8')](_0xbf3c('0x9'),attributes,{'tableName':_0xbf3c('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xbf3c('0xb'),_0xbf3c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 72bb192..1986377 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 _0xecf5=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xecf5,0x1c5));var _0x5ecf=function(_0x278b5c,_0x4e2cc6){_0x278b5c=_0x278b5c-0x0;var _0x297083=_0xecf5[_0x278b5c];return _0x297083;};'use strict';var _=require('lodash');var util=require(_0x5ecf('0x0'));var moment=require(_0x5ecf('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ecf('0x2'));var fs=require('fs');var Redis=require(_0x5ecf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ecf('0x4'));var config=require(_0x5ecf('0x5'));var jayson=require(_0x5ecf('0x6'));var client=jayson[_0x5ecf('0x7')][_0x5ecf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d5a17,_0x4af53e,_0x4972e3){return new BPromise(function(_0x5d89af,_0x99e0d1){return client[_0x5ecf('0x9')](_0x2d5a17,_0x4972e3)[_0x5ecf('0xa')](function(_0x57d0e0){logger[_0x5ecf('0xb')](_0x5ecf('0xc'),_0x4af53e,_0x5ecf('0xd'));logger[_0x5ecf('0xe')](_0x5ecf('0xf'),_0x4af53e,'request\x20sent',JSON['stringify'](_0x57d0e0));if(_0x57d0e0[_0x5ecf('0x10')]){if(_0x57d0e0[_0x5ecf('0x10')][_0x5ecf('0x11')]===0x1f4){logger[_0x5ecf('0x10')](_0x5ecf('0xc'),_0x4af53e,_0x57d0e0['error']['message']);return _0x99e0d1(_0x57d0e0[_0x5ecf('0x10')][_0x5ecf('0x12')]);}logger[_0x5ecf('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4af53e,_0x57d0e0[_0x5ecf('0x10')][_0x5ecf('0x12')]);return _0x5d89af(_0x57d0e0['error']['message']);}else{logger[_0x5ecf('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x4af53e,_0x5ecf('0xd'));_0x5d89af(_0x57d0e0['result'][_0x5ecf('0x12')]);}})[_0x5ecf('0x13')](function(_0x21c84e){logger[_0x5ecf('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4af53e,_0x21c84e);_0x99e0d1(_0x21c84e);});});} \ No newline at end of file +var _0x76c5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x76c5,0x1df));var _0x576c=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x76c5[_0x454e6d];return _0x4bc294;};'use strict';var _=require(_0x576c('0x0'));var util=require('util');var moment=require(_0x576c('0x1'));var BPromise=require(_0x576c('0x2'));var rs=require(_0x576c('0x3'));var fs=require('fs');var Redis=require(_0x576c('0x4'));var db=require(_0x576c('0x5'))['db'];var utils=require(_0x576c('0x6'));var logger=require('../../config/logger')(_0x576c('0x7'));var config=require(_0x576c('0x8'));var jayson=require(_0x576c('0x9'));var client=jayson[_0x576c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9595a6,_0x327612,_0x2ac1b9){return new BPromise(function(_0x487a2c,_0x54d082){return client[_0x576c('0xb')](_0x9595a6,_0x2ac1b9)[_0x576c('0xc')](function(_0x2ee0ad){logger[_0x576c('0xd')](_0x576c('0xe'),_0x327612,_0x576c('0xf'));logger[_0x576c('0x10')](_0x576c('0x11'),_0x327612,_0x576c('0xf'),JSON[_0x576c('0x12')](_0x2ee0ad));if(_0x2ee0ad[_0x576c('0x13')]){if(_0x2ee0ad[_0x576c('0x13')][_0x576c('0x14')]===0x1f4){logger[_0x576c('0x13')](_0x576c('0xe'),_0x327612,_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);return _0x54d082(_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);}logger[_0x576c('0x13')](_0x576c('0xe'),_0x327612,_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);return _0x487a2c(_0x2ee0ad[_0x576c('0x13')][_0x576c('0x15')]);}else{logger[_0x576c('0xd')](_0x576c('0xe'),_0x327612,_0x576c('0xf'));_0x487a2c(_0x2ee0ad[_0x576c('0x16')][_0x576c('0x15')]);}})['catch'](function(_0x322f96){logger[_0x576c('0x13')](_0x576c('0xe'),_0x327612,_0x322f96);_0x54d082(_0x322f96);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 484cd68..70d28a1 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 _0xfe5e=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','/:id','destroy','exports','multer'];(function(_0x143a4d,_0x24755c){var _0x218f81=function(_0x33174d){while(--_0x33174d){_0x143a4d['push'](_0x143a4d['shift']());}};_0x218f81(++_0x24755c);}(_0xfe5e,0x103));var _0xefe5=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0xfe5e[_0x5192de];return _0x4e287e;};'use strict';var multer=require(_0xefe5('0x0'));var util=require(_0xefe5('0x1'));var path=require(_0xefe5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xefe5('0x3'));var interaction=require(_0xefe5('0x4'));var config=require(_0xefe5('0x5'));var controller=require('./intSalesforceAccount.controller');router[_0xefe5('0x6')]('/',auth[_0xefe5('0x7')](),controller[_0xefe5('0x8')]);router[_0xefe5('0x6')]('/:id',auth[_0xefe5('0x7')](),controller[_0xefe5('0x9')]);router[_0xefe5('0x6')](_0xefe5('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xefe5('0xb'),auth[_0xefe5('0x7')](),controller['getFields']);router[_0xefe5('0xc')]('/',auth[_0xefe5('0x7')](),controller[_0xefe5('0xd')]);router[_0xefe5('0xc')](_0xefe5('0xa'),auth['isAuthenticated'](),controller[_0xefe5('0xe')]);router[_0xefe5('0xf')]('/:id',auth[_0xefe5('0x7')](),controller['update']);router[_0xefe5('0x10')](_0xefe5('0x11'),auth['isAuthenticated'](),controller[_0xefe5('0x12')]);module[_0xefe5('0x13')]=router; \ No newline at end of file +var _0x8d02=['/:id','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','isAuthenticated','show','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x3a6562,_0x20f6af){var _0x3a3094=function(_0x4c6d8a){while(--_0x4c6d8a){_0x3a6562['push'](_0x3a6562['shift']());}};_0x3a3094(++_0x20f6af);}(_0x8d02,0x191));var _0x28d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8d02[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x28d0('0x0'));var util=require(_0x28d0('0x1'));var path=require('path');var timeout=require(_0x28d0('0x2'));var express=require('express');var router=express[_0x28d0('0x3')]();var auth=require(_0x28d0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x28d0('0x5'));var controller=require(_0x28d0('0x6'));router[_0x28d0('0x7')]('/',auth['isAuthenticated'](),controller[_0x28d0('0x8')]);router[_0x28d0('0x7')]('/:id',auth[_0x28d0('0x9')](),controller[_0x28d0('0xa')]);router['get']('/:id/configurations',auth[_0x28d0('0x9')](),controller['getConfigurations']);router[_0x28d0('0x7')]('/:id/fields',auth[_0x28d0('0x9')](),controller[_0x28d0('0xb')]);router[_0x28d0('0xc')]('/',auth[_0x28d0('0x9')](),controller[_0x28d0('0xd')]);router[_0x28d0('0xc')](_0x28d0('0xe'),auth[_0x28d0('0x9')](),controller[_0x28d0('0xf')]);router[_0x28d0('0x10')]('/:id',auth[_0x28d0('0x9')](),controller[_0x28d0('0x11')]);router[_0x28d0('0x12')](_0x28d0('0x13'),auth[_0x28d0('0x9')](),controller[_0x28d0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7ad2063..2380543 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 _0x25e4=['integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0x25e4,0x10a));var _0x425e=function(_0x3a7108,_0x594584){_0x3a7108=_0x3a7108-0x0;var _0x50782c=_0x25e4[_0x3a7108];return _0x50782c;};'use strict';var Sequelize=require(_0x425e('0x0'));module[_0x425e('0x1')]={'name':{'type':Sequelize[_0x425e('0x2')]},'description':{'type':Sequelize[_0x425e('0x2')]},'username':{'type':Sequelize[_0x425e('0x2')],'unique':_0x425e('0x3')},'remoteUri':{'type':Sequelize[_0x425e('0x2')]},'password':{'type':Sequelize[_0x425e('0x2')]},'clientId':{'type':Sequelize[_0x425e('0x2')]},'clientSecret':{'type':Sequelize[_0x425e('0x2')]},'securityToken':{'type':Sequelize[_0x425e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x425e('0x4'),_0x425e('0x5')),'defaultValue':_0x425e('0x4')}}; \ No newline at end of file +var _0x28b0=['integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x28b0,0x1db));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x028b('0x0'));module[_0x028b('0x1')]={'name':{'type':Sequelize[_0x028b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x028b('0x2')],'unique':_0x028b('0x3')},'remoteUri':{'type':Sequelize[_0x028b('0x2')]},'password':{'type':Sequelize[_0x028b('0x2')]},'clientId':{'type':Sequelize[_0x028b('0x2')]},'clientSecret':{'type':Sequelize[_0x028b('0x2')]},'securityToken':{'type':Sequelize[_0x028b('0x2')]},'serverUrl':{'type':Sequelize[_0x028b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x028b('0x4')](_0x028b('0x5'),'newTab'),'defaultValue':_0x028b('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 051360b..5dbaf10 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 _0x5f66=['securityToken','substring','Connection','login','username','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallType','Priority','Type','Origin','Reason','IsEscalated','SuppliedCompany','includes','picklistValues','label','value','boolean','True','true','false','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../components/integrations/configuration','client','http','request','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','sendStatus','status','count','offset','Content-Range','json','apply','reject','destroy','then','end','stack','name','index','map','SalesforceAccount','rawAttributes','type','model','query','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','update','params','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x65f6('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x65f6('0x15')][_0x65f6('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2c4ee5,_0x217570,_0x369f96,_0x1d29fd){return new BPromise(function(_0x44144b,_0xb1d40a){var _0x46dbc6=_0x1d29fd||client;return _0x46dbc6[_0x65f6('0x17')](_0x2c4ee5,_0x369f96)['then'](function(_0x19b9ff){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x217570,_0x65f6('0x18'));logger[_0x65f6('0x19')](_0x65f6('0x1a'),_0x217570,_0x65f6('0x18'),JSON[_0x65f6('0x1b')](_0x19b9ff));if(_0x19b9ff[_0x65f6('0x1c')]){if(_0x19b9ff[_0x65f6('0x1c')][_0x65f6('0x1d')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x217570,_0x19b9ff[_0x65f6('0x1c')]['message']);return _0xb1d40a(_0x19b9ff['error']['message']);}logger[_0x65f6('0x1c')](_0x65f6('0x1e'),_0x217570,_0x19b9ff['error'][_0x65f6('0x1f')]);return _0x44144b(_0x19b9ff[_0x65f6('0x1c')][_0x65f6('0x1f')]);}else{logger[_0x65f6('0x20')](_0x65f6('0x1e'),_0x217570,_0x65f6('0x18'));_0x44144b(_0x19b9ff['result'][_0x65f6('0x1f')]);}})['catch'](function(_0x5b9e2a){logger[_0x65f6('0x1c')](_0x65f6('0x1e'),_0x217570,_0x5b9e2a);_0xb1d40a(_0x5b9e2a);});});}function respondWithStatusCode(_0x524e42,_0x1eeaaa){_0x1eeaaa=_0x1eeaaa||0xcc;return function(_0x471a33){if(_0x471a33){return _0x524e42[_0x65f6('0x21')](_0x1eeaaa);}return _0x524e42[_0x65f6('0x22')](_0x1eeaaa)['end']();};}function respondWithResult(_0x9d7bb0,_0x59ea32){_0x59ea32=_0x59ea32||0xc8;return function(_0x20a161){if(_0x20a161){return _0x9d7bb0['status'](_0x59ea32)['json'](_0x20a161);}};}function respondWithFilteredResult(_0x4fde2f,_0x29abdb){return function(_0x16cde8){if(_0x16cde8){var _0x4b2292=_0x16cde8[_0x65f6('0x23')],_0x296cd9=_0x29abdb[_0x65f6('0x24')],_0x28f710=_0x29abdb[_0x65f6('0x24')]+_0x29abdb['limit'],_0x52277c;if(_0x28f710>=_0x4b2292){_0x28f710=_0x4b2292;_0x52277c=0xc8;}else{_0x52277c=0xce;}_0x4fde2f['status'](_0x52277c);return _0x4fde2f['set'](_0x65f6('0x25'),_0x296cd9+'-'+_0x28f710+'/'+_0x4b2292)[_0x65f6('0x26')](_0x16cde8);}return null;};}function patchUpdates(_0x4344b3){return function(_0x408ccc){try{jsonpatch[_0x65f6('0x27')](_0x408ccc,_0x4344b3,!![]);}catch(_0x14a387){return BPromise[_0x65f6('0x28')](_0x14a387);}return _0x408ccc['save']();};}function saveUpdates(_0x4ea23d,_0x154cbd){return function(_0x27e284){if(_0x27e284){return _0x27e284['update'](_0x4ea23d)['then'](function(_0x10b368){return _0x10b368;});}return null;};}function removeEntity(_0x1ce43c,_0x11fe3b){return function(_0xc53cb7){if(_0xc53cb7){return _0xc53cb7[_0x65f6('0x29')]()[_0x65f6('0x2a')](function(){_0x1ce43c['status'](0xcc)[_0x65f6('0x2b')]();});}};}function handleEntityNotFound(_0x38f3c6,_0x46f03c){return function(_0x4bc037){if(!_0x4bc037){_0x38f3c6[_0x65f6('0x21')](0x194);}return _0x4bc037;};}function handleError(_0x2a7aa8,_0xbaed3c){_0xbaed3c=_0xbaed3c||0x1f4;return function(_0x45510a){logger[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x2c')]);if(_0x45510a['name']){delete _0x45510a[_0x65f6('0x2d')];}_0x2a7aa8[_0x65f6('0x22')](_0xbaed3c)['send'](_0x45510a);};}exports[_0x65f6('0x2e')]=function(_0x5a740a,_0x2b403b){var _0x50494b={},_0x2b9fb6={},_0x24f7fd={'count':0x0,'rows':[]};var _0x5ce050=_[_0x65f6('0x2f')](db[_0x65f6('0x30')][_0x65f6('0x31')],function(_0x515648){return{'name':_0x515648['fieldName'],'type':_0x515648[_0x65f6('0x32')]['key']};});_0x2b9fb6[_0x65f6('0x33')]=_['map'](_0x5ce050,_0x65f6('0x2d'));_0x2b9fb6[_0x65f6('0x34')]=_['keys'](_0x5a740a[_0x65f6('0x34')]);_0x2b9fb6['filters']=_['intersection'](_0x2b9fb6[_0x65f6('0x33')],_0x2b9fb6[_0x65f6('0x34')]);_0x50494b[_0x65f6('0x35')]=_[_0x65f6('0x36')](_0x2b9fb6[_0x65f6('0x33')],qs[_0x65f6('0x37')](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x37')]));_0x50494b['attributes']=_0x50494b[_0x65f6('0x35')]['length']?_0x50494b[_0x65f6('0x35')]:_0x2b9fb6[_0x65f6('0x33')];if(!_0x5a740a[_0x65f6('0x34')][_0x65f6('0x38')]('nolimit')){_0x50494b[_0x65f6('0x39')]=qs[_0x65f6('0x39')](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x39')]);_0x50494b[_0x65f6('0x24')]=qs[_0x65f6('0x24')](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x24')]);}_0x50494b[_0x65f6('0x3a')]=qs['sort'](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x3b')]);_0x50494b[_0x65f6('0x3c')]=qs[_0x65f6('0x3d')](_[_0x65f6('0x3e')](_0x5a740a[_0x65f6('0x34')],_0x2b9fb6[_0x65f6('0x3d')]),_0x5ce050);if(_0x5a740a[_0x65f6('0x34')][_0x65f6('0x3f')]){_0x50494b[_0x65f6('0x3c')]=_[_0x65f6('0x40')](_0x50494b[_0x65f6('0x3c')],{'$or':_[_0x65f6('0x2f')](_0x5ce050,function(_0x27157d){if(_0x27157d[_0x65f6('0x32')]!==_0x65f6('0x41')){var _0x5119ee={};_0x5119ee[_0x27157d[_0x65f6('0x2d')]]={'$like':'%'+_0x5a740a[_0x65f6('0x34')][_0x65f6('0x3f')]+'%'};return _0x5119ee;}})});}_0x50494b=_[_0x65f6('0x40')]({},_0x50494b,_0x5a740a['options']);var _0x1bf5bf={'where':_0x50494b[_0x65f6('0x3c')]};return db[_0x65f6('0x30')]['count'](_0x1bf5bf)[_0x65f6('0x2a')](function(_0x3386a2){_0x24f7fd[_0x65f6('0x23')]=_0x3386a2;if(_0x5a740a[_0x65f6('0x34')]['includeAll']){_0x50494b[_0x65f6('0x42')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x65f6('0x43')](_0x50494b);})[_0x65f6('0x2a')](function(_0x577c93){_0x24f7fd[_0x65f6('0x44')]=_0x577c93;return _0x24f7fd;})['then'](respondWithFilteredResult(_0x2b403b,_0x50494b))[_0x65f6('0x45')](handleError(_0x2b403b,null));};exports[_0x65f6('0x46')]=function(_0x2d1706,_0xc0db01){var _0x3ec18f={'raw':![],'where':{'id':_0x2d1706['params']['id']}},_0x3837b2={};_0x3837b2['model']=_[_0x65f6('0x47')](db[_0x65f6('0x30')][_0x65f6('0x31')]);_0x3837b2[_0x65f6('0x34')]=_[_0x65f6('0x47')](_0x2d1706[_0x65f6('0x34')]);_0x3837b2[_0x65f6('0x3d')]=_[_0x65f6('0x36')](_0x3837b2[_0x65f6('0x33')],_0x3837b2['query']);_0x3ec18f[_0x65f6('0x35')]=_[_0x65f6('0x36')](_0x3837b2[_0x65f6('0x33')],qs['fields'](_0x2d1706[_0x65f6('0x34')][_0x65f6('0x37')]));_0x3ec18f['attributes']=_0x3ec18f[_0x65f6('0x35')][_0x65f6('0x48')]?_0x3ec18f['attributes']:_0x3837b2[_0x65f6('0x33')];if(_0x2d1706['query'][_0x65f6('0x49')]){_0x3ec18f[_0x65f6('0x42')]=[{'all':!![]}];}_0x3ec18f=_[_0x65f6('0x40')]({},_0x3ec18f,_0x2d1706['options']);return db[_0x65f6('0x30')][_0x65f6('0x4a')](_0x3ec18f)['then'](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x2a')](respondWithResult(_0xc0db01,null))[_0x65f6('0x45')](handleError(_0xc0db01,null));};exports['create']=function(_0x34d6a9,_0x344c0e){return db[_0x65f6('0x30')][_0x65f6('0x4b')](_0x34d6a9[_0x65f6('0x4c')],{})[_0x65f6('0x2a')](respondWithResult(_0x344c0e,0xc9))[_0x65f6('0x45')](handleError(_0x344c0e,null));};exports[_0x65f6('0x4d')]=function(_0x4f69d8,_0x52c5a4){if(_0x4f69d8['body']['id']){delete _0x4f69d8[_0x65f6('0x4c')]['id'];}return db[_0x65f6('0x30')][_0x65f6('0x4a')]({'where':{'id':_0x4f69d8[_0x65f6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x52c5a4,null))[_0x65f6('0x2a')](saveUpdates(_0x4f69d8[_0x65f6('0x4c')],null))[_0x65f6('0x2a')](respondWithResult(_0x52c5a4,null))['catch'](handleError(_0x52c5a4,null));};exports[_0x65f6('0x29')]=function(_0x2eb08f,_0x289f8f){return db['SalesforceAccount']['find']({'where':{'id':_0x2eb08f[_0x65f6('0x4e')]['id']}})[_0x65f6('0x2a')](handleEntityNotFound(_0x289f8f,null))[_0x65f6('0x2a')](removeEntity(_0x289f8f,null))[_0x65f6('0x45')](handleError(_0x289f8f,null));};exports[_0x65f6('0x4f')]=function(_0x3cf5fe,_0x35d77f,_0x138334){var _0x2d8b5b={};var _0xddbd90={};var _0xa7eee9;var _0x141fcc;return db[_0x65f6('0x30')][_0x65f6('0x50')]({'where':{'id':_0x3cf5fe['params']['id']}})[_0x65f6('0x2a')](handleEntityNotFound(_0x35d77f,null))[_0x65f6('0x2a')](function(_0x42a805){if(_0x42a805){_0xa7eee9=_0x42a805;_0xddbd90['model']=_[_0x65f6('0x47')](db[_0x65f6('0x51')][_0x65f6('0x31')]);_0xddbd90[_0x65f6('0x34')]=_['keys'](_0x3cf5fe[_0x65f6('0x34')]);_0xddbd90[_0x65f6('0x3d')]=_[_0x65f6('0x36')](_0xddbd90[_0x65f6('0x33')],_0xddbd90['query']);_0x2d8b5b[_0x65f6('0x35')]=_[_0x65f6('0x36')](_0xddbd90['model'],qs[_0x65f6('0x37')](_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x37')]));_0x2d8b5b['attributes']=_0x2d8b5b[_0x65f6('0x35')][_0x65f6('0x48')]?_0x2d8b5b[_0x65f6('0x35')]:_0xddbd90[_0x65f6('0x33')];_0x2d8b5b[_0x65f6('0x3a')]=qs[_0x65f6('0x3b')](_0x3cf5fe['query']['sort']);_0x2d8b5b['where']=qs[_0x65f6('0x3d')](_[_0x65f6('0x3e')](_0x3cf5fe[_0x65f6('0x34')],_0xddbd90[_0x65f6('0x3d')]));if(_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x3f')]){_0x2d8b5b['where']=_[_0x65f6('0x40')](_0x2d8b5b[_0x65f6('0x3c')],{'$or':_['map'](_0x2d8b5b[_0x65f6('0x35')],function(_0x39c244){var _0x477489={};_0x477489[_0x39c244]={'$like':'%'+_0x3cf5fe['query'][_0x65f6('0x3f')]+'%'};return _0x477489;})});}_0x2d8b5b=_[_0x65f6('0x40')]({},_0x2d8b5b,_0x3cf5fe['options']);return _0xa7eee9[_0x65f6('0x4f')](_0x2d8b5b);}})[_0x65f6('0x2a')](function(_0x1301f5){if(_0x1301f5){_0x141fcc=_0x1301f5[_0x65f6('0x48')];if(!_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x38')](_0x65f6('0x52'))){_0x2d8b5b['limit']=qs['limit'](_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x39')]);_0x2d8b5b['offset']=qs[_0x65f6('0x24')](_0x3cf5fe['query'][_0x65f6('0x24')]);}return _0xa7eee9['getConfigurations'](_0x2d8b5b);}})[_0x65f6('0x2a')](function(_0xdc8989){if(_0xdc8989){return _0xdc8989?{'count':_0x141fcc,'rows':_0xdc8989}:null;}})[_0x65f6('0x2a')](respondWithResult(_0x35d77f,null))[_0x65f6('0x45')](handleError(_0x35d77f,null));};exports[_0x65f6('0x53')]=function(_0x264e6c,_0x1aaf75,_0x1cc66a){if(_0x264e6c[_0x65f6('0x4c')]['id']){delete _0x264e6c['body']['id'];}return db['SalesforceAccount'][_0x65f6('0x50')]({'where':{'id':_0x264e6c[_0x65f6('0x4e')]['id']}})[_0x65f6('0x2a')](handleEntityNotFound(_0x1aaf75,null))['then'](function(_0x49cd14){if(_0x49cd14){_0x264e6c[_0x65f6('0x4c')][_0x65f6('0x54')]=_0x49cd14['id'];_0x264e6c[_0x65f6('0x4c')][_0x65f6('0x55')]=integrations[_0x65f6('0x56')](_0x264e6c[_0x65f6('0x4c')]['channel'],_0x264e6c['body'][_0x65f6('0x32')]);_0x264e6c[_0x65f6('0x4c')]['Descriptions']=integrations[_0x65f6('0x57')](_0x264e6c['body'][_0x65f6('0x58')],_0x264e6c[_0x65f6('0x4c')][_0x65f6('0x32')]);return db[_0x65f6('0x51')]['create'](_0x264e6c[_0x65f6('0x4c')],{'include':[{'model':db[_0x65f6('0x59')],'as':_0x65f6('0x55')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x65f6('0x2a')](respondWithResult(_0x1aaf75,null))['catch'](handleError(_0x1aaf75,null));};exports[_0x65f6('0x5a')]=function(_0xf6de,_0x7c856d,_0x354b90){var _0x512776;var _0x53e168='';var _0x56f7f1=_0x65f6('0x5b');return db[_0x65f6('0x30')][_0x65f6('0x50')]({'where':{'id':_0xf6de['params']['id']},'attributes':['id',_0x65f6('0x5c'),_0x65f6('0x5d'),_0x65f6('0x5e'),'username',_0x65f6('0x5f'),_0x65f6('0x60')]})['then'](handleEntityNotFound(_0x7c856d,null))[_0x65f6('0x2a')](function(_0x2f59f9){if(_0x2f59f9){_0x53e168=_0x2f59f9['remoteUri'];var _0x36baed=_0x53e168['slice'](-0x1);if(_0x36baed==='/'){_0x53e168=_0x53e168[_0x65f6('0x61')](0x0,_0x53e168['lastIndexOf'](_0x36baed));}_0x512776=new jsforce[(_0x65f6('0x62'))]({'oauth2':{'loginUrl':_0x53e168,'clientId':_0x2f59f9[_0x65f6('0x5d')],'clientSecret':_0x2f59f9['clientSecret']}});return _0x512776[_0x65f6('0x63')](_0x2f59f9[_0x65f6('0x64')],_0x2f59f9[_0x65f6('0x5f')][_0x65f6('0x65')](_0x2f59f9[_0x65f6('0x60')]));}})[_0x65f6('0x2a')](function(_0x46af9f){if(_0x46af9f){if(!_[_0x65f6('0x66')](_0xf6de[_0x65f6('0x34')][_0x65f6('0x67')])){_0x56f7f1=_0xf6de[_0x65f6('0x34')]['ticketType'];}return _0x512776[_0x65f6('0x68')](_0x56f7f1)[_0x65f6('0x69')]();}})[_0x65f6('0x2a')](function(_0x219e42){var _0x5694f9=[_0x65f6('0x6a'),_0x65f6('0x6b'),'CallObject',_0x65f6('0x6c'),'IsArchived',_0x65f6('0x6d'),'Status',_0x65f6('0x6e')];if(!_[_0x65f6('0x66')](_0xf6de['query']['ticketType'])&&_0xf6de[_0x65f6('0x34')][_0x65f6('0x67')]==='Case'){_0x5694f9=[_0x65f6('0x6e'),_0x65f6('0x6f'),_0x65f6('0x70'),'Status',_0x65f6('0x6d'),_0x65f6('0x71'),'SuppliedName',_0x65f6('0x72')];}if(_0x219e42){_['remove'](_0x219e42[_0x65f6('0x37')],function(_0x57eb49){return _0x57eb49['custom']===![]&&!_0x5694f9[_0x65f6('0x73')](_0x57eb49[_0x65f6('0x2d')]);});return{'count':_0x219e42[_0x65f6('0x37')][_0x65f6('0x48')],'rows':_[_0x65f6('0x2f')](_0x219e42[_0x65f6('0x37')],function(_0x1ac46f){return{'id':_0x1ac46f[_0x65f6('0x2d')],'name':_0x1ac46f['label'],'custom':_0x1ac46f['custom'],'options':_0x1ac46f[_0x65f6('0x74')]['length']>0x0?_[_0x65f6('0x2f')](_0x1ac46f[_0x65f6('0x74')],function(_0x21b5f2){return{'name':_0x21b5f2[_0x65f6('0x75')],'value':_0x21b5f2[_0x65f6('0x76')]};}):_0x1ac46f['type']==_0x65f6('0x77')?[{'name':_0x65f6('0x78'),'value':_0x65f6('0x79')},{'name':'False','value':_0x65f6('0x7a')}]:[]};})};}})[_0x65f6('0x2a')](respondWithResult(_0x7c856d,null))[_0x65f6('0x45')](function(_0x23180e){var _0x25a2a7=_0xf6de[_0x65f6('0x34')]['test']?0x1f4:_0x23180e['statusCode']||0x1f4;logger[_0x65f6('0x1c')](_0x65f6('0x7b'),_0x65f6('0x5a'),_0x25a2a7,JSON[_0x65f6('0x1b')](_0x23180e));delete _0x23180e['name'];if(_0x25a2a7===0x191){_0x25a2a7=0x190;}_0x7c856d['status'](_0x25a2a7)[_0x65f6('0x7c')](_0xf6de[_0x65f6('0x34')][_0x65f6('0x7d')]?{'message':_0x65f6('0x7e'),'statusCode':_0x23180e[_0x65f6('0x7f')]}:_0x23180e);});}; \ No newline at end of file +var _0xb62e=['keys','intersection','attributes','model','fields','length','order','where','filters','pick','filter','merge','VIRTUAL','options','catch','show','includeAll','include','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','sort','hasOwnProperty','nolimit','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Origin','Reason','SuppliedName','SuppliedCompany','includes','label','custom','picklistValues','boolean','true','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0xb62e,0x1de));var _0xeb62=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb62e[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var licenseUtil=require(_0xeb62('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1a'));var jayson=require(_0xeb62('0x1b'));var client=jayson[_0xeb62('0x1c')][_0xeb62('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x55a629,_0x333126,_0x2fbad2,_0x23fb15){return new BPromise(function(_0x4da178,_0x26c3fd){var _0x195837=_0x23fb15||client;return _0x195837[_0xeb62('0x1e')](_0x55a629,_0x2fbad2)['then'](function(_0x1f6a1f){logger[_0xeb62('0x1f')](_0xeb62('0x20'),_0x333126,_0xeb62('0x21'));logger[_0xeb62('0x22')](_0xeb62('0x23'),_0x333126,_0xeb62('0x21'),JSON[_0xeb62('0x24')](_0x1f6a1f));if(_0x1f6a1f[_0xeb62('0x25')]){if(_0x1f6a1f[_0xeb62('0x25')][_0xeb62('0x26')]===0x1f4){logger[_0xeb62('0x25')](_0xeb62('0x20'),_0x333126,_0x1f6a1f['error'][_0xeb62('0x27')]);return _0x26c3fd(_0x1f6a1f[_0xeb62('0x25')][_0xeb62('0x27')]);}logger[_0xeb62('0x25')](_0xeb62('0x20'),_0x333126,_0x1f6a1f[_0xeb62('0x25')][_0xeb62('0x27')]);return _0x4da178(_0x1f6a1f['error']['message']);}else{logger[_0xeb62('0x1f')](_0xeb62('0x20'),_0x333126,_0xeb62('0x21'));_0x4da178(_0x1f6a1f[_0xeb62('0x28')][_0xeb62('0x27')]);}})['catch'](function(_0x5e7aee){logger[_0xeb62('0x25')](_0xeb62('0x20'),_0x333126,_0x5e7aee);_0x26c3fd(_0x5e7aee);});});}function respondWithStatusCode(_0x182781,_0x395b70){_0x395b70=_0x395b70||0xcc;return function(_0x55a169){if(_0x55a169){return _0x182781['sendStatus'](_0x395b70);}return _0x182781[_0xeb62('0x29')](_0x395b70)['end']();};}function respondWithResult(_0x448327,_0x4b0f46){_0x4b0f46=_0x4b0f46||0xc8;return function(_0xfe3e16){if(_0xfe3e16){return _0x448327['status'](_0x4b0f46)[_0xeb62('0x2a')](_0xfe3e16);}};}function respondWithFilteredResult(_0x6bfbbc,_0x46d1bb){return function(_0x4e4268){if(_0x4e4268){var _0x3ef784=_0x4e4268[_0xeb62('0x2b')],_0x3ae031=_0x46d1bb[_0xeb62('0x2c')],_0x5222f4=_0x46d1bb['offset']+_0x46d1bb[_0xeb62('0x2d')],_0xe8872c;if(_0x5222f4>=_0x3ef784){_0x5222f4=_0x3ef784;_0xe8872c=0xc8;}else{_0xe8872c=0xce;}_0x6bfbbc[_0xeb62('0x29')](_0xe8872c);return _0x6bfbbc['set'](_0xeb62('0x2e'),_0x3ae031+'-'+_0x5222f4+'/'+_0x3ef784)[_0xeb62('0x2a')](_0x4e4268);}return null;};}function patchUpdates(_0x2c967c){return function(_0x2c308c){try{jsonpatch[_0xeb62('0x2f')](_0x2c308c,_0x2c967c,!![]);}catch(_0x5195bf){return BPromise['reject'](_0x5195bf);}return _0x2c308c[_0xeb62('0x30')]();};}function saveUpdates(_0x357cf4,_0x1607ef){return function(_0x3f89ed){if(_0x3f89ed){return _0x3f89ed[_0xeb62('0x31')](_0x357cf4)[_0xeb62('0x32')](function(_0x1ae51e){return _0x1ae51e;});}return null;};}function removeEntity(_0x4be25d,_0x411062){return function(_0x47a94b){if(_0x47a94b){return _0x47a94b['destroy']()[_0xeb62('0x32')](function(){_0x4be25d[_0xeb62('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ade38,_0x4bcfce){return function(_0x1c2195){if(!_0x1c2195){_0x1ade38[_0xeb62('0x33')](0x194);}return _0x1c2195;};}function handleError(_0x530587,_0x2c23c6){_0x2c23c6=_0x2c23c6||0x1f4;return function(_0xe2589){logger['error'](_0xe2589[_0xeb62('0x34')]);if(_0xe2589[_0xeb62('0x35')]){delete _0xe2589[_0xeb62('0x35')];}_0x530587[_0xeb62('0x29')](_0x2c23c6)['send'](_0xe2589);};}exports[_0xeb62('0x36')]=function(_0x43685b,_0x4cf6b0){var _0x4acc96={},_0x112cd7={},_0x117d8c={'count':0x0,'rows':[]};var _0x4e29a7=_[_0xeb62('0x37')](db[_0xeb62('0x38')][_0xeb62('0x39')],function(_0x1f839a){return{'name':_0x1f839a[_0xeb62('0x3a')],'type':_0x1f839a[_0xeb62('0x3b')][_0xeb62('0x3c')]};});_0x112cd7['model']=_['map'](_0x4e29a7,_0xeb62('0x35'));_0x112cd7[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x43685b[_0xeb62('0x3d')]);_0x112cd7['filters']=_[_0xeb62('0x3f')](_0x112cd7['model'],_0x112cd7[_0xeb62('0x3d')]);_0x4acc96[_0xeb62('0x40')]=_[_0xeb62('0x3f')](_0x112cd7[_0xeb62('0x41')],qs[_0xeb62('0x42')](_0x43685b[_0xeb62('0x3d')][_0xeb62('0x42')]));_0x4acc96[_0xeb62('0x40')]=_0x4acc96['attributes'][_0xeb62('0x43')]?_0x4acc96[_0xeb62('0x40')]:_0x112cd7[_0xeb62('0x41')];if(!_0x43685b[_0xeb62('0x3d')]['hasOwnProperty']('nolimit')){_0x4acc96[_0xeb62('0x2d')]=qs[_0xeb62('0x2d')](_0x43685b['query'][_0xeb62('0x2d')]);_0x4acc96[_0xeb62('0x2c')]=qs['offset'](_0x43685b[_0xeb62('0x3d')]['offset']);}_0x4acc96[_0xeb62('0x44')]=qs['sort'](_0x43685b[_0xeb62('0x3d')]['sort']);_0x4acc96[_0xeb62('0x45')]=qs[_0xeb62('0x46')](_[_0xeb62('0x47')](_0x43685b['query'],_0x112cd7['filters']),_0x4e29a7);if(_0x43685b[_0xeb62('0x3d')][_0xeb62('0x48')]){_0x4acc96[_0xeb62('0x45')]=_[_0xeb62('0x49')](_0x4acc96[_0xeb62('0x45')],{'$or':_['map'](_0x4e29a7,function(_0x29fdb8){if(_0x29fdb8['type']!==_0xeb62('0x4a')){var _0x4a34ce={};_0x4a34ce[_0x29fdb8[_0xeb62('0x35')]]={'$like':'%'+_0x43685b['query'][_0xeb62('0x48')]+'%'};return _0x4a34ce;}})});}_0x4acc96=_['merge']({},_0x4acc96,_0x43685b[_0xeb62('0x4b')]);var _0x4624e7={'where':_0x4acc96[_0xeb62('0x45')]};return db[_0xeb62('0x38')][_0xeb62('0x2b')](_0x4624e7)[_0xeb62('0x32')](function(_0x4e62eb){_0x117d8c[_0xeb62('0x2b')]=_0x4e62eb;if(_0x43685b[_0xeb62('0x3d')]['includeAll']){_0x4acc96['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x4acc96);})[_0xeb62('0x32')](function(_0x12562f){_0x117d8c['rows']=_0x12562f;return _0x117d8c;})[_0xeb62('0x32')](respondWithFilteredResult(_0x4cf6b0,_0x4acc96))[_0xeb62('0x4c')](handleError(_0x4cf6b0,null));};exports[_0xeb62('0x4d')]=function(_0x16e262,_0x39595c){var _0x555812={'raw':![],'where':{'id':_0x16e262['params']['id']}},_0xfb8cc7={};_0xfb8cc7[_0xeb62('0x41')]=_[_0xeb62('0x3e')](db[_0xeb62('0x38')][_0xeb62('0x39')]);_0xfb8cc7[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x16e262[_0xeb62('0x3d')]);_0xfb8cc7[_0xeb62('0x46')]=_[_0xeb62('0x3f')](_0xfb8cc7[_0xeb62('0x41')],_0xfb8cc7[_0xeb62('0x3d')]);_0x555812[_0xeb62('0x40')]=_['intersection'](_0xfb8cc7[_0xeb62('0x41')],qs['fields'](_0x16e262['query'][_0xeb62('0x42')]));_0x555812[_0xeb62('0x40')]=_0x555812['attributes'][_0xeb62('0x43')]?_0x555812[_0xeb62('0x40')]:_0xfb8cc7['model'];if(_0x16e262[_0xeb62('0x3d')][_0xeb62('0x4e')]){_0x555812[_0xeb62('0x4f')]=[{'all':!![]}];}_0x555812=_[_0xeb62('0x49')]({},_0x555812,_0x16e262[_0xeb62('0x4b')]);return db[_0xeb62('0x38')][_0xeb62('0x50')](_0x555812)[_0xeb62('0x32')](handleEntityNotFound(_0x39595c,null))['then'](respondWithResult(_0x39595c,null))[_0xeb62('0x4c')](handleError(_0x39595c,null));};exports['create']=function(_0x35a2d6,_0x39f88d){return db[_0xeb62('0x38')][_0xeb62('0x51')](_0x35a2d6[_0xeb62('0x52')],{})[_0xeb62('0x32')](respondWithResult(_0x39f88d,0xc9))[_0xeb62('0x4c')](handleError(_0x39f88d,null));};exports[_0xeb62('0x31')]=function(_0x595d58,_0x4d31a1){if(_0x595d58['body']['id']){delete _0x595d58['body']['id'];}return db[_0xeb62('0x38')]['find']({'where':{'id':_0x595d58[_0xeb62('0x53')]['id']}})['then'](handleEntityNotFound(_0x4d31a1,null))[_0xeb62('0x32')](saveUpdates(_0x595d58[_0xeb62('0x52')],null))[_0xeb62('0x32')](respondWithResult(_0x4d31a1,null))['catch'](handleError(_0x4d31a1,null));};exports[_0xeb62('0x54')]=function(_0x1486a6,_0x518dd4){return db[_0xeb62('0x38')][_0xeb62('0x50')]({'where':{'id':_0x1486a6[_0xeb62('0x53')]['id']}})[_0xeb62('0x32')](handleEntityNotFound(_0x518dd4,null))['then'](removeEntity(_0x518dd4,null))[_0xeb62('0x4c')](handleError(_0x518dd4,null));};exports[_0xeb62('0x55')]=function(_0x4cd99f,_0x2eba52,_0x5d1415){var _0x10b1ef={};var _0x466c3c={};var _0x3a450b;var _0x46da69;return db[_0xeb62('0x38')][_0xeb62('0x56')]({'where':{'id':_0x4cd99f[_0xeb62('0x53')]['id']}})[_0xeb62('0x32')](handleEntityNotFound(_0x2eba52,null))[_0xeb62('0x32')](function(_0x15c93f){if(_0x15c93f){_0x3a450b=_0x15c93f;_0x466c3c[_0xeb62('0x41')]=_[_0xeb62('0x3e')](db[_0xeb62('0x57')][_0xeb62('0x39')]);_0x466c3c['query']=_['keys'](_0x4cd99f['query']);_0x466c3c['filters']=_[_0xeb62('0x3f')](_0x466c3c['model'],_0x466c3c[_0xeb62('0x3d')]);_0x10b1ef[_0xeb62('0x40')]=_[_0xeb62('0x3f')](_0x466c3c[_0xeb62('0x41')],qs[_0xeb62('0x42')](_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x42')]));_0x10b1ef[_0xeb62('0x40')]=_0x10b1ef[_0xeb62('0x40')][_0xeb62('0x43')]?_0x10b1ef['attributes']:_0x466c3c[_0xeb62('0x41')];_0x10b1ef[_0xeb62('0x44')]=qs[_0xeb62('0x58')](_0x4cd99f[_0xeb62('0x3d')]['sort']);_0x10b1ef[_0xeb62('0x45')]=qs[_0xeb62('0x46')](_[_0xeb62('0x47')](_0x4cd99f[_0xeb62('0x3d')],_0x466c3c[_0xeb62('0x46')]));if(_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x48')]){_0x10b1ef[_0xeb62('0x45')]=_[_0xeb62('0x49')](_0x10b1ef[_0xeb62('0x45')],{'$or':_[_0xeb62('0x37')](_0x10b1ef['attributes'],function(_0x110224){var _0x33419f={};_0x33419f[_0x110224]={'$like':'%'+_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x48')]+'%'};return _0x33419f;})});}_0x10b1ef=_[_0xeb62('0x49')]({},_0x10b1ef,_0x4cd99f[_0xeb62('0x4b')]);return _0x3a450b[_0xeb62('0x55')](_0x10b1ef);}})[_0xeb62('0x32')](function(_0x1183f4){if(_0x1183f4){_0x46da69=_0x1183f4[_0xeb62('0x43')];if(!_0x4cd99f['query'][_0xeb62('0x59')](_0xeb62('0x5a'))){_0x10b1ef[_0xeb62('0x2d')]=qs[_0xeb62('0x2d')](_0x4cd99f['query'][_0xeb62('0x2d')]);_0x10b1ef[_0xeb62('0x2c')]=qs[_0xeb62('0x2c')](_0x4cd99f[_0xeb62('0x3d')][_0xeb62('0x2c')]);}return _0x3a450b[_0xeb62('0x55')](_0x10b1ef);}})['then'](function(_0x18a348){if(_0x18a348){return _0x18a348?{'count':_0x46da69,'rows':_0x18a348}:null;}})[_0xeb62('0x32')](respondWithResult(_0x2eba52,null))[_0xeb62('0x4c')](handleError(_0x2eba52,null));};exports[_0xeb62('0x5b')]=function(_0x351acf,_0x28d0ff,_0x2e4502){if(_0x351acf[_0xeb62('0x52')]['id']){delete _0x351acf[_0xeb62('0x52')]['id'];}return db[_0xeb62('0x38')][_0xeb62('0x56')]({'where':{'id':_0x351acf[_0xeb62('0x53')]['id']}})[_0xeb62('0x32')](handleEntityNotFound(_0x28d0ff,null))[_0xeb62('0x32')](function(_0xddc862){if(_0xddc862){_0x351acf[_0xeb62('0x52')]['AccountId']=_0xddc862['id'];_0x351acf[_0xeb62('0x52')]['Subjects']=integrations[_0xeb62('0x5c')](_0x351acf[_0xeb62('0x52')]['channel'],_0x351acf[_0xeb62('0x52')][_0xeb62('0x3b')]);_0x351acf[_0xeb62('0x52')][_0xeb62('0x5d')]=integrations[_0xeb62('0x5e')](_0x351acf[_0xeb62('0x52')][_0xeb62('0x5f')],_0x351acf[_0xeb62('0x52')][_0xeb62('0x3b')]);return db[_0xeb62('0x57')][_0xeb62('0x51')](_0x351acf[_0xeb62('0x52')],{'include':[{'model':db[_0xeb62('0x60')],'as':'Subjects'},{'model':db[_0xeb62('0x60')],'as':_0xeb62('0x5d')}]});}return null;})['then'](respondWithResult(_0x28d0ff,null))[_0xeb62('0x4c')](handleError(_0x28d0ff,null));};exports['getFields']=function(_0x32679a,_0x13678d,_0x34e2d1){var _0x10dee9;var _0x44f90e='';var _0x33fbda='Task';return db[_0xeb62('0x38')]['findOne']({'where':{'id':_0x32679a[_0xeb62('0x53')]['id']},'attributes':['id',_0xeb62('0x61'),_0xeb62('0x62'),_0xeb62('0x63'),_0xeb62('0x64'),'password',_0xeb62('0x65')]})[_0xeb62('0x32')](handleEntityNotFound(_0x13678d,null))[_0xeb62('0x32')](function(_0x51c237){if(_0x51c237){_0x44f90e=_0x51c237[_0xeb62('0x61')];var _0x3ad496=_0x44f90e[_0xeb62('0x66')](-0x1);if(_0x3ad496==='/'){_0x44f90e=_0x44f90e[_0xeb62('0x67')](0x0,_0x44f90e[_0xeb62('0x68')](_0x3ad496));}_0x10dee9=new jsforce[(_0xeb62('0x69'))]({'oauth2':{'loginUrl':_0x44f90e,'clientId':_0x51c237['clientId'],'clientSecret':_0x51c237['clientSecret']}});return _0x10dee9['login'](_0x51c237['username'],_0x51c237['password'][_0xeb62('0x6a')](_0x51c237[_0xeb62('0x65')]));}})[_0xeb62('0x32')](function(_0x18ebb6){if(_0x18ebb6){if(!_[_0xeb62('0x6b')](_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')])){_0x33fbda=_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')];}return _0x10dee9[_0xeb62('0x6d')](_0x33fbda)[_0xeb62('0x6e')]();}})[_0xeb62('0x32')](function(_0x491d2d){var _0x71c47b=[_0xeb62('0x6f'),_0xeb62('0x70'),_0xeb62('0x71'),_0xeb62('0x72'),_0xeb62('0x73'),_0xeb62('0x74'),_0xeb62('0x75'),_0xeb62('0x76')];if(!_[_0xeb62('0x6b')](_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')])&&_0x32679a[_0xeb62('0x3d')][_0xeb62('0x6c')]===_0xeb62('0x77')){_0x71c47b=[_0xeb62('0x76'),_0xeb62('0x78'),_0xeb62('0x79'),'Status',_0xeb62('0x74'),'IsEscalated',_0xeb62('0x7a'),_0xeb62('0x7b')];}if(_0x491d2d){_['remove'](_0x491d2d[_0xeb62('0x42')],function(_0x4e3c6c){return _0x4e3c6c['custom']===![]&&!_0x71c47b[_0xeb62('0x7c')](_0x4e3c6c[_0xeb62('0x35')]);});return{'count':_0x491d2d[_0xeb62('0x42')][_0xeb62('0x43')],'rows':_['map'](_0x491d2d[_0xeb62('0x42')],function(_0x252410){return{'id':_0x252410['name'],'name':_0x252410[_0xeb62('0x7d')],'custom':_0x252410[_0xeb62('0x7e')],'options':_0x252410[_0xeb62('0x7f')][_0xeb62('0x43')]>0x0?_[_0xeb62('0x37')](_0x252410[_0xeb62('0x7f')],function(_0x119f9c){return{'name':_0x119f9c[_0xeb62('0x7d')],'value':_0x119f9c['value']};}):_0x252410[_0xeb62('0x3b')]==_0xeb62('0x80')?[{'name':'True','value':_0xeb62('0x81')},{'name':'False','value':'false'}]:[]};})};}})[_0xeb62('0x32')](respondWithResult(_0x13678d,null))[_0xeb62('0x4c')](function(_0x45a1d2){var _0x43b4f3=_0x32679a[_0xeb62('0x3d')]['test']?0x1f4:_0x45a1d2[_0xeb62('0x82')]||0x1f4;logger[_0xeb62('0x25')](_0xeb62('0x83'),_0xeb62('0x84'),_0x43b4f3,JSON[_0xeb62('0x24')](_0x45a1d2));delete _0x45a1d2[_0xeb62('0x35')];if(_0x43b4f3===0x191){_0x43b4f3=0x190;}_0x13678d[_0xeb62('0x29')](_0x43b4f3)[_0xeb62('0x85')](_0x32679a['query']['test']?{'message':_0xeb62('0x86'),'statusCode':_0x45a1d2[_0xeb62('0x82')]}:_0x45a1d2);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 71f0a73..98f5aad 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 _0x4c16=['api','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x5b161d,_0x17f33a){var _0x54be10=function(_0x399428){while(--_0x399428){_0x5b161d['push'](_0x5b161d['shift']());}};_0x54be10(++_0x17f33a);}(_0x4c16,0x17e));var _0x64c1=function(_0x4b5409,_0x472b71){_0x4b5409=_0x4b5409-0x0;var _0x90b623=_0x4c16[_0x4b5409];return _0x90b623;};'use strict';var _=require(_0x64c1('0x0'));var util=require(_0x64c1('0x1'));var logger=require(_0x64c1('0x2'))(_0x64c1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x64c1('0x4'));var rimraf=require(_0x64c1('0x5'));var config=require(_0x64c1('0x6'));var attributes=require(_0x64c1('0x7'));var integrations=require(_0x64c1('0x8'));module['exports']=function(_0x48e951,_0x302602){return _0x48e951['define'](_0x64c1('0x9'),attributes,{'tableName':_0x64c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fc5=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x523f32,_0x42594a){var _0x183aba=function(_0x1ae751){while(--_0x1ae751){_0x523f32['push'](_0x523f32['shift']());}};_0x183aba(++_0x42594a);}(_0x1fc5,0x189));var _0x51fc=function(_0x359099,_0x3f911d){_0x359099=_0x359099-0x0;var _0xf3478=_0x1fc5[_0x359099];return _0xf3478;};'use strict';var _=require(_0x51fc('0x0'));var util=require(_0x51fc('0x1'));var logger=require(_0x51fc('0x2'))(_0x51fc('0x3'));var moment=require('moment');var BPromise=require(_0x51fc('0x4'));var rp=require(_0x51fc('0x5'));var fs=require('fs');var path=require(_0x51fc('0x6'));var rimraf=require(_0x51fc('0x7'));var config=require(_0x51fc('0x8'));var attributes=require(_0x51fc('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3e6693,_0xc2c4e7){return _0x3e6693['define'](_0x51fc('0xa'),attributes,{'tableName':_0x51fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 590a78a..b499e65 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 _0x984b=['catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','find','ShowSalesforceAccount','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x109cad,_0x2292a9){var _0x180f60=function(_0x3dd44b){while(--_0x3dd44b){_0x109cad['push'](_0x109cad['shift']());}};_0x180f60(++_0x2292a9);}(_0x984b,0xee));var _0xb984=function(_0x566eac,_0x3d4b48){_0x566eac=_0x566eac-0x0;var _0x1da507=_0x984b[_0x566eac];return _0x1da507;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['GetSalesforceAccount']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')]({'raw':_0x396c36['options']?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![],'where':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x18')]||null:null,'limit':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x19')]||null:null,'include':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x396c36[_0xb984('0x15')][_0xb984('0x1a')],function(_0x52c581){return{'model':db[_0x52c581[_0xb984('0x1c')]],'as':_0x52c581['as'],'attributes':_0x52c581[_0xb984('0x18')],'include':_0x52c581[_0xb984('0x1a')]?_['map'](_0x52c581[_0xb984('0x1a')],function(_0x2e806e){return{'model':db[_0x2e806e[_0xb984('0x1c')]],'as':_0x2e806e['as'],'attributes':_0x2e806e[_0xb984('0x18')],'include':_0x2e806e[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x2e806e[_0xb984('0x1a')],function(_0x4b3da0){return{'model':db[_0x4b3da0['model']],'as':_0x4b3da0['as'],'attributes':_0x4b3da0[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb984('0x7')](function(_0x3e254b){logger[_0xb984('0x8')]('GetSalesforceAccount',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x1d'),_0x396c36,JSON[_0xb984('0xd')](_0x3e254b));_0x3a5c96(_0x3e254b);})['catch'](function(_0x363e33){logger[_0xb984('0xe')](_0xb984('0x1d'),_0x363e33[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75['error'](0x1f4,_0x363e33['message']));});});};exports['ShowSalesforceAccount']=function(_0x10b9ac){var _0x23ecf6=this;return new Promise(function(_0x58a98c,_0x320bef){return db[_0xb984('0x13')][_0xb984('0x1e')]({'raw':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options'][_0xb984('0x18')]||null:null,'include':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x10b9ac[_0xb984('0x15')]['include'],function(_0x54a293){return{'model':db[_0x54a293[_0xb984('0x1c')]],'as':_0x54a293['as'],'attributes':_0x54a293[_0xb984('0x18')],'include':_0x54a293[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x54a293[_0xb984('0x1a')],function(_0x55dc81){return{'model':db[_0x55dc81[_0xb984('0x1c')]],'as':_0x55dc81['as'],'attributes':_0x55dc81[_0xb984('0x18')],'include':_0x55dc81['include']?_['map'](_0x55dc81[_0xb984('0x1a')],function(_0x4a440d){return{'model':db[_0x4a440d[_0xb984('0x1c')]],'as':_0x4a440d['as'],'attributes':_0x4a440d[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349db9){logger['info'](_0xb984('0x1f'),_0x10b9ac);logger['debug'](_0xb984('0x1f'),_0x10b9ac,JSON['stringify'](_0x349db9));_0x58a98c(_0x349db9);})['catch'](function(_0xf6d925){logger[_0xb984('0xe')]('ShowSalesforceAccount',_0xf6d925[_0xb984('0x10')],_0x10b9ac);_0x320bef(_0x23ecf6[_0xb984('0xe')](0x1f4,_0xf6d925['message']));});});}; \ No newline at end of file +var _0x222f=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','debug','find','where','ShowSalesforceAccount'];(function(_0x260ce2,_0x2e22b8){var _0x16b105=function(_0x260a06){while(--_0x260a06){_0x260ce2['push'](_0x260ce2['shift']());}};_0x16b105(++_0x2e22b8);}(_0x222f,0x1a4));var _0xf222=function(_0x9b14ee,_0x574340){_0x9b14ee=_0x9b14ee-0x0;var _0xc3fa3c=_0x222f[_0x9b14ee];return _0xc3fa3c;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});}exports[_0xf222('0x16')]=function(_0x8783ab){var _0xfb4ddf=this;return new Promise(function(_0x12a2e4,_0x1e57ee){return db[_0xf222('0x17')]['findAll']({'raw':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x8783ab[_0xf222('0x18')]?_0x8783ab['options']['where']||null:null,'attributes':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'limit':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1b')]||null:null,'include':_0x8783ab['options']?_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')],function(_0x2d18ab){return{'model':db[_0x2d18ab[_0xf222('0x1e')]],'as':_0x2d18ab['as'],'attributes':_0x2d18ab[_0xf222('0x1a')],'include':_0x2d18ab['include']?_[_0xf222('0x1d')](_0x2d18ab[_0xf222('0x1c')],function(_0x1883c1){return{'model':db[_0x1883c1[_0xf222('0x1e')]],'as':_0x1883c1['as'],'attributes':_0x1883c1[_0xf222('0x1a')],'include':_0x1883c1[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x1883c1[_0xf222('0x1c')],function(_0x15bf4e){return{'model':db[_0x15bf4e[_0xf222('0x1e')]],'as':_0x15bf4e['as'],'attributes':_0x15bf4e[_0xf222('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b2b1){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1f')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x14b2b1));_0x12a2e4(_0x14b2b1);})[_0xf222('0x15')](function(_0x1b928b){logger[_0xf222('0x11')]('GetSalesforceAccount',_0x1b928b[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x1b928b[_0xf222('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x3ccc9e){var _0x5d5963=this;return new Promise(function(_0x40c7e7,_0x27a8cc){return db[_0xf222('0x17')][_0xf222('0x20')]({'raw':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x3ccc9e['options']?_0x3ccc9e['options'][_0xf222('0x21')]||null:null,'attributes':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'include':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')]['include']?_[_0xf222('0x1d')](_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1c')],function(_0x57c862){return{'model':db[_0x57c862[_0xf222('0x1e')]],'as':_0x57c862['as'],'attributes':_0x57c862[_0xf222('0x1a')],'include':_0x57c862[_0xf222('0x1c')]?_['map'](_0x57c862[_0xf222('0x1c')],function(_0x21e20a){return{'model':db[_0x21e20a[_0xf222('0x1e')]],'as':_0x21e20a['as'],'attributes':_0x21e20a['attributes'],'include':_0x21e20a[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x21e20a[_0xf222('0x1c')],function(_0x2b838c){return{'model':db[_0x2b838c[_0xf222('0x1e')]],'as':_0x2b838c['as'],'attributes':_0x2b838c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf222('0xb')](function(_0x542123){logger[_0xf222('0xc')](_0xf222('0x22'),_0x3ccc9e);logger[_0xf222('0x1f')]('ShowSalesforceAccount',_0x3ccc9e,JSON[_0xf222('0x10')](_0x542123));_0x40c7e7(_0x542123);})[_0xf222('0x15')](function(_0x54a10d){logger[_0xf222('0x11')]('ShowSalesforceAccount',_0x54a10d[_0xf222('0x13')],_0x3ccc9e);_0x27a8cc(_0x5d5963[_0xf222('0x11')](0x1f4,_0x54a10d[_0xf222('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index fa9fc79..8ed8ec6 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 _0xf65d=['index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf65d,0xf1));var _0xdf65=function(_0x45f2e1,_0x48b816){_0x45f2e1=_0x45f2e1-0x0;var _0x461542=_0xf65d[_0x45f2e1];return _0x461542;};'use strict';var multer=require(_0xdf65('0x0'));var util=require(_0xdf65('0x1'));var path=require(_0xdf65('0x2'));var timeout=require(_0xdf65('0x3'));var express=require(_0xdf65('0x4'));var router=express[_0xdf65('0x5')]();var auth=require(_0xdf65('0x6'));var interaction=require(_0xdf65('0x7'));var config=require(_0xdf65('0x8'));var controller=require(_0xdf65('0x9'));router[_0xdf65('0xa')]('/',auth[_0xdf65('0xb')](),controller[_0xdf65('0xc')]);router[_0xdf65('0xa')]('/:id',auth[_0xdf65('0xb')](),controller[_0xdf65('0xd')]);router['get'](_0xdf65('0xe'),auth[_0xdf65('0xb')](),controller['getFields']);router[_0xdf65('0xa')](_0xdf65('0xf'),auth[_0xdf65('0xb')](),controller[_0xdf65('0x10')]);router['get']('/:id/descriptions',auth[_0xdf65('0xb')](),controller[_0xdf65('0x11')]);router[_0xdf65('0x12')]('/',auth[_0xdf65('0xb')](),controller[_0xdf65('0x13')]);router[_0xdf65('0x14')](_0xdf65('0x15'),auth[_0xdf65('0xb')](),controller['update']);router[_0xdf65('0x16')](_0xdf65('0x15'),auth[_0xdf65('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0d4f=['getDescriptions','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x18d7fc,_0x5c9ab1){var _0x58214b=function(_0x42e5b1){while(--_0x42e5b1){_0x18d7fc['push'](_0x18d7fc['shift']());}};_0x58214b(++_0x5c9ab1);}(_0x0d4f,0x150));var _0xf0d4=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x0d4f[_0x521929];return _0x632436;};'use strict';var multer=require(_0xf0d4('0x0'));var util=require(_0xf0d4('0x1'));var path=require(_0xf0d4('0x2'));var timeout=require(_0xf0d4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xf0d4('0x4'));var interaction=require(_0xf0d4('0x5'));var config=require('../../config/environment');var controller=require(_0xf0d4('0x6'));router['get']('/',auth[_0xf0d4('0x7')](),controller['index']);router[_0xf0d4('0x8')](_0xf0d4('0x9'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0xa')]);router[_0xf0d4('0x8')](_0xf0d4('0xb'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0xc')]);router[_0xf0d4('0x8')](_0xf0d4('0xd'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0xe')]);router[_0xf0d4('0x8')](_0xf0d4('0xf'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0x10')]);router['post']('/',auth[_0xf0d4('0x7')](),controller[_0xf0d4('0x11')]);router[_0xf0d4('0x12')](_0xf0d4('0x9'),auth[_0xf0d4('0x7')](),controller[_0xf0d4('0x13')]);router[_0xf0d4('0x14')](_0xf0d4('0x9'),auth['isAuthenticated'](),controller[_0xf0d4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 94e0291..645b44f 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 _0xe22f=['ENUM','Task','Case','contact_lead','lead','sequelize','STRING'];(function(_0x1effbd,_0x4a0608){var _0x41f256=function(_0x1b8b9d){while(--_0x1b8b9d){_0x1effbd['push'](_0x1effbd['shift']());}};_0x41f256(++_0x4a0608);}(_0xe22f,0x83));var _0xfe22=function(_0x1881f2,_0x1c16ac){_0x1881f2=_0x1881f2-0x0;var _0x282338=_0xe22f[_0x1881f2];return _0x282338;};'use strict';var Sequelize=require(_0xfe22('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe22('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xfe22('0x2')](_0xfe22('0x3'),_0xfe22('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xfe22('0x2')](_0xfe22('0x5'),'contact',_0xfe22('0x6')),'defaultValue':_0xfe22('0x5')},'moduleCreate':{'type':Sequelize[_0xfe22('0x2')]('nothing','contact',_0xfe22('0x6')),'defaultValue':_0xfe22('0x6')}}; \ No newline at end of file +var _0x38b8=['ENUM','Task','Case','contact_lead','contact','lead','sequelize','exports','STRING'];(function(_0x2880d8,_0x284ded){var _0x51f5a9=function(_0xafd747){while(--_0xafd747){_0x2880d8['push'](_0x2880d8['shift']());}};_0x51f5a9(++_0x284ded);}(_0x38b8,0x1d1));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x838b('0x0'));module[_0x838b('0x1')]={'name':{'type':Sequelize[_0x838b('0x2')]},'description':{'type':Sequelize[_0x838b('0x2')]},'ticketType':{'type':Sequelize[_0x838b('0x3')](_0x838b('0x4'),_0x838b('0x5')),'defaultValue':_0x838b('0x4')},'moduleSearch':{'type':Sequelize[_0x838b('0x3')](_0x838b('0x6'),_0x838b('0x7'),_0x838b('0x8')),'defaultValue':_0x838b('0x6')},'moduleCreate':{'type':Sequelize[_0x838b('0x3')]('nothing','contact',_0x838b('0x8')),'defaultValue':_0x838b('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index cfc0b1d..863591a 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 _0xb23a=['key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','type','VIRTUAL','where','includeAll','include','SalesforceConfiguration','findAll','rows','show','find','create','body','params','getFields','findOne','SalesforceField','pick','filter','options','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','destroy','end','stack','name','send','index','map','rawAttributes'];(function(_0x39553d,_0x4089ad){var _0x1a3d4c=function(_0x1c4658){while(--_0x1c4658){_0x39553d['push'](_0x39553d['shift']());}};_0x1a3d4c(++_0x4089ad);}(_0xb23a,0xd3));var _0xab23=function(_0x1b2432,_0x4780c2){_0x1b2432=_0x1b2432-0x0;var _0x4ef4f5=_0xb23a[_0x1b2432];return _0x4ef4f5;};'use strict';var pdf=require(_0xab23('0x0'));var emlformat=require(_0xab23('0x1'));var rimraf=require(_0xab23('0x2'));var zipdir=require(_0xab23('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab23('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab23('0x5'));var path=require(_0xab23('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab23('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab23('0x8'));var crypto=require(_0xab23('0x9'));var jsforce=require(_0xab23('0xa'));var deskjs=require(_0xab23('0xb'));var toCsv=require(_0xab23('0xc'));var querystring=require('querystring');var Papa=require(_0xab23('0xd'));var Redis=require(_0xab23('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xab23('0xf'));var as=require(_0xab23('0x10'));var hardwareService=require(_0xab23('0x11'));var logger=require(_0xab23('0x12'))('api');var utils=require(_0xab23('0x13'));var config=require(_0xab23('0x14'));var licenseUtil=require(_0xab23('0x15'));var db=require(_0xab23('0x16'))['db'];var jayson=require(_0xab23('0x17'));var client=jayson[_0xab23('0x18')][_0xab23('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x424f42,_0x3e600c,_0x4625a0,_0x2a767a){return new BPromise(function(_0x1a857a,_0x5208d0){var _0x353f56=_0x2a767a||client;return _0x353f56['request'](_0x424f42,_0x4625a0)[_0xab23('0x1a')](function(_0x226d0a){logger[_0xab23('0x1b')](_0xab23('0x1c'),_0x3e600c,_0xab23('0x1d'));logger[_0xab23('0x1e')](_0xab23('0x1f'),_0x3e600c,_0xab23('0x1d'),JSON['stringify'](_0x226d0a));if(_0x226d0a['error']){if(_0x226d0a[_0xab23('0x20')][_0xab23('0x21')]===0x1f4){logger[_0xab23('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e600c,_0x226d0a[_0xab23('0x20')]['message']);return _0x5208d0(_0x226d0a[_0xab23('0x20')]['message']);}logger[_0xab23('0x20')](_0xab23('0x1c'),_0x3e600c,_0x226d0a[_0xab23('0x20')][_0xab23('0x22')]);return _0x1a857a(_0x226d0a[_0xab23('0x20')][_0xab23('0x22')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3e600c,_0xab23('0x1d'));_0x1a857a(_0x226d0a['result'][_0xab23('0x22')]);}})[_0xab23('0x23')](function(_0x1af069){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3e600c,_0x1af069);_0x5208d0(_0x1af069);});});}function respondWithStatusCode(_0x569d7f,_0x3889a8){_0x3889a8=_0x3889a8||0xcc;return function(_0x42fa5c){if(_0x42fa5c){return _0x569d7f[_0xab23('0x24')](_0x3889a8);}return _0x569d7f[_0xab23('0x25')](_0x3889a8)['end']();};}function respondWithResult(_0x19f522,_0x449c2a){_0x449c2a=_0x449c2a||0xc8;return function(_0x19b4e9){if(_0x19b4e9){return _0x19f522[_0xab23('0x25')](_0x449c2a)[_0xab23('0x26')](_0x19b4e9);}};}function respondWithFilteredResult(_0x23474c,_0x160b38){return function(_0x110b9a){if(_0x110b9a){var _0x230fa0=_0x110b9a[_0xab23('0x27')],_0x28ace5=_0x160b38[_0xab23('0x28')],_0x10ecd2=_0x160b38['offset']+_0x160b38[_0xab23('0x29')],_0x4439d8;if(_0x10ecd2>=_0x230fa0){_0x10ecd2=_0x230fa0;_0x4439d8=0xc8;}else{_0x4439d8=0xce;}_0x23474c[_0xab23('0x25')](_0x4439d8);return _0x23474c['set'](_0xab23('0x2a'),_0x28ace5+'-'+_0x10ecd2+'/'+_0x230fa0)[_0xab23('0x26')](_0x110b9a);}return null;};}function patchUpdates(_0x25cc16){return function(_0x532f8a){try{jsonpatch['apply'](_0x532f8a,_0x25cc16,!![]);}catch(_0x4e5db6){return BPromise[_0xab23('0x2b')](_0x4e5db6);}return _0x532f8a[_0xab23('0x2c')]();};}function saveUpdates(_0x5cebfc,_0x5badb1){return function(_0x44c837){if(_0x44c837){return _0x44c837['update'](_0x5cebfc)[_0xab23('0x1a')](function(_0x8a1680){return _0x8a1680;});}return null;};}function removeEntity(_0x1fcedb,_0x1ff08f){return function(_0x16a4ca){if(_0x16a4ca){return _0x16a4ca[_0xab23('0x2d')]()[_0xab23('0x1a')](function(){_0x1fcedb[_0xab23('0x25')](0xcc)[_0xab23('0x2e')]();});}};}function handleEntityNotFound(_0x124ec4,_0x473f30){return function(_0x29d200){if(!_0x29d200){_0x124ec4[_0xab23('0x24')](0x194);}return _0x29d200;};}function handleError(_0x46b686,_0x4989e8){_0x4989e8=_0x4989e8||0x1f4;return function(_0x2961d8){logger[_0xab23('0x20')](_0x2961d8[_0xab23('0x2f')]);if(_0x2961d8[_0xab23('0x30')]){delete _0x2961d8['name'];}_0x46b686[_0xab23('0x25')](_0x4989e8)[_0xab23('0x31')](_0x2961d8);};}exports[_0xab23('0x32')]=function(_0x3557d5,_0x2c72e9){var _0x105f23={},_0x8d436e={},_0x2c0a84={'count':0x0,'rows':[]};var _0x5a9dc4=_[_0xab23('0x33')](db['SalesforceConfiguration'][_0xab23('0x34')],function(_0x3a7079){return{'name':_0x3a7079['fieldName'],'type':_0x3a7079['type'][_0xab23('0x35')]};});_0x8d436e['model']=_[_0xab23('0x33')](_0x5a9dc4,'name');_0x8d436e[_0xab23('0x36')]=_[_0xab23('0x37')](_0x3557d5[_0xab23('0x36')]);_0x8d436e[_0xab23('0x38')]=_[_0xab23('0x39')](_0x8d436e['model'],_0x8d436e[_0xab23('0x36')]);_0x105f23['attributes']=_[_0xab23('0x39')](_0x8d436e[_0xab23('0x3a')],qs[_0xab23('0x3b')](_0x3557d5[_0xab23('0x36')]['fields']));_0x105f23[_0xab23('0x3c')]=_0x105f23[_0xab23('0x3c')][_0xab23('0x3d')]?_0x105f23[_0xab23('0x3c')]:_0x8d436e[_0xab23('0x3a')];if(!_0x3557d5[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x105f23[_0xab23('0x29')]=qs['limit'](_0x3557d5[_0xab23('0x36')][_0xab23('0x29')]);_0x105f23[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x3557d5[_0xab23('0x36')][_0xab23('0x28')]);}_0x105f23[_0xab23('0x40')]=qs['sort'](_0x3557d5[_0xab23('0x36')][_0xab23('0x41')]);_0x105f23['where']=qs[_0xab23('0x38')](_['pick'](_0x3557d5[_0xab23('0x36')],_0x8d436e['filters']),_0x5a9dc4);if(_0x3557d5[_0xab23('0x36')]['filter']){_0x105f23['where']=_[_0xab23('0x42')](_0x105f23['where'],{'$or':_[_0xab23('0x33')](_0x5a9dc4,function(_0x1380d8){if(_0x1380d8[_0xab23('0x43')]!==_0xab23('0x44')){var _0x2c6703={};_0x2c6703[_0x1380d8[_0xab23('0x30')]]={'$like':'%'+_0x3557d5['query']['filter']+'%'};return _0x2c6703;}})});}_0x105f23=_['merge']({},_0x105f23,_0x3557d5['options']);var _0x271e14={'where':_0x105f23[_0xab23('0x45')]};return db['SalesforceConfiguration'][_0xab23('0x27')](_0x271e14)[_0xab23('0x1a')](function(_0x4e05c7){_0x2c0a84[_0xab23('0x27')]=_0x4e05c7;if(_0x3557d5['query'][_0xab23('0x46')]){_0x105f23[_0xab23('0x47')]=[{'all':!![]}];}return db[_0xab23('0x48')][_0xab23('0x49')](_0x105f23);})[_0xab23('0x1a')](function(_0x2a6324){_0x2c0a84[_0xab23('0x4a')]=_0x2a6324;return _0x2c0a84;})[_0xab23('0x1a')](respondWithFilteredResult(_0x2c72e9,_0x105f23))[_0xab23('0x23')](handleError(_0x2c72e9,null));};exports[_0xab23('0x4b')]=function(_0x1c0ede,_0x2dee35){var _0x208e54={'raw':![],'where':{'id':_0x1c0ede['params']['id']}},_0x232c87={};_0x232c87[_0xab23('0x3a')]=_[_0xab23('0x37')](db[_0xab23('0x48')][_0xab23('0x34')]);_0x232c87[_0xab23('0x36')]=_[_0xab23('0x37')](_0x1c0ede[_0xab23('0x36')]);_0x232c87[_0xab23('0x38')]=_['intersection'](_0x232c87[_0xab23('0x3a')],_0x232c87[_0xab23('0x36')]);_0x208e54[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x232c87[_0xab23('0x3a')],qs[_0xab23('0x3b')](_0x1c0ede[_0xab23('0x36')]['fields']));_0x208e54[_0xab23('0x3c')]=_0x208e54[_0xab23('0x3c')][_0xab23('0x3d')]?_0x208e54[_0xab23('0x3c')]:_0x232c87[_0xab23('0x3a')];if(_0x1c0ede[_0xab23('0x36')][_0xab23('0x46')]){_0x208e54[_0xab23('0x47')]=[{'all':!![]}];}_0x208e54=_[_0xab23('0x42')]({},_0x208e54,_0x1c0ede['options']);return db[_0xab23('0x48')][_0xab23('0x4c')](_0x208e54)[_0xab23('0x1a')](handleEntityNotFound(_0x2dee35,null))[_0xab23('0x1a')](respondWithResult(_0x2dee35,null))[_0xab23('0x23')](handleError(_0x2dee35,null));};exports[_0xab23('0x4d')]=function(_0x121b11,_0x1beaeb){return db[_0xab23('0x48')]['create'](_0x121b11['body'],{})[_0xab23('0x1a')](respondWithResult(_0x1beaeb,0xc9))[_0xab23('0x23')](handleError(_0x1beaeb,null));};exports['update']=function(_0x341bdb,_0x3de437){if(_0x341bdb[_0xab23('0x4e')]['id']){delete _0x341bdb[_0xab23('0x4e')]['id'];}return db['SalesforceConfiguration'][_0xab23('0x4c')]({'where':{'id':_0x341bdb[_0xab23('0x4f')]['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x3de437,null))[_0xab23('0x1a')](saveUpdates(_0x341bdb['body'],null))[_0xab23('0x1a')](respondWithResult(_0x3de437,null))['catch'](handleError(_0x3de437,null));};exports[_0xab23('0x2d')]=function(_0xacfeb2,_0x8fc78f){return db[_0xab23('0x48')][_0xab23('0x4c')]({'where':{'id':_0xacfeb2[_0xab23('0x4f')]['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x8fc78f,null))['then'](removeEntity(_0x8fc78f,null))['catch'](handleError(_0x8fc78f,null));};exports[_0xab23('0x50')]=function(_0x3bca32,_0x3c8b41,_0x21dee6){var _0x293e23={};var _0x4ee4f5={};var _0x549849;var _0x26b92a;return db[_0xab23('0x48')][_0xab23('0x51')]({'where':{'id':_0x3bca32[_0xab23('0x4f')]['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x3c8b41,null))['then'](function(_0x18866f){if(_0x18866f){_0x549849=_0x18866f;_0x4ee4f5['model']=_[_0xab23('0x37')](db[_0xab23('0x52')][_0xab23('0x34')]);_0x4ee4f5[_0xab23('0x36')]=_[_0xab23('0x37')](_0x3bca32[_0xab23('0x36')]);_0x4ee4f5['filters']=_[_0xab23('0x39')](_0x4ee4f5['model'],_0x4ee4f5[_0xab23('0x36')]);_0x293e23[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x4ee4f5['model'],qs[_0xab23('0x3b')](_0x3bca32[_0xab23('0x36')]['fields']));_0x293e23['attributes']=_0x293e23[_0xab23('0x3c')]['length']?_0x293e23[_0xab23('0x3c')]:_0x4ee4f5['model'];_0x293e23[_0xab23('0x40')]=qs[_0xab23('0x41')](_0x3bca32[_0xab23('0x36')][_0xab23('0x41')]);_0x293e23[_0xab23('0x45')]=qs[_0xab23('0x38')](_[_0xab23('0x53')](_0x3bca32[_0xab23('0x36')],_0x4ee4f5[_0xab23('0x38')]));if(_0x3bca32[_0xab23('0x36')][_0xab23('0x54')]){_0x293e23[_0xab23('0x45')]=_[_0xab23('0x42')](_0x293e23['where'],{'$or':_[_0xab23('0x33')](_0x293e23['attributes'],function(_0x36a240){var _0x226bd4={};_0x226bd4[_0x36a240]={'$like':'%'+_0x3bca32[_0xab23('0x36')][_0xab23('0x54')]+'%'};return _0x226bd4;})});}_0x293e23=_[_0xab23('0x42')]({},_0x293e23,_0x3bca32[_0xab23('0x55')]);return _0x549849['getFields'](_0x293e23);}})[_0xab23('0x1a')](function(_0x46a281){if(_0x46a281){_0x26b92a=_0x46a281['length'];if(!_0x3bca32[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x293e23[_0xab23('0x29')]=qs[_0xab23('0x29')](_0x3bca32['query'][_0xab23('0x29')]);_0x293e23[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x3bca32[_0xab23('0x36')][_0xab23('0x28')]);}return _0x549849['getFields'](_0x293e23);}})[_0xab23('0x1a')](function(_0x269936){if(_0x269936){return _0x269936?{'count':_0x26b92a,'rows':_0x269936}:null;}})[_0xab23('0x1a')](respondWithResult(_0x3c8b41,null))[_0xab23('0x23')](handleError(_0x3c8b41,null));};exports[_0xab23('0x56')]=function(_0x255a96,_0x191352,_0x2c603f){var _0x51bd64={};var _0x9a80ca={};var _0x46ad81;var _0x13fc9d;return db[_0xab23('0x48')][_0xab23('0x51')]({'where':{'id':_0x255a96['params']['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x191352,null))['then'](function(_0x2bd3bc){if(_0x2bd3bc){_0x46ad81=_0x2bd3bc;_0x9a80ca[_0xab23('0x3a')]=_[_0xab23('0x37')](db[_0xab23('0x52')][_0xab23('0x34')]);_0x9a80ca[_0xab23('0x36')]=_[_0xab23('0x37')](_0x255a96['query']);_0x9a80ca['filters']=_[_0xab23('0x39')](_0x9a80ca[_0xab23('0x3a')],_0x9a80ca[_0xab23('0x36')]);_0x51bd64[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x9a80ca[_0xab23('0x3a')],qs[_0xab23('0x3b')](_0x255a96['query']['fields']));_0x51bd64[_0xab23('0x3c')]=_0x51bd64[_0xab23('0x3c')][_0xab23('0x3d')]?_0x51bd64[_0xab23('0x3c')]:_0x9a80ca[_0xab23('0x3a')];_0x51bd64[_0xab23('0x40')]=qs['sort'](_0x255a96['query'][_0xab23('0x41')]);_0x51bd64['where']=qs['filters'](_[_0xab23('0x53')](_0x255a96['query'],_0x9a80ca[_0xab23('0x38')]));if(_0x255a96[_0xab23('0x36')][_0xab23('0x54')]){_0x51bd64[_0xab23('0x45')]=_[_0xab23('0x42')](_0x51bd64['where'],{'$or':_[_0xab23('0x33')](_0x51bd64[_0xab23('0x3c')],function(_0x1b2c0f){var _0x590fca={};_0x590fca[_0x1b2c0f]={'$like':'%'+_0x255a96[_0xab23('0x36')][_0xab23('0x54')]+'%'};return _0x590fca;})});}_0x51bd64=_[_0xab23('0x42')]({},_0x51bd64,_0x255a96[_0xab23('0x55')]);return _0x46ad81[_0xab23('0x56')](_0x51bd64);}})['then'](function(_0x139549){if(_0x139549){_0x13fc9d=_0x139549[_0xab23('0x3d')];if(!_0x255a96[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x51bd64['limit']=qs[_0xab23('0x29')](_0x255a96[_0xab23('0x36')][_0xab23('0x29')]);_0x51bd64[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x255a96['query'][_0xab23('0x28')]);}return _0x46ad81[_0xab23('0x56')](_0x51bd64);}})['then'](function(_0x74606){if(_0x74606){return _0x74606?{'count':_0x13fc9d,'rows':_0x74606}:null;}})[_0xab23('0x1a')](respondWithResult(_0x191352,null))['catch'](handleError(_0x191352,null));};exports[_0xab23('0x57')]=function(_0x62dd88,_0x5bb50f,_0x7d9abc){var _0x4fc931={};var _0x49b239={};var _0x34636e;var _0x4ec30b;return db[_0xab23('0x48')]['findOne']({'where':{'id':_0x62dd88['params']['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x5bb50f,null))[_0xab23('0x1a')](function(_0x1b19d0){if(_0x1b19d0){_0x34636e=_0x1b19d0;_0x49b239[_0xab23('0x3a')]=_[_0xab23('0x37')](db['SalesforceField'][_0xab23('0x34')]);_0x49b239[_0xab23('0x36')]=_[_0xab23('0x37')](_0x62dd88[_0xab23('0x36')]);_0x49b239['filters']=_[_0xab23('0x39')](_0x49b239[_0xab23('0x3a')],_0x49b239[_0xab23('0x36')]);_0x4fc931[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x49b239['model'],qs[_0xab23('0x3b')](_0x62dd88[_0xab23('0x36')][_0xab23('0x3b')]));_0x4fc931[_0xab23('0x3c')]=_0x4fc931[_0xab23('0x3c')]['length']?_0x4fc931[_0xab23('0x3c')]:_0x49b239['model'];_0x4fc931[_0xab23('0x40')]=qs[_0xab23('0x41')](_0x62dd88[_0xab23('0x36')][_0xab23('0x41')]);_0x4fc931[_0xab23('0x45')]=qs[_0xab23('0x38')](_[_0xab23('0x53')](_0x62dd88['query'],_0x49b239[_0xab23('0x38')]));if(_0x62dd88[_0xab23('0x36')][_0xab23('0x54')]){_0x4fc931[_0xab23('0x45')]=_[_0xab23('0x42')](_0x4fc931['where'],{'$or':_['map'](_0x4fc931[_0xab23('0x3c')],function(_0x4a62aa){var _0xabdd4e={};_0xabdd4e[_0x4a62aa]={'$like':'%'+_0x62dd88[_0xab23('0x36')]['filter']+'%'};return _0xabdd4e;})});}_0x4fc931=_[_0xab23('0x42')]({},_0x4fc931,_0x62dd88[_0xab23('0x55')]);return _0x34636e[_0xab23('0x57')](_0x4fc931);}})['then'](function(_0x31ad23){if(_0x31ad23){_0x4ec30b=_0x31ad23[_0xab23('0x3d')];if(!_0x62dd88[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x4fc931['limit']=qs[_0xab23('0x29')](_0x62dd88[_0xab23('0x36')][_0xab23('0x29')]);_0x4fc931[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x62dd88[_0xab23('0x36')][_0xab23('0x28')]);}return _0x34636e[_0xab23('0x57')](_0x4fc931);}})[_0xab23('0x1a')](function(_0x57ad4f){if(_0x57ad4f){return _0x57ad4f?{'count':_0x4ec30b,'rows':_0x57ad4f}:null;}})['then'](respondWithResult(_0x5bb50f,null))[_0xab23('0x23')](handleError(_0x5bb50f,null));}; \ No newline at end of file +var _0xeef0=['findOne','SalesforceField','getSubjects','order','hasOwnProperty','nolimit','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','set','update','destroy','stack','name','rawAttributes','type','key','model','map','query','intersection','fields','attributes','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','count','include','findAll','show','params','keys','length','includeAll','find','create','body','getFields'];(function(_0x3358cb,_0x3d549a){var _0x9c97af=function(_0x3b3aeb){while(--_0x3b3aeb){_0x3358cb['push'](_0x3358cb['shift']());}};_0x9c97af(++_0x3d549a);}(_0xeef0,0x14f));var _0x0eef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeef0[_0x1cc8fe];return _0x230054;};'use strict';var pdf=require(_0x0eef('0x0'));var emlformat=require(_0x0eef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0eef('0x2'));var jsonpatch=require(_0x0eef('0x3'));var rp=require(_0x0eef('0x4'));var moment=require(_0x0eef('0x5'));var BPromise=require(_0x0eef('0x6'));var Mustache=require(_0x0eef('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0eef('0x8'));var csv=require(_0x0eef('0x9'));var ejs=require(_0x0eef('0xa'));var fs=require('fs');var _=require(_0x0eef('0xb'));var squel=require('squel');var crypto=require(_0x0eef('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0eef('0x9'));var querystring=require('querystring');var Papa=require(_0x0eef('0xd'));var Redis=require(_0x0eef('0xe'));var authService=require(_0x0eef('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0eef('0x10'));var hardwareService=require(_0x0eef('0x11'));var logger=require(_0x0eef('0x12'))(_0x0eef('0x13'));var utils=require(_0x0eef('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0eef('0x15'))['db'];var jayson=require(_0x0eef('0x16'));var client=jayson[_0x0eef('0x17')][_0x0eef('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x490617,_0x1dbba2,_0x3254a1,_0x2b2b30){return new BPromise(function(_0x3a4d76,_0x4ed3c8){var _0x31f641=_0x2b2b30||client;return _0x31f641['request'](_0x490617,_0x3254a1)[_0x0eef('0x19')](function(_0x55a8bf){logger['info'](_0x0eef('0x1a'),_0x1dbba2,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1dbba2,_0x0eef('0x1b'),JSON[_0x0eef('0x1c')](_0x55a8bf));if(_0x55a8bf['error']){if(_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1e')]===0x1f4){logger['error'](_0x0eef('0x1a'),_0x1dbba2,_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1f')]);return _0x4ed3c8(_0x55a8bf[_0x0eef('0x1d')]['message']);}logger[_0x0eef('0x1d')](_0x0eef('0x1a'),_0x1dbba2,_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1f')]);return _0x3a4d76(_0x55a8bf[_0x0eef('0x1d')][_0x0eef('0x1f')]);}else{logger[_0x0eef('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1dbba2,_0x0eef('0x1b'));_0x3a4d76(_0x55a8bf[_0x0eef('0x21')][_0x0eef('0x1f')]);}})[_0x0eef('0x22')](function(_0x27e9f8){logger['error'](_0x0eef('0x1a'),_0x1dbba2,_0x27e9f8);_0x4ed3c8(_0x27e9f8);});});}function respondWithStatusCode(_0x40fc70,_0x29ef68){_0x29ef68=_0x29ef68||0xcc;return function(_0x43f2ca){if(_0x43f2ca){return _0x40fc70[_0x0eef('0x23')](_0x29ef68);}return _0x40fc70[_0x0eef('0x24')](_0x29ef68)[_0x0eef('0x25')]();};}function respondWithResult(_0x1e8472,_0x4417af){_0x4417af=_0x4417af||0xc8;return function(_0x519a14){if(_0x519a14){return _0x1e8472[_0x0eef('0x24')](_0x4417af)['json'](_0x519a14);}};}function respondWithFilteredResult(_0x49866b,_0x3ca2ef){return function(_0x2bc6e2){if(_0x2bc6e2){var _0x3adddc=_0x2bc6e2['count'],_0x5855dc=_0x3ca2ef[_0x0eef('0x26')],_0x4e4cc2=_0x3ca2ef[_0x0eef('0x26')]+_0x3ca2ef['limit'],_0x4c28e4;if(_0x4e4cc2>=_0x3adddc){_0x4e4cc2=_0x3adddc;_0x4c28e4=0xc8;}else{_0x4c28e4=0xce;}_0x49866b[_0x0eef('0x24')](_0x4c28e4);return _0x49866b[_0x0eef('0x27')]('Content-Range',_0x5855dc+'-'+_0x4e4cc2+'/'+_0x3adddc)['json'](_0x2bc6e2);}return null;};}function patchUpdates(_0x2dff3c){return function(_0x2f1659){try{jsonpatch['apply'](_0x2f1659,_0x2dff3c,!![]);}catch(_0x5511f9){return BPromise['reject'](_0x5511f9);}return _0x2f1659['save']();};}function saveUpdates(_0x81e955,_0xea75c4){return function(_0x44ecaa){if(_0x44ecaa){return _0x44ecaa[_0x0eef('0x28')](_0x81e955)['then'](function(_0x1fe27c){return _0x1fe27c;});}return null;};}function removeEntity(_0x147ae9,_0x419074){return function(_0x32aff0){if(_0x32aff0){return _0x32aff0[_0x0eef('0x29')]()[_0x0eef('0x19')](function(){_0x147ae9[_0x0eef('0x24')](0xcc)[_0x0eef('0x25')]();});}};}function handleEntityNotFound(_0x5c824c,_0x7c91e){return function(_0x58d568){if(!_0x58d568){_0x5c824c[_0x0eef('0x23')](0x194);}return _0x58d568;};}function handleError(_0x3836db,_0x3e5781){_0x3e5781=_0x3e5781||0x1f4;return function(_0x40743a){logger['error'](_0x40743a[_0x0eef('0x2a')]);if(_0x40743a[_0x0eef('0x2b')]){delete _0x40743a[_0x0eef('0x2b')];}_0x3836db['status'](_0x3e5781)['send'](_0x40743a);};}exports['index']=function(_0x5a6364,_0x3892e1){var _0x291176={},_0x2e19e5={},_0x1f31db={'count':0x0,'rows':[]};var _0x3a9982=_['map'](db['SalesforceConfiguration'][_0x0eef('0x2c')],function(_0x2aff5f){return{'name':_0x2aff5f['fieldName'],'type':_0x2aff5f[_0x0eef('0x2d')][_0x0eef('0x2e')]};});_0x2e19e5[_0x0eef('0x2f')]=_[_0x0eef('0x30')](_0x3a9982,_0x0eef('0x2b'));_0x2e19e5[_0x0eef('0x31')]=_['keys'](_0x5a6364['query']);_0x2e19e5['filters']=_[_0x0eef('0x32')](_0x2e19e5['model'],_0x2e19e5[_0x0eef('0x31')]);_0x291176['attributes']=_[_0x0eef('0x32')](_0x2e19e5['model'],qs[_0x0eef('0x33')](_0x5a6364['query']['fields']));_0x291176[_0x0eef('0x34')]=_0x291176['attributes']['length']?_0x291176['attributes']:_0x2e19e5[_0x0eef('0x2f')];if(!_0x5a6364[_0x0eef('0x31')]['hasOwnProperty']('nolimit')){_0x291176[_0x0eef('0x35')]=qs[_0x0eef('0x35')](_0x5a6364['query'][_0x0eef('0x35')]);_0x291176[_0x0eef('0x26')]=qs['offset'](_0x5a6364[_0x0eef('0x31')][_0x0eef('0x26')]);}_0x291176['order']=qs['sort'](_0x5a6364['query'][_0x0eef('0x36')]);_0x291176[_0x0eef('0x37')]=qs[_0x0eef('0x38')](_[_0x0eef('0x39')](_0x5a6364[_0x0eef('0x31')],_0x2e19e5['filters']),_0x3a9982);if(_0x5a6364[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x291176[_0x0eef('0x37')]=_['merge'](_0x291176[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x3a9982,function(_0x300ce7){if(_0x300ce7[_0x0eef('0x2d')]!==_0x0eef('0x3b')){var _0x172b41={};_0x172b41[_0x300ce7[_0x0eef('0x2b')]]={'$like':'%'+_0x5a6364['query']['filter']+'%'};return _0x172b41;}})});}_0x291176=_[_0x0eef('0x3c')]({},_0x291176,_0x5a6364[_0x0eef('0x3d')]);var _0x43dd23={'where':_0x291176[_0x0eef('0x37')]};return db[_0x0eef('0x3e')][_0x0eef('0x3f')](_0x43dd23)[_0x0eef('0x19')](function(_0x5eda8c){_0x1f31db[_0x0eef('0x3f')]=_0x5eda8c;if(_0x5a6364[_0x0eef('0x31')]['includeAll']){_0x291176[_0x0eef('0x40')]=[{'all':!![]}];}return db[_0x0eef('0x3e')][_0x0eef('0x41')](_0x291176);})['then'](function(_0x46a398){_0x1f31db['rows']=_0x46a398;return _0x1f31db;})[_0x0eef('0x19')](respondWithFilteredResult(_0x3892e1,_0x291176))[_0x0eef('0x22')](handleError(_0x3892e1,null));};exports[_0x0eef('0x42')]=function(_0x2d0c35,_0x4e2072){var _0x5b4e65={'raw':![],'where':{'id':_0x2d0c35[_0x0eef('0x43')]['id']}},_0x14e8c0={};_0x14e8c0[_0x0eef('0x2f')]=_['keys'](db[_0x0eef('0x3e')][_0x0eef('0x2c')]);_0x14e8c0[_0x0eef('0x31')]=_[_0x0eef('0x44')](_0x2d0c35[_0x0eef('0x31')]);_0x14e8c0[_0x0eef('0x38')]=_['intersection'](_0x14e8c0['model'],_0x14e8c0[_0x0eef('0x31')]);_0x5b4e65[_0x0eef('0x34')]=_[_0x0eef('0x32')](_0x14e8c0[_0x0eef('0x2f')],qs[_0x0eef('0x33')](_0x2d0c35[_0x0eef('0x31')][_0x0eef('0x33')]));_0x5b4e65[_0x0eef('0x34')]=_0x5b4e65[_0x0eef('0x34')][_0x0eef('0x45')]?_0x5b4e65['attributes']:_0x14e8c0[_0x0eef('0x2f')];if(_0x2d0c35[_0x0eef('0x31')][_0x0eef('0x46')]){_0x5b4e65[_0x0eef('0x40')]=[{'all':!![]}];}_0x5b4e65=_[_0x0eef('0x3c')]({},_0x5b4e65,_0x2d0c35[_0x0eef('0x3d')]);return db['SalesforceConfiguration'][_0x0eef('0x47')](_0x5b4e65)[_0x0eef('0x19')](handleEntityNotFound(_0x4e2072,null))[_0x0eef('0x19')](respondWithResult(_0x4e2072,null))[_0x0eef('0x22')](handleError(_0x4e2072,null));};exports[_0x0eef('0x48')]=function(_0x4f3002,_0x48ce14){return db[_0x0eef('0x3e')][_0x0eef('0x48')](_0x4f3002['body'],{})[_0x0eef('0x19')](respondWithResult(_0x48ce14,0xc9))[_0x0eef('0x22')](handleError(_0x48ce14,null));};exports[_0x0eef('0x28')]=function(_0x24112c,_0x2ba174){if(_0x24112c[_0x0eef('0x49')]['id']){delete _0x24112c[_0x0eef('0x49')]['id'];}return db[_0x0eef('0x3e')][_0x0eef('0x47')]({'where':{'id':_0x24112c[_0x0eef('0x43')]['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x2ba174,null))['then'](saveUpdates(_0x24112c[_0x0eef('0x49')],null))['then'](respondWithResult(_0x2ba174,null))['catch'](handleError(_0x2ba174,null));};exports['destroy']=function(_0x9a17a7,_0x1b59a7){return db['SalesforceConfiguration'][_0x0eef('0x47')]({'where':{'id':_0x9a17a7[_0x0eef('0x43')]['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x1b59a7,null))['then'](removeEntity(_0x1b59a7,null))[_0x0eef('0x22')](handleError(_0x1b59a7,null));};exports[_0x0eef('0x4a')]=function(_0x2efd07,_0x2be681,_0x1cca12){var _0x39be72={};var _0x4032bd={};var _0x45c28c;var _0x16a3bb;return db[_0x0eef('0x3e')][_0x0eef('0x4b')]({'where':{'id':_0x2efd07['params']['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x2be681,null))[_0x0eef('0x19')](function(_0x44dc25){if(_0x44dc25){_0x45c28c=_0x44dc25;_0x4032bd[_0x0eef('0x2f')]=_['keys'](db[_0x0eef('0x4c')]['rawAttributes']);_0x4032bd[_0x0eef('0x31')]=_[_0x0eef('0x44')](_0x2efd07[_0x0eef('0x31')]);_0x4032bd['filters']=_[_0x0eef('0x32')](_0x4032bd['model'],_0x4032bd[_0x0eef('0x31')]);_0x39be72[_0x0eef('0x34')]=_[_0x0eef('0x32')](_0x4032bd['model'],qs[_0x0eef('0x33')](_0x2efd07[_0x0eef('0x31')][_0x0eef('0x33')]));_0x39be72[_0x0eef('0x34')]=_0x39be72[_0x0eef('0x34')]['length']?_0x39be72['attributes']:_0x4032bd[_0x0eef('0x2f')];_0x39be72['order']=qs[_0x0eef('0x36')](_0x2efd07[_0x0eef('0x31')]['sort']);_0x39be72[_0x0eef('0x37')]=qs[_0x0eef('0x38')](_['pick'](_0x2efd07[_0x0eef('0x31')],_0x4032bd['filters']));if(_0x2efd07[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x39be72['where']=_[_0x0eef('0x3c')](_0x39be72[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x39be72[_0x0eef('0x34')],function(_0xff26d1){var _0x631c99={};_0x631c99[_0xff26d1]={'$like':'%'+_0x2efd07[_0x0eef('0x31')][_0x0eef('0x3a')]+'%'};return _0x631c99;})});}_0x39be72=_['merge']({},_0x39be72,_0x2efd07[_0x0eef('0x3d')]);return _0x45c28c['getFields'](_0x39be72);}})[_0x0eef('0x19')](function(_0x40bcc3){if(_0x40bcc3){_0x16a3bb=_0x40bcc3['length'];if(!_0x2efd07[_0x0eef('0x31')]['hasOwnProperty']('nolimit')){_0x39be72[_0x0eef('0x35')]=qs[_0x0eef('0x35')](_0x2efd07[_0x0eef('0x31')]['limit']);_0x39be72['offset']=qs[_0x0eef('0x26')](_0x2efd07[_0x0eef('0x31')][_0x0eef('0x26')]);}return _0x45c28c[_0x0eef('0x4a')](_0x39be72);}})[_0x0eef('0x19')](function(_0x3461ce){if(_0x3461ce){return _0x3461ce?{'count':_0x16a3bb,'rows':_0x3461ce}:null;}})['then'](respondWithResult(_0x2be681,null))[_0x0eef('0x22')](handleError(_0x2be681,null));};exports[_0x0eef('0x4d')]=function(_0x4f9221,_0x3b2546,_0x4ad050){var _0x49b573={};var _0x28b996={};var _0xdc640b;var _0x259d57;return db[_0x0eef('0x3e')][_0x0eef('0x4b')]({'where':{'id':_0x4f9221[_0x0eef('0x43')]['id']}})[_0x0eef('0x19')](handleEntityNotFound(_0x3b2546,null))[_0x0eef('0x19')](function(_0x1a2028){if(_0x1a2028){_0xdc640b=_0x1a2028;_0x28b996[_0x0eef('0x2f')]=_[_0x0eef('0x44')](db[_0x0eef('0x4c')][_0x0eef('0x2c')]);_0x28b996[_0x0eef('0x31')]=_['keys'](_0x4f9221[_0x0eef('0x31')]);_0x28b996[_0x0eef('0x38')]=_[_0x0eef('0x32')](_0x28b996[_0x0eef('0x2f')],_0x28b996[_0x0eef('0x31')]);_0x49b573[_0x0eef('0x34')]=_[_0x0eef('0x32')](_0x28b996[_0x0eef('0x2f')],qs[_0x0eef('0x33')](_0x4f9221['query'][_0x0eef('0x33')]));_0x49b573[_0x0eef('0x34')]=_0x49b573[_0x0eef('0x34')][_0x0eef('0x45')]?_0x49b573['attributes']:_0x28b996['model'];_0x49b573[_0x0eef('0x4e')]=qs[_0x0eef('0x36')](_0x4f9221[_0x0eef('0x31')]['sort']);_0x49b573[_0x0eef('0x37')]=qs[_0x0eef('0x38')](_[_0x0eef('0x39')](_0x4f9221['query'],_0x28b996['filters']));if(_0x4f9221[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x49b573[_0x0eef('0x37')]=_[_0x0eef('0x3c')](_0x49b573[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x49b573[_0x0eef('0x34')],function(_0x1d80df){var _0x504e13={};_0x504e13[_0x1d80df]={'$like':'%'+_0x4f9221['query'][_0x0eef('0x3a')]+'%'};return _0x504e13;})});}_0x49b573=_['merge']({},_0x49b573,_0x4f9221[_0x0eef('0x3d')]);return _0xdc640b[_0x0eef('0x4d')](_0x49b573);}})[_0x0eef('0x19')](function(_0x364815){if(_0x364815){_0x259d57=_0x364815[_0x0eef('0x45')];if(!_0x4f9221[_0x0eef('0x31')][_0x0eef('0x4f')](_0x0eef('0x50'))){_0x49b573[_0x0eef('0x35')]=qs['limit'](_0x4f9221[_0x0eef('0x31')][_0x0eef('0x35')]);_0x49b573[_0x0eef('0x26')]=qs[_0x0eef('0x26')](_0x4f9221[_0x0eef('0x31')][_0x0eef('0x26')]);}return _0xdc640b[_0x0eef('0x4d')](_0x49b573);}})['then'](function(_0x3bd2f6){if(_0x3bd2f6){return _0x3bd2f6?{'count':_0x259d57,'rows':_0x3bd2f6}:null;}})[_0x0eef('0x19')](respondWithResult(_0x3b2546,null))[_0x0eef('0x22')](handleError(_0x3b2546,null));};exports['getDescriptions']=function(_0x5db5b6,_0x15776c,_0x10e079){var _0x50ff28={};var _0x163598={};var _0x44882a;var _0x14876a;return db['SalesforceConfiguration'][_0x0eef('0x4b')]({'where':{'id':_0x5db5b6[_0x0eef('0x43')]['id']}})['then'](handleEntityNotFound(_0x15776c,null))[_0x0eef('0x19')](function(_0x8394e7){if(_0x8394e7){_0x44882a=_0x8394e7;_0x163598[_0x0eef('0x2f')]=_[_0x0eef('0x44')](db[_0x0eef('0x4c')][_0x0eef('0x2c')]);_0x163598[_0x0eef('0x31')]=_[_0x0eef('0x44')](_0x5db5b6[_0x0eef('0x31')]);_0x163598['filters']=_[_0x0eef('0x32')](_0x163598[_0x0eef('0x2f')],_0x163598['query']);_0x50ff28['attributes']=_[_0x0eef('0x32')](_0x163598[_0x0eef('0x2f')],qs[_0x0eef('0x33')](_0x5db5b6['query']['fields']));_0x50ff28['attributes']=_0x50ff28[_0x0eef('0x34')][_0x0eef('0x45')]?_0x50ff28[_0x0eef('0x34')]:_0x163598['model'];_0x50ff28[_0x0eef('0x4e')]=qs[_0x0eef('0x36')](_0x5db5b6['query'][_0x0eef('0x36')]);_0x50ff28[_0x0eef('0x37')]=qs['filters'](_[_0x0eef('0x39')](_0x5db5b6['query'],_0x163598[_0x0eef('0x38')]));if(_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x3a')]){_0x50ff28[_0x0eef('0x37')]=_['merge'](_0x50ff28[_0x0eef('0x37')],{'$or':_[_0x0eef('0x30')](_0x50ff28[_0x0eef('0x34')],function(_0x1b0555){var _0x1c7885={};_0x1c7885[_0x1b0555]={'$like':'%'+_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x3a')]+'%'};return _0x1c7885;})});}_0x50ff28=_[_0x0eef('0x3c')]({},_0x50ff28,_0x5db5b6['options']);return _0x44882a[_0x0eef('0x51')](_0x50ff28);}})[_0x0eef('0x19')](function(_0x1b7444){if(_0x1b7444){_0x14876a=_0x1b7444[_0x0eef('0x45')];if(!_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x4f')]('nolimit')){_0x50ff28[_0x0eef('0x35')]=qs[_0x0eef('0x35')](_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x35')]);_0x50ff28[_0x0eef('0x26')]=qs[_0x0eef('0x26')](_0x5db5b6[_0x0eef('0x31')][_0x0eef('0x26')]);}return _0x44882a['getDescriptions'](_0x50ff28);}})['then'](function(_0x37d35c){if(_0x37d35c){return _0x37d35c?{'count':_0x14876a,'rows':_0x37d35c}:null;}})['then'](respondWithResult(_0x15776c,null))[_0x0eef('0x22')](handleError(_0x15776c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index bd2c8e1..affd79b 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 _0x6696=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0xcb1887,_0x433a2d){var _0x5733e1=function(_0x56a443){while(--_0x56a443){_0xcb1887['push'](_0xcb1887['shift']());}};_0x5733e1(++_0x433a2d);}(_0x6696,0x81));var _0x6669=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6696[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x6669('0x0'));var util=require(_0x6669('0x1'));var logger=require(_0x6669('0x2'))(_0x6669('0x3'));var moment=require(_0x6669('0x4'));var BPromise=require(_0x6669('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6669('0x6'));var rimraf=require(_0x6669('0x7'));var config=require('../../config/environment');var attributes=require(_0x6669('0x8'));module[_0x6669('0x9')]=function(_0x14b8d8,_0x538066){return _0x14b8d8[_0x6669('0xa')](_0x6669('0xb'),attributes,{'tableName':_0x6669('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a6d=['int_salesforce_configurations','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a6d,0xa3));var _0xd5a6=function(_0xe61be9,_0x4bc4a8){_0xe61be9=_0xe61be9-0x0;var _0x1c72ae=_0x5a6d[_0xe61be9];return _0x1c72ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd5a6('0x0'))('api');var moment=require(_0xd5a6('0x1'));var BPromise=require(_0xd5a6('0x2'));var rp=require(_0xd5a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd5a6('0x4'));var attributes=require(_0xd5a6('0x5'));module['exports']=function(_0x325703,_0x42b756){return _0x325703[_0xd5a6('0x6')](_0xd5a6('0x7'),attributes,{'tableName':_0xd5a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 4c278e0..e7cb1ab 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 _0x0d75=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x0d75,0x8c));var _0x50d7=function(_0x20c838,_0x1e45dc){_0x20c838=_0x20c838-0x0;var _0x374e12=_0x0d75[_0x20c838];return _0x374e12;};'use strict';var _=require(_0x50d7('0x0'));var util=require(_0x50d7('0x1'));var moment=require(_0x50d7('0x2'));var BPromise=require(_0x50d7('0x3'));var rs=require(_0x50d7('0x4'));var fs=require('fs');var Redis=require(_0x50d7('0x5'));var db=require(_0x50d7('0x6'))['db'];var utils=require(_0x50d7('0x7'));var logger=require(_0x50d7('0x8'))(_0x50d7('0x9'));var config=require(_0x50d7('0xa'));var jayson=require(_0x50d7('0xb'));var client=jayson['client'][_0x50d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41b7d2,_0x4f7f8c,_0x1ea845){return new BPromise(function(_0x430694,_0x7932fa){return client['request'](_0x41b7d2,_0x1ea845)['then'](function(_0x20457d){logger[_0x50d7('0xd')](_0x50d7('0xe'),_0x4f7f8c,_0x50d7('0xf'));logger[_0x50d7('0x10')](_0x50d7('0x11'),_0x4f7f8c,_0x50d7('0xf'),JSON[_0x50d7('0x12')](_0x20457d));if(_0x20457d[_0x50d7('0x13')]){if(_0x20457d[_0x50d7('0x13')][_0x50d7('0x14')]===0x1f4){logger[_0x50d7('0x13')](_0x50d7('0xe'),_0x4f7f8c,_0x20457d[_0x50d7('0x13')][_0x50d7('0x15')]);return _0x7932fa(_0x20457d[_0x50d7('0x13')][_0x50d7('0x15')]);}logger[_0x50d7('0x13')](_0x50d7('0xe'),_0x4f7f8c,_0x20457d[_0x50d7('0x13')]['message']);return _0x430694(_0x20457d[_0x50d7('0x13')][_0x50d7('0x15')]);}else{logger[_0x50d7('0xd')](_0x50d7('0xe'),_0x4f7f8c,_0x50d7('0xf'));_0x430694(_0x20457d[_0x50d7('0x16')][_0x50d7('0x15')]);}})[_0x50d7('0x17')](function(_0x14881e){logger[_0x50d7('0x13')](_0x50d7('0xe'),_0x4f7f8c,_0x14881e);_0x7932fa(_0x14881e);});});} \ No newline at end of file +var _0xeed4=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message'];(function(_0x5f477a,_0x41cfd1){var _0x37a42a=function(_0x37630e){while(--_0x37630e){_0x5f477a['push'](_0x5f477a['shift']());}};_0x37a42a(++_0x41cfd1);}(_0xeed4,0xf4));var _0x4eed=function(_0x4e13b0,_0x1ca561){_0x4e13b0=_0x4e13b0-0x0;var _0x5c2a63=_0xeed4[_0x4e13b0];return _0x5c2a63;};'use strict';var _=require('lodash');var util=require(_0x4eed('0x0'));var moment=require(_0x4eed('0x1'));var BPromise=require(_0x4eed('0x2'));var rs=require(_0x4eed('0x3'));var fs=require('fs');var Redis=require(_0x4eed('0x4'));var db=require(_0x4eed('0x5'))['db'];var utils=require(_0x4eed('0x6'));var logger=require(_0x4eed('0x7'))('rpc');var config=require(_0x4eed('0x8'));var jayson=require(_0x4eed('0x9'));var client=jayson[_0x4eed('0xa')][_0x4eed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28fa41,_0x3db9b5,_0x1c6d6a){return new BPromise(function(_0x4fd745,_0x48b59e){return client[_0x4eed('0xc')](_0x28fa41,_0x1c6d6a)['then'](function(_0x28d0e3){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3db9b5,'request\x20sent');logger[_0x4eed('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3db9b5,_0x4eed('0xe'),JSON[_0x4eed('0xf')](_0x28d0e3));if(_0x28d0e3[_0x4eed('0x10')]){if(_0x28d0e3[_0x4eed('0x10')][_0x4eed('0x11')]===0x1f4){logger[_0x4eed('0x10')](_0x4eed('0x12'),_0x3db9b5,_0x28d0e3[_0x4eed('0x10')][_0x4eed('0x13')]);return _0x48b59e(_0x28d0e3['error'][_0x4eed('0x13')]);}logger[_0x4eed('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3db9b5,_0x28d0e3[_0x4eed('0x10')][_0x4eed('0x13')]);return _0x4fd745(_0x28d0e3['error'][_0x4eed('0x13')]);}else{logger[_0x4eed('0x14')](_0x4eed('0x12'),_0x3db9b5,_0x4eed('0xe'));_0x4fd745(_0x28d0e3['result']['message']);}})[_0x4eed('0x15')](function(_0x1d885a){logger[_0x4eed('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3db9b5,_0x1d885a);_0x48b59e(_0x1d885a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e286f6f..a00e0f9 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 _0xf072=['post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf072,0x1cf));var _0x2f07=function(_0x50cd31,_0x33368c){_0x50cd31=_0x50cd31-0x0;var _0x3143ef=_0xf072[_0x50cd31];return _0x3143ef;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var auth=require(_0x2f07('0x4'));var interaction=require(_0x2f07('0x5'));var config=require(_0x2f07('0x6'));var controller=require('./intSalesforceField.controller');router[_0x2f07('0x7')]('/',auth[_0x2f07('0x8')](),controller[_0x2f07('0x9')]);router[_0x2f07('0x7')](_0x2f07('0xa'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xb')]);router[_0x2f07('0xc')]('/',auth[_0x2f07('0x8')](),controller[_0x2f07('0xd')]);router[_0x2f07('0xe')](_0x2f07('0xa'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xf')]);router[_0x2f07('0x10')]('/:id',auth[_0x2f07('0x8')](),controller[_0x2f07('0x11')]);module[_0x2f07('0x12')]=router; \ No newline at end of file +var _0x6b8f=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','create','update','delete'];(function(_0x1a227d,_0x11093d){var _0x11f7fe=function(_0x5f0aa7){while(--_0x5f0aa7){_0x1a227d['push'](_0x1a227d['shift']());}};_0x11f7fe(++_0x11093d);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x3c5028,_0x2f019e){_0x3c5028=_0x3c5028-0x0;var _0x5d9151=_0x6b8f[_0x3c5028];return _0x5d9151;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xf6b8('0x2'));var interaction=require(_0xf6b8('0x3'));var config=require('../../config/environment');var controller=require(_0xf6b8('0x4'));router[_0xf6b8('0x5')]('/',auth[_0xf6b8('0x6')](),controller['index']);router[_0xf6b8('0x5')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf6b8('0x9')]);router['put'](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xa')]);router[_0xf6b8('0xb')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 7f95de4..44d48d1 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 _0xc1f2=['STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x98332,_0x1a37ec){var _0x5ccd9b=function(_0x155941){while(--_0x155941){_0x98332['push'](_0x98332['shift']());}};_0x5ccd9b(++_0x1a37ec);}(_0xc1f2,0x169));var _0x2c1f=function(_0x3a8bb8,_0x5aae01){_0x3a8bb8=_0x3a8bb8-0x0;var _0x13a3e3=_0xc1f2[_0x3a8bb8];return _0x13a3e3;};'use strict';var Sequelize=require(_0x2c1f('0x0'));module['exports']={'type':{'type':Sequelize[_0x2c1f('0x1')](_0x2c1f('0x2'),_0x2c1f('0x3'),_0x2c1f('0x4'),'keyValue'),'defaultValue':_0x2c1f('0x2')},'content':{'type':Sequelize[_0x2c1f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2c1f('0x1')]('string','variable',_0x2c1f('0x4'))},'keyContent':{'type':Sequelize[_0x2c1f('0x5')]},'idField':{'type':Sequelize[_0x2c1f('0x5')]},'variableName':{'type':Sequelize[_0x2c1f('0x5')]}}; \ No newline at end of file +var _0x4fa6=['string','variable','STRING','ENUM','customVariable','sequelize'];(function(_0x515391,_0x1dccad){var _0x4ccc61=function(_0x1a5fef){while(--_0x1a5fef){_0x515391['push'](_0x515391['shift']());}};_0x4ccc61(++_0x1dccad);}(_0x4fa6,0x14f));var _0x64fa=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4fa6[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x64fa('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x64fa('0x1'),_0x64fa('0x2'),'customVariable','keyValue'),'defaultValue':_0x64fa('0x1')},'content':{'type':Sequelize[_0x64fa('0x3')]},'key':{'type':Sequelize[_0x64fa('0x3')]},'keyType':{'type':Sequelize[_0x64fa('0x4')](_0x64fa('0x1'),_0x64fa('0x2'),_0x64fa('0x5'))},'keyContent':{'type':Sequelize[_0x64fa('0x3')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x64fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a3ffe3f..be842cd 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 _0xda11=['find','create','body','catch','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','SalesforceField','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','findAll','rows','show','params','rawAttributes','includeAll','include'];(function(_0x547d1e,_0x342531){var _0x8ead1d=function(_0x2cc967){while(--_0x2cc967){_0x547d1e['push'](_0x547d1e['shift']());}};_0x8ead1d(++_0x342531);}(_0xda11,0xe5));var _0x1da1=function(_0x38b6c0,_0x44bd58){_0x38b6c0=_0x38b6c0-0x0;var _0x3d48f7=_0xda11[_0x38b6c0];return _0x3d48f7;};'use strict';var pdf=require(_0x1da1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1da1('0x1'));var zipdir=require(_0x1da1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1da1('0x3'));var moment=require(_0x1da1('0x4'));var BPromise=require(_0x1da1('0x5'));var Mustache=require(_0x1da1('0x6'));var util=require(_0x1da1('0x7'));var path=require(_0x1da1('0x8'));var sox=require('sox');var csv=require(_0x1da1('0x9'));var ejs=require(_0x1da1('0xa'));var fs=require('fs');var _=require(_0x1da1('0xb'));var squel=require(_0x1da1('0xc'));var crypto=require(_0x1da1('0xd'));var jsforce=require(_0x1da1('0xe'));var deskjs=require(_0x1da1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1da1('0x10'));var Papa=require(_0x1da1('0x11'));var Redis=require(_0x1da1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1da1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1da1('0x14'));var logger=require(_0x1da1('0x15'))(_0x1da1('0x16'));var utils=require(_0x1da1('0x17'));var config=require(_0x1da1('0x18'));var licenseUtil=require(_0x1da1('0x19'));var db=require(_0x1da1('0x1a'))['db'];function respondWithStatusCode(_0x3c35d1,_0x33cc64){_0x33cc64=_0x33cc64||0xcc;return function(_0x13e8c0){if(_0x13e8c0){return _0x3c35d1[_0x1da1('0x1b')](_0x33cc64);}return _0x3c35d1[_0x1da1('0x1c')](_0x33cc64)['end']();};}function respondWithResult(_0x3574b1,_0x401b9a){_0x401b9a=_0x401b9a||0xc8;return function(_0x1466ca){if(_0x1466ca){return _0x3574b1[_0x1da1('0x1c')](_0x401b9a)['json'](_0x1466ca);}};}function respondWithFilteredResult(_0x2b1cad,_0x412f30){return function(_0x802829){if(_0x802829){var _0x12efdf=_0x802829['count'],_0x1dc7c8=_0x412f30[_0x1da1('0x1d')],_0x4a009c=_0x412f30['offset']+_0x412f30[_0x1da1('0x1e')],_0x5b95e9;if(_0x4a009c>=_0x12efdf){_0x4a009c=_0x12efdf;_0x5b95e9=0xc8;}else{_0x5b95e9=0xce;}_0x2b1cad[_0x1da1('0x1c')](_0x5b95e9);return _0x2b1cad[_0x1da1('0x1f')](_0x1da1('0x20'),_0x1dc7c8+'-'+_0x4a009c+'/'+_0x12efdf)[_0x1da1('0x21')](_0x802829);}return null;};}function patchUpdates(_0x20a25a){return function(_0x34ed32){try{jsonpatch[_0x1da1('0x22')](_0x34ed32,_0x20a25a,!![]);}catch(_0x15bd3b){return BPromise[_0x1da1('0x23')](_0x15bd3b);}return _0x34ed32[_0x1da1('0x24')]();};}function saveUpdates(_0x4676c7,_0x38d515){return function(_0x41c67c){if(_0x41c67c){return _0x41c67c[_0x1da1('0x25')](_0x4676c7)[_0x1da1('0x26')](function(_0x37f11b){return _0x37f11b;});}return null;};}function removeEntity(_0xdbe37c,_0x1afd05){return function(_0x278769){if(_0x278769){return _0x278769[_0x1da1('0x27')]()[_0x1da1('0x26')](function(){_0xdbe37c[_0x1da1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47d831,_0x4b06f3){return function(_0x610c57){if(!_0x610c57){_0x47d831[_0x1da1('0x1b')](0x194);}return _0x610c57;};}function handleError(_0xedbda,_0x1de47d){_0x1de47d=_0x1de47d||0x1f4;return function(_0x25c36f){logger[_0x1da1('0x28')](_0x25c36f['stack']);if(_0x25c36f[_0x1da1('0x29')]){delete _0x25c36f[_0x1da1('0x29')];}_0xedbda[_0x1da1('0x1c')](_0x1de47d)[_0x1da1('0x2a')](_0x25c36f);};}exports['index']=function(_0x4831fa,_0x2e3eb8){var _0x2908f1={},_0x128127={},_0x180cd3={'count':0x0,'rows':[]};var _0x33061e=_['map'](db[_0x1da1('0x2b')]['rawAttributes'],function(_0x13645c){return{'name':_0x13645c['fieldName'],'type':_0x13645c[_0x1da1('0x2c')][_0x1da1('0x2d')]};});_0x128127['model']=_[_0x1da1('0x2e')](_0x33061e,_0x1da1('0x29'));_0x128127[_0x1da1('0x2f')]=_[_0x1da1('0x30')](_0x4831fa['query']);_0x128127['filters']=_['intersection'](_0x128127[_0x1da1('0x31')],_0x128127[_0x1da1('0x2f')]);_0x2908f1[_0x1da1('0x32')]=_[_0x1da1('0x33')](_0x128127['model'],qs['fields'](_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x34')]));_0x2908f1[_0x1da1('0x32')]=_0x2908f1[_0x1da1('0x32')][_0x1da1('0x35')]?_0x2908f1[_0x1da1('0x32')]:_0x128127[_0x1da1('0x31')];if(!_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x36')]('nolimit')){_0x2908f1[_0x1da1('0x1e')]=qs[_0x1da1('0x1e')](_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x1e')]);_0x2908f1[_0x1da1('0x1d')]=qs['offset'](_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x1d')]);}_0x2908f1['order']=qs[_0x1da1('0x37')](_0x4831fa['query']['sort']);_0x2908f1['where']=qs['filters'](_[_0x1da1('0x38')](_0x4831fa[_0x1da1('0x2f')],_0x128127[_0x1da1('0x39')]),_0x33061e);if(_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x3a')]){_0x2908f1[_0x1da1('0x3b')]=_[_0x1da1('0x3c')](_0x2908f1['where'],{'$or':_[_0x1da1('0x2e')](_0x33061e,function(_0x1b05de){if(_0x1b05de[_0x1da1('0x2c')]!==_0x1da1('0x3d')){var _0x4b8d40={};_0x4b8d40[_0x1b05de[_0x1da1('0x29')]]={'$like':'%'+_0x4831fa['query']['filter']+'%'};return _0x4b8d40;}})});}_0x2908f1=_[_0x1da1('0x3c')]({},_0x2908f1,_0x4831fa[_0x1da1('0x3e')]);var _0x2786a7={'where':_0x2908f1[_0x1da1('0x3b')]};return db[_0x1da1('0x2b')]['count'](_0x2786a7)['then'](function(_0x58a07c){_0x180cd3[_0x1da1('0x3f')]=_0x58a07c;if(_0x4831fa['query']['includeAll']){_0x2908f1['include']=[{'all':!![]}];}return db[_0x1da1('0x2b')][_0x1da1('0x40')](_0x2908f1);})['then'](function(_0x533fb2){_0x180cd3[_0x1da1('0x41')]=_0x533fb2;return _0x180cd3;})[_0x1da1('0x26')](respondWithFilteredResult(_0x2e3eb8,_0x2908f1))['catch'](handleError(_0x2e3eb8,null));};exports[_0x1da1('0x42')]=function(_0x56044d,_0x59a4b0){var _0x2cf747={'raw':!![],'where':{'id':_0x56044d[_0x1da1('0x43')]['id']}},_0x39245f={};_0x39245f[_0x1da1('0x31')]=_[_0x1da1('0x30')](db[_0x1da1('0x2b')][_0x1da1('0x44')]);_0x39245f[_0x1da1('0x2f')]=_[_0x1da1('0x30')](_0x56044d[_0x1da1('0x2f')]);_0x39245f[_0x1da1('0x39')]=_['intersection'](_0x39245f[_0x1da1('0x31')],_0x39245f[_0x1da1('0x2f')]);_0x2cf747[_0x1da1('0x32')]=_[_0x1da1('0x33')](_0x39245f[_0x1da1('0x31')],qs[_0x1da1('0x34')](_0x56044d[_0x1da1('0x2f')]['fields']));_0x2cf747[_0x1da1('0x32')]=_0x2cf747[_0x1da1('0x32')]['length']?_0x2cf747[_0x1da1('0x32')]:_0x39245f[_0x1da1('0x31')];if(_0x56044d['query'][_0x1da1('0x45')]){_0x2cf747[_0x1da1('0x46')]=[{'all':!![]}];}_0x2cf747=_['merge']({},_0x2cf747,_0x56044d[_0x1da1('0x3e')]);return db['SalesforceField'][_0x1da1('0x47')](_0x2cf747)[_0x1da1('0x26')](handleEntityNotFound(_0x59a4b0,null))['then'](respondWithResult(_0x59a4b0,null))['catch'](handleError(_0x59a4b0,null));};exports['create']=function(_0x153360,_0x1d56c2){return db[_0x1da1('0x2b')][_0x1da1('0x48')](_0x153360['body'],{})[_0x1da1('0x26')](respondWithResult(_0x1d56c2,0xc9))['catch'](handleError(_0x1d56c2,null));};exports['update']=function(_0x58c2fc,_0xa0245e){if(_0x58c2fc[_0x1da1('0x49')]['id']){delete _0x58c2fc[_0x1da1('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x58c2fc[_0x1da1('0x43')]['id']}})[_0x1da1('0x26')](handleEntityNotFound(_0xa0245e,null))[_0x1da1('0x26')](saveUpdates(_0x58c2fc[_0x1da1('0x49')],null))[_0x1da1('0x26')](respondWithResult(_0xa0245e,null))[_0x1da1('0x4a')](handleError(_0xa0245e,null));};exports[_0x1da1('0x27')]=function(_0x20b04c,_0xe6d2a3){return db[_0x1da1('0x2b')][_0x1da1('0x47')]({'where':{'id':_0x20b04c[_0x1da1('0x43')]['id']}})[_0x1da1('0x26')](handleEntityNotFound(_0xe6d2a3,null))[_0x1da1('0x26')](removeEntity(_0xe6d2a3,null))['catch'](handleError(_0xe6d2a3,null));}; \ No newline at end of file +var _0x89ff=['index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name'];(function(_0x3838bf,_0x39f6da){var _0x58e5af=function(_0x16086){while(--_0x16086){_0x3838bf['push'](_0x3838bf['shift']());}};_0x58e5af(++_0x39f6da);}(_0x89ff,0xb4));var _0xf89f=function(_0x732d54,_0x5708f4){_0x732d54=_0x732d54-0x0;var _0x55e766=_0x89ff[_0x732d54];return _0x55e766;};'use strict';var pdf=require(_0xf89f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf89f('0x1'));var jsonpatch=require(_0xf89f('0x2'));var rp=require(_0xf89f('0x3'));var moment=require(_0xf89f('0x4'));var BPromise=require(_0xf89f('0x5'));var Mustache=require('mustache');var util=require(_0xf89f('0x6'));var path=require(_0xf89f('0x7'));var sox=require('sox');var csv=require(_0xf89f('0x8'));var ejs=require(_0xf89f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf89f('0xa'));var crypto=require(_0xf89f('0xb'));var jsforce=require(_0xf89f('0xc'));var deskjs=require(_0xf89f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf89f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf89f('0xf'));var as=require(_0xf89f('0x10'));var hardwareService=require(_0xf89f('0x11'));var logger=require(_0xf89f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf89f('0x13'));var licenseUtil=require(_0xf89f('0x14'));var db=require(_0xf89f('0x15'))['db'];function respondWithStatusCode(_0x344adb,_0x5c391e){_0x5c391e=_0x5c391e||0xcc;return function(_0x1e656e){if(_0x1e656e){return _0x344adb['sendStatus'](_0x5c391e);}return _0x344adb[_0xf89f('0x16')](_0x5c391e)[_0xf89f('0x17')]();};}function respondWithResult(_0x534951,_0x29ceb2){_0x29ceb2=_0x29ceb2||0xc8;return function(_0x1bbdd0){if(_0x1bbdd0){return _0x534951[_0xf89f('0x16')](_0x29ceb2)['json'](_0x1bbdd0);}};}function respondWithFilteredResult(_0x3ac433,_0x3f5317){return function(_0x9efe8d){if(_0x9efe8d){var _0x47fd1b=_0x9efe8d[_0xf89f('0x18')],_0x2dd39c=_0x3f5317['offset'],_0x1bd92b=_0x3f5317[_0xf89f('0x19')]+_0x3f5317[_0xf89f('0x1a')],_0x51be86;if(_0x1bd92b>=_0x47fd1b){_0x1bd92b=_0x47fd1b;_0x51be86=0xc8;}else{_0x51be86=0xce;}_0x3ac433[_0xf89f('0x16')](_0x51be86);return _0x3ac433[_0xf89f('0x1b')](_0xf89f('0x1c'),_0x2dd39c+'-'+_0x1bd92b+'/'+_0x47fd1b)[_0xf89f('0x1d')](_0x9efe8d);}return null;};}function patchUpdates(_0xd5de1a){return function(_0x5d985d){try{jsonpatch[_0xf89f('0x1e')](_0x5d985d,_0xd5de1a,!![]);}catch(_0x34d7a6){return BPromise[_0xf89f('0x1f')](_0x34d7a6);}return _0x5d985d[_0xf89f('0x20')]();};}function saveUpdates(_0x5f321d,_0x4698f1){return function(_0x2dc3b8){if(_0x2dc3b8){return _0x2dc3b8[_0xf89f('0x21')](_0x5f321d)[_0xf89f('0x22')](function(_0x5a1f53){return _0x5a1f53;});}return null;};}function removeEntity(_0x216862,_0x25fdaf){return function(_0x4ad8c1){if(_0x4ad8c1){return _0x4ad8c1[_0xf89f('0x23')]()[_0xf89f('0x22')](function(){_0x216862[_0xf89f('0x16')](0xcc)[_0xf89f('0x17')]();});}};}function handleEntityNotFound(_0x36de82,_0x1ed868){return function(_0x41033d){if(!_0x41033d){_0x36de82[_0xf89f('0x24')](0x194);}return _0x41033d;};}function handleError(_0x31cdca,_0x5bf4fa){_0x5bf4fa=_0x5bf4fa||0x1f4;return function(_0x54af1c){logger['error'](_0x54af1c[_0xf89f('0x25')]);if(_0x54af1c[_0xf89f('0x26')]){delete _0x54af1c['name'];}_0x31cdca[_0xf89f('0x16')](_0x5bf4fa)['send'](_0x54af1c);};}exports[_0xf89f('0x27')]=function(_0x42880d,_0x349495){var _0xab5659={},_0x55f483={},_0x1b2c9c={'count':0x0,'rows':[]};var _0x2fabfd=_[_0xf89f('0x28')](db[_0xf89f('0x29')][_0xf89f('0x2a')],function(_0x989620){return{'name':_0x989620[_0xf89f('0x2b')],'type':_0x989620[_0xf89f('0x2c')][_0xf89f('0x2d')]};});_0x55f483[_0xf89f('0x2e')]=_['map'](_0x2fabfd,'name');_0x55f483['query']=_[_0xf89f('0x2f')](_0x42880d[_0xf89f('0x30')]);_0x55f483[_0xf89f('0x31')]=_[_0xf89f('0x32')](_0x55f483[_0xf89f('0x2e')],_0x55f483[_0xf89f('0x30')]);_0xab5659[_0xf89f('0x33')]=_['intersection'](_0x55f483[_0xf89f('0x2e')],qs[_0xf89f('0x34')](_0x42880d['query'][_0xf89f('0x34')]));_0xab5659[_0xf89f('0x33')]=_0xab5659[_0xf89f('0x33')][_0xf89f('0x35')]?_0xab5659[_0xf89f('0x33')]:_0x55f483[_0xf89f('0x2e')];if(!_0x42880d[_0xf89f('0x30')][_0xf89f('0x36')](_0xf89f('0x37'))){_0xab5659['limit']=qs[_0xf89f('0x1a')](_0x42880d['query']['limit']);_0xab5659[_0xf89f('0x19')]=qs[_0xf89f('0x19')](_0x42880d[_0xf89f('0x30')]['offset']);}_0xab5659[_0xf89f('0x38')]=qs[_0xf89f('0x39')](_0x42880d[_0xf89f('0x30')][_0xf89f('0x39')]);_0xab5659[_0xf89f('0x3a')]=qs[_0xf89f('0x31')](_[_0xf89f('0x3b')](_0x42880d['query'],_0x55f483[_0xf89f('0x31')]),_0x2fabfd);if(_0x42880d[_0xf89f('0x30')][_0xf89f('0x3c')]){_0xab5659['where']=_[_0xf89f('0x3d')](_0xab5659[_0xf89f('0x3a')],{'$or':_[_0xf89f('0x28')](_0x2fabfd,function(_0x4f1058){if(_0x4f1058[_0xf89f('0x2c')]!==_0xf89f('0x3e')){var _0x320c53={};_0x320c53[_0x4f1058[_0xf89f('0x26')]]={'$like':'%'+_0x42880d[_0xf89f('0x30')][_0xf89f('0x3c')]+'%'};return _0x320c53;}})});}_0xab5659=_[_0xf89f('0x3d')]({},_0xab5659,_0x42880d[_0xf89f('0x3f')]);var _0xce1512={'where':_0xab5659[_0xf89f('0x3a')]};return db['SalesforceField'][_0xf89f('0x18')](_0xce1512)[_0xf89f('0x22')](function(_0x35d482){_0x1b2c9c['count']=_0x35d482;if(_0x42880d['query'][_0xf89f('0x40')]){_0xab5659['include']=[{'all':!![]}];}return db[_0xf89f('0x29')][_0xf89f('0x41')](_0xab5659);})['then'](function(_0x4552be){_0x1b2c9c[_0xf89f('0x42')]=_0x4552be;return _0x1b2c9c;})[_0xf89f('0x22')](respondWithFilteredResult(_0x349495,_0xab5659))[_0xf89f('0x43')](handleError(_0x349495,null));};exports['show']=function(_0x71a1b8,_0x1897ff){var _0x1b43c9={'raw':!![],'where':{'id':_0x71a1b8[_0xf89f('0x44')]['id']}},_0x26041c={};_0x26041c[_0xf89f('0x2e')]=_['keys'](db[_0xf89f('0x29')][_0xf89f('0x2a')]);_0x26041c[_0xf89f('0x30')]=_['keys'](_0x71a1b8[_0xf89f('0x30')]);_0x26041c['filters']=_[_0xf89f('0x32')](_0x26041c[_0xf89f('0x2e')],_0x26041c['query']);_0x1b43c9[_0xf89f('0x33')]=_['intersection'](_0x26041c[_0xf89f('0x2e')],qs[_0xf89f('0x34')](_0x71a1b8[_0xf89f('0x30')][_0xf89f('0x34')]));_0x1b43c9[_0xf89f('0x33')]=_0x1b43c9['attributes'][_0xf89f('0x35')]?_0x1b43c9[_0xf89f('0x33')]:_0x26041c[_0xf89f('0x2e')];if(_0x71a1b8[_0xf89f('0x30')][_0xf89f('0x40')]){_0x1b43c9[_0xf89f('0x45')]=[{'all':!![]}];}_0x1b43c9=_[_0xf89f('0x3d')]({},_0x1b43c9,_0x71a1b8[_0xf89f('0x3f')]);return db[_0xf89f('0x29')][_0xf89f('0x46')](_0x1b43c9)[_0xf89f('0x22')](handleEntityNotFound(_0x1897ff,null))[_0xf89f('0x22')](respondWithResult(_0x1897ff,null))['catch'](handleError(_0x1897ff,null));};exports[_0xf89f('0x47')]=function(_0x391e0e,_0x2de88a){return db['SalesforceField'][_0xf89f('0x47')](_0x391e0e[_0xf89f('0x48')],{})['then'](respondWithResult(_0x2de88a,0xc9))[_0xf89f('0x43')](handleError(_0x2de88a,null));};exports[_0xf89f('0x21')]=function(_0x4e451e,_0x5434a1){if(_0x4e451e[_0xf89f('0x48')]['id']){delete _0x4e451e['body']['id'];}return db[_0xf89f('0x29')]['find']({'where':{'id':_0x4e451e['params']['id']}})[_0xf89f('0x22')](handleEntityNotFound(_0x5434a1,null))[_0xf89f('0x22')](saveUpdates(_0x4e451e['body'],null))['then'](respondWithResult(_0x5434a1,null))[_0xf89f('0x43')](handleError(_0x5434a1,null));};exports[_0xf89f('0x23')]=function(_0x25c329,_0x1b11bc){return db[_0xf89f('0x29')][_0xf89f('0x46')]({'where':{'id':_0x25c329[_0xf89f('0x44')]['id']}})[_0xf89f('0x22')](handleEntityNotFound(_0x1b11bc,null))['then'](removeEntity(_0x1b11bc,null))[_0xf89f('0x43')](handleError(_0x1b11bc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 83d8303..886604e 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 _0x17a0=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x574af4,_0x1a668e){var _0xd915d4=function(_0x193e50){while(--_0x193e50){_0x574af4['push'](_0x574af4['shift']());}};_0xd915d4(++_0x1a668e);}(_0x17a0,0x165));var _0x017a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x17a0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x017a('0x0'));var logger=require(_0x017a('0x1'))(_0x017a('0x2'));var moment=require('moment');var BPromise=require(_0x017a('0x3'));var rp=require(_0x017a('0x4'));var fs=require('fs');var path=require(_0x017a('0x5'));var rimraf=require(_0x017a('0x6'));var config=require('../../config/environment');var attributes=require(_0x017a('0x7'));module[_0x017a('0x8')]=function(_0x3fccd9,_0x8d767f){return _0x3fccd9[_0x017a('0x9')](_0x017a('0xa'),attributes,{'tableName':_0x017a('0xb'),'paranoid':![],'indexes':[{'name':_0x017a('0xc'),'fields':[_0x017a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc69c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x4e2b73,_0x5dfde9){var _0xa03b99=function(_0x2a3c39){while(--_0x2a3c39){_0x4e2b73['push'](_0x4e2b73['shift']());}};_0xa03b99(++_0x5dfde9);}(_0xc69c,0x1ee));var _0xcc69=function(_0x26cd05,_0x1f7d74){_0x26cd05=_0x26cd05-0x0;var _0x3e13b9=_0xc69c[_0x26cd05];return _0x3e13b9;};'use strict';var _=require(_0xcc69('0x0'));var util=require('util');var logger=require(_0xcc69('0x1'))(_0xcc69('0x2'));var moment=require(_0xcc69('0x3'));var BPromise=require(_0xcc69('0x4'));var rp=require(_0xcc69('0x5'));var fs=require('fs');var path=require(_0xcc69('0x6'));var rimraf=require(_0xcc69('0x7'));var config=require(_0xcc69('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xcc69('0x9')]=function(_0x3182cc,_0x56fde8){return _0x3182cc[_0xcc69('0xa')](_0xcc69('0xb'),attributes,{'tableName':_0xcc69('0xc'),'paranoid':![],'indexes':[{'name':_0xcc69('0xd'),'fields':[_0xcc69('0xe'),_0xcc69('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 554349d..05956a5 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(_0x7732b9,_0x54bbd1){var _0x3b5af9=function(_0x3ff949){while(--_0x3ff949){_0x7732b9['push'](_0x7732b9['shift']());}};_0x3b5af9(++_0x54bbd1);}(_0x153f,0x15b));var _0xf153=function(_0xeb4bd7,_0xfd50b2){_0xeb4bd7=_0xeb4bd7-0x0;var _0x2aa7c1=_0x153f[_0xeb4bd7];return _0x2aa7c1;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0xe5b5[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('SalesforceField,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6b94fdf..f42269f 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 _0x16a8=['update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x16a8,0xb4));var _0x816a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x16a8[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x816a('0x0'));var util=require('util');var path=require(_0x816a('0x1'));var timeout=require(_0x816a('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x816a('0x3'));var interaction=require(_0x816a('0x4'));var config=require(_0x816a('0x5'));var controller=require(_0x816a('0x6'));router[_0x816a('0x7')]('/',auth[_0x816a('0x8')](),controller[_0x816a('0x9')]);router[_0x816a('0x7')](_0x816a('0xa'),auth['isAuthenticated'](),controller[_0x816a('0xb')]);router[_0x816a('0x7')](_0x816a('0xc'),auth[_0x816a('0x8')](),controller[_0x816a('0xd')]);router[_0x816a('0x7')](_0x816a('0xe'),auth[_0x816a('0x8')](),controller[_0x816a('0xf')]);router[_0x816a('0x10')]('/',auth[_0x816a('0x8')](),controller['create']);router[_0x816a('0x10')](_0x816a('0xc'),auth[_0x816a('0x8')](),controller[_0x816a('0x11')]);router['put']('/:id',auth[_0x816a('0x8')](),controller[_0x816a('0x12')]);router[_0x816a('0x13')](_0x816a('0xa'),auth[_0x816a('0x8')](),controller[_0x816a('0x14')]);module[_0x816a('0x15')]=router; \ No newline at end of file +var _0xf5da=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','getFields','post','create','update','delete'];(function(_0x26c169,_0x45cc97){var _0x544051=function(_0x577093){while(--_0x577093){_0x26c169['push'](_0x26c169['shift']());}};_0x544051(++_0x45cc97);}(_0xf5da,0x1a6));var _0xaf5d=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xf5da[_0x3df9dd];return _0x4f11e4;};'use strict';var multer=require(_0xaf5d('0x0'));var util=require(_0xaf5d('0x1'));var path=require(_0xaf5d('0x2'));var timeout=require(_0xaf5d('0x3'));var express=require(_0xaf5d('0x4'));var router=express[_0xaf5d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf5d('0x6'));var config=require(_0xaf5d('0x7'));var controller=require(_0xaf5d('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaf5d('0x9'),auth[_0xaf5d('0xa')](),controller['show']);router[_0xaf5d('0xb')](_0xaf5d('0xc'),auth[_0xaf5d('0xa')](),controller[_0xaf5d('0xd')]);router[_0xaf5d('0xb')]('/:id/fields',auth[_0xaf5d('0xa')](),controller[_0xaf5d('0xe')]);router[_0xaf5d('0xf')]('/',auth['isAuthenticated'](),controller[_0xaf5d('0x10')]);router[_0xaf5d('0xf')](_0xaf5d('0xc'),auth[_0xaf5d('0xa')](),controller['addConfiguration']);router['put'](_0xaf5d('0x9'),auth[_0xaf5d('0xa')](),controller[_0xaf5d('0x11')]);router[_0xaf5d('0x12')]('/:id',auth[_0xaf5d('0xa')](),controller[_0xaf5d('0x13')]);module[_0xaf5d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 853aae7..4bb17cf 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 _0x6f5e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x542994,_0x5bc517){var _0x39dd11=function(_0x55d86c){while(--_0x55d86c){_0x542994['push'](_0x542994['shift']());}};_0x39dd11(++_0x5bc517);}(_0x6f5e,0x15a));var _0xe6f5=function(_0x2e666f,_0x1bc5f3){_0x2e666f=_0x2e666f-0x0;var _0x455047=_0x6f5e[_0x2e666f];return _0x455047;};'use strict';var Sequelize=require(_0xe6f5('0x0'));module[_0xe6f5('0x1')]={'name':{'type':Sequelize[_0xe6f5('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xe6f5('0x3')},'password':{'type':Sequelize[_0xe6f5('0x2')]},'email':{'type':Sequelize[_0xe6f5('0x2')]},'remoteUri':{'type':Sequelize[_0xe6f5('0x2')],'unique':_0xe6f5('0x4')},'serverUrl':{'type':Sequelize[_0xe6f5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf44e=['remoteUri','sequelize','STRING','username'];(function(_0x2ecd72,_0xb6f7d4){var _0x586778=function(_0x580c4e){while(--_0x580c4e){_0x2ecd72['push'](_0x2ecd72['shift']());}};_0x586778(++_0xb6f7d4);}(_0xf44e,0x1cd));var _0xef44=function(_0x2808a9,_0x1e82e3){_0x2808a9=_0x2808a9-0x0;var _0x2385dd=_0xf44e[_0x2808a9];return _0x2385dd;};'use strict';var Sequelize=require(_0xef44('0x0'));module['exports']={'name':{'type':Sequelize[_0xef44('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xef44('0x1')],'unique':_0xef44('0x2')},'password':{'type':Sequelize[_0xef44('0x1')]},'email':{'type':Sequelize[_0xef44('0x1')]},'remoteUri':{'type':Sequelize[_0xef44('0x1')],'unique':_0xef44('0x3')},'serverUrl':{'type':Sequelize[_0xef44('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 45323f4..5bce748 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 _0x1ccd=['user_input','sys_created_on','state','sys_created_by','knowledge','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','resolved_at','subcategory','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','Wrong\x20credentials','boolean','true','False','false','GET','inactive','value','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','ServicenowAccount','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','getFields','hold_reason','close_code','notify','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by'];(function(_0x2a92b5,_0x519146){var _0x204b4e=function(_0x53fd2){while(--_0x53fd2){_0x2a92b5['push'](_0x2a92b5['shift']());}};_0x204b4e(++_0x519146);}(_0x1ccd,0x1dd));var _0xd1cc=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x1ccd[_0x243217];return _0x478029;};'use strict';var pdf=require(_0xd1cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd1cc('0x1'));var zipdir=require(_0xd1cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1cc('0x3'));var moment=require(_0xd1cc('0x4'));var BPromise=require(_0xd1cc('0x5'));var Mustache=require(_0xd1cc('0x6'));var util=require(_0xd1cc('0x7'));var path=require(_0xd1cc('0x8'));var sox=require(_0xd1cc('0x9'));var csv=require(_0xd1cc('0xa'));var ejs=require(_0xd1cc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd1cc('0xc'));var crypto=require(_0xd1cc('0xd'));var jsforce=require(_0xd1cc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd1cc('0xa'));var querystring=require(_0xd1cc('0xf'));var Papa=require(_0xd1cc('0x10'));var Redis=require(_0xd1cc('0x11'));var authService=require(_0xd1cc('0x12'));var qs=require(_0xd1cc('0x13'));var as=require(_0xd1cc('0x14'));var hardwareService=require(_0xd1cc('0x15'));var logger=require(_0xd1cc('0x16'))('api');var utils=require(_0xd1cc('0x17'));var config=require(_0xd1cc('0x18'));var licenseUtil=require(_0xd1cc('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd1cc('0x1a'));var jayson=require(_0xd1cc('0x1b'));var client=jayson[_0xd1cc('0x1c')][_0xd1cc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54b8dc,_0xb39452,_0x18889b,_0x398d25){return new BPromise(function(_0x3c1fe9,_0x278e46){var _0x3fdea4=_0x398d25||client;return _0x3fdea4['request'](_0x54b8dc,_0x18889b)[_0xd1cc('0x1e')](function(_0xc99cc9){logger['info'](_0xd1cc('0x1f'),_0xb39452,_0xd1cc('0x20'));logger[_0xd1cc('0x21')](_0xd1cc('0x22'),_0xb39452,_0xd1cc('0x20'),JSON['stringify'](_0xc99cc9));if(_0xc99cc9['error']){if(_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x24')]===0x1f4){logger[_0xd1cc('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0xb39452,_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x25')]);return _0x278e46(_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x25')]);}logger[_0xd1cc('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0xb39452,_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x25')]);return _0x3c1fe9(_0xc99cc9['error'][_0xd1cc('0x25')]);}else{logger[_0xd1cc('0x26')](_0xd1cc('0x1f'),_0xb39452,'request\x20sent');_0x3c1fe9(_0xc99cc9['result'][_0xd1cc('0x25')]);}})[_0xd1cc('0x27')](function(_0x56be19){logger[_0xd1cc('0x23')](_0xd1cc('0x1f'),_0xb39452,_0x56be19);_0x278e46(_0x56be19);});});}function respondWithStatusCode(_0x3babaf,_0x1cbeb9){_0x1cbeb9=_0x1cbeb9||0xcc;return function(_0x3baed2){if(_0x3baed2){return _0x3babaf[_0xd1cc('0x28')](_0x1cbeb9);}return _0x3babaf['status'](_0x1cbeb9)[_0xd1cc('0x29')]();};}function respondWithResult(_0x4632de,_0x5566e3){_0x5566e3=_0x5566e3||0xc8;return function(_0x323579){if(_0x323579){return _0x4632de[_0xd1cc('0x2a')](_0x5566e3)[_0xd1cc('0x2b')](_0x323579);}};}function respondWithFilteredResult(_0x1dd0da,_0x42eab1){return function(_0x130ae2){if(_0x130ae2){var _0x59572a=_0x130ae2[_0xd1cc('0x2c')],_0x9ed080=_0x42eab1[_0xd1cc('0x2d')],_0x38964d=_0x42eab1['offset']+_0x42eab1[_0xd1cc('0x2e')],_0x1eae63;if(_0x38964d>=_0x59572a){_0x38964d=_0x59572a;_0x1eae63=0xc8;}else{_0x1eae63=0xce;}_0x1dd0da[_0xd1cc('0x2a')](_0x1eae63);return _0x1dd0da[_0xd1cc('0x2f')](_0xd1cc('0x30'),_0x9ed080+'-'+_0x38964d+'/'+_0x59572a)[_0xd1cc('0x2b')](_0x130ae2);}return null;};}function patchUpdates(_0x3b0bcd){return function(_0x3b3da4){try{jsonpatch[_0xd1cc('0x31')](_0x3b3da4,_0x3b0bcd,!![]);}catch(_0x318b63){return BPromise[_0xd1cc('0x32')](_0x318b63);}return _0x3b3da4[_0xd1cc('0x33')]();};}function saveUpdates(_0x368ee0,_0x1e9048){return function(_0x577667){if(_0x577667){return _0x577667[_0xd1cc('0x34')](_0x368ee0)[_0xd1cc('0x1e')](function(_0x22f6ba){return _0x22f6ba;});}return null;};}function removeEntity(_0x4442b7,_0x2ad47b){return function(_0x435b4f){if(_0x435b4f){return _0x435b4f[_0xd1cc('0x35')]()['then'](function(){_0x4442b7[_0xd1cc('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52abc9,_0x4faba3){return function(_0x2529f4){if(!_0x2529f4){_0x52abc9['sendStatus'](0x194);}return _0x2529f4;};}function handleError(_0x40a6b4,_0x50019e){_0x50019e=_0x50019e||0x1f4;return function(_0x159bd3){logger[_0xd1cc('0x23')](_0x159bd3[_0xd1cc('0x36')]);if(_0x159bd3[_0xd1cc('0x37')]){delete _0x159bd3['name'];}_0x40a6b4[_0xd1cc('0x2a')](_0x50019e)[_0xd1cc('0x38')](_0x159bd3);};}exports['index']=function(_0x53b411,_0xf91a89){var _0x30b5f3={},_0x4beb71={},_0x3a3a3a={'count':0x0,'rows':[]};var _0x46840a=_[_0xd1cc('0x39')](db[_0xd1cc('0x3a')]['rawAttributes'],function(_0x5e954d){return{'name':_0x5e954d[_0xd1cc('0x3b')],'type':_0x5e954d[_0xd1cc('0x3c')]['key']};});_0x4beb71[_0xd1cc('0x3d')]=_[_0xd1cc('0x39')](_0x46840a,_0xd1cc('0x37'));_0x4beb71[_0xd1cc('0x3e')]=_['keys'](_0x53b411[_0xd1cc('0x3e')]);_0x4beb71['filters']=_['intersection'](_0x4beb71[_0xd1cc('0x3d')],_0x4beb71[_0xd1cc('0x3e')]);_0x30b5f3[_0xd1cc('0x3f')]=_[_0xd1cc('0x40')](_0x4beb71[_0xd1cc('0x3d')],qs['fields'](_0x53b411['query'][_0xd1cc('0x41')]));_0x30b5f3[_0xd1cc('0x3f')]=_0x30b5f3['attributes'][_0xd1cc('0x42')]?_0x30b5f3[_0xd1cc('0x3f')]:_0x4beb71[_0xd1cc('0x3d')];if(!_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x43')](_0xd1cc('0x44'))){_0x30b5f3['limit']=qs[_0xd1cc('0x2e')](_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x2e')]);_0x30b5f3[_0xd1cc('0x2d')]=qs['offset'](_0x53b411['query'][_0xd1cc('0x2d')]);}_0x30b5f3[_0xd1cc('0x45')]=qs['sort'](_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x46')]);_0x30b5f3[_0xd1cc('0x47')]=qs[_0xd1cc('0x48')](_[_0xd1cc('0x49')](_0x53b411['query'],_0x4beb71[_0xd1cc('0x48')]),_0x46840a);if(_0x53b411[_0xd1cc('0x3e')]['filter']){_0x30b5f3[_0xd1cc('0x47')]=_[_0xd1cc('0x4a')](_0x30b5f3[_0xd1cc('0x47')],{'$or':_[_0xd1cc('0x39')](_0x46840a,function(_0x783594){if(_0x783594[_0xd1cc('0x3c')]!=='VIRTUAL'){var _0x3d2f6f={};_0x3d2f6f[_0x783594[_0xd1cc('0x37')]]={'$like':'%'+_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x4b')]+'%'};return _0x3d2f6f;}})});}_0x30b5f3=_[_0xd1cc('0x4a')]({},_0x30b5f3,_0x53b411[_0xd1cc('0x4c')]);var _0x4de5ee={'where':_0x30b5f3[_0xd1cc('0x47')]};return db[_0xd1cc('0x3a')][_0xd1cc('0x2c')](_0x4de5ee)[_0xd1cc('0x1e')](function(_0x277665){_0x3a3a3a[_0xd1cc('0x2c')]=_0x277665;if(_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x4d')]){_0x30b5f3[_0xd1cc('0x4e')]=[{'all':!![]}];}return db[_0xd1cc('0x3a')]['findAll'](_0x30b5f3);})['then'](function(_0x1fffb9){_0x3a3a3a[_0xd1cc('0x4f')]=_0x1fffb9;return _0x3a3a3a;})[_0xd1cc('0x1e')](respondWithFilteredResult(_0xf91a89,_0x30b5f3))['catch'](handleError(_0xf91a89,null));};exports[_0xd1cc('0x50')]=function(_0x3c4c60,_0x5a8772){var _0x21d39d={'raw':![],'where':{'id':_0x3c4c60[_0xd1cc('0x51')]['id']}},_0x282025={};_0x282025['model']=_[_0xd1cc('0x52')](db['ServicenowAccount'][_0xd1cc('0x53')]);_0x282025[_0xd1cc('0x3e')]=_['keys'](_0x3c4c60[_0xd1cc('0x3e')]);_0x282025[_0xd1cc('0x48')]=_[_0xd1cc('0x40')](_0x282025[_0xd1cc('0x3d')],_0x282025['query']);_0x21d39d[_0xd1cc('0x3f')]=_[_0xd1cc('0x40')](_0x282025[_0xd1cc('0x3d')],qs[_0xd1cc('0x41')](_0x3c4c60[_0xd1cc('0x3e')][_0xd1cc('0x41')]));_0x21d39d[_0xd1cc('0x3f')]=_0x21d39d['attributes'][_0xd1cc('0x42')]?_0x21d39d['attributes']:_0x282025['model'];if(_0x3c4c60[_0xd1cc('0x3e')][_0xd1cc('0x4d')]){_0x21d39d['include']=[{'all':!![]}];}_0x21d39d=_[_0xd1cc('0x4a')]({},_0x21d39d,_0x3c4c60['options']);return db[_0xd1cc('0x3a')][_0xd1cc('0x54')](_0x21d39d)['then'](handleEntityNotFound(_0x5a8772,null))[_0xd1cc('0x1e')](respondWithResult(_0x5a8772,null))[_0xd1cc('0x27')](handleError(_0x5a8772,null));};exports[_0xd1cc('0x55')]=function(_0x11a1ab,_0x52efe9){return db[_0xd1cc('0x3a')][_0xd1cc('0x55')](_0x11a1ab[_0xd1cc('0x56')],{})[_0xd1cc('0x1e')](respondWithResult(_0x52efe9,0xc9))[_0xd1cc('0x27')](handleError(_0x52efe9,null));};exports[_0xd1cc('0x34')]=function(_0x35e20d,_0x221187){if(_0x35e20d[_0xd1cc('0x56')]['id']){delete _0x35e20d[_0xd1cc('0x56')]['id'];}return db[_0xd1cc('0x3a')][_0xd1cc('0x54')]({'where':{'id':_0x35e20d[_0xd1cc('0x51')]['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x221187,null))['then'](saveUpdates(_0x35e20d[_0xd1cc('0x56')],null))['then'](respondWithResult(_0x221187,null))[_0xd1cc('0x27')](handleError(_0x221187,null));};exports[_0xd1cc('0x35')]=function(_0x4bc492,_0x1655b4){return db['ServicenowAccount'][_0xd1cc('0x54')]({'where':{'id':_0x4bc492['params']['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x1655b4,null))[_0xd1cc('0x1e')](removeEntity(_0x1655b4,null))[_0xd1cc('0x27')](handleError(_0x1655b4,null));};exports[_0xd1cc('0x57')]=function(_0x309996,_0x4098c8,_0x27faa2){var _0x1fe285={};var _0x143958={};var _0x383ddc;var _0x39c866;return db[_0xd1cc('0x3a')][_0xd1cc('0x58')]({'where':{'id':_0x309996[_0xd1cc('0x51')]['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x4098c8,null))[_0xd1cc('0x1e')](function(_0x51b0ae){if(_0x51b0ae){_0x383ddc=_0x51b0ae;_0x143958[_0xd1cc('0x3d')]=_['keys'](db[_0xd1cc('0x59')]['rawAttributes']);_0x143958['query']=_['keys'](_0x309996[_0xd1cc('0x3e')]);_0x143958['filters']=_[_0xd1cc('0x40')](_0x143958[_0xd1cc('0x3d')],_0x143958[_0xd1cc('0x3e')]);_0x1fe285['attributes']=_['intersection'](_0x143958['model'],qs[_0xd1cc('0x41')](_0x309996['query'][_0xd1cc('0x41')]));_0x1fe285[_0xd1cc('0x3f')]=_0x1fe285[_0xd1cc('0x3f')]['length']?_0x1fe285[_0xd1cc('0x3f')]:_0x143958[_0xd1cc('0x3d')];_0x1fe285[_0xd1cc('0x45')]=qs[_0xd1cc('0x46')](_0x309996[_0xd1cc('0x3e')][_0xd1cc('0x46')]);_0x1fe285['where']=qs['filters'](_[_0xd1cc('0x49')](_0x309996[_0xd1cc('0x3e')],_0x143958[_0xd1cc('0x48')]));if(_0x309996['query'][_0xd1cc('0x4b')]){_0x1fe285[_0xd1cc('0x47')]=_[_0xd1cc('0x4a')](_0x1fe285[_0xd1cc('0x47')],{'$or':_[_0xd1cc('0x39')](_0x1fe285[_0xd1cc('0x3f')],function(_0x366a01){var _0xdaf6ab={};_0xdaf6ab[_0x366a01]={'$like':'%'+_0x309996['query']['filter']+'%'};return _0xdaf6ab;})});}_0x1fe285=_['merge']({},_0x1fe285,_0x309996[_0xd1cc('0x4c')]);return _0x383ddc[_0xd1cc('0x57')](_0x1fe285);}})[_0xd1cc('0x1e')](function(_0x47b7cd){if(_0x47b7cd){_0x39c866=_0x47b7cd[_0xd1cc('0x42')];if(!_0x309996[_0xd1cc('0x3e')][_0xd1cc('0x43')](_0xd1cc('0x44'))){_0x1fe285[_0xd1cc('0x2e')]=qs['limit'](_0x309996[_0xd1cc('0x3e')][_0xd1cc('0x2e')]);_0x1fe285[_0xd1cc('0x2d')]=qs[_0xd1cc('0x2d')](_0x309996['query'][_0xd1cc('0x2d')]);}return _0x383ddc[_0xd1cc('0x57')](_0x1fe285);}})[_0xd1cc('0x1e')](function(_0x9ca36){if(_0x9ca36){return _0x9ca36?{'count':_0x39c866,'rows':_0x9ca36}:null;}})[_0xd1cc('0x1e')](respondWithResult(_0x4098c8,null))[_0xd1cc('0x27')](handleError(_0x4098c8,null));};exports[_0xd1cc('0x5a')]=function(_0x2c1f99,_0x3bf512,_0x22678b){if(_0x2c1f99[_0xd1cc('0x56')]['id']){delete _0x2c1f99[_0xd1cc('0x56')]['id'];}return db[_0xd1cc('0x3a')]['findOne']({'where':{'id':_0x2c1f99['params']['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x3bf512,null))[_0xd1cc('0x1e')](function(_0x3d88dc){if(_0x3d88dc){_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x5b')]=_0x3d88dc['id'];_0x2c1f99['body']['Subjects']=integrations[_0xd1cc('0x5c')](_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x5d')],_0x2c1f99[_0xd1cc('0x56')]['type']);_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x5e')]=integrations['getDescriptions'](_0x2c1f99['body'][_0xd1cc('0x5d')],_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x3c')]);return db[_0xd1cc('0x59')][_0xd1cc('0x55')](_0x2c1f99[_0xd1cc('0x56')],{'include':[{'model':db[_0xd1cc('0x5f')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0xd1cc('0x5e')}]});}return null;})['then'](respondWithResult(_0x3bf512,null))[_0xd1cc('0x27')](handleError(_0x3bf512,null));};exports[_0xd1cc('0x60')]=function(_0x1a2dec,_0x58eff3,_0x3d6026){var _0x219452=['made_sla',_0xd1cc('0x61'),'knowledge','subcategory',_0xd1cc('0x62'),_0xd1cc('0x63'),'incident_state',_0xd1cc('0x64'),_0xd1cc('0x65')];var _0x29c8f3=[_0xd1cc('0x66'),_0xd1cc('0x67'),_0xd1cc('0x68'),_0xd1cc('0x69'),_0xd1cc('0x6a'),_0xd1cc('0x6b'),'child_incidents',_0xd1cc('0x61'),'approval_history',_0xd1cc('0x6c'),_0xd1cc('0x6d'),_0xd1cc('0x6e'),'opened_by',_0xd1cc('0x6f'),_0xd1cc('0x70'),'sys_domain',_0xd1cc('0x71'),_0xd1cc('0x72'),_0xd1cc('0x73'),'order','calendar_stc','closed_at',_0xd1cc('0x74'),_0xd1cc('0x75'),_0xd1cc('0x76'),_0xd1cc('0x77'),_0xd1cc('0x78'),_0xd1cc('0x79'),_0xd1cc('0x7a'),_0xd1cc('0x7b'),_0xd1cc('0x7c'),_0xd1cc('0x7d'),'expected_start',_0xd1cc('0x7e'),'business_duration',_0xd1cc('0x7f'),_0xd1cc('0x80'),'reopened_time',_0xd1cc('0x81'),'caller_id','approval_set',_0xd1cc('0x82'),_0xd1cc('0x83'),'short_description',_0xd1cc('0x62'),_0xd1cc('0x84'),_0xd1cc('0x85'),_0xd1cc('0x86'),_0xd1cc('0x87'),_0xd1cc('0x88'),_0xd1cc('0x89'),_0xd1cc('0x8a'),_0xd1cc('0x8b'),'notify',_0xd1cc('0x8c'),_0xd1cc('0x8d'),_0xd1cc('0x8e'),_0xd1cc('0x8f'),_0xd1cc('0x90'),_0xd1cc('0x91'),_0xd1cc('0x92'),_0xd1cc('0x93'),_0xd1cc('0x94'),_0xd1cc('0x95'),_0xd1cc('0x96'),_0xd1cc('0x97'),_0xd1cc('0x98'),'activity_due',_0xd1cc('0x99'),'severity',_0xd1cc('0x9a'),_0xd1cc('0x9b'),_0xd1cc('0x9c'),_0xd1cc('0x9d'),_0xd1cc('0x9e'),'sys_mod_count',_0xd1cc('0x9f'),'sys_tags',_0xd1cc('0xa0'),_0xd1cc('0xa1'),_0xd1cc('0xa2'),_0xd1cc('0xa3'),'category'];var _0x5b79e8='';var _0x21ce15='';var _0x5b53fb=[];var _0x3f75b4='';var _0x2d48fa='';var _0xabbb03=[];var _0x2e3077='';var _0x36da67='';var _0x17721e={};var _0xfe3466='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x1a2dec[_0xd1cc('0x51')]['id']},'attributes':['id',_0xd1cc('0xa4'),_0xd1cc('0xa5'),_0xd1cc('0xa6'),_0xd1cc('0xa7'),_0xd1cc('0xa8')]})[_0xd1cc('0x1e')](handleEntityNotFound(_0x58eff3,null))[_0xd1cc('0x1e')](function(_0x51a461){if(_0x51a461){_0xfe3466=_0x51a461['remoteUri'];var _0x52ac4c=_0xfe3466[_0xd1cc('0xa9')](-0x1);if(_0x52ac4c==='/'){_0xfe3466=_0xfe3466[_0xd1cc('0xaa')](0x0,_0xfe3466[_0xd1cc('0xab')](_0x52ac4c));}_0x36da67=util['format']('%s/api/now/doc/table/schema/',_0xfe3466);_0x2e3077=util[_0xd1cc('0xac')](_0xd1cc('0xad'),_0xfe3466);_0x17721e={'user':_0x51a461[_0xd1cc('0xa4')],'pass':_0x51a461['password']};var _0x4794ac={'method':'GET','uri':_0x36da67+_0xd1cc('0xae'),'auth':_0x17721e,'json':!![]};return rp(_0x4794ac);}})[_0xd1cc('0x1e')](function(_0x490f8f){if(_0x490f8f[_0xd1cc('0xaf')][_0xd1cc('0x42')]>0x0){_0x5b79e8=_0x490f8f[_0xd1cc('0xaf')];}console[_0xd1cc('0xb0')]('incident\x20table\x20objects',_0x5b79e8);_0xabbb03=[];_0x21ce15=Object[_0xd1cc('0xb1')]([],_0x5b79e8);_[_0xd1cc('0xb2')](_0x21ce15,function(_0x4ac63a){return!_0x219452[_0xd1cc('0xb3')](_0x4ac63a['name']);});_0x21ce15[_0xd1cc('0xb4')](function(_0x51cbfb){var _0x24736a=createFieldObject(_0x2e3077,_0x17721e,_0x51cbfb[_0xd1cc('0xb5')],_0x51cbfb[_0xd1cc('0x37')],_0x51cbfb[_0xd1cc('0xb6')],![]);_0xabbb03[_0xd1cc('0xb7')](_0x24736a);});return Promise[_0xd1cc('0xb8')](_0xabbb03);})[_0xd1cc('0x1e')](function(_0x5193a8){_0x5b53fb=_0x5193a8;_0x3f75b4=Object[_0xd1cc('0xb1')]([],_0x5b79e8);console[_0xd1cc('0xb0')]('TCL:\x20_object',_0x5b79e8);_[_0xd1cc('0xb2')](_0x3f75b4,function(_0xa9234a){return _0x29c8f3[_0xd1cc('0xb3')](_0xa9234a[_0xd1cc('0x37')]);});console[_0xd1cc('0xb0')](_0xd1cc('0xb9'),_0x3f75b4);_0xabbb03=[];_0x3f75b4[_0xd1cc('0xb4')](function(_0x4f0185){var _0x1078e4=createFieldObject(_0x2e3077,_0x17721e,_0x4f0185[_0xd1cc('0xb5')],_0x4f0185[_0xd1cc('0x37')],_0x4f0185[_0xd1cc('0xb6')],!![]);_0xabbb03[_0xd1cc('0xb7')](_0x1078e4);});return Promise[_0xd1cc('0xb8')](_0xabbb03);})[_0xd1cc('0x1e')](function(_0x33f25f){_0x2d48fa=_0x33f25f;var _0x3044ed=_0x5b53fb['concat'](_0x2d48fa);return{'count':_0x3044ed[_0xd1cc('0x42')],'rows':_0x3044ed};})[_0xd1cc('0x1e')](respondWithResult(_0x58eff3,null))[_0xd1cc('0x27')](function(_0x2ba7f1){console[_0xd1cc('0xb0')]('ServiceNow\x20error:\x20'+_0x2ba7f1);var _0x2dc2f0=_0x1a2dec[_0xd1cc('0x3e')][_0xd1cc('0xba')]?0x1f4:_0x2ba7f1[_0xd1cc('0xbb')]||0x1f4;logger['error'](_0x2ba7f1[_0xd1cc('0x36')]);delete _0x2ba7f1[_0xd1cc('0x37')];if(_0x2dc2f0===0x191){_0x2dc2f0=0x190;}_0x58eff3[_0xd1cc('0x2a')](_0x2dc2f0)[_0xd1cc('0x38')](_0x1a2dec[_0xd1cc('0x3e')]['test']?{'message':_0xd1cc('0xbc'),'statusCode':_0x2ba7f1[_0xd1cc('0xbb')]}:_0x2ba7f1);});};function createFieldObject(_0x4352a7,_0xd300d2,_0x2e8a65,_0x3fa038,_0x5035eb,_0x4f2007){return new Promise(function(_0x23e1c8,_0x39f4fa){var _0x17748e={'id':_0x3fa038,'name':_0x5035eb,'custom':_0x4f2007};if(_0x2e8a65===_0xd1cc('0xbd')){_0x17748e['options']=[{'name':'True','value':_0xd1cc('0xbe')},{'name':_0xd1cc('0xbf'),'value':_0xd1cc('0xc0')}];_0x23e1c8(_0x17748e);}else{var _0x151310={'method':_0xd1cc('0xc1'),'uri':_0x4352a7+'sys_choice?sysparm_query=name=incident^element='+_0x3fa038,'auth':_0xd300d2,'json':!![]};return rp(_0x151310)[_0xd1cc('0x1e')](function(_0x4094cf){var _0x3d8258=[];if(_0x4094cf[_0xd1cc('0xaf')][_0xd1cc('0x42')]>0x0){_0x4094cf[_0xd1cc('0xaf')][_0xd1cc('0xb4')](function(_0xc88f78){if(_0xc88f78[_0xd1cc('0xc2')]==='false'){var _0x17f77f={'name':_0xc88f78[_0xd1cc('0xb6')],'value':_0xc88f78[_0xd1cc('0xc3')]};_0x3d8258[_0xd1cc('0xb7')](_0x17f77f);}});}_0x17748e[_0xd1cc('0x4c')]=_0x3d8258;if(_0x17748e['options'][_0xd1cc('0x42')]>0x0){_0x23e1c8(_0x17748e);}else{if(_0x4f2007==![]){_0x23e1c8();}else{_0x23e1c8(_0x17748e);}}});}});} \ No newline at end of file +var _0x1881=['incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','statusCode','test','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','save','destroy','end','name','send','index','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','ServicenowAccount','findAll','show','params','rawAttributes','find','create','body','update','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','category','parent','watch_list','child_incidents','approval_history','number','opened_by','user_input','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','expected_start','business_duration','group_list','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','closed_by','parent_incident','sys_id','contact_type','problem_id','company','reassignment_count','activity_due','severity','comments','comments_and_work_notes','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/'];(function(_0x4a568c,_0xecea09){var _0x9c55e0=function(_0x22cf58){while(--_0x22cf58){_0x4a568c['push'](_0x4a568c['shift']());}};_0x9c55e0(++_0xecea09);}(_0x1881,0x18b));var _0x1188=function(_0x4a2ff1,_0x13de3b){_0x4a2ff1=_0x4a2ff1-0x0;var _0x106aa7=_0x1881[_0x4a2ff1];return _0x106aa7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1188('0x0'));var zipdir=require(_0x1188('0x1'));var jsonpatch=require(_0x1188('0x2'));var rp=require(_0x1188('0x3'));var moment=require(_0x1188('0x4'));var BPromise=require(_0x1188('0x5'));var Mustache=require(_0x1188('0x6'));var util=require(_0x1188('0x7'));var path=require(_0x1188('0x8'));var sox=require('sox');var csv=require(_0x1188('0x9'));var ejs=require(_0x1188('0xa'));var fs=require('fs');var _=require(_0x1188('0xb'));var squel=require(_0x1188('0xc'));var crypto=require('crypto');var jsforce=require(_0x1188('0xd'));var deskjs=require(_0x1188('0xe'));var toCsv=require(_0x1188('0x9'));var querystring=require('querystring');var Papa=require(_0x1188('0xf'));var Redis=require(_0x1188('0x10'));var authService=require(_0x1188('0x11'));var qs=require(_0x1188('0x12'));var as=require(_0x1188('0x13'));var hardwareService=require(_0x1188('0x14'));var logger=require(_0x1188('0x15'))(_0x1188('0x16'));var utils=require(_0x1188('0x17'));var config=require(_0x1188('0x18'));var licenseUtil=require(_0x1188('0x19'));var db=require(_0x1188('0x1a'))['db'];var integrations=require(_0x1188('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x1188('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5049f1,_0x47fe7d,_0x392be7,_0x311543){return new BPromise(function(_0x23dcaa,_0x558164){var _0x33cc77=_0x311543||client;return _0x33cc77[_0x1188('0x1d')](_0x5049f1,_0x392be7)[_0x1188('0x1e')](function(_0x41690c){logger[_0x1188('0x1f')](_0x1188('0x20'),_0x47fe7d,_0x1188('0x21'));logger[_0x1188('0x22')](_0x1188('0x23'),_0x47fe7d,'request\x20sent',JSON['stringify'](_0x41690c));if(_0x41690c[_0x1188('0x24')]){if(_0x41690c['error'][_0x1188('0x25')]===0x1f4){logger[_0x1188('0x24')](_0x1188('0x20'),_0x47fe7d,_0x41690c[_0x1188('0x24')][_0x1188('0x26')]);return _0x558164(_0x41690c['error']['message']);}logger[_0x1188('0x24')](_0x1188('0x20'),_0x47fe7d,_0x41690c[_0x1188('0x24')][_0x1188('0x26')]);return _0x23dcaa(_0x41690c[_0x1188('0x24')][_0x1188('0x26')]);}else{logger[_0x1188('0x1f')](_0x1188('0x20'),_0x47fe7d,'request\x20sent');_0x23dcaa(_0x41690c[_0x1188('0x27')][_0x1188('0x26')]);}})[_0x1188('0x28')](function(_0x157278){logger[_0x1188('0x24')](_0x1188('0x20'),_0x47fe7d,_0x157278);_0x558164(_0x157278);});});}function respondWithStatusCode(_0x3b9e0b,_0x29bb61){_0x29bb61=_0x29bb61||0xcc;return function(_0x50fa62){if(_0x50fa62){return _0x3b9e0b[_0x1188('0x29')](_0x29bb61);}return _0x3b9e0b[_0x1188('0x2a')](_0x29bb61)['end']();};}function respondWithResult(_0x48c70f,_0x46ad89){_0x46ad89=_0x46ad89||0xc8;return function(_0x3e322f){if(_0x3e322f){return _0x48c70f[_0x1188('0x2a')](_0x46ad89)[_0x1188('0x2b')](_0x3e322f);}};}function respondWithFilteredResult(_0x451076,_0x40c159){return function(_0x1f09cd){if(_0x1f09cd){var _0x9ea40d=_0x1f09cd[_0x1188('0x2c')],_0x4b8e4f=_0x40c159['offset'],_0x512a13=_0x40c159['offset']+_0x40c159[_0x1188('0x2d')],_0x3d2fbc;if(_0x512a13>=_0x9ea40d){_0x512a13=_0x9ea40d;_0x3d2fbc=0xc8;}else{_0x3d2fbc=0xce;}_0x451076[_0x1188('0x2a')](_0x3d2fbc);return _0x451076[_0x1188('0x2e')](_0x1188('0x2f'),_0x4b8e4f+'-'+_0x512a13+'/'+_0x9ea40d)[_0x1188('0x2b')](_0x1f09cd);}return null;};}function patchUpdates(_0x11a9f8){return function(_0x32137a){try{jsonpatch['apply'](_0x32137a,_0x11a9f8,!![]);}catch(_0x4bf422){return BPromise['reject'](_0x4bf422);}return _0x32137a[_0x1188('0x30')]();};}function saveUpdates(_0x22cf8a,_0x3f232e){return function(_0x1c2d22){if(_0x1c2d22){return _0x1c2d22['update'](_0x22cf8a)['then'](function(_0xb76be8){return _0xb76be8;});}return null;};}function removeEntity(_0x530ca4,_0x2d7f8a){return function(_0x25348a){if(_0x25348a){return _0x25348a[_0x1188('0x31')]()[_0x1188('0x1e')](function(){_0x530ca4[_0x1188('0x2a')](0xcc)[_0x1188('0x32')]();});}};}function handleEntityNotFound(_0x27a840,_0x2d9ed9){return function(_0x396e8e){if(!_0x396e8e){_0x27a840[_0x1188('0x29')](0x194);}return _0x396e8e;};}function handleError(_0x1163b3,_0x3bf9d7){_0x3bf9d7=_0x3bf9d7||0x1f4;return function(_0x5a3aab){logger['error'](_0x5a3aab['stack']);if(_0x5a3aab[_0x1188('0x33')]){delete _0x5a3aab['name'];}_0x1163b3[_0x1188('0x2a')](_0x3bf9d7)[_0x1188('0x34')](_0x5a3aab);};}exports[_0x1188('0x35')]=function(_0x1e33ee,_0x386b12){var _0x431e9b={},_0x350f97={},_0xb09581={'count':0x0,'rows':[]};var _0x37b632=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x38f71d){return{'name':_0x38f71d['fieldName'],'type':_0x38f71d[_0x1188('0x36')]['key']};});_0x350f97['model']=_[_0x1188('0x37')](_0x37b632,'name');_0x350f97[_0x1188('0x38')]=_[_0x1188('0x39')](_0x1e33ee[_0x1188('0x38')]);_0x350f97[_0x1188('0x3a')]=_['intersection'](_0x350f97[_0x1188('0x3b')],_0x350f97['query']);_0x431e9b[_0x1188('0x3c')]=_[_0x1188('0x3d')](_0x350f97['model'],qs[_0x1188('0x3e')](_0x1e33ee[_0x1188('0x38')][_0x1188('0x3e')]));_0x431e9b[_0x1188('0x3c')]=_0x431e9b[_0x1188('0x3c')][_0x1188('0x3f')]?_0x431e9b['attributes']:_0x350f97[_0x1188('0x3b')];if(!_0x1e33ee[_0x1188('0x38')][_0x1188('0x40')](_0x1188('0x41'))){_0x431e9b[_0x1188('0x2d')]=qs[_0x1188('0x2d')](_0x1e33ee[_0x1188('0x38')]['limit']);_0x431e9b[_0x1188('0x42')]=qs[_0x1188('0x42')](_0x1e33ee[_0x1188('0x38')][_0x1188('0x42')]);}_0x431e9b[_0x1188('0x43')]=qs['sort'](_0x1e33ee[_0x1188('0x38')][_0x1188('0x44')]);_0x431e9b['where']=qs['filters'](_[_0x1188('0x45')](_0x1e33ee[_0x1188('0x38')],_0x350f97[_0x1188('0x3a')]),_0x37b632);if(_0x1e33ee[_0x1188('0x38')][_0x1188('0x46')]){_0x431e9b[_0x1188('0x47')]=_[_0x1188('0x48')](_0x431e9b[_0x1188('0x47')],{'$or':_[_0x1188('0x37')](_0x37b632,function(_0x5d715f){if(_0x5d715f['type']!==_0x1188('0x49')){var _0x3890ae={};_0x3890ae[_0x5d715f[_0x1188('0x33')]]={'$like':'%'+_0x1e33ee['query']['filter']+'%'};return _0x3890ae;}})});}_0x431e9b=_['merge']({},_0x431e9b,_0x1e33ee[_0x1188('0x4a')]);var _0x2fe21a={'where':_0x431e9b[_0x1188('0x47')]};return db['ServicenowAccount'][_0x1188('0x2c')](_0x2fe21a)['then'](function(_0x3559e9){_0xb09581[_0x1188('0x2c')]=_0x3559e9;if(_0x1e33ee[_0x1188('0x38')][_0x1188('0x4b')]){_0x431e9b[_0x1188('0x4c')]=[{'all':!![]}];}return db[_0x1188('0x4d')][_0x1188('0x4e')](_0x431e9b);})[_0x1188('0x1e')](function(_0x26d07f){_0xb09581['rows']=_0x26d07f;return _0xb09581;})[_0x1188('0x1e')](respondWithFilteredResult(_0x386b12,_0x431e9b))['catch'](handleError(_0x386b12,null));};exports[_0x1188('0x4f')]=function(_0x573c40,_0x5b17b6){var _0x3486be={'raw':![],'where':{'id':_0x573c40[_0x1188('0x50')]['id']}},_0x4e34c5={};_0x4e34c5[_0x1188('0x3b')]=_[_0x1188('0x39')](db[_0x1188('0x4d')][_0x1188('0x51')]);_0x4e34c5[_0x1188('0x38')]=_[_0x1188('0x39')](_0x573c40[_0x1188('0x38')]);_0x4e34c5[_0x1188('0x3a')]=_[_0x1188('0x3d')](_0x4e34c5['model'],_0x4e34c5['query']);_0x3486be['attributes']=_['intersection'](_0x4e34c5['model'],qs['fields'](_0x573c40[_0x1188('0x38')][_0x1188('0x3e')]));_0x3486be[_0x1188('0x3c')]=_0x3486be[_0x1188('0x3c')][_0x1188('0x3f')]?_0x3486be[_0x1188('0x3c')]:_0x4e34c5[_0x1188('0x3b')];if(_0x573c40['query']['includeAll']){_0x3486be[_0x1188('0x4c')]=[{'all':!![]}];}_0x3486be=_[_0x1188('0x48')]({},_0x3486be,_0x573c40['options']);return db[_0x1188('0x4d')][_0x1188('0x52')](_0x3486be)['then'](handleEntityNotFound(_0x5b17b6,null))[_0x1188('0x1e')](respondWithResult(_0x5b17b6,null))[_0x1188('0x28')](handleError(_0x5b17b6,null));};exports[_0x1188('0x53')]=function(_0x1269f2,_0x1b63de){return db[_0x1188('0x4d')][_0x1188('0x53')](_0x1269f2[_0x1188('0x54')],{})[_0x1188('0x1e')](respondWithResult(_0x1b63de,0xc9))[_0x1188('0x28')](handleError(_0x1b63de,null));};exports[_0x1188('0x55')]=function(_0x127599,_0x124020){if(_0x127599[_0x1188('0x54')]['id']){delete _0x127599['body']['id'];}return db['ServicenowAccount'][_0x1188('0x52')]({'where':{'id':_0x127599[_0x1188('0x50')]['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x124020,null))[_0x1188('0x1e')](saveUpdates(_0x127599[_0x1188('0x54')],null))['then'](respondWithResult(_0x124020,null))[_0x1188('0x28')](handleError(_0x124020,null));};exports[_0x1188('0x31')]=function(_0x15ffd5,_0x92c2c0){return db[_0x1188('0x4d')][_0x1188('0x52')]({'where':{'id':_0x15ffd5['params']['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x92c2c0,null))[_0x1188('0x1e')](removeEntity(_0x92c2c0,null))[_0x1188('0x28')](handleError(_0x92c2c0,null));};exports[_0x1188('0x56')]=function(_0x50240b,_0x28d160,_0x2c51b6){var _0x8629aa={};var _0x44b731={};var _0x8503cf;var _0x507af5;return db['ServicenowAccount']['findOne']({'where':{'id':_0x50240b[_0x1188('0x50')]['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x28d160,null))['then'](function(_0x22fe53){if(_0x22fe53){_0x8503cf=_0x22fe53;_0x44b731['model']=_[_0x1188('0x39')](db[_0x1188('0x57')][_0x1188('0x51')]);_0x44b731[_0x1188('0x38')]=_['keys'](_0x50240b[_0x1188('0x38')]);_0x44b731[_0x1188('0x3a')]=_[_0x1188('0x3d')](_0x44b731[_0x1188('0x3b')],_0x44b731[_0x1188('0x38')]);_0x8629aa[_0x1188('0x3c')]=_[_0x1188('0x3d')](_0x44b731[_0x1188('0x3b')],qs[_0x1188('0x3e')](_0x50240b['query'][_0x1188('0x3e')]));_0x8629aa[_0x1188('0x3c')]=_0x8629aa[_0x1188('0x3c')][_0x1188('0x3f')]?_0x8629aa['attributes']:_0x44b731[_0x1188('0x3b')];_0x8629aa[_0x1188('0x43')]=qs[_0x1188('0x44')](_0x50240b[_0x1188('0x38')][_0x1188('0x44')]);_0x8629aa[_0x1188('0x47')]=qs['filters'](_[_0x1188('0x45')](_0x50240b[_0x1188('0x38')],_0x44b731[_0x1188('0x3a')]));if(_0x50240b[_0x1188('0x38')][_0x1188('0x46')]){_0x8629aa[_0x1188('0x47')]=_['merge'](_0x8629aa['where'],{'$or':_['map'](_0x8629aa['attributes'],function(_0x307bb5){var _0x2117f7={};_0x2117f7[_0x307bb5]={'$like':'%'+_0x50240b[_0x1188('0x38')]['filter']+'%'};return _0x2117f7;})});}_0x8629aa=_[_0x1188('0x48')]({},_0x8629aa,_0x50240b[_0x1188('0x4a')]);return _0x8503cf[_0x1188('0x56')](_0x8629aa);}})[_0x1188('0x1e')](function(_0x4fe003){if(_0x4fe003){_0x507af5=_0x4fe003[_0x1188('0x3f')];if(!_0x50240b[_0x1188('0x38')]['hasOwnProperty'](_0x1188('0x41'))){_0x8629aa[_0x1188('0x2d')]=qs[_0x1188('0x2d')](_0x50240b[_0x1188('0x38')][_0x1188('0x2d')]);_0x8629aa['offset']=qs[_0x1188('0x42')](_0x50240b[_0x1188('0x38')]['offset']);}return _0x8503cf['getConfigurations'](_0x8629aa);}})[_0x1188('0x1e')](function(_0x3c275c){if(_0x3c275c){return _0x3c275c?{'count':_0x507af5,'rows':_0x3c275c}:null;}})['then'](respondWithResult(_0x28d160,null))[_0x1188('0x28')](handleError(_0x28d160,null));};exports[_0x1188('0x58')]=function(_0x18b41a,_0x549595,_0x1178d3){if(_0x18b41a['body']['id']){delete _0x18b41a[_0x1188('0x54')]['id'];}return db[_0x1188('0x4d')][_0x1188('0x59')]({'where':{'id':_0x18b41a['params']['id']}})[_0x1188('0x1e')](handleEntityNotFound(_0x549595,null))[_0x1188('0x1e')](function(_0x14aa09){if(_0x14aa09){_0x18b41a['body'][_0x1188('0x5a')]=_0x14aa09['id'];_0x18b41a[_0x1188('0x54')][_0x1188('0x5b')]=integrations[_0x1188('0x5c')](_0x18b41a[_0x1188('0x54')][_0x1188('0x5d')],_0x18b41a['body'][_0x1188('0x36')]);_0x18b41a[_0x1188('0x54')]['Descriptions']=integrations[_0x1188('0x5e')](_0x18b41a[_0x1188('0x54')][_0x1188('0x5d')],_0x18b41a[_0x1188('0x54')][_0x1188('0x36')]);return db['ServicenowConfiguration'][_0x1188('0x53')](_0x18b41a[_0x1188('0x54')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x1188('0x5f')],'as':_0x1188('0x60')}]});}return null;})[_0x1188('0x1e')](respondWithResult(_0x549595,null))['catch'](handleError(_0x549595,null));};exports[_0x1188('0x61')]=function(_0x4dee3b,_0x349a07,_0x525101){var _0x1457e0=[_0x1188('0x62'),_0x1188('0x63'),_0x1188('0x64'),'subcategory',_0x1188('0x65'),_0x1188('0x66'),_0x1188('0x67'),'severity',_0x1188('0x68')];var _0x326135=[_0x1188('0x69'),_0x1188('0x62'),'caused_by',_0x1188('0x6a'),'upon_reject','sys_updated_on',_0x1188('0x6b'),_0x1188('0x63'),_0x1188('0x6c'),_0x1188('0x6d'),'resolved_by','sys_updated_by',_0x1188('0x6e'),_0x1188('0x6f'),'sys_created_on','sys_domain',_0x1188('0x70'),_0x1188('0x71'),_0x1188('0x64'),'order',_0x1188('0x72'),'closed_at',_0x1188('0x73'),_0x1188('0x74'),_0x1188('0x75'),'active',_0x1188('0x76'),_0x1188('0x77'),'priority',_0x1188('0x78'),_0x1188('0x79'),'time_worked',_0x1188('0x7a'),'opened_at',_0x1188('0x7b'),_0x1188('0x7c'),'work_end','reopened_time','resolved_at',_0x1188('0x7d'),_0x1188('0x7e'),'subcategory','work_notes',_0x1188('0x7f'),'close_code',_0x1188('0x80'),_0x1188('0x81'),_0x1188('0x82'),_0x1188('0x83'),'business_stc',_0x1188('0x84'),_0x1188('0x85'),'calendar_duration',_0x1188('0x66'),'sys_class_name','close_notes',_0x1188('0x86'),'follow_up',_0x1188('0x87'),_0x1188('0x88'),_0x1188('0x89'),'reopened_by','incident_state','urgency',_0x1188('0x8a'),_0x1188('0x8b'),_0x1188('0x8c'),_0x1188('0x8d'),'assigned_to',_0x1188('0x8e'),_0x1188('0x8f'),'sla_due','approval',_0x1188('0x90'),'due_date',_0x1188('0x91'),'reopen_count',_0x1188('0x92'),'escalation',_0x1188('0x93'),_0x1188('0x94'),_0x1188('0x95'),'category'];var _0x3e6332='';var _0x4b3bab='';var _0x4cd75d=[];var _0x191436='';var _0x4db53f='';var _0x2fac4c=[];var _0x55f86c='';var _0x2f8ddd='';var _0x5d73ab={};var _0x50d2b1='';return db['ServicenowAccount'][_0x1188('0x59')]({'where':{'id':_0x4dee3b['params']['id']},'attributes':['id',_0x1188('0x96'),_0x1188('0x97'),_0x1188('0x98'),_0x1188('0x99'),_0x1188('0x9a')]})[_0x1188('0x1e')](handleEntityNotFound(_0x349a07,null))['then'](function(_0x3c56d2){if(_0x3c56d2){_0x50d2b1=_0x3c56d2['remoteUri'];var _0x2b498f=_0x50d2b1[_0x1188('0x9b')](-0x1);if(_0x2b498f==='/'){_0x50d2b1=_0x50d2b1['substring'](0x0,_0x50d2b1[_0x1188('0x9c')](_0x2b498f));}_0x2f8ddd=util[_0x1188('0x9d')](_0x1188('0x9e'),_0x50d2b1);_0x55f86c=util['format'](_0x1188('0x9f'),_0x50d2b1);_0x5d73ab={'user':_0x3c56d2[_0x1188('0x96')],'pass':_0x3c56d2['password']};var _0x559da9={'method':'GET','uri':_0x2f8ddd+_0x1188('0xa0'),'auth':_0x5d73ab,'json':!![]};return rp(_0x559da9);}})[_0x1188('0x1e')](function(_0x546e32){if(_0x546e32[_0x1188('0x27')]['length']>0x0){_0x3e6332=_0x546e32[_0x1188('0x27')];}console[_0x1188('0xa1')](_0x1188('0xa2'),_0x3e6332);_0x2fac4c=[];_0x4b3bab=Object[_0x1188('0xa3')]([],_0x3e6332);_[_0x1188('0xa4')](_0x4b3bab,function(_0x3d9d89){return!_0x1457e0['includes'](_0x3d9d89[_0x1188('0x33')]);});_0x4b3bab[_0x1188('0xa5')](function(_0x4189ca){var _0x33311f=createFieldObject(_0x55f86c,_0x5d73ab,_0x4189ca[_0x1188('0xa6')],_0x4189ca[_0x1188('0x33')],_0x4189ca['label'],![]);_0x2fac4c[_0x1188('0xa7')](_0x33311f);});return Promise[_0x1188('0xa8')](_0x2fac4c);})[_0x1188('0x1e')](function(_0x3e802a){_0x4cd75d=_0x3e802a;_0x191436=Object[_0x1188('0xa3')]([],_0x3e6332);console['log']('TCL:\x20_object',_0x3e6332);_['remove'](_0x191436,function(_0x256efc){return _0x326135[_0x1188('0xa9')](_0x256efc[_0x1188('0x33')]);});console[_0x1188('0xa1')](_0x1188('0xaa'),_0x191436);_0x2fac4c=[];_0x191436['forEach'](function(_0xadfbba){var _0x2696e3=createFieldObject(_0x55f86c,_0x5d73ab,_0xadfbba[_0x1188('0xa6')],_0xadfbba[_0x1188('0x33')],_0xadfbba[_0x1188('0xab')],!![]);_0x2fac4c[_0x1188('0xa7')](_0x2696e3);});return Promise['all'](_0x2fac4c);})[_0x1188('0x1e')](function(_0x289240){_0x4db53f=_0x289240;var _0x133c6c=_0x4cd75d[_0x1188('0xac')](_0x4db53f);return{'count':_0x133c6c[_0x1188('0x3f')],'rows':_0x133c6c};})[_0x1188('0x1e')](respondWithResult(_0x349a07,null))['catch'](function(_0x375de8){console[_0x1188('0xa1')]('ServiceNow\x20error:\x20'+_0x375de8);var _0x6f2d56=_0x4dee3b[_0x1188('0x38')]['test']?0x1f4:_0x375de8[_0x1188('0xad')]||0x1f4;logger[_0x1188('0x24')](_0x375de8['stack']);delete _0x375de8['name'];if(_0x6f2d56===0x191){_0x6f2d56=0x190;}_0x349a07['status'](_0x6f2d56)[_0x1188('0x34')](_0x4dee3b[_0x1188('0x38')][_0x1188('0xae')]?{'message':_0x1188('0xaf'),'statusCode':_0x375de8[_0x1188('0xad')]}:_0x375de8);});};function createFieldObject(_0x72bec,_0x10df5a,_0x282c1b,_0x366e36,_0x47a735,_0x2ba8aa){return new Promise(function(_0x5336e4,_0x203d54){var _0x53526f={'id':_0x366e36,'name':_0x47a735,'custom':_0x2ba8aa};if(_0x282c1b===_0x1188('0xb0')){_0x53526f[_0x1188('0x4a')]=[{'name':_0x1188('0xb1'),'value':_0x1188('0xb2')},{'name':_0x1188('0xb3'),'value':_0x1188('0xb4')}];_0x5336e4(_0x53526f);}else{var _0x2f6e03={'method':_0x1188('0xb5'),'uri':_0x72bec+_0x1188('0xb6')+_0x366e36,'auth':_0x10df5a,'json':!![]};return rp(_0x2f6e03)['then'](function(_0x341454){var _0x388b2f=[];if(_0x341454[_0x1188('0x27')][_0x1188('0x3f')]>0x0){_0x341454[_0x1188('0x27')]['forEach'](function(_0x149eb1){if(_0x149eb1[_0x1188('0xb7')]===_0x1188('0xb4')){var _0x2731f3={'name':_0x149eb1[_0x1188('0xab')],'value':_0x149eb1[_0x1188('0xb8')]};_0x388b2f[_0x1188('0xa7')](_0x2731f3);}});}_0x53526f[_0x1188('0x4a')]=_0x388b2f;if(_0x53526f['options'][_0x1188('0x3f')]>0x0){_0x5336e4(_0x53526f);}else{if(_0x2ba8aa==![]){_0x5336e4();}else{_0x5336e4(_0x53526f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 359eb1a..961a546 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 _0x04de=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger'];(function(_0x35138f,_0x4b50ba){var _0x56dc96=function(_0x35a421){while(--_0x35a421){_0x35138f['push'](_0x35138f['shift']());}};_0x56dc96(++_0x4b50ba);}(_0x04de,0x107));var _0xe04d=function(_0x6206c3,_0x17ace0){_0x6206c3=_0x6206c3-0x0;var _0x4ddbd0=_0x04de[_0x6206c3];return _0x4ddbd0;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var logger=require(_0xe04d('0x2'))(_0xe04d('0x3'));var moment=require(_0xe04d('0x4'));var BPromise=require(_0xe04d('0x5'));var rp=require(_0xe04d('0x6'));var fs=require('fs');var path=require(_0xe04d('0x7'));var rimraf=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var attributes=require(_0xe04d('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4f7637,_0x531688){return _0x4f7637[_0xe04d('0xb')](_0xe04d('0xc'),attributes,{'tableName':_0xe04d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x425d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash'];(function(_0xf532eb,_0x32a0be){var _0x2375aa=function(_0x7d4d7c){while(--_0x7d4d7c){_0xf532eb['push'](_0xf532eb['shift']());}};_0x2375aa(++_0x32a0be);}(_0x425d,0x1e0));var _0xd425=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x425d[_0x323430];return _0x9eecd1;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var fs=require('fs');var path=require(_0xd425('0x6'));var rimraf=require(_0xd425('0x7'));var config=require('../../config/environment');var attributes=require(_0xd425('0x8'));var integrations=require(_0xd425('0x9'));module[_0xd425('0xa')]=function(_0x36866e,_0x1d97d9){return _0x36866e[_0xd425('0xb')]('ServicenowAccount',attributes,{'tableName':_0xd425('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index f4c76b8..75379a8 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 _0xff4e=['model','attributes','map','then','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','debug','request\x20sent','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include'];(function(_0x31453e,_0x446835){var _0x151e9d=function(_0xa70561){while(--_0xa70561){_0x31453e['push'](_0x31453e['shift']());}};_0x151e9d(++_0x446835);}(_0xff4e,0x1c0));var _0xeff4=function(_0x66094a,_0x3f5795){_0x66094a=_0x66094a-0x0;var _0xf8cf1d=_0xff4e[_0x66094a];return _0xf8cf1d;};'use strict';var _=require(_0xeff4('0x0'));var util=require('util');var moment=require(_0xeff4('0x1'));var BPromise=require(_0xeff4('0x2'));var rs=require(_0xeff4('0x3'));var fs=require('fs');var Redis=require(_0xeff4('0x4'));var db=require(_0xeff4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeff4('0x6'))(_0xeff4('0x7'));var config=require(_0xeff4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeff4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x117a99,_0x32bb6c,_0x31a7c0){return new BPromise(function(_0x2e07da,_0x5bcb14){return client['request'](_0x117a99,_0x31a7c0)['then'](function(_0x3f7ee0){logger[_0xeff4('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x32bb6c,'request\x20sent');logger[_0xeff4('0xb')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x32bb6c,_0xeff4('0xc'),JSON[_0xeff4('0xd')](_0x3f7ee0));if(_0x3f7ee0[_0xeff4('0xe')]){if(_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0xf')]===0x1f4){logger[_0xeff4('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x32bb6c,_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);return _0x5bcb14(_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);}logger[_0xeff4('0xe')](_0xeff4('0x11'),_0x32bb6c,_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);return _0x2e07da(_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x32bb6c,'request\x20sent');_0x2e07da(_0x3f7ee0[_0xeff4('0x12')][_0xeff4('0x10')]);}})[_0xeff4('0x13')](function(_0x4b4879){logger['error'](_0xeff4('0x11'),_0x32bb6c,_0x4b4879);_0x5bcb14(_0x4b4879);});});}exports[_0xeff4('0x14')]=function(_0x3cb125){var _0x12ba21=this;return new Promise(function(_0x224253,_0x3ca427){return db[_0xeff4('0x15')][_0xeff4('0x16')]({'raw':_0x3cb125['options']?_0x3cb125[_0xeff4('0x17')][_0xeff4('0x18')]===undefined?!![]:![]:!![],'where':_0x3cb125['options']?_0x3cb125['options'][_0xeff4('0x19')]||null:null,'attributes':_0x3cb125['options']?_0x3cb125[_0xeff4('0x17')]['attributes']||null:null,'limit':_0x3cb125[_0xeff4('0x17')]?_0x3cb125[_0xeff4('0x17')][_0xeff4('0x1a')]||null:null,'include':_0x3cb125[_0xeff4('0x17')]?_0x3cb125[_0xeff4('0x17')][_0xeff4('0x1b')]?_['map'](_0x3cb125[_0xeff4('0x17')][_0xeff4('0x1b')],function(_0x7f5144){return{'model':db[_0x7f5144[_0xeff4('0x1c')]],'as':_0x7f5144['as'],'attributes':_0x7f5144[_0xeff4('0x1d')],'include':_0x7f5144[_0xeff4('0x1b')]?_[_0xeff4('0x1e')](_0x7f5144[_0xeff4('0x1b')],function(_0x266e40){return{'model':db[_0x266e40['model']],'as':_0x266e40['as'],'attributes':_0x266e40[_0xeff4('0x1d')],'include':_0x266e40['include']?_[_0xeff4('0x1e')](_0x266e40[_0xeff4('0x1b')],function(_0x74fe2e){return{'model':db[_0x74fe2e[_0xeff4('0x1c')]],'as':_0x74fe2e['as'],'attributes':_0x74fe2e[_0xeff4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeff4('0x1f')](function(_0x36f067){logger[_0xeff4('0xa')](_0xeff4('0x14'),_0x3cb125);logger[_0xeff4('0xb')](_0xeff4('0x14'),_0x3cb125,JSON['stringify'](_0x36f067));_0x224253(_0x36f067);})[_0xeff4('0x13')](function(_0x4177d7){logger[_0xeff4('0xe')](_0xeff4('0x14'),_0x4177d7[_0xeff4('0x10')],_0x3cb125);_0x3ca427(_0x12ba21[_0xeff4('0xe')](0x1f4,_0x4177d7['message']));});});};exports[_0xeff4('0x20')]=function(_0x3dee09){var _0xe863b7=this;return new Promise(function(_0x38cde3,_0x258e38){return db[_0xeff4('0x15')][_0xeff4('0x21')]({'raw':_0x3dee09[_0xeff4('0x17')]?_0x3dee09[_0xeff4('0x17')][_0xeff4('0x18')]===undefined?!![]:![]:!![],'where':_0x3dee09[_0xeff4('0x17')]?_0x3dee09[_0xeff4('0x17')][_0xeff4('0x19')]||null:null,'attributes':_0x3dee09[_0xeff4('0x17')]?_0x3dee09[_0xeff4('0x17')][_0xeff4('0x1d')]||null:null,'include':_0x3dee09[_0xeff4('0x17')]?_0x3dee09['options'][_0xeff4('0x1b')]?_['map'](_0x3dee09[_0xeff4('0x17')][_0xeff4('0x1b')],function(_0x3c0ea5){return{'model':db[_0x3c0ea5['model']],'as':_0x3c0ea5['as'],'attributes':_0x3c0ea5[_0xeff4('0x1d')],'include':_0x3c0ea5[_0xeff4('0x1b')]?_[_0xeff4('0x1e')](_0x3c0ea5['include'],function(_0x1636b5){return{'model':db[_0x1636b5['model']],'as':_0x1636b5['as'],'attributes':_0x1636b5[_0xeff4('0x1d')],'include':_0x1636b5[_0xeff4('0x1b')]?_['map'](_0x1636b5['include'],function(_0x297710){return{'model':db[_0x297710[_0xeff4('0x1c')]],'as':_0x297710['as'],'attributes':_0x297710[_0xeff4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ed658){logger[_0xeff4('0xa')](_0xeff4('0x20'),_0x3dee09);logger[_0xeff4('0xb')]('ShowServicenowAccount',_0x3dee09,JSON[_0xeff4('0xd')](_0x4ed658));_0x38cde3(_0x4ed658);})[_0xeff4('0x13')](function(_0x425b0f){logger[_0xeff4('0xe')](_0xeff4('0x20'),_0x425b0f[_0xeff4('0x10')],_0x3dee09);_0x258e38(_0xe863b7[_0xeff4('0xe')](0x1f4,_0x425b0f[_0xeff4('0x10')]));});});}; \ No newline at end of file +var _0x3584=['model','attributes','GetServicenowAccount','stringify','ShowServicenowAccount','find','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','ServicenowAccount','findAll','options','raw','where','limit','include','map'];(function(_0x10a8d8,_0x28f292){var _0x3b2b79=function(_0x55a3fe){while(--_0x55a3fe){_0x10a8d8['push'](_0x10a8d8['shift']());}};_0x3b2b79(++_0x28f292);}(_0x3584,0x1cf));var _0x4358=function(_0x134035,_0x189313){_0x134035=_0x134035-0x0;var _0x2b10fd=_0x3584[_0x134035];return _0x2b10fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4358('0x0'));var BPromise=require(_0x4358('0x1'));var rs=require(_0x4358('0x2'));var fs=require('fs');var Redis=require(_0x4358('0x3'));var db=require(_0x4358('0x4'))['db'];var utils=require(_0x4358('0x5'));var logger=require(_0x4358('0x6'))(_0x4358('0x7'));var config=require(_0x4358('0x8'));var jayson=require(_0x4358('0x9'));var client=jayson[_0x4358('0xa')][_0x4358('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ef8b,_0x17bbad,_0x2c700c){return new BPromise(function(_0x509c60,_0x50f1a0){return client[_0x4358('0xc')](_0x47ef8b,_0x2c700c)[_0x4358('0xd')](function(_0x235d7a){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x17bbad,_0x4358('0xe'));logger[_0x4358('0xf')](_0x4358('0x10'),_0x17bbad,_0x4358('0xe'),JSON['stringify'](_0x235d7a));if(_0x235d7a[_0x4358('0x11')]){if(_0x235d7a['error'][_0x4358('0x12')]===0x1f4){logger[_0x4358('0x11')](_0x4358('0x13'),_0x17bbad,_0x235d7a[_0x4358('0x11')][_0x4358('0x14')]);return _0x50f1a0(_0x235d7a[_0x4358('0x11')][_0x4358('0x14')]);}logger[_0x4358('0x11')](_0x4358('0x13'),_0x17bbad,_0x235d7a[_0x4358('0x11')][_0x4358('0x14')]);return _0x509c60(_0x235d7a['error'][_0x4358('0x14')]);}else{logger['info'](_0x4358('0x13'),_0x17bbad,_0x4358('0xe'));_0x509c60(_0x235d7a[_0x4358('0x15')][_0x4358('0x14')]);}})[_0x4358('0x16')](function(_0x8ce263){logger[_0x4358('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x17bbad,_0x8ce263);_0x50f1a0(_0x8ce263);});});}exports['GetServicenowAccount']=function(_0x311c4f){var _0x11e095=this;return new Promise(function(_0xf2ebe,_0x5a06ad){return db[_0x4358('0x17')][_0x4358('0x18')]({'raw':_0x311c4f[_0x4358('0x19')]?_0x311c4f['options'][_0x4358('0x1a')]===undefined?!![]:![]:!![],'where':_0x311c4f[_0x4358('0x19')]?_0x311c4f[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x311c4f['options']?_0x311c4f['options']['attributes']||null:null,'limit':_0x311c4f[_0x4358('0x19')]?_0x311c4f[_0x4358('0x19')][_0x4358('0x1c')]||null:null,'include':_0x311c4f[_0x4358('0x19')]?_0x311c4f['options'][_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x311c4f[_0x4358('0x19')][_0x4358('0x1d')],function(_0x40fcc2){return{'model':db[_0x40fcc2[_0x4358('0x1f')]],'as':_0x40fcc2['as'],'attributes':_0x40fcc2['attributes'],'include':_0x40fcc2[_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x40fcc2[_0x4358('0x1d')],function(_0x6d8484){return{'model':db[_0x6d8484[_0x4358('0x1f')]],'as':_0x6d8484['as'],'attributes':_0x6d8484[_0x4358('0x20')],'include':_0x6d8484['include']?_[_0x4358('0x1e')](_0x6d8484['include'],function(_0x5394df){return{'model':db[_0x5394df[_0x4358('0x1f')]],'as':_0x5394df['as'],'attributes':_0x5394df['attributes']};}):[]};}):[]};}):[]:[]})[_0x4358('0xd')](function(_0x91e4ed){logger['info'](_0x4358('0x21'),_0x311c4f);logger[_0x4358('0xf')](_0x4358('0x21'),_0x311c4f,JSON[_0x4358('0x22')](_0x91e4ed));_0xf2ebe(_0x91e4ed);})['catch'](function(_0x431885){logger[_0x4358('0x11')](_0x4358('0x21'),_0x431885[_0x4358('0x14')],_0x311c4f);_0x5a06ad(_0x11e095[_0x4358('0x11')](0x1f4,_0x431885[_0x4358('0x14')]));});});};exports[_0x4358('0x23')]=function(_0x28d410){var _0x259f86=this;return new Promise(function(_0x492863,_0x32038d){return db[_0x4358('0x17')][_0x4358('0x24')]({'raw':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')][_0x4358('0x20')]||null:null,'include':_0x28d410[_0x4358('0x19')]?_0x28d410[_0x4358('0x19')][_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x28d410[_0x4358('0x19')][_0x4358('0x1d')],function(_0x1cc8de){return{'model':db[_0x1cc8de[_0x4358('0x1f')]],'as':_0x1cc8de['as'],'attributes':_0x1cc8de[_0x4358('0x20')],'include':_0x1cc8de[_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x1cc8de['include'],function(_0x1ec5a1){return{'model':db[_0x1ec5a1['model']],'as':_0x1ec5a1['as'],'attributes':_0x1ec5a1[_0x4358('0x20')],'include':_0x1ec5a1[_0x4358('0x1d')]?_[_0x4358('0x1e')](_0x1ec5a1[_0x4358('0x1d')],function(_0xd5a0fe){return{'model':db[_0xd5a0fe[_0x4358('0x1f')]],'as':_0xd5a0fe['as'],'attributes':_0xd5a0fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x4358('0xd')](function(_0x28a302){logger[_0x4358('0x25')](_0x4358('0x23'),_0x28d410);logger['debug'](_0x4358('0x23'),_0x28d410,JSON[_0x4358('0x22')](_0x28a302));_0x492863(_0x28a302);})[_0x4358('0x16')](function(_0x16a40b){logger[_0x4358('0x11')]('ShowServicenowAccount',_0x16a40b[_0x4358('0x14')],_0x28d410);_0x32038d(_0x259f86['error'](0x1f4,_0x16a40b[_0x4358('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index bb89512..a745316 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 _0x778d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','util','Router'];(function(_0x3e1f74,_0x1ab355){var _0x27195c=function(_0x1a4db7){while(--_0x1a4db7){_0x3e1f74['push'](_0x3e1f74['shift']());}};_0x27195c(++_0x1ab355);}(_0x778d,0x11b));var _0xd778=function(_0x3484fc,_0x12883e){_0x3484fc=_0x3484fc-0x0;var _0x5d6e41=_0x778d[_0x3484fc];return _0x5d6e41;};'use strict';var multer=require('multer');var util=require(_0xd778('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd778('0x1')]();var auth=require(_0xd778('0x2'));var interaction=require(_0xd778('0x3'));var config=require(_0xd778('0x4'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd778('0x5')]('/:id',auth[_0xd778('0x6')](),controller[_0xd778('0x7')]);router['get'](_0xd778('0x8'),auth[_0xd778('0x6')](),controller['getFields']);router[_0xd778('0x5')](_0xd778('0x9'),auth[_0xd778('0x6')](),controller[_0xd778('0xa')]);router[_0xd778('0x5')](_0xd778('0xb'),auth[_0xd778('0x6')](),controller[_0xd778('0xc')]);router[_0xd778('0xd')]('/',auth[_0xd778('0x6')](),controller[_0xd778('0xe')]);router['put'](_0xd778('0xf'),auth[_0xd778('0x6')](),controller[_0xd778('0x10')]);router[_0xd778('0x11')](_0xd778('0xf'),auth[_0xd778('0x6')](),controller[_0xd778('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1330=['Router','../../components/auth/service','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1330,0x1b4));var _0x0133=function(_0x390b37,_0x23ed18){_0x390b37=_0x390b37-0x0;var _0x265e6e=_0x1330[_0x390b37];return _0x265e6e;};'use strict';var multer=require('multer');var util=require(_0x0133('0x0'));var path=require(_0x0133('0x1'));var timeout=require(_0x0133('0x2'));var express=require(_0x0133('0x3'));var router=express[_0x0133('0x4')]();var auth=require(_0x0133('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0133('0x6'));router[_0x0133('0x7')]('/',auth[_0x0133('0x8')](),controller['index']);router['get'](_0x0133('0x9'),auth['isAuthenticated'](),controller[_0x0133('0xa')]);router[_0x0133('0x7')](_0x0133('0xb'),auth['isAuthenticated'](),controller[_0x0133('0xc')]);router[_0x0133('0x7')](_0x0133('0xd'),auth['isAuthenticated'](),controller[_0x0133('0xe')]);router['get'](_0x0133('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0133('0x10')]('/',auth[_0x0133('0x8')](),controller[_0x0133('0x11')]);router[_0x0133('0x12')](_0x0133('0x9'),auth[_0x0133('0x8')](),controller[_0x0133('0x13')]);router['delete']('/:id',auth[_0x0133('0x8')](),controller[_0x0133('0x14')]);module[_0x0133('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c5ca1c9..1f517cd 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 _0x6009=['STRING','sequelize','exports'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x6009,0xcd));var _0x9600=function(_0x4c9ad2,_0x3bb687){_0x4c9ad2=_0x4c9ad2-0x0;var _0x507886=_0x6009[_0x4c9ad2];return _0x507886;};'use strict';var Sequelize=require(_0x9600('0x0'));module[_0x9600('0x1')]={'name':{'type':Sequelize[_0x9600('0x2')]},'description':{'type':Sequelize[_0x9600('0x2')]}}; \ No newline at end of file +var _0x45ac=['exports','STRING'];(function(_0x387ec1,_0xa73770){var _0x4ca6fe=function(_0xa1a849){while(--_0xa1a849){_0x387ec1['push'](_0x387ec1['shift']());}};_0x4ca6fe(++_0xa73770);}(_0x45ac,0xf2));var _0xc45a=function(_0x58fc2b,_0x368286){_0x58fc2b=_0x58fc2b-0x0;var _0x3937ce=_0x45ac[_0x58fc2b];return _0x3937ce;};'use strict';var Sequelize=require('sequelize');module[_0xc45a('0x0')]={'name':{'type':Sequelize[_0xc45a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 35477fc..8af88b9 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 _0xf505=['sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','ServicenowConfiguration','findAll','rows','options','find','create','body','update','params','getFields','findOne','ServicenowField','pick','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xf505,0x1a4));var _0x5f50=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0xf505[_0x3f8759];return _0x2d33ca;};'use strict';var pdf=require(_0x5f50('0x0'));var emlformat=require(_0x5f50('0x1'));var rimraf=require(_0x5f50('0x2'));var zipdir=require(_0x5f50('0x3'));var jsonpatch=require(_0x5f50('0x4'));var rp=require(_0x5f50('0x5'));var moment=require(_0x5f50('0x6'));var BPromise=require(_0x5f50('0x7'));var Mustache=require(_0x5f50('0x8'));var util=require(_0x5f50('0x9'));var path=require(_0x5f50('0xa'));var sox=require(_0x5f50('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5f50('0xc'));var crypto=require(_0x5f50('0xd'));var jsforce=require(_0x5f50('0xe'));var deskjs=require(_0x5f50('0xf'));var toCsv=require(_0x5f50('0x10'));var querystring=require(_0x5f50('0x11'));var Papa=require('papaparse');var Redis=require(_0x5f50('0x12'));var authService=require(_0x5f50('0x13'));var qs=require(_0x5f50('0x14'));var as=require(_0x5f50('0x15'));var hardwareService=require(_0x5f50('0x16'));var logger=require(_0x5f50('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x5f50('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f50('0x19'))['db'];var jayson=require(_0x5f50('0x1a'));var client=jayson[_0x5f50('0x1b')][_0x5f50('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2658f8,_0x56b777,_0x1a76b3,_0x2e10fb){return new BPromise(function(_0x5d8e4e,_0x4b0d71){var _0x4e341a=_0x2e10fb||client;return _0x4e341a[_0x5f50('0x1d')](_0x2658f8,_0x1a76b3)[_0x5f50('0x1e')](function(_0x3cff5a){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x56b777,_0x5f50('0x1f'));logger[_0x5f50('0x20')](_0x5f50('0x21'),_0x56b777,_0x5f50('0x1f'),JSON['stringify'](_0x3cff5a));if(_0x3cff5a[_0x5f50('0x22')]){if(_0x3cff5a[_0x5f50('0x22')][_0x5f50('0x23')]===0x1f4){logger[_0x5f50('0x22')](_0x5f50('0x24'),_0x56b777,_0x3cff5a['error'][_0x5f50('0x25')]);return _0x4b0d71(_0x3cff5a[_0x5f50('0x22')][_0x5f50('0x25')]);}logger['error'](_0x5f50('0x24'),_0x56b777,_0x3cff5a['error']['message']);return _0x5d8e4e(_0x3cff5a['error'][_0x5f50('0x25')]);}else{logger[_0x5f50('0x26')](_0x5f50('0x24'),_0x56b777,_0x5f50('0x1f'));_0x5d8e4e(_0x3cff5a['result'][_0x5f50('0x25')]);}})[_0x5f50('0x27')](function(_0x45b385){logger['error'](_0x5f50('0x24'),_0x56b777,_0x45b385);_0x4b0d71(_0x45b385);});});}function respondWithStatusCode(_0x183f30,_0x12445a){_0x12445a=_0x12445a||0xcc;return function(_0x34012e){if(_0x34012e){return _0x183f30[_0x5f50('0x28')](_0x12445a);}return _0x183f30[_0x5f50('0x29')](_0x12445a)[_0x5f50('0x2a')]();};}function respondWithResult(_0x3c1ad1,_0x2f17b8){_0x2f17b8=_0x2f17b8||0xc8;return function(_0x25f217){if(_0x25f217){return _0x3c1ad1[_0x5f50('0x29')](_0x2f17b8)[_0x5f50('0x2b')](_0x25f217);}};}function respondWithFilteredResult(_0x50406d,_0x3704f6){return function(_0x4f8802){if(_0x4f8802){var _0x5dee82=_0x4f8802[_0x5f50('0x2c')],_0x516269=_0x3704f6[_0x5f50('0x2d')],_0x5c043a=_0x3704f6['offset']+_0x3704f6[_0x5f50('0x2e')],_0x1bdfb1;if(_0x5c043a>=_0x5dee82){_0x5c043a=_0x5dee82;_0x1bdfb1=0xc8;}else{_0x1bdfb1=0xce;}_0x50406d[_0x5f50('0x29')](_0x1bdfb1);return _0x50406d['set'](_0x5f50('0x2f'),_0x516269+'-'+_0x5c043a+'/'+_0x5dee82)[_0x5f50('0x2b')](_0x4f8802);}return null;};}function patchUpdates(_0x20dff5){return function(_0x1c89b1){try{jsonpatch[_0x5f50('0x30')](_0x1c89b1,_0x20dff5,!![]);}catch(_0x129477){return BPromise[_0x5f50('0x31')](_0x129477);}return _0x1c89b1['save']();};}function saveUpdates(_0x424ccd,_0x462ef9){return function(_0x1f0190){if(_0x1f0190){return _0x1f0190['update'](_0x424ccd)[_0x5f50('0x1e')](function(_0xfa0429){return _0xfa0429;});}return null;};}function removeEntity(_0x44876a,_0x470672){return function(_0x1cddc4){if(_0x1cddc4){return _0x1cddc4[_0x5f50('0x32')]()[_0x5f50('0x1e')](function(){_0x44876a[_0x5f50('0x29')](0xcc)[_0x5f50('0x2a')]();});}};}function handleEntityNotFound(_0x44eedb,_0x1d5676){return function(_0x291420){if(!_0x291420){_0x44eedb[_0x5f50('0x28')](0x194);}return _0x291420;};}function handleError(_0x121ce3,_0x315423){_0x315423=_0x315423||0x1f4;return function(_0x1852d4){logger['error'](_0x1852d4[_0x5f50('0x33')]);if(_0x1852d4[_0x5f50('0x34')]){delete _0x1852d4['name'];}_0x121ce3[_0x5f50('0x29')](_0x315423)[_0x5f50('0x35')](_0x1852d4);};}exports['index']=function(_0x468209,_0x178436){var _0x224888={},_0x3c547e={},_0x9b4901={'count':0x0,'rows':[]};var _0x1a1fd8=_[_0x5f50('0x36')](db['ServicenowConfiguration'][_0x5f50('0x37')],function(_0x41e264){return{'name':_0x41e264[_0x5f50('0x38')],'type':_0x41e264[_0x5f50('0x39')][_0x5f50('0x3a')]};});_0x3c547e[_0x5f50('0x3b')]=_[_0x5f50('0x36')](_0x1a1fd8,_0x5f50('0x34'));_0x3c547e[_0x5f50('0x3c')]=_[_0x5f50('0x3d')](_0x468209[_0x5f50('0x3c')]);_0x3c547e[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x3c547e['model'],_0x3c547e[_0x5f50('0x3c')]);_0x224888[_0x5f50('0x40')]=_[_0x5f50('0x3f')](_0x3c547e['model'],qs[_0x5f50('0x41')](_0x468209[_0x5f50('0x3c')][_0x5f50('0x41')]));_0x224888[_0x5f50('0x40')]=_0x224888[_0x5f50('0x40')][_0x5f50('0x42')]?_0x224888[_0x5f50('0x40')]:_0x3c547e['model'];if(!_0x468209[_0x5f50('0x3c')]['hasOwnProperty'](_0x5f50('0x43'))){_0x224888[_0x5f50('0x2e')]=qs[_0x5f50('0x2e')](_0x468209[_0x5f50('0x3c')]['limit']);_0x224888[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x468209['query']['offset']);}_0x224888[_0x5f50('0x44')]=qs[_0x5f50('0x45')](_0x468209[_0x5f50('0x3c')][_0x5f50('0x45')]);_0x224888['where']=qs[_0x5f50('0x3e')](_['pick'](_0x468209[_0x5f50('0x3c')],_0x3c547e['filters']),_0x1a1fd8);if(_0x468209['query']['filter']){_0x224888[_0x5f50('0x46')]=_[_0x5f50('0x47')](_0x224888[_0x5f50('0x46')],{'$or':_[_0x5f50('0x36')](_0x1a1fd8,function(_0x1751bb){if(_0x1751bb[_0x5f50('0x39')]!==_0x5f50('0x48')){var _0x96cb76={};_0x96cb76[_0x1751bb[_0x5f50('0x34')]]={'$like':'%'+_0x468209['query'][_0x5f50('0x49')]+'%'};return _0x96cb76;}})});}_0x224888=_['merge']({},_0x224888,_0x468209['options']);var _0x16b37b={'where':_0x224888[_0x5f50('0x46')]};return db['ServicenowConfiguration']['count'](_0x16b37b)[_0x5f50('0x1e')](function(_0x383654){_0x9b4901[_0x5f50('0x2c')]=_0x383654;if(_0x468209[_0x5f50('0x3c')][_0x5f50('0x4a')]){_0x224888[_0x5f50('0x4b')]=[{'all':!![]}];}return db[_0x5f50('0x4c')][_0x5f50('0x4d')](_0x224888);})[_0x5f50('0x1e')](function(_0x29e46a){_0x9b4901[_0x5f50('0x4e')]=_0x29e46a;return _0x9b4901;})[_0x5f50('0x1e')](respondWithFilteredResult(_0x178436,_0x224888))[_0x5f50('0x27')](handleError(_0x178436,null));};exports['show']=function(_0xe9aead,_0x43e8eb){var _0x381dd7={'raw':![],'where':{'id':_0xe9aead['params']['id']}},_0x332bd3={};_0x332bd3['model']=_['keys'](db[_0x5f50('0x4c')][_0x5f50('0x37')]);_0x332bd3['query']=_['keys'](_0xe9aead[_0x5f50('0x3c')]);_0x332bd3[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x332bd3[_0x5f50('0x3b')],_0x332bd3['query']);_0x381dd7[_0x5f50('0x40')]=_[_0x5f50('0x3f')](_0x332bd3[_0x5f50('0x3b')],qs[_0x5f50('0x41')](_0xe9aead[_0x5f50('0x3c')][_0x5f50('0x41')]));_0x381dd7['attributes']=_0x381dd7['attributes'][_0x5f50('0x42')]?_0x381dd7[_0x5f50('0x40')]:_0x332bd3[_0x5f50('0x3b')];if(_0xe9aead[_0x5f50('0x3c')]['includeAll']){_0x381dd7[_0x5f50('0x4b')]=[{'all':!![]}];}_0x381dd7=_['merge']({},_0x381dd7,_0xe9aead[_0x5f50('0x4f')]);return db['ServicenowConfiguration'][_0x5f50('0x50')](_0x381dd7)[_0x5f50('0x1e')](handleEntityNotFound(_0x43e8eb,null))['then'](respondWithResult(_0x43e8eb,null))['catch'](handleError(_0x43e8eb,null));};exports[_0x5f50('0x51')]=function(_0x3ff53f,_0x2e5263){return db[_0x5f50('0x4c')][_0x5f50('0x51')](_0x3ff53f[_0x5f50('0x52')],{})['then'](respondWithResult(_0x2e5263,0xc9))['catch'](handleError(_0x2e5263,null));};exports[_0x5f50('0x53')]=function(_0x53a168,_0x43e048){if(_0x53a168[_0x5f50('0x52')]['id']){delete _0x53a168[_0x5f50('0x52')]['id'];}return db[_0x5f50('0x4c')]['find']({'where':{'id':_0x53a168[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x43e048,null))[_0x5f50('0x1e')](saveUpdates(_0x53a168['body'],null))['then'](respondWithResult(_0x43e048,null))[_0x5f50('0x27')](handleError(_0x43e048,null));};exports['destroy']=function(_0x2b08d5,_0x5cba03){return db[_0x5f50('0x4c')][_0x5f50('0x50')]({'where':{'id':_0x2b08d5[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x5cba03,null))[_0x5f50('0x1e')](removeEntity(_0x5cba03,null))[_0x5f50('0x27')](handleError(_0x5cba03,null));};exports[_0x5f50('0x55')]=function(_0x3bb396,_0x27f05b,_0x47e19a){var _0x5ec555={};var _0x2b35e0={};var _0x4f57b0;var _0x3ab245;return db[_0x5f50('0x4c')][_0x5f50('0x56')]({'where':{'id':_0x3bb396[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x27f05b,null))[_0x5f50('0x1e')](function(_0x56df7c){if(_0x56df7c){_0x4f57b0=_0x56df7c;_0x2b35e0['model']=_[_0x5f50('0x3d')](db[_0x5f50('0x57')]['rawAttributes']);_0x2b35e0[_0x5f50('0x3c')]=_['keys'](_0x3bb396[_0x5f50('0x3c')]);_0x2b35e0[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x2b35e0['model'],_0x2b35e0[_0x5f50('0x3c')]);_0x5ec555[_0x5f50('0x40')]=_[_0x5f50('0x3f')](_0x2b35e0[_0x5f50('0x3b')],qs[_0x5f50('0x41')](_0x3bb396[_0x5f50('0x3c')]['fields']));_0x5ec555['attributes']=_0x5ec555[_0x5f50('0x40')][_0x5f50('0x42')]?_0x5ec555[_0x5f50('0x40')]:_0x2b35e0[_0x5f50('0x3b')];_0x5ec555[_0x5f50('0x44')]=qs[_0x5f50('0x45')](_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x45')]);_0x5ec555['where']=qs[_0x5f50('0x3e')](_[_0x5f50('0x58')](_0x3bb396[_0x5f50('0x3c')],_0x2b35e0['filters']));if(_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x49')]){_0x5ec555['where']=_[_0x5f50('0x47')](_0x5ec555['where'],{'$or':_[_0x5f50('0x36')](_0x5ec555[_0x5f50('0x40')],function(_0xad2fa3){var _0x394b49={};_0x394b49[_0xad2fa3]={'$like':'%'+_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x49')]+'%'};return _0x394b49;})});}_0x5ec555=_[_0x5f50('0x47')]({},_0x5ec555,_0x3bb396[_0x5f50('0x4f')]);return _0x4f57b0[_0x5f50('0x55')](_0x5ec555);}})[_0x5f50('0x1e')](function(_0x567244){if(_0x567244){_0x3ab245=_0x567244['length'];if(!_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x59')](_0x5f50('0x43'))){_0x5ec555[_0x5f50('0x2e')]=qs[_0x5f50('0x2e')](_0x3bb396['query'][_0x5f50('0x2e')]);_0x5ec555[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x3bb396['query'][_0x5f50('0x2d')]);}return _0x4f57b0['getFields'](_0x5ec555);}})[_0x5f50('0x1e')](function(_0x40f0ad){if(_0x40f0ad){return _0x40f0ad?{'count':_0x3ab245,'rows':_0x40f0ad}:null;}})['then'](respondWithResult(_0x27f05b,null))[_0x5f50('0x27')](handleError(_0x27f05b,null));};exports[_0x5f50('0x5a')]=function(_0x15c826,_0x15ca78,_0x1fde59){var _0x67868e={};var _0x2dc43c={};var _0x241e96;var _0x18e781;return db[_0x5f50('0x4c')][_0x5f50('0x56')]({'where':{'id':_0x15c826[_0x5f50('0x54')]['id']}})['then'](handleEntityNotFound(_0x15ca78,null))['then'](function(_0x4f2aa1){if(_0x4f2aa1){_0x241e96=_0x4f2aa1;_0x2dc43c[_0x5f50('0x3b')]=_['keys'](db[_0x5f50('0x57')]['rawAttributes']);_0x2dc43c[_0x5f50('0x3c')]=_[_0x5f50('0x3d')](_0x15c826[_0x5f50('0x3c')]);_0x2dc43c[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x2dc43c[_0x5f50('0x3b')],_0x2dc43c[_0x5f50('0x3c')]);_0x67868e[_0x5f50('0x40')]=_['intersection'](_0x2dc43c['model'],qs[_0x5f50('0x41')](_0x15c826[_0x5f50('0x3c')][_0x5f50('0x41')]));_0x67868e[_0x5f50('0x40')]=_0x67868e['attributes'][_0x5f50('0x42')]?_0x67868e['attributes']:_0x2dc43c[_0x5f50('0x3b')];_0x67868e[_0x5f50('0x44')]=qs[_0x5f50('0x45')](_0x15c826[_0x5f50('0x3c')]['sort']);_0x67868e[_0x5f50('0x46')]=qs[_0x5f50('0x3e')](_[_0x5f50('0x58')](_0x15c826[_0x5f50('0x3c')],_0x2dc43c[_0x5f50('0x3e')]));if(_0x15c826[_0x5f50('0x3c')]['filter']){_0x67868e[_0x5f50('0x46')]=_[_0x5f50('0x47')](_0x67868e[_0x5f50('0x46')],{'$or':_['map'](_0x67868e[_0x5f50('0x40')],function(_0x27066c){var _0x13fa88={};_0x13fa88[_0x27066c]={'$like':'%'+_0x15c826[_0x5f50('0x3c')][_0x5f50('0x49')]+'%'};return _0x13fa88;})});}_0x67868e=_[_0x5f50('0x47')]({},_0x67868e,_0x15c826[_0x5f50('0x4f')]);return _0x241e96['getSubjects'](_0x67868e);}})['then'](function(_0x19f824){if(_0x19f824){_0x18e781=_0x19f824[_0x5f50('0x42')];if(!_0x15c826[_0x5f50('0x3c')][_0x5f50('0x59')](_0x5f50('0x43'))){_0x67868e[_0x5f50('0x2e')]=qs['limit'](_0x15c826[_0x5f50('0x3c')]['limit']);_0x67868e[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x15c826['query'][_0x5f50('0x2d')]);}return _0x241e96['getSubjects'](_0x67868e);}})[_0x5f50('0x1e')](function(_0x2bde9d){if(_0x2bde9d){return _0x2bde9d?{'count':_0x18e781,'rows':_0x2bde9d}:null;}})[_0x5f50('0x1e')](respondWithResult(_0x15ca78,null))[_0x5f50('0x27')](handleError(_0x15ca78,null));};exports[_0x5f50('0x5b')]=function(_0x1e7929,_0x5c2298,_0x46af0c){var _0x1793cb={};var _0x3d766f={};var _0x53d7f4;var _0x15825e;return db[_0x5f50('0x4c')][_0x5f50('0x56')]({'where':{'id':_0x1e7929[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x5c2298,null))[_0x5f50('0x1e')](function(_0x1e2890){if(_0x1e2890){_0x53d7f4=_0x1e2890;_0x3d766f[_0x5f50('0x3b')]=_[_0x5f50('0x3d')](db[_0x5f50('0x57')][_0x5f50('0x37')]);_0x3d766f[_0x5f50('0x3c')]=_[_0x5f50('0x3d')](_0x1e7929[_0x5f50('0x3c')]);_0x3d766f[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x3d766f['model'],_0x3d766f['query']);_0x1793cb[_0x5f50('0x40')]=_['intersection'](_0x3d766f[_0x5f50('0x3b')],qs[_0x5f50('0x41')](_0x1e7929['query']['fields']));_0x1793cb['attributes']=_0x1793cb[_0x5f50('0x40')][_0x5f50('0x42')]?_0x1793cb['attributes']:_0x3d766f['model'];_0x1793cb['order']=qs[_0x5f50('0x45')](_0x1e7929['query'][_0x5f50('0x45')]);_0x1793cb[_0x5f50('0x46')]=qs['filters'](_[_0x5f50('0x58')](_0x1e7929[_0x5f50('0x3c')],_0x3d766f['filters']));if(_0x1e7929[_0x5f50('0x3c')][_0x5f50('0x49')]){_0x1793cb[_0x5f50('0x46')]=_[_0x5f50('0x47')](_0x1793cb[_0x5f50('0x46')],{'$or':_[_0x5f50('0x36')](_0x1793cb[_0x5f50('0x40')],function(_0x4f1bae){var _0x3844f9={};_0x3844f9[_0x4f1bae]={'$like':'%'+_0x1e7929['query'][_0x5f50('0x49')]+'%'};return _0x3844f9;})});}_0x1793cb=_[_0x5f50('0x47')]({},_0x1793cb,_0x1e7929[_0x5f50('0x4f')]);return _0x53d7f4[_0x5f50('0x5b')](_0x1793cb);}})['then'](function(_0x48bf50){if(_0x48bf50){_0x15825e=_0x48bf50[_0x5f50('0x42')];if(!_0x1e7929[_0x5f50('0x3c')][_0x5f50('0x59')]('nolimit')){_0x1793cb[_0x5f50('0x2e')]=qs[_0x5f50('0x2e')](_0x1e7929[_0x5f50('0x3c')][_0x5f50('0x2e')]);_0x1793cb[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x1e7929['query'][_0x5f50('0x2d')]);}return _0x53d7f4[_0x5f50('0x5b')](_0x1793cb);}})[_0x5f50('0x1e')](function(_0x5af0be){if(_0x5af0be){return _0x5af0be?{'count':_0x15825e,'rows':_0x5af0be}:null;}})[_0x5f50('0x1e')](respondWithResult(_0x5c2298,null))[_0x5f50('0x27')](handleError(_0x5c2298,null));}; \ No newline at end of file +var _0xbc99=['nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','includeAll','include','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','update','destroy','then','stack','name','send','index','ServicenowConfiguration','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x22123d,_0x45ae06){var _0xeabce1=function(_0x239cae){while(--_0x239cae){_0x22123d['push'](_0x22123d['shift']());}};_0xeabce1(++_0x45ae06);}(_0xbc99,0x12b));var _0x9bc9=function(_0x5c9785,_0x22a1c9){_0x5c9785=_0x5c9785-0x0;var _0x186834=_0xbc99[_0x5c9785];return _0x186834;};'use strict';var pdf=require(_0x9bc9('0x0'));var emlformat=require(_0x9bc9('0x1'));var rimraf=require(_0x9bc9('0x2'));var zipdir=require(_0x9bc9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bc9('0x4'));var moment=require(_0x9bc9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9bc9('0x6'));var util=require(_0x9bc9('0x7'));var path=require(_0x9bc9('0x8'));var sox=require(_0x9bc9('0x9'));var csv=require(_0x9bc9('0xa'));var ejs=require(_0x9bc9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9bc9('0xc'));var jsforce=require(_0x9bc9('0xd'));var deskjs=require(_0x9bc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9bc9('0xf'));var Papa=require(_0x9bc9('0x10'));var Redis=require(_0x9bc9('0x11'));var authService=require(_0x9bc9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9bc9('0x13'));var hardwareService=require(_0x9bc9('0x14'));var logger=require('../../config/logger')(_0x9bc9('0x15'));var utils=require(_0x9bc9('0x16'));var config=require(_0x9bc9('0x17'));var licenseUtil=require(_0x9bc9('0x18'));var db=require(_0x9bc9('0x19'))['db'];var jayson=require(_0x9bc9('0x1a'));var client=jayson[_0x9bc9('0x1b')][_0x9bc9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x293050,_0x307edf,_0xc5f278,_0x1766c1){return new BPromise(function(_0x4e03eb,_0x5081d0){var _0x1f90a8=_0x1766c1||client;return _0x1f90a8[_0x9bc9('0x1d')](_0x293050,_0xc5f278)['then'](function(_0x1ffdfd){logger[_0x9bc9('0x1e')](_0x9bc9('0x1f'),_0x307edf,_0x9bc9('0x20'));logger[_0x9bc9('0x21')](_0x9bc9('0x22'),_0x307edf,'request\x20sent',JSON['stringify'](_0x1ffdfd));if(_0x1ffdfd[_0x9bc9('0x23')]){if(_0x1ffdfd[_0x9bc9('0x23')][_0x9bc9('0x24')]===0x1f4){logger['error'](_0x9bc9('0x1f'),_0x307edf,_0x1ffdfd[_0x9bc9('0x23')][_0x9bc9('0x25')]);return _0x5081d0(_0x1ffdfd[_0x9bc9('0x23')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x307edf,_0x1ffdfd[_0x9bc9('0x23')]['message']);return _0x4e03eb(_0x1ffdfd['error']['message']);}else{logger[_0x9bc9('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x307edf,_0x9bc9('0x20'));_0x4e03eb(_0x1ffdfd[_0x9bc9('0x26')][_0x9bc9('0x25')]);}})[_0x9bc9('0x27')](function(_0x51bb1a){logger[_0x9bc9('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x307edf,_0x51bb1a);_0x5081d0(_0x51bb1a);});});}function respondWithStatusCode(_0x1b6cfa,_0x16ec08){_0x16ec08=_0x16ec08||0xcc;return function(_0x2d02e3){if(_0x2d02e3){return _0x1b6cfa[_0x9bc9('0x28')](_0x16ec08);}return _0x1b6cfa[_0x9bc9('0x29')](_0x16ec08)[_0x9bc9('0x2a')]();};}function respondWithResult(_0x4aeabc,_0x2b083b){_0x2b083b=_0x2b083b||0xc8;return function(_0x2d3f1b){if(_0x2d3f1b){return _0x4aeabc['status'](_0x2b083b)['json'](_0x2d3f1b);}};}function respondWithFilteredResult(_0x451c72,_0x24919a){return function(_0xbef83f){if(_0xbef83f){var _0x1d16b0=_0xbef83f[_0x9bc9('0x2b')],_0x45d964=_0x24919a[_0x9bc9('0x2c')],_0x585f32=_0x24919a[_0x9bc9('0x2c')]+_0x24919a[_0x9bc9('0x2d')],_0x23f640;if(_0x585f32>=_0x1d16b0){_0x585f32=_0x1d16b0;_0x23f640=0xc8;}else{_0x23f640=0xce;}_0x451c72[_0x9bc9('0x29')](_0x23f640);return _0x451c72[_0x9bc9('0x2e')]('Content-Range',_0x45d964+'-'+_0x585f32+'/'+_0x1d16b0)[_0x9bc9('0x2f')](_0xbef83f);}return null;};}function patchUpdates(_0x173e2d){return function(_0x403cc7){try{jsonpatch[_0x9bc9('0x30')](_0x403cc7,_0x173e2d,!![]);}catch(_0x13b41a){return BPromise['reject'](_0x13b41a);}return _0x403cc7['save']();};}function saveUpdates(_0x4c2747,_0x1e3f3e){return function(_0x17d14a){if(_0x17d14a){return _0x17d14a[_0x9bc9('0x31')](_0x4c2747)['then'](function(_0x4c4a9e){return _0x4c4a9e;});}return null;};}function removeEntity(_0x1f5af2,_0x11f835){return function(_0x314158){if(_0x314158){return _0x314158[_0x9bc9('0x32')]()[_0x9bc9('0x33')](function(){_0x1f5af2[_0x9bc9('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171d77,_0x941afc){return function(_0x1b36d5){if(!_0x1b36d5){_0x171d77[_0x9bc9('0x28')](0x194);}return _0x1b36d5;};}function handleError(_0x470ca3,_0x22beb7){_0x22beb7=_0x22beb7||0x1f4;return function(_0x279bf3){logger[_0x9bc9('0x23')](_0x279bf3[_0x9bc9('0x34')]);if(_0x279bf3[_0x9bc9('0x35')]){delete _0x279bf3[_0x9bc9('0x35')];}_0x470ca3[_0x9bc9('0x29')](_0x22beb7)[_0x9bc9('0x36')](_0x279bf3);};}exports[_0x9bc9('0x37')]=function(_0x44b16e,_0x16a333){var _0x2c2b2b={},_0x1fd0e1={},_0x59e8f7={'count':0x0,'rows':[]};var _0x313e97=_['map'](db[_0x9bc9('0x38')][_0x9bc9('0x39')],function(_0x21d0f6){return{'name':_0x21d0f6['fieldName'],'type':_0x21d0f6['type'][_0x9bc9('0x3a')]};});_0x1fd0e1[_0x9bc9('0x3b')]=_[_0x9bc9('0x3c')](_0x313e97,_0x9bc9('0x35'));_0x1fd0e1[_0x9bc9('0x3d')]=_[_0x9bc9('0x3e')](_0x44b16e['query']);_0x1fd0e1[_0x9bc9('0x3f')]=_[_0x9bc9('0x40')](_0x1fd0e1[_0x9bc9('0x3b')],_0x1fd0e1[_0x9bc9('0x3d')]);_0x2c2b2b[_0x9bc9('0x41')]=_['intersection'](_0x1fd0e1[_0x9bc9('0x3b')],qs['fields'](_0x44b16e['query'][_0x9bc9('0x42')]));_0x2c2b2b['attributes']=_0x2c2b2b['attributes'][_0x9bc9('0x43')]?_0x2c2b2b[_0x9bc9('0x41')]:_0x1fd0e1[_0x9bc9('0x3b')];if(!_0x44b16e[_0x9bc9('0x3d')][_0x9bc9('0x44')](_0x9bc9('0x45'))){_0x2c2b2b['limit']=qs[_0x9bc9('0x2d')](_0x44b16e[_0x9bc9('0x3d')][_0x9bc9('0x2d')]);_0x2c2b2b[_0x9bc9('0x2c')]=qs['offset'](_0x44b16e['query'][_0x9bc9('0x2c')]);}_0x2c2b2b[_0x9bc9('0x46')]=qs[_0x9bc9('0x47')](_0x44b16e['query'][_0x9bc9('0x47')]);_0x2c2b2b['where']=qs['filters'](_[_0x9bc9('0x48')](_0x44b16e[_0x9bc9('0x3d')],_0x1fd0e1['filters']),_0x313e97);if(_0x44b16e['query']['filter']){_0x2c2b2b[_0x9bc9('0x49')]=_[_0x9bc9('0x4a')](_0x2c2b2b[_0x9bc9('0x49')],{'$or':_[_0x9bc9('0x3c')](_0x313e97,function(_0x12aa50){if(_0x12aa50['type']!==_0x9bc9('0x4b')){var _0x3e8019={};_0x3e8019[_0x12aa50['name']]={'$like':'%'+_0x44b16e[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x3e8019;}})});}_0x2c2b2b=_[_0x9bc9('0x4a')]({},_0x2c2b2b,_0x44b16e[_0x9bc9('0x4d')]);var _0x5e0fcf={'where':_0x2c2b2b[_0x9bc9('0x49')]};return db[_0x9bc9('0x38')]['count'](_0x5e0fcf)[_0x9bc9('0x33')](function(_0x78f3d1){_0x59e8f7[_0x9bc9('0x2b')]=_0x78f3d1;if(_0x44b16e['query']['includeAll']){_0x2c2b2b['include']=[{'all':!![]}];}return db[_0x9bc9('0x38')][_0x9bc9('0x4e')](_0x2c2b2b);})[_0x9bc9('0x33')](function(_0x19309a){_0x59e8f7[_0x9bc9('0x4f')]=_0x19309a;return _0x59e8f7;})[_0x9bc9('0x33')](respondWithFilteredResult(_0x16a333,_0x2c2b2b))[_0x9bc9('0x27')](handleError(_0x16a333,null));};exports[_0x9bc9('0x50')]=function(_0x36f389,_0x376978){var _0x2b01a0={'raw':![],'where':{'id':_0x36f389[_0x9bc9('0x51')]['id']}},_0x48540f={};_0x48540f[_0x9bc9('0x3b')]=_[_0x9bc9('0x3e')](db['ServicenowConfiguration'][_0x9bc9('0x39')]);_0x48540f[_0x9bc9('0x3d')]=_[_0x9bc9('0x3e')](_0x36f389[_0x9bc9('0x3d')]);_0x48540f[_0x9bc9('0x3f')]=_['intersection'](_0x48540f[_0x9bc9('0x3b')],_0x48540f[_0x9bc9('0x3d')]);_0x2b01a0[_0x9bc9('0x41')]=_[_0x9bc9('0x40')](_0x48540f['model'],qs['fields'](_0x36f389['query'][_0x9bc9('0x42')]));_0x2b01a0[_0x9bc9('0x41')]=_0x2b01a0[_0x9bc9('0x41')]['length']?_0x2b01a0['attributes']:_0x48540f[_0x9bc9('0x3b')];if(_0x36f389[_0x9bc9('0x3d')][_0x9bc9('0x52')]){_0x2b01a0[_0x9bc9('0x53')]=[{'all':!![]}];}_0x2b01a0=_[_0x9bc9('0x4a')]({},_0x2b01a0,_0x36f389[_0x9bc9('0x4d')]);return db[_0x9bc9('0x38')][_0x9bc9('0x54')](_0x2b01a0)['then'](handleEntityNotFound(_0x376978,null))[_0x9bc9('0x33')](respondWithResult(_0x376978,null))[_0x9bc9('0x27')](handleError(_0x376978,null));};exports['create']=function(_0x42500a,_0x3e7756){return db[_0x9bc9('0x38')][_0x9bc9('0x55')](_0x42500a['body'],{})[_0x9bc9('0x33')](respondWithResult(_0x3e7756,0xc9))[_0x9bc9('0x27')](handleError(_0x3e7756,null));};exports['update']=function(_0x45b6fc,_0x35ba82){if(_0x45b6fc[_0x9bc9('0x56')]['id']){delete _0x45b6fc[_0x9bc9('0x56')]['id'];}return db[_0x9bc9('0x38')]['find']({'where':{'id':_0x45b6fc[_0x9bc9('0x51')]['id']}})[_0x9bc9('0x33')](handleEntityNotFound(_0x35ba82,null))[_0x9bc9('0x33')](saveUpdates(_0x45b6fc[_0x9bc9('0x56')],null))['then'](respondWithResult(_0x35ba82,null))[_0x9bc9('0x27')](handleError(_0x35ba82,null));};exports[_0x9bc9('0x32')]=function(_0x286683,_0x187975){return db[_0x9bc9('0x38')][_0x9bc9('0x54')]({'where':{'id':_0x286683[_0x9bc9('0x51')]['id']}})[_0x9bc9('0x33')](handleEntityNotFound(_0x187975,null))[_0x9bc9('0x33')](removeEntity(_0x187975,null))[_0x9bc9('0x27')](handleError(_0x187975,null));};exports[_0x9bc9('0x57')]=function(_0x166cd1,_0x6521c,_0x20c817){var _0x47ac08={};var _0x60b40b={};var _0x521c47;var _0x4ea4db;return db[_0x9bc9('0x38')][_0x9bc9('0x58')]({'where':{'id':_0x166cd1[_0x9bc9('0x51')]['id']}})['then'](handleEntityNotFound(_0x6521c,null))['then'](function(_0x595093){if(_0x595093){_0x521c47=_0x595093;_0x60b40b['model']=_[_0x9bc9('0x3e')](db[_0x9bc9('0x59')][_0x9bc9('0x39')]);_0x60b40b[_0x9bc9('0x3d')]=_['keys'](_0x166cd1[_0x9bc9('0x3d')]);_0x60b40b[_0x9bc9('0x3f')]=_['intersection'](_0x60b40b[_0x9bc9('0x3b')],_0x60b40b[_0x9bc9('0x3d')]);_0x47ac08[_0x9bc9('0x41')]=_['intersection'](_0x60b40b[_0x9bc9('0x3b')],qs['fields'](_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x42')]));_0x47ac08[_0x9bc9('0x41')]=_0x47ac08[_0x9bc9('0x41')][_0x9bc9('0x43')]?_0x47ac08[_0x9bc9('0x41')]:_0x60b40b[_0x9bc9('0x3b')];_0x47ac08['order']=qs[_0x9bc9('0x47')](_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x47')]);_0x47ac08[_0x9bc9('0x49')]=qs[_0x9bc9('0x3f')](_[_0x9bc9('0x48')](_0x166cd1[_0x9bc9('0x3d')],_0x60b40b[_0x9bc9('0x3f')]));if(_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x4c')]){_0x47ac08[_0x9bc9('0x49')]=_[_0x9bc9('0x4a')](_0x47ac08[_0x9bc9('0x49')],{'$or':_[_0x9bc9('0x3c')](_0x47ac08[_0x9bc9('0x41')],function(_0x48fd5c){var _0x2d8edf={};_0x2d8edf[_0x48fd5c]={'$like':'%'+_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x2d8edf;})});}_0x47ac08=_[_0x9bc9('0x4a')]({},_0x47ac08,_0x166cd1[_0x9bc9('0x4d')]);return _0x521c47[_0x9bc9('0x57')](_0x47ac08);}})[_0x9bc9('0x33')](function(_0x229ddd){if(_0x229ddd){_0x4ea4db=_0x229ddd[_0x9bc9('0x43')];if(!_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x44')]('nolimit')){_0x47ac08[_0x9bc9('0x2d')]=qs[_0x9bc9('0x2d')](_0x166cd1[_0x9bc9('0x3d')][_0x9bc9('0x2d')]);_0x47ac08[_0x9bc9('0x2c')]=qs['offset'](_0x166cd1['query']['offset']);}return _0x521c47[_0x9bc9('0x57')](_0x47ac08);}})[_0x9bc9('0x33')](function(_0x20a2d8){if(_0x20a2d8){return _0x20a2d8?{'count':_0x4ea4db,'rows':_0x20a2d8}:null;}})['then'](respondWithResult(_0x6521c,null))[_0x9bc9('0x27')](handleError(_0x6521c,null));};exports[_0x9bc9('0x5a')]=function(_0x57a5bf,_0x10f20f,_0x2a5a8f){var _0x583e51={};var _0x43fefd={};var _0x2666dd;var _0x1a8845;return db['ServicenowConfiguration'][_0x9bc9('0x58')]({'where':{'id':_0x57a5bf['params']['id']}})['then'](handleEntityNotFound(_0x10f20f,null))[_0x9bc9('0x33')](function(_0x56164b){if(_0x56164b){_0x2666dd=_0x56164b;_0x43fefd[_0x9bc9('0x3b')]=_[_0x9bc9('0x3e')](db[_0x9bc9('0x59')][_0x9bc9('0x39')]);_0x43fefd[_0x9bc9('0x3d')]=_['keys'](_0x57a5bf[_0x9bc9('0x3d')]);_0x43fefd['filters']=_['intersection'](_0x43fefd['model'],_0x43fefd[_0x9bc9('0x3d')]);_0x583e51[_0x9bc9('0x41')]=_[_0x9bc9('0x40')](_0x43fefd[_0x9bc9('0x3b')],qs[_0x9bc9('0x42')](_0x57a5bf[_0x9bc9('0x3d')]['fields']));_0x583e51[_0x9bc9('0x41')]=_0x583e51[_0x9bc9('0x41')][_0x9bc9('0x43')]?_0x583e51[_0x9bc9('0x41')]:_0x43fefd[_0x9bc9('0x3b')];_0x583e51[_0x9bc9('0x46')]=qs['sort'](_0x57a5bf[_0x9bc9('0x3d')]['sort']);_0x583e51['where']=qs[_0x9bc9('0x3f')](_['pick'](_0x57a5bf[_0x9bc9('0x3d')],_0x43fefd['filters']));if(_0x57a5bf[_0x9bc9('0x3d')][_0x9bc9('0x4c')]){_0x583e51[_0x9bc9('0x49')]=_['merge'](_0x583e51[_0x9bc9('0x49')],{'$or':_[_0x9bc9('0x3c')](_0x583e51[_0x9bc9('0x41')],function(_0x26f1bf){var _0x274c0a={};_0x274c0a[_0x26f1bf]={'$like':'%'+_0x57a5bf[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x274c0a;})});}_0x583e51=_[_0x9bc9('0x4a')]({},_0x583e51,_0x57a5bf[_0x9bc9('0x4d')]);return _0x2666dd['getSubjects'](_0x583e51);}})['then'](function(_0x3296bc){if(_0x3296bc){_0x1a8845=_0x3296bc[_0x9bc9('0x43')];if(!_0x57a5bf[_0x9bc9('0x3d')]['hasOwnProperty']('nolimit')){_0x583e51[_0x9bc9('0x2d')]=qs['limit'](_0x57a5bf[_0x9bc9('0x3d')][_0x9bc9('0x2d')]);_0x583e51['offset']=qs[_0x9bc9('0x2c')](_0x57a5bf['query'][_0x9bc9('0x2c')]);}return _0x2666dd['getSubjects'](_0x583e51);}})[_0x9bc9('0x33')](function(_0x5347fa){if(_0x5347fa){return _0x5347fa?{'count':_0x1a8845,'rows':_0x5347fa}:null;}})[_0x9bc9('0x33')](respondWithResult(_0x10f20f,null))['catch'](handleError(_0x10f20f,null));};exports[_0x9bc9('0x5b')]=function(_0x2922fc,_0x55f33e,_0x52ef8c){var _0x1ca4fa={};var _0x36973e={};var _0x494c26;var _0xb74df5;return db[_0x9bc9('0x38')]['findOne']({'where':{'id':_0x2922fc[_0x9bc9('0x51')]['id']}})[_0x9bc9('0x33')](handleEntityNotFound(_0x55f33e,null))['then'](function(_0x198722){if(_0x198722){_0x494c26=_0x198722;_0x36973e[_0x9bc9('0x3b')]=_[_0x9bc9('0x3e')](db[_0x9bc9('0x59')]['rawAttributes']);_0x36973e[_0x9bc9('0x3d')]=_[_0x9bc9('0x3e')](_0x2922fc[_0x9bc9('0x3d')]);_0x36973e['filters']=_[_0x9bc9('0x40')](_0x36973e[_0x9bc9('0x3b')],_0x36973e[_0x9bc9('0x3d')]);_0x1ca4fa[_0x9bc9('0x41')]=_[_0x9bc9('0x40')](_0x36973e['model'],qs[_0x9bc9('0x42')](_0x2922fc['query'][_0x9bc9('0x42')]));_0x1ca4fa[_0x9bc9('0x41')]=_0x1ca4fa[_0x9bc9('0x41')][_0x9bc9('0x43')]?_0x1ca4fa['attributes']:_0x36973e[_0x9bc9('0x3b')];_0x1ca4fa[_0x9bc9('0x46')]=qs['sort'](_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x47')]);_0x1ca4fa[_0x9bc9('0x49')]=qs[_0x9bc9('0x3f')](_[_0x9bc9('0x48')](_0x2922fc['query'],_0x36973e['filters']));if(_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x4c')]){_0x1ca4fa['where']=_[_0x9bc9('0x4a')](_0x1ca4fa[_0x9bc9('0x49')],{'$or':_['map'](_0x1ca4fa[_0x9bc9('0x41')],function(_0x2d9ca1){var _0x3966af={};_0x3966af[_0x2d9ca1]={'$like':'%'+_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x4c')]+'%'};return _0x3966af;})});}_0x1ca4fa=_[_0x9bc9('0x4a')]({},_0x1ca4fa,_0x2922fc['options']);return _0x494c26['getDescriptions'](_0x1ca4fa);}})['then'](function(_0x35098a){if(_0x35098a){_0xb74df5=_0x35098a[_0x9bc9('0x43')];if(!_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x44')]('nolimit')){_0x1ca4fa[_0x9bc9('0x2d')]=qs[_0x9bc9('0x2d')](_0x2922fc[_0x9bc9('0x3d')]['limit']);_0x1ca4fa[_0x9bc9('0x2c')]=qs[_0x9bc9('0x2c')](_0x2922fc[_0x9bc9('0x3d')][_0x9bc9('0x2c')]);}return _0x494c26['getDescriptions'](_0x1ca4fa);}})[_0x9bc9('0x33')](function(_0x32153d){if(_0x32153d){return _0x32153d?{'count':_0xb74df5,'rows':_0x32153d}:null;}})[_0x9bc9('0x33')](respondWithResult(_0x55f33e,null))['catch'](handleError(_0x55f33e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b50b6e1..db8087b 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 _0x2eaf=['path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x381f60,_0x5986d8){var _0x525b7d=function(_0x338f29){while(--_0x338f29){_0x381f60['push'](_0x381f60['shift']());}};_0x525b7d(++_0x5986d8);}(_0x2eaf,0x16f));var _0xf2ea=function(_0x48a1dc,_0x3421dd){_0x48a1dc=_0x48a1dc-0x0;var _0x5c079e=_0x2eaf[_0x48a1dc];return _0x5c079e;};'use strict';var _=require(_0xf2ea('0x0'));var util=require(_0xf2ea('0x1'));var logger=require(_0xf2ea('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2ea('0x3'));var rp=require(_0xf2ea('0x4'));var fs=require('fs');var path=require(_0xf2ea('0x5'));var rimraf=require('rimraf');var config=require(_0xf2ea('0x6'));var attributes=require(_0xf2ea('0x7'));module[_0xf2ea('0x8')]=function(_0x20ca7e,_0x3a479c){return _0x20ca7e[_0xf2ea('0x9')](_0xf2ea('0xa'),attributes,{'tableName':_0xf2ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e09=['ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x4332f3,_0x1c667f){var _0x371d18=function(_0x1d36e6){while(--_0x1d36e6){_0x4332f3['push'](_0x4332f3['shift']());}};_0x371d18(++_0x1c667f);}(_0x2e09,0xc6));var _0x92e0=function(_0x4e9f45,_0x5d1bcd){_0x4e9f45=_0x4e9f45-0x0;var _0x2ccec3=_0x2e09[_0x4e9f45];return _0x2ccec3;};'use strict';var _=require(_0x92e0('0x0'));var util=require('util');var logger=require(_0x92e0('0x1'))(_0x92e0('0x2'));var moment=require(_0x92e0('0x3'));var BPromise=require(_0x92e0('0x4'));var rp=require(_0x92e0('0x5'));var fs=require('fs');var path=require(_0x92e0('0x6'));var rimraf=require(_0x92e0('0x7'));var config=require(_0x92e0('0x8'));var attributes=require(_0x92e0('0x9'));module[_0x92e0('0xa')]=function(_0xf5c84b,_0x47bbe7){return _0xf5c84b[_0x92e0('0xb')](_0x92e0('0xc'),attributes,{'tableName':_0x92e0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 54e2808..3673863 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 _0xb578=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x313d69,_0x5d092a){var _0x4f2598=function(_0x4293ae){while(--_0x4293ae){_0x313d69['push'](_0x313d69['shift']());}};_0x4f2598(++_0x5d092a);}(_0xb578,0xfc));var _0x8b57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb578[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8b57('0x0'));var util=require(_0x8b57('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b57('0x2'));var fs=require('fs');var Redis=require(_0x8b57('0x3'));var db=require(_0x8b57('0x4'))['db'];var utils=require(_0x8b57('0x5'));var logger=require(_0x8b57('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b57('0x7'));var client=jayson['client'][_0x8b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfb46b8,_0x364864,_0xbf48a1){return new BPromise(function(_0x18bfc1,_0x232a3c){return client[_0x8b57('0x9')](_0xfb46b8,_0xbf48a1)[_0x8b57('0xa')](function(_0xefc040){logger['info'](_0x8b57('0xb'),_0x364864,_0x8b57('0xc'));logger[_0x8b57('0xd')](_0x8b57('0xe'),_0x364864,_0x8b57('0xc'),JSON['stringify'](_0xefc040));if(_0xefc040[_0x8b57('0xf')]){if(_0xefc040[_0x8b57('0xf')]['code']===0x1f4){logger[_0x8b57('0xf')](_0x8b57('0xb'),_0x364864,_0xefc040[_0x8b57('0xf')][_0x8b57('0x10')]);return _0x232a3c(_0xefc040[_0x8b57('0xf')][_0x8b57('0x10')]);}logger[_0x8b57('0xf')](_0x8b57('0xb'),_0x364864,_0xefc040[_0x8b57('0xf')]['message']);return _0x18bfc1(_0xefc040['error'][_0x8b57('0x10')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x364864,_0x8b57('0xc'));_0x18bfc1(_0xefc040[_0x8b57('0x11')][_0x8b57('0x10')]);}})[_0x8b57('0x12')](function(_0x16f210){logger[_0x8b57('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x364864,_0x16f210);_0x232a3c(_0x16f210);});});} \ No newline at end of file +var _0x4e9f=['jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1680a9,_0x40651d){var _0x1e456a=function(_0x95654){while(--_0x95654){_0x1680a9['push'](_0x1680a9['shift']());}};_0x1e456a(++_0x40651d);}(_0x4e9f,0x122));var _0xf4e9=function(_0xf7b39e,_0x371b92){_0xf7b39e=_0xf7b39e-0x0;var _0x322d06=_0x4e9f[_0xf7b39e];return _0x322d06;};'use strict';var _=require(_0xf4e9('0x0'));var util=require(_0xf4e9('0x1'));var moment=require(_0xf4e9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4e9('0x3'));var fs=require('fs');var Redis=require(_0xf4e9('0x4'));var db=require(_0xf4e9('0x5'))['db'];var utils=require(_0xf4e9('0x6'));var logger=require(_0xf4e9('0x7'))(_0xf4e9('0x8'));var config=require(_0xf4e9('0x9'));var jayson=require(_0xf4e9('0xa'));var client=jayson[_0xf4e9('0xb')][_0xf4e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32cf09,_0x572a68,_0x44ce60){return new BPromise(function(_0x306159,_0x5c77a5){return client['request'](_0x32cf09,_0x44ce60)[_0xf4e9('0xd')](function(_0x151b7a){logger[_0xf4e9('0xe')](_0xf4e9('0xf'),_0x572a68,_0xf4e9('0x10'));logger[_0xf4e9('0x11')](_0xf4e9('0x12'),_0x572a68,'request\x20sent',JSON[_0xf4e9('0x13')](_0x151b7a));if(_0x151b7a[_0xf4e9('0x14')]){if(_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x15')]===0x1f4){logger[_0xf4e9('0x14')](_0xf4e9('0xf'),_0x572a68,_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);return _0x5c77a5(_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);}logger[_0xf4e9('0x14')](_0xf4e9('0xf'),_0x572a68,_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);return _0x306159(_0x151b7a[_0xf4e9('0x14')][_0xf4e9('0x16')]);}else{logger[_0xf4e9('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x572a68,_0xf4e9('0x10'));_0x306159(_0x151b7a[_0xf4e9('0x17')][_0xf4e9('0x16')]);}})[_0xf4e9('0x18')](function(_0x46e9c5){logger[_0xf4e9('0x14')](_0xf4e9('0xf'),_0x572a68,_0x46e9c5);_0x5c77a5(_0x46e9c5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1f8ffea..784d847 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 _0x7118=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x556b1d,_0xa0f67e){var _0x346381=function(_0x31a455){while(--_0x31a455){_0x556b1d['push'](_0x556b1d['shift']());}};_0x346381(++_0xa0f67e);}(_0x7118,0x1d4));var _0x8711=function(_0x33382a,_0x55a6f5){_0x33382a=_0x33382a-0x0;var _0x130b96=_0x7118[_0x33382a];return _0x130b96;};'use strict';var multer=require(_0x8711('0x0'));var util=require(_0x8711('0x1'));var path=require(_0x8711('0x2'));var timeout=require(_0x8711('0x3'));var express=require(_0x8711('0x4'));var router=express[_0x8711('0x5')]();var auth=require(_0x8711('0x6'));var interaction=require(_0x8711('0x7'));var config=require(_0x8711('0x8'));var controller=require(_0x8711('0x9'));router[_0x8711('0xa')]('/',auth['isAuthenticated'](),controller[_0x8711('0xb')]);router[_0x8711('0xa')](_0x8711('0xc'),auth[_0x8711('0xd')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')]('/',auth[_0x8711('0xd')](),controller['create']);router[_0x8711('0x10')]('/:id',auth[_0x8711('0xd')](),controller[_0x8711('0x11')]);router['delete'](_0x8711('0xc'),auth[_0x8711('0xd')](),controller[_0x8711('0x12')]);module['exports']=router; \ No newline at end of file +var _0x32ca=['express','Router','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3d8c81,_0xac262d){var _0x251bc8=function(_0x3b2ecc){while(--_0x3b2ecc){_0x3d8c81['push'](_0x3d8c81['shift']());}};_0x251bc8(++_0xac262d);}(_0x32ca,0x1d1));var _0xa32c=function(_0x28bf5d,_0x4d2cfb){_0x28bf5d=_0x28bf5d-0x0;var _0x39a35c=_0x32ca[_0x28bf5d];return _0x39a35c;};'use strict';var multer=require(_0xa32c('0x0'));var util=require(_0xa32c('0x1'));var path=require(_0xa32c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa32c('0x3'));var router=express[_0xa32c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa32c('0x5'));var config=require('../../config/environment');var controller=require(_0xa32c('0x6'));router[_0xa32c('0x7')]('/',auth[_0xa32c('0x8')](),controller[_0xa32c('0x9')]);router[_0xa32c('0x7')](_0xa32c('0xa'),auth['isAuthenticated'](),controller[_0xa32c('0xb')]);router[_0xa32c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa32c('0xd')](_0xa32c('0xa'),auth[_0xa32c('0x8')](),controller[_0xa32c('0xe')]);router[_0xa32c('0xf')](_0xa32c('0xa'),auth[_0xa32c('0x8')](),controller[_0xa32c('0x10')]);module[_0xa32c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3deeed3..31f8a18 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 _0x2dd1=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x12bdbb,_0x2e289b){var _0x553c08=function(_0xe9defe){while(--_0xe9defe){_0x12bdbb['push'](_0x12bdbb['shift']());}};_0x553c08(++_0x2e289b);}(_0x2dd1,0x18c));var _0x12dd=function(_0xf8298,_0x3d4d0b){_0xf8298=_0xf8298-0x0;var _0x51b895=_0x2dd1[_0xf8298];return _0x51b895;};'use strict';var Sequelize=require(_0x12dd('0x0'));module[_0x12dd('0x1')]={'type':{'type':Sequelize[_0x12dd('0x2')](_0x12dd('0x3'),_0x12dd('0x4'),_0x12dd('0x5'),'keyValue'),'defaultValue':_0x12dd('0x3')},'content':{'type':Sequelize[_0x12dd('0x6')]},'key':{'type':Sequelize[_0x12dd('0x6')]},'keyType':{'type':Sequelize[_0x12dd('0x2')](_0x12dd('0x3'),_0x12dd('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x12dd('0x6')]},'idField':{'type':Sequelize[_0x12dd('0x6')]},'nameField':{'type':Sequelize[_0x12dd('0x6')]},'customField':{'type':Sequelize[_0x12dd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc418=['keyValue','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable'];(function(_0x553ac2,_0x156cf0){var _0x2182d8=function(_0x594e0f){while(--_0x594e0f){_0x553ac2['push'](_0x553ac2['shift']());}};_0x2182d8(++_0x156cf0);}(_0xc418,0x1cc));var _0x8c41=function(_0x88dc75,_0x526f60){_0x88dc75=_0x88dc75-0x0;var _0x5b8282=_0xc418[_0x88dc75];return _0x5b8282;};'use strict';var Sequelize=require('sequelize');module[_0x8c41('0x0')]={'type':{'type':Sequelize[_0x8c41('0x1')](_0x8c41('0x2'),_0x8c41('0x3'),'customVariable',_0x8c41('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8c41('0x5')]},'key':{'type':Sequelize[_0x8c41('0x5')]},'keyType':{'type':Sequelize[_0x8c41('0x1')](_0x8c41('0x2'),'variable',_0x8c41('0x6'))},'keyContent':{'type':Sequelize[_0x8c41('0x5')]},'idField':{'type':Sequelize[_0x8c41('0x5')]},'nameField':{'type':Sequelize[_0x8c41('0x5')]},'customField':{'type':Sequelize[_0x8c41('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c41('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5d44439..637ae37 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 _0x0490=['count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','ServicenowField','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x0490,0x147));var _0x0049=function(_0x39eb2d,_0x3e1745){_0x39eb2d=_0x39eb2d-0x0;var _0x403b69=_0x0490[_0x39eb2d];return _0x403b69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0049('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0049('0x1'));var BPromise=require(_0x0049('0x2'));var Mustache=require(_0x0049('0x3'));var util=require(_0x0049('0x4'));var path=require(_0x0049('0x5'));var sox=require(_0x0049('0x6'));var csv=require(_0x0049('0x7'));var ejs=require(_0x0049('0x8'));var fs=require('fs');var _=require(_0x0049('0x9'));var squel=require('squel');var crypto=require(_0x0049('0xa'));var jsforce=require(_0x0049('0xb'));var deskjs=require(_0x0049('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0049('0xd'));var Papa=require(_0x0049('0xe'));var Redis=require(_0x0049('0xf'));var authService=require(_0x0049('0x10'));var qs=require(_0x0049('0x11'));var as=require(_0x0049('0x12'));var hardwareService=require(_0x0049('0x13'));var logger=require(_0x0049('0x14'))(_0x0049('0x15'));var utils=require('../../config/utils');var config=require(_0x0049('0x16'));var licenseUtil=require(_0x0049('0x17'));var db=require(_0x0049('0x18'))['db'];function respondWithStatusCode(_0x5b4d44,_0x547be9){_0x547be9=_0x547be9||0xcc;return function(_0x3cf392){if(_0x3cf392){return _0x5b4d44[_0x0049('0x19')](_0x547be9);}return _0x5b4d44[_0x0049('0x1a')](_0x547be9)[_0x0049('0x1b')]();};}function respondWithResult(_0x42dc6b,_0x5934fc){_0x5934fc=_0x5934fc||0xc8;return function(_0x3aabfb){if(_0x3aabfb){return _0x42dc6b[_0x0049('0x1a')](_0x5934fc)['json'](_0x3aabfb);}};}function respondWithFilteredResult(_0x1802f5,_0x2aace1){return function(_0x2d6b06){if(_0x2d6b06){var _0x1a62aa=_0x2d6b06[_0x0049('0x1c')],_0x5adcf2=_0x2aace1[_0x0049('0x1d')],_0x502038=_0x2aace1[_0x0049('0x1d')]+_0x2aace1[_0x0049('0x1e')],_0x4315b5;if(_0x502038>=_0x1a62aa){_0x502038=_0x1a62aa;_0x4315b5=0xc8;}else{_0x4315b5=0xce;}_0x1802f5[_0x0049('0x1a')](_0x4315b5);return _0x1802f5[_0x0049('0x1f')](_0x0049('0x20'),_0x5adcf2+'-'+_0x502038+'/'+_0x1a62aa)[_0x0049('0x21')](_0x2d6b06);}return null;};}function patchUpdates(_0x226808){return function(_0x59c64f){try{jsonpatch[_0x0049('0x22')](_0x59c64f,_0x226808,!![]);}catch(_0x4367ce){return BPromise['reject'](_0x4367ce);}return _0x59c64f[_0x0049('0x23')]();};}function saveUpdates(_0x4624ff,_0x2a5ec3){return function(_0x996fa5){if(_0x996fa5){return _0x996fa5[_0x0049('0x24')](_0x4624ff)['then'](function(_0x26a9fb){return _0x26a9fb;});}return null;};}function removeEntity(_0x462ceb,_0x49c00b){return function(_0x2170d2){if(_0x2170d2){return _0x2170d2[_0x0049('0x25')]()[_0x0049('0x26')](function(){_0x462ceb[_0x0049('0x1a')](0xcc)[_0x0049('0x1b')]();});}};}function handleEntityNotFound(_0x2e9f44,_0x223c9c){return function(_0x457bb3){if(!_0x457bb3){_0x2e9f44[_0x0049('0x19')](0x194);}return _0x457bb3;};}function handleError(_0x7a9715,_0x39eb94){_0x39eb94=_0x39eb94||0x1f4;return function(_0x211e5b){logger['error'](_0x211e5b[_0x0049('0x27')]);if(_0x211e5b[_0x0049('0x28')]){delete _0x211e5b[_0x0049('0x28')];}_0x7a9715[_0x0049('0x1a')](_0x39eb94)[_0x0049('0x29')](_0x211e5b);};}exports['index']=function(_0x29bae3,_0x525ecb){var _0x8bb034={},_0x3679d0={},_0x450698={'count':0x0,'rows':[]};var _0x8d272b=_['map'](db[_0x0049('0x2a')][_0x0049('0x2b')],function(_0x2407d8){return{'name':_0x2407d8[_0x0049('0x2c')],'type':_0x2407d8[_0x0049('0x2d')]['key']};});_0x3679d0[_0x0049('0x2e')]=_[_0x0049('0x2f')](_0x8d272b,_0x0049('0x28'));_0x3679d0['query']=_[_0x0049('0x30')](_0x29bae3[_0x0049('0x31')]);_0x3679d0[_0x0049('0x32')]=_[_0x0049('0x33')](_0x3679d0['model'],_0x3679d0[_0x0049('0x31')]);_0x8bb034[_0x0049('0x34')]=_['intersection'](_0x3679d0[_0x0049('0x2e')],qs[_0x0049('0x35')](_0x29bae3['query'][_0x0049('0x35')]));_0x8bb034[_0x0049('0x34')]=_0x8bb034[_0x0049('0x34')][_0x0049('0x36')]?_0x8bb034[_0x0049('0x34')]:_0x3679d0['model'];if(!_0x29bae3[_0x0049('0x31')][_0x0049('0x37')](_0x0049('0x38'))){_0x8bb034[_0x0049('0x1e')]=qs[_0x0049('0x1e')](_0x29bae3['query'][_0x0049('0x1e')]);_0x8bb034['offset']=qs[_0x0049('0x1d')](_0x29bae3[_0x0049('0x31')][_0x0049('0x1d')]);}_0x8bb034['order']=qs[_0x0049('0x39')](_0x29bae3['query'][_0x0049('0x39')]);_0x8bb034[_0x0049('0x3a')]=qs[_0x0049('0x32')](_['pick'](_0x29bae3[_0x0049('0x31')],_0x3679d0[_0x0049('0x32')]),_0x8d272b);if(_0x29bae3[_0x0049('0x31')][_0x0049('0x3b')]){_0x8bb034[_0x0049('0x3a')]=_[_0x0049('0x3c')](_0x8bb034['where'],{'$or':_[_0x0049('0x2f')](_0x8d272b,function(_0x3902f5){if(_0x3902f5['type']!=='VIRTUAL'){var _0xb8b839={};_0xb8b839[_0x3902f5[_0x0049('0x28')]]={'$like':'%'+_0x29bae3[_0x0049('0x31')][_0x0049('0x3b')]+'%'};return _0xb8b839;}})});}_0x8bb034=_[_0x0049('0x3c')]({},_0x8bb034,_0x29bae3[_0x0049('0x3d')]);var _0x2ab147={'where':_0x8bb034[_0x0049('0x3a')]};return db['ServicenowField'][_0x0049('0x1c')](_0x2ab147)[_0x0049('0x26')](function(_0x46c6b5){_0x450698[_0x0049('0x1c')]=_0x46c6b5;if(_0x29bae3[_0x0049('0x31')][_0x0049('0x3e')]){_0x8bb034[_0x0049('0x3f')]=[{'all':!![]}];}return db[_0x0049('0x2a')]['findAll'](_0x8bb034);})[_0x0049('0x26')](function(_0x1e8903){_0x450698[_0x0049('0x40')]=_0x1e8903;return _0x450698;})[_0x0049('0x26')](respondWithFilteredResult(_0x525ecb,_0x8bb034))[_0x0049('0x41')](handleError(_0x525ecb,null));};exports[_0x0049('0x42')]=function(_0x2acbc4,_0x21ea1a){var _0x469bb1={'raw':!![],'where':{'id':_0x2acbc4[_0x0049('0x43')]['id']}},_0x127d27={};_0x127d27[_0x0049('0x2e')]=_[_0x0049('0x30')](db['ServicenowField'][_0x0049('0x2b')]);_0x127d27[_0x0049('0x31')]=_[_0x0049('0x30')](_0x2acbc4['query']);_0x127d27['filters']=_[_0x0049('0x33')](_0x127d27['model'],_0x127d27[_0x0049('0x31')]);_0x469bb1[_0x0049('0x34')]=_[_0x0049('0x33')](_0x127d27[_0x0049('0x2e')],qs[_0x0049('0x35')](_0x2acbc4[_0x0049('0x31')][_0x0049('0x35')]));_0x469bb1[_0x0049('0x34')]=_0x469bb1['attributes']['length']?_0x469bb1['attributes']:_0x127d27[_0x0049('0x2e')];if(_0x2acbc4[_0x0049('0x31')][_0x0049('0x3e')]){_0x469bb1['include']=[{'all':!![]}];}_0x469bb1=_[_0x0049('0x3c')]({},_0x469bb1,_0x2acbc4[_0x0049('0x3d')]);return db[_0x0049('0x2a')]['find'](_0x469bb1)['then'](handleEntityNotFound(_0x21ea1a,null))['then'](respondWithResult(_0x21ea1a,null))[_0x0049('0x41')](handleError(_0x21ea1a,null));};exports['create']=function(_0x4f829e,_0x19e16c){return db[_0x0049('0x2a')][_0x0049('0x44')](_0x4f829e[_0x0049('0x45')],{})[_0x0049('0x26')](respondWithResult(_0x19e16c,0xc9))['catch'](handleError(_0x19e16c,null));};exports[_0x0049('0x24')]=function(_0x2862bf,_0xd4254){if(_0x2862bf[_0x0049('0x45')]['id']){delete _0x2862bf[_0x0049('0x45')]['id'];}return db[_0x0049('0x2a')]['find']({'where':{'id':_0x2862bf[_0x0049('0x43')]['id']}})['then'](handleEntityNotFound(_0xd4254,null))[_0x0049('0x26')](saveUpdates(_0x2862bf['body'],null))[_0x0049('0x26')](respondWithResult(_0xd4254,null))[_0x0049('0x41')](handleError(_0xd4254,null));};exports[_0x0049('0x25')]=function(_0xf34d0e,_0xc3a900){return db['ServicenowField'][_0x0049('0x46')]({'where':{'id':_0xf34d0e[_0x0049('0x43')]['id']}})[_0x0049('0x26')](handleEntityNotFound(_0xc3a900,null))[_0x0049('0x26')](removeEntity(_0xc3a900,null))[_0x0049('0x41')](handleError(_0xc3a900,null));}; \ No newline at end of file +var _0xa88f=['error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','params','fields','length','merge','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','reject','update','then','destroy'];(function(_0x704ab3,_0x4c65a2){var _0xf235b0=function(_0xd7a871){while(--_0xd7a871){_0x704ab3['push'](_0x704ab3['shift']());}};_0xf235b0(++_0x4c65a2);}(_0xa88f,0x182));var _0xfa88=function(_0x2ca8af,_0x50514a){_0x2ca8af=_0x2ca8af-0x0;var _0x142dd7=_0xa88f[_0x2ca8af];return _0x142dd7;};'use strict';var pdf=require(_0xfa88('0x0'));var emlformat=require(_0xfa88('0x1'));var rimraf=require(_0xfa88('0x2'));var zipdir=require(_0xfa88('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa88('0x4'));var BPromise=require(_0xfa88('0x5'));var Mustache=require('mustache');var util=require(_0xfa88('0x6'));var path=require(_0xfa88('0x7'));var sox=require(_0xfa88('0x8'));var csv=require(_0xfa88('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfa88('0xa'));var jsforce=require(_0xfa88('0xb'));var deskjs=require(_0xfa88('0xc'));var toCsv=require(_0xfa88('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfa88('0xd'));var authService=require(_0xfa88('0xe'));var qs=require(_0xfa88('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa88('0x10'));var logger=require(_0xfa88('0x11'))('api');var utils=require(_0xfa88('0x12'));var config=require(_0xfa88('0x13'));var licenseUtil=require(_0xfa88('0x14'));var db=require(_0xfa88('0x15'))['db'];function respondWithStatusCode(_0x1f5142,_0x1be999){_0x1be999=_0x1be999||0xcc;return function(_0x5232e4){if(_0x5232e4){return _0x1f5142[_0xfa88('0x16')](_0x1be999);}return _0x1f5142['status'](_0x1be999)[_0xfa88('0x17')]();};}function respondWithResult(_0x57bde2,_0x39f7b2){_0x39f7b2=_0x39f7b2||0xc8;return function(_0x3448a5){if(_0x3448a5){return _0x57bde2['status'](_0x39f7b2)[_0xfa88('0x18')](_0x3448a5);}};}function respondWithFilteredResult(_0x1a74bd,_0x49a3a9){return function(_0xffbc0a){if(_0xffbc0a){var _0x39e9c5=_0xffbc0a[_0xfa88('0x19')],_0x40daca=_0x49a3a9[_0xfa88('0x1a')],_0x18380a=_0x49a3a9[_0xfa88('0x1a')]+_0x49a3a9[_0xfa88('0x1b')],_0x506f6f;if(_0x18380a>=_0x39e9c5){_0x18380a=_0x39e9c5;_0x506f6f=0xc8;}else{_0x506f6f=0xce;}_0x1a74bd[_0xfa88('0x1c')](_0x506f6f);return _0x1a74bd[_0xfa88('0x1d')]('Content-Range',_0x40daca+'-'+_0x18380a+'/'+_0x39e9c5)[_0xfa88('0x18')](_0xffbc0a);}return null;};}function patchUpdates(_0xa7fe06){return function(_0x1bfe4f){try{jsonpatch['apply'](_0x1bfe4f,_0xa7fe06,!![]);}catch(_0x182246){return BPromise[_0xfa88('0x1e')](_0x182246);}return _0x1bfe4f['save']();};}function saveUpdates(_0x1e6897,_0x15c286){return function(_0x48c827){if(_0x48c827){return _0x48c827[_0xfa88('0x1f')](_0x1e6897)[_0xfa88('0x20')](function(_0x1b0808){return _0x1b0808;});}return null;};}function removeEntity(_0x57f3b5,_0x5191af){return function(_0x394b93){if(_0x394b93){return _0x394b93[_0xfa88('0x21')]()[_0xfa88('0x20')](function(){_0x57f3b5['status'](0xcc)[_0xfa88('0x17')]();});}};}function handleEntityNotFound(_0x33e5c4,_0x49d00e){return function(_0x5eb8d1){if(!_0x5eb8d1){_0x33e5c4['sendStatus'](0x194);}return _0x5eb8d1;};}function handleError(_0x52bf05,_0x4f0d16){_0x4f0d16=_0x4f0d16||0x1f4;return function(_0x5a4d05){logger[_0xfa88('0x22')](_0x5a4d05[_0xfa88('0x23')]);if(_0x5a4d05['name']){delete _0x5a4d05[_0xfa88('0x24')];}_0x52bf05[_0xfa88('0x1c')](_0x4f0d16)['send'](_0x5a4d05);};}exports[_0xfa88('0x25')]=function(_0x3114a8,_0xcb683e){var _0x531986={},_0x25023f={},_0x193580={'count':0x0,'rows':[]};var _0x586b99=_[_0xfa88('0x26')](db[_0xfa88('0x27')][_0xfa88('0x28')],function(_0x584e7b){return{'name':_0x584e7b[_0xfa88('0x29')],'type':_0x584e7b[_0xfa88('0x2a')][_0xfa88('0x2b')]};});_0x25023f[_0xfa88('0x2c')]=_[_0xfa88('0x26')](_0x586b99,_0xfa88('0x24'));_0x25023f[_0xfa88('0x2d')]=_[_0xfa88('0x2e')](_0x3114a8[_0xfa88('0x2d')]);_0x25023f[_0xfa88('0x2f')]=_['intersection'](_0x25023f[_0xfa88('0x2c')],_0x25023f[_0xfa88('0x2d')]);_0x531986[_0xfa88('0x30')]=_[_0xfa88('0x31')](_0x25023f[_0xfa88('0x2c')],qs['fields'](_0x3114a8[_0xfa88('0x2d')]['fields']));_0x531986[_0xfa88('0x30')]=_0x531986[_0xfa88('0x30')]['length']?_0x531986[_0xfa88('0x30')]:_0x25023f[_0xfa88('0x2c')];if(!_0x3114a8['query'][_0xfa88('0x32')](_0xfa88('0x33'))){_0x531986[_0xfa88('0x1b')]=qs[_0xfa88('0x1b')](_0x3114a8[_0xfa88('0x2d')]['limit']);_0x531986[_0xfa88('0x1a')]=qs[_0xfa88('0x1a')](_0x3114a8[_0xfa88('0x2d')]['offset']);}_0x531986[_0xfa88('0x34')]=qs[_0xfa88('0x35')](_0x3114a8[_0xfa88('0x2d')][_0xfa88('0x35')]);_0x531986[_0xfa88('0x36')]=qs['filters'](_[_0xfa88('0x37')](_0x3114a8[_0xfa88('0x2d')],_0x25023f['filters']),_0x586b99);if(_0x3114a8['query'][_0xfa88('0x38')]){_0x531986[_0xfa88('0x36')]=_['merge'](_0x531986[_0xfa88('0x36')],{'$or':_['map'](_0x586b99,function(_0x354ccc){if(_0x354ccc[_0xfa88('0x2a')]!=='VIRTUAL'){var _0x2fc3c9={};_0x2fc3c9[_0x354ccc[_0xfa88('0x24')]]={'$like':'%'+_0x3114a8[_0xfa88('0x2d')][_0xfa88('0x38')]+'%'};return _0x2fc3c9;}})});}_0x531986=_['merge']({},_0x531986,_0x3114a8[_0xfa88('0x39')]);var _0xce117a={'where':_0x531986[_0xfa88('0x36')]};return db['ServicenowField'][_0xfa88('0x19')](_0xce117a)[_0xfa88('0x20')](function(_0x3a7afc){_0x193580[_0xfa88('0x19')]=_0x3a7afc;if(_0x3114a8[_0xfa88('0x2d')][_0xfa88('0x3a')]){_0x531986[_0xfa88('0x3b')]=[{'all':!![]}];}return db[_0xfa88('0x27')][_0xfa88('0x3c')](_0x531986);})[_0xfa88('0x20')](function(_0x107768){_0x193580[_0xfa88('0x3d')]=_0x107768;return _0x193580;})[_0xfa88('0x20')](respondWithFilteredResult(_0xcb683e,_0x531986))['catch'](handleError(_0xcb683e,null));};exports['show']=function(_0x1fbb29,_0x506c0e){var _0x479f4a={'raw':!![],'where':{'id':_0x1fbb29[_0xfa88('0x3e')]['id']}},_0x2c2dde={};_0x2c2dde[_0xfa88('0x2c')]=_[_0xfa88('0x2e')](db['ServicenowField'][_0xfa88('0x28')]);_0x2c2dde[_0xfa88('0x2d')]=_[_0xfa88('0x2e')](_0x1fbb29[_0xfa88('0x2d')]);_0x2c2dde[_0xfa88('0x2f')]=_[_0xfa88('0x31')](_0x2c2dde[_0xfa88('0x2c')],_0x2c2dde[_0xfa88('0x2d')]);_0x479f4a[_0xfa88('0x30')]=_[_0xfa88('0x31')](_0x2c2dde[_0xfa88('0x2c')],qs['fields'](_0x1fbb29[_0xfa88('0x2d')][_0xfa88('0x3f')]));_0x479f4a[_0xfa88('0x30')]=_0x479f4a['attributes'][_0xfa88('0x40')]?_0x479f4a[_0xfa88('0x30')]:_0x2c2dde[_0xfa88('0x2c')];if(_0x1fbb29[_0xfa88('0x2d')]['includeAll']){_0x479f4a[_0xfa88('0x3b')]=[{'all':!![]}];}_0x479f4a=_[_0xfa88('0x41')]({},_0x479f4a,_0x1fbb29[_0xfa88('0x39')]);return db[_0xfa88('0x27')][_0xfa88('0x42')](_0x479f4a)[_0xfa88('0x20')](handleEntityNotFound(_0x506c0e,null))[_0xfa88('0x20')](respondWithResult(_0x506c0e,null))[_0xfa88('0x43')](handleError(_0x506c0e,null));};exports[_0xfa88('0x44')]=function(_0xda3c88,_0x23f2a3){return db[_0xfa88('0x27')]['create'](_0xda3c88[_0xfa88('0x45')],{})[_0xfa88('0x20')](respondWithResult(_0x23f2a3,0xc9))[_0xfa88('0x43')](handleError(_0x23f2a3,null));};exports[_0xfa88('0x1f')]=function(_0x2a48b7,_0x5f33a5){if(_0x2a48b7[_0xfa88('0x45')]['id']){delete _0x2a48b7[_0xfa88('0x45')]['id'];}return db[_0xfa88('0x27')][_0xfa88('0x42')]({'where':{'id':_0x2a48b7[_0xfa88('0x3e')]['id']}})[_0xfa88('0x20')](handleEntityNotFound(_0x5f33a5,null))[_0xfa88('0x20')](saveUpdates(_0x2a48b7[_0xfa88('0x45')],null))[_0xfa88('0x20')](respondWithResult(_0x5f33a5,null))[_0xfa88('0x43')](handleError(_0x5f33a5,null));};exports[_0xfa88('0x21')]=function(_0x55bce8,_0x5db9ad){return db[_0xfa88('0x27')][_0xfa88('0x42')]({'where':{'id':_0x55bce8['params']['id']}})[_0xfa88('0x20')](handleEntityNotFound(_0x5db9ad,null))[_0xfa88('0x20')](removeEntity(_0x5db9ad,null))[_0xfa88('0x43')](handleError(_0x5db9ad,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4b14801..ed26d4e 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 _0x0d0c=['int_servicenow_fields','servicenow_unique_index','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','ServicenowField'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0d0c,0x1e4));var _0xc0d0=function(_0x3cb15a,_0x363658){_0x3cb15a=_0x3cb15a-0x0;var _0x251651=_0x0d0c[_0x3cb15a];return _0x251651;};'use strict';var _=require('lodash');var util=require(_0xc0d0('0x0'));var logger=require(_0xc0d0('0x1'))(_0xc0d0('0x2'));var moment=require(_0xc0d0('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0d0('0x4'));var fs=require('fs');var path=require(_0xc0d0('0x5'));var rimraf=require(_0xc0d0('0x6'));var config=require(_0xc0d0('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x436fa4,_0x281692){return _0x436fa4[_0xc0d0('0x8')](_0xc0d0('0x9'),attributes,{'tableName':_0xc0d0('0xa'),'paranoid':![],'indexes':[{'name':_0xc0d0('0xb'),'fields':['idField',_0xc0d0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8d8=['servicenow_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xc8d8,0xfd));var _0x8c8d=function(_0x1aaa52,_0x442418){_0x1aaa52=_0x1aaa52-0x0;var _0x1a3b6a=_0xc8d8[_0x1aaa52];return _0x1a3b6a;};'use strict';var _=require(_0x8c8d('0x0'));var util=require(_0x8c8d('0x1'));var logger=require(_0x8c8d('0x2'))(_0x8c8d('0x3'));var moment=require(_0x8c8d('0x4'));var BPromise=require(_0x8c8d('0x5'));var rp=require(_0x8c8d('0x6'));var fs=require('fs');var path=require(_0x8c8d('0x7'));var rimraf=require(_0x8c8d('0x8'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x8c8d('0x9')]=function(_0x29b45b,_0x12420d){return _0x29b45b[_0x8c8d('0xa')](_0x8c8d('0xb'),attributes,{'tableName':_0x8c8d('0xc'),'paranoid':![],'indexes':[{'name':_0x8c8d('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 879e35d..125e122 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 _0x20a8=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x20a8,0xc1));var _0x820a=function(_0x12b140,_0x251008){_0x12b140=_0x12b140-0x0;var _0x393003=_0x20a8[_0x12b140];return _0x393003;};'use strict';var _=require(_0x820a('0x0'));var util=require(_0x820a('0x1'));var moment=require(_0x820a('0x2'));var BPromise=require(_0x820a('0x3'));var rs=require(_0x820a('0x4'));var fs=require('fs');var Redis=require(_0x820a('0x5'));var db=require(_0x820a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x820a('0x7'))(_0x820a('0x8'));var config=require(_0x820a('0x9'));var jayson=require(_0x820a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40051e,_0x1a903b,_0x3cb371){return new BPromise(function(_0x41beb2,_0x28f16a){return client[_0x820a('0xb')](_0x40051e,_0x3cb371)[_0x820a('0xc')](function(_0x2766b7){logger[_0x820a('0xd')]('ServicenowField,\x20%s,\x20%s',_0x1a903b,_0x820a('0xe'));logger['debug'](_0x820a('0xf'),_0x1a903b,_0x820a('0xe'),JSON[_0x820a('0x10')](_0x2766b7));if(_0x2766b7[_0x820a('0x11')]){if(_0x2766b7[_0x820a('0x11')]['code']===0x1f4){logger[_0x820a('0x11')](_0x820a('0x12'),_0x1a903b,_0x2766b7['error']['message']);return _0x28f16a(_0x2766b7[_0x820a('0x11')][_0x820a('0x13')]);}logger[_0x820a('0x11')](_0x820a('0x12'),_0x1a903b,_0x2766b7[_0x820a('0x11')][_0x820a('0x13')]);return _0x41beb2(_0x2766b7['error'][_0x820a('0x13')]);}else{logger['info'](_0x820a('0x12'),_0x1a903b,_0x820a('0xe'));_0x41beb2(_0x2766b7[_0x820a('0x14')]['message']);}})[_0x820a('0x15')](function(_0x3d7cc3){logger[_0x820a('0x11')](_0x820a('0x12'),_0x1a903b,_0x3d7cc3);_0x28f16a(_0x3d7cc3);});});} \ No newline at end of file +var _0xf9b3=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xf9b3,0x162));var _0x3f9b=function(_0x5e4356,_0x3034e3){_0x5e4356=_0x5e4356-0x0;var _0x4fc097=_0xf9b3[_0x5e4356];return _0x4fc097;};'use strict';var _=require(_0x3f9b('0x0'));var util=require(_0x3f9b('0x1'));var moment=require(_0x3f9b('0x2'));var BPromise=require(_0x3f9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f9b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f9b('0x5'));var logger=require('../../config/logger')(_0x3f9b('0x6'));var config=require(_0x3f9b('0x7'));var jayson=require(_0x3f9b('0x8'));var client=jayson[_0x3f9b('0x9')][_0x3f9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3151a5,_0x26314d,_0x24f776){return new BPromise(function(_0x2b8536,_0x26a834){return client[_0x3f9b('0xb')](_0x3151a5,_0x24f776)[_0x3f9b('0xc')](function(_0x389e22){logger[_0x3f9b('0xd')](_0x3f9b('0xe'),_0x26314d,_0x3f9b('0xf'));logger[_0x3f9b('0x10')](_0x3f9b('0x11'),_0x26314d,'request\x20sent',JSON[_0x3f9b('0x12')](_0x389e22));if(_0x389e22['error']){if(_0x389e22[_0x3f9b('0x13')]['code']===0x1f4){logger[_0x3f9b('0x13')](_0x3f9b('0xe'),_0x26314d,_0x389e22['error'][_0x3f9b('0x14')]);return _0x26a834(_0x389e22[_0x3f9b('0x13')][_0x3f9b('0x14')]);}logger[_0x3f9b('0x13')](_0x3f9b('0xe'),_0x26314d,_0x389e22[_0x3f9b('0x13')][_0x3f9b('0x14')]);return _0x2b8536(_0x389e22[_0x3f9b('0x13')][_0x3f9b('0x14')]);}else{logger[_0x3f9b('0xd')](_0x3f9b('0xe'),_0x26314d,_0x3f9b('0xf'));_0x2b8536(_0x389e22[_0x3f9b('0x15')][_0x3f9b('0x14')]);}})[_0x3f9b('0x16')](function(_0x1dd8b1){logger[_0x3f9b('0x13')](_0x3f9b('0xe'),_0x26314d,_0x1dd8b1);_0x26a834(_0x1dd8b1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9f61781..ff27aeb 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 _0xd909=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index'];(function(_0x2772eb,_0x438f1b){var _0x13264b=function(_0x383661){while(--_0x383661){_0x2772eb['push'](_0x2772eb['shift']());}};_0x13264b(++_0x438f1b);}(_0xd909,0x1c1));var _0x9d90=function(_0x58411c,_0x5a2452){_0x58411c=_0x58411c-0x0;var _0x5d0780=_0xd909[_0x58411c];return _0x5d0780;};'use strict';var multer=require('multer');var util=require(_0x9d90('0x0'));var path=require(_0x9d90('0x1'));var timeout=require(_0x9d90('0x2'));var express=require(_0x9d90('0x3'));var router=express['Router']();var auth=require(_0x9d90('0x4'));var interaction=require(_0x9d90('0x5'));var config=require(_0x9d90('0x6'));var controller=require(_0x9d90('0x7'));router[_0x9d90('0x8')]('/',auth[_0x9d90('0x9')](),controller[_0x9d90('0xa')]);router['get'](_0x9d90('0xb'),auth[_0x9d90('0x9')](),controller[_0x9d90('0xc')]);router[_0x9d90('0x8')](_0x9d90('0xd'),auth[_0x9d90('0x9')](),controller[_0x9d90('0xe')]);router[_0x9d90('0x8')](_0x9d90('0xf'),auth[_0x9d90('0x9')](),controller[_0x9d90('0x10')]);router['post']('/',auth[_0x9d90('0x9')](),controller[_0x9d90('0x11')]);router['post'](_0x9d90('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x9d90('0x12')](_0x9d90('0xb'),auth[_0x9d90('0x9')](),controller[_0x9d90('0x13')]);router[_0x9d90('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9d90('0x15')]);module[_0x9d90('0x16')]=router; \ No newline at end of file +var _0x7866=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get'];(function(_0xf3120,_0x80a54c){var _0x5aa549=function(_0x17ba5b){while(--_0x17ba5b){_0xf3120['push'](_0xf3120['shift']());}};_0x5aa549(++_0x80a54c);}(_0x7866,0x114));var _0x6786=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7866[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x6786('0x0'));var util=require(_0x6786('0x1'));var path=require('path');var timeout=require(_0x6786('0x2'));var express=require(_0x6786('0x3'));var router=express[_0x6786('0x4')]();var auth=require(_0x6786('0x5'));var interaction=require(_0x6786('0x6'));var config=require(_0x6786('0x7'));var controller=require(_0x6786('0x8'));router[_0x6786('0x9')]('/',auth[_0x6786('0xa')](),controller[_0x6786('0xb')]);router[_0x6786('0x9')](_0x6786('0xc'),auth[_0x6786('0xa')](),controller[_0x6786('0xd')]);router['get'](_0x6786('0xe'),auth[_0x6786('0xa')](),controller[_0x6786('0xf')]);router[_0x6786('0x9')](_0x6786('0x10'),auth[_0x6786('0xa')](),controller[_0x6786('0x11')]);router[_0x6786('0x12')]('/',auth[_0x6786('0xa')](),controller[_0x6786('0x13')]);router[_0x6786('0x12')]('/:id/configurations',auth[_0x6786('0xa')](),controller[_0x6786('0x14')]);router[_0x6786('0x15')](_0x6786('0xc'),auth['isAuthenticated'](),controller[_0x6786('0x16')]);router[_0x6786('0x17')]('/:id',auth[_0x6786('0xa')](),controller[_0x6786('0x18')]);module[_0x6786('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index c8ef450..2227d5d 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 _0xb62d=['sequelize','STRING','username'];(function(_0x1aeb18,_0x5c1735){var _0xcf0f83=function(_0x1241e5){while(--_0x1241e5){_0x1aeb18['push'](_0x1aeb18['shift']());}};_0xcf0f83(++_0x5c1735);}(_0xb62d,0x18c));var _0xdb62=function(_0x18eb22,_0x1f925f){_0x18eb22=_0x18eb22-0x0;var _0x2f1f27=_0xb62d[_0x18eb22];return _0x2f1f27;};'use strict';var Sequelize=require(_0xdb62('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb62('0x1')]},'description':{'type':Sequelize[_0xdb62('0x1')]},'username':{'type':Sequelize[_0xdb62('0x1')],'unique':_0xdb62('0x2')},'password':{'type':Sequelize[_0xdb62('0x1')]},'remoteUri':{'type':Sequelize[_0xdb62('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xdb62('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7ac4=['STRING','username','remoteUri','sequelize','exports'];(function(_0x50d825,_0x8c86bf){var _0x5c27b5=function(_0x152fed){while(--_0x152fed){_0x50d825['push'](_0x50d825['shift']());}};_0x5c27b5(++_0x8c86bf);}(_0x7ac4,0x6c));var _0x47ac=function(_0x1a52f7,_0x32f669){_0x1a52f7=_0x1a52f7-0x0;var _0x151b11=_0x7ac4[_0x1a52f7];return _0x151b11;};'use strict';var Sequelize=require(_0x47ac('0x0'));module[_0x47ac('0x1')]={'name':{'type':Sequelize[_0x47ac('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x47ac('0x2')],'unique':_0x47ac('0x3')},'password':{'type':Sequelize[_0x47ac('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47ac('0x4')},'serverUrl':{'type':Sequelize[_0x47ac('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index ed43ec9..dc3eb3b 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 _0x768b=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','includeAll','options','find','create','body','params','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','Calls','values','label','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x768b,0x7e));var _0xb768=function(_0x25bf9d,_0x154132){_0x25bf9d=_0x25bf9d-0x0;var _0x12666f=_0x768b[_0x25bf9d];return _0x12666f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb768('0x0'));var rimraf=require(_0xb768('0x1'));var zipdir=require(_0xb768('0x2'));var jsonpatch=require(_0xb768('0x3'));var rp=require(_0xb768('0x4'));var moment=require(_0xb768('0x5'));var BPromise=require(_0xb768('0x6'));var Mustache=require(_0xb768('0x7'));var util=require('util');var path=require(_0xb768('0x8'));var sox=require(_0xb768('0x9'));var csv=require(_0xb768('0xa'));var ejs=require(_0xb768('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb768('0xc'));var crypto=require(_0xb768('0xd'));var jsforce=require(_0xb768('0xe'));var deskjs=require(_0xb768('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb768('0x10'));var Redis=require(_0xb768('0x11'));var authService=require(_0xb768('0x12'));var qs=require(_0xb768('0x13'));var as=require(_0xb768('0x14'));var hardwareService=require(_0xb768('0x15'));var logger=require(_0xb768('0x16'))(_0xb768('0x17'));var utils=require(_0xb768('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb768('0x19'));var db=require(_0xb768('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb768('0x1b'));var client=jayson['client'][_0xb768('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2147eb,_0x276925,_0x1b8da4,_0x17a2ed){return new BPromise(function(_0x4f3deb,_0x361cd0){var _0x26b8ce=_0x17a2ed||client;return _0x26b8ce[_0xb768('0x1d')](_0x2147eb,_0x1b8da4)[_0xb768('0x1e')](function(_0x27ab35){logger[_0xb768('0x1f')](_0xb768('0x20'),_0x276925,_0xb768('0x21'));logger['debug'](_0xb768('0x22'),_0x276925,_0xb768('0x21'),JSON[_0xb768('0x23')](_0x27ab35));if(_0x27ab35[_0xb768('0x24')]){if(_0x27ab35[_0xb768('0x24')]['code']===0x1f4){logger[_0xb768('0x24')]('SugarcrmAccount,\x20%s,\x20%s',_0x276925,_0x27ab35[_0xb768('0x24')][_0xb768('0x25')]);return _0x361cd0(_0x27ab35['error']['message']);}logger['error'](_0xb768('0x20'),_0x276925,_0x27ab35[_0xb768('0x24')]['message']);return _0x4f3deb(_0x27ab35['error']['message']);}else{logger[_0xb768('0x1f')]('SugarcrmAccount,\x20%s,\x20%s',_0x276925,'request\x20sent');_0x4f3deb(_0x27ab35[_0xb768('0x26')]['message']);}})[_0xb768('0x27')](function(_0x426d8e){logger[_0xb768('0x24')](_0xb768('0x20'),_0x276925,_0x426d8e);_0x361cd0(_0x426d8e);});});}function respondWithStatusCode(_0x18ed47,_0x8f755c){_0x8f755c=_0x8f755c||0xcc;return function(_0x272d57){if(_0x272d57){return _0x18ed47[_0xb768('0x28')](_0x8f755c);}return _0x18ed47['status'](_0x8f755c)['end']();};}function respondWithResult(_0x4a7263,_0xc09c0b){_0xc09c0b=_0xc09c0b||0xc8;return function(_0x1dc3b4){if(_0x1dc3b4){return _0x4a7263[_0xb768('0x29')](_0xc09c0b)[_0xb768('0x2a')](_0x1dc3b4);}};}function respondWithFilteredResult(_0x3007eb,_0x4cb999){return function(_0x1bfd5f){if(_0x1bfd5f){var _0x4777cd=_0x1bfd5f[_0xb768('0x2b')],_0x5e14ab=_0x4cb999[_0xb768('0x2c')],_0x4bda5a=_0x4cb999['offset']+_0x4cb999[_0xb768('0x2d')],_0x33748a;if(_0x4bda5a>=_0x4777cd){_0x4bda5a=_0x4777cd;_0x33748a=0xc8;}else{_0x33748a=0xce;}_0x3007eb[_0xb768('0x29')](_0x33748a);return _0x3007eb[_0xb768('0x2e')]('Content-Range',_0x5e14ab+'-'+_0x4bda5a+'/'+_0x4777cd)[_0xb768('0x2a')](_0x1bfd5f);}return null;};}function patchUpdates(_0x38b356){return function(_0xec4c5a){try{jsonpatch[_0xb768('0x2f')](_0xec4c5a,_0x38b356,!![]);}catch(_0x25fa11){return BPromise[_0xb768('0x30')](_0x25fa11);}return _0xec4c5a['save']();};}function saveUpdates(_0x78c1d9,_0x18fa5a){return function(_0x3f49f6){if(_0x3f49f6){return _0x3f49f6[_0xb768('0x31')](_0x78c1d9)['then'](function(_0x46632d){return _0x46632d;});}return null;};}function removeEntity(_0x2123b0,_0x1e93b7){return function(_0x1d3c35){if(_0x1d3c35){return _0x1d3c35[_0xb768('0x32')]()[_0xb768('0x1e')](function(){_0x2123b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50ea29,_0x419a7f){return function(_0x7f6b53){if(!_0x7f6b53){_0x50ea29[_0xb768('0x28')](0x194);}return _0x7f6b53;};}function handleError(_0x6f0120,_0x9fcd1b){_0x9fcd1b=_0x9fcd1b||0x1f4;return function(_0x5925dd){logger[_0xb768('0x24')](_0x5925dd['stack']);if(_0x5925dd['name']){delete _0x5925dd[_0xb768('0x33')];}_0x6f0120[_0xb768('0x29')](_0x9fcd1b)[_0xb768('0x34')](_0x5925dd);};}exports[_0xb768('0x35')]=function(_0x5aa914,_0x331908){var _0x3c78e6={},_0x50e042={},_0x1d1391={'count':0x0,'rows':[]};var _0x2cb562=_[_0xb768('0x36')](db[_0xb768('0x37')][_0xb768('0x38')],function(_0x331bb2){return{'name':_0x331bb2['fieldName'],'type':_0x331bb2[_0xb768('0x39')][_0xb768('0x3a')]};});_0x50e042[_0xb768('0x3b')]=_[_0xb768('0x36')](_0x2cb562,_0xb768('0x33'));_0x50e042[_0xb768('0x3c')]=_[_0xb768('0x3d')](_0x5aa914[_0xb768('0x3c')]);_0x50e042[_0xb768('0x3e')]=_['intersection'](_0x50e042[_0xb768('0x3b')],_0x50e042[_0xb768('0x3c')]);_0x3c78e6[_0xb768('0x3f')]=_[_0xb768('0x40')](_0x50e042[_0xb768('0x3b')],qs[_0xb768('0x41')](_0x5aa914[_0xb768('0x3c')][_0xb768('0x41')]));_0x3c78e6[_0xb768('0x3f')]=_0x3c78e6['attributes'][_0xb768('0x42')]?_0x3c78e6['attributes']:_0x50e042['model'];if(!_0x5aa914['query'][_0xb768('0x43')](_0xb768('0x44'))){_0x3c78e6[_0xb768('0x2d')]=qs[_0xb768('0x2d')](_0x5aa914[_0xb768('0x3c')][_0xb768('0x2d')]);_0x3c78e6[_0xb768('0x2c')]=qs['offset'](_0x5aa914[_0xb768('0x3c')][_0xb768('0x2c')]);}_0x3c78e6[_0xb768('0x45')]=qs[_0xb768('0x46')](_0x5aa914[_0xb768('0x3c')][_0xb768('0x46')]);_0x3c78e6['where']=qs[_0xb768('0x3e')](_[_0xb768('0x47')](_0x5aa914[_0xb768('0x3c')],_0x50e042[_0xb768('0x3e')]),_0x2cb562);if(_0x5aa914[_0xb768('0x3c')][_0xb768('0x48')]){_0x3c78e6[_0xb768('0x49')]=_['merge'](_0x3c78e6[_0xb768('0x49')],{'$or':_[_0xb768('0x36')](_0x2cb562,function(_0x26a0d7){if(_0x26a0d7[_0xb768('0x39')]!==_0xb768('0x4a')){var _0x2732a6={};_0x2732a6[_0x26a0d7[_0xb768('0x33')]]={'$like':'%'+_0x5aa914[_0xb768('0x3c')]['filter']+'%'};return _0x2732a6;}})});}_0x3c78e6=_[_0xb768('0x4b')]({},_0x3c78e6,_0x5aa914['options']);var _0x39ad93={'where':_0x3c78e6[_0xb768('0x49')]};return db[_0xb768('0x37')][_0xb768('0x2b')](_0x39ad93)[_0xb768('0x1e')](function(_0x3ef18a){_0x1d1391[_0xb768('0x2b')]=_0x3ef18a;if(_0x5aa914[_0xb768('0x3c')]['includeAll']){_0x3c78e6[_0xb768('0x4c')]=[{'all':!![]}];}return db[_0xb768('0x37')][_0xb768('0x4d')](_0x3c78e6);})[_0xb768('0x1e')](function(_0x530a6a){_0x1d1391[_0xb768('0x4e')]=_0x530a6a;return _0x1d1391;})[_0xb768('0x1e')](respondWithFilteredResult(_0x331908,_0x3c78e6))[_0xb768('0x27')](handleError(_0x331908,null));};exports[_0xb768('0x4f')]=function(_0x1c3ae9,_0x3a59e7){var _0x11080e={'raw':![],'where':{'id':_0x1c3ae9['params']['id']}},_0x1ec0a6={};_0x1ec0a6[_0xb768('0x3b')]=_[_0xb768('0x3d')](db[_0xb768('0x37')]['rawAttributes']);_0x1ec0a6[_0xb768('0x3c')]=_[_0xb768('0x3d')](_0x1c3ae9['query']);_0x1ec0a6['filters']=_[_0xb768('0x40')](_0x1ec0a6[_0xb768('0x3b')],_0x1ec0a6[_0xb768('0x3c')]);_0x11080e['attributes']=_[_0xb768('0x40')](_0x1ec0a6[_0xb768('0x3b')],qs[_0xb768('0x41')](_0x1c3ae9[_0xb768('0x3c')][_0xb768('0x41')]));_0x11080e[_0xb768('0x3f')]=_0x11080e['attributes'][_0xb768('0x42')]?_0x11080e[_0xb768('0x3f')]:_0x1ec0a6['model'];if(_0x1c3ae9[_0xb768('0x3c')][_0xb768('0x50')]){_0x11080e[_0xb768('0x4c')]=[{'all':!![]}];}_0x11080e=_[_0xb768('0x4b')]({},_0x11080e,_0x1c3ae9[_0xb768('0x51')]);return db[_0xb768('0x37')][_0xb768('0x52')](_0x11080e)[_0xb768('0x1e')](handleEntityNotFound(_0x3a59e7,null))[_0xb768('0x1e')](respondWithResult(_0x3a59e7,null))[_0xb768('0x27')](handleError(_0x3a59e7,null));};exports['create']=function(_0x2e7b80,_0x247d5e){return db[_0xb768('0x37')][_0xb768('0x53')](_0x2e7b80[_0xb768('0x54')],{})[_0xb768('0x1e')](respondWithResult(_0x247d5e,0xc9))[_0xb768('0x27')](handleError(_0x247d5e,null));};exports[_0xb768('0x31')]=function(_0x92745d,_0x529fbd){if(_0x92745d['body']['id']){delete _0x92745d[_0xb768('0x54')]['id'];}return db[_0xb768('0x37')]['find']({'where':{'id':_0x92745d['params']['id']}})['then'](handleEntityNotFound(_0x529fbd,null))[_0xb768('0x1e')](saveUpdates(_0x92745d[_0xb768('0x54')],null))[_0xb768('0x1e')](respondWithResult(_0x529fbd,null))[_0xb768('0x27')](handleError(_0x529fbd,null));};exports[_0xb768('0x32')]=function(_0xffc3ac,_0x4dfb65){return db[_0xb768('0x37')][_0xb768('0x52')]({'where':{'id':_0xffc3ac[_0xb768('0x55')]['id']}})[_0xb768('0x1e')](handleEntityNotFound(_0x4dfb65,null))[_0xb768('0x1e')](removeEntity(_0x4dfb65,null))['catch'](handleError(_0x4dfb65,null));};exports['getConfigurations']=function(_0xbbddb3,_0x565229,_0x528245){var _0x6f9671={};var _0x19710e={};var _0x10d844;var _0x297cd9;return db[_0xb768('0x37')][_0xb768('0x56')]({'where':{'id':_0xbbddb3['params']['id']}})['then'](handleEntityNotFound(_0x565229,null))[_0xb768('0x1e')](function(_0x5ab842){if(_0x5ab842){_0x10d844=_0x5ab842;_0x19710e['model']=_[_0xb768('0x3d')](db['SugarcrmConfiguration'][_0xb768('0x38')]);_0x19710e[_0xb768('0x3c')]=_['keys'](_0xbbddb3[_0xb768('0x3c')]);_0x19710e[_0xb768('0x3e')]=_[_0xb768('0x40')](_0x19710e[_0xb768('0x3b')],_0x19710e[_0xb768('0x3c')]);_0x6f9671[_0xb768('0x3f')]=_[_0xb768('0x40')](_0x19710e[_0xb768('0x3b')],qs[_0xb768('0x41')](_0xbbddb3[_0xb768('0x3c')]['fields']));_0x6f9671[_0xb768('0x3f')]=_0x6f9671[_0xb768('0x3f')]['length']?_0x6f9671[_0xb768('0x3f')]:_0x19710e[_0xb768('0x3b')];_0x6f9671[_0xb768('0x45')]=qs[_0xb768('0x46')](_0xbbddb3[_0xb768('0x3c')][_0xb768('0x46')]);_0x6f9671['where']=qs[_0xb768('0x3e')](_[_0xb768('0x47')](_0xbbddb3[_0xb768('0x3c')],_0x19710e[_0xb768('0x3e')]));if(_0xbbddb3[_0xb768('0x3c')][_0xb768('0x48')]){_0x6f9671[_0xb768('0x49')]=_[_0xb768('0x4b')](_0x6f9671[_0xb768('0x49')],{'$or':_['map'](_0x6f9671[_0xb768('0x3f')],function(_0x1cb537){var _0x4484d1={};_0x4484d1[_0x1cb537]={'$like':'%'+_0xbbddb3['query'][_0xb768('0x48')]+'%'};return _0x4484d1;})});}_0x6f9671=_['merge']({},_0x6f9671,_0xbbddb3['options']);return _0x10d844[_0xb768('0x57')](_0x6f9671);}})['then'](function(_0x2a38f8){if(_0x2a38f8){_0x297cd9=_0x2a38f8[_0xb768('0x42')];if(!_0xbbddb3[_0xb768('0x3c')]['hasOwnProperty']('nolimit')){_0x6f9671[_0xb768('0x2d')]=qs['limit'](_0xbbddb3[_0xb768('0x3c')]['limit']);_0x6f9671[_0xb768('0x2c')]=qs[_0xb768('0x2c')](_0xbbddb3[_0xb768('0x3c')][_0xb768('0x2c')]);}return _0x10d844[_0xb768('0x57')](_0x6f9671);}})[_0xb768('0x1e')](function(_0x120d1e){if(_0x120d1e){return _0x120d1e?{'count':_0x297cd9,'rows':_0x120d1e}:null;}})[_0xb768('0x1e')](respondWithResult(_0x565229,null))['catch'](handleError(_0x565229,null));};exports[_0xb768('0x58')]=function(_0x5f2293,_0x5cc63f,_0x1046a8){if(_0x5f2293[_0xb768('0x54')]['id']){delete _0x5f2293[_0xb768('0x54')]['id'];}return db[_0xb768('0x37')]['findOne']({'where':{'id':_0x5f2293[_0xb768('0x55')]['id']}})[_0xb768('0x1e')](handleEntityNotFound(_0x5cc63f,null))['then'](function(_0x42a155){if(_0x42a155){_0x5f2293[_0xb768('0x54')][_0xb768('0x59')]=_0x42a155['id'];_0x5f2293[_0xb768('0x54')][_0xb768('0x5a')]=integrations[_0xb768('0x5b')](_0x5f2293[_0xb768('0x54')][_0xb768('0x5c')],_0x5f2293['body'][_0xb768('0x39')]);_0x5f2293[_0xb768('0x54')][_0xb768('0x5d')]=integrations[_0xb768('0x5e')](_0x5f2293[_0xb768('0x54')][_0xb768('0x5c')],_0x5f2293[_0xb768('0x54')][_0xb768('0x39')]);return db['SugarcrmConfiguration'][_0xb768('0x53')](_0x5f2293[_0xb768('0x54')],{'include':[{'model':db[_0xb768('0x5f')],'as':_0xb768('0x5a')},{'model':db[_0xb768('0x5f')],'as':_0xb768('0x5d')}]});}return null;})['then'](respondWithResult(_0x5cc63f,null))[_0xb768('0x27')](handleError(_0x5cc63f,null));};exports['getFields']=function(_0x20da00,_0x584df0,_0x15d2f4){var _0x1755b7='';var _0x12b036=['id',_0xb768('0x33'),_0xb768('0x60'),_0xb768('0x61'),_0xb768('0x62'),_0xb768('0x63'),_0xb768('0x64'),'duration_minutes',_0xb768('0x65'),_0xb768('0x66'),_0xb768('0x67'),_0xb768('0x68')];return db[_0xb768('0x37')]['findOne']({'where':{'id':_0x20da00[_0xb768('0x55')]['id']},'attributes':['id',_0xb768('0x69'),_0xb768('0x6a'),'remoteUri']})[_0xb768('0x1e')](handleEntityNotFound(_0x584df0,null))[_0xb768('0x1e')](function(_0x120486){if(_0x120486){_0x1755b7=_0x120486[_0xb768('0x6b')];var _0x10a150=_0x1755b7[_0xb768('0x6c')](-0x1);if(_0x10a150==='/'){_0x1755b7=_0x1755b7[_0xb768('0x6d')](0x0,_0x1755b7[_0xb768('0x6e')](_0x10a150));}return rp({'method':_0xb768('0x6f'),'uri':util[_0xb768('0x70')]('%s%s',_0x1755b7,_0xb768('0x71')),'json':!![],'form':{'method':_0xb768('0x72'),'input_type':'JSON','response_type':_0xb768('0x73'),'rest_data':JSON[_0xb768('0x23')]({'user_auth':{'user_name':_0x120486['username'],'password':_0x120486[_0xb768('0x6a')],'encryption':_0xb768('0x74')},'application':_0xb768('0x75')})}});}})['then'](function(_0x4c3179){if(_0x4c3179&&_0x4c3179['name']!==_0xb768('0x76')&&_0x4c3179[_0xb768('0x33')]!=='Password\x20Expired'){return rp({'method':_0xb768('0x6f'),'uri':util['format'](_0xb768('0x77'),_0x1755b7,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb768('0x23')]({'session':_0x4c3179['id'],'module_name':_0xb768('0x78')})}})[_0xb768('0x1e')](function(_0x5ccbb8){if(_0x5ccbb8){var _0x5a4e28=_[_0xb768('0x79')](_0x5ccbb8['module_fields']);_['remove'](_0x5a4e28,function(_0x3f5e13){return _0x12b036['includes'](_0x3f5e13[_0xb768('0x33')]);});return{'count':_0x5a4e28['length'],'rows':_[_0xb768('0x36')](_0x5a4e28,function(_0x369b42){return{'id':_0x369b42[_0xb768('0x33')],'name':_0x369b42[_0xb768('0x7a')],'custom':_['endsWith'](_0x369b42[_0xb768('0x33')],'_c')?!![]:![],'options':_0x369b42[_0xb768('0x51')]?_[_0xb768('0x36')](_[_0xb768('0x79')](_0x369b42[_0xb768('0x51')]),function(_0x472b16){return{'name':_0x472b16[_0xb768('0x7b')],'value':_0x472b16[_0xb768('0x33')]};}):[]};})};}})[_0xb768('0x1e')](respondWithResult(_0x584df0,null))[_0xb768('0x27')](function(_0x58e23c){var _0x2cdcd7=_0x20da00[_0xb768('0x3c')][_0xb768('0x7c')]?0x1f4:_0x58e23c[_0xb768('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb768('0x7e'),_0x2cdcd7,JSON['stringify'](_0x58e23c));delete _0x58e23c[_0xb768('0x33')];if(_0x2cdcd7===0x191){_0x2cdcd7=0x190;}_0x584df0[_0xb768('0x29')](_0x2cdcd7)[_0xb768('0x34')](_0x20da00[_0xb768('0x3c')][_0xb768('0x7c')]?{'message':_0xb768('0x7f'),'statusCode':_0x58e23c[_0xb768('0x7d')]}:_0x58e23c);});}else{var _0x4e44ee=0x1f4;_0x584df0[_0xb768('0x29')](_0x4e44ee)[_0xb768('0x34')]({'message':_0xb768('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8927=['util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','SugarcrmAccount','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','includes','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x448970,_0x44b9b4){var _0x2fa420=function(_0x10a754){while(--_0x10a754){_0x448970['push'](_0x448970['shift']());}};_0x2fa420(++_0x44b9b4);}(_0x8927,0x7b));var _0x7892=function(_0x2e31b0,_0x52a170){_0x2e31b0=_0x2e31b0-0x0;var _0x57b64e=_0x8927[_0x2e31b0];return _0x57b64e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7892('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7892('0x1'));var jsonpatch=require(_0x7892('0x2'));var rp=require('request-promise');var moment=require(_0x7892('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7892('0x4'));var path=require(_0x7892('0x5'));var sox=require(_0x7892('0x6'));var csv=require(_0x7892('0x7'));var ejs=require(_0x7892('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7892('0x9'));var deskjs=require(_0x7892('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7892('0xb'));var Papa=require(_0x7892('0xc'));var Redis=require(_0x7892('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7892('0xe'));var hardwareService=require(_0x7892('0xf'));var logger=require(_0x7892('0x10'))(_0x7892('0x11'));var utils=require('../../config/utils');var config=require(_0x7892('0x12'));var licenseUtil=require(_0x7892('0x13'));var db=require(_0x7892('0x14'))['db'];var integrations=require(_0x7892('0x15'));var jayson=require(_0x7892('0x16'));var client=jayson[_0x7892('0x17')][_0x7892('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576330,_0x4ee21a,_0x5b64b4,_0x31d53e){return new BPromise(function(_0x57c298,_0x51156a){var _0x563dde=_0x31d53e||client;return _0x563dde['request'](_0x576330,_0x5b64b4)[_0x7892('0x19')](function(_0x32dfc8){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x4ee21a,_0x7892('0x1a'));logger[_0x7892('0x1b')](_0x7892('0x1c'),_0x4ee21a,_0x7892('0x1a'),JSON[_0x7892('0x1d')](_0x32dfc8));if(_0x32dfc8[_0x7892('0x1e')]){if(_0x32dfc8[_0x7892('0x1e')][_0x7892('0x1f')]===0x1f4){logger[_0x7892('0x1e')](_0x7892('0x20'),_0x4ee21a,_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);return _0x51156a(_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);}logger[_0x7892('0x1e')](_0x7892('0x20'),_0x4ee21a,_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);return _0x57c298(_0x32dfc8[_0x7892('0x1e')][_0x7892('0x21')]);}else{logger[_0x7892('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x4ee21a,'request\x20sent');_0x57c298(_0x32dfc8[_0x7892('0x23')][_0x7892('0x21')]);}})['catch'](function(_0x131759){logger[_0x7892('0x1e')](_0x7892('0x20'),_0x4ee21a,_0x131759);_0x51156a(_0x131759);});});}function respondWithStatusCode(_0x1930a3,_0x29776a){_0x29776a=_0x29776a||0xcc;return function(_0x5255bc){if(_0x5255bc){return _0x1930a3['sendStatus'](_0x29776a);}return _0x1930a3[_0x7892('0x24')](_0x29776a)[_0x7892('0x25')]();};}function respondWithResult(_0x1060ed,_0x324377){_0x324377=_0x324377||0xc8;return function(_0x58f4f4){if(_0x58f4f4){return _0x1060ed[_0x7892('0x24')](_0x324377)[_0x7892('0x26')](_0x58f4f4);}};}function respondWithFilteredResult(_0x9c8dc3,_0x21215f){return function(_0x5c7e0f){if(_0x5c7e0f){var _0x52945a=_0x5c7e0f[_0x7892('0x27')],_0x67a87b=_0x21215f[_0x7892('0x28')],_0x79e147=_0x21215f['offset']+_0x21215f[_0x7892('0x29')],_0x1bb7fb;if(_0x79e147>=_0x52945a){_0x79e147=_0x52945a;_0x1bb7fb=0xc8;}else{_0x1bb7fb=0xce;}_0x9c8dc3['status'](_0x1bb7fb);return _0x9c8dc3[_0x7892('0x2a')]('Content-Range',_0x67a87b+'-'+_0x79e147+'/'+_0x52945a)['json'](_0x5c7e0f);}return null;};}function patchUpdates(_0x2d38f6){return function(_0xe55b4){try{jsonpatch[_0x7892('0x2b')](_0xe55b4,_0x2d38f6,!![]);}catch(_0xbaf7ca){return BPromise[_0x7892('0x2c')](_0xbaf7ca);}return _0xe55b4[_0x7892('0x2d')]();};}function saveUpdates(_0x42707f,_0x17f7da){return function(_0x1d7417){if(_0x1d7417){return _0x1d7417[_0x7892('0x2e')](_0x42707f)[_0x7892('0x19')](function(_0x119025){return _0x119025;});}return null;};}function removeEntity(_0xb7dea2,_0x23be74){return function(_0x38d625){if(_0x38d625){return _0x38d625[_0x7892('0x2f')]()[_0x7892('0x19')](function(){_0xb7dea2[_0x7892('0x24')](0xcc)[_0x7892('0x25')]();});}};}function handleEntityNotFound(_0x23a25f,_0x2d1e55){return function(_0x11bc5c){if(!_0x11bc5c){_0x23a25f[_0x7892('0x30')](0x194);}return _0x11bc5c;};}function handleError(_0x202919,_0x253fbf){_0x253fbf=_0x253fbf||0x1f4;return function(_0xac0d7f){logger['error'](_0xac0d7f[_0x7892('0x31')]);if(_0xac0d7f[_0x7892('0x32')]){delete _0xac0d7f[_0x7892('0x32')];}_0x202919[_0x7892('0x24')](_0x253fbf)[_0x7892('0x33')](_0xac0d7f);};}exports['index']=function(_0x26d296,_0x4a2c01){var _0x35e492={},_0x23f78e={},_0x293d4b={'count':0x0,'rows':[]};var _0x43f510=_['map'](db[_0x7892('0x34')][_0x7892('0x35')],function(_0x317c60){return{'name':_0x317c60['fieldName'],'type':_0x317c60[_0x7892('0x36')][_0x7892('0x37')]};});_0x23f78e['model']=_[_0x7892('0x38')](_0x43f510,_0x7892('0x32'));_0x23f78e[_0x7892('0x39')]=_[_0x7892('0x3a')](_0x26d296[_0x7892('0x39')]);_0x23f78e[_0x7892('0x3b')]=_[_0x7892('0x3c')](_0x23f78e[_0x7892('0x3d')],_0x23f78e[_0x7892('0x39')]);_0x35e492[_0x7892('0x3e')]=_[_0x7892('0x3c')](_0x23f78e[_0x7892('0x3d')],qs[_0x7892('0x3f')](_0x26d296[_0x7892('0x39')]['fields']));_0x35e492[_0x7892('0x3e')]=_0x35e492[_0x7892('0x3e')][_0x7892('0x40')]?_0x35e492[_0x7892('0x3e')]:_0x23f78e['model'];if(!_0x26d296[_0x7892('0x39')][_0x7892('0x41')](_0x7892('0x42'))){_0x35e492[_0x7892('0x29')]=qs[_0x7892('0x29')](_0x26d296[_0x7892('0x39')][_0x7892('0x29')]);_0x35e492[_0x7892('0x28')]=qs[_0x7892('0x28')](_0x26d296[_0x7892('0x39')][_0x7892('0x28')]);}_0x35e492[_0x7892('0x43')]=qs['sort'](_0x26d296[_0x7892('0x39')][_0x7892('0x44')]);_0x35e492[_0x7892('0x45')]=qs[_0x7892('0x3b')](_[_0x7892('0x46')](_0x26d296['query'],_0x23f78e[_0x7892('0x3b')]),_0x43f510);if(_0x26d296[_0x7892('0x39')]['filter']){_0x35e492['where']=_[_0x7892('0x47')](_0x35e492[_0x7892('0x45')],{'$or':_[_0x7892('0x38')](_0x43f510,function(_0x28fd4b){if(_0x28fd4b[_0x7892('0x36')]!==_0x7892('0x48')){var _0xcaa5b={};_0xcaa5b[_0x28fd4b['name']]={'$like':'%'+_0x26d296[_0x7892('0x39')][_0x7892('0x49')]+'%'};return _0xcaa5b;}})});}_0x35e492=_[_0x7892('0x47')]({},_0x35e492,_0x26d296[_0x7892('0x4a')]);var _0x151018={'where':_0x35e492[_0x7892('0x45')]};return db[_0x7892('0x34')][_0x7892('0x27')](_0x151018)[_0x7892('0x19')](function(_0x355c9f){_0x293d4b[_0x7892('0x27')]=_0x355c9f;if(_0x26d296[_0x7892('0x39')][_0x7892('0x4b')]){_0x35e492[_0x7892('0x4c')]=[{'all':!![]}];}return db[_0x7892('0x34')][_0x7892('0x4d')](_0x35e492);})[_0x7892('0x19')](function(_0x1e485e){_0x293d4b['rows']=_0x1e485e;return _0x293d4b;})[_0x7892('0x19')](respondWithFilteredResult(_0x4a2c01,_0x35e492))[_0x7892('0x4e')](handleError(_0x4a2c01,null));};exports['show']=function(_0x11faf0,_0x271ac3){var _0x11699d={'raw':![],'where':{'id':_0x11faf0[_0x7892('0x4f')]['id']}},_0x43fd17={};_0x43fd17[_0x7892('0x3d')]=_[_0x7892('0x3a')](db[_0x7892('0x34')]['rawAttributes']);_0x43fd17[_0x7892('0x39')]=_[_0x7892('0x3a')](_0x11faf0['query']);_0x43fd17[_0x7892('0x3b')]=_[_0x7892('0x3c')](_0x43fd17[_0x7892('0x3d')],_0x43fd17[_0x7892('0x39')]);_0x11699d['attributes']=_[_0x7892('0x3c')](_0x43fd17[_0x7892('0x3d')],qs[_0x7892('0x3f')](_0x11faf0[_0x7892('0x39')]['fields']));_0x11699d[_0x7892('0x3e')]=_0x11699d[_0x7892('0x3e')][_0x7892('0x40')]?_0x11699d[_0x7892('0x3e')]:_0x43fd17['model'];if(_0x11faf0[_0x7892('0x39')][_0x7892('0x4b')]){_0x11699d[_0x7892('0x4c')]=[{'all':!![]}];}_0x11699d=_[_0x7892('0x47')]({},_0x11699d,_0x11faf0[_0x7892('0x4a')]);return db[_0x7892('0x34')][_0x7892('0x50')](_0x11699d)[_0x7892('0x19')](handleEntityNotFound(_0x271ac3,null))[_0x7892('0x19')](respondWithResult(_0x271ac3,null))[_0x7892('0x4e')](handleError(_0x271ac3,null));};exports['create']=function(_0x22c9c9,_0x52186d){return db[_0x7892('0x34')][_0x7892('0x51')](_0x22c9c9[_0x7892('0x52')],{})[_0x7892('0x19')](respondWithResult(_0x52186d,0xc9))['catch'](handleError(_0x52186d,null));};exports[_0x7892('0x2e')]=function(_0x50fcdc,_0x17511d){if(_0x50fcdc['body']['id']){delete _0x50fcdc[_0x7892('0x52')]['id'];}return db[_0x7892('0x34')][_0x7892('0x50')]({'where':{'id':_0x50fcdc[_0x7892('0x4f')]['id']}})[_0x7892('0x19')](handleEntityNotFound(_0x17511d,null))[_0x7892('0x19')](saveUpdates(_0x50fcdc['body'],null))[_0x7892('0x19')](respondWithResult(_0x17511d,null))[_0x7892('0x4e')](handleError(_0x17511d,null));};exports['destroy']=function(_0x328e3b,_0x48c1c2){return db[_0x7892('0x34')][_0x7892('0x50')]({'where':{'id':_0x328e3b[_0x7892('0x4f')]['id']}})['then'](handleEntityNotFound(_0x48c1c2,null))[_0x7892('0x19')](removeEntity(_0x48c1c2,null))['catch'](handleError(_0x48c1c2,null));};exports[_0x7892('0x53')]=function(_0x17c096,_0x32800c,_0x7334e6){var _0x6d4d82={};var _0x5999ef={};var _0x48fd98;var _0x548b05;return db[_0x7892('0x34')][_0x7892('0x54')]({'where':{'id':_0x17c096[_0x7892('0x4f')]['id']}})['then'](handleEntityNotFound(_0x32800c,null))['then'](function(_0x418391){if(_0x418391){_0x48fd98=_0x418391;_0x5999ef[_0x7892('0x3d')]=_[_0x7892('0x3a')](db[_0x7892('0x55')]['rawAttributes']);_0x5999ef[_0x7892('0x39')]=_[_0x7892('0x3a')](_0x17c096[_0x7892('0x39')]);_0x5999ef[_0x7892('0x3b')]=_[_0x7892('0x3c')](_0x5999ef[_0x7892('0x3d')],_0x5999ef[_0x7892('0x39')]);_0x6d4d82[_0x7892('0x3e')]=_[_0x7892('0x3c')](_0x5999ef['model'],qs[_0x7892('0x3f')](_0x17c096[_0x7892('0x39')][_0x7892('0x3f')]));_0x6d4d82[_0x7892('0x3e')]=_0x6d4d82[_0x7892('0x3e')][_0x7892('0x40')]?_0x6d4d82[_0x7892('0x3e')]:_0x5999ef[_0x7892('0x3d')];_0x6d4d82[_0x7892('0x43')]=qs['sort'](_0x17c096[_0x7892('0x39')]['sort']);_0x6d4d82[_0x7892('0x45')]=qs['filters'](_[_0x7892('0x46')](_0x17c096['query'],_0x5999ef[_0x7892('0x3b')]));if(_0x17c096[_0x7892('0x39')]['filter']){_0x6d4d82['where']=_[_0x7892('0x47')](_0x6d4d82[_0x7892('0x45')],{'$or':_[_0x7892('0x38')](_0x6d4d82['attributes'],function(_0x60aa3b){var _0xb8ec3a={};_0xb8ec3a[_0x60aa3b]={'$like':'%'+_0x17c096[_0x7892('0x39')][_0x7892('0x49')]+'%'};return _0xb8ec3a;})});}_0x6d4d82=_[_0x7892('0x47')]({},_0x6d4d82,_0x17c096['options']);return _0x48fd98[_0x7892('0x53')](_0x6d4d82);}})[_0x7892('0x19')](function(_0x2a3b08){if(_0x2a3b08){_0x548b05=_0x2a3b08[_0x7892('0x40')];if(!_0x17c096['query'][_0x7892('0x41')](_0x7892('0x42'))){_0x6d4d82[_0x7892('0x29')]=qs[_0x7892('0x29')](_0x17c096[_0x7892('0x39')]['limit']);_0x6d4d82[_0x7892('0x28')]=qs[_0x7892('0x28')](_0x17c096[_0x7892('0x39')][_0x7892('0x28')]);}return _0x48fd98[_0x7892('0x53')](_0x6d4d82);}})[_0x7892('0x19')](function(_0x12da06){if(_0x12da06){return _0x12da06?{'count':_0x548b05,'rows':_0x12da06}:null;}})[_0x7892('0x19')](respondWithResult(_0x32800c,null))['catch'](handleError(_0x32800c,null));};exports[_0x7892('0x56')]=function(_0x921e09,_0x1f25d9,_0x1f4ddd){if(_0x921e09[_0x7892('0x52')]['id']){delete _0x921e09['body']['id'];}return db['SugarcrmAccount'][_0x7892('0x54')]({'where':{'id':_0x921e09['params']['id']}})[_0x7892('0x19')](handleEntityNotFound(_0x1f25d9,null))[_0x7892('0x19')](function(_0x438c63){if(_0x438c63){_0x921e09['body'][_0x7892('0x57')]=_0x438c63['id'];_0x921e09[_0x7892('0x52')][_0x7892('0x58')]=integrations['getSubjects'](_0x921e09[_0x7892('0x52')][_0x7892('0x59')],_0x921e09[_0x7892('0x52')]['type']);_0x921e09[_0x7892('0x52')][_0x7892('0x5a')]=integrations[_0x7892('0x5b')](_0x921e09[_0x7892('0x52')]['channel'],_0x921e09[_0x7892('0x52')][_0x7892('0x36')]);return db[_0x7892('0x55')][_0x7892('0x51')](_0x921e09[_0x7892('0x52')],{'include':[{'model':db[_0x7892('0x5c')],'as':_0x7892('0x58')},{'model':db[_0x7892('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1f25d9,null))[_0x7892('0x4e')](handleError(_0x1f25d9,null));};exports[_0x7892('0x5d')]=function(_0x5c23a5,_0x6907a3,_0x57021b){var _0x2f105b='';var _0x53c79b=['id',_0x7892('0x32'),_0x7892('0x5e'),_0x7892('0x5f'),_0x7892('0x60'),_0x7892('0x61'),_0x7892('0x62'),_0x7892('0x63'),_0x7892('0x64'),'parent_type',_0x7892('0x65'),_0x7892('0x66')];return db[_0x7892('0x34')][_0x7892('0x54')]({'where':{'id':_0x5c23a5[_0x7892('0x4f')]['id']},'attributes':['id',_0x7892('0x67'),'password','remoteUri']})[_0x7892('0x19')](handleEntityNotFound(_0x6907a3,null))['then'](function(_0xbcd5c2){if(_0xbcd5c2){_0x2f105b=_0xbcd5c2[_0x7892('0x68')];var _0x40d55f=_0x2f105b[_0x7892('0x69')](-0x1);if(_0x40d55f==='/'){_0x2f105b=_0x2f105b[_0x7892('0x6a')](0x0,_0x2f105b['lastIndexOf'](_0x40d55f));}return rp({'method':_0x7892('0x6b'),'uri':util[_0x7892('0x6c')](_0x7892('0x6d'),_0x2f105b,_0x7892('0x6e')),'json':!![],'form':{'method':_0x7892('0x6f'),'input_type':_0x7892('0x70'),'response_type':_0x7892('0x70'),'rest_data':JSON[_0x7892('0x1d')]({'user_auth':{'user_name':_0xbcd5c2[_0x7892('0x67')],'password':_0xbcd5c2[_0x7892('0x71')],'encryption':_0x7892('0x72')},'application':_0x7892('0x73')})}});}})[_0x7892('0x19')](function(_0x2c39d4){if(_0x2c39d4&&_0x2c39d4[_0x7892('0x32')]!==_0x7892('0x74')&&_0x2c39d4[_0x7892('0x32')]!==_0x7892('0x75')){return rp({'method':'POST','uri':util[_0x7892('0x6c')]('%s%s',_0x2f105b,_0x7892('0x6e')),'json':!![],'form':{'method':_0x7892('0x76'),'input_type':_0x7892('0x70'),'response_type':_0x7892('0x70'),'rest_data':JSON[_0x7892('0x1d')]({'session':_0x2c39d4['id'],'module_name':_0x7892('0x77')})}})[_0x7892('0x19')](function(_0x518b76){if(_0x518b76){var _0xe52104=_[_0x7892('0x78')](_0x518b76[_0x7892('0x79')]);_['remove'](_0xe52104,function(_0x436c60){return _0x53c79b[_0x7892('0x7a')](_0x436c60[_0x7892('0x32')]);});return{'count':_0xe52104[_0x7892('0x40')],'rows':_['map'](_0xe52104,function(_0x430bba){return{'id':_0x430bba[_0x7892('0x32')],'name':_0x430bba[_0x7892('0x7b')],'custom':_['endsWith'](_0x430bba['name'],'_c')?!![]:![],'options':_0x430bba['options']?_['map'](_['values'](_0x430bba[_0x7892('0x4a')]),function(_0x54e84b){return{'name':_0x54e84b['value'],'value':_0x54e84b['name']};}):[]};})};}})[_0x7892('0x19')](respondWithResult(_0x6907a3,null))[_0x7892('0x4e')](function(_0x3b75f0){var _0x5726d6=_0x5c23a5[_0x7892('0x39')][_0x7892('0x7c')]?0x1f4:_0x3b75f0['statusCode']||0x1f4;logger[_0x7892('0x1e')](_0x7892('0x7d'),_0x7892('0x5d'),_0x5726d6,JSON['stringify'](_0x3b75f0));delete _0x3b75f0[_0x7892('0x32')];if(_0x5726d6===0x191){_0x5726d6=0x190;}_0x6907a3[_0x7892('0x24')](_0x5726d6)[_0x7892('0x33')](_0x5c23a5[_0x7892('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3b75f0['statusCode']}:_0x3b75f0);});}else{var _0x156397=0x1f4;_0x6907a3['status'](_0x156397)[_0x7892('0x33')]({'message':_0x7892('0x7e'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 2ea26bd..941248a 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 _0xed19=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16eb49,_0x591e1f){var _0x3fb01e=function(_0x413b70){while(--_0x413b70){_0x16eb49['push'](_0x16eb49['shift']());}};_0x3fb01e(++_0x591e1f);}(_0xed19,0x7c));var _0x9ed1=function(_0x2d2b63,_0x277d0a){_0x2d2b63=_0x2d2b63-0x0;var _0x5d18f8=_0xed19[_0x2d2b63];return _0x5d18f8;};'use strict';var _=require('lodash');var util=require(_0x9ed1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9ed1('0x1'));var BPromise=require('bluebird');var rp=require(_0x9ed1('0x2'));var fs=require('fs');var path=require(_0x9ed1('0x3'));var rimraf=require(_0x9ed1('0x4'));var config=require(_0x9ed1('0x5'));var attributes=require(_0x9ed1('0x6'));var integrations=require(_0x9ed1('0x7'));module[_0x9ed1('0x8')]=function(_0x1a4445,_0x5d5f59){return _0x1a4445['define']('SugarcrmAccount',attributes,{'tableName':_0x9ed1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed8=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x4bc5fd,_0x32f2a5){var _0x42e4df=function(_0x170f58){while(--_0x170f58){_0x4bc5fd['push'](_0x4bc5fd['shift']());}};_0x42e4df(++_0x32f2a5);}(_0x0ed8,0x11a));var _0x80ed=function(_0x316b48,_0x11246b){_0x316b48=_0x316b48-0x0;var _0x573b7c=_0x0ed8[_0x316b48];return _0x573b7c;};'use strict';var _=require('lodash');var util=require(_0x80ed('0x0'));var logger=require(_0x80ed('0x1'))(_0x80ed('0x2'));var moment=require('moment');var BPromise=require(_0x80ed('0x3'));var rp=require(_0x80ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80ed('0x5'));var config=require(_0x80ed('0x6'));var attributes=require(_0x80ed('0x7'));var integrations=require(_0x80ed('0x8'));module[_0x80ed('0x9')]=function(_0x156e1a,_0x249da7){return _0x156e1a[_0x80ed('0xa')](_0x80ed('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 7df9231..bd44862 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 _0x06dc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3109db,_0x31936d){var _0x37c63a=function(_0x37db03){while(--_0x37db03){_0x3109db['push'](_0x3109db['shift']());}};_0x37c63a(++_0x31936d);}(_0x06dc,0x192));var _0xc06d=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x06dc[_0x359377];return _0x8be18a;};'use strict';var _=require(_0xc06d('0x0'));var util=require('util');var moment=require(_0xc06d('0x1'));var BPromise=require(_0xc06d('0x2'));var rs=require(_0xc06d('0x3'));var fs=require('fs');var Redis=require(_0xc06d('0x4'));var db=require(_0xc06d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc06d('0x6'))(_0xc06d('0x7'));var config=require(_0xc06d('0x8'));var jayson=require(_0xc06d('0x9'));var client=jayson[_0xc06d('0xa')][_0xc06d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539cc1,_0xc5aed1,_0x27c421){return new BPromise(function(_0x36c92f,_0xe4ded6){return client[_0xc06d('0xc')](_0x539cc1,_0x27c421)['then'](function(_0x5e494d){logger[_0xc06d('0xd')](_0xc06d('0xe'),_0xc5aed1,_0xc06d('0xf'));logger[_0xc06d('0x10')](_0xc06d('0x11'),_0xc5aed1,_0xc06d('0xf'),JSON[_0xc06d('0x12')](_0x5e494d));if(_0x5e494d[_0xc06d('0x13')]){if(_0x5e494d[_0xc06d('0x13')][_0xc06d('0x14')]===0x1f4){logger[_0xc06d('0x13')](_0xc06d('0xe'),_0xc5aed1,_0x5e494d[_0xc06d('0x13')][_0xc06d('0x15')]);return _0xe4ded6(_0x5e494d[_0xc06d('0x13')][_0xc06d('0x15')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0xc5aed1,_0x5e494d[_0xc06d('0x13')]['message']);return _0x36c92f(_0x5e494d[_0xc06d('0x13')][_0xc06d('0x15')]);}else{logger['info'](_0xc06d('0xe'),_0xc5aed1,_0xc06d('0xf'));_0x36c92f(_0x5e494d['result'][_0xc06d('0x15')]);}})[_0xc06d('0x16')](function(_0x45dace){logger[_0xc06d('0x13')](_0xc06d('0xe'),_0xc5aed1,_0x45dace);_0xe4ded6(_0x45dace);});});}exports[_0xc06d('0x17')]=function(_0x42a4c){var _0x59ca01=this;return new Promise(function(_0x458c07,_0x25afd9){return db[_0xc06d('0x18')][_0xc06d('0x19')]({'raw':_0x42a4c['options']?_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1b')]===undefined?!![]:![]:!![],'where':_0x42a4c[_0xc06d('0x1a')]?_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1c')]||null:null,'attributes':_0x42a4c['options']?_0x42a4c['options'][_0xc06d('0x1d')]||null:null,'limit':_0x42a4c[_0xc06d('0x1a')]?_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1e')]||null:null,'include':_0x42a4c[_0xc06d('0x1a')]?_0x42a4c['options'][_0xc06d('0x1f')]?_[_0xc06d('0x20')](_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1f')],function(_0x46fed7){return{'model':db[_0x46fed7['model']],'as':_0x46fed7['as'],'attributes':_0x46fed7[_0xc06d('0x1d')],'include':_0x46fed7[_0xc06d('0x1f')]?_['map'](_0x46fed7['include'],function(_0x120170){return{'model':db[_0x120170[_0xc06d('0x21')]],'as':_0x120170['as'],'attributes':_0x120170['attributes'],'include':_0x120170[_0xc06d('0x1f')]?_['map'](_0x120170[_0xc06d('0x1f')],function(_0x2e2b9f){return{'model':db[_0x2e2b9f['model']],'as':_0x2e2b9f['as'],'attributes':_0x2e2b9f[_0xc06d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc06d('0x22')](function(_0x35ce90){logger['info'](_0xc06d('0x17'),_0x42a4c);logger[_0xc06d('0x10')](_0xc06d('0x17'),_0x42a4c,JSON[_0xc06d('0x12')](_0x35ce90));_0x458c07(_0x35ce90);})[_0xc06d('0x16')](function(_0x10146e){logger['error'](_0xc06d('0x17'),_0x10146e[_0xc06d('0x15')],_0x42a4c);_0x25afd9(_0x59ca01['error'](0x1f4,_0x10146e[_0xc06d('0x15')]));});});};exports[_0xc06d('0x23')]=function(_0x3eab32){var _0x396b73=this;return new Promise(function(_0x3b1d15,_0x3bee73){return db['SugarcrmAccount'][_0xc06d('0x24')]({'raw':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1c')]||null:null,'attributes':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1d')]||null:null,'include':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1f')]?_['map'](_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1f')],function(_0x59e225){return{'model':db[_0x59e225[_0xc06d('0x21')]],'as':_0x59e225['as'],'attributes':_0x59e225['attributes'],'include':_0x59e225[_0xc06d('0x1f')]?_[_0xc06d('0x20')](_0x59e225[_0xc06d('0x1f')],function(_0x567d09){return{'model':db[_0x567d09[_0xc06d('0x21')]],'as':_0x567d09['as'],'attributes':_0x567d09[_0xc06d('0x1d')],'include':_0x567d09[_0xc06d('0x1f')]?_[_0xc06d('0x20')](_0x567d09['include'],function(_0x243de6){return{'model':db[_0x243de6[_0xc06d('0x21')]],'as':_0x243de6['as'],'attributes':_0x243de6[_0xc06d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x390950){logger[_0xc06d('0xd')](_0xc06d('0x23'),_0x3eab32);logger['debug'](_0xc06d('0x23'),_0x3eab32,JSON[_0xc06d('0x12')](_0x390950));_0x3b1d15(_0x390950);})[_0xc06d('0x16')](function(_0x54329e){logger[_0xc06d('0x13')](_0xc06d('0x23'),_0x54329e[_0xc06d('0x15')],_0x3eab32);_0x3bee73(_0x396b73[_0xc06d('0x13')](0x1f4,_0x54329e[_0xc06d('0x15')]));});});}; \ No newline at end of file +var _0x0cff=['../../config/logger','jayson/promise','http','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowSugarcrmAccount','find','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x456e8c,_0x20ad52){var _0xb007de=function(_0x362631){while(--_0x362631){_0x456e8c['push'](_0x456e8c['shift']());}};_0xb007de(++_0x20ad52);}(_0x0cff,0x13b));var _0xf0cf=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x0cff[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0xf0cf('0x0'));var util=require('util');var moment=require(_0xf0cf('0x1'));var BPromise=require(_0xf0cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0cf('0x3'))['db'];var utils=require(_0xf0cf('0x4'));var logger=require(_0xf0cf('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0cf('0x6'));var client=jayson['client'][_0xf0cf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c60bf,_0x4c8cf0,_0x21d057){return new BPromise(function(_0x49a54f,_0x4ed23a){return client['request'](_0x2c60bf,_0x21d057)[_0xf0cf('0x8')](function(_0x2c83d7){logger[_0xf0cf('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x4c8cf0,_0xf0cf('0xa'));logger['debug'](_0xf0cf('0xb'),_0x4c8cf0,_0xf0cf('0xa'),JSON[_0xf0cf('0xc')](_0x2c83d7));if(_0x2c83d7[_0xf0cf('0xd')]){if(_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0xe')]===0x1f4){logger[_0xf0cf('0xd')](_0xf0cf('0xf'),_0x4c8cf0,_0x2c83d7['error']['message']);return _0x4ed23a(_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0x10')]);}logger[_0xf0cf('0xd')](_0xf0cf('0xf'),_0x4c8cf0,_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0x10')]);return _0x49a54f(_0x2c83d7[_0xf0cf('0xd')][_0xf0cf('0x10')]);}else{logger['info'](_0xf0cf('0xf'),_0x4c8cf0,'request\x20sent');_0x49a54f(_0x2c83d7['result']['message']);}})[_0xf0cf('0x11')](function(_0x25f546){logger[_0xf0cf('0xd')](_0xf0cf('0xf'),_0x4c8cf0,_0x25f546);_0x4ed23a(_0x25f546);});});}exports[_0xf0cf('0x12')]=function(_0x14eb8a){var _0x4cdd49=this;return new Promise(function(_0x2e6065,_0x57c4f7){return db[_0xf0cf('0x13')][_0xf0cf('0x14')]({'raw':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a['options'][_0xf0cf('0x16')]===undefined?!![]:![]:!![],'where':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a[_0xf0cf('0x15')][_0xf0cf('0x17')]||null:null,'attributes':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a[_0xf0cf('0x15')]['attributes']||null:null,'limit':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a['options'][_0xf0cf('0x18')]||null:null,'include':_0x14eb8a[_0xf0cf('0x15')]?_0x14eb8a[_0xf0cf('0x15')][_0xf0cf('0x19')]?_[_0xf0cf('0x1a')](_0x14eb8a['options'][_0xf0cf('0x19')],function(_0x1bd879){return{'model':db[_0x1bd879[_0xf0cf('0x1b')]],'as':_0x1bd879['as'],'attributes':_0x1bd879[_0xf0cf('0x1c')],'include':_0x1bd879['include']?_[_0xf0cf('0x1a')](_0x1bd879['include'],function(_0x295001){return{'model':db[_0x295001[_0xf0cf('0x1b')]],'as':_0x295001['as'],'attributes':_0x295001['attributes'],'include':_0x295001[_0xf0cf('0x19')]?_['map'](_0x295001['include'],function(_0x277643){return{'model':db[_0x277643['model']],'as':_0x277643['as'],'attributes':_0x277643[_0xf0cf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0cf('0x8')](function(_0x511743){logger[_0xf0cf('0x9')](_0xf0cf('0x12'),_0x14eb8a);logger[_0xf0cf('0x1d')](_0xf0cf('0x12'),_0x14eb8a,JSON[_0xf0cf('0xc')](_0x511743));_0x2e6065(_0x511743);})[_0xf0cf('0x11')](function(_0x349b4e){logger[_0xf0cf('0xd')](_0xf0cf('0x12'),_0x349b4e[_0xf0cf('0x10')],_0x14eb8a);_0x57c4f7(_0x4cdd49[_0xf0cf('0xd')](0x1f4,_0x349b4e[_0xf0cf('0x10')]));});});};exports[_0xf0cf('0x1e')]=function(_0x23cf1c){var _0x34f2d7=this;return new Promise(function(_0x5a2da4,_0x1a7fa9){return db[_0xf0cf('0x13')][_0xf0cf('0x1f')]({'raw':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c[_0xf0cf('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c['options']['where']||null:null,'attributes':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c[_0xf0cf('0x15')][_0xf0cf('0x1c')]||null:null,'include':_0x23cf1c[_0xf0cf('0x15')]?_0x23cf1c[_0xf0cf('0x15')]['include']?_['map'](_0x23cf1c[_0xf0cf('0x15')][_0xf0cf('0x19')],function(_0x233672){return{'model':db[_0x233672[_0xf0cf('0x1b')]],'as':_0x233672['as'],'attributes':_0x233672[_0xf0cf('0x1c')],'include':_0x233672[_0xf0cf('0x19')]?_[_0xf0cf('0x1a')](_0x233672['include'],function(_0x220849){return{'model':db[_0x220849['model']],'as':_0x220849['as'],'attributes':_0x220849[_0xf0cf('0x1c')],'include':_0x220849[_0xf0cf('0x19')]?_['map'](_0x220849['include'],function(_0x4a7b19){return{'model':db[_0x4a7b19[_0xf0cf('0x1b')]],'as':_0x4a7b19['as'],'attributes':_0x4a7b19['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0cf('0x8')](function(_0x4e3a9a){logger[_0xf0cf('0x9')](_0xf0cf('0x1e'),_0x23cf1c);logger[_0xf0cf('0x1d')]('ShowSugarcrmAccount',_0x23cf1c,JSON[_0xf0cf('0xc')](_0x4e3a9a));_0x5a2da4(_0x4e3a9a);})[_0xf0cf('0x11')](function(_0x579233){logger[_0xf0cf('0xd')]('ShowSugarcrmAccount',_0x579233[_0xf0cf('0x10')],_0x23cf1c);_0x1a7fa9(_0x34f2d7[_0xf0cf('0xd')](0x1f4,_0x579233[_0xf0cf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c1fe2a9..d13d1c1 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 _0x2805=['/:id/descriptions','getDescriptions','post','put','/:id','update','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2805,0x9b));var _0x5280=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x2805[_0x125ff8];return _0x2d9ef;};'use strict';var multer=require(_0x5280('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5280('0x1'));var express=require(_0x5280('0x2'));var router=express[_0x5280('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5280('0x4'));var config=require(_0x5280('0x5'));var controller=require(_0x5280('0x6'));router[_0x5280('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5280('0x7')]('/:id',auth[_0x5280('0x8')](),controller[_0x5280('0x9')]);router[_0x5280('0x7')](_0x5280('0xa'),auth[_0x5280('0x8')](),controller['getFields']);router[_0x5280('0x7')](_0x5280('0xb'),auth['isAuthenticated'](),controller[_0x5280('0xc')]);router[_0x5280('0x7')](_0x5280('0xd'),auth[_0x5280('0x8')](),controller[_0x5280('0xe')]);router[_0x5280('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5280('0x10')](_0x5280('0x11'),auth[_0x5280('0x8')](),controller[_0x5280('0x12')]);router['delete'](_0x5280('0x11'),auth[_0x5280('0x8')](),controller[_0x5280('0x13')]);module[_0x5280('0x14')]=router; \ No newline at end of file +var _0x0e99=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x267eaf,_0x56dfad){var _0x418ed5=function(_0x3bf5ed){while(--_0x3bf5ed){_0x267eaf['push'](_0x267eaf['shift']());}};_0x418ed5(++_0x56dfad);}(_0x0e99,0x153));var _0x90e9=function(_0x1d5fb9,_0x43aa73){_0x1d5fb9=_0x1d5fb9-0x0;var _0xd72009=_0x0e99[_0x1d5fb9];return _0xd72009;};'use strict';var multer=require('multer');var util=require(_0x90e9('0x0'));var path=require(_0x90e9('0x1'));var timeout=require(_0x90e9('0x2'));var express=require(_0x90e9('0x3'));var router=express[_0x90e9('0x4')]();var auth=require(_0x90e9('0x5'));var interaction=require(_0x90e9('0x6'));var config=require(_0x90e9('0x7'));var controller=require(_0x90e9('0x8'));router['get']('/',auth[_0x90e9('0x9')](),controller[_0x90e9('0xa')]);router['get'](_0x90e9('0xb'),auth[_0x90e9('0x9')](),controller['show']);router[_0x90e9('0xc')](_0x90e9('0xd'),auth['isAuthenticated'](),controller[_0x90e9('0xe')]);router[_0x90e9('0xc')]('/:id/subjects',auth[_0x90e9('0x9')](),controller['getSubjects']);router[_0x90e9('0xc')](_0x90e9('0xf'),auth['isAuthenticated'](),controller[_0x90e9('0x10')]);router[_0x90e9('0x11')]('/',auth['isAuthenticated'](),controller[_0x90e9('0x12')]);router[_0x90e9('0x13')](_0x90e9('0xb'),auth[_0x90e9('0x9')](),controller[_0x90e9('0x14')]);router[_0x90e9('0x15')](_0x90e9('0xb'),auth[_0x90e9('0x9')](),controller[_0x90e9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4ff1523..1d2f116 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 _0xdd8b=['STRING'];(function(_0x1b68bd,_0x2f3842){var _0x1780e8=function(_0x41d549){while(--_0x41d549){_0x1b68bd['push'](_0x1b68bd['shift']());}};_0x1780e8(++_0x2f3842);}(_0xdd8b,0x180));var _0xbdd8=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0xdd8b[_0x4ab3fb];return _0x34fe1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbdd8('0x0')]},'description':{'type':Sequelize[_0xbdd8('0x0')]}}; \ No newline at end of file +var _0x40a7=['STRING','sequelize'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x40a7,0x141));var _0x740a=function(_0x475f91,_0x499f97){_0x475f91=_0x475f91-0x0;var _0x1bf7d4=_0x40a7[_0x475f91];return _0x1bf7d4;};'use strict';var Sequelize=require(_0x740a('0x0'));module['exports']={'name':{'type':Sequelize[_0x740a('0x1')]},'description':{'type':Sequelize[_0x740a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c2410eb..5bd8b7f 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 _0x7e7f=['status','json','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','SugarcrmConfiguration','includeAll','include','findAll','params','keys','fields','options','find','create','body','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end'];(function(_0x149980,_0xeb67c8){var _0x3aacce=function(_0x276700){while(--_0x276700){_0x149980['push'](_0x149980['shift']());}};_0x3aacce(++_0xeb67c8);}(_0x7e7f,0x8d));var _0xf7e7=function(_0x56d224,_0x58ec4e){_0x56d224=_0x56d224-0x0;var _0x1acbdb=_0x7e7f[_0x56d224];return _0x1acbdb;};'use strict';var pdf=require(_0xf7e7('0x0'));var emlformat=require(_0xf7e7('0x1'));var rimraf=require(_0xf7e7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7e7('0x3'));var rp=require(_0xf7e7('0x4'));var moment=require(_0xf7e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf7e7('0x6'));var util=require('util');var path=require(_0xf7e7('0x7'));var sox=require('sox');var csv=require(_0xf7e7('0x8'));var ejs=require(_0xf7e7('0x9'));var fs=require('fs');var _=require(_0xf7e7('0xa'));var squel=require(_0xf7e7('0xb'));var crypto=require(_0xf7e7('0xc'));var jsforce=require(_0xf7e7('0xd'));var deskjs=require(_0xf7e7('0xe'));var toCsv=require(_0xf7e7('0x8'));var querystring=require(_0xf7e7('0xf'));var Papa=require(_0xf7e7('0x10'));var Redis=require(_0xf7e7('0x11'));var authService=require(_0xf7e7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf7e7('0x13'));var hardwareService=require(_0xf7e7('0x14'));var logger=require(_0xf7e7('0x15'))('api');var utils=require(_0xf7e7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xf7e7('0x17'));var client=jayson[_0xf7e7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35594e,_0x218a06,_0x29b6e2,_0x502d84){return new BPromise(function(_0x484fde,_0x4dc075){var _0x114ee3=_0x502d84||client;return _0x114ee3[_0xf7e7('0x19')](_0x35594e,_0x29b6e2)[_0xf7e7('0x1a')](function(_0x4ffc6b){logger[_0xf7e7('0x1b')](_0xf7e7('0x1c'),_0x218a06,_0xf7e7('0x1d'));logger[_0xf7e7('0x1e')](_0xf7e7('0x1f'),_0x218a06,_0xf7e7('0x1d'),JSON[_0xf7e7('0x20')](_0x4ffc6b));if(_0x4ffc6b['error']){if(_0x4ffc6b[_0xf7e7('0x21')][_0xf7e7('0x22')]===0x1f4){logger[_0xf7e7('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x218a06,_0x4ffc6b[_0xf7e7('0x21')][_0xf7e7('0x23')]);return _0x4dc075(_0x4ffc6b[_0xf7e7('0x21')]['message']);}logger[_0xf7e7('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x218a06,_0x4ffc6b[_0xf7e7('0x21')]['message']);return _0x484fde(_0x4ffc6b['error'][_0xf7e7('0x23')]);}else{logger[_0xf7e7('0x1b')](_0xf7e7('0x1c'),_0x218a06,_0xf7e7('0x1d'));_0x484fde(_0x4ffc6b[_0xf7e7('0x24')][_0xf7e7('0x23')]);}})[_0xf7e7('0x25')](function(_0xf2bc72){logger[_0xf7e7('0x21')](_0xf7e7('0x1c'),_0x218a06,_0xf2bc72);_0x4dc075(_0xf2bc72);});});}function respondWithStatusCode(_0x2dd048,_0x599574){_0x599574=_0x599574||0xcc;return function(_0x2ebac7){if(_0x2ebac7){return _0x2dd048['sendStatus'](_0x599574);}return _0x2dd048['status'](_0x599574)[_0xf7e7('0x26')]();};}function respondWithResult(_0x5f2358,_0x47c51f){_0x47c51f=_0x47c51f||0xc8;return function(_0x30ff22){if(_0x30ff22){return _0x5f2358[_0xf7e7('0x27')](_0x47c51f)[_0xf7e7('0x28')](_0x30ff22);}};}function respondWithFilteredResult(_0x3c41b5,_0x4178be){return function(_0x3495af){if(_0x3495af){var _0x576183=_0x3495af[_0xf7e7('0x29')],_0x41a9de=_0x4178be[_0xf7e7('0x2a')],_0x23aec8=_0x4178be[_0xf7e7('0x2a')]+_0x4178be['limit'],_0x2a7480;if(_0x23aec8>=_0x576183){_0x23aec8=_0x576183;_0x2a7480=0xc8;}else{_0x2a7480=0xce;}_0x3c41b5[_0xf7e7('0x27')](_0x2a7480);return _0x3c41b5['set'](_0xf7e7('0x2b'),_0x41a9de+'-'+_0x23aec8+'/'+_0x576183)[_0xf7e7('0x28')](_0x3495af);}return null;};}function patchUpdates(_0x5d99f8){return function(_0x551276){try{jsonpatch[_0xf7e7('0x2c')](_0x551276,_0x5d99f8,!![]);}catch(_0x59e580){return BPromise[_0xf7e7('0x2d')](_0x59e580);}return _0x551276[_0xf7e7('0x2e')]();};}function saveUpdates(_0xa0b949,_0x45be79){return function(_0x540b5a){if(_0x540b5a){return _0x540b5a[_0xf7e7('0x2f')](_0xa0b949)[_0xf7e7('0x1a')](function(_0x36185b){return _0x36185b;});}return null;};}function removeEntity(_0x37963a,_0x48dafe){return function(_0x4d4a54){if(_0x4d4a54){return _0x4d4a54[_0xf7e7('0x30')]()[_0xf7e7('0x1a')](function(){_0x37963a['status'](0xcc)[_0xf7e7('0x26')]();});}};}function handleEntityNotFound(_0x24cfc9,_0x250aaa){return function(_0x139697){if(!_0x139697){_0x24cfc9[_0xf7e7('0x31')](0x194);}return _0x139697;};}function handleError(_0x211eb6,_0x214a01){_0x214a01=_0x214a01||0x1f4;return function(_0x5d8f67){logger[_0xf7e7('0x21')](_0x5d8f67['stack']);if(_0x5d8f67[_0xf7e7('0x32')]){delete _0x5d8f67[_0xf7e7('0x32')];}_0x211eb6[_0xf7e7('0x27')](_0x214a01)[_0xf7e7('0x33')](_0x5d8f67);};}exports[_0xf7e7('0x34')]=function(_0x525c09,_0x1b8010){var _0x337bf3={},_0x4a58f9={},_0x237c7b={'count':0x0,'rows':[]};var _0x55d579=_['map'](db['SugarcrmConfiguration'][_0xf7e7('0x35')],function(_0x1c9142){return{'name':_0x1c9142[_0xf7e7('0x36')],'type':_0x1c9142[_0xf7e7('0x37')][_0xf7e7('0x38')]};});_0x4a58f9[_0xf7e7('0x39')]=_[_0xf7e7('0x3a')](_0x55d579,_0xf7e7('0x32'));_0x4a58f9[_0xf7e7('0x3b')]=_['keys'](_0x525c09['query']);_0x4a58f9[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x4a58f9[_0xf7e7('0x39')],_0x4a58f9['query']);_0x337bf3[_0xf7e7('0x3e')]=_['intersection'](_0x4a58f9[_0xf7e7('0x39')],qs['fields'](_0x525c09[_0xf7e7('0x3b')]['fields']));_0x337bf3[_0xf7e7('0x3e')]=_0x337bf3[_0xf7e7('0x3e')][_0xf7e7('0x3f')]?_0x337bf3[_0xf7e7('0x3e')]:_0x4a58f9[_0xf7e7('0x39')];if(!_0x525c09[_0xf7e7('0x3b')]['hasOwnProperty'](_0xf7e7('0x40'))){_0x337bf3[_0xf7e7('0x41')]=qs['limit'](_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x41')]);_0x337bf3[_0xf7e7('0x2a')]=qs[_0xf7e7('0x2a')](_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x2a')]);}_0x337bf3[_0xf7e7('0x42')]=qs['sort'](_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x43')]);_0x337bf3[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_[_0xf7e7('0x45')](_0x525c09[_0xf7e7('0x3b')],_0x4a58f9[_0xf7e7('0x3c')]),_0x55d579);if(_0x525c09[_0xf7e7('0x3b')]['filter']){_0x337bf3[_0xf7e7('0x44')]=_[_0xf7e7('0x46')](_0x337bf3[_0xf7e7('0x44')],{'$or':_[_0xf7e7('0x3a')](_0x55d579,function(_0x3a20d1){if(_0x3a20d1[_0xf7e7('0x37')]!==_0xf7e7('0x47')){var _0x16afb9={};_0x16afb9[_0x3a20d1[_0xf7e7('0x32')]]={'$like':'%'+_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x48')]+'%'};return _0x16afb9;}})});}_0x337bf3=_[_0xf7e7('0x46')]({},_0x337bf3,_0x525c09['options']);var _0x1372e6={'where':_0x337bf3[_0xf7e7('0x44')]};return db[_0xf7e7('0x49')][_0xf7e7('0x29')](_0x1372e6)['then'](function(_0x2d577d){_0x237c7b[_0xf7e7('0x29')]=_0x2d577d;if(_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x4a')]){_0x337bf3[_0xf7e7('0x4b')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xf7e7('0x4c')](_0x337bf3);})[_0xf7e7('0x1a')](function(_0x4ef6fc){_0x237c7b['rows']=_0x4ef6fc;return _0x237c7b;})[_0xf7e7('0x1a')](respondWithFilteredResult(_0x1b8010,_0x337bf3))[_0xf7e7('0x25')](handleError(_0x1b8010,null));};exports['show']=function(_0x2df85f,_0x10b335){var _0x39f6c8={'raw':![],'where':{'id':_0x2df85f[_0xf7e7('0x4d')]['id']}},_0x56cbdc={};_0x56cbdc[_0xf7e7('0x39')]=_[_0xf7e7('0x4e')](db[_0xf7e7('0x49')]['rawAttributes']);_0x56cbdc[_0xf7e7('0x3b')]=_[_0xf7e7('0x4e')](_0x2df85f[_0xf7e7('0x3b')]);_0x56cbdc[_0xf7e7('0x3c')]=_['intersection'](_0x56cbdc[_0xf7e7('0x39')],_0x56cbdc[_0xf7e7('0x3b')]);_0x39f6c8[_0xf7e7('0x3e')]=_[_0xf7e7('0x3d')](_0x56cbdc[_0xf7e7('0x39')],qs['fields'](_0x2df85f['query'][_0xf7e7('0x4f')]));_0x39f6c8[_0xf7e7('0x3e')]=_0x39f6c8[_0xf7e7('0x3e')][_0xf7e7('0x3f')]?_0x39f6c8[_0xf7e7('0x3e')]:_0x56cbdc[_0xf7e7('0x39')];if(_0x2df85f[_0xf7e7('0x3b')][_0xf7e7('0x4a')]){_0x39f6c8[_0xf7e7('0x4b')]=[{'all':!![]}];}_0x39f6c8=_[_0xf7e7('0x46')]({},_0x39f6c8,_0x2df85f[_0xf7e7('0x50')]);return db[_0xf7e7('0x49')][_0xf7e7('0x51')](_0x39f6c8)[_0xf7e7('0x1a')](handleEntityNotFound(_0x10b335,null))[_0xf7e7('0x1a')](respondWithResult(_0x10b335,null))[_0xf7e7('0x25')](handleError(_0x10b335,null));};exports[_0xf7e7('0x52')]=function(_0x437084,_0x47a11c){return db['SugarcrmConfiguration'][_0xf7e7('0x52')](_0x437084[_0xf7e7('0x53')],{})[_0xf7e7('0x1a')](respondWithResult(_0x47a11c,0xc9))['catch'](handleError(_0x47a11c,null));};exports[_0xf7e7('0x2f')]=function(_0x6328e9,_0xf687ff){if(_0x6328e9[_0xf7e7('0x53')]['id']){delete _0x6328e9['body']['id'];}return db[_0xf7e7('0x49')][_0xf7e7('0x51')]({'where':{'id':_0x6328e9['params']['id']}})['then'](handleEntityNotFound(_0xf687ff,null))['then'](saveUpdates(_0x6328e9[_0xf7e7('0x53')],null))[_0xf7e7('0x1a')](respondWithResult(_0xf687ff,null))[_0xf7e7('0x25')](handleError(_0xf687ff,null));};exports[_0xf7e7('0x30')]=function(_0x14e61c,_0x56914b){return db[_0xf7e7('0x49')][_0xf7e7('0x51')]({'where':{'id':_0x14e61c[_0xf7e7('0x4d')]['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x56914b,null))[_0xf7e7('0x1a')](removeEntity(_0x56914b,null))[_0xf7e7('0x25')](handleError(_0x56914b,null));};exports['getFields']=function(_0x5a18af,_0x1024ff,_0x9f045b){var _0x37a927={};var _0x27faa3={};var _0x15b2d1;var _0x2f4d15;return db[_0xf7e7('0x49')][_0xf7e7('0x54')]({'where':{'id':_0x5a18af[_0xf7e7('0x4d')]['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x1024ff,null))[_0xf7e7('0x1a')](function(_0x5d3ea8){if(_0x5d3ea8){_0x15b2d1=_0x5d3ea8;_0x27faa3['model']=_[_0xf7e7('0x4e')](db[_0xf7e7('0x55')][_0xf7e7('0x35')]);_0x27faa3[_0xf7e7('0x3b')]=_['keys'](_0x5a18af[_0xf7e7('0x3b')]);_0x27faa3[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x27faa3[_0xf7e7('0x39')],_0x27faa3['query']);_0x37a927[_0xf7e7('0x3e')]=_[_0xf7e7('0x3d')](_0x27faa3[_0xf7e7('0x39')],qs[_0xf7e7('0x4f')](_0x5a18af[_0xf7e7('0x3b')][_0xf7e7('0x4f')]));_0x37a927[_0xf7e7('0x3e')]=_0x37a927[_0xf7e7('0x3e')]['length']?_0x37a927['attributes']:_0x27faa3[_0xf7e7('0x39')];_0x37a927[_0xf7e7('0x42')]=qs[_0xf7e7('0x43')](_0x5a18af['query'][_0xf7e7('0x43')]);_0x37a927[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_[_0xf7e7('0x45')](_0x5a18af[_0xf7e7('0x3b')],_0x27faa3[_0xf7e7('0x3c')]));if(_0x5a18af['query'][_0xf7e7('0x48')]){_0x37a927[_0xf7e7('0x44')]=_['merge'](_0x37a927[_0xf7e7('0x44')],{'$or':_[_0xf7e7('0x3a')](_0x37a927[_0xf7e7('0x3e')],function(_0x3cd2c8){var _0x56adc0={};_0x56adc0[_0x3cd2c8]={'$like':'%'+_0x5a18af[_0xf7e7('0x3b')]['filter']+'%'};return _0x56adc0;})});}_0x37a927=_[_0xf7e7('0x46')]({},_0x37a927,_0x5a18af[_0xf7e7('0x50')]);return _0x15b2d1['getFields'](_0x37a927);}})[_0xf7e7('0x1a')](function(_0x2de8e3){if(_0x2de8e3){_0x2f4d15=_0x2de8e3[_0xf7e7('0x3f')];if(!_0x5a18af[_0xf7e7('0x3b')]['hasOwnProperty']('nolimit')){_0x37a927[_0xf7e7('0x41')]=qs[_0xf7e7('0x41')](_0x5a18af[_0xf7e7('0x3b')]['limit']);_0x37a927[_0xf7e7('0x2a')]=qs[_0xf7e7('0x2a')](_0x5a18af[_0xf7e7('0x3b')][_0xf7e7('0x2a')]);}return _0x15b2d1[_0xf7e7('0x56')](_0x37a927);}})[_0xf7e7('0x1a')](function(_0xf02388){if(_0xf02388){return _0xf02388?{'count':_0x2f4d15,'rows':_0xf02388}:null;}})[_0xf7e7('0x1a')](respondWithResult(_0x1024ff,null))[_0xf7e7('0x25')](handleError(_0x1024ff,null));};exports[_0xf7e7('0x57')]=function(_0x3dead2,_0x3c05e9,_0x4e08e8){var _0x105eb0={};var _0x2974aa={};var _0x4b3130;var _0x39c64e;return db['SugarcrmConfiguration'][_0xf7e7('0x54')]({'where':{'id':_0x3dead2['params']['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x3c05e9,null))['then'](function(_0x3346fb){if(_0x3346fb){_0x4b3130=_0x3346fb;_0x2974aa['model']=_['keys'](db[_0xf7e7('0x55')][_0xf7e7('0x35')]);_0x2974aa[_0xf7e7('0x3b')]=_[_0xf7e7('0x4e')](_0x3dead2[_0xf7e7('0x3b')]);_0x2974aa[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x2974aa[_0xf7e7('0x39')],_0x2974aa[_0xf7e7('0x3b')]);_0x105eb0['attributes']=_[_0xf7e7('0x3d')](_0x2974aa[_0xf7e7('0x39')],qs[_0xf7e7('0x4f')](_0x3dead2['query'][_0xf7e7('0x4f')]));_0x105eb0[_0xf7e7('0x3e')]=_0x105eb0['attributes'][_0xf7e7('0x3f')]?_0x105eb0[_0xf7e7('0x3e')]:_0x2974aa['model'];_0x105eb0[_0xf7e7('0x42')]=qs[_0xf7e7('0x43')](_0x3dead2[_0xf7e7('0x3b')][_0xf7e7('0x43')]);_0x105eb0[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_['pick'](_0x3dead2[_0xf7e7('0x3b')],_0x2974aa['filters']));if(_0x3dead2[_0xf7e7('0x3b')][_0xf7e7('0x48')]){_0x105eb0[_0xf7e7('0x44')]=_[_0xf7e7('0x46')](_0x105eb0['where'],{'$or':_[_0xf7e7('0x3a')](_0x105eb0[_0xf7e7('0x3e')],function(_0x1bb383){var _0x57ff23={};_0x57ff23[_0x1bb383]={'$like':'%'+_0x3dead2['query']['filter']+'%'};return _0x57ff23;})});}_0x105eb0=_[_0xf7e7('0x46')]({},_0x105eb0,_0x3dead2['options']);return _0x4b3130[_0xf7e7('0x57')](_0x105eb0);}})['then'](function(_0x2a89e5){if(_0x2a89e5){_0x39c64e=_0x2a89e5[_0xf7e7('0x3f')];if(!_0x3dead2[_0xf7e7('0x3b')]['hasOwnProperty'](_0xf7e7('0x40'))){_0x105eb0[_0xf7e7('0x41')]=qs[_0xf7e7('0x41')](_0x3dead2[_0xf7e7('0x3b')][_0xf7e7('0x41')]);_0x105eb0[_0xf7e7('0x2a')]=qs['offset'](_0x3dead2['query'][_0xf7e7('0x2a')]);}return _0x4b3130[_0xf7e7('0x57')](_0x105eb0);}})[_0xf7e7('0x1a')](function(_0x11074e){if(_0x11074e){return _0x11074e?{'count':_0x39c64e,'rows':_0x11074e}:null;}})[_0xf7e7('0x1a')](respondWithResult(_0x3c05e9,null))['catch'](handleError(_0x3c05e9,null));};exports[_0xf7e7('0x58')]=function(_0x3f8df4,_0x38cb57,_0x54bb3f){var _0x2b27df={};var _0x1c7cac={};var _0x571b90;var _0x1ac54d;return db[_0xf7e7('0x49')][_0xf7e7('0x54')]({'where':{'id':_0x3f8df4[_0xf7e7('0x4d')]['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x38cb57,null))[_0xf7e7('0x1a')](function(_0x35f1c3){if(_0x35f1c3){_0x571b90=_0x35f1c3;_0x1c7cac['model']=_[_0xf7e7('0x4e')](db['SugarcrmField'][_0xf7e7('0x35')]);_0x1c7cac['query']=_[_0xf7e7('0x4e')](_0x3f8df4[_0xf7e7('0x3b')]);_0x1c7cac[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x1c7cac[_0xf7e7('0x39')],_0x1c7cac['query']);_0x2b27df['attributes']=_[_0xf7e7('0x3d')](_0x1c7cac[_0xf7e7('0x39')],qs['fields'](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x4f')]));_0x2b27df[_0xf7e7('0x3e')]=_0x2b27df[_0xf7e7('0x3e')][_0xf7e7('0x3f')]?_0x2b27df[_0xf7e7('0x3e')]:_0x1c7cac[_0xf7e7('0x39')];_0x2b27df['order']=qs[_0xf7e7('0x43')](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x43')]);_0x2b27df[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_[_0xf7e7('0x45')](_0x3f8df4[_0xf7e7('0x3b')],_0x1c7cac[_0xf7e7('0x3c')]));if(_0x3f8df4['query'][_0xf7e7('0x48')]){_0x2b27df['where']=_['merge'](_0x2b27df[_0xf7e7('0x44')],{'$or':_[_0xf7e7('0x3a')](_0x2b27df['attributes'],function(_0xa4de2e){var _0x2c0b69={};_0x2c0b69[_0xa4de2e]={'$like':'%'+_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x48')]+'%'};return _0x2c0b69;})});}_0x2b27df=_[_0xf7e7('0x46')]({},_0x2b27df,_0x3f8df4[_0xf7e7('0x50')]);return _0x571b90['getDescriptions'](_0x2b27df);}})['then'](function(_0x259a9b){if(_0x259a9b){_0x1ac54d=_0x259a9b[_0xf7e7('0x3f')];if(!_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x59')]('nolimit')){_0x2b27df['limit']=qs['limit'](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x41')]);_0x2b27df[_0xf7e7('0x2a')]=qs[_0xf7e7('0x2a')](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x2a')]);}return _0x571b90[_0xf7e7('0x58')](_0x2b27df);}})[_0xf7e7('0x1a')](function(_0x3a7613){if(_0x3a7613){return _0x3a7613?{'count':_0x1ac54d,'rows':_0x3a7613}:null;}})['then'](respondWithResult(_0x38cb57,null))[_0xf7e7('0x25')](handleError(_0x38cb57,null));}; \ No newline at end of file +var _0xb181=['options','includeAll','include','findAll','rows','show','params','length','find','catch','body','getFields','fields','order','findOne','getSubjects','getDescriptions','html-pdf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb181,0xc1));var _0x1b18=function(_0x3cbee0,_0x352a0a){_0x3cbee0=_0x3cbee0-0x0;var _0x2ed094=_0xb181[_0x3cbee0];return _0x2ed094;};'use strict';var pdf=require(_0x1b18('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b18('0x1'));var BPromise=require(_0x1b18('0x2'));var Mustache=require(_0x1b18('0x3'));var util=require(_0x1b18('0x4'));var path=require('path');var sox=require(_0x1b18('0x5'));var csv=require(_0x1b18('0x6'));var ejs=require(_0x1b18('0x7'));var fs=require('fs');var _=require(_0x1b18('0x8'));var squel=require(_0x1b18('0x9'));var crypto=require(_0x1b18('0xa'));var jsforce=require(_0x1b18('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1b18('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b18('0xc'));var authService=require(_0x1b18('0xd'));var qs=require(_0x1b18('0xe'));var as=require(_0x1b18('0xf'));var hardwareService=require(_0x1b18('0x10'));var logger=require(_0x1b18('0x11'))(_0x1b18('0x12'));var utils=require(_0x1b18('0x13'));var config=require(_0x1b18('0x14'));var licenseUtil=require(_0x1b18('0x15'));var db=require(_0x1b18('0x16'))['db'];var jayson=require(_0x1b18('0x17'));var client=jayson[_0x1b18('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4efa2d,_0x122139,_0x3f1b3d,_0x4d067f){return new BPromise(function(_0x118223,_0x221a30){var _0x22d1d4=_0x4d067f||client;return _0x22d1d4[_0x1b18('0x19')](_0x4efa2d,_0x3f1b3d)[_0x1b18('0x1a')](function(_0x51cad3){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x122139,_0x1b18('0x1b'));logger[_0x1b18('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x122139,_0x1b18('0x1b'),JSON[_0x1b18('0x1d')](_0x51cad3));if(_0x51cad3['error']){if(_0x51cad3[_0x1b18('0x1e')][_0x1b18('0x1f')]===0x1f4){logger['error'](_0x1b18('0x20'),_0x122139,_0x51cad3[_0x1b18('0x1e')]['message']);return _0x221a30(_0x51cad3['error']['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x122139,_0x51cad3[_0x1b18('0x1e')][_0x1b18('0x21')]);return _0x118223(_0x51cad3[_0x1b18('0x1e')][_0x1b18('0x21')]);}else{logger[_0x1b18('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x122139,_0x1b18('0x1b'));_0x118223(_0x51cad3[_0x1b18('0x23')][_0x1b18('0x21')]);}})['catch'](function(_0x45696c){logger['error'](_0x1b18('0x20'),_0x122139,_0x45696c);_0x221a30(_0x45696c);});});}function respondWithStatusCode(_0x3cd9cf,_0x4d53c9){_0x4d53c9=_0x4d53c9||0xcc;return function(_0x5b0625){if(_0x5b0625){return _0x3cd9cf[_0x1b18('0x24')](_0x4d53c9);}return _0x3cd9cf['status'](_0x4d53c9)[_0x1b18('0x25')]();};}function respondWithResult(_0x30d490,_0x2a93b5){_0x2a93b5=_0x2a93b5||0xc8;return function(_0xb201fd){if(_0xb201fd){return _0x30d490['status'](_0x2a93b5)[_0x1b18('0x26')](_0xb201fd);}};}function respondWithFilteredResult(_0xe752c5,_0x2f7fb0){return function(_0x1f444){if(_0x1f444){var _0x13d90f=_0x1f444[_0x1b18('0x27')],_0x30d367=_0x2f7fb0[_0x1b18('0x28')],_0x1ad6c8=_0x2f7fb0[_0x1b18('0x28')]+_0x2f7fb0[_0x1b18('0x29')],_0x567636;if(_0x1ad6c8>=_0x13d90f){_0x1ad6c8=_0x13d90f;_0x567636=0xc8;}else{_0x567636=0xce;}_0xe752c5[_0x1b18('0x2a')](_0x567636);return _0xe752c5['set'](_0x1b18('0x2b'),_0x30d367+'-'+_0x1ad6c8+'/'+_0x13d90f)[_0x1b18('0x26')](_0x1f444);}return null;};}function patchUpdates(_0x4ef74c){return function(_0x50e928){try{jsonpatch[_0x1b18('0x2c')](_0x50e928,_0x4ef74c,!![]);}catch(_0x1c19bc){return BPromise[_0x1b18('0x2d')](_0x1c19bc);}return _0x50e928[_0x1b18('0x2e')]();};}function saveUpdates(_0x1f34e5,_0x356408){return function(_0x25171b){if(_0x25171b){return _0x25171b[_0x1b18('0x2f')](_0x1f34e5)[_0x1b18('0x1a')](function(_0x79be02){return _0x79be02;});}return null;};}function removeEntity(_0x6d0f5d,_0xb126f0){return function(_0x55df7e){if(_0x55df7e){return _0x55df7e[_0x1b18('0x30')]()[_0x1b18('0x1a')](function(){_0x6d0f5d['status'](0xcc)[_0x1b18('0x25')]();});}};}function handleEntityNotFound(_0x505e4f,_0x145652){return function(_0x201886){if(!_0x201886){_0x505e4f['sendStatus'](0x194);}return _0x201886;};}function handleError(_0x1599c2,_0x4fcb01){_0x4fcb01=_0x4fcb01||0x1f4;return function(_0x4fb418){logger['error'](_0x4fb418['stack']);if(_0x4fb418[_0x1b18('0x31')]){delete _0x4fb418['name'];}_0x1599c2[_0x1b18('0x2a')](_0x4fcb01)[_0x1b18('0x32')](_0x4fb418);};}exports['index']=function(_0x18ec63,_0x5383b7){var _0x3fa789={},_0x503298={},_0x3e9326={'count':0x0,'rows':[]};var _0x338657=_[_0x1b18('0x33')](db[_0x1b18('0x34')][_0x1b18('0x35')],function(_0x31534c){return{'name':_0x31534c[_0x1b18('0x36')],'type':_0x31534c[_0x1b18('0x37')][_0x1b18('0x38')]};});_0x503298['model']=_[_0x1b18('0x33')](_0x338657,_0x1b18('0x31'));_0x503298[_0x1b18('0x39')]=_[_0x1b18('0x3a')](_0x18ec63['query']);_0x503298[_0x1b18('0x3b')]=_['intersection'](_0x503298[_0x1b18('0x3c')],_0x503298[_0x1b18('0x39')]);_0x3fa789['attributes']=_[_0x1b18('0x3d')](_0x503298['model'],qs['fields'](_0x18ec63[_0x1b18('0x39')]['fields']));_0x3fa789['attributes']=_0x3fa789[_0x1b18('0x3e')]['length']?_0x3fa789['attributes']:_0x503298[_0x1b18('0x3c')];if(!_0x18ec63[_0x1b18('0x39')][_0x1b18('0x3f')](_0x1b18('0x40'))){_0x3fa789[_0x1b18('0x29')]=qs['limit'](_0x18ec63['query']['limit']);_0x3fa789['offset']=qs[_0x1b18('0x28')](_0x18ec63[_0x1b18('0x39')][_0x1b18('0x28')]);}_0x3fa789['order']=qs['sort'](_0x18ec63['query'][_0x1b18('0x41')]);_0x3fa789['where']=qs[_0x1b18('0x3b')](_[_0x1b18('0x42')](_0x18ec63[_0x1b18('0x39')],_0x503298['filters']),_0x338657);if(_0x18ec63[_0x1b18('0x39')][_0x1b18('0x43')]){_0x3fa789[_0x1b18('0x44')]=_[_0x1b18('0x45')](_0x3fa789['where'],{'$or':_[_0x1b18('0x33')](_0x338657,function(_0x58cf00){if(_0x58cf00[_0x1b18('0x37')]!==_0x1b18('0x46')){var _0x809f6b={};_0x809f6b[_0x58cf00[_0x1b18('0x31')]]={'$like':'%'+_0x18ec63[_0x1b18('0x39')][_0x1b18('0x43')]+'%'};return _0x809f6b;}})});}_0x3fa789=_[_0x1b18('0x45')]({},_0x3fa789,_0x18ec63[_0x1b18('0x47')]);var _0x23163d={'where':_0x3fa789[_0x1b18('0x44')]};return db['SugarcrmConfiguration'][_0x1b18('0x27')](_0x23163d)['then'](function(_0x16a40e){_0x3e9326['count']=_0x16a40e;if(_0x18ec63[_0x1b18('0x39')][_0x1b18('0x48')]){_0x3fa789[_0x1b18('0x49')]=[{'all':!![]}];}return db[_0x1b18('0x34')][_0x1b18('0x4a')](_0x3fa789);})[_0x1b18('0x1a')](function(_0x2b755f){_0x3e9326[_0x1b18('0x4b')]=_0x2b755f;return _0x3e9326;})['then'](respondWithFilteredResult(_0x5383b7,_0x3fa789))['catch'](handleError(_0x5383b7,null));};exports[_0x1b18('0x4c')]=function(_0x476ffc,_0xda10ef){var _0x55305a={'raw':![],'where':{'id':_0x476ffc[_0x1b18('0x4d')]['id']}},_0x22b2c5={};_0x22b2c5[_0x1b18('0x3c')]=_[_0x1b18('0x3a')](db[_0x1b18('0x34')]['rawAttributes']);_0x22b2c5[_0x1b18('0x39')]=_[_0x1b18('0x3a')](_0x476ffc[_0x1b18('0x39')]);_0x22b2c5[_0x1b18('0x3b')]=_[_0x1b18('0x3d')](_0x22b2c5[_0x1b18('0x3c')],_0x22b2c5[_0x1b18('0x39')]);_0x55305a['attributes']=_['intersection'](_0x22b2c5['model'],qs['fields'](_0x476ffc[_0x1b18('0x39')]['fields']));_0x55305a['attributes']=_0x55305a[_0x1b18('0x3e')][_0x1b18('0x4e')]?_0x55305a[_0x1b18('0x3e')]:_0x22b2c5[_0x1b18('0x3c')];if(_0x476ffc['query']['includeAll']){_0x55305a['include']=[{'all':!![]}];}_0x55305a=_[_0x1b18('0x45')]({},_0x55305a,_0x476ffc[_0x1b18('0x47')]);return db[_0x1b18('0x34')][_0x1b18('0x4f')](_0x55305a)[_0x1b18('0x1a')](handleEntityNotFound(_0xda10ef,null))[_0x1b18('0x1a')](respondWithResult(_0xda10ef,null))[_0x1b18('0x50')](handleError(_0xda10ef,null));};exports['create']=function(_0x240177,_0x521c27){return db[_0x1b18('0x34')]['create'](_0x240177[_0x1b18('0x51')],{})[_0x1b18('0x1a')](respondWithResult(_0x521c27,0xc9))[_0x1b18('0x50')](handleError(_0x521c27,null));};exports[_0x1b18('0x2f')]=function(_0x513630,_0x2c6bf2){if(_0x513630[_0x1b18('0x51')]['id']){delete _0x513630[_0x1b18('0x51')]['id'];}return db[_0x1b18('0x34')][_0x1b18('0x4f')]({'where':{'id':_0x513630[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x2c6bf2,null))[_0x1b18('0x1a')](saveUpdates(_0x513630[_0x1b18('0x51')],null))['then'](respondWithResult(_0x2c6bf2,null))['catch'](handleError(_0x2c6bf2,null));};exports['destroy']=function(_0x3b9df9,_0x4e94b1){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x3b9df9[_0x1b18('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4e94b1,null))['then'](removeEntity(_0x4e94b1,null))['catch'](handleError(_0x4e94b1,null));};exports[_0x1b18('0x52')]=function(_0x1b7f5d,_0x2c5afd,_0x1493a5){var _0x12f8f6={};var _0x3d9285={};var _0x3efa83;var _0x5369dd;return db[_0x1b18('0x34')]['findOne']({'where':{'id':_0x1b7f5d[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x2c5afd,null))['then'](function(_0x53d199){if(_0x53d199){_0x3efa83=_0x53d199;_0x3d9285['model']=_[_0x1b18('0x3a')](db['SugarcrmField']['rawAttributes']);_0x3d9285[_0x1b18('0x39')]=_['keys'](_0x1b7f5d[_0x1b18('0x39')]);_0x3d9285[_0x1b18('0x3b')]=_[_0x1b18('0x3d')](_0x3d9285['model'],_0x3d9285['query']);_0x12f8f6[_0x1b18('0x3e')]=_['intersection'](_0x3d9285['model'],qs[_0x1b18('0x53')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x53')]));_0x12f8f6['attributes']=_0x12f8f6[_0x1b18('0x3e')][_0x1b18('0x4e')]?_0x12f8f6['attributes']:_0x3d9285[_0x1b18('0x3c')];_0x12f8f6[_0x1b18('0x54')]=qs[_0x1b18('0x41')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x41')]);_0x12f8f6[_0x1b18('0x44')]=qs[_0x1b18('0x3b')](_['pick'](_0x1b7f5d[_0x1b18('0x39')],_0x3d9285[_0x1b18('0x3b')]));if(_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x43')]){_0x12f8f6[_0x1b18('0x44')]=_[_0x1b18('0x45')](_0x12f8f6[_0x1b18('0x44')],{'$or':_[_0x1b18('0x33')](_0x12f8f6['attributes'],function(_0x32d61e){var _0x5349eb={};_0x5349eb[_0x32d61e]={'$like':'%'+_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x43')]+'%'};return _0x5349eb;})});}_0x12f8f6=_[_0x1b18('0x45')]({},_0x12f8f6,_0x1b7f5d['options']);return _0x3efa83['getFields'](_0x12f8f6);}})[_0x1b18('0x1a')](function(_0x34ead6){if(_0x34ead6){_0x5369dd=_0x34ead6[_0x1b18('0x4e')];if(!_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x3f')]('nolimit')){_0x12f8f6[_0x1b18('0x29')]=qs[_0x1b18('0x29')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x29')]);_0x12f8f6[_0x1b18('0x28')]=qs[_0x1b18('0x28')](_0x1b7f5d[_0x1b18('0x39')][_0x1b18('0x28')]);}return _0x3efa83[_0x1b18('0x52')](_0x12f8f6);}})[_0x1b18('0x1a')](function(_0x52bcbc){if(_0x52bcbc){return _0x52bcbc?{'count':_0x5369dd,'rows':_0x52bcbc}:null;}})['then'](respondWithResult(_0x2c5afd,null))['catch'](handleError(_0x2c5afd,null));};exports['getSubjects']=function(_0x4caee7,_0x3c0202,_0x30d948){var _0x4dd226={};var _0x1606c0={};var _0x4f0363;var _0x3e8b54;return db[_0x1b18('0x34')][_0x1b18('0x55')]({'where':{'id':_0x4caee7[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x3c0202,null))[_0x1b18('0x1a')](function(_0x1d3b85){if(_0x1d3b85){_0x4f0363=_0x1d3b85;_0x1606c0[_0x1b18('0x3c')]=_[_0x1b18('0x3a')](db['SugarcrmField']['rawAttributes']);_0x1606c0[_0x1b18('0x39')]=_[_0x1b18('0x3a')](_0x4caee7[_0x1b18('0x39')]);_0x1606c0['filters']=_['intersection'](_0x1606c0[_0x1b18('0x3c')],_0x1606c0[_0x1b18('0x39')]);_0x4dd226[_0x1b18('0x3e')]=_[_0x1b18('0x3d')](_0x1606c0[_0x1b18('0x3c')],qs[_0x1b18('0x53')](_0x4caee7[_0x1b18('0x39')]['fields']));_0x4dd226[_0x1b18('0x3e')]=_0x4dd226['attributes'][_0x1b18('0x4e')]?_0x4dd226['attributes']:_0x1606c0[_0x1b18('0x3c')];_0x4dd226[_0x1b18('0x54')]=qs[_0x1b18('0x41')](_0x4caee7[_0x1b18('0x39')][_0x1b18('0x41')]);_0x4dd226['where']=qs[_0x1b18('0x3b')](_['pick'](_0x4caee7['query'],_0x1606c0[_0x1b18('0x3b')]));if(_0x4caee7[_0x1b18('0x39')]['filter']){_0x4dd226[_0x1b18('0x44')]=_['merge'](_0x4dd226['where'],{'$or':_[_0x1b18('0x33')](_0x4dd226[_0x1b18('0x3e')],function(_0x2c1ddd){var _0x3c90b6={};_0x3c90b6[_0x2c1ddd]={'$like':'%'+_0x4caee7[_0x1b18('0x39')][_0x1b18('0x43')]+'%'};return _0x3c90b6;})});}_0x4dd226=_[_0x1b18('0x45')]({},_0x4dd226,_0x4caee7[_0x1b18('0x47')]);return _0x4f0363[_0x1b18('0x56')](_0x4dd226);}})[_0x1b18('0x1a')](function(_0x46e7b8){if(_0x46e7b8){_0x3e8b54=_0x46e7b8[_0x1b18('0x4e')];if(!_0x4caee7[_0x1b18('0x39')][_0x1b18('0x3f')](_0x1b18('0x40'))){_0x4dd226[_0x1b18('0x29')]=qs['limit'](_0x4caee7[_0x1b18('0x39')][_0x1b18('0x29')]);_0x4dd226[_0x1b18('0x28')]=qs[_0x1b18('0x28')](_0x4caee7['query'][_0x1b18('0x28')]);}return _0x4f0363[_0x1b18('0x56')](_0x4dd226);}})[_0x1b18('0x1a')](function(_0x53508e){if(_0x53508e){return _0x53508e?{'count':_0x3e8b54,'rows':_0x53508e}:null;}})[_0x1b18('0x1a')](respondWithResult(_0x3c0202,null))['catch'](handleError(_0x3c0202,null));};exports[_0x1b18('0x57')]=function(_0x29a4a0,_0x178ed8,_0xea54e9){var _0x3a5ebf={};var _0x4ab693={};var _0x1a5bcc;var _0x750f86;return db[_0x1b18('0x34')]['findOne']({'where':{'id':_0x29a4a0[_0x1b18('0x4d')]['id']}})[_0x1b18('0x1a')](handleEntityNotFound(_0x178ed8,null))[_0x1b18('0x1a')](function(_0x3458c7){if(_0x3458c7){_0x1a5bcc=_0x3458c7;_0x4ab693['model']=_[_0x1b18('0x3a')](db['SugarcrmField'][_0x1b18('0x35')]);_0x4ab693['query']=_[_0x1b18('0x3a')](_0x29a4a0[_0x1b18('0x39')]);_0x4ab693[_0x1b18('0x3b')]=_[_0x1b18('0x3d')](_0x4ab693['model'],_0x4ab693[_0x1b18('0x39')]);_0x3a5ebf[_0x1b18('0x3e')]=_[_0x1b18('0x3d')](_0x4ab693[_0x1b18('0x3c')],qs[_0x1b18('0x53')](_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x53')]));_0x3a5ebf['attributes']=_0x3a5ebf[_0x1b18('0x3e')]['length']?_0x3a5ebf[_0x1b18('0x3e')]:_0x4ab693[_0x1b18('0x3c')];_0x3a5ebf[_0x1b18('0x54')]=qs[_0x1b18('0x41')](_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x41')]);_0x3a5ebf[_0x1b18('0x44')]=qs[_0x1b18('0x3b')](_[_0x1b18('0x42')](_0x29a4a0[_0x1b18('0x39')],_0x4ab693['filters']));if(_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x43')]){_0x3a5ebf['where']=_[_0x1b18('0x45')](_0x3a5ebf[_0x1b18('0x44')],{'$or':_[_0x1b18('0x33')](_0x3a5ebf[_0x1b18('0x3e')],function(_0x2bf77e){var _0x17c7cf={};_0x17c7cf[_0x2bf77e]={'$like':'%'+_0x29a4a0['query'][_0x1b18('0x43')]+'%'};return _0x17c7cf;})});}_0x3a5ebf=_[_0x1b18('0x45')]({},_0x3a5ebf,_0x29a4a0[_0x1b18('0x47')]);return _0x1a5bcc[_0x1b18('0x57')](_0x3a5ebf);}})[_0x1b18('0x1a')](function(_0x579cea){if(_0x579cea){_0x750f86=_0x579cea[_0x1b18('0x4e')];if(!_0x29a4a0[_0x1b18('0x39')][_0x1b18('0x3f')](_0x1b18('0x40'))){_0x3a5ebf['limit']=qs[_0x1b18('0x29')](_0x29a4a0[_0x1b18('0x39')]['limit']);_0x3a5ebf[_0x1b18('0x28')]=qs[_0x1b18('0x28')](_0x29a4a0['query'][_0x1b18('0x28')]);}return _0x1a5bcc['getDescriptions'](_0x3a5ebf);}})[_0x1b18('0x1a')](function(_0x551ac7){if(_0x551ac7){return _0x551ac7?{'count':_0x750f86,'rows':_0x551ac7}:null;}})[_0x1b18('0x1a')](respondWithResult(_0x178ed8,null))[_0x1b18('0x50')](handleError(_0x178ed8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index eb36db2..89339c1 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 _0xb9b9=['api','moment','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','../../config/logger'];(function(_0xf13641,_0x4342c1){var _0x3d9f3d=function(_0x1b1ef3){while(--_0x1b1ef3){_0xf13641['push'](_0xf13641['shift']());}};_0x3d9f3d(++_0x4342c1);}(_0xb9b9,0x147));var _0x9b9b=function(_0x590ec9,_0x318077){_0x590ec9=_0x590ec9-0x0;var _0x116142=_0xb9b9[_0x590ec9];return _0x116142;};'use strict';var _=require(_0x9b9b('0x0'));var util=require(_0x9b9b('0x1'));var logger=require(_0x9b9b('0x2'))(_0x9b9b('0x3'));var moment=require(_0x9b9b('0x4'));var BPromise=require('bluebird');var rp=require(_0x9b9b('0x5'));var fs=require('fs');var path=require(_0x9b9b('0x6'));var rimraf=require('rimraf');var config=require(_0x9b9b('0x7'));var attributes=require(_0x9b9b('0x8'));module[_0x9b9b('0x9')]=function(_0xcec761,_0x13ae43){return _0xcec761['define'](_0x9b9b('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffd2=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x3e0ffc,_0xac5165){var _0x16dde3=function(_0x11a859){while(--_0x11a859){_0x3e0ffc['push'](_0x3e0ffc['shift']());}};_0x16dde3(++_0xac5165);}(_0xffd2,0x68));var _0x2ffd=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xffd2[_0x2e53e1];return _0x3a23de;};'use strict';var _=require(_0x2ffd('0x0'));var util=require(_0x2ffd('0x1'));var logger=require(_0x2ffd('0x2'))(_0x2ffd('0x3'));var moment=require(_0x2ffd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2ffd('0x5'));var config=require(_0x2ffd('0x6'));var attributes=require(_0x2ffd('0x7'));module[_0x2ffd('0x8')]=function(_0x27b9c3,_0x1d6f2f){return _0x27b9c3[_0x2ffd('0x9')](_0x2ffd('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index daff18a..e31e544 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 _0xd0ae=['stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xd0ae,0x11b));var _0xed0a=function(_0xdc9b51,_0x303a4a){_0xdc9b51=_0xdc9b51-0x0;var _0x405b25=_0xd0ae[_0xdc9b51];return _0x405b25;};'use strict';var _=require(_0xed0a('0x0'));var util=require(_0xed0a('0x1'));var moment=require(_0xed0a('0x2'));var BPromise=require(_0xed0a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed0a('0x4'));var db=require(_0xed0a('0x5'))['db'];var utils=require(_0xed0a('0x6'));var logger=require('../../config/logger')(_0xed0a('0x7'));var config=require(_0xed0a('0x8'));var jayson=require(_0xed0a('0x9'));var client=jayson[_0xed0a('0xa')][_0xed0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4610f9,_0x4531aa,_0x2bd8af){return new BPromise(function(_0x3030ff,_0xc1266c){return client[_0xed0a('0xc')](_0x4610f9,_0x2bd8af)[_0xed0a('0xd')](function(_0x364c4b){logger[_0xed0a('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4531aa,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4531aa,_0xed0a('0xf'),JSON[_0xed0a('0x10')](_0x364c4b));if(_0x364c4b[_0xed0a('0x11')]){if(_0x364c4b[_0xed0a('0x11')][_0xed0a('0x12')]===0x1f4){logger[_0xed0a('0x11')](_0xed0a('0x13'),_0x4531aa,_0x364c4b[_0xed0a('0x11')][_0xed0a('0x14')]);return _0xc1266c(_0x364c4b[_0xed0a('0x11')][_0xed0a('0x14')]);}logger[_0xed0a('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4531aa,_0x364c4b[_0xed0a('0x11')]['message']);return _0x3030ff(_0x364c4b[_0xed0a('0x11')][_0xed0a('0x14')]);}else{logger[_0xed0a('0xe')](_0xed0a('0x13'),_0x4531aa,_0xed0a('0xf'));_0x3030ff(_0x364c4b[_0xed0a('0x15')][_0xed0a('0x14')]);}})[_0xed0a('0x16')](function(_0x4354df){logger[_0xed0a('0x11')](_0xed0a('0x13'),_0x4531aa,_0x4354df);_0xc1266c(_0x4354df);});});} \ No newline at end of file +var _0xf58e=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xf58e,0xea));var _0xef58=function(_0x512953,_0xc51958){_0x512953=_0x512953-0x0;var _0x3f06e8=_0xf58e[_0x512953];return _0x3f06e8;};'use strict';var _=require(_0xef58('0x0'));var util=require(_0xef58('0x1'));var moment=require(_0xef58('0x2'));var BPromise=require('bluebird');var rs=require(_0xef58('0x3'));var fs=require('fs');var Redis=require(_0xef58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef58('0x5'));var logger=require('../../config/logger')(_0xef58('0x6'));var config=require('../../config/environment');var jayson=require(_0xef58('0x7'));var client=jayson[_0xef58('0x8')][_0xef58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x517f2c,_0x5e5a8b,_0x7d78cf){return new BPromise(function(_0x580dbd,_0x2fc2a5){return client[_0xef58('0xa')](_0x517f2c,_0x7d78cf)[_0xef58('0xb')](function(_0x191c80){logger[_0xef58('0xc')](_0xef58('0xd'),_0x5e5a8b,_0xef58('0xe'));logger['debug'](_0xef58('0xf'),_0x5e5a8b,_0xef58('0xe'),JSON[_0xef58('0x10')](_0x191c80));if(_0x191c80[_0xef58('0x11')]){if(_0x191c80[_0xef58('0x11')]['code']===0x1f4){logger[_0xef58('0x11')](_0xef58('0xd'),_0x5e5a8b,_0x191c80[_0xef58('0x11')]['message']);return _0x2fc2a5(_0x191c80[_0xef58('0x11')]['message']);}logger[_0xef58('0x11')](_0xef58('0xd'),_0x5e5a8b,_0x191c80['error'][_0xef58('0x12')]);return _0x580dbd(_0x191c80[_0xef58('0x11')][_0xef58('0x12')]);}else{logger['info'](_0xef58('0xd'),_0x5e5a8b,_0xef58('0xe'));_0x580dbd(_0x191c80['result'][_0xef58('0x12')]);}})['catch'](function(_0x13066e){logger[_0xef58('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5e5a8b,_0x13066e);_0x2fc2a5(_0x13066e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 53e4d14..5cc9b01 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 _0x2eab=['delete','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','index','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x2eab,0xa2));var _0xb2ea=function(_0x23e6a0,_0x498803){_0x23e6a0=_0x23e6a0-0x0;var _0x433cd8=_0x2eab[_0x23e6a0];return _0x433cd8;};'use strict';var multer=require(_0xb2ea('0x0'));var util=require(_0xb2ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2ea('0x2'));var router=express[_0xb2ea('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb2ea('0x4'));var config=require(_0xb2ea('0x5'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb2ea('0x6')]);router['get']('/:id',auth[_0xb2ea('0x7')](),controller[_0xb2ea('0x8')]);router[_0xb2ea('0x9')]('/',auth[_0xb2ea('0x7')](),controller[_0xb2ea('0xa')]);router[_0xb2ea('0xb')](_0xb2ea('0xc'),auth[_0xb2ea('0x7')](),controller[_0xb2ea('0xd')]);router[_0xb2ea('0xe')]('/:id',auth[_0xb2ea('0x7')](),controller['destroy']);module[_0xb2ea('0xf')]=router; \ No newline at end of file +var _0x1907=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','create','put','delete','destroy'];(function(_0x118dab,_0x3413c9){var _0x4e30ba=function(_0x2c00f3){while(--_0x2c00f3){_0x118dab['push'](_0x118dab['shift']());}};_0x4e30ba(++_0x3413c9);}(_0x1907,0x1aa));var _0x7190=function(_0x428942,_0xab65b4){_0x428942=_0x428942-0x0;var _0x447c2d=_0x1907[_0x428942];return _0x447c2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7190('0x0'));var timeout=require(_0x7190('0x1'));var express=require(_0x7190('0x2'));var router=express[_0x7190('0x3')]();var auth=require(_0x7190('0x4'));var interaction=require(_0x7190('0x5'));var config=require(_0x7190('0x6'));var controller=require(_0x7190('0x7'));router[_0x7190('0x8')]('/',auth['isAuthenticated'](),controller[_0x7190('0x9')]);router['get'](_0x7190('0xa'),auth[_0x7190('0xb')](),controller['show']);router['post']('/',auth[_0x7190('0xb')](),controller[_0x7190('0xc')]);router[_0x7190('0xd')](_0x7190('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7190('0xe')](_0x7190('0xa'),auth['isAuthenticated'](),controller[_0x7190('0xf')]);module[_0x7190('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 32032fb..d7e190a 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 _0xe4a5=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x485f02,_0x17bce1){var _0x1df3af=function(_0x443d3a){while(--_0x443d3a){_0x485f02['push'](_0x485f02['shift']());}};_0x1df3af(++_0x17bce1);}(_0xe4a5,0xea));var _0x5e4a=function(_0x2afa0a,_0x4b273c){_0x2afa0a=_0x2afa0a-0x0;var _0x206201=_0xe4a5[_0x2afa0a];return _0x206201;};'use strict';var Sequelize=require(_0x5e4a('0x0'));module[_0x5e4a('0x1')]={'type':{'type':Sequelize[_0x5e4a('0x2')](_0x5e4a('0x3'),_0x5e4a('0x4'),_0x5e4a('0x5'),'keyValue'),'defaultValue':_0x5e4a('0x3')},'content':{'type':Sequelize[_0x5e4a('0x6')]},'key':{'type':Sequelize[_0x5e4a('0x6')]},'keyType':{'type':Sequelize[_0x5e4a('0x2')](_0x5e4a('0x3'),_0x5e4a('0x4'),_0x5e4a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5e4a('0x6')]},'nameField':{'type':Sequelize[_0x5e4a('0x6')]},'customField':{'type':Sequelize[_0x5e4a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5da1=['variable','customVariable','STRING','ENUM','BOOLEAN','string'];(function(_0x39004e,_0x57831d){var _0x266b61=function(_0x55bc74){while(--_0x55bc74){_0x39004e['push'](_0x39004e['shift']());}};_0x266b61(++_0x57831d);}(_0x5da1,0xbf));var _0x15da=function(_0x479e9c,_0x136802){_0x479e9c=_0x479e9c-0x0;var _0x5c3f1c=_0x5da1[_0x479e9c];return _0x5c3f1c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x15da('0x0'),_0x15da('0x1'),_0x15da('0x2'),'keyValue'),'defaultValue':_0x15da('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x15da('0x3')]},'keyType':{'type':Sequelize[_0x15da('0x4')]('string',_0x15da('0x1'),_0x15da('0x2'))},'keyContent':{'type':Sequelize[_0x15da('0x3')]},'idField':{'type':Sequelize[_0x15da('0x3')]},'nameField':{'type':Sequelize[_0x15da('0x3')]},'customField':{'type':Sequelize[_0x15da('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15da('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 445d28a..94ca97d 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 _0x1db9=['nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','rawAttributes','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','SugarcrmField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x1edd90,_0x39303b){var _0x49deca=function(_0x11008d){while(--_0x11008d){_0x1edd90['push'](_0x1edd90['shift']());}};_0x49deca(++_0x39303b);}(_0x1db9,0x176));var _0x91db=function(_0x5831ee,_0x45dcb1){_0x5831ee=_0x5831ee-0x0;var _0x350b12=_0x1db9[_0x5831ee];return _0x350b12;};'use strict';var pdf=require(_0x91db('0x0'));var emlformat=require(_0x91db('0x1'));var rimraf=require(_0x91db('0x2'));var zipdir=require(_0x91db('0x3'));var jsonpatch=require(_0x91db('0x4'));var rp=require(_0x91db('0x5'));var moment=require('moment');var BPromise=require(_0x91db('0x6'));var Mustache=require(_0x91db('0x7'));var util=require('util');var path=require('path');var sox=require(_0x91db('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=_0x260b56[_0x91db('0x19')],_0x675bd=_0x33b39d['offset'],_0x26d10c=_0x33b39d[_0x91db('0x1a')]+_0x33b39d[_0x91db('0x1b')],_0x1e9679;if(_0x26d10c>=_0x143bc4){_0x26d10c=_0x143bc4;_0x1e9679=0xc8;}else{_0x1e9679=0xce;}_0x2df307[_0x91db('0x16')](_0x1e9679);return _0x2df307[_0x91db('0x1c')](_0x91db('0x1d'),_0x675bd+'-'+_0x26d10c+'/'+_0x143bc4)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x5c15ef){return function(_0x4ae820){try{jsonpatch[_0x91db('0x1e')](_0x4ae820,_0x5c15ef,!![]);}catch(_0x137edf){return BPromise[_0x91db('0x1f')](_0x137edf);}return _0x4ae820[_0x91db('0x20')]();};}function saveUpdates(_0x50cf9c,_0x168dea){return function(_0x324de7){if(_0x324de7){return _0x324de7[_0x91db('0x21')](_0x50cf9c)[_0x91db('0x22')](function(_0x25593c){return _0x25593c;});}return null;};}function removeEntity(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x23')]()[_0x91db('0x22')](function(){_0x31b96c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x134caa,_0x2ac8d5){return function(_0x50687e){if(!_0x50687e){_0x134caa[_0x91db('0x15')](0x194);}return _0x50687e;};}function handleError(_0x16efa4,_0x39ae31){_0x39ae31=_0x39ae31||0x1f4;return function(_0x6e3a9c){logger[_0x91db('0x24')](_0x6e3a9c['stack']);if(_0x6e3a9c['name']){delete _0x6e3a9c[_0x91db('0x25')];}_0x16efa4[_0x91db('0x16')](_0x39ae31)[_0x91db('0x26')](_0x6e3a9c);};}exports['index']=function(_0x3b38f2,_0x3c31ea){var _0x46c0e8={},_0x1bb4f8={},_0x512c79={'count':0x0,'rows':[]};var _0x1a64f0=_[_0x91db('0x27')](db[_0x91db('0x28')]['rawAttributes'],function(_0x2ff6c8){return{'name':_0x2ff6c8[_0x91db('0x29')],'type':_0x2ff6c8[_0x91db('0x2a')][_0x91db('0x2b')]};});_0x1bb4f8[_0x91db('0x2c')]=_[_0x91db('0x27')](_0x1a64f0,_0x91db('0x25'));_0x1bb4f8[_0x91db('0x2d')]=_[_0x91db('0x2e')](_0x3b38f2[_0x91db('0x2d')]);_0x1bb4f8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x1bb4f8[_0x91db('0x2c')],_0x1bb4f8[_0x91db('0x2d')]);_0x46c0e8['attributes']=_[_0x91db('0x30')](_0x1bb4f8[_0x91db('0x2c')],qs[_0x91db('0x31')](_0x3b38f2[_0x91db('0x2d')][_0x91db('0x31')]));_0x46c0e8['attributes']=_0x46c0e8[_0x91db('0x32')][_0x91db('0x33')]?_0x46c0e8[_0x91db('0x32')]:_0x1bb4f8['model'];if(!_0x3b38f2[_0x91db('0x2d')]['hasOwnProperty'](_0x91db('0x34'))){_0x46c0e8[_0x91db('0x1b')]=qs[_0x91db('0x1b')](_0x3b38f2[_0x91db('0x2d')]['limit']);_0x46c0e8[_0x91db('0x1a')]=qs[_0x91db('0x1a')](_0x3b38f2[_0x91db('0x2d')]['offset']);}_0x46c0e8[_0x91db('0x35')]=qs[_0x91db('0x36')](_0x3b38f2['query'][_0x91db('0x36')]);_0x46c0e8[_0x91db('0x37')]=qs['filters'](_[_0x91db('0x38')](_0x3b38f2['query'],_0x1bb4f8[_0x91db('0x2f')]),_0x1a64f0);if(_0x3b38f2[_0x91db('0x2d')]['filter']){_0x46c0e8['where']=_['merge'](_0x46c0e8[_0x91db('0x37')],{'$or':_[_0x91db('0x27')](_0x1a64f0,function(_0x5ce345){if(_0x5ce345[_0x91db('0x2a')]!==_0x91db('0x39')){var _0x1a0703={};_0x1a0703[_0x5ce345[_0x91db('0x25')]]={'$like':'%'+_0x3b38f2[_0x91db('0x2d')][_0x91db('0x3a')]+'%'};return _0x1a0703;}})});}_0x46c0e8=_[_0x91db('0x3b')]({},_0x46c0e8,_0x3b38f2[_0x91db('0x3c')]);var _0xcdc472={'where':_0x46c0e8[_0x91db('0x37')]};return db[_0x91db('0x28')]['count'](_0xcdc472)[_0x91db('0x22')](function(_0x50c414){_0x512c79[_0x91db('0x19')]=_0x50c414;if(_0x3b38f2[_0x91db('0x2d')]['includeAll']){_0x46c0e8[_0x91db('0x3d')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3e')](_0x46c0e8);})[_0x91db('0x22')](function(_0x18cab8){_0x512c79['rows']=_0x18cab8;return _0x512c79;})[_0x91db('0x22')](respondWithFilteredResult(_0x3c31ea,_0x46c0e8))[_0x91db('0x3f')](handleError(_0x3c31ea,null));};exports[_0x91db('0x40')]=function(_0x55188b,_0x4733a4){var _0xed543c={'raw':!![],'where':{'id':_0x55188b['params']['id']}},_0x3aaf2e={};_0x3aaf2e[_0x91db('0x2c')]=_[_0x91db('0x2e')](db[_0x91db('0x28')][_0x91db('0x41')]);_0x3aaf2e[_0x91db('0x2d')]=_['keys'](_0x55188b[_0x91db('0x2d')]);_0x3aaf2e['filters']=_[_0x91db('0x30')](_0x3aaf2e[_0x91db('0x2c')],_0x3aaf2e[_0x91db('0x2d')]);_0xed543c[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3aaf2e[_0x91db('0x2c')],qs[_0x91db('0x31')](_0x55188b[_0x91db('0x2d')][_0x91db('0x31')]));_0xed543c[_0x91db('0x32')]=_0xed543c[_0x91db('0x32')]['length']?_0xed543c['attributes']:_0x3aaf2e[_0x91db('0x2c')];if(_0x55188b[_0x91db('0x2d')][_0x91db('0x42')]){_0xed543c['include']=[{'all':!![]}];}_0xed543c=_[_0x91db('0x3b')]({},_0xed543c,_0x55188b[_0x91db('0x3c')]);return db[_0x91db('0x28')][_0x91db('0x43')](_0xed543c)[_0x91db('0x22')](handleEntityNotFound(_0x4733a4,null))['then'](respondWithResult(_0x4733a4,null))[_0x91db('0x3f')](handleError(_0x4733a4,null));};exports['create']=function(_0x7c4981,_0x28211b){return db[_0x91db('0x28')][_0x91db('0x44')](_0x7c4981[_0x91db('0x45')],{})[_0x91db('0x22')](respondWithResult(_0x28211b,0xc9))[_0x91db('0x3f')](handleError(_0x28211b,null));};exports[_0x91db('0x21')]=function(_0x1a0009,_0x4fb60e){if(_0x1a0009['body']['id']){delete _0x1a0009[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x43')]({'where':{'id':_0x1a0009[_0x91db('0x46')]['id']}})[_0x91db('0x22')](handleEntityNotFound(_0x4fb60e,null))['then'](saveUpdates(_0x1a0009[_0x91db('0x45')],null))[_0x91db('0x22')](respondWithResult(_0x4fb60e,null))[_0x91db('0x3f')](handleError(_0x4fb60e,null));};exports[_0x91db('0x23')]=function(_0x404900,_0x51a75b){return db[_0x91db('0x28')][_0x91db('0x43')]({'where':{'id':_0x404900[_0x91db('0x46')]['id']}})[_0x91db('0x22')](handleEntityNotFound(_0x51a75b,null))[_0x91db('0x22')](removeEntity(_0x51a75b,null))[_0x91db('0x3f')](handleError(_0x51a75b,null));}; \ No newline at end of file +var _0x25fa=['sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','name','index','SugarcrmField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x1fbde3,_0x59da39){var _0x2b092f=function(_0x18bd24){while(--_0x18bd24){_0x1fbde3['push'](_0x1fbde3['shift']());}};_0x2b092f(++_0x59da39);}(_0x25fa,0x109));var _0xa25f=function(_0x56dd26,_0x8e37a4){_0x56dd26=_0x56dd26-0x0;var _0x5d77f4=_0x25fa[_0x56dd26];return _0x5d77f4;};'use strict';var pdf=require(_0xa25f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa25f('0x1'));var zipdir=require(_0xa25f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa25f('0x3'));var moment=require(_0xa25f('0x4'));var BPromise=require(_0xa25f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa25f('0x6'));var sox=require('sox');var csv=require(_0xa25f('0x7'));var ejs=require(_0xa25f('0x8'));var fs=require('fs');var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0x7'));var querystring=require(_0xa25f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa25f('0xf'));var authService=require(_0xa25f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x11'));var hardwareService=require(_0xa25f('0x12'));var logger=require(_0xa25f('0x13'))(_0xa25f('0x14'));var utils=require('../../config/utils');var config=require(_0xa25f('0x15'));var licenseUtil=require(_0xa25f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x17')](_0x465e41);}return _0x3e970c[_0xa25f('0x18')](_0x465e41)[_0xa25f('0x19')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x18')](_0x199e18)[_0xa25f('0x1a')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=_0x1e5836[_0xa25f('0x1b')],_0x57ada6=_0x2d2417[_0xa25f('0x1c')],_0x2d4f0f=_0x2d2417[_0xa25f('0x1c')]+_0x2d2417[_0xa25f('0x1d')],_0x471679;if(_0x2d4f0f>=_0x1859ba){_0x2d4f0f=_0x1859ba;_0x471679=0xc8;}else{_0x471679=0xce;}_0x465809['status'](_0x471679);return _0x465809[_0xa25f('0x1e')]('Content-Range',_0x57ada6+'-'+_0x2d4f0f+'/'+_0x1859ba)[_0xa25f('0x1a')](_0x1e5836);}return null;};}function patchUpdates(_0x562573){return function(_0x559c89){try{jsonpatch[_0xa25f('0x1f')](_0x559c89,_0x562573,!![]);}catch(_0x489c83){return BPromise[_0xa25f('0x20')](_0x489c83);}return _0x559c89[_0xa25f('0x21')]();};}function saveUpdates(_0x2aaf3a,_0x3c2665){return function(_0x21d035){if(_0x21d035){return _0x21d035['update'](_0x2aaf3a)[_0xa25f('0x22')](function(_0x3c1e3b){return _0x3c1e3b;});}return null;};}function removeEntity(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x23')]()[_0xa25f('0x22')](function(){_0x371716[_0xa25f('0x18')](0xcc)[_0xa25f('0x19')]();});}};}function handleEntityNotFound(_0x4c6f4d,_0x2b710f){return function(_0x906388){if(!_0x906388){_0x4c6f4d[_0xa25f('0x17')](0x194);}return _0x906388;};}function handleError(_0x317f0c,_0x5d93a9){_0x5d93a9=_0x5d93a9||0x1f4;return function(_0x2812d7){logger[_0xa25f('0x24')](_0x2812d7['stack']);if(_0x2812d7[_0xa25f('0x25')]){delete _0x2812d7['name'];}_0x317f0c[_0xa25f('0x18')](_0x5d93a9)['send'](_0x2812d7);};}exports[_0xa25f('0x26')]=function(_0x2448f4,_0x493de0){var _0xf6c928={},_0x1412b6={},_0x54d98c={'count':0x0,'rows':[]};var _0x471e7c=_['map'](db[_0xa25f('0x27')][_0xa25f('0x28')],function(_0x472114){return{'name':_0x472114[_0xa25f('0x29')],'type':_0x472114[_0xa25f('0x2a')]['key']};});_0x1412b6[_0xa25f('0x2b')]=_[_0xa25f('0x2c')](_0x471e7c,_0xa25f('0x25'));_0x1412b6[_0xa25f('0x2d')]=_[_0xa25f('0x2e')](_0x2448f4['query']);_0x1412b6[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x1412b6[_0xa25f('0x2b')],_0x1412b6[_0xa25f('0x2d')]);_0xf6c928[_0xa25f('0x31')]=_[_0xa25f('0x30')](_0x1412b6[_0xa25f('0x2b')],qs[_0xa25f('0x32')](_0x2448f4[_0xa25f('0x2d')]['fields']));_0xf6c928['attributes']=_0xf6c928['attributes'][_0xa25f('0x33')]?_0xf6c928[_0xa25f('0x31')]:_0x1412b6[_0xa25f('0x2b')];if(!_0x2448f4[_0xa25f('0x2d')][_0xa25f('0x34')](_0xa25f('0x35'))){_0xf6c928[_0xa25f('0x1d')]=qs[_0xa25f('0x1d')](_0x2448f4[_0xa25f('0x2d')][_0xa25f('0x1d')]);_0xf6c928[_0xa25f('0x1c')]=qs['offset'](_0x2448f4['query'][_0xa25f('0x1c')]);}_0xf6c928[_0xa25f('0x36')]=qs[_0xa25f('0x37')](_0x2448f4['query']['sort']);_0xf6c928['where']=qs[_0xa25f('0x2f')](_[_0xa25f('0x38')](_0x2448f4[_0xa25f('0x2d')],_0x1412b6['filters']),_0x471e7c);if(_0x2448f4['query'][_0xa25f('0x39')]){_0xf6c928[_0xa25f('0x3a')]=_['merge'](_0xf6c928['where'],{'$or':_[_0xa25f('0x2c')](_0x471e7c,function(_0x33ad7a){if(_0x33ad7a[_0xa25f('0x2a')]!=='VIRTUAL'){var _0x151c4b={};_0x151c4b[_0x33ad7a[_0xa25f('0x25')]]={'$like':'%'+_0x2448f4[_0xa25f('0x2d')]['filter']+'%'};return _0x151c4b;}})});}_0xf6c928=_['merge']({},_0xf6c928,_0x2448f4[_0xa25f('0x3b')]);var _0x44c9c8={'where':_0xf6c928[_0xa25f('0x3a')]};return db[_0xa25f('0x27')][_0xa25f('0x1b')](_0x44c9c8)[_0xa25f('0x22')](function(_0x276fa6){_0x54d98c[_0xa25f('0x1b')]=_0x276fa6;if(_0x2448f4['query'][_0xa25f('0x3c')]){_0xf6c928[_0xa25f('0x3d')]=[{'all':!![]}];}return db[_0xa25f('0x27')][_0xa25f('0x3e')](_0xf6c928);})[_0xa25f('0x22')](function(_0xd285eb){_0x54d98c[_0xa25f('0x3f')]=_0xd285eb;return _0x54d98c;})[_0xa25f('0x22')](respondWithFilteredResult(_0x493de0,_0xf6c928))[_0xa25f('0x40')](handleError(_0x493de0,null));};exports[_0xa25f('0x41')]=function(_0xd91854,_0x3267a0){var _0x82ddbf={'raw':!![],'where':{'id':_0xd91854[_0xa25f('0x42')]['id']}},_0x593cee={};_0x593cee['model']=_[_0xa25f('0x2e')](db[_0xa25f('0x27')][_0xa25f('0x28')]);_0x593cee['query']=_[_0xa25f('0x2e')](_0xd91854[_0xa25f('0x2d')]);_0x593cee[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x593cee['model'],_0x593cee[_0xa25f('0x2d')]);_0x82ddbf[_0xa25f('0x31')]=_[_0xa25f('0x30')](_0x593cee[_0xa25f('0x2b')],qs[_0xa25f('0x32')](_0xd91854[_0xa25f('0x2d')]['fields']));_0x82ddbf[_0xa25f('0x31')]=_0x82ddbf[_0xa25f('0x31')]['length']?_0x82ddbf[_0xa25f('0x31')]:_0x593cee[_0xa25f('0x2b')];if(_0xd91854[_0xa25f('0x2d')][_0xa25f('0x3c')]){_0x82ddbf[_0xa25f('0x3d')]=[{'all':!![]}];}_0x82ddbf=_[_0xa25f('0x43')]({},_0x82ddbf,_0xd91854[_0xa25f('0x3b')]);return db[_0xa25f('0x27')][_0xa25f('0x44')](_0x82ddbf)[_0xa25f('0x22')](handleEntityNotFound(_0x3267a0,null))[_0xa25f('0x22')](respondWithResult(_0x3267a0,null))[_0xa25f('0x40')](handleError(_0x3267a0,null));};exports[_0xa25f('0x45')]=function(_0x53a92a,_0x356a95){return db[_0xa25f('0x27')][_0xa25f('0x45')](_0x53a92a[_0xa25f('0x46')],{})['then'](respondWithResult(_0x356a95,0xc9))[_0xa25f('0x40')](handleError(_0x356a95,null));};exports[_0xa25f('0x47')]=function(_0x93cee1,_0x59e964){if(_0x93cee1[_0xa25f('0x46')]['id']){delete _0x93cee1[_0xa25f('0x46')]['id'];}return db[_0xa25f('0x27')][_0xa25f('0x44')]({'where':{'id':_0x93cee1[_0xa25f('0x42')]['id']}})[_0xa25f('0x22')](handleEntityNotFound(_0x59e964,null))[_0xa25f('0x22')](saveUpdates(_0x93cee1[_0xa25f('0x46')],null))['then'](respondWithResult(_0x59e964,null))[_0xa25f('0x40')](handleError(_0x59e964,null));};exports[_0xa25f('0x23')]=function(_0x3245e3,_0x16ae1c){return db[_0xa25f('0x27')][_0xa25f('0x44')]({'where':{'id':_0x3245e3[_0xa25f('0x42')]['id']}})[_0xa25f('0x22')](handleEntityNotFound(_0x16ae1c,null))[_0xa25f('0x22')](removeEntity(_0x16ae1c,null))[_0xa25f('0x40')](handleError(_0x16ae1c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e217d0f..a97c8d3 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 _0xc25b=['api','moment','bluebird','rimraf','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x411a2f,_0x3bac15){var _0x265a3f=function(_0x9a6189){while(--_0x9a6189){_0x411a2f['push'](_0x411a2f['shift']());}};_0x265a3f(++_0x3bac15);}(_0xc25b,0x82));var _0xbc25=function(_0x2bed52,_0x54edc2){_0x2bed52=_0x2bed52-0x0;var _0x4f36fa=_0xc25b[_0x2bed52];return _0x4f36fa;};'use strict';var _=require('lodash');var util=require(_0xbc25('0x0'));var logger=require(_0xbc25('0x1'))(_0xbc25('0x2'));var moment=require(_0xbc25('0x3'));var BPromise=require(_0xbc25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc25('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0xbc25('0x6')]=function(_0x53b48c,_0x1c7c1e){return _0x53b48c['define'](_0xbc25('0x7'),attributes,{'tableName':_0xbc25('0x8'),'paranoid':![],'indexes':[{'name':_0xbc25('0x9'),'fields':[_0xbc25('0xa'),_0xbc25('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf3d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','idField','lodash','../../config/logger'];(function(_0x1be7f7,_0x8cc363){var _0x573179=function(_0x1e8044){while(--_0x1e8044){_0x1be7f7['push'](_0x1be7f7['shift']());}};_0x573179(++_0x8cc363);}(_0xbf3d,0xd6));var _0xdbf3=function(_0x1736e8,_0x386016){_0x1736e8=_0x1736e8-0x0;var _0x5d37ad=_0xbf3d[_0x1736e8];return _0x5d37ad;};'use strict';var _=require(_0xdbf3('0x0'));var util=require('util');var logger=require(_0xdbf3('0x1'))(_0xdbf3('0x2'));var moment=require(_0xdbf3('0x3'));var BPromise=require(_0xdbf3('0x4'));var rp=require(_0xdbf3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbf3('0x6'));var config=require(_0xdbf3('0x7'));var attributes=require(_0xdbf3('0x8'));module[_0xdbf3('0x9')]=function(_0x558af6,_0x32e328){return _0x558af6['define'](_0xdbf3('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xdbf3('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 06dc696..5a170f6 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x351e0b,_0x3ac77a){var _0x144b90=function(_0xc3072){while(--_0xc3072){_0x351e0b['push'](_0x351e0b['shift']());}};_0x144b90(++_0x3ac77a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0xb10b[_0x3ff685];return _0x2046c9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x8c87a9,_0x448198){var _0x592e51=function(_0x4235fa){while(--_0x4235fa){_0x8c87a9['push'](_0x8c87a9['shift']());}};_0x592e51(++_0x448198);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 78d972f..4984a92 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 _0x6381=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6381,0x16b));var _0x1638=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6381[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1638('0x0'));var util=require(_0x1638('0x1'));var path=require('path');var timeout=require(_0x1638('0x2'));var express=require(_0x1638('0x3'));var router=express[_0x1638('0x4')]();var auth=require(_0x1638('0x5'));var interaction=require(_0x1638('0x6'));var config=require(_0x1638('0x7'));var controller=require(_0x1638('0x8'));router[_0x1638('0x9')]('/',auth[_0x1638('0xa')](),controller['index']);router[_0x1638('0x9')](_0x1638('0xb'),auth[_0x1638('0xa')](),controller[_0x1638('0xc')]);router[_0x1638('0x9')](_0x1638('0xd'),auth[_0x1638('0xa')](),controller[_0x1638('0xe')]);router[_0x1638('0x9')](_0x1638('0xf'),auth[_0x1638('0xa')](),controller['getFields']);router[_0x1638('0x10')]('/',auth[_0x1638('0xa')](),controller[_0x1638('0x11')]);router[_0x1638('0x10')](_0x1638('0xd'),auth[_0x1638('0xa')](),controller[_0x1638('0x12')]);router[_0x1638('0x13')](_0x1638('0xb'),auth['isAuthenticated'](),controller[_0x1638('0x14')]);router[_0x1638('0x15')](_0x1638('0xb'),auth[_0x1638('0xa')](),controller[_0x1638('0x16')]);module[_0x1638('0x17')]=router; \ No newline at end of file +var _0xc3c5=['delete','exports','multer','util','path','express','Router','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x3e2c08,_0x5265ca){var _0x37e838=function(_0xb322ea){while(--_0xb322ea){_0x3e2c08['push'](_0x3e2c08['shift']());}};_0x37e838(++_0x5265ca);}(_0xc3c5,0x189));var _0x5c3c=function(_0x341980,_0x41ff49){_0x341980=_0x341980-0x0;var _0x568d59=_0xc3c5[_0x341980];return _0x568d59;};'use strict';var multer=require(_0x5c3c('0x0'));var util=require(_0x5c3c('0x1'));var path=require(_0x5c3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c3c('0x3'));var router=express[_0x5c3c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c3c('0x5'));var controller=require(_0x5c3c('0x6'));router[_0x5c3c('0x7')]('/',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x9')]);router['get']('/:id',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0xa')]);router[_0x5c3c('0x7')](_0x5c3c('0xb'),auth[_0x5c3c('0x8')](),controller[_0x5c3c('0xc')]);router[_0x5c3c('0x7')](_0x5c3c('0xd'),auth[_0x5c3c('0x8')](),controller[_0x5c3c('0xe')]);router[_0x5c3c('0xf')]('/',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x10')]);router[_0x5c3c('0xf')]('/:id/configurations',auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x11')]);router[_0x5c3c('0x12')](_0x5c3c('0x13'),auth[_0x5c3c('0x8')](),controller[_0x5c3c('0x14')]);router[_0x5c3c('0x15')](_0x5c3c('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x5c3c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 548df07..02cba68 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 _0x2645=['STRING','HelpDesk','sequelize','exports'];(function(_0x363c24,_0x239a13){var _0x291a1e=function(_0x16e25f){while(--_0x16e25f){_0x363c24['push'](_0x363c24['shift']());}};_0x291a1e(++_0x239a13);}(_0x2645,0x6e));var _0x5264=function(_0x5e3fc2,_0x38cacf){_0x5e3fc2=_0x5e3fc2-0x0;var _0x7b79b=_0x2645[_0x5e3fc2];return _0x7b79b;};'use strict';var Sequelize=require(_0x5264('0x0'));module[_0x5264('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5264('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5264('0x2')],'allowNull':![],'defaultValue':_0x5264('0x3')},'remoteUri':{'type':Sequelize[_0x5264('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5264('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6657=['STRING','sequelize'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6657,0x17f));var _0x7665=function(_0x4c76ad,_0x24bdab){_0x4c76ad=_0x4c76ad-0x0;var _0xde0a18=_0x6657[_0x4c76ad];return _0xde0a18;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7665('0x1')]},'username':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7665('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7665('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index df1d390..03f57d3 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 _0x88e8=['where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','update','destroy','getConfigurations','VtigerConfiguration','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','findOne','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','autogenerated','reference','owner','includes','remove','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','map','VtigerAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','pick','filter'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x88e8,0xc8));var _0x888e=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0x88e8[_0x546c68];return _0x4a2389;};'use strict';var pdf=require(_0x888e('0x0'));var emlformat=require(_0x888e('0x1'));var rimraf=require(_0x888e('0x2'));var zipdir=require(_0x888e('0x3'));var jsonpatch=require(_0x888e('0x4'));var rp=require(_0x888e('0x5'));var moment=require(_0x888e('0x6'));var BPromise=require(_0x888e('0x7'));var Mustache=require(_0x888e('0x8'));var util=require(_0x888e('0x9'));var path=require(_0x888e('0xa'));var sox=require(_0x888e('0xb'));var csv=require(_0x888e('0xc'));var ejs=require(_0x888e('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x888e('0xe'));var crypto=require(_0x888e('0xf'));var jsforce=require(_0x888e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x888e('0x11'));var Papa=require('papaparse');var Redis=require(_0x888e('0x12'));var authService=require(_0x888e('0x13'));var qs=require(_0x888e('0x14'));var as=require(_0x888e('0x15'));var hardwareService=require(_0x888e('0x16'));var logger=require(_0x888e('0x17'))('api');var utils=require(_0x888e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x888e('0x19'));var db=require(_0x888e('0x1a'))['db'];var integrations=require(_0x888e('0x1b'));var jayson=require(_0x888e('0x1c'));var client=jayson[_0x888e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b94d,_0x11501b,_0x176c62,_0x5a3e90){return new BPromise(function(_0x5a6274,_0x5e80fc){var _0x551e82=_0x5a3e90||client;return _0x551e82[_0x888e('0x1e')](_0x14b94d,_0x176c62)[_0x888e('0x1f')](function(_0x20716e){logger['info'](_0x888e('0x20'),_0x11501b,_0x888e('0x21'));logger[_0x888e('0x22')](_0x888e('0x23'),_0x11501b,_0x888e('0x21'),JSON[_0x888e('0x24')](_0x20716e));if(_0x20716e[_0x888e('0x25')]){if(_0x20716e[_0x888e('0x25')]['code']===0x1f4){logger[_0x888e('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x11501b,_0x20716e[_0x888e('0x25')][_0x888e('0x26')]);return _0x5e80fc(_0x20716e[_0x888e('0x25')]['message']);}logger[_0x888e('0x25')](_0x888e('0x20'),_0x11501b,_0x20716e[_0x888e('0x25')][_0x888e('0x26')]);return _0x5a6274(_0x20716e['error']['message']);}else{logger[_0x888e('0x27')](_0x888e('0x20'),_0x11501b,_0x888e('0x21'));_0x5a6274(_0x20716e[_0x888e('0x28')][_0x888e('0x26')]);}})['catch'](function(_0x21e207){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x11501b,_0x21e207);_0x5e80fc(_0x21e207);});});}function respondWithStatusCode(_0x29e601,_0x3ab9d2){_0x3ab9d2=_0x3ab9d2||0xcc;return function(_0x1be16b){if(_0x1be16b){return _0x29e601[_0x888e('0x29')](_0x3ab9d2);}return _0x29e601['status'](_0x3ab9d2)[_0x888e('0x2a')]();};}function respondWithResult(_0x284740,_0x2b48e6){_0x2b48e6=_0x2b48e6||0xc8;return function(_0x5a1b03){if(_0x5a1b03){return _0x284740[_0x888e('0x2b')](_0x2b48e6)[_0x888e('0x2c')](_0x5a1b03);}};}function respondWithFilteredResult(_0x1e12fa,_0x4ec180){return function(_0x16b771){if(_0x16b771){var _0x4e0d57=_0x16b771[_0x888e('0x2d')],_0x33c633=_0x4ec180['offset'],_0x4bec46=_0x4ec180[_0x888e('0x2e')]+_0x4ec180[_0x888e('0x2f')],_0x56b146;if(_0x4bec46>=_0x4e0d57){_0x4bec46=_0x4e0d57;_0x56b146=0xc8;}else{_0x56b146=0xce;}_0x1e12fa[_0x888e('0x2b')](_0x56b146);return _0x1e12fa[_0x888e('0x30')](_0x888e('0x31'),_0x33c633+'-'+_0x4bec46+'/'+_0x4e0d57)[_0x888e('0x2c')](_0x16b771);}return null;};}function patchUpdates(_0x50d320){return function(_0xb5b401){try{jsonpatch[_0x888e('0x32')](_0xb5b401,_0x50d320,!![]);}catch(_0x3424c9){return BPromise[_0x888e('0x33')](_0x3424c9);}return _0xb5b401[_0x888e('0x34')]();};}function saveUpdates(_0x109b0e,_0x13f390){return function(_0xcf9cb5){if(_0xcf9cb5){return _0xcf9cb5['update'](_0x109b0e)['then'](function(_0x5e3419){return _0x5e3419;});}return null;};}function removeEntity(_0x3ad9da,_0x2e4fc1){return function(_0x57f997){if(_0x57f997){return _0x57f997['destroy']()[_0x888e('0x1f')](function(){_0x3ad9da[_0x888e('0x2b')](0xcc)[_0x888e('0x2a')]();});}};}function handleEntityNotFound(_0x48e519,_0x49fc6f){return function(_0x39877e){if(!_0x39877e){_0x48e519[_0x888e('0x29')](0x194);}return _0x39877e;};}function handleError(_0x32bf01,_0x3ce03c){_0x3ce03c=_0x3ce03c||0x1f4;return function(_0x198a23){logger[_0x888e('0x25')](_0x198a23[_0x888e('0x35')]);if(_0x198a23[_0x888e('0x36')]){delete _0x198a23[_0x888e('0x36')];}_0x32bf01[_0x888e('0x2b')](_0x3ce03c)['send'](_0x198a23);};}exports['index']=function(_0x5dbe7c,_0x5ade49){var _0xbd89ed={},_0x549e14={},_0x180aaf={'count':0x0,'rows':[]};var _0x380e5b=_[_0x888e('0x37')](db[_0x888e('0x38')]['rawAttributes'],function(_0x69e734){return{'name':_0x69e734[_0x888e('0x39')],'type':_0x69e734[_0x888e('0x3a')][_0x888e('0x3b')]};});_0x549e14[_0x888e('0x3c')]=_['map'](_0x380e5b,_0x888e('0x36'));_0x549e14[_0x888e('0x3d')]=_['keys'](_0x5dbe7c[_0x888e('0x3d')]);_0x549e14[_0x888e('0x3e')]=_[_0x888e('0x3f')](_0x549e14[_0x888e('0x3c')],_0x549e14['query']);_0xbd89ed[_0x888e('0x40')]=_[_0x888e('0x3f')](_0x549e14['model'],qs[_0x888e('0x41')](_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x41')]));_0xbd89ed[_0x888e('0x40')]=_0xbd89ed[_0x888e('0x40')]['length']?_0xbd89ed[_0x888e('0x40')]:_0x549e14[_0x888e('0x3c')];if(!_0x5dbe7c['query']['hasOwnProperty']('nolimit')){_0xbd89ed[_0x888e('0x2f')]=qs[_0x888e('0x2f')](_0x5dbe7c[_0x888e('0x3d')]['limit']);_0xbd89ed[_0x888e('0x2e')]=qs[_0x888e('0x2e')](_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x2e')]);}_0xbd89ed[_0x888e('0x42')]=qs[_0x888e('0x43')](_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x43')]);_0xbd89ed['where']=qs['filters'](_[_0x888e('0x44')](_0x5dbe7c['query'],_0x549e14[_0x888e('0x3e')]),_0x380e5b);if(_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x45')]){_0xbd89ed[_0x888e('0x46')]=_['merge'](_0xbd89ed['where'],{'$or':_['map'](_0x380e5b,function(_0x300e37){if(_0x300e37[_0x888e('0x3a')]!==_0x888e('0x47')){var _0x208f0d={};_0x208f0d[_0x300e37[_0x888e('0x36')]]={'$like':'%'+_0x5dbe7c[_0x888e('0x3d')]['filter']+'%'};return _0x208f0d;}})});}_0xbd89ed=_[_0x888e('0x48')]({},_0xbd89ed,_0x5dbe7c[_0x888e('0x49')]);var _0x2603a2={'where':_0xbd89ed[_0x888e('0x46')]};return db[_0x888e('0x38')][_0x888e('0x2d')](_0x2603a2)['then'](function(_0x3250c1){_0x180aaf['count']=_0x3250c1;if(_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x4a')]){_0xbd89ed[_0x888e('0x4b')]=[{'all':!![]}];}return db[_0x888e('0x38')]['findAll'](_0xbd89ed);})['then'](function(_0x454144){_0x180aaf[_0x888e('0x4c')]=_0x454144;return _0x180aaf;})[_0x888e('0x1f')](respondWithFilteredResult(_0x5ade49,_0xbd89ed))[_0x888e('0x4d')](handleError(_0x5ade49,null));};exports[_0x888e('0x4e')]=function(_0x1823c0,_0x230b82){var _0x2c9475={'raw':![],'where':{'id':_0x1823c0[_0x888e('0x4f')]['id']}},_0x30541e={};_0x30541e['model']=_[_0x888e('0x50')](db[_0x888e('0x38')][_0x888e('0x51')]);_0x30541e[_0x888e('0x3d')]=_[_0x888e('0x50')](_0x1823c0[_0x888e('0x3d')]);_0x30541e[_0x888e('0x3e')]=_[_0x888e('0x3f')](_0x30541e[_0x888e('0x3c')],_0x30541e[_0x888e('0x3d')]);_0x2c9475['attributes']=_[_0x888e('0x3f')](_0x30541e['model'],qs['fields'](_0x1823c0[_0x888e('0x3d')][_0x888e('0x41')]));_0x2c9475[_0x888e('0x40')]=_0x2c9475['attributes'][_0x888e('0x52')]?_0x2c9475['attributes']:_0x30541e[_0x888e('0x3c')];if(_0x1823c0[_0x888e('0x3d')][_0x888e('0x4a')]){_0x2c9475[_0x888e('0x4b')]=[{'all':!![]}];}_0x2c9475=_['merge']({},_0x2c9475,_0x1823c0[_0x888e('0x49')]);return db[_0x888e('0x38')][_0x888e('0x53')](_0x2c9475)['then'](handleEntityNotFound(_0x230b82,null))[_0x888e('0x1f')](respondWithResult(_0x230b82,null))[_0x888e('0x4d')](handleError(_0x230b82,null));};exports[_0x888e('0x54')]=function(_0xfff430,_0x1152d7){return db[_0x888e('0x38')][_0x888e('0x54')](_0xfff430[_0x888e('0x55')],{})[_0x888e('0x1f')](respondWithResult(_0x1152d7,0xc9))[_0x888e('0x4d')](handleError(_0x1152d7,null));};exports[_0x888e('0x56')]=function(_0x5be0b0,_0x3aea3f){if(_0x5be0b0[_0x888e('0x55')]['id']){delete _0x5be0b0['body']['id'];}return db[_0x888e('0x38')]['find']({'where':{'id':_0x5be0b0[_0x888e('0x4f')]['id']}})[_0x888e('0x1f')](handleEntityNotFound(_0x3aea3f,null))[_0x888e('0x1f')](saveUpdates(_0x5be0b0[_0x888e('0x55')],null))['then'](respondWithResult(_0x3aea3f,null))[_0x888e('0x4d')](handleError(_0x3aea3f,null));};exports[_0x888e('0x57')]=function(_0x46667e,_0x2b001d){return db[_0x888e('0x38')]['find']({'where':{'id':_0x46667e['params']['id']}})[_0x888e('0x1f')](handleEntityNotFound(_0x2b001d,null))[_0x888e('0x1f')](removeEntity(_0x2b001d,null))[_0x888e('0x4d')](handleError(_0x2b001d,null));};exports[_0x888e('0x58')]=function(_0x40166c,_0x1d27ad,_0x22fdf7){var _0x1cd385={};var _0x40f7ee={};var _0x34b66f;var _0x4a6a46;return db[_0x888e('0x38')]['findOne']({'where':{'id':_0x40166c[_0x888e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1d27ad,null))['then'](function(_0x2eaa59){if(_0x2eaa59){_0x34b66f=_0x2eaa59;_0x40f7ee[_0x888e('0x3c')]=_[_0x888e('0x50')](db[_0x888e('0x59')]['rawAttributes']);_0x40f7ee['query']=_[_0x888e('0x50')](_0x40166c[_0x888e('0x3d')]);_0x40f7ee[_0x888e('0x3e')]=_[_0x888e('0x3f')](_0x40f7ee[_0x888e('0x3c')],_0x40f7ee['query']);_0x1cd385[_0x888e('0x40')]=_['intersection'](_0x40f7ee[_0x888e('0x3c')],qs[_0x888e('0x41')](_0x40166c['query']['fields']));_0x1cd385[_0x888e('0x40')]=_0x1cd385['attributes'][_0x888e('0x52')]?_0x1cd385[_0x888e('0x40')]:_0x40f7ee[_0x888e('0x3c')];_0x1cd385[_0x888e('0x42')]=qs[_0x888e('0x43')](_0x40166c[_0x888e('0x3d')]['sort']);_0x1cd385['where']=qs['filters'](_[_0x888e('0x44')](_0x40166c[_0x888e('0x3d')],_0x40f7ee[_0x888e('0x3e')]));if(_0x40166c[_0x888e('0x3d')][_0x888e('0x45')]){_0x1cd385['where']=_[_0x888e('0x48')](_0x1cd385[_0x888e('0x46')],{'$or':_[_0x888e('0x37')](_0x1cd385[_0x888e('0x40')],function(_0x24cb5c){var _0x496a41={};_0x496a41[_0x24cb5c]={'$like':'%'+_0x40166c[_0x888e('0x3d')][_0x888e('0x45')]+'%'};return _0x496a41;})});}_0x1cd385=_[_0x888e('0x48')]({},_0x1cd385,_0x40166c['options']);return _0x34b66f[_0x888e('0x58')](_0x1cd385);}})[_0x888e('0x1f')](function(_0x2005d8){if(_0x2005d8){_0x4a6a46=_0x2005d8[_0x888e('0x52')];if(!_0x40166c['query'][_0x888e('0x5a')](_0x888e('0x5b'))){_0x1cd385[_0x888e('0x2f')]=qs[_0x888e('0x2f')](_0x40166c['query'][_0x888e('0x2f')]);_0x1cd385[_0x888e('0x2e')]=qs[_0x888e('0x2e')](_0x40166c[_0x888e('0x3d')]['offset']);}return _0x34b66f['getConfigurations'](_0x1cd385);}})[_0x888e('0x1f')](function(_0x27049e){if(_0x27049e){return _0x27049e?{'count':_0x4a6a46,'rows':_0x27049e}:null;}})['then'](respondWithResult(_0x1d27ad,null))['catch'](handleError(_0x1d27ad,null));};exports['addConfiguration']=function(_0x560fc8,_0x1f4e2d,_0x127520){if(_0x560fc8[_0x888e('0x55')]['id']){delete _0x560fc8['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x560fc8['params']['id']}})[_0x888e('0x1f')](handleEntityNotFound(_0x1f4e2d,null))['then'](function(_0x383171){if(_0x383171){_0x560fc8[_0x888e('0x55')][_0x888e('0x5c')]=_0x383171['id'];_0x560fc8[_0x888e('0x55')][_0x888e('0x5d')]=integrations[_0x888e('0x5e')](_0x560fc8[_0x888e('0x55')][_0x888e('0x5f')],_0x560fc8[_0x888e('0x55')][_0x888e('0x3a')]);_0x560fc8['body'][_0x888e('0x60')]=integrations['getDescriptions'](_0x560fc8[_0x888e('0x55')][_0x888e('0x5f')],_0x560fc8['body'][_0x888e('0x3a')]);return db['VtigerConfiguration'][_0x888e('0x54')](_0x560fc8[_0x888e('0x55')],{'include':[{'model':db[_0x888e('0x61')],'as':'Subjects'},{'model':db[_0x888e('0x61')],'as':_0x888e('0x60')}]});}return null;})[_0x888e('0x1f')](respondWithResult(_0x1f4e2d,null))['catch'](handleError(_0x1f4e2d,null));};var md5=require(_0x888e('0x62'));exports['getFields']=function(_0x22c3e4,_0x2df460,_0x1c4bbd){var _0x32303d=null;var _0x16c465=null;var _0x2c2daf=null;var _0x5ebc94=null;var _0x459180='';return db['VtigerAccount'][_0x888e('0x63')]({'where':{'id':_0x22c3e4['params']['id']},'attributes':['id','name',_0x888e('0x64'),_0x888e('0x65'),_0x888e('0x66'),_0x888e('0x67'),'serverUrl',_0x888e('0x68')]})[_0x888e('0x1f')](handleEntityNotFound(_0x2df460,null))[_0x888e('0x1f')](function(_0x474f73){if(_0x474f73){_0x32303d=_0x474f73[_0x888e('0x64')];_0x16c465=_0x474f73[_0x888e('0x68')];_0x2c2daf=_0x474f73[_0x888e('0x66')];_0x459180=_0x474f73[_0x888e('0x67')];var _0xd102ca=_0x459180[_0x888e('0x69')](-0x1);if(_0xd102ca==='/'){_0x459180=_0x459180[_0x888e('0x6a')](0x0,_0x459180[_0x888e('0x6b')](_0xd102ca));}_0x5ebc94=util[_0x888e('0x6c')](_0x888e('0x6d'),_0x459180);var _0x5d28b2={'method':'GET','uri':_0x5ebc94,'qs':{'operation':_0x888e('0x6e'),'username':_0x474f73[_0x888e('0x64')]},'json':!![]};return rp(_0x5d28b2);}})['then'](function(_0x1180e6){if(_0x1180e6[_0x888e('0x6f')]){var _0x4b46d8={'method':_0x888e('0x70'),'uri':_0x5ebc94,'form':{'operation':_0x888e('0x71'),'username':_0x32303d,'accessKey':md5(_0x1180e6[_0x888e('0x28')][_0x888e('0x72')]+_0x16c465)},'json':!![]};return rp(_0x4b46d8);}})[_0x888e('0x1f')](function(_0x5b510f){if(_0x5b510f[_0x888e('0x6f')]){var _0x37b5b3={'method':_0x888e('0x73'),'uri':_0x5ebc94,'qs':{'operation':_0x888e('0x74'),'username':_0x32303d,'sessionName':_0x5b510f[_0x888e('0x28')]['sessionName'],'elementType':_0x2c2daf},'json':!![]};return rp(_0x37b5b3);}})[_0x888e('0x1f')](function(_0x534997){if(_0x534997[_0x888e('0x6f')]){var _0x403d96=[_0x888e('0x75'),_0x888e('0x76'),_0x888e('0x77')];_['remove'](_0x534997['result'][_0x888e('0x41')],function(_0x434a39){return _0x403d96[_0x888e('0x78')](_0x434a39[_0x888e('0x3a')][_0x888e('0x36')]);});_[_0x888e('0x79')](_0x534997[_0x888e('0x28')][_0x888e('0x41')],function(_0x553f56){return _0x553f56['editable']===_0x888e('0x7a');});return{'count':_0x534997[_0x888e('0x28')][_0x888e('0x41')][_0x888e('0x52')],'rows':_[_0x888e('0x37')](_0x534997['result']['fields'],function(_0x3cce53){return{'id':_0x3cce53['name'],'name':_0x3cce53[_0x888e('0x7b')],'custom':_[_0x888e('0x7c')](_0x3cce53[_0x888e('0x36')],_0x888e('0x7d'))?!![]:![],'options':_0x3cce53[_0x888e('0x3a')][_0x888e('0x36')]===_0x888e('0x7e')&&_0x3cce53[_0x888e('0x3a')]['picklistValues'][_0x888e('0x52')]>0x0?_['map'](_0x3cce53[_0x888e('0x3a')][_0x888e('0x7f')],function(_0x4efbb7){return{'name':_0x4efbb7[_0x888e('0x7b')],'value':_0x4efbb7[_0x888e('0x80')]};}):[]};})};}})[_0x888e('0x1f')](respondWithResult(_0x2df460,null))[_0x888e('0x4d')](function(_0x53fe5b){console['log'](_0x888e('0x81')+_0x53fe5b);var _0x4eb9de=_0x22c3e4['query'][_0x888e('0x82')]?0x1f4:_0x53fe5b[_0x888e('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x888e('0x84'),_0x4eb9de,JSON[_0x888e('0x24')](_0x53fe5b));delete _0x53fe5b['name'];if(_0x4eb9de===0x191){_0x4eb9de=0x190;}_0x2df460[_0x888e('0x2b')](_0x4eb9de)[_0x888e('0x85')](_0x22c3e4[_0x888e('0x3d')][_0x888e('0x82')]?{'message':_0x888e('0x86'),'statusCode':_0x53fe5b[_0x888e('0x83')]}:_0x53fe5b);});}; \ No newline at end of file +var _0xe02c=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','destroy','getConfigurations','findOne','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','description','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','editable','label','picklist','picklistValues','log','vTiger\x20error:\x20','test'];(function(_0x327f15,_0x81c005){var _0x305edd=function(_0x546dcd){while(--_0x546dcd){_0x327f15['push'](_0x327f15['shift']());}};_0x305edd(++_0x81c005);}(_0xe02c,0x81));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xce02('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xce02('0x1'));var rp=require(_0xce02('0x2'));var moment=require(_0xce02('0x3'));var BPromise=require(_0xce02('0x4'));var Mustache=require(_0xce02('0x5'));var util=require(_0xce02('0x6'));var path=require(_0xce02('0x7'));var sox=require(_0xce02('0x8'));var csv=require('to-csv');var ejs=require(_0xce02('0x9'));var fs=require('fs');var _=require(_0xce02('0xa'));var squel=require(_0xce02('0xb'));var crypto=require(_0xce02('0xc'));var jsforce=require(_0xce02('0xd'));var deskjs=require(_0xce02('0xe'));var toCsv=require(_0xce02('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce02('0x10'));var authService=require(_0xce02('0x11'));var qs=require(_0xce02('0x12'));var as=require(_0xce02('0x13'));var hardwareService=require(_0xce02('0x14'));var logger=require(_0xce02('0x15'))('api');var utils=require(_0xce02('0x16'));var config=require(_0xce02('0x17'));var licenseUtil=require(_0xce02('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xce02('0x19'));var jayson=require(_0xce02('0x1a'));var client=jayson[_0xce02('0x1b')][_0xce02('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17a6e3,_0x2ae50c,_0x5c9d19,_0x140c15){return new BPromise(function(_0x462762,_0x2a9403){var _0x335d8d=_0x140c15||client;return _0x335d8d['request'](_0x17a6e3,_0x5c9d19)[_0xce02('0x1d')](function(_0x4544f5){logger[_0xce02('0x1e')](_0xce02('0x1f'),_0x2ae50c,_0xce02('0x20'));logger[_0xce02('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2ae50c,'request\x20sent',JSON[_0xce02('0x22')](_0x4544f5));if(_0x4544f5[_0xce02('0x23')]){if(_0x4544f5[_0xce02('0x23')]['code']===0x1f4){logger['error'](_0xce02('0x1f'),_0x2ae50c,_0x4544f5[_0xce02('0x23')]['message']);return _0x2a9403(_0x4544f5[_0xce02('0x23')][_0xce02('0x24')]);}logger[_0xce02('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x2ae50c,_0x4544f5[_0xce02('0x23')][_0xce02('0x24')]);return _0x462762(_0x4544f5[_0xce02('0x23')][_0xce02('0x24')]);}else{logger[_0xce02('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x2ae50c,'request\x20sent');_0x462762(_0x4544f5[_0xce02('0x25')][_0xce02('0x24')]);}})['catch'](function(_0x838409){logger['error'](_0xce02('0x1f'),_0x2ae50c,_0x838409);_0x2a9403(_0x838409);});});}function respondWithStatusCode(_0x6f7c78,_0x2f30f1){_0x2f30f1=_0x2f30f1||0xcc;return function(_0x4efa13){if(_0x4efa13){return _0x6f7c78[_0xce02('0x26')](_0x2f30f1);}return _0x6f7c78['status'](_0x2f30f1)[_0xce02('0x27')]();};}function respondWithResult(_0x255a18,_0x46db1d){_0x46db1d=_0x46db1d||0xc8;return function(_0x29de8a){if(_0x29de8a){return _0x255a18[_0xce02('0x28')](_0x46db1d)[_0xce02('0x29')](_0x29de8a);}};}function respondWithFilteredResult(_0x2ce794,_0x1e099b){return function(_0x1f9c99){if(_0x1f9c99){var _0x5e70d7=_0x1f9c99['count'],_0x41591b=_0x1e099b[_0xce02('0x2a')],_0x37e6ac=_0x1e099b[_0xce02('0x2a')]+_0x1e099b[_0xce02('0x2b')],_0x3cbbec;if(_0x37e6ac>=_0x5e70d7){_0x37e6ac=_0x5e70d7;_0x3cbbec=0xc8;}else{_0x3cbbec=0xce;}_0x2ce794['status'](_0x3cbbec);return _0x2ce794['set'](_0xce02('0x2c'),_0x41591b+'-'+_0x37e6ac+'/'+_0x5e70d7)[_0xce02('0x29')](_0x1f9c99);}return null;};}function patchUpdates(_0x37f395){return function(_0xc8b041){try{jsonpatch[_0xce02('0x2d')](_0xc8b041,_0x37f395,!![]);}catch(_0x5a92d1){return BPromise[_0xce02('0x2e')](_0x5a92d1);}return _0xc8b041[_0xce02('0x2f')]();};}function saveUpdates(_0x2f0dad,_0x3fa8ae){return function(_0x1e9920){if(_0x1e9920){return _0x1e9920['update'](_0x2f0dad)[_0xce02('0x1d')](function(_0x1e3623){return _0x1e3623;});}return null;};}function removeEntity(_0x294f43,_0x268402){return function(_0x3da607){if(_0x3da607){return _0x3da607['destroy']()[_0xce02('0x1d')](function(){_0x294f43[_0xce02('0x28')](0xcc)[_0xce02('0x27')]();});}};}function handleEntityNotFound(_0x546444,_0x174c08){return function(_0x525692){if(!_0x525692){_0x546444[_0xce02('0x26')](0x194);}return _0x525692;};}function handleError(_0x3e700e,_0x52ff44){_0x52ff44=_0x52ff44||0x1f4;return function(_0x7b8aa7){logger[_0xce02('0x23')](_0x7b8aa7[_0xce02('0x30')]);if(_0x7b8aa7[_0xce02('0x31')]){delete _0x7b8aa7['name'];}_0x3e700e[_0xce02('0x28')](_0x52ff44)[_0xce02('0x32')](_0x7b8aa7);};}exports[_0xce02('0x33')]=function(_0x55869b,_0x50be6f){var _0x52548d={},_0x167bda={},_0x2e0376={'count':0x0,'rows':[]};var _0xfdd65e=_[_0xce02('0x34')](db[_0xce02('0x35')][_0xce02('0x36')],function(_0x2b5f80){return{'name':_0x2b5f80[_0xce02('0x37')],'type':_0x2b5f80['type'][_0xce02('0x38')]};});_0x167bda['model']=_['map'](_0xfdd65e,_0xce02('0x31'));_0x167bda[_0xce02('0x39')]=_[_0xce02('0x3a')](_0x55869b[_0xce02('0x39')]);_0x167bda['filters']=_[_0xce02('0x3b')](_0x167bda['model'],_0x167bda[_0xce02('0x39')]);_0x52548d[_0xce02('0x3c')]=_[_0xce02('0x3b')](_0x167bda[_0xce02('0x3d')],qs[_0xce02('0x3e')](_0x55869b[_0xce02('0x39')][_0xce02('0x3e')]));_0x52548d[_0xce02('0x3c')]=_0x52548d['attributes']['length']?_0x52548d[_0xce02('0x3c')]:_0x167bda[_0xce02('0x3d')];if(!_0x55869b[_0xce02('0x39')][_0xce02('0x3f')]('nolimit')){_0x52548d[_0xce02('0x2b')]=qs['limit'](_0x55869b[_0xce02('0x39')][_0xce02('0x2b')]);_0x52548d[_0xce02('0x2a')]=qs[_0xce02('0x2a')](_0x55869b[_0xce02('0x39')]['offset']);}_0x52548d['order']=qs['sort'](_0x55869b[_0xce02('0x39')][_0xce02('0x40')]);_0x52548d[_0xce02('0x41')]=qs[_0xce02('0x42')](_[_0xce02('0x43')](_0x55869b[_0xce02('0x39')],_0x167bda[_0xce02('0x42')]),_0xfdd65e);if(_0x55869b[_0xce02('0x39')][_0xce02('0x44')]){_0x52548d['where']=_[_0xce02('0x45')](_0x52548d[_0xce02('0x41')],{'$or':_['map'](_0xfdd65e,function(_0x5e8acf){if(_0x5e8acf[_0xce02('0x46')]!=='VIRTUAL'){var _0xde83a={};_0xde83a[_0x5e8acf[_0xce02('0x31')]]={'$like':'%'+_0x55869b[_0xce02('0x39')][_0xce02('0x44')]+'%'};return _0xde83a;}})});}_0x52548d=_[_0xce02('0x45')]({},_0x52548d,_0x55869b['options']);var _0x4a06ca={'where':_0x52548d['where']};return db[_0xce02('0x35')]['count'](_0x4a06ca)[_0xce02('0x1d')](function(_0x5dc178){_0x2e0376['count']=_0x5dc178;if(_0x55869b['query'][_0xce02('0x47')]){_0x52548d[_0xce02('0x48')]=[{'all':!![]}];}return db['VtigerAccount'][_0xce02('0x49')](_0x52548d);})['then'](function(_0x1c84d4){_0x2e0376[_0xce02('0x4a')]=_0x1c84d4;return _0x2e0376;})[_0xce02('0x1d')](respondWithFilteredResult(_0x50be6f,_0x52548d))[_0xce02('0x4b')](handleError(_0x50be6f,null));};exports[_0xce02('0x4c')]=function(_0xf80cf3,_0x1aa67){var _0x53094e={'raw':![],'where':{'id':_0xf80cf3[_0xce02('0x4d')]['id']}},_0x4dcdd7={};_0x4dcdd7[_0xce02('0x3d')]=_['keys'](db['VtigerAccount'][_0xce02('0x36')]);_0x4dcdd7[_0xce02('0x39')]=_[_0xce02('0x3a')](_0xf80cf3[_0xce02('0x39')]);_0x4dcdd7[_0xce02('0x42')]=_[_0xce02('0x3b')](_0x4dcdd7['model'],_0x4dcdd7[_0xce02('0x39')]);_0x53094e[_0xce02('0x3c')]=_[_0xce02('0x3b')](_0x4dcdd7[_0xce02('0x3d')],qs[_0xce02('0x3e')](_0xf80cf3[_0xce02('0x39')][_0xce02('0x3e')]));_0x53094e[_0xce02('0x3c')]=_0x53094e['attributes'][_0xce02('0x4e')]?_0x53094e['attributes']:_0x4dcdd7[_0xce02('0x3d')];if(_0xf80cf3['query']['includeAll']){_0x53094e[_0xce02('0x48')]=[{'all':!![]}];}_0x53094e=_['merge']({},_0x53094e,_0xf80cf3['options']);return db[_0xce02('0x35')][_0xce02('0x4f')](_0x53094e)[_0xce02('0x1d')](handleEntityNotFound(_0x1aa67,null))[_0xce02('0x1d')](respondWithResult(_0x1aa67,null))[_0xce02('0x4b')](handleError(_0x1aa67,null));};exports['create']=function(_0xfacc26,_0x466a24){return db[_0xce02('0x35')][_0xce02('0x50')](_0xfacc26[_0xce02('0x51')],{})[_0xce02('0x1d')](respondWithResult(_0x466a24,0xc9))[_0xce02('0x4b')](handleError(_0x466a24,null));};exports[_0xce02('0x52')]=function(_0x2ae7e2,_0x16ec1f){if(_0x2ae7e2[_0xce02('0x51')]['id']){delete _0x2ae7e2['body']['id'];}return db[_0xce02('0x35')][_0xce02('0x4f')]({'where':{'id':_0x2ae7e2[_0xce02('0x4d')]['id']}})[_0xce02('0x1d')](handleEntityNotFound(_0x16ec1f,null))[_0xce02('0x1d')](saveUpdates(_0x2ae7e2['body'],null))[_0xce02('0x1d')](respondWithResult(_0x16ec1f,null))[_0xce02('0x4b')](handleError(_0x16ec1f,null));};exports[_0xce02('0x53')]=function(_0x59cf68,_0x1f10d6){return db[_0xce02('0x35')]['find']({'where':{'id':_0x59cf68[_0xce02('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f10d6,null))[_0xce02('0x1d')](removeEntity(_0x1f10d6,null))[_0xce02('0x4b')](handleError(_0x1f10d6,null));};exports[_0xce02('0x54')]=function(_0x43d500,_0x2d72cf,_0x2b62f9){var _0x23b39a={};var _0x4e6935={};var _0x153f7e;var _0x58660a;return db[_0xce02('0x35')][_0xce02('0x55')]({'where':{'id':_0x43d500['params']['id']}})['then'](handleEntityNotFound(_0x2d72cf,null))[_0xce02('0x1d')](function(_0x15aa63){if(_0x15aa63){_0x153f7e=_0x15aa63;_0x4e6935[_0xce02('0x3d')]=_[_0xce02('0x3a')](db['VtigerConfiguration'][_0xce02('0x36')]);_0x4e6935['query']=_['keys'](_0x43d500[_0xce02('0x39')]);_0x4e6935[_0xce02('0x42')]=_[_0xce02('0x3b')](_0x4e6935['model'],_0x4e6935['query']);_0x23b39a[_0xce02('0x3c')]=_[_0xce02('0x3b')](_0x4e6935['model'],qs[_0xce02('0x3e')](_0x43d500['query']['fields']));_0x23b39a[_0xce02('0x3c')]=_0x23b39a[_0xce02('0x3c')][_0xce02('0x4e')]?_0x23b39a['attributes']:_0x4e6935[_0xce02('0x3d')];_0x23b39a[_0xce02('0x56')]=qs[_0xce02('0x40')](_0x43d500['query'][_0xce02('0x40')]);_0x23b39a[_0xce02('0x41')]=qs[_0xce02('0x42')](_[_0xce02('0x43')](_0x43d500[_0xce02('0x39')],_0x4e6935[_0xce02('0x42')]));if(_0x43d500['query']['filter']){_0x23b39a[_0xce02('0x41')]=_[_0xce02('0x45')](_0x23b39a['where'],{'$or':_[_0xce02('0x34')](_0x23b39a[_0xce02('0x3c')],function(_0x48f2a1){var _0x203171={};_0x203171[_0x48f2a1]={'$like':'%'+_0x43d500[_0xce02('0x39')][_0xce02('0x44')]+'%'};return _0x203171;})});}_0x23b39a=_[_0xce02('0x45')]({},_0x23b39a,_0x43d500[_0xce02('0x57')]);return _0x153f7e['getConfigurations'](_0x23b39a);}})['then'](function(_0x2935b8){if(_0x2935b8){_0x58660a=_0x2935b8['length'];if(!_0x43d500[_0xce02('0x39')][_0xce02('0x3f')]('nolimit')){_0x23b39a[_0xce02('0x2b')]=qs[_0xce02('0x2b')](_0x43d500['query']['limit']);_0x23b39a[_0xce02('0x2a')]=qs['offset'](_0x43d500['query'][_0xce02('0x2a')]);}return _0x153f7e['getConfigurations'](_0x23b39a);}})[_0xce02('0x1d')](function(_0x3b8e3f){if(_0x3b8e3f){return _0x3b8e3f?{'count':_0x58660a,'rows':_0x3b8e3f}:null;}})[_0xce02('0x1d')](respondWithResult(_0x2d72cf,null))[_0xce02('0x4b')](handleError(_0x2d72cf,null));};exports[_0xce02('0x58')]=function(_0x57b400,_0x2227be,_0x2dfdc8){if(_0x57b400[_0xce02('0x51')]['id']){delete _0x57b400[_0xce02('0x51')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x57b400[_0xce02('0x4d')]['id']}})[_0xce02('0x1d')](handleEntityNotFound(_0x2227be,null))[_0xce02('0x1d')](function(_0xf51df3){if(_0xf51df3){_0x57b400[_0xce02('0x51')][_0xce02('0x59')]=_0xf51df3['id'];_0x57b400['body'][_0xce02('0x5a')]=integrations[_0xce02('0x5b')](_0x57b400['body'][_0xce02('0x5c')],_0x57b400[_0xce02('0x51')][_0xce02('0x46')]);_0x57b400['body']['Descriptions']=integrations[_0xce02('0x5d')](_0x57b400[_0xce02('0x51')][_0xce02('0x5c')],_0x57b400[_0xce02('0x51')][_0xce02('0x46')]);return db[_0xce02('0x5e')][_0xce02('0x50')](_0x57b400[_0xce02('0x51')],{'include':[{'model':db['VtigerField'],'as':_0xce02('0x5a')},{'model':db[_0xce02('0x5f')],'as':_0xce02('0x60')}]});}return null;})[_0xce02('0x1d')](respondWithResult(_0x2227be,null))[_0xce02('0x4b')](handleError(_0x2227be,null));};var md5=require(_0xce02('0x61'));exports['getFields']=function(_0x55e54d,_0xf3cd58,_0x2dbc62){var _0x415be3=null;var _0x3948c8=null;var _0x583b37=null;var _0x5e137d=null;var _0x2ab307='';return db[_0xce02('0x35')][_0xce02('0x55')]({'where':{'id':_0x55e54d[_0xce02('0x4d')]['id']},'attributes':['id','name','username',_0xce02('0x62'),'moduleName',_0xce02('0x63'),_0xce02('0x64'),_0xce02('0x65')]})[_0xce02('0x1d')](handleEntityNotFound(_0xf3cd58,null))[_0xce02('0x1d')](function(_0x542990){if(_0x542990){_0x415be3=_0x542990[_0xce02('0x66')];_0x3948c8=_0x542990['accessKey'];_0x583b37=_0x542990['moduleName'];_0x2ab307=_0x542990[_0xce02('0x63')];var _0x12ff6a=_0x2ab307[_0xce02('0x67')](-0x1);if(_0x12ff6a==='/'){_0x2ab307=_0x2ab307[_0xce02('0x68')](0x0,_0x2ab307[_0xce02('0x69')](_0x12ff6a));}_0x5e137d=util[_0xce02('0x6a')]('%s/webservice.php',_0x2ab307);var _0x120934={'method':'GET','uri':_0x5e137d,'qs':{'operation':_0xce02('0x6b'),'username':_0x542990[_0xce02('0x66')]},'json':!![]};return rp(_0x120934);}})[_0xce02('0x1d')](function(_0x1bbb12){if(_0x1bbb12[_0xce02('0x6c')]){var _0x5ee7a4={'method':_0xce02('0x6d'),'uri':_0x5e137d,'form':{'operation':_0xce02('0x6e'),'username':_0x415be3,'accessKey':md5(_0x1bbb12[_0xce02('0x25')][_0xce02('0x6f')]+_0x3948c8)},'json':!![]};return rp(_0x5ee7a4);}})[_0xce02('0x1d')](function(_0x2b60d9){if(_0x2b60d9['success']){var _0x3251c0={'method':'GET','uri':_0x5e137d,'qs':{'operation':_0xce02('0x70'),'username':_0x415be3,'sessionName':_0x2b60d9[_0xce02('0x25')][_0xce02('0x71')],'elementType':_0x583b37},'json':!![]};return rp(_0x3251c0);}})[_0xce02('0x1d')](function(_0x371d7e){if(_0x371d7e[_0xce02('0x6c')]){var _0x283edb=[_0xce02('0x72'),_0xce02('0x73'),_0xce02('0x74')];_['remove'](_0x371d7e['result'][_0xce02('0x3e')],function(_0x9c8d31){return _0x283edb['includes'](_0x9c8d31[_0xce02('0x46')]['name']);});_[_0xce02('0x75')](_0x371d7e[_0xce02('0x25')][_0xce02('0x3e')],function(_0x5a0a0d){return _0x5a0a0d[_0xce02('0x76')]==='false';});return{'count':_0x371d7e[_0xce02('0x25')][_0xce02('0x3e')][_0xce02('0x4e')],'rows':_[_0xce02('0x34')](_0x371d7e[_0xce02('0x25')]['fields'],function(_0x149ff6){return{'id':_0x149ff6[_0xce02('0x31')],'name':_0x149ff6[_0xce02('0x77')],'custom':_['startsWith'](_0x149ff6[_0xce02('0x31')],'cf_')?!![]:![],'options':_0x149ff6[_0xce02('0x46')][_0xce02('0x31')]===_0xce02('0x78')&&_0x149ff6['type'][_0xce02('0x79')][_0xce02('0x4e')]>0x0?_['map'](_0x149ff6[_0xce02('0x46')][_0xce02('0x79')],function(_0x27ed26){return{'name':_0x27ed26[_0xce02('0x77')],'value':_0x27ed26['value']};}):[]};})};}})[_0xce02('0x1d')](respondWithResult(_0xf3cd58,null))['catch'](function(_0xc617c7){console[_0xce02('0x7a')](_0xce02('0x7b')+_0xc617c7);var _0x4761d1=_0x55e54d[_0xce02('0x39')][_0xce02('0x7c')]?0x1f4:_0xc617c7['statusCode']||0x1f4;logger[_0xce02('0x23')](_0xce02('0x7d'),'getFields',_0x4761d1,JSON[_0xce02('0x22')](_0xc617c7));delete _0xc617c7['name'];if(_0x4761d1===0x191){_0x4761d1=0x190;}_0xf3cd58[_0xce02('0x28')](_0x4761d1)[_0xce02('0x32')](_0x55e54d[_0xce02('0x39')][_0xce02('0x7c')]?{'message':_0xce02('0x7e'),'statusCode':_0xc617c7['statusCode']}:_0xc617c7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 6690f92..18169af 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 _0xc665=['define','VtigerAccount','int_vtiger_accounts','lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x24f8da,_0x5f26ae){var _0x4d2307=function(_0x5b0840){while(--_0x5b0840){_0x24f8da['push'](_0x24f8da['shift']());}};_0x4d2307(++_0x5f26ae);}(_0xc665,0x179));var _0x5c66=function(_0x54faa7,_0x1ca559){_0x54faa7=_0x54faa7-0x0;var _0x254df5=_0xc665[_0x54faa7];return _0x254df5;};'use strict';var _=require(_0x5c66('0x0'));var util=require(_0x5c66('0x1'));var logger=require('../../config/logger')(_0x5c66('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5c66('0x3'));var fs=require('fs');var path=require(_0x5c66('0x4'));var rimraf=require(_0x5c66('0x5'));var config=require(_0x5c66('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5c66('0x7')]=function(_0xef670,_0x372e07){return _0xef670[_0x5c66('0x8')](_0x5c66('0x9'),attributes,{'tableName':_0x5c66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5d4=['../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x9118c8,_0x43ef27){var _0x5f124d=function(_0x1237aa){while(--_0x1237aa){_0x9118c8['push'](_0x9118c8['shift']());}};_0x5f124d(++_0x43ef27);}(_0xc5d4,0x154));var _0x4c5d=function(_0x238310,_0x548829){_0x238310=_0x238310-0x0;var _0x44fd18=_0xc5d4[_0x238310];return _0x44fd18;};'use strict';var _=require(_0x4c5d('0x0'));var util=require(_0x4c5d('0x1'));var logger=require('../../config/logger')(_0x4c5d('0x2'));var moment=require(_0x4c5d('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c5d('0x4'));var fs=require('fs');var path=require(_0x4c5d('0x5'));var rimraf=require(_0x4c5d('0x6'));var config=require(_0x4c5d('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4c5d('0x8'));module[_0x4c5d('0x9')]=function(_0x4cec5b,_0x4d206e){return _0x4cec5b['define'](_0x4c5d('0xa'),attributes,{'tableName':_0x4c5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 1d67aec..77bacbd 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 _0xf03a=['message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','then','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','VtigerAccount,\x20%s,\x20%s'];(function(_0x1e4009,_0x211046){var _0xaa8ae8=function(_0x36e7b0){while(--_0x36e7b0){_0x1e4009['push'](_0x1e4009['shift']());}};_0xaa8ae8(++_0x211046);}(_0xf03a,0x118));var _0xaf03=function(_0x549cad,_0xc32566){_0x549cad=_0x549cad-0x0;var _0x5a9eed=_0xf03a[_0x549cad];return _0x5a9eed;};'use strict';var _=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var moment=require(_0xaf03('0x2'));var BPromise=require(_0xaf03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf03('0x4'))['db'];var utils=require(_0xaf03('0x5'));var logger=require('../../config/logger')(_0xaf03('0x6'));var config=require(_0xaf03('0x7'));var jayson=require(_0xaf03('0x8'));var client=jayson['client'][_0xaf03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xda07cc,_0x58bf00,_0x43b90a){return new BPromise(function(_0x47d9be,_0x2cdb00){return client[_0xaf03('0xa')](_0xda07cc,_0x43b90a)['then'](function(_0x1be0f7){logger[_0xaf03('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x58bf00,'request\x20sent');logger[_0xaf03('0xc')](_0xaf03('0xd'),_0x58bf00,_0xaf03('0xe'),JSON['stringify'](_0x1be0f7));if(_0x1be0f7[_0xaf03('0xf')]){if(_0x1be0f7[_0xaf03('0xf')]['code']===0x1f4){logger[_0xaf03('0xf')](_0xaf03('0x10'),_0x58bf00,_0x1be0f7[_0xaf03('0xf')][_0xaf03('0x11')]);return _0x2cdb00(_0x1be0f7[_0xaf03('0xf')][_0xaf03('0x11')]);}logger[_0xaf03('0xf')](_0xaf03('0x10'),_0x58bf00,_0x1be0f7[_0xaf03('0xf')]['message']);return _0x47d9be(_0x1be0f7[_0xaf03('0xf')][_0xaf03('0x11')]);}else{logger[_0xaf03('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x58bf00,'request\x20sent');_0x47d9be(_0x1be0f7['result'][_0xaf03('0x11')]);}})[_0xaf03('0x12')](function(_0x5ecbb9){logger[_0xaf03('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x58bf00,_0x5ecbb9);_0x2cdb00(_0x5ecbb9);});});}exports[_0xaf03('0x13')]=function(_0x3e849f){var _0x566444=this;return new Promise(function(_0x4d66d2,_0x3f3fe5){return db[_0xaf03('0x14')][_0xaf03('0x15')]({'raw':_0x3e849f[_0xaf03('0x16')]?_0x3e849f[_0xaf03('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3e849f[_0xaf03('0x16')]?_0x3e849f[_0xaf03('0x16')][_0xaf03('0x17')]||null:null,'attributes':_0x3e849f[_0xaf03('0x16')]?_0x3e849f['options'][_0xaf03('0x18')]||null:null,'limit':_0x3e849f[_0xaf03('0x16')]?_0x3e849f['options'][_0xaf03('0x19')]||null:null,'include':_0x3e849f[_0xaf03('0x16')]?_0x3e849f[_0xaf03('0x16')][_0xaf03('0x1a')]?_['map'](_0x3e849f[_0xaf03('0x16')][_0xaf03('0x1a')],function(_0x20e47f){return{'model':db[_0x20e47f[_0xaf03('0x1b')]],'as':_0x20e47f['as'],'attributes':_0x20e47f[_0xaf03('0x18')],'include':_0x20e47f['include']?_[_0xaf03('0x1c')](_0x20e47f[_0xaf03('0x1a')],function(_0x575568){return{'model':db[_0x575568['model']],'as':_0x575568['as'],'attributes':_0x575568[_0xaf03('0x18')],'include':_0x575568[_0xaf03('0x1a')]?_['map'](_0x575568['include'],function(_0x139cd5){return{'model':db[_0x139cd5[_0xaf03('0x1b')]],'as':_0x139cd5['as'],'attributes':_0x139cd5[_0xaf03('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf03('0x1d')](function(_0x4a6eed){logger[_0xaf03('0xb')](_0xaf03('0x13'),_0x3e849f);logger['debug'](_0xaf03('0x13'),_0x3e849f,JSON[_0xaf03('0x1e')](_0x4a6eed));_0x4d66d2(_0x4a6eed);})[_0xaf03('0x12')](function(_0xbbe556){logger['error'](_0xaf03('0x13'),_0xbbe556[_0xaf03('0x11')],_0x3e849f);_0x3f3fe5(_0x566444[_0xaf03('0xf')](0x1f4,_0xbbe556[_0xaf03('0x11')]));});});};exports[_0xaf03('0x1f')]=function(_0xf1f97c){var _0x34d2c5=this;return new Promise(function(_0x4a83cc,_0x134273){return db[_0xaf03('0x14')][_0xaf03('0x20')]({'raw':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c[_0xaf03('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c[_0xaf03('0x16')][_0xaf03('0x17')]||null:null,'attributes':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c[_0xaf03('0x16')][_0xaf03('0x18')]||null:null,'include':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c['options'][_0xaf03('0x1a')]?_['map'](_0xf1f97c[_0xaf03('0x16')][_0xaf03('0x1a')],function(_0x55caa4){return{'model':db[_0x55caa4[_0xaf03('0x1b')]],'as':_0x55caa4['as'],'attributes':_0x55caa4[_0xaf03('0x18')],'include':_0x55caa4[_0xaf03('0x1a')]?_[_0xaf03('0x1c')](_0x55caa4['include'],function(_0x5bb1f7){return{'model':db[_0x5bb1f7[_0xaf03('0x1b')]],'as':_0x5bb1f7['as'],'attributes':_0x5bb1f7['attributes'],'include':_0x5bb1f7[_0xaf03('0x1a')]?_[_0xaf03('0x1c')](_0x5bb1f7['include'],function(_0x4e3f47){return{'model':db[_0x4e3f47[_0xaf03('0x1b')]],'as':_0x4e3f47['as'],'attributes':_0x4e3f47[_0xaf03('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf03('0x1d')](function(_0x535c40){logger[_0xaf03('0xb')]('ShowVtigerAccount',_0xf1f97c);logger['debug'](_0xaf03('0x1f'),_0xf1f97c,JSON[_0xaf03('0x1e')](_0x535c40));_0x4a83cc(_0x535c40);})['catch'](function(_0x20d2fc){logger[_0xaf03('0xf')](_0xaf03('0x1f'),_0x20d2fc[_0xaf03('0x11')],_0xf1f97c);_0x134273(_0x34d2c5[_0xaf03('0xf')](0x1f4,_0x20d2fc[_0xaf03('0x11')]));});});}; \ No newline at end of file +var _0x4756=['GetVtigerAccount','VtigerAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','ShowVtigerAccount','find','where','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x2b2792,_0x5d3200){var _0x4c9f42=function(_0x1d7d4d){while(--_0x1d7d4d){_0x2b2792['push'](_0x2b2792['shift']());}};_0x4c9f42(++_0x5d3200);}(_0x4756,0xc8));var _0x6475=function(_0x1b173f,_0x6bec20){_0x1b173f=_0x1b173f-0x0;var _0x271705=_0x4756[_0x1b173f];return _0x271705;};'use strict';var _=require(_0x6475('0x0'));var util=require(_0x6475('0x1'));var moment=require(_0x6475('0x2'));var BPromise=require(_0x6475('0x3'));var rs=require(_0x6475('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6475('0x5'));var logger=require(_0x6475('0x6'))(_0x6475('0x7'));var config=require(_0x6475('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6475('0x9')][_0x6475('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x240c38,_0x326405,_0x422f2e){return new BPromise(function(_0x3f72e8,_0x3f96d7){return client[_0x6475('0xb')](_0x240c38,_0x422f2e)[_0x6475('0xc')](function(_0x184927){logger['info'](_0x6475('0xd'),_0x326405,_0x6475('0xe'));logger[_0x6475('0xf')](_0x6475('0x10'),_0x326405,'request\x20sent',JSON['stringify'](_0x184927));if(_0x184927[_0x6475('0x11')]){if(_0x184927[_0x6475('0x11')][_0x6475('0x12')]===0x1f4){logger[_0x6475('0x11')](_0x6475('0xd'),_0x326405,_0x184927[_0x6475('0x11')][_0x6475('0x13')]);return _0x3f96d7(_0x184927[_0x6475('0x11')]['message']);}logger[_0x6475('0x11')](_0x6475('0xd'),_0x326405,_0x184927[_0x6475('0x11')][_0x6475('0x13')]);return _0x3f72e8(_0x184927[_0x6475('0x11')]['message']);}else{logger[_0x6475('0x14')](_0x6475('0xd'),_0x326405,_0x6475('0xe'));_0x3f72e8(_0x184927[_0x6475('0x15')]['message']);}})['catch'](function(_0x269ccf){logger[_0x6475('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x326405,_0x269ccf);_0x3f96d7(_0x269ccf);});});}exports[_0x6475('0x16')]=function(_0x33b0e1){var _0x1bcd76=this;return new Promise(function(_0x137042,_0x26dfdf){return db[_0x6475('0x17')][_0x6475('0x18')]({'raw':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1['options'][_0x6475('0x1a')]===undefined?!![]:![]:!![],'where':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1[_0x6475('0x19')]['where']||null:null,'attributes':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1['options']['attributes']||null:null,'limit':_0x33b0e1['options']?_0x33b0e1['options'][_0x6475('0x1b')]||null:null,'include':_0x33b0e1[_0x6475('0x19')]?_0x33b0e1['options'][_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x33b0e1[_0x6475('0x19')][_0x6475('0x1c')],function(_0x4ef512){return{'model':db[_0x4ef512[_0x6475('0x1e')]],'as':_0x4ef512['as'],'attributes':_0x4ef512['attributes'],'include':_0x4ef512['include']?_[_0x6475('0x1d')](_0x4ef512['include'],function(_0x2527c7){return{'model':db[_0x2527c7[_0x6475('0x1e')]],'as':_0x2527c7['as'],'attributes':_0x2527c7[_0x6475('0x1f')],'include':_0x2527c7['include']?_[_0x6475('0x1d')](_0x2527c7[_0x6475('0x1c')],function(_0xce9692){return{'model':db[_0xce9692['model']],'as':_0xce9692['as'],'attributes':_0xce9692[_0x6475('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6475('0xc')](function(_0x20450e){logger[_0x6475('0x14')](_0x6475('0x16'),_0x33b0e1);logger[_0x6475('0xf')]('GetVtigerAccount',_0x33b0e1,JSON[_0x6475('0x20')](_0x20450e));_0x137042(_0x20450e);})['catch'](function(_0x1a707d){logger[_0x6475('0x11')]('GetVtigerAccount',_0x1a707d[_0x6475('0x13')],_0x33b0e1);_0x26dfdf(_0x1bcd76['error'](0x1f4,_0x1a707d[_0x6475('0x13')]));});});};exports[_0x6475('0x21')]=function(_0x202ea8){var _0x2a5af3=this;return new Promise(function(_0x5f4be5,_0x229ea6){return db[_0x6475('0x17')][_0x6475('0x22')]({'raw':_0x202ea8[_0x6475('0x19')]?_0x202ea8[_0x6475('0x19')][_0x6475('0x1a')]===undefined?!![]:![]:!![],'where':_0x202ea8[_0x6475('0x19')]?_0x202ea8[_0x6475('0x19')][_0x6475('0x23')]||null:null,'attributes':_0x202ea8[_0x6475('0x19')]?_0x202ea8['options'][_0x6475('0x1f')]||null:null,'include':_0x202ea8[_0x6475('0x19')]?_0x202ea8[_0x6475('0x19')][_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x202ea8['options'][_0x6475('0x1c')],function(_0x393acf){return{'model':db[_0x393acf[_0x6475('0x1e')]],'as':_0x393acf['as'],'attributes':_0x393acf[_0x6475('0x1f')],'include':_0x393acf[_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x393acf[_0x6475('0x1c')],function(_0x2394f3){return{'model':db[_0x2394f3[_0x6475('0x1e')]],'as':_0x2394f3['as'],'attributes':_0x2394f3[_0x6475('0x1f')],'include':_0x2394f3[_0x6475('0x1c')]?_[_0x6475('0x1d')](_0x2394f3[_0x6475('0x1c')],function(_0x4291c4){return{'model':db[_0x4291c4[_0x6475('0x1e')]],'as':_0x4291c4['as'],'attributes':_0x4291c4['attributes']};}):[]};}):[]};}):[]:[]})[_0x6475('0xc')](function(_0x4c0c22){logger[_0x6475('0x14')]('ShowVtigerAccount',_0x202ea8);logger[_0x6475('0xf')](_0x6475('0x21'),_0x202ea8,JSON[_0x6475('0x20')](_0x4c0c22));_0x5f4be5(_0x4c0c22);})[_0x6475('0x24')](function(_0x262504){logger[_0x6475('0x11')](_0x6475('0x21'),_0x262504[_0x6475('0x13')],_0x202ea8);_0x229ea6(_0x2a5af3[_0x6475('0x11')](0x1f4,_0x262504[_0x6475('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 060f2f5..134c994 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x359ac8,_0x3d0732){var _0x407061=function(_0x37acbe){while(--_0x37acbe){_0x359ac8['push'](_0x359ac8['shift']());}};_0x407061(++_0x3d0732);}(_0xb10b,0x12a));var _0xbb10=function(_0x4888e0,_0x35f563){_0x4888e0=_0x4888e0-0x0;var _0x346fee=_0xb10b[_0x4888e0];return _0x346fee;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x4f1560,_0x18c6e4){var _0x14b3ae=function(_0x9ed837){while(--_0x9ed837){_0x4f1560['push'](_0x4f1560['shift']());}};_0x14b3ae(++_0x18c6e4);}(_0xb10b,0x12a));var _0xbb10=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xb10b[_0x15876a];return _0xbd900f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index dd924b3..38a4ff6 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 _0xf0e1=['STRING','sequelize','exports'];(function(_0x25b3d5,_0x4f0a26){var _0x130bd9=function(_0x4ddb14){while(--_0x4ddb14){_0x25b3d5['push'](_0x25b3d5['shift']());}};_0x130bd9(++_0x4f0a26);}(_0xf0e1,0x70));var _0x1f0e=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0xf0e1[_0x44039a];return _0x525de5;};'use strict';var Sequelize=require(_0x1f0e('0x0'));module[_0x1f0e('0x1')]={'name':{'type':Sequelize[_0x1f0e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5bce=['sequelize','exports','STRING'];(function(_0x1149d6,_0x491eeb){var _0x4c17f5=function(_0x1b544c){while(--_0x1b544c){_0x1149d6['push'](_0x1149d6['shift']());}};_0x4c17f5(++_0x491eeb);}(_0x5bce,0x7b));var _0xe5bc=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x5bce[_0x22ee1e];return _0x49a5c9;};'use strict';var Sequelize=require(_0xe5bc('0x0'));module[_0xe5bc('0x1')]={'name':{'type':Sequelize[_0xe5bc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index fbbe7dd..a94a01d 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 _0x9dbe=['jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','create','body','update','find','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x307f13,_0x27e474){var _0x28eab2=function(_0x427d1d){while(--_0x427d1d){_0x307f13['push'](_0x307f13['shift']());}};_0x28eab2(++_0x27e474);}(_0x9dbe,0x1c4));var _0xe9db=function(_0x557f28,_0xc7a5a6){_0x557f28=_0x557f28-0x0;var _0x2ffa93=_0x9dbe[_0x557f28];return _0x2ffa93;};'use strict';var pdf=require(_0xe9db('0x0'));var emlformat=require(_0xe9db('0x1'));var rimraf=require(_0xe9db('0x2'));var zipdir=require(_0xe9db('0x3'));var jsonpatch=require(_0xe9db('0x4'));var rp=require(_0xe9db('0x5'));var moment=require(_0xe9db('0x6'));var BPromise=require(_0xe9db('0x7'));var Mustache=require('mustache');var util=require(_0xe9db('0x8'));var path=require(_0xe9db('0x9'));var sox=require(_0xe9db('0xa'));var csv=require('to-csv');var ejs=require(_0xe9db('0xb'));var fs=require('fs');var _=require(_0xe9db('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe9db('0xd'));var deskjs=require(_0xe9db('0xe'));var toCsv=require(_0xe9db('0xf'));var querystring=require(_0xe9db('0x10'));var Papa=require(_0xe9db('0x11'));var Redis=require(_0xe9db('0x12'));var authService=require(_0xe9db('0x13'));var qs=require(_0xe9db('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9db('0x15'));var logger=require(_0xe9db('0x16'))(_0xe9db('0x17'));var utils=require(_0xe9db('0x18'));var config=require(_0xe9db('0x19'));var licenseUtil=require(_0xe9db('0x1a'));var db=require(_0xe9db('0x1b'))['db'];var jayson=require(_0xe9db('0x1c'));var client=jayson[_0xe9db('0x1d')][_0xe9db('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x564cb8,_0x1c83d0,_0x589917,_0x8034f8){return new BPromise(function(_0x4f6d72,_0x2684bb){var _0x35c12e=_0x8034f8||client;return _0x35c12e[_0xe9db('0x1f')](_0x564cb8,_0x589917)['then'](function(_0x5d1468){logger[_0xe9db('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c83d0,_0xe9db('0x21'));logger[_0xe9db('0x22')](_0xe9db('0x23'),_0x1c83d0,_0xe9db('0x21'),JSON[_0xe9db('0x24')](_0x5d1468));if(_0x5d1468[_0xe9db('0x25')]){if(_0x5d1468[_0xe9db('0x25')][_0xe9db('0x26')]===0x1f4){logger[_0xe9db('0x25')](_0xe9db('0x27'),_0x1c83d0,_0x5d1468[_0xe9db('0x25')][_0xe9db('0x28')]);return _0x2684bb(_0x5d1468[_0xe9db('0x25')][_0xe9db('0x28')]);}logger[_0xe9db('0x25')](_0xe9db('0x27'),_0x1c83d0,_0x5d1468[_0xe9db('0x25')][_0xe9db('0x28')]);return _0x4f6d72(_0x5d1468['error'][_0xe9db('0x28')]);}else{logger['info'](_0xe9db('0x27'),_0x1c83d0,_0xe9db('0x21'));_0x4f6d72(_0x5d1468[_0xe9db('0x29')][_0xe9db('0x28')]);}})[_0xe9db('0x2a')](function(_0x11746c){logger['error'](_0xe9db('0x27'),_0x1c83d0,_0x11746c);_0x2684bb(_0x11746c);});});}function respondWithStatusCode(_0x149db9,_0x4768c2){_0x4768c2=_0x4768c2||0xcc;return function(_0x2e978c){if(_0x2e978c){return _0x149db9[_0xe9db('0x2b')](_0x4768c2);}return _0x149db9[_0xe9db('0x2c')](_0x4768c2)[_0xe9db('0x2d')]();};}function respondWithResult(_0x35f2fd,_0x1efa63){_0x1efa63=_0x1efa63||0xc8;return function(_0x5889a5){if(_0x5889a5){return _0x35f2fd[_0xe9db('0x2c')](_0x1efa63)[_0xe9db('0x2e')](_0x5889a5);}};}function respondWithFilteredResult(_0x3d2422,_0x5d6484){return function(_0x10c8a1){if(_0x10c8a1){var _0x4fefa6=_0x10c8a1[_0xe9db('0x2f')],_0x5218b1=_0x5d6484[_0xe9db('0x30')],_0x586430=_0x5d6484[_0xe9db('0x30')]+_0x5d6484[_0xe9db('0x31')],_0x174ec6;if(_0x586430>=_0x4fefa6){_0x586430=_0x4fefa6;_0x174ec6=0xc8;}else{_0x174ec6=0xce;}_0x3d2422['status'](_0x174ec6);return _0x3d2422[_0xe9db('0x32')](_0xe9db('0x33'),_0x5218b1+'-'+_0x586430+'/'+_0x4fefa6)[_0xe9db('0x2e')](_0x10c8a1);}return null;};}function patchUpdates(_0xf64d60){return function(_0x3c85e5){try{jsonpatch[_0xe9db('0x34')](_0x3c85e5,_0xf64d60,!![]);}catch(_0x19d04b){return BPromise[_0xe9db('0x35')](_0x19d04b);}return _0x3c85e5[_0xe9db('0x36')]();};}function saveUpdates(_0x302b12,_0x2b46b5){return function(_0x2b075a){if(_0x2b075a){return _0x2b075a['update'](_0x302b12)[_0xe9db('0x37')](function(_0x4a83a7){return _0x4a83a7;});}return null;};}function removeEntity(_0xf6f44b,_0x392daf){return function(_0x11ce05){if(_0x11ce05){return _0x11ce05[_0xe9db('0x38')]()['then'](function(){_0xf6f44b[_0xe9db('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x149a56,_0xcbc84c){return function(_0x1de5fa){if(!_0x1de5fa){_0x149a56['sendStatus'](0x194);}return _0x1de5fa;};}function handleError(_0x5a8f52,_0x49df4e){_0x49df4e=_0x49df4e||0x1f4;return function(_0x42f8b8){logger[_0xe9db('0x25')](_0x42f8b8[_0xe9db('0x39')]);if(_0x42f8b8['name']){delete _0x42f8b8[_0xe9db('0x3a')];}_0x5a8f52[_0xe9db('0x2c')](_0x49df4e)[_0xe9db('0x3b')](_0x42f8b8);};}exports['index']=function(_0x33ffec,_0x5870b3){var _0x5de5bb={},_0x30bc28={},_0x486121={'count':0x0,'rows':[]};var _0x27372d=_['map'](db[_0xe9db('0x3c')][_0xe9db('0x3d')],function(_0x3b7c70){return{'name':_0x3b7c70[_0xe9db('0x3e')],'type':_0x3b7c70['type'][_0xe9db('0x3f')]};});_0x30bc28[_0xe9db('0x40')]=_[_0xe9db('0x41')](_0x27372d,_0xe9db('0x3a'));_0x30bc28['query']=_['keys'](_0x33ffec[_0xe9db('0x42')]);_0x30bc28[_0xe9db('0x43')]=_[_0xe9db('0x44')](_0x30bc28[_0xe9db('0x40')],_0x30bc28['query']);_0x5de5bb[_0xe9db('0x45')]=_['intersection'](_0x30bc28[_0xe9db('0x40')],qs[_0xe9db('0x46')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x46')]));_0x5de5bb[_0xe9db('0x45')]=_0x5de5bb[_0xe9db('0x45')][_0xe9db('0x47')]?_0x5de5bb[_0xe9db('0x45')]:_0x30bc28[_0xe9db('0x40')];if(!_0x33ffec[_0xe9db('0x42')][_0xe9db('0x48')](_0xe9db('0x49'))){_0x5de5bb['limit']=qs[_0xe9db('0x31')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x31')]);_0x5de5bb['offset']=qs[_0xe9db('0x30')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x30')]);}_0x5de5bb[_0xe9db('0x4a')]=qs[_0xe9db('0x4b')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x4b')]);_0x5de5bb[_0xe9db('0x4c')]=qs['filters'](_[_0xe9db('0x4d')](_0x33ffec[_0xe9db('0x42')],_0x30bc28[_0xe9db('0x43')]),_0x27372d);if(_0x33ffec[_0xe9db('0x42')][_0xe9db('0x4e')]){_0x5de5bb[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x5de5bb[_0xe9db('0x4c')],{'$or':_[_0xe9db('0x41')](_0x27372d,function(_0x1a1b25){if(_0x1a1b25['type']!==_0xe9db('0x50')){var _0xd8cfef={};_0xd8cfef[_0x1a1b25[_0xe9db('0x3a')]]={'$like':'%'+_0x33ffec['query'][_0xe9db('0x4e')]+'%'};return _0xd8cfef;}})});}_0x5de5bb=_[_0xe9db('0x4f')]({},_0x5de5bb,_0x33ffec['options']);var _0x5bc132={'where':_0x5de5bb[_0xe9db('0x4c')]};return db['VtigerConfiguration'][_0xe9db('0x2f')](_0x5bc132)[_0xe9db('0x37')](function(_0x500874){_0x486121[_0xe9db('0x2f')]=_0x500874;if(_0x33ffec[_0xe9db('0x42')][_0xe9db('0x51')]){_0x5de5bb[_0xe9db('0x52')]=[{'all':!![]}];}return db[_0xe9db('0x3c')]['findAll'](_0x5de5bb);})[_0xe9db('0x37')](function(_0x2c5abe){_0x486121[_0xe9db('0x53')]=_0x2c5abe;return _0x486121;})[_0xe9db('0x37')](respondWithFilteredResult(_0x5870b3,_0x5de5bb))[_0xe9db('0x2a')](handleError(_0x5870b3,null));};exports['show']=function(_0x41b4bc,_0x14abe4){var _0x53caf6={'raw':![],'where':{'id':_0x41b4bc['params']['id']}},_0x3dd26e={};_0x3dd26e['model']=_[_0xe9db('0x54')](db[_0xe9db('0x3c')][_0xe9db('0x3d')]);_0x3dd26e[_0xe9db('0x42')]=_[_0xe9db('0x54')](_0x41b4bc['query']);_0x3dd26e[_0xe9db('0x43')]=_[_0xe9db('0x44')](_0x3dd26e[_0xe9db('0x40')],_0x3dd26e[_0xe9db('0x42')]);_0x53caf6[_0xe9db('0x45')]=_[_0xe9db('0x44')](_0x3dd26e[_0xe9db('0x40')],qs[_0xe9db('0x46')](_0x41b4bc[_0xe9db('0x42')][_0xe9db('0x46')]));_0x53caf6[_0xe9db('0x45')]=_0x53caf6[_0xe9db('0x45')][_0xe9db('0x47')]?_0x53caf6['attributes']:_0x3dd26e[_0xe9db('0x40')];if(_0x41b4bc['query'][_0xe9db('0x51')]){_0x53caf6[_0xe9db('0x52')]=[{'all':!![]}];}_0x53caf6=_[_0xe9db('0x4f')]({},_0x53caf6,_0x41b4bc[_0xe9db('0x55')]);return db['VtigerConfiguration']['find'](_0x53caf6)[_0xe9db('0x37')](handleEntityNotFound(_0x14abe4,null))[_0xe9db('0x37')](respondWithResult(_0x14abe4,null))['catch'](handleError(_0x14abe4,null));};exports['create']=function(_0x22dde1,_0x569a76){return db[_0xe9db('0x3c')][_0xe9db('0x56')](_0x22dde1[_0xe9db('0x57')],{})[_0xe9db('0x37')](respondWithResult(_0x569a76,0xc9))[_0xe9db('0x2a')](handleError(_0x569a76,null));};exports[_0xe9db('0x58')]=function(_0x36b1d7,_0x5eef4c){if(_0x36b1d7[_0xe9db('0x57')]['id']){delete _0x36b1d7['body']['id'];}return db[_0xe9db('0x3c')][_0xe9db('0x59')]({'where':{'id':_0x36b1d7[_0xe9db('0x5a')]['id']}})[_0xe9db('0x37')](handleEntityNotFound(_0x5eef4c,null))[_0xe9db('0x37')](saveUpdates(_0x36b1d7[_0xe9db('0x57')],null))[_0xe9db('0x37')](respondWithResult(_0x5eef4c,null))[_0xe9db('0x2a')](handleError(_0x5eef4c,null));};exports[_0xe9db('0x38')]=function(_0x551db8,_0x2e0a6a){return db[_0xe9db('0x3c')][_0xe9db('0x59')]({'where':{'id':_0x551db8['params']['id']}})['then'](handleEntityNotFound(_0x2e0a6a,null))[_0xe9db('0x37')](removeEntity(_0x2e0a6a,null))[_0xe9db('0x2a')](handleError(_0x2e0a6a,null));};exports[_0xe9db('0x5b')]=function(_0x1bfd7e,_0x438ef2,_0x51f34f){var _0x1504a9={};var _0x3a2319={};var _0x56947e;var _0x9be61a;return db[_0xe9db('0x3c')][_0xe9db('0x5c')]({'where':{'id':_0x1bfd7e[_0xe9db('0x5a')]['id']}})[_0xe9db('0x37')](handleEntityNotFound(_0x438ef2,null))[_0xe9db('0x37')](function(_0x2d3275){if(_0x2d3275){_0x56947e=_0x2d3275;_0x3a2319[_0xe9db('0x40')]=_[_0xe9db('0x54')](db['VtigerField']['rawAttributes']);_0x3a2319[_0xe9db('0x42')]=_['keys'](_0x1bfd7e[_0xe9db('0x42')]);_0x3a2319[_0xe9db('0x43')]=_['intersection'](_0x3a2319[_0xe9db('0x40')],_0x3a2319[_0xe9db('0x42')]);_0x1504a9[_0xe9db('0x45')]=_[_0xe9db('0x44')](_0x3a2319['model'],qs[_0xe9db('0x46')](_0x1bfd7e[_0xe9db('0x42')][_0xe9db('0x46')]));_0x1504a9[_0xe9db('0x45')]=_0x1504a9['attributes'][_0xe9db('0x47')]?_0x1504a9[_0xe9db('0x45')]:_0x3a2319[_0xe9db('0x40')];_0x1504a9[_0xe9db('0x4a')]=qs['sort'](_0x1bfd7e[_0xe9db('0x42')]['sort']);_0x1504a9['where']=qs['filters'](_[_0xe9db('0x4d')](_0x1bfd7e[_0xe9db('0x42')],_0x3a2319[_0xe9db('0x43')]));if(_0x1bfd7e[_0xe9db('0x42')][_0xe9db('0x4e')]){_0x1504a9[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x1504a9[_0xe9db('0x4c')],{'$or':_[_0xe9db('0x41')](_0x1504a9[_0xe9db('0x45')],function(_0x2cc0df){var _0x461c5f={};_0x461c5f[_0x2cc0df]={'$like':'%'+_0x1bfd7e['query'][_0xe9db('0x4e')]+'%'};return _0x461c5f;})});}_0x1504a9=_['merge']({},_0x1504a9,_0x1bfd7e[_0xe9db('0x55')]);return _0x56947e['getFields'](_0x1504a9);}})[_0xe9db('0x37')](function(_0x4e97db){if(_0x4e97db){_0x9be61a=_0x4e97db[_0xe9db('0x47')];if(!_0x1bfd7e[_0xe9db('0x42')][_0xe9db('0x48')](_0xe9db('0x49'))){_0x1504a9['limit']=qs[_0xe9db('0x31')](_0x1bfd7e['query'][_0xe9db('0x31')]);_0x1504a9['offset']=qs['offset'](_0x1bfd7e['query'][_0xe9db('0x30')]);}return _0x56947e['getFields'](_0x1504a9);}})[_0xe9db('0x37')](function(_0x5ad44c){if(_0x5ad44c){return _0x5ad44c?{'count':_0x9be61a,'rows':_0x5ad44c}:null;}})[_0xe9db('0x37')](respondWithResult(_0x438ef2,null))[_0xe9db('0x2a')](handleError(_0x438ef2,null));};exports['getSubjects']=function(_0x235bed,_0x1166ab,_0x3a11f0){var _0x28953f={};var _0xce0d0e={};var _0x6b8f4b;var _0x1cd284;return db[_0xe9db('0x3c')]['findOne']({'where':{'id':_0x235bed['params']['id']}})[_0xe9db('0x37')](handleEntityNotFound(_0x1166ab,null))['then'](function(_0x32788e){if(_0x32788e){_0x6b8f4b=_0x32788e;_0xce0d0e[_0xe9db('0x40')]=_[_0xe9db('0x54')](db[_0xe9db('0x5d')][_0xe9db('0x3d')]);_0xce0d0e[_0xe9db('0x42')]=_[_0xe9db('0x54')](_0x235bed[_0xe9db('0x42')]);_0xce0d0e[_0xe9db('0x43')]=_[_0xe9db('0x44')](_0xce0d0e[_0xe9db('0x40')],_0xce0d0e[_0xe9db('0x42')]);_0x28953f[_0xe9db('0x45')]=_['intersection'](_0xce0d0e['model'],qs[_0xe9db('0x46')](_0x235bed[_0xe9db('0x42')][_0xe9db('0x46')]));_0x28953f[_0xe9db('0x45')]=_0x28953f['attributes'][_0xe9db('0x47')]?_0x28953f[_0xe9db('0x45')]:_0xce0d0e[_0xe9db('0x40')];_0x28953f['order']=qs[_0xe9db('0x4b')](_0x235bed[_0xe9db('0x42')][_0xe9db('0x4b')]);_0x28953f[_0xe9db('0x4c')]=qs[_0xe9db('0x43')](_['pick'](_0x235bed['query'],_0xce0d0e[_0xe9db('0x43')]));if(_0x235bed[_0xe9db('0x42')][_0xe9db('0x4e')]){_0x28953f[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x28953f[_0xe9db('0x4c')],{'$or':_[_0xe9db('0x41')](_0x28953f['attributes'],function(_0x33b64a){var _0x195faf={};_0x195faf[_0x33b64a]={'$like':'%'+_0x235bed[_0xe9db('0x42')][_0xe9db('0x4e')]+'%'};return _0x195faf;})});}_0x28953f=_[_0xe9db('0x4f')]({},_0x28953f,_0x235bed[_0xe9db('0x55')]);return _0x6b8f4b[_0xe9db('0x5e')](_0x28953f);}})[_0xe9db('0x37')](function(_0x14a921){if(_0x14a921){_0x1cd284=_0x14a921[_0xe9db('0x47')];if(!_0x235bed[_0xe9db('0x42')][_0xe9db('0x48')](_0xe9db('0x49'))){_0x28953f[_0xe9db('0x31')]=qs[_0xe9db('0x31')](_0x235bed[_0xe9db('0x42')][_0xe9db('0x31')]);_0x28953f[_0xe9db('0x30')]=qs[_0xe9db('0x30')](_0x235bed['query'][_0xe9db('0x30')]);}return _0x6b8f4b['getSubjects'](_0x28953f);}})['then'](function(_0x66418b){if(_0x66418b){return _0x66418b?{'count':_0x1cd284,'rows':_0x66418b}:null;}})['then'](respondWithResult(_0x1166ab,null))[_0xe9db('0x2a')](handleError(_0x1166ab,null));};exports[_0xe9db('0x5f')]=function(_0x595630,_0x1723fb,_0x1b43a7){var _0x49675b={};var _0x120542={};var _0x59ac48;var _0x3fcb2d;return db[_0xe9db('0x3c')][_0xe9db('0x5c')]({'where':{'id':_0x595630[_0xe9db('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1723fb,null))[_0xe9db('0x37')](function(_0x2237ad){if(_0x2237ad){_0x59ac48=_0x2237ad;_0x120542[_0xe9db('0x40')]=_[_0xe9db('0x54')](db[_0xe9db('0x5d')]['rawAttributes']);_0x120542['query']=_['keys'](_0x595630[_0xe9db('0x42')]);_0x120542[_0xe9db('0x43')]=_['intersection'](_0x120542[_0xe9db('0x40')],_0x120542['query']);_0x49675b[_0xe9db('0x45')]=_[_0xe9db('0x44')](_0x120542[_0xe9db('0x40')],qs[_0xe9db('0x46')](_0x595630[_0xe9db('0x42')][_0xe9db('0x46')]));_0x49675b[_0xe9db('0x45')]=_0x49675b['attributes'][_0xe9db('0x47')]?_0x49675b[_0xe9db('0x45')]:_0x120542[_0xe9db('0x40')];_0x49675b[_0xe9db('0x4a')]=qs[_0xe9db('0x4b')](_0x595630[_0xe9db('0x42')][_0xe9db('0x4b')]);_0x49675b[_0xe9db('0x4c')]=qs[_0xe9db('0x43')](_['pick'](_0x595630[_0xe9db('0x42')],_0x120542['filters']));if(_0x595630['query'][_0xe9db('0x4e')]){_0x49675b[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x49675b['where'],{'$or':_[_0xe9db('0x41')](_0x49675b[_0xe9db('0x45')],function(_0x934386){var _0x133392={};_0x133392[_0x934386]={'$like':'%'+_0x595630['query'][_0xe9db('0x4e')]+'%'};return _0x133392;})});}_0x49675b=_['merge']({},_0x49675b,_0x595630[_0xe9db('0x55')]);return _0x59ac48['getDescriptions'](_0x49675b);}})[_0xe9db('0x37')](function(_0x15f0ad){if(_0x15f0ad){_0x3fcb2d=_0x15f0ad[_0xe9db('0x47')];if(!_0x595630[_0xe9db('0x42')]['hasOwnProperty']('nolimit')){_0x49675b[_0xe9db('0x31')]=qs[_0xe9db('0x31')](_0x595630[_0xe9db('0x42')][_0xe9db('0x31')]);_0x49675b['offset']=qs[_0xe9db('0x30')](_0x595630[_0xe9db('0x42')][_0xe9db('0x30')]);}return _0x59ac48[_0xe9db('0x5f')](_0x49675b);}})[_0xe9db('0x37')](function(_0x3dabb4){if(_0x3dabb4){return _0x3dabb4?{'count':_0x3fcb2d,'rows':_0x3dabb4}:null;}})['then'](respondWithResult(_0x1723fb,null))[_0xe9db('0x2a')](handleError(_0x1723fb,null));}; \ No newline at end of file +var _0xab26=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','name','send','map','VtigerConfiguration','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','sort','filter','where','merge','VIRTUAL','count','include','show','params','includeAll','options','find','create','body','findOne','VtigerField','pick','getFields','hasOwnProperty','nolimit','order','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x57a8f,_0x490836){var _0x3d67aa=function(_0x113a40){while(--_0x113a40){_0x57a8f['push'](_0x57a8f['shift']());}};_0x3d67aa(++_0x490836);}(_0xab26,0x196));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0x6ab2('0x0'));var emlformat=require(_0x6ab2('0x1'));var rimraf=require(_0x6ab2('0x2'));var zipdir=require(_0x6ab2('0x3'));var jsonpatch=require(_0x6ab2('0x4'));var rp=require('request-promise');var moment=require(_0x6ab2('0x5'));var BPromise=require(_0x6ab2('0x6'));var Mustache=require(_0x6ab2('0x7'));var util=require(_0x6ab2('0x8'));var path=require(_0x6ab2('0x9'));var sox=require(_0x6ab2('0xa'));var csv=require(_0x6ab2('0xb'));var ejs=require(_0x6ab2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ab2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ab2('0xb'));var querystring=require(_0x6ab2('0xe'));var Papa=require(_0x6ab2('0xf'));var Redis=require(_0x6ab2('0x10'));var authService=require(_0x6ab2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab2('0x12'));var logger=require('../../config/logger')(_0x6ab2('0x13'));var utils=require('../../config/utils');var config=require(_0x6ab2('0x14'));var licenseUtil=require(_0x6ab2('0x15'));var db=require(_0x6ab2('0x16'))['db'];var jayson=require(_0x6ab2('0x17'));var client=jayson[_0x6ab2('0x18')][_0x6ab2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4744dd,_0x277d8b,_0x2cb047,_0x57a1a2){return new BPromise(function(_0x4b9aa3,_0x3e7e56){var _0x16d83c=_0x57a1a2||client;return _0x16d83c[_0x6ab2('0x1a')](_0x4744dd,_0x2cb047)['then'](function(_0x462849){logger[_0x6ab2('0x1b')](_0x6ab2('0x1c'),_0x277d8b,_0x6ab2('0x1d'));logger['debug'](_0x6ab2('0x1e'),_0x277d8b,_0x6ab2('0x1d'),JSON['stringify'](_0x462849));if(_0x462849[_0x6ab2('0x1f')]){if(_0x462849[_0x6ab2('0x1f')]['code']===0x1f4){logger[_0x6ab2('0x1f')](_0x6ab2('0x1c'),_0x277d8b,_0x462849[_0x6ab2('0x1f')]['message']);return _0x3e7e56(_0x462849[_0x6ab2('0x1f')]['message']);}logger[_0x6ab2('0x1f')](_0x6ab2('0x1c'),_0x277d8b,_0x462849[_0x6ab2('0x1f')][_0x6ab2('0x20')]);return _0x4b9aa3(_0x462849[_0x6ab2('0x1f')]['message']);}else{logger['info'](_0x6ab2('0x1c'),_0x277d8b,_0x6ab2('0x1d'));_0x4b9aa3(_0x462849['result'][_0x6ab2('0x20')]);}})[_0x6ab2('0x21')](function(_0x4863da){logger[_0x6ab2('0x1f')](_0x6ab2('0x1c'),_0x277d8b,_0x4863da);_0x3e7e56(_0x4863da);});});}function respondWithStatusCode(_0x309b06,_0x472f61){_0x472f61=_0x472f61||0xcc;return function(_0x172339){if(_0x172339){return _0x309b06[_0x6ab2('0x22')](_0x472f61);}return _0x309b06[_0x6ab2('0x23')](_0x472f61)[_0x6ab2('0x24')]();};}function respondWithResult(_0x38010d,_0x5b4266){_0x5b4266=_0x5b4266||0xc8;return function(_0x2e8406){if(_0x2e8406){return _0x38010d['status'](_0x5b4266)[_0x6ab2('0x25')](_0x2e8406);}};}function respondWithFilteredResult(_0x2224b3,_0x4d85cd){return function(_0x3cdc0d){if(_0x3cdc0d){var _0x48f086=_0x3cdc0d['count'],_0x395119=_0x4d85cd[_0x6ab2('0x26')],_0x37cd34=_0x4d85cd[_0x6ab2('0x26')]+_0x4d85cd[_0x6ab2('0x27')],_0x352fc4;if(_0x37cd34>=_0x48f086){_0x37cd34=_0x48f086;_0x352fc4=0xc8;}else{_0x352fc4=0xce;}_0x2224b3[_0x6ab2('0x23')](_0x352fc4);return _0x2224b3[_0x6ab2('0x28')]('Content-Range',_0x395119+'-'+_0x37cd34+'/'+_0x48f086)['json'](_0x3cdc0d);}return null;};}function patchUpdates(_0xc70f31){return function(_0x58cca4){try{jsonpatch[_0x6ab2('0x29')](_0x58cca4,_0xc70f31,!![]);}catch(_0x4a0b5b){return BPromise[_0x6ab2('0x2a')](_0x4a0b5b);}return _0x58cca4[_0x6ab2('0x2b')]();};}function saveUpdates(_0x218f2e,_0x1429c2){return function(_0x3a1043){if(_0x3a1043){return _0x3a1043[_0x6ab2('0x2c')](_0x218f2e)[_0x6ab2('0x2d')](function(_0x4007dd){return _0x4007dd;});}return null;};}function removeEntity(_0x538b8c,_0x22a540){return function(_0xb0646){if(_0xb0646){return _0xb0646[_0x6ab2('0x2e')]()[_0x6ab2('0x2d')](function(){_0x538b8c['status'](0xcc)[_0x6ab2('0x24')]();});}};}function handleEntityNotFound(_0x1543f1,_0x131da8){return function(_0x3fc1e1){if(!_0x3fc1e1){_0x1543f1[_0x6ab2('0x22')](0x194);}return _0x3fc1e1;};}function handleError(_0x3c7894,_0x275e8a){_0x275e8a=_0x275e8a||0x1f4;return function(_0x1beac7){logger[_0x6ab2('0x1f')](_0x1beac7['stack']);if(_0x1beac7[_0x6ab2('0x2f')]){delete _0x1beac7[_0x6ab2('0x2f')];}_0x3c7894[_0x6ab2('0x23')](_0x275e8a)[_0x6ab2('0x30')](_0x1beac7);};}exports['index']=function(_0x50f90b,_0x3f2b05){var _0x200d53={},_0x1f6223={},_0x550e73={'count':0x0,'rows':[]};var _0x599e79=_[_0x6ab2('0x31')](db[_0x6ab2('0x32')][_0x6ab2('0x33')],function(_0x4a5ce){return{'name':_0x4a5ce['fieldName'],'type':_0x4a5ce[_0x6ab2('0x34')][_0x6ab2('0x35')]};});_0x1f6223[_0x6ab2('0x36')]=_['map'](_0x599e79,_0x6ab2('0x2f'));_0x1f6223['query']=_[_0x6ab2('0x37')](_0x50f90b['query']);_0x1f6223[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x1f6223[_0x6ab2('0x36')],_0x1f6223[_0x6ab2('0x3a')]);_0x200d53[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x1f6223[_0x6ab2('0x36')],qs['fields'](_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x3c')]));_0x200d53[_0x6ab2('0x3b')]=_0x200d53['attributes'][_0x6ab2('0x3d')]?_0x200d53['attributes']:_0x1f6223[_0x6ab2('0x36')];if(!_0x50f90b[_0x6ab2('0x3a')]['hasOwnProperty']('nolimit')){_0x200d53[_0x6ab2('0x27')]=qs[_0x6ab2('0x27')](_0x50f90b[_0x6ab2('0x3a')]['limit']);_0x200d53[_0x6ab2('0x26')]=qs[_0x6ab2('0x26')](_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x26')]);}_0x200d53['order']=qs[_0x6ab2('0x3e')](_0x50f90b['query']['sort']);_0x200d53['where']=qs[_0x6ab2('0x38')](_['pick'](_0x50f90b['query'],_0x1f6223[_0x6ab2('0x38')]),_0x599e79);if(_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x200d53[_0x6ab2('0x40')]=_[_0x6ab2('0x41')](_0x200d53[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x31')](_0x599e79,function(_0x8208e0){if(_0x8208e0[_0x6ab2('0x34')]!==_0x6ab2('0x42')){var _0x31488d={};_0x31488d[_0x8208e0['name']]={'$like':'%'+_0x50f90b[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0x31488d;}})});}_0x200d53=_[_0x6ab2('0x41')]({},_0x200d53,_0x50f90b['options']);var _0x584c71={'where':_0x200d53[_0x6ab2('0x40')]};return db[_0x6ab2('0x32')][_0x6ab2('0x43')](_0x584c71)['then'](function(_0x324c99){_0x550e73[_0x6ab2('0x43')]=_0x324c99;if(_0x50f90b[_0x6ab2('0x3a')]['includeAll']){_0x200d53[_0x6ab2('0x44')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x200d53);})[_0x6ab2('0x2d')](function(_0x2e00e9){_0x550e73['rows']=_0x2e00e9;return _0x550e73;})[_0x6ab2('0x2d')](respondWithFilteredResult(_0x3f2b05,_0x200d53))[_0x6ab2('0x21')](handleError(_0x3f2b05,null));};exports[_0x6ab2('0x45')]=function(_0x49d5f8,_0x4971c4){var _0x457e9a={'raw':![],'where':{'id':_0x49d5f8[_0x6ab2('0x46')]['id']}},_0x41aec5={};_0x41aec5['model']=_[_0x6ab2('0x37')](db[_0x6ab2('0x32')][_0x6ab2('0x33')]);_0x41aec5['query']=_[_0x6ab2('0x37')](_0x49d5f8[_0x6ab2('0x3a')]);_0x41aec5[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x41aec5[_0x6ab2('0x36')],_0x41aec5['query']);_0x457e9a[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x41aec5['model'],qs[_0x6ab2('0x3c')](_0x49d5f8[_0x6ab2('0x3a')][_0x6ab2('0x3c')]));_0x457e9a[_0x6ab2('0x3b')]=_0x457e9a[_0x6ab2('0x3b')][_0x6ab2('0x3d')]?_0x457e9a[_0x6ab2('0x3b')]:_0x41aec5[_0x6ab2('0x36')];if(_0x49d5f8[_0x6ab2('0x3a')][_0x6ab2('0x47')]){_0x457e9a['include']=[{'all':!![]}];}_0x457e9a=_[_0x6ab2('0x41')]({},_0x457e9a,_0x49d5f8[_0x6ab2('0x48')]);return db[_0x6ab2('0x32')][_0x6ab2('0x49')](_0x457e9a)[_0x6ab2('0x2d')](handleEntityNotFound(_0x4971c4,null))[_0x6ab2('0x2d')](respondWithResult(_0x4971c4,null))[_0x6ab2('0x21')](handleError(_0x4971c4,null));};exports['create']=function(_0x448c35,_0x1e89d2){return db['VtigerConfiguration'][_0x6ab2('0x4a')](_0x448c35[_0x6ab2('0x4b')],{})[_0x6ab2('0x2d')](respondWithResult(_0x1e89d2,0xc9))[_0x6ab2('0x21')](handleError(_0x1e89d2,null));};exports[_0x6ab2('0x2c')]=function(_0x3df106,_0x463d46){if(_0x3df106[_0x6ab2('0x4b')]['id']){delete _0x3df106[_0x6ab2('0x4b')]['id'];}return db['VtigerConfiguration'][_0x6ab2('0x49')]({'where':{'id':_0x3df106[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x463d46,null))[_0x6ab2('0x2d')](saveUpdates(_0x3df106[_0x6ab2('0x4b')],null))[_0x6ab2('0x2d')](respondWithResult(_0x463d46,null))['catch'](handleError(_0x463d46,null));};exports[_0x6ab2('0x2e')]=function(_0x214189,_0x1be5c6){return db['VtigerConfiguration'][_0x6ab2('0x49')]({'where':{'id':_0x214189[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x1be5c6,null))['then'](removeEntity(_0x1be5c6,null))[_0x6ab2('0x21')](handleError(_0x1be5c6,null));};exports['getFields']=function(_0x1d754d,_0x1586d7,_0x40cbd8){var _0x4198d6={};var _0x3ccd50={};var _0x88b7a;var _0x239eda;return db[_0x6ab2('0x32')][_0x6ab2('0x4c')]({'where':{'id':_0x1d754d[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x1586d7,null))[_0x6ab2('0x2d')](function(_0x499f43){if(_0x499f43){_0x88b7a=_0x499f43;_0x3ccd50[_0x6ab2('0x36')]=_['keys'](db[_0x6ab2('0x4d')][_0x6ab2('0x33')]);_0x3ccd50['query']=_[_0x6ab2('0x37')](_0x1d754d['query']);_0x3ccd50[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x3ccd50[_0x6ab2('0x36')],_0x3ccd50['query']);_0x4198d6[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x3ccd50[_0x6ab2('0x36')],qs[_0x6ab2('0x3c')](_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x3c')]));_0x4198d6[_0x6ab2('0x3b')]=_0x4198d6[_0x6ab2('0x3b')][_0x6ab2('0x3d')]?_0x4198d6[_0x6ab2('0x3b')]:_0x3ccd50['model'];_0x4198d6['order']=qs[_0x6ab2('0x3e')](_0x1d754d['query'][_0x6ab2('0x3e')]);_0x4198d6[_0x6ab2('0x40')]=qs[_0x6ab2('0x38')](_[_0x6ab2('0x4e')](_0x1d754d['query'],_0x3ccd50[_0x6ab2('0x38')]));if(_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x4198d6[_0x6ab2('0x40')]=_[_0x6ab2('0x41')](_0x4198d6['where'],{'$or':_['map'](_0x4198d6[_0x6ab2('0x3b')],function(_0x36c150){var _0x4a4ce6={};_0x4a4ce6[_0x36c150]={'$like':'%'+_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0x4a4ce6;})});}_0x4198d6=_[_0x6ab2('0x41')]({},_0x4198d6,_0x1d754d['options']);return _0x88b7a[_0x6ab2('0x4f')](_0x4198d6);}})[_0x6ab2('0x2d')](function(_0x2edfb2){if(_0x2edfb2){_0x239eda=_0x2edfb2[_0x6ab2('0x3d')];if(!_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x50')](_0x6ab2('0x51'))){_0x4198d6[_0x6ab2('0x27')]=qs['limit'](_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x27')]);_0x4198d6['offset']=qs[_0x6ab2('0x26')](_0x1d754d[_0x6ab2('0x3a')][_0x6ab2('0x26')]);}return _0x88b7a[_0x6ab2('0x4f')](_0x4198d6);}})['then'](function(_0x33984a){if(_0x33984a){return _0x33984a?{'count':_0x239eda,'rows':_0x33984a}:null;}})[_0x6ab2('0x2d')](respondWithResult(_0x1586d7,null))[_0x6ab2('0x21')](handleError(_0x1586d7,null));};exports['getSubjects']=function(_0x49efae,_0x2bb83e,_0x50eb60){var _0x1615fb={};var _0x4205d8={};var _0x241963;var _0x167c36;return db[_0x6ab2('0x32')][_0x6ab2('0x4c')]({'where':{'id':_0x49efae[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x2bb83e,null))[_0x6ab2('0x2d')](function(_0x443dfc){if(_0x443dfc){_0x241963=_0x443dfc;_0x4205d8['model']=_[_0x6ab2('0x37')](db[_0x6ab2('0x4d')][_0x6ab2('0x33')]);_0x4205d8[_0x6ab2('0x3a')]=_[_0x6ab2('0x37')](_0x49efae[_0x6ab2('0x3a')]);_0x4205d8['filters']=_[_0x6ab2('0x39')](_0x4205d8[_0x6ab2('0x36')],_0x4205d8['query']);_0x1615fb[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x4205d8[_0x6ab2('0x36')],qs['fields'](_0x49efae[_0x6ab2('0x3a')]['fields']));_0x1615fb[_0x6ab2('0x3b')]=_0x1615fb[_0x6ab2('0x3b')]['length']?_0x1615fb['attributes']:_0x4205d8[_0x6ab2('0x36')];_0x1615fb[_0x6ab2('0x52')]=qs[_0x6ab2('0x3e')](_0x49efae['query']['sort']);_0x1615fb[_0x6ab2('0x40')]=qs['filters'](_[_0x6ab2('0x4e')](_0x49efae[_0x6ab2('0x3a')],_0x4205d8[_0x6ab2('0x38')]));if(_0x49efae[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x1615fb[_0x6ab2('0x40')]=_[_0x6ab2('0x41')](_0x1615fb[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x31')](_0x1615fb[_0x6ab2('0x3b')],function(_0x17bf4a){var _0x103f10={};_0x103f10[_0x17bf4a]={'$like':'%'+_0x49efae[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0x103f10;})});}_0x1615fb=_[_0x6ab2('0x41')]({},_0x1615fb,_0x49efae['options']);return _0x241963['getSubjects'](_0x1615fb);}})['then'](function(_0x81a464){if(_0x81a464){_0x167c36=_0x81a464['length'];if(!_0x49efae[_0x6ab2('0x3a')][_0x6ab2('0x50')](_0x6ab2('0x51'))){_0x1615fb[_0x6ab2('0x27')]=qs[_0x6ab2('0x27')](_0x49efae['query'][_0x6ab2('0x27')]);_0x1615fb[_0x6ab2('0x26')]=qs[_0x6ab2('0x26')](_0x49efae[_0x6ab2('0x3a')]['offset']);}return _0x241963['getSubjects'](_0x1615fb);}})[_0x6ab2('0x2d')](function(_0xae44f6){if(_0xae44f6){return _0xae44f6?{'count':_0x167c36,'rows':_0xae44f6}:null;}})[_0x6ab2('0x2d')](respondWithResult(_0x2bb83e,null))[_0x6ab2('0x21')](handleError(_0x2bb83e,null));};exports['getDescriptions']=function(_0x15fecb,_0x242313,_0x4182ec){var _0x206657={};var _0x4595dc={};var _0x28deae;var _0x332f51;return db['VtigerConfiguration'][_0x6ab2('0x4c')]({'where':{'id':_0x15fecb[_0x6ab2('0x46')]['id']}})[_0x6ab2('0x2d')](handleEntityNotFound(_0x242313,null))['then'](function(_0x14e38f){if(_0x14e38f){_0x28deae=_0x14e38f;_0x4595dc['model']=_['keys'](db[_0x6ab2('0x4d')][_0x6ab2('0x33')]);_0x4595dc[_0x6ab2('0x3a')]=_[_0x6ab2('0x37')](_0x15fecb[_0x6ab2('0x3a')]);_0x4595dc[_0x6ab2('0x38')]=_[_0x6ab2('0x39')](_0x4595dc[_0x6ab2('0x36')],_0x4595dc[_0x6ab2('0x3a')]);_0x206657[_0x6ab2('0x3b')]=_[_0x6ab2('0x39')](_0x4595dc[_0x6ab2('0x36')],qs[_0x6ab2('0x3c')](_0x15fecb['query'][_0x6ab2('0x3c')]));_0x206657[_0x6ab2('0x3b')]=_0x206657[_0x6ab2('0x3b')][_0x6ab2('0x3d')]?_0x206657[_0x6ab2('0x3b')]:_0x4595dc[_0x6ab2('0x36')];_0x206657[_0x6ab2('0x52')]=qs['sort'](_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x3e')]);_0x206657[_0x6ab2('0x40')]=qs[_0x6ab2('0x38')](_[_0x6ab2('0x4e')](_0x15fecb[_0x6ab2('0x3a')],_0x4595dc['filters']));if(_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x3f')]){_0x206657['where']=_[_0x6ab2('0x41')](_0x206657[_0x6ab2('0x40')],{'$or':_[_0x6ab2('0x31')](_0x206657['attributes'],function(_0x263e68){var _0xa798ad={};_0xa798ad[_0x263e68]={'$like':'%'+_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x3f')]+'%'};return _0xa798ad;})});}_0x206657=_['merge']({},_0x206657,_0x15fecb[_0x6ab2('0x48')]);return _0x28deae[_0x6ab2('0x53')](_0x206657);}})[_0x6ab2('0x2d')](function(_0x3e56be){if(_0x3e56be){_0x332f51=_0x3e56be['length'];if(!_0x15fecb['query'][_0x6ab2('0x50')](_0x6ab2('0x51'))){_0x206657[_0x6ab2('0x27')]=qs[_0x6ab2('0x27')](_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x27')]);_0x206657[_0x6ab2('0x26')]=qs[_0x6ab2('0x26')](_0x15fecb[_0x6ab2('0x3a')][_0x6ab2('0x26')]);}return _0x28deae['getDescriptions'](_0x206657);}})[_0x6ab2('0x2d')](function(_0x1a3156){if(_0x1a3156){return _0x1a3156?{'count':_0x332f51,'rows':_0x1a3156}:null;}})['then'](respondWithResult(_0x242313,null))[_0x6ab2('0x21')](handleError(_0x242313,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9993926..79689b7 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 _0x98e4=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','moment'];(function(_0x2f51ef,_0x33104a){var _0x1ef732=function(_0x2b023b){while(--_0x2b023b){_0x2f51ef['push'](_0x2f51ef['shift']());}};_0x1ef732(++_0x33104a);}(_0x98e4,0xe7));var _0x498e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x98e4[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x498e('0x0'))(_0x498e('0x1'));var moment=require(_0x498e('0x2'));var BPromise=require(_0x498e('0x3'));var rp=require(_0x498e('0x4'));var fs=require('fs');var path=require(_0x498e('0x5'));var rimraf=require(_0x498e('0x6'));var config=require(_0x498e('0x7'));var attributes=require(_0x498e('0x8'));module[_0x498e('0x9')]=function(_0x3a76ff,_0x46e946){return _0x3a76ff[_0x498e('0xa')](_0x498e('0xb'),attributes,{'tableName':_0x498e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0daa=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x8e0cc0,_0x2df700){var _0x54b84f=function(_0x39daf8){while(--_0x39daf8){_0x8e0cc0['push'](_0x8e0cc0['shift']());}};_0x54b84f(++_0x2df700);}(_0x0daa,0x1eb));var _0xa0da=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0daa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa0da('0x0'));var util=require(_0xa0da('0x1'));var logger=require(_0xa0da('0x2'))('api');var moment=require(_0xa0da('0x3'));var BPromise=require(_0xa0da('0x4'));var rp=require(_0xa0da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0da('0x6'));var config=require(_0xa0da('0x7'));var attributes=require(_0xa0da('0x8'));module[_0xa0da('0x9')]=function(_0x354af1,_0x4b56f7){return _0x354af1[_0xa0da('0xa')](_0xa0da('0xb'),attributes,{'tableName':_0xa0da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 6cf73bb..c8dc898 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 _0xc568=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x1fdf50,_0x4216f3){var _0x1c3b73=function(_0x3ab674){while(--_0x3ab674){_0x1fdf50['push'](_0x1fdf50['shift']());}};_0x1c3b73(++_0x4216f3);}(_0xc568,0x14a));var _0x8c56=function(_0x13e998,_0x110473){_0x13e998=_0x13e998-0x0;var _0x155462=_0xc568[_0x13e998];return _0x155462;};'use strict';var _=require('lodash');var util=require(_0x8c56('0x0'));var moment=require(_0x8c56('0x1'));var BPromise=require(_0x8c56('0x2'));var rs=require(_0x8c56('0x3'));var fs=require('fs');var Redis=require(_0x8c56('0x4'));var db=require(_0x8c56('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c56('0x6'));var config=require(_0x8c56('0x7'));var jayson=require(_0x8c56('0x8'));var client=jayson[_0x8c56('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b6405,_0x4a208c,_0x3bc925){return new BPromise(function(_0x2d6d70,_0x4e903d){return client[_0x8c56('0xa')](_0x1b6405,_0x3bc925)[_0x8c56('0xb')](function(_0x3ec523){logger[_0x8c56('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x4a208c,_0x8c56('0xd'));logger[_0x8c56('0xe')](_0x8c56('0xf'),_0x4a208c,_0x8c56('0xd'),JSON['stringify'](_0x3ec523));if(_0x3ec523['error']){if(_0x3ec523[_0x8c56('0x10')][_0x8c56('0x11')]===0x1f4){logger[_0x8c56('0x10')](_0x8c56('0x12'),_0x4a208c,_0x3ec523[_0x8c56('0x10')]['message']);return _0x4e903d(_0x3ec523[_0x8c56('0x10')]['message']);}logger['error'](_0x8c56('0x12'),_0x4a208c,_0x3ec523['error'][_0x8c56('0x13')]);return _0x2d6d70(_0x3ec523[_0x8c56('0x10')][_0x8c56('0x13')]);}else{logger[_0x8c56('0xc')](_0x8c56('0x12'),_0x4a208c,_0x8c56('0xd'));_0x2d6d70(_0x3ec523[_0x8c56('0x14')][_0x8c56('0x13')]);}})[_0x8c56('0x15')](function(_0x38c751){logger[_0x8c56('0x10')](_0x8c56('0x12'),_0x4a208c,_0x38c751);_0x4e903d(_0x38c751);});});} \ No newline at end of file +var _0x2dd1=['jayson/promise','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13a03e,_0x5c45d4){var _0x1bad9f=function(_0x40cb4b){while(--_0x40cb4b){_0x13a03e['push'](_0x13a03e['shift']());}};_0x1bad9f(++_0x5c45d4);}(_0x2dd1,0x15c));var _0x12dd=function(_0x2c7c79,_0x24027c){_0x2c7c79=_0x2c7c79-0x0;var _0x6ddb2e=_0x2dd1[_0x2c7c79];return _0x6ddb2e;};'use strict';var _=require(_0x12dd('0x0'));var util=require(_0x12dd('0x1'));var moment=require(_0x12dd('0x2'));var BPromise=require(_0x12dd('0x3'));var rs=require(_0x12dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12dd('0x5'))['db'];var utils=require(_0x12dd('0x6'));var logger=require(_0x12dd('0x7'))(_0x12dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x12dd('0x9'));var client=jayson['client'][_0x12dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d2bc,_0x1c6100,_0x31901e){return new BPromise(function(_0x16abed,_0x3853b5){return client['request'](_0x10d2bc,_0x31901e)[_0x12dd('0xb')](function(_0x5b4d27){logger['info'](_0x12dd('0xc'),_0x1c6100,'request\x20sent');logger[_0x12dd('0xd')](_0x12dd('0xe'),_0x1c6100,_0x12dd('0xf'),JSON['stringify'](_0x5b4d27));if(_0x5b4d27['error']){if(_0x5b4d27[_0x12dd('0x10')][_0x12dd('0x11')]===0x1f4){logger[_0x12dd('0x10')](_0x12dd('0xc'),_0x1c6100,_0x5b4d27[_0x12dd('0x10')][_0x12dd('0x12')]);return _0x3853b5(_0x5b4d27[_0x12dd('0x10')]['message']);}logger[_0x12dd('0x10')](_0x12dd('0xc'),_0x1c6100,_0x5b4d27[_0x12dd('0x10')]['message']);return _0x16abed(_0x5b4d27[_0x12dd('0x10')]['message']);}else{logger[_0x12dd('0x13')](_0x12dd('0xc'),_0x1c6100,_0x12dd('0xf'));_0x16abed(_0x5b4d27[_0x12dd('0x14')][_0x12dd('0x12')]);}})['catch'](function(_0x5e6b38){logger[_0x12dd('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c6100,_0x5e6b38);_0x3853b5(_0x5e6b38);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e65a572..a35fd18 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 _0xf161=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x3117c6,_0x1975e5){var _0x33da11=function(_0x34228a){while(--_0x34228a){_0x3117c6['push'](_0x3117c6['shift']());}};_0x33da11(++_0x1975e5);}(_0xf161,0x137));var _0x1f16=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf161[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var path=require(_0x1f16('0x2'));var timeout=require(_0x1f16('0x3'));var express=require(_0x1f16('0x4'));var router=express['Router']();var auth=require(_0x1f16('0x5'));var interaction=require(_0x1f16('0x6'));var config=require(_0x1f16('0x7'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x1f16('0x8')](),controller[_0x1f16('0x9')]);router[_0x1f16('0xa')](_0x1f16('0xb'),auth[_0x1f16('0x8')](),controller[_0x1f16('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1f16('0xd')](_0x1f16('0xb'),auth[_0x1f16('0x8')](),controller[_0x1f16('0xe')]);router[_0x1f16('0xf')](_0x1f16('0xb'),auth['isAuthenticated'](),controller[_0x1f16('0x10')]);module[_0x1f16('0x11')]=router; \ No newline at end of file +var _0xfb0a=['multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get','show','post','create','put','/:id','exports'];(function(_0x45c5ae,_0x30be9){var _0x2a46db=function(_0xa85828){while(--_0xa85828){_0x45c5ae['push'](_0x45c5ae['shift']());}};_0x2a46db(++_0x30be9);}(_0xfb0a,0xd2));var _0xafb0=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xfb0a[_0x43f881];return _0x365c14;};'use strict';var multer=require(_0xafb0('0x0'));var util=require('util');var path=require(_0xafb0('0x1'));var timeout=require(_0xafb0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xafb0('0x3'));var interaction=require(_0xafb0('0x4'));var config=require(_0xafb0('0x5'));var controller=require(_0xafb0('0x6'));router['get']('/',auth[_0xafb0('0x7')](),controller['index']);router[_0xafb0('0x8')]('/:id',auth[_0xafb0('0x7')](),controller[_0xafb0('0x9')]);router[_0xafb0('0xa')]('/',auth[_0xafb0('0x7')](),controller[_0xafb0('0xb')]);router[_0xafb0('0xc')](_0xafb0('0xd'),auth[_0xafb0('0x7')](),controller['update']);router['delete'](_0xafb0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xafb0('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4e22b48..23f2b14 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 _0x1928=['variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x250b98,_0x3b0ae0){var _0x8d07ea=function(_0x2b2cb1){while(--_0x2b2cb1){_0x250b98['push'](_0x250b98['shift']());}};_0x8d07ea(++_0x3b0ae0);}(_0x1928,0x138));var _0x8192=function(_0x2d9f01,_0x6c14e0){_0x2d9f01=_0x2d9f01-0x0;var _0x1eaa12=_0x1928[_0x2d9f01];return _0x1eaa12;};'use strict';var Sequelize=require(_0x8192('0x0'));module[_0x8192('0x1')]={'type':{'type':Sequelize[_0x8192('0x2')]('string',_0x8192('0x3'),_0x8192('0x4'),_0x8192('0x5')),'defaultValue':_0x8192('0x6')},'content':{'type':Sequelize[_0x8192('0x7')]},'key':{'type':Sequelize[_0x8192('0x7')]},'keyType':{'type':Sequelize[_0x8192('0x2')](_0x8192('0x6'),_0x8192('0x3'),_0x8192('0x4'))},'keyContent':{'type':Sequelize[_0x8192('0x7')]},'idField':{'type':Sequelize[_0x8192('0x7')]},'nameField':{'type':Sequelize[_0x8192('0x7')]},'customField':{'type':Sequelize[_0x8192('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd01a=['string','customVariable','keyValue','variable','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x4bc98b,_0x356c04){var _0x4308ee=function(_0x2d163d){while(--_0x2d163d){_0x4bc98b['push'](_0x4bc98b['shift']());}};_0x4308ee(++_0x356c04);}(_0xd01a,0x1ae));var _0xad01=function(_0x3ed0e0,_0x48547e){_0x3ed0e0=_0x3ed0e0-0x0;var _0x5c6628=_0xd01a[_0x3ed0e0];return _0x5c6628;};'use strict';var Sequelize=require(_0xad01('0x0'));module['exports']={'type':{'type':Sequelize[_0xad01('0x1')](_0xad01('0x2'),'variable',_0xad01('0x3'),_0xad01('0x4')),'defaultValue':_0xad01('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xad01('0x1')](_0xad01('0x2'),_0xad01('0x5'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xad01('0x6')]},'nameField':{'type':Sequelize[_0xad01('0x6')]},'customField':{'type':Sequelize[_0xad01('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad01('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0a8a22f..b6cc1c8 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 _0x6657=['destroy','sendStatus','name','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x6657,0x17f));var _0x7665=function(_0x4d33ff,_0x22cfff){_0x4d33ff=_0x4d33ff-0x0;var _0x60a1a9=_0x6657[_0x4d33ff];return _0x60a1a9;};'use strict';var pdf=require(_0x7665('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7665('0x1'));var zipdir=require(_0x7665('0x2'));var jsonpatch=require(_0x7665('0x3'));var rp=require(_0x7665('0x4'));var moment=require('moment');var BPromise=require(_0x7665('0x5'));var Mustache=require(_0x7665('0x6'));var util=require(_0x7665('0x7'));var path=require(_0x7665('0x8'));var sox=require(_0x7665('0x9'));var csv=require(_0x7665('0xa'));var ejs=require(_0x7665('0xb'));var fs=require('fs');var _=require(_0x7665('0xc'));var squel=require('squel');var crypto=require(_0x7665('0xd'));var jsforce=require(_0x7665('0xe'));var deskjs=require(_0x7665('0xf'));var toCsv=require(_0x7665('0xa'));var querystring=require(_0x7665('0x10'));var Papa=require(_0x7665('0x11'));var Redis=require(_0x7665('0x12'));var authService=require(_0x7665('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7665('0x14'));var hardwareService=require(_0x7665('0x15'));var logger=require(_0x7665('0x16'))('api');var utils=require(_0x7665('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7665('0x18'));var db=require(_0x7665('0x19'))['db'];function respondWithStatusCode(_0x4a346f,_0xb56a8e){_0xb56a8e=_0xb56a8e||0xcc;return function(_0x2e8dda){if(_0x2e8dda){return _0x4a346f['sendStatus'](_0xb56a8e);}return _0x4a346f[_0x7665('0x1a')](_0xb56a8e)[_0x7665('0x1b')]();};}function respondWithResult(_0x4e75c2,_0x42c571){_0x42c571=_0x42c571||0xc8;return function(_0x311e63){if(_0x311e63){return _0x4e75c2[_0x7665('0x1a')](_0x42c571)[_0x7665('0x1c')](_0x311e63);}};}function respondWithFilteredResult(_0x2719c0,_0x331d8c){return function(_0x308e5c){if(_0x308e5c){var _0x3fb8cb=_0x308e5c[_0x7665('0x1d')],_0x3b270e=_0x331d8c[_0x7665('0x1e')],_0x334ee6=_0x331d8c[_0x7665('0x1e')]+_0x331d8c[_0x7665('0x1f')],_0x365469;if(_0x334ee6>=_0x3fb8cb){_0x334ee6=_0x3fb8cb;_0x365469=0xc8;}else{_0x365469=0xce;}_0x2719c0[_0x7665('0x1a')](_0x365469);return _0x2719c0['set'](_0x7665('0x20'),_0x3b270e+'-'+_0x334ee6+'/'+_0x3fb8cb)[_0x7665('0x1c')](_0x308e5c);}return null;};}function patchUpdates(_0x4f1f1d){return function(_0x32b37a){try{jsonpatch[_0x7665('0x21')](_0x32b37a,_0x4f1f1d,!![]);}catch(_0x6dd715){return BPromise[_0x7665('0x22')](_0x6dd715);}return _0x32b37a['save']();};}function saveUpdates(_0x35ca0f,_0x1c0549){return function(_0x155c45){if(_0x155c45){return _0x155c45[_0x7665('0x23')](_0x35ca0f)[_0x7665('0x24')](function(_0x52cc46){return _0x52cc46;});}return null;};}function removeEntity(_0x1292a0,_0x51d577){return function(_0x37be5d){if(_0x37be5d){return _0x37be5d[_0x7665('0x25')]()['then'](function(){_0x1292a0['status'](0xcc)[_0x7665('0x1b')]();});}};}function handleEntityNotFound(_0x2b60dc,_0x4a9a25){return function(_0x2c54cc){if(!_0x2c54cc){_0x2b60dc[_0x7665('0x26')](0x194);}return _0x2c54cc;};}function handleError(_0xcc4a89,_0x488d86){_0x488d86=_0x488d86||0x1f4;return function(_0x5b5be6){logger['error'](_0x5b5be6['stack']);if(_0x5b5be6[_0x7665('0x27')]){delete _0x5b5be6[_0x7665('0x27')];}_0xcc4a89[_0x7665('0x1a')](_0x488d86)['send'](_0x5b5be6);};}exports[_0x7665('0x28')]=function(_0x383d06,_0x50bfa5){var _0x56b6e8={},_0x30bd99={},_0x45f6a4={'count':0x0,'rows':[]};var _0x4220c9=_[_0x7665('0x29')](db[_0x7665('0x2a')][_0x7665('0x2b')],function(_0x5891fb){return{'name':_0x5891fb[_0x7665('0x2c')],'type':_0x5891fb['type']['key']};});_0x30bd99[_0x7665('0x2d')]=_[_0x7665('0x29')](_0x4220c9,_0x7665('0x27'));_0x30bd99[_0x7665('0x2e')]=_[_0x7665('0x2f')](_0x383d06[_0x7665('0x2e')]);_0x30bd99[_0x7665('0x30')]=_[_0x7665('0x31')](_0x30bd99[_0x7665('0x2d')],_0x30bd99[_0x7665('0x2e')]);_0x56b6e8[_0x7665('0x32')]=_[_0x7665('0x31')](_0x30bd99[_0x7665('0x2d')],qs[_0x7665('0x33')](_0x383d06[_0x7665('0x2e')][_0x7665('0x33')]));_0x56b6e8[_0x7665('0x32')]=_0x56b6e8[_0x7665('0x32')][_0x7665('0x34')]?_0x56b6e8['attributes']:_0x30bd99[_0x7665('0x2d')];if(!_0x383d06[_0x7665('0x2e')][_0x7665('0x35')](_0x7665('0x36'))){_0x56b6e8[_0x7665('0x1f')]=qs[_0x7665('0x1f')](_0x383d06['query'][_0x7665('0x1f')]);_0x56b6e8[_0x7665('0x1e')]=qs[_0x7665('0x1e')](_0x383d06[_0x7665('0x2e')][_0x7665('0x1e')]);}_0x56b6e8['order']=qs[_0x7665('0x37')](_0x383d06['query'][_0x7665('0x37')]);_0x56b6e8['where']=qs[_0x7665('0x30')](_[_0x7665('0x38')](_0x383d06[_0x7665('0x2e')],_0x30bd99[_0x7665('0x30')]),_0x4220c9);if(_0x383d06[_0x7665('0x2e')][_0x7665('0x39')]){_0x56b6e8['where']=_[_0x7665('0x3a')](_0x56b6e8[_0x7665('0x3b')],{'$or':_[_0x7665('0x29')](_0x4220c9,function(_0x130ee6){if(_0x130ee6['type']!==_0x7665('0x3c')){var _0x22e94e={};_0x22e94e[_0x130ee6[_0x7665('0x27')]]={'$like':'%'+_0x383d06[_0x7665('0x2e')][_0x7665('0x39')]+'%'};return _0x22e94e;}})});}_0x56b6e8=_['merge']({},_0x56b6e8,_0x383d06[_0x7665('0x3d')]);var _0x341098={'where':_0x56b6e8[_0x7665('0x3b')]};return db[_0x7665('0x2a')][_0x7665('0x1d')](_0x341098)[_0x7665('0x24')](function(_0x301cee){_0x45f6a4[_0x7665('0x1d')]=_0x301cee;if(_0x383d06[_0x7665('0x2e')][_0x7665('0x3e')]){_0x56b6e8['include']=[{'all':!![]}];}return db['VtigerField'][_0x7665('0x3f')](_0x56b6e8);})[_0x7665('0x24')](function(_0x48e455){_0x45f6a4['rows']=_0x48e455;return _0x45f6a4;})[_0x7665('0x24')](respondWithFilteredResult(_0x50bfa5,_0x56b6e8))[_0x7665('0x40')](handleError(_0x50bfa5,null));};exports['show']=function(_0x3e7ee2,_0x2753c7){var _0x34a0ab={'raw':!![],'where':{'id':_0x3e7ee2[_0x7665('0x41')]['id']}},_0x30c992={};_0x30c992[_0x7665('0x2d')]=_[_0x7665('0x2f')](db[_0x7665('0x2a')][_0x7665('0x2b')]);_0x30c992[_0x7665('0x2e')]=_[_0x7665('0x2f')](_0x3e7ee2[_0x7665('0x2e')]);_0x30c992[_0x7665('0x30')]=_[_0x7665('0x31')](_0x30c992['model'],_0x30c992[_0x7665('0x2e')]);_0x34a0ab['attributes']=_[_0x7665('0x31')](_0x30c992[_0x7665('0x2d')],qs[_0x7665('0x33')](_0x3e7ee2[_0x7665('0x2e')][_0x7665('0x33')]));_0x34a0ab['attributes']=_0x34a0ab[_0x7665('0x32')][_0x7665('0x34')]?_0x34a0ab['attributes']:_0x30c992[_0x7665('0x2d')];if(_0x3e7ee2['query'][_0x7665('0x3e')]){_0x34a0ab[_0x7665('0x42')]=[{'all':!![]}];}_0x34a0ab=_[_0x7665('0x3a')]({},_0x34a0ab,_0x3e7ee2['options']);return db['VtigerField'][_0x7665('0x43')](_0x34a0ab)[_0x7665('0x24')](handleEntityNotFound(_0x2753c7,null))['then'](respondWithResult(_0x2753c7,null))[_0x7665('0x40')](handleError(_0x2753c7,null));};exports[_0x7665('0x44')]=function(_0x2bc404,_0x289b11){return db[_0x7665('0x2a')][_0x7665('0x44')](_0x2bc404[_0x7665('0x45')],{})[_0x7665('0x24')](respondWithResult(_0x289b11,0xc9))[_0x7665('0x40')](handleError(_0x289b11,null));};exports[_0x7665('0x23')]=function(_0x464a2b,_0x4a6b78){if(_0x464a2b[_0x7665('0x45')]['id']){delete _0x464a2b['body']['id'];}return db[_0x7665('0x2a')][_0x7665('0x43')]({'where':{'id':_0x464a2b[_0x7665('0x41')]['id']}})[_0x7665('0x24')](handleEntityNotFound(_0x4a6b78,null))['then'](saveUpdates(_0x464a2b[_0x7665('0x45')],null))[_0x7665('0x24')](respondWithResult(_0x4a6b78,null))[_0x7665('0x40')](handleError(_0x4a6b78,null));};exports[_0x7665('0x25')]=function(_0x69912d,_0x532740){return db[_0x7665('0x2a')]['find']({'where':{'id':_0x69912d[_0x7665('0x41')]['id']}})[_0x7665('0x24')](handleEntityNotFound(_0x532740,null))['then'](removeEntity(_0x532740,null))['catch'](handleError(_0x532740,null));}; \ No newline at end of file +var _0x199c=['stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','VtigerField','findAll','rows','params','fields','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x199c,0x1d8));var _0xc199=function(_0x4c69ca,_0x2e2245){_0x4c69ca=_0x4c69ca-0x0;var _0x2a6d65=_0x199c[_0x4c69ca];return _0x2a6d65;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc199('0x0'));var zipdir=require(_0xc199('0x1'));var jsonpatch=require(_0xc199('0x2'));var rp=require(_0xc199('0x3'));var moment=require(_0xc199('0x4'));var BPromise=require(_0xc199('0x5'));var Mustache=require(_0xc199('0x6'));var util=require(_0xc199('0x7'));var path=require('path');var sox=require(_0xc199('0x8'));var csv=require(_0xc199('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc199('0xa'));var crypto=require(_0xc199('0xb'));var jsforce=require(_0xc199('0xc'));var deskjs=require(_0xc199('0xd'));var toCsv=require(_0xc199('0x9'));var querystring=require(_0xc199('0xe'));var Papa=require(_0xc199('0xf'));var Redis=require(_0xc199('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc199('0x11'));var as=require(_0xc199('0x12'));var hardwareService=require(_0xc199('0x13'));var logger=require(_0xc199('0x14'))(_0xc199('0x15'));var utils=require(_0xc199('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc199('0x17'));var db=require(_0xc199('0x18'))['db'];function respondWithStatusCode(_0x34fde3,_0x13b4fa){_0x13b4fa=_0x13b4fa||0xcc;return function(_0x3c3cf9){if(_0x3c3cf9){return _0x34fde3['sendStatus'](_0x13b4fa);}return _0x34fde3[_0xc199('0x19')](_0x13b4fa)[_0xc199('0x1a')]();};}function respondWithResult(_0x67c1ed,_0x62f34e){_0x62f34e=_0x62f34e||0xc8;return function(_0x427698){if(_0x427698){return _0x67c1ed['status'](_0x62f34e)['json'](_0x427698);}};}function respondWithFilteredResult(_0x269ab4,_0x5a8e99){return function(_0x58d871){if(_0x58d871){var _0x3c4736=_0x58d871[_0xc199('0x1b')],_0x5a4381=_0x5a8e99[_0xc199('0x1c')],_0x445c65=_0x5a8e99[_0xc199('0x1c')]+_0x5a8e99[_0xc199('0x1d')],_0x4f268d;if(_0x445c65>=_0x3c4736){_0x445c65=_0x3c4736;_0x4f268d=0xc8;}else{_0x4f268d=0xce;}_0x269ab4[_0xc199('0x19')](_0x4f268d);return _0x269ab4[_0xc199('0x1e')](_0xc199('0x1f'),_0x5a4381+'-'+_0x445c65+'/'+_0x3c4736)[_0xc199('0x20')](_0x58d871);}return null;};}function patchUpdates(_0x2c953f){return function(_0x14e969){try{jsonpatch[_0xc199('0x21')](_0x14e969,_0x2c953f,!![]);}catch(_0x54babd){return BPromise[_0xc199('0x22')](_0x54babd);}return _0x14e969[_0xc199('0x23')]();};}function saveUpdates(_0xe0b173,_0x430e4c){return function(_0x4e176b){if(_0x4e176b){return _0x4e176b[_0xc199('0x24')](_0xe0b173)[_0xc199('0x25')](function(_0x381c94){return _0x381c94;});}return null;};}function removeEntity(_0x349dd9,_0x45873f){return function(_0x5c34e8){if(_0x5c34e8){return _0x5c34e8['destroy']()['then'](function(){_0x349dd9[_0xc199('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f576,_0x5cefd7){return function(_0x3bf1a5){if(!_0x3bf1a5){_0x30f576[_0xc199('0x26')](0x194);}return _0x3bf1a5;};}function handleError(_0x4e0306,_0x2d184d){_0x2d184d=_0x2d184d||0x1f4;return function(_0x838760){logger['error'](_0x838760[_0xc199('0x27')]);if(_0x838760['name']){delete _0x838760['name'];}_0x4e0306[_0xc199('0x19')](_0x2d184d)[_0xc199('0x28')](_0x838760);};}exports[_0xc199('0x29')]=function(_0x4d795f,_0x2ed565){var _0x138443={},_0x5bd0bc={},_0x2825c8={'count':0x0,'rows':[]};var _0x5ea29e=_[_0xc199('0x2a')](db['VtigerField'][_0xc199('0x2b')],function(_0x13e53e){return{'name':_0x13e53e[_0xc199('0x2c')],'type':_0x13e53e[_0xc199('0x2d')][_0xc199('0x2e')]};});_0x5bd0bc[_0xc199('0x2f')]=_[_0xc199('0x2a')](_0x5ea29e,_0xc199('0x30'));_0x5bd0bc['query']=_[_0xc199('0x31')](_0x4d795f[_0xc199('0x32')]);_0x5bd0bc[_0xc199('0x33')]=_['intersection'](_0x5bd0bc[_0xc199('0x2f')],_0x5bd0bc['query']);_0x138443['attributes']=_[_0xc199('0x34')](_0x5bd0bc[_0xc199('0x2f')],qs['fields'](_0x4d795f[_0xc199('0x32')]['fields']));_0x138443['attributes']=_0x138443[_0xc199('0x35')]['length']?_0x138443[_0xc199('0x35')]:_0x5bd0bc[_0xc199('0x2f')];if(!_0x4d795f[_0xc199('0x32')][_0xc199('0x36')](_0xc199('0x37'))){_0x138443['limit']=qs['limit'](_0x4d795f['query'][_0xc199('0x1d')]);_0x138443['offset']=qs[_0xc199('0x1c')](_0x4d795f[_0xc199('0x32')][_0xc199('0x1c')]);}_0x138443[_0xc199('0x38')]=qs[_0xc199('0x39')](_0x4d795f[_0xc199('0x32')][_0xc199('0x39')]);_0x138443[_0xc199('0x3a')]=qs[_0xc199('0x33')](_[_0xc199('0x3b')](_0x4d795f['query'],_0x5bd0bc['filters']),_0x5ea29e);if(_0x4d795f[_0xc199('0x32')][_0xc199('0x3c')]){_0x138443[_0xc199('0x3a')]=_[_0xc199('0x3d')](_0x138443[_0xc199('0x3a')],{'$or':_[_0xc199('0x2a')](_0x5ea29e,function(_0x3966d0){if(_0x3966d0[_0xc199('0x2d')]!=='VIRTUAL'){var _0x552467={};_0x552467[_0x3966d0['name']]={'$like':'%'+_0x4d795f[_0xc199('0x32')][_0xc199('0x3c')]+'%'};return _0x552467;}})});}_0x138443=_[_0xc199('0x3d')]({},_0x138443,_0x4d795f['options']);var _0x190877={'where':_0x138443[_0xc199('0x3a')]};return db['VtigerField'][_0xc199('0x1b')](_0x190877)[_0xc199('0x25')](function(_0x316766){_0x2825c8[_0xc199('0x1b')]=_0x316766;if(_0x4d795f['query'][_0xc199('0x3e')]){_0x138443[_0xc199('0x3f')]=[{'all':!![]}];}return db[_0xc199('0x40')][_0xc199('0x41')](_0x138443);})[_0xc199('0x25')](function(_0x2ffff7){_0x2825c8[_0xc199('0x42')]=_0x2ffff7;return _0x2825c8;})['then'](respondWithFilteredResult(_0x2ed565,_0x138443))['catch'](handleError(_0x2ed565,null));};exports['show']=function(_0x138448,_0x2e45d2){var _0x2089b5={'raw':!![],'where':{'id':_0x138448[_0xc199('0x43')]['id']}},_0xd464c3={};_0xd464c3['model']=_['keys'](db[_0xc199('0x40')][_0xc199('0x2b')]);_0xd464c3['query']=_['keys'](_0x138448[_0xc199('0x32')]);_0xd464c3[_0xc199('0x33')]=_['intersection'](_0xd464c3[_0xc199('0x2f')],_0xd464c3[_0xc199('0x32')]);_0x2089b5['attributes']=_[_0xc199('0x34')](_0xd464c3[_0xc199('0x2f')],qs[_0xc199('0x44')](_0x138448['query'][_0xc199('0x44')]));_0x2089b5[_0xc199('0x35')]=_0x2089b5[_0xc199('0x35')]['length']?_0x2089b5[_0xc199('0x35')]:_0xd464c3[_0xc199('0x2f')];if(_0x138448[_0xc199('0x32')]['includeAll']){_0x2089b5[_0xc199('0x3f')]=[{'all':!![]}];}_0x2089b5=_[_0xc199('0x3d')]({},_0x2089b5,_0x138448['options']);return db[_0xc199('0x40')][_0xc199('0x45')](_0x2089b5)[_0xc199('0x25')](handleEntityNotFound(_0x2e45d2,null))['then'](respondWithResult(_0x2e45d2,null))['catch'](handleError(_0x2e45d2,null));};exports[_0xc199('0x46')]=function(_0x1a6238,_0x54c0a8){return db[_0xc199('0x40')][_0xc199('0x46')](_0x1a6238['body'],{})[_0xc199('0x25')](respondWithResult(_0x54c0a8,0xc9))[_0xc199('0x47')](handleError(_0x54c0a8,null));};exports['update']=function(_0x10f418,_0xd845f7){if(_0x10f418[_0xc199('0x48')]['id']){delete _0x10f418[_0xc199('0x48')]['id'];}return db['VtigerField'][_0xc199('0x45')]({'where':{'id':_0x10f418[_0xc199('0x43')]['id']}})[_0xc199('0x25')](handleEntityNotFound(_0xd845f7,null))[_0xc199('0x25')](saveUpdates(_0x10f418['body'],null))[_0xc199('0x25')](respondWithResult(_0xd845f7,null))['catch'](handleError(_0xd845f7,null));};exports['destroy']=function(_0x18f410,_0xdfcf6a){return db[_0xc199('0x40')][_0xc199('0x45')]({'where':{'id':_0x18f410[_0xc199('0x43')]['id']}})[_0xc199('0x25')](handleEntityNotFound(_0xdfcf6a,null))[_0xc199('0x25')](removeEntity(_0xdfcf6a,null))[_0xc199('0x47')](handleError(_0xdfcf6a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ab8b0a9..9871dd2 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(_0x5974ea,_0x20a219){var _0x2ab445=function(_0x686db9){while(--_0x686db9){_0x5974ea['push'](_0x5974ea['shift']());}};_0x2ab445(++_0x20a219);}(_0x7a54,0x106));var _0x47a5=function(_0xb317b,_0x133be9){_0xb317b=_0xb317b-0x0;var _0x446551=_0x7a54[_0xb317b];return _0x446551;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xc6e820,_0x4ce318){var _0x5c1c25=function(_0x175669){while(--_0x175669){_0xc6e820['push'](_0xc6e820['shift']());}};_0x5c1c25(++_0x4ce318);}(_0x7a54,0x106));var _0x47a5=function(_0x5a81ee,_0x44ec44){_0x5a81ee=_0x5a81ee-0x0;var _0x512075=_0x7a54[_0x5a81ee];return _0x512075;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index e69c022..c1f4e40 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 _0xab26=['message','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x90734b,_0x15125e){var _0x4c8255=function(_0xa82e3){while(--_0xa82e3){_0x90734b['push'](_0x90734b['shift']());}};_0x4c8255(++_0x15125e);}(_0xab26,0xd2));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var moment=require(_0x6ab2('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ab2('0x3'));var fs=require('fs');var Redis=require(_0x6ab2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ab2('0x5'))('rpc');var config=require(_0x6ab2('0x6'));var jayson=require(_0x6ab2('0x7'));var client=jayson[_0x6ab2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41643a,_0x337cdf,_0x54bf93){return new BPromise(function(_0x140cc1,_0x3157f1){return client[_0x6ab2('0x9')](_0x41643a,_0x54bf93)[_0x6ab2('0xa')](function(_0x3bb68b){logger[_0x6ab2('0xb')](_0x6ab2('0xc'),_0x337cdf,_0x6ab2('0xd'));logger[_0x6ab2('0xe')](_0x6ab2('0xf'),_0x337cdf,_0x6ab2('0xd'),JSON['stringify'](_0x3bb68b));if(_0x3bb68b[_0x6ab2('0x10')]){if(_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x11')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x337cdf,_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);return _0x3157f1(_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);}logger[_0x6ab2('0x10')](_0x6ab2('0xc'),_0x337cdf,_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);return _0x140cc1(_0x3bb68b['error'][_0x6ab2('0x12')]);}else{logger['info'](_0x6ab2('0xc'),_0x337cdf,_0x6ab2('0xd'));_0x140cc1(_0x3bb68b['result']['message']);}})['catch'](function(_0x2adc75){logger[_0x6ab2('0x10')](_0x6ab2('0xc'),_0x337cdf,_0x2adc75);_0x3157f1(_0x2adc75);});});} \ No newline at end of file +var _0x887b=['request','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x32f893,_0x5b07de){var _0x26f175=function(_0x42a43f){while(--_0x42a43f){_0x32f893['push'](_0x32f893['shift']());}};_0x26f175(++_0x5b07de);}(_0x887b,0x185));var _0xb887=function(_0xbc9ca1,_0x498f2f){_0xbc9ca1=_0xbc9ca1-0x0;var _0x4cba6f=_0x887b[_0xbc9ca1];return _0x4cba6f;};'use strict';var _=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var moment=require(_0xb887('0x2'));var BPromise=require(_0xb887('0x3'));var rs=require(_0xb887('0x4'));var fs=require('fs');var Redis=require(_0xb887('0x5'));var db=require(_0xb887('0x6'))['db'];var utils=require(_0xb887('0x7'));var logger=require(_0xb887('0x8'))('rpc');var config=require(_0xb887('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x332507,_0x353587,_0x59707f){return new BPromise(function(_0x4a1c1e,_0x32ace2){return client[_0xb887('0xa')](_0x332507,_0x59707f)['then'](function(_0x49962f){logger['info'](_0xb887('0xb'),_0x353587,_0xb887('0xc'));logger['debug'](_0xb887('0xd'),_0x353587,'request\x20sent',JSON[_0xb887('0xe')](_0x49962f));if(_0x49962f[_0xb887('0xf')]){if(_0x49962f[_0xb887('0xf')][_0xb887('0x10')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x353587,_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);return _0x32ace2(_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);}logger[_0xb887('0xf')]('VtigerField,\x20%s,\x20%s',_0x353587,_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);return _0x4a1c1e(_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);}else{logger[_0xb887('0x12')](_0xb887('0xb'),_0x353587,_0xb887('0xc'));_0x4a1c1e(_0x49962f[_0xb887('0x13')][_0xb887('0x11')]);}})[_0xb887('0x14')](function(_0x2f4e2d){logger[_0xb887('0xf')]('VtigerField,\x20%s,\x20%s',_0x353587,_0x2f4e2d);_0x32ace2(_0x2f4e2d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 7a71bd6..2135b46 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 _0xd526=['getFields','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0x4a8655,_0xdaabdf){var _0x56b19f=function(_0x1a541a){while(--_0x1a541a){_0x4a8655['push'](_0x4a8655['shift']());}};_0x56b19f(++_0xdaabdf);}(_0xd526,0xee));var _0x6d52=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd526[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x6d52('0x0'));var util=require(_0x6d52('0x1'));var path=require(_0x6d52('0x2'));var timeout=require(_0x6d52('0x3'));var express=require(_0x6d52('0x4'));var router=express[_0x6d52('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6d52('0x6'));var config=require(_0x6d52('0x7'));var controller=require(_0x6d52('0x8'));router[_0x6d52('0x9')]('/',auth[_0x6d52('0xa')](),controller['index']);router[_0x6d52('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6d52('0xb')]);router['get'](_0x6d52('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6d52('0x9')](_0x6d52('0xd'),auth[_0x6d52('0xa')](),controller[_0x6d52('0xe')]);router['post']('/',auth[_0x6d52('0xa')](),controller[_0x6d52('0xf')]);router['post']('/:id/configurations',auth[_0x6d52('0xa')](),controller[_0x6d52('0x10')]);router[_0x6d52('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6d52('0x12')]);router[_0x6d52('0x13')]('/:id',auth[_0x6d52('0xa')](),controller[_0x6d52('0x14')]);module['exports']=router; \ No newline at end of file +var _0xec56=['getFields','post','create','addConfiguration','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x37ed49,_0x53e558){var _0x198627=function(_0x21999d){while(--_0x21999d){_0x37ed49['push'](_0x37ed49['shift']());}};_0x198627(++_0x53e558);}(_0xec56,0x1bd));var _0x6ec5=function(_0xb9aed5,_0x3b1298){_0xb9aed5=_0xb9aed5-0x0;var _0x4716e9=_0xec56[_0xb9aed5];return _0x4716e9;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var auth=require(_0x6ec5('0x4'));var interaction=require(_0x6ec5('0x5'));var config=require(_0x6ec5('0x6'));var controller=require(_0x6ec5('0x7'));router[_0x6ec5('0x8')]('/',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xa')]);router[_0x6ec5('0x8')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xc')]);router[_0x6ec5('0x8')](_0x6ec5('0xd'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xe')]);router[_0x6ec5('0x8')]('/:id/fields',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0xf')]);router[_0x6ec5('0x10')]('/',auth[_0x6ec5('0x9')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x10')](_0x6ec5('0xd'),auth['isAuthenticated'](),controller[_0x6ec5('0x12')]);router[_0x6ec5('0x13')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller[_0x6ec5('0x14')]);router[_0x6ec5('0x15')](_0x6ec5('0xb'),auth[_0x6ec5('0x9')](),controller['destroy']);module[_0x6ec5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d0d2c20..33cfb7a 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 _0x5497=['password','token','integrationTab','newTab','exports','STRING','username'];(function(_0x79009e,_0x5f43ce){var _0x955626=function(_0xb142a1){while(--_0xb142a1){_0x79009e['push'](_0x79009e['shift']());}};_0x955626(++_0x5f43ce);}(_0x5497,0xb3));var _0x7549=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x5497[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require('sequelize');module[_0x7549('0x0')]={'name':{'type':Sequelize[_0x7549('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x7549('0x2')},'password':{'type':Sequelize[_0x7549('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7549('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x7549('0x3'),_0x7549('0x4')),'defaultValue':_0x7549('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7549('0x5'),_0x7549('0x6')),'defaultValue':_0x7549('0x5')}}; \ No newline at end of file +var _0x2935=['token','integrationTab','newTab','sequelize','STRING','remoteUri','ENUM','password'];(function(_0x576811,_0x25ff72){var _0x4d66d6=function(_0x1b454e){while(--_0x1b454e){_0x576811['push'](_0x576811['shift']());}};_0x4d66d6(++_0x25ff72);}(_0x2935,0xd3));var _0x5293=function(_0x4d1672,_0x4fc2af){_0x4d1672=_0x4d1672-0x0;var _0x3bbb42=_0x2935[_0x4d1672];return _0x3bbb42;};'use strict';var Sequelize=require(_0x5293('0x0'));module['exports']={'name':{'type':Sequelize[_0x5293('0x1')]},'description':{'type':Sequelize[_0x5293('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x5293('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5293('0x1')],'unique':_0x5293('0x2')},'authType':{'type':Sequelize[_0x5293('0x3')](_0x5293('0x4'),_0x5293('0x5')),'defaultValue':_0x5293('0x4')},'serverUrl':{'type':Sequelize[_0x5293('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5293('0x6'),_0x5293('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 35e50f4..6c6ad38 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 _0xd2bf=['index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','find','create','body','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','Basic\x20%s','%s:%s','base64','headers','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xd2bf[_0x479160];return _0x47ac6d;};'use strict';var pdf=require(_0xfd2b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfd2b('0x1'));var rp=require(_0xfd2b('0x2'));var moment=require('moment');var BPromise=require(_0xfd2b('0x3'));var Mustache=require('mustache');var util=require(_0xfd2b('0x4'));var path=require(_0xfd2b('0x5'));var sox=require(_0xfd2b('0x6'));var csv=require(_0xfd2b('0x7'));var ejs=require(_0xfd2b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfd2b('0x9'));var crypto=require(_0xfd2b('0xa'));var jsforce=require(_0xfd2b('0xb'));var deskjs=require(_0xfd2b('0xc'));var toCsv=require(_0xfd2b('0x7'));var querystring=require(_0xfd2b('0xd'));var Papa=require(_0xfd2b('0xe'));var Redis=require(_0xfd2b('0xf'));var authService=require(_0xfd2b('0x10'));var qs=require(_0xfd2b('0x11'));var as=require(_0xfd2b('0x12'));var hardwareService=require(_0xfd2b('0x13'));var logger=require(_0xfd2b('0x14'))(_0xfd2b('0x15'));var utils=require('../../config/utils');var config=require(_0xfd2b('0x16'));var licenseUtil=require(_0xfd2b('0x17'));var db=require(_0xfd2b('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfd2b('0x19'));var client=jayson['client'][_0xfd2b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x182ce0,_0x465dae,_0x5a6e04,_0x361c89){return new BPromise(function(_0x1be5d8,_0x2bc40c){var _0x3ef7ef=_0x361c89||client;return _0x3ef7ef[_0xfd2b('0x1b')](_0x182ce0,_0x5a6e04)['then'](function(_0xec43de){logger[_0xfd2b('0x1c')](_0xfd2b('0x1d'),_0x465dae,_0xfd2b('0x1e'));logger[_0xfd2b('0x1f')](_0xfd2b('0x20'),_0x465dae,'request\x20sent',JSON['stringify'](_0xec43de));if(_0xec43de[_0xfd2b('0x21')]){if(_0xec43de[_0xfd2b('0x21')][_0xfd2b('0x22')]===0x1f4){logger[_0xfd2b('0x21')](_0xfd2b('0x1d'),_0x465dae,_0xec43de['error'][_0xfd2b('0x23')]);return _0x2bc40c(_0xec43de[_0xfd2b('0x21')][_0xfd2b('0x23')]);}logger[_0xfd2b('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x465dae,_0xec43de[_0xfd2b('0x21')][_0xfd2b('0x23')]);return _0x1be5d8(_0xec43de[_0xfd2b('0x21')]['message']);}else{logger[_0xfd2b('0x1c')](_0xfd2b('0x1d'),_0x465dae,_0xfd2b('0x1e'));_0x1be5d8(_0xec43de[_0xfd2b('0x24')]['message']);}})[_0xfd2b('0x25')](function(_0x59fc64){logger[_0xfd2b('0x21')](_0xfd2b('0x1d'),_0x465dae,_0x59fc64);_0x2bc40c(_0x59fc64);});});}function respondWithStatusCode(_0x5ada3e,_0x337f15){_0x337f15=_0x337f15||0xcc;return function(_0x17ec35){if(_0x17ec35){return _0x5ada3e[_0xfd2b('0x26')](_0x337f15);}return _0x5ada3e[_0xfd2b('0x27')](_0x337f15)[_0xfd2b('0x28')]();};}function respondWithResult(_0x222eed,_0x1cd6d5){_0x1cd6d5=_0x1cd6d5||0xc8;return function(_0x983c56){if(_0x983c56){return _0x222eed[_0xfd2b('0x27')](_0x1cd6d5)['json'](_0x983c56);}};}function respondWithFilteredResult(_0x203de3,_0x1b7126){return function(_0x3dd59c){if(_0x3dd59c){var _0x2ae821=_0x3dd59c['count'],_0x1fad45=_0x1b7126[_0xfd2b('0x29')],_0x271081=_0x1b7126['offset']+_0x1b7126[_0xfd2b('0x2a')],_0x40a15f;if(_0x271081>=_0x2ae821){_0x271081=_0x2ae821;_0x40a15f=0xc8;}else{_0x40a15f=0xce;}_0x203de3[_0xfd2b('0x27')](_0x40a15f);return _0x203de3[_0xfd2b('0x2b')](_0xfd2b('0x2c'),_0x1fad45+'-'+_0x271081+'/'+_0x2ae821)[_0xfd2b('0x2d')](_0x3dd59c);}return null;};}function patchUpdates(_0x466a7c){return function(_0x2b5530){try{jsonpatch[_0xfd2b('0x2e')](_0x2b5530,_0x466a7c,!![]);}catch(_0x1faa57){return BPromise[_0xfd2b('0x2f')](_0x1faa57);}return _0x2b5530[_0xfd2b('0x30')]();};}function saveUpdates(_0x509475,_0x238805){return function(_0x499c3b){if(_0x499c3b){return _0x499c3b[_0xfd2b('0x31')](_0x509475)[_0xfd2b('0x32')](function(_0xe101ed){return _0xe101ed;});}return null;};}function removeEntity(_0x2ffc01,_0x36117a){return function(_0x55bcd4){if(_0x55bcd4){return _0x55bcd4[_0xfd2b('0x33')]()[_0xfd2b('0x32')](function(){_0x2ffc01[_0xfd2b('0x27')](0xcc)[_0xfd2b('0x28')]();});}};}function handleEntityNotFound(_0x680ae4,_0x5508ff){return function(_0x50cfaf){if(!_0x50cfaf){_0x680ae4[_0xfd2b('0x26')](0x194);}return _0x50cfaf;};}function handleError(_0xd6357f,_0x4d5e3c){_0x4d5e3c=_0x4d5e3c||0x1f4;return function(_0x4ccb4b){logger[_0xfd2b('0x21')](_0x4ccb4b[_0xfd2b('0x34')]);if(_0x4ccb4b[_0xfd2b('0x35')]){delete _0x4ccb4b[_0xfd2b('0x35')];}_0xd6357f[_0xfd2b('0x27')](_0x4d5e3c)[_0xfd2b('0x36')](_0x4ccb4b);};}exports[_0xfd2b('0x37')]=function(_0x53764a,_0xe4979f){var _0x47a250={},_0xa956e3={},_0x53d843={'count':0x0,'rows':[]};var _0x132faf=_[_0xfd2b('0x38')](db[_0xfd2b('0x39')][_0xfd2b('0x3a')],function(_0x5dd5d6){return{'name':_0x5dd5d6[_0xfd2b('0x3b')],'type':_0x5dd5d6[_0xfd2b('0x3c')][_0xfd2b('0x3d')]};});_0xa956e3[_0xfd2b('0x3e')]=_[_0xfd2b('0x38')](_0x132faf,'name');_0xa956e3[_0xfd2b('0x3f')]=_[_0xfd2b('0x40')](_0x53764a[_0xfd2b('0x3f')]);_0xa956e3[_0xfd2b('0x41')]=_[_0xfd2b('0x42')](_0xa956e3[_0xfd2b('0x3e')],_0xa956e3[_0xfd2b('0x3f')]);_0x47a250[_0xfd2b('0x43')]=_['intersection'](_0xa956e3[_0xfd2b('0x3e')],qs[_0xfd2b('0x44')](_0x53764a['query']['fields']));_0x47a250[_0xfd2b('0x43')]=_0x47a250['attributes'][_0xfd2b('0x45')]?_0x47a250[_0xfd2b('0x43')]:_0xa956e3['model'];if(!_0x53764a['query']['hasOwnProperty'](_0xfd2b('0x46'))){_0x47a250[_0xfd2b('0x2a')]=qs[_0xfd2b('0x2a')](_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x2a')]);_0x47a250['offset']=qs[_0xfd2b('0x29')](_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x29')]);}_0x47a250[_0xfd2b('0x47')]=qs[_0xfd2b('0x48')](_0x53764a[_0xfd2b('0x3f')]['sort']);_0x47a250[_0xfd2b('0x49')]=qs[_0xfd2b('0x41')](_[_0xfd2b('0x4a')](_0x53764a[_0xfd2b('0x3f')],_0xa956e3[_0xfd2b('0x41')]),_0x132faf);if(_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x4b')]){_0x47a250[_0xfd2b('0x49')]=_[_0xfd2b('0x4c')](_0x47a250[_0xfd2b('0x49')],{'$or':_[_0xfd2b('0x38')](_0x132faf,function(_0x410329){if(_0x410329['type']!==_0xfd2b('0x4d')){var _0x1fe5a3={};_0x1fe5a3[_0x410329[_0xfd2b('0x35')]]={'$like':'%'+_0x53764a[_0xfd2b('0x3f')]['filter']+'%'};return _0x1fe5a3;}})});}_0x47a250=_[_0xfd2b('0x4c')]({},_0x47a250,_0x53764a[_0xfd2b('0x4e')]);var _0xfccd49={'where':_0x47a250[_0xfd2b('0x49')]};return db[_0xfd2b('0x39')]['count'](_0xfccd49)[_0xfd2b('0x32')](function(_0x4022ab){_0x53d843[_0xfd2b('0x4f')]=_0x4022ab;if(_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x50')]){_0x47a250[_0xfd2b('0x51')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x47a250);})[_0xfd2b('0x32')](function(_0x23b712){_0x53d843[_0xfd2b('0x52')]=_0x23b712;return _0x53d843;})[_0xfd2b('0x32')](respondWithFilteredResult(_0xe4979f,_0x47a250))[_0xfd2b('0x25')](handleError(_0xe4979f,null));};exports[_0xfd2b('0x53')]=function(_0x12d781,_0x54ed0f){var _0x138e75={'raw':![],'where':{'id':_0x12d781[_0xfd2b('0x54')]['id']}},_0x480dc7={};_0x480dc7[_0xfd2b('0x3e')]=_[_0xfd2b('0x40')](db[_0xfd2b('0x39')][_0xfd2b('0x3a')]);_0x480dc7[_0xfd2b('0x3f')]=_[_0xfd2b('0x40')](_0x12d781[_0xfd2b('0x3f')]);_0x480dc7[_0xfd2b('0x41')]=_['intersection'](_0x480dc7[_0xfd2b('0x3e')],_0x480dc7[_0xfd2b('0x3f')]);_0x138e75[_0xfd2b('0x43')]=_[_0xfd2b('0x42')](_0x480dc7['model'],qs[_0xfd2b('0x44')](_0x12d781[_0xfd2b('0x3f')][_0xfd2b('0x44')]));_0x138e75[_0xfd2b('0x43')]=_0x138e75['attributes']['length']?_0x138e75[_0xfd2b('0x43')]:_0x480dc7['model'];if(_0x12d781[_0xfd2b('0x3f')]['includeAll']){_0x138e75[_0xfd2b('0x51')]=[{'all':!![]}];}_0x138e75=_['merge']({},_0x138e75,_0x12d781['options']);return db[_0xfd2b('0x39')][_0xfd2b('0x55')](_0x138e75)[_0xfd2b('0x32')](handleEntityNotFound(_0x54ed0f,null))[_0xfd2b('0x32')](respondWithResult(_0x54ed0f,null))['catch'](handleError(_0x54ed0f,null));};exports[_0xfd2b('0x56')]=function(_0x4fc9b8,_0x5eff22){return db[_0xfd2b('0x39')][_0xfd2b('0x56')](_0x4fc9b8[_0xfd2b('0x57')],{})[_0xfd2b('0x32')](respondWithResult(_0x5eff22,0xc9))[_0xfd2b('0x25')](handleError(_0x5eff22,null));};exports[_0xfd2b('0x31')]=function(_0x31b022,_0x35ce47){if(_0x31b022[_0xfd2b('0x57')]['id']){delete _0x31b022['body']['id'];}return db['ZendeskAccount'][_0xfd2b('0x55')]({'where':{'id':_0x31b022[_0xfd2b('0x54')]['id']}})[_0xfd2b('0x32')](handleEntityNotFound(_0x35ce47,null))[_0xfd2b('0x32')](saveUpdates(_0x31b022['body'],null))[_0xfd2b('0x32')](respondWithResult(_0x35ce47,null))[_0xfd2b('0x25')](handleError(_0x35ce47,null));};exports[_0xfd2b('0x33')]=function(_0x40a7be,_0x4f7816){return db[_0xfd2b('0x39')]['find']({'where':{'id':_0x40a7be[_0xfd2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f7816,null))[_0xfd2b('0x32')](removeEntity(_0x4f7816,null))[_0xfd2b('0x25')](handleError(_0x4f7816,null));};exports[_0xfd2b('0x58')]=function(_0x5eddb5,_0x281d2c,_0x498168){var _0x52db23={};var _0x4d6aa6={};var _0x3db4d1;var _0x18c286;return db[_0xfd2b('0x39')]['findOne']({'where':{'id':_0x5eddb5[_0xfd2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x281d2c,null))[_0xfd2b('0x32')](function(_0x48230f){if(_0x48230f){_0x3db4d1=_0x48230f;_0x4d6aa6[_0xfd2b('0x3e')]=_['keys'](db[_0xfd2b('0x59')][_0xfd2b('0x3a')]);_0x4d6aa6[_0xfd2b('0x3f')]=_[_0xfd2b('0x40')](_0x5eddb5[_0xfd2b('0x3f')]);_0x4d6aa6['filters']=_[_0xfd2b('0x42')](_0x4d6aa6[_0xfd2b('0x3e')],_0x4d6aa6[_0xfd2b('0x3f')]);_0x52db23[_0xfd2b('0x43')]=_['intersection'](_0x4d6aa6['model'],qs['fields'](_0x5eddb5['query'][_0xfd2b('0x44')]));_0x52db23[_0xfd2b('0x43')]=_0x52db23['attributes'][_0xfd2b('0x45')]?_0x52db23[_0xfd2b('0x43')]:_0x4d6aa6['model'];_0x52db23[_0xfd2b('0x47')]=qs[_0xfd2b('0x48')](_0x5eddb5[_0xfd2b('0x3f')][_0xfd2b('0x48')]);_0x52db23[_0xfd2b('0x49')]=qs[_0xfd2b('0x41')](_[_0xfd2b('0x4a')](_0x5eddb5['query'],_0x4d6aa6['filters']));if(_0x5eddb5['query'][_0xfd2b('0x4b')]){_0x52db23[_0xfd2b('0x49')]=_[_0xfd2b('0x4c')](_0x52db23[_0xfd2b('0x49')],{'$or':_[_0xfd2b('0x38')](_0x52db23[_0xfd2b('0x43')],function(_0x3bce98){var _0x5cbe4c={};_0x5cbe4c[_0x3bce98]={'$like':'%'+_0x5eddb5['query'][_0xfd2b('0x4b')]+'%'};return _0x5cbe4c;})});}_0x52db23=_['merge']({},_0x52db23,_0x5eddb5[_0xfd2b('0x4e')]);return _0x3db4d1['getConfigurations'](_0x52db23);}})[_0xfd2b('0x32')](function(_0x525b65){if(_0x525b65){_0x18c286=_0x525b65[_0xfd2b('0x45')];if(!_0x5eddb5['query']['hasOwnProperty']('nolimit')){_0x52db23['limit']=qs[_0xfd2b('0x2a')](_0x5eddb5[_0xfd2b('0x3f')]['limit']);_0x52db23[_0xfd2b('0x29')]=qs[_0xfd2b('0x29')](_0x5eddb5[_0xfd2b('0x3f')][_0xfd2b('0x29')]);}return _0x3db4d1[_0xfd2b('0x58')](_0x52db23);}})['then'](function(_0x52d4fb){if(_0x52d4fb){return _0x52d4fb?{'count':_0x18c286,'rows':_0x52d4fb}:null;}})[_0xfd2b('0x32')](respondWithResult(_0x281d2c,null))[_0xfd2b('0x25')](handleError(_0x281d2c,null));};exports[_0xfd2b('0x5a')]=function(_0x518732,_0x517adb,_0x233477){if(_0x518732[_0xfd2b('0x57')]['id']){delete _0x518732[_0xfd2b('0x57')]['id'];}return db[_0xfd2b('0x39')][_0xfd2b('0x5b')]({'where':{'id':_0x518732[_0xfd2b('0x54')]['id']}})[_0xfd2b('0x32')](handleEntityNotFound(_0x517adb,null))[_0xfd2b('0x32')](function(_0x3e6c77){if(_0x3e6c77){_0x518732[_0xfd2b('0x57')][_0xfd2b('0x5c')]=_0x3e6c77['id'];_0x518732[_0xfd2b('0x57')][_0xfd2b('0x5d')]=integrations[_0xfd2b('0x5e')](_0x518732['body'][_0xfd2b('0x5f')],_0x518732[_0xfd2b('0x57')][_0xfd2b('0x3c')]);_0x518732['body']['Descriptions']=integrations[_0xfd2b('0x60')](_0x518732[_0xfd2b('0x57')][_0xfd2b('0x5f')],_0x518732[_0xfd2b('0x57')][_0xfd2b('0x3c')]);return db[_0xfd2b('0x59')]['create'](_0x518732['body'],{'include':[{'model':db[_0xfd2b('0x61')],'as':_0xfd2b('0x5d')},{'model':db[_0xfd2b('0x61')],'as':_0xfd2b('0x62')}]});}return null;})[_0xfd2b('0x32')](respondWithResult(_0x517adb,null))['catch'](handleError(_0x517adb,null));};exports[_0xfd2b('0x63')]=function(_0x2b680c,_0x396c9e,_0x51bebb){var _0x22fab3='';return db[_0xfd2b('0x39')]['findOne']({'where':{'id':_0x2b680c[_0xfd2b('0x54')]['id']},'attributes':['id',_0xfd2b('0x64'),_0xfd2b('0x65'),_0xfd2b('0x66'),_0xfd2b('0x67'),_0xfd2b('0x68')]})['then'](handleEntityNotFound(_0x396c9e,null))['then'](function(_0x158a90){if(_0x158a90){_0x22fab3=_0x158a90[_0xfd2b('0x68')];var _0x24789b=_0x22fab3[_0xfd2b('0x69')](-0x1);if(_0x24789b==='/'){_0x22fab3=_0x22fab3[_0xfd2b('0x6a')](0x0,_0x22fab3[_0xfd2b('0x6b')](_0x24789b));}var _0x162806={'method':'GET','uri':util[_0xfd2b('0x6c')](_0xfd2b('0x6d'),_0x22fab3,'ticket_fields'),'json':!![]};switch(_0x158a90['authType']){case _0xfd2b('0x65'):_0x162806['headers']={'Authorization':util[_0xfd2b('0x6c')](_0xfd2b('0x6e'),new Buffer(util[_0xfd2b('0x6c')](_0xfd2b('0x6f'),_0x158a90[_0xfd2b('0x64')],_0x158a90[_0xfd2b('0x65')]))['toString'](_0xfd2b('0x70')))};break;case'token':_0x162806[_0xfd2b('0x71')]={'Authorization':util[_0xfd2b('0x6c')](_0xfd2b('0x6e'),new Buffer(util[_0xfd2b('0x6c')](_0xfd2b('0x72'),_0x158a90['username'],_0x158a90[_0xfd2b('0x66')]))[_0xfd2b('0x73')]('base64'))};break;default:throw new db['Sequelize'][(_0xfd2b('0x74'))](_0xfd2b('0x75'));}return rp(_0x162806);}})[_0xfd2b('0x32')](function(_0x49353b){if(_0x49353b){var _0x15a866=[_0xfd2b('0x76'),_0xfd2b('0x77'),_0xfd2b('0x78'),_0xfd2b('0x79')];_[_0xfd2b('0x7a')](_0x49353b[_0xfd2b('0x7b')],function(_0x252ca8){return _0x15a866[_0xfd2b('0x7c')](_0x252ca8[_0xfd2b('0x3c')]);});return{'count':_0x49353b[_0xfd2b('0x7b')][_0xfd2b('0x45')],'rows':_[_0xfd2b('0x38')](_0x49353b[_0xfd2b('0x7b')],function(_0x434fa5){return{'id':_0x434fa5['id'],'name':_0x434fa5['position']>0x7?_0x434fa5[_0xfd2b('0x7d')]:_0x434fa5[_0xfd2b('0x3c')],'custom':_0x434fa5['position']>0x7?!![]:![],'options':_0x434fa5[_0xfd2b('0x7e')]?_0x434fa5[_0xfd2b('0x7e')]:_0x434fa5['custom_field_options']?_0x434fa5[_0xfd2b('0x7f')]:[]};})};}})[_0xfd2b('0x32')](respondWithResult(_0x396c9e,null))['catch'](function(_0x3eabbc){var _0x3ebfc4=_0x2b680c[_0xfd2b('0x3f')][_0xfd2b('0x80')]?0x1f4:_0x3eabbc[_0xfd2b('0x81')]||0x1f4;logger[_0xfd2b('0x21')](_0xfd2b('0x82'),_0xfd2b('0x63'),_0x3ebfc4,JSON[_0xfd2b('0x83')](_0x3eabbc));delete _0x3eabbc[_0xfd2b('0x35')];if(_0x3ebfc4===0x191){_0x3ebfc4=0x190;}_0x396c9e['status'](_0x3ebfc4)['send'](_0x2b680c['query']['test']?{'message':_0xfd2b('0x84'),'statusCode':_0x3eabbc[_0xfd2b('0x81')]}:_0x3eabbc);});}; \ No newline at end of file +var _0x56dc=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','status','json','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','username','base64','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x176aa8,_0x5ec010){var _0x9082b5=function(_0x13da01){while(--_0x13da01){_0x176aa8['push'](_0x176aa8['shift']());}};_0x9082b5(++_0x5ec010);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc56d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc56d('0x1'));var zipdir=require(_0xc56d('0x2'));var jsonpatch=require(_0xc56d('0x3'));var rp=require(_0xc56d('0x4'));var moment=require(_0xc56d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc56d('0x6'));var util=require(_0xc56d('0x7'));var path=require(_0xc56d('0x8'));var sox=require(_0xc56d('0x9'));var csv=require(_0xc56d('0xa'));var ejs=require(_0xc56d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc56d('0xc'));var crypto=require(_0xc56d('0xd'));var jsforce=require(_0xc56d('0xe'));var deskjs=require(_0xc56d('0xf'));var toCsv=require(_0xc56d('0xa'));var querystring=require(_0xc56d('0x10'));var Papa=require(_0xc56d('0x11'));var Redis=require(_0xc56d('0x12'));var authService=require(_0xc56d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc56d('0x14'));var hardwareService=require(_0xc56d('0x15'));var logger=require(_0xc56d('0x16'))('api');var utils=require(_0xc56d('0x17'));var config=require(_0xc56d('0x18'));var licenseUtil=require(_0xc56d('0x19'));var db=require(_0xc56d('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xc56d('0x1b'));var client=jayson[_0xc56d('0x1c')][_0xc56d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b60cd,_0x433b4b,_0x3c0bb5,_0xf3e4eb){return new BPromise(function(_0x13a712,_0x525da1){var _0x2eefa6=_0xf3e4eb||client;return _0x2eefa6[_0xc56d('0x1e')](_0x4b60cd,_0x3c0bb5)['then'](function(_0x4c5651){logger[_0xc56d('0x1f')](_0xc56d('0x20'),_0x433b4b,_0xc56d('0x21'));logger[_0xc56d('0x22')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x433b4b,_0xc56d('0x21'),JSON['stringify'](_0x4c5651));if(_0x4c5651[_0xc56d('0x23')]){if(_0x4c5651[_0xc56d('0x23')]['code']===0x1f4){logger[_0xc56d('0x23')](_0xc56d('0x20'),_0x433b4b,_0x4c5651[_0xc56d('0x23')][_0xc56d('0x24')]);return _0x525da1(_0x4c5651[_0xc56d('0x23')]['message']);}logger[_0xc56d('0x23')](_0xc56d('0x20'),_0x433b4b,_0x4c5651[_0xc56d('0x23')][_0xc56d('0x24')]);return _0x13a712(_0x4c5651['error']['message']);}else{logger['info'](_0xc56d('0x20'),_0x433b4b,_0xc56d('0x21'));_0x13a712(_0x4c5651[_0xc56d('0x25')]['message']);}})['catch'](function(_0xfabb4d){logger[_0xc56d('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x433b4b,_0xfabb4d);_0x525da1(_0xfabb4d);});});}function respondWithStatusCode(_0x446792,_0x41e336){_0x41e336=_0x41e336||0xcc;return function(_0x29f065){if(_0x29f065){return _0x446792[_0xc56d('0x26')](_0x41e336);}return _0x446792['status'](_0x41e336)['end']();};}function respondWithResult(_0x2a769c,_0x30eacf){_0x30eacf=_0x30eacf||0xc8;return function(_0x5405a8){if(_0x5405a8){return _0x2a769c[_0xc56d('0x27')](_0x30eacf)[_0xc56d('0x28')](_0x5405a8);}};}function respondWithFilteredResult(_0x20ab1c,_0x4d4b8e){return function(_0x29e8e2){if(_0x29e8e2){var _0x2e48ae=_0x29e8e2[_0xc56d('0x29')],_0x30dbd9=_0x4d4b8e['offset'],_0x2fff7c=_0x4d4b8e[_0xc56d('0x2a')]+_0x4d4b8e['limit'],_0x10b384;if(_0x2fff7c>=_0x2e48ae){_0x2fff7c=_0x2e48ae;_0x10b384=0xc8;}else{_0x10b384=0xce;}_0x20ab1c[_0xc56d('0x27')](_0x10b384);return _0x20ab1c[_0xc56d('0x2b')](_0xc56d('0x2c'),_0x30dbd9+'-'+_0x2fff7c+'/'+_0x2e48ae)[_0xc56d('0x28')](_0x29e8e2);}return null;};}function patchUpdates(_0x1973b1){return function(_0x5b1543){try{jsonpatch[_0xc56d('0x2d')](_0x5b1543,_0x1973b1,!![]);}catch(_0x53faa2){return BPromise['reject'](_0x53faa2);}return _0x5b1543['save']();};}function saveUpdates(_0x296cab,_0x56326a){return function(_0x391cac){if(_0x391cac){return _0x391cac[_0xc56d('0x2e')](_0x296cab)[_0xc56d('0x2f')](function(_0x5affc6){return _0x5affc6;});}return null;};}function removeEntity(_0x3ee7d0,_0x2cc4d5){return function(_0x414531){if(_0x414531){return _0x414531[_0xc56d('0x30')]()['then'](function(){_0x3ee7d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c852,_0x362d74){return function(_0x4373be){if(!_0x4373be){_0x21c852[_0xc56d('0x26')](0x194);}return _0x4373be;};}function handleError(_0x3cdfab,_0x5d17cc){_0x5d17cc=_0x5d17cc||0x1f4;return function(_0x1e8988){logger[_0xc56d('0x23')](_0x1e8988[_0xc56d('0x31')]);if(_0x1e8988[_0xc56d('0x32')]){delete _0x1e8988[_0xc56d('0x32')];}_0x3cdfab[_0xc56d('0x27')](_0x5d17cc)[_0xc56d('0x33')](_0x1e8988);};}exports['index']=function(_0x1219aa,_0x47bac6){var _0x36ae22={},_0x429f9d={},_0x5a1d7f={'count':0x0,'rows':[]};var _0x3b133d=_[_0xc56d('0x34')](db[_0xc56d('0x35')][_0xc56d('0x36')],function(_0x3c8a73){return{'name':_0x3c8a73[_0xc56d('0x37')],'type':_0x3c8a73[_0xc56d('0x38')][_0xc56d('0x39')]};});_0x429f9d[_0xc56d('0x3a')]=_[_0xc56d('0x34')](_0x3b133d,_0xc56d('0x32'));_0x429f9d[_0xc56d('0x3b')]=_[_0xc56d('0x3c')](_0x1219aa[_0xc56d('0x3b')]);_0x429f9d[_0xc56d('0x3d')]=_[_0xc56d('0x3e')](_0x429f9d[_0xc56d('0x3a')],_0x429f9d[_0xc56d('0x3b')]);_0x36ae22[_0xc56d('0x3f')]=_[_0xc56d('0x3e')](_0x429f9d[_0xc56d('0x3a')],qs[_0xc56d('0x40')](_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x40')]));_0x36ae22[_0xc56d('0x3f')]=_0x36ae22[_0xc56d('0x3f')][_0xc56d('0x41')]?_0x36ae22[_0xc56d('0x3f')]:_0x429f9d[_0xc56d('0x3a')];if(!_0x1219aa['query'][_0xc56d('0x42')](_0xc56d('0x43'))){_0x36ae22[_0xc56d('0x44')]=qs['limit'](_0x1219aa['query'][_0xc56d('0x44')]);_0x36ae22['offset']=qs['offset'](_0x1219aa['query']['offset']);}_0x36ae22['order']=qs[_0xc56d('0x45')](_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x45')]);_0x36ae22[_0xc56d('0x46')]=qs[_0xc56d('0x3d')](_[_0xc56d('0x47')](_0x1219aa[_0xc56d('0x3b')],_0x429f9d[_0xc56d('0x3d')]),_0x3b133d);if(_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x48')]){_0x36ae22['where']=_[_0xc56d('0x49')](_0x36ae22[_0xc56d('0x46')],{'$or':_[_0xc56d('0x34')](_0x3b133d,function(_0x5bcf14){if(_0x5bcf14[_0xc56d('0x38')]!==_0xc56d('0x4a')){var _0x2cc663={};_0x2cc663[_0x5bcf14[_0xc56d('0x32')]]={'$like':'%'+_0x1219aa[_0xc56d('0x3b')][_0xc56d('0x48')]+'%'};return _0x2cc663;}})});}_0x36ae22=_[_0xc56d('0x49')]({},_0x36ae22,_0x1219aa[_0xc56d('0x4b')]);var _0x556dd3={'where':_0x36ae22[_0xc56d('0x46')]};return db[_0xc56d('0x35')][_0xc56d('0x29')](_0x556dd3)[_0xc56d('0x2f')](function(_0xab1fd){_0x5a1d7f[_0xc56d('0x29')]=_0xab1fd;if(_0x1219aa[_0xc56d('0x3b')]['includeAll']){_0x36ae22[_0xc56d('0x4c')]=[{'all':!![]}];}return db[_0xc56d('0x35')][_0xc56d('0x4d')](_0x36ae22);})['then'](function(_0x5d7c76){_0x5a1d7f[_0xc56d('0x4e')]=_0x5d7c76;return _0x5a1d7f;})[_0xc56d('0x2f')](respondWithFilteredResult(_0x47bac6,_0x36ae22))[_0xc56d('0x4f')](handleError(_0x47bac6,null));};exports[_0xc56d('0x50')]=function(_0x20d6eb,_0x27effc){var _0x5d738a={'raw':![],'where':{'id':_0x20d6eb['params']['id']}},_0x416b63={};_0x416b63[_0xc56d('0x3a')]=_[_0xc56d('0x3c')](db['ZendeskAccount'][_0xc56d('0x36')]);_0x416b63[_0xc56d('0x3b')]=_[_0xc56d('0x3c')](_0x20d6eb['query']);_0x416b63[_0xc56d('0x3d')]=_[_0xc56d('0x3e')](_0x416b63[_0xc56d('0x3a')],_0x416b63['query']);_0x5d738a[_0xc56d('0x3f')]=_[_0xc56d('0x3e')](_0x416b63[_0xc56d('0x3a')],qs[_0xc56d('0x40')](_0x20d6eb[_0xc56d('0x3b')]['fields']));_0x5d738a[_0xc56d('0x3f')]=_0x5d738a[_0xc56d('0x3f')][_0xc56d('0x41')]?_0x5d738a[_0xc56d('0x3f')]:_0x416b63[_0xc56d('0x3a')];if(_0x20d6eb[_0xc56d('0x3b')]['includeAll']){_0x5d738a['include']=[{'all':!![]}];}_0x5d738a=_[_0xc56d('0x49')]({},_0x5d738a,_0x20d6eb[_0xc56d('0x4b')]);return db[_0xc56d('0x35')][_0xc56d('0x51')](_0x5d738a)['then'](handleEntityNotFound(_0x27effc,null))[_0xc56d('0x2f')](respondWithResult(_0x27effc,null))[_0xc56d('0x4f')](handleError(_0x27effc,null));};exports[_0xc56d('0x52')]=function(_0x256ebb,_0x44b370){return db['ZendeskAccount'][_0xc56d('0x52')](_0x256ebb[_0xc56d('0x53')],{})[_0xc56d('0x2f')](respondWithResult(_0x44b370,0xc9))['catch'](handleError(_0x44b370,null));};exports[_0xc56d('0x2e')]=function(_0x3cdf0f,_0x4f6d64){if(_0x3cdf0f[_0xc56d('0x53')]['id']){delete _0x3cdf0f[_0xc56d('0x53')]['id'];}return db[_0xc56d('0x35')]['find']({'where':{'id':_0x3cdf0f[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x4f6d64,null))[_0xc56d('0x2f')](saveUpdates(_0x3cdf0f[_0xc56d('0x53')],null))[_0xc56d('0x2f')](respondWithResult(_0x4f6d64,null))[_0xc56d('0x4f')](handleError(_0x4f6d64,null));};exports['destroy']=function(_0x552d35,_0x574f4e){return db[_0xc56d('0x35')]['find']({'where':{'id':_0x552d35[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x574f4e,null))[_0xc56d('0x2f')](removeEntity(_0x574f4e,null))[_0xc56d('0x4f')](handleError(_0x574f4e,null));};exports[_0xc56d('0x55')]=function(_0x2944ee,_0x2eaaa5,_0x5484c4){var _0x56e313={};var _0x43eff0={};var _0x180fc9;var _0x49f314;return db[_0xc56d('0x35')][_0xc56d('0x56')]({'where':{'id':_0x2944ee[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x2eaaa5,null))[_0xc56d('0x2f')](function(_0x567c5d){if(_0x567c5d){_0x180fc9=_0x567c5d;_0x43eff0[_0xc56d('0x3a')]=_['keys'](db[_0xc56d('0x57')][_0xc56d('0x36')]);_0x43eff0[_0xc56d('0x3b')]=_[_0xc56d('0x3c')](_0x2944ee[_0xc56d('0x3b')]);_0x43eff0[_0xc56d('0x3d')]=_[_0xc56d('0x3e')](_0x43eff0[_0xc56d('0x3a')],_0x43eff0['query']);_0x56e313[_0xc56d('0x3f')]=_[_0xc56d('0x3e')](_0x43eff0['model'],qs[_0xc56d('0x40')](_0x2944ee[_0xc56d('0x3b')][_0xc56d('0x40')]));_0x56e313[_0xc56d('0x3f')]=_0x56e313[_0xc56d('0x3f')][_0xc56d('0x41')]?_0x56e313[_0xc56d('0x3f')]:_0x43eff0[_0xc56d('0x3a')];_0x56e313[_0xc56d('0x58')]=qs[_0xc56d('0x45')](_0x2944ee[_0xc56d('0x3b')][_0xc56d('0x45')]);_0x56e313['where']=qs[_0xc56d('0x3d')](_[_0xc56d('0x47')](_0x2944ee[_0xc56d('0x3b')],_0x43eff0['filters']));if(_0x2944ee['query'][_0xc56d('0x48')]){_0x56e313[_0xc56d('0x46')]=_[_0xc56d('0x49')](_0x56e313[_0xc56d('0x46')],{'$or':_[_0xc56d('0x34')](_0x56e313[_0xc56d('0x3f')],function(_0x33c3c7){var _0x16c24b={};_0x16c24b[_0x33c3c7]={'$like':'%'+_0x2944ee[_0xc56d('0x3b')]['filter']+'%'};return _0x16c24b;})});}_0x56e313=_['merge']({},_0x56e313,_0x2944ee[_0xc56d('0x4b')]);return _0x180fc9['getConfigurations'](_0x56e313);}})[_0xc56d('0x2f')](function(_0x21c89f){if(_0x21c89f){_0x49f314=_0x21c89f['length'];if(!_0x2944ee[_0xc56d('0x3b')][_0xc56d('0x42')](_0xc56d('0x43'))){_0x56e313[_0xc56d('0x44')]=qs[_0xc56d('0x44')](_0x2944ee[_0xc56d('0x3b')]['limit']);_0x56e313[_0xc56d('0x2a')]=qs['offset'](_0x2944ee[_0xc56d('0x3b')]['offset']);}return _0x180fc9[_0xc56d('0x55')](_0x56e313);}})[_0xc56d('0x2f')](function(_0x9da6){if(_0x9da6){return _0x9da6?{'count':_0x49f314,'rows':_0x9da6}:null;}})['then'](respondWithResult(_0x2eaaa5,null))['catch'](handleError(_0x2eaaa5,null));};exports[_0xc56d('0x59')]=function(_0x64de40,_0x6aea0e,_0x2c1dcd){if(_0x64de40[_0xc56d('0x53')]['id']){delete _0x64de40[_0xc56d('0x53')]['id'];}return db[_0xc56d('0x35')][_0xc56d('0x56')]({'where':{'id':_0x64de40[_0xc56d('0x54')]['id']}})[_0xc56d('0x2f')](handleEntityNotFound(_0x6aea0e,null))[_0xc56d('0x2f')](function(_0x35a4ba){if(_0x35a4ba){_0x64de40['body'][_0xc56d('0x5a')]=_0x35a4ba['id'];_0x64de40[_0xc56d('0x53')]['Subjects']=integrations[_0xc56d('0x5b')](_0x64de40['body'][_0xc56d('0x5c')],_0x64de40[_0xc56d('0x53')][_0xc56d('0x38')]);_0x64de40[_0xc56d('0x53')][_0xc56d('0x5d')]=integrations[_0xc56d('0x5e')](_0x64de40[_0xc56d('0x53')][_0xc56d('0x5c')],_0x64de40['body'][_0xc56d('0x38')]);return db['ZendeskConfiguration'][_0xc56d('0x52')](_0x64de40[_0xc56d('0x53')],{'include':[{'model':db[_0xc56d('0x5f')],'as':_0xc56d('0x60')},{'model':db['ZendeskField'],'as':_0xc56d('0x5d')}]});}return null;})[_0xc56d('0x2f')](respondWithResult(_0x6aea0e,null))['catch'](handleError(_0x6aea0e,null));};exports['getFields']=function(_0x558b1d,_0x443501,_0x25817a){var _0x2dc125='';return db[_0xc56d('0x35')][_0xc56d('0x56')]({'where':{'id':_0x558b1d[_0xc56d('0x54')]['id']},'attributes':['id','username',_0xc56d('0x61'),_0xc56d('0x62'),_0xc56d('0x63'),_0xc56d('0x64')]})[_0xc56d('0x2f')](handleEntityNotFound(_0x443501,null))[_0xc56d('0x2f')](function(_0x290109){if(_0x290109){_0x2dc125=_0x290109[_0xc56d('0x64')];var _0x59c445=_0x2dc125[_0xc56d('0x65')](-0x1);if(_0x59c445==='/'){_0x2dc125=_0x2dc125['substring'](0x0,_0x2dc125[_0xc56d('0x66')](_0x59c445));}var _0x2b6a3f={'method':_0xc56d('0x67'),'uri':util[_0xc56d('0x68')](_0xc56d('0x69'),_0x2dc125,_0xc56d('0x6a')),'json':!![]};switch(_0x290109[_0xc56d('0x63')]){case _0xc56d('0x61'):_0x2b6a3f[_0xc56d('0x6b')]={'Authorization':util['format'](_0xc56d('0x6c'),new Buffer(util[_0xc56d('0x68')](_0xc56d('0x6d'),_0x290109['username'],_0x290109[_0xc56d('0x61')]))[_0xc56d('0x6e')]('base64'))};break;case _0xc56d('0x62'):_0x2b6a3f[_0xc56d('0x6b')]={'Authorization':util[_0xc56d('0x68')](_0xc56d('0x6c'),new Buffer(util[_0xc56d('0x68')]('%s/token:%s',_0x290109[_0xc56d('0x6f')],_0x290109['token']))[_0xc56d('0x6e')](_0xc56d('0x70')))};break;default:throw new db['Sequelize']['ValidationError'](_0xc56d('0x71'));}return rp(_0x2b6a3f);}})[_0xc56d('0x2f')](function(_0x11ca6c){if(_0x11ca6c){var _0x473adc=[_0xc56d('0x72'),_0xc56d('0x73'),_0xc56d('0x74'),_0xc56d('0x75')];_[_0xc56d('0x76')](_0x11ca6c[_0xc56d('0x6a')],function(_0x4c368e){return _0x473adc[_0xc56d('0x77')](_0x4c368e['type']);});return{'count':_0x11ca6c[_0xc56d('0x6a')][_0xc56d('0x41')],'rows':_[_0xc56d('0x34')](_0x11ca6c[_0xc56d('0x6a')],function(_0x40fd88){return{'id':_0x40fd88['id'],'name':_0x40fd88['position']>0x7?_0x40fd88[_0xc56d('0x78')]:_0x40fd88[_0xc56d('0x38')],'custom':_0x40fd88[_0xc56d('0x79')]>0x7?!![]:![],'options':_0x40fd88[_0xc56d('0x7a')]?_0x40fd88['system_field_options']:_0x40fd88[_0xc56d('0x7b')]?_0x40fd88[_0xc56d('0x7b')]:[]};})};}})['then'](respondWithResult(_0x443501,null))[_0xc56d('0x4f')](function(_0xaa1be6){var _0x32a09f=_0x558b1d['query'][_0xc56d('0x7c')]?0x1f4:_0xaa1be6[_0xc56d('0x7d')]||0x1f4;logger[_0xc56d('0x23')](_0xc56d('0x7e'),_0xc56d('0x7f'),_0x32a09f,JSON[_0xc56d('0x80')](_0xaa1be6));delete _0xaa1be6['name'];if(_0x32a09f===0x191){_0x32a09f=0x190;}_0x443501[_0xc56d('0x27')](_0x32a09f)[_0xc56d('0x33')](_0x558b1d[_0xc56d('0x3b')][_0xc56d('0x7c')]?{'message':_0xc56d('0x81'),'statusCode':_0xaa1be6[_0xc56d('0x7d')]}:_0xaa1be6);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1e501aa..f0f1215 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 _0x561c=['bluebird','request-promise','path','./intZendeskAccount.attributes','exports','ZendeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x55b57f,_0x1a3c19){var _0x2e55a0=function(_0x205a39){while(--_0x205a39){_0x55b57f['push'](_0x55b57f['shift']());}};_0x2e55a0(++_0x1a3c19);}(_0x561c,0x8a));var _0xc561=function(_0x3125cf,_0x1540d5){_0x3125cf=_0x3125cf-0x0;var _0x47df70=_0x561c[_0x3125cf];return _0x47df70;};'use strict';var _=require(_0xc561('0x0'));var util=require(_0xc561('0x1'));var logger=require(_0xc561('0x2'))(_0xc561('0x3'));var moment=require(_0xc561('0x4'));var BPromise=require(_0xc561('0x5'));var rp=require(_0xc561('0x6'));var fs=require('fs');var path=require(_0xc561('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc561('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc561('0x9')]=function(_0x1a587a,_0x1abca6){return _0x1a587a['define'](_0xc561('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26df=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','./intZendeskAccount.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26df,0xd5));var _0xf26d=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x26df[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require('lodash');var util=require(_0xf26d('0x0'));var logger=require(_0xf26d('0x1'))(_0xf26d('0x2'));var moment=require(_0xf26d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf26d('0x4'));var fs=require('fs');var path=require(_0xf26d('0x5'));var rimraf=require(_0xf26d('0x6'));var config=require('../../config/environment');var attributes=require(_0xf26d('0x7'));var integrations=require(_0xf26d('0x8'));module[_0xf26d('0x9')]=function(_0x35ca3d,_0x779910){return _0x35ca3d[_0xf26d('0xa')](_0xf26d('0xb'),attributes,{'tableName':_0xf26d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index de52e56..ee73dc4 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(_0x55e138,_0x212557){var _0x318b6e=function(_0x4c7c04){while(--_0x4c7c04){_0x55e138['push'](_0x55e138['shift']());}};_0x318b6e(++_0x212557);}(_0x757a,0xde));var _0xa757=function(_0x22acbb,_0x3181bf){_0x22acbb=_0x22acbb-0x0;var _0x371254=_0x757a[_0x22acbb];return _0x371254;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7b977dd..4b6b055 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 _0x5a57=['/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','multer','util','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects'];(function(_0x512661,_0x4b4012){var _0x1debde=function(_0x1ed401){while(--_0x1ed401){_0x512661['push'](_0x512661['shift']());}};_0x1debde(++_0x4b4012);}(_0x5a57,0x121));var _0x75a5=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x5a57[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x75a5('0x0'));var util=require(_0x75a5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x75a5('0x2'));var config=require(_0x75a5('0x3'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x75a5('0x4')](_0x75a5('0x5'),auth[_0x75a5('0x6')](),controller[_0x75a5('0x7')]);router[_0x75a5('0x4')]('/:id/fields',auth[_0x75a5('0x6')](),controller[_0x75a5('0x8')]);router['get'](_0x75a5('0x9'),auth['isAuthenticated'](),controller[_0x75a5('0xa')]);router['get'](_0x75a5('0xb'),auth[_0x75a5('0x6')](),controller['getDescriptions']);router[_0x75a5('0x4')](_0x75a5('0xc'),auth[_0x75a5('0x6')](),controller[_0x75a5('0xd')]);router[_0x75a5('0xe')]('/',auth['isAuthenticated'](),controller[_0x75a5('0xf')]);router[_0x75a5('0xe')]('/:id/tags',auth['isAuthenticated'](),controller[_0x75a5('0x10')]);router[_0x75a5('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x75a5('0x12')](_0x75a5('0x5'),auth[_0x75a5('0x6')](),controller[_0x75a5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x374f=['put','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create'];(function(_0x4239fd,_0x32b441){var _0x98031d=function(_0x14247d){while(--_0x14247d){_0x4239fd['push'](_0x4239fd['shift']());}};_0x98031d(++_0x32b441);}(_0x374f,0x183));var _0xf374=function(_0x4f2342,_0x4edaa1){_0x4f2342=_0x4f2342-0x0;var _0x561068=_0x374f[_0x4f2342];return _0x561068;};'use strict';var multer=require('multer');var util=require(_0xf374('0x0'));var path=require(_0xf374('0x1'));var timeout=require(_0xf374('0x2'));var express=require('express');var router=express[_0xf374('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf374('0x4'));var config=require(_0xf374('0x5'));var controller=require('./intZendeskConfiguration.controller');router[_0xf374('0x6')]('/',auth[_0xf374('0x7')](),controller[_0xf374('0x8')]);router[_0xf374('0x6')](_0xf374('0x9'),auth[_0xf374('0x7')](),controller[_0xf374('0xa')]);router[_0xf374('0x6')](_0xf374('0xb'),auth['isAuthenticated'](),controller[_0xf374('0xc')]);router[_0xf374('0x6')](_0xf374('0xd'),auth['isAuthenticated'](),controller[_0xf374('0xe')]);router['get'](_0xf374('0xf'),auth[_0xf374('0x7')](),controller[_0xf374('0x10')]);router[_0xf374('0x6')](_0xf374('0x11'),auth[_0xf374('0x7')](),controller[_0xf374('0x12')]);router[_0xf374('0x13')]('/',auth[_0xf374('0x7')](),controller[_0xf374('0x14')]);router['post'](_0xf374('0x11'),auth['isAuthenticated'](),controller['setTags']);router[_0xf374('0x15')](_0xf374('0x9'),auth[_0xf374('0x7')](),controller['update']);router['delete'](_0xf374('0x9'),auth[_0xf374('0x7')](),controller[_0xf374('0x16')]);module[_0xf374('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index ce9d53c..59171df 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe73b=['sequelize','exports','STRING'];(function(_0x3fdba4,_0x538272){var _0x1dd6dc=function(_0x56a53d){while(--_0x56a53d){_0x3fdba4['push'](_0x3fdba4['shift']());}};_0x1dd6dc(++_0x538272);}(_0xe73b,0x14a));var _0xbe73=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0xe73b[_0x16e0c8];return _0xe4b5af;};'use strict';var Sequelize=require(_0xbe73('0x0'));module[_0xbe73('0x1')]={'name':{'type':Sequelize[_0xbe73('0x2')]},'description':{'type':Sequelize[_0xbe73('0x2')]}}; \ No newline at end of file +var _0xccee=['STRING','exports'];(function(_0x105022,_0x3b5997){var _0x4635ce=function(_0x43505a){while(--_0x43505a){_0x105022['push'](_0x105022['shift']());}};_0x4635ce(++_0x3b5997);}(_0xccee,0x87));var _0xecce=function(_0x1a65aa,_0x590ae7){_0x1a65aa=_0x1a65aa-0x0;var _0x1b09e2=_0xccee[_0x1a65aa];return _0x1b09e2;};'use strict';var Sequelize=require('sequelize');module[_0xecce('0x0')]={'name':{'type':Sequelize[_0xecce('0x1')]},'description':{'type':Sequelize[_0xecce('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2ec8f05..cc1ca15 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 _0xb2cd=['intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','getFields','findOne','nolimit','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','reject','save','update','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x4da28f,_0x164324){var _0xe49192=function(_0x29fdfc){while(--_0x29fdfc){_0x4da28f['push'](_0x4da28f['shift']());}};_0xe49192(++_0x164324);}(_0xb2cd,0x12f));var _0xdb2c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xb2cd[_0x344a3f];return _0x264712;};'use strict';var pdf=require(_0xdb2c('0x0'));var emlformat=require(_0xdb2c('0x1'));var rimraf=require(_0xdb2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb2c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb2c('0x4'));var Mustache=require(_0xdb2c('0x5'));var util=require(_0xdb2c('0x6'));var path=require(_0xdb2c('0x7'));var sox=require('sox');var csv=require(_0xdb2c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdb2c('0x9'));var squel=require(_0xdb2c('0xa'));var crypto=require(_0xdb2c('0xb'));var jsforce=require(_0xdb2c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdb2c('0x8'));var querystring=require(_0xdb2c('0xd'));var Papa=require('papaparse');var Redis=require(_0xdb2c('0xe'));var authService=require(_0xdb2c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb2c('0x10'));var logger=require(_0xdb2c('0x11'))(_0xdb2c('0x12'));var utils=require(_0xdb2c('0x13'));var config=require(_0xdb2c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xdb2c('0x15'));var client=jayson[_0xdb2c('0x16')][_0xdb2c('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3ea0c8,_0x4f6b66,_0x1f2b48,_0x1b8952){return new BPromise(function(_0x4a6594,_0x19e36d){var _0x40f9c5=_0x1b8952||client;return _0x40f9c5[_0xdb2c('0x18')](_0x3ea0c8,_0x1f2b48)[_0xdb2c('0x19')](function(_0x4e5c09){logger[_0xdb2c('0x1a')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4f6b66,_0xdb2c('0x1b'));logger[_0xdb2c('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4f6b66,_0xdb2c('0x1b'),JSON['stringify'](_0x4e5c09));if(_0x4e5c09[_0xdb2c('0x1d')]){if(_0x4e5c09[_0xdb2c('0x1d')][_0xdb2c('0x1e')]===0x1f4){logger['error'](_0xdb2c('0x1f'),_0x4f6b66,_0x4e5c09[_0xdb2c('0x1d')][_0xdb2c('0x20')]);return _0x19e36d(_0x4e5c09[_0xdb2c('0x1d')]['message']);}logger[_0xdb2c('0x1d')](_0xdb2c('0x1f'),_0x4f6b66,_0x4e5c09['error'][_0xdb2c('0x20')]);return _0x4a6594(_0x4e5c09[_0xdb2c('0x1d')][_0xdb2c('0x20')]);}else{logger[_0xdb2c('0x1a')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4f6b66,_0xdb2c('0x1b'));_0x4a6594(_0x4e5c09[_0xdb2c('0x21')]['message']);}})[_0xdb2c('0x22')](function(_0x13131b){logger['error'](_0xdb2c('0x1f'),_0x4f6b66,_0x13131b);_0x19e36d(_0x13131b);});});}function respondWithStatusCode(_0x5a9ed3,_0x8531f){_0x8531f=_0x8531f||0xcc;return function(_0x139228){if(_0x139228){return _0x5a9ed3[_0xdb2c('0x23')](_0x8531f);}return _0x5a9ed3[_0xdb2c('0x24')](_0x8531f)[_0xdb2c('0x25')]();};}function respondWithResult(_0x4b5b2e,_0x59bd85){_0x59bd85=_0x59bd85||0xc8;return function(_0x2fb3c3){if(_0x2fb3c3){return _0x4b5b2e[_0xdb2c('0x24')](_0x59bd85)['json'](_0x2fb3c3);}};}function respondWithFilteredResult(_0x333cab,_0x7a52f2){return function(_0x3dc18c){if(_0x3dc18c){var _0x47e395=_0x3dc18c[_0xdb2c('0x26')],_0x1aece7=_0x7a52f2[_0xdb2c('0x27')],_0x216afc=_0x7a52f2[_0xdb2c('0x27')]+_0x7a52f2['limit'],_0x52abdf;if(_0x216afc>=_0x47e395){_0x216afc=_0x47e395;_0x52abdf=0xc8;}else{_0x52abdf=0xce;}_0x333cab[_0xdb2c('0x24')](_0x52abdf);return _0x333cab[_0xdb2c('0x28')](_0xdb2c('0x29'),_0x1aece7+'-'+_0x216afc+'/'+_0x47e395)['json'](_0x3dc18c);}return null;};}function patchUpdates(_0x3d0e8b){return function(_0x5e4425){try{jsonpatch['apply'](_0x5e4425,_0x3d0e8b,!![]);}catch(_0x1df792){return BPromise[_0xdb2c('0x2a')](_0x1df792);}return _0x5e4425[_0xdb2c('0x2b')]();};}function saveUpdates(_0x440b44,_0x9880e5){return function(_0x5351c0){if(_0x5351c0){return _0x5351c0[_0xdb2c('0x2c')](_0x440b44)['then'](function(_0x29c9a0){return _0x29c9a0;});}return null;};}function removeEntity(_0x36ed22,_0x600d4){return function(_0xb1431){if(_0xb1431){return _0xb1431['destroy']()[_0xdb2c('0x19')](function(){_0x36ed22['status'](0xcc)[_0xdb2c('0x25')]();});}};}function handleEntityNotFound(_0x3f9267,_0x2b3cbd){return function(_0x530869){if(!_0x530869){_0x3f9267['sendStatus'](0x194);}return _0x530869;};}function handleError(_0x48029b,_0x1c3df2){_0x1c3df2=_0x1c3df2||0x1f4;return function(_0x3e7a2a){logger['error'](_0x3e7a2a[_0xdb2c('0x2d')]);if(_0x3e7a2a[_0xdb2c('0x2e')]){delete _0x3e7a2a['name'];}_0x48029b[_0xdb2c('0x24')](_0x1c3df2)['send'](_0x3e7a2a);};}exports[_0xdb2c('0x2f')]=function(_0x4cd13a,_0x176fa0){var _0x43c5c9={},_0x41c581={},_0x505e5b={'count':0x0,'rows':[]};var _0x563c1e=_[_0xdb2c('0x30')](db[_0xdb2c('0x31')][_0xdb2c('0x32')],function(_0x4ffc92){return{'name':_0x4ffc92[_0xdb2c('0x33')],'type':_0x4ffc92[_0xdb2c('0x34')][_0xdb2c('0x35')]};});_0x41c581['model']=_[_0xdb2c('0x30')](_0x563c1e,_0xdb2c('0x2e'));_0x41c581[_0xdb2c('0x36')]=_[_0xdb2c('0x37')](_0x4cd13a[_0xdb2c('0x36')]);_0x41c581[_0xdb2c('0x38')]=_[_0xdb2c('0x39')](_0x41c581[_0xdb2c('0x3a')],_0x41c581[_0xdb2c('0x36')]);_0x43c5c9[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x41c581[_0xdb2c('0x3a')],qs[_0xdb2c('0x3c')](_0x4cd13a['query'][_0xdb2c('0x3c')]));_0x43c5c9[_0xdb2c('0x3b')]=_0x43c5c9[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x43c5c9[_0xdb2c('0x3b')]:_0x41c581[_0xdb2c('0x3a')];if(!_0x4cd13a['query'][_0xdb2c('0x3e')]('nolimit')){_0x43c5c9[_0xdb2c('0x3f')]=qs['limit'](_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x3f')]);_0x43c5c9[_0xdb2c('0x27')]=qs['offset'](_0x4cd13a['query'][_0xdb2c('0x27')]);}_0x43c5c9[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x4cd13a[_0xdb2c('0x36')]['sort']);_0x43c5c9[_0xdb2c('0x42')]=qs[_0xdb2c('0x38')](_[_0xdb2c('0x43')](_0x4cd13a[_0xdb2c('0x36')],_0x41c581[_0xdb2c('0x38')]),_0x563c1e);if(_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x43c5c9[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x43c5c9[_0xdb2c('0x42')],{'$or':_[_0xdb2c('0x30')](_0x563c1e,function(_0x78b175){if(_0x78b175['type']!==_0xdb2c('0x46')){var _0x50555b={};_0x50555b[_0x78b175[_0xdb2c('0x2e')]]={'$like':'%'+_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x44')]+'%'};return _0x50555b;}})});}_0x43c5c9=_['merge']({},_0x43c5c9,_0x4cd13a[_0xdb2c('0x47')]);var _0x4279ca={'where':_0x43c5c9['where']};return db['ZendeskConfiguration'][_0xdb2c('0x26')](_0x4279ca)[_0xdb2c('0x19')](function(_0x43fa84){_0x505e5b[_0xdb2c('0x26')]=_0x43fa84;if(_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x48')]){_0x43c5c9[_0xdb2c('0x49')]=[{'all':!![]}];}return db[_0xdb2c('0x31')][_0xdb2c('0x4a')](_0x43c5c9);})[_0xdb2c('0x19')](function(_0x3dceaf){_0x505e5b['rows']=_0x3dceaf;return _0x505e5b;})['then'](respondWithFilteredResult(_0x176fa0,_0x43c5c9))[_0xdb2c('0x22')](handleError(_0x176fa0,null));};exports[_0xdb2c('0x4b')]=function(_0x2fdb47,_0x4c7de4){var _0x2bd7df={'raw':![],'where':{'id':_0x2fdb47[_0xdb2c('0x4c')]['id']}},_0x199531={};_0x199531[_0xdb2c('0x3a')]=_[_0xdb2c('0x37')](db[_0xdb2c('0x31')]['rawAttributes']);_0x199531[_0xdb2c('0x36')]=_['keys'](_0x2fdb47[_0xdb2c('0x36')]);_0x199531[_0xdb2c('0x38')]=_['intersection'](_0x199531[_0xdb2c('0x3a')],_0x199531[_0xdb2c('0x36')]);_0x2bd7df[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x199531[_0xdb2c('0x3a')],qs['fields'](_0x2fdb47[_0xdb2c('0x36')][_0xdb2c('0x3c')]));_0x2bd7df['attributes']=_0x2bd7df[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x2bd7df[_0xdb2c('0x3b')]:_0x199531[_0xdb2c('0x3a')];if(_0x2fdb47[_0xdb2c('0x36')]['includeAll']){_0x2bd7df[_0xdb2c('0x49')]=[{'all':!![]}];}_0x2bd7df=_['merge']({},_0x2bd7df,_0x2fdb47[_0xdb2c('0x47')]);return db[_0xdb2c('0x31')][_0xdb2c('0x4d')](_0x2bd7df)[_0xdb2c('0x19')](handleEntityNotFound(_0x4c7de4,null))[_0xdb2c('0x19')](respondWithResult(_0x4c7de4,null))[_0xdb2c('0x22')](handleError(_0x4c7de4,null));};exports['create']=function(_0x462628,_0x1c0223){return db[_0xdb2c('0x31')][_0xdb2c('0x4e')](_0x462628[_0xdb2c('0x4f')],{})[_0xdb2c('0x19')](respondWithResult(_0x1c0223,0xc9))['catch'](handleError(_0x1c0223,null));};exports[_0xdb2c('0x2c')]=function(_0x28da99,_0x2c7ec5){if(_0x28da99[_0xdb2c('0x4f')]['id']){delete _0x28da99['body']['id'];}return db[_0xdb2c('0x31')][_0xdb2c('0x4d')]({'where':{'id':_0x28da99[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x2c7ec5,null))[_0xdb2c('0x19')](saveUpdates(_0x28da99[_0xdb2c('0x4f')],null))[_0xdb2c('0x19')](respondWithResult(_0x2c7ec5,null))[_0xdb2c('0x22')](handleError(_0x2c7ec5,null));};exports['destroy']=function(_0x4d75e1,_0x4e37e4){return db[_0xdb2c('0x31')]['find']({'where':{'id':_0x4d75e1[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x4e37e4,null))[_0xdb2c('0x19')](removeEntity(_0x4e37e4,null))[_0xdb2c('0x22')](handleError(_0x4e37e4,null));};exports[_0xdb2c('0x50')]=function(_0x5d6862,_0x39d823,_0x291f2d){var _0x2edefa={};var _0x140e11={};var _0x4e11af;var _0x16b65e;return db[_0xdb2c('0x31')][_0xdb2c('0x51')]({'where':{'id':_0x5d6862[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x39d823,null))[_0xdb2c('0x19')](function(_0x16ffab){if(_0x16ffab){_0x4e11af=_0x16ffab;_0x140e11['model']=_[_0xdb2c('0x37')](db['ZendeskField'][_0xdb2c('0x32')]);_0x140e11[_0xdb2c('0x36')]=_['keys'](_0x5d6862[_0xdb2c('0x36')]);_0x140e11[_0xdb2c('0x38')]=_['intersection'](_0x140e11[_0xdb2c('0x3a')],_0x140e11[_0xdb2c('0x36')]);_0x2edefa[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x140e11[_0xdb2c('0x3a')],qs[_0xdb2c('0x3c')](_0x5d6862['query'][_0xdb2c('0x3c')]));_0x2edefa[_0xdb2c('0x3b')]=_0x2edefa[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x2edefa[_0xdb2c('0x3b')]:_0x140e11['model'];_0x2edefa['order']=qs[_0xdb2c('0x41')](_0x5d6862[_0xdb2c('0x36')][_0xdb2c('0x41')]);_0x2edefa['where']=qs[_0xdb2c('0x38')](_['pick'](_0x5d6862[_0xdb2c('0x36')],_0x140e11['filters']));if(_0x5d6862[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x2edefa[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x2edefa[_0xdb2c('0x42')],{'$or':_[_0xdb2c('0x30')](_0x2edefa['attributes'],function(_0x35158b){var _0x31a3b9={};_0x31a3b9[_0x35158b]={'$like':'%'+_0x5d6862['query'][_0xdb2c('0x44')]+'%'};return _0x31a3b9;})});}_0x2edefa=_[_0xdb2c('0x45')]({},_0x2edefa,_0x5d6862[_0xdb2c('0x47')]);return _0x4e11af[_0xdb2c('0x50')](_0x2edefa);}})['then'](function(_0x2b88d3){if(_0x2b88d3){_0x16b65e=_0x2b88d3[_0xdb2c('0x3d')];if(!_0x5d6862['query']['hasOwnProperty'](_0xdb2c('0x52'))){_0x2edefa[_0xdb2c('0x3f')]=qs['limit'](_0x5d6862['query'][_0xdb2c('0x3f')]);_0x2edefa[_0xdb2c('0x27')]=qs['offset'](_0x5d6862['query'][_0xdb2c('0x27')]);}return _0x4e11af[_0xdb2c('0x50')](_0x2edefa);}})[_0xdb2c('0x19')](function(_0x176029){if(_0x176029){return _0x176029?{'count':_0x16b65e,'rows':_0x176029}:null;}})[_0xdb2c('0x19')](respondWithResult(_0x39d823,null))[_0xdb2c('0x22')](handleError(_0x39d823,null));};exports[_0xdb2c('0x53')]=function(_0x4774b3,_0x71bcaa,_0x3324b6){var _0x25c07e={};var _0x4f8aaa={};var _0x53af3d;var _0x1b3e4e;return db[_0xdb2c('0x31')][_0xdb2c('0x51')]({'where':{'id':_0x4774b3[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x71bcaa,null))[_0xdb2c('0x19')](function(_0x4e01ac){if(_0x4e01ac){_0x53af3d=_0x4e01ac;_0x4f8aaa[_0xdb2c('0x3a')]=_[_0xdb2c('0x37')](db[_0xdb2c('0x54')][_0xdb2c('0x32')]);_0x4f8aaa[_0xdb2c('0x36')]=_['keys'](_0x4774b3['query']);_0x4f8aaa[_0xdb2c('0x38')]=_[_0xdb2c('0x39')](_0x4f8aaa[_0xdb2c('0x3a')],_0x4f8aaa[_0xdb2c('0x36')]);_0x25c07e['attributes']=_[_0xdb2c('0x39')](_0x4f8aaa[_0xdb2c('0x3a')],qs['fields'](_0x4774b3['query']['fields']));_0x25c07e[_0xdb2c('0x3b')]=_0x25c07e[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x25c07e[_0xdb2c('0x3b')]:_0x4f8aaa['model'];_0x25c07e[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x41')]);_0x25c07e['where']=qs['filters'](_[_0xdb2c('0x43')](_0x4774b3[_0xdb2c('0x36')],_0x4f8aaa[_0xdb2c('0x38')]));if(_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x25c07e['where']=_[_0xdb2c('0x45')](_0x25c07e[_0xdb2c('0x42')],{'$or':_['map'](_0x25c07e[_0xdb2c('0x3b')],function(_0x4e78f4){var _0x2230bd={};_0x2230bd[_0x4e78f4]={'$like':'%'+_0x4774b3[_0xdb2c('0x36')]['filter']+'%'};return _0x2230bd;})});}_0x25c07e=_[_0xdb2c('0x45')]({},_0x25c07e,_0x4774b3['options']);return _0x53af3d[_0xdb2c('0x53')](_0x25c07e);}})[_0xdb2c('0x19')](function(_0x41fc5c){if(_0x41fc5c){_0x1b3e4e=_0x41fc5c['length'];if(!_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x3e')]('nolimit')){_0x25c07e[_0xdb2c('0x3f')]=qs[_0xdb2c('0x3f')](_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x3f')]);_0x25c07e['offset']=qs[_0xdb2c('0x27')](_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x27')]);}return _0x53af3d['getSubjects'](_0x25c07e);}})['then'](function(_0x441947){if(_0x441947){return _0x441947?{'count':_0x1b3e4e,'rows':_0x441947}:null;}})[_0xdb2c('0x19')](respondWithResult(_0x71bcaa,null))['catch'](handleError(_0x71bcaa,null));};exports[_0xdb2c('0x55')]=function(_0x50f1bc,_0x352eef,_0x141fdc){var _0x3dcf95={};var _0x48bdfc={};var _0x5970a0;var _0x3f34a1;return db[_0xdb2c('0x31')][_0xdb2c('0x51')]({'where':{'id':_0x50f1bc['params']['id']}})['then'](handleEntityNotFound(_0x352eef,null))[_0xdb2c('0x19')](function(_0x4ddc71){if(_0x4ddc71){_0x5970a0=_0x4ddc71;_0x48bdfc[_0xdb2c('0x3a')]=_[_0xdb2c('0x37')](db[_0xdb2c('0x54')][_0xdb2c('0x32')]);_0x48bdfc[_0xdb2c('0x36')]=_[_0xdb2c('0x37')](_0x50f1bc[_0xdb2c('0x36')]);_0x48bdfc['filters']=_['intersection'](_0x48bdfc['model'],_0x48bdfc['query']);_0x3dcf95[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x48bdfc['model'],qs[_0xdb2c('0x3c')](_0x50f1bc['query'][_0xdb2c('0x3c')]));_0x3dcf95[_0xdb2c('0x3b')]=_0x3dcf95['attributes'][_0xdb2c('0x3d')]?_0x3dcf95[_0xdb2c('0x3b')]:_0x48bdfc['model'];_0x3dcf95[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x50f1bc['query'][_0xdb2c('0x41')]);_0x3dcf95[_0xdb2c('0x42')]=qs[_0xdb2c('0x38')](_['pick'](_0x50f1bc['query'],_0x48bdfc[_0xdb2c('0x38')]));if(_0x50f1bc[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x3dcf95[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x3dcf95[_0xdb2c('0x42')],{'$or':_[_0xdb2c('0x30')](_0x3dcf95['attributes'],function(_0x43379c){var _0x2a3293={};_0x2a3293[_0x43379c]={'$like':'%'+_0x50f1bc[_0xdb2c('0x36')][_0xdb2c('0x44')]+'%'};return _0x2a3293;})});}_0x3dcf95=_[_0xdb2c('0x45')]({},_0x3dcf95,_0x50f1bc['options']);return _0x5970a0[_0xdb2c('0x55')](_0x3dcf95);}})[_0xdb2c('0x19')](function(_0x552e8a){if(_0x552e8a){_0x3f34a1=_0x552e8a[_0xdb2c('0x3d')];if(!_0x50f1bc['query'][_0xdb2c('0x3e')](_0xdb2c('0x52'))){_0x3dcf95[_0xdb2c('0x3f')]=qs[_0xdb2c('0x3f')](_0x50f1bc[_0xdb2c('0x36')]['limit']);_0x3dcf95[_0xdb2c('0x27')]=qs[_0xdb2c('0x27')](_0x50f1bc['query'][_0xdb2c('0x27')]);}return _0x5970a0[_0xdb2c('0x55')](_0x3dcf95);}})[_0xdb2c('0x19')](function(_0x5e853f){if(_0x5e853f){return _0x5e853f?{'count':_0x3f34a1,'rows':_0x5e853f}:null;}})['then'](respondWithResult(_0x352eef,null))[_0xdb2c('0x22')](handleError(_0x352eef,null));};exports[_0xdb2c('0x56')]=function(_0x353306,_0x5c1c27,_0x599317){var _0x10835e={};var _0x1dfd0f={};var _0x5e9c53;var _0x4ebe79;return db[_0xdb2c('0x31')]['findOne']({'where':{'id':_0x353306[_0xdb2c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c1c27,null))['then'](function(_0x174753){if(_0x174753){_0x5e9c53=_0x174753;_0x1dfd0f[_0xdb2c('0x3a')]=_['keys'](db[_0xdb2c('0x57')][_0xdb2c('0x32')]);_0x1dfd0f['query']=_['keys'](_0x353306['query']);_0x1dfd0f[_0xdb2c('0x38')]=_[_0xdb2c('0x39')](_0x1dfd0f[_0xdb2c('0x3a')],_0x1dfd0f['query']);_0x10835e['attributes']=_[_0xdb2c('0x39')](_0x1dfd0f[_0xdb2c('0x3a')],qs['fields'](_0x353306[_0xdb2c('0x36')]['fields']));_0x10835e[_0xdb2c('0x3b')]=_0x10835e['attributes']['length']?_0x10835e['attributes']:_0x1dfd0f[_0xdb2c('0x3a')];_0x10835e[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x353306[_0xdb2c('0x36')][_0xdb2c('0x41')]);_0x10835e[_0xdb2c('0x42')]=qs['filters'](_['pick'](_0x353306['query'],_0x1dfd0f['filters']));if(_0x353306[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x10835e[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x10835e['where'],{'$or':_[_0xdb2c('0x30')](_0x10835e[_0xdb2c('0x3b')],function(_0x2ae248){var _0x42b81d={};_0x42b81d[_0x2ae248]={'$like':'%'+_0x353306[_0xdb2c('0x36')]['filter']+'%'};return _0x42b81d;})});}_0x10835e=_['merge']({},_0x10835e,_0x353306[_0xdb2c('0x47')]);return _0x5e9c53[_0xdb2c('0x56')](_0x10835e);}})[_0xdb2c('0x19')](function(_0x2500f9){if(_0x2500f9){_0x4ebe79=_0x2500f9[_0xdb2c('0x3d')];if(!_0x353306[_0xdb2c('0x36')][_0xdb2c('0x3e')](_0xdb2c('0x52'))){_0x10835e[_0xdb2c('0x3f')]=qs['limit'](_0x353306[_0xdb2c('0x36')][_0xdb2c('0x3f')]);_0x10835e[_0xdb2c('0x27')]=qs[_0xdb2c('0x27')](_0x353306['query'][_0xdb2c('0x27')]);}return _0x5e9c53[_0xdb2c('0x56')](_0x10835e);}})[_0xdb2c('0x19')](function(_0x48f3e6){if(_0x48f3e6){return _0x48f3e6?{'count':_0x4ebe79,'rows':_0x48f3e6}:null;}})[_0xdb2c('0x19')](respondWithResult(_0x5c1c27,null))[_0xdb2c('0x22')](handleError(_0x5c1c27,null));};exports['setTags']=function(_0x16c763,_0x4c804a,_0x395a8f){if(_0x16c763['body']['id']){delete _0x16c763[_0xdb2c('0x4f')]['id'];}return db[_0xdb2c('0x31')]['findOne']({'where':{'id':_0x16c763['params']['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x4c804a,null))[_0xdb2c('0x19')](function(_0x48b73f){if(_0x48b73f){return _0x48b73f[_0xdb2c('0x58')](_0x16c763[_0xdb2c('0x4f')][_0xdb2c('0x59')]||[]);}return null;})[_0xdb2c('0x19')](respondWithResult(_0x4c804a,null))[_0xdb2c('0x22')](handleError(_0x4c804a,null));}; \ No newline at end of file +var _0x6396=['update','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','create','body','find','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6396,0x145));var _0x6639=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x6396[_0x2caaef];return _0xd011f8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6639('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6639('0x1'));var rp=require('request-promise');var moment=require(_0x6639('0x2'));var BPromise=require(_0x6639('0x3'));var Mustache=require('mustache');var util=require(_0x6639('0x4'));var path=require(_0x6639('0x5'));var sox=require(_0x6639('0x6'));var csv=require(_0x6639('0x7'));var ejs=require(_0x6639('0x8'));var fs=require('fs');var _=require(_0x6639('0x9'));var squel=require(_0x6639('0xa'));var crypto=require('crypto');var jsforce=require(_0x6639('0xb'));var deskjs=require(_0x6639('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6639('0xd'));var Papa=require(_0x6639('0xe'));var Redis=require('ioredis');var authService=require(_0x6639('0xf'));var qs=require(_0x6639('0x10'));var as=require(_0x6639('0x11'));var hardwareService=require(_0x6639('0x12'));var logger=require(_0x6639('0x13'))(_0x6639('0x14'));var utils=require(_0x6639('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6639('0x16'));var db=require(_0x6639('0x17'))['db'];var jayson=require(_0x6639('0x18'));var client=jayson[_0x6639('0x19')][_0x6639('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x54b3f7,_0x560308,_0x4b0109,_0x1f7976){return new BPromise(function(_0x306743,_0x3e8655){var _0x1a87e5=_0x1f7976||client;return _0x1a87e5[_0x6639('0x1b')](_0x54b3f7,_0x4b0109)[_0x6639('0x1c')](function(_0x20c81d){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x560308,_0x6639('0x1d'));logger[_0x6639('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x560308,_0x6639('0x1d'),JSON[_0x6639('0x1f')](_0x20c81d));if(_0x20c81d[_0x6639('0x20')]){if(_0x20c81d[_0x6639('0x20')][_0x6639('0x21')]===0x1f4){logger[_0x6639('0x20')](_0x6639('0x22'),_0x560308,_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);return _0x3e8655(_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);}logger[_0x6639('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x560308,_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);return _0x306743(_0x20c81d[_0x6639('0x20')][_0x6639('0x23')]);}else{logger[_0x6639('0x24')](_0x6639('0x22'),_0x560308,_0x6639('0x1d'));_0x306743(_0x20c81d['result']['message']);}})[_0x6639('0x25')](function(_0x2e19c9){logger['error'](_0x6639('0x22'),_0x560308,_0x2e19c9);_0x3e8655(_0x2e19c9);});});}function respondWithStatusCode(_0x512b8d,_0x5c7676){_0x5c7676=_0x5c7676||0xcc;return function(_0x35c4b1){if(_0x35c4b1){return _0x512b8d[_0x6639('0x26')](_0x5c7676);}return _0x512b8d[_0x6639('0x27')](_0x5c7676)[_0x6639('0x28')]();};}function respondWithResult(_0x483b77,_0x2a7702){_0x2a7702=_0x2a7702||0xc8;return function(_0x2e0a73){if(_0x2e0a73){return _0x483b77[_0x6639('0x27')](_0x2a7702)[_0x6639('0x29')](_0x2e0a73);}};}function respondWithFilteredResult(_0x1b6dba,_0x2208e2){return function(_0x35bef5){if(_0x35bef5){var _0x3cc9f4=_0x35bef5['count'],_0x5beea4=_0x2208e2['offset'],_0x349153=_0x2208e2[_0x6639('0x2a')]+_0x2208e2[_0x6639('0x2b')],_0x309af7;if(_0x349153>=_0x3cc9f4){_0x349153=_0x3cc9f4;_0x309af7=0xc8;}else{_0x309af7=0xce;}_0x1b6dba['status'](_0x309af7);return _0x1b6dba['set'](_0x6639('0x2c'),_0x5beea4+'-'+_0x349153+'/'+_0x3cc9f4)['json'](_0x35bef5);}return null;};}function patchUpdates(_0x1550a2){return function(_0x433d92){try{jsonpatch['apply'](_0x433d92,_0x1550a2,!![]);}catch(_0x1a432){return BPromise[_0x6639('0x2d')](_0x1a432);}return _0x433d92[_0x6639('0x2e')]();};}function saveUpdates(_0x15632b,_0x1ede04){return function(_0x1f0a4f){if(_0x1f0a4f){return _0x1f0a4f[_0x6639('0x2f')](_0x15632b)[_0x6639('0x1c')](function(_0x57c1aa){return _0x57c1aa;});}return null;};}function removeEntity(_0x344d8b,_0x5d938a){return function(_0x405dc3){if(_0x405dc3){return _0x405dc3[_0x6639('0x30')]()['then'](function(){_0x344d8b[_0x6639('0x27')](0xcc)[_0x6639('0x28')]();});}};}function handleEntityNotFound(_0x575d4e,_0x1aa9a7){return function(_0x9fc088){if(!_0x9fc088){_0x575d4e[_0x6639('0x26')](0x194);}return _0x9fc088;};}function handleError(_0x33ef29,_0x217f64){_0x217f64=_0x217f64||0x1f4;return function(_0x3635af){logger[_0x6639('0x20')](_0x3635af[_0x6639('0x31')]);if(_0x3635af[_0x6639('0x32')]){delete _0x3635af[_0x6639('0x32')];}_0x33ef29['status'](_0x217f64)[_0x6639('0x33')](_0x3635af);};}exports[_0x6639('0x34')]=function(_0x7294ce,_0x35eb1b){var _0x22df2e={},_0x5ab95c={},_0xe968a5={'count':0x0,'rows':[]};var _0xf44e44=_[_0x6639('0x35')](db[_0x6639('0x36')][_0x6639('0x37')],function(_0xbd7a1c){return{'name':_0xbd7a1c[_0x6639('0x38')],'type':_0xbd7a1c[_0x6639('0x39')][_0x6639('0x3a')]};});_0x5ab95c[_0x6639('0x3b')]=_[_0x6639('0x35')](_0xf44e44,_0x6639('0x32'));_0x5ab95c[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x7294ce[_0x6639('0x3c')]);_0x5ab95c[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x5ab95c[_0x6639('0x3b')],_0x5ab95c['query']);_0x22df2e[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x5ab95c[_0x6639('0x3b')],qs[_0x6639('0x41')](_0x7294ce[_0x6639('0x3c')][_0x6639('0x41')]));_0x22df2e[_0x6639('0x40')]=_0x22df2e[_0x6639('0x40')][_0x6639('0x42')]?_0x22df2e[_0x6639('0x40')]:_0x5ab95c[_0x6639('0x3b')];if(!_0x7294ce[_0x6639('0x3c')][_0x6639('0x43')](_0x6639('0x44'))){_0x22df2e[_0x6639('0x2b')]=qs[_0x6639('0x2b')](_0x7294ce['query'][_0x6639('0x2b')]);_0x22df2e[_0x6639('0x2a')]=qs[_0x6639('0x2a')](_0x7294ce[_0x6639('0x3c')]['offset']);}_0x22df2e[_0x6639('0x45')]=qs['sort'](_0x7294ce[_0x6639('0x3c')][_0x6639('0x46')]);_0x22df2e[_0x6639('0x47')]=qs[_0x6639('0x3e')](_[_0x6639('0x48')](_0x7294ce[_0x6639('0x3c')],_0x5ab95c[_0x6639('0x3e')]),_0xf44e44);if(_0x7294ce[_0x6639('0x3c')][_0x6639('0x49')]){_0x22df2e[_0x6639('0x47')]=_[_0x6639('0x4a')](_0x22df2e[_0x6639('0x47')],{'$or':_[_0x6639('0x35')](_0xf44e44,function(_0x2efa2c){if(_0x2efa2c[_0x6639('0x39')]!==_0x6639('0x4b')){var _0x30a3c1={};_0x30a3c1[_0x2efa2c[_0x6639('0x32')]]={'$like':'%'+_0x7294ce[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x30a3c1;}})});}_0x22df2e=_[_0x6639('0x4a')]({},_0x22df2e,_0x7294ce[_0x6639('0x4c')]);var _0x4968ba={'where':_0x22df2e[_0x6639('0x47')]};return db[_0x6639('0x36')][_0x6639('0x4d')](_0x4968ba)['then'](function(_0x2f45b0){_0xe968a5[_0x6639('0x4d')]=_0x2f45b0;if(_0x7294ce[_0x6639('0x3c')]['includeAll']){_0x22df2e[_0x6639('0x4e')]=[{'all':!![]}];}return db[_0x6639('0x36')][_0x6639('0x4f')](_0x22df2e);})[_0x6639('0x1c')](function(_0xbe86eb){_0xe968a5[_0x6639('0x50')]=_0xbe86eb;return _0xe968a5;})[_0x6639('0x1c')](respondWithFilteredResult(_0x35eb1b,_0x22df2e))[_0x6639('0x25')](handleError(_0x35eb1b,null));};exports['show']=function(_0x58078b,_0x2af1e3){var _0x3885fa={'raw':![],'where':{'id':_0x58078b[_0x6639('0x51')]['id']}},_0x268461={};_0x268461['model']=_[_0x6639('0x3d')](db[_0x6639('0x36')][_0x6639('0x37')]);_0x268461[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x58078b[_0x6639('0x3c')]);_0x268461[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x268461[_0x6639('0x3b')],_0x268461[_0x6639('0x3c')]);_0x3885fa[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x268461['model'],qs[_0x6639('0x41')](_0x58078b[_0x6639('0x3c')][_0x6639('0x41')]));_0x3885fa[_0x6639('0x40')]=_0x3885fa[_0x6639('0x40')][_0x6639('0x42')]?_0x3885fa[_0x6639('0x40')]:_0x268461[_0x6639('0x3b')];if(_0x58078b[_0x6639('0x3c')]['includeAll']){_0x3885fa[_0x6639('0x4e')]=[{'all':!![]}];}_0x3885fa=_[_0x6639('0x4a')]({},_0x3885fa,_0x58078b[_0x6639('0x4c')]);return db[_0x6639('0x36')]['find'](_0x3885fa)[_0x6639('0x1c')](handleEntityNotFound(_0x2af1e3,null))[_0x6639('0x1c')](respondWithResult(_0x2af1e3,null))[_0x6639('0x25')](handleError(_0x2af1e3,null));};exports[_0x6639('0x52')]=function(_0x5975fb,_0x16625d){return db['ZendeskConfiguration'][_0x6639('0x52')](_0x5975fb['body'],{})[_0x6639('0x1c')](respondWithResult(_0x16625d,0xc9))[_0x6639('0x25')](handleError(_0x16625d,null));};exports[_0x6639('0x2f')]=function(_0xe0a49e,_0x309c06){if(_0xe0a49e[_0x6639('0x53')]['id']){delete _0xe0a49e[_0x6639('0x53')]['id'];}return db['ZendeskConfiguration'][_0x6639('0x54')]({'where':{'id':_0xe0a49e[_0x6639('0x51')]['id']}})['then'](handleEntityNotFound(_0x309c06,null))[_0x6639('0x1c')](saveUpdates(_0xe0a49e[_0x6639('0x53')],null))['then'](respondWithResult(_0x309c06,null))[_0x6639('0x25')](handleError(_0x309c06,null));};exports[_0x6639('0x30')]=function(_0x17ad8f,_0x13dd5d){return db[_0x6639('0x36')]['find']({'where':{'id':_0x17ad8f[_0x6639('0x51')]['id']}})[_0x6639('0x1c')](handleEntityNotFound(_0x13dd5d,null))[_0x6639('0x1c')](removeEntity(_0x13dd5d,null))[_0x6639('0x25')](handleError(_0x13dd5d,null));};exports[_0x6639('0x55')]=function(_0x217b50,_0x238324,_0x2804ea){var _0x2c1942={};var _0x5cfbd6={};var _0x1a4c8d;var _0x3eba69;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x217b50[_0x6639('0x51')]['id']}})['then'](handleEntityNotFound(_0x238324,null))['then'](function(_0x35b2f4){if(_0x35b2f4){_0x1a4c8d=_0x35b2f4;_0x5cfbd6[_0x6639('0x3b')]=_['keys'](db[_0x6639('0x57')][_0x6639('0x37')]);_0x5cfbd6[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x217b50['query']);_0x5cfbd6[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x5cfbd6[_0x6639('0x3b')],_0x5cfbd6[_0x6639('0x3c')]);_0x2c1942[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x5cfbd6['model'],qs['fields'](_0x217b50[_0x6639('0x3c')][_0x6639('0x41')]));_0x2c1942[_0x6639('0x40')]=_0x2c1942[_0x6639('0x40')]['length']?_0x2c1942['attributes']:_0x5cfbd6['model'];_0x2c1942[_0x6639('0x45')]=qs[_0x6639('0x46')](_0x217b50[_0x6639('0x3c')]['sort']);_0x2c1942[_0x6639('0x47')]=qs[_0x6639('0x3e')](_['pick'](_0x217b50[_0x6639('0x3c')],_0x5cfbd6[_0x6639('0x3e')]));if(_0x217b50['query'][_0x6639('0x49')]){_0x2c1942[_0x6639('0x47')]=_[_0x6639('0x4a')](_0x2c1942[_0x6639('0x47')],{'$or':_['map'](_0x2c1942[_0x6639('0x40')],function(_0x1f07ff){var _0x2b84c8={};_0x2b84c8[_0x1f07ff]={'$like':'%'+_0x217b50[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x2b84c8;})});}_0x2c1942=_['merge']({},_0x2c1942,_0x217b50[_0x6639('0x4c')]);return _0x1a4c8d['getFields'](_0x2c1942);}})[_0x6639('0x1c')](function(_0x50f8b6){if(_0x50f8b6){_0x3eba69=_0x50f8b6[_0x6639('0x42')];if(!_0x217b50[_0x6639('0x3c')]['hasOwnProperty'](_0x6639('0x44'))){_0x2c1942[_0x6639('0x2b')]=qs[_0x6639('0x2b')](_0x217b50[_0x6639('0x3c')][_0x6639('0x2b')]);_0x2c1942[_0x6639('0x2a')]=qs[_0x6639('0x2a')](_0x217b50[_0x6639('0x3c')]['offset']);}return _0x1a4c8d[_0x6639('0x55')](_0x2c1942);}})[_0x6639('0x1c')](function(_0x234c4e){if(_0x234c4e){return _0x234c4e?{'count':_0x3eba69,'rows':_0x234c4e}:null;}})[_0x6639('0x1c')](respondWithResult(_0x238324,null))[_0x6639('0x25')](handleError(_0x238324,null));};exports[_0x6639('0x58')]=function(_0x15e05d,_0x264396,_0x4888a6){var _0x287ef1={};var _0xd44f11={};var _0x350c6b;var _0x3ef1aa;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x15e05d[_0x6639('0x51')]['id']}})[_0x6639('0x1c')](handleEntityNotFound(_0x264396,null))[_0x6639('0x1c')](function(_0x42d632){if(_0x42d632){_0x350c6b=_0x42d632;_0xd44f11[_0x6639('0x3b')]=_[_0x6639('0x3d')](db[_0x6639('0x57')][_0x6639('0x37')]);_0xd44f11[_0x6639('0x3c')]=_['keys'](_0x15e05d[_0x6639('0x3c')]);_0xd44f11['filters']=_[_0x6639('0x3f')](_0xd44f11[_0x6639('0x3b')],_0xd44f11[_0x6639('0x3c')]);_0x287ef1[_0x6639('0x40')]=_[_0x6639('0x3f')](_0xd44f11[_0x6639('0x3b')],qs[_0x6639('0x41')](_0x15e05d['query']['fields']));_0x287ef1[_0x6639('0x40')]=_0x287ef1[_0x6639('0x40')][_0x6639('0x42')]?_0x287ef1[_0x6639('0x40')]:_0xd44f11[_0x6639('0x3b')];_0x287ef1[_0x6639('0x45')]=qs['sort'](_0x15e05d['query']['sort']);_0x287ef1[_0x6639('0x47')]=qs[_0x6639('0x3e')](_[_0x6639('0x48')](_0x15e05d[_0x6639('0x3c')],_0xd44f11['filters']));if(_0x15e05d['query'][_0x6639('0x49')]){_0x287ef1['where']=_[_0x6639('0x4a')](_0x287ef1['where'],{'$or':_[_0x6639('0x35')](_0x287ef1[_0x6639('0x40')],function(_0x54ed2b){var _0x2e297d={};_0x2e297d[_0x54ed2b]={'$like':'%'+_0x15e05d[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x2e297d;})});}_0x287ef1=_['merge']({},_0x287ef1,_0x15e05d[_0x6639('0x4c')]);return _0x350c6b[_0x6639('0x58')](_0x287ef1);}})[_0x6639('0x1c')](function(_0x2d551d){if(_0x2d551d){_0x3ef1aa=_0x2d551d[_0x6639('0x42')];if(!_0x15e05d[_0x6639('0x3c')][_0x6639('0x43')](_0x6639('0x44'))){_0x287ef1['limit']=qs[_0x6639('0x2b')](_0x15e05d[_0x6639('0x3c')][_0x6639('0x2b')]);_0x287ef1[_0x6639('0x2a')]=qs['offset'](_0x15e05d[_0x6639('0x3c')][_0x6639('0x2a')]);}return _0x350c6b[_0x6639('0x58')](_0x287ef1);}})['then'](function(_0x1e1584){if(_0x1e1584){return _0x1e1584?{'count':_0x3ef1aa,'rows':_0x1e1584}:null;}})[_0x6639('0x1c')](respondWithResult(_0x264396,null))[_0x6639('0x25')](handleError(_0x264396,null));};exports[_0x6639('0x59')]=function(_0x4bde72,_0x1f8efc,_0x2a7b35){var _0x1e10fe={};var _0x500ee1={};var _0x4591d4;var _0x2429f4;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x4bde72[_0x6639('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f8efc,null))['then'](function(_0x3f25f4){if(_0x3f25f4){_0x4591d4=_0x3f25f4;_0x500ee1[_0x6639('0x3b')]=_[_0x6639('0x3d')](db[_0x6639('0x57')][_0x6639('0x37')]);_0x500ee1['query']=_[_0x6639('0x3d')](_0x4bde72[_0x6639('0x3c')]);_0x500ee1[_0x6639('0x3e')]=_[_0x6639('0x3f')](_0x500ee1[_0x6639('0x3b')],_0x500ee1[_0x6639('0x3c')]);_0x1e10fe['attributes']=_['intersection'](_0x500ee1['model'],qs[_0x6639('0x41')](_0x4bde72[_0x6639('0x3c')][_0x6639('0x41')]));_0x1e10fe[_0x6639('0x40')]=_0x1e10fe[_0x6639('0x40')][_0x6639('0x42')]?_0x1e10fe[_0x6639('0x40')]:_0x500ee1[_0x6639('0x3b')];_0x1e10fe[_0x6639('0x45')]=qs['sort'](_0x4bde72['query'][_0x6639('0x46')]);_0x1e10fe[_0x6639('0x47')]=qs['filters'](_[_0x6639('0x48')](_0x4bde72[_0x6639('0x3c')],_0x500ee1[_0x6639('0x3e')]));if(_0x4bde72[_0x6639('0x3c')][_0x6639('0x49')]){_0x1e10fe[_0x6639('0x47')]=_[_0x6639('0x4a')](_0x1e10fe['where'],{'$or':_[_0x6639('0x35')](_0x1e10fe[_0x6639('0x40')],function(_0x2c4267){var _0x266a10={};_0x266a10[_0x2c4267]={'$like':'%'+_0x4bde72['query']['filter']+'%'};return _0x266a10;})});}_0x1e10fe=_['merge']({},_0x1e10fe,_0x4bde72['options']);return _0x4591d4[_0x6639('0x59')](_0x1e10fe);}})[_0x6639('0x1c')](function(_0x1301b6){if(_0x1301b6){_0x2429f4=_0x1301b6['length'];if(!_0x4bde72[_0x6639('0x3c')][_0x6639('0x43')]('nolimit')){_0x1e10fe[_0x6639('0x2b')]=qs[_0x6639('0x2b')](_0x4bde72[_0x6639('0x3c')][_0x6639('0x2b')]);_0x1e10fe[_0x6639('0x2a')]=qs[_0x6639('0x2a')](_0x4bde72[_0x6639('0x3c')]['offset']);}return _0x4591d4[_0x6639('0x59')](_0x1e10fe);}})[_0x6639('0x1c')](function(_0x52a11a){if(_0x52a11a){return _0x52a11a?{'count':_0x2429f4,'rows':_0x52a11a}:null;}})['then'](respondWithResult(_0x1f8efc,null))[_0x6639('0x25')](handleError(_0x1f8efc,null));};exports[_0x6639('0x5a')]=function(_0x4d8b0c,_0x1d12e0,_0x41b780){var _0x4e1cec={};var _0x1750ae={};var _0xf77385;var _0x4c855d;return db[_0x6639('0x36')][_0x6639('0x56')]({'where':{'id':_0x4d8b0c['params']['id']}})['then'](handleEntityNotFound(_0x1d12e0,null))['then'](function(_0x50efac){if(_0x50efac){_0xf77385=_0x50efac;_0x1750ae[_0x6639('0x3b')]=_[_0x6639('0x3d')](db[_0x6639('0x5b')][_0x6639('0x37')]);_0x1750ae[_0x6639('0x3c')]=_[_0x6639('0x3d')](_0x4d8b0c[_0x6639('0x3c')]);_0x1750ae['filters']=_[_0x6639('0x3f')](_0x1750ae[_0x6639('0x3b')],_0x1750ae[_0x6639('0x3c')]);_0x4e1cec[_0x6639('0x40')]=_[_0x6639('0x3f')](_0x1750ae[_0x6639('0x3b')],qs[_0x6639('0x41')](_0x4d8b0c[_0x6639('0x3c')]['fields']));_0x4e1cec[_0x6639('0x40')]=_0x4e1cec[_0x6639('0x40')]['length']?_0x4e1cec['attributes']:_0x1750ae[_0x6639('0x3b')];_0x4e1cec[_0x6639('0x45')]=qs[_0x6639('0x46')](_0x4d8b0c[_0x6639('0x3c')]['sort']);_0x4e1cec[_0x6639('0x47')]=qs[_0x6639('0x3e')](_[_0x6639('0x48')](_0x4d8b0c['query'],_0x1750ae[_0x6639('0x3e')]));if(_0x4d8b0c[_0x6639('0x3c')][_0x6639('0x49')]){_0x4e1cec[_0x6639('0x47')]=_['merge'](_0x4e1cec[_0x6639('0x47')],{'$or':_[_0x6639('0x35')](_0x4e1cec[_0x6639('0x40')],function(_0x297848){var _0x48b3c7={};_0x48b3c7[_0x297848]={'$like':'%'+_0x4d8b0c[_0x6639('0x3c')][_0x6639('0x49')]+'%'};return _0x48b3c7;})});}_0x4e1cec=_[_0x6639('0x4a')]({},_0x4e1cec,_0x4d8b0c[_0x6639('0x4c')]);return _0xf77385[_0x6639('0x5a')](_0x4e1cec);}})[_0x6639('0x1c')](function(_0x1ba411){if(_0x1ba411){_0x4c855d=_0x1ba411[_0x6639('0x42')];if(!_0x4d8b0c['query'][_0x6639('0x43')](_0x6639('0x44'))){_0x4e1cec[_0x6639('0x2b')]=qs['limit'](_0x4d8b0c[_0x6639('0x3c')][_0x6639('0x2b')]);_0x4e1cec['offset']=qs[_0x6639('0x2a')](_0x4d8b0c['query'][_0x6639('0x2a')]);}return _0xf77385[_0x6639('0x5a')](_0x4e1cec);}})[_0x6639('0x1c')](function(_0x530098){if(_0x530098){return _0x530098?{'count':_0x4c855d,'rows':_0x530098}:null;}})['then'](respondWithResult(_0x1d12e0,null))['catch'](handleError(_0x1d12e0,null));};exports[_0x6639('0x5c')]=function(_0x1390d7,_0x5f0843,_0x236ae2){if(_0x1390d7['body']['id']){delete _0x1390d7[_0x6639('0x53')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1390d7[_0x6639('0x51')]['id']}})[_0x6639('0x1c')](handleEntityNotFound(_0x5f0843,null))[_0x6639('0x1c')](function(_0x1eaad9){if(_0x1eaad9){return _0x1eaad9[_0x6639('0x5c')](_0x1390d7[_0x6639('0x53')]['ids']||[]);}return null;})['then'](respondWithResult(_0x5f0843,null))[_0x6639('0x25')](handleError(_0x5f0843,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 3e207d9..8485575 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 _0xcbd0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x3e5ea4,_0x2c2743){var _0x57edc3=function(_0x3ef8e1){while(--_0x3ef8e1){_0x3e5ea4['push'](_0x3e5ea4['shift']());}};_0x57edc3(++_0x2c2743);}(_0xcbd0,0xb4));var _0x0cbd=function(_0x38c983,_0x193747){_0x38c983=_0x38c983-0x0;var _0x185d5c=_0xcbd0[_0x38c983];return _0x185d5c;};'use strict';var _=require(_0x0cbd('0x0'));var util=require(_0x0cbd('0x1'));var logger=require('../../config/logger')(_0x0cbd('0x2'));var moment=require(_0x0cbd('0x3'));var BPromise=require(_0x0cbd('0x4'));var rp=require(_0x0cbd('0x5'));var fs=require('fs');var path=require(_0x0cbd('0x6'));var rimraf=require(_0x0cbd('0x7'));var config=require(_0x0cbd('0x8'));var attributes=require(_0x0cbd('0x9'));module[_0x0cbd('0xa')]=function(_0x3a571f,_0x150977){return _0x3a571f[_0x0cbd('0xb')](_0x0cbd('0xc'),attributes,{'tableName':_0x0cbd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6017=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x31cdfe,_0x12fc88){var _0x471ce3=function(_0xce9887){while(--_0xce9887){_0x31cdfe['push'](_0x31cdfe['shift']());}};_0x471ce3(++_0x12fc88);}(_0x6017,0x110));var _0x7601=function(_0x221608,_0x357be2){_0x221608=_0x221608-0x0;var _0x557280=_0x6017[_0x221608];return _0x557280;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var logger=require(_0x7601('0x2'))(_0x7601('0x3'));var moment=require(_0x7601('0x4'));var BPromise=require(_0x7601('0x5'));var rp=require(_0x7601('0x6'));var fs=require('fs');var path=require(_0x7601('0x7'));var rimraf=require(_0x7601('0x8'));var config=require(_0x7601('0x9'));var attributes=require(_0x7601('0xa'));module['exports']=function(_0x2a1d2f,_0x39bb72){return _0x2a1d2f[_0x7601('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x7601('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index ee47b44..1be7c4c 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 _0x17d1=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then'];(function(_0x1fa6e8,_0x2dc7e9){var _0x1e18a8=function(_0x395175){while(--_0x395175){_0x1fa6e8['push'](_0x1fa6e8['shift']());}};_0x1e18a8(++_0x2dc7e9);}(_0x17d1,0x14d));var _0x117d=function(_0x283554,_0x440e1d){_0x283554=_0x283554-0x0;var _0xc44bc0=_0x17d1[_0x283554];return _0xc44bc0;};'use strict';var _=require(_0x117d('0x0'));var util=require(_0x117d('0x1'));var moment=require(_0x117d('0x2'));var BPromise=require(_0x117d('0x3'));var rs=require(_0x117d('0x4'));var fs=require('fs');var Redis=require(_0x117d('0x5'));var db=require(_0x117d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x117d('0x7'));var config=require('../../config/environment');var jayson=require(_0x117d('0x8'));var client=jayson[_0x117d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33612d,_0x2d8189,_0x33b58c){return new BPromise(function(_0x43ed5b,_0x15e9d0){return client[_0x117d('0xa')](_0x33612d,_0x33b58c)[_0x117d('0xb')](function(_0x928b64){logger[_0x117d('0xc')](_0x117d('0xd'),_0x2d8189,_0x117d('0xe'));logger[_0x117d('0xf')](_0x117d('0x10'),_0x2d8189,_0x117d('0xe'),JSON[_0x117d('0x11')](_0x928b64));if(_0x928b64[_0x117d('0x12')]){if(_0x928b64[_0x117d('0x12')][_0x117d('0x13')]===0x1f4){logger[_0x117d('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2d8189,_0x928b64['error']['message']);return _0x15e9d0(_0x928b64[_0x117d('0x12')][_0x117d('0x14')]);}logger[_0x117d('0x12')](_0x117d('0xd'),_0x2d8189,_0x928b64[_0x117d('0x12')][_0x117d('0x14')]);return _0x43ed5b(_0x928b64[_0x117d('0x12')][_0x117d('0x14')]);}else{logger[_0x117d('0xc')](_0x117d('0xd'),_0x2d8189,_0x117d('0xe'));_0x43ed5b(_0x928b64[_0x117d('0x15')]['message']);}})[_0x117d('0x16')](function(_0x289bcb){logger[_0x117d('0x12')](_0x117d('0xd'),_0x2d8189,_0x289bcb);_0x15e9d0(_0x289bcb);});});} \ No newline at end of file +var _0x18f5=['http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x4a3ee0,_0xa9cfad){var _0x1a627d=function(_0x29bc91){while(--_0x29bc91){_0x4a3ee0['push'](_0x4a3ee0['shift']());}};_0x1a627d(++_0xa9cfad);}(_0x18f5,0x18e));var _0x518f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x18f5[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x518f('0x0'));var util=require(_0x518f('0x1'));var moment=require(_0x518f('0x2'));var BPromise=require('bluebird');var rs=require(_0x518f('0x3'));var fs=require('fs');var Redis=require(_0x518f('0x4'));var db=require(_0x518f('0x5'))['db'];var utils=require(_0x518f('0x6'));var logger=require(_0x518f('0x7'))('rpc');var config=require(_0x518f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x518f('0x9')][_0x518f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10cd07,_0x2203ac,_0x3e6e77){return new BPromise(function(_0xf22eba,_0x152784){return client[_0x518f('0xb')](_0x10cd07,_0x3e6e77)[_0x518f('0xc')](function(_0x1a621d){logger['info'](_0x518f('0xd'),_0x2203ac,_0x518f('0xe'));logger[_0x518f('0xf')](_0x518f('0x10'),_0x2203ac,_0x518f('0xe'),JSON[_0x518f('0x11')](_0x1a621d));if(_0x1a621d[_0x518f('0x12')]){if(_0x1a621d[_0x518f('0x12')][_0x518f('0x13')]===0x1f4){logger['error'](_0x518f('0xd'),_0x2203ac,_0x1a621d[_0x518f('0x12')]['message']);return _0x152784(_0x1a621d['error'][_0x518f('0x14')]);}logger[_0x518f('0x12')](_0x518f('0xd'),_0x2203ac,_0x1a621d[_0x518f('0x12')][_0x518f('0x14')]);return _0xf22eba(_0x1a621d['error'][_0x518f('0x14')]);}else{logger[_0x518f('0x15')](_0x518f('0xd'),_0x2203ac,_0x518f('0xe'));_0xf22eba(_0x1a621d[_0x518f('0x16')][_0x518f('0x14')]);}})[_0x518f('0x17')](function(_0x2e6296){logger['error'](_0x518f('0xd'),_0x2203ac,_0x2e6296);_0x152784(_0x2e6296);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 38f0dc4..1f2f85a 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 _0xc3b8=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x4e2860,_0x418bd0){var _0x5e51cb=function(_0x183f99){while(--_0x183f99){_0x4e2860['push'](_0x4e2860['shift']());}};_0x5e51cb(++_0x418bd0);}(_0xc3b8,0x118));var _0x8c3b=function(_0x4da144,_0x1b6d8d){_0x4da144=_0x4da144-0x0;var _0x426592=_0xc3b8[_0x4da144];return _0x426592;};'use strict';var multer=require(_0x8c3b('0x0'));var util=require(_0x8c3b('0x1'));var path=require(_0x8c3b('0x2'));var timeout=require(_0x8c3b('0x3'));var express=require(_0x8c3b('0x4'));var router=express[_0x8c3b('0x5')]();var auth=require(_0x8c3b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c3b('0x7'));var controller=require(_0x8c3b('0x8'));router['get']('/',auth[_0x8c3b('0x9')](),controller[_0x8c3b('0xa')]);router[_0x8c3b('0xb')](_0x8c3b('0xc'),auth[_0x8c3b('0x9')](),controller[_0x8c3b('0xd')]);router[_0x8c3b('0xe')]('/',auth[_0x8c3b('0x9')](),controller[_0x8c3b('0xf')]);router[_0x8c3b('0x10')]('/:id',auth[_0x8c3b('0x9')](),controller['update']);router[_0x8c3b('0x11')](_0x8c3b('0xc'),auth['isAuthenticated'](),controller[_0x8c3b('0x12')]);module[_0x8c3b('0x13')]=router; \ No newline at end of file +var _0x3eec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x5bb0fd,_0x550b23){var _0x217bee=function(_0x2d6796){while(--_0x2d6796){_0x5bb0fd['push'](_0x5bb0fd['shift']());}};_0x217bee(++_0x550b23);}(_0x3eec,0x1e9));var _0xc3ee=function(_0xd790dd,_0x4f0824){_0xd790dd=_0xd790dd-0x0;var _0x313ea8=_0x3eec[_0xd790dd];return _0x313ea8;};'use strict';var multer=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var path=require(_0xc3ee('0x2'));var timeout=require(_0xc3ee('0x3'));var express=require('express');var router=express[_0xc3ee('0x4')]();var auth=require(_0xc3ee('0x5'));var interaction=require(_0xc3ee('0x6'));var config=require(_0xc3ee('0x7'));var controller=require(_0xc3ee('0x8'));router[_0xc3ee('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3ee('0xa')]);router[_0xc3ee('0x9')](_0xc3ee('0xb'),auth[_0xc3ee('0xc')](),controller[_0xc3ee('0xd')]);router[_0xc3ee('0xe')]('/',auth[_0xc3ee('0xc')](),controller[_0xc3ee('0xf')]);router[_0xc3ee('0x10')](_0xc3ee('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc3ee('0x11')](_0xc3ee('0xb'),auth[_0xc3ee('0xc')](),controller[_0xc3ee('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7e99326..d5c36be 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 _0x55a5=['keyValue','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x55a5,0xf7));var _0x555a=function(_0x39cdb8,_0x15ee98){_0x39cdb8=_0x39cdb8-0x0;var _0x44bbc9=_0x55a5[_0x39cdb8];return _0x44bbc9;};'use strict';var Sequelize=require(_0x555a('0x0'));module['exports']={'type':{'type':Sequelize[_0x555a('0x1')](_0x555a('0x2'),_0x555a('0x3'),_0x555a('0x4'),_0x555a('0x5')),'defaultValue':_0x555a('0x2')},'content':{'type':Sequelize[_0x555a('0x6')]},'key':{'type':Sequelize[_0x555a('0x6')]},'keyType':{'type':Sequelize[_0x555a('0x1')](_0x555a('0x2'),_0x555a('0x3'),_0x555a('0x4'))},'keyContent':{'type':Sequelize[_0x555a('0x6')]},'idField':{'type':Sequelize[_0x555a('0x6')]},'nameField':{'type':Sequelize[_0x555a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x555a('0x6')]}}; \ No newline at end of file +var _0x1738=['ENUM','string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','STRING'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x1738,0x1bc));var _0x8173=function(_0x410448,_0x3f8548){_0x410448=_0x410448-0x0;var _0x5c3225=_0x1738[_0x410448];return _0x5c3225;};'use strict';var Sequelize=require(_0x8173('0x0'));module[_0x8173('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8173('0x2'),_0x8173('0x3'),_0x8173('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8173('0x5')]},'keyType':{'type':Sequelize[_0x8173('0x6')](_0x8173('0x7'),_0x8173('0x2'),_0x8173('0x3'))},'keyContent':{'type':Sequelize[_0x8173('0x5')]},'idField':{'type':Sequelize[_0x8173('0x5')]},'nameField':{'type':Sequelize[_0x8173('0x5')]},'customField':{'type':Sequelize[_0x8173('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8173('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index dece9d9..0772676 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 _0x5430=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','map','ZendeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4fc6e5,_0x4526a1){var _0x528d72=function(_0x405814){while(--_0x405814){_0x4fc6e5['push'](_0x4fc6e5['shift']());}};_0x528d72(++_0x4526a1);}(_0x5430,0x10c));var _0x0543=function(_0x49148c,_0x41ff16){_0x49148c=_0x49148c-0x0;var _0x443913=_0x5430[_0x49148c];return _0x443913;};'use strict';var pdf=require(_0x0543('0x0'));var emlformat=require(_0x0543('0x1'));var rimraf=require(_0x0543('0x2'));var zipdir=require(_0x0543('0x3'));var jsonpatch=require(_0x0543('0x4'));var rp=require(_0x0543('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0543('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0543('0x7'));var csv=require(_0x0543('0x8'));var ejs=require(_0x0543('0x9'));var fs=require('fs');var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x8'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=_0x1dff7d[_0x0543('0x1c')],_0x38a32e=_0x40fb03[_0x0543('0x1d')],_0x50d504=_0x40fb03[_0x0543('0x1d')]+_0x40fb03[_0x0543('0x1e')],_0xe69a3d;if(_0x50d504>=_0x1cfadf){_0x50d504=_0x1cfadf;_0xe69a3d=0xc8;}else{_0xe69a3d=0xce;}_0xcb09df[_0x0543('0x1a')](_0xe69a3d);return _0xcb09df[_0x0543('0x1f')]('Content-Range',_0x38a32e+'-'+_0x50d504+'/'+_0x1cfadf)[_0x0543('0x20')](_0x1dff7d);}return null;};}function patchUpdates(_0x5362cb){return function(_0x50ea84){try{jsonpatch[_0x0543('0x21')](_0x50ea84,_0x5362cb,!![]);}catch(_0x419913){return BPromise[_0x0543('0x22')](_0x419913);}return _0x50ea84['save']();};}function saveUpdates(_0x3f0452,_0x51c271){return function(_0x401da5){if(_0x401da5){return _0x401da5[_0x0543('0x23')](_0x3f0452)['then'](function(_0x18dd45){return _0x18dd45;});}return null;};}function removeEntity(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')]()[_0x0543('0x25')](function(){_0x333c72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f1b2,_0xbfe5dc){return function(_0x25b3a1){if(!_0x25b3a1){_0x59f1b2[_0x0543('0x19')](0x194);}return _0x25b3a1;};}function handleError(_0xaf1c0e,_0x2b1425){_0x2b1425=_0x2b1425||0x1f4;return function(_0x26e500){logger[_0x0543('0x26')](_0x26e500[_0x0543('0x27')]);if(_0x26e500[_0x0543('0x28')]){delete _0x26e500[_0x0543('0x28')];}_0xaf1c0e[_0x0543('0x1a')](_0x2b1425)[_0x0543('0x29')](_0x26e500);};}exports['index']=function(_0x25e6f1,_0x153bda){var _0x30ad9e={},_0x4f2592={},_0x9c7e34={'count':0x0,'rows':[]};var _0x27031f=_[_0x0543('0x2a')](db[_0x0543('0x2b')]['rawAttributes'],function(_0x1732be){return{'name':_0x1732be[_0x0543('0x2c')],'type':_0x1732be['type']['key']};});_0x4f2592[_0x0543('0x2d')]=_[_0x0543('0x2a')](_0x27031f,'name');_0x4f2592[_0x0543('0x2e')]=_[_0x0543('0x2f')](_0x25e6f1[_0x0543('0x2e')]);_0x4f2592[_0x0543('0x30')]=_[_0x0543('0x31')](_0x4f2592[_0x0543('0x2d')],_0x4f2592[_0x0543('0x2e')]);_0x30ad9e['attributes']=_[_0x0543('0x31')](_0x4f2592['model'],qs[_0x0543('0x32')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x32')]));_0x30ad9e[_0x0543('0x33')]=_0x30ad9e[_0x0543('0x33')]['length']?_0x30ad9e[_0x0543('0x33')]:_0x4f2592['model'];if(!_0x25e6f1[_0x0543('0x2e')][_0x0543('0x34')](_0x0543('0x35'))){_0x30ad9e[_0x0543('0x1e')]=qs['limit'](_0x25e6f1[_0x0543('0x2e')]['limit']);_0x30ad9e[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x1d')]);}_0x30ad9e[_0x0543('0x36')]=qs[_0x0543('0x37')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x37')]);_0x30ad9e[_0x0543('0x38')]=qs[_0x0543('0x30')](_['pick'](_0x25e6f1[_0x0543('0x2e')],_0x4f2592[_0x0543('0x30')]),_0x27031f);if(_0x25e6f1['query'][_0x0543('0x39')]){_0x30ad9e['where']=_[_0x0543('0x3a')](_0x30ad9e[_0x0543('0x38')],{'$or':_['map'](_0x27031f,function(_0x5e8800){if(_0x5e8800[_0x0543('0x3b')]!==_0x0543('0x3c')){var _0x4ca572={};_0x4ca572[_0x5e8800[_0x0543('0x28')]]={'$like':'%'+_0x25e6f1[_0x0543('0x2e')]['filter']+'%'};return _0x4ca572;}})});}_0x30ad9e=_[_0x0543('0x3a')]({},_0x30ad9e,_0x25e6f1[_0x0543('0x3d')]);var _0x3ecd70={'where':_0x30ad9e[_0x0543('0x38')]};return db[_0x0543('0x2b')]['count'](_0x3ecd70)['then'](function(_0x4816ac){_0x9c7e34[_0x0543('0x1c')]=_0x4816ac;if(_0x25e6f1[_0x0543('0x2e')][_0x0543('0x3e')]){_0x30ad9e[_0x0543('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0x0543('0x40')](_0x30ad9e);})[_0x0543('0x25')](function(_0xe3936f){_0x9c7e34[_0x0543('0x41')]=_0xe3936f;return _0x9c7e34;})[_0x0543('0x25')](respondWithFilteredResult(_0x153bda,_0x30ad9e))[_0x0543('0x42')](handleError(_0x153bda,null));};exports[_0x0543('0x43')]=function(_0x58e779,_0x24a891){var _0x32d031={'raw':!![],'where':{'id':_0x58e779[_0x0543('0x44')]['id']}},_0x3dd2ca={};_0x3dd2ca[_0x0543('0x2d')]=_[_0x0543('0x2f')](db['ZendeskField']['rawAttributes']);_0x3dd2ca[_0x0543('0x2e')]=_[_0x0543('0x2f')](_0x58e779[_0x0543('0x2e')]);_0x3dd2ca[_0x0543('0x30')]=_[_0x0543('0x31')](_0x3dd2ca[_0x0543('0x2d')],_0x3dd2ca[_0x0543('0x2e')]);_0x32d031[_0x0543('0x33')]=_[_0x0543('0x31')](_0x3dd2ca['model'],qs['fields'](_0x58e779[_0x0543('0x2e')][_0x0543('0x32')]));_0x32d031['attributes']=_0x32d031['attributes'][_0x0543('0x45')]?_0x32d031[_0x0543('0x33')]:_0x3dd2ca['model'];if(_0x58e779[_0x0543('0x2e')]['includeAll']){_0x32d031[_0x0543('0x3f')]=[{'all':!![]}];}_0x32d031=_[_0x0543('0x3a')]({},_0x32d031,_0x58e779['options']);return db['ZendeskField'][_0x0543('0x46')](_0x32d031)['then'](handleEntityNotFound(_0x24a891,null))[_0x0543('0x25')](respondWithResult(_0x24a891,null))[_0x0543('0x42')](handleError(_0x24a891,null));};exports[_0x0543('0x47')]=function(_0x270ce0,_0x158536){return db[_0x0543('0x2b')]['create'](_0x270ce0[_0x0543('0x48')],{})[_0x0543('0x25')](respondWithResult(_0x158536,0xc9))[_0x0543('0x42')](handleError(_0x158536,null));};exports[_0x0543('0x23')]=function(_0x40abbd,_0x4ea239){if(_0x40abbd[_0x0543('0x48')]['id']){delete _0x40abbd['body']['id'];}return db[_0x0543('0x2b')][_0x0543('0x46')]({'where':{'id':_0x40abbd[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x4ea239,null))[_0x0543('0x25')](saveUpdates(_0x40abbd[_0x0543('0x48')],null))['then'](respondWithResult(_0x4ea239,null))['catch'](handleError(_0x4ea239,null));};exports['destroy']=function(_0xc832e2,_0x2177b8){return db['ZendeskField'][_0x0543('0x46')]({'where':{'id':_0xc832e2[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x2177b8,null))[_0x0543('0x25')](removeEntity(_0x2177b8,null))[_0x0543('0x42')](handleError(_0x2177b8,null));}; \ No newline at end of file +var _0xeb3b=['util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','reject','update','then','sendStatus','error','stack','index','map','ZendeskField','fieldName','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x46b043,_0x1fd514){var _0x2bcc2a=function(_0x102be3){while(--_0x102be3){_0x46b043['push'](_0x46b043['shift']());}};_0x2bcc2a(++_0x1fd514);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0xeb3b[_0x442f02];return _0xab6ef1;};'use strict';var pdf=require(_0xbeb3('0x0'));var emlformat=require(_0xbeb3('0x1'));var rimraf=require(_0xbeb3('0x2'));var zipdir=require(_0xbeb3('0x3'));var jsonpatch=require(_0xbeb3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeb3('0x5'));var Mustache=require('mustache');var util=require(_0xbeb3('0x6'));var path=require('path');var sox=require(_0xbeb3('0x7'));var csv=require(_0xbeb3('0x8'));var ejs=require(_0xbeb3('0x9'));var fs=require('fs');var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x8'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=_0x535836['count'],_0x5970a1=_0x26daf2['offset'],_0x80ef55=_0x26daf2[_0xbeb3('0x1c')]+_0x26daf2[_0xbeb3('0x1d')],_0x4e7d99;if(_0x80ef55>=_0x1aeaee){_0x80ef55=_0x1aeaee;_0x4e7d99=0xc8;}else{_0x4e7d99=0xce;}_0x43d58a[_0xbeb3('0x19')](_0x4e7d99);return _0x43d58a[_0xbeb3('0x1e')]('Content-Range',_0x5970a1+'-'+_0x80ef55+'/'+_0x1aeaee)[_0xbeb3('0x1b')](_0x535836);}return null;};}function patchUpdates(_0x821d92){return function(_0xe2cc47){try{jsonpatch['apply'](_0xe2cc47,_0x821d92,!![]);}catch(_0x4af96f){return BPromise[_0xbeb3('0x1f')](_0x4af96f);}return _0xe2cc47['save']();};}function saveUpdates(_0x1d917b,_0x50b005){return function(_0x5ea6f7){if(_0x5ea6f7){return _0x5ea6f7[_0xbeb3('0x20')](_0x1d917b)[_0xbeb3('0x21')](function(_0x2f3088){return _0x2f3088;});}return null;};}function removeEntity(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['destroy']()[_0xbeb3('0x21')](function(){_0x4bd89e[_0xbeb3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc384a,_0x278fe4){return function(_0x16b079){if(!_0x16b079){_0xfc384a[_0xbeb3('0x22')](0x194);}return _0x16b079;};}function handleError(_0x2bc188,_0xee71d7){_0xee71d7=_0xee71d7||0x1f4;return function(_0x84921a){logger[_0xbeb3('0x23')](_0x84921a[_0xbeb3('0x24')]);if(_0x84921a['name']){delete _0x84921a['name'];}_0x2bc188[_0xbeb3('0x19')](_0xee71d7)['send'](_0x84921a);};}exports[_0xbeb3('0x25')]=function(_0xda808c,_0x138adf){var _0x400f65={},_0x4fa3c7={},_0x2fe7ec={'count':0x0,'rows':[]};var _0x5bc3e1=_[_0xbeb3('0x26')](db[_0xbeb3('0x27')]['rawAttributes'],function(_0x483198){return{'name':_0x483198[_0xbeb3('0x28')],'type':_0x483198['type']['key']};});_0x4fa3c7['model']=_['map'](_0x5bc3e1,_0xbeb3('0x29'));_0x4fa3c7['query']=_[_0xbeb3('0x2a')](_0xda808c[_0xbeb3('0x2b')]);_0x4fa3c7[_0xbeb3('0x2c')]=_[_0xbeb3('0x2d')](_0x4fa3c7[_0xbeb3('0x2e')],_0x4fa3c7[_0xbeb3('0x2b')]);_0x400f65[_0xbeb3('0x2f')]=_[_0xbeb3('0x2d')](_0x4fa3c7[_0xbeb3('0x2e')],qs[_0xbeb3('0x30')](_0xda808c['query'][_0xbeb3('0x30')]));_0x400f65[_0xbeb3('0x2f')]=_0x400f65['attributes'][_0xbeb3('0x31')]?_0x400f65[_0xbeb3('0x2f')]:_0x4fa3c7[_0xbeb3('0x2e')];if(!_0xda808c[_0xbeb3('0x2b')]['hasOwnProperty'](_0xbeb3('0x32'))){_0x400f65[_0xbeb3('0x1d')]=qs[_0xbeb3('0x1d')](_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x1d')]);_0x400f65[_0xbeb3('0x1c')]=qs[_0xbeb3('0x1c')](_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x1c')]);}_0x400f65['order']=qs[_0xbeb3('0x33')](_0xda808c['query'][_0xbeb3('0x33')]);_0x400f65[_0xbeb3('0x34')]=qs[_0xbeb3('0x2c')](_[_0xbeb3('0x35')](_0xda808c[_0xbeb3('0x2b')],_0x4fa3c7[_0xbeb3('0x2c')]),_0x5bc3e1);if(_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x36')]){_0x400f65['where']=_[_0xbeb3('0x37')](_0x400f65['where'],{'$or':_['map'](_0x5bc3e1,function(_0x547275){if(_0x547275[_0xbeb3('0x38')]!==_0xbeb3('0x39')){var _0x397b68={};_0x397b68[_0x547275[_0xbeb3('0x29')]]={'$like':'%'+_0xda808c[_0xbeb3('0x2b')][_0xbeb3('0x36')]+'%'};return _0x397b68;}})});}_0x400f65=_['merge']({},_0x400f65,_0xda808c[_0xbeb3('0x3a')]);var _0x40de8d={'where':_0x400f65[_0xbeb3('0x34')]};return db['ZendeskField']['count'](_0x40de8d)['then'](function(_0x46f570){_0x2fe7ec[_0xbeb3('0x3b')]=_0x46f570;if(_0xda808c[_0xbeb3('0x2b')]['includeAll']){_0x400f65[_0xbeb3('0x3c')]=[{'all':!![]}];}return db['ZendeskField'][_0xbeb3('0x3d')](_0x400f65);})[_0xbeb3('0x21')](function(_0x12156b){_0x2fe7ec[_0xbeb3('0x3e')]=_0x12156b;return _0x2fe7ec;})['then'](respondWithFilteredResult(_0x138adf,_0x400f65))['catch'](handleError(_0x138adf,null));};exports[_0xbeb3('0x3f')]=function(_0x3684f1,_0x3d4262){var _0x2443a0={'raw':!![],'where':{'id':_0x3684f1[_0xbeb3('0x40')]['id']}},_0x1add7c={};_0x1add7c[_0xbeb3('0x2e')]=_[_0xbeb3('0x2a')](db['ZendeskField'][_0xbeb3('0x41')]);_0x1add7c[_0xbeb3('0x2b')]=_[_0xbeb3('0x2a')](_0x3684f1[_0xbeb3('0x2b')]);_0x1add7c[_0xbeb3('0x2c')]=_[_0xbeb3('0x2d')](_0x1add7c[_0xbeb3('0x2e')],_0x1add7c['query']);_0x2443a0[_0xbeb3('0x2f')]=_[_0xbeb3('0x2d')](_0x1add7c[_0xbeb3('0x2e')],qs[_0xbeb3('0x30')](_0x3684f1[_0xbeb3('0x2b')][_0xbeb3('0x30')]));_0x2443a0[_0xbeb3('0x2f')]=_0x2443a0[_0xbeb3('0x2f')][_0xbeb3('0x31')]?_0x2443a0[_0xbeb3('0x2f')]:_0x1add7c[_0xbeb3('0x2e')];if(_0x3684f1[_0xbeb3('0x2b')][_0xbeb3('0x42')]){_0x2443a0['include']=[{'all':!![]}];}_0x2443a0=_[_0xbeb3('0x37')]({},_0x2443a0,_0x3684f1[_0xbeb3('0x3a')]);return db[_0xbeb3('0x27')]['find'](_0x2443a0)['then'](handleEntityNotFound(_0x3d4262,null))[_0xbeb3('0x21')](respondWithResult(_0x3d4262,null))[_0xbeb3('0x43')](handleError(_0x3d4262,null));};exports[_0xbeb3('0x44')]=function(_0xf0fcd6,_0x5294ac){return db[_0xbeb3('0x27')]['create'](_0xf0fcd6['body'],{})[_0xbeb3('0x21')](respondWithResult(_0x5294ac,0xc9))[_0xbeb3('0x43')](handleError(_0x5294ac,null));};exports[_0xbeb3('0x20')]=function(_0x8eaebd,_0x4c55f4){if(_0x8eaebd[_0xbeb3('0x45')]['id']){delete _0x8eaebd[_0xbeb3('0x45')]['id'];}return db[_0xbeb3('0x27')]['find']({'where':{'id':_0x8eaebd[_0xbeb3('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c55f4,null))['then'](saveUpdates(_0x8eaebd[_0xbeb3('0x45')],null))[_0xbeb3('0x21')](respondWithResult(_0x4c55f4,null))[_0xbeb3('0x43')](handleError(_0x4c55f4,null));};exports['destroy']=function(_0x23d63c,_0x312b28){return db[_0xbeb3('0x27')]['find']({'where':{'id':_0x23d63c[_0xbeb3('0x40')]['id']}})['then'](handleEntityNotFound(_0x312b28,null))[_0xbeb3('0x21')](removeEntity(_0x312b28,null))['catch'](handleError(_0x312b28,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 85cf109..44db48d 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 _0xe0c0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash'];(function(_0x50f637,_0x2879ab){var _0x5453e5=function(_0x36ae55){while(--_0x36ae55){_0x50f637['push'](_0x50f637['shift']());}};_0x5453e5(++_0x2879ab);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x4fb456,_0x67d084){_0x4fb456=_0x4fb456-0x0;var _0x452ec0=_0xe0c0[_0x4fb456];return _0x452ec0;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var logger=require(_0x0e0c('0x1'))(_0x0e0c('0x2'));var moment=require(_0x0e0c('0x3'));var BPromise=require(_0x0e0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e0c('0x5'));var rimraf=require(_0x0e0c('0x6'));var config=require(_0x0e0c('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x0e0c('0x8')]=function(_0x2856d7,_0x4a094c){return _0x2856d7[_0x0e0c('0x9')](_0x0e0c('0xa'),attributes,{'tableName':_0x0e0c('0xb'),'paranoid':![],'indexes':[{'name':_0x0e0c('0xc'),'fields':[_0x0e0c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb71=['define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x290a7d,_0x20b9b1){var _0x2f573c=function(_0x5beae2){while(--_0x5beae2){_0x290a7d['push'](_0x290a7d['shift']());}};_0x2f573c(++_0x20b9b1);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x42c11f,_0x100303){_0x42c11f=_0x42c11f-0x0;var _0x4b574f=_0xfb71[_0x42c11f];return _0x4b574f;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var logger=require(_0x1fb7('0x2'))(_0x1fb7('0x3'));var moment=require(_0x1fb7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb7('0x5'));var rimraf=require(_0x1fb7('0x6'));var config=require(_0x1fb7('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x1fb7('0x8')]=function(_0x29532a,_0x2babe0){return _0x29532a[_0x1fb7('0x9')](_0x1fb7('0xa'),attributes,{'tableName':_0x1fb7('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1fb7('0xc'),_0x1fb7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index ead6380..668f19a 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 _0xd68e=['code','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2a3587,_0x4177be){var _0x19fca2=function(_0x3b06f4){while(--_0x3b06f4){_0x2a3587['push'](_0x2a3587['shift']());}};_0x19fca2(++_0x4177be);}(_0xd68e,0x10c));var _0xed68=function(_0x3feab5,_0x1849cb){_0x3feab5=_0x3feab5-0x0;var _0x4fb9e9=_0xd68e[_0x3feab5];return _0x4fb9e9;};'use strict';var _=require(_0xed68('0x0'));var util=require(_0xed68('0x1'));var moment=require(_0xed68('0x2'));var BPromise=require(_0xed68('0x3'));var rs=require(_0xed68('0x4'));var fs=require('fs');var Redis=require(_0xed68('0x5'));var db=require(_0xed68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xed68('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xed68('0x8'));var client=jayson['client'][_0xed68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x140e50,_0x324509,_0x41776e){return new BPromise(function(_0x49518e,_0x4f14bb){return client[_0xed68('0xa')](_0x140e50,_0x41776e)[_0xed68('0xb')](function(_0x23e4f7){logger[_0xed68('0xc')](_0xed68('0xd'),_0x324509,'request\x20sent');logger[_0xed68('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x324509,_0xed68('0xf'),JSON[_0xed68('0x10')](_0x23e4f7));if(_0x23e4f7[_0xed68('0x11')]){if(_0x23e4f7['error'][_0xed68('0x12')]===0x1f4){logger[_0xed68('0x11')]('ZendeskField,\x20%s,\x20%s',_0x324509,_0x23e4f7[_0xed68('0x11')]['message']);return _0x4f14bb(_0x23e4f7[_0xed68('0x11')]['message']);}logger[_0xed68('0x11')](_0xed68('0xd'),_0x324509,_0x23e4f7[_0xed68('0x11')]['message']);return _0x49518e(_0x23e4f7[_0xed68('0x11')]['message']);}else{logger[_0xed68('0xc')](_0xed68('0xd'),_0x324509,_0xed68('0xf'));_0x49518e(_0x23e4f7[_0xed68('0x13')][_0xed68('0x14')]);}})[_0xed68('0x15')](function(_0x4de352){logger['error'](_0xed68('0xd'),_0x324509,_0x4de352);_0x4f14bb(_0x4de352);});});} \ No newline at end of file +var _0xb279=['jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb279,0x19a));var _0x9b27=function(_0x53a7d6,_0x502301){_0x53a7d6=_0x53a7d6-0x0;var _0x522645=_0xb279[_0x53a7d6];return _0x522645;};'use strict';var _=require(_0x9b27('0x0'));var util=require('util');var moment=require(_0x9b27('0x1'));var BPromise=require(_0x9b27('0x2'));var rs=require(_0x9b27('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b27('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b27('0x5'))(_0x9b27('0x6'));var config=require(_0x9b27('0x7'));var jayson=require(_0x9b27('0x8'));var client=jayson[_0x9b27('0x9')][_0x9b27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x190683,_0x5efbd2,_0xa78916){return new BPromise(function(_0x4bff11,_0x5a4884){return client['request'](_0x190683,_0xa78916)[_0x9b27('0xb')](function(_0x571bea){logger[_0x9b27('0xc')](_0x9b27('0xd'),_0x5efbd2,_0x9b27('0xe'));logger[_0x9b27('0xf')](_0x9b27('0x10'),_0x5efbd2,'request\x20sent',JSON[_0x9b27('0x11')](_0x571bea));if(_0x571bea[_0x9b27('0x12')]){if(_0x571bea[_0x9b27('0x12')]['code']===0x1f4){logger['error'](_0x9b27('0xd'),_0x5efbd2,_0x571bea[_0x9b27('0x12')][_0x9b27('0x13')]);return _0x5a4884(_0x571bea[_0x9b27('0x12')][_0x9b27('0x13')]);}logger[_0x9b27('0x12')](_0x9b27('0xd'),_0x5efbd2,_0x571bea[_0x9b27('0x12')][_0x9b27('0x13')]);return _0x4bff11(_0x571bea[_0x9b27('0x12')]['message']);}else{logger[_0x9b27('0xc')](_0x9b27('0xd'),_0x5efbd2,_0x9b27('0xe'));_0x4bff11(_0x571bea[_0x9b27('0x14')][_0x9b27('0x13')]);}})[_0x9b27('0x15')](function(_0x4c4bcc){logger[_0x9b27('0x12')](_0x9b27('0xd'),_0x5efbd2,_0x4c4bcc);_0x5a4884(_0x4c4bcc);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a7f07e8..c7b6501 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(_0x2e7915,_0x54543d){var _0x2f91c9=function(_0x3b8bd0){while(--_0x3b8bd0){_0x2e7915['push'](_0x2e7915['shift']());}};_0x2f91c9(++_0x54543d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x4d8274,_0x37b9c7){var _0x32d9fb=function(_0x3f5b24){while(--_0x3f5b24){_0x4d8274['push'](_0x4d8274['shift']());}};_0x32d9fb(++_0x37b9c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c887108..c4703a2 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 _0x8991=['STRING','exports'];(function(_0x24468c,_0x2f7b87){var _0x508565=function(_0x412e02){while(--_0x412e02){_0x24468c['push'](_0x24468c['shift']());}};_0x508565(++_0x2f7b87);}(_0x8991,0x155));var _0x1899=function(_0x3ff417,_0x1217d8){_0x3ff417=_0x3ff417-0x0;var _0x208cee=_0x8991[_0x3ff417];return _0x208cee;};'use strict';var Sequelize=require('sequelize');module[_0x1899('0x0')]={'name':{'type':Sequelize[_0x1899('0x1')]},'description':{'type':Sequelize[_0x1899('0x1')]},'host':{'type':Sequelize[_0x1899('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1899('0x1')]},'clientSecret':{'type':Sequelize[_0x1899('0x1')]},'serverUrl':{'type':Sequelize[_0x1899('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1899('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfdf4=['STRING','sequelize','exports'];(function(_0x49e4a3,_0x23f937){var _0x13dd22=function(_0x580c32){while(--_0x580c32){_0x49e4a3['push'](_0x49e4a3['shift']());}};_0x13dd22(++_0x23f937);}(_0xfdf4,0x1c6));var _0x4fdf=function(_0x47e470,_0x161293){_0x47e470=_0x47e470-0x0;var _0x2f9d8d=_0xfdf4[_0x47e470];return _0x2f9d8d;};'use strict';var Sequelize=require(_0x4fdf('0x0'));module[_0x4fdf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fdf('0x2')]},'host':{'type':Sequelize[_0x4fdf('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4fdf('0x2')]},'clientSecret':{'type':Sequelize[_0x4fdf('0x2')]},'serverUrl':{'type':Sequelize[_0x4fdf('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x4fdf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d86b028..a724a68 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 _0x5c96=['https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','length','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','fields','create','body','find','params','getConfigurations','ZohoConfiguration','findOne','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x5c96,0x133));var _0x65c9=function(_0x54f445,_0x1a57fd){_0x54f445=_0x54f445-0x0;var _0x365fd3=_0x5c96[_0x54f445];return _0x365fd3;};'use strict';var pdf=require(_0x65c9('0x0'));var emlformat=require(_0x65c9('0x1'));var rimraf=require(_0x65c9('0x2'));var zipdir=require(_0x65c9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65c9('0x4'));var moment=require(_0x65c9('0x5'));var BPromise=require(_0x65c9('0x6'));var Mustache=require(_0x65c9('0x7'));var util=require(_0x65c9('0x8'));var path=require(_0x65c9('0x9'));var sox=require(_0x65c9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x65c9('0xb'));var jsforce=require(_0x65c9('0xc'));var deskjs=require(_0x65c9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65c9('0xe'));var Papa=require(_0x65c9('0xf'));var Redis=require(_0x65c9('0x10'));var authService=require(_0x65c9('0x11'));var qs=require(_0x65c9('0x12'));var as=require(_0x65c9('0x13'));var hardwareService=require(_0x65c9('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x65c9('0x15'));var licenseUtil=require(_0x65c9('0x16'));var db=require(_0x65c9('0x17'))['db'];var integrations=require(_0x65c9('0x18'));var jayson=require(_0x65c9('0x19'));var client=jayson['client'][_0x65c9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x561e56,_0x436a6c,_0x13d1bb,_0x4c965d){return new BPromise(function(_0x171883,_0x1f689e){var _0x379f5f=_0x4c965d||client;return _0x379f5f[_0x65c9('0x1b')](_0x561e56,_0x13d1bb)[_0x65c9('0x1c')](function(_0x795652){logger[_0x65c9('0x1d')](_0x65c9('0x1e'),_0x436a6c,_0x65c9('0x1f'));logger[_0x65c9('0x20')](_0x65c9('0x21'),_0x436a6c,_0x65c9('0x1f'),JSON['stringify'](_0x795652));if(_0x795652['error']){if(_0x795652[_0x65c9('0x22')][_0x65c9('0x23')]===0x1f4){logger[_0x65c9('0x22')](_0x65c9('0x1e'),_0x436a6c,_0x795652[_0x65c9('0x22')][_0x65c9('0x24')]);return _0x1f689e(_0x795652[_0x65c9('0x22')]['message']);}logger[_0x65c9('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x436a6c,_0x795652['error']['message']);return _0x171883(_0x795652['error'][_0x65c9('0x24')]);}else{logger[_0x65c9('0x1d')](_0x65c9('0x1e'),_0x436a6c,_0x65c9('0x1f'));_0x171883(_0x795652[_0x65c9('0x25')][_0x65c9('0x24')]);}})[_0x65c9('0x26')](function(_0x171029){logger[_0x65c9('0x22')](_0x65c9('0x1e'),_0x436a6c,_0x171029);_0x1f689e(_0x171029);});});}function respondWithStatusCode(_0x240438,_0x5c9593){_0x5c9593=_0x5c9593||0xcc;return function(_0x19d224){if(_0x19d224){return _0x240438[_0x65c9('0x27')](_0x5c9593);}return _0x240438[_0x65c9('0x28')](_0x5c9593)[_0x65c9('0x29')]();};}function respondWithResult(_0x4692b4,_0x370e5b){_0x370e5b=_0x370e5b||0xc8;return function(_0x580445){if(_0x580445){return _0x4692b4['status'](_0x370e5b)[_0x65c9('0x2a')](_0x580445);}};}function respondWithFilteredResult(_0x453612,_0x5e4b8a){return function(_0x2860b3){if(_0x2860b3){var _0x368e13=_0x2860b3['count'],_0x4f48cf=_0x5e4b8a['offset'],_0x1db634=_0x5e4b8a[_0x65c9('0x2b')]+_0x5e4b8a['limit'],_0xfeac3a;if(_0x1db634>=_0x368e13){_0x1db634=_0x368e13;_0xfeac3a=0xc8;}else{_0xfeac3a=0xce;}_0x453612[_0x65c9('0x28')](_0xfeac3a);return _0x453612['set'](_0x65c9('0x2c'),_0x4f48cf+'-'+_0x1db634+'/'+_0x368e13)['json'](_0x2860b3);}return null;};}function patchUpdates(_0x1f4ae7){return function(_0xc02623){try{jsonpatch[_0x65c9('0x2d')](_0xc02623,_0x1f4ae7,!![]);}catch(_0x547e4d){return BPromise[_0x65c9('0x2e')](_0x547e4d);}return _0xc02623[_0x65c9('0x2f')]();};}function saveUpdates(_0x499fa6,_0xdcd766){return function(_0x5e61ca){if(_0x5e61ca){return _0x5e61ca[_0x65c9('0x30')](_0x499fa6)[_0x65c9('0x1c')](function(_0x242db6){return _0x242db6;});}return null;};}function removeEntity(_0x379a57,_0x5315f2){return function(_0x1dcd81){if(_0x1dcd81){return _0x1dcd81[_0x65c9('0x31')]()[_0x65c9('0x1c')](function(){_0x379a57['status'](0xcc)[_0x65c9('0x29')]();});}};}function handleEntityNotFound(_0x1da275,_0x47cb16){return function(_0x1f9a1c){if(!_0x1f9a1c){_0x1da275['sendStatus'](0x194);}return _0x1f9a1c;};}function handleError(_0x270e01,_0x21e510){_0x21e510=_0x21e510||0x1f4;return function(_0x1e5dd9){logger[_0x65c9('0x22')](_0x1e5dd9['stack']);if(_0x1e5dd9[_0x65c9('0x32')]){delete _0x1e5dd9[_0x65c9('0x32')];}_0x270e01['status'](_0x21e510)[_0x65c9('0x33')](_0x1e5dd9);};}exports[_0x65c9('0x34')]=function(_0x2f58e6,_0x2353cf){var _0xe8278d={},_0x3bc3bc={},_0x56fd0d={'count':0x0,'rows':[]};var _0x232ed1=_[_0x65c9('0x35')](db[_0x65c9('0x36')][_0x65c9('0x37')],function(_0x3f6df7){return{'name':_0x3f6df7[_0x65c9('0x38')],'type':_0x3f6df7[_0x65c9('0x39')][_0x65c9('0x3a')]};});_0x3bc3bc[_0x65c9('0x3b')]=_['map'](_0x232ed1,_0x65c9('0x32'));_0x3bc3bc['query']=_[_0x65c9('0x3c')](_0x2f58e6[_0x65c9('0x3d')]);_0x3bc3bc['filters']=_['intersection'](_0x3bc3bc[_0x65c9('0x3b')],_0x3bc3bc[_0x65c9('0x3d')]);_0xe8278d[_0x65c9('0x3e')]=_[_0x65c9('0x3f')](_0x3bc3bc[_0x65c9('0x3b')],qs['fields'](_0x2f58e6[_0x65c9('0x3d')]['fields']));_0xe8278d['attributes']=_0xe8278d[_0x65c9('0x3e')][_0x65c9('0x40')]?_0xe8278d['attributes']:_0x3bc3bc['model'];if(!_0x2f58e6[_0x65c9('0x3d')]['hasOwnProperty'](_0x65c9('0x41'))){_0xe8278d[_0x65c9('0x42')]=qs[_0x65c9('0x42')](_0x2f58e6[_0x65c9('0x3d')][_0x65c9('0x42')]);_0xe8278d[_0x65c9('0x2b')]=qs[_0x65c9('0x2b')](_0x2f58e6[_0x65c9('0x3d')]['offset']);}_0xe8278d[_0x65c9('0x43')]=qs[_0x65c9('0x44')](_0x2f58e6[_0x65c9('0x3d')]['sort']);_0xe8278d['where']=qs[_0x65c9('0x45')](_['pick'](_0x2f58e6[_0x65c9('0x3d')],_0x3bc3bc[_0x65c9('0x45')]),_0x232ed1);if(_0x2f58e6[_0x65c9('0x3d')]['filter']){_0xe8278d[_0x65c9('0x46')]=_[_0x65c9('0x47')](_0xe8278d[_0x65c9('0x46')],{'$or':_['map'](_0x232ed1,function(_0xfa16c4){if(_0xfa16c4[_0x65c9('0x39')]!==_0x65c9('0x48')){var _0x189464={};_0x189464[_0xfa16c4[_0x65c9('0x32')]]={'$like':'%'+_0x2f58e6['query'][_0x65c9('0x49')]+'%'};return _0x189464;}})});}_0xe8278d=_['merge']({},_0xe8278d,_0x2f58e6[_0x65c9('0x4a')]);var _0x498351={'where':_0xe8278d[_0x65c9('0x46')]};return db[_0x65c9('0x36')]['count'](_0x498351)[_0x65c9('0x1c')](function(_0x38795e){_0x56fd0d[_0x65c9('0x4b')]=_0x38795e;if(_0x2f58e6[_0x65c9('0x3d')][_0x65c9('0x4c')]){_0xe8278d[_0x65c9('0x4d')]=[{'all':!![]}];}return db['ZohoAccount'][_0x65c9('0x4e')](_0xe8278d);})[_0x65c9('0x1c')](function(_0x29d169){_0x56fd0d[_0x65c9('0x4f')]=_0x29d169;return _0x56fd0d;})[_0x65c9('0x1c')](respondWithFilteredResult(_0x2353cf,_0xe8278d))['catch'](handleError(_0x2353cf,null));};exports['show']=function(_0x3bb32e,_0x42f665){var _0x28b4d1={'raw':![],'where':{'id':_0x3bb32e['params']['id']}},_0x2aaa3c={};_0x2aaa3c[_0x65c9('0x3b')]=_[_0x65c9('0x3c')](db[_0x65c9('0x36')][_0x65c9('0x37')]);_0x2aaa3c[_0x65c9('0x3d')]=_[_0x65c9('0x3c')](_0x3bb32e[_0x65c9('0x3d')]);_0x2aaa3c[_0x65c9('0x45')]=_['intersection'](_0x2aaa3c[_0x65c9('0x3b')],_0x2aaa3c[_0x65c9('0x3d')]);_0x28b4d1[_0x65c9('0x3e')]=_[_0x65c9('0x3f')](_0x2aaa3c[_0x65c9('0x3b')],qs[_0x65c9('0x50')](_0x3bb32e[_0x65c9('0x3d')][_0x65c9('0x50')]));_0x28b4d1['attributes']=_0x28b4d1[_0x65c9('0x3e')][_0x65c9('0x40')]?_0x28b4d1[_0x65c9('0x3e')]:_0x2aaa3c['model'];if(_0x3bb32e['query'][_0x65c9('0x4c')]){_0x28b4d1[_0x65c9('0x4d')]=[{'all':!![]}];}_0x28b4d1=_[_0x65c9('0x47')]({},_0x28b4d1,_0x3bb32e[_0x65c9('0x4a')]);return db['ZohoAccount']['find'](_0x28b4d1)[_0x65c9('0x1c')](handleEntityNotFound(_0x42f665,null))[_0x65c9('0x1c')](respondWithResult(_0x42f665,null))[_0x65c9('0x26')](handleError(_0x42f665,null));};exports[_0x65c9('0x51')]=function(_0x27a1ef,_0x10be2d){return db[_0x65c9('0x36')][_0x65c9('0x51')](_0x27a1ef[_0x65c9('0x52')],{})[_0x65c9('0x1c')](respondWithResult(_0x10be2d,0xc9))[_0x65c9('0x26')](handleError(_0x10be2d,null));};exports[_0x65c9('0x30')]=function(_0x5b691d,_0xa6315d){if(_0x5b691d[_0x65c9('0x52')]['id']){delete _0x5b691d['body']['id'];}return db['ZohoAccount'][_0x65c9('0x53')]({'where':{'id':_0x5b691d[_0x65c9('0x54')]['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0xa6315d,null))['then'](saveUpdates(_0x5b691d[_0x65c9('0x52')],null))[_0x65c9('0x1c')](respondWithResult(_0xa6315d,null))[_0x65c9('0x26')](handleError(_0xa6315d,null));};exports['destroy']=function(_0x7b4fe7,_0x1342e8){return db['ZohoAccount'][_0x65c9('0x53')]({'where':{'id':_0x7b4fe7[_0x65c9('0x54')]['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0x1342e8,null))[_0x65c9('0x1c')](removeEntity(_0x1342e8,null))[_0x65c9('0x26')](handleError(_0x1342e8,null));};exports[_0x65c9('0x55')]=function(_0x1e4796,_0x53fe2b,_0x391e03){var _0x1ad01e={};var _0x3625ab={};var _0x1a6c82;var _0x5da8d4;return db[_0x65c9('0x36')]['findOne']({'where':{'id':_0x1e4796['params']['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0x53fe2b,null))[_0x65c9('0x1c')](function(_0x4ae956){if(_0x4ae956){_0x1a6c82=_0x4ae956;_0x3625ab[_0x65c9('0x3b')]=_[_0x65c9('0x3c')](db[_0x65c9('0x56')]['rawAttributes']);_0x3625ab[_0x65c9('0x3d')]=_[_0x65c9('0x3c')](_0x1e4796['query']);_0x3625ab[_0x65c9('0x45')]=_[_0x65c9('0x3f')](_0x3625ab['model'],_0x3625ab[_0x65c9('0x3d')]);_0x1ad01e[_0x65c9('0x3e')]=_[_0x65c9('0x3f')](_0x3625ab[_0x65c9('0x3b')],qs['fields'](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x50')]));_0x1ad01e[_0x65c9('0x3e')]=_0x1ad01e['attributes']['length']?_0x1ad01e[_0x65c9('0x3e')]:_0x3625ab[_0x65c9('0x3b')];_0x1ad01e[_0x65c9('0x43')]=qs[_0x65c9('0x44')](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x44')]);_0x1ad01e[_0x65c9('0x46')]=qs['filters'](_['pick'](_0x1e4796[_0x65c9('0x3d')],_0x3625ab[_0x65c9('0x45')]));if(_0x1e4796['query'][_0x65c9('0x49')]){_0x1ad01e[_0x65c9('0x46')]=_[_0x65c9('0x47')](_0x1ad01e['where'],{'$or':_[_0x65c9('0x35')](_0x1ad01e[_0x65c9('0x3e')],function(_0x40c589){var _0xa4af80={};_0xa4af80[_0x40c589]={'$like':'%'+_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x49')]+'%'};return _0xa4af80;})});}_0x1ad01e=_[_0x65c9('0x47')]({},_0x1ad01e,_0x1e4796[_0x65c9('0x4a')]);return _0x1a6c82[_0x65c9('0x55')](_0x1ad01e);}})['then'](function(_0x4897d5){if(_0x4897d5){_0x5da8d4=_0x4897d5[_0x65c9('0x40')];if(!_0x1e4796['query']['hasOwnProperty'](_0x65c9('0x41'))){_0x1ad01e[_0x65c9('0x42')]=qs[_0x65c9('0x42')](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x42')]);_0x1ad01e[_0x65c9('0x2b')]=qs[_0x65c9('0x2b')](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x2b')]);}return _0x1a6c82[_0x65c9('0x55')](_0x1ad01e);}})[_0x65c9('0x1c')](function(_0x58c915){if(_0x58c915){return _0x58c915?{'count':_0x5da8d4,'rows':_0x58c915}:null;}})[_0x65c9('0x1c')](respondWithResult(_0x53fe2b,null))[_0x65c9('0x26')](handleError(_0x53fe2b,null));};exports['addConfiguration']=function(_0x1514ef,_0x2086d0,_0xec2055){if(_0x1514ef[_0x65c9('0x52')]['id']){delete _0x1514ef[_0x65c9('0x52')]['id'];}return db[_0x65c9('0x36')][_0x65c9('0x57')]({'where':{'id':_0x1514ef['params']['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0x2086d0,null))[_0x65c9('0x1c')](function(_0x245c1c){if(_0x245c1c){_0x1514ef[_0x65c9('0x52')]['AccountId']=_0x245c1c['id'];_0x1514ef[_0x65c9('0x52')][_0x65c9('0x58')]=integrations['getSubjects'](_0x1514ef[_0x65c9('0x52')][_0x65c9('0x59')],_0x1514ef['body'][_0x65c9('0x39')]);_0x1514ef[_0x65c9('0x52')][_0x65c9('0x5a')]=integrations['getDescriptions'](_0x1514ef['body'][_0x65c9('0x59')],_0x1514ef[_0x65c9('0x52')][_0x65c9('0x39')]);return db['ZohoConfiguration'][_0x65c9('0x51')](_0x1514ef[_0x65c9('0x52')],{'include':[{'model':db[_0x65c9('0x5b')],'as':_0x65c9('0x58')},{'model':db[_0x65c9('0x5b')],'as':_0x65c9('0x5a')}]});}return null;})[_0x65c9('0x1c')](respondWithResult(_0x2086d0,null))['catch'](handleError(_0x2086d0,null));};function getAccessToken(_0x2d96b5){return new Promise(function(_0x52b50d,_0xb43947){var _0x541ac4;switch(_0x2d96b5[_0x65c9('0x5c')]){case'US':_0x541ac4=_0x65c9('0x5d');break;case'AU':_0x541ac4=_0x65c9('0x5e');break;case'EU':_0x541ac4=_0x65c9('0x5f');break;case'IN':_0x541ac4=_0x65c9('0x60');break;case'CN':_0x541ac4='https://accounts.zoho.com.cn';break;default:_0x541ac4=_0x65c9('0x5f');break;}var _0x75120f={'method':_0x65c9('0x61'),'uri':_0x541ac4+_0x65c9('0x62'),'qs':{'refresh_token':_0x2d96b5[_0x65c9('0x63')],'client_id':_0x2d96b5[_0x65c9('0x64')],'client_secret':_0x2d96b5[_0x65c9('0x65')],'grant_type':_0x65c9('0x66')},'json':!![]};return rp(_0x75120f)[_0x65c9('0x1c')](function(_0x9f895c){if(_0x9f895c[_0x65c9('0x67')]){_0x52b50d(_0x9f895c[_0x65c9('0x67')]);}else{_0xb43947('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x47de62){_0xb43947(_0x47de62);});});}exports[_0x65c9('0x68')]=function(_0x4ce63a,_0x1d062f,_0x13a765){var _0xa09fd1,_0x39a757,_0x28ba01,_0x1f3497,_0x5f4870;return db[_0x65c9('0x36')]['findOne']({'where':{'id':_0x4ce63a[_0x65c9('0x54')]['id']},'attributes':['id',_0x65c9('0x69'),_0x65c9('0x5c'),_0x65c9('0x64'),'clientSecret',_0x65c9('0x6a'),'code',_0x65c9('0x63')]})[_0x65c9('0x1c')](handleEntityNotFound(_0x1d062f,null))[_0x65c9('0x1c')](function(_0x479dfc){_0x5f4870=_0x479dfc;_0xa09fd1=_0x5f4870[_0x65c9('0x69')];_0x39a757=_0xa09fd1==='zoho.eu'?'eu':'com';_0x28ba01=_0x5f4870['serverUrl'];var _0xb69bf6=_0x28ba01[_0x65c9('0x6b')](-0x1);if(_0xb69bf6==='/'||_0xb69bf6==='\x5c'||_0xb69bf6===':'){_0x28ba01=_0x28ba01['substring'](0x0,_0x28ba01[_0x65c9('0x6c')](_0xb69bf6));}if(!_0x5f4870['refreshToken']){throw new Error(_0x65c9('0x6d'));}return getAccessToken(_0x5f4870);})[_0x65c9('0x1c')](function(_0x242e6b){if(_0x242e6b){return rp({'method':_0x65c9('0x6e'),'uri':util[_0x65c9('0x6f')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x39a757),'qs':{'module':_0x65c9('0x70')},'headers':{'Authorization':_0x65c9('0x71')+_0x242e6b},'json':!![]});}})[_0x65c9('0x1c')](function(_0x389989){if(_0x389989){if(_0x389989[_0x65c9('0x72')]&&_0x389989[_0x65c9('0x72')][_0x65c9('0x22')]){throw new Error(_0x389989[_0x65c9('0x72')]['error']['message']);}var _0x48bfcd=[];var _0x237f85=[];var _0x38dcc1=[_0x65c9('0x73'),_0x65c9('0x74'),_0x65c9('0x75'),_0x65c9('0x76'),_0x65c9('0x77'),'Call_Result','Call_Start_Time',_0x65c9('0x78')];_0x237f85=_[_0x65c9('0x79')](_0x389989[_0x65c9('0x50')],function(_0x5b8812){return _0x38dcc1[_0x65c9('0x7a')](_0x5b8812[_0x65c9('0x7b')]);});for(var _0x4a395b=0x0;_0x4a395b<_0x237f85[_0x65c9('0x40')];_0x4a395b++){if(_0x237f85[_0x4a395b]['system_mandatory']===![]){_0x48bfcd[_0x65c9('0x7c')]({'id':_0x237f85[_0x4a395b]['id'],'name':_0x237f85[_0x4a395b][_0x65c9('0x7d')],'custom':_0x237f85[_0x4a395b][_0x65c9('0x7e')],'options':_0x237f85[_0x4a395b][_0x65c9('0x7f')]==='picklist'&&_0x237f85[_0x4a395b][_0x65c9('0x80')][_0x65c9('0x40')]>-0x1?_[_0x65c9('0x35')](_0x237f85[_0x4a395b]['pick_list_values'],function(_0x1a44da){return{'name':_0x1a44da,'value':_0x1a44da};}):[]});}}return{'count':_0x48bfcd[_0x65c9('0x40')],'rows':_0x48bfcd};}else{return{'count':0x0,'rows':[]};}})[_0x65c9('0x1c')](respondWithResult(_0x1d062f,null))[_0x65c9('0x26')](function(_0xb438a8){var _0x2f5a2c=_0x4ce63a[_0x65c9('0x3d')][_0x65c9('0x81')]?0x1f4:_0xb438a8['statusCode']||0x1f4;logger[_0x65c9('0x22')](_0x65c9('0x82'),_0x65c9('0x68'),_0x2f5a2c,JSON[_0x65c9('0x83')](_0xb438a8));delete _0xb438a8[_0x65c9('0x32')];if(_0x2f5a2c===0x191){_0x2f5a2c=0x190;}_0x1d062f[_0x65c9('0x28')](_0x2f5a2c)[_0x65c9('0x33')](_0x4ce63a[_0x65c9('0x3d')]['test']?{'message':_0x65c9('0x84'),'statusCode':_0xb438a8[_0x65c9('0x85')]}:_0xb438a8);});}; \ No newline at end of file +var _0x7880=['ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','status','end','name','index','map','rawAttributes','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','ZohoAccount','includeAll','include','findAll','rows','params','keys','find','create','body','getConfigurations','findOne','ZohoConfiguration','length','AccountId','Subjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x7880,0x1f4));var _0x0788=function(_0x54d5c8,_0x344ce5){_0x54d5c8=_0x54d5c8-0x0;var _0x525e2e=_0x7880[_0x54d5c8];return _0x525e2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];var integrations=require(_0x0788('0x1a'));var jayson=require(_0x0788('0x1b'));var client=jayson[_0x0788('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcaa0e9,_0x7e3407,_0x3bdcdf,_0x13cf07){return new BPromise(function(_0x51e5d3,_0x43ca01){var _0x4ed024=_0x13cf07||client;return _0x4ed024[_0x0788('0x1d')](_0xcaa0e9,_0x3bdcdf)[_0x0788('0x1e')](function(_0x3fd1e4){logger[_0x0788('0x1f')](_0x0788('0x20'),_0x7e3407,_0x0788('0x21'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x7e3407,_0x0788('0x21'),JSON[_0x0788('0x22')](_0x3fd1e4));if(_0x3fd1e4['error']){if(_0x3fd1e4[_0x0788('0x23')][_0x0788('0x24')]===0x1f4){logger[_0x0788('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x7e3407,_0x3fd1e4[_0x0788('0x23')][_0x0788('0x25')]);return _0x43ca01(_0x3fd1e4['error'][_0x0788('0x25')]);}logger['error'](_0x0788('0x20'),_0x7e3407,_0x3fd1e4['error'][_0x0788('0x25')]);return _0x51e5d3(_0x3fd1e4[_0x0788('0x23')][_0x0788('0x25')]);}else{logger[_0x0788('0x1f')](_0x0788('0x20'),_0x7e3407,'request\x20sent');_0x51e5d3(_0x3fd1e4['result'][_0x0788('0x25')]);}})[_0x0788('0x26')](function(_0x645320){logger[_0x0788('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x7e3407,_0x645320);_0x43ca01(_0x645320);});});}function respondWithStatusCode(_0x4d5c93,_0x79204e){_0x79204e=_0x79204e||0xcc;return function(_0x18cc33){if(_0x18cc33){return _0x4d5c93[_0x0788('0x27')](_0x79204e);}return _0x4d5c93['status'](_0x79204e)['end']();};}function respondWithResult(_0x240459,_0xa1f7dc){_0xa1f7dc=_0xa1f7dc||0xc8;return function(_0x5f2dda){if(_0x5f2dda){return _0x240459['status'](_0xa1f7dc)[_0x0788('0x28')](_0x5f2dda);}};}function respondWithFilteredResult(_0x44798c,_0x57fda1){return function(_0x286730){if(_0x286730){var _0x40e7a6=_0x286730[_0x0788('0x29')],_0x467d52=_0x57fda1[_0x0788('0x2a')],_0x18fc0e=_0x57fda1[_0x0788('0x2a')]+_0x57fda1['limit'],_0xf9ba32;if(_0x18fc0e>=_0x40e7a6){_0x18fc0e=_0x40e7a6;_0xf9ba32=0xc8;}else{_0xf9ba32=0xce;}_0x44798c['status'](_0xf9ba32);return _0x44798c[_0x0788('0x2b')](_0x0788('0x2c'),_0x467d52+'-'+_0x18fc0e+'/'+_0x40e7a6)['json'](_0x286730);}return null;};}function patchUpdates(_0x4aa48b){return function(_0x2e2ca8){try{jsonpatch[_0x0788('0x2d')](_0x2e2ca8,_0x4aa48b,!![]);}catch(_0x20fcd8){return BPromise[_0x0788('0x2e')](_0x20fcd8);}return _0x2e2ca8[_0x0788('0x2f')]();};}function saveUpdates(_0x44bff2,_0x327d67){return function(_0x36e077){if(_0x36e077){return _0x36e077[_0x0788('0x30')](_0x44bff2)[_0x0788('0x1e')](function(_0x5ec0ed){return _0x5ec0ed;});}return null;};}function removeEntity(_0x2a08b7,_0x1aab6a){return function(_0x2db509){if(_0x2db509){return _0x2db509[_0x0788('0x31')]()[_0x0788('0x1e')](function(){_0x2a08b7[_0x0788('0x32')](0xcc)[_0x0788('0x33')]();});}};}function handleEntityNotFound(_0x15d67a,_0x1cb6c0){return function(_0xaed27e){if(!_0xaed27e){_0x15d67a['sendStatus'](0x194);}return _0xaed27e;};}function handleError(_0x4ae132,_0x5947d3){_0x5947d3=_0x5947d3||0x1f4;return function(_0x5633da){logger['error'](_0x5633da['stack']);if(_0x5633da[_0x0788('0x34')]){delete _0x5633da[_0x0788('0x34')];}_0x4ae132[_0x0788('0x32')](_0x5947d3)['send'](_0x5633da);};}exports[_0x0788('0x35')]=function(_0x3369a1,_0x112476){var _0xaea11d={},_0x57c4d8={},_0x2ed940={'count':0x0,'rows':[]};var _0x4a4a2b=_[_0x0788('0x36')](db['ZohoAccount'][_0x0788('0x37')],function(_0x1beb1f){return{'name':_0x1beb1f['fieldName'],'type':_0x1beb1f[_0x0788('0x38')][_0x0788('0x39')]};});_0x57c4d8['model']=_[_0x0788('0x36')](_0x4a4a2b,'name');_0x57c4d8[_0x0788('0x3a')]=_['keys'](_0x3369a1[_0x0788('0x3a')]);_0x57c4d8['filters']=_[_0x0788('0x3b')](_0x57c4d8['model'],_0x57c4d8['query']);_0xaea11d[_0x0788('0x3c')]=_[_0x0788('0x3b')](_0x57c4d8[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x3369a1[_0x0788('0x3a')]['fields']));_0xaea11d['attributes']=_0xaea11d['attributes']['length']?_0xaea11d[_0x0788('0x3c')]:_0x57c4d8[_0x0788('0x3d')];if(!_0x3369a1[_0x0788('0x3a')][_0x0788('0x3f')](_0x0788('0x40'))){_0xaea11d['limit']=qs['limit'](_0x3369a1[_0x0788('0x3a')][_0x0788('0x41')]);_0xaea11d[_0x0788('0x2a')]=qs[_0x0788('0x2a')](_0x3369a1[_0x0788('0x3a')][_0x0788('0x2a')]);}_0xaea11d[_0x0788('0x42')]=qs[_0x0788('0x43')](_0x3369a1[_0x0788('0x3a')]['sort']);_0xaea11d['where']=qs[_0x0788('0x44')](_[_0x0788('0x45')](_0x3369a1[_0x0788('0x3a')],_0x57c4d8['filters']),_0x4a4a2b);if(_0x3369a1['query']['filter']){_0xaea11d[_0x0788('0x46')]=_[_0x0788('0x47')](_0xaea11d[_0x0788('0x46')],{'$or':_[_0x0788('0x36')](_0x4a4a2b,function(_0x2737d8){if(_0x2737d8[_0x0788('0x38')]!==_0x0788('0x48')){var _0x15b90c={};_0x15b90c[_0x2737d8['name']]={'$like':'%'+_0x3369a1[_0x0788('0x3a')][_0x0788('0x49')]+'%'};return _0x15b90c;}})});}_0xaea11d=_[_0x0788('0x47')]({},_0xaea11d,_0x3369a1[_0x0788('0x4a')]);var _0x58eb04={'where':_0xaea11d[_0x0788('0x46')]};return db[_0x0788('0x4b')]['count'](_0x58eb04)['then'](function(_0x524b43){_0x2ed940[_0x0788('0x29')]=_0x524b43;if(_0x3369a1['query'][_0x0788('0x4c')]){_0xaea11d[_0x0788('0x4d')]=[{'all':!![]}];}return db[_0x0788('0x4b')][_0x0788('0x4e')](_0xaea11d);})[_0x0788('0x1e')](function(_0x359dd6){_0x2ed940[_0x0788('0x4f')]=_0x359dd6;return _0x2ed940;})[_0x0788('0x1e')](respondWithFilteredResult(_0x112476,_0xaea11d))['catch'](handleError(_0x112476,null));};exports['show']=function(_0x39c3cc,_0xe7dfdc){var _0x2f232c={'raw':![],'where':{'id':_0x39c3cc[_0x0788('0x50')]['id']}},_0x5af6dd={};_0x5af6dd[_0x0788('0x3d')]=_[_0x0788('0x51')](db[_0x0788('0x4b')][_0x0788('0x37')]);_0x5af6dd['query']=_['keys'](_0x39c3cc[_0x0788('0x3a')]);_0x5af6dd[_0x0788('0x44')]=_['intersection'](_0x5af6dd[_0x0788('0x3d')],_0x5af6dd['query']);_0x2f232c[_0x0788('0x3c')]=_[_0x0788('0x3b')](_0x5af6dd[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x39c3cc[_0x0788('0x3a')][_0x0788('0x3e')]));_0x2f232c[_0x0788('0x3c')]=_0x2f232c[_0x0788('0x3c')]['length']?_0x2f232c[_0x0788('0x3c')]:_0x5af6dd[_0x0788('0x3d')];if(_0x39c3cc[_0x0788('0x3a')]['includeAll']){_0x2f232c[_0x0788('0x4d')]=[{'all':!![]}];}_0x2f232c=_[_0x0788('0x47')]({},_0x2f232c,_0x39c3cc['options']);return db[_0x0788('0x4b')][_0x0788('0x52')](_0x2f232c)[_0x0788('0x1e')](handleEntityNotFound(_0xe7dfdc,null))[_0x0788('0x1e')](respondWithResult(_0xe7dfdc,null))[_0x0788('0x26')](handleError(_0xe7dfdc,null));};exports[_0x0788('0x53')]=function(_0x4a465c,_0x4fcd30){return db[_0x0788('0x4b')][_0x0788('0x53')](_0x4a465c['body'],{})[_0x0788('0x1e')](respondWithResult(_0x4fcd30,0xc9))[_0x0788('0x26')](handleError(_0x4fcd30,null));};exports[_0x0788('0x30')]=function(_0x2b8f63,_0xf543a8){if(_0x2b8f63[_0x0788('0x54')]['id']){delete _0x2b8f63[_0x0788('0x54')]['id'];}return db[_0x0788('0x4b')][_0x0788('0x52')]({'where':{'id':_0x2b8f63[_0x0788('0x50')]['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0xf543a8,null))[_0x0788('0x1e')](saveUpdates(_0x2b8f63['body'],null))[_0x0788('0x1e')](respondWithResult(_0xf543a8,null))[_0x0788('0x26')](handleError(_0xf543a8,null));};exports[_0x0788('0x31')]=function(_0x5ba197,_0x9a13b){return db[_0x0788('0x4b')]['find']({'where':{'id':_0x5ba197['params']['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0x9a13b,null))[_0x0788('0x1e')](removeEntity(_0x9a13b,null))[_0x0788('0x26')](handleError(_0x9a13b,null));};exports[_0x0788('0x55')]=function(_0x2c0bcc,_0x4c08f9,_0x535648){var _0x336d30={};var _0x3be076={};var _0x30a0e0;var _0x47be71;return db['ZohoAccount'][_0x0788('0x56')]({'where':{'id':_0x2c0bcc['params']['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0x4c08f9,null))[_0x0788('0x1e')](function(_0x223767){if(_0x223767){_0x30a0e0=_0x223767;_0x3be076[_0x0788('0x3d')]=_[_0x0788('0x51')](db[_0x0788('0x57')][_0x0788('0x37')]);_0x3be076[_0x0788('0x3a')]=_[_0x0788('0x51')](_0x2c0bcc[_0x0788('0x3a')]);_0x3be076['filters']=_[_0x0788('0x3b')](_0x3be076[_0x0788('0x3d')],_0x3be076[_0x0788('0x3a')]);_0x336d30[_0x0788('0x3c')]=_['intersection'](_0x3be076[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x3e')]));_0x336d30[_0x0788('0x3c')]=_0x336d30['attributes'][_0x0788('0x58')]?_0x336d30['attributes']:_0x3be076[_0x0788('0x3d')];_0x336d30[_0x0788('0x42')]=qs[_0x0788('0x43')](_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x43')]);_0x336d30[_0x0788('0x46')]=qs[_0x0788('0x44')](_[_0x0788('0x45')](_0x2c0bcc[_0x0788('0x3a')],_0x3be076['filters']));if(_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x49')]){_0x336d30[_0x0788('0x46')]=_['merge'](_0x336d30['where'],{'$or':_[_0x0788('0x36')](_0x336d30[_0x0788('0x3c')],function(_0x31ed44){var _0x51baa4={};_0x51baa4[_0x31ed44]={'$like':'%'+_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x49')]+'%'};return _0x51baa4;})});}_0x336d30=_[_0x0788('0x47')]({},_0x336d30,_0x2c0bcc[_0x0788('0x4a')]);return _0x30a0e0['getConfigurations'](_0x336d30);}})['then'](function(_0x4fc29b){if(_0x4fc29b){_0x47be71=_0x4fc29b[_0x0788('0x58')];if(!_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x3f')]('nolimit')){_0x336d30['limit']=qs[_0x0788('0x41')](_0x2c0bcc['query'][_0x0788('0x41')]);_0x336d30[_0x0788('0x2a')]=qs[_0x0788('0x2a')](_0x2c0bcc[_0x0788('0x3a')][_0x0788('0x2a')]);}return _0x30a0e0[_0x0788('0x55')](_0x336d30);}})[_0x0788('0x1e')](function(_0x47543a){if(_0x47543a){return _0x47543a?{'count':_0x47be71,'rows':_0x47543a}:null;}})[_0x0788('0x1e')](respondWithResult(_0x4c08f9,null))[_0x0788('0x26')](handleError(_0x4c08f9,null));};exports['addConfiguration']=function(_0x240210,_0x30248c,_0x52926f){if(_0x240210['body']['id']){delete _0x240210[_0x0788('0x54')]['id'];}return db[_0x0788('0x4b')][_0x0788('0x56')]({'where':{'id':_0x240210[_0x0788('0x50')]['id']}})[_0x0788('0x1e')](handleEntityNotFound(_0x30248c,null))[_0x0788('0x1e')](function(_0x489277){if(_0x489277){_0x240210[_0x0788('0x54')][_0x0788('0x59')]=_0x489277['id'];_0x240210[_0x0788('0x54')][_0x0788('0x5a')]=integrations['getSubjects'](_0x240210[_0x0788('0x54')][_0x0788('0x5b')],_0x240210[_0x0788('0x54')][_0x0788('0x38')]);_0x240210['body']['Descriptions']=integrations[_0x0788('0x5c')](_0x240210[_0x0788('0x54')][_0x0788('0x5b')],_0x240210[_0x0788('0x54')][_0x0788('0x38')]);return db[_0x0788('0x57')][_0x0788('0x53')](_0x240210[_0x0788('0x54')],{'include':[{'model':db[_0x0788('0x5d')],'as':'Subjects'},{'model':db[_0x0788('0x5d')],'as':_0x0788('0x5e')}]});}return null;})[_0x0788('0x1e')](respondWithResult(_0x30248c,null))['catch'](handleError(_0x30248c,null));};function getAccessToken(_0x534a21){return new Promise(function(_0x14fc12,_0x5cd77b){var _0x39f4fe;switch(_0x534a21[_0x0788('0x5f')]){case'US':_0x39f4fe=_0x0788('0x60');break;case'AU':_0x39f4fe=_0x0788('0x61');break;case'EU':_0x39f4fe=_0x0788('0x62');break;case'IN':_0x39f4fe=_0x0788('0x63');break;case'CN':_0x39f4fe=_0x0788('0x64');break;default:_0x39f4fe=_0x0788('0x62');break;}var _0x188eeb={'method':'POST','uri':_0x39f4fe+_0x0788('0x65'),'qs':{'refresh_token':_0x534a21[_0x0788('0x66')],'client_id':_0x534a21[_0x0788('0x67')],'client_secret':_0x534a21['clientSecret'],'grant_type':_0x0788('0x68')},'json':!![]};return rp(_0x188eeb)[_0x0788('0x1e')](function(_0x2f8788){if(_0x2f8788['access_token']){_0x14fc12(_0x2f8788[_0x0788('0x69')]);}else{_0x5cd77b(_0x0788('0x6a'));}})[_0x0788('0x26')](function(_0x33a2fb){_0x5cd77b(_0x33a2fb);});});}exports[_0x0788('0x6b')]=function(_0x1e1963,_0x358754,_0x69e7cc){var _0x25058b,_0x5d8ddb,_0x471b3a,_0x623d29,_0x32b9a8;return db[_0x0788('0x4b')][_0x0788('0x56')]({'where':{'id':_0x1e1963['params']['id']},'attributes':['id',_0x0788('0x6c'),_0x0788('0x5f'),_0x0788('0x67'),'clientSecret',_0x0788('0x6d'),_0x0788('0x24'),_0x0788('0x66')]})[_0x0788('0x1e')](handleEntityNotFound(_0x358754,null))[_0x0788('0x1e')](function(_0x48afda){_0x32b9a8=_0x48afda;_0x25058b=_0x32b9a8[_0x0788('0x6c')];_0x5d8ddb=_0x25058b===_0x0788('0x6e')?'eu':'com';_0x471b3a=_0x32b9a8[_0x0788('0x6d')];var _0x1c8f74=_0x471b3a['slice'](-0x1);if(_0x1c8f74==='/'||_0x1c8f74==='\x5c'||_0x1c8f74===':'){_0x471b3a=_0x471b3a[_0x0788('0x6f')](0x0,_0x471b3a[_0x0788('0x70')](_0x1c8f74));}if(!_0x32b9a8[_0x0788('0x66')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x32b9a8);})[_0x0788('0x1e')](function(_0x42c537){if(_0x42c537){return rp({'method':_0x0788('0x71'),'uri':util['format'](_0x0788('0x72'),_0x5d8ddb),'qs':{'module':_0x0788('0x73')},'headers':{'Authorization':_0x0788('0x74')+_0x42c537},'json':!![]});}})[_0x0788('0x1e')](function(_0x27c4d5){if(_0x27c4d5){if(_0x27c4d5[_0x0788('0x75')]&&_0x27c4d5[_0x0788('0x75')][_0x0788('0x23')]){throw new Error(_0x27c4d5['response'][_0x0788('0x23')][_0x0788('0x25')]);}var _0x121f1d=[];var _0x31c921=[];var _0x57674a=['Owner',_0x0788('0x76'),_0x0788('0x77'),'WhoId',_0x0788('0x78'),_0x0788('0x79'),_0x0788('0x7a'),'Call_Type'];_0x31c921=_['remove'](_0x27c4d5[_0x0788('0x3e')],function(_0x1927ed){return _0x57674a['includes'](_0x1927ed['api_name']);});for(var _0x4ace43=0x0;_0x4ace43<_0x31c921[_0x0788('0x58')];_0x4ace43++){if(_0x31c921[_0x4ace43][_0x0788('0x7b')]===![]){_0x121f1d['push']({'id':_0x31c921[_0x4ace43]['id'],'name':_0x31c921[_0x4ace43][_0x0788('0x7c')],'custom':_0x31c921[_0x4ace43][_0x0788('0x7d')],'options':_0x31c921[_0x4ace43][_0x0788('0x7e')]===_0x0788('0x7f')&&_0x31c921[_0x4ace43][_0x0788('0x80')]['length']>-0x1?_[_0x0788('0x36')](_0x31c921[_0x4ace43]['pick_list_values'],function(_0x2e1d76){return{'name':_0x2e1d76,'value':_0x2e1d76};}):[]});}}return{'count':_0x121f1d['length'],'rows':_0x121f1d};}else{return{'count':0x0,'rows':[]};}})[_0x0788('0x1e')](respondWithResult(_0x358754,null))[_0x0788('0x26')](function(_0xbf1276){var _0x41ef38=_0x1e1963[_0x0788('0x3a')][_0x0788('0x81')]?0x1f4:_0xbf1276[_0x0788('0x82')]||0x1f4;logger[_0x0788('0x23')](_0x0788('0x83'),_0x0788('0x6b'),_0x41ef38,JSON[_0x0788('0x22')](_0xbf1276));delete _0xbf1276[_0x0788('0x34')];if(_0x41ef38===0x191){_0x41ef38=0x190;}_0x358754[_0x0788('0x32')](_0x41ef38)['send'](_0x1e1963['query']['test']?{'message':_0x0788('0x84'),'statusCode':_0xbf1276[_0x0788('0x82')]}:_0xbf1276);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 60cc0aa..eac651d 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 _0x9bac=['code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','clientId','host','https://accounts.zoho.com.au','POST','refreshToken','info','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret'];(function(_0x5dc2eb,_0x105d4d){var _0x211d72=function(_0x1712f6){while(--_0x1712f6){_0x5dc2eb['push'](_0x5dc2eb['shift']());}};_0x211d72(++_0x105d4d);}(_0x9bac,0x100));var _0xc9ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9bac[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc9ba('0x0'));var util=require(_0xc9ba('0x1'));var logger=require(_0xc9ba('0x2'))(_0xc9ba('0x3'));var moment=require(_0xc9ba('0x4'));var BPromise=require(_0xc9ba('0x5'));var rp=require(_0xc9ba('0x6'));var fs=require('fs');var path=require(_0xc9ba('0x7'));var rimraf=require(_0xc9ba('0x8'));var config=require(_0xc9ba('0x9'));var attributes=require(_0xc9ba('0xa'));var integrations=require(_0xc9ba('0xb'));module[_0xc9ba('0xc')]=function(_0x5bfb51,_0xa7c461){return _0x5bfb51[_0xc9ba('0xd')](_0xc9ba('0xe'),attributes,{'tableName':_0xc9ba('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x16285c,_0x2fa67a,_0x367bcd){if(_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x11'))||_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x12'))||_0x16285c[_0xc9ba('0x10')]('clientId')||_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x13'))||_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x14'))||_0x16285c[_0xc9ba('0x10')]('host')){var _0x48fb16,_0x4de8d0;_0x48fb16=_0x16285c[_0xc9ba('0x12')];var _0x5740ec=_0x48fb16[_0xc9ba('0x15')](-0x1);if(_0x5740ec==='/'||_0x5740ec==='\x5c'||_0x5740ec===':'){_0x48fb16=_0x48fb16[_0xc9ba('0x16')](0x0,_0x48fb16[_0xc9ba('0x17')](_0x5740ec));}switch(_0x16285c[_0xc9ba('0x11')]){case'US':_0x4de8d0=_0xc9ba('0x18');break;case'AU':_0x4de8d0='https://accounts.zoho.com.au';break;case'IN':_0x4de8d0=_0xc9ba('0x19');break;case'CN':_0x4de8d0=_0xc9ba('0x1a');break;default:_0x4de8d0=_0xc9ba('0x1b');break;}var _0x2918c8={'method':'POST','uri':_0x4de8d0+_0xc9ba('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x16285c['clientId'],'client_secret':_0x16285c[_0xc9ba('0x13')],'redirect_uri':_0x16285c[_0xc9ba('0x12')],'code':_0x16285c[_0xc9ba('0x14')]},'headers':{'Content-Type':_0xc9ba('0x1d')}};return rp(_0x2918c8)[_0xc9ba('0x1e')](function(_0x124069){var _0x102b80=JSON[_0xc9ba('0x1f')](_0x124069);if(_0x102b80[_0xc9ba('0x20')]){_0x16285c['refreshToken']=_0x102b80[_0xc9ba('0x20')];logger['info'](util[_0xc9ba('0x21')](_0xc9ba('0x22'),_0x16285c[_0xc9ba('0x23')],_0x16285c['id']));}else{logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x16285c[_0xc9ba('0x23')],_0x16285c['id']),util[_0xc9ba('0x25')](_0x102b80,{'showHidden':![],'depth':null}));}return _0x367bcd(null,_0x2fa67a);})[_0xc9ba('0x26')](function(_0x45765e){logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')](_0xc9ba('0x27'),_0x16285c[_0xc9ba('0x23')],_0x16285c['id']),util[_0xc9ba('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x367bcd(_0x45765e);});}else{return _0x367bcd(null,_0x2fa67a);}},'beforeUpdate':function(_0x28824a,_0x52fccb,_0x386e9b){if(_0x28824a[_0xc9ba('0x10')]('zone')||_0x28824a[_0xc9ba('0x10')]('serverUrl')||_0x28824a[_0xc9ba('0x10')](_0xc9ba('0x28'))||_0x28824a[_0xc9ba('0x10')](_0xc9ba('0x13'))||_0x28824a[_0xc9ba('0x10')](_0xc9ba('0x14'))||_0x28824a['changed'](_0xc9ba('0x29'))){var _0x2e5329,_0x3e93d7;_0x2e5329=_0x28824a[_0xc9ba('0x12')];var _0x45ca53=_0x2e5329[_0xc9ba('0x15')](-0x1);if(_0x45ca53==='/'||_0x45ca53==='\x5c'||_0x45ca53===':'){_0x2e5329=_0x2e5329[_0xc9ba('0x16')](0x0,_0x2e5329['lastIndexOf'](_0x45ca53));}switch(_0x28824a['zone']){case'US':_0x3e93d7='https://accounts.zoho.com';break;case'AU':_0x3e93d7=_0xc9ba('0x2a');break;case'IN':_0x3e93d7=_0xc9ba('0x19');break;case'CN':_0x3e93d7=_0xc9ba('0x1a');break;default:_0x3e93d7=_0xc9ba('0x1b');break;}var _0x313a84={'method':_0xc9ba('0x2b'),'uri':_0x3e93d7+_0xc9ba('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x28824a[_0xc9ba('0x28')],'client_secret':_0x28824a['clientSecret'],'redirect_uri':_0x28824a[_0xc9ba('0x12')],'code':_0x28824a[_0xc9ba('0x14')]},'headers':{'Content-Type':_0xc9ba('0x1d')}};return rp(_0x313a84)[_0xc9ba('0x1e')](function(_0x568f9e){var _0x1db6f7=JSON[_0xc9ba('0x1f')](_0x568f9e);if(_0x1db6f7['refresh_token']){_0x28824a[_0xc9ba('0x2c')]=_0x1db6f7[_0xc9ba('0x20')];logger[_0xc9ba('0x2d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28824a['name'],_0x28824a['id']));}else{logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')](_0xc9ba('0x27'),_0x28824a[_0xc9ba('0x23')],_0x28824a['id']),util['inspect'](_0x1db6f7,{'showHidden':![],'depth':null}));}return _0x386e9b(null,_0x52fccb);})[_0xc9ba('0x26')](function(_0x5743f1){logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')](_0xc9ba('0x27'),_0x28824a[_0xc9ba('0x23')],_0x28824a['id']),util[_0xc9ba('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x386e9b(_0x5743f1);});}else{return _0x386e9b(null,_0x52fccb);}}}});}; \ No newline at end of file +var _0x7131=['parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','clientId','https://accounts.zoho.com','https://accounts.zoho.eu','info','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientSecret','application/x-www-form-urlencoded'];(function(_0x5c060d,_0x4195dc){var _0x217e6b=function(_0x54788f){while(--_0x54788f){_0x5c060d['push'](_0x5c060d['shift']());}};_0x217e6b(++_0x4195dc);}(_0x7131,0x12d));var _0x1713=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x7131[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x1713('0x0'));var util=require(_0x1713('0x1'));var logger=require(_0x1713('0x2'))('api');var moment=require(_0x1713('0x3'));var BPromise=require(_0x1713('0x4'));var rp=require(_0x1713('0x5'));var fs=require('fs');var path=require(_0x1713('0x6'));var rimraf=require('rimraf');var config=require(_0x1713('0x7'));var attributes=require(_0x1713('0x8'));var integrations=require(_0x1713('0x9'));module[_0x1713('0xa')]=function(_0xaa7b7c,_0x281dea){return _0xaa7b7c[_0x1713('0xb')](_0x1713('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e32a9,_0x673738,_0x4de281){if(_0x1e32a9[_0x1713('0xd')](_0x1713('0xe'))||_0x1e32a9[_0x1713('0xd')]('serverUrl')||_0x1e32a9[_0x1713('0xd')]('clientId')||_0x1e32a9[_0x1713('0xd')]('clientSecret')||_0x1e32a9[_0x1713('0xd')](_0x1713('0xf'))||_0x1e32a9[_0x1713('0xd')](_0x1713('0x10'))){var _0x5d9864,_0x135356;_0x5d9864=_0x1e32a9[_0x1713('0x11')];var _0x1d3ccc=_0x5d9864[_0x1713('0x12')](-0x1);if(_0x1d3ccc==='/'||_0x1d3ccc==='\x5c'||_0x1d3ccc===':'){_0x5d9864=_0x5d9864[_0x1713('0x13')](0x0,_0x5d9864[_0x1713('0x14')](_0x1d3ccc));}switch(_0x1e32a9['zone']){case'US':_0x135356='https://accounts.zoho.com';break;case'AU':_0x135356='https://accounts.zoho.com.au';break;case'IN':_0x135356=_0x1713('0x15');break;case'CN':_0x135356=_0x1713('0x16');break;default:_0x135356='https://accounts.zoho.eu';break;}var _0x486360={'method':_0x1713('0x17'),'uri':_0x135356+'/oauth/v2/token','form':{'grant_type':_0x1713('0x18'),'client_id':_0x1e32a9['clientId'],'client_secret':_0x1e32a9[_0x1713('0x19')],'redirect_uri':_0x1e32a9[_0x1713('0x11')],'code':_0x1e32a9[_0x1713('0xf')]},'headers':{'Content-Type':_0x1713('0x1a')}};return rp(_0x486360)['then'](function(_0xb197cd){var _0x4b0200=JSON[_0x1713('0x1b')](_0xb197cd);if(_0x4b0200[_0x1713('0x1c')]){_0x1e32a9[_0x1713('0x1d')]=_0x4b0200['refresh_token'];logger['info'](util[_0x1713('0x1e')](_0x1713('0x1f'),_0x1e32a9[_0x1713('0x20')],_0x1e32a9['id']));}else{logger[_0x1713('0x21')](util[_0x1713('0x1e')](_0x1713('0x22'),_0x1e32a9[_0x1713('0x20')],_0x1e32a9['id']),util[_0x1713('0x23')](_0x4b0200,{'showHidden':![],'depth':null}));}return _0x4de281(null,_0x673738);})[_0x1713('0x24')](function(_0x71795c){logger[_0x1713('0x21')](util[_0x1713('0x1e')](_0x1713('0x22'),_0x1e32a9[_0x1713('0x20')],_0x1e32a9['id']),util[_0x1713('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4de281(_0x71795c);});}else{return _0x4de281(null,_0x673738);}},'beforeUpdate':function(_0x12ac8a,_0x92cf4e,_0x320b52){if(_0x12ac8a[_0x1713('0xd')](_0x1713('0xe'))||_0x12ac8a[_0x1713('0xd')](_0x1713('0x11'))||_0x12ac8a[_0x1713('0xd')](_0x1713('0x25'))||_0x12ac8a['changed']('clientSecret')||_0x12ac8a[_0x1713('0xd')]('code')||_0x12ac8a[_0x1713('0xd')](_0x1713('0x10'))){var _0xc6c065,_0x417b37;_0xc6c065=_0x12ac8a[_0x1713('0x11')];var _0x353e11=_0xc6c065[_0x1713('0x12')](-0x1);if(_0x353e11==='/'||_0x353e11==='\x5c'||_0x353e11===':'){_0xc6c065=_0xc6c065[_0x1713('0x13')](0x0,_0xc6c065[_0x1713('0x14')](_0x353e11));}switch(_0x12ac8a['zone']){case'US':_0x417b37=_0x1713('0x26');break;case'AU':_0x417b37='https://accounts.zoho.com.au';break;case'IN':_0x417b37=_0x1713('0x15');break;case'CN':_0x417b37=_0x1713('0x16');break;default:_0x417b37=_0x1713('0x27');break;}var _0xd47ec3={'method':_0x1713('0x17'),'uri':_0x417b37+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x12ac8a[_0x1713('0x25')],'client_secret':_0x12ac8a[_0x1713('0x19')],'redirect_uri':_0x12ac8a['serverUrl'],'code':_0x12ac8a[_0x1713('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0xd47ec3)['then'](function(_0x1b52e1){var _0x569890=JSON['parse'](_0x1b52e1);if(_0x569890['refresh_token']){_0x12ac8a[_0x1713('0x1d')]=_0x569890[_0x1713('0x1c')];logger[_0x1713('0x28')](util[_0x1713('0x1e')](_0x1713('0x1f'),_0x12ac8a['name'],_0x12ac8a['id']));}else{logger[_0x1713('0x21')](util[_0x1713('0x1e')](_0x1713('0x22'),_0x12ac8a[_0x1713('0x20')],_0x12ac8a['id']),util['inspect'](_0x569890,{'showHidden':![],'depth':null}));}return _0x320b52(null,_0x92cf4e);})[_0x1713('0x24')](function(_0xe427f0){logger[_0x1713('0x21')](util[_0x1713('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x12ac8a[_0x1713('0x20')],_0x12ac8a['id']),util[_0x1713('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x320b52(_0xe427f0);});}else{return _0x320b52(null,_0x92cf4e);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e64dd20..685971a 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 _0x6d8c=['include','model','catch','ShowZohoAccount','where','stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','ZohoAccount,\x20%s,\x20%s','message','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','map'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x6d8c,0x146));var _0xc6d8=function(_0x59d15b,_0x2b7565){_0x59d15b=_0x59d15b-0x0;var _0x219c2d=_0x6d8c[_0x59d15b];return _0x219c2d;};'use strict';var _=require(_0xc6d8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc6d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6d8('0x2'));var db=require(_0xc6d8('0x3'))['db'];var utils=require(_0xc6d8('0x4'));var logger=require(_0xc6d8('0x5'))(_0xc6d8('0x6'));var config=require(_0xc6d8('0x7'));var jayson=require(_0xc6d8('0x8'));var client=jayson[_0xc6d8('0x9')][_0xc6d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x66aa7e,_0x311226,_0x3b5ee1){return new BPromise(function(_0x3a5308,_0x8f3ef){return client['request'](_0x66aa7e,_0x3b5ee1)[_0xc6d8('0xb')](function(_0x1ac944){logger[_0xc6d8('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x311226,_0xc6d8('0xd'));logger[_0xc6d8('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x311226,_0xc6d8('0xd'),JSON['stringify'](_0x1ac944));if(_0x1ac944[_0xc6d8('0xf')]){if(_0x1ac944[_0xc6d8('0xf')][_0xc6d8('0x10')]===0x1f4){logger[_0xc6d8('0xf')](_0xc6d8('0x11'),_0x311226,_0x1ac944['error'][_0xc6d8('0x12')]);return _0x8f3ef(_0x1ac944['error'][_0xc6d8('0x12')]);}logger['error'](_0xc6d8('0x11'),_0x311226,_0x1ac944[_0xc6d8('0xf')][_0xc6d8('0x12')]);return _0x3a5308(_0x1ac944[_0xc6d8('0xf')][_0xc6d8('0x12')]);}else{logger[_0xc6d8('0xc')](_0xc6d8('0x11'),_0x311226,_0xc6d8('0xd'));_0x3a5308(_0x1ac944['result'][_0xc6d8('0x12')]);}})['catch'](function(_0x50da97){logger[_0xc6d8('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x311226,_0x50da97);_0x8f3ef(_0x50da97);});});}exports[_0xc6d8('0x13')]=function(_0x5de1c3){var _0x3e31c4=this;return new Promise(function(_0xd590a7,_0x29e531){return db[_0xc6d8('0x14')]['findAll']({'raw':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x16')]===undefined?!![]:![]:!![],'where':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')]['where']||null:null,'attributes':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x17')]||null:null,'limit':_0x5de1c3['options']?_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x18')]||null:null,'include':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')]['include']?_[_0xc6d8('0x19')](_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x1a')],function(_0x334d3d){return{'model':db[_0x334d3d['model']],'as':_0x334d3d['as'],'attributes':_0x334d3d[_0xc6d8('0x17')],'include':_0x334d3d[_0xc6d8('0x1a')]?_[_0xc6d8('0x19')](_0x334d3d[_0xc6d8('0x1a')],function(_0xc568e9){return{'model':db[_0xc568e9[_0xc6d8('0x1b')]],'as':_0xc568e9['as'],'attributes':_0xc568e9['attributes'],'include':_0xc568e9[_0xc6d8('0x1a')]?_[_0xc6d8('0x19')](_0xc568e9[_0xc6d8('0x1a')],function(_0x4040d3){return{'model':db[_0x4040d3[_0xc6d8('0x1b')]],'as':_0x4040d3['as'],'attributes':_0x4040d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6d8('0xb')](function(_0x9a30c8){logger[_0xc6d8('0xc')](_0xc6d8('0x13'),_0x5de1c3);logger[_0xc6d8('0xe')](_0xc6d8('0x13'),_0x5de1c3,JSON['stringify'](_0x9a30c8));_0xd590a7(_0x9a30c8);})[_0xc6d8('0x1c')](function(_0x2ce8b0){logger['error'](_0xc6d8('0x13'),_0x2ce8b0[_0xc6d8('0x12')],_0x5de1c3);_0x29e531(_0x3e31c4['error'](0x1f4,_0x2ce8b0['message']));});});};exports[_0xc6d8('0x1d')]=function(_0x5bd560){var _0x1cec57=this;return new Promise(function(_0x271d0c,_0x5d4c25){return db[_0xc6d8('0x14')]['find']({'raw':_0x5bd560[_0xc6d8('0x15')]?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x16')]===undefined?!![]:![]:!![],'where':_0x5bd560[_0xc6d8('0x15')]?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x1e')]||null:null,'attributes':_0x5bd560[_0xc6d8('0x15')]?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x17')]||null:null,'include':_0x5bd560['options']?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x1a')]?_[_0xc6d8('0x19')](_0x5bd560['options'][_0xc6d8('0x1a')],function(_0x152360){return{'model':db[_0x152360[_0xc6d8('0x1b')]],'as':_0x152360['as'],'attributes':_0x152360[_0xc6d8('0x17')],'include':_0x152360['include']?_[_0xc6d8('0x19')](_0x152360[_0xc6d8('0x1a')],function(_0x4202fc){return{'model':db[_0x4202fc[_0xc6d8('0x1b')]],'as':_0x4202fc['as'],'attributes':_0x4202fc[_0xc6d8('0x17')],'include':_0x4202fc['include']?_[_0xc6d8('0x19')](_0x4202fc[_0xc6d8('0x1a')],function(_0x2ea0d3){return{'model':db[_0x2ea0d3[_0xc6d8('0x1b')]],'as':_0x2ea0d3['as'],'attributes':_0x2ea0d3[_0xc6d8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc6d8('0xb')](function(_0x4ec323){logger[_0xc6d8('0xc')](_0xc6d8('0x1d'),_0x5bd560);logger[_0xc6d8('0xe')](_0xc6d8('0x1d'),_0x5bd560,JSON[_0xc6d8('0x1f')](_0x4ec323));_0x271d0c(_0x4ec323);})['catch'](function(_0x2288d2){logger['error'](_0xc6d8('0x1d'),_0x2288d2[_0xc6d8('0x12')],_0x5bd560);_0x5d4c25(_0x1cec57[_0xc6d8('0xf')](0x1f4,_0x2288d2[_0xc6d8('0x12')]));});});}; \ No newline at end of file +var _0xbade=['message','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','map','include','model','debug','ShowZohoAccount','where','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','info','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s'];(function(_0x4dfbe0,_0x556350){var _0x1bcb68=function(_0x4be615){while(--_0x4be615){_0x4dfbe0['push'](_0x4dfbe0['shift']());}};_0x1bcb68(++_0x556350);}(_0xbade,0x1ce));var _0xebad=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xbade[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xebad('0x0'));var util=require(_0xebad('0x1'));var moment=require(_0xebad('0x2'));var BPromise=require(_0xebad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebad('0x4'));var db=require(_0xebad('0x5'))['db'];var utils=require(_0xebad('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xebad('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4abaf2,_0xaa3fac,_0x46391b){return new BPromise(function(_0x16e934,_0x435b3d){return client['request'](_0x4abaf2,_0x46391b)['then'](function(_0x24549d){logger[_0xebad('0x8')]('ZohoAccount,\x20%s,\x20%s',_0xaa3fac,_0xebad('0x9'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xaa3fac,_0xebad('0x9'),JSON[_0xebad('0xa')](_0x24549d));if(_0x24549d[_0xebad('0xb')]){if(_0x24549d[_0xebad('0xb')][_0xebad('0xc')]===0x1f4){logger[_0xebad('0xb')](_0xebad('0xd'),_0xaa3fac,_0x24549d[_0xebad('0xb')]['message']);return _0x435b3d(_0x24549d[_0xebad('0xb')][_0xebad('0xe')]);}logger['error'](_0xebad('0xd'),_0xaa3fac,_0x24549d['error'][_0xebad('0xe')]);return _0x16e934(_0x24549d[_0xebad('0xb')]['message']);}else{logger[_0xebad('0x8')]('ZohoAccount,\x20%s,\x20%s',_0xaa3fac,_0xebad('0x9'));_0x16e934(_0x24549d['result'][_0xebad('0xe')]);}})[_0xebad('0xf')](function(_0x104211){logger[_0xebad('0xb')]('ZohoAccount,\x20%s,\x20%s',_0xaa3fac,_0x104211);_0x435b3d(_0x104211);});});}exports[_0xebad('0x10')]=function(_0xb28f3){var _0x56fb02=this;return new Promise(function(_0x2dfc2a,_0x15dba5){return db[_0xebad('0x11')]['findAll']({'raw':_0xb28f3['options']?_0xb28f3[_0xebad('0x12')][_0xebad('0x13')]===undefined?!![]:![]:!![],'where':_0xb28f3[_0xebad('0x12')]?_0xb28f3[_0xebad('0x12')]['where']||null:null,'attributes':_0xb28f3[_0xebad('0x12')]?_0xb28f3[_0xebad('0x12')][_0xebad('0x14')]||null:null,'limit':_0xb28f3['options']?_0xb28f3[_0xebad('0x12')]['limit']||null:null,'include':_0xb28f3[_0xebad('0x12')]?_0xb28f3[_0xebad('0x12')]['include']?_[_0xebad('0x15')](_0xb28f3['options'][_0xebad('0x16')],function(_0x2d9c7a){return{'model':db[_0x2d9c7a[_0xebad('0x17')]],'as':_0x2d9c7a['as'],'attributes':_0x2d9c7a[_0xebad('0x14')],'include':_0x2d9c7a[_0xebad('0x16')]?_[_0xebad('0x15')](_0x2d9c7a[_0xebad('0x16')],function(_0x12c181){return{'model':db[_0x12c181[_0xebad('0x17')]],'as':_0x12c181['as'],'attributes':_0x12c181[_0xebad('0x14')],'include':_0x12c181[_0xebad('0x16')]?_[_0xebad('0x15')](_0x12c181['include'],function(_0x223bf8){return{'model':db[_0x223bf8['model']],'as':_0x223bf8['as'],'attributes':_0x223bf8[_0xebad('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x232450){logger['info'](_0xebad('0x10'),_0xb28f3);logger[_0xebad('0x18')](_0xebad('0x10'),_0xb28f3,JSON['stringify'](_0x232450));_0x2dfc2a(_0x232450);})['catch'](function(_0x564826){logger[_0xebad('0xb')](_0xebad('0x10'),_0x564826[_0xebad('0xe')],_0xb28f3);_0x15dba5(_0x56fb02[_0xebad('0xb')](0x1f4,_0x564826[_0xebad('0xe')]));});});};exports[_0xebad('0x19')]=function(_0x3970a7){var _0x42878d=this;return new Promise(function(_0x2558a6,_0x575751){return db[_0xebad('0x11')]['find']({'raw':_0x3970a7[_0xebad('0x12')]?_0x3970a7[_0xebad('0x12')][_0xebad('0x13')]===undefined?!![]:![]:!![],'where':_0x3970a7['options']?_0x3970a7[_0xebad('0x12')][_0xebad('0x1a')]||null:null,'attributes':_0x3970a7[_0xebad('0x12')]?_0x3970a7[_0xebad('0x12')][_0xebad('0x14')]||null:null,'include':_0x3970a7[_0xebad('0x12')]?_0x3970a7[_0xebad('0x12')][_0xebad('0x16')]?_[_0xebad('0x15')](_0x3970a7['options'][_0xebad('0x16')],function(_0x14109e){return{'model':db[_0x14109e[_0xebad('0x17')]],'as':_0x14109e['as'],'attributes':_0x14109e[_0xebad('0x14')],'include':_0x14109e[_0xebad('0x16')]?_[_0xebad('0x15')](_0x14109e[_0xebad('0x16')],function(_0x236428){return{'model':db[_0x236428[_0xebad('0x17')]],'as':_0x236428['as'],'attributes':_0x236428[_0xebad('0x14')],'include':_0x236428[_0xebad('0x16')]?_['map'](_0x236428[_0xebad('0x16')],function(_0x24a455){return{'model':db[_0x24a455[_0xebad('0x17')]],'as':_0x24a455['as'],'attributes':_0x24a455[_0xebad('0x14')]};}):[]};}):[]};}):[]:[]})[_0xebad('0x1b')](function(_0x5f4b88){logger[_0xebad('0x8')]('ShowZohoAccount',_0x3970a7);logger[_0xebad('0x18')](_0xebad('0x19'),_0x3970a7,JSON[_0xebad('0xa')](_0x5f4b88));_0x2558a6(_0x5f4b88);})[_0xebad('0xf')](function(_0x12aa0b){logger[_0xebad('0xb')](_0xebad('0x19'),_0x12aa0b[_0xebad('0xe')],_0x3970a7);_0x575751(_0x42878d['error'](0x1f4,_0x12aa0b[_0xebad('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3e6b4bb..45857bf 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 _0x37b4=['/:id/subjects','getSubjects','isAuthenticated','getDescriptions','post','put','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','/:id','show','/:id/fields','get'];(function(_0x35bb18,_0x49d2d5){var _0x5b17be=function(_0x367efd){while(--_0x367efd){_0x35bb18['push'](_0x35bb18['shift']());}};_0x5b17be(++_0x49d2d5);}(_0x37b4,0xef));var _0x437b=function(_0x4b6db3,_0x4bfef8){_0x4b6db3=_0x4b6db3-0x0;var _0x5797ff=_0x37b4[_0x4b6db3];return _0x5797ff;};'use strict';var multer=require(_0x437b('0x0'));var util=require('util');var path=require(_0x437b('0x1'));var timeout=require(_0x437b('0x2'));var express=require(_0x437b('0x3'));var router=express['Router']();var auth=require(_0x437b('0x4'));var interaction=require(_0x437b('0x5'));var config=require(_0x437b('0x6'));var controller=require(_0x437b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x437b('0x8')]);router['get'](_0x437b('0x9'),auth['isAuthenticated'](),controller[_0x437b('0xa')]);router['get'](_0x437b('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x437b('0xc')](_0x437b('0xd'),auth['isAuthenticated'](),controller[_0x437b('0xe')]);router['get']('/:id/descriptions',auth[_0x437b('0xf')](),controller[_0x437b('0x10')]);router[_0x437b('0x11')]('/',auth[_0x437b('0xf')](),controller['create']);router[_0x437b('0x12')](_0x437b('0x9'),auth[_0x437b('0xf')](),controller['update']);router[_0x437b('0x13')](_0x437b('0x9'),auth[_0x437b('0xf')](),controller['destroy']);module[_0x437b('0x14')]=router; \ No newline at end of file +var _0x7070=['getSubjects','/:id/descriptions','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','/:id/fields','getFields','get','/:id/subjects'];(function(_0x3a2a56,_0x277b9d){var _0x1f7417=function(_0x2b489f){while(--_0x2b489f){_0x3a2a56['push'](_0x3a2a56['shift']());}};_0x1f7417(++_0x277b9d);}(_0x7070,0x1d7));var _0x0707=function(_0x4c9c48,_0x1c15ae){_0x4c9c48=_0x4c9c48-0x0;var _0x47b9dd=_0x7070[_0x4c9c48];return _0x47b9dd;};'use strict';var multer=require('multer');var util=require(_0x0707('0x0'));var path=require('path');var timeout=require(_0x0707('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x0707('0x2'));var interaction=require(_0x0707('0x3'));var config=require(_0x0707('0x4'));var controller=require(_0x0707('0x5'));router['get']('/',auth[_0x0707('0x6')](),controller[_0x0707('0x7')]);router['get']('/:id',auth[_0x0707('0x6')](),controller['show']);router['get'](_0x0707('0x8'),auth[_0x0707('0x6')](),controller[_0x0707('0x9')]);router[_0x0707('0xa')](_0x0707('0xb'),auth[_0x0707('0x6')](),controller[_0x0707('0xc')]);router[_0x0707('0xa')](_0x0707('0xd'),auth[_0x0707('0x6')](),controller['getDescriptions']);router[_0x0707('0xe')]('/',auth['isAuthenticated'](),controller[_0x0707('0xf')]);router['put'](_0x0707('0x10'),auth[_0x0707('0x6')](),controller[_0x0707('0x11')]);router[_0x0707('0x12')](_0x0707('0x10'),auth[_0x0707('0x6')](),controller[_0x0707('0x13')]);module[_0x0707('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index a85e34d..ad2b488 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 _0x4fcc=['STRING','ENUM','lead','contact','exports'];(function(_0x56a465,_0x10ab49){var _0x2b754f=function(_0x177b00){while(--_0x177b00){_0x56a465['push'](_0x56a465['shift']());}};_0x2b754f(++_0x10ab49);}(_0x4fcc,0x77));var _0xc4fc=function(_0x58eb5f,_0x411c00){_0x58eb5f=_0x58eb5f-0x0;var _0x3c8676=_0x4fcc[_0x58eb5f];return _0x3c8676;};'use strict';var Sequelize=require('sequelize');module[_0xc4fc('0x0')]={'name':{'type':Sequelize[_0xc4fc('0x1')]},'moduleCreate':{'type':Sequelize[_0xc4fc('0x2')]('lead','contact','nothing'),'defaultValue':_0xc4fc('0x3')},'moduleSearch':{'type':Sequelize[_0xc4fc('0x2')]('contact_lead',_0xc4fc('0x4'),_0xc4fc('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xc4fc('0x1')]}}; \ No newline at end of file +var _0xe92a=['nothing','ENUM','contact_lead','contact','sequelize','STRING','lead'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xe92a,0x13f));var _0xae92=function(_0x16f7aa,_0x1f59e7){_0x16f7aa=_0x16f7aa-0x0;var _0x1ea658=_0xe92a[_0x16f7aa];return _0x1ea658;};'use strict';var Sequelize=require(_0xae92('0x0'));module['exports']={'name':{'type':Sequelize[_0xae92('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xae92('0x2'),'contact',_0xae92('0x3')),'defaultValue':_0xae92('0x2')},'moduleSearch':{'type':Sequelize[_0xae92('0x4')](_0xae92('0x5'),_0xae92('0x6'),_0xae92('0x2')),'defaultValue':_0xae92('0x5')},'description':{'type':Sequelize[_0xae92('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 879b88b..ebd0e54 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(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 451fffd..6e1867e 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 _0xf0b0=['define','int_zoho_configurations','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xf0b0,0x1d6));var _0x0f0b=function(_0x49f232,_0xc45467){_0x49f232=_0x49f232-0x0;var _0x584a7b=_0xf0b0[_0x49f232];return _0x584a7b;};'use strict';var _=require('lodash');var util=require(_0x0f0b('0x0'));var logger=require('../../config/logger')(_0x0f0b('0x1'));var moment=require(_0x0f0b('0x2'));var BPromise=require(_0x0f0b('0x3'));var rp=require(_0x0f0b('0x4'));var fs=require('fs');var path=require(_0x0f0b('0x5'));var rimraf=require(_0x0f0b('0x6'));var config=require(_0x0f0b('0x7'));var attributes=require(_0x0f0b('0x8'));module[_0x0f0b('0x9')]=function(_0xcf02dd,_0x433646){return _0xcf02dd[_0x0f0b('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x0f0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe934=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xe934,0x117));var _0x4e93=function(_0x232eb7,_0x199b07){_0x232eb7=_0x232eb7-0x0;var _0xd7fb8=_0xe934[_0x232eb7];return _0xd7fb8;};'use strict';var _=require(_0x4e93('0x0'));var util=require(_0x4e93('0x1'));var logger=require(_0x4e93('0x2'))(_0x4e93('0x3'));var moment=require(_0x4e93('0x4'));var BPromise=require(_0x4e93('0x5'));var rp=require(_0x4e93('0x6'));var fs=require('fs');var path=require(_0x4e93('0x7'));var rimraf=require(_0x4e93('0x8'));var config=require(_0x4e93('0x9'));var attributes=require(_0x4e93('0xa'));module['exports']=function(_0x5e1319,_0x575e71){return _0x5e1319['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e6f1d03..a1181e6 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 _0x0cfd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x53ae2b,_0xe8b280){var _0x45ade9=function(_0x631729){while(--_0x631729){_0x53ae2b['push'](_0x53ae2b['shift']());}};_0x45ade9(++_0xe8b280);}(_0x0cfd,0x120));var _0xd0cf=function(_0x3f5abd,_0x25cfb8){_0x3f5abd=_0x3f5abd-0x0;var _0x30e448=_0x0cfd[_0x3f5abd];return _0x30e448;};'use strict';var _=require(_0xd0cf('0x0'));var util=require(_0xd0cf('0x1'));var moment=require(_0xd0cf('0x2'));var BPromise=require(_0xd0cf('0x3'));var rs=require(_0xd0cf('0x4'));var fs=require('fs');var Redis=require(_0xd0cf('0x5'));var db=require(_0xd0cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0cf('0x7'))('rpc');var config=require(_0xd0cf('0x8'));var jayson=require(_0xd0cf('0x9'));var client=jayson[_0xd0cf('0xa')][_0xd0cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294192,_0x3c2ba5,_0x25ed30){return new BPromise(function(_0xe1e1fa,_0x3591e){return client[_0xd0cf('0xc')](_0x294192,_0x25ed30)[_0xd0cf('0xd')](function(_0x43e202){logger[_0xd0cf('0xe')](_0xd0cf('0xf'),_0x3c2ba5,_0xd0cf('0x10'));logger['debug'](_0xd0cf('0x11'),_0x3c2ba5,_0xd0cf('0x10'),JSON[_0xd0cf('0x12')](_0x43e202));if(_0x43e202[_0xd0cf('0x13')]){if(_0x43e202[_0xd0cf('0x13')][_0xd0cf('0x14')]===0x1f4){logger['error'](_0xd0cf('0xf'),_0x3c2ba5,_0x43e202[_0xd0cf('0x13')][_0xd0cf('0x15')]);return _0x3591e(_0x43e202['error'][_0xd0cf('0x15')]);}logger[_0xd0cf('0x13')](_0xd0cf('0xf'),_0x3c2ba5,_0x43e202['error'][_0xd0cf('0x15')]);return _0xe1e1fa(_0x43e202[_0xd0cf('0x13')]['message']);}else{logger[_0xd0cf('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3c2ba5,_0xd0cf('0x10'));_0xe1e1fa(_0x43e202[_0xd0cf('0x16')][_0xd0cf('0x15')]);}})[_0xd0cf('0x17')](function(_0x397e95){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3c2ba5,_0x397e95);_0x3591e(_0x397e95);});});} \ No newline at end of file +var _0x756a=['jayson/promise','client','http','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x390976,_0xb59147){var _0x41906d=function(_0x13c4ca){while(--_0x13c4ca){_0x390976['push'](_0x390976['shift']());}};_0x41906d(++_0xb59147);}(_0x756a,0x163));var _0xa756=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x756a[_0x2a55f8];return _0x245efd;};'use strict';var _=require('lodash');var util=require(_0xa756('0x0'));var moment=require('moment');var BPromise=require(_0xa756('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa756('0x2'))['db'];var utils=require(_0xa756('0x3'));var logger=require('../../config/logger')(_0xa756('0x4'));var config=require('../../config/environment');var jayson=require(_0xa756('0x5'));var client=jayson[_0xa756('0x6')][_0xa756('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40a250,_0x4f9e76,_0x492a76){return new BPromise(function(_0x1cc3b4,_0x4951ed){return client['request'](_0x40a250,_0x492a76)['then'](function(_0x3867db){logger['info'](_0xa756('0x8'),_0x4f9e76,_0xa756('0x9'));logger[_0xa756('0xa')](_0xa756('0xb'),_0x4f9e76,_0xa756('0x9'),JSON['stringify'](_0x3867db));if(_0x3867db[_0xa756('0xc')]){if(_0x3867db[_0xa756('0xc')][_0xa756('0xd')]===0x1f4){logger['error'](_0xa756('0x8'),_0x4f9e76,_0x3867db['error']['message']);return _0x4951ed(_0x3867db[_0xa756('0xc')][_0xa756('0xe')]);}logger[_0xa756('0xc')](_0xa756('0x8'),_0x4f9e76,_0x3867db[_0xa756('0xc')][_0xa756('0xe')]);return _0x1cc3b4(_0x3867db[_0xa756('0xc')][_0xa756('0xe')]);}else{logger[_0xa756('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x4f9e76,_0xa756('0x9'));_0x1cc3b4(_0x3867db[_0xa756('0x10')][_0xa756('0xe')]);}})[_0xa756('0x11')](function(_0x2c8b95){logger[_0xa756('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x4f9e76,_0x2c8b95);_0x4951ed(_0x2c8b95);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 542e420..5edc1ef 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 _0x5c3c=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','post','put','/:id','update','delete'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x5c3c,0x132));var _0xc5c3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5c3c[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var auth=require(_0xc5c3('0x5'));var interaction=require(_0xc5c3('0x6'));var config=require(_0xc5c3('0x7'));var controller=require(_0xc5c3('0x8'));router[_0xc5c3('0x9')]('/',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xb')]);router[_0xc5c3('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5c3('0xc')]('/',auth[_0xc5c3('0xa')](),controller['create']);router[_0xc5c3('0xd')](_0xc5c3('0xe'),auth['isAuthenticated'](),controller[_0xc5c3('0xf')]);router[_0xc5c3('0x10')]('/:id',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x11')]);module[_0xc5c3('0x12')]=router; \ No newline at end of file +var _0xe5af=['post','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','show'];(function(_0x3b0fdb,_0x23a049){var _0x220a59=function(_0x1b9024){while(--_0x1b9024){_0x3b0fdb['push'](_0x3b0fdb['shift']());}};_0x220a59(++_0x23a049);}(_0xe5af,0x9c));var _0xfe5a=function(_0x558f99,_0x3ac63c){_0x558f99=_0x558f99-0x0;var _0x134ebc=_0xe5af[_0x558f99];return _0x134ebc;};'use strict';var multer=require('multer');var util=require(_0xfe5a('0x0'));var path=require(_0xfe5a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe5a('0x2'));var router=express[_0xfe5a('0x3')]();var auth=require(_0xfe5a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfe5a('0x5'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0xfe5a('0x6')](),controller[_0xfe5a('0x7')]);router['get']('/:id',auth[_0xfe5a('0x6')](),controller[_0xfe5a('0x8')]);router[_0xfe5a('0x9')]('/',auth[_0xfe5a('0x6')](),controller['create']);router[_0xfe5a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfe5a('0xb')]);router[_0xfe5a('0xc')]('/:id',auth[_0xfe5a('0x6')](),controller[_0xfe5a('0xd')]);module[_0xfe5a('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a0b41a2..a78244f 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 _0xcb66=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb66,0x19f));var _0x6cb6=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xcb66[_0x5d5bcb];return _0x4ea5eb;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'type':{'type':Sequelize[_0x6cb6('0x1')](_0x6cb6('0x2'),_0x6cb6('0x3'),_0x6cb6('0x4'),'keyValue'),'defaultValue':_0x6cb6('0x2')},'content':{'type':Sequelize[_0x6cb6('0x5')]},'key':{'type':Sequelize[_0x6cb6('0x5')]},'keyType':{'type':Sequelize[_0x6cb6('0x1')](_0x6cb6('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6cb6('0x5')]},'idField':{'type':Sequelize[_0x6cb6('0x5')]},'nameField':{'type':Sequelize[_0x6cb6('0x5')]},'customField':{'type':Sequelize[_0x6cb6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6cb6('0x5')]}}; \ No newline at end of file +var _0x2a56=['exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x39c309,_0x207f40){var _0x35e23b=function(_0x105282){while(--_0x105282){_0x39c309['push'](_0x39c309['shift']());}};_0x35e23b(++_0x207f40);}(_0x2a56,0xaf));var _0x62a5=function(_0x14ebb0,_0x2fe8a5){_0x14ebb0=_0x14ebb0-0x0;var _0xe14915=_0x2a56[_0x14ebb0];return _0xe14915;};'use strict';var Sequelize=require('sequelize');module[_0x62a5('0x0')]={'type':{'type':Sequelize['ENUM'](_0x62a5('0x1'),_0x62a5('0x2'),_0x62a5('0x3'),_0x62a5('0x4')),'defaultValue':_0x62a5('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x62a5('0x5')]},'keyType':{'type':Sequelize[_0x62a5('0x6')](_0x62a5('0x1'),_0x62a5('0x2'),_0x62a5('0x3'))},'keyContent':{'type':Sequelize[_0x62a5('0x5')]},'idField':{'type':Sequelize[_0x62a5('0x5')]},'nameField':{'type':Sequelize[_0x62a5('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x62a5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 5a231f3..8df29c4 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 _0x189a=['end','json','count','offset','limit','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','merge','type','options','where','ZohoField','includeAll','findAll','rows','show','params','length','include','catch','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x189a,0x1cb));var _0xa189=function(_0x497790,_0x2b3754){_0x497790=_0x497790-0x0;var _0x5148d0=_0x189a[_0x497790];return _0x5148d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa189('0x0'));var zipdir=require(_0xa189('0x1'));var jsonpatch=require(_0xa189('0x2'));var rp=require(_0xa189('0x3'));var moment=require(_0xa189('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa189('0x5'));var sox=require(_0xa189('0x6'));var csv=require(_0xa189('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa189('0x8'));var squel=require(_0xa189('0x9'));var crypto=require(_0xa189('0xa'));var jsforce=require(_0xa189('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa189('0x7'));var querystring=require(_0xa189('0xc'));var Papa=require(_0xa189('0xd'));var Redis=require('ioredis');var authService=require(_0xa189('0xe'));var qs=require(_0xa189('0xf'));var as=require(_0xa189('0x10'));var hardwareService=require(_0xa189('0x11'));var logger=require(_0xa189('0x12'))(_0xa189('0x13'));var utils=require(_0xa189('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa189('0x15'))['db'];function respondWithStatusCode(_0x23a798,_0x1a8a68){_0x1a8a68=_0x1a8a68||0xcc;return function(_0x1d11a8){if(_0x1d11a8){return _0x23a798[_0xa189('0x16')](_0x1a8a68);}return _0x23a798[_0xa189('0x17')](_0x1a8a68)[_0xa189('0x18')]();};}function respondWithResult(_0x3eecce,_0x1db54a){_0x1db54a=_0x1db54a||0xc8;return function(_0x3d8a88){if(_0x3d8a88){return _0x3eecce['status'](_0x1db54a)[_0xa189('0x19')](_0x3d8a88);}};}function respondWithFilteredResult(_0x2ace99,_0x5d321b){return function(_0x44deae){if(_0x44deae){var _0x240f77=_0x44deae[_0xa189('0x1a')],_0x51cac0=_0x5d321b[_0xa189('0x1b')],_0x8b1a12=_0x5d321b[_0xa189('0x1b')]+_0x5d321b[_0xa189('0x1c')],_0x28ea82;if(_0x8b1a12>=_0x240f77){_0x8b1a12=_0x240f77;_0x28ea82=0xc8;}else{_0x28ea82=0xce;}_0x2ace99[_0xa189('0x17')](_0x28ea82);return _0x2ace99['set']('Content-Range',_0x51cac0+'-'+_0x8b1a12+'/'+_0x240f77)[_0xa189('0x19')](_0x44deae);}return null;};}function patchUpdates(_0x277604){return function(_0x12aab1){try{jsonpatch['apply'](_0x12aab1,_0x277604,!![]);}catch(_0x26f58e){return BPromise['reject'](_0x26f58e);}return _0x12aab1[_0xa189('0x1d')]();};}function saveUpdates(_0x1215ea,_0x4d656e){return function(_0x26b141){if(_0x26b141){return _0x26b141['update'](_0x1215ea)[_0xa189('0x1e')](function(_0x3f0956){return _0x3f0956;});}return null;};}function removeEntity(_0x44d0d3,_0x8d19d7){return function(_0x8e46a3){if(_0x8e46a3){return _0x8e46a3[_0xa189('0x1f')]()[_0xa189('0x1e')](function(){_0x44d0d3[_0xa189('0x17')](0xcc)[_0xa189('0x18')]();});}};}function handleEntityNotFound(_0xa83c91,_0x30a5ba){return function(_0x41ff34){if(!_0x41ff34){_0xa83c91[_0xa189('0x16')](0x194);}return _0x41ff34;};}function handleError(_0x5b9387,_0x42bd88){_0x42bd88=_0x42bd88||0x1f4;return function(_0x16642d){logger[_0xa189('0x20')](_0x16642d['stack']);if(_0x16642d[_0xa189('0x21')]){delete _0x16642d[_0xa189('0x21')];}_0x5b9387['status'](_0x42bd88)[_0xa189('0x22')](_0x16642d);};}exports[_0xa189('0x23')]=function(_0x1006fc,_0x8e537b){var _0x20cffb={},_0xea7b77={},_0x8c807b={'count':0x0,'rows':[]};var _0x1df361=_[_0xa189('0x24')](db['ZohoField'][_0xa189('0x25')],function(_0x3d67e3){return{'name':_0x3d67e3[_0xa189('0x26')],'type':_0x3d67e3['type'][_0xa189('0x27')]};});_0xea7b77[_0xa189('0x28')]=_[_0xa189('0x24')](_0x1df361,_0xa189('0x21'));_0xea7b77['query']=_[_0xa189('0x29')](_0x1006fc[_0xa189('0x2a')]);_0xea7b77['filters']=_[_0xa189('0x2b')](_0xea7b77['model'],_0xea7b77['query']);_0x20cffb['attributes']=_[_0xa189('0x2b')](_0xea7b77[_0xa189('0x28')],qs[_0xa189('0x2c')](_0x1006fc[_0xa189('0x2a')][_0xa189('0x2c')]));_0x20cffb[_0xa189('0x2d')]=_0x20cffb[_0xa189('0x2d')]['length']?_0x20cffb[_0xa189('0x2d')]:_0xea7b77[_0xa189('0x28')];if(!_0x1006fc[_0xa189('0x2a')][_0xa189('0x2e')](_0xa189('0x2f'))){_0x20cffb[_0xa189('0x1c')]=qs[_0xa189('0x1c')](_0x1006fc[_0xa189('0x2a')][_0xa189('0x1c')]);_0x20cffb[_0xa189('0x1b')]=qs[_0xa189('0x1b')](_0x1006fc['query'][_0xa189('0x1b')]);}_0x20cffb[_0xa189('0x30')]=qs['sort'](_0x1006fc[_0xa189('0x2a')][_0xa189('0x31')]);_0x20cffb['where']=qs['filters'](_['pick'](_0x1006fc[_0xa189('0x2a')],_0xea7b77[_0xa189('0x32')]),_0x1df361);if(_0x1006fc[_0xa189('0x2a')][_0xa189('0x33')]){_0x20cffb['where']=_[_0xa189('0x34')](_0x20cffb['where'],{'$or':_[_0xa189('0x24')](_0x1df361,function(_0x36abd7){if(_0x36abd7[_0xa189('0x35')]!=='VIRTUAL'){var _0x3dc05f={};_0x3dc05f[_0x36abd7[_0xa189('0x21')]]={'$like':'%'+_0x1006fc[_0xa189('0x2a')][_0xa189('0x33')]+'%'};return _0x3dc05f;}})});}_0x20cffb=_[_0xa189('0x34')]({},_0x20cffb,_0x1006fc[_0xa189('0x36')]);var _0x26a920={'where':_0x20cffb[_0xa189('0x37')]};return db[_0xa189('0x38')][_0xa189('0x1a')](_0x26a920)['then'](function(_0x319b18){_0x8c807b[_0xa189('0x1a')]=_0x319b18;if(_0x1006fc[_0xa189('0x2a')][_0xa189('0x39')]){_0x20cffb['include']=[{'all':!![]}];}return db[_0xa189('0x38')][_0xa189('0x3a')](_0x20cffb);})[_0xa189('0x1e')](function(_0x79639c){_0x8c807b[_0xa189('0x3b')]=_0x79639c;return _0x8c807b;})[_0xa189('0x1e')](respondWithFilteredResult(_0x8e537b,_0x20cffb))['catch'](handleError(_0x8e537b,null));};exports[_0xa189('0x3c')]=function(_0x2c0818,_0x14e256){var _0x16dc10={'raw':!![],'where':{'id':_0x2c0818[_0xa189('0x3d')]['id']}},_0xd6e205={};_0xd6e205['model']=_['keys'](db['ZohoField']['rawAttributes']);_0xd6e205[_0xa189('0x2a')]=_[_0xa189('0x29')](_0x2c0818[_0xa189('0x2a')]);_0xd6e205[_0xa189('0x32')]=_['intersection'](_0xd6e205['model'],_0xd6e205[_0xa189('0x2a')]);_0x16dc10[_0xa189('0x2d')]=_[_0xa189('0x2b')](_0xd6e205['model'],qs[_0xa189('0x2c')](_0x2c0818[_0xa189('0x2a')][_0xa189('0x2c')]));_0x16dc10['attributes']=_0x16dc10[_0xa189('0x2d')][_0xa189('0x3e')]?_0x16dc10[_0xa189('0x2d')]:_0xd6e205[_0xa189('0x28')];if(_0x2c0818[_0xa189('0x2a')][_0xa189('0x39')]){_0x16dc10[_0xa189('0x3f')]=[{'all':!![]}];}_0x16dc10=_[_0xa189('0x34')]({},_0x16dc10,_0x2c0818['options']);return db['ZohoField']['find'](_0x16dc10)['then'](handleEntityNotFound(_0x14e256,null))[_0xa189('0x1e')](respondWithResult(_0x14e256,null))[_0xa189('0x40')](handleError(_0x14e256,null));};exports[_0xa189('0x41')]=function(_0x272d00,_0x4fff64){return db['ZohoField'][_0xa189('0x41')](_0x272d00[_0xa189('0x42')],{})['then'](respondWithResult(_0x4fff64,0xc9))[_0xa189('0x40')](handleError(_0x4fff64,null));};exports[_0xa189('0x43')]=function(_0x2418bd,_0x15b86f){if(_0x2418bd[_0xa189('0x42')]['id']){delete _0x2418bd['body']['id'];}return db['ZohoField'][_0xa189('0x44')]({'where':{'id':_0x2418bd[_0xa189('0x3d')]['id']}})[_0xa189('0x1e')](handleEntityNotFound(_0x15b86f,null))['then'](saveUpdates(_0x2418bd[_0xa189('0x42')],null))['then'](respondWithResult(_0x15b86f,null))[_0xa189('0x40')](handleError(_0x15b86f,null));};exports[_0xa189('0x1f')]=function(_0x17827c,_0x34815f){return db[_0xa189('0x38')]['find']({'where':{'id':_0x17827c['params']['id']}})[_0xa189('0x1e')](handleEntityNotFound(_0x34815f,null))[_0xa189('0x1e')](removeEntity(_0x34815f,null))[_0xa189('0x40')](handleError(_0x34815f,null));}; \ No newline at end of file +var _0xee0a=['filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','pick','merge','where','options','then','includeAll','findAll','rows','params','include','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys'];(function(_0x580a21,_0x27af24){var _0x46ea56=function(_0x47c944){while(--_0x47c944){_0x580a21['push'](_0x580a21['shift']());}};_0x46ea56(++_0x27af24);}(_0xee0a,0xa3));var _0xaee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee0a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xaee0('0x0'));var emlformat=require(_0xaee0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaee0('0x2'));var jsonpatch=require(_0xaee0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaee0('0x4'));var util=require(_0xaee0('0x5'));var path=require('path');var sox=require(_0xaee0('0x6'));var csv=require(_0xaee0('0x7'));var ejs=require(_0xaee0('0x8'));var fs=require('fs');var _=require(_0xaee0('0x9'));var squel=require(_0xaee0('0xa'));var crypto=require(_0xaee0('0xb'));var jsforce=require(_0xaee0('0xc'));var deskjs=require(_0xaee0('0xd'));var toCsv=require(_0xaee0('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaee0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xaee0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaee0('0x10'))(_0xaee0('0x11'));var utils=require(_0xaee0('0x12'));var config=require(_0xaee0('0x13'));var licenseUtil=require(_0xaee0('0x14'));var db=require(_0xaee0('0x15'))['db'];function respondWithStatusCode(_0x4636ca,_0x25af07){_0x25af07=_0x25af07||0xcc;return function(_0x279c68){if(_0x279c68){return _0x4636ca[_0xaee0('0x16')](_0x25af07);}return _0x4636ca['status'](_0x25af07)[_0xaee0('0x17')]();};}function respondWithResult(_0x1070b4,_0x3764ab){_0x3764ab=_0x3764ab||0xc8;return function(_0x3252ac){if(_0x3252ac){return _0x1070b4[_0xaee0('0x18')](_0x3764ab)[_0xaee0('0x19')](_0x3252ac);}};}function respondWithFilteredResult(_0x72556d,_0x35aff7){return function(_0x1b2e1f){if(_0x1b2e1f){var _0x39abd9=_0x1b2e1f[_0xaee0('0x1a')],_0x49ad6a=_0x35aff7[_0xaee0('0x1b')],_0x41995a=_0x35aff7[_0xaee0('0x1b')]+_0x35aff7[_0xaee0('0x1c')],_0x2518fb;if(_0x41995a>=_0x39abd9){_0x41995a=_0x39abd9;_0x2518fb=0xc8;}else{_0x2518fb=0xce;}_0x72556d[_0xaee0('0x18')](_0x2518fb);return _0x72556d[_0xaee0('0x1d')](_0xaee0('0x1e'),_0x49ad6a+'-'+_0x41995a+'/'+_0x39abd9)[_0xaee0('0x19')](_0x1b2e1f);}return null;};}function patchUpdates(_0x451e2c){return function(_0x367a2a){try{jsonpatch[_0xaee0('0x1f')](_0x367a2a,_0x451e2c,!![]);}catch(_0x694b0b){return BPromise['reject'](_0x694b0b);}return _0x367a2a['save']();};}function saveUpdates(_0x54e39c,_0x3a9c42){return function(_0x4f8fc2){if(_0x4f8fc2){return _0x4f8fc2[_0xaee0('0x20')](_0x54e39c)['then'](function(_0x30eb98){return _0x30eb98;});}return null;};}function removeEntity(_0x621973,_0x1e99ac){return function(_0x767a13){if(_0x767a13){return _0x767a13[_0xaee0('0x21')]()['then'](function(){_0x621973['status'](0xcc)[_0xaee0('0x17')]();});}};}function handleEntityNotFound(_0x51ad0e,_0x3d488e){return function(_0x704479){if(!_0x704479){_0x51ad0e[_0xaee0('0x16')](0x194);}return _0x704479;};}function handleError(_0x269943,_0x48ef9d){_0x48ef9d=_0x48ef9d||0x1f4;return function(_0x39b57a){logger[_0xaee0('0x22')](_0x39b57a[_0xaee0('0x23')]);if(_0x39b57a[_0xaee0('0x24')]){delete _0x39b57a[_0xaee0('0x24')];}_0x269943[_0xaee0('0x18')](_0x48ef9d)[_0xaee0('0x25')](_0x39b57a);};}exports[_0xaee0('0x26')]=function(_0x2d7030,_0x39c7d6){var _0x281219={},_0x209868={},_0x2b9f08={'count':0x0,'rows':[]};var _0x1df682=_[_0xaee0('0x27')](db[_0xaee0('0x28')][_0xaee0('0x29')],function(_0x20d1fc){return{'name':_0x20d1fc[_0xaee0('0x2a')],'type':_0x20d1fc[_0xaee0('0x2b')][_0xaee0('0x2c')]};});_0x209868['model']=_[_0xaee0('0x27')](_0x1df682,_0xaee0('0x24'));_0x209868[_0xaee0('0x2d')]=_[_0xaee0('0x2e')](_0x2d7030['query']);_0x209868[_0xaee0('0x2f')]=_[_0xaee0('0x30')](_0x209868['model'],_0x209868[_0xaee0('0x2d')]);_0x281219['attributes']=_[_0xaee0('0x30')](_0x209868['model'],qs[_0xaee0('0x31')](_0x2d7030[_0xaee0('0x2d')][_0xaee0('0x31')]));_0x281219[_0xaee0('0x32')]=_0x281219[_0xaee0('0x32')][_0xaee0('0x33')]?_0x281219[_0xaee0('0x32')]:_0x209868[_0xaee0('0x34')];if(!_0x2d7030['query'][_0xaee0('0x35')](_0xaee0('0x36'))){_0x281219[_0xaee0('0x1c')]=qs[_0xaee0('0x1c')](_0x2d7030[_0xaee0('0x2d')]['limit']);_0x281219['offset']=qs['offset'](_0x2d7030[_0xaee0('0x2d')]['offset']);}_0x281219['order']=qs[_0xaee0('0x37')](_0x2d7030[_0xaee0('0x2d')][_0xaee0('0x37')]);_0x281219['where']=qs[_0xaee0('0x2f')](_[_0xaee0('0x38')](_0x2d7030['query'],_0x209868[_0xaee0('0x2f')]),_0x1df682);if(_0x2d7030['query']['filter']){_0x281219['where']=_[_0xaee0('0x39')](_0x281219[_0xaee0('0x3a')],{'$or':_[_0xaee0('0x27')](_0x1df682,function(_0x368da3){if(_0x368da3['type']!=='VIRTUAL'){var _0x39a059={};_0x39a059[_0x368da3[_0xaee0('0x24')]]={'$like':'%'+_0x2d7030[_0xaee0('0x2d')]['filter']+'%'};return _0x39a059;}})});}_0x281219=_[_0xaee0('0x39')]({},_0x281219,_0x2d7030[_0xaee0('0x3b')]);var _0x21b47f={'where':_0x281219[_0xaee0('0x3a')]};return db[_0xaee0('0x28')][_0xaee0('0x1a')](_0x21b47f)[_0xaee0('0x3c')](function(_0x167b7e){_0x2b9f08[_0xaee0('0x1a')]=_0x167b7e;if(_0x2d7030[_0xaee0('0x2d')][_0xaee0('0x3d')]){_0x281219['include']=[{'all':!![]}];}return db[_0xaee0('0x28')][_0xaee0('0x3e')](_0x281219);})[_0xaee0('0x3c')](function(_0x5216ab){_0x2b9f08[_0xaee0('0x3f')]=_0x5216ab;return _0x2b9f08;})[_0xaee0('0x3c')](respondWithFilteredResult(_0x39c7d6,_0x281219))['catch'](handleError(_0x39c7d6,null));};exports['show']=function(_0x26837b,_0xe06677){var _0x590c0d={'raw':!![],'where':{'id':_0x26837b[_0xaee0('0x40')]['id']}},_0x4f7851={};_0x4f7851['model']=_[_0xaee0('0x2e')](db[_0xaee0('0x28')][_0xaee0('0x29')]);_0x4f7851[_0xaee0('0x2d')]=_[_0xaee0('0x2e')](_0x26837b[_0xaee0('0x2d')]);_0x4f7851['filters']=_[_0xaee0('0x30')](_0x4f7851[_0xaee0('0x34')],_0x4f7851[_0xaee0('0x2d')]);_0x590c0d[_0xaee0('0x32')]=_['intersection'](_0x4f7851[_0xaee0('0x34')],qs[_0xaee0('0x31')](_0x26837b[_0xaee0('0x2d')]['fields']));_0x590c0d[_0xaee0('0x32')]=_0x590c0d['attributes']['length']?_0x590c0d[_0xaee0('0x32')]:_0x4f7851[_0xaee0('0x34')];if(_0x26837b[_0xaee0('0x2d')]['includeAll']){_0x590c0d[_0xaee0('0x41')]=[{'all':!![]}];}_0x590c0d=_[_0xaee0('0x39')]({},_0x590c0d,_0x26837b['options']);return db[_0xaee0('0x28')][_0xaee0('0x42')](_0x590c0d)['then'](handleEntityNotFound(_0xe06677,null))[_0xaee0('0x3c')](respondWithResult(_0xe06677,null))[_0xaee0('0x43')](handleError(_0xe06677,null));};exports[_0xaee0('0x44')]=function(_0x5129da,_0x4429d7){return db[_0xaee0('0x28')][_0xaee0('0x44')](_0x5129da[_0xaee0('0x45')],{})[_0xaee0('0x3c')](respondWithResult(_0x4429d7,0xc9))['catch'](handleError(_0x4429d7,null));};exports[_0xaee0('0x20')]=function(_0x40d3b0,_0x722520){if(_0x40d3b0[_0xaee0('0x45')]['id']){delete _0x40d3b0[_0xaee0('0x45')]['id'];}return db[_0xaee0('0x28')][_0xaee0('0x42')]({'where':{'id':_0x40d3b0[_0xaee0('0x40')]['id']}})[_0xaee0('0x3c')](handleEntityNotFound(_0x722520,null))[_0xaee0('0x3c')](saveUpdates(_0x40d3b0[_0xaee0('0x45')],null))[_0xaee0('0x3c')](respondWithResult(_0x722520,null))[_0xaee0('0x43')](handleError(_0x722520,null));};exports[_0xaee0('0x21')]=function(_0x31d266,_0x349836){return db[_0xaee0('0x28')][_0xaee0('0x42')]({'where':{'id':_0x31d266['params']['id']}})[_0xaee0('0x3c')](handleEntityNotFound(_0x349836,null))['then'](removeEntity(_0x349836,null))[_0xaee0('0x43')](handleError(_0x349836,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 35885e5..0d4bacb 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 _0x8ad2=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8ad2,0x135));var _0x28ad=function(_0x118668,_0x3c16a1){_0x118668=_0x118668-0x0;var _0x3a2d11=_0x8ad2[_0x118668];return _0x3a2d11;};'use strict';var _=require(_0x28ad('0x0'));var util=require(_0x28ad('0x1'));var logger=require(_0x28ad('0x2'))(_0x28ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28ad('0x4'));var fs=require('fs');var path=require(_0x28ad('0x5'));var rimraf=require(_0x28ad('0x6'));var config=require(_0x28ad('0x7'));var attributes=require(_0x28ad('0x8'));module[_0x28ad('0x9')]=function(_0x3a0688,_0xfa7342){return _0x3a0688[_0x28ad('0xa')](_0x28ad('0xb'),attributes,{'tableName':_0x28ad('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x28ad('0xd'),_0x28ad('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc57=['ZohoField','int_zoho_fields','idField','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xcc57,0xd3));var _0x7cc5=function(_0x21946b,_0x165c02){_0x21946b=_0x21946b-0x0;var _0xa7f04=_0xcc57[_0x21946b];return _0xa7f04;};'use strict';var _=require('lodash');var util=require(_0x7cc5('0x0'));var logger=require(_0x7cc5('0x1'))(_0x7cc5('0x2'));var moment=require(_0x7cc5('0x3'));var BPromise=require('bluebird');var rp=require(_0x7cc5('0x4'));var fs=require('fs');var path=require(_0x7cc5('0x5'));var rimraf=require(_0x7cc5('0x6'));var config=require(_0x7cc5('0x7'));var attributes=require(_0x7cc5('0x8'));module['exports']=function(_0xd0c458,_0xeb94f7){return _0xd0c458[_0x7cc5('0x9')](_0x7cc5('0xa'),attributes,{'tableName':_0x7cc5('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x7cc5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 88162f1..e077374 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(_0x51227e,_0x21f277){var _0x457194=function(_0x5077e8){while(--_0x5077e8){_0x51227e['push'](_0x51227e['shift']());}};_0x457194(++_0x21f277);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){return client[_0xd7df('0xe')](_0x354ea7,_0x2c48a4)[_0xd7df('0xf')](function(_0x3dee59){logger['info'](_0xd7df('0x10'),_0x16e50,'request\x20sent');logger[_0xd7df('0x11')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x16e50,_0xd7df('0x12'),JSON[_0xd7df('0x13')](_0x3dee59));if(_0x3dee59[_0xd7df('0x14')]){if(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x15')]===0x1f4){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0xab6742(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0x5c220a(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}else{logger['info'](_0xd7df('0x10'),_0x16e50,_0xd7df('0x12'));_0x5c220a(_0x3dee59['result'][_0xd7df('0x16')]);}})[_0xd7df('0x17')](function(_0x5d3beb){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x5d3beb);_0xab6742(_0x5d3beb);});});} \ No newline at end of file +var _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x386213,_0x308bfc){var _0x4a0cc7=function(_0x491962){while(--_0x491962){_0x386213['push'](_0x386213['shift']());}};_0x4a0cc7(++_0x308bfc);}(_0x81bd,0x7c));var _0xd81b=function(_0x47d56f,_0x4115dc){_0x47d56f=_0x47d56f-0x0;var _0x4c66a1=_0x81bd[_0x47d56f];return _0x4c66a1;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('ZohoField,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('ZohoField,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0dc7d09..f4d9c84 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 _0xd479=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xd479,0xc1));var _0x9d47=function(_0x536eb7,_0x40e27c){_0x536eb7=_0x536eb7-0x0;var _0x244386=_0xd479[_0x536eb7];return _0x244386;};'use strict';var multer=require(_0x9d47('0x0'));var util=require('util');var path=require(_0x9d47('0x1'));var timeout=require(_0x9d47('0x2'));var express=require(_0x9d47('0x3'));var router=express[_0x9d47('0x4')]();var auth=require(_0x9d47('0x5'));var interaction=require(_0x9d47('0x6'));var config=require(_0x9d47('0x7'));module[_0x9d47('0x8')]=router; \ No newline at end of file +var _0x0529=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x0529,0xb6));var _0x9052=function(_0x4a6986,_0xfb44ce){_0x4a6986=_0x4a6986-0x0;var _0x11dc20=_0x0529[_0x4a6986];return _0x11dc20;};'use strict';var multer=require('multer');var util=require(_0x9052('0x0'));var path=require('path');var timeout=require(_0x9052('0x1'));var express=require(_0x9052('0x2'));var router=express['Router']();var auth=require(_0x9052('0x3'));var interaction=require(_0x9052('0x4'));var config=require(_0x9052('0x5'));module[_0x9052('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3ec6d48..0a6d8f5 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 _0x6db1=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x5f1aae,_0x2ce300){var _0x310f49=function(_0x97f3bb){while(--_0x97f3bb){_0x5f1aae['push'](_0x5f1aae['shift']());}};_0x310f49(++_0x2ce300);}(_0x6db1,0x128));var _0x16db=function(_0x471c21,_0x3de07e){_0x471c21=_0x471c21-0x0;var _0x3df323=_0x6db1[_0x471c21];return _0x3df323;};'use strict';var Sequelize=require(_0x16db('0x0'));module[_0x16db('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x16db('0x2')],'allowNull':![],'unique':_0x16db('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x16db('0x4')},'filename':{'type':Sequelize[_0x16db('0x2')]},'path':{'type':Sequelize[_0x16db('0x2')]},'type':{'type':Sequelize[_0x16db('0x2')]},'size':{'type':Sequelize[_0x16db('0x5')]},'active':{'type':Sequelize[_0x16db('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x16db('0x2')]},'logo':{'type':Sequelize[_0x16db('0x2')]},'state':{'type':Sequelize[_0x16db('0x2')],'unique':_0x16db('0x7')},'description':{'type':Sequelize[_0x16db('0x2')]},'title':{'type':Sequelize[_0x16db('0x2')]},'remoteUri':{'type':Sequelize[_0x16db('0x2')]},'link':{'type':Sequelize[_0x16db('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x48d1=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports'];(function(_0x2ced73,_0x3ec05c){var _0x316e99=function(_0x422dae){while(--_0x422dae){_0x2ced73['push'](_0x2ced73['shift']());}};_0x316e99(++_0x3ec05c);}(_0x48d1,0x187));var _0x148d=function(_0x8014ea,_0x133292){_0x8014ea=_0x8014ea-0x0;var _0x26f9f8=_0x48d1[_0x8014ea];return _0x26f9f8;};'use strict';var Sequelize=require('sequelize');module[_0x148d('0x0')]={'name':{'type':Sequelize[_0x148d('0x1')],'allowNull':![],'unique':_0x148d('0x2')},'version':{'type':Sequelize[_0x148d('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x148d('0x1')],'defaultValue':_0x148d('0x3')},'filename':{'type':Sequelize[_0x148d('0x1')]},'path':{'type':Sequelize[_0x148d('0x1')]},'type':{'type':Sequelize[_0x148d('0x1')]},'size':{'type':Sequelize[_0x148d('0x4')]},'active':{'type':Sequelize[_0x148d('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x148d('0x1')]},'logo':{'type':Sequelize[_0x148d('0x1')]},'state':{'type':Sequelize[_0x148d('0x1')],'unique':_0x148d('0x6')},'description':{'type':Sequelize[_0x148d('0x1')]},'title':{'type':Sequelize[_0x148d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x148d('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0eaf6cd..1b1093f 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 _0x2ae0=['destroy','then','error','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Integration','findAll','catch','show','params','length','find','create','body','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','save','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2ae0,0x137));var _0x02ae=function(_0x86e23c,_0x5c6ba0){_0x86e23c=_0x86e23c-0x0;var _0x26a8a6=_0x2ae0[_0x86e23c];return _0x26a8a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x02ae('0x0'));var zipdir=require(_0x02ae('0x1'));var jsonpatch=require(_0x02ae('0x2'));var rp=require('request-promise');var moment=require(_0x02ae('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x02ae('0x4'));var path=require(_0x02ae('0x5'));var sox=require(_0x02ae('0x6'));var csv=require('to-csv');var ejs=require(_0x02ae('0x7'));var fs=require('fs');var _=require(_0x02ae('0x8'));var squel=require(_0x02ae('0x9'));var crypto=require(_0x02ae('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x02ae('0xb'));var querystring=require(_0x02ae('0xc'));var Papa=require(_0x02ae('0xd'));var Redis=require('ioredis');var authService=require(_0x02ae('0xe'));var qs=require(_0x02ae('0xf'));var as=require(_0x02ae('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x02ae('0x11'));var utils=require('../../config/utils');var config=require(_0x02ae('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20897d,_0x4d617e){_0x4d617e=_0x4d617e||0xcc;return function(_0x40d76a){if(_0x40d76a){return _0x20897d['sendStatus'](_0x4d617e);}return _0x20897d[_0x02ae('0x13')](_0x4d617e)[_0x02ae('0x14')]();};}function respondWithResult(_0x457334,_0x4d4d31){_0x4d4d31=_0x4d4d31||0xc8;return function(_0x428ae7){if(_0x428ae7){return _0x457334[_0x02ae('0x13')](_0x4d4d31)[_0x02ae('0x15')](_0x428ae7);}};}function respondWithFilteredResult(_0x325430,_0x42cc66){return function(_0x265ebf){if(_0x265ebf){var _0x4a5331=_0x265ebf[_0x02ae('0x16')],_0x5305ec=_0x42cc66[_0x02ae('0x17')],_0x6a66a1=_0x42cc66[_0x02ae('0x17')]+_0x42cc66[_0x02ae('0x18')],_0x4000cd;if(_0x6a66a1>=_0x4a5331){_0x6a66a1=_0x4a5331;_0x4000cd=0xc8;}else{_0x4000cd=0xce;}_0x325430[_0x02ae('0x13')](_0x4000cd);return _0x325430['set'](_0x02ae('0x19'),_0x5305ec+'-'+_0x6a66a1+'/'+_0x4a5331)[_0x02ae('0x15')](_0x265ebf);}return null;};}function patchUpdates(_0x2ceda0){return function(_0x3d7227){try{jsonpatch[_0x02ae('0x1a')](_0x3d7227,_0x2ceda0,!![]);}catch(_0x57e15b){return BPromise['reject'](_0x57e15b);}return _0x3d7227[_0x02ae('0x1b')]();};}function saveUpdates(_0x247e67,_0x51e369){return function(_0x9bed75){if(_0x9bed75){return _0x9bed75[_0x02ae('0x1c')](_0x247e67)['then'](function(_0x474ca5){return _0x474ca5;});}return null;};}function removeEntity(_0x5e14b2,_0x7f54fc){return function(_0x2fa49d){if(_0x2fa49d){return _0x2fa49d[_0x02ae('0x1d')]()[_0x02ae('0x1e')](function(){_0x5e14b2[_0x02ae('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bc12,_0x3f6e7c){return function(_0x50420){if(!_0x50420){_0x47bc12['sendStatus'](0x194);}return _0x50420;};}function handleError(_0x1f8c35,_0xbd1d40){_0xbd1d40=_0xbd1d40||0x1f4;return function(_0x570157){logger[_0x02ae('0x1f')](_0x570157[_0x02ae('0x20')]);if(_0x570157['name']){delete _0x570157['name'];}_0x1f8c35[_0x02ae('0x13')](_0xbd1d40)['send'](_0x570157);};}exports[_0x02ae('0x21')]=function(_0x509e03,_0x2e6753){var _0x25d688={},_0x3f28f1={},_0x58e08d={'count':0x0,'rows':[]};var _0x23ab7b=_[_0x02ae('0x22')](db['Integration'][_0x02ae('0x23')],function(_0x5d2404){return{'name':_0x5d2404[_0x02ae('0x24')],'type':_0x5d2404[_0x02ae('0x25')][_0x02ae('0x26')]};});_0x3f28f1[_0x02ae('0x27')]=_['map'](_0x23ab7b,_0x02ae('0x28'));_0x3f28f1[_0x02ae('0x29')]=_[_0x02ae('0x2a')](_0x509e03[_0x02ae('0x29')]);_0x3f28f1[_0x02ae('0x2b')]=_[_0x02ae('0x2c')](_0x3f28f1[_0x02ae('0x27')],_0x3f28f1['query']);_0x25d688[_0x02ae('0x2d')]=_[_0x02ae('0x2c')](_0x3f28f1[_0x02ae('0x27')],qs[_0x02ae('0x2e')](_0x509e03[_0x02ae('0x29')][_0x02ae('0x2e')]));_0x25d688[_0x02ae('0x2d')]=_0x25d688[_0x02ae('0x2d')]['length']?_0x25d688[_0x02ae('0x2d')]:_0x3f28f1[_0x02ae('0x27')];if(!_0x509e03[_0x02ae('0x29')][_0x02ae('0x2f')](_0x02ae('0x30'))){_0x25d688[_0x02ae('0x18')]=qs[_0x02ae('0x18')](_0x509e03[_0x02ae('0x29')]['limit']);_0x25d688[_0x02ae('0x17')]=qs[_0x02ae('0x17')](_0x509e03[_0x02ae('0x29')]['offset']);}_0x25d688[_0x02ae('0x31')]=qs[_0x02ae('0x32')](_0x509e03[_0x02ae('0x29')]['sort']);_0x25d688[_0x02ae('0x33')]=qs['filters'](_[_0x02ae('0x34')](_0x509e03[_0x02ae('0x29')],_0x3f28f1[_0x02ae('0x2b')]),_0x23ab7b);if(_0x509e03[_0x02ae('0x29')][_0x02ae('0x35')]){_0x25d688[_0x02ae('0x33')]=_[_0x02ae('0x36')](_0x25d688[_0x02ae('0x33')],{'$or':_[_0x02ae('0x22')](_0x23ab7b,function(_0x15c13d){if(_0x15c13d[_0x02ae('0x25')]!==_0x02ae('0x37')){var _0x297230={};_0x297230[_0x15c13d['name']]={'$like':'%'+_0x509e03[_0x02ae('0x29')][_0x02ae('0x35')]+'%'};return _0x297230;}})});}_0x25d688=_[_0x02ae('0x36')]({},_0x25d688,_0x509e03[_0x02ae('0x38')]);var _0x40abbb={'where':_0x25d688['where']};return db['Integration']['count'](_0x40abbb)[_0x02ae('0x1e')](function(_0x5146e2){_0x58e08d[_0x02ae('0x16')]=_0x5146e2;if(_0x509e03[_0x02ae('0x29')][_0x02ae('0x39')]){_0x25d688[_0x02ae('0x3a')]=[{'all':!![]}];}return db[_0x02ae('0x3b')][_0x02ae('0x3c')](_0x25d688);})[_0x02ae('0x1e')](function(_0x5c2f91){_0x58e08d['rows']=_0x5c2f91;return _0x58e08d;})[_0x02ae('0x1e')](respondWithFilteredResult(_0x2e6753,_0x25d688))[_0x02ae('0x3d')](handleError(_0x2e6753,null));};exports[_0x02ae('0x3e')]=function(_0xb0fc53,_0x57b6cb){var _0x1109dc={'raw':![],'where':{'id':_0xb0fc53[_0x02ae('0x3f')]['id']}},_0xe08b6d={};_0xe08b6d[_0x02ae('0x27')]=_[_0x02ae('0x2a')](db[_0x02ae('0x3b')][_0x02ae('0x23')]);_0xe08b6d[_0x02ae('0x29')]=_[_0x02ae('0x2a')](_0xb0fc53[_0x02ae('0x29')]);_0xe08b6d['filters']=_[_0x02ae('0x2c')](_0xe08b6d['model'],_0xe08b6d[_0x02ae('0x29')]);_0x1109dc['attributes']=_['intersection'](_0xe08b6d[_0x02ae('0x27')],qs[_0x02ae('0x2e')](_0xb0fc53['query'][_0x02ae('0x2e')]));_0x1109dc[_0x02ae('0x2d')]=_0x1109dc[_0x02ae('0x2d')][_0x02ae('0x40')]?_0x1109dc['attributes']:_0xe08b6d[_0x02ae('0x27')];if(_0xb0fc53['query']['includeAll']){_0x1109dc[_0x02ae('0x3a')]=[{'all':!![]}];}_0x1109dc=_[_0x02ae('0x36')]({},_0x1109dc,_0xb0fc53[_0x02ae('0x38')]);return db['Integration'][_0x02ae('0x41')](_0x1109dc)[_0x02ae('0x1e')](handleEntityNotFound(_0x57b6cb,null))[_0x02ae('0x1e')](respondWithResult(_0x57b6cb,null))[_0x02ae('0x3d')](handleError(_0x57b6cb,null));};exports[_0x02ae('0x42')]=function(_0xeb8a88,_0x1a2457){return db[_0x02ae('0x3b')][_0x02ae('0x42')](_0xeb8a88['body'],{})['then'](respondWithResult(_0x1a2457,0xc9))[_0x02ae('0x3d')](handleError(_0x1a2457,null));};exports[_0x02ae('0x1c')]=function(_0x5bb85d,_0x327543){if(_0x5bb85d[_0x02ae('0x43')]['id']){delete _0x5bb85d[_0x02ae('0x43')]['id'];}return db[_0x02ae('0x3b')][_0x02ae('0x41')]({'where':{'id':_0x5bb85d['params']['id']}})[_0x02ae('0x1e')](handleEntityNotFound(_0x327543,null))[_0x02ae('0x1e')](saveUpdates(_0x5bb85d[_0x02ae('0x43')],null))[_0x02ae('0x1e')](respondWithResult(_0x327543,null))[_0x02ae('0x3d')](handleError(_0x327543,null));};exports[_0x02ae('0x1d')]=function(_0x3aab5b,_0x186bd1){return db[_0x02ae('0x3b')]['find']({'where':{'id':_0x3aab5b['params']['id']}})['then'](handleEntityNotFound(_0x186bd1,null))['then'](removeEntity(_0x186bd1,null))[_0x02ae('0x3d')](handleError(_0x186bd1,null));}; \ No newline at end of file +var _0x4034=['includeAll','include','findAll','rows','show','params','keys','length','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','set','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','Integration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','filter','options','count'];(function(_0x3524f5,_0x3577d0){var _0x334fc5=function(_0x3b6f6e){while(--_0x3b6f6e){_0x3524f5['push'](_0x3524f5['shift']());}};_0x334fc5(++_0x3577d0);}(_0x4034,0x166));var _0x4403=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x4034[_0xd13a88];return _0x1c993c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4403('0x0'));var rimraf=require(_0x4403('0x1'));var zipdir=require(_0x4403('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4403('0x3'));var moment=require('moment');var BPromise=require(_0x4403('0x4'));var Mustache=require(_0x4403('0x5'));var util=require('util');var path=require(_0x4403('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4403('0x7'));var squel=require('squel');var crypto=require(_0x4403('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4403('0x9'));var Redis=require(_0x4403('0xa'));var authService=require(_0x4403('0xb'));var qs=require(_0x4403('0xc'));var as=require(_0x4403('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4403('0xe'))(_0x4403('0xf'));var utils=require(_0x4403('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4403('0x11'));var db=require(_0x4403('0x12'))['db'];function respondWithStatusCode(_0x461d33,_0x309153){_0x309153=_0x309153||0xcc;return function(_0x1309d8){if(_0x1309d8){return _0x461d33['sendStatus'](_0x309153);}return _0x461d33[_0x4403('0x13')](_0x309153)['end']();};}function respondWithResult(_0x3b940d,_0x124ac6){_0x124ac6=_0x124ac6||0xc8;return function(_0x4f7d51){if(_0x4f7d51){return _0x3b940d[_0x4403('0x13')](_0x124ac6)[_0x4403('0x14')](_0x4f7d51);}};}function respondWithFilteredResult(_0x26b124,_0x34036c){return function(_0x339b67){if(_0x339b67){var _0xee64a6=_0x339b67['count'],_0x1086fb=_0x34036c[_0x4403('0x15')],_0x1a247b=_0x34036c[_0x4403('0x15')]+_0x34036c['limit'],_0x5db8df;if(_0x1a247b>=_0xee64a6){_0x1a247b=_0xee64a6;_0x5db8df=0xc8;}else{_0x5db8df=0xce;}_0x26b124[_0x4403('0x13')](_0x5db8df);return _0x26b124[_0x4403('0x16')]('Content-Range',_0x1086fb+'-'+_0x1a247b+'/'+_0xee64a6)['json'](_0x339b67);}return null;};}function patchUpdates(_0x1eb151){return function(_0x50aa92){try{jsonpatch[_0x4403('0x17')](_0x50aa92,_0x1eb151,!![]);}catch(_0x275d33){return BPromise[_0x4403('0x18')](_0x275d33);}return _0x50aa92['save']();};}function saveUpdates(_0x13c664,_0x2550f8){return function(_0x4d5fda){if(_0x4d5fda){return _0x4d5fda[_0x4403('0x19')](_0x13c664)['then'](function(_0x3f4b0b){return _0x3f4b0b;});}return null;};}function removeEntity(_0x1da2e5,_0x382ed7){return function(_0x11f975){if(_0x11f975){return _0x11f975[_0x4403('0x1a')]()[_0x4403('0x1b')](function(){_0x1da2e5['status'](0xcc)[_0x4403('0x1c')]();});}};}function handleEntityNotFound(_0x34a5e9,_0x2f8f91){return function(_0x1c549a){if(!_0x1c549a){_0x34a5e9[_0x4403('0x1d')](0x194);}return _0x1c549a;};}function handleError(_0x3e037d,_0x488deb){_0x488deb=_0x488deb||0x1f4;return function(_0x5e4e60){logger[_0x4403('0x1e')](_0x5e4e60[_0x4403('0x1f')]);if(_0x5e4e60[_0x4403('0x20')]){delete _0x5e4e60['name'];}_0x3e037d[_0x4403('0x13')](_0x488deb)['send'](_0x5e4e60);};}exports['index']=function(_0x5ccf50,_0x4df4a0){var _0x4ef7a6={},_0x3d6c96={},_0x5998c6={'count':0x0,'rows':[]};var _0x5ba688=_['map'](db[_0x4403('0x21')][_0x4403('0x22')],function(_0x36307d){return{'name':_0x36307d[_0x4403('0x23')],'type':_0x36307d['type'][_0x4403('0x24')]};});_0x3d6c96[_0x4403('0x25')]=_[_0x4403('0x26')](_0x5ba688,_0x4403('0x20'));_0x3d6c96[_0x4403('0x27')]=_['keys'](_0x5ccf50['query']);_0x3d6c96[_0x4403('0x28')]=_[_0x4403('0x29')](_0x3d6c96[_0x4403('0x25')],_0x3d6c96[_0x4403('0x27')]);_0x4ef7a6[_0x4403('0x2a')]=_['intersection'](_0x3d6c96['model'],qs['fields'](_0x5ccf50[_0x4403('0x27')][_0x4403('0x2b')]));_0x4ef7a6[_0x4403('0x2a')]=_0x4ef7a6[_0x4403('0x2a')]['length']?_0x4ef7a6[_0x4403('0x2a')]:_0x3d6c96['model'];if(!_0x5ccf50[_0x4403('0x27')][_0x4403('0x2c')](_0x4403('0x2d'))){_0x4ef7a6[_0x4403('0x2e')]=qs[_0x4403('0x2e')](_0x5ccf50[_0x4403('0x27')]['limit']);_0x4ef7a6[_0x4403('0x15')]=qs[_0x4403('0x15')](_0x5ccf50[_0x4403('0x27')][_0x4403('0x15')]);}_0x4ef7a6[_0x4403('0x2f')]=qs['sort'](_0x5ccf50[_0x4403('0x27')][_0x4403('0x30')]);_0x4ef7a6[_0x4403('0x31')]=qs[_0x4403('0x28')](_[_0x4403('0x32')](_0x5ccf50[_0x4403('0x27')],_0x3d6c96[_0x4403('0x28')]),_0x5ba688);if(_0x5ccf50[_0x4403('0x27')]['filter']){_0x4ef7a6[_0x4403('0x31')]=_['merge'](_0x4ef7a6[_0x4403('0x31')],{'$or':_[_0x4403('0x26')](_0x5ba688,function(_0x4b4518){if(_0x4b4518[_0x4403('0x33')]!==_0x4403('0x34')){var _0x388f7d={};_0x388f7d[_0x4b4518[_0x4403('0x20')]]={'$like':'%'+_0x5ccf50['query'][_0x4403('0x35')]+'%'};return _0x388f7d;}})});}_0x4ef7a6=_['merge']({},_0x4ef7a6,_0x5ccf50[_0x4403('0x36')]);var _0x5e51d4={'where':_0x4ef7a6[_0x4403('0x31')]};return db[_0x4403('0x21')][_0x4403('0x37')](_0x5e51d4)['then'](function(_0xd523c0){_0x5998c6[_0x4403('0x37')]=_0xd523c0;if(_0x5ccf50[_0x4403('0x27')][_0x4403('0x38')]){_0x4ef7a6[_0x4403('0x39')]=[{'all':!![]}];}return db['Integration'][_0x4403('0x3a')](_0x4ef7a6);})[_0x4403('0x1b')](function(_0x336057){_0x5998c6[_0x4403('0x3b')]=_0x336057;return _0x5998c6;})[_0x4403('0x1b')](respondWithFilteredResult(_0x4df4a0,_0x4ef7a6))['catch'](handleError(_0x4df4a0,null));};exports[_0x4403('0x3c')]=function(_0x1250af,_0x215434){var _0x55485d={'raw':![],'where':{'id':_0x1250af[_0x4403('0x3d')]['id']}},_0x574b28={};_0x574b28[_0x4403('0x25')]=_[_0x4403('0x3e')](db['Integration']['rawAttributes']);_0x574b28['query']=_[_0x4403('0x3e')](_0x1250af['query']);_0x574b28['filters']=_[_0x4403('0x29')](_0x574b28[_0x4403('0x25')],_0x574b28['query']);_0x55485d['attributes']=_[_0x4403('0x29')](_0x574b28[_0x4403('0x25')],qs[_0x4403('0x2b')](_0x1250af['query'][_0x4403('0x2b')]));_0x55485d[_0x4403('0x2a')]=_0x55485d[_0x4403('0x2a')][_0x4403('0x3f')]?_0x55485d[_0x4403('0x2a')]:_0x574b28[_0x4403('0x25')];if(_0x1250af['query'][_0x4403('0x38')]){_0x55485d['include']=[{'all':!![]}];}_0x55485d=_[_0x4403('0x40')]({},_0x55485d,_0x1250af['options']);return db[_0x4403('0x21')][_0x4403('0x41')](_0x55485d)[_0x4403('0x1b')](handleEntityNotFound(_0x215434,null))[_0x4403('0x1b')](respondWithResult(_0x215434,null))[_0x4403('0x42')](handleError(_0x215434,null));};exports[_0x4403('0x43')]=function(_0x59a43b,_0x3cb9df){return db[_0x4403('0x21')][_0x4403('0x43')](_0x59a43b[_0x4403('0x44')],{})[_0x4403('0x1b')](respondWithResult(_0x3cb9df,0xc9))['catch'](handleError(_0x3cb9df,null));};exports['update']=function(_0x4dfe9d,_0x1dc5ac){if(_0x4dfe9d[_0x4403('0x44')]['id']){delete _0x4dfe9d['body']['id'];}return db[_0x4403('0x21')][_0x4403('0x41')]({'where':{'id':_0x4dfe9d['params']['id']}})[_0x4403('0x1b')](handleEntityNotFound(_0x1dc5ac,null))[_0x4403('0x1b')](saveUpdates(_0x4dfe9d[_0x4403('0x44')],null))['then'](respondWithResult(_0x1dc5ac,null))[_0x4403('0x42')](handleError(_0x1dc5ac,null));};exports[_0x4403('0x1a')]=function(_0x1f9f5c,_0x244d3b){return db[_0x4403('0x21')]['find']({'where':{'id':_0x1f9f5c['params']['id']}})[_0x4403('0x1b')](handleEntityNotFound(_0x244d3b,null))['then'](removeEntity(_0x244d3b,null))[_0x4403('0x42')](handleError(_0x244d3b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2b443f1..0ecae67 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 _0xb846=['define','Integration','integrations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xb846,0x16b));var _0x6b84=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb846[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x6b84('0x0'));var util=require(_0x6b84('0x1'));var logger=require('../../config/logger')(_0x6b84('0x2'));var moment=require(_0x6b84('0x3'));var BPromise=require(_0x6b84('0x4'));var rp=require(_0x6b84('0x5'));var fs=require('fs');var path=require(_0x6b84('0x6'));var rimraf=require(_0x6b84('0x7'));var config=require(_0x6b84('0x8'));var attributes=require('./integration.attributes');module['exports']=function(_0x5c0294,_0x2bb607){return _0x5c0294[_0x6b84('0x9')](_0x6b84('0xa'),attributes,{'tableName':_0x6b84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb91=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0xbb91,0x1c9));var _0x1bb9=function(_0x30f87a,_0x2cce5a){_0x30f87a=_0x30f87a-0x0;var _0x3a8efc=_0xbb91[_0x30f87a];return _0x3a8efc;};'use strict';var _=require(_0x1bb9('0x0'));var util=require(_0x1bb9('0x1'));var logger=require(_0x1bb9('0x2'))(_0x1bb9('0x3'));var moment=require('moment');var BPromise=require(_0x1bb9('0x4'));var rp=require(_0x1bb9('0x5'));var fs=require('fs');var path=require(_0x1bb9('0x6'));var rimraf=require(_0x1bb9('0x7'));var config=require(_0x1bb9('0x8'));var attributes=require(_0x1bb9('0x9'));module[_0x1bb9('0xa')]=function(_0x3c74ae,_0x49ccb1){return _0x3c74ae[_0x1bb9('0xb')](_0x1bb9('0xc'),attributes,{'tableName':_0x1bb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 9002c71..9520849 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 _0xd6d2=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x442301,_0x92f908){_0x442301=_0x442301-0x0;var _0x2616ca=_0xd6d2[_0x442301];return _0x2616ca;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var moment=require('moment');var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d6d('0x5'))(_0x2d6d('0x6'));var config=require(_0x2d6d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d6d('0x8')][_0x2d6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf59b20,_0x45b7b9,_0x4002b7){return new BPromise(function(_0x42d802,_0x1cab9b){return client[_0x2d6d('0xa')](_0xf59b20,_0x4002b7)[_0x2d6d('0xb')](function(_0x261959){logger[_0x2d6d('0xc')]('Integration,\x20%s,\x20%s',_0x45b7b9,_0x2d6d('0xd'));logger[_0x2d6d('0xe')](_0x2d6d('0xf'),_0x45b7b9,_0x2d6d('0xd'),JSON[_0x2d6d('0x10')](_0x261959));if(_0x261959['error']){if(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x12')]===0x1f4){logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959[_0x2d6d('0x11')]['message']);return _0x1cab9b(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x14')]);}logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959['error'][_0x2d6d('0x14')]);return _0x42d802(_0x261959[_0x2d6d('0x11')]['message']);}else{logger['info'](_0x2d6d('0x13'),_0x45b7b9,_0x2d6d('0xd'));_0x42d802(_0x261959[_0x2d6d('0x15')]['message']);}})[_0x2d6d('0x16')](function(_0x5b8d81){logger['error']('Integration,\x20%s,\x20%s',_0x45b7b9,_0x5b8d81);_0x1cab9b(_0x5b8d81);});});} \ No newline at end of file +var _0xfdcb=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xfdcb,0x134));var _0xbfdc=function(_0x3c27b6,_0x2192cb){_0x3c27b6=_0x3c27b6-0x0;var _0x2a5f55=_0xfdcb[_0x3c27b6];return _0x2a5f55;};'use strict';var _=require(_0xbfdc('0x0'));var util=require(_0xbfdc('0x1'));var moment=require(_0xbfdc('0x2'));var BPromise=require(_0xbfdc('0x3'));var rs=require(_0xbfdc('0x4'));var fs=require('fs');var Redis=require(_0xbfdc('0x5'));var db=require(_0xbfdc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbfdc('0x7'));var config=require(_0xbfdc('0x8'));var jayson=require(_0xbfdc('0x9'));var client=jayson['client'][_0xbfdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x875b31,_0x1c2a8f,_0x23778a){return new BPromise(function(_0x165e00,_0x3beab3){return client['request'](_0x875b31,_0x23778a)[_0xbfdc('0xb')](function(_0x23d964){logger[_0xbfdc('0xc')]('Integration,\x20%s,\x20%s',_0x1c2a8f,_0xbfdc('0xd'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x1c2a8f,'request\x20sent',JSON[_0xbfdc('0xe')](_0x23d964));if(_0x23d964[_0xbfdc('0xf')]){if(_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x10')]===0x1f4){logger['error'](_0xbfdc('0x11'),_0x1c2a8f,_0x23d964['error'][_0xbfdc('0x12')]);return _0x3beab3(_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x12')]);}logger[_0xbfdc('0xf')](_0xbfdc('0x11'),_0x1c2a8f,_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x12')]);return _0x165e00(_0x23d964[_0xbfdc('0xf')][_0xbfdc('0x12')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x1c2a8f,_0xbfdc('0xd'));_0x165e00(_0x23d964[_0xbfdc('0x13')][_0xbfdc('0x12')]);}})[_0xbfdc('0x14')](function(_0x15884d){logger[_0xbfdc('0xf')](_0xbfdc('0x11'),_0x1c2a8f,_0x15884d);_0x3beab3(_0x15884d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4db6238..895dd2b 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 _0x074a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','express','Router'];(function(_0x508835,_0x80e24b){var _0x5b8e84=function(_0x299554){while(--_0x299554){_0x508835['push'](_0x508835['shift']());}};_0x5b8e84(++_0x80e24b);}(_0x074a,0xe2));var _0xa074=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x074a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa074('0x0'));var util=require(_0xa074('0x1'));var path=require(_0xa074('0x2'));var timeout=require('connect-timeout');var express=require(_0xa074('0x3'));var router=express[_0xa074('0x4')]();var auth=require(_0xa074('0x5'));var interaction=require(_0xa074('0x6'));var config=require(_0xa074('0x7'));var controller=require(_0xa074('0x8'));router['get']('/',auth[_0xa074('0x9')](),controller[_0xa074('0xa')]);router[_0xa074('0xb')](_0xa074('0xc'),auth[_0xa074('0x9')](),controller[_0xa074('0xd')]);router['get'](_0xa074('0xe'),auth[_0xa074('0x9')](),controller[_0xa074('0xf')]);router[_0xa074('0x10')]('/',auth[_0xa074('0x9')](),controller[_0xa074('0x11')]);router[_0xa074('0x12')](_0xa074('0xe'),auth['isAuthenticated'](),controller[_0xa074('0x13')]);router['delete'](_0xa074('0xe'),auth[_0xa074('0x9')](),controller['destroy']);module[_0xa074('0x14')]=router; \ No newline at end of file +var _0x608b=['../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3f0440,_0x5d1a1e){var _0x9421f3=function(_0x3d7b0f){while(--_0x3d7b0f){_0x3f0440['push'](_0x3f0440['shift']());}};_0x9421f3(++_0x5d1a1e);}(_0x608b,0xa9));var _0xb608=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x608b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb608('0x0'));var util=require(_0xb608('0x1'));var path=require(_0xb608('0x2'));var timeout=require(_0xb608('0x3'));var express=require(_0xb608('0x4'));var router=express[_0xb608('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb608('0x6'));var config=require(_0xb608('0x7'));var controller=require('./integrationReport.controller');router[_0xb608('0x8')]('/',auth['isAuthenticated'](),controller[_0xb608('0x9')]);router[_0xb608('0x8')](_0xb608('0xa'),auth['isAuthenticated'](),controller[_0xb608('0xb')]);router[_0xb608('0x8')](_0xb608('0xc'),auth[_0xb608('0xd')](),controller[_0xb608('0xe')]);router[_0xb608('0xf')]('/',auth[_0xb608('0xd')](),controller[_0xb608('0x10')]);router[_0xb608('0x11')]('/:id',auth[_0xb608('0xd')](),controller[_0xb608('0x12')]);router[_0xb608('0x13')]('/:id',auth[_0xb608('0xd')](),controller[_0xb608('0x14')]);module[_0xb608('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 089bf28..b39b97c 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 _0xa5b3=['TEXT','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x185ddd,_0x255cda){var _0x3179dd=function(_0x1b0dc2){while(--_0x1b0dc2){_0x185ddd['push'](_0x185ddd['shift']());}};_0x3179dd(++_0x255cda);}(_0xa5b3,0x72));var _0x3a5b=function(_0x573050,_0x383dbe){_0x573050=_0x573050-0x0;var _0x39bdd2=_0xa5b3[_0x573050];return _0x39bdd2;};'use strict';var Sequelize=require(_0x3a5b('0x0'));module[_0x3a5b('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x3a5b('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3a5b('0x2')]},'integrationId':{'type':Sequelize[_0x3a5b('0x3')]},'contacts':{'type':Sequelize[_0x3a5b('0x2')]},'uniqueid':{'type':Sequelize[_0x3a5b('0x2')]},'calleridnum':{'type':Sequelize[_0x3a5b('0x2')]},'calleridname':{'type':Sequelize[_0x3a5b('0x2')]},'queue':{'type':Sequelize[_0x3a5b('0x2')]},'interface':{'type':Sequelize[_0x3a5b('0x2')]},'membername':{'type':Sequelize[_0x3a5b('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3a5b('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3a5b('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3a5b('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3a5b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3a5b('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x3a5b('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3a5b('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3a5b('0x4')]},'lastevent':{'type':Sequelize[_0x3a5b('0x2')]},'channel':{'type':Sequelize[_0x3a5b('0x2')]},'channelstate':{'type':Sequelize[_0x3a5b('0x3')]},'channelstatedesc':{'type':Sequelize[_0x3a5b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a5b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3a5b('0x2')]},'accountcode':{'type':Sequelize[_0x3a5b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3a5b('0x2')]},'priority':{'type':Sequelize[_0x3a5b('0x2')]},'destchannel':{'type':Sequelize[_0x3a5b('0x2')]},'destchannelstate':{'type':Sequelize[_0x3a5b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3a5b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3a5b('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3a5b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3a5b('0x2')]},'destlanguage':{'type':Sequelize[_0x3a5b('0x2')]},'destaccountcode':{'type':Sequelize[_0x3a5b('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3a5b('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3a5b('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x3a5b('0x2')]},'subject':{'type':Sequelize[_0x3a5b('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3a5b('0x2')]},'attachment':{'type':Sequelize[_0x3a5b('0x6')]},'html':{'type':Sequelize[_0x3a5b('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x3a5b('0x7'),_0x3a5b('0x8'),'RECEIVED',_0x3a5b('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3a5b('0x2')]},'projectId':{'type':Sequelize[_0x3a5b('0x3')]}}; \ No newline at end of file +var _0xb3b3=['ENUM','SENT','SENDING','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0xb3b3,0x1e0));var _0x3b3b=function(_0x3b3577,_0x4387e3){_0x3b3577=_0x3b3577-0x0;var _0x245826=_0xb3b3[_0x3b3577];return _0x245826;};'use strict';var Sequelize=require('sequelize');module[_0x3b3b('0x0')]={'integration':{'type':Sequelize[_0x3b3b('0x1')]},'eventChannel':{'type':Sequelize[_0x3b3b('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3b3b('0x1')]},'integrationId':{'type':Sequelize[_0x3b3b('0x2')]},'contacts':{'type':Sequelize[_0x3b3b('0x1')]},'uniqueid':{'type':Sequelize[_0x3b3b('0x1')]},'calleridnum':{'type':Sequelize[_0x3b3b('0x1')]},'calleridname':{'type':Sequelize[_0x3b3b('0x1')]},'queue':{'type':Sequelize[_0x3b3b('0x1')]},'interface':{'type':Sequelize[_0x3b3b('0x1')]},'membername':{'type':Sequelize[_0x3b3b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3b3b('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3b3b('0x3')]},'talktime':{'type':Sequelize[_0x3b3b('0x2')]},'agentacw':{'type':Sequelize[_0x3b3b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3b3b('0x2')]},'reason':{'type':Sequelize[_0x3b3b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x3b3b('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3b3b('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3b3b('0x3')]},'lastevent':{'type':Sequelize[_0x3b3b('0x1')]},'channel':{'type':Sequelize[_0x3b3b('0x1')]},'channelstate':{'type':Sequelize[_0x3b3b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3b3b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3b3b('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3b3b('0x1')]},'context':{'type':Sequelize[_0x3b3b('0x1')]},'exten':{'type':Sequelize[_0x3b3b('0x1')]},'priority':{'type':Sequelize[_0x3b3b('0x1')]},'destchannel':{'type':Sequelize[_0x3b3b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3b3b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3b3b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x3b3b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x3b3b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3b3b('0x1')]},'destlanguage':{'type':Sequelize[_0x3b3b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3b3b('0x1')]},'destcontext':{'type':Sequelize[_0x3b3b('0x1')]},'destexten':{'type':Sequelize[_0x3b3b('0x1')]},'destpriority':{'type':Sequelize[_0x3b3b('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x3b3b('0x1')]},'inReplyTo':{'type':Sequelize[_0x3b3b('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3b3b('0x1')]},'to':{'type':Sequelize[_0x3b3b('0x1')]},'cc':{'type':Sequelize[_0x3b3b('0x1')]},'attachment':{'type':Sequelize[_0x3b3b('0x5')]},'html':{'type':Sequelize[_0x3b3b('0x5')]},'text':{'type':Sequelize[_0x3b3b('0x5')]},'status':{'type':Sequelize[_0x3b3b('0x6')](_0x3b3b('0x7'),_0x3b3b('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x3b3b('0x1')]},'app':{'type':Sequelize[_0x3b3b('0x1')]},'appdata':{'type':Sequelize[_0x3b3b('0x1')]},'projectId':{'type':Sequelize[_0x3b3b('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0493e0d..f2b063c 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 _0xe377=['sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','keys','include','find','create','params','body','describe','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x234f95,_0x3dd669){var _0x160058=function(_0x3d1f3f){while(--_0x3d1f3f){_0x234f95['push'](_0x234f95['shift']());}};_0x160058(++_0x3dd669);}(_0xe377,0x1e2));var _0x7e37=function(_0xd1becf,_0x2bdf36){_0xd1becf=_0xd1becf-0x0;var _0x3eed49=_0xe377[_0xd1becf];return _0x3eed49;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7e37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e37('0x1'));var moment=require('moment');var BPromise=require(_0x7e37('0x2'));var Mustache=require(_0x7e37('0x3'));var util=require('util');var path=require(_0x7e37('0x4'));var sox=require(_0x7e37('0x5'));var csv=require(_0x7e37('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e37('0x7'));var squel=require(_0x7e37('0x8'));var crypto=require(_0x7e37('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7e37('0xa'));var toCsv=require(_0x7e37('0x6'));var querystring=require(_0x7e37('0xb'));var Papa=require(_0x7e37('0xc'));var Redis=require(_0x7e37('0xd'));var authService=require(_0x7e37('0xe'));var qs=require(_0x7e37('0xf'));var as=require(_0x7e37('0x10'));var hardwareService=require(_0x7e37('0x11'));var logger=require(_0x7e37('0x12'))(_0x7e37('0x13'));var utils=require('../../config/utils');var config=require(_0x7e37('0x14'));var licenseUtil=require(_0x7e37('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e332d,_0xef069e){_0xef069e=_0xef069e||0xcc;return function(_0xad4ff7){if(_0xad4ff7){return _0x2e332d[_0x7e37('0x16')](_0xef069e);}return _0x2e332d[_0x7e37('0x17')](_0xef069e)[_0x7e37('0x18')]();};}function respondWithResult(_0x49c0cc,_0x5aa45c){_0x5aa45c=_0x5aa45c||0xc8;return function(_0x1c7dab){if(_0x1c7dab){return _0x49c0cc[_0x7e37('0x17')](_0x5aa45c)[_0x7e37('0x19')](_0x1c7dab);}};}function respondWithFilteredResult(_0x47227c,_0x819906){return function(_0x20bc27){if(_0x20bc27){var _0x2d8355=_0x20bc27[_0x7e37('0x1a')],_0x400202=_0x819906['offset'],_0x26c17e=_0x819906[_0x7e37('0x1b')]+_0x819906['limit'],_0x39760c;if(_0x26c17e>=_0x2d8355){_0x26c17e=_0x2d8355;_0x39760c=0xc8;}else{_0x39760c=0xce;}_0x47227c[_0x7e37('0x17')](_0x39760c);return _0x47227c['set'](_0x7e37('0x1c'),_0x400202+'-'+_0x26c17e+'/'+_0x2d8355)['json'](_0x20bc27);}return null;};}function patchUpdates(_0x5db406){return function(_0x51a619){try{jsonpatch[_0x7e37('0x1d')](_0x51a619,_0x5db406,!![]);}catch(_0x3a6ac2){return BPromise[_0x7e37('0x1e')](_0x3a6ac2);}return _0x51a619[_0x7e37('0x1f')]();};}function saveUpdates(_0x3be13f,_0x222b24){return function(_0x40c0b8){if(_0x40c0b8){return _0x40c0b8[_0x7e37('0x20')](_0x3be13f)['then'](function(_0x457e74){return _0x457e74;});}return null;};}function removeEntity(_0x224347,_0x1ea207){return function(_0x12443a){if(_0x12443a){return _0x12443a[_0x7e37('0x21')]()[_0x7e37('0x22')](function(){_0x224347[_0x7e37('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aec67,_0x2741d8){return function(_0x77dd9c){if(!_0x77dd9c){_0x1aec67[_0x7e37('0x16')](0x194);}return _0x77dd9c;};}function handleError(_0x1ffad3,_0x5ce23e){_0x5ce23e=_0x5ce23e||0x1f4;return function(_0x56093d){logger[_0x7e37('0x23')](_0x56093d[_0x7e37('0x24')]);if(_0x56093d[_0x7e37('0x25')]){delete _0x56093d['name'];}_0x1ffad3[_0x7e37('0x17')](_0x5ce23e)[_0x7e37('0x26')](_0x56093d);};}exports['index']=function(_0x358073,_0x21f8cc){var _0x1ffcef={},_0x2f0e0d={},_0x4a8f1d={'count':0x0,'rows':[]};var _0x2cf58c=_[_0x7e37('0x27')](db[_0x7e37('0x28')][_0x7e37('0x29')],function(_0x33d18a){return{'name':_0x33d18a[_0x7e37('0x2a')],'type':_0x33d18a[_0x7e37('0x2b')][_0x7e37('0x2c')]};});_0x2f0e0d[_0x7e37('0x2d')]=_[_0x7e37('0x27')](_0x2cf58c,_0x7e37('0x25'));_0x2f0e0d[_0x7e37('0x2e')]=_['keys'](_0x358073[_0x7e37('0x2e')]);_0x2f0e0d[_0x7e37('0x2f')]=_[_0x7e37('0x30')](_0x2f0e0d[_0x7e37('0x2d')],_0x2f0e0d[_0x7e37('0x2e')]);_0x1ffcef[_0x7e37('0x31')]=_[_0x7e37('0x30')](_0x2f0e0d['model'],qs[_0x7e37('0x32')](_0x358073['query'][_0x7e37('0x32')]));_0x1ffcef['attributes']=_0x1ffcef[_0x7e37('0x31')][_0x7e37('0x33')]?_0x1ffcef[_0x7e37('0x31')]:_0x2f0e0d[_0x7e37('0x2d')];if(!_0x358073[_0x7e37('0x2e')][_0x7e37('0x34')](_0x7e37('0x35'))){_0x1ffcef[_0x7e37('0x36')]=qs[_0x7e37('0x36')](_0x358073[_0x7e37('0x2e')][_0x7e37('0x36')]);_0x1ffcef[_0x7e37('0x1b')]=qs[_0x7e37('0x1b')](_0x358073['query'][_0x7e37('0x1b')]);}_0x1ffcef[_0x7e37('0x37')]=qs[_0x7e37('0x38')](_0x358073['query']['sort']);_0x1ffcef['where']=qs['filters'](_['pick'](_0x358073['query'],_0x2f0e0d[_0x7e37('0x2f')]),_0x2cf58c);if(_0x358073['query'][_0x7e37('0x39')]){_0x1ffcef[_0x7e37('0x3a')]=_[_0x7e37('0x3b')](_0x1ffcef[_0x7e37('0x3a')],{'$or':_[_0x7e37('0x27')](_0x2cf58c,function(_0x13cd36){if(_0x13cd36[_0x7e37('0x2b')]!==_0x7e37('0x3c')){var _0x34bcea={};_0x34bcea[_0x13cd36[_0x7e37('0x25')]]={'$like':'%'+_0x358073[_0x7e37('0x2e')][_0x7e37('0x39')]+'%'};return _0x34bcea;}})});}_0x1ffcef=_['merge']({},_0x1ffcef,_0x358073['options']);var _0x5b9633={'where':_0x1ffcef[_0x7e37('0x3a')]};return db[_0x7e37('0x28')]['count'](_0x5b9633)[_0x7e37('0x22')](function(_0x2edd0a){_0x4a8f1d[_0x7e37('0x1a')]=_0x2edd0a;if(_0x358073[_0x7e37('0x2e')][_0x7e37('0x3d')]){_0x1ffcef['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x1ffcef);})['then'](function(_0x24b960){_0x4a8f1d[_0x7e37('0x3e')]=_0x24b960;return _0x4a8f1d;})[_0x7e37('0x22')](respondWithFilteredResult(_0x21f8cc,_0x1ffcef))[_0x7e37('0x3f')](handleError(_0x21f8cc,null));};exports[_0x7e37('0x40')]=function(_0x26e264,_0x6c18c5){var _0x44658c={'raw':![],'where':{'id':_0x26e264['params']['id']}},_0x412b2e={};_0x412b2e[_0x7e37('0x2d')]=_[_0x7e37('0x41')](db[_0x7e37('0x28')]['rawAttributes']);_0x412b2e['query']=_['keys'](_0x26e264[_0x7e37('0x2e')]);_0x412b2e[_0x7e37('0x2f')]=_[_0x7e37('0x30')](_0x412b2e['model'],_0x412b2e[_0x7e37('0x2e')]);_0x44658c[_0x7e37('0x31')]=_[_0x7e37('0x30')](_0x412b2e['model'],qs['fields'](_0x26e264[_0x7e37('0x2e')][_0x7e37('0x32')]));_0x44658c['attributes']=_0x44658c['attributes'][_0x7e37('0x33')]?_0x44658c['attributes']:_0x412b2e[_0x7e37('0x2d')];if(_0x26e264[_0x7e37('0x2e')][_0x7e37('0x3d')]){_0x44658c[_0x7e37('0x42')]=[{'all':!![]}];}_0x44658c=_[_0x7e37('0x3b')]({},_0x44658c,_0x26e264['options']);return db[_0x7e37('0x28')][_0x7e37('0x43')](_0x44658c)[_0x7e37('0x22')](handleEntityNotFound(_0x6c18c5,null))[_0x7e37('0x22')](respondWithResult(_0x6c18c5,null))[_0x7e37('0x3f')](handleError(_0x6c18c5,null));};exports['create']=function(_0x48fc69,_0x1a065c){return db['IntegrationReport'][_0x7e37('0x44')](_0x48fc69['body'],{})[_0x7e37('0x22')](respondWithResult(_0x1a065c,0xc9))['catch'](handleError(_0x1a065c,null));};exports[_0x7e37('0x20')]=function(_0x55d71f,_0x5b94c0){if(_0x55d71f['body']['id']){delete _0x55d71f['body']['id'];}return db[_0x7e37('0x28')][_0x7e37('0x43')]({'where':{'id':_0x55d71f[_0x7e37('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b94c0,null))['then'](saveUpdates(_0x55d71f[_0x7e37('0x46')],null))['then'](respondWithResult(_0x5b94c0,null))['catch'](handleError(_0x5b94c0,null));};exports['destroy']=function(_0x33febf,_0x4ae87c){return db[_0x7e37('0x28')][_0x7e37('0x43')]({'where':{'id':_0x33febf[_0x7e37('0x45')]['id']}})[_0x7e37('0x22')](handleEntityNotFound(_0x4ae87c,null))['then'](removeEntity(_0x4ae87c,null))[_0x7e37('0x3f')](handleError(_0x4ae87c,null));};exports[_0x7e37('0x47')]=function(_0x4e34be,_0x565886){return db[_0x7e37('0x28')][_0x7e37('0x47')]()['then'](respondWithResult(_0x565886,null))[_0x7e37('0x3f')](handleError(_0x565886,null));}; \ No newline at end of file +var _0xbf6c=['squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','apply','reject','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','rows','catch','show','params','keys','includeAll','include','find','create','update','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash'];(function(_0x52de48,_0x5bc748){var _0x18f4c0=function(_0x44459e){while(--_0x44459e){_0x52de48['push'](_0x52de48['shift']());}};_0x18f4c0(++_0x5bc748);}(_0xbf6c,0x164));var _0xcbf6=function(_0x383072,_0x516994){_0x383072=_0x383072-0x0;var _0x15f04e=_0xbf6c[_0x383072];return _0x15f04e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcbf6('0x0'));var jsonpatch=require(_0xcbf6('0x1'));var rp=require(_0xcbf6('0x2'));var moment=require('moment');var BPromise=require(_0xcbf6('0x3'));var Mustache=require('mustache');var util=require(_0xcbf6('0x4'));var path=require(_0xcbf6('0x5'));var sox=require('sox');var csv=require(_0xcbf6('0x6'));var ejs=require(_0xcbf6('0x7'));var fs=require('fs');var _=require(_0xcbf6('0x8'));var squel=require(_0xcbf6('0x9'));var crypto=require(_0xcbf6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcbf6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcbf6('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcbf6('0xd'));var qs=require(_0xcbf6('0xe'));var as=require(_0xcbf6('0xf'));var hardwareService=require(_0xcbf6('0x10'));var logger=require(_0xcbf6('0x11'))('api');var utils=require(_0xcbf6('0x12'));var config=require(_0xcbf6('0x13'));var licenseUtil=require(_0xcbf6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55a193,_0x393a7b){_0x393a7b=_0x393a7b||0xcc;return function(_0x134d94){if(_0x134d94){return _0x55a193[_0xcbf6('0x15')](_0x393a7b);}return _0x55a193[_0xcbf6('0x16')](_0x393a7b)[_0xcbf6('0x17')]();};}function respondWithResult(_0x1d8bcf,_0xcac9f2){_0xcac9f2=_0xcac9f2||0xc8;return function(_0x42e322){if(_0x42e322){return _0x1d8bcf['status'](_0xcac9f2)[_0xcbf6('0x18')](_0x42e322);}};}function respondWithFilteredResult(_0x317f03,_0xee83e1){return function(_0xb53e17){if(_0xb53e17){var _0x2d5485=_0xb53e17['count'],_0x23a7e2=_0xee83e1[_0xcbf6('0x19')],_0x8629dd=_0xee83e1[_0xcbf6('0x19')]+_0xee83e1['limit'],_0x368637;if(_0x8629dd>=_0x2d5485){_0x8629dd=_0x2d5485;_0x368637=0xc8;}else{_0x368637=0xce;}_0x317f03[_0xcbf6('0x16')](_0x368637);return _0x317f03[_0xcbf6('0x1a')]('Content-Range',_0x23a7e2+'-'+_0x8629dd+'/'+_0x2d5485)['json'](_0xb53e17);}return null;};}function patchUpdates(_0x3c1823){return function(_0x2242ae){try{jsonpatch[_0xcbf6('0x1b')](_0x2242ae,_0x3c1823,!![]);}catch(_0x4d8a5b){return BPromise[_0xcbf6('0x1c')](_0x4d8a5b);}return _0x2242ae['save']();};}function saveUpdates(_0x219567,_0x321061){return function(_0x2151d9){if(_0x2151d9){return _0x2151d9['update'](_0x219567)[_0xcbf6('0x1d')](function(_0x11b788){return _0x11b788;});}return null;};}function removeEntity(_0x5e8f02,_0x29e1f1){return function(_0x546f15){if(_0x546f15){return _0x546f15[_0xcbf6('0x1e')]()[_0xcbf6('0x1d')](function(){_0x5e8f02['status'](0xcc)[_0xcbf6('0x17')]();});}};}function handleEntityNotFound(_0x4f774d,_0x182417){return function(_0x2f5b20){if(!_0x2f5b20){_0x4f774d['sendStatus'](0x194);}return _0x2f5b20;};}function handleError(_0x3fc059,_0x1c14e8){_0x1c14e8=_0x1c14e8||0x1f4;return function(_0x56d75c){logger[_0xcbf6('0x1f')](_0x56d75c[_0xcbf6('0x20')]);if(_0x56d75c[_0xcbf6('0x21')]){delete _0x56d75c['name'];}_0x3fc059['status'](_0x1c14e8)[_0xcbf6('0x22')](_0x56d75c);};}exports[_0xcbf6('0x23')]=function(_0x58257a,_0x1a37fc){var _0x5d6068={},_0x1d9bbb={},_0x58cdd0={'count':0x0,'rows':[]};var _0x24c1e5=_[_0xcbf6('0x24')](db[_0xcbf6('0x25')][_0xcbf6('0x26')],function(_0x2f3936){return{'name':_0x2f3936[_0xcbf6('0x27')],'type':_0x2f3936[_0xcbf6('0x28')][_0xcbf6('0x29')]};});_0x1d9bbb[_0xcbf6('0x2a')]=_['map'](_0x24c1e5,'name');_0x1d9bbb['query']=_['keys'](_0x58257a[_0xcbf6('0x2b')]);_0x1d9bbb['filters']=_[_0xcbf6('0x2c')](_0x1d9bbb[_0xcbf6('0x2a')],_0x1d9bbb['query']);_0x5d6068[_0xcbf6('0x2d')]=_[_0xcbf6('0x2c')](_0x1d9bbb[_0xcbf6('0x2a')],qs[_0xcbf6('0x2e')](_0x58257a[_0xcbf6('0x2b')]['fields']));_0x5d6068[_0xcbf6('0x2d')]=_0x5d6068['attributes'][_0xcbf6('0x2f')]?_0x5d6068[_0xcbf6('0x2d')]:_0x1d9bbb[_0xcbf6('0x2a')];if(!_0x58257a['query'][_0xcbf6('0x30')](_0xcbf6('0x31'))){_0x5d6068[_0xcbf6('0x32')]=qs[_0xcbf6('0x32')](_0x58257a[_0xcbf6('0x2b')][_0xcbf6('0x32')]);_0x5d6068[_0xcbf6('0x19')]=qs[_0xcbf6('0x19')](_0x58257a[_0xcbf6('0x2b')]['offset']);}_0x5d6068[_0xcbf6('0x33')]=qs[_0xcbf6('0x34')](_0x58257a[_0xcbf6('0x2b')][_0xcbf6('0x34')]);_0x5d6068[_0xcbf6('0x35')]=qs[_0xcbf6('0x36')](_[_0xcbf6('0x37')](_0x58257a[_0xcbf6('0x2b')],_0x1d9bbb['filters']),_0x24c1e5);if(_0x58257a[_0xcbf6('0x2b')]['filter']){_0x5d6068[_0xcbf6('0x35')]=_[_0xcbf6('0x38')](_0x5d6068[_0xcbf6('0x35')],{'$or':_[_0xcbf6('0x24')](_0x24c1e5,function(_0x28bbb2){if(_0x28bbb2[_0xcbf6('0x28')]!==_0xcbf6('0x39')){var _0x29a34c={};_0x29a34c[_0x28bbb2['name']]={'$like':'%'+_0x58257a[_0xcbf6('0x2b')][_0xcbf6('0x3a')]+'%'};return _0x29a34c;}})});}_0x5d6068=_[_0xcbf6('0x38')]({},_0x5d6068,_0x58257a[_0xcbf6('0x3b')]);var _0x20f371={'where':_0x5d6068[_0xcbf6('0x35')]};return db[_0xcbf6('0x25')][_0xcbf6('0x3c')](_0x20f371)['then'](function(_0x162b0c){_0x58cdd0[_0xcbf6('0x3c')]=_0x162b0c;if(_0x58257a[_0xcbf6('0x2b')]['includeAll']){_0x5d6068['include']=[{'all':!![]}];}return db[_0xcbf6('0x25')]['findAll'](_0x5d6068);})['then'](function(_0x1a8f34){_0x58cdd0[_0xcbf6('0x3d')]=_0x1a8f34;return _0x58cdd0;})[_0xcbf6('0x1d')](respondWithFilteredResult(_0x1a37fc,_0x5d6068))[_0xcbf6('0x3e')](handleError(_0x1a37fc,null));};exports[_0xcbf6('0x3f')]=function(_0x19a3e9,_0x28611f){var _0x227a1b={'raw':![],'where':{'id':_0x19a3e9[_0xcbf6('0x40')]['id']}},_0x101e0b={};_0x101e0b[_0xcbf6('0x2a')]=_['keys'](db[_0xcbf6('0x25')]['rawAttributes']);_0x101e0b[_0xcbf6('0x2b')]=_[_0xcbf6('0x41')](_0x19a3e9[_0xcbf6('0x2b')]);_0x101e0b[_0xcbf6('0x36')]=_[_0xcbf6('0x2c')](_0x101e0b[_0xcbf6('0x2a')],_0x101e0b[_0xcbf6('0x2b')]);_0x227a1b[_0xcbf6('0x2d')]=_[_0xcbf6('0x2c')](_0x101e0b[_0xcbf6('0x2a')],qs[_0xcbf6('0x2e')](_0x19a3e9[_0xcbf6('0x2b')][_0xcbf6('0x2e')]));_0x227a1b[_0xcbf6('0x2d')]=_0x227a1b[_0xcbf6('0x2d')][_0xcbf6('0x2f')]?_0x227a1b['attributes']:_0x101e0b[_0xcbf6('0x2a')];if(_0x19a3e9['query'][_0xcbf6('0x42')]){_0x227a1b[_0xcbf6('0x43')]=[{'all':!![]}];}_0x227a1b=_[_0xcbf6('0x38')]({},_0x227a1b,_0x19a3e9['options']);return db[_0xcbf6('0x25')][_0xcbf6('0x44')](_0x227a1b)[_0xcbf6('0x1d')](handleEntityNotFound(_0x28611f,null))[_0xcbf6('0x1d')](respondWithResult(_0x28611f,null))[_0xcbf6('0x3e')](handleError(_0x28611f,null));};exports[_0xcbf6('0x45')]=function(_0x53111e,_0x2f195d){return db[_0xcbf6('0x25')]['create'](_0x53111e['body'],{})[_0xcbf6('0x1d')](respondWithResult(_0x2f195d,0xc9))['catch'](handleError(_0x2f195d,null));};exports[_0xcbf6('0x46')]=function(_0x2038c3,_0x95d7a8){if(_0x2038c3[_0xcbf6('0x47')]['id']){delete _0x2038c3[_0xcbf6('0x47')]['id'];}return db[_0xcbf6('0x25')]['find']({'where':{'id':_0x2038c3[_0xcbf6('0x40')]['id']}})[_0xcbf6('0x1d')](handleEntityNotFound(_0x95d7a8,null))[_0xcbf6('0x1d')](saveUpdates(_0x2038c3['body'],null))[_0xcbf6('0x1d')](respondWithResult(_0x95d7a8,null))[_0xcbf6('0x3e')](handleError(_0x95d7a8,null));};exports[_0xcbf6('0x1e')]=function(_0x529513,_0x31f7a4){return db[_0xcbf6('0x25')][_0xcbf6('0x44')]({'where':{'id':_0x529513[_0xcbf6('0x40')]['id']}})[_0xcbf6('0x1d')](handleEntityNotFound(_0x31f7a4,null))[_0xcbf6('0x1d')](removeEntity(_0x31f7a4,null))[_0xcbf6('0x3e')](handleError(_0x31f7a4,null));};exports[_0xcbf6('0x48')]=function(_0x3fb481,_0x3ab545){return db[_0xcbf6('0x25')][_0xcbf6('0x48')]()[_0xcbf6('0x1d')](respondWithResult(_0x3ab545,null))[_0xcbf6('0x3e')](handleError(_0x3ab545,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c931812..b5c158d 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 _0x9b99=['define','IntegrationReport','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x17c36e,_0x1f5f48){var _0x1510ea=function(_0x25aee2){while(--_0x25aee2){_0x17c36e['push'](_0x17c36e['shift']());}};_0x1510ea(++_0x1f5f48);}(_0x9b99,0xa7));var _0x99b9=function(_0x467855,_0x2fbf50){_0x467855=_0x467855-0x0;var _0x31ad03=_0x9b99[_0x467855];return _0x31ad03;};'use strict';var _=require(_0x99b9('0x0'));var util=require(_0x99b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x99b9('0x2'));var BPromise=require(_0x99b9('0x3'));var rp=require(_0x99b9('0x4'));var fs=require('fs');var path=require(_0x99b9('0x5'));var rimraf=require(_0x99b9('0x6'));var config=require(_0x99b9('0x7'));var attributes=require(_0x99b9('0x8'));module['exports']=function(_0x2adf2b,_0x5d2908){return _0x2adf2b[_0x99b9('0x9')](_0x99b9('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7506=['exports','report_integration','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./integrationReport.attributes'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7506,0x13d));var _0x6750=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x7506[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x6750('0x0'));var util=require('util');var logger=require(_0x6750('0x1'))(_0x6750('0x2'));var moment=require(_0x6750('0x3'));var BPromise=require(_0x6750('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6750('0x5'));var attributes=require(_0x6750('0x6'));module[_0x6750('0x7')]=function(_0x2365ec,_0x1ea8d1){return _0x2365ec['define']('IntegrationReport',attributes,{'tableName':_0x6750('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 10b144d..be8b8f2 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xda3f,0xec));var _0xfda3=function(_0x353b02,_0x434359){_0x353b02=_0x353b02-0x0;var _0x38f694=_0xda3f[_0x353b02];return _0x38f694;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x4fc2,0x111));var _0x24fc=function(_0x552804,_0x3c3d1e){_0x552804=_0x552804-0x0;var _0x32be66=_0x4fc2[_0x552804];return _0x32be66;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 8b6b242..426c263 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x32794d,_0x2905e8){var _0x430a45=function(_0x5f15c3){while(--_0x5f15c3){_0x32794d['push'](_0x32794d['shift']());}};_0x430a45(++_0x2905e8);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x55ca,0x126));var _0xa55c=function(_0x49bfb8,_0x5b6e2b){_0x49bfb8=_0x49bfb8-0x0;var _0x1be0b7=_0x55ca[_0x49bfb8];return _0x1be0b7;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b91c1de..e5660c3 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 _0xc7f1=['STRING','exports'];(function(_0x2a96e0,_0x2caca3){var _0x2ad930=function(_0x569c5c){while(--_0x569c5c){_0x2a96e0['push'](_0x2a96e0['shift']());}};_0x2ad930(++_0x2caca3);}(_0xc7f1,0x6f));var _0x1c7f=function(_0x5521cf,_0x2d738b){_0x5521cf=_0x5521cf-0x0;var _0x1d1122=_0xc7f1[_0x5521cf];return _0x1d1122;};'use strict';var Sequelize=require('sequelize');module[_0x1c7f('0x0')]={'name':{'type':Sequelize[_0x1c7f('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xb114=['STRING','sequelize','exports'];(function(_0x2dd849,_0x3bd1bf){var _0x38ba4e=function(_0xd89ddc){while(--_0xd89ddc){_0x2dd849['push'](_0x2dd849['shift']());}};_0x38ba4e(++_0x3bd1bf);}(_0xb114,0x133));var _0x4b11=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb114[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x4b11('0x0'));module[_0x4b11('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b11('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 2a61d3e..134739b 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 _0xe5c2=['util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','Intervals','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','Interval','rows','catch','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','findAll','rimraf','request-promise','bluebird','mustache'];(function(_0x28911a,_0xc090fa){var _0x2afc4e=function(_0x10ace6){while(--_0x10ace6){_0x28911a['push'](_0x28911a['shift']());}};_0x2afc4e(++_0xc090fa);}(_0xe5c2,0x1b9));var _0x2e5c=function(_0x1f2f1d,_0x5263f9){_0x1f2f1d=_0x1f2f1d-0x0;var _0x4c911a=_0xe5c2[_0x1f2f1d];return _0x4c911a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2e5c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e5c('0x1'));var moment=require('moment');var BPromise=require(_0x2e5c('0x2'));var Mustache=require(_0x2e5c('0x3'));var util=require(_0x2e5c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x2e5c('0x5'));var ejs=require(_0x2e5c('0x6'));var fs=require('fs');var _=require(_0x2e5c('0x7'));var squel=require(_0x2e5c('0x8'));var crypto=require(_0x2e5c('0x9'));var jsforce=require(_0x2e5c('0xa'));var deskjs=require(_0x2e5c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2e5c('0xc'));var Papa=require('papaparse');var Redis=require(_0x2e5c('0xd'));var authService=require(_0x2e5c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2e5c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e5c('0x10'))(_0x2e5c('0x11'));var utils=require(_0x2e5c('0x12'));var config=require(_0x2e5c('0x13'));var licenseUtil=require(_0x2e5c('0x14'));var db=require(_0x2e5c('0x15'))['db'];var extensions=require(_0x2e5c('0x16'));function respondWithStatusCode(_0x1bbd71,_0x57d263){_0x57d263=_0x57d263||0xcc;return function(_0x1e318b){if(_0x1e318b){return _0x1bbd71[_0x2e5c('0x17')](_0x57d263);}return _0x1bbd71[_0x2e5c('0x18')](_0x57d263)[_0x2e5c('0x19')]();};}function respondWithResult(_0x1cbaf6,_0x16dc14){_0x16dc14=_0x16dc14||0xc8;return function(_0x409e39){if(_0x409e39){return _0x1cbaf6[_0x2e5c('0x18')](_0x16dc14)[_0x2e5c('0x1a')](_0x409e39);}};}function respondWithFilteredResult(_0x585960,_0x322888){return function(_0x122641){if(_0x122641){var _0x33c25b=_0x122641[_0x2e5c('0x1b')],_0x41a174=_0x322888[_0x2e5c('0x1c')],_0x108ac4=_0x322888['offset']+_0x322888[_0x2e5c('0x1d')],_0x160765;if(_0x108ac4>=_0x33c25b){_0x108ac4=_0x33c25b;_0x160765=0xc8;}else{_0x160765=0xce;}_0x585960[_0x2e5c('0x18')](_0x160765);return _0x585960[_0x2e5c('0x1e')](_0x2e5c('0x1f'),_0x41a174+'-'+_0x108ac4+'/'+_0x33c25b)[_0x2e5c('0x1a')](_0x122641);}return null;};}function patchUpdates(_0xcdeea7){return function(_0x5e7787){try{jsonpatch['apply'](_0x5e7787,_0xcdeea7,!![]);}catch(_0x6b2492){return BPromise['reject'](_0x6b2492);}return _0x5e7787[_0x2e5c('0x20')]();};}function saveUpdates(_0x29f843,_0x18d65e){return function(_0x51e194){if(_0x51e194){return _0x51e194[_0x2e5c('0x21')](_0x29f843)['then'](function(_0x35a108){return _0x35a108;});}return null;};}function removeEntity(_0x2743b7,_0x4cbde7){return function(_0x19c254){if(_0x19c254){return _0x19c254[_0x2e5c('0x22')]()[_0x2e5c('0x23')](function(){var _0x119f25=_0x19c254['get']({'plain':!![]});var _0xa4562a=_0x2e5c('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0xa4562a,'resourceId':_0x119f25['id']}})['then'](function(){return _0x19c254;});})[_0x2e5c('0x23')](function(){_0x2743b7[_0x2e5c('0x18')](0xcc)[_0x2e5c('0x19')]();});}};}function handleEntityNotFound(_0x32be08,_0x587594){return function(_0x4a4fbc){if(!_0x4a4fbc){_0x32be08[_0x2e5c('0x17')](0x194);}return _0x4a4fbc;};}function handleError(_0x120381,_0x35c197){_0x35c197=_0x35c197||0x1f4;return function(_0x240698){logger[_0x2e5c('0x25')](_0x240698[_0x2e5c('0x26')]);if(_0x240698[_0x2e5c('0x27')]){delete _0x240698[_0x2e5c('0x27')];}_0x120381[_0x2e5c('0x18')](_0x35c197)[_0x2e5c('0x28')](_0x240698);};}exports[_0x2e5c('0x29')]=function(_0x5ddd58,_0x7efaba){var _0x4d980f={},_0x26f1c9={},_0x98a0c6={'count':0x0,'rows':[]};var _0x3955ae=_[_0x2e5c('0x2a')](db['Interval'][_0x2e5c('0x2b')],function(_0x17f48e){return{'name':_0x17f48e['fieldName'],'type':_0x17f48e[_0x2e5c('0x2c')][_0x2e5c('0x2d')]};});_0x26f1c9[_0x2e5c('0x2e')]=_['map'](_0x3955ae,'name');_0x26f1c9[_0x2e5c('0x2f')]=_['keys'](_0x5ddd58[_0x2e5c('0x2f')]);_0x26f1c9['filters']=_[_0x2e5c('0x30')](_0x26f1c9[_0x2e5c('0x2e')],_0x26f1c9['query']);_0x4d980f[_0x2e5c('0x31')]=_[_0x2e5c('0x30')](_0x26f1c9[_0x2e5c('0x2e')],qs[_0x2e5c('0x32')](_0x5ddd58[_0x2e5c('0x2f')][_0x2e5c('0x32')]));_0x4d980f[_0x2e5c('0x31')]=_0x4d980f[_0x2e5c('0x31')][_0x2e5c('0x33')]?_0x4d980f[_0x2e5c('0x31')]:_0x26f1c9['model'];if(!_0x5ddd58[_0x2e5c('0x2f')][_0x2e5c('0x34')](_0x2e5c('0x35'))){_0x4d980f[_0x2e5c('0x1d')]=qs['limit'](_0x5ddd58[_0x2e5c('0x2f')]['limit']);_0x4d980f[_0x2e5c('0x1c')]=qs[_0x2e5c('0x1c')](_0x5ddd58['query'][_0x2e5c('0x1c')]);}_0x4d980f[_0x2e5c('0x36')]=qs[_0x2e5c('0x37')](_0x5ddd58[_0x2e5c('0x2f')]['sort']);_0x4d980f['where']=qs[_0x2e5c('0x38')](_[_0x2e5c('0x39')](_0x5ddd58[_0x2e5c('0x2f')],_0x26f1c9['filters']),_0x3955ae);if(_0x5ddd58[_0x2e5c('0x2f')][_0x2e5c('0x3a')]){_0x4d980f[_0x2e5c('0x3b')]=_[_0x2e5c('0x3c')](_0x4d980f[_0x2e5c('0x3b')],{'$or':_[_0x2e5c('0x2a')](_0x3955ae,function(_0x3f2c9a){if(_0x3f2c9a[_0x2e5c('0x2c')]!==_0x2e5c('0x3d')){var _0x353e4e={};_0x353e4e[_0x3f2c9a[_0x2e5c('0x27')]]={'$like':'%'+_0x5ddd58[_0x2e5c('0x2f')]['filter']+'%'};return _0x353e4e;}})});}_0x4d980f=_[_0x2e5c('0x3c')]({},_0x4d980f,_0x5ddd58[_0x2e5c('0x3e')]);var _0x2ea95c={'where':_0x4d980f[_0x2e5c('0x3b')]};return db['Interval'][_0x2e5c('0x1b')](_0x2ea95c)[_0x2e5c('0x23')](function(_0x2581ff){_0x98a0c6[_0x2e5c('0x1b')]=_0x2581ff;if(_0x5ddd58['query']['includeAll']){_0x4d980f[_0x2e5c('0x3f')]=[{'all':!![]}];}return db[_0x2e5c('0x40')]['findAll'](_0x4d980f);})[_0x2e5c('0x23')](function(_0x167137){_0x98a0c6[_0x2e5c('0x41')]=_0x167137;return _0x98a0c6;})[_0x2e5c('0x23')](respondWithFilteredResult(_0x7efaba,_0x4d980f))[_0x2e5c('0x42')](handleError(_0x7efaba,null));};exports['show']=function(_0x4e7e0f,_0x3b0e14){var _0x553532={'raw':!![],'where':{'id':_0x4e7e0f[_0x2e5c('0x43')]['id']}},_0x298330={};_0x298330[_0x2e5c('0x2e')]=_[_0x2e5c('0x44')](db['Interval'][_0x2e5c('0x2b')]);_0x298330[_0x2e5c('0x2f')]=_[_0x2e5c('0x44')](_0x4e7e0f[_0x2e5c('0x2f')]);_0x298330[_0x2e5c('0x38')]=_[_0x2e5c('0x30')](_0x298330[_0x2e5c('0x2e')],_0x298330[_0x2e5c('0x2f')]);_0x553532['attributes']=_[_0x2e5c('0x30')](_0x298330[_0x2e5c('0x2e')],qs[_0x2e5c('0x32')](_0x4e7e0f[_0x2e5c('0x2f')][_0x2e5c('0x32')]));_0x553532[_0x2e5c('0x31')]=_0x553532['attributes'][_0x2e5c('0x33')]?_0x553532['attributes']:_0x298330[_0x2e5c('0x2e')];if(_0x4e7e0f['query'][_0x2e5c('0x45')]){_0x553532[_0x2e5c('0x3f')]=[{'all':!![]}];}_0x553532=_[_0x2e5c('0x3c')]({},_0x553532,_0x4e7e0f[_0x2e5c('0x3e')]);return db[_0x2e5c('0x40')][_0x2e5c('0x46')](_0x553532)[_0x2e5c('0x23')](handleEntityNotFound(_0x3b0e14,null))[_0x2e5c('0x23')](respondWithResult(_0x3b0e14,null))['catch'](handleError(_0x3b0e14,null));};exports['create']=function(_0x438d47,_0x4e8c90){return db[_0x2e5c('0x40')][_0x2e5c('0x47')](_0x438d47[_0x2e5c('0x48')],{})[_0x2e5c('0x23')](function(_0x5e1e00){var _0xbcf50=_0x438d47[_0x2e5c('0x49')][_0x2e5c('0x4a')]({'plain':!![]});if(!_0xbcf50)throw new Error(_0x2e5c('0x4b'));if(_0xbcf50[_0x2e5c('0x4c')]===_0x2e5c('0x49')){var _0x50e375=_0x5e1e00[_0x2e5c('0x4a')]({'plain':!![]});var _0x4e8f0c=_0x2e5c('0x24');return db[_0x2e5c('0x4d')][_0x2e5c('0x46')]({'where':{'name':_0x4e8f0c,'userProfileId':_0xbcf50['userProfileId']},'raw':!![]})['then'](function(_0x6986c2){if(_0x6986c2&&_0x6986c2[_0x2e5c('0x4e')]===0x0){return db[_0x2e5c('0x4f')][_0x2e5c('0x47')]({'name':_0x50e375[_0x2e5c('0x27')],'resourceId':_0x50e375['id'],'type':_0x6986c2['name'],'sectionId':_0x6986c2['id']},{})[_0x2e5c('0x23')](function(){return _0x5e1e00;});}else{return _0x5e1e00;}})[_0x2e5c('0x42')](function(_0x5ee1c5){logger[_0x2e5c('0x25')](_0x2e5c('0x50'),_0x5ee1c5);throw _0x5ee1c5;});}return _0x5e1e00;})[_0x2e5c('0x23')](respondWithResult(_0x4e8c90,0xc9))[_0x2e5c('0x42')](handleError(_0x4e8c90,null));};exports[_0x2e5c('0x21')]=function(_0x4680be,_0x44987b){if(_0x4680be[_0x2e5c('0x48')]['id']){delete _0x4680be[_0x2e5c('0x48')]['id'];}return db['Interval'][_0x2e5c('0x46')]({'where':{'id':_0x4680be[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x44987b,null))[_0x2e5c('0x23')](saveUpdates(_0x4680be[_0x2e5c('0x48')],null))['then'](respondWithResult(_0x44987b,null))[_0x2e5c('0x42')](handleError(_0x44987b,null));};exports[_0x2e5c('0x22')]=function(_0x283a64,_0x38e160){return db[_0x2e5c('0x40')][_0x2e5c('0x46')]({'where':{'id':_0x283a64[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x38e160,null))[_0x2e5c('0x23')](removeEntity(_0x38e160,null))[_0x2e5c('0x42')](handleError(_0x38e160,null));};exports[_0x2e5c('0x51')]=function(_0x950282,_0x38e276,_0x2aadb9){if(_0x950282['body']['id']){delete _0x950282[_0x2e5c('0x48')]['id'];}return db['Interval']['find']({'where':{'id':_0x950282[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x38e276,null))[_0x2e5c('0x23')](function(_0x3e9e6e){if(_0x3e9e6e){_0x950282[_0x2e5c('0x48')][_0x2e5c('0x52')]=_0x3e9e6e['id'];return db[_0x2e5c('0x40')][_0x2e5c('0x47')](_0x950282[_0x2e5c('0x48')]);}})[_0x2e5c('0x23')](respondWithResult(_0x38e276,null))[_0x2e5c('0x42')](handleError(_0x38e276,null));};exports[_0x2e5c('0x53')]=function(_0x495612,_0x3acbb4,_0x40f07f){var _0x515c64={};var _0xa77a5d={};var _0x25351f;var _0x349efe;return db[_0x2e5c('0x40')][_0x2e5c('0x54')]({'where':{'id':_0x495612['params']['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x3acbb4,null))[_0x2e5c('0x23')](function(_0x56908e){if(_0x56908e){_0x25351f=_0x56908e;_0xa77a5d[_0x2e5c('0x2e')]=_['keys'](db['Interval']['rawAttributes']);_0xa77a5d[_0x2e5c('0x2f')]=_[_0x2e5c('0x44')](_0x495612[_0x2e5c('0x2f')]);_0xa77a5d[_0x2e5c('0x38')]=_[_0x2e5c('0x30')](_0xa77a5d[_0x2e5c('0x2e')],_0xa77a5d[_0x2e5c('0x2f')]);_0x515c64['attributes']=_['intersection'](_0xa77a5d[_0x2e5c('0x2e')],qs[_0x2e5c('0x32')](_0x495612['query'][_0x2e5c('0x32')]));_0x515c64[_0x2e5c('0x31')]=_0x515c64[_0x2e5c('0x31')][_0x2e5c('0x33')]?_0x515c64[_0x2e5c('0x31')]:_0xa77a5d[_0x2e5c('0x2e')];_0x515c64[_0x2e5c('0x36')]=qs['sort'](_0x495612['query'][_0x2e5c('0x37')]);_0x515c64[_0x2e5c('0x3b')]=qs[_0x2e5c('0x38')](_['pick'](_0x495612['query'],_0xa77a5d['filters']));if(_0x495612['query']['filter']){_0x515c64[_0x2e5c('0x3b')]=_[_0x2e5c('0x3c')](_0x515c64['where'],{'$or':_[_0x2e5c('0x2a')](_0x515c64['attributes'],function(_0x26ed04){var _0x383b2e={};_0x383b2e[_0x26ed04]={'$like':'%'+_0x495612['query'][_0x2e5c('0x3a')]+'%'};return _0x383b2e;})});}_0x515c64=_[_0x2e5c('0x3c')]({},_0x515c64,_0x495612[_0x2e5c('0x3e')]);return _0x25351f[_0x2e5c('0x53')](_0x515c64);}})[_0x2e5c('0x23')](function(_0x23bbca){if(_0x23bbca){_0x349efe=_0x23bbca[_0x2e5c('0x33')];if(!_0x495612[_0x2e5c('0x2f')][_0x2e5c('0x34')]('nolimit')){_0x515c64[_0x2e5c('0x1d')]=qs[_0x2e5c('0x1d')](_0x495612[_0x2e5c('0x2f')][_0x2e5c('0x1d')]);_0x515c64[_0x2e5c('0x1c')]=qs[_0x2e5c('0x1c')](_0x495612[_0x2e5c('0x2f')][_0x2e5c('0x1c')]);}return _0x25351f['getIntervals'](_0x515c64);}})[_0x2e5c('0x23')](function(_0xf4cbb2){if(_0xf4cbb2){return _0xf4cbb2?{'count':_0x349efe,'rows':_0xf4cbb2}:null;}})[_0x2e5c('0x23')](respondWithResult(_0x3acbb4,null))[_0x2e5c('0x42')](handleError(_0x3acbb4,null));};exports['addIntervals']=function(_0x26395c,_0x1170dc,_0x103a8f){return db[_0x2e5c('0x40')]['findOne']({'where':{'id':_0x26395c[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x1170dc,null))[_0x2e5c('0x23')](function(_0x26d7b8){if(_0x26d7b8){return db[_0x2e5c('0x55')][_0x2e5c('0x56')](function(_0x682f1d){return db[_0x2e5c('0x40')][_0x2e5c('0x22')]({'where':{'IntervalId':_0x26395c[_0x2e5c('0x43')]['id']},'transaction':_0x682f1d})[_0x2e5c('0x23')](function(_0xbc6799){var _0x501fd2=_[_0x2e5c('0x2a')](_0x26395c[_0x2e5c('0x48')],function(_0x1bdae1){delete _0x1bdae1['id'];_0x1bdae1[_0x2e5c('0x52')]=_0x26395c[_0x2e5c('0x43')]['id'];return _0x1bdae1;});return db['Interval'][_0x2e5c('0x57')](_0x501fd2,{'transaction':_0x682f1d});});})[_0x2e5c('0x23')](function(){return db[_0x2e5c('0x40')][_0x2e5c('0x58')]({'where':{'IntervalId':_0x26395c['params']['id']}});});}})[_0x2e5c('0x23')](respondWithResult(_0x1170dc,null))[_0x2e5c('0x42')](handleError(_0x1170dc,null));}; \ No newline at end of file +var _0x54bb=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','set','reject','update','destroy','then','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','getIntervals','addIntervals','sequelize','transaction','IntervalId','html-pdf','eml-format'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x54bb,0xb2));var _0xb54b=function(_0x5c43cf,_0x297c45){_0x5c43cf=_0x5c43cf-0x0;var _0x56a800=_0x54bb[_0x5c43cf];return _0x56a800;};'use strict';var pdf=require(_0xb54b('0x0'));var emlformat=require(_0xb54b('0x1'));var rimraf=require(_0xb54b('0x2'));var zipdir=require(_0xb54b('0x3'));var jsonpatch=require(_0xb54b('0x4'));var rp=require(_0xb54b('0x5'));var moment=require(_0xb54b('0x6'));var BPromise=require(_0xb54b('0x7'));var Mustache=require(_0xb54b('0x8'));var util=require('util');var path=require(_0xb54b('0x9'));var sox=require(_0xb54b('0xa'));var csv=require(_0xb54b('0xb'));var ejs=require(_0xb54b('0xc'));var fs=require('fs');var _=require(_0xb54b('0xd'));var squel=require('squel');var crypto=require(_0xb54b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb54b('0xf'));var Papa=require(_0xb54b('0x10'));var Redis=require(_0xb54b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb54b('0x12'));var as=require(_0xb54b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb54b('0x14'))(_0xb54b('0x15'));var utils=require('../../config/utils');var config=require(_0xb54b('0x16'));var licenseUtil=require(_0xb54b('0x17'));var db=require(_0xb54b('0x18'))['db'];var extensions=require(_0xb54b('0x19'));function respondWithStatusCode(_0x242b54,_0x497361){_0x497361=_0x497361||0xcc;return function(_0x365c47){if(_0x365c47){return _0x242b54[_0xb54b('0x1a')](_0x497361);}return _0x242b54[_0xb54b('0x1b')](_0x497361)[_0xb54b('0x1c')]();};}function respondWithResult(_0x28e271,_0xd9a765){_0xd9a765=_0xd9a765||0xc8;return function(_0x1f39bb){if(_0x1f39bb){return _0x28e271[_0xb54b('0x1b')](_0xd9a765)[_0xb54b('0x1d')](_0x1f39bb);}};}function respondWithFilteredResult(_0x480fd5,_0x4c1763){return function(_0x44b6f9){if(_0x44b6f9){var _0xa17ea0=_0x44b6f9[_0xb54b('0x1e')],_0x48757c=_0x4c1763[_0xb54b('0x1f')],_0x59e75f=_0x4c1763[_0xb54b('0x1f')]+_0x4c1763['limit'],_0x3e86cb;if(_0x59e75f>=_0xa17ea0){_0x59e75f=_0xa17ea0;_0x3e86cb=0xc8;}else{_0x3e86cb=0xce;}_0x480fd5[_0xb54b('0x1b')](_0x3e86cb);return _0x480fd5[_0xb54b('0x20')]('Content-Range',_0x48757c+'-'+_0x59e75f+'/'+_0xa17ea0)['json'](_0x44b6f9);}return null;};}function patchUpdates(_0x5cf144){return function(_0x277f8a){try{jsonpatch['apply'](_0x277f8a,_0x5cf144,!![]);}catch(_0x506eaf){return BPromise[_0xb54b('0x21')](_0x506eaf);}return _0x277f8a['save']();};}function saveUpdates(_0x3bd282,_0xed2b43){return function(_0x409836){if(_0x409836){return _0x409836[_0xb54b('0x22')](_0x3bd282)['then'](function(_0x6a00dc){return _0x6a00dc;});}return null;};}function removeEntity(_0x380ef1,_0x5e5627){return function(_0x470c3a){if(_0x470c3a){return _0x470c3a[_0xb54b('0x23')]()[_0xb54b('0x24')](function(){var _0x4d2876=_0x470c3a[_0xb54b('0x25')]({'plain':!![]});var _0x528373=_0xb54b('0x26');return db[_0xb54b('0x27')][_0xb54b('0x23')]({'where':{'type':_0x528373,'resourceId':_0x4d2876['id']}})[_0xb54b('0x24')](function(){return _0x470c3a;});})['then'](function(){_0x380ef1[_0xb54b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26371b,_0x5efb6b){return function(_0x4b110d){if(!_0x4b110d){_0x26371b[_0xb54b('0x1a')](0x194);}return _0x4b110d;};}function handleError(_0x18e1fe,_0x3c3fa3){_0x3c3fa3=_0x3c3fa3||0x1f4;return function(_0x2d8b62){logger[_0xb54b('0x28')](_0x2d8b62[_0xb54b('0x29')]);if(_0x2d8b62[_0xb54b('0x2a')]){delete _0x2d8b62[_0xb54b('0x2a')];}_0x18e1fe['status'](_0x3c3fa3)[_0xb54b('0x2b')](_0x2d8b62);};}exports[_0xb54b('0x2c')]=function(_0x3760f0,_0x4b25d7){var _0xd36f5f={},_0x1d8b7c={},_0x3372fe={'count':0x0,'rows':[]};var _0x2108cf=_[_0xb54b('0x2d')](db[_0xb54b('0x2e')]['rawAttributes'],function(_0x87ec7c){return{'name':_0x87ec7c['fieldName'],'type':_0x87ec7c[_0xb54b('0x2f')][_0xb54b('0x30')]};});_0x1d8b7c['model']=_['map'](_0x2108cf,'name');_0x1d8b7c[_0xb54b('0x31')]=_[_0xb54b('0x32')](_0x3760f0[_0xb54b('0x31')]);_0x1d8b7c[_0xb54b('0x33')]=_[_0xb54b('0x34')](_0x1d8b7c['model'],_0x1d8b7c[_0xb54b('0x31')]);_0xd36f5f[_0xb54b('0x35')]=_[_0xb54b('0x34')](_0x1d8b7c['model'],qs[_0xb54b('0x36')](_0x3760f0[_0xb54b('0x31')]['fields']));_0xd36f5f[_0xb54b('0x35')]=_0xd36f5f[_0xb54b('0x35')][_0xb54b('0x37')]?_0xd36f5f[_0xb54b('0x35')]:_0x1d8b7c[_0xb54b('0x38')];if(!_0x3760f0[_0xb54b('0x31')][_0xb54b('0x39')](_0xb54b('0x3a'))){_0xd36f5f[_0xb54b('0x3b')]=qs[_0xb54b('0x3b')](_0x3760f0['query'][_0xb54b('0x3b')]);_0xd36f5f[_0xb54b('0x1f')]=qs[_0xb54b('0x1f')](_0x3760f0[_0xb54b('0x31')][_0xb54b('0x1f')]);}_0xd36f5f[_0xb54b('0x3c')]=qs[_0xb54b('0x3d')](_0x3760f0[_0xb54b('0x31')][_0xb54b('0x3d')]);_0xd36f5f['where']=qs[_0xb54b('0x33')](_[_0xb54b('0x3e')](_0x3760f0[_0xb54b('0x31')],_0x1d8b7c[_0xb54b('0x33')]),_0x2108cf);if(_0x3760f0['query'][_0xb54b('0x3f')]){_0xd36f5f[_0xb54b('0x40')]=_['merge'](_0xd36f5f[_0xb54b('0x40')],{'$or':_[_0xb54b('0x2d')](_0x2108cf,function(_0x176aa5){if(_0x176aa5[_0xb54b('0x2f')]!==_0xb54b('0x41')){var _0x1c9889={};_0x1c9889[_0x176aa5[_0xb54b('0x2a')]]={'$like':'%'+_0x3760f0[_0xb54b('0x31')][_0xb54b('0x3f')]+'%'};return _0x1c9889;}})});}_0xd36f5f=_[_0xb54b('0x42')]({},_0xd36f5f,_0x3760f0[_0xb54b('0x43')]);var _0x4ea62a={'where':_0xd36f5f[_0xb54b('0x40')]};return db[_0xb54b('0x2e')][_0xb54b('0x1e')](_0x4ea62a)[_0xb54b('0x24')](function(_0x3f291b){_0x3372fe[_0xb54b('0x1e')]=_0x3f291b;if(_0x3760f0[_0xb54b('0x31')][_0xb54b('0x44')]){_0xd36f5f['include']=[{'all':!![]}];}return db['Interval'][_0xb54b('0x45')](_0xd36f5f);})['then'](function(_0x440286){_0x3372fe[_0xb54b('0x46')]=_0x440286;return _0x3372fe;})[_0xb54b('0x24')](respondWithFilteredResult(_0x4b25d7,_0xd36f5f))[_0xb54b('0x47')](handleError(_0x4b25d7,null));};exports[_0xb54b('0x48')]=function(_0x34ce2f,_0x55aa0a){var _0x22cae3={'raw':!![],'where':{'id':_0x34ce2f[_0xb54b('0x49')]['id']}},_0x407ca2={};_0x407ca2[_0xb54b('0x38')]=_[_0xb54b('0x32')](db[_0xb54b('0x2e')][_0xb54b('0x4a')]);_0x407ca2[_0xb54b('0x31')]=_['keys'](_0x34ce2f['query']);_0x407ca2[_0xb54b('0x33')]=_[_0xb54b('0x34')](_0x407ca2[_0xb54b('0x38')],_0x407ca2[_0xb54b('0x31')]);_0x22cae3['attributes']=_[_0xb54b('0x34')](_0x407ca2[_0xb54b('0x38')],qs[_0xb54b('0x36')](_0x34ce2f[_0xb54b('0x31')][_0xb54b('0x36')]));_0x22cae3[_0xb54b('0x35')]=_0x22cae3[_0xb54b('0x35')]['length']?_0x22cae3[_0xb54b('0x35')]:_0x407ca2[_0xb54b('0x38')];if(_0x34ce2f[_0xb54b('0x31')][_0xb54b('0x44')]){_0x22cae3['include']=[{'all':!![]}];}_0x22cae3=_['merge']({},_0x22cae3,_0x34ce2f[_0xb54b('0x43')]);return db[_0xb54b('0x2e')][_0xb54b('0x4b')](_0x22cae3)['then'](handleEntityNotFound(_0x55aa0a,null))[_0xb54b('0x24')](respondWithResult(_0x55aa0a,null))[_0xb54b('0x47')](handleError(_0x55aa0a,null));};exports['create']=function(_0x1cf9b7,_0x13c9cd){return db['Interval'][_0xb54b('0x4c')](_0x1cf9b7[_0xb54b('0x4d')],{})[_0xb54b('0x24')](function(_0x334a83){var _0x4471f7=_0x1cf9b7[_0xb54b('0x4e')]['get']({'plain':!![]});if(!_0x4471f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4471f7[_0xb54b('0x4f')]===_0xb54b('0x4e')){var _0x14d7a9=_0x334a83[_0xb54b('0x25')]({'plain':!![]});var _0x55ca5b=_0xb54b('0x26');return db[_0xb54b('0x50')][_0xb54b('0x4b')]({'where':{'name':_0x55ca5b,'userProfileId':_0x4471f7[_0xb54b('0x51')]},'raw':!![]})[_0xb54b('0x24')](function(_0x103aef){if(_0x103aef&&_0x103aef[_0xb54b('0x52')]===0x0){return db[_0xb54b('0x27')][_0xb54b('0x4c')]({'name':_0x14d7a9[_0xb54b('0x2a')],'resourceId':_0x14d7a9['id'],'type':_0x103aef[_0xb54b('0x2a')],'sectionId':_0x103aef['id']},{})['then'](function(){return _0x334a83;});}else{return _0x334a83;}})['catch'](function(_0x328458){logger[_0xb54b('0x28')](_0xb54b('0x53'),_0x328458);throw _0x328458;});}return _0x334a83;})[_0xb54b('0x24')](respondWithResult(_0x13c9cd,0xc9))[_0xb54b('0x47')](handleError(_0x13c9cd,null));};exports[_0xb54b('0x22')]=function(_0x526ed6,_0x508b9f){if(_0x526ed6[_0xb54b('0x4d')]['id']){delete _0x526ed6[_0xb54b('0x4d')]['id'];}return db['Interval'][_0xb54b('0x4b')]({'where':{'id':_0x526ed6[_0xb54b('0x49')]['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x508b9f,null))[_0xb54b('0x24')](saveUpdates(_0x526ed6['body'],null))[_0xb54b('0x24')](respondWithResult(_0x508b9f,null))[_0xb54b('0x47')](handleError(_0x508b9f,null));};exports[_0xb54b('0x23')]=function(_0x52301e,_0x57c2fe){return db['Interval'][_0xb54b('0x4b')]({'where':{'id':_0x52301e['params']['id']}})['then'](handleEntityNotFound(_0x57c2fe,null))[_0xb54b('0x24')](removeEntity(_0x57c2fe,null))[_0xb54b('0x47')](handleError(_0x57c2fe,null));};exports['addInterval']=function(_0x2d089e,_0x26dc04,_0x5d3877){if(_0x2d089e[_0xb54b('0x4d')]['id']){delete _0x2d089e[_0xb54b('0x4d')]['id'];}return db['Interval'][_0xb54b('0x4b')]({'where':{'id':_0x2d089e[_0xb54b('0x49')]['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x26dc04,null))[_0xb54b('0x24')](function(_0x317bb2){if(_0x317bb2){_0x2d089e[_0xb54b('0x4d')]['IntervalId']=_0x317bb2['id'];return db[_0xb54b('0x2e')][_0xb54b('0x4c')](_0x2d089e[_0xb54b('0x4d')]);}})['then'](respondWithResult(_0x26dc04,null))[_0xb54b('0x47')](handleError(_0x26dc04,null));};exports['getIntervals']=function(_0x4ffb50,_0x5ac314,_0x514062){var _0x3ebcbe={};var _0x26c98b={};var _0x140554;var _0x5cd887;return db['Interval'][_0xb54b('0x54')]({'where':{'id':_0x4ffb50['params']['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x5ac314,null))[_0xb54b('0x24')](function(_0x1677f6){if(_0x1677f6){_0x140554=_0x1677f6;_0x26c98b[_0xb54b('0x38')]=_[_0xb54b('0x32')](db['Interval'][_0xb54b('0x4a')]);_0x26c98b['query']=_[_0xb54b('0x32')](_0x4ffb50['query']);_0x26c98b['filters']=_['intersection'](_0x26c98b[_0xb54b('0x38')],_0x26c98b[_0xb54b('0x31')]);_0x3ebcbe[_0xb54b('0x35')]=_[_0xb54b('0x34')](_0x26c98b[_0xb54b('0x38')],qs[_0xb54b('0x36')](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x36')]));_0x3ebcbe[_0xb54b('0x35')]=_0x3ebcbe[_0xb54b('0x35')][_0xb54b('0x37')]?_0x3ebcbe[_0xb54b('0x35')]:_0x26c98b[_0xb54b('0x38')];_0x3ebcbe['order']=qs[_0xb54b('0x3d')](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3d')]);_0x3ebcbe[_0xb54b('0x40')]=qs[_0xb54b('0x33')](_[_0xb54b('0x3e')](_0x4ffb50[_0xb54b('0x31')],_0x26c98b['filters']));if(_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3f')]){_0x3ebcbe[_0xb54b('0x40')]=_[_0xb54b('0x42')](_0x3ebcbe[_0xb54b('0x40')],{'$or':_[_0xb54b('0x2d')](_0x3ebcbe[_0xb54b('0x35')],function(_0x4fef64){var _0x33600e={};_0x33600e[_0x4fef64]={'$like':'%'+_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3f')]+'%'};return _0x33600e;})});}_0x3ebcbe=_[_0xb54b('0x42')]({},_0x3ebcbe,_0x4ffb50[_0xb54b('0x43')]);return _0x140554[_0xb54b('0x55')](_0x3ebcbe);}})['then'](function(_0x1947cf){if(_0x1947cf){_0x5cd887=_0x1947cf[_0xb54b('0x37')];if(!_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x39')]('nolimit')){_0x3ebcbe['limit']=qs['limit'](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x3b')]);_0x3ebcbe[_0xb54b('0x1f')]=qs[_0xb54b('0x1f')](_0x4ffb50[_0xb54b('0x31')][_0xb54b('0x1f')]);}return _0x140554[_0xb54b('0x55')](_0x3ebcbe);}})[_0xb54b('0x24')](function(_0x612b87){if(_0x612b87){return _0x612b87?{'count':_0x5cd887,'rows':_0x612b87}:null;}})['then'](respondWithResult(_0x5ac314,null))[_0xb54b('0x47')](handleError(_0x5ac314,null));};exports[_0xb54b('0x56')]=function(_0x463f17,_0x5357a5,_0x5267db){return db[_0xb54b('0x2e')][_0xb54b('0x54')]({'where':{'id':_0x463f17[_0xb54b('0x49')]['id']}})[_0xb54b('0x24')](handleEntityNotFound(_0x5357a5,null))['then'](function(_0x998deb){if(_0x998deb){return db[_0xb54b('0x57')][_0xb54b('0x58')](function(_0x3a3421){return db[_0xb54b('0x2e')][_0xb54b('0x23')]({'where':{'IntervalId':_0x463f17[_0xb54b('0x49')]['id']},'transaction':_0x3a3421})[_0xb54b('0x24')](function(_0x10ab31){var _0x2f7c22=_[_0xb54b('0x2d')](_0x463f17[_0xb54b('0x4d')],function(_0x282c12){delete _0x282c12['id'];_0x282c12[_0xb54b('0x59')]=_0x463f17['params']['id'];return _0x282c12;});return db[_0xb54b('0x2e')]['bulkCreate'](_0x2f7c22,{'transaction':_0x3a3421});});})['then'](function(){return db['Interval'][_0xb54b('0x45')]({'where':{'IntervalId':_0x463f17[_0xb54b('0x49')]['id']}});});}})[_0xb54b('0x24')](respondWithResult(_0x5357a5,null))[_0xb54b('0x47')](handleError(_0x5357a5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2c0375e..cdef6e7 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 _0x95b9=['tools_intervals','rewrite','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','Interval'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x95b9,0x10c));var _0x995b=function(_0x3f0ef1,_0x21b53b){_0x3f0ef1=_0x3f0ef1-0x0;var _0x1c4073=_0x95b9[_0x3f0ef1];return _0x1c4073;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var logger=require('../../config/logger')(_0x995b('0x2'));var moment=require('moment');var BPromise=require(_0x995b('0x3'));var rp=require(_0x995b('0x4'));var fs=require('fs');var path=require(_0x995b('0x5'));var rimraf=require(_0x995b('0x6'));var config=require(_0x995b('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0x995b('0x8'));module[_0x995b('0x9')]=function(_0x473daf,_0x288eab){return _0x473daf[_0x995b('0xa')](_0x995b('0xb'),attributes,{'tableName':_0x995b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x409d1d,_0x422895){extensions[_0x995b('0xd')](_0x473daf,_0x409d1d);},'afterBulkCreate':function(_0x6893b0,_0x2a38eb,_0xd5f3df){_0xd5f3df();extensions[_0x995b('0xd')](_0x473daf,_0x6893b0[0x0]);},'afterUpdate':function(_0x51a538,_0x2fc37c){extensions[_0x995b('0xd')](_0x473daf,_0x51a538);},'afterDestroy':function(_0x2617c8,_0xd82621){extensions[_0x995b('0xd')](_0x473daf,_0x2617c8);}}});}; \ No newline at end of file +var _0x3238=['rimraf','../../config/environment','exports','define','tools_intervals','rewrite','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var logger=require(_0x8323('0x1'))(_0x8323('0x2'));var moment=require(_0x8323('0x3'));var BPromise=require('bluebird');var rp=require(_0x8323('0x4'));var fs=require('fs');var path=require(_0x8323('0x5'));var rimraf=require(_0x8323('0x6'));var config=require(_0x8323('0x7'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0x8323('0x8')]=function(_0x5544f9,_0x40b1f0){return _0x5544f9[_0x8323('0x9')]('Interval',attributes,{'tableName':_0x8323('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5950e2,_0x216dc5){extensions[_0x8323('0xb')](_0x5544f9,_0x5950e2);},'afterBulkCreate':function(_0x1577a6,_0x1009a4,_0x1a5373){_0x1a5373();extensions[_0x8323('0xb')](_0x5544f9,_0x1577a6[0x0]);},'afterUpdate':function(_0x46f52b,_0x2dce91){extensions['rewrite'](_0x5544f9,_0x46f52b);},'afterDestroy':function(_0x42ca90,_0x278933){extensions[_0x8323('0xb')](_0x5544f9,_0x42ca90);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 08832a0..d6d114c 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 _0x5320=['message','catch','Interval','raw','options','where','attributes','limit','include','map','model','GetInterval','stringify','ShowInterval','find','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','Interval,\x20%s,\x20%s'];(function(_0x367a98,_0x245b6e){var _0x3cb8c5=function(_0x54be98){while(--_0x54be98){_0x367a98['push'](_0x367a98['shift']());}};_0x3cb8c5(++_0x245b6e);}(_0x5320,0x1dd));var _0x0532=function(_0x2f0a6a,_0xe1e4d7){_0x2f0a6a=_0x2f0a6a-0x0;var _0xbacf5c=_0x5320[_0x2f0a6a];return _0xbacf5c;};'use strict';var _=require(_0x0532('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0532('0x1'));var rs=require(_0x0532('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0532('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0532('0x4'))(_0x0532('0x5'));var config=require(_0x0532('0x6'));var jayson=require(_0x0532('0x7'));var client=jayson['client'][_0x0532('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcc122d,_0x56167c,_0x64055e){return new BPromise(function(_0x452c86,_0x270173){return client[_0x0532('0x9')](_0xcc122d,_0x64055e)[_0x0532('0xa')](function(_0x5754e2){logger[_0x0532('0xb')]('Interval,\x20%s,\x20%s',_0x56167c,_0x0532('0xc'));logger[_0x0532('0xd')](_0x0532('0xe'),_0x56167c,_0x0532('0xc'),JSON['stringify'](_0x5754e2));if(_0x5754e2[_0x0532('0xf')]){if(_0x5754e2[_0x0532('0xf')][_0x0532('0x10')]===0x1f4){logger[_0x0532('0xf')](_0x0532('0x11'),_0x56167c,_0x5754e2['error'][_0x0532('0x12')]);return _0x270173(_0x5754e2[_0x0532('0xf')][_0x0532('0x12')]);}logger[_0x0532('0xf')](_0x0532('0x11'),_0x56167c,_0x5754e2[_0x0532('0xf')][_0x0532('0x12')]);return _0x452c86(_0x5754e2[_0x0532('0xf')]['message']);}else{logger['info']('Interval,\x20%s,\x20%s',_0x56167c,_0x0532('0xc'));_0x452c86(_0x5754e2['result'][_0x0532('0x12')]);}})[_0x0532('0x13')](function(_0x55fd7d){logger[_0x0532('0xf')](_0x0532('0x11'),_0x56167c,_0x55fd7d);_0x270173(_0x55fd7d);});});}exports['GetInterval']=function(_0x556046){var _0x537af1=this;return new Promise(function(_0x54fde4,_0x36c135){return db[_0x0532('0x14')]['findAll']({'raw':_0x556046['options']?_0x556046['options'][_0x0532('0x15')]===undefined?!![]:![]:!![],'where':_0x556046[_0x0532('0x16')]?_0x556046[_0x0532('0x16')][_0x0532('0x17')]||null:null,'attributes':_0x556046[_0x0532('0x16')]?_0x556046['options'][_0x0532('0x18')]||null:null,'limit':_0x556046[_0x0532('0x16')]?_0x556046['options'][_0x0532('0x19')]||null:null,'include':_0x556046[_0x0532('0x16')]?_0x556046[_0x0532('0x16')][_0x0532('0x1a')]?_[_0x0532('0x1b')](_0x556046[_0x0532('0x16')][_0x0532('0x1a')],function(_0x151f09){return{'model':db[_0x151f09[_0x0532('0x1c')]],'as':_0x151f09['as'],'attributes':_0x151f09['attributes'],'include':_0x151f09['include']?_[_0x0532('0x1b')](_0x151f09[_0x0532('0x1a')],function(_0x4c933d){return{'model':db[_0x4c933d[_0x0532('0x1c')]],'as':_0x4c933d['as'],'attributes':_0x4c933d['attributes'],'include':_0x4c933d['include']?_[_0x0532('0x1b')](_0x4c933d[_0x0532('0x1a')],function(_0x1e40dd){return{'model':db[_0x1e40dd[_0x0532('0x1c')]],'as':_0x1e40dd['as'],'attributes':_0x1e40dd[_0x0532('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0532('0xa')](function(_0x18076f){logger['info']('GetInterval',_0x556046);logger['debug'](_0x0532('0x1d'),_0x556046,JSON[_0x0532('0x1e')](_0x18076f));_0x54fde4(_0x18076f);})['catch'](function(_0x3a8c9f){logger[_0x0532('0xf')](_0x0532('0x1d'),_0x3a8c9f[_0x0532('0x12')],_0x556046);_0x36c135(_0x537af1[_0x0532('0xf')](0x1f4,_0x3a8c9f[_0x0532('0x12')]));});});};exports[_0x0532('0x1f')]=function(_0x3c8801){var _0x1f7424=this;return new Promise(function(_0x2da48b,_0xafc101){return db[_0x0532('0x14')][_0x0532('0x20')]({'raw':_0x3c8801['options']?_0x3c8801['options'][_0x0532('0x15')]===undefined?!![]:![]:!![],'where':_0x3c8801['options']?_0x3c8801[_0x0532('0x16')]['where']||null:null,'attributes':_0x3c8801['options']?_0x3c8801['options'][_0x0532('0x18')]||null:null,'include':_0x3c8801[_0x0532('0x16')]?_0x3c8801[_0x0532('0x16')][_0x0532('0x1a')]?_['map'](_0x3c8801[_0x0532('0x16')][_0x0532('0x1a')],function(_0xe3ad57){return{'model':db[_0xe3ad57[_0x0532('0x1c')]],'as':_0xe3ad57['as'],'attributes':_0xe3ad57[_0x0532('0x18')],'include':_0xe3ad57['include']?_[_0x0532('0x1b')](_0xe3ad57[_0x0532('0x1a')],function(_0xd6d3fa){return{'model':db[_0xd6d3fa[_0x0532('0x1c')]],'as':_0xd6d3fa['as'],'attributes':_0xd6d3fa[_0x0532('0x18')],'include':_0xd6d3fa[_0x0532('0x1a')]?_[_0x0532('0x1b')](_0xd6d3fa[_0x0532('0x1a')],function(_0x1a2eca){return{'model':db[_0x1a2eca[_0x0532('0x1c')]],'as':_0x1a2eca['as'],'attributes':_0x1a2eca[_0x0532('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0532('0xa')](function(_0x3a17f5){logger[_0x0532('0xb')]('ShowInterval',_0x3c8801);logger[_0x0532('0xd')](_0x0532('0x1f'),_0x3c8801,JSON[_0x0532('0x1e')](_0x3a17f5));_0x2da48b(_0x3a17f5);})[_0x0532('0x13')](function(_0x4ec595){logger[_0x0532('0xf')](_0x0532('0x1f'),_0x4ec595[_0x0532('0x12')],_0x3c8801);_0xafc101(_0x1f7424[_0x0532('0xf')](0x1f4,_0x4ec595['message']));});});}; \ No newline at end of file +var _0x4e63=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetInterval','Interval','findAll','options','raw','attributes','include','map','model','ShowInterval','find','where','lodash','util','moment','bluebird'];(function(_0x3ef777,_0x69c304){var _0x1bb655=function(_0xd72f1d){while(--_0xd72f1d){_0x3ef777['push'](_0x3ef777['shift']());}};_0x1bb655(++_0x69c304);}(_0x4e63,0xce));var _0x34e6=function(_0x24f528,_0x135b93){_0x24f528=_0x24f528-0x0;var _0x444234=_0x4e63[_0x24f528];return _0x444234;};'use strict';var _=require(_0x34e6('0x0'));var util=require(_0x34e6('0x1'));var moment=require(_0x34e6('0x2'));var BPromise=require(_0x34e6('0x3'));var rs=require(_0x34e6('0x4'));var fs=require('fs');var Redis=require(_0x34e6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x34e6('0x6'));var logger=require('../../config/logger')(_0x34e6('0x7'));var config=require(_0x34e6('0x8'));var jayson=require(_0x34e6('0x9'));var client=jayson[_0x34e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe999e6,_0x35696b,_0x511d8d){return new BPromise(function(_0x5796cf,_0x12554d){return client['request'](_0xe999e6,_0x511d8d)[_0x34e6('0xb')](function(_0x5468c0){logger[_0x34e6('0xc')](_0x34e6('0xd'),_0x35696b,'request\x20sent');logger[_0x34e6('0xe')](_0x34e6('0xf'),_0x35696b,_0x34e6('0x10'),JSON[_0x34e6('0x11')](_0x5468c0));if(_0x5468c0['error']){if(_0x5468c0['error'][_0x34e6('0x12')]===0x1f4){logger[_0x34e6('0x13')]('Interval,\x20%s,\x20%s',_0x35696b,_0x5468c0['error'][_0x34e6('0x14')]);return _0x12554d(_0x5468c0[_0x34e6('0x13')][_0x34e6('0x14')]);}logger[_0x34e6('0x13')](_0x34e6('0xd'),_0x35696b,_0x5468c0[_0x34e6('0x13')][_0x34e6('0x14')]);return _0x5796cf(_0x5468c0[_0x34e6('0x13')][_0x34e6('0x14')]);}else{logger['info']('Interval,\x20%s,\x20%s',_0x35696b,_0x34e6('0x10'));_0x5796cf(_0x5468c0[_0x34e6('0x15')][_0x34e6('0x14')]);}})[_0x34e6('0x16')](function(_0x280379){logger['error'](_0x34e6('0xd'),_0x35696b,_0x280379);_0x12554d(_0x280379);});});}exports[_0x34e6('0x17')]=function(_0x18a739){var _0x2f08b8=this;return new Promise(function(_0x5d9ac5,_0x23d9c0){return db[_0x34e6('0x18')][_0x34e6('0x19')]({'raw':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')][_0x34e6('0x1b')]===undefined?!![]:![]:!![],'where':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')]['where']||null:null,'attributes':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')][_0x34e6('0x1c')]||null:null,'limit':_0x18a739['options']?_0x18a739[_0x34e6('0x1a')]['limit']||null:null,'include':_0x18a739['options']?_0x18a739['options'][_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x18a739[_0x34e6('0x1a')][_0x34e6('0x1d')],function(_0x5e1a73){return{'model':db[_0x5e1a73[_0x34e6('0x1f')]],'as':_0x5e1a73['as'],'attributes':_0x5e1a73[_0x34e6('0x1c')],'include':_0x5e1a73[_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x5e1a73[_0x34e6('0x1d')],function(_0x464791){return{'model':db[_0x464791['model']],'as':_0x464791['as'],'attributes':_0x464791[_0x34e6('0x1c')],'include':_0x464791['include']?_['map'](_0x464791[_0x34e6('0x1d')],function(_0x45e1f3){return{'model':db[_0x45e1f3['model']],'as':_0x45e1f3['as'],'attributes':_0x45e1f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x34e6('0xb')](function(_0x5959c5){logger[_0x34e6('0xc')](_0x34e6('0x17'),_0x18a739);logger[_0x34e6('0xe')](_0x34e6('0x17'),_0x18a739,JSON[_0x34e6('0x11')](_0x5959c5));_0x5d9ac5(_0x5959c5);})['catch'](function(_0x52bdd9){logger['error'](_0x34e6('0x17'),_0x52bdd9['message'],_0x18a739);_0x23d9c0(_0x2f08b8[_0x34e6('0x13')](0x1f4,_0x52bdd9[_0x34e6('0x14')]));});});};exports[_0x34e6('0x20')]=function(_0x5b1d95){var _0x4691e3=this;return new Promise(function(_0x374b21,_0x3630ba){return db['Interval'][_0x34e6('0x21')]({'raw':_0x5b1d95[_0x34e6('0x1a')]?_0x5b1d95[_0x34e6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d95[_0x34e6('0x1a')]?_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x22')]||null:null,'attributes':_0x5b1d95['options']?_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x1c')]||null:null,'include':_0x5b1d95[_0x34e6('0x1a')]?_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x5b1d95[_0x34e6('0x1a')][_0x34e6('0x1d')],function(_0x5e85a8){return{'model':db[_0x5e85a8[_0x34e6('0x1f')]],'as':_0x5e85a8['as'],'attributes':_0x5e85a8[_0x34e6('0x1c')],'include':_0x5e85a8[_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x5e85a8[_0x34e6('0x1d')],function(_0x389917){return{'model':db[_0x389917['model']],'as':_0x389917['as'],'attributes':_0x389917[_0x34e6('0x1c')],'include':_0x389917[_0x34e6('0x1d')]?_[_0x34e6('0x1e')](_0x389917[_0x34e6('0x1d')],function(_0x336b38){return{'model':db[_0x336b38[_0x34e6('0x1f')]],'as':_0x336b38['as'],'attributes':_0x336b38[_0x34e6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x34e6('0xb')](function(_0x1ad468){logger['info']('ShowInterval',_0x5b1d95);logger[_0x34e6('0xe')](_0x34e6('0x20'),_0x5b1d95,JSON['stringify'](_0x1ad468));_0x374b21(_0x1ad468);})[_0x34e6('0x16')](function(_0x4e2b07){logger['error']('ShowInterval',_0x4e2b07['message'],_0x5b1d95);_0x3630ba(_0x4691e3[_0x34e6('0x13')](0x1f4,_0x4e2b07[_0x34e6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index be6eb0d..c2a7230 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 _0xdf83=['isAuthenticated','send','exports','./jira.controller','post'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0xdf83,0x120));var _0x3df8=function(_0x37d172,_0x55b556){_0x37d172=_0x37d172-0x0;var _0xc6dac3=_0xdf83[_0x37d172];return _0xc6dac3;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x3df8('0x0'));router[_0x3df8('0x1')]('/',auth[_0x3df8('0x2')](),controller[_0x3df8('0x3')]);module[_0x3df8('0x4')]=router; \ No newline at end of file +var _0xd0e3=['./jira.controller','post','isAuthenticated','send','express'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xd0e3,0xd6));var _0x3d0e=function(_0x33898e,_0x1e994c){_0x33898e=_0x33898e-0x0;var _0x2465f4=_0xd0e3[_0x33898e];return _0x2465f4;};'use strict';var express=require(_0x3d0e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x3d0e('0x1'));router[_0x3d0e('0x2')]('/',auth[_0x3d0e('0x3')](),controller[_0x3d0e('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3e8fbb0..f84ea13 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 _0xfe32=['socket','remoteAddress','bluebird','https','../../config/logger','support','summary','description','issuetype','Bug','fields','customfield_11500','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection'];(function(_0xf9d280,_0x22e8d1){var _0x32e024=function(_0x544cd8){while(--_0x544cd8){_0xf9d280['push'](_0xf9d280['shift']());}};_0x32e024(++_0x22e8d1);}(_0xfe32,0x18e));var _0x2fe3=function(_0x3f386a,_0x33766c){_0x3f386a=_0x3f386a-0x0;var _0x5068ba=_0xfe32[_0x3f386a];return _0x5068ba;};'use strict';var BPromise=require(_0x2fe3('0x0'));var https=require(_0x2fe3('0x1'));var logger=require(_0x2fe3('0x2'))('api');var USERNAME=_0x2fe3('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5810dc,_0x26de38){var _0x4d774a={'fields':{'project':{'key':_0x5810dc['key']||'MOTGUI'},'summary':(_0x5810dc[_0x2fe3('0x4')]||'Report')+'\x20from\x20'+_0x5810dc['ip'],'description':_0x5810dc[_0x2fe3('0x5')]||JSON['stringify'](_0x5810dc),'issuetype':{'name':_0x5810dc[_0x2fe3('0x6')]||_0x2fe3('0x7')}}};_0x4d774a[_0x2fe3('0x8')][_0x2fe3('0x9')]=_0x5810dc['email'];_0x4d774a[_0x2fe3('0x8')]['customfield_11501']=_0x5810dc[_0x2fe3('0xa')];_0x4d774a[_0x2fe3('0x8')]['customfield_11502']=_0x5810dc[_0x2fe3('0xb')];_0x4d774a[_0x2fe3('0x8')][_0x2fe3('0xc')]=_0x5810dc[_0x2fe3('0xd')];_0x4d774a[_0x2fe3('0x8')][_0x2fe3('0xe')]=_0x5810dc[_0x2fe3('0xf')];_0x4d774a['fields'][_0x2fe3('0x10')]=_0x5810dc['ip'];var _0x33b393={'host':_0x2fe3('0x11'),'port':0x1bb,'path':_0x2fe3('0x12'),'method':_0x2fe3('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x2fe3('0x14'),'Authorization':_0x2fe3('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x2fe3('0x16'))}};var _0x338ec3=JSON[_0x2fe3('0x17')](_0x4d774a);var _0x4f6d21=https[_0x2fe3('0x18')](_0x33b393,function(_0x46e360){_0x46e360[_0x2fe3('0x19')](_0x2fe3('0x1a'));var _0x17ca3b='';_0x46e360['on'](_0x2fe3('0x1b'),function(_0x98f8cf){_0x17ca3b+=_0x98f8cf;});_0x46e360['on'](_0x2fe3('0x1c'),function(){if(_0x26de38){return _0x26de38[_0x2fe3('0x1d')](_0x46e360[_0x2fe3('0x1e')])[_0x2fe3('0x1f')](JSON[_0x2fe3('0x20')](_0x17ca3b));}});});_0x4f6d21['on']('error',function(_0x39b009){if(_0x26de38){return _0x26de38[_0x2fe3('0x1d')](0x1f4)[_0x2fe3('0x1f')]({'errors':[{'message':_0x2fe3('0x21'),'type':_0x2fe3('0x22')}]});}});_0x4f6d21[_0x2fe3('0x23')](_0x338ec3);_0x4f6d21[_0x2fe3('0x1c')]();}exports[_0x2fe3('0x24')]=openIssue;exports[_0x2fe3('0x25')]=function(_0x33316e,_0x27f9cd){_0x33316e[_0x2fe3('0x26')]['ip']=_0x33316e[_0x2fe3('0x27')][_0x2fe3('0x28')]||_0x33316e[_0x2fe3('0x29')]['remoteAddress']||_0x33316e[_0x2fe3('0x2a')][_0x2fe3('0x2b')]||_0x33316e[_0x2fe3('0x29')][_0x2fe3('0x2a')][_0x2fe3('0x2b')];return openIssue(_0x33316e[_0x2fe3('0x26')],_0x27f9cd);}; \ No newline at end of file +var _0x15bf=['/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','utf8','data','end','statusCode','json','parse','error','status','api.jira','write','send','body','headers','connection','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','reason','customfield_10102','track.xcallymotion.com'];(function(_0x463410,_0x51753a){var _0x375cda=function(_0x2de994){while(--_0x2de994){_0x463410['push'](_0x463410['shift']());}};_0x375cda(++_0x51753a);}(_0x15bf,0x9e));var _0xf15b=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x15bf[_0xf79bae];return _0x5d2cb7;};'use strict';var BPromise=require(_0xf15b('0x0'));var https=require(_0xf15b('0x1'));var logger=require(_0xf15b('0x2'))('api');var USERNAME=_0xf15b('0x3');var PASSWORD=_0xf15b('0x4');function openIssue(_0x2de900,_0x2dee10){var _0x3eaa5b={'fields':{'project':{'key':_0x2de900[_0xf15b('0x5')]||_0xf15b('0x6')},'summary':(_0x2de900[_0xf15b('0x7')]||_0xf15b('0x8'))+'\x20from\x20'+_0x2de900['ip'],'description':_0x2de900[_0xf15b('0x9')]||JSON['stringify'](_0x2de900),'issuetype':{'name':_0x2de900[_0xf15b('0xa')]||'Bug'}}};_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0xc')]=_0x2de900[_0xf15b('0xd')];_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0xe')]=_0x2de900[_0xf15b('0xf')];_0x3eaa5b['fields'][_0xf15b('0x10')]=_0x2de900[_0xf15b('0x11')];_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0x12')]=_0x2de900['name'];_0x3eaa5b[_0xf15b('0xb')]['customfield_11504']=_0x2de900[_0xf15b('0x13')];_0x3eaa5b[_0xf15b('0xb')][_0xf15b('0x14')]=_0x2de900['ip'];var _0x3d79fa={'host':_0xf15b('0x15'),'port':0x1bb,'path':_0xf15b('0x16'),'method':_0xf15b('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xf15b('0x18'),'Authorization':_0xf15b('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xf15b('0x1a')](_0xf15b('0x1b'))}};var _0x2c673a=JSON[_0xf15b('0x1c')](_0x3eaa5b);var _0x38b3f9=https[_0xf15b('0x1d')](_0x3d79fa,function(_0x539849){_0x539849['setEncoding'](_0xf15b('0x1e'));var _0x22d532='';_0x539849['on'](_0xf15b('0x1f'),function(_0x3856c8){_0x22d532+=_0x3856c8;});_0x539849['on'](_0xf15b('0x20'),function(){if(_0x2dee10){return _0x2dee10['status'](_0x539849[_0xf15b('0x21')])[_0xf15b('0x22')](JSON[_0xf15b('0x23')](_0x22d532));}});});_0x38b3f9['on'](_0xf15b('0x24'),function(_0x589708){if(_0x2dee10){return _0x2dee10[_0xf15b('0x25')](0x1f4)[_0xf15b('0x22')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xf15b('0x26')}]});}});_0x38b3f9[_0xf15b('0x27')](_0x2c673a);_0x38b3f9[_0xf15b('0x20')]();}exports['openIssue']=openIssue;exports[_0xf15b('0x28')]=function(_0x2af6de,_0x3a7454){_0x2af6de[_0xf15b('0x29')]['ip']=_0x2af6de[_0xf15b('0x2a')]['x-forwarded-for']||_0x2af6de[_0xf15b('0x2b')][_0xf15b('0x2c')]||_0x2af6de['socket'][_0xf15b('0x2c')]||_0x2af6de[_0xf15b('0x2b')]['socket'][_0xf15b('0x2c')];return openIssue(_0x2af6de[_0xf15b('0x29')],_0x3a7454);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8faf348..98c92d0 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 _0xc34d=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xc34d,0x11c));var _0xdc34=function(_0x3dc8d0,_0x481035){_0x3dc8d0=_0x3dc8d0-0x0;var _0x4f8586=_0xc34d[_0x3dc8d0];return _0x4f8586;};'use strict';var multer=require(_0xdc34('0x0'));var util=require(_0xdc34('0x1'));var path=require('path');var timeout=require(_0xdc34('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdc34('0x3'));var interaction=require(_0xdc34('0x4'));var config=require(_0xdc34('0x5'));var controller=require(_0xdc34('0x6'));router[_0xdc34('0x7')]('/',auth['isAuthenticated'](),controller[_0xdc34('0x8')]);router[_0xdc34('0x7')]('/describe',auth[_0xdc34('0x9')](),controller[_0xdc34('0xa')]);router['get'](_0xdc34('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdc34('0xc')]('/',auth[_0xdc34('0x9')](),controller[_0xdc34('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc34('0xe')]);router[_0xdc34('0xf')](_0xdc34('0xb'),auth[_0xdc34('0x9')](),controller[_0xdc34('0x10')]);module[_0xdc34('0x11')]=router; \ No newline at end of file +var _0x97b5=['../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x4333b0,_0x50a2d2){var _0x4541db=function(_0x3cddb6){while(--_0x3cddb6){_0x4333b0['push'](_0x4333b0['shift']());}};_0x4541db(++_0x50a2d2);}(_0x97b5,0x100));var _0x597b=function(_0x441489,_0x5a2be1){_0x441489=_0x441489-0x0;var _0x37411f=_0x97b5[_0x441489];return _0x37411f;};'use strict';var multer=require(_0x597b('0x0'));var util=require(_0x597b('0x1'));var path=require('path');var timeout=require(_0x597b('0x2'));var express=require('express');var router=express[_0x597b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x597b('0x4'));var config=require('../../config/environment');var controller=require(_0x597b('0x5'));router[_0x597b('0x6')]('/',auth[_0x597b('0x7')](),controller[_0x597b('0x8')]);router[_0x597b('0x6')](_0x597b('0x9'),auth[_0x597b('0x7')](),controller[_0x597b('0xa')]);router['get'](_0x597b('0xb'),auth[_0x597b('0x7')](),controller[_0x597b('0xc')]);router[_0x597b('0xd')]('/',auth[_0x597b('0x7')](),controller[_0x597b('0xe')]);router[_0x597b('0xf')](_0x597b('0xb'),auth['isAuthenticated'](),controller[_0x597b('0x10')]);router[_0x597b('0x11')]('/:id',auth[_0x597b('0x7')](),controller[_0x597b('0x12')]);module[_0x597b('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4df75fe..220ba4b 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 _0x0c9e=['STRING','long','exports'];(function(_0xa34974,_0xca2bb4){var _0x4e2583=function(_0x31ea82){while(--_0x31ea82){_0xa34974['push'](_0xa34974['shift']());}};_0x4e2583(++_0xca2bb4);}(_0x0c9e,0x17c));var _0xe0c9=function(_0x1e6afe,_0x9afb2d){_0x1e6afe=_0x1e6afe-0x0;var _0x2b7482=_0x0c9e[_0x1e6afe];return _0x2b7482;};'use strict';var Sequelize=require('sequelize');module[_0xe0c9('0x0')]={'question':{'type':Sequelize[_0xe0c9('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xe0c9('0x2'))},'membername':{'type':Sequelize[_0xe0c9('0x1')]},'projectname':{'type':Sequelize[_0xe0c9('0x1')]},'queue':{'type':Sequelize[_0xe0c9('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe0c9('0x1')]},'questionId':{'type':Sequelize[_0xe0c9('0x1')]}}; \ No newline at end of file +var _0xe857=['exports','STRING','sequelize'];(function(_0x11879b,_0x52fbc6){var _0x1caddf=function(_0x6e1617){while(--_0x6e1617){_0x11879b['push'](_0x11879b['shift']());}};_0x1caddf(++_0x52fbc6);}(_0xe857,0x1e8));var _0x7e85=function(_0x3b5a04,_0x51915b){_0x3b5a04=_0x3b5a04-0x0;var _0xf968eb=_0xe857[_0x3b5a04];return _0xf968eb;};'use strict';var Sequelize=require(_0x7e85('0x0'));module[_0x7e85('0x1')]={'question':{'type':Sequelize[_0x7e85('0x2')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0x7e85('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7e85('0x2')]},'uniqueid':{'type':Sequelize[_0x7e85('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7e85('0x2')]},'questionId':{'type':Sequelize[_0x7e85('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index a4a087c..da7052a 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 _0x7d19=['limit','status','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','count','offset'];(function(_0x55fac,_0x31b254){var _0x22909e=function(_0x42de60){while(--_0x42de60){_0x55fac['push'](_0x55fac['shift']());}};_0x22909e(++_0x31b254);}(_0x7d19,0x78));var _0x97d1=function(_0x1d05c2,_0x1a6c2d){_0x1d05c2=_0x1d05c2-0x0;var _0x4766f5=_0x7d19[_0x1d05c2];return _0x4766f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97d1('0x0'));var rimraf=require(_0x97d1('0x1'));var zipdir=require(_0x97d1('0x2'));var jsonpatch=require(_0x97d1('0x3'));var rp=require(_0x97d1('0x4'));var moment=require(_0x97d1('0x5'));var BPromise=require(_0x97d1('0x6'));var Mustache=require('mustache');var util=require(_0x97d1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x97d1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97d1('0x9'));var squel=require('squel');var crypto=require(_0x97d1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x97d1('0x8'));var querystring=require(_0x97d1('0xb'));var Papa=require(_0x97d1('0xc'));var Redis=require('ioredis');var authService=require(_0x97d1('0xd'));var qs=require(_0x97d1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97d1('0xf'));var logger=require('../../config/logger')(_0x97d1('0x10'));var utils=require(_0x97d1('0x11'));var config=require(_0x97d1('0x12'));var licenseUtil=require(_0x97d1('0x13'));var db=require(_0x97d1('0x14'))['db'];function respondWithStatusCode(_0x5aab56,_0xf0a645){_0xf0a645=_0xf0a645||0xcc;return function(_0x36b5bb){if(_0x36b5bb){return _0x5aab56[_0x97d1('0x15')](_0xf0a645);}return _0x5aab56['status'](_0xf0a645)['end']();};}function respondWithResult(_0x42e438,_0x19487b){_0x19487b=_0x19487b||0xc8;return function(_0x3636ce){if(_0x3636ce){return _0x42e438['status'](_0x19487b)['json'](_0x3636ce);}};}function respondWithFilteredResult(_0x41e592,_0x4a7754){return function(_0x4cd01f){if(_0x4cd01f){var _0x174a3c=_0x4cd01f[_0x97d1('0x16')],_0x388dd6=_0x4a7754[_0x97d1('0x17')],_0x1f3a8c=_0x4a7754[_0x97d1('0x17')]+_0x4a7754[_0x97d1('0x18')],_0x1875f4;if(_0x1f3a8c>=_0x174a3c){_0x1f3a8c=_0x174a3c;_0x1875f4=0xc8;}else{_0x1875f4=0xce;}_0x41e592[_0x97d1('0x19')](_0x1875f4);return _0x41e592[_0x97d1('0x1a')](_0x97d1('0x1b'),_0x388dd6+'-'+_0x1f3a8c+'/'+_0x174a3c)[_0x97d1('0x1c')](_0x4cd01f);}return null;};}function patchUpdates(_0x447661){return function(_0x53c0dd){try{jsonpatch[_0x97d1('0x1d')](_0x53c0dd,_0x447661,!![]);}catch(_0x3d4621){return BPromise[_0x97d1('0x1e')](_0x3d4621);}return _0x53c0dd['save']();};}function saveUpdates(_0xe8637,_0x85f9c5){return function(_0x5ceab6){if(_0x5ceab6){return _0x5ceab6[_0x97d1('0x1f')](_0xe8637)[_0x97d1('0x20')](function(_0x47e0ae){return _0x47e0ae;});}return null;};}function removeEntity(_0x3c6418,_0x437ab9){return function(_0x1b48da){if(_0x1b48da){return _0x1b48da[_0x97d1('0x21')]()[_0x97d1('0x20')](function(){_0x3c6418[_0x97d1('0x19')](0xcc)[_0x97d1('0x22')]();});}};}function handleEntityNotFound(_0x3beb22,_0x2d7933){return function(_0x103978){if(!_0x103978){_0x3beb22[_0x97d1('0x15')](0x194);}return _0x103978;};}function handleError(_0x3987e9,_0x1991b7){_0x1991b7=_0x1991b7||0x1f4;return function(_0x4af401){logger[_0x97d1('0x23')](_0x4af401['stack']);if(_0x4af401[_0x97d1('0x24')]){delete _0x4af401['name'];}_0x3987e9[_0x97d1('0x19')](_0x1991b7)[_0x97d1('0x25')](_0x4af401);};}exports['index']=function(_0x4fcbeb,_0x2c0c20){var _0x548d28={},_0x49e6db={},_0x539a07={'count':0x0,'rows':[]};var _0x3cb3e5=_[_0x97d1('0x26')](db[_0x97d1('0x27')][_0x97d1('0x28')],function(_0x32b0a5){return{'name':_0x32b0a5[_0x97d1('0x29')],'type':_0x32b0a5[_0x97d1('0x2a')][_0x97d1('0x2b')]};});_0x49e6db[_0x97d1('0x2c')]=_[_0x97d1('0x26')](_0x3cb3e5,_0x97d1('0x24'));_0x49e6db[_0x97d1('0x2d')]=_[_0x97d1('0x2e')](_0x4fcbeb[_0x97d1('0x2d')]);_0x49e6db['filters']=_[_0x97d1('0x2f')](_0x49e6db[_0x97d1('0x2c')],_0x49e6db[_0x97d1('0x2d')]);_0x548d28[_0x97d1('0x30')]=_[_0x97d1('0x2f')](_0x49e6db['model'],qs[_0x97d1('0x31')](_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x31')]));_0x548d28['attributes']=_0x548d28[_0x97d1('0x30')][_0x97d1('0x32')]?_0x548d28[_0x97d1('0x30')]:_0x49e6db[_0x97d1('0x2c')];if(!_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x33')](_0x97d1('0x34'))){_0x548d28[_0x97d1('0x18')]=qs[_0x97d1('0x18')](_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x18')]);_0x548d28['offset']=qs[_0x97d1('0x17')](_0x4fcbeb['query'][_0x97d1('0x17')]);}_0x548d28[_0x97d1('0x35')]=qs[_0x97d1('0x36')](_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x36')]);_0x548d28[_0x97d1('0x37')]=qs[_0x97d1('0x38')](_[_0x97d1('0x39')](_0x4fcbeb['query'],_0x49e6db['filters']),_0x3cb3e5);if(_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x3a')]){_0x548d28[_0x97d1('0x37')]=_['merge'](_0x548d28[_0x97d1('0x37')],{'$or':_['map'](_0x3cb3e5,function(_0x224202){if(_0x224202['type']!==_0x97d1('0x3b')){var _0x151120={};_0x151120[_0x224202[_0x97d1('0x24')]]={'$like':'%'+_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x3a')]+'%'};return _0x151120;}})});}_0x548d28=_[_0x97d1('0x3c')]({},_0x548d28,_0x4fcbeb[_0x97d1('0x3d')]);var _0x2877be={'where':_0x548d28[_0x97d1('0x37')]};return db[_0x97d1('0x27')]['count'](_0x2877be)['then'](function(_0x4f405a){_0x539a07[_0x97d1('0x16')]=_0x4f405a;if(_0x4fcbeb['query'][_0x97d1('0x3e')]){_0x548d28[_0x97d1('0x3f')]=[{'all':!![]}];}return db[_0x97d1('0x27')][_0x97d1('0x40')](_0x548d28);})[_0x97d1('0x20')](function(_0x56aa8b){_0x539a07[_0x97d1('0x41')]=_0x56aa8b;return _0x539a07;})[_0x97d1('0x20')](respondWithFilteredResult(_0x2c0c20,_0x548d28))[_0x97d1('0x42')](handleError(_0x2c0c20,null));};exports[_0x97d1('0x43')]=function(_0x1c9a5d,_0x55db28){var _0x2631c2={'raw':!![],'where':{'id':_0x1c9a5d[_0x97d1('0x44')]['id']}},_0x32552d={};_0x32552d['model']=_[_0x97d1('0x2e')](db['JscriptyAnswerReport']['rawAttributes']);_0x32552d[_0x97d1('0x2d')]=_[_0x97d1('0x2e')](_0x1c9a5d[_0x97d1('0x2d')]);_0x32552d[_0x97d1('0x38')]=_[_0x97d1('0x2f')](_0x32552d['model'],_0x32552d[_0x97d1('0x2d')]);_0x2631c2[_0x97d1('0x30')]=_[_0x97d1('0x2f')](_0x32552d[_0x97d1('0x2c')],qs[_0x97d1('0x31')](_0x1c9a5d[_0x97d1('0x2d')][_0x97d1('0x31')]));_0x2631c2['attributes']=_0x2631c2[_0x97d1('0x30')]['length']?_0x2631c2[_0x97d1('0x30')]:_0x32552d[_0x97d1('0x2c')];if(_0x1c9a5d[_0x97d1('0x2d')][_0x97d1('0x3e')]){_0x2631c2[_0x97d1('0x3f')]=[{'all':!![]}];}_0x2631c2=_[_0x97d1('0x3c')]({},_0x2631c2,_0x1c9a5d['options']);return db[_0x97d1('0x27')][_0x97d1('0x45')](_0x2631c2)[_0x97d1('0x20')](handleEntityNotFound(_0x55db28,null))[_0x97d1('0x20')](respondWithResult(_0x55db28,null))[_0x97d1('0x42')](handleError(_0x55db28,null));};exports[_0x97d1('0x46')]=function(_0x2357ed,_0x3cbf47){return db[_0x97d1('0x27')][_0x97d1('0x46')](_0x2357ed[_0x97d1('0x47')],{})[_0x97d1('0x20')](respondWithResult(_0x3cbf47,0xc9))[_0x97d1('0x42')](handleError(_0x3cbf47,null));};exports[_0x97d1('0x1f')]=function(_0x3c7877,_0x4add90){if(_0x3c7877[_0x97d1('0x47')]['id']){delete _0x3c7877['body']['id'];}return db[_0x97d1('0x27')][_0x97d1('0x45')]({'where':{'id':_0x3c7877[_0x97d1('0x44')]['id']}})[_0x97d1('0x20')](handleEntityNotFound(_0x4add90,null))[_0x97d1('0x20')](saveUpdates(_0x3c7877[_0x97d1('0x47')],null))[_0x97d1('0x20')](respondWithResult(_0x4add90,null))[_0x97d1('0x42')](handleError(_0x4add90,null));};exports[_0x97d1('0x21')]=function(_0x123d29,_0x6e6bdd){return db[_0x97d1('0x27')][_0x97d1('0x45')]({'where':{'id':_0x123d29[_0x97d1('0x44')]['id']}})[_0x97d1('0x20')](handleEntityNotFound(_0x6e6bdd,null))[_0x97d1('0x20')](removeEntity(_0x6e6bdd,null))[_0x97d1('0x42')](handleError(_0x6e6bdd,null));};exports['describe']=function(_0x12d7c6,_0x411aef){return db[_0x97d1('0x27')]['describe']()[_0x97d1('0x20')](respondWithResult(_0x411aef,null))[_0x97d1('0x42')](handleError(_0x411aef,null));}; \ No newline at end of file +var _0x5ce0=['key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','count','includeAll','include','findAll','catch','params','rawAttributes','fields','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','index','map','JscriptyAnswerReport','fieldName','type'];(function(_0x33e5e2,_0x10d7a8){var _0x21e5af=function(_0x4b4103){while(--_0x4b4103){_0x33e5e2['push'](_0x33e5e2['shift']());}};_0x21e5af(++_0x10d7a8);}(_0x5ce0,0x180));var _0x05ce=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x5ce0[_0xbc1a4b];return _0x108b87;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x05ce('0x0'));var rimraf=require(_0x05ce('0x1'));var zipdir=require(_0x05ce('0x2'));var jsonpatch=require(_0x05ce('0x3'));var rp=require(_0x05ce('0x4'));var moment=require('moment');var BPromise=require(_0x05ce('0x5'));var Mustache=require(_0x05ce('0x6'));var util=require('util');var path=require(_0x05ce('0x7'));var sox=require(_0x05ce('0x8'));var csv=require(_0x05ce('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x05ce('0xa'));var crypto=require(_0x05ce('0xb'));var jsforce=require(_0x05ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x05ce('0x9'));var querystring=require(_0x05ce('0xd'));var Papa=require('papaparse');var Redis=require(_0x05ce('0xe'));var authService=require(_0x05ce('0xf'));var qs=require(_0x05ce('0x10'));var as=require(_0x05ce('0x11'));var hardwareService=require(_0x05ce('0x12'));var logger=require(_0x05ce('0x13'))(_0x05ce('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x05ce('0x15'));var db=require(_0x05ce('0x16'))['db'];function respondWithStatusCode(_0x2300d0,_0x77326f){_0x77326f=_0x77326f||0xcc;return function(_0x5cb395){if(_0x5cb395){return _0x2300d0['sendStatus'](_0x77326f);}return _0x2300d0[_0x05ce('0x17')](_0x77326f)[_0x05ce('0x18')]();};}function respondWithResult(_0x27e178,_0x56ba0f){_0x56ba0f=_0x56ba0f||0xc8;return function(_0x574773){if(_0x574773){return _0x27e178[_0x05ce('0x17')](_0x56ba0f)[_0x05ce('0x19')](_0x574773);}};}function respondWithFilteredResult(_0x111038,_0x1a141c){return function(_0x337220){if(_0x337220){var _0x4514df=_0x337220['count'],_0x5b2d4d=_0x1a141c['offset'],_0x3f66d2=_0x1a141c[_0x05ce('0x1a')]+_0x1a141c[_0x05ce('0x1b')],_0x5a3873;if(_0x3f66d2>=_0x4514df){_0x3f66d2=_0x4514df;_0x5a3873=0xc8;}else{_0x5a3873=0xce;}_0x111038[_0x05ce('0x17')](_0x5a3873);return _0x111038['set'](_0x05ce('0x1c'),_0x5b2d4d+'-'+_0x3f66d2+'/'+_0x4514df)[_0x05ce('0x19')](_0x337220);}return null;};}function patchUpdates(_0x1fe284){return function(_0x35073e){try{jsonpatch[_0x05ce('0x1d')](_0x35073e,_0x1fe284,!![]);}catch(_0x3cfb89){return BPromise[_0x05ce('0x1e')](_0x3cfb89);}return _0x35073e['save']();};}function saveUpdates(_0x1661ec,_0xc72d6){return function(_0x21c4ae){if(_0x21c4ae){return _0x21c4ae['update'](_0x1661ec)[_0x05ce('0x1f')](function(_0x2e38e5){return _0x2e38e5;});}return null;};}function removeEntity(_0x32dc8e,_0x4b7948){return function(_0x46eea4){if(_0x46eea4){return _0x46eea4[_0x05ce('0x20')]()[_0x05ce('0x1f')](function(){_0x32dc8e[_0x05ce('0x17')](0xcc)[_0x05ce('0x18')]();});}};}function handleEntityNotFound(_0x191589,_0xaa7b96){return function(_0x5c8a88){if(!_0x5c8a88){_0x191589[_0x05ce('0x21')](0x194);}return _0x5c8a88;};}function handleError(_0x38f14a,_0x500cef){_0x500cef=_0x500cef||0x1f4;return function(_0x44caf4){logger[_0x05ce('0x22')](_0x44caf4['stack']);if(_0x44caf4['name']){delete _0x44caf4[_0x05ce('0x23')];}_0x38f14a[_0x05ce('0x17')](_0x500cef)[_0x05ce('0x24')](_0x44caf4);};}exports[_0x05ce('0x25')]=function(_0x5d1502,_0x62f53d){var _0x1fac83={},_0x59d94c={},_0x48272a={'count':0x0,'rows':[]};var _0x50c823=_[_0x05ce('0x26')](db[_0x05ce('0x27')]['rawAttributes'],function(_0x85399f){return{'name':_0x85399f[_0x05ce('0x28')],'type':_0x85399f[_0x05ce('0x29')][_0x05ce('0x2a')]};});_0x59d94c[_0x05ce('0x2b')]=_[_0x05ce('0x26')](_0x50c823,'name');_0x59d94c[_0x05ce('0x2c')]=_[_0x05ce('0x2d')](_0x5d1502[_0x05ce('0x2c')]);_0x59d94c[_0x05ce('0x2e')]=_['intersection'](_0x59d94c[_0x05ce('0x2b')],_0x59d94c[_0x05ce('0x2c')]);_0x1fac83[_0x05ce('0x2f')]=_[_0x05ce('0x30')](_0x59d94c[_0x05ce('0x2b')],qs['fields'](_0x5d1502[_0x05ce('0x2c')]['fields']));_0x1fac83[_0x05ce('0x2f')]=_0x1fac83['attributes'][_0x05ce('0x31')]?_0x1fac83[_0x05ce('0x2f')]:_0x59d94c[_0x05ce('0x2b')];if(!_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x32')](_0x05ce('0x33'))){_0x1fac83['limit']=qs['limit'](_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x1b')]);_0x1fac83[_0x05ce('0x1a')]=qs[_0x05ce('0x1a')](_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x1a')]);}_0x1fac83[_0x05ce('0x34')]=qs[_0x05ce('0x35')](_0x5d1502[_0x05ce('0x2c')][_0x05ce('0x35')]);_0x1fac83['where']=qs[_0x05ce('0x2e')](_['pick'](_0x5d1502[_0x05ce('0x2c')],_0x59d94c[_0x05ce('0x2e')]),_0x50c823);if(_0x5d1502[_0x05ce('0x2c')]['filter']){_0x1fac83['where']=_[_0x05ce('0x36')](_0x1fac83[_0x05ce('0x37')],{'$or':_['map'](_0x50c823,function(_0x281699){if(_0x281699['type']!==_0x05ce('0x38')){var _0x2b5cbf={};_0x2b5cbf[_0x281699[_0x05ce('0x23')]]={'$like':'%'+_0x5d1502[_0x05ce('0x2c')]['filter']+'%'};return _0x2b5cbf;}})});}_0x1fac83=_['merge']({},_0x1fac83,_0x5d1502['options']);var _0x5d14b8={'where':_0x1fac83['where']};return db[_0x05ce('0x27')][_0x05ce('0x39')](_0x5d14b8)[_0x05ce('0x1f')](function(_0x4516ad){_0x48272a['count']=_0x4516ad;if(_0x5d1502['query'][_0x05ce('0x3a')]){_0x1fac83[_0x05ce('0x3b')]=[{'all':!![]}];}return db[_0x05ce('0x27')][_0x05ce('0x3c')](_0x1fac83);})['then'](function(_0x59ac6e){_0x48272a['rows']=_0x59ac6e;return _0x48272a;})[_0x05ce('0x1f')](respondWithFilteredResult(_0x62f53d,_0x1fac83))[_0x05ce('0x3d')](handleError(_0x62f53d,null));};exports['show']=function(_0x5e8bba,_0x356aff){var _0x2ae479={'raw':!![],'where':{'id':_0x5e8bba[_0x05ce('0x3e')]['id']}},_0x45edd1={};_0x45edd1[_0x05ce('0x2b')]=_[_0x05ce('0x2d')](db[_0x05ce('0x27')][_0x05ce('0x3f')]);_0x45edd1[_0x05ce('0x2c')]=_[_0x05ce('0x2d')](_0x5e8bba[_0x05ce('0x2c')]);_0x45edd1[_0x05ce('0x2e')]=_[_0x05ce('0x30')](_0x45edd1['model'],_0x45edd1[_0x05ce('0x2c')]);_0x2ae479[_0x05ce('0x2f')]=_[_0x05ce('0x30')](_0x45edd1[_0x05ce('0x2b')],qs[_0x05ce('0x40')](_0x5e8bba['query'][_0x05ce('0x40')]));_0x2ae479[_0x05ce('0x2f')]=_0x2ae479[_0x05ce('0x2f')][_0x05ce('0x31')]?_0x2ae479[_0x05ce('0x2f')]:_0x45edd1[_0x05ce('0x2b')];if(_0x5e8bba[_0x05ce('0x2c')][_0x05ce('0x3a')]){_0x2ae479['include']=[{'all':!![]}];}_0x2ae479=_['merge']({},_0x2ae479,_0x5e8bba[_0x05ce('0x41')]);return db['JscriptyAnswerReport'][_0x05ce('0x42')](_0x2ae479)[_0x05ce('0x1f')](handleEntityNotFound(_0x356aff,null))[_0x05ce('0x1f')](respondWithResult(_0x356aff,null))[_0x05ce('0x3d')](handleError(_0x356aff,null));};exports[_0x05ce('0x43')]=function(_0x1fa6cc,_0x57edd8){return db[_0x05ce('0x27')][_0x05ce('0x43')](_0x1fa6cc[_0x05ce('0x44')],{})[_0x05ce('0x1f')](respondWithResult(_0x57edd8,0xc9))['catch'](handleError(_0x57edd8,null));};exports[_0x05ce('0x45')]=function(_0x308fc9,_0x5ebce1){if(_0x308fc9['body']['id']){delete _0x308fc9[_0x05ce('0x44')]['id'];}return db[_0x05ce('0x27')][_0x05ce('0x42')]({'where':{'id':_0x308fc9[_0x05ce('0x3e')]['id']}})[_0x05ce('0x1f')](handleEntityNotFound(_0x5ebce1,null))[_0x05ce('0x1f')](saveUpdates(_0x308fc9[_0x05ce('0x44')],null))[_0x05ce('0x1f')](respondWithResult(_0x5ebce1,null))[_0x05ce('0x3d')](handleError(_0x5ebce1,null));};exports[_0x05ce('0x20')]=function(_0x5a25ec,_0x3338a4){return db['JscriptyAnswerReport'][_0x05ce('0x42')]({'where':{'id':_0x5a25ec[_0x05ce('0x3e')]['id']}})[_0x05ce('0x1f')](handleEntityNotFound(_0x3338a4,null))[_0x05ce('0x1f')](removeEntity(_0x3338a4,null))['catch'](handleError(_0x3338a4,null));};exports['describe']=function(_0xf4a21,_0x1ff886){return db['JscriptyAnswerReport'][_0x05ce('0x46')]()[_0x05ce('0x1f')](respondWithResult(_0x1ff886,null))[_0x05ce('0x3d')](handleError(_0x1ff886,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index f87079d..b5bf75e 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 _0xd450=['define','report_jscripty_answers','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x5d7bab,_0x50baf5){var _0x504de1=function(_0x243f79){while(--_0x243f79){_0x5d7bab['push'](_0x5d7bab['shift']());}};_0x504de1(++_0x50baf5);}(_0xd450,0x1e2));var _0x0d45=function(_0x39d6c4,_0x4255fa){_0x39d6c4=_0x39d6c4-0x0;var _0x1d206e=_0xd450[_0x39d6c4];return _0x1d206e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d45('0x0'))(_0x0d45('0x1'));var moment=require(_0x0d45('0x2'));var BPromise=require(_0x0d45('0x3'));var rp=require(_0x0d45('0x4'));var fs=require('fs');var path=require(_0x0d45('0x5'));var rimraf=require(_0x0d45('0x6'));var config=require(_0x0d45('0x7'));var attributes=require(_0x0d45('0x8'));module[_0x0d45('0x9')]=function(_0x2f4930,_0x2339c8){return _0x2f4930[_0x0d45('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x0d45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf34d=['./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf34d,0x153));var _0xdf34=function(_0x190659,_0x438027){_0x190659=_0x190659-0x0;var _0x348c66=_0xf34d[_0x190659];return _0x348c66;};'use strict';var _=require(_0xdf34('0x0'));var util=require('util');var logger=require(_0xdf34('0x1'))(_0xdf34('0x2'));var moment=require(_0xdf34('0x3'));var BPromise=require(_0xdf34('0x4'));var rp=require(_0xdf34('0x5'));var fs=require('fs');var path=require(_0xdf34('0x6'));var rimraf=require(_0xdf34('0x7'));var config=require(_0xdf34('0x8'));var attributes=require(_0xdf34('0x9'));module[_0xdf34('0xa')]=function(_0x272391,_0x36c91c){return _0x272391['define'](_0xdf34('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ff6708f..7281ccd 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 _0xc29f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2bd368,_0x2e2bc0){var _0x319b2a=function(_0x4d12cd){while(--_0x4d12cd){_0x2bd368['push'](_0x2bd368['shift']());}};_0x319b2a(++_0x2e2bc0);}(_0xc29f,0x176));var _0xfc29=function(_0x4fe6c0,_0x21d0dc){_0x4fe6c0=_0x4fe6c0-0x0;var _0x56e77b=_0xc29f[_0x4fe6c0];return _0x56e77b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc29('0x0'));var BPromise=require(_0xfc29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc29('0x2'));var db=require(_0xfc29('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc29('0x4'))(_0xfc29('0x5'));var config=require(_0xfc29('0x6'));var jayson=require(_0xfc29('0x7'));var client=jayson[_0xfc29('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe9b513,_0x5985ae,_0x35371d){return new BPromise(function(_0x297852,_0x39d5b7){return client[_0xfc29('0x9')](_0xe9b513,_0x35371d)[_0xfc29('0xa')](function(_0x43b617){logger[_0xfc29('0xb')](_0xfc29('0xc'),_0x5985ae,_0xfc29('0xd'));logger[_0xfc29('0xe')](_0xfc29('0xf'),_0x5985ae,_0xfc29('0xd'),JSON['stringify'](_0x43b617));if(_0x43b617[_0xfc29('0x10')]){if(_0x43b617[_0xfc29('0x10')]['code']===0x1f4){logger['error'](_0xfc29('0xc'),_0x5985ae,_0x43b617[_0xfc29('0x10')][_0xfc29('0x11')]);return _0x39d5b7(_0x43b617[_0xfc29('0x10')][_0xfc29('0x11')]);}logger['error'](_0xfc29('0xc'),_0x5985ae,_0x43b617['error'][_0xfc29('0x11')]);return _0x297852(_0x43b617['error'][_0xfc29('0x11')]);}else{logger[_0xfc29('0xb')](_0xfc29('0xc'),_0x5985ae,'request\x20sent');_0x297852(_0x43b617['result'][_0xfc29('0x11')]);}})['catch'](function(_0x5c8ab4){logger['error'](_0xfc29('0xc'),_0x5985ae,_0x5c8ab4);_0x39d5b7(_0x5c8ab4);});});} \ No newline at end of file +var _0x4f02=['info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x4f02,0xbe));var _0x24f0=function(_0x21f66e,_0x20afcf){_0x21f66e=_0x21f66e-0x0;var _0x2a960f=_0x4f02[_0x21f66e];return _0x2a960f;};'use strict';var _=require(_0x24f0('0x0'));var util=require(_0x24f0('0x1'));var moment=require(_0x24f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x24f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24f0('0x4'))['db'];var utils=require(_0x24f0('0x5'));var logger=require(_0x24f0('0x6'))(_0x24f0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1786bd,_0x2cb55c,_0x334dd9){return new BPromise(function(_0x451f60,_0x30710e){return client[_0x24f0('0x8')](_0x1786bd,_0x334dd9)[_0x24f0('0x9')](function(_0x12eba1){logger[_0x24f0('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cb55c,_0x24f0('0xb'));logger[_0x24f0('0xc')](_0x24f0('0xd'),_0x2cb55c,_0x24f0('0xb'),JSON['stringify'](_0x12eba1));if(_0x12eba1[_0x24f0('0xe')]){if(_0x12eba1[_0x24f0('0xe')][_0x24f0('0xf')]===0x1f4){logger[_0x24f0('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cb55c,_0x12eba1['error'][_0x24f0('0x10')]);return _0x30710e(_0x12eba1[_0x24f0('0xe')]['message']);}logger[_0x24f0('0xe')](_0x24f0('0x11'),_0x2cb55c,_0x12eba1[_0x24f0('0xe')][_0x24f0('0x10')]);return _0x451f60(_0x12eba1[_0x24f0('0xe')][_0x24f0('0x10')]);}else{logger[_0x24f0('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cb55c,_0x24f0('0xb'));_0x451f60(_0x12eba1[_0x24f0('0x12')][_0x24f0('0x10')]);}})[_0x24f0('0x13')](function(_0x96a77b){logger[_0x24f0('0xe')](_0x24f0('0x11'),_0x2cb55c,_0x96a77b);_0x30710e(_0x96a77b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1461a2b..5432469 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 _0x44e6=['isAuthenticated','index','get','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./jscriptyProject.controller'];(function(_0x56184d,_0x384b9b){var _0x23349b=function(_0x24907f){while(--_0x24907f){_0x56184d['push'](_0x56184d['shift']());}};_0x23349b(++_0x384b9b);}(_0x44e6,0xda));var _0x644e=function(_0xeb2e5c,_0x4c4316){_0xeb2e5c=_0xeb2e5c-0x0;var _0x449f83=_0x44e6[_0xeb2e5c];return _0x449f83;};'use strict';var multer=require(_0x644e('0x0'));var util=require(_0x644e('0x1'));var path=require('path');var timeout=require(_0x644e('0x2'));var express=require(_0x644e('0x3'));var router=express[_0x644e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x644e('0x5'));var config=require('../../config/environment');var controller=require(_0x644e('0x6'));router['get']('/',auth[_0x644e('0x7')](),controller[_0x644e('0x8')]);router[_0x644e('0x9')]('/:id',auth[_0x644e('0x7')](),controller['show']);router[_0x644e('0x9')](_0x644e('0xa'),auth['isAuthenticated'](),controller[_0x644e('0xb')]);router['get'](_0x644e('0xc'),auth[_0x644e('0x7')](),controller[_0x644e('0xd')]);router[_0x644e('0x9')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x644e('0xe')),controller[_0x644e('0xf')]);router[_0x644e('0x10')]('/',auth[_0x644e('0x7')](),controller['create']);router['post'](_0x644e('0x11'),auth[_0x644e('0x7')](),controller[_0x644e('0x12')]);router[_0x644e('0x13')](_0x644e('0x14'),auth[_0x644e('0x7')](),controller[_0x644e('0x15')]);router[_0x644e('0x16')](_0x644e('0x14'),auth[_0x644e('0x7')](),controller[_0x644e('0x17')]);module[_0x644e('0x18')]=router; \ No newline at end of file +var _0x03ec=['create','/:id/clone','clone','put','/:id','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','index','get','isAuthenticated','/:id/sessions','/:id/answers','/:id/summary','post'];(function(_0x2dab9c,_0x42e513){var _0x400996=function(_0xed5b37){while(--_0xed5b37){_0x2dab9c['push'](_0x2dab9c['shift']());}};_0x400996(++_0x42e513);}(_0x03ec,0x85));var _0xc03e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc03e('0x0'));var util=require(_0xc03e('0x1'));var path=require('path');var timeout=require(_0xc03e('0x2'));var express=require('express');var router=express[_0xc03e('0x3')]();var auth=require(_0xc03e('0x4'));var interaction=require(_0xc03e('0x5'));var config=require('../../config/environment');var controller=require(_0xc03e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc03e('0x7')]);router[_0xc03e('0x8')]('/:id',auth[_0xc03e('0x9')](),controller['show']);router[_0xc03e('0x8')](_0xc03e('0xa'),auth[_0xc03e('0x9')](),controller['getSessions']);router[_0xc03e('0x8')](_0xc03e('0xb'),auth[_0xc03e('0x9')](),controller['getAnswers']);router['get'](_0xc03e('0xc'),auth[_0xc03e('0x9')](),timeout('30s'),controller['getSummary']);router[_0xc03e('0xd')]('/',auth[_0xc03e('0x9')](),controller[_0xc03e('0xe')]);router[_0xc03e('0xd')](_0xc03e('0xf'),auth[_0xc03e('0x9')](),controller[_0xc03e('0x10')]);router[_0xc03e('0x11')](_0xc03e('0x12'),auth[_0xc03e('0x9')](),controller[_0xc03e('0x13')]);router[_0xc03e('0x14')](_0xc03e('0x12'),auth[_0xc03e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 84cb513..5b762a9 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 _0x146e=['lodash','util','exports','STRING','name','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','BOOLEAN'];(function(_0x55c0d8,_0x344327){var _0x28a252=function(_0x17048b){while(--_0x17048b){_0x55c0d8['push'](_0x55c0d8['shift']());}};_0x28a252(++_0x344327);}(_0x146e,0x152));var _0xe146=function(_0x2cfd0e,_0x29e7d0){_0x2cfd0e=_0x2cfd0e-0x0;var _0x1e782d=_0x146e[_0x2cfd0e];return _0x1e782d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe146('0x0'));var util=require(_0xe146('0x1'));module[_0xe146('0x2')]={'name':{'type':Sequelize[_0xe146('0x3')],'unique':_0xe146('0x4')},'description':{'type':Sequelize[_0xe146('0x3')]},'formData':{'type':Sequelize['TEXT'](_0xe146('0x5')),'set':function(_0xcf2ee9){if(_[_0xe146('0x6')](_0xcf2ee9)){this[_0xe146('0x7')]('formData',JSON['stringify'](_0xcf2ee9));}else if(_[_0xe146('0x8')](_0xcf2ee9)){this[_0xe146('0x7')]('formData',_0xcf2ee9);}else{this['setDataValue'](_0xe146('0x9'),util[_0xe146('0xa')](_0xe146('0xb'),this['getDataValue'](_0xe146('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe146('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe146('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x4e0a=['TEXT','long','setDataValue','formData','stringify','format','getDataValue','BOOLEAN','util','exports','STRING'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x4e0a,0x110));var _0xa4e0=function(_0xdb47d8,_0x933e5b){_0xdb47d8=_0xdb47d8-0x0;var _0x5cdfd9=_0x4e0a[_0xdb47d8];return _0x5cdfd9;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0xa4e0('0x0'));module[_0xa4e0('0x1')]={'name':{'type':Sequelize[_0xa4e0('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xa4e0('0x2')]},'formData':{'type':Sequelize[_0xa4e0('0x3')](_0xa4e0('0x4')),'set':function(_0x159c13){if(_['isObjectLike'](_0x159c13)){this[_0xa4e0('0x5')](_0xa4e0('0x6'),JSON[_0xa4e0('0x7')](_0x159c13));}else if(_['isString'](_0x159c13)){this['setDataValue']('formData',_0x159c13);}else{this['setDataValue'](_0xa4e0('0x6'),util[_0xa4e0('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xa4e0('0x9')]('name')||'',this[_0xa4e0('0x9')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa4e0('0xa')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 572737b..58d1e6d 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 _0x096c=['question','format','SessionId','answer','isEmpty','now','setHeader','Content-disposition','Content-type','text/csv','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','role','Projects','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ProjectId','JscriptySessionReport','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','findAll','-createdAt','questionId'];(function(_0x225634,_0x2822e2){var _0x2f3c62=function(_0x4ffe0e){while(--_0x4ffe0e){_0x225634['push'](_0x225634['shift']());}};_0x2f3c62(++_0x2822e2);}(_0x096c,0xea));var _0xc096=function(_0x191852,_0x6d4c72){_0x191852=_0x191852-0x0;var _0x506d7c=_0x096c[_0x191852];return _0x506d7c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc096('0x0'));var rimraf=require(_0xc096('0x1'));var zipdir=require(_0xc096('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc096('0x3'));var moment=require(_0xc096('0x4'));var BPromise=require(_0xc096('0x5'));var Mustache=require(_0xc096('0x6'));var util=require(_0xc096('0x7'));var path=require(_0xc096('0x8'));var sox=require(_0xc096('0x9'));var csv=require(_0xc096('0xa'));var ejs=require(_0xc096('0xb'));var fs=require('fs');var _=require(_0xc096('0xc'));var squel=require('squel');var crypto=require(_0xc096('0xd'));var jsforce=require(_0xc096('0xe'));var deskjs=require(_0xc096('0xf'));var toCsv=require(_0xc096('0xa'));var querystring=require(_0xc096('0x10'));var Papa=require(_0xc096('0x11'));var Redis=require(_0xc096('0x12'));var authService=require(_0xc096('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc096('0x14'));var hardwareService=require(_0xc096('0x15'));var logger=require('../../config/logger')(_0xc096('0x16'));var utils=require('../../config/utils');var config=require(_0xc096('0x17'));var licenseUtil=require(_0xc096('0x18'));var db=require(_0xc096('0x19'))['db'];function respondWithStatusCode(_0x799368,_0x5211ed){_0x5211ed=_0x5211ed||0xcc;return function(_0x5a0fc3){if(_0x5a0fc3){return _0x799368['sendStatus'](_0x5211ed);}return _0x799368[_0xc096('0x1a')](_0x5211ed)[_0xc096('0x1b')]();};}function respondWithResult(_0x20b76a,_0x35e436){_0x35e436=_0x35e436||0xc8;return function(_0x3671e2){if(_0x3671e2){return _0x20b76a[_0xc096('0x1a')](_0x35e436)[_0xc096('0x1c')](_0x3671e2);}};}function respondWithFilteredResult(_0x532a00,_0x4c0c9f){return function(_0x523c1b){if(_0x523c1b){var _0x4213bb=_0x523c1b['count'],_0xca875b=_0x4c0c9f[_0xc096('0x1d')],_0x2c8e47=_0x4c0c9f[_0xc096('0x1d')]+_0x4c0c9f[_0xc096('0x1e')],_0x15fb95;if(_0x2c8e47>=_0x4213bb){_0x2c8e47=_0x4213bb;_0x15fb95=0xc8;}else{_0x15fb95=0xce;}_0x532a00[_0xc096('0x1a')](_0x15fb95);return _0x532a00[_0xc096('0x1f')]('Content-Range',_0xca875b+'-'+_0x2c8e47+'/'+_0x4213bb)[_0xc096('0x1c')](_0x523c1b);}return null;};}function patchUpdates(_0x4f654d){return function(_0x5ed445){try{jsonpatch[_0xc096('0x20')](_0x5ed445,_0x4f654d,!![]);}catch(_0x3b742b){return BPromise['reject'](_0x3b742b);}return _0x5ed445['save']();};}function saveUpdates(_0x6ac8c9,_0x12ae27){return function(_0x16d087){if(_0x16d087){return _0x16d087[_0xc096('0x21')](_0x6ac8c9)[_0xc096('0x22')](function(_0x31dfa9){return _0x31dfa9;});}return null;};}function removeEntity(_0x3a272d,_0x6f6439){return function(_0x18d973){if(_0x18d973){return _0x18d973[_0xc096('0x23')]()[_0xc096('0x22')](function(){var _0x16492e=_0x18d973[_0xc096('0x24')]({'plain':!![]});var _0x3ddfc1='Projects';return db[_0xc096('0x25')][_0xc096('0x23')]({'where':{'type':_0x3ddfc1,'resourceId':_0x16492e['id']}})[_0xc096('0x22')](function(){return _0x18d973;});})[_0xc096('0x22')](function(){_0x3a272d[_0xc096('0x1a')](0xcc)[_0xc096('0x1b')]();});}};}function handleEntityNotFound(_0x3d12cf,_0x2d8721){return function(_0x3f500e){if(!_0x3f500e){_0x3d12cf[_0xc096('0x26')](0x194);}return _0x3f500e;};}function handleError(_0x523aea,_0x461399){_0x461399=_0x461399||0x1f4;return function(_0x86f2b){logger['error'](_0x86f2b[_0xc096('0x27')]);if(_0x86f2b[_0xc096('0x28')]){delete _0x86f2b[_0xc096('0x28')];}_0x523aea[_0xc096('0x1a')](_0x461399)[_0xc096('0x29')](_0x86f2b);};}exports[_0xc096('0x2a')]=function(_0x5a43c9,_0x11b3c3){var _0x195d76={},_0x5b35f4={},_0x325993={'count':0x0,'rows':[]};var _0x98cfeb=_[_0xc096('0x2b')](db[_0xc096('0x2c')][_0xc096('0x2d')],function(_0x339f58){return{'name':_0x339f58[_0xc096('0x2e')],'type':_0x339f58[_0xc096('0x2f')]['key']};});_0x5b35f4['model']=_[_0xc096('0x2b')](_0x98cfeb,_0xc096('0x28'));_0x5b35f4[_0xc096('0x30')]=_[_0xc096('0x31')](_0x5a43c9[_0xc096('0x30')]);_0x5b35f4[_0xc096('0x32')]=_[_0xc096('0x33')](_0x5b35f4[_0xc096('0x34')],_0x5b35f4[_0xc096('0x30')]);_0x195d76[_0xc096('0x35')]=_[_0xc096('0x33')](_0x5b35f4[_0xc096('0x34')],qs[_0xc096('0x36')](_0x5a43c9[_0xc096('0x30')]['fields']));_0x195d76[_0xc096('0x35')]=_0x195d76[_0xc096('0x35')][_0xc096('0x37')]?_0x195d76['attributes']:_0x5b35f4[_0xc096('0x34')];if(!_0x5a43c9[_0xc096('0x30')][_0xc096('0x38')](_0xc096('0x39'))){_0x195d76['limit']=qs[_0xc096('0x1e')](_0x5a43c9['query'][_0xc096('0x1e')]);_0x195d76['offset']=qs['offset'](_0x5a43c9['query']['offset']);}_0x195d76[_0xc096('0x3a')]=qs[_0xc096('0x3b')](_0x5a43c9[_0xc096('0x30')][_0xc096('0x3b')]);_0x195d76[_0xc096('0x3c')]=qs[_0xc096('0x32')](_[_0xc096('0x3d')](_0x5a43c9[_0xc096('0x30')],_0x5b35f4[_0xc096('0x32')]),_0x98cfeb);if(_0x5a43c9[_0xc096('0x30')][_0xc096('0x3e')]){_0x195d76['where']=_[_0xc096('0x3f')](_0x195d76['where'],{'$or':_[_0xc096('0x2b')](_0x98cfeb,function(_0x1bbf83){if(_0x1bbf83[_0xc096('0x2f')]!==_0xc096('0x40')){var _0x1275fa={};_0x1275fa[_0x1bbf83[_0xc096('0x28')]]={'$like':'%'+_0x5a43c9[_0xc096('0x30')][_0xc096('0x3e')]+'%'};return _0x1275fa;}})});}_0x195d76=_['merge']({},_0x195d76,_0x5a43c9[_0xc096('0x41')]);var _0xf6be0f={'where':_0x195d76[_0xc096('0x3c')]};return db[_0xc096('0x2c')]['count'](_0xf6be0f)['then'](function(_0x348a09){_0x325993[_0xc096('0x42')]=_0x348a09;if(_0x5a43c9[_0xc096('0x30')][_0xc096('0x43')]){_0x195d76[_0xc096('0x44')]=[{'all':!![]}];}return db[_0xc096('0x2c')]['findAll'](_0x195d76);})[_0xc096('0x22')](function(_0x30b154){_0x325993[_0xc096('0x45')]=_0x30b154;return _0x325993;})[_0xc096('0x22')](respondWithFilteredResult(_0x11b3c3,_0x195d76))[_0xc096('0x46')](handleError(_0x11b3c3,null));};exports['show']=function(_0xfef1cf,_0x5cbda0){var _0x18598f={'raw':![],'where':{'id':_0xfef1cf[_0xc096('0x47')]['id']}},_0x505cd2={};_0x505cd2[_0xc096('0x34')]=_[_0xc096('0x31')](db[_0xc096('0x2c')][_0xc096('0x2d')]);_0x505cd2[_0xc096('0x30')]=_[_0xc096('0x31')](_0xfef1cf[_0xc096('0x30')]);_0x505cd2[_0xc096('0x32')]=_[_0xc096('0x33')](_0x505cd2[_0xc096('0x34')],_0x505cd2['query']);_0x18598f[_0xc096('0x35')]=_[_0xc096('0x33')](_0x505cd2['model'],qs[_0xc096('0x36')](_0xfef1cf['query'][_0xc096('0x36')]));_0x18598f[_0xc096('0x35')]=_0x18598f[_0xc096('0x35')]['length']?_0x18598f['attributes']:_0x505cd2[_0xc096('0x34')];if(_0xfef1cf[_0xc096('0x30')][_0xc096('0x43')]){_0x18598f[_0xc096('0x44')]=[{'all':!![]}];}_0x18598f=_[_0xc096('0x3f')]({},_0x18598f,_0xfef1cf[_0xc096('0x41')]);return db[_0xc096('0x2c')][_0xc096('0x48')](_0x18598f)['then'](handleEntityNotFound(_0x5cbda0,null))[_0xc096('0x22')](respondWithResult(_0x5cbda0,null))[_0xc096('0x46')](handleError(_0x5cbda0,null));};exports[_0xc096('0x49')]=function(_0x44d64c,_0x3ac94d){return db['JscriptyProject'][_0xc096('0x49')](_0x44d64c[_0xc096('0x4a')],{})[_0xc096('0x22')](function(_0x5709ff){var _0x3e3491=_0x44d64c['user'][_0xc096('0x24')]({'plain':!![]});if(!_0x3e3491)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e3491[_0xc096('0x4b')]==='user'){var _0x371638=_0x5709ff[_0xc096('0x24')]({'plain':!![]});var _0x240577=_0xc096('0x4c');return db[_0xc096('0x4d')]['find']({'where':{'name':_0x240577,'userProfileId':_0x3e3491[_0xc096('0x4e')]},'raw':!![]})['then'](function(_0x57e64f){if(_0x57e64f&&_0x57e64f[_0xc096('0x4f')]===0x0){return db['UserProfileResource'][_0xc096('0x49')]({'name':_0x371638[_0xc096('0x28')],'resourceId':_0x371638['id'],'type':_0x57e64f[_0xc096('0x28')],'sectionId':_0x57e64f['id']},{})[_0xc096('0x22')](function(){return _0x5709ff;});}else{return _0x5709ff;}})['catch'](function(_0x27f69d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27f69d);throw _0x27f69d;});}return _0x5709ff;})[_0xc096('0x22')](respondWithResult(_0x3ac94d,0xc9))['catch'](handleError(_0x3ac94d,null));};exports[_0xc096('0x50')]=function(_0x114e3f,_0x35dc7f){var _0x1e14de={'where':{'id':_0x114e3f[_0xc096('0x47')]['id']}},_0x290541={};_0x290541['model']=_[_0xc096('0x31')](db[_0xc096('0x2c')][_0xc096('0x2d')]);_0x1e14de['attributes']=_['intersection'](_0x290541[_0xc096('0x34')],qs[_0xc096('0x36')](_0x114e3f[_0xc096('0x30')][_0xc096('0x36')]));_0x1e14de[_0xc096('0x35')]=_0x1e14de[_0xc096('0x35')][_0xc096('0x37')]?_0x1e14de[_0xc096('0x35')]:_0x290541['model'];if(_0x114e3f[_0xc096('0x30')][_0xc096('0x43')]){_0x1e14de['include']=[{'all':!![]}];}_0x1e14de=_[_0xc096('0x3f')]({},_0x1e14de,_0x114e3f['options']);return db['JscriptyProject'][_0xc096('0x48')](_0x1e14de)[_0xc096('0x22')](handleEntityNotFound(_0x35dc7f,null))[_0xc096('0x22')](function(_0x250c7b){if(_0x250c7b){var _0x582358=_0x250c7b[_0xc096('0x24')]({'plain':!![]});_0x582358=qs['omit'](_0x582358,['id',_0xc096('0x51'),_0xc096('0x52')]);_0x114e3f[_0xc096('0x4a')]=_['omit'](_0x114e3f[_0xc096('0x4a')],['id',_0xc096('0x51'),_0xc096('0x52')]);return db[_0xc096('0x2c')][_0xc096('0x49')](_[_0xc096('0x3f')](_0x582358,_0x114e3f[_0xc096('0x4a')]),{'include':_0x114e3f['query'][_0xc096('0x43')]?[{'all':!![]}]:undefined})[_0xc096('0x22')](function(_0x270fbc){var _0x52e116=_0x114e3f[_0xc096('0x53')][_0xc096('0x24')]({'plain':!![]});if(!_0x52e116)throw new Error(_0xc096('0x54'));if(_0x52e116[_0xc096('0x4b')]===_0xc096('0x53')){var _0x2f9ceb=_0x270fbc['get']({'plain':!![]});var _0x48b7b6='Projects';return db[_0xc096('0x4d')][_0xc096('0x48')]({'where':{'name':_0x48b7b6,'userProfileId':_0x52e116[_0xc096('0x4e')]},'raw':!![]})['then'](function(_0x1970b8){if(_0x1970b8&&_0x1970b8[_0xc096('0x4f')]===0x0){return db[_0xc096('0x25')][_0xc096('0x49')]({'name':_0x2f9ceb['name'],'resourceId':_0x2f9ceb['id'],'type':_0x1970b8['name'],'sectionId':_0x1970b8['id']},{})['then'](function(){return _0x270fbc;});}else{return _0x270fbc;}})[_0xc096('0x46')](function(_0x1fd79c){logger[_0xc096('0x55')](_0xc096('0x56'),_0x1fd79c);throw _0x1fd79c;});}return _0x270fbc;});}})[_0xc096('0x22')](respondWithResult(_0x35dc7f,0xc9))[_0xc096('0x46')](handleError(_0x35dc7f,null));};exports[_0xc096('0x21')]=function(_0x29c91e,_0x340a36){if(_0x29c91e[_0xc096('0x4a')]['id']){delete _0x29c91e['body']['id'];}return db[_0xc096('0x2c')]['find']({'where':{'id':_0x29c91e[_0xc096('0x47')]['id']}})['then'](handleEntityNotFound(_0x340a36,null))[_0xc096('0x22')](saveUpdates(_0x29c91e['body'],null))['then'](respondWithResult(_0x340a36,null))['catch'](handleError(_0x340a36,null));};exports[_0xc096('0x23')]=function(_0x44f691,_0x20f128){return db[_0xc096('0x2c')]['find']({'where':{'id':_0x44f691[_0xc096('0x47')]['id']}})[_0xc096('0x22')](handleEntityNotFound(_0x20f128,null))[_0xc096('0x22')](removeEntity(_0x20f128,null))[_0xc096('0x46')](handleError(_0x20f128,null));};exports['getSessions']=function(_0x28100b,_0x53828a,_0x4d1533){var _0x5b7d40={'raw':!![],'where':{}};var _0x429583={};var _0x1094db={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x28100b[_0xc096('0x47')]['id']}})[_0xc096('0x22')](handleEntityNotFound(_0x53828a,null))['then'](function(_0x5a6d96){if(_0x5a6d96){_0x429583['model']=_[_0xc096('0x31')](db['JscriptySessionReport'][_0xc096('0x2d')]);_0x429583['query']=_[_0xc096('0x31')](_0x28100b[_0xc096('0x30')]);_0x429583[_0xc096('0x32')]=_[_0xc096('0x33')](_0x429583[_0xc096('0x34')],_0x429583[_0xc096('0x30')]);_0x5b7d40['attributes']=_['intersection'](_0x429583[_0xc096('0x34')],qs[_0xc096('0x36')](_0x28100b[_0xc096('0x30')][_0xc096('0x36')]));_0x5b7d40[_0xc096('0x35')]=_0x5b7d40['attributes'][_0xc096('0x37')]?_0x5b7d40[_0xc096('0x35')]:_0x429583[_0xc096('0x34')];if(!_0x28100b[_0xc096('0x30')][_0xc096('0x38')](_0xc096('0x39'))){_0x5b7d40[_0xc096('0x1e')]=qs[_0xc096('0x1e')](_0x28100b[_0xc096('0x30')]['limit']);_0x5b7d40['offset']=qs[_0xc096('0x1d')](_0x28100b['query'][_0xc096('0x1d')]);}_0x5b7d40['order']=qs[_0xc096('0x3b')](_0x28100b[_0xc096('0x30')][_0xc096('0x3b')]);_0x5b7d40['where']=qs[_0xc096('0x32')](_[_0xc096('0x3d')](_0x28100b[_0xc096('0x30')],_0x429583[_0xc096('0x32')]));_0x5b7d40['where'][_0xc096('0x57')]=_0x5a6d96['id'];if(_0x28100b[_0xc096('0x30')][_0xc096('0x3e')]){_0x5b7d40['where']=_['merge'](_0x5b7d40['where'],{'$or':_[_0xc096('0x2b')](_0x5b7d40[_0xc096('0x35')],function(_0x40f857){var _0x5b7234={};_0x5b7234[_0x40f857]={'$like':'%'+_0x28100b[_0xc096('0x30')][_0xc096('0x3e')]+'%'};return _0x5b7234;})});}_0x5b7d40=_[_0xc096('0x3f')]({},_0x5b7d40,_0x28100b[_0xc096('0x41')]);return db['JscriptySessionReport'][_0xc096('0x42')]({'where':_0x5b7d40[_0xc096('0x3c')]})[_0xc096('0x22')](function(_0x3ef6e8){_0x1094db['count']=_0x3ef6e8;if(_0x28100b['query'][_0xc096('0x43')]){_0x5b7d40[_0xc096('0x44')]=[{'all':!![]}];}return db[_0xc096('0x58')]['findAll'](_0x5b7d40);})[_0xc096('0x22')](function(_0x2a3bfd){_0x1094db[_0xc096('0x45')]=_0x2a3bfd;return _0x1094db;});}})[_0xc096('0x22')](respondWithFilteredResult(_0x53828a,_0x5b7d40))[_0xc096('0x46')](handleError(_0x53828a,null));};exports['getAnswers']=function(_0x587b03,_0xbf5c91,_0x41e218){var _0x2529ae={'raw':!![],'where':{}};var _0x1adedf={};var _0x4b6b34={'count':0x0,'rows':[]};return db[_0xc096('0x2c')]['findOne']({'where':{'id':_0x587b03[_0xc096('0x47')]['id']}})[_0xc096('0x22')](handleEntityNotFound(_0xbf5c91,null))['then'](function(_0x4ac7c1){if(_0x4ac7c1){_0x1adedf[_0xc096('0x34')]=_['keys'](db[_0xc096('0x59')][_0xc096('0x2d')]);_0x1adedf[_0xc096('0x30')]=_['keys'](_0x587b03[_0xc096('0x30')]);_0x1adedf[_0xc096('0x32')]=_[_0xc096('0x33')](_0x1adedf[_0xc096('0x34')],_0x1adedf['query']);_0x2529ae[_0xc096('0x35')]=_['intersection'](_0x1adedf['model'],qs['fields'](_0x587b03[_0xc096('0x30')]['fields']));_0x2529ae[_0xc096('0x35')]=_0x2529ae[_0xc096('0x35')][_0xc096('0x37')]?_0x2529ae['attributes']:_0x1adedf[_0xc096('0x34')];if(!_0x587b03['query'][_0xc096('0x38')](_0xc096('0x39'))){_0x2529ae[_0xc096('0x1e')]=qs[_0xc096('0x1e')](_0x587b03[_0xc096('0x30')][_0xc096('0x1e')]);_0x2529ae[_0xc096('0x1d')]=qs[_0xc096('0x1d')](_0x587b03[_0xc096('0x30')][_0xc096('0x1d')]);}_0x2529ae[_0xc096('0x3a')]=qs['sort'](_0x587b03['query']['sort']);_0x2529ae[_0xc096('0x3c')]=qs[_0xc096('0x32')](_[_0xc096('0x3d')](_0x587b03[_0xc096('0x30')],_0x1adedf[_0xc096('0x32')]));_0x2529ae[_0xc096('0x3c')][_0xc096('0x57')]=_0x4ac7c1['id'];if(_0x587b03[_0xc096('0x30')][_0xc096('0x3e')]){_0x2529ae[_0xc096('0x3c')]=_[_0xc096('0x3f')](_0x2529ae[_0xc096('0x3c')],{'$or':_[_0xc096('0x2b')](_0x2529ae['attributes'],function(_0x404a52){var _0xf8534f={};_0xf8534f[_0x404a52]={'$like':'%'+_0x587b03['query'][_0xc096('0x3e')]+'%'};return _0xf8534f;})});}_0x2529ae=_[_0xc096('0x3f')]({},_0x2529ae,_0x587b03['options']);return db[_0xc096('0x59')][_0xc096('0x42')]({'where':_0x2529ae[_0xc096('0x3c')]})[_0xc096('0x22')](function(_0x59ce6a){_0x4b6b34[_0xc096('0x42')]=_0x59ce6a;if(_0x587b03[_0xc096('0x30')][_0xc096('0x43')]){_0x2529ae[_0xc096('0x44')]=[{'all':!![]}];}return db[_0xc096('0x59')]['findAll'](_0x2529ae);})['then'](function(_0x502dbb){_0x4b6b34[_0xc096('0x45')]=_0x502dbb;return _0x4b6b34;});}})[_0xc096('0x22')](respondWithFilteredResult(_0xbf5c91,_0x2529ae))['catch'](handleError(_0xbf5c91,null));};function char(_0x3c7375){return _0xc096('0x5a')===typeof _0x3c7375?String[_0xc096('0x5b')][_0xc096('0x20')](null,arguments):_0x3c7375;}function needsEncapsulation(_0x186d50){return!!_0x186d50&&(_0x186d50['toString']()[_0xc096('0x5c')](char(0xd))>=0x0||_0x186d50[_0xc096('0x5d')]()[_0xc096('0x5c')](char(0xa))>=0x0||_0x186d50['toString']()[_0xc096('0x5c')](char(0x2c))>=0x0||_0x186d50['toString']()[_0xc096('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x4e8394){var _0x4ea58e=char(0x22),_0xa3fb53='\x5c'+char(0x22),_0x438574=_0x4e8394[_0xc096('0x5d')]()[_0xc096('0x5e')](new RegExp(_0x4ea58e,'g'),_0xa3fb53);return _0x4ea58e+_0x438574+_0x4ea58e;}exports[_0xc096('0x5f')]=function(_0xb58dc5,_0x1cc2d0,_0x37ac75){var _0x23d5e8,_0x5ff365;var _0x532577={'where':{'ProjectId':_0xb58dc5['params']['id']}};if(_0xb58dc5[_0xc096('0x30')][_0xc096('0x60')]){_0x532577[_0xc096('0x3c')][_0xc096('0x61')]=JSON[_0xc096('0x62')](_0xb58dc5['query'][_0xc096('0x60')]);}return db['JscriptySessionReport'][_0xc096('0x63')](_0x532577)['then'](handleEntityNotFound(_0x1cc2d0,null))[_0xc096('0x22')](function(_0x5479af){if(_0x5479af){_0x23d5e8=_0x5479af;return db['JscriptyQuestionReport'][_0xc096('0x63')]({'where':{'SessionId':{'$in':_['map'](_0x23d5e8,'id')},'ProjectId':_0xb58dc5[_0xc096('0x47')]['id']},'order':_0xc096('0x64')});}})[_0xc096('0x22')](handleEntityNotFound(_0x1cc2d0,null))[_0xc096('0x22')](function(_0x49ffdf){if(_0x49ffdf){_0x5ff365=_0x49ffdf;var _0x182736={};for(var _0x31f6e=0x0,_0xe669a7=_0x5ff365['length'];_0x31f6e<_0xe669a7;_0x31f6e++){if(!_0x182736[_0xc096('0x38')](_0x5ff365[_0x31f6e]['questionId'])){_0x182736[_0x5ff365[_0x31f6e][_0xc096('0x65')]]=needsEncapsulation(_0x5ff365[_0x31f6e][_0xc096('0x66')])?encapsulate(_0x5ff365[_0x31f6e][_0xc096('0x66')]):_0x5ff365[_0x31f6e]['question'];}}var _0x2022da=[],_0x54325d={};for(var _0x2fcb10=0x0,_0x1b699b=_0x23d5e8['length'];_0x2fcb10<_0x1b699b;_0x2fcb10++){_0x54325d={'ProjectId':_0xb58dc5[_0xc096('0x47')]['id'],'SessionId':_0x23d5e8[_0x2fcb10]['id'],'StartTime':moment(_0x23d5e8[_0x2fcb10][_0xc096('0x61')])[_0xc096('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3a728f=0x0,_0x41f85b=_0x5ff365['length'];_0x3a728f<_0x41f85b;_0x3a728f++){if(_0x5ff365[_0x3a728f][_0xc096('0x68')]==_0x23d5e8[_0x2fcb10]['id']&&_0x182736[_0xc096('0x38')](_0x5ff365[_0x3a728f][_0xc096('0x65')])){_0x54325d[_0x182736[_0x5ff365[_0x3a728f][_0xc096('0x65')]]]=_0x5ff365[_0x3a728f][_0xc096('0x69')];}}for(var _0x2cfefa in _0x182736){if(!_0x54325d['hasOwnProperty'](_0x182736[_0x2cfefa])){_0x54325d[_0x182736[_0x2cfefa]]=null;}}_0x2022da['push'](_0x54325d);}return _0x2022da;}})[_0xc096('0x22')](function(_0x1085fc){if(!_[_0xc096('0x6a')](_0x1085fc)){var _0x3df238=toCsv(_0x1085fc);var _0x4b770e=Date[_0xc096('0x6b')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xb58dc5[_0xc096('0x47')]['id'],_0x4b770e),_0x3df238);_0x1cc2d0[_0xc096('0x6c')](_0xc096('0x6d'),'attachment;\x20filename='+util[_0xc096('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0xb58dc5[_0xc096('0x47')]['id'],_0x4b770e));_0x1cc2d0[_0xc096('0x6c')](_0xc096('0x6e'),_0xc096('0x6f'));return _0x1cc2d0['download'](util[_0xc096('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xb58dc5[_0xc096('0x47')]['id'],_0x4b770e));}else{return _0x1cc2d0[_0xc096('0x26')](0xcc);}})[_0xc096('0x46')](handleError(_0x1cc2d0,null));}; \ No newline at end of file +var _0x5059=['replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','JscriptyProject','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','rawAttributes','options','catch','body','role','user','UserProfileSection','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','findOne','ProjectId','JscriptySessionReport','JscriptyAnswerReport','number','fromCharCode','toString','indexOf'];(function(_0x42dcbb,_0x3bab87){var _0x597f5d=function(_0x3c93c6){while(--_0x3c93c6){_0x42dcbb['push'](_0x42dcbb['shift']());}};_0x597f5d(++_0x3bab87);}(_0x5059,0x1f0));var _0x9505=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x5059[_0x329437];return _0x3789d9;};'use strict';var pdf=require(_0x9505('0x0'));var emlformat=require(_0x9505('0x1'));var rimraf=require(_0x9505('0x2'));var zipdir=require(_0x9505('0x3'));var jsonpatch=require(_0x9505('0x4'));var rp=require(_0x9505('0x5'));var moment=require('moment');var BPromise=require(_0x9505('0x6'));var Mustache=require(_0x9505('0x7'));var util=require(_0x9505('0x8'));var path=require('path');var sox=require(_0x9505('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9505('0xa'));var squel=require(_0x9505('0xb'));var crypto=require(_0x9505('0xc'));var jsforce=require(_0x9505('0xd'));var deskjs=require(_0x9505('0xe'));var toCsv=require(_0x9505('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9505('0x10'));var authService=require(_0x9505('0x11'));var qs=require(_0x9505('0x12'));var as=require(_0x9505('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9505('0x14'))(_0x9505('0x15'));var utils=require(_0x9505('0x16'));var config=require(_0x9505('0x17'));var licenseUtil=require(_0x9505('0x18'));var db=require(_0x9505('0x19'))['db'];function respondWithStatusCode(_0x55e49c,_0x5f35ba){_0x5f35ba=_0x5f35ba||0xcc;return function(_0x285c8b){if(_0x285c8b){return _0x55e49c[_0x9505('0x1a')](_0x5f35ba);}return _0x55e49c[_0x9505('0x1b')](_0x5f35ba)['end']();};}function respondWithResult(_0xad8154,_0x28f1ab){_0x28f1ab=_0x28f1ab||0xc8;return function(_0x3a4f24){if(_0x3a4f24){return _0xad8154[_0x9505('0x1b')](_0x28f1ab)['json'](_0x3a4f24);}};}function respondWithFilteredResult(_0x2dc7d2,_0x270997){return function(_0x5a87f2){if(_0x5a87f2){var _0x110608=_0x5a87f2[_0x9505('0x1c')],_0x48f281=_0x270997[_0x9505('0x1d')],_0x710342=_0x270997['offset']+_0x270997[_0x9505('0x1e')],_0x277655;if(_0x710342>=_0x110608){_0x710342=_0x110608;_0x277655=0xc8;}else{_0x277655=0xce;}_0x2dc7d2[_0x9505('0x1b')](_0x277655);return _0x2dc7d2[_0x9505('0x1f')](_0x9505('0x20'),_0x48f281+'-'+_0x710342+'/'+_0x110608)[_0x9505('0x21')](_0x5a87f2);}return null;};}function patchUpdates(_0x2bc4f9){return function(_0x28e898){try{jsonpatch[_0x9505('0x22')](_0x28e898,_0x2bc4f9,!![]);}catch(_0x3626d9){return BPromise[_0x9505('0x23')](_0x3626d9);}return _0x28e898['save']();};}function saveUpdates(_0x269e8c,_0x44071a){return function(_0x49df95){if(_0x49df95){return _0x49df95[_0x9505('0x24')](_0x269e8c)[_0x9505('0x25')](function(_0x38a667){return _0x38a667;});}return null;};}function removeEntity(_0x4af3d1,_0x7900dc){return function(_0x4d143d){if(_0x4d143d){return _0x4d143d['destroy']()['then'](function(){var _0x2545a0=_0x4d143d[_0x9505('0x26')]({'plain':!![]});var _0x5d28b0=_0x9505('0x27');return db[_0x9505('0x28')][_0x9505('0x29')]({'where':{'type':_0x5d28b0,'resourceId':_0x2545a0['id']}})[_0x9505('0x25')](function(){return _0x4d143d;});})[_0x9505('0x25')](function(){_0x4af3d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd9ae27,_0x379574){return function(_0x4f7e3b){if(!_0x4f7e3b){_0xd9ae27[_0x9505('0x1a')](0x194);}return _0x4f7e3b;};}function handleError(_0x268f5d,_0x1b6d3d){_0x1b6d3d=_0x1b6d3d||0x1f4;return function(_0x238889){logger[_0x9505('0x2a')](_0x238889[_0x9505('0x2b')]);if(_0x238889[_0x9505('0x2c')]){delete _0x238889[_0x9505('0x2c')];}_0x268f5d[_0x9505('0x1b')](_0x1b6d3d)[_0x9505('0x2d')](_0x238889);};}exports[_0x9505('0x2e')]=function(_0x91bd73,_0x59929c){var _0x13b628={},_0x494fe5={},_0x2fa63d={'count':0x0,'rows':[]};var _0x5a4841=_['map'](db[_0x9505('0x2f')]['rawAttributes'],function(_0x21ac28){return{'name':_0x21ac28[_0x9505('0x30')],'type':_0x21ac28[_0x9505('0x31')][_0x9505('0x32')]};});_0x494fe5['model']=_[_0x9505('0x33')](_0x5a4841,'name');_0x494fe5['query']=_[_0x9505('0x34')](_0x91bd73[_0x9505('0x35')]);_0x494fe5[_0x9505('0x36')]=_[_0x9505('0x37')](_0x494fe5[_0x9505('0x38')],_0x494fe5['query']);_0x13b628[_0x9505('0x39')]=_[_0x9505('0x37')](_0x494fe5[_0x9505('0x38')],qs[_0x9505('0x3a')](_0x91bd73['query']['fields']));_0x13b628['attributes']=_0x13b628[_0x9505('0x39')][_0x9505('0x3b')]?_0x13b628['attributes']:_0x494fe5[_0x9505('0x38')];if(!_0x91bd73[_0x9505('0x35')][_0x9505('0x3c')](_0x9505('0x3d'))){_0x13b628[_0x9505('0x1e')]=qs['limit'](_0x91bd73[_0x9505('0x35')][_0x9505('0x1e')]);_0x13b628[_0x9505('0x1d')]=qs[_0x9505('0x1d')](_0x91bd73[_0x9505('0x35')][_0x9505('0x1d')]);}_0x13b628[_0x9505('0x3e')]=qs['sort'](_0x91bd73[_0x9505('0x35')][_0x9505('0x3f')]);_0x13b628[_0x9505('0x40')]=qs['filters'](_[_0x9505('0x41')](_0x91bd73[_0x9505('0x35')],_0x494fe5[_0x9505('0x36')]),_0x5a4841);if(_0x91bd73['query'][_0x9505('0x42')]){_0x13b628[_0x9505('0x40')]=_[_0x9505('0x43')](_0x13b628[_0x9505('0x40')],{'$or':_[_0x9505('0x33')](_0x5a4841,function(_0x5ce30f){if(_0x5ce30f[_0x9505('0x31')]!==_0x9505('0x44')){var _0x1c0309={};_0x1c0309[_0x5ce30f['name']]={'$like':'%'+_0x91bd73[_0x9505('0x35')][_0x9505('0x42')]+'%'};return _0x1c0309;}})});}_0x13b628=_[_0x9505('0x43')]({},_0x13b628,_0x91bd73['options']);var _0x3f2077={'where':_0x13b628[_0x9505('0x40')]};return db[_0x9505('0x2f')][_0x9505('0x1c')](_0x3f2077)[_0x9505('0x25')](function(_0x35fd80){_0x2fa63d[_0x9505('0x1c')]=_0x35fd80;if(_0x91bd73[_0x9505('0x35')][_0x9505('0x45')]){_0x13b628[_0x9505('0x46')]=[{'all':!![]}];}return db[_0x9505('0x2f')][_0x9505('0x47')](_0x13b628);})[_0x9505('0x25')](function(_0x3677db){_0x2fa63d[_0x9505('0x48')]=_0x3677db;return _0x2fa63d;})[_0x9505('0x25')](respondWithFilteredResult(_0x59929c,_0x13b628))['catch'](handleError(_0x59929c,null));};exports['show']=function(_0xb6cb47,_0x202e27){var _0x1a15b9={'raw':![],'where':{'id':_0xb6cb47['params']['id']}},_0x106048={};_0x106048[_0x9505('0x38')]=_[_0x9505('0x34')](db[_0x9505('0x2f')][_0x9505('0x49')]);_0x106048[_0x9505('0x35')]=_['keys'](_0xb6cb47[_0x9505('0x35')]);_0x106048[_0x9505('0x36')]=_['intersection'](_0x106048['model'],_0x106048[_0x9505('0x35')]);_0x1a15b9['attributes']=_[_0x9505('0x37')](_0x106048['model'],qs[_0x9505('0x3a')](_0xb6cb47[_0x9505('0x35')][_0x9505('0x3a')]));_0x1a15b9['attributes']=_0x1a15b9[_0x9505('0x39')][_0x9505('0x3b')]?_0x1a15b9[_0x9505('0x39')]:_0x106048[_0x9505('0x38')];if(_0xb6cb47['query'][_0x9505('0x45')]){_0x1a15b9['include']=[{'all':!![]}];}_0x1a15b9=_[_0x9505('0x43')]({},_0x1a15b9,_0xb6cb47[_0x9505('0x4a')]);return db['JscriptyProject']['find'](_0x1a15b9)[_0x9505('0x25')](handleEntityNotFound(_0x202e27,null))[_0x9505('0x25')](respondWithResult(_0x202e27,null))[_0x9505('0x4b')](handleError(_0x202e27,null));};exports['create']=function(_0x10c9a5,_0x442d97){return db[_0x9505('0x2f')]['create'](_0x10c9a5[_0x9505('0x4c')],{})[_0x9505('0x25')](function(_0x5aea02){var _0x4aad43=_0x10c9a5['user'][_0x9505('0x26')]({'plain':!![]});if(!_0x4aad43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4aad43[_0x9505('0x4d')]===_0x9505('0x4e')){var _0x3d6276=_0x5aea02[_0x9505('0x26')]({'plain':!![]});var _0x5112c2=_0x9505('0x27');return db[_0x9505('0x4f')][_0x9505('0x50')]({'where':{'name':_0x5112c2,'userProfileId':_0x4aad43['userProfileId']},'raw':!![]})[_0x9505('0x25')](function(_0x3a1223){if(_0x3a1223&&_0x3a1223['autoAssociation']===0x0){return db[_0x9505('0x28')][_0x9505('0x51')]({'name':_0x3d6276['name'],'resourceId':_0x3d6276['id'],'type':_0x3a1223[_0x9505('0x2c')],'sectionId':_0x3a1223['id']},{})[_0x9505('0x25')](function(){return _0x5aea02;});}else{return _0x5aea02;}})[_0x9505('0x4b')](function(_0x358c4e){logger[_0x9505('0x2a')](_0x9505('0x52'),_0x358c4e);throw _0x358c4e;});}return _0x5aea02;})[_0x9505('0x25')](respondWithResult(_0x442d97,0xc9))[_0x9505('0x4b')](handleError(_0x442d97,null));};exports[_0x9505('0x53')]=function(_0x5cf058,_0x5d83d6){var _0x4f88a6={'where':{'id':_0x5cf058[_0x9505('0x54')]['id']}},_0x3407a5={};_0x3407a5[_0x9505('0x38')]=_[_0x9505('0x34')](db[_0x9505('0x2f')][_0x9505('0x49')]);_0x4f88a6[_0x9505('0x39')]=_[_0x9505('0x37')](_0x3407a5['model'],qs[_0x9505('0x3a')](_0x5cf058['query'][_0x9505('0x3a')]));_0x4f88a6[_0x9505('0x39')]=_0x4f88a6[_0x9505('0x39')][_0x9505('0x3b')]?_0x4f88a6['attributes']:_0x3407a5[_0x9505('0x38')];if(_0x5cf058[_0x9505('0x35')][_0x9505('0x45')]){_0x4f88a6[_0x9505('0x46')]=[{'all':!![]}];}_0x4f88a6=_[_0x9505('0x43')]({},_0x4f88a6,_0x5cf058['options']);return db[_0x9505('0x2f')][_0x9505('0x50')](_0x4f88a6)[_0x9505('0x25')](handleEntityNotFound(_0x5d83d6,null))[_0x9505('0x25')](function(_0x163d6e){if(_0x163d6e){var _0x1c9599=_0x163d6e[_0x9505('0x26')]({'plain':!![]});_0x1c9599=qs[_0x9505('0x55')](_0x1c9599,['id',_0x9505('0x56'),_0x9505('0x57')]);_0x5cf058[_0x9505('0x4c')]=_[_0x9505('0x55')](_0x5cf058[_0x9505('0x4c')],['id','createdAt','updatedAt']);return db[_0x9505('0x2f')][_0x9505('0x51')](_[_0x9505('0x43')](_0x1c9599,_0x5cf058[_0x9505('0x4c')]),{'include':_0x5cf058[_0x9505('0x35')][_0x9505('0x45')]?[{'all':!![]}]:undefined})[_0x9505('0x25')](function(_0x28a1bc){var _0xbb935c=_0x5cf058[_0x9505('0x4e')][_0x9505('0x26')]({'plain':!![]});if(!_0xbb935c)throw new Error(_0x9505('0x58'));if(_0xbb935c[_0x9505('0x4d')]===_0x9505('0x4e')){var _0x4f1cd3=_0x28a1bc[_0x9505('0x26')]({'plain':!![]});var _0x4f2eba='Projects';return db[_0x9505('0x4f')]['find']({'where':{'name':_0x4f2eba,'userProfileId':_0xbb935c[_0x9505('0x59')]},'raw':!![]})[_0x9505('0x25')](function(_0x4fc6f5){if(_0x4fc6f5&&_0x4fc6f5[_0x9505('0x5a')]===0x0){return db[_0x9505('0x28')]['create']({'name':_0x4f1cd3[_0x9505('0x2c')],'resourceId':_0x4f1cd3['id'],'type':_0x4fc6f5[_0x9505('0x2c')],'sectionId':_0x4fc6f5['id']},{})[_0x9505('0x25')](function(){return _0x28a1bc;});}else{return _0x28a1bc;}})['catch'](function(_0x2588c2){logger[_0x9505('0x2a')](_0x9505('0x52'),_0x2588c2);throw _0x2588c2;});}return _0x28a1bc;});}})['then'](respondWithResult(_0x5d83d6,0xc9))[_0x9505('0x4b')](handleError(_0x5d83d6,null));};exports[_0x9505('0x24')]=function(_0x172f9e,_0x1d2854){if(_0x172f9e[_0x9505('0x4c')]['id']){delete _0x172f9e[_0x9505('0x4c')]['id'];}return db[_0x9505('0x2f')]['find']({'where':{'id':_0x172f9e[_0x9505('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d2854,null))[_0x9505('0x25')](saveUpdates(_0x172f9e['body'],null))[_0x9505('0x25')](respondWithResult(_0x1d2854,null))['catch'](handleError(_0x1d2854,null));};exports[_0x9505('0x29')]=function(_0x49300f,_0x294541){return db[_0x9505('0x2f')]['find']({'where':{'id':_0x49300f['params']['id']}})[_0x9505('0x25')](handleEntityNotFound(_0x294541,null))[_0x9505('0x25')](removeEntity(_0x294541,null))['catch'](handleError(_0x294541,null));};exports['getSessions']=function(_0x1eca9d,_0x5aed49,_0x46fc4f){var _0x5efd0a={'raw':!![],'where':{}};var _0x140a53={};var _0x37cd22={'count':0x0,'rows':[]};return db[_0x9505('0x2f')][_0x9505('0x5b')]({'where':{'id':_0x1eca9d[_0x9505('0x54')]['id']}})[_0x9505('0x25')](handleEntityNotFound(_0x5aed49,null))[_0x9505('0x25')](function(_0x20dc3d){if(_0x20dc3d){_0x140a53[_0x9505('0x38')]=_['keys'](db['JscriptySessionReport'][_0x9505('0x49')]);_0x140a53[_0x9505('0x35')]=_[_0x9505('0x34')](_0x1eca9d[_0x9505('0x35')]);_0x140a53[_0x9505('0x36')]=_['intersection'](_0x140a53[_0x9505('0x38')],_0x140a53['query']);_0x5efd0a[_0x9505('0x39')]=_['intersection'](_0x140a53[_0x9505('0x38')],qs[_0x9505('0x3a')](_0x1eca9d[_0x9505('0x35')][_0x9505('0x3a')]));_0x5efd0a[_0x9505('0x39')]=_0x5efd0a[_0x9505('0x39')][_0x9505('0x3b')]?_0x5efd0a['attributes']:_0x140a53[_0x9505('0x38')];if(!_0x1eca9d[_0x9505('0x35')][_0x9505('0x3c')](_0x9505('0x3d'))){_0x5efd0a[_0x9505('0x1e')]=qs[_0x9505('0x1e')](_0x1eca9d[_0x9505('0x35')]['limit']);_0x5efd0a[_0x9505('0x1d')]=qs[_0x9505('0x1d')](_0x1eca9d[_0x9505('0x35')][_0x9505('0x1d')]);}_0x5efd0a[_0x9505('0x3e')]=qs[_0x9505('0x3f')](_0x1eca9d[_0x9505('0x35')][_0x9505('0x3f')]);_0x5efd0a[_0x9505('0x40')]=qs['filters'](_[_0x9505('0x41')](_0x1eca9d[_0x9505('0x35')],_0x140a53[_0x9505('0x36')]));_0x5efd0a[_0x9505('0x40')][_0x9505('0x5c')]=_0x20dc3d['id'];if(_0x1eca9d[_0x9505('0x35')][_0x9505('0x42')]){_0x5efd0a['where']=_['merge'](_0x5efd0a[_0x9505('0x40')],{'$or':_['map'](_0x5efd0a[_0x9505('0x39')],function(_0x358c5c){var _0x3553ae={};_0x3553ae[_0x358c5c]={'$like':'%'+_0x1eca9d[_0x9505('0x35')][_0x9505('0x42')]+'%'};return _0x3553ae;})});}_0x5efd0a=_[_0x9505('0x43')]({},_0x5efd0a,_0x1eca9d['options']);return db[_0x9505('0x5d')][_0x9505('0x1c')]({'where':_0x5efd0a['where']})[_0x9505('0x25')](function(_0x29cca1){_0x37cd22[_0x9505('0x1c')]=_0x29cca1;if(_0x1eca9d['query'][_0x9505('0x45')]){_0x5efd0a[_0x9505('0x46')]=[{'all':!![]}];}return db[_0x9505('0x5d')][_0x9505('0x47')](_0x5efd0a);})[_0x9505('0x25')](function(_0x4c0777){_0x37cd22['rows']=_0x4c0777;return _0x37cd22;});}})[_0x9505('0x25')](respondWithFilteredResult(_0x5aed49,_0x5efd0a))[_0x9505('0x4b')](handleError(_0x5aed49,null));};exports['getAnswers']=function(_0x5942f3,_0x3bbd6f,_0x575eb4){var _0x520dbc={'raw':!![],'where':{}};var _0x559443={};var _0x515890={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x9505('0x5b')]({'where':{'id':_0x5942f3[_0x9505('0x54')]['id']}})[_0x9505('0x25')](handleEntityNotFound(_0x3bbd6f,null))[_0x9505('0x25')](function(_0x5d18b2){if(_0x5d18b2){_0x559443[_0x9505('0x38')]=_[_0x9505('0x34')](db[_0x9505('0x5e')][_0x9505('0x49')]);_0x559443[_0x9505('0x35')]=_['keys'](_0x5942f3[_0x9505('0x35')]);_0x559443['filters']=_[_0x9505('0x37')](_0x559443[_0x9505('0x38')],_0x559443[_0x9505('0x35')]);_0x520dbc[_0x9505('0x39')]=_[_0x9505('0x37')](_0x559443[_0x9505('0x38')],qs[_0x9505('0x3a')](_0x5942f3[_0x9505('0x35')]['fields']));_0x520dbc[_0x9505('0x39')]=_0x520dbc[_0x9505('0x39')][_0x9505('0x3b')]?_0x520dbc[_0x9505('0x39')]:_0x559443[_0x9505('0x38')];if(!_0x5942f3[_0x9505('0x35')][_0x9505('0x3c')](_0x9505('0x3d'))){_0x520dbc[_0x9505('0x1e')]=qs['limit'](_0x5942f3['query'][_0x9505('0x1e')]);_0x520dbc['offset']=qs[_0x9505('0x1d')](_0x5942f3[_0x9505('0x35')][_0x9505('0x1d')]);}_0x520dbc[_0x9505('0x3e')]=qs['sort'](_0x5942f3[_0x9505('0x35')][_0x9505('0x3f')]);_0x520dbc[_0x9505('0x40')]=qs[_0x9505('0x36')](_[_0x9505('0x41')](_0x5942f3[_0x9505('0x35')],_0x559443[_0x9505('0x36')]));_0x520dbc['where'][_0x9505('0x5c')]=_0x5d18b2['id'];if(_0x5942f3['query']['filter']){_0x520dbc[_0x9505('0x40')]=_[_0x9505('0x43')](_0x520dbc['where'],{'$or':_['map'](_0x520dbc[_0x9505('0x39')],function(_0xfb7f13){var _0xb5f123={};_0xb5f123[_0xfb7f13]={'$like':'%'+_0x5942f3[_0x9505('0x35')]['filter']+'%'};return _0xb5f123;})});}_0x520dbc=_['merge']({},_0x520dbc,_0x5942f3[_0x9505('0x4a')]);return db[_0x9505('0x5e')]['count']({'where':_0x520dbc[_0x9505('0x40')]})['then'](function(_0x49df81){_0x515890[_0x9505('0x1c')]=_0x49df81;if(_0x5942f3[_0x9505('0x35')][_0x9505('0x45')]){_0x520dbc['include']=[{'all':!![]}];}return db[_0x9505('0x5e')]['findAll'](_0x520dbc);})[_0x9505('0x25')](function(_0x2aa7fb){_0x515890[_0x9505('0x48')]=_0x2aa7fb;return _0x515890;});}})[_0x9505('0x25')](respondWithFilteredResult(_0x3bbd6f,_0x520dbc))[_0x9505('0x4b')](handleError(_0x3bbd6f,null));};function char(_0x282465){return _0x9505('0x5f')===typeof _0x282465?String[_0x9505('0x60')][_0x9505('0x22')](null,arguments):_0x282465;}function needsEncapsulation(_0x2f97bb){return!!_0x2f97bb&&(_0x2f97bb[_0x9505('0x61')]()['indexOf'](char(0xd))>=0x0||_0x2f97bb['toString']()[_0x9505('0x62')](char(0xa))>=0x0||_0x2f97bb[_0x9505('0x61')]()[_0x9505('0x62')](char(0x2c))>=0x0||_0x2f97bb[_0x9505('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4a2cb1){var _0x5700d4=char(0x22),_0x25ee17='\x5c'+char(0x22),_0x3a5878=_0x4a2cb1[_0x9505('0x61')]()[_0x9505('0x63')](new RegExp(_0x5700d4,'g'),_0x25ee17);return _0x5700d4+_0x3a5878+_0x5700d4;}exports['getSummary']=function(_0x2db7eb,_0x447e07,_0x19b73d){var _0x4b3b18,_0x23e89b;var _0x54ab5f={'where':{'ProjectId':_0x2db7eb[_0x9505('0x54')]['id']}};if(_0x2db7eb['query'][_0x9505('0x64')]){_0x54ab5f[_0x9505('0x40')][_0x9505('0x65')]=JSON[_0x9505('0x66')](_0x2db7eb[_0x9505('0x35')][_0x9505('0x64')]);}return db['JscriptySessionReport'][_0x9505('0x47')](_0x54ab5f)[_0x9505('0x25')](handleEntityNotFound(_0x447e07,null))[_0x9505('0x25')](function(_0x2d0fbf){if(_0x2d0fbf){_0x4b3b18=_0x2d0fbf;return db[_0x9505('0x67')][_0x9505('0x47')]({'where':{'SessionId':{'$in':_[_0x9505('0x33')](_0x4b3b18,'id')},'ProjectId':_0x2db7eb[_0x9505('0x54')]['id']},'order':_0x9505('0x68')});}})[_0x9505('0x25')](handleEntityNotFound(_0x447e07,null))[_0x9505('0x25')](function(_0x29f22f){if(_0x29f22f){_0x23e89b=_0x29f22f;var _0x29fa32={};for(var _0x160021=0x0,_0x51a07b=_0x23e89b['length'];_0x160021<_0x51a07b;_0x160021++){if(!_0x29fa32['hasOwnProperty'](_0x23e89b[_0x160021]['questionId'])){_0x29fa32[_0x23e89b[_0x160021][_0x9505('0x69')]]=needsEncapsulation(_0x23e89b[_0x160021][_0x9505('0x6a')])?encapsulate(_0x23e89b[_0x160021][_0x9505('0x6a')]):_0x23e89b[_0x160021]['question'];}}var _0x2e3a0e=[],_0x5f0a7d={};for(var _0xbbbe83=0x0,_0x2bb69b=_0x4b3b18['length'];_0xbbbe83<_0x2bb69b;_0xbbbe83++){_0x5f0a7d={'ProjectId':_0x2db7eb[_0x9505('0x54')]['id'],'SessionId':_0x4b3b18[_0xbbbe83]['id'],'StartTime':moment(_0x4b3b18[_0xbbbe83][_0x9505('0x65')])[_0x9505('0x6b')](_0x9505('0x6c'))};for(var _0x129ad2=0x0,_0x3f3db1=_0x23e89b['length'];_0x129ad2<_0x3f3db1;_0x129ad2++){if(_0x23e89b[_0x129ad2][_0x9505('0x6d')]==_0x4b3b18[_0xbbbe83]['id']&&_0x29fa32[_0x9505('0x3c')](_0x23e89b[_0x129ad2][_0x9505('0x69')])){_0x5f0a7d[_0x29fa32[_0x23e89b[_0x129ad2][_0x9505('0x69')]]]=_0x23e89b[_0x129ad2]['answer'];}}for(var _0x3b04c3 in _0x29fa32){if(!_0x5f0a7d[_0x9505('0x3c')](_0x29fa32[_0x3b04c3])){_0x5f0a7d[_0x29fa32[_0x3b04c3]]=null;}}_0x2e3a0e[_0x9505('0x6e')](_0x5f0a7d);}return _0x2e3a0e;}})[_0x9505('0x25')](function(_0x239bb6){if(!_[_0x9505('0x6f')](_0x239bb6)){var _0x422f08=toCsv(_0x239bb6);var _0x3296dc=Date[_0x9505('0x70')]();fs[_0x9505('0x71')](util[_0x9505('0x6b')](_0x9505('0x72'),_0x2db7eb[_0x9505('0x54')]['id'],_0x3296dc),_0x422f08);_0x447e07['setHeader']('Content-disposition','attachment;\x20filename='+util['format'](_0x9505('0x73'),_0x2db7eb[_0x9505('0x54')]['id'],_0x3296dc));_0x447e07[_0x9505('0x74')](_0x9505('0x75'),'text/csv');return _0x447e07[_0x9505('0x76')](util[_0x9505('0x6b')](_0x9505('0x72'),_0x2db7eb['params']['id'],_0x3296dc));}else{return _0x447e07[_0x9505('0x1a')](0xcc);}})[_0x9505('0x4b')](handleError(_0x447e07,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c4a7424..107f2a9 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 _0xe8e9=['../../config/logger','moment','bluebird','path','../../config/environment','define','JscriptyProject','lodash','util'];(function(_0x21654d,_0x4002da){var _0x8e212d=function(_0x478123){while(--_0x478123){_0x21654d['push'](_0x21654d['shift']());}};_0x8e212d(++_0x4002da);}(_0xe8e9,0x181));var _0x9e8e=function(_0x2f1fd6,_0x173766){_0x2f1fd6=_0x2f1fd6-0x0;var _0x453f59=_0xe8e9[_0x2f1fd6];return _0x453f59;};'use strict';var _=require(_0x9e8e('0x0'));var util=require(_0x9e8e('0x1'));var logger=require(_0x9e8e('0x2'))('api');var moment=require(_0x9e8e('0x3'));var BPromise=require(_0x9e8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e8e('0x5'));var rimraf=require('rimraf');var config=require(_0x9e8e('0x6'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x425f5c,_0x412e3d){return _0x425f5c[_0x9e8e('0x7')](_0x9e8e('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['JscriptyProject','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports'];(function(_0x4e1642,_0x1133dc){var _0x4c7998=function(_0x571374){while(--_0x571374){_0x4e1642['push'](_0x4e1642['shift']());}};_0x4c7998(++_0x1133dc);}(_0x33af,0xa3));var _0xf33a=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0x33af[_0x2b0875];return _0xedb8d7;};'use strict';var _=require(_0xf33a('0x0'));var util=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var moment=require('moment');var BPromise=require(_0xf33a('0x4'));var rp=require(_0xf33a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xf33a('0x7')]=function(_0x412944,_0x4818fb){return _0x412944['define'](_0xf33a('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 7644e96..6effe50 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 _0xd93e=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x508c81,_0x10ba01){var _0x57e41d=function(_0x2b59bb){while(--_0x2b59bb){_0x508c81['push'](_0x508c81['shift']());}};_0x57e41d(++_0x10ba01);}(_0xd93e,0xeb));var _0xed93=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xd93e[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var moment=require(_0xed93('0x2'));var BPromise=require('bluebird');var rs=require(_0xed93('0x3'));var fs=require('fs');var Redis=require(_0xed93('0x4'));var db=require(_0xed93('0x5'))['db'];var utils=require(_0xed93('0x6'));var logger=require(_0xed93('0x7'))(_0xed93('0x8'));var config=require(_0xed93('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xed93('0xa')][_0xed93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29fc90,_0x5eb86d,_0x536f94){return new BPromise(function(_0x1eb813,_0xb240b5){return client[_0xed93('0xc')](_0x29fc90,_0x536f94)[_0xed93('0xd')](function(_0x262b23){logger[_0xed93('0xe')](_0xed93('0xf'),_0x5eb86d,_0xed93('0x10'));logger[_0xed93('0x11')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x5eb86d,_0xed93('0x10'),JSON['stringify'](_0x262b23));if(_0x262b23[_0xed93('0x12')]){if(_0x262b23[_0xed93('0x12')][_0xed93('0x13')]===0x1f4){logger[_0xed93('0x12')](_0xed93('0xf'),_0x5eb86d,_0x262b23[_0xed93('0x12')]['message']);return _0xb240b5(_0x262b23['error']['message']);}logger[_0xed93('0x12')](_0xed93('0xf'),_0x5eb86d,_0x262b23[_0xed93('0x12')][_0xed93('0x14')]);return _0x1eb813(_0x262b23[_0xed93('0x12')][_0xed93('0x14')]);}else{logger[_0xed93('0xe')](_0xed93('0xf'),_0x5eb86d,_0xed93('0x10'));_0x1eb813(_0x262b23[_0xed93('0x15')]['message']);}})[_0xed93('0x16')](function(_0x1dc5bb){logger['error'](_0xed93('0xf'),_0x5eb86d,_0x1dc5bb);_0xb240b5(_0x1dc5bb);});});} \ No newline at end of file +var _0xde1a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x3fe34c,_0x2a15b9){var _0x4a5413=function(_0xdb3546){while(--_0xdb3546){_0x3fe34c['push'](_0x3fe34c['shift']());}};_0x4a5413(++_0x2a15b9);}(_0xde1a,0x14d));var _0xade1=function(_0x5866c6,_0x5445a5){_0x5866c6=_0x5866c6-0x0;var _0xcc2415=_0xde1a[_0x5866c6];return _0xcc2415;};'use strict';var _=require(_0xade1('0x0'));var util=require(_0xade1('0x1'));var moment=require(_0xade1('0x2'));var BPromise=require(_0xade1('0x3'));var rs=require(_0xade1('0x4'));var fs=require('fs');var Redis=require(_0xade1('0x5'));var db=require(_0xade1('0x6'))['db'];var utils=require(_0xade1('0x7'));var logger=require(_0xade1('0x8'))(_0xade1('0x9'));var config=require('../../config/environment');var jayson=require(_0xade1('0xa'));var client=jayson['client'][_0xade1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf6ab1,_0x461123,_0x358be4){return new BPromise(function(_0x35b55c,_0x2f1783){return client[_0xade1('0xc')](_0xf6ab1,_0x358be4)['then'](function(_0x4d1228){logger[_0xade1('0xd')](_0xade1('0xe'),_0x461123,_0xade1('0xf'));logger['debug'](_0xade1('0x10'),_0x461123,_0xade1('0xf'),JSON[_0xade1('0x11')](_0x4d1228));if(_0x4d1228[_0xade1('0x12')]){if(_0x4d1228[_0xade1('0x12')]['code']===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x461123,_0x4d1228[_0xade1('0x12')][_0xade1('0x13')]);return _0x2f1783(_0x4d1228[_0xade1('0x12')][_0xade1('0x13')]);}logger[_0xade1('0x12')](_0xade1('0xe'),_0x461123,_0x4d1228[_0xade1('0x12')]['message']);return _0x35b55c(_0x4d1228['error'][_0xade1('0x13')]);}else{logger['info'](_0xade1('0xe'),_0x461123,_0xade1('0xf'));_0x35b55c(_0x4d1228[_0xade1('0x14')][_0xade1('0x13')]);}})['catch'](function(_0x16788a){logger[_0xade1('0x12')](_0xade1('0xe'),_0x461123,_0x16788a);_0x2f1783(_0x16788a);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 889ef46..61b024a 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 _0xfa63=['delete','destroy','exports','multer','express','Router','../../components/auth/service','isAuthenticated','index','get','describe','/:id','show','create','update'];(function(_0x1bf4ee,_0x33de42){var _0x3dd9ae=function(_0x1e114c){while(--_0x1e114c){_0x1bf4ee['push'](_0x1bf4ee['shift']());}};_0x3dd9ae(++_0x33de42);}(_0xfa63,0x12f));var _0x3fa6=function(_0x5b841d,_0x4a0531){_0x5b841d=_0x5b841d-0x0;var _0x1a580b=_0xfa63[_0x5b841d];return _0x1a580b;};'use strict';var multer=require(_0x3fa6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3fa6('0x1'));var router=express[_0x3fa6('0x2')]();var auth=require(_0x3fa6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0x5')]);router[_0x3fa6('0x6')]('/describe',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0x7')]);router[_0x3fa6('0x6')](_0x3fa6('0x8'),auth[_0x3fa6('0x4')](),controller[_0x3fa6('0x9')]);router['post']('/',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0xa')]);router['put']('/:id',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0xb')]);router[_0x3fa6('0xc')](_0x3fa6('0x8'),auth[_0x3fa6('0x4')](),controller[_0x3fa6('0xd')]);module[_0x3fa6('0xe')]=router; \ No newline at end of file +var _0x457b=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x457b,0x192));var _0xb457=function(_0x5e6c6b,_0x394668){_0x5e6c6b=_0x5e6c6b-0x0;var _0x14a242=_0x457b[_0x5e6c6b];return _0x14a242;};'use strict';var multer=require(_0xb457('0x0'));var util=require('util');var path=require(_0xb457('0x1'));var timeout=require(_0xb457('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb457('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb457('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb457('0x5')]('/',auth[_0xb457('0x6')](),controller[_0xb457('0x7')]);router[_0xb457('0x5')](_0xb457('0x8'),auth[_0xb457('0x6')](),controller['describe']);router[_0xb457('0x5')](_0xb457('0x9'),auth[_0xb457('0x6')](),controller[_0xb457('0xa')]);router['post']('/',auth[_0xb457('0x6')](),controller['create']);router[_0xb457('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb457('0xc')]);router[_0xb457('0xd')](_0xb457('0x9'),auth[_0xb457('0x6')](),controller['destroy']);module[_0xb457('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9d0ca23..45d2459 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 _0xa210=['sequelize','exports','TEXT','long','STRING'];(function(_0x362224,_0x25b88c){var _0x4a8a90=function(_0x1e5e87){while(--_0x1e5e87){_0x362224['push'](_0x362224['shift']());}};_0x4a8a90(++_0x25b88c);}(_0xa210,0x127));var _0x0a21=function(_0x25f9bc,_0x546933){_0x25f9bc=_0x25f9bc-0x0;var _0xe71cd1=_0xa210[_0x25f9bc];return _0xe71cd1;};'use strict';var Sequelize=require(_0x0a21('0x0'));module[_0x0a21('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x0a21('0x2')](_0x0a21('0x3'))},'membername':{'type':Sequelize[_0x0a21('0x4')]},'projectname':{'type':Sequelize[_0x0a21('0x4')]},'queue':{'type':Sequelize[_0x0a21('0x4')]},'uniqueid':{'type':Sequelize[_0x0a21('0x4')]},'calleridname':{'type':Sequelize[_0x0a21('0x4')]},'calleridnum':{'type':Sequelize[_0x0a21('0x4')]},'questionId':{'type':Sequelize[_0x0a21('0x4')]}}; \ No newline at end of file +var _0x3d85=['long','STRING'];(function(_0x55ba48,_0x27d352){var _0x3f43e5=function(_0x3d0a07){while(--_0x3d0a07){_0x55ba48['push'](_0x55ba48['shift']());}};_0x3f43e5(++_0x27d352);}(_0x3d85,0xe3));var _0x53d8=function(_0x5626b8,_0x49d3cc){_0x5626b8=_0x5626b8-0x0;var _0x1247d0=_0x3d85[_0x5626b8];return _0x1247d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x53d8('0x0')]},'answer':{'type':Sequelize['TEXT'](_0x53d8('0x1'))},'membername':{'type':Sequelize[_0x53d8('0x0')]},'projectname':{'type':Sequelize[_0x53d8('0x0')]},'queue':{'type':Sequelize[_0x53d8('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x53d8('0x0')]},'calleridnum':{'type':Sequelize[_0x53d8('0x0')]},'questionId':{'type':Sequelize[_0x53d8('0x0')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 69bb7f7..6d80d34 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 _0xc28b=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x5701e3,_0xedbc7a){var _0x3341be=function(_0x1fe1f4){while(--_0x1fe1f4){_0x5701e3['push'](_0x5701e3['shift']());}};_0x3341be(++_0xedbc7a);}(_0xc28b,0x115));var _0xbc28=function(_0x2cd17f,_0x3e9c94){_0x2cd17f=_0x2cd17f-0x0;var _0x5bab50=_0xc28b[_0x2cd17f];return _0x5bab50;};'use strict';var pdf=require(_0xbc28('0x0'));var emlformat=require(_0xbc28('0x1'));var rimraf=require(_0xbc28('0x2'));var zipdir=require(_0xbc28('0x3'));var jsonpatch=require(_0xbc28('0x4'));var rp=require(_0xbc28('0x5'));var moment=require(_0xbc28('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbc28('0x7'));var util=require(_0xbc28('0x8'));var path=require(_0xbc28('0x9'));var sox=require('sox');var csv=require(_0xbc28('0xa'));var ejs=require(_0xbc28('0xb'));var fs=require('fs');var _=require(_0xbc28('0xc'));var squel=require('squel');var crypto=require(_0xbc28('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbc28('0xe'));var toCsv=require(_0xbc28('0xa'));var querystring=require(_0xbc28('0xf'));var Papa=require(_0xbc28('0x10'));var Redis=require(_0xbc28('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbc28('0x12'));var as=require(_0xbc28('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc28('0x14'))(_0xbc28('0x15'));var utils=require('../../config/utils');var config=require(_0xbc28('0x16'));var licenseUtil=require(_0xbc28('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x215ca3,_0x550a10){_0x550a10=_0x550a10||0xcc;return function(_0x115e84){if(_0x115e84){return _0x215ca3[_0xbc28('0x18')](_0x550a10);}return _0x215ca3[_0xbc28('0x19')](_0x550a10)[_0xbc28('0x1a')]();};}function respondWithResult(_0x910b98,_0x323a8c){_0x323a8c=_0x323a8c||0xc8;return function(_0x38fee3){if(_0x38fee3){return _0x910b98[_0xbc28('0x19')](_0x323a8c)[_0xbc28('0x1b')](_0x38fee3);}};}function respondWithFilteredResult(_0x570b44,_0x4f43b5){return function(_0x37db46){if(_0x37db46){var _0x4cbc13=_0x37db46[_0xbc28('0x1c')],_0x165705=_0x4f43b5[_0xbc28('0x1d')],_0x21c5ff=_0x4f43b5['offset']+_0x4f43b5[_0xbc28('0x1e')],_0x1bff18;if(_0x21c5ff>=_0x4cbc13){_0x21c5ff=_0x4cbc13;_0x1bff18=0xc8;}else{_0x1bff18=0xce;}_0x570b44[_0xbc28('0x19')](_0x1bff18);return _0x570b44[_0xbc28('0x1f')](_0xbc28('0x20'),_0x165705+'-'+_0x21c5ff+'/'+_0x4cbc13)[_0xbc28('0x1b')](_0x37db46);}return null;};}function patchUpdates(_0x296091){return function(_0x5fe2d){try{jsonpatch[_0xbc28('0x21')](_0x5fe2d,_0x296091,!![]);}catch(_0x38b430){return BPromise[_0xbc28('0x22')](_0x38b430);}return _0x5fe2d[_0xbc28('0x23')]();};}function saveUpdates(_0xefb833,_0x2bb572){return function(_0x133c28){if(_0x133c28){return _0x133c28['update'](_0xefb833)['then'](function(_0x13a69e){return _0x13a69e;});}return null;};}function removeEntity(_0x37f214,_0x2c2939){return function(_0x2b4a1b){if(_0x2b4a1b){return _0x2b4a1b[_0xbc28('0x24')]()[_0xbc28('0x25')](function(){_0x37f214['status'](0xcc)[_0xbc28('0x1a')]();});}};}function handleEntityNotFound(_0x27f9cb,_0x1af620){return function(_0x415da5){if(!_0x415da5){_0x27f9cb[_0xbc28('0x18')](0x194);}return _0x415da5;};}function handleError(_0x500127,_0x22e7b7){_0x22e7b7=_0x22e7b7||0x1f4;return function(_0x1a976c){logger['error'](_0x1a976c[_0xbc28('0x26')]);if(_0x1a976c[_0xbc28('0x27')]){delete _0x1a976c['name'];}_0x500127[_0xbc28('0x19')](_0x22e7b7)['send'](_0x1a976c);};}exports[_0xbc28('0x28')]=function(_0x5d1d80,_0x32822c){var _0x1f635c={},_0x5263ff={},_0x3da7ba={'count':0x0,'rows':[]};var _0x5d8e43=_[_0xbc28('0x29')](db[_0xbc28('0x2a')][_0xbc28('0x2b')],function(_0x124239){return{'name':_0x124239[_0xbc28('0x2c')],'type':_0x124239[_0xbc28('0x2d')][_0xbc28('0x2e')]};});_0x5263ff[_0xbc28('0x2f')]=_[_0xbc28('0x29')](_0x5d8e43,_0xbc28('0x27'));_0x5263ff['query']=_['keys'](_0x5d1d80['query']);_0x5263ff[_0xbc28('0x30')]=_[_0xbc28('0x31')](_0x5263ff[_0xbc28('0x2f')],_0x5263ff['query']);_0x1f635c[_0xbc28('0x32')]=_[_0xbc28('0x31')](_0x5263ff[_0xbc28('0x2f')],qs[_0xbc28('0x33')](_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x33')]));_0x1f635c[_0xbc28('0x32')]=_0x1f635c['attributes'][_0xbc28('0x35')]?_0x1f635c[_0xbc28('0x32')]:_0x5263ff[_0xbc28('0x2f')];if(!_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x36')](_0xbc28('0x37'))){_0x1f635c[_0xbc28('0x1e')]=qs[_0xbc28('0x1e')](_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x1e')]);_0x1f635c['offset']=qs[_0xbc28('0x1d')](_0x5d1d80[_0xbc28('0x34')]['offset']);}_0x1f635c[_0xbc28('0x38')]=qs['sort'](_0x5d1d80['query']['sort']);_0x1f635c[_0xbc28('0x39')]=qs[_0xbc28('0x30')](_['pick'](_0x5d1d80[_0xbc28('0x34')],_0x5263ff[_0xbc28('0x30')]),_0x5d8e43);if(_0x5d1d80['query']['filter']){_0x1f635c['where']=_['merge'](_0x1f635c[_0xbc28('0x39')],{'$or':_[_0xbc28('0x29')](_0x5d8e43,function(_0x1ece5b){if(_0x1ece5b[_0xbc28('0x2d')]!=='VIRTUAL'){var _0x4cf2fb={};_0x4cf2fb[_0x1ece5b[_0xbc28('0x27')]]={'$like':'%'+_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x3a')]+'%'};return _0x4cf2fb;}})});}_0x1f635c=_[_0xbc28('0x3b')]({},_0x1f635c,_0x5d1d80[_0xbc28('0x3c')]);var _0x465a9c={'where':_0x1f635c['where']};return db[_0xbc28('0x2a')][_0xbc28('0x1c')](_0x465a9c)['then'](function(_0x22b84d){_0x3da7ba[_0xbc28('0x1c')]=_0x22b84d;if(_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x3d')]){_0x1f635c[_0xbc28('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbc28('0x3f')](_0x1f635c);})[_0xbc28('0x25')](function(_0x1229bf){_0x3da7ba[_0xbc28('0x40')]=_0x1229bf;return _0x3da7ba;})[_0xbc28('0x25')](respondWithFilteredResult(_0x32822c,_0x1f635c))[_0xbc28('0x41')](handleError(_0x32822c,null));};exports[_0xbc28('0x42')]=function(_0x3e7169,_0x17980a){var _0x110ba2={'raw':!![],'where':{'id':_0x3e7169[_0xbc28('0x43')]['id']}},_0x414eb9={};_0x414eb9[_0xbc28('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0xbc28('0x2b')]);_0x414eb9[_0xbc28('0x34')]=_[_0xbc28('0x44')](_0x3e7169[_0xbc28('0x34')]);_0x414eb9[_0xbc28('0x30')]=_['intersection'](_0x414eb9[_0xbc28('0x2f')],_0x414eb9[_0xbc28('0x34')]);_0x110ba2['attributes']=_['intersection'](_0x414eb9[_0xbc28('0x2f')],qs[_0xbc28('0x33')](_0x3e7169[_0xbc28('0x34')]['fields']));_0x110ba2[_0xbc28('0x32')]=_0x110ba2[_0xbc28('0x32')][_0xbc28('0x35')]?_0x110ba2['attributes']:_0x414eb9[_0xbc28('0x2f')];if(_0x3e7169['query'][_0xbc28('0x3d')]){_0x110ba2[_0xbc28('0x3e')]=[{'all':!![]}];}_0x110ba2=_[_0xbc28('0x3b')]({},_0x110ba2,_0x3e7169[_0xbc28('0x3c')]);return db[_0xbc28('0x2a')][_0xbc28('0x45')](_0x110ba2)[_0xbc28('0x25')](handleEntityNotFound(_0x17980a,null))[_0xbc28('0x25')](respondWithResult(_0x17980a,null))[_0xbc28('0x41')](handleError(_0x17980a,null));};exports['create']=function(_0x202d48,_0x3e5bb9){return db[_0xbc28('0x2a')][_0xbc28('0x46')](_0x202d48[_0xbc28('0x47')],{})[_0xbc28('0x25')](respondWithResult(_0x3e5bb9,0xc9))[_0xbc28('0x41')](handleError(_0x3e5bb9,null));};exports[_0xbc28('0x48')]=function(_0x2dd963,_0x2e7059){if(_0x2dd963[_0xbc28('0x47')]['id']){delete _0x2dd963['body']['id'];}return db[_0xbc28('0x2a')][_0xbc28('0x45')]({'where':{'id':_0x2dd963[_0xbc28('0x43')]['id']}})[_0xbc28('0x25')](handleEntityNotFound(_0x2e7059,null))[_0xbc28('0x25')](saveUpdates(_0x2dd963[_0xbc28('0x47')],null))[_0xbc28('0x25')](respondWithResult(_0x2e7059,null))[_0xbc28('0x41')](handleError(_0x2e7059,null));};exports[_0xbc28('0x24')]=function(_0x5ccfc4,_0x1accc6){return db['JscriptyQuestionReport'][_0xbc28('0x45')]({'where':{'id':_0x5ccfc4[_0xbc28('0x43')]['id']}})[_0xbc28('0x25')](handleEntityNotFound(_0x1accc6,null))[_0xbc28('0x25')](removeEntity(_0x1accc6,null))['catch'](handleError(_0x1accc6,null));};exports[_0xbc28('0x49')]=function(_0x5d25ca,_0x422791){return db[_0xbc28('0x2a')]['describe']()[_0xbc28('0x25')](respondWithResult(_0x422791,null))[_0xbc28('0x41')](handleError(_0x422791,null));}; \ No newline at end of file +var _0x5b5f=['name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','keys','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','error'];(function(_0x3a4f6e,_0x4b14f2){var _0x394180=function(_0x34fe52){while(--_0x34fe52){_0x3a4f6e['push'](_0x3a4f6e['shift']());}};_0x394180(++_0x4b14f2);}(_0x5b5f,0x14b));var _0xf5b5=function(_0x3a4827,_0x8a4407){_0x3a4827=_0x3a4827-0x0;var _0xabf933=_0x5b5f[_0x3a4827];return _0xabf933;};'use strict';var pdf=require(_0xf5b5('0x0'));var emlformat=require(_0xf5b5('0x1'));var rimraf=require(_0xf5b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5b5('0x3'));var rp=require(_0xf5b5('0x4'));var moment=require('moment');var BPromise=require(_0xf5b5('0x5'));var Mustache=require(_0xf5b5('0x6'));var util=require(_0xf5b5('0x7'));var path=require(_0xf5b5('0x8'));var sox=require(_0xf5b5('0x9'));var csv=require(_0xf5b5('0xa'));var ejs=require(_0xf5b5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf5b5('0xc'));var crypto=require(_0xf5b5('0xd'));var jsforce=require(_0xf5b5('0xe'));var deskjs=require(_0xf5b5('0xf'));var toCsv=require(_0xf5b5('0xa'));var querystring=require(_0xf5b5('0x10'));var Papa=require(_0xf5b5('0x11'));var Redis=require('ioredis');var authService=require(_0xf5b5('0x12'));var qs=require(_0xf5b5('0x13'));var as=require(_0xf5b5('0x14'));var hardwareService=require(_0xf5b5('0x15'));var logger=require('../../config/logger')(_0xf5b5('0x16'));var utils=require(_0xf5b5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5b5('0x18'))['db'];function respondWithStatusCode(_0x306492,_0x47c923){_0x47c923=_0x47c923||0xcc;return function(_0x2eb415){if(_0x2eb415){return _0x306492[_0xf5b5('0x19')](_0x47c923);}return _0x306492[_0xf5b5('0x1a')](_0x47c923)['end']();};}function respondWithResult(_0x1c57b4,_0x2cb7ec){_0x2cb7ec=_0x2cb7ec||0xc8;return function(_0x3485d4){if(_0x3485d4){return _0x1c57b4['status'](_0x2cb7ec)[_0xf5b5('0x1b')](_0x3485d4);}};}function respondWithFilteredResult(_0x4d1065,_0x1d1240){return function(_0x552caf){if(_0x552caf){var _0x4b7da3=_0x552caf[_0xf5b5('0x1c')],_0x3ecbd7=_0x1d1240[_0xf5b5('0x1d')],_0x39d37d=_0x1d1240[_0xf5b5('0x1d')]+_0x1d1240[_0xf5b5('0x1e')],_0x1c6929;if(_0x39d37d>=_0x4b7da3){_0x39d37d=_0x4b7da3;_0x1c6929=0xc8;}else{_0x1c6929=0xce;}_0x4d1065[_0xf5b5('0x1a')](_0x1c6929);return _0x4d1065['set']('Content-Range',_0x3ecbd7+'-'+_0x39d37d+'/'+_0x4b7da3)['json'](_0x552caf);}return null;};}function patchUpdates(_0x4e28a8){return function(_0x2d4247){try{jsonpatch[_0xf5b5('0x1f')](_0x2d4247,_0x4e28a8,!![]);}catch(_0x41abb7){return BPromise[_0xf5b5('0x20')](_0x41abb7);}return _0x2d4247[_0xf5b5('0x21')]();};}function saveUpdates(_0x49f66b,_0x110c40){return function(_0x3f0437){if(_0x3f0437){return _0x3f0437[_0xf5b5('0x22')](_0x49f66b)[_0xf5b5('0x23')](function(_0x4a1ff1){return _0x4a1ff1;});}return null;};}function removeEntity(_0x46215c,_0x16ad57){return function(_0x3d5bc8){if(_0x3d5bc8){return _0x3d5bc8[_0xf5b5('0x24')]()[_0xf5b5('0x23')](function(){_0x46215c[_0xf5b5('0x1a')](0xcc)[_0xf5b5('0x25')]();});}};}function handleEntityNotFound(_0x238f32,_0x12df36){return function(_0x16379e){if(!_0x16379e){_0x238f32[_0xf5b5('0x19')](0x194);}return _0x16379e;};}function handleError(_0x3e23bd,_0x2d436e){_0x2d436e=_0x2d436e||0x1f4;return function(_0x39f525){logger[_0xf5b5('0x26')](_0x39f525['stack']);if(_0x39f525[_0xf5b5('0x27')]){delete _0x39f525[_0xf5b5('0x27')];}_0x3e23bd[_0xf5b5('0x1a')](_0x2d436e)[_0xf5b5('0x28')](_0x39f525);};}exports[_0xf5b5('0x29')]=function(_0x249f7a,_0x312237){var _0x1638ba={},_0x3d698b={},_0x5adc79={'count':0x0,'rows':[]};var _0xace3c=_[_0xf5b5('0x2a')](db[_0xf5b5('0x2b')]['rawAttributes'],function(_0x10bdd8){return{'name':_0x10bdd8[_0xf5b5('0x2c')],'type':_0x10bdd8[_0xf5b5('0x2d')][_0xf5b5('0x2e')]};});_0x3d698b[_0xf5b5('0x2f')]=_[_0xf5b5('0x2a')](_0xace3c,_0xf5b5('0x27'));_0x3d698b['query']=_['keys'](_0x249f7a[_0xf5b5('0x30')]);_0x3d698b[_0xf5b5('0x31')]=_['intersection'](_0x3d698b[_0xf5b5('0x2f')],_0x3d698b[_0xf5b5('0x30')]);_0x1638ba[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x3d698b[_0xf5b5('0x2f')],qs[_0xf5b5('0x34')](_0x249f7a['query']['fields']));_0x1638ba[_0xf5b5('0x32')]=_0x1638ba['attributes'][_0xf5b5('0x35')]?_0x1638ba['attributes']:_0x3d698b[_0xf5b5('0x2f')];if(!_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x36')](_0xf5b5('0x37'))){_0x1638ba[_0xf5b5('0x1e')]=qs[_0xf5b5('0x1e')](_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x1e')]);_0x1638ba[_0xf5b5('0x1d')]=qs['offset'](_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x1d')]);}_0x1638ba[_0xf5b5('0x38')]=qs['sort'](_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x39')]);_0x1638ba[_0xf5b5('0x3a')]=qs[_0xf5b5('0x31')](_[_0xf5b5('0x3b')](_0x249f7a[_0xf5b5('0x30')],_0x3d698b[_0xf5b5('0x31')]),_0xace3c);if(_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x3c')]){_0x1638ba[_0xf5b5('0x3a')]=_[_0xf5b5('0x3d')](_0x1638ba[_0xf5b5('0x3a')],{'$or':_[_0xf5b5('0x2a')](_0xace3c,function(_0x36b209){if(_0x36b209[_0xf5b5('0x2d')]!=='VIRTUAL'){var _0x5a253c={};_0x5a253c[_0x36b209['name']]={'$like':'%'+_0x249f7a[_0xf5b5('0x30')][_0xf5b5('0x3c')]+'%'};return _0x5a253c;}})});}_0x1638ba=_[_0xf5b5('0x3d')]({},_0x1638ba,_0x249f7a[_0xf5b5('0x3e')]);var _0xe69f81={'where':_0x1638ba['where']};return db[_0xf5b5('0x2b')][_0xf5b5('0x1c')](_0xe69f81)[_0xf5b5('0x23')](function(_0x307b8b){_0x5adc79[_0xf5b5('0x1c')]=_0x307b8b;if(_0x249f7a['query'][_0xf5b5('0x3f')]){_0x1638ba[_0xf5b5('0x40')]=[{'all':!![]}];}return db[_0xf5b5('0x2b')]['findAll'](_0x1638ba);})[_0xf5b5('0x23')](function(_0x5cea5e){_0x5adc79[_0xf5b5('0x41')]=_0x5cea5e;return _0x5adc79;})['then'](respondWithFilteredResult(_0x312237,_0x1638ba))[_0xf5b5('0x42')](handleError(_0x312237,null));};exports[_0xf5b5('0x43')]=function(_0x144d2b,_0x25bc63){var _0x4b2fdc={'raw':!![],'where':{'id':_0x144d2b['params']['id']}},_0x58146f={};_0x58146f[_0xf5b5('0x2f')]=_[_0xf5b5('0x44')](db[_0xf5b5('0x2b')]['rawAttributes']);_0x58146f[_0xf5b5('0x30')]=_[_0xf5b5('0x44')](_0x144d2b[_0xf5b5('0x30')]);_0x58146f[_0xf5b5('0x31')]=_[_0xf5b5('0x33')](_0x58146f[_0xf5b5('0x2f')],_0x58146f[_0xf5b5('0x30')]);_0x4b2fdc[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x58146f['model'],qs['fields'](_0x144d2b['query'][_0xf5b5('0x34')]));_0x4b2fdc[_0xf5b5('0x32')]=_0x4b2fdc[_0xf5b5('0x32')][_0xf5b5('0x35')]?_0x4b2fdc[_0xf5b5('0x32')]:_0x58146f[_0xf5b5('0x2f')];if(_0x144d2b[_0xf5b5('0x30')][_0xf5b5('0x3f')]){_0x4b2fdc[_0xf5b5('0x40')]=[{'all':!![]}];}_0x4b2fdc=_[_0xf5b5('0x3d')]({},_0x4b2fdc,_0x144d2b[_0xf5b5('0x3e')]);return db[_0xf5b5('0x2b')][_0xf5b5('0x45')](_0x4b2fdc)[_0xf5b5('0x23')](handleEntityNotFound(_0x25bc63,null))[_0xf5b5('0x23')](respondWithResult(_0x25bc63,null))[_0xf5b5('0x42')](handleError(_0x25bc63,null));};exports[_0xf5b5('0x46')]=function(_0x4ef737,_0x20088c){return db[_0xf5b5('0x2b')][_0xf5b5('0x46')](_0x4ef737[_0xf5b5('0x47')],{})[_0xf5b5('0x23')](respondWithResult(_0x20088c,0xc9))['catch'](handleError(_0x20088c,null));};exports[_0xf5b5('0x22')]=function(_0x14de6b,_0x43346c){if(_0x14de6b[_0xf5b5('0x47')]['id']){delete _0x14de6b[_0xf5b5('0x47')]['id'];}return db[_0xf5b5('0x2b')][_0xf5b5('0x45')]({'where':{'id':_0x14de6b[_0xf5b5('0x48')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x43346c,null))['then'](saveUpdates(_0x14de6b['body'],null))[_0xf5b5('0x23')](respondWithResult(_0x43346c,null))[_0xf5b5('0x42')](handleError(_0x43346c,null));};exports[_0xf5b5('0x24')]=function(_0x2aa074,_0x50d69a){return db[_0xf5b5('0x2b')][_0xf5b5('0x45')]({'where':{'id':_0x2aa074[_0xf5b5('0x48')]['id']}})['then'](handleEntityNotFound(_0x50d69a,null))[_0xf5b5('0x23')](removeEntity(_0x50d69a,null))[_0xf5b5('0x42')](handleError(_0x50d69a,null));};exports[_0xf5b5('0x49')]=function(_0x533dc4,_0x10b21e){return db[_0xf5b5('0x2b')]['describe']()[_0xf5b5('0x23')](respondWithResult(_0x10b21e,null))[_0xf5b5('0x42')](handleError(_0x10b21e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d039d06..06cbb4f 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 _0x3061=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','api'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x3061,0xfb));var _0x1306=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x3061[_0x3c2b2e];return _0x27a338;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1306('0x0'));var moment=require(_0x1306('0x1'));var BPromise=require(_0x1306('0x2'));var rp=require(_0x1306('0x3'));var fs=require('fs');var path=require(_0x1306('0x4'));var rimraf=require(_0x1306('0x5'));var config=require(_0x1306('0x6'));var attributes=require(_0x1306('0x7'));module[_0x1306('0x8')]=function(_0x2924df,_0x17c155){return _0x2924df[_0x1306('0x9')](_0x1306('0xa'),attributes,{'tableName':_0x1306('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57c9=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','api','bluebird'];(function(_0x2a7909,_0x50e5fa){var _0x3052b3=function(_0x5b5568){while(--_0x5b5568){_0x2a7909['push'](_0x2a7909['shift']());}};_0x3052b3(++_0x50e5fa);}(_0x57c9,0xde));var _0x957c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x57c9[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x957c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x957c('0x1'));var moment=require('moment');var BPromise=require(_0x957c('0x2'));var rp=require(_0x957c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x957c('0x4'));var config=require(_0x957c('0x5'));var attributes=require(_0x957c('0x6'));module['exports']=function(_0x2c3feb,_0x2f2423){return _0x2c3feb[_0x957c('0x7')](_0x957c('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 2ffde89..2c780a3 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 _0xbdc8=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x5c27e5,_0x19adcb){var _0x5e0ad2=function(_0x5e9a1){while(--_0x5e9a1){_0x5c27e5['push'](_0x5c27e5['shift']());}};_0x5e0ad2(++_0x19adcb);}(_0xbdc8,0x18a));var _0x8bdc=function(_0x12d57b,_0x3e58d1){_0x12d57b=_0x12d57b-0x0;var _0x5b0e50=_0xbdc8[_0x12d57b];return _0x5b0e50;};'use strict';var _=require(_0x8bdc('0x0'));var util=require(_0x8bdc('0x1'));var moment=require(_0x8bdc('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bdc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bdc('0x4'))['db'];var utils=require(_0x8bdc('0x5'));var logger=require('../../config/logger')(_0x8bdc('0x6'));var config=require(_0x8bdc('0x7'));var jayson=require(_0x8bdc('0x8'));var client=jayson[_0x8bdc('0x9')][_0x8bdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58cb9b,_0x260c17,_0x5e3001){return new BPromise(function(_0x2c4ca4,_0x4f4d87){return client[_0x8bdc('0xb')](_0x58cb9b,_0x5e3001)[_0x8bdc('0xc')](function(_0x5d591a){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x260c17,_0x8bdc('0xd'));logger[_0x8bdc('0xe')](_0x8bdc('0xf'),_0x260c17,_0x8bdc('0xd'),JSON[_0x8bdc('0x10')](_0x5d591a));if(_0x5d591a['error']){if(_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x12')]===0x1f4){logger['error'](_0x8bdc('0x13'),_0x260c17,_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x14')]);return _0x4f4d87(_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x14')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x260c17,_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x14')]);return _0x2c4ca4(_0x5d591a[_0x8bdc('0x11')]['message']);}else{logger[_0x8bdc('0x15')](_0x8bdc('0x13'),_0x260c17,'request\x20sent');_0x2c4ca4(_0x5d591a[_0x8bdc('0x16')][_0x8bdc('0x14')]);}})[_0x8bdc('0x17')](function(_0x21ab8b){logger[_0x8bdc('0x11')](_0x8bdc('0x13'),_0x260c17,_0x21ab8b);_0x4f4d87(_0x21ab8b);});});} \ No newline at end of file +var _0x417e=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x4e5040,_0x2c288a){var _0x396234=function(_0x143d97){while(--_0x143d97){_0x4e5040['push'](_0x4e5040['shift']());}};_0x396234(++_0x2c288a);}(_0x417e,0x118));var _0xe417=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x417e[_0x2307fa];return _0x496486;};'use strict';var _=require(_0xe417('0x0'));var util=require(_0xe417('0x1'));var moment=require('moment');var BPromise=require(_0xe417('0x2'));var rs=require(_0xe417('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe417('0x4'))['db'];var utils=require(_0xe417('0x5'));var logger=require('../../config/logger')(_0xe417('0x6'));var config=require('../../config/environment');var jayson=require(_0xe417('0x7'));var client=jayson[_0xe417('0x8')][_0xe417('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14c451,_0x490baa,_0x3d8e02){return new BPromise(function(_0x1dede5,_0x32f8ff){return client['request'](_0x14c451,_0x3d8e02)['then'](function(_0xd3b9eb){logger['info'](_0xe417('0xa'),_0x490baa,_0xe417('0xb'));logger[_0xe417('0xc')](_0xe417('0xd'),_0x490baa,_0xe417('0xb'),JSON[_0xe417('0xe')](_0xd3b9eb));if(_0xd3b9eb[_0xe417('0xf')]){if(_0xd3b9eb['error'][_0xe417('0x10')]===0x1f4){logger['error'](_0xe417('0xa'),_0x490baa,_0xd3b9eb[_0xe417('0xf')][_0xe417('0x11')]);return _0x32f8ff(_0xd3b9eb[_0xe417('0xf')][_0xe417('0x11')]);}logger[_0xe417('0xf')](_0xe417('0xa'),_0x490baa,_0xd3b9eb['error'][_0xe417('0x11')]);return _0x1dede5(_0xd3b9eb[_0xe417('0xf')][_0xe417('0x11')]);}else{logger[_0xe417('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x490baa,'request\x20sent');_0x1dede5(_0xd3b9eb['result'][_0xe417('0x11')]);}})[_0xe417('0x13')](function(_0x440581){logger[_0xe417('0xf')](_0xe417('0xa'),_0x490baa,_0x440581);_0x32f8ff(_0x440581);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4a068b4..924002c 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 _0xee39=['./jscriptySessionReport.controller','get','isAuthenticated','index','describe','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee39,0x1e6));var _0x9ee3=function(_0xfe88c0,_0x1921b6){_0xfe88c0=_0xfe88c0-0x0;var _0x104792=_0xee39[_0xfe88c0];return _0x104792;};'use strict';var multer=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var path=require(_0x9ee3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ee3('0x3'));var router=express[_0x9ee3('0x4')]();var auth=require(_0x9ee3('0x5'));var interaction=require(_0x9ee3('0x6'));var config=require(_0x9ee3('0x7'));var controller=require(_0x9ee3('0x8'));router[_0x9ee3('0x9')]('/',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xb')]);router[_0x9ee3('0x9')]('/describe',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xc')]);router[_0x9ee3('0x9')]('/:id',auth[_0x9ee3('0xa')](),controller['show']);router[_0x9ee3('0x9')]('/:id/questions',auth[_0x9ee3('0xa')](),controller['getQuestions']);router['post']('/',auth[_0x9ee3('0xa')](),controller['create']);router[_0x9ee3('0xd')]('/:id',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xe')]);router[_0x9ee3('0xf')](_0x9ee3('0x10'),auth[_0x9ee3('0xa')](),controller[_0x9ee3('0x11')]);module[_0x9ee3('0x12')]=router; \ No newline at end of file +var _0xedd9=['show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x353a70,_0x4b34be){var _0x538a57=function(_0x1712d4){while(--_0x1712d4){_0x353a70['push'](_0x353a70['shift']());}};_0x538a57(++_0x4b34be);}(_0xedd9,0xfc));var _0x9edd=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xedd9[_0x456b77];return _0x118bb6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 4d49fbd..7306752 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 _0x305d=['BOOLEAN','sequelize','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x1f39ea,_0x46db42){var _0x3ab48a=function(_0x391a50){while(--_0x391a50){_0x1f39ea['push'](_0x1f39ea['shift']());}};_0x3ab48a(++_0x46db42);}(_0x305d,0x9b));var _0xd305=function(_0x17660d,_0x233288){_0x17660d=_0x17660d-0x0;var _0xce3b14=_0x305d[_0x17660d];return _0xce3b14;};'use strict';var moment=require('moment');var Sequelize=require(_0xd305('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xd305('0x1')],'set':function(_0x2f316e){this[_0xd305('0x2')]('starttime',_0x2f316e);this[_0xd305('0x2')](_0xd305('0x3'),moment()['format'](_0xd305('0x4')));}},'endtime':{'type':Sequelize[_0xd305('0x1')]},'membername':{'type':Sequelize[_0xd305('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd305('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd305('0x5')]},'completed':{'type':Sequelize[_0xd305('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x6b9b=['BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','STRING'];(function(_0x4cda06,_0x3cb29c){var _0x48f3fa=function(_0x21f3a6){while(--_0x21f3a6){_0x4cda06['push'](_0x4cda06['shift']());}};_0x48f3fa(++_0x3cb29c);}(_0x6b9b,0xb9));var _0xb6b9=function(_0x49d5df,_0x4b3a11){_0x49d5df=_0x49d5df-0x0;var _0x5de0e6=_0x6b9b[_0x49d5df];return _0x5de0e6;};'use strict';var moment=require(_0xb6b9('0x0'));var Sequelize=require(_0xb6b9('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xb6b9('0x2')],'set':function(_0x420485){this[_0xb6b9('0x3')](_0xb6b9('0x4'),_0x420485);this[_0xb6b9('0x3')](_0xb6b9('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb6b9('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb6b9('0x6')]},'uniqueid':{'type':Sequelize[_0xb6b9('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb6b9('0x6')]},'completed':{'type':Sequelize[_0xb6b9('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bdd1831..79c0d2f 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(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':!![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['JscriptySessionReport'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b){return db['JscriptySessionReport'][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports[_0x0a9e('0x46')]=function(_0x61bb17,_0x30decb,_0x2e5165){var _0x375c18={'raw':!![],'where':{}};var _0x5d38ae={};var _0x4b1b9f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0a9e('0x47')]({'where':{'id':_0x61bb17[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))['then'](function(_0x2b69d9){if(_0x2b69d9){_0x5d38ae[_0x0a9e('0x2a')]=_['keys'](db['JscriptyQuestionReport'][_0x0a9e('0x27')]);_0x5d38ae['query']=_[_0x0a9e('0x3f')](_0x61bb17['query']);_0x5d38ae[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5d38ae[_0x0a9e('0x2a')],_0x5d38ae['query']);_0x375c18[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5d38ae['model'],qs['fields'](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x375c18['attributes']=_0x375c18[_0x0a9e('0x2e')]['length']?_0x375c18[_0x0a9e('0x2e')]:_0x5d38ae['model'];if(!_0x61bb17[_0x0a9e('0x2b')]['hasOwnProperty']('nolimit')){_0x375c18['limit']=qs[_0x0a9e('0x1a')](_0x61bb17['query'][_0x0a9e('0x1a')]);_0x375c18[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}_0x375c18[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x61bb17[_0x0a9e('0x2b')]['sort']);_0x375c18[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x48')](_0x61bb17[_0x0a9e('0x2b')],_0x5d38ae[_0x0a9e('0x2c')]));_0x375c18[_0x0a9e('0x34')]['SessionId']=_0x2b69d9['id'];if(_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x375c18['where']=_[_0x0a9e('0x37')](_0x375c18['where'],{'$or':_[_0x0a9e('0x25')](_0x375c18['attributes'],function(_0x4b3c1a){var _0x5674ee={};_0x5674ee[_0x4b3c1a]={'$like':'%'+_0x61bb17[_0x0a9e('0x2b')]['filter']+'%'};return _0x5674ee;})});}_0x375c18=_[_0x0a9e('0x37')]({},_0x375c18,_0x61bb17[_0x0a9e('0x40')]);return db[_0x0a9e('0x49')][_0x0a9e('0x38')]({'where':_0x375c18[_0x0a9e('0x34')]})[_0x0a9e('0x22')](function(_0x49eed0){_0x4b1b9f[_0x0a9e('0x38')]=_0x49eed0;if(_0x61bb17['query'][_0x0a9e('0x39')]){_0x375c18[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x49')]['findAll'](_0x375c18);})[_0x0a9e('0x22')](function(_0x156f1c){_0x4b1b9f[_0x0a9e('0x3c')]=_0x156f1c;return _0x4b1b9f;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x30decb,_0x375c18))['catch'](handleError(_0x30decb,null));}; \ No newline at end of file +var _0xd8b0=['options','includeAll','include','rows','catch','show','params','intersection','merge','create','body','update','find','describe','rawAttributes','SessionId','map','JscriptyQuestionReport','findAll','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','JscriptySessionReport','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var licenseUtil=require(_0x0d8b('0x15'));var db=require(_0x0d8b('0x16'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x17')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b)[_0x0d8b('0x19')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x18')](_0x5ad086)[_0x0d8b('0x1a')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=_0xa86349[_0x0d8b('0x1b')],_0xe2e167=_0x23eb7b[_0x0d8b('0x1c')],_0x2cb03c=_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b[_0x0d8b('0x1d')],_0x5cd485;if(_0x2cb03c>=_0x17f7df){_0x2cb03c=_0x17f7df;_0x5cd485=0xc8;}else{_0x5cd485=0xce;}_0x4f6f21[_0x0d8b('0x18')](_0x5cd485);return _0x4f6f21[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0xe2e167+'-'+_0x2cb03c+'/'+_0x17f7df)[_0x0d8b('0x1a')](_0xa86349);}return null;};}function patchUpdates(_0x4a15bf){return function(_0x27512e){try{jsonpatch[_0x0d8b('0x20')](_0x27512e,_0x4a15bf,!![]);}catch(_0x196c0a){return BPromise[_0x0d8b('0x21')](_0x196c0a);}return _0x27512e[_0x0d8b('0x22')]();};}function saveUpdates(_0x5b709c,_0x393beb){return function(_0x352c17){if(_0x352c17){return _0x352c17['update'](_0x5b709c)['then'](function(_0x33fb87){return _0x33fb87;});}return null;};}function removeEntity(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')]()[_0x0d8b('0x24')](function(){_0x54a9a7[_0x0d8b('0x18')](0xcc)[_0x0d8b('0x19')]();});}};}function handleEntityNotFound(_0x221071,_0x2c64e2){return function(_0x30980c){if(!_0x30980c){_0x221071[_0x0d8b('0x17')](0x194);}return _0x30980c;};}function handleError(_0x27b695,_0x5e5bc3){_0x5e5bc3=_0x5e5bc3||0x1f4;return function(_0xe8bbee){logger[_0x0d8b('0x25')](_0xe8bbee['stack']);if(_0xe8bbee[_0x0d8b('0x26')]){delete _0xe8bbee['name'];}_0x27b695[_0x0d8b('0x18')](_0x5e5bc3)[_0x0d8b('0x27')](_0xe8bbee);};}exports[_0x0d8b('0x28')]=function(_0x4fe6f9,_0x59a905){var _0x28f639={},_0x3ef745={},_0x4c05ee={'count':0x0,'rows':[]};var _0xcbc4ac=_['map'](db[_0x0d8b('0x29')]['rawAttributes'],function(_0x97050a){return{'name':_0x97050a['fieldName'],'type':_0x97050a[_0x0d8b('0x2a')]['key']};});_0x3ef745[_0x0d8b('0x2b')]=_['map'](_0xcbc4ac,_0x0d8b('0x26'));_0x3ef745[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0x4fe6f9['query']);_0x3ef745['filters']=_['intersection'](_0x3ef745[_0x0d8b('0x2b')],_0x3ef745['query']);_0x28f639[_0x0d8b('0x2e')]=_['intersection'](_0x3ef745['model'],qs[_0x0d8b('0x2f')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x28f639[_0x0d8b('0x2e')]=_0x28f639[_0x0d8b('0x2e')][_0x0d8b('0x30')]?_0x28f639[_0x0d8b('0x2e')]:_0x3ef745[_0x0d8b('0x2b')];if(!_0x4fe6f9['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x28f639['limit']=qs[_0x0d8b('0x1d')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x28f639['offset']=qs[_0x0d8b('0x1c')](_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x1c')]);}_0x28f639[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x4fe6f9['query'][_0x0d8b('0x34')]);_0x28f639[_0x0d8b('0x35')]=qs['filters'](_[_0x0d8b('0x36')](_0x4fe6f9[_0x0d8b('0x2c')],_0x3ef745[_0x0d8b('0x37')]),_0xcbc4ac);if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x28f639['where']=_['merge'](_0x28f639[_0x0d8b('0x35')],{'$or':_['map'](_0xcbc4ac,function(_0x531c55){if(_0x531c55[_0x0d8b('0x2a')]!==_0x0d8b('0x39')){var _0x15ec8a={};_0x15ec8a[_0x531c55[_0x0d8b('0x26')]]={'$like':'%'+_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x15ec8a;}})});}_0x28f639=_['merge']({},_0x28f639,_0x4fe6f9[_0x0d8b('0x3a')]);var _0x6a02ad={'where':_0x28f639[_0x0d8b('0x35')]};return db[_0x0d8b('0x29')][_0x0d8b('0x1b')](_0x6a02ad)[_0x0d8b('0x24')](function(_0xf1680e){_0x4c05ee['count']=_0xf1680e;if(_0x4fe6f9[_0x0d8b('0x2c')][_0x0d8b('0x3b')]){_0x28f639[_0x0d8b('0x3c')]=[{'all':!![]}];}return db[_0x0d8b('0x29')]['findAll'](_0x28f639);})[_0x0d8b('0x24')](function(_0x4b4bde){_0x4c05ee[_0x0d8b('0x3d')]=_0x4b4bde;return _0x4c05ee;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x59a905,_0x28f639))[_0x0d8b('0x3e')](handleError(_0x59a905,null));};exports[_0x0d8b('0x3f')]=function(_0x35fa7e,_0x3e632e){var _0x1ff17d={'raw':!![],'where':{'id':_0x35fa7e[_0x0d8b('0x40')]['id']}},_0x373f69={};_0x373f69[_0x0d8b('0x2b')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x373f69['query']=_['keys'](_0x35fa7e[_0x0d8b('0x2c')]);_0x373f69[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x373f69['model'],_0x373f69['query']);_0x1ff17d[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x373f69[_0x0d8b('0x2b')],qs['fields'](_0x35fa7e[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x1ff17d['attributes']=_0x1ff17d['attributes'][_0x0d8b('0x30')]?_0x1ff17d['attributes']:_0x373f69[_0x0d8b('0x2b')];if(_0x35fa7e['query']['includeAll']){_0x1ff17d[_0x0d8b('0x3c')]=[{'all':!![]}];}_0x1ff17d=_[_0x0d8b('0x42')]({},_0x1ff17d,_0x35fa7e['options']);return db['JscriptySessionReport']['find'](_0x1ff17d)['then'](handleEntityNotFound(_0x3e632e,null))[_0x0d8b('0x24')](respondWithResult(_0x3e632e,null))[_0x0d8b('0x3e')](handleError(_0x3e632e,null));};exports[_0x0d8b('0x43')]=function(_0x490eda,_0xb0910e){return db[_0x0d8b('0x29')][_0x0d8b('0x43')](_0x490eda[_0x0d8b('0x44')],{})[_0x0d8b('0x24')](respondWithResult(_0xb0910e,0xc9))[_0x0d8b('0x3e')](handleError(_0xb0910e,null));};exports[_0x0d8b('0x45')]=function(_0x1d5067,_0x384a5e){if(_0x1d5067[_0x0d8b('0x44')]['id']){delete _0x1d5067[_0x0d8b('0x44')]['id'];}return db[_0x0d8b('0x29')][_0x0d8b('0x46')]({'where':{'id':_0x1d5067[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x384a5e,null))[_0x0d8b('0x24')](saveUpdates(_0x1d5067[_0x0d8b('0x44')],null))[_0x0d8b('0x24')](respondWithResult(_0x384a5e,null))[_0x0d8b('0x3e')](handleError(_0x384a5e,null));};exports['destroy']=function(_0x371fa0,_0x4d8850){return db['JscriptySessionReport'][_0x0d8b('0x46')]({'where':{'id':_0x371fa0[_0x0d8b('0x40')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x4d8850,null))[_0x0d8b('0x24')](removeEntity(_0x4d8850,null))['catch'](handleError(_0x4d8850,null));};exports[_0x0d8b('0x47')]=function(_0x1106d6,_0x386074){return db[_0x0d8b('0x29')][_0x0d8b('0x47')]()['then'](respondWithResult(_0x386074,null))['catch'](handleError(_0x386074,null));};exports['getQuestions']=function(_0x573f4f,_0x368ede,_0xf22c3c){var _0x5e3bb4={'raw':!![],'where':{}};var _0x4950a8={};var _0x44c5c1={'count':0x0,'rows':[]};return db[_0x0d8b('0x29')]['findOne']({'where':{'id':_0x573f4f['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x368ede,null))[_0x0d8b('0x24')](function(_0x3cd00a){if(_0x3cd00a){_0x4950a8[_0x0d8b('0x2b')]=_[_0x0d8b('0x2d')](db['JscriptyQuestionReport'][_0x0d8b('0x48')]);_0x4950a8[_0x0d8b('0x2c')]=_['keys'](_0x573f4f['query']);_0x4950a8[_0x0d8b('0x37')]=_[_0x0d8b('0x41')](_0x4950a8['model'],_0x4950a8['query']);_0x5e3bb4[_0x0d8b('0x2e')]=_[_0x0d8b('0x41')](_0x4950a8[_0x0d8b('0x2b')],qs[_0x0d8b('0x2f')](_0x573f4f['query'][_0x0d8b('0x2f')]));_0x5e3bb4['attributes']=_0x5e3bb4['attributes'][_0x0d8b('0x30')]?_0x5e3bb4[_0x0d8b('0x2e')]:_0x4950a8['model'];if(!_0x573f4f['query'][_0x0d8b('0x31')](_0x0d8b('0x32'))){_0x5e3bb4[_0x0d8b('0x1d')]=qs[_0x0d8b('0x1d')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x1d')]);_0x5e3bb4[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x573f4f['query'][_0x0d8b('0x1c')]);}_0x5e3bb4[_0x0d8b('0x33')]=qs[_0x0d8b('0x34')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x34')]);_0x5e3bb4[_0x0d8b('0x35')]=qs[_0x0d8b('0x37')](_[_0x0d8b('0x36')](_0x573f4f[_0x0d8b('0x2c')],_0x4950a8['filters']));_0x5e3bb4[_0x0d8b('0x35')][_0x0d8b('0x49')]=_0x3cd00a['id'];if(_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x5e3bb4[_0x0d8b('0x35')]=_['merge'](_0x5e3bb4[_0x0d8b('0x35')],{'$or':_[_0x0d8b('0x4a')](_0x5e3bb4[_0x0d8b('0x2e')],function(_0x17a87f){var _0x1d6cd4={};_0x1d6cd4[_0x17a87f]={'$like':'%'+_0x573f4f['query']['filter']+'%'};return _0x1d6cd4;})});}_0x5e3bb4=_[_0x0d8b('0x42')]({},_0x5e3bb4,_0x573f4f[_0x0d8b('0x3a')]);return db[_0x0d8b('0x4b')][_0x0d8b('0x1b')]({'where':_0x5e3bb4['where']})[_0x0d8b('0x24')](function(_0x12aef7){_0x44c5c1[_0x0d8b('0x1b')]=_0x12aef7;if(_0x573f4f['query'][_0x0d8b('0x3b')]){_0x5e3bb4['include']=[{'all':!![]}];}return db[_0x0d8b('0x4b')][_0x0d8b('0x4c')](_0x5e3bb4);})[_0x0d8b('0x24')](function(_0x26ccf0){_0x44c5c1[_0x0d8b('0x3d')]=_0x26ccf0;return _0x44c5c1;});}})[_0x0d8b('0x24')](respondWithFilteredResult(_0x368ede,_0x5e3bb4))['catch'](handleError(_0x368ede,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d035f73..f9477ff 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 _0x1254=['report_jscripty_sessions','lodash','util','api','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x1254,0x79));var _0x4125=function(_0x5da550,_0x60f06f){_0x5da550=_0x5da550-0x0;var _0x5246eb=_0x1254[_0x5da550];return _0x5246eb;};'use strict';var _=require(_0x4125('0x0'));var util=require(_0x4125('0x1'));var logger=require('../../config/logger')(_0x4125('0x2'));var moment=require('moment');var BPromise=require(_0x4125('0x3'));var rp=require(_0x4125('0x4'));var fs=require('fs');var path=require(_0x4125('0x5'));var rimraf=require('rimraf');var config=require(_0x4125('0x6'));var attributes=require(_0x4125('0x7'));module['exports']=function(_0x328cc2,_0x51cdb4){return _0x328cc2['define'](_0x4125('0x8'),attributes,{'tableName':_0x4125('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ace=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x28d87a,_0xe7c5f){var _0x385f93=function(_0x61fed9){while(--_0x61fed9){_0x28d87a['push'](_0x28d87a['shift']());}};_0x385f93(++_0xe7c5f);}(_0x7ace,0x16c));var _0xe7ac=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x7ace[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xe7ac('0x0'));var util=require(_0xe7ac('0x1'));var logger=require(_0xe7ac('0x2'))(_0xe7ac('0x3'));var moment=require('moment');var BPromise=require(_0xe7ac('0x4'));var rp=require(_0xe7ac('0x5'));var fs=require('fs');var path=require(_0xe7ac('0x6'));var rimraf=require(_0xe7ac('0x7'));var config=require(_0xe7ac('0x8'));var attributes=require(_0xe7ac('0x9'));module[_0xe7ac('0xa')]=function(_0x3513af,_0x5088ae){return _0x3513af[_0xe7ac('0xb')](_0xe7ac('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index ed262b6..c14275b 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 _0x01bb=['http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x29c3d1,_0x22f4e3){var _0x1ace84=function(_0x1c8174){while(--_0x1c8174){_0x29c3d1['push'](_0x29c3d1['shift']());}};_0x1ace84(++_0x22f4e3);}(_0x01bb,0x171));var _0xb01b=function(_0x10eb67,_0x576170){_0x10eb67=_0x10eb67-0x0;var _0x2b9283=_0x01bb[_0x10eb67];return _0x2b9283;};'use strict';var _=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var moment=require(_0xb01b('0x2'));var BPromise=require(_0xb01b('0x3'));var rs=require(_0xb01b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb01b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb01b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb01b('0x7'));var client=jayson[_0xb01b('0x8')][_0xb01b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc9f593,_0x21bfc5,_0x197515){return new BPromise(function(_0xb32053,_0x126b26){return client['request'](_0xc9f593,_0x197515)[_0xb01b('0xa')](function(_0x2292de){logger[_0xb01b('0xb')](_0xb01b('0xc'),_0x21bfc5,_0xb01b('0xd'));logger['debug'](_0xb01b('0xe'),_0x21bfc5,_0xb01b('0xd'),JSON[_0xb01b('0xf')](_0x2292de));if(_0x2292de[_0xb01b('0x10')]){if(_0x2292de['error'][_0xb01b('0x11')]===0x1f4){logger[_0xb01b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x21bfc5,_0x2292de['error'][_0xb01b('0x12')]);return _0x126b26(_0x2292de[_0xb01b('0x10')][_0xb01b('0x12')]);}logger[_0xb01b('0x10')](_0xb01b('0xc'),_0x21bfc5,_0x2292de[_0xb01b('0x10')][_0xb01b('0x12')]);return _0xb32053(_0x2292de[_0xb01b('0x10')][_0xb01b('0x12')]);}else{logger[_0xb01b('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x21bfc5,_0xb01b('0xd'));_0xb32053(_0x2292de[_0xb01b('0x13')][_0xb01b('0x12')]);}})[_0xb01b('0x14')](function(_0x2b6875){logger[_0xb01b('0x10')](_0xb01b('0xc'),_0x21bfc5,_0x2b6875);_0x126b26(_0x2b6875);});});} \ No newline at end of file +var _0x2f36=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x585f40,_0x4a3091){var _0x44fc86=function(_0x5bcedc){while(--_0x5bcedc){_0x585f40['push'](_0x585f40['shift']());}};_0x44fc86(++_0x4a3091);}(_0x2f36,0x1e4));var _0x62f3=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2f36[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x62f3('0x0'));var util=require(_0x62f3('0x1'));var moment=require(_0x62f3('0x2'));var BPromise=require('bluebird');var rs=require(_0x62f3('0x3'));var fs=require('fs');var Redis=require(_0x62f3('0x4'));var db=require(_0x62f3('0x5'))['db'];var utils=require(_0x62f3('0x6'));var logger=require(_0x62f3('0x7'))(_0x62f3('0x8'));var config=require(_0x62f3('0x9'));var jayson=require(_0x62f3('0xa'));var client=jayson[_0x62f3('0xb')][_0x62f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59ad70,_0x4d68a5,_0xd27cc7){return new BPromise(function(_0xbeb52f,_0x2ee5f3){return client['request'](_0x59ad70,_0xd27cc7)['then'](function(_0x5ec83f){logger[_0x62f3('0xd')](_0x62f3('0xe'),_0x4d68a5,_0x62f3('0xf'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4d68a5,_0x62f3('0xf'),JSON['stringify'](_0x5ec83f));if(_0x5ec83f[_0x62f3('0x10')]){if(_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x11')]===0x1f4){logger[_0x62f3('0x10')](_0x62f3('0xe'),_0x4d68a5,_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);return _0x2ee5f3(_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);}logger[_0x62f3('0x10')](_0x62f3('0xe'),_0x4d68a5,_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);return _0xbeb52f(_0x5ec83f[_0x62f3('0x10')][_0x62f3('0x12')]);}else{logger[_0x62f3('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d68a5,_0x62f3('0xf'));_0xbeb52f(_0x5ec83f[_0x62f3('0x13')]['message']);}})['catch'](function(_0x457453){logger['error'](_0x62f3('0xe'),_0x4d68a5,_0x457453);_0x2ee5f3(_0x457453);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c98792b..c7a4e7b 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 _0x6c0b=['index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6c0b,0xa5));var _0xb6c0=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x6c0b[_0x5ac0f0];return _0x4aceec;};'use strict';var multer=require(_0xb6c0('0x0'));var util=require(_0xb6c0('0x1'));var path=require(_0xb6c0('0x2'));var timeout=require(_0xb6c0('0x3'));var express=require(_0xb6c0('0x4'));var router=express[_0xb6c0('0x5')]();var auth=require(_0xb6c0('0x6'));var interaction=require(_0xb6c0('0x7'));var config=require(_0xb6c0('0x8'));var controller=require(_0xb6c0('0x9'));router[_0xb6c0('0xa')]('/',controller[_0xb6c0('0xb')]);router[_0xb6c0('0xc')]('/:id',auth[_0xb6c0('0xd')](),controller[_0xb6c0('0xe')]);module[_0xb6c0('0xf')]=router; \ No newline at end of file +var _0xf86a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','put','/:id','exports'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xf86a,0x1d4));var _0xaf86=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf86a[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xaf86('0x0'));var util=require(_0xaf86('0x1'));var path=require(_0xaf86('0x2'));var timeout=require(_0xaf86('0x3'));var express=require(_0xaf86('0x4'));var router=express[_0xaf86('0x5')]();var auth=require(_0xaf86('0x6'));var interaction=require(_0xaf86('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xaf86('0x8')]('/',controller[_0xaf86('0x9')]);router[_0xaf86('0xa')](_0xaf86('0xb'),auth['isAuthenticated'](),controller['update']);module[_0xaf86('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d63c54e..c4d3d0d 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 _0x3f8a=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x3a14fb,_0x193cda){var _0x107656=function(_0x40b2e8){while(--_0x40b2e8){_0x3a14fb['push'](_0x3a14fb['shift']());}};_0x107656(++_0x193cda);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2f759f,_0x3b5339){_0x2f759f=_0x2f759f-0x0;var _0x58b759=_0x3f8a[_0x2f759f];return _0x58b759;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'license':{'type':Sequelize[_0xa3f8('0x2')]},'data1':{'type':Sequelize[_0xa3f8('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa3f8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1967=['TEXT','STRING','INTEGER','exports'];(function(_0x30764a,_0x2356ad){var _0x25f1d8=function(_0x310912){while(--_0x310912){_0x30764a['push'](_0x30764a['shift']());}};_0x25f1d8(++_0x2356ad);}(_0x1967,0x173));var _0x7196=function(_0x540605,_0x49ade1){_0x540605=_0x540605-0x0;var _0x4d89ff=_0x1967[_0x540605];return _0x4d89ff;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'license':{'type':Sequelize[_0x7196('0x1')]},'data1':{'type':Sequelize[_0x7196('0x2')]},'data2':{'type':Sequelize[_0x7196('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7196('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 4c1ab0b..7c06555 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 _0x8ef6=['update','body','params','get','checkLicense','key','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','limit','reject','save','then','stack','send','index','model','keys','License','rawAttributes','query','intersection','fields','attributes','length','merge','options','getLicense','catch'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2d46f3,_0x2d294d){_0x2d46f3=_0x2d46f3-0x0;var _0x4b75f1=_0x8ef6[_0x2d46f3];return _0x4b75f1;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x1a'));var db=require(_0x68ef('0x1b'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1c')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1d')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1e')](_0x2657c5)[_0x68ef('0x1f')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=_0x35493d[_0x68ef('0x20')],_0x3d1e90=_0x5005ba['offset'],_0x3780a4=_0x5005ba['offset']+_0x5005ba[_0x68ef('0x21')],_0x5c4456;if(_0x3780a4>=_0x37c4cc){_0x3780a4=_0x37c4cc;_0x5c4456=0xc8;}else{_0x5c4456=0xce;}_0x24682d[_0x68ef('0x1e')](_0x5c4456);return _0x24682d['set']('Content-Range',_0x3d1e90+'-'+_0x3780a4+'/'+_0x37c4cc)[_0x68ef('0x1f')](_0x35493d);}return null;};}function patchUpdates(_0x2cd92c){return function(_0x318514){try{jsonpatch['apply'](_0x318514,_0x2cd92c,!![]);}catch(_0x1dc49c){return BPromise[_0x68ef('0x22')](_0x1dc49c);}return _0x318514[_0x68ef('0x23')]();};}function saveUpdates(_0x5b246b,_0x3c46d4){return function(_0x3be4c0){if(_0x3be4c0){return _0x3be4c0['update'](_0x5b246b)[_0x68ef('0x24')](function(_0xf4760f){return _0xf4760f;});}return null;};}function removeEntity(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['destroy']()[_0x68ef('0x24')](function(){_0x19aa3d[_0x68ef('0x1e')](0xcc)[_0x68ef('0x1d')]();});}};}function handleEntityNotFound(_0x2e6e39,_0x438b4c){return function(_0xfe2595){if(!_0xfe2595){_0x2e6e39[_0x68ef('0x1c')](0x194);}return _0xfe2595;};}function handleError(_0x49374f,_0x65fd09){_0x65fd09=_0x65fd09||0x1f4;return function(_0x13280b){logger['error'](_0x13280b[_0x68ef('0x25')]);if(_0x13280b['name']){delete _0x13280b['name'];}_0x49374f['status'](_0x65fd09)[_0x68ef('0x26')](_0x13280b);};}var utilLicense=require(_0x68ef('0x1a'));exports[_0x68ef('0x27')]=function(_0x29518e,_0x52e67e){var _0x4a0550={'raw':!![],'where':{'id':0x1}},_0x1cbe4f={};_0x1cbe4f[_0x68ef('0x28')]=_[_0x68ef('0x29')](db[_0x68ef('0x2a')][_0x68ef('0x2b')]);_0x1cbe4f[_0x68ef('0x2c')]=_[_0x68ef('0x29')](_0x29518e[_0x68ef('0x2c')]);_0x1cbe4f['filters']=_[_0x68ef('0x2d')](_0x1cbe4f[_0x68ef('0x28')],_0x1cbe4f[_0x68ef('0x2c')]);_0x4a0550['attributes']=_[_0x68ef('0x2d')](_0x1cbe4f['model'],qs[_0x68ef('0x2e')](_0x29518e[_0x68ef('0x2c')]['fields']));_0x4a0550['attributes']=_0x4a0550[_0x68ef('0x2f')][_0x68ef('0x30')]?_0x4a0550['attributes']:_0x1cbe4f[_0x68ef('0x28')];_0x4a0550=_[_0x68ef('0x31')]({},_0x4a0550,_0x29518e[_0x68ef('0x32')]);return utilLicense[_0x68ef('0x33')](_0x4a0550)['then'](respondWithResult(_0x52e67e,null))[_0x68ef('0x34')](handleError(_0x52e67e,null));};exports[_0x68ef('0x35')]=function(_0x5f137b,_0x2f8de2){if(_0x5f137b['body']['id']){delete _0x5f137b[_0x68ef('0x36')]['id'];}return db[_0x68ef('0x2a')]['find']({'where':{'id':_0x5f137b[_0x68ef('0x37')]['id']}})['then'](handleEntityNotFound(_0x2f8de2,null))[_0x68ef('0x24')](function(_0x575f43){var _0x2fbb0d=_0x575f43[_0x68ef('0x38')]({'plain':!![]});return utilLicense[_0x68ef('0x39')](_0x2fbb0d,_0x5f137b['body'][_0x68ef('0x3a')]);})['then'](function(_0x476938){if(!_0x476938['demo']){return saveUpdates(_0x5f137b[_0x68ef('0x36')],null);}return _0x476938;})[_0x68ef('0x24')](respondWithResult(_0x2f8de2,null))[_0x68ef('0x34')](handleError(_0x2f8de2,null));}; \ No newline at end of file +var _0xff16=['checkLicense','key','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','error','stack','send','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','options','getLicense','body','params'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xff16,0x7f));var _0x6ff1=function(_0x10da77,_0x51723f){_0x10da77=_0x10da77-0x0;var _0x387dbb=_0xff16[_0x10da77];return _0x387dbb;};'use strict';var pdf=require(_0x6ff1('0x0'));var emlformat=require(_0x6ff1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ff1('0x2'));var jsonpatch=require(_0x6ff1('0x3'));var rp=require(_0x6ff1('0x4'));var moment=require(_0x6ff1('0x5'));var BPromise=require(_0x6ff1('0x6'));var Mustache=require(_0x6ff1('0x7'));var util=require(_0x6ff1('0x8'));var path=require(_0x6ff1('0x9'));var sox=require('sox');var csv=require(_0x6ff1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6ff1('0xb'));var squel=require(_0x6ff1('0xc'));var crypto=require(_0x6ff1('0xd'));var jsforce=require(_0x6ff1('0xe'));var deskjs=require(_0x6ff1('0xf'));var toCsv=require(_0x6ff1('0xa'));var querystring=require(_0x6ff1('0x10'));var Papa=require(_0x6ff1('0x11'));var Redis=require('ioredis');var authService=require(_0x6ff1('0x12'));var qs=require(_0x6ff1('0x13'));var as=require(_0x6ff1('0x14'));var hardwareService=require(_0x6ff1('0x15'));var logger=require(_0x6ff1('0x16'))(_0x6ff1('0x17'));var utils=require(_0x6ff1('0x18'));var config=require(_0x6ff1('0x19'));var licenseUtil=require(_0x6ff1('0x1a'));var db=require(_0x6ff1('0x1b'))['db'];function respondWithStatusCode(_0x4e8484,_0x5cf649){_0x5cf649=_0x5cf649||0xcc;return function(_0x5dacd6){if(_0x5dacd6){return _0x4e8484['sendStatus'](_0x5cf649);}return _0x4e8484[_0x6ff1('0x1c')](_0x5cf649)[_0x6ff1('0x1d')]();};}function respondWithResult(_0x1451af,_0x543e07){_0x543e07=_0x543e07||0xc8;return function(_0x58952d){if(_0x58952d){return _0x1451af['status'](_0x543e07)[_0x6ff1('0x1e')](_0x58952d);}};}function respondWithFilteredResult(_0x1ec8e9,_0x23112d){return function(_0x29e6c7){if(_0x29e6c7){var _0x36fa15=_0x29e6c7[_0x6ff1('0x1f')],_0x475144=_0x23112d[_0x6ff1('0x20')],_0x5f5c1d=_0x23112d[_0x6ff1('0x20')]+_0x23112d[_0x6ff1('0x21')],_0x155d26;if(_0x5f5c1d>=_0x36fa15){_0x5f5c1d=_0x36fa15;_0x155d26=0xc8;}else{_0x155d26=0xce;}_0x1ec8e9[_0x6ff1('0x1c')](_0x155d26);return _0x1ec8e9['set'](_0x6ff1('0x22'),_0x475144+'-'+_0x5f5c1d+'/'+_0x36fa15)[_0x6ff1('0x1e')](_0x29e6c7);}return null;};}function patchUpdates(_0x24a697){return function(_0x256457){try{jsonpatch[_0x6ff1('0x23')](_0x256457,_0x24a697,!![]);}catch(_0x1b75fb){return BPromise['reject'](_0x1b75fb);}return _0x256457[_0x6ff1('0x24')]();};}function saveUpdates(_0x54c961,_0x328325){return function(_0x3d9816){if(_0x3d9816){return _0x3d9816[_0x6ff1('0x25')](_0x54c961)[_0x6ff1('0x26')](function(_0x251415){return _0x251415;});}return null;};}function removeEntity(_0x47fd1f,_0x56027f){return function(_0x561bcd){if(_0x561bcd){return _0x561bcd['destroy']()[_0x6ff1('0x26')](function(){_0x47fd1f[_0x6ff1('0x1c')](0xcc)[_0x6ff1('0x1d')]();});}};}function handleEntityNotFound(_0x41b160,_0x1ec4f1){return function(_0x25b27d){if(!_0x25b27d){_0x41b160[_0x6ff1('0x27')](0x194);}return _0x25b27d;};}function handleError(_0x35f395,_0x4e699a){_0x4e699a=_0x4e699a||0x1f4;return function(_0x13acb3){logger[_0x6ff1('0x28')](_0x13acb3[_0x6ff1('0x29')]);if(_0x13acb3['name']){delete _0x13acb3['name'];}_0x35f395[_0x6ff1('0x1c')](_0x4e699a)[_0x6ff1('0x2a')](_0x13acb3);};}var utilLicense=require('../../config/license/util');exports[_0x6ff1('0x2b')]=function(_0xc46904,_0x5cc00f){var _0x3a062c={'raw':!![],'where':{'id':0x1}},_0x3b9d53={};_0x3b9d53['model']=_[_0x6ff1('0x2c')](db[_0x6ff1('0x2d')][_0x6ff1('0x2e')]);_0x3b9d53[_0x6ff1('0x2f')]=_['keys'](_0xc46904[_0x6ff1('0x2f')]);_0x3b9d53[_0x6ff1('0x30')]=_[_0x6ff1('0x31')](_0x3b9d53[_0x6ff1('0x32')],_0x3b9d53[_0x6ff1('0x2f')]);_0x3a062c['attributes']=_[_0x6ff1('0x31')](_0x3b9d53[_0x6ff1('0x32')],qs[_0x6ff1('0x33')](_0xc46904['query'][_0x6ff1('0x33')]));_0x3a062c['attributes']=_0x3a062c[_0x6ff1('0x34')][_0x6ff1('0x35')]?_0x3a062c[_0x6ff1('0x34')]:_0x3b9d53[_0x6ff1('0x32')];_0x3a062c=_[_0x6ff1('0x36')]({},_0x3a062c,_0xc46904[_0x6ff1('0x37')]);return utilLicense[_0x6ff1('0x38')](_0x3a062c)['then'](respondWithResult(_0x5cc00f,null))['catch'](handleError(_0x5cc00f,null));};exports[_0x6ff1('0x25')]=function(_0x8f4931,_0x216e79){if(_0x8f4931[_0x6ff1('0x39')]['id']){delete _0x8f4931[_0x6ff1('0x39')]['id'];}return db[_0x6ff1('0x2d')]['find']({'where':{'id':_0x8f4931[_0x6ff1('0x3a')]['id']}})[_0x6ff1('0x26')](handleEntityNotFound(_0x216e79,null))[_0x6ff1('0x26')](function(_0x5a48bc){var _0x1b5ce1=_0x5a48bc['get']({'plain':!![]});return utilLicense[_0x6ff1('0x3b')](_0x1b5ce1,_0x8f4931['body'][_0x6ff1('0x3c')]);})[_0x6ff1('0x26')](function(_0x51e12b){if(!_0x51e12b['demo']){return saveUpdates(_0x8f4931['body'],null);}return _0x51e12b;})[_0x6ff1('0x26')](respondWithResult(_0x216e79,null))[_0x6ff1('0x3d')](handleError(_0x216e79,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5a4e14e..0477c91 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 _0x80ce=['moment','request-promise','path','rimraf','define','License','api'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x80ce,0xae));var _0xe80c=function(_0x474e88,_0x53dc50){_0x474e88=_0x474e88-0x0;var _0x19553e=_0x80ce[_0x474e88];return _0x19553e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe80c('0x0'));var moment=require(_0xe80c('0x1'));var BPromise=require('bluebird');var rp=require(_0xe80c('0x2'));var fs=require('fs');var path=require(_0xe80c('0x3'));var rimraf=require(_0xe80c('0x4'));var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x48d62c,_0x19b480){return _0x48d62c[_0xe80c('0x5')](_0xe80c('0x6'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x894c=['../../config/environment','define','util','moment','request-promise','path'];(function(_0x234154,_0x300bdc){var _0x3c6e71=function(_0x436efb){while(--_0x436efb){_0x234154['push'](_0x234154['shift']());}};_0x3c6e71(++_0x300bdc);}(_0x894c,0x98));var _0xc894=function(_0x59ad4a,_0x130b73){_0x59ad4a=_0x59ad4a-0x0;var _0x3247bb=_0x894c[_0x59ad4a];return _0x3247bb;};'use strict';var _=require('lodash');var util=require(_0xc894('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc894('0x1'));var BPromise=require('bluebird');var rp=require(_0xc894('0x2'));var fs=require('fs');var path=require(_0xc894('0x3'));var rimraf=require('rimraf');var config=require(_0xc894('0x4'));var attributes=require('./license.attributes');module['exports']=function(_0xbca199,_0x6f3adc){return _0xbca199[_0xc894('0x5')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 1b158c3..11ba711 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 _0x720e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x4bf0b5,_0x2d3087){var _0x42c84=function(_0x3b5954){while(--_0x3b5954){_0x4bf0b5['push'](_0x4bf0b5['shift']());}};_0x42c84(++_0x2d3087);}(_0x720e,0x1cb));var _0xe720=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x720e[_0x2307fa];return _0x496486;};'use strict';var _=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var moment=require(_0xe720('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe720('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe720('0x4'));var logger=require(_0xe720('0x5'))(_0xe720('0x6'));var config=require(_0xe720('0x7'));var jayson=require(_0xe720('0x8'));var client=jayson[_0xe720('0x9')][_0xe720('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ffe24,_0x3e38ca,_0x19642d){return new BPromise(function(_0x4e715c,_0x4a3b70){return client['request'](_0x4ffe24,_0x19642d)[_0xe720('0xb')](function(_0x2e08e7){logger[_0xe720('0xc')]('License,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));logger[_0xe720('0xe')](_0xe720('0xf'),_0x3e38ca,_0xe720('0xd'),JSON[_0xe720('0x10')](_0x2e08e7));if(_0x2e08e7[_0xe720('0x11')]){if(_0x2e08e7['error']['code']===0x1f4){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);return _0x4a3b70(_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);}logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')]['message']);return _0x4e715c(_0x2e08e7['error'][_0xe720('0x13')]);}else{logger[_0xe720('0xc')]('License,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));_0x4e715c(_0x2e08e7[_0xe720('0x14')]['message']);}})[_0xe720('0x15')](function(_0x5ac1e2){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x5ac1e2);_0x4a3b70(_0x5ac1e2);});});} \ No newline at end of file +var _0x87ae=['debug','License,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','License,\x20%s,\x20%s','request\x20sent'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x87ae,0xf5));var _0xe87a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x87ae[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe87a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x1'));var db=require(_0xe87a('0x2'))['db'];var utils=require(_0xe87a('0x3'));var logger=require('../../config/logger')(_0xe87a('0x4'));var config=require(_0xe87a('0x5'));var jayson=require(_0xe87a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125dd3,_0x2fbd6b,_0x5dff22){return new BPromise(function(_0x379db4,_0x455b3a){return client['request'](_0x125dd3,_0x5dff22)[_0xe87a('0x7')](function(_0x278d7c){logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));logger[_0xe87a('0xa')](_0xe87a('0xb'),_0x2fbd6b,_0xe87a('0x9'),JSON[_0xe87a('0xc')](_0x278d7c));if(_0x278d7c['error']){if(_0x278d7c['error'][_0xe87a('0xd')]===0x1f4){logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c['error'][_0xe87a('0xf')]);return _0x455b3a(_0x278d7c[_0xe87a('0xe')]['message']);}logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c[_0xe87a('0xe')]['message']);return _0x379db4(_0x278d7c['error']['message']);}else{logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));_0x379db4(_0x278d7c[_0xe87a('0x10')][_0xe87a('0xf')]);}})['catch'](function(_0x415147){logger[_0xe87a('0xe')]('License,\x20%s,\x20%s',_0x2fbd6b,_0x415147);_0x455b3a(_0x415147);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a5eb0f1..1aa8e02 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 _0x4128=['get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/:id/send','send','/:id/users','removeDispositions','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4128,0x1a5));var _0x8412=function(_0x1d3d5f,_0x46ac4f){_0x1d3d5f=_0x1d3d5f-0x0;var _0x17c2d6=_0x4128[_0x1d3d5f];return _0x17c2d6;};'use strict';var multer=require(_0x8412('0x0'));var util=require(_0x8412('0x1'));var path=require(_0x8412('0x2'));var timeout=require(_0x8412('0x3'));var express=require(_0x8412('0x4'));var router=express[_0x8412('0x5')]();var auth=require(_0x8412('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8412('0x7'));var controller=require('./mailAccount.controller');router[_0x8412('0x8')]('/',auth[_0x8412('0x9')](),controller['index']);router[_0x8412('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8412('0xa')]);router[_0x8412('0x8')](_0x8412('0xb'),auth[_0x8412('0x9')](),controller['show']);router[_0x8412('0x8')](_0x8412('0xc'),auth[_0x8412('0x9')](),controller[_0x8412('0xd')]);router[_0x8412('0x8')]('/:id/canned_answers',auth[_0x8412('0x9')](),controller[_0x8412('0xe')]);router[_0x8412('0x8')](_0x8412('0xf'),auth['isAuthenticated'](),controller['getImap']);router[_0x8412('0x8')](_0x8412('0x10'),auth[_0x8412('0x9')](),controller[_0x8412('0x11')]);router['get'](_0x8412('0x12'),auth['isAuthenticated'](),controller[_0x8412('0x13')]);router[_0x8412('0x8')](_0x8412('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0x8412('0x8')](_0x8412('0x15'),auth[_0x8412('0x9')](),controller['getMessages']);router[_0x8412('0x8')](_0x8412('0x16'),auth[_0x8412('0x9')](),controller[_0x8412('0x17')]);router[_0x8412('0x8')]('/:id/users',auth[_0x8412('0x9')](),controller['getAgents']);router[_0x8412('0x18')](_0x8412('0xc'),auth[_0x8412('0x9')](),controller[_0x8412('0x19')]);router[_0x8412('0x18')](_0x8412('0x1a'),auth[_0x8412('0x9')](),controller[_0x8412('0x1b')]);router[_0x8412('0x18')]('/',auth[_0x8412('0x9')](),controller['create']);router['post'](_0x8412('0xf'),auth[_0x8412('0x9')](),controller['addImap']);router['post']('/:id/out_servers',auth[_0x8412('0x9')](),controller['addSmtp']);router[_0x8412('0x18')](_0x8412('0x12'),auth['isAuthenticated'](),controller[_0x8412('0x1c')]);router[_0x8412('0x18')](_0x8412('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0x8412('0x18')](_0x8412('0x1d'),auth[_0x8412('0x9')](),controller[_0x8412('0x1e')]);router['post'](_0x8412('0x1f'),auth[_0x8412('0x9')](),controller['addAgents']);router['put'](_0x8412('0xb'),auth[_0x8412('0x9')](),controller['update']);router['delete'](_0x8412('0xc'),auth[_0x8412('0x9')](),controller[_0x8412('0x20')]);router[_0x8412('0x21')](_0x8412('0x1a'),auth[_0x8412('0x9')](),controller[_0x8412('0x22')]);router[_0x8412('0x21')]('/:id/in_servers',auth[_0x8412('0x9')](),controller['removeImap']);router[_0x8412('0x21')](_0x8412('0x10'),auth[_0x8412('0x9')](),controller[_0x8412('0x23')]);router[_0x8412('0x21')](_0x8412('0xb'),auth[_0x8412('0x9')](),controller[_0x8412('0x24')]);router[_0x8412('0x21')](_0x8412('0x1f'),auth[_0x8412('0x9')](),controller[_0x8412('0x25')]);module[_0x8412('0x26')]=router; \ No newline at end of file +var _0x7f86=['../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','update','removeDispositions','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x44f563,_0x353637){var _0x3478fd=function(_0x42144d){while(--_0x42144d){_0x44f563['push'](_0x44f563['shift']());}};_0x3478fd(++_0x353637);}(_0x7f86,0xea));var _0x67f8=function(_0x52f878,_0x3a510f){_0x52f878=_0x52f878-0x0;var _0x675257=_0x7f86[_0x52f878];return _0x675257;};'use strict';var multer=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var path=require(_0x67f8('0x2'));var timeout=require(_0x67f8('0x3'));var express=require(_0x67f8('0x4'));var router=express['Router']();var auth=require(_0x67f8('0x5'));var interaction=require(_0x67f8('0x6'));var config=require(_0x67f8('0x7'));var controller=require(_0x67f8('0x8'));router['get']('/',auth[_0x67f8('0x9')](),controller[_0x67f8('0xa')]);router[_0x67f8('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x67f8('0xc')]);router[_0x67f8('0xb')](_0x67f8('0xd'),auth[_0x67f8('0x9')](),controller['show']);router[_0x67f8('0xb')](_0x67f8('0xe'),auth[_0x67f8('0x9')](),controller[_0x67f8('0xf')]);router[_0x67f8('0xb')](_0x67f8('0x10'),auth['isAuthenticated'](),controller[_0x67f8('0x11')]);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x67f8('0x12')]);router[_0x67f8('0xb')](_0x67f8('0x13'),auth['isAuthenticated'](),controller[_0x67f8('0x14')]);router[_0x67f8('0xb')](_0x67f8('0x15'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x16')]);router[_0x67f8('0xb')](_0x67f8('0x17'),auth['isAuthenticated'](),controller['getApplications']);router[_0x67f8('0xb')](_0x67f8('0x18'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x19')]);router['get'](_0x67f8('0x1a'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x1b')]);router[_0x67f8('0xb')](_0x67f8('0x1c'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x1d')]);router[_0x67f8('0x1e')]('/:id/dispositions',auth[_0x67f8('0x9')](),controller[_0x67f8('0x1f')]);router[_0x67f8('0x1e')](_0x67f8('0x10'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x20')]);router[_0x67f8('0x1e')]('/',auth['isAuthenticated'](),controller[_0x67f8('0x21')]);router[_0x67f8('0x1e')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x67f8('0x22')]);router[_0x67f8('0x1e')](_0x67f8('0x13'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x23')]);router['post'](_0x67f8('0x15'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x24')]);router[_0x67f8('0x1e')](_0x67f8('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x67f8('0x25'),auth['isAuthenticated'](),controller[_0x67f8('0x26')]);router[_0x67f8('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0x67f8('0x27')]);router['put'](_0x67f8('0xd'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x28')]);router['delete'](_0x67f8('0xe'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x29')]);router[_0x67f8('0x2a')](_0x67f8('0x10'),auth[_0x67f8('0x9')](),controller[_0x67f8('0x2b')]);router[_0x67f8('0x2a')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0x67f8('0x9')](),controller[_0x67f8('0x2c')]);router[_0x67f8('0x2a')]('/:id',auth[_0x67f8('0x9')](),controller[_0x67f8('0x2d')]);router['delete'](_0x67f8('0x1c'),auth['isAuthenticated'](),controller[_0x67f8('0x2e')]);module[_0x67f8('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index c93ebbb..fd3d766 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 _0xda27=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x4e896d,_0x377ff7){var _0x42c7b4=function(_0x3ffa41){while(--_0x3ffa41){_0x4e896d['push'](_0x4e896d['shift']());}};_0x42c7b4(++_0x377ff7);}(_0xda27,0x1e8));var _0x7da2=function(_0x1a8414,_0x4f735e){_0x1a8414=_0x1a8414-0x0;var _0x430a62=_0xda27[_0x1a8414];return _0x430a62;};'use strict';var Sequelize=require(_0x7da2('0x0'));module[_0x7da2('0x1')]={'description':{'type':Sequelize[_0x7da2('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7da2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7da2('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7da2('0x4')]},'markAsUnread':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7da2('0x5')},'fontSize':{'type':Sequelize[_0x7da2('0x6')](0x2)[_0x7da2('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7da2('0x4')],'defaultValue':function(){return _0x7da2('0x8');}},'notificationSound':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7da2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7da2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7da2('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![],'comment':_0x7da2('0xa'),'set':function(_0x10fa6d){if(!_0x10fa6d)this['setDataValue'](_0x7da2('0xb'),null);this[_0x7da2('0xc')](_0x7da2('0xd'),_0x10fa6d);}}}; \ No newline at end of file +var _0x68a6=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x51d959,_0x14cdb0){var _0x27c3a0=function(_0x11fc32){while(--_0x11fc32){_0x51d959['push'](_0x51d959['shift']());}};_0x27c3a0(++_0x14cdb0);}(_0x68a6,0x13b));var _0x668a=function(_0x7bb475,_0x58e315){_0x7bb475=_0x7bb475-0x0;var _0x3dbe8c=_0x68a6[_0x7bb475];return _0x3dbe8c;};'use strict';var Sequelize=require(_0x668a('0x0'));module[_0x668a('0x1')]={'description':{'type':Sequelize[_0x668a('0x2')]},'name':{'type':Sequelize[_0x668a('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x668a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x668a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x668a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x668a('0x4')]},'markAsUnread':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x668a('0x2')],'allowNull':![],'defaultValue':_0x668a('0x5')},'fontSize':{'type':Sequelize[_0x668a('0x6')](0x2)[_0x668a('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x668a('0x4')],'defaultValue':function(){return _0x668a('0x8');}},'notificationSound':{'type':Sequelize[_0x668a('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x668a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x668a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x668a('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x668a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x668a('0x3')],'defaultValue':![],'comment':_0x668a('0xa'),'set':function(_0x1b6c8e){if(!_0x1b6c8e)this['setDataValue'](_0x668a('0xb'),null);this[_0x668a('0xc')](_0x668a('0xd'),_0x1b6c8e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index e1a89ec..63fb1e7 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 _0x2204=['CmContact','Contacts','DESC','from','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','attach','out','messageId','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','UserProfileResource','destroy','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','MailAccount','rawAttributes','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','body','describe','addDisposition','MailAccountId','create','findOne','Disposition','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','key','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0x2204,0xe4));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4220('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4220('0x1'));var zipdir=require(_0x4220('0x2'));var jsonpatch=require(_0x4220('0x3'));var rp=require(_0x4220('0x4'));var moment=require('moment');var BPromise=require(_0x4220('0x5'));var Mustache=require(_0x4220('0x6'));var util=require(_0x4220('0x7'));var path=require(_0x4220('0x8'));var sox=require(_0x4220('0x9'));var csv=require('to-csv');var ejs=require(_0x4220('0xa'));var fs=require('fs');var _=require(_0x4220('0xb'));var squel=require('squel');var crypto=require(_0x4220('0xc'));var jsforce=require(_0x4220('0xd'));var deskjs=require(_0x4220('0xe'));var toCsv=require(_0x4220('0xf'));var querystring=require(_0x4220('0x10'));var Papa=require(_0x4220('0x11'));var Redis=require(_0x4220('0x12'));var authService=require(_0x4220('0x13'));var qs=require(_0x4220('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4220('0x15'));var logger=require('../../config/logger')(_0x4220('0x16'));var utils=require(_0x4220('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4220('0x18'));var db=require(_0x4220('0x19'))['db'];config['redis']=_[_0x4220('0x1a')](config[_0x4220('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4220('0x1c'))(new Redis(config[_0x4220('0x1b')]));require(_0x4220('0x1d'))[_0x4220('0x1e')](socket);var jayson=require(_0x4220('0x1f'));var client=jayson[_0x4220('0x20')][_0x4220('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x31a904,_0x49a555,_0x5edd18,_0x337e9d){return new BPromise(function(_0xd8ecbb,_0x44061b){var _0x32f4aa=_0x337e9d||client;return _0x32f4aa[_0x4220('0x22')](_0x31a904,_0x5edd18)[_0x4220('0x23')](function(_0x47dabe){logger['info'](_0x4220('0x24'),_0x49a555,_0x4220('0x25'));logger[_0x4220('0x26')](_0x4220('0x27'),_0x49a555,_0x4220('0x25'),JSON[_0x4220('0x28')](_0x47dabe));if(_0x47dabe[_0x4220('0x29')]){if(_0x47dabe['error'][_0x4220('0x2a')]===0x1f4){logger[_0x4220('0x29')](_0x4220('0x24'),_0x49a555,_0x47dabe[_0x4220('0x29')][_0x4220('0x2b')]);return _0x44061b(_0x47dabe[_0x4220('0x29')]['message']);}logger[_0x4220('0x29')](_0x4220('0x24'),_0x49a555,_0x47dabe[_0x4220('0x29')][_0x4220('0x2b')]);return _0xd8ecbb(_0x47dabe['error'][_0x4220('0x2b')]);}else{logger[_0x4220('0x2c')](_0x4220('0x24'),_0x49a555,_0x4220('0x25'));_0xd8ecbb(_0x47dabe[_0x4220('0x2d')][_0x4220('0x2b')]);}})[_0x4220('0x2e')](function(_0x3729dd){logger[_0x4220('0x29')](_0x4220('0x24'),_0x49a555,_0x3729dd);_0x44061b(_0x3729dd);});});}function respondWithStatusCode(_0x2f024a,_0x1da33c){_0x1da33c=_0x1da33c||0xcc;return function(_0x26f157){if(_0x26f157){return _0x2f024a['sendStatus'](_0x1da33c);}return _0x2f024a[_0x4220('0x2f')](_0x1da33c)[_0x4220('0x30')]();};}function respondWithResult(_0x2f0ea6,_0x5ad493){_0x5ad493=_0x5ad493||0xc8;return function(_0x5e7442){if(_0x5e7442){return _0x2f0ea6[_0x4220('0x2f')](_0x5ad493)[_0x4220('0x31')](_0x5e7442);}};}function respondWithFilteredResult(_0xf0bf94,_0x1d27ba){return function(_0x37ca87){if(_0x37ca87){var _0x242081=_0x37ca87['count'],_0x29c240=_0x1d27ba[_0x4220('0x32')],_0x2f05b8=_0x1d27ba[_0x4220('0x32')]+_0x1d27ba[_0x4220('0x33')],_0x57ccac;if(_0x2f05b8>=_0x242081){_0x2f05b8=_0x242081;_0x57ccac=0xc8;}else{_0x57ccac=0xce;}_0xf0bf94['status'](_0x57ccac);return _0xf0bf94[_0x4220('0x34')](_0x4220('0x35'),_0x29c240+'-'+_0x2f05b8+'/'+_0x242081)[_0x4220('0x31')](_0x37ca87);}return null;};}function patchUpdates(_0x8a8dfc){return function(_0xa7df85){try{jsonpatch[_0x4220('0x36')](_0xa7df85,_0x8a8dfc,!![]);}catch(_0x3669b7){return BPromise[_0x4220('0x37')](_0x3669b7);}return _0xa7df85[_0x4220('0x38')]();};}function saveUpdates(_0x2fc766,_0x250d66){return function(_0x4c72a6){if(_0x4c72a6){return _0x4c72a6[_0x4220('0x39')](_0x2fc766)['then'](function(_0x4bace6){return _0x4bace6;});}return null;};}function removeEntity(_0x300b92,_0xbd6af1){return function(_0x289636){if(_0x289636){return _0x289636['destroy']()[_0x4220('0x23')](function(){var _0x3d0d50=_0x289636['get']({'plain':!![]});var _0x17c369='MailAccounts';return db[_0x4220('0x3a')][_0x4220('0x3b')]({'where':{'type':_0x17c369,'resourceId':_0x3d0d50['id']}})[_0x4220('0x23')](function(){return _0x289636;});})[_0x4220('0x23')](function(){_0x300b92[_0x4220('0x2f')](0xcc)[_0x4220('0x30')]();});}};}function handleEntityNotFound(_0x516586,_0xc8de17){return function(_0x1dff49){if(!_0x1dff49){_0x516586['sendStatus'](0x194);}return _0x1dff49;};}function handleError(_0x470d71,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x584472){logger['error'](_0x584472['stack']);if(_0x584472[_0x4220('0x3c')]){delete _0x584472[_0x4220('0x3c')];}_0x470d71[_0x4220('0x2f')](_0x2b4f46)[_0x4220('0x3d')](_0x584472);};}exports[_0x4220('0x3e')]=function(_0x50434d,_0x2041cc){var _0x3938f5={'include':[{'model':db[_0x4220('0x3f')],'as':_0x4220('0x40')},{'model':db[_0x4220('0x41')],'as':_0x4220('0x42')},{'model':db[_0x4220('0x43')],'as':'mandatoryDispositionPause'}]},_0x5666a5={},_0x3cd2e3={'count':0x0,'rows':[]};var _0x520b28=_['map'](db[_0x4220('0x44')][_0x4220('0x45')],function(_0x92bbd){return{'name':_0x92bbd['fieldName'],'type':_0x92bbd[_0x4220('0x46')]['key']};});_0x5666a5['model']=_['map'](_0x520b28,_0x4220('0x3c'));_0x5666a5['query']=_[_0x4220('0x47')](_0x50434d[_0x4220('0x48')]);_0x5666a5[_0x4220('0x49')]=_[_0x4220('0x4a')](_0x5666a5[_0x4220('0x4b')],_0x5666a5['query']);_0x3938f5['attributes']=_[_0x4220('0x4a')](_0x5666a5[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x50434d[_0x4220('0x48')]['fields']));_0x3938f5['attributes']=_0x3938f5[_0x4220('0x4d')][_0x4220('0x4e')]?_0x3938f5[_0x4220('0x4d')]:_0x5666a5[_0x4220('0x4b')];if(!_0x50434d[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x3938f5[_0x4220('0x33')]=qs[_0x4220('0x33')](_0x50434d['query'][_0x4220('0x33')]);_0x3938f5[_0x4220('0x32')]=qs['offset'](_0x50434d[_0x4220('0x48')]['offset']);}_0x3938f5[_0x4220('0x51')]=qs[_0x4220('0x52')](_0x50434d['query'][_0x4220('0x52')]);_0x3938f5[_0x4220('0x53')]=qs[_0x4220('0x49')](_[_0x4220('0x54')](_0x50434d[_0x4220('0x48')],_0x5666a5[_0x4220('0x49')]),_0x520b28);if(_0x50434d['query'][_0x4220('0x55')]){_0x3938f5[_0x4220('0x53')]=_['merge'](_0x3938f5['where'],{'$or':_[_0x4220('0x56')](_0x520b28,function(_0x571c86){if(_0x571c86['type']!==_0x4220('0x57')){var _0x383d80={};_0x383d80[_0x571c86['name']]={'$like':'%'+_0x50434d[_0x4220('0x48')]['filter']+'%'};return _0x383d80;}})});}_0x3938f5=_[_0x4220('0x58')]({},_0x3938f5,_0x50434d[_0x4220('0x59')]);var _0x43af01={'where':_0x3938f5[_0x4220('0x53')]};return db[_0x4220('0x44')][_0x4220('0x5a')](_0x43af01)[_0x4220('0x23')](function(_0x195916){_0x3cd2e3[_0x4220('0x5a')]=_0x195916;if(_0x50434d['query'][_0x4220('0x5b')]){_0x3938f5[_0x4220('0x5c')]=[{'all':!![]}];}return db[_0x4220('0x44')][_0x4220('0x5d')](_0x3938f5);})['then'](function(_0x54f4df){_0x3cd2e3['rows']=_0x54f4df;return _0x3cd2e3;})[_0x4220('0x23')](respondWithFilteredResult(_0x2041cc,_0x3938f5))[_0x4220('0x2e')](handleError(_0x2041cc,null));};exports[_0x4220('0x5e')]=function(_0x1375f5,_0x47acc5){var _0x4557ba={'raw':![],'where':{'id':_0x1375f5[_0x4220('0x5f')]['id']},'include':[{'model':db[_0x4220('0x3f')],'as':_0x4220('0x40')},{'model':db[_0x4220('0x41')],'as':_0x4220('0x42')},{'model':db['Pause'],'as':_0x4220('0x60')}]},_0xfa10f0={};_0xfa10f0[_0x4220('0x4b')]=_['keys'](db[_0x4220('0x44')][_0x4220('0x45')]);_0xfa10f0[_0x4220('0x48')]=_['keys'](_0x1375f5[_0x4220('0x48')]);_0xfa10f0[_0x4220('0x49')]=_[_0x4220('0x4a')](_0xfa10f0[_0x4220('0x4b')],_0xfa10f0[_0x4220('0x48')]);_0x4557ba['attributes']=_[_0x4220('0x4a')](_0xfa10f0['model'],qs[_0x4220('0x4c')](_0x1375f5[_0x4220('0x48')][_0x4220('0x4c')]));_0x4557ba[_0x4220('0x4d')]=_0x4557ba[_0x4220('0x4d')]['length']?_0x4557ba[_0x4220('0x4d')]:_0xfa10f0[_0x4220('0x4b')];if(_0x1375f5[_0x4220('0x48')][_0x4220('0x5b')]){_0x4557ba[_0x4220('0x5c')]=[{'all':!![]}];}_0x4557ba=_[_0x4220('0x58')]({},_0x4557ba,_0x1375f5[_0x4220('0x59')]);return db[_0x4220('0x44')][_0x4220('0x61')](_0x4557ba)['then'](handleEntityNotFound(_0x47acc5,null))[_0x4220('0x23')](respondWithResult(_0x47acc5,null))[_0x4220('0x2e')](handleError(_0x47acc5,null));};exports[_0x4220('0x39')]=function(_0x298238,_0x284979){if(_0x298238[_0x4220('0x62')]['id']){delete _0x298238['body']['id'];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x298238[_0x4220('0x5f')]['id']},'include':[{'model':db[_0x4220('0x3f')],'as':'Imap'},{'model':db[_0x4220('0x41')],'as':_0x4220('0x42')},{'model':db[_0x4220('0x43')],'as':_0x4220('0x60')}]})['then'](handleEntityNotFound(_0x284979,null))[_0x4220('0x23')](saveUpdates(_0x298238['body'],null))[_0x4220('0x23')](function(_0x402400){if(_0x402400&&_0x298238[_0x4220('0x62')][_0x4220('0x40')]){return db[_0x4220('0x3f')][_0x4220('0x39')](_0x298238[_0x4220('0x62')][_0x4220('0x40')],{'where':{'MailAccountId':_0x402400['id']}})[_0x4220('0x23')](function(){return _0x402400;});}return _0x402400;})[_0x4220('0x23')](function(_0x873db2){if(_0x873db2&&_0x298238[_0x4220('0x62')][_0x4220('0x42')]){return db[_0x4220('0x41')][_0x4220('0x39')](_0x298238[_0x4220('0x62')][_0x4220('0x42')],{'where':{'MailAccountId':_0x873db2['id']}})[_0x4220('0x23')](function(){return _0x873db2;});}return _0x873db2;})[_0x4220('0x23')](respondWithResult(_0x284979,null))[_0x4220('0x2e')](handleError(_0x284979,null));};exports[_0x4220('0x63')]=function(_0x568ad5,_0x34b408){return db['MailAccount'][_0x4220('0x63')]()['then'](respondWithResult(_0x34b408,null))[_0x4220('0x2e')](handleError(_0x34b408,null));};exports[_0x4220('0x64')]=function(_0x10b753,_0x58405c,_0x179a80){if(_0x10b753['body']['id']){delete _0x10b753['body']['id'];}return db['MailAccount'][_0x4220('0x61')]({'where':{'id':_0x10b753[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x58405c,null))[_0x4220('0x23')](function(_0x32ffac){if(_0x32ffac){_0x10b753[_0x4220('0x62')][_0x4220('0x65')]=_0x32ffac['id'];return db['Disposition'][_0x4220('0x66')](_0x10b753['body']);}})['then'](respondWithResult(_0x58405c,null))[_0x4220('0x2e')](handleError(_0x58405c,null));};exports['getDispositions']=function(_0x9ead37,_0x515760,_0x44895d){var _0x1daa99={'raw':![],'where':{}};var _0x213032={};var _0x3fd491={'count':0x0,'rows':[]};return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x9ead37['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x515760,null))[_0x4220('0x23')](function(_0xf41c4d){if(_0xf41c4d){_0x213032[_0x4220('0x4b')]=_[_0x4220('0x47')](db['Disposition'][_0x4220('0x45')]);_0x213032[_0x4220('0x48')]=_['keys'](_0x9ead37[_0x4220('0x48')]);_0x213032[_0x4220('0x49')]=_['intersection'](_0x213032[_0x4220('0x4b')],_0x213032[_0x4220('0x48')]);_0x1daa99[_0x4220('0x4d')]=_['intersection'](_0x213032[_0x4220('0x4b')],qs['fields'](_0x9ead37[_0x4220('0x48')]['fields']));_0x1daa99['attributes']=_0x1daa99[_0x4220('0x4d')][_0x4220('0x4e')]?_0x1daa99['attributes']:_0x213032[_0x4220('0x4b')];if(!_0x9ead37[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x1daa99['limit']=qs[_0x4220('0x33')](_0x9ead37[_0x4220('0x48')]['limit']);_0x1daa99[_0x4220('0x32')]=qs[_0x4220('0x32')](_0x9ead37[_0x4220('0x48')][_0x4220('0x32')]);}_0x1daa99[_0x4220('0x51')]=qs[_0x4220('0x52')](_0x9ead37['query']['sort']);_0x1daa99[_0x4220('0x53')]=qs['filters'](_[_0x4220('0x54')](_0x9ead37[_0x4220('0x48')],_0x213032[_0x4220('0x49')]));_0x1daa99[_0x4220('0x53')][_0x4220('0x65')]=_0xf41c4d['id'];if(_0x9ead37[_0x4220('0x48')][_0x4220('0x55')]){_0x1daa99[_0x4220('0x53')]=_[_0x4220('0x58')](_0x1daa99[_0x4220('0x53')],{'$or':_[_0x4220('0x56')](_0x1daa99[_0x4220('0x4d')],function(_0x2c28f8){var _0x4b1204={};_0x4b1204[_0x2c28f8]={'$like':'%'+_0x9ead37[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x4b1204;})});}_0x1daa99=_[_0x4220('0x58')]({},_0x1daa99,_0x9ead37['options']);return db[_0x4220('0x68')][_0x4220('0x5a')]({'where':_0x1daa99[_0x4220('0x53')]})[_0x4220('0x23')](function(_0x4e5286){_0x3fd491['count']=_0x4e5286;if(_0x9ead37[_0x4220('0x48')][_0x4220('0x5b')]){_0x1daa99['include']=[{'all':!![]}];}return db[_0x4220('0x68')][_0x4220('0x5d')](_0x1daa99);})[_0x4220('0x23')](function(_0x332c18){_0x3fd491[_0x4220('0x69')]=_0x332c18;return _0x3fd491;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x515760,_0x1daa99))[_0x4220('0x2e')](handleError(_0x515760,null));};exports[_0x4220('0x6a')]=function(_0x2cfd00,_0x1ca9f4,_0x4b8846){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x2cfd00['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x1ca9f4,null))[_0x4220('0x23')](function(_0x43e9e8){if(_0x43e9e8){return _0x43e9e8[_0x4220('0x6a')](_0x2cfd00[_0x4220('0x48')]['ids']);}})[_0x4220('0x23')](respondWithStatusCode(_0x1ca9f4,null))[_0x4220('0x2e')](handleError(_0x1ca9f4,null));};exports[_0x4220('0x6b')]=function(_0x48b088,_0x2dbd51,_0x216724){if(_0x48b088['body']['id']){delete _0x48b088[_0x4220('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x48b088['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x2dbd51,null))[_0x4220('0x23')](function(_0x54ebe5){if(_0x54ebe5){_0x48b088[_0x4220('0x62')][_0x4220('0x65')]=_0x54ebe5['id'];return db[_0x4220('0x6c')][_0x4220('0x66')](_0x48b088['body']);}})[_0x4220('0x23')](respondWithResult(_0x2dbd51,null))[_0x4220('0x2e')](handleError(_0x2dbd51,null));};exports['getAnswers']=function(_0x2731a2,_0x570f2c,_0x4f48b6){var _0x479e71={'raw':![],'where':{}};var _0x5840e9={};var _0x351740={'count':0x0,'rows':[]};return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x2731a2['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x570f2c,null))[_0x4220('0x23')](function(_0x2d1ef9){if(_0x2d1ef9){_0x5840e9[_0x4220('0x4b')]=_[_0x4220('0x47')](db['CannedAnswer']['rawAttributes']);_0x5840e9[_0x4220('0x48')]=_[_0x4220('0x47')](_0x2731a2[_0x4220('0x48')]);_0x5840e9['filters']=_[_0x4220('0x4a')](_0x5840e9[_0x4220('0x4b')],_0x5840e9[_0x4220('0x48')]);_0x479e71['attributes']=_[_0x4220('0x4a')](_0x5840e9[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x2731a2[_0x4220('0x48')][_0x4220('0x4c')]));_0x479e71[_0x4220('0x4d')]=_0x479e71[_0x4220('0x4d')][_0x4220('0x4e')]?_0x479e71['attributes']:_0x5840e9[_0x4220('0x4b')];if(!_0x2731a2[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x479e71[_0x4220('0x33')]=qs['limit'](_0x2731a2[_0x4220('0x48')][_0x4220('0x33')]);_0x479e71[_0x4220('0x32')]=qs[_0x4220('0x32')](_0x2731a2['query'][_0x4220('0x32')]);}_0x479e71['order']=qs['sort'](_0x2731a2['query'][_0x4220('0x52')]);_0x479e71[_0x4220('0x53')]=qs[_0x4220('0x49')](_[_0x4220('0x54')](_0x2731a2['query'],_0x5840e9[_0x4220('0x49')]));_0x479e71[_0x4220('0x53')][_0x4220('0x65')]=_0x2d1ef9['id'];if(_0x2731a2[_0x4220('0x48')]['filter']){_0x479e71['where']=_[_0x4220('0x58')](_0x479e71['where'],{'$or':_[_0x4220('0x56')](_0x479e71[_0x4220('0x4d')],function(_0x3adae6){var _0x1d4aeb={};_0x1d4aeb[_0x3adae6]={'$like':'%'+_0x2731a2[_0x4220('0x48')]['filter']+'%'};return _0x1d4aeb;})});}_0x479e71=_[_0x4220('0x58')]({},_0x479e71,_0x2731a2[_0x4220('0x59')]);return db[_0x4220('0x6c')][_0x4220('0x5a')]({'where':_0x479e71[_0x4220('0x53')]})[_0x4220('0x23')](function(_0x4e29d0){_0x351740[_0x4220('0x5a')]=_0x4e29d0;if(_0x2731a2[_0x4220('0x48')][_0x4220('0x5b')]){_0x479e71[_0x4220('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4220('0x5d')](_0x479e71);})[_0x4220('0x23')](function(_0x3d62c7){_0x351740[_0x4220('0x69')]=_0x3d62c7;return _0x351740;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x570f2c,_0x479e71))[_0x4220('0x2e')](handleError(_0x570f2c,null));};exports[_0x4220('0x6d')]=function(_0x5e1d2d,_0x40ce21,_0x206e20){return db['MailAccount'][_0x4220('0x61')]({'where':{'id':_0x5e1d2d[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x40ce21,null))[_0x4220('0x23')](function(_0x297929){if(_0x297929){return _0x297929[_0x4220('0x6d')](_0x5e1d2d['query'][_0x4220('0x6e')]);}})[_0x4220('0x23')](respondWithStatusCode(_0x40ce21,null))['catch'](handleError(_0x40ce21,null));};exports[_0x4220('0x66')]=function(_0x141621,_0x4d73e1){var _0x11ffc6={'name':_0x141621[_0x4220('0x62')][_0x4220('0x3c')],'key':_0x141621['body'][_0x4220('0x6f')],'email':_0x141621[_0x4220('0x62')]['email'],'ListId':_0x141621[_0x4220('0x62')][_0x4220('0x70')],'active':!_[_0x4220('0x71')](_0x141621[_0x4220('0x62')][_0x4220('0x72')])?_0x141621[_0x4220('0x62')]['active']:!![],'description':_0x141621[_0x4220('0x62')][_0x4220('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x4220('0x71')](_0x141621[_0x4220('0x62')]['cservice'])){if(_0x141621[_0x4220('0x62')][_0x4220('0x74')]){_0x11ffc6[_0x4220('0x40')]['user']=_0x11ffc6['Smtp'][_0x4220('0x75')]=_0x141621[_0x4220('0x62')][_0x4220('0x76')];_0x11ffc6[_0x4220('0x40')][_0x4220('0x77')]=_0x11ffc6[_0x4220('0x42')][_0x4220('0x78')]=_0x141621[_0x4220('0x62')][_0x4220('0x79')];}else{_0x11ffc6['Imap'][_0x4220('0x7a')]=_0x11ffc6[_0x4220('0x42')][_0x4220('0x7a')]=![];}_0x11ffc6[_0x4220('0x40')]['host']=_0x141621[_0x4220('0x62')][_0x4220('0x40')][_0x4220('0x7b')];_0x11ffc6[_0x4220('0x40')][_0x4220('0x7c')]=_0x141621[_0x4220('0x62')][_0x4220('0x40')][_0x4220('0x7c')];_0x11ffc6[_0x4220('0x42')]['host']=_0x141621['body'][_0x4220('0x42')]['host'];_0x11ffc6[_0x4220('0x42')][_0x4220('0x7c')]=_0x141621['body']['Smtp'][_0x4220('0x7c')];}else{_0x11ffc6[_0x4220('0x40')][_0x4220('0x7d')]=_0x11ffc6['Smtp'][_0x4220('0x7d')]=_0x141621[_0x4220('0x62')][_0x4220('0x7e')];_0x11ffc6['Imap']['user']=_0x11ffc6[_0x4220('0x42')][_0x4220('0x75')]=_0x141621['body'][_0x4220('0x76')];_0x11ffc6['Imap'][_0x4220('0x77')]=_0x11ffc6['Smtp'][_0x4220('0x78')]=_0x141621[_0x4220('0x62')][_0x4220('0x79')];}return db['MailAccount']['create'](_0x11ffc6,{'include':[{'model':db[_0x4220('0x41')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x4220('0x40')}]})[_0x4220('0x23')](function(_0x32af06){var _0x1bdc89=_0x141621['user'][_0x4220('0x7f')]({'plain':!![]});if(!_0x1bdc89)throw new Error(_0x4220('0x80'));if(_0x1bdc89[_0x4220('0x81')]===_0x4220('0x75')){var _0x2dfcd8=_0x32af06[_0x4220('0x7f')]({'plain':!![]});return db[_0x4220('0x82')][_0x4220('0x61')]({'where':{'name':_0x4220('0x83'),'userProfileId':_0x1bdc89[_0x4220('0x84')]},'raw':!![]})[_0x4220('0x23')](function(_0x2e7210){if(_0x2e7210&&_0x2e7210['autoAssociation']===0x0){return db['UserProfileResource'][_0x4220('0x66')]({'name':_0x2dfcd8['name'],'resourceId':_0x2dfcd8['id'],'type':_0x2e7210[_0x4220('0x3c')],'sectionId':_0x2e7210['id']},{})['then'](function(){return _0x32af06;});}else{return _0x32af06;}})[_0x4220('0x2e')](function(_0xb46fd7){logger[_0x4220('0x29')](_0x4220('0x85'),_0xb46fd7);throw _0xb46fd7;});}return _0x32af06;})[_0x4220('0x23')](respondWithResult(_0x4d73e1,0xc9))[_0x4220('0x2e')](handleError(_0x4d73e1,null));};exports['getImap']=function(_0x3857fe,_0x509566,_0x197480){return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x3857fe[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x509566,null))[_0x4220('0x23')](function(_0x466712){if(_0x466712){return _0x466712[_0x4220('0x86')]();}return null;})[_0x4220('0x23')](respondWithResult(_0x509566,null))[_0x4220('0x2e')](handleError(_0x509566,null));};exports[_0x4220('0x87')]=function(_0x57076c,_0x1945d8,_0x4e46a2){if(_0x57076c[_0x4220('0x62')]['id']){delete _0x57076c[_0x4220('0x62')]['id'];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x57076c['params']['id']}})['then'](handleEntityNotFound(_0x1945d8,null))[_0x4220('0x23')](function(_0x5dc933){if(_0x5dc933){_0x57076c[_0x4220('0x62')][_0x4220('0x65')]=_0x5dc933['id'];return db[_0x4220('0x3f')][_0x4220('0x66')](_0x57076c[_0x4220('0x62')]);}})['then'](respondWithResult(_0x1945d8,null))['catch'](handleError(_0x1945d8,null));};exports['removeImap']=function(_0x5997df,_0xa9906c,_0x8740d){return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x5997df[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0xa9906c,null))[_0x4220('0x23')](function(_0x56a0bc){if(_0x56a0bc){return _0x56a0bc[_0x4220('0x88')](null);}return null;})[_0x4220('0x23')](respondWithStatusCode(_0xa9906c,null))['catch'](handleError(_0xa9906c,null));};exports[_0x4220('0x89')]=function(_0x508006,_0x4c28e6,_0x4e2bfb){return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x508006[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4c28e6,null))[_0x4220('0x23')](function(_0x932f37){if(_0x932f37){return _0x932f37[_0x4220('0x89')]();}return null;})['then'](respondWithResult(_0x4c28e6,null))[_0x4220('0x2e')](handleError(_0x4c28e6,null));};exports['addSmtp']=function(_0x4a0602,_0x50c0fa,_0x11f9f7){if(_0x4a0602[_0x4220('0x62')]['id']){delete _0x4a0602['body']['id'];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x4a0602[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x50c0fa,null))[_0x4220('0x23')](function(_0x42c9ae){if(_0x42c9ae){_0x4a0602['body'][_0x4220('0x65')]=_0x42c9ae['id'];return db['MailServerOut'][_0x4220('0x66')](_0x4a0602[_0x4220('0x62')]);}})[_0x4220('0x23')](respondWithResult(_0x50c0fa,null))[_0x4220('0x2e')](handleError(_0x50c0fa,null));};exports[_0x4220('0x8a')]=function(_0x5395e7,_0x4119b4,_0x352785){return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x5395e7[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x4119b4,null))[_0x4220('0x23')](function(_0x1af790){if(_0x1af790){return _0x1af790[_0x4220('0x8b')](null);}return null;})[_0x4220('0x23')](respondWithStatusCode(_0x4119b4,null))[_0x4220('0x2e')](handleError(_0x4119b4,null));};exports[_0x4220('0x8c')]=function(_0x1ab37e,_0x174616,_0x468f2c){return db[_0x4220('0x8d')][_0x4220('0x61')]({'where':{'id':_0x1ab37e[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x174616,null))[_0x4220('0x23')](function(_0x21c85e){if(_0x21c85e){return _0x21c85e[_0x4220('0x8c')](_0x1ab37e[_0x4220('0x62')]['ids'],_[_0x4220('0x8e')](_0x1ab37e[_0x4220('0x62')],[_0x4220('0x6e'),'id'])||{});}})[_0x4220('0x23')](respondWithResult(_0x174616,null))['catch'](handleError(_0x174616,null));};exports[_0x4220('0x8f')]=function(_0x2547d7,_0x4487f6,_0x394b8c){var _0x1bdade={'raw':![],'where':{}};var _0x4f1c08={};var _0x3e2252={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2547d7['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x4487f6,null))['then'](function(_0x4109b0){if(_0x4109b0){_0x4f1c08[_0x4220('0x4b')]=_['keys'](db['MailInteraction'][_0x4220('0x45')]);_0x4f1c08[_0x4220('0x48')]=_[_0x4220('0x47')](_0x2547d7['query']);_0x4f1c08[_0x4220('0x49')]=_[_0x4220('0x4a')](_0x4f1c08[_0x4220('0x4b')],_0x4f1c08[_0x4220('0x48')]);_0x1bdade['attributes']=_['intersection'](_0x4f1c08[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x2547d7[_0x4220('0x48')][_0x4220('0x4c')]));_0x1bdade[_0x4220('0x4d')]=_0x1bdade[_0x4220('0x4d')][_0x4220('0x4e')]?_0x1bdade[_0x4220('0x4d')]:_0x4f1c08['model'];if(!_0x2547d7[_0x4220('0x48')]['hasOwnProperty']('nolimit')){_0x1bdade[_0x4220('0x33')]=qs[_0x4220('0x33')](_0x2547d7['query'][_0x4220('0x33')]);_0x1bdade['offset']=qs[_0x4220('0x32')](_0x2547d7[_0x4220('0x48')][_0x4220('0x32')]);}_0x1bdade[_0x4220('0x51')]=qs[_0x4220('0x52')](_0x2547d7[_0x4220('0x48')][_0x4220('0x52')]);_0x1bdade[_0x4220('0x53')]=qs[_0x4220('0x49')](_[_0x4220('0x54')](_0x2547d7['query'],_0x4f1c08[_0x4220('0x49')]));_0x1bdade[_0x4220('0x53')][_0x4220('0x65')]=_0x4109b0['id'];if(_0x2547d7[_0x4220('0x48')][_0x4220('0x55')]){_0x1bdade[_0x4220('0x53')]=_[_0x4220('0x58')](_0x1bdade[_0x4220('0x53')],{'$or':_['map'](_0x1bdade[_0x4220('0x4d')],function(_0x37a5c3){var _0x3617ad={};_0x3617ad[_0x37a5c3]={'$like':'%'+_0x2547d7[_0x4220('0x48')]['filter']+'%'};return _0x3617ad;})});}_0x1bdade=_[_0x4220('0x58')]({},_0x1bdade,_0x2547d7[_0x4220('0x59')]);return db[_0x4220('0x8d')]['count']({'where':_0x1bdade['where']})['then'](function(_0x343fb5){_0x3e2252['count']=_0x343fb5;if(_0x2547d7[_0x4220('0x48')][_0x4220('0x5b')]){_0x1bdade[_0x4220('0x5c')]=[{'model':db['CmContact'],'as':_0x4220('0x90'),'required':![]},{'model':db[_0x4220('0x91')],'as':_0x4220('0x92'),'attributes':[_0x4220('0x3c'),_0x4220('0x93'),'internal'],'required':![]},{'model':db[_0x4220('0x94')],'as':_0x4220('0x95'),'attributes':['id','name',_0x4220('0x96')],'where':_0x2547d7['query'][_0x4220('0x97')]?{'id':_0x2547d7[_0x4220('0x48')][_0x4220('0x97')]}:undefined,'required':_0x2547d7[_0x4220('0x48')][_0x4220('0x97')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x1bdade);})[_0x4220('0x23')](function(_0x31eedc){_0x3e2252[_0x4220('0x69')]=_0x31eedc;return _0x3e2252;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x4487f6,_0x1bdade))[_0x4220('0x2e')](handleError(_0x4487f6,null));};exports[_0x4220('0x98')]=function(_0x58fe1e,_0x50130b,_0x5cbf90){return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x58fe1e[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x50130b,null))[_0x4220('0x23')](function(_0x43b8f7){if(_0x43b8f7){return db['sequelize'][_0x4220('0x99')](function(_0x5147f6){return db[_0x4220('0x9a')][_0x4220('0x3b')]({'where':{'MailAccountId':_0x58fe1e['params']['id']},'transaction':_0x5147f6})[_0x4220('0x23')](function(_0x20ddfa){var _0x116709=_['map'](_0x58fe1e[_0x4220('0x62')],function(_0x24d612){_0x24d612[_0x4220('0x65')]=_0x58fe1e['params']['id'];return _0x24d612;});return db[_0x4220('0x9a')][_0x4220('0x9b')](_0x116709,{'transaction':_0x5147f6});});})[_0x4220('0x23')](function(){return db[_0x4220('0x9a')][_0x4220('0x9c')]({'where':{'MailAccountId':_0x58fe1e[_0x4220('0x5f')]['id']},'order':_0x4220('0x9d')});});}})[_0x4220('0x23')](respondWithResult(_0x50130b,null))['catch'](handleError(_0x50130b,null));};exports[_0x4220('0x9e')]=function(_0x19395b,_0x5b1280,_0x41d563){var _0x1fcbb8={};var _0x37f36e={};var _0x509c26;var _0x206393;return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x19395b[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x5b1280,null))[_0x4220('0x23')](function(_0x319097){if(_0x319097){_0x509c26=_0x319097;_0x37f36e[_0x4220('0x4b')]=_[_0x4220('0x47')](db[_0x4220('0x9a')]['rawAttributes']);_0x37f36e[_0x4220('0x48')]=_[_0x4220('0x47')](_0x19395b['query']);_0x37f36e[_0x4220('0x49')]=_[_0x4220('0x4a')](_0x37f36e['model'],_0x37f36e['query']);_0x1fcbb8['attributes']=_['intersection'](_0x37f36e[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x19395b[_0x4220('0x48')][_0x4220('0x4c')]));_0x1fcbb8[_0x4220('0x4d')]=_0x1fcbb8[_0x4220('0x4d')][_0x4220('0x4e')]?_0x1fcbb8[_0x4220('0x4d')]:_0x37f36e[_0x4220('0x4b')];_0x1fcbb8['order']=qs['sort'](_0x19395b[_0x4220('0x48')][_0x4220('0x52')]);_0x1fcbb8['where']=qs['filters'](_[_0x4220('0x54')](_0x19395b[_0x4220('0x48')],_0x37f36e[_0x4220('0x49')]));if(_0x19395b[_0x4220('0x48')][_0x4220('0x55')]){_0x1fcbb8[_0x4220('0x53')]=_['merge'](_0x1fcbb8[_0x4220('0x53')],{'$or':_[_0x4220('0x56')](_0x1fcbb8[_0x4220('0x4d')],function(_0x354b46){var _0x54ba13={};_0x54ba13[_0x354b46]={'$like':'%'+_0x19395b[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x54ba13;})});}_0x1fcbb8=_[_0x4220('0x58')]({},_0x1fcbb8,_0x19395b[_0x4220('0x59')]);return _0x509c26[_0x4220('0x9e')](_0x1fcbb8);}})[_0x4220('0x23')](function(_0x2dccfb){if(_0x2dccfb){_0x206393=_0x2dccfb[_0x4220('0x4e')];if(!_0x19395b[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x1fcbb8[_0x4220('0x33')]=qs['limit'](_0x19395b[_0x4220('0x48')]['limit']);_0x1fcbb8[_0x4220('0x32')]=qs['offset'](_0x19395b[_0x4220('0x48')][_0x4220('0x32')]);}return _0x509c26[_0x4220('0x9e')](_0x1fcbb8);}})[_0x4220('0x23')](function(_0x4eeb95){if(_0x4eeb95){return _0x4eeb95?{'count':_0x206393,'rows':_0x4eeb95}:null;}})[_0x4220('0x23')](respondWithResult(_0x5b1280,null))[_0x4220('0x2e')](handleError(_0x5b1280,null));};exports[_0x4220('0x9f')]=function(_0x4b5434,_0x6cf9e3,_0x45e53c){var _0x2feae3={'raw':!![],'where':{}};var _0x4fd62c={};var _0x1b215f={'count':0x0,'rows':[]};return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x4b5434[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x6cf9e3,null))[_0x4220('0x23')](function(_0x963c9){if(_0x963c9){_0x4fd62c[_0x4220('0x4b')]=_[_0x4220('0x47')](db[_0x4220('0xa0')][_0x4220('0x45')]);_0x4fd62c[_0x4220('0x48')]=_['keys'](_0x4b5434[_0x4220('0x48')]);_0x4fd62c['filters']=_[_0x4220('0x4a')](_0x4fd62c['model'],_0x4fd62c[_0x4220('0x48')]);_0x2feae3[_0x4220('0x4d')]=_['intersection'](_0x4fd62c[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x4b5434['query'][_0x4220('0x4c')]));_0x2feae3[_0x4220('0x4d')]=_0x2feae3[_0x4220('0x4d')][_0x4220('0x4e')]?_0x2feae3[_0x4220('0x4d')]:_0x4fd62c[_0x4220('0x4b')];if(!_0x4b5434[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x2feae3[_0x4220('0x33')]=qs['limit'](_0x4b5434['query'][_0x4220('0x33')]);_0x2feae3['offset']=qs[_0x4220('0x32')](_0x4b5434[_0x4220('0x48')]['offset']);}_0x2feae3['order']=qs[_0x4220('0x52')](_0x4b5434[_0x4220('0x48')][_0x4220('0x52')]);_0x2feae3['where']=qs['filters'](_[_0x4220('0x54')](_0x4b5434[_0x4220('0x48')],_0x4fd62c[_0x4220('0x49')]));_0x2feae3[_0x4220('0x53')]['MailAccountId']=_0x963c9['id'];if(_0x4b5434[_0x4220('0x48')][_0x4220('0x55')]){_0x2feae3[_0x4220('0x53')]=_[_0x4220('0x58')](_0x2feae3[_0x4220('0x53')],{'$or':_[_0x4220('0x56')](_0x2feae3[_0x4220('0x4d')],function(_0x3d3e5c){var _0x20dd26={};_0x20dd26[_0x3d3e5c]={'$like':'%'+_0x4b5434[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x20dd26;})});}if(_0x4b5434[_0x4220('0x48')][_0x4220('0xa1')]){var _0x5a2038=_0x4b5434[_0x4220('0x48')][_0x4220('0xa1')][_0x4220('0xa2')](',');var _0x4c0c6b={};_0x4c0c6b[_0x5a2038[0x0]]={'$gte':moment(_0x5a2038[0x1])[_0x4220('0xa3')](_0x4220('0xa4'))};_0x2feae3[_0x4220('0x53')]=_[_0x4220('0x58')](_0x2feae3[_0x4220('0x53')],_0x4c0c6b);}_0x2feae3=_['merge']({},_0x2feae3,_0x4b5434[_0x4220('0x59')]);return db['MailMessage']['count']({'where':_0x2feae3[_0x4220('0x53')]})['then'](function(_0x2bc3cd){_0x1b215f[_0x4220('0x5a')]=_0x2bc3cd;if(_0x4b5434['query']['includeAll']){_0x2feae3['include']=[{'all':!![]}];}return db['MailMessage'][_0x4220('0x5d')](_0x2feae3);})[_0x4220('0x23')](function(_0x349ad8){_0x1b215f[_0x4220('0x69')]=_0x349ad8;return _0x1b215f;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x6cf9e3,_0x2feae3))[_0x4220('0x2e')](handleError(_0x6cf9e3,null));};exports['send']=function(_0x55e950,_0x2f30c1,_0x23b229){var _0x14dea6,_0x3d9da6={},_0x185536;if(_0x55e950[_0x4220('0x62')]['to']){_0x185536=_0x55e950[_0x4220('0x62')]['to'][_0x4220('0xa2')](',')[0x0];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x55e950[_0x4220('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x4220('0xa5'),'include':[{'model':db[_0x4220('0xa6')],'as':_0x4220('0xa7'),'where':{'email':_0x185536},'limit':0x1,'order':[['updatedAt',_0x4220('0xa8')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x4220('0x23')](handleEntityNotFound(_0x2f30c1,null))[_0x4220('0x23')](function(_0x55b17c){if(_0x55b17c){_0x14dea6=_0x55b17c;if(_0x55b17c[_0x4220('0x42')]){if(_['isNil'](_0x55e950[_0x4220('0x62')][_0x4220('0xa9')])){_0x55e950[_0x4220('0x62')]['from']=util[_0x4220('0xa3')]('%s\x20<%s>',_0x55b17c[_0x4220('0x3c')],_0x55b17c[_0x4220('0xaa')]||_0x55b17c['Smtp'][_0x4220('0x75')]);}if(_0x55e950[_0x4220('0x62')][_0x4220('0xab')]&&_0x55e950[_0x4220('0x62')][_0x4220('0xab')]['length']){for(var _0x2772bb=0x0;_0x2772bb<_0x55e950[_0x4220('0x62')][_0x4220('0xab')][_0x4220('0x4e')];_0x2772bb+=0x1){_0x55e950['body'][_0x4220('0xab')][_0x2772bb]={'filename':_0x55e950[_0x4220('0x62')][_0x4220('0xab')][_0x2772bb][_0x4220('0x3c')],'path':path[_0x4220('0xac')](config[_0x4220('0xad')],_0x4220('0xae'),_0x55e950[_0x4220('0x62')]['attachments'][_0x2772bb][_0x4220('0xaf')])};}}var _0x4abc79={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x55b17c['Smtp'][_0x4220('0x7d')])){if(_0x55b17c[_0x4220('0x42')][_0x4220('0x7a')]){_0x4abc79[_0x4220('0xb0')]={'user':_0x55b17c['Smtp'][_0x4220('0x75')],'pass':_0x55b17c['Smtp'][_0x4220('0x78')]};}_0x4abc79[_0x4220('0x7b')]=_0x55b17c['Smtp'][_0x4220('0x7b')];_0x4abc79[_0x4220('0x7c')]=_0x55b17c[_0x4220('0x42')][_0x4220('0x7c')];_0x4abc79[_0x4220('0xb1')]=_0x55b17c[_0x4220('0x42')]['secure'];}else{_0x4abc79['service']=_0x55b17c[_0x4220('0x42')][_0x4220('0x7d')];_0x4abc79[_0x4220('0xb0')]={'user':_0x55b17c[_0x4220('0x42')][_0x4220('0x75')],'pass':_0x55b17c['Smtp'][_0x4220('0x78')]};}return respondWithRpcPromise(_0x4220('0xb2'),_0x4220('0xb3'),{'account':_0x4abc79,'message':_0x55e950['body']});}else{throw new Error(_0x4220('0xb4'));}}})[_0x4220('0x23')](function(_0x2f99ab){if(_0x2f99ab){_0x3d9da6=_0x2f99ab;if(_0x14dea6[_0x4220('0xa5')]){if(_0x14dea6[_0x4220('0xa5')][_0x4220('0xa7')][_0x4220('0x4e')]){return _0x14dea6[_0x4220('0xa5')][_0x4220('0xa7')][0x0];}else{return db['CmContact']['create'](_[_0x4220('0x1a')](_0x55e950[_0x4220('0x62')],{'firstName':_0x55e950['body']['to'],'email':_0x55e950[_0x4220('0x62')]['to'],'phone':_0x55e950[_0x4220('0x62')]['to'],'ListId':_0x14dea6[_0x4220('0x70')]}));}}else{throw new Error(_0x4220('0xb4'));}}})['then'](function(_0x471d1c){if(_0x471d1c){var _0x1514a5={'UserId':_0x55e950['user']['id'],'ContactId':_0x471d1c['id'],'MailAccountId':_0x14dea6['id'],'inReplyTo':_0x3d9da6['messageId'],'to':_0x55e950[_0x4220('0x62')]['from'],'cc':_0x55e950[_0x4220('0x62')]['cc'],'subject':_0x55e950[_0x4220('0x62')]['subject'],'attach':_0x55e950[_0x4220('0x62')][_0x4220('0xb5')],'firstMsgDirection':_0x4220('0xb6'),'lastMsgAt':moment()[_0x4220('0xa3')](_0x4220('0xa4')),'lastMsgDirection':'out','lastMsgBody':_0x55e950['body']['body'],'Messages':[_[_0x4220('0x58')](_0x55e950[_0x4220('0x62')],{'messageId':_0x3d9da6[_0x4220('0xb7')],'sentAt':moment()[_0x4220('0xa3')](_0x4220('0xa4')),'read':!![],'MailAccountId':_0x14dea6['id'],'UserId':_0x55e950[_0x4220('0x75')]['id'],'ContactId':_0x471d1c['id']})]};if(_0x55e950['body'][_0x4220('0xb8')]){_0x1514a5=_[_0x4220('0x58')](_0x1514a5,_0x55e950[_0x4220('0x62')][_0x4220('0xb8')]);}return db[_0x4220('0x8d')][_0x4220('0x66')](_0x1514a5,{'include':[{'model':db[_0x4220('0xa0')],'as':_0x4220('0xb9')}]});}})['then'](respondWithResult(_0x2f30c1,null))['catch'](handleError(_0x2f30c1,null));};exports[_0x4220('0xba')]=function(_0x4ef999,_0x297357,_0xadc3a1){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x4ef999[_0x4220('0x5f')]['id']},'include':[{'model':db[_0x4220('0x41')],'as':_0x4220('0x42'),'raw':!![]}]})[_0x4220('0x23')](handleEntityNotFound(_0x297357,null))['then'](function(_0x3da429){if(_0x3da429&&_0x3da429[_0x4220('0x42')]){var _0x214f3a={'id':_0x3da429['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3da429[_0x4220('0x42')]['service']){_0x214f3a['service']=_0x3da429['Smtp'][_0x4220('0x7d')];}else{_0x214f3a['host']=_0x3da429['Smtp']['host'];_0x214f3a[_0x4220('0x7c')]=_0x3da429[_0x4220('0x42')][_0x4220('0x7c')];_0x214f3a[_0x4220('0xb1')]=_0x3da429[_0x4220('0x42')][_0x4220('0xb1')];}if(_0x3da429[_0x4220('0x42')][_0x4220('0x7a')]){_0x214f3a[_0x4220('0xb0')]={'user':_0x3da429[_0x4220('0x42')][_0x4220('0x75')],'pass':_0x3da429[_0x4220('0x42')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x4220('0xba'),{'account':_0x214f3a});}})[_0x4220('0x23')](respondWithResult(_0x297357,null))[_0x4220('0x2e')](handleError(_0x297357,null));};exports['destroy']=function(_0x153fac,_0x2b6b51){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x153fac['params']['id']}})['then'](handleEntityNotFound(_0x2b6b51,null))[_0x4220('0x23')](function(_0x596ca2){if(_0x596ca2&&_0x596ca2['service']){throw new db[(_0x4220('0xbb'))]['ValidationError'](_0x4220('0xbc'));}return _0x596ca2;})[_0x4220('0x23')](removeEntity(_0x2b6b51,null))[_0x4220('0x2e')](handleError(_0x2b6b51,null));};exports[_0x4220('0xbd')]=function(_0x58a0f9,_0x2c6ab2,_0x26f482){return db[_0x4220('0x44')]['find']({'where':{'id':_0x58a0f9['params']['id']}})['then'](handleEntityNotFound(_0x2c6ab2,null))[_0x4220('0x23')](function(_0x17f64b){if(_0x17f64b){return _0x17f64b[_0x4220('0xbd')](_0x58a0f9['body'][_0x4220('0x6e')],_[_0x4220('0x8e')](_0x58a0f9[_0x4220('0x62')],['ids','id'])||{})[_0x4220('0xbe')](function(_0x14507e){for(var _0x4b995c=0x0;_0x4b995c<_0x58a0f9[_0x4220('0x62')][_0x4220('0x6e')][_0x4220('0x4e')];_0x4b995c+=0x1){socket[_0x4220('0xbf')](_0x4220('0xc0'),{'UserId':_0x58a0f9[_0x4220('0x62')][_0x4220('0x6e')][_0x4b995c],'MailAccountId':_0x58a0f9[_0x4220('0x5f')]['id']});}return _0x14507e;});}})[_0x4220('0x23')](respondWithResult(_0x2c6ab2,null))[_0x4220('0x2e')](handleError(_0x2c6ab2,null));};exports[_0x4220('0xc1')]=function(_0x593a36,_0x530e16,_0x38a095){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x593a36[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x530e16,null))['then'](function(_0x21bef7){if(_0x21bef7){return _0x21bef7[_0x4220('0xc1')](_0x593a36[_0x4220('0x48')][_0x4220('0x6e')])[_0x4220('0x23')](function(){if(_[_0x4220('0xc2')](_0x593a36[_0x4220('0x48')][_0x4220('0x6e')])){for(var _0x1363cb=0x0;_0x1363cb<_0x593a36[_0x4220('0x48')][_0x4220('0x6e')][_0x4220('0x4e')];_0x1363cb+=0x1){socket[_0x4220('0xbf')](_0x4220('0xc3'),{'UserId':Number(_0x593a36[_0x4220('0x48')][_0x4220('0x6e')][_0x1363cb]),'MailAccountId':Number(_0x593a36[_0x4220('0x5f')]['id'])});}}else{socket[_0x4220('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x593a36['query'][_0x4220('0x6e')]),'MailAccountId':Number(_0x593a36[_0x4220('0x5f')]['id'])});}});}})[_0x4220('0x23')](respondWithStatusCode(_0x530e16,null))[_0x4220('0x2e')](handleError(_0x530e16,null));};exports[_0x4220('0xc4')]=function(_0x6280b2,_0x4d989a,_0x4b551b){var _0x3a0af4={};var _0x56c21f={};var _0x32f484;var _0x739833;return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x6280b2['params']['id']}})['then'](handleEntityNotFound(_0x4d989a,null))[_0x4220('0x23')](function(_0x5218eb){if(_0x5218eb){_0x32f484=_0x5218eb;_0x56c21f[_0x4220('0x4b')]=_[_0x4220('0x47')](db['User'][_0x4220('0x45')]);_0x56c21f[_0x4220('0x48')]=_[_0x4220('0x47')](_0x6280b2['query']);_0x56c21f['filters']=_[_0x4220('0x4a')](_0x56c21f[_0x4220('0x4b')],_0x56c21f[_0x4220('0x48')]);_0x3a0af4[_0x4220('0x4d')]=_[_0x4220('0x4a')](_0x56c21f['model'],qs['fields'](_0x6280b2[_0x4220('0x48')]['fields']));_0x3a0af4[_0x4220('0x4d')]=_0x3a0af4[_0x4220('0x4d')]['length']?_0x3a0af4[_0x4220('0x4d')]:_0x56c21f[_0x4220('0x4b')];_0x3a0af4['order']=qs[_0x4220('0x52')](_0x6280b2[_0x4220('0x48')][_0x4220('0x52')]);_0x3a0af4[_0x4220('0x53')]=qs[_0x4220('0x49')](_['pick'](_0x6280b2[_0x4220('0x48')],_0x56c21f[_0x4220('0x49')]));if(_0x6280b2['query']['filter']){_0x3a0af4[_0x4220('0x53')]=_[_0x4220('0x58')](_0x3a0af4['where'],{'$or':_[_0x4220('0x56')](_0x3a0af4[_0x4220('0x4d')],function(_0x240fd1){var _0x2bdfa5={};_0x2bdfa5[_0x240fd1]={'$like':'%'+_0x6280b2[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x2bdfa5;})});}_0x3a0af4=_[_0x4220('0x58')]({},_0x3a0af4,_0x6280b2[_0x4220('0x59')]);return _0x32f484['getAgents'](_0x3a0af4);}})[_0x4220('0x23')](function(_0x5242e5){if(_0x5242e5){_0x739833=_0x5242e5['length'];if(!_0x6280b2['query'][_0x4220('0x4f')]('nolimit')){_0x3a0af4['limit']=qs[_0x4220('0x33')](_0x6280b2[_0x4220('0x48')][_0x4220('0x33')]);_0x3a0af4['offset']=qs[_0x4220('0x32')](_0x6280b2[_0x4220('0x48')][_0x4220('0x32')]);}return _0x32f484['getAgents'](_0x3a0af4);}})[_0x4220('0x23')](function(_0x4c1765){if(_0x4c1765){return _0x4c1765?{'count':_0x739833,'rows':_0x4c1765}:null;}})[_0x4220('0x23')](respondWithResult(_0x4d989a,null))[_0x4220('0x2e')](handleError(_0x4d989a,null));}; \ No newline at end of file +var _0xad9b=['filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','rows','show','params','find','body','MailServerOut','describe','Disposition','create','findOne','MailAccountId','map','findAll','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','from','format','attachments','join','server/files/attachments','basename','secure','auth','SendMail','sendMail','Contacts','List\x20not\x20found','subject','attach','messageId','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','json','count','set','Content-Range','apply','reject','update','destroy','get','MailAccounts','UserProfileResource','stack','name','status','send','index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','query','keys'];(function(_0x1a73f7,_0x274c12){var _0x3570fa=function(_0xdb9fc0){while(--_0xdb9fc0){_0x1a73f7['push'](_0x1a73f7['shift']());}};_0x3570fa(++_0x274c12);}(_0xad9b,0x1ea));var _0xbad9=function(_0x2d8520,_0x2d155b){_0x2d8520=_0x2d8520-0x0;var _0x5734e4=_0xad9b[_0x2d8520];return _0x5734e4;};'use strict';var pdf=require(_0xbad9('0x0'));var emlformat=require(_0xbad9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbad9('0x2'));var jsonpatch=require(_0xbad9('0x3'));var rp=require(_0xbad9('0x4'));var moment=require(_0xbad9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbad9('0x6'));var util=require(_0xbad9('0x7'));var path=require(_0xbad9('0x8'));var sox=require(_0xbad9('0x9'));var csv=require(_0xbad9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbad9('0xb'));var squel=require(_0xbad9('0xc'));var crypto=require('crypto');var jsforce=require(_0xbad9('0xd'));var deskjs=require(_0xbad9('0xe'));var toCsv=require(_0xbad9('0xa'));var querystring=require('querystring');var Papa=require(_0xbad9('0xf'));var Redis=require('ioredis');var authService=require(_0xbad9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbad9('0x11'));var hardwareService=require(_0xbad9('0x12'));var logger=require(_0xbad9('0x13'))(_0xbad9('0x14'));var utils=require(_0xbad9('0x15'));var config=require(_0xbad9('0x16'));var licenseUtil=require(_0xbad9('0x17'));var db=require(_0xbad9('0x18'))['db'];config[_0xbad9('0x19')]=_['defaults'](config['redis'],{'host':_0xbad9('0x1a'),'port':0x18eb});var socket=require(_0xbad9('0x1b'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xbad9('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbad9('0x1d')]['http']({'port':0x232b});function respondWithRpcPromise(_0x2e2bd7,_0x11f10d,_0x13d6e6,_0x17e908){return new BPromise(function(_0x228bb8,_0x5d0c29){var _0x2f54f0=_0x17e908||client;return _0x2f54f0[_0xbad9('0x1e')](_0x2e2bd7,_0x13d6e6)[_0xbad9('0x1f')](function(_0x3b1a32){logger['info'](_0xbad9('0x20'),_0x11f10d,_0xbad9('0x21'));logger['debug'](_0xbad9('0x22'),_0x11f10d,'request\x20sent',JSON[_0xbad9('0x23')](_0x3b1a32));if(_0x3b1a32[_0xbad9('0x24')]){if(_0x3b1a32[_0xbad9('0x24')][_0xbad9('0x25')]===0x1f4){logger[_0xbad9('0x24')](_0xbad9('0x20'),_0x11f10d,_0x3b1a32[_0xbad9('0x24')]['message']);return _0x5d0c29(_0x3b1a32[_0xbad9('0x24')][_0xbad9('0x26')]);}logger[_0xbad9('0x24')]('MailAccount,\x20%s,\x20%s',_0x11f10d,_0x3b1a32[_0xbad9('0x24')][_0xbad9('0x26')]);return _0x228bb8(_0x3b1a32[_0xbad9('0x24')]['message']);}else{logger[_0xbad9('0x27')](_0xbad9('0x20'),_0x11f10d,'request\x20sent');_0x228bb8(_0x3b1a32[_0xbad9('0x28')][_0xbad9('0x26')]);}})[_0xbad9('0x29')](function(_0x15c5b0){logger[_0xbad9('0x24')](_0xbad9('0x20'),_0x11f10d,_0x15c5b0);_0x5d0c29(_0x15c5b0);});});}function respondWithStatusCode(_0x388e4a,_0x22caa7){_0x22caa7=_0x22caa7||0xcc;return function(_0x3d3594){if(_0x3d3594){return _0x388e4a[_0xbad9('0x2a')](_0x22caa7);}return _0x388e4a['status'](_0x22caa7)[_0xbad9('0x2b')]();};}function respondWithResult(_0xca7f15,_0xd9687){_0xd9687=_0xd9687||0xc8;return function(_0x162d20){if(_0x162d20){return _0xca7f15['status'](_0xd9687)[_0xbad9('0x2c')](_0x162d20);}};}function respondWithFilteredResult(_0x5c0dee,_0x52187a){return function(_0x75d59){if(_0x75d59){var _0x34b51a=_0x75d59[_0xbad9('0x2d')],_0x128a45=_0x52187a['offset'],_0x2be588=_0x52187a['offset']+_0x52187a['limit'],_0x3b3ac9;if(_0x2be588>=_0x34b51a){_0x2be588=_0x34b51a;_0x3b3ac9=0xc8;}else{_0x3b3ac9=0xce;}_0x5c0dee['status'](_0x3b3ac9);return _0x5c0dee[_0xbad9('0x2e')](_0xbad9('0x2f'),_0x128a45+'-'+_0x2be588+'/'+_0x34b51a)[_0xbad9('0x2c')](_0x75d59);}return null;};}function patchUpdates(_0x23a65f){return function(_0x590325){try{jsonpatch[_0xbad9('0x30')](_0x590325,_0x23a65f,!![]);}catch(_0x200431){return BPromise[_0xbad9('0x31')](_0x200431);}return _0x590325['save']();};}function saveUpdates(_0x5c9b60,_0x1e1059){return function(_0x2c84d7){if(_0x2c84d7){return _0x2c84d7[_0xbad9('0x32')](_0x5c9b60)['then'](function(_0x5e471f){return _0x5e471f;});}return null;};}function removeEntity(_0x1e6807,_0x2f2e4a){return function(_0x5f3b53){if(_0x5f3b53){return _0x5f3b53[_0xbad9('0x33')]()['then'](function(){var _0x13aa52=_0x5f3b53[_0xbad9('0x34')]({'plain':!![]});var _0x48d33d=_0xbad9('0x35');return db[_0xbad9('0x36')][_0xbad9('0x33')]({'where':{'type':_0x48d33d,'resourceId':_0x13aa52['id']}})[_0xbad9('0x1f')](function(){return _0x5f3b53;});})[_0xbad9('0x1f')](function(){_0x1e6807['status'](0xcc)[_0xbad9('0x2b')]();});}};}function handleEntityNotFound(_0x10d200,_0x5252e9){return function(_0xa2450){if(!_0xa2450){_0x10d200['sendStatus'](0x194);}return _0xa2450;};}function handleError(_0x287cab,_0x3c29c8){_0x3c29c8=_0x3c29c8||0x1f4;return function(_0x2b3b58){logger['error'](_0x2b3b58[_0xbad9('0x37')]);if(_0x2b3b58[_0xbad9('0x38')]){delete _0x2b3b58[_0xbad9('0x38')];}_0x287cab[_0xbad9('0x39')](_0x3c29c8)[_0xbad9('0x3a')](_0x2b3b58);};}exports[_0xbad9('0x3b')]=function(_0xabc793,_0x1c27ac){var _0x264f72={'include':[{'model':db[_0xbad9('0x3c')],'as':_0xbad9('0x3d')},{'model':db['MailServerOut'],'as':_0xbad9('0x3e')},{'model':db[_0xbad9('0x3f')],'as':_0xbad9('0x40')}]},_0x106620={},_0x3f60cd={'count':0x0,'rows':[]};var _0x40c1c8=_['map'](db['MailAccount'][_0xbad9('0x41')],function(_0x340956){return{'name':_0x340956[_0xbad9('0x42')],'type':_0x340956[_0xbad9('0x43')][_0xbad9('0x44')]};});_0x106620['model']=_['map'](_0x40c1c8,_0xbad9('0x38'));_0x106620[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0xabc793[_0xbad9('0x45')]);_0x106620[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x106620['model'],_0x106620[_0xbad9('0x45')]);_0x264f72['attributes']=_['intersection'](_0x106620[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x264f72[_0xbad9('0x4b')]=_0x264f72[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x264f72[_0xbad9('0x4b')]:_0x106620['model'];if(!_0xabc793[_0xbad9('0x45')][_0xbad9('0x4d')]('nolimit')){_0x264f72[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x264f72[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x4f')]);}_0x264f72[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0xabc793[_0xbad9('0x45')][_0xbad9('0x51')]);_0x264f72[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_[_0xbad9('0x53')](_0xabc793[_0xbad9('0x45')],_0x106620[_0xbad9('0x47')]),_0x40c1c8);if(_0xabc793['query'][_0xbad9('0x54')]){_0x264f72[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x264f72['where'],{'$or':_['map'](_0x40c1c8,function(_0x294e4c){if(_0x294e4c['type']!==_0xbad9('0x56')){var _0x407a9d={};_0x407a9d[_0x294e4c['name']]={'$like':'%'+_0xabc793['query'][_0xbad9('0x54')]+'%'};return _0x407a9d;}})});}_0x264f72=_[_0xbad9('0x55')]({},_0x264f72,_0xabc793[_0xbad9('0x57')]);var _0x1c680e={'where':_0x264f72['where']};return db[_0xbad9('0x58')]['count'](_0x1c680e)['then'](function(_0x3adff9){_0x3f60cd[_0xbad9('0x2d')]=_0x3adff9;if(_0xabc793['query'][_0xbad9('0x59')]){_0x264f72[_0xbad9('0x5a')]=[{'all':!![]}];}return db[_0xbad9('0x58')]['findAll'](_0x264f72);})[_0xbad9('0x1f')](function(_0x17b0a6){_0x3f60cd[_0xbad9('0x5b')]=_0x17b0a6;return _0x3f60cd;})[_0xbad9('0x1f')](respondWithFilteredResult(_0x1c27ac,_0x264f72))[_0xbad9('0x29')](handleError(_0x1c27ac,null));};exports[_0xbad9('0x5c')]=function(_0xdb504,_0x32d0d1){var _0x3dee91={'raw':![],'where':{'id':_0xdb504[_0xbad9('0x5d')]['id']},'include':[{'model':db[_0xbad9('0x3c')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xbad9('0x3e')},{'model':db[_0xbad9('0x3f')],'as':_0xbad9('0x40')}]},_0x3baaf7={};_0x3baaf7[_0xbad9('0x49')]=_[_0xbad9('0x46')](db[_0xbad9('0x58')]['rawAttributes']);_0x3baaf7[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0xdb504[_0xbad9('0x45')]);_0x3baaf7['filters']=_[_0xbad9('0x48')](_0x3baaf7[_0xbad9('0x49')],_0x3baaf7[_0xbad9('0x45')]);_0x3dee91[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x3baaf7[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0xdb504[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x3dee91['attributes']=_0x3dee91[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x3dee91[_0xbad9('0x4b')]:_0x3baaf7[_0xbad9('0x49')];if(_0xdb504[_0xbad9('0x45')][_0xbad9('0x59')]){_0x3dee91[_0xbad9('0x5a')]=[{'all':!![]}];}_0x3dee91=_[_0xbad9('0x55')]({},_0x3dee91,_0xdb504[_0xbad9('0x57')]);return db[_0xbad9('0x58')][_0xbad9('0x5e')](_0x3dee91)[_0xbad9('0x1f')](handleEntityNotFound(_0x32d0d1,null))[_0xbad9('0x1f')](respondWithResult(_0x32d0d1,null))[_0xbad9('0x29')](handleError(_0x32d0d1,null));};exports[_0xbad9('0x32')]=function(_0xfd27af,_0x48dc06){if(_0xfd27af[_0xbad9('0x5f')]['id']){delete _0xfd27af[_0xbad9('0x5f')]['id'];}return db[_0xbad9('0x58')]['find']({'where':{'id':_0xfd27af[_0xbad9('0x5d')]['id']},'include':[{'model':db[_0xbad9('0x3c')],'as':_0xbad9('0x3d')},{'model':db[_0xbad9('0x60')],'as':'Smtp'},{'model':db['Pause'],'as':_0xbad9('0x40')}]})['then'](handleEntityNotFound(_0x48dc06,null))['then'](saveUpdates(_0xfd27af[_0xbad9('0x5f')],null))[_0xbad9('0x1f')](function(_0x4bf9ec){if(_0x4bf9ec&&_0xfd27af[_0xbad9('0x5f')][_0xbad9('0x3d')]){return db[_0xbad9('0x3c')][_0xbad9('0x32')](_0xfd27af[_0xbad9('0x5f')]['Imap'],{'where':{'MailAccountId':_0x4bf9ec['id']}})[_0xbad9('0x1f')](function(){return _0x4bf9ec;});}return _0x4bf9ec;})[_0xbad9('0x1f')](function(_0x6176c0){if(_0x6176c0&&_0xfd27af[_0xbad9('0x5f')]['Smtp']){return db[_0xbad9('0x60')]['update'](_0xfd27af[_0xbad9('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x6176c0['id']}})[_0xbad9('0x1f')](function(){return _0x6176c0;});}return _0x6176c0;})[_0xbad9('0x1f')](respondWithResult(_0x48dc06,null))[_0xbad9('0x29')](handleError(_0x48dc06,null));};exports['describe']=function(_0x446173,_0x36d0f3){return db['MailAccount'][_0xbad9('0x61')]()['then'](respondWithResult(_0x36d0f3,null))[_0xbad9('0x29')](handleError(_0x36d0f3,null));};exports['addDisposition']=function(_0x106270,_0x2464fc,_0x28054b){if(_0x106270[_0xbad9('0x5f')]['id']){delete _0x106270[_0xbad9('0x5f')]['id'];}return db[_0xbad9('0x58')]['find']({'where':{'id':_0x106270[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x2464fc,null))[_0xbad9('0x1f')](function(_0x33b665){if(_0x33b665){_0x106270['body']['MailAccountId']=_0x33b665['id'];return db[_0xbad9('0x62')][_0xbad9('0x63')](_0x106270[_0xbad9('0x5f')]);}})[_0xbad9('0x1f')](respondWithResult(_0x2464fc,null))[_0xbad9('0x29')](handleError(_0x2464fc,null));};exports['getDispositions']=function(_0x13a1c4,_0x17b434,_0x4dbe2a){var _0x560573={'raw':![],'where':{}};var _0x2a3efe={};var _0xe543bc={'count':0x0,'rows':[]};return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x13a1c4[_0xbad9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x17b434,null))[_0xbad9('0x1f')](function(_0x3fa475){if(_0x3fa475){_0x2a3efe[_0xbad9('0x49')]=_[_0xbad9('0x46')](db['Disposition'][_0xbad9('0x41')]);_0x2a3efe[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x13a1c4['query']);_0x2a3efe[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x2a3efe['model'],_0x2a3efe[_0xbad9('0x45')]);_0x560573[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x2a3efe[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0x13a1c4[_0xbad9('0x45')]['fields']));_0x560573[_0xbad9('0x4b')]=_0x560573[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x560573['attributes']:_0x2a3efe[_0xbad9('0x49')];if(!_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x4d')]('nolimit')){_0x560573[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x13a1c4[_0xbad9('0x45')]['limit']);_0x560573[_0xbad9('0x4f')]=qs['offset'](_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x4f')]);}_0x560573['order']=qs[_0xbad9('0x51')](_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x51')]);_0x560573[_0xbad9('0x52')]=qs['filters'](_[_0xbad9('0x53')](_0x13a1c4['query'],_0x2a3efe[_0xbad9('0x47')]));_0x560573[_0xbad9('0x52')][_0xbad9('0x65')]=_0x3fa475['id'];if(_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x54')]){_0x560573[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x560573[_0xbad9('0x52')],{'$or':_[_0xbad9('0x66')](_0x560573[_0xbad9('0x4b')],function(_0x11f72b){var _0x940a0e={};_0x940a0e[_0x11f72b]={'$like':'%'+_0x13a1c4[_0xbad9('0x45')]['filter']+'%'};return _0x940a0e;})});}_0x560573=_[_0xbad9('0x55')]({},_0x560573,_0x13a1c4['options']);return db[_0xbad9('0x62')]['count']({'where':_0x560573['where']})[_0xbad9('0x1f')](function(_0x2149db){_0xe543bc['count']=_0x2149db;if(_0x13a1c4[_0xbad9('0x45')][_0xbad9('0x59')]){_0x560573['include']=[{'all':!![]}];}return db[_0xbad9('0x62')][_0xbad9('0x67')](_0x560573);})['then'](function(_0x1abf92){_0xe543bc[_0xbad9('0x5b')]=_0x1abf92;return _0xe543bc;});}})[_0xbad9('0x1f')](respondWithFilteredResult(_0x17b434,_0x560573))['catch'](handleError(_0x17b434,null));};exports[_0xbad9('0x68')]=function(_0xa5e079,_0x55c395,_0x5f3878){return db['MailAccount'][_0xbad9('0x5e')]({'where':{'id':_0xa5e079['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x55c395,null))['then'](function(_0x54ff0e){if(_0x54ff0e){return _0x54ff0e[_0xbad9('0x68')](_0xa5e079[_0xbad9('0x45')][_0xbad9('0x69')]);}})[_0xbad9('0x1f')](respondWithStatusCode(_0x55c395,null))[_0xbad9('0x29')](handleError(_0x55c395,null));};exports[_0xbad9('0x6a')]=function(_0x33e0ee,_0x985e9,_0x25da05){if(_0x33e0ee[_0xbad9('0x5f')]['id']){delete _0x33e0ee['body']['id'];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x33e0ee[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x985e9,null))[_0xbad9('0x1f')](function(_0x105771){if(_0x105771){_0x33e0ee[_0xbad9('0x5f')][_0xbad9('0x65')]=_0x105771['id'];return db[_0xbad9('0x6b')]['create'](_0x33e0ee[_0xbad9('0x5f')]);}})[_0xbad9('0x1f')](respondWithResult(_0x985e9,null))[_0xbad9('0x29')](handleError(_0x985e9,null));};exports['getAnswers']=function(_0x5ee90d,_0x497e39,_0x4d0688){var _0x4f0138={'raw':![],'where':{}};var _0x9a5318={};var _0x5345f1={'count':0x0,'rows':[]};return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x5ee90d[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x497e39,null))[_0xbad9('0x1f')](function(_0xfa23ff){if(_0xfa23ff){_0x9a5318['model']=_['keys'](db[_0xbad9('0x6b')][_0xbad9('0x41')]);_0x9a5318[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x5ee90d[_0xbad9('0x45')]);_0x9a5318[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x9a5318['model'],_0x9a5318[_0xbad9('0x45')]);_0x4f0138['attributes']=_[_0xbad9('0x48')](_0x9a5318[_0xbad9('0x49')],qs['fields'](_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x4f0138[_0xbad9('0x4b')]=_0x4f0138[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x4f0138[_0xbad9('0x4b')]:_0x9a5318['model'];if(!_0x5ee90d[_0xbad9('0x45')]['hasOwnProperty'](_0xbad9('0x6c'))){_0x4f0138[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x4f0138[_0xbad9('0x4f')]=qs['offset'](_0x5ee90d[_0xbad9('0x45')]['offset']);}_0x4f0138[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x51')]);_0x4f0138[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_['pick'](_0x5ee90d[_0xbad9('0x45')],_0x9a5318[_0xbad9('0x47')]));_0x4f0138['where'][_0xbad9('0x65')]=_0xfa23ff['id'];if(_0x5ee90d['query']['filter']){_0x4f0138[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x4f0138[_0xbad9('0x52')],{'$or':_['map'](_0x4f0138[_0xbad9('0x4b')],function(_0x23cbf1){var _0x4b3ae3={};_0x4b3ae3[_0x23cbf1]={'$like':'%'+_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x54')]+'%'};return _0x4b3ae3;})});}_0x4f0138=_[_0xbad9('0x55')]({},_0x4f0138,_0x5ee90d['options']);return db['CannedAnswer'][_0xbad9('0x2d')]({'where':_0x4f0138[_0xbad9('0x52')]})[_0xbad9('0x1f')](function(_0x4972cb){_0x5345f1['count']=_0x4972cb;if(_0x5ee90d[_0xbad9('0x45')][_0xbad9('0x59')]){_0x4f0138[_0xbad9('0x5a')]=[{'all':!![]}];}return db[_0xbad9('0x6b')][_0xbad9('0x67')](_0x4f0138);})[_0xbad9('0x1f')](function(_0x33e799){_0x5345f1[_0xbad9('0x5b')]=_0x33e799;return _0x5345f1;});}})['then'](respondWithFilteredResult(_0x497e39,_0x4f0138))['catch'](handleError(_0x497e39,null));};exports['removeAnswers']=function(_0x40275f,_0x4c727f,_0x17faaf){return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x40275f[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x4c727f,null))['then'](function(_0x357957){if(_0x357957){return _0x357957[_0xbad9('0x6d')](_0x40275f[_0xbad9('0x45')]['ids']);}})[_0xbad9('0x1f')](respondWithStatusCode(_0x4c727f,null))[_0xbad9('0x29')](handleError(_0x4c727f,null));};exports['create']=function(_0x4acaf4,_0x1a6470){var _0x2b4298={'name':_0x4acaf4[_0xbad9('0x5f')]['name'],'key':_0x4acaf4['body'][_0xbad9('0x44')],'email':_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x6e')],'ListId':_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x6f')],'active':!_[_0xbad9('0x70')](_0x4acaf4['body'][_0xbad9('0x71')])?_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x71')]:!![],'description':_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0xbad9('0x70')](_0x4acaf4['body'][_0xbad9('0x73')])){if(_0x4acaf4[_0xbad9('0x5f')]['cauthentication']){_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x74')]=_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x74')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x75')];_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x76')]=_0x2b4298['Smtp']['pass']=_0x4acaf4['body'][_0xbad9('0x77')];}else{_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x78')]=_0x2b4298[_0xbad9('0x3e')]['authentication']=![];}_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x79')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x3d')][_0xbad9('0x79')];_0x2b4298[_0xbad9('0x3d')][_0xbad9('0x7a')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x3d')][_0xbad9('0x7a')];_0x2b4298['Smtp'][_0xbad9('0x79')]=_0x4acaf4['body'][_0xbad9('0x3e')][_0xbad9('0x79')];_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x7a')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x3e')]['port'];}else{_0x2b4298[_0xbad9('0x3d')]['service']=_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x7b')]=_0x4acaf4[_0xbad9('0x5f')]['cservice'];_0x2b4298['Imap']['user']=_0x2b4298[_0xbad9('0x3e')][_0xbad9('0x74')]=_0x4acaf4[_0xbad9('0x5f')][_0xbad9('0x75')];_0x2b4298['Imap'][_0xbad9('0x76')]=_0x2b4298['Smtp'][_0xbad9('0x7c')]=_0x4acaf4['body'][_0xbad9('0x77')];}return db[_0xbad9('0x58')]['create'](_0x2b4298,{'include':[{'model':db[_0xbad9('0x60')],'as':_0xbad9('0x3e')},{'model':db[_0xbad9('0x3c')],'as':_0xbad9('0x3d')}]})['then'](function(_0x191439){var _0x2bf8f8=_0x4acaf4['user']['get']({'plain':!![]});if(!_0x2bf8f8)throw new Error(_0xbad9('0x7d'));if(_0x2bf8f8['role']===_0xbad9('0x74')){var _0x12655a=_0x191439[_0xbad9('0x34')]({'plain':!![]});return db[_0xbad9('0x7e')]['find']({'where':{'name':_0xbad9('0x35'),'userProfileId':_0x2bf8f8[_0xbad9('0x7f')]},'raw':!![]})[_0xbad9('0x1f')](function(_0xa3e084){if(_0xa3e084&&_0xa3e084['autoAssociation']===0x0){return db[_0xbad9('0x36')]['create']({'name':_0x12655a[_0xbad9('0x38')],'resourceId':_0x12655a['id'],'type':_0xa3e084[_0xbad9('0x38')],'sectionId':_0xa3e084['id']},{})[_0xbad9('0x1f')](function(){return _0x191439;});}else{return _0x191439;}})['catch'](function(_0x26d6bf){logger['error'](_0xbad9('0x80'),_0x26d6bf);throw _0x26d6bf;});}return _0x191439;})[_0xbad9('0x1f')](respondWithResult(_0x1a6470,0xc9))[_0xbad9('0x29')](handleError(_0x1a6470,null));};exports[_0xbad9('0x81')]=function(_0x467d10,_0x157679,_0x16ffce){return db['MailAccount']['findOne']({'where':{'id':_0x467d10['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x157679,null))[_0xbad9('0x1f')](function(_0xc7ded){if(_0xc7ded){return _0xc7ded[_0xbad9('0x81')]();}return null;})['then'](respondWithResult(_0x157679,null))[_0xbad9('0x29')](handleError(_0x157679,null));};exports[_0xbad9('0x82')]=function(_0x383a76,_0x24ed48,_0x3c52ed){if(_0x383a76[_0xbad9('0x5f')]['id']){delete _0x383a76[_0xbad9('0x5f')]['id'];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x383a76[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x24ed48,null))[_0xbad9('0x1f')](function(_0xc978cf){if(_0xc978cf){_0x383a76['body'][_0xbad9('0x65')]=_0xc978cf['id'];return db[_0xbad9('0x3c')][_0xbad9('0x63')](_0x383a76['body']);}})[_0xbad9('0x1f')](respondWithResult(_0x24ed48,null))[_0xbad9('0x29')](handleError(_0x24ed48,null));};exports['removeImap']=function(_0xa0a47a,_0xeb92fa,_0x2736b4){return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0xa0a47a[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0xeb92fa,null))[_0xbad9('0x1f')](function(_0x4b3d9c){if(_0x4b3d9c){return _0x4b3d9c[_0xbad9('0x83')](null);}return null;})[_0xbad9('0x1f')](respondWithStatusCode(_0xeb92fa,null))[_0xbad9('0x29')](handleError(_0xeb92fa,null));};exports['getSmtp']=function(_0x5efbbf,_0x17336e,_0x2ae887){return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x5efbbf['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x17336e,null))['then'](function(_0x2d6204){if(_0x2d6204){return _0x2d6204[_0xbad9('0x84')]();}return null;})['then'](respondWithResult(_0x17336e,null))['catch'](handleError(_0x17336e,null));};exports['addSmtp']=function(_0xff089,_0x25dc3e,_0x205af2){if(_0xff089['body']['id']){delete _0xff089['body']['id'];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0xff089[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x25dc3e,null))['then'](function(_0x1b521f){if(_0x1b521f){_0xff089['body']['MailAccountId']=_0x1b521f['id'];return db[_0xbad9('0x60')][_0xbad9('0x63')](_0xff089[_0xbad9('0x5f')]);}})['then'](respondWithResult(_0x25dc3e,null))[_0xbad9('0x29')](handleError(_0x25dc3e,null));};exports['removeSmtp']=function(_0x3a351d,_0x180131,_0x186652){return db['MailAccount'][_0xbad9('0x64')]({'where':{'id':_0x3a351d[_0xbad9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x180131,null))['then'](function(_0x1b66e6){if(_0x1b66e6){return _0x1b66e6[_0xbad9('0x85')](null);}return null;})[_0xbad9('0x1f')](respondWithStatusCode(_0x180131,null))['catch'](handleError(_0x180131,null));};exports[_0xbad9('0x86')]=function(_0x1719ad,_0x1f1cf2,_0x2d5349){return db[_0xbad9('0x87')][_0xbad9('0x5e')]({'where':{'id':_0x1719ad[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x1f1cf2,null))[_0xbad9('0x1f')](function(_0x2c8ec9){if(_0x2c8ec9){return _0x2c8ec9[_0xbad9('0x86')](_0x1719ad[_0xbad9('0x5f')][_0xbad9('0x69')],_[_0xbad9('0x88')](_0x1719ad[_0xbad9('0x5f')],[_0xbad9('0x69'),'id'])||{});}})[_0xbad9('0x1f')](respondWithResult(_0x1f1cf2,null))[_0xbad9('0x29')](handleError(_0x1f1cf2,null));};exports[_0xbad9('0x89')]=function(_0x488c3a,_0x489fbc,_0x235d27){var _0x38e901={'raw':![],'where':{}};var _0x49d95d={};var _0x1f276a={'count':0x0,'rows':[]};return db[_0xbad9('0x58')]['findOne']({'where':{'id':_0x488c3a[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x489fbc,null))[_0xbad9('0x1f')](function(_0x299913){if(_0x299913){_0x49d95d[_0xbad9('0x49')]=_['keys'](db[_0xbad9('0x87')][_0xbad9('0x41')]);_0x49d95d['query']=_[_0xbad9('0x46')](_0x488c3a[_0xbad9('0x45')]);_0x49d95d[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x49d95d[_0xbad9('0x49')],_0x49d95d['query']);_0x38e901[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x49d95d['model'],qs[_0xbad9('0x4a')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x38e901[_0xbad9('0x4b')]=_0x38e901[_0xbad9('0x4b')][_0xbad9('0x4c')]?_0x38e901[_0xbad9('0x4b')]:_0x49d95d['model'];if(!_0x488c3a[_0xbad9('0x45')]['hasOwnProperty'](_0xbad9('0x6c'))){_0x38e901['limit']=qs[_0xbad9('0x4e')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x38e901[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x4f')]);}_0x38e901[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0x488c3a[_0xbad9('0x45')][_0xbad9('0x51')]);_0x38e901[_0xbad9('0x52')]=qs['filters'](_[_0xbad9('0x53')](_0x488c3a[_0xbad9('0x45')],_0x49d95d[_0xbad9('0x47')]));_0x38e901[_0xbad9('0x52')][_0xbad9('0x65')]=_0x299913['id'];if(_0x488c3a[_0xbad9('0x45')][_0xbad9('0x54')]){_0x38e901[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x38e901[_0xbad9('0x52')],{'$or':_[_0xbad9('0x66')](_0x38e901[_0xbad9('0x4b')],function(_0x442498){var _0xacbad3={};_0xacbad3[_0x442498]={'$like':'%'+_0x488c3a[_0xbad9('0x45')][_0xbad9('0x54')]+'%'};return _0xacbad3;})});}_0x38e901=_[_0xbad9('0x55')]({},_0x38e901,_0x488c3a[_0xbad9('0x57')]);return db[_0xbad9('0x87')][_0xbad9('0x2d')]({'where':_0x38e901[_0xbad9('0x52')]})[_0xbad9('0x1f')](function(_0x55194c){_0x1f276a['count']=_0x55194c;if(_0x488c3a[_0xbad9('0x45')]['includeAll']){_0x38e901[_0xbad9('0x5a')]=[{'model':db[_0xbad9('0x8a')],'as':_0xbad9('0x8b'),'required':![]},{'model':db[_0xbad9('0x8c')],'as':_0xbad9('0x8d'),'attributes':[_0xbad9('0x38'),'fullname','internal'],'required':![]},{'model':db[_0xbad9('0x8e')],'as':_0xbad9('0x8f'),'attributes':['id',_0xbad9('0x38'),'color'],'where':_0x488c3a[_0xbad9('0x45')][_0xbad9('0x90')]?{'id':_0x488c3a[_0xbad9('0x45')][_0xbad9('0x90')]}:undefined,'required':_0x488c3a[_0xbad9('0x45')][_0xbad9('0x90')]?!![]:![]}];}return db[_0xbad9('0x87')]['findAll'](_0x38e901);})['then'](function(_0x4ec919){_0x1f276a[_0xbad9('0x5b')]=_0x4ec919;return _0x1f276a;});}})[_0xbad9('0x1f')](respondWithFilteredResult(_0x489fbc,_0x38e901))['catch'](handleError(_0x489fbc,null));};exports[_0xbad9('0x91')]=function(_0x241f66,_0x4cc6ee,_0x421c1){return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x241f66['params']['id']}})['then'](handleEntityNotFound(_0x4cc6ee,null))[_0xbad9('0x1f')](function(_0x439c74){if(_0x439c74){return db[_0xbad9('0x92')][_0xbad9('0x93')](function(_0x39f4d5){return db[_0xbad9('0x94')][_0xbad9('0x33')]({'where':{'MailAccountId':_0x241f66[_0xbad9('0x5d')]['id']},'transaction':_0x39f4d5})[_0xbad9('0x1f')](function(_0x53e5f2){var _0x26c02b=_['map'](_0x241f66[_0xbad9('0x5f')],function(_0x153423){_0x153423[_0xbad9('0x65')]=_0x241f66[_0xbad9('0x5d')]['id'];return _0x153423;});return db[_0xbad9('0x94')]['bulkCreate'](_0x26c02b,{'transaction':_0x39f4d5});});})['then'](function(){return db[_0xbad9('0x94')][_0xbad9('0x95')]({'where':{'MailAccountId':_0x241f66[_0xbad9('0x5d')]['id']},'order':'priority'});});}})[_0xbad9('0x1f')](respondWithResult(_0x4cc6ee,null))[_0xbad9('0x29')](handleError(_0x4cc6ee,null));};exports[_0xbad9('0x96')]=function(_0x436a5e,_0x3ed3c4,_0x2e4fd9){var _0x10aa1c={};var _0x31a299={};var _0x2a6241;var _0x2bfea2;return db['MailAccount']['findOne']({'where':{'id':_0x436a5e['params']['id']}})['then'](handleEntityNotFound(_0x3ed3c4,null))['then'](function(_0x12a6d4){if(_0x12a6d4){_0x2a6241=_0x12a6d4;_0x31a299[_0xbad9('0x49')]=_['keys'](db[_0xbad9('0x94')][_0xbad9('0x41')]);_0x31a299[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x436a5e[_0xbad9('0x45')]);_0x31a299[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x31a299[_0xbad9('0x49')],_0x31a299[_0xbad9('0x45')]);_0x10aa1c['attributes']=_[_0xbad9('0x48')](_0x31a299['model'],qs[_0xbad9('0x4a')](_0x436a5e[_0xbad9('0x45')][_0xbad9('0x4a')]));_0x10aa1c[_0xbad9('0x4b')]=_0x10aa1c['attributes'][_0xbad9('0x4c')]?_0x10aa1c['attributes']:_0x31a299[_0xbad9('0x49')];_0x10aa1c['order']=qs[_0xbad9('0x51')](_0x436a5e[_0xbad9('0x45')][_0xbad9('0x51')]);_0x10aa1c[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_[_0xbad9('0x53')](_0x436a5e[_0xbad9('0x45')],_0x31a299[_0xbad9('0x47')]));if(_0x436a5e['query'][_0xbad9('0x54')]){_0x10aa1c[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x10aa1c[_0xbad9('0x52')],{'$or':_[_0xbad9('0x66')](_0x10aa1c[_0xbad9('0x4b')],function(_0x3c3bea){var _0x3ce68c={};_0x3ce68c[_0x3c3bea]={'$like':'%'+_0x436a5e[_0xbad9('0x45')]['filter']+'%'};return _0x3ce68c;})});}_0x10aa1c=_[_0xbad9('0x55')]({},_0x10aa1c,_0x436a5e[_0xbad9('0x57')]);return _0x2a6241[_0xbad9('0x96')](_0x10aa1c);}})['then'](function(_0x2fde90){if(_0x2fde90){_0x2bfea2=_0x2fde90[_0xbad9('0x4c')];if(!_0x436a5e[_0xbad9('0x45')][_0xbad9('0x4d')](_0xbad9('0x6c'))){_0x10aa1c['limit']=qs[_0xbad9('0x4e')](_0x436a5e['query'][_0xbad9('0x4e')]);_0x10aa1c[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0x436a5e[_0xbad9('0x45')]['offset']);}return _0x2a6241[_0xbad9('0x96')](_0x10aa1c);}})[_0xbad9('0x1f')](function(_0x5ea8be){if(_0x5ea8be){return _0x5ea8be?{'count':_0x2bfea2,'rows':_0x5ea8be}:null;}})[_0xbad9('0x1f')](respondWithResult(_0x3ed3c4,null))[_0xbad9('0x29')](handleError(_0x3ed3c4,null));};exports[_0xbad9('0x97')]=function(_0x234f02,_0x1d1d8b,_0x14180d){var _0x26c768={'raw':!![],'where':{}};var _0x1e8e9b={};var _0xbe7206={'count':0x0,'rows':[]};return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x234f02['params']['id']}})['then'](handleEntityNotFound(_0x1d1d8b,null))['then'](function(_0x1b6281){if(_0x1b6281){_0x1e8e9b[_0xbad9('0x49')]=_[_0xbad9('0x46')](db[_0xbad9('0x98')][_0xbad9('0x41')]);_0x1e8e9b[_0xbad9('0x45')]=_[_0xbad9('0x46')](_0x234f02['query']);_0x1e8e9b[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x1e8e9b[_0xbad9('0x49')],_0x1e8e9b[_0xbad9('0x45')]);_0x26c768[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x1e8e9b['model'],qs[_0xbad9('0x4a')](_0x234f02[_0xbad9('0x45')]['fields']));_0x26c768[_0xbad9('0x4b')]=_0x26c768[_0xbad9('0x4b')]['length']?_0x26c768[_0xbad9('0x4b')]:_0x1e8e9b[_0xbad9('0x49')];if(!_0x234f02[_0xbad9('0x45')][_0xbad9('0x4d')](_0xbad9('0x6c'))){_0x26c768[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x234f02[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x26c768['offset']=qs[_0xbad9('0x4f')](_0x234f02[_0xbad9('0x45')]['offset']);}_0x26c768[_0xbad9('0x50')]=qs[_0xbad9('0x51')](_0x234f02[_0xbad9('0x45')]['sort']);_0x26c768[_0xbad9('0x52')]=qs['filters'](_[_0xbad9('0x53')](_0x234f02[_0xbad9('0x45')],_0x1e8e9b['filters']));_0x26c768['where'][_0xbad9('0x65')]=_0x1b6281['id'];if(_0x234f02[_0xbad9('0x45')][_0xbad9('0x54')]){_0x26c768[_0xbad9('0x52')]=_['merge'](_0x26c768['where'],{'$or':_[_0xbad9('0x66')](_0x26c768['attributes'],function(_0x2a3dc6){var _0x4e9755={};_0x4e9755[_0x2a3dc6]={'$like':'%'+_0x234f02['query'][_0xbad9('0x54')]+'%'};return _0x4e9755;})});}if(_0x234f02[_0xbad9('0x45')][_0xbad9('0x99')]){var _0x1f73e2=_0x234f02[_0xbad9('0x45')][_0xbad9('0x99')][_0xbad9('0x9a')](',');var _0x3a6f03={};_0x3a6f03[_0x1f73e2[0x0]]={'$gte':moment(_0x1f73e2[0x1])['format'](_0xbad9('0x9b'))};_0x26c768['where']=_[_0xbad9('0x55')](_0x26c768['where'],_0x3a6f03);}_0x26c768=_[_0xbad9('0x55')]({},_0x26c768,_0x234f02[_0xbad9('0x57')]);return db[_0xbad9('0x98')][_0xbad9('0x2d')]({'where':_0x26c768[_0xbad9('0x52')]})[_0xbad9('0x1f')](function(_0x55ea21){_0xbe7206[_0xbad9('0x2d')]=_0x55ea21;if(_0x234f02[_0xbad9('0x45')]['includeAll']){_0x26c768[_0xbad9('0x5a')]=[{'all':!![]}];}return db[_0xbad9('0x98')]['findAll'](_0x26c768);})[_0xbad9('0x1f')](function(_0x4a1f70){_0xbe7206[_0xbad9('0x5b')]=_0x4a1f70;return _0xbe7206;});}})[_0xbad9('0x1f')](respondWithFilteredResult(_0x1d1d8b,_0x26c768))[_0xbad9('0x29')](handleError(_0x1d1d8b,null));};exports[_0xbad9('0x3a')]=function(_0x5d3447,_0xaf00c1,_0x3c3129){var _0x43cb7b,_0x1192ce={},_0x28b8e6;if(_0x5d3447[_0xbad9('0x5f')]['to']){_0x28b8e6=_0x5d3447[_0xbad9('0x5f')]['to'][_0xbad9('0x9a')](',')[0x0];}return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x5d3447['params']['id']},'include':[{'model':db[_0xbad9('0x9c')],'as':_0xbad9('0x9d'),'include':[{'model':db[_0xbad9('0x8a')],'as':'Contacts','where':{'email':_0x28b8e6},'limit':0x1,'order':[[_0xbad9('0x9e'),_0xbad9('0x9f')]]}]},{'model':db[_0xbad9('0x60')],'as':_0xbad9('0x3e'),'raw':!![]}]})[_0xbad9('0x1f')](handleEntityNotFound(_0xaf00c1,null))[_0xbad9('0x1f')](function(_0x26fd9d){if(_0x26fd9d){_0x43cb7b=_0x26fd9d;if(_0x26fd9d[_0xbad9('0x3e')]){if(_[_0xbad9('0x70')](_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa0')])){_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa0')]=util[_0xbad9('0xa1')]('%s\x20<%s>',_0x26fd9d[_0xbad9('0x38')],_0x26fd9d[_0xbad9('0x6e')]||_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x74')]);}if(_0x5d3447['body']['attachments']&&_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa2')]['length']){for(var _0x132cba=0x0;_0x132cba<_0x5d3447['body'][_0xbad9('0xa2')][_0xbad9('0x4c')];_0x132cba+=0x1){_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xa2')][_0x132cba]={'filename':_0x5d3447[_0xbad9('0x5f')]['attachments'][_0x132cba][_0xbad9('0x38')],'path':path[_0xbad9('0xa3')](config['root'],_0xbad9('0xa4'),_0x5d3447['body'][_0xbad9('0xa2')][_0x132cba][_0xbad9('0xa5')])};}}var _0x413034={'tls':{'rejectUnauthorized':![]}};if(_[_0xbad9('0x70')](_0x26fd9d['Smtp'][_0xbad9('0x7b')])){if(_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x78')]){_0x413034['auth']={'user':_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x74')],'pass':_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x7c')]};}_0x413034[_0xbad9('0x79')]=_0x26fd9d['Smtp'][_0xbad9('0x79')];_0x413034[_0xbad9('0x7a')]=_0x26fd9d[_0xbad9('0x3e')]['port'];_0x413034[_0xbad9('0xa6')]=_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0xa6')];}else{_0x413034[_0xbad9('0x7b')]=_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x7b')];_0x413034[_0xbad9('0xa7')]={'user':_0x26fd9d[_0xbad9('0x3e')][_0xbad9('0x74')],'pass':_0x26fd9d[_0xbad9('0x3e')]['pass']};}return respondWithRpcPromise(_0xbad9('0xa8'),_0xbad9('0xa9'),{'account':_0x413034,'message':_0x5d3447[_0xbad9('0x5f')]});}else{throw new Error('List\x20not\x20found');}}})[_0xbad9('0x1f')](function(_0x1dbe7d){if(_0x1dbe7d){_0x1192ce=_0x1dbe7d;if(_0x43cb7b[_0xbad9('0x9d')]){if(_0x43cb7b[_0xbad9('0x9d')][_0xbad9('0xaa')]['length']){return _0x43cb7b['List'][_0xbad9('0xaa')][0x0];}else{return db[_0xbad9('0x8a')][_0xbad9('0x63')](_['defaults'](_0x5d3447[_0xbad9('0x5f')],{'firstName':_0x5d3447[_0xbad9('0x5f')]['to'],'email':_0x5d3447[_0xbad9('0x5f')]['to'],'phone':_0x5d3447[_0xbad9('0x5f')]['to'],'ListId':_0x43cb7b[_0xbad9('0x6f')]}));}}else{throw new Error(_0xbad9('0xab'));}}})[_0xbad9('0x1f')](function(_0x10c4e1){if(_0x10c4e1){var _0x336014={'UserId':_0x5d3447[_0xbad9('0x74')]['id'],'ContactId':_0x10c4e1['id'],'MailAccountId':_0x43cb7b['id'],'inReplyTo':_0x1192ce['messageId'],'to':_0x5d3447['body'][_0xbad9('0xa0')],'cc':_0x5d3447[_0xbad9('0x5f')]['cc'],'subject':_0x5d3447[_0xbad9('0x5f')][_0xbad9('0xac')],'attach':_0x5d3447['body'][_0xbad9('0xad')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xbad9('0xa1')](_0xbad9('0x9b')),'lastMsgDirection':'out','lastMsgBody':_0x5d3447['body']['body'],'Messages':[_[_0xbad9('0x55')](_0x5d3447[_0xbad9('0x5f')],{'messageId':_0x1192ce[_0xbad9('0xae')],'sentAt':moment()[_0xbad9('0xa1')](_0xbad9('0x9b')),'read':!![],'MailAccountId':_0x43cb7b['id'],'UserId':_0x5d3447['user']['id'],'ContactId':_0x10c4e1['id']})]};if(_0x5d3447[_0xbad9('0x5f')]['Interaction']){_0x336014=_[_0xbad9('0x55')](_0x336014,_0x5d3447['body']['Interaction']);}return db[_0xbad9('0x87')][_0xbad9('0x63')](_0x336014,{'include':[{'model':db['MailMessage'],'as':_0xbad9('0xaf')}]});}})['then'](respondWithResult(_0xaf00c1,null))['catch'](handleError(_0xaf00c1,null));};exports[_0xbad9('0xb0')]=function(_0x288e40,_0x25c3c8,_0x1b5099){return db['MailAccount'][_0xbad9('0x5e')]({'where':{'id':_0x288e40[_0xbad9('0x5d')]['id']},'include':[{'model':db[_0xbad9('0x60')],'as':'Smtp','raw':!![]}]})[_0xbad9('0x1f')](handleEntityNotFound(_0x25c3c8,null))[_0xbad9('0x1f')](function(_0x384589){if(_0x384589&&_0x384589['Smtp']){var _0x46c2f8={'id':_0x384589['id'],'tls':{'rejectUnauthorized':![]}};if(_0x384589[_0xbad9('0x3e')][_0xbad9('0x7b')]){_0x46c2f8[_0xbad9('0x7b')]=_0x384589[_0xbad9('0x3e')][_0xbad9('0x7b')];}else{_0x46c2f8[_0xbad9('0x79')]=_0x384589[_0xbad9('0x3e')][_0xbad9('0x79')];_0x46c2f8[_0xbad9('0x7a')]=_0x384589[_0xbad9('0x3e')]['port'];_0x46c2f8[_0xbad9('0xa6')]=_0x384589[_0xbad9('0x3e')][_0xbad9('0xa6')];}if(_0x384589[_0xbad9('0x3e')][_0xbad9('0x78')]){_0x46c2f8[_0xbad9('0xa7')]={'user':_0x384589['Smtp'][_0xbad9('0x74')],'pass':_0x384589[_0xbad9('0x3e')][_0xbad9('0x7c')]};}return respondWithRpcPromise(_0xbad9('0xb1'),_0xbad9('0xb0'),{'account':_0x46c2f8});}})[_0xbad9('0x1f')](respondWithResult(_0x25c3c8,null))[_0xbad9('0x29')](handleError(_0x25c3c8,null));};exports[_0xbad9('0x33')]=function(_0x467287,_0x376380){return db['MailAccount']['find']({'where':{'id':_0x467287['params']['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x376380,null))[_0xbad9('0x1f')](function(_0x5e161e){if(_0x5e161e&&_0x5e161e[_0xbad9('0x7b')]){throw new db[(_0xbad9('0xb2'))]['ValidationError'](_0xbad9('0xb3'));}return _0x5e161e;})[_0xbad9('0x1f')](removeEntity(_0x376380,null))[_0xbad9('0x29')](handleError(_0x376380,null));};exports[_0xbad9('0xb4')]=function(_0x578adb,_0xae72a,_0x5ee894){return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x578adb[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0xae72a,null))[_0xbad9('0x1f')](function(_0x4a2abb){if(_0x4a2abb){return _0x4a2abb['addAgents'](_0x578adb[_0xbad9('0x5f')][_0xbad9('0x69')],_['omit'](_0x578adb[_0xbad9('0x5f')],[_0xbad9('0x69'),'id'])||{})['spread'](function(_0x5015bf){for(var _0x303553=0x0;_0x303553<_0x578adb[_0xbad9('0x5f')]['ids'][_0xbad9('0x4c')];_0x303553+=0x1){socket[_0xbad9('0xb5')](_0xbad9('0xb6'),{'UserId':_0x578adb[_0xbad9('0x5f')][_0xbad9('0x69')][_0x303553],'MailAccountId':_0x578adb[_0xbad9('0x5d')]['id']});}return _0x5015bf;});}})['then'](respondWithResult(_0xae72a,null))[_0xbad9('0x29')](handleError(_0xae72a,null));};exports[_0xbad9('0xb7')]=function(_0x30334a,_0x1c9872,_0x2b8181){return db[_0xbad9('0x58')][_0xbad9('0x5e')]({'where':{'id':_0x30334a[_0xbad9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c9872,null))[_0xbad9('0x1f')](function(_0x334d25){if(_0x334d25){return _0x334d25['removeAgents'](_0x30334a['query'][_0xbad9('0x69')])[_0xbad9('0x1f')](function(){if(_[_0xbad9('0xb8')](_0x30334a[_0xbad9('0x45')]['ids'])){for(var _0x57b4c4=0x0;_0x57b4c4<_0x30334a[_0xbad9('0x45')][_0xbad9('0x69')][_0xbad9('0x4c')];_0x57b4c4+=0x1){socket[_0xbad9('0xb5')](_0xbad9('0xb9'),{'UserId':Number(_0x30334a[_0xbad9('0x45')][_0xbad9('0x69')][_0x57b4c4]),'MailAccountId':Number(_0x30334a[_0xbad9('0x5d')]['id'])});}}else{socket[_0xbad9('0xb5')](_0xbad9('0xb9'),{'UserId':Number(_0x30334a[_0xbad9('0x45')][_0xbad9('0x69')]),'MailAccountId':Number(_0x30334a[_0xbad9('0x5d')]['id'])});}});}})[_0xbad9('0x1f')](respondWithStatusCode(_0x1c9872,null))['catch'](handleError(_0x1c9872,null));};exports[_0xbad9('0xba')]=function(_0x2e5ab6,_0x3d36c3,_0x467550){var _0x3d3e63={};var _0x4581dd={};var _0x5de079;var _0x51c4cc;return db[_0xbad9('0x58')][_0xbad9('0x64')]({'where':{'id':_0x2e5ab6[_0xbad9('0x5d')]['id']}})[_0xbad9('0x1f')](handleEntityNotFound(_0x3d36c3,null))['then'](function(_0x5b298f){if(_0x5b298f){_0x5de079=_0x5b298f;_0x4581dd[_0xbad9('0x49')]=_[_0xbad9('0x46')](db[_0xbad9('0x8c')][_0xbad9('0x41')]);_0x4581dd['query']=_[_0xbad9('0x46')](_0x2e5ab6[_0xbad9('0x45')]);_0x4581dd[_0xbad9('0x47')]=_[_0xbad9('0x48')](_0x4581dd[_0xbad9('0x49')],_0x4581dd[_0xbad9('0x45')]);_0x3d3e63[_0xbad9('0x4b')]=_[_0xbad9('0x48')](_0x4581dd[_0xbad9('0x49')],qs[_0xbad9('0x4a')](_0x2e5ab6['query'][_0xbad9('0x4a')]));_0x3d3e63['attributes']=_0x3d3e63['attributes'][_0xbad9('0x4c')]?_0x3d3e63[_0xbad9('0x4b')]:_0x4581dd['model'];_0x3d3e63[_0xbad9('0x50')]=qs['sort'](_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x51')]);_0x3d3e63[_0xbad9('0x52')]=qs[_0xbad9('0x47')](_[_0xbad9('0x53')](_0x2e5ab6[_0xbad9('0x45')],_0x4581dd['filters']));if(_0x2e5ab6[_0xbad9('0x45')]['filter']){_0x3d3e63[_0xbad9('0x52')]=_[_0xbad9('0x55')](_0x3d3e63['where'],{'$or':_['map'](_0x3d3e63[_0xbad9('0x4b')],function(_0x4cbe3b){var _0x36551b={};_0x36551b[_0x4cbe3b]={'$like':'%'+_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x54')]+'%'};return _0x36551b;})});}_0x3d3e63=_[_0xbad9('0x55')]({},_0x3d3e63,_0x2e5ab6[_0xbad9('0x57')]);return _0x5de079[_0xbad9('0xba')](_0x3d3e63);}})[_0xbad9('0x1f')](function(_0x3853ff){if(_0x3853ff){_0x51c4cc=_0x3853ff[_0xbad9('0x4c')];if(!_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x4d')](_0xbad9('0x6c'))){_0x3d3e63[_0xbad9('0x4e')]=qs[_0xbad9('0x4e')](_0x2e5ab6[_0xbad9('0x45')][_0xbad9('0x4e')]);_0x3d3e63[_0xbad9('0x4f')]=qs[_0xbad9('0x4f')](_0x2e5ab6[_0xbad9('0x45')]['offset']);}return _0x5de079[_0xbad9('0xba')](_0x3d3e63);}})[_0xbad9('0x1f')](function(_0x549cab){if(_0x549cab){return _0x549cab?{'count':_0x51c4cc,'rows':_0x549cab}:null;}})['then'](respondWithResult(_0x3d36c3,null))['catch'](handleError(_0x3d36c3,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 44d5123..37d9a85 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 _0xba2a=['events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x515d61,_0x51eab7){var _0x4bda81=function(_0x1b1a8f){while(--_0x1b1a8f){_0x515d61['push'](_0x515d61['shift']());}};_0x4bda81(++_0x51eab7);}(_0xba2a,0x1ef));var _0xaba2=function(_0x2a14fb,_0x6f1e5d){_0x2a14fb=_0x2a14fb-0x0;var _0x2a9180=_0xba2a[_0x2a14fb];return _0x2a9180;};'use strict';var EventEmitter=require(_0xaba2('0x0'));var MailAccount=require(_0xaba2('0x1'))['db'][_0xaba2('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xaba2('0x3')](0x0);var events={'afterCreate':_0xaba2('0x4'),'afterUpdate':'update','afterDestroy':_0xaba2('0x5')};function emitEvent(_0x53a287){return function(_0x52cef8,_0x421f9f,_0xb1b909){MailAccountEvents[_0xaba2('0x6')](_0x53a287+':'+_0x52cef8['id'],_0x52cef8);MailAccountEvents[_0xaba2('0x6')](_0x53a287,_0x52cef8);_0xb1b909(null);};}for(var e in events){if(events[_0xaba2('0x7')](e)){var event=events[e];MailAccount[_0xaba2('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xf896=['events','MailAccount','setMaxListeners','update','remove','emit'];(function(_0x58d8c3,_0x4fad0c){var _0x2fc3d5=function(_0x40e22e){while(--_0x40e22e){_0x58d8c3['push'](_0x58d8c3['shift']());}};_0x2fc3d5(++_0x4fad0c);}(_0xf896,0x186));var _0x6f89=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xf896[_0x1ad926];return _0x1b81dc;};'use strict';var EventEmitter=require(_0x6f89('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x6f89('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6f89('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f89('0x3'),'afterDestroy':_0x6f89('0x4')};function emitEvent(_0x1b26bd){return function(_0xb498d4,_0xc1328b,_0x3fa41a){MailAccountEvents[_0x6f89('0x5')](_0x1b26bd+':'+_0xb498d4['id'],_0xb498d4);MailAccountEvents[_0x6f89('0x5')](_0x1b26bd,_0xb498d4);_0x3fa41a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f869d01..58b7c4a 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 _0xa902=['../../config/logger','api','moment','request-promise','../../config/environment','./mailAccount.attributes','exports','define','mail_accounts','lodash','util'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa902,0x8d));var _0x2a90=function(_0x4015b7,_0x3e76b3){_0x4015b7=_0x4015b7-0x0;var _0x354114=_0xa902[_0x4015b7];return _0x354114;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var moment=require(_0x2a90('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a90('0x6'));var attributes=require(_0x2a90('0x7'));module[_0x2a90('0x8')]=function(_0x21e1d2,_0x4a32c7){return _0x21e1d2[_0x2a90('0x9')]('MailAccount',attributes,{'tableName':_0x2a90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dcb=['util','moment','bluebird','request-promise','path','rimraf','exports','MailAccount','mail_accounts','lodash'];(function(_0x5f4769,_0x5510f4){var _0x3925bf=function(_0x349ac5){while(--_0x349ac5){_0x5f4769['push'](_0x5f4769['shift']());}};_0x3925bf(++_0x5510f4);}(_0x4dcb,0x153));var _0xb4dc=function(_0x4ffe5a,_0x4dc8ec){_0x4ffe5a=_0x4ffe5a-0x0;var _0x23a297=_0x4dcb[_0x4ffe5a];return _0x23a297;};'use strict';var _=require(_0xb4dc('0x0'));var util=require(_0xb4dc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4dc('0x2'));var BPromise=require(_0xb4dc('0x3'));var rp=require(_0xb4dc('0x4'));var fs=require('fs');var path=require(_0xb4dc('0x5'));var rimraf=require(_0xb4dc('0x6'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0xb4dc('0x7')]=function(_0x493ce7,_0x38f8bc){return _0x493ce7['define'](_0xb4dc('0x8'),attributes,{'tableName':_0xb4dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 91801fe..6908eb1 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 _0x195e=['from','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','priority','asc','autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','YYYY-MM-DD\x20HH:mm:ss','interaction','created','create','attachments','originCc','bcc','UserId','User','name','unshift','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','debug','find','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0xcb86e,_0x27e972){var _0x256865=function(_0x8e44e2){while(--_0x8e44e2){_0xcb86e['push'](_0xcb86e['shift']());}};_0x256865(++_0x27e972);}(_0x195e,0xfb));var _0xe195=function(_0x1f6b09,_0x352d85){_0x1f6b09=_0x1f6b09-0x0;var _0x155d71=_0x195e[_0x1f6b09];return _0x155d71;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232c});config[_0xe195('0xd')]=_[_0xe195('0xe')](config[_0xe195('0xd')],{'host':_0xe195('0xf'),'port':0x18eb});var socket=require(_0xe195('0x10'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3bf721,_0x3a7b4e,_0x1d8102){return new BPromise(function(_0xb606ec,_0x5bd212){return client[_0xe195('0x11')](_0x3bf721,_0x1d8102)[_0xe195('0x12')](function(_0x1bde59){logger['info'](_0xe195('0x13'),_0x3a7b4e,_0xe195('0x14'));logger['debug'](_0xe195('0x15'),_0x3a7b4e,_0xe195('0x14'),JSON[_0xe195('0x16')](_0x1bde59));if(_0x1bde59[_0xe195('0x17')]){if(_0x1bde59['error'][_0xe195('0x18')]===0x1f4){logger[_0xe195('0x17')]('MailAccount,\x20%s,\x20%s',_0x3a7b4e,_0x1bde59['error'][_0xe195('0x19')]);return _0x5bd212(_0x1bde59['error'][_0xe195('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3a7b4e,_0x1bde59[_0xe195('0x17')][_0xe195('0x19')]);return _0xb606ec(_0x1bde59[_0xe195('0x17')][_0xe195('0x19')]);}else{logger[_0xe195('0x1a')](_0xe195('0x13'),_0x3a7b4e,_0xe195('0x14'));_0xb606ec(_0x1bde59[_0xe195('0x1b')][_0xe195('0x19')]);}})[_0xe195('0x1c')](function(_0x4db087){logger[_0xe195('0x17')](_0xe195('0x13'),_0x3a7b4e,_0x4db087);_0x5bd212(_0x4db087);});});}exports[_0xe195('0x1d')]=function(_0x2cb300){var _0x3f4326=this;return new Promise(function(_0x14b686,_0x496722){return db[_0xe195('0x1e')][_0xe195('0x1f')]({'raw':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2cb300['options']?_0x2cb300['options'][_0xe195('0x21')]||null:null,'attributes':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')][_0xe195('0x22')]||null:null,'limit':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')][_0xe195('0x23')]||null:null,'include':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')][_0xe195('0x24')]?_[_0xe195('0x25')](_0x2cb300[_0xe195('0x20')][_0xe195('0x24')],function(_0x58ea75){return{'model':db[_0x58ea75[_0xe195('0x26')]],'as':_0x58ea75['as'],'attributes':_0x58ea75[_0xe195('0x22')],'include':_0x58ea75[_0xe195('0x24')]?_[_0xe195('0x25')](_0x58ea75[_0xe195('0x24')],function(_0x38be17){return{'model':db[_0x38be17[_0xe195('0x26')]],'as':_0x38be17['as'],'attributes':_0x38be17[_0xe195('0x22')],'include':_0x38be17[_0xe195('0x24')]?_[_0xe195('0x25')](_0x38be17['include'],function(_0x33a08d){return{'model':db[_0x33a08d[_0xe195('0x26')]],'as':_0x33a08d['as'],'attributes':_0x33a08d[_0xe195('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe195('0x12')](function(_0x283516){logger['info']('GetMailAccount',_0x2cb300);logger[_0xe195('0x27')](_0xe195('0x1d'),_0x2cb300,JSON[_0xe195('0x16')](_0x283516));_0x14b686(_0x283516);})[_0xe195('0x1c')](function(_0x2b69a3){logger[_0xe195('0x17')]('GetMailAccount',_0x2b69a3[_0xe195('0x19')],_0x2cb300);_0x496722(_0x3f4326[_0xe195('0x17')](0x1f4,_0x2b69a3[_0xe195('0x19')]));});});};exports['ShowMailAccount']=function(_0x2b399e){var _0x5a9f50=this;return new Promise(function(_0xca299f,_0x7ec255){return db['MailAccount'][_0xe195('0x28')]({'raw':_0x2b399e[_0xe195('0x20')]?_0x2b399e[_0xe195('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2b399e[_0xe195('0x20')]?_0x2b399e[_0xe195('0x20')][_0xe195('0x21')]||null:null,'attributes':_0x2b399e[_0xe195('0x20')]?_0x2b399e[_0xe195('0x20')][_0xe195('0x22')]||null:null,'include':_0x2b399e['options']?_0x2b399e[_0xe195('0x20')][_0xe195('0x24')]?_[_0xe195('0x25')](_0x2b399e[_0xe195('0x20')][_0xe195('0x24')],function(_0x2ce341){return{'model':db[_0x2ce341[_0xe195('0x26')]],'as':_0x2ce341['as'],'attributes':_0x2ce341['attributes'],'include':_0x2ce341[_0xe195('0x24')]?_[_0xe195('0x25')](_0x2ce341['include'],function(_0x2a3ecd){return{'model':db[_0x2a3ecd[_0xe195('0x26')]],'as':_0x2a3ecd['as'],'attributes':_0x2a3ecd['attributes'],'include':_0x2a3ecd[_0xe195('0x24')]?_['map'](_0x2a3ecd[_0xe195('0x24')],function(_0x3fc4c6){return{'model':db[_0x3fc4c6[_0xe195('0x26')]],'as':_0x3fc4c6['as'],'attributes':_0x3fc4c6[_0xe195('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe195('0x12')](function(_0x423023){logger['info'](_0xe195('0x29'),_0x2b399e);logger[_0xe195('0x27')](_0xe195('0x29'),_0x2b399e,JSON['stringify'](_0x423023));_0xca299f(_0x423023);})[_0xe195('0x1c')](function(_0x4dd43a){logger['error'](_0xe195('0x29'),_0x4dd43a[_0xe195('0x19')],_0x2b399e);_0x7ec255(_0x5a9f50['error'](0x1f4,_0x4dd43a[_0xe195('0x19')]));});});};exports[_0xe195('0x2a')]=function(_0x28ac42){var _0x57f25f=this;return new Promise(function(_0x2b6bad,_0x78f2cc){var _0x4028b6={'body':_0x28ac42[_0xe195('0x2b')],'channel':_0xe195('0x2c')};var _0x206dfb=_[_0xe195('0x2d')](_[_0xe195('0x2e')](db[_0xe195('0x2f')][_0xe195('0x30')]),[_0xe195('0x31'),_0xe195('0x32'),'CompanyId',_0xe195('0x33')]);var _0x2e732a=![];if(_0x28ac42[_0xe195('0x2b')]['id']){delete _0x28ac42[_0xe195('0x2b')]['id'];}if(_[_0xe195('0x34')](_0x28ac42['body']['from'])){return _0x78f2cc(_0x57f25f['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe195('0x34')](_0x28ac42['body'][_0xe195('0x2b')])||_0x28ac42['body']['body']===''){return _0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0xe195('0x35')));}if(_[_0xe195('0x34')](_0x28ac42[_0xe195('0x2b')][_0xe195('0x36')])){return _0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0xe195('0x37')+_0x206dfb));}if(!_[_0xe195('0x38')](_0x206dfb,_0x28ac42['body']['mapKey'])){return _0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0xe195('0x39')+_0x206dfb));}var _0x4873be={};_0x4873be[_0x28ac42[_0xe195('0x2b')][_0xe195('0x36')]]=_0x28ac42[_0xe195('0x2b')][_0xe195('0x3a')];return db[_0xe195('0x1e')][_0xe195('0x28')]({'where':{'id':_0x28ac42[_0xe195('0x3b')]['id']},'include':[{'model':db[_0xe195('0x3c')],'as':_0xe195('0x3d'),'include':[{'model':db[_0xe195('0x2f')],'as':_0xe195('0x3e'),'where':_0x4873be,'limit':0x1,'order':[[_0xe195('0x32'),'DESC']]}]},{'model':db[_0xe195('0x3f')],'as':_0xe195('0x40')},{'model':db[_0xe195('0x41')],'as':_0xe195('0x42')}]})[_0xe195('0x12')](function(_0x289782){if(_0x289782&&_0x289782[_0xe195('0x3d')]){var _0x30fe4b=_0x289782[_0xe195('0x43')]({'plain':!![]});_0x4028b6[_0xe195('0x3b')]=_[_0xe195('0x44')](_0x30fe4b,['Applications',_0xe195('0x3d')]);_0x4028b6['applications']=_0x30fe4b[_0xe195('0x40')];_0x4028b6[_0xe195('0x45')]=_0x30fe4b[_0xe195('0x3d')];_0x4028b6['applications']=_['orderBy'](_0x4028b6[_0xe195('0x46')],[_0xe195('0x47')],[_0xe195('0x48')]);if(_0x4028b6[_0xe195('0x3b')]&&_0x4028b6[_0xe195('0x3b')][_0xe195('0x49')]){_0x4028b6[_0xe195('0x46')][_0xe195('0x4a')]({'id':0x0,'priority':_0x4028b6[_0xe195('0x46')][_0xe195('0x4b')]+0x1,'app':_0xe195('0x4c'),'appdata':_0xe195('0x49'),'interval':_0xe195('0x4d')});}if(_0x4028b6[_0xe195('0x3b')][_0xe195('0x40')]){delete _0x4028b6[_0xe195('0x3b')][_0xe195('0x40')];}if(_0x4028b6[_0xe195('0x3b')][_0xe195('0x3d')]){delete _0x4028b6['account'][_0xe195('0x3d')];}if(_0x30fe4b[_0xe195('0x3d')][_0xe195('0x3e')][_0xe195('0x4b')]){return _0x30fe4b[_0xe195('0x3d')][_0xe195('0x3e')][0x0];}var _0x57ad8c=_['defaults'](_0x28ac42[_0xe195('0x2b')],{'firstName':_0x28ac42[_0xe195('0x2b')][_0xe195('0x3a')],'ListId':_0x30fe4b['ListId']});_0x57ad8c[_0x28ac42[_0xe195('0x2b')][_0xe195('0x36')]]=_0x28ac42['body'][_0xe195('0x3a')];return db[_0xe195('0x2f')]['create'](_0x57ad8c);}else{throw new Error(_0xe195('0x4e'));}})['then'](function(_0x368623){_0x4028b6[_0xe195('0x4f')]=_0x368623;if(_0x368623){if(!_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x50')]){_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['messageId']=rs[_0xe195('0x51')]()+'\x20'+_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x3a')];}var _0x2ff60c={'ContactId':_0x368623['id'],'MailAccountId':_0x28ac42[_0xe195('0x3b')]['id'],'inReplyTo':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x50')],'to':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x3a')],'cc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['cc'],'subject':_0x28ac42[_0xe195('0x2b')]['message'][_0xe195('0x52')],'attach':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x53')],'lastMsgAt':moment()[_0xe195('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x28ac42[_0xe195('0x2b')][_0xe195('0x2b')]};return db[_0xe195('0x55')][_0xe195('0x28')]({'where':{'closed':![],'MailAccountId':_0x28ac42[_0xe195('0x3b')]['id']},'include':[{'model':db[_0xe195('0x56')],'as':_0xe195('0x57'),'attributes':[_0xe195('0x50')],'where':{'messageId':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x58')]}}]})[_0xe195('0x12')](function(_0xa90491){if(_0xa90491){return[_0xa90491,![]];}return db[_0xe195('0x55')]['create'](_0x2ff60c)[_0xe195('0x12')](function(_0x57aa4b){return[_0x57aa4b,!![]];});});}else{throw new Error(_0xe195('0x59'));}})['spread'](function(_0x2f60d9,_0x28f0b2){if(_0x2f60d9){_0x2e732a=_0x28f0b2;if(!_0x28f0b2){return _0x2f60d9['update']({'inReplyTo':_0x28ac42['body'][_0xe195('0x19')][_0xe195('0x50')],'to':_0x28ac42['body'][_0xe195('0x19')][_0xe195('0x3a')],'cc':_0x28ac42['body'][_0xe195('0x19')]['cc'],'subject':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x52')],'attach':_0x2f60d9['attach']?_0x2f60d9['attach']:_0x28ac42['body'][_0xe195('0x19')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0xe195('0x5a')),'lastMsgAt':moment()[_0xe195('0x54')](_0xe195('0x5a')),'lastMsgDirection':'in','lastMsgBody':_0x28ac42['body']['body']});}else{return _0x2f60d9;}}})[_0xe195('0x12')](function(_0x46f1a2){_0x4028b6[_0xe195('0x5b')]=_0x46f1a2['get']({'plain':!![]});_0x4028b6[_0xe195('0x5b')][_0xe195('0x5c')]=_0x2e732a;return db[_0xe195('0x56')][_0xe195('0x5d')]({'body':_0x28ac42[_0xe195('0x2b')][_0xe195('0x2b')],'MailAccountId':_0x28ac42[_0xe195('0x3b')]['id'],'MailInteractionId':_0x46f1a2['id'],'direction':'in','ContactId':_0x4028b6[_0xe195('0x4f')]['id'],'messageId':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['messageId'],'from':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x3a')],'to':_0x28ac42[_0xe195('0x2b')]['message']['to'],'cc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['cc'],'subject':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x52')],'attach':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['attach'],'Attachments':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x5e')],'originTo':_0x28ac42[_0xe195('0x2b')]['message']['originTo'],'originCc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x5f')],'bcc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x60')]},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xe195('0x12')](function(_0x34a330){_0x4028b6[_0xe195('0x19')]=_0x34a330;if(_0x4028b6[_0xe195('0x5b')][_0xe195('0x61')]){return db[_0xe195('0x62')][_0xe195('0x28')]({'attributes':['id',_0xe195('0x63')],'where':{'id':_0x4028b6['interaction'][_0xe195('0x61')]}})[_0xe195('0x12')](function(_0x1bf3fa){if(_0x1bf3fa){_0x4028b6[_0xe195('0x46')][_0xe195('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1bf3fa[_0xe195('0x63')]+','+(_0x4028b6[_0xe195('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xe195('0x4d')});}return respondWithRpcPromise(_0xe195('0x65'),'startRouting',_0x4028b6);});}return respondWithRpcPromise(_0xe195('0x65'),_0xe195('0x66'),_0x4028b6);})['then'](function(_0x458f8b){_0x2b6bad(_0x458f8b);})[_0xe195('0x1c')](function(_0x15d24b){_0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0x15d24b[_0xe195('0x19')]));});});}; \ No newline at end of file +var _0x4d6e=['Contact\x20not\x20found','spread','format','interaction','MailMessage','attachments','originTo','bcc','Attachment','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','then','debug','ShowMailAccount','stringify','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','asc','autoclose','length','*,*,*,*','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo'];(function(_0x14743f,_0xbd44a5){var _0x5aa889=function(_0x47d613){while(--_0x47d613){_0x14743f['push'](_0x14743f['shift']());}};_0x5aa889(++_0xbd44a5);}(_0x4d6e,0x77));var _0xe4d6=function(_0x2e3210,_0x555b54){_0x2e3210=_0x2e3210-0x0;var _0x399fad=_0x4d6e[_0x2e3210];return _0x399fad;};'use strict';var _=require(_0xe4d6('0x0'));var util=require(_0xe4d6('0x1'));var moment=require(_0xe4d6('0x2'));var BPromise=require(_0xe4d6('0x3'));var rs=require(_0xe4d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4d6('0x5'))['db'];var utils=require(_0xe4d6('0x6'));var logger=require(_0xe4d6('0x7'))(_0xe4d6('0x8'));var config=require(_0xe4d6('0x9'));var jayson=require(_0xe4d6('0xa'));var client=jayson[_0xe4d6('0xb')][_0xe4d6('0xc')]({'port':0x232c});config[_0xe4d6('0xd')]=_[_0xe4d6('0xe')](config[_0xe4d6('0xd')],{'host':_0xe4d6('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4d6('0xd')]));require(_0xe4d6('0x10'))['register'](socket);function respondWithRpcPromise(_0x1cca29,_0x162a11,_0x782aa6){return new BPromise(function(_0xb27ad4,_0x2fb743){return client[_0xe4d6('0x11')](_0x1cca29,_0x782aa6)['then'](function(_0x4ca8b5){logger[_0xe4d6('0x12')](_0xe4d6('0x13'),_0x162a11,_0xe4d6('0x14'));logger['debug'](_0xe4d6('0x15'),_0x162a11,_0xe4d6('0x14'),JSON['stringify'](_0x4ca8b5));if(_0x4ca8b5[_0xe4d6('0x16')]){if(_0x4ca8b5[_0xe4d6('0x16')]['code']===0x1f4){logger[_0xe4d6('0x16')](_0xe4d6('0x13'),_0x162a11,_0x4ca8b5[_0xe4d6('0x16')][_0xe4d6('0x17')]);return _0x2fb743(_0x4ca8b5['error'][_0xe4d6('0x17')]);}logger[_0xe4d6('0x16')](_0xe4d6('0x13'),_0x162a11,_0x4ca8b5[_0xe4d6('0x16')]['message']);return _0xb27ad4(_0x4ca8b5[_0xe4d6('0x16')]['message']);}else{logger['info'](_0xe4d6('0x13'),_0x162a11,_0xe4d6('0x14'));_0xb27ad4(_0x4ca8b5[_0xe4d6('0x18')][_0xe4d6('0x17')]);}})[_0xe4d6('0x19')](function(_0x47e4bb){logger[_0xe4d6('0x16')](_0xe4d6('0x13'),_0x162a11,_0x47e4bb);_0x2fb743(_0x47e4bb);});});}exports[_0xe4d6('0x1a')]=function(_0x34f6bd){var _0x3895ed=this;return new Promise(function(_0x2fbefc,_0x26b9b6){return db[_0xe4d6('0x1b')]['findAll']({'raw':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd['options'][_0xe4d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd[_0xe4d6('0x1c')][_0xe4d6('0x1e')]||null:null,'attributes':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd[_0xe4d6('0x1c')][_0xe4d6('0x1f')]||null:null,'limit':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd['options'][_0xe4d6('0x20')]||null:null,'include':_0x34f6bd[_0xe4d6('0x1c')]?_0x34f6bd['options'][_0xe4d6('0x21')]?_[_0xe4d6('0x22')](_0x34f6bd[_0xe4d6('0x1c')][_0xe4d6('0x21')],function(_0x13aeec){return{'model':db[_0x13aeec[_0xe4d6('0x23')]],'as':_0x13aeec['as'],'attributes':_0x13aeec[_0xe4d6('0x1f')],'include':_0x13aeec[_0xe4d6('0x21')]?_['map'](_0x13aeec[_0xe4d6('0x21')],function(_0x152d16){return{'model':db[_0x152d16['model']],'as':_0x152d16['as'],'attributes':_0x152d16['attributes'],'include':_0x152d16['include']?_[_0xe4d6('0x22')](_0x152d16['include'],function(_0x3d2efe){return{'model':db[_0x3d2efe['model']],'as':_0x3d2efe['as'],'attributes':_0x3d2efe['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4d6('0x24')](function(_0x4e45f0){logger['info'](_0xe4d6('0x1a'),_0x34f6bd);logger[_0xe4d6('0x25')]('GetMailAccount',_0x34f6bd,JSON['stringify'](_0x4e45f0));_0x2fbefc(_0x4e45f0);})[_0xe4d6('0x19')](function(_0x4077c1){logger['error'](_0xe4d6('0x1a'),_0x4077c1[_0xe4d6('0x17')],_0x34f6bd);_0x26b9b6(_0x3895ed[_0xe4d6('0x16')](0x1f4,_0x4077c1[_0xe4d6('0x17')]));});});};exports[_0xe4d6('0x26')]=function(_0x17e467){var _0x48cf65=this;return new Promise(function(_0x562070,_0x9b089b){return db[_0xe4d6('0x1b')]['find']({'raw':_0x17e467[_0xe4d6('0x1c')]?_0x17e467['options'][_0xe4d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x17e467['options']?_0x17e467['options'][_0xe4d6('0x1e')]||null:null,'attributes':_0x17e467['options']?_0x17e467['options'][_0xe4d6('0x1f')]||null:null,'include':_0x17e467[_0xe4d6('0x1c')]?_0x17e467[_0xe4d6('0x1c')][_0xe4d6('0x21')]?_['map'](_0x17e467[_0xe4d6('0x1c')][_0xe4d6('0x21')],function(_0x822a27){return{'model':db[_0x822a27[_0xe4d6('0x23')]],'as':_0x822a27['as'],'attributes':_0x822a27[_0xe4d6('0x1f')],'include':_0x822a27[_0xe4d6('0x21')]?_[_0xe4d6('0x22')](_0x822a27[_0xe4d6('0x21')],function(_0x28e423){return{'model':db[_0x28e423[_0xe4d6('0x23')]],'as':_0x28e423['as'],'attributes':_0x28e423['attributes'],'include':_0x28e423[_0xe4d6('0x21')]?_['map'](_0x28e423[_0xe4d6('0x21')],function(_0x36c147){return{'model':db[_0x36c147[_0xe4d6('0x23')]],'as':_0x36c147['as'],'attributes':_0x36c147[_0xe4d6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x483121){logger[_0xe4d6('0x12')](_0xe4d6('0x26'),_0x17e467);logger[_0xe4d6('0x25')](_0xe4d6('0x26'),_0x17e467,JSON[_0xe4d6('0x27')](_0x483121));_0x562070(_0x483121);})[_0xe4d6('0x19')](function(_0x2c57c2){logger['error'](_0xe4d6('0x26'),_0x2c57c2[_0xe4d6('0x17')],_0x17e467);_0x9b089b(_0x48cf65['error'](0x1f4,_0x2c57c2['message']));});});};exports[_0xe4d6('0x28')]=function(_0x1b8c4b){var _0x4950cf=this;return new Promise(function(_0x1a577f,_0x35054f){var _0x310419={'body':_0x1b8c4b[_0xe4d6('0x29')],'channel':'mail'};var _0x3c0f11=_[_0xe4d6('0x2a')](_[_0xe4d6('0x2b')](db[_0xe4d6('0x2c')][_0xe4d6('0x2d')]),[_0xe4d6('0x2e'),'updatedAt','CompanyId','ListId']);var _0x551789=![];if(_0x1b8c4b[_0xe4d6('0x29')]['id']){delete _0x1b8c4b[_0xe4d6('0x29')]['id'];}if(_[_0xe4d6('0x2f')](_0x1b8c4b['body'][_0xe4d6('0x30')])){return _0x35054f(_0x4950cf['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe4d6('0x2f')](_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x29')])||_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x29')]===''){return _0x35054f(_0x4950cf[_0xe4d6('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe4d6('0x2f')](_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x31')])){return _0x35054f(_0x4950cf[_0xe4d6('0x16')](0x1f4,_0xe4d6('0x32')+_0x3c0f11));}if(!_[_0xe4d6('0x33')](_0x3c0f11,_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x31')])){return _0x35054f(_0x4950cf['error'](0x1f4,_0xe4d6('0x34')+_0x3c0f11));}var _0x38ceca={};_0x38ceca[_0x1b8c4b[_0xe4d6('0x29')]['mapKey']]=_0x1b8c4b['body'][_0xe4d6('0x30')];return db[_0xe4d6('0x1b')][_0xe4d6('0x35')]({'where':{'id':_0x1b8c4b[_0xe4d6('0x36')]['id']},'include':[{'model':db[_0xe4d6('0x37')],'as':_0xe4d6('0x38'),'include':[{'model':db[_0xe4d6('0x2c')],'as':_0xe4d6('0x39'),'where':_0x38ceca,'limit':0x1,'order':[[_0xe4d6('0x3a'),_0xe4d6('0x3b')]]}]},{'model':db[_0xe4d6('0x3c')],'as':_0xe4d6('0x3d')},{'model':db[_0xe4d6('0x3e')],'as':_0xe4d6('0x3f')}]})[_0xe4d6('0x24')](function(_0x179eec){if(_0x179eec&&_0x179eec['List']){var _0x1bbd16=_0x179eec[_0xe4d6('0x40')]({'plain':!![]});_0x310419['account']=_[_0xe4d6('0x41')](_0x1bbd16,['Applications',_0xe4d6('0x38')]);_0x310419[_0xe4d6('0x42')]=_0x1bbd16['Applications'];_0x310419[_0xe4d6('0x43')]=_0x1bbd16['List'];_0x310419['applications']=_[_0xe4d6('0x44')](_0x310419[_0xe4d6('0x42')],['priority'],[_0xe4d6('0x45')]);if(_0x310419[_0xe4d6('0x36')]&&_0x310419[_0xe4d6('0x36')][_0xe4d6('0x46')]){_0x310419[_0xe4d6('0x42')]['push']({'id':0x0,'priority':_0x310419[_0xe4d6('0x42')][_0xe4d6('0x47')]+0x1,'app':'close','appdata':'autoclose','interval':_0xe4d6('0x48')});}if(_0x310419[_0xe4d6('0x36')][_0xe4d6('0x3d')]){delete _0x310419['account'][_0xe4d6('0x3d')];}if(_0x310419[_0xe4d6('0x36')][_0xe4d6('0x38')]){delete _0x310419[_0xe4d6('0x36')][_0xe4d6('0x38')];}if(_0x1bbd16['List'][_0xe4d6('0x39')][_0xe4d6('0x47')]){return _0x1bbd16[_0xe4d6('0x38')][_0xe4d6('0x39')][0x0];}var _0x38a427=_['defaults'](_0x1b8c4b[_0xe4d6('0x29')],{'firstName':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x30')],'ListId':_0x1bbd16[_0xe4d6('0x49')]});_0x38a427[_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x31')]]=_0x1b8c4b['body'][_0xe4d6('0x30')];return db[_0xe4d6('0x2c')][_0xe4d6('0x4a')](_0x38a427);}else{throw new Error(_0xe4d6('0x4b'));}})[_0xe4d6('0x24')](function(_0x34731b){_0x310419[_0xe4d6('0x4c')]=_0x34731b;if(_0x34731b){if(!_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4d')]){_0x1b8c4b[_0xe4d6('0x29')]['message'][_0xe4d6('0x4d')]=rs[_0xe4d6('0x4e')]()+'\x20'+_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x30')];}var _0x7596e8={'ContactId':_0x34731b['id'],'MailAccountId':_0x1b8c4b['account']['id'],'inReplyTo':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x4d')],'to':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['from'],'cc':_0x1b8c4b['body'][_0xe4d6('0x17')]['cc'],'subject':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4f')],'attach':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x50')],'lastMsgAt':moment()['format'](_0xe4d6('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x1b8c4b['body'][_0xe4d6('0x29')]};return db[_0xe4d6('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x1b8c4b[_0xe4d6('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':_0xe4d6('0x53'),'attributes':[_0xe4d6('0x4d')],'where':{'messageId':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x54')]}}]})[_0xe4d6('0x24')](function(_0x49df65){if(_0x49df65){return[_0x49df65,![]];}return db['MailInteraction']['create'](_0x7596e8)[_0xe4d6('0x24')](function(_0x40d488){return[_0x40d488,!![]];});});}else{throw new Error(_0xe4d6('0x55'));}})[_0xe4d6('0x56')](function(_0xe54334,_0x2f3c19){if(_0xe54334){_0x551789=_0x2f3c19;if(!_0x2f3c19){return _0xe54334['update']({'inReplyTo':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4d')],'to':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x30')],'cc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['cc'],'subject':_0x1b8c4b[_0xe4d6('0x29')]['message']['subject'],'attach':_0xe54334[_0xe4d6('0x50')]?_0xe54334[_0xe4d6('0x50')]:_0x1b8c4b['body']['message'][_0xe4d6('0x50')],'substatus':null,'substatusAt':moment()[_0xe4d6('0x57')](_0xe4d6('0x51')),'lastMsgAt':moment()[_0xe4d6('0x57')](_0xe4d6('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x1b8c4b['body'][_0xe4d6('0x29')]});}else{return _0xe54334;}}})[_0xe4d6('0x24')](function(_0x349b56){_0x310419[_0xe4d6('0x58')]=_0x349b56[_0xe4d6('0x40')]({'plain':!![]});_0x310419[_0xe4d6('0x58')]['created']=_0x551789;return db[_0xe4d6('0x59')]['create']({'body':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x29')],'MailAccountId':_0x1b8c4b[_0xe4d6('0x36')]['id'],'MailInteractionId':_0x349b56['id'],'direction':'in','ContactId':_0x310419[_0xe4d6('0x4c')]['id'],'messageId':_0x1b8c4b['body'][_0xe4d6('0x17')][_0xe4d6('0x4d')],'from':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['from'],'to':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['to'],'cc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['cc'],'subject':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x4f')],'attach':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x50')],'Attachments':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x5a')],'originTo':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x5b')],'originCc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')]['originCc'],'bcc':_0x1b8c4b[_0xe4d6('0x29')][_0xe4d6('0x17')][_0xe4d6('0x5c')]},{'include':[{'model':db[_0xe4d6('0x5d')],'as':'Attachments'}]});})[_0xe4d6('0x24')](function(_0x36a77f){_0x310419[_0xe4d6('0x17')]=_0x36a77f;if(_0x310419['interaction']['UserId']){return db[_0xe4d6('0x5e')]['find']({'attributes':['id',_0xe4d6('0x5f')],'where':{'id':_0x310419[_0xe4d6('0x58')][_0xe4d6('0x60')]}})['then'](function(_0x2357ba){if(_0x2357ba){_0x310419[_0xe4d6('0x42')][_0xe4d6('0x61')]({'id':0x0,'priority':0x0,'app':_0xe4d6('0x62'),'appdata':_0x2357ba[_0xe4d6('0x5f')]+','+(_0x310419[_0xe4d6('0x36')][_0xe4d6('0x63')]||0xa),'interval':_0xe4d6('0x48')});}return respondWithRpcPromise(_0xe4d6('0x64'),_0xe4d6('0x65'),_0x310419);});}return respondWithRpcPromise(_0xe4d6('0x64'),'startRouting',_0x310419);})[_0xe4d6('0x24')](function(_0x52686a){_0x1a577f(_0x52686a);})[_0xe4d6('0x19')](function(_0x5dfb3b){_0x35054f(_0x4950cf[_0xe4d6('0x16')](0x1f4,_0x5dfb3b[_0xe4d6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 689d244..efab912 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 _0x496e=['register','length','mailAccount:','save','remove','update','removeListener'];(function(_0x56410f,_0xd93c15){var _0x520c0c=function(_0x34b014){while(--_0x34b014){_0x56410f['push'](_0x56410f['shift']());}};_0x520c0c(++_0xd93c15);}(_0x496e,0x1a0));var _0xe496=function(_0xbafddc,_0x4c078f){_0xbafddc=_0xbafddc-0x0;var _0x4332a4=_0x496e[_0xbafddc];return _0x4332a4;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe496('0x0'),_0xe496('0x1'),_0xe496('0x2')];function createListener(_0x42947d,_0x4b3145){return function(_0x5ed541){_0x4b3145['emit'](_0x42947d,_0x5ed541);};}function removeListener(_0x1daba1,_0x509847){return function(){MailAccountEvents[_0xe496('0x3')](_0x1daba1,_0x509847);};}exports[_0xe496('0x4')]=function(_0x1fc796){for(var _0x178897=0x0,_0x2ba6bf=events[_0xe496('0x5')];_0x178897<_0x2ba6bf;_0x178897++){var _0x19970b=events[_0x178897];var _0x42b1b6=createListener(_0xe496('0x6')+_0x19970b,_0x1fc796);MailAccountEvents['on'](_0x19970b,_0x42b1b6);}}; \ No newline at end of file +var _0xd9ce=['update','emit','removeListener','register','./mailAccount.events','save','remove'];(function(_0x579121,_0x27e9e2){var _0x38a4ae=function(_0x53e154){while(--_0x53e154){_0x579121['push'](_0x579121['shift']());}};_0x38a4ae(++_0x27e9e2);}(_0xd9ce,0xeb));var _0xed9c=function(_0x482815,_0x3601b1){_0x482815=_0x482815-0x0;var _0x272d11=_0xd9ce[_0x482815];return _0x272d11;};'use strict';var MailAccountEvents=require(_0xed9c('0x0'));var events=[_0xed9c('0x1'),_0xed9c('0x2'),_0xed9c('0x3')];function createListener(_0x3892c2,_0x2008a1){return function(_0x1aa913){_0x2008a1[_0xed9c('0x4')](_0x3892c2,_0x1aa913);};}function removeListener(_0x5903b6,_0x3c9c4a){return function(){MailAccountEvents[_0xed9c('0x5')](_0x5903b6,_0x3c9c4a);};}exports[_0xed9c('0x6')]=function(_0x154e9d){for(var _0x3043a6=0x0,_0x434898=events['length'];_0x3043a6<_0x434898;_0x3043a6++){var _0x2ad757=events[_0x3043a6];var _0xde32e4=createListener('mailAccount:'+_0x2ad757,_0x154e9d);MailAccountEvents['on'](_0x2ad757,_0xde32e4);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 20eeb02..857434a 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 _0x0fd9=['./mailApplication.controller','get','/:id','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x3cf6a3,_0xc502f9){var _0x26c993=function(_0x34844f){while(--_0x34844f){_0x3cf6a3['push'](_0x3cf6a3['shift']());}};_0x26c993(++_0xc502f9);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x0fd9[_0x1b76e6];return _0x333b53;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x90fd('0x4'));var config=require(_0x90fd('0x5'));var controller=require(_0x90fd('0x6'));router[_0x90fd('0x7')](_0x90fd('0x8'),auth[_0x90fd('0x9')](),controller['show']);router['put'](_0x90fd('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x90fd('0xa')](_0x90fd('0x8'),auth['isAuthenticated'](),controller[_0x90fd('0xb')]);module[_0x90fd('0xc')]=router; \ No newline at end of file +var _0xbf6e=['get','/:id','isAuthenticated','show','put','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x44a02f,_0x34aa73){var _0x5d1d8f=function(_0x5eb7b8){while(--_0x5eb7b8){_0x44a02f['push'](_0x44a02f['shift']());}};_0x5d1d8f(++_0x34aa73);}(_0xbf6e,0x149));var _0xebf6=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xbf6e[_0x16b1a5];return _0x475e25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var auth=require(_0xebf6('0x4'));var interaction=require(_0xebf6('0x5'));var config=require(_0xebf6('0x6'));var controller=require('./mailApplication.controller');router[_0xebf6('0x7')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0xb')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller['update']);router[_0xebf6('0xc')](_0xebf6('0x8'),auth[_0xebf6('0x9')](),controller['destroy']);module[_0xebf6('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b516104..9303210 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 _0x722f=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x18c8b5,_0x2a15d3){var _0x358984=function(_0xf5461){while(--_0xf5461){_0x18c8b5['push'](_0x18c8b5['shift']());}};_0x358984(++_0x2a15d3);}(_0x722f,0x75));var _0xf722=function(_0x5281c2,_0x124b85){_0x5281c2=_0x5281c2-0x0;var _0x296b51=_0x722f[_0x5281c2];return _0x296b51;};'use strict';var Sequelize=require(_0xf722('0x0'));module[_0xf722('0x1')]={'priority':{'type':Sequelize[_0xf722('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf722('0x3')],'allowNull':![],'defaultValue':_0xf722('0x4')},'appdata':{'type':Sequelize[_0xf722('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf722('0x3')],'defaultValue':_0xf722('0x6')}}; \ No newline at end of file +var _0x13dd=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x2b0690,_0x4f742f){var _0x82be1=function(_0x1e1084){while(--_0x1e1084){_0x2b0690['push'](_0x2b0690['shift']());}};_0x82be1(++_0x4f742f);}(_0x13dd,0x84));var _0xd13d=function(_0x136d95,_0x353962){_0x136d95=_0x136d95-0x0;var _0x5c2bd9=_0x13dd[_0x136d95];return _0x5c2bd9;};'use strict';var Sequelize=require(_0xd13d('0x0'));module[_0xd13d('0x1')]={'priority':{'type':Sequelize[_0xd13d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd13d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd13d('0x4')],'defaultValue':_0xd13d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7ef9a4b..eb8797f 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 _0xb632=['error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','update','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','destroy'];(function(_0x3e630a,_0x507613){var _0xca5993=function(_0x167f79){while(--_0x167f79){_0x3e630a['push'](_0x3e630a['shift']());}};_0xca5993(++_0x507613);}(_0xb632,0x1a7));var _0x2b63=function(_0x16773c,_0x18b870){_0x16773c=_0x16773c-0x0;var _0x29ca30=_0xb632[_0x16773c];return _0x29ca30;};'use strict';var pdf=require(_0x2b63('0x0'));var emlformat=require(_0x2b63('0x1'));var rimraf=require(_0x2b63('0x2'));var zipdir=require(_0x2b63('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b63('0x4'));var BPromise=require(_0x2b63('0x5'));var Mustache=require(_0x2b63('0x6'));var util=require(_0x2b63('0x7'));var path=require('path');var sox=require(_0x2b63('0x8'));var csv=require(_0x2b63('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2b63('0xa'));var squel=require(_0x2b63('0xb'));var crypto=require(_0x2b63('0xc'));var jsforce=require(_0x2b63('0xd'));var deskjs=require(_0x2b63('0xe'));var toCsv=require(_0x2b63('0x9'));var querystring=require(_0x2b63('0xf'));var Papa=require(_0x2b63('0x10'));var Redis=require(_0x2b63('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b63('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2b63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2b63('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20988e,_0x2a74bd){_0x2a74bd=_0x2a74bd||0xcc;return function(_0x26a22d){if(_0x26a22d){return _0x20988e[_0x2b63('0x15')](_0x2a74bd);}return _0x20988e[_0x2b63('0x16')](_0x2a74bd)[_0x2b63('0x17')]();};}function respondWithResult(_0x2ab71a,_0x164636){_0x164636=_0x164636||0xc8;return function(_0x213e1f){if(_0x213e1f){return _0x2ab71a['status'](_0x164636)[_0x2b63('0x18')](_0x213e1f);}};}function respondWithFilteredResult(_0x4ba8fa,_0x57778f){return function(_0x411446){if(_0x411446){var _0x2f512f=_0x411446[_0x2b63('0x19')],_0x3743c3=_0x57778f['offset'],_0x2c5a0f=_0x57778f[_0x2b63('0x1a')]+_0x57778f[_0x2b63('0x1b')],_0x5da348;if(_0x2c5a0f>=_0x2f512f){_0x2c5a0f=_0x2f512f;_0x5da348=0xc8;}else{_0x5da348=0xce;}_0x4ba8fa[_0x2b63('0x16')](_0x5da348);return _0x4ba8fa[_0x2b63('0x1c')]('Content-Range',_0x3743c3+'-'+_0x2c5a0f+'/'+_0x2f512f)[_0x2b63('0x18')](_0x411446);}return null;};}function patchUpdates(_0x173978){return function(_0xe8893f){try{jsonpatch['apply'](_0xe8893f,_0x173978,!![]);}catch(_0x66408){return BPromise[_0x2b63('0x1d')](_0x66408);}return _0xe8893f[_0x2b63('0x1e')]();};}function saveUpdates(_0x109e06,_0x52473d){return function(_0x43267e){if(_0x43267e){return _0x43267e['update'](_0x109e06)[_0x2b63('0x1f')](function(_0x449576){return _0x449576;});}return null;};}function removeEntity(_0x39b774,_0x2470e7){return function(_0x169296){if(_0x169296){return _0x169296[_0x2b63('0x20')]()[_0x2b63('0x1f')](function(){_0x39b774[_0x2b63('0x16')](0xcc)[_0x2b63('0x17')]();});}};}function handleEntityNotFound(_0x25ea36,_0x2b4e3a){return function(_0x1c4e18){if(!_0x1c4e18){_0x25ea36[_0x2b63('0x15')](0x194);}return _0x1c4e18;};}function handleError(_0x1a14cc,_0x19ddb5){_0x19ddb5=_0x19ddb5||0x1f4;return function(_0x5937f5){logger[_0x2b63('0x21')](_0x5937f5[_0x2b63('0x22')]);if(_0x5937f5[_0x2b63('0x23')]){delete _0x5937f5['name'];}_0x1a14cc['status'](_0x19ddb5)[_0x2b63('0x24')](_0x5937f5);};}exports[_0x2b63('0x25')]=function(_0x2921cf,_0x391cc5){var _0x51aee4={'raw':!![],'where':{'id':_0x2921cf[_0x2b63('0x26')]['id']}},_0x54b67b={};_0x54b67b[_0x2b63('0x27')]=_[_0x2b63('0x28')](db[_0x2b63('0x29')][_0x2b63('0x2a')]);_0x54b67b['query']=_[_0x2b63('0x28')](_0x2921cf[_0x2b63('0x2b')]);_0x54b67b[_0x2b63('0x2c')]=_[_0x2b63('0x2d')](_0x54b67b['model'],_0x54b67b[_0x2b63('0x2b')]);_0x51aee4['attributes']=_['intersection'](_0x54b67b[_0x2b63('0x27')],qs[_0x2b63('0x2e')](_0x2921cf['query'][_0x2b63('0x2e')]));_0x51aee4[_0x2b63('0x2f')]=_0x51aee4[_0x2b63('0x2f')][_0x2b63('0x30')]?_0x51aee4[_0x2b63('0x2f')]:_0x54b67b['model'];if(_0x2921cf[_0x2b63('0x2b')][_0x2b63('0x31')]){_0x51aee4[_0x2b63('0x32')]=[{'all':!![]}];}_0x51aee4=_[_0x2b63('0x33')]({},_0x51aee4,_0x2921cf[_0x2b63('0x34')]);return db[_0x2b63('0x29')][_0x2b63('0x35')](_0x51aee4)[_0x2b63('0x1f')](handleEntityNotFound(_0x391cc5,null))[_0x2b63('0x1f')](respondWithResult(_0x391cc5,null))[_0x2b63('0x36')](handleError(_0x391cc5,null));};exports[_0x2b63('0x37')]=function(_0x30d4b5,_0xe4798f){if(_0x30d4b5['body']['id']){delete _0x30d4b5[_0x2b63('0x38')]['id'];}return db[_0x2b63('0x29')][_0x2b63('0x35')]({'where':{'id':_0x30d4b5[_0x2b63('0x26')]['id']}})[_0x2b63('0x1f')](handleEntityNotFound(_0xe4798f,null))[_0x2b63('0x1f')](saveUpdates(_0x30d4b5['body'],null))['then'](respondWithResult(_0xe4798f,null))['catch'](handleError(_0xe4798f,null));};exports[_0x2b63('0x20')]=function(_0x337e38,_0x4e579c){return db[_0x2b63('0x29')][_0x2b63('0x35')]({'where':{'id':_0x337e38[_0x2b63('0x26')]['id']}})[_0x2b63('0x1f')](handleEntityNotFound(_0x4e579c,null))[_0x2b63('0x1f')](removeEntity(_0x4e579c,null))[_0x2b63('0x36')](handleError(_0x4e579c,null));}; \ No newline at end of file +var _0xb0ff=['status','end','json','count','offset','limit','set','apply','update','then','error','name','send','params','model','rawAttributes','query','keys','intersection','attributes','fields','length','include','merge','MailApplication','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3fd531,_0x538738){var _0x5bd9db=function(_0x676411){while(--_0x676411){_0x3fd531['push'](_0x3fd531['shift']());}};_0x5bd9db(++_0x538738);}(_0xb0ff,0xb8));var _0xfb0f=function(_0x3f9043,_0x1b5407){_0x3f9043=_0x3f9043-0x0;var _0x24b935=_0xb0ff[_0x3f9043];return _0x24b935;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfb0f('0x0'));var zipdir=require(_0xfb0f('0x1'));var jsonpatch=require(_0xfb0f('0x2'));var rp=require(_0xfb0f('0x3'));var moment=require(_0xfb0f('0x4'));var BPromise=require(_0xfb0f('0x5'));var Mustache=require('mustache');var util=require(_0xfb0f('0x6'));var path=require(_0xfb0f('0x7'));var sox=require(_0xfb0f('0x8'));var csv=require(_0xfb0f('0x9'));var ejs=require(_0xfb0f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfb0f('0xb'));var crypto=require(_0xfb0f('0xc'));var jsforce=require(_0xfb0f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfb0f('0x9'));var querystring=require('querystring');var Papa=require(_0xfb0f('0xe'));var Redis=require(_0xfb0f('0xf'));var authService=require(_0xfb0f('0x10'));var qs=require(_0xfb0f('0x11'));var as=require(_0xfb0f('0x12'));var hardwareService=require(_0xfb0f('0x13'));var logger=require('../../config/logger')(_0xfb0f('0x14'));var utils=require('../../config/utils');var config=require(_0xfb0f('0x15'));var licenseUtil=require(_0xfb0f('0x16'));var db=require(_0xfb0f('0x17'))['db'];function respondWithStatusCode(_0x246540,_0x333934){_0x333934=_0x333934||0xcc;return function(_0x1c4964){if(_0x1c4964){return _0x246540['sendStatus'](_0x333934);}return _0x246540[_0xfb0f('0x18')](_0x333934)[_0xfb0f('0x19')]();};}function respondWithResult(_0x43339f,_0x5c4b3e){_0x5c4b3e=_0x5c4b3e||0xc8;return function(_0x5e30bd){if(_0x5e30bd){return _0x43339f[_0xfb0f('0x18')](_0x5c4b3e)[_0xfb0f('0x1a')](_0x5e30bd);}};}function respondWithFilteredResult(_0x3ce79a,_0x678832){return function(_0xc62ec4){if(_0xc62ec4){var _0x31d69a=_0xc62ec4[_0xfb0f('0x1b')],_0x1e765b=_0x678832[_0xfb0f('0x1c')],_0x4847cb=_0x678832[_0xfb0f('0x1c')]+_0x678832[_0xfb0f('0x1d')],_0xa65bec;if(_0x4847cb>=_0x31d69a){_0x4847cb=_0x31d69a;_0xa65bec=0xc8;}else{_0xa65bec=0xce;}_0x3ce79a[_0xfb0f('0x18')](_0xa65bec);return _0x3ce79a[_0xfb0f('0x1e')]('Content-Range',_0x1e765b+'-'+_0x4847cb+'/'+_0x31d69a)['json'](_0xc62ec4);}return null;};}function patchUpdates(_0x167dd1){return function(_0x2ccbb6){try{jsonpatch[_0xfb0f('0x1f')](_0x2ccbb6,_0x167dd1,!![]);}catch(_0x5d8f1a){return BPromise['reject'](_0x5d8f1a);}return _0x2ccbb6['save']();};}function saveUpdates(_0x103bdf,_0x500859){return function(_0xb79ab4){if(_0xb79ab4){return _0xb79ab4[_0xfb0f('0x20')](_0x103bdf)[_0xfb0f('0x21')](function(_0x4eaa2a){return _0x4eaa2a;});}return null;};}function removeEntity(_0x26103f,_0x2d6405){return function(_0x3d7e6a){if(_0x3d7e6a){return _0x3d7e6a['destroy']()['then'](function(){_0x26103f[_0xfb0f('0x18')](0xcc)[_0xfb0f('0x19')]();});}};}function handleEntityNotFound(_0x806198,_0x3b31dd){return function(_0x4a4965){if(!_0x4a4965){_0x806198['sendStatus'](0x194);}return _0x4a4965;};}function handleError(_0x3ff5fe,_0x18c41d){_0x18c41d=_0x18c41d||0x1f4;return function(_0x1be29e){logger[_0xfb0f('0x22')](_0x1be29e['stack']);if(_0x1be29e[_0xfb0f('0x23')]){delete _0x1be29e[_0xfb0f('0x23')];}_0x3ff5fe[_0xfb0f('0x18')](_0x18c41d)[_0xfb0f('0x24')](_0x1be29e);};}exports['show']=function(_0x221c22,_0xfb5b38){var _0x11065c={'raw':!![],'where':{'id':_0x221c22[_0xfb0f('0x25')]['id']}},_0xb40e54={};_0xb40e54[_0xfb0f('0x26')]=_['keys'](db['MailApplication'][_0xfb0f('0x27')]);_0xb40e54[_0xfb0f('0x28')]=_[_0xfb0f('0x29')](_0x221c22[_0xfb0f('0x28')]);_0xb40e54['filters']=_[_0xfb0f('0x2a')](_0xb40e54[_0xfb0f('0x26')],_0xb40e54['query']);_0x11065c[_0xfb0f('0x2b')]=_[_0xfb0f('0x2a')](_0xb40e54[_0xfb0f('0x26')],qs[_0xfb0f('0x2c')](_0x221c22[_0xfb0f('0x28')][_0xfb0f('0x2c')]));_0x11065c[_0xfb0f('0x2b')]=_0x11065c[_0xfb0f('0x2b')][_0xfb0f('0x2d')]?_0x11065c[_0xfb0f('0x2b')]:_0xb40e54[_0xfb0f('0x26')];if(_0x221c22['query']['includeAll']){_0x11065c[_0xfb0f('0x2e')]=[{'all':!![]}];}_0x11065c=_[_0xfb0f('0x2f')]({},_0x11065c,_0x221c22['options']);return db[_0xfb0f('0x30')][_0xfb0f('0x31')](_0x11065c)[_0xfb0f('0x21')](handleEntityNotFound(_0xfb5b38,null))[_0xfb0f('0x21')](respondWithResult(_0xfb5b38,null))[_0xfb0f('0x32')](handleError(_0xfb5b38,null));};exports[_0xfb0f('0x20')]=function(_0x13257e,_0x545ade){if(_0x13257e[_0xfb0f('0x33')]['id']){delete _0x13257e[_0xfb0f('0x33')]['id'];}return db[_0xfb0f('0x30')][_0xfb0f('0x31')]({'where':{'id':_0x13257e[_0xfb0f('0x25')]['id']}})['then'](handleEntityNotFound(_0x545ade,null))[_0xfb0f('0x21')](saveUpdates(_0x13257e[_0xfb0f('0x33')],null))[_0xfb0f('0x21')](respondWithResult(_0x545ade,null))[_0xfb0f('0x32')](handleError(_0x545ade,null));};exports['destroy']=function(_0x53da36,_0x15b316){return db[_0xfb0f('0x30')][_0xfb0f('0x31')]({'where':{'id':_0x53da36[_0xfb0f('0x25')]['id']}})[_0xfb0f('0x21')](handleEntityNotFound(_0x15b316,null))[_0xfb0f('0x21')](removeEntity(_0x15b316,null))[_0xfb0f('0x32')](handleError(_0x15b316,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 623e518..02716b6 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 _0x9c1d=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./mailApplication.attributes','exports'];(function(_0x5ddd8d,_0x495d09){var _0x453514=function(_0x5e2541){while(--_0x5e2541){_0x5ddd8d['push'](_0x5ddd8d['shift']());}};_0x453514(++_0x495d09);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x2a7580,_0x168f12){_0x2a7580=_0x2a7580-0x0;var _0x1ab265=_0x9c1d[_0x2a7580];return _0x1ab265;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var logger=require(_0xd9c1('0x2'))('api');var moment=require(_0xd9c1('0x3'));var BPromise=require(_0xd9c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9c1('0x5'));var rimraf=require(_0xd9c1('0x6'));var config=require('../../config/environment');var attributes=require(_0xd9c1('0x7'));module[_0xd9c1('0x8')]=function(_0x206639,_0x29840f){return _0x206639[_0xd9c1('0x9')](_0xd9c1('0xa'),attributes,{'tableName':_0xd9c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9c1('0xc'),'collate':_0xd9c1('0xd')});}; \ No newline at end of file +var _0x01a6=['rimraf','./mailApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01a6,0x162));var _0x601a=function(_0x39fb98,_0x3fcd7b){_0x39fb98=_0x39fb98-0x0;var _0x5062eb=_0x01a6[_0x39fb98];return _0x5062eb;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var logger=require(_0x601a('0x1'))(_0x601a('0x2'));var moment=require(_0x601a('0x3'));var BPromise=require(_0x601a('0x4'));var rp=require(_0x601a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x601a('0x6'));var config=require('../../config/environment');var attributes=require(_0x601a('0x7'));module[_0x601a('0x8')]=function(_0x30df8c,_0x196c77){return _0x30df8c[_0x601a('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x601a('0xa'),'collate':_0x601a('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index aeca465..329d1d1 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 _0xac65=['jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x38495a,_0x15aea2){var _0x1322dd=function(_0x43c4b0){while(--_0x43c4b0){_0x38495a['push'](_0x38495a['shift']());}};_0x1322dd(++_0x15aea2);}(_0xac65,0x123));var _0x5ac6=function(_0x441c24,_0x57749d){_0x441c24=_0x441c24-0x0;var _0xddbb42=_0xac65[_0x441c24];return _0xddbb42;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var moment=require(_0x5ac6('0x2'));var BPromise=require(_0x5ac6('0x3'));var rs=require(_0x5ac6('0x4'));var fs=require('fs');var Redis=require(_0x5ac6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ac6('0x6'));var logger=require(_0x5ac6('0x7'))(_0x5ac6('0x8'));var config=require('../../config/environment');var jayson=require(_0x5ac6('0x9'));var client=jayson[_0x5ac6('0xa')][_0x5ac6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52a27f,_0x4b3f02,_0x513202){return new BPromise(function(_0x5c9519,_0x67cca3){return client[_0x5ac6('0xc')](_0x52a27f,_0x513202)[_0x5ac6('0xd')](function(_0x331af){logger[_0x5ac6('0xe')](_0x5ac6('0xf'),_0x4b3f02,_0x5ac6('0x10'));logger['debug'](_0x5ac6('0x11'),_0x4b3f02,'request\x20sent',JSON[_0x5ac6('0x12')](_0x331af));if(_0x331af[_0x5ac6('0x13')]){if(_0x331af[_0x5ac6('0x13')][_0x5ac6('0x14')]===0x1f4){logger[_0x5ac6('0x13')](_0x5ac6('0xf'),_0x4b3f02,_0x331af[_0x5ac6('0x13')]['message']);return _0x67cca3(_0x331af['error'][_0x5ac6('0x15')]);}logger[_0x5ac6('0x13')](_0x5ac6('0xf'),_0x4b3f02,_0x331af[_0x5ac6('0x13')][_0x5ac6('0x15')]);return _0x5c9519(_0x331af[_0x5ac6('0x13')][_0x5ac6('0x15')]);}else{logger['info'](_0x5ac6('0xf'),_0x4b3f02,_0x5ac6('0x10'));_0x5c9519(_0x331af[_0x5ac6('0x16')][_0x5ac6('0x15')]);}})[_0x5ac6('0x17')](function(_0x5ab486){logger[_0x5ac6('0x13')](_0x5ac6('0xf'),_0x4b3f02,_0x5ab486);_0x67cca3(_0x5ab486);});});}exports['UpdateMailApplication']=function(_0xea410f){var _0x26b77b=this;return new Promise(function(_0x5ec8bc,_0x2c2fb6){return db['MailApplication']['update'](_0xea410f[_0x5ac6('0x18')],{'raw':_0xea410f[_0x5ac6('0x19')]?_0xea410f['options'][_0x5ac6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xea410f[_0x5ac6('0x19')]?_0xea410f[_0x5ac6('0x19')][_0x5ac6('0x1b')]||null:null,'attributes':_0xea410f[_0x5ac6('0x19')]?_0xea410f[_0x5ac6('0x19')][_0x5ac6('0x1c')]||null:null,'limit':_0xea410f[_0x5ac6('0x19')]?_0xea410f[_0x5ac6('0x19')]['limit']||null:null})[_0x5ac6('0xd')](function(_0x1d866a){logger['info']('UpdateMailApplication',_0xea410f);logger[_0x5ac6('0x1d')]('UpdateMailApplication',_0xea410f,JSON[_0x5ac6('0x12')](_0x1d866a));_0x5ec8bc(_0x1d866a);})[_0x5ac6('0x17')](function(_0xd313b8){logger[_0x5ac6('0x13')]('UpdateMailApplication',_0xd313b8[_0x5ac6('0x15')],_0xea410f);_0x2c2fb6(_0x26b77b['error'](0x1f4,_0xd313b8[_0x5ac6('0x15')]));});});}; \ No newline at end of file +var _0xa4e8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','options','raw','where','limit','util'];(function(_0x3ded,_0x491c2e){var _0x1e3e35=function(_0x2ed7b4){while(--_0x2ed7b4){_0x3ded['push'](_0x3ded['shift']());}};_0x1e3e35(++_0x491c2e);}(_0xa4e8,0xef));var _0x8a4e=function(_0xa7abb3,_0xdeb465){_0xa7abb3=_0xa7abb3-0x0;var _0x353347=_0xa4e8[_0xa7abb3];return _0x353347;};'use strict';var _=require('lodash');var util=require(_0x8a4e('0x0'));var moment=require(_0x8a4e('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a4e('0x2'));var fs=require('fs');var Redis=require(_0x8a4e('0x3'));var db=require(_0x8a4e('0x4'))['db'];var utils=require(_0x8a4e('0x5'));var logger=require(_0x8a4e('0x6'))(_0x8a4e('0x7'));var config=require(_0x8a4e('0x8'));var jayson=require(_0x8a4e('0x9'));var client=jayson[_0x8a4e('0xa')][_0x8a4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ae3e2,_0x4daa9e,_0x1caa6c){return new BPromise(function(_0x2e6e18,_0x5d8e7a){return client[_0x8a4e('0xc')](_0x4ae3e2,_0x1caa6c)[_0x8a4e('0xd')](function(_0xaf30ae){logger[_0x8a4e('0xe')](_0x8a4e('0xf'),_0x4daa9e,_0x8a4e('0x10'));logger[_0x8a4e('0x11')](_0x8a4e('0x12'),_0x4daa9e,_0x8a4e('0x10'),JSON[_0x8a4e('0x13')](_0xaf30ae));if(_0xaf30ae[_0x8a4e('0x14')]){if(_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x15')]===0x1f4){logger[_0x8a4e('0x14')](_0x8a4e('0xf'),_0x4daa9e,_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x16')]);return _0x5d8e7a(_0xaf30ae['error']['message']);}logger[_0x8a4e('0x14')]('MailApplication,\x20%s,\x20%s',_0x4daa9e,_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x16')]);return _0x2e6e18(_0xaf30ae[_0x8a4e('0x14')][_0x8a4e('0x16')]);}else{logger[_0x8a4e('0xe')](_0x8a4e('0xf'),_0x4daa9e,_0x8a4e('0x10'));_0x2e6e18(_0xaf30ae['result'][_0x8a4e('0x16')]);}})[_0x8a4e('0x17')](function(_0x53178f){logger[_0x8a4e('0x14')](_0x8a4e('0xf'),_0x4daa9e,_0x53178f);_0x5d8e7a(_0x53178f);});});}exports[_0x8a4e('0x18')]=function(_0x5db1fd){var _0x4bd3f3=this;return new Promise(function(_0x2e570b,_0x2ef63d){return db[_0x8a4e('0x19')]['update'](_0x5db1fd['body'],{'raw':_0x5db1fd[_0x8a4e('0x1a')]?_0x5db1fd['options'][_0x8a4e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db1fd['options']?_0x5db1fd['options'][_0x8a4e('0x1c')]||null:null,'attributes':_0x5db1fd[_0x8a4e('0x1a')]?_0x5db1fd[_0x8a4e('0x1a')]['attributes']||null:null,'limit':_0x5db1fd[_0x8a4e('0x1a')]?_0x5db1fd[_0x8a4e('0x1a')][_0x8a4e('0x1d')]||null:null})['then'](function(_0x743ec5){logger[_0x8a4e('0xe')](_0x8a4e('0x18'),_0x5db1fd);logger[_0x8a4e('0x11')](_0x8a4e('0x18'),_0x5db1fd,JSON[_0x8a4e('0x13')](_0x743ec5));_0x2e570b(_0x743ec5);})['catch'](function(_0x511cab){logger[_0x8a4e('0x14')](_0x8a4e('0x18'),_0x511cab[_0x8a4e('0x16')],_0x5db1fd);_0x2ef63d(_0x4bd3f3[_0x8a4e('0x14')](0x1f4,_0x511cab['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9e84b97..73e4876 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 _0x55a5=['getMessages','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','mailinteraction:destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x55a5,0xf7));var _0x555a=function(_0x788a54,_0x12450b){_0x788a54=_0x788a54-0x0;var _0x8b73a4=_0x55a5[_0x788a54];return _0x8b73a4;};'use strict';var multer=require(_0x555a('0x0'));var util=require('util');var path=require(_0x555a('0x1'));var timeout=require(_0x555a('0x2'));var express=require(_0x555a('0x3'));var router=express[_0x555a('0x4')]();var auth=require(_0x555a('0x5'));var interaction=require(_0x555a('0x6'));var config=require(_0x555a('0x7'));var controller=require(_0x555a('0x8'));router[_0x555a('0x9')]('/',auth[_0x555a('0xa')](),controller[_0x555a('0xb')]);router[_0x555a('0x9')](_0x555a('0xc'),auth[_0x555a('0xa')](),controller[_0x555a('0xd')]);router['get'](_0x555a('0xe'),auth[_0x555a('0xa')](),controller[_0x555a('0xf')]);router[_0x555a('0x9')](_0x555a('0x10'),auth[_0x555a('0xa')](),controller[_0x555a('0x11')]);router[_0x555a('0x9')]('/:id/download',auth[_0x555a('0xa')](),controller[_0x555a('0x12')]);router[_0x555a('0x13')]('/',auth[_0x555a('0xa')](),controller[_0x555a('0x14')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x555a('0x13')](_0x555a('0x15'),auth[_0x555a('0xa')](),interaction[_0x555a('0x16')](_0x555a('0x17'),_0x555a('0x18')),controller[_0x555a('0x19')]);router[_0x555a('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x555a('0x17'),_0x555a('0x1b')),controller[_0x555a('0x1c')]);router['delete'](_0x555a('0xe'),auth[_0x555a('0xa')](),interaction[_0x555a('0x16')]('mail',_0x555a('0x1d')),controller['destroy']);router[_0x555a('0x1e')](_0x555a('0x15'),auth[_0x555a('0xa')](),controller[_0x555a('0x1f')]);module[_0x555a('0x20')]=router; \ No newline at end of file +var _0xa9e5=['update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','addMessage','/:id/tags','mail','addTags','put','tracked','mailinteraction:update'];(function(_0x38d3b8,_0x80cb3b){var _0x213345=function(_0x4c24c5){while(--_0x4c24c5){_0x38d3b8['push'](_0x38d3b8['shift']());}};_0x213345(++_0x80cb3b);}(_0xa9e5,0x8a));var _0x5a9e=function(_0xdfe4da,_0x31113d){_0xdfe4da=_0xdfe4da-0x0;var _0x574a8d=_0xa9e5[_0xdfe4da];return _0x574a8d;};'use strict';var multer=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var path=require('path');var timeout=require(_0x5a9e('0x2'));var express=require(_0x5a9e('0x3'));var router=express[_0x5a9e('0x4')]();var auth=require(_0x5a9e('0x5'));var interaction=require(_0x5a9e('0x6'));var config=require(_0x5a9e('0x7'));var controller=require(_0x5a9e('0x8'));router[_0x5a9e('0x9')]('/',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xb')]);router[_0x5a9e('0x9')](_0x5a9e('0xc'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xd')]);router['get'](_0x5a9e('0xe'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xf')]);router[_0x5a9e('0x9')]('/:id/messages',auth[_0x5a9e('0xa')](),controller['getMessages']);router[_0x5a9e('0x9')](_0x5a9e('0x10'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x11')]);router[_0x5a9e('0x12')]('/',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x13')]);router[_0x5a9e('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5a9e('0x14')]);router[_0x5a9e('0x12')](_0x5a9e('0x15'),auth[_0x5a9e('0xa')](),interaction['tracked'](_0x5a9e('0x16'),'mailinteraction:addtags'),controller[_0x5a9e('0x17')]);router[_0x5a9e('0x18')]('/:id',auth[_0x5a9e('0xa')](),interaction[_0x5a9e('0x19')](_0x5a9e('0x16'),_0x5a9e('0x1a')),controller[_0x5a9e('0x1b')]);router[_0x5a9e('0x1c')](_0x5a9e('0xe'),auth[_0x5a9e('0xa')](),interaction['tracked']('mail',_0x5a9e('0x1d')),controller[_0x5a9e('0x1e')]);router[_0x5a9e('0x1c')]('/:id/tags',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x1f')]);module[_0x5a9e('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 58311e7..142a82d 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 _0x063d=['BOOLEAN','DATE','STRING','TEXT','out','ENUM','long','iconv','exports'];(function(_0x525276,_0xd269da){var _0x49d8e2=function(_0x4725b0){while(--_0x4725b0){_0x525276['push'](_0x525276['shift']());}};_0x49d8e2(++_0xd269da);}(_0x063d,0xa9));var _0xd063=function(_0x159458,_0x583a4f){_0x159458=_0x159458-0x0;var _0x16b7fb=_0x063d[_0x159458];return _0x16b7fb;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xd063('0x0'));module[_0xd063('0x1')]={'closed':{'type':Sequelize[_0xd063('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd063('0x3')]},'disposition':{'type':Sequelize[_0xd063('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd063('0x4')]},'note':{'type':Sequelize[_0xd063('0x4')]},'inReplyTo':{'type':Sequelize[_0xd063('0x4')](0x1fe)},'to':{'type':Sequelize[_0xd063('0x4')]},'cc':{'type':Sequelize[_0xd063('0x5')]('long')},'subject':{'type':Sequelize[_0xd063('0x5')]()},'attach':{'type':Sequelize[_0xd063('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd063('0x3')]},'substatus':{'type':Sequelize[_0xd063('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd063('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd063('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd063('0x7')]('in',_0xd063('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd063('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0xd063('0x5')](_0xd063('0x8'))}}; \ No newline at end of file +var _0x2976=['TEXT','long','DATE','out','ENUM','exports','BOOLEAN','STRING'];(function(_0x3d1203,_0xdca475){var _0x56166e=function(_0x4d51cd){while(--_0x4d51cd){_0x3d1203['push'](_0x3d1203['shift']());}};_0x56166e(++_0xdca475);}(_0x2976,0x195));var _0x6297=function(_0x578099,_0x322c67){_0x578099=_0x578099-0x0;var _0x9fce11=_0x2976[_0x578099];return _0x9fce11;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x6297('0x0')]={'closed':{'type':Sequelize[_0x6297('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6297('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6297('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6297('0x3')](_0x6297('0x4'))},'subject':{'type':Sequelize[_0x6297('0x3')]()},'attach':{'type':Sequelize[_0x6297('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6297('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x6297('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6297('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6297('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6297('0x7')]('in',_0x6297('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x6297('0x3')]('long')},'lastMsgText':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 277530f..924c3cf 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 _0x5c76=['addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','message%d.eml','log','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','status','end','offset','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','fullname','TagIds','Tags','split','MailInteraction','findOne','lastMsgBody','then','lastMsgText','trimStart','fromString','catch','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','plainBody','text','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','count','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','keys','rawAttributes','includeAll','options','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','MailInteractionId','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll'];(function(_0x310832,_0xe72c7e){var _0x103f74=function(_0x4a217c){while(--_0x4a217c){_0x310832['push'](_0x310832['shift']());}};_0x103f74(++_0xe72c7e);}(_0x5c76,0x111));var _0x65c7=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x5c76[_0x166d93];return _0xba708;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65c7('0x0'));var rimraf=require(_0x65c7('0x1'));var zipdir=require(_0x65c7('0x2'));var jsonpatch=require(_0x65c7('0x3'));var rp=require('request-promise');var moment=require(_0x65c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65c7('0x5'));var path=require(_0x65c7('0x6'));var sox=require(_0x65c7('0x7'));var csv=require(_0x65c7('0x8'));var ejs=require(_0x65c7('0x9'));var fs=require('fs');var _=require(_0x65c7('0xa'));var squel=require('squel');var crypto=require(_0x65c7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x65c7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65c7('0xd'));var Papa=require(_0x65c7('0xe'));var htmlToText=require('html-to-text');var Redis=require(_0x65c7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x65c7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x65c7('0x11'));var config=require(_0x65c7('0x12'));var licenseUtil=require(_0x65c7('0x13'));var db=require(_0x65c7('0x14'))['db'];config[_0x65c7('0x15')]=_['defaults'](config['redis'],{'host':_0x65c7('0x16'),'port':0x18eb});var socket=require(_0x65c7('0x17'))(new Redis(config[_0x65c7('0x15')]));require(_0x65c7('0x18'))['register'](socket);function respondWithStatusCode(_0x3af826,_0x5b4cda){_0x5b4cda=_0x5b4cda||0xcc;return function(_0x2c7eb1){if(_0x2c7eb1){return _0x3af826['sendStatus'](_0x5b4cda);}return _0x3af826[_0x65c7('0x19')](_0x5b4cda)[_0x65c7('0x1a')]();};}function respondWithResult(_0x5dbc0c,_0x5f19dc){_0x5f19dc=_0x5f19dc||0xc8;return function(_0x3c98d2){if(_0x3c98d2){return _0x5dbc0c[_0x65c7('0x19')](_0x5f19dc)['json'](_0x3c98d2);}};}function respondWithFilteredResult(_0x2a3474,_0x2d2c0c){return function(_0x11e27d){if(_0x11e27d){var _0x1c1370=_0x11e27d['count'],_0x1e197f=_0x2d2c0c[_0x65c7('0x1b')],_0x2e59f7=_0x2d2c0c[_0x65c7('0x1b')]+_0x2d2c0c['limit'],_0x41c8ca;if(_0x2e59f7>=_0x1c1370){_0x2e59f7=_0x1c1370;_0x41c8ca=0xc8;}else{_0x41c8ca=0xce;}_0x2a3474['status'](_0x41c8ca);return _0x2a3474[_0x65c7('0x1c')](_0x65c7('0x1d'),_0x1e197f+'-'+_0x2e59f7+'/'+_0x1c1370)[_0x65c7('0x1e')](_0x11e27d);}return null;};}function patchUpdates(_0x3aa8c5){return function(_0x9487d5){try{jsonpatch[_0x65c7('0x1f')](_0x9487d5,_0x3aa8c5,!![]);}catch(_0x51b0b7){return BPromise[_0x65c7('0x20')](_0x51b0b7);}return _0x9487d5['save']();};}function saveUpdates(_0x597606,_0x3f2a82){return function(_0x58048b){if(_0x58048b){return _0x58048b[_0x65c7('0x21')](_0x597606)['then'](function(_0x553edd){return _0x553edd;});}return null;};}function removeEntity(_0x41345c,_0x13a4b4){return function(_0x45329b){if(_0x45329b){return _0x45329b[_0x65c7('0x22')]()['then'](function(){_0x41345c[_0x65c7('0x19')](0xcc)[_0x65c7('0x1a')]();});}};}function handleEntityNotFound(_0x430bfa,_0x1e8a53){return function(_0x35220d){if(!_0x35220d){_0x430bfa['sendStatus'](0x194);}return _0x35220d;};}function handleError(_0x442013,_0x28bbd4){_0x28bbd4=_0x28bbd4||0x1f4;return function(_0x5b3a4a){logger[_0x65c7('0x23')](_0x5b3a4a[_0x65c7('0x24')]);if(_0x5b3a4a['name']){delete _0x5b3a4a[_0x65c7('0x25')];}_0x442013[_0x65c7('0x19')](_0x28bbd4)[_0x65c7('0x26')](_0x5b3a4a);};}function getInteractionUsers(_0x3560c0,_0x53f994){return new BPromise(function(_0x157012,_0x3d9ba7){try{if(_0x53f994[_0x3560c0['id']]){_0x3560c0['Users']=_['map'](_0x53f994[_0x3560c0['id']],function(_0x221b08){return{'id':_0x221b08['id'],'fullname':_0x221b08[_0x65c7('0x27')]};});}}catch(_0x5bcb2c){_0x3d9ba7(_0x5bcb2c);}_0x157012(_0x3560c0);});}function getInteractionTags(_0xff4d7d,_0x574110){return new BPromise(function(_0x1c2169,_0xebbd15){try{if(_0xff4d7d[_0x65c7('0x28')]){_0xff4d7d[_0x65c7('0x29')]=[];_0xff4d7d['TagIds'][_0x65c7('0x2a')](',')['forEach'](function(_0x5105c5){_0xff4d7d[_0x65c7('0x29')]['push'](_0x574110[_0x5105c5]);});}delete _0xff4d7d[_0x65c7('0x28')];}catch(_0x36b9b0){_0xebbd15(_0x36b9b0);}_0x1c2169(_0xff4d7d);});}function getLastMessageText(_0x510bfb){return new BPromise(function(_0x3e790e,_0x3cd050){return db[_0x65c7('0x2b')][_0x65c7('0x2c')]({'where':{'id':_0x510bfb['id']},'attributes':[_0x65c7('0x2d'),'lastMsgText'],'raw':!![]})[_0x65c7('0x2e')](function(_0x3ae41a){if(!_0x3ae41a[_0x65c7('0x2f')]){_0x510bfb['lastMsgText']=_[_0x65c7('0x30')](htmlToText[_0x65c7('0x31')](_0x3ae41a['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x510bfb[_0x65c7('0x2f')]=_0x3ae41a['lastMsgText'];}_0x3e790e(_0x510bfb);})[_0x65c7('0x32')](function(_0x373441){_0x3cd050(_0x373441);});});}function updateMailInteraction(_0x207622,_0x5875f5,_0x18b081,_0xfbb26f){return new BPromise(function(_0x4d06a7,_0xae67c){return getInteractionUsers(_0x207622,_0x18b081)['then'](function(_0x4e163c){return getInteractionTags(_0x4e163c,_0x5875f5);})[_0x65c7('0x2e')](function(_0x467042){if(_0xfbb26f){_0x4d06a7(getLastMessageText(_0x467042));}else{_0x4d06a7(_0x467042);}})[_0x65c7('0x32')](function(_0x2796b7){_0xae67c(_0x2796b7);});});}exports[_0x65c7('0x33')]=function(_0x599b10,_0x24f08e){var _0x34aa67={},_0x5a0b58={},_0x4608e7={'count':0x0,'rows':[]};var _0x3595d4=_[_0x65c7('0x34')](db['MailInteraction']['rawAttributes'],function(_0x2315fb){return{'name':_0x2315fb[_0x65c7('0x35')],'type':_0x2315fb[_0x65c7('0x36')][_0x65c7('0x37')]};});_0x5a0b58[_0x65c7('0x38')]=_[_0x65c7('0x34')](_0x3595d4,'name');_0x5a0b58[_0x65c7('0x39')]=_['keys'](_0x599b10[_0x65c7('0x39')]);_0x5a0b58[_0x65c7('0x3a')]=_[_0x65c7('0x3b')](_0x5a0b58[_0x65c7('0x38')],_0x5a0b58[_0x65c7('0x39')]);_0x34aa67[_0x65c7('0x3c')]=_[_0x65c7('0x3b')](_0x5a0b58[_0x65c7('0x38')],qs[_0x65c7('0x3d')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x3d')]));_0x34aa67[_0x65c7('0x3c')]=_0x34aa67['attributes'][_0x65c7('0x3e')]?_0x34aa67[_0x65c7('0x3c')]:_0x5a0b58['model'];if(!_0x599b10[_0x65c7('0x39')][_0x65c7('0x3f')](_0x65c7('0x40'))){_0x34aa67[_0x65c7('0x41')]=qs[_0x65c7('0x41')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x41')]);_0x34aa67[_0x65c7('0x1b')]=qs[_0x65c7('0x1b')](_0x599b10['query'][_0x65c7('0x1b')]);}_0x34aa67[_0x65c7('0x42')]=qs[_0x65c7('0x43')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x43')]);_0x34aa67[_0x65c7('0x44')]=qs[_0x65c7('0x3a')](_[_0x65c7('0x45')](_0x599b10[_0x65c7('0x39')],_0x5a0b58[_0x65c7('0x3a')]),_0x3595d4);var _0x107f86=[];var _0x4f7802=squel[_0x65c7('0x46')]()[_0x65c7('0x47')]('id')[_0x65c7('0x47')](_0x65c7('0x25'))[_0x65c7('0x47')](_0x65c7('0x48'))['from'](_0x65c7('0x49'));var _0x2e32c0=squel[_0x65c7('0x46')]()[_0x65c7('0x47')](_0x65c7('0x4a'))[_0x65c7('0x47')](_0x65c7('0x4b'))['field'](_0x65c7('0x4c'))[_0x65c7('0x4d')](_0x65c7('0x4e'),'ui')[_0x65c7('0x4f')](_0x65c7('0x50'),'u',_0x65c7('0x51'));var _0x5b7651=squel[_0x65c7('0x46')]()[_0x65c7('0x4d')]('mail_interactions','i')['left_join'](_0x65c7('0x52'),'c',_0x65c7('0x53'))[_0x65c7('0x4f')](_0x65c7('0x50'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x65c7('0x54'),'a',_0x65c7('0x55'))['left_join'](_0x65c7('0x56'),'me',_0x65c7('0x57'))[_0x65c7('0x4f')](_0x65c7('0x58'),'it',_0x65c7('0x59'))[_0x65c7('0x4f')](_0x65c7('0x49'),'t',_0x65c7('0x5a'));var _0x5b7ff3=squel[_0x65c7('0x5b')]();var _0x5cbbcf=[];var _0x1748c3=squel[_0x65c7('0x5b')]();var _0x5d83cc;if(_0x599b10[_0x65c7('0x39')]['search']){_0x5d83cc=as[_0x65c7('0x5c')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x5d')]);var _0x17afa1=_0x5d83cc[_0x65c7('0x5e')];for(var _0x1ad9ef=0x0;_0x1ad9ef<_0x5d83cc[_0x65c7('0x5f')][_0x65c7('0x3e')];_0x1ad9ef++){var _0x1c1ce4=_0x5d83cc[_0x65c7('0x5f')][_0x1ad9ef];var _0xd9d628='i';var _0x3ce7d4=_[_0x65c7('0x60')](_0x3595d4,[_0x65c7('0x25'),_0x1c1ce4[_0x65c7('0x47')]]);if(!_0x3ce7d4){switch(_0x1c1ce4[_0x65c7('0x47')]){case _0x65c7('0x61'):if(_0x1c1ce4[_0x65c7('0x62')]==0x1){_0x5b7651[_0x65c7('0x63')]('`'+_0x1c1ce4['field']+_0x65c7('0x64'));}else{_0x5b7651[_0x65c7('0x63')]('`'+_0x1c1ce4['field']+_0x65c7('0x65'));}break;case _0x65c7('0x66'):if(_0x1c1ce4['operator']===_0x65c7('0x67')){if(_0x1c1ce4[_0x65c7('0x62')][_0x65c7('0x2a')]('\x20')['length']>0x1){_0x5b7ff3[_0x17afa1](_0x65c7('0x68'),qs[_0x65c7('0x69')](_0x1c1ce4['value']),null);}else{var _0x1c8079='%'+_0x1c1ce4[_0x65c7('0x62')]+'%';_0x5b7ff3[_0x17afa1](_0x65c7('0x6a'),_0x1c8079,_0x1c8079,_0x1c8079);}}else{_0x3ce7d4=_['find'](_0x3595d4,[_0x65c7('0x25'),_0x65c7('0x6b')]);_0x1c1ce4[_0x65c7('0x47')]=_0x65c7('0x6b');_0xb7b89f=as[_0x65c7('0x6c')](_0xd9d628,_0x3ce7d4[_0x65c7('0x36')],_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f['text'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x6d')],_0xb7b89f['value'][_0x65c7('0x1a')]);}break;case _0x65c7('0x6e'):var _0x583e06=_0x1c1ce4[_0x65c7('0x62')][_0x65c7('0x2a')](',')['map'](function(_0x1882c1){return Number(_0x1882c1);});_0x583e06[_0x65c7('0x6f')](function(_0x330802){_0x1748c3['or'](_0x65c7('0x70'),'%,'+_0x330802+',%');});_0x5cbbcf=_[_0x65c7('0x71')](_0x5cbbcf,_0x583e06);break;case _0x65c7('0x72'):if(_0x1c1ce4[_0x65c7('0x73')]===_0x65c7('0x67')){_0x5b7ff3[_0x17afa1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1c1ce4[_0x65c7('0x62')]+'%',null);}else{_0x3ce7d4=_[_0x65c7('0x60')](_0x3595d4,[_0x65c7('0x25'),_0x65c7('0x74')]);_0x1c1ce4['field']=_0x65c7('0x74');_0xb7b89f=as['buildExpression'](_0xd9d628,_0x3ce7d4[_0x65c7('0x36')],_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f['text'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x6d')],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x1a')]);}break;case _0x65c7('0x75'):_0xb7b89f=as['buildExpression']('me',null,_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f[_0x65c7('0x76')],_0xb7b89f['value']['start'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x1a')]);break;}}else{var _0xb7b89f=as['buildExpression'](_0xd9d628,_0x3ce7d4[_0x65c7('0x36')],_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f[_0x65c7('0x76')],_0xb7b89f[_0x65c7('0x62')]['start'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x1a')]);}}}else{var _0x2f32e8=_(_0x599b10[_0x65c7('0x39')])['keys']()[_0x65c7('0x34')](function(_0x517c11){return _[_0x65c7('0x77')](_0x3595d4,[_0x65c7('0x25'),_0x517c11])?_0x517c11:undefined;})[_0x65c7('0x78')]()['value']();if(!_[_0x65c7('0x79')](_0x2f32e8)){_0x2f32e8['forEach'](function(_0x5e9ab7){if(_0x5e9ab7===_0x65c7('0x7a')){_0x5b7651[_0x65c7('0x44')](_0x65c7('0x7b'),[][_0x65c7('0x7c')](_0x599b10[_0x65c7('0x39')][_0x5e9ab7]));}else if(_0x5e9ab7===_0x65c7('0x7d')){var _0x209e7c=JSON[_0x65c7('0x7e')](_0x599b10[_0x65c7('0x39')][_0x5e9ab7])['$gte'];var _0x5451e4=JSON[_0x65c7('0x7e')](_0x599b10['query'][_0x5e9ab7])[_0x65c7('0x7f')];_0x5b7651[_0x65c7('0x44')](_0x65c7('0x80'),_0x209e7c,_0x5451e4);}else{if(_0x599b10[_0x65c7('0x39')][_0x5e9ab7]===_0x65c7('0x81')){_0x5b7651[_0x65c7('0x44')]('i.'+_0x5e9ab7+'\x20IS\x20NULL');}else{_0x5b7651[_0x65c7('0x44')]('i.'+_0x5e9ab7+_0x65c7('0x82'),_0x599b10[_0x65c7('0x39')][_0x5e9ab7]);}}});}if(_0x599b10['query'][_0x65c7('0x83')]){if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x83')]==0x1){_0x5b7651['having'](_0x65c7('0x84'));}else{_0x5b7651[_0x65c7('0x63')](_0x65c7('0x85'));}}if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')]){_0x5cbbcf=_[_0x65c7('0x87')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')])?_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')]:new Array(_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')]);_0x5cbbcf[_0x65c7('0x6f')](function(_0x38d1db){_0x1748c3['or'](_0x65c7('0x70'),'%,'+_0x38d1db+',%');});}if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x88')]){var _0xdbc874=_0x599b10[_0x65c7('0x39')][_0x65c7('0x88')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x65c7('0x89')](_0xdbc874)){_0x5b7ff3['or'](_0x65c7('0x8a'),_0xdbc874+'%');}else if(qs[_0x65c7('0x8b')](_0xdbc874)){_0x5b7ff3['or'](_0x65c7('0x8c'),_0xdbc874+'%');}else{_0x5b7ff3['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x65c7('0x69')](_0xdbc874))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x65c7('0x69')](_0xdbc874));}}}_0x5b7651[_0x65c7('0x44')](_0x5b7ff3);_0x5b7651[_0x65c7('0x8d')](_0x65c7('0x8e'));var _0x3ab7ac={'type':db['Sequelize'][_0x65c7('0x8f')][_0x65c7('0x90')],'raw':!![]};var _0x3f37e7=_0x5b7651[_0x65c7('0x91')]();_0x3f37e7[_0x65c7('0x47')](_0x65c7('0x8e'));_0x3f37e7[_0x65c7('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x65c7('0x61'));if(_0x34aa67['order']){_0x34aa67[_0x65c7('0x42')][_0x65c7('0x6f')](function(_0x256ec8){var _0x1647ee=_0x256ec8[0x0]==='contactName'?_0x256ec8[0x0]:'i.'+_0x256ec8[0x0];_0x5b7651[_0x65c7('0x42')](_0x1647ee,_0x256ec8[0x1]===_0x65c7('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x5cbbcf)){_0x5b7651[_0x65c7('0x63')](_0x1748c3);_0x3f37e7['where'](_0x65c7('0x93'),_0x5cbbcf);}BPromise[_0x65c7('0x94')]()['then'](function(){if(!_0x5d83cc){if(_0x599b10[_0x65c7('0x39')]['MailAccountId']||_0x599b10[_0x65c7('0x39')][_0x65c7('0x95')])return;_0x3f37e7['where'](_0x65c7('0x96'));_0x5b7651[_0x65c7('0x44')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x599b10[_0x65c7('0x97')][_0x65c7('0x98')]!==_0x65c7('0x99'))return;return _0x599b10[_0x65c7('0x97')][_0x65c7('0x9a')]({'attributes':['id'],'raw':!![]})[_0x65c7('0x2e')](function(_0x4ebd43){if(_['isEmpty'](_0x4ebd43)){_0x3f37e7[_0x65c7('0x44')](_0x65c7('0x9b'));_0x5b7651[_0x65c7('0x44')](_0x65c7('0x9b'));}else{_0x3f37e7[_0x65c7('0x44')](_0x65c7('0x7b'),_[_0x65c7('0x34')](_0x4ebd43,'id'));_0x5b7651[_0x65c7('0x44')](_0x65c7('0x7b'),_[_0x65c7('0x34')](_0x4ebd43,'id'));}});})[_0x65c7('0x2e')](function(){if(_0x599b10[_0x65c7('0x97')]['role']===_0x65c7('0x99')&&!_0x5d83cc&&!_0x599b10[_0x65c7('0x39')][_0x65c7('0x7a')])return[];return db[_0x65c7('0x9c')][_0x65c7('0x39')](_0x3f37e7['toString'](),_0x3ab7ac);})[_0x65c7('0x2e')](function(_0x31ae2e){_0x4608e7[_0x65c7('0x9d')]=_0x31ae2e[_0x65c7('0x3e')];if(_0x4608e7[_0x65c7('0x9d')]===0x0)return[];return db[_0x65c7('0x9c')][_0x65c7('0x39')](_0x4f7802[_0x65c7('0x9e')](),_0x3ab7ac)[_0x65c7('0x2e')](function(_0x19f652){_0x107f86=_['keyBy'](_0x19f652,'id');_0x3ab7ac=_['merge'](_0x3ab7ac,{'model':db[_0x65c7('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x3d')]){_0x34aa67[_0x65c7('0x3c')][_0x65c7('0x6f')](function(_0x30b25e){_0x5b7651[_0x65c7('0x47')]('i.'+_0x30b25e);});}else{_0x5b7651['field'](_0x65c7('0x9f'),_0x65c7('0x61'));_0x5b7651['field']('a.key',_0x65c7('0xa0'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa1'),_0x65c7('0xa2'));_0x5b7651[_0x65c7('0x47')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x65c7('0xa3'));_0x5b7651['field'](_0x65c7('0x8e'));_0x5b7651['field'](_0x65c7('0xa4'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa5'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa6'));_0x5b7651[_0x65c7('0x47')]('i.closedAt');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa7'));_0x5b7651[_0x65c7('0x47')]('i.lastMsgAt');_0x5b7651[_0x65c7('0x47')]('i.lastMsgDirection');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa8'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa9'));_0x5b7651[_0x65c7('0x47')]('i.secondDisposition');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xaa'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xab'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xac'));_0x5b7651[_0x65c7('0x47')]('i.ContactId');_0x5b7651['field'](_0x65c7('0xad'));_0x5b7651[_0x65c7('0x47')]('i.UserId');_0x5b7651[_0x65c7('0x47')]('c.firstName',_0x65c7('0xae'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xaf'),_0x65c7('0xb0'));_0x5b7651[_0x65c7('0x47')]('c.email','Contact.email');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb1'),_0x65c7('0xb2'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb3'),_0x65c7('0xb4'));_0x5b7651['field'](_0x65c7('0xb5'),_0x65c7('0xb6'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb7'),_0x65c7('0xb8'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb9'),'Owner.internal');_0x5b7651['field'](_0x65c7('0xba'),'TagIds');}if(_0x34aa67['limit'])_0x5b7651[_0x65c7('0x41')](_0x34aa67[_0x65c7('0x41')]);if(_0x34aa67[_0x65c7('0x1b')])_0x5b7651['offset'](_0x34aa67[_0x65c7('0x1b')]);return db['sequelize'][_0x65c7('0x39')](_0x5b7651[_0x65c7('0x9e')](),_0x3ab7ac);})[_0x65c7('0x2e')](function(_0xa9dead){_0x2e32c0[_0x65c7('0x44')]('ui.MailInteractionId\x20IN\x20?',_[_0x65c7('0x34')](_0xa9dead,'id'));return db[_0x65c7('0x9c')]['query'](_0x2e32c0[_0x65c7('0x9e')](),_0x3ab7ac)[_0x65c7('0x2e')](function(_0x41cc5d){var _0x541052=_[_0x65c7('0xbb')](_0x41cc5d,'MailInteractionId');var _0x2de3be=[];return db[_0x65c7('0xbc')][_0x65c7('0x2c')]({'attributes':[_0x65c7('0xbd')],'raw':!![]})['then'](function(_0x36dbad){var _0x9ffebf=_0x36dbad[_0x65c7('0xbd')];_0xa9dead[_0x65c7('0x6f')](function(_0x173387){_0x2de3be['push'](updateMailInteraction(_0x173387,_0x107f86,_0x541052,_0x9ffebf));});return BPromise[_0x65c7('0xbe')](_0x2de3be);});});});})['then'](function(_0x1e7be3){_0x4608e7[_0x65c7('0xbf')]=_0x1e7be3;return _0x4608e7;})[_0x65c7('0x2e')](respondWithFilteredResult(_0x24f08e,_0x34aa67))[_0x65c7('0x32')](handleError(_0x24f08e,null));};exports['show']=function(_0x1a4d1f,_0x6b624f){var _0x4db5b9={'raw':![],'where':{'id':_0x1a4d1f['params']['id']}},_0xd6e11e={};_0xd6e11e[_0x65c7('0x38')]=_[_0x65c7('0xc0')](db[_0x65c7('0x2b')][_0x65c7('0xc1')]);_0xd6e11e['query']=_[_0x65c7('0xc0')](_0x1a4d1f['query']);_0xd6e11e['filters']=_[_0x65c7('0x3b')](_0xd6e11e[_0x65c7('0x38')],_0xd6e11e[_0x65c7('0x39')]);_0x4db5b9['attributes']=_[_0x65c7('0x3b')](_0xd6e11e['model'],qs[_0x65c7('0x3d')](_0x1a4d1f[_0x65c7('0x39')][_0x65c7('0x3d')]));_0x4db5b9['attributes']=_0x4db5b9[_0x65c7('0x3c')][_0x65c7('0x3e')]?_0x4db5b9['attributes']:_0xd6e11e[_0x65c7('0x38')];if(_0x1a4d1f[_0x65c7('0x39')][_0x65c7('0xc2')]){_0x4db5b9['include']=[{'all':!![]}];}_0x4db5b9=_['merge']({},_0x4db5b9,_0x1a4d1f[_0x65c7('0xc3')]);return db['MailInteraction'][_0x65c7('0x60')](_0x4db5b9)[_0x65c7('0x2e')](handleEntityNotFound(_0x6b624f,null))['then'](respondWithResult(_0x6b624f,null))[_0x65c7('0x32')](handleError(_0x6b624f,null));};exports[_0x65c7('0xc4')]=function(_0x4e2058,_0x4a1cab){return db['MailInteraction']['create'](_0x4e2058[_0x65c7('0xc5')],{})[_0x65c7('0x2e')](respondWithResult(_0x4a1cab,0xc9))[_0x65c7('0x32')](handleError(_0x4a1cab,null));};exports[_0x65c7('0x21')]=function(_0x3c282d,_0x15deca){if(_0x3c282d[_0x65c7('0xc5')]['id']){delete _0x3c282d[_0x65c7('0xc5')]['id'];}return db[_0x65c7('0x2b')][_0x65c7('0x60')]({'where':{'id':_0x3c282d[_0x65c7('0xc6')]['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x15deca,null))[_0x65c7('0x2e')](saveUpdates(_0x3c282d[_0x65c7('0xc5')],null))['then'](respondWithResult(_0x15deca,null))[_0x65c7('0x32')](handleError(_0x15deca,null));};exports['destroy']=function(_0x5afba6,_0x34e44f){return db[_0x65c7('0x2b')]['find']({'where':{'id':_0x5afba6[_0x65c7('0xc6')]['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x34e44f,null))[_0x65c7('0x2e')](removeEntity(_0x34e44f,null))[_0x65c7('0x32')](handleError(_0x34e44f,null));};exports[_0x65c7('0xc7')]=function(_0x109934,_0x1caf51){return db[_0x65c7('0x2b')][_0x65c7('0xc7')]()[_0x65c7('0x2e')](respondWithResult(_0x1caf51,null))[_0x65c7('0x32')](handleError(_0x1caf51,null));};exports[_0x65c7('0xc8')]=function(_0x25f3ce,_0x3e239d,_0x464fcb){return db[_0x65c7('0xc9')][_0x65c7('0x60')]({'where':{'id':_0x25f3ce[_0x65c7('0xc6')]['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x3e239d,null))[_0x65c7('0x2e')](function(_0x41d7df){if(_0x41d7df){return _0x41d7df[_0x65c7('0xc8')](_0x25f3ce[_0x65c7('0xc5')][_0x65c7('0xca')],_[_0x65c7('0xcb')](_0x25f3ce['body'],[_0x65c7('0xca'),'id'])||{});}})['then'](respondWithResult(_0x3e239d,null))[_0x65c7('0x32')](handleError(_0x3e239d,null));};exports[_0x65c7('0xcc')]=function(_0x4af373,_0x14049c,_0x17639e){var _0x4632cc={'raw':![],'where':{}};var _0x45ff21={};var _0x1d4a23={'count':0x0,'rows':[]};return db[_0x65c7('0x2b')][_0x65c7('0x2c')]({'where':{'id':_0x4af373['params']['id']}})['then'](handleEntityNotFound(_0x14049c,null))[_0x65c7('0x2e')](function(_0x35b372){if(_0x35b372){_0x45ff21['model']=_[_0x65c7('0xc0')](db[_0x65c7('0xc9')][_0x65c7('0xc1')]);_0x45ff21[_0x65c7('0x39')]=_[_0x65c7('0xc0')](_0x4af373[_0x65c7('0x39')]);_0x45ff21['filters']=_[_0x65c7('0x3b')](_0x45ff21['model'],_0x45ff21[_0x65c7('0x39')]);_0x4632cc[_0x65c7('0x3c')]=_[_0x65c7('0x3b')](_0x45ff21[_0x65c7('0x38')],qs[_0x65c7('0x3d')](_0x4af373[_0x65c7('0x39')]['fields']));_0x4632cc[_0x65c7('0x3c')]=_0x4632cc['attributes'][_0x65c7('0x3e')]?_0x4632cc[_0x65c7('0x3c')]:_0x45ff21[_0x65c7('0x38')];if(!_0x4af373[_0x65c7('0x39')][_0x65c7('0x3f')](_0x65c7('0x40'))){_0x4632cc[_0x65c7('0x41')]=qs[_0x65c7('0x41')](_0x4af373['query'][_0x65c7('0x41')]);_0x4632cc[_0x65c7('0x1b')]=qs[_0x65c7('0x1b')](_0x4af373[_0x65c7('0x39')][_0x65c7('0x1b')]);}_0x4632cc[_0x65c7('0x42')]=qs[_0x65c7('0x43')](_0x4af373[_0x65c7('0x39')]['sort']);_0x4632cc[_0x65c7('0x44')]=qs[_0x65c7('0x3a')](_[_0x65c7('0x45')](_0x4af373[_0x65c7('0x39')],_0x45ff21['filters']));_0x4632cc[_0x65c7('0x44')][_0x65c7('0xcd')]=_0x35b372['id'];if(_0x4af373['query']['filter']){_0x4632cc[_0x65c7('0x44')]=_[_0x65c7('0xce')](_0x4632cc[_0x65c7('0x44')],{'$or':_[_0x65c7('0x34')](_0x4632cc[_0x65c7('0x3c')],function(_0xf24baf){var _0x46a566={};_0x46a566[_0xf24baf]={'$like':'%'+_0x4af373[_0x65c7('0x39')][_0x65c7('0x88')]+'%'};return _0x46a566;})});}if(_0x4af373['query'][_0x65c7('0xcf')]){var _0xf5b55f=_0x4af373[_0x65c7('0x39')][_0x65c7('0xcf')][_0x65c7('0x2a')](',');var _0x4e9f15={};_0x4e9f15[_0xf5b55f[0x0]]={'$gte':moment(_0xf5b55f[0x1])[_0x65c7('0xd0')](_0x65c7('0xd1'))};_0x4632cc[_0x65c7('0x44')]=_[_0x65c7('0xce')](_0x4632cc['where'],_0x4e9f15);}_0x4632cc=_[_0x65c7('0xce')]({},_0x4632cc,_0x4af373['options']);return db[_0x65c7('0xc9')]['count']({'where':_0x4632cc['where']})[_0x65c7('0x2e')](function(_0x2d4b3f){_0x1d4a23[_0x65c7('0x9d')]=_0x2d4b3f;if(_0x4af373[_0x65c7('0x39')]['includeAll']){_0x4632cc['include']=[{'all':!![]}];}return db['MailMessage'][_0x65c7('0xd2')](_0x4632cc);})[_0x65c7('0x2e')](function(_0x346e18){_0x1d4a23[_0x65c7('0xbf')]=_0x346e18;return _0x1d4a23;});}})['then'](respondWithFilteredResult(_0x14049c,_0x4632cc))[_0x65c7('0x32')](handleError(_0x14049c,null));};exports[_0x65c7('0xd3')]=function(_0x3d61b2,_0x331440,_0x223d83){return db['MailInteraction'][_0x65c7('0x60')]({'where':{'id':_0x3d61b2[_0x65c7('0xc6')]['id']}})['then'](handleEntityNotFound(_0x331440,null))[_0x65c7('0x2e')](function(_0x12b689){if(_0x12b689){return _0x12b689[_0x65c7('0xd4')](_0x3d61b2[_0x65c7('0xc5')][_0x65c7('0xca')],_[_0x65c7('0xcb')](_0x3d61b2[_0x65c7('0xc5')],['ids','id'])||{})[_0x65c7('0xd5')](function(){return db[_0x65c7('0x6e')]['findAll']({'attributes':['id',_0x65c7('0x25'),_0x65c7('0x48')],'where':{'id':_0x3d61b2['body']['ids']}});})[_0x65c7('0x2e')](function(_0x1507ef){socket[_0x65c7('0xd6')](_0x65c7('0xd7'),{'id':Number(_0x3d61b2[_0x65c7('0xc6')]['id']),'tags':_0x1507ef||[]});return{'id':Number(_0x3d61b2[_0x65c7('0xc6')]['id']),'tags':_0x1507ef||[]};});}})[_0x65c7('0x2e')](respondWithResult(_0x331440,null))['catch'](handleError(_0x331440,null));};exports[_0x65c7('0xd8')]=function(_0x3ff049,_0x27901b,_0x333626){return db[_0x65c7('0x2b')][_0x65c7('0x60')]({'where':{'id':_0x3ff049['params']['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x27901b,null))[_0x65c7('0x2e')](function(_0x7055d){if(_0x7055d){return _0x7055d[_0x65c7('0xd8')](_0x3ff049['query'][_0x65c7('0xca')]);}})['then'](respondWithStatusCode(_0x27901b,null))[_0x65c7('0x32')](handleError(_0x27901b,null));};exports[_0x65c7('0xd9')]=function(_0x2a775f,_0x1d7dbb){var _0x4909c8=moment()['unix']()[_0x65c7('0x9e')]();var _0x24e6ca=path[_0x65c7('0xda')](config[_0x65c7('0xdb')],_0x65c7('0xdc'),_0x65c7('0xdd'),_0x65c7('0xde'));var _0x49ac25=path[_0x65c7('0xda')](config[_0x65c7('0xdb')],_0x65c7('0xdc'),_0x65c7('0xdd'),_0x65c7('0xdf'));var _0x4065cb=path[_0x65c7('0xda')](_0x24e6ca,_0x4909c8);var _0x2b0447=util[_0x65c7('0xd0')](_0x65c7('0xe0'),_0x2a775f[_0x65c7('0xc6')]['id'],_0x4909c8);var _0x28cadb=path[_0x65c7('0xda')](_0x24e6ca,_0x2b0447);var _0x3924ae=[];if(_0x2a775f[_0x65c7('0x39')][_0x65c7('0xdf')]){_0x3924ae[_0x65c7('0xe1')]({'model':db[_0x65c7('0xe2')],'as':_0x65c7('0xe3'),'raw':!![]});}var _0x56adb=[{'model':db[_0x65c7('0xc9')],'as':_0x65c7('0xe4'),'attributes':['id',_0x65c7('0xc5'),'from','to','cc',_0x65c7('0xe5'),_0x65c7('0xe6'),_0x65c7('0x7d')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x3924ae}];return db[_0x65c7('0x2b')][_0x65c7('0x60')]({'where':{'id':_0x2a775f['params']['id']},'include':_0x56adb})[_0x65c7('0x2e')](handleEntityNotFound(_0x1d7dbb,null))['then'](function(_0x181a77){if(_0x181a77&&_0x181a77[_0x65c7('0xe4')]){var _0x5f5c19=_0x181a77[_0x65c7('0xe7')]({'plain':!![]});fs[_0x65c7('0xe8')](_0x4065cb);return BPromise['each'](_0x5f5c19['Messages'],function(_0x4f8548,_0x11c91c){var _0x575429={'from':_0x4f8548[_0x65c7('0x4d')],'to':_0x4f8548['to'],'subject':_0x4f8548['subject'],'html':_0x4f8548[_0x65c7('0xc5')],'headers':{'Date':moment(_0x4f8548[_0x65c7('0x7d')])['format'](_0x65c7('0xe9'))},'attachments':[]};if(_0x4f8548['cc']){_0x575429[_0x65c7('0xea')]['Cc']=_0x4f8548['cc'];}if(_0x4f8548['bcc']){_0x575429['headers'][_0x65c7('0xeb')]=_0x4f8548['bcc'];}return new BPromise(function(_0x2aa291,_0x461536){if(_0x4f8548[_0x65c7('0xe3')]){for(var _0x574f95=0x0;_0x574f95<_0x4f8548[_0x65c7('0xe3')]['length'];_0x574f95++){var _0x3137e4=_0x4f8548[_0x65c7('0xe3')][_0x574f95];var _0xb10429=path[_0x65c7('0xda')](_0x49ac25,_0x3137e4['basename']);if(fs[_0x65c7('0xec')](_0xb10429)){_0x575429[_0x65c7('0xdf')]['push']({'name':_0x3137e4[_0x65c7('0x25')],'contentType':_0x3137e4[_0x65c7('0x36')],'data':fs[_0x65c7('0xed')](_0xb10429)});}}}emlformat[_0x65c7('0xee')](_0x575429,function(_0x54a035,_0x27ed5e){if(_0x54a035)return _0x461536(_0x54a035);fs['writeFileSync'](path[_0x65c7('0xda')](_0x4065cb,util['format'](_0x65c7('0xef'),_0x11c91c)),_0x27ed5e);return _0x2aa291(_0x27ed5e);});});})[_0x65c7('0x2e')](function(){return new BPromise(function(_0x2b96e7,_0xecb8ae){zipdir(_0x4065cb,{'saveTo':_0x28cadb},function(_0xd6d6db,_0xe1f428){if(_0xd6d6db)return _0xecb8ae(_0xd6d6db);return _0x2b96e7(_0xe1f428);});})['then'](function(){return new BPromise(function(_0x28183c,_0xe9dc4d){rimraf(_0x4065cb,function(_0xddd61f){if(_0xddd61f)_0xe9dc4d(_0xddd61f);return _0x28183c();});});})['then'](function(){return _0x1d7dbb['download'](_0x28cadb,_0x2b0447,function(_0x4dc18c){if(_0x4dc18c){console[_0x65c7('0xf0')](_0x65c7('0xf1'),_0x4dc18c);}else{fs['unlinkSync'](_0x28cadb);}});});});}else{return _0x1d7dbb['sendStatus'](0xc8);}})['catch'](handleError(_0x1d7dbb,null));}; \ No newline at end of file +var _0x205c=['$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','catch','params','keys','rawAttributes','includeAll','include','options','create','body','describe','addMessage','MailMessage','ids','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','omit','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','Messages','bcc','get','mkdirSync','each','subject','headers','Bcc','Attachments','attachments','build','message%d.eml','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','index','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','color','from','tools_tags','u.id','field','u.fullname','ui.MailInteractionId','left_join','users','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x205c,0x76));var _0xc205=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x205c[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xc205('0x0'));var emlformat=require(_0xc205('0x1'));var rimraf=require(_0xc205('0x2'));var zipdir=require(_0xc205('0x3'));var jsonpatch=require(_0xc205('0x4'));var rp=require('request-promise');var moment=require(_0xc205('0x5'));var BPromise=require(_0xc205('0x6'));var Mustache=require('mustache');var util=require(_0xc205('0x7'));var path=require('path');var sox=require(_0xc205('0x8'));var csv=require('to-csv');var ejs=require(_0xc205('0x9'));var fs=require('fs');var _=require(_0xc205('0xa'));var squel=require('squel');var crypto=require(_0xc205('0xb'));var jsforce=require(_0xc205('0xc'));var deskjs=require(_0xc205('0xd'));var toCsv=require(_0xc205('0xe'));var querystring=require('querystring');var Papa=require(_0xc205('0xf'));var htmlToText=require(_0xc205('0x10'));var Redis=require(_0xc205('0x11'));var authService=require(_0xc205('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc205('0x13'));var hardwareService=require(_0xc205('0x14'));var logger=require(_0xc205('0x15'))(_0xc205('0x16'));var utils=require(_0xc205('0x17'));var config=require(_0xc205('0x18'));var licenseUtil=require(_0xc205('0x19'));var db=require(_0xc205('0x1a'))['db'];config[_0xc205('0x1b')]=_['defaults'](config[_0xc205('0x1b')],{'host':_0xc205('0x1c'),'port':0x18eb});var socket=require(_0xc205('0x1d'))(new Redis(config[_0xc205('0x1b')]));require('./mailInteraction.socket')[_0xc205('0x1e')](socket);function respondWithStatusCode(_0x4f4ef7,_0x4f60e4){_0x4f60e4=_0x4f60e4||0xcc;return function(_0x42a16a){if(_0x42a16a){return _0x4f4ef7[_0xc205('0x1f')](_0x4f60e4);}return _0x4f4ef7[_0xc205('0x20')](_0x4f60e4)[_0xc205('0x21')]();};}function respondWithResult(_0x4b8267,_0xc77df){_0xc77df=_0xc77df||0xc8;return function(_0x481ebe){if(_0x481ebe){return _0x4b8267[_0xc205('0x20')](_0xc77df)[_0xc205('0x22')](_0x481ebe);}};}function respondWithFilteredResult(_0x3889ef,_0x47638f){return function(_0x40e1f8){if(_0x40e1f8){var _0x4730f2=_0x40e1f8[_0xc205('0x23')],_0x3380d9=_0x47638f[_0xc205('0x24')],_0x106fca=_0x47638f[_0xc205('0x24')]+_0x47638f[_0xc205('0x25')],_0xd30915;if(_0x106fca>=_0x4730f2){_0x106fca=_0x4730f2;_0xd30915=0xc8;}else{_0xd30915=0xce;}_0x3889ef['status'](_0xd30915);return _0x3889ef[_0xc205('0x26')](_0xc205('0x27'),_0x3380d9+'-'+_0x106fca+'/'+_0x4730f2)[_0xc205('0x22')](_0x40e1f8);}return null;};}function patchUpdates(_0x4c4c21){return function(_0x4d0497){try{jsonpatch[_0xc205('0x28')](_0x4d0497,_0x4c4c21,!![]);}catch(_0x3966d4){return BPromise['reject'](_0x3966d4);}return _0x4d0497[_0xc205('0x29')]();};}function saveUpdates(_0x2e3b1d,_0x57fe29){return function(_0x4b00a8){if(_0x4b00a8){return _0x4b00a8[_0xc205('0x2a')](_0x2e3b1d)[_0xc205('0x2b')](function(_0x14cb34){return _0x14cb34;});}return null;};}function removeEntity(_0x4cf654,_0x4ac87e){return function(_0x1a4cfe){if(_0x1a4cfe){return _0x1a4cfe[_0xc205('0x2c')]()[_0xc205('0x2b')](function(){_0x4cf654['status'](0xcc)[_0xc205('0x21')]();});}};}function handleEntityNotFound(_0x1ac591,_0x4b7f6f){return function(_0x1e9906){if(!_0x1e9906){_0x1ac591[_0xc205('0x1f')](0x194);}return _0x1e9906;};}function handleError(_0x301245,_0x2ae34e){_0x2ae34e=_0x2ae34e||0x1f4;return function(_0x2a07b7){logger['error'](_0x2a07b7[_0xc205('0x2d')]);if(_0x2a07b7[_0xc205('0x2e')]){delete _0x2a07b7[_0xc205('0x2e')];}_0x301245[_0xc205('0x20')](_0x2ae34e)[_0xc205('0x2f')](_0x2a07b7);};}function getInteractionUsers(_0x210295,_0x7941a9){return new BPromise(function(_0x28a3ae,_0x320283){try{if(_0x7941a9[_0x210295['id']]){_0x210295['Users']=_[_0xc205('0x30')](_0x7941a9[_0x210295['id']],function(_0x3c595e){return{'id':_0x3c595e['id'],'fullname':_0x3c595e['fullname']};});}}catch(_0x180cba){_0x320283(_0x180cba);}_0x28a3ae(_0x210295);});}function getInteractionTags(_0x497d74,_0x43041a){return new BPromise(function(_0x58db41,_0xc75c6){try{if(_0x497d74[_0xc205('0x31')]){_0x497d74[_0xc205('0x32')]=[];_0x497d74[_0xc205('0x31')][_0xc205('0x33')](',')[_0xc205('0x34')](function(_0x4647a2){_0x497d74[_0xc205('0x32')][_0xc205('0x35')](_0x43041a[_0x4647a2]);});}delete _0x497d74['TagIds'];}catch(_0x172843){_0xc75c6(_0x172843);}_0x58db41(_0x497d74);});}function getLastMessageText(_0x34b865){return new BPromise(function(_0x3f34f8,_0x4719a5){return db[_0xc205('0x36')][_0xc205('0x37')]({'where':{'id':_0x34b865['id']},'attributes':[_0xc205('0x38'),_0xc205('0x39')],'raw':!![]})['then'](function(_0x1d18a3){if(!_0x1d18a3[_0xc205('0x39')]){_0x34b865[_0xc205('0x39')]=_[_0xc205('0x3a')](htmlToText[_0xc205('0x3b')](_0x1d18a3['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x34b865[_0xc205('0x39')]=_0x1d18a3[_0xc205('0x39')];}_0x3f34f8(_0x34b865);})['catch'](function(_0x157087){_0x4719a5(_0x157087);});});}function updateMailInteraction(_0x128fe3,_0x24de8f,_0x51b77e,_0x1894a6){return new BPromise(function(_0x234fcf,_0x376aa9){return getInteractionUsers(_0x128fe3,_0x51b77e)[_0xc205('0x2b')](function(_0x19c142){return getInteractionTags(_0x19c142,_0x24de8f);})[_0xc205('0x2b')](function(_0x11fda4){if(_0x1894a6){_0x234fcf(getLastMessageText(_0x11fda4));}else{_0x234fcf(_0x11fda4);}})['catch'](function(_0x606f19){_0x376aa9(_0x606f19);});});}exports[_0xc205('0x3c')]=function(_0x5751c3,_0x539dab){var _0x118ca8={},_0x56be7d={},_0x2fdad4={'count':0x0,'rows':[]};var _0xbb8222=_[_0xc205('0x30')](db[_0xc205('0x36')]['rawAttributes'],function(_0x451c5b){return{'name':_0x451c5b[_0xc205('0x3d')],'type':_0x451c5b[_0xc205('0x3e')]['key']};});_0x56be7d[_0xc205('0x3f')]=_[_0xc205('0x30')](_0xbb8222,_0xc205('0x2e'));_0x56be7d[_0xc205('0x40')]=_['keys'](_0x5751c3['query']);_0x56be7d[_0xc205('0x41')]=_['intersection'](_0x56be7d[_0xc205('0x3f')],_0x56be7d[_0xc205('0x40')]);_0x118ca8['attributes']=_[_0xc205('0x42')](_0x56be7d[_0xc205('0x3f')],qs[_0xc205('0x43')](_0x5751c3[_0xc205('0x40')][_0xc205('0x43')]));_0x118ca8[_0xc205('0x44')]=_0x118ca8[_0xc205('0x44')][_0xc205('0x45')]?_0x118ca8['attributes']:_0x56be7d[_0xc205('0x3f')];if(!_0x5751c3['query'][_0xc205('0x46')](_0xc205('0x47'))){_0x118ca8[_0xc205('0x25')]=qs[_0xc205('0x25')](_0x5751c3[_0xc205('0x40')][_0xc205('0x25')]);_0x118ca8['offset']=qs[_0xc205('0x24')](_0x5751c3[_0xc205('0x40')]['offset']);}_0x118ca8[_0xc205('0x48')]=qs[_0xc205('0x49')](_0x5751c3[_0xc205('0x40')]['sort']);_0x118ca8[_0xc205('0x4a')]=qs[_0xc205('0x41')](_[_0xc205('0x4b')](_0x5751c3[_0xc205('0x40')],_0x56be7d[_0xc205('0x41')]),_0xbb8222);var _0x10c96b=[];var _0x4aed6e=squel[_0xc205('0x4c')]()['field']('id')['field']('name')['field'](_0xc205('0x4d'))[_0xc205('0x4e')](_0xc205('0x4f'));var _0x1a4f8f=squel[_0xc205('0x4c')]()['field'](_0xc205('0x50'))[_0xc205('0x51')](_0xc205('0x52'))['field'](_0xc205('0x53'))[_0xc205('0x4e')]('user_has_mail_interactions','ui')[_0xc205('0x54')](_0xc205('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x22ad26=squel['select']()[_0xc205('0x4e')](_0xc205('0x56'),'i')[_0xc205('0x54')](_0xc205('0x57'),'c',_0xc205('0x58'))[_0xc205('0x54')]('users','o','o.id\x20=\x20i.UserId')[_0xc205('0x54')](_0xc205('0x59'),'a',_0xc205('0x5a'))[_0xc205('0x54')](_0xc205('0x5b'),'me',_0xc205('0x5c'))['left_join'](_0xc205('0x5d'),'it','it.MailInteractionId\x20=\x20i.id')[_0xc205('0x54')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x4d63e4=squel['expr']();var _0x1e0b07=[];var _0x4c30f7=squel['expr']();var _0x5018f7;if(_0x5751c3[_0xc205('0x40')][_0xc205('0x5e')]){_0x5018f7=as[_0xc205('0x5f')](_0x5751c3[_0xc205('0x40')][_0xc205('0x5e')]);var _0x4e1f8a=_0x5018f7[_0xc205('0x60')];for(var _0x4c132a=0x0;_0x4c132a<_0x5018f7[_0xc205('0x61')][_0xc205('0x45')];_0x4c132a++){var _0x129648=_0x5018f7['conditions'][_0x4c132a];var _0x48112c='i';var _0x4b0114=_[_0xc205('0x62')](_0xbb8222,[_0xc205('0x2e'),_0x129648['field']]);if(!_0x4b0114){switch(_0x129648[_0xc205('0x51')]){case'unreadMessages':if(_0x129648[_0xc205('0x63')]==0x1){_0x22ad26[_0xc205('0x64')]('`'+_0x129648[_0xc205('0x51')]+'`\x20=\x200');}else{_0x22ad26[_0xc205('0x64')]('`'+_0x129648['field']+_0xc205('0x65'));}break;case'Contact':if(_0x129648['operator']==='$substring'){if(_0x129648['value'][_0xc205('0x33')]('\x20')[_0xc205('0x45')]>0x1){_0x4d63e4[_0x4e1f8a](_0xc205('0x66'),qs[_0xc205('0x67')](_0x129648['value']),null);}else{var _0x4e6a8d='%'+_0x129648[_0xc205('0x63')]+'%';_0x4d63e4[_0x4e1f8a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4e6a8d,_0x4e6a8d,_0x4e6a8d);}}else{_0x4b0114=_[_0xc205('0x62')](_0xbb8222,[_0xc205('0x2e'),_0xc205('0x68')]);_0x129648[_0xc205('0x51')]='ContactId';_0x44b7c0=as[_0xc205('0x69')](_0x48112c,_0x4b0114[_0xc205('0x3e')],_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x21')]);}break;case _0xc205('0x6c'):var _0x57c8d1=_0x129648[_0xc205('0x63')][_0xc205('0x33')](',')[_0xc205('0x30')](function(_0x3c83a7){return Number(_0x3c83a7);});_0x57c8d1[_0xc205('0x34')](function(_0x24ecf5){_0x4c30f7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x24ecf5+',%');});_0x1e0b07=_['union'](_0x1e0b07,_0x57c8d1);break;case _0xc205('0x6d'):if(_0x129648[_0xc205('0x6e')]===_0xc205('0x6f')){_0x4d63e4[_0x4e1f8a](_0xc205('0x70'),'%'+_0x129648[_0xc205('0x63')]+'%',null);}else{_0x4b0114=_[_0xc205('0x62')](_0xbb8222,['name',_0xc205('0x71')]);_0x129648[_0xc205('0x51')]=_0xc205('0x71');_0x44b7c0=as[_0xc205('0x69')](_0x48112c,_0x4b0114[_0xc205('0x3e')],_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')]['end']);}break;case _0xc205('0x72'):_0x44b7c0=as[_0xc205('0x69')]('me',null,_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0['value'][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')]['end']);break;}}else{var _0x44b7c0=as[_0xc205('0x69')](_0x48112c,_0x4b0114[_0xc205('0x3e')],_0x129648);_0x4d63e4[_0x4e1f8a](_0x44b7c0[_0xc205('0x6a')],_0x44b7c0['value'][_0xc205('0x6b')],_0x44b7c0[_0xc205('0x63')][_0xc205('0x21')]);}}}else{var _0x49884=_(_0x5751c3[_0xc205('0x40')])['keys']()[_0xc205('0x30')](function(_0x52df78){return _[_0xc205('0x73')](_0xbb8222,[_0xc205('0x2e'),_0x52df78])?_0x52df78:undefined;})[_0xc205('0x74')]()[_0xc205('0x63')]();if(!_['isEmpty'](_0x49884)){_0x49884['forEach'](function(_0x28c66a){if(_0x28c66a===_0xc205('0x75')){_0x22ad26[_0xc205('0x4a')](_0xc205('0x76'),[][_0xc205('0x77')](_0x5751c3['query'][_0x28c66a]));}else if(_0x28c66a===_0xc205('0x78')){var _0x1cbb0d=JSON[_0xc205('0x79')](_0x5751c3['query'][_0x28c66a])['$gte'];var _0x2cabb0=JSON[_0xc205('0x79')](_0x5751c3['query'][_0x28c66a])[_0xc205('0x7a')];_0x22ad26['where'](_0xc205('0x7b'),_0x1cbb0d,_0x2cabb0);}else{if(_0x5751c3[_0xc205('0x40')][_0x28c66a]===_0xc205('0x7c')){_0x22ad26['where']('i.'+_0x28c66a+_0xc205('0x7d'));}else{_0x22ad26[_0xc205('0x4a')]('i.'+_0x28c66a+_0xc205('0x7e'),_0x5751c3[_0xc205('0x40')][_0x28c66a]);}}});}if(_0x5751c3[_0xc205('0x40')][_0xc205('0x7f')]){if(_0x5751c3[_0xc205('0x40')][_0xc205('0x7f')]==0x1){_0x22ad26[_0xc205('0x64')](_0xc205('0x80'));}else{_0x22ad26['having'](_0xc205('0x81'));}}if(_0x5751c3[_0xc205('0x40')][_0xc205('0x82')]){_0x1e0b07=_[_0xc205('0x83')](_0x5751c3[_0xc205('0x40')][_0xc205('0x82')])?_0x5751c3[_0xc205('0x40')][_0xc205('0x82')]:new Array(_0x5751c3[_0xc205('0x40')]['tag']);_0x1e0b07[_0xc205('0x34')](function(_0x5f0998){_0x4c30f7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5f0998+',%');});}if(_0x5751c3[_0xc205('0x40')][_0xc205('0x84')]){var _0x410e7f=_0x5751c3['query'][_0xc205('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc205('0x85')](_0x410e7f)){_0x4d63e4['or'](_0xc205('0x86'),_0x410e7f+'%');}else if(qs[_0xc205('0x87')](_0x410e7f)){_0x4d63e4['or'](_0xc205('0x88'),_0x410e7f+'%');}else{_0x4d63e4['or'](_0xc205('0x89'),qs[_0xc205('0x67')](_0x410e7f))['or'](_0xc205('0x8a'),qs[_0xc205('0x67')](_0x410e7f));}}}_0x22ad26['where'](_0x4d63e4);_0x22ad26[_0xc205('0x8b')](_0xc205('0x8c'));var _0x18e3f1={'type':db[_0xc205('0x8d')][_0xc205('0x8e')][_0xc205('0x8f')],'raw':!![]};var _0xde2cca=_0x22ad26['clone']();_0xde2cca[_0xc205('0x51')]('i.id');_0xde2cca[_0xc205('0x51')](_0xc205('0x90'),_0xc205('0x91'));if(_0x118ca8[_0xc205('0x48')]){_0x118ca8['order'][_0xc205('0x34')](function(_0x5f1069){var _0x4f911c=_0x5f1069[0x0]==='contactName'?_0x5f1069[0x0]:'i.'+_0x5f1069[0x0];_0x22ad26['order'](_0x4f911c,_0x5f1069[0x1]===_0xc205('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x1e0b07)){_0x22ad26[_0xc205('0x64')](_0x4c30f7);_0xde2cca[_0xc205('0x4a')](_0xc205('0x93'),_0x1e0b07);}BPromise['resolve']()[_0xc205('0x2b')](function(){if(!_0x5018f7){if(_0x5751c3['query'][_0xc205('0x75')]||_0x5751c3[_0xc205('0x40')]['journey'])return;_0xde2cca[_0xc205('0x4a')](_0xc205('0x94'));_0x22ad26[_0xc205('0x4a')](_0xc205('0x94'));return;}if(_0x5751c3[_0xc205('0x95')][_0xc205('0x96')]!=='agent')return;return _0x5751c3[_0xc205('0x95')][_0xc205('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x7286f3){if(_[_0xc205('0x98')](_0x7286f3)){_0xde2cca[_0xc205('0x4a')](_0xc205('0x99'));_0x22ad26[_0xc205('0x4a')](_0xc205('0x99'));}else{_0xde2cca['where']('i.MailAccountId\x20IN\x20?',_['map'](_0x7286f3,'id'));_0x22ad26[_0xc205('0x4a')]('i.MailAccountId\x20IN\x20?',_['map'](_0x7286f3,'id'));}});})[_0xc205('0x2b')](function(){if(_0x5751c3[_0xc205('0x95')][_0xc205('0x96')]===_0xc205('0x9a')&&!_0x5018f7&&!_0x5751c3[_0xc205('0x40')]['MailAccountId'])return[];return db['sequelize'][_0xc205('0x40')](_0xde2cca['toString'](),_0x18e3f1);})[_0xc205('0x2b')](function(_0x8744f){_0x2fdad4[_0xc205('0x23')]=_0x8744f[_0xc205('0x45')];if(_0x2fdad4['count']===0x0)return[];return db[_0xc205('0x9b')][_0xc205('0x40')](_0x4aed6e[_0xc205('0x9c')](),_0x18e3f1)[_0xc205('0x2b')](function(_0x236c95){_0x10c96b=_[_0xc205('0x9d')](_0x236c95,'id');_0x18e3f1=_[_0xc205('0x9e')](_0x18e3f1,{'model':db[_0xc205('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5751c3[_0xc205('0x40')][_0xc205('0x43')]){_0x118ca8[_0xc205('0x44')]['forEach'](function(_0x1df61c){_0x22ad26[_0xc205('0x51')]('i.'+_0x1df61c);});}else{_0x22ad26[_0xc205('0x51')](_0xc205('0x90'),'unreadMessages');_0x22ad26[_0xc205('0x51')](_0xc205('0x9f'),_0xc205('0xa0'));_0x22ad26['field'](_0xc205('0xa1'),_0xc205('0xa2'));_0x22ad26[_0xc205('0x51')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xc205('0xa3'));_0x22ad26[_0xc205('0x51')](_0xc205('0x8c'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa4'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa5'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa6'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa7'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa8'));_0x22ad26[_0xc205('0x51')](_0xc205('0xa9'));_0x22ad26[_0xc205('0x51')](_0xc205('0xaa'));_0x22ad26[_0xc205('0x51')](_0xc205('0xab'));_0x22ad26[_0xc205('0x51')](_0xc205('0xac'));_0x22ad26[_0xc205('0x51')](_0xc205('0xad'));_0x22ad26[_0xc205('0x51')](_0xc205('0xae'));_0x22ad26['field'](_0xc205('0xaf'));_0x22ad26[_0xc205('0x51')](_0xc205('0xb0'));_0x22ad26[_0xc205('0x51')]('i.ContactId');_0x22ad26[_0xc205('0x51')](_0xc205('0xb1'));_0x22ad26['field'](_0xc205('0xb2'));_0x22ad26[_0xc205('0x51')]('c.firstName','Contact.firstName');_0x22ad26[_0xc205('0x51')](_0xc205('0xb3'),'Contact.lastName');_0x22ad26[_0xc205('0x51')](_0xc205('0xb4'),_0xc205('0xb5'));_0x22ad26['field'](_0xc205('0xb6'),'Contact.phone');_0x22ad26[_0xc205('0x51')](_0xc205('0xb7'),'Contact.mobile');_0x22ad26[_0xc205('0x51')]('c.fax',_0xc205('0xb8'));_0x22ad26[_0xc205('0x51')](_0xc205('0xb9'),_0xc205('0xba'));_0x22ad26[_0xc205('0x51')](_0xc205('0xbb'),'Owner.internal');_0x22ad26[_0xc205('0x51')](_0xc205('0xbc'),'TagIds');}if(_0x118ca8['limit'])_0x22ad26[_0xc205('0x25')](_0x118ca8['limit']);if(_0x118ca8[_0xc205('0x24')])_0x22ad26[_0xc205('0x24')](_0x118ca8[_0xc205('0x24')]);return db['sequelize']['query'](_0x22ad26[_0xc205('0x9c')](),_0x18e3f1);})[_0xc205('0x2b')](function(_0x3152c6){_0x1a4f8f[_0xc205('0x4a')](_0xc205('0xbd'),_[_0xc205('0x30')](_0x3152c6,'id'));return db[_0xc205('0x9b')][_0xc205('0x40')](_0x1a4f8f[_0xc205('0x9c')](),_0x18e3f1)[_0xc205('0x2b')](function(_0x5630b6){var _0x298317=_[_0xc205('0xbe')](_0x5630b6,_0xc205('0xbf'));var _0x3fb044=[];return db[_0xc205('0xc0')][_0xc205('0x37')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x32a7cb){var _0x14aa01=_0x32a7cb[_0xc205('0xc1')];_0x3152c6[_0xc205('0x34')](function(_0x416f14){_0x3fb044['push'](updateMailInteraction(_0x416f14,_0x10c96b,_0x298317,_0x14aa01));});return BPromise[_0xc205('0xc2')](_0x3fb044);});});});})[_0xc205('0x2b')](function(_0xb3ba1e){_0x2fdad4[_0xc205('0xc3')]=_0xb3ba1e;return _0x2fdad4;})[_0xc205('0x2b')](respondWithFilteredResult(_0x539dab,_0x118ca8))[_0xc205('0xc4')](handleError(_0x539dab,null));};exports['show']=function(_0x96b585,_0x3af1f4){var _0x54fcb0={'raw':![],'where':{'id':_0x96b585[_0xc205('0xc5')]['id']}},_0x121d64={};_0x121d64['model']=_[_0xc205('0xc6')](db[_0xc205('0x36')][_0xc205('0xc7')]);_0x121d64['query']=_[_0xc205('0xc6')](_0x96b585[_0xc205('0x40')]);_0x121d64[_0xc205('0x41')]=_['intersection'](_0x121d64['model'],_0x121d64[_0xc205('0x40')]);_0x54fcb0['attributes']=_[_0xc205('0x42')](_0x121d64[_0xc205('0x3f')],qs['fields'](_0x96b585[_0xc205('0x40')][_0xc205('0x43')]));_0x54fcb0[_0xc205('0x44')]=_0x54fcb0[_0xc205('0x44')][_0xc205('0x45')]?_0x54fcb0['attributes']:_0x121d64[_0xc205('0x3f')];if(_0x96b585[_0xc205('0x40')][_0xc205('0xc8')]){_0x54fcb0[_0xc205('0xc9')]=[{'all':!![]}];}_0x54fcb0=_[_0xc205('0x9e')]({},_0x54fcb0,_0x96b585[_0xc205('0xca')]);return db[_0xc205('0x36')][_0xc205('0x62')](_0x54fcb0)[_0xc205('0x2b')](handleEntityNotFound(_0x3af1f4,null))[_0xc205('0x2b')](respondWithResult(_0x3af1f4,null))['catch'](handleError(_0x3af1f4,null));};exports[_0xc205('0xcb')]=function(_0xcf69b,_0x35776c){return db['MailInteraction'][_0xc205('0xcb')](_0xcf69b[_0xc205('0xcc')],{})[_0xc205('0x2b')](respondWithResult(_0x35776c,0xc9))[_0xc205('0xc4')](handleError(_0x35776c,null));};exports[_0xc205('0x2a')]=function(_0x498116,_0xa1b49c){if(_0x498116[_0xc205('0xcc')]['id']){delete _0x498116[_0xc205('0xcc')]['id'];}return db[_0xc205('0x36')][_0xc205('0x62')]({'where':{'id':_0x498116[_0xc205('0xc5')]['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0xa1b49c,null))['then'](saveUpdates(_0x498116[_0xc205('0xcc')],null))['then'](respondWithResult(_0xa1b49c,null))[_0xc205('0xc4')](handleError(_0xa1b49c,null));};exports[_0xc205('0x2c')]=function(_0x2414e4,_0x153cd3){return db[_0xc205('0x36')]['find']({'where':{'id':_0x2414e4[_0xc205('0xc5')]['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0x153cd3,null))['then'](removeEntity(_0x153cd3,null))[_0xc205('0xc4')](handleError(_0x153cd3,null));};exports[_0xc205('0xcd')]=function(_0x527950,_0xbfbd6){return db['MailInteraction'][_0xc205('0xcd')]()['then'](respondWithResult(_0xbfbd6,null))[_0xc205('0xc4')](handleError(_0xbfbd6,null));};exports[_0xc205('0xce')]=function(_0x3a1058,_0x40cb13,_0x58fc8b){return db[_0xc205('0xcf')][_0xc205('0x62')]({'where':{'id':_0x3a1058[_0xc205('0xc5')]['id']}})['then'](handleEntityNotFound(_0x40cb13,null))[_0xc205('0x2b')](function(_0x4dc890){if(_0x4dc890){return _0x4dc890[_0xc205('0xce')](_0x3a1058['body'][_0xc205('0xd0')],_['omit'](_0x3a1058[_0xc205('0xcc')],['ids','id'])||{});}})[_0xc205('0x2b')](respondWithResult(_0x40cb13,null))[_0xc205('0xc4')](handleError(_0x40cb13,null));};exports[_0xc205('0xd1')]=function(_0x2177e0,_0x370660,_0x41e88f){var _0x5994bf={'raw':![],'where':{}};var _0x28e9e0={};var _0x431471={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x2177e0[_0xc205('0xc5')]['id']}})['then'](handleEntityNotFound(_0x370660,null))[_0xc205('0x2b')](function(_0x218199){if(_0x218199){_0x28e9e0['model']=_['keys'](db[_0xc205('0xcf')][_0xc205('0xc7')]);_0x28e9e0[_0xc205('0x40')]=_[_0xc205('0xc6')](_0x2177e0[_0xc205('0x40')]);_0x28e9e0['filters']=_[_0xc205('0x42')](_0x28e9e0['model'],_0x28e9e0[_0xc205('0x40')]);_0x5994bf[_0xc205('0x44')]=_[_0xc205('0x42')](_0x28e9e0[_0xc205('0x3f')],qs['fields'](_0x2177e0[_0xc205('0x40')]['fields']));_0x5994bf[_0xc205('0x44')]=_0x5994bf[_0xc205('0x44')][_0xc205('0x45')]?_0x5994bf[_0xc205('0x44')]:_0x28e9e0['model'];if(!_0x2177e0['query'][_0xc205('0x46')]('nolimit')){_0x5994bf['limit']=qs[_0xc205('0x25')](_0x2177e0[_0xc205('0x40')][_0xc205('0x25')]);_0x5994bf[_0xc205('0x24')]=qs[_0xc205('0x24')](_0x2177e0[_0xc205('0x40')]['offset']);}_0x5994bf['order']=qs[_0xc205('0x49')](_0x2177e0[_0xc205('0x40')]['sort']);_0x5994bf[_0xc205('0x4a')]=qs['filters'](_['pick'](_0x2177e0['query'],_0x28e9e0[_0xc205('0x41')]));_0x5994bf[_0xc205('0x4a')][_0xc205('0xbf')]=_0x218199['id'];if(_0x2177e0[_0xc205('0x40')][_0xc205('0x84')]){_0x5994bf[_0xc205('0x4a')]=_[_0xc205('0x9e')](_0x5994bf[_0xc205('0x4a')],{'$or':_[_0xc205('0x30')](_0x5994bf[_0xc205('0x44')],function(_0x32050f){var _0x57d52b={};_0x57d52b[_0x32050f]={'$like':'%'+_0x2177e0['query']['filter']+'%'};return _0x57d52b;})});}if(_0x2177e0['query'][_0xc205('0xd2')]){var _0x5eb281=_0x2177e0[_0xc205('0x40')][_0xc205('0xd2')]['split'](',');var _0x4a4613={};_0x4a4613[_0x5eb281[0x0]]={'$gte':moment(_0x5eb281[0x1])[_0xc205('0xd3')](_0xc205('0xd4'))};_0x5994bf[_0xc205('0x4a')]=_['merge'](_0x5994bf[_0xc205('0x4a')],_0x4a4613);}_0x5994bf=_[_0xc205('0x9e')]({},_0x5994bf,_0x2177e0[_0xc205('0xca')]);return db[_0xc205('0xcf')][_0xc205('0x23')]({'where':_0x5994bf['where']})[_0xc205('0x2b')](function(_0x233e70){_0x431471[_0xc205('0x23')]=_0x233e70;if(_0x2177e0[_0xc205('0x40')][_0xc205('0xc8')]){_0x5994bf[_0xc205('0xc9')]=[{'all':!![]}];}return db[_0xc205('0xcf')]['findAll'](_0x5994bf);})[_0xc205('0x2b')](function(_0x56a585){_0x431471['rows']=_0x56a585;return _0x431471;});}})[_0xc205('0x2b')](respondWithFilteredResult(_0x370660,_0x5994bf))[_0xc205('0xc4')](handleError(_0x370660,null));};exports['addTags']=function(_0x437392,_0x28cf58,_0x54d745){return db['MailInteraction'][_0xc205('0x62')]({'where':{'id':_0x437392[_0xc205('0xc5')]['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0x28cf58,null))[_0xc205('0x2b')](function(_0x92fd8e){if(_0x92fd8e){return _0x92fd8e[_0xc205('0xd5')](_0x437392['body'][_0xc205('0xd0')],_[_0xc205('0xd6')](_0x437392[_0xc205('0xcc')],[_0xc205('0xd0'),'id'])||{})[_0xc205('0xd7')](function(){return db['Tag'][_0xc205('0xd8')]({'attributes':['id',_0xc205('0x2e'),_0xc205('0x4d')],'where':{'id':_0x437392['body'][_0xc205('0xd0')]}});})[_0xc205('0x2b')](function(_0x3ec697){socket[_0xc205('0xd9')](_0xc205('0xda'),{'id':Number(_0x437392['params']['id']),'tags':_0x3ec697||[]});return{'id':Number(_0x437392[_0xc205('0xc5')]['id']),'tags':_0x3ec697||[]};});}})[_0xc205('0x2b')](respondWithResult(_0x28cf58,null))[_0xc205('0xc4')](handleError(_0x28cf58,null));};exports[_0xc205('0xdb')]=function(_0x569c4c,_0x2481b6,_0xdc454e){return db[_0xc205('0x36')][_0xc205('0x62')]({'where':{'id':_0x569c4c['params']['id']}})[_0xc205('0x2b')](handleEntityNotFound(_0x2481b6,null))['then'](function(_0x240a54){if(_0x240a54){return _0x240a54[_0xc205('0xdb')](_0x569c4c[_0xc205('0x40')][_0xc205('0xd0')]);}})[_0xc205('0x2b')](respondWithStatusCode(_0x2481b6,null))['catch'](handleError(_0x2481b6,null));};exports[_0xc205('0xdc')]=function(_0x14abb3,_0x3d29f6){var _0x4f11af=moment()[_0xc205('0xdd')]()[_0xc205('0x9c')]();var _0x22ce0a=path[_0xc205('0xde')](config[_0xc205('0xdf')],_0xc205('0xe0'),_0xc205('0xe1'),'tmp');var _0x19195a=path[_0xc205('0xde')](config[_0xc205('0xdf')],_0xc205('0xe0'),_0xc205('0xe1'),'attachments');var _0x3789c9=path['join'](_0x22ce0a,_0x4f11af);var _0xb24577=util[_0xc205('0xd3')]('transcript-%d-%s.zip',_0x14abb3[_0xc205('0xc5')]['id'],_0x4f11af);var _0x287fcd=path['join'](_0x22ce0a,_0xb24577);var _0x5a47b1=[];if(_0x14abb3[_0xc205('0x40')]['attachments']){_0x5a47b1[_0xc205('0x35')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4909d4=[{'model':db['MailMessage'],'as':_0xc205('0xe2'),'attributes':['id',_0xc205('0xcc'),_0xc205('0x4e'),'to','cc',_0xc205('0xe3'),'subject',_0xc205('0x78')],'where':{'secret':![]},'order':qs[_0xc205('0x49')]('id'),'include':_0x5a47b1}];return db['MailInteraction'][_0xc205('0x62')]({'where':{'id':_0x14abb3[_0xc205('0xc5')]['id']},'include':_0x4909d4})['then'](handleEntityNotFound(_0x3d29f6,null))['then'](function(_0x3fa981){if(_0x3fa981&&_0x3fa981['Messages']){var _0x30eb76=_0x3fa981[_0xc205('0xe4')]({'plain':!![]});fs[_0xc205('0xe5')](_0x3789c9);return BPromise[_0xc205('0xe6')](_0x30eb76[_0xc205('0xe2')],function(_0x2a47bb,_0xa6f7e5){var _0xfd6100={'from':_0x2a47bb['from'],'to':_0x2a47bb['to'],'subject':_0x2a47bb[_0xc205('0xe7')],'html':_0x2a47bb[_0xc205('0xcc')],'headers':{'Date':moment(_0x2a47bb[_0xc205('0x78')])[_0xc205('0xd3')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2a47bb['cc']){_0xfd6100[_0xc205('0xe8')]['Cc']=_0x2a47bb['cc'];}if(_0x2a47bb['bcc']){_0xfd6100[_0xc205('0xe8')][_0xc205('0xe9')]=_0x2a47bb['bcc'];}return new BPromise(function(_0x38ea0f,_0x3d370f){if(_0x2a47bb[_0xc205('0xea')]){for(var _0x1586cb=0x0;_0x1586cb<_0x2a47bb[_0xc205('0xea')][_0xc205('0x45')];_0x1586cb++){var _0x6b4ab9=_0x2a47bb['Attachments'][_0x1586cb];var _0x4ad603=path[_0xc205('0xde')](_0x19195a,_0x6b4ab9['basename']);if(fs['existsSync'](_0x4ad603)){_0xfd6100[_0xc205('0xeb')][_0xc205('0x35')]({'name':_0x6b4ab9[_0xc205('0x2e')],'contentType':_0x6b4ab9[_0xc205('0x3e')],'data':fs['readFileSync'](_0x4ad603)});}}}emlformat[_0xc205('0xec')](_0xfd6100,function(_0x5cacd0,_0x309fd0){if(_0x5cacd0)return _0x3d370f(_0x5cacd0);fs['writeFileSync'](path[_0xc205('0xde')](_0x3789c9,util[_0xc205('0xd3')](_0xc205('0xed'),_0xa6f7e5)),_0x309fd0);return _0x38ea0f(_0x309fd0);});});})[_0xc205('0x2b')](function(){return new BPromise(function(_0x36eccd,_0x47d9fa){zipdir(_0x3789c9,{'saveTo':_0x287fcd},function(_0x3bb079,_0xcde86c){if(_0x3bb079)return _0x47d9fa(_0x3bb079);return _0x36eccd(_0xcde86c);});})['then'](function(){return new BPromise(function(_0x4ef0d9,_0xc2a7f4){rimraf(_0x3789c9,function(_0x57973b){if(_0x57973b)_0xc2a7f4(_0x57973b);return _0x4ef0d9();});});})['then'](function(){return _0x3d29f6[_0xc205('0xdc')](_0x287fcd,_0xb24577,function(_0x562f95){if(_0x562f95){console[_0xc205('0xee')](_0xc205('0xef'),_0x562f95);}else{fs['unlinkSync'](_0x287fcd);}});});});}else{return _0x3d29f6['sendStatus'](0xc8);}})[_0xc205('0xc4')](handleError(_0x3d29f6,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3d20025..3c1c337 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 _0x4b9b=['then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers'];(function(_0x178cc6,_0x115f6f){var _0x23f980=function(_0x1ff81f){while(--_0x1ff81f){_0x178cc6['push'](_0x178cc6['shift']());}};_0x23f980(++_0x115f6f);}(_0x4b9b,0x1c5));var _0xb4b9=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x4b9b[_0x32f9ca];return _0x52e083;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xb4b9('0x0'))['db'][_0xb4b9('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xb4b9('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb4b9('0x3'),'afterDestroy':_0xb4b9('0x4')};function emitEvent(_0x73ec12){return function(_0x5290dc,_0x1fb6b0,_0x3b135d){_0x5290dc[_0xb4b9('0x5')]({'attributes':['id'],'raw':!![]})[_0xb4b9('0x6')](function(_0x5bdb18){_0x5290dc[_0xb4b9('0x7')](_0xb4b9('0x8'),_0x5bdb18['map'](function(_0x49b9d8){return{'id':_0x49b9d8['id']};}));return MailMessage[_0xb4b9('0x9')]({'where':{'MailInteractionId':_0x5290dc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4b9('0x6')](function(_0x47b4f8){_0x5290dc[_0xb4b9('0x7')](_0xb4b9('0xa'),_0x47b4f8[_0xb4b9('0xb')]);MailInteractionEvents[_0xb4b9('0xc')](_0x73ec12+':'+_0x5290dc['id'],_0x5290dc);MailInteractionEvents[_0xb4b9('0xc')](_0x73ec12,_0x5290dc);_0x3b135d(null);})[_0xb4b9('0xd')](_0x3b135d(null));};}for(var e in events){if(events[_0xb4b9('0xe')](e)){var event=events[e];MailInteraction[_0xb4b9('0xf')](e,emitEvent(event));}}module[_0xb4b9('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x5806=['MailInteraction','MailMessage','setMaxListeners','update','remove','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x332fe1,_0x276196){var _0x45a0dc=function(_0x383cd9){while(--_0x383cd9){_0x332fe1['push'](_0x332fe1['shift']());}};_0x45a0dc(++_0x276196);}(_0x5806,0x1a7));var _0x6580=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x5806[_0x55677b];return _0x104b88;};'use strict';var EventEmitter=require(_0x6580('0x0'));var MailInteraction=require(_0x6580('0x1'))['db'][_0x6580('0x2')];var MailMessage=require(_0x6580('0x1'))['db'][_0x6580('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6580('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6580('0x5'),'afterDestroy':_0x6580('0x6')};function emitEvent(_0x5ca02c){return function(_0x177eed,_0x452d13,_0x10254b){_0x177eed['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x196555){_0x177eed[_0x6580('0x7')]('Users',_0x196555[_0x6580('0x8')](function(_0x27e188){return{'id':_0x27e188['id']};}));return MailMessage[_0x6580('0x9')]({'where':{'MailInteractionId':_0x177eed['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6580('0xa')](function(_0xf32aff){_0x177eed['setDataValue'](_0x6580('0xb'),_0xf32aff[_0x6580('0xc')]);MailInteractionEvents[_0x6580('0xd')](_0x5ca02c+':'+_0x177eed['id'],_0x177eed);MailInteractionEvents[_0x6580('0xd')](_0x5ca02c,_0x177eed);_0x10254b(null);})[_0x6580('0xe')](_0x10254b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6580('0xf')](e,emitEvent(event));}}module[_0x6580('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0ce1588..0203858 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 _0x402b=['path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5305a2,_0xd1483c){var _0x2a2064=function(_0x342406){while(--_0x342406){_0x5305a2['push'](_0x5305a2['shift']());}};_0x2a2064(++_0xd1483c);}(_0x402b,0x1bb));var _0xb402=function(_0x209fd5,_0x2035a8){_0x209fd5=_0x209fd5-0x0;var _0x1f8f75=_0x402b[_0x209fd5];return _0x1f8f75;};'use strict';var _=require(_0xb402('0x0'));var util=require('util');var logger=require(_0xb402('0x1'))(_0xb402('0x2'));var moment=require(_0xb402('0x3'));var BPromise=require('bluebird');var rp=require(_0xb402('0x4'));var fs=require('fs');var path=require(_0xb402('0x5'));var rimraf=require('rimraf');var config=require(_0xb402('0x6'));var attributes=require(_0xb402('0x7'));module[_0xb402('0x8')]=function(_0x37d1e6,_0x3d96be){return _0x37d1e6[_0xb402('0x9')](_0xb402('0xa'),attributes,{'tableName':_0xb402('0xb'),'paranoid':![],'indexes':[{'name':_0xb402('0xc'),'fields':['subject','to'],'type':_0xb402('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x125cc7,_0x1ec115,_0x148dcf){if(_0x125cc7[_0xb402('0xe')]){_0x125cc7[_0xb402('0xf')]=moment()[_0xb402('0x10')](_0xb402('0x11'));}if(_0x125cc7[_0xb402('0x12')]){_0x125cc7[_0xb402('0x13')]=moment()[_0xb402('0x10')](_0xb402('0x11'));}_0x148dcf(null,_0x1ec115);},'beforeUpdate':function(_0x3f3132,_0x41b8bd,_0x471add){if(_0x3f3132[_0xb402('0x14')](_0xb402('0xe'))){_0x3f3132[_0xb402('0xf')]=_0x3f3132[_0xb402('0xe')]?moment()[_0xb402('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3f3132[_0xb402('0x14')]('closed')){_0x3f3132[_0xb402('0x13')]=moment()['format'](_0xb402('0x11'));_0x3f3132[_0xb402('0xe')]=null;_0x3f3132[_0xb402('0xf')]=null;}_0x471add(null,_0x3f3132);},'afterUpdate':function(_0x964ffb,_0x373c92,_0x1cb1a5){var _0x145a2d=_0x37d1e6[_0xb402('0x15')];var _0x3428a6=_0x964ffb[_0xb402('0x16')]({'plain':!![]});if(_0x3428a6[_0xb402('0x12')]){return _0x145a2d[_0xb402('0x17')][_0xb402('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3428a6['id']}})[_0xb402('0x19')](function(){_0x1cb1a5();})[_0xb402('0x1a')](function(_0x129dba){_0x1cb1a5(_0x129dba);});}else{_0x1cb1a5();}}},'charset':'utf8mb4','collate':_0xb402('0x1b')});}; \ No newline at end of file +var _0x1020=['then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','update'];(function(_0x98dc8a,_0x1064e6){var _0x34c560=function(_0x225879){while(--_0x225879){_0x98dc8a['push'](_0x98dc8a['shift']());}};_0x34c560(++_0x1064e6);}(_0x1020,0x1a4));var _0x0102=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x1020[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x0102('0x0'));var util=require('util');var logger=require(_0x0102('0x1'))(_0x0102('0x2'));var moment=require(_0x0102('0x3'));var BPromise=require(_0x0102('0x4'));var rp=require(_0x0102('0x5'));var fs=require('fs');var path=require(_0x0102('0x6'));var rimraf=require(_0x0102('0x7'));var config=require(_0x0102('0x8'));var attributes=require(_0x0102('0x9'));module[_0x0102('0xa')]=function(_0x27dd86,_0x3afe31){return _0x27dd86['define'](_0x0102('0xb'),attributes,{'tableName':_0x0102('0xc'),'paranoid':![],'indexes':[{'name':_0x0102('0xd'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x88bf17,_0x566659,_0x47fac0){if(_0x88bf17[_0x0102('0xe')]){_0x88bf17[_0x0102('0xf')]=moment()[_0x0102('0x10')](_0x0102('0x11'));}if(_0x88bf17[_0x0102('0x12')]){_0x88bf17['closedAt']=moment()[_0x0102('0x10')](_0x0102('0x11'));}_0x47fac0(null,_0x566659);},'beforeUpdate':function(_0xd75f51,_0x1af71f,_0x1945cf){if(_0xd75f51[_0x0102('0x13')](_0x0102('0xe'))){_0xd75f51[_0x0102('0xf')]=_0xd75f51[_0x0102('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xd75f51[_0x0102('0x13')](_0x0102('0x12'))){_0xd75f51[_0x0102('0x14')]=moment()[_0x0102('0x10')](_0x0102('0x11'));_0xd75f51[_0x0102('0xe')]=null;_0xd75f51[_0x0102('0xf')]=null;}_0x1945cf(null,_0xd75f51);},'afterUpdate':function(_0x2e0c35,_0x3b7253,_0x2493fe){var _0x38fab3=_0x27dd86['models'];var _0x2ca87b=_0x2e0c35['get']({'plain':!![]});if(_0x2ca87b['closed']){return _0x38fab3['MailMessage'][_0x0102('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x2ca87b['id']}})[_0x0102('0x16')](function(){_0x2493fe();})[_0x0102('0x17')](function(_0x1a0afe){_0x2493fe(_0x1a0afe);});}else{_0x2493fe();}}},'charset':_0x0102('0x18'),'collate':_0x0102('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3b0805e..d15ad68 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 _0xd0d5=['options','where','attributes','limit','info','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','debug','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0xa56399,_0x543112){_0xa56399=_0xa56399-0x0;var _0x1f5d70=_0xd0d5[_0xa56399];return _0x1f5d70;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d0d('0x0'));var db=require(_0x5d0d('0x1'))['db'];var utils=require(_0x5d0d('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d0d('0x3'));var jayson=require(_0x5d0d('0x4'));var client=jayson[_0x5d0d('0x5')][_0x5d0d('0x6')]({'port':0x232a});config['redis']=_[_0x5d0d('0x7')](config[_0x5d0d('0x8')],{'host':_0x5d0d('0x9'),'port':0x18eb});var socket=require(_0x5d0d('0xa'))(new Redis(config[_0x5d0d('0x8')]));require('./mailInteraction.socket')[_0x5d0d('0xb')](socket);function respondWithRpcPromise(_0x59e827,_0x2e3af3,_0x14d579){return new BPromise(function(_0x27f539,_0x3fdb1){return client[_0x5d0d('0xc')](_0x59e827,_0x14d579)[_0x5d0d('0xd')](function(_0x2b95e3){logger['info'](_0x5d0d('0xe'),_0x2e3af3,_0x5d0d('0xf'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2e3af3,_0x5d0d('0xf'),JSON[_0x5d0d('0x10')](_0x2b95e3));if(_0x2b95e3[_0x5d0d('0x11')]){if(_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x12')]===0x1f4){logger[_0x5d0d('0x11')](_0x5d0d('0xe'),_0x2e3af3,_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x13')]);return _0x3fdb1(_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x13')]);}logger[_0x5d0d('0x11')](_0x5d0d('0xe'),_0x2e3af3,_0x2b95e3[_0x5d0d('0x11')]['message']);return _0x27f539(_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x13')]);}else{logger['info'](_0x5d0d('0xe'),_0x2e3af3,_0x5d0d('0xf'));_0x27f539(_0x2b95e3[_0x5d0d('0x14')][_0x5d0d('0x13')]);}})[_0x5d0d('0x15')](function(_0x1e83a8){logger[_0x5d0d('0x11')](_0x5d0d('0xe'),_0x2e3af3,_0x1e83a8);_0x3fdb1(_0x1e83a8);});});}exports[_0x5d0d('0x16')]=function(_0x5091b7){var _0x1a505d=this;return new Promise(function(_0x145d36,_0x29c332){return db['MailInteraction'][_0x5d0d('0x17')](_0x5091b7[_0x5d0d('0x18')],{'raw':_0x5091b7[_0x5d0d('0x19')]?_0x5091b7[_0x5d0d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5091b7['options']?_0x5091b7[_0x5d0d('0x19')][_0x5d0d('0x1a')]||null:null,'attributes':_0x5091b7['options']?_0x5091b7[_0x5d0d('0x19')][_0x5d0d('0x1b')]||null:null,'limit':_0x5091b7[_0x5d0d('0x19')]?_0x5091b7[_0x5d0d('0x19')][_0x5d0d('0x1c')]||null:null})[_0x5d0d('0xd')](function(_0x1ca18f){logger[_0x5d0d('0x1d')](_0x5d0d('0x16'),_0x5091b7);logger['debug'](_0x5d0d('0x16'),_0x5091b7,JSON[_0x5d0d('0x10')](_0x1ca18f));_0x145d36(_0x1ca18f);})[_0x5d0d('0x15')](function(_0x4394a5){logger[_0x5d0d('0x11')](_0x5d0d('0x16'),_0x4394a5[_0x5d0d('0x13')],_0x5091b7);_0x29c332(_0x1a505d[_0x5d0d('0x11')](0x1f4,_0x4394a5[_0x5d0d('0x13')]));});});};exports[_0x5d0d('0x1e')]=function(_0xe56390){return new Promise(function(_0x45a25a,_0x2f88ea){return db['MailInteraction']['find']({'where':_0xe56390['options']?_0xe56390[_0x5d0d('0x19')][_0x5d0d('0x1a')]||null:null})[_0x5d0d('0xd')](function(_0x53dfb4){if(_0x53dfb4){return _0x53dfb4[_0x5d0d('0x1f')](_0xe56390[_0x5d0d('0x18')][_0x5d0d('0x20')],_[_0x5d0d('0x21')](_0xe56390[_0x5d0d('0x18')],[_0x5d0d('0x20'),'id'])||{});}})[_0x5d0d('0x22')](function(_0x27adfe){logger['info'](_0x5d0d('0x23'),_0xe56390);logger[_0x5d0d('0x24')](_0x5d0d('0x23'),_0xe56390,JSON['stringify'](_0x27adfe));_0x45a25a(_0x27adfe);})[_0x5d0d('0x15')](function(_0x454084){logger[_0x5d0d('0x11')](_0x5d0d('0x23'),_0x454084[_0x5d0d('0x13')],_0xe56390);_0x2f88ea(_this['error'](0x1f4,_0x454084[_0x5d0d('0x13')]));});});}; \ No newline at end of file +var _0x4d41=['message','info','result','catch','UpdateMailInteraction','update','body','options','raw','where','limit','debug','AddTagsToMailInteraction','find','then','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x166146,_0x1f34c6){var _0x9c7390=function(_0x1e368c){while(--_0x1e368c){_0x166146['push'](_0x166146['shift']());}};_0x9c7390(++_0x1f34c6);}(_0x4d41,0x153));var _0x14d4=function(_0x35c12c,_0x378ba0){_0x35c12c=_0x35c12c-0x0;var _0x2bab3a=_0x4d41[_0x35c12c];return _0x2bab3a;};'use strict';var _=require(_0x14d4('0x0'));var util=require(_0x14d4('0x1'));var moment=require(_0x14d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d4('0x3'));var fs=require('fs');var Redis=require(_0x14d4('0x4'));var db=require(_0x14d4('0x5'))['db'];var utils=require(_0x14d4('0x6'));var logger=require(_0x14d4('0x7'))(_0x14d4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14d4('0x9')][_0x14d4('0xa')]({'port':0x232a});config[_0x14d4('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x14d4('0xc'))(new Redis(config[_0x14d4('0xb')]));require(_0x14d4('0xd'))[_0x14d4('0xe')](socket);function respondWithRpcPromise(_0x4dab73,_0x54ed12,_0x14e477){return new BPromise(function(_0x3031cc,_0x2f4309){return client['request'](_0x4dab73,_0x14e477)['then'](function(_0x1469e2){logger['info'](_0x14d4('0xf'),_0x54ed12,_0x14d4('0x10'));logger['debug'](_0x14d4('0x11'),_0x54ed12,_0x14d4('0x10'),JSON[_0x14d4('0x12')](_0x1469e2));if(_0x1469e2[_0x14d4('0x13')]){if(_0x1469e2[_0x14d4('0x13')][_0x14d4('0x14')]===0x1f4){logger[_0x14d4('0x13')](_0x14d4('0xf'),_0x54ed12,_0x1469e2[_0x14d4('0x13')]['message']);return _0x2f4309(_0x1469e2[_0x14d4('0x13')][_0x14d4('0x15')]);}logger[_0x14d4('0x13')]('MailInteraction,\x20%s,\x20%s',_0x54ed12,_0x1469e2[_0x14d4('0x13')][_0x14d4('0x15')]);return _0x3031cc(_0x1469e2[_0x14d4('0x13')][_0x14d4('0x15')]);}else{logger[_0x14d4('0x16')](_0x14d4('0xf'),_0x54ed12,_0x14d4('0x10'));_0x3031cc(_0x1469e2[_0x14d4('0x17')][_0x14d4('0x15')]);}})[_0x14d4('0x18')](function(_0x75287d){logger[_0x14d4('0x13')]('MailInteraction,\x20%s,\x20%s',_0x54ed12,_0x75287d);_0x2f4309(_0x75287d);});});}exports[_0x14d4('0x19')]=function(_0x25499b){var _0x3b754f=this;return new Promise(function(_0x5abf23,_0x321f4a){return db['MailInteraction'][_0x14d4('0x1a')](_0x25499b[_0x14d4('0x1b')],{'raw':_0x25499b[_0x14d4('0x1c')]?_0x25499b[_0x14d4('0x1c')][_0x14d4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25499b['options']?_0x25499b[_0x14d4('0x1c')][_0x14d4('0x1e')]||null:null,'attributes':_0x25499b[_0x14d4('0x1c')]?_0x25499b['options']['attributes']||null:null,'limit':_0x25499b[_0x14d4('0x1c')]?_0x25499b[_0x14d4('0x1c')][_0x14d4('0x1f')]||null:null})['then'](function(_0x2ffca8){logger[_0x14d4('0x16')]('UpdateMailInteraction',_0x25499b);logger[_0x14d4('0x20')](_0x14d4('0x19'),_0x25499b,JSON[_0x14d4('0x12')](_0x2ffca8));_0x5abf23(_0x2ffca8);})[_0x14d4('0x18')](function(_0x4ed285){logger[_0x14d4('0x13')]('UpdateMailInteraction',_0x4ed285['message'],_0x25499b);_0x321f4a(_0x3b754f[_0x14d4('0x13')](0x1f4,_0x4ed285[_0x14d4('0x15')]));});});};exports[_0x14d4('0x21')]=function(_0x9fa275){return new Promise(function(_0x4e15dd,_0x3aa339){return db['MailInteraction'][_0x14d4('0x22')]({'where':_0x9fa275[_0x14d4('0x1c')]?_0x9fa275['options'][_0x14d4('0x1e')]||null:null})[_0x14d4('0x23')](function(_0x567149){if(_0x567149){return _0x567149[_0x14d4('0x24')](_0x9fa275[_0x14d4('0x1b')][_0x14d4('0x25')],_['omit'](_0x9fa275['body'],[_0x14d4('0x25'),'id'])||{});}})[_0x14d4('0x26')](function(_0x55fcd1){logger[_0x14d4('0x16')]('AddTags',_0x9fa275);logger[_0x14d4('0x20')]('AddTags',_0x9fa275,JSON[_0x14d4('0x12')](_0x55fcd1));_0x4e15dd(_0x55fcd1);})[_0x14d4('0x18')](function(_0xb5de8b){logger[_0x14d4('0x13')](_0x14d4('0x27'),_0xb5de8b[_0x14d4('0x15')],_0x9fa275);_0x3aa339(_this[_0x14d4('0x13')](0x1f4,_0xb5de8b[_0x14d4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 9b89e3b..6640f37 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 _0x75f5=['removeListener','register','length','./mailInteraction.events','save','update','emit'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x75f5,0xce));var _0x575f=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x75f5[_0x236d24];return _0x1574cf;};'use strict';var MailInteractionEvents=require(_0x575f('0x0'));var events=[_0x575f('0x1'),'remove',_0x575f('0x2')];function createListener(_0x5ac165,_0x4d7527){return function(_0xa43066){_0x4d7527[_0x575f('0x3')](_0x5ac165,_0xa43066);};}function removeListener(_0x44788a,_0x4bf6bd){return function(){MailInteractionEvents[_0x575f('0x4')](_0x44788a,_0x4bf6bd);};}exports[_0x575f('0x5')]=function(_0xc121f8){for(var _0x3c2a84=0x0,_0x4ca08d=events[_0x575f('0x6')];_0x3c2a84<_0x4ca08d;_0x3c2a84++){var _0x42e6b0=events[_0x3c2a84];var _0xfc1214=createListener('mailInteraction:'+_0x42e6b0,_0xc121f8);MailInteractionEvents['on'](_0x42e6b0,_0xfc1214);}}; \ No newline at end of file +var _0x70f2=['save','emit','removeListener','register','length','mailInteraction:'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x70f2,0x7e));var _0x270f=function(_0x23db34,_0x530e6e){_0x23db34=_0x23db34-0x0;var _0x5bd878=_0x70f2[_0x23db34];return _0x5bd878;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x270f('0x0'),'remove','update'];function createListener(_0x20326f,_0x13b056){return function(_0x355896){_0x13b056[_0x270f('0x1')](_0x20326f,_0x355896);};}function removeListener(_0xda7ad0,_0x3c89c4){return function(){MailInteractionEvents[_0x270f('0x2')](_0xda7ad0,_0x3c89c4);};}exports[_0x270f('0x3')]=function(_0x4a1c07){for(var _0x3b6850=0x0,_0xb64db6=events[_0x270f('0x4')];_0x3b6850<_0xb64db6;_0x3b6850++){var _0x2a0337=events[_0x3b6850];var _0x3db212=createListener(_0x270f('0x5')+_0x2a0337,_0x4a1c07);MailInteractionEvents['on'](_0x2a0337,_0x3db212);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cdfb3aa..9b36a3e 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 _0x7da7=['./mailMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x7da7,0x10d));var _0x77da=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x7da7[_0x2a56ad];return _0x425175;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['get'](_0x77da('0xe'),auth[_0x77da('0x7')](),controller[_0x77da('0xf')]);router['post']('/',auth[_0x77da('0x7')](),interaction[_0x77da('0x10')](_0x77da('0x11'),_0x77da('0x12')),controller['create']);router[_0x77da('0x13')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller['update']);router['put'](_0x77da('0x14'),auth[_0x77da('0x7')](),controller['accept']);router[_0x77da('0x13')](_0x77da('0x15'),auth[_0x77da('0x7')](),controller[_0x77da('0x16')]);router['delete'](_0x77da('0xc'),auth['isAuthenticated'](),controller[_0x77da('0x17')]);module[_0x77da('0x18')]=router; \ No newline at end of file +var _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x98a8,0x12c));var _0x898a=function(_0x456973,_0x4385c5){_0x456973=_0x456973-0x0;var _0x26c314=_0x98a8[_0x456973];return _0x26c314;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 04b2be2..e36c62e 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 _0x0760=['TEXT','long','DATE','INTEGER','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x6899c7,_0x363413){var _0x5186ee=function(_0x2f83a9){while(--_0x2f83a9){_0x6899c7['push'](_0x6899c7['shift']());}};_0x5186ee(++_0x363413);}(_0x0760,0xa9));var _0x0076=function(_0x1503cd,_0x4018e7){_0x1503cd=_0x1503cd-0x0;var _0x5f2be0=_0x0760[_0x1503cd];return _0x5f2be0;};'use strict';var Sequelize=require(_0x0076('0x0'));var _=require('lodash');module[_0x0076('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x0076('0x2'))},'read':{'type':Sequelize[_0x0076('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0076('0x4')]('in',_0x0076('0x5')),'defaultValue':_0x0076('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x0076('0x6')]},'to':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))},'cc':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))},'bcc':{'type':Sequelize['TEXT'](_0x0076('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x0076('0x9')]},'attach':{'type':Sequelize[_0x0076('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0076('0x9')]},'originTo':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))},'originCc':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))}}; \ No newline at end of file +var _0x5b6e=['lodash','TEXT','medium','BOOLEAN','out','STRING','long','INTEGER','sequelize'];(function(_0x652866,_0x4c1b7c){var _0xe26c4c=function(_0x177502){while(--_0x177502){_0x652866['push'](_0x652866['shift']());}};_0xe26c4c(++_0x4c1b7c);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x139713,_0x4d9d1d){_0x139713=_0x139713-0x0;var _0x49d7ac=_0x5b6e[_0x139713];return _0x49d7ac;};'use strict';var Sequelize=require(_0xe5b6('0x0'));var _=require(_0xe5b6('0x1'));module['exports']={'body':{'type':Sequelize[_0xe5b6('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe5b6('0x2')](_0xe5b6('0x3'))},'read':{'type':Sequelize[_0xe5b6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe5b6('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe5b6('0x6')](0x1fe)},'from':{'type':Sequelize[_0xe5b6('0x6')]},'to':{'type':Sequelize[_0xe5b6('0x2')]('long')},'cc':{'type':Sequelize[_0xe5b6('0x2')](_0xe5b6('0x7'))},'bcc':{'type':Sequelize[_0xe5b6('0x2')]('long')},'subject':{'type':Sequelize[_0xe5b6('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xe5b6('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe5b6('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xe5b6('0x2')](_0xe5b6('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xe5b6('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index a438416..143b9b1 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 _0xe079=['channel','EventManager','acceptmessage','mail-interactions','agent','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','rejectmessage','download','unix','server','files','tmp','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','push','readFileSync','build','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','sendStatus','count','offset','limit','status','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','body','find','describe','create','direction','out','secret','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','Contact','get','UserId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','SIP/%s'];(function(_0x31c0e5,_0x472b48){var _0x16dce4=function(_0x3fe675){while(--_0x3fe675){_0x31c0e5['push'](_0x31c0e5['shift']());}};_0x16dce4(++_0x472b48);}(_0xe079,0x166));var _0x9e07=function(_0x27dd4d,_0x303ac8){_0x27dd4d=_0x27dd4d-0x0;var _0x5820ce=_0xe079[_0x27dd4d];return _0x5820ce;};'use strict';var pdf=require(_0x9e07('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9e07('0x1'));var zipdir=require(_0x9e07('0x2'));var jsonpatch=require(_0x9e07('0x3'));var rp=require(_0x9e07('0x4'));var moment=require(_0x9e07('0x5'));var BPromise=require(_0x9e07('0x6'));var Mustache=require('mustache');var util=require(_0x9e07('0x7'));var path=require(_0x9e07('0x8'));var sox=require(_0x9e07('0x9'));var csv=require(_0x9e07('0xa'));var ejs=require(_0x9e07('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9e07('0xc'));var crypto=require(_0x9e07('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e07('0xe'));var Redis=require('ioredis');var authService=require(_0x9e07('0xf'));var qs=require(_0x9e07('0x10'));var as=require(_0x9e07('0x11'));var hardwareService=require(_0x9e07('0x12'));var logger=require(_0x9e07('0x13'))(_0x9e07('0x14'));var utils=require('../../config/utils');var config=require(_0x9e07('0x15'));var licenseUtil=require(_0x9e07('0x16'));var db=require(_0x9e07('0x17'))['db'];config['redis']=_[_0x9e07('0x18')](config[_0x9e07('0x19')],{'host':_0x9e07('0x1a'),'port':0x18eb});var socket=require(_0x9e07('0x1b'))(new Redis(config[_0x9e07('0x19')]));require(_0x9e07('0x1c'))['register'](socket);var jayson=require(_0x9e07('0x1d'));var client=jayson[_0x9e07('0x1e')][_0x9e07('0x1f')]({'port':0x232c});var client9003=jayson['client'][_0x9e07('0x1f')]({'port':0x232b});var client9002=jayson['client'][_0x9e07('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x25f2d1,_0x4fc772,_0x23f92c,_0x17cb59){return new BPromise(function(_0x417c3a,_0x112536){var _0x27805b=_0x17cb59||client;return _0x27805b[_0x9e07('0x20')](_0x25f2d1,_0x23f92c)[_0x9e07('0x21')](function(_0x21f357){logger[_0x9e07('0x22')](_0x9e07('0x23'),_0x4fc772,'request\x20sent');logger['debug'](_0x9e07('0x24'),_0x4fc772,_0x9e07('0x25'),JSON[_0x9e07('0x26')](_0x21f357));if(_0x21f357['error']){if(_0x21f357['error'][_0x9e07('0x27')]===0x1f4){logger[_0x9e07('0x28')](_0x9e07('0x23'),_0x4fc772,_0x21f357[_0x9e07('0x28')][_0x9e07('0x29')]);return _0x112536(_0x21f357[_0x9e07('0x28')][_0x9e07('0x29')]);}logger[_0x9e07('0x28')](_0x9e07('0x23'),_0x4fc772,_0x21f357[_0x9e07('0x28')]['message']);return _0x417c3a(_0x21f357[_0x9e07('0x28')]['message']);}else{logger[_0x9e07('0x22')](_0x9e07('0x23'),_0x4fc772,'request\x20sent');_0x417c3a(_0x21f357['result']['message']);}})[_0x9e07('0x2a')](function(_0x14d746){logger[_0x9e07('0x28')](_0x9e07('0x23'),_0x4fc772,_0x14d746);_0x112536(_0x14d746);});});}function respondWithStatusCode(_0x3a04ca,_0x79c9f7){_0x79c9f7=_0x79c9f7||0xcc;return function(_0x358ad7){if(_0x358ad7){return _0x3a04ca[_0x9e07('0x2b')](_0x79c9f7);}return _0x3a04ca['status'](_0x79c9f7)['end']();};}function respondWithResult(_0x54ffc4,_0x235260){_0x235260=_0x235260||0xc8;return function(_0x46cc8a){if(_0x46cc8a){return _0x54ffc4['status'](_0x235260)['json'](_0x46cc8a);}};}function respondWithFilteredResult(_0x4973a5,_0x537e70){return function(_0x49a57d){if(_0x49a57d){var _0x7c5817=_0x49a57d[_0x9e07('0x2c')],_0x12bd8d=_0x537e70['offset'],_0x46428a=_0x537e70[_0x9e07('0x2d')]+_0x537e70[_0x9e07('0x2e')],_0x64ffab;if(_0x46428a>=_0x7c5817){_0x46428a=_0x7c5817;_0x64ffab=0xc8;}else{_0x64ffab=0xce;}_0x4973a5[_0x9e07('0x2f')](_0x64ffab);return _0x4973a5['set'](_0x9e07('0x30'),_0x12bd8d+'-'+_0x46428a+'/'+_0x7c5817)[_0x9e07('0x31')](_0x49a57d);}return null;};}function patchUpdates(_0x5768b2){return function(_0x2c0ccd){try{jsonpatch[_0x9e07('0x32')](_0x2c0ccd,_0x5768b2,!![]);}catch(_0x297e56){return BPromise[_0x9e07('0x33')](_0x297e56);}return _0x2c0ccd[_0x9e07('0x34')]();};}function saveUpdates(_0x2668c1,_0x3d5e4b){return function(_0x4fe9d7){if(_0x4fe9d7){return _0x4fe9d7[_0x9e07('0x35')](_0x2668c1)[_0x9e07('0x21')](function(_0x37f664){return _0x37f664;});}return null;};}function removeEntity(_0x266070,_0x25bd10){return function(_0x36a1ce){if(_0x36a1ce){return _0x36a1ce[_0x9e07('0x36')]()[_0x9e07('0x21')](function(){_0x266070['status'](0xcc)[_0x9e07('0x37')]();});}};}function handleEntityNotFound(_0x2fa14d,_0x4280c7){return function(_0x37a249){if(!_0x37a249){_0x2fa14d['sendStatus'](0x194);}return _0x37a249;};}function handleError(_0x218ad5,_0xebad26){_0xebad26=_0xebad26||0x1f4;return function(_0x2ac2ed){logger[_0x9e07('0x28')](_0x2ac2ed[_0x9e07('0x38')]);if(_0x2ac2ed[_0x9e07('0x39')]){delete _0x2ac2ed[_0x9e07('0x39')];}_0x218ad5[_0x9e07('0x2f')](_0xebad26)[_0x9e07('0x3a')](_0x2ac2ed);};}exports['index']=function(_0x5a49e1,_0x3b5c7f){var _0x573d61={},_0x2b1e1c={},_0x49a60c={'count':0x0,'rows':[]};var _0x384f2f=_[_0x9e07('0x3b')](db[_0x9e07('0x3c')][_0x9e07('0x3d')],function(_0x29f080){return{'name':_0x29f080[_0x9e07('0x3e')],'type':_0x29f080[_0x9e07('0x3f')][_0x9e07('0x40')]};});_0x2b1e1c[_0x9e07('0x41')]=_['map'](_0x384f2f,_0x9e07('0x39'));_0x2b1e1c[_0x9e07('0x42')]=_[_0x9e07('0x43')](_0x5a49e1[_0x9e07('0x42')]);_0x2b1e1c[_0x9e07('0x44')]=_['intersection'](_0x2b1e1c['model'],_0x2b1e1c[_0x9e07('0x42')]);_0x573d61[_0x9e07('0x45')]=_[_0x9e07('0x46')](_0x2b1e1c[_0x9e07('0x41')],qs[_0x9e07('0x47')](_0x5a49e1['query']['fields']));_0x573d61['attributes']=_0x573d61[_0x9e07('0x45')][_0x9e07('0x48')]?_0x573d61[_0x9e07('0x45')]:_0x2b1e1c['model'];if(!_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x49')](_0x9e07('0x4a'))){_0x573d61[_0x9e07('0x2e')]=qs[_0x9e07('0x2e')](_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x2e')]);_0x573d61[_0x9e07('0x2d')]=qs['offset'](_0x5a49e1[_0x9e07('0x42')]['offset']);}_0x573d61[_0x9e07('0x4b')]=qs[_0x9e07('0x4c')](_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x4c')]);_0x573d61[_0x9e07('0x4d')]=qs[_0x9e07('0x44')](_[_0x9e07('0x4e')](_0x5a49e1['query'],_0x2b1e1c[_0x9e07('0x44')]),_0x384f2f);if(_0x5a49e1[_0x9e07('0x42')]['filter']){_0x573d61[_0x9e07('0x4d')]=_[_0x9e07('0x4f')](_0x573d61[_0x9e07('0x4d')],{'$or':_[_0x9e07('0x3b')](_0x384f2f,function(_0x10249b){if(_0x10249b[_0x9e07('0x3f')]!==_0x9e07('0x50')){var _0x6f1908={};_0x6f1908[_0x10249b[_0x9e07('0x39')]]={'$like':'%'+_0x5a49e1['query'][_0x9e07('0x51')]+'%'};return _0x6f1908;}})});}_0x573d61=_[_0x9e07('0x4f')]({},_0x573d61,_0x5a49e1['options']);var _0x3066da={'where':_0x573d61['where']};return db[_0x9e07('0x3c')][_0x9e07('0x2c')](_0x3066da)[_0x9e07('0x21')](function(_0xc0b29b){_0x49a60c[_0x9e07('0x2c')]=_0xc0b29b;if(_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x52')]){_0x573d61[_0x9e07('0x53')]=[{'all':!![]}];}return db[_0x9e07('0x3c')][_0x9e07('0x54')](_0x573d61);})[_0x9e07('0x21')](function(_0x1dc8b5){_0x49a60c[_0x9e07('0x55')]=_0x1dc8b5;return _0x49a60c;})['then'](respondWithFilteredResult(_0x3b5c7f,_0x573d61))[_0x9e07('0x2a')](handleError(_0x3b5c7f,null));};exports[_0x9e07('0x56')]=function(_0x15e2b9,_0x42f659){var _0x2033da={'raw':!![],'where':{'id':_0x15e2b9[_0x9e07('0x57')]['id']}},_0x2695de={};_0x2695de[_0x9e07('0x41')]=_[_0x9e07('0x43')](db[_0x9e07('0x3c')][_0x9e07('0x3d')]);_0x2695de[_0x9e07('0x42')]=_[_0x9e07('0x43')](_0x15e2b9[_0x9e07('0x42')]);_0x2695de[_0x9e07('0x44')]=_[_0x9e07('0x46')](_0x2695de['model'],_0x2695de[_0x9e07('0x42')]);_0x2033da[_0x9e07('0x45')]=_[_0x9e07('0x46')](_0x2695de[_0x9e07('0x41')],qs[_0x9e07('0x47')](_0x15e2b9[_0x9e07('0x42')]['fields']));_0x2033da[_0x9e07('0x45')]=_0x2033da[_0x9e07('0x45')][_0x9e07('0x48')]?_0x2033da[_0x9e07('0x45')]:_0x2695de[_0x9e07('0x41')];if(_0x15e2b9[_0x9e07('0x42')]['includeAll']){_0x2033da[_0x9e07('0x53')]=[{'all':!![]}];}_0x2033da=_['merge']({},_0x2033da,_0x15e2b9[_0x9e07('0x58')]);return db['MailMessage']['find'](_0x2033da)[_0x9e07('0x21')](handleEntityNotFound(_0x42f659,null))['then'](respondWithResult(_0x42f659,null))[_0x9e07('0x2a')](handleError(_0x42f659,null));};exports[_0x9e07('0x35')]=function(_0x14d9fa,_0x53c00f){if(_0x14d9fa[_0x9e07('0x59')]['id']){delete _0x14d9fa[_0x9e07('0x59')]['id'];}return db[_0x9e07('0x3c')][_0x9e07('0x5a')]({'where':{'id':_0x14d9fa[_0x9e07('0x57')]['id']}})[_0x9e07('0x21')](handleEntityNotFound(_0x53c00f,null))[_0x9e07('0x21')](saveUpdates(_0x14d9fa[_0x9e07('0x59')],null))[_0x9e07('0x21')](respondWithResult(_0x53c00f,null))[_0x9e07('0x2a')](handleError(_0x53c00f,null));};exports[_0x9e07('0x36')]=function(_0x46781d,_0x1d7d50){return db['MailMessage'][_0x9e07('0x5a')]({'where':{'id':_0x46781d[_0x9e07('0x57')]['id']}})[_0x9e07('0x21')](handleEntityNotFound(_0x1d7d50,null))[_0x9e07('0x21')](removeEntity(_0x1d7d50,null))[_0x9e07('0x2a')](handleError(_0x1d7d50,null));};exports[_0x9e07('0x5b')]=function(_0x1fd9a5,_0x1ebcf6){return db[_0x9e07('0x3c')][_0x9e07('0x5b')]()[_0x9e07('0x21')](respondWithResult(_0x1ebcf6,null))[_0x9e07('0x2a')](handleError(_0x1ebcf6,null));};exports[_0x9e07('0x5c')]=function(_0x55c82e,_0x48be65){return db['MailMessage'][_0x9e07('0x5c')](_0x55c82e[_0x9e07('0x59')])[_0x9e07('0x21')](function(_0x2368c3){if(_0x2368c3){if(_0x2368c3[_0x9e07('0x5d')]===_0x9e07('0x5e')&&!_0x2368c3[_0x9e07('0x5f')]){var _0x3c2a0f,_0x500926,_0x251902;if(_0x55c82e['body']['to']){_0x500926=_0x55c82e[_0x9e07('0x59')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2368c3[_0x9e07('0x60')]},'include':[{'model':db[_0x9e07('0x61')],'as':_0x9e07('0x62'),'include':[{'model':db[_0x9e07('0x63')],'as':_0x9e07('0x64'),'where':{'email':_0x500926},'limit':0x1,'order':[['updatedAt',_0x9e07('0x65')]]}]},{'model':db[_0x9e07('0x66')],'as':_0x9e07('0x67'),'raw':!![]}]})[_0x9e07('0x21')](function(_0x52c9f0){_0x3c2a0f=_0x52c9f0;if(_0x3c2a0f&&_0x3c2a0f['Smtp']){var _0x4c33be={'tls':{'rejectUnauthorized':![]}};if(_[_0x9e07('0x68')](_0x3c2a0f[_0x9e07('0x67')]['service'])){_0x4c33be[_0x9e07('0x69')]=_0x3c2a0f['Smtp'][_0x9e07('0x69')];_0x4c33be['port']=_0x3c2a0f['Smtp'][_0x9e07('0x6a')];_0x4c33be[_0x9e07('0x6b')]=_0x3c2a0f[_0x9e07('0x67')]['secure'];if(_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x6c')]){_0x4c33be[_0x9e07('0x6d')]={'user':_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x6e')],'pass':_0x3c2a0f['Smtp'][_0x9e07('0x6f')]};}}else{_0x4c33be['service']=_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x70')];_0x4c33be[_0x9e07('0x6d')]={'user':_0x3c2a0f['Smtp'][_0x9e07('0x6e')],'pass':_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x6f')]};_0x4c33be[_0x9e07('0x6b')]=_0x3c2a0f['Smtp'][_0x9e07('0x6b')];}if(_0x55c82e[_0x9e07('0x59')][_0x9e07('0x71')]&&_0x55c82e[_0x9e07('0x59')][_0x9e07('0x71')][_0x9e07('0x48')]){for(var _0x420e34=0x0;_0x420e34<_0x55c82e['body'][_0x9e07('0x71')][_0x9e07('0x48')];_0x420e34+=0x1){_0x55c82e['body'][_0x9e07('0x71')][_0x420e34]={'filename':_0x55c82e['body'][_0x9e07('0x71')][_0x420e34][_0x9e07('0x39')],'path':path[_0x9e07('0x72')](config[_0x9e07('0x73')],_0x9e07('0x74'),_0x55c82e[_0x9e07('0x59')]['attachments'][_0x420e34][_0x9e07('0x75')])};}}_0x251902={'account':_0x4c33be,'message':_0x55c82e[_0x9e07('0x59')]};return;}})[_0x9e07('0x21')](function(){if(_0x3c2a0f[_0x9e07('0x62')]){if(_0x3c2a0f[_0x9e07('0x62')]['Contacts'][_0x9e07('0x48')]){return _0x3c2a0f[_0x9e07('0x62')][_0x9e07('0x64')][0x0];}else{return db['CmContact'][_0x9e07('0x5c')](_['defaults'](_0x55c82e[_0x9e07('0x59')],{'firstName':_0x55c82e[_0x9e07('0x59')]['to'],'email':_0x55c82e[_0x9e07('0x59')]['to'],'phone':_0x55c82e[_0x9e07('0x59')]['to'],'ListId':_0x3c2a0f['ListId']}));}}else{throw new Error(_0x9e07('0x76'));}})[_0x9e07('0x21')](function(){if(_0x251902){return respondWithRpcPromise(_0x9e07('0x77'),'sendMail',_0x251902,client9003)[_0x9e07('0x21')](function(_0x45348a){return _0x2368c3[_0x9e07('0x35')]({'read':!![],'messageId':_0x45348a[_0x9e07('0x78')],'sentAt':moment()[_0x9e07('0x79')](_0x9e07('0x7a'))});})[_0x9e07('0x2a')](function(_0x149421){logger['error']('%s',JSON[_0x9e07('0x26')](_0x149421));return _0x2368c3;});}return _0x2368c3;});}return _0x2368c3;}})['then'](respondWithResult(_0x48be65,0xc9))[_0x9e07('0x2a')](handleError(_0x48be65,null));};var interaction_log=require(_0x9e07('0x13'))('mail-interactions');exports[_0x9e07('0x7b')]=function(_0x1a5d9,_0x1374aa,_0x5785e3){var _0x4a7894={'channel':_0x9e07('0x7c')};if(_0x1a5d9['body']['id']){delete _0x1a5d9[_0x9e07('0x59')]['id'];}_0x1a5d9[_0x9e07('0x59')]['read']=!![];_0x1a5d9['body'][_0x9e07('0x7d')]=moment()[_0x9e07('0x79')](_0x9e07('0x7a'));_0x1a5d9[_0x9e07('0x59')]['UserId']=_0x1a5d9[_0x9e07('0x59')]['UserId']||_0x1a5d9['user']['id'];return db[_0x9e07('0x3c')][_0x9e07('0x5a')]({'where':{'id':_0x1a5d9[_0x9e07('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9e07('0x7e')}]})[_0x9e07('0x21')](handleEntityNotFound(_0x1374aa,null))[_0x9e07('0x21')](saveUpdates(_0x1a5d9[_0x9e07('0x59')],null))[_0x9e07('0x21')](function(_0x55f79b){if(_0x55f79b){_0x4a7894[_0x9e07('0x29')]=_0x55f79b[_0x9e07('0x7f')]({'plain':!![]});return db['MailInteraction'][_0x9e07('0x5a')]({'where':{'id':_0x55f79b['MailInteractionId']}});}return null;})[_0x9e07('0x21')](handleEntityNotFound(_0x1374aa,null))[_0x9e07('0x21')](function(_0x4fc264){if(_0x4fc264){return _0x4fc264[_0x9e07('0x35')]({'UserId':_0x1a5d9[_0x9e07('0x59')][_0x9e07('0x80')],'read1stAt':_[_0x9e07('0x68')](_0x4fc264[_0x9e07('0x81')])?moment()[_0x9e07('0x79')](_0x9e07('0x7a')):undefined});}return null;})[_0x9e07('0x21')](function(_0x5402cb){if(_0x5402cb){_0x4a7894[_0x9e07('0x82')]=_0x5402cb[_0x9e07('0x7f')]({'plain':!![]});interaction_log[_0x9e07('0x22')](_0x9e07('0x83'),_0x1a5d9[_0x9e07('0x6e')]['id'],_0x1a5d9[_0x9e07('0x6e')][_0x9e07('0x39')],_0x1a5d9[_0x9e07('0x6e')][_0x9e07('0x84')],_0x4a7894['interaction']['id'],_0x1a5d9[_0x9e07('0x59')]?JSON['stringify'](_0x1a5d9[_0x9e07('0x59')]):_0x9e07('0x85'));return respondWithRpcPromise('AcceptMessage',_0x9e07('0x86'),_0x4a7894);}return null;})['then'](function(_0x9fc055){if(_0x9fc055){if(_0x1a5d9['body']['manual']){_0x4a7894[_0x9e07('0x29')][_0x9e07('0x87')]=util['format'](_0x9e07('0x88'),_0x1a5d9[_0x9e07('0x6e')][_0x9e07('0x39')]);_0x4a7894[_0x9e07('0x29')][_0x9e07('0x89')]=_0x4a7894[_0x9e07('0x89')];_0x4a7894[_0x9e07('0x29')]['event']=_0x9e07('0x7b');return respondWithRpcPromise(_0x9e07('0x8a'),_0x9e07('0x8a'),{'event':_0x9e07('0x8b'),'message':_0x4a7894[_0x9e07('0x29')]},client9002)[_0x9e07('0x21')](function(){return _0x4a7894;});}return _0x4a7894;}return null;})[_0x9e07('0x21')](respondWithResult(_0x1374aa,null))[_0x9e07('0x2a')](handleError(_0x1374aa,null));};var interaction_log=require(_0x9e07('0x13'))(_0x9e07('0x8c'));exports[_0x9e07('0x33')]=function(_0x3127ba,_0x41444d,_0x1bbed0){var _0xe9245d={'agent':{},'channel':_0x9e07('0x7c')};if(_0x3127ba[_0x9e07('0x59')]['id']){delete _0x3127ba[_0x9e07('0x59')]['id'];}_0x3127ba[_0x9e07('0x59')][_0x9e07('0x80')]=_0x3127ba[_0x9e07('0x59')][_0x9e07('0x80')]||_0x3127ba['user']['id'];_0xe9245d[_0x9e07('0x8d')]['id']=_0x3127ba[_0x9e07('0x59')][_0x9e07('0x80')];return db[_0x9e07('0x3c')][_0x9e07('0x5a')]({'where':{'id':_0x3127ba[_0x9e07('0x57')]['id'],'UserId':null}})[_0x9e07('0x21')](handleEntityNotFound(_0x41444d,null))['then'](function(_0x3388ca){if(_0x3388ca){_0xe9245d[_0x9e07('0x29')]=_0x3388ca['get']({'plain':!![]});return db['MailInteraction'][_0x9e07('0x5a')]({'where':{'id':_0x3388ca[_0x9e07('0x8e')]}});}return null;})['then'](handleEntityNotFound(_0x41444d,null))[_0x9e07('0x21')](function(_0x368925){if(_0x368925){_0xe9245d[_0x9e07('0x82')]=_0x368925['get']({'plain':!![]});interaction_log['info'](_0x9e07('0x8f'),_0x3127ba[_0x9e07('0x6e')]['id'],_0x3127ba[_0x9e07('0x6e')][_0x9e07('0x39')],_0x3127ba[_0x9e07('0x6e')][_0x9e07('0x84')],_0xe9245d[_0x9e07('0x82')]['id'],_0x3127ba['body']?JSON['stringify'](_0x3127ba[_0x9e07('0x59')]):_0x9e07('0x85'));return respondWithRpcPromise('RejectMessage',_0x9e07('0x90'),_0xe9245d);}return null;})[_0x9e07('0x21')](function(_0x4d108a){if(_0x4d108a){_0x4d108a['message']['interface']=util[_0x9e07('0x79')]('SIP/%s',_0x3127ba[_0x9e07('0x6e')][_0x9e07('0x39')]);_0x4d108a[_0x9e07('0x29')]['channel']=_0xe9245d[_0x9e07('0x89')];_0x4d108a[_0x9e07('0x29')][_0x9e07('0x91')]=_0x9e07('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0x9e07('0x92'),'message':_0x4d108a[_0x9e07('0x29')]},client9002);return _0xe9245d;}return null;})[_0x9e07('0x21')](respondWithResult(_0x41444d,null))[_0x9e07('0x2a')](handleError(_0x41444d,null));};exports[_0x9e07('0x93')]=function(_0xebca88,_0x49bafe){var _0x2f47b3=moment()[_0x9e07('0x94')]()['toString']();var _0x6034e2=path['join'](config[_0x9e07('0x73')],_0x9e07('0x95'),_0x9e07('0x96'),_0x9e07('0x97'));var _0x3898b5=path['join'](config[_0x9e07('0x73')],_0x9e07('0x95'),_0x9e07('0x96'),_0x9e07('0x71'));var _0x51a5c4=util['format']('message-%s.eml',_0x2f47b3);return db['MailMessage'][_0x9e07('0x5a')]({'where':{'id':_0xebca88[_0x9e07('0x57')]['id']},'attributes':['id','body',_0x9e07('0x98'),'to','cc','bcc',_0x9e07('0x99'),_0x9e07('0x9a')],'include':_0xebca88[_0x9e07('0x42')][_0x9e07('0x71')]?[{'model':db[_0x9e07('0x9b')],'as':_0x9e07('0x9c')}]:undefined})[_0x9e07('0x21')](handleEntityNotFound(_0x49bafe,null))[_0x9e07('0x21')](function(_0x3cd44a){if(_0x3cd44a){var _0x4908a6=_0x3cd44a;var _0x27d565={'from':_0x4908a6['from'],'to':_0x4908a6['to'],'subject':_0x4908a6['subject'],'html':_0x4908a6[_0x9e07('0x59')],'headers':{'Date':moment(_0x4908a6['createdAt'])[_0x9e07('0x79')](_0x9e07('0x9d'))},'attachments':[]};if(_0x3cd44a['cc']){_0x27d565['headers']['Cc']=_0x3cd44a['cc'];}if(_0x3cd44a[_0x9e07('0x9e')]){_0x27d565[_0x9e07('0x9f')]['Bcc']=_0x3cd44a[_0x9e07('0x9e')];}return new BPromise(function(_0x1d09ec,_0x4e6d3b){if(_0x3cd44a['Attachments']){for(var _0x2047e9=0x0;_0x2047e9<_0x3cd44a['Attachments'][_0x9e07('0x48')];_0x2047e9++){var _0x29229f=_0x3cd44a[_0x9e07('0x9c')][_0x2047e9];var _0x18fb09=path[_0x9e07('0x72')](_0x3898b5,_0x29229f['basename']);if(fs['existsSync'](_0x18fb09)){_0x27d565['attachments'][_0x9e07('0xa0')]({'name':_0x29229f[_0x9e07('0x39')],'contentType':_0x29229f[_0x9e07('0x3f')],'data':fs[_0x9e07('0xa1')](_0x18fb09)});}}}emlformat[_0x9e07('0xa2')](_0x27d565,function(_0x20d7b4,_0x8e5290){if(_0x20d7b4)return _0x4e6d3b(_0x20d7b4);fs['writeFileSync'](path[_0x9e07('0x72')](_0x6034e2,_0x51a5c4),_0x8e5290);return _0x1d09ec(_0x8e5290);});});}})[_0x9e07('0x21')](function(_0x503ec7){if(_0x503ec7){return _0x49bafe[_0x9e07('0x93')](path[_0x9e07('0x72')](_0x6034e2,_0x51a5c4),_0x51a5c4,function(_0x824072){if(_0x824072){console['log'](_0x9e07('0xa3'),_0x824072);}else{fs[_0x9e07('0xa4')](path[_0x9e07('0x72')](_0x6034e2,_0x51a5c4));}});}})[_0x9e07('0x2a')](handleError(_0x49bafe,null));}; \ No newline at end of file +var _0x1bd0=['includeAll','include','body','find','destroy','params','describe','create','direction','out','split','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','pass','service','auth','attachments','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','user','Contact','get','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','unix','root','server','files','message-%s.eml','from','subject','createdAt','Attachment','headers','Bcc','bcc','Attachments','existsSync','push','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','index','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailMessage','findAll','rows','show','rawAttributes'];(function(_0x35a1cb,_0x5050aa){var _0x1f7dc0=function(_0x55b124){while(--_0x55b124){_0x35a1cb['push'](_0x35a1cb['shift']());}};_0x1f7dc0(++_0x5050aa);}(_0x1bd0,0x100));var _0x01bd=function(_0x3aa8b8,_0x10251d){_0x3aa8b8=_0x3aa8b8-0x0;var _0x2157fd=_0x1bd0[_0x3aa8b8];return _0x2157fd;};'use strict';var pdf=require(_0x01bd('0x0'));var emlformat=require(_0x01bd('0x1'));var rimraf=require(_0x01bd('0x2'));var zipdir=require(_0x01bd('0x3'));var jsonpatch=require(_0x01bd('0x4'));var rp=require(_0x01bd('0x5'));var moment=require(_0x01bd('0x6'));var BPromise=require(_0x01bd('0x7'));var Mustache=require(_0x01bd('0x8'));var util=require('util');var path=require(_0x01bd('0x9'));var sox=require(_0x01bd('0xa'));var csv=require(_0x01bd('0xb'));var ejs=require(_0x01bd('0xc'));var fs=require('fs');var _=require(_0x01bd('0xd'));var squel=require(_0x01bd('0xe'));var crypto=require(_0x01bd('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x01bd('0xb'));var querystring=require(_0x01bd('0x10'));var Papa=require('papaparse');var Redis=require(_0x01bd('0x11'));var authService=require(_0x01bd('0x12'));var qs=require(_0x01bd('0x13'));var as=require(_0x01bd('0x14'));var hardwareService=require(_0x01bd('0x15'));var logger=require(_0x01bd('0x16'))(_0x01bd('0x17'));var utils=require(_0x01bd('0x18'));var config=require(_0x01bd('0x19'));var licenseUtil=require(_0x01bd('0x1a'));var db=require(_0x01bd('0x1b'))['db'];config[_0x01bd('0x1c')]=_[_0x01bd('0x1d')](config[_0x01bd('0x1c')],{'host':_0x01bd('0x1e'),'port':0x18eb});var socket=require(_0x01bd('0x1f'))(new Redis(config[_0x01bd('0x1c')]));require(_0x01bd('0x20'))['register'](socket);var jayson=require(_0x01bd('0x21'));var client=jayson['client'][_0x01bd('0x22')]({'port':0x232c});var client9003=jayson['client'][_0x01bd('0x22')]({'port':0x232b});var client9002=jayson['client'][_0x01bd('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5dd2c6,_0x299852,_0x32847b,_0x331022){return new BPromise(function(_0x584ed8,_0x716b00){var _0x415029=_0x331022||client;return _0x415029[_0x01bd('0x23')](_0x5dd2c6,_0x32847b)[_0x01bd('0x24')](function(_0x354f41){logger[_0x01bd('0x25')]('MailMessage,\x20%s,\x20%s',_0x299852,_0x01bd('0x26'));logger[_0x01bd('0x27')](_0x01bd('0x28'),_0x299852,_0x01bd('0x26'),JSON[_0x01bd('0x29')](_0x354f41));if(_0x354f41[_0x01bd('0x2a')]){if(_0x354f41['error'][_0x01bd('0x2b')]===0x1f4){logger[_0x01bd('0x2a')](_0x01bd('0x2c'),_0x299852,_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);return _0x716b00(_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);}logger[_0x01bd('0x2a')](_0x01bd('0x2c'),_0x299852,_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);return _0x584ed8(_0x354f41[_0x01bd('0x2a')][_0x01bd('0x2d')]);}else{logger[_0x01bd('0x25')](_0x01bd('0x2c'),_0x299852,_0x01bd('0x26'));_0x584ed8(_0x354f41[_0x01bd('0x2e')][_0x01bd('0x2d')]);}})[_0x01bd('0x2f')](function(_0x13b8db){logger[_0x01bd('0x2a')](_0x01bd('0x2c'),_0x299852,_0x13b8db);_0x716b00(_0x13b8db);});});}function respondWithStatusCode(_0x413788,_0x14e55e){_0x14e55e=_0x14e55e||0xcc;return function(_0x29d66b){if(_0x29d66b){return _0x413788[_0x01bd('0x30')](_0x14e55e);}return _0x413788[_0x01bd('0x31')](_0x14e55e)[_0x01bd('0x32')]();};}function respondWithResult(_0x54d094,_0x55fcaf){_0x55fcaf=_0x55fcaf||0xc8;return function(_0x21db7c){if(_0x21db7c){return _0x54d094['status'](_0x55fcaf)[_0x01bd('0x33')](_0x21db7c);}};}function respondWithFilteredResult(_0x35afc7,_0xb2f765){return function(_0x2610df){if(_0x2610df){var _0x552586=_0x2610df[_0x01bd('0x34')],_0x5ac3f1=_0xb2f765[_0x01bd('0x35')],_0x4035ca=_0xb2f765['offset']+_0xb2f765[_0x01bd('0x36')],_0x250a90;if(_0x4035ca>=_0x552586){_0x4035ca=_0x552586;_0x250a90=0xc8;}else{_0x250a90=0xce;}_0x35afc7[_0x01bd('0x31')](_0x250a90);return _0x35afc7[_0x01bd('0x37')](_0x01bd('0x38'),_0x5ac3f1+'-'+_0x4035ca+'/'+_0x552586)[_0x01bd('0x33')](_0x2610df);}return null;};}function patchUpdates(_0x1e7eae){return function(_0x42a1cf){try{jsonpatch['apply'](_0x42a1cf,_0x1e7eae,!![]);}catch(_0x1a7c4d){return BPromise[_0x01bd('0x39')](_0x1a7c4d);}return _0x42a1cf[_0x01bd('0x3a')]();};}function saveUpdates(_0x546596,_0x24ac9f){return function(_0x1c10f8){if(_0x1c10f8){return _0x1c10f8[_0x01bd('0x3b')](_0x546596)['then'](function(_0x44f148){return _0x44f148;});}return null;};}function removeEntity(_0x28813e,_0xc27380){return function(_0xf2b8c){if(_0xf2b8c){return _0xf2b8c['destroy']()[_0x01bd('0x24')](function(){_0x28813e[_0x01bd('0x31')](0xcc)[_0x01bd('0x32')]();});}};}function handleEntityNotFound(_0x4d425a,_0x539bc2){return function(_0x21e707){if(!_0x21e707){_0x4d425a[_0x01bd('0x30')](0x194);}return _0x21e707;};}function handleError(_0x75c994,_0x199b25){_0x199b25=_0x199b25||0x1f4;return function(_0x5e75d2){logger['error'](_0x5e75d2[_0x01bd('0x3c')]);if(_0x5e75d2[_0x01bd('0x3d')]){delete _0x5e75d2['name'];}_0x75c994[_0x01bd('0x31')](_0x199b25)['send'](_0x5e75d2);};}exports[_0x01bd('0x3e')]=function(_0x5f225f,_0x49a3dd){var _0x28d1ef={},_0x5377d8={},_0x5e17b8={'count':0x0,'rows':[]};var _0x1210cf=_['map'](db['MailMessage']['rawAttributes'],function(_0x2b3319){return{'name':_0x2b3319[_0x01bd('0x3f')],'type':_0x2b3319[_0x01bd('0x40')][_0x01bd('0x41')]};});_0x5377d8[_0x01bd('0x42')]=_[_0x01bd('0x43')](_0x1210cf,_0x01bd('0x3d'));_0x5377d8['query']=_[_0x01bd('0x44')](_0x5f225f[_0x01bd('0x45')]);_0x5377d8['filters']=_[_0x01bd('0x46')](_0x5377d8[_0x01bd('0x42')],_0x5377d8[_0x01bd('0x45')]);_0x28d1ef[_0x01bd('0x47')]=_[_0x01bd('0x46')](_0x5377d8['model'],qs[_0x01bd('0x48')](_0x5f225f[_0x01bd('0x45')][_0x01bd('0x48')]));_0x28d1ef[_0x01bd('0x47')]=_0x28d1ef[_0x01bd('0x47')][_0x01bd('0x49')]?_0x28d1ef[_0x01bd('0x47')]:_0x5377d8[_0x01bd('0x42')];if(!_0x5f225f[_0x01bd('0x45')][_0x01bd('0x4a')](_0x01bd('0x4b'))){_0x28d1ef['limit']=qs[_0x01bd('0x36')](_0x5f225f[_0x01bd('0x45')][_0x01bd('0x36')]);_0x28d1ef[_0x01bd('0x35')]=qs[_0x01bd('0x35')](_0x5f225f[_0x01bd('0x45')][_0x01bd('0x35')]);}_0x28d1ef[_0x01bd('0x4c')]=qs[_0x01bd('0x4d')](_0x5f225f[_0x01bd('0x45')]['sort']);_0x28d1ef[_0x01bd('0x4e')]=qs[_0x01bd('0x4f')](_[_0x01bd('0x50')](_0x5f225f[_0x01bd('0x45')],_0x5377d8[_0x01bd('0x4f')]),_0x1210cf);if(_0x5f225f[_0x01bd('0x45')][_0x01bd('0x51')]){_0x28d1ef[_0x01bd('0x4e')]=_[_0x01bd('0x52')](_0x28d1ef['where'],{'$or':_[_0x01bd('0x43')](_0x1210cf,function(_0x126fe6){if(_0x126fe6[_0x01bd('0x40')]!==_0x01bd('0x53')){var _0x2a17b8={};_0x2a17b8[_0x126fe6[_0x01bd('0x3d')]]={'$like':'%'+_0x5f225f['query']['filter']+'%'};return _0x2a17b8;}})});}_0x28d1ef=_[_0x01bd('0x52')]({},_0x28d1ef,_0x5f225f[_0x01bd('0x54')]);var _0x5b2265={'where':_0x28d1ef[_0x01bd('0x4e')]};return db[_0x01bd('0x55')][_0x01bd('0x34')](_0x5b2265)[_0x01bd('0x24')](function(_0x1455a1){_0x5e17b8[_0x01bd('0x34')]=_0x1455a1;if(_0x5f225f['query']['includeAll']){_0x28d1ef['include']=[{'all':!![]}];}return db[_0x01bd('0x55')][_0x01bd('0x56')](_0x28d1ef);})[_0x01bd('0x24')](function(_0x51c6db){_0x5e17b8[_0x01bd('0x57')]=_0x51c6db;return _0x5e17b8;})[_0x01bd('0x24')](respondWithFilteredResult(_0x49a3dd,_0x28d1ef))[_0x01bd('0x2f')](handleError(_0x49a3dd,null));};exports[_0x01bd('0x58')]=function(_0x4cec2d,_0x28674f){var _0x2eea4a={'raw':!![],'where':{'id':_0x4cec2d['params']['id']}},_0x26ed30={};_0x26ed30[_0x01bd('0x42')]=_['keys'](db[_0x01bd('0x55')][_0x01bd('0x59')]);_0x26ed30[_0x01bd('0x45')]=_[_0x01bd('0x44')](_0x4cec2d['query']);_0x26ed30[_0x01bd('0x4f')]=_[_0x01bd('0x46')](_0x26ed30[_0x01bd('0x42')],_0x26ed30['query']);_0x2eea4a['attributes']=_[_0x01bd('0x46')](_0x26ed30['model'],qs[_0x01bd('0x48')](_0x4cec2d['query'][_0x01bd('0x48')]));_0x2eea4a[_0x01bd('0x47')]=_0x2eea4a[_0x01bd('0x47')]['length']?_0x2eea4a['attributes']:_0x26ed30[_0x01bd('0x42')];if(_0x4cec2d[_0x01bd('0x45')][_0x01bd('0x5a')]){_0x2eea4a[_0x01bd('0x5b')]=[{'all':!![]}];}_0x2eea4a=_['merge']({},_0x2eea4a,_0x4cec2d[_0x01bd('0x54')]);return db[_0x01bd('0x55')]['find'](_0x2eea4a)[_0x01bd('0x24')](handleEntityNotFound(_0x28674f,null))['then'](respondWithResult(_0x28674f,null))[_0x01bd('0x2f')](handleError(_0x28674f,null));};exports[_0x01bd('0x3b')]=function(_0x2fc394,_0x77d39b){if(_0x2fc394[_0x01bd('0x5c')]['id']){delete _0x2fc394['body']['id'];}return db[_0x01bd('0x55')][_0x01bd('0x5d')]({'where':{'id':_0x2fc394['params']['id']}})[_0x01bd('0x24')](handleEntityNotFound(_0x77d39b,null))[_0x01bd('0x24')](saveUpdates(_0x2fc394[_0x01bd('0x5c')],null))[_0x01bd('0x24')](respondWithResult(_0x77d39b,null))['catch'](handleError(_0x77d39b,null));};exports[_0x01bd('0x5e')]=function(_0x583ffd,_0x5a7c4c){return db[_0x01bd('0x55')][_0x01bd('0x5d')]({'where':{'id':_0x583ffd[_0x01bd('0x5f')]['id']}})[_0x01bd('0x24')](handleEntityNotFound(_0x5a7c4c,null))[_0x01bd('0x24')](removeEntity(_0x5a7c4c,null))[_0x01bd('0x2f')](handleError(_0x5a7c4c,null));};exports[_0x01bd('0x60')]=function(_0x3b3ab3,_0x52102a){return db['MailMessage']['describe']()[_0x01bd('0x24')](respondWithResult(_0x52102a,null))['catch'](handleError(_0x52102a,null));};exports[_0x01bd('0x61')]=function(_0x3b018a,_0x5dfcb1){return db[_0x01bd('0x55')][_0x01bd('0x61')](_0x3b018a['body'])[_0x01bd('0x24')](function(_0x2aac32){if(_0x2aac32){if(_0x2aac32[_0x01bd('0x62')]===_0x01bd('0x63')&&!_0x2aac32['secret']){var _0x458380,_0x163a6b,_0x14e259;if(_0x3b018a[_0x01bd('0x5c')]['to']){_0x163a6b=_0x3b018a[_0x01bd('0x5c')]['to'][_0x01bd('0x64')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2aac32[_0x01bd('0x65')]},'include':[{'model':db['CmList'],'as':_0x01bd('0x66'),'include':[{'model':db[_0x01bd('0x67')],'as':'Contacts','where':{'email':_0x163a6b},'limit':0x1,'order':[[_0x01bd('0x68'),_0x01bd('0x69')]]}]},{'model':db[_0x01bd('0x6a')],'as':'Smtp','raw':!![]}]})[_0x01bd('0x24')](function(_0x410dcf){_0x458380=_0x410dcf;if(_0x458380&&_0x458380[_0x01bd('0x6b')]){var _0x32ec05={'tls':{'rejectUnauthorized':![]}};if(_[_0x01bd('0x6c')](_0x458380[_0x01bd('0x6b')]['service'])){_0x32ec05[_0x01bd('0x6d')]=_0x458380[_0x01bd('0x6b')]['host'];_0x32ec05[_0x01bd('0x6e')]=_0x458380[_0x01bd('0x6b')][_0x01bd('0x6e')];_0x32ec05['secure']=_0x458380[_0x01bd('0x6b')][_0x01bd('0x6f')];if(_0x458380[_0x01bd('0x6b')][_0x01bd('0x70')]){_0x32ec05['auth']={'user':_0x458380[_0x01bd('0x6b')]['user'],'pass':_0x458380[_0x01bd('0x6b')][_0x01bd('0x71')]};}}else{_0x32ec05[_0x01bd('0x72')]=_0x458380['Smtp'][_0x01bd('0x72')];_0x32ec05[_0x01bd('0x73')]={'user':_0x458380['Smtp']['user'],'pass':_0x458380[_0x01bd('0x6b')]['pass']};_0x32ec05[_0x01bd('0x6f')]=_0x458380['Smtp']['secure'];}if(_0x3b018a[_0x01bd('0x5c')][_0x01bd('0x74')]&&_0x3b018a[_0x01bd('0x5c')][_0x01bd('0x74')]['length']){for(var _0x4f6ac0=0x0;_0x4f6ac0<_0x3b018a['body'][_0x01bd('0x74')][_0x01bd('0x49')];_0x4f6ac0+=0x1){_0x3b018a['body']['attachments'][_0x4f6ac0]={'filename':_0x3b018a[_0x01bd('0x5c')]['attachments'][_0x4f6ac0][_0x01bd('0x3d')],'path':path[_0x01bd('0x75')](config['root'],_0x01bd('0x76'),_0x3b018a['body'][_0x01bd('0x74')][_0x4f6ac0][_0x01bd('0x77')])};}}_0x14e259={'account':_0x32ec05,'message':_0x3b018a['body']};return;}})[_0x01bd('0x24')](function(){if(_0x458380[_0x01bd('0x66')]){if(_0x458380[_0x01bd('0x66')][_0x01bd('0x78')][_0x01bd('0x49')]){return _0x458380['List'][_0x01bd('0x78')][0x0];}else{return db['CmContact'][_0x01bd('0x61')](_[_0x01bd('0x1d')](_0x3b018a[_0x01bd('0x5c')],{'firstName':_0x3b018a[_0x01bd('0x5c')]['to'],'email':_0x3b018a['body']['to'],'phone':_0x3b018a['body']['to'],'ListId':_0x458380[_0x01bd('0x79')]}));}}else{throw new Error(_0x01bd('0x7a'));}})[_0x01bd('0x24')](function(){if(_0x14e259){return respondWithRpcPromise('SendMail',_0x01bd('0x7b'),_0x14e259,client9003)[_0x01bd('0x24')](function(_0x2fa8ff){return _0x2aac32[_0x01bd('0x3b')]({'read':!![],'messageId':_0x2fa8ff[_0x01bd('0x7c')],'sentAt':moment()[_0x01bd('0x7d')](_0x01bd('0x7e'))});})[_0x01bd('0x2f')](function(_0x1208df){logger[_0x01bd('0x2a')]('%s',JSON[_0x01bd('0x29')](_0x1208df));return _0x2aac32;});}return _0x2aac32;});}return _0x2aac32;}})[_0x01bd('0x24')](respondWithResult(_0x5dfcb1,0xc9))[_0x01bd('0x2f')](handleError(_0x5dfcb1,null));};var interaction_log=require('../../config/logger')(_0x01bd('0x7f'));exports[_0x01bd('0x80')]=function(_0x7debeb,_0x17fe4a,_0x17219c){var _0x103186={'channel':_0x01bd('0x81')};if(_0x7debeb[_0x01bd('0x5c')]['id']){delete _0x7debeb[_0x01bd('0x5c')]['id'];}_0x7debeb[_0x01bd('0x5c')][_0x01bd('0x82')]=!![];_0x7debeb[_0x01bd('0x5c')][_0x01bd('0x83')]=moment()['format'](_0x01bd('0x7e'));_0x7debeb[_0x01bd('0x5c')]['UserId']=_0x7debeb['body'][_0x01bd('0x84')]||_0x7debeb[_0x01bd('0x85')]['id'];return db[_0x01bd('0x55')][_0x01bd('0x5d')]({'where':{'id':_0x7debeb[_0x01bd('0x5f')]['id'],'UserId':null},'include':[{'model':db[_0x01bd('0x67')],'as':_0x01bd('0x86')}]})[_0x01bd('0x24')](handleEntityNotFound(_0x17fe4a,null))['then'](saveUpdates(_0x7debeb['body'],null))[_0x01bd('0x24')](function(_0x49d2e3){if(_0x49d2e3){_0x103186[_0x01bd('0x2d')]=_0x49d2e3[_0x01bd('0x87')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x49d2e3[_0x01bd('0x88')]}});}return null;})['then'](handleEntityNotFound(_0x17fe4a,null))[_0x01bd('0x24')](function(_0x5015db){if(_0x5015db){return _0x5015db['update']({'UserId':_0x7debeb[_0x01bd('0x5c')][_0x01bd('0x84')],'read1stAt':_[_0x01bd('0x6c')](_0x5015db[_0x01bd('0x89')])?moment()[_0x01bd('0x7d')](_0x01bd('0x7e')):undefined});}return null;})[_0x01bd('0x24')](function(_0x34ef50){if(_0x34ef50){_0x103186[_0x01bd('0x8a')]=_0x34ef50[_0x01bd('0x87')]({'plain':!![]});interaction_log[_0x01bd('0x25')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7debeb[_0x01bd('0x85')]['id'],_0x7debeb['user'][_0x01bd('0x3d')],_0x7debeb[_0x01bd('0x85')][_0x01bd('0x8b')],_0x103186['interaction']['id'],_0x7debeb[_0x01bd('0x5c')]?JSON[_0x01bd('0x29')](_0x7debeb[_0x01bd('0x5c')]):_0x01bd('0x8c'));return respondWithRpcPromise(_0x01bd('0x8d'),_0x01bd('0x8e'),_0x103186);}return null;})['then'](function(_0x3b4b77){if(_0x3b4b77){if(_0x7debeb[_0x01bd('0x5c')]['manual']){_0x103186['message'][_0x01bd('0x8f')]=util[_0x01bd('0x7d')]('SIP/%s',_0x7debeb['user'][_0x01bd('0x3d')]);_0x103186[_0x01bd('0x2d')][_0x01bd('0x90')]=_0x103186[_0x01bd('0x90')];_0x103186[_0x01bd('0x2d')][_0x01bd('0x91')]=_0x01bd('0x80');return respondWithRpcPromise(_0x01bd('0x92'),_0x01bd('0x92'),{'event':_0x01bd('0x93'),'message':_0x103186[_0x01bd('0x2d')]},client9002)[_0x01bd('0x24')](function(){return _0x103186;});}return _0x103186;}return null;})[_0x01bd('0x24')](respondWithResult(_0x17fe4a,null))[_0x01bd('0x2f')](handleError(_0x17fe4a,null));};var interaction_log=require(_0x01bd('0x16'))(_0x01bd('0x7f'));exports[_0x01bd('0x39')]=function(_0x6516d5,_0x1f5fec,_0x43bc21){var _0x5733ed={'agent':{},'channel':'mail'};if(_0x6516d5['body']['id']){delete _0x6516d5[_0x01bd('0x5c')]['id'];}_0x6516d5[_0x01bd('0x5c')][_0x01bd('0x84')]=_0x6516d5['body'][_0x01bd('0x84')]||_0x6516d5[_0x01bd('0x85')]['id'];_0x5733ed['agent']['id']=_0x6516d5[_0x01bd('0x5c')]['UserId'];return db[_0x01bd('0x55')]['find']({'where':{'id':_0x6516d5[_0x01bd('0x5f')]['id'],'UserId':null}})[_0x01bd('0x24')](handleEntityNotFound(_0x1f5fec,null))['then'](function(_0x68f724){if(_0x68f724){_0x5733ed[_0x01bd('0x2d')]=_0x68f724[_0x01bd('0x87')]({'plain':!![]});return db[_0x01bd('0x94')][_0x01bd('0x5d')]({'where':{'id':_0x68f724[_0x01bd('0x88')]}});}return null;})[_0x01bd('0x24')](handleEntityNotFound(_0x1f5fec,null))['then'](function(_0x57601f){if(_0x57601f){_0x5733ed[_0x01bd('0x8a')]=_0x57601f[_0x01bd('0x87')]({'plain':!![]});interaction_log['info'](_0x01bd('0x95'),_0x6516d5[_0x01bd('0x85')]['id'],_0x6516d5[_0x01bd('0x85')][_0x01bd('0x3d')],_0x6516d5['user']['role'],_0x5733ed['interaction']['id'],_0x6516d5[_0x01bd('0x5c')]?JSON[_0x01bd('0x29')](_0x6516d5['body']):_0x01bd('0x8c'));return respondWithRpcPromise(_0x01bd('0x96'),_0x01bd('0x97'),_0x5733ed);}return null;})[_0x01bd('0x24')](function(_0x592c8a){if(_0x592c8a){_0x592c8a[_0x01bd('0x2d')][_0x01bd('0x8f')]=util[_0x01bd('0x7d')]('SIP/%s',_0x6516d5[_0x01bd('0x85')][_0x01bd('0x3d')]);_0x592c8a[_0x01bd('0x2d')][_0x01bd('0x90')]=_0x5733ed[_0x01bd('0x90')];_0x592c8a[_0x01bd('0x2d')][_0x01bd('0x91')]='reject';respondWithRpcPromise(_0x01bd('0x92'),'EventManager',{'event':'rejectmessage','message':_0x592c8a[_0x01bd('0x2d')]},client9002);return _0x5733ed;}return null;})['then'](respondWithResult(_0x1f5fec,null))[_0x01bd('0x2f')](handleError(_0x1f5fec,null));};exports['download']=function(_0x509c8d,_0x383faf){var _0x3a8123=moment()[_0x01bd('0x98')]()['toString']();var _0x5b105d=path[_0x01bd('0x75')](config[_0x01bd('0x99')],_0x01bd('0x9a'),_0x01bd('0x9b'),'tmp');var _0x417631=path[_0x01bd('0x75')](config[_0x01bd('0x99')],_0x01bd('0x9a'),_0x01bd('0x9b'),_0x01bd('0x74'));var _0x33769f=util[_0x01bd('0x7d')](_0x01bd('0x9c'),_0x3a8123);return db['MailMessage'][_0x01bd('0x5d')]({'where':{'id':_0x509c8d['params']['id']},'attributes':['id',_0x01bd('0x5c'),_0x01bd('0x9d'),'to','cc','bcc',_0x01bd('0x9e'),_0x01bd('0x9f')],'include':_0x509c8d['query'][_0x01bd('0x74')]?[{'model':db[_0x01bd('0xa0')],'as':'Attachments'}]:undefined})[_0x01bd('0x24')](handleEntityNotFound(_0x383faf,null))['then'](function(_0x338aa8){if(_0x338aa8){var _0x52c6f7=_0x338aa8;var _0x2b5509={'from':_0x52c6f7[_0x01bd('0x9d')],'to':_0x52c6f7['to'],'subject':_0x52c6f7[_0x01bd('0x9e')],'html':_0x52c6f7['body'],'headers':{'Date':moment(_0x52c6f7[_0x01bd('0x9f')])[_0x01bd('0x7d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x338aa8['cc']){_0x2b5509[_0x01bd('0xa1')]['Cc']=_0x338aa8['cc'];}if(_0x338aa8['bcc']){_0x2b5509['headers'][_0x01bd('0xa2')]=_0x338aa8[_0x01bd('0xa3')];}return new BPromise(function(_0x51a2d9,_0x3634d3){if(_0x338aa8[_0x01bd('0xa4')]){for(var _0x2ebc58=0x0;_0x2ebc58<_0x338aa8[_0x01bd('0xa4')]['length'];_0x2ebc58++){var _0x172dca=_0x338aa8[_0x01bd('0xa4')][_0x2ebc58];var _0x3fdf81=path[_0x01bd('0x75')](_0x417631,_0x172dca[_0x01bd('0x77')]);if(fs[_0x01bd('0xa5')](_0x3fdf81)){_0x2b5509[_0x01bd('0x74')][_0x01bd('0xa6')]({'name':_0x172dca[_0x01bd('0x3d')],'contentType':_0x172dca[_0x01bd('0x40')],'data':fs['readFileSync'](_0x3fdf81)});}}}emlformat[_0x01bd('0xa7')](_0x2b5509,function(_0x3daa2c,_0x12acc4){if(_0x3daa2c)return _0x3634d3(_0x3daa2c);fs[_0x01bd('0xa8')](path[_0x01bd('0x75')](_0x5b105d,_0x33769f),_0x12acc4);return _0x51a2d9(_0x12acc4);});});}})[_0x01bd('0x24')](function(_0x1cc295){if(_0x1cc295){return _0x383faf[_0x01bd('0xa9')](path['join'](_0x5b105d,_0x33769f),_0x33769f,function(_0x7d4ea0){if(_0x7d4ea0){console[_0x01bd('0xaa')](_0x01bd('0xab'),_0x7d4ea0);}else{fs[_0x01bd('0xac')](path[_0x01bd('0x75')](_0x5b105d,_0x33769f));}});}})[_0x01bd('0x2f')](handleError(_0x383faf,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a451688..bb25fb0 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 _0xc969=['MailMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0xc969,0x147));var _0x9c96=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xc969[_0x5416db];return _0x243e35;};'use strict';var EventEmitter=require(_0x9c96('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x9c96('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9c96('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c96('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4a6ac8){return function(_0x1a80ef,_0x19db83,_0x310cab){MailMessageEvents[_0x9c96('0x4')](_0x4a6ac8+':'+_0x1a80ef['id'],_0x1a80ef);MailMessageEvents[_0x9c96('0x4')](_0x4a6ac8,_0x1a80ef);_0x310cab(null);};}for(var e in events){if(events[_0x9c96('0x5')](e)){var event=events[e];MailMessage[_0x9c96('0x6')](e,emitEvent(event));}}module[_0x9c96('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xbf05=['events','MailMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xbf05,0x6c));var _0x5bf0=function(_0x3428b0,_0x1948c5){_0x3428b0=_0x3428b0-0x0;var _0x179550=_0xbf05[_0x3428b0];return _0x179550;};'use strict';var EventEmitter=require(_0x5bf0('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x5bf0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5bf0('0x2')](0x0);var events={'afterCreate':_0x5bf0('0x3'),'afterUpdate':_0x5bf0('0x4'),'afterDestroy':_0x5bf0('0x5')};function emitEvent(_0xfcdc33){return function(_0x352497,_0xc7176e,_0x30121b){MailMessageEvents['emit'](_0xfcdc33+':'+_0x352497['id'],_0x352497);MailMessageEvents[_0x5bf0('0x6')](_0xfcdc33,_0x352497);_0x30121b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x5bf0('0x7')](e,emitEvent(event));}}module[_0x5bf0('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9b66b8a..7a8e1f8 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 _0xe631=['MailInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x443f8b,_0x931638){var _0x5b0287=function(_0xdaf2e7){while(--_0xdaf2e7){_0x443f8b['push'](_0x443f8b['shift']());}};_0x5b0287(++_0x931638);}(_0xe631,0x150));var _0x1e63=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xe631[_0x47408e];return _0x1636bc;};'use strict';var _=require(_0x1e63('0x0'));var util=require('util');var logger=require(_0x1e63('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x1e63('0x2'));var fs=require('fs');var path=require(_0x1e63('0x3'));var rimraf=require(_0x1e63('0x4'));var config=require(_0x1e63('0x5'));var attributes=require(_0x1e63('0x6'));module['exports']=function(_0x5a7419,_0x27ca7a){return _0x5a7419[_0x1e63('0x7')](_0x1e63('0x8'),attributes,{'tableName':_0x1e63('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1e63('0xa')]},{'name':_0x1e63('0xb'),'fields':[_0x1e63('0xc'),'subject'],'type':_0x1e63('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a3a22,_0x14231e,_0x2ad72a){if(_0x3a3a22[_0x1e63('0xe')]){_0x3a3a22['plainBody']=htmlToText[_0x1e63('0xf')](_0x3a3a22['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2ad72a(null,_0x14231e);},'afterCreate':function(_0x21c727,_0x1e4f1c,_0x2bb559){var _0x4c1455=_0x5a7419[_0x1e63('0x10')];var _0x22f81d=_0x21c727['get']({'plain':!![]});if(_0x22f81d[_0x1e63('0x11')][_0x1e63('0x12')]()==='in'||_0x22f81d[_0x1e63('0x11')][_0x1e63('0x12')]()===_0x1e63('0x13')&&!_0x22f81d[_0x1e63('0x14')]&&!_[_0x1e63('0x15')](_0x22f81d[_0x1e63('0x16')])){_0x4c1455['MailInteraction'][_0x1e63('0x17')]({'where':{'id':_0x22f81d[_0x1e63('0x18')]}})['then'](function(_0x49c62e){if(_0x49c62e){_0x49c62e[_0x1e63('0x19')]({'lastMsgAt':_0x22f81d['createdAt'],'lastMsgDirection':_0x22f81d['direction']['toLowerCase'](),'lastMsgBody':_0x22f81d[_0x1e63('0xe')]});}})[_0x1e63('0x1a')](function(_0x247214){console[_0x1e63('0x1b')](_0x247214);});}_0x2bb559();}},'charset':_0x1e63('0x1c'),'collate':_0x1e63('0x1d')});}; \ No newline at end of file +var _0xf676=['FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xf676,0x100));var _0x6f67=function(_0x43148e,_0xa81910){_0x43148e=_0x43148e-0x0;var _0x4880a7=_0xf676[_0x43148e];return _0x4880a7;};'use strict';var _=require(_0x6f67('0x0'));var util=require('util');var logger=require(_0x6f67('0x1'))(_0x6f67('0x2'));var moment=require('moment');var BPromise=require(_0x6f67('0x3'));var rp=require(_0x6f67('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x6f67('0x5'));var rimraf=require(_0x6f67('0x6'));var config=require(_0x6f67('0x7'));var attributes=require(_0x6f67('0x8'));module[_0x6f67('0x9')]=function(_0x51687b,_0x21cd64){return _0x51687b[_0x6f67('0xa')](_0x6f67('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x6f67('0xc'),'fields':['messageId']},{'name':_0x6f67('0xd'),'fields':[_0x6f67('0xe'),_0x6f67('0xf')],'type':_0x6f67('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x281621,_0x23401c,_0x547b48){if(_0x281621[_0x6f67('0x11')]){_0x281621['plainBody']=htmlToText[_0x6f67('0x12')](_0x281621[_0x6f67('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x547b48(null,_0x23401c);},'afterCreate':function(_0x3fc121,_0x232557,_0x123106){var _0x1129b6=_0x51687b[_0x6f67('0x13')];var _0x200605=_0x3fc121[_0x6f67('0x14')]({'plain':!![]});if(_0x200605[_0x6f67('0x15')]['toLowerCase']()==='in'||_0x200605[_0x6f67('0x15')][_0x6f67('0x16')]()===_0x6f67('0x17')&&!_0x200605[_0x6f67('0x18')]&&!_[_0x6f67('0x19')](_0x200605[_0x6f67('0x1a')])){_0x1129b6[_0x6f67('0x1b')]['findOne']({'where':{'id':_0x200605[_0x6f67('0x1c')]}})['then'](function(_0x33e0d5){if(_0x33e0d5){_0x33e0d5[_0x6f67('0x1d')]({'lastMsgAt':_0x200605[_0x6f67('0x1e')],'lastMsgDirection':_0x200605[_0x6f67('0x15')][_0x6f67('0x16')](),'lastMsgBody':_0x200605[_0x6f67('0x11')]});}})[_0x6f67('0x1f')](function(_0x165bb7){console[_0x6f67('0x20')](_0x165bb7);});}_0x123106();}},'charset':_0x6f67('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b2cf604..ec4b433 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 _0xe3ab=['raw','then','CreateMailMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailMessage','create','body','options'];(function(_0x18761b,_0x42cbed){var _0x2a05bb=function(_0x4e45a7){while(--_0x4e45a7){_0x18761b['push'](_0x18761b['shift']());}};_0x2a05bb(++_0x42cbed);}(_0xe3ab,0x8b));var _0xbe3a=function(_0x5800a5,_0x2823f6){_0x5800a5=_0x5800a5-0x0;var _0x420c85=_0xe3ab[_0x5800a5];return _0x420c85;};'use strict';var _=require(_0xbe3a('0x0'));var util=require('util');var moment=require(_0xbe3a('0x1'));var BPromise=require(_0xbe3a('0x2'));var rs=require(_0xbe3a('0x3'));var fs=require('fs');var Redis=require(_0xbe3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe3a('0x5'));var logger=require('../../config/logger')(_0xbe3a('0x6'));var config=require(_0xbe3a('0x7'));var jayson=require(_0xbe3a('0x8'));var client=jayson[_0xbe3a('0x9')][_0xbe3a('0xa')]({'port':0x232a});config[_0xbe3a('0xb')]=_[_0xbe3a('0xc')](config[_0xbe3a('0xb')],{'host':_0xbe3a('0xd'),'port':0x18eb});var socket=require(_0xbe3a('0xe'))(new Redis(config[_0xbe3a('0xb')]));require(_0xbe3a('0xf'))['register'](socket);function respondWithRpcPromise(_0x529bee,_0x18497d,_0x4160d9){return new BPromise(function(_0x5139c8,_0x2bff13){return client[_0xbe3a('0x10')](_0x529bee,_0x4160d9)['then'](function(_0x921acf){logger['info'](_0xbe3a('0x11'),_0x18497d,_0xbe3a('0x12'));logger[_0xbe3a('0x13')](_0xbe3a('0x14'),_0x18497d,_0xbe3a('0x12'),JSON[_0xbe3a('0x15')](_0x921acf));if(_0x921acf[_0xbe3a('0x16')]){if(_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x17')]===0x1f4){logger[_0xbe3a('0x16')]('MailMessage,\x20%s,\x20%s',_0x18497d,_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x18')]);return _0x2bff13(_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x18')]);}logger[_0xbe3a('0x16')](_0xbe3a('0x11'),_0x18497d,_0x921acf['error'][_0xbe3a('0x18')]);return _0x5139c8(_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x18')]);}else{logger['info'](_0xbe3a('0x11'),_0x18497d,_0xbe3a('0x12'));_0x5139c8(_0x921acf[_0xbe3a('0x19')][_0xbe3a('0x18')]);}})[_0xbe3a('0x1a')](function(_0x5ccdb5){logger[_0xbe3a('0x16')](_0xbe3a('0x11'),_0x18497d,_0x5ccdb5);_0x2bff13(_0x5ccdb5);});});}exports['CreateMailMessage']=function(_0x18f402){var _0x3423fa=this;return new Promise(function(_0x29960a,_0x5e6b76){return db[_0xbe3a('0x1b')][_0xbe3a('0x1c')](_0x18f402[_0xbe3a('0x1d')],{'raw':_0x18f402['options']?_0x18f402[_0xbe3a('0x1e')][_0xbe3a('0x1f')]===undefined?!![]:![]:!![]})[_0xbe3a('0x20')](function(_0x389203){logger['info'](_0xbe3a('0x21'),_0x18f402);logger['debug'](_0xbe3a('0x21'),_0x18f402,JSON[_0xbe3a('0x15')](_0x389203));_0x29960a(_0x389203);})[_0xbe3a('0x1a')](function(_0x411355){logger[_0xbe3a('0x16')]('CreateMailMessage',_0x411355[_0xbe3a('0x18')],_0x18f402);_0x5e6b76(_0x3423fa['error'](0x1f4,_0x411355[_0xbe3a('0x18')]));});});}; \ No newline at end of file +var _0x312d=['jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateMailMessage','MailMessage','body','options','raw','debug','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x312d,0x14d));var _0xd312=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x312d[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd312('0x0'));var util=require(_0xd312('0x1'));var moment=require(_0xd312('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd312('0x3'));var db=require(_0xd312('0x4'))['db'];var utils=require(_0xd312('0x5'));var logger=require(_0xd312('0x6'))('rpc');var config=require(_0xd312('0x7'));var jayson=require(_0xd312('0x8'));var client=jayson['client'][_0xd312('0x9')]({'port':0x232a});config[_0xd312('0xa')]=_['defaults'](config[_0xd312('0xa')],{'host':_0xd312('0xb'),'port':0x18eb});var socket=require(_0xd312('0xc'))(new Redis(config['redis']));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x182317,_0x200b45,_0x1398ab){return new BPromise(function(_0x5bc6e7,_0x444f32){return client[_0xd312('0xd')](_0x182317,_0x1398ab)[_0xd312('0xe')](function(_0x4af672){logger[_0xd312('0xf')](_0xd312('0x10'),_0x200b45,_0xd312('0x11'));logger['debug'](_0xd312('0x12'),_0x200b45,_0xd312('0x11'),JSON['stringify'](_0x4af672));if(_0x4af672[_0xd312('0x13')]){if(_0x4af672[_0xd312('0x13')][_0xd312('0x14')]===0x1f4){logger[_0xd312('0x13')]('MailMessage,\x20%s,\x20%s',_0x200b45,_0x4af672[_0xd312('0x13')][_0xd312('0x15')]);return _0x444f32(_0x4af672['error'][_0xd312('0x15')]);}logger[_0xd312('0x13')]('MailMessage,\x20%s,\x20%s',_0x200b45,_0x4af672[_0xd312('0x13')][_0xd312('0x15')]);return _0x5bc6e7(_0x4af672[_0xd312('0x13')][_0xd312('0x15')]);}else{logger[_0xd312('0xf')](_0xd312('0x10'),_0x200b45,_0xd312('0x11'));_0x5bc6e7(_0x4af672[_0xd312('0x16')]['message']);}})['catch'](function(_0x3ecb32){logger[_0xd312('0x13')](_0xd312('0x10'),_0x200b45,_0x3ecb32);_0x444f32(_0x3ecb32);});});}exports[_0xd312('0x17')]=function(_0x4b959b){var _0x4ce937=this;return new Promise(function(_0x1ce5e1,_0x463b6a){return db[_0xd312('0x18')]['create'](_0x4b959b[_0xd312('0x19')],{'raw':_0x4b959b[_0xd312('0x1a')]?_0x4b959b[_0xd312('0x1a')][_0xd312('0x1b')]===undefined?!![]:![]:!![]})[_0xd312('0xe')](function(_0x38a235){logger['info'](_0xd312('0x17'),_0x4b959b);logger[_0xd312('0x1c')]('CreateMailMessage',_0x4b959b,JSON[_0xd312('0x1d')](_0x38a235));_0x1ce5e1(_0x38a235);})[_0xd312('0x1e')](function(_0x19fa39){logger['error'](_0xd312('0x17'),_0x19fa39[_0xd312('0x15')],_0x4b959b);_0x463b6a(_0x4ce937[_0xd312('0x13')](0x1f4,_0x19fa39[_0xd312('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 114ae59..8de22b8 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 _0x851e=['register','length','./mailMessage.events','save','remove','emit'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x851e,0x1e8));var _0xe851=function(_0xdac383,_0x505d99){_0xdac383=_0xdac383-0x0;var _0x3e783d=_0x851e[_0xdac383];return _0x3e783d;};'use strict';var MailMessageEvents=require(_0xe851('0x0'));var events=[_0xe851('0x1'),_0xe851('0x2'),'update'];function createListener(_0x506932,_0x122708){return function(_0x11f06b){_0x122708[_0xe851('0x3')](_0x506932,_0x11f06b);};}function removeListener(_0x326b34,_0xe50306){return function(){MailMessageEvents['removeListener'](_0x326b34,_0xe50306);};}exports[_0xe851('0x4')]=function(_0x2b36b5){for(var _0xba0648=0x0,_0x37ac0b=events[_0xe851('0x5')];_0xba0648<_0x37ac0b;_0xba0648++){var _0x4e1c59=events[_0xba0648];var _0x38a43b=createListener('mailMessage:'+_0x4e1c59,_0x2b36b5);MailMessageEvents['on'](_0x4e1c59,_0x38a43b);}}; \ No newline at end of file +var _0x4b81=['emit','removeListener','length','mailMessage:','./mailMessage.events','remove','update'];(function(_0x48fb10,_0xa50a89){var _0x534251=function(_0xcdc19e){while(--_0xcdc19e){_0x48fb10['push'](_0x48fb10['shift']());}};_0x534251(++_0xa50a89);}(_0x4b81,0x9e));var _0x14b8=function(_0x4aabe3,_0x867468){_0x4aabe3=_0x4aabe3-0x0;var _0x4df232=_0x4b81[_0x4aabe3];return _0x4df232;};'use strict';var MailMessageEvents=require(_0x14b8('0x0'));var events=['save',_0x14b8('0x1'),_0x14b8('0x2')];function createListener(_0x341fa8,_0x3a976e){return function(_0x5a1114){_0x3a976e[_0x14b8('0x3')](_0x341fa8,_0x5a1114);};}function removeListener(_0x426f1b,_0x2254d2){return function(){MailMessageEvents[_0x14b8('0x4')](_0x426f1b,_0x2254d2);};}exports['register']=function(_0x51f300){for(var _0x1d2c35=0x0,_0x512e62=events[_0x14b8('0x5')];_0x1d2c35<_0x512e62;_0x1d2c35++){var _0x104775=events[_0x1d2c35];var _0x3702b3=createListener(_0x14b8('0x6')+_0x104775,_0x51f300);MailMessageEvents['on'](_0x104775,_0x3702b3);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0920e50..02a318f 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 _0xbcb6=['express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','util','connect-timeout'];(function(_0x38d9cb,_0x30654d){var _0x15102a=function(_0x13db6b){while(--_0x13db6b){_0x38d9cb['push'](_0x38d9cb['shift']());}};_0x15102a(++_0x30654d);}(_0xbcb6,0xad));var _0x6bcb=function(_0x3776b4,_0x19a1e3){_0x3776b4=_0x3776b4-0x0;var _0x1636d9=_0xbcb6[_0x3776b4];return _0x1636d9;};'use strict';var multer=require('multer');var util=require(_0x6bcb('0x0'));var path=require('path');var timeout=require(_0x6bcb('0x1'));var express=require(_0x6bcb('0x2'));var router=express[_0x6bcb('0x3')]();var auth=require(_0x6bcb('0x4'));var interaction=require(_0x6bcb('0x5'));var config=require('../../config/environment');var controller=require(_0x6bcb('0x6'));router[_0x6bcb('0x7')]('/',auth[_0x6bcb('0x8')](),controller['index']);router['get'](_0x6bcb('0x9'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0xa')]);router[_0x6bcb('0x7')](_0x6bcb('0xb'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0xc')]);router[_0x6bcb('0x7')]('/:id/members',auth[_0x6bcb('0x8')](),controller[_0x6bcb('0xd')]);router[_0x6bcb('0x7')](_0x6bcb('0xe'),auth[_0x6bcb('0x8')](),controller['getTeams']);router[_0x6bcb('0x7')](_0x6bcb('0xf'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x10')]);router[_0x6bcb('0x11')]('/',auth[_0x6bcb('0x8')](),controller['create']);router[_0x6bcb('0x11')](_0x6bcb('0xe'),auth[_0x6bcb('0x8')](),controller['addTeams']);router[_0x6bcb('0x11')](_0x6bcb('0xf'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x12')]);router[_0x6bcb('0x13')](_0x6bcb('0xb'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x14')]);router['delete'](_0x6bcb('0xb'),auth['isAuthenticated'](),controller[_0x6bcb('0x15')]);router[_0x6bcb('0x16')]('/:id/teams',auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x17')]);router[_0x6bcb('0x16')](_0x6bcb('0xf'),auth['isAuthenticated'](),controller[_0x6bcb('0x18')]);module['exports']=router; \ No newline at end of file +var _0x967f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x967f,0x1a4));var _0xf967=function(_0x2dc786,_0x49378d){_0x2dc786=_0x2dc786-0x0;var _0x5f0e7e=_0x967f[_0x2dc786];return _0x5f0e7e;};'use strict';var multer=require(_0xf967('0x0'));var util=require('util');var path=require(_0xf967('0x1'));var timeout=require(_0xf967('0x2'));var express=require(_0xf967('0x3'));var router=express[_0xf967('0x4')]();var auth=require(_0xf967('0x5'));var interaction=require(_0xf967('0x6'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xf967('0x7')]('/',auth[_0xf967('0x8')](),controller[_0xf967('0x9')]);router[_0xf967('0x7')](_0xf967('0xa'),auth[_0xf967('0x8')](),controller[_0xf967('0xb')]);router[_0xf967('0x7')]('/:id',auth[_0xf967('0x8')](),controller['show']);router[_0xf967('0x7')](_0xf967('0xc'),auth['isAuthenticated'](),controller[_0xf967('0xd')]);router[_0xf967('0x7')](_0xf967('0xe'),auth[_0xf967('0x8')](),controller[_0xf967('0xf')]);router[_0xf967('0x7')](_0xf967('0x10'),auth['isAuthenticated'](),controller[_0xf967('0x11')]);router['post']('/',auth[_0xf967('0x8')](),controller['create']);router[_0xf967('0x12')](_0xf967('0xe'),auth['isAuthenticated'](),controller[_0xf967('0x13')]);router[_0xf967('0x12')](_0xf967('0x10'),auth[_0xf967('0x8')](),controller[_0xf967('0x14')]);router[_0xf967('0x15')](_0xf967('0x16'),auth['isAuthenticated'](),controller[_0xf967('0x17')]);router[_0xf967('0x18')](_0xf967('0x16'),auth[_0xf967('0x8')](),controller[_0xf967('0x19')]);router['delete'](_0xf967('0xe'),auth[_0xf967('0x8')](),controller['removeTeams']);router[_0xf967('0x18')](_0xf967('0x10'),auth['isAuthenticated'](),controller[_0xf967('0x1a')]);module[_0xf967('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5d7e82e..a7c49eb 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 _0xf69c=['roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x33dcc1,_0x3d1495){var _0x5ea2c8=function(_0x162b3b){while(--_0x162b3b){_0x33dcc1['push'](_0x33dcc1['shift']());}};_0x5ea2c8(++_0x3d1495);}(_0xf69c,0x151));var _0xcf69=function(_0x140202,_0x4245c7){_0x140202=_0x140202-0x0;var _0x3037c2=_0xf69c[_0x140202];return _0x3037c2;};'use strict';var Sequelize=require(_0xcf69('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf69('0x1')],'unique':_0xcf69('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcf69('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcf69('0x4'),'beepall',_0xcf69('0x5'))}}; \ No newline at end of file +var _0x4f81=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x24d8d1,_0x54a306){var _0x2aec98=function(_0x531a63){while(--_0x531a63){_0x24d8d1['push'](_0x24d8d1['shift']());}};_0x2aec98(++_0x54a306);}(_0x4f81,0x1e3));var _0x14f8=function(_0x39ef84,_0x45b675){_0x39ef84=_0x39ef84-0x0;var _0x1bd320=_0x4f81[_0x39ef84];return _0x1bd320;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x14f8('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x14f8('0x0')]},'timeout':{'type':Sequelize[_0x14f8('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x14f8('0x2')](_0x14f8('0x3'),_0x14f8('0x4'),_0x14f8('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 0673de1..9ae72d0 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 _0xdd4f=['type','VIRTUAL','options','MailQueue','includeAll','findAll','rows','catch','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserMailQueue','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','toString','QueryTypes','every','includes','union','compact','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','MailQueues','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x833bdc,_0x1dca8b){_0x833bdc=_0x833bdc-0x0;var _0x307055=_0xdd4f[_0x833bdc];return _0x307055;};'use strict';var pdf=require(_0xfdd4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfdd4('0x1'));var rp=require(_0xfdd4('0x2'));var moment=require('moment');var BPromise=require(_0xfdd4('0x3'));var Mustache=require(_0xfdd4('0x4'));var util=require(_0xfdd4('0x5'));var path=require('path');var sox=require(_0xfdd4('0x6'));var csv=require(_0xfdd4('0x7'));var ejs=require(_0xfdd4('0x8'));var fs=require('fs');var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x7'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=_0x2ccc88[_0xfdd4('0x1f')],_0x33d752=_0x2eb174['offset'],_0x1746e1=_0x2eb174[_0xfdd4('0x20')]+_0x2eb174[_0xfdd4('0x21')],_0x2ffd5f;if(_0x1746e1>=_0x32b5f7){_0x1746e1=_0x32b5f7;_0x2ffd5f=0xc8;}else{_0x2ffd5f=0xce;}_0x216c7e[_0xfdd4('0x1c')](_0x2ffd5f);return _0x216c7e[_0xfdd4('0x22')](_0xfdd4('0x23'),_0x33d752+'-'+_0x1746e1+'/'+_0x32b5f7)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x452afb){return function(_0x34dfa8){try{jsonpatch['apply'](_0x34dfa8,_0x452afb,!![]);}catch(_0x2147e6){return BPromise[_0xfdd4('0x24')](_0x2147e6);}return _0x34dfa8[_0xfdd4('0x25')]();};}function saveUpdates(_0x16e81b,_0xb7856d){return function(_0x144acd){if(_0x144acd){return _0x144acd[_0xfdd4('0x26')](_0x16e81b)[_0xfdd4('0x27')](function(_0x538b00){return _0x538b00;});}return null;};}function removeEntity(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['destroy']()[_0xfdd4('0x27')](function(){var _0x39b712=_0x4397a3[_0xfdd4('0x28')]({'plain':!![]});var _0x2f8268=_0xfdd4('0x29');return db['UserProfileResource'][_0xfdd4('0x2a')]({'where':{'type':_0x2f8268,'resourceId':_0x39b712['id']}})[_0xfdd4('0x27')](function(){return _0x4397a3;});})[_0xfdd4('0x27')](function(){_0x1e14da[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x192471,_0x453a48){return function(_0x37b7a2){if(!_0x37b7a2){_0x192471['sendStatus'](0x194);}return _0x37b7a2;};}function handleError(_0xcbd1fb,_0x39981f){_0x39981f=_0x39981f||0x1f4;return function(_0x385a68){logger[_0xfdd4('0x2b')](_0x385a68[_0xfdd4('0x2c')]);if(_0x385a68['name']){delete _0x385a68[_0xfdd4('0x2d')];}_0xcbd1fb[_0xfdd4('0x1c')](_0x39981f)[_0xfdd4('0x2e')](_0x385a68);};}exports[_0xfdd4('0x2f')]=function(_0x13cc5e,_0x4d64ce){var _0x374e98={},_0x315568={},_0x2ab99e={'count':0x0,'rows':[]};var _0x5ba4e8=_[_0xfdd4('0x30')](db['MailQueue'][_0xfdd4('0x31')],function(_0x2b22f9){return{'name':_0x2b22f9['fieldName'],'type':_0x2b22f9['type'][_0xfdd4('0x32')]};});_0x315568[_0xfdd4('0x33')]=_['map'](_0x5ba4e8,'name');_0x315568[_0xfdd4('0x34')]=_[_0xfdd4('0x35')](_0x13cc5e[_0xfdd4('0x34')]);_0x315568[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x315568[_0xfdd4('0x33')],_0x315568[_0xfdd4('0x34')]);_0x374e98[_0xfdd4('0x38')]=_[_0xfdd4('0x37')](_0x315568[_0xfdd4('0x33')],qs[_0xfdd4('0x39')](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x39')]));_0x374e98[_0xfdd4('0x38')]=_0x374e98[_0xfdd4('0x38')][_0xfdd4('0x3a')]?_0x374e98[_0xfdd4('0x38')]:_0x315568[_0xfdd4('0x33')];if(!_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3b')](_0xfdd4('0x3c'))){_0x374e98[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x21')]);_0x374e98[_0xfdd4('0x20')]=qs['offset'](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x20')]);}_0x374e98[_0xfdd4('0x3d')]=qs[_0xfdd4('0x3e')](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3e')]);_0x374e98['where']=qs[_0xfdd4('0x36')](_['pick'](_0x13cc5e[_0xfdd4('0x34')],_0x315568[_0xfdd4('0x36')]),_0x5ba4e8);if(_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x374e98['where']=_[_0xfdd4('0x40')](_0x374e98[_0xfdd4('0x41')],{'$or':_[_0xfdd4('0x30')](_0x5ba4e8,function(_0x2ee857){if(_0x2ee857[_0xfdd4('0x42')]!==_0xfdd4('0x43')){var _0x28e5e2={};_0x28e5e2[_0x2ee857[_0xfdd4('0x2d')]]={'$like':'%'+_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3f')]+'%'};return _0x28e5e2;}})});}_0x374e98=_['merge']({},_0x374e98,_0x13cc5e[_0xfdd4('0x44')]);var _0x2196f={'where':_0x374e98[_0xfdd4('0x41')]};return db[_0xfdd4('0x45')]['count'](_0x2196f)[_0xfdd4('0x27')](function(_0x378965){_0x2ab99e[_0xfdd4('0x1f')]=_0x378965;if(_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x46')]){_0x374e98['include']=[{'all':!![]}];}return db[_0xfdd4('0x45')][_0xfdd4('0x47')](_0x374e98);})[_0xfdd4('0x27')](function(_0x11f1ed){_0x2ab99e[_0xfdd4('0x48')]=_0x11f1ed;return _0x2ab99e;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x4d64ce,_0x374e98))[_0xfdd4('0x49')](handleError(_0x4d64ce,null));};exports['show']=function(_0x2dd3fa,_0x586713){var _0x3a0de9={'raw':!![],'where':{'id':_0x2dd3fa[_0xfdd4('0x4a')]['id']}},_0x11f241={};_0x11f241[_0xfdd4('0x33')]=_['keys'](db[_0xfdd4('0x45')][_0xfdd4('0x31')]);_0x11f241['query']=_[_0xfdd4('0x35')](_0x2dd3fa[_0xfdd4('0x34')]);_0x11f241['filters']=_[_0xfdd4('0x37')](_0x11f241['model'],_0x11f241['query']);_0x3a0de9['attributes']=_[_0xfdd4('0x37')](_0x11f241[_0xfdd4('0x33')],qs[_0xfdd4('0x39')](_0x2dd3fa['query'][_0xfdd4('0x39')]));_0x3a0de9[_0xfdd4('0x38')]=_0x3a0de9['attributes'][_0xfdd4('0x3a')]?_0x3a0de9[_0xfdd4('0x38')]:_0x11f241[_0xfdd4('0x33')];if(_0x2dd3fa[_0xfdd4('0x34')][_0xfdd4('0x46')]){_0x3a0de9[_0xfdd4('0x4b')]=[{'all':!![]}];}_0x3a0de9=_[_0xfdd4('0x40')]({},_0x3a0de9,_0x2dd3fa[_0xfdd4('0x44')]);return db[_0xfdd4('0x45')][_0xfdd4('0x4c')](_0x3a0de9)[_0xfdd4('0x27')](handleEntityNotFound(_0x586713,null))[_0xfdd4('0x27')](respondWithResult(_0x586713,null))[_0xfdd4('0x49')](handleError(_0x586713,null));};exports[_0xfdd4('0x4d')]=function(_0x55065e,_0x4dd1a2){return db[_0xfdd4('0x45')][_0xfdd4('0x4d')](_0x55065e[_0xfdd4('0x4e')],{})[_0xfdd4('0x27')](function(_0x507bf5){var _0x3c6828=_0x55065e[_0xfdd4('0x4f')]['get']({'plain':!![]});if(!_0x3c6828)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c6828['role']==='user'){var _0x557cb3=_0x507bf5[_0xfdd4('0x28')]({'plain':!![]});var _0x88e9ef=_0xfdd4('0x29');return db[_0xfdd4('0x50')][_0xfdd4('0x4c')]({'where':{'name':_0x88e9ef,'userProfileId':_0x3c6828[_0xfdd4('0x51')]},'raw':!![]})['then'](function(_0x17bbab){if(_0x17bbab&&_0x17bbab[_0xfdd4('0x52')]===0x0){return db[_0xfdd4('0x53')][_0xfdd4('0x4d')]({'name':_0x557cb3['name'],'resourceId':_0x557cb3['id'],'type':_0x17bbab[_0xfdd4('0x2d')],'sectionId':_0x17bbab['id']},{})[_0xfdd4('0x27')](function(){return _0x507bf5;});}else{return _0x507bf5;}})['catch'](function(_0x3e3916){logger[_0xfdd4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e3916);throw _0x3e3916;});}return _0x507bf5;})['then'](respondWithResult(_0x4dd1a2,0xc9))[_0xfdd4('0x49')](handleError(_0x4dd1a2,null));};exports[_0xfdd4('0x26')]=function(_0x18f071,_0x30ce95){if(_0x18f071[_0xfdd4('0x4e')]['id']){delete _0x18f071[_0xfdd4('0x4e')]['id'];}return db[_0xfdd4('0x45')][_0xfdd4('0x4c')]({'where':{'id':_0x18f071['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x30ce95,null))['then'](saveUpdates(_0x18f071['body'],null))[_0xfdd4('0x27')](respondWithResult(_0x30ce95,null))[_0xfdd4('0x49')](handleError(_0x30ce95,null));};exports['destroy']=function(_0x4f2160,_0x4df9d4){return db[_0xfdd4('0x45')][_0xfdd4('0x4c')]({'where':{'id':_0x4f2160['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x4df9d4,null))[_0xfdd4('0x27')](removeEntity(_0x4df9d4,null))[_0xfdd4('0x49')](handleError(_0x4df9d4,null));};exports[_0xfdd4('0x54')]=function(_0x24d995,_0x52887d){return db['MailQueue']['describe']()['then'](respondWithResult(_0x52887d,null))[_0xfdd4('0x49')](handleError(_0x52887d,null));};exports[_0xfdd4('0x55')]=function(_0x5ddc25,_0x1eee3d,_0x2abe50){var _0x4d4304={'raw':!![],'where':{}},_0x45dcc8={},_0x118eb0;return db['MailQueue'][_0xfdd4('0x56')]({'where':{'id':_0x5ddc25[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x1eee3d,null))['then'](function(_0x2cc8ca){if(_0x2cc8ca){_0x118eb0=_0x2cc8ca[_0xfdd4('0x28')]({'plain':!![]});_0x45dcc8[_0xfdd4('0x33')]=_[_0xfdd4('0x35')](db[_0xfdd4('0x57')]['rawAttributes']);_0x45dcc8[_0xfdd4('0x34')]=_[_0xfdd4('0x35')](_0x5ddc25[_0xfdd4('0x34')]);_0x45dcc8[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x45dcc8[_0xfdd4('0x33')],_0x45dcc8[_0xfdd4('0x34')]);_0x4d4304[_0xfdd4('0x38')]=_[_0xfdd4('0x37')](_0x45dcc8['model'],qs[_0xfdd4('0x39')](_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x39')]));_0x4d4304[_0xfdd4('0x38')]=_0x4d4304[_0xfdd4('0x38')]['length']?_0x4d4304[_0xfdd4('0x38')]:_0x45dcc8[_0xfdd4('0x33')];if(!_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x3b')](_0xfdd4('0x3c'))){_0x4d4304[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x21')]);_0x4d4304[_0xfdd4('0x20')]=qs[_0xfdd4('0x20')](_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x20')]);}_0x4d4304['order']=qs[_0xfdd4('0x3e')](_0x5ddc25['query'][_0xfdd4('0x3e')]);_0x4d4304[_0xfdd4('0x41')]=qs[_0xfdd4('0x36')](_[_0xfdd4('0x58')](_0x5ddc25[_0xfdd4('0x34')],_0x45dcc8[_0xfdd4('0x36')]));_0x4d4304[_0xfdd4('0x41')][_0xfdd4('0x59')]=_0x2cc8ca['id'];if(_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x4d4304[_0xfdd4('0x41')]=_[_0xfdd4('0x40')](_0x4d4304['where'],{'$or':_['map'](_0x4d4304['attributes'],function(_0x3feda6){var _0x2fcfe4={};_0x2fcfe4[_0x3feda6]={'$like':'%'+_0x5ddc25['query'][_0xfdd4('0x3f')]+'%'};return _0x2fcfe4;})});}_0x4d4304=_[_0xfdd4('0x40')]({},_0x4d4304,_0x5ddc25[_0xfdd4('0x44')]);return db[_0xfdd4('0x57')][_0xfdd4('0x47')](_0x4d4304);}})['then'](function(_0x150537){if(_0x150537){return db[_0xfdd4('0x5a')][_0xfdd4('0x5b')]({'where':{'id':_['map'](_0x150537,_0xfdd4('0x5c')),'role':'agent'},'attributes':['id',_0xfdd4('0x2d'),_0xfdd4('0x5d'),_0xfdd4('0x5e'),_0xfdd4('0x5f')]});}})['then'](function(_0x2351b6){if(_0x2351b6){return{'count':_0x2351b6[_0xfdd4('0x1f')],'rows':_['map'](_0x2351b6[_0xfdd4('0x48')],function(_0x341e95){return{'membername':_0x341e95[_0xfdd4('0x2d')],'UserId':_0x341e95['id'],'queue_name':_0x118eb0['name'],'MailQueueId':_0x118eb0['id'],'interface':util[_0xfdd4('0x60')](_0xfdd4('0x61'),_0xfdd4('0x62'),_0x341e95['name']),'penalty':0x0,'paused':_0x341e95[_0xfdd4('0x5d')],'createdAt':_0x341e95[_0xfdd4('0x5f')],'updatedAt':_0x341e95[_0xfdd4('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfdd4('0x27')](respondWithFilteredResult(_0x1eee3d,_0x4d4304))[_0xfdd4('0x49')](handleError(_0x1eee3d,null));};exports[_0xfdd4('0x63')]=function(_0x185226,_0x539d3b,_0x147d54){var _0x36b615={};var _0xab101d={};var _0x3c24b0;var _0xcdc104;return db[_0xfdd4('0x45')][_0xfdd4('0x56')]({'where':{'id':_0x185226[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x539d3b,null))[_0xfdd4('0x27')](function(_0x5800b8){if(_0x5800b8){_0x3c24b0=_0x5800b8;_0xab101d['model']=_[_0xfdd4('0x35')](db['Team'][_0xfdd4('0x31')]);_0xab101d['query']=_[_0xfdd4('0x35')](_0x185226[_0xfdd4('0x34')]);_0xab101d[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0xab101d[_0xfdd4('0x33')],_0xab101d[_0xfdd4('0x34')]);_0x36b615[_0xfdd4('0x38')]=_['intersection'](_0xab101d['model'],qs[_0xfdd4('0x39')](_0x185226['query'][_0xfdd4('0x39')]));_0x36b615[_0xfdd4('0x38')]=_0x36b615[_0xfdd4('0x38')][_0xfdd4('0x3a')]?_0x36b615[_0xfdd4('0x38')]:_0xab101d[_0xfdd4('0x33')];_0x36b615[_0xfdd4('0x3d')]=qs['sort'](_0x185226['query'][_0xfdd4('0x3e')]);_0x36b615[_0xfdd4('0x41')]=qs[_0xfdd4('0x36')](_[_0xfdd4('0x58')](_0x185226[_0xfdd4('0x34')],_0xab101d[_0xfdd4('0x36')]));if(_0x185226[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x36b615[_0xfdd4('0x41')]=_[_0xfdd4('0x40')](_0x36b615[_0xfdd4('0x41')],{'$or':_[_0xfdd4('0x30')](_0x36b615[_0xfdd4('0x38')],function(_0x48c480){var _0x4bb814={};_0x4bb814[_0x48c480]={'$like':'%'+_0x185226[_0xfdd4('0x34')][_0xfdd4('0x3f')]+'%'};return _0x4bb814;})});}_0x36b615=_['merge']({},_0x36b615,_0x185226['options']);return _0x3c24b0[_0xfdd4('0x63')](_0x36b615);}})[_0xfdd4('0x27')](function(_0x4b85bd){if(_0x4b85bd){_0xcdc104=_0x4b85bd[_0xfdd4('0x3a')];if(!_0x185226[_0xfdd4('0x34')][_0xfdd4('0x3b')](_0xfdd4('0x3c'))){_0x36b615[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x185226['query'][_0xfdd4('0x21')]);_0x36b615[_0xfdd4('0x20')]=qs[_0xfdd4('0x20')](_0x185226[_0xfdd4('0x34')][_0xfdd4('0x20')]);}return _0x3c24b0[_0xfdd4('0x63')](_0x36b615);}})[_0xfdd4('0x27')](function(_0x18eea8){if(_0x18eea8){return _0x18eea8?{'count':_0xcdc104,'rows':_0x18eea8}:null;}})['then'](respondWithResult(_0x539d3b,null))['catch'](handleError(_0x539d3b,null));};exports[_0xfdd4('0x64')]=function(_0x54e922,_0xe13e8a,_0x1b4f61){var _0x298906=_0x54e922[_0xfdd4('0x4e')][_0xfdd4('0x65')];return db['Team']['findAll']({'where':{'id':_0x298906},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x5a')],'as':'Agents','attributes':['id',_0xfdd4('0x2d'),'online',_0xfdd4('0x66'),_0xfdd4('0x67')],'raw':!![]}]})[_0xfdd4('0x27')](function(_0x5b48a0){if(_0x5b48a0){var _0x43e308=_[_0xfdd4('0x68')](_0x5b48a0,function(_0x1823e1){var _0x18ae9e=_0x1823e1[_0xfdd4('0x28')]({'plain':!![]});return _0x18ae9e[_0xfdd4('0x69')];});return db[_0xfdd4('0x45')]['find']({'where':{'id':_0x54e922[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x1bd3e7){return db[_0xfdd4('0x6a')][_0xfdd4('0x6b')](function(_0x33a5a0){return _0x1bd3e7[_0xfdd4('0x64')](_0x298906,{'transaction':_0x33a5a0})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x6c')](_0x43e308,function(_0x530157){return db['UserMailQueue'][_0xfdd4('0x6d')]({'where':{'UserId':_0x530157['id'],'MailQueueId':_0x54e922[_0xfdd4('0x4a')]['id']},'transaction':_0x33a5a0});});})[_0xfdd4('0x27')](function(){_0x43e308['forEach'](function(_0x22e0c9){socket[_0xfdd4('0x6e')](_0xfdd4('0x6f'),{'UserId':_0x22e0c9['id'],'MailQueueId':_0x1bd3e7['id']});});});});});}})[_0xfdd4('0x27')](respondWithStatusCode(_0xe13e8a,null))['catch'](handleError(_0xe13e8a,null));};exports['removeTeams']=function(_0x21ccc0,_0xea95b6,_0x3b75bf){return db['Team'][_0xfdd4('0x47')]({'where':{'id':_0x21ccc0[_0xfdd4('0x34')][_0xfdd4('0x65')]},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x5a')],'as':_0xfdd4('0x69'),'attributes':['id'],'raw':!![]}]})[_0xfdd4('0x27')](handleEntityNotFound(_0xea95b6,null))['then'](function(_0x5150d8){var _0x5ba44a=_[_0xfdd4('0x30')](_0x5150d8,'id');var _0x6a1410=[];var _0x1e4556=[];var _0x1515e0=squel[_0xfdd4('0x70')]();_0x1515e0[_0xfdd4('0x71')](_0xfdd4('0x72'))['from'](_0xfdd4('0x73'),'tq')['join'](_0xfdd4('0x74'),'ut',_0xfdd4('0x75'))['where'](_0xfdd4('0x76'),_0x21ccc0[_0xfdd4('0x4a')]['id']);for(var _0x163426=0x0;_0x163426<_0x5150d8[_0xfdd4('0x3a')];_0x163426+=0x1){let _0x3cd7ae=_0x5150d8[_0x163426];for(var _0xd5d8cb=0x0;_0xd5d8cb<_0x3cd7ae[_0xfdd4('0x69')][_0xfdd4('0x3a')];_0xd5d8cb+=0x1){let _0xcc0684=_0x3cd7ae['Agents'][_0xd5d8cb];var _0x391a25=_0x1515e0['clone']();_0x391a25[_0xfdd4('0x41')]('ut.UserId\x20=\x20?',_0xcc0684['id']);_0x1e4556['push'](db[_0xfdd4('0x6a')][_0xfdd4('0x34')](_0x391a25[_0xfdd4('0x77')](),{'type':db[_0xfdd4('0x6a')][_0xfdd4('0x78')]['SELECT']})[_0xfdd4('0x27')](function(_0x1fad79){if(_0x1fad79[_0xfdd4('0x3a')]===0x1){return _0xcc0684['id'];}else{var _0x90eabb=_[_0xfdd4('0x79')](_[_0xfdd4('0x30')](_0x1fad79,'TeamId'),function(_0x7a81f1){return _[_0xfdd4('0x7a')](_0x5ba44a,_0x7a81f1);});if(_0x90eabb){return _0xcc0684['id'];}}}));}}return BPromise['all'](_0x1e4556)['then'](function(_0x4a5749){_0x6a1410=_(_0x6a1410)[_0xfdd4('0x7b')](_0x4a5749)[_0xfdd4('0x7c')]()['value']();return db['MailQueue'][_0xfdd4('0x4c')]({'where':{'id':_0x21ccc0[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x5f0d71){return db['sequelize'][_0xfdd4('0x6b')](function(_0xd6eb47){return _0x5f0d71[_0xfdd4('0x7d')](_0x21ccc0['query'][_0xfdd4('0x65')],{'transaction':_0xd6eb47})['then'](function(){if(!_[_0xfdd4('0x7e')](_0x6a1410)){return _0x5f0d71[_0xfdd4('0x7f')](_0x6a1410,{'transaction':_0xd6eb47});}})[_0xfdd4('0x27')](function(){_0x6a1410['forEach'](function(_0x3966ed){socket[_0xfdd4('0x6e')](_0xfdd4('0x80'),{'UserId':_0x3966ed,'MailQueueId':_0x5f0d71['id']});});});});});});})[_0xfdd4('0x27')](respondWithStatusCode(_0xea95b6,null))[_0xfdd4('0x49')](handleError(_0xea95b6,null));};exports['addAgents']=function(_0x19de84,_0x71376e,_0x133f56){return db['MailQueue'][_0xfdd4('0x4c')]({'where':{'id':_0x19de84[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x71376e,null))[_0xfdd4('0x27')](function(_0x56e5d3){if(_0x56e5d3){return _0x56e5d3[_0xfdd4('0x81')](_0x19de84['body']['ids'],_['omit'](_0x19de84[_0xfdd4('0x4e')],['ids','id'])||{})['spread'](function(_0x52082a){for(var _0x459f5b=0x0;_0x459f5b<_0x19de84[_0xfdd4('0x4e')][_0xfdd4('0x65')][_0xfdd4('0x3a')];_0x459f5b+=0x1){socket[_0xfdd4('0x6e')](_0xfdd4('0x6f'),{'UserId':_0x19de84[_0xfdd4('0x4e')][_0xfdd4('0x65')][_0x459f5b],'MailQueueId':_0x19de84[_0xfdd4('0x4a')]['id']});}return _0x52082a;});}})[_0xfdd4('0x27')](respondWithResult(_0x71376e,null))[_0xfdd4('0x49')](handleError(_0x71376e,null));};exports[_0xfdd4('0x7f')]=function(_0x31303f,_0x40fc6a,_0x46b927){return db[_0xfdd4('0x45')][_0xfdd4('0x4c')]({'where':{'id':_0x31303f[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x40fc6a,null))[_0xfdd4('0x27')](function(_0x1e28f8){if(_0x1e28f8){return _0x1e28f8[_0xfdd4('0x7f')](_0x31303f[_0xfdd4('0x34')][_0xfdd4('0x65')])[_0xfdd4('0x27')](function(){if(_[_0xfdd4('0x82')](_0x31303f['query'][_0xfdd4('0x65')])){for(var _0x3bbee0=0x0;_0x3bbee0<_0x31303f[_0xfdd4('0x34')][_0xfdd4('0x65')][_0xfdd4('0x3a')];_0x3bbee0+=0x1){socket['emit'](_0xfdd4('0x80'),{'UserId':Number(_0x31303f[_0xfdd4('0x34')][_0xfdd4('0x65')][_0x3bbee0]),'MailQueueId':Number(_0x31303f[_0xfdd4('0x4a')]['id'])});}}else{socket[_0xfdd4('0x6e')](_0xfdd4('0x80'),{'UserId':Number(_0x31303f['query'][_0xfdd4('0x65')]),'MailQueueId':Number(_0x31303f[_0xfdd4('0x4a')]['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x40fc6a,null))[_0xfdd4('0x49')](handleError(_0x40fc6a,null));};exports[_0xfdd4('0x83')]=function(_0x260b70,_0x566a92,_0x2a6a0d){var _0x3d82d1={};var _0x17d272={};var _0x5e19db;var _0x27ad11;return db[_0xfdd4('0x45')]['findOne']({'where':{'id':_0x260b70['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x566a92,null))[_0xfdd4('0x27')](function(_0x16635c){if(_0x16635c){_0x5e19db=_0x16635c;_0x17d272[_0xfdd4('0x33')]=_['keys'](db[_0xfdd4('0x5a')]['rawAttributes']);_0x17d272[_0xfdd4('0x34')]=_[_0xfdd4('0x35')](_0x260b70[_0xfdd4('0x34')]);_0x17d272[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x17d272[_0xfdd4('0x33')],_0x17d272[_0xfdd4('0x34')]);_0x3d82d1[_0xfdd4('0x38')]=_[_0xfdd4('0x37')](_0x17d272[_0xfdd4('0x33')],qs[_0xfdd4('0x39')](_0x260b70['query'][_0xfdd4('0x39')]));_0x3d82d1[_0xfdd4('0x38')]=_0x3d82d1[_0xfdd4('0x38')][_0xfdd4('0x3a')]?_0x3d82d1[_0xfdd4('0x38')]:_0x17d272[_0xfdd4('0x33')];_0x3d82d1['order']=qs[_0xfdd4('0x3e')](_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3e')]);_0x3d82d1[_0xfdd4('0x41')]=qs['filters'](_[_0xfdd4('0x58')](_0x260b70[_0xfdd4('0x34')],_0x17d272['filters']));if(_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x3d82d1[_0xfdd4('0x41')]=_[_0xfdd4('0x40')](_0x3d82d1[_0xfdd4('0x41')],{'$or':_[_0xfdd4('0x30')](_0x3d82d1[_0xfdd4('0x38')],function(_0x217d9b){var _0x1d460f={};_0x1d460f[_0x217d9b]={'$like':'%'+_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3f')]+'%'};return _0x1d460f;})});}_0x3d82d1=_[_0xfdd4('0x40')]({},_0x3d82d1,_0x260b70[_0xfdd4('0x44')]);return _0x5e19db[_0xfdd4('0x83')](_0x3d82d1);}})['then'](function(_0x42253b){if(_0x42253b){_0x27ad11=_0x42253b[_0xfdd4('0x3a')];if(!_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3b')]('nolimit')){_0x3d82d1[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x260b70['query'][_0xfdd4('0x21')]);_0x3d82d1[_0xfdd4('0x20')]=qs[_0xfdd4('0x20')](_0x260b70[_0xfdd4('0x34')]['offset']);}return _0x5e19db[_0xfdd4('0x83')](_0x3d82d1);}})['then'](function(_0x2aa3d3){if(_0x2aa3d3){return _0x2aa3d3?{'count':_0x27ad11,'rows':_0x2aa3d3}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x566a92,null))['catch'](handleError(_0x566a92,null));}; \ No newline at end of file +var _0x2f8b=['spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','catch','create','body','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','MailQueueId','User','findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit'];(function(_0x968411,_0x151619){var _0x46e3e5=function(_0x3c621e){while(--_0x3c621e){_0x968411['push'](_0x968411['shift']());}};_0x46e3e5(++_0x151619);}(_0x2f8b,0x96));var _0xb2f8=function(_0x54c152,_0x4a7263){_0x54c152=_0x54c152-0x0;var _0x11ebbc=_0x2f8b[_0x54c152];return _0x11ebbc;};'use strict';var pdf=require(_0xb2f8('0x0'));var emlformat=require(_0xb2f8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb2f8('0x2'));var jsonpatch=require(_0xb2f8('0x3'));var rp=require(_0xb2f8('0x4'));var moment=require(_0xb2f8('0x5'));var BPromise=require(_0xb2f8('0x6'));var Mustache=require(_0xb2f8('0x7'));var util=require(_0xb2f8('0x8'));var path=require('path');var sox=require(_0xb2f8('0x9'));var csv=require(_0xb2f8('0xa'));var ejs=require(_0xb2f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb2f8('0xc'));var crypto=require('crypto');var jsforce=require(_0xb2f8('0xd'));var deskjs=require(_0xb2f8('0xe'));var toCsv=require(_0xb2f8('0xa'));var querystring=require(_0xb2f8('0xf'));var Papa=require(_0xb2f8('0x10'));var Redis=require(_0xb2f8('0x11'));var authService=require(_0xb2f8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2f8('0x13'));var hardwareService=require(_0xb2f8('0x14'));var logger=require(_0xb2f8('0x15'))(_0xb2f8('0x16'));var utils=require(_0xb2f8('0x17'));var config=require(_0xb2f8('0x18'));var licenseUtil=require(_0xb2f8('0x19'));var db=require(_0xb2f8('0x1a'))['db'];config[_0xb2f8('0x1b')]=_[_0xb2f8('0x1c')](config[_0xb2f8('0x1b')],{'host':_0xb2f8('0x1d'),'port':0x18eb});var socket=require(_0xb2f8('0x1e'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xb2f8('0x1f')](socket);function respondWithStatusCode(_0x1389a3,_0x52105e){_0x52105e=_0x52105e||0xcc;return function(_0xe6f94e){if(_0xe6f94e){return _0x1389a3[_0xb2f8('0x20')](_0x52105e);}return _0x1389a3[_0xb2f8('0x21')](_0x52105e)[_0xb2f8('0x22')]();};}function respondWithResult(_0x57d3c8,_0x4aabd4){_0x4aabd4=_0x4aabd4||0xc8;return function(_0x2a39a4){if(_0x2a39a4){return _0x57d3c8[_0xb2f8('0x21')](_0x4aabd4)['json'](_0x2a39a4);}};}function respondWithFilteredResult(_0x90ee1f,_0x31e436){return function(_0x56b307){if(_0x56b307){var _0x345a20=_0x56b307[_0xb2f8('0x23')],_0x4dae59=_0x31e436[_0xb2f8('0x24')],_0x4285ed=_0x31e436[_0xb2f8('0x24')]+_0x31e436[_0xb2f8('0x25')],_0x46333f;if(_0x4285ed>=_0x345a20){_0x4285ed=_0x345a20;_0x46333f=0xc8;}else{_0x46333f=0xce;}_0x90ee1f[_0xb2f8('0x21')](_0x46333f);return _0x90ee1f[_0xb2f8('0x26')](_0xb2f8('0x27'),_0x4dae59+'-'+_0x4285ed+'/'+_0x345a20)[_0xb2f8('0x28')](_0x56b307);}return null;};}function patchUpdates(_0x55bb42){return function(_0x4501eb){try{jsonpatch['apply'](_0x4501eb,_0x55bb42,!![]);}catch(_0x25d13a){return BPromise[_0xb2f8('0x29')](_0x25d13a);}return _0x4501eb[_0xb2f8('0x2a')]();};}function saveUpdates(_0x22fe8b,_0x4f5a75){return function(_0x3fee39){if(_0x3fee39){return _0x3fee39[_0xb2f8('0x2b')](_0x22fe8b)[_0xb2f8('0x2c')](function(_0x5a8466){return _0x5a8466;});}return null;};}function removeEntity(_0x12d551,_0x59243d){return function(_0x4d1a03){if(_0x4d1a03){return _0x4d1a03[_0xb2f8('0x2d')]()[_0xb2f8('0x2c')](function(){var _0x4c2dcc=_0x4d1a03[_0xb2f8('0x2e')]({'plain':!![]});var _0x3643e4=_0xb2f8('0x2f');return db[_0xb2f8('0x30')][_0xb2f8('0x2d')]({'where':{'type':_0x3643e4,'resourceId':_0x4c2dcc['id']}})[_0xb2f8('0x2c')](function(){return _0x4d1a03;});})['then'](function(){_0x12d551[_0xb2f8('0x21')](0xcc)[_0xb2f8('0x22')]();});}};}function handleEntityNotFound(_0x3f9e32,_0x2352dc){return function(_0x2ceb6e){if(!_0x2ceb6e){_0x3f9e32['sendStatus'](0x194);}return _0x2ceb6e;};}function handleError(_0x2a2dcf,_0x190115){_0x190115=_0x190115||0x1f4;return function(_0x4c6662){logger[_0xb2f8('0x31')](_0x4c6662[_0xb2f8('0x32')]);if(_0x4c6662[_0xb2f8('0x33')]){delete _0x4c6662[_0xb2f8('0x33')];}_0x2a2dcf['status'](_0x190115)[_0xb2f8('0x34')](_0x4c6662);};}exports[_0xb2f8('0x35')]=function(_0x196a14,_0x5ca8b1){var _0x38b7e0={},_0x573e61={},_0x19f582={'count':0x0,'rows':[]};var _0x2e1bea=_[_0xb2f8('0x36')](db[_0xb2f8('0x37')][_0xb2f8('0x38')],function(_0x31f922){return{'name':_0x31f922[_0xb2f8('0x39')],'type':_0x31f922[_0xb2f8('0x3a')][_0xb2f8('0x3b')]};});_0x573e61[_0xb2f8('0x3c')]=_['map'](_0x2e1bea,_0xb2f8('0x33'));_0x573e61[_0xb2f8('0x3d')]=_[_0xb2f8('0x3e')](_0x196a14[_0xb2f8('0x3d')]);_0x573e61['filters']=_[_0xb2f8('0x3f')](_0x573e61[_0xb2f8('0x3c')],_0x573e61[_0xb2f8('0x3d')]);_0x38b7e0[_0xb2f8('0x40')]=_[_0xb2f8('0x3f')](_0x573e61['model'],qs[_0xb2f8('0x41')](_0x196a14['query']['fields']));_0x38b7e0[_0xb2f8('0x40')]=_0x38b7e0[_0xb2f8('0x40')][_0xb2f8('0x42')]?_0x38b7e0[_0xb2f8('0x40')]:_0x573e61[_0xb2f8('0x3c')];if(!_0x196a14[_0xb2f8('0x3d')]['hasOwnProperty'](_0xb2f8('0x43'))){_0x38b7e0[_0xb2f8('0x25')]=qs[_0xb2f8('0x25')](_0x196a14['query']['limit']);_0x38b7e0['offset']=qs[_0xb2f8('0x24')](_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x24')]);}_0x38b7e0['order']=qs[_0xb2f8('0x44')](_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x44')]);_0x38b7e0[_0xb2f8('0x45')]=qs[_0xb2f8('0x46')](_[_0xb2f8('0x47')](_0x196a14[_0xb2f8('0x3d')],_0x573e61['filters']),_0x2e1bea);if(_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x48')]){_0x38b7e0['where']=_[_0xb2f8('0x49')](_0x38b7e0[_0xb2f8('0x45')],{'$or':_[_0xb2f8('0x36')](_0x2e1bea,function(_0x32ada8){if(_0x32ada8[_0xb2f8('0x3a')]!==_0xb2f8('0x4a')){var _0x24f9e0={};_0x24f9e0[_0x32ada8[_0xb2f8('0x33')]]={'$like':'%'+_0x196a14[_0xb2f8('0x3d')][_0xb2f8('0x48')]+'%'};return _0x24f9e0;}})});}_0x38b7e0=_['merge']({},_0x38b7e0,_0x196a14[_0xb2f8('0x4b')]);var _0x2ddff3={'where':_0x38b7e0[_0xb2f8('0x45')]};return db[_0xb2f8('0x37')][_0xb2f8('0x23')](_0x2ddff3)[_0xb2f8('0x2c')](function(_0x51a568){_0x19f582[_0xb2f8('0x23')]=_0x51a568;if(_0x196a14[_0xb2f8('0x3d')]['includeAll']){_0x38b7e0[_0xb2f8('0x4c')]=[{'all':!![]}];}return db[_0xb2f8('0x37')][_0xb2f8('0x4d')](_0x38b7e0);})['then'](function(_0x2881ab){_0x19f582[_0xb2f8('0x4e')]=_0x2881ab;return _0x19f582;})['then'](respondWithFilteredResult(_0x5ca8b1,_0x38b7e0))['catch'](handleError(_0x5ca8b1,null));};exports[_0xb2f8('0x4f')]=function(_0x308efb,_0x575636){var _0x33e0bb={'raw':!![],'where':{'id':_0x308efb[_0xb2f8('0x50')]['id']}},_0x54231d={};_0x54231d[_0xb2f8('0x3c')]=_[_0xb2f8('0x3e')](db[_0xb2f8('0x37')][_0xb2f8('0x38')]);_0x54231d['query']=_[_0xb2f8('0x3e')](_0x308efb[_0xb2f8('0x3d')]);_0x54231d['filters']=_[_0xb2f8('0x3f')](_0x54231d[_0xb2f8('0x3c')],_0x54231d[_0xb2f8('0x3d')]);_0x33e0bb[_0xb2f8('0x40')]=_['intersection'](_0x54231d[_0xb2f8('0x3c')],qs['fields'](_0x308efb[_0xb2f8('0x3d')]['fields']));_0x33e0bb[_0xb2f8('0x40')]=_0x33e0bb[_0xb2f8('0x40')][_0xb2f8('0x42')]?_0x33e0bb[_0xb2f8('0x40')]:_0x54231d[_0xb2f8('0x3c')];if(_0x308efb[_0xb2f8('0x3d')]['includeAll']){_0x33e0bb[_0xb2f8('0x4c')]=[{'all':!![]}];}_0x33e0bb=_[_0xb2f8('0x49')]({},_0x33e0bb,_0x308efb[_0xb2f8('0x4b')]);return db[_0xb2f8('0x37')]['find'](_0x33e0bb)[_0xb2f8('0x2c')](handleEntityNotFound(_0x575636,null))['then'](respondWithResult(_0x575636,null))[_0xb2f8('0x51')](handleError(_0x575636,null));};exports[_0xb2f8('0x52')]=function(_0x4f67af,_0x1155ff){return db[_0xb2f8('0x37')][_0xb2f8('0x52')](_0x4f67af[_0xb2f8('0x53')],{})[_0xb2f8('0x2c')](function(_0x57280b){var _0x1fc9f3=_0x4f67af[_0xb2f8('0x54')][_0xb2f8('0x2e')]({'plain':!![]});if(!_0x1fc9f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fc9f3[_0xb2f8('0x55')]==='user'){var _0x3d77cb=_0x57280b[_0xb2f8('0x2e')]({'plain':!![]});var _0x24b6ec=_0xb2f8('0x2f');return db['UserProfileSection'][_0xb2f8('0x56')]({'where':{'name':_0x24b6ec,'userProfileId':_0x1fc9f3[_0xb2f8('0x57')]},'raw':!![]})[_0xb2f8('0x2c')](function(_0x411524){if(_0x411524&&_0x411524['autoAssociation']===0x0){return db['UserProfileResource'][_0xb2f8('0x52')]({'name':_0x3d77cb[_0xb2f8('0x33')],'resourceId':_0x3d77cb['id'],'type':_0x411524['name'],'sectionId':_0x411524['id']},{})[_0xb2f8('0x2c')](function(){return _0x57280b;});}else{return _0x57280b;}})['catch'](function(_0x190958){logger[_0xb2f8('0x31')](_0xb2f8('0x58'),_0x190958);throw _0x190958;});}return _0x57280b;})[_0xb2f8('0x2c')](respondWithResult(_0x1155ff,0xc9))[_0xb2f8('0x51')](handleError(_0x1155ff,null));};exports[_0xb2f8('0x2b')]=function(_0x4c752b,_0x36f3fd){if(_0x4c752b[_0xb2f8('0x53')]['id']){delete _0x4c752b[_0xb2f8('0x53')]['id'];}return db[_0xb2f8('0x37')]['find']({'where':{'id':_0x4c752b[_0xb2f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x36f3fd,null))[_0xb2f8('0x2c')](saveUpdates(_0x4c752b[_0xb2f8('0x53')],null))[_0xb2f8('0x2c')](respondWithResult(_0x36f3fd,null))[_0xb2f8('0x51')](handleError(_0x36f3fd,null));};exports[_0xb2f8('0x2d')]=function(_0x4065fb,_0x1441d3){return db[_0xb2f8('0x37')][_0xb2f8('0x56')]({'where':{'id':_0x4065fb[_0xb2f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x1441d3,null))['then'](removeEntity(_0x1441d3,null))[_0xb2f8('0x51')](handleError(_0x1441d3,null));};exports[_0xb2f8('0x59')]=function(_0x5814fc,_0x5380a9){return db['MailQueue'][_0xb2f8('0x59')]()['then'](respondWithResult(_0x5380a9,null))[_0xb2f8('0x51')](handleError(_0x5380a9,null));};exports[_0xb2f8('0x5a')]=function(_0x362012,_0x52640a,_0x1aab69){var _0x4ec32a={'raw':!![],'where':{}},_0x56b213={},_0x594f02;return db[_0xb2f8('0x37')][_0xb2f8('0x5b')]({'where':{'id':_0x362012[_0xb2f8('0x50')]['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x52640a,null))[_0xb2f8('0x2c')](function(_0x5af46e){if(_0x5af46e){_0x594f02=_0x5af46e[_0xb2f8('0x2e')]({'plain':!![]});_0x56b213[_0xb2f8('0x3c')]=_[_0xb2f8('0x3e')](db[_0xb2f8('0x5c')]['rawAttributes']);_0x56b213[_0xb2f8('0x3d')]=_['keys'](_0x362012[_0xb2f8('0x3d')]);_0x56b213[_0xb2f8('0x46')]=_['intersection'](_0x56b213['model'],_0x56b213[_0xb2f8('0x3d')]);_0x4ec32a[_0xb2f8('0x40')]=_[_0xb2f8('0x3f')](_0x56b213[_0xb2f8('0x3c')],qs[_0xb2f8('0x41')](_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x41')]));_0x4ec32a['attributes']=_0x4ec32a['attributes'][_0xb2f8('0x42')]?_0x4ec32a['attributes']:_0x56b213[_0xb2f8('0x3c')];if(!_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x5d')](_0xb2f8('0x43'))){_0x4ec32a[_0xb2f8('0x25')]=qs[_0xb2f8('0x25')](_0x362012['query']['limit']);_0x4ec32a[_0xb2f8('0x24')]=qs[_0xb2f8('0x24')](_0x362012[_0xb2f8('0x3d')]['offset']);}_0x4ec32a[_0xb2f8('0x5e')]=qs['sort'](_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x44')]);_0x4ec32a[_0xb2f8('0x45')]=qs[_0xb2f8('0x46')](_['pick'](_0x362012['query'],_0x56b213[_0xb2f8('0x46')]));_0x4ec32a[_0xb2f8('0x45')][_0xb2f8('0x5f')]=_0x5af46e['id'];if(_0x362012[_0xb2f8('0x3d')][_0xb2f8('0x48')]){_0x4ec32a[_0xb2f8('0x45')]=_['merge'](_0x4ec32a[_0xb2f8('0x45')],{'$or':_['map'](_0x4ec32a[_0xb2f8('0x40')],function(_0x300eca){var _0x463d16={};_0x463d16[_0x300eca]={'$like':'%'+_0x362012[_0xb2f8('0x3d')]['filter']+'%'};return _0x463d16;})});}_0x4ec32a=_[_0xb2f8('0x49')]({},_0x4ec32a,_0x362012['options']);return db['UserMailQueue']['findAll'](_0x4ec32a);}})['then'](function(_0x5f176){if(_0x5f176){return db[_0xb2f8('0x60')][_0xb2f8('0x61')]({'where':{'id':_[_0xb2f8('0x36')](_0x5f176,_0xb2f8('0x62')),'role':'agent'},'attributes':['id',_0xb2f8('0x33'),_0xb2f8('0x63'),'updatedAt',_0xb2f8('0x64')]});}})[_0xb2f8('0x2c')](function(_0x2cdcc3){if(_0x2cdcc3){return{'count':_0x2cdcc3[_0xb2f8('0x23')],'rows':_[_0xb2f8('0x36')](_0x2cdcc3[_0xb2f8('0x4e')],function(_0x3e683b){return{'membername':_0x3e683b[_0xb2f8('0x33')],'UserId':_0x3e683b['id'],'queue_name':_0x594f02[_0xb2f8('0x33')],'MailQueueId':_0x594f02['id'],'interface':util[_0xb2f8('0x65')](_0xb2f8('0x66'),_0xb2f8('0x67'),_0x3e683b[_0xb2f8('0x33')]),'penalty':0x0,'paused':_0x3e683b['mailPause'],'createdAt':_0x3e683b[_0xb2f8('0x64')],'updatedAt':_0x3e683b[_0xb2f8('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb2f8('0x2c')](respondWithFilteredResult(_0x52640a,_0x4ec32a))[_0xb2f8('0x51')](handleError(_0x52640a,null));};exports[_0xb2f8('0x69')]=function(_0x3bdadc,_0x31aaf0,_0x4d4188){var _0x451695={};var _0x38782d={};var _0x4ff1c8;var _0x5a6df3;return db[_0xb2f8('0x37')][_0xb2f8('0x5b')]({'where':{'id':_0x3bdadc['params']['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x31aaf0,null))[_0xb2f8('0x2c')](function(_0x2dc354){if(_0x2dc354){_0x4ff1c8=_0x2dc354;_0x38782d[_0xb2f8('0x3c')]=_[_0xb2f8('0x3e')](db[_0xb2f8('0x6a')][_0xb2f8('0x38')]);_0x38782d[_0xb2f8('0x3d')]=_[_0xb2f8('0x3e')](_0x3bdadc[_0xb2f8('0x3d')]);_0x38782d[_0xb2f8('0x46')]=_[_0xb2f8('0x3f')](_0x38782d['model'],_0x38782d[_0xb2f8('0x3d')]);_0x451695[_0xb2f8('0x40')]=_[_0xb2f8('0x3f')](_0x38782d[_0xb2f8('0x3c')],qs['fields'](_0x3bdadc['query'][_0xb2f8('0x41')]));_0x451695[_0xb2f8('0x40')]=_0x451695['attributes'][_0xb2f8('0x42')]?_0x451695[_0xb2f8('0x40')]:_0x38782d['model'];_0x451695[_0xb2f8('0x5e')]=qs[_0xb2f8('0x44')](_0x3bdadc[_0xb2f8('0x3d')]['sort']);_0x451695[_0xb2f8('0x45')]=qs['filters'](_[_0xb2f8('0x47')](_0x3bdadc['query'],_0x38782d[_0xb2f8('0x46')]));if(_0x3bdadc[_0xb2f8('0x3d')]['filter']){_0x451695['where']=_[_0xb2f8('0x49')](_0x451695['where'],{'$or':_[_0xb2f8('0x36')](_0x451695[_0xb2f8('0x40')],function(_0x4fa258){var _0x5565d5={};_0x5565d5[_0x4fa258]={'$like':'%'+_0x3bdadc['query'][_0xb2f8('0x48')]+'%'};return _0x5565d5;})});}_0x451695=_[_0xb2f8('0x49')]({},_0x451695,_0x3bdadc['options']);return _0x4ff1c8['getTeams'](_0x451695);}})[_0xb2f8('0x2c')](function(_0x203cc1){if(_0x203cc1){_0x5a6df3=_0x203cc1[_0xb2f8('0x42')];if(!_0x3bdadc[_0xb2f8('0x3d')][_0xb2f8('0x5d')]('nolimit')){_0x451695[_0xb2f8('0x25')]=qs[_0xb2f8('0x25')](_0x3bdadc[_0xb2f8('0x3d')][_0xb2f8('0x25')]);_0x451695['offset']=qs['offset'](_0x3bdadc[_0xb2f8('0x3d')][_0xb2f8('0x24')]);}return _0x4ff1c8['getTeams'](_0x451695);}})[_0xb2f8('0x2c')](function(_0x42f926){if(_0x42f926){return _0x42f926?{'count':_0x5a6df3,'rows':_0x42f926}:null;}})['then'](respondWithResult(_0x31aaf0,null))[_0xb2f8('0x51')](handleError(_0x31aaf0,null));};exports[_0xb2f8('0x6b')]=function(_0x3e866f,_0x41fdd8,_0x45c2d3){var _0x16b0ab=_0x3e866f['body']['ids'];return db[_0xb2f8('0x6a')][_0xb2f8('0x4d')]({'where':{'id':_0x16b0ab},'attributes':['id'],'include':[{'model':db[_0xb2f8('0x60')],'as':'Agents','attributes':['id',_0xb2f8('0x33'),_0xb2f8('0x6c'),_0xb2f8('0x6d'),_0xb2f8('0x6e')],'raw':!![]}]})[_0xb2f8('0x2c')](function(_0x5d04b7){if(_0x5d04b7){var _0x3388f0=_['flatMap'](_0x5d04b7,function(_0x5c7415){var _0x1809e2=_0x5c7415['get']({'plain':!![]});return _0x1809e2[_0xb2f8('0x6f')];});return db['MailQueue'][_0xb2f8('0x56')]({'where':{'id':_0x3e866f[_0xb2f8('0x50')]['id']}})[_0xb2f8('0x2c')](function(_0x172c93){return db[_0xb2f8('0x70')][_0xb2f8('0x71')](function(_0x8110c9){return _0x172c93[_0xb2f8('0x6b')](_0x16b0ab,{'transaction':_0x8110c9})[_0xb2f8('0x2c')](function(){return BPromise[_0xb2f8('0x72')](_0x3388f0,function(_0x1278df){return db[_0xb2f8('0x5c')][_0xb2f8('0x73')]({'where':{'UserId':_0x1278df['id'],'MailQueueId':_0x3e866f[_0xb2f8('0x50')]['id']},'transaction':_0x8110c9});});})[_0xb2f8('0x2c')](function(){_0x3388f0[_0xb2f8('0x74')](function(_0x3d4f2e){socket[_0xb2f8('0x75')](_0xb2f8('0x76'),{'UserId':_0x3d4f2e['id'],'MailQueueId':_0x172c93['id']});});});});});}})[_0xb2f8('0x2c')](respondWithStatusCode(_0x41fdd8,null))['catch'](handleError(_0x41fdd8,null));};exports[_0xb2f8('0x77')]=function(_0x168f72,_0x68b445,_0x179e32){return db[_0xb2f8('0x6a')][_0xb2f8('0x4d')]({'where':{'id':_0x168f72[_0xb2f8('0x3d')][_0xb2f8('0x78')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb2f8('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xb2f8('0x2c')](handleEntityNotFound(_0x68b445,null))[_0xb2f8('0x2c')](function(_0x2c17e0){var _0x7422b9=_[_0xb2f8('0x36')](_0x2c17e0,'id');var _0x25e73e=[];var _0x55752d=[];var _0x33c383=squel[_0xb2f8('0x79')]();_0x33c383[_0xb2f8('0x7a')]('tq.TeamId')[_0xb2f8('0x7b')]('team_has_mail_queues','tq')[_0xb2f8('0x7c')](_0xb2f8('0x7d'),'ut',_0xb2f8('0x7e'))[_0xb2f8('0x45')](_0xb2f8('0x7f'),_0x168f72[_0xb2f8('0x50')]['id']);for(var _0x197fcf=0x0;_0x197fcf<_0x2c17e0[_0xb2f8('0x42')];_0x197fcf+=0x1){let _0x410abc=_0x2c17e0[_0x197fcf];for(var _0x20c34e=0x0;_0x20c34e<_0x410abc[_0xb2f8('0x6f')][_0xb2f8('0x42')];_0x20c34e+=0x1){let _0x3481c6=_0x410abc[_0xb2f8('0x6f')][_0x20c34e];var _0x403664=_0x33c383[_0xb2f8('0x80')]();_0x403664['where'](_0xb2f8('0x81'),_0x3481c6['id']);_0x55752d[_0xb2f8('0x82')](db[_0xb2f8('0x70')][_0xb2f8('0x3d')](_0x403664[_0xb2f8('0x83')](),{'type':db[_0xb2f8('0x70')][_0xb2f8('0x84')][_0xb2f8('0x85')]})[_0xb2f8('0x2c')](function(_0x9fdd52){if(_0x9fdd52[_0xb2f8('0x42')]===0x1){return _0x3481c6['id'];}else{var _0x131101=_[_0xb2f8('0x86')](_[_0xb2f8('0x36')](_0x9fdd52,'TeamId'),function(_0x480b30){return _[_0xb2f8('0x87')](_0x7422b9,_0x480b30);});if(_0x131101){return _0x3481c6['id'];}}}));}}return BPromise[_0xb2f8('0x88')](_0x55752d)[_0xb2f8('0x2c')](function(_0x302c4b){_0x25e73e=_(_0x25e73e)[_0xb2f8('0x89')](_0x302c4b)[_0xb2f8('0x8a')]()['value']();return db['MailQueue'][_0xb2f8('0x56')]({'where':{'id':_0x168f72[_0xb2f8('0x50')]['id']}})['then'](function(_0x4a87ef){return db['sequelize'][_0xb2f8('0x71')](function(_0x1cfaae){return _0x4a87ef[_0xb2f8('0x77')](_0x168f72[_0xb2f8('0x3d')][_0xb2f8('0x78')],{'transaction':_0x1cfaae})[_0xb2f8('0x2c')](function(){if(!_[_0xb2f8('0x8b')](_0x25e73e)){return _0x4a87ef[_0xb2f8('0x8c')](_0x25e73e,{'transaction':_0x1cfaae});}})[_0xb2f8('0x2c')](function(){_0x25e73e[_0xb2f8('0x74')](function(_0x37dab2){socket['emit'](_0xb2f8('0x8d'),{'UserId':_0x37dab2,'MailQueueId':_0x4a87ef['id']});});});});});});})[_0xb2f8('0x2c')](respondWithStatusCode(_0x68b445,null))[_0xb2f8('0x51')](handleError(_0x68b445,null));};exports[_0xb2f8('0x8e')]=function(_0x24bdcb,_0x454c22,_0x5714e6){return db[_0xb2f8('0x37')][_0xb2f8('0x56')]({'where':{'id':_0x24bdcb['params']['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x454c22,null))[_0xb2f8('0x2c')](function(_0x1bd978){if(_0x1bd978){return _0x1bd978[_0xb2f8('0x8e')](_0x24bdcb['body'][_0xb2f8('0x78')],_[_0xb2f8('0x8f')](_0x24bdcb[_0xb2f8('0x53')],[_0xb2f8('0x78'),'id'])||{})[_0xb2f8('0x90')](function(_0x2ade89){for(var _0x2a5af8=0x0;_0x2a5af8<_0x24bdcb['body'][_0xb2f8('0x78')][_0xb2f8('0x42')];_0x2a5af8+=0x1){socket['emit'](_0xb2f8('0x76'),{'UserId':_0x24bdcb[_0xb2f8('0x53')][_0xb2f8('0x78')][_0x2a5af8],'MailQueueId':_0x24bdcb['params']['id']});}return _0x2ade89;});}})[_0xb2f8('0x2c')](respondWithResult(_0x454c22,null))['catch'](handleError(_0x454c22,null));};exports[_0xb2f8('0x8c')]=function(_0x326824,_0x5b1e85,_0x26056e){return db[_0xb2f8('0x37')]['find']({'where':{'id':_0x326824[_0xb2f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b1e85,null))[_0xb2f8('0x2c')](function(_0xf49197){if(_0xf49197){return _0xf49197[_0xb2f8('0x8c')](_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')])[_0xb2f8('0x2c')](function(){if(_[_0xb2f8('0x91')](_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')])){for(var _0x39693b=0x0;_0x39693b<_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')][_0xb2f8('0x42')];_0x39693b+=0x1){socket[_0xb2f8('0x75')](_0xb2f8('0x8d'),{'UserId':Number(_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')][_0x39693b]),'MailQueueId':Number(_0x326824['params']['id'])});}}else{socket[_0xb2f8('0x75')](_0xb2f8('0x8d'),{'UserId':Number(_0x326824[_0xb2f8('0x3d')][_0xb2f8('0x78')]),'MailQueueId':Number(_0x326824['params']['id'])});}});}})[_0xb2f8('0x2c')](respondWithStatusCode(_0x5b1e85,null))[_0xb2f8('0x51')](handleError(_0x5b1e85,null));};exports[_0xb2f8('0x92')]=function(_0x12ae08,_0x24c705,_0x14bd40){var _0x172fe2={};var _0x45de81={};var _0x76b6fa;var _0x2f42e8;return db[_0xb2f8('0x37')][_0xb2f8('0x5b')]({'where':{'id':_0x12ae08['params']['id']}})[_0xb2f8('0x2c')](handleEntityNotFound(_0x24c705,null))[_0xb2f8('0x2c')](function(_0x195c87){if(_0x195c87){_0x76b6fa=_0x195c87;_0x45de81['model']=_[_0xb2f8('0x3e')](db['User'][_0xb2f8('0x38')]);_0x45de81[_0xb2f8('0x3d')]=_[_0xb2f8('0x3e')](_0x12ae08['query']);_0x45de81[_0xb2f8('0x46')]=_[_0xb2f8('0x3f')](_0x45de81[_0xb2f8('0x3c')],_0x45de81[_0xb2f8('0x3d')]);_0x172fe2[_0xb2f8('0x40')]=_['intersection'](_0x45de81[_0xb2f8('0x3c')],qs[_0xb2f8('0x41')](_0x12ae08['query'][_0xb2f8('0x41')]));_0x172fe2['attributes']=_0x172fe2['attributes'][_0xb2f8('0x42')]?_0x172fe2[_0xb2f8('0x40')]:_0x45de81[_0xb2f8('0x3c')];_0x172fe2[_0xb2f8('0x5e')]=qs['sort'](_0x12ae08[_0xb2f8('0x3d')][_0xb2f8('0x44')]);_0x172fe2['where']=qs[_0xb2f8('0x46')](_[_0xb2f8('0x47')](_0x12ae08[_0xb2f8('0x3d')],_0x45de81[_0xb2f8('0x46')]));if(_0x12ae08['query'][_0xb2f8('0x48')]){_0x172fe2[_0xb2f8('0x45')]=_[_0xb2f8('0x49')](_0x172fe2[_0xb2f8('0x45')],{'$or':_[_0xb2f8('0x36')](_0x172fe2[_0xb2f8('0x40')],function(_0x4ce0a4){var _0x6d34db={};_0x6d34db[_0x4ce0a4]={'$like':'%'+_0x12ae08[_0xb2f8('0x3d')][_0xb2f8('0x48')]+'%'};return _0x6d34db;})});}_0x172fe2=_['merge']({},_0x172fe2,_0x12ae08[_0xb2f8('0x4b')]);return _0x76b6fa[_0xb2f8('0x92')](_0x172fe2);}})[_0xb2f8('0x2c')](function(_0x1a5e24){if(_0x1a5e24){_0x2f42e8=_0x1a5e24[_0xb2f8('0x42')];if(!_0x12ae08[_0xb2f8('0x3d')][_0xb2f8('0x5d')](_0xb2f8('0x43'))){_0x172fe2['limit']=qs[_0xb2f8('0x25')](_0x12ae08[_0xb2f8('0x3d')]['limit']);_0x172fe2[_0xb2f8('0x24')]=qs[_0xb2f8('0x24')](_0x12ae08['query']['offset']);}return _0x76b6fa[_0xb2f8('0x92')](_0x172fe2);}})['then'](function(_0x19d9e2){if(_0x19d9e2){return _0x19d9e2?{'count':_0x2f42e8,'rows':_0x19d9e2}:null;}})['then'](respondWithResult(_0x24c705,null))[_0xb2f8('0x51')](handleError(_0x24c705,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 854733a..c1ca38b 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 _0x5ba6=['setMaxListeners','save','update','remove','emit','hook','exports','MailQueue'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x5ba6,0x9f));var _0x65ba=function(_0x3a2237,_0x29880c){_0x3a2237=_0x3a2237-0x0;var _0x819842=_0x5ba6[_0x3a2237];return _0x819842;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x65ba('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x65ba('0x1')](0x0);var events={'afterCreate':_0x65ba('0x2'),'afterUpdate':_0x65ba('0x3'),'afterDestroy':_0x65ba('0x4')};function emitEvent(_0x5e07be){return function(_0x12bffd,_0x1b375b,_0x2f8ce1){MailQueueEvents[_0x65ba('0x5')](_0x5e07be+':'+_0x12bffd['id'],_0x12bffd);MailQueueEvents['emit'](_0x5e07be,_0x12bffd);_0x2f8ce1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x65ba('0x6')](e,emitEvent(event));}}module[_0x65ba('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x7e1c=['MailQueue','save','emit','hook','exports','../../mysqldb'];(function(_0x420922,_0x3ec1c4){var _0x30e7a1=function(_0x28ac4d){while(--_0x28ac4d){_0x420922['push'](_0x420922['shift']());}};_0x30e7a1(++_0x3ec1c4);}(_0x7e1c,0xbf));var _0xc7e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e1c[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xc7e1('0x0'))['db'][_0xc7e1('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc7e1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c7555){return function(_0x20037c,_0x383700,_0x138b8d){MailQueueEvents[_0xc7e1('0x3')](_0x1c7555+':'+_0x20037c['id'],_0x20037c);MailQueueEvents[_0xc7e1('0x3')](_0x1c7555,_0x20037c);_0x138b8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xc7e1('0x4')](e,emitEvent(event));}}module[_0xc7e1('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f954503..e22d152 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 _0x9fa9=['MailQueue','mail_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x467e9e,_0x4a6888){var _0x10376a=function(_0x5f3437){while(--_0x5f3437){_0x467e9e['push'](_0x467e9e['shift']());}};_0x10376a(++_0x4a6888);}(_0x9fa9,0x9e));var _0x99fa=function(_0x323f60,_0x3a8934){_0x323f60=_0x323f60-0x0;var _0x5bd6ee=_0x9fa9[_0x323f60];return _0x5bd6ee;};'use strict';var _=require(_0x99fa('0x0'));var util=require('util');var logger=require(_0x99fa('0x1'))('api');var moment=require(_0x99fa('0x2'));var BPromise=require(_0x99fa('0x3'));var rp=require(_0x99fa('0x4'));var fs=require('fs');var path=require(_0x99fa('0x5'));var rimraf=require('rimraf');var config=require(_0x99fa('0x6'));var attributes=require(_0x99fa('0x7'));module[_0x99fa('0x8')]=function(_0xe695c1,_0x4e00f5){return _0xe695c1[_0x99fa('0x9')](_0x99fa('0xa'),attributes,{'tableName':_0x99fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb3f=['request-promise','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','moment'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0xcb3f,0x1bf));var _0xfcb3=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xcb3f[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xfcb3('0x0'));var util=require('util');var logger=require(_0xfcb3('0x1'))('api');var moment=require(_0xfcb3('0x2'));var BPromise=require('bluebird');var rp=require(_0xfcb3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcb3('0x4'));var config=require('../../config/environment');var attributes=require(_0xfcb3('0x5'));module[_0xfcb3('0x6')]=function(_0x2bf3ea,_0x54c5be){return _0x2bf3ea[_0xfcb3('0x7')](_0xfcb3('0x8'),attributes,{'tableName':_0xfcb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index c73b110..d0aabac 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 _0x4767=['jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','options','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x42e513,_0xdec8f){var _0x18a5d7=function(_0x991dec){while(--_0x991dec){_0x42e513['push'](_0x42e513['shift']());}};_0x18a5d7(++_0xdec8f);}(_0x4767,0xc0));var _0x7476=function(_0x7813ad,_0x5ef86b){_0x7813ad=_0x7813ad-0x0;var _0x53c501=_0x4767[_0x7813ad];return _0x53c501;};'use strict';var _=require(_0x7476('0x0'));var util=require(_0x7476('0x1'));var moment=require(_0x7476('0x2'));var BPromise=require('bluebird');var rs=require(_0x7476('0x3'));var fs=require('fs');var Redis=require(_0x7476('0x4'));var db=require(_0x7476('0x5'))['db'];var utils=require(_0x7476('0x6'));var logger=require('../../config/logger')(_0x7476('0x7'));var config=require('../../config/environment');var jayson=require(_0x7476('0x8'));var client=jayson[_0x7476('0x9')][_0x7476('0xa')]({'port':0x232a});config[_0x7476('0xb')]=_[_0x7476('0xc')](config[_0x7476('0xb')],{'host':_0x7476('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7476('0xb')]));require(_0x7476('0xe'))[_0x7476('0xf')](socket);function respondWithRpcPromise(_0x4c798f,_0x505b4a,_0x1a0327){return new BPromise(function(_0x4425ea,_0x2f2243){return client[_0x7476('0x10')](_0x4c798f,_0x1a0327)[_0x7476('0x11')](function(_0x3f526e){logger[_0x7476('0x12')](_0x7476('0x13'),_0x505b4a,_0x7476('0x14'));logger[_0x7476('0x15')](_0x7476('0x16'),_0x505b4a,_0x7476('0x14'),JSON[_0x7476('0x17')](_0x3f526e));if(_0x3f526e[_0x7476('0x18')]){if(_0x3f526e[_0x7476('0x18')][_0x7476('0x19')]===0x1f4){logger[_0x7476('0x18')](_0x7476('0x13'),_0x505b4a,_0x3f526e[_0x7476('0x18')]['message']);return _0x2f2243(_0x3f526e[_0x7476('0x18')]['message']);}logger[_0x7476('0x18')](_0x7476('0x13'),_0x505b4a,_0x3f526e[_0x7476('0x18')][_0x7476('0x1a')]);return _0x4425ea(_0x3f526e[_0x7476('0x18')]['message']);}else{logger[_0x7476('0x12')](_0x7476('0x13'),_0x505b4a,'request\x20sent');_0x4425ea(_0x3f526e[_0x7476('0x1b')][_0x7476('0x1a')]);}})[_0x7476('0x1c')](function(_0x31d856){logger[_0x7476('0x18')]('MailQueue,\x20%s,\x20%s',_0x505b4a,_0x31d856);_0x2f2243(_0x31d856);});});}exports[_0x7476('0x1d')]=function(_0x461f44){var _0x2c4eb0=this;return new Promise(function(_0x5e19fc,_0x5d2ac1){return db['MailQueue']['findAll']({'raw':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')][_0x7476('0x1f')]||null:null,'attributes':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')][_0x7476('0x20')]||null:null,'limit':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')][_0x7476('0x21')]||null:null,'include':_0x461f44[_0x7476('0x1e')]?_0x461f44['options'][_0x7476('0x22')]?_[_0x7476('0x23')](_0x461f44[_0x7476('0x1e')]['include'],function(_0x4f0c0b){return{'model':db[_0x4f0c0b[_0x7476('0x24')]],'as':_0x4f0c0b['as'],'attributes':_0x4f0c0b[_0x7476('0x20')],'include':_0x4f0c0b['include']?_[_0x7476('0x23')](_0x4f0c0b[_0x7476('0x22')],function(_0x1ee5e3){return{'model':db[_0x1ee5e3['model']],'as':_0x1ee5e3['as'],'attributes':_0x1ee5e3['attributes'],'include':_0x1ee5e3[_0x7476('0x22')]?_[_0x7476('0x23')](_0x1ee5e3[_0x7476('0x22')],function(_0x3a5af0){return{'model':db[_0x3a5af0['model']],'as':_0x3a5af0['as'],'attributes':_0x3a5af0['attributes']};}):[]};}):[]};}):[]:[]})[_0x7476('0x11')](function(_0x33f786){logger[_0x7476('0x12')](_0x7476('0x1d'),_0x461f44);logger[_0x7476('0x15')]('GetMailQueue',_0x461f44,JSON[_0x7476('0x17')](_0x33f786));_0x5e19fc(_0x33f786);})['catch'](function(_0x211239){logger[_0x7476('0x18')](_0x7476('0x1d'),_0x211239['message'],_0x461f44);_0x5d2ac1(_0x2c4eb0[_0x7476('0x18')](0x1f4,_0x211239[_0x7476('0x1a')]));});});};exports[_0x7476('0x25')]=function(_0x45bbe7){var _0x2d30bc=this;return new Promise(function(_0x35afed,_0x5c7dc7){return db[_0x7476('0x26')]['find']({'raw':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7['options'][_0x7476('0x27')]===undefined?!![]:![]:!![],'where':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7[_0x7476('0x1e')]['where']||null:null,'attributes':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7[_0x7476('0x1e')][_0x7476('0x20')]||null:null,'include':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7[_0x7476('0x1e')][_0x7476('0x22')]?_[_0x7476('0x23')](_0x45bbe7[_0x7476('0x1e')][_0x7476('0x22')],function(_0x54ce0b){return{'model':db[_0x54ce0b[_0x7476('0x24')]],'as':_0x54ce0b['as'],'attributes':_0x54ce0b[_0x7476('0x20')],'include':_0x54ce0b[_0x7476('0x22')]?_[_0x7476('0x23')](_0x54ce0b['include'],function(_0x27438b){return{'model':db[_0x27438b['model']],'as':_0x27438b['as'],'attributes':_0x27438b[_0x7476('0x20')],'include':_0x27438b['include']?_[_0x7476('0x23')](_0x27438b[_0x7476('0x22')],function(_0x288fde){return{'model':db[_0x288fde[_0x7476('0x24')]],'as':_0x288fde['as'],'attributes':_0x288fde['attributes']};}):[]};}):[]};}):[]:[]})[_0x7476('0x11')](function(_0x1054ff){logger['info'](_0x7476('0x25'),_0x45bbe7);logger[_0x7476('0x15')](_0x7476('0x25'),_0x45bbe7,JSON[_0x7476('0x17')](_0x1054ff));_0x35afed(_0x1054ff);})[_0x7476('0x1c')](function(_0x5d9c9a){logger[_0x7476('0x18')](_0x7476('0x25'),_0x5d9c9a['message'],_0x45bbe7);_0x5c7dc7(_0x2d30bc[_0x7476('0x18')](0x1f4,_0x5d9c9a[_0x7476('0x1a')]));});});}; \ No newline at end of file +var _0x1bd1=['find','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','info','catch','GetMailQueue','MailQueue','options','raw','where','attributes','include','map','model','stringify','ShowMailQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1bd1,0x177));var _0x11bd=function(_0x58885f,_0x98e475){_0x58885f=_0x58885f-0x0;var _0x15b184=_0x1bd1[_0x58885f];return _0x15b184;};'use strict';var _=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var moment=require(_0x11bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x11bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x11bd('0x4'))('rpc');var config=require(_0x11bd('0x5'));var jayson=require(_0x11bd('0x6'));var client=jayson['client'][_0x11bd('0x7')]({'port':0x232a});config[_0x11bd('0x8')]=_[_0x11bd('0x9')](config[_0x11bd('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x11bd('0xa'))(new Redis(config[_0x11bd('0x8')]));require('./mailQueue.socket')[_0x11bd('0xb')](socket);function respondWithRpcPromise(_0x3aef16,_0x5bc05b,_0x888787){return new BPromise(function(_0x2b5fdc,_0x55d2d1){return client['request'](_0x3aef16,_0x888787)[_0x11bd('0xc')](function(_0x5c09fa){logger['info']('MailQueue,\x20%s,\x20%s',_0x5bc05b,_0x11bd('0xd'));logger[_0x11bd('0xe')](_0x11bd('0xf'),_0x5bc05b,_0x11bd('0xd'),JSON['stringify'](_0x5c09fa));if(_0x5c09fa[_0x11bd('0x10')]){if(_0x5c09fa[_0x11bd('0x10')][_0x11bd('0x11')]===0x1f4){logger[_0x11bd('0x10')]('MailQueue,\x20%s,\x20%s',_0x5bc05b,_0x5c09fa[_0x11bd('0x10')]['message']);return _0x55d2d1(_0x5c09fa[_0x11bd('0x10')][_0x11bd('0x12')]);}logger['error'](_0x11bd('0x13'),_0x5bc05b,_0x5c09fa[_0x11bd('0x10')][_0x11bd('0x12')]);return _0x2b5fdc(_0x5c09fa['error']['message']);}else{logger[_0x11bd('0x14')](_0x11bd('0x13'),_0x5bc05b,_0x11bd('0xd'));_0x2b5fdc(_0x5c09fa['result']['message']);}})[_0x11bd('0x15')](function(_0x46f0b1){logger[_0x11bd('0x10')]('MailQueue,\x20%s,\x20%s',_0x5bc05b,_0x46f0b1);_0x55d2d1(_0x46f0b1);});});}exports[_0x11bd('0x16')]=function(_0x2b6065){var _0x387dcb=this;return new Promise(function(_0x413ad5,_0xeaa4d7){return db[_0x11bd('0x17')]['findAll']({'raw':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')][_0x11bd('0x19')]===undefined?!![]:![]:!![],'where':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')][_0x11bd('0x1a')]||null:null,'attributes':_0x2b6065[_0x11bd('0x18')]?_0x2b6065['options'][_0x11bd('0x1b')]||null:null,'limit':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')]['limit']||null:null,'include':_0x2b6065[_0x11bd('0x18')]?_0x2b6065[_0x11bd('0x18')][_0x11bd('0x1c')]?_[_0x11bd('0x1d')](_0x2b6065[_0x11bd('0x18')]['include'],function(_0x50e98f){return{'model':db[_0x50e98f[_0x11bd('0x1e')]],'as':_0x50e98f['as'],'attributes':_0x50e98f[_0x11bd('0x1b')],'include':_0x50e98f['include']?_[_0x11bd('0x1d')](_0x50e98f['include'],function(_0x2f2f05){return{'model':db[_0x2f2f05[_0x11bd('0x1e')]],'as':_0x2f2f05['as'],'attributes':_0x2f2f05['attributes'],'include':_0x2f2f05[_0x11bd('0x1c')]?_[_0x11bd('0x1d')](_0x2f2f05[_0x11bd('0x1c')],function(_0x5ed529){return{'model':db[_0x5ed529[_0x11bd('0x1e')]],'as':_0x5ed529['as'],'attributes':_0x5ed529['attributes']};}):[]};}):[]};}):[]:[]})[_0x11bd('0xc')](function(_0x212117){logger[_0x11bd('0x14')](_0x11bd('0x16'),_0x2b6065);logger['debug'](_0x11bd('0x16'),_0x2b6065,JSON[_0x11bd('0x1f')](_0x212117));_0x413ad5(_0x212117);})[_0x11bd('0x15')](function(_0x10bfb0){logger[_0x11bd('0x10')](_0x11bd('0x16'),_0x10bfb0['message'],_0x2b6065);_0xeaa4d7(_0x387dcb[_0x11bd('0x10')](0x1f4,_0x10bfb0[_0x11bd('0x12')]));});});};exports[_0x11bd('0x20')]=function(_0x3e3e0f){var _0x255cbc=this;return new Promise(function(_0x554f0f,_0x86ec2){return db[_0x11bd('0x17')][_0x11bd('0x21')]({'raw':_0x3e3e0f['options']?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x19')]===undefined?!![]:![]:!![],'where':_0x3e3e0f[_0x11bd('0x18')]?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x1a')]||null:null,'attributes':_0x3e3e0f[_0x11bd('0x18')]?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x1b')]||null:null,'include':_0x3e3e0f['options']?_0x3e3e0f[_0x11bd('0x18')][_0x11bd('0x1c')]?_['map'](_0x3e3e0f[_0x11bd('0x18')]['include'],function(_0x41205e){return{'model':db[_0x41205e[_0x11bd('0x1e')]],'as':_0x41205e['as'],'attributes':_0x41205e['attributes'],'include':_0x41205e[_0x11bd('0x1c')]?_['map'](_0x41205e[_0x11bd('0x1c')],function(_0x21d9a9){return{'model':db[_0x21d9a9[_0x11bd('0x1e')]],'as':_0x21d9a9['as'],'attributes':_0x21d9a9[_0x11bd('0x1b')],'include':_0x21d9a9['include']?_[_0x11bd('0x1d')](_0x21d9a9['include'],function(_0x5dc746){return{'model':db[_0x5dc746[_0x11bd('0x1e')]],'as':_0x5dc746['as'],'attributes':_0x5dc746['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48a060){logger[_0x11bd('0x14')](_0x11bd('0x20'),_0x3e3e0f);logger[_0x11bd('0xe')](_0x11bd('0x20'),_0x3e3e0f,JSON[_0x11bd('0x1f')](_0x48a060));_0x554f0f(_0x48a060);})[_0x11bd('0x15')](function(_0x4e2967){logger[_0x11bd('0x10')](_0x11bd('0x20'),_0x4e2967[_0x11bd('0x12')],_0x3e3e0f);_0x86ec2(_0x255cbc[_0x11bd('0x10')](0x1f4,_0x4e2967[_0x11bd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3ee86de..e16f277 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 _0x90ee=['update','removeListener','register','mailQueue:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90ee,0x130));var _0xe90e=function(_0x79b53e,_0x108f8d){_0x79b53e=_0x79b53e-0x0;var _0x2d4d6c=_0x90ee[_0x79b53e];return _0x2d4d6c;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xe90e('0x0'),'remove',_0xe90e('0x1')];function createListener(_0x106e43,_0x51f0c3){return function(_0x427ae4){_0x51f0c3['emit'](_0x106e43,_0x427ae4);};}function removeListener(_0x3b8c79,_0xe2d72){return function(){MailQueueEvents[_0xe90e('0x2')](_0x3b8c79,_0xe2d72);};}exports[_0xe90e('0x3')]=function(_0x25cdad){for(var _0x53fb48=0x0,_0x1bc2ba=events['length'];_0x53fb48<_0x1bc2ba;_0x53fb48++){var _0x165703=events[_0x53fb48];var _0x1698cd=createListener(_0xe90e('0x4')+_0x165703,_0x25cdad);MailQueueEvents['on'](_0x165703,_0x1698cd);}}; \ No newline at end of file +var _0xa409=['save','removeListener','length','mailQueue:'];(function(_0x447b21,_0x4c1c3c){var _0x1a43e8=function(_0x174d44){while(--_0x174d44){_0x447b21['push'](_0x447b21['shift']());}};_0x1a43e8(++_0x4c1c3c);}(_0xa409,0xf8));var _0x9a40=function(_0x3692c2,_0x21116a){_0x3692c2=_0x3692c2-0x0;var _0x394483=_0xa409[_0x3692c2];return _0x394483;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9a40('0x0'),'remove','update'];function createListener(_0x236e24,_0x392f32){return function(_0x3bfb30){_0x392f32['emit'](_0x236e24,_0x3bfb30);};}function removeListener(_0x56915f,_0x5840fb){return function(){MailQueueEvents[_0x9a40('0x1')](_0x56915f,_0x5840fb);};}exports['register']=function(_0x397372){for(var _0x9d4009=0x0,_0x2a0c6e=events[_0x9a40('0x2')];_0x9d4009<_0x2a0c6e;_0x9d4009++){var _0x8cbe30=events[_0x9d4009];var _0x3fb1f0=createListener(_0x9a40('0x3')+_0x8cbe30,_0x397372);MailQueueEvents['on'](_0x8cbe30,_0x3fb1f0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index df420c8..a51c289 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 _0x4938=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x15a4ad,_0x382963){var _0x1e6853=function(_0xc6d485){while(--_0xc6d485){_0x15a4ad['push'](_0x15a4ad['shift']());}};_0x1e6853(++_0x382963);}(_0x4938,0x188));var _0x8493=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0x4938[_0x592df4];return _0x3b4fe4;};'use strict';var multer=require('multer');var util=require(_0x8493('0x0'));var path=require(_0x8493('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8493('0x2')]();var auth=require(_0x8493('0x3'));var interaction=require(_0x8493('0x4'));var config=require(_0x8493('0x5'));var controller=require(_0x8493('0x6'));router[_0x8493('0x7')]('/',auth[_0x8493('0x8')](),controller[_0x8493('0x9')]);router[_0x8493('0x7')](_0x8493('0xa'),auth[_0x8493('0x8')](),controller[_0x8493('0xb')]);router[_0x8493('0x7')]('/:id',auth[_0x8493('0x8')](),controller[_0x8493('0xc')]);router['post']('/',auth[_0x8493('0x8')](),controller[_0x8493('0xd')]);router[_0x8493('0xe')](_0x8493('0xf'),auth['isAuthenticated'](),controller[_0x8493('0x10')]);router[_0x8493('0x11')](_0x8493('0xf'),auth[_0x8493('0x8')](),controller[_0x8493('0x12')]);module[_0x8493('0x13')]=router; \ No newline at end of file +var _0x02b6=['describe','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x02b6,0x115));var _0x602b=function(_0x5ec4f4,_0x4d39bf){_0x5ec4f4=_0x5ec4f4-0x0;var _0x220187=_0x02b6[_0x5ec4f4];return _0x220187;};'use strict';var multer=require(_0x602b('0x0'));var util=require(_0x602b('0x1'));var path=require(_0x602b('0x2'));var timeout=require(_0x602b('0x3'));var express=require(_0x602b('0x4'));var router=express[_0x602b('0x5')]();var auth=require(_0x602b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x602b('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x602b('0x8')](),controller[_0x602b('0x9')]);router[_0x602b('0xa')]('/describe',auth[_0x602b('0x8')](),controller[_0x602b('0xb')]);router['get'](_0x602b('0xc'),auth[_0x602b('0x8')](),controller[_0x602b('0xd')]);router['post']('/',auth[_0x602b('0x8')](),controller['create']);router[_0x602b('0xe')](_0x602b('0xc'),auth[_0x602b('0x8')](),controller[_0x602b('0xf')]);router[_0x602b('0x10')](_0x602b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x602b('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1bcdee2..ee032dc 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 _0xe054=['DATE','sequelize','exports','STRING'];(function(_0xdde30a,_0x3e2df5){var _0x3807d9=function(_0x53d4e9){while(--_0x53d4e9){_0xdde30a['push'](_0xdde30a['shift']());}};_0x3807d9(++_0x3e2df5);}(_0xe054,0x71));var _0x4e05=function(_0x3267a5,_0xb72a80){_0x3267a5=_0x3267a5-0x0;var _0x50a168=_0xe054[_0x3267a5];return _0x50a168;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e05('0x0'));module[_0x4e05('0x1')]={'uniqueid':{'type':Sequelize[_0x4e05('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4e05('0x2')]},'joinAt':{'type':Sequelize[_0x4e05('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4e05('0x3')]},'exitAt':{'type':Sequelize[_0x4e05('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc6e2=['sequelize','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6e2,0xaf));var _0x2c6e=function(_0x361610,_0x43f725){_0x361610=_0x361610-0x0;var _0x8d6321=_0xc6e2[_0x361610];return _0x8d6321;};'use strict';var moment=require(_0x2c6e('0x0'));var Sequelize=require(_0x2c6e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2c6e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2c6e('0x2')]},'joinAt':{'type':Sequelize[_0x2c6e('0x3')]},'leaveAt':{'type':Sequelize[_0x2c6e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2c6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2ea2cc0..9ae0b90 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 _0x0ba2=['catch','show','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','error','name','send','MailQueueReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','filter','where','VIRTUAL','merge','options','include','findAll','rows'];(function(_0x27772a,_0x26e3eb){var _0x4856b8=function(_0x5025cf){while(--_0x5025cf){_0x27772a['push'](_0x27772a['shift']());}};_0x4856b8(++_0x26e3eb);}(_0x0ba2,0x1cb));var _0x20ba=function(_0x45725b,_0x6f132e){_0x45725b=_0x45725b-0x0;var _0x2f65a0=_0x0ba2[_0x45725b];return _0x2f65a0;};'use strict';var pdf=require(_0x20ba('0x0'));var emlformat=require(_0x20ba('0x1'));var rimraf=require(_0x20ba('0x2'));var zipdir=require(_0x20ba('0x3'));var jsonpatch=require(_0x20ba('0x4'));var rp=require(_0x20ba('0x5'));var moment=require(_0x20ba('0x6'));var BPromise=require(_0x20ba('0x7'));var Mustache=require(_0x20ba('0x8'));var util=require(_0x20ba('0x9'));var path=require(_0x20ba('0xa'));var sox=require(_0x20ba('0xb'));var csv=require(_0x20ba('0xc'));var ejs=require(_0x20ba('0xd'));var fs=require('fs');var _=require(_0x20ba('0xe'));var squel=require('squel');var crypto=require(_0x20ba('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x20ba('0x10'));var toCsv=require(_0x20ba('0xc'));var querystring=require(_0x20ba('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x20ba('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20ba('0x13'));var logger=require(_0x20ba('0x14'))(_0x20ba('0x15'));var utils=require(_0x20ba('0x16'));var config=require(_0x20ba('0x17'));var licenseUtil=require(_0x20ba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47d709,_0x32748a){_0x32748a=_0x32748a||0xcc;return function(_0x5cd393){if(_0x5cd393){return _0x47d709[_0x20ba('0x19')](_0x32748a);}return _0x47d709['status'](_0x32748a)['end']();};}function respondWithResult(_0x28e460,_0x2dd218){_0x2dd218=_0x2dd218||0xc8;return function(_0x4dd65d){if(_0x4dd65d){return _0x28e460[_0x20ba('0x1a')](_0x2dd218)[_0x20ba('0x1b')](_0x4dd65d);}};}function respondWithFilteredResult(_0x147d39,_0x3c317d){return function(_0x4b389c){if(_0x4b389c){var _0x415fdf=_0x4b389c[_0x20ba('0x1c')],_0x3ae7f9=_0x3c317d[_0x20ba('0x1d')],_0x40a5d9=_0x3c317d['offset']+_0x3c317d['limit'],_0x45122c;if(_0x40a5d9>=_0x415fdf){_0x40a5d9=_0x415fdf;_0x45122c=0xc8;}else{_0x45122c=0xce;}_0x147d39[_0x20ba('0x1a')](_0x45122c);return _0x147d39[_0x20ba('0x1e')]('Content-Range',_0x3ae7f9+'-'+_0x40a5d9+'/'+_0x415fdf)[_0x20ba('0x1b')](_0x4b389c);}return null;};}function patchUpdates(_0xa4206b){return function(_0x3ea82a){try{jsonpatch[_0x20ba('0x1f')](_0x3ea82a,_0xa4206b,!![]);}catch(_0x1867fa){return BPromise[_0x20ba('0x20')](_0x1867fa);}return _0x3ea82a[_0x20ba('0x21')]();};}function saveUpdates(_0x1032b8,_0x594896){return function(_0x41dcd7){if(_0x41dcd7){return _0x41dcd7[_0x20ba('0x22')](_0x1032b8)[_0x20ba('0x23')](function(_0xf2c345){return _0xf2c345;});}return null;};}function removeEntity(_0x10abd3,_0x8c1eb6){return function(_0x5095eb){if(_0x5095eb){return _0x5095eb['destroy']()[_0x20ba('0x23')](function(){_0x10abd3[_0x20ba('0x1a')](0xcc)[_0x20ba('0x24')]();});}};}function handleEntityNotFound(_0x5dfc92,_0x453023){return function(_0xda03e1){if(!_0xda03e1){_0x5dfc92[_0x20ba('0x19')](0x194);}return _0xda03e1;};}function handleError(_0x3c3fa8,_0x54b5ea){_0x54b5ea=_0x54b5ea||0x1f4;return function(_0x2fe49f){logger[_0x20ba('0x25')](_0x2fe49f['stack']);if(_0x2fe49f[_0x20ba('0x26')]){delete _0x2fe49f['name'];}_0x3c3fa8[_0x20ba('0x1a')](_0x54b5ea)[_0x20ba('0x27')](_0x2fe49f);};}exports['index']=function(_0x35c4b5,_0x543c76){var _0x4f6a00={},_0x5a6ef2={},_0x24afb5={'count':0x0,'rows':[]};var _0x14f442=_['map'](db[_0x20ba('0x28')][_0x20ba('0x29')],function(_0x107043){return{'name':_0x107043[_0x20ba('0x2a')],'type':_0x107043[_0x20ba('0x2b')][_0x20ba('0x2c')]};});_0x5a6ef2['model']=_[_0x20ba('0x2d')](_0x14f442,'name');_0x5a6ef2[_0x20ba('0x2e')]=_[_0x20ba('0x2f')](_0x35c4b5[_0x20ba('0x2e')]);_0x5a6ef2['filters']=_[_0x20ba('0x30')](_0x5a6ef2[_0x20ba('0x31')],_0x5a6ef2['query']);_0x4f6a00[_0x20ba('0x32')]=_[_0x20ba('0x30')](_0x5a6ef2[_0x20ba('0x31')],qs[_0x20ba('0x33')](_0x35c4b5[_0x20ba('0x2e')][_0x20ba('0x33')]));_0x4f6a00['attributes']=_0x4f6a00[_0x20ba('0x32')][_0x20ba('0x34')]?_0x4f6a00[_0x20ba('0x32')]:_0x5a6ef2[_0x20ba('0x31')];if(!_0x35c4b5['query'][_0x20ba('0x35')](_0x20ba('0x36'))){_0x4f6a00[_0x20ba('0x37')]=qs[_0x20ba('0x37')](_0x35c4b5['query'][_0x20ba('0x37')]);_0x4f6a00[_0x20ba('0x1d')]=qs[_0x20ba('0x1d')](_0x35c4b5['query']['offset']);}_0x4f6a00['order']=qs[_0x20ba('0x38')](_0x35c4b5[_0x20ba('0x2e')]['sort']);_0x4f6a00['where']=qs['filters'](_['pick'](_0x35c4b5[_0x20ba('0x2e')],_0x5a6ef2[_0x20ba('0x39')]),_0x14f442);if(_0x35c4b5[_0x20ba('0x2e')][_0x20ba('0x3a')]){_0x4f6a00[_0x20ba('0x3b')]=_['merge'](_0x4f6a00[_0x20ba('0x3b')],{'$or':_[_0x20ba('0x2d')](_0x14f442,function(_0x4006ce){if(_0x4006ce[_0x20ba('0x2b')]!==_0x20ba('0x3c')){var _0x13582b={};_0x13582b[_0x4006ce[_0x20ba('0x26')]]={'$like':'%'+_0x35c4b5[_0x20ba('0x2e')][_0x20ba('0x3a')]+'%'};return _0x13582b;}})});}_0x4f6a00=_[_0x20ba('0x3d')]({},_0x4f6a00,_0x35c4b5[_0x20ba('0x3e')]);var _0x11449d={'where':_0x4f6a00[_0x20ba('0x3b')]};return db[_0x20ba('0x28')][_0x20ba('0x1c')](_0x11449d)[_0x20ba('0x23')](function(_0x285bfa){_0x24afb5[_0x20ba('0x1c')]=_0x285bfa;if(_0x35c4b5[_0x20ba('0x2e')]['includeAll']){_0x4f6a00[_0x20ba('0x3f')]=[{'all':!![]}];}return db[_0x20ba('0x28')][_0x20ba('0x40')](_0x4f6a00);})['then'](function(_0x1a8ae5){_0x24afb5[_0x20ba('0x41')]=_0x1a8ae5;return _0x24afb5;})[_0x20ba('0x23')](respondWithFilteredResult(_0x543c76,_0x4f6a00))[_0x20ba('0x42')](handleError(_0x543c76,null));};exports[_0x20ba('0x43')]=function(_0x34b831,_0x53d8f5){var _0x39e9fb={'raw':!![],'where':{'id':_0x34b831[_0x20ba('0x44')]['id']}},_0x3ac798={};_0x3ac798[_0x20ba('0x31')]=_[_0x20ba('0x2f')](db['MailQueueReport']['rawAttributes']);_0x3ac798['query']=_['keys'](_0x34b831['query']);_0x3ac798[_0x20ba('0x39')]=_[_0x20ba('0x30')](_0x3ac798[_0x20ba('0x31')],_0x3ac798['query']);_0x39e9fb[_0x20ba('0x32')]=_[_0x20ba('0x30')](_0x3ac798[_0x20ba('0x31')],qs[_0x20ba('0x33')](_0x34b831[_0x20ba('0x2e')][_0x20ba('0x33')]));_0x39e9fb[_0x20ba('0x32')]=_0x39e9fb[_0x20ba('0x32')]['length']?_0x39e9fb['attributes']:_0x3ac798[_0x20ba('0x31')];if(_0x34b831[_0x20ba('0x2e')][_0x20ba('0x45')]){_0x39e9fb[_0x20ba('0x3f')]=[{'all':!![]}];}_0x39e9fb=_[_0x20ba('0x3d')]({},_0x39e9fb,_0x34b831['options']);return db[_0x20ba('0x28')]['find'](_0x39e9fb)[_0x20ba('0x23')](handleEntityNotFound(_0x53d8f5,null))[_0x20ba('0x23')](respondWithResult(_0x53d8f5,null))[_0x20ba('0x42')](handleError(_0x53d8f5,null));};exports[_0x20ba('0x46')]=function(_0x56a152,_0x16cd37){return db[_0x20ba('0x28')][_0x20ba('0x46')](_0x56a152[_0x20ba('0x47')],{})['then'](respondWithResult(_0x16cd37,0xc9))[_0x20ba('0x42')](handleError(_0x16cd37,null));};exports[_0x20ba('0x22')]=function(_0x591ca3,_0x5a24c2){if(_0x591ca3['body']['id']){delete _0x591ca3[_0x20ba('0x47')]['id'];}return db['MailQueueReport'][_0x20ba('0x48')]({'where':{'id':_0x591ca3[_0x20ba('0x44')]['id']}})[_0x20ba('0x23')](handleEntityNotFound(_0x5a24c2,null))[_0x20ba('0x23')](saveUpdates(_0x591ca3[_0x20ba('0x47')],null))[_0x20ba('0x23')](respondWithResult(_0x5a24c2,null))[_0x20ba('0x42')](handleError(_0x5a24c2,null));};exports[_0x20ba('0x49')]=function(_0x107140,_0x259d28){return db[_0x20ba('0x28')][_0x20ba('0x48')]({'where':{'id':_0x107140['params']['id']}})['then'](handleEntityNotFound(_0x259d28,null))[_0x20ba('0x23')](removeEntity(_0x259d28,null))['catch'](handleError(_0x259d28,null));};exports[_0x20ba('0x4a')]=function(_0x22f5d4,_0x2c9276){return db[_0x20ba('0x28')][_0x20ba('0x4a')]()['then'](respondWithResult(_0x2c9276,null))[_0x20ba('0x42')](handleError(_0x2c9276,null));}; \ No newline at end of file +var _0x22cd=['set','Content-Range','save','update','then','destroy','stack','name','send','index','map','MailQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','limit','status'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x22cd,0x74));var _0xd22c=function(_0x3f2ecf,_0x4ccad6){_0x3f2ecf=_0x3f2ecf-0x0;var _0xa6dd7e=_0x22cd[_0x3f2ecf];return _0xa6dd7e;};'use strict';var pdf=require(_0xd22c('0x0'));var emlformat=require(_0xd22c('0x1'));var rimraf=require(_0xd22c('0x2'));var zipdir=require(_0xd22c('0x3'));var jsonpatch=require(_0xd22c('0x4'));var rp=require(_0xd22c('0x5'));var moment=require('moment');var BPromise=require(_0xd22c('0x6'));var Mustache=require('mustache');var util=require(_0xd22c('0x7'));var path=require(_0xd22c('0x8'));var sox=require(_0xd22c('0x9'));var csv=require(_0xd22c('0xa'));var ejs=require(_0xd22c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd22c('0xc'));var crypto=require(_0xd22c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd22c('0xe'));var toCsv=require(_0xd22c('0xa'));var querystring=require(_0xd22c('0xf'));var Papa=require(_0xd22c('0x10'));var Redis=require(_0xd22c('0x11'));var authService=require(_0xd22c('0x12'));var qs=require(_0xd22c('0x13'));var as=require(_0xd22c('0x14'));var hardwareService=require(_0xd22c('0x15'));var logger=require(_0xd22c('0x16'))(_0xd22c('0x17'));var utils=require(_0xd22c('0x18'));var config=require(_0xd22c('0x19'));var licenseUtil=require(_0xd22c('0x1a'));var db=require(_0xd22c('0x1b'))['db'];function respondWithStatusCode(_0x5561cc,_0x3910fb){_0x3910fb=_0x3910fb||0xcc;return function(_0x1358c5){if(_0x1358c5){return _0x5561cc[_0xd22c('0x1c')](_0x3910fb);}return _0x5561cc['status'](_0x3910fb)['end']();};}function respondWithResult(_0x368a26,_0x495679){_0x495679=_0x495679||0xc8;return function(_0x30314a){if(_0x30314a){return _0x368a26['status'](_0x495679)[_0xd22c('0x1d')](_0x30314a);}};}function respondWithFilteredResult(_0x2a65b4,_0x5711d0){return function(_0x2c85bc){if(_0x2c85bc){var _0x2aac66=_0x2c85bc[_0xd22c('0x1e')],_0x5ed75a=_0x5711d0[_0xd22c('0x1f')],_0x289cc7=_0x5711d0[_0xd22c('0x1f')]+_0x5711d0[_0xd22c('0x20')],_0x1118ed;if(_0x289cc7>=_0x2aac66){_0x289cc7=_0x2aac66;_0x1118ed=0xc8;}else{_0x1118ed=0xce;}_0x2a65b4[_0xd22c('0x21')](_0x1118ed);return _0x2a65b4[_0xd22c('0x22')](_0xd22c('0x23'),_0x5ed75a+'-'+_0x289cc7+'/'+_0x2aac66)[_0xd22c('0x1d')](_0x2c85bc);}return null;};}function patchUpdates(_0x50d20c){return function(_0x4c297f){try{jsonpatch['apply'](_0x4c297f,_0x50d20c,!![]);}catch(_0x305f6f){return BPromise['reject'](_0x305f6f);}return _0x4c297f[_0xd22c('0x24')]();};}function saveUpdates(_0x5b0d73,_0x14b31d){return function(_0x39c3cd){if(_0x39c3cd){return _0x39c3cd[_0xd22c('0x25')](_0x5b0d73)[_0xd22c('0x26')](function(_0x7a45d5){return _0x7a45d5;});}return null;};}function removeEntity(_0x1c33ef,_0x5b49b7){return function(_0x3f380f){if(_0x3f380f){return _0x3f380f[_0xd22c('0x27')]()[_0xd22c('0x26')](function(){_0x1c33ef[_0xd22c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x348ea8,_0x3038ce){return function(_0x37b73f){if(!_0x37b73f){_0x348ea8['sendStatus'](0x194);}return _0x37b73f;};}function handleError(_0x370d93,_0x692b18){_0x692b18=_0x692b18||0x1f4;return function(_0x1001ac){logger['error'](_0x1001ac[_0xd22c('0x28')]);if(_0x1001ac['name']){delete _0x1001ac[_0xd22c('0x29')];}_0x370d93[_0xd22c('0x21')](_0x692b18)[_0xd22c('0x2a')](_0x1001ac);};}exports[_0xd22c('0x2b')]=function(_0x15e10d,_0x1f7baf){var _0x20a36e={},_0x5a35b3={},_0x1636e2={'count':0x0,'rows':[]};var _0x24da31=_[_0xd22c('0x2c')](db[_0xd22c('0x2d')]['rawAttributes'],function(_0x322f83){return{'name':_0x322f83[_0xd22c('0x2e')],'type':_0x322f83[_0xd22c('0x2f')][_0xd22c('0x30')]};});_0x5a35b3[_0xd22c('0x31')]=_['map'](_0x24da31,'name');_0x5a35b3['query']=_['keys'](_0x15e10d[_0xd22c('0x32')]);_0x5a35b3['filters']=_[_0xd22c('0x33')](_0x5a35b3['model'],_0x5a35b3['query']);_0x20a36e[_0xd22c('0x34')]=_[_0xd22c('0x33')](_0x5a35b3[_0xd22c('0x31')],qs[_0xd22c('0x35')](_0x15e10d[_0xd22c('0x32')][_0xd22c('0x35')]));_0x20a36e[_0xd22c('0x34')]=_0x20a36e['attributes'][_0xd22c('0x36')]?_0x20a36e['attributes']:_0x5a35b3[_0xd22c('0x31')];if(!_0x15e10d['query'][_0xd22c('0x37')]('nolimit')){_0x20a36e[_0xd22c('0x20')]=qs[_0xd22c('0x20')](_0x15e10d[_0xd22c('0x32')]['limit']);_0x20a36e[_0xd22c('0x1f')]=qs[_0xd22c('0x1f')](_0x15e10d[_0xd22c('0x32')][_0xd22c('0x1f')]);}_0x20a36e[_0xd22c('0x38')]=qs[_0xd22c('0x39')](_0x15e10d['query']['sort']);_0x20a36e[_0xd22c('0x3a')]=qs[_0xd22c('0x3b')](_['pick'](_0x15e10d[_0xd22c('0x32')],_0x5a35b3[_0xd22c('0x3b')]),_0x24da31);if(_0x15e10d[_0xd22c('0x32')][_0xd22c('0x3c')]){_0x20a36e[_0xd22c('0x3a')]=_['merge'](_0x20a36e[_0xd22c('0x3a')],{'$or':_[_0xd22c('0x2c')](_0x24da31,function(_0x34b919){if(_0x34b919['type']!=='VIRTUAL'){var _0x3d2189={};_0x3d2189[_0x34b919[_0xd22c('0x29')]]={'$like':'%'+_0x15e10d['query'][_0xd22c('0x3c')]+'%'};return _0x3d2189;}})});}_0x20a36e=_[_0xd22c('0x3d')]({},_0x20a36e,_0x15e10d['options']);var _0x16c4fa={'where':_0x20a36e[_0xd22c('0x3a')]};return db['MailQueueReport'][_0xd22c('0x1e')](_0x16c4fa)['then'](function(_0x257360){_0x1636e2[_0xd22c('0x1e')]=_0x257360;if(_0x15e10d[_0xd22c('0x32')][_0xd22c('0x3e')]){_0x20a36e['include']=[{'all':!![]}];}return db[_0xd22c('0x2d')][_0xd22c('0x3f')](_0x20a36e);})[_0xd22c('0x26')](function(_0x42b8d3){_0x1636e2[_0xd22c('0x40')]=_0x42b8d3;return _0x1636e2;})[_0xd22c('0x26')](respondWithFilteredResult(_0x1f7baf,_0x20a36e))[_0xd22c('0x41')](handleError(_0x1f7baf,null));};exports[_0xd22c('0x42')]=function(_0x5bd1c1,_0xf68122){var _0x1e3e20={'raw':!![],'where':{'id':_0x5bd1c1[_0xd22c('0x43')]['id']}},_0x54de1a={};_0x54de1a[_0xd22c('0x31')]=_[_0xd22c('0x44')](db['MailQueueReport'][_0xd22c('0x45')]);_0x54de1a[_0xd22c('0x32')]=_[_0xd22c('0x44')](_0x5bd1c1[_0xd22c('0x32')]);_0x54de1a[_0xd22c('0x3b')]=_[_0xd22c('0x33')](_0x54de1a['model'],_0x54de1a[_0xd22c('0x32')]);_0x1e3e20[_0xd22c('0x34')]=_[_0xd22c('0x33')](_0x54de1a['model'],qs[_0xd22c('0x35')](_0x5bd1c1[_0xd22c('0x32')][_0xd22c('0x35')]));_0x1e3e20[_0xd22c('0x34')]=_0x1e3e20['attributes'][_0xd22c('0x36')]?_0x1e3e20[_0xd22c('0x34')]:_0x54de1a[_0xd22c('0x31')];if(_0x5bd1c1[_0xd22c('0x32')][_0xd22c('0x3e')]){_0x1e3e20['include']=[{'all':!![]}];}_0x1e3e20=_[_0xd22c('0x3d')]({},_0x1e3e20,_0x5bd1c1[_0xd22c('0x46')]);return db[_0xd22c('0x2d')][_0xd22c('0x47')](_0x1e3e20)[_0xd22c('0x26')](handleEntityNotFound(_0xf68122,null))[_0xd22c('0x26')](respondWithResult(_0xf68122,null))[_0xd22c('0x41')](handleError(_0xf68122,null));};exports[_0xd22c('0x48')]=function(_0x91bec5,_0x2c966a){return db[_0xd22c('0x2d')][_0xd22c('0x48')](_0x91bec5['body'],{})[_0xd22c('0x26')](respondWithResult(_0x2c966a,0xc9))[_0xd22c('0x41')](handleError(_0x2c966a,null));};exports[_0xd22c('0x25')]=function(_0x19c49d,_0x202e35){if(_0x19c49d[_0xd22c('0x49')]['id']){delete _0x19c49d['body']['id'];}return db[_0xd22c('0x2d')][_0xd22c('0x47')]({'where':{'id':_0x19c49d[_0xd22c('0x43')]['id']}})[_0xd22c('0x26')](handleEntityNotFound(_0x202e35,null))[_0xd22c('0x26')](saveUpdates(_0x19c49d[_0xd22c('0x49')],null))[_0xd22c('0x26')](respondWithResult(_0x202e35,null))[_0xd22c('0x41')](handleError(_0x202e35,null));};exports[_0xd22c('0x27')]=function(_0x4791b7,_0x112c6f){return db['MailQueueReport']['find']({'where':{'id':_0x4791b7[_0xd22c('0x43')]['id']}})[_0xd22c('0x26')](handleEntityNotFound(_0x112c6f,null))[_0xd22c('0x26')](removeEntity(_0x112c6f,null))[_0xd22c('0x41')](handleError(_0x112c6f,null));};exports[_0xd22c('0x4a')]=function(_0x2337e3,_0x4096d4){return db['MailQueueReport'][_0xd22c('0x4a')]()[_0xd22c('0x26')](respondWithResult(_0x4096d4,null))[_0xd22c('0x41')](handleError(_0x4096d4,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 82851f9..aee890e 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 _0x7442=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid'];(function(_0x14d83a,_0x1e388a){var _0x5c4868=function(_0x450e07){while(--_0x450e07){_0x14d83a['push'](_0x14d83a['shift']());}};_0x5c4868(++_0x1e388a);}(_0x7442,0x1a4));var _0x2744=function(_0x53fb63,_0x2497b0){_0x53fb63=_0x53fb63-0x0;var _0x3fd488=_0x7442[_0x53fb63];return _0x3fd488;};'use strict';var _=require('lodash');var util=require(_0x2744('0x0'));var logger=require(_0x2744('0x1'))(_0x2744('0x2'));var moment=require(_0x2744('0x3'));var BPromise=require(_0x2744('0x4'));var rp=require(_0x2744('0x5'));var fs=require('fs');var path=require(_0x2744('0x6'));var rimraf=require(_0x2744('0x7'));var config=require(_0x2744('0x8'));var attributes=require(_0x2744('0x9'));module[_0x2744('0xa')]=function(_0x5443b2,_0x12dbf9){return _0x5443b2[_0x2744('0xb')]('MailQueueReport',attributes,{'tableName':_0x2744('0xc'),'paranoid':![],'indexes':[{'name':_0x2744('0xd'),'fields':[_0x2744('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc495=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc495,0x1e0));var _0x5c49=function(_0x14bc8a,_0x398bbd){_0x14bc8a=_0x14bc8a-0x0;var _0x13c384=_0xc495[_0x14bc8a];return _0x13c384;};'use strict';var _=require(_0x5c49('0x0'));var util=require(_0x5c49('0x1'));var logger=require(_0x5c49('0x2'))(_0x5c49('0x3'));var moment=require(_0x5c49('0x4'));var BPromise=require(_0x5c49('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c49('0x6'));var rimraf=require('rimraf');var config=require(_0x5c49('0x7'));var attributes=require(_0x5c49('0x8'));module[_0x5c49('0x9')]=function(_0x44f638,_0x1dfc85){return _0x44f638[_0x5c49('0xa')](_0x5c49('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x5c49('0xc'),'fields':[_0x5c49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f6a78aa..c86586c 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 _0x3d2d=['../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueueReport,\x20%s,\x20%s','info','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x3d2d,0x12a));var _0xd3d2=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x3d2d[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0xd3d2('0x0'));var util=require(_0xd3d2('0x1'));var moment=require(_0xd3d2('0x2'));var BPromise=require(_0xd3d2('0x3'));var rs=require(_0xd3d2('0x4'));var fs=require('fs');var Redis=require(_0xd3d2('0x5'));var db=require(_0xd3d2('0x6'))['db'];var utils=require(_0xd3d2('0x7'));var logger=require(_0xd3d2('0x8'))(_0xd3d2('0x9'));var config=require(_0xd3d2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd3d2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2ddb,_0x5a70a1,_0x3c3922){return new BPromise(function(_0x25f775,_0x2fd395){return client['request'](_0x5c2ddb,_0x3c3922)[_0xd3d2('0xc')](function(_0xcc92de){logger['info']('MailQueueReport,\x20%s,\x20%s',_0x5a70a1,_0xd3d2('0xd'));logger[_0xd3d2('0xe')](_0xd3d2('0xf'),_0x5a70a1,_0xd3d2('0xd'),JSON[_0xd3d2('0x10')](_0xcc92de));if(_0xcc92de['error']){if(_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x12')]===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x5a70a1,_0xcc92de[_0xd3d2('0x11')]['message']);return _0x2fd395(_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x13')]);}logger['error'](_0xd3d2('0x14'),_0x5a70a1,_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x13')]);return _0x25f775(_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x13')]);}else{logger[_0xd3d2('0x15')](_0xd3d2('0x14'),_0x5a70a1,_0xd3d2('0xd'));_0x25f775(_0xcc92de[_0xd3d2('0x16')]['message']);}})[_0xd3d2('0x17')](function(_0x230ab1){logger[_0xd3d2('0x11')](_0xd3d2('0x14'),_0x5a70a1,_0x230ab1);_0x2fd395(_0x230ab1);});});}exports[_0xd3d2('0x18')]=function(_0x295055){var _0x5b8114=this;return new Promise(function(_0x5502ae,_0x6c2c64){return db[_0xd3d2('0x19')][_0xd3d2('0x1a')](_0x295055[_0xd3d2('0x1b')],{'raw':_0x295055['options']?_0x295055[_0xd3d2('0x1c')][_0xd3d2('0x1d')]===undefined?!![]:![]:!![]})[_0xd3d2('0xc')](function(_0x22ba0c){logger[_0xd3d2('0x15')](_0xd3d2('0x18'),_0x295055);logger['debug'](_0xd3d2('0x18'),_0x295055,JSON['stringify'](_0x22ba0c));_0x5502ae(_0x22ba0c);})[_0xd3d2('0x17')](function(_0x4268ad){logger[_0xd3d2('0x11')](_0xd3d2('0x18'),_0x4268ad[_0xd3d2('0x13')],_0x295055);_0x6c2c64(_0x5b8114[_0xd3d2('0x11')](0x1f4,_0x4268ad[_0xd3d2('0x13')]));});});};exports[_0xd3d2('0x1e')]=function(_0xfc6973){var _0x318739=this;return new Promise(function(_0x3508d8,_0x50b062){return db[_0xd3d2('0x19')][_0xd3d2('0x1f')](_0xfc6973[_0xd3d2('0x1b')],{'raw':_0xfc6973[_0xd3d2('0x1c')]?_0xfc6973[_0xd3d2('0x1c')][_0xd3d2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfc6973[_0xd3d2('0x1c')]?_0xfc6973[_0xd3d2('0x1c')][_0xd3d2('0x20')]||null:null,'attributes':_0xfc6973[_0xd3d2('0x1c')]?_0xfc6973[_0xd3d2('0x1c')][_0xd3d2('0x21')]||null:null,'limit':_0xfc6973['options']?_0xfc6973[_0xd3d2('0x1c')]['limit']||null:null})[_0xd3d2('0xc')](function(_0xf44213){logger[_0xd3d2('0x15')]('UpdateMailQueueReport',_0xfc6973);logger['debug'](_0xd3d2('0x1e'),_0xfc6973,JSON[_0xd3d2('0x10')](_0xf44213));_0x3508d8(_0xf44213);})['catch'](function(_0x556773){logger[_0xd3d2('0x11')]('UpdateMailQueueReport',_0x556773[_0xd3d2('0x13')],_0xfc6973);_0x50b062(_0x318739[_0xd3d2('0x11')](0x1f4,_0x556773['message']));});});}; \ No newline at end of file +var _0xf885=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x418044,_0xf49cf9){var _0x2c4246=function(_0x21e38b){while(--_0x21e38b){_0x418044['push'](_0x418044['shift']());}};_0x2c4246(++_0xf49cf9);}(_0xf885,0xa9));var _0x5f88=function(_0x3f5210,_0x32f195){_0x3f5210=_0x3f5210-0x0;var _0x53c3ab=_0xf885[_0x3f5210];return _0x53c3ab;};'use strict';var _=require(_0x5f88('0x0'));var util=require('util');var moment=require(_0x5f88('0x1'));var BPromise=require(_0x5f88('0x2'));var rs=require(_0x5f88('0x3'));var fs=require('fs');var Redis=require(_0x5f88('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f88('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f88('0x6'));var jayson=require(_0x5f88('0x7'));var client=jayson[_0x5f88('0x8')][_0x5f88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ee068,_0x2e9d87,_0x23aa88){return new BPromise(function(_0x1bedbd,_0x4d2734){return client[_0x5f88('0xa')](_0x4ee068,_0x23aa88)[_0x5f88('0xb')](function(_0x31222b){logger[_0x5f88('0xc')](_0x5f88('0xd'),_0x2e9d87,_0x5f88('0xe'));logger[_0x5f88('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x2e9d87,'request\x20sent',JSON[_0x5f88('0x10')](_0x31222b));if(_0x31222b['error']){if(_0x31222b[_0x5f88('0x11')]['code']===0x1f4){logger[_0x5f88('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x2e9d87,_0x31222b[_0x5f88('0x11')]['message']);return _0x4d2734(_0x31222b[_0x5f88('0x11')][_0x5f88('0x12')]);}logger[_0x5f88('0x11')](_0x5f88('0xd'),_0x2e9d87,_0x31222b['error'][_0x5f88('0x12')]);return _0x1bedbd(_0x31222b['error'][_0x5f88('0x12')]);}else{logger['info'](_0x5f88('0xd'),_0x2e9d87,_0x5f88('0xe'));_0x1bedbd(_0x31222b[_0x5f88('0x13')][_0x5f88('0x12')]);}})[_0x5f88('0x14')](function(_0x202503){logger[_0x5f88('0x11')](_0x5f88('0xd'),_0x2e9d87,_0x202503);_0x4d2734(_0x202503);});});}exports[_0x5f88('0x15')]=function(_0x1f2ec4){var _0xc9d15f=this;return new Promise(function(_0x3fd5bd,_0x50ae16){return db['MailQueueReport'][_0x5f88('0x16')](_0x1f2ec4[_0x5f88('0x17')],{'raw':_0x1f2ec4[_0x5f88('0x18')]?_0x1f2ec4[_0x5f88('0x18')][_0x5f88('0x19')]===undefined?!![]:![]:!![]})[_0x5f88('0xb')](function(_0x290e39){logger[_0x5f88('0xc')]('CreateMailQueueReport',_0x1f2ec4);logger[_0x5f88('0xf')](_0x5f88('0x15'),_0x1f2ec4,JSON[_0x5f88('0x10')](_0x290e39));_0x3fd5bd(_0x290e39);})[_0x5f88('0x14')](function(_0x5a7d0b){logger[_0x5f88('0x11')]('CreateMailQueueReport',_0x5a7d0b['message'],_0x1f2ec4);_0x50ae16(_0xc9d15f[_0x5f88('0x11')](0x1f4,_0x5a7d0b[_0x5f88('0x12')]));});});};exports[_0x5f88('0x1a')]=function(_0x49d76c){var _0x40044f=this;return new Promise(function(_0x138d92,_0x152968){return db['MailQueueReport'][_0x5f88('0x1b')](_0x49d76c[_0x5f88('0x17')],{'raw':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')][_0x5f88('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')][_0x5f88('0x1c')]||null:null,'attributes':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')]['attributes']||null:null,'limit':_0x49d76c[_0x5f88('0x18')]?_0x49d76c[_0x5f88('0x18')]['limit']||null:null})[_0x5f88('0xb')](function(_0x4c415c){logger[_0x5f88('0xc')](_0x5f88('0x1a'),_0x49d76c);logger['debug'](_0x5f88('0x1a'),_0x49d76c,JSON['stringify'](_0x4c415c));_0x138d92(_0x4c415c);})['catch'](function(_0x46010c){logger[_0x5f88('0x11')]('UpdateMailQueueReport',_0x46010c[_0x5f88('0x12')],_0x49d76c);_0x152968(_0x40044f[_0x5f88('0x11')](0x1f4,_0x46010c[_0x5f88('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index fe3d338..147eb32 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 _0x571c=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x91407c,_0x5cf5b6){var _0x8bf5e8=function(_0x208e75){while(--_0x208e75){_0x91407c['push'](_0x91407c['shift']());}};_0x8bf5e8(++_0x5cf5b6);}(_0x571c,0x1ab));var _0xc571=function(_0x1f60d5,_0x1ba1c0){_0x1f60d5=_0x1f60d5-0x0;var _0x2db7d3=_0x571c[_0x1f60d5];return _0x2db7d3;};'use strict';var multer=require(_0xc571('0x0'));var util=require(_0xc571('0x1'));var path=require(_0xc571('0x2'));var timeout=require(_0xc571('0x3'));var express=require(_0xc571('0x4'));var router=express['Router']();var auth=require(_0xc571('0x5'));var interaction=require(_0xc571('0x6'));var config=require(_0xc571('0x7'));module[_0xc571('0x8')]=router; \ No newline at end of file +var _0x1649=['express','Router','../../components/auth/service','../../config/environment','exports','path','connect-timeout'];(function(_0x201042,_0x50bd0a){var _0x17f363=function(_0x4d7519){while(--_0x4d7519){_0x201042['push'](_0x201042['shift']());}};_0x17f363(++_0x50bd0a);}(_0x1649,0x1e8));var _0x9164=function(_0x1e9d78,_0x46ea3e){_0x1e9d78=_0x1e9d78-0x0;var _0xe77e1c=_0x1649[_0x1e9d78];return _0xe77e1c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9164('0x0'));var timeout=require(_0x9164('0x1'));var express=require(_0x9164('0x2'));var router=express[_0x9164('0x3')]();var auth=require(_0x9164('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9164('0x5'));module[_0x9164('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 2a2815a..336b038 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 _0x411d=['INBOX','sequelize','STRING','username','INTEGER'];(function(_0x4fcbe1,_0x272f63){var _0x2a2c07=function(_0x145c5d){while(--_0x145c5d){_0x4fcbe1['push'](_0x4fcbe1['shift']());}};_0x2a2c07(++_0x272f63);}(_0x411d,0x187));var _0xd411=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x411d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd411('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd411('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xd411('0x1')],'unique':_0xd411('0x2')},'password':{'type':Sequelize[_0xd411('0x1')]},'port':{'type':Sequelize[_0xd411('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd411('0x1')],'defaultValue':_0xd411('0x4')},'connTimeout':{'type':Sequelize[_0xd411('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd411('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd411('0x1')]}}; \ No newline at end of file +var _0x5235=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x5235,0xd5));var _0x5523=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x5235[_0x1e172a];return _0x96338b;};'use strict';var Sequelize=require(_0x5523('0x0'));module[_0x5523('0x1')]={'description':{'type':Sequelize[_0x5523('0x2')]},'host':{'type':Sequelize[_0x5523('0x2')]},'authentication':{'type':Sequelize[_0x5523('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5523('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x5523('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x5523('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5523('0x2')],'defaultValue':_0x5523('0x4')},'connTimeout':{'type':Sequelize[_0x5523('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5523('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5523('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 978f34b..e89ad9b 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 _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','define','mail_servers_in','lodash','util'];(function(_0x5e0ba3,_0x43e5fd){var _0x1f15bf=function(_0x3a2840){while(--_0x3a2840){_0x5e0ba3['push'](_0x5e0ba3['shift']());}};_0x1f15bf(++_0x43e5fd);}(_0x3266,0x6a));var _0x6326=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x3266[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('MailServerIn',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb921=['../../config/logger','api','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x325507,_0x1968ab){var _0x1a5253=function(_0x591c8e){while(--_0x591c8e){_0x325507['push'](_0x325507['shift']());}};_0x1a5253(++_0x1968ab);}(_0xb921,0x16a));var _0x1b92=function(_0x32af46,_0xb38e36){_0x32af46=_0x32af46-0x0;var _0x5a5520=_0xb921[_0x32af46];return _0x5a5520;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var logger=require(_0x1b92('0x2'))(_0x1b92('0x3'));var moment=require(_0x1b92('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b92('0x5'));var rimraf=require(_0x1b92('0x6'));var config=require(_0x1b92('0x7'));var attributes=require(_0x1b92('0x8'));module[_0x1b92('0x9')]=function(_0x29a1db,_0x4358e3){return _0x29a1db[_0x1b92('0xa')](_0x1b92('0xb'),attributes,{'tableName':_0x1b92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index f2a6a75..fd46845 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 _0xe1e9=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','info','GetMailServerIn','MailServerIn','findAll','raw','options','where','limit','include','map','model','attributes','stringify','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s'];(function(_0x4220ba,_0x2d7aac){var _0x574a20=function(_0x39b0f7){while(--_0x39b0f7){_0x4220ba['push'](_0x4220ba['shift']());}};_0x574a20(++_0x2d7aac);}(_0xe1e9,0x10b));var _0x9e1e=function(_0x83eb71,_0x2b977f){_0x83eb71=_0x83eb71-0x0;var _0x1db3ba=_0xe1e9[_0x83eb71];return _0x1db3ba;};'use strict';var _=require(_0x9e1e('0x0'));var util=require('util');var moment=require(_0x9e1e('0x1'));var BPromise=require(_0x9e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e1e('0x3'))['db'];var utils=require(_0x9e1e('0x4'));var logger=require('../../config/logger')(_0x9e1e('0x5'));var config=require(_0x9e1e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9e1e('0x7')][_0x9e1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36ba82,_0x5c9922,_0x3e2417){return new BPromise(function(_0x519f5b,_0x43f59c){return client[_0x9e1e('0x9')](_0x36ba82,_0x3e2417)[_0x9e1e('0xa')](function(_0x3c6805){logger['info'](_0x9e1e('0xb'),_0x5c9922,_0x9e1e('0xc'));logger[_0x9e1e('0xd')](_0x9e1e('0xe'),_0x5c9922,'request\x20sent',JSON['stringify'](_0x3c6805));if(_0x3c6805[_0x9e1e('0xf')]){if(_0x3c6805[_0x9e1e('0xf')]['code']===0x1f4){logger[_0x9e1e('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5c9922,_0x3c6805[_0x9e1e('0xf')]['message']);return _0x43f59c(_0x3c6805[_0x9e1e('0xf')][_0x9e1e('0x10')]);}logger[_0x9e1e('0xf')](_0x9e1e('0xb'),_0x5c9922,_0x3c6805[_0x9e1e('0xf')][_0x9e1e('0x10')]);return _0x519f5b(_0x3c6805[_0x9e1e('0xf')][_0x9e1e('0x10')]);}else{logger[_0x9e1e('0x11')]('MailServerIn,\x20%s,\x20%s',_0x5c9922,_0x9e1e('0xc'));_0x519f5b(_0x3c6805['result'][_0x9e1e('0x10')]);}})['catch'](function(_0x38d24d){logger['error'](_0x9e1e('0xb'),_0x5c9922,_0x38d24d);_0x43f59c(_0x38d24d);});});}exports[_0x9e1e('0x12')]=function(_0x51c3c0){var _0x4c6b48=this;return new Promise(function(_0x5c9148,_0x21c0d6){return db[_0x9e1e('0x13')][_0x9e1e('0x14')]({'raw':_0x51c3c0['options']?_0x51c3c0['options'][_0x9e1e('0x15')]===undefined?!![]:![]:!![],'where':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x17')]||null:null,'attributes':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0['options']['attributes']||null:null,'limit':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x18')]||null:null,'include':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x19')]?_[_0x9e1e('0x1a')](_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x19')],function(_0x465076){return{'model':db[_0x465076[_0x9e1e('0x1b')]],'as':_0x465076['as'],'attributes':_0x465076[_0x9e1e('0x1c')],'include':_0x465076[_0x9e1e('0x19')]?_[_0x9e1e('0x1a')](_0x465076['include'],function(_0x53178b){return{'model':db[_0x53178b[_0x9e1e('0x1b')]],'as':_0x53178b['as'],'attributes':_0x53178b['attributes'],'include':_0x53178b[_0x9e1e('0x19')]?_[_0x9e1e('0x1a')](_0x53178b['include'],function(_0x28370c){return{'model':db[_0x28370c[_0x9e1e('0x1b')]],'as':_0x28370c['as'],'attributes':_0x28370c[_0x9e1e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e1e('0xa')](function(_0x10a7a8){logger[_0x9e1e('0x11')]('GetMailServerIn',_0x51c3c0);logger[_0x9e1e('0xd')]('GetMailServerIn',_0x51c3c0,JSON[_0x9e1e('0x1d')](_0x10a7a8));_0x5c9148(_0x10a7a8);})[_0x9e1e('0x1e')](function(_0x23f9d0){logger[_0x9e1e('0xf')]('GetMailServerIn',_0x23f9d0[_0x9e1e('0x10')],_0x51c3c0);_0x21c0d6(_0x4c6b48[_0x9e1e('0xf')](0x1f4,_0x23f9d0[_0x9e1e('0x10')]));});});}; \ No newline at end of file +var _0x39be=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x39be,0xe9));var _0xe39b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x39be[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe39b('0x0'));var util=require('util');var moment=require(_0xe39b('0x1'));var BPromise=require(_0xe39b('0x2'));var rs=require(_0xe39b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe39b('0x4'))['db'];var utils=require(_0xe39b('0x5'));var logger=require(_0xe39b('0x6'))(_0xe39b('0x7'));var config=require('../../config/environment');var jayson=require(_0xe39b('0x8'));var client=jayson[_0xe39b('0x9')][_0xe39b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa14e73,_0x3de9d4,_0x9899fa){return new BPromise(function(_0x392086,_0x289481){return client['request'](_0xa14e73,_0x9899fa)[_0xe39b('0xb')](function(_0x3dd928){logger[_0xe39b('0xc')](_0xe39b('0xd'),_0x3de9d4,_0xe39b('0xe'));logger[_0xe39b('0xf')](_0xe39b('0x10'),_0x3de9d4,_0xe39b('0xe'),JSON[_0xe39b('0x11')](_0x3dd928));if(_0x3dd928[_0xe39b('0x12')]){if(_0x3dd928['error']['code']===0x1f4){logger[_0xe39b('0x12')](_0xe39b('0xd'),_0x3de9d4,_0x3dd928['error']['message']);return _0x289481(_0x3dd928[_0xe39b('0x12')][_0xe39b('0x13')]);}logger[_0xe39b('0x12')](_0xe39b('0xd'),_0x3de9d4,_0x3dd928[_0xe39b('0x12')]['message']);return _0x392086(_0x3dd928[_0xe39b('0x12')][_0xe39b('0x13')]);}else{logger['info'](_0xe39b('0xd'),_0x3de9d4,_0xe39b('0xe'));_0x392086(_0x3dd928[_0xe39b('0x14')]['message']);}})['catch'](function(_0x540a92){logger[_0xe39b('0x12')](_0xe39b('0xd'),_0x3de9d4,_0x540a92);_0x289481(_0x540a92);});});}exports[_0xe39b('0x15')]=function(_0x28d359){var _0x32ff19=this;return new Promise(function(_0x44278c,_0x17b2dd){return db[_0xe39b('0x16')][_0xe39b('0x17')]({'raw':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')][_0xe39b('0x19')]===undefined?!![]:![]:!![],'where':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')][_0xe39b('0x1a')]||null:null,'attributes':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')][_0xe39b('0x1b')]||null:null,'limit':_0x28d359[_0xe39b('0x18')]?_0x28d359[_0xe39b('0x18')]['limit']||null:null,'include':_0x28d359['options']?_0x28d359['options'][_0xe39b('0x1c')]?_[_0xe39b('0x1d')](_0x28d359['options'][_0xe39b('0x1c')],function(_0x45c507){return{'model':db[_0x45c507[_0xe39b('0x1e')]],'as':_0x45c507['as'],'attributes':_0x45c507[_0xe39b('0x1b')],'include':_0x45c507[_0xe39b('0x1c')]?_['map'](_0x45c507['include'],function(_0x237c66){return{'model':db[_0x237c66[_0xe39b('0x1e')]],'as':_0x237c66['as'],'attributes':_0x237c66[_0xe39b('0x1b')],'include':_0x237c66['include']?_[_0xe39b('0x1d')](_0x237c66[_0xe39b('0x1c')],function(_0x11c283){return{'model':db[_0x11c283[_0xe39b('0x1e')]],'as':_0x11c283['as'],'attributes':_0x11c283[_0xe39b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe39b('0xb')](function(_0x3b0c3c){logger['info']('GetMailServerIn',_0x28d359);logger[_0xe39b('0xf')](_0xe39b('0x15'),_0x28d359,JSON[_0xe39b('0x11')](_0x3b0c3c));_0x44278c(_0x3b0c3c);})['catch'](function(_0x4fa471){logger[_0xe39b('0x12')](_0xe39b('0x15'),_0x4fa471[_0xe39b('0x13')],_0x28d359);_0x17b2dd(_0x32ff19[_0xe39b('0x12')](0x1f4,_0x4fa471[_0xe39b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 34d079a..2790aee 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 _0x7a60=['express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0xe57104,_0x355232){var _0x5a73fb=function(_0x3d97a7){while(--_0x3d97a7){_0xe57104['push'](_0xe57104['shift']());}};_0x5a73fb(++_0x355232);}(_0x7a60,0x195));var _0x07a6=function(_0x19edf0,_0x4a1189){_0x19edf0=_0x19edf0-0x0;var _0x4375d0=_0x7a60[_0x19edf0];return _0x4375d0;};'use strict';var multer=require(_0x07a6('0x0'));var util=require(_0x07a6('0x1'));var path=require(_0x07a6('0x2'));var timeout=require('connect-timeout');var express=require(_0x07a6('0x3'));var router=express[_0x07a6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x07a6('0x5'));var config=require(_0x07a6('0x6'));var controller=require(_0x07a6('0x7'));router[_0x07a6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x07a6('0x9')](),controller[_0x07a6('0xa')]);router[_0x07a6('0xb')]('/',auth[_0x07a6('0x9')](),controller['create']);router['put'](_0x07a6('0xc'),auth[_0x07a6('0x9')](),controller[_0x07a6('0xd')]);router[_0x07a6('0xe')](_0x07a6('0xc'),auth[_0x07a6('0x9')](),controller[_0x07a6('0xf')]);module[_0x07a6('0x10')]=router; \ No newline at end of file +var _0x2107=['index','show','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2107,0x14c));var _0x7210=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x2107[_0x5a636f];return _0x6a8cfb;};'use strict';var multer=require('multer');var util=require(_0x7210('0x0'));var path=require('path');var timeout=require(_0x7210('0x1'));var express=require(_0x7210('0x2'));var router=express[_0x7210('0x3')]();var auth=require(_0x7210('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7210('0x5'));var controller=require('./mailServerOut.controller');router[_0x7210('0x6')]('/',auth[_0x7210('0x7')](),controller[_0x7210('0x8')]);router['get']('/:id',auth[_0x7210('0x7')](),controller[_0x7210('0x9')]);router[_0x7210('0xa')]('/',auth[_0x7210('0x7')](),controller[_0x7210('0xb')]);router['put'](_0x7210('0xc'),auth[_0x7210('0x7')](),controller[_0x7210('0xd')]);router[_0x7210('0xe')](_0x7210('0xc'),auth[_0x7210('0x7')](),controller[_0x7210('0xf')]);module[_0x7210('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9415d0b..4069de4 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 _0xd9a8=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x468342,_0x15e0ed){_0x468342=_0x468342-0x0;var _0x204a5c=_0xd9a8[_0x468342];return _0x204a5c;};'use strict';var Sequelize=require(_0x8d9a('0x0'));module[_0x8d9a('0x1')]={'description':{'type':Sequelize[_0x8d9a('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x8d9a('0x2')]},'pass':{'type':Sequelize[_0x8d9a('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x8d9a('0x2')]},'authentication':{'type':Sequelize[_0x8d9a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7958=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x380767,_0x5ee13b){var _0x177d8d=function(_0x47f5a6){while(--_0x47f5a6){_0x380767['push'](_0x380767['shift']());}};_0x177d8d(++_0x5ee13b);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8795('0x0'));module[_0x8795('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8795('0x2')]},'user':{'type':Sequelize[_0x8795('0x2')]},'pass':{'type':Sequelize[_0x8795('0x2')]},'port':{'type':Sequelize[_0x8795('0x3')]},'secure':{'type':Sequelize[_0x8795('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8795('0x2')]},'authentication':{'type':Sequelize[_0x8795('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 259f289..94145b5 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 _0x0bc2=['stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','options','MailServerOut','count','includeAll','include','findAll','catch','show','merge','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','save','then','destroy','sendStatus','error'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0x0bc2,0xf9));var _0x20bc=function(_0x38cb4a,_0x56cf9e){_0x38cb4a=_0x38cb4a-0x0;var _0x49fd3f=_0x0bc2[_0x38cb4a];return _0x49fd3f;};'use strict';var pdf=require(_0x20bc('0x0'));var emlformat=require(_0x20bc('0x1'));var rimraf=require(_0x20bc('0x2'));var zipdir=require(_0x20bc('0x3'));var jsonpatch=require(_0x20bc('0x4'));var rp=require(_0x20bc('0x5'));var moment=require('moment');var BPromise=require(_0x20bc('0x6'));var Mustache=require('mustache');var util=require(_0x20bc('0x7'));var path=require(_0x20bc('0x8'));var sox=require(_0x20bc('0x9'));var csv=require(_0x20bc('0xa'));var ejs=require(_0x20bc('0xb'));var fs=require('fs');var _=require(_0x20bc('0xc'));var squel=require(_0x20bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x20bc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x20bc('0xa'));var querystring=require(_0x20bc('0xf'));var Papa=require(_0x20bc('0x10'));var Redis=require(_0x20bc('0x11'));var authService=require(_0x20bc('0x12'));var qs=require(_0x20bc('0x13'));var as=require(_0x20bc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20bc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x20bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x20bc('0x17'))['db'];function respondWithStatusCode(_0x4ea2e7,_0x2ef054){_0x2ef054=_0x2ef054||0xcc;return function(_0x4563ec){if(_0x4563ec){return _0x4ea2e7['sendStatus'](_0x2ef054);}return _0x4ea2e7['status'](_0x2ef054)[_0x20bc('0x18')]();};}function respondWithResult(_0x13d930,_0xfb064e){_0xfb064e=_0xfb064e||0xc8;return function(_0x1f9de6){if(_0x1f9de6){return _0x13d930[_0x20bc('0x19')](_0xfb064e)[_0x20bc('0x1a')](_0x1f9de6);}};}function respondWithFilteredResult(_0x3b53eb,_0x573210){return function(_0x35b37d){if(_0x35b37d){var _0x19036c=_0x35b37d['count'],_0x2f499f=_0x573210[_0x20bc('0x1b')],_0x10008c=_0x573210[_0x20bc('0x1b')]+_0x573210[_0x20bc('0x1c')],_0x29dfd0;if(_0x10008c>=_0x19036c){_0x10008c=_0x19036c;_0x29dfd0=0xc8;}else{_0x29dfd0=0xce;}_0x3b53eb[_0x20bc('0x19')](_0x29dfd0);return _0x3b53eb['set'](_0x20bc('0x1d'),_0x2f499f+'-'+_0x10008c+'/'+_0x19036c)[_0x20bc('0x1a')](_0x35b37d);}return null;};}function patchUpdates(_0x250feb){return function(_0x16707e){try{jsonpatch['apply'](_0x16707e,_0x250feb,!![]);}catch(_0x539eff){return BPromise['reject'](_0x539eff);}return _0x16707e[_0x20bc('0x1e')]();};}function saveUpdates(_0x144208,_0x5b5c20){return function(_0x38839a){if(_0x38839a){return _0x38839a['update'](_0x144208)[_0x20bc('0x1f')](function(_0x523fe7){return _0x523fe7;});}return null;};}function removeEntity(_0xca1a02,_0x4118d6){return function(_0x6f3d0d){if(_0x6f3d0d){return _0x6f3d0d[_0x20bc('0x20')]()[_0x20bc('0x1f')](function(){_0xca1a02[_0x20bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e0ae,_0x392d35){return function(_0x4c0c2f){if(!_0x4c0c2f){_0x22e0ae[_0x20bc('0x21')](0x194);}return _0x4c0c2f;};}function handleError(_0x366854,_0x4749e6){_0x4749e6=_0x4749e6||0x1f4;return function(_0x81f8fd){logger[_0x20bc('0x22')](_0x81f8fd[_0x20bc('0x23')]);if(_0x81f8fd[_0x20bc('0x24')]){delete _0x81f8fd[_0x20bc('0x24')];}_0x366854['status'](_0x4749e6)[_0x20bc('0x25')](_0x81f8fd);};}exports[_0x20bc('0x26')]=function(_0x28ac72,_0x582b9d){var _0x440cd1={},_0x1d15f5={},_0x19d648={'count':0x0,'rows':[]};var _0x358910=_[_0x20bc('0x27')](db['MailServerOut'][_0x20bc('0x28')],function(_0x330225){return{'name':_0x330225[_0x20bc('0x29')],'type':_0x330225[_0x20bc('0x2a')]['key']};});_0x1d15f5[_0x20bc('0x2b')]=_[_0x20bc('0x27')](_0x358910,_0x20bc('0x24'));_0x1d15f5[_0x20bc('0x2c')]=_[_0x20bc('0x2d')](_0x28ac72['query']);_0x1d15f5['filters']=_['intersection'](_0x1d15f5[_0x20bc('0x2b')],_0x1d15f5[_0x20bc('0x2c')]);_0x440cd1[_0x20bc('0x2e')]=_[_0x20bc('0x2f')](_0x1d15f5['model'],qs[_0x20bc('0x30')](_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x30')]));_0x440cd1[_0x20bc('0x2e')]=_0x440cd1['attributes']['length']?_0x440cd1['attributes']:_0x1d15f5[_0x20bc('0x2b')];if(!_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x31')]('nolimit')){_0x440cd1[_0x20bc('0x1c')]=qs[_0x20bc('0x1c')](_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x1c')]);_0x440cd1['offset']=qs[_0x20bc('0x1b')](_0x28ac72[_0x20bc('0x2c')]['offset']);}_0x440cd1[_0x20bc('0x32')]=qs[_0x20bc('0x33')](_0x28ac72['query']['sort']);_0x440cd1['where']=qs[_0x20bc('0x34')](_[_0x20bc('0x35')](_0x28ac72[_0x20bc('0x2c')],_0x1d15f5[_0x20bc('0x34')]),_0x358910);if(_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x36')]){_0x440cd1[_0x20bc('0x37')]=_['merge'](_0x440cd1[_0x20bc('0x37')],{'$or':_[_0x20bc('0x27')](_0x358910,function(_0x380ed4){if(_0x380ed4[_0x20bc('0x2a')]!==_0x20bc('0x38')){var _0x5f1891={};_0x5f1891[_0x380ed4[_0x20bc('0x24')]]={'$like':'%'+_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x36')]+'%'};return _0x5f1891;}})});}_0x440cd1=_['merge']({},_0x440cd1,_0x28ac72[_0x20bc('0x39')]);var _0x4902c3={'where':_0x440cd1[_0x20bc('0x37')]};return db[_0x20bc('0x3a')][_0x20bc('0x3b')](_0x4902c3)['then'](function(_0x2fe9e6){_0x19d648[_0x20bc('0x3b')]=_0x2fe9e6;if(_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x3c')]){_0x440cd1[_0x20bc('0x3d')]=[{'all':!![]}];}return db[_0x20bc('0x3a')][_0x20bc('0x3e')](_0x440cd1);})[_0x20bc('0x1f')](function(_0x33a017){_0x19d648['rows']=_0x33a017;return _0x19d648;})[_0x20bc('0x1f')](respondWithFilteredResult(_0x582b9d,_0x440cd1))[_0x20bc('0x3f')](handleError(_0x582b9d,null));};exports[_0x20bc('0x40')]=function(_0x567a97,_0x700dcb){var _0x4b09fe={'raw':!![],'where':{'id':_0x567a97['params']['id']}},_0x3934ff={};_0x3934ff[_0x20bc('0x2b')]=_[_0x20bc('0x2d')](db[_0x20bc('0x3a')]['rawAttributes']);_0x3934ff['query']=_['keys'](_0x567a97[_0x20bc('0x2c')]);_0x3934ff['filters']=_[_0x20bc('0x2f')](_0x3934ff['model'],_0x3934ff[_0x20bc('0x2c')]);_0x4b09fe['attributes']=_[_0x20bc('0x2f')](_0x3934ff[_0x20bc('0x2b')],qs[_0x20bc('0x30')](_0x567a97['query'][_0x20bc('0x30')]));_0x4b09fe['attributes']=_0x4b09fe['attributes']['length']?_0x4b09fe[_0x20bc('0x2e')]:_0x3934ff[_0x20bc('0x2b')];if(_0x567a97[_0x20bc('0x2c')]['includeAll']){_0x4b09fe[_0x20bc('0x3d')]=[{'all':!![]}];}_0x4b09fe=_[_0x20bc('0x41')]({},_0x4b09fe,_0x567a97[_0x20bc('0x39')]);return db[_0x20bc('0x3a')][_0x20bc('0x42')](_0x4b09fe)[_0x20bc('0x1f')](handleEntityNotFound(_0x700dcb,null))[_0x20bc('0x1f')](respondWithResult(_0x700dcb,null))[_0x20bc('0x3f')](handleError(_0x700dcb,null));};exports[_0x20bc('0x43')]=function(_0x4c1233,_0x1e1dfb){return db['MailServerOut']['create'](_0x4c1233[_0x20bc('0x44')],{})[_0x20bc('0x1f')](respondWithResult(_0x1e1dfb,0xc9))[_0x20bc('0x3f')](handleError(_0x1e1dfb,null));};exports[_0x20bc('0x45')]=function(_0x52f8b3,_0x481354){if(_0x52f8b3[_0x20bc('0x44')]['id']){delete _0x52f8b3['body']['id'];}return db[_0x20bc('0x3a')][_0x20bc('0x42')]({'where':{'id':_0x52f8b3[_0x20bc('0x46')]['id']}})['then'](handleEntityNotFound(_0x481354,null))[_0x20bc('0x1f')](saveUpdates(_0x52f8b3[_0x20bc('0x44')],null))[_0x20bc('0x1f')](respondWithResult(_0x481354,null))[_0x20bc('0x3f')](handleError(_0x481354,null));};exports[_0x20bc('0x20')]=function(_0x3c27a2,_0x44392c){return db[_0x20bc('0x3a')][_0x20bc('0x42')]({'where':{'id':_0x3c27a2[_0x20bc('0x46')]['id']}})[_0x20bc('0x1f')](handleEntityNotFound(_0x44392c,null))[_0x20bc('0x1f')](removeEntity(_0x44392c,null))[_0x20bc('0x3f')](handleError(_0x44392c,null));}; \ No newline at end of file +var _0x6765=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','reject','update','then','destroy','sendStatus','error','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x543e10,_0x141572){var _0xb1add6=function(_0x2a08f9){while(--_0x2a08f9){_0x543e10['push'](_0x543e10['shift']());}};_0xb1add6(++_0x141572);}(_0x6765,0x172));var _0x5676=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x6765[_0x3a9661];return _0x5bb119;};'use strict';var pdf=require(_0x5676('0x0'));var emlformat=require(_0x5676('0x1'));var rimraf=require(_0x5676('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5676('0x3'));var rp=require('request-promise');var moment=require(_0x5676('0x4'));var BPromise=require(_0x5676('0x5'));var Mustache=require('mustache');var util=require(_0x5676('0x6'));var path=require(_0x5676('0x7'));var sox=require(_0x5676('0x8'));var csv=require(_0x5676('0x9'));var ejs=require(_0x5676('0xa'));var fs=require('fs');var _=require(_0x5676('0xb'));var squel=require(_0x5676('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5676('0xd'));var toCsv=require(_0x5676('0x9'));var querystring=require(_0x5676('0xe'));var Papa=require(_0x5676('0xf'));var Redis=require(_0x5676('0x10'));var authService=require(_0x5676('0x11'));var qs=require(_0x5676('0x12'));var as=require(_0x5676('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5676('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5676('0x15'));var licenseUtil=require(_0x5676('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed856f,_0x1b194f){_0x1b194f=_0x1b194f||0xcc;return function(_0x3c601d){if(_0x3c601d){return _0xed856f['sendStatus'](_0x1b194f);}return _0xed856f[_0x5676('0x17')](_0x1b194f)[_0x5676('0x18')]();};}function respondWithResult(_0x34838e,_0x26c91a){_0x26c91a=_0x26c91a||0xc8;return function(_0x3efe34){if(_0x3efe34){return _0x34838e[_0x5676('0x17')](_0x26c91a)[_0x5676('0x19')](_0x3efe34);}};}function respondWithFilteredResult(_0x4f1ca8,_0x4e35dd){return function(_0x54a937){if(_0x54a937){var _0x3232a3=_0x54a937[_0x5676('0x1a')],_0x430a9b=_0x4e35dd[_0x5676('0x1b')],_0x377183=_0x4e35dd[_0x5676('0x1b')]+_0x4e35dd[_0x5676('0x1c')],_0x306608;if(_0x377183>=_0x3232a3){_0x377183=_0x3232a3;_0x306608=0xc8;}else{_0x306608=0xce;}_0x4f1ca8[_0x5676('0x17')](_0x306608);return _0x4f1ca8[_0x5676('0x1d')]('Content-Range',_0x430a9b+'-'+_0x377183+'/'+_0x3232a3)[_0x5676('0x19')](_0x54a937);}return null;};}function patchUpdates(_0x1c5fc9){return function(_0xf5ecb6){try{jsonpatch['apply'](_0xf5ecb6,_0x1c5fc9,!![]);}catch(_0x53e64d){return BPromise[_0x5676('0x1e')](_0x53e64d);}return _0xf5ecb6['save']();};}function saveUpdates(_0x3d7d8a,_0x3f5fde){return function(_0x39a3b8){if(_0x39a3b8){return _0x39a3b8[_0x5676('0x1f')](_0x3d7d8a)[_0x5676('0x20')](function(_0x523fee){return _0x523fee;});}return null;};}function removeEntity(_0x17d0c4,_0x4cf919){return function(_0xfe1daf){if(_0xfe1daf){return _0xfe1daf[_0x5676('0x21')]()[_0x5676('0x20')](function(){_0x17d0c4[_0x5676('0x17')](0xcc)[_0x5676('0x18')]();});}};}function handleEntityNotFound(_0x575db6,_0x1a3036){return function(_0x146da2){if(!_0x146da2){_0x575db6[_0x5676('0x22')](0x194);}return _0x146da2;};}function handleError(_0x2862f4,_0x556dd8){_0x556dd8=_0x556dd8||0x1f4;return function(_0x5dc393){logger[_0x5676('0x23')](_0x5dc393['stack']);if(_0x5dc393[_0x5676('0x24')]){delete _0x5dc393[_0x5676('0x24')];}_0x2862f4[_0x5676('0x17')](_0x556dd8)[_0x5676('0x25')](_0x5dc393);};}exports['index']=function(_0x2fe11a,_0xd4f8f){var _0x2ca761={},_0x360210={},_0xd1626a={'count':0x0,'rows':[]};var _0xb936b6=_[_0x5676('0x26')](db[_0x5676('0x27')][_0x5676('0x28')],function(_0x11220b){return{'name':_0x11220b[_0x5676('0x29')],'type':_0x11220b[_0x5676('0x2a')][_0x5676('0x2b')]};});_0x360210[_0x5676('0x2c')]=_[_0x5676('0x26')](_0xb936b6,_0x5676('0x24'));_0x360210[_0x5676('0x2d')]=_[_0x5676('0x2e')](_0x2fe11a[_0x5676('0x2d')]);_0x360210['filters']=_['intersection'](_0x360210['model'],_0x360210[_0x5676('0x2d')]);_0x2ca761['attributes']=_[_0x5676('0x2f')](_0x360210[_0x5676('0x2c')],qs[_0x5676('0x30')](_0x2fe11a[_0x5676('0x2d')][_0x5676('0x30')]));_0x2ca761['attributes']=_0x2ca761[_0x5676('0x31')][_0x5676('0x32')]?_0x2ca761[_0x5676('0x31')]:_0x360210['model'];if(!_0x2fe11a[_0x5676('0x2d')][_0x5676('0x33')](_0x5676('0x34'))){_0x2ca761[_0x5676('0x1c')]=qs['limit'](_0x2fe11a['query']['limit']);_0x2ca761[_0x5676('0x1b')]=qs[_0x5676('0x1b')](_0x2fe11a[_0x5676('0x2d')][_0x5676('0x1b')]);}_0x2ca761[_0x5676('0x35')]=qs[_0x5676('0x36')](_0x2fe11a[_0x5676('0x2d')][_0x5676('0x36')]);_0x2ca761[_0x5676('0x37')]=qs[_0x5676('0x38')](_['pick'](_0x2fe11a[_0x5676('0x2d')],_0x360210[_0x5676('0x38')]),_0xb936b6);if(_0x2fe11a['query'][_0x5676('0x39')]){_0x2ca761[_0x5676('0x37')]=_['merge'](_0x2ca761[_0x5676('0x37')],{'$or':_['map'](_0xb936b6,function(_0x25516e){if(_0x25516e[_0x5676('0x2a')]!==_0x5676('0x3a')){var _0x8de9d3={};_0x8de9d3[_0x25516e['name']]={'$like':'%'+_0x2fe11a[_0x5676('0x2d')][_0x5676('0x39')]+'%'};return _0x8de9d3;}})});}_0x2ca761=_[_0x5676('0x3b')]({},_0x2ca761,_0x2fe11a[_0x5676('0x3c')]);var _0x5877c6={'where':_0x2ca761[_0x5676('0x37')]};return db['MailServerOut'][_0x5676('0x1a')](_0x5877c6)[_0x5676('0x20')](function(_0x11eceb){_0xd1626a[_0x5676('0x1a')]=_0x11eceb;if(_0x2fe11a[_0x5676('0x2d')][_0x5676('0x3d')]){_0x2ca761['include']=[{'all':!![]}];}return db[_0x5676('0x27')][_0x5676('0x3e')](_0x2ca761);})[_0x5676('0x20')](function(_0x1e0ce9){_0xd1626a[_0x5676('0x3f')]=_0x1e0ce9;return _0xd1626a;})[_0x5676('0x20')](respondWithFilteredResult(_0xd4f8f,_0x2ca761))[_0x5676('0x40')](handleError(_0xd4f8f,null));};exports['show']=function(_0x608a2,_0x5e9204){var _0x2ca3bb={'raw':!![],'where':{'id':_0x608a2[_0x5676('0x41')]['id']}},_0x1a1f35={};_0x1a1f35[_0x5676('0x2c')]=_[_0x5676('0x2e')](db[_0x5676('0x27')]['rawAttributes']);_0x1a1f35['query']=_[_0x5676('0x2e')](_0x608a2['query']);_0x1a1f35[_0x5676('0x38')]=_[_0x5676('0x2f')](_0x1a1f35[_0x5676('0x2c')],_0x1a1f35[_0x5676('0x2d')]);_0x2ca3bb['attributes']=_[_0x5676('0x2f')](_0x1a1f35['model'],qs[_0x5676('0x30')](_0x608a2['query'][_0x5676('0x30')]));_0x2ca3bb[_0x5676('0x31')]=_0x2ca3bb[_0x5676('0x31')][_0x5676('0x32')]?_0x2ca3bb[_0x5676('0x31')]:_0x1a1f35['model'];if(_0x608a2[_0x5676('0x2d')]['includeAll']){_0x2ca3bb[_0x5676('0x42')]=[{'all':!![]}];}_0x2ca3bb=_[_0x5676('0x3b')]({},_0x2ca3bb,_0x608a2[_0x5676('0x3c')]);return db['MailServerOut'][_0x5676('0x43')](_0x2ca3bb)[_0x5676('0x20')](handleEntityNotFound(_0x5e9204,null))['then'](respondWithResult(_0x5e9204,null))[_0x5676('0x40')](handleError(_0x5e9204,null));};exports[_0x5676('0x44')]=function(_0x5c9542,_0x3754a9){return db[_0x5676('0x27')][_0x5676('0x44')](_0x5c9542[_0x5676('0x45')],{})[_0x5676('0x20')](respondWithResult(_0x3754a9,0xc9))[_0x5676('0x40')](handleError(_0x3754a9,null));};exports[_0x5676('0x1f')]=function(_0x1aab15,_0x46a396){if(_0x1aab15[_0x5676('0x45')]['id']){delete _0x1aab15[_0x5676('0x45')]['id'];}return db[_0x5676('0x27')]['find']({'where':{'id':_0x1aab15[_0x5676('0x41')]['id']}})[_0x5676('0x20')](handleEntityNotFound(_0x46a396,null))[_0x5676('0x20')](saveUpdates(_0x1aab15['body'],null))[_0x5676('0x20')](respondWithResult(_0x46a396,null))[_0x5676('0x40')](handleError(_0x46a396,null));};exports[_0x5676('0x21')]=function(_0xf624b7,_0x4558d0){return db[_0x5676('0x27')][_0x5676('0x43')]({'where':{'id':_0xf624b7[_0x5676('0x41')]['id']}})[_0x5676('0x20')](handleEntityNotFound(_0x4558d0,null))[_0x5676('0x20')](removeEntity(_0x4558d0,null))[_0x5676('0x40')](handleError(_0x4558d0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index eacbc79..0977b55 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x46ed,0x168));var _0xd46e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46ed[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['exports','define','MailServerOut','mail_servers_out','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x51abc7,_0x404a0f){var _0x18fb20=function(_0xbf3fb7){while(--_0xbf3fb7){_0x51abc7['push'](_0x51abc7['shift']());}};_0x18fb20(++_0x404a0f);}(_0xda19,0xd5));var _0x9da1=function(_0x34cda7,_0xfd20d4){_0x34cda7=_0x34cda7-0x0;var _0x2ae028=_0xda19[_0x34cda7];return _0x2ae028;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e27e796..a75792c 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 _0x459e=['code','MailServerOut,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e19ee,_0x4bb2c5){var _0x1580c4=function(_0x4be41a){while(--_0x4be41a){_0x1e19ee['push'](_0x1e19ee['shift']());}};_0x1580c4(++_0x4bb2c5);}(_0x459e,0x95));var _0xe459=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x459e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe459('0x0'));var moment=require(_0xe459('0x1'));var BPromise=require(_0xe459('0x2'));var rs=require(_0xe459('0x3'));var fs=require('fs');var Redis=require(_0xe459('0x4'));var db=require(_0xe459('0x5'))['db'];var utils=require(_0xe459('0x6'));var logger=require(_0xe459('0x7'))(_0xe459('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe459('0x9')][_0xe459('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa79a8d,_0x3d668a,_0x18693d){return new BPromise(function(_0x235d6d,_0x45fd0d){return client[_0xe459('0xb')](_0xa79a8d,_0x18693d)[_0xe459('0xc')](function(_0x2b1264){logger[_0xe459('0xd')]('MailServerOut,\x20%s,\x20%s',_0x3d668a,_0xe459('0xe'));logger[_0xe459('0xf')](_0xe459('0x10'),_0x3d668a,_0xe459('0xe'),JSON[_0xe459('0x11')](_0x2b1264));if(_0x2b1264['error']){if(_0x2b1264[_0xe459('0x12')][_0xe459('0x13')]===0x1f4){logger[_0xe459('0x12')](_0xe459('0x14'),_0x3d668a,_0x2b1264['error'][_0xe459('0x15')]);return _0x45fd0d(_0x2b1264['error'][_0xe459('0x15')]);}logger[_0xe459('0x12')](_0xe459('0x14'),_0x3d668a,_0x2b1264[_0xe459('0x12')]['message']);return _0x235d6d(_0x2b1264[_0xe459('0x12')][_0xe459('0x15')]);}else{logger[_0xe459('0xd')](_0xe459('0x14'),_0x3d668a,_0xe459('0xe'));_0x235d6d(_0x2b1264[_0xe459('0x16')][_0xe459('0x15')]);}})[_0xe459('0x17')](function(_0x54be48){logger[_0xe459('0x12')](_0xe459('0x14'),_0x3d668a,_0x54be48);_0x45fd0d(_0x54be48);});});} \ No newline at end of file +var _0x7364=['error','code','MailServerOut,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x15f018,_0xb8c2d){var _0x555d81=function(_0xcc4ae9){while(--_0xcc4ae9){_0x15f018['push'](_0x15f018['shift']());}};_0x555d81(++_0xb8c2d);}(_0x7364,0xf6));var _0x4736=function(_0x5a6d53,_0x3a954d){_0x5a6d53=_0x5a6d53-0x0;var _0x4d677c=_0x7364[_0x5a6d53];return _0x4d677c;};'use strict';var _=require(_0x4736('0x0'));var util=require(_0x4736('0x1'));var moment=require(_0x4736('0x2'));var BPromise=require(_0x4736('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4736('0x4'));var db=require(_0x4736('0x5'))['db'];var utils=require(_0x4736('0x6'));var logger=require(_0x4736('0x7'))('rpc');var config=require(_0x4736('0x8'));var jayson=require(_0x4736('0x9'));var client=jayson[_0x4736('0xa')][_0x4736('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x112b9f,_0x2792fb,_0x41a10a){return new BPromise(function(_0x102271,_0x1efd6c){return client[_0x4736('0xc')](_0x112b9f,_0x41a10a)[_0x4736('0xd')](function(_0x3ece1f){logger[_0x4736('0xe')]('MailServerOut,\x20%s,\x20%s',_0x2792fb,'request\x20sent');logger[_0x4736('0xf')](_0x4736('0x10'),_0x2792fb,_0x4736('0x11'),JSON['stringify'](_0x3ece1f));if(_0x3ece1f[_0x4736('0x12')]){if(_0x3ece1f['error'][_0x4736('0x13')]===0x1f4){logger[_0x4736('0x12')](_0x4736('0x14'),_0x2792fb,_0x3ece1f[_0x4736('0x12')][_0x4736('0x15')]);return _0x1efd6c(_0x3ece1f[_0x4736('0x12')]['message']);}logger[_0x4736('0x12')]('MailServerOut,\x20%s,\x20%s',_0x2792fb,_0x3ece1f[_0x4736('0x12')][_0x4736('0x15')]);return _0x102271(_0x3ece1f[_0x4736('0x12')][_0x4736('0x15')]);}else{logger['info'](_0x4736('0x14'),_0x2792fb,_0x4736('0x11'));_0x102271(_0x3ece1f['result']['message']);}})['catch'](function(_0x4277c1){logger[_0x4736('0x12')](_0x4736('0x14'),_0x2792fb,_0x4277c1);_0x1efd6c(_0x4277c1);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a8ea882..86e37a6 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 _0xca03=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4c74c4,_0x2d4da2){var _0x3158d3=function(_0x3f5382){while(--_0x3f5382){_0x4c74c4['push'](_0x4c74c4['shift']());}};_0x3158d3(++_0x2d4da2);}(_0xca03,0x18b));var _0x3ca0=function(_0x489f27,_0x59cc83){_0x489f27=_0x489f27-0x0;var _0x5a2c5e=_0xca03[_0x489f27];return _0x5a2c5e;};'use strict';var multer=require(_0x3ca0('0x0'));var util=require(_0x3ca0('0x1'));var path=require(_0x3ca0('0x2'));var timeout=require(_0x3ca0('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3ca0('0x4'));var interaction=require(_0x3ca0('0x5'));var config=require(_0x3ca0('0x6'));var controller=require('./mailSubstatus.controller');router[_0x3ca0('0x7')]('/',auth['isAuthenticated'](),controller[_0x3ca0('0x8')]);router[_0x3ca0('0x7')](_0x3ca0('0x9'),auth['isAuthenticated'](),controller[_0x3ca0('0xa')]);router[_0x3ca0('0x7')](_0x3ca0('0xb'),auth[_0x3ca0('0xc')](),controller[_0x3ca0('0xd')]);router[_0x3ca0('0xe')]('/',auth[_0x3ca0('0xc')](),controller['create']);router[_0x3ca0('0xf')](_0x3ca0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3ca0('0x10')](_0x3ca0('0xb'),auth[_0x3ca0('0xc')](),controller[_0x3ca0('0x11')]);module[_0x3ca0('0x12')]=router; \ No newline at end of file +var _0xcb28=['../../config/environment','./mailSubstatus.controller','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xcb28,0x1c6));var _0x8cb2=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0xcb28[_0x414f67];return _0x338537;};'use strict';var multer=require(_0x8cb2('0x0'));var util=require(_0x8cb2('0x1'));var path=require(_0x8cb2('0x2'));var timeout=require(_0x8cb2('0x3'));var express=require(_0x8cb2('0x4'));var router=express[_0x8cb2('0x5')]();var auth=require(_0x8cb2('0x6'));var interaction=require(_0x8cb2('0x7'));var config=require(_0x8cb2('0x8'));var controller=require(_0x8cb2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8cb2('0xa')]);router['get'](_0x8cb2('0xb'),auth[_0x8cb2('0xc')](),controller[_0x8cb2('0xd')]);router['get'](_0x8cb2('0xe'),auth[_0x8cb2('0xc')](),controller[_0x8cb2('0xf')]);router[_0x8cb2('0x10')]('/',auth[_0x8cb2('0xc')](),controller[_0x8cb2('0x11')]);router[_0x8cb2('0x12')]('/:id',auth[_0x8cb2('0xc')](),controller['update']);router[_0x8cb2('0x13')](_0x8cb2('0xe'),auth[_0x8cb2('0xc')](),controller[_0x8cb2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index b60e8ba..5185e49 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 _0x195f=['exports','name','STRING','sequelize'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x195f,0x113));var _0xf195=function(_0x131205,_0x57575c){_0x131205=_0x131205-0x0;var _0x305300=_0x195f[_0x131205];return _0x305300;};'use strict';var Sequelize=require(_0xf195('0x0'));module[_0xf195('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf195('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf195('0x3')]}}; \ No newline at end of file +var _0x5430=['sequelize','exports','STRING','name'];(function(_0x11d411,_0x18677b){var _0x328df6=function(_0x45bc7d){while(--_0x45bc7d){_0x11d411['push'](_0x11d411['shift']());}};_0x328df6(++_0x18677b);}(_0x5430,0x10c));var _0x0543=function(_0x5d9efc,_0x2efe4f){_0x5d9efc=_0x5d9efc-0x0;var _0x40da50=_0x5430[_0x5d9efc];return _0x40da50;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0543('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b63117c..3588dd5 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 _0x8620=['api','../../config/environment','../../config/license/util','json','offset','limit','status','set','Content-Range','reject','update','then','destroy','end','sendStatus','stack','name','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','rows','catch','show','keys','MailSubstatus','intersection','fields','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x8620,0xc4));var _0x0862=function(_0x2611ff,_0x5081ba){_0x2611ff=_0x2611ff-0x0;var _0x4621c4=_0x8620[_0x2611ff];return _0x4621c4;};'use strict';var pdf=require(_0x0862('0x0'));var emlformat=require(_0x0862('0x1'));var rimraf=require(_0x0862('0x2'));var zipdir=require(_0x0862('0x3'));var jsonpatch=require(_0x0862('0x4'));var rp=require(_0x0862('0x5'));var moment=require('moment');var BPromise=require(_0x0862('0x6'));var Mustache=require(_0x0862('0x7'));var util=require(_0x0862('0x8'));var path=require(_0x0862('0x9'));var sox=require(_0x0862('0xa'));var csv=require(_0x0862('0xb'));var ejs=require(_0x0862('0xc'));var fs=require('fs');var _=require(_0x0862('0xd'));var squel=require(_0x0862('0xe'));var crypto=require(_0x0862('0xf'));var jsforce=require(_0x0862('0x10'));var deskjs=require(_0x0862('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0862('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0862('0x13'));var as=require(_0x0862('0x14'));var hardwareService=require(_0x0862('0x15'));var logger=require(_0x0862('0x16'))(_0x0862('0x17'));var utils=require('../../config/utils');var config=require(_0x0862('0x18'));var licenseUtil=require(_0x0862('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe99502,_0x28a2bd){_0x28a2bd=_0x28a2bd||0xcc;return function(_0x5a218c){if(_0x5a218c){return _0xe99502['sendStatus'](_0x28a2bd);}return _0xe99502['status'](_0x28a2bd)['end']();};}function respondWithResult(_0x34f6fd,_0x48e195){_0x48e195=_0x48e195||0xc8;return function(_0x33e4df){if(_0x33e4df){return _0x34f6fd['status'](_0x48e195)[_0x0862('0x1a')](_0x33e4df);}};}function respondWithFilteredResult(_0x4701bd,_0x33f640){return function(_0x5ce8d9){if(_0x5ce8d9){var _0x3b22f6=_0x5ce8d9['count'],_0x5dcb7c=_0x33f640['offset'],_0x172807=_0x33f640[_0x0862('0x1b')]+_0x33f640[_0x0862('0x1c')],_0x29fce4;if(_0x172807>=_0x3b22f6){_0x172807=_0x3b22f6;_0x29fce4=0xc8;}else{_0x29fce4=0xce;}_0x4701bd[_0x0862('0x1d')](_0x29fce4);return _0x4701bd[_0x0862('0x1e')](_0x0862('0x1f'),_0x5dcb7c+'-'+_0x172807+'/'+_0x3b22f6)['json'](_0x5ce8d9);}return null;};}function patchUpdates(_0x1d4a24){return function(_0x390f0f){try{jsonpatch['apply'](_0x390f0f,_0x1d4a24,!![]);}catch(_0x1994c7){return BPromise[_0x0862('0x20')](_0x1994c7);}return _0x390f0f['save']();};}function saveUpdates(_0x1ce503,_0x5ed8b6){return function(_0x3363dc){if(_0x3363dc){return _0x3363dc[_0x0862('0x21')](_0x1ce503)[_0x0862('0x22')](function(_0x2c156c){return _0x2c156c;});}return null;};}function removeEntity(_0x581cd8,_0x18369e){return function(_0x4f392c){if(_0x4f392c){return _0x4f392c[_0x0862('0x23')]()[_0x0862('0x22')](function(){_0x581cd8[_0x0862('0x1d')](0xcc)[_0x0862('0x24')]();});}};}function handleEntityNotFound(_0x49aa3d,_0x3c9751){return function(_0x28609d){if(!_0x28609d){_0x49aa3d[_0x0862('0x25')](0x194);}return _0x28609d;};}function handleError(_0x4e0e09,_0x54dae3){_0x54dae3=_0x54dae3||0x1f4;return function(_0x35ec66){logger['error'](_0x35ec66[_0x0862('0x26')]);if(_0x35ec66[_0x0862('0x27')]){delete _0x35ec66[_0x0862('0x27')];}_0x4e0e09[_0x0862('0x1d')](_0x54dae3)['send'](_0x35ec66);};}exports['index']=function(_0x2172ee,_0x243cdc){var _0x52100d={},_0xd22247={},_0x2661df={'count':0x0,'rows':[]};var _0x416627=_['map'](db['MailSubstatus'][_0x0862('0x28')],function(_0x5b46a1){return{'name':_0x5b46a1[_0x0862('0x29')],'type':_0x5b46a1[_0x0862('0x2a')][_0x0862('0x2b')]};});_0xd22247[_0x0862('0x2c')]=_[_0x0862('0x2d')](_0x416627,_0x0862('0x27'));_0xd22247[_0x0862('0x2e')]=_['keys'](_0x2172ee[_0x0862('0x2e')]);_0xd22247[_0x0862('0x2f')]=_['intersection'](_0xd22247[_0x0862('0x2c')],_0xd22247[_0x0862('0x2e')]);_0x52100d[_0x0862('0x30')]=_['intersection'](_0xd22247[_0x0862('0x2c')],qs['fields'](_0x2172ee[_0x0862('0x2e')]['fields']));_0x52100d[_0x0862('0x30')]=_0x52100d[_0x0862('0x30')]['length']?_0x52100d['attributes']:_0xd22247[_0x0862('0x2c')];if(!_0x2172ee[_0x0862('0x2e')][_0x0862('0x31')](_0x0862('0x32'))){_0x52100d[_0x0862('0x1c')]=qs[_0x0862('0x1c')](_0x2172ee[_0x0862('0x2e')][_0x0862('0x1c')]);_0x52100d[_0x0862('0x1b')]=qs[_0x0862('0x1b')](_0x2172ee[_0x0862('0x2e')][_0x0862('0x1b')]);}_0x52100d[_0x0862('0x33')]=qs[_0x0862('0x34')](_0x2172ee[_0x0862('0x2e')][_0x0862('0x34')]);_0x52100d[_0x0862('0x35')]=qs['filters'](_[_0x0862('0x36')](_0x2172ee[_0x0862('0x2e')],_0xd22247['filters']),_0x416627);if(_0x2172ee[_0x0862('0x2e')][_0x0862('0x37')]){_0x52100d[_0x0862('0x35')]=_[_0x0862('0x38')](_0x52100d[_0x0862('0x35')],{'$or':_[_0x0862('0x2d')](_0x416627,function(_0x2e9e37){if(_0x2e9e37[_0x0862('0x2a')]!==_0x0862('0x39')){var _0x37f953={};_0x37f953[_0x2e9e37[_0x0862('0x27')]]={'$like':'%'+_0x2172ee['query'][_0x0862('0x37')]+'%'};return _0x37f953;}})});}_0x52100d=_[_0x0862('0x38')]({},_0x52100d,_0x2172ee[_0x0862('0x3a')]);var _0x4f636f={'where':_0x52100d[_0x0862('0x35')]};return db['MailSubstatus'][_0x0862('0x3b')](_0x4f636f)[_0x0862('0x22')](function(_0x111047){_0x2661df[_0x0862('0x3b')]=_0x111047;if(_0x2172ee['query']['includeAll']){_0x52100d['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x52100d);})[_0x0862('0x22')](function(_0x8deb1c){_0x2661df[_0x0862('0x3c')]=_0x8deb1c;return _0x2661df;})['then'](respondWithFilteredResult(_0x243cdc,_0x52100d))[_0x0862('0x3d')](handleError(_0x243cdc,null));};exports[_0x0862('0x3e')]=function(_0x2c6220,_0x23e712){var _0x166c02={'raw':!![],'where':{'id':_0x2c6220['params']['id']}},_0x3a2190={};_0x3a2190['model']=_[_0x0862('0x3f')](db[_0x0862('0x40')]['rawAttributes']);_0x3a2190[_0x0862('0x2e')]=_[_0x0862('0x3f')](_0x2c6220[_0x0862('0x2e')]);_0x3a2190[_0x0862('0x2f')]=_['intersection'](_0x3a2190[_0x0862('0x2c')],_0x3a2190['query']);_0x166c02[_0x0862('0x30')]=_[_0x0862('0x41')](_0x3a2190[_0x0862('0x2c')],qs[_0x0862('0x42')](_0x2c6220['query'][_0x0862('0x42')]));_0x166c02[_0x0862('0x30')]=_0x166c02['attributes']['length']?_0x166c02[_0x0862('0x30')]:_0x3a2190[_0x0862('0x2c')];if(_0x2c6220[_0x0862('0x2e')]['includeAll']){_0x166c02[_0x0862('0x43')]=[{'all':!![]}];}_0x166c02=_['merge']({},_0x166c02,_0x2c6220[_0x0862('0x3a')]);return db[_0x0862('0x40')][_0x0862('0x44')](_0x166c02)[_0x0862('0x22')](handleEntityNotFound(_0x23e712,null))['then'](respondWithResult(_0x23e712,null))['catch'](handleError(_0x23e712,null));};exports[_0x0862('0x45')]=function(_0x5c9ea7,_0x4bc1f1){return db[_0x0862('0x40')][_0x0862('0x45')](_0x5c9ea7[_0x0862('0x46')],{})[_0x0862('0x22')](respondWithResult(_0x4bc1f1,0xc9))[_0x0862('0x3d')](handleError(_0x4bc1f1,null));};exports[_0x0862('0x21')]=function(_0x5dbae5,_0x4f0b1d){if(_0x5dbae5[_0x0862('0x46')]['id']){delete _0x5dbae5['body']['id'];}return db[_0x0862('0x40')][_0x0862('0x44')]({'where':{'id':_0x5dbae5['params']['id']}})[_0x0862('0x22')](handleEntityNotFound(_0x4f0b1d,null))['then'](saveUpdates(_0x5dbae5[_0x0862('0x46')],null))['then'](respondWithResult(_0x4f0b1d,null))[_0x0862('0x3d')](handleError(_0x4f0b1d,null));};exports[_0x0862('0x23')]=function(_0x1b008b,_0x467468){return db['MailSubstatus'][_0x0862('0x44')]({'where':{'id':_0x1b008b[_0x0862('0x47')]['id']}})[_0x0862('0x22')](handleEntityNotFound(_0x467468,null))[_0x0862('0x22')](removeEntity(_0x467468,null))[_0x0862('0x3d')](handleError(_0x467468,null));};exports['describe']=function(_0x4067a1,_0x474307){return db['MailSubstatus'][_0x0862('0x48')]()['then'](respondWithResult(_0x474307,null))['catch'](handleError(_0x474307,null));}; \ No newline at end of file +var _0x159e=['../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','type','merge','options','includeAll','findAll','rows','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x15400d,_0x349577){var _0x4d9a0e=function(_0x3de71f){while(--_0x3de71f){_0x15400d['push'](_0x15400d['shift']());}};_0x4d9a0e(++_0x349577);}(_0x159e,0x14c));var _0xe159=function(_0x5ec651,_0x597f24){_0x5ec651=_0x5ec651-0x0;var _0x38a1a4=_0x159e[_0x5ec651];return _0x38a1a4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe159('0x0'));var rimraf=require(_0xe159('0x1'));var zipdir=require(_0xe159('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe159('0x3'));var moment=require(_0xe159('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe159('0x5'));var sox=require('sox');var csv=require(_0xe159('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe159('0x7'));var jsforce=require(_0xe159('0x8'));var deskjs=require(_0xe159('0x9'));var toCsv=require(_0xe159('0x6'));var querystring=require(_0xe159('0xa'));var Papa=require('papaparse');var Redis=require(_0xe159('0xb'));var authService=require(_0xe159('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe159('0xd'));var hardwareService=require(_0xe159('0xe'));var logger=require(_0xe159('0xf'))(_0xe159('0x10'));var utils=require(_0xe159('0x11'));var config=require(_0xe159('0x12'));var licenseUtil=require(_0xe159('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c067,_0x33f4c6){_0x33f4c6=_0x33f4c6||0xcc;return function(_0x537ec3){if(_0x537ec3){return _0x49c067[_0xe159('0x14')](_0x33f4c6);}return _0x49c067[_0xe159('0x15')](_0x33f4c6)[_0xe159('0x16')]();};}function respondWithResult(_0x3f0e4b,_0x4b9891){_0x4b9891=_0x4b9891||0xc8;return function(_0x34af89){if(_0x34af89){return _0x3f0e4b[_0xe159('0x15')](_0x4b9891)['json'](_0x34af89);}};}function respondWithFilteredResult(_0x30fe06,_0x1b4e2e){return function(_0x410941){if(_0x410941){var _0x315542=_0x410941[_0xe159('0x17')],_0x3103c4=_0x1b4e2e[_0xe159('0x18')],_0x5754a3=_0x1b4e2e['offset']+_0x1b4e2e['limit'],_0x9f04ca;if(_0x5754a3>=_0x315542){_0x5754a3=_0x315542;_0x9f04ca=0xc8;}else{_0x9f04ca=0xce;}_0x30fe06[_0xe159('0x15')](_0x9f04ca);return _0x30fe06[_0xe159('0x19')](_0xe159('0x1a'),_0x3103c4+'-'+_0x5754a3+'/'+_0x315542)[_0xe159('0x1b')](_0x410941);}return null;};}function patchUpdates(_0xc61644){return function(_0x427560){try{jsonpatch[_0xe159('0x1c')](_0x427560,_0xc61644,!![]);}catch(_0x2081e5){return BPromise[_0xe159('0x1d')](_0x2081e5);}return _0x427560[_0xe159('0x1e')]();};}function saveUpdates(_0x185701,_0x4ff535){return function(_0x5249c8){if(_0x5249c8){return _0x5249c8[_0xe159('0x1f')](_0x185701)[_0xe159('0x20')](function(_0x576ae4){return _0x576ae4;});}return null;};}function removeEntity(_0x276ab1,_0x7cd585){return function(_0x1cb542){if(_0x1cb542){return _0x1cb542['destroy']()[_0xe159('0x20')](function(){_0x276ab1[_0xe159('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x89c74e,_0x3696bf){return function(_0x208550){if(!_0x208550){_0x89c74e[_0xe159('0x14')](0x194);}return _0x208550;};}function handleError(_0x2f1825,_0x5902f6){_0x5902f6=_0x5902f6||0x1f4;return function(_0x5535c5){logger[_0xe159('0x21')](_0x5535c5[_0xe159('0x22')]);if(_0x5535c5[_0xe159('0x23')]){delete _0x5535c5[_0xe159('0x23')];}_0x2f1825[_0xe159('0x15')](_0x5902f6)['send'](_0x5535c5);};}exports[_0xe159('0x24')]=function(_0x34a40a,_0x1e4684){var _0x11633a={},_0x1581b6={},_0x143bbb={'count':0x0,'rows':[]};var _0x44c75f=_[_0xe159('0x25')](db[_0xe159('0x26')][_0xe159('0x27')],function(_0x555bdf){return{'name':_0x555bdf[_0xe159('0x28')],'type':_0x555bdf['type'][_0xe159('0x29')]};});_0x1581b6[_0xe159('0x2a')]=_[_0xe159('0x25')](_0x44c75f,_0xe159('0x23'));_0x1581b6[_0xe159('0x2b')]=_[_0xe159('0x2c')](_0x34a40a[_0xe159('0x2b')]);_0x1581b6['filters']=_[_0xe159('0x2d')](_0x1581b6['model'],_0x1581b6[_0xe159('0x2b')]);_0x11633a[_0xe159('0x2e')]=_[_0xe159('0x2d')](_0x1581b6[_0xe159('0x2a')],qs[_0xe159('0x2f')](_0x34a40a[_0xe159('0x2b')][_0xe159('0x2f')]));_0x11633a[_0xe159('0x2e')]=_0x11633a[_0xe159('0x2e')][_0xe159('0x30')]?_0x11633a[_0xe159('0x2e')]:_0x1581b6[_0xe159('0x2a')];if(!_0x34a40a[_0xe159('0x2b')][_0xe159('0x31')](_0xe159('0x32'))){_0x11633a['limit']=qs[_0xe159('0x33')](_0x34a40a['query']['limit']);_0x11633a[_0xe159('0x18')]=qs['offset'](_0x34a40a[_0xe159('0x2b')][_0xe159('0x18')]);}_0x11633a['order']=qs[_0xe159('0x34')](_0x34a40a[_0xe159('0x2b')][_0xe159('0x34')]);_0x11633a[_0xe159('0x35')]=qs['filters'](_['pick'](_0x34a40a[_0xe159('0x2b')],_0x1581b6[_0xe159('0x36')]),_0x44c75f);if(_0x34a40a[_0xe159('0x2b')][_0xe159('0x37')]){_0x11633a[_0xe159('0x35')]=_['merge'](_0x11633a[_0xe159('0x35')],{'$or':_[_0xe159('0x25')](_0x44c75f,function(_0x47f21c){if(_0x47f21c[_0xe159('0x38')]!=='VIRTUAL'){var _0x1dc39e={};_0x1dc39e[_0x47f21c[_0xe159('0x23')]]={'$like':'%'+_0x34a40a[_0xe159('0x2b')][_0xe159('0x37')]+'%'};return _0x1dc39e;}})});}_0x11633a=_[_0xe159('0x39')]({},_0x11633a,_0x34a40a[_0xe159('0x3a')]);var _0x2cb6f1={'where':_0x11633a[_0xe159('0x35')]};return db[_0xe159('0x26')][_0xe159('0x17')](_0x2cb6f1)[_0xe159('0x20')](function(_0x17c77d){_0x143bbb[_0xe159('0x17')]=_0x17c77d;if(_0x34a40a['query'][_0xe159('0x3b')]){_0x11633a['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xe159('0x3c')](_0x11633a);})[_0xe159('0x20')](function(_0x52752d){_0x143bbb[_0xe159('0x3d')]=_0x52752d;return _0x143bbb;})[_0xe159('0x20')](respondWithFilteredResult(_0x1e4684,_0x11633a))['catch'](handleError(_0x1e4684,null));};exports['show']=function(_0x260e34,_0x5dcacb){var _0x4eaa97={'raw':!![],'where':{'id':_0x260e34[_0xe159('0x3e')]['id']}},_0x53cafd={};_0x53cafd[_0xe159('0x2a')]=_[_0xe159('0x2c')](db[_0xe159('0x26')]['rawAttributes']);_0x53cafd['query']=_[_0xe159('0x2c')](_0x260e34[_0xe159('0x2b')]);_0x53cafd[_0xe159('0x36')]=_[_0xe159('0x2d')](_0x53cafd[_0xe159('0x2a')],_0x53cafd[_0xe159('0x2b')]);_0x4eaa97[_0xe159('0x2e')]=_[_0xe159('0x2d')](_0x53cafd['model'],qs[_0xe159('0x2f')](_0x260e34['query']['fields']));_0x4eaa97[_0xe159('0x2e')]=_0x4eaa97[_0xe159('0x2e')][_0xe159('0x30')]?_0x4eaa97[_0xe159('0x2e')]:_0x53cafd['model'];if(_0x260e34[_0xe159('0x2b')]['includeAll']){_0x4eaa97[_0xe159('0x3f')]=[{'all':!![]}];}_0x4eaa97=_[_0xe159('0x39')]({},_0x4eaa97,_0x260e34['options']);return db[_0xe159('0x26')][_0xe159('0x40')](_0x4eaa97)[_0xe159('0x20')](handleEntityNotFound(_0x5dcacb,null))['then'](respondWithResult(_0x5dcacb,null))[_0xe159('0x41')](handleError(_0x5dcacb,null));};exports['create']=function(_0x35b1d0,_0x5e1e90){return db[_0xe159('0x26')][_0xe159('0x42')](_0x35b1d0[_0xe159('0x43')],{})['then'](respondWithResult(_0x5e1e90,0xc9))[_0xe159('0x41')](handleError(_0x5e1e90,null));};exports[_0xe159('0x1f')]=function(_0x2271bf,_0x3d8f6a){if(_0x2271bf[_0xe159('0x43')]['id']){delete _0x2271bf[_0xe159('0x43')]['id'];}return db[_0xe159('0x26')]['find']({'where':{'id':_0x2271bf['params']['id']}})[_0xe159('0x20')](handleEntityNotFound(_0x3d8f6a,null))[_0xe159('0x20')](saveUpdates(_0x2271bf[_0xe159('0x43')],null))[_0xe159('0x20')](respondWithResult(_0x3d8f6a,null))[_0xe159('0x41')](handleError(_0x3d8f6a,null));};exports[_0xe159('0x44')]=function(_0x45aecc,_0x4a1432){return db[_0xe159('0x26')][_0xe159('0x40')]({'where':{'id':_0x45aecc[_0xe159('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a1432,null))[_0xe159('0x20')](removeEntity(_0x4a1432,null))[_0xe159('0x41')](handleError(_0x4a1432,null));};exports[_0xe159('0x45')]=function(_0x1c096f,_0x22ce8f){return db[_0xe159('0x26')]['describe']()['then'](respondWithResult(_0x22ce8f,null))[_0xe159('0x41')](handleError(_0x22ce8f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f84c4df..bf4d48c 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses','lodash','util'];(function(_0x534cb8,_0x339b40){var _0x2847c7=function(_0xdbc62){while(--_0xdbc62){_0x534cb8['push'](_0x534cb8['shift']());}};_0x2847c7(++_0x339b40);}(_0x1a37,0xb4));var _0x71a3=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1a37[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./mailSubstatus.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65c9=['bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash','util','api','moment'];(function(_0x3a68c9,_0xc6e6b2){var _0x2f0284=function(_0x50f70d){while(--_0x50f70d){_0x3a68c9['push'](_0x3a68c9['shift']());}};_0x2f0284(++_0xc6e6b2);}(_0x65c9,0x182));var _0x965c=function(_0xdfce51,_0x455ed8){_0xdfce51=_0xdfce51-0x0;var _0x210798=_0x65c9[_0xdfce51];return _0x210798;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require('../../config/logger')(_0x965c('0x2'));var moment=require(_0x965c('0x3'));var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));module[_0x965c('0xa')]=function(_0xbda9ee,_0xb9c834){return _0xbda9ee[_0x965c('0xb')]('MailSubstatus',attributes,{'tableName':_0x965c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 59c9cdc..f60afb2 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','util'];(function(_0x2db2a7,_0x495a66){var _0x5b67a1=function(_0x458a94){while(--_0x458a94){_0x2db2a7['push'](_0x2db2a7['shift']());}};_0x5b67a1(++_0x495a66);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f0112,_0x17f94b){_0x1f0112=_0x1f0112-0x0;var _0x28799b=_0xedd9[_0x1f0112];return _0x28799b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('MailSubstatus,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x0a9a=['MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x15b192,_0x38c235){var _0x396e73=function(_0x4ba480){while(--_0x4ba480){_0x15b192['push'](_0x15b192['shift']());}};_0x396e73(++_0x38c235);}(_0x0a9a,0x183));var _0xa0a9=function(_0x410234,_0x45f58c){_0x410234=_0x410234-0x0;var _0x1824fd=_0x0a9a[_0x410234];return _0x1824fd;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d28ebf7..fe49def 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 _0x158b=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x152c94,_0x1b9c39){var _0x4c46e8=function(_0xc758f1){while(--_0xc758f1){_0x152c94['push'](_0x152c94['shift']());}};_0x4c46e8(++_0x1b9c39);}(_0x158b,0x1c2));var _0xb158=function(_0x496812,_0x31d206){_0x496812=_0x496812-0x0;var _0xfc2e47=_0x158b[_0x496812];return _0xfc2e47;};'use strict';var multer=require(_0xb158('0x0'));var util=require(_0xb158('0x1'));var path=require(_0xb158('0x2'));var timeout=require('connect-timeout');var express=require(_0xb158('0x3'));var router=express[_0xb158('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb158('0x5'));var config=require(_0xb158('0x6'));var controller=require(_0xb158('0x7'));router[_0xb158('0x8')]('/',auth[_0xb158('0x9')](),controller[_0xb158('0xa')]);router[_0xb158('0x8')](_0xb158('0xb'),auth['isAuthenticated'](),controller[_0xb158('0xc')]);router['get']('/:id',auth[_0xb158('0x9')](),controller[_0xb158('0xd')]);router[_0xb158('0xe')]('/',auth[_0xb158('0x9')](),controller['create']);router[_0xb158('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb158('0x10')]);router[_0xb158('0x11')]('/:id',auth[_0xb158('0x9')](),controller[_0xb158('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8ca8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','delete','destroy','multer'];(function(_0x3486c8,_0x5758a2){var _0x44a444=function(_0x14052a){while(--_0x14052a){_0x3486c8['push'](_0x3486c8['shift']());}};_0x44a444(++_0x5758a2);}(_0x8ca8,0x13a));var _0x88ca=function(_0x2f1c6d,_0x1abb45){_0x2f1c6d=_0x2f1c6d-0x0;var _0x18da40=_0x8ca8[_0x2f1c6d];return _0x18da40;};'use strict';var multer=require(_0x88ca('0x0'));var util=require(_0x88ca('0x1'));var path=require(_0x88ca('0x2'));var timeout=require(_0x88ca('0x3'));var express=require(_0x88ca('0x4'));var router=express[_0x88ca('0x5')]();var auth=require(_0x88ca('0x6'));var interaction=require(_0x88ca('0x7'));var config=require(_0x88ca('0x8'));var controller=require(_0x88ca('0x9'));router['get']('/',auth[_0x88ca('0xa')](),controller[_0x88ca('0xb')]);router[_0x88ca('0xc')](_0x88ca('0xd'),auth[_0x88ca('0xa')](),controller[_0x88ca('0xe')]);router['get'](_0x88ca('0xf'),auth[_0x88ca('0xa')](),controller[_0x88ca('0x10')]);router['post']('/',auth[_0x88ca('0xa')](),controller[_0x88ca('0x11')]);router[_0x88ca('0x12')]('/:id',auth[_0x88ca('0xa')](),controller['update']);router[_0x88ca('0x13')](_0x88ca('0xf'),auth[_0x88ca('0xa')](),controller[_0x88ca('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ed33a0c..04fe5c3 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 _0x2960=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','account'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2960,0x7b));var _0x0296=function(_0x346e6b,_0x1f4479){_0x346e6b=_0x346e6b-0x0;var _0x15f973=_0x2960[_0x346e6b];return _0x15f973;};'use strict';var moment=require('moment');var Sequelize=require(_0x0296('0x0'));module[_0x0296('0x1')]={'uniqueid':{'type':Sequelize[_0x0296('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0296('0x3')](_0x0296('0x4'),'agent',_0x0296('0x5')),'allowNull':![],'defaultValue':_0x0296('0x5')},'transferredAt':{'type':Sequelize[_0x0296('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x0296('0x7')]}}; \ No newline at end of file +var _0xcb93=['agent','queue','DATE','NOW','sequelize','exports','ENUM','account'];(function(_0x4cba2d,_0x4b33af){var _0x228b0d=function(_0x5ef570){while(--_0x5ef570){_0x4cba2d['push'](_0x4cba2d['shift']());}};_0x228b0d(++_0x4b33af);}(_0xcb93,0x1a4));var _0x3cb9=function(_0x3f15c0,_0x57b955){_0x3f15c0=_0x3f15c0-0x0;var _0x3ee023=_0xcb93[_0x3f15c0];return _0x3ee023;};'use strict';var moment=require('moment');var Sequelize=require(_0x3cb9('0x0'));module[_0x3cb9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3cb9('0x2')](_0x3cb9('0x3'),_0x3cb9('0x4'),_0x3cb9('0x5')),'allowNull':![],'defaultValue':_0x3cb9('0x5')},'transferredAt':{'type':Sequelize[_0x3cb9('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x3cb9('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e24a46b..49ead88 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 _0xf34f=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','MailTransferReport','rawAttributes','fieldName','type','key','name','query'];(function(_0x43b871,_0xb66bad){var _0x461875=function(_0x2a882a){while(--_0x2a882a){_0x43b871['push'](_0x43b871['shift']());}};_0x461875(++_0xb66bad);}(_0xf34f,0x64));var _0xff34=function(_0x5176d4,_0x590ea4){_0x5176d4=_0x5176d4-0x0;var _0x2870c6=_0xf34f[_0x5176d4];return _0x2870c6;};'use strict';var pdf=require(_0xff34('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff34('0x2'));var rp=require('request-promise');var moment=require(_0xff34('0x3'));var BPromise=require(_0xff34('0x4'));var Mustache=require(_0xff34('0x5'));var util=require('util');var path=require(_0xff34('0x6'));var sox=require('sox');var csv=require(_0xff34('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff34('0x8'));var squel=require('squel');var crypto=require(_0xff34('0x9'));var jsforce=require(_0xff34('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff34('0xb'));var Papa=require(_0xff34('0xc'));var Redis=require(_0xff34('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xff34('0xe'));var as=require(_0xff34('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff34('0x10'))(_0xff34('0x11'));var utils=require(_0xff34('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xff34('0x13'));var db=require(_0xff34('0x14'))['db'];function respondWithStatusCode(_0x2e3d0a,_0x3fa22f){_0x3fa22f=_0x3fa22f||0xcc;return function(_0x39ecac){if(_0x39ecac){return _0x2e3d0a[_0xff34('0x15')](_0x3fa22f);}return _0x2e3d0a[_0xff34('0x16')](_0x3fa22f)[_0xff34('0x17')]();};}function respondWithResult(_0x3b0921,_0x275871){_0x275871=_0x275871||0xc8;return function(_0x2fe6b1){if(_0x2fe6b1){return _0x3b0921[_0xff34('0x16')](_0x275871)[_0xff34('0x18')](_0x2fe6b1);}};}function respondWithFilteredResult(_0x3a184e,_0x3bfe1c){return function(_0x11aac2){if(_0x11aac2){var _0x23023f=_0x11aac2['count'],_0x3b7af5=_0x3bfe1c[_0xff34('0x19')],_0x31fdfd=_0x3bfe1c['offset']+_0x3bfe1c[_0xff34('0x1a')],_0xf5e0ec;if(_0x31fdfd>=_0x23023f){_0x31fdfd=_0x23023f;_0xf5e0ec=0xc8;}else{_0xf5e0ec=0xce;}_0x3a184e['status'](_0xf5e0ec);return _0x3a184e[_0xff34('0x1b')](_0xff34('0x1c'),_0x3b7af5+'-'+_0x31fdfd+'/'+_0x23023f)['json'](_0x11aac2);}return null;};}function patchUpdates(_0x5f5107){return function(_0x1a3a6d){try{jsonpatch[_0xff34('0x1d')](_0x1a3a6d,_0x5f5107,!![]);}catch(_0x2b967f){return BPromise[_0xff34('0x1e')](_0x2b967f);}return _0x1a3a6d[_0xff34('0x1f')]();};}function saveUpdates(_0x26998e,_0x3fb8a9){return function(_0x112b15){if(_0x112b15){return _0x112b15[_0xff34('0x20')](_0x26998e)[_0xff34('0x21')](function(_0x2ed55d){return _0x2ed55d;});}return null;};}function removeEntity(_0x1c76f6,_0x25eb54){return function(_0x244e8f){if(_0x244e8f){return _0x244e8f[_0xff34('0x22')]()[_0xff34('0x21')](function(){_0x1c76f6[_0xff34('0x16')](0xcc)[_0xff34('0x17')]();});}};}function handleEntityNotFound(_0x40f14e,_0x1bbcff){return function(_0x2fde63){if(!_0x2fde63){_0x40f14e['sendStatus'](0x194);}return _0x2fde63;};}function handleError(_0x17391d,_0x3bf481){_0x3bf481=_0x3bf481||0x1f4;return function(_0x66df01){logger[_0xff34('0x23')](_0x66df01[_0xff34('0x24')]);if(_0x66df01['name']){delete _0x66df01['name'];}_0x17391d[_0xff34('0x16')](_0x3bf481)[_0xff34('0x25')](_0x66df01);};}exports['index']=function(_0x284696,_0x119c88){var _0x206dc3={},_0x4c2c42={},_0x20ca49={'count':0x0,'rows':[]};var _0x52629f=_[_0xff34('0x26')](db[_0xff34('0x27')][_0xff34('0x28')],function(_0x5c1e72){return{'name':_0x5c1e72[_0xff34('0x29')],'type':_0x5c1e72[_0xff34('0x2a')][_0xff34('0x2b')]};});_0x4c2c42['model']=_[_0xff34('0x26')](_0x52629f,_0xff34('0x2c'));_0x4c2c42[_0xff34('0x2d')]=_[_0xff34('0x2e')](_0x284696[_0xff34('0x2d')]);_0x4c2c42[_0xff34('0x2f')]=_['intersection'](_0x4c2c42['model'],_0x4c2c42[_0xff34('0x2d')]);_0x206dc3['attributes']=_[_0xff34('0x30')](_0x4c2c42[_0xff34('0x31')],qs['fields'](_0x284696[_0xff34('0x2d')][_0xff34('0x32')]));_0x206dc3[_0xff34('0x33')]=_0x206dc3[_0xff34('0x33')][_0xff34('0x34')]?_0x206dc3[_0xff34('0x33')]:_0x4c2c42[_0xff34('0x31')];if(!_0x284696[_0xff34('0x2d')][_0xff34('0x35')]('nolimit')){_0x206dc3[_0xff34('0x1a')]=qs['limit'](_0x284696[_0xff34('0x2d')][_0xff34('0x1a')]);_0x206dc3['offset']=qs['offset'](_0x284696[_0xff34('0x2d')][_0xff34('0x19')]);}_0x206dc3[_0xff34('0x36')]=qs[_0xff34('0x37')](_0x284696[_0xff34('0x2d')]['sort']);_0x206dc3[_0xff34('0x38')]=qs[_0xff34('0x2f')](_['pick'](_0x284696[_0xff34('0x2d')],_0x4c2c42[_0xff34('0x2f')]),_0x52629f);if(_0x284696['query'][_0xff34('0x39')]){_0x206dc3['where']=_[_0xff34('0x3a')](_0x206dc3[_0xff34('0x38')],{'$or':_['map'](_0x52629f,function(_0x1021ac){if(_0x1021ac[_0xff34('0x2a')]!==_0xff34('0x3b')){var _0x1c1f69={};_0x1c1f69[_0x1021ac[_0xff34('0x2c')]]={'$like':'%'+_0x284696[_0xff34('0x2d')][_0xff34('0x39')]+'%'};return _0x1c1f69;}})});}_0x206dc3=_['merge']({},_0x206dc3,_0x284696['options']);var _0x920b2e={'where':_0x206dc3[_0xff34('0x38')]};return db['MailTransferReport'][_0xff34('0x3c')](_0x920b2e)[_0xff34('0x21')](function(_0x248e7e){_0x20ca49[_0xff34('0x3c')]=_0x248e7e;if(_0x284696[_0xff34('0x2d')][_0xff34('0x3d')]){_0x206dc3[_0xff34('0x3e')]=[{'all':!![]}];}return db[_0xff34('0x27')][_0xff34('0x3f')](_0x206dc3);})[_0xff34('0x21')](function(_0x10c1ee){_0x20ca49[_0xff34('0x40')]=_0x10c1ee;return _0x20ca49;})[_0xff34('0x21')](respondWithFilteredResult(_0x119c88,_0x206dc3))[_0xff34('0x41')](handleError(_0x119c88,null));};exports[_0xff34('0x42')]=function(_0x16e288,_0x5e33e2){var _0xb9e560={'raw':!![],'where':{'id':_0x16e288['params']['id']}},_0x23fc9e={};_0x23fc9e[_0xff34('0x31')]=_[_0xff34('0x2e')](db[_0xff34('0x27')][_0xff34('0x28')]);_0x23fc9e[_0xff34('0x2d')]=_['keys'](_0x16e288['query']);_0x23fc9e[_0xff34('0x2f')]=_[_0xff34('0x30')](_0x23fc9e['model'],_0x23fc9e[_0xff34('0x2d')]);_0xb9e560[_0xff34('0x33')]=_[_0xff34('0x30')](_0x23fc9e[_0xff34('0x31')],qs[_0xff34('0x32')](_0x16e288['query']['fields']));_0xb9e560[_0xff34('0x33')]=_0xb9e560['attributes'][_0xff34('0x34')]?_0xb9e560['attributes']:_0x23fc9e[_0xff34('0x31')];if(_0x16e288['query'][_0xff34('0x3d')]){_0xb9e560['include']=[{'all':!![]}];}_0xb9e560=_[_0xff34('0x3a')]({},_0xb9e560,_0x16e288[_0xff34('0x43')]);return db['MailTransferReport'][_0xff34('0x44')](_0xb9e560)[_0xff34('0x21')](handleEntityNotFound(_0x5e33e2,null))[_0xff34('0x21')](respondWithResult(_0x5e33e2,null))[_0xff34('0x41')](handleError(_0x5e33e2,null));};exports[_0xff34('0x45')]=function(_0x785280,_0x1e59e6){return db['MailTransferReport'][_0xff34('0x45')](_0x785280['body'],{})['then'](respondWithResult(_0x1e59e6,0xc9))['catch'](handleError(_0x1e59e6,null));};exports[_0xff34('0x20')]=function(_0x57589e,_0x15f3ba){if(_0x57589e[_0xff34('0x46')]['id']){delete _0x57589e[_0xff34('0x46')]['id'];}return db[_0xff34('0x27')]['find']({'where':{'id':_0x57589e['params']['id']}})[_0xff34('0x21')](handleEntityNotFound(_0x15f3ba,null))[_0xff34('0x21')](saveUpdates(_0x57589e[_0xff34('0x46')],null))['then'](respondWithResult(_0x15f3ba,null))['catch'](handleError(_0x15f3ba,null));};exports['destroy']=function(_0x1f5389,_0x139002){return db[_0xff34('0x27')]['find']({'where':{'id':_0x1f5389[_0xff34('0x47')]['id']}})['then'](handleEntityNotFound(_0x139002,null))[_0xff34('0x21')](removeEntity(_0x139002,null))['catch'](handleError(_0x139002,null));};exports[_0xff34('0x48')]=function(_0x1de6a1,_0x94510c){return db['MailTransferReport'][_0xff34('0x48')]()['then'](respondWithResult(_0x94510c,null))[_0xff34('0x41')](handleError(_0x94510c,null));}; \ No newline at end of file +var _0x3f71=['stack','name','status','index','map','rawAttributes','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','merge','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','length','create','body','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x3f71,0x10d));var _0x13f7=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3f71[_0xd09668];return _0x68726;};'use strict';var pdf=require(_0x13f7('0x0'));var emlformat=require(_0x13f7('0x1'));var rimraf=require(_0x13f7('0x2'));var zipdir=require(_0x13f7('0x3'));var jsonpatch=require(_0x13f7('0x4'));var rp=require(_0x13f7('0x5'));var moment=require(_0x13f7('0x6'));var BPromise=require(_0x13f7('0x7'));var Mustache=require(_0x13f7('0x8'));var util=require(_0x13f7('0x9'));var path=require('path');var sox=require(_0x13f7('0xa'));var csv=require('to-csv');var ejs=require(_0x13f7('0xb'));var fs=require('fs');var _=require(_0x13f7('0xc'));var squel=require(_0x13f7('0xd'));var crypto=require('crypto');var jsforce=require(_0x13f7('0xe'));var deskjs=require(_0x13f7('0xf'));var toCsv=require(_0x13f7('0x10'));var querystring=require('querystring');var Papa=require(_0x13f7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x13f7('0x12'));var as=require(_0x13f7('0x13'));var hardwareService=require(_0x13f7('0x14'));var logger=require(_0x13f7('0x15'))(_0x13f7('0x16'));var utils=require(_0x13f7('0x17'));var config=require(_0x13f7('0x18'));var licenseUtil=require(_0x13f7('0x19'));var db=require(_0x13f7('0x1a'))['db'];function respondWithStatusCode(_0x390fd8,_0x571ab2){_0x571ab2=_0x571ab2||0xcc;return function(_0x774c0a){if(_0x774c0a){return _0x390fd8[_0x13f7('0x1b')](_0x571ab2);}return _0x390fd8['status'](_0x571ab2)['end']();};}function respondWithResult(_0x40dfd3,_0x42ecf1){_0x42ecf1=_0x42ecf1||0xc8;return function(_0x5ecc1c){if(_0x5ecc1c){return _0x40dfd3['status'](_0x42ecf1)[_0x13f7('0x1c')](_0x5ecc1c);}};}function respondWithFilteredResult(_0x57a432,_0x324052){return function(_0x559156){if(_0x559156){var _0xd87f1=_0x559156[_0x13f7('0x1d')],_0x2745cc=_0x324052[_0x13f7('0x1e')],_0x44f5da=_0x324052['offset']+_0x324052['limit'],_0x5838a7;if(_0x44f5da>=_0xd87f1){_0x44f5da=_0xd87f1;_0x5838a7=0xc8;}else{_0x5838a7=0xce;}_0x57a432['status'](_0x5838a7);return _0x57a432[_0x13f7('0x1f')](_0x13f7('0x20'),_0x2745cc+'-'+_0x44f5da+'/'+_0xd87f1)[_0x13f7('0x1c')](_0x559156);}return null;};}function patchUpdates(_0x4ac8b3){return function(_0x5d0ca7){try{jsonpatch[_0x13f7('0x21')](_0x5d0ca7,_0x4ac8b3,!![]);}catch(_0x4c8e3f){return BPromise[_0x13f7('0x22')](_0x4c8e3f);}return _0x5d0ca7['save']();};}function saveUpdates(_0x129dd6,_0x532493){return function(_0x4ea5dc){if(_0x4ea5dc){return _0x4ea5dc[_0x13f7('0x23')](_0x129dd6)[_0x13f7('0x24')](function(_0x316994){return _0x316994;});}return null;};}function removeEntity(_0x4e325d,_0x22c930){return function(_0x4b475a){if(_0x4b475a){return _0x4b475a[_0x13f7('0x25')]()[_0x13f7('0x24')](function(){_0x4e325d['status'](0xcc)[_0x13f7('0x26')]();});}};}function handleEntityNotFound(_0x4ed019,_0x2372d9){return function(_0x5b04ac){if(!_0x5b04ac){_0x4ed019['sendStatus'](0x194);}return _0x5b04ac;};}function handleError(_0x51113a,_0x31bf1d){_0x31bf1d=_0x31bf1d||0x1f4;return function(_0x34d562){logger['error'](_0x34d562[_0x13f7('0x27')]);if(_0x34d562[_0x13f7('0x28')]){delete _0x34d562[_0x13f7('0x28')];}_0x51113a[_0x13f7('0x29')](_0x31bf1d)['send'](_0x34d562);};}exports[_0x13f7('0x2a')]=function(_0x2230bc,_0x3b2760){var _0xc2302={},_0x45c346={},_0x4f3135={'count':0x0,'rows':[]};var _0xd432a0=_[_0x13f7('0x2b')](db['MailTransferReport'][_0x13f7('0x2c')],function(_0x24ba9b){return{'name':_0x24ba9b['fieldName'],'type':_0x24ba9b['type'][_0x13f7('0x2d')]};});_0x45c346[_0x13f7('0x2e')]=_[_0x13f7('0x2b')](_0xd432a0,'name');_0x45c346['query']=_[_0x13f7('0x2f')](_0x2230bc[_0x13f7('0x30')]);_0x45c346['filters']=_['intersection'](_0x45c346[_0x13f7('0x2e')],_0x45c346[_0x13f7('0x30')]);_0xc2302[_0x13f7('0x31')]=_[_0x13f7('0x32')](_0x45c346[_0x13f7('0x2e')],qs[_0x13f7('0x33')](_0x2230bc[_0x13f7('0x30')][_0x13f7('0x33')]));_0xc2302[_0x13f7('0x31')]=_0xc2302[_0x13f7('0x31')]['length']?_0xc2302['attributes']:_0x45c346[_0x13f7('0x2e')];if(!_0x2230bc['query'][_0x13f7('0x34')](_0x13f7('0x35'))){_0xc2302[_0x13f7('0x36')]=qs[_0x13f7('0x36')](_0x2230bc['query'][_0x13f7('0x36')]);_0xc2302['offset']=qs['offset'](_0x2230bc[_0x13f7('0x30')][_0x13f7('0x1e')]);}_0xc2302[_0x13f7('0x37')]=qs[_0x13f7('0x38')](_0x2230bc[_0x13f7('0x30')][_0x13f7('0x38')]);_0xc2302[_0x13f7('0x39')]=qs[_0x13f7('0x3a')](_[_0x13f7('0x3b')](_0x2230bc['query'],_0x45c346[_0x13f7('0x3a')]),_0xd432a0);if(_0x2230bc['query'][_0x13f7('0x3c')]){_0xc2302['where']=_['merge'](_0xc2302[_0x13f7('0x39')],{'$or':_['map'](_0xd432a0,function(_0x268f1b){if(_0x268f1b[_0x13f7('0x3d')]!=='VIRTUAL'){var _0x4f8649={};_0x4f8649[_0x268f1b[_0x13f7('0x28')]]={'$like':'%'+_0x2230bc[_0x13f7('0x30')][_0x13f7('0x3c')]+'%'};return _0x4f8649;}})});}_0xc2302=_[_0x13f7('0x3e')]({},_0xc2302,_0x2230bc[_0x13f7('0x3f')]);var _0x1b9d6e={'where':_0xc2302['where']};return db[_0x13f7('0x40')][_0x13f7('0x1d')](_0x1b9d6e)[_0x13f7('0x24')](function(_0x236568){_0x4f3135[_0x13f7('0x1d')]=_0x236568;if(_0x2230bc[_0x13f7('0x30')][_0x13f7('0x41')]){_0xc2302[_0x13f7('0x42')]=[{'all':!![]}];}return db[_0x13f7('0x40')][_0x13f7('0x43')](_0xc2302);})[_0x13f7('0x24')](function(_0x2ce8f6){_0x4f3135[_0x13f7('0x44')]=_0x2ce8f6;return _0x4f3135;})['then'](respondWithFilteredResult(_0x3b2760,_0xc2302))[_0x13f7('0x45')](handleError(_0x3b2760,null));};exports[_0x13f7('0x46')]=function(_0x58b03b,_0x2c7005){var _0x2f6320={'raw':!![],'where':{'id':_0x58b03b['params']['id']}},_0x3bb02d={};_0x3bb02d['model']=_['keys'](db[_0x13f7('0x40')]['rawAttributes']);_0x3bb02d['query']=_[_0x13f7('0x2f')](_0x58b03b[_0x13f7('0x30')]);_0x3bb02d['filters']=_[_0x13f7('0x32')](_0x3bb02d[_0x13f7('0x2e')],_0x3bb02d[_0x13f7('0x30')]);_0x2f6320['attributes']=_['intersection'](_0x3bb02d[_0x13f7('0x2e')],qs[_0x13f7('0x33')](_0x58b03b[_0x13f7('0x30')][_0x13f7('0x33')]));_0x2f6320[_0x13f7('0x31')]=_0x2f6320['attributes'][_0x13f7('0x47')]?_0x2f6320[_0x13f7('0x31')]:_0x3bb02d[_0x13f7('0x2e')];if(_0x58b03b['query']['includeAll']){_0x2f6320[_0x13f7('0x42')]=[{'all':!![]}];}_0x2f6320=_[_0x13f7('0x3e')]({},_0x2f6320,_0x58b03b[_0x13f7('0x3f')]);return db[_0x13f7('0x40')]['find'](_0x2f6320)[_0x13f7('0x24')](handleEntityNotFound(_0x2c7005,null))[_0x13f7('0x24')](respondWithResult(_0x2c7005,null))['catch'](handleError(_0x2c7005,null));};exports[_0x13f7('0x48')]=function(_0x2989c0,_0x10acf1){return db[_0x13f7('0x40')]['create'](_0x2989c0['body'],{})['then'](respondWithResult(_0x10acf1,0xc9))[_0x13f7('0x45')](handleError(_0x10acf1,null));};exports['update']=function(_0x2ad4c8,_0x3087bc){if(_0x2ad4c8['body']['id']){delete _0x2ad4c8[_0x13f7('0x49')]['id'];}return db[_0x13f7('0x40')]['find']({'where':{'id':_0x2ad4c8[_0x13f7('0x4a')]['id']}})[_0x13f7('0x24')](handleEntityNotFound(_0x3087bc,null))[_0x13f7('0x24')](saveUpdates(_0x2ad4c8[_0x13f7('0x49')],null))[_0x13f7('0x24')](respondWithResult(_0x3087bc,null))[_0x13f7('0x45')](handleError(_0x3087bc,null));};exports[_0x13f7('0x25')]=function(_0x477c44,_0x6b39ac){return db[_0x13f7('0x40')][_0x13f7('0x4b')]({'where':{'id':_0x477c44[_0x13f7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6b39ac,null))['then'](removeEntity(_0x6b39ac,null))[_0x13f7('0x45')](handleError(_0x6b39ac,null));};exports[_0x13f7('0x4c')]=function(_0x5e8e01,_0x9da8f2){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x9da8f2,null))['catch'](handleError(_0x9da8f2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 200e59d..a025900 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 _0x7938=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer'];(function(_0x5c30fc,_0x376fa4){var _0x321b98=function(_0x58af34){while(--_0x58af34){_0x5c30fc['push'](_0x5c30fc['shift']());}};_0x321b98(++_0x376fa4);}(_0x7938,0x1e1));var _0x8793=function(_0x53ea76,_0x444156){_0x53ea76=_0x53ea76-0x0;var _0x4eb2aa=_0x7938[_0x53ea76];return _0x4eb2aa;};'use strict';var _=require(_0x8793('0x0'));var util=require(_0x8793('0x1'));var logger=require(_0x8793('0x2'))('api');var moment=require(_0x8793('0x3'));var BPromise=require(_0x8793('0x4'));var rp=require(_0x8793('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8793('0x6'));var attributes=require(_0x8793('0x7'));module[_0x8793('0x8')]=function(_0x1ec154,_0x52cc3e){return _0x1ec154['define'](_0x8793('0x9'),attributes,{'tableName':_0x8793('0xa'),'paranoid':![],'indexes':[{'name':_0x8793('0xb'),'fields':[_0x8793('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe884=['define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x5dd0d0,_0x213a28){var _0x194c9f=function(_0x43cccf){while(--_0x43cccf){_0x5dd0d0['push'](_0x5dd0d0['shift']());}};_0x194c9f(++_0x213a28);}(_0xe884,0x1bc));var _0x4e88=function(_0x153fb4,_0x5ab8c8){_0x153fb4=_0x153fb4-0x0;var _0x373974=_0xe884[_0x153fb4];return _0x373974;};'use strict';var _=require('lodash');var util=require(_0x4e88('0x0'));var logger=require(_0x4e88('0x1'))(_0x4e88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e88('0x4'));var config=require(_0x4e88('0x5'));var attributes=require(_0x4e88('0x6'));module['exports']=function(_0x49ce20,_0x4949a4){return _0x49ce20[_0x4e88('0x7')](_0x4e88('0x8'),attributes,{'tableName':_0x4e88('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4e88('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index c253b9b..8f3ad5e 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 _0x82ce=['code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x29371e,_0xb5100c){var _0x244623=function(_0x4303ed){while(--_0x4303ed){_0x29371e['push'](_0x29371e['shift']());}};_0x244623(++_0xb5100c);}(_0x82ce,0x140));var _0xe82c=function(_0x2c09b3,_0x40ee89){_0x2c09b3=_0x2c09b3-0x0;var _0x5d438f=_0x82ce[_0x2c09b3];return _0x5d438f;};'use strict';var _=require(_0xe82c('0x0'));var util=require(_0xe82c('0x1'));var moment=require(_0xe82c('0x2'));var BPromise=require(_0xe82c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe82c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe82c('0x5'))(_0xe82c('0x6'));var config=require(_0xe82c('0x7'));var jayson=require(_0xe82c('0x8'));var client=jayson['client'][_0xe82c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1da4e8,_0x3baef6,_0x3508a6){return new BPromise(function(_0x3eb47b,_0x3a82bc){return client['request'](_0x1da4e8,_0x3508a6)[_0xe82c('0xa')](function(_0x563822){logger[_0xe82c('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x3baef6,_0xe82c('0xc'));logger[_0xe82c('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3baef6,_0xe82c('0xc'),JSON[_0xe82c('0xe')](_0x563822));if(_0x563822[_0xe82c('0xf')]){if(_0x563822['error'][_0xe82c('0x10')]===0x1f4){logger['error'](_0xe82c('0x11'),_0x3baef6,_0x563822[_0xe82c('0xf')][_0xe82c('0x12')]);return _0x3a82bc(_0x563822[_0xe82c('0xf')]['message']);}logger[_0xe82c('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3baef6,_0x563822['error'][_0xe82c('0x12')]);return _0x3eb47b(_0x563822[_0xe82c('0xf')][_0xe82c('0x12')]);}else{logger[_0xe82c('0xb')](_0xe82c('0x11'),_0x3baef6,_0xe82c('0xc'));_0x3eb47b(_0x563822[_0xe82c('0x13')]['message']);}})[_0xe82c('0x14')](function(_0x4c3178){logger['error'](_0xe82c('0x11'),_0x3baef6,_0x4c3178);_0x3a82bc(_0x4c3178);});});} \ No newline at end of file +var _0xcc02=['../../config/environment','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x573880,_0x51363d){var _0x191a2c=function(_0x1f7af8){while(--_0x1f7af8){_0x573880['push'](_0x573880['shift']());}};_0x191a2c(++_0x51363d);}(_0xcc02,0x16c));var _0x2cc0=function(_0x1fa51d,_0x271b8d){_0x1fa51d=_0x1fa51d-0x0;var _0x5d3431=_0xcc02[_0x1fa51d];return _0x5d3431;};'use strict';var _=require(_0x2cc0('0x0'));var util=require(_0x2cc0('0x1'));var moment=require(_0x2cc0('0x2'));var BPromise=require(_0x2cc0('0x3'));var rs=require(_0x2cc0('0x4'));var fs=require('fs');var Redis=require(_0x2cc0('0x5'));var db=require(_0x2cc0('0x6'))['db'];var utils=require(_0x2cc0('0x7'));var logger=require(_0x2cc0('0x8'))(_0x2cc0('0x9'));var config=require(_0x2cc0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2cc0('0xb')][_0x2cc0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22c15b,_0x1a3439,_0x417167){return new BPromise(function(_0x566543,_0x3bac73){return client['request'](_0x22c15b,_0x417167)[_0x2cc0('0xd')](function(_0x280180){logger[_0x2cc0('0xe')](_0x2cc0('0xf'),_0x1a3439,_0x2cc0('0x10'));logger['debug'](_0x2cc0('0x11'),_0x1a3439,_0x2cc0('0x10'),JSON[_0x2cc0('0x12')](_0x280180));if(_0x280180[_0x2cc0('0x13')]){if(_0x280180[_0x2cc0('0x13')]['code']===0x1f4){logger[_0x2cc0('0x13')](_0x2cc0('0xf'),_0x1a3439,_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);return _0x3bac73(_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);}logger[_0x2cc0('0x13')](_0x2cc0('0xf'),_0x1a3439,_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);return _0x566543(_0x280180[_0x2cc0('0x13')][_0x2cc0('0x14')]);}else{logger['info'](_0x2cc0('0xf'),_0x1a3439,_0x2cc0('0x10'));_0x566543(_0x280180[_0x2cc0('0x15')][_0x2cc0('0x14')]);}})['catch'](function(_0x8aec6){logger[_0x2cc0('0x13')](_0x2cc0('0xf'),_0x1a3439,_0x8aec6);_0x3bac73(_0x8aec6);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 131d89a..0daad93 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 _0x6b1f=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','show','post','create','put','update','delete','/:id','destroy'];(function(_0x19d381,_0x500157){var _0x25908a=function(_0x435889){while(--_0x435889){_0x19d381['push'](_0x19d381['shift']());}};_0x25908a(++_0x500157);}(_0x6b1f,0x1cd));var _0xf6b1=function(_0x1fb88a,_0x4e2070){_0x1fb88a=_0x1fb88a-0x0;var _0x14a845=_0x6b1f[_0x1fb88a];return _0x14a845;};'use strict';var multer=require(_0xf6b1('0x0'));var util=require(_0xf6b1('0x1'));var path=require(_0xf6b1('0x2'));var timeout=require(_0xf6b1('0x3'));var express=require(_0xf6b1('0x4'));var router=express['Router']();var auth=require(_0xf6b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b1('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0x8')]);router[_0xf6b1('0x9')]('/describe',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0xa')]);router[_0xf6b1('0x9')]('/:id',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0xb')]);router[_0xf6b1('0xc')]('/',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0xd')]);router[_0xf6b1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf6b1('0xf')]);router[_0xf6b1('0x10')](_0xf6b1('0x11'),auth[_0xf6b1('0x7')](),controller[_0xf6b1('0x12')]);module[_0xf6b1('0x13')]=router; \ No newline at end of file +var _0xb583=['Router','../../components/interaction/service','./memberReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb583,0x7b));var _0x3b58=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb583[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0x3b58('0x0'));var path=require('path');var timeout=require(_0x3b58('0x1'));var express=require(_0x3b58('0x2'));var router=express[_0x3b58('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3b58('0x4'));var config=require('../../config/environment');var controller=require(_0x3b58('0x5'));router[_0x3b58('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3b58('0x7'),auth[_0x3b58('0x8')](),controller[_0x3b58('0x9')]);router[_0x3b58('0x6')](_0x3b58('0xa'),auth[_0x3b58('0x8')](),controller[_0x3b58('0xb')]);router[_0x3b58('0xc')]('/',auth[_0x3b58('0x8')](),controller[_0x3b58('0xd')]);router[_0x3b58('0xe')](_0x3b58('0xa'),auth[_0x3b58('0x8')](),controller[_0x3b58('0xf')]);router[_0x3b58('0x10')]('/:id',auth[_0x3b58('0x8')](),controller['destroy']);module[_0x3b58('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f3c6c4a..0fb1939 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 _0xa3ab=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]'];(function(_0x2e35cb,_0x40731e){var _0x34259c=function(_0x36a19d){while(--_0x36a19d){_0x2e35cb['push'](_0x2e35cb['shift']());}};_0x34259c(++_0x40731e);}(_0xa3ab,0x1a4));var _0xba3a=function(_0x5f32f0,_0x1d36b4){_0x5f32f0=_0x5f32f0-0x0;var _0x5acfb0=_0xa3ab[_0x5f32f0];return _0x5acfb0;};'use strict';var Sequelize=require(_0xba3a('0x0'));var moment=require(_0xba3a('0x1'));module[_0xba3a('0x2')]={'channel':{'type':Sequelize[_0xba3a('0x3')]},'membername':{'type':Sequelize[_0xba3a('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xba3a('0x3')],'defaultValue':_0xba3a('0x4'),'comment':_0xba3a('0x5')},'duration':{'type':Sequelize[_0xba3a('0x6')]},'enterAt':{'type':Sequelize[_0xba3a('0x7')]},'exitAt':{'type':Sequelize[_0xba3a('0x7')],'set':function(_0x3b6562){var _0x503ec6=moment(_0x3b6562);var _0x4a862a=moment(this[_0xba3a('0x8')](_0xba3a('0x9')));var _0x45bc33=_0x503ec6[_0xba3a('0xa')](_0x4a862a,_0xba3a('0xb'));this[_0xba3a('0xc')](_0xba3a('0xd'),_0x3b6562);this[_0xba3a('0xc')](_0xba3a('0xe'),_0x45bc33||null);}},'data1':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0xf')},'data2':{'type':Sequelize[_0xba3a('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0x10')},'data4':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0x11')},'data5':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0x12')},'role':{'type':Sequelize[_0xba3a('0x3')]},'internal':{'type':Sequelize[_0xba3a('0x6')]},'uniqueid':{'type':Sequelize[_0xba3a('0x3')]}}; \ No newline at end of file +var _0x2499=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','setDataValue','exitAt','duration'];(function(_0x390b35,_0x4b80f1){var _0x400533=function(_0xf607c1){while(--_0xf607c1){_0x390b35['push'](_0x390b35['shift']());}};_0x400533(++_0x4b80f1);}(_0x2499,0x189));var _0x9249=function(_0x5888e7,_0x4ab90f){_0x5888e7=_0x5888e7-0x0;var _0x5da1f2=_0x2499[_0x5888e7];return _0x5da1f2;};'use strict';var Sequelize=require(_0x9249('0x0'));var moment=require(_0x9249('0x1'));module[_0x9249('0x2')]={'channel':{'type':Sequelize[_0x9249('0x3')]},'membername':{'type':Sequelize[_0x9249('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9249('0x3')],'defaultValue':_0x9249('0x4'),'comment':_0x9249('0x5')},'duration':{'type':Sequelize[_0x9249('0x6')]},'enterAt':{'type':Sequelize[_0x9249('0x7')]},'exitAt':{'type':Sequelize[_0x9249('0x7')],'set':function(_0x263e89){var _0x27d36b=moment(_0x263e89);var _0x12031e=moment(this[_0x9249('0x8')]('enterAt'));var _0x9631c4=_0x27d36b['diff'](_0x12031e,'seconds');this[_0x9249('0x9')](_0x9249('0xa'),_0x263e89);this[_0x9249('0x9')](_0x9249('0xb'),_0x9631c4||null);}},'data1':{'type':Sequelize[_0x9249('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9249('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x9249('0x3')],'comment':_0x9249('0xc')},'data4':{'type':Sequelize[_0x9249('0x3')],'comment':_0x9249('0xd')},'data5':{'type':Sequelize[_0x9249('0x3')],'comment':_0x9249('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9249('0x6')]},'uniqueid':{'type':Sequelize[_0x9249('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 5d812a9..c33556a 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 _0xb648=['model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','MemberReport','rawAttributes','fieldName','type','key'];(function(_0x5dd9d2,_0x56ebd9){var _0x1ab0ac=function(_0x4b2d39){while(--_0x4b2d39){_0x5dd9d2['push'](_0x5dd9d2['shift']());}};_0x1ab0ac(++_0x56ebd9);}(_0xb648,0xaa));var _0x8b64=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0xb648[_0xf80b3];return _0x10c489;};'use strict';var pdf=require(_0x8b64('0x0'));var emlformat=require(_0x8b64('0x1'));var rimraf=require(_0x8b64('0x2'));var zipdir=require(_0x8b64('0x3'));var jsonpatch=require(_0x8b64('0x4'));var rp=require(_0x8b64('0x5'));var moment=require(_0x8b64('0x6'));var BPromise=require(_0x8b64('0x7'));var Mustache=require(_0x8b64('0x8'));var util=require(_0x8b64('0x9'));var path=require('path');var sox=require(_0x8b64('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8b64('0xb'));var crypto=require(_0x8b64('0xc'));var jsforce=require(_0x8b64('0xd'));var deskjs=require(_0x8b64('0xe'));var toCsv=require(_0x8b64('0xf'));var querystring=require(_0x8b64('0x10'));var Papa=require(_0x8b64('0x11'));var Redis=require('ioredis');var authService=require(_0x8b64('0x12'));var qs=require(_0x8b64('0x13'));var as=require(_0x8b64('0x14'));var hardwareService=require(_0x8b64('0x15'));var logger=require(_0x8b64('0x16'))('api');var utils=require(_0x8b64('0x17'));var config=require(_0x8b64('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b64('0x19'))['db'];function respondWithStatusCode(_0x278f43,_0x1246fc){_0x1246fc=_0x1246fc||0xcc;return function(_0x2630fc){if(_0x2630fc){return _0x278f43[_0x8b64('0x1a')](_0x1246fc);}return _0x278f43[_0x8b64('0x1b')](_0x1246fc)[_0x8b64('0x1c')]();};}function respondWithResult(_0x4828f8,_0x458232){_0x458232=_0x458232||0xc8;return function(_0x299090){if(_0x299090){return _0x4828f8[_0x8b64('0x1b')](_0x458232)[_0x8b64('0x1d')](_0x299090);}};}function respondWithFilteredResult(_0x57d106,_0x5baa0d){return function(_0x3df19b){if(_0x3df19b){var _0x53c4b9=_0x3df19b[_0x8b64('0x1e')],_0x5dc10e=_0x5baa0d[_0x8b64('0x1f')],_0x280414=_0x5baa0d[_0x8b64('0x1f')]+_0x5baa0d[_0x8b64('0x20')],_0x1bcdc0;if(_0x280414>=_0x53c4b9){_0x280414=_0x53c4b9;_0x1bcdc0=0xc8;}else{_0x1bcdc0=0xce;}_0x57d106[_0x8b64('0x1b')](_0x1bcdc0);return _0x57d106[_0x8b64('0x21')](_0x8b64('0x22'),_0x5dc10e+'-'+_0x280414+'/'+_0x53c4b9)[_0x8b64('0x1d')](_0x3df19b);}return null;};}function patchUpdates(_0x1b767d){return function(_0x2e067f){try{jsonpatch[_0x8b64('0x23')](_0x2e067f,_0x1b767d,!![]);}catch(_0x36dccb){return BPromise['reject'](_0x36dccb);}return _0x2e067f[_0x8b64('0x24')]();};}function saveUpdates(_0x322224,_0x2d0998){return function(_0x36fad5){if(_0x36fad5){return _0x36fad5[_0x8b64('0x25')](_0x322224)['then'](function(_0x2e4451){return _0x2e4451;});}return null;};}function removeEntity(_0x1649a6,_0x5aa276){return function(_0x216bb0){if(_0x216bb0){return _0x216bb0[_0x8b64('0x26')]()[_0x8b64('0x27')](function(){_0x1649a6[_0x8b64('0x1b')](0xcc)[_0x8b64('0x1c')]();});}};}function handleEntityNotFound(_0x4e70c5,_0x3a7474){return function(_0x120c93){if(!_0x120c93){_0x4e70c5[_0x8b64('0x1a')](0x194);}return _0x120c93;};}function handleError(_0x236123,_0x7c500a){_0x7c500a=_0x7c500a||0x1f4;return function(_0x8b3671){logger[_0x8b64('0x28')](_0x8b3671[_0x8b64('0x29')]);if(_0x8b3671[_0x8b64('0x2a')]){delete _0x8b3671[_0x8b64('0x2a')];}_0x236123[_0x8b64('0x1b')](_0x7c500a)[_0x8b64('0x2b')](_0x8b3671);};}exports['index']=function(_0x2cd1b1,_0x18ca17){var _0x54f4c0={},_0x5028cf={},_0x307c78={'count':0x0,'rows':[]};var _0xa3bc4a=_['map'](db[_0x8b64('0x2c')][_0x8b64('0x2d')],function(_0x438a68){return{'name':_0x438a68[_0x8b64('0x2e')],'type':_0x438a68[_0x8b64('0x2f')][_0x8b64('0x30')]};});_0x5028cf[_0x8b64('0x31')]=_[_0x8b64('0x32')](_0xa3bc4a,_0x8b64('0x2a'));_0x5028cf['query']=_[_0x8b64('0x33')](_0x2cd1b1['query']);_0x5028cf[_0x8b64('0x34')]=_[_0x8b64('0x35')](_0x5028cf['model'],_0x5028cf[_0x8b64('0x36')]);_0x54f4c0[_0x8b64('0x37')]=_['intersection'](_0x5028cf[_0x8b64('0x31')],qs[_0x8b64('0x38')](_0x2cd1b1['query'][_0x8b64('0x38')]));_0x54f4c0[_0x8b64('0x37')]=_0x54f4c0[_0x8b64('0x37')][_0x8b64('0x39')]?_0x54f4c0[_0x8b64('0x37')]:_0x5028cf[_0x8b64('0x31')];if(!_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x3a')](_0x8b64('0x3b'))){_0x54f4c0[_0x8b64('0x20')]=qs[_0x8b64('0x20')](_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x20')]);_0x54f4c0[_0x8b64('0x1f')]=qs[_0x8b64('0x1f')](_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x1f')]);}_0x54f4c0[_0x8b64('0x3c')]=qs['sort'](_0x2cd1b1[_0x8b64('0x36')]['sort']);_0x54f4c0[_0x8b64('0x3d')]=qs[_0x8b64('0x34')](_[_0x8b64('0x3e')](_0x2cd1b1['query'],_0x5028cf[_0x8b64('0x34')]),_0xa3bc4a);if(_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x3f')]){_0x54f4c0[_0x8b64('0x3d')]=_[_0x8b64('0x40')](_0x54f4c0[_0x8b64('0x3d')],{'$or':_[_0x8b64('0x32')](_0xa3bc4a,function(_0x570b45){if(_0x570b45[_0x8b64('0x2f')]!==_0x8b64('0x41')){var _0x5cfb62={};_0x5cfb62[_0x570b45[_0x8b64('0x2a')]]={'$like':'%'+_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x3f')]+'%'};return _0x5cfb62;}})});}_0x54f4c0=_[_0x8b64('0x40')]({},_0x54f4c0,_0x2cd1b1[_0x8b64('0x42')]);var _0x350b69={'where':_0x54f4c0['where']};return db[_0x8b64('0x2c')][_0x8b64('0x1e')](_0x350b69)[_0x8b64('0x27')](function(_0x454084){_0x307c78['count']=_0x454084;if(_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x43')]){_0x54f4c0['include']=[{'all':!![]}];}return db[_0x8b64('0x2c')]['findAll'](_0x54f4c0);})[_0x8b64('0x27')](function(_0x29742c){_0x307c78['rows']=_0x29742c;return _0x307c78;})['then'](respondWithFilteredResult(_0x18ca17,_0x54f4c0))['catch'](handleError(_0x18ca17,null));};exports['show']=function(_0xf7b076,_0x1cede0){var _0x488ee0={'raw':!![],'where':{'id':_0xf7b076[_0x8b64('0x44')]['id']}},_0x50593c={};_0x50593c[_0x8b64('0x31')]=_[_0x8b64('0x33')](db[_0x8b64('0x2c')]['rawAttributes']);_0x50593c[_0x8b64('0x36')]=_[_0x8b64('0x33')](_0xf7b076['query']);_0x50593c[_0x8b64('0x34')]=_[_0x8b64('0x35')](_0x50593c['model'],_0x50593c[_0x8b64('0x36')]);_0x488ee0[_0x8b64('0x37')]=_[_0x8b64('0x35')](_0x50593c[_0x8b64('0x31')],qs[_0x8b64('0x38')](_0xf7b076[_0x8b64('0x36')][_0x8b64('0x38')]));_0x488ee0[_0x8b64('0x37')]=_0x488ee0[_0x8b64('0x37')][_0x8b64('0x39')]?_0x488ee0[_0x8b64('0x37')]:_0x50593c[_0x8b64('0x31')];if(_0xf7b076[_0x8b64('0x36')]['includeAll']){_0x488ee0['include']=[{'all':!![]}];}_0x488ee0=_[_0x8b64('0x40')]({},_0x488ee0,_0xf7b076['options']);return db[_0x8b64('0x2c')][_0x8b64('0x45')](_0x488ee0)[_0x8b64('0x27')](handleEntityNotFound(_0x1cede0,null))[_0x8b64('0x27')](respondWithResult(_0x1cede0,null))[_0x8b64('0x46')](handleError(_0x1cede0,null));};exports[_0x8b64('0x47')]=function(_0x5de174,_0x4995ce){return db[_0x8b64('0x2c')][_0x8b64('0x47')](_0x5de174[_0x8b64('0x48')],{})[_0x8b64('0x27')](respondWithResult(_0x4995ce,0xc9))[_0x8b64('0x46')](handleError(_0x4995ce,null));};exports[_0x8b64('0x25')]=function(_0x39966c,_0x1b9a7a){if(_0x39966c[_0x8b64('0x48')]['id']){delete _0x39966c[_0x8b64('0x48')]['id'];}return db[_0x8b64('0x2c')][_0x8b64('0x45')]({'where':{'id':_0x39966c[_0x8b64('0x44')]['id']}})[_0x8b64('0x27')](handleEntityNotFound(_0x1b9a7a,null))[_0x8b64('0x27')](saveUpdates(_0x39966c[_0x8b64('0x48')],null))[_0x8b64('0x27')](respondWithResult(_0x1b9a7a,null))[_0x8b64('0x46')](handleError(_0x1b9a7a,null));};exports[_0x8b64('0x26')]=function(_0x110def,_0x59ce93){return db['MemberReport'][_0x8b64('0x45')]({'where':{'id':_0x110def['params']['id']}})[_0x8b64('0x27')](handleEntityNotFound(_0x59ce93,null))[_0x8b64('0x27')](removeEntity(_0x59ce93,null))['catch'](handleError(_0x59ce93,null));};exports['describe']=function(_0x51170b,_0x5d9037){return db[_0x8b64('0x2c')]['describe']()['then'](respondWithResult(_0x5d9037,null))[_0x8b64('0x46')](handleError(_0x5d9037,null));}; \ No newline at end of file +var _0xf48f=['lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','then','destroy','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x3313fa,_0x2355af){var _0x324a4e=function(_0xd1e457){while(--_0xd1e457){_0x3313fa['push'](_0x3313fa['shift']());}};_0x324a4e(++_0x2355af);}(_0xf48f,0x87));var _0xff48=function(_0x4111f7,_0x186e09){_0x4111f7=_0x4111f7-0x0;var _0x2c4bf9=_0xf48f[_0x4111f7];return _0x2c4bf9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff48('0x0'));var rimraf=require(_0xff48('0x1'));var zipdir=require(_0xff48('0x2'));var jsonpatch=require(_0xff48('0x3'));var rp=require(_0xff48('0x4'));var moment=require(_0xff48('0x5'));var BPromise=require(_0xff48('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff48('0x7'));var sox=require(_0xff48('0x8'));var csv=require(_0xff48('0x9'));var ejs=require(_0xff48('0xa'));var fs=require('fs');var _=require(_0xff48('0xb'));var squel=require('squel');var crypto=require(_0xff48('0xc'));var jsforce=require(_0xff48('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xff48('0x9'));var querystring=require(_0xff48('0xe'));var Papa=require(_0xff48('0xf'));var Redis=require('ioredis');var authService=require(_0xff48('0x10'));var qs=require(_0xff48('0x11'));var as=require(_0xff48('0x12'));var hardwareService=require(_0xff48('0x13'));var logger=require(_0xff48('0x14'))(_0xff48('0x15'));var utils=require(_0xff48('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xff48('0x17'));var db=require(_0xff48('0x18'))['db'];function respondWithStatusCode(_0x1dbff9,_0x4755e9){_0x4755e9=_0x4755e9||0xcc;return function(_0x5b0d58){if(_0x5b0d58){return _0x1dbff9[_0xff48('0x19')](_0x4755e9);}return _0x1dbff9[_0xff48('0x1a')](_0x4755e9)[_0xff48('0x1b')]();};}function respondWithResult(_0x5aed2a,_0x4c7a64){_0x4c7a64=_0x4c7a64||0xc8;return function(_0x3ebbd3){if(_0x3ebbd3){return _0x5aed2a['status'](_0x4c7a64)['json'](_0x3ebbd3);}};}function respondWithFilteredResult(_0x3e9740,_0x37c8c1){return function(_0x4b7f9b){if(_0x4b7f9b){var _0x29cbee=_0x4b7f9b[_0xff48('0x1c')],_0x827734=_0x37c8c1[_0xff48('0x1d')],_0x5dbd2f=_0x37c8c1['offset']+_0x37c8c1[_0xff48('0x1e')],_0x3d2990;if(_0x5dbd2f>=_0x29cbee){_0x5dbd2f=_0x29cbee;_0x3d2990=0xc8;}else{_0x3d2990=0xce;}_0x3e9740[_0xff48('0x1a')](_0x3d2990);return _0x3e9740[_0xff48('0x1f')](_0xff48('0x20'),_0x827734+'-'+_0x5dbd2f+'/'+_0x29cbee)[_0xff48('0x21')](_0x4b7f9b);}return null;};}function patchUpdates(_0x1251cd){return function(_0x1656e9){try{jsonpatch[_0xff48('0x22')](_0x1656e9,_0x1251cd,!![]);}catch(_0x29bf88){return BPromise['reject'](_0x29bf88);}return _0x1656e9['save']();};}function saveUpdates(_0x477851,_0x557846){return function(_0x5e5a65){if(_0x5e5a65){return _0x5e5a65['update'](_0x477851)[_0xff48('0x23')](function(_0x488376){return _0x488376;});}return null;};}function removeEntity(_0x54f03c,_0x36cc15){return function(_0x167f88){if(_0x167f88){return _0x167f88[_0xff48('0x24')]()[_0xff48('0x23')](function(){_0x54f03c[_0xff48('0x1a')](0xcc)[_0xff48('0x1b')]();});}};}function handleEntityNotFound(_0x19e4d8,_0x4558ea){return function(_0x5e5a43){if(!_0x5e5a43){_0x19e4d8[_0xff48('0x19')](0x194);}return _0x5e5a43;};}function handleError(_0x348eac,_0xf028cc){_0xf028cc=_0xf028cc||0x1f4;return function(_0x108a49){logger['error'](_0x108a49[_0xff48('0x25')]);if(_0x108a49['name']){delete _0x108a49[_0xff48('0x26')];}_0x348eac['status'](_0xf028cc)[_0xff48('0x27')](_0x108a49);};}exports[_0xff48('0x28')]=function(_0x2fdf58,_0x405353){var _0x230640={},_0x3c1510={},_0x2207db={'count':0x0,'rows':[]};var _0x38c25b=_[_0xff48('0x29')](db[_0xff48('0x2a')][_0xff48('0x2b')],function(_0x15c5c2){return{'name':_0x15c5c2[_0xff48('0x2c')],'type':_0x15c5c2[_0xff48('0x2d')]['key']};});_0x3c1510[_0xff48('0x2e')]=_[_0xff48('0x29')](_0x38c25b,_0xff48('0x26'));_0x3c1510[_0xff48('0x2f')]=_[_0xff48('0x30')](_0x2fdf58[_0xff48('0x2f')]);_0x3c1510[_0xff48('0x31')]=_[_0xff48('0x32')](_0x3c1510[_0xff48('0x2e')],_0x3c1510['query']);_0x230640['attributes']=_[_0xff48('0x32')](_0x3c1510['model'],qs['fields'](_0x2fdf58[_0xff48('0x2f')][_0xff48('0x33')]));_0x230640[_0xff48('0x34')]=_0x230640[_0xff48('0x34')][_0xff48('0x35')]?_0x230640[_0xff48('0x34')]:_0x3c1510[_0xff48('0x2e')];if(!_0x2fdf58[_0xff48('0x2f')][_0xff48('0x36')](_0xff48('0x37'))){_0x230640[_0xff48('0x1e')]=qs[_0xff48('0x1e')](_0x2fdf58[_0xff48('0x2f')][_0xff48('0x1e')]);_0x230640['offset']=qs[_0xff48('0x1d')](_0x2fdf58[_0xff48('0x2f')][_0xff48('0x1d')]);}_0x230640[_0xff48('0x38')]=qs[_0xff48('0x39')](_0x2fdf58['query'][_0xff48('0x39')]);_0x230640[_0xff48('0x3a')]=qs['filters'](_['pick'](_0x2fdf58[_0xff48('0x2f')],_0x3c1510['filters']),_0x38c25b);if(_0x2fdf58['query'][_0xff48('0x3b')]){_0x230640[_0xff48('0x3a')]=_[_0xff48('0x3c')](_0x230640[_0xff48('0x3a')],{'$or':_['map'](_0x38c25b,function(_0x31311d){if(_0x31311d[_0xff48('0x2d')]!==_0xff48('0x3d')){var _0x2bc024={};_0x2bc024[_0x31311d[_0xff48('0x26')]]={'$like':'%'+_0x2fdf58[_0xff48('0x2f')][_0xff48('0x3b')]+'%'};return _0x2bc024;}})});}_0x230640=_[_0xff48('0x3c')]({},_0x230640,_0x2fdf58['options']);var _0x3fb908={'where':_0x230640[_0xff48('0x3a')]};return db[_0xff48('0x2a')][_0xff48('0x1c')](_0x3fb908)[_0xff48('0x23')](function(_0x5496d5){_0x2207db[_0xff48('0x1c')]=_0x5496d5;if(_0x2fdf58['query'][_0xff48('0x3e')]){_0x230640[_0xff48('0x3f')]=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x230640);})[_0xff48('0x23')](function(_0x530c73){_0x2207db[_0xff48('0x40')]=_0x530c73;return _0x2207db;})[_0xff48('0x23')](respondWithFilteredResult(_0x405353,_0x230640))[_0xff48('0x41')](handleError(_0x405353,null));};exports[_0xff48('0x42')]=function(_0x5cc12e,_0x10f2a3){var _0xe81f12={'raw':!![],'where':{'id':_0x5cc12e['params']['id']}},_0xe28c7f={};_0xe28c7f[_0xff48('0x2e')]=_['keys'](db[_0xff48('0x2a')][_0xff48('0x2b')]);_0xe28c7f['query']=_[_0xff48('0x30')](_0x5cc12e[_0xff48('0x2f')]);_0xe28c7f[_0xff48('0x31')]=_['intersection'](_0xe28c7f[_0xff48('0x2e')],_0xe28c7f[_0xff48('0x2f')]);_0xe81f12[_0xff48('0x34')]=_['intersection'](_0xe28c7f[_0xff48('0x2e')],qs[_0xff48('0x33')](_0x5cc12e[_0xff48('0x2f')][_0xff48('0x33')]));_0xe81f12[_0xff48('0x34')]=_0xe81f12['attributes'][_0xff48('0x35')]?_0xe81f12['attributes']:_0xe28c7f[_0xff48('0x2e')];if(_0x5cc12e[_0xff48('0x2f')][_0xff48('0x3e')]){_0xe81f12[_0xff48('0x3f')]=[{'all':!![]}];}_0xe81f12=_['merge']({},_0xe81f12,_0x5cc12e['options']);return db[_0xff48('0x2a')][_0xff48('0x43')](_0xe81f12)['then'](handleEntityNotFound(_0x10f2a3,null))['then'](respondWithResult(_0x10f2a3,null))[_0xff48('0x41')](handleError(_0x10f2a3,null));};exports[_0xff48('0x44')]=function(_0x1425cc,_0x1b5532){return db[_0xff48('0x2a')]['create'](_0x1425cc[_0xff48('0x45')],{})['then'](respondWithResult(_0x1b5532,0xc9))[_0xff48('0x41')](handleError(_0x1b5532,null));};exports[_0xff48('0x46')]=function(_0x1eed4a,_0x1f7df6){if(_0x1eed4a['body']['id']){delete _0x1eed4a['body']['id'];}return db[_0xff48('0x2a')][_0xff48('0x43')]({'where':{'id':_0x1eed4a[_0xff48('0x47')]['id']}})[_0xff48('0x23')](handleEntityNotFound(_0x1f7df6,null))[_0xff48('0x23')](saveUpdates(_0x1eed4a[_0xff48('0x45')],null))[_0xff48('0x23')](respondWithResult(_0x1f7df6,null))[_0xff48('0x41')](handleError(_0x1f7df6,null));};exports[_0xff48('0x24')]=function(_0x97fc00,_0x432fae){return db[_0xff48('0x2a')][_0xff48('0x43')]({'where':{'id':_0x97fc00['params']['id']}})['then'](handleEntityNotFound(_0x432fae,null))[_0xff48('0x23')](removeEntity(_0x432fae,null))[_0xff48('0x41')](handleError(_0x432fae,null));};exports['describe']=function(_0x2df773,_0x2cc224){return db['MemberReport'][_0xff48('0x48')]()[_0xff48('0x23')](respondWithResult(_0x2cc224,null))[_0xff48('0x41')](handleError(_0x2cc224,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index bb3bcb6..84412b6 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 _0xb371=['exports','define','MemberReport','membername','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x18e340,_0x141c8d){var _0xd107c8=function(_0x365b75){while(--_0x365b75){_0x18e340['push'](_0x18e340['shift']());}};_0xd107c8(++_0x141c8d);}(_0xb371,0x74));var _0x1b37=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb371[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x1b37('0x0'));var util=require(_0x1b37('0x1'));var logger=require(_0x1b37('0x2'))('api');var moment=require(_0x1b37('0x3'));var BPromise=require(_0x1b37('0x4'));var rp=require(_0x1b37('0x5'));var fs=require('fs');var path=require(_0x1b37('0x6'));var rimraf=require(_0x1b37('0x7'));var config=require(_0x1b37('0x8'));var attributes=require(_0x1b37('0x9'));module[_0x1b37('0xa')]=function(_0x40eeea,_0x43b00e){return _0x40eeea[_0x1b37('0xb')](_0x1b37('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x1b37('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f39=['path','rimraf','../../config/environment','define','MemberReport','membername','interface','lodash','../../config/logger','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f39,0x1bf));var _0x98f3=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x8f39[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x98f3('0x0'));var util=require('util');var logger=require(_0x98f3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x98f3('0x2'));var rp=require(_0x98f3('0x3'));var fs=require('fs');var path=require(_0x98f3('0x4'));var rimraf=require(_0x98f3('0x5'));var config=require(_0x98f3('0x6'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x336dc2,_0xd006c9){return _0x336dc2[_0x98f3('0x7')](_0x98f3('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x98f3('0x9'),_0x98f3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 0ed66b8..a578fdf 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 _0xd6eb=['attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','where'];(function(_0x4bc706,_0x2fbaba){var _0x23bce4=function(_0x4f009b){while(--_0x4f009b){_0x4bc706['push'](_0x4bc706['shift']());}};_0x23bce4(++_0x2fbaba);}(_0xd6eb,0x17d));var _0xbd6e=function(_0x242df0,_0x258788){_0x242df0=_0x242df0-0x0;var _0x1d38d6=_0xd6eb[_0x242df0];return _0x1d38d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbd6e('0x0'));var rs=require(_0xbd6e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd6e('0x2'));var logger=require(_0xbd6e('0x3'))(_0xbd6e('0x4'));var config=require('../../config/environment');var jayson=require(_0xbd6e('0x5'));var client=jayson[_0xbd6e('0x6')][_0xbd6e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x331408,_0x1b08bd,_0x277738){return new BPromise(function(_0x24d288,_0x3ab695){return client[_0xbd6e('0x8')](_0x331408,_0x277738)[_0xbd6e('0x9')](function(_0x4b0865){logger[_0xbd6e('0xa')]('MemberReport,\x20%s,\x20%s',_0x1b08bd,'request\x20sent');logger[_0xbd6e('0xb')](_0xbd6e('0xc'),_0x1b08bd,_0xbd6e('0xd'),JSON[_0xbd6e('0xe')](_0x4b0865));if(_0x4b0865[_0xbd6e('0xf')]){if(_0x4b0865['error'][_0xbd6e('0x10')]===0x1f4){logger[_0xbd6e('0xf')](_0xbd6e('0x11'),_0x1b08bd,_0x4b0865[_0xbd6e('0xf')][_0xbd6e('0x12')]);return _0x3ab695(_0x4b0865['error'][_0xbd6e('0x12')]);}logger[_0xbd6e('0xf')]('MemberReport,\x20%s,\x20%s',_0x1b08bd,_0x4b0865[_0xbd6e('0xf')][_0xbd6e('0x12')]);return _0x24d288(_0x4b0865['error'][_0xbd6e('0x12')]);}else{logger[_0xbd6e('0xa')](_0xbd6e('0x11'),_0x1b08bd,_0xbd6e('0xd'));_0x24d288(_0x4b0865[_0xbd6e('0x13')][_0xbd6e('0x12')]);}})[_0xbd6e('0x14')](function(_0x5e28e6){logger[_0xbd6e('0xf')](_0xbd6e('0x11'),_0x1b08bd,_0x5e28e6);_0x3ab695(_0x5e28e6);});});}exports[_0xbd6e('0x15')]=function(_0x224f99){var _0x1bd9bc=this;return new Promise(function(_0x3e9de6,_0x238c07){return db[_0xbd6e('0x16')][_0xbd6e('0x17')]({'raw':_0x224f99[_0xbd6e('0x18')]?_0x224f99['options']['raw']===undefined?!![]:![]:!![],'where':_0x224f99[_0xbd6e('0x18')]?_0x224f99[_0xbd6e('0x18')][_0xbd6e('0x19')]||null:null,'attributes':_0x224f99[_0xbd6e('0x18')]?_0x224f99[_0xbd6e('0x18')][_0xbd6e('0x1a')]||null:null,'limit':_0x224f99[_0xbd6e('0x18')]?_0x224f99[_0xbd6e('0x18')][_0xbd6e('0x1b')]||null:null,'include':_0x224f99[_0xbd6e('0x18')]?_0x224f99['options'][_0xbd6e('0x1c')]?_[_0xbd6e('0x1d')](_0x224f99[_0xbd6e('0x18')]['include'],function(_0x30f6a2){return{'model':db[_0x30f6a2['model']],'as':_0x30f6a2['as'],'attributes':_0x30f6a2[_0xbd6e('0x1a')],'include':_0x30f6a2['include']?_[_0xbd6e('0x1d')](_0x30f6a2[_0xbd6e('0x1c')],function(_0x400e85){return{'model':db[_0x400e85[_0xbd6e('0x1e')]],'as':_0x400e85['as'],'attributes':_0x400e85[_0xbd6e('0x1a')],'include':_0x400e85[_0xbd6e('0x1c')]?_[_0xbd6e('0x1d')](_0x400e85[_0xbd6e('0x1c')],function(_0x5c34e8){return{'model':db[_0x5c34e8[_0xbd6e('0x1e')]],'as':_0x5c34e8['as'],'attributes':_0x5c34e8[_0xbd6e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f9993){logger[_0xbd6e('0xa')](_0xbd6e('0x15'),_0x224f99);logger[_0xbd6e('0xb')](_0xbd6e('0x15'),_0x224f99,JSON[_0xbd6e('0xe')](_0x2f9993));_0x3e9de6(_0x2f9993);})[_0xbd6e('0x14')](function(_0x44fa73){logger['error'](_0xbd6e('0x15'),_0x44fa73[_0xbd6e('0x12')],_0x224f99);_0x238c07(_0x1bd9bc[_0xbd6e('0xf')](0x1f4,_0x44fa73[_0xbd6e('0x12')]));});});};exports[_0xbd6e('0x1f')]=function(_0x441e7a){var _0x3737ce=this;return new Promise(function(_0x473534,_0x24b0c8){return db[_0xbd6e('0x16')][_0xbd6e('0x20')](_0x441e7a[_0xbd6e('0x21')],{'raw':_0x441e7a[_0xbd6e('0x18')]?_0x441e7a[_0xbd6e('0x18')][_0xbd6e('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x269e85){logger['info'](_0xbd6e('0x1f'),_0x441e7a);logger[_0xbd6e('0xb')](_0xbd6e('0x1f'),_0x441e7a,JSON[_0xbd6e('0xe')](_0x269e85));_0x473534(_0x269e85);})['catch'](function(_0x53aafa){logger[_0xbd6e('0xf')](_0xbd6e('0x1f'),_0x53aafa['message'],_0x441e7a);_0x24b0c8(_0x3737ce[_0xbd6e('0xf')](0x1f4,_0x53aafa[_0xbd6e('0x12')]));});});};exports[_0xbd6e('0x23')]=function(_0x1e6873){var _0x47a1d9=this;return new Promise(function(_0x4b3936,_0x5d1710){return db[_0xbd6e('0x16')][_0xbd6e('0x24')](_0x1e6873['body'],{'raw':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873['options']['where']||null:null,'attributes':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873[_0xbd6e('0x18')][_0xbd6e('0x1a')]||null:null,'limit':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873[_0xbd6e('0x18')][_0xbd6e('0x1b')]||null:null})[_0xbd6e('0x9')](function(_0x46f22d){logger['info'](_0xbd6e('0x23'),_0x1e6873);logger[_0xbd6e('0xb')](_0xbd6e('0x23'),_0x1e6873,JSON['stringify'](_0x46f22d));_0x4b3936(_0x46f22d);})['catch'](function(_0x1646b7){logger[_0xbd6e('0xf')]('UpdateMemberReport',_0x1646b7[_0xbd6e('0x12')],_0x1e6873);_0x5d1710(_0x47a1d9[_0xbd6e('0xf')](0x1f4,_0x1646b7['message']));});});}; \ No newline at end of file +var _0xae71=['MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport'];(function(_0x201621,_0x49d187){var _0x38c2c0=function(_0x366a65){while(--_0x366a65){_0x201621['push'](_0x201621['shift']());}};_0x38c2c0(++_0x49d187);}(_0xae71,0x194));var _0x1ae7=function(_0x5535a3,_0x1e7ab9){_0x5535a3=_0x5535a3-0x0;var _0x4da372=_0xae71[_0x5535a3];return _0x4da372;};'use strict';var _=require(_0x1ae7('0x0'));var util=require(_0x1ae7('0x1'));var moment=require(_0x1ae7('0x2'));var BPromise=require(_0x1ae7('0x3'));var rs=require(_0x1ae7('0x4'));var fs=require('fs');var Redis=require(_0x1ae7('0x5'));var db=require(_0x1ae7('0x6'))['db'];var utils=require(_0x1ae7('0x7'));var logger=require(_0x1ae7('0x8'))('rpc');var config=require(_0x1ae7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ae7('0xa')][_0x1ae7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ad5b7,_0x3dc963,_0x3b2338){return new BPromise(function(_0x72899c,_0x54632f){return client[_0x1ae7('0xc')](_0x4ad5b7,_0x3b2338)[_0x1ae7('0xd')](function(_0x135c52){logger[_0x1ae7('0xe')](_0x1ae7('0xf'),_0x3dc963,_0x1ae7('0x10'));logger[_0x1ae7('0x11')](_0x1ae7('0x12'),_0x3dc963,_0x1ae7('0x10'),JSON[_0x1ae7('0x13')](_0x135c52));if(_0x135c52[_0x1ae7('0x14')]){if(_0x135c52[_0x1ae7('0x14')]['code']===0x1f4){logger[_0x1ae7('0x14')]('MemberReport,\x20%s,\x20%s',_0x3dc963,_0x135c52[_0x1ae7('0x14')][_0x1ae7('0x15')]);return _0x54632f(_0x135c52[_0x1ae7('0x14')][_0x1ae7('0x15')]);}logger[_0x1ae7('0x14')](_0x1ae7('0xf'),_0x3dc963,_0x135c52[_0x1ae7('0x14')]['message']);return _0x72899c(_0x135c52[_0x1ae7('0x14')]['message']);}else{logger[_0x1ae7('0xe')](_0x1ae7('0xf'),_0x3dc963,_0x1ae7('0x10'));_0x72899c(_0x135c52[_0x1ae7('0x16')][_0x1ae7('0x15')]);}})[_0x1ae7('0x17')](function(_0x259ef2){logger[_0x1ae7('0x14')](_0x1ae7('0xf'),_0x3dc963,_0x259ef2);_0x54632f(_0x259ef2);});});}exports[_0x1ae7('0x18')]=function(_0x3c04cc){var _0x434bf4=this;return new Promise(function(_0x526964,_0x57d5a7){return db[_0x1ae7('0x19')][_0x1ae7('0x1a')]({'raw':_0x3c04cc[_0x1ae7('0x1b')]?_0x3c04cc['options'][_0x1ae7('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c04cc['options']?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x1d')]||null:null,'attributes':_0x3c04cc[_0x1ae7('0x1b')]?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x1e')]||null:null,'limit':_0x3c04cc['options']?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x1f')]||null:null,'include':_0x3c04cc[_0x1ae7('0x1b')]?_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x20')]?_[_0x1ae7('0x21')](_0x3c04cc[_0x1ae7('0x1b')][_0x1ae7('0x20')],function(_0x16eeef){return{'model':db[_0x16eeef['model']],'as':_0x16eeef['as'],'attributes':_0x16eeef[_0x1ae7('0x1e')],'include':_0x16eeef[_0x1ae7('0x20')]?_[_0x1ae7('0x21')](_0x16eeef[_0x1ae7('0x20')],function(_0xbc303e){return{'model':db[_0xbc303e[_0x1ae7('0x22')]],'as':_0xbc303e['as'],'attributes':_0xbc303e[_0x1ae7('0x1e')],'include':_0xbc303e['include']?_[_0x1ae7('0x21')](_0xbc303e['include'],function(_0x56993e){return{'model':db[_0x56993e['model']],'as':_0x56993e['as'],'attributes':_0x56993e[_0x1ae7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1ae7('0xd')](function(_0x9daf81){logger[_0x1ae7('0xe')](_0x1ae7('0x18'),_0x3c04cc);logger[_0x1ae7('0x11')](_0x1ae7('0x18'),_0x3c04cc,JSON['stringify'](_0x9daf81));_0x526964(_0x9daf81);})['catch'](function(_0x3e248a){logger['error'](_0x1ae7('0x18'),_0x3e248a['message'],_0x3c04cc);_0x57d5a7(_0x434bf4[_0x1ae7('0x14')](0x1f4,_0x3e248a['message']));});});};exports[_0x1ae7('0x23')]=function(_0x44471b){var _0x2a2369=this;return new Promise(function(_0x4a5ccf,_0x29b267){return db['MemberReport'][_0x1ae7('0x24')](_0x44471b[_0x1ae7('0x25')],{'raw':_0x44471b['options']?_0x44471b['options'][_0x1ae7('0x1c')]===undefined?!![]:![]:!![]})[_0x1ae7('0xd')](function(_0x4d9079){logger[_0x1ae7('0xe')]('CreateMemberReport',_0x44471b);logger[_0x1ae7('0x11')](_0x1ae7('0x23'),_0x44471b,JSON[_0x1ae7('0x13')](_0x4d9079));_0x4a5ccf(_0x4d9079);})[_0x1ae7('0x17')](function(_0xd06252){logger[_0x1ae7('0x14')](_0x1ae7('0x23'),_0xd06252[_0x1ae7('0x15')],_0x44471b);_0x29b267(_0x2a2369[_0x1ae7('0x14')](0x1f4,_0xd06252[_0x1ae7('0x15')]));});});};exports[_0x1ae7('0x26')]=function(_0x482725){var _0x56dbf9=this;return new Promise(function(_0x583a3f,_0x41ba7f){return db[_0x1ae7('0x19')]['update'](_0x482725[_0x1ae7('0x25')],{'raw':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1d')]||null:null,'attributes':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1e')]||null:null,'limit':_0x482725[_0x1ae7('0x1b')]?_0x482725[_0x1ae7('0x1b')][_0x1ae7('0x1f')]||null:null})[_0x1ae7('0xd')](function(_0x3d7d2a){logger[_0x1ae7('0xe')](_0x1ae7('0x26'),_0x482725);logger[_0x1ae7('0x11')](_0x1ae7('0x26'),_0x482725,JSON['stringify'](_0x3d7d2a));_0x583a3f(_0x3d7d2a);})[_0x1ae7('0x17')](function(_0xdb653c){logger['error'](_0x1ae7('0x26'),_0xdb653c[_0x1ae7('0x15')],_0x482725);_0x41ba7f(_0x56dbf9[_0x1ae7('0x14')](0x1f4,_0xdb653c[_0x1ae7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c694410..7249ee1 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 _0x5c00=['index','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x36d31e,_0x21e2c4){var _0x28eeda=function(_0x55f07f){while(--_0x55f07f){_0x36d31e['push'](_0x36d31e['shift']());}};_0x28eeda(++_0x21e2c4);}(_0x5c00,0x17e));var _0x05c0=function(_0x4c566d,_0x55d066){_0x4c566d=_0x4c566d-0x0;var _0x33fd32=_0x5c00[_0x4c566d];return _0x33fd32;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',controller[_0x05c0('0x8')]);module[_0x05c0('0x9')]=router; \ No newline at end of file +var _0x6324=['path','connect-timeout','Router','../../components/interaction/service','./migration.controller','index','exports','multer','util'];(function(_0x192a38,_0x229b2a){var _0x1d2b72=function(_0xfbdfb5){while(--_0xfbdfb5){_0x192a38['push'](_0x192a38['shift']());}};_0x1d2b72(++_0x229b2a);}(_0x6324,0x142));var _0x4632=function(_0x458959,_0x4cdf7a){_0x458959=_0x458959-0x0;var _0xde7ff6=_0x6324[_0x458959];return _0xde7ff6;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get']('/',controller[_0x4632('0x7')]);module[_0x4632('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a07aea2..fd85c5c 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 _0xf7fe=['exports','STRING','version','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf7fe,0x17f));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xef7f('0x0'));module[_0xef7f('0x1')]={'version':{'type':Sequelize[_0xef7f('0x2')],'unique':_0xef7f('0x3')}}; \ No newline at end of file +var _0x7dc9=['version','sequelize','exports','STRING'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0x7dc9,0x1b5));var _0x97dc=function(_0x42a2f7,_0x564723){_0x42a2f7=_0x42a2f7-0x0;var _0x5026cb=_0x7dc9[_0x42a2f7];return _0x5026cb;};'use strict';var Sequelize=require(_0x97dc('0x0'));module[_0x97dc('0x1')]={'version':{'type':Sequelize[_0x97dc('0x2')],'unique':_0x97dc('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8f81e80..e694f1a 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 _0xe11a=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','Migration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x383c3f,_0x1f70ab){var _0x1cef7=function(_0x3b86c8){while(--_0x3b86c8){_0x383c3f['push'](_0x383c3f['shift']());}};_0x1cef7(++_0x1f70ab);}(_0xe11a,0xcf));var _0xae11=function(_0x5282b9,_0x47c508){_0x5282b9=_0x5282b9-0x0;var _0x280eca=_0xe11a[_0x5282b9];return _0x280eca;};'use strict';var pdf=require(_0xae11('0x0'));var emlformat=require(_0xae11('0x1'));var rimraf=require(_0xae11('0x2'));var zipdir=require(_0xae11('0x3'));var jsonpatch=require(_0xae11('0x4'));var rp=require(_0xae11('0x5'));var moment=require(_0xae11('0x6'));var BPromise=require(_0xae11('0x7'));var Mustache=require(_0xae11('0x8'));var util=require('util');var path=require(_0xae11('0x9'));var sox=require(_0xae11('0xa'));var csv=require(_0xae11('0xb'));var ejs=require(_0xae11('0xc'));var fs=require('fs');var _=require(_0xae11('0xd'));var squel=require('squel');var crypto=require(_0xae11('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xae11('0xf'));var toCsv=require(_0xae11('0xb'));var querystring=require(_0xae11('0x10'));var Papa=require(_0xae11('0x11'));var Redis=require(_0xae11('0x12'));var authService=require(_0xae11('0x13'));var qs=require(_0xae11('0x14'));var as=require(_0xae11('0x15'));var hardwareService=require(_0xae11('0x16'));var logger=require(_0xae11('0x17'))(_0xae11('0x18'));var utils=require(_0xae11('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xae11('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f93b,_0x16dd9b){_0x16dd9b=_0x16dd9b||0xcc;return function(_0xb097bb){if(_0xb097bb){return _0x58f93b[_0xae11('0x1b')](_0x16dd9b);}return _0x58f93b[_0xae11('0x1c')](_0x16dd9b)[_0xae11('0x1d')]();};}function respondWithResult(_0x433232,_0x103b47){_0x103b47=_0x103b47||0xc8;return function(_0x5c7b7b){if(_0x5c7b7b){return _0x433232[_0xae11('0x1c')](_0x103b47)[_0xae11('0x1e')](_0x5c7b7b);}};}function respondWithFilteredResult(_0x9aef4b,_0x39a056){return function(_0x3f4a8a){if(_0x3f4a8a){var _0x54e735=_0x3f4a8a[_0xae11('0x1f')],_0x87a5c5=_0x39a056[_0xae11('0x20')],_0x1b7da9=_0x39a056['offset']+_0x39a056[_0xae11('0x21')],_0x18297d;if(_0x1b7da9>=_0x54e735){_0x1b7da9=_0x54e735;_0x18297d=0xc8;}else{_0x18297d=0xce;}_0x9aef4b[_0xae11('0x1c')](_0x18297d);return _0x9aef4b[_0xae11('0x22')](_0xae11('0x23'),_0x87a5c5+'-'+_0x1b7da9+'/'+_0x54e735)['json'](_0x3f4a8a);}return null;};}function patchUpdates(_0x747006){return function(_0x25199f){try{jsonpatch[_0xae11('0x24')](_0x25199f,_0x747006,!![]);}catch(_0x294929){return BPromise[_0xae11('0x25')](_0x294929);}return _0x25199f[_0xae11('0x26')]();};}function saveUpdates(_0x2087ab,_0x27e3c1){return function(_0x3497d7){if(_0x3497d7){return _0x3497d7[_0xae11('0x27')](_0x2087ab)['then'](function(_0xf4b15f){return _0xf4b15f;});}return null;};}function removeEntity(_0x38ad58,_0x594d20){return function(_0x54e827){if(_0x54e827){return _0x54e827[_0xae11('0x28')]()[_0xae11('0x29')](function(){_0x38ad58[_0xae11('0x1c')](0xcc)[_0xae11('0x1d')]();});}};}function handleEntityNotFound(_0xade2b4,_0x4c287f){return function(_0x59be85){if(!_0x59be85){_0xade2b4[_0xae11('0x1b')](0x194);}return _0x59be85;};}function handleError(_0x4d3807,_0x3666a9){_0x3666a9=_0x3666a9||0x1f4;return function(_0xad6c96){logger['error'](_0xad6c96[_0xae11('0x2a')]);if(_0xad6c96['name']){delete _0xad6c96[_0xae11('0x2b')];}_0x4d3807[_0xae11('0x1c')](_0x3666a9)[_0xae11('0x2c')](_0xad6c96);};}exports[_0xae11('0x2d')]=function(_0x3b7d7c,_0x3379cc){var _0x48bdb0={},_0xa735a4={},_0x51a39e={'count':0x0,'rows':[]};var _0x4abbac=_[_0xae11('0x2e')](db[_0xae11('0x2f')][_0xae11('0x30')],function(_0x139094){return{'name':_0x139094['fieldName'],'type':_0x139094[_0xae11('0x31')][_0xae11('0x32')]};});_0xa735a4['model']=_[_0xae11('0x2e')](_0x4abbac,'name');_0xa735a4[_0xae11('0x33')]=_[_0xae11('0x34')](_0x3b7d7c[_0xae11('0x33')]);_0xa735a4[_0xae11('0x35')]=_[_0xae11('0x36')](_0xa735a4[_0xae11('0x37')],_0xa735a4[_0xae11('0x33')]);_0x48bdb0[_0xae11('0x38')]=_[_0xae11('0x36')](_0xa735a4[_0xae11('0x37')],qs[_0xae11('0x39')](_0x3b7d7c[_0xae11('0x33')][_0xae11('0x39')]));_0x48bdb0[_0xae11('0x38')]=_0x48bdb0[_0xae11('0x38')][_0xae11('0x3a')]?_0x48bdb0[_0xae11('0x38')]:_0xa735a4[_0xae11('0x37')];if(!_0x3b7d7c[_0xae11('0x33')][_0xae11('0x3b')](_0xae11('0x3c'))){_0x48bdb0[_0xae11('0x21')]=qs[_0xae11('0x21')](_0x3b7d7c[_0xae11('0x33')][_0xae11('0x21')]);_0x48bdb0[_0xae11('0x20')]=qs[_0xae11('0x20')](_0x3b7d7c['query'][_0xae11('0x20')]);}_0x48bdb0[_0xae11('0x3d')]=qs[_0xae11('0x3e')](_0x3b7d7c[_0xae11('0x33')][_0xae11('0x3e')]);_0x48bdb0[_0xae11('0x3f')]=qs['filters'](_[_0xae11('0x40')](_0x3b7d7c[_0xae11('0x33')],_0xa735a4[_0xae11('0x35')]),_0x4abbac);if(_0x3b7d7c[_0xae11('0x33')][_0xae11('0x41')]){_0x48bdb0[_0xae11('0x3f')]=_[_0xae11('0x42')](_0x48bdb0[_0xae11('0x3f')],{'$or':_[_0xae11('0x2e')](_0x4abbac,function(_0x4bdd6c){if(_0x4bdd6c[_0xae11('0x31')]!=='VIRTUAL'){var _0x2595d3={};_0x2595d3[_0x4bdd6c[_0xae11('0x2b')]]={'$like':'%'+_0x3b7d7c[_0xae11('0x33')][_0xae11('0x41')]+'%'};return _0x2595d3;}})});}_0x48bdb0=_[_0xae11('0x42')]({},_0x48bdb0,_0x3b7d7c[_0xae11('0x43')]);var _0xb38940={'where':_0x48bdb0[_0xae11('0x3f')]};return db[_0xae11('0x2f')][_0xae11('0x1f')](_0xb38940)[_0xae11('0x29')](function(_0xad10e3){_0x51a39e[_0xae11('0x1f')]=_0xad10e3;if(_0x3b7d7c[_0xae11('0x33')]['includeAll']){_0x48bdb0['include']=[{'all':!![]}];}return db[_0xae11('0x2f')][_0xae11('0x44')](_0x48bdb0);})[_0xae11('0x29')](function(_0xf53e04){_0x51a39e[_0xae11('0x45')]=_0xf53e04;return _0x51a39e;})[_0xae11('0x29')](respondWithFilteredResult(_0x3379cc,_0x48bdb0))[_0xae11('0x46')](handleError(_0x3379cc,null));}; \ No newline at end of file +var _0x43ad=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','then','destroy','stack','name','send','map','Migration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','jsforce','desk.js'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x43ad,0xaf));var _0xd43a=function(_0x4cacfd,_0x3206ed){_0x4cacfd=_0x4cacfd-0x0;var _0x17f3b7=_0x43ad[_0x4cacfd];return _0x17f3b7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd43a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd43a('0x1'));var jsonpatch=require(_0xd43a('0x2'));var rp=require(_0xd43a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd43a('0x4'));var util=require(_0xd43a('0x5'));var path=require(_0xd43a('0x6'));var sox=require('sox');var csv=require(_0xd43a('0x7'));var ejs=require(_0xd43a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd43a('0x9'));var deskjs=require(_0xd43a('0xa'));var toCsv=require(_0xd43a('0x7'));var querystring=require(_0xd43a('0xb'));var Papa=require(_0xd43a('0xc'));var Redis=require(_0xd43a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd43a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd43a('0xf'));var logger=require(_0xd43a('0x10'))(_0xd43a('0x11'));var utils=require(_0xd43a('0x12'));var config=require(_0xd43a('0x13'));var licenseUtil=require(_0xd43a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x87ae18,_0x2a199b){_0x2a199b=_0x2a199b||0xcc;return function(_0x4d811f){if(_0x4d811f){return _0x87ae18[_0xd43a('0x15')](_0x2a199b);}return _0x87ae18[_0xd43a('0x16')](_0x2a199b)[_0xd43a('0x17')]();};}function respondWithResult(_0x47fa65,_0xa72d6c){_0xa72d6c=_0xa72d6c||0xc8;return function(_0xb5cb28){if(_0xb5cb28){return _0x47fa65['status'](_0xa72d6c)['json'](_0xb5cb28);}};}function respondWithFilteredResult(_0x47bbbd,_0x1a237b){return function(_0x1dc833){if(_0x1dc833){var _0x39c7cc=_0x1dc833[_0xd43a('0x18')],_0x2bf1f2=_0x1a237b[_0xd43a('0x19')],_0x3b9cd6=_0x1a237b[_0xd43a('0x19')]+_0x1a237b['limit'],_0x142afe;if(_0x3b9cd6>=_0x39c7cc){_0x3b9cd6=_0x39c7cc;_0x142afe=0xc8;}else{_0x142afe=0xce;}_0x47bbbd[_0xd43a('0x16')](_0x142afe);return _0x47bbbd[_0xd43a('0x1a')](_0xd43a('0x1b'),_0x2bf1f2+'-'+_0x3b9cd6+'/'+_0x39c7cc)[_0xd43a('0x1c')](_0x1dc833);}return null;};}function patchUpdates(_0x2699c9){return function(_0x5d9a05){try{jsonpatch['apply'](_0x5d9a05,_0x2699c9,!![]);}catch(_0x45cc07){return BPromise['reject'](_0x45cc07);}return _0x5d9a05['save']();};}function saveUpdates(_0x577d28,_0x1784e4){return function(_0x591d20){if(_0x591d20){return _0x591d20['update'](_0x577d28)[_0xd43a('0x1d')](function(_0x2aa319){return _0x2aa319;});}return null;};}function removeEntity(_0x40eaa9,_0x463677){return function(_0x4d54b6){if(_0x4d54b6){return _0x4d54b6[_0xd43a('0x1e')]()[_0xd43a('0x1d')](function(){_0x40eaa9[_0xd43a('0x16')](0xcc)[_0xd43a('0x17')]();});}};}function handleEntityNotFound(_0x4d467c,_0x378180){return function(_0x451105){if(!_0x451105){_0x4d467c['sendStatus'](0x194);}return _0x451105;};}function handleError(_0x52f26f,_0x18eae7){_0x18eae7=_0x18eae7||0x1f4;return function(_0x540978){logger['error'](_0x540978[_0xd43a('0x1f')]);if(_0x540978[_0xd43a('0x20')]){delete _0x540978['name'];}_0x52f26f['status'](_0x18eae7)[_0xd43a('0x21')](_0x540978);};}exports['index']=function(_0x3ec7df,_0x5e89f6){var _0x387d12={},_0x4559c4={},_0x4dad31={'count':0x0,'rows':[]};var _0xfe5b0c=_[_0xd43a('0x22')](db[_0xd43a('0x23')][_0xd43a('0x24')],function(_0x5a9664){return{'name':_0x5a9664[_0xd43a('0x25')],'type':_0x5a9664['type'][_0xd43a('0x26')]};});_0x4559c4['model']=_['map'](_0xfe5b0c,_0xd43a('0x20'));_0x4559c4[_0xd43a('0x27')]=_[_0xd43a('0x28')](_0x3ec7df[_0xd43a('0x27')]);_0x4559c4[_0xd43a('0x29')]=_[_0xd43a('0x2a')](_0x4559c4[_0xd43a('0x2b')],_0x4559c4[_0xd43a('0x27')]);_0x387d12[_0xd43a('0x2c')]=_[_0xd43a('0x2a')](_0x4559c4[_0xd43a('0x2b')],qs[_0xd43a('0x2d')](_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x2d')]));_0x387d12['attributes']=_0x387d12[_0xd43a('0x2c')][_0xd43a('0x2e')]?_0x387d12[_0xd43a('0x2c')]:_0x4559c4['model'];if(!_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x2f')](_0xd43a('0x30'))){_0x387d12[_0xd43a('0x31')]=qs[_0xd43a('0x31')](_0x3ec7df[_0xd43a('0x27')]['limit']);_0x387d12['offset']=qs['offset'](_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x19')]);}_0x387d12[_0xd43a('0x32')]=qs[_0xd43a('0x33')](_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x33')]);_0x387d12['where']=qs[_0xd43a('0x29')](_[_0xd43a('0x34')](_0x3ec7df[_0xd43a('0x27')],_0x4559c4['filters']),_0xfe5b0c);if(_0x3ec7df['query']['filter']){_0x387d12[_0xd43a('0x35')]=_[_0xd43a('0x36')](_0x387d12[_0xd43a('0x35')],{'$or':_['map'](_0xfe5b0c,function(_0x43a25b){if(_0x43a25b[_0xd43a('0x37')]!==_0xd43a('0x38')){var _0xb2426f={};_0xb2426f[_0x43a25b[_0xd43a('0x20')]]={'$like':'%'+_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x39')]+'%'};return _0xb2426f;}})});}_0x387d12=_[_0xd43a('0x36')]({},_0x387d12,_0x3ec7df[_0xd43a('0x3a')]);var _0x23ddf5={'where':_0x387d12[_0xd43a('0x35')]};return db['Migration'][_0xd43a('0x18')](_0x23ddf5)['then'](function(_0x483b44){_0x4dad31[_0xd43a('0x18')]=_0x483b44;if(_0x3ec7df[_0xd43a('0x27')][_0xd43a('0x3b')]){_0x387d12['include']=[{'all':!![]}];}return db[_0xd43a('0x23')][_0xd43a('0x3c')](_0x387d12);})[_0xd43a('0x1d')](function(_0x36624d){_0x4dad31['rows']=_0x36624d;return _0x4dad31;})[_0xd43a('0x1d')](respondWithFilteredResult(_0x5e89f6,_0x387d12))[_0xd43a('0x3d')](handleError(_0x5e89f6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ab1bac5..cc0cc0c 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 _0x05c8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash'];(function(_0x2013c0,_0x4299f0){var _0x22f7a4=function(_0x227d21){while(--_0x227d21){_0x2013c0['push'](_0x2013c0['shift']());}};_0x22f7a4(++_0x4299f0);}(_0x05c8,0x1b9));var _0x805c=function(_0x4a4696,_0x342074){_0x4a4696=_0x4a4696-0x0;var _0x15adc3=_0x05c8[_0x4a4696];return _0x15adc3;};'use strict';var _=require(_0x805c('0x0'));var util=require('util');var logger=require(_0x805c('0x1'))(_0x805c('0x2'));var moment=require(_0x805c('0x3'));var BPromise=require(_0x805c('0x4'));var rp=require(_0x805c('0x5'));var fs=require('fs');var path=require(_0x805c('0x6'));var rimraf=require(_0x805c('0x7'));var config=require(_0x805c('0x8'));var attributes=require('./migration.attributes');module[_0x805c('0x9')]=function(_0x3a0df6,_0x4d590f){return _0x3a0df6[_0x805c('0xa')](_0x805c('0xb'),attributes,{'tableName':_0x805c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0897=['Migration','migrations','util','../../config/logger','bluebird','request-promise','path','rimraf','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0897,0x18e));var _0x7089=function(_0x1e6481,_0xd8a345){_0x1e6481=_0x1e6481-0x0;var _0x4f5cac=_0x0897[_0x1e6481];return _0x4f5cac;};'use strict';var _=require('lodash');var util=require(_0x7089('0x0'));var logger=require(_0x7089('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7089('0x2'));var rp=require(_0x7089('0x3'));var fs=require('fs');var path=require(_0x7089('0x4'));var rimraf=require(_0x7089('0x5'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x7089('0x6')]=function(_0x26b051,_0x315035){return _0x26b051['define'](_0x7089('0x7'),attributes,{'tableName':_0x7089('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 2fa89c2..9bd44c4 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 _0xf3f9=['../../config/utils','../../config/logger','rpc','client','then','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x286fdc,_0x54551d){_0x286fdc=_0x286fdc-0x0;var _0x11fe49=_0xf3f9[_0x286fdc];return _0x11fe49;};'use strict';var _=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var moment=require('moment');var BPromise=require(_0x9f3f('0x2'));var rs=require(_0x9f3f('0x3'));var fs=require('fs');var Redis=require(_0x9f3f('0x4'));var db=require(_0x9f3f('0x5'))['db'];var utils=require(_0x9f3f('0x6'));var logger=require(_0x9f3f('0x7'))(_0x9f3f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9f3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17b150,_0x4a9a17,_0x373b80){return new BPromise(function(_0xa6b3ae,_0x223546){return client['request'](_0x17b150,_0x373b80)[_0x9f3f('0xa')](function(_0x588c31){logger['info']('Migration,\x20%s,\x20%s',_0x4a9a17,'request\x20sent');logger[_0x9f3f('0xb')](_0x9f3f('0xc'),_0x4a9a17,_0x9f3f('0xd'),JSON[_0x9f3f('0xe')](_0x588c31));if(_0x588c31[_0x9f3f('0xf')]){if(_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x10')]===0x1f4){logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x12')]);return _0x223546(_0x588c31[_0x9f3f('0xf')]['message']);}logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x588c31['error']['message']);return _0xa6b3ae(_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x12')]);}else{logger[_0x9f3f('0x13')](_0x9f3f('0x11'),_0x4a9a17,_0x9f3f('0xd'));_0xa6b3ae(_0x588c31[_0x9f3f('0x14')]['message']);}})[_0x9f3f('0x15')](function(_0x75ecdb){logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x75ecdb);_0x223546(_0x75ecdb);});});} \ No newline at end of file +var _0x849a=['rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a9976,_0x35ba73){var _0x4cc15f=function(_0x1b9bb7){while(--_0x1b9bb7){_0x5a9976['push'](_0x5a9976['shift']());}};_0x4cc15f(++_0x35ba73);}(_0x849a,0x1ba));var _0xa849=function(_0x2571a7,_0x1db1d7){_0x2571a7=_0x2571a7-0x0;var _0x337c09=_0x849a[_0x2571a7];return _0x337c09;};'use strict';var _=require(_0xa849('0x0'));var util=require(_0xa849('0x1'));var moment=require(_0xa849('0x2'));var BPromise=require(_0xa849('0x3'));var rs=require(_0xa849('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa849('0x5'))['db'];var utils=require(_0xa849('0x6'));var logger=require(_0xa849('0x7'))(_0xa849('0x8'));var config=require(_0xa849('0x9'));var jayson=require(_0xa849('0xa'));var client=jayson[_0xa849('0xb')][_0xa849('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ea7b8,_0x308e26,_0x5e5aee){return new BPromise(function(_0x16e755,_0x259965){return client['request'](_0x4ea7b8,_0x5e5aee)[_0xa849('0xd')](function(_0x163c80){logger[_0xa849('0xe')](_0xa849('0xf'),_0x308e26,_0xa849('0x10'));logger[_0xa849('0x11')](_0xa849('0x12'),_0x308e26,_0xa849('0x10'),JSON[_0xa849('0x13')](_0x163c80));if(_0x163c80[_0xa849('0x14')]){if(_0x163c80[_0xa849('0x14')][_0xa849('0x15')]===0x1f4){logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);return _0x259965(_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);}logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x163c80[_0xa849('0x14')][_0xa849('0x16')]);return _0x16e755(_0x163c80['error'][_0xa849('0x16')]);}else{logger[_0xa849('0xe')](_0xa849('0xf'),_0x308e26,'request\x20sent');_0x16e755(_0x163c80[_0xa849('0x17')][_0xa849('0x16')]);}})[_0xa849('0x18')](function(_0x3a9a41){logger[_0xa849('0x14')](_0xa849('0xf'),_0x308e26,_0x3a9a41);_0x259965(_0x3a9a41);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 445dd72..fcde7a4 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 _0xa478=['express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x229caa,_0x5867ac){var _0xbcf32f=function(_0x1c8797){while(--_0x1c8797){_0x229caa['push'](_0x229caa['shift']());}};_0xbcf32f(++_0x5867ac);}(_0xa478,0x1ea));var _0x8a47=function(_0x4d183d,_0x123de0){_0x4d183d=_0x4d183d-0x0;var _0x431236=_0xa478[_0x4d183d];return _0x431236;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require('path');var timeout=require(_0x8a47('0x2'));var express=require(_0x8a47('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8a47('0x4'));var config=require(_0x8a47('0x5'));var controller=require('./network.controller');router[_0x8a47('0x6')]('/',auth[_0x8a47('0x7')](),controller[_0x8a47('0x8')]);router[_0x8a47('0x6')](_0x8a47('0x9'),auth['isAuthenticated'](),controller[_0x8a47('0xa')]);router[_0x8a47('0xb')]('/',auth[_0x8a47('0x7')](),controller[_0x8a47('0xc')]);router[_0x8a47('0xd')]('/:id',auth[_0x8a47('0x7')](),controller[_0x8a47('0xe')]);router['delete'](_0x8a47('0x9'),auth['isAuthenticated'](),controller[_0x8a47('0xf')]);module[_0x8a47('0x10')]=router; \ No newline at end of file +var _0x9888=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer'];(function(_0x3f8ea4,_0x84bc4f){var _0x434fd0=function(_0x4ffd2c){while(--_0x4ffd2c){_0x3f8ea4['push'](_0x3f8ea4['shift']());}};_0x434fd0(++_0x84bc4f);}(_0x9888,0xd0));var _0x8988=function(_0x158f79,_0x3b3688){_0x158f79=_0x158f79-0x0;var _0x5c4da1=_0x9888[_0x158f79];return _0x5c4da1;};'use strict';var multer=require(_0x8988('0x0'));var util=require(_0x8988('0x1'));var path=require(_0x8988('0x2'));var timeout=require(_0x8988('0x3'));var express=require(_0x8988('0x4'));var router=express[_0x8988('0x5')]();var auth=require(_0x8988('0x6'));var interaction=require(_0x8988('0x7'));var config=require(_0x8988('0x8'));var controller=require(_0x8988('0x9'));router[_0x8988('0xa')]('/',auth[_0x8988('0xb')](),controller[_0x8988('0xc')]);router[_0x8988('0xa')](_0x8988('0xd'),auth[_0x8988('0xb')](),controller['show']);router[_0x8988('0xe')]('/',auth[_0x8988('0xb')](),controller[_0x8988('0xf')]);router[_0x8988('0x10')](_0x8988('0xd'),auth[_0x8988('0xb')](),controller['update']);router[_0x8988('0x11')](_0x8988('0xd'),auth[_0x8988('0xb')](),controller[_0x8988('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 780a52b..c4fcbd9 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(_0x3f5d9a,_0x33b385){var _0x1af057=function(_0x2e5d8d){while(--_0x2e5d8d){_0x3f5d9a['push'](_0x3f5d9a['shift']());}};_0x1af057(++_0x33b385);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x4634d7,_0x354459){var _0x365b57=function(_0x1f1030){while(--_0x1f1030){_0x4634d7['push'](_0x4634d7['shift']());}};_0x365b57(++_0x354459);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ac84413..e34abf0 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 _0xaec3=['../../config/environment','../../config/license/util','../../mysqldb','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','create','sequelize','transaction','body','type','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','res_stun_monitor.so','server/files/templates/network.ejs','chan_sip.so','find','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','toLowerCase','/etc/asterisk/sip_xcally_%s.conf','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xaec3,0x122));var _0x3aec=function(_0x5da97b,_0x31ab7e){_0x5da97b=_0x5da97b-0x0;var _0x2d1b02=_0xaec3[_0x5da97b];return _0x2d1b02;};'use strict';var pdf=require(_0x3aec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3aec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3aec('0x2'));var rp=require(_0x3aec('0x3'));var moment=require(_0x3aec('0x4'));var BPromise=require(_0x3aec('0x5'));var Mustache=require('mustache');var util=require(_0x3aec('0x6'));var path=require(_0x3aec('0x7'));var sox=require(_0x3aec('0x8'));var csv=require(_0x3aec('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3aec('0xa'));var squel=require(_0x3aec('0xb'));var crypto=require(_0x3aec('0xc'));var jsforce=require(_0x3aec('0xd'));var deskjs=require(_0x3aec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3aec('0xf'));var Papa=require(_0x3aec('0x10'));var Redis=require(_0x3aec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3aec('0x12'));var as=require(_0x3aec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3aec('0x14'))(_0x3aec('0x15'));var utils=require('../../config/utils');var config=require(_0x3aec('0x16'));var licenseUtil=require(_0x3aec('0x17'));var db=require(_0x3aec('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3aec('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x366a24,_0x5bff08,_0x4fc142,_0x7ef48c){return new BPromise(function(_0xab443b,_0x5363df){var _0x2e075b=_0x7ef48c||client;return _0x2e075b[_0x3aec('0x1a')](_0x366a24,_0x4fc142)[_0x3aec('0x1b')](function(_0x4b2b6d){logger['info'](_0x3aec('0x1c'),_0x5bff08,_0x3aec('0x1d'));logger[_0x3aec('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x5bff08,_0x3aec('0x1d'),JSON[_0x3aec('0x1f')](_0x4b2b6d));if(_0x4b2b6d[_0x3aec('0x20')]){if(_0x4b2b6d[_0x3aec('0x20')][_0x3aec('0x21')]===0x1f4){logger[_0x3aec('0x20')](_0x3aec('0x1c'),_0x5bff08,_0x4b2b6d[_0x3aec('0x20')][_0x3aec('0x22')]);return _0x5363df(_0x4b2b6d[_0x3aec('0x20')]['message']);}logger['error'](_0x3aec('0x1c'),_0x5bff08,_0x4b2b6d['error'][_0x3aec('0x22')]);return _0xab443b(_0x4b2b6d[_0x3aec('0x20')]['message']);}else{logger[_0x3aec('0x23')](_0x3aec('0x1c'),_0x5bff08,_0x3aec('0x1d'));_0xab443b(_0x4b2b6d[_0x3aec('0x24')][_0x3aec('0x22')]);}})[_0x3aec('0x25')](function(_0x31d54c){logger[_0x3aec('0x20')](_0x3aec('0x1c'),_0x5bff08,_0x31d54c);_0x5363df(_0x31d54c);});});}function respondWithStatusCode(_0x5d1d53,_0x3d9e5e){_0x3d9e5e=_0x3d9e5e||0xcc;return function(_0xdc0e95){if(_0xdc0e95){return _0x5d1d53['sendStatus'](_0x3d9e5e);}return _0x5d1d53[_0x3aec('0x26')](_0x3d9e5e)[_0x3aec('0x27')]();};}function respondWithResult(_0x59085a,_0x1ca302){_0x1ca302=_0x1ca302||0xc8;return function(_0x5a77a1){if(_0x5a77a1){return _0x59085a[_0x3aec('0x26')](_0x1ca302)[_0x3aec('0x28')](_0x5a77a1);}};}function respondWithFilteredResult(_0x55e59a,_0x313111){return function(_0x2ae719){if(_0x2ae719){var _0x2b161e=_0x2ae719[_0x3aec('0x29')],_0x585aa4=_0x313111[_0x3aec('0x2a')],_0x45948d=_0x313111[_0x3aec('0x2a')]+_0x313111[_0x3aec('0x2b')],_0x55ee46;if(_0x45948d>=_0x2b161e){_0x45948d=_0x2b161e;_0x55ee46=0xc8;}else{_0x55ee46=0xce;}_0x55e59a[_0x3aec('0x26')](_0x55ee46);return _0x55e59a[_0x3aec('0x2c')](_0x3aec('0x2d'),_0x585aa4+'-'+_0x45948d+'/'+_0x2b161e)[_0x3aec('0x28')](_0x2ae719);}return null;};}function patchUpdates(_0x4d695a){return function(_0x1a3578){try{jsonpatch['apply'](_0x1a3578,_0x4d695a,!![]);}catch(_0x569e6a){return BPromise[_0x3aec('0x2e')](_0x569e6a);}return _0x1a3578[_0x3aec('0x2f')]();};}function saveUpdates(_0x132fb1,_0x599b19){return function(_0xa4a909){if(_0xa4a909){return _0xa4a909[_0x3aec('0x30')](_0x132fb1)[_0x3aec('0x1b')](function(_0xedd600){return _0xedd600;});}return null;};}function removeEntity(_0x4000e5,_0x3bbf66){return function(_0x54ec22){if(_0x54ec22){return _0x54ec22[_0x3aec('0x31')]()[_0x3aec('0x1b')](function(){_0x4000e5['status'](0xcc)[_0x3aec('0x27')]();});}};}function handleEntityNotFound(_0x175104,_0x251c48){return function(_0x5897e5){if(!_0x5897e5){_0x175104['sendStatus'](0x194);}return _0x5897e5;};}function handleError(_0xf7451b,_0x37ceff){_0x37ceff=_0x37ceff||0x1f4;return function(_0x1b5c4d){logger[_0x3aec('0x20')](_0x1b5c4d[_0x3aec('0x32')]);if(_0x1b5c4d[_0x3aec('0x33')]){delete _0x1b5c4d[_0x3aec('0x33')];}_0xf7451b[_0x3aec('0x26')](_0x37ceff)[_0x3aec('0x34')](_0x1b5c4d);};}exports[_0x3aec('0x35')]=function(_0x494fd5,_0x25e5fb){var _0x5cd842={},_0x50c585={},_0x42d5f7={'count':0x0,'rows':[]};var _0x929a61=_[_0x3aec('0x36')](db[_0x3aec('0x37')][_0x3aec('0x38')],function(_0x38a1c3){return{'name':_0x38a1c3[_0x3aec('0x39')],'type':_0x38a1c3['type']['key']};});_0x50c585[_0x3aec('0x3a')]=_[_0x3aec('0x36')](_0x929a61,'name');_0x50c585['query']=_['keys'](_0x494fd5[_0x3aec('0x3b')]);_0x50c585[_0x3aec('0x3c')]=_[_0x3aec('0x3d')](_0x50c585[_0x3aec('0x3a')],_0x50c585[_0x3aec('0x3b')]);_0x5cd842[_0x3aec('0x3e')]=_[_0x3aec('0x3d')](_0x50c585['model'],qs[_0x3aec('0x3f')](_0x494fd5[_0x3aec('0x3b')]['fields']));_0x5cd842['attributes']=_0x5cd842[_0x3aec('0x3e')][_0x3aec('0x40')]?_0x5cd842[_0x3aec('0x3e')]:_0x50c585[_0x3aec('0x3a')];if(!_0x494fd5[_0x3aec('0x3b')]['hasOwnProperty']('nolimit')){_0x5cd842[_0x3aec('0x2b')]=qs[_0x3aec('0x2b')](_0x494fd5[_0x3aec('0x3b')]['limit']);_0x5cd842[_0x3aec('0x2a')]=qs['offset'](_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x2a')]);}_0x5cd842[_0x3aec('0x41')]=qs[_0x3aec('0x42')](_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x42')]);_0x5cd842[_0x3aec('0x43')]=qs[_0x3aec('0x3c')](_['pick'](_0x494fd5[_0x3aec('0x3b')],_0x50c585[_0x3aec('0x3c')]),_0x929a61);if(_0x494fd5[_0x3aec('0x3b')]['filter']){_0x5cd842[_0x3aec('0x43')]=_[_0x3aec('0x44')](_0x5cd842[_0x3aec('0x43')],{'$or':_['map'](_0x929a61,function(_0x189c76){if(_0x189c76['type']!=='VIRTUAL'){var _0x180303={};_0x180303[_0x189c76['name']]={'$like':'%'+_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x45')]+'%'};return _0x180303;}})});}_0x5cd842=_['merge']({},_0x5cd842,_0x494fd5[_0x3aec('0x46')]);var _0x1d186e={'where':_0x5cd842[_0x3aec('0x43')]};return db['Network']['count'](_0x1d186e)[_0x3aec('0x1b')](function(_0x4f607b){_0x42d5f7[_0x3aec('0x29')]=_0x4f607b;if(_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x47')]){_0x5cd842['include']=[{'all':!![]}];}return db[_0x3aec('0x37')][_0x3aec('0x48')](_0x5cd842);})[_0x3aec('0x1b')](function(_0x256df0){_0x42d5f7[_0x3aec('0x49')]=_0x256df0;return _0x42d5f7;})[_0x3aec('0x1b')](respondWithFilteredResult(_0x25e5fb,_0x5cd842))[_0x3aec('0x25')](handleError(_0x25e5fb,null));};exports[_0x3aec('0x4a')]=function(_0x2af49f,_0x397a4a){var _0x28c859={'raw':!![],'where':{'id':_0x2af49f[_0x3aec('0x4b')]['id']}},_0x2dc621={};_0x2dc621[_0x3aec('0x3a')]=_[_0x3aec('0x4c')](db['Network']['rawAttributes']);_0x2dc621['query']=_[_0x3aec('0x4c')](_0x2af49f['query']);_0x2dc621[_0x3aec('0x3c')]=_[_0x3aec('0x3d')](_0x2dc621[_0x3aec('0x3a')],_0x2dc621[_0x3aec('0x3b')]);_0x28c859[_0x3aec('0x3e')]=_[_0x3aec('0x3d')](_0x2dc621['model'],qs[_0x3aec('0x3f')](_0x2af49f[_0x3aec('0x3b')][_0x3aec('0x3f')]));_0x28c859['attributes']=_0x28c859[_0x3aec('0x3e')]['length']?_0x28c859[_0x3aec('0x3e')]:_0x2dc621[_0x3aec('0x3a')];if(_0x2af49f[_0x3aec('0x3b')][_0x3aec('0x47')]){_0x28c859[_0x3aec('0x4d')]=[{'all':!![]}];}_0x28c859=_[_0x3aec('0x44')]({},_0x28c859,_0x2af49f['options']);return db['Network']['find'](_0x28c859)[_0x3aec('0x1b')](handleEntityNotFound(_0x397a4a,null))[_0x3aec('0x1b')](respondWithResult(_0x397a4a,null))[_0x3aec('0x25')](handleError(_0x397a4a,null));};exports[_0x3aec('0x4e')]=function(_0x29d5a3,_0x56b9c6,_0x46fbf5){var _0x315940;return db[_0x3aec('0x4f')][_0x3aec('0x50')](function(_0x3ffff0){return db[_0x3aec('0x37')][_0x3aec('0x4e')](_0x29d5a3[_0x3aec('0x51')],{'raw':!![]})[_0x3aec('0x1b')](function(_0x1a7f84){_0x315940=_0x1a7f84;return db[_0x3aec('0x37')][_0x3aec('0x48')]({'where':{'type':_0x29d5a3['body']['type']},'raw':!![]});})[_0x3aec('0x1b')](function(_0x1f137b){if(_0x315940[_0x3aec('0x52')][_0x3aec('0x53')]()==_0x3aec('0x54')){var _0x54a7bb=fs['readFileSync'](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x57')),_0x3aec('0x58'));var _0x4656d9=ejs[_0x3aec('0x59')](_0x54a7bb,{'networks':_0x1f137b||[]});fs[_0x3aec('0x5a')](_0x3aec('0x5b'),_0x4656d9);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x4e'),{'module':'res_stun_monitor.so'});}else if(_0x315940[_0x3aec('0x52')]['toUpperCase']()==_0x3aec('0x5d')){var _0x129e45=fs[_0x3aec('0x5e')](path['join'](config[_0x3aec('0x56')],'server/files/templates/turn_multiple.ejs'),_0x3aec('0x58'));var _0x4c787d=ejs[_0x3aec('0x59')](_0x129e45,{'networks':_0x1f137b||[]});fs[_0x3aec('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x4c787d);return respondWithRpcPromise(_0x3aec('0x5c'),'create',{'module':_0x3aec('0x5f')});}else{var _0x53bac5=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x60')),'utf8');var _0x373ddb=ejs[_0x3aec('0x59')](_0x53bac5,{'networks':_0x1f137b||[]});fs[_0x3aec('0x5a')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x29d5a3[_0x3aec('0x51')][_0x3aec('0x52')]['toLowerCase']()),_0x373ddb);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x4e'),{'module':_0x3aec('0x61')});}return null;})['then'](function(){return _0x315940;});})[_0x3aec('0x1b')](respondWithResult(_0x56b9c6,0xc9))[_0x3aec('0x25')](handleError(_0x56b9c6,null));};exports[_0x3aec('0x30')]=function(_0x548368,_0x1dc950,_0x56ab16){var _0x195cfd;return db[_0x3aec('0x4f')][_0x3aec('0x50')](function(_0x335007){return db[_0x3aec('0x37')][_0x3aec('0x62')]({'where':{'id':_0x548368[_0x3aec('0x4b')]['id']}})[_0x3aec('0x1b')](handleEntityNotFound(_0x1dc950,null))['then'](saveUpdates(_0x548368[_0x3aec('0x51')],null))[_0x3aec('0x1b')](function(_0x109c4c){if(_0x109c4c){_0x195cfd=_0x109c4c;return db[_0x3aec('0x37')][_0x3aec('0x48')]({'where':{'type':_0x195cfd[_0x3aec('0x52')]},'raw':!![]});}return null;})[_0x3aec('0x1b')](function(_0x258aff){if(_0x195cfd[_0x3aec('0x52')][_0x3aec('0x53')]()==_0x3aec('0x54')){var _0x1a35eb=fs[_0x3aec('0x5e')](path['join'](config[_0x3aec('0x56')],'server/files/templates/stun_multiple.ejs'),_0x3aec('0x58'));var _0x40b47a=ejs[_0x3aec('0x59')](_0x1a35eb,{'networks':_0x258aff||[]});fs[_0x3aec('0x5a')](_0x3aec('0x5b'),_0x40b47a);return respondWithRpcPromise(_0x3aec('0x5c'),'update',{'module':_0x3aec('0x5f')});}else if(_0x195cfd['type'][_0x3aec('0x53')]()==_0x3aec('0x5d')){var _0x599151=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x63')),_0x3aec('0x58'));var _0x3d1d9a=ejs[_0x3aec('0x59')](_0x599151,{'networks':_0x258aff||[]});fs[_0x3aec('0x5a')](_0x3aec('0x64'),_0x3d1d9a);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x30'),{'module':_0x3aec('0x5f')});}else{var _0x389812=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config['root'],_0x3aec('0x60')),'utf8');var _0xf6eccf=ejs['render'](_0x389812,{'networks':_0x258aff||[]});fs[_0x3aec('0x5a')](util[_0x3aec('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x548368['body']['type'][_0x3aec('0x66')]()),_0xf6eccf);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x30'),{'module':'chan_sip.so'});}return null;})[_0x3aec('0x1b')](function(_0x3dc85b){if(_0x3dc85b){return _0x195cfd;}return null;});})[_0x3aec('0x1b')](respondWithResult(_0x1dc950,null))[_0x3aec('0x25')](handleError(_0x1dc950,null));};exports[_0x3aec('0x31')]=function(_0x108f8b,_0x58821,_0x61c8d2){var _0x51a371;return db[_0x3aec('0x37')]['find']({'where':{'id':_0x108f8b[_0x3aec('0x4b')]['id']}})[_0x3aec('0x1b')](function(_0x1e3fd8){_0x51a371=_0x1e3fd8;return _0x1e3fd8;})['then'](handleEntityNotFound(_0x58821,null))[_0x3aec('0x1b')](removeEntity(_0x58821,null))[_0x3aec('0x1b')](function(){if(_0x51a371){return db[_0x3aec('0x37')][_0x3aec('0x48')]({'where':{'type':_0x51a371[_0x3aec('0x52')]},'raw':!![]});}})['then'](function(_0x1f54cd){if(_0x51a371['type'][_0x3aec('0x53')]()==_0x3aec('0x54')){var _0x555fee=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x57')),_0x3aec('0x58'));var _0x31ee3e=ejs['render'](_0x555fee,{'networks':_0x1f54cd||[]});fs[_0x3aec('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x31ee3e);return respondWithRpcPromise('Reload',_0x3aec('0x31'),{'module':_0x3aec('0x5f')});}else if(_0x51a371[_0x3aec('0x52')][_0x3aec('0x53')]()=='TURN'){var _0x29a3b0=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x63')),_0x3aec('0x58'));var _0x206aa3=ejs[_0x3aec('0x59')](_0x29a3b0,{'networks':_0x1f54cd||[]});fs[_0x3aec('0x5a')](_0x3aec('0x64'),_0x206aa3);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x31'),{'module':_0x3aec('0x5f')});}else{var _0x397b0d=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x60')),_0x3aec('0x58'));var _0x1590ad=ejs[_0x3aec('0x59')](_0x397b0d,{'networks':_0x1f54cd||[]});fs[_0x3aec('0x5a')](util[_0x3aec('0x65')](_0x3aec('0x67'),_0x108f8b['body'][_0x3aec('0x52')][_0x3aec('0x66')]()),_0x1590ad);return respondWithRpcPromise(_0x3aec('0x5c'),'destroy',{'module':_0x3aec('0x61')});}return null;})['catch'](handleError(_0x58821,null));}; \ No newline at end of file +var _0x820e=['offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Network','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','create','transaction','body','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','update','TURN','format','chan_sip.so','toUpperCase','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count'];(function(_0x33c52d,_0x42df8d){var _0x48201d=function(_0x10841d){while(--_0x10841d){_0x33c52d['push'](_0x33c52d['shift']());}};_0x48201d(++_0x42df8d);}(_0x820e,0xae));var _0xe820=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x820e[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0xe820('0x0'));var emlformat=require(_0xe820('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe820('0x2'));var jsonpatch=require(_0xe820('0x3'));var rp=require(_0xe820('0x4'));var moment=require(_0xe820('0x5'));var BPromise=require(_0xe820('0x6'));var Mustache=require(_0xe820('0x7'));var util=require(_0xe820('0x8'));var path=require(_0xe820('0x9'));var sox=require(_0xe820('0xa'));var csv=require('to-csv');var ejs=require(_0xe820('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe820('0xc'));var crypto=require(_0xe820('0xd'));var jsforce=require(_0xe820('0xe'));var deskjs=require(_0xe820('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe820('0x10'));var Redis=require(_0xe820('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe820('0x12'));var as=require(_0xe820('0x13'));var hardwareService=require(_0xe820('0x14'));var logger=require(_0xe820('0x15'))('api');var utils=require(_0xe820('0x16'));var config=require(_0xe820('0x17'));var licenseUtil=require(_0xe820('0x18'));var db=require(_0xe820('0x19'))['db'];var jayson=require(_0xe820('0x1a'));var client=jayson['client'][_0xe820('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x167a0e,_0x3220b2,_0x1c083e,_0x151b06){return new BPromise(function(_0x2b4208,_0x16d0e5){var _0x2745de=_0x151b06||client;return _0x2745de[_0xe820('0x1c')](_0x167a0e,_0x1c083e)[_0xe820('0x1d')](function(_0x5cfce8){logger['info']('Network,\x20%s,\x20%s',_0x3220b2,_0xe820('0x1e'));logger['debug'](_0xe820('0x1f'),_0x3220b2,_0xe820('0x1e'),JSON[_0xe820('0x20')](_0x5cfce8));if(_0x5cfce8['error']){if(_0x5cfce8['error'][_0xe820('0x21')]===0x1f4){logger[_0xe820('0x22')](_0xe820('0x23'),_0x3220b2,_0x5cfce8['error'][_0xe820('0x24')]);return _0x16d0e5(_0x5cfce8[_0xe820('0x22')][_0xe820('0x24')]);}logger[_0xe820('0x22')](_0xe820('0x23'),_0x3220b2,_0x5cfce8['error'][_0xe820('0x24')]);return _0x2b4208(_0x5cfce8[_0xe820('0x22')][_0xe820('0x24')]);}else{logger['info'](_0xe820('0x23'),_0x3220b2,_0xe820('0x1e'));_0x2b4208(_0x5cfce8[_0xe820('0x25')]['message']);}})[_0xe820('0x26')](function(_0x2e45a3){logger['error'](_0xe820('0x23'),_0x3220b2,_0x2e45a3);_0x16d0e5(_0x2e45a3);});});}function respondWithStatusCode(_0xa6972d,_0x40f942){_0x40f942=_0x40f942||0xcc;return function(_0x59888f){if(_0x59888f){return _0xa6972d[_0xe820('0x27')](_0x40f942);}return _0xa6972d[_0xe820('0x28')](_0x40f942)[_0xe820('0x29')]();};}function respondWithResult(_0x56d1a6,_0x19517c){_0x19517c=_0x19517c||0xc8;return function(_0x13f1c6){if(_0x13f1c6){return _0x56d1a6['status'](_0x19517c)[_0xe820('0x2a')](_0x13f1c6);}};}function respondWithFilteredResult(_0x3eb8d5,_0x4fba68){return function(_0x5c83c0){if(_0x5c83c0){var _0x25f016=_0x5c83c0[_0xe820('0x2b')],_0x2d4372=_0x4fba68[_0xe820('0x2c')],_0x5912c1=_0x4fba68[_0xe820('0x2c')]+_0x4fba68[_0xe820('0x2d')],_0x14dd61;if(_0x5912c1>=_0x25f016){_0x5912c1=_0x25f016;_0x14dd61=0xc8;}else{_0x14dd61=0xce;}_0x3eb8d5['status'](_0x14dd61);return _0x3eb8d5[_0xe820('0x2e')](_0xe820('0x2f'),_0x2d4372+'-'+_0x5912c1+'/'+_0x25f016)[_0xe820('0x2a')](_0x5c83c0);}return null;};}function patchUpdates(_0x3c3b2d){return function(_0x55ab9e){try{jsonpatch[_0xe820('0x30')](_0x55ab9e,_0x3c3b2d,!![]);}catch(_0x487d60){return BPromise[_0xe820('0x31')](_0x487d60);}return _0x55ab9e[_0xe820('0x32')]();};}function saveUpdates(_0x11beb7,_0x573b08){return function(_0x5a70b4){if(_0x5a70b4){return _0x5a70b4['update'](_0x11beb7)[_0xe820('0x1d')](function(_0x2abe1f){return _0x2abe1f;});}return null;};}function removeEntity(_0x3c7625,_0x495107){return function(_0x384329){if(_0x384329){return _0x384329[_0xe820('0x33')]()[_0xe820('0x1d')](function(){_0x3c7625[_0xe820('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5acb32,_0x530c0a){return function(_0x227964){if(!_0x227964){_0x5acb32['sendStatus'](0x194);}return _0x227964;};}function handleError(_0x4fa322,_0x103cf4){_0x103cf4=_0x103cf4||0x1f4;return function(_0x336b5d){logger[_0xe820('0x22')](_0x336b5d[_0xe820('0x34')]);if(_0x336b5d[_0xe820('0x35')]){delete _0x336b5d[_0xe820('0x35')];}_0x4fa322[_0xe820('0x28')](_0x103cf4)[_0xe820('0x36')](_0x336b5d);};}exports[_0xe820('0x37')]=function(_0x3b03d8,_0x2d9368){var _0x37cf1d={},_0x3f92a5={},_0x5d5368={'count':0x0,'rows':[]};var _0x55ba29=_[_0xe820('0x38')](db[_0xe820('0x39')]['rawAttributes'],function(_0x4db973){return{'name':_0x4db973[_0xe820('0x3a')],'type':_0x4db973[_0xe820('0x3b')][_0xe820('0x3c')]};});_0x3f92a5['model']=_[_0xe820('0x38')](_0x55ba29,_0xe820('0x35'));_0x3f92a5[_0xe820('0x3d')]=_[_0xe820('0x3e')](_0x3b03d8[_0xe820('0x3d')]);_0x3f92a5['filters']=_['intersection'](_0x3f92a5[_0xe820('0x3f')],_0x3f92a5[_0xe820('0x3d')]);_0x37cf1d['attributes']=_[_0xe820('0x40')](_0x3f92a5[_0xe820('0x3f')],qs[_0xe820('0x41')](_0x3b03d8[_0xe820('0x3d')][_0xe820('0x41')]));_0x37cf1d[_0xe820('0x42')]=_0x37cf1d['attributes'][_0xe820('0x43')]?_0x37cf1d[_0xe820('0x42')]:_0x3f92a5[_0xe820('0x3f')];if(!_0x3b03d8[_0xe820('0x3d')][_0xe820('0x44')](_0xe820('0x45'))){_0x37cf1d[_0xe820('0x2d')]=qs[_0xe820('0x2d')](_0x3b03d8[_0xe820('0x3d')][_0xe820('0x2d')]);_0x37cf1d['offset']=qs[_0xe820('0x2c')](_0x3b03d8['query'][_0xe820('0x2c')]);}_0x37cf1d[_0xe820('0x46')]=qs['sort'](_0x3b03d8['query']['sort']);_0x37cf1d[_0xe820('0x47')]=qs[_0xe820('0x48')](_[_0xe820('0x49')](_0x3b03d8[_0xe820('0x3d')],_0x3f92a5[_0xe820('0x48')]),_0x55ba29);if(_0x3b03d8[_0xe820('0x3d')][_0xe820('0x4a')]){_0x37cf1d['where']=_['merge'](_0x37cf1d[_0xe820('0x47')],{'$or':_[_0xe820('0x38')](_0x55ba29,function(_0x564214){if(_0x564214[_0xe820('0x3b')]!==_0xe820('0x4b')){var _0x2ce5a8={};_0x2ce5a8[_0x564214[_0xe820('0x35')]]={'$like':'%'+_0x3b03d8[_0xe820('0x3d')]['filter']+'%'};return _0x2ce5a8;}})});}_0x37cf1d=_['merge']({},_0x37cf1d,_0x3b03d8[_0xe820('0x4c')]);var _0x42aa46={'where':_0x37cf1d[_0xe820('0x47')]};return db[_0xe820('0x39')]['count'](_0x42aa46)[_0xe820('0x1d')](function(_0x52b350){_0x5d5368['count']=_0x52b350;if(_0x3b03d8[_0xe820('0x3d')][_0xe820('0x4d')]){_0x37cf1d[_0xe820('0x4e')]=[{'all':!![]}];}return db['Network'][_0xe820('0x4f')](_0x37cf1d);})['then'](function(_0x435ec4){_0x5d5368['rows']=_0x435ec4;return _0x5d5368;})[_0xe820('0x1d')](respondWithFilteredResult(_0x2d9368,_0x37cf1d))['catch'](handleError(_0x2d9368,null));};exports[_0xe820('0x50')]=function(_0x541ca0,_0x570806){var _0x220c5f={'raw':!![],'where':{'id':_0x541ca0[_0xe820('0x51')]['id']}},_0x556d58={};_0x556d58[_0xe820('0x3f')]=_[_0xe820('0x3e')](db[_0xe820('0x39')][_0xe820('0x52')]);_0x556d58[_0xe820('0x3d')]=_[_0xe820('0x3e')](_0x541ca0['query']);_0x556d58['filters']=_[_0xe820('0x40')](_0x556d58[_0xe820('0x3f')],_0x556d58[_0xe820('0x3d')]);_0x220c5f[_0xe820('0x42')]=_[_0xe820('0x40')](_0x556d58[_0xe820('0x3f')],qs[_0xe820('0x41')](_0x541ca0[_0xe820('0x3d')][_0xe820('0x41')]));_0x220c5f[_0xe820('0x42')]=_0x220c5f[_0xe820('0x42')][_0xe820('0x43')]?_0x220c5f[_0xe820('0x42')]:_0x556d58['model'];if(_0x541ca0['query'][_0xe820('0x4d')]){_0x220c5f[_0xe820('0x4e')]=[{'all':!![]}];}_0x220c5f=_['merge']({},_0x220c5f,_0x541ca0[_0xe820('0x4c')]);return db[_0xe820('0x39')][_0xe820('0x53')](_0x220c5f)[_0xe820('0x1d')](handleEntityNotFound(_0x570806,null))[_0xe820('0x1d')](respondWithResult(_0x570806,null))['catch'](handleError(_0x570806,null));};exports[_0xe820('0x54')]=function(_0x2194eb,_0x235cdd,_0x37a448){var _0x9775b5;return db['sequelize'][_0xe820('0x55')](function(_0x16ce34){return db['Network'][_0xe820('0x54')](_0x2194eb[_0xe820('0x56')],{'raw':!![]})[_0xe820('0x1d')](function(_0x1a30ef){_0x9775b5=_0x1a30ef;return db[_0xe820('0x39')][_0xe820('0x4f')]({'where':{'type':_0x2194eb[_0xe820('0x56')][_0xe820('0x3b')]},'raw':!![]});})[_0xe820('0x1d')](function(_0xe01bd2){if(_0x9775b5[_0xe820('0x3b')]['toUpperCase']()==_0xe820('0x57')){var _0x5124f8=fs[_0xe820('0x58')](path['join'](config[_0xe820('0x59')],_0xe820('0x5a')),_0xe820('0x5b'));var _0x40206b=ejs[_0xe820('0x5c')](_0x5124f8,{'networks':_0xe01bd2||[]});fs[_0xe820('0x5d')](_0xe820('0x5e'),_0x40206b);return respondWithRpcPromise(_0xe820('0x5f'),'create',{'module':'res_stun_monitor.so'});}else if(_0x9775b5[_0xe820('0x3b')]['toUpperCase']()=='TURN'){var _0x56ca8e=fs['readFileSync'](path[_0xe820('0x60')](config[_0xe820('0x59')],_0xe820('0x61')),_0xe820('0x5b'));var _0x3cf185=ejs[_0xe820('0x5c')](_0x56ca8e,{'networks':_0xe01bd2||[]});fs[_0xe820('0x5d')](_0xe820('0x62'),_0x3cf185);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x54'),{'module':_0xe820('0x63')});}else{var _0x275d95=fs['readFileSync'](path['join'](config[_0xe820('0x59')],_0xe820('0x64')),_0xe820('0x5b'));var _0x382532=ejs[_0xe820('0x5c')](_0x275d95,{'networks':_0xe01bd2||[]});fs[_0xe820('0x5d')](util['format'](_0xe820('0x65'),_0x2194eb[_0xe820('0x56')]['type'][_0xe820('0x66')]()),_0x382532);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}return null;})[_0xe820('0x1d')](function(){return _0x9775b5;});})[_0xe820('0x1d')](respondWithResult(_0x235cdd,0xc9))[_0xe820('0x26')](handleError(_0x235cdd,null));};exports['update']=function(_0x2d94d0,_0x56dd3c,_0x31acaa){var _0x4b415e;return db[_0xe820('0x67')][_0xe820('0x55')](function(_0x80d037){return db[_0xe820('0x39')]['find']({'where':{'id':_0x2d94d0[_0xe820('0x51')]['id']}})['then'](handleEntityNotFound(_0x56dd3c,null))[_0xe820('0x1d')](saveUpdates(_0x2d94d0[_0xe820('0x56')],null))[_0xe820('0x1d')](function(_0x4d9ecc){if(_0x4d9ecc){_0x4b415e=_0x4d9ecc;return db[_0xe820('0x39')]['findAll']({'where':{'type':_0x4b415e[_0xe820('0x3b')]},'raw':!![]});}return null;})[_0xe820('0x1d')](function(_0x487e2f){if(_0x4b415e[_0xe820('0x3b')]['toUpperCase']()=='STUN'){var _0x584c35=fs[_0xe820('0x58')](path[_0xe820('0x60')](config[_0xe820('0x59')],_0xe820('0x5a')),_0xe820('0x5b'));var _0x2dfea7=ejs['render'](_0x584c35,{'networks':_0x487e2f||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2dfea7);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x68'),{'module':_0xe820('0x63')});}else if(_0x4b415e[_0xe820('0x3b')]['toUpperCase']()==_0xe820('0x69')){var _0xe442ee=fs[_0xe820('0x58')](path[_0xe820('0x60')](config[_0xe820('0x59')],_0xe820('0x61')),_0xe820('0x5b'));var _0x3de612=ejs[_0xe820('0x5c')](_0xe442ee,{'networks':_0x487e2f||[]});fs[_0xe820('0x5d')](_0xe820('0x62'),_0x3de612);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x68'),{'module':_0xe820('0x63')});}else{var _0x21fec1=fs[_0xe820('0x58')](path['join'](config[_0xe820('0x59')],'server/files/templates/network.ejs'),_0xe820('0x5b'));var _0xca5599=ejs[_0xe820('0x5c')](_0x21fec1,{'networks':_0x487e2f||[]});fs['writeFileSync'](util[_0xe820('0x6a')](_0xe820('0x65'),_0x2d94d0[_0xe820('0x56')][_0xe820('0x3b')]['toLowerCase']()),_0xca5599);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x68'),{'module':_0xe820('0x6b')});}return null;})[_0xe820('0x1d')](function(_0xe05ffc){if(_0xe05ffc){return _0x4b415e;}return null;});})[_0xe820('0x1d')](respondWithResult(_0x56dd3c,null))[_0xe820('0x26')](handleError(_0x56dd3c,null));};exports['destroy']=function(_0x195e06,_0xc451af,_0x6aaf81){var _0x320f9c;return db[_0xe820('0x39')][_0xe820('0x53')]({'where':{'id':_0x195e06[_0xe820('0x51')]['id']}})['then'](function(_0x349ee5){_0x320f9c=_0x349ee5;return _0x349ee5;})['then'](handleEntityNotFound(_0xc451af,null))[_0xe820('0x1d')](removeEntity(_0xc451af,null))[_0xe820('0x1d')](function(){if(_0x320f9c){return db['Network']['findAll']({'where':{'type':_0x320f9c['type']},'raw':!![]});}})[_0xe820('0x1d')](function(_0x580fcc){if(_0x320f9c[_0xe820('0x3b')][_0xe820('0x6c')]()==_0xe820('0x57')){var _0x440433=fs[_0xe820('0x58')](path[_0xe820('0x60')](config[_0xe820('0x59')],'server/files/templates/stun_multiple.ejs'),_0xe820('0x5b'));var _0x5a64fd=ejs[_0xe820('0x5c')](_0x440433,{'networks':_0x580fcc||[]});fs[_0xe820('0x5d')](_0xe820('0x5e'),_0x5a64fd);return respondWithRpcPromise(_0xe820('0x5f'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x320f9c[_0xe820('0x3b')][_0xe820('0x6c')]()==_0xe820('0x69')){var _0x3fd80b=fs['readFileSync'](path['join'](config[_0xe820('0x59')],_0xe820('0x61')),'utf8');var _0x558c60=ejs[_0xe820('0x5c')](_0x3fd80b,{'networks':_0x580fcc||[]});fs['writeFileSync'](_0xe820('0x62'),_0x558c60);return respondWithRpcPromise(_0xe820('0x5f'),_0xe820('0x33'),{'module':_0xe820('0x63')});}else{var _0x275289=fs[_0xe820('0x58')](path[_0xe820('0x60')](config['root'],_0xe820('0x64')),_0xe820('0x5b'));var _0x3365ef=ejs[_0xe820('0x5c')](_0x275289,{'networks':_0x580fcc||[]});fs[_0xe820('0x5d')](util[_0xe820('0x6a')](_0xe820('0x65'),_0x195e06[_0xe820('0x56')][_0xe820('0x3b')][_0xe820('0x66')]()),_0x3365ef);return respondWithRpcPromise('Reload',_0xe820('0x33'),{'module':'chan_sip.so'});}return null;})[_0xe820('0x26')](handleError(_0xc451af,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a214480..05c4cd0 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 _0x5c76=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','../../config/logger'];(function(_0x3f18a7,_0x412898){var _0x1d04ba=function(_0x1b4be7){while(--_0x1b4be7){_0x3f18a7['push'](_0x3f18a7['shift']());}};_0x1d04ba(++_0x412898);}(_0x5c76,0x83));var _0x65c7=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x5c76[_0x999b85];return _0x1d7124;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x65c7('0x0'))(_0x65c7('0x1'));var moment=require(_0x65c7('0x2'));var BPromise=require(_0x65c7('0x3'));var rp=require(_0x65c7('0x4'));var fs=require('fs');var path=require(_0x65c7('0x5'));var rimraf=require(_0x65c7('0x6'));var config=require(_0x65c7('0x7'));var attributes=require(_0x65c7('0x8'));module[_0x65c7('0x9')]=function(_0x5854de,_0x1c3bf0){return _0x5854de[_0x65c7('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf10d=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf10d,0x125));var _0xdf10=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xf10d[_0x533e4e];return _0x1f14bb;};'use strict';var _=require(_0xdf10('0x0'));var util=require(_0xdf10('0x1'));var logger=require(_0xdf10('0x2'))(_0xdf10('0x3'));var moment=require(_0xdf10('0x4'));var BPromise=require(_0xdf10('0x5'));var rp=require(_0xdf10('0x6'));var fs=require('fs');var path=require(_0xdf10('0x7'));var rimraf=require(_0xdf10('0x8'));var config=require(_0xdf10('0x9'));var attributes=require(_0xdf10('0xa'));module[_0xdf10('0xb')]=function(_0x413325,_0x6923f8){return _0x413325[_0xdf10('0xc')](_0xdf10('0xd'),attributes,{'tableName':_0xdf10('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 1207ee5..d7fe96d 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 _0x180a=['client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x57317d,_0x2bfde9){var _0x44a0fd=function(_0x5342ac){while(--_0x5342ac){_0x57317d['push'](_0x57317d['shift']());}};_0x44a0fd(++_0x2bfde9);}(_0x180a,0x148));var _0xa180=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x180a[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa180('0x0'));var BPromise=require(_0xa180('0x1'));var rs=require(_0xa180('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa180('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa180('0x4'))(_0xa180('0x5'));var config=require(_0xa180('0x6'));var jayson=require(_0xa180('0x7'));var client=jayson[_0xa180('0x8')][_0xa180('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a1f03,_0x2a9feb,_0x3e6f60){return new BPromise(function(_0x15bc29,_0x3a797b){return client['request'](_0x2a1f03,_0x3e6f60)[_0xa180('0xa')](function(_0x30eced){logger[_0xa180('0xb')](_0xa180('0xc'),_0x2a9feb,_0xa180('0xd'));logger[_0xa180('0xe')](_0xa180('0xf'),_0x2a9feb,_0xa180('0xd'),JSON[_0xa180('0x10')](_0x30eced));if(_0x30eced[_0xa180('0x11')]){if(_0x30eced[_0xa180('0x11')][_0xa180('0x12')]===0x1f4){logger[_0xa180('0x11')](_0xa180('0xc'),_0x2a9feb,_0x30eced[_0xa180('0x11')]['message']);return _0x3a797b(_0x30eced[_0xa180('0x11')][_0xa180('0x13')]);}logger[_0xa180('0x11')]('Network,\x20%s,\x20%s',_0x2a9feb,_0x30eced[_0xa180('0x11')][_0xa180('0x13')]);return _0x15bc29(_0x30eced[_0xa180('0x11')][_0xa180('0x13')]);}else{logger[_0xa180('0xb')]('Network,\x20%s,\x20%s',_0x2a9feb,'request\x20sent');_0x15bc29(_0x30eced['result'][_0xa180('0x13')]);}})[_0xa180('0x14')](function(_0x383940){logger[_0xa180('0x11')]('Network,\x20%s,\x20%s',_0x2a9feb,_0x383940);_0x3a797b(_0x383940);});});} \ No newline at end of file +var _0x2dd7=['error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x2dd7,0xad));var _0x72dd=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x2dd7[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0x72dd('0x0'));var util=require(_0x72dd('0x1'));var moment=require(_0x72dd('0x2'));var BPromise=require(_0x72dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72dd('0x4'));var db=require(_0x72dd('0x5'))['db'];var utils=require(_0x72dd('0x6'));var logger=require(_0x72dd('0x7'))(_0x72dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x72dd('0x9'));var client=jayson[_0x72dd('0xa')][_0x72dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e209c,_0x541bb0,_0x4ed1c2){return new BPromise(function(_0x43b195,_0x324b38){return client[_0x72dd('0xc')](_0x1e209c,_0x4ed1c2)['then'](function(_0x111599){logger['info'](_0x72dd('0xd'),_0x541bb0,_0x72dd('0xe'));logger[_0x72dd('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x541bb0,_0x72dd('0xe'),JSON['stringify'](_0x111599));if(_0x111599[_0x72dd('0x10')]){if(_0x111599[_0x72dd('0x10')][_0x72dd('0x11')]===0x1f4){logger[_0x72dd('0x10')]('Network,\x20%s,\x20%s',_0x541bb0,_0x111599[_0x72dd('0x10')][_0x72dd('0x12')]);return _0x324b38(_0x111599[_0x72dd('0x10')][_0x72dd('0x12')]);}logger['error'](_0x72dd('0xd'),_0x541bb0,_0x111599[_0x72dd('0x10')]['message']);return _0x43b195(_0x111599[_0x72dd('0x10')][_0x72dd('0x12')]);}else{logger[_0x72dd('0x13')](_0x72dd('0xd'),_0x541bb0,_0x72dd('0xe'));_0x43b195(_0x111599[_0x72dd('0x14')][_0x72dd('0x12')]);}})['catch'](function(_0x3ec374){logger[_0x72dd('0x10')](_0x72dd('0xd'),_0x541bb0,_0x3ec374);_0x324b38(_0x3ec374);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 68ed0ba..3795373 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 _0xd24b=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','util'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0xd24b,0x1c1));var _0xbd24=function(_0x226dc8,_0x3cd5fc){_0x226dc8=_0x226dc8-0x0;var _0x3c534f=_0xd24b[_0x226dc8];return _0x3c534f;};'use strict';var multer=require(_0xbd24('0x0'));var util=require(_0xbd24('0x1'));var path=require(_0xbd24('0x2'));var timeout=require(_0xbd24('0x3'));var express=require('express');var router=express[_0xbd24('0x4')]();var auth=require(_0xbd24('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd24('0x6'));var controller=require(_0xbd24('0x7'));router[_0xbd24('0x8')]('/',auth[_0xbd24('0x9')](),controller[_0xbd24('0xa')]);module['exports']=router; \ No newline at end of file +var _0x826a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./notification.controller','sendNotification','exports','multer','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x826a,0x154));var _0xa826=function(_0x3e6465,_0x206f76){_0x3e6465=_0x3e6465-0x0;var _0x202c47=_0x826a[_0x3e6465];return _0x202c47;};'use strict';var multer=require(_0xa826('0x0'));var util=require('util');var path=require(_0xa826('0x1'));var timeout=require(_0xa826('0x2'));var express=require('express');var router=express[_0xa826('0x3')]();var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router['post']('/',auth['isAuthenticated'](),controller[_0xa826('0x7')]);module[_0xa826('0x8')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index bf5db7a..685a740 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 _0xb6a7=['exports','TEXT','STRING','sequelize'];(function(_0x58da8d,_0x462e9d){var _0x549771=function(_0x79c9e1){while(--_0x79c9e1){_0x58da8d['push'](_0x58da8d['shift']());}};_0x549771(++_0x462e9d);}(_0xb6a7,0xaf));var _0x7b6a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb6a7[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x7b6a('0x0'));module[_0x7b6a('0x1')]={'body':{'type':Sequelize[_0x7b6a('0x2')]},'senderName':{'type':Sequelize[_0x7b6a('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x7b6a('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x247f=['sequelize','exports','TEXT','STRING'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x247f,0x1ec));var _0xf247=function(_0x4b953a,_0xfa4b35){_0x4b953a=_0x4b953a-0x0;var _0x523513=_0x247f[_0x4b953a];return _0x523513;};'use strict';var Sequelize=require(_0xf247('0x0'));module[_0xf247('0x1')]={'body':{'type':Sequelize[_0xf247('0x2')]},'senderName':{'type':Sequelize[_0xf247('0x3')]},'recipientsId':{'type':Sequelize[_0xf247('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 9c62618..d9eae6e 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 _0x7952=['beep','SenderId','sortBy','join','sequelize','transaction','Notification','forEach','emit','notification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','User','queue','replace','Queue','ids','push','all','union','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./notification.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','end','error','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','view','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0x7952,0x197));var _0x2795=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x7952[_0xe1b5f6];return _0x44636e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2795('0x0'));var rimraf=require(_0x2795('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2795('0x2'));var rp=require(_0x2795('0x3'));var moment=require(_0x2795('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2795('0x5'));var util=require('util');var path=require(_0x2795('0x6'));var sox=require(_0x2795('0x7'));var csv=require('to-csv');var ejs=require(_0x2795('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2795('0x9'));var crypto=require('crypto');var jsforce=require(_0x2795('0xa'));var deskjs=require(_0x2795('0xb'));var toCsv=require(_0x2795('0xc'));var querystring=require(_0x2795('0xd'));var Papa=require(_0x2795('0xe'));var Redis=require(_0x2795('0xf'));var authService=require(_0x2795('0x10'));var qs=require(_0x2795('0x11'));var as=require(_0x2795('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2795('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2795('0x14'));var licenseUtil=require(_0x2795('0x15'));var db=require(_0x2795('0x16'))['db'];config[_0x2795('0x17')]=_[_0x2795('0x18')](config[_0x2795('0x17')],{'host':_0x2795('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2795('0x17')]));require(_0x2795('0x1a'))[_0x2795('0x1b')](socket);function respondWithStatusCode(_0x588149,_0x245a3c){_0x245a3c=_0x245a3c||0xcc;return function(_0x1a1d02){if(_0x1a1d02){return _0x588149[_0x2795('0x1c')](_0x245a3c);}return _0x588149[_0x2795('0x1d')](_0x245a3c)['end']();};}function respondWithResult(_0xccb963,_0x635821){_0x635821=_0x635821||0xc8;return function(_0x9f6f7d){if(_0x9f6f7d){return _0xccb963[_0x2795('0x1d')](_0x635821)[_0x2795('0x1e')](_0x9f6f7d);}};}function respondWithFilteredResult(_0x4cfa14,_0x36d15c){return function(_0x445e00){if(_0x445e00){var _0x4f285a=_0x445e00[_0x2795('0x1f')],_0xf56c54=_0x36d15c[_0x2795('0x20')],_0x134fea=_0x36d15c[_0x2795('0x20')]+_0x36d15c['limit'],_0x30e20e;if(_0x134fea>=_0x4f285a){_0x134fea=_0x4f285a;_0x30e20e=0xc8;}else{_0x30e20e=0xce;}_0x4cfa14[_0x2795('0x1d')](_0x30e20e);return _0x4cfa14[_0x2795('0x21')](_0x2795('0x22'),_0xf56c54+'-'+_0x134fea+'/'+_0x4f285a)[_0x2795('0x1e')](_0x445e00);}return null;};}function patchUpdates(_0x1e1901){return function(_0x236a6b){try{jsonpatch[_0x2795('0x23')](_0x236a6b,_0x1e1901,!![]);}catch(_0x1edea3){return BPromise[_0x2795('0x24')](_0x1edea3);}return _0x236a6b[_0x2795('0x25')]();};}function saveUpdates(_0xae8a2e,_0x1f4cff){return function(_0x568c24){if(_0x568c24){return _0x568c24['update'](_0xae8a2e)[_0x2795('0x26')](function(_0x2c3a28){return _0x2c3a28;});}return null;};}function removeEntity(_0x4b9ce3,_0x755dc2){return function(_0x11a17c){if(_0x11a17c){return _0x11a17c['destroy']()[_0x2795('0x26')](function(){_0x4b9ce3[_0x2795('0x1d')](0xcc)[_0x2795('0x27')]();});}};}function handleEntityNotFound(_0xc71b7a,_0x477c52){return function(_0x3ab6b3){if(!_0x3ab6b3){_0xc71b7a[_0x2795('0x1c')](0x194);}return _0x3ab6b3;};}function handleError(_0x467141,_0x4ac50d){_0x4ac50d=_0x4ac50d||0x1f4;return function(_0x478b84){logger[_0x2795('0x28')](_0x478b84['stack']);if(_0x478b84[_0x2795('0x29')]){delete _0x478b84['name'];}_0x467141[_0x2795('0x1d')](_0x4ac50d)[_0x2795('0x2a')](_0x478b84);};}exports[_0x2795('0x2b')]=function(_0x1c58b6,_0x20f55c,_0x33d978){if(!_0x1c58b6['body'][_0x2795('0x2c')](_0x2795('0x2d'))&&!_0x1c58b6[_0x2795('0x2e')]['hasOwnProperty'](_0x2795('0x2f'))){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1c58b6[_0x2795('0x2e')][_0x2795('0x2c')](_0x2795('0x2f'))&&!_0x1c58b6[_0x2795('0x2e')][_0x2795('0x2c')](_0x2795('0x32'))){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1c58b6['body'][_0x2795('0x2c')](_0x2795('0x33'))){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1b060b=JSON['parse'](_0x1c58b6[_0x2795('0x2e')]['recipients']);}catch(_0x284e05){logger[_0x2795('0x28')](_0x284e05);throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))](_0x2795('0x34'));}var _0x125358=[_0x2795('0x35'),'faxqueue',_0x2795('0x36'),'openchannelqueue',_0x2795('0x37'),_0x2795('0x38'),_0x2795('0x39'),_0x2795('0x3a'),'user'];if(_[_0x2795('0x3b')](_0x1b060b,function(_0x40a0ae){return!_[_0x2795('0x3c')](_0x125358,_0x40a0ae[_0x2795('0x3d')][_0x2795('0x3e')]());})){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))](_0x2795('0x3f'));}}}var _0x3c12f4={};_0x3c12f4[_0x2795('0x40')]=_0x1c58b6[_0x2795('0x2e')][_0x2795('0x2c')](_0x2795('0x40'))?_0x1c58b6[_0x2795('0x2e')][_0x2795('0x40')]:_0x1c58b6[_0x2795('0x41')]['fullname'];_0x3c12f4[_0x2795('0x42')]=_[_0x2795('0x43')](_0x1c58b6[_0x2795('0x2e')][_0x2795('0x42')])?null:_0x1c58b6[_0x2795('0x2e')][_0x2795('0x42')];_0x3c12f4[_0x2795('0x44')]=_0x1c58b6[_0x2795('0x2e')][_0x2795('0x44')]||![];_0x3c12f4[_0x2795('0x45')]=_0x1c58b6[_0x2795('0x41')]['id'];return getContent(_0x1c58b6[_0x2795('0x2e')])[_0x2795('0x26')](function(_0x1ef384){_0x3c12f4[_0x2795('0x2e')]=_0x1ef384;return getRecipients(_0x1b060b);})[_0x2795('0x26')](function(_0x240edf){_0x3c12f4['recipientsId']=_[_0x2795('0x46')](_0x240edf)[_0x2795('0x47')](',');return db[_0x2795('0x48')][_0x2795('0x49')](function(_0x132617){return db[_0x2795('0x4a')]['create'](_0x3c12f4,{'raw':!![],'transaction':_0x132617})[_0x2795('0x26')](function(_0xa82982){var _0x124417={'sender':_0x3c12f4[_0x2795('0x40')],'description':_0x3c12f4[_0x2795('0x42')],'content':_0x3c12f4[_0x2795('0x2e')],'beep':_0x3c12f4[_0x2795('0x44')]};_0x240edf[_0x2795('0x4b')](function(_0x3763a3){_0x124417['recipient']=_0x3763a3;socket[_0x2795('0x4c')](_0x2795('0x4d'),_0x124417);});return _0xa82982;});});})[_0x2795('0x26')](respondWithResult(_0x20f55c,0xc9))[_0x2795('0x4e')](handleError(_0x20f55c,null));};function getContent(_0x25b5dc){return new BPromise(function(_0x14297a,_0x35020e){if(_0x25b5dc[_0x2795('0x2d')]){_0x14297a(_0x25b5dc[_0x2795('0x2d')]);return;}return db[_0x2795('0x4f')][_0x2795('0x50')]({'attributes':['html'],'where':{'id':_0x25b5dc[_0x2795('0x2f')]},'raw':!![]})[_0x2795('0x26')](function(_0x43f2f2){if(!_0x43f2f2)throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))](_0x2795('0x51'));var _0x4c9cb3=Mustache[_0x2795('0x52')](_0x43f2f2[_0x2795('0x53')],_0x25b5dc['view']);_0x14297a(_0x4c9cb3);})['catch'](function(_0x48dd4f){_0x35020e(_0x48dd4f);});});}function getRecipients(_0xcce20c){return new BPromise(function(_0x2f2c18,_0x5b13c9){var _0x2769e5=[];var _0x73c06=[];_0xcce20c[_0x2795('0x4b')](function(_0x43bfc6){var _0x1ea3c7=_['startCase'](_0x43bfc6[_0x2795('0x3d')][_0x2795('0x3e')]());if(_0x1ea3c7===_0x2795('0x54')){_0x2769e5=_['union'](_0x2769e5,_0x43bfc6['ids']);}else{if(_[_0x2795('0x3c')](_0x1ea3c7,_0x2795('0x55')))_0x1ea3c7=_0x1ea3c7[_0x2795('0x56')](_0x2795('0x55'),_0x2795('0x57'));_0x43bfc6[_0x2795('0x58')][_0x2795('0x4b')](function(_0x11563c){_0x73c06[_0x2795('0x59')](getAgents(_0x1ea3c7,_0x11563c));});}});return BPromise[_0x2795('0x5a')](_0x73c06)['then'](function(_0x101294){_0x2769e5=_[_0x2795('0x5b')](_0x2769e5,_[_0x2795('0x5c')](_0x101294));_0x2f2c18(_0x2769e5);})[_0x2795('0x4e')](function(_0x386815){_0x5b13c9(_0x386815);});});}function getAgents(_0x180df5,_0x15e5af){return new BPromise(function(_0x547acc,_0x42f787){return db[_0x180df5][_0x2795('0x50')]({'where':{'id':_0x15e5af}})[_0x2795('0x26')](function(_0x50c3e4){return _0x50c3e4[_0x2795('0x5d')]({'attributes':['id'],'raw':!![]})[_0x2795('0x26')](function(_0x30a2c4){var _0x57300a=_[_0x2795('0x5e')](_0x30a2c4,'id');_0x547acc(_0x57300a);});})[_0x2795('0x4e')](function(_0x1fd763){_0x42f787(_0x1fd763);});});} \ No newline at end of file +var _0x8ee4=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','json','offset','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','voicequeue','whatsappqueue','team','user','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','Notification','create','forEach','recipient','emit','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','union','ids','queue','replace','push','all','flatten','getAgents','map','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x4bea66,_0x1b18e5){var _0x54abf7=function(_0x3cdb99){while(--_0x3cdb99){_0x4bea66['push'](_0x4bea66['shift']());}};_0x54abf7(++_0x1b18e5);}(_0x8ee4,0x115));var _0x48ee=function(_0x30f154,_0x2fac7c){_0x30f154=_0x30f154-0x0;var _0x27e67b=_0x8ee4[_0x30f154];return _0x27e67b;};'use strict';var pdf=require(_0x48ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x48ee('0x1'));var zipdir=require(_0x48ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48ee('0x3'));var moment=require('moment');var BPromise=require(_0x48ee('0x4'));var Mustache=require(_0x48ee('0x5'));var util=require(_0x48ee('0x6'));var path=require('path');var sox=require(_0x48ee('0x7'));var csv=require(_0x48ee('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x48ee('0x9'));var squel=require(_0x48ee('0xa'));var crypto=require(_0x48ee('0xb'));var jsforce=require(_0x48ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x48ee('0x8'));var querystring=require(_0x48ee('0xd'));var Papa=require(_0x48ee('0xe'));var Redis=require(_0x48ee('0xf'));var authService=require(_0x48ee('0x10'));var qs=require(_0x48ee('0x11'));var as=require(_0x48ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48ee('0x13'))(_0x48ee('0x14'));var utils=require(_0x48ee('0x15'));var config=require(_0x48ee('0x16'));var licenseUtil=require(_0x48ee('0x17'));var db=require(_0x48ee('0x18'))['db'];config[_0x48ee('0x19')]=_[_0x48ee('0x1a')](config[_0x48ee('0x19')],{'host':_0x48ee('0x1b'),'port':0x18eb});var socket=require(_0x48ee('0x1c'))(new Redis(config[_0x48ee('0x19')]));require(_0x48ee('0x1d'))[_0x48ee('0x1e')](socket);function respondWithStatusCode(_0x27a6a2,_0x17e6dc){_0x17e6dc=_0x17e6dc||0xcc;return function(_0x281593){if(_0x281593){return _0x27a6a2[_0x48ee('0x1f')](_0x17e6dc);}return _0x27a6a2[_0x48ee('0x20')](_0x17e6dc)['end']();};}function respondWithResult(_0x5f288a,_0x38d51a){_0x38d51a=_0x38d51a||0xc8;return function(_0xfd75f5){if(_0xfd75f5){return _0x5f288a[_0x48ee('0x20')](_0x38d51a)[_0x48ee('0x21')](_0xfd75f5);}};}function respondWithFilteredResult(_0x4191f3,_0x590303){return function(_0x2060b3){if(_0x2060b3){var _0x24d542=_0x2060b3['count'],_0x5be550=_0x590303[_0x48ee('0x22')],_0x5da5a9=_0x590303[_0x48ee('0x22')]+_0x590303['limit'],_0x10e9a5;if(_0x5da5a9>=_0x24d542){_0x5da5a9=_0x24d542;_0x10e9a5=0xc8;}else{_0x10e9a5=0xce;}_0x4191f3[_0x48ee('0x20')](_0x10e9a5);return _0x4191f3['set'](_0x48ee('0x23'),_0x5be550+'-'+_0x5da5a9+'/'+_0x24d542)[_0x48ee('0x21')](_0x2060b3);}return null;};}function patchUpdates(_0xacb2da){return function(_0x17a17c){try{jsonpatch[_0x48ee('0x24')](_0x17a17c,_0xacb2da,!![]);}catch(_0x3eec09){return BPromise[_0x48ee('0x25')](_0x3eec09);}return _0x17a17c['save']();};}function saveUpdates(_0x536536,_0x2fa22e){return function(_0x44db4a){if(_0x44db4a){return _0x44db4a[_0x48ee('0x26')](_0x536536)['then'](function(_0x191854){return _0x191854;});}return null;};}function removeEntity(_0xdde82f,_0x3cf1fd){return function(_0x659d42){if(_0x659d42){return _0x659d42[_0x48ee('0x27')]()[_0x48ee('0x28')](function(){_0xdde82f[_0x48ee('0x20')](0xcc)[_0x48ee('0x29')]();});}};}function handleEntityNotFound(_0x127bba,_0x363aed){return function(_0x3d3a5b){if(!_0x3d3a5b){_0x127bba[_0x48ee('0x1f')](0x194);}return _0x3d3a5b;};}function handleError(_0x555e31,_0x28ea16){_0x28ea16=_0x28ea16||0x1f4;return function(_0x4488b2){logger[_0x48ee('0x2a')](_0x4488b2[_0x48ee('0x2b')]);if(_0x4488b2['name']){delete _0x4488b2[_0x48ee('0x2c')];}_0x555e31[_0x48ee('0x20')](_0x28ea16)[_0x48ee('0x2d')](_0x4488b2);};}exports['sendNotification']=function(_0x1ee82d,_0x31d69f,_0x42e672){if(!_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x2f')](_0x48ee('0x30'))&&!_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x2f')](_0x48ee('0x31'))){throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x34'));}else{if(_0x1ee82d['body'][_0x48ee('0x2f')](_0x48ee('0x31'))&&!_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x2f')](_0x48ee('0x35'))){throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x36'));}if(!_0x1ee82d['body'][_0x48ee('0x2f')]('recipients')){throw new db['Sequelize'][(_0x48ee('0x33'))](_0x48ee('0x37'));}else{try{var _0x59356f=JSON[_0x48ee('0x38')](_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x39')]);}catch(_0x31d8ea){logger[_0x48ee('0x2a')](_0x31d8ea);throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x3a'));}var _0x27b37b=['chatqueue',_0x48ee('0x3b'),_0x48ee('0x3c'),'openchannelqueue','smsqueue',_0x48ee('0x3d'),_0x48ee('0x3e'),_0x48ee('0x3f'),_0x48ee('0x40')];if(_['some'](_0x59356f,function(_0x1d6609){return!_['includes'](_0x27b37b,_0x1d6609['model']['toLowerCase']());})){throw new db[(_0x48ee('0x32'))][(_0x48ee('0x33'))](_0x48ee('0x41'));}}}var _0x5a343a={};_0x5a343a[_0x48ee('0x42')]=_0x1ee82d[_0x48ee('0x2e')]['hasOwnProperty']('senderName')?_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x42')]:_0x1ee82d['user'][_0x48ee('0x43')];_0x5a343a[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x44')])?null:_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x44')];_0x5a343a['beep']=_0x1ee82d[_0x48ee('0x2e')][_0x48ee('0x46')]||![];_0x5a343a[_0x48ee('0x47')]=_0x1ee82d[_0x48ee('0x40')]['id'];return getContent(_0x1ee82d[_0x48ee('0x2e')])[_0x48ee('0x28')](function(_0x25acd7){_0x5a343a[_0x48ee('0x2e')]=_0x25acd7;return getRecipients(_0x59356f);})['then'](function(_0x45d1b1){_0x5a343a[_0x48ee('0x48')]=_[_0x48ee('0x49')](_0x45d1b1)[_0x48ee('0x4a')](',');return db['sequelize'][_0x48ee('0x4b')](function(_0x2e94ca){return db[_0x48ee('0x4c')][_0x48ee('0x4d')](_0x5a343a,{'raw':!![],'transaction':_0x2e94ca})[_0x48ee('0x28')](function(_0x1ef8a3){var _0x70760f={'sender':_0x5a343a[_0x48ee('0x42')],'description':_0x5a343a[_0x48ee('0x44')],'content':_0x5a343a['body'],'beep':_0x5a343a[_0x48ee('0x46')]};_0x45d1b1[_0x48ee('0x4e')](function(_0x465c0c){_0x70760f[_0x48ee('0x4f')]=_0x465c0c;socket[_0x48ee('0x50')](_0x48ee('0x51'),_0x70760f);});return _0x1ef8a3;});});})[_0x48ee('0x28')](respondWithResult(_0x31d69f,0xc9))['catch'](handleError(_0x31d69f,null));};function getContent(_0x167f04){return new BPromise(function(_0x4a18a1,_0xa15caa){if(_0x167f04[_0x48ee('0x30')]){_0x4a18a1(_0x167f04[_0x48ee('0x30')]);return;}return db[_0x48ee('0x52')][_0x48ee('0x53')]({'attributes':[_0x48ee('0x54')],'where':{'id':_0x167f04['TemplateId']},'raw':!![]})[_0x48ee('0x28')](function(_0x17e90c){if(!_0x17e90c)throw new db['Sequelize'][(_0x48ee('0x33'))](_0x48ee('0x55'));var _0x156b51=Mustache['render'](_0x17e90c[_0x48ee('0x54')],_0x167f04[_0x48ee('0x35')]);_0x4a18a1(_0x156b51);})[_0x48ee('0x56')](function(_0xc517fa){_0xa15caa(_0xc517fa);});});}function getRecipients(_0x336dd5){return new BPromise(function(_0x1772d0,_0x228b3e){var _0x20064d=[];var _0x10ce16=[];_0x336dd5[_0x48ee('0x4e')](function(_0x304f99){var _0x47d3e6=_['startCase'](_0x304f99['model']['toLowerCase']());if(_0x47d3e6==='User'){_0x20064d=_[_0x48ee('0x57')](_0x20064d,_0x304f99[_0x48ee('0x58')]);}else{if(_['includes'](_0x47d3e6,_0x48ee('0x59')))_0x47d3e6=_0x47d3e6[_0x48ee('0x5a')](_0x48ee('0x59'),'Queue');_0x304f99[_0x48ee('0x58')][_0x48ee('0x4e')](function(_0x4a7514){_0x10ce16[_0x48ee('0x5b')](getAgents(_0x47d3e6,_0x4a7514));});}});return BPromise[_0x48ee('0x5c')](_0x10ce16)['then'](function(_0x1fd09b){_0x20064d=_[_0x48ee('0x57')](_0x20064d,_[_0x48ee('0x5d')](_0x1fd09b));_0x1772d0(_0x20064d);})[_0x48ee('0x56')](function(_0x3bbaef){_0x228b3e(_0x3bbaef);});});}function getAgents(_0x22d7e4,_0x502a89){return new BPromise(function(_0x434b88,_0x33eb8c){return db[_0x22d7e4][_0x48ee('0x53')]({'where':{'id':_0x502a89}})['then'](function(_0xdd08d3){return _0xdd08d3[_0x48ee('0x5e')]({'attributes':['id'],'raw':!![]})[_0x48ee('0x28')](function(_0x51de36){var _0x25411d=_[_0x48ee('0x5f')](_0x51de36,'id');_0x434b88(_0x25411d);});})['catch'](function(_0x7da877){_0x33eb8c(_0x7da877);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 3ad5684..bc1fae6 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 _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x39b333,_0x247db1){var _0x4d361b=function(_0x26cd54){while(--_0x26cd54){_0x39b333['push'](_0x39b333['shift']());}};_0x4d361b(++_0x247db1);}(_0xdb28,0x106));var _0x8db2=function(_0x32fd0f,_0x43ae17){_0x32fd0f=_0x32fd0f-0x0;var _0x9815d8=_0xdb28[_0x32fd0f];return _0x9815d8;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x3c88fe,_0x1633d1){var _0x11f8fd=function(_0x2d9375){while(--_0x2d9375){_0x3c88fe['push'](_0x3c88fe['shift']());}};_0x11f8fd(++_0x1633d1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index c49f746..a51cd90 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 _0x269b=['rimraf','../../config/environment','./notification.attributes','Notification','notifications','../../config/logger','api','moment','path'];(function(_0x3e0fc8,_0x236a34){var _0x5c4ebb=function(_0x5b2f46){while(--_0x5b2f46){_0x3e0fc8['push'](_0x3e0fc8['shift']());}};_0x5c4ebb(++_0x236a34);}(_0x269b,0x1ac));var _0xb269=function(_0x3efd24,_0x307e53){_0x3efd24=_0x3efd24-0x0;var _0x5df6f2=_0x269b[_0x3efd24];return _0x5df6f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb269('0x0'))(_0xb269('0x1'));var moment=require(_0xb269('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb269('0x3'));var rimraf=require(_0xb269('0x4'));var config=require(_0xb269('0x5'));var attributes=require(_0xb269('0x6'));module['exports']=function(_0x5a9efa,_0x2c7cb0){return _0x5a9efa['define'](_0xb269('0x7'),attributes,{'tableName':_0xb269('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5fae=['utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','Notification','notifications'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5fae,0x121));var _0xe5fa=function(_0x58b399,_0x9d183a){_0x58b399=_0x58b399-0x0;var _0x4cccd5=_0x5fae[_0x58b399];return _0x4cccd5;};'use strict';var _=require(_0xe5fa('0x0'));var util=require(_0xe5fa('0x1'));var logger=require('../../config/logger')(_0xe5fa('0x2'));var moment=require(_0xe5fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5fa('0x4'));var fs=require('fs');var path=require(_0xe5fa('0x5'));var rimraf=require(_0xe5fa('0x6'));var config=require(_0xe5fa('0x7'));var attributes=require('./notification.attributes');module[_0xe5fa('0x8')]=function(_0x1e8bd9,_0x505337){return _0x1e8bd9['define'](_0xe5fa('0x9'),attributes,{'tableName':_0xe5fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe5fa('0xb')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 888b49d..fad13b5 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 _0x5ba5=['error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x51ce32,_0x31f60d){var _0x11b5fc=function(_0x3f4e3a){while(--_0x3f4e3a){_0x51ce32['push'](_0x51ce32['shift']());}};_0x11b5fc(++_0x31f60d);}(_0x5ba5,0x1b4));var _0x55ba=function(_0x450a0d,_0x21839f){_0x450a0d=_0x450a0d-0x0;var _0x41e651=_0x5ba5[_0x450a0d];return _0x41e651;};'use strict';var _=require(_0x55ba('0x0'));var util=require('util');var moment=require(_0x55ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x55ba('0x2'));var fs=require('fs');var Redis=require(_0x55ba('0x3'));var db=require(_0x55ba('0x4'))['db'];var utils=require(_0x55ba('0x5'));var logger=require(_0x55ba('0x6'))(_0x55ba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x55ba('0x8')]({'port':0x232a});config[_0x55ba('0x9')]=_[_0x55ba('0xa')](config[_0x55ba('0x9')],{'host':_0x55ba('0xb'),'port':0x18eb});var socket=require(_0x55ba('0xc'))(new Redis(config[_0x55ba('0x9')]));require(_0x55ba('0xd'))[_0x55ba('0xe')](socket);function respondWithRpcPromise(_0x137a6c,_0x12b655,_0x5a2348){return new BPromise(function(_0x2c3a65,_0xd46fdb){return client[_0x55ba('0xf')](_0x137a6c,_0x5a2348)[_0x55ba('0x10')](function(_0x2408bb){logger[_0x55ba('0x11')](_0x55ba('0x12'),_0x12b655,_0x55ba('0x13'));logger[_0x55ba('0x14')](_0x55ba('0x15'),_0x12b655,_0x55ba('0x13'),JSON[_0x55ba('0x16')](_0x2408bb));if(_0x2408bb[_0x55ba('0x17')]){if(_0x2408bb[_0x55ba('0x17')][_0x55ba('0x18')]===0x1f4){logger[_0x55ba('0x17')]('Notification,\x20%s,\x20%s',_0x12b655,_0x2408bb[_0x55ba('0x17')][_0x55ba('0x19')]);return _0xd46fdb(_0x2408bb['error'][_0x55ba('0x19')]);}logger[_0x55ba('0x17')]('Notification,\x20%s,\x20%s',_0x12b655,_0x2408bb['error']['message']);return _0x2c3a65(_0x2408bb[_0x55ba('0x17')][_0x55ba('0x19')]);}else{logger[_0x55ba('0x11')](_0x55ba('0x12'),_0x12b655,_0x55ba('0x13'));_0x2c3a65(_0x2408bb[_0x55ba('0x1a')][_0x55ba('0x19')]);}})['catch'](function(_0x687f7d){logger['error']('Notification,\x20%s,\x20%s',_0x12b655,_0x687f7d);_0xd46fdb(_0x687f7d);});});} \ No newline at end of file +var _0x9e1c=['client','http','defaults','redis','register','request','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9e1c,0x14a));var _0xc9e1=function(_0x1d3bd0,_0x3ded50){_0x1d3bd0=_0x1d3bd0-0x0;var _0x221cdb=_0x9e1c[_0x1d3bd0];return _0x221cdb;};'use strict';var _=require(_0xc9e1('0x0'));var util=require('util');var moment=require(_0xc9e1('0x1'));var BPromise=require(_0xc9e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9e1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9e1('0x4'))(_0xc9e1('0x5'));var config=require(_0xc9e1('0x6'));var jayson=require(_0xc9e1('0x7'));var client=jayson[_0xc9e1('0x8')][_0xc9e1('0x9')]({'port':0x232a});config['redis']=_[_0xc9e1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9e1('0xb')]));require('./notification.socket')[_0xc9e1('0xc')](socket);function respondWithRpcPromise(_0x3a2b3f,_0x1dce00,_0x3f41a1){return new BPromise(function(_0x30a7eb,_0x335d72){return client[_0xc9e1('0xd')](_0x3a2b3f,_0x3f41a1)[_0xc9e1('0xe')](function(_0xb58b40){logger[_0xc9e1('0xf')](_0xc9e1('0x10'),_0x1dce00,'request\x20sent');logger[_0xc9e1('0x11')](_0xc9e1('0x12'),_0x1dce00,_0xc9e1('0x13'),JSON[_0xc9e1('0x14')](_0xb58b40));if(_0xb58b40[_0xc9e1('0x15')]){if(_0xb58b40[_0xc9e1('0x15')][_0xc9e1('0x16')]===0x1f4){logger[_0xc9e1('0x15')]('Notification,\x20%s,\x20%s',_0x1dce00,_0xb58b40[_0xc9e1('0x15')]['message']);return _0x335d72(_0xb58b40['error'][_0xc9e1('0x17')]);}logger[_0xc9e1('0x15')](_0xc9e1('0x10'),_0x1dce00,_0xb58b40[_0xc9e1('0x15')]['message']);return _0x30a7eb(_0xb58b40['error']['message']);}else{logger[_0xc9e1('0xf')](_0xc9e1('0x10'),_0x1dce00,_0xc9e1('0x13'));_0x30a7eb(_0xb58b40[_0xc9e1('0x18')]['message']);}})[_0xc9e1('0x19')](function(_0x1bbd79){logger[_0xc9e1('0x15')](_0xc9e1('0x10'),_0x1dce00,_0x1bbd79);_0x335d72(_0x1bbd79);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 405d4f2..a0cba46 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 _0x3b07=['./notification.events','save','remove','emit','removeListener','length'];(function(_0x20ac3e,_0x1c2914){var _0x2f220d=function(_0x15f1fc){while(--_0x15f1fc){_0x20ac3e['push'](_0x20ac3e['shift']());}};_0x2f220d(++_0x1c2914);}(_0x3b07,0x1b6));var _0x73b0=function(_0x37e0d9,_0x17e912){_0x37e0d9=_0x37e0d9-0x0;var _0x5967c0=_0x3b07[_0x37e0d9];return _0x5967c0;};'use strict';var NotificationEvents=require(_0x73b0('0x0'));var events=[_0x73b0('0x1'),_0x73b0('0x2'),'update'];function createListener(_0x320f43,_0x5cc297){return function(_0x328598){_0x5cc297[_0x73b0('0x3')](_0x320f43,_0x328598);};}function removeListener(_0x942ad,_0x40b4cd){return function(){NotificationEvents[_0x73b0('0x4')](_0x942ad,_0x40b4cd);};}exports['register']=function(_0x5bec72){for(var _0x3566d7=0x0,_0x2e281b=events[_0x73b0('0x5')];_0x3566d7<_0x2e281b;_0x3566d7++){var _0xcae853=events[_0x3566d7];var _0x1cd971=createListener('notification:'+_0xcae853,_0x5bec72);NotificationEvents['on'](_0xcae853,_0x1cd971);}}; \ No newline at end of file +var _0xd575=['update','emit','removeListener','register','length','./notification.events'];(function(_0x624f98,_0x12488a){var _0x4e09ec=function(_0x5cb32f){while(--_0x5cb32f){_0x624f98['push'](_0x624f98['shift']());}};_0x4e09ec(++_0x12488a);}(_0xd575,0x12b));var _0x5d57=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0xd575[_0x336ca2];return _0xda59a6;};'use strict';var NotificationEvents=require(_0x5d57('0x0'));var events=['save','remove',_0x5d57('0x1')];function createListener(_0x379a63,_0x55f1df){return function(_0x30ea29){_0x55f1df[_0x5d57('0x2')](_0x379a63,_0x30ea29);};}function removeListener(_0x5ca101,_0x552a49){return function(){NotificationEvents[_0x5d57('0x3')](_0x5ca101,_0x552a49);};}exports[_0x5d57('0x4')]=function(_0x497b14){for(var _0x1cdbcc=0x0,_0x229944=events[_0x5d57('0x5')];_0x1cdbcc<_0x229944;_0x1cdbcc++){var _0x416546=events[_0x1cdbcc];var _0x13806f=createListener('notification:'+_0x416546,_0x497b14);NotificationEvents['on'](_0x416546,_0x13806f);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d08407a..5c8b97f 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 _0xc835=['path','connect-timeout','express','Router','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util'];(function(_0x30bd03,_0x240df7){var _0x578486=function(_0x28acb6){while(--_0x28acb6){_0x30bd03['push'](_0x30bd03['shift']());}};_0x578486(++_0x240df7);}(_0xc835,0xcb));var _0x5c83=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xc835[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x5c83('0x0'));var util=require(_0x5c83('0x1'));var path=require(_0x5c83('0x2'));var timeout=require(_0x5c83('0x3'));var express=require(_0x5c83('0x4'));var router=express[_0x5c83('0x5')]();var auth=require(_0x5c83('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c83('0x7'));router[_0x5c83('0x8')]('/',auth[_0x5c83('0x9')](),controller[_0x5c83('0xa')]);router[_0x5c83('0x8')](_0x5c83('0xb'),auth['isAuthenticated'](),controller[_0x5c83('0xc')]);router[_0x5c83('0x8')](_0x5c83('0xd'),auth[_0x5c83('0x9')](),controller[_0x5c83('0xe')]);router['get'](_0x5c83('0xf'),auth['isAuthenticated'](),controller[_0x5c83('0x10')]);router[_0x5c83('0x8')](_0x5c83('0x11'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x12')]);router['get'](_0x5c83('0x13'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x14')]);router['get'](_0x5c83('0x15'),auth['isAuthenticated'](),controller[_0x5c83('0x16')]);router[_0x5c83('0x8')](_0x5c83('0x17'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x18')]);router[_0x5c83('0x19')]('/',auth[_0x5c83('0x9')](),controller[_0x5c83('0x1a')]);router[_0x5c83('0x19')](_0x5c83('0xf'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x1b')]);router[_0x5c83('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x5c83('0x1c')]);router[_0x5c83('0x19')](_0x5c83('0x1d'),controller[_0x5c83('0x1e')]);router['post'](_0x5c83('0x13'),auth['isAuthenticated'](),controller[_0x5c83('0x1f')]);router['post'](_0x5c83('0x17'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x20')]);router[_0x5c83('0x19')]('/:id/send',auth['isAuthenticated'](),controller[_0x5c83('0x21')]);router[_0x5c83('0x22')]('/:id',auth[_0x5c83('0x9')](),controller[_0x5c83('0x23')]);router[_0x5c83('0x24')](_0x5c83('0xd'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x25')]);router[_0x5c83('0x24')]('/:id/dispositions',auth[_0x5c83('0x9')](),controller[_0x5c83('0x26')]);router['delete'](_0x5c83('0x11'),auth[_0x5c83('0x9')](),controller['removeAnswers']);router[_0x5c83('0x24')](_0x5c83('0x17'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x27')]);module[_0x5c83('0x28')]=router; \ No newline at end of file +var _0x4141=['connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','put','update','delete','removeAnswers','removeAgents','exports','multer','util'];(function(_0x4c0a0e,_0x2e4b1a){var _0x284bd0=function(_0x3b4f3d){while(--_0x3b4f3d){_0x4c0a0e['push'](_0x4c0a0e['shift']());}};_0x284bd0(++_0x2e4b1a);}(_0x4141,0x10e));var _0x1414=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4141[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x1414('0x0'));var util=require(_0x1414('0x1'));var path=require('path');var timeout=require(_0x1414('0x2'));var express=require(_0x1414('0x3'));var router=express[_0x1414('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1414('0x5'));var controller=require('./openchannelAccount.controller');router[_0x1414('0x6')]('/',auth[_0x1414('0x7')](),controller[_0x1414('0x8')]);router[_0x1414('0x6')]('/describe',auth[_0x1414('0x7')](),controller[_0x1414('0x9')]);router['get'](_0x1414('0xa'),auth[_0x1414('0x7')](),controller[_0x1414('0xb')]);router[_0x1414('0x6')](_0x1414('0xc'),auth[_0x1414('0x7')](),controller['getDispositions']);router[_0x1414('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1414('0xd')]);router[_0x1414('0x6')](_0x1414('0xe'),auth[_0x1414('0x7')](),controller['getApplications']);router[_0x1414('0x6')](_0x1414('0xf'),auth[_0x1414('0x7')](),controller['getInteractions']);router[_0x1414('0x6')](_0x1414('0x10'),auth[_0x1414('0x7')](),controller[_0x1414('0x11')]);router[_0x1414('0x12')]('/',auth['isAuthenticated'](),controller[_0x1414('0x13')]);router[_0x1414('0x12')](_0x1414('0xc'),auth['isAuthenticated'](),controller[_0x1414('0x14')]);router[_0x1414('0x12')](_0x1414('0x15'),auth[_0x1414('0x7')](),controller[_0x1414('0x16')]);router[_0x1414('0x12')](_0x1414('0x17'),controller[_0x1414('0x18')]);router['post'](_0x1414('0xe'),auth[_0x1414('0x7')](),controller['addApplications']);router[_0x1414('0x12')](_0x1414('0x10'),auth['isAuthenticated'](),controller[_0x1414('0x19')]);router[_0x1414('0x12')](_0x1414('0x1a'),auth[_0x1414('0x7')](),controller[_0x1414('0x1b')]);router[_0x1414('0x1c')](_0x1414('0xa'),auth[_0x1414('0x7')](),controller[_0x1414('0x1d')]);router['delete']('/:id',auth[_0x1414('0x7')](),controller['destroy']);router[_0x1414('0x1e')]('/:id/dispositions',auth[_0x1414('0x7')](),controller['removeDispositions']);router[_0x1414('0x1e')](_0x1414('0x15'),auth[_0x1414('0x7')](),controller[_0x1414('0x1f')]);router[_0x1414('0x1e')]('/:id/users',auth[_0x1414('0x7')](),controller[_0x1414('0x20')]);module[_0x1414('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 7bd4d39..0df63df 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 _0x10c1=['STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x10c1,0x72));var _0x110c=function(_0x5860b,_0x4d68df){_0x5860b=_0x5860b-0x0;var _0x5668a9=_0x10c1[_0x5860b];return _0x5668a9;};'use strict';var Sequelize=require(_0x110c('0x0'));var rs=require('randomstring');module[_0x110c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x110c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x110c('0x3')]},'token':{'type':Sequelize[_0x110c('0x3')],'defaultValue':function(){return rs[_0x110c('0x4')]();}},'replyUri':{'type':Sequelize[_0x110c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x110c('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x110c('0x5');}},'notificationSound':{'type':Sequelize[_0x110c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x110c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x110c('0x3')]},'queueTransfer':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x110c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x110c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x110c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x110c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![],'comment':_0x110c('0x9'),'set':function(_0x5ee902){if(!_0x5ee902)this[_0x110c('0xa')](_0x110c('0xb'),null);this[_0x110c('0xa')](_0x110c('0xc'),_0x5ee902);}}}; \ No newline at end of file +var _0xe934=['setDataValue','mandatoryDisposition','sequelize','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xe934,0x1af));var _0x4e93=function(_0x494f7f,_0x34a09b){_0x494f7f=_0x494f7f-0x0;var _0x18ebe4=_0xe934[_0x494f7f];return _0x18ebe4;};'use strict';var Sequelize=require(_0x4e93('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4e93('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4e93('0x2')],'defaultValue':function(){return rs[_0x4e93('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4e93('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4e93('0x4')],'defaultValue':function(){return _0x4e93('0x5');}},'notificationSound':{'type':Sequelize[_0x4e93('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4e93('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e93('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4e93('0x2')]},'queueTransfer':{'type':Sequelize[_0x4e93('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4e93('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4e93('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4e93('0x8'),'set':function(_0x4089ea){if(!_0x4089ea)this[_0x4e93('0x9')]('mandatoryDispositionPauseId',null);this[_0x4e93('0x9')](_0x4e93('0xa'),_0x4089ea);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 730c87a..ced4344 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 _0xae24=['Start','startRouting','EventManager','sequelize','transaction','findAndCountAll','getApplications','Owner','fullname','internal','Tags','color','tag','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','params','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','Sequelize','difference','createdAt','updatedAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','OpenchannelApplication','Applications','applications','orderBy','priority','asc','account','ListId','contact','firstName','threadId','OpenchannelInteraction','ContactId','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership'];(function(_0x36d9bb,_0x5bc18d){var _0x115720=function(_0x2e451f){while(--_0x2e451f){_0x36d9bb['push'](_0x36d9bb['shift']());}};_0x115720(++_0x5bc18d);}(_0xae24,0x182));var _0x4ae2=function(_0x212249,_0x16f5b8){_0x212249=_0x212249-0x0;var _0x3ad2bc=_0xae24[_0x212249];return _0x3ad2bc;};'use strict';var pdf=require(_0x4ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae2('0x4'));var util=require('util');var path=require(_0x4ae2('0x5'));var sox=require(_0x4ae2('0x6'));var csv=require(_0x4ae2('0x7'));var ejs=require(_0x4ae2('0x8'));var fs=require('fs');var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];config[_0x4ae2('0x15')]=_[_0x4ae2('0x16')](config[_0x4ae2('0x15')],{'host':_0x4ae2('0x17'),'port':0x18eb});var socket=require(_0x4ae2('0x18'))(new Redis(config[_0x4ae2('0x15')]));require(_0x4ae2('0x19'))[_0x4ae2('0x1a')](socket);var jayson=require(_0x4ae2('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x4ae2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xf834a1,_0x5f447a,_0x463765,_0x9fb8db){return new BPromise(function(_0x1fde63,_0x1d5a78){var _0x428d24=_0x9fb8db||client;return _0x428d24[_0x4ae2('0x1d')](_0xf834a1,_0x463765)[_0x4ae2('0x1e')](function(_0xdc8798){logger[_0x4ae2('0x1f')](_0x4ae2('0x20'),_0x5f447a,'request\x20sent');logger['debug'](_0x4ae2('0x21'),_0x5f447a,_0x4ae2('0x22'),JSON['stringify'](_0xdc8798));if(_0xdc8798[_0x4ae2('0x23')]){if(_0xdc8798[_0x4ae2('0x23')][_0x4ae2('0x24')]===0x1f4){logger[_0x4ae2('0x23')](_0x4ae2('0x20'),_0x5f447a,_0xdc8798['error'][_0x4ae2('0x25')]);return _0x1d5a78(_0xdc8798['error']['message']);}logger[_0x4ae2('0x23')](_0x4ae2('0x20'),_0x5f447a,_0xdc8798[_0x4ae2('0x23')][_0x4ae2('0x25')]);return _0x1fde63(_0xdc8798[_0x4ae2('0x23')]['message']);}else{logger[_0x4ae2('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x5f447a,_0x4ae2('0x22'));_0x1fde63(_0xdc8798[_0x4ae2('0x26')][_0x4ae2('0x25')]);}})['catch'](function(_0x43f112){logger[_0x4ae2('0x23')](_0x4ae2('0x20'),_0x5f447a,_0x43f112);_0x1d5a78(_0x43f112);});});}function respondWithStatusCode(_0x2aaa6f,_0x1c2934){_0x1c2934=_0x1c2934||0xcc;return function(_0x255772){if(_0x255772){return _0x2aaa6f['sendStatus'](_0x1c2934);}return _0x2aaa6f['status'](_0x1c2934)[_0x4ae2('0x27')]();};}function respondWithResult(_0x3030f8,_0x3fa514){_0x3fa514=_0x3fa514||0xc8;return function(_0x329588){if(_0x329588){return _0x3030f8[_0x4ae2('0x28')](_0x3fa514)[_0x4ae2('0x29')](_0x329588);}};}function respondWithFilteredResult(_0x57a377,_0x5ec1fd){return function(_0x3e2666){if(_0x3e2666){var _0x4e7741=_0x3e2666[_0x4ae2('0x2a')],_0x554cff=_0x5ec1fd['offset'],_0x5e9f03=_0x5ec1fd[_0x4ae2('0x2b')]+_0x5ec1fd[_0x4ae2('0x2c')],_0x1e2b2d;if(_0x5e9f03>=_0x4e7741){_0x5e9f03=_0x4e7741;_0x1e2b2d=0xc8;}else{_0x1e2b2d=0xce;}_0x57a377[_0x4ae2('0x28')](_0x1e2b2d);return _0x57a377[_0x4ae2('0x2d')](_0x4ae2('0x2e'),_0x554cff+'-'+_0x5e9f03+'/'+_0x4e7741)[_0x4ae2('0x29')](_0x3e2666);}return null;};}function patchUpdates(_0x26adce){return function(_0x269603){try{jsonpatch[_0x4ae2('0x2f')](_0x269603,_0x26adce,!![]);}catch(_0x3542df){return BPromise[_0x4ae2('0x30')](_0x3542df);}return _0x269603[_0x4ae2('0x31')]();};}function saveUpdates(_0x3ab303,_0x27c6d4){return function(_0x548a1){if(_0x548a1){return _0x548a1[_0x4ae2('0x32')](_0x3ab303)[_0x4ae2('0x1e')](function(_0x4bd47f){return _0x4bd47f;});}return null;};}function removeEntity(_0xdcd11e,_0x516e8c){return function(_0x3479a1){if(_0x3479a1){return _0x3479a1[_0x4ae2('0x33')]()['then'](function(){var _0x1516b8=_0x3479a1[_0x4ae2('0x34')]({'plain':!![]});var _0x1cd46d=_0x4ae2('0x35');return db['UserProfileResource'][_0x4ae2('0x33')]({'where':{'type':_0x1cd46d,'resourceId':_0x1516b8['id']}})[_0x4ae2('0x1e')](function(){return _0x3479a1;});})[_0x4ae2('0x1e')](function(){_0xdcd11e[_0x4ae2('0x28')](0xcc)[_0x4ae2('0x27')]();});}};}function handleEntityNotFound(_0x142ce7,_0x32e3ec){return function(_0x46f3a2){if(!_0x46f3a2){_0x142ce7[_0x4ae2('0x36')](0x194);}return _0x46f3a2;};}function handleError(_0x5c5c7d,_0x4275d5){_0x4275d5=_0x4275d5||0x1f4;return function(_0x47ee5d){logger[_0x4ae2('0x23')](_0x47ee5d[_0x4ae2('0x37')]);if(_0x47ee5d[_0x4ae2('0x38')]){delete _0x47ee5d[_0x4ae2('0x38')];}_0x5c5c7d[_0x4ae2('0x28')](_0x4275d5)[_0x4ae2('0x39')](_0x47ee5d);};}exports['index']=function(_0x38f12f,_0x700f27){var _0x20d755={'include':[{'model':db[_0x4ae2('0x3a')],'as':_0x4ae2('0x3b')}]},_0x2c3a60={},_0x49baf9={'count':0x0,'rows':[]};var _0x2f0d83=_[_0x4ae2('0x3c')](db[_0x4ae2('0x3d')][_0x4ae2('0x3e')],function(_0x1fdc61){return{'name':_0x1fdc61[_0x4ae2('0x3f')],'type':_0x1fdc61[_0x4ae2('0x40')][_0x4ae2('0x41')]};});_0x2c3a60[_0x4ae2('0x42')]=_['map'](_0x2f0d83,_0x4ae2('0x38'));_0x2c3a60[_0x4ae2('0x43')]=_[_0x4ae2('0x44')](_0x38f12f[_0x4ae2('0x43')]);_0x2c3a60['filters']=_['intersection'](_0x2c3a60[_0x4ae2('0x42')],_0x2c3a60[_0x4ae2('0x43')]);_0x20d755[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x2c3a60['model'],qs[_0x4ae2('0x47')](_0x38f12f[_0x4ae2('0x43')]['fields']));_0x20d755[_0x4ae2('0x45')]=_0x20d755[_0x4ae2('0x45')][_0x4ae2('0x48')]?_0x20d755['attributes']:_0x2c3a60[_0x4ae2('0x42')];if(!_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x20d755[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x2c')]);_0x20d755['offset']=qs[_0x4ae2('0x2b')](_0x38f12f[_0x4ae2('0x43')]['offset']);}_0x20d755[_0x4ae2('0x4b')]=qs[_0x4ae2('0x4c')](_0x38f12f['query'][_0x4ae2('0x4c')]);_0x20d755[_0x4ae2('0x4d')]=qs['filters'](_[_0x4ae2('0x4e')](_0x38f12f[_0x4ae2('0x43')],_0x2c3a60[_0x4ae2('0x4f')]),_0x2f0d83);if(_0x38f12f['query']['filter']){_0x20d755[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x20d755[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x2f0d83,function(_0x507f1d){if(_0x507f1d[_0x4ae2('0x40')]!==_0x4ae2('0x51')){var _0x163d75={};_0x163d75[_0x507f1d['name']]={'$like':'%'+_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x163d75;}})});}_0x20d755=_[_0x4ae2('0x50')]({},_0x20d755,_0x38f12f['options']);var _0x16bf0b={'where':_0x20d755[_0x4ae2('0x4d')]};return db[_0x4ae2('0x3d')][_0x4ae2('0x2a')](_0x16bf0b)[_0x4ae2('0x1e')](function(_0x1b3b0b){_0x49baf9[_0x4ae2('0x2a')]=_0x1b3b0b;if(_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x20d755[_0x4ae2('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x4ae2('0x55')](_0x20d755);})[_0x4ae2('0x1e')](function(_0x10db30){_0x49baf9[_0x4ae2('0x56')]=_0x10db30;return _0x49baf9;})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x700f27,_0x20d755))[_0x4ae2('0x57')](handleError(_0x700f27,null));};exports[_0x4ae2('0x58')]=function(_0x13cda3,_0x4ffe8d){var _0xe58384={'raw':![],'where':{'id':_0x13cda3['params']['id']},'include':[{'model':db[_0x4ae2('0x3a')],'as':_0x4ae2('0x3b')}]},_0x2215eb={};_0x2215eb['model']=_[_0x4ae2('0x44')](db['OpenchannelAccount'][_0x4ae2('0x3e')]);_0x2215eb['query']=_[_0x4ae2('0x44')](_0x13cda3[_0x4ae2('0x43')]);_0x2215eb[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x2215eb[_0x4ae2('0x42')],_0x2215eb[_0x4ae2('0x43')]);_0xe58384[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x2215eb[_0x4ae2('0x42')],qs['fields'](_0x13cda3[_0x4ae2('0x43')][_0x4ae2('0x47')]));_0xe58384[_0x4ae2('0x45')]=_0xe58384[_0x4ae2('0x45')]['length']?_0xe58384[_0x4ae2('0x45')]:_0x2215eb[_0x4ae2('0x42')];if(_0x13cda3[_0x4ae2('0x43')]['includeAll']){_0xe58384['include']=[{'all':!![]}];}_0xe58384=_[_0x4ae2('0x50')]({},_0xe58384,_0x13cda3[_0x4ae2('0x59')]);return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')](_0xe58384)[_0x4ae2('0x1e')](handleEntityNotFound(_0x4ffe8d,null))[_0x4ae2('0x1e')](respondWithResult(_0x4ffe8d,null))[_0x4ae2('0x57')](handleError(_0x4ffe8d,null));};exports[_0x4ae2('0x5b')]=function(_0x3aa206,_0x53e815){return db[_0x4ae2('0x3d')]['create'](_0x3aa206[_0x4ae2('0x5c')],{})[_0x4ae2('0x1e')](function(_0x28e7a8){var _0x2143fe=_0x3aa206[_0x4ae2('0x5d')][_0x4ae2('0x34')]({'plain':!![]});if(!_0x2143fe)throw new Error(_0x4ae2('0x5e'));if(_0x2143fe[_0x4ae2('0x5f')]==='user'){var _0x496f98=_0x28e7a8[_0x4ae2('0x34')]({'plain':!![]});var _0x3ed1d5=_0x4ae2('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x3ed1d5,'userProfileId':_0x2143fe[_0x4ae2('0x60')]},'raw':!![]})[_0x4ae2('0x1e')](function(_0x2a0c47){if(_0x2a0c47&&_0x2a0c47[_0x4ae2('0x61')]===0x0){return db[_0x4ae2('0x62')]['create']({'name':_0x496f98['name'],'resourceId':_0x496f98['id'],'type':_0x2a0c47['name'],'sectionId':_0x2a0c47['id']},{})[_0x4ae2('0x1e')](function(){return _0x28e7a8;});}else{return _0x28e7a8;}})['catch'](function(_0x4e54d1){logger[_0x4ae2('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e54d1);throw _0x4e54d1;});}return _0x28e7a8;})[_0x4ae2('0x1e')](respondWithResult(_0x53e815,0xc9))['catch'](handleError(_0x53e815,null));};exports[_0x4ae2('0x32')]=function(_0x59a999,_0xf417c0){if(_0x59a999['body']['id']){delete _0x59a999[_0x4ae2('0x5c')]['id'];}return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')]({'where':{'id':_0x59a999[_0x4ae2('0x63')]['id']},'include':[{'model':db[_0x4ae2('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xf417c0,null))[_0x4ae2('0x1e')](saveUpdates(_0x59a999[_0x4ae2('0x5c')],null))['then'](respondWithResult(_0xf417c0,null))[_0x4ae2('0x57')](handleError(_0xf417c0,null));};exports[_0x4ae2('0x33')]=function(_0x517800,_0x2c5bc7){return db[_0x4ae2('0x3d')]['find']({'where':{'id':_0x517800['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x2c5bc7,null))[_0x4ae2('0x1e')](removeEntity(_0x2c5bc7,null))['catch'](handleError(_0x2c5bc7,null));};exports[_0x4ae2('0x64')]=function(_0x449d5a,_0x38ad53){return db[_0x4ae2('0x3d')]['describe']()[_0x4ae2('0x1e')](respondWithResult(_0x38ad53,null))[_0x4ae2('0x57')](handleError(_0x38ad53,null));};exports['addDisposition']=function(_0x325455,_0x231796,_0x3412a1){if(_0x325455['body']['id']){delete _0x325455['body']['id'];}return db[_0x4ae2('0x3d')]['find']({'where':{'id':_0x325455[_0x4ae2('0x63')]['id']}})['then'](handleEntityNotFound(_0x231796,null))[_0x4ae2('0x1e')](function(_0x5c5b94){if(_0x5c5b94){_0x325455[_0x4ae2('0x5c')]['OpenchannelAccountId']=_0x5c5b94['id'];return db[_0x4ae2('0x65')]['create'](_0x325455['body']);}})[_0x4ae2('0x1e')](respondWithResult(_0x231796,null))[_0x4ae2('0x57')](handleError(_0x231796,null));};exports[_0x4ae2('0x66')]=function(_0xde3aac,_0x44a298,_0x240a7a){var _0x3e4e96={'raw':![],'where':{}};var _0x1ac2de={};var _0x2d2acc={'count':0x0,'rows':[]};return db[_0x4ae2('0x3d')][_0x4ae2('0x67')]({'where':{'id':_0xde3aac[_0x4ae2('0x63')]['id']}})['then'](handleEntityNotFound(_0x44a298,null))[_0x4ae2('0x1e')](function(_0x25a3d8){if(_0x25a3d8){_0x1ac2de[_0x4ae2('0x42')]=_[_0x4ae2('0x44')](db['Disposition'][_0x4ae2('0x3e')]);_0x1ac2de['query']=_[_0x4ae2('0x44')](_0xde3aac[_0x4ae2('0x43')]);_0x1ac2de[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x1ac2de[_0x4ae2('0x42')],_0x1ac2de[_0x4ae2('0x43')]);_0x3e4e96['attributes']=_[_0x4ae2('0x46')](_0x1ac2de[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0xde3aac['query'][_0x4ae2('0x47')]));_0x3e4e96[_0x4ae2('0x45')]=_0x3e4e96[_0x4ae2('0x45')]['length']?_0x3e4e96[_0x4ae2('0x45')]:_0x1ac2de[_0x4ae2('0x42')];if(!_0xde3aac[_0x4ae2('0x43')]['hasOwnProperty'](_0x4ae2('0x4a'))){_0x3e4e96[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0xde3aac[_0x4ae2('0x43')]['limit']);_0x3e4e96[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0xde3aac[_0x4ae2('0x43')][_0x4ae2('0x2b')]);}_0x3e4e96[_0x4ae2('0x4b')]=qs[_0x4ae2('0x4c')](_0xde3aac[_0x4ae2('0x43')]['sort']);_0x3e4e96['where']=qs[_0x4ae2('0x4f')](_[_0x4ae2('0x4e')](_0xde3aac[_0x4ae2('0x43')],_0x1ac2de[_0x4ae2('0x4f')]));_0x3e4e96[_0x4ae2('0x4d')][_0x4ae2('0x68')]=_0x25a3d8['id'];if(_0xde3aac['query'][_0x4ae2('0x52')]){_0x3e4e96[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x3e4e96[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x3e4e96[_0x4ae2('0x45')],function(_0x4ddd4d){var _0x3c2596={};_0x3c2596[_0x4ddd4d]={'$like':'%'+_0xde3aac[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x3c2596;})});}_0x3e4e96=_[_0x4ae2('0x50')]({},_0x3e4e96,_0xde3aac[_0x4ae2('0x59')]);return db[_0x4ae2('0x65')]['count']({'where':_0x3e4e96['where']})[_0x4ae2('0x1e')](function(_0xffd492){_0x2d2acc['count']=_0xffd492;if(_0xde3aac[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x3e4e96[_0x4ae2('0x54')]=[{'all':!![]}];}return db[_0x4ae2('0x65')][_0x4ae2('0x55')](_0x3e4e96);})[_0x4ae2('0x1e')](function(_0xc4748b){_0x2d2acc['rows']=_0xc4748b;return _0x2d2acc;});}})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x44a298,_0x3e4e96))[_0x4ae2('0x57')](handleError(_0x44a298,null));};exports[_0x4ae2('0x69')]=function(_0x406d4a,_0x1035e5,_0x29b0d0){return db['OpenchannelAccount'][_0x4ae2('0x5a')]({'where':{'id':_0x406d4a[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x1035e5,null))['then'](function(_0x3eaacb){if(_0x3eaacb){return _0x3eaacb['removeDispositions'](_0x406d4a[_0x4ae2('0x43')][_0x4ae2('0x6a')]);}})[_0x4ae2('0x1e')](respondWithStatusCode(_0x1035e5,null))[_0x4ae2('0x57')](handleError(_0x1035e5,null));};exports[_0x4ae2('0x6b')]=function(_0x5004e0,_0x46546c,_0x384c7e){if(_0x5004e0[_0x4ae2('0x5c')]['id']){delete _0x5004e0[_0x4ae2('0x5c')]['id'];}return db['OpenchannelAccount'][_0x4ae2('0x5a')]({'where':{'id':_0x5004e0['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x46546c,null))[_0x4ae2('0x1e')](function(_0x4b7baf){if(_0x4b7baf){_0x5004e0[_0x4ae2('0x5c')][_0x4ae2('0x68')]=_0x4b7baf['id'];return db[_0x4ae2('0x6c')][_0x4ae2('0x5b')](_0x5004e0[_0x4ae2('0x5c')]);}})[_0x4ae2('0x1e')](respondWithResult(_0x46546c,null))['catch'](handleError(_0x46546c,null));};exports[_0x4ae2('0x6d')]=function(_0x5caba1,_0x4a8d2c,_0x3226e7){var _0x461c66={'raw':![],'where':{}};var _0x34855a={};var _0x1dd43c={'count':0x0,'rows':[]};return db[_0x4ae2('0x3d')]['findOne']({'where':{'id':_0x5caba1['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x4a8d2c,null))[_0x4ae2('0x1e')](function(_0x2dfe75){if(_0x2dfe75){_0x34855a[_0x4ae2('0x42')]=_[_0x4ae2('0x44')](db[_0x4ae2('0x6c')][_0x4ae2('0x3e')]);_0x34855a[_0x4ae2('0x43')]=_['keys'](_0x5caba1[_0x4ae2('0x43')]);_0x34855a[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x34855a[_0x4ae2('0x42')],_0x34855a[_0x4ae2('0x43')]);_0x461c66[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x34855a[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x47')]));_0x461c66[_0x4ae2('0x45')]=_0x461c66[_0x4ae2('0x45')][_0x4ae2('0x48')]?_0x461c66[_0x4ae2('0x45')]:_0x34855a[_0x4ae2('0x42')];if(!_0x5caba1[_0x4ae2('0x43')]['hasOwnProperty'](_0x4ae2('0x4a'))){_0x461c66[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x5caba1['query']['limit']);_0x461c66[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0x5caba1['query'][_0x4ae2('0x2b')]);}_0x461c66[_0x4ae2('0x4b')]=qs['sort'](_0x5caba1[_0x4ae2('0x43')]['sort']);_0x461c66['where']=qs['filters'](_[_0x4ae2('0x4e')](_0x5caba1['query'],_0x34855a[_0x4ae2('0x4f')]));_0x461c66[_0x4ae2('0x4d')][_0x4ae2('0x68')]=_0x2dfe75['id'];if(_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x52')]){_0x461c66[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x461c66[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x461c66['attributes'],function(_0x3f17ca){var _0x3fce49={};_0x3fce49[_0x3f17ca]={'$like':'%'+_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x3fce49;})});}_0x461c66=_['merge']({},_0x461c66,_0x5caba1[_0x4ae2('0x59')]);return db[_0x4ae2('0x6c')][_0x4ae2('0x2a')]({'where':_0x461c66['where']})[_0x4ae2('0x1e')](function(_0x1a2c97){_0x1dd43c[_0x4ae2('0x2a')]=_0x1a2c97;if(_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x461c66[_0x4ae2('0x54')]=[{'all':!![]}];}return db[_0x4ae2('0x6c')]['findAll'](_0x461c66);})[_0x4ae2('0x1e')](function(_0x4654b8){_0x1dd43c[_0x4ae2('0x56')]=_0x4654b8;return _0x1dd43c;});}})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x4a8d2c,_0x461c66))[_0x4ae2('0x57')](handleError(_0x4a8d2c,null));};exports['removeAnswers']=function(_0x1c613d,_0x36fade,_0x1ed168){return db['OpenchannelAccount'][_0x4ae2('0x5a')]({'where':{'id':_0x1c613d[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x36fade,null))[_0x4ae2('0x1e')](function(_0x52521f){if(_0x52521f){return _0x52521f[_0x4ae2('0x6e')](_0x1c613d[_0x4ae2('0x43')]['ids']);}})[_0x4ae2('0x1e')](respondWithStatusCode(_0x36fade,null))[_0x4ae2('0x57')](handleError(_0x36fade,null));};exports['notify']=function(_0x543524,_0x28d3c5,_0x49d34e){var _0x40036e={'body':_0x543524[_0x4ae2('0x5c')],'channel':_0x4ae2('0x6f')};var _0x30c767=[];var _0xa0be2c=[];var _0x33c3c2={};var _0x41b7d5=![];return db['CmContact']['describe']()['then'](function(_0x114223){if(!_0x114223){throw new db[(_0x4ae2('0x70'))]['ValidationError']('no\x20available\x20attributes');}_0x30c767=_[_0x4ae2('0x71')](_[_0x4ae2('0x44')](_0x114223),[_0x4ae2('0x72'),_0x4ae2('0x73')]);_0xa0be2c=_[_0x4ae2('0x71')](_[_0x4ae2('0x44')](_0x114223),['createdAt',_0x4ae2('0x73'),_0x4ae2('0x74'),'ListId']);if(_0x543524[_0x4ae2('0x5c')]['id']){delete _0x543524['body']['id'];}if(_[_0x4ae2('0x75')](_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x76')])){throw new db['Sequelize'][(_0x4ae2('0x77'))](_0x4ae2('0x78'));}if(_[_0x4ae2('0x75')](_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x5c')])||_0x543524['body'][_0x4ae2('0x5c')]===''){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))](_0x4ae2('0x79'));}if(_['isNil'](_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x7a')])){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa0be2c);}if(!_[_0x4ae2('0x7b')](_0xa0be2c,_0x543524['body'][_0x4ae2('0x7a')])){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))](_0x4ae2('0x7c')+_0xa0be2c);}_0x33c3c2[_0x543524['body'][_0x4ae2('0x7a')]]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x76')];})[_0x4ae2('0x1e')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x543524['params']['id']},'include':[{'model':db[_0x4ae2('0x7d')],'as':_0x4ae2('0x7e'),'include':[{'model':db[_0x4ae2('0x7f')],'as':_0x4ae2('0x80'),'where':_0x33c3c2,'limit':0x1,'order':[[_0x4ae2('0x73'),'DESC']]}]},{'model':db[_0x4ae2('0x81')],'as':_0x4ae2('0x82')}]});})[_0x4ae2('0x1e')](handleEntityNotFound(_0x28d3c5,null))[_0x4ae2('0x1e')](function(_0x305faf){if(_0x305faf&&_0x305faf[_0x4ae2('0x7e')]){_0x40036e['account']=_0x305faf;_0x40036e[_0x4ae2('0x83')]=_0x305faf['Applications'];_0x40036e['list']=_0x305faf[_0x4ae2('0x7e')];_0x40036e[_0x4ae2('0x83')]=_[_0x4ae2('0x84')](_0x40036e[_0x4ae2('0x83')],[_0x4ae2('0x85')],[_0x4ae2('0x86')]);if(_0x40036e[_0x4ae2('0x87')]['Applications']){delete _0x40036e[_0x4ae2('0x87')][_0x4ae2('0x82')];}if(_0x40036e[_0x4ae2('0x87')][_0x4ae2('0x7e')]&&_0x40036e[_0x4ae2('0x87')][_0x4ae2('0x7e')][_0x4ae2('0x80')]['length']){return _0x40036e[_0x4ae2('0x87')][_0x4ae2('0x7e')][_0x4ae2('0x80')][0x0];}var _0x506020=_[_0x4ae2('0x16')](_0x543524[_0x4ae2('0x5c')],{'firstName':_0x543524['body'][_0x4ae2('0x76')],'ListId':_0x305faf[_0x4ae2('0x88')]});_0x506020[_0x543524['body'][_0x4ae2('0x7a')]]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x76')];return db[_0x4ae2('0x7f')][_0x4ae2('0x5b')](_0x506020,{'fields':_0x30c767,'raw':!![]});}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x28d3c5,null))[_0x4ae2('0x1e')](function(_0x539acf){_0x40036e[_0x4ae2('0x89')]=_0x539acf;if(_0x539acf){var _0x283c7c={'ContactId':_0x539acf['id'],'OpenchannelAccountId':_0x543524[_0x4ae2('0x63')]['id'],'from':(_0x539acf[_0x4ae2('0x8a')]||'')+'\x20'+(_0x539acf['lastName']||'')};var _0x2ece8c={'OpenchannelAccountId':_0x543524['params']['id'],'closed':![]};if(_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')]){_0x2ece8c[_0x4ae2('0x8b')]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')];return db[_0x4ae2('0x8c')][_0x4ae2('0x5a')]({'where':_0x2ece8c})['then'](function(_0x137a23){if(_0x137a23){return[_0x137a23,![]];}_0x283c7c[_0x4ae2('0x8b')]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')];_0x283c7c['externalUrl']=_0x543524['body']['externalUrl'];return db[_0x4ae2('0x8c')][_0x4ae2('0x5b')](_0x283c7c)['then'](function(_0x3eaa73){return[_0x3eaa73,!![]];});});}else{_0x2ece8c[_0x4ae2('0x8b')]=null;}_0x2ece8c[_0x4ae2('0x8d')]=_0x539acf['id'];return db[_0x4ae2('0x8c')][_0x4ae2('0x5a')]({'where':_0x2ece8c})[_0x4ae2('0x1e')](function(_0x5cd9fa){if(_0x5cd9fa){return[_0x5cd9fa,![]];}return db[_0x4ae2('0x8c')][_0x4ae2('0x5b')](_0x283c7c)[_0x4ae2('0x1e')](function(_0xa07825){return[_0xa07825,!![]];});});}})['spread'](function(_0xac0552,_0x24ddbd){if(_0xac0552){_0x41b7d5=_0x24ddbd;if(!_0x24ddbd){var _0x1e92a3={'from':(_0x40036e['contact'][_0x4ae2('0x8a')]||'')+'\x20'+(_0x40036e[_0x4ae2('0x89')][_0x4ae2('0x8e')]||'')};if(_0x543524['body']['threadId']&&_0x543524[_0x4ae2('0x5c')]['messageId']&&_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')]!=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8f')]){_0x1e92a3['threadId']=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8f')];}return _0xac0552[_0x4ae2('0x32')](_0x1e92a3);}else{return _0xac0552;}}})[_0x4ae2('0x1e')](function(_0x6a9664){_0x40036e[_0x4ae2('0x90')]=_0x6a9664['get']({'plain':!![]});_0x40036e['interaction']['created']=_0x41b7d5;if(_0x40036e[_0x4ae2('0x90')][_0x4ae2('0x91')]){if(_0x40036e[_0x4ae2('0x87')][_0x4ae2('0x92')]){_0x40036e['applications'][_0x4ae2('0x93')]({'id':0x0,'priority':_0x40036e[_0x4ae2('0x83')][_0x4ae2('0x48')]+0x1,'app':_0x4ae2('0x94'),'appdata':_0x4ae2('0x95'),'interval':_0x4ae2('0x96')});}}return db[_0x4ae2('0x97')][_0x4ae2('0x5b')]({'body':_0x543524[_0x4ae2('0x5c')]['body'],'OpenchannelAccountId':_0x543524[_0x4ae2('0x63')]['id'],'OpenchannelInteractionId':_0x6a9664['id'],'direction':'in','ContactId':_0x40036e[_0x4ae2('0x89')]['id'],'AttachmentId':_0x543524['body']['AttachmentId']});})[_0x4ae2('0x1e')](function(_0x451a76){_0x40036e[_0x4ae2('0x25')]=_0x451a76;if(_0x40036e[_0x4ae2('0x90')][_0x4ae2('0x98')]){return db[_0x4ae2('0x99')]['find']({'attributes':['id','name'],'where':{'id':_0x40036e[_0x4ae2('0x90')]['UserId']}})['then'](function(_0x2af585){if(_0x2af585){_0x40036e[_0x4ae2('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4ae2('0x9a'),'appdata':_0x2af585['name']+','+(_0x40036e['account'][_0x4ae2('0x9b')]||0xa),'interval':_0x4ae2('0x96')});_0x40036e[_0x4ae2('0x9c')]=![];}return respondWithRpcPromise(_0x4ae2('0x9d'),_0x4ae2('0x9e'),_0x40036e);});}return respondWithRpcPromise(_0x4ae2('0x9d'),'startRouting',_0x40036e);})[_0x4ae2('0x1e')](function(_0x4c83a9){respondWithRpcPromise(_0x4ae2('0x9f'),_0x4ae2('0x9f'),{'event':'notify','message':_0x4c83a9},client9002);return _0x4c83a9;})[_0x4ae2('0x1e')](respondWithResult(_0x28d3c5,null))[_0x4ae2('0x57')](handleError(_0x28d3c5,null));};exports['addApplications']=function(_0x4ba0af,_0x1064ad,_0x245d0d){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4ba0af['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x1064ad,null))['then'](function(_0x139b38){if(_0x139b38){return db[_0x4ae2('0xa0')][_0x4ae2('0xa1')](function(_0x16cee3){return db[_0x4ae2('0x81')][_0x4ae2('0x33')]({'where':{'OpenchannelAccountId':_0x4ba0af[_0x4ae2('0x63')]['id']},'transaction':_0x16cee3})[_0x4ae2('0x1e')](function(_0x479ffa){var _0x22d1b1=_['map'](_0x4ba0af[_0x4ae2('0x5c')],function(_0x1afc50){_0x1afc50[_0x4ae2('0x68')]=_0x4ba0af[_0x4ae2('0x63')]['id'];return _0x1afc50;});return db[_0x4ae2('0x81')]['bulkCreate'](_0x22d1b1,{'transaction':_0x16cee3});});})[_0x4ae2('0x1e')](function(){return db[_0x4ae2('0x81')][_0x4ae2('0xa2')]({'where':{'OpenchannelAccountId':_0x4ba0af[_0x4ae2('0x63')]['id']},'order':_0x4ae2('0x85')});});}})[_0x4ae2('0x1e')](respondWithResult(_0x1064ad,null))[_0x4ae2('0x57')](handleError(_0x1064ad,null));};exports['getApplications']=function(_0x46023b,_0x124b84,_0x61eaa7){var _0x3d1aaa={};var _0x1e16f3={};var _0x18bb34;var _0xb86bf;return db[_0x4ae2('0x3d')][_0x4ae2('0x67')]({'where':{'id':_0x46023b['params']['id']}})['then'](handleEntityNotFound(_0x124b84,null))[_0x4ae2('0x1e')](function(_0x48e5a1){if(_0x48e5a1){_0x18bb34=_0x48e5a1;_0x1e16f3[_0x4ae2('0x42')]=_[_0x4ae2('0x44')](db[_0x4ae2('0x81')][_0x4ae2('0x3e')]);_0x1e16f3[_0x4ae2('0x43')]=_[_0x4ae2('0x44')](_0x46023b['query']);_0x1e16f3[_0x4ae2('0x4f')]=_['intersection'](_0x1e16f3[_0x4ae2('0x42')],_0x1e16f3[_0x4ae2('0x43')]);_0x3d1aaa['attributes']=_['intersection'](_0x1e16f3[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0x46023b[_0x4ae2('0x43')]['fields']));_0x3d1aaa[_0x4ae2('0x45')]=_0x3d1aaa[_0x4ae2('0x45')][_0x4ae2('0x48')]?_0x3d1aaa[_0x4ae2('0x45')]:_0x1e16f3[_0x4ae2('0x42')];_0x3d1aaa[_0x4ae2('0x4b')]=qs[_0x4ae2('0x4c')](_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x4c')]);_0x3d1aaa[_0x4ae2('0x4d')]=qs['filters'](_[_0x4ae2('0x4e')](_0x46023b['query'],_0x1e16f3[_0x4ae2('0x4f')]));if(_0x46023b[_0x4ae2('0x43')]['filter']){_0x3d1aaa[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x3d1aaa[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x3d1aaa[_0x4ae2('0x45')],function(_0x57047d){var _0x4f1b08={};_0x4f1b08[_0x57047d]={'$like':'%'+_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x4f1b08;})});}_0x3d1aaa=_[_0x4ae2('0x50')]({},_0x3d1aaa,_0x46023b[_0x4ae2('0x59')]);return _0x18bb34[_0x4ae2('0xa3')](_0x3d1aaa);}})[_0x4ae2('0x1e')](function(_0x7a22a2){if(_0x7a22a2){_0xb86bf=_0x7a22a2[_0x4ae2('0x48')];if(!_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x3d1aaa['limit']=qs['limit'](_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x2c')]);_0x3d1aaa[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0x46023b[_0x4ae2('0x43')]['offset']);}return _0x18bb34[_0x4ae2('0xa3')](_0x3d1aaa);}})[_0x4ae2('0x1e')](function(_0x2a80bb){if(_0x2a80bb){return _0x2a80bb?{'count':_0xb86bf,'rows':_0x2a80bb}:null;}})[_0x4ae2('0x1e')](respondWithResult(_0x124b84,null))[_0x4ae2('0x57')](handleError(_0x124b84,null));};exports['getInteractions']=function(_0x42b50a,_0x19dfa1,_0xb5773a){var _0x588c51={'raw':![],'where':{}};var _0x1ad97d={};var _0x15bd95={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x42b50a[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x19dfa1,null))[_0x4ae2('0x1e')](function(_0x5a274a){if(_0x5a274a){_0x1ad97d['model']=_[_0x4ae2('0x44')](db[_0x4ae2('0x8c')][_0x4ae2('0x3e')]);_0x1ad97d['query']=_['keys'](_0x42b50a['query']);_0x1ad97d[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x1ad97d[_0x4ae2('0x42')],_0x1ad97d[_0x4ae2('0x43')]);_0x588c51[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x1ad97d[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0x42b50a[_0x4ae2('0x43')]['fields']));_0x588c51[_0x4ae2('0x45')]=_0x588c51[_0x4ae2('0x45')]['length']?_0x588c51[_0x4ae2('0x45')]:_0x1ad97d[_0x4ae2('0x42')];if(!_0x42b50a['query'][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x588c51[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x42b50a['query'][_0x4ae2('0x2c')]);_0x588c51[_0x4ae2('0x2b')]=qs['offset'](_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x2b')]);}_0x588c51[_0x4ae2('0x4b')]=qs['sort'](_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x4c')]);_0x588c51[_0x4ae2('0x4d')]=qs[_0x4ae2('0x4f')](_[_0x4ae2('0x4e')](_0x42b50a[_0x4ae2('0x43')],_0x1ad97d[_0x4ae2('0x4f')]));_0x588c51['where'][_0x4ae2('0x68')]=_0x5a274a['id'];if(_0x42b50a[_0x4ae2('0x43')]['filter']){_0x588c51[_0x4ae2('0x4d')]=_['merge'](_0x588c51[_0x4ae2('0x4d')],{'$or':_['map'](_0x588c51['attributes'],function(_0x1031a9){var _0x1ba1df={};_0x1ba1df[_0x1031a9]={'$like':'%'+_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x1ba1df;})});}_0x588c51=_[_0x4ae2('0x50')]({},_0x588c51,_0x42b50a[_0x4ae2('0x59')]);return db[_0x4ae2('0x8c')]['count']({'where':_0x588c51[_0x4ae2('0x4d')]})[_0x4ae2('0x1e')](function(_0x5640e1){_0x15bd95[_0x4ae2('0x2a')]=_0x5640e1;if(_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x588c51[_0x4ae2('0x54')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4ae2('0x99')],'as':_0x4ae2('0xa4'),'attributes':['name',_0x4ae2('0xa5'),_0x4ae2('0xa6')],'required':![]},{'model':db['Tag'],'as':_0x4ae2('0xa7'),'attributes':['id',_0x4ae2('0x38'),_0x4ae2('0xa8')],'where':_0x42b50a[_0x4ae2('0x43')]['tag']?{'id':_0x42b50a['query'][_0x4ae2('0xa9')]}:undefined,'required':_0x42b50a['query'][_0x4ae2('0xa9')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x4ae2('0x55')](_0x588c51);})[_0x4ae2('0x1e')](function(_0xb27ee8){_0x15bd95[_0x4ae2('0x56')]=_0xb27ee8;return _0x15bd95;});}})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x19dfa1,_0x588c51))[_0x4ae2('0x57')](handleError(_0x19dfa1,null));};exports['addAgents']=function(_0x54164d,_0x38b5d8,_0x56174){return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')]({'where':{'id':_0x54164d[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x38b5d8,null))[_0x4ae2('0x1e')](function(_0x245e81){if(_0x245e81){return _0x245e81['addAgents'](_0x54164d[_0x4ae2('0x5c')][_0x4ae2('0x6a')],_[_0x4ae2('0xaa')](_0x54164d[_0x4ae2('0x5c')],[_0x4ae2('0x6a'),'id'])||{})[_0x4ae2('0xab')](function(_0x50692e){for(var _0x1a8f93=0x0;_0x1a8f93<_0x54164d['body'][_0x4ae2('0x6a')]['length'];_0x1a8f93+=0x1){socket[_0x4ae2('0xac')](_0x4ae2('0xad'),{'UserId':_0x54164d[_0x4ae2('0x5c')][_0x4ae2('0x6a')][_0x1a8f93],'OpenchannelAccountId':_0x54164d[_0x4ae2('0x63')]['id']});}return _0x50692e;});}})[_0x4ae2('0x1e')](respondWithResult(_0x38b5d8,null))[_0x4ae2('0x57')](handleError(_0x38b5d8,null));};exports[_0x4ae2('0xae')]=function(_0x37fbe4,_0x379c74,_0x3aed91){return db[_0x4ae2('0x3d')]['find']({'where':{'id':_0x37fbe4[_0x4ae2('0x63')]['id']}})['then'](handleEntityNotFound(_0x379c74,null))[_0x4ae2('0x1e')](function(_0x47f805){if(_0x47f805){return _0x47f805[_0x4ae2('0xae')](_0x37fbe4[_0x4ae2('0x43')][_0x4ae2('0x6a')])['then'](function(){if(_[_0x4ae2('0xaf')](_0x37fbe4[_0x4ae2('0x43')]['ids'])){for(var _0x328ac1=0x0;_0x328ac1<_0x37fbe4[_0x4ae2('0x43')][_0x4ae2('0x6a')]['length'];_0x328ac1+=0x1){socket[_0x4ae2('0xac')](_0x4ae2('0xb0'),{'UserId':Number(_0x37fbe4[_0x4ae2('0x43')][_0x4ae2('0x6a')][_0x328ac1]),'OpenchannelAccountId':Number(_0x37fbe4[_0x4ae2('0x63')]['id'])});}}else{socket[_0x4ae2('0xac')](_0x4ae2('0xb0'),{'UserId':Number(_0x37fbe4['query'][_0x4ae2('0x6a')]),'OpenchannelAccountId':Number(_0x37fbe4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x379c74,null))[_0x4ae2('0x57')](handleError(_0x379c74,null));};exports[_0x4ae2('0xb1')]=function(_0x49336b,_0x44e969,_0x254ddd){var _0x4ce07b={};var _0x5d6a40={};var _0x1c2389;var _0x37b550;return db[_0x4ae2('0x3d')][_0x4ae2('0x67')]({'where':{'id':_0x49336b['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x44e969,null))[_0x4ae2('0x1e')](function(_0x43dfcc){if(_0x43dfcc){_0x1c2389=_0x43dfcc;_0x5d6a40[_0x4ae2('0x42')]=_['keys'](db[_0x4ae2('0x99')][_0x4ae2('0x3e')]);_0x5d6a40['query']=_[_0x4ae2('0x44')](_0x49336b['query']);_0x5d6a40[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x5d6a40[_0x4ae2('0x42')],_0x5d6a40['query']);_0x4ce07b[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x5d6a40['model'],qs['fields'](_0x49336b[_0x4ae2('0x43')]['fields']));_0x4ce07b[_0x4ae2('0x45')]=_0x4ce07b['attributes']['length']?_0x4ce07b[_0x4ae2('0x45')]:_0x5d6a40['model'];_0x4ce07b['order']=qs[_0x4ae2('0x4c')](_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x4c')]);_0x4ce07b[_0x4ae2('0x4d')]=qs[_0x4ae2('0x4f')](_['pick'](_0x49336b[_0x4ae2('0x43')],_0x5d6a40[_0x4ae2('0x4f')]));if(_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x52')]){_0x4ce07b[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x4ce07b[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x4ce07b['attributes'],function(_0x1a8486){var _0x115428={};_0x115428[_0x1a8486]={'$like':'%'+_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x115428;})});}_0x4ce07b=_['merge']({},_0x4ce07b,_0x49336b[_0x4ae2('0x59')]);return _0x1c2389[_0x4ae2('0xb1')](_0x4ce07b);}})[_0x4ae2('0x1e')](function(_0x109c73){if(_0x109c73){_0x37b550=_0x109c73[_0x4ae2('0x48')];if(!_0x49336b['query'][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x4ce07b[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x49336b['query']['limit']);_0x4ce07b[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x2b')]);}return _0x1c2389[_0x4ae2('0xb1')](_0x4ce07b);}})[_0x4ae2('0x1e')](function(_0x3e277c){if(_0x3e277c){return _0x3e277c?{'count':_0x37b550,'rows':_0x3e277c}:null;}})[_0x4ae2('0x1e')](respondWithResult(_0x44e969,null))[_0x4ae2('0x57')](handleError(_0x44e969,null));};exports['send']=function(_0x3dd195,_0x305a82,_0x8ebd81){var _0x34d7ac,_0x5818b6,_0x4c2842;if(_['isNil'](_0x3dd195[_0x4ae2('0x5c')]['body'])||_0x3dd195['body']['body']===''){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))](_0x4ae2('0x79'));}if(_['isNil'](_0x3dd195[_0x4ae2('0x5c')]['to'])){}_0x34d7ac=_0x3dd195[_0x4ae2('0x5c')]['to'];return db['OpenchannelAccount'][_0x4ae2('0x67')]({'where':{'id':_0x3dd195[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x305a82,null))[_0x4ae2('0x1e')](function(_0x4413ea){if(_0x4413ea){return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')]({'where':{'id':_0x4413ea['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4ae2('0x7f')],'as':_0x4ae2('0x80'),'where':{[_0x4413ea[_0x4ae2('0x7a')]]:_0x34d7ac},'limit':0x1,'order':[[_0x4ae2('0x73'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x305a82,null))['then'](function(_0x49b820){if(_0x49b820&&_0x49b820['List']){_0x5818b6=_0x49b820[_0x4ae2('0x34')]({'plain':!![]});if(_0x5818b6[_0x4ae2('0x7e')]&&_0x5818b6[_0x4ae2('0x7e')][_0x4ae2('0x80')][_0x4ae2('0x48')]){return _0x5818b6[_0x4ae2('0x7e')]['Contacts'][0x0];}return db['CmContact'][_0x4ae2('0x5b')](_['defaults'](_0x3dd195[_0x4ae2('0x5c')],{'firstName':_0x34d7ac,[_0x49b820['mapKey']]:_0x34d7ac,'phone':_0x34d7ac,'ListId':_0x5818b6[_0x4ae2('0x88')]}));}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x305a82,null))[_0x4ae2('0x1e')](function(_0x24b581){if(_0x24b581){_0x4c2842=_0x24b581;return db['OpenchannelInteraction'][_0x4ae2('0x5a')]({'where':{'ContactId':_0x4c2842['id'],'closed':![],'OpenchannelAccountId':_0x5818b6['id']}})[_0x4ae2('0x1e')](function(_0x5e28ab){if(_0x5e28ab){return[_0x5e28ab,![]];}return db[_0x4ae2('0x8c')]['create']({'UserId':_0x3dd195[_0x4ae2('0x5d')]['id'],'ContactId':_0x4c2842['id'],'OpenchannelAccountId':_0x5818b6['id'],'lastMsgDirection':_0x4ae2('0xb2'),'Messages':[_[_0x4ae2('0x50')](_0x3dd195[_0x4ae2('0x5c')],{'read':![],'body':_0x3dd195[_0x4ae2('0x5c')]['body'],'OpenchannelAccountId':_0x5818b6['id'],'UserId':_0x3dd195[_0x4ae2('0x5d')]['id'],'ContactId':_0x4c2842['id']})]},{'include':[{'model':db[_0x4ae2('0x97')],'as':_0x4ae2('0xb3')}]})[_0x4ae2('0x1e')](function(_0x20a8d2){return[_0x20a8d2,!![]];});});}})['spread'](function(_0x46c21d,_0x2f5760){if(_0x2f5760){return _0x46c21d;}return db[_0x4ae2('0x97')]['create'](_[_0x4ae2('0x50')](_0x3dd195[_0x4ae2('0x5c')],{'read':![],'body':_0x3dd195[_0x4ae2('0x5c')][_0x4ae2('0x5c')],'OpenchannelAccountId':_0x5818b6['id'],'OpenchannelInteractionId':_0x46c21d['id'],'UserId':_0x3dd195[_0x4ae2('0x5d')]['id'],'ContactId':_0x4c2842['id']}))[_0x4ae2('0x1e')](function(_0x531d22){_0x46c21d['dataValues'][_0x4ae2('0xb3')]=[];_0x46c21d[_0x4ae2('0xb4')][_0x4ae2('0xb3')][_0x4ae2('0x93')](_0x531d22[_0x4ae2('0xb4')]);return _0x46c21d;});});}})[_0x4ae2('0x1e')](respondWithResult(_0x305a82,null))[_0x4ae2('0x57')](handleError(_0x305a82,null));}; \ No newline at end of file +var _0x9c5a=['updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','OpenchannelMessage','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','rows','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x497e9d,_0x348ee0){var _0x4e5db2=function(_0x80a3c4){while(--_0x80a3c4){_0x497e9d['push'](_0x497e9d['shift']());}};_0x4e5db2(++_0x348ee0);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x33ad36,_0x4304a9){_0x33ad36=_0x33ad36-0x0;var _0x52e6e5=_0x9c5a[_0x33ad36];return _0x52e6e5;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];config[_0xa9c5('0x17')]=_[_0xa9c5('0x18')](config[_0xa9c5('0x17')],{'host':_0xa9c5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9c5('0x17')]));require(_0xa9c5('0x1a'))[_0xa9c5('0x1b')](socket);var jayson=require(_0xa9c5('0x1c'));var client=jayson[_0xa9c5('0x1d')][_0xa9c5('0x1e')]({'port':0x232c});var client9002=jayson[_0xa9c5('0x1d')][_0xa9c5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x19a43e,_0xcf13f2,_0x4bb57e,_0x2b0d73){return new BPromise(function(_0xd85c32,_0x1ee5ac){var _0x55cce5=_0x2b0d73||client;return _0x55cce5[_0xa9c5('0x1f')](_0x19a43e,_0x4bb57e)[_0xa9c5('0x20')](function(_0x2b9ac5){logger[_0xa9c5('0x21')](_0xa9c5('0x22'),_0xcf13f2,_0xa9c5('0x23'));logger[_0xa9c5('0x24')](_0xa9c5('0x25'),_0xcf13f2,_0xa9c5('0x23'),JSON[_0xa9c5('0x26')](_0x2b9ac5));if(_0x2b9ac5[_0xa9c5('0x27')]){if(_0x2b9ac5[_0xa9c5('0x27')]['code']===0x1f4){logger[_0xa9c5('0x27')](_0xa9c5('0x22'),_0xcf13f2,_0x2b9ac5['error']['message']);return _0x1ee5ac(_0x2b9ac5[_0xa9c5('0x27')][_0xa9c5('0x28')]);}logger[_0xa9c5('0x27')](_0xa9c5('0x22'),_0xcf13f2,_0x2b9ac5[_0xa9c5('0x27')][_0xa9c5('0x28')]);return _0xd85c32(_0x2b9ac5['error']['message']);}else{logger[_0xa9c5('0x21')](_0xa9c5('0x22'),_0xcf13f2,'request\x20sent');_0xd85c32(_0x2b9ac5[_0xa9c5('0x29')][_0xa9c5('0x28')]);}})[_0xa9c5('0x2a')](function(_0x32fc7d){logger[_0xa9c5('0x27')](_0xa9c5('0x22'),_0xcf13f2,_0x32fc7d);_0x1ee5ac(_0x32fc7d);});});}function respondWithStatusCode(_0xe44e6d,_0x51b64a){_0x51b64a=_0x51b64a||0xcc;return function(_0x4e8a7f){if(_0x4e8a7f){return _0xe44e6d[_0xa9c5('0x2b')](_0x51b64a);}return _0xe44e6d['status'](_0x51b64a)[_0xa9c5('0x2c')]();};}function respondWithResult(_0x830bad,_0x4caefa){_0x4caefa=_0x4caefa||0xc8;return function(_0x11a723){if(_0x11a723){return _0x830bad[_0xa9c5('0x2d')](_0x4caefa)['json'](_0x11a723);}};}function respondWithFilteredResult(_0x413edf,_0x32baf9){return function(_0x198cdf){if(_0x198cdf){var _0x185eb8=_0x198cdf['count'],_0x325c65=_0x32baf9[_0xa9c5('0x2e')],_0x4f6e70=_0x32baf9[_0xa9c5('0x2e')]+_0x32baf9[_0xa9c5('0x2f')],_0x36f267;if(_0x4f6e70>=_0x185eb8){_0x4f6e70=_0x185eb8;_0x36f267=0xc8;}else{_0x36f267=0xce;}_0x413edf['status'](_0x36f267);return _0x413edf[_0xa9c5('0x30')](_0xa9c5('0x31'),_0x325c65+'-'+_0x4f6e70+'/'+_0x185eb8)['json'](_0x198cdf);}return null;};}function patchUpdates(_0x3f11a9){return function(_0xc454fd){try{jsonpatch[_0xa9c5('0x32')](_0xc454fd,_0x3f11a9,!![]);}catch(_0x378684){return BPromise[_0xa9c5('0x33')](_0x378684);}return _0xc454fd[_0xa9c5('0x34')]();};}function saveUpdates(_0x3a66d8,_0x4b9104){return function(_0x452330){if(_0x452330){return _0x452330[_0xa9c5('0x35')](_0x3a66d8)[_0xa9c5('0x20')](function(_0x1c01f9){return _0x1c01f9;});}return null;};}function removeEntity(_0x1c617c,_0x2de191){return function(_0x226427){if(_0x226427){return _0x226427[_0xa9c5('0x36')]()['then'](function(){var _0x4e3f3e=_0x226427[_0xa9c5('0x37')]({'plain':!![]});var _0x30a0e8=_0xa9c5('0x38');return db[_0xa9c5('0x39')][_0xa9c5('0x36')]({'where':{'type':_0x30a0e8,'resourceId':_0x4e3f3e['id']}})[_0xa9c5('0x20')](function(){return _0x226427;});})['then'](function(){_0x1c617c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x314010,_0x27d614){return function(_0x5087e4){if(!_0x5087e4){_0x314010[_0xa9c5('0x2b')](0x194);}return _0x5087e4;};}function handleError(_0x56eb82,_0x1f5740){_0x1f5740=_0x1f5740||0x1f4;return function(_0x1fc8bf){logger[_0xa9c5('0x27')](_0x1fc8bf[_0xa9c5('0x3a')]);if(_0x1fc8bf['name']){delete _0x1fc8bf[_0xa9c5('0x3b')];}_0x56eb82[_0xa9c5('0x2d')](_0x1f5740)[_0xa9c5('0x3c')](_0x1fc8bf);};}exports[_0xa9c5('0x3d')]=function(_0x814c1a,_0x17ef8e){var _0x422f9b={'include':[{'model':db[_0xa9c5('0x3e')],'as':_0xa9c5('0x3f')}]},_0x251812={},_0x573fc0={'count':0x0,'rows':[]};var _0x841c18=_[_0xa9c5('0x40')](db[_0xa9c5('0x41')][_0xa9c5('0x42')],function(_0x493b20){return{'name':_0x493b20[_0xa9c5('0x43')],'type':_0x493b20['type'][_0xa9c5('0x44')]};});_0x251812['model']=_[_0xa9c5('0x40')](_0x841c18,_0xa9c5('0x3b'));_0x251812[_0xa9c5('0x45')]=_['keys'](_0x814c1a[_0xa9c5('0x45')]);_0x251812[_0xa9c5('0x46')]=_[_0xa9c5('0x47')](_0x251812[_0xa9c5('0x48')],_0x251812['query']);_0x422f9b[_0xa9c5('0x49')]=_[_0xa9c5('0x47')](_0x251812[_0xa9c5('0x48')],qs[_0xa9c5('0x4a')](_0x814c1a[_0xa9c5('0x45')]['fields']));_0x422f9b[_0xa9c5('0x49')]=_0x422f9b['attributes'][_0xa9c5('0x4b')]?_0x422f9b[_0xa9c5('0x49')]:_0x251812[_0xa9c5('0x48')];if(!_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x422f9b[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x422f9b['offset']=qs[_0xa9c5('0x2e')](_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}_0x422f9b[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x814c1a[_0xa9c5('0x45')]['sort']);_0x422f9b[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_['pick'](_0x814c1a['query'],_0x251812['filters']),_0x841c18);if(_0x814c1a['query']['filter']){_0x422f9b[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x422f9b[_0xa9c5('0x50')],{'$or':_[_0xa9c5('0x40')](_0x841c18,function(_0x255402){if(_0x255402[_0xa9c5('0x52')]!==_0xa9c5('0x53')){var _0x5b00a6={};_0x5b00a6[_0x255402[_0xa9c5('0x3b')]]={'$like':'%'+_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x54')]+'%'};return _0x5b00a6;}})});}_0x422f9b=_[_0xa9c5('0x51')]({},_0x422f9b,_0x814c1a[_0xa9c5('0x55')]);var _0x4bf8b4={'where':_0x422f9b[_0xa9c5('0x50')]};return db['OpenchannelAccount'][_0xa9c5('0x56')](_0x4bf8b4)[_0xa9c5('0x20')](function(_0x5c1c3a){_0x573fc0['count']=_0x5c1c3a;if(_0x814c1a[_0xa9c5('0x45')][_0xa9c5('0x57')]){_0x422f9b[_0xa9c5('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x422f9b);})[_0xa9c5('0x20')](function(_0xd03cec){_0x573fc0['rows']=_0xd03cec;return _0x573fc0;})[_0xa9c5('0x20')](respondWithFilteredResult(_0x17ef8e,_0x422f9b))[_0xa9c5('0x2a')](handleError(_0x17ef8e,null));};exports[_0xa9c5('0x59')]=function(_0x361b7c,_0x34020f){var _0xb369da={'raw':![],'where':{'id':_0x361b7c['params']['id']},'include':[{'model':db['Pause'],'as':_0xa9c5('0x3f')}]},_0x4b6fc9={};_0x4b6fc9[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db[_0xa9c5('0x41')][_0xa9c5('0x42')]);_0x4b6fc9[_0xa9c5('0x45')]=_['keys'](_0x361b7c[_0xa9c5('0x45')]);_0x4b6fc9[_0xa9c5('0x46')]=_[_0xa9c5('0x47')](_0x4b6fc9[_0xa9c5('0x48')],_0x4b6fc9[_0xa9c5('0x45')]);_0xb369da[_0xa9c5('0x49')]=_['intersection'](_0x4b6fc9['model'],qs[_0xa9c5('0x4a')](_0x361b7c['query'][_0xa9c5('0x4a')]));_0xb369da['attributes']=_0xb369da[_0xa9c5('0x49')][_0xa9c5('0x4b')]?_0xb369da[_0xa9c5('0x49')]:_0x4b6fc9['model'];if(_0x361b7c[_0xa9c5('0x45')][_0xa9c5('0x57')]){_0xb369da[_0xa9c5('0x58')]=[{'all':!![]}];}_0xb369da=_[_0xa9c5('0x51')]({},_0xb369da,_0x361b7c['options']);return db['OpenchannelAccount'][_0xa9c5('0x5b')](_0xb369da)[_0xa9c5('0x20')](handleEntityNotFound(_0x34020f,null))[_0xa9c5('0x20')](respondWithResult(_0x34020f,null))['catch'](handleError(_0x34020f,null));};exports[_0xa9c5('0x5c')]=function(_0x867922,_0x3d3c04){return db[_0xa9c5('0x41')][_0xa9c5('0x5c')](_0x867922[_0xa9c5('0x5d')],{})[_0xa9c5('0x20')](function(_0x298b3d){var _0x5a7f0a=_0x867922[_0xa9c5('0x5e')]['get']({'plain':!![]});if(!_0x5a7f0a)throw new Error(_0xa9c5('0x5f'));if(_0x5a7f0a[_0xa9c5('0x60')]===_0xa9c5('0x5e')){var _0x4dfe3a=_0x298b3d[_0xa9c5('0x37')]({'plain':!![]});var _0x1dd3b2='OpenchannelAccounts';return db[_0xa9c5('0x61')][_0xa9c5('0x5b')]({'where':{'name':_0x1dd3b2,'userProfileId':_0x5a7f0a[_0xa9c5('0x62')]},'raw':!![]})[_0xa9c5('0x20')](function(_0x49f91c){if(_0x49f91c&&_0x49f91c[_0xa9c5('0x63')]===0x0){return db[_0xa9c5('0x39')][_0xa9c5('0x5c')]({'name':_0x4dfe3a[_0xa9c5('0x3b')],'resourceId':_0x4dfe3a['id'],'type':_0x49f91c['name'],'sectionId':_0x49f91c['id']},{})['then'](function(){return _0x298b3d;});}else{return _0x298b3d;}})[_0xa9c5('0x2a')](function(_0x3deb64){logger[_0xa9c5('0x27')](_0xa9c5('0x64'),_0x3deb64);throw _0x3deb64;});}return _0x298b3d;})[_0xa9c5('0x20')](respondWithResult(_0x3d3c04,0xc9))[_0xa9c5('0x2a')](handleError(_0x3d3c04,null));};exports['update']=function(_0x86be71,_0x1e787e){if(_0x86be71[_0xa9c5('0x5d')]['id']){delete _0x86be71[_0xa9c5('0x5d')]['id'];}return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x86be71[_0xa9c5('0x65')]['id']},'include':[{'model':db[_0xa9c5('0x3e')],'as':_0xa9c5('0x3f')}]})[_0xa9c5('0x20')](handleEntityNotFound(_0x1e787e,null))['then'](saveUpdates(_0x86be71['body'],null))[_0xa9c5('0x20')](respondWithResult(_0x1e787e,null))[_0xa9c5('0x2a')](handleError(_0x1e787e,null));};exports[_0xa9c5('0x36')]=function(_0x47afaa,_0x57abd1){return db[_0xa9c5('0x41')]['find']({'where':{'id':_0x47afaa[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x57abd1,null))[_0xa9c5('0x20')](removeEntity(_0x57abd1,null))[_0xa9c5('0x2a')](handleError(_0x57abd1,null));};exports[_0xa9c5('0x66')]=function(_0x11bb72,_0xfd6ecf){return db[_0xa9c5('0x41')][_0xa9c5('0x66')]()[_0xa9c5('0x20')](respondWithResult(_0xfd6ecf,null))[_0xa9c5('0x2a')](handleError(_0xfd6ecf,null));};exports[_0xa9c5('0x67')]=function(_0x59cfee,_0x3312d1,_0x1a4aa7){if(_0x59cfee[_0xa9c5('0x5d')]['id']){delete _0x59cfee[_0xa9c5('0x5d')]['id'];}return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x59cfee[_0xa9c5('0x65')]['id']}})['then'](handleEntityNotFound(_0x3312d1,null))['then'](function(_0x207bb7){if(_0x207bb7){_0x59cfee['body'][_0xa9c5('0x68')]=_0x207bb7['id'];return db[_0xa9c5('0x69')]['create'](_0x59cfee[_0xa9c5('0x5d')]);}})[_0xa9c5('0x20')](respondWithResult(_0x3312d1,null))['catch'](handleError(_0x3312d1,null));};exports['getDispositions']=function(_0x14c4f2,_0x26c805,_0x22af29){var _0x514f3d={'raw':![],'where':{}};var _0x4a2bce={};var _0xd1ea={'count':0x0,'rows':[]};return db[_0xa9c5('0x41')]['findOne']({'where':{'id':_0x14c4f2[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x26c805,null))[_0xa9c5('0x20')](function(_0x3c0c7a){if(_0x3c0c7a){_0x4a2bce[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db['Disposition'][_0xa9c5('0x42')]);_0x4a2bce[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x14c4f2[_0xa9c5('0x45')]);_0x4a2bce['filters']=_[_0xa9c5('0x47')](_0x4a2bce[_0xa9c5('0x48')],_0x4a2bce['query']);_0x514f3d[_0xa9c5('0x49')]=_[_0xa9c5('0x47')](_0x4a2bce[_0xa9c5('0x48')],qs['fields'](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x4a')]));_0x514f3d[_0xa9c5('0x49')]=_0x514f3d[_0xa9c5('0x49')][_0xa9c5('0x4b')]?_0x514f3d[_0xa9c5('0x49')]:_0x4a2bce[_0xa9c5('0x48')];if(!_0x14c4f2['query'][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x514f3d[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x514f3d[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}_0x514f3d[_0xa9c5('0x4e')]=qs['sort'](_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x4f')]);_0x514f3d['where']=qs[_0xa9c5('0x46')](_[_0xa9c5('0x6a')](_0x14c4f2[_0xa9c5('0x45')],_0x4a2bce['filters']));_0x514f3d[_0xa9c5('0x50')][_0xa9c5('0x68')]=_0x3c0c7a['id'];if(_0x14c4f2[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x514f3d['where']=_[_0xa9c5('0x51')](_0x514f3d[_0xa9c5('0x50')],{'$or':_['map'](_0x514f3d['attributes'],function(_0x4b2046){var _0x4bbe99={};_0x4bbe99[_0x4b2046]={'$like':'%'+_0x14c4f2['query']['filter']+'%'};return _0x4bbe99;})});}_0x514f3d=_['merge']({},_0x514f3d,_0x14c4f2['options']);return db[_0xa9c5('0x69')][_0xa9c5('0x56')]({'where':_0x514f3d[_0xa9c5('0x50')]})[_0xa9c5('0x20')](function(_0x3e0f0f){_0xd1ea['count']=_0x3e0f0f;if(_0x14c4f2['query']['includeAll']){_0x514f3d['include']=[{'all':!![]}];}return db[_0xa9c5('0x69')][_0xa9c5('0x6b')](_0x514f3d);})[_0xa9c5('0x20')](function(_0x2eda17){_0xd1ea['rows']=_0x2eda17;return _0xd1ea;});}})['then'](respondWithFilteredResult(_0x26c805,_0x514f3d))[_0xa9c5('0x2a')](handleError(_0x26c805,null));};exports[_0xa9c5('0x6c')]=function(_0x144e97,_0x2b118d,_0x1d89ec){return db['OpenchannelAccount'][_0xa9c5('0x5b')]({'where':{'id':_0x144e97[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x2b118d,null))['then'](function(_0x26c81e){if(_0x26c81e){return _0x26c81e[_0xa9c5('0x6c')](_0x144e97[_0xa9c5('0x45')][_0xa9c5('0x6d')]);}})['then'](respondWithStatusCode(_0x2b118d,null))[_0xa9c5('0x2a')](handleError(_0x2b118d,null));};exports[_0xa9c5('0x6e')]=function(_0x58d575,_0x5deb88,_0x2f1e9f){if(_0x58d575['body']['id']){delete _0x58d575['body']['id'];}return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x58d575[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x5deb88,null))[_0xa9c5('0x20')](function(_0x5bc433){if(_0x5bc433){_0x58d575[_0xa9c5('0x5d')]['OpenchannelAccountId']=_0x5bc433['id'];return db[_0xa9c5('0x6f')][_0xa9c5('0x5c')](_0x58d575[_0xa9c5('0x5d')]);}})[_0xa9c5('0x20')](respondWithResult(_0x5deb88,null))['catch'](handleError(_0x5deb88,null));};exports['getAnswers']=function(_0x47225c,_0x532712,_0x57851d){var _0x38e2f={'raw':![],'where':{}};var _0x370bbb={};var _0x4cdf88={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0x47225c[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x532712,null))[_0xa9c5('0x20')](function(_0x57e73c){if(_0x57e73c){_0x370bbb['model']=_[_0xa9c5('0x5a')](db[_0xa9c5('0x6f')][_0xa9c5('0x42')]);_0x370bbb[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x47225c[_0xa9c5('0x45')]);_0x370bbb[_0xa9c5('0x46')]=_['intersection'](_0x370bbb[_0xa9c5('0x48')],_0x370bbb[_0xa9c5('0x45')]);_0x38e2f['attributes']=_[_0xa9c5('0x47')](_0x370bbb[_0xa9c5('0x48')],qs['fields'](_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x4a')]));_0x38e2f[_0xa9c5('0x49')]=_0x38e2f[_0xa9c5('0x49')][_0xa9c5('0x4b')]?_0x38e2f[_0xa9c5('0x49')]:_0x370bbb[_0xa9c5('0x48')];if(!_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x38e2f[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x38e2f[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0x47225c[_0xa9c5('0x45')]['offset']);}_0x38e2f[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x47225c[_0xa9c5('0x45')]['sort']);_0x38e2f[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_['pick'](_0x47225c[_0xa9c5('0x45')],_0x370bbb[_0xa9c5('0x46')]));_0x38e2f[_0xa9c5('0x50')][_0xa9c5('0x68')]=_0x57e73c['id'];if(_0x47225c[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x38e2f[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x38e2f[_0xa9c5('0x50')],{'$or':_[_0xa9c5('0x40')](_0x38e2f[_0xa9c5('0x49')],function(_0x4fe78){var _0xf8f816={};_0xf8f816[_0x4fe78]={'$like':'%'+_0x47225c['query']['filter']+'%'};return _0xf8f816;})});}_0x38e2f=_[_0xa9c5('0x51')]({},_0x38e2f,_0x47225c[_0xa9c5('0x55')]);return db['CannedAnswer'][_0xa9c5('0x56')]({'where':_0x38e2f[_0xa9c5('0x50')]})[_0xa9c5('0x20')](function(_0x148338){_0x4cdf88['count']=_0x148338;if(_0x47225c['query'][_0xa9c5('0x57')]){_0x38e2f[_0xa9c5('0x58')]=[{'all':!![]}];}return db[_0xa9c5('0x6f')]['findAll'](_0x38e2f);})[_0xa9c5('0x20')](function(_0x132958){_0x4cdf88[_0xa9c5('0x71')]=_0x132958;return _0x4cdf88;});}})['then'](respondWithFilteredResult(_0x532712,_0x38e2f))[_0xa9c5('0x2a')](handleError(_0x532712,null));};exports[_0xa9c5('0x72')]=function(_0x70230d,_0x1a09f0,_0xd2b735){return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x70230d[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x1a09f0,null))[_0xa9c5('0x20')](function(_0x133a2c){if(_0x133a2c){return _0x133a2c[_0xa9c5('0x72')](_0x70230d[_0xa9c5('0x45')][_0xa9c5('0x6d')]);}})[_0xa9c5('0x20')](respondWithStatusCode(_0x1a09f0,null))['catch'](handleError(_0x1a09f0,null));};exports['notify']=function(_0x4acddb,_0x1d6a2a,_0x3bfc19){var _0x4d3fa4={'body':_0x4acddb[_0xa9c5('0x5d')],'channel':_0xa9c5('0x73')};var _0x5646ab=[];var _0x428223=[];var _0x36d10b={};var _0x2f853b=![];return db[_0xa9c5('0x74')][_0xa9c5('0x66')]()['then'](function(_0x70d779){if(!_0x70d779){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))](_0xa9c5('0x77'));}_0x5646ab=_[_0xa9c5('0x78')](_[_0xa9c5('0x5a')](_0x70d779),[_0xa9c5('0x79'),_0xa9c5('0x7a')]);_0x428223=_[_0xa9c5('0x78')](_[_0xa9c5('0x5a')](_0x70d779),[_0xa9c5('0x79'),_0xa9c5('0x7a'),_0xa9c5('0x7b'),'ListId']);if(_0x4acddb['body']['id']){delete _0x4acddb[_0xa9c5('0x5d')]['id'];}if(_[_0xa9c5('0x7c')](_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7d')])){throw new db['Sequelize'][(_0xa9c5('0x76'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4acddb['body'][_0xa9c5('0x5d')])||_0x4acddb[_0xa9c5('0x5d')]['body']===''){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))](_0xa9c5('0x7e'));}if(_[_0xa9c5('0x7c')](_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7f')])){throw new db[(_0xa9c5('0x75'))]['ValidationError'](_0xa9c5('0x80')+_0x428223);}if(!_['includes'](_0x428223,_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7f')])){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))](_0xa9c5('0x81')+_0x428223);}_0x36d10b[_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7f')]]=_0x4acddb[_0xa9c5('0x5d')]['from'];})[_0xa9c5('0x20')](function(){return db['OpenchannelAccount'][_0xa9c5('0x5b')]({'where':{'id':_0x4acddb['params']['id']},'include':[{'model':db[_0xa9c5('0x82')],'as':_0xa9c5('0x83'),'include':[{'model':db[_0xa9c5('0x74')],'as':_0xa9c5('0x84'),'where':_0x36d10b,'limit':0x1,'order':[[_0xa9c5('0x7a'),_0xa9c5('0x85')]]}]},{'model':db[_0xa9c5('0x86')],'as':_0xa9c5('0x87')}]});})['then'](handleEntityNotFound(_0x1d6a2a,null))['then'](function(_0x3fd556){if(_0x3fd556&&_0x3fd556[_0xa9c5('0x83')]){_0x4d3fa4[_0xa9c5('0x88')]=_0x3fd556;_0x4d3fa4[_0xa9c5('0x89')]=_0x3fd556['Applications'];_0x4d3fa4['list']=_0x3fd556[_0xa9c5('0x83')];_0x4d3fa4[_0xa9c5('0x89')]=_[_0xa9c5('0x8a')](_0x4d3fa4[_0xa9c5('0x89')],[_0xa9c5('0x8b')],[_0xa9c5('0x8c')]);if(_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x87')]){delete _0x4d3fa4[_0xa9c5('0x88')]['Applications'];}if(_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x83')]&&_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x83')][_0xa9c5('0x84')][_0xa9c5('0x4b')]){return _0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x83')][_0xa9c5('0x84')][0x0];}var _0x2204b=_[_0xa9c5('0x18')](_0x4acddb[_0xa9c5('0x5d')],{'firstName':_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7d')],'ListId':_0x3fd556[_0xa9c5('0x8d')]});_0x2204b[_0x4acddb['body'][_0xa9c5('0x7f')]]=_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x7d')];return db['CmContact'][_0xa9c5('0x5c')](_0x2204b,{'fields':_0x5646ab,'raw':!![]});}})['then'](handleEntityNotFound(_0x1d6a2a,null))[_0xa9c5('0x20')](function(_0x195206){_0x4d3fa4[_0xa9c5('0x8e')]=_0x195206;if(_0x195206){var _0x28f6e8={'ContactId':_0x195206['id'],'OpenchannelAccountId':_0x4acddb[_0xa9c5('0x65')]['id'],'from':(_0x195206[_0xa9c5('0x8f')]||'')+'\x20'+(_0x195206[_0xa9c5('0x90')]||'')};var _0x102868={'OpenchannelAccountId':_0x4acddb[_0xa9c5('0x65')]['id'],'closed':![]};if(_0x4acddb['body'][_0xa9c5('0x91')]){_0x102868[_0xa9c5('0x91')]=_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x91')];return db[_0xa9c5('0x92')]['find']({'where':_0x102868})[_0xa9c5('0x20')](function(_0x3c11df){if(_0x3c11df){return[_0x3c11df,![]];}_0x28f6e8[_0xa9c5('0x91')]=_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x91')];_0x28f6e8['externalUrl']=_0x4acddb[_0xa9c5('0x5d')]['externalUrl'];return db[_0xa9c5('0x92')][_0xa9c5('0x5c')](_0x28f6e8)[_0xa9c5('0x20')](function(_0x255c72){return[_0x255c72,!![]];});});}else{_0x102868[_0xa9c5('0x91')]=null;}_0x102868[_0xa9c5('0x93')]=_0x195206['id'];return db[_0xa9c5('0x92')][_0xa9c5('0x5b')]({'where':_0x102868})[_0xa9c5('0x20')](function(_0x1400b2){if(_0x1400b2){return[_0x1400b2,![]];}return db[_0xa9c5('0x92')][_0xa9c5('0x5c')](_0x28f6e8)[_0xa9c5('0x20')](function(_0x1c8efb){return[_0x1c8efb,!![]];});});}})[_0xa9c5('0x94')](function(_0x452650,_0x124b4a){if(_0x452650){_0x2f853b=_0x124b4a;if(!_0x124b4a){var _0x523391={'from':(_0x4d3fa4[_0xa9c5('0x8e')][_0xa9c5('0x8f')]||'')+'\x20'+(_0x4d3fa4[_0xa9c5('0x8e')][_0xa9c5('0x90')]||'')};if(_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x91')]&&_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x95')]&&_0x4acddb['body'][_0xa9c5('0x91')]!=_0x4acddb[_0xa9c5('0x5d')]['messageId']){_0x523391[_0xa9c5('0x91')]=_0x4acddb[_0xa9c5('0x5d')]['messageId'];}return _0x452650['update'](_0x523391);}else{return _0x452650;}}})[_0xa9c5('0x20')](function(_0x39c3e4){_0x4d3fa4['interaction']=_0x39c3e4[_0xa9c5('0x37')]({'plain':!![]});_0x4d3fa4[_0xa9c5('0x96')][_0xa9c5('0x97')]=_0x2f853b;if(_0x4d3fa4[_0xa9c5('0x96')][_0xa9c5('0x97')]){if(_0x4d3fa4[_0xa9c5('0x88')][_0xa9c5('0x98')]){_0x4d3fa4[_0xa9c5('0x89')][_0xa9c5('0x99')]({'id':0x0,'priority':_0x4d3fa4['applications'][_0xa9c5('0x4b')]+0x1,'app':_0xa9c5('0x9a'),'appdata':_0xa9c5('0x9b'),'interval':_0xa9c5('0x9c')});}}return db['OpenchannelMessage']['create']({'body':_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x5d')],'OpenchannelAccountId':_0x4acddb[_0xa9c5('0x65')]['id'],'OpenchannelInteractionId':_0x39c3e4['id'],'direction':'in','ContactId':_0x4d3fa4[_0xa9c5('0x8e')]['id'],'AttachmentId':_0x4acddb[_0xa9c5('0x5d')][_0xa9c5('0x9d')]});})['then'](function(_0xca4f80){_0x4d3fa4[_0xa9c5('0x28')]=_0xca4f80;if(_0x4d3fa4[_0xa9c5('0x96')]['UserId']){return db[_0xa9c5('0x9e')][_0xa9c5('0x5b')]({'attributes':['id','name'],'where':{'id':_0x4d3fa4[_0xa9c5('0x96')]['UserId']}})[_0xa9c5('0x20')](function(_0x4d4cd2){if(_0x4d4cd2){_0x4d3fa4['applications'][_0xa9c5('0x9f')]({'id':0x0,'priority':0x0,'app':_0xa9c5('0xa0'),'appdata':_0x4d4cd2['name']+','+(_0x4d3fa4['account'][_0xa9c5('0xa1')]||0xa),'interval':_0xa9c5('0x9c')});_0x4d3fa4[_0xa9c5('0xa2')]=![];}return respondWithRpcPromise(_0xa9c5('0xa3'),'startRouting',_0x4d3fa4);});}return respondWithRpcPromise(_0xa9c5('0xa3'),_0xa9c5('0xa4'),_0x4d3fa4);})['then'](function(_0x5c3bc9){respondWithRpcPromise(_0xa9c5('0xa5'),'EventManager',{'event':_0xa9c5('0xa6'),'message':_0x5c3bc9},client9002);return _0x5c3bc9;})['then'](respondWithResult(_0x1d6a2a,null))[_0xa9c5('0x2a')](handleError(_0x1d6a2a,null));};exports['addApplications']=function(_0xc290ff,_0x27ceea,_0x15c882){return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0xc290ff[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x27ceea,null))[_0xa9c5('0x20')](function(_0x448971){if(_0x448971){return db[_0xa9c5('0xa7')][_0xa9c5('0xa8')](function(_0x15ee82){return db[_0xa9c5('0x86')][_0xa9c5('0x36')]({'where':{'OpenchannelAccountId':_0xc290ff[_0xa9c5('0x65')]['id']},'transaction':_0x15ee82})[_0xa9c5('0x20')](function(_0x4681f9){var _0x1ead2e=_[_0xa9c5('0x40')](_0xc290ff[_0xa9c5('0x5d')],function(_0x1e2b13){_0x1e2b13[_0xa9c5('0x68')]=_0xc290ff[_0xa9c5('0x65')]['id'];return _0x1e2b13;});return db[_0xa9c5('0x86')][_0xa9c5('0xa9')](_0x1ead2e,{'transaction':_0x15ee82});});})[_0xa9c5('0x20')](function(){return db[_0xa9c5('0x86')][_0xa9c5('0xaa')]({'where':{'OpenchannelAccountId':_0xc290ff[_0xa9c5('0x65')]['id']},'order':'priority'});});}})[_0xa9c5('0x20')](respondWithResult(_0x27ceea,null))[_0xa9c5('0x2a')](handleError(_0x27ceea,null));};exports[_0xa9c5('0xab')]=function(_0xa8905e,_0x5e9ce9,_0x1ff174){var _0x4d7916={};var _0x21a87e={};var _0x5b8f70;var _0x3725ff;return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0xa8905e[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x5e9ce9,null))[_0xa9c5('0x20')](function(_0x4a6123){if(_0x4a6123){_0x5b8f70=_0x4a6123;_0x21a87e[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db[_0xa9c5('0x86')][_0xa9c5('0x42')]);_0x21a87e[_0xa9c5('0x45')]=_['keys'](_0xa8905e[_0xa9c5('0x45')]);_0x21a87e[_0xa9c5('0x46')]=_[_0xa9c5('0x47')](_0x21a87e['model'],_0x21a87e[_0xa9c5('0x45')]);_0x4d7916[_0xa9c5('0x49')]=_[_0xa9c5('0x47')](_0x21a87e[_0xa9c5('0x48')],qs['fields'](_0xa8905e['query']['fields']));_0x4d7916[_0xa9c5('0x49')]=_0x4d7916[_0xa9c5('0x49')]['length']?_0x4d7916[_0xa9c5('0x49')]:_0x21a87e['model'];_0x4d7916[_0xa9c5('0x4e')]=qs['sort'](_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x4f')]);_0x4d7916[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_[_0xa9c5('0x6a')](_0xa8905e[_0xa9c5('0x45')],_0x21a87e[_0xa9c5('0x46')]));if(_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x4d7916[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x4d7916['where'],{'$or':_[_0xa9c5('0x40')](_0x4d7916[_0xa9c5('0x49')],function(_0x1bf7f5){var _0x5f2be5={};_0x5f2be5[_0x1bf7f5]={'$like':'%'+_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x54')]+'%'};return _0x5f2be5;})});}_0x4d7916=_[_0xa9c5('0x51')]({},_0x4d7916,_0xa8905e['options']);return _0x5b8f70[_0xa9c5('0xab')](_0x4d7916);}})[_0xa9c5('0x20')](function(_0x47ba5a){if(_0x47ba5a){_0x3725ff=_0x47ba5a[_0xa9c5('0x4b')];if(!_0xa8905e[_0xa9c5('0x45')]['hasOwnProperty'](_0xa9c5('0x4d'))){_0x4d7916[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0xa8905e[_0xa9c5('0x45')]['limit']);_0x4d7916[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0xa8905e[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}return _0x5b8f70['getApplications'](_0x4d7916);}})[_0xa9c5('0x20')](function(_0xb306d4){if(_0xb306d4){return _0xb306d4?{'count':_0x3725ff,'rows':_0xb306d4}:null;}})[_0xa9c5('0x20')](respondWithResult(_0x5e9ce9,null))[_0xa9c5('0x2a')](handleError(_0x5e9ce9,null));};exports['getInteractions']=function(_0x4ee92c,_0xec79ee,_0x5860b9){var _0x5c8e25={'raw':![],'where':{}};var _0xeea9b1={};var _0x3dd33c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa9c5('0x70')]({'where':{'id':_0x4ee92c[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0xec79ee,null))[_0xa9c5('0x20')](function(_0x2c2671){if(_0x2c2671){_0xeea9b1[_0xa9c5('0x48')]=_[_0xa9c5('0x5a')](db[_0xa9c5('0x92')]['rawAttributes']);_0xeea9b1[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x4ee92c[_0xa9c5('0x45')]);_0xeea9b1[_0xa9c5('0x46')]=_['intersection'](_0xeea9b1[_0xa9c5('0x48')],_0xeea9b1[_0xa9c5('0x45')]);_0x5c8e25[_0xa9c5('0x49')]=_['intersection'](_0xeea9b1['model'],qs[_0xa9c5('0x4a')](_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x4a')]));_0x5c8e25['attributes']=_0x5c8e25['attributes'][_0xa9c5('0x4b')]?_0x5c8e25[_0xa9c5('0x49')]:_0xeea9b1['model'];if(!_0x4ee92c[_0xa9c5('0x45')]['hasOwnProperty'](_0xa9c5('0x4d'))){_0x5c8e25[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x2f')]);_0x5c8e25[_0xa9c5('0x2e')]=qs[_0xa9c5('0x2e')](_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}_0x5c8e25[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x4ee92c['query'][_0xa9c5('0x4f')]);_0x5c8e25[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_[_0xa9c5('0x6a')](_0x4ee92c[_0xa9c5('0x45')],_0xeea9b1[_0xa9c5('0x46')]));_0x5c8e25[_0xa9c5('0x50')]['OpenchannelAccountId']=_0x2c2671['id'];if(_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x5c8e25[_0xa9c5('0x50')]=_['merge'](_0x5c8e25['where'],{'$or':_[_0xa9c5('0x40')](_0x5c8e25[_0xa9c5('0x49')],function(_0x56fbe6){var _0x2a3f43={};_0x2a3f43[_0x56fbe6]={'$like':'%'+_0x4ee92c[_0xa9c5('0x45')]['filter']+'%'};return _0x2a3f43;})});}_0x5c8e25=_[_0xa9c5('0x51')]({},_0x5c8e25,_0x4ee92c[_0xa9c5('0x55')]);return db[_0xa9c5('0x92')][_0xa9c5('0x56')]({'where':_0x5c8e25[_0xa9c5('0x50')]})[_0xa9c5('0x20')](function(_0x433fb3){_0x3dd33c[_0xa9c5('0x56')]=_0x433fb3;if(_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0x57')]){_0x5c8e25[_0xa9c5('0x58')]=[{'model':db['CmContact'],'as':_0xa9c5('0xac'),'required':![]},{'model':db['User'],'as':_0xa9c5('0xad'),'attributes':[_0xa9c5('0x3b'),_0xa9c5('0xae'),_0xa9c5('0xaf')],'required':![]},{'model':db['Tag'],'as':_0xa9c5('0xb0'),'attributes':['id',_0xa9c5('0x3b'),_0xa9c5('0xb1')],'where':_0x4ee92c[_0xa9c5('0x45')]['tag']?{'id':_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0xb2')]}:undefined,'required':_0x4ee92c[_0xa9c5('0x45')][_0xa9c5('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xa9c5('0x6b')](_0x5c8e25);})[_0xa9c5('0x20')](function(_0x42e161){_0x3dd33c[_0xa9c5('0x71')]=_0x42e161;return _0x3dd33c;});}})[_0xa9c5('0x20')](respondWithFilteredResult(_0xec79ee,_0x5c8e25))[_0xa9c5('0x2a')](handleError(_0xec79ee,null));};exports[_0xa9c5('0xb3')]=function(_0x211248,_0x1564df,_0x250e38){return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x211248[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x1564df,null))[_0xa9c5('0x20')](function(_0x51640b){if(_0x51640b){return _0x51640b[_0xa9c5('0xb3')](_0x211248['body']['ids'],_[_0xa9c5('0xb4')](_0x211248[_0xa9c5('0x5d')],[_0xa9c5('0x6d'),'id'])||{})[_0xa9c5('0x94')](function(_0x236792){for(var _0x485b64=0x0;_0x485b64<_0x211248[_0xa9c5('0x5d')]['ids']['length'];_0x485b64+=0x1){socket[_0xa9c5('0xb5')](_0xa9c5('0xb6'),{'UserId':_0x211248[_0xa9c5('0x5d')][_0xa9c5('0x6d')][_0x485b64],'OpenchannelAccountId':_0x211248[_0xa9c5('0x65')]['id']});}return _0x236792;});}})[_0xa9c5('0x20')](respondWithResult(_0x1564df,null))[_0xa9c5('0x2a')](handleError(_0x1564df,null));};exports[_0xa9c5('0xb7')]=function(_0x33de33,_0x3b4879,_0x3d2909){return db[_0xa9c5('0x41')]['find']({'where':{'id':_0x33de33[_0xa9c5('0x65')]['id']}})[_0xa9c5('0x20')](handleEntityNotFound(_0x3b4879,null))[_0xa9c5('0x20')](function(_0x2bf1b3){if(_0x2bf1b3){return _0x2bf1b3[_0xa9c5('0xb7')](_0x33de33[_0xa9c5('0x45')][_0xa9c5('0x6d')])[_0xa9c5('0x20')](function(){if(_[_0xa9c5('0xb8')](_0x33de33[_0xa9c5('0x45')]['ids'])){for(var _0x42d0c9=0x0;_0x42d0c9<_0x33de33['query'][_0xa9c5('0x6d')][_0xa9c5('0x4b')];_0x42d0c9+=0x1){socket[_0xa9c5('0xb5')](_0xa9c5('0xb9'),{'UserId':Number(_0x33de33[_0xa9c5('0x45')][_0xa9c5('0x6d')][_0x42d0c9]),'OpenchannelAccountId':Number(_0x33de33['params']['id'])});}}else{socket[_0xa9c5('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x33de33[_0xa9c5('0x45')]['ids']),'OpenchannelAccountId':Number(_0x33de33[_0xa9c5('0x65')]['id'])});}});}})[_0xa9c5('0x20')](respondWithStatusCode(_0x3b4879,null))[_0xa9c5('0x2a')](handleError(_0x3b4879,null));};exports[_0xa9c5('0xba')]=function(_0x5523d9,_0x4c48fc,_0x5e02c8){var _0x21fa3e={};var _0x4d19fe={};var _0x45fa29;var _0x197ebf;return db[_0xa9c5('0x41')][_0xa9c5('0x70')]({'where':{'id':_0x5523d9['params']['id']}})['then'](handleEntityNotFound(_0x4c48fc,null))['then'](function(_0x3cd7f2){if(_0x3cd7f2){_0x45fa29=_0x3cd7f2;_0x4d19fe['model']=_[_0xa9c5('0x5a')](db[_0xa9c5('0x9e')][_0xa9c5('0x42')]);_0x4d19fe[_0xa9c5('0x45')]=_[_0xa9c5('0x5a')](_0x5523d9[_0xa9c5('0x45')]);_0x4d19fe['filters']=_[_0xa9c5('0x47')](_0x4d19fe[_0xa9c5('0x48')],_0x4d19fe[_0xa9c5('0x45')]);_0x21fa3e[_0xa9c5('0x49')]=_['intersection'](_0x4d19fe[_0xa9c5('0x48')],qs['fields'](_0x5523d9['query'][_0xa9c5('0x4a')]));_0x21fa3e[_0xa9c5('0x49')]=_0x21fa3e['attributes'][_0xa9c5('0x4b')]?_0x21fa3e[_0xa9c5('0x49')]:_0x4d19fe['model'];_0x21fa3e[_0xa9c5('0x4e')]=qs[_0xa9c5('0x4f')](_0x5523d9[_0xa9c5('0x45')]['sort']);_0x21fa3e[_0xa9c5('0x50')]=qs[_0xa9c5('0x46')](_['pick'](_0x5523d9[_0xa9c5('0x45')],_0x4d19fe[_0xa9c5('0x46')]));if(_0x5523d9[_0xa9c5('0x45')][_0xa9c5('0x54')]){_0x21fa3e[_0xa9c5('0x50')]=_[_0xa9c5('0x51')](_0x21fa3e[_0xa9c5('0x50')],{'$or':_[_0xa9c5('0x40')](_0x21fa3e['attributes'],function(_0x4961bb){var _0x4af8bb={};_0x4af8bb[_0x4961bb]={'$like':'%'+_0x5523d9[_0xa9c5('0x45')]['filter']+'%'};return _0x4af8bb;})});}_0x21fa3e=_[_0xa9c5('0x51')]({},_0x21fa3e,_0x5523d9['options']);return _0x45fa29[_0xa9c5('0xba')](_0x21fa3e);}})[_0xa9c5('0x20')](function(_0x476138){if(_0x476138){_0x197ebf=_0x476138['length'];if(!_0x5523d9['query'][_0xa9c5('0x4c')](_0xa9c5('0x4d'))){_0x21fa3e[_0xa9c5('0x2f')]=qs[_0xa9c5('0x2f')](_0x5523d9[_0xa9c5('0x45')]['limit']);_0x21fa3e[_0xa9c5('0x2e')]=qs['offset'](_0x5523d9[_0xa9c5('0x45')][_0xa9c5('0x2e')]);}return _0x45fa29['getAgents'](_0x21fa3e);}})['then'](function(_0xe1c093){if(_0xe1c093){return _0xe1c093?{'count':_0x197ebf,'rows':_0xe1c093}:null;}})[_0xa9c5('0x20')](respondWithResult(_0x4c48fc,null))['catch'](handleError(_0x4c48fc,null));};exports[_0xa9c5('0x3c')]=function(_0x3ab4e2,_0x2a7040,_0x1bad25){var _0x4600a3,_0x3179b7,_0x336e17;if(_[_0xa9c5('0x7c')](_0x3ab4e2['body'][_0xa9c5('0x5d')])||_0x3ab4e2[_0xa9c5('0x5d')][_0xa9c5('0x5d')]===''){throw new db[(_0xa9c5('0x75'))][(_0xa9c5('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa9c5('0x7c')](_0x3ab4e2[_0xa9c5('0x5d')]['to'])){}_0x4600a3=_0x3ab4e2['body']['to'];return db[_0xa9c5('0x41')][_0xa9c5('0x70')]({'where':{'id':_0x3ab4e2[_0xa9c5('0x65')]['id']}})['then'](handleEntityNotFound(_0x2a7040,null))[_0xa9c5('0x20')](function(_0x4b0823){if(_0x4b0823){return db[_0xa9c5('0x41')][_0xa9c5('0x5b')]({'where':{'id':_0x4b0823['id']},'include':[{'model':db[_0xa9c5('0x82')],'as':_0xa9c5('0x83'),'include':[{'model':db[_0xa9c5('0x74')],'as':_0xa9c5('0x84'),'where':{[_0x4b0823[_0xa9c5('0x7f')]]:_0x4600a3},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xa9c5('0x20')](handleEntityNotFound(_0x2a7040,null))[_0xa9c5('0x20')](function(_0x2068d6){if(_0x2068d6&&_0x2068d6[_0xa9c5('0x83')]){_0x3179b7=_0x2068d6['get']({'plain':!![]});if(_0x3179b7[_0xa9c5('0x83')]&&_0x3179b7[_0xa9c5('0x83')][_0xa9c5('0x84')][_0xa9c5('0x4b')]){return _0x3179b7[_0xa9c5('0x83')]['Contacts'][0x0];}return db[_0xa9c5('0x74')][_0xa9c5('0x5c')](_[_0xa9c5('0x18')](_0x3ab4e2[_0xa9c5('0x5d')],{'firstName':_0x4600a3,[_0x2068d6[_0xa9c5('0x7f')]]:_0x4600a3,'phone':_0x4600a3,'ListId':_0x3179b7[_0xa9c5('0x8d')]}));}})['then'](handleEntityNotFound(_0x2a7040,null))['then'](function(_0xa98273){if(_0xa98273){_0x336e17=_0xa98273;return db[_0xa9c5('0x92')][_0xa9c5('0x5b')]({'where':{'ContactId':_0x336e17['id'],'closed':![],'OpenchannelAccountId':_0x3179b7['id']}})['then'](function(_0x59bea2){if(_0x59bea2){return[_0x59bea2,![]];}return db[_0xa9c5('0x92')][_0xa9c5('0x5c')]({'UserId':_0x3ab4e2[_0xa9c5('0x5e')]['id'],'ContactId':_0x336e17['id'],'OpenchannelAccountId':_0x3179b7['id'],'lastMsgDirection':_0xa9c5('0xbb'),'Messages':[_['merge'](_0x3ab4e2[_0xa9c5('0x5d')],{'read':![],'body':_0x3ab4e2['body'][_0xa9c5('0x5d')],'OpenchannelAccountId':_0x3179b7['id'],'UserId':_0x3ab4e2[_0xa9c5('0x5e')]['id'],'ContactId':_0x336e17['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xa9c5('0xbc')}]})[_0xa9c5('0x20')](function(_0x133f35){return[_0x133f35,!![]];});});}})[_0xa9c5('0x94')](function(_0x1b1cef,_0x5b87a8){if(_0x5b87a8){return _0x1b1cef;}return db[_0xa9c5('0xbd')]['create'](_['merge'](_0x3ab4e2['body'],{'read':![],'body':_0x3ab4e2[_0xa9c5('0x5d')]['body'],'OpenchannelAccountId':_0x3179b7['id'],'OpenchannelInteractionId':_0x1b1cef['id'],'UserId':_0x3ab4e2[_0xa9c5('0x5e')]['id'],'ContactId':_0x336e17['id']}))[_0xa9c5('0x20')](function(_0x379ff8){_0x1b1cef[_0xa9c5('0xbe')][_0xa9c5('0xbc')]=[];_0x1b1cef[_0xa9c5('0xbe')]['Messages'][_0xa9c5('0x99')](_0x379ff8['dataValues']);return _0x1b1cef;});});}})['then'](respondWithResult(_0x2a7040,null))[_0xa9c5('0x2a')](handleError(_0x2a7040,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 053dd46..edaeb1d 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 _0x7564=['exports','events','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7564,0x1cd));var _0x4756=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7564[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0x4756('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x4756('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4756('0x2')](0x0);var events={'afterCreate':_0x4756('0x3'),'afterUpdate':_0x4756('0x4'),'afterDestroy':_0x4756('0x5')};function emitEvent(_0x108f17){return function(_0x357047,_0x5d2f2,_0x56ac28){OpenchannelAccountEvents[_0x4756('0x6')](_0x108f17+':'+_0x357047['id'],_0x357047);OpenchannelAccountEvents[_0x4756('0x6')](_0x108f17,_0x357047);_0x56ac28(null);};}for(var e in events){if(events[_0x4756('0x7')](e)){var event=events[e];OpenchannelAccount[_0x4756('0x8')](e,emitEvent(event));}}module[_0x4756('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9cde=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x21c3d9,_0x1d5f2c){var _0x434f57=function(_0x26fe59){while(--_0x26fe59){_0x21c3d9['push'](_0x21c3d9['shift']());}};_0x434f57(++_0x1d5f2c);}(_0x9cde,0x1d9));var _0xe9cd=function(_0x6620b8,_0x8b3d5e){_0x6620b8=_0x6620b8-0x0;var _0x33de50=_0x9cde[_0x6620b8];return _0x33de50;};'use strict';var EventEmitter=require(_0xe9cd('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe9cd('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9cd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9cd('0x3'),'afterDestroy':_0xe9cd('0x4')};function emitEvent(_0x158845){return function(_0x374080,_0x24c657,_0x390e72){OpenchannelAccountEvents['emit'](_0x158845+':'+_0x374080['id'],_0x374080);OpenchannelAccountEvents[_0xe9cd('0x5')](_0x158845,_0x374080);_0x390e72(null);};}for(var e in events){if(events[_0xe9cd('0x6')](e)){var event=events[e];OpenchannelAccount[_0xe9cd('0x7')](e,emitEvent(event));}}module[_0xe9cd('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 038d2cd..a67adba 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 _0xf7ec=['util','moment','bluebird','../../config/environment','exports','define','OpenchannelAccount','lodash'];(function(_0x5ac12b,_0x36a412){var _0x3c7901=function(_0x60afbb){while(--_0x60afbb){_0x5ac12b['push'](_0x5ac12b['shift']());}};_0x3c7901(++_0x36a412);}(_0xf7ec,0xe7));var _0xcf7e=function(_0x24dedb,_0x116fe6){_0x24dedb=_0x24dedb-0x0;var _0x4220b2=_0xf7ec[_0x24dedb];return _0x4220b2;};'use strict';var _=require(_0xcf7e('0x0'));var util=require(_0xcf7e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf7e('0x2'));var BPromise=require(_0xcf7e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcf7e('0x4'));var attributes=require('./openchannelAccount.attributes');module[_0xcf7e('0x5')]=function(_0x5fa5e7,_0x527bd3){return _0x5fa5e7[_0xcf7e('0x6')](_0xcf7e('0x7'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x503c=['../../config/environment','./openchannelAccount.attributes','exports','OpenchannelAccount','openchannel_accounts','bluebird','request-promise','rimraf'];(function(_0x558c4e,_0x5f57f8){var _0x3ccaba=function(_0x535a9){while(--_0x535a9){_0x558c4e['push'](_0x558c4e['shift']());}};_0x3ccaba(++_0x5f57f8);}(_0x503c,0x1bd));var _0xc503=function(_0x1e1d5d,_0x213f5b){_0x1e1d5d=_0x1e1d5d-0x0;var _0x1830ac=_0x503c[_0x1e1d5d];return _0x1830ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc503('0x0'));var rp=require(_0xc503('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc503('0x2'));var config=require(_0xc503('0x3'));var attributes=require(_0xc503('0x4'));module[_0xc503('0x5')]=function(_0x3cb881,_0x5e1043){return _0x3cb881['define'](_0xc503('0x6'),attributes,{'tableName':_0xc503('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 302b183..432925e 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 _0x3dbb=['jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3dbb,0x12f));var _0xb3db=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x3dbb[_0xb7a459];return _0x104ab5;};'use strict';var _=require(_0xb3db('0x0'));var util=require(_0xb3db('0x1'));var moment=require(_0xb3db('0x2'));var BPromise=require(_0xb3db('0x3'));var rs=require(_0xb3db('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb3db('0x5'));var logger=require(_0xb3db('0x6'))(_0xb3db('0x7'));var config=require(_0xb3db('0x8'));var jayson=require(_0xb3db('0x9'));var client=jayson[_0xb3db('0xa')][_0xb3db('0xb')]({'port':0x232a});config[_0xb3db('0xc')]=_['defaults'](config[_0xb3db('0xc')],{'host':_0xb3db('0xd'),'port':0x18eb});var socket=require(_0xb3db('0xe'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xb3db('0xf')](socket);function respondWithRpcPromise(_0x2e6ab7,_0x1b136d,_0x153142){return new BPromise(function(_0x320af3,_0xb9501d){return client[_0xb3db('0x10')](_0x2e6ab7,_0x153142)[_0xb3db('0x11')](function(_0x3a2d97){logger[_0xb3db('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x1b136d,_0xb3db('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1b136d,_0xb3db('0x13'),JSON[_0xb3db('0x14')](_0x3a2d97));if(_0x3a2d97[_0xb3db('0x15')]){if(_0x3a2d97[_0xb3db('0x15')][_0xb3db('0x16')]===0x1f4){logger[_0xb3db('0x15')](_0xb3db('0x17'),_0x1b136d,_0x3a2d97[_0xb3db('0x15')]['message']);return _0xb9501d(_0x3a2d97[_0xb3db('0x15')][_0xb3db('0x18')]);}logger[_0xb3db('0x15')](_0xb3db('0x17'),_0x1b136d,_0x3a2d97[_0xb3db('0x15')]['message']);return _0x320af3(_0x3a2d97[_0xb3db('0x15')][_0xb3db('0x18')]);}else{logger[_0xb3db('0x12')](_0xb3db('0x17'),_0x1b136d,_0xb3db('0x13'));_0x320af3(_0x3a2d97[_0xb3db('0x19')][_0xb3db('0x18')]);}})['catch'](function(_0x2bb811){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1b136d,_0x2bb811);_0xb9501d(_0x2bb811);});});} \ No newline at end of file +var _0xc0e1=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','request\x20sent','debug'];(function(_0x1e890c,_0x51cc3d){var _0x375202=function(_0x564977){while(--_0x564977){_0x1e890c['push'](_0x1e890c['shift']());}};_0x375202(++_0x51cc3d);}(_0xc0e1,0x181));var _0x1c0e=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xc0e1[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1c0e('0x0'));var util=require('util');var moment=require(_0x1c0e('0x1'));var BPromise=require(_0x1c0e('0x2'));var rs=require(_0x1c0e('0x3'));var fs=require('fs');var Redis=require(_0x1c0e('0x4'));var db=require(_0x1c0e('0x5'))['db'];var utils=require(_0x1c0e('0x6'));var logger=require(_0x1c0e('0x7'))(_0x1c0e('0x8'));var config=require('../../config/environment');var jayson=require(_0x1c0e('0x9'));var client=jayson[_0x1c0e('0xa')]['http']({'port':0x232a});config[_0x1c0e('0xb')]=_[_0x1c0e('0xc')](config[_0x1c0e('0xb')],{'host':_0x1c0e('0xd'),'port':0x18eb});var socket=require(_0x1c0e('0xe'))(new Redis(config['redis']));require(_0x1c0e('0xf'))[_0x1c0e('0x10')](socket);function respondWithRpcPromise(_0x47dcfb,_0x2aeb74,_0x55070d){return new BPromise(function(_0xabca79,_0x1a418a){return client[_0x1c0e('0x11')](_0x47dcfb,_0x55070d)['then'](function(_0x4f66a2){logger[_0x1c0e('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x2aeb74,_0x1c0e('0x13'));logger[_0x1c0e('0x14')](_0x1c0e('0x15'),_0x2aeb74,_0x1c0e('0x13'),JSON[_0x1c0e('0x16')](_0x4f66a2));if(_0x4f66a2['error']){if(_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x18')]===0x1f4){logger[_0x1c0e('0x17')](_0x1c0e('0x19'),_0x2aeb74,_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x1a')]);return _0x1a418a(_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x1a')]);}logger[_0x1c0e('0x17')](_0x1c0e('0x19'),_0x2aeb74,_0x4f66a2[_0x1c0e('0x17')][_0x1c0e('0x1a')]);return _0xabca79(_0x4f66a2[_0x1c0e('0x17')]['message']);}else{logger['info'](_0x1c0e('0x19'),_0x2aeb74,_0x1c0e('0x13'));_0xabca79(_0x4f66a2[_0x1c0e('0x1b')][_0x1c0e('0x1a')]);}})[_0x1c0e('0x1c')](function(_0x324a38){logger['error'](_0x1c0e('0x19'),_0x2aeb74,_0x324a38);_0x1a418a(_0x324a38);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 595f0eb..e3b746e 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 _0xc415=['removeListener','register','length','openchannelAccount:','save','remove','emit'];(function(_0x5c6a83,_0x4d4660){var _0x59e89f=function(_0x563209){while(--_0x563209){_0x5c6a83['push'](_0x5c6a83['shift']());}};_0x59e89f(++_0x4d4660);}(_0xc415,0xba));var _0x5c41=function(_0x6b66ef,_0x2a1d82){_0x6b66ef=_0x6b66ef-0x0;var _0x1f3a1b=_0xc415[_0x6b66ef];return _0x1f3a1b;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x5c41('0x0'),_0x5c41('0x1'),'update'];function createListener(_0x4c2314,_0x38cb10){return function(_0x166b79){_0x38cb10[_0x5c41('0x2')](_0x4c2314,_0x166b79);};}function removeListener(_0x231939,_0x2a649d){return function(){OpenchannelAccountEvents[_0x5c41('0x3')](_0x231939,_0x2a649d);};}exports[_0x5c41('0x4')]=function(_0x1aea8f){for(var _0x19df34=0x0,_0x16120c=events[_0x5c41('0x5')];_0x19df34<_0x16120c;_0x19df34++){var _0x789645=events[_0x19df34];var _0x3f17c6=createListener(_0x5c41('0x6')+_0x789645,_0x1aea8f);OpenchannelAccountEvents['on'](_0x789645,_0x3f17c6);}}; \ No newline at end of file +var _0xc3a9=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x2cc98e,_0x3f51e9){var _0x4c3ea6=function(_0x73d432){while(--_0x73d432){_0x2cc98e['push'](_0x2cc98e['shift']());}};_0x4c3ea6(++_0x3f51e9);}(_0xc3a9,0x1bc));var _0x9c3a=function(_0x4a837d,_0x1f2fda){_0x4a837d=_0x4a837d-0x0;var _0x4d25d9=_0xc3a9[_0x4a837d];return _0x4d25d9;};'use strict';var OpenchannelAccountEvents=require(_0x9c3a('0x0'));var events=[_0x9c3a('0x1'),'remove',_0x9c3a('0x2')];function createListener(_0x559138,_0x18dc25){return function(_0x3e444a){_0x18dc25[_0x9c3a('0x3')](_0x559138,_0x3e444a);};}function removeListener(_0x104021,_0x39b1a6){return function(){OpenchannelAccountEvents[_0x9c3a('0x4')](_0x104021,_0x39b1a6);};}exports[_0x9c3a('0x5')]=function(_0x43770f){for(var _0x34cb95=0x0,_0x16b3da=events[_0x9c3a('0x6')];_0x34cb95<_0x16b3da;_0x34cb95++){var _0x2f2505=events[_0x34cb95];var _0x64a14=createListener(_0x9c3a('0x7')+_0x2f2505,_0x43770f);OpenchannelAccountEvents['on'](_0x2f2505,_0x64a14);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1f7c0dc..36bb637 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 _0xaf11=['post','put','update','/:id','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x1e7cde,_0x525eca){var _0x5412db=function(_0x59e130){while(--_0x59e130){_0x1e7cde['push'](_0x1e7cde['shift']());}};_0x5412db(++_0x525eca);}(_0xaf11,0x15e));var _0x1af1=function(_0x2c290c,_0xb7f93){_0x2c290c=_0x2c290c-0x0;var _0x4090a8=_0xaf11[_0x2c290c];return _0x4090a8;};'use strict';var multer=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var path=require(_0x1af1('0x2'));var timeout=require('connect-timeout');var express=require(_0x1af1('0x3'));var router=express['Router']();var auth=require(_0x1af1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1af1('0x5'));var controller=require(_0x1af1('0x6'));router[_0x1af1('0x7')]('/',auth[_0x1af1('0x8')](),controller[_0x1af1('0x9')]);router['get']('/:id',auth[_0x1af1('0x8')](),controller['show']);router[_0x1af1('0xa')]('/',auth[_0x1af1('0x8')](),controller['create']);router[_0x1af1('0xb')]('/:id',auth[_0x1af1('0x8')](),controller[_0x1af1('0xc')]);router['delete'](_0x1af1('0xd'),auth[_0x1af1('0x8')](),controller[_0x1af1('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc23c=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show'];(function(_0x3a8c8f,_0x567295){var _0x4d8b4a=function(_0x42a96e){while(--_0x42a96e){_0x3a8c8f['push'](_0x3a8c8f['shift']());}};_0x4d8b4a(++_0x567295);}(_0xc23c,0x16f));var _0xcc23=function(_0x1ac8fe,_0xc0578f){_0x1ac8fe=_0x1ac8fe-0x0;var _0x4c6db2=_0xc23c[_0x1ac8fe];return _0x4c6db2;};'use strict';var multer=require(_0xcc23('0x0'));var util=require('util');var path=require(_0xcc23('0x1'));var timeout=require(_0xcc23('0x2'));var express=require(_0xcc23('0x3'));var router=express[_0xcc23('0x4')]();var auth=require(_0xcc23('0x5'));var interaction=require(_0xcc23('0x6'));var config=require(_0xcc23('0x7'));var controller=require(_0xcc23('0x8'));router[_0xcc23('0x9')]('/',auth[_0xcc23('0xa')](),controller['index']);router[_0xcc23('0x9')](_0xcc23('0xb'),auth[_0xcc23('0xa')](),controller[_0xcc23('0xc')]);router[_0xcc23('0xd')]('/',auth['isAuthenticated'](),controller[_0xcc23('0xe')]);router[_0xcc23('0xf')](_0xcc23('0xb'),auth[_0xcc23('0xa')](),controller[_0xcc23('0x10')]);router[_0xcc23('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xcc23('0x12')]);module[_0xcc23('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 85f23b9..803b4f4 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 _0xe15e=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0xe15e,0x6e));var _0xee15=function(_0x227c6a,_0x28eb95){_0x227c6a=_0x227c6a-0x0;var _0x4bfb41=_0xe15e[_0x227c6a];return _0x4bfb41;};'use strict';var Sequelize=require('sequelize');module[_0xee15('0x0')]={'priority':{'type':Sequelize[_0xee15('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xee15('0x2')],'allowNull':![],'defaultValue':_0xee15('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xee15('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xee15('0x4')}}; \ No newline at end of file +var _0x75c3=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x556892,_0x2680cf){var _0xfb1c4d=function(_0xcd7945){while(--_0xcd7945){_0x556892['push'](_0x556892['shift']());}};_0xfb1c4d(++_0x2680cf);}(_0x75c3,0x13f));var _0x375c=function(_0x453f73,_0x4f8759){_0x453f73=_0x453f73-0x0;var _0x3a4f4c=_0x75c3[_0x453f73];return _0x3a4f4c;};'use strict';var Sequelize=require(_0x375c('0x0'));module[_0x375c('0x1')]={'priority':{'type':Sequelize[_0x375c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x375c('0x3')],'allowNull':![],'defaultValue':_0x375c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x375c('0x3')]},'interval':{'type':Sequelize[_0x375c('0x3')],'defaultValue':_0x375c('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 33be607..4802946 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 _0xecb6=['attributes','length','limit','offset','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','params','create','body','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields'];(function(_0x590fa4,_0x804923){var _0x1300cb=function(_0x1a10dc){while(--_0x1a10dc){_0x590fa4['push'](_0x590fa4['shift']());}};_0x1300cb(++_0x804923);}(_0xecb6,0x1cb));var _0x6ecb=function(_0x55f9ae,_0x330df3){_0x55f9ae=_0x55f9ae-0x0;var _0x579b39=_0xecb6[_0x55f9ae];return _0x579b39;};'use strict';var pdf=require(_0x6ecb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6ecb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ecb('0x2'));var rp=require(_0x6ecb('0x3'));var moment=require(_0x6ecb('0x4'));var BPromise=require(_0x6ecb('0x5'));var Mustache=require(_0x6ecb('0x6'));var util=require(_0x6ecb('0x7'));var path=require('path');var sox=require(_0x6ecb('0x8'));var csv=require(_0x6ecb('0x9'));var ejs=require(_0x6ecb('0xa'));var fs=require('fs');var _=require(_0x6ecb('0xb'));var squel=require(_0x6ecb('0xc'));var crypto=require(_0x6ecb('0xd'));var jsforce=require(_0x6ecb('0xe'));var deskjs=require(_0x6ecb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6ecb('0x10'));var Papa=require(_0x6ecb('0x11'));var Redis=require(_0x6ecb('0x12'));var authService=require(_0x6ecb('0x13'));var qs=require(_0x6ecb('0x14'));var as=require(_0x6ecb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ecb('0x16'));var utils=require(_0x6ecb('0x17'));var config=require(_0x6ecb('0x18'));var licenseUtil=require(_0x6ecb('0x19'));var db=require(_0x6ecb('0x1a'))['db'];function respondWithStatusCode(_0x39e7f4,_0x506bdc){_0x506bdc=_0x506bdc||0xcc;return function(_0x574e9d){if(_0x574e9d){return _0x39e7f4[_0x6ecb('0x1b')](_0x506bdc);}return _0x39e7f4[_0x6ecb('0x1c')](_0x506bdc)[_0x6ecb('0x1d')]();};}function respondWithResult(_0x4004db,_0x537fbd){_0x537fbd=_0x537fbd||0xc8;return function(_0x22f57d){if(_0x22f57d){return _0x4004db[_0x6ecb('0x1c')](_0x537fbd)[_0x6ecb('0x1e')](_0x22f57d);}};}function respondWithFilteredResult(_0x20aceb,_0x134b74){return function(_0x2ff757){if(_0x2ff757){var _0x3e8f29=_0x2ff757['count'],_0x2ac7f7=_0x134b74['offset'],_0x46dcd5=_0x134b74['offset']+_0x134b74['limit'],_0x518d1b;if(_0x46dcd5>=_0x3e8f29){_0x46dcd5=_0x3e8f29;_0x518d1b=0xc8;}else{_0x518d1b=0xce;}_0x20aceb[_0x6ecb('0x1c')](_0x518d1b);return _0x20aceb[_0x6ecb('0x1f')](_0x6ecb('0x20'),_0x2ac7f7+'-'+_0x46dcd5+'/'+_0x3e8f29)[_0x6ecb('0x1e')](_0x2ff757);}return null;};}function patchUpdates(_0x532ce8){return function(_0x5d2347){try{jsonpatch[_0x6ecb('0x21')](_0x5d2347,_0x532ce8,!![]);}catch(_0x13a6e6){return BPromise[_0x6ecb('0x22')](_0x13a6e6);}return _0x5d2347['save']();};}function saveUpdates(_0x38e46e,_0x4660f6){return function(_0x3db854){if(_0x3db854){return _0x3db854[_0x6ecb('0x23')](_0x38e46e)[_0x6ecb('0x24')](function(_0x2ef28f){return _0x2ef28f;});}return null;};}function removeEntity(_0x5eb431,_0x24918d){return function(_0x1cffd4){if(_0x1cffd4){return _0x1cffd4[_0x6ecb('0x25')]()[_0x6ecb('0x24')](function(){_0x5eb431[_0x6ecb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d8d48,_0x42e82e){return function(_0x43f05d){if(!_0x43f05d){_0x2d8d48[_0x6ecb('0x1b')](0x194);}return _0x43f05d;};}function handleError(_0x1b1bdc,_0x57acfd){_0x57acfd=_0x57acfd||0x1f4;return function(_0xf9713d){logger[_0x6ecb('0x26')](_0xf9713d['stack']);if(_0xf9713d[_0x6ecb('0x27')]){delete _0xf9713d[_0x6ecb('0x27')];}_0x1b1bdc[_0x6ecb('0x1c')](_0x57acfd)['send'](_0xf9713d);};}exports[_0x6ecb('0x28')]=function(_0x2943ef,_0x3f081f){var _0x534b0d={},_0xc14021={},_0x7d3b47={'count':0x0,'rows':[]};var _0x301c7d=_[_0x6ecb('0x29')](db[_0x6ecb('0x2a')][_0x6ecb('0x2b')],function(_0x4a42c5){return{'name':_0x4a42c5[_0x6ecb('0x2c')],'type':_0x4a42c5['type'][_0x6ecb('0x2d')]};});_0xc14021['model']=_[_0x6ecb('0x29')](_0x301c7d,_0x6ecb('0x27'));_0xc14021[_0x6ecb('0x2e')]=_[_0x6ecb('0x2f')](_0x2943ef['query']);_0xc14021[_0x6ecb('0x30')]=_['intersection'](_0xc14021[_0x6ecb('0x31')],_0xc14021[_0x6ecb('0x2e')]);_0x534b0d['attributes']=_[_0x6ecb('0x32')](_0xc14021[_0x6ecb('0x31')],qs[_0x6ecb('0x33')](_0x2943ef[_0x6ecb('0x2e')]['fields']));_0x534b0d[_0x6ecb('0x34')]=_0x534b0d[_0x6ecb('0x34')][_0x6ecb('0x35')]?_0x534b0d['attributes']:_0xc14021[_0x6ecb('0x31')];if(!_0x2943ef[_0x6ecb('0x2e')]['hasOwnProperty']('nolimit')){_0x534b0d[_0x6ecb('0x36')]=qs[_0x6ecb('0x36')](_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x36')]);_0x534b0d['offset']=qs['offset'](_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x37')]);}_0x534b0d['order']=qs[_0x6ecb('0x38')](_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x38')]);_0x534b0d['where']=qs['filters'](_[_0x6ecb('0x39')](_0x2943ef['query'],_0xc14021[_0x6ecb('0x30')]),_0x301c7d);if(_0x2943ef['query'][_0x6ecb('0x3a')]){_0x534b0d[_0x6ecb('0x3b')]=_[_0x6ecb('0x3c')](_0x534b0d[_0x6ecb('0x3b')],{'$or':_[_0x6ecb('0x29')](_0x301c7d,function(_0x4ea750){if(_0x4ea750[_0x6ecb('0x3d')]!==_0x6ecb('0x3e')){var _0x575d70={};_0x575d70[_0x4ea750[_0x6ecb('0x27')]]={'$like':'%'+_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x3a')]+'%'};return _0x575d70;}})});}_0x534b0d=_['merge']({},_0x534b0d,_0x2943ef[_0x6ecb('0x3f')]);var _0x4c4dbc={'where':_0x534b0d[_0x6ecb('0x3b')]};return db['OpenchannelApplication'][_0x6ecb('0x40')](_0x4c4dbc)[_0x6ecb('0x24')](function(_0x10f909){_0x7d3b47['count']=_0x10f909;if(_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x41')]){_0x534b0d[_0x6ecb('0x42')]=[{'all':!![]}];}return db[_0x6ecb('0x2a')]['findAll'](_0x534b0d);})[_0x6ecb('0x24')](function(_0x285fc1){_0x7d3b47[_0x6ecb('0x43')]=_0x285fc1;return _0x7d3b47;})[_0x6ecb('0x24')](respondWithFilteredResult(_0x3f081f,_0x534b0d))[_0x6ecb('0x44')](handleError(_0x3f081f,null));};exports['show']=function(_0x24102f,_0x16dd6e){var _0xf893bc={'raw':!![],'where':{'id':_0x24102f[_0x6ecb('0x45')]['id']}},_0x4eeba5={};_0x4eeba5[_0x6ecb('0x31')]=_[_0x6ecb('0x2f')](db[_0x6ecb('0x2a')][_0x6ecb('0x2b')]);_0x4eeba5[_0x6ecb('0x2e')]=_[_0x6ecb('0x2f')](_0x24102f[_0x6ecb('0x2e')]);_0x4eeba5[_0x6ecb('0x30')]=_['intersection'](_0x4eeba5['model'],_0x4eeba5['query']);_0xf893bc[_0x6ecb('0x34')]=_['intersection'](_0x4eeba5[_0x6ecb('0x31')],qs[_0x6ecb('0x33')](_0x24102f[_0x6ecb('0x2e')][_0x6ecb('0x33')]));_0xf893bc['attributes']=_0xf893bc[_0x6ecb('0x34')][_0x6ecb('0x35')]?_0xf893bc[_0x6ecb('0x34')]:_0x4eeba5[_0x6ecb('0x31')];if(_0x24102f[_0x6ecb('0x2e')][_0x6ecb('0x41')]){_0xf893bc[_0x6ecb('0x42')]=[{'all':!![]}];}_0xf893bc=_[_0x6ecb('0x3c')]({},_0xf893bc,_0x24102f['options']);return db[_0x6ecb('0x2a')]['find'](_0xf893bc)[_0x6ecb('0x24')](handleEntityNotFound(_0x16dd6e,null))[_0x6ecb('0x24')](respondWithResult(_0x16dd6e,null))[_0x6ecb('0x44')](handleError(_0x16dd6e,null));};exports[_0x6ecb('0x46')]=function(_0x45c68d,_0x4ac48b){return db[_0x6ecb('0x2a')]['create'](_0x45c68d['body'],{})[_0x6ecb('0x24')](respondWithResult(_0x4ac48b,0xc9))[_0x6ecb('0x44')](handleError(_0x4ac48b,null));};exports['update']=function(_0x216d75,_0xb0a546){if(_0x216d75[_0x6ecb('0x47')]['id']){delete _0x216d75[_0x6ecb('0x47')]['id'];}return db[_0x6ecb('0x2a')][_0x6ecb('0x48')]({'where':{'id':_0x216d75[_0x6ecb('0x45')]['id']}})[_0x6ecb('0x24')](handleEntityNotFound(_0xb0a546,null))['then'](saveUpdates(_0x216d75['body'],null))[_0x6ecb('0x24')](respondWithResult(_0xb0a546,null))[_0x6ecb('0x44')](handleError(_0xb0a546,null));};exports[_0x6ecb('0x25')]=function(_0x83bbee,_0xfcc67e){return db[_0x6ecb('0x2a')][_0x6ecb('0x48')]({'where':{'id':_0x83bbee[_0x6ecb('0x45')]['id']}})[_0x6ecb('0x24')](handleEntityNotFound(_0xfcc67e,null))[_0x6ecb('0x24')](removeEntity(_0xfcc67e,null))[_0x6ecb('0x44')](handleError(_0xfcc67e,null));}; \ No newline at end of file +var _0x0c98=['limit','Content-Range','json','apply','reject','save','then','destroy','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0xe5b699,_0xa63a8c){var _0x3238a1=function(_0x1fab54){while(--_0x1fab54){_0xe5b699['push'](_0xe5b699['shift']());}};_0x3238a1(++_0xa63a8c);}(_0x0c98,0xae));var _0x80c9=function(_0x13b35a,_0x32a31e){_0x13b35a=_0x13b35a-0x0;var _0x3181d2=_0x0c98[_0x13b35a];return _0x3181d2;};'use strict';var pdf=require(_0x80c9('0x0'));var emlformat=require(_0x80c9('0x1'));var rimraf=require(_0x80c9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80c9('0x3'));var rp=require(_0x80c9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x80c9('0x5'));var util=require('util');var path=require(_0x80c9('0x6'));var sox=require('sox');var csv=require(_0x80c9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x80c9('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x80c9('0x7'));var querystring=require(_0x80c9('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x80c9('0xa'));var qs=require(_0x80c9('0xb'));var as=require(_0x80c9('0xc'));var hardwareService=require(_0x80c9('0xd'));var logger=require(_0x80c9('0xe'))(_0x80c9('0xf'));var utils=require('../../config/utils');var config=require(_0x80c9('0x10'));var licenseUtil=require(_0x80c9('0x11'));var db=require(_0x80c9('0x12'))['db'];function respondWithStatusCode(_0x2305d4,_0x5cac42){_0x5cac42=_0x5cac42||0xcc;return function(_0xc10b9e){if(_0xc10b9e){return _0x2305d4[_0x80c9('0x13')](_0x5cac42);}return _0x2305d4[_0x80c9('0x14')](_0x5cac42)[_0x80c9('0x15')]();};}function respondWithResult(_0x4a230b,_0x15f2b5){_0x15f2b5=_0x15f2b5||0xc8;return function(_0x3d82ab){if(_0x3d82ab){return _0x4a230b[_0x80c9('0x14')](_0x15f2b5)['json'](_0x3d82ab);}};}function respondWithFilteredResult(_0x42d96c,_0x28e361){return function(_0x2c6bd9){if(_0x2c6bd9){var _0x3ea14b=_0x2c6bd9[_0x80c9('0x16')],_0x359545=_0x28e361[_0x80c9('0x17')],_0x265f0d=_0x28e361[_0x80c9('0x17')]+_0x28e361[_0x80c9('0x18')],_0x544849;if(_0x265f0d>=_0x3ea14b){_0x265f0d=_0x3ea14b;_0x544849=0xc8;}else{_0x544849=0xce;}_0x42d96c[_0x80c9('0x14')](_0x544849);return _0x42d96c['set'](_0x80c9('0x19'),_0x359545+'-'+_0x265f0d+'/'+_0x3ea14b)[_0x80c9('0x1a')](_0x2c6bd9);}return null;};}function patchUpdates(_0x5570e2){return function(_0x12bf01){try{jsonpatch[_0x80c9('0x1b')](_0x12bf01,_0x5570e2,!![]);}catch(_0x502fd1){return BPromise[_0x80c9('0x1c')](_0x502fd1);}return _0x12bf01[_0x80c9('0x1d')]();};}function saveUpdates(_0x1879b5,_0x3fd3e5){return function(_0x668967){if(_0x668967){return _0x668967['update'](_0x1879b5)[_0x80c9('0x1e')](function(_0x51184a){return _0x51184a;});}return null;};}function removeEntity(_0x1f28a3,_0x1dd524){return function(_0x4dced3){if(_0x4dced3){return _0x4dced3[_0x80c9('0x1f')]()[_0x80c9('0x1e')](function(){_0x1f28a3[_0x80c9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a00e0,_0x4ae74d){return function(_0x3b7bbe){if(!_0x3b7bbe){_0x4a00e0[_0x80c9('0x13')](0x194);}return _0x3b7bbe;};}function handleError(_0x12ba70,_0x4537d2){_0x4537d2=_0x4537d2||0x1f4;return function(_0x298826){logger['error'](_0x298826['stack']);if(_0x298826['name']){delete _0x298826[_0x80c9('0x20')];}_0x12ba70['status'](_0x4537d2)[_0x80c9('0x21')](_0x298826);};}exports[_0x80c9('0x22')]=function(_0x4a440f,_0x43194a){var _0xf221ce={},_0x377803={},_0x1219fe={'count':0x0,'rows':[]};var _0x579098=_[_0x80c9('0x23')](db[_0x80c9('0x24')][_0x80c9('0x25')],function(_0x25a0e6){return{'name':_0x25a0e6[_0x80c9('0x26')],'type':_0x25a0e6[_0x80c9('0x27')][_0x80c9('0x28')]};});_0x377803[_0x80c9('0x29')]=_[_0x80c9('0x23')](_0x579098,_0x80c9('0x20'));_0x377803[_0x80c9('0x2a')]=_[_0x80c9('0x2b')](_0x4a440f[_0x80c9('0x2a')]);_0x377803[_0x80c9('0x2c')]=_[_0x80c9('0x2d')](_0x377803[_0x80c9('0x29')],_0x377803[_0x80c9('0x2a')]);_0xf221ce[_0x80c9('0x2e')]=_[_0x80c9('0x2d')](_0x377803[_0x80c9('0x29')],qs['fields'](_0x4a440f['query'][_0x80c9('0x2f')]));_0xf221ce[_0x80c9('0x2e')]=_0xf221ce[_0x80c9('0x2e')][_0x80c9('0x30')]?_0xf221ce[_0x80c9('0x2e')]:_0x377803['model'];if(!_0x4a440f[_0x80c9('0x2a')][_0x80c9('0x31')](_0x80c9('0x32'))){_0xf221ce[_0x80c9('0x18')]=qs['limit'](_0x4a440f[_0x80c9('0x2a')]['limit']);_0xf221ce[_0x80c9('0x17')]=qs[_0x80c9('0x17')](_0x4a440f[_0x80c9('0x2a')][_0x80c9('0x17')]);}_0xf221ce[_0x80c9('0x33')]=qs['sort'](_0x4a440f['query']['sort']);_0xf221ce[_0x80c9('0x34')]=qs[_0x80c9('0x2c')](_['pick'](_0x4a440f[_0x80c9('0x2a')],_0x377803[_0x80c9('0x2c')]),_0x579098);if(_0x4a440f[_0x80c9('0x2a')]['filter']){_0xf221ce['where']=_[_0x80c9('0x35')](_0xf221ce[_0x80c9('0x34')],{'$or':_['map'](_0x579098,function(_0x284790){if(_0x284790[_0x80c9('0x27')]!==_0x80c9('0x36')){var _0x70b118={};_0x70b118[_0x284790[_0x80c9('0x20')]]={'$like':'%'+_0x4a440f['query']['filter']+'%'};return _0x70b118;}})});}_0xf221ce=_[_0x80c9('0x35')]({},_0xf221ce,_0x4a440f[_0x80c9('0x37')]);var _0xdfe0e={'where':_0xf221ce[_0x80c9('0x34')]};return db[_0x80c9('0x24')][_0x80c9('0x16')](_0xdfe0e)[_0x80c9('0x1e')](function(_0x31f008){_0x1219fe['count']=_0x31f008;if(_0x4a440f['query'][_0x80c9('0x38')]){_0xf221ce[_0x80c9('0x39')]=[{'all':!![]}];}return db[_0x80c9('0x24')][_0x80c9('0x3a')](_0xf221ce);})['then'](function(_0x2fd5f0){_0x1219fe['rows']=_0x2fd5f0;return _0x1219fe;})[_0x80c9('0x1e')](respondWithFilteredResult(_0x43194a,_0xf221ce))[_0x80c9('0x3b')](handleError(_0x43194a,null));};exports[_0x80c9('0x3c')]=function(_0x3b701a,_0x3db342){var _0x23cfde={'raw':!![],'where':{'id':_0x3b701a[_0x80c9('0x3d')]['id']}},_0x1c90ff={};_0x1c90ff[_0x80c9('0x29')]=_[_0x80c9('0x2b')](db[_0x80c9('0x24')]['rawAttributes']);_0x1c90ff[_0x80c9('0x2a')]=_[_0x80c9('0x2b')](_0x3b701a[_0x80c9('0x2a')]);_0x1c90ff[_0x80c9('0x2c')]=_[_0x80c9('0x2d')](_0x1c90ff['model'],_0x1c90ff['query']);_0x23cfde[_0x80c9('0x2e')]=_[_0x80c9('0x2d')](_0x1c90ff['model'],qs[_0x80c9('0x2f')](_0x3b701a[_0x80c9('0x2a')]['fields']));_0x23cfde[_0x80c9('0x2e')]=_0x23cfde[_0x80c9('0x2e')]['length']?_0x23cfde['attributes']:_0x1c90ff[_0x80c9('0x29')];if(_0x3b701a['query']['includeAll']){_0x23cfde['include']=[{'all':!![]}];}_0x23cfde=_[_0x80c9('0x35')]({},_0x23cfde,_0x3b701a['options']);return db[_0x80c9('0x24')][_0x80c9('0x3e')](_0x23cfde)[_0x80c9('0x1e')](handleEntityNotFound(_0x3db342,null))['then'](respondWithResult(_0x3db342,null))[_0x80c9('0x3b')](handleError(_0x3db342,null));};exports[_0x80c9('0x3f')]=function(_0x139d5f,_0xe10bf2){return db[_0x80c9('0x24')]['create'](_0x139d5f[_0x80c9('0x40')],{})[_0x80c9('0x1e')](respondWithResult(_0xe10bf2,0xc9))[_0x80c9('0x3b')](handleError(_0xe10bf2,null));};exports[_0x80c9('0x41')]=function(_0x4ca7d7,_0x4249ac){if(_0x4ca7d7[_0x80c9('0x40')]['id']){delete _0x4ca7d7[_0x80c9('0x40')]['id'];}return db[_0x80c9('0x24')][_0x80c9('0x3e')]({'where':{'id':_0x4ca7d7['params']['id']}})[_0x80c9('0x1e')](handleEntityNotFound(_0x4249ac,null))[_0x80c9('0x1e')](saveUpdates(_0x4ca7d7[_0x80c9('0x40')],null))[_0x80c9('0x1e')](respondWithResult(_0x4249ac,null))[_0x80c9('0x3b')](handleError(_0x4249ac,null));};exports[_0x80c9('0x1f')]=function(_0x535db1,_0x5b8a47){return db[_0x80c9('0x24')][_0x80c9('0x3e')]({'where':{'id':_0x535db1[_0x80c9('0x3d')]['id']}})[_0x80c9('0x1e')](handleEntityNotFound(_0x5b8a47,null))[_0x80c9('0x1e')](removeEntity(_0x5b8a47,null))[_0x80c9('0x3b')](handleError(_0x5b8a47,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 20f99ad..daa4769 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 _0x0972=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x5da81c,_0x42dda3){var _0x148229=function(_0x1bec4a){while(--_0x1bec4a){_0x5da81c['push'](_0x5da81c['shift']());}};_0x148229(++_0x42dda3);}(_0x0972,0x11e));var _0x2097=function(_0x4ff94f,_0x14c098){_0x4ff94f=_0x4ff94f-0x0;var _0x446781=_0x0972[_0x4ff94f];return _0x446781;};'use strict';var _=require(_0x2097('0x0'));var util=require(_0x2097('0x1'));var logger=require(_0x2097('0x2'))('api');var moment=require(_0x2097('0x3'));var BPromise=require(_0x2097('0x4'));var rp=require(_0x2097('0x5'));var fs=require('fs');var path=require(_0x2097('0x6'));var rimraf=require(_0x2097('0x7'));var config=require(_0x2097('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x2097('0x9')]=function(_0x426766,_0x4dd7ec){return _0x426766[_0x2097('0xa')](_0x2097('0xb'),attributes,{'tableName':_0x2097('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2097('0xd'),'collate':_0x2097('0xe')});}; \ No newline at end of file +var _0x2a14=['./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21e5aa,_0x15a5c0){var _0x26e60d=function(_0x4cd6e8){while(--_0x4cd6e8){_0x21e5aa['push'](_0x21e5aa['shift']());}};_0x26e60d(++_0x15a5c0);}(_0x2a14,0x155));var _0x42a1=function(_0x3aa600,_0xee93db){_0x3aa600=_0x3aa600-0x0;var _0x28458e=_0x2a14[_0x3aa600];return _0x28458e;};'use strict';var _=require(_0x42a1('0x0'));var util=require(_0x42a1('0x1'));var logger=require(_0x42a1('0x2'))(_0x42a1('0x3'));var moment=require('moment');var BPromise=require(_0x42a1('0x4'));var rp=require(_0x42a1('0x5'));var fs=require('fs');var path=require(_0x42a1('0x6'));var rimraf=require(_0x42a1('0x7'));var config=require(_0x42a1('0x8'));var attributes=require(_0x42a1('0x9'));module[_0x42a1('0xa')]=function(_0x5e590d,_0x5c756c){return _0x5e590d['define'](_0x42a1('0xb'),attributes,{'tableName':_0x42a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42a1('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 31fa509..0a16de7 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(_0x2a0cbe,_0xfbf284){var _0x515b89=function(_0x286dc3){while(--_0x286dc3){_0x2a0cbe['push'](_0x2a0cbe['shift']());}};_0x515b89(++_0xfbf284);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xb10b[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4a97a9,_0x52552b){var _0x43fb99=function(_0x5e775f){while(--_0x5e775f){_0x4a97a9['push'](_0x4a97a9['shift']());}};_0x43fb99(++_0x52552b);}(_0xb10b,0x12a));var _0xbb10=function(_0x335cfa,_0x1e7634){_0x335cfa=_0x335cfa-0x0;var _0xb7a81b=_0xb10b[_0x335cfa];return _0xb7a81b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3e860bd..b57e692 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 _0x896d=['util','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x5b4615,_0x3fad71){var _0x44eb78=function(_0x589498){while(--_0x589498){_0x5b4615['push'](_0x5b4615['shift']());}};_0x44eb78(++_0x3fad71);}(_0x896d,0x135));var _0xd896=function(_0x46d232,_0x5ac7e5){_0x46d232=_0x46d232-0x0;var _0x52da0f=_0x896d[_0x46d232];return _0x52da0f;};'use strict';var multer=require(_0xd896('0x0'));var util=require(_0xd896('0x1'));var path=require(_0xd896('0x2'));var timeout=require('connect-timeout');var express=require(_0xd896('0x3'));var router=express[_0xd896('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd896('0x5'));var config=require(_0xd896('0x6'));var controller=require(_0xd896('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd896('0x8')](_0xd896('0x9'),auth[_0xd896('0xa')](),controller[_0xd896('0xb')]);router[_0xd896('0x8')](_0xd896('0xc'),auth['isAuthenticated'](),controller[_0xd896('0xd')]);router[_0xd896('0x8')](_0xd896('0xe'),auth[_0xd896('0xa')](),controller['getMessages']);router[_0xd896('0x8')]('/:id/download',auth[_0xd896('0xa')](),controller[_0xd896('0xf')]);router[_0xd896('0x10')]('/',auth[_0xd896('0xa')](),controller[_0xd896('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xd896('0x12')]);router[_0xd896('0x10')](_0xd896('0x13'),auth[_0xd896('0xa')](),interaction[_0xd896('0x14')]('openchannel',_0xd896('0x15')),controller['addTags']);router[_0xd896('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xd896('0x17')),controller[_0xd896('0x18')]);router[_0xd896('0x19')](_0xd896('0xc'),auth[_0xd896('0xa')](),interaction[_0xd896('0x14')](_0xd896('0x1a'),_0xd896('0x1b')),controller[_0xd896('0x1c')]);router[_0xd896('0x19')](_0xd896('0x13'),auth[_0xd896('0xa')](),controller[_0xd896('0x1d')]);module[_0xd896('0x1e')]=router; \ No newline at end of file +var _0xafea=['/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x78335b,_0xb7a172){var _0x863f42=function(_0x4d9624){while(--_0x4d9624){_0x78335b['push'](_0x78335b['shift']());}};_0x863f42(++_0xb7a172);}(_0xafea,0x1c0));var _0xaafe=function(_0x166df0,_0x5d1fb6){_0x166df0=_0x166df0-0x0;var _0x1cba78=_0xafea[_0x166df0];return _0x1cba78;};'use strict';var multer=require(_0xaafe('0x0'));var util=require(_0xaafe('0x1'));var path=require(_0xaafe('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaafe('0x3')]();var auth=require(_0xaafe('0x4'));var interaction=require(_0xaafe('0x5'));var config=require(_0xaafe('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xaafe('0x7')]('/',auth[_0xaafe('0x8')](),controller[_0xaafe('0x9')]);router[_0xaafe('0x7')]('/describe',auth[_0xaafe('0x8')](),controller['describe']);router[_0xaafe('0x7')](_0xaafe('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaafe('0x7')]('/:id/messages',auth[_0xaafe('0x8')](),controller['getMessages']);router[_0xaafe('0x7')](_0xaafe('0xb'),auth[_0xaafe('0x8')](),controller[_0xaafe('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaafe('0xd')]);router[_0xaafe('0xe')](_0xaafe('0xf'),auth[_0xaafe('0x8')](),controller[_0xaafe('0x10')]);router[_0xaafe('0xe')](_0xaafe('0x11'),auth[_0xaafe('0x8')](),interaction['tracked'](_0xaafe('0x12'),_0xaafe('0x13')),controller[_0xaafe('0x14')]);router[_0xaafe('0x15')](_0xaafe('0xa'),auth[_0xaafe('0x8')](),interaction[_0xaafe('0x16')](_0xaafe('0x12'),_0xaafe('0x17')),controller['update']);router[_0xaafe('0x18')](_0xaafe('0xa'),auth['isAuthenticated'](),interaction[_0xaafe('0x16')]('openchannel',_0xaafe('0x19')),controller[_0xaafe('0x1a')]);router[_0xaafe('0x18')](_0xaafe('0x11'),auth[_0xaafe('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index fb1ca84..704a2d3 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 _0x7948=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7948,0x185));var _0x8794=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x7948[_0x1b745b];return _0x120a9d;};'use strict';var Sequelize=require(_0x8794('0x0'));module[_0x8794('0x1')]={'closed':{'type':Sequelize[_0x8794('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8794('0x3')]},'disposition':{'type':Sequelize[_0x8794('0x4')]},'secondDisposition':{'type':Sequelize[_0x8794('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8794('0x4')]},'note':{'type':Sequelize[_0x8794('0x4')]},'read1stAt':{'type':Sequelize[_0x8794('0x3')]},'threadId':{'type':Sequelize[_0x8794('0x4')]},'externalUrl':{'type':Sequelize[_0x8794('0x4')]},'lastMsgAt':{'type':Sequelize[_0x8794('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8794('0x5')]('in',_0x8794('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8794('0x4')]}}; \ No newline at end of file +var _0xb9fc=['STRING','out','BOOLEAN','DATE'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0xb9fc,0x6e));var _0xcb9f=function(_0x11c2b4,_0x147fd6){_0x11c2b4=_0x11c2b4-0x0;var _0x5cfd74=_0xb9fc[_0x11c2b4];return _0x5cfd74;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xcb9f('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb9f('0x1')]},'disposition':{'type':Sequelize[_0xcb9f('0x2')]},'secondDisposition':{'type':Sequelize[_0xcb9f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcb9f('0x2')]},'note':{'type':Sequelize[_0xcb9f('0x2')]},'read1stAt':{'type':Sequelize[_0xcb9f('0x1')]},'threadId':{'type':Sequelize[_0xcb9f('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xcb9f('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcb9f('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xcb9f('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 836bdea..3815be3 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 _0xf873=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','count','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','options','create','destroy','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','nolimit','sort','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','format','User','push','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Openchannel','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','System','out','renderFile','downloadInteraction.html','transcript-','.pdf','err','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','end','stack','name','send','map','fullname','TagIds','Tags','split','then','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','where','filters','pick','field','select','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','start','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte'];(function(_0x2dfe1c,_0x52165a){var _0x251ca2=function(_0x5ba9ec){while(--_0x5ba9ec){_0x2dfe1c['push'](_0x2dfe1c['shift']());}};_0x251ca2(++_0x52165a);}(_0xf873,0x168));var _0x3f87=function(_0x3a883a,_0x5a1efa){_0x3a883a=_0x3a883a-0x0;var _0x183794=_0xf873[_0x3a883a];return _0x183794;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3f87('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f87('0x1'));var moment=require(_0x3f87('0x2'));var BPromise=require(_0x3f87('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f87('0x4'));var sox=require(_0x3f87('0x5'));var csv=require(_0x3f87('0x6'));var ejs=require(_0x3f87('0x7'));var fs=require('fs');var _=require(_0x3f87('0x8'));var squel=require(_0x3f87('0x9'));var crypto=require(_0x3f87('0xa'));var jsforce=require(_0x3f87('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3f87('0x6'));var querystring=require('querystring');var Papa=require(_0x3f87('0xc'));var Redis=require('ioredis');var authService=require(_0x3f87('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f87('0xe'));var logger=require(_0x3f87('0xf'))(_0x3f87('0x10'));var utils=require('../../config/utils');var config=require(_0x3f87('0x11'));var licenseUtil=require(_0x3f87('0x12'));var db=require(_0x3f87('0x13'))['db'];config[_0x3f87('0x14')]=_[_0x3f87('0x15')](config[_0x3f87('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f87('0x16'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x3f87('0x17')](socket);function respondWithStatusCode(_0x5b4fec,_0x401118){_0x401118=_0x401118||0xcc;return function(_0x193f23){if(_0x193f23){return _0x5b4fec[_0x3f87('0x18')](_0x401118);}return _0x5b4fec[_0x3f87('0x19')](_0x401118)['end']();};}function respondWithResult(_0x246b18,_0x139846){_0x139846=_0x139846||0xc8;return function(_0x287157){if(_0x287157){return _0x246b18[_0x3f87('0x19')](_0x139846)[_0x3f87('0x1a')](_0x287157);}};}function respondWithFilteredResult(_0x360a2c,_0x1ef1e2){return function(_0x5a2d0){if(_0x5a2d0){var _0x336f37=_0x5a2d0['count'],_0x59f479=_0x1ef1e2[_0x3f87('0x1b')],_0x3ce9d9=_0x1ef1e2[_0x3f87('0x1b')]+_0x1ef1e2[_0x3f87('0x1c')],_0x2dcef8;if(_0x3ce9d9>=_0x336f37){_0x3ce9d9=_0x336f37;_0x2dcef8=0xc8;}else{_0x2dcef8=0xce;}_0x360a2c[_0x3f87('0x19')](_0x2dcef8);return _0x360a2c['set'](_0x3f87('0x1d'),_0x59f479+'-'+_0x3ce9d9+'/'+_0x336f37)['json'](_0x5a2d0);}return null;};}function patchUpdates(_0x5af828){return function(_0x14ac60){try{jsonpatch[_0x3f87('0x1e')](_0x14ac60,_0x5af828,!![]);}catch(_0x57452d){return BPromise[_0x3f87('0x1f')](_0x57452d);}return _0x14ac60['save']();};}function saveUpdates(_0x24538d,_0x4ce790){return function(_0x3a8550){if(_0x3a8550){return _0x3a8550[_0x3f87('0x20')](_0x24538d)['then'](function(_0x3555cc){return _0x3555cc;});}return null;};}function removeEntity(_0x405d08,_0x2ce6ee){return function(_0x56afcf){if(_0x56afcf){return _0x56afcf['destroy']()['then'](function(){_0x405d08[_0x3f87('0x19')](0xcc)[_0x3f87('0x21')]();});}};}function handleEntityNotFound(_0x506778,_0x3b3adb){return function(_0x575879){if(!_0x575879){_0x506778[_0x3f87('0x18')](0x194);}return _0x575879;};}function handleError(_0x54da6d,_0x544521){_0x544521=_0x544521||0x1f4;return function(_0x5ba33c){logger['error'](_0x5ba33c[_0x3f87('0x22')]);if(_0x5ba33c[_0x3f87('0x23')]){delete _0x5ba33c[_0x3f87('0x23')];}_0x54da6d[_0x3f87('0x19')](_0x544521)[_0x3f87('0x24')](_0x5ba33c);};}function getInteractionUsers(_0x3584d4,_0x1dbfe4){return new BPromise(function(_0xcc77a1,_0x29151d){try{if(_0x1dbfe4[_0x3584d4['id']]){_0x3584d4['Users']=_[_0x3f87('0x25')](_0x1dbfe4[_0x3584d4['id']],function(_0x4e3140){return{'id':_0x4e3140['id'],'fullname':_0x4e3140[_0x3f87('0x26')]};});}}catch(_0x2df7bb){_0x29151d(_0x2df7bb);}_0xcc77a1(_0x3584d4);});}function getInteractionTags(_0x28067e,_0x45542c){return new BPromise(function(_0x5a28f3,_0x3bbddc){try{if(_0x28067e[_0x3f87('0x27')]){_0x28067e[_0x3f87('0x28')]=[];_0x28067e[_0x3f87('0x27')][_0x3f87('0x29')](',')['forEach'](function(_0x1e0d3e){_0x28067e[_0x3f87('0x28')]['push'](_0x45542c[_0x1e0d3e]);});}delete _0x28067e[_0x3f87('0x27')];}catch(_0x46a35a){_0x3bbddc(_0x46a35a);}_0x5a28f3(_0x28067e);});}function updateOpenchannelInteraction(_0x1183d6,_0xe9ee24,_0x3458af){return new BPromise(function(_0x14635b,_0x2f1518){return getInteractionUsers(_0x1183d6,_0x3458af)[_0x3f87('0x2a')](function(_0x49a81c){return getInteractionTags(_0x49a81c,_0xe9ee24);})[_0x3f87('0x2a')](function(_0xbfb77){_0x14635b(_0xbfb77);})[_0x3f87('0x2b')](function(_0xa23340){_0x2f1518(_0xa23340);});});}exports[_0x3f87('0x2c')]=function(_0x2e12a3,_0x4a309f){var _0x5eafd4={},_0x2aa766={},_0x6da4c5={'count':0x0,'rows':[]};var _0x39b32a=_[_0x3f87('0x25')](db[_0x3f87('0x2d')][_0x3f87('0x2e')],function(_0x426d5e){return{'name':_0x426d5e[_0x3f87('0x2f')],'type':_0x426d5e[_0x3f87('0x30')][_0x3f87('0x31')]};});_0x2aa766[_0x3f87('0x32')]=_[_0x3f87('0x25')](_0x39b32a,_0x3f87('0x23'));_0x2aa766['query']=_[_0x3f87('0x33')](_0x2e12a3['query']);_0x2aa766['filters']=_[_0x3f87('0x34')](_0x2aa766['model'],_0x2aa766[_0x3f87('0x35')]);_0x5eafd4['attributes']=_[_0x3f87('0x34')](_0x2aa766['model'],qs[_0x3f87('0x36')](_0x2e12a3[_0x3f87('0x35')]['fields']));_0x5eafd4[_0x3f87('0x37')]=_0x5eafd4['attributes'][_0x3f87('0x38')]?_0x5eafd4['attributes']:_0x2aa766[_0x3f87('0x32')];if(!_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x39')]('nolimit')){_0x5eafd4[_0x3f87('0x1c')]=qs[_0x3f87('0x1c')](_0x2e12a3[_0x3f87('0x35')]['limit']);_0x5eafd4[_0x3f87('0x1b')]=qs[_0x3f87('0x1b')](_0x2e12a3[_0x3f87('0x35')]['offset']);}_0x5eafd4[_0x3f87('0x3a')]=qs['sort'](_0x2e12a3[_0x3f87('0x35')]['sort']);_0x5eafd4[_0x3f87('0x3b')]=qs[_0x3f87('0x3c')](_[_0x3f87('0x3d')](_0x2e12a3[_0x3f87('0x35')],_0x2aa766[_0x3f87('0x3c')]),_0x39b32a);var _0x50ede8=[];var _0x13c34b=squel['select']()[_0x3f87('0x3e')]('id')['field'](_0x3f87('0x23'))[_0x3f87('0x3e')]('color')['from']('tools_tags');var _0x5a94a8=squel[_0x3f87('0x3f')]()[_0x3f87('0x3e')](_0x3f87('0x40'))[_0x3f87('0x3e')](_0x3f87('0x41'))[_0x3f87('0x3e')](_0x3f87('0x42'))[_0x3f87('0x43')](_0x3f87('0x44'),'ui')[_0x3f87('0x45')]('users','u',_0x3f87('0x46'));var _0x3b6997=squel[_0x3f87('0x3f')]()[_0x3f87('0x43')](_0x3f87('0x47'),'i')[_0x3f87('0x45')](_0x3f87('0x48'),'c',_0x3f87('0x49'))[_0x3f87('0x45')](_0x3f87('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x3f87('0x45')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0x3f87('0x45')](_0x3f87('0x4b'),'me',_0x3f87('0x4c'))[_0x3f87('0x45')](_0x3f87('0x4d'),'it',_0x3f87('0x4e'))[_0x3f87('0x45')](_0x3f87('0x4f'),'t',_0x3f87('0x50'));var _0x131aa6=squel[_0x3f87('0x51')]();var _0x568e94=[];var _0x5166be=squel['expr']();var _0x3d047b;if(_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x52')]){_0x3d047b=as[_0x3f87('0x53')](_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x52')]);var _0x11928d=_0x3d047b[_0x3f87('0x54')];for(var _0x3e0e7e=0x0;_0x3e0e7e<_0x3d047b[_0x3f87('0x55')][_0x3f87('0x38')];_0x3e0e7e++){var _0x2d95fe=_0x3d047b[_0x3f87('0x55')][_0x3e0e7e];var _0x270df5='i';var _0x11cd06=_['find'](_0x39b32a,['name',_0x2d95fe[_0x3f87('0x3e')]]);if(!_0x11cd06){switch(_0x2d95fe[_0x3f87('0x3e')]){case _0x3f87('0x56'):if(_0x2d95fe['value']==0x1){_0x3b6997['having']('`'+_0x2d95fe[_0x3f87('0x3e')]+'`\x20=\x200');}else{_0x3b6997[_0x3f87('0x57')]('`'+_0x2d95fe[_0x3f87('0x3e')]+_0x3f87('0x58'));}break;case _0x3f87('0x59'):if(_0x2d95fe[_0x3f87('0x5a')]===_0x3f87('0x5b')){if(_0x2d95fe[_0x3f87('0x5c')][_0x3f87('0x29')]('\x20')[_0x3f87('0x38')]>0x1){_0x131aa6[_0x11928d](_0x3f87('0x5d'),qs[_0x3f87('0x5e')](_0x2d95fe['value']),null);}else{var _0x29272d='%'+_0x2d95fe['value']+'%';_0x131aa6[_0x11928d](_0x3f87('0x5f'),_0x29272d,_0x29272d,_0x29272d);}}else{_0x11cd06=_[_0x3f87('0x60')](_0x39b32a,[_0x3f87('0x23'),_0x3f87('0x61')]);_0x2d95fe['field']=_0x3f87('0x61');_0x5a32ca=as[_0x3f87('0x62')](_0x270df5,_0x11cd06[_0x3f87('0x30')],_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca[_0x3f87('0x63')],_0x5a32ca[_0x3f87('0x5c')]['start'],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x21')]);}break;case _0x3f87('0x64'):var _0x57ee24=_0x2d95fe[_0x3f87('0x5c')][_0x3f87('0x29')](',')[_0x3f87('0x25')](function(_0x437fd7){return Number(_0x437fd7);});_0x57ee24[_0x3f87('0x65')](function(_0xd84d6d){_0x5166be['or'](_0x3f87('0x66'),'%,'+_0xd84d6d+',%');});_0x568e94=_[_0x3f87('0x67')](_0x568e94,_0x57ee24);break;case'User':if(_0x2d95fe[_0x3f87('0x5a')]==='$substring'){_0x131aa6[_0x11928d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2d95fe[_0x3f87('0x5c')]+'%',null);}else{_0x11cd06=_[_0x3f87('0x60')](_0x39b32a,[_0x3f87('0x23'),_0x3f87('0x68')]);_0x2d95fe['field']=_0x3f87('0x68');_0x5a32ca=as[_0x3f87('0x62')](_0x270df5,_0x11cd06[_0x3f87('0x30')],_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca[_0x3f87('0x63')],_0x5a32ca[_0x3f87('0x5c')]['start'],_0x5a32ca[_0x3f87('0x5c')]['end']);}break;case _0x3f87('0x69'):_0x5a32ca=as['buildExpression']('me',null,_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca['text'],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x6a')],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x21')]);break;}}else{var _0x5a32ca=as['buildExpression'](_0x270df5,_0x11cd06[_0x3f87('0x30')],_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca[_0x3f87('0x63')],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x6a')],_0x5a32ca['value']['end']);}}}else{var _0xbd2a5a=_(_0x2e12a3[_0x3f87('0x35')])[_0x3f87('0x33')]()[_0x3f87('0x25')](function(_0x2e32b4){return _[_0x3f87('0x6b')](_0x39b32a,[_0x3f87('0x23'),_0x2e32b4])?_0x2e32b4:undefined;})['compact']()[_0x3f87('0x5c')]();if(!_[_0x3f87('0x6c')](_0xbd2a5a)){_0xbd2a5a['forEach'](function(_0x5e8567){if(_0x5e8567===_0x3f87('0x6d')){_0x3b6997[_0x3f87('0x3b')](_0x3f87('0x6e'),[][_0x3f87('0x6f')](_0x2e12a3[_0x3f87('0x35')][_0x5e8567]));}else if(_0x5e8567===_0x3f87('0x70')){var _0x19dfd3=JSON['parse'](_0x2e12a3[_0x3f87('0x35')][_0x5e8567])[_0x3f87('0x71')];var _0x536a86=JSON[_0x3f87('0x72')](_0x2e12a3['query'][_0x5e8567])[_0x3f87('0x73')];_0x3b6997[_0x3f87('0x3b')](_0x3f87('0x74'),_0x19dfd3,_0x536a86);}else{if(_0x2e12a3[_0x3f87('0x35')][_0x5e8567]===_0x3f87('0x75')){_0x3b6997['where']('i.'+_0x5e8567+_0x3f87('0x76'));}else{_0x3b6997[_0x3f87('0x3b')]('i.'+_0x5e8567+'\x20=\x20?',_0x2e12a3[_0x3f87('0x35')][_0x5e8567]);}}});}if(_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x77')]){if(_0x2e12a3['query']['read']==0x1){_0x3b6997[_0x3f87('0x57')](_0x3f87('0x78'));}else{_0x3b6997['having']('`unreadMessages`\x20>\x200');}}if(_0x2e12a3['query'][_0x3f87('0x79')]){_0x568e94=_[_0x3f87('0x7a')](_0x2e12a3['query']['tag'])?_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x79')]:new Array(_0x2e12a3[_0x3f87('0x35')]['tag']);_0x568e94[_0x3f87('0x65')](function(_0x5cd3c1){_0x5166be['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5cd3c1+',%');});}if(_0x2e12a3[_0x3f87('0x35')]['filter']){var _0x104a78=_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x7b')][_0x3f87('0x7c')]('\x5c','\x5c\x5c')[_0x3f87('0x7c')](/'/g,'\x27\x27');if(qs[_0x3f87('0x7d')](_0x104a78)){_0x131aa6['or'](_0x3f87('0x7e'),_0x104a78+'%');}else{_0x131aa6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x104a78))['or'](_0x3f87('0x7f'),_0x104a78+'%')['or'](_0x3f87('0x80'),_0x104a78+'%');}}}_0x3b6997[_0x3f87('0x3b')](_0x131aa6);_0x3b6997[_0x3f87('0x81')](_0x3f87('0x82'));var _0x2e0253={'type':db[_0x3f87('0x83')]['QueryTypes'][_0x3f87('0x84')],'raw':!![]};var _0x53c196=_0x3b6997[_0x3f87('0x85')]();_0x53c196[_0x3f87('0x3e')]('i.id');_0x53c196[_0x3f87('0x3e')](_0x3f87('0x86'),'unreadMessages');if(_0x5eafd4['order']){_0x5eafd4[_0x3f87('0x3a')][_0x3f87('0x65')](function(_0x3f45c3){var _0x265a68=_0x3f45c3[0x0]===_0x3f87('0x87')?_0x3f45c3[0x0]:'i.'+_0x3f45c3[0x0];_0x3b6997[_0x3f87('0x3a')](_0x265a68,_0x3f45c3[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3f87('0x6c')](_0x568e94)){_0x3b6997[_0x3f87('0x57')](_0x5166be);_0x53c196[_0x3f87('0x3b')]('t.id\x20IN\x20?',_0x568e94);}BPromise[_0x3f87('0x88')]()['then'](function(){if(!_0x3d047b){if(_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x6d')]||_0x2e12a3['query'][_0x3f87('0x89')])return;_0x53c196['where'](_0x3f87('0x8a'));_0x3b6997['where'](_0x3f87('0x8a'));return;}if(_0x2e12a3[_0x3f87('0x8b')]['role']!==_0x3f87('0x8c'))return;return _0x2e12a3[_0x3f87('0x8b')][_0x3f87('0x8d')]({'attributes':['id'],'raw':!![]})[_0x3f87('0x2a')](function(_0x458ebc){if(_[_0x3f87('0x6c')](_0x458ebc)){_0x53c196['where'](_0x3f87('0x8e'));_0x3b6997[_0x3f87('0x3b')](_0x3f87('0x8e'));}else{_0x53c196['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x3f87('0x25')](_0x458ebc,'id'));_0x3b6997['where'](_0x3f87('0x6e'),_[_0x3f87('0x25')](_0x458ebc,'id'));}});})[_0x3f87('0x2a')](function(){if(_0x2e12a3[_0x3f87('0x8b')][_0x3f87('0x8f')]==='agent'&&!_0x3d047b&&!_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x6d')])return[];return db['sequelize'][_0x3f87('0x35')](_0x53c196[_0x3f87('0x90')](),_0x2e0253);})[_0x3f87('0x2a')](function(_0x4f80c1){_0x6da4c5[_0x3f87('0x91')]=_0x4f80c1[_0x3f87('0x38')];if(_0x6da4c5['count']===0x0)return[];return db['sequelize'][_0x3f87('0x35')](_0x13c34b[_0x3f87('0x90')](),_0x2e0253)[_0x3f87('0x2a')](function(_0x1d230d){_0x50ede8=_['keyBy'](_0x1d230d,'id');_0x2e0253=_[_0x3f87('0x92')](_0x2e0253,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e12a3[_0x3f87('0x35')]['fields']){_0x5eafd4[_0x3f87('0x37')][_0x3f87('0x65')](function(_0x400704){_0x3b6997[_0x3f87('0x3e')]('i.'+_0x400704);});}else{_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x86'),'unreadMessages');_0x3b6997['field']('a.key',_0x3f87('0x93'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x94'),_0x3f87('0x95'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x96'),'contactName');_0x3b6997['field'](_0x3f87('0x97'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x98'),_0x3f87('0x99'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9a'),_0x3f87('0x9b'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9c'),_0x3f87('0x9d'));_0x3b6997[_0x3f87('0x3e')]('c.phone','Contact.phone');_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9e'),'Contact.mobile');_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9f'),_0x3f87('0xa0'));_0x3b6997['field'](_0x3f87('0xa1'),_0x3f87('0xa2'));_0x3b6997[_0x3f87('0x3e')]('o.internal',_0x3f87('0xa3'));_0x3b6997['field'](_0x3f87('0xa4'),_0x3f87('0x27'));}if(_0x5eafd4['limit'])_0x3b6997[_0x3f87('0x1c')](_0x5eafd4[_0x3f87('0x1c')]);if(_0x5eafd4[_0x3f87('0x1b')])_0x3b6997[_0x3f87('0x1b')](_0x5eafd4['offset']);return db[_0x3f87('0xa5')][_0x3f87('0x35')](_0x3b6997[_0x3f87('0x90')](),_0x2e0253);})[_0x3f87('0x2a')](function(_0x3a2b2f){_0x5a94a8[_0x3f87('0x3b')](_0x3f87('0xa6'),_[_0x3f87('0x25')](_0x3a2b2f,'id'));return db[_0x3f87('0xa5')]['query'](_0x5a94a8['toString'](),_0x2e0253)[_0x3f87('0x2a')](function(_0x20dc35){var _0x1d43fd=_[_0x3f87('0xa7')](_0x20dc35,_0x3f87('0xa8'));var _0x4d4409=[];_0x3a2b2f[_0x3f87('0x65')](function(_0x450f92){_0x4d4409['push'](updateOpenchannelInteraction(_0x450f92,_0x50ede8,_0x1d43fd));});return BPromise[_0x3f87('0xa9')](_0x4d4409);});});})['then'](function(_0x396efa){_0x6da4c5[_0x3f87('0xaa')]=_0x396efa;return _0x6da4c5;})[_0x3f87('0x2a')](respondWithFilteredResult(_0x4a309f,_0x5eafd4))[_0x3f87('0x2b')](handleError(_0x4a309f,null));};exports[_0x3f87('0xab')]=function(_0x2b72b9,_0x20e8dd){var _0x4bec1a={};if(_0x2b72b9[_0x3f87('0x35')]['type']&&_0x2b72b9[_0x3f87('0x35')][_0x3f87('0x30')]===_0x3f87('0x43')){_0x4bec1a[_0x3f87('0x43')]=_0x2b72b9[_0x3f87('0xac')]['id'];}else{_0x4bec1a['id']=_0x2b72b9['params']['id'];}var _0x47f81c={'raw':![],'where':_0x4bec1a},_0x34a7d9={};_0x34a7d9['model']=_['keys'](db[_0x3f87('0x2d')][_0x3f87('0x2e')]);_0x34a7d9[_0x3f87('0x35')]=_[_0x3f87('0x33')](_0x2b72b9[_0x3f87('0x35')]);_0x34a7d9[_0x3f87('0x3c')]=_[_0x3f87('0x34')](_0x34a7d9['model'],_0x34a7d9['query']);_0x47f81c['attributes']=_[_0x3f87('0x34')](_0x34a7d9['model'],qs[_0x3f87('0x36')](_0x2b72b9[_0x3f87('0x35')][_0x3f87('0x36')]));_0x47f81c[_0x3f87('0x37')]=_0x47f81c['attributes'][_0x3f87('0x38')]?_0x47f81c['attributes']:_0x34a7d9[_0x3f87('0x32')];if(_0x2b72b9[_0x3f87('0x35')]['includeAll']){_0x47f81c[_0x3f87('0xad')]=[{'all':!![]}];}_0x47f81c=_[_0x3f87('0x92')]({},_0x47f81c,_0x2b72b9[_0x3f87('0xae')]);return db[_0x3f87('0x2d')][_0x3f87('0x60')](_0x47f81c)[_0x3f87('0x2a')](handleEntityNotFound(_0x20e8dd,null))['then'](respondWithResult(_0x20e8dd,null))[_0x3f87('0x2b')](handleError(_0x20e8dd,null));};exports[_0x3f87('0xaf')]=function(_0x3e2f94,_0x5aeb27){return db[_0x3f87('0x2d')]['create'](_0x3e2f94['body'],{})[_0x3f87('0x2a')](respondWithResult(_0x5aeb27,0xc9))['catch'](handleError(_0x5aeb27,null));};exports[_0x3f87('0x20')]=function(_0x3f1e9d,_0x2ef034){if(_0x3f1e9d[_0x3f87('0x69')]['id']){delete _0x3f1e9d['body']['id'];}return db[_0x3f87('0x2d')][_0x3f87('0x60')]({'where':{'id':_0x3f1e9d[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x2ef034,null))[_0x3f87('0x2a')](saveUpdates(_0x3f1e9d[_0x3f87('0x69')],null))[_0x3f87('0x2a')](respondWithResult(_0x2ef034,null))[_0x3f87('0x2b')](handleError(_0x2ef034,null));};exports[_0x3f87('0xb0')]=function(_0x510a9b,_0x5c793e){return db['OpenchannelInteraction'][_0x3f87('0x60')]({'where':{'id':_0x510a9b[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x5c793e,null))[_0x3f87('0x2a')](removeEntity(_0x5c793e,null))['catch'](handleError(_0x5c793e,null));};exports['describe']=function(_0x2efebd,_0x270eb0){return db[_0x3f87('0x2d')][_0x3f87('0xb1')]()[_0x3f87('0x2a')](respondWithResult(_0x270eb0,null))['catch'](handleError(_0x270eb0,null));};exports['addMessage']=function(_0x226778,_0xa58e7d,_0x490589){return db[_0x3f87('0xb2')]['find']({'where':{'id':_0x226778[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0xa58e7d,null))[_0x3f87('0x2a')](function(_0x3e01d6){if(_0x3e01d6){return _0x3e01d6[_0x3f87('0xb3')](_0x226778[_0x3f87('0x69')][_0x3f87('0xb4')],_[_0x3f87('0xb5')](_0x226778['body'],[_0x3f87('0xb4'),'id'])||{});}})['then'](respondWithResult(_0xa58e7d,null))[_0x3f87('0x2b')](handleError(_0xa58e7d,null));};exports[_0x3f87('0xb6')]=function(_0x29d2f4,_0x59c00a,_0x47b468){var _0x106f8c={'raw':![],'where':{}};var _0x39401c={};var _0x47a84d={'count':0x0,'rows':[]};return db[_0x3f87('0x2d')][_0x3f87('0xb7')]({'where':{'id':_0x29d2f4[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x59c00a,null))[_0x3f87('0x2a')](function(_0x36b81a){if(_0x36b81a){_0x39401c[_0x3f87('0x32')]=_[_0x3f87('0x33')](db[_0x3f87('0xb2')]['rawAttributes']);_0x39401c[_0x3f87('0x35')]=_[_0x3f87('0x33')](_0x29d2f4['query']);_0x39401c[_0x3f87('0x3c')]=_[_0x3f87('0x34')](_0x39401c[_0x3f87('0x32')],_0x39401c[_0x3f87('0x35')]);_0x106f8c['attributes']=_[_0x3f87('0x34')](_0x39401c[_0x3f87('0x32')],qs[_0x3f87('0x36')](_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x36')]));_0x106f8c[_0x3f87('0x37')]=_0x106f8c[_0x3f87('0x37')]['length']?_0x106f8c[_0x3f87('0x37')]:_0x39401c[_0x3f87('0x32')];if(!_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x39')](_0x3f87('0xb8'))){_0x106f8c['limit']=qs[_0x3f87('0x1c')](_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x1c')]);_0x106f8c[_0x3f87('0x1b')]=qs[_0x3f87('0x1b')](_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x1b')]);}_0x106f8c[_0x3f87('0x3a')]=qs[_0x3f87('0xb9')](_0x29d2f4['query']['sort']);_0x106f8c[_0x3f87('0x3b')]=qs[_0x3f87('0x3c')](_[_0x3f87('0x3d')](_0x29d2f4[_0x3f87('0x35')],_0x39401c['filters']));_0x106f8c[_0x3f87('0x3b')]['OpenchannelInteractionId']=_0x36b81a['id'];if(_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x7b')]){_0x106f8c[_0x3f87('0x3b')]=_[_0x3f87('0x92')](_0x106f8c[_0x3f87('0x3b')],{'$or':_['map'](_0x106f8c['attributes'],function(_0x52d7b9){var _0x302c6d={};_0x302c6d[_0x52d7b9]={'$like':'%'+_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x7b')]+'%'};return _0x302c6d;})});}if(_0x29d2f4['query']['$gte']){var _0x2a7a67=_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x71')][_0x3f87('0x29')](',');var _0x3353b5={};_0x3353b5[_0x2a7a67[0x0]]={'$gte':moment(_0x2a7a67[0x1])['format'](_0x3f87('0xba'))};_0x106f8c['where']=_['merge'](_0x106f8c['where'],_0x3353b5);}_0x106f8c=_['merge']({},_0x106f8c,_0x29d2f4[_0x3f87('0xae')]);return db[_0x3f87('0xb2')][_0x3f87('0x91')]({'where':_0x106f8c[_0x3f87('0x3b')]})[_0x3f87('0x2a')](function(_0x591857){_0x47a84d[_0x3f87('0x91')]=_0x591857;if(_0x29d2f4[_0x3f87('0x35')][_0x3f87('0xbb')]){_0x106f8c['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3f87('0xbc')](_0x106f8c);})[_0x3f87('0x2a')](function(_0x2773ed){_0x47a84d[_0x3f87('0xaa')]=_0x2773ed;return _0x47a84d;});}})[_0x3f87('0x2a')](respondWithFilteredResult(_0x59c00a,_0x106f8c))[_0x3f87('0x2b')](handleError(_0x59c00a,null));};exports[_0x3f87('0xbd')]=function(_0x312b2a,_0x48db58,_0x44e556){return db['OpenchannelInteraction']['find']({'where':{'id':_0x312b2a[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x48db58,null))[_0x3f87('0x2a')](function(_0x4f8950){if(_0x4f8950){return _0x4f8950[_0x3f87('0xbe')](_0x312b2a[_0x3f87('0x69')][_0x3f87('0xb4')],_[_0x3f87('0xb5')](_0x312b2a[_0x3f87('0x69')],['ids','id'])||{})[_0x3f87('0xbf')](function(){return db[_0x3f87('0x64')][_0x3f87('0xbc')]({'attributes':['id',_0x3f87('0x23'),_0x3f87('0xc0')],'where':{'id':_0x312b2a[_0x3f87('0x69')]['ids']}});})[_0x3f87('0x2a')](function(_0x2ed6b0){socket[_0x3f87('0xc1')]('openchannelInteractionTags:save',{'id':Number(_0x312b2a[_0x3f87('0xac')]['id']),'tags':_0x2ed6b0||[]});return{'id':Number(_0x312b2a[_0x3f87('0xac')]['id']),'tags':_0x2ed6b0||[]};});}})[_0x3f87('0x2a')](respondWithResult(_0x48db58,null))[_0x3f87('0x2b')](handleError(_0x48db58,null));};exports[_0x3f87('0xc2')]=function(_0x3e2a15,_0x25700f,_0xee7104){return db[_0x3f87('0x2d')][_0x3f87('0x60')]({'where':{'id':_0x3e2a15[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x25700f,null))['then'](function(_0x4dcacd){if(_0x4dcacd){return _0x4dcacd['removeTags'](_0x3e2a15['query'][_0x3f87('0xb4')]);}})['then'](respondWithStatusCode(_0x25700f,null))[_0x3f87('0x2b')](handleError(_0x25700f,null));};exports[_0x3f87('0xc3')]=function(_0x52a3f8,_0x57d07b){var _0x139fe1=moment()[_0x3f87('0xc4')]()['toString']();var _0x3b4f71=path['join'](config[_0x3f87('0xc5')],_0x3f87('0xc6'),_0x3f87('0xc7'),_0x3f87('0xc8'));var _0x43e49e=path[_0x3f87('0xc9')](config[_0x3f87('0xc5')],_0x3f87('0xc6'),_0x3f87('0xc7'),_0x3f87('0xca'));var _0x559151=path['join'](_0x3b4f71,_0x139fe1);var _0xf90e6b=util[_0x3f87('0xcb')]('transcript-%d-%s.zip',_0x52a3f8[_0x3f87('0xac')]['id'],_0x139fe1);var _0x2b1a8c=path[_0x3f87('0xc9')](_0x3b4f71,_0xf90e6b);var _0x4fed89=[];_0x4fed89['push']({'model':db[_0x3f87('0xcc')],'as':_0x3f87('0xcc'),'attributes':['id',_0x3f87('0x26')],'raw':!![]});_0x4fed89[_0x3f87('0xcd')]({'model':db[_0x3f87('0xce')],'as':_0x3f87('0x59'),'attributes':['id',_0x3f87('0xcf'),_0x3f87('0xd0')],'raw':!![]});if(_0x52a3f8[_0x3f87('0x35')][_0x3f87('0xca')]){_0x4fed89[_0x3f87('0xcd')]({'model':db[_0x3f87('0xd1')],'as':_0x3f87('0xd1'),'raw':!![]});}var _0x6c8193=[{'model':db[_0x3f87('0xb2')],'as':_0x3f87('0xd2'),'attributes':['id',_0x3f87('0x69'),_0x3f87('0x70'),_0x3f87('0xd3'),_0x3f87('0xd4'),_0x3f87('0x77')],'include':_0x4fed89}];_0x6c8193[_0x3f87('0xcd')]({'model':db[_0x3f87('0xd5')],'as':_0x3f87('0xd6'),'attributes':['id',_0x3f87('0x23')]});_0x6c8193[_0x3f87('0xcd')]({'model':db[_0x3f87('0xcc')],'as':_0x3f87('0xd7'),'attributes':['id',_0x3f87('0x26')]});return db[_0x3f87('0x2d')][_0x3f87('0x60')]({'where':{'id':_0x52a3f8['params']['id']},'include':_0x6c8193})[_0x3f87('0x2a')](handleEntityNotFound(_0x57d07b,null))[_0x3f87('0x2a')](function(_0x863b04){if(_0x863b04){var _0x4ca607=_0x863b04['get']({'plain':!![]});fs[_0x3f87('0xd8')](_0x559151);var _0x32892e={'format':'A4','border':_0x3f87('0xd9'),'header':{'height':'40px','contents':{'first':_0x3f87('0xda')}},'footer':{'height':_0x3f87('0xdb'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x3f87('0xdc'),'Openchannel',_0x4ca607['id']),moment()[_0x3f87('0xcb')]('YYYY-MM-DD')[_0x3f87('0x90')]())}}};var _0x525fc5={'channel':_0x3f87('0xdd'),'account':_0x4ca607[_0x3f87('0xd6')][_0x3f87('0x23')],'agent':_0x4ca607[_0x3f87('0xd7')]?_0x4ca607[_0x3f87('0xd7')]['fullname']:'N.A.','createdAt':moment(_0x4ca607[_0x3f87('0x70')])['format'](_0x3f87('0xba'))['toString'](),'closedAt':_0x4ca607[_0x3f87('0xde')]?moment(_0x4ca607[_0x3f87('0xdf')])[_0x3f87('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3f87('0x90')]():'','disposition':_0x4ca607[_0x3f87('0xe0')],'visibility':_0x4ca607[_0x3f87('0xe1')]?_0x3f87('0xe2'):'Private','messages':_(_0x4ca607[_0x3f87('0xd2')])[_0x3f87('0x7b')]({'secret':![]})[_0x3f87('0x25')](function(_0x2e6213){if(_0x2e6213['Attachment']){var _0x234ad7=path[_0x3f87('0xc9')](_0x43e49e,_0x2e6213[_0x3f87('0xd1')][_0x3f87('0xe3')]);if(fs[_0x3f87('0xe4')](_0x234ad7)){fs[_0x3f87('0xe5')](_0x234ad7)[_0x3f87('0xe6')](fs['createWriteStream'](path[_0x3f87('0xc9')](_0x559151,_0x2e6213[_0x3f87('0xd1')][_0x3f87('0xe3')])));}}return{'date':moment(_0x2e6213[_0x3f87('0x70')])[_0x3f87('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3f87('0x90')](),'sender':_0x2e6213[_0x3f87('0xd3')]==='out'?_0x2e6213['User']?_0x2e6213[_0x3f87('0xcc')][_0x3f87('0x26')]:_0x3f87('0xe7'):_0x2e6213[_0x3f87('0x59')][_0x3f87('0xcf')]+(_0x2e6213[_0x3f87('0x59')][_0x3f87('0xd0')]?'\x20'+_0x2e6213[_0x3f87('0x59')]['lastName']:''),'body':_0x2e6213[_0x3f87('0xd1')]?_0x2e6213[_0x3f87('0xd1')][_0x3f87('0xe3')]:_0x2e6213[_0x3f87('0x69')],'direction':_0x2e6213[_0x3f87('0xd3')]===_0x3f87('0xe8')?'A':'C','secret':_0x2e6213[_0x3f87('0xd4')],'read':_0x2e6213['read'],'attachment':_0x2e6213[_0x3f87('0xd1')]};})[_0x3f87('0x5c')]()};return ejs[_0x3f87('0xe9')](path['join'](config['root'],_0x3f87('0xc6'),'views',_0x3f87('0xea')),{'interaction':_0x525fc5})['then'](function(_0x2c87e0){return new BPromise(function(_0x10f543,_0x4ebbcd){pdf[_0x3f87('0xaf')](_0x2c87e0,_0x32892e)['toFile'](path['join'](_0x559151,_0x3f87('0xeb')+_0x4ca607['id']+'-'+_0x139fe1+_0x3f87('0xec')),function(_0x38b36f,_0x1a19e3){if(_0x38b36f)return _0x4ebbcd(_0x38b36f);_0x10f543(_0x1a19e3);});});})['then'](function(){return new BPromise(function(_0x14079d,_0x3c6cc8){zipdir(_0x559151,{'saveTo':_0x2b1a8c},function(_0x56a899,_0x2ce5e8){if(_0x56a899)return _0x3c6cc8(_0x56a899);return _0x14079d(_0x2ce5e8);});})['then'](function(){return new BPromise(function(_0x12027c,_0x1a9729){rimraf(_0x559151,function(_0x54bf3d){if(_0x54bf3d)_0x1a9729(_0x54bf3d);return _0x12027c();});});})[_0x3f87('0x2a')](function(){return _0x57d07b[_0x3f87('0xc3')](_0x2b1a8c,_0xf90e6b,function(_0x36ad12){if(_0x36ad12){console['log'](_0x3f87('0xed'),_0x36ad12);}else{fs['unlinkSync'](_0x2b1a8c);}});});});}else{return _0x57d07b[_0x3f87('0x18')](0xc8);}})[_0x3f87('0x2b')](handleError(_0x57d07b,null));}; \ No newline at end of file +var _0x0984=['nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','having','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','count','merge','OpenchannelInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','push','all','rows','params','includeAll','include','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','getMessages','pick','OpenchannelInteractionId','format','findAll','addTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','secret','Account','Owner','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','existsSync','createReadStream','createWriteStream','basename','out','System','firstName','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','fullname','TagIds','forEach','Tags','catch','index','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x5b825a,_0x4d4d06){var _0x29de9f=function(_0x2c7fcd){while(--_0x2c7fcd){_0x5b825a['push'](_0x5b825a['shift']());}};_0x29de9f(++_0x4d4d06);}(_0x0984,0x1b0));var _0x4098=function(_0x2006cf,_0x410386){_0x2006cf=_0x2006cf-0x0;var _0x437451=_0x0984[_0x2006cf];return _0x437451;};'use strict';var pdf=require(_0x4098('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4098('0x1'));var zipdir=require(_0x4098('0x2'));var jsonpatch=require(_0x4098('0x3'));var rp=require(_0x4098('0x4'));var moment=require(_0x4098('0x5'));var BPromise=require(_0x4098('0x6'));var Mustache=require(_0x4098('0x7'));var util=require(_0x4098('0x8'));var path=require(_0x4098('0x9'));var sox=require(_0x4098('0xa'));var csv=require(_0x4098('0xb'));var ejs=require(_0x4098('0xc'));var fs=require('fs');var _=require(_0x4098('0xd'));var squel=require(_0x4098('0xe'));var crypto=require(_0x4098('0xf'));var jsforce=require(_0x4098('0x10'));var deskjs=require(_0x4098('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4098('0x12'));var Papa=require('papaparse');var Redis=require(_0x4098('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4098('0x14'));var as=require(_0x4098('0x15'));var hardwareService=require(_0x4098('0x16'));var logger=require('../../config/logger')(_0x4098('0x17'));var utils=require(_0x4098('0x18'));var config=require(_0x4098('0x19'));var licenseUtil=require(_0x4098('0x1a'));var db=require(_0x4098('0x1b'))['db'];config[_0x4098('0x1c')]=_[_0x4098('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4098('0x1e'))[_0x4098('0x1f')](socket);function respondWithStatusCode(_0x35b722,_0x5d7ca9){_0x5d7ca9=_0x5d7ca9||0xcc;return function(_0x605812){if(_0x605812){return _0x35b722[_0x4098('0x20')](_0x5d7ca9);}return _0x35b722[_0x4098('0x21')](_0x5d7ca9)[_0x4098('0x22')]();};}function respondWithResult(_0xe5e3a,_0x1eed9f){_0x1eed9f=_0x1eed9f||0xc8;return function(_0x3be17c){if(_0x3be17c){return _0xe5e3a['status'](_0x1eed9f)[_0x4098('0x23')](_0x3be17c);}};}function respondWithFilteredResult(_0x5647fd,_0x4c225d){return function(_0x57967f){if(_0x57967f){var _0x49e45a=_0x57967f['count'],_0x473e33=_0x4c225d['offset'],_0x5add97=_0x4c225d[_0x4098('0x24')]+_0x4c225d[_0x4098('0x25')],_0x1097c9;if(_0x5add97>=_0x49e45a){_0x5add97=_0x49e45a;_0x1097c9=0xc8;}else{_0x1097c9=0xce;}_0x5647fd[_0x4098('0x21')](_0x1097c9);return _0x5647fd[_0x4098('0x26')](_0x4098('0x27'),_0x473e33+'-'+_0x5add97+'/'+_0x49e45a)[_0x4098('0x23')](_0x57967f);}return null;};}function patchUpdates(_0x5347c3){return function(_0x1ad5a8){try{jsonpatch[_0x4098('0x28')](_0x1ad5a8,_0x5347c3,!![]);}catch(_0x19ac85){return BPromise[_0x4098('0x29')](_0x19ac85);}return _0x1ad5a8[_0x4098('0x2a')]();};}function saveUpdates(_0xc223d3,_0x421fac){return function(_0x2be75b){if(_0x2be75b){return _0x2be75b['update'](_0xc223d3)[_0x4098('0x2b')](function(_0x5cea0f){return _0x5cea0f;});}return null;};}function removeEntity(_0x93f80d,_0x5cc553){return function(_0x57fbcb){if(_0x57fbcb){return _0x57fbcb[_0x4098('0x2c')]()[_0x4098('0x2b')](function(){_0x93f80d[_0x4098('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350176,_0x26b3c3){return function(_0x3c854e){if(!_0x3c854e){_0x350176[_0x4098('0x20')](0x194);}return _0x3c854e;};}function handleError(_0x538ad4,_0x4190e8){_0x4190e8=_0x4190e8||0x1f4;return function(_0x1d4318){logger[_0x4098('0x2d')](_0x1d4318[_0x4098('0x2e')]);if(_0x1d4318[_0x4098('0x2f')]){delete _0x1d4318[_0x4098('0x2f')];}_0x538ad4[_0x4098('0x21')](_0x4190e8)[_0x4098('0x30')](_0x1d4318);};}function getInteractionUsers(_0x3215f2,_0x463e83){return new BPromise(function(_0x1dab6c,_0x24de01){try{if(_0x463e83[_0x3215f2['id']]){_0x3215f2['Users']=_[_0x4098('0x31')](_0x463e83[_0x3215f2['id']],function(_0x30443c){return{'id':_0x30443c['id'],'fullname':_0x30443c[_0x4098('0x32')]};});}}catch(_0x3ea09e){_0x24de01(_0x3ea09e);}_0x1dab6c(_0x3215f2);});}function getInteractionTags(_0xb7aa8d,_0x167d36){return new BPromise(function(_0x4f5c9d,_0xecc2b7){try{if(_0xb7aa8d[_0x4098('0x33')]){_0xb7aa8d['Tags']=[];_0xb7aa8d[_0x4098('0x33')]['split'](',')[_0x4098('0x34')](function(_0x287486){_0xb7aa8d[_0x4098('0x35')]['push'](_0x167d36[_0x287486]);});}delete _0xb7aa8d[_0x4098('0x33')];}catch(_0x26d69b){_0xecc2b7(_0x26d69b);}_0x4f5c9d(_0xb7aa8d);});}function updateOpenchannelInteraction(_0x352bbe,_0xd801d9,_0x1a6c91){return new BPromise(function(_0x419ae7,_0x4ec406){return getInteractionUsers(_0x352bbe,_0x1a6c91)[_0x4098('0x2b')](function(_0xd2fa43){return getInteractionTags(_0xd2fa43,_0xd801d9);})[_0x4098('0x2b')](function(_0xe7c5ac){_0x419ae7(_0xe7c5ac);})[_0x4098('0x36')](function(_0x1504f8){_0x4ec406(_0x1504f8);});});}exports[_0x4098('0x37')]=function(_0x168442,_0x439f1b){var _0x2f8d2d={},_0x3efc8f={},_0xa06c8c={'count':0x0,'rows':[]};var _0x5e13cf=_[_0x4098('0x31')](db['OpenchannelInteraction'][_0x4098('0x38')],function(_0xe76dc5){return{'name':_0xe76dc5[_0x4098('0x39')],'type':_0xe76dc5[_0x4098('0x3a')][_0x4098('0x3b')]};});_0x3efc8f['model']=_[_0x4098('0x31')](_0x5e13cf,_0x4098('0x2f'));_0x3efc8f['query']=_[_0x4098('0x3c')](_0x168442[_0x4098('0x3d')]);_0x3efc8f[_0x4098('0x3e')]=_[_0x4098('0x3f')](_0x3efc8f[_0x4098('0x40')],_0x3efc8f[_0x4098('0x3d')]);_0x2f8d2d[_0x4098('0x41')]=_[_0x4098('0x3f')](_0x3efc8f[_0x4098('0x40')],qs[_0x4098('0x42')](_0x168442['query'][_0x4098('0x42')]));_0x2f8d2d['attributes']=_0x2f8d2d['attributes']['length']?_0x2f8d2d[_0x4098('0x41')]:_0x3efc8f['model'];if(!_0x168442[_0x4098('0x3d')][_0x4098('0x43')](_0x4098('0x44'))){_0x2f8d2d[_0x4098('0x25')]=qs[_0x4098('0x25')](_0x168442[_0x4098('0x3d')][_0x4098('0x25')]);_0x2f8d2d[_0x4098('0x24')]=qs[_0x4098('0x24')](_0x168442[_0x4098('0x3d')][_0x4098('0x24')]);}_0x2f8d2d[_0x4098('0x45')]=qs[_0x4098('0x46')](_0x168442[_0x4098('0x3d')][_0x4098('0x46')]);_0x2f8d2d[_0x4098('0x47')]=qs[_0x4098('0x3e')](_['pick'](_0x168442[_0x4098('0x3d')],_0x3efc8f['filters']),_0x5e13cf);var _0x301494=[];var _0x5e5ff4=squel[_0x4098('0x48')]()[_0x4098('0x49')]('id')[_0x4098('0x49')](_0x4098('0x2f'))['field'](_0x4098('0x4a'))[_0x4098('0x4b')](_0x4098('0x4c'));var _0x415c53=squel['select']()[_0x4098('0x49')](_0x4098('0x4d'))[_0x4098('0x49')](_0x4098('0x4e'))[_0x4098('0x49')]('ui.OpenchannelInteractionId')[_0x4098('0x4b')](_0x4098('0x4f'),'ui')[_0x4098('0x50')](_0x4098('0x51'),'u',_0x4098('0x52'));var _0x3cde74=squel['select']()['from'](_0x4098('0x53'),'i')[_0x4098('0x50')](_0x4098('0x54'),'c',_0x4098('0x55'))[_0x4098('0x50')]('users','o',_0x4098('0x56'))[_0x4098('0x50')](_0x4098('0x57'),'a',_0x4098('0x58'))[_0x4098('0x50')](_0x4098('0x59'),'me',_0x4098('0x5a'))[_0x4098('0x50')](_0x4098('0x5b'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x4098('0x50')](_0x4098('0x4c'),'t',_0x4098('0x5c'));var _0x2ecc6f=squel[_0x4098('0x5d')]();var _0x429ad6=[];var _0x2d14c9=squel[_0x4098('0x5d')]();var _0x4dfe9b;if(_0x168442[_0x4098('0x3d')][_0x4098('0x5e')]){_0x4dfe9b=as[_0x4098('0x5f')](_0x168442['query']['search']);var _0x101a52=_0x4dfe9b[_0x4098('0x60')];for(var _0x296884=0x0;_0x296884<_0x4dfe9b['conditions'][_0x4098('0x61')];_0x296884++){var _0x2db56f=_0x4dfe9b[_0x4098('0x62')][_0x296884];var _0x4b222f='i';var _0x4777e8=_['find'](_0x5e13cf,['name',_0x2db56f[_0x4098('0x49')]]);if(!_0x4777e8){switch(_0x2db56f[_0x4098('0x49')]){case _0x4098('0x63'):if(_0x2db56f[_0x4098('0x64')]==0x1){_0x3cde74['having']('`'+_0x2db56f[_0x4098('0x49')]+'`\x20=\x200');}else{_0x3cde74[_0x4098('0x65')]('`'+_0x2db56f[_0x4098('0x49')]+'`\x20>\x200');}break;case _0x4098('0x66'):if(_0x2db56f[_0x4098('0x67')]===_0x4098('0x68')){if(_0x2db56f[_0x4098('0x64')]['split']('\x20')['length']>0x1){_0x2ecc6f[_0x101a52]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4098('0x69')](_0x2db56f[_0x4098('0x64')]),null);}else{var _0x112ff9='%'+_0x2db56f[_0x4098('0x64')]+'%';_0x2ecc6f[_0x101a52](_0x4098('0x6a'),_0x112ff9,_0x112ff9,_0x112ff9);}}else{_0x4777e8=_[_0x4098('0x6b')](_0x5e13cf,['name',_0x4098('0x6c')]);_0x2db56f[_0x4098('0x49')]=_0x4098('0x6c');_0x2493ab=as[_0x4098('0x6d')](_0x4b222f,_0x4777e8['type'],_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab['text'],_0x2493ab['value'][_0x4098('0x6e')],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);}break;case _0x4098('0x6f'):var _0x474cfa=_0x2db56f[_0x4098('0x64')][_0x4098('0x70')](',')[_0x4098('0x31')](function(_0x57ad9e){return Number(_0x57ad9e);});_0x474cfa[_0x4098('0x34')](function(_0x4ce501){_0x2d14c9['or'](_0x4098('0x71'),'%,'+_0x4ce501+',%');});_0x429ad6=_[_0x4098('0x72')](_0x429ad6,_0x474cfa);break;case _0x4098('0x73'):if(_0x2db56f[_0x4098('0x67')]===_0x4098('0x68')){_0x2ecc6f[_0x101a52](_0x4098('0x74'),'%'+_0x2db56f[_0x4098('0x64')]+'%',null);}else{_0x4777e8=_['find'](_0x5e13cf,[_0x4098('0x2f'),'UserId']);_0x2db56f[_0x4098('0x49')]='UserId';_0x2493ab=as[_0x4098('0x6d')](_0x4b222f,_0x4777e8['type'],_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab[_0x4098('0x75')],_0x2493ab[_0x4098('0x64')]['start'],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);}break;case'body':_0x2493ab=as[_0x4098('0x6d')]('me',null,_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab[_0x4098('0x75')],_0x2493ab['value'][_0x4098('0x6e')],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);break;}}else{var _0x2493ab=as[_0x4098('0x6d')](_0x4b222f,_0x4777e8[_0x4098('0x3a')],_0x2db56f);_0x2ecc6f[_0x101a52](_0x2493ab[_0x4098('0x75')],_0x2493ab[_0x4098('0x64')]['start'],_0x2493ab[_0x4098('0x64')][_0x4098('0x22')]);}}}else{var _0x485947=_(_0x168442[_0x4098('0x3d')])[_0x4098('0x3c')]()['map'](function(_0x33be12){return _[_0x4098('0x76')](_0x5e13cf,[_0x4098('0x2f'),_0x33be12])?_0x33be12:undefined;})[_0x4098('0x77')]()[_0x4098('0x64')]();if(!_[_0x4098('0x78')](_0x485947)){_0x485947[_0x4098('0x34')](function(_0xa199d2){if(_0xa199d2==='OpenchannelAccountId'){_0x3cde74['where'](_0x4098('0x79'),[][_0x4098('0x7a')](_0x168442[_0x4098('0x3d')][_0xa199d2]));}else if(_0xa199d2===_0x4098('0x7b')){var _0x7e0bc=JSON[_0x4098('0x7c')](_0x168442[_0x4098('0x3d')][_0xa199d2])[_0x4098('0x7d')];var _0x454a04=JSON[_0x4098('0x7c')](_0x168442[_0x4098('0x3d')][_0xa199d2])[_0x4098('0x7e')];_0x3cde74[_0x4098('0x47')](_0x4098('0x7f'),_0x7e0bc,_0x454a04);}else{if(_0x168442[_0x4098('0x3d')][_0xa199d2]===_0x4098('0x80')){_0x3cde74['where']('i.'+_0xa199d2+_0x4098('0x81'));}else{_0x3cde74[_0x4098('0x47')]('i.'+_0xa199d2+'\x20=\x20?',_0x168442[_0x4098('0x3d')][_0xa199d2]);}}});}if(_0x168442[_0x4098('0x3d')]['read']){if(_0x168442[_0x4098('0x3d')][_0x4098('0x82')]==0x1){_0x3cde74[_0x4098('0x65')](_0x4098('0x83'));}else{_0x3cde74[_0x4098('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x168442['query']['tag']){_0x429ad6=_[_0x4098('0x84')](_0x168442['query']['tag'])?_0x168442['query']['tag']:new Array(_0x168442[_0x4098('0x3d')]['tag']);_0x429ad6[_0x4098('0x34')](function(_0x15c6e2){_0x2d14c9['or'](_0x4098('0x71'),'%,'+_0x15c6e2+',%');});}if(_0x168442[_0x4098('0x3d')]['filter']){var _0x7f50b5=_0x168442['query'][_0x4098('0x85')][_0x4098('0x86')]('\x5c','\x5c\x5c')[_0x4098('0x86')](/'/g,'\x27\x27');if(qs[_0x4098('0x87')](_0x7f50b5)){_0x2ecc6f['or'](_0x4098('0x88'),_0x7f50b5+'%');}else{_0x2ecc6f['or'](_0x4098('0x89'),qs['getFullTextValue'](_0x7f50b5))['or'](_0x4098('0x8a'),_0x7f50b5+'%')['or'](_0x4098('0x8b'),_0x7f50b5+'%');}}}_0x3cde74[_0x4098('0x47')](_0x2ecc6f);_0x3cde74[_0x4098('0x8c')](_0x4098('0x8d'));var _0x3ee37a={'type':db[_0x4098('0x8e')][_0x4098('0x8f')][_0x4098('0x90')],'raw':!![]};var _0x4f58cf=_0x3cde74[_0x4098('0x91')]();_0x4f58cf[_0x4098('0x49')]('i.id');_0x4f58cf['field'](_0x4098('0x92'),_0x4098('0x63'));if(_0x2f8d2d[_0x4098('0x45')]){_0x2f8d2d['order']['forEach'](function(_0x31f646){var _0x2e3c0b=_0x31f646[0x0]===_0x4098('0x93')?_0x31f646[0x0]:'i.'+_0x31f646[0x0];_0x3cde74[_0x4098('0x45')](_0x2e3c0b,_0x31f646[0x1]===_0x4098('0x94')?![]:!![]);});}if(!_[_0x4098('0x78')](_0x429ad6)){_0x3cde74['having'](_0x2d14c9);_0x4f58cf[_0x4098('0x47')](_0x4098('0x95'),_0x429ad6);}BPromise[_0x4098('0x96')]()['then'](function(){if(!_0x4dfe9b){if(_0x168442['query'][_0x4098('0x97')]||_0x168442[_0x4098('0x3d')][_0x4098('0x98')])return;_0x4f58cf[_0x4098('0x47')](_0x4098('0x99'));_0x3cde74['where'](_0x4098('0x99'));return;}if(_0x168442[_0x4098('0x9a')]['role']!==_0x4098('0x9b'))return;return _0x168442[_0x4098('0x9a')][_0x4098('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x272197){if(_[_0x4098('0x78')](_0x272197)){_0x4f58cf[_0x4098('0x47')](_0x4098('0x9d'));_0x3cde74[_0x4098('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x4f58cf[_0x4098('0x47')](_0x4098('0x79'),_[_0x4098('0x31')](_0x272197,'id'));_0x3cde74[_0x4098('0x47')](_0x4098('0x79'),_[_0x4098('0x31')](_0x272197,'id'));}});})[_0x4098('0x2b')](function(){if(_0x168442[_0x4098('0x9a')][_0x4098('0x9e')]==='agent'&&!_0x4dfe9b&&!_0x168442[_0x4098('0x3d')][_0x4098('0x97')])return[];return db[_0x4098('0x9f')]['query'](_0x4f58cf['toString'](),_0x3ee37a);})['then'](function(_0x3c1516){_0xa06c8c['count']=_0x3c1516[_0x4098('0x61')];if(_0xa06c8c[_0x4098('0xa0')]===0x0)return[];return db[_0x4098('0x9f')][_0x4098('0x3d')](_0x5e5ff4['toString'](),_0x3ee37a)['then'](function(_0x2c04bd){_0x301494=_['keyBy'](_0x2c04bd,'id');_0x3ee37a=_[_0x4098('0xa1')](_0x3ee37a,{'model':db[_0x4098('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x168442['query'][_0x4098('0x42')]){_0x2f8d2d[_0x4098('0x41')][_0x4098('0x34')](function(_0x8a5cec){_0x3cde74[_0x4098('0x49')]('i.'+_0x8a5cec);});}else{_0x3cde74['field'](_0x4098('0x92'),_0x4098('0x63'));_0x3cde74[_0x4098('0x49')]('a.key',_0x4098('0xa3'));_0x3cde74[_0x4098('0x49')](_0x4098('0xa4'),_0x4098('0xa5'));_0x3cde74[_0x4098('0x49')](_0x4098('0xa6'),_0x4098('0x93'));_0x3cde74['field'](_0x4098('0xa7'));_0x3cde74[_0x4098('0x49')](_0x4098('0xa8'),'Contact.firstName');_0x3cde74[_0x4098('0x49')]('c.lastName',_0x4098('0xa9'));_0x3cde74[_0x4098('0x49')](_0x4098('0xaa'),'Contact.email');_0x3cde74[_0x4098('0x49')]('c.phone',_0x4098('0xab'));_0x3cde74['field']('c.mobile',_0x4098('0xac'));_0x3cde74[_0x4098('0x49')]('c.fax',_0x4098('0xad'));_0x3cde74[_0x4098('0x49')](_0x4098('0xae'),_0x4098('0xaf'));_0x3cde74[_0x4098('0x49')](_0x4098('0xb0'),_0x4098('0xb1'));_0x3cde74[_0x4098('0x49')](_0x4098('0xb2'),_0x4098('0x33'));}if(_0x2f8d2d['limit'])_0x3cde74[_0x4098('0x25')](_0x2f8d2d[_0x4098('0x25')]);if(_0x2f8d2d['offset'])_0x3cde74['offset'](_0x2f8d2d['offset']);return db['sequelize'][_0x4098('0x3d')](_0x3cde74[_0x4098('0xb3')](),_0x3ee37a);})[_0x4098('0x2b')](function(_0x17b07b){_0x415c53[_0x4098('0x47')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x17b07b,'id'));return db['sequelize'][_0x4098('0x3d')](_0x415c53[_0x4098('0xb3')](),_0x3ee37a)[_0x4098('0x2b')](function(_0x261bfe){var _0x1f828d=_[_0x4098('0xb4')](_0x261bfe,'OpenchannelInteractionId');var _0x4ae46a=[];_0x17b07b['forEach'](function(_0x1906c8){_0x4ae46a[_0x4098('0xb5')](updateOpenchannelInteraction(_0x1906c8,_0x301494,_0x1f828d));});return BPromise[_0x4098('0xb6')](_0x4ae46a);});});})['then'](function(_0x206d16){_0xa06c8c[_0x4098('0xb7')]=_0x206d16;return _0xa06c8c;})[_0x4098('0x2b')](respondWithFilteredResult(_0x439f1b,_0x2f8d2d))[_0x4098('0x36')](handleError(_0x439f1b,null));};exports['show']=function(_0xcdeec1,_0x26964d){var _0x3ab4ad={};if(_0xcdeec1[_0x4098('0x3d')][_0x4098('0x3a')]&&_0xcdeec1[_0x4098('0x3d')]['type']===_0x4098('0x4b')){_0x3ab4ad['from']=_0xcdeec1[_0x4098('0xb8')]['id'];}else{_0x3ab4ad['id']=_0xcdeec1[_0x4098('0xb8')]['id'];}var _0x380c18={'raw':![],'where':_0x3ab4ad},_0x332587={};_0x332587[_0x4098('0x40')]=_[_0x4098('0x3c')](db[_0x4098('0xa2')][_0x4098('0x38')]);_0x332587[_0x4098('0x3d')]=_[_0x4098('0x3c')](_0xcdeec1[_0x4098('0x3d')]);_0x332587['filters']=_[_0x4098('0x3f')](_0x332587['model'],_0x332587[_0x4098('0x3d')]);_0x380c18['attributes']=_[_0x4098('0x3f')](_0x332587[_0x4098('0x40')],qs[_0x4098('0x42')](_0xcdeec1[_0x4098('0x3d')][_0x4098('0x42')]));_0x380c18['attributes']=_0x380c18[_0x4098('0x41')][_0x4098('0x61')]?_0x380c18[_0x4098('0x41')]:_0x332587[_0x4098('0x40')];if(_0xcdeec1[_0x4098('0x3d')][_0x4098('0xb9')]){_0x380c18[_0x4098('0xba')]=[{'all':!![]}];}_0x380c18=_[_0x4098('0xa1')]({},_0x380c18,_0xcdeec1[_0x4098('0xbb')]);return db['OpenchannelInteraction'][_0x4098('0x6b')](_0x380c18)[_0x4098('0x2b')](handleEntityNotFound(_0x26964d,null))[_0x4098('0x2b')](respondWithResult(_0x26964d,null))[_0x4098('0x36')](handleError(_0x26964d,null));};exports[_0x4098('0xbc')]=function(_0x2b76cb,_0xfcdb46){return db['OpenchannelInteraction'][_0x4098('0xbc')](_0x2b76cb[_0x4098('0xbd')],{})[_0x4098('0x2b')](respondWithResult(_0xfcdb46,0xc9))['catch'](handleError(_0xfcdb46,null));};exports[_0x4098('0xbe')]=function(_0x3a6911,_0x408101){if(_0x3a6911[_0x4098('0xbd')]['id']){delete _0x3a6911[_0x4098('0xbd')]['id'];}return db[_0x4098('0xa2')]['find']({'where':{'id':_0x3a6911[_0x4098('0xb8')]['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0x408101,null))[_0x4098('0x2b')](saveUpdates(_0x3a6911['body'],null))[_0x4098('0x2b')](respondWithResult(_0x408101,null))[_0x4098('0x36')](handleError(_0x408101,null));};exports[_0x4098('0x2c')]=function(_0x444d33,_0x49441d){return db[_0x4098('0xa2')]['find']({'where':{'id':_0x444d33['params']['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0x49441d,null))[_0x4098('0x2b')](removeEntity(_0x49441d,null))[_0x4098('0x36')](handleError(_0x49441d,null));};exports[_0x4098('0xbf')]=function(_0x5e27ec,_0x5095c6){return db[_0x4098('0xa2')][_0x4098('0xbf')]()['then'](respondWithResult(_0x5095c6,null))[_0x4098('0x36')](handleError(_0x5095c6,null));};exports[_0x4098('0xc0')]=function(_0x3bff85,_0x37c718,_0x47b28f){return db[_0x4098('0xc1')][_0x4098('0x6b')]({'where':{'id':_0x3bff85[_0x4098('0xb8')]['id']}})['then'](handleEntityNotFound(_0x37c718,null))[_0x4098('0x2b')](function(_0xf559d5){if(_0xf559d5){return _0xf559d5[_0x4098('0xc0')](_0x3bff85[_0x4098('0xbd')][_0x4098('0xc2')],_['omit'](_0x3bff85[_0x4098('0xbd')],['ids','id'])||{});}})[_0x4098('0x2b')](respondWithResult(_0x37c718,null))[_0x4098('0x36')](handleError(_0x37c718,null));};exports[_0x4098('0xc3')]=function(_0x3670b5,_0x541bc3,_0x3afec3){var _0x180bd0={'raw':![],'where':{}};var _0x8c8781={};var _0x4b5a4e={'count':0x0,'rows':[]};return db[_0x4098('0xa2')]['findOne']({'where':{'id':_0x3670b5['params']['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0x541bc3,null))['then'](function(_0x9d89df){if(_0x9d89df){_0x8c8781[_0x4098('0x40')]=_[_0x4098('0x3c')](db[_0x4098('0xc1')]['rawAttributes']);_0x8c8781[_0x4098('0x3d')]=_[_0x4098('0x3c')](_0x3670b5[_0x4098('0x3d')]);_0x8c8781['filters']=_['intersection'](_0x8c8781['model'],_0x8c8781['query']);_0x180bd0[_0x4098('0x41')]=_['intersection'](_0x8c8781[_0x4098('0x40')],qs[_0x4098('0x42')](_0x3670b5[_0x4098('0x3d')][_0x4098('0x42')]));_0x180bd0[_0x4098('0x41')]=_0x180bd0['attributes'][_0x4098('0x61')]?_0x180bd0[_0x4098('0x41')]:_0x8c8781[_0x4098('0x40')];if(!_0x3670b5[_0x4098('0x3d')][_0x4098('0x43')]('nolimit')){_0x180bd0[_0x4098('0x25')]=qs[_0x4098('0x25')](_0x3670b5[_0x4098('0x3d')][_0x4098('0x25')]);_0x180bd0[_0x4098('0x24')]=qs['offset'](_0x3670b5[_0x4098('0x3d')][_0x4098('0x24')]);}_0x180bd0[_0x4098('0x45')]=qs['sort'](_0x3670b5['query']['sort']);_0x180bd0[_0x4098('0x47')]=qs[_0x4098('0x3e')](_[_0x4098('0xc4')](_0x3670b5[_0x4098('0x3d')],_0x8c8781[_0x4098('0x3e')]));_0x180bd0[_0x4098('0x47')][_0x4098('0xc5')]=_0x9d89df['id'];if(_0x3670b5['query'][_0x4098('0x85')]){_0x180bd0[_0x4098('0x47')]=_[_0x4098('0xa1')](_0x180bd0[_0x4098('0x47')],{'$or':_['map'](_0x180bd0[_0x4098('0x41')],function(_0x26aa05){var _0x2e88b3={};_0x2e88b3[_0x26aa05]={'$like':'%'+_0x3670b5[_0x4098('0x3d')][_0x4098('0x85')]+'%'};return _0x2e88b3;})});}if(_0x3670b5[_0x4098('0x3d')][_0x4098('0x7d')]){var _0x728b71=_0x3670b5['query'][_0x4098('0x7d')][_0x4098('0x70')](',');var _0x185097={};_0x185097[_0x728b71[0x0]]={'$gte':moment(_0x728b71[0x1])[_0x4098('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x180bd0[_0x4098('0x47')]=_[_0x4098('0xa1')](_0x180bd0[_0x4098('0x47')],_0x185097);}_0x180bd0=_[_0x4098('0xa1')]({},_0x180bd0,_0x3670b5['options']);return db[_0x4098('0xc1')][_0x4098('0xa0')]({'where':_0x180bd0['where']})[_0x4098('0x2b')](function(_0x3cde79){_0x4b5a4e[_0x4098('0xa0')]=_0x3cde79;if(_0x3670b5[_0x4098('0x3d')][_0x4098('0xb9')]){_0x180bd0['include']=[{'all':!![]}];}return db[_0x4098('0xc1')][_0x4098('0xc7')](_0x180bd0);})['then'](function(_0x3024b4){_0x4b5a4e[_0x4098('0xb7')]=_0x3024b4;return _0x4b5a4e;});}})[_0x4098('0x2b')](respondWithFilteredResult(_0x541bc3,_0x180bd0))[_0x4098('0x36')](handleError(_0x541bc3,null));};exports[_0x4098('0xc8')]=function(_0xd6d9ae,_0x29d3c1,_0xfb9787){return db[_0x4098('0xa2')]['find']({'where':{'id':_0xd6d9ae['params']['id']}})['then'](handleEntityNotFound(_0x29d3c1,null))['then'](function(_0x322f38){if(_0x322f38){return _0x322f38['setTags'](_0xd6d9ae[_0x4098('0xbd')]['ids'],_[_0x4098('0xc9')](_0xd6d9ae[_0x4098('0xbd')],[_0x4098('0xc2'),'id'])||{})[_0x4098('0xca')](function(){return db[_0x4098('0x6f')][_0x4098('0xc7')]({'attributes':['id',_0x4098('0x2f'),_0x4098('0x4a')],'where':{'id':_0xd6d9ae[_0x4098('0xbd')]['ids']}});})[_0x4098('0x2b')](function(_0x278c7e){socket[_0x4098('0xcb')](_0x4098('0xcc'),{'id':Number(_0xd6d9ae[_0x4098('0xb8')]['id']),'tags':_0x278c7e||[]});return{'id':Number(_0xd6d9ae[_0x4098('0xb8')]['id']),'tags':_0x278c7e||[]};});}})['then'](respondWithResult(_0x29d3c1,null))[_0x4098('0x36')](handleError(_0x29d3c1,null));};exports[_0x4098('0xcd')]=function(_0xfad477,_0xca7f42,_0x11fee6){return db[_0x4098('0xa2')][_0x4098('0x6b')]({'where':{'id':_0xfad477[_0x4098('0xb8')]['id']}})[_0x4098('0x2b')](handleEntityNotFound(_0xca7f42,null))[_0x4098('0x2b')](function(_0x26f238){if(_0x26f238){return _0x26f238[_0x4098('0xcd')](_0xfad477[_0x4098('0x3d')][_0x4098('0xc2')]);}})['then'](respondWithStatusCode(_0xca7f42,null))[_0x4098('0x36')](handleError(_0xca7f42,null));};exports[_0x4098('0xce')]=function(_0x470cb4,_0x1478a0){var _0x3a9cfa=moment()['unix']()[_0x4098('0xb3')]();var _0x47ba6f=path[_0x4098('0xcf')](config[_0x4098('0xd0')],_0x4098('0xd1'),_0x4098('0xd2'),_0x4098('0xd3'));var _0x429ff1=path[_0x4098('0xcf')](config[_0x4098('0xd0')],_0x4098('0xd1'),'files',_0x4098('0xd4'));var _0x261611=path['join'](_0x47ba6f,_0x3a9cfa);var _0x2e6039=util[_0x4098('0xc6')](_0x4098('0xd5'),_0x470cb4['params']['id'],_0x3a9cfa);var _0x2bc728=path[_0x4098('0xcf')](_0x47ba6f,_0x2e6039);var _0x10165c=[];_0x10165c[_0x4098('0xb5')]({'model':db[_0x4098('0x73')],'as':_0x4098('0x73'),'attributes':['id',_0x4098('0x32')],'raw':!![]});_0x10165c[_0x4098('0xb5')]({'model':db[_0x4098('0xd6')],'as':_0x4098('0x66'),'attributes':['id','firstName',_0x4098('0xd7')],'raw':!![]});if(_0x470cb4['query'][_0x4098('0xd4')]){_0x10165c[_0x4098('0xb5')]({'model':db[_0x4098('0xd8')],'as':'Attachment','raw':!![]});}var _0x809b93=[{'model':db['OpenchannelMessage'],'as':_0x4098('0xd9'),'attributes':['id',_0x4098('0xbd'),_0x4098('0x7b'),_0x4098('0xda'),_0x4098('0xdb'),_0x4098('0x82')],'include':_0x10165c}];_0x809b93[_0x4098('0xb5')]({'model':db['OpenchannelAccount'],'as':_0x4098('0xdc'),'attributes':['id',_0x4098('0x2f')]});_0x809b93[_0x4098('0xb5')]({'model':db[_0x4098('0x73')],'as':_0x4098('0xdd'),'attributes':['id','fullname']});return db[_0x4098('0xa2')]['find']({'where':{'id':_0x470cb4[_0x4098('0xb8')]['id']},'include':_0x809b93})[_0x4098('0x2b')](handleEntityNotFound(_0x1478a0,null))[_0x4098('0x2b')](function(_0x33ac36){if(_0x33ac36){var _0x59f52c=_0x33ac36['get']({'plain':!![]});fs['mkdirSync'](_0x261611);var _0x5657cf={'format':'A4','border':_0x4098('0xde'),'header':{'height':_0x4098('0xdf'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x4098('0xe0'),'contents':{'default':util[_0x4098('0xc6')](_0x4098('0xe1'),util[_0x4098('0xc6')](_0x4098('0xe2'),_0x4098('0xe3'),_0x59f52c['id']),moment()[_0x4098('0xc6')](_0x4098('0xe4'))[_0x4098('0xb3')]())}}};var _0x259ac0={'channel':'Openchannel','account':_0x59f52c[_0x4098('0xdc')][_0x4098('0x2f')],'agent':_0x59f52c[_0x4098('0xdd')]?_0x59f52c['Owner'][_0x4098('0x32')]:_0x4098('0xe5'),'createdAt':moment(_0x59f52c[_0x4098('0x7b')])['format'](_0x4098('0xe6'))[_0x4098('0xb3')](),'closedAt':_0x59f52c[_0x4098('0xe7')]?moment(_0x59f52c[_0x4098('0xe8')])[_0x4098('0xc6')](_0x4098('0xe6'))[_0x4098('0xb3')]():'','disposition':_0x59f52c[_0x4098('0xe9')],'visibility':_0x59f52c[_0x4098('0xea')]?_0x4098('0xeb'):'Private','messages':_(_0x59f52c[_0x4098('0xd9')])[_0x4098('0x85')]({'secret':![]})[_0x4098('0x31')](function(_0x1f5719){if(_0x1f5719[_0x4098('0xd8')]){var _0x50dcaa=path[_0x4098('0xcf')](_0x429ff1,_0x1f5719['Attachment']['basename']);if(fs[_0x4098('0xec')](_0x50dcaa)){fs[_0x4098('0xed')](_0x50dcaa)['pipe'](fs[_0x4098('0xee')](path[_0x4098('0xcf')](_0x261611,_0x1f5719[_0x4098('0xd8')][_0x4098('0xef')])));}}return{'date':moment(_0x1f5719[_0x4098('0x7b')])[_0x4098('0xc6')](_0x4098('0xe6'))[_0x4098('0xb3')](),'sender':_0x1f5719[_0x4098('0xda')]===_0x4098('0xf0')?_0x1f5719['User']?_0x1f5719[_0x4098('0x73')][_0x4098('0x32')]:_0x4098('0xf1'):_0x1f5719[_0x4098('0x66')][_0x4098('0xf2')]+(_0x1f5719[_0x4098('0x66')][_0x4098('0xd7')]?'\x20'+_0x1f5719['Contact'][_0x4098('0xd7')]:''),'body':_0x1f5719[_0x4098('0xd8')]?_0x1f5719[_0x4098('0xd8')][_0x4098('0xef')]:_0x1f5719['body'],'direction':_0x1f5719[_0x4098('0xda')]==='out'?'A':'C','secret':_0x1f5719[_0x4098('0xdb')],'read':_0x1f5719[_0x4098('0x82')],'attachment':_0x1f5719[_0x4098('0xd8')]};})[_0x4098('0x64')]()};return ejs[_0x4098('0xf3')](path['join'](config['root'],'server','views',_0x4098('0xf4')),{'interaction':_0x259ac0})[_0x4098('0x2b')](function(_0xefffad){return new BPromise(function(_0x31bd1a,_0x46c6f9){pdf['create'](_0xefffad,_0x5657cf)[_0x4098('0xf5')](path['join'](_0x261611,_0x4098('0xf6')+_0x59f52c['id']+'-'+_0x3a9cfa+_0x4098('0xf7')),function(_0xa244d0,_0x47237c){if(_0xa244d0)return _0x46c6f9(_0xa244d0);_0x31bd1a(_0x47237c);});});})[_0x4098('0x2b')](function(){return new BPromise(function(_0x42ee40,_0x43687d){zipdir(_0x261611,{'saveTo':_0x2bc728},function(_0x5d54be,_0x469f73){if(_0x5d54be)return _0x43687d(_0x5d54be);return _0x42ee40(_0x469f73);});})[_0x4098('0x2b')](function(){return new BPromise(function(_0x23a724,_0x1622fb){rimraf(_0x261611,function(_0x3d8373){if(_0x3d8373)_0x1622fb(_0x3d8373);return _0x23a724();});});})[_0x4098('0x2b')](function(){return _0x1478a0[_0x4098('0xce')](_0x2bc728,_0x2e6039,function(_0x386b37){if(_0x386b37){console[_0x4098('0xf8')](_0x4098('0xf9'),_0x386b37);}else{fs['unlinkSync'](_0x2bc728);}});});});}else{return _0x1478a0[_0x4098('0x20')](0xc8);}})[_0x4098('0x36')](handleError(_0x1478a0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7ab4a58..3b94196 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 _0x5546=['save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x2a7ae9,_0x317027){var _0x169dff=function(_0x525e29){while(--_0x525e29){_0x2a7ae9['push'](_0x2a7ae9['shift']());}};_0x169dff(++_0x317027);}(_0x5546,0x177));var _0x6554=function(_0x4aa0ce,_0x3e3908){_0x4aa0ce=_0x4aa0ce-0x0;var _0x34ad6d=_0x5546[_0x4aa0ce];return _0x34ad6d;};'use strict';var EventEmitter=require(_0x6554('0x0'));var OpenchannelInteraction=require(_0x6554('0x1'))['db'][_0x6554('0x2')];var OpenchannelMessage=require(_0x6554('0x1'))['db'][_0x6554('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6554('0x4')](0x0);var events={'afterCreate':_0x6554('0x5'),'afterUpdate':_0x6554('0x6'),'afterDestroy':_0x6554('0x7')};function emitEvent(_0x33c43c){return function(_0x3faca9,_0x110d98,_0x4981f7){_0x3faca9[_0x6554('0x8')]({'attributes':['id'],'raw':!![]})[_0x6554('0x9')](function(_0x53833c){_0x3faca9[_0x6554('0xa')](_0x6554('0xb'),_0x53833c[_0x6554('0xc')](function(_0x11ea37){return{'id':_0x11ea37['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3faca9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6554('0x9')](function(_0x142f11){_0x3faca9['setDataValue'](_0x6554('0xd'),_0x142f11[_0x6554('0xe')]);OpenchannelInteractionEvents[_0x6554('0xf')](_0x33c43c+':'+_0x3faca9['id'],_0x3faca9);OpenchannelInteractionEvents[_0x6554('0xf')](_0x33c43c,_0x3faca9);_0x4981f7(null);})[_0x6554('0x10')](_0x4981f7(null));};}for(var e in events){if(events[_0x6554('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x6554('0x12')](e,emitEvent(event));}}module[_0x6554('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1f2e=['then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','getUsers'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1f2e,0x109));var _0xe1f2=function(_0x2b50aa,_0x5a8fbc){_0x2b50aa=_0x2b50aa-0x0;var _0x46b453=_0x1f2e[_0x2b50aa];return _0x46b453;};'use strict';var EventEmitter=require(_0xe1f2('0x0'));var OpenchannelInteraction=require(_0xe1f2('0x1'))['db'][_0xe1f2('0x2')];var OpenchannelMessage=require(_0xe1f2('0x1'))['db'][_0xe1f2('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1f2('0x4'),'afterUpdate':_0xe1f2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a174a){return function(_0x5a23c2,_0xb603b6,_0xd36acf){_0x5a23c2[_0xe1f2('0x6')]({'attributes':['id'],'raw':!![]})[_0xe1f2('0x7')](function(_0x18b237){_0x5a23c2['setDataValue']('Users',_0x18b237[_0xe1f2('0x8')](function(_0x1b71c5){return{'id':_0x1b71c5['id']};}));return OpenchannelMessage[_0xe1f2('0x9')]({'where':{'OpenchannelInteractionId':_0x5a23c2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe1f2('0x7')](function(_0x22674d){_0x5a23c2['setDataValue'](_0xe1f2('0xa'),_0x22674d['length']);OpenchannelInteractionEvents[_0xe1f2('0xb')](_0x2a174a+':'+_0x5a23c2['id'],_0x5a23c2);OpenchannelInteractionEvents[_0xe1f2('0xb')](_0x2a174a,_0x5a23c2);_0xd36acf(null);})[_0xe1f2('0xc')](_0xd36acf(null));};}for(var e in events){if(events[_0xe1f2('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xe1f2('0xe')](e,emitEvent(event));}}module[_0xe1f2('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 79b0cbb..edd911a 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 _0xaa3f=['rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47435b,_0x2c5c6f){var _0xf181af=function(_0x3e8da0){while(--_0x3e8da0){_0x47435b['push'](_0x47435b['shift']());}};_0xf181af(++_0x2c5c6f);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5c61ab,_0x3eab07){_0x5c61ab=_0x5c61ab-0x0;var _0x5e8c86=_0xaa3f[_0x5c61ab];return _0x5e8c86;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x328d5f,_0x2e422d,_0xf420ec){if(_0x328d5f['changed'](_0xfaa3('0xd'))){_0x328d5f[_0xfaa3('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xf420ec(null,_0x328d5f);}}});}; \ No newline at end of file +var _0x4b19=['../../config/logger','api','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b19,0x195));var _0x94b1=function(_0x253305,_0x2762a5){_0x253305=_0x253305-0x0;var _0x386613=_0x4b19[_0x253305];return _0x386613;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x201a02,_0xad0a85,_0x5aee5f){if(_0x201a02[_0x94b1('0xb')]('closed')){_0x201a02['closedAt']=moment()[_0x94b1('0xc')](_0x94b1('0xd'));}_0x5aee5f(null,_0x201a02);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4bebe15..788604d 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 _0xd130=['request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','attributes','limit','AddTagsToOpenchannelInteraction','find','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','register'];(function(_0x2406dd,_0x1248a6){var _0x8cbed1=function(_0x2e71fb){while(--_0x2e71fb){_0x2406dd['push'](_0x2406dd['shift']());}};_0x8cbed1(++_0x1248a6);}(_0xd130,0xdb));var _0x0d13=function(_0xf58ab,_0x19b260){_0xf58ab=_0xf58ab-0x0;var _0x5094d6=_0xd130[_0xf58ab];return _0x5094d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d13('0x0'));var BPromise=require(_0x0d13('0x1'));var rs=require(_0x0d13('0x2'));var fs=require('fs');var Redis=require(_0x0d13('0x3'));var db=require(_0x0d13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d13('0x5'))(_0x0d13('0x6'));var config=require(_0x0d13('0x7'));var jayson=require(_0x0d13('0x8'));var client=jayson[_0x0d13('0x9')][_0x0d13('0xa')]({'port':0x232a});config[_0x0d13('0xb')]=_['defaults'](config[_0x0d13('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d13('0xc'))(new Redis(config['redis']));require(_0x0d13('0xd'))[_0x0d13('0xe')](socket);function respondWithRpcPromise(_0x56953d,_0x14d32f,_0x325b01){return new BPromise(function(_0x4efaa8,_0x19f3af){return client[_0x0d13('0xf')](_0x56953d,_0x325b01)[_0x0d13('0x10')](function(_0x2f39b8){logger[_0x0d13('0x11')](_0x0d13('0x12'),_0x14d32f,_0x0d13('0x13'));logger[_0x0d13('0x14')](_0x0d13('0x15'),_0x14d32f,_0x0d13('0x13'),JSON[_0x0d13('0x16')](_0x2f39b8));if(_0x2f39b8[_0x0d13('0x17')]){if(_0x2f39b8[_0x0d13('0x17')][_0x0d13('0x18')]===0x1f4){logger['error'](_0x0d13('0x12'),_0x14d32f,_0x2f39b8[_0x0d13('0x17')][_0x0d13('0x19')]);return _0x19f3af(_0x2f39b8[_0x0d13('0x17')]['message']);}logger[_0x0d13('0x17')](_0x0d13('0x12'),_0x14d32f,_0x2f39b8[_0x0d13('0x17')]['message']);return _0x4efaa8(_0x2f39b8['error'][_0x0d13('0x19')]);}else{logger['info'](_0x0d13('0x12'),_0x14d32f,_0x0d13('0x13'));_0x4efaa8(_0x2f39b8[_0x0d13('0x1a')][_0x0d13('0x19')]);}})[_0x0d13('0x1b')](function(_0x516a4e){logger[_0x0d13('0x17')](_0x0d13('0x12'),_0x14d32f,_0x516a4e);_0x19f3af(_0x516a4e);});});}exports[_0x0d13('0x1c')]=function(_0x321f15){var _0x1592ff=this;return new Promise(function(_0x1e8d53,_0x475a21){return db[_0x0d13('0x1d')]['update'](_0x321f15[_0x0d13('0x1e')],{'raw':_0x321f15[_0x0d13('0x1f')]?_0x321f15[_0x0d13('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x321f15[_0x0d13('0x1f')]?_0x321f15[_0x0d13('0x1f')]['where']||null:null,'attributes':_0x321f15[_0x0d13('0x1f')]?_0x321f15['options'][_0x0d13('0x20')]||null:null,'limit':_0x321f15[_0x0d13('0x1f')]?_0x321f15['options'][_0x0d13('0x21')]||null:null})['then'](function(_0x3a0756){logger[_0x0d13('0x11')](_0x0d13('0x1c'),_0x321f15);logger[_0x0d13('0x14')]('UpdateOpenchannelInteraction',_0x321f15,JSON['stringify'](_0x3a0756));_0x1e8d53(_0x3a0756);})[_0x0d13('0x1b')](function(_0x9444f5){logger['error'](_0x0d13('0x1c'),_0x9444f5[_0x0d13('0x19')],_0x321f15);_0x475a21(_0x1592ff[_0x0d13('0x17')](0x1f4,_0x9444f5['message']));});});};exports[_0x0d13('0x22')]=function(_0x1143e2){return new Promise(function(_0x39b4f6,_0x398b0b){return db[_0x0d13('0x1d')][_0x0d13('0x23')]({'where':_0x1143e2[_0x0d13('0x1f')]?_0x1143e2['options']['where']||null:null})[_0x0d13('0x10')](function(_0x24482e){if(_0x24482e){return _0x24482e['addTags'](_0x1143e2[_0x0d13('0x1e')][_0x0d13('0x24')],_['omit'](_0x1143e2[_0x0d13('0x1e')],[_0x0d13('0x24'),'id'])||{});}})[_0x0d13('0x25')](function(_0x170195){logger[_0x0d13('0x11')]('AddTags',_0x1143e2);logger[_0x0d13('0x14')](_0x0d13('0x26'),_0x1143e2,JSON['stringify'](_0x170195));_0x39b4f6(_0x170195);})[_0x0d13('0x1b')](function(_0xb9ee29){logger[_0x0d13('0x17')](_0x0d13('0x26'),_0xb9ee29['message'],_0x1143e2);_0x398b0b(_this[_0x0d13('0x17')](0x1f4,_0xb9ee29['message']));});});}; \ No newline at end of file +var _0x22fb=['client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','info','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','request\x20sent','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','then','AddTagsToOpenchannelInteraction','where','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x20e83b,_0xf15200){var _0x240f71=function(_0x102909){while(--_0x102909){_0x20e83b['push'](_0x20e83b['shift']());}};_0x240f71(++_0xf15200);}(_0x22fb,0x188));var _0xb22f=function(_0x3929dc,_0x51aa48){_0x3929dc=_0x3929dc-0x0;var _0x1eb253=_0x22fb[_0x3929dc];return _0x1eb253;};'use strict';var _=require('lodash');var util=require(_0xb22f('0x0'));var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rs=require(_0xb22f('0x3'));var fs=require('fs');var Redis=require(_0xb22f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb22f('0x5'));var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config[_0xb22f('0xa')],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xd'))[_0xb22f('0xe')](socket);function respondWithRpcPromise(_0x5ca654,_0x51caab,_0x9685b6){return new BPromise(function(_0x3bfda1,_0x249e6c){return client[_0xb22f('0xf')](_0x5ca654,_0x9685b6)['then'](function(_0x44b90a){logger[_0xb22f('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x51caab,'request\x20sent');logger[_0xb22f('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x51caab,'request\x20sent',JSON[_0xb22f('0x12')](_0x44b90a));if(_0x44b90a[_0xb22f('0x13')]){if(_0x44b90a[_0xb22f('0x13')][_0xb22f('0x14')]===0x1f4){logger[_0xb22f('0x13')](_0xb22f('0x15'),_0x51caab,_0x44b90a[_0xb22f('0x13')][_0xb22f('0x16')]);return _0x249e6c(_0x44b90a[_0xb22f('0x13')]['message']);}logger[_0xb22f('0x13')](_0xb22f('0x15'),_0x51caab,_0x44b90a[_0xb22f('0x13')]['message']);return _0x3bfda1(_0x44b90a[_0xb22f('0x13')][_0xb22f('0x16')]);}else{logger[_0xb22f('0x10')](_0xb22f('0x15'),_0x51caab,_0xb22f('0x17'));_0x3bfda1(_0x44b90a['result'][_0xb22f('0x16')]);}})[_0xb22f('0x18')](function(_0x31ec28){logger[_0xb22f('0x13')](_0xb22f('0x15'),_0x51caab,_0x31ec28);_0x249e6c(_0x31ec28);});});}exports[_0xb22f('0x19')]=function(_0x136d84){var _0x2a8c2b=this;return new Promise(function(_0x17bad8,_0x707488){return db[_0xb22f('0x1a')][_0xb22f('0x1b')](_0x136d84['body'],{'raw':_0x136d84[_0xb22f('0x1c')]?_0x136d84[_0xb22f('0x1c')][_0xb22f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x136d84[_0xb22f('0x1c')]?_0x136d84['options']['where']||null:null,'attributes':_0x136d84[_0xb22f('0x1c')]?_0x136d84[_0xb22f('0x1c')][_0xb22f('0x1e')]||null:null,'limit':_0x136d84['options']?_0x136d84[_0xb22f('0x1c')]['limit']||null:null})[_0xb22f('0x1f')](function(_0x5db217){logger[_0xb22f('0x10')](_0xb22f('0x19'),_0x136d84);logger['debug'](_0xb22f('0x19'),_0x136d84,JSON[_0xb22f('0x12')](_0x5db217));_0x17bad8(_0x5db217);})[_0xb22f('0x18')](function(_0x40c1a8){logger[_0xb22f('0x13')](_0xb22f('0x19'),_0x40c1a8[_0xb22f('0x16')],_0x136d84);_0x707488(_0x2a8c2b[_0xb22f('0x13')](0x1f4,_0x40c1a8[_0xb22f('0x16')]));});});};exports[_0xb22f('0x20')]=function(_0x157e4a){return new Promise(function(_0x1fbef9,_0x406216){return db[_0xb22f('0x1a')]['find']({'where':_0x157e4a[_0xb22f('0x1c')]?_0x157e4a['options'][_0xb22f('0x21')]||null:null})[_0xb22f('0x1f')](function(_0x627812){if(_0x627812){return _0x627812[_0xb22f('0x22')](_0x157e4a['body'][_0xb22f('0x23')],_[_0xb22f('0x24')](_0x157e4a[_0xb22f('0x25')],['ids','id'])||{});}})[_0xb22f('0x26')](function(_0x56af09){logger[_0xb22f('0x10')](_0xb22f('0x27'),_0x157e4a);logger[_0xb22f('0x11')](_0xb22f('0x27'),_0x157e4a,JSON[_0xb22f('0x12')](_0x56af09));_0x1fbef9(_0x56af09);})['catch'](function(_0x2e82cc){logger[_0xb22f('0x13')](_0xb22f('0x27'),_0x2e82cc[_0xb22f('0x16')],_0x157e4a);_0x406216(_this['error'](0x1f4,_0x2e82cc[_0xb22f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 24fc125..b8cd546 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 _0xd241=['length','openchannelInteraction:','./openchannelInteraction.events','save','emit','removeListener','register'];(function(_0x4fd392,_0x1c824c){var _0x1febf6=function(_0x141773){while(--_0x141773){_0x4fd392['push'](_0x4fd392['shift']());}};_0x1febf6(++_0x1c824c);}(_0xd241,0x17c));var _0x1d24=function(_0x4b027b,_0x1318ef){_0x4b027b=_0x4b027b-0x0;var _0x22172e=_0xd241[_0x4b027b];return _0x22172e;};'use strict';var OpenchannelInteractionEvents=require(_0x1d24('0x0'));var events=[_0x1d24('0x1'),'remove','update'];function createListener(_0x207b63,_0x4dfebb){return function(_0xc0d9d8){_0x4dfebb[_0x1d24('0x2')](_0x207b63,_0xc0d9d8);};}function removeListener(_0x183780,_0x395cfe){return function(){OpenchannelInteractionEvents[_0x1d24('0x3')](_0x183780,_0x395cfe);};}exports[_0x1d24('0x4')]=function(_0x80100a){for(var _0x3899eb=0x0,_0x541afc=events[_0x1d24('0x5')];_0x3899eb<_0x541afc;_0x3899eb++){var _0x27ce23=events[_0x3899eb];var _0x42d64a=createListener(_0x1d24('0x6')+_0x27ce23,_0x80100a);OpenchannelInteractionEvents['on'](_0x27ce23,_0x42d64a);}}; \ No newline at end of file +var _0x5007=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x5603ce,_0x414c69){var _0x256d69=function(_0x34a61d){while(--_0x34a61d){_0x5603ce['push'](_0x5603ce['shift']());}};_0x256d69(++_0x414c69);}(_0x5007,0xf3));var _0x7500=function(_0x3382bf,_0x83ad){_0x3382bf=_0x3382bf-0x0;var _0x456cca=_0x5007[_0x3382bf];return _0x456cca;};'use strict';var OpenchannelInteractionEvents=require(_0x7500('0x0'));var events=[_0x7500('0x1'),_0x7500('0x2'),_0x7500('0x3')];function createListener(_0xbad4d1,_0x31a50d){return function(_0x22073b){_0x31a50d[_0x7500('0x4')](_0xbad4d1,_0x22073b);};}function removeListener(_0x2ef94c,_0x1933e1){return function(){OpenchannelInteractionEvents[_0x7500('0x5')](_0x2ef94c,_0x1933e1);};}exports[_0x7500('0x6')]=function(_0x5d54ec){for(var _0x59626e=0x0,_0x54cf09=events[_0x7500('0x7')];_0x59626e<_0x54cf09;_0x59626e++){var _0x4d820e=events[_0x59626e];var _0x51adf6=createListener(_0x7500('0x8')+_0x4d820e,_0x5d54ec);OpenchannelInteractionEvents['on'](_0x4d820e,_0x51adf6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9948db5..5bfab58 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 _0x1b61=['/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','/describe','describe','/:id','show','post','isAuthenticated','openchannel','openchannelmessage:create','create','put','update','accept'];(function(_0x40eec9,_0x817a67){var _0xfee890=function(_0x186640){while(--_0x186640){_0x40eec9['push'](_0x40eec9['shift']());}};_0xfee890(++_0x817a67);}(_0x1b61,0x68));var _0x11b6=function(_0x530a58,_0x141d0a){_0x530a58=_0x530a58-0x0;var _0x46efd4=_0x1b61[_0x530a58];return _0x46efd4;};'use strict';var multer=require('multer');var util=require(_0x11b6('0x0'));var path=require(_0x11b6('0x1'));var timeout=require(_0x11b6('0x2'));var express=require(_0x11b6('0x3'));var router=express[_0x11b6('0x4')]();var auth=require(_0x11b6('0x5'));var interaction=require(_0x11b6('0x6'));var config=require('../../config/environment');var controller=require(_0x11b6('0x7'));router[_0x11b6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x11b6('0x8')](_0x11b6('0x9'),auth['isAuthenticated'](),controller[_0x11b6('0xa')]);router['get'](_0x11b6('0xb'),auth['isAuthenticated'](),controller[_0x11b6('0xc')]);router[_0x11b6('0xd')]('/',auth[_0x11b6('0xe')](),interaction['tracked'](_0x11b6('0xf'),_0x11b6('0x10')),controller[_0x11b6('0x11')]);router[_0x11b6('0x12')](_0x11b6('0xb'),auth['isAuthenticated'](),controller[_0x11b6('0x13')]);router[_0x11b6('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x11b6('0x14')]);router[_0x11b6('0x12')](_0x11b6('0x15'),auth[_0x11b6('0xe')](),controller[_0x11b6('0x16')]);router[_0x11b6('0x17')](_0x11b6('0xb'),auth[_0x11b6('0xe')](),controller['destroy']);module[_0x11b6('0x18')]=router; \ No newline at end of file +var _0x8f72=['put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0x8f72,0xa8));var _0x28f7=function(_0x443011,_0x421288){_0x443011=_0x443011-0x0;var _0x1585cc=_0x8f72[_0x443011];return _0x1585cc;};'use strict';var multer=require(_0x28f7('0x0'));var util=require(_0x28f7('0x1'));var path=require(_0x28f7('0x2'));var timeout=require(_0x28f7('0x3'));var express=require(_0x28f7('0x4'));var router=express['Router']();var auth=require(_0x28f7('0x5'));var interaction=require(_0x28f7('0x6'));var config=require(_0x28f7('0x7'));var controller=require('./openchannelMessage.controller');router[_0x28f7('0x8')]('/',auth['isAuthenticated'](),controller[_0x28f7('0x9')]);router[_0x28f7('0x8')](_0x28f7('0xa'),auth[_0x28f7('0xb')](),controller[_0x28f7('0xc')]);router[_0x28f7('0x8')](_0x28f7('0xd'),auth[_0x28f7('0xb')](),controller[_0x28f7('0xe')]);router[_0x28f7('0xf')]('/',auth[_0x28f7('0xb')](),interaction[_0x28f7('0x10')](_0x28f7('0x11'),_0x28f7('0x12')),controller[_0x28f7('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x28f7('0x14')]);router[_0x28f7('0x15')](_0x28f7('0x16'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x28f7('0x17'),auth[_0x28f7('0xb')](),controller[_0x28f7('0x18')]);router['delete'](_0x28f7('0xd'),auth[_0x28f7('0xb')](),controller[_0x28f7('0x19')]);module[_0x28f7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 699038f..a01b1c0 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 _0xa6b6=['ENUM','out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x53d9b1,_0x4c411f){var _0x75dfd1=function(_0x53bf2a){while(--_0x53bf2a){_0x53d9b1['push'](_0x53d9b1['shift']());}};_0x75dfd1(++_0x4c411f);}(_0xa6b6,0x167));var _0x6a6b=function(_0x27973c,_0x2d8b16){_0x27973c=_0x27973c-0x0;var _0x2ef123=_0xa6b6[_0x27973c];return _0x2ef123;};'use strict';var Sequelize=require(_0x6a6b('0x0'));module[_0x6a6b('0x1')]={'body':{'type':Sequelize[_0x6a6b('0x2')](_0x6a6b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6a6b('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a6b('0x5')]('in',_0x6a6b('0x6')),'defaultValue':_0x6a6b('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x135e=['TEXT','medium','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x12b9ee,_0x55560f){var _0x473e8c=function(_0x13f96b){while(--_0x13f96b){_0x12b9ee['push'](_0x12b9ee['shift']());}};_0x473e8c(++_0x55560f);}(_0x135e,0x91));var _0xe135=function(_0x161f29,_0x3f90c3){_0x161f29=_0x161f29-0x0;var _0x142eec=_0x135e[_0x161f29];return _0x142eec;};'use strict';var Sequelize=require(_0xe135('0x0'));module[_0xe135('0x1')]={'body':{'type':Sequelize[_0xe135('0x2')](_0xe135('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe135('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe135('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe135('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe135('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index a552c94..6141a31 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 _0x9e0d=['zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','merge','find','create','body','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf'];(function(_0x3ef8cc,_0x221408){var _0x1f5f9b=function(_0xc7be04){while(--_0xc7be04){_0x3ef8cc['push'](_0x3ef8cc['shift']());}};_0x1f5f9b(++_0x221408);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x3b9682,_0x37b95b){_0x3b9682=_0x3b9682-0x0;var _0x5c9351=_0x9e0d[_0x3b9682];return _0x5c9351;};'use strict';var pdf=require(_0xd9e0('0x0'));var emlformat=require(_0xd9e0('0x1'));var rimraf=require(_0xd9e0('0x2'));var zipdir=require(_0xd9e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9e0('0x4'));var moment=require(_0xd9e0('0x5'));var BPromise=require(_0xd9e0('0x6'));var Mustache=require(_0xd9e0('0x7'));var util=require(_0xd9e0('0x8'));var path=require(_0xd9e0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9e0('0xa'));var fs=require('fs');var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];config[_0xd9e0('0x1b')]=_[_0xd9e0('0x1c')](config[_0xd9e0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd9e0('0x1d'))(new Redis(config['redis']));require(_0xd9e0('0x1e'))['register'](socket);var jayson=require(_0xd9e0('0x1f'));var client=jayson[_0xd9e0('0x20')][_0xd9e0('0x21')]({'port':0x232c});var client9002=jayson[_0xd9e0('0x20')][_0xd9e0('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4da900,_0x58d44c,_0x5aff0b,_0x2eebec){return new BPromise(function(_0x386816,_0x71e4e1){var _0x1cdcb6=_0x2eebec||client;return _0x1cdcb6['request'](_0x4da900,_0x5aff0b)[_0xd9e0('0x22')](function(_0x56421e){logger['info'](_0xd9e0('0x23'),_0x58d44c,_0xd9e0('0x24'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x58d44c,_0xd9e0('0x24'),JSON[_0xd9e0('0x25')](_0x56421e));if(_0x56421e['error']){if(_0x56421e[_0xd9e0('0x26')][_0xd9e0('0x27')]===0x1f4){logger[_0xd9e0('0x26')](_0xd9e0('0x23'),_0x58d44c,_0x56421e[_0xd9e0('0x26')][_0xd9e0('0x28')]);return _0x71e4e1(_0x56421e[_0xd9e0('0x26')]['message']);}logger[_0xd9e0('0x26')](_0xd9e0('0x23'),_0x58d44c,_0x56421e['error'][_0xd9e0('0x28')]);return _0x386816(_0x56421e[_0xd9e0('0x26')]['message']);}else{logger[_0xd9e0('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x58d44c,_0xd9e0('0x24'));_0x386816(_0x56421e[_0xd9e0('0x2a')]['message']);}})[_0xd9e0('0x2b')](function(_0x53cf67){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x58d44c,_0x53cf67);_0x71e4e1(_0x53cf67);});});}function respondWithStatusCode(_0x4737ae,_0x21c796){_0x21c796=_0x21c796||0xcc;return function(_0x7065c6){if(_0x7065c6){return _0x4737ae[_0xd9e0('0x2c')](_0x21c796);}return _0x4737ae[_0xd9e0('0x2d')](_0x21c796)[_0xd9e0('0x2e')]();};}function respondWithResult(_0x237dfe,_0x5d56ba){_0x5d56ba=_0x5d56ba||0xc8;return function(_0x28664c){if(_0x28664c){return _0x237dfe[_0xd9e0('0x2d')](_0x5d56ba)[_0xd9e0('0x2f')](_0x28664c);}};}function respondWithFilteredResult(_0x17a899,_0x2738e9){return function(_0x4f5367){if(_0x4f5367){var _0x4b4f7d=_0x4f5367['count'],_0x4e719c=_0x2738e9[_0xd9e0('0x30')],_0x2cdbba=_0x2738e9[_0xd9e0('0x30')]+_0x2738e9[_0xd9e0('0x31')],_0x1682f9;if(_0x2cdbba>=_0x4b4f7d){_0x2cdbba=_0x4b4f7d;_0x1682f9=0xc8;}else{_0x1682f9=0xce;}_0x17a899[_0xd9e0('0x2d')](_0x1682f9);return _0x17a899[_0xd9e0('0x32')](_0xd9e0('0x33'),_0x4e719c+'-'+_0x2cdbba+'/'+_0x4b4f7d)[_0xd9e0('0x2f')](_0x4f5367);}return null;};}function patchUpdates(_0x505885){return function(_0x189c6a){try{jsonpatch[_0xd9e0('0x34')](_0x189c6a,_0x505885,!![]);}catch(_0x36a908){return BPromise[_0xd9e0('0x35')](_0x36a908);}return _0x189c6a[_0xd9e0('0x36')]();};}function saveUpdates(_0x33c205,_0x209a8f){return function(_0x264e49){if(_0x264e49){return _0x264e49[_0xd9e0('0x37')](_0x33c205)[_0xd9e0('0x22')](function(_0x27a36a){return _0x27a36a;});}return null;};}function removeEntity(_0x453509,_0x4940cc){return function(_0x8ae3ee){if(_0x8ae3ee){return _0x8ae3ee[_0xd9e0('0x38')]()[_0xd9e0('0x22')](function(){_0x453509[_0xd9e0('0x2d')](0xcc)[_0xd9e0('0x2e')]();});}};}function handleEntityNotFound(_0x514069,_0x38ad92){return function(_0x3b6e42){if(!_0x3b6e42){_0x514069[_0xd9e0('0x2c')](0x194);}return _0x3b6e42;};}function handleError(_0x23901a,_0x588f8c){_0x588f8c=_0x588f8c||0x1f4;return function(_0x372847){logger['error'](_0x372847[_0xd9e0('0x39')]);if(_0x372847[_0xd9e0('0x3a')]){delete _0x372847[_0xd9e0('0x3a')];}_0x23901a[_0xd9e0('0x2d')](_0x588f8c)[_0xd9e0('0x3b')](_0x372847);};}exports[_0xd9e0('0x3c')]=function(_0x19ff63,_0x40a542){var _0x4574fb={},_0x5065f7={},_0x318679={'count':0x0,'rows':[]};var _0x1c9d50=_[_0xd9e0('0x3d')](db[_0xd9e0('0x3e')]['rawAttributes'],function(_0x38ad8c){return{'name':_0x38ad8c[_0xd9e0('0x3f')],'type':_0x38ad8c[_0xd9e0('0x40')][_0xd9e0('0x41')]};});_0x5065f7[_0xd9e0('0x42')]=_[_0xd9e0('0x3d')](_0x1c9d50,_0xd9e0('0x3a'));_0x5065f7[_0xd9e0('0x43')]=_[_0xd9e0('0x44')](_0x19ff63[_0xd9e0('0x43')]);_0x5065f7[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x5065f7[_0xd9e0('0x42')],_0x5065f7[_0xd9e0('0x43')]);_0x4574fb[_0xd9e0('0x47')]=_[_0xd9e0('0x46')](_0x5065f7['model'],qs[_0xd9e0('0x48')](_0x19ff63[_0xd9e0('0x43')]['fields']));_0x4574fb[_0xd9e0('0x47')]=_0x4574fb['attributes'][_0xd9e0('0x49')]?_0x4574fb[_0xd9e0('0x47')]:_0x5065f7[_0xd9e0('0x42')];if(!_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x4a')](_0xd9e0('0x4b'))){_0x4574fb['limit']=qs['limit'](_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x31')]);_0x4574fb[_0xd9e0('0x30')]=qs[_0xd9e0('0x30')](_0x19ff63[_0xd9e0('0x43')]['offset']);}_0x4574fb[_0xd9e0('0x4c')]=qs[_0xd9e0('0x4d')](_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x4d')]);_0x4574fb['where']=qs[_0xd9e0('0x45')](_[_0xd9e0('0x4e')](_0x19ff63[_0xd9e0('0x43')],_0x5065f7['filters']),_0x1c9d50);if(_0x19ff63['query'][_0xd9e0('0x4f')]){_0x4574fb[_0xd9e0('0x50')]=_['merge'](_0x4574fb['where'],{'$or':_[_0xd9e0('0x3d')](_0x1c9d50,function(_0x25496d){if(_0x25496d[_0xd9e0('0x40')]!==_0xd9e0('0x51')){var _0x1ce011={};_0x1ce011[_0x25496d[_0xd9e0('0x3a')]]={'$like':'%'+_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x4f')]+'%'};return _0x1ce011;}})});}_0x4574fb=_['merge']({},_0x4574fb,_0x19ff63[_0xd9e0('0x52')]);var _0x44f7c5={'where':_0x4574fb['where']};return db[_0xd9e0('0x3e')][_0xd9e0('0x53')](_0x44f7c5)[_0xd9e0('0x22')](function(_0x1312bb){_0x318679[_0xd9e0('0x53')]=_0x1312bb;if(_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x54')]){_0x4574fb[_0xd9e0('0x55')]=[{'all':!![]}];}return db[_0xd9e0('0x3e')][_0xd9e0('0x56')](_0x4574fb);})[_0xd9e0('0x22')](function(_0x3c650f){_0x318679['rows']=_0x3c650f;return _0x318679;})[_0xd9e0('0x22')](respondWithFilteredResult(_0x40a542,_0x4574fb))[_0xd9e0('0x2b')](handleError(_0x40a542,null));};exports['show']=function(_0x252eac,_0x5ad53d){var _0x181452={'raw':!![],'where':{'id':_0x252eac[_0xd9e0('0x57')]['id']}},_0x1de37a={};_0x1de37a[_0xd9e0('0x42')]=_[_0xd9e0('0x44')](db[_0xd9e0('0x3e')][_0xd9e0('0x58')]);_0x1de37a['query']=_[_0xd9e0('0x44')](_0x252eac[_0xd9e0('0x43')]);_0x1de37a[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x1de37a[_0xd9e0('0x42')],_0x1de37a['query']);_0x181452['attributes']=_[_0xd9e0('0x46')](_0x1de37a['model'],qs[_0xd9e0('0x48')](_0x252eac[_0xd9e0('0x43')]['fields']));_0x181452['attributes']=_0x181452[_0xd9e0('0x47')][_0xd9e0('0x49')]?_0x181452[_0xd9e0('0x47')]:_0x1de37a['model'];if(_0x252eac[_0xd9e0('0x43')]['includeAll']){_0x181452[_0xd9e0('0x55')]=[{'all':!![]}];}_0x181452=_[_0xd9e0('0x59')]({},_0x181452,_0x252eac[_0xd9e0('0x52')]);return db['OpenchannelMessage'][_0xd9e0('0x5a')](_0x181452)['then'](handleEntityNotFound(_0x5ad53d,null))[_0xd9e0('0x22')](respondWithResult(_0x5ad53d,null))[_0xd9e0('0x2b')](handleError(_0x5ad53d,null));};exports['create']=function(_0x38af96,_0x1dff01){return db['OpenchannelMessage'][_0xd9e0('0x5b')](_0x38af96[_0xd9e0('0x5c')],{})['then'](respondWithResult(_0x1dff01,0xc9))[_0xd9e0('0x2b')](handleError(_0x1dff01,null));};exports[_0xd9e0('0x37')]=function(_0x5b52d9,_0x1e3fee){if(_0x5b52d9[_0xd9e0('0x5c')]['id']){delete _0x5b52d9['body']['id'];}return db[_0xd9e0('0x3e')][_0xd9e0('0x5a')]({'where':{'id':_0x5b52d9[_0xd9e0('0x57')]['id']}})[_0xd9e0('0x22')](handleEntityNotFound(_0x1e3fee,null))[_0xd9e0('0x22')](saveUpdates(_0x5b52d9[_0xd9e0('0x5c')],null))[_0xd9e0('0x22')](respondWithResult(_0x1e3fee,null))[_0xd9e0('0x2b')](handleError(_0x1e3fee,null));};exports[_0xd9e0('0x38')]=function(_0x100580,_0x4cf50d){return db['OpenchannelMessage']['find']({'where':{'id':_0x100580[_0xd9e0('0x57')]['id']}})['then'](handleEntityNotFound(_0x4cf50d,null))[_0xd9e0('0x22')](removeEntity(_0x4cf50d,null))[_0xd9e0('0x2b')](handleError(_0x4cf50d,null));};exports[_0xd9e0('0x5d')]=function(_0x34963b,_0x5376f9){return db[_0xd9e0('0x3e')][_0xd9e0('0x5d')]()[_0xd9e0('0x22')](respondWithResult(_0x5376f9,null))[_0xd9e0('0x2b')](handleError(_0x5376f9,null));};var interaction_log=require(_0xd9e0('0x5e'))('openchannel-interactions');exports[_0xd9e0('0x5f')]=function(_0x25be84,_0x580a1f,_0x404acd){var _0x93dfae={'channel':_0xd9e0('0x60')};if(_0x25be84[_0xd9e0('0x5c')]['id']){delete _0x25be84[_0xd9e0('0x5c')]['id'];}_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x61')]=!![];_0x25be84['body'][_0xd9e0('0x62')]=moment()[_0xd9e0('0x63')](_0xd9e0('0x64'));_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x65')]=_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x65')]||_0x25be84[_0xd9e0('0x66')]['id'];return db[_0xd9e0('0x3e')][_0xd9e0('0x5a')]({'where':{'id':_0x25be84['params']['id'],'UserId':null},'include':[{'model':db[_0xd9e0('0x67')],'as':'Contact'}]})[_0xd9e0('0x22')](handleEntityNotFound(_0x580a1f,null))[_0xd9e0('0x22')](saveUpdates(_0x25be84['body'],null))['then'](function(_0x1a06f6){if(_0x1a06f6){_0x93dfae[_0xd9e0('0x28')]=_0x1a06f6[_0xd9e0('0x68')]({'plain':!![]});return db[_0xd9e0('0x69')][_0xd9e0('0x5a')]({'where':{'id':_0x1a06f6['OpenchannelInteractionId']}});}return null;})[_0xd9e0('0x22')](handleEntityNotFound(_0x580a1f,null))[_0xd9e0('0x22')](function(_0x4c6279){if(_0x4c6279){return _0x4c6279[_0xd9e0('0x37')]({'UserId':_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x65')],'read1stAt':_[_0xd9e0('0x6a')](_0x4c6279['read1stAt'])?moment()[_0xd9e0('0x63')](_0xd9e0('0x64')):undefined});}return null;})[_0xd9e0('0x22')](function(_0x1e96ef){if(_0x1e96ef){_0x93dfae['interaction']=_0x1e96ef['get']({'plain':!![]});interaction_log['info'](_0xd9e0('0x6b'),_0x25be84[_0xd9e0('0x66')]['id'],_0x25be84[_0xd9e0('0x66')]['name'],_0x25be84[_0xd9e0('0x66')][_0xd9e0('0x6c')],_0x93dfae[_0xd9e0('0x6d')]['id'],_0x25be84[_0xd9e0('0x5c')]?JSON[_0xd9e0('0x25')](_0x25be84[_0xd9e0('0x5c')]):'null');return respondWithRpcPromise(_0xd9e0('0x6e'),'acceptMessage',_0x93dfae);}return null;})[_0xd9e0('0x22')](function(_0x5aa8b4){if(_0x5aa8b4){if(_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x6f')]){_0x93dfae[_0xd9e0('0x28')][_0xd9e0('0x70')]=util[_0xd9e0('0x63')](_0xd9e0('0x71'),_0x25be84[_0xd9e0('0x66')][_0xd9e0('0x3a')]);_0x93dfae[_0xd9e0('0x28')][_0xd9e0('0x72')]=_0x93dfae[_0xd9e0('0x72')];_0x93dfae['message'][_0xd9e0('0x73')]=_0xd9e0('0x5f');return respondWithRpcPromise(_0xd9e0('0x74'),_0xd9e0('0x74'),{'event':_0xd9e0('0x75'),'message':_0x93dfae[_0xd9e0('0x28')]},client9002)[_0xd9e0('0x22')](function(){return _0x93dfae;});}return _0x93dfae;}return null;})[_0xd9e0('0x22')](respondWithResult(_0x580a1f,null))['catch'](handleError(_0x580a1f,null));};var interaction_log=require(_0xd9e0('0x5e'))(_0xd9e0('0x76'));exports[_0xd9e0('0x35')]=function(_0x299998,_0x149e60,_0x202527){var _0x229f9a={'agent':{},'channel':_0xd9e0('0x60')};if(_0x299998['body']['id']){delete _0x299998[_0xd9e0('0x5c')]['id'];}_0x299998[_0xd9e0('0x5c')][_0xd9e0('0x65')]=_0x299998[_0xd9e0('0x5c')][_0xd9e0('0x65')]||_0x299998[_0xd9e0('0x66')]['id'];_0x229f9a['agent']['id']=_0x299998[_0xd9e0('0x5c')]['UserId'];return db[_0xd9e0('0x3e')][_0xd9e0('0x5a')]({'where':{'id':_0x299998['params']['id'],'UserId':null}})[_0xd9e0('0x22')](handleEntityNotFound(_0x149e60,null))[_0xd9e0('0x22')](function(_0x5846ef){if(_0x5846ef){_0x229f9a[_0xd9e0('0x28')]=_0x5846ef[_0xd9e0('0x68')]({'plain':!![]});return db[_0xd9e0('0x69')][_0xd9e0('0x5a')]({'where':{'id':_0x5846ef[_0xd9e0('0x77')]}});}return null;})[_0xd9e0('0x22')](handleEntityNotFound(_0x149e60,null))[_0xd9e0('0x22')](function(_0x2e0ab2){if(_0x2e0ab2){_0x229f9a['interaction']=_0x2e0ab2['get']({'plain':!![]});interaction_log[_0xd9e0('0x29')](_0xd9e0('0x78'),_0x299998[_0xd9e0('0x66')]['id'],_0x299998['user']['name'],_0x299998['user']['role'],_0x229f9a[_0xd9e0('0x6d')]['id'],_0x299998['body']?JSON[_0xd9e0('0x25')](_0x299998['body']):_0xd9e0('0x79'));return respondWithRpcPromise(_0xd9e0('0x7a'),_0xd9e0('0x7b'),_0x229f9a);}return null;})[_0xd9e0('0x22')](function(_0x58a4e0){if(_0x58a4e0){_0x58a4e0['message'][_0xd9e0('0x70')]=util[_0xd9e0('0x63')](_0xd9e0('0x71'),_0x299998['user']['name']);_0x58a4e0['message'][_0xd9e0('0x72')]=_0x229f9a[_0xd9e0('0x72')];_0x58a4e0[_0xd9e0('0x28')][_0xd9e0('0x73')]='reject';respondWithRpcPromise(_0xd9e0('0x74'),_0xd9e0('0x74'),{'event':_0xd9e0('0x7c'),'message':_0x58a4e0[_0xd9e0('0x28')]},client9002);return _0x229f9a;}return null;})[_0xd9e0('0x22')](respondWithResult(_0x149e60,null))[_0xd9e0('0x2b')](handleError(_0x149e60,null));}; \ No newline at end of file +var _0x6f2f=['update','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','show','includeAll','include','options','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','rejectmessage','html-pdf','eml-format','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x21d2ca,_0x5a0a5f){var _0x487407=function(_0x59817e){while(--_0x59817e){_0x21d2ca['push'](_0x21d2ca['shift']());}};_0x487407(++_0x5a0a5f);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x6f2f[_0x13e741];return _0x3f8bb3;};'use strict';var pdf=require(_0xf6f2('0x0'));var emlformat=require(_0xf6f2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6f2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf6f2('0x3'));var util=require(_0xf6f2('0x4'));var path=require(_0xf6f2('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf6f2('0x6'));var fs=require('fs');var _=require(_0xf6f2('0x7'));var squel=require(_0xf6f2('0x8'));var crypto=require(_0xf6f2('0x9'));var jsforce=require(_0xf6f2('0xa'));var deskjs=require(_0xf6f2('0xb'));var toCsv=require(_0xf6f2('0xc'));var querystring=require(_0xf6f2('0xd'));var Papa=require(_0xf6f2('0xe'));var Redis=require(_0xf6f2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf6f2('0x10'));var as=require(_0xf6f2('0x11'));var hardwareService=require(_0xf6f2('0x12'));var logger=require(_0xf6f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf6f2('0x14'));var db=require(_0xf6f2('0x15'))['db'];config[_0xf6f2('0x16')]=_[_0xf6f2('0x17')](config[_0xf6f2('0x16')],{'host':_0xf6f2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6f2('0x16')]));require(_0xf6f2('0x19'))[_0xf6f2('0x1a')](socket);var jayson=require(_0xf6f2('0x1b'));var client=jayson[_0xf6f2('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf6f2('0x1c')][_0xf6f2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x314f9a,_0x26c176,_0x2d4294,_0x200a85){return new BPromise(function(_0x17dec3,_0x4441f3){var _0x4115dd=_0x200a85||client;return _0x4115dd[_0xf6f2('0x1e')](_0x314f9a,_0x2d4294)[_0xf6f2('0x1f')](function(_0x506b3){logger[_0xf6f2('0x20')](_0xf6f2('0x21'),_0x26c176,_0xf6f2('0x22'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x26c176,_0xf6f2('0x22'),JSON['stringify'](_0x506b3));if(_0x506b3[_0xf6f2('0x23')]){if(_0x506b3[_0xf6f2('0x23')][_0xf6f2('0x24')]===0x1f4){logger[_0xf6f2('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x26c176,_0x506b3[_0xf6f2('0x23')][_0xf6f2('0x25')]);return _0x4441f3(_0x506b3[_0xf6f2('0x23')][_0xf6f2('0x25')]);}logger['error'](_0xf6f2('0x21'),_0x26c176,_0x506b3['error'][_0xf6f2('0x25')]);return _0x17dec3(_0x506b3['error'][_0xf6f2('0x25')]);}else{logger[_0xf6f2('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x26c176,_0xf6f2('0x22'));_0x17dec3(_0x506b3[_0xf6f2('0x26')][_0xf6f2('0x25')]);}})[_0xf6f2('0x27')](function(_0x219a12){logger[_0xf6f2('0x23')](_0xf6f2('0x21'),_0x26c176,_0x219a12);_0x4441f3(_0x219a12);});});}function respondWithStatusCode(_0x1f87ab,_0x5dac6a){_0x5dac6a=_0x5dac6a||0xcc;return function(_0x2b233f){if(_0x2b233f){return _0x1f87ab[_0xf6f2('0x28')](_0x5dac6a);}return _0x1f87ab[_0xf6f2('0x29')](_0x5dac6a)[_0xf6f2('0x2a')]();};}function respondWithResult(_0x2cf300,_0x341495){_0x341495=_0x341495||0xc8;return function(_0x3b0179){if(_0x3b0179){return _0x2cf300[_0xf6f2('0x29')](_0x341495)[_0xf6f2('0x2b')](_0x3b0179);}};}function respondWithFilteredResult(_0x40243e,_0x2c643d){return function(_0x4accfe){if(_0x4accfe){var _0x2aa645=_0x4accfe[_0xf6f2('0x2c')],_0x26c4dc=_0x2c643d[_0xf6f2('0x2d')],_0x17c63f=_0x2c643d[_0xf6f2('0x2d')]+_0x2c643d[_0xf6f2('0x2e')],_0x458171;if(_0x17c63f>=_0x2aa645){_0x17c63f=_0x2aa645;_0x458171=0xc8;}else{_0x458171=0xce;}_0x40243e[_0xf6f2('0x29')](_0x458171);return _0x40243e[_0xf6f2('0x2f')](_0xf6f2('0x30'),_0x26c4dc+'-'+_0x17c63f+'/'+_0x2aa645)[_0xf6f2('0x2b')](_0x4accfe);}return null;};}function patchUpdates(_0x5281cf){return function(_0x13145f){try{jsonpatch[_0xf6f2('0x31')](_0x13145f,_0x5281cf,!![]);}catch(_0x2fc531){return BPromise[_0xf6f2('0x32')](_0x2fc531);}return _0x13145f[_0xf6f2('0x33')]();};}function saveUpdates(_0x3a421f,_0x630ebf){return function(_0x18570a){if(_0x18570a){return _0x18570a[_0xf6f2('0x34')](_0x3a421f)[_0xf6f2('0x1f')](function(_0x68c829){return _0x68c829;});}return null;};}function removeEntity(_0x22e17c,_0x258cf7){return function(_0x5c23b2){if(_0x5c23b2){return _0x5c23b2['destroy']()['then'](function(){_0x22e17c[_0xf6f2('0x29')](0xcc)[_0xf6f2('0x2a')]();});}};}function handleEntityNotFound(_0x4f5763,_0x5f29ba){return function(_0x160d58){if(!_0x160d58){_0x4f5763[_0xf6f2('0x28')](0x194);}return _0x160d58;};}function handleError(_0x436d5f,_0x9bf3e0){_0x9bf3e0=_0x9bf3e0||0x1f4;return function(_0xce0c28){logger[_0xf6f2('0x23')](_0xce0c28['stack']);if(_0xce0c28[_0xf6f2('0x35')]){delete _0xce0c28['name'];}_0x436d5f[_0xf6f2('0x29')](_0x9bf3e0)[_0xf6f2('0x36')](_0xce0c28);};}exports[_0xf6f2('0x37')]=function(_0x2b13f2,_0x5d3c67){var _0x464e2c={},_0x311a37={},_0x4f4dce={'count':0x0,'rows':[]};var _0x4bf2df=_[_0xf6f2('0x38')](db[_0xf6f2('0x39')][_0xf6f2('0x3a')],function(_0x598489){return{'name':_0x598489[_0xf6f2('0x3b')],'type':_0x598489['type'][_0xf6f2('0x3c')]};});_0x311a37[_0xf6f2('0x3d')]=_[_0xf6f2('0x38')](_0x4bf2df,'name');_0x311a37[_0xf6f2('0x3e')]=_[_0xf6f2('0x3f')](_0x2b13f2[_0xf6f2('0x3e')]);_0x311a37[_0xf6f2('0x40')]=_[_0xf6f2('0x41')](_0x311a37['model'],_0x311a37[_0xf6f2('0x3e')]);_0x464e2c[_0xf6f2('0x42')]=_[_0xf6f2('0x41')](_0x311a37[_0xf6f2('0x3d')],qs[_0xf6f2('0x43')](_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x43')]));_0x464e2c['attributes']=_0x464e2c[_0xf6f2('0x42')][_0xf6f2('0x44')]?_0x464e2c[_0xf6f2('0x42')]:_0x311a37['model'];if(!_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x45')](_0xf6f2('0x46'))){_0x464e2c[_0xf6f2('0x2e')]=qs[_0xf6f2('0x2e')](_0x2b13f2['query'][_0xf6f2('0x2e')]);_0x464e2c[_0xf6f2('0x2d')]=qs[_0xf6f2('0x2d')](_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x2d')]);}_0x464e2c['order']=qs[_0xf6f2('0x47')](_0x2b13f2['query'][_0xf6f2('0x47')]);_0x464e2c[_0xf6f2('0x48')]=qs[_0xf6f2('0x40')](_[_0xf6f2('0x49')](_0x2b13f2[_0xf6f2('0x3e')],_0x311a37[_0xf6f2('0x40')]),_0x4bf2df);if(_0x2b13f2[_0xf6f2('0x3e')][_0xf6f2('0x4a')]){_0x464e2c[_0xf6f2('0x48')]=_[_0xf6f2('0x4b')](_0x464e2c[_0xf6f2('0x48')],{'$or':_['map'](_0x4bf2df,function(_0x904241){if(_0x904241[_0xf6f2('0x4c')]!==_0xf6f2('0x4d')){var _0x4c83e2={};_0x4c83e2[_0x904241['name']]={'$like':'%'+_0x2b13f2['query'][_0xf6f2('0x4a')]+'%'};return _0x4c83e2;}})});}_0x464e2c=_[_0xf6f2('0x4b')]({},_0x464e2c,_0x2b13f2['options']);var _0x5c1b80={'where':_0x464e2c[_0xf6f2('0x48')]};return db[_0xf6f2('0x39')][_0xf6f2('0x2c')](_0x5c1b80)[_0xf6f2('0x1f')](function(_0x11dd69){_0x4f4dce[_0xf6f2('0x2c')]=_0x11dd69;if(_0x2b13f2['query']['includeAll']){_0x464e2c['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xf6f2('0x4e')](_0x464e2c);})['then'](function(_0x37927d){_0x4f4dce[_0xf6f2('0x4f')]=_0x37927d;return _0x4f4dce;})[_0xf6f2('0x1f')](respondWithFilteredResult(_0x5d3c67,_0x464e2c))[_0xf6f2('0x27')](handleError(_0x5d3c67,null));};exports[_0xf6f2('0x50')]=function(_0x52939f,_0x5a7b28){var _0x198b62={'raw':!![],'where':{'id':_0x52939f['params']['id']}},_0x5f3863={};_0x5f3863[_0xf6f2('0x3d')]=_[_0xf6f2('0x3f')](db[_0xf6f2('0x39')][_0xf6f2('0x3a')]);_0x5f3863[_0xf6f2('0x3e')]=_[_0xf6f2('0x3f')](_0x52939f['query']);_0x5f3863[_0xf6f2('0x40')]=_[_0xf6f2('0x41')](_0x5f3863['model'],_0x5f3863[_0xf6f2('0x3e')]);_0x198b62[_0xf6f2('0x42')]=_[_0xf6f2('0x41')](_0x5f3863['model'],qs[_0xf6f2('0x43')](_0x52939f[_0xf6f2('0x3e')][_0xf6f2('0x43')]));_0x198b62[_0xf6f2('0x42')]=_0x198b62[_0xf6f2('0x42')][_0xf6f2('0x44')]?_0x198b62[_0xf6f2('0x42')]:_0x5f3863[_0xf6f2('0x3d')];if(_0x52939f[_0xf6f2('0x3e')][_0xf6f2('0x51')]){_0x198b62[_0xf6f2('0x52')]=[{'all':!![]}];}_0x198b62=_['merge']({},_0x198b62,_0x52939f[_0xf6f2('0x53')]);return db[_0xf6f2('0x39')][_0xf6f2('0x54')](_0x198b62)[_0xf6f2('0x1f')](handleEntityNotFound(_0x5a7b28,null))[_0xf6f2('0x1f')](respondWithResult(_0x5a7b28,null))[_0xf6f2('0x27')](handleError(_0x5a7b28,null));};exports[_0xf6f2('0x55')]=function(_0x22e7d1,_0x328cb0){return db[_0xf6f2('0x39')]['create'](_0x22e7d1[_0xf6f2('0x56')],{})[_0xf6f2('0x1f')](respondWithResult(_0x328cb0,0xc9))['catch'](handleError(_0x328cb0,null));};exports[_0xf6f2('0x34')]=function(_0x59dbfc,_0x5e4d86){if(_0x59dbfc[_0xf6f2('0x56')]['id']){delete _0x59dbfc[_0xf6f2('0x56')]['id'];}return db[_0xf6f2('0x39')][_0xf6f2('0x54')]({'where':{'id':_0x59dbfc[_0xf6f2('0x57')]['id']}})[_0xf6f2('0x1f')](handleEntityNotFound(_0x5e4d86,null))[_0xf6f2('0x1f')](saveUpdates(_0x59dbfc[_0xf6f2('0x56')],null))['then'](respondWithResult(_0x5e4d86,null))[_0xf6f2('0x27')](handleError(_0x5e4d86,null));};exports['destroy']=function(_0x2efa18,_0x4bceba){return db[_0xf6f2('0x39')][_0xf6f2('0x54')]({'where':{'id':_0x2efa18[_0xf6f2('0x57')]['id']}})[_0xf6f2('0x1f')](handleEntityNotFound(_0x4bceba,null))['then'](removeEntity(_0x4bceba,null))[_0xf6f2('0x27')](handleError(_0x4bceba,null));};exports[_0xf6f2('0x58')]=function(_0x52d278,_0x2c67cc){return db[_0xf6f2('0x39')]['describe']()[_0xf6f2('0x1f')](respondWithResult(_0x2c67cc,null))[_0xf6f2('0x27')](handleError(_0x2c67cc,null));};var interaction_log=require(_0xf6f2('0x13'))(_0xf6f2('0x59'));exports[_0xf6f2('0x5a')]=function(_0x176d0f,_0x178d55,_0x27de66){var _0x51dd58={'channel':_0xf6f2('0x5b')};if(_0x176d0f[_0xf6f2('0x56')]['id']){delete _0x176d0f['body']['id'];}_0x176d0f[_0xf6f2('0x56')]['read']=!![];_0x176d0f['body'][_0xf6f2('0x5c')]=moment()[_0xf6f2('0x5d')](_0xf6f2('0x5e'));_0x176d0f['body'][_0xf6f2('0x5f')]=_0x176d0f[_0xf6f2('0x56')][_0xf6f2('0x5f')]||_0x176d0f[_0xf6f2('0x60')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x176d0f[_0xf6f2('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xf6f2('0x61')],'as':_0xf6f2('0x62')}]})[_0xf6f2('0x1f')](handleEntityNotFound(_0x178d55,null))[_0xf6f2('0x1f')](saveUpdates(_0x176d0f[_0xf6f2('0x56')],null))[_0xf6f2('0x1f')](function(_0x2ec204){if(_0x2ec204){_0x51dd58['message']=_0x2ec204[_0xf6f2('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf6f2('0x54')]({'where':{'id':_0x2ec204[_0xf6f2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x178d55,null))[_0xf6f2('0x1f')](function(_0x4fe17b){if(_0x4fe17b){return _0x4fe17b[_0xf6f2('0x34')]({'UserId':_0x176d0f[_0xf6f2('0x56')]['UserId'],'read1stAt':_[_0xf6f2('0x65')](_0x4fe17b[_0xf6f2('0x66')])?moment()[_0xf6f2('0x5d')](_0xf6f2('0x5e')):undefined});}return null;})[_0xf6f2('0x1f')](function(_0x4c1695){if(_0x4c1695){_0x51dd58[_0xf6f2('0x67')]=_0x4c1695[_0xf6f2('0x63')]({'plain':!![]});interaction_log[_0xf6f2('0x20')](_0xf6f2('0x68'),_0x176d0f['user']['id'],_0x176d0f[_0xf6f2('0x60')][_0xf6f2('0x35')],_0x176d0f[_0xf6f2('0x60')]['role'],_0x51dd58['interaction']['id'],_0x176d0f[_0xf6f2('0x56')]?JSON[_0xf6f2('0x69')](_0x176d0f[_0xf6f2('0x56')]):'null');return respondWithRpcPromise(_0xf6f2('0x6a'),_0xf6f2('0x6b'),_0x51dd58);}return null;})[_0xf6f2('0x1f')](function(_0x5a2ad6){if(_0x5a2ad6){if(_0x176d0f[_0xf6f2('0x56')][_0xf6f2('0x6c')]){_0x51dd58[_0xf6f2('0x25')][_0xf6f2('0x6d')]=util['format'](_0xf6f2('0x6e'),_0x176d0f[_0xf6f2('0x60')]['name']);_0x51dd58[_0xf6f2('0x25')][_0xf6f2('0x6f')]=_0x51dd58[_0xf6f2('0x6f')];_0x51dd58['message'][_0xf6f2('0x70')]=_0xf6f2('0x5a');return respondWithRpcPromise(_0xf6f2('0x71'),_0xf6f2('0x71'),{'event':_0xf6f2('0x72'),'message':_0x51dd58[_0xf6f2('0x25')]},client9002)[_0xf6f2('0x1f')](function(){return _0x51dd58;});}return _0x51dd58;}return null;})[_0xf6f2('0x1f')](respondWithResult(_0x178d55,null))[_0xf6f2('0x27')](handleError(_0x178d55,null));};var interaction_log=require(_0xf6f2('0x13'))(_0xf6f2('0x59'));exports[_0xf6f2('0x32')]=function(_0xfe7e86,_0x2a9756,_0x233d59){var _0x1243cd={'agent':{},'channel':_0xf6f2('0x5b')};if(_0xfe7e86[_0xf6f2('0x56')]['id']){delete _0xfe7e86[_0xf6f2('0x56')]['id'];}_0xfe7e86[_0xf6f2('0x56')][_0xf6f2('0x5f')]=_0xfe7e86[_0xf6f2('0x56')]['UserId']||_0xfe7e86[_0xf6f2('0x60')]['id'];_0x1243cd[_0xf6f2('0x73')]['id']=_0xfe7e86[_0xf6f2('0x56')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0xfe7e86[_0xf6f2('0x57')]['id'],'UserId':null}})[_0xf6f2('0x1f')](handleEntityNotFound(_0x2a9756,null))[_0xf6f2('0x1f')](function(_0xfabb12){if(_0xfabb12){_0x1243cd[_0xf6f2('0x25')]=_0xfabb12[_0xf6f2('0x63')]({'plain':!![]});return db[_0xf6f2('0x74')][_0xf6f2('0x54')]({'where':{'id':_0xfabb12[_0xf6f2('0x64')]}});}return null;})[_0xf6f2('0x1f')](handleEntityNotFound(_0x2a9756,null))[_0xf6f2('0x1f')](function(_0x50a8a3){if(_0x50a8a3){_0x1243cd[_0xf6f2('0x67')]=_0x50a8a3[_0xf6f2('0x63')]({'plain':!![]});interaction_log[_0xf6f2('0x20')](_0xf6f2('0x75'),_0xfe7e86[_0xf6f2('0x60')]['id'],_0xfe7e86['user']['name'],_0xfe7e86[_0xf6f2('0x60')][_0xf6f2('0x76')],_0x1243cd['interaction']['id'],_0xfe7e86[_0xf6f2('0x56')]?JSON[_0xf6f2('0x69')](_0xfe7e86[_0xf6f2('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0xf6f2('0x77'),_0x1243cd);}return null;})[_0xf6f2('0x1f')](function(_0x1fd79c){if(_0x1fd79c){_0x1fd79c['message'][_0xf6f2('0x6d')]=util[_0xf6f2('0x5d')](_0xf6f2('0x6e'),_0xfe7e86[_0xf6f2('0x60')]['name']);_0x1fd79c[_0xf6f2('0x25')][_0xf6f2('0x6f')]=_0x1243cd['channel'];_0x1fd79c[_0xf6f2('0x25')][_0xf6f2('0x70')]=_0xf6f2('0x32');respondWithRpcPromise(_0xf6f2('0x71'),_0xf6f2('0x71'),{'event':_0xf6f2('0x78'),'message':_0x1fd79c['message']},client9002);return _0x1243cd;}return null;})[_0xf6f2('0x1f')](respondWithResult(_0x2a9756,null))[_0xf6f2('0x27')](handleError(_0x2a9756,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1a6461f..2f3a8b4 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 _0x57a6=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage'];(function(_0x26bbfd,_0x4dde15){var _0x3044da=function(_0x16e5e7){while(--_0x16e5e7){_0x26bbfd['push'](_0x26bbfd['shift']());}};_0x3044da(++_0x4dde15);}(_0x57a6,0x10e));var _0x657a=function(_0x2194b4,_0x19b8bf){_0x2194b4=_0x2194b4-0x0;var _0x1d88c9=_0x57a6[_0x2194b4];return _0x1d88c9;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x657a('0x0'))['db'][_0x657a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x657a('0x2')](0x0);var events={'afterCreate':_0x657a('0x3'),'afterUpdate':_0x657a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x256f93){return function(_0x1e1ec2,_0x29d113,_0x4d552e){OpenchannelMessageEvents[_0x657a('0x5')](_0x256f93+':'+_0x1e1ec2['id'],_0x1e1ec2);OpenchannelMessageEvents[_0x657a('0x5')](_0x256f93,_0x1e1ec2);_0x4d552e(null);};}for(var e in events){if(events[_0x657a('0x6')](e)){var event=events[e];OpenchannelMessage[_0x657a('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x267a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2c22d4,_0xe73c28){var _0x36a1f7=function(_0x243215){while(--_0x243215){_0x2c22d4['push'](_0x2c22d4['shift']());}};_0x36a1f7(++_0xe73c28);}(_0x267a,0xaf));var _0xa267=function(_0x163f58,_0x1c8ae4){_0x163f58=_0x163f58-0x0;var _0x472ed9=_0x267a[_0x163f58];return _0x472ed9;};'use strict';var EventEmitter=require(_0xa267('0x0'));var OpenchannelMessage=require(_0xa267('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa267('0x2')](0x0);var events={'afterCreate':_0xa267('0x3'),'afterUpdate':_0xa267('0x4'),'afterDestroy':_0xa267('0x5')};function emitEvent(_0x2ff6b7){return function(_0x25e038,_0x25f2bf,_0x14ecd7){OpenchannelMessageEvents[_0xa267('0x6')](_0x2ff6b7+':'+_0x25e038['id'],_0x25e038);OpenchannelMessageEvents[_0xa267('0x6')](_0x2ff6b7,_0x25e038);_0x14ecd7(null);};}for(var e in events){if(events[_0xa267('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xa267('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f2ee365..ddae691 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 _0xbab2=['createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbab2,0x1ef));var _0x2bab=function(_0x58815d,_0x574dea){_0x58815d=_0x58815d-0x0;var _0x37584e=_0xbab2[_0x58815d];return _0x37584e;};'use strict';var _=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var logger=require('../../config/logger')(_0x2bab('0x2'));var moment=require(_0x2bab('0x3'));var BPromise=require(_0x2bab('0x4'));var rp=require(_0x2bab('0x5'));var fs=require('fs');var path=require(_0x2bab('0x6'));var rimraf=require(_0x2bab('0x7'));var config=require(_0x2bab('0x8'));var attributes=require(_0x2bab('0x9'));module[_0x2bab('0xa')]=function(_0x207677,_0x1ddc15){return _0x207677[_0x2bab('0xb')](_0x2bab('0xc'),attributes,{'tableName':_0x2bab('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x2bab('0xe')],'type':_0x2bab('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f27a4,_0xfccb44,_0x2a3deb){var _0xd75aef=_0x207677[_0x2bab('0x10')];var _0x43a0f6=_0x1f27a4['get']({'plain':!![]});if(_0x43a0f6[_0x2bab('0x11')]['toLowerCase']()==='in'||_0x43a0f6[_0x2bab('0x11')][_0x2bab('0x12')]()===_0x2bab('0x13')&&!_0x43a0f6[_0x2bab('0x14')]&&!_[_0x2bab('0x15')](_0x43a0f6[_0x2bab('0x16')])){_0xd75aef[_0x2bab('0x17')]['findOne']({'where':{'id':_0x43a0f6['OpenchannelInteractionId']}})['then'](function(_0x455e03){if(_0x455e03){_0x455e03[_0x2bab('0x18')]({'lastMsgAt':_0x43a0f6[_0x2bab('0x19')],'lastMsgDirection':_0x43a0f6[_0x2bab('0x11')]['toLowerCase']()});}})[_0x2bab('0x1a')](function(_0x20ddcd){console[_0x2bab('0x1b')](_0x20ddcd);});}if(_0x43a0f6[_0x2bab('0x11')]===_0x2bab('0x13')&&!_0x43a0f6[_0x2bab('0x14')]){var _0x38f4af;_0xd75aef[_0x2bab('0x1c')][_0x2bab('0x1d')]()[_0x2bab('0x1e')](function(_0x3bda4e){return _0xd75aef[_0x2bab('0x1f')][_0x2bab('0x20')]({'where':{'id':_0x43a0f6[_0x2bab('0x21')]},'include':[{'model':_0xd75aef[_0x2bab('0x17')],'as':_0x2bab('0x22'),'where':{'id':_0x43a0f6[_0x2bab('0x23')]},'limit':0x1,'include':[{'model':_0xd75aef[_0x2bab('0x1c')],'as':_0x2bab('0x24'),'attributes':_[_0x2bab('0x25')](_0x3bda4e)}]}]});})[_0x2bab('0x1e')](function(_0x29fcd3){_0x38f4af=_0x29fcd3['get']({'plain':!![]});if(_0x38f4af&&_0x38f4af[_0x2bab('0x26')]){logger['info'](_0x2bab('0x27'),_0x2bab('0x28'),util[_0x2bab('0x29')](_0x2bab('0x2a'),_0x43a0f6['id'],_0x38f4af['replyUri']));if(_0x38f4af[_0x2bab('0x22')]&&_0x38f4af[_0x2bab('0x22')][_0x2bab('0x2b')]){_0x43a0f6[_0x2bab('0x2c')]=_[_0x2bab('0x2d')](_0x38f4af[_0x2bab('0x22')][0x0],_0x2bab('0x24'));_0x43a0f6['Contact']=_0x38f4af['Interactions'][0x0][_0x2bab('0x24')];}var _0xfccb44={'method':_0x2bab('0x2e'),'uri':encodeURI(_0x38f4af['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xfccb44['method']){case'GET':_0xfccb44['qs']=_0x43a0f6;break;case _0x2bab('0x2e'):_0xfccb44[_0x2bab('0xe')]=_0x43a0f6;break;}return rp(_0xfccb44)[_0x2bab('0x1e')](function(_0x11e52f){logger[_0x2bab('0x2f')](_0x2bab('0x27'),_0x2bab('0x28'),util[_0x2bab('0x29')](_0x2bab('0x30'),_0x43a0f6['id'],_0x38f4af[_0x2bab('0x26')]));if(_0x11e52f[_0x2bab('0xe')][_0x2bab('0x31')]&&_0x11e52f[_0x2bab('0xe')][_0x2bab('0x31')]!=_0x43a0f6[_0x2bab('0x2c')]['threadId']){return _0xd75aef['OpenchannelInteraction'][_0x2bab('0x18')]({'threadId':_0x11e52f['body']['threadId']},{'logging':!![],'where':{'id':_0x43a0f6[_0x2bab('0x2c')]['id']}});}else{return;}})[_0x2bab('0x1e')](function(){return _0x1f27a4[_0x2bab('0x18')]({'read':!![]});})[_0x2bab('0x1a')](function(_0x1d1455){logger[_0x2bab('0x1b')](_0x2bab('0x27'),_0x2bab('0x28'),util[_0x2bab('0x32')](_0x1d1455,{'showHidden':![],'depth':null}));_0x2a3deb();});}else{_0x2a3deb();}})['finally'](function(){_0x2a3deb();});}else{_0x2a3deb();}}},'charset':_0x2bab('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1fa4=['UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','CmContact','describe','then','find','OpenchannelAccountId','Interactions','Contact','keys','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','method','GET','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','replyUri','threadId','Interaction','update','error','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','secret'];(function(_0x3b0c7d,_0x15adcc){var _0x438b84=function(_0x1d42f4){while(--_0x1d42f4){_0x3b0c7d['push'](_0x3b0c7d['shift']());}};_0x438b84(++_0x15adcc);}(_0x1fa4,0x186));var _0x41fa=function(_0x5e651e,_0x3a63b9){_0x5e651e=_0x5e651e-0x0;var _0x49db9e=_0x1fa4[_0x5e651e];return _0x49db9e;};'use strict';var _=require(_0x41fa('0x0'));var util=require('util');var logger=require(_0x41fa('0x1'))(_0x41fa('0x2'));var moment=require(_0x41fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x41fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41fa('0x5'));var config=require('../../config/environment');var attributes=require(_0x41fa('0x6'));module[_0x41fa('0x7')]=function(_0x262fcb,_0x458835){return _0x262fcb[_0x41fa('0x8')](_0x41fa('0x9'),attributes,{'tableName':_0x41fa('0xa'),'paranoid':![],'indexes':[{'name':_0x41fa('0xb'),'fields':[_0x41fa('0xc')],'type':_0x41fa('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46e134,_0x2528a1,_0x246de1){var _0x3550ab=_0x262fcb['models'];var _0x3c763b=_0x46e134[_0x41fa('0xe')]({'plain':!![]});if(_0x3c763b[_0x41fa('0xf')][_0x41fa('0x10')]()==='in'||_0x3c763b['direction'][_0x41fa('0x10')]()==='out'&&!_0x3c763b[_0x41fa('0x11')]&&!_['isNil'](_0x3c763b[_0x41fa('0x12')])){_0x3550ab[_0x41fa('0x13')][_0x41fa('0x14')]({'where':{'id':_0x3c763b[_0x41fa('0x15')]}})['then'](function(_0x5a24ba){if(_0x5a24ba){_0x5a24ba['update']({'lastMsgAt':_0x3c763b[_0x41fa('0x16')],'lastMsgDirection':_0x3c763b[_0x41fa('0xf')][_0x41fa('0x10')]()});}})[_0x41fa('0x17')](function(_0x9bfffd){console['error'](_0x9bfffd);});}if(_0x3c763b[_0x41fa('0xf')]==='out'&&!_0x3c763b[_0x41fa('0x11')]){var _0x1a639b;_0x3550ab[_0x41fa('0x18')][_0x41fa('0x19')]()[_0x41fa('0x1a')](function(_0x3e8c34){return _0x3550ab['OpenchannelAccount'][_0x41fa('0x1b')]({'where':{'id':_0x3c763b[_0x41fa('0x1c')]},'include':[{'model':_0x3550ab[_0x41fa('0x13')],'as':_0x41fa('0x1d'),'where':{'id':_0x3c763b[_0x41fa('0x15')]},'limit':0x1,'include':[{'model':_0x3550ab[_0x41fa('0x18')],'as':_0x41fa('0x1e'),'attributes':_[_0x41fa('0x1f')](_0x3e8c34)}]}]});})[_0x41fa('0x1a')](function(_0x2b20eb){_0x1a639b=_0x2b20eb[_0x41fa('0xe')]({'plain':!![]});if(_0x1a639b&&_0x1a639b['replyUri']){logger[_0x41fa('0x20')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x41fa('0x21')](_0x41fa('0x22'),_0x3c763b['id'],_0x1a639b['replyUri']));if(_0x1a639b[_0x41fa('0x1d')]&&_0x1a639b['Interactions'][_0x41fa('0x23')]){_0x3c763b['Interaction']=_['omit'](_0x1a639b['Interactions'][0x0],'Contact');_0x3c763b[_0x41fa('0x1e')]=_0x1a639b[_0x41fa('0x1d')][0x0][_0x41fa('0x1e')];}var _0x2528a1={'method':'POST','uri':encodeURI(_0x1a639b['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2528a1[_0x41fa('0x24')]){case _0x41fa('0x25'):_0x2528a1['qs']=_0x3c763b;break;case _0x41fa('0x26'):_0x2528a1[_0x41fa('0xc')]=_0x3c763b;break;}return rp(_0x2528a1)[_0x41fa('0x1a')](function(_0x2f1eff){logger[_0x41fa('0x20')](_0x41fa('0x27'),'afterCreate',util[_0x41fa('0x21')](_0x41fa('0x28'),_0x3c763b['id'],_0x1a639b[_0x41fa('0x29')]));if(_0x2f1eff[_0x41fa('0xc')][_0x41fa('0x2a')]&&_0x2f1eff[_0x41fa('0xc')][_0x41fa('0x2a')]!=_0x3c763b[_0x41fa('0x2b')][_0x41fa('0x2a')]){return _0x3550ab[_0x41fa('0x13')][_0x41fa('0x2c')]({'threadId':_0x2f1eff[_0x41fa('0xc')][_0x41fa('0x2a')]},{'logging':!![],'where':{'id':_0x3c763b[_0x41fa('0x2b')]['id']}});}else{return;}})[_0x41fa('0x1a')](function(){return _0x46e134[_0x41fa('0x2c')]({'read':!![]});})[_0x41fa('0x17')](function(_0x2df9e9){logger[_0x41fa('0x2d')](_0x41fa('0x27'),_0x41fa('0x2e'),util[_0x41fa('0x2f')](_0x2df9e9,{'showHidden':![],'depth':null}));_0x246de1();});}else{_0x246de1();}})[_0x41fa('0x30')](function(){_0x246de1();});}else{_0x246de1();}}},'charset':_0x41fa('0x31'),'collate':_0x41fa('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 722cfed..34c70c4 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28d650,_0x578ba3){var _0x83038f=function(_0x4a7621){while(--_0x4a7621){_0x28d650['push'](_0x28d650['shift']());}};_0x83038f(++_0x578ba3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x170016,_0xc2693c){_0x170016=_0x170016-0x0;var _0x406a91=_0x5f2f[_0x170016];return _0x406a91;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x2a8255,_0x2ab6cb){var _0x20d7a5=function(_0x19f120){while(--_0x19f120){_0x2a8255['push'](_0x2a8255['shift']());}};_0x20d7a5(++_0x2ab6cb);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0xb10b[_0x2d460c];return _0xf6fc4c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 301e506..d124a05 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 _0xda3f=['openchannelMessage:','save','remove','register','length'];(function(_0x5aa69d,_0x523ebe){var _0x5021eb=function(_0xd98988){while(--_0xd98988){_0x5aa69d['push'](_0x5aa69d['shift']());}};_0x5021eb(++_0x523ebe);}(_0xda3f,0xec));var _0xfda3=function(_0x4c182f,_0x156c10){_0x4c182f=_0x4c182f-0x0;var _0x15483d=_0xda3f[_0x4c182f];return _0x15483d;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xfda3('0x0'),_0xfda3('0x1'),'update'];function createListener(_0x5299b0,_0x5d7071){return function(_0x3859fe){_0x5d7071['emit'](_0x5299b0,_0x3859fe);};}function removeListener(_0x36dc71,_0x22187d){return function(){OpenchannelMessageEvents['removeListener'](_0x36dc71,_0x22187d);};}exports[_0xfda3('0x2')]=function(_0x43a010){for(var _0x47e7e2=0x0,_0x4e72d1=events[_0xfda3('0x3')];_0x47e7e2<_0x4e72d1;_0x47e7e2++){var _0x42476a=events[_0x47e7e2];var _0x125e2a=createListener(_0xfda3('0x4')+_0x42476a,_0x43a010);OpenchannelMessageEvents['on'](_0x42476a,_0x125e2a);}}; \ No newline at end of file +var _0xedd9=['removeListener','register','length','openchannelMessage:','save','remove','update','emit'];(function(_0x56cfa7,_0x36f8cc){var _0xd0941e=function(_0x2f1f63){while(--_0x2f1f63){_0x56cfa7['push'](_0x56cfa7['shift']());}};_0xd0941e(++_0x36f8cc);}(_0xedd9,0xfc));var _0x9edd=function(_0x338c0e,_0x5a11ef){_0x338c0e=_0x338c0e-0x0;var _0x5b737a=_0xedd9[_0x338c0e];return _0x5b737a;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){OpenchannelMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);OpenchannelMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 747db3a..2b06ac9 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 _0xfa45=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x262f44,_0x3847ba){var _0x33b27c=function(_0x5db154){while(--_0x5db154){_0x262f44['push'](_0x262f44['shift']());}};_0x33b27c(++_0x3847ba);}(_0xfa45,0x11b));var _0x5fa4=function(_0x1f5ca2,_0x227396){_0x1f5ca2=_0x1f5ca2-0x0;var _0x50f60c=_0xfa45[_0x1f5ca2];return _0x50f60c;};'use strict';var multer=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var path=require(_0x5fa4('0x2'));var timeout=require(_0x5fa4('0x3'));var express=require(_0x5fa4('0x4'));var router=express[_0x5fa4('0x5')]();var auth=require(_0x5fa4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5fa4('0x7'));var controller=require('./openchannelQueue.controller');router[_0x5fa4('0x8')]('/',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xa')]);router[_0x5fa4('0x8')](_0x5fa4('0xb'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xc')]);router[_0x5fa4('0x8')](_0x5fa4('0xd'),auth[_0x5fa4('0x9')](),controller['show']);router[_0x5fa4('0x8')]('/:id/members',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xe')]);router[_0x5fa4('0x8')](_0x5fa4('0xf'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x10')]);router[_0x5fa4('0x8')](_0x5fa4('0x11'),auth['isAuthenticated'](),controller[_0x5fa4('0x12')]);router['post']('/',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x13')]);router[_0x5fa4('0x14')](_0x5fa4('0xf'),auth[_0x5fa4('0x9')](),controller['addTeams']);router[_0x5fa4('0x14')](_0x5fa4('0x11'),auth['isAuthenticated'](),controller[_0x5fa4('0x15')]);router[_0x5fa4('0x16')]('/:id',auth[_0x5fa4('0x9')](),controller['update']);router['delete'](_0x5fa4('0xd'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x17')]);router[_0x5fa4('0x18')](_0x5fa4('0xf'),auth[_0x5fa4('0x9')](),controller['removeTeams']);router[_0x5fa4('0x18')](_0x5fa4('0x11'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x19')]);module[_0x5fa4('0x1a')]=router; \ No newline at end of file +var _0x282a=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x282a,0xa2));var _0xa282=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x282a[_0x42bdad];return _0x122626;};'use strict';var multer=require('multer');var util=require(_0xa282('0x0'));var path=require(_0xa282('0x1'));var timeout=require(_0xa282('0x2'));var express=require(_0xa282('0x3'));var router=express[_0xa282('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa282('0x5'));var config=require(_0xa282('0x6'));var controller=require('./openchannelQueue.controller');router[_0xa282('0x7')]('/',auth['isAuthenticated'](),controller[_0xa282('0x8')]);router['get'](_0xa282('0x9'),auth[_0xa282('0xa')](),controller[_0xa282('0xb')]);router['get'](_0xa282('0xc'),auth['isAuthenticated'](),controller[_0xa282('0xd')]);router[_0xa282('0x7')](_0xa282('0xe'),auth[_0xa282('0xa')](),controller[_0xa282('0xf')]);router[_0xa282('0x7')](_0xa282('0x10'),auth[_0xa282('0xa')](),controller[_0xa282('0x11')]);router[_0xa282('0x7')](_0xa282('0x12'),auth[_0xa282('0xa')](),controller[_0xa282('0x13')]);router[_0xa282('0x14')]('/',auth[_0xa282('0xa')](),controller[_0xa282('0x15')]);router[_0xa282('0x14')](_0xa282('0x10'),auth['isAuthenticated'](),controller[_0xa282('0x16')]);router[_0xa282('0x14')](_0xa282('0x12'),auth[_0xa282('0xa')](),controller[_0xa282('0x17')]);router['put']('/:id',auth[_0xa282('0xa')](),controller[_0xa282('0x18')]);router[_0xa282('0x19')](_0xa282('0xc'),auth[_0xa282('0xa')](),controller['destroy']);router['delete'](_0xa282('0x10'),auth[_0xa282('0xa')](),controller[_0xa282('0x1a')]);router[_0xa282('0x19')](_0xa282('0x12'),auth[_0xa282('0xa')](),controller[_0xa282('0x1b')]);module[_0xa282('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ad8c4a0..9b185aa 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 _0xd029=['roundrobin','sequelize','exports','STRING','ENUM','beepall'];(function(_0x5d22d0,_0x33ca97){var _0x4daca4=function(_0x21151d){while(--_0x21151d){_0x5d22d0['push'](_0x5d22d0['shift']());}};_0x4daca4(++_0x33ca97);}(_0xd029,0x85));var _0x9d02=function(_0x5d5e0c,_0x543810){_0x5d5e0c=_0x5d5e0c-0x0;var _0x231f7f=_0xd029[_0x5d5e0c];return _0x231f7f;};'use strict';var Sequelize=require(_0x9d02('0x0'));module[_0x9d02('0x1')]={'name':{'type':Sequelize[_0x9d02('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9d02('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9d02('0x3')]('rrmemory',_0x9d02('0x4'),_0x9d02('0x5'))}}; \ No newline at end of file +var _0xbf1a=['exports','name','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbf1a,0x1c7));var _0xabf1=function(_0x5b98c5,_0x430f22){_0x5b98c5=_0x5b98c5-0x0;var _0x28b033=_0xbf1a[_0x5b98c5];return _0x28b033;};'use strict';var Sequelize=require(_0xabf1('0x0'));module[_0xabf1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xabf1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabf1('0x3')](_0xabf1('0x4'),'beepall',_0xabf1('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 620e29f..a4dc9eb 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 _0xf590=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','openchannelPause','nolimit','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x20e7d3,_0xb54e3f){var _0xa62eeb=function(_0x9966d1){while(--_0x9966d1){_0x20e7d3['push'](_0x20e7d3['shift']());}};_0xa62eeb(++_0xb54e3f);}(_0xf590,0x7a));var _0x0f59=function(_0x1bfd43,_0x2b9d99){_0x1bfd43=_0x1bfd43-0x0;var _0x13fbc9=_0xf590[_0x1bfd43];return _0x13fbc9;};'use strict';var pdf=require(_0x0f59('0x0'));var emlformat=require(_0x0f59('0x1'));var rimraf=require(_0x0f59('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f59('0x3'));var rp=require(_0x0f59('0x4'));var moment=require(_0x0f59('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f59('0x6'));var util=require(_0x0f59('0x7'));var path=require(_0x0f59('0x8'));var sox=require(_0x0f59('0x9'));var csv=require(_0x0f59('0xa'));var ejs=require(_0x0f59('0xb'));var fs=require('fs');var _=require(_0x0f59('0xc'));var squel=require('squel');var crypto=require(_0x0f59('0xd'));var jsforce=require(_0x0f59('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0f59('0xa'));var querystring=require(_0x0f59('0xf'));var Papa=require(_0x0f59('0x10'));var Redis=require(_0x0f59('0x11'));var authService=require(_0x0f59('0x12'));var qs=require(_0x0f59('0x13'));var as=require(_0x0f59('0x14'));var hardwareService=require(_0x0f59('0x15'));var logger=require(_0x0f59('0x16'))(_0x0f59('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f59('0x18'));var db=require(_0x0f59('0x19'))['db'];config[_0x0f59('0x1a')]=_[_0x0f59('0x1b')](config['redis'],{'host':_0x0f59('0x1c'),'port':0x18eb});var socket=require(_0x0f59('0x1d'))(new Redis(config[_0x0f59('0x1a')]));require(_0x0f59('0x1e'))[_0x0f59('0x1f')](socket);function respondWithStatusCode(_0x24eac6,_0x5ca9a5){_0x5ca9a5=_0x5ca9a5||0xcc;return function(_0x17bde3){if(_0x17bde3){return _0x24eac6[_0x0f59('0x20')](_0x5ca9a5);}return _0x24eac6['status'](_0x5ca9a5)[_0x0f59('0x21')]();};}function respondWithResult(_0x261136,_0x1601b2){_0x1601b2=_0x1601b2||0xc8;return function(_0x1a5b5d){if(_0x1a5b5d){return _0x261136[_0x0f59('0x22')](_0x1601b2)[_0x0f59('0x23')](_0x1a5b5d);}};}function respondWithFilteredResult(_0xa4e1f4,_0x4c30e5){return function(_0x42fc73){if(_0x42fc73){var _0x1a1822=_0x42fc73[_0x0f59('0x24')],_0x2e2fdc=_0x4c30e5['offset'],_0x359afd=_0x4c30e5[_0x0f59('0x25')]+_0x4c30e5['limit'],_0x145a22;if(_0x359afd>=_0x1a1822){_0x359afd=_0x1a1822;_0x145a22=0xc8;}else{_0x145a22=0xce;}_0xa4e1f4[_0x0f59('0x22')](_0x145a22);return _0xa4e1f4[_0x0f59('0x26')](_0x0f59('0x27'),_0x2e2fdc+'-'+_0x359afd+'/'+_0x1a1822)['json'](_0x42fc73);}return null;};}function patchUpdates(_0x64dd82){return function(_0x42f171){try{jsonpatch[_0x0f59('0x28')](_0x42f171,_0x64dd82,!![]);}catch(_0x3ee3ab){return BPromise['reject'](_0x3ee3ab);}return _0x42f171[_0x0f59('0x29')]();};}function saveUpdates(_0x12411f,_0x267786){return function(_0x277b1b){if(_0x277b1b){return _0x277b1b[_0x0f59('0x2a')](_0x12411f)[_0x0f59('0x2b')](function(_0x219797){return _0x219797;});}return null;};}function removeEntity(_0x319832,_0x2d1023){return function(_0x1aad7a){if(_0x1aad7a){return _0x1aad7a[_0x0f59('0x2c')]()[_0x0f59('0x2b')](function(){var _0x4f98ee=_0x1aad7a[_0x0f59('0x2d')]({'plain':!![]});var _0x161486=_0x0f59('0x2e');return db[_0x0f59('0x2f')][_0x0f59('0x2c')]({'where':{'type':_0x161486,'resourceId':_0x4f98ee['id']}})[_0x0f59('0x2b')](function(){return _0x1aad7a;});})[_0x0f59('0x2b')](function(){_0x319832[_0x0f59('0x22')](0xcc)[_0x0f59('0x21')]();});}};}function handleEntityNotFound(_0x9982d5,_0x4b17d5){return function(_0x1b815a){if(!_0x1b815a){_0x9982d5[_0x0f59('0x20')](0x194);}return _0x1b815a;};}function handleError(_0x2f75a8,_0x47a81b){_0x47a81b=_0x47a81b||0x1f4;return function(_0x8c92ae){logger[_0x0f59('0x30')](_0x8c92ae[_0x0f59('0x31')]);if(_0x8c92ae[_0x0f59('0x32')]){delete _0x8c92ae[_0x0f59('0x32')];}_0x2f75a8[_0x0f59('0x22')](_0x47a81b)[_0x0f59('0x33')](_0x8c92ae);};}exports[_0x0f59('0x34')]=function(_0x3c5a26,_0xaf1611){var _0x347ed3={},_0x393a83={},_0x2134c0={'count':0x0,'rows':[]};var _0xfb6573=_['map'](db[_0x0f59('0x35')][_0x0f59('0x36')],function(_0x3179cf){return{'name':_0x3179cf[_0x0f59('0x37')],'type':_0x3179cf['type'][_0x0f59('0x38')]};});_0x393a83[_0x0f59('0x39')]=_[_0x0f59('0x3a')](_0xfb6573,_0x0f59('0x32'));_0x393a83['query']=_[_0x0f59('0x3b')](_0x3c5a26['query']);_0x393a83['filters']=_['intersection'](_0x393a83[_0x0f59('0x39')],_0x393a83[_0x0f59('0x3c')]);_0x347ed3[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x393a83[_0x0f59('0x39')],qs['fields'](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x347ed3['attributes']=_0x347ed3[_0x0f59('0x3d')][_0x0f59('0x40')]?_0x347ed3[_0x0f59('0x3d')]:_0x393a83['model'];if(!_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x41')]('nolimit')){_0x347ed3['limit']=qs[_0x0f59('0x42')](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x42')]);_0x347ed3['offset']=qs['offset'](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x25')]);}_0x347ed3[_0x0f59('0x43')]=qs[_0x0f59('0x44')](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x44')]);_0x347ed3[_0x0f59('0x45')]=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x3c5a26[_0x0f59('0x3c')],_0x393a83['filters']),_0xfb6573);if(_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x48')]){_0x347ed3['where']=_[_0x0f59('0x49')](_0x347ed3[_0x0f59('0x45')],{'$or':_['map'](_0xfb6573,function(_0x40623d){if(_0x40623d[_0x0f59('0x4a')]!==_0x0f59('0x4b')){var _0x109c93={};_0x109c93[_0x40623d[_0x0f59('0x32')]]={'$like':'%'+_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x48')]+'%'};return _0x109c93;}})});}_0x347ed3=_[_0x0f59('0x49')]({},_0x347ed3,_0x3c5a26[_0x0f59('0x4c')]);var _0x445d20={'where':_0x347ed3[_0x0f59('0x45')]};return db['OpenchannelQueue'][_0x0f59('0x24')](_0x445d20)[_0x0f59('0x2b')](function(_0x3d2c6d){_0x2134c0[_0x0f59('0x24')]=_0x3d2c6d;if(_0x3c5a26[_0x0f59('0x3c')]['includeAll']){_0x347ed3[_0x0f59('0x4d')]=[{'all':!![]}];}return db[_0x0f59('0x35')][_0x0f59('0x4e')](_0x347ed3);})[_0x0f59('0x2b')](function(_0x2c47b5){_0x2134c0['rows']=_0x2c47b5;return _0x2134c0;})[_0x0f59('0x2b')](respondWithFilteredResult(_0xaf1611,_0x347ed3))[_0x0f59('0x4f')](handleError(_0xaf1611,null));};exports['show']=function(_0x3e5e14,_0x32efab){var _0x4cdaa1={'raw':!![],'where':{'id':_0x3e5e14[_0x0f59('0x50')]['id']}},_0x67fa3a={};_0x67fa3a[_0x0f59('0x39')]=_[_0x0f59('0x3b')](db[_0x0f59('0x35')][_0x0f59('0x36')]);_0x67fa3a[_0x0f59('0x3c')]=_[_0x0f59('0x3b')](_0x3e5e14[_0x0f59('0x3c')]);_0x67fa3a['filters']=_[_0x0f59('0x3e')](_0x67fa3a[_0x0f59('0x39')],_0x67fa3a['query']);_0x4cdaa1[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x67fa3a['model'],qs[_0x0f59('0x3f')](_0x3e5e14[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x4cdaa1['attributes']=_0x4cdaa1['attributes'][_0x0f59('0x40')]?_0x4cdaa1[_0x0f59('0x3d')]:_0x67fa3a[_0x0f59('0x39')];if(_0x3e5e14[_0x0f59('0x3c')][_0x0f59('0x51')]){_0x4cdaa1['include']=[{'all':!![]}];}_0x4cdaa1=_[_0x0f59('0x49')]({},_0x4cdaa1,_0x3e5e14['options']);return db['OpenchannelQueue']['find'](_0x4cdaa1)[_0x0f59('0x2b')](handleEntityNotFound(_0x32efab,null))[_0x0f59('0x2b')](respondWithResult(_0x32efab,null))[_0x0f59('0x4f')](handleError(_0x32efab,null));};exports[_0x0f59('0x52')]=function(_0x1a0aab,_0x2ddc1c){return db['OpenchannelQueue'][_0x0f59('0x52')](_0x1a0aab[_0x0f59('0x53')],{})[_0x0f59('0x2b')](function(_0x33b296){var _0x107cc2=_0x1a0aab[_0x0f59('0x54')][_0x0f59('0x2d')]({'plain':!![]});if(!_0x107cc2)throw new Error(_0x0f59('0x55'));if(_0x107cc2['role']===_0x0f59('0x54')){var _0x1b36b6=_0x33b296[_0x0f59('0x2d')]({'plain':!![]});var _0x4b732c=_0x0f59('0x2e');return db[_0x0f59('0x56')]['find']({'where':{'name':_0x4b732c,'userProfileId':_0x107cc2[_0x0f59('0x57')]},'raw':!![]})[_0x0f59('0x2b')](function(_0xedf402){if(_0xedf402&&_0xedf402['autoAssociation']===0x0){return db[_0x0f59('0x2f')][_0x0f59('0x52')]({'name':_0x1b36b6['name'],'resourceId':_0x1b36b6['id'],'type':_0xedf402[_0x0f59('0x32')],'sectionId':_0xedf402['id']},{})[_0x0f59('0x2b')](function(){return _0x33b296;});}else{return _0x33b296;}})[_0x0f59('0x4f')](function(_0x573084){logger[_0x0f59('0x30')](_0x0f59('0x58'),_0x573084);throw _0x573084;});}return _0x33b296;})['then'](respondWithResult(_0x2ddc1c,0xc9))[_0x0f59('0x4f')](handleError(_0x2ddc1c,null));};exports[_0x0f59('0x2a')]=function(_0x4e039a,_0xf5383a){if(_0x4e039a['body']['id']){delete _0x4e039a[_0x0f59('0x53')]['id'];}return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x4e039a[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0xf5383a,null))[_0x0f59('0x2b')](saveUpdates(_0x4e039a[_0x0f59('0x53')],null))[_0x0f59('0x2b')](respondWithResult(_0xf5383a,null))[_0x0f59('0x4f')](handleError(_0xf5383a,null));};exports[_0x0f59('0x2c')]=function(_0x1c3884,_0x5b3537){return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x1c3884[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x5b3537,null))['then'](removeEntity(_0x5b3537,null))[_0x0f59('0x4f')](handleError(_0x5b3537,null));};exports[_0x0f59('0x5a')]=function(_0x5bce3b,_0xe2c638){return db[_0x0f59('0x35')][_0x0f59('0x5a')]()['then'](respondWithResult(_0xe2c638,null))[_0x0f59('0x4f')](handleError(_0xe2c638,null));};exports['getMembers']=function(_0x5b0cdf,_0x4ce463,_0x32ee84){var _0x35247c={'raw':!![],'where':{}},_0xaa98b1={},_0x27e3df;return db[_0x0f59('0x35')][_0x0f59('0x5b')]({'where':{'id':_0x5b0cdf[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x4ce463,null))[_0x0f59('0x2b')](function(_0x2d9192){if(_0x2d9192){_0x27e3df=_0x2d9192[_0x0f59('0x2d')]({'plain':!![]});_0xaa98b1[_0x0f59('0x39')]=_['keys'](db[_0x0f59('0x5c')][_0x0f59('0x36')]);_0xaa98b1[_0x0f59('0x3c')]=_[_0x0f59('0x3b')](_0x5b0cdf[_0x0f59('0x3c')]);_0xaa98b1[_0x0f59('0x46')]=_[_0x0f59('0x3e')](_0xaa98b1['model'],_0xaa98b1['query']);_0x35247c[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0xaa98b1[_0x0f59('0x39')],qs[_0x0f59('0x3f')](_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x35247c[_0x0f59('0x3d')]=_0x35247c[_0x0f59('0x3d')][_0x0f59('0x40')]?_0x35247c['attributes']:_0xaa98b1[_0x0f59('0x39')];if(!_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x41')]('nolimit')){_0x35247c['limit']=qs[_0x0f59('0x42')](_0x5b0cdf['query'][_0x0f59('0x42')]);_0x35247c[_0x0f59('0x25')]=qs[_0x0f59('0x25')](_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x25')]);}_0x35247c[_0x0f59('0x43')]=qs['sort'](_0x5b0cdf['query'][_0x0f59('0x44')]);_0x35247c[_0x0f59('0x45')]=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x5b0cdf['query'],_0xaa98b1[_0x0f59('0x46')]));_0x35247c[_0x0f59('0x45')]['OpenchannelQueueId']=_0x2d9192['id'];if(_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x48')]){_0x35247c['where']=_[_0x0f59('0x49')](_0x35247c[_0x0f59('0x45')],{'$or':_[_0x0f59('0x3a')](_0x35247c[_0x0f59('0x3d')],function(_0x4d8192){var _0x209b5c={};_0x209b5c[_0x4d8192]={'$like':'%'+_0x5b0cdf['query'][_0x0f59('0x48')]+'%'};return _0x209b5c;})});}_0x35247c=_[_0x0f59('0x49')]({},_0x35247c,_0x5b0cdf[_0x0f59('0x4c')]);return db[_0x0f59('0x5c')][_0x0f59('0x4e')](_0x35247c);}})[_0x0f59('0x2b')](function(_0x53b043){if(_0x53b043){return db[_0x0f59('0x5d')][_0x0f59('0x5e')]({'where':{'id':_[_0x0f59('0x3a')](_0x53b043,_0x0f59('0x5f')),'role':_0x0f59('0x60')},'attributes':['id',_0x0f59('0x32'),'openchannelPause',_0x0f59('0x61'),_0x0f59('0x62')]});}})[_0x0f59('0x2b')](function(_0x118b1c){if(_0x118b1c){return{'count':_0x118b1c[_0x0f59('0x24')],'rows':_[_0x0f59('0x3a')](_0x118b1c['rows'],function(_0x1eaa49){return{'membername':_0x1eaa49['name'],'UserId':_0x1eaa49['id'],'queue_name':_0x27e3df[_0x0f59('0x32')],'OpenchannelQueueId':_0x27e3df['id'],'interface':util['format']('%s/%s','SIP',_0x1eaa49['name']),'penalty':0x0,'paused':_0x1eaa49[_0x0f59('0x63')],'createdAt':_0x1eaa49[_0x0f59('0x62')],'updatedAt':_0x1eaa49[_0x0f59('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ce463,_0x35247c))[_0x0f59('0x4f')](handleError(_0x4ce463,null));};exports['getTeams']=function(_0x3dc507,_0x200e85,_0x593ea4){var _0x5dea9d={};var _0x274ff8={};var _0x340d7b;var _0x3027c0;return db['OpenchannelQueue'][_0x0f59('0x5b')]({'where':{'id':_0x3dc507[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x200e85,null))[_0x0f59('0x2b')](function(_0x4234a4){if(_0x4234a4){_0x340d7b=_0x4234a4;_0x274ff8[_0x0f59('0x39')]=_[_0x0f59('0x3b')](db['Team']['rawAttributes']);_0x274ff8[_0x0f59('0x3c')]=_[_0x0f59('0x3b')](_0x3dc507[_0x0f59('0x3c')]);_0x274ff8['filters']=_[_0x0f59('0x3e')](_0x274ff8[_0x0f59('0x39')],_0x274ff8['query']);_0x5dea9d[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x274ff8[_0x0f59('0x39')],qs[_0x0f59('0x3f')](_0x3dc507[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x5dea9d[_0x0f59('0x3d')]=_0x5dea9d[_0x0f59('0x3d')][_0x0f59('0x40')]?_0x5dea9d[_0x0f59('0x3d')]:_0x274ff8[_0x0f59('0x39')];_0x5dea9d[_0x0f59('0x43')]=qs['sort'](_0x3dc507[_0x0f59('0x3c')][_0x0f59('0x44')]);_0x5dea9d['where']=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x3dc507['query'],_0x274ff8['filters']));if(_0x3dc507[_0x0f59('0x3c')]['filter']){_0x5dea9d[_0x0f59('0x45')]=_['merge'](_0x5dea9d[_0x0f59('0x45')],{'$or':_[_0x0f59('0x3a')](_0x5dea9d[_0x0f59('0x3d')],function(_0x2f406f){var _0x39358c={};_0x39358c[_0x2f406f]={'$like':'%'+_0x3dc507['query'][_0x0f59('0x48')]+'%'};return _0x39358c;})});}_0x5dea9d=_[_0x0f59('0x49')]({},_0x5dea9d,_0x3dc507[_0x0f59('0x4c')]);return _0x340d7b['getTeams'](_0x5dea9d);}})[_0x0f59('0x2b')](function(_0x19c4d5){if(_0x19c4d5){_0x3027c0=_0x19c4d5[_0x0f59('0x40')];if(!_0x3dc507['query'][_0x0f59('0x41')](_0x0f59('0x64'))){_0x5dea9d[_0x0f59('0x42')]=qs[_0x0f59('0x42')](_0x3dc507[_0x0f59('0x3c')]['limit']);_0x5dea9d['offset']=qs['offset'](_0x3dc507[_0x0f59('0x3c')][_0x0f59('0x25')]);}return _0x340d7b[_0x0f59('0x65')](_0x5dea9d);}})['then'](function(_0xaab8e6){if(_0xaab8e6){return _0xaab8e6?{'count':_0x3027c0,'rows':_0xaab8e6}:null;}})['then'](respondWithResult(_0x200e85,null))[_0x0f59('0x4f')](handleError(_0x200e85,null));};exports[_0x0f59('0x66')]=function(_0x183425,_0x321ddd,_0x1a206a){var _0x32a82c=_0x183425['body'][_0x0f59('0x67')];return db[_0x0f59('0x68')][_0x0f59('0x4e')]({'where':{'id':_0x32a82c},'attributes':['id'],'include':[{'model':db[_0x0f59('0x5d')],'as':_0x0f59('0x69'),'attributes':['id',_0x0f59('0x32'),_0x0f59('0x6a'),_0x0f59('0x6b'),_0x0f59('0x6c')],'raw':!![]}]})['then'](function(_0x4fc82f){if(_0x4fc82f){var _0x51ecc8=_[_0x0f59('0x6d')](_0x4fc82f,function(_0x2d0fb6){var _0x4d0d57=_0x2d0fb6[_0x0f59('0x2d')]({'plain':!![]});return _0x4d0d57[_0x0f59('0x69')];});return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x183425[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](function(_0x1b709d){return db[_0x0f59('0x6e')][_0x0f59('0x6f')](function(_0x19fa25){return _0x1b709d[_0x0f59('0x66')](_0x32a82c,{'transaction':_0x19fa25})[_0x0f59('0x2b')](function(){return BPromise['each'](_0x51ecc8,function(_0x3d97a1){return db[_0x0f59('0x5c')][_0x0f59('0x70')]({'where':{'UserId':_0x3d97a1['id'],'OpenchannelQueueId':_0x183425['params']['id']},'transaction':_0x19fa25});});})[_0x0f59('0x2b')](function(){_0x51ecc8[_0x0f59('0x71')](function(_0x1114bf){socket[_0x0f59('0x72')]('userOpenchannelQueue:save',{'UserId':_0x1114bf['id'],'OpenchannelQueueId':_0x1b709d['id']});});});});});}})[_0x0f59('0x2b')](respondWithStatusCode(_0x321ddd,null))[_0x0f59('0x4f')](handleError(_0x321ddd,null));};exports[_0x0f59('0x73')]=function(_0x1be115,_0x13f01a,_0x36f190){return db[_0x0f59('0x68')]['findAll']({'where':{'id':_0x1be115[_0x0f59('0x3c')][_0x0f59('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0f59('0x69'),'attributes':['id'],'raw':!![]}]})[_0x0f59('0x2b')](handleEntityNotFound(_0x13f01a,null))[_0x0f59('0x2b')](function(_0x4a5c87){var _0x38b46a=_['map'](_0x4a5c87,'id');var _0x16353a=[];var _0x95e8c1=[];var _0x473dea=squel['select']();_0x473dea[_0x0f59('0x74')](_0x0f59('0x75'))['from'](_0x0f59('0x76'),'tq')[_0x0f59('0x77')]('user_has_teams','ut',_0x0f59('0x78'))[_0x0f59('0x45')](_0x0f59('0x79'),_0x1be115[_0x0f59('0x50')]['id']);for(var _0x1eb3ef=0x0;_0x1eb3ef<_0x4a5c87[_0x0f59('0x40')];_0x1eb3ef+=0x1){let _0x13a926=_0x4a5c87[_0x1eb3ef];for(var _0x5bfc84=0x0;_0x5bfc84<_0x13a926[_0x0f59('0x69')][_0x0f59('0x40')];_0x5bfc84+=0x1){let _0x125fd8=_0x13a926[_0x0f59('0x69')][_0x5bfc84];var _0xa5f92f=_0x473dea[_0x0f59('0x7a')]();_0xa5f92f[_0x0f59('0x45')]('ut.UserId\x20=\x20?',_0x125fd8['id']);_0x95e8c1['push'](db[_0x0f59('0x6e')][_0x0f59('0x3c')](_0xa5f92f[_0x0f59('0x7b')](),{'type':db['sequelize'][_0x0f59('0x7c')][_0x0f59('0x7d')]})['then'](function(_0x2a145a){if(_0x2a145a[_0x0f59('0x40')]===0x1){return _0x125fd8['id'];}else{var _0x5e28aa=_[_0x0f59('0x7e')](_[_0x0f59('0x3a')](_0x2a145a,_0x0f59('0x7f')),function(_0x3c42a7){return _[_0x0f59('0x80')](_0x38b46a,_0x3c42a7);});if(_0x5e28aa){return _0x125fd8['id'];}}}));}}return BPromise[_0x0f59('0x81')](_0x95e8c1)['then'](function(_0x45868b){_0x16353a=_(_0x16353a)[_0x0f59('0x82')](_0x45868b)[_0x0f59('0x83')]()[_0x0f59('0x84')]();return db[_0x0f59('0x35')]['find']({'where':{'id':_0x1be115[_0x0f59('0x50')]['id']}})['then'](function(_0x39b7a9){return db['sequelize'][_0x0f59('0x6f')](function(_0x221d77){return _0x39b7a9['removeTeams'](_0x1be115['query'][_0x0f59('0x67')],{'transaction':_0x221d77})['then'](function(){if(!_[_0x0f59('0x85')](_0x16353a)){return _0x39b7a9['removeAgents'](_0x16353a,{'transaction':_0x221d77});}})[_0x0f59('0x2b')](function(){_0x16353a['forEach'](function(_0x33a2c4){socket[_0x0f59('0x72')](_0x0f59('0x86'),{'UserId':_0x33a2c4,'OpenchannelQueueId':_0x39b7a9['id']});});});});});});})[_0x0f59('0x2b')](respondWithStatusCode(_0x13f01a,null))[_0x0f59('0x4f')](handleError(_0x13f01a,null));};exports['addAgents']=function(_0x455d0d,_0x31a84f,_0x4c65a5){return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x455d0d[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x31a84f,null))['then'](function(_0x5aa420){if(_0x5aa420){return _0x5aa420[_0x0f59('0x87')](_0x455d0d[_0x0f59('0x53')][_0x0f59('0x67')],_[_0x0f59('0x88')](_0x455d0d[_0x0f59('0x53')],[_0x0f59('0x67'),'id'])||{})[_0x0f59('0x89')](function(_0x16bea4){for(var _0x31c3ad=0x0;_0x31c3ad<_0x455d0d[_0x0f59('0x53')][_0x0f59('0x67')][_0x0f59('0x40')];_0x31c3ad+=0x1){socket[_0x0f59('0x72')]('userOpenchannelQueue:save',{'UserId':_0x455d0d[_0x0f59('0x53')][_0x0f59('0x67')][_0x31c3ad],'OpenchannelQueueId':_0x455d0d['params']['id']});}return _0x16bea4;});}})[_0x0f59('0x2b')](respondWithResult(_0x31a84f,null))[_0x0f59('0x4f')](handleError(_0x31a84f,null));};exports[_0x0f59('0x8a')]=function(_0x5697dd,_0x3e7157,_0x2f9b06){return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x5697dd[_0x0f59('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e7157,null))[_0x0f59('0x2b')](function(_0xcbeeae){if(_0xcbeeae){return _0xcbeeae[_0x0f59('0x8a')](_0x5697dd[_0x0f59('0x3c')][_0x0f59('0x67')])['then'](function(){if(_[_0x0f59('0x8b')](_0x5697dd[_0x0f59('0x3c')]['ids'])){for(var _0xe62d83=0x0;_0xe62d83<_0x5697dd[_0x0f59('0x3c')][_0x0f59('0x67')][_0x0f59('0x40')];_0xe62d83+=0x1){socket[_0x0f59('0x72')](_0x0f59('0x86'),{'UserId':Number(_0x5697dd[_0x0f59('0x3c')]['ids'][_0xe62d83]),'OpenchannelQueueId':Number(_0x5697dd[_0x0f59('0x50')]['id'])});}}else{socket[_0x0f59('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5697dd[_0x0f59('0x3c')][_0x0f59('0x67')]),'OpenchannelQueueId':Number(_0x5697dd[_0x0f59('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e7157,null))[_0x0f59('0x4f')](handleError(_0x3e7157,null));};exports['getAgents']=function(_0x61f881,_0x15d1bd,_0x40380d){var _0x266271={};var _0x2fefca={};var _0x278151;var _0x52d31b;return db[_0x0f59('0x35')]['findOne']({'where':{'id':_0x61f881['params']['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x15d1bd,null))[_0x0f59('0x2b')](function(_0x4d4b01){if(_0x4d4b01){_0x278151=_0x4d4b01;_0x2fefca[_0x0f59('0x39')]=_[_0x0f59('0x3b')](db[_0x0f59('0x5d')][_0x0f59('0x36')]);_0x2fefca[_0x0f59('0x3c')]=_['keys'](_0x61f881['query']);_0x2fefca[_0x0f59('0x46')]=_[_0x0f59('0x3e')](_0x2fefca[_0x0f59('0x39')],_0x2fefca['query']);_0x266271[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x2fefca['model'],qs[_0x0f59('0x3f')](_0x61f881[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x266271[_0x0f59('0x3d')]=_0x266271['attributes'][_0x0f59('0x40')]?_0x266271['attributes']:_0x2fefca[_0x0f59('0x39')];_0x266271[_0x0f59('0x43')]=qs[_0x0f59('0x44')](_0x61f881[_0x0f59('0x3c')][_0x0f59('0x44')]);_0x266271['where']=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x61f881['query'],_0x2fefca[_0x0f59('0x46')]));if(_0x61f881[_0x0f59('0x3c')][_0x0f59('0x48')]){_0x266271[_0x0f59('0x45')]=_[_0x0f59('0x49')](_0x266271[_0x0f59('0x45')],{'$or':_[_0x0f59('0x3a')](_0x266271[_0x0f59('0x3d')],function(_0x1c6a28){var _0x5f0f8a={};_0x5f0f8a[_0x1c6a28]={'$like':'%'+_0x61f881[_0x0f59('0x3c')][_0x0f59('0x48')]+'%'};return _0x5f0f8a;})});}_0x266271=_[_0x0f59('0x49')]({},_0x266271,_0x61f881[_0x0f59('0x4c')]);return _0x278151[_0x0f59('0x8c')](_0x266271);}})[_0x0f59('0x2b')](function(_0x2c5c16){if(_0x2c5c16){_0x52d31b=_0x2c5c16['length'];if(!_0x61f881['query'][_0x0f59('0x41')]('nolimit')){_0x266271[_0x0f59('0x42')]=qs['limit'](_0x61f881[_0x0f59('0x3c')][_0x0f59('0x42')]);_0x266271['offset']=qs[_0x0f59('0x25')](_0x61f881[_0x0f59('0x3c')]['offset']);}return _0x278151[_0x0f59('0x8c')](_0x266271);}})[_0x0f59('0x2b')](function(_0x5e8997){if(_0x5e8997){return _0x5e8997?{'count':_0x52d31b,'rows':_0x5e8997}:null;}})[_0x0f59('0x2b')](respondWithResult(_0x15d1bd,null))[_0x0f59('0x4f')](handleError(_0x15d1bd,null));}; \ No newline at end of file +var _0x3605=['includes','all','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelQueue','includeAll','findAll','catch','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','every','TeamId'];(function(_0x52b914,_0x52bcd3){var _0x21e041=function(_0x379e3a){while(--_0x379e3a){_0x52b914['push'](_0x52b914['shift']());}};_0x21e041(++_0x52bcd3);}(_0x3605,0x123));var _0x5360=function(_0xacf6ff,_0x366edc){_0xacf6ff=_0xacf6ff-0x0;var _0x3a7374=_0x3605[_0xacf6ff];return _0x3a7374;};'use strict';var pdf=require(_0x5360('0x0'));var emlformat=require(_0x5360('0x1'));var rimraf=require(_0x5360('0x2'));var zipdir=require(_0x5360('0x3'));var jsonpatch=require(_0x5360('0x4'));var rp=require('request-promise');var moment=require(_0x5360('0x5'));var BPromise=require(_0x5360('0x6'));var Mustache=require(_0x5360('0x7'));var util=require(_0x5360('0x8'));var path=require(_0x5360('0x9'));var sox=require(_0x5360('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5360('0xb'));var squel=require('squel');var crypto=require(_0x5360('0xc'));var jsforce=require(_0x5360('0xd'));var deskjs=require(_0x5360('0xe'));var toCsv=require(_0x5360('0xf'));var querystring=require(_0x5360('0x10'));var Papa=require(_0x5360('0x11'));var Redis=require(_0x5360('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5360('0x13'));var hardwareService=require(_0x5360('0x14'));var logger=require('../../config/logger')(_0x5360('0x15'));var utils=require(_0x5360('0x16'));var config=require(_0x5360('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5360('0x18'))['db'];config[_0x5360('0x19')]=_[_0x5360('0x1a')](config['redis'],{'host':_0x5360('0x1b'),'port':0x18eb});var socket=require(_0x5360('0x1c'))(new Redis(config[_0x5360('0x19')]));require(_0x5360('0x1d'))['register'](socket);function respondWithStatusCode(_0x44b67a,_0x5559ce){_0x5559ce=_0x5559ce||0xcc;return function(_0x220a00){if(_0x220a00){return _0x44b67a[_0x5360('0x1e')](_0x5559ce);}return _0x44b67a[_0x5360('0x1f')](_0x5559ce)[_0x5360('0x20')]();};}function respondWithResult(_0x54c0dc,_0x78563){_0x78563=_0x78563||0xc8;return function(_0x55118b){if(_0x55118b){return _0x54c0dc[_0x5360('0x1f')](_0x78563)[_0x5360('0x21')](_0x55118b);}};}function respondWithFilteredResult(_0x591ec2,_0x2b2374){return function(_0xb8f2c0){if(_0xb8f2c0){var _0x4c923a=_0xb8f2c0[_0x5360('0x22')],_0x415bc8=_0x2b2374[_0x5360('0x23')],_0x32a086=_0x2b2374[_0x5360('0x23')]+_0x2b2374['limit'],_0x17377b;if(_0x32a086>=_0x4c923a){_0x32a086=_0x4c923a;_0x17377b=0xc8;}else{_0x17377b=0xce;}_0x591ec2[_0x5360('0x1f')](_0x17377b);return _0x591ec2[_0x5360('0x24')](_0x5360('0x25'),_0x415bc8+'-'+_0x32a086+'/'+_0x4c923a)[_0x5360('0x21')](_0xb8f2c0);}return null;};}function patchUpdates(_0x126135){return function(_0x2cc5fd){try{jsonpatch[_0x5360('0x26')](_0x2cc5fd,_0x126135,!![]);}catch(_0x222739){return BPromise[_0x5360('0x27')](_0x222739);}return _0x2cc5fd[_0x5360('0x28')]();};}function saveUpdates(_0x3eae81,_0x35c948){return function(_0x7a02f4){if(_0x7a02f4){return _0x7a02f4[_0x5360('0x29')](_0x3eae81)[_0x5360('0x2a')](function(_0x5ac866){return _0x5ac866;});}return null;};}function removeEntity(_0x3b8f89,_0x5ac1de){return function(_0x5b8986){if(_0x5b8986){return _0x5b8986[_0x5360('0x2b')]()[_0x5360('0x2a')](function(){var _0x1bdd46=_0x5b8986[_0x5360('0x2c')]({'plain':!![]});var _0x1ff730=_0x5360('0x2d');return db[_0x5360('0x2e')]['destroy']({'where':{'type':_0x1ff730,'resourceId':_0x1bdd46['id']}})[_0x5360('0x2a')](function(){return _0x5b8986;});})[_0x5360('0x2a')](function(){_0x3b8f89[_0x5360('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f0d94,_0x3bcf42){return function(_0x36ebeb){if(!_0x36ebeb){_0x2f0d94[_0x5360('0x1e')](0x194);}return _0x36ebeb;};}function handleError(_0x14e16a,_0x164c60){_0x164c60=_0x164c60||0x1f4;return function(_0x49a493){logger[_0x5360('0x2f')](_0x49a493['stack']);if(_0x49a493['name']){delete _0x49a493[_0x5360('0x30')];}_0x14e16a[_0x5360('0x1f')](_0x164c60)[_0x5360('0x31')](_0x49a493);};}exports[_0x5360('0x32')]=function(_0xb36911,_0x14b97e){var _0x521b30={},_0x2bb357={},_0xf391f4={'count':0x0,'rows':[]};var _0x188428=_[_0x5360('0x33')](db['OpenchannelQueue'][_0x5360('0x34')],function(_0x358ae6){return{'name':_0x358ae6[_0x5360('0x35')],'type':_0x358ae6[_0x5360('0x36')][_0x5360('0x37')]};});_0x2bb357['model']=_[_0x5360('0x33')](_0x188428,_0x5360('0x30'));_0x2bb357[_0x5360('0x38')]=_[_0x5360('0x39')](_0xb36911[_0x5360('0x38')]);_0x2bb357['filters']=_[_0x5360('0x3a')](_0x2bb357['model'],_0x2bb357['query']);_0x521b30[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x2bb357[_0x5360('0x3c')],qs['fields'](_0xb36911[_0x5360('0x38')][_0x5360('0x3d')]));_0x521b30[_0x5360('0x3b')]=_0x521b30[_0x5360('0x3b')][_0x5360('0x3e')]?_0x521b30['attributes']:_0x2bb357[_0x5360('0x3c')];if(!_0xb36911[_0x5360('0x38')][_0x5360('0x3f')](_0x5360('0x40'))){_0x521b30[_0x5360('0x41')]=qs[_0x5360('0x41')](_0xb36911['query'][_0x5360('0x41')]);_0x521b30[_0x5360('0x23')]=qs['offset'](_0xb36911['query']['offset']);}_0x521b30[_0x5360('0x42')]=qs['sort'](_0xb36911[_0x5360('0x38')][_0x5360('0x43')]);_0x521b30[_0x5360('0x44')]=qs[_0x5360('0x45')](_[_0x5360('0x46')](_0xb36911['query'],_0x2bb357['filters']),_0x188428);if(_0xb36911[_0x5360('0x38')]['filter']){_0x521b30[_0x5360('0x44')]=_[_0x5360('0x47')](_0x521b30[_0x5360('0x44')],{'$or':_[_0x5360('0x33')](_0x188428,function(_0x20d87d){if(_0x20d87d['type']!==_0x5360('0x48')){var _0x2c9871={};_0x2c9871[_0x20d87d[_0x5360('0x30')]]={'$like':'%'+_0xb36911[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x2c9871;}})});}_0x521b30=_[_0x5360('0x47')]({},_0x521b30,_0xb36911[_0x5360('0x4a')]);var _0x35c882={'where':_0x521b30[_0x5360('0x44')]};return db[_0x5360('0x4b')][_0x5360('0x22')](_0x35c882)['then'](function(_0xd63f89){_0xf391f4['count']=_0xd63f89;if(_0xb36911[_0x5360('0x38')][_0x5360('0x4c')]){_0x521b30['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5360('0x4d')](_0x521b30);})[_0x5360('0x2a')](function(_0x21998c){_0xf391f4['rows']=_0x21998c;return _0xf391f4;})[_0x5360('0x2a')](respondWithFilteredResult(_0x14b97e,_0x521b30))[_0x5360('0x4e')](handleError(_0x14b97e,null));};exports[_0x5360('0x4f')]=function(_0x2e534b,_0x58effd){var _0x415eab={'raw':!![],'where':{'id':_0x2e534b['params']['id']}},_0xa3de21={};_0xa3de21[_0x5360('0x3c')]=_[_0x5360('0x39')](db['OpenchannelQueue'][_0x5360('0x34')]);_0xa3de21[_0x5360('0x38')]=_[_0x5360('0x39')](_0x2e534b['query']);_0xa3de21[_0x5360('0x45')]=_['intersection'](_0xa3de21['model'],_0xa3de21[_0x5360('0x38')]);_0x415eab[_0x5360('0x3b')]=_['intersection'](_0xa3de21['model'],qs[_0x5360('0x3d')](_0x2e534b[_0x5360('0x38')][_0x5360('0x3d')]));_0x415eab[_0x5360('0x3b')]=_0x415eab[_0x5360('0x3b')]['length']?_0x415eab[_0x5360('0x3b')]:_0xa3de21['model'];if(_0x2e534b['query']['includeAll']){_0x415eab[_0x5360('0x50')]=[{'all':!![]}];}_0x415eab=_['merge']({},_0x415eab,_0x2e534b[_0x5360('0x4a')]);return db[_0x5360('0x4b')]['find'](_0x415eab)[_0x5360('0x2a')](handleEntityNotFound(_0x58effd,null))[_0x5360('0x2a')](respondWithResult(_0x58effd,null))[_0x5360('0x4e')](handleError(_0x58effd,null));};exports[_0x5360('0x51')]=function(_0x5508b3,_0x181eb0){return db['OpenchannelQueue'][_0x5360('0x51')](_0x5508b3[_0x5360('0x52')],{})['then'](function(_0x577adc){var _0x472b6e=_0x5508b3['user'][_0x5360('0x2c')]({'plain':!![]});if(!_0x472b6e)throw new Error(_0x5360('0x53'));if(_0x472b6e[_0x5360('0x54')]==='user'){var _0x13615b=_0x577adc[_0x5360('0x2c')]({'plain':!![]});var _0x2b24ea='OpenchannelQueues';return db[_0x5360('0x55')][_0x5360('0x56')]({'where':{'name':_0x2b24ea,'userProfileId':_0x472b6e[_0x5360('0x57')]},'raw':!![]})[_0x5360('0x2a')](function(_0x102262){if(_0x102262&&_0x102262['autoAssociation']===0x0){return db[_0x5360('0x2e')][_0x5360('0x51')]({'name':_0x13615b[_0x5360('0x30')],'resourceId':_0x13615b['id'],'type':_0x102262[_0x5360('0x30')],'sectionId':_0x102262['id']},{})['then'](function(){return _0x577adc;});}else{return _0x577adc;}})[_0x5360('0x4e')](function(_0x1afcd0){logger['error'](_0x5360('0x58'),_0x1afcd0);throw _0x1afcd0;});}return _0x577adc;})[_0x5360('0x2a')](respondWithResult(_0x181eb0,0xc9))['catch'](handleError(_0x181eb0,null));};exports['update']=function(_0x208920,_0x3bccb0){if(_0x208920[_0x5360('0x52')]['id']){delete _0x208920[_0x5360('0x52')]['id'];}return db['OpenchannelQueue'][_0x5360('0x56')]({'where':{'id':_0x208920[_0x5360('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bccb0,null))[_0x5360('0x2a')](saveUpdates(_0x208920[_0x5360('0x52')],null))['then'](respondWithResult(_0x3bccb0,null))['catch'](handleError(_0x3bccb0,null));};exports[_0x5360('0x2b')]=function(_0x50eeee,_0x541c25){return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x50eeee[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x541c25,null))[_0x5360('0x2a')](removeEntity(_0x541c25,null))[_0x5360('0x4e')](handleError(_0x541c25,null));};exports[_0x5360('0x5a')]=function(_0x35cbd3,_0x1e3e27){return db[_0x5360('0x4b')][_0x5360('0x5a')]()[_0x5360('0x2a')](respondWithResult(_0x1e3e27,null))['catch'](handleError(_0x1e3e27,null));};exports['getMembers']=function(_0x13c9f8,_0x24a341,_0x503c40){var _0xd432db={'raw':!![],'where':{}},_0x559ac9={},_0x5e66fd;return db[_0x5360('0x4b')][_0x5360('0x5b')]({'where':{'id':_0x13c9f8[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x24a341,null))[_0x5360('0x2a')](function(_0x2cada5){if(_0x2cada5){_0x5e66fd=_0x2cada5[_0x5360('0x2c')]({'plain':!![]});_0x559ac9[_0x5360('0x3c')]=_[_0x5360('0x39')](db[_0x5360('0x5c')][_0x5360('0x34')]);_0x559ac9['query']=_[_0x5360('0x39')](_0x13c9f8[_0x5360('0x38')]);_0x559ac9[_0x5360('0x45')]=_[_0x5360('0x3a')](_0x559ac9[_0x5360('0x3c')],_0x559ac9[_0x5360('0x38')]);_0xd432db[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x559ac9['model'],qs[_0x5360('0x3d')](_0x13c9f8[_0x5360('0x38')][_0x5360('0x3d')]));_0xd432db[_0x5360('0x3b')]=_0xd432db[_0x5360('0x3b')][_0x5360('0x3e')]?_0xd432db['attributes']:_0x559ac9['model'];if(!_0x13c9f8[_0x5360('0x38')][_0x5360('0x3f')](_0x5360('0x40'))){_0xd432db[_0x5360('0x41')]=qs[_0x5360('0x41')](_0x13c9f8[_0x5360('0x38')][_0x5360('0x41')]);_0xd432db[_0x5360('0x23')]=qs[_0x5360('0x23')](_0x13c9f8[_0x5360('0x38')]['offset']);}_0xd432db[_0x5360('0x42')]=qs[_0x5360('0x43')](_0x13c9f8[_0x5360('0x38')][_0x5360('0x43')]);_0xd432db[_0x5360('0x44')]=qs[_0x5360('0x45')](_[_0x5360('0x46')](_0x13c9f8[_0x5360('0x38')],_0x559ac9['filters']));_0xd432db[_0x5360('0x44')][_0x5360('0x5d')]=_0x2cada5['id'];if(_0x13c9f8[_0x5360('0x38')][_0x5360('0x49')]){_0xd432db[_0x5360('0x44')]=_[_0x5360('0x47')](_0xd432db[_0x5360('0x44')],{'$or':_['map'](_0xd432db[_0x5360('0x3b')],function(_0x381697){var _0x14abb2={};_0x14abb2[_0x381697]={'$like':'%'+_0x13c9f8[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x14abb2;})});}_0xd432db=_[_0x5360('0x47')]({},_0xd432db,_0x13c9f8[_0x5360('0x4a')]);return db[_0x5360('0x5c')][_0x5360('0x4d')](_0xd432db);}})['then'](function(_0x4f5889){if(_0x4f5889){return db[_0x5360('0x5e')]['findAndCountAll']({'where':{'id':_[_0x5360('0x33')](_0x4f5889,_0x5360('0x5f')),'role':_0x5360('0x60')},'attributes':['id',_0x5360('0x30'),_0x5360('0x61'),_0x5360('0x62'),_0x5360('0x63')]});}})['then'](function(_0x16c204){if(_0x16c204){return{'count':_0x16c204['count'],'rows':_[_0x5360('0x33')](_0x16c204[_0x5360('0x64')],function(_0x207516){return{'membername':_0x207516[_0x5360('0x30')],'UserId':_0x207516['id'],'queue_name':_0x5e66fd['name'],'OpenchannelQueueId':_0x5e66fd['id'],'interface':util[_0x5360('0x65')]('%s/%s',_0x5360('0x66'),_0x207516[_0x5360('0x30')]),'penalty':0x0,'paused':_0x207516['openchannelPause'],'createdAt':_0x207516[_0x5360('0x63')],'updatedAt':_0x207516['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5360('0x2a')](respondWithFilteredResult(_0x24a341,_0xd432db))[_0x5360('0x4e')](handleError(_0x24a341,null));};exports['getTeams']=function(_0x446b25,_0x327cc5,_0x13cc63){var _0x1d68fe={};var _0x2e0ca4={};var _0x13c193;var _0x2f5fd6;return db[_0x5360('0x4b')]['findOne']({'where':{'id':_0x446b25[_0x5360('0x59')]['id']}})['then'](handleEntityNotFound(_0x327cc5,null))[_0x5360('0x2a')](function(_0x172f31){if(_0x172f31){_0x13c193=_0x172f31;_0x2e0ca4[_0x5360('0x3c')]=_[_0x5360('0x39')](db[_0x5360('0x67')]['rawAttributes']);_0x2e0ca4['query']=_[_0x5360('0x39')](_0x446b25[_0x5360('0x38')]);_0x2e0ca4[_0x5360('0x45')]=_[_0x5360('0x3a')](_0x2e0ca4['model'],_0x2e0ca4[_0x5360('0x38')]);_0x1d68fe[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x2e0ca4['model'],qs[_0x5360('0x3d')](_0x446b25['query'][_0x5360('0x3d')]));_0x1d68fe[_0x5360('0x3b')]=_0x1d68fe['attributes'][_0x5360('0x3e')]?_0x1d68fe[_0x5360('0x3b')]:_0x2e0ca4[_0x5360('0x3c')];_0x1d68fe[_0x5360('0x42')]=qs['sort'](_0x446b25[_0x5360('0x38')][_0x5360('0x43')]);_0x1d68fe[_0x5360('0x44')]=qs['filters'](_[_0x5360('0x46')](_0x446b25[_0x5360('0x38')],_0x2e0ca4[_0x5360('0x45')]));if(_0x446b25['query'][_0x5360('0x49')]){_0x1d68fe[_0x5360('0x44')]=_[_0x5360('0x47')](_0x1d68fe[_0x5360('0x44')],{'$or':_[_0x5360('0x33')](_0x1d68fe['attributes'],function(_0x573929){var _0x268a43={};_0x268a43[_0x573929]={'$like':'%'+_0x446b25[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x268a43;})});}_0x1d68fe=_['merge']({},_0x1d68fe,_0x446b25[_0x5360('0x4a')]);return _0x13c193[_0x5360('0x68')](_0x1d68fe);}})[_0x5360('0x2a')](function(_0x19b3f5){if(_0x19b3f5){_0x2f5fd6=_0x19b3f5[_0x5360('0x3e')];if(!_0x446b25['query'][_0x5360('0x3f')](_0x5360('0x40'))){_0x1d68fe[_0x5360('0x41')]=qs[_0x5360('0x41')](_0x446b25['query'][_0x5360('0x41')]);_0x1d68fe[_0x5360('0x23')]=qs[_0x5360('0x23')](_0x446b25['query'][_0x5360('0x23')]);}return _0x13c193[_0x5360('0x68')](_0x1d68fe);}})[_0x5360('0x2a')](function(_0x145b55){if(_0x145b55){return _0x145b55?{'count':_0x2f5fd6,'rows':_0x145b55}:null;}})[_0x5360('0x2a')](respondWithResult(_0x327cc5,null))[_0x5360('0x4e')](handleError(_0x327cc5,null));};exports[_0x5360('0x69')]=function(_0x286dd4,_0x182123,_0x391b2e){var _0x2be28a=_0x286dd4[_0x5360('0x52')][_0x5360('0x6a')];return db['Team'][_0x5360('0x4d')]({'where':{'id':_0x2be28a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5360('0x6b'),'attributes':['id',_0x5360('0x30'),_0x5360('0x6c'),_0x5360('0x6d'),'interface'],'raw':!![]}]})[_0x5360('0x2a')](function(_0xd51380){if(_0xd51380){var _0x374597=_['flatMap'](_0xd51380,function(_0x46a593){var _0x5bbf49=_0x46a593[_0x5360('0x2c')]({'plain':!![]});return _0x5bbf49['Agents'];});return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x286dd4[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](function(_0x2b5ead){return db[_0x5360('0x6e')][_0x5360('0x6f')](function(_0x51d8b5){return _0x2b5ead[_0x5360('0x69')](_0x2be28a,{'transaction':_0x51d8b5})[_0x5360('0x2a')](function(){return BPromise[_0x5360('0x70')](_0x374597,function(_0x20fbd5){return db[_0x5360('0x5c')][_0x5360('0x71')]({'where':{'UserId':_0x20fbd5['id'],'OpenchannelQueueId':_0x286dd4[_0x5360('0x59')]['id']},'transaction':_0x51d8b5});});})[_0x5360('0x2a')](function(){_0x374597[_0x5360('0x72')](function(_0x53084a){socket[_0x5360('0x73')](_0x5360('0x74'),{'UserId':_0x53084a['id'],'OpenchannelQueueId':_0x2b5ead['id']});});});});});}})['then'](respondWithStatusCode(_0x182123,null))['catch'](handleError(_0x182123,null));};exports['removeTeams']=function(_0x5a5f87,_0x3c5109,_0x26e06d){return db['Team'][_0x5360('0x4d')]({'where':{'id':_0x5a5f87[_0x5360('0x38')][_0x5360('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x5360('0x5e')],'as':_0x5360('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x5360('0x2a')](handleEntityNotFound(_0x3c5109,null))[_0x5360('0x2a')](function(_0x327586){var _0x34c7cb=_[_0x5360('0x33')](_0x327586,'id');var _0x20d803=[];var _0x460159=[];var _0x361ee8=squel[_0x5360('0x75')]();_0x361ee8[_0x5360('0x76')](_0x5360('0x77'))[_0x5360('0x78')]('team_has_openchannel_queues','tq')[_0x5360('0x79')](_0x5360('0x7a'),'ut',_0x5360('0x7b'))[_0x5360('0x44')]('OpenchannelQueueId\x20=\x20?',_0x5a5f87[_0x5360('0x59')]['id']);for(var _0x485b52=0x0;_0x485b52<_0x327586['length'];_0x485b52+=0x1){let _0x44dd18=_0x327586[_0x485b52];for(var _0x3fd6da=0x0;_0x3fd6da<_0x44dd18[_0x5360('0x6b')][_0x5360('0x3e')];_0x3fd6da+=0x1){let _0x213d3e=_0x44dd18[_0x5360('0x6b')][_0x3fd6da];var _0x1737ca=_0x361ee8[_0x5360('0x7c')]();_0x1737ca[_0x5360('0x44')]('ut.UserId\x20=\x20?',_0x213d3e['id']);_0x460159['push'](db['sequelize']['query'](_0x1737ca['toString'](),{'type':db[_0x5360('0x6e')][_0x5360('0x7d')][_0x5360('0x7e')]})['then'](function(_0x40159a){if(_0x40159a[_0x5360('0x3e')]===0x1){return _0x213d3e['id'];}else{var _0x1f39ce=_[_0x5360('0x7f')](_[_0x5360('0x33')](_0x40159a,_0x5360('0x80')),function(_0x1d00fe){return _[_0x5360('0x81')](_0x34c7cb,_0x1d00fe);});if(_0x1f39ce){return _0x213d3e['id'];}}}));}}return BPromise[_0x5360('0x82')](_0x460159)[_0x5360('0x2a')](function(_0x214398){_0x20d803=_(_0x20d803)['union'](_0x214398)[_0x5360('0x83')]()[_0x5360('0x84')]();return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x5a5f87[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](function(_0x14f585){return db[_0x5360('0x6e')][_0x5360('0x6f')](function(_0x5b6795){return _0x14f585[_0x5360('0x85')](_0x5a5f87[_0x5360('0x38')]['ids'],{'transaction':_0x5b6795})['then'](function(){if(!_[_0x5360('0x86')](_0x20d803)){return _0x14f585[_0x5360('0x87')](_0x20d803,{'transaction':_0x5b6795});}})[_0x5360('0x2a')](function(){_0x20d803[_0x5360('0x72')](function(_0x4bc3ba){socket[_0x5360('0x73')](_0x5360('0x88'),{'UserId':_0x4bc3ba,'OpenchannelQueueId':_0x14f585['id']});});});});});});})[_0x5360('0x2a')](respondWithStatusCode(_0x3c5109,null))[_0x5360('0x4e')](handleError(_0x3c5109,null));};exports[_0x5360('0x89')]=function(_0x20c4b2,_0x269a23,_0x393228){return db[_0x5360('0x4b')][_0x5360('0x56')]({'where':{'id':_0x20c4b2[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x269a23,null))['then'](function(_0x55c3bf){if(_0x55c3bf){return _0x55c3bf['addAgents'](_0x20c4b2['body'][_0x5360('0x6a')],_['omit'](_0x20c4b2['body'],[_0x5360('0x6a'),'id'])||{})['spread'](function(_0x172244){for(var _0x4b5d4e=0x0;_0x4b5d4e<_0x20c4b2[_0x5360('0x52')][_0x5360('0x6a')]['length'];_0x4b5d4e+=0x1){socket[_0x5360('0x73')](_0x5360('0x74'),{'UserId':_0x20c4b2[_0x5360('0x52')][_0x5360('0x6a')][_0x4b5d4e],'OpenchannelQueueId':_0x20c4b2[_0x5360('0x59')]['id']});}return _0x172244;});}})['then'](respondWithResult(_0x269a23,null))[_0x5360('0x4e')](handleError(_0x269a23,null));};exports[_0x5360('0x87')]=function(_0x1d2517,_0x17c697,_0x2e6f37){return db[_0x5360('0x4b')]['find']({'where':{'id':_0x1d2517['params']['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x17c697,null))[_0x5360('0x2a')](function(_0x572fa1){if(_0x572fa1){return _0x572fa1[_0x5360('0x87')](_0x1d2517[_0x5360('0x38')]['ids'])[_0x5360('0x2a')](function(){if(_[_0x5360('0x8a')](_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')])){for(var _0x4ab928=0x0;_0x4ab928<_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')]['length'];_0x4ab928+=0x1){socket[_0x5360('0x73')](_0x5360('0x88'),{'UserId':Number(_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')][_0x4ab928]),'OpenchannelQueueId':Number(_0x1d2517[_0x5360('0x59')]['id'])});}}else{socket[_0x5360('0x73')](_0x5360('0x88'),{'UserId':Number(_0x1d2517[_0x5360('0x38')][_0x5360('0x6a')]),'OpenchannelQueueId':Number(_0x1d2517['params']['id'])});}});}})[_0x5360('0x2a')](respondWithStatusCode(_0x17c697,null))['catch'](handleError(_0x17c697,null));};exports['getAgents']=function(_0x9bb523,_0x34e2a8,_0x5d6304){var _0x2764bf={};var _0x599e5a={};var _0x2eb089;var _0x44e7c8;return db[_0x5360('0x4b')]['findOne']({'where':{'id':_0x9bb523[_0x5360('0x59')]['id']}})[_0x5360('0x2a')](handleEntityNotFound(_0x34e2a8,null))['then'](function(_0x1f36c4){if(_0x1f36c4){_0x2eb089=_0x1f36c4;_0x599e5a[_0x5360('0x3c')]=_[_0x5360('0x39')](db[_0x5360('0x5e')][_0x5360('0x34')]);_0x599e5a['query']=_['keys'](_0x9bb523['query']);_0x599e5a[_0x5360('0x45')]=_['intersection'](_0x599e5a[_0x5360('0x3c')],_0x599e5a[_0x5360('0x38')]);_0x2764bf[_0x5360('0x3b')]=_[_0x5360('0x3a')](_0x599e5a[_0x5360('0x3c')],qs['fields'](_0x9bb523['query']['fields']));_0x2764bf[_0x5360('0x3b')]=_0x2764bf[_0x5360('0x3b')]['length']?_0x2764bf[_0x5360('0x3b')]:_0x599e5a[_0x5360('0x3c')];_0x2764bf[_0x5360('0x42')]=qs[_0x5360('0x43')](_0x9bb523[_0x5360('0x38')]['sort']);_0x2764bf[_0x5360('0x44')]=qs[_0x5360('0x45')](_[_0x5360('0x46')](_0x9bb523['query'],_0x599e5a[_0x5360('0x45')]));if(_0x9bb523[_0x5360('0x38')][_0x5360('0x49')]){_0x2764bf[_0x5360('0x44')]=_[_0x5360('0x47')](_0x2764bf[_0x5360('0x44')],{'$or':_[_0x5360('0x33')](_0x2764bf['attributes'],function(_0x479a61){var _0x147e47={};_0x147e47[_0x479a61]={'$like':'%'+_0x9bb523[_0x5360('0x38')][_0x5360('0x49')]+'%'};return _0x147e47;})});}_0x2764bf=_[_0x5360('0x47')]({},_0x2764bf,_0x9bb523[_0x5360('0x4a')]);return _0x2eb089[_0x5360('0x8b')](_0x2764bf);}})[_0x5360('0x2a')](function(_0x6d7820){if(_0x6d7820){_0x44e7c8=_0x6d7820[_0x5360('0x3e')];if(!_0x9bb523[_0x5360('0x38')]['hasOwnProperty'](_0x5360('0x40'))){_0x2764bf[_0x5360('0x41')]=qs[_0x5360('0x41')](_0x9bb523[_0x5360('0x38')]['limit']);_0x2764bf[_0x5360('0x23')]=qs[_0x5360('0x23')](_0x9bb523[_0x5360('0x38')][_0x5360('0x23')]);}return _0x2eb089['getAgents'](_0x2764bf);}})[_0x5360('0x2a')](function(_0x26ea5e){if(_0x26ea5e){return _0x26ea5e?{'count':_0x44e7c8,'rows':_0x26ea5e}:null;}})[_0x5360('0x2a')](respondWithResult(_0x34e2a8,null))[_0x5360('0x4e')](handleError(_0x34e2a8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 345fd57..adbf2c5 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 _0x0242=['hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0242,0x15f));var _0x2024=function(_0x4dc0c8,_0x48d51f){_0x4dc0c8=_0x4dc0c8-0x0;var _0x26bf81=_0x0242[_0x4dc0c8];return _0x26bf81;};'use strict';var EventEmitter=require(_0x2024('0x0'));var OpenchannelQueue=require(_0x2024('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2024('0x2'),'afterUpdate':_0x2024('0x3'),'afterDestroy':_0x2024('0x4')};function emitEvent(_0x4e434f){return function(_0x235a98,_0x24401e,_0x4ead08){OpenchannelQueueEvents[_0x2024('0x5')](_0x4e434f+':'+_0x235a98['id'],_0x235a98);OpenchannelQueueEvents[_0x2024('0x5')](_0x4e434f,_0x235a98);_0x4ead08(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2024('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x4655=['save','update','remove','emit','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x7d653b,_0x3f3341){var _0x3a30e7=function(_0x4e7b60){while(--_0x4e7b60){_0x7d653b['push'](_0x7d653b['shift']());}};_0x3a30e7(++_0x3f3341);}(_0x4655,0x11c));var _0x5465=function(_0x346156,_0x35e0ae){_0x346156=_0x346156-0x0;var _0x5b3ec7=_0x4655[_0x346156];return _0x5b3ec7;};'use strict';var EventEmitter=require(_0x5465('0x0'));var OpenchannelQueue=require(_0x5465('0x1'))['db'][_0x5465('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5465('0x3')](0x0);var events={'afterCreate':_0x5465('0x4'),'afterUpdate':_0x5465('0x5'),'afterDestroy':_0x5465('0x6')};function emitEvent(_0x2f15db){return function(_0x41601b,_0x5f1e4f,_0x49d94){OpenchannelQueueEvents[_0x5465('0x7')](_0x2f15db+':'+_0x41601b['id'],_0x41601b);OpenchannelQueueEvents[_0x5465('0x7')](_0x2f15db,_0x41601b);_0x49d94(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5465('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8df7fcc..d221fc2 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 _0x5f5f=['exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x5f5f,0x178));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5f5('0x0'));var util=require('util');var logger=require(_0xf5f5('0x1'))(_0xf5f5('0x2'));var moment=require(_0xf5f5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5f5('0x4'));var fs=require('fs');var path=require(_0xf5f5('0x5'));var rimraf=require(_0xf5f5('0x6'));var config=require(_0xf5f5('0x7'));var attributes=require(_0xf5f5('0x8'));module[_0xf5f5('0x9')]=function(_0x28fc98,_0xb6003b){return _0x28fc98[_0xf5f5('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb49=['define','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x32f725,_0x1c4b0d){var _0x544673=function(_0x9b5a9b){while(--_0x9b5a9b){_0x32f725['push'](_0x32f725['shift']());}};_0x544673(++_0x1c4b0d);}(_0xcb49,0x156));var _0x9cb4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xcb49[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x9cb4('0x0'));var util=require('util');var logger=require(_0x9cb4('0x1'))(_0x9cb4('0x2'));var moment=require(_0x9cb4('0x3'));var BPromise=require(_0x9cb4('0x4'));var rp=require(_0x9cb4('0x5'));var fs=require('fs');var path=require(_0x9cb4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x9cb4('0x7')]=function(_0x5c54b7,_0x5618ab){return _0x5c54b7[_0x9cb4('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x9cb4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 07a8d08..a66bcd4 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 _0x7583=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','raw','options','where','attributes','include','model','map','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash'];(function(_0x42b156,_0x12c79e){var _0x2a8554=function(_0x26ab18){while(--_0x26ab18){_0x42b156['push'](_0x42b156['shift']());}};_0x2a8554(++_0x12c79e);}(_0x7583,0x117));var _0x3758=function(_0x441e17,_0x340ea9){_0x441e17=_0x441e17-0x0;var _0x3c9eb4=_0x7583[_0x441e17];return _0x3c9eb4;};'use strict';var _=require(_0x3758('0x0'));var util=require('util');var moment=require(_0x3758('0x1'));var BPromise=require(_0x3758('0x2'));var rs=require(_0x3758('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3758('0x4'))['db'];var utils=require(_0x3758('0x5'));var logger=require(_0x3758('0x6'))(_0x3758('0x7'));var config=require(_0x3758('0x8'));var jayson=require(_0x3758('0x9'));var client=jayson[_0x3758('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3758('0xb')](config[_0x3758('0xc')],{'host':_0x3758('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3758('0xe'))[_0x3758('0xf')](socket);function respondWithRpcPromise(_0x19f96a,_0xcbb5f7,_0x2f375b){return new BPromise(function(_0x2ae1ef,_0x41090b){return client[_0x3758('0x10')](_0x19f96a,_0x2f375b)[_0x3758('0x11')](function(_0x2901ca){logger[_0x3758('0x12')](_0x3758('0x13'),_0xcbb5f7,_0x3758('0x14'));logger[_0x3758('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xcbb5f7,'request\x20sent',JSON[_0x3758('0x16')](_0x2901ca));if(_0x2901ca[_0x3758('0x17')]){if(_0x2901ca[_0x3758('0x17')][_0x3758('0x18')]===0x1f4){logger[_0x3758('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0xcbb5f7,_0x2901ca['error']['message']);return _0x41090b(_0x2901ca[_0x3758('0x17')][_0x3758('0x19')]);}logger['error'](_0x3758('0x13'),_0xcbb5f7,_0x2901ca[_0x3758('0x17')][_0x3758('0x19')]);return _0x2ae1ef(_0x2901ca[_0x3758('0x17')][_0x3758('0x19')]);}else{logger[_0x3758('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0xcbb5f7,_0x3758('0x14'));_0x2ae1ef(_0x2901ca[_0x3758('0x1a')]['message']);}})[_0x3758('0x1b')](function(_0x1bf820){logger[_0x3758('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0xcbb5f7,_0x1bf820);_0x41090b(_0x1bf820);});});}exports['GetOpenchannelQueue']=function(_0x593d18){var _0x546deb=this;return new Promise(function(_0x571c18,_0x3c0168){return db[_0x3758('0x1c')][_0x3758('0x1d')]({'raw':_0x593d18['options']?_0x593d18['options'][_0x3758('0x1e')]===undefined?!![]:![]:!![],'where':_0x593d18[_0x3758('0x1f')]?_0x593d18[_0x3758('0x1f')][_0x3758('0x20')]||null:null,'attributes':_0x593d18[_0x3758('0x1f')]?_0x593d18[_0x3758('0x1f')][_0x3758('0x21')]||null:null,'limit':_0x593d18['options']?_0x593d18['options']['limit']||null:null,'include':_0x593d18[_0x3758('0x1f')]?_0x593d18[_0x3758('0x1f')][_0x3758('0x22')]?_['map'](_0x593d18[_0x3758('0x1f')][_0x3758('0x22')],function(_0xc167fb){return{'model':db[_0xc167fb[_0x3758('0x23')]],'as':_0xc167fb['as'],'attributes':_0xc167fb['attributes'],'include':_0xc167fb[_0x3758('0x22')]?_[_0x3758('0x24')](_0xc167fb['include'],function(_0x5ce6a7){return{'model':db[_0x5ce6a7['model']],'as':_0x5ce6a7['as'],'attributes':_0x5ce6a7['attributes'],'include':_0x5ce6a7[_0x3758('0x22')]?_[_0x3758('0x24')](_0x5ce6a7[_0x3758('0x22')],function(_0x57e477){return{'model':db[_0x57e477[_0x3758('0x23')]],'as':_0x57e477['as'],'attributes':_0x57e477[_0x3758('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1876b5){logger['info'](_0x3758('0x25'),_0x593d18);logger[_0x3758('0x15')](_0x3758('0x25'),_0x593d18,JSON[_0x3758('0x16')](_0x1876b5));_0x571c18(_0x1876b5);})[_0x3758('0x1b')](function(_0x23b9d1){logger['error'](_0x3758('0x25'),_0x23b9d1[_0x3758('0x19')],_0x593d18);_0x3c0168(_0x546deb[_0x3758('0x17')](0x1f4,_0x23b9d1[_0x3758('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x4d8632){var _0x1e7241=this;return new Promise(function(_0x1ed4da,_0x4004bf){return db[_0x3758('0x1c')][_0x3758('0x26')]({'raw':_0x4d8632[_0x3758('0x1f')]?_0x4d8632[_0x3758('0x1f')][_0x3758('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d8632[_0x3758('0x1f')]?_0x4d8632['options'][_0x3758('0x20')]||null:null,'attributes':_0x4d8632[_0x3758('0x1f')]?_0x4d8632[_0x3758('0x1f')][_0x3758('0x21')]||null:null,'include':_0x4d8632['options']?_0x4d8632[_0x3758('0x1f')]['include']?_['map'](_0x4d8632[_0x3758('0x1f')][_0x3758('0x22')],function(_0x3ccbdc){return{'model':db[_0x3ccbdc[_0x3758('0x23')]],'as':_0x3ccbdc['as'],'attributes':_0x3ccbdc[_0x3758('0x21')],'include':_0x3ccbdc[_0x3758('0x22')]?_[_0x3758('0x24')](_0x3ccbdc[_0x3758('0x22')],function(_0x26d5b6){return{'model':db[_0x26d5b6[_0x3758('0x23')]],'as':_0x26d5b6['as'],'attributes':_0x26d5b6['attributes'],'include':_0x26d5b6[_0x3758('0x22')]?_[_0x3758('0x24')](_0x26d5b6[_0x3758('0x22')],function(_0x162787){return{'model':db[_0x162787[_0x3758('0x23')]],'as':_0x162787['as'],'attributes':_0x162787[_0x3758('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3758('0x11')](function(_0xd02612){logger[_0x3758('0x12')](_0x3758('0x27'),_0x4d8632);logger[_0x3758('0x15')](_0x3758('0x27'),_0x4d8632,JSON[_0x3758('0x16')](_0xd02612));_0x1ed4da(_0xd02612);})[_0x3758('0x1b')](function(_0x327c8a){logger[_0x3758('0x17')](_0x3758('0x27'),_0x327c8a['message'],_0x4d8632);_0x4004bf(_0x1e7241[_0x3758('0x17')](0x1f4,_0x327c8a[_0x3758('0x19')]));});});}; \ No newline at end of file +var _0x56b2=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','model','include','map','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56b2,0x85));var _0x256b=function(_0x60c113,_0x5d2578){_0x60c113=_0x60c113-0x0;var _0x384785=_0x56b2[_0x60c113];return _0x384785;};'use strict';var _=require(_0x256b('0x0'));var util=require(_0x256b('0x1'));var moment=require(_0x256b('0x2'));var BPromise=require(_0x256b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x256b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x256b('0x5'));var logger=require(_0x256b('0x6'))(_0x256b('0x7'));var config=require(_0x256b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x256b('0x9')][_0x256b('0xa')]({'port':0x232a});config[_0x256b('0xb')]=_[_0x256b('0xc')](config[_0x256b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x256b('0xd'))(new Redis(config[_0x256b('0xb')]));require(_0x256b('0xe'))['register'](socket);function respondWithRpcPromise(_0x788058,_0x129e55,_0x5dada1){return new BPromise(function(_0x191446,_0x3d847a){return client[_0x256b('0xf')](_0x788058,_0x5dada1)[_0x256b('0x10')](function(_0x1d84b9){logger[_0x256b('0x11')](_0x256b('0x12'),_0x129e55,_0x256b('0x13'));logger[_0x256b('0x14')](_0x256b('0x15'),_0x129e55,'request\x20sent',JSON[_0x256b('0x16')](_0x1d84b9));if(_0x1d84b9['error']){if(_0x1d84b9[_0x256b('0x17')]['code']===0x1f4){logger[_0x256b('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x129e55,_0x1d84b9[_0x256b('0x17')]['message']);return _0x3d847a(_0x1d84b9['error']['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x129e55,_0x1d84b9[_0x256b('0x17')][_0x256b('0x18')]);return _0x191446(_0x1d84b9[_0x256b('0x17')][_0x256b('0x18')]);}else{logger[_0x256b('0x11')](_0x256b('0x12'),_0x129e55,'request\x20sent');_0x191446(_0x1d84b9['result'][_0x256b('0x18')]);}})['catch'](function(_0x428fd1){logger['error'](_0x256b('0x12'),_0x129e55,_0x428fd1);_0x3d847a(_0x428fd1);});});}exports[_0x256b('0x19')]=function(_0x478df5){var _0x2e567e=this;return new Promise(function(_0x1e85d9,_0x1e1221){return db[_0x256b('0x1a')]['findAll']({'raw':_0x478df5['options']?_0x478df5[_0x256b('0x1b')][_0x256b('0x1c')]===undefined?!![]:![]:!![],'where':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')][_0x256b('0x1d')]||null:null,'attributes':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')][_0x256b('0x1e')]||null:null,'limit':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')][_0x256b('0x1f')]||null:null,'include':_0x478df5[_0x256b('0x1b')]?_0x478df5[_0x256b('0x1b')]['include']?_['map'](_0x478df5[_0x256b('0x1b')]['include'],function(_0x3498be){return{'model':db[_0x3498be[_0x256b('0x20')]],'as':_0x3498be['as'],'attributes':_0x3498be[_0x256b('0x1e')],'include':_0x3498be[_0x256b('0x21')]?_[_0x256b('0x22')](_0x3498be[_0x256b('0x21')],function(_0x13cb70){return{'model':db[_0x13cb70['model']],'as':_0x13cb70['as'],'attributes':_0x13cb70[_0x256b('0x1e')],'include':_0x13cb70[_0x256b('0x21')]?_[_0x256b('0x22')](_0x13cb70[_0x256b('0x21')],function(_0xaa913e){return{'model':db[_0xaa913e[_0x256b('0x20')]],'as':_0xaa913e['as'],'attributes':_0xaa913e[_0x256b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x256b('0x10')](function(_0x2dd761){logger[_0x256b('0x11')](_0x256b('0x19'),_0x478df5);logger['debug'](_0x256b('0x19'),_0x478df5,JSON[_0x256b('0x16')](_0x2dd761));_0x1e85d9(_0x2dd761);})[_0x256b('0x23')](function(_0xa3e4ee){logger[_0x256b('0x17')](_0x256b('0x19'),_0xa3e4ee['message'],_0x478df5);_0x1e1221(_0x2e567e['error'](0x1f4,_0xa3e4ee[_0x256b('0x18')]));});});};exports[_0x256b('0x24')]=function(_0x3f5359){var _0x288675=this;return new Promise(function(_0x7241fb,_0x27305a){return db[_0x256b('0x1a')][_0x256b('0x25')]({'raw':_0x3f5359[_0x256b('0x1b')]?_0x3f5359[_0x256b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f5359[_0x256b('0x1b')]?_0x3f5359[_0x256b('0x1b')][_0x256b('0x1d')]||null:null,'attributes':_0x3f5359[_0x256b('0x1b')]?_0x3f5359['options'][_0x256b('0x1e')]||null:null,'include':_0x3f5359['options']?_0x3f5359[_0x256b('0x1b')][_0x256b('0x21')]?_[_0x256b('0x22')](_0x3f5359[_0x256b('0x1b')]['include'],function(_0x360811){return{'model':db[_0x360811[_0x256b('0x20')]],'as':_0x360811['as'],'attributes':_0x360811[_0x256b('0x1e')],'include':_0x360811[_0x256b('0x21')]?_[_0x256b('0x22')](_0x360811['include'],function(_0x4b5a56){return{'model':db[_0x4b5a56[_0x256b('0x20')]],'as':_0x4b5a56['as'],'attributes':_0x4b5a56[_0x256b('0x1e')],'include':_0x4b5a56[_0x256b('0x21')]?_['map'](_0x4b5a56[_0x256b('0x21')],function(_0x3a7ffa){return{'model':db[_0x3a7ffa[_0x256b('0x20')]],'as':_0x3a7ffa['as'],'attributes':_0x3a7ffa[_0x256b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x256b('0x10')](function(_0x3f4be4){logger['info'](_0x256b('0x24'),_0x3f5359);logger[_0x256b('0x14')](_0x256b('0x24'),_0x3f5359,JSON['stringify'](_0x3f4be4));_0x7241fb(_0x3f4be4);})[_0x256b('0x23')](function(_0x50cc34){logger[_0x256b('0x17')]('ShowOpenchannelQueue',_0x50cc34[_0x256b('0x18')],_0x3f5359);_0x27305a(_0x288675[_0x256b('0x17')](0x1f4,_0x50cc34[_0x256b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 7e8c10a..8aea31c 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 _0x39ba=['./openchannelQueue.events','save','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39ba,0xf0));var _0xa39b=function(_0xffa992,_0x44251a){_0xffa992=_0xffa992-0x0;var _0x402b95=_0x39ba[_0xffa992];return _0x402b95;};'use strict';var OpenchannelQueueEvents=require(_0xa39b('0x0'));var events=[_0xa39b('0x1'),'remove',_0xa39b('0x2')];function createListener(_0x400b61,_0x115906){return function(_0x475bb3){_0x115906[_0xa39b('0x3')](_0x400b61,_0x475bb3);};}function removeListener(_0x913c6d,_0x4e6aec){return function(){OpenchannelQueueEvents[_0xa39b('0x4')](_0x913c6d,_0x4e6aec);};}exports[_0xa39b('0x5')]=function(_0x90a9ba){for(var _0x356709=0x0,_0x404871=events[_0xa39b('0x6')];_0x356709<_0x404871;_0x356709++){var _0x146cb2=events[_0x356709];var _0x17ac64=createListener(_0xa39b('0x7')+_0x146cb2,_0x90a9ba);OpenchannelQueueEvents['on'](_0x146cb2,_0x17ac64);}}; \ No newline at end of file +var _0xa401=['emit','removeListener','length','openchannelQueue:','remove'];(function(_0x29524c,_0x5a0936){var _0xa1f54c=function(_0x1177d9){while(--_0x1177d9){_0x29524c['push'](_0x29524c['shift']());}};_0xa1f54c(++_0x5a0936);}(_0xa401,0x17b));var _0x1a40=function(_0x217d38,_0x5e416a){_0x217d38=_0x217d38-0x0;var _0x5c6140=_0xa401[_0x217d38];return _0x5c6140;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x1a40('0x0'),'update'];function createListener(_0x2f849a,_0x5788f5){return function(_0x27044b){_0x5788f5[_0x1a40('0x1')](_0x2f849a,_0x27044b);};}function removeListener(_0xa12013,_0x196e8e){return function(){OpenchannelQueueEvents[_0x1a40('0x2')](_0xa12013,_0x196e8e);};}exports['register']=function(_0x5515d5){for(var _0x3e5202=0x0,_0x4d94b3=events[_0x1a40('0x3')];_0x3e5202<_0x4d94b3;_0x3e5202++){var _0x41623e=events[_0x3e5202];var _0x540a5e=createListener(_0x1a40('0x4')+_0x41623e,_0x5515d5);OpenchannelQueueEvents['on'](_0x41623e,_0x540a5e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8df2348..3938a2a 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 _0x6175=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','destroy'];(function(_0x2c8d36,_0x5dbd10){var _0x2e8253=function(_0x1e5994){while(--_0x1e5994){_0x2c8d36['push'](_0x2c8d36['shift']());}};_0x2e8253(++_0x5dbd10);}(_0x6175,0x7f));var _0x5617=function(_0x23d1d8,_0x408735){_0x23d1d8=_0x23d1d8-0x0;var _0x322b62=_0x6175[_0x23d1d8];return _0x322b62;};'use strict';var multer=require(_0x5617('0x0'));var util=require(_0x5617('0x1'));var path=require(_0x5617('0x2'));var timeout=require(_0x5617('0x3'));var express=require(_0x5617('0x4'));var router=express[_0x5617('0x5')]();var auth=require(_0x5617('0x6'));var interaction=require(_0x5617('0x7'));var config=require(_0x5617('0x8'));var controller=require(_0x5617('0x9'));router[_0x5617('0xa')]('/',auth[_0x5617('0xb')](),controller[_0x5617('0xc')]);router['get'](_0x5617('0xd'),auth['isAuthenticated'](),controller[_0x5617('0xe')]);router[_0x5617('0xa')](_0x5617('0xf'),auth[_0x5617('0xb')](),controller[_0x5617('0x10')]);router[_0x5617('0x11')]('/',auth[_0x5617('0xb')](),controller['create']);router['put'](_0x5617('0xf'),auth[_0x5617('0xb')](),controller[_0x5617('0x12')]);router['delete'](_0x5617('0xf'),auth[_0x5617('0xb')](),controller[_0x5617('0x13')]);module[_0x5617('0x14')]=router; \ No newline at end of file +var _0x9be1=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x9be1,0x128));var _0x19be=function(_0x3b08e2,_0x55204d){_0x3b08e2=_0x3b08e2-0x0;var _0x437253=_0x9be1[_0x3b08e2];return _0x437253;};'use strict';var multer=require(_0x19be('0x0'));var util=require(_0x19be('0x1'));var path=require(_0x19be('0x2'));var timeout=require(_0x19be('0x3'));var express=require(_0x19be('0x4'));var router=express[_0x19be('0x5')]();var auth=require(_0x19be('0x6'));var interaction=require(_0x19be('0x7'));var config=require(_0x19be('0x8'));var controller=require(_0x19be('0x9'));router[_0x19be('0xa')]('/',auth[_0x19be('0xb')](),controller['index']);router[_0x19be('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x19be('0xc')]);router[_0x19be('0xa')](_0x19be('0xd'),auth[_0x19be('0xb')](),controller[_0x19be('0xe')]);router['post']('/',auth[_0x19be('0xb')](),controller['create']);router[_0x19be('0xf')](_0x19be('0xd'),auth[_0x19be('0xb')](),controller[_0x19be('0x10')]);router[_0x19be('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x19be('0x12')]);module[_0x19be('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index e5c8557..1280088 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 _0xb212=['moment','sequelize','exports','STRING','DATE'];(function(_0x512d4f,_0xb1b718){var _0x2dc3a0=function(_0xc1b01b){while(--_0xc1b01b){_0x512d4f['push'](_0x512d4f['shift']());}};_0x2dc3a0(++_0xb1b718);}(_0xb212,0x1f4));var _0x2b21=function(_0x244aba,_0x46e3cd){_0x244aba=_0x244aba-0x0;var _0x22ed31=_0xb212[_0x244aba];return _0x22ed31;};'use strict';var moment=require(_0x2b21('0x0'));var Sequelize=require(_0x2b21('0x1'));module[_0x2b21('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2b21('0x3')]},'joinAt':{'type':Sequelize[_0x2b21('0x4')]},'leaveAt':{'type':Sequelize[_0x2b21('0x4')]},'acceptAt':{'type':Sequelize[_0x2b21('0x4')]},'exitAt':{'type':Sequelize[_0x2b21('0x4')]},'reason':{'type':Sequelize[_0x2b21('0x3')]}}; \ No newline at end of file +var _0x2f9d=['moment','sequelize','STRING','DATE'];(function(_0x29ed9b,_0x3787b5){var _0x3cd011=function(_0x3ee66c){while(--_0x3ee66c){_0x29ed9b['push'](_0x29ed9b['shift']());}};_0x3cd011(++_0x3787b5);}(_0x2f9d,0x1e4));var _0xd2f9=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2f9d[_0xd1d19a];return _0x52a79d;};'use strict';var moment=require(_0xd2f9('0x0'));var Sequelize=require(_0xd2f9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd2f9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd2f9('0x2')]},'joinAt':{'type':Sequelize[_0xd2f9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd2f9('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 00e95c6..8e58a1d 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 _0x4711=['reject','save','update','then','destroy','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0xc12b91,_0x546f13){var _0x36d5a0=function(_0x13387f){while(--_0x13387f){_0xc12b91['push'](_0xc12b91['shift']());}};_0x36d5a0(++_0x546f13);}(_0x4711,0x10c));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1471('0x0'));var emlformat=require(_0x1471('0x1'));var rimraf=require(_0x1471('0x2'));var zipdir=require(_0x1471('0x3'));var jsonpatch=require(_0x1471('0x4'));var rp=require(_0x1471('0x5'));var moment=require(_0x1471('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1471('0x7'));var util=require('util');var path=require(_0x1471('0x8'));var sox=require(_0x1471('0x9'));var csv=require(_0x1471('0xa'));var ejs=require(_0x1471('0xb'));var fs=require('fs');var _=require(_0x1471('0xc'));var squel=require('squel');var crypto=require(_0x1471('0xd'));var jsforce=require(_0x1471('0xe'));var deskjs=require(_0x1471('0xf'));var toCsv=require(_0x1471('0xa'));var querystring=require(_0x1471('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1471('0x11'));var qs=require(_0x1471('0x12'));var as=require(_0x1471('0x13'));var hardwareService=require(_0x1471('0x14'));var logger=require(_0x1471('0x15'))(_0x1471('0x16'));var utils=require(_0x1471('0x17'));var config=require(_0x1471('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1471('0x19'))['db'];function respondWithStatusCode(_0x1e3bb1,_0x23039b){_0x23039b=_0x23039b||0xcc;return function(_0x9f7985){if(_0x9f7985){return _0x1e3bb1[_0x1471('0x1a')](_0x23039b);}return _0x1e3bb1['status'](_0x23039b)[_0x1471('0x1b')]();};}function respondWithResult(_0x1d5167,_0x16a3f7){_0x16a3f7=_0x16a3f7||0xc8;return function(_0x4daf51){if(_0x4daf51){return _0x1d5167[_0x1471('0x1c')](_0x16a3f7)[_0x1471('0x1d')](_0x4daf51);}};}function respondWithFilteredResult(_0x16c18e,_0x3f124e){return function(_0x3c1132){if(_0x3c1132){var _0x254f2c=_0x3c1132[_0x1471('0x1e')],_0x33a6fc=_0x3f124e[_0x1471('0x1f')],_0x594cf2=_0x3f124e['offset']+_0x3f124e[_0x1471('0x20')],_0x11ea35;if(_0x594cf2>=_0x254f2c){_0x594cf2=_0x254f2c;_0x11ea35=0xc8;}else{_0x11ea35=0xce;}_0x16c18e[_0x1471('0x1c')](_0x11ea35);return _0x16c18e[_0x1471('0x21')](_0x1471('0x22'),_0x33a6fc+'-'+_0x594cf2+'/'+_0x254f2c)[_0x1471('0x1d')](_0x3c1132);}return null;};}function patchUpdates(_0x41c8c2){return function(_0x148c5a){try{jsonpatch[_0x1471('0x23')](_0x148c5a,_0x41c8c2,!![]);}catch(_0x4e57df){return BPromise[_0x1471('0x24')](_0x4e57df);}return _0x148c5a[_0x1471('0x25')]();};}function saveUpdates(_0xdebb7c,_0x90f430){return function(_0x1f1f65){if(_0x1f1f65){return _0x1f1f65[_0x1471('0x26')](_0xdebb7c)[_0x1471('0x27')](function(_0x2a14db){return _0x2a14db;});}return null;};}function removeEntity(_0x2b322f,_0x2e7399){return function(_0x2e7f45){if(_0x2e7f45){return _0x2e7f45[_0x1471('0x28')]()[_0x1471('0x27')](function(){_0x2b322f[_0x1471('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e68b0,_0x3a04cf){return function(_0x53d84f){if(!_0x53d84f){_0x2e68b0[_0x1471('0x1a')](0x194);}return _0x53d84f;};}function handleError(_0x1f6acb,_0x45e3df){_0x45e3df=_0x45e3df||0x1f4;return function(_0x27cc4a){logger['error'](_0x27cc4a['stack']);if(_0x27cc4a[_0x1471('0x29')]){delete _0x27cc4a[_0x1471('0x29')];}_0x1f6acb[_0x1471('0x1c')](_0x45e3df)[_0x1471('0x2a')](_0x27cc4a);};}exports[_0x1471('0x2b')]=function(_0x33394e,_0x52bb10){var _0x44b7a1={},_0x5158b2={},_0x2da177={'count':0x0,'rows':[]};var _0x2b90f8=_[_0x1471('0x2c')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x2ebcf0){return{'name':_0x2ebcf0['fieldName'],'type':_0x2ebcf0['type'][_0x1471('0x2d')]};});_0x5158b2[_0x1471('0x2e')]=_[_0x1471('0x2c')](_0x2b90f8,_0x1471('0x29'));_0x5158b2[_0x1471('0x2f')]=_[_0x1471('0x30')](_0x33394e['query']);_0x5158b2[_0x1471('0x31')]=_[_0x1471('0x32')](_0x5158b2[_0x1471('0x2e')],_0x5158b2[_0x1471('0x2f')]);_0x44b7a1[_0x1471('0x33')]=_[_0x1471('0x32')](_0x5158b2['model'],qs[_0x1471('0x34')](_0x33394e[_0x1471('0x2f')][_0x1471('0x34')]));_0x44b7a1[_0x1471('0x33')]=_0x44b7a1[_0x1471('0x33')]['length']?_0x44b7a1[_0x1471('0x33')]:_0x5158b2[_0x1471('0x2e')];if(!_0x33394e['query'][_0x1471('0x35')](_0x1471('0x36'))){_0x44b7a1[_0x1471('0x20')]=qs[_0x1471('0x20')](_0x33394e[_0x1471('0x2f')][_0x1471('0x20')]);_0x44b7a1[_0x1471('0x1f')]=qs['offset'](_0x33394e[_0x1471('0x2f')][_0x1471('0x1f')]);}_0x44b7a1['order']=qs[_0x1471('0x37')](_0x33394e['query'][_0x1471('0x37')]);_0x44b7a1[_0x1471('0x38')]=qs[_0x1471('0x31')](_[_0x1471('0x39')](_0x33394e['query'],_0x5158b2[_0x1471('0x31')]),_0x2b90f8);if(_0x33394e['query'][_0x1471('0x3a')]){_0x44b7a1['where']=_[_0x1471('0x3b')](_0x44b7a1['where'],{'$or':_[_0x1471('0x2c')](_0x2b90f8,function(_0x3835db){if(_0x3835db[_0x1471('0x3c')]!==_0x1471('0x3d')){var _0x50eaa1={};_0x50eaa1[_0x3835db['name']]={'$like':'%'+_0x33394e[_0x1471('0x2f')][_0x1471('0x3a')]+'%'};return _0x50eaa1;}})});}_0x44b7a1=_[_0x1471('0x3b')]({},_0x44b7a1,_0x33394e[_0x1471('0x3e')]);var _0x78d154={'where':_0x44b7a1['where']};return db[_0x1471('0x3f')][_0x1471('0x1e')](_0x78d154)[_0x1471('0x27')](function(_0x1a2aca){_0x2da177['count']=_0x1a2aca;if(_0x33394e[_0x1471('0x2f')][_0x1471('0x40')]){_0x44b7a1[_0x1471('0x41')]=[{'all':!![]}];}return db[_0x1471('0x3f')]['findAll'](_0x44b7a1);})['then'](function(_0xc69e37){_0x2da177[_0x1471('0x42')]=_0xc69e37;return _0x2da177;})[_0x1471('0x27')](respondWithFilteredResult(_0x52bb10,_0x44b7a1))['catch'](handleError(_0x52bb10,null));};exports[_0x1471('0x43')]=function(_0x2809ea,_0x46a748){var _0x473e22={'raw':!![],'where':{'id':_0x2809ea[_0x1471('0x44')]['id']}},_0x5b57b3={};_0x5b57b3['model']=_[_0x1471('0x30')](db[_0x1471('0x3f')][_0x1471('0x45')]);_0x5b57b3[_0x1471('0x2f')]=_[_0x1471('0x30')](_0x2809ea[_0x1471('0x2f')]);_0x5b57b3[_0x1471('0x31')]=_['intersection'](_0x5b57b3['model'],_0x5b57b3['query']);_0x473e22['attributes']=_[_0x1471('0x32')](_0x5b57b3['model'],qs[_0x1471('0x34')](_0x2809ea['query'][_0x1471('0x34')]));_0x473e22[_0x1471('0x33')]=_0x473e22['attributes'][_0x1471('0x46')]?_0x473e22[_0x1471('0x33')]:_0x5b57b3[_0x1471('0x2e')];if(_0x2809ea[_0x1471('0x2f')][_0x1471('0x40')]){_0x473e22[_0x1471('0x41')]=[{'all':!![]}];}_0x473e22=_[_0x1471('0x3b')]({},_0x473e22,_0x2809ea[_0x1471('0x3e')]);return db['OpenchannelQueueReport']['find'](_0x473e22)[_0x1471('0x27')](handleEntityNotFound(_0x46a748,null))[_0x1471('0x27')](respondWithResult(_0x46a748,null))[_0x1471('0x47')](handleError(_0x46a748,null));};exports[_0x1471('0x48')]=function(_0x20ceaf,_0x202eaf){return db[_0x1471('0x3f')][_0x1471('0x48')](_0x20ceaf[_0x1471('0x49')],{})[_0x1471('0x27')](respondWithResult(_0x202eaf,0xc9))[_0x1471('0x47')](handleError(_0x202eaf,null));};exports[_0x1471('0x26')]=function(_0x33b938,_0x30d61b){if(_0x33b938[_0x1471('0x49')]['id']){delete _0x33b938[_0x1471('0x49')]['id'];}return db['OpenchannelQueueReport'][_0x1471('0x4a')]({'where':{'id':_0x33b938[_0x1471('0x44')]['id']}})[_0x1471('0x27')](handleEntityNotFound(_0x30d61b,null))[_0x1471('0x27')](saveUpdates(_0x33b938[_0x1471('0x49')],null))['then'](respondWithResult(_0x30d61b,null))[_0x1471('0x47')](handleError(_0x30d61b,null));};exports[_0x1471('0x28')]=function(_0x20de1d,_0x8f9554){return db[_0x1471('0x3f')]['find']({'where':{'id':_0x20de1d[_0x1471('0x44')]['id']}})[_0x1471('0x27')](handleEntityNotFound(_0x8f9554,null))[_0x1471('0x27')](removeEntity(_0x8f9554,null))['catch'](handleError(_0x8f9554,null));};exports[_0x1471('0x4b')]=function(_0x41a985,_0x5165af){return db[_0x1471('0x3f')][_0x1471('0x4b')]()[_0x1471('0x27')](respondWithResult(_0x5165af,null))[_0x1471('0x47')](handleError(_0x5165af,null));}; \ No newline at end of file +var _0x177a=['catch','create','body','destroy','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find'];(function(_0x5d6af2,_0x359d90){var _0x23d91c=function(_0x424f1a){while(--_0x424f1a){_0x5d6af2['push'](_0x5d6af2['shift']());}};_0x23d91c(++_0x359d90);}(_0x177a,0xdd));var _0xa177=function(_0x5b5390,_0x28fe85){_0x5b5390=_0x5b5390-0x0;var _0xac323b=_0x177a[_0x5b5390];return _0xac323b;};'use strict';var pdf=require(_0xa177('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa177('0x1'));var jsonpatch=require(_0xa177('0x2'));var rp=require(_0xa177('0x3'));var moment=require(_0xa177('0x4'));var BPromise=require(_0xa177('0x5'));var Mustache=require(_0xa177('0x6'));var util=require('util');var path=require(_0xa177('0x7'));var sox=require(_0xa177('0x8'));var csv=require(_0xa177('0x9'));var ejs=require(_0xa177('0xa'));var fs=require('fs');var _=require(_0xa177('0xb'));var squel=require(_0xa177('0xc'));var crypto=require(_0xa177('0xd'));var jsforce=require(_0xa177('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa177('0x9'));var querystring=require('querystring');var Papa=require(_0xa177('0xf'));var Redis=require(_0xa177('0x10'));var authService=require(_0xa177('0x11'));var qs=require(_0xa177('0x12'));var as=require(_0xa177('0x13'));var hardwareService=require(_0xa177('0x14'));var logger=require(_0xa177('0x15'))('api');var utils=require(_0xa177('0x16'));var config=require(_0xa177('0x17'));var licenseUtil=require(_0xa177('0x18'));var db=require(_0xa177('0x19'))['db'];function respondWithStatusCode(_0x411274,_0x34baf1){_0x34baf1=_0x34baf1||0xcc;return function(_0x26c738){if(_0x26c738){return _0x411274['sendStatus'](_0x34baf1);}return _0x411274['status'](_0x34baf1)[_0xa177('0x1a')]();};}function respondWithResult(_0x198a92,_0x39d274){_0x39d274=_0x39d274||0xc8;return function(_0x179f42){if(_0x179f42){return _0x198a92[_0xa177('0x1b')](_0x39d274)[_0xa177('0x1c')](_0x179f42);}};}function respondWithFilteredResult(_0x258985,_0xbc9fa4){return function(_0x278633){if(_0x278633){var _0x3c1443=_0x278633[_0xa177('0x1d')],_0x26be7a=_0xbc9fa4[_0xa177('0x1e')],_0x24a35e=_0xbc9fa4['offset']+_0xbc9fa4[_0xa177('0x1f')],_0x5445da;if(_0x24a35e>=_0x3c1443){_0x24a35e=_0x3c1443;_0x5445da=0xc8;}else{_0x5445da=0xce;}_0x258985[_0xa177('0x1b')](_0x5445da);return _0x258985[_0xa177('0x20')](_0xa177('0x21'),_0x26be7a+'-'+_0x24a35e+'/'+_0x3c1443)['json'](_0x278633);}return null;};}function patchUpdates(_0x56816d){return function(_0x516acf){try{jsonpatch[_0xa177('0x22')](_0x516acf,_0x56816d,!![]);}catch(_0x2bc02d){return BPromise[_0xa177('0x23')](_0x2bc02d);}return _0x516acf[_0xa177('0x24')]();};}function saveUpdates(_0x50a957,_0x324bda){return function(_0x5ec792){if(_0x5ec792){return _0x5ec792[_0xa177('0x25')](_0x50a957)['then'](function(_0x401481){return _0x401481;});}return null;};}function removeEntity(_0x184178,_0x369942){return function(_0x279632){if(_0x279632){return _0x279632['destroy']()[_0xa177('0x26')](function(){_0x184178[_0xa177('0x1b')](0xcc)[_0xa177('0x1a')]();});}};}function handleEntityNotFound(_0x4bc686,_0x5d5118){return function(_0x4e0159){if(!_0x4e0159){_0x4bc686['sendStatus'](0x194);}return _0x4e0159;};}function handleError(_0x440d3d,_0x382a61){_0x382a61=_0x382a61||0x1f4;return function(_0x1cf775){logger[_0xa177('0x27')](_0x1cf775[_0xa177('0x28')]);if(_0x1cf775['name']){delete _0x1cf775[_0xa177('0x29')];}_0x440d3d[_0xa177('0x1b')](_0x382a61)['send'](_0x1cf775);};}exports['index']=function(_0x182160,_0x5b42a1){var _0x55f460={},_0x59d40d={},_0x45c513={'count':0x0,'rows':[]};var _0x4c8a61=_[_0xa177('0x2a')](db[_0xa177('0x2b')][_0xa177('0x2c')],function(_0x5f20d4){return{'name':_0x5f20d4[_0xa177('0x2d')],'type':_0x5f20d4[_0xa177('0x2e')]['key']};});_0x59d40d[_0xa177('0x2f')]=_[_0xa177('0x2a')](_0x4c8a61,_0xa177('0x29'));_0x59d40d[_0xa177('0x30')]=_[_0xa177('0x31')](_0x182160[_0xa177('0x30')]);_0x59d40d[_0xa177('0x32')]=_[_0xa177('0x33')](_0x59d40d['model'],_0x59d40d[_0xa177('0x30')]);_0x55f460[_0xa177('0x34')]=_['intersection'](_0x59d40d[_0xa177('0x2f')],qs[_0xa177('0x35')](_0x182160['query'][_0xa177('0x35')]));_0x55f460[_0xa177('0x34')]=_0x55f460['attributes'][_0xa177('0x36')]?_0x55f460[_0xa177('0x34')]:_0x59d40d[_0xa177('0x2f')];if(!_0x182160['query']['hasOwnProperty']('nolimit')){_0x55f460['limit']=qs['limit'](_0x182160[_0xa177('0x30')][_0xa177('0x1f')]);_0x55f460[_0xa177('0x1e')]=qs[_0xa177('0x1e')](_0x182160[_0xa177('0x30')][_0xa177('0x1e')]);}_0x55f460['order']=qs[_0xa177('0x37')](_0x182160[_0xa177('0x30')][_0xa177('0x37')]);_0x55f460[_0xa177('0x38')]=qs[_0xa177('0x32')](_[_0xa177('0x39')](_0x182160[_0xa177('0x30')],_0x59d40d[_0xa177('0x32')]),_0x4c8a61);if(_0x182160['query'][_0xa177('0x3a')]){_0x55f460[_0xa177('0x38')]=_['merge'](_0x55f460[_0xa177('0x38')],{'$or':_['map'](_0x4c8a61,function(_0x319c9c){if(_0x319c9c[_0xa177('0x2e')]!=='VIRTUAL'){var _0x129aed={};_0x129aed[_0x319c9c[_0xa177('0x29')]]={'$like':'%'+_0x182160[_0xa177('0x30')][_0xa177('0x3a')]+'%'};return _0x129aed;}})});}_0x55f460=_[_0xa177('0x3b')]({},_0x55f460,_0x182160[_0xa177('0x3c')]);var _0x4e6297={'where':_0x55f460[_0xa177('0x38')]};return db[_0xa177('0x2b')][_0xa177('0x1d')](_0x4e6297)[_0xa177('0x26')](function(_0x235241){_0x45c513['count']=_0x235241;if(_0x182160['query'][_0xa177('0x3d')]){_0x55f460[_0xa177('0x3e')]=[{'all':!![]}];}return db[_0xa177('0x2b')][_0xa177('0x3f')](_0x55f460);})[_0xa177('0x26')](function(_0x32f300){_0x45c513[_0xa177('0x40')]=_0x32f300;return _0x45c513;})[_0xa177('0x26')](respondWithFilteredResult(_0x5b42a1,_0x55f460))['catch'](handleError(_0x5b42a1,null));};exports['show']=function(_0x44774e,_0x3de295){var _0x36b5b8={'raw':!![],'where':{'id':_0x44774e[_0xa177('0x41')]['id']}},_0x374571={};_0x374571[_0xa177('0x2f')]=_[_0xa177('0x31')](db['OpenchannelQueueReport'][_0xa177('0x2c')]);_0x374571['query']=_[_0xa177('0x31')](_0x44774e[_0xa177('0x30')]);_0x374571[_0xa177('0x32')]=_[_0xa177('0x33')](_0x374571[_0xa177('0x2f')],_0x374571[_0xa177('0x30')]);_0x36b5b8['attributes']=_[_0xa177('0x33')](_0x374571[_0xa177('0x2f')],qs[_0xa177('0x35')](_0x44774e[_0xa177('0x30')][_0xa177('0x35')]));_0x36b5b8[_0xa177('0x34')]=_0x36b5b8['attributes'][_0xa177('0x36')]?_0x36b5b8[_0xa177('0x34')]:_0x374571[_0xa177('0x2f')];if(_0x44774e[_0xa177('0x30')][_0xa177('0x3d')]){_0x36b5b8[_0xa177('0x3e')]=[{'all':!![]}];}_0x36b5b8=_['merge']({},_0x36b5b8,_0x44774e[_0xa177('0x3c')]);return db[_0xa177('0x2b')][_0xa177('0x42')](_0x36b5b8)[_0xa177('0x26')](handleEntityNotFound(_0x3de295,null))[_0xa177('0x26')](respondWithResult(_0x3de295,null))[_0xa177('0x43')](handleError(_0x3de295,null));};exports[_0xa177('0x44')]=function(_0x280d40,_0x26d84b){return db[_0xa177('0x2b')][_0xa177('0x44')](_0x280d40[_0xa177('0x45')],{})[_0xa177('0x26')](respondWithResult(_0x26d84b,0xc9))[_0xa177('0x43')](handleError(_0x26d84b,null));};exports[_0xa177('0x25')]=function(_0x14a2c6,_0x5f2ebd){if(_0x14a2c6[_0xa177('0x45')]['id']){delete _0x14a2c6[_0xa177('0x45')]['id'];}return db[_0xa177('0x2b')][_0xa177('0x42')]({'where':{'id':_0x14a2c6[_0xa177('0x41')]['id']}})['then'](handleEntityNotFound(_0x5f2ebd,null))[_0xa177('0x26')](saveUpdates(_0x14a2c6[_0xa177('0x45')],null))['then'](respondWithResult(_0x5f2ebd,null))[_0xa177('0x43')](handleError(_0x5f2ebd,null));};exports[_0xa177('0x46')]=function(_0x230a9d,_0x32703b){return db[_0xa177('0x2b')][_0xa177('0x42')]({'where':{'id':_0x230a9d['params']['id']}})[_0xa177('0x26')](handleEntityNotFound(_0x32703b,null))[_0xa177('0x26')](removeEntity(_0x32703b,null))[_0xa177('0x43')](handleError(_0x32703b,null));};exports['describe']=function(_0x1f3977,_0xb1b274){return db[_0xa177('0x2b')][_0xa177('0x47')]()[_0xa177('0x26')](respondWithResult(_0xb1b274,null))[_0xa177('0x43')](handleError(_0xb1b274,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1f290f0..8502e20 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 _0x383a=['../../config/environment','define','util','../../config/logger','bluebird','path','rimraf'];(function(_0xc47ba8,_0x18d8e7){var _0x56d91a=function(_0x4af983){while(--_0x4af983){_0xc47ba8['push'](_0xc47ba8['shift']());}};_0x56d91a(++_0x18d8e7);}(_0x383a,0x1ad));var _0xa383=function(_0x1c688b,_0x4df102){_0x1c688b=_0x1c688b-0x0;var _0x4d4577=_0x383a[_0x1c688b];return _0x4d4577;};'use strict';var _=require('lodash');var util=require(_0xa383('0x0'));var logger=require(_0xa383('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa383('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa383('0x3'));var rimraf=require(_0xa383('0x4'));var config=require(_0xa383('0x5'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0xc72371,_0x160e4f){return _0xc72371[_0xa383('0x6')]('OpenchannelQueueReport',attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x006d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x1a9607,_0x39d774){var _0x43773c=function(_0x3e6739){while(--_0x3e6739){_0x1a9607['push'](_0x1a9607['shift']());}};_0x43773c(++_0x39d774);}(_0x006d,0xea));var _0xd006=function(_0x41e0d4,_0x40536e){_0x41e0d4=_0x41e0d4-0x0;var _0x3a2ded=_0x006d[_0x41e0d4];return _0x3a2ded;};'use strict';var _=require(_0xd006('0x0'));var util=require(_0xd006('0x1'));var logger=require(_0xd006('0x2'))(_0xd006('0x3'));var moment=require(_0xd006('0x4'));var BPromise=require(_0xd006('0x5'));var rp=require(_0xd006('0x6'));var fs=require('fs');var path=require(_0xd006('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd006('0x8'));module[_0xd006('0x9')]=function(_0x4d16cb,_0xd874b1){return _0x4d16cb['define'](_0xd006('0xa'),attributes,{'tableName':_0xd006('0xb'),'paranoid':![],'indexes':[{'name':_0xd006('0xc'),'fields':[_0xd006('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a7b3e97..a3ce014 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 _0xb64b=['info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x44cb20,_0x406f9b){var _0x3ee0d7=function(_0x59af3e){while(--_0x59af3e){_0x44cb20['push'](_0x44cb20['shift']());}};_0x3ee0d7(++_0x406f9b);}(_0xb64b,0xe7));var _0xbb64=function(_0x385358,_0x4aebf7){_0x385358=_0x385358-0x0;var _0x5bd30f=_0xb64b[_0x385358];return _0x5bd30f;};'use strict';var _=require(_0xbb64('0x0'));var util=require(_0xbb64('0x1'));var moment=require(_0xbb64('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb64('0x3'));var fs=require('fs');var Redis=require(_0xbb64('0x4'));var db=require(_0xbb64('0x5'))['db'];var utils=require(_0xbb64('0x6'));var logger=require(_0xbb64('0x7'))(_0xbb64('0x8'));var config=require(_0xbb64('0x9'));var jayson=require(_0xbb64('0xa'));var client=jayson[_0xbb64('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37b199,_0x12b3bd,_0x16352e){return new BPromise(function(_0x227eda,_0x574e0f){return client[_0xbb64('0xc')](_0x37b199,_0x16352e)[_0xbb64('0xd')](function(_0x56301f){logger[_0xbb64('0xe')](_0xbb64('0xf'),_0x12b3bd,_0xbb64('0x10'));logger[_0xbb64('0x11')](_0xbb64('0x12'),_0x12b3bd,_0xbb64('0x10'),JSON[_0xbb64('0x13')](_0x56301f));if(_0x56301f[_0xbb64('0x14')]){if(_0x56301f[_0xbb64('0x14')]['code']===0x1f4){logger['error'](_0xbb64('0xf'),_0x12b3bd,_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);return _0x574e0f(_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);}logger[_0xbb64('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12b3bd,_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);return _0x227eda(_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);}else{logger[_0xbb64('0xe')](_0xbb64('0xf'),_0x12b3bd,'request\x20sent');_0x227eda(_0x56301f[_0xbb64('0x16')][_0xbb64('0x15')]);}})[_0xbb64('0x17')](function(_0x2a43cb){logger['error'](_0xbb64('0xf'),_0x12b3bd,_0x2a43cb);_0x574e0f(_0x2a43cb);});});}exports[_0xbb64('0x18')]=function(_0x59a375){var _0x2643b9=this;return new Promise(function(_0x36e7b5,_0x41cec7){return db[_0xbb64('0x19')][_0xbb64('0x1a')](_0x59a375['body'],{'raw':_0x59a375[_0xbb64('0x1b')]?_0x59a375[_0xbb64('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xbb64('0xd')](function(_0x493ae4){logger[_0xbb64('0xe')]('CreateOpenchannelQueueReport',_0x59a375);logger[_0xbb64('0x11')](_0xbb64('0x18'),_0x59a375,JSON[_0xbb64('0x13')](_0x493ae4));_0x36e7b5(_0x493ae4);})[_0xbb64('0x17')](function(_0x3eec48){logger[_0xbb64('0x14')](_0xbb64('0x18'),_0x3eec48[_0xbb64('0x15')],_0x59a375);_0x41cec7(_0x2643b9['error'](0x1f4,_0x3eec48[_0xbb64('0x15')]));});});};exports[_0xbb64('0x1c')]=function(_0x349c20){var _0x53b8b2=this;return new Promise(function(_0x116dbb,_0xf79a98){return db['OpenchannelQueueReport'][_0xbb64('0x1d')](_0x349c20[_0xbb64('0x1e')],{'raw':_0x349c20[_0xbb64('0x1b')]?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x349c20['options']?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x20')]||null:null,'attributes':_0x349c20[_0xbb64('0x1b')]?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x21')]||null:null,'limit':_0x349c20[_0xbb64('0x1b')]?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x22')]||null:null})['then'](function(_0x53b6e1){logger['info'](_0xbb64('0x1c'),_0x349c20);logger[_0xbb64('0x11')](_0xbb64('0x1c'),_0x349c20,JSON[_0xbb64('0x13')](_0x53b6e1));_0x116dbb(_0x53b6e1);})[_0xbb64('0x17')](function(_0x385f99){logger['error'](_0xbb64('0x1c'),_0x385f99['message'],_0x349c20);_0xf79a98(_0x53b8b2[_0xbb64('0x14')](0x1f4,_0x385f99['message']));});});}; \ No newline at end of file +var _0xc0a2=['body','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc0a2,0xae));var _0x2c0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc0a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var moment=require(_0x2c0a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c0a('0x3'));var db=require(_0x2c0a('0x4'))['db'];var utils=require(_0x2c0a('0x5'));var logger=require('../../config/logger')(_0x2c0a('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c0a('0x7'));var client=jayson[_0x2c0a('0x8')][_0x2c0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37a117,_0x2d7532,_0x1e7e6f){return new BPromise(function(_0x2c8f8a,_0x2e5dab){return client[_0x2c0a('0xa')](_0x37a117,_0x1e7e6f)['then'](function(_0x531fb7){logger[_0x2c0a('0xb')](_0x2c0a('0xc'),_0x2d7532,'request\x20sent');logger[_0x2c0a('0xd')](_0x2c0a('0xe'),_0x2d7532,_0x2c0a('0xf'),JSON[_0x2c0a('0x10')](_0x531fb7));if(_0x531fb7[_0x2c0a('0x11')]){if(_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x12')]===0x1f4){logger['error'](_0x2c0a('0xc'),_0x2d7532,_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x13')]);return _0x2e5dab(_0x531fb7['error']['message']);}logger['error'](_0x2c0a('0xc'),_0x2d7532,_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x13')]);return _0x2c8f8a(_0x531fb7[_0x2c0a('0x11')][_0x2c0a('0x13')]);}else{logger[_0x2c0a('0xb')](_0x2c0a('0xc'),_0x2d7532,_0x2c0a('0xf'));_0x2c8f8a(_0x531fb7[_0x2c0a('0x14')][_0x2c0a('0x13')]);}})[_0x2c0a('0x15')](function(_0x245742){logger[_0x2c0a('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2d7532,_0x245742);_0x2e5dab(_0x245742);});});}exports['CreateOpenchannelQueueReport']=function(_0x3e1eb1){var _0x105c76=this;return new Promise(function(_0x30433e,_0x10b005){return db[_0x2c0a('0x16')][_0x2c0a('0x17')](_0x3e1eb1['body'],{'raw':_0x3e1eb1[_0x2c0a('0x18')]?_0x3e1eb1[_0x2c0a('0x18')][_0x2c0a('0x19')]===undefined?!![]:![]:!![]})[_0x2c0a('0x1a')](function(_0x4f68a9){logger[_0x2c0a('0xb')](_0x2c0a('0x1b'),_0x3e1eb1);logger['debug'](_0x2c0a('0x1b'),_0x3e1eb1,JSON[_0x2c0a('0x10')](_0x4f68a9));_0x30433e(_0x4f68a9);})[_0x2c0a('0x15')](function(_0x26c91c){logger['error'](_0x2c0a('0x1b'),_0x26c91c[_0x2c0a('0x13')],_0x3e1eb1);_0x10b005(_0x105c76[_0x2c0a('0x11')](0x1f4,_0x26c91c[_0x2c0a('0x13')]));});});};exports[_0x2c0a('0x1c')]=function(_0xc55f42){var _0x24f378=this;return new Promise(function(_0x5a23aa,_0x21d906){return db[_0x2c0a('0x16')][_0x2c0a('0x1d')](_0xc55f42[_0x2c0a('0x1e')],{'raw':_0xc55f42[_0x2c0a('0x18')]?_0xc55f42[_0x2c0a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc55f42[_0x2c0a('0x18')]?_0xc55f42[_0x2c0a('0x18')][_0x2c0a('0x1f')]||null:null,'attributes':_0xc55f42['options']?_0xc55f42[_0x2c0a('0x18')][_0x2c0a('0x20')]||null:null,'limit':_0xc55f42[_0x2c0a('0x18')]?_0xc55f42[_0x2c0a('0x18')][_0x2c0a('0x21')]||null:null})['then'](function(_0x2c529c){logger[_0x2c0a('0xb')](_0x2c0a('0x1c'),_0xc55f42);logger[_0x2c0a('0xd')]('UpdateOpenchannelQueueReport',_0xc55f42,JSON[_0x2c0a('0x10')](_0x2c529c));_0x5a23aa(_0x2c529c);})[_0x2c0a('0x15')](function(_0x3f980a){logger['error'](_0x2c0a('0x1c'),_0x3f980a['message'],_0xc55f42);_0x21d906(_0x24f378[_0x2c0a('0x11')](0x1f4,_0x3f980a[_0x2c0a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 043ddae..c25fd49 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(_0x2ee790,_0x5a8661){var _0x5a54a5=function(_0x2713a4){while(--_0x2713a4){_0x2ee790['push'](_0x2ee790['shift']());}};_0x5a54a5(++_0x5a8661);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d4408f3..458a9c1 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 _0x46a3=['sequelize','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x46a3,0x1c0));var _0x346a=function(_0x24d9cb,_0x1c522c){_0x24d9cb=_0x24d9cb-0x0;var _0x536c24=_0x46a3[_0x24d9cb];return _0x536c24;};'use strict';var moment=require('moment');var Sequelize=require(_0x346a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x346a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x346a('0x2')]('account',_0x346a('0x3'),_0x346a('0x4')),'allowNull':![],'defaultValue':_0x346a('0x4')},'transferredAt':{'type':Sequelize[_0x346a('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x346a('0x6')]}}; \ No newline at end of file +var _0x1ecf=['DATE','NOW','sequelize','exports','STRING','account','agent','queue'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1ecf,0x1a2));var _0xf1ec=function(_0x4b3e49,_0x9e566c){_0x4b3e49=_0x4b3e49-0x0;var _0x57e339=_0x1ecf[_0x4b3e49];return _0x57e339;};'use strict';var moment=require('moment');var Sequelize=require(_0xf1ec('0x0'));module[_0xf1ec('0x1')]={'uniqueid':{'type':Sequelize[_0xf1ec('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf1ec('0x3'),_0xf1ec('0x4'),_0xf1ec('0x5')),'allowNull':![],'defaultValue':_0xf1ec('0x5')},'transferredAt':{'type':Sequelize[_0xf1ec('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xf1ec('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c20097a..2ff9222 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 _0xc32d=['then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','catch','show','params','intersection','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x2b8d70,_0x5dec25){var _0x2395b3=function(_0x55c6d7){while(--_0x55c6d7){_0x2b8d70['push'](_0x2b8d70['shift']());}};_0x2395b3(++_0x5dec25);}(_0xc32d,0x18c));var _0xdc32=function(_0x1b57d0,_0x3d64f9){_0x1b57d0=_0x1b57d0-0x0;var _0x4681a9=_0xc32d[_0x1b57d0];return _0x4681a9;};'use strict';var pdf=require(_0xdc32('0x0'));var emlformat=require(_0xdc32('0x1'));var rimraf=require(_0xdc32('0x2'));var zipdir=require(_0xdc32('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc32('0x4'));var moment=require('moment');var BPromise=require(_0xdc32('0x5'));var Mustache=require(_0xdc32('0x6'));var util=require(_0xdc32('0x7'));var path=require(_0xdc32('0x8'));var sox=require(_0xdc32('0x9'));var csv=require(_0xdc32('0xa'));var ejs=require(_0xdc32('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdc32('0xc'));var jsforce=require(_0xdc32('0xd'));var deskjs=require(_0xdc32('0xe'));var toCsv=require(_0xdc32('0xa'));var querystring=require('querystring');var Papa=require(_0xdc32('0xf'));var Redis=require(_0xdc32('0x10'));var authService=require(_0xdc32('0x11'));var qs=require(_0xdc32('0x12'));var as=require(_0xdc32('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdc32('0x14'));var config=require(_0xdc32('0x15'));var licenseUtil=require(_0xdc32('0x16'));var db=require(_0xdc32('0x17'))['db'];function respondWithStatusCode(_0x57d812,_0x1f5fca){_0x1f5fca=_0x1f5fca||0xcc;return function(_0x23f3f8){if(_0x23f3f8){return _0x57d812[_0xdc32('0x18')](_0x1f5fca);}return _0x57d812[_0xdc32('0x19')](_0x1f5fca)[_0xdc32('0x1a')]();};}function respondWithResult(_0x1c3523,_0x5c9e6a){_0x5c9e6a=_0x5c9e6a||0xc8;return function(_0x2c4c44){if(_0x2c4c44){return _0x1c3523[_0xdc32('0x19')](_0x5c9e6a)[_0xdc32('0x1b')](_0x2c4c44);}};}function respondWithFilteredResult(_0x473ffc,_0x56274f){return function(_0x325fa0){if(_0x325fa0){var _0x34100f=_0x325fa0[_0xdc32('0x1c')],_0x502d00=_0x56274f[_0xdc32('0x1d')],_0x4145c9=_0x56274f['offset']+_0x56274f[_0xdc32('0x1e')],_0x405c90;if(_0x4145c9>=_0x34100f){_0x4145c9=_0x34100f;_0x405c90=0xc8;}else{_0x405c90=0xce;}_0x473ffc['status'](_0x405c90);return _0x473ffc[_0xdc32('0x1f')](_0xdc32('0x20'),_0x502d00+'-'+_0x4145c9+'/'+_0x34100f)[_0xdc32('0x1b')](_0x325fa0);}return null;};}function patchUpdates(_0x2b0df4){return function(_0xe18dc4){try{jsonpatch['apply'](_0xe18dc4,_0x2b0df4,!![]);}catch(_0x319dca){return BPromise[_0xdc32('0x21')](_0x319dca);}return _0xe18dc4[_0xdc32('0x22')]();};}function saveUpdates(_0x4800e7,_0x4145e7){return function(_0x2416ed){if(_0x2416ed){return _0x2416ed[_0xdc32('0x23')](_0x4800e7)[_0xdc32('0x24')](function(_0x5400ae){return _0x5400ae;});}return null;};}function removeEntity(_0xa990ad,_0x3a0328){return function(_0x5cb126){if(_0x5cb126){return _0x5cb126[_0xdc32('0x25')]()[_0xdc32('0x24')](function(){_0xa990ad[_0xdc32('0x19')](0xcc)[_0xdc32('0x1a')]();});}};}function handleEntityNotFound(_0x218d1a,_0x1d966b){return function(_0x5a598c){if(!_0x5a598c){_0x218d1a[_0xdc32('0x18')](0x194);}return _0x5a598c;};}function handleError(_0x40dc69,_0x1610fb){_0x1610fb=_0x1610fb||0x1f4;return function(_0x1864ed){logger[_0xdc32('0x26')](_0x1864ed['stack']);if(_0x1864ed[_0xdc32('0x27')]){delete _0x1864ed[_0xdc32('0x27')];}_0x40dc69[_0xdc32('0x19')](_0x1610fb)[_0xdc32('0x28')](_0x1864ed);};}exports[_0xdc32('0x29')]=function(_0x3f82dc,_0x59e050){var _0x4f7280={},_0x5af250={},_0x3c2ec4={'count':0x0,'rows':[]};var _0x5eca9b=_[_0xdc32('0x2a')](db['OpenchannelTransferReport'][_0xdc32('0x2b')],function(_0x3a30f4){return{'name':_0x3a30f4[_0xdc32('0x2c')],'type':_0x3a30f4[_0xdc32('0x2d')][_0xdc32('0x2e')]};});_0x5af250['model']=_[_0xdc32('0x2a')](_0x5eca9b,'name');_0x5af250[_0xdc32('0x2f')]=_['keys'](_0x3f82dc[_0xdc32('0x2f')]);_0x5af250[_0xdc32('0x30')]=_['intersection'](_0x5af250[_0xdc32('0x31')],_0x5af250[_0xdc32('0x2f')]);_0x4f7280['attributes']=_['intersection'](_0x5af250[_0xdc32('0x31')],qs['fields'](_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x32')]));_0x4f7280[_0xdc32('0x33')]=_0x4f7280[_0xdc32('0x33')]['length']?_0x4f7280[_0xdc32('0x33')]:_0x5af250[_0xdc32('0x31')];if(!_0x3f82dc['query'][_0xdc32('0x34')](_0xdc32('0x35'))){_0x4f7280['limit']=qs['limit'](_0x3f82dc[_0xdc32('0x2f')]['limit']);_0x4f7280[_0xdc32('0x1d')]=qs[_0xdc32('0x1d')](_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x1d')]);}_0x4f7280[_0xdc32('0x36')]=qs['sort'](_0x3f82dc['query'][_0xdc32('0x37')]);_0x4f7280[_0xdc32('0x38')]=qs['filters'](_['pick'](_0x3f82dc['query'],_0x5af250[_0xdc32('0x30')]),_0x5eca9b);if(_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x39')]){_0x4f7280[_0xdc32('0x38')]=_['merge'](_0x4f7280[_0xdc32('0x38')],{'$or':_[_0xdc32('0x2a')](_0x5eca9b,function(_0x5c1c57){if(_0x5c1c57['type']!==_0xdc32('0x3a')){var _0xae568a={};_0xae568a[_0x5c1c57[_0xdc32('0x27')]]={'$like':'%'+_0x3f82dc['query'][_0xdc32('0x39')]+'%'};return _0xae568a;}})});}_0x4f7280=_[_0xdc32('0x3b')]({},_0x4f7280,_0x3f82dc[_0xdc32('0x3c')]);var _0x31ddb9={'where':_0x4f7280[_0xdc32('0x38')]};return db[_0xdc32('0x3d')][_0xdc32('0x1c')](_0x31ddb9)[_0xdc32('0x24')](function(_0x17a6cd){_0x3c2ec4[_0xdc32('0x1c')]=_0x17a6cd;if(_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x3e')]){_0x4f7280[_0xdc32('0x3f')]=[{'all':!![]}];}return db[_0xdc32('0x3d')]['findAll'](_0x4f7280);})[_0xdc32('0x24')](function(_0x30972e){_0x3c2ec4['rows']=_0x30972e;return _0x3c2ec4;})[_0xdc32('0x24')](respondWithFilteredResult(_0x59e050,_0x4f7280))[_0xdc32('0x40')](handleError(_0x59e050,null));};exports[_0xdc32('0x41')]=function(_0x4e407a,_0x565980){var _0x3af544={'raw':!![],'where':{'id':_0x4e407a[_0xdc32('0x42')]['id']}},_0x48e4e5={};_0x48e4e5[_0xdc32('0x31')]=_['keys'](db['OpenchannelTransferReport'][_0xdc32('0x2b')]);_0x48e4e5[_0xdc32('0x2f')]=_['keys'](_0x4e407a[_0xdc32('0x2f')]);_0x48e4e5[_0xdc32('0x30')]=_[_0xdc32('0x43')](_0x48e4e5[_0xdc32('0x31')],_0x48e4e5[_0xdc32('0x2f')]);_0x3af544[_0xdc32('0x33')]=_[_0xdc32('0x43')](_0x48e4e5['model'],qs[_0xdc32('0x32')](_0x4e407a['query'][_0xdc32('0x32')]));_0x3af544[_0xdc32('0x33')]=_0x3af544[_0xdc32('0x33')][_0xdc32('0x44')]?_0x3af544[_0xdc32('0x33')]:_0x48e4e5[_0xdc32('0x31')];if(_0x4e407a[_0xdc32('0x2f')][_0xdc32('0x3e')]){_0x3af544[_0xdc32('0x3f')]=[{'all':!![]}];}_0x3af544=_[_0xdc32('0x3b')]({},_0x3af544,_0x4e407a[_0xdc32('0x3c')]);return db['OpenchannelTransferReport'][_0xdc32('0x45')](_0x3af544)['then'](handleEntityNotFound(_0x565980,null))[_0xdc32('0x24')](respondWithResult(_0x565980,null))['catch'](handleError(_0x565980,null));};exports[_0xdc32('0x46')]=function(_0x56f8c2,_0xb356ce){return db[_0xdc32('0x3d')][_0xdc32('0x46')](_0x56f8c2['body'],{})['then'](respondWithResult(_0xb356ce,0xc9))[_0xdc32('0x40')](handleError(_0xb356ce,null));};exports[_0xdc32('0x23')]=function(_0x34475d,_0x446274){if(_0x34475d[_0xdc32('0x47')]['id']){delete _0x34475d[_0xdc32('0x47')]['id'];}return db['OpenchannelTransferReport'][_0xdc32('0x45')]({'where':{'id':_0x34475d[_0xdc32('0x42')]['id']}})[_0xdc32('0x24')](handleEntityNotFound(_0x446274,null))[_0xdc32('0x24')](saveUpdates(_0x34475d[_0xdc32('0x47')],null))[_0xdc32('0x24')](respondWithResult(_0x446274,null))[_0xdc32('0x40')](handleError(_0x446274,null));};exports[_0xdc32('0x25')]=function(_0x54b156,_0x2d3fac){return db['OpenchannelTransferReport'][_0xdc32('0x45')]({'where':{'id':_0x54b156['params']['id']}})[_0xdc32('0x24')](handleEntityNotFound(_0x2d3fac,null))[_0xdc32('0x24')](removeEntity(_0x2d3fac,null))[_0xdc32('0x40')](handleError(_0x2d3fac,null));};exports['describe']=function(_0x297282,_0x243319){return db[_0xdc32('0x3d')]['describe']()[_0xdc32('0x24')](respondWithResult(_0x243319,null))[_0xdc32('0x40')](handleError(_0x243319,null));}; \ No newline at end of file +var _0x46af=['where','merge','VIRTUAL','count','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','describe','html-pdf','fast-json-patch','request-promise','util','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','OpenchannelTransferReport','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','filter'];(function(_0x3f36ed,_0x38124c){var _0x402a89=function(_0x4d8924){while(--_0x4d8924){_0x3f36ed['push'](_0x3f36ed['shift']());}};_0x402a89(++_0x38124c);}(_0x46af,0x1a2));var _0xf46a=function(_0x1c8655,_0x2e298b){_0x1c8655=_0x1c8655-0x0;var _0x569164=_0x46af[_0x1c8655];return _0x569164;};'use strict';var pdf=require(_0xf46a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf46a('0x1'));var rp=require(_0xf46a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf46a('0x3'));var path=require('path');var sox=require(_0xf46a('0x4'));var csv=require(_0xf46a('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf46a('0x6'));var squel=require(_0xf46a('0x7'));var crypto=require(_0xf46a('0x8'));var jsforce=require(_0xf46a('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf46a('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf46a('0xa'));var authService=require(_0xf46a('0xb'));var qs=require(_0xf46a('0xc'));var as=require(_0xf46a('0xd'));var hardwareService=require(_0xf46a('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xf46a('0xf'));var config=require(_0xf46a('0x10'));var licenseUtil=require(_0xf46a('0x11'));var db=require(_0xf46a('0x12'))['db'];function respondWithStatusCode(_0x8cce71,_0x2ae94d){_0x2ae94d=_0x2ae94d||0xcc;return function(_0x259612){if(_0x259612){return _0x8cce71['sendStatus'](_0x2ae94d);}return _0x8cce71[_0xf46a('0x13')](_0x2ae94d)['end']();};}function respondWithResult(_0x119a80,_0x816afc){_0x816afc=_0x816afc||0xc8;return function(_0x328697){if(_0x328697){return _0x119a80['status'](_0x816afc)[_0xf46a('0x14')](_0x328697);}};}function respondWithFilteredResult(_0x18d838,_0x3493c5){return function(_0xce52bb){if(_0xce52bb){var _0x2289a6=_0xce52bb['count'],_0x29a2d2=_0x3493c5[_0xf46a('0x15')],_0x43f7a7=_0x3493c5[_0xf46a('0x15')]+_0x3493c5[_0xf46a('0x16')],_0x49ddc3;if(_0x43f7a7>=_0x2289a6){_0x43f7a7=_0x2289a6;_0x49ddc3=0xc8;}else{_0x49ddc3=0xce;}_0x18d838[_0xf46a('0x13')](_0x49ddc3);return _0x18d838[_0xf46a('0x17')](_0xf46a('0x18'),_0x29a2d2+'-'+_0x43f7a7+'/'+_0x2289a6)[_0xf46a('0x14')](_0xce52bb);}return null;};}function patchUpdates(_0xbafad9){return function(_0x4af959){try{jsonpatch[_0xf46a('0x19')](_0x4af959,_0xbafad9,!![]);}catch(_0x2c75c8){return BPromise[_0xf46a('0x1a')](_0x2c75c8);}return _0x4af959[_0xf46a('0x1b')]();};}function saveUpdates(_0x3accb7,_0x4fa891){return function(_0x5cbf0a){if(_0x5cbf0a){return _0x5cbf0a[_0xf46a('0x1c')](_0x3accb7)['then'](function(_0x46ce02){return _0x46ce02;});}return null;};}function removeEntity(_0x553182,_0x2f94fe){return function(_0x8dbee1){if(_0x8dbee1){return _0x8dbee1[_0xf46a('0x1d')]()[_0xf46a('0x1e')](function(){_0x553182['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x348d44,_0x3c8ce9){return function(_0x1504b7){if(!_0x1504b7){_0x348d44[_0xf46a('0x1f')](0x194);}return _0x1504b7;};}function handleError(_0x5b97b2,_0x3b716f){_0x3b716f=_0x3b716f||0x1f4;return function(_0x3fa8e7){logger[_0xf46a('0x20')](_0x3fa8e7[_0xf46a('0x21')]);if(_0x3fa8e7[_0xf46a('0x22')]){delete _0x3fa8e7[_0xf46a('0x22')];}_0x5b97b2['status'](_0x3b716f)[_0xf46a('0x23')](_0x3fa8e7);};}exports['index']=function(_0xc9f4f2,_0x31d622){var _0x52fb57={},_0x451690={},_0x20e873={'count':0x0,'rows':[]};var _0x4769cd=_['map'](db[_0xf46a('0x24')][_0xf46a('0x25')],function(_0x2127d2){return{'name':_0x2127d2['fieldName'],'type':_0x2127d2[_0xf46a('0x26')][_0xf46a('0x27')]};});_0x451690[_0xf46a('0x28')]=_[_0xf46a('0x29')](_0x4769cd,'name');_0x451690[_0xf46a('0x2a')]=_['keys'](_0xc9f4f2['query']);_0x451690[_0xf46a('0x2b')]=_[_0xf46a('0x2c')](_0x451690[_0xf46a('0x28')],_0x451690[_0xf46a('0x2a')]);_0x52fb57['attributes']=_[_0xf46a('0x2c')](_0x451690[_0xf46a('0x28')],qs['fields'](_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x2d')]));_0x52fb57['attributes']=_0x52fb57[_0xf46a('0x2e')][_0xf46a('0x2f')]?_0x52fb57[_0xf46a('0x2e')]:_0x451690['model'];if(!_0xc9f4f2['query']['hasOwnProperty'](_0xf46a('0x30'))){_0x52fb57[_0xf46a('0x16')]=qs[_0xf46a('0x16')](_0xc9f4f2['query'][_0xf46a('0x16')]);_0x52fb57[_0xf46a('0x15')]=qs[_0xf46a('0x15')](_0xc9f4f2['query'][_0xf46a('0x15')]);}_0x52fb57['order']=qs['sort'](_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x31')]);_0x52fb57['where']=qs[_0xf46a('0x2b')](_['pick'](_0xc9f4f2[_0xf46a('0x2a')],_0x451690[_0xf46a('0x2b')]),_0x4769cd);if(_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x32')]){_0x52fb57[_0xf46a('0x33')]=_[_0xf46a('0x34')](_0x52fb57['where'],{'$or':_[_0xf46a('0x29')](_0x4769cd,function(_0x1cb087){if(_0x1cb087[_0xf46a('0x26')]!==_0xf46a('0x35')){var _0x3ba232={};_0x3ba232[_0x1cb087[_0xf46a('0x22')]]={'$like':'%'+_0xc9f4f2[_0xf46a('0x2a')][_0xf46a('0x32')]+'%'};return _0x3ba232;}})});}_0x52fb57=_['merge']({},_0x52fb57,_0xc9f4f2['options']);var _0x546702={'where':_0x52fb57[_0xf46a('0x33')]};return db[_0xf46a('0x24')][_0xf46a('0x36')](_0x546702)['then'](function(_0x57e970){_0x20e873[_0xf46a('0x36')]=_0x57e970;if(_0xc9f4f2[_0xf46a('0x2a')]['includeAll']){_0x52fb57[_0xf46a('0x37')]=[{'all':!![]}];}return db[_0xf46a('0x24')][_0xf46a('0x38')](_0x52fb57);})[_0xf46a('0x1e')](function(_0x37af42){_0x20e873[_0xf46a('0x39')]=_0x37af42;return _0x20e873;})[_0xf46a('0x1e')](respondWithFilteredResult(_0x31d622,_0x52fb57))['catch'](handleError(_0x31d622,null));};exports[_0xf46a('0x3a')]=function(_0x211bb9,_0x6db179){var _0x303965={'raw':!![],'where':{'id':_0x211bb9[_0xf46a('0x3b')]['id']}},_0x541251={};_0x541251[_0xf46a('0x28')]=_['keys'](db[_0xf46a('0x24')][_0xf46a('0x25')]);_0x541251[_0xf46a('0x2a')]=_[_0xf46a('0x3c')](_0x211bb9[_0xf46a('0x2a')]);_0x541251[_0xf46a('0x2b')]=_['intersection'](_0x541251[_0xf46a('0x28')],_0x541251[_0xf46a('0x2a')]);_0x303965[_0xf46a('0x2e')]=_[_0xf46a('0x2c')](_0x541251[_0xf46a('0x28')],qs[_0xf46a('0x2d')](_0x211bb9[_0xf46a('0x2a')][_0xf46a('0x2d')]));_0x303965[_0xf46a('0x2e')]=_0x303965[_0xf46a('0x2e')][_0xf46a('0x2f')]?_0x303965[_0xf46a('0x2e')]:_0x541251[_0xf46a('0x28')];if(_0x211bb9[_0xf46a('0x2a')][_0xf46a('0x3d')]){_0x303965[_0xf46a('0x37')]=[{'all':!![]}];}_0x303965=_[_0xf46a('0x34')]({},_0x303965,_0x211bb9['options']);return db[_0xf46a('0x24')][_0xf46a('0x3e')](_0x303965)[_0xf46a('0x1e')](handleEntityNotFound(_0x6db179,null))['then'](respondWithResult(_0x6db179,null))['catch'](handleError(_0x6db179,null));};exports[_0xf46a('0x3f')]=function(_0x32df80,_0x429b71){return db['OpenchannelTransferReport']['create'](_0x32df80[_0xf46a('0x40')],{})[_0xf46a('0x1e')](respondWithResult(_0x429b71,0xc9))[_0xf46a('0x41')](handleError(_0x429b71,null));};exports[_0xf46a('0x1c')]=function(_0x417262,_0x4cb920){if(_0x417262[_0xf46a('0x40')]['id']){delete _0x417262[_0xf46a('0x40')]['id'];}return db[_0xf46a('0x24')][_0xf46a('0x3e')]({'where':{'id':_0x417262[_0xf46a('0x3b')]['id']}})[_0xf46a('0x1e')](handleEntityNotFound(_0x4cb920,null))[_0xf46a('0x1e')](saveUpdates(_0x417262[_0xf46a('0x40')],null))[_0xf46a('0x1e')](respondWithResult(_0x4cb920,null))[_0xf46a('0x41')](handleError(_0x4cb920,null));};exports[_0xf46a('0x1d')]=function(_0x2703e3,_0x595e14){return db['OpenchannelTransferReport'][_0xf46a('0x3e')]({'where':{'id':_0x2703e3[_0xf46a('0x3b')]['id']}})[_0xf46a('0x1e')](handleEntityNotFound(_0x595e14,null))[_0xf46a('0x1e')](removeEntity(_0x595e14,null))[_0xf46a('0x41')](handleError(_0x595e14,null));};exports[_0xf46a('0x42')]=function(_0x4e2989,_0x15508b){return db['OpenchannelTransferReport'][_0xf46a('0x42')]()[_0xf46a('0x1e')](respondWithResult(_0x15508b,null))[_0xf46a('0x41')](handleError(_0x15508b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index fbef6a4..8c56ad0 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 _0x5889=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2214b6,_0x7dc12b){var _0x42a89e=function(_0x270be4){while(--_0x270be4){_0x2214b6['push'](_0x2214b6['shift']());}};_0x42a89e(++_0x7dc12b);}(_0x5889,0x127));var _0x9588=function(_0x325989,_0x3908f9){_0x325989=_0x325989-0x0;var _0x3487c7=_0x5889[_0x325989];return _0x3487c7;};'use strict';var _=require(_0x9588('0x0'));var util=require('util');var logger=require(_0x9588('0x1'))(_0x9588('0x2'));var moment=require(_0x9588('0x3'));var BPromise=require(_0x9588('0x4'));var rp=require(_0x9588('0x5'));var fs=require('fs');var path=require(_0x9588('0x6'));var rimraf=require(_0x9588('0x7'));var config=require(_0x9588('0x8'));var attributes=require(_0x9588('0x9'));module[_0x9588('0xa')]=function(_0x10dbf9,_0x336e06){return _0x10dbf9[_0x9588('0xb')](_0x9588('0xc'),attributes,{'tableName':_0x9588('0xd'),'paranoid':![],'indexes':[{'name':_0x9588('0xe'),'fields':[_0x9588('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa14=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x4f9d26,_0x641341){var _0x57debc=function(_0x48f368){while(--_0x48f368){_0x4f9d26['push'](_0x4f9d26['shift']());}};_0x57debc(++_0x641341);}(_0xfa14,0x1d3));var _0x4fa1=function(_0x45d1b1,_0x328cb0){_0x45d1b1=_0x45d1b1-0x0;var _0x313c30=_0xfa14[_0x45d1b1];return _0x313c30;};'use strict';var _=require(_0x4fa1('0x0'));var util=require(_0x4fa1('0x1'));var logger=require(_0x4fa1('0x2'))(_0x4fa1('0x3'));var moment=require(_0x4fa1('0x4'));var BPromise=require(_0x4fa1('0x5'));var rp=require(_0x4fa1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4fa1('0x7'));var attributes=require(_0x4fa1('0x8'));module[_0x4fa1('0x9')]=function(_0x18f52d,_0x3e0796){return _0x18f52d['define'](_0x4fa1('0xa'),attributes,{'tableName':_0x4fa1('0xb'),'paranoid':![],'indexes':[{'name':_0x4fa1('0xc'),'fields':[_0x4fa1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 785a2ae..c59ba69 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 _0xf6af=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c2362,_0x20efcc){var _0x259677=function(_0x509cf2){while(--_0x509cf2){_0x5c2362['push'](_0x5c2362['shift']());}};_0x259677(++_0x20efcc);}(_0xf6af,0xb0));var _0xff6a=function(_0x19c4fe,_0x3f793a){_0x19c4fe=_0x19c4fe-0x0;var _0x1c4084=_0xf6af[_0x19c4fe];return _0x1c4084;};'use strict';var _=require(_0xff6a('0x0'));var util=require('util');var moment=require(_0xff6a('0x1'));var BPromise=require(_0xff6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff6a('0x3'));var db=require(_0xff6a('0x4'))['db'];var utils=require(_0xff6a('0x5'));var logger=require(_0xff6a('0x6'))(_0xff6a('0x7'));var config=require(_0xff6a('0x8'));var jayson=require(_0xff6a('0x9'));var client=jayson[_0xff6a('0xa')][_0xff6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0374a,_0x4b933f,_0x2cbed0){return new BPromise(function(_0x401bf7,_0x2d3e7a){return client[_0xff6a('0xc')](_0xb0374a,_0x2cbed0)[_0xff6a('0xd')](function(_0x586bf9){logger[_0xff6a('0xe')](_0xff6a('0xf'),_0x4b933f,_0xff6a('0x10'));logger[_0xff6a('0x11')](_0xff6a('0x12'),_0x4b933f,'request\x20sent',JSON[_0xff6a('0x13')](_0x586bf9));if(_0x586bf9[_0xff6a('0x14')]){if(_0x586bf9['error'][_0xff6a('0x15')]===0x1f4){logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x586bf9[_0xff6a('0x14')]['message']);return _0x2d3e7a(_0x586bf9[_0xff6a('0x14')][_0xff6a('0x16')]);}logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x586bf9[_0xff6a('0x14')][_0xff6a('0x16')]);return _0x401bf7(_0x586bf9['error']['message']);}else{logger['info'](_0xff6a('0xf'),_0x4b933f,_0xff6a('0x10'));_0x401bf7(_0x586bf9[_0xff6a('0x17')][_0xff6a('0x16')]);}})[_0xff6a('0x18')](function(_0x4f77a9){logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x4f77a9);_0x2d3e7a(_0x4f77a9);});});} \ No newline at end of file +var _0x57b3=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x400fc9,_0x3f52a7){var _0x1204d1=function(_0x245e09){while(--_0x245e09){_0x400fc9['push'](_0x400fc9['shift']());}};_0x1204d1(++_0x3f52a7);}(_0x57b3,0x1ad));var _0x357b=function(_0x375893,_0x46d391){_0x375893=_0x375893-0x0;var _0x6ac68=_0x57b3[_0x375893];return _0x6ac68;};'use strict';var _=require('lodash');var util=require(_0x357b('0x0'));var moment=require(_0x357b('0x1'));var BPromise=require(_0x357b('0x2'));var rs=require(_0x357b('0x3'));var fs=require('fs');var Redis=require(_0x357b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x357b('0x5'));var logger=require(_0x357b('0x6'))(_0x357b('0x7'));var config=require(_0x357b('0x8'));var jayson=require(_0x357b('0x9'));var client=jayson['client'][_0x357b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d284,_0x49060f,_0x1791de){return new BPromise(function(_0x46ca92,_0x688272){return client['request'](_0x48d284,_0x1791de)[_0x357b('0xb')](function(_0x170608){logger[_0x357b('0xc')](_0x357b('0xd'),_0x49060f,_0x357b('0xe'));logger[_0x357b('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x49060f,_0x357b('0xe'),JSON[_0x357b('0x10')](_0x170608));if(_0x170608[_0x357b('0x11')]){if(_0x170608[_0x357b('0x11')]['code']===0x1f4){logger[_0x357b('0x11')](_0x357b('0xd'),_0x49060f,_0x170608[_0x357b('0x11')][_0x357b('0x12')]);return _0x688272(_0x170608[_0x357b('0x11')][_0x357b('0x12')]);}logger[_0x357b('0x11')](_0x357b('0xd'),_0x49060f,_0x170608['error']['message']);return _0x46ca92(_0x170608[_0x357b('0x11')][_0x357b('0x12')]);}else{logger[_0x357b('0xc')](_0x357b('0xd'),_0x49060f,_0x357b('0xe'));_0x46ca92(_0x170608['result'][_0x357b('0x12')]);}})[_0x357b('0x13')](function(_0x27d4f8){logger['error'](_0x357b('0xd'),_0x49060f,_0x27d4f8);_0x688272(_0x27d4f8);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1ed7096..b877f7c 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 _0x135e=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x29f642,_0x2e4958){var _0x2c0988=function(_0xa7382b){while(--_0xa7382b){_0x29f642['push'](_0x29f642['shift']());}};_0x2c0988(++_0x2e4958);}(_0x135e,0xc5));var _0xe135=function(_0x36fd55,_0x4ef430){_0x36fd55=_0x36fd55-0x0;var _0x2fd560=_0x135e[_0x36fd55];return _0x2fd560;};'use strict';var multer=require('multer');var util=require(_0xe135('0x0'));var path=require(_0xe135('0x1'));var timeout=require(_0xe135('0x2'));var express=require(_0xe135('0x3'));var router=express[_0xe135('0x4')]();var auth=require(_0xe135('0x5'));var interaction=require(_0xe135('0x6'));var config=require(_0xe135('0x7'));var controller=require('./pause.controller');router[_0xe135('0x8')]('/',auth['isAuthenticated'](),controller[_0xe135('0x9')]);router[_0xe135('0x8')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller[_0xe135('0xc')]);router[_0xe135('0xd')]('/',auth[_0xe135('0xb')](),controller[_0xe135('0xe')]);router[_0xe135('0xf')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller[_0xe135('0x10')]);router[_0xe135('0x11')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller['destroy']);module[_0xe135('0x12')]=router; \ No newline at end of file +var _0x2cba=['post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show'];(function(_0x470c92,_0x104210){var _0x16c0ae=function(_0x4006b4){while(--_0x4006b4){_0x470c92['push'](_0x470c92['shift']());}};_0x16c0ae(++_0x104210);}(_0x2cba,0x1bf));var _0xa2cb=function(_0x1e2f99,_0x42ca89){_0x1e2f99=_0x1e2f99-0x0;var _0xaaf02d=_0x2cba[_0x1e2f99];return _0xaaf02d;};'use strict';var multer=require(_0xa2cb('0x0'));var util=require('util');var path=require(_0xa2cb('0x1'));var timeout=require(_0xa2cb('0x2'));var express=require(_0xa2cb('0x3'));var router=express[_0xa2cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa2cb('0x5'));var controller=require(_0xa2cb('0x6'));router[_0xa2cb('0x7')]('/',auth[_0xa2cb('0x8')](),controller[_0xa2cb('0x9')]);router[_0xa2cb('0x7')](_0xa2cb('0xa'),auth[_0xa2cb('0x8')](),controller[_0xa2cb('0xb')]);router[_0xa2cb('0xc')]('/',auth[_0xa2cb('0x8')](),controller['create']);router[_0xa2cb('0xd')](_0xa2cb('0xa'),auth[_0xa2cb('0x8')](),controller[_0xa2cb('0xe')]);router[_0xa2cb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa2cb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8c4fd60..64c7388 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 _0xcfcc=['sequelize','name','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcfcc,0xb7));var _0xccfc=function(_0x56676a,_0x13ff5d){_0x56676a=_0x56676a-0x0;var _0x347c52=_0xcfcc[_0x56676a];return _0x347c52;};'use strict';var Sequelize=require(_0xccfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xccfc('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xccfc('0x2')]}}; \ No newline at end of file +var _0x520b=['STRING','sequelize','exports','name'];(function(_0x99cd0c,_0x2a778f){var _0x18f2e5=function(_0x53b2ae){while(--_0x53b2ae){_0x99cd0c['push'](_0x99cd0c['shift']());}};_0x18f2e5(++_0x2a778f);}(_0x520b,0x1d9));var _0xb520=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0x520b[_0x1635fe];return _0x3c512a;};'use strict';var Sequelize=require(_0xb520('0x0'));module[_0xb520('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb520('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb520('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2a1c65e..08c468f 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 _0xa62f=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','Pause','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','status','set','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa62f,0x181));var _0xfa62=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa62f[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa62('0x0'));var rimraf=require(_0xfa62('0x1'));var zipdir=require(_0xfa62('0x2'));var jsonpatch=require(_0xfa62('0x3'));var rp=require(_0xfa62('0x4'));var moment=require('moment');var BPromise=require(_0xfa62('0x5'));var Mustache=require(_0xfa62('0x6'));var util=require(_0xfa62('0x7'));var path=require(_0xfa62('0x8'));var sox=require('sox');var csv=require(_0xfa62('0x9'));var ejs=require(_0xfa62('0xa'));var fs=require('fs');var _=require(_0xfa62('0xb'));var squel=require(_0xfa62('0xc'));var crypto=require(_0xfa62('0xd'));var jsforce=require(_0xfa62('0xe'));var deskjs=require(_0xfa62('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa62('0x10'));var Redis=require(_0xfa62('0x11'));var authService=require(_0xfa62('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfa62('0x13'));var hardwareService=require(_0xfa62('0x14'));var logger=require(_0xfa62('0x15'))(_0xfa62('0x16'));var utils=require(_0xfa62('0x17'));var config=require(_0xfa62('0x18'));var licenseUtil=require(_0xfa62('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9430,_0x56e4f1){_0x56e4f1=_0x56e4f1||0xcc;return function(_0x14836e){if(_0x14836e){return _0x3c9430[_0xfa62('0x1a')](_0x56e4f1);}return _0x3c9430['status'](_0x56e4f1)[_0xfa62('0x1b')]();};}function respondWithResult(_0x2599c8,_0x5349d6){_0x5349d6=_0x5349d6||0xc8;return function(_0x397f42){if(_0x397f42){return _0x2599c8['status'](_0x5349d6)[_0xfa62('0x1c')](_0x397f42);}};}function respondWithFilteredResult(_0x1d9e2a,_0x5b8ff5){return function(_0x399ce9){if(_0x399ce9){var _0x4867ef=_0x399ce9[_0xfa62('0x1d')],_0x13e37a=_0x5b8ff5[_0xfa62('0x1e')],_0x49d70f=_0x5b8ff5['offset']+_0x5b8ff5['limit'],_0x4c13b2;if(_0x49d70f>=_0x4867ef){_0x49d70f=_0x4867ef;_0x4c13b2=0xc8;}else{_0x4c13b2=0xce;}_0x1d9e2a[_0xfa62('0x1f')](_0x4c13b2);return _0x1d9e2a[_0xfa62('0x20')]('Content-Range',_0x13e37a+'-'+_0x49d70f+'/'+_0x4867ef)[_0xfa62('0x1c')](_0x399ce9);}return null;};}function patchUpdates(_0x21dde4){return function(_0x16cae9){try{jsonpatch['apply'](_0x16cae9,_0x21dde4,!![]);}catch(_0x2fa852){return BPromise[_0xfa62('0x21')](_0x2fa852);}return _0x16cae9[_0xfa62('0x22')]();};}function saveUpdates(_0xe60ae7,_0xd9f233){return function(_0x391645){if(_0x391645){return _0x391645[_0xfa62('0x23')](_0xe60ae7)[_0xfa62('0x24')](function(_0x210d06){return _0x210d06;});}return null;};}function removeEntity(_0x5c577b,_0x53fe2e){return function(_0x454d0d){if(_0x454d0d){return _0x454d0d[_0xfa62('0x25')]()[_0xfa62('0x24')](function(){var _0x44f999=_0x454d0d[_0xfa62('0x26')]({'plain':!![]});var _0xec4234=_0xfa62('0x27');return db[_0xfa62('0x28')][_0xfa62('0x25')]({'where':{'type':_0xec4234,'resourceId':_0x44f999['id']}})[_0xfa62('0x24')](function(){return _0x454d0d;});})[_0xfa62('0x24')](function(){_0x5c577b[_0xfa62('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4003c5,_0x174caf){return function(_0x4b8a1c){if(!_0x4b8a1c){_0x4003c5[_0xfa62('0x1a')](0x194);}return _0x4b8a1c;};}function handleError(_0x485e9e,_0x590e03){_0x590e03=_0x590e03||0x1f4;return function(_0x3358f8){logger[_0xfa62('0x29')](_0x3358f8[_0xfa62('0x2a')]);if(_0x3358f8[_0xfa62('0x2b')]){delete _0x3358f8[_0xfa62('0x2b')];}_0x485e9e[_0xfa62('0x1f')](_0x590e03)[_0xfa62('0x2c')](_0x3358f8);};}exports['index']=function(_0x42e1ae,_0x516acb){var _0x50cd06={},_0x195a11={},_0x3d4319={'count':0x0,'rows':[]};var _0x35c02d=_[_0xfa62('0x2d')](db['Pause']['rawAttributes'],function(_0x2d0e46){return{'name':_0x2d0e46[_0xfa62('0x2e')],'type':_0x2d0e46[_0xfa62('0x2f')][_0xfa62('0x30')]};});_0x195a11[_0xfa62('0x31')]=_[_0xfa62('0x2d')](_0x35c02d,'name');_0x195a11[_0xfa62('0x32')]=_[_0xfa62('0x33')](_0x42e1ae['query']);_0x195a11[_0xfa62('0x34')]=_[_0xfa62('0x35')](_0x195a11[_0xfa62('0x31')],_0x195a11[_0xfa62('0x32')]);_0x50cd06[_0xfa62('0x36')]=_[_0xfa62('0x35')](_0x195a11[_0xfa62('0x31')],qs[_0xfa62('0x37')](_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x37')]));_0x50cd06[_0xfa62('0x36')]=_0x50cd06[_0xfa62('0x36')][_0xfa62('0x38')]?_0x50cd06[_0xfa62('0x36')]:_0x195a11[_0xfa62('0x31')];if(!_0x42e1ae['query'][_0xfa62('0x39')](_0xfa62('0x3a'))){_0x50cd06['limit']=qs[_0xfa62('0x3b')](_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x3b')]);_0x50cd06[_0xfa62('0x1e')]=qs[_0xfa62('0x1e')](_0x42e1ae['query'][_0xfa62('0x1e')]);}_0x50cd06[_0xfa62('0x3c')]=qs['sort'](_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x3d')]);_0x50cd06[_0xfa62('0x3e')]=qs[_0xfa62('0x34')](_[_0xfa62('0x3f')](_0x42e1ae[_0xfa62('0x32')],_0x195a11[_0xfa62('0x34')]),_0x35c02d);if(_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x40')]){_0x50cd06[_0xfa62('0x3e')]=_[_0xfa62('0x41')](_0x50cd06[_0xfa62('0x3e')],{'$or':_[_0xfa62('0x2d')](_0x35c02d,function(_0x444f41){if(_0x444f41['type']!==_0xfa62('0x42')){var _0x5b9550={};_0x5b9550[_0x444f41[_0xfa62('0x2b')]]={'$like':'%'+_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x40')]+'%'};return _0x5b9550;}})});}_0x50cd06=_[_0xfa62('0x41')]({},_0x50cd06,_0x42e1ae['options']);var _0x33e640={'where':_0x50cd06[_0xfa62('0x3e')]};return db['Pause'][_0xfa62('0x1d')](_0x33e640)[_0xfa62('0x24')](function(_0x53261e){_0x3d4319[_0xfa62('0x1d')]=_0x53261e;if(_0x42e1ae[_0xfa62('0x32')]['includeAll']){_0x50cd06[_0xfa62('0x43')]=[{'all':!![]}];}return db[_0xfa62('0x44')][_0xfa62('0x45')](_0x50cd06);})[_0xfa62('0x24')](function(_0x22cc22){_0x3d4319[_0xfa62('0x46')]=_0x22cc22;return _0x3d4319;})[_0xfa62('0x24')](respondWithFilteredResult(_0x516acb,_0x50cd06))['catch'](handleError(_0x516acb,null));};exports[_0xfa62('0x47')]=function(_0x1a8160,_0xb9da93){var _0xc60609={'raw':!![],'where':{'id':_0x1a8160[_0xfa62('0x48')]['id']}},_0x38dab1={};_0x38dab1['model']=_['keys'](db[_0xfa62('0x44')][_0xfa62('0x49')]);_0x38dab1[_0xfa62('0x32')]=_[_0xfa62('0x33')](_0x1a8160['query']);_0x38dab1[_0xfa62('0x34')]=_[_0xfa62('0x35')](_0x38dab1[_0xfa62('0x31')],_0x38dab1[_0xfa62('0x32')]);_0xc60609[_0xfa62('0x36')]=_[_0xfa62('0x35')](_0x38dab1[_0xfa62('0x31')],qs[_0xfa62('0x37')](_0x1a8160['query'][_0xfa62('0x37')]));_0xc60609[_0xfa62('0x36')]=_0xc60609[_0xfa62('0x36')]['length']?_0xc60609[_0xfa62('0x36')]:_0x38dab1[_0xfa62('0x31')];if(_0x1a8160[_0xfa62('0x32')][_0xfa62('0x4a')]){_0xc60609[_0xfa62('0x43')]=[{'all':!![]}];}_0xc60609=_[_0xfa62('0x41')]({},_0xc60609,_0x1a8160[_0xfa62('0x4b')]);return db[_0xfa62('0x44')][_0xfa62('0x4c')](_0xc60609)['then'](handleEntityNotFound(_0xb9da93,null))[_0xfa62('0x24')](respondWithResult(_0xb9da93,null))[_0xfa62('0x4d')](handleError(_0xb9da93,null));};exports[_0xfa62('0x4e')]=function(_0x5b86d4,_0x2d4fe8){return db['Pause'][_0xfa62('0x4e')](_0x5b86d4[_0xfa62('0x4f')],{})[_0xfa62('0x24')](function(_0x274047){var _0xc0af02=_0x5b86d4[_0xfa62('0x50')]['get']({'plain':!![]});if(!_0xc0af02)throw new Error(_0xfa62('0x51'));if(_0xc0af02[_0xfa62('0x52')]===_0xfa62('0x50')){var _0x220616=_0x274047[_0xfa62('0x26')]({'plain':!![]});var _0x332b25=_0xfa62('0x27');return db[_0xfa62('0x53')][_0xfa62('0x4c')]({'where':{'name':_0x332b25,'userProfileId':_0xc0af02[_0xfa62('0x54')]},'raw':!![]})['then'](function(_0x17fb46){if(_0x17fb46&&_0x17fb46[_0xfa62('0x55')]===0x0){return db[_0xfa62('0x28')][_0xfa62('0x4e')]({'name':_0x220616[_0xfa62('0x2b')],'resourceId':_0x220616['id'],'type':_0x17fb46[_0xfa62('0x2b')],'sectionId':_0x17fb46['id']},{})[_0xfa62('0x24')](function(){return _0x274047;});}else{return _0x274047;}})[_0xfa62('0x4d')](function(_0x389f07){logger[_0xfa62('0x29')](_0xfa62('0x56'),_0x389f07);throw _0x389f07;});}return _0x274047;})['then'](respondWithResult(_0x2d4fe8,0xc9))[_0xfa62('0x4d')](handleError(_0x2d4fe8,null));};exports[_0xfa62('0x23')]=function(_0xfe3253,_0x1f5d90){if(_0xfe3253[_0xfa62('0x4f')]['id']){delete _0xfe3253[_0xfa62('0x4f')]['id'];}return db[_0xfa62('0x44')][_0xfa62('0x4c')]({'where':{'id':_0xfe3253[_0xfa62('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f5d90,null))[_0xfa62('0x24')](saveUpdates(_0xfe3253[_0xfa62('0x4f')],null))[_0xfa62('0x24')](respondWithResult(_0x1f5d90,null))[_0xfa62('0x4d')](handleError(_0x1f5d90,null));};exports[_0xfa62('0x25')]=function(_0x193839,_0x2875c3){return db[_0xfa62('0x44')][_0xfa62('0x4c')]({'where':{'id':_0x193839[_0xfa62('0x48')]['id']}})[_0xfa62('0x24')](handleEntityNotFound(_0x2875c3,null))['then'](removeEntity(_0x2875c3,null))['catch'](handleError(_0x2875c3,null));}; \ No newline at end of file +var _0x4fd0=['get','Pauses','UserProfileResource','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy'];(function(_0x337d97,_0x19c381){var _0x53aa89=function(_0x1ee5eb){while(--_0x1ee5eb){_0x337d97['push'](_0x337d97['shift']());}};_0x53aa89(++_0x19c381);}(_0x4fd0,0x176));var _0x04fd=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x4fd0[_0x403fc7];return _0x5d0827;};'use strict';var pdf=require(_0x04fd('0x0'));var emlformat=require(_0x04fd('0x1'));var rimraf=require(_0x04fd('0x2'));var zipdir=require(_0x04fd('0x3'));var jsonpatch=require(_0x04fd('0x4'));var rp=require('request-promise');var moment=require(_0x04fd('0x5'));var BPromise=require(_0x04fd('0x6'));var Mustache=require(_0x04fd('0x7'));var util=require(_0x04fd('0x8'));var path=require('path');var sox=require(_0x04fd('0x9'));var csv=require(_0x04fd('0xa'));var ejs=require(_0x04fd('0xb'));var fs=require('fs');var _=require(_0x04fd('0xc'));var squel=require(_0x04fd('0xd'));var crypto=require(_0x04fd('0xe'));var jsforce=require(_0x04fd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x04fd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04fd('0x11'));var hardwareService=require(_0x04fd('0x12'));var logger=require(_0x04fd('0x13'))(_0x04fd('0x14'));var utils=require('../../config/utils');var config=require(_0x04fd('0x15'));var licenseUtil=require(_0x04fd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a7e0b,_0x1435e6){_0x1435e6=_0x1435e6||0xcc;return function(_0x5477ab){if(_0x5477ab){return _0x4a7e0b[_0x04fd('0x17')](_0x1435e6);}return _0x4a7e0b[_0x04fd('0x18')](_0x1435e6)[_0x04fd('0x19')]();};}function respondWithResult(_0x379927,_0x103434){_0x103434=_0x103434||0xc8;return function(_0x54e200){if(_0x54e200){return _0x379927['status'](_0x103434)[_0x04fd('0x1a')](_0x54e200);}};}function respondWithFilteredResult(_0x2e9471,_0x4ed8d8){return function(_0x2d4617){if(_0x2d4617){var _0x1f0f0a=_0x2d4617[_0x04fd('0x1b')],_0x2dc7c5=_0x4ed8d8[_0x04fd('0x1c')],_0x152ac6=_0x4ed8d8['offset']+_0x4ed8d8['limit'],_0x3464e5;if(_0x152ac6>=_0x1f0f0a){_0x152ac6=_0x1f0f0a;_0x3464e5=0xc8;}else{_0x3464e5=0xce;}_0x2e9471[_0x04fd('0x18')](_0x3464e5);return _0x2e9471[_0x04fd('0x1d')]('Content-Range',_0x2dc7c5+'-'+_0x152ac6+'/'+_0x1f0f0a)[_0x04fd('0x1a')](_0x2d4617);}return null;};}function patchUpdates(_0x29c6e8){return function(_0x2b29cb){try{jsonpatch[_0x04fd('0x1e')](_0x2b29cb,_0x29c6e8,!![]);}catch(_0x1d0b9c){return BPromise[_0x04fd('0x1f')](_0x1d0b9c);}return _0x2b29cb[_0x04fd('0x20')]();};}function saveUpdates(_0x1c29e1,_0x534205){return function(_0x30bff2){if(_0x30bff2){return _0x30bff2[_0x04fd('0x21')](_0x1c29e1)[_0x04fd('0x22')](function(_0x1797ec){return _0x1797ec;});}return null;};}function removeEntity(_0xca73e,_0x5d053d){return function(_0x40c75e){if(_0x40c75e){return _0x40c75e[_0x04fd('0x23')]()['then'](function(){var _0x172cf7=_0x40c75e[_0x04fd('0x24')]({'plain':!![]});var _0x2a0423=_0x04fd('0x25');return db[_0x04fd('0x26')][_0x04fd('0x23')]({'where':{'type':_0x2a0423,'resourceId':_0x172cf7['id']}})[_0x04fd('0x22')](function(){return _0x40c75e;});})[_0x04fd('0x22')](function(){_0xca73e[_0x04fd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111879,_0x4001f9){return function(_0x387e4a){if(!_0x387e4a){_0x111879[_0x04fd('0x17')](0x194);}return _0x387e4a;};}function handleError(_0x28a9b1,_0x4489eb){_0x4489eb=_0x4489eb||0x1f4;return function(_0x3ab9ca){logger['error'](_0x3ab9ca['stack']);if(_0x3ab9ca[_0x04fd('0x27')]){delete _0x3ab9ca[_0x04fd('0x27')];}_0x28a9b1[_0x04fd('0x18')](_0x4489eb)[_0x04fd('0x28')](_0x3ab9ca);};}exports[_0x04fd('0x29')]=function(_0xc993bd,_0x595793){var _0x575eeb={},_0x37eec4={},_0x35ad15={'count':0x0,'rows':[]};var _0x323a99=_[_0x04fd('0x2a')](db[_0x04fd('0x2b')][_0x04fd('0x2c')],function(_0xfcacbc){return{'name':_0xfcacbc[_0x04fd('0x2d')],'type':_0xfcacbc[_0x04fd('0x2e')][_0x04fd('0x2f')]};});_0x37eec4[_0x04fd('0x30')]=_[_0x04fd('0x2a')](_0x323a99,'name');_0x37eec4['query']=_[_0x04fd('0x31')](_0xc993bd[_0x04fd('0x32')]);_0x37eec4['filters']=_['intersection'](_0x37eec4[_0x04fd('0x30')],_0x37eec4[_0x04fd('0x32')]);_0x575eeb['attributes']=_[_0x04fd('0x33')](_0x37eec4[_0x04fd('0x30')],qs[_0x04fd('0x34')](_0xc993bd[_0x04fd('0x32')][_0x04fd('0x34')]));_0x575eeb[_0x04fd('0x35')]=_0x575eeb[_0x04fd('0x35')][_0x04fd('0x36')]?_0x575eeb[_0x04fd('0x35')]:_0x37eec4[_0x04fd('0x30')];if(!_0xc993bd[_0x04fd('0x32')][_0x04fd('0x37')]('nolimit')){_0x575eeb[_0x04fd('0x38')]=qs[_0x04fd('0x38')](_0xc993bd['query']['limit']);_0x575eeb[_0x04fd('0x1c')]=qs[_0x04fd('0x1c')](_0xc993bd[_0x04fd('0x32')][_0x04fd('0x1c')]);}_0x575eeb[_0x04fd('0x39')]=qs[_0x04fd('0x3a')](_0xc993bd[_0x04fd('0x32')][_0x04fd('0x3a')]);_0x575eeb[_0x04fd('0x3b')]=qs[_0x04fd('0x3c')](_[_0x04fd('0x3d')](_0xc993bd['query'],_0x37eec4['filters']),_0x323a99);if(_0xc993bd[_0x04fd('0x32')][_0x04fd('0x3e')]){_0x575eeb[_0x04fd('0x3b')]=_[_0x04fd('0x3f')](_0x575eeb[_0x04fd('0x3b')],{'$or':_[_0x04fd('0x2a')](_0x323a99,function(_0x5926f4){if(_0x5926f4[_0x04fd('0x2e')]!==_0x04fd('0x40')){var _0x52e427={};_0x52e427[_0x5926f4[_0x04fd('0x27')]]={'$like':'%'+_0xc993bd[_0x04fd('0x32')][_0x04fd('0x3e')]+'%'};return _0x52e427;}})});}_0x575eeb=_[_0x04fd('0x3f')]({},_0x575eeb,_0xc993bd[_0x04fd('0x41')]);var _0x280972={'where':_0x575eeb[_0x04fd('0x3b')]};return db[_0x04fd('0x2b')][_0x04fd('0x1b')](_0x280972)[_0x04fd('0x22')](function(_0x205dde){_0x35ad15['count']=_0x205dde;if(_0xc993bd[_0x04fd('0x32')]['includeAll']){_0x575eeb['include']=[{'all':!![]}];}return db[_0x04fd('0x2b')][_0x04fd('0x42')](_0x575eeb);})[_0x04fd('0x22')](function(_0x4ed622){_0x35ad15[_0x04fd('0x43')]=_0x4ed622;return _0x35ad15;})[_0x04fd('0x22')](respondWithFilteredResult(_0x595793,_0x575eeb))[_0x04fd('0x44')](handleError(_0x595793,null));};exports['show']=function(_0x4b6e22,_0x5ea7ca){var _0x10a659={'raw':!![],'where':{'id':_0x4b6e22[_0x04fd('0x45')]['id']}},_0x4a4b26={};_0x4a4b26['model']=_[_0x04fd('0x31')](db[_0x04fd('0x2b')][_0x04fd('0x2c')]);_0x4a4b26['query']=_[_0x04fd('0x31')](_0x4b6e22[_0x04fd('0x32')]);_0x4a4b26[_0x04fd('0x3c')]=_[_0x04fd('0x33')](_0x4a4b26[_0x04fd('0x30')],_0x4a4b26[_0x04fd('0x32')]);_0x10a659[_0x04fd('0x35')]=_['intersection'](_0x4a4b26[_0x04fd('0x30')],qs[_0x04fd('0x34')](_0x4b6e22['query'][_0x04fd('0x34')]));_0x10a659[_0x04fd('0x35')]=_0x10a659[_0x04fd('0x35')]['length']?_0x10a659[_0x04fd('0x35')]:_0x4a4b26['model'];if(_0x4b6e22[_0x04fd('0x32')]['includeAll']){_0x10a659[_0x04fd('0x46')]=[{'all':!![]}];}_0x10a659=_[_0x04fd('0x3f')]({},_0x10a659,_0x4b6e22['options']);return db[_0x04fd('0x2b')][_0x04fd('0x47')](_0x10a659)['then'](handleEntityNotFound(_0x5ea7ca,null))['then'](respondWithResult(_0x5ea7ca,null))[_0x04fd('0x44')](handleError(_0x5ea7ca,null));};exports['create']=function(_0x386786,_0x5812da){return db[_0x04fd('0x2b')]['create'](_0x386786[_0x04fd('0x48')],{})[_0x04fd('0x22')](function(_0x2ef86b){var _0xc78269=_0x386786[_0x04fd('0x49')][_0x04fd('0x24')]({'plain':!![]});if(!_0xc78269)throw new Error(_0x04fd('0x4a'));if(_0xc78269[_0x04fd('0x4b')]===_0x04fd('0x49')){var _0x13e3b1=_0x2ef86b[_0x04fd('0x24')]({'plain':!![]});var _0x59ce50=_0x04fd('0x25');return db[_0x04fd('0x4c')][_0x04fd('0x47')]({'where':{'name':_0x59ce50,'userProfileId':_0xc78269[_0x04fd('0x4d')]},'raw':!![]})[_0x04fd('0x22')](function(_0x466244){if(_0x466244&&_0x466244[_0x04fd('0x4e')]===0x0){return db[_0x04fd('0x26')][_0x04fd('0x4f')]({'name':_0x13e3b1[_0x04fd('0x27')],'resourceId':_0x13e3b1['id'],'type':_0x466244[_0x04fd('0x27')],'sectionId':_0x466244['id']},{})[_0x04fd('0x22')](function(){return _0x2ef86b;});}else{return _0x2ef86b;}})[_0x04fd('0x44')](function(_0x555346){logger[_0x04fd('0x50')](_0x04fd('0x51'),_0x555346);throw _0x555346;});}return _0x2ef86b;})[_0x04fd('0x22')](respondWithResult(_0x5812da,0xc9))[_0x04fd('0x44')](handleError(_0x5812da,null));};exports[_0x04fd('0x21')]=function(_0x4a566f,_0x2c9cd9){if(_0x4a566f[_0x04fd('0x48')]['id']){delete _0x4a566f['body']['id'];}return db['Pause'][_0x04fd('0x47')]({'where':{'id':_0x4a566f[_0x04fd('0x45')]['id']}})[_0x04fd('0x22')](handleEntityNotFound(_0x2c9cd9,null))['then'](saveUpdates(_0x4a566f[_0x04fd('0x48')],null))['then'](respondWithResult(_0x2c9cd9,null))[_0x04fd('0x44')](handleError(_0x2c9cd9,null));};exports[_0x04fd('0x23')]=function(_0x3918d5,_0x495ae1){return db[_0x04fd('0x2b')]['find']({'where':{'id':_0x3918d5[_0x04fd('0x45')]['id']}})['then'](handleEntityNotFound(_0x495ae1,null))[_0x04fd('0x22')](removeEntity(_0x495ae1,null))['catch'](handleError(_0x495ae1,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 382c47e..df6edb4 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 _0x0424=['./pause.attributes','exports','define','Pause','tools_pauses','../../config/logger','api','moment','bluebird','path'];(function(_0x1bf0cd,_0x5b34e4){var _0x38090=function(_0x532a96){while(--_0x532a96){_0x1bf0cd['push'](_0x1bf0cd['shift']());}};_0x38090(++_0x5b34e4);}(_0x0424,0x159));var _0x4042=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x0424[_0x43a6cd];return _0x5acb36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x199d=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./pause.attributes','Pause','tools_pauses','lodash','util'];(function(_0x397da6,_0x444b8d){var _0x604023=function(_0x27d65e){while(--_0x27d65e){_0x397da6['push'](_0x397da6['shift']());}};_0x604023(++_0x444b8d);}(_0x199d,0x13d));var _0xd199=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0x199d[_0xf34895];return _0x143f44;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var logger=require(_0xd199('0x2'))(_0xd199('0x3'));var moment=require(_0xd199('0x4'));var BPromise=require('bluebird');var rp=require(_0xd199('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd199('0x6'));var config=require(_0xd199('0x7'));var attributes=require(_0xd199('0x8'));module['exports']=function(_0x44dc53,_0x16825f){return _0x44dc53['define'](_0xd199('0x9'),attributes,{'tableName':_0xd199('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index cd53226..44ca8e7 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 _0xda79=['options','where','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowPause','Pause','find'];(function(_0x1dcc9a,_0x29cd4b){var _0x572f23=function(_0x154a60){while(--_0x154a60){_0x1dcc9a['push'](_0x1dcc9a['shift']());}};_0x572f23(++_0x29cd4b);}(_0xda79,0x82));var _0x9da7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xda79[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var moment=require('moment');var BPromise=require(_0x9da7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9da7('0x3'));var db=require(_0x9da7('0x4'))['db'];var utils=require(_0x9da7('0x5'));var logger=require('../../config/logger')(_0x9da7('0x6'));var config=require(_0x9da7('0x7'));var jayson=require(_0x9da7('0x8'));var client=jayson[_0x9da7('0x9')][_0x9da7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cfb66,_0x3fc0ba,_0x558307){return new BPromise(function(_0x5cd11e,_0x116acf){return client['request'](_0x1cfb66,_0x558307)[_0x9da7('0xb')](function(_0x3b65f6){logger[_0x9da7('0xc')](_0x9da7('0xd'),_0x3fc0ba,_0x9da7('0xe'));logger[_0x9da7('0xf')]('Pause,\x20%s,\x20%s,\x20%s',_0x3fc0ba,_0x9da7('0xe'),JSON[_0x9da7('0x10')](_0x3b65f6));if(_0x3b65f6[_0x9da7('0x11')]){if(_0x3b65f6['error'][_0x9da7('0x12')]===0x1f4){logger[_0x9da7('0x11')](_0x9da7('0xd'),_0x3fc0ba,_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);return _0x116acf(_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);}logger[_0x9da7('0x11')]('Pause,\x20%s,\x20%s',_0x3fc0ba,_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);return _0x5cd11e(_0x3b65f6[_0x9da7('0x11')]['message']);}else{logger[_0x9da7('0xc')](_0x9da7('0xd'),_0x3fc0ba,_0x9da7('0xe'));_0x5cd11e(_0x3b65f6[_0x9da7('0x14')][_0x9da7('0x13')]);}})[_0x9da7('0x15')](function(_0x1c9068){logger['error'](_0x9da7('0xd'),_0x3fc0ba,_0x1c9068);_0x116acf(_0x1c9068);});});}exports[_0x9da7('0x16')]=function(_0x5b481d){var _0x29f89c=this;return new Promise(function(_0xbe32c5,_0x128245){return db[_0x9da7('0x17')][_0x9da7('0x18')]({'raw':_0x5b481d[_0x9da7('0x19')]?_0x5b481d[_0x9da7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b481d['options']?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1a')]||null:null,'attributes':_0x5b481d['options']?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1b')]||null:null,'include':_0x5b481d[_0x9da7('0x19')]?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1c')]?_['map'](_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1c')],function(_0x1b715d){return{'model':db[_0x1b715d['model']],'as':_0x1b715d['as'],'attributes':_0x1b715d['attributes'],'include':_0x1b715d['include']?_[_0x9da7('0x1d')](_0x1b715d['include'],function(_0x5751ed){return{'model':db[_0x5751ed['model']],'as':_0x5751ed['as'],'attributes':_0x5751ed[_0x9da7('0x1b')],'include':_0x5751ed[_0x9da7('0x1c')]?_[_0x9da7('0x1d')](_0x5751ed[_0x9da7('0x1c')],function(_0x2c77cc){return{'model':db[_0x2c77cc[_0x9da7('0x1e')]],'as':_0x2c77cc['as'],'attributes':_0x2c77cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x9da7('0xb')](function(_0x407775){logger[_0x9da7('0xc')](_0x9da7('0x16'),_0x5b481d);logger['debug'](_0x9da7('0x16'),_0x5b481d,JSON['stringify'](_0x407775));_0xbe32c5(_0x407775);})[_0x9da7('0x15')](function(_0xfdc095){logger[_0x9da7('0x11')](_0x9da7('0x16'),_0xfdc095[_0x9da7('0x13')],_0x5b481d);_0x128245(_0x29f89c[_0x9da7('0x11')](0x1f4,_0xfdc095[_0x9da7('0x13')]));});});}; \ No newline at end of file +var _0xeadc=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','raw','options','where','attributes','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c7e8a,_0x44bda3){var _0x396a48=function(_0xc8de){while(--_0xc8de){_0x1c7e8a['push'](_0x1c7e8a['shift']());}};_0x396a48(++_0x44bda3);}(_0xeadc,0xdf));var _0xcead=function(_0x3ffb61,_0x1969e0){_0x3ffb61=_0x3ffb61-0x0;var _0x1fca08=_0xeadc[_0x3ffb61];return _0x1fca08;};'use strict';var _=require(_0xcead('0x0'));var util=require('util');var moment=require(_0xcead('0x1'));var BPromise=require('bluebird');var rs=require(_0xcead('0x2'));var fs=require('fs');var Redis=require(_0xcead('0x3'));var db=require(_0xcead('0x4'))['db'];var utils=require(_0xcead('0x5'));var logger=require(_0xcead('0x6'))(_0xcead('0x7'));var config=require(_0xcead('0x8'));var jayson=require(_0xcead('0x9'));var client=jayson[_0xcead('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26a4f5,_0x236ab2,_0x617299){return new BPromise(function(_0x45f9cd,_0x4873cc){return client[_0xcead('0xb')](_0x26a4f5,_0x617299)[_0xcead('0xc')](function(_0x3bc4e0){logger[_0xcead('0xd')]('Pause,\x20%s,\x20%s',_0x236ab2,_0xcead('0xe'));logger['debug'](_0xcead('0xf'),_0x236ab2,_0xcead('0xe'),JSON[_0xcead('0x10')](_0x3bc4e0));if(_0x3bc4e0['error']){if(_0x3bc4e0[_0xcead('0x11')][_0xcead('0x12')]===0x1f4){logger[_0xcead('0x11')](_0xcead('0x13'),_0x236ab2,_0x3bc4e0[_0xcead('0x11')][_0xcead('0x14')]);return _0x4873cc(_0x3bc4e0['error'][_0xcead('0x14')]);}logger[_0xcead('0x11')](_0xcead('0x13'),_0x236ab2,_0x3bc4e0['error']['message']);return _0x45f9cd(_0x3bc4e0['error'][_0xcead('0x14')]);}else{logger[_0xcead('0xd')](_0xcead('0x13'),_0x236ab2,'request\x20sent');_0x45f9cd(_0x3bc4e0[_0xcead('0x15')][_0xcead('0x14')]);}})[_0xcead('0x16')](function(_0x32d3c4){logger[_0xcead('0x11')](_0xcead('0x13'),_0x236ab2,_0x32d3c4);_0x4873cc(_0x32d3c4);});});}exports[_0xcead('0x17')]=function(_0x241635){var _0x43cab6=this;return new Promise(function(_0x5d55ef,_0x47570e){return db[_0xcead('0x18')]['find']({'raw':_0x241635['options']?_0x241635['options'][_0xcead('0x19')]===undefined?!![]:![]:!![],'where':_0x241635['options']?_0x241635[_0xcead('0x1a')][_0xcead('0x1b')]||null:null,'attributes':_0x241635[_0xcead('0x1a')]?_0x241635[_0xcead('0x1a')][_0xcead('0x1c')]||null:null,'include':_0x241635[_0xcead('0x1a')]?_0x241635[_0xcead('0x1a')][_0xcead('0x1d')]?_[_0xcead('0x1e')](_0x241635['options'][_0xcead('0x1d')],function(_0x5d1242){return{'model':db[_0x5d1242[_0xcead('0x1f')]],'as':_0x5d1242['as'],'attributes':_0x5d1242['attributes'],'include':_0x5d1242['include']?_['map'](_0x5d1242[_0xcead('0x1d')],function(_0x193eee){return{'model':db[_0x193eee[_0xcead('0x1f')]],'as':_0x193eee['as'],'attributes':_0x193eee[_0xcead('0x1c')],'include':_0x193eee[_0xcead('0x1d')]?_['map'](_0x193eee[_0xcead('0x1d')],function(_0x2318bf){return{'model':db[_0x2318bf['model']],'as':_0x2318bf['as'],'attributes':_0x2318bf[_0xcead('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcead('0xc')](function(_0x381a58){logger[_0xcead('0xd')]('ShowPause',_0x241635);logger[_0xcead('0x20')](_0xcead('0x17'),_0x241635,JSON['stringify'](_0x381a58));_0x5d55ef(_0x381a58);})[_0xcead('0x16')](function(_0x2e6f74){logger[_0xcead('0x11')](_0xcead('0x17'),_0x2e6f74[_0xcead('0x14')],_0x241635);_0x47570e(_0x43cab6[_0xcead('0x11')](0x1f4,_0x2e6f74[_0xcead('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 59e96dd..a1c0062 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 _0x9b38=['%s-%s%s','now','extname','single','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','replace','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b38,0x1b7));var _0x89b3=function(_0x665870,_0x42ab57){_0x665870=_0x665870-0x0;var _0x317721=_0x9b38[_0x665870];return _0x317721;};'use strict';var multer=require(_0x89b3('0x0'));var util=require(_0x89b3('0x1'));var path=require(_0x89b3('0x2'));var timeout=require(_0x89b3('0x3'));var express=require(_0x89b3('0x4'));var router=express[_0x89b3('0x5')]();var auth=require(_0x89b3('0x6'));var interaction=require(_0x89b3('0x7'));var config=require(_0x89b3('0x8'));var controller=require('./plugin.controller');router[_0x89b3('0x9')]('/',auth[_0x89b3('0xa')](),controller['index']);router[_0x89b3('0x9')](_0x89b3('0xb'),controller[_0x89b3('0xc')]);router[_0x89b3('0x9')](_0x89b3('0xd'),auth['isAuthenticated'](),controller[_0x89b3('0xe')]);router[_0x89b3('0x9')](_0x89b3('0xf'),auth[_0x89b3('0xa')](),controller[_0x89b3('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1948a6,_0x52dfed,_0x509303){_0x509303(null,path[_0x89b3('0x11')](config[_0x89b3('0x12')],_0x89b3('0x13')));},'filename':function(_0x24cb27,_0x314481,_0x580627){_0x314481[_0x89b3('0x14')]=_0x314481[_0x89b3('0x14')][_0x89b3('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x580627(null,util[_0x89b3('0x16')](_0x89b3('0x17'),path['basename'](_0x314481[_0x89b3('0x14')],path['extname'](_0x314481['originalname'])),Date[_0x89b3('0x18')](),path[_0x89b3('0x19')](_0x314481[_0x89b3('0x14')])));}})});router['post']('/',upload[_0x89b3('0x1a')]('file'),controller['upload']);router[_0x89b3('0x1b')]('/webhook',controller[_0x89b3('0x1c')]);router[_0x89b3('0x1d')](_0x89b3('0xd'),auth[_0x89b3('0xa')](),controller[_0x89b3('0x1e')]);router['delete'](_0x89b3('0xd'),auth[_0x89b3('0xa')](),controller[_0x89b3('0x1f')]);module[_0x89b3('0x20')]=router; \ No newline at end of file +var _0xa3e8=['/:id','show','/:id/download','join','root','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','put','update','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet'];(function(_0x439b2f,_0x48b320){var _0x2d5910=function(_0x2d2913){while(--_0x2d2913){_0x439b2f['push'](_0x439b2f['shift']());}};_0x2d5910(++_0x48b320);}(_0xa3e8,0x186));var _0x8a3e=function(_0xaacc18,_0x502187){_0xaacc18=_0xaacc18-0x0;var _0x28bbac=_0xa3e8[_0xaacc18];return _0x28bbac;};'use strict';var multer=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var path=require('path');var timeout=require(_0x8a3e('0x2'));var express=require(_0x8a3e('0x3'));var router=express[_0x8a3e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8a3e('0x5'));var config=require(_0x8a3e('0x6'));var controller=require(_0x8a3e('0x7'));router[_0x8a3e('0x8')]('/',auth[_0x8a3e('0x9')](),controller[_0x8a3e('0xa')]);router[_0x8a3e('0x8')](_0x8a3e('0xb'),controller[_0x8a3e('0xc')]);router['get'](_0x8a3e('0xd'),auth[_0x8a3e('0x9')](),controller[_0x8a3e('0xe')]);router[_0x8a3e('0x8')](_0x8a3e('0xf'),auth[_0x8a3e('0x9')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b47de,_0x1fe891,_0x5a477b){_0x5a477b(null,path[_0x8a3e('0x10')](config[_0x8a3e('0x11')],_0x8a3e('0x12')));},'filename':function(_0xe52cd4,_0x1842fb,_0x5175b9){_0x1842fb[_0x8a3e('0x13')]=_0x1842fb[_0x8a3e('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5175b9(null,util[_0x8a3e('0x14')]('%s-%s%s',path[_0x8a3e('0x15')](_0x1842fb['originalname'],path[_0x8a3e('0x16')](_0x1842fb[_0x8a3e('0x13')])),Date[_0x8a3e('0x17')](),path['extname'](_0x1842fb[_0x8a3e('0x13')])));}})});router[_0x8a3e('0x18')]('/',upload[_0x8a3e('0x19')](_0x8a3e('0x1a')),controller[_0x8a3e('0x1b')]);router[_0x8a3e('0x18')](_0x8a3e('0xb'),controller['webhookPost']);router[_0x8a3e('0x1c')](_0x8a3e('0xd'),auth[_0x8a3e('0x9')](),controller[_0x8a3e('0x1d')]);router[_0x8a3e('0x1e')](_0x8a3e('0xd'),auth[_0x8a3e('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 961c71b..611cbdf 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 _0x9354=['BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9354,0x10a));var _0x4935=function(_0x41886e,_0x2f9b3e){_0x41886e=_0x41886e-0x0;var _0x10e7f4=_0x9354[_0x41886e];return _0x10e7f4;};'use strict';var Sequelize=require(_0x4935('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4935('0x1')](_0x4935('0x2'),_0x4935('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x4935('0x4')]},'path':{'type':Sequelize[_0x4935('0x5')],'comment':_0x4935('0x6')},'active':{'type':Sequelize[_0x4935('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x4935('0x8'),_0x4935('0x9'),_0x4935('0xa'),_0x4935('0xb')),'defaultValue':_0x4935('0xa'),'comment':_0x4935('0xc')},'icon':{'type':Sequelize[_0x4935('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x4935('0x5')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x4935('0x5')]}}; \ No newline at end of file +var _0x4ddb=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly'];(function(_0x2c6c54,_0x1f99c9){var _0x3cc4fe=function(_0xe971a1){while(--_0xe971a1){_0x2c6c54['push'](_0x2c6c54['shift']());}};_0x3cc4fe(++_0x1f99c9);}(_0x4ddb,0x107));var _0xb4dd=function(_0x2912b9,_0x55e6e1){_0x2912b9=_0x2912b9-0x0;var _0x154da8=_0x4ddb[_0x2912b9];return _0x154da8;};'use strict';var Sequelize=require(_0xb4dd('0x0'));module[_0xb4dd('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb4dd('0x2')]('html','script')},'description':{'type':Sequelize[_0xb4dd('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xb4dd('0x4')],'comment':_0xb4dd('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb4dd('0x2')](_0xb4dd('0x6'),_0xb4dd('0x7'),_0xb4dd('0x8'),'never'),'defaultValue':_0xb4dd('0x8'),'comment':_0xb4dd('0x9')},'icon':{'type':Sequelize[_0xb4dd('0x4')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xb4dd('0x4')]},'scriptName':{'type':Sequelize[_0xb4dd('0x4')]},'scriptPath':{'type':Sequelize[_0xb4dd('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3fb74f5..64cf1f3 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 _0x41fb=['attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','include','findAll','rows','show','params','fields','includeAll','find','catch','download','path','root','server/files/plugins','format','%s.zip','basename','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptName','test','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','set','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','then','destroy','Plugins','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0x41fb,0x1bc));var _0xb41f=function(_0x26c115,_0x29d327){_0x26c115=_0x26c115-0x0;var _0xf6dece=_0x41fb[_0x26c115];return _0xf6dece;};'use strict';var pdf=require(_0xb41f('0x0'));var emlformat=require(_0xb41f('0x1'));var rimraf=require(_0xb41f('0x2'));var zipdir=require(_0xb41f('0x3'));var jsonpatch=require(_0xb41f('0x4'));var rp=require(_0xb41f('0x5'));var moment=require(_0xb41f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb41f('0x7'));var util=require(_0xb41f('0x8'));var path=require('path');var sox=require(_0xb41f('0x9'));var csv=require(_0xb41f('0xa'));var ejs=require(_0xb41f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb41f('0xc'));var crypto=require(_0xb41f('0xd'));var jsforce=require(_0xb41f('0xe'));var deskjs=require(_0xb41f('0xf'));var toCsv=require(_0xb41f('0xa'));var querystring=require(_0xb41f('0x10'));var Papa=require(_0xb41f('0x11'));var extract=require('extract-zip');var rimraf=require(_0xb41f('0x2'));var archiver=require(_0xb41f('0x12'));var Redis=require(_0xb41f('0x13'));var authService=require(_0xb41f('0x14'));var qs=require(_0xb41f('0x15'));var as=require(_0xb41f('0x16'));var hardwareService=require(_0xb41f('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb41f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb41f('0x19'))['db'];config[_0xb41f('0x1a')]=_[_0xb41f('0x1b')](config[_0xb41f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb41f('0x1c'))(new Redis(config[_0xb41f('0x1a')]));require(_0xb41f('0x1d'))[_0xb41f('0x1e')](socket);function respondWithStatusCode(_0x3699a2,_0x3d7a76){_0x3d7a76=_0x3d7a76||0xcc;return function(_0x468b6b){if(_0x468b6b){return _0x3699a2[_0xb41f('0x1f')](_0x3d7a76);}return _0x3699a2[_0xb41f('0x20')](_0x3d7a76)['end']();};}function respondWithResult(_0xb0fd07,_0x466690){_0x466690=_0x466690||0xc8;return function(_0x124d49){if(_0x124d49){return _0xb0fd07[_0xb41f('0x20')](_0x466690)['json'](_0x124d49);}};}function respondWithFilteredResult(_0x3a8f95,_0x5061c8){return function(_0x2b33cf){if(_0x2b33cf){var _0x4421d3=_0x2b33cf[_0xb41f('0x21')],_0x19e03b=_0x5061c8[_0xb41f('0x22')],_0x238f1f=_0x5061c8[_0xb41f('0x22')]+_0x5061c8['limit'],_0x3ea2a8;if(_0x238f1f>=_0x4421d3){_0x238f1f=_0x4421d3;_0x3ea2a8=0xc8;}else{_0x3ea2a8=0xce;}_0x3a8f95['status'](_0x3ea2a8);return _0x3a8f95['set'](_0xb41f('0x23'),_0x19e03b+'-'+_0x238f1f+'/'+_0x4421d3)[_0xb41f('0x24')](_0x2b33cf);}return null;};}function patchUpdates(_0x45d8c5){return function(_0x208a35){try{jsonpatch[_0xb41f('0x25')](_0x208a35,_0x45d8c5,!![]);}catch(_0x2c8b29){return BPromise[_0xb41f('0x26')](_0x2c8b29);}return _0x208a35[_0xb41f('0x27')]();};}function saveUpdates(_0x1810f9,_0x5ca75a){return function(_0x3dc97e){if(_0x3dc97e){return _0x3dc97e['update'](_0x1810f9)[_0xb41f('0x28')](function(_0x3b0678){return _0x3b0678;});}return null;};}function removeEntity(_0x2798e6,_0x419626){return function(_0x47ccf8){if(_0x47ccf8){return _0x47ccf8[_0xb41f('0x29')]()[_0xb41f('0x28')](function(){var _0x9bd52b=_0x47ccf8['get']({'plain':!![]});var _0x580f38=_0xb41f('0x2a');return db[_0xb41f('0x2b')][_0xb41f('0x29')]({'where':{'type':_0x580f38,'resourceId':_0x9bd52b['id']}})['then'](function(){return _0x47ccf8;});})[_0xb41f('0x28')](function(){_0x2798e6[_0xb41f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4114f8,_0x2a79c7){return function(_0x58c867){if(!_0x58c867){_0x4114f8[_0xb41f('0x1f')](0x194);}return _0x58c867;};}function handleError(_0x37a268,_0x17d725){_0x17d725=_0x17d725||0x1f4;return function(_0x10bb77){logger[_0xb41f('0x2c')](_0x10bb77[_0xb41f('0x2d')]);if(_0x10bb77[_0xb41f('0x2e')]){delete _0x10bb77[_0xb41f('0x2e')];}_0x37a268['status'](_0x17d725)['send'](_0x10bb77);};}exports[_0xb41f('0x2f')]=function(_0x1e2906,_0x3265c9){var _0x598b8c={},_0x30aca8={},_0x142abd={'count':0x0,'rows':[]};var _0x59ba24=_[_0xb41f('0x30')](db['Plugin'][_0xb41f('0x31')],function(_0x4d73e9){return{'name':_0x4d73e9['fieldName'],'type':_0x4d73e9[_0xb41f('0x32')][_0xb41f('0x33')]};});_0x30aca8['model']=_['map'](_0x59ba24,_0xb41f('0x2e'));_0x30aca8[_0xb41f('0x34')]=_[_0xb41f('0x35')](_0x1e2906['query']);_0x30aca8[_0xb41f('0x36')]=_[_0xb41f('0x37')](_0x30aca8[_0xb41f('0x38')],_0x30aca8[_0xb41f('0x34')]);_0x598b8c[_0xb41f('0x39')]=_['intersection'](_0x30aca8[_0xb41f('0x38')],qs['fields'](_0x1e2906[_0xb41f('0x34')]['fields']));_0x598b8c[_0xb41f('0x39')]=_0x598b8c[_0xb41f('0x39')][_0xb41f('0x3a')]?_0x598b8c[_0xb41f('0x39')]:_0x30aca8[_0xb41f('0x38')];if(!_0x1e2906[_0xb41f('0x34')]['hasOwnProperty'](_0xb41f('0x3b'))){_0x598b8c[_0xb41f('0x3c')]=qs[_0xb41f('0x3c')](_0x1e2906[_0xb41f('0x34')][_0xb41f('0x3c')]);_0x598b8c['offset']=qs[_0xb41f('0x22')](_0x1e2906[_0xb41f('0x34')][_0xb41f('0x22')]);}_0x598b8c[_0xb41f('0x3d')]=qs[_0xb41f('0x3e')](_0x1e2906[_0xb41f('0x34')][_0xb41f('0x3e')]);_0x598b8c[_0xb41f('0x3f')]=qs[_0xb41f('0x36')](_[_0xb41f('0x40')](_0x1e2906['query'],_0x30aca8[_0xb41f('0x36')]),_0x59ba24);if(_0x1e2906[_0xb41f('0x34')][_0xb41f('0x41')]){_0x598b8c[_0xb41f('0x3f')]=_[_0xb41f('0x42')](_0x598b8c[_0xb41f('0x3f')],{'$or':_[_0xb41f('0x30')](_0x59ba24,function(_0x1658e0){if(_0x1658e0[_0xb41f('0x32')]!==_0xb41f('0x43')){var _0x3a2df7={};_0x3a2df7[_0x1658e0[_0xb41f('0x2e')]]={'$like':'%'+_0x1e2906[_0xb41f('0x34')][_0xb41f('0x41')]+'%'};return _0x3a2df7;}})});}_0x598b8c=_[_0xb41f('0x42')]({},_0x598b8c,_0x1e2906[_0xb41f('0x44')]);var _0x207ac0={'where':_0x598b8c[_0xb41f('0x3f')]};return db[_0xb41f('0x45')]['count'](_0x207ac0)[_0xb41f('0x28')](function(_0xdc286e){_0x142abd[_0xb41f('0x21')]=_0xdc286e;if(_0x1e2906[_0xb41f('0x34')]['includeAll']){_0x598b8c[_0xb41f('0x46')]=[{'all':!![]}];}return db[_0xb41f('0x45')][_0xb41f('0x47')](_0x598b8c);})[_0xb41f('0x28')](function(_0x44dfa8){_0x142abd[_0xb41f('0x48')]=_0x44dfa8;return _0x142abd;})[_0xb41f('0x28')](respondWithFilteredResult(_0x3265c9,_0x598b8c))['catch'](handleError(_0x3265c9,null));};exports[_0xb41f('0x49')]=function(_0x3d58f5,_0x722a07){var _0x3df4bf={'raw':!![],'where':{'id':_0x3d58f5[_0xb41f('0x4a')]['id']}},_0x3f8f55={};_0x3f8f55[_0xb41f('0x38')]=_[_0xb41f('0x35')](db[_0xb41f('0x45')][_0xb41f('0x31')]);_0x3f8f55[_0xb41f('0x34')]=_['keys'](_0x3d58f5[_0xb41f('0x34')]);_0x3f8f55[_0xb41f('0x36')]=_[_0xb41f('0x37')](_0x3f8f55[_0xb41f('0x38')],_0x3f8f55['query']);_0x3df4bf[_0xb41f('0x39')]=_[_0xb41f('0x37')](_0x3f8f55[_0xb41f('0x38')],qs[_0xb41f('0x4b')](_0x3d58f5[_0xb41f('0x34')][_0xb41f('0x4b')]));_0x3df4bf[_0xb41f('0x39')]=_0x3df4bf[_0xb41f('0x39')][_0xb41f('0x3a')]?_0x3df4bf['attributes']:_0x3f8f55['model'];if(_0x3d58f5[_0xb41f('0x34')][_0xb41f('0x4c')]){_0x3df4bf[_0xb41f('0x46')]=[{'all':!![]}];}_0x3df4bf=_['merge']({},_0x3df4bf,_0x3d58f5[_0xb41f('0x44')]);return db[_0xb41f('0x45')][_0xb41f('0x4d')](_0x3df4bf)[_0xb41f('0x28')](handleEntityNotFound(_0x722a07,null))[_0xb41f('0x28')](respondWithResult(_0x722a07,null))[_0xb41f('0x4e')](handleError(_0x722a07,null));};exports[_0xb41f('0x4f')]=function(_0x2fe2d1,_0x564fe2,_0x170738){return db[_0xb41f('0x45')]['find']({'where':{'id':_0x2fe2d1[_0xb41f('0x4a')]['id']},'attributes':[_0xb41f('0x2e'),_0xb41f('0x50')],'raw':!![]})[_0xb41f('0x28')](handleEntityNotFound(_0x564fe2,null))['then'](function(_0x31c6eb){if(_0x31c6eb){var _0x535a51=path['join'](config[_0xb41f('0x51')],_0xb41f('0x52'),util[_0xb41f('0x53')](_0xb41f('0x54'),path[_0xb41f('0x55')](_0x31c6eb[_0xb41f('0x50')])));var _0x18dc66=fs['createWriteStream'](_0x535a51);var _0xefb49c=archiver(_0xb41f('0x56'),{'zlib':{'level':0x9}});_0xefb49c['on'](_0xb41f('0x57'),function(_0x14bd34){if(_0x14bd34['code']===_0xb41f('0x58')){logger[_0xb41f('0x2c')](_0x14bd34);}else{throw new db[(_0xb41f('0x59'))][(_0xb41f('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xefb49c['on'](_0xb41f('0x2c'),function(_0xb01da8){throw new db[(_0xb41f('0x59'))]['Error'](_0xb41f('0x5b'));});_0xefb49c[_0xb41f('0x5c')](_0x18dc66);_0xefb49c['glob'](_0xb41f('0x5d'),{'cwd':path[_0xb41f('0x5e')](config[_0xb41f('0x51')],_0xb41f('0x52'),path[_0xb41f('0x5f')](_0x31c6eb[_0xb41f('0x50')])),'ignore':[path[_0xb41f('0x5e')](path['basename'](_0x31c6eb[_0xb41f('0x50')]),_0xb41f('0x60')),path[_0xb41f('0x5e')](path['basename'](_0x31c6eb[_0xb41f('0x50')]),_0xb41f('0x61'))],'nodir':!![]})[_0xb41f('0x62')]();_0x18dc66['on']('close',function(){if(!fs['existsSync'](_0x535a51)){throw new db[(_0xb41f('0x59'))][(_0xb41f('0x5a'))](_0xb41f('0x63'));}return _0x564fe2['download'](_0x535a51,util[_0xb41f('0x53')]('%s.zip',path[_0xb41f('0x55')](_0x31c6eb[_0xb41f('0x50')])),function(_0x5e9e32){if(_0x5e9e32){throw new db['Sequelize'][(_0xb41f('0x5a'))](_0xb41f('0x64'));}fs[_0xb41f('0x65')](_0x535a51);logger[_0xb41f('0x66')](_0xb41f('0x67'));logger['info'](_0xb41f('0x68'));});});}return null;})[_0xb41f('0x4e')](handleError(_0x564fe2,null));};exports[_0xb41f('0x69')]=function(_0x3ab9cf,_0x13e4a2,_0x1d1feb){var _0x34c05f=path[_0xb41f('0x55')](_0x3ab9cf[_0xb41f('0x6a')][_0xb41f('0x6b')],path['extname'](_0x3ab9cf[_0xb41f('0x6a')]['filename']));var _0x953f=path[_0xb41f('0x5e')](config['root'],_0xb41f('0x52'),_0x3ab9cf[_0xb41f('0x6a')]['filename']);var _0x5996a8=path['join'](config[_0xb41f('0x51')],_0xb41f('0x52'),_0x34c05f);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x953f);logger[_0xb41f('0x66')](_0xb41f('0x6c'),_0x5996a8);try{fs[_0xb41f('0x6d')](_0x953f,parseInt(_0xb41f('0x6e'),0x8));extract(_0x953f,{'dir':_0x5996a8},function(_0x5b1aab){if(_0x5b1aab){logger[_0xb41f('0x2c')](_0x5b1aab);handleError(_0x5b1aab,!![]);};var _0x465a9c=fs[_0xb41f('0x6f')](_0x5996a8);if(_0x465a9c[_0xb41f('0x3a')]>0x1){removeReferences(_0x953f,_0x5996a8);logger[_0xb41f('0x2c')]('Invalid\x20plugin\x20structure');return _0x1d1feb(new Error('Invalid\x20plugin\x20structure'));}var _0x37ac5d=fs['lstatSync'](path[_0xb41f('0x5e')](_0x5996a8,_0x465a9c[0x0]));if(_0x37ac5d[_0xb41f('0x70')]()){removeReferences(_0x953f,_0x5996a8);logger['error'](_0xb41f('0x71'));return _0x1d1feb(new Error(_0xb41f('0x71')));}if(_0x37ac5d[_0xb41f('0x72')]()){var _0x5104b0=fs[_0xb41f('0x6f')](path[_0xb41f('0x5e')](_0x5996a8,_0x465a9c[0x0]));if(_0x5104b0[_0xb41f('0x3a')]===0x0){removeReferences(_0x953f,_0x5996a8);logger[_0xb41f('0x2c')](_0xb41f('0x71'));return _0x1d1feb(new Error(_0xb41f('0x71')));}var _0x159e52=_0x5104b0[_0xb41f('0x73')](function(_0x247f54){return _0x247f54===_0xb41f('0x74');});if(!_0x159e52){return _0x1d1feb(new Error(_0xb41f('0x75')));}var _0x393055=fs[_0xb41f('0x76')](path[_0xb41f('0x5e')](_0x5996a8,_0x465a9c[0x0],_0xb41f('0x74')));var _0xe246ab=JSON['parse'](_0x393055);if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x2e')]){return _0x1d1feb(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x32')]){return _0x1d1feb(new Error(_0xb41f('0x78')));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x79')]){return _0x1d1feb(new Error(_0xb41f('0x7a')));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')]){return _0x1d1feb(new Error(_0xb41f('0x7c')));}if(_0xe246ab[_0xb41f('0x32')]===_0xb41f('0x7d')){if('undefined'==typeof _0xe246ab['parameters'][_0xb41f('0x7e')]){return _0x1d1feb(new Error(_0xb41f('0x7f')));}if('undefined'==typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')]&&_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')]){return _0x1d1feb(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xe246ab[_0xb41f('0x32')]===_0xb41f('0x82')){if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')]['scriptName']){return _0x1d1feb(new Error(_0xb41f('0x83')));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x84')]){return _0x1d1feb(new Error(_0xb41f('0x85')));}}else{return _0x1d1feb(new Error(_0xb41f('0x86')));}var _0x33ffde=_0xe246ab[_0xb41f('0x2e')];var _0x1ede00=_0xe246ab['description'];var _0x35edc7=_0xe246ab['type'];var _0x234e7d=_0xe246ab[_0xb41f('0x87')]?_0xe246ab[_0xb41f('0x87')]:'always';var _0x3dc5e8=_0xe246ab[_0xb41f('0x88')]?_0xe246ab[_0xb41f('0x88')]:_0xb41f('0x89');var _0x5e110b='';var _0x46aca2='';var _0x10826e='';var _0x1d61af='';var _0x51ec91=_0xe246ab['version'];if(_0x35edc7===_0xb41f('0x7d')){if(_0xb41f('0x77')!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')]){var _0x53602f=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x53602f)){_0x5e110b=path[_0xb41f('0x5e')](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x53602f);}else{_0x5e110b=_0x53602f;}}else{logger[_0xb41f('0x66')](_0xb41f('0x8b'));}if('undefined'!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')]){var _0x467aa9=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x467aa9)){_0x46aca2=path[_0xb41f('0x5e')](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x467aa9);}else{_0x46aca2=_0x467aa9;}}else{logger[_0xb41f('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x35edc7===_0xb41f('0x82')){_0x10826e=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x8c')];_0x1d61af=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x84')];if(_0xb41f('0x77')!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')]){if(_0xb41f('0x77')!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')]){var _0x53602f=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xb41f('0x8d')](_0x53602f)){_0x5e110b=path['join'](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x53602f);}else{_0x5e110b=_0x53602f;}}if(_0xb41f('0x77')!=typeof _0xe246ab['parameters'][_0xb41f('0x7e')][_0xb41f('0x81')]){var _0x467aa9=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xb41f('0x8d')](_0x467aa9)){_0x46aca2=path[_0xb41f('0x5e')](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x467aa9);}else{_0x46aca2=_0x467aa9;}}}}var _0x3ba5f9={'name':_0x33ffde,'description':_0x1ede00,'path':path['join'](_0x34c05f,_0x465a9c[0x0]),'type':_0x35edc7,'sidebar':_0x234e7d,'icon':_0x3dc5e8,'adminUrl':_0x5e110b,'agentUrl':_0x46aca2,'scriptName':_0x10826e,'scriptPath':_0x1d61af,'version':_0x51ec91};removeReferences(_0x953f,null);return db[_0xb41f('0x45')][_0xb41f('0x8e')](_0x3ba5f9)[_0xb41f('0x28')](function(_0x565e6c){var _0x4fdbb5={'role':_0x3ab9cf['body'][_0xb41f('0x8f')],'userProfileId':_0x3ab9cf[_0xb41f('0x90')][_0xb41f('0x91')]};if(!_0x4fdbb5)throw new Error(_0xb41f('0x92'));if(_0x4fdbb5['role']==='user'){var _0x2c96f0=_0x565e6c[_0xb41f('0x93')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xb41f('0x2a'),'userProfileId':_0x4fdbb5[_0xb41f('0x91')]},'raw':!![]})[_0xb41f('0x28')](function(_0x3866fa){if(_0x3866fa&&_0x3866fa['autoAssociation']===0x0){return db[_0xb41f('0x2b')][_0xb41f('0x8e')]({'name':_0x2c96f0['name'],'resourceId':_0x2c96f0['id'],'type':_0x3866fa[_0xb41f('0x2e')],'sectionId':_0x3866fa['id']},{})['then'](function(){return _0x565e6c;});}else{return _0x565e6c;}})[_0xb41f('0x4e')](function(_0x59ce14){logger[_0xb41f('0x2c')](_0xb41f('0x94'),_0x59ce14);throw _0x59ce14;});}return _0x565e6c;})['then'](respondWithResult(_0x13e4a2,null))[_0xb41f('0x4e')](handleError(_0x13e4a2,null));}});}catch(_0x496ec9){_0x13e4a2[_0xb41f('0x20')](0x1f4)[_0xb41f('0x95')](_0x496ec9);}};function removeReferences(_0x48fded,_0x4e9552){try{if(_0x48fded){fs['unlinkSync'](_0x48fded);logger[_0xb41f('0x66')]('Zip\x20archive\x20removed');}if(_0x4e9552){rimraf(_0x4e9552,function(){});logger['info'](_0xb41f('0x96'));}}catch(_0x210ae7){logger[_0xb41f('0x2c')](_0x210ae7);}}exports['update']=function(_0x76e4ea,_0x5dc8ca,_0x1b78a2){return db[_0xb41f('0x45')][_0xb41f('0x4d')]({'where':{'id':_0x76e4ea[_0xb41f('0x4a')]['id']}})[_0xb41f('0x28')](handleEntityNotFound(_0x5dc8ca,null))[_0xb41f('0x28')](saveUpdates(_0x76e4ea[_0xb41f('0x90')],null))[_0xb41f('0x28')](respondWithResult(_0x5dc8ca,null))['catch'](handleError(_0x5dc8ca,null));};exports[_0xb41f('0x97')]=function(_0x43883b,_0x9dcbcd,_0x22c881){return db['Plugin'][_0xb41f('0x4d')]({'where':{'id':_0x43883b[_0xb41f('0x4a')]['id']}})[_0xb41f('0x28')](function(_0x3a04c8){if(_0x3a04c8){return _0x3a04c8[_0xb41f('0x29')]();}})[_0xb41f('0x28')](function(_0x2d4666){rimraf(path[_0xb41f('0x5e')](config[_0xb41f('0x51')],_0xb41f('0x52'),path[_0xb41f('0x5f')](_0x2d4666[_0xb41f('0x50')])),function(){});return _0x2d4666;})[_0xb41f('0x28')](handleEntityNotFound(_0x9dcbcd,null))[_0xb41f('0x28')](respondWithStatusCode(_0x9dcbcd,null))[_0xb41f('0x4e')](handleError(_0x9dcbcd,null));};exports[_0xb41f('0x98')]=function(_0x3677fa,_0x24d90b,_0x483480){return BPromise[_0xb41f('0x99')]()[_0xb41f('0x28')](function(){if(!_0x3677fa[_0xb41f('0x34')]['path']){throw new Error(_0xb41f('0x9a'));}if(!_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3d3608=_0x3677fa['query'][_0xb41f('0x9c')]?_0x3677fa['query'][_0xb41f('0x9c')]+':'+_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9b')]:'http://localhost:'+_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9b')];var _0x3353a4=_0x3677fa[_0xb41f('0x34')][_0xb41f('0x24')]?_0x3677fa[_0xb41f('0x34')][_0xb41f('0x24')]:!![];var _0x31945b=_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9d')]?_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9d')]:null;var _0x234c42={'method':_0x3677fa[_0xb41f('0x9e')],'uri':util[_0xb41f('0x53')](_0xb41f('0x9f'),_0x3d3608,_0x3677fa[_0xb41f('0x34')][_0xb41f('0x50')]),'json':_0x3353a4,'resolveWithFullResponse':!![],'encoding':_0x31945b,'qs':_0x3677fa[_0xb41f('0x34')]};if(_0x3677fa[_0xb41f('0xa0')]){_0x234c42[_0xb41f('0xa0')]=_0x3677fa[_0xb41f('0xa0')];if(_0x234c42[_0xb41f('0xa0')][_0xb41f('0xa1')]){delete _0x234c42[_0xb41f('0xa0')][_0xb41f('0xa1')];}}if(_0x234c42[_0xb41f('0xa0')][_0xb41f('0xa2')]){delete _0x234c42[_0xb41f('0xa0')][_0xb41f('0xa2')];}return rp(_0x234c42);})[_0xb41f('0x28')](function(_0x5606eb){if(_0x5606eb){_0x24d90b['set'](_0x5606eb[_0xb41f('0xa0')]);logger[_0xb41f('0x66')](_0x5606eb['body']);if(_['endsWith'](_0x3677fa['query']['path'],'download')&&_0x5606eb['statusCode']==0x1f4){return _0x24d90b[_0xb41f('0x1f')](_0x5606eb['statusCode']);}else{return _0x24d90b[_0xb41f('0x20')](_0x5606eb[_0xb41f('0xa3')])['send'](_0x5606eb[_0xb41f('0x90')]);}}else{return _0x24d90b[_0xb41f('0x1f')](0xc8);}})[_0xb41f('0x4e')](handleError(_0x24d90b,null));};exports['webhookPost']=function(_0x8c32ae,_0x4d20c6,_0x536713){return BPromise[_0xb41f('0x99')]()['then'](function(){if(!_0x8c32ae['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9b')]){throw new Error(_0xb41f('0xa4'));}var _0x383a30=_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9c')]?_0x8c32ae['query'][_0xb41f('0x9c')]+':'+_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9b')]:_0xb41f('0xa5')+_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9b')];var _0x560f27=_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x24')]?_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x24')]:!![];var _0x43b4a9=_0x8c32ae['query']['encoding']?_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9d')]:null;var _0x4f1d72={'method':_0x8c32ae['method'],'uri':util['format'](_0xb41f('0x9f'),_0x383a30,_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x50')]),'json':_0x560f27,'resolveWithFullResponse':!![],'encoding':_0x43b4a9,'body':_0x8c32ae[_0xb41f('0x90')]};if(_0x8c32ae[_0xb41f('0xa0')]){_0x4f1d72['headers']=_0x8c32ae[_0xb41f('0xa0')];if(_0x4f1d72[_0xb41f('0xa0')][_0xb41f('0xa1')]){delete _0x4f1d72[_0xb41f('0xa0')]['content-length'];}}if(_0x4f1d72[_0xb41f('0xa0')][_0xb41f('0xa2')]){delete _0x4f1d72[_0xb41f('0xa0')][_0xb41f('0xa2')];}return rp(_0x4f1d72);})[_0xb41f('0x28')](function(_0x48b1c1){if(_0x48b1c1){_0x4d20c6[_0xb41f('0xa6')](_0x48b1c1[_0xb41f('0xa0')]);logger[_0xb41f('0x66')](_0x48b1c1[_0xb41f('0x90')]);return _0x4d20c6[_0xb41f('0x20')](_0x48b1c1[_0xb41f('0xa3')])['send'](_0x48b1c1[_0xb41f('0x90')]);}else{return _0x4d20c6[_0xb41f('0x1f')](0xc8);}})['catch'](handleError(_0x4d20c6,null));}; \ No newline at end of file +var _0xdf97=['root','server/files/plugins','format','%s.zip','basename','path','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','register','sendStatus','end','status','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','join'];(function(_0x555435,_0xa74e4e){var _0x42c398=function(_0x1fdd48){while(--_0x1fdd48){_0x555435['push'](_0x555435['shift']());}};_0x42c398(++_0xa74e4e);}(_0xdf97,0x1b4));var _0x7df9=function(_0x1e9e51,_0x5b18d9){_0x1e9e51=_0x1e9e51-0x0;var _0x2bba1e=_0xdf97[_0x1e9e51];return _0x2bba1e;};'use strict';var pdf=require(_0x7df9('0x0'));var emlformat=require(_0x7df9('0x1'));var rimraf=require(_0x7df9('0x2'));var zipdir=require(_0x7df9('0x3'));var jsonpatch=require(_0x7df9('0x4'));var rp=require(_0x7df9('0x5'));var moment=require(_0x7df9('0x6'));var BPromise=require(_0x7df9('0x7'));var Mustache=require(_0x7df9('0x8'));var util=require(_0x7df9('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x7df9('0xa'));var ejs=require(_0x7df9('0xb'));var fs=require('fs');var _=require(_0x7df9('0xc'));var squel=require('squel');var crypto=require(_0x7df9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7df9('0xe'));var toCsv=require(_0x7df9('0xa'));var querystring=require(_0x7df9('0xf'));var Papa=require(_0x7df9('0x10'));var extract=require(_0x7df9('0x11'));var rimraf=require(_0x7df9('0x2'));var archiver=require(_0x7df9('0x12'));var Redis=require(_0x7df9('0x13'));var authService=require(_0x7df9('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7df9('0x15'));var logger=require(_0x7df9('0x16'))(_0x7df9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7df9('0x18'))['db'];config['redis']=_[_0x7df9('0x19')](config[_0x7df9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7df9('0x1a')]));require('./plugin.socket')[_0x7df9('0x1b')](socket);function respondWithStatusCode(_0x1e7e49,_0x30dcd0){_0x30dcd0=_0x30dcd0||0xcc;return function(_0x581eb9){if(_0x581eb9){return _0x1e7e49[_0x7df9('0x1c')](_0x30dcd0);}return _0x1e7e49['status'](_0x30dcd0)[_0x7df9('0x1d')]();};}function respondWithResult(_0x462a67,_0x2e879f){_0x2e879f=_0x2e879f||0xc8;return function(_0x1b2758){if(_0x1b2758){return _0x462a67[_0x7df9('0x1e')](_0x2e879f)['json'](_0x1b2758);}};}function respondWithFilteredResult(_0x2d8f3a,_0x18f2b1){return function(_0x137a03){if(_0x137a03){var _0x4e5b47=_0x137a03[_0x7df9('0x1f')],_0x3790bb=_0x18f2b1[_0x7df9('0x20')],_0x374374=_0x18f2b1[_0x7df9('0x20')]+_0x18f2b1['limit'],_0x3570d3;if(_0x374374>=_0x4e5b47){_0x374374=_0x4e5b47;_0x3570d3=0xc8;}else{_0x3570d3=0xce;}_0x2d8f3a[_0x7df9('0x1e')](_0x3570d3);return _0x2d8f3a[_0x7df9('0x21')](_0x7df9('0x22'),_0x3790bb+'-'+_0x374374+'/'+_0x4e5b47)[_0x7df9('0x23')](_0x137a03);}return null;};}function patchUpdates(_0x420c98){return function(_0x63cb6c){try{jsonpatch['apply'](_0x63cb6c,_0x420c98,!![]);}catch(_0x241dd4){return BPromise[_0x7df9('0x24')](_0x241dd4);}return _0x63cb6c[_0x7df9('0x25')]();};}function saveUpdates(_0x2dae67,_0x124f35){return function(_0x4f68e2){if(_0x4f68e2){return _0x4f68e2[_0x7df9('0x26')](_0x2dae67)[_0x7df9('0x27')](function(_0x5cdaea){return _0x5cdaea;});}return null;};}function removeEntity(_0x4b4a42,_0x2ce280){return function(_0x15f5fb){if(_0x15f5fb){return _0x15f5fb[_0x7df9('0x28')]()[_0x7df9('0x27')](function(){var _0x23444f=_0x15f5fb[_0x7df9('0x29')]({'plain':!![]});var _0x121f20='Plugins';return db[_0x7df9('0x2a')][_0x7df9('0x28')]({'where':{'type':_0x121f20,'resourceId':_0x23444f['id']}})[_0x7df9('0x27')](function(){return _0x15f5fb;});})['then'](function(){_0x4b4a42[_0x7df9('0x1e')](0xcc)[_0x7df9('0x1d')]();});}};}function handleEntityNotFound(_0xfa2f3b,_0x32df5a){return function(_0x55b371){if(!_0x55b371){_0xfa2f3b[_0x7df9('0x1c')](0x194);}return _0x55b371;};}function handleError(_0x3e0d76,_0x3cc09a){_0x3cc09a=_0x3cc09a||0x1f4;return function(_0x66ec99){logger[_0x7df9('0x2b')](_0x66ec99[_0x7df9('0x2c')]);if(_0x66ec99[_0x7df9('0x2d')]){delete _0x66ec99['name'];}_0x3e0d76[_0x7df9('0x1e')](_0x3cc09a)[_0x7df9('0x2e')](_0x66ec99);};}exports[_0x7df9('0x2f')]=function(_0x217a58,_0x2fa3de){var _0x2a81d0={},_0x35cc49={},_0x4e33a4={'count':0x0,'rows':[]};var _0x11c261=_[_0x7df9('0x30')](db[_0x7df9('0x31')][_0x7df9('0x32')],function(_0x1a98a3){return{'name':_0x1a98a3[_0x7df9('0x33')],'type':_0x1a98a3[_0x7df9('0x34')][_0x7df9('0x35')]};});_0x35cc49[_0x7df9('0x36')]=_[_0x7df9('0x30')](_0x11c261,'name');_0x35cc49['query']=_[_0x7df9('0x37')](_0x217a58[_0x7df9('0x38')]);_0x35cc49[_0x7df9('0x39')]=_[_0x7df9('0x3a')](_0x35cc49[_0x7df9('0x36')],_0x35cc49['query']);_0x2a81d0[_0x7df9('0x3b')]=_['intersection'](_0x35cc49['model'],qs['fields'](_0x217a58[_0x7df9('0x38')]['fields']));_0x2a81d0['attributes']=_0x2a81d0['attributes'][_0x7df9('0x3c')]?_0x2a81d0[_0x7df9('0x3b')]:_0x35cc49[_0x7df9('0x36')];if(!_0x217a58[_0x7df9('0x38')]['hasOwnProperty'](_0x7df9('0x3d'))){_0x2a81d0[_0x7df9('0x3e')]=qs[_0x7df9('0x3e')](_0x217a58[_0x7df9('0x38')][_0x7df9('0x3e')]);_0x2a81d0[_0x7df9('0x20')]=qs[_0x7df9('0x20')](_0x217a58[_0x7df9('0x38')][_0x7df9('0x20')]);}_0x2a81d0[_0x7df9('0x3f')]=qs['sort'](_0x217a58[_0x7df9('0x38')][_0x7df9('0x40')]);_0x2a81d0[_0x7df9('0x41')]=qs['filters'](_[_0x7df9('0x42')](_0x217a58[_0x7df9('0x38')],_0x35cc49[_0x7df9('0x39')]),_0x11c261);if(_0x217a58[_0x7df9('0x38')][_0x7df9('0x43')]){_0x2a81d0[_0x7df9('0x41')]=_[_0x7df9('0x44')](_0x2a81d0['where'],{'$or':_[_0x7df9('0x30')](_0x11c261,function(_0x413a09){if(_0x413a09[_0x7df9('0x34')]!==_0x7df9('0x45')){var _0x86e808={};_0x86e808[_0x413a09[_0x7df9('0x2d')]]={'$like':'%'+_0x217a58[_0x7df9('0x38')][_0x7df9('0x43')]+'%'};return _0x86e808;}})});}_0x2a81d0=_[_0x7df9('0x44')]({},_0x2a81d0,_0x217a58[_0x7df9('0x46')]);var _0x2a5601={'where':_0x2a81d0['where']};return db[_0x7df9('0x31')][_0x7df9('0x1f')](_0x2a5601)[_0x7df9('0x27')](function(_0x5c7bf6){_0x4e33a4['count']=_0x5c7bf6;if(_0x217a58[_0x7df9('0x38')][_0x7df9('0x47')]){_0x2a81d0[_0x7df9('0x48')]=[{'all':!![]}];}return db[_0x7df9('0x31')][_0x7df9('0x49')](_0x2a81d0);})['then'](function(_0x327566){_0x4e33a4[_0x7df9('0x4a')]=_0x327566;return _0x4e33a4;})[_0x7df9('0x27')](respondWithFilteredResult(_0x2fa3de,_0x2a81d0))[_0x7df9('0x4b')](handleError(_0x2fa3de,null));};exports['show']=function(_0xb8412a,_0xb9bc57){var _0x2dbefb={'raw':!![],'where':{'id':_0xb8412a[_0x7df9('0x4c')]['id']}},_0x114013={};_0x114013[_0x7df9('0x36')]=_[_0x7df9('0x37')](db[_0x7df9('0x31')][_0x7df9('0x32')]);_0x114013[_0x7df9('0x38')]=_[_0x7df9('0x37')](_0xb8412a['query']);_0x114013[_0x7df9('0x39')]=_[_0x7df9('0x3a')](_0x114013[_0x7df9('0x36')],_0x114013[_0x7df9('0x38')]);_0x2dbefb[_0x7df9('0x3b')]=_[_0x7df9('0x3a')](_0x114013[_0x7df9('0x36')],qs['fields'](_0xb8412a[_0x7df9('0x38')][_0x7df9('0x4d')]));_0x2dbefb[_0x7df9('0x3b')]=_0x2dbefb[_0x7df9('0x3b')][_0x7df9('0x3c')]?_0x2dbefb[_0x7df9('0x3b')]:_0x114013['model'];if(_0xb8412a[_0x7df9('0x38')][_0x7df9('0x47')]){_0x2dbefb[_0x7df9('0x48')]=[{'all':!![]}];}_0x2dbefb=_[_0x7df9('0x44')]({},_0x2dbefb,_0xb8412a[_0x7df9('0x46')]);return db[_0x7df9('0x31')][_0x7df9('0x4e')](_0x2dbefb)[_0x7df9('0x27')](handleEntityNotFound(_0xb9bc57,null))[_0x7df9('0x27')](respondWithResult(_0xb9bc57,null))[_0x7df9('0x4b')](handleError(_0xb9bc57,null));};exports['download']=function(_0x213e28,_0x5cd330,_0x28e177){return db['Plugin']['find']({'where':{'id':_0x213e28[_0x7df9('0x4c')]['id']},'attributes':[_0x7df9('0x2d'),'path'],'raw':!![]})[_0x7df9('0x27')](handleEntityNotFound(_0x5cd330,null))['then'](function(_0x19c9b4){if(_0x19c9b4){var _0x5ebd1d=path[_0x7df9('0x4f')](config[_0x7df9('0x50')],_0x7df9('0x51'),util[_0x7df9('0x52')](_0x7df9('0x53'),path[_0x7df9('0x54')](_0x19c9b4[_0x7df9('0x55')])));var _0x226ba5=fs[_0x7df9('0x56')](_0x5ebd1d);var _0x37f35c=archiver(_0x7df9('0x57'),{'zlib':{'level':0x9}});_0x37f35c['on'](_0x7df9('0x58'),function(_0x21cfbb){if(_0x21cfbb[_0x7df9('0x59')]===_0x7df9('0x5a')){logger[_0x7df9('0x2b')](_0x21cfbb);}else{throw new db[(_0x7df9('0x5b'))]['Error'](_0x7df9('0x5c'));}});_0x37f35c['on'](_0x7df9('0x2b'),function(_0x976dc6){throw new db['Sequelize'][(_0x7df9('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x37f35c[_0x7df9('0x5e')](_0x226ba5);_0x37f35c['glob'](_0x7df9('0x5f'),{'cwd':path[_0x7df9('0x4f')](config[_0x7df9('0x50')],'server/files/plugins',path[_0x7df9('0x60')](_0x19c9b4[_0x7df9('0x55')])),'ignore':[path['join'](path[_0x7df9('0x54')](_0x19c9b4[_0x7df9('0x55')]),_0x7df9('0x61')),path[_0x7df9('0x4f')](path['basename'](_0x19c9b4[_0x7df9('0x55')]),_0x7df9('0x62'))],'nodir':!![]})['finalize']();_0x226ba5['on'](_0x7df9('0x63'),function(){if(!fs[_0x7df9('0x64')](_0x5ebd1d)){throw new db['Sequelize'][(_0x7df9('0x5d'))]('Plugin\x20not\x20found');}return _0x5cd330[_0x7df9('0x65')](_0x5ebd1d,util[_0x7df9('0x52')](_0x7df9('0x53'),path[_0x7df9('0x54')](_0x19c9b4[_0x7df9('0x55')])),function(_0x4aaf7d){if(_0x4aaf7d){throw new db[(_0x7df9('0x5b'))]['Error'](_0x7df9('0x66'));}fs[_0x7df9('0x67')](_0x5ebd1d);logger[_0x7df9('0x68')](_0x7df9('0x69'));logger[_0x7df9('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0x7df9('0x4b')](handleError(_0x5cd330,null));};exports[_0x7df9('0x6a')]=function(_0xe37071,_0x2ebdf9,_0x2db3b3){var _0x4d5e6b=path[_0x7df9('0x54')](_0xe37071['file'][_0x7df9('0x6b')],path[_0x7df9('0x6c')](_0xe37071[_0x7df9('0x6d')]['filename']));var _0x2ab472=path[_0x7df9('0x4f')](config['root'],_0x7df9('0x51'),_0xe37071['file'][_0x7df9('0x6b')]);var _0x3725c2=path[_0x7df9('0x4f')](config[_0x7df9('0x50')],'server/files/plugins',_0x4d5e6b);logger[_0x7df9('0x68')](_0x7df9('0x6e'),_0x2ab472);logger[_0x7df9('0x68')](_0x7df9('0x6f'),_0x3725c2);try{fs[_0x7df9('0x70')](_0x2ab472,parseInt(_0x7df9('0x71'),0x8));extract(_0x2ab472,{'dir':_0x3725c2},function(_0x18097f){if(_0x18097f){logger['error'](_0x18097f);handleError(_0x18097f,!![]);};var _0x165b56=fs[_0x7df9('0x72')](_0x3725c2);if(_0x165b56[_0x7df9('0x3c')]>0x1){removeReferences(_0x2ab472,_0x3725c2);logger[_0x7df9('0x2b')](_0x7df9('0x73'));return _0x2db3b3(new Error(_0x7df9('0x73')));}var _0x413b03=fs[_0x7df9('0x74')](path[_0x7df9('0x4f')](_0x3725c2,_0x165b56[0x0]));if(_0x413b03[_0x7df9('0x75')]()){removeReferences(_0x2ab472,_0x3725c2);logger[_0x7df9('0x2b')](_0x7df9('0x73'));return _0x2db3b3(new Error(_0x7df9('0x73')));}if(_0x413b03[_0x7df9('0x76')]()){var _0xdf9f94=fs[_0x7df9('0x72')](path[_0x7df9('0x4f')](_0x3725c2,_0x165b56[0x0]));if(_0xdf9f94[_0x7df9('0x3c')]===0x0){removeReferences(_0x2ab472,_0x3725c2);logger['error'](_0x7df9('0x73'));return _0x2db3b3(new Error(_0x7df9('0x73')));}var _0x5a66ee=_0xdf9f94[_0x7df9('0x77')](function(_0x40b0e7){return _0x40b0e7===_0x7df9('0x78');});if(!_0x5a66ee){return _0x2db3b3(new Error(_0x7df9('0x79')));}var _0xfba696=fs['readFileSync'](path[_0x7df9('0x4f')](_0x3725c2,_0x165b56[0x0],_0x7df9('0x78')));var _0x5afced=JSON[_0x7df9('0x7a')](_0xfba696);if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x2d')]){return _0x2db3b3(new Error(_0x7df9('0x7c')));}if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x34')]){return _0x2db3b3(new Error(_0x7df9('0x7d')));}if(_0x7df9('0x7b')==typeof _0x5afced['version']){return _0x2db3b3(new Error(_0x7df9('0x7e')));}if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x7f')]){return _0x2db3b3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5afced['type']===_0x7df9('0x80')){if('undefined'==typeof _0x5afced['parameters'][_0x7df9('0x81')]){return _0x2db3b3(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')][_0x7df9('0x82')]&&_0x7df9('0x7b')==typeof _0x5afced['parameters']['views'][_0x7df9('0x83')]){return _0x2db3b3(new Error(_0x7df9('0x84')));}}else if(_0x5afced[_0x7df9('0x34')]===_0x7df9('0x85')){if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x86')]){return _0x2db3b3(new Error(_0x7df9('0x87')));}if(_0x7df9('0x7b')==typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x88')]){return _0x2db3b3(new Error(_0x7df9('0x89')));}}else{return _0x2db3b3(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xd6a5fb=_0x5afced['name'];var _0x594fd8=_0x5afced[_0x7df9('0x8a')];var _0x5b8fe5=_0x5afced['type'];var _0x55cd2c=_0x5afced[_0x7df9('0x8b')]?_0x5afced[_0x7df9('0x8b')]:_0x7df9('0x8c');var _0x3fb71d=_0x5afced[_0x7df9('0x8d')]?_0x5afced[_0x7df9('0x8d')]:_0x7df9('0x8e');var _0x552b4a='';var _0x324263='';var _0x407e6d='';var _0x11c7ab='';var _0x36f6ce=_0x5afced[_0x7df9('0x8f')];if(_0x5b8fe5==='html'){if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')]['admin']){var _0x21eb73=_0x5afced['parameters'][_0x7df9('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7df9('0x90')](_0x21eb73)){_0x552b4a=path[_0x7df9('0x4f')](_0x7df9('0x91'),_0x4d5e6b,_0x165b56[0x0],_0x21eb73);}else{_0x552b4a=_0x21eb73;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')]['views']['agent']){var _0x45b669=_0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')][_0x7df9('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x45b669)){_0x324263=path[_0x7df9('0x4f')](_0x7df9('0x91'),_0x4d5e6b,_0x165b56[0x0],_0x45b669);}else{_0x324263=_0x45b669;}}else{logger[_0x7df9('0x68')](_0x7df9('0x92'));}}else if(_0x5b8fe5===_0x7df9('0x85')){_0x407e6d=_0x5afced[_0x7df9('0x7f')]['scriptName'];_0x11c7ab=_0x5afced[_0x7df9('0x7f')]['scriptPath'];if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')]){if(_0x7df9('0x7b')!=typeof _0x5afced[_0x7df9('0x7f')]['views'][_0x7df9('0x82')]){var _0x21eb73=_0x5afced[_0x7df9('0x7f')][_0x7df9('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7df9('0x90')](_0x21eb73)){_0x552b4a=path[_0x7df9('0x4f')]('plugins',_0x4d5e6b,_0x165b56[0x0],_0x21eb73);}else{_0x552b4a=_0x21eb73;}}if('undefined'!=typeof _0x5afced[_0x7df9('0x7f')]['views'][_0x7df9('0x83')]){var _0x45b669=_0x5afced['parameters'][_0x7df9('0x81')][_0x7df9('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x7df9('0x90')](_0x45b669)){_0x324263=path[_0x7df9('0x4f')](_0x7df9('0x91'),_0x4d5e6b,_0x165b56[0x0],_0x45b669);}else{_0x324263=_0x45b669;}}}}var _0x11386e={'name':_0xd6a5fb,'description':_0x594fd8,'path':path[_0x7df9('0x4f')](_0x4d5e6b,_0x165b56[0x0]),'type':_0x5b8fe5,'sidebar':_0x55cd2c,'icon':_0x3fb71d,'adminUrl':_0x552b4a,'agentUrl':_0x324263,'scriptName':_0x407e6d,'scriptPath':_0x11c7ab,'version':_0x36f6ce};removeReferences(_0x2ab472,null);return db['Plugin'][_0x7df9('0x93')](_0x11386e)[_0x7df9('0x27')](function(_0x148973){var _0x48a6cc={'role':_0xe37071['body'][_0x7df9('0x94')],'userProfileId':_0xe37071[_0x7df9('0x95')]['userProfileId']};if(!_0x48a6cc)throw new Error(_0x7df9('0x96'));if(_0x48a6cc[_0x7df9('0x94')]===_0x7df9('0x97')){var _0x6cd24d=_0x148973['get']({'plain':!![]});return db['UserProfileSection'][_0x7df9('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x48a6cc[_0x7df9('0x98')]},'raw':!![]})[_0x7df9('0x27')](function(_0x13bc78){if(_0x13bc78&&_0x13bc78[_0x7df9('0x99')]===0x0){return db[_0x7df9('0x2a')][_0x7df9('0x93')]({'name':_0x6cd24d[_0x7df9('0x2d')],'resourceId':_0x6cd24d['id'],'type':_0x13bc78['name'],'sectionId':_0x13bc78['id']},{})['then'](function(){return _0x148973;});}else{return _0x148973;}})[_0x7df9('0x4b')](function(_0x45d9c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45d9c0);throw _0x45d9c0;});}return _0x148973;})[_0x7df9('0x27')](respondWithResult(_0x2ebdf9,null))[_0x7df9('0x4b')](handleError(_0x2ebdf9,null));}});}catch(_0x1236b8){_0x2ebdf9[_0x7df9('0x1e')](0x1f4)['send'](_0x1236b8);}};function removeReferences(_0x1c0c53,_0x547c61){try{if(_0x1c0c53){fs[_0x7df9('0x67')](_0x1c0c53);logger['info'](_0x7df9('0x9a'));}if(_0x547c61){rimraf(_0x547c61,function(){});logger[_0x7df9('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x1f8f40){logger['error'](_0x1f8f40);}}exports[_0x7df9('0x26')]=function(_0x142be3,_0x16c6f9,_0x37de31){return db[_0x7df9('0x31')][_0x7df9('0x4e')]({'where':{'id':_0x142be3[_0x7df9('0x4c')]['id']}})[_0x7df9('0x27')](handleEntityNotFound(_0x16c6f9,null))['then'](saveUpdates(_0x142be3[_0x7df9('0x95')],null))['then'](respondWithResult(_0x16c6f9,null))['catch'](handleError(_0x16c6f9,null));};exports[_0x7df9('0x9b')]=function(_0x39a24c,_0x2b76cd,_0x32e7ee){return db[_0x7df9('0x31')][_0x7df9('0x4e')]({'where':{'id':_0x39a24c['params']['id']}})[_0x7df9('0x27')](function(_0x3357d2){if(_0x3357d2){return _0x3357d2[_0x7df9('0x28')]();}})['then'](function(_0x1917a1){rimraf(path[_0x7df9('0x4f')](config[_0x7df9('0x50')],_0x7df9('0x51'),path['dirname'](_0x1917a1['path'])),function(){});return _0x1917a1;})[_0x7df9('0x27')](handleEntityNotFound(_0x2b76cd,null))[_0x7df9('0x27')](respondWithStatusCode(_0x2b76cd,null))[_0x7df9('0x4b')](handleError(_0x2b76cd,null));};exports[_0x7df9('0x9c')]=function(_0x1456df,_0x56da09,_0xa8a759){return BPromise[_0x7df9('0x9d')]()[_0x7df9('0x27')](function(){if(!_0x1456df['query'][_0x7df9('0x55')]){throw new Error(_0x7df9('0x9e'));}if(!_0x1456df[_0x7df9('0x38')][_0x7df9('0x9f')]){throw new Error(_0x7df9('0xa0'));}var _0x25520b=_0x1456df[_0x7df9('0x38')]['hostname']?_0x1456df['query'][_0x7df9('0xa1')]+':'+_0x1456df[_0x7df9('0x38')][_0x7df9('0x9f')]:_0x7df9('0xa2')+_0x1456df[_0x7df9('0x38')][_0x7df9('0x9f')];var _0x1bb232=_0x1456df[_0x7df9('0x38')][_0x7df9('0x23')]?_0x1456df[_0x7df9('0x38')][_0x7df9('0x23')]:!![];var _0x3519d7=_0x1456df[_0x7df9('0x38')][_0x7df9('0xa3')]?_0x1456df[_0x7df9('0x38')][_0x7df9('0xa3')]:null;var _0x35961d={'method':_0x1456df['method'],'uri':util[_0x7df9('0x52')](_0x7df9('0xa4'),_0x25520b,_0x1456df[_0x7df9('0x38')]['path']),'json':_0x1bb232,'resolveWithFullResponse':!![],'encoding':_0x3519d7,'qs':_0x1456df[_0x7df9('0x38')]};if(_0x1456df[_0x7df9('0xa5')]){_0x35961d[_0x7df9('0xa5')]=_0x1456df[_0x7df9('0xa5')];if(_0x35961d[_0x7df9('0xa5')][_0x7df9('0xa6')]){delete _0x35961d[_0x7df9('0xa5')][_0x7df9('0xa6')];}}if(_0x35961d[_0x7df9('0xa5')][_0x7df9('0xa7')]){delete _0x35961d['headers'][_0x7df9('0xa7')];}return rp(_0x35961d);})[_0x7df9('0x27')](function(_0x1f261f){if(_0x1f261f){_0x56da09[_0x7df9('0x21')](_0x1f261f[_0x7df9('0xa5')]);logger[_0x7df9('0x68')](_0x1f261f[_0x7df9('0x95')]);if(_[_0x7df9('0xa8')](_0x1456df[_0x7df9('0x38')][_0x7df9('0x55')],_0x7df9('0x65'))&&_0x1f261f[_0x7df9('0xa9')]==0x1f4){return _0x56da09[_0x7df9('0x1c')](_0x1f261f['statusCode']);}else{return _0x56da09[_0x7df9('0x1e')](_0x1f261f[_0x7df9('0xa9')])[_0x7df9('0x2e')](_0x1f261f['body']);}}else{return _0x56da09[_0x7df9('0x1c')](0xc8);}})[_0x7df9('0x4b')](handleError(_0x56da09,null));};exports[_0x7df9('0xaa')]=function(_0x2185ab,_0x5b989a,_0x1f6ebd){return BPromise[_0x7df9('0x9d')]()[_0x7df9('0x27')](function(){if(!_0x2185ab[_0x7df9('0x38')][_0x7df9('0x55')]){throw new Error(_0x7df9('0x9e'));}if(!_0x2185ab['query']['port']){throw new Error(_0x7df9('0xa0'));}var _0x2f7d99=_0x2185ab[_0x7df9('0x38')][_0x7df9('0xa1')]?_0x2185ab['query'][_0x7df9('0xa1')]+':'+_0x2185ab[_0x7df9('0x38')]['port']:'http://localhost:'+_0x2185ab[_0x7df9('0x38')][_0x7df9('0x9f')];var _0x2f810f=_0x2185ab['query']['json']?_0x2185ab[_0x7df9('0x38')]['json']:!![];var _0x339bfa=_0x2185ab[_0x7df9('0x38')][_0x7df9('0xa3')]?_0x2185ab['query'][_0x7df9('0xa3')]:null;var _0x1deff4={'method':_0x2185ab[_0x7df9('0xab')],'uri':util[_0x7df9('0x52')]('%s%s',_0x2f7d99,_0x2185ab[_0x7df9('0x38')][_0x7df9('0x55')]),'json':_0x2f810f,'resolveWithFullResponse':!![],'encoding':_0x339bfa,'body':_0x2185ab['body']};if(_0x2185ab[_0x7df9('0xa5')]){_0x1deff4[_0x7df9('0xa5')]=_0x2185ab['headers'];if(_0x1deff4['headers'][_0x7df9('0xa6')]){delete _0x1deff4['headers'][_0x7df9('0xa6')];}}if(_0x1deff4[_0x7df9('0xa5')][_0x7df9('0xa7')]){delete _0x1deff4[_0x7df9('0xa5')][_0x7df9('0xa7')];}return rp(_0x1deff4);})[_0x7df9('0x27')](function(_0x944157){if(_0x944157){_0x5b989a[_0x7df9('0x21')](_0x944157[_0x7df9('0xa5')]);logger['info'](_0x944157[_0x7df9('0x95')]);return _0x5b989a[_0x7df9('0x1e')](_0x944157[_0x7df9('0xa9')])[_0x7df9('0x2e')](_0x944157[_0x7df9('0x95')]);}else{return _0x5b989a[_0x7df9('0x1c')](0xc8);}})['catch'](handleError(_0x5b989a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4ec7830..05dc90e 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 _0xe5af=['emit','exports','../../mysqldb','Plugin','save','update','remove'];(function(_0x510345,_0x532b17){var _0xe1ff99=function(_0x5beca0){while(--_0x5beca0){_0x510345['push'](_0x510345['shift']());}};_0xe1ff99(++_0x532b17);}(_0xe5af,0x9c));var _0xfe5a=function(_0x179f03,_0x4d05ab){_0x179f03=_0x179f03-0x0;var _0x2fffa2=_0xe5af[_0x179f03];return _0x2fffa2;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){PluginEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);PluginEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=PluginEvents; \ No newline at end of file +var _0x6a55=['hasOwnProperty','hook','exports','events','save','emit'];(function(_0xc70a7f,_0x54be61){var _0x1d529b=function(_0x184a71){while(--_0x184a71){_0xc70a7f['push'](_0xc70a7f['shift']());}};_0x1d529b(++_0x54be61);}(_0x6a55,0xdb));var _0x56a5=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0x6a55[_0x3bee55];return _0x5649d2;};'use strict';var EventEmitter=require(_0x56a5('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56a5('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x116199){return function(_0x5e5a32,_0x3ff76a,_0x5171fa){PluginEvents[_0x56a5('0x2')](_0x116199+':'+_0x5e5a32['id'],_0x5e5a32);PluginEvents[_0x56a5('0x2')](_0x116199,_0x5e5a32);_0x5171fa(null);};}for(var e in events){if(events[_0x56a5('0x3')](e)){var event=events[e];Plugin[_0x56a5('0x4')](e,emitEvent(event));}}module[_0x56a5('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 31a98bf..54fe32e 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 _0x008c=['define','plugins','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x58422c,_0x55903e){var _0x4f4554=function(_0x261f4d){while(--_0x261f4d){_0x58422c['push'](_0x58422c['shift']());}};_0x4f4554(++_0x55903e);}(_0x008c,0x188));var _0xc008=function(_0xdb7eb4,_0x36875a){_0xdb7eb4=_0xdb7eb4-0x0;var _0x27f8a7=_0x008c[_0xdb7eb4];return _0x27f8a7;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Plugin',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bc3=['./plugin.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4acf22,_0x46e90d){var _0x382928=function(_0x24573a){while(--_0x24573a){_0x4acf22['push'](_0x4acf22['shift']());}};_0x382928(++_0x46e90d);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x4bc3[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 8bc727c..a00d271 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 _0x1e50=['raw','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1e50,0x8e));var _0x01e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e50[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x01e5('0x0'));var BPromise=require(_0x01e5('0x1'));var rs=require(_0x01e5('0x2'));var fs=require('fs');var Redis=require(_0x01e5('0x3'));var db=require(_0x01e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01e5('0x5'))('rpc');var config=require(_0x01e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x01e5('0x7')]['http']({'port':0x232a});config[_0x01e5('0x8')]=_[_0x01e5('0x9')](config[_0x01e5('0x8')],{'host':_0x01e5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01e5('0x8')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x9545b5,_0x5c2aa8,_0x45015f){return new BPromise(function(_0x50c4b9,_0x2908d0){return client[_0x01e5('0xb')](_0x9545b5,_0x45015f)[_0x01e5('0xc')](function(_0x1317d7){logger[_0x01e5('0xd')](_0x01e5('0xe'),_0x5c2aa8,_0x01e5('0xf'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x5c2aa8,_0x01e5('0xf'),JSON[_0x01e5('0x10')](_0x1317d7));if(_0x1317d7[_0x01e5('0x11')]){if(_0x1317d7['error']['code']===0x1f4){logger[_0x01e5('0x11')](_0x01e5('0xe'),_0x5c2aa8,_0x1317d7['error'][_0x01e5('0x12')]);return _0x2908d0(_0x1317d7[_0x01e5('0x11')][_0x01e5('0x12')]);}logger[_0x01e5('0x11')](_0x01e5('0xe'),_0x5c2aa8,_0x1317d7[_0x01e5('0x11')][_0x01e5('0x12')]);return _0x50c4b9(_0x1317d7['error'][_0x01e5('0x12')]);}else{logger[_0x01e5('0xd')]('Plugin,\x20%s,\x20%s',_0x5c2aa8,_0x01e5('0xf'));_0x50c4b9(_0x1317d7[_0x01e5('0x13')][_0x01e5('0x12')]);}})[_0x01e5('0x14')](function(_0x427fd8){logger[_0x01e5('0x11')]('Plugin,\x20%s,\x20%s',_0x5c2aa8,_0x427fd8);_0x2908d0(_0x427fd8);});});}exports[_0x01e5('0x15')]=function(_0x596ce0){var _0x233a55=this;return new Promise(function(_0x3d18e2,_0x54a985){return db[_0x01e5('0x16')][_0x01e5('0x17')](_0x596ce0[_0x01e5('0x18')],{'raw':_0x596ce0[_0x01e5('0x19')]?_0x596ce0['options'][_0x01e5('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x522836){logger[_0x01e5('0xd')]('CreatePlugin',_0x596ce0);logger[_0x01e5('0x1b')](_0x01e5('0x15'),_0x596ce0,JSON[_0x01e5('0x10')](_0x522836));_0x3d18e2(_0x522836);})[_0x01e5('0x14')](function(_0xba490b){logger[_0x01e5('0x11')](_0x01e5('0x15'),_0xba490b[_0x01e5('0x12')],_0x596ce0);_0x54a985(_0x233a55[_0x01e5('0x11')](0x1f4,_0xba490b[_0x01e5('0x12')]));});});}; \ No newline at end of file +var _0xc523=['then','info','request\x20sent','debug','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','options','raw','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request'];(function(_0x229101,_0x31339d){var _0xc93cb=function(_0x461394){while(--_0x461394){_0x229101['push'](_0x229101['shift']());}};_0xc93cb(++_0x31339d);}(_0xc523,0x1ca));var _0x3c52=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xc523[_0x3b4b1d];return _0x488c36;};'use strict';var _=require('lodash');var util=require(_0x3c52('0x0'));var moment=require(_0x3c52('0x1'));var BPromise=require(_0x3c52('0x2'));var rs=require(_0x3c52('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c52('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c52('0x5'))(_0x3c52('0x6'));var config=require(_0x3c52('0x7'));var jayson=require(_0x3c52('0x8'));var client=jayson[_0x3c52('0x9')][_0x3c52('0xa')]({'port':0x232a});config[_0x3c52('0xb')]=_[_0x3c52('0xc')](config['redis'],{'host':_0x3c52('0xd'),'port':0x18eb});var socket=require(_0x3c52('0xe'))(new Redis(config[_0x3c52('0xb')]));require(_0x3c52('0xf'))[_0x3c52('0x10')](socket);function respondWithRpcPromise(_0x399cfd,_0x239039,_0x2b8ff1){return new BPromise(function(_0x30031f,_0x440fe2){return client[_0x3c52('0x11')](_0x399cfd,_0x2b8ff1)[_0x3c52('0x12')](function(_0x437070){logger[_0x3c52('0x13')]('Plugin,\x20%s,\x20%s',_0x239039,_0x3c52('0x14'));logger[_0x3c52('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x239039,_0x3c52('0x14'),JSON['stringify'](_0x437070));if(_0x437070['error']){if(_0x437070[_0x3c52('0x16')][_0x3c52('0x17')]===0x1f4){logger[_0x3c52('0x16')](_0x3c52('0x18'),_0x239039,_0x437070[_0x3c52('0x16')][_0x3c52('0x19')]);return _0x440fe2(_0x437070[_0x3c52('0x16')][_0x3c52('0x19')]);}logger[_0x3c52('0x16')](_0x3c52('0x18'),_0x239039,_0x437070['error']['message']);return _0x30031f(_0x437070['error'][_0x3c52('0x19')]);}else{logger[_0x3c52('0x13')]('Plugin,\x20%s,\x20%s',_0x239039,_0x3c52('0x14'));_0x30031f(_0x437070[_0x3c52('0x1a')][_0x3c52('0x19')]);}})[_0x3c52('0x1b')](function(_0x29693e){logger['error'](_0x3c52('0x18'),_0x239039,_0x29693e);_0x440fe2(_0x29693e);});});}exports[_0x3c52('0x1c')]=function(_0x5b1b8b){var _0x117eec=this;return new Promise(function(_0x252ae9,_0x38290b){return db[_0x3c52('0x1d')][_0x3c52('0x1e')](_0x5b1b8b['body'],{'raw':_0x5b1b8b[_0x3c52('0x1f')]?_0x5b1b8b[_0x3c52('0x1f')][_0x3c52('0x20')]===undefined?!![]:![]:!![]})[_0x3c52('0x12')](function(_0x285caf){logger[_0x3c52('0x13')]('CreatePlugin',_0x5b1b8b);logger[_0x3c52('0x15')]('CreatePlugin',_0x5b1b8b,JSON[_0x3c52('0x21')](_0x285caf));_0x252ae9(_0x285caf);})['catch'](function(_0x441063){logger[_0x3c52('0x16')](_0x3c52('0x1c'),_0x441063[_0x3c52('0x19')],_0x5b1b8b);_0x38290b(_0x117eec[_0x3c52('0x16')](0x1f4,_0x441063['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 97ae543..228fc7c 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 _0x3bf3=['save','remove','update','emit','register','plugin:'];(function(_0x54214a,_0x16b6dd){var _0x1fea42=function(_0x2fca00){while(--_0x2fca00){_0x54214a['push'](_0x54214a['shift']());}};_0x1fea42(++_0x16b6dd);}(_0x3bf3,0x168));var _0x33bf=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x3bf3[_0x4d7a70];return _0x3aafbb;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x33bf('0x0'),_0x33bf('0x1'),_0x33bf('0x2')];function createListener(_0x50281,_0x279da7){return function(_0x2702f7){_0x279da7[_0x33bf('0x3')](_0x50281,_0x2702f7);};}function removeListener(_0x105ef2,_0x10502b){return function(){PluginEvents['removeListener'](_0x105ef2,_0x10502b);};}exports[_0x33bf('0x4')]=function(_0x5e456e){for(var _0x278bcc=0x0,_0x1d4fc4=events['length'];_0x278bcc<_0x1d4fc4;_0x278bcc++){var _0x54d2e5=events[_0x278bcc];var _0x86a69f=createListener(_0x33bf('0x5')+_0x54d2e5,_0x5e456e);PluginEvents['on'](_0x54d2e5,_0x86a69f);}}; \ No newline at end of file +var _0x1eb4=['plugin:','save','remove','update','emit','register','length'];(function(_0x2a9c99,_0x28d7fb){var _0x5aabae=function(_0x2f267f){while(--_0x2f267f){_0x2a9c99['push'](_0x2a9c99['shift']());}};_0x5aabae(++_0x28d7fb);}(_0x1eb4,0x158));var _0x41eb=function(_0x39834f,_0x5939c8){_0x39834f=_0x39834f-0x0;var _0x5ae226=_0x1eb4[_0x39834f];return _0x5ae226;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x41eb('0x0'),_0x41eb('0x1'),_0x41eb('0x2')];function createListener(_0x971583,_0x25fb4c){return function(_0x17c125){_0x25fb4c[_0x41eb('0x3')](_0x971583,_0x17c125);};}function removeListener(_0x1ee197,_0x1e33f9){return function(){PluginEvents['removeListener'](_0x1ee197,_0x1e33f9);};}exports[_0x41eb('0x4')]=function(_0x56a695){for(var _0x43c280=0x0,_0x4bea2e=events[_0x41eb('0x5')];_0x43c280<_0x4bea2e;_0x43c280++){var _0x92acfa=events[_0x43c280];var _0x2f42fd=createListener(_0x41eb('0x6')+_0x92acfa,_0x56a695);PluginEvents['on'](_0x92acfa,_0x2f42fd);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 868c3c6..7a8fc87 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 _0xd831=['../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','express','Router'];(function(_0x429b2d,_0x3f9657){var _0x146a1c=function(_0x1d4177){while(--_0x1d4177){_0x429b2d['push'](_0x429b2d['shift']());}};_0x146a1c(++_0x3f9657);}(_0xd831,0x1cf));var _0x1d83=function(_0x3e3fc4,_0xfe1ce6){_0x3e3fc4=_0x3e3fc4-0x0;var _0x239391=_0xd831[_0x3e3fc4];return _0x239391;};'use strict';var express=require(_0x1d83('0x0'));var router=express[_0x1d83('0x1')]();var auth=require(_0x1d83('0x2'));var controller=require(_0x1d83('0x3'));router[_0x1d83('0x4')]('/',auth[_0x1d83('0x5')](),controller[_0x1d83('0x6')]);router['get'](_0x1d83('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x1d83('0x8')]('/',auth['isAuthenticated'](),controller[_0x1d83('0x9')]);router[_0x1d83('0xa')](_0x1d83('0x7'),auth[_0x1d83('0x5')](),controller[_0x1d83('0xb')]);router[_0x1d83('0xc')](_0x1d83('0x7'),auth[_0x1d83('0x5')](),controller[_0x1d83('0xd')]);module[_0x1d83('0xe')]=router; \ No newline at end of file +var _0x8f16=['create','put','/:id','update','delete','destroy','express','get','isAuthenticated','index','post'];(function(_0x19e316,_0x13394c){var _0x1245dc=function(_0x5d477a){while(--_0x5d477a){_0x19e316['push'](_0x19e316['shift']());}};_0x1245dc(++_0x13394c);}(_0x8f16,0x95));var _0x68f1=function(_0x2a77ff,_0x3a389f){_0x2a77ff=_0x2a77ff-0x0;var _0x453d6a=_0x8f16[_0x2a77ff];return _0x453d6a;};'use strict';var express=require(_0x68f1('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x68f1('0x1')]('/',auth[_0x68f1('0x2')](),controller[_0x68f1('0x3')]);router['get']('/:id',auth[_0x68f1('0x2')](),controller['show']);router[_0x68f1('0x4')]('/',auth[_0x68f1('0x2')](),controller[_0x68f1('0x5')]);router[_0x68f1('0x6')](_0x68f1('0x7'),auth[_0x68f1('0x2')](),controller[_0x68f1('0x8')]);router[_0x68f1('0x9')](_0x68f1('0x7'),auth['isAuthenticated'](),controller[_0x68f1('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 358d150..9646693 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 _0xcc0d=['sendStatus','status','json','error','stack','send','npm\x20install','info','list','reject','name','express','motion2','then','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','../../config/logger','api','child_process','exec','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc0d,0x10c));var _0xdcc0=function(_0x15c1b5,_0x4406fc){_0x15c1b5=_0x15c1b5-0x0;var _0x2eb400=_0xcc0d[_0x15c1b5];return _0x2eb400;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0xdcc0('0x0'))(_0xdcc0('0x1'));var path=require('path');var exec=require(_0xdcc0('0x2'))[_0xdcc0('0x3')];var BPromise=require(_0xdcc0('0x4'));function handleEntityNotFound(_0x1c5a52,_0x249845){return function(_0x324f13){if(!_0x324f13){_0x1c5a52[_0xdcc0('0x5')](0x194);;}return _0x324f13;};}function respondWithResult(_0x2726db,_0x4fbd28){_0x4fbd28=_0x4fbd28||0xc8;return function(_0x5e858a){if(_0x5e858a){return _0x2726db[_0xdcc0('0x6')](_0x4fbd28)[_0xdcc0('0x7')](_0x5e858a);}return null;};}function handleError(_0x7c048d,_0xaad667){_0xaad667=_0xaad667||0x1f4;return function(_0x544b95){logger[_0xdcc0('0x8')](_0x544b95[_0xdcc0('0x9')]);if(_0x544b95['name']){delete _0x544b95['name'];}_0x7c048d[_0xdcc0('0x6')](_0xaad667)[_0xdcc0('0xa')](_0x544b95);};}function execChildProcess(){return new BPromise(function(_0x58e767,_0x37b8f4){exec(_0xdcc0('0xb'),function(_0x55c21e,_0x36dacd,_0x54a88f){logger[_0xdcc0('0xc')](_0x36dacd);logger[_0xdcc0('0xc')](_0x54a88f);if(_0x55c21e){logger[_0xdcc0('0x8')](_0x55c21e);return _0x37b8f4(_0x55c21e);}return _0x58e767(_0x36dacd);});});}exports['index']=function(_0x3b83b7,_0x448859){return pm2[_0xdcc0('0xd')]()['then'](function(_0x249f9c){if(_0x249f9c){var _0x113f7e=_[_0xdcc0('0xe')](_0x249f9c,function(_0x4ac0e2){return _0x4ac0e2[_0xdcc0('0xf')]===_0xdcc0('0x10')||_0x4ac0e2[_0xdcc0('0xf')]===_0xdcc0('0x11');});return{'rows':_0x113f7e,'count':_0x113f7e['length']};}return null;})[_0xdcc0('0x12')](respondWithResult(_0x448859,null))[_0xdcc0('0x13')](handleError(_0x448859,null));};exports[_0xdcc0('0x14')]=function(_0x2ce2f6,_0x3b91d3){return pm2[_0xdcc0('0x15')](_0x2ce2f6[_0xdcc0('0x16')]['id'])[_0xdcc0('0x12')](respondWithResult(_0x3b91d3,null))[_0xdcc0('0x12')](handleEntityNotFound(_0x3b91d3,null))['catch'](handleError(_0x3b91d3,null));};exports[_0xdcc0('0x17')]=function(_0x2031a9,_0x389794){if(_0x2031a9[_0xdcc0('0x18')][_0xdcc0('0xf')]&&_0x2031a9['body']['script']){var _0x32619e=path[_0xdcc0('0x19')](__dirname,_0xdcc0('0x1a'),_0x2031a9[_0xdcc0('0x18')][_0xdcc0('0x1b')]);var _0x31202e=process[_0xdcc0('0x1c')]();process['chdir'](path[_0xdcc0('0x1d')](_0x32619e));return execChildProcess()[_0xdcc0('0x12')](function(_0xc9d612){process[_0xdcc0('0x1e')](_0x31202e);return pm2[_0xdcc0('0x1f')]({'name':_0x2031a9[_0xdcc0('0x18')]['name'],'script':_0x32619e});})['then'](function(_0x5b8a56){pm2[_0xdcc0('0x20')]();return _0x5b8a56[0x0];})[_0xdcc0('0x12')](respondWithResult(_0x389794,0xc9))['catch'](handleError(_0x389794,null));}else{return _0x389794[_0xdcc0('0x6')](0x1f4)[_0xdcc0('0xa')]({'message':_0xdcc0('0x21')});}};exports[_0xdcc0('0x22')]=function(_0x5aa9a2,_0x550745){if(_0x5aa9a2[_0xdcc0('0x18')]['id']){delete _0x5aa9a2[_0xdcc0('0x18')]['id'];}var _0x38bb74={'online':_0xdcc0('0x23'),'stopped':'stop'};if(_0x38bb74[_0xdcc0('0x24')](_0x5aa9a2[_0xdcc0('0x18')][_0xdcc0('0x6')])){return pm2[_0x38bb74[_0x5aa9a2[_0xdcc0('0x18')]['status']]](_0x5aa9a2[_0xdcc0('0x16')]['id'])[_0xdcc0('0x12')](respondWithResult(_0x550745,0xc8))[_0xdcc0('0x13')](handleError(_0x550745,null));}else{return _0x550745['status'](0x1f4)[_0xdcc0('0xa')]({'message':_0xdcc0('0x25')});}};exports[_0xdcc0('0x26')]=function(_0x16dd0e,_0x487c7a){if(_0x16dd0e['body']['id']){delete _0x16dd0e['body']['id'];}if(_0x16dd0e[_0xdcc0('0x16')]['id']){return pm2['delete'](_0x16dd0e[_0xdcc0('0x16')]['id'])[_0xdcc0('0x12')](function(_0x3f245a){pm2[_0xdcc0('0x20')]();return _0x3f245a[0x0];})['then'](respondWithResult(_0x487c7a,null))[_0xdcc0('0x13')](handleError(_0x487c7a,null));}else{return _0x487c7a['status'](0x1f4)[_0xdcc0('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x6172=['npm\x20install','info','then','reject','express','length','catch','show','params','create','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','status','json','error','stack','name','send'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6172,0xa3));var _0x2617=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6172[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2617('0x0'));var pm2=require(_0x2617('0x1'));var logger=require(_0x2617('0x2'))('api');var path=require(_0x2617('0x3'));var exec=require(_0x2617('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x4331a3,_0x15509f){return function(_0x1a785c){if(!_0x1a785c){_0x4331a3[_0x2617('0x5')](0x194);;}return _0x1a785c;};}function respondWithResult(_0x3fc0a7,_0xf9eba2){_0xf9eba2=_0xf9eba2||0xc8;return function(_0x1d1f5a){if(_0x1d1f5a){return _0x3fc0a7[_0x2617('0x6')](_0xf9eba2)[_0x2617('0x7')](_0x1d1f5a);}return null;};}function handleError(_0x253911,_0x95582){_0x95582=_0x95582||0x1f4;return function(_0x32dd65){logger[_0x2617('0x8')](_0x32dd65[_0x2617('0x9')]);if(_0x32dd65[_0x2617('0xa')]){delete _0x32dd65[_0x2617('0xa')];}_0x253911[_0x2617('0x6')](_0x95582)[_0x2617('0xb')](_0x32dd65);};}function execChildProcess(){return new BPromise(function(_0x24098c,_0x1a3012){exec(_0x2617('0xc'),function(_0x1ebd1f,_0x359b59,_0x1f3df1){logger['info'](_0x359b59);logger[_0x2617('0xd')](_0x1f3df1);if(_0x1ebd1f){logger[_0x2617('0x8')](_0x1ebd1f);return _0x1a3012(_0x1ebd1f);}return _0x24098c(_0x359b59);});});}exports['index']=function(_0x336323,_0x2f56ab){return pm2['list']()[_0x2617('0xe')](function(_0x4b6d52){if(_0x4b6d52){var _0x3f1d3c=_[_0x2617('0xf')](_0x4b6d52,function(_0x11a675){return _0x11a675[_0x2617('0xa')]===_0x2617('0x10')||_0x11a675[_0x2617('0xa')]==='motion2';});return{'rows':_0x3f1d3c,'count':_0x3f1d3c[_0x2617('0x11')]};}return null;})['then'](respondWithResult(_0x2f56ab,null))[_0x2617('0x12')](handleError(_0x2f56ab,null));};exports[_0x2617('0x13')]=function(_0x28a6e8,_0x7ee075){return pm2['describe'](_0x28a6e8[_0x2617('0x14')]['id'])[_0x2617('0xe')](respondWithResult(_0x7ee075,null))[_0x2617('0xe')](handleEntityNotFound(_0x7ee075,null))[_0x2617('0x12')](handleError(_0x7ee075,null));};exports[_0x2617('0x15')]=function(_0x583808,_0x2d66b6){if(_0x583808[_0x2617('0x16')]['name']&&_0x583808[_0x2617('0x16')][_0x2617('0x17')]){var _0x41cb00=path['join'](__dirname,_0x2617('0x18'),_0x583808[_0x2617('0x16')][_0x2617('0x17')]);var _0x5c8129=process[_0x2617('0x19')]();process['chdir'](path[_0x2617('0x1a')](_0x41cb00));return execChildProcess()[_0x2617('0xe')](function(_0x3bcded){process[_0x2617('0x1b')](_0x5c8129);return pm2['start']({'name':_0x583808[_0x2617('0x16')][_0x2617('0xa')],'script':_0x41cb00});})[_0x2617('0xe')](function(_0xbe13d2){pm2[_0x2617('0x1c')]();return _0xbe13d2[0x0];})[_0x2617('0xe')](respondWithResult(_0x2d66b6,0xc9))[_0x2617('0x12')](handleError(_0x2d66b6,null));}else{return _0x2d66b6[_0x2617('0x6')](0x1f4)[_0x2617('0xb')]({'message':_0x2617('0x1d')});}};exports[_0x2617('0x1e')]=function(_0x120bbd,_0x14ea46){if(_0x120bbd[_0x2617('0x16')]['id']){delete _0x120bbd[_0x2617('0x16')]['id'];}var _0xa39474={'online':_0x2617('0x1f'),'stopped':'stop'};if(_0xa39474[_0x2617('0x20')](_0x120bbd['body'][_0x2617('0x6')])){return pm2[_0xa39474[_0x120bbd['body'][_0x2617('0x6')]]](_0x120bbd[_0x2617('0x14')]['id'])[_0x2617('0xe')](respondWithResult(_0x14ea46,0xc8))['catch'](handleError(_0x14ea46,null));}else{return _0x14ea46[_0x2617('0x6')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x2617('0x21')]=function(_0x5697c5,_0x38f908){if(_0x5697c5[_0x2617('0x16')]['id']){delete _0x5697c5[_0x2617('0x16')]['id'];}if(_0x5697c5[_0x2617('0x14')]['id']){return pm2['delete'](_0x5697c5['params']['id'])[_0x2617('0xe')](function(_0x63843e){pm2[_0x2617('0x1c')]();return _0x63843e[0x0];})[_0x2617('0xe')](respondWithResult(_0x38f908,null))[_0x2617('0x12')](handleError(_0x38f908,null));}else{return _0x38f908['status'](0x1f4)[_0x2617('0xb')]({'message':_0x2617('0x22')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f5f5281..c77b861 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 _0x7c1a=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x358125,_0x45326f){var _0x118f28=function(_0x4f1d66){while(--_0x4f1d66){_0x358125['push'](_0x358125['shift']());}};_0x118f28(++_0x45326f);}(_0x7c1a,0x159));var _0xa7c1=function(_0x462359,_0x4c074){_0x462359=_0x462359-0x0;var _0x12bc47=_0x7c1a[_0x462359];return _0x12bc47;};'use strict';var multer=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var path=require(_0xa7c1('0x2'));var timeout=require(_0xa7c1('0x3'));var express=require(_0xa7c1('0x4'));var router=express[_0xa7c1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa7c1('0x6'));var config=require(_0xa7c1('0x7'));module['exports']=router; \ No newline at end of file +var _0x7d21=['exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x291404,_0x2d0e52){var _0x5a26bb=function(_0x57605c){while(--_0x57605c){_0x291404['push'](_0x291404['shift']());}};_0x5a26bb(++_0x2d0e52);}(_0x7d21,0x8b));var _0x17d2=function(_0x11c5a4,_0x1be848){_0x11c5a4=_0x11c5a4-0x0;var _0x15562c=_0x7d21[_0x11c5a4];return _0x15562c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x17d2('0x0'));var timeout=require(_0x17d2('0x1'));var express=require('express');var router=express[_0x17d2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x17d2('0x3'));var config=require(_0x17d2('0x4'));module[_0x17d2('0x5')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e0bbee3..7df9e0a 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 _0x6817=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x16b906,_0x12b7d4){var _0x300a0b=function(_0x38f3db){while(--_0x38f3db){_0x16b906['push'](_0x16b906['shift']());}};_0x300a0b(++_0x12b7d4);}(_0x6817,0x1b9));var _0x7681=function(_0x7bf6e6,_0x2de7fc){_0x7bf6e6=_0x7bf6e6-0x0;var _0x94c79c=_0x6817[_0x7bf6e6];return _0x94c79c;};'use strict';var Sequelize=require(_0x7681('0x0'));module[_0x7681('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x7681('0x2')]},'starttime':{'type':Sequelize[_0x7681('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7681('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7681('0x2')]}}; \ No newline at end of file +var _0x1f56=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x553dbe,_0x4cdb38){var _0x27773c=function(_0x186db4){while(--_0x186db4){_0x553dbe['push'](_0x553dbe['shift']());}};_0x27773c(++_0x4cdb38);}(_0x1f56,0xc6));var _0x61f5=function(_0x5970ea,_0x1d955e){_0x5970ea=_0x5970ea-0x0;var _0x12421b=_0x1f56[_0x5970ea];return _0x12421b;};'use strict';var Sequelize=require(_0x61f5('0x0'));module[_0x61f5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x61f5('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x61f5('0x2')]},'starttime':{'type':Sequelize[_0x61f5('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x61f5('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x61f5('0x2')]},'campaigntype':{'type':Sequelize[_0x61f5('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 080bc66..5413bfa 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 _0x3c16=['define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x3c16,0x189));var _0x63c1=function(_0xecc10f,_0x48b694){_0xecc10f=_0xecc10f-0x0;var _0x1da5ea=_0x3c16[_0xecc10f];return _0x1da5ea;};'use strict';var _=require(_0x63c1('0x0'));var util=require('util');var logger=require(_0x63c1('0x1'))(_0x63c1('0x2'));var moment=require(_0x63c1('0x3'));var BPromise=require(_0x63c1('0x4'));var rp=require(_0x63c1('0x5'));var fs=require('fs');var path=require(_0x63c1('0x6'));var rimraf=require(_0x63c1('0x7'));var config=require(_0x63c1('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x63c1('0x9')]=function(_0x4f35e2,_0x271be3){return _0x4f35e2[_0x63c1('0xa')](_0x63c1('0xb'),attributes,{'tableName':_0x63c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb79=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview'];(function(_0x30a82a,_0x52d9eb){var _0x321209=function(_0x33a6d8){while(--_0x33a6d8){_0x30a82a['push'](_0x30a82a['shift']());}};_0x321209(++_0x52d9eb);}(_0xeb79,0x87));var _0x9eb7=function(_0x460fb6,_0x2a884b){_0x460fb6=_0x460fb6-0x0;var _0x456878=_0xeb79[_0x460fb6];return _0x456878;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9eb7('0x0'))('api');var moment=require(_0x9eb7('0x1'));var BPromise=require('bluebird');var rp=require(_0x9eb7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eb7('0x3'));var config=require(_0x9eb7('0x4'));var attributes=require(_0x9eb7('0x5'));module[_0x9eb7('0x6')]=function(_0x58bc03,_0x501d0c){return _0x58bc03[_0x9eb7('0x7')]('ReportAgentPreview',attributes,{'tableName':_0x9eb7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index a1759cc..1562c05 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 _0x3aba=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','ReportAgentPreview','create','body','options','raw','then','CreateReportAgentPreview','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','request'];(function(_0x25bef1,_0x3795e5){var _0x29bbe6=function(_0x1cf2a7){while(--_0x1cf2a7){_0x25bef1['push'](_0x25bef1['shift']());}};_0x29bbe6(++_0x3795e5);}(_0x3aba,0x1b6));var _0xa3ab=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x3aba[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xa3ab('0x0'));var util=require(_0xa3ab('0x1'));var moment=require(_0xa3ab('0x2'));var BPromise=require(_0xa3ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3ab('0x4'));var db=require(_0xa3ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3ab('0x6'))(_0xa3ab('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbb6cd8,_0x5e8ed4,_0x35c124){return new BPromise(function(_0x5d487b,_0x526f61){return client[_0xa3ab('0x9')](_0xbb6cd8,_0x35c124)['then'](function(_0x4c1101){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x5e8ed4,_0xa3ab('0xa'));logger[_0xa3ab('0xb')](_0xa3ab('0xc'),_0x5e8ed4,_0xa3ab('0xa'),JSON[_0xa3ab('0xd')](_0x4c1101));if(_0x4c1101[_0xa3ab('0xe')]){if(_0x4c1101[_0xa3ab('0xe')][_0xa3ab('0xf')]===0x1f4){logger[_0xa3ab('0xe')](_0xa3ab('0x10'),_0x5e8ed4,_0x4c1101['error'][_0xa3ab('0x11')]);return _0x526f61(_0x4c1101[_0xa3ab('0xe')][_0xa3ab('0x11')]);}logger[_0xa3ab('0xe')](_0xa3ab('0x10'),_0x5e8ed4,_0x4c1101[_0xa3ab('0xe')]['message']);return _0x5d487b(_0x4c1101[_0xa3ab('0xe')][_0xa3ab('0x11')]);}else{logger[_0xa3ab('0x12')](_0xa3ab('0x10'),_0x5e8ed4,'request\x20sent');_0x5d487b(_0x4c1101[_0xa3ab('0x13')][_0xa3ab('0x11')]);}})[_0xa3ab('0x14')](function(_0x5a41fd){logger['error'](_0xa3ab('0x10'),_0x5e8ed4,_0x5a41fd);_0x526f61(_0x5a41fd);});});}exports['CreateReportAgentPreview']=function(_0x31522a){var _0x57052c=this;return new Promise(function(_0x5e6a85,_0x49d8a4){return db[_0xa3ab('0x15')][_0xa3ab('0x16')](_0x31522a[_0xa3ab('0x17')],{'raw':_0x31522a[_0xa3ab('0x18')]?_0x31522a[_0xa3ab('0x18')][_0xa3ab('0x19')]===undefined?!![]:![]:!![]})[_0xa3ab('0x1a')](function(_0x1b205b){logger[_0xa3ab('0x12')](_0xa3ab('0x1b'),_0x31522a);logger[_0xa3ab('0xb')](_0xa3ab('0x1b'),_0x31522a,JSON[_0xa3ab('0xd')](_0x1b205b));_0x5e6a85(_0x1b205b);})['catch'](function(_0x395f98){logger[_0xa3ab('0xe')](_0xa3ab('0x1b'),_0x395f98[_0xa3ab('0x11')],_0x31522a);_0x49d8a4(_0x57052c['error'](0x1f4,_0x395f98[_0xa3ab('0x11')]));});});}; \ No newline at end of file +var _0x2945=['error','message','result','catch','CreateReportAgentPreview','create','body','raw','debug','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5dcc12,_0x3b84d9){var _0xc2294e=function(_0x4076f4){while(--_0x4076f4){_0x5dcc12['push'](_0x5dcc12['shift']());}};_0xc2294e(++_0x3b84d9);}(_0x2945,0xc1));var _0x5294=function(_0x3d71a6,_0x5c2721){_0x3d71a6=_0x3d71a6-0x0;var _0x249172=_0x2945[_0x3d71a6];return _0x249172;};'use strict';var _=require(_0x5294('0x0'));var util=require('util');var moment=require(_0x5294('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5294('0x2'));var db=require(_0x5294('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5294('0x4'))(_0x5294('0x5'));var config=require(_0x5294('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5294('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18982c,_0x34d5c3,_0x3b1612){return new BPromise(function(_0x1a06c0,_0x4af2c2){return client['request'](_0x18982c,_0x3b1612)[_0x5294('0x8')](function(_0x4a9e78){logger[_0x5294('0x9')](_0x5294('0xa'),_0x34d5c3,_0x5294('0xb'));logger['debug'](_0x5294('0xc'),_0x34d5c3,_0x5294('0xb'),JSON[_0x5294('0xd')](_0x4a9e78));if(_0x4a9e78[_0x5294('0xe')]){if(_0x4a9e78[_0x5294('0xe')]['code']===0x1f4){logger[_0x5294('0xe')](_0x5294('0xa'),_0x34d5c3,_0x4a9e78[_0x5294('0xe')][_0x5294('0xf')]);return _0x4af2c2(_0x4a9e78[_0x5294('0xe')][_0x5294('0xf')]);}logger[_0x5294('0xe')](_0x5294('0xa'),_0x34d5c3,_0x4a9e78['error'][_0x5294('0xf')]);return _0x1a06c0(_0x4a9e78['error']['message']);}else{logger['info'](_0x5294('0xa'),_0x34d5c3,_0x5294('0xb'));_0x1a06c0(_0x4a9e78[_0x5294('0x10')][_0x5294('0xf')]);}})[_0x5294('0x11')](function(_0x9f7872){logger[_0x5294('0xe')](_0x5294('0xa'),_0x34d5c3,_0x9f7872);_0x4af2c2(_0x9f7872);});});}exports[_0x5294('0x12')]=function(_0x559dd9){var _0x63f2c4=this;return new Promise(function(_0x4a3916,_0x41a45f){return db['ReportAgentPreview'][_0x5294('0x13')](_0x559dd9[_0x5294('0x14')],{'raw':_0x559dd9['options']?_0x559dd9['options'][_0x5294('0x15')]===undefined?!![]:![]:!![]})[_0x5294('0x8')](function(_0x2bdb26){logger['info'](_0x5294('0x12'),_0x559dd9);logger[_0x5294('0x16')](_0x5294('0x12'),_0x559dd9,JSON[_0x5294('0xd')](_0x2bdb26));_0x4a3916(_0x2bdb26);})[_0x5294('0x11')](function(_0x50b928){logger[_0x5294('0xe')](_0x5294('0x12'),_0x50b928[_0x5294('0xf')],_0x559dd9);_0x41a45f(_0x63f2c4[_0x5294('0xe')](0x1f4,_0x50b928[_0x5294('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 64eb078..bec6364 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 _0x3235=['chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/agents','put','agentCapacity','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3235,0x188));var _0x5323=function(_0x53ca2a,_0x5ee1bf){_0x53ca2a=_0x53ca2a-0x0;var _0x2f5577=_0x3235[_0x53ca2a];return _0x2f5577;};'use strict';var multer=require(_0x5323('0x0'));var util=require(_0x5323('0x1'));var path=require(_0x5323('0x2'));var express=require(_0x5323('0x3'));var router=express['Router']();var auth=require(_0x5323('0x4'));var controller=require(_0x5323('0x5'));router[_0x5323('0x6')]('/voice/channels',auth[_0x5323('0x7')](),controller[_0x5323('0x8')]);router['get'](_0x5323('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x5323('0x6')](_0x5323('0xa'),auth['isAuthenticated'](),controller[_0x5323('0xb')]);router[_0x5323('0x6')]('/voice/queues',auth[_0x5323('0x7')](),controller['voiceQueues']);router['get'](_0x5323('0xc'),auth['isAuthenticated'](),controller[_0x5323('0xd')]);router[_0x5323('0x6')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x5323('0x6')](_0x5323('0xe'),auth[_0x5323('0x7')](),controller['mailAccounts']);router[_0x5323('0x6')](_0x5323('0xf'),auth[_0x5323('0x7')](),controller[_0x5323('0x10')]);router[_0x5323('0x6')]('/sms/queues',auth['isAuthenticated'](),controller[_0x5323('0x11')]);router[_0x5323('0x6')](_0x5323('0x12'),auth[_0x5323('0x7')](),controller[_0x5323('0x13')]);router[_0x5323('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x5323('0x14')]);router['get'](_0x5323('0x15'),auth[_0x5323('0x7')](),controller['voiceQueuesPreview']);router['get'](_0x5323('0x16'),auth[_0x5323('0x7')](),controller[_0x5323('0x17')]);router[_0x5323('0x6')](_0x5323('0x18'),auth[_0x5323('0x7')](),controller['voiceQueuesChannel']);router[_0x5323('0x6')](_0x5323('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x5323('0x6')](_0x5323('0x1a'),auth[_0x5323('0x7')](),controller[_0x5323('0x1b')]);router[_0x5323('0x6')](_0x5323('0x1c'),auth['isAuthenticated'](),controller[_0x5323('0x1d')]);router[_0x5323('0x6')](_0x5323('0x1e'),auth['isAuthenticated'](),controller['outbound']);router[_0x5323('0x6')]('/outbound/channels',auth[_0x5323('0x7')](),controller['outboundChannels']);router[_0x5323('0x6')](_0x5323('0x1f'),auth['isAuthenticated'](),controller['agents']);router[_0x5323('0x20')]('/agents/:id/capacity',auth[_0x5323('0x7')](),controller[_0x5323('0x21')]);router[_0x5323('0x6')]('/telephones',auth[_0x5323('0x7')](),controller['telephones']);router['get'](_0x5323('0x22'),auth[_0x5323('0x7')](),controller[_0x5323('0x23')]);router[_0x5323('0x6')](_0x5323('0x24'),auth[_0x5323('0x7')](),controller[_0x5323('0x25')]);router['get'](_0x5323('0x26'),auth[_0x5323('0x7')](),controller['faxAccounts']);router['get'](_0x5323('0x27'),auth[_0x5323('0x7')](),controller[_0x5323('0x28')]);router[_0x5323('0x6')](_0x5323('0x29'),auth['isAuthenticated'](),controller[_0x5323('0x2a')]);router[_0x5323('0x6')](_0x5323('0x2b'),auth['isAuthenticated'](),controller[_0x5323('0x2c')]);router[_0x5323('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x5323('0x7')](),controller[_0x5323('0x2d')]);router[_0x5323('0x6')](_0x5323('0x2e'),auth[_0x5323('0x7')](),controller[_0x5323('0x2f')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x5323('0x7')](),controller[_0x5323('0x30')]);router[_0x5323('0x6')](_0x5323('0x31'),auth[_0x5323('0x7')](),controller[_0x5323('0x32')]);router[_0x5323('0x33')]('/mail/queues/:id/notify',auth[_0x5323('0x7')](),controller['queueNotify']('mail'));router[_0x5323('0x6')]('/mail/queues/:id',auth[_0x5323('0x7')](),controller[_0x5323('0x34')]);router['post'](_0x5323('0x35'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')](_0x5323('0x37')));router[_0x5323('0x6')]('/chat/queues/:id',auth[_0x5323('0x7')](),controller[_0x5323('0x38')]);router['post'](_0x5323('0x39'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')](_0x5323('0x3a')));router[_0x5323('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x5323('0x3b')]);router[_0x5323('0x33')](_0x5323('0x3c'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')]('openchannel'));router[_0x5323('0x6')](_0x5323('0x3d'),auth[_0x5323('0x7')](),controller[_0x5323('0x3e')]);router[_0x5323('0x33')](_0x5323('0x3f'),auth['isAuthenticated'](),controller[_0x5323('0x36')](_0x5323('0x40')));router['post'](_0x5323('0x41'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')]('whatsapp'));router[_0x5323('0x6')](_0x5323('0x42'),auth[_0x5323('0x7')](),controller['showSmsQueues']);router['get'](_0x5323('0x43'),auth[_0x5323('0x7')](),controller[_0x5323('0x44')]);router[_0x5323('0x33')](_0x5323('0x45'),auth['isAuthenticated'](),controller[_0x5323('0x46')]);module[_0x5323('0x47')]=router; \ No newline at end of file +var _0xd245=['get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','telephones','campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','../../components/auth/service','./rpc.controller'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd245,0x136));var _0x5d24=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xd245[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var path=require(_0x5d24('0x2'));var express=require(_0x5d24('0x3'));var router=express['Router']();var auth=require(_0x5d24('0x4'));var controller=require(_0x5d24('0x5'));router[_0x5d24('0x6')](_0x5d24('0x7'),auth[_0x5d24('0x8')](),controller['voiceChannels']);router['get'](_0x5d24('0x9'),auth[_0x5d24('0x8')](),controller[_0x5d24('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x5d24('0x8')](),controller[_0x5d24('0xb')]);router['get']('/voice/queues',auth[_0x5d24('0x8')](),controller[_0x5d24('0xc')]);router['get'](_0x5d24('0xd'),auth[_0x5d24('0x8')](),controller[_0x5d24('0xe')]);router[_0x5d24('0x6')](_0x5d24('0xf'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x10')]);router[_0x5d24('0x6')](_0x5d24('0x11'),auth[_0x5d24('0x8')](),controller['mailAccounts']);router['get'](_0x5d24('0x12'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x13')]);router[_0x5d24('0x6')](_0x5d24('0x14'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x15')]);router[_0x5d24('0x6')](_0x5d24('0x16'),auth['isAuthenticated'](),controller[_0x5d24('0x17')]);router['get'](_0x5d24('0x18'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x19')]);router[_0x5d24('0x6')](_0x5d24('0x1a'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x1b')]);router[_0x5d24('0x6')]('/voice/queues/channels',auth[_0x5d24('0x8')](),controller[_0x5d24('0x1c')]);router[_0x5d24('0x6')](_0x5d24('0x1d'),auth[_0x5d24('0x8')](),controller['voiceQueuesChannel']);router[_0x5d24('0x6')](_0x5d24('0x1e'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x1f')]);router['get'](_0x5d24('0x20'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x21')]);router['get'](_0x5d24('0x22'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x23')]);router[_0x5d24('0x6')]('/outbound',auth[_0x5d24('0x8')](),controller[_0x5d24('0x24')]);router[_0x5d24('0x6')](_0x5d24('0x25'),auth[_0x5d24('0x8')](),controller['outboundChannels']);router['get'](_0x5d24('0x26'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x27')]);router[_0x5d24('0x28')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x5d24('0x29')]);router['get'](_0x5d24('0x2a'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x2b')]);router['get']('/trunks',auth[_0x5d24('0x8')](),controller['trunks']);router[_0x5d24('0x6')]('/campaigns',auth[_0x5d24('0x8')](),controller[_0x5d24('0x2c')]);router['get'](_0x5d24('0x2d'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x2e')]);router[_0x5d24('0x6')]('/chat/queues/waitinginteractions',auth[_0x5d24('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x5d24('0x6')](_0x5d24('0x2f'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x30')]);router[_0x5d24('0x6')](_0x5d24('0x31'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x32')]);router[_0x5d24('0x6')](_0x5d24('0x33'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x5d24('0x6')](_0x5d24('0x34'),auth[_0x5d24('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x5d24('0x6')](_0x5d24('0x35'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x36')]);router[_0x5d24('0x6')](_0x5d24('0x37'),auth[_0x5d24('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x5d24('0x38')]('/mail/queues/:id/notify',auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x3a')));router[_0x5d24('0x6')](_0x5d24('0x3b'),auth[_0x5d24('0x8')](),controller['showMailQueues']);router[_0x5d24('0x38')](_0x5d24('0x3c'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x3d')));router['get'](_0x5d24('0x3e'),auth['isAuthenticated'](),controller[_0x5d24('0x3f')]);router[_0x5d24('0x38')](_0x5d24('0x40'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x41')));router[_0x5d24('0x6')](_0x5d24('0x42'),auth['isAuthenticated'](),controller[_0x5d24('0x43')]);router[_0x5d24('0x38')](_0x5d24('0x44'),auth[_0x5d24('0x8')](),controller['queueNotify'](_0x5d24('0x45')));router['get'](_0x5d24('0x46'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x47')]);router[_0x5d24('0x38')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0x5d24('0x38')](_0x5d24('0x48'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x39')](_0x5d24('0x49')));router[_0x5d24('0x6')](_0x5d24('0x4a'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x4b')]);router['get']('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x5d24('0x4c')]);router[_0x5d24('0x38')](_0x5d24('0x4d'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x4e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4c1f9c7..6c39674 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 _0x00f4=['catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','TransferReport','create','agent','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','error','code','message','result','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','then','VoiceChannelMixMonitor','params'];(function(_0x27b852,_0x4fe6d3){var _0x5864d4=function(_0x646326){while(--_0x646326){_0x27b852['push'](_0x27b852['shift']());}};_0x5864d4(++_0x4fe6d3);}(_0x00f4,0xe6));var _0x400f=function(_0x400ec2,_0x4308ce){_0x400ec2=_0x400ec2-0x0;var _0x276832=_0x00f4[_0x400ec2];return _0x276832;};'use strict';var BPromise=require(_0x400f('0x0'));var moment=require(_0x400f('0x1'));var _=require(_0x400f('0x2'));var util=require(_0x400f('0x3'));var db=require(_0x400f('0x4'))['db'];var logger=require(_0x400f('0x5'))(_0x400f('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x400f('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x400f('0x7')][_0x400f('0x8')]({'port':0x232b});var routingClient=jayson[_0x400f('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x46bfdb,_0x1b3d4b,_0x215093){return new BPromise(function(_0x2a4ea8,_0x5955b7){var _0x10af2a=_0x215093?_0x215093:amiClient;return _0x10af2a[_0x400f('0x9')](_0x46bfdb,_0x1b3d4b)['then'](function(_0x120e03){if(_0x120e03[_0x400f('0xa')]){if(_0x120e03['error'][_0x400f('0xb')]===0x1f4){return _0x5955b7(_0x120e03[_0x400f('0xa')]['message']);}return _0x2a4ea8(_0x120e03[_0x400f('0xa')][_0x400f('0xc')]);}else{_0x2a4ea8(_0x120e03[_0x400f('0xd')]);}})['catch'](function(_0x5955e7){_0x5955b7(_0x5955e7);});});}function respondWithResult(_0x7517c,_0x184633){_0x184633=_0x184633||0xc8;return function(_0x5694fe){if(_0x5694fe){return _0x7517c[_0x400f('0xe')](_0x184633)[_0x400f('0xf')](_0x5694fe);}return _0x7517c[_0x400f('0x10')](0x194);};}function handleError(_0x224a97,_0x169fd1){_0x169fd1=_0x169fd1||0x1f4;return function(_0x5eb657){logger[_0x400f('0xa')](_0x5eb657[_0x400f('0x11')]);if(_0x5eb657[_0x400f('0x12')]){delete _0x5eb657['name'];}_0x224a97[_0x400f('0xe')](_0x169fd1)[_0x400f('0x13')](_0x5eb657);};}function findById(_0x110964){return function(_0x1d2df5){if(!_[_0x400f('0x14')](_0x110964)&&!_[_0x400f('0x14')](_0x1d2df5)&&!_[_0x400f('0x14')](_0x1d2df5[_0x400f('0x15')])){return _[_0x400f('0x16')](_0x1d2df5['rows'],function(_0x5482a9){return _0x5482a9['id']==_0x110964;});}return null;};}exports['voiceChannels']=function(_0x4337d0,_0x1f9482){return respondWithRpcPromise(_0x400f('0x17'),_0x4337d0[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x1f9482,null))['catch'](handleError(_0x1f9482,null));};exports['voiceChannelMixMonitor']=function(_0x43d9eb,_0x4e0d46){return respondWithRpcPromise(_0x400f('0x1a'),_['merge'](_0x43d9eb['query'],_0x43d9eb[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x4e0d46,null))[_0x400f('0x1c')](handleError(_0x4e0d46,null));};exports[_0x400f('0x1d')]=function(_0x1251a2,_0x53a77f){return respondWithRpcPromise(_0x400f('0x1e'),_[_0x400f('0x1f')](_0x1251a2[_0x400f('0x18')],_0x1251a2[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x53a77f,null))[_0x400f('0x1c')](handleError(_0x53a77f,null));};exports['voiceQueues']=function(_0x21ab35,_0x2301e0){return respondWithRpcPromise(_0x400f('0x20'),_0x21ab35[_0x400f('0x18')])['then'](respondWithResult(_0x2301e0,null))['catch'](handleError(_0x2301e0,null));};exports['showVoiceQueues']=function(_0xf9b657,_0x4171cf){return respondWithRpcPromise(_0x400f('0x20'),_0xf9b657['query'])[_0x400f('0x19')](findById(_0xf9b657[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x4171cf,null))[_0x400f('0x1c')](handleError(_0x4171cf,null));};exports[_0x400f('0x21')]=function(_0x398d61,_0x1ed4e3){return respondWithRpcPromise(_0x400f('0x22'),_[_0x400f('0x1f')](_0x398d61[_0x400f('0x18')],_0x398d61[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x1ed4e3,null))['catch'](handleError(_0x1ed4e3,null));};exports[_0x400f('0x23')]=function(_0x355384,_0x34a3bc){return respondWithRpcPromise('VoiceQueuesChannels',_0x355384[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x34a3bc,null))[_0x400f('0x1c')](handleError(_0x34a3bc,null));};exports['voiceQueuesChannel']=function(_0x45efbe,_0x5cab90){return respondWithRpcPromise(_0x400f('0x24'),_[_0x400f('0x1f')](_0x45efbe['query'],_0x45efbe[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x5cab90,null))[_0x400f('0x1c')](handleError(_0x5cab90,null));};exports[_0x400f('0x25')]=function(_0x1174ca,_0xadfbe7){return respondWithRpcPromise(_0x400f('0x26'),_[_0x400f('0x1f')](_0x1174ca['query'],_0x1174ca[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0xadfbe7,null))[_0x400f('0x1c')](handleError(_0xadfbe7,null));};exports['voiceQueuesChannelRedirect']=function(_0xf05871,_0x5ea712){return respondWithRpcPromise(_0x400f('0x27'),_[_0x400f('0x1f')](_0xf05871[_0x400f('0x18')],_0xf05871['params']))[_0x400f('0x19')](respondWithResult(_0x5ea712,null))[_0x400f('0x1c')](handleError(_0x5ea712,null));};exports[_0x400f('0x28')]=function(_0x3e9e8b,_0x441c49){return respondWithRpcPromise(_0x400f('0x29'),_0x3e9e8b[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x441c49,null))[_0x400f('0x1c')](handleError(_0x441c49,null));};exports['outboundChannels']=function(_0xa5864f,_0x2da6f3){return respondWithRpcPromise('OutboundChannels',_0xa5864f[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x2da6f3,null))[_0x400f('0x1c')](handleError(_0x2da6f3,null));};exports[_0x400f('0x2a')]=function(_0x4a340a,_0x5fef50){var _0x4e353b;return respondWithRpcPromise('Agents',_0x4a340a[_0x400f('0x18')])[_0x400f('0x19')](function(_0x453d10){_0x4e353b=_0x453d10;return respondWithRpcPromise(_0x400f('0x2b'),_0x4a340a['query'],routingClient);})[_0x400f('0x19')](function(_0x2a470f){return _[_0x400f('0x1f')]({},_0x2a470f,_0x4e353b);})['then'](respondWithResult(_0x5fef50,null))[_0x400f('0x1c')](handleError(_0x5fef50,null));};exports[_0x400f('0x2c')]=function(_0x5a312e,_0x53afd6){if(_0x5a312e[_0x400f('0x2d')]&&_0x5a312e['body'][_0x400f('0x2e')]&&_0x5a312e[_0x400f('0x2f')]&&_0x5a312e[_0x400f('0x2f')]['name']){for(var _0x48cb76 in _0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')]){if(_0x5a312e['body'][_0x400f('0x2e')][_0x400f('0x30')](_0x48cb76)){db[_0x400f('0x31')][_0x400f('0x32')]({'where':{'channel':_0x48cb76,'membername':_0x5a312e[_0x400f('0x2f')]['name'],'type':_0x400f('0x33'),'exitAt':null,'uniqueid':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76]&&_0x5a312e[_0x400f('0x2d')]['interaction'][_0x48cb76][_0x400f('0x34')]?{'$notIn':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76]}:{'$ne':null}}})[_0x400f('0x19')](function(_0x25919b){var _0x54b255=moment()[_0x400f('0x35')](_0x400f('0x36'));for(var _0x3cea01=0x0,_0x419584=_0x25919b[_0x400f('0x34')];_0x3cea01<_0x419584;_0x3cea01+=0x1){_0x25919b[_0x3cea01][_0x400f('0x37')]({'exitAt':_0x54b255});}});for(var _0x1d8f8f=0x0;_0x1d8f8f<_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76][_0x400f('0x34')];_0x1d8f8f+=0x1){db[_0x400f('0x31')]['findOrCreate']({'where':{'channel':_0x48cb76,'membername':_0x5a312e['user']['name'],'type':_0x400f('0x33'),'uniqueid':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76][_0x1d8f8f],'exitAt':null},'defaults':{'channel':_0x48cb76,'membername':_0x5a312e[_0x400f('0x2f')][_0x400f('0x12')],'interface':_['isNil'](_0x5a312e['user'][_0x400f('0x38')])?util[_0x400f('0x35')]('SIP/%s',_0x5a312e['user'][_0x400f('0x12')]):_0x5a312e['user'][_0x400f('0x38')],'type':_0x400f('0x33'),'enterAt':moment()[_0x400f('0x35')](_0x400f('0x36')),'role':'agent','internal':_0x5a312e[_0x400f('0x2f')]['internal'],'uniqueid':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76][_0x1d8f8f]}});}}}}return respondWithRpcPromise(_0x400f('0x39'),{'id':_0x5a312e['params']['id'],'capacity':_0x5a312e['body'][_0x400f('0x3a')]},routingClient)[_0x400f('0x19')](respondWithResult(_0x53afd6,null))[_0x400f('0x1c')](handleError(_0x53afd6,null));};exports[_0x400f('0x3b')]=function(_0x3e7509,_0x283a51){return respondWithRpcPromise(_0x400f('0x3c'),_0x3e7509[_0x400f('0x18')])['then'](respondWithResult(_0x283a51,null))[_0x400f('0x1c')](handleError(_0x283a51,null));};exports[_0x400f('0x3d')]=function(_0x4622cb,_0x4b8606){return respondWithRpcPromise(_0x400f('0x3e'),_0x4622cb[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x4b8606,null))['catch'](handleError(_0x4b8606,null));};exports['campaigns']=function(_0x13a160,_0x4569df){return respondWithRpcPromise(_0x400f('0x3f'),_0x13a160['query'])[_0x400f('0x19')](respondWithResult(_0x4569df,null))[_0x400f('0x1c')](handleError(_0x4569df,null));};exports[_0x400f('0x40')]=function(_0x506790,_0x38c72e){return respondWithRpcPromise(_0x400f('0x41'),_0x506790[_0x400f('0x18')],routingClient)['then'](respondWithResult(_0x38c72e,null))[_0x400f('0x1c')](handleError(_0x38c72e,null));};exports[_0x400f('0x42')]=function(_0xb1b4fd,_0x296449){return respondWithRpcPromise(_0x400f('0x41'),_0xb1b4fd[_0x400f('0x18')],routingClient)['then'](findById(_0xb1b4fd[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x296449,null))['catch'](handleError(_0x296449,null));};exports[_0x400f('0x43')]=function(_0x2c41b8,_0x49e063){return respondWithRpcPromise('MailQueues',_0x2c41b8['query'],routingClient)[_0x400f('0x19')](respondWithResult(_0x49e063,null))[_0x400f('0x1c')](handleError(_0x49e063,null));};exports[_0x400f('0x44')]=function(_0x585e25,_0x674093){return respondWithRpcPromise(_0x400f('0x45'),_0x585e25[_0x400f('0x18')],routingClient)['then'](findById(_0x585e25[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x674093,null))['catch'](handleError(_0x674093,null));};exports[_0x400f('0x46')]=function(_0x5ec8a3,_0x1db35d){return respondWithRpcPromise(_0x400f('0x47'),_0x5ec8a3['query'],mailClient)[_0x400f('0x19')](respondWithResult(_0x1db35d,null))['catch'](handleError(_0x1db35d,null));};exports[_0x400f('0x48')]=function(_0x3f52e7,_0x7a8150){return respondWithRpcPromise(_0x400f('0x49'),_0x3f52e7['query'],routingClient)[_0x400f('0x19')](respondWithResult(_0x7a8150,null))['catch'](handleError(_0x7a8150,null));};exports[_0x400f('0x4a')]=function(_0x1edf74,_0x45f30f){return respondWithRpcPromise(_0x400f('0x49'),_0x1edf74[_0x400f('0x18')],routingClient)['then'](findById(_0x1edf74['params']['id']))[_0x400f('0x19')](respondWithResult(_0x45f30f,null))[_0x400f('0x1c')](handleError(_0x45f30f,null));};exports[_0x400f('0x4b')]=function(_0x5e53d3,_0x21ee1b){return respondWithRpcPromise(_0x400f('0x4c'),_0x5e53d3[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x21ee1b,null))[_0x400f('0x1c')](handleError(_0x21ee1b,null));};exports['showSmsQueues']=function(_0x4ca680,_0x395a52){return respondWithRpcPromise(_0x400f('0x4c'),_0x4ca680[_0x400f('0x18')],routingClient)[_0x400f('0x19')](findById(_0x4ca680[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x395a52,null))[_0x400f('0x1c')](handleError(_0x395a52,null));};exports[_0x400f('0x4d')]=function(_0x209599,_0x3ee565){return respondWithRpcPromise('WhatsappQueues',_0x209599[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x3ee565,null))[_0x400f('0x1c')](handleError(_0x3ee565,null));};exports[_0x400f('0x4e')]=function(_0x3133c5,_0x2ca507){return respondWithRpcPromise(_0x400f('0x4f'),_0x3133c5[_0x400f('0x18')],routingClient)[_0x400f('0x19')](findById(_0x3133c5[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x2ca507,null))[_0x400f('0x1c')](handleError(_0x2ca507,null));};exports[_0x400f('0x50')]=function(_0x52e74d,_0x17fe11){return respondWithRpcPromise(_0x400f('0x51'),_0x52e74d['query'],routingClient)[_0x400f('0x19')](respondWithResult(_0x17fe11,null))['catch'](handleError(_0x17fe11,null));};exports[_0x400f('0x52')]=function(_0x1642a8,_0x1a7a23){return respondWithRpcPromise('FaxQueues',_0x1642a8[_0x400f('0x18')],routingClient)[_0x400f('0x19')](findById(_0x1642a8[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x1a7a23,null))[_0x400f('0x1c')](handleError(_0x1a7a23,null));};exports[_0x400f('0x53')]=function(_0x11204c,_0x1c0233){return respondWithRpcPromise(_0x400f('0x54'),_0x11204c[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x1c0233,null))['catch'](handleError(_0x1c0233,null));};exports[_0x400f('0x55')]=function(_0x374cf9,_0x14f295){return respondWithRpcPromise(_0x400f('0x56'),_0x374cf9[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x14f295,null))[_0x400f('0x1c')](handleError(_0x14f295,null));};exports[_0x400f('0x57')]=function(_0x22493c,_0x356dea){return respondWithRpcPromise(_0x400f('0x58'),_0x22493c[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x356dea,null))['catch'](handleError(_0x356dea,null));};exports[_0x400f('0x59')]=function(_0x46eaed,_0x41fd06){return respondWithRpcPromise(_0x400f('0x5a'),_0x46eaed[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x41fd06,null))[_0x400f('0x1c')](handleError(_0x41fd06,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x56a10e,_0x3ce897){return respondWithRpcPromise(_0x400f('0x5a'),_0x56a10e[_0x400f('0x18')],routingClient)[_0x400f('0x19')](function(_0x577086){if(_0x56a10e['query'][_0x400f('0x5b')]!==undefined){var _0x114453=_(_0x577086[_0x400f('0x15')])[_0x400f('0x5c')]([_0x56a10e[_0x400f('0x18')][_0x400f('0x5b')],_0x56a10e[_0x400f('0x1b')]['id']])[_0x400f('0x5d')](_0x400f('0x5e'))[_0x400f('0x5f')]()['value']();return _0x577086[_0x400f('0x15')]['filter'](function(_0x3611f3){return _0x114453[_0x400f('0x60')](_0x3611f3[_0x400f('0x5e')])>-0x1;});}else{return _0x577086[_0x400f('0x15')][_0x400f('0x5c')](function(_0x296ddf){return _0x296ddf[_0x400f('0x5e')]===parseInt(_0x56a10e['params']['id']);});}})[_0x400f('0x19')](respondWithResult(_0x3ce897,null))[_0x400f('0x1c')](handleError(_0x3ce897,null));};exports[_0x400f('0x61')]=function(_0x45c28d,_0xe9b133){return respondWithRpcPromise(_0x400f('0x62'),_0x45c28d[_0x400f('0x18')],routingClient)['then'](respondWithResult(_0xe9b133,null))[_0x400f('0x1c')](handleError(_0xe9b133,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3fdac2,_0x3e7248){return respondWithRpcPromise(_0x400f('0x63'),_0x3fdac2[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x3e7248,null))[_0x400f('0x1c')](handleError(_0x3e7248,null));};exports['faxQueuesWaitingInteractions']=function(_0x3520c7,_0x503c3e){return respondWithRpcPromise(_0x400f('0x64'),_0x3520c7[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x503c3e,null))[_0x400f('0x1c')](handleError(_0x503c3e,null));};exports['queueNotify']=function(_0xfd4142){return function(_0x320074,_0xc0d618){var _0x57f965,_0x3ca622;var _0x2d08c8=_[_0x400f('0x65')](_0xfd4142);var _0x3b2d8d=_0xfd4142===_0x400f('0x66')?_0x400f('0x67'):'Account';return db[_0x2d08c8+_0x400f('0x68')][_0x400f('0x69')]({'raw':!![],'where':{'id':_0x320074[_0x400f('0x1b')]['id']}})['then'](function(_0x57c028){if(_[_0x400f('0x14')](_0x57c028)){throw new Error(_0x2d08c8+_0x400f('0x6a'));}_0x57f965=_0x57c028;return db[_0x2d08c8+_0x400f('0x6b')][_0x400f('0x69')]({'where':{'id':_0x320074[_0x400f('0x2d')][_0x400f('0x6c')]},'include':[{'model':db[_0x2d08c8+_0x400f('0x6d')],'as':_0x400f('0x6d')},{'model':db[_0x2d08c8+_0x3b2d8d],'as':_0x400f('0x6e')}]});})['then'](function(_0x56636a){if(_['isNil'](_0x56636a)){throw new Error(_0x2d08c8+_0x400f('0x6f'));}_0x3ca622=_0x56636a;return _0x56636a[_0x400f('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x533c6d={'uniqueid':_0xfd4142+'.'+_0x3ca622['id']+'.'+_0x3ca622[_0x400f('0x6d')]['id'],'FromUserId':_0x320074[_0x400f('0x2f')]['id'],'type':_0x400f('0x71')};_0x533c6d[_0x2d08c8+_0x400f('0x72')]=_0x3ca622['id'];_0x533c6d[_0x2d08c8+'InteractionId']=_0x3ca622[_0x400f('0x6d')]['id'];_0x533c6d[_0x400f('0x73')+_0x2d08c8+_0x3b2d8d+'Id']=_0x3ca622[_0x400f('0x6e')]['id'];_0x533c6d['To'+_0x2d08c8+_0x400f('0x74')]=_0x57f965['id'];return db[_0x2d08c8+'TransferReport']['create'](_0x533c6d);})['then'](function(){return respondWithRpcPromise(_0x400f('0x75'),{'channel':_0xfd4142,'interaction':_0x3ca622[_0x400f('0x6d')],'message':_0x3ca622,'account':_0x3ca622['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x400f('0x71'),'appdata':_0x57f965['name']+','+(_0x3ca622[_0x400f('0x6e')][_0x400f('0x76')]||0x12c),'interval':_0x400f('0x77')}]},routingClient);})[_0x400f('0x19')](respondWithResult(_0xc0d618,null))[_0x400f('0x1c')](handleError(_0xc0d618,null));};};exports['agentNotify']=function(_0x24ec51,_0x3e76b6){var _0x1a44e8,_0x30818b;if(_[_0x400f('0x14')](_0x24ec51[_0x400f('0x2d')][_0x400f('0x78')])){throw new Error(_0x400f('0x79'));}var _0x24a389=_0x24ec51['body'][_0x400f('0x78')];var _0x5db1f6=_['capitalize'](_0x24a389);var _0x288c2a=_0x24a389===_0x400f('0x66')?'Website':_0x400f('0x6e');return db[_0x400f('0x7a')][_0x400f('0x69')]({'raw':!![],'where':{'id':_0x24ec51[_0x400f('0x1b')]['id'],'role':'agent'}})[_0x400f('0x19')](function(_0x5cc2bf){if(_['isNil'](_0x5cc2bf)){throw new Error(_0x400f('0x7b'));}_0x1a44e8=_0x5cc2bf;return db[_0x5db1f6+_0x400f('0x6b')][_0x400f('0x69')]({'where':{'id':_0x24ec51[_0x400f('0x2d')][_0x400f('0x6c')]},'include':[{'model':db[_0x5db1f6+_0x400f('0x6d')],'as':_0x400f('0x6d')},{'model':db[_0x5db1f6+_0x288c2a],'as':_0x400f('0x6e')}]});})['then'](function(_0x23ab26){if(_[_0x400f('0x14')](_0x23ab26)){throw new Error(_0x5db1f6+_0x400f('0x6f'));}_0x30818b=_0x23ab26;return _0x23ab26[_0x400f('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x400f('0x19')](function(){var _0x4c2927={'uniqueid':_0x24a389+'.'+_0x30818b['id']+'.'+_0x30818b[_0x400f('0x6d')]['id'],'FromUserId':_0x24ec51[_0x400f('0x2f')]['id'],'type':_0x400f('0x71'),'ToUserId':_0x1a44e8['id']};_0x4c2927[_0x5db1f6+_0x400f('0x72')]=_0x30818b['id'];_0x4c2927[_0x5db1f6+_0x400f('0x7c')]=_0x30818b[_0x400f('0x6d')]['id'];_0x4c2927[_0x400f('0x73')+_0x5db1f6+_0x288c2a+'Id']=_0x30818b[_0x400f('0x6e')]['id'];return db[_0x5db1f6+_0x400f('0x7d')][_0x400f('0x7e')](_0x4c2927);})[_0x400f('0x19')](function(){return respondWithRpcPromise(_0x400f('0x75'),{'channel':_0x24a389,'interaction':_0x30818b[_0x400f('0x6d')],'message':_0x30818b,'account':_0x30818b[_0x400f('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x400f('0x7f'),'appdata':_0x1a44e8[_0x400f('0x12')]+','+(_0x30818b[_0x400f('0x6e')][_0x400f('0x80')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x3e76b6,null))[_0x400f('0x1c')](handleError(_0x3e76b6,null));}; \ No newline at end of file +var _0xfc84=['find','rows','voiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','voiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','merge','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','length','updateAttributes','findOrCreate','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','create','queueTransferTimeout','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','Message','TransferReport','Start','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','client','http','request','then','error','code','message','result','status','json','sendStatus','name','isNil'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xfc84,0x6f));var _0x4fc8=function(_0x4c47cb,_0x1281a0){_0x4c47cb=_0x4c47cb-0x0;var _0x4c59da=_0xfc84[_0x4c47cb];return _0x4c59da;};'use strict';var BPromise=require(_0x4fc8('0x0'));var moment=require('moment');var _=require(_0x4fc8('0x1'));var util=require(_0x4fc8('0x2'));var db=require(_0x4fc8('0x3'))['db'];var logger=require(_0x4fc8('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x4fc8('0x5')][_0x4fc8('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x4fc8('0x5')][_0x4fc8('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1f300a,_0x4c4887,_0x41701c){return new BPromise(function(_0x75e6f7,_0x452581){var _0x1f3c6f=_0x41701c?_0x41701c:amiClient;return _0x1f3c6f[_0x4fc8('0x7')](_0x1f300a,_0x4c4887)[_0x4fc8('0x8')](function(_0x6625dc){if(_0x6625dc[_0x4fc8('0x9')]){if(_0x6625dc[_0x4fc8('0x9')][_0x4fc8('0xa')]===0x1f4){return _0x452581(_0x6625dc[_0x4fc8('0x9')][_0x4fc8('0xb')]);}return _0x75e6f7(_0x6625dc['error'][_0x4fc8('0xb')]);}else{_0x75e6f7(_0x6625dc[_0x4fc8('0xc')]);}})['catch'](function(_0x2f8947){_0x452581(_0x2f8947);});});}function respondWithResult(_0x5d1ee6,_0x38816f){_0x38816f=_0x38816f||0xc8;return function(_0x59e521){if(_0x59e521){return _0x5d1ee6[_0x4fc8('0xd')](_0x38816f)[_0x4fc8('0xe')](_0x59e521);}return _0x5d1ee6[_0x4fc8('0xf')](0x194);};}function handleError(_0x35363f,_0x5c71ba){_0x5c71ba=_0x5c71ba||0x1f4;return function(_0x357c99){logger[_0x4fc8('0x9')](_0x357c99['stack']);if(_0x357c99[_0x4fc8('0x10')]){delete _0x357c99[_0x4fc8('0x10')];}_0x35363f[_0x4fc8('0xd')](_0x5c71ba)['send'](_0x357c99);};}function findById(_0xfbac16){return function(_0x21e87d){if(!_[_0x4fc8('0x11')](_0xfbac16)&&!_[_0x4fc8('0x11')](_0x21e87d)&&!_[_0x4fc8('0x11')](_0x21e87d['rows'])){return _[_0x4fc8('0x12')](_0x21e87d[_0x4fc8('0x13')],function(_0x52617a){return _0x52617a['id']==_0xfbac16;});}return null;};}exports[_0x4fc8('0x14')]=function(_0x2946fd,_0x3cb582){return respondWithRpcPromise('VoiceChannels',_0x2946fd['query'])[_0x4fc8('0x8')](respondWithResult(_0x3cb582,null))[_0x4fc8('0x15')](handleError(_0x3cb582,null));};exports[_0x4fc8('0x16')]=function(_0x5c5540,_0xe361e6){return respondWithRpcPromise(_0x4fc8('0x17'),_['merge'](_0x5c5540[_0x4fc8('0x18')],_0x5c5540['params']))[_0x4fc8('0x8')](respondWithResult(_0xe361e6,null))['catch'](handleError(_0xe361e6,null));};exports[_0x4fc8('0x19')]=function(_0x4856c4,_0x143b1a){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x4856c4[_0x4fc8('0x18')],_0x4856c4[_0x4fc8('0x1a')]))[_0x4fc8('0x8')](respondWithResult(_0x143b1a,null))[_0x4fc8('0x15')](handleError(_0x143b1a,null));};exports[_0x4fc8('0x1b')]=function(_0x23c40e,_0x368914){return respondWithRpcPromise('VoiceQueues',_0x23c40e[_0x4fc8('0x18')])['then'](respondWithResult(_0x368914,null))[_0x4fc8('0x15')](handleError(_0x368914,null));};exports[_0x4fc8('0x1c')]=function(_0x316868,_0x3f41ee){return respondWithRpcPromise('VoiceQueues',_0x316868['query'])['then'](findById(_0x316868[_0x4fc8('0x1a')]['id']))[_0x4fc8('0x8')](respondWithResult(_0x3f41ee,null))[_0x4fc8('0x15')](handleError(_0x3f41ee,null));};exports[_0x4fc8('0x1d')]=function(_0x4930c3,_0x3b1372){return respondWithRpcPromise(_0x4fc8('0x1e'),_[_0x4fc8('0x1f')](_0x4930c3[_0x4fc8('0x18')],_0x4930c3['params']))[_0x4fc8('0x8')](respondWithResult(_0x3b1372,null))[_0x4fc8('0x15')](handleError(_0x3b1372,null));};exports['voiceQueuesChannels']=function(_0x525212,_0x7cdd0e){return respondWithRpcPromise(_0x4fc8('0x20'),_0x525212[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x7cdd0e,null))[_0x4fc8('0x15')](handleError(_0x7cdd0e,null));};exports[_0x4fc8('0x21')]=function(_0x3dcf2e,_0x3de979){return respondWithRpcPromise(_0x4fc8('0x22'),_[_0x4fc8('0x1f')](_0x3dcf2e[_0x4fc8('0x18')],_0x3dcf2e[_0x4fc8('0x1a')]))[_0x4fc8('0x8')](respondWithResult(_0x3de979,null))[_0x4fc8('0x15')](handleError(_0x3de979,null));};exports[_0x4fc8('0x23')]=function(_0x4e3930,_0x55133f){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x4fc8('0x1f')](_0x4e3930[_0x4fc8('0x18')],_0x4e3930['params']))[_0x4fc8('0x8')](respondWithResult(_0x55133f,null))[_0x4fc8('0x15')](handleError(_0x55133f,null));};exports[_0x4fc8('0x24')]=function(_0x54909e,_0xe61a21){return respondWithRpcPromise(_0x4fc8('0x25'),_[_0x4fc8('0x1f')](_0x54909e[_0x4fc8('0x18')],_0x54909e['params']))[_0x4fc8('0x8')](respondWithResult(_0xe61a21,null))['catch'](handleError(_0xe61a21,null));};exports[_0x4fc8('0x26')]=function(_0x5cdc3b,_0x115165){return respondWithRpcPromise(_0x4fc8('0x27'),_0x5cdc3b[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x115165,null))[_0x4fc8('0x15')](handleError(_0x115165,null));};exports[_0x4fc8('0x28')]=function(_0x446ce2,_0x3cfa33){return respondWithRpcPromise(_0x4fc8('0x29'),_0x446ce2[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x3cfa33,null))[_0x4fc8('0x15')](handleError(_0x3cfa33,null));};exports[_0x4fc8('0x2a')]=function(_0x364609,_0x4fade7){var _0x24f700;return respondWithRpcPromise(_0x4fc8('0x2b'),_0x364609['query'])[_0x4fc8('0x8')](function(_0x50a13d){_0x24f700=_0x50a13d;return respondWithRpcPromise(_0x4fc8('0x2b'),_0x364609[_0x4fc8('0x18')],routingClient);})[_0x4fc8('0x8')](function(_0x55c439){return _[_0x4fc8('0x1f')]({},_0x55c439,_0x24f700);})['then'](respondWithResult(_0x4fade7,null))[_0x4fc8('0x15')](handleError(_0x4fade7,null));};exports['agentCapacity']=function(_0x2df914,_0x22c442){if(_0x2df914[_0x4fc8('0x2c')]&&_0x2df914['body']['interaction']&&_0x2df914[_0x4fc8('0x2d')]&&_0x2df914[_0x4fc8('0x2d')]['name']){for(var _0x36a11e in _0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')]){if(_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x4fc8('0x2f')](_0x36a11e)){db[_0x4fc8('0x30')][_0x4fc8('0x31')]({'where':{'channel':_0x36a11e,'membername':_0x2df914[_0x4fc8('0x2d')]['name'],'type':_0x4fc8('0x32'),'exitAt':null,'uniqueid':_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e]&&_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e]['length']?{'$notIn':_0x2df914['body'][_0x4fc8('0x2e')][_0x36a11e]}:{'$ne':null}}})[_0x4fc8('0x8')](function(_0x235feb){var _0xfc116f=moment()[_0x4fc8('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x568200=0x0,_0x583b9c=_0x235feb[_0x4fc8('0x34')];_0x568200<_0x583b9c;_0x568200+=0x1){_0x235feb[_0x568200][_0x4fc8('0x35')]({'exitAt':_0xfc116f});}});for(var _0x5cf952=0x0;_0x5cf952<_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e][_0x4fc8('0x34')];_0x5cf952+=0x1){db['MemberReport'][_0x4fc8('0x36')]({'where':{'channel':_0x36a11e,'membername':_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x10')],'type':_0x4fc8('0x32'),'uniqueid':_0x2df914['body'][_0x4fc8('0x2e')][_0x36a11e][_0x5cf952],'exitAt':null},'defaults':{'channel':_0x36a11e,'membername':_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x10')],'interface':_[_0x4fc8('0x11')](_0x2df914[_0x4fc8('0x2d')]['interface'])?util[_0x4fc8('0x33')](_0x4fc8('0x37'),_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x10')]):_0x2df914['user']['interface'],'type':'INTERACTION','enterAt':moment()[_0x4fc8('0x33')](_0x4fc8('0x38')),'role':_0x4fc8('0x39'),'internal':_0x2df914[_0x4fc8('0x2d')][_0x4fc8('0x3a')],'uniqueid':_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x2e')][_0x36a11e][_0x5cf952]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2df914['params']['id'],'capacity':_0x2df914[_0x4fc8('0x2c')][_0x4fc8('0x3b')]},routingClient)['then'](respondWithResult(_0x22c442,null))[_0x4fc8('0x15')](handleError(_0x22c442,null));};exports[_0x4fc8('0x3c')]=function(_0x2c4f98,_0x23631c){return respondWithRpcPromise(_0x4fc8('0x3d'),_0x2c4f98[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x23631c,null))[_0x4fc8('0x15')](handleError(_0x23631c,null));};exports[_0x4fc8('0x3e')]=function(_0x409bbf,_0x540a41){return respondWithRpcPromise(_0x4fc8('0x3f'),_0x409bbf['query'])[_0x4fc8('0x8')](respondWithResult(_0x540a41,null))[_0x4fc8('0x15')](handleError(_0x540a41,null));};exports[_0x4fc8('0x40')]=function(_0x98dbaa,_0x36fda8){return respondWithRpcPromise('Campaigns',_0x98dbaa[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x36fda8,null))[_0x4fc8('0x15')](handleError(_0x36fda8,null));};exports[_0x4fc8('0x41')]=function(_0x1d43d2,_0x16f57e){return respondWithRpcPromise(_0x4fc8('0x42'),_0x1d43d2['query'],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x16f57e,null))[_0x4fc8('0x15')](handleError(_0x16f57e,null));};exports[_0x4fc8('0x43')]=function(_0x26cd15,_0x5c1dd2){return respondWithRpcPromise(_0x4fc8('0x42'),_0x26cd15[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](findById(_0x26cd15['params']['id']))[_0x4fc8('0x8')](respondWithResult(_0x5c1dd2,null))[_0x4fc8('0x15')](handleError(_0x5c1dd2,null));};exports[_0x4fc8('0x44')]=function(_0x5c3d92,_0x1c387a){return respondWithRpcPromise('MailQueues',_0x5c3d92[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1c387a,null))['catch'](handleError(_0x1c387a,null));};exports[_0x4fc8('0x45')]=function(_0x50f68f,_0x38711b){return respondWithRpcPromise(_0x4fc8('0x46'),_0x50f68f[_0x4fc8('0x18')],routingClient)['then'](findById(_0x50f68f['params']['id']))[_0x4fc8('0x8')](respondWithResult(_0x38711b,null))[_0x4fc8('0x15')](handleError(_0x38711b,null));};exports['mailAccounts']=function(_0x56426f,_0x1d9b76){return respondWithRpcPromise(_0x4fc8('0x47'),_0x56426f['query'],mailClient)[_0x4fc8('0x8')](respondWithResult(_0x1d9b76,null))[_0x4fc8('0x15')](handleError(_0x1d9b76,null));};exports[_0x4fc8('0x48')]=function(_0x294b0c,_0x1835f7){return respondWithRpcPromise(_0x4fc8('0x49'),_0x294b0c[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1835f7,null))[_0x4fc8('0x15')](handleError(_0x1835f7,null));};exports['showOpenchannelQueues']=function(_0x53982f,_0x1d2c67){return respondWithRpcPromise(_0x4fc8('0x49'),_0x53982f[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](findById(_0x53982f[_0x4fc8('0x1a')]['id']))[_0x4fc8('0x8')](respondWithResult(_0x1d2c67,null))[_0x4fc8('0x15')](handleError(_0x1d2c67,null));};exports[_0x4fc8('0x4a')]=function(_0x18f7d1,_0x52ce92){return respondWithRpcPromise(_0x4fc8('0x4b'),_0x18f7d1[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x52ce92,null))['catch'](handleError(_0x52ce92,null));};exports[_0x4fc8('0x4c')]=function(_0x2342f6,_0x1bf850){return respondWithRpcPromise(_0x4fc8('0x4b'),_0x2342f6[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](findById(_0x2342f6[_0x4fc8('0x1a')]['id']))['then'](respondWithResult(_0x1bf850,null))[_0x4fc8('0x15')](handleError(_0x1bf850,null));};exports[_0x4fc8('0x4d')]=function(_0x1a7d19,_0x44387a){return respondWithRpcPromise('WhatsappQueues',_0x1a7d19['query'],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x44387a,null))['catch'](handleError(_0x44387a,null));};exports[_0x4fc8('0x4e')]=function(_0x36e456,_0x5cee6b){return respondWithRpcPromise(_0x4fc8('0x4f'),_0x36e456['query'],routingClient)[_0x4fc8('0x8')](findById(_0x36e456[_0x4fc8('0x1a')]['id']))['then'](respondWithResult(_0x5cee6b,null))[_0x4fc8('0x15')](handleError(_0x5cee6b,null));};exports[_0x4fc8('0x50')]=function(_0x8303f0,_0x3d6482){return respondWithRpcPromise(_0x4fc8('0x51'),_0x8303f0[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x3d6482,null))[_0x4fc8('0x15')](handleError(_0x3d6482,null));};exports[_0x4fc8('0x52')]=function(_0x7c670f,_0xe1b482){return respondWithRpcPromise(_0x4fc8('0x51'),_0x7c670f['query'],routingClient)['then'](findById(_0x7c670f[_0x4fc8('0x1a')]['id']))[_0x4fc8('0x8')](respondWithResult(_0xe1b482,null))[_0x4fc8('0x15')](handleError(_0xe1b482,null));};exports[_0x4fc8('0x53')]=function(_0x26031a,_0x5948e2){return respondWithRpcPromise(_0x4fc8('0x54'),_0x26031a[_0x4fc8('0x18')])[_0x4fc8('0x8')](respondWithResult(_0x5948e2,null))[_0x4fc8('0x15')](handleError(_0x5948e2,null));};exports[_0x4fc8('0x55')]=function(_0x1747b0,_0x1654a7){return respondWithRpcPromise(_0x4fc8('0x56'),_0x1747b0[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1654a7,null))[_0x4fc8('0x15')](handleError(_0x1654a7,null));};exports[_0x4fc8('0x57')]=function(_0x5eaad3,_0x2721ba){return respondWithRpcPromise(_0x4fc8('0x58'),_0x5eaad3[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x2721ba,null))[_0x4fc8('0x15')](handleError(_0x2721ba,null));};exports[_0x4fc8('0x59')]=function(_0x3edc58,_0x1c55b3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3edc58[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x1c55b3,null))[_0x4fc8('0x15')](handleError(_0x1c55b3,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x102d6f,_0x5617d8){return respondWithRpcPromise(_0x4fc8('0x5a'),_0x102d6f['query'],routingClient)[_0x4fc8('0x8')](function(_0x588d98){if(_0x102d6f[_0x4fc8('0x18')][_0x4fc8('0x5b')]!==undefined){var _0x2b79f1=_(_0x588d98[_0x4fc8('0x13')])[_0x4fc8('0x5c')]([_0x102d6f[_0x4fc8('0x18')]['type'],_0x102d6f[_0x4fc8('0x1a')]['id']])[_0x4fc8('0x5d')](_0x4fc8('0x5e'))[_0x4fc8('0x5f')]()['value']();return _0x588d98[_0x4fc8('0x13')][_0x4fc8('0x5c')](function(_0x13e6d7){return _0x2b79f1[_0x4fc8('0x60')](_0x13e6d7['queue_id'])>-0x1;});}else{return _0x588d98[_0x4fc8('0x13')][_0x4fc8('0x5c')](function(_0x406c71){return _0x406c71[_0x4fc8('0x5e')]===parseInt(_0x102d6f[_0x4fc8('0x1a')]['id']);});}})[_0x4fc8('0x8')](respondWithResult(_0x5617d8,null))[_0x4fc8('0x15')](handleError(_0x5617d8,null));};exports[_0x4fc8('0x61')]=function(_0xa491a1,_0x27c1e8){return respondWithRpcPromise(_0x4fc8('0x62'),_0xa491a1[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x27c1e8,null))[_0x4fc8('0x15')](handleError(_0x27c1e8,null));};exports[_0x4fc8('0x63')]=function(_0x126e75,_0x424229){return respondWithRpcPromise(_0x4fc8('0x64'),_0x126e75[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0x424229,null))[_0x4fc8('0x15')](handleError(_0x424229,null));};exports[_0x4fc8('0x65')]=function(_0x54511f,_0xb5c65f){return respondWithRpcPromise(_0x4fc8('0x66'),_0x54511f[_0x4fc8('0x18')],routingClient)[_0x4fc8('0x8')](respondWithResult(_0xb5c65f,null))[_0x4fc8('0x15')](handleError(_0xb5c65f,null));};exports[_0x4fc8('0x67')]=function(_0x4094c5){return function(_0x6ce411,_0x5037a6){var _0x30c753,_0x2e4e00;var _0x163840=_['capitalize'](_0x4094c5);var _0x2681e9=_0x4094c5===_0x4fc8('0x68')?_0x4fc8('0x69'):_0x4fc8('0x6a');return db[_0x163840+_0x4fc8('0x6b')]['findOne']({'raw':!![],'where':{'id':_0x6ce411[_0x4fc8('0x1a')]['id']}})['then'](function(_0x2391f6){if(_[_0x4fc8('0x11')](_0x2391f6)){throw new Error(_0x163840+_0x4fc8('0x6c'));}_0x30c753=_0x2391f6;return db[_0x163840+'Message'][_0x4fc8('0x6d')]({'where':{'id':_0x6ce411[_0x4fc8('0x2c')][_0x4fc8('0x6e')]},'include':[{'model':db[_0x163840+_0x4fc8('0x6f')],'as':_0x4fc8('0x6f')},{'model':db[_0x163840+_0x2681e9],'as':_0x4fc8('0x6a')}]});})[_0x4fc8('0x8')](function(_0x5329c7){if(_['isNil'](_0x5329c7)){throw new Error(_0x163840+_0x4fc8('0x70'));}_0x2e4e00=_0x5329c7;return _0x5329c7[_0x4fc8('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4fc8('0x8')](function(){var _0x5cda67={'uniqueid':_0x4094c5+'.'+_0x2e4e00['id']+'.'+_0x2e4e00[_0x4fc8('0x6f')]['id'],'FromUserId':_0x6ce411[_0x4fc8('0x2d')]['id'],'type':_0x4fc8('0x72')};_0x5cda67[_0x163840+'MessageId']=_0x2e4e00['id'];_0x5cda67[_0x163840+_0x4fc8('0x73')]=_0x2e4e00[_0x4fc8('0x6f')]['id'];_0x5cda67[_0x4fc8('0x74')+_0x163840+_0x2681e9+'Id']=_0x2e4e00[_0x4fc8('0x6a')]['id'];_0x5cda67['To'+_0x163840+_0x4fc8('0x75')]=_0x30c753['id'];return db[_0x163840+'TransferReport'][_0x4fc8('0x76')](_0x5cda67);})[_0x4fc8('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x4094c5,'interaction':_0x2e4e00[_0x4fc8('0x6f')],'message':_0x2e4e00,'account':_0x2e4e00[_0x4fc8('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4fc8('0x72'),'appdata':_0x30c753[_0x4fc8('0x10')]+','+(_0x2e4e00[_0x4fc8('0x6a')][_0x4fc8('0x77')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x4fc8('0x8')](respondWithResult(_0x5037a6,null))['catch'](handleError(_0x5037a6,null));};};exports['agentNotify']=function(_0x3f35cb,_0x20db7f){var _0x238c57,_0x59ad7d;if(_[_0x4fc8('0x11')](_0x3f35cb[_0x4fc8('0x2c')][_0x4fc8('0x78')])){throw new Error(_0x4fc8('0x79'));}var _0x2fd041=_0x3f35cb[_0x4fc8('0x2c')][_0x4fc8('0x78')];var _0x548ee5=_['capitalize'](_0x2fd041);var _0x2e1023=_0x2fd041===_0x4fc8('0x68')?_0x4fc8('0x69'):_0x4fc8('0x6a');return db[_0x4fc8('0x7a')][_0x4fc8('0x6d')]({'raw':!![],'where':{'id':_0x3f35cb['params']['id'],'role':_0x4fc8('0x39')}})['then'](function(_0x24a33a){if(_[_0x4fc8('0x11')](_0x24a33a)){throw new Error(_0x4fc8('0x7b'));}_0x238c57=_0x24a33a;return db[_0x548ee5+_0x4fc8('0x7c')][_0x4fc8('0x6d')]({'where':{'id':_0x3f35cb[_0x4fc8('0x2c')][_0x4fc8('0x6e')]},'include':[{'model':db[_0x548ee5+_0x4fc8('0x6f')],'as':'Interaction'},{'model':db[_0x548ee5+_0x2e1023],'as':_0x4fc8('0x6a')}]});})[_0x4fc8('0x8')](function(_0x480648){if(_[_0x4fc8('0x11')](_0x480648)){throw new Error(_0x548ee5+'\x20Message\x20not\x20found');}_0x59ad7d=_0x480648;return _0x480648[_0x4fc8('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4fc8('0x8')](function(){var _0xdb131f={'uniqueid':_0x2fd041+'.'+_0x59ad7d['id']+'.'+_0x59ad7d['Interaction']['id'],'FromUserId':_0x3f35cb['user']['id'],'type':_0x4fc8('0x72'),'ToUserId':_0x238c57['id']};_0xdb131f[_0x548ee5+'MessageId']=_0x59ad7d['id'];_0xdb131f[_0x548ee5+_0x4fc8('0x73')]=_0x59ad7d[_0x4fc8('0x6f')]['id'];_0xdb131f[_0x4fc8('0x74')+_0x548ee5+_0x2e1023+'Id']=_0x59ad7d[_0x4fc8('0x6a')]['id'];return db[_0x548ee5+_0x4fc8('0x7d')][_0x4fc8('0x76')](_0xdb131f);})[_0x4fc8('0x8')](function(){return respondWithRpcPromise(_0x4fc8('0x7e'),{'channel':_0x2fd041,'interaction':_0x59ad7d[_0x4fc8('0x6f')],'message':_0x59ad7d,'account':_0x59ad7d[_0x4fc8('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4fc8('0x39'),'appdata':_0x238c57[_0x4fc8('0x10')]+','+(_0x59ad7d[_0x4fc8('0x6a')][_0x4fc8('0x7f')]||0x12c),'interval':_0x4fc8('0x80')}]},routingClient);})[_0x4fc8('0x8')](respondWithResult(_0x20db7f,null))['catch'](handleError(_0x20db7f,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index bb25c44..fd3d9e8 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 _0x3f1d=['Router','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','post','create','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x3e1563,_0x2f2947){var _0x510d1d=function(_0x3e1742){while(--_0x3e1742){_0x3e1563['push'](_0x3e1563['shift']());}};_0x510d1d(++_0x2f2947);}(_0x3f1d,0x140));var _0xd3f1=function(_0x245cca,_0xcfccbc){_0x245cca=_0x245cca-0x0;var _0xdb0de4=_0x3f1d[_0x245cca];return _0xdb0de4;};'use strict';var multer=require(_0xd3f1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd3f1('0x1'));var express=require(_0xd3f1('0x2'));var router=express[_0xd3f1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd3f1('0x4'));var controller=require(_0xd3f1('0x5'));router['get']('/',auth[_0xd3f1('0x6')](),controller[_0xd3f1('0x7')]);router[_0xd3f1('0x8')](_0xd3f1('0x9'),auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xa')]);router[_0xd3f1('0x8')](_0xd3f1('0xb'),auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xc')]);router[_0xd3f1('0xd')]('/',auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xe')]);router['put'](_0xd3f1('0x9'),auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xf')]);router[_0xd3f1('0x10')]('/:id',auth[_0xd3f1('0x6')](),controller[_0xd3f1('0x11')]);module[_0xd3f1('0x12')]=router; \ No newline at end of file +var _0xc024=['isAuthenticated','/:id','/:id/run','create','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x5f1fd3,_0x2592ea){var _0x5ecb14=function(_0x3c3972){while(--_0x3c3972){_0x5f1fd3['push'](_0x5f1fd3['shift']());}};_0x5ecb14(++_0x2592ea);}(_0xc024,0x19f));var _0x4c02=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xc024[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require(_0x4c02('0x0'));var path=require(_0x4c02('0x1'));var timeout=require(_0x4c02('0x2'));var express=require(_0x4c02('0x3'));var router=express[_0x4c02('0x4')]();var auth=require(_0x4c02('0x5'));var interaction=require(_0x4c02('0x6'));var config=require(_0x4c02('0x7'));var controller=require(_0x4c02('0x8'));router[_0x4c02('0x9')]('/',auth[_0x4c02('0xa')](),controller['index']);router[_0x4c02('0x9')](_0x4c02('0xb'),auth[_0x4c02('0xa')](),controller['show']);router[_0x4c02('0x9')](_0x4c02('0xc'),auth[_0x4c02('0xa')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0x4c02('0xd')]);router['put'](_0x4c02('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4c02('0xe')](_0x4c02('0xb'),auth[_0x4c02('0xa')](),controller[_0x4c02('0xf')]);module[_0x4c02('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 7de4d88..9bda4b6 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 _0xea1c=['hours','minutes','csv','pdf','custom','default','TEXT','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcea1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xcea1('0x0')]},'active':{'type':Sequelize[_0xcea1('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcea1('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xcea1('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcea1('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcea1('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcea1('0x4')](_0xcea1('0x5'),_0xcea1('0x6'),_0xcea1('0x7'),_0xcea1('0x8'),_0xcea1('0x9'),_0xcea1('0xa'),_0xcea1('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xcea1('0x4')](_0xcea1('0xc'),_0xcea1('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xcea1('0xc')},'type':{'type':Sequelize[_0xcea1('0x4')](_0xcea1('0xe'),_0xcea1('0xf')),'allowNull':![],'defaultValue':_0xcea1('0xe')},'sendMail':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xcea1('0x0')]},'cc':{'type':Sequelize[_0xcea1('0x10')]},'bcc':{'type':Sequelize[_0xcea1('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0ef4=['minutes','csv','pdf','custom','default','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','months','weeks','days','hours'];(function(_0x336b4b,_0x3da0a0){var _0x41a72e=function(_0x836635){while(--_0x836635){_0x336b4b['push'](_0x336b4b['shift']());}};_0x41a72e(++_0x3da0a0);}(_0x0ef4,0xc7));var _0x40ef=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x0ef4[_0x1ca890];return _0x3f8e01;};'use strict';var Sequelize=require('sequelize');module[_0x40ef('0x0')]={'name':{'type':Sequelize[_0x40ef('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x40ef('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x40ef('0x2')},'startAt':{'type':Sequelize[_0x40ef('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x40ef('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x40ef('0x4')]('years','quarters',_0x40ef('0x5'),_0x40ef('0x6'),_0x40ef('0x7'),_0x40ef('0x8'),_0x40ef('0x9')),'allowNull':![],'defaultValue':_0x40ef('0x7')},'output':{'type':Sequelize[_0x40ef('0x4')](_0x40ef('0xa'),_0x40ef('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0x40ef('0xa')},'type':{'type':Sequelize['ENUM'](_0x40ef('0xc'),_0x40ef('0xd')),'allowNull':![],'defaultValue':_0x40ef('0xc')},'sendMail':{'type':Sequelize[_0x40ef('0xe')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x40ef('0xf')]},'bcc':{'type':Sequelize[_0x40ef('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x40ef('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 00916c7..c4b3998 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 _0xd571=['findAll','rows','catch','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','body','params','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','include'];(function(_0x32bff9,_0x3f27d5){var _0xbab93=function(_0x3027b5){while(--_0x3027b5){_0x32bff9['push'](_0x32bff9['shift']());}};_0xbab93(++_0x3f27d5);}(_0xd571,0x112));var _0x1d57=function(_0x580c9c,_0x19569f){_0x580c9c=_0x580c9c-0x0;var _0x311594=_0xd571[_0x580c9c];return _0x311594;};'use strict';var pdf=require(_0x1d57('0x0'));var emlformat=require(_0x1d57('0x1'));var rimraf=require(_0x1d57('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d57('0x3'));var rp=require(_0x1d57('0x4'));var moment=require(_0x1d57('0x5'));var BPromise=require(_0x1d57('0x6'));var Mustache=require(_0x1d57('0x7'));var util=require(_0x1d57('0x8'));var path=require('path');var sox=require(_0x1d57('0x9'));var csv=require(_0x1d57('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d57('0xb'));var squel=require(_0x1d57('0xc'));var crypto=require(_0x1d57('0xd'));var jsforce=require(_0x1d57('0xe'));var deskjs=require(_0x1d57('0xf'));var toCsv=require(_0x1d57('0xa'));var querystring=require(_0x1d57('0x10'));var Papa=require(_0x1d57('0x11'));var Redis=require('ioredis');var authService=require(_0x1d57('0x12'));var qs=require(_0x1d57('0x13'));var as=require(_0x1d57('0x14'));var hardwareService=require(_0x1d57('0x15'));var logger=require(_0x1d57('0x16'))(_0x1d57('0x17'));var utils=require(_0x1d57('0x18'));var config=require(_0x1d57('0x19'));var licenseUtil=require(_0x1d57('0x1a'));var db=require(_0x1d57('0x1b'))['db'];function respondWithStatusCode(_0xe38d0,_0x438415){_0x438415=_0x438415||0xcc;return function(_0x419315){if(_0x419315){return _0xe38d0['sendStatus'](_0x438415);}return _0xe38d0[_0x1d57('0x1c')](_0x438415)[_0x1d57('0x1d')]();};}function respondWithResult(_0x3001ab,_0x5dc7ad){_0x5dc7ad=_0x5dc7ad||0xc8;return function(_0x10d9a7){if(_0x10d9a7){return _0x3001ab[_0x1d57('0x1c')](_0x5dc7ad)['json'](_0x10d9a7);}};}function respondWithFilteredResult(_0x11b955,_0x364ac7){return function(_0x289d5b){if(_0x289d5b){var _0x1ce153=_0x289d5b[_0x1d57('0x1e')],_0xed0a15=_0x364ac7[_0x1d57('0x1f')],_0x2058de=_0x364ac7[_0x1d57('0x1f')]+_0x364ac7[_0x1d57('0x20')],_0x344073;if(_0x2058de>=_0x1ce153){_0x2058de=_0x1ce153;_0x344073=0xc8;}else{_0x344073=0xce;}_0x11b955[_0x1d57('0x1c')](_0x344073);return _0x11b955[_0x1d57('0x21')](_0x1d57('0x22'),_0xed0a15+'-'+_0x2058de+'/'+_0x1ce153)[_0x1d57('0x23')](_0x289d5b);}return null;};}function patchUpdates(_0x486951){return function(_0x2f8680){try{jsonpatch['apply'](_0x2f8680,_0x486951,!![]);}catch(_0x45b265){return BPromise[_0x1d57('0x24')](_0x45b265);}return _0x2f8680[_0x1d57('0x25')]();};}function saveUpdates(_0x1b3b7a,_0x57df25){return function(_0x3cb0a6){if(_0x3cb0a6){return _0x3cb0a6['update'](_0x1b3b7a)[_0x1d57('0x26')](function(_0x18eff4){return _0x18eff4;});}return null;};}function removeEntity(_0x334d31,_0x2d8c6f){return function(_0x1cff8e){if(_0x1cff8e){return _0x1cff8e[_0x1d57('0x27')]()[_0x1d57('0x26')](function(){var _0x5f0579=_0x1cff8e[_0x1d57('0x28')]({'plain':!![]});var _0xd4882a=_0x1d57('0x29');return db[_0x1d57('0x2a')][_0x1d57('0x27')]({'where':{'type':_0xd4882a,'resourceId':_0x5f0579['id']}})['then'](function(){return _0x1cff8e;});})[_0x1d57('0x26')](function(){_0x334d31['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe533b2,_0x85ce7e){return function(_0x4db711){if(!_0x4db711){_0xe533b2[_0x1d57('0x2b')](0x194);}return _0x4db711;};}function handleError(_0xfd6cac,_0x4b35ba){_0x4b35ba=_0x4b35ba||0x1f4;return function(_0x196484){logger[_0x1d57('0x2c')](_0x196484['stack']);if(_0x196484['name']){delete _0x196484[_0x1d57('0x2d')];}_0xfd6cac[_0x1d57('0x1c')](_0x4b35ba)[_0x1d57('0x2e')](_0x196484);};}exports[_0x1d57('0x2f')]=function(_0x3dd5c2,_0x1b2d3d){var _0x11c82d={},_0x1f4a0b={},_0x361211={'count':0x0,'rows':[]};var _0x31c64e=_[_0x1d57('0x30')](db[_0x1d57('0x31')][_0x1d57('0x32')],function(_0x592792){return{'name':_0x592792[_0x1d57('0x33')],'type':_0x592792[_0x1d57('0x34')]['key']};});_0x1f4a0b[_0x1d57('0x35')]=_['map'](_0x31c64e,_0x1d57('0x2d'));_0x1f4a0b[_0x1d57('0x36')]=_[_0x1d57('0x37')](_0x3dd5c2[_0x1d57('0x36')]);_0x1f4a0b['filters']=_['intersection'](_0x1f4a0b[_0x1d57('0x35')],_0x1f4a0b['query']);_0x11c82d[_0x1d57('0x38')]=_[_0x1d57('0x39')](_0x1f4a0b[_0x1d57('0x35')],qs['fields'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x3a')]));_0x11c82d[_0x1d57('0x38')]=_0x11c82d[_0x1d57('0x38')][_0x1d57('0x3b')]?_0x11c82d[_0x1d57('0x38')]:_0x1f4a0b[_0x1d57('0x35')];if(!_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x3c')]('nolimit')){_0x11c82d['limit']=qs['limit'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x20')]);_0x11c82d[_0x1d57('0x1f')]=qs['offset'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x1f')]);}_0x11c82d[_0x1d57('0x3d')]=qs['sort'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x3e')]);_0x11c82d[_0x1d57('0x3f')]=qs[_0x1d57('0x40')](_[_0x1d57('0x41')](_0x3dd5c2[_0x1d57('0x36')],_0x1f4a0b[_0x1d57('0x40')]),_0x31c64e);if(_0x3dd5c2['query'][_0x1d57('0x42')]){_0x11c82d[_0x1d57('0x3f')]=_['merge'](_0x11c82d[_0x1d57('0x3f')],{'$or':_[_0x1d57('0x30')](_0x31c64e,function(_0x45f469){if(_0x45f469[_0x1d57('0x34')]!==_0x1d57('0x43')){var _0x51f5b5={};_0x51f5b5[_0x45f469[_0x1d57('0x2d')]]={'$like':'%'+_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x42')]+'%'};return _0x51f5b5;}})});}_0x11c82d=_[_0x1d57('0x44')]({},_0x11c82d,_0x3dd5c2['options']);var _0x5abb66={'where':_0x11c82d[_0x1d57('0x3f')]};return db[_0x1d57('0x31')][_0x1d57('0x1e')](_0x5abb66)[_0x1d57('0x26')](function(_0x1ed499){_0x361211['count']=_0x1ed499;if(_0x3dd5c2[_0x1d57('0x36')]['includeAll']){_0x11c82d[_0x1d57('0x45')]=[{'all':!![]}];}return db[_0x1d57('0x31')][_0x1d57('0x46')](_0x11c82d);})[_0x1d57('0x26')](function(_0x235f10){_0x361211[_0x1d57('0x47')]=_0x235f10;return _0x361211;})[_0x1d57('0x26')](respondWithFilteredResult(_0x1b2d3d,_0x11c82d))[_0x1d57('0x48')](handleError(_0x1b2d3d,null));};exports['show']=function(_0x57e319,_0x21b899){var _0x4659fb={'raw':![],'where':{'id':_0x57e319['params']['id']}},_0xca6fca={};_0xca6fca['model']=_[_0x1d57('0x37')](db[_0x1d57('0x31')][_0x1d57('0x32')]);_0xca6fca[_0x1d57('0x36')]=_[_0x1d57('0x37')](_0x57e319[_0x1d57('0x36')]);_0xca6fca[_0x1d57('0x40')]=_[_0x1d57('0x39')](_0xca6fca[_0x1d57('0x35')],_0xca6fca[_0x1d57('0x36')]);_0x4659fb[_0x1d57('0x38')]=_['intersection'](_0xca6fca[_0x1d57('0x35')],qs[_0x1d57('0x3a')](_0x57e319[_0x1d57('0x36')][_0x1d57('0x3a')]));_0x4659fb[_0x1d57('0x38')]=_0x4659fb[_0x1d57('0x38')][_0x1d57('0x3b')]?_0x4659fb[_0x1d57('0x38')]:_0xca6fca[_0x1d57('0x35')];if(_0x57e319['query'][_0x1d57('0x49')]){_0x4659fb[_0x1d57('0x45')]=[{'all':!![]}];}_0x4659fb=_[_0x1d57('0x44')]({},_0x4659fb,_0x57e319[_0x1d57('0x4a')]);return db[_0x1d57('0x31')]['find'](_0x4659fb)['then'](handleEntityNotFound(_0x21b899,null))[_0x1d57('0x26')](respondWithResult(_0x21b899,null))[_0x1d57('0x48')](handleError(_0x21b899,null));};exports[_0x1d57('0x4b')]=function(_0x3250e6,_0x4d0cf5){return db[_0x1d57('0x31')][_0x1d57('0x4b')](_0x3250e6['body'],{})[_0x1d57('0x26')](function(_0xc89f27){var _0x4b4b67=_0x3250e6[_0x1d57('0x4c')]['get']({'plain':!![]});if(!_0x4b4b67)throw new Error(_0x1d57('0x4d'));if(_0x4b4b67[_0x1d57('0x4e')]===_0x1d57('0x4c')){var _0x40010c=_0xc89f27[_0x1d57('0x28')]({'plain':!![]});var _0x43070d=_0x1d57('0x29');return db['UserProfileSection'][_0x1d57('0x4f')]({'where':{'name':_0x43070d,'userProfileId':_0x4b4b67[_0x1d57('0x50')]},'raw':!![]})[_0x1d57('0x26')](function(_0x1efb77){if(_0x1efb77&&_0x1efb77[_0x1d57('0x51')]===0x0){return db[_0x1d57('0x2a')][_0x1d57('0x4b')]({'name':_0x40010c[_0x1d57('0x2d')],'resourceId':_0x40010c['id'],'type':_0x1efb77[_0x1d57('0x2d')],'sectionId':_0x1efb77['id']},{})['then'](function(){return _0xc89f27;});}else{return _0xc89f27;}})['catch'](function(_0x5cf7d5){logger[_0x1d57('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cf7d5);throw _0x5cf7d5;});}return _0xc89f27;})['then'](respondWithResult(_0x4d0cf5,0xc9))[_0x1d57('0x48')](handleError(_0x4d0cf5,null));};exports[_0x1d57('0x52')]=function(_0x42439a,_0x282236){if(_0x42439a['body']['id']){delete _0x42439a[_0x1d57('0x53')]['id'];}return db[_0x1d57('0x31')][_0x1d57('0x4f')]({'where':{'id':_0x42439a[_0x1d57('0x54')]['id']}})[_0x1d57('0x26')](handleEntityNotFound(_0x282236,null))[_0x1d57('0x26')](saveUpdates(_0x42439a[_0x1d57('0x53')],null))['then'](respondWithResult(_0x282236,null))[_0x1d57('0x48')](handleError(_0x282236,null));};exports[_0x1d57('0x27')]=function(_0x1a1d3e,_0x425246){return db[_0x1d57('0x31')][_0x1d57('0x4f')]({'where':{'id':_0x1a1d3e[_0x1d57('0x54')]['id']}})['then'](handleEntityNotFound(_0x425246,null))[_0x1d57('0x26')](removeEntity(_0x425246,null))[_0x1d57('0x48')](handleError(_0x425246,null));};exports[_0x1d57('0x55')]=function(_0x111414,_0x5f3bce,_0x100905){var _0x2df189=require('../../config/schedule');return db['Schedule'][_0x1d57('0x4f')]({'where':{'id':_0x111414[_0x1d57('0x54')]['id']},'raw':!![]})[_0x1d57('0x26')](handleEntityNotFound(_0x5f3bce,null))[_0x1d57('0x26')](function(){_0x2df189[_0x1d57('0x55')](_0x111414[_0x1d57('0x54')]['id']);})[_0x1d57('0x26')](respondWithStatusCode(_0x5f3bce,null))['catch'](handleError(_0x5f3bce,null));}; \ No newline at end of file +var _0x7785=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','reject','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','to-csv','ejs'];(function(_0xf804d4,_0x46b271){var _0x24afaa=function(_0x16faa4){while(--_0x16faa4){_0xf804d4['push'](_0xf804d4['shift']());}};_0x24afaa(++_0x46b271);}(_0x7785,0x1cb));var _0x5778=function(_0xd365dc,_0x573a11){_0xd365dc=_0xd365dc-0x0;var _0x198418=_0x7785[_0xd365dc];return _0x198418;};'use strict';var pdf=require(_0x5778('0x0'));var emlformat=require(_0x5778('0x1'));var rimraf=require(_0x5778('0x2'));var zipdir=require(_0x5778('0x3'));var jsonpatch=require(_0x5778('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5778('0x5'));var path=require(_0x5778('0x6'));var sox=require('sox');var csv=require(_0x5778('0x7'));var ejs=require(_0x5778('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5778('0x9'));var crypto=require(_0x5778('0xa'));var jsforce=require(_0x5778('0xb'));var deskjs=require(_0x5778('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5778('0xd'));var authService=require(_0x5778('0xe'));var qs=require(_0x5778('0xf'));var as=require(_0x5778('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5778('0x11'));var utils=require(_0x5778('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5778('0x13'))['db'];function respondWithStatusCode(_0x16b121,_0x4a7de4){_0x4a7de4=_0x4a7de4||0xcc;return function(_0x524c91){if(_0x524c91){return _0x16b121['sendStatus'](_0x4a7de4);}return _0x16b121[_0x5778('0x14')](_0x4a7de4)[_0x5778('0x15')]();};}function respondWithResult(_0x46d6af,_0x54f444){_0x54f444=_0x54f444||0xc8;return function(_0x3772db){if(_0x3772db){return _0x46d6af['status'](_0x54f444)[_0x5778('0x16')](_0x3772db);}};}function respondWithFilteredResult(_0xaf6af5,_0x2cd2d1){return function(_0x467f89){if(_0x467f89){var _0x5df5e3=_0x467f89[_0x5778('0x17')],_0x1adaec=_0x2cd2d1[_0x5778('0x18')],_0x279484=_0x2cd2d1[_0x5778('0x18')]+_0x2cd2d1[_0x5778('0x19')],_0x186987;if(_0x279484>=_0x5df5e3){_0x279484=_0x5df5e3;_0x186987=0xc8;}else{_0x186987=0xce;}_0xaf6af5[_0x5778('0x14')](_0x186987);return _0xaf6af5[_0x5778('0x1a')]('Content-Range',_0x1adaec+'-'+_0x279484+'/'+_0x5df5e3)['json'](_0x467f89);}return null;};}function patchUpdates(_0xcb40e6){return function(_0x48cfd3){try{jsonpatch['apply'](_0x48cfd3,_0xcb40e6,!![]);}catch(_0x12335a){return BPromise[_0x5778('0x1b')](_0x12335a);}return _0x48cfd3['save']();};}function saveUpdates(_0x5cf7c6,_0x48e54b){return function(_0x7e637c){if(_0x7e637c){return _0x7e637c[_0x5778('0x1c')](_0x5cf7c6)[_0x5778('0x1d')](function(_0x4cc085){return _0x4cc085;});}return null;};}function removeEntity(_0x1170be,_0x5ba3eb){return function(_0x3e7cd2){if(_0x3e7cd2){return _0x3e7cd2[_0x5778('0x1e')]()[_0x5778('0x1d')](function(){var _0x57215f=_0x3e7cd2[_0x5778('0x1f')]({'plain':!![]});var _0x3da2ca=_0x5778('0x20');return db[_0x5778('0x21')][_0x5778('0x1e')]({'where':{'type':_0x3da2ca,'resourceId':_0x57215f['id']}})['then'](function(){return _0x3e7cd2;});})['then'](function(){_0x1170be[_0x5778('0x14')](0xcc)[_0x5778('0x15')]();});}};}function handleEntityNotFound(_0x25c21c,_0x2a3499){return function(_0x29a10c){if(!_0x29a10c){_0x25c21c[_0x5778('0x22')](0x194);}return _0x29a10c;};}function handleError(_0x534035,_0x38d344){_0x38d344=_0x38d344||0x1f4;return function(_0x25e312){logger[_0x5778('0x23')](_0x25e312[_0x5778('0x24')]);if(_0x25e312[_0x5778('0x25')]){delete _0x25e312[_0x5778('0x25')];}_0x534035[_0x5778('0x14')](_0x38d344)[_0x5778('0x26')](_0x25e312);};}exports[_0x5778('0x27')]=function(_0x279bfb,_0x456579){var _0x4eedd7={},_0x58dcee={},_0x37aa7d={'count':0x0,'rows':[]};var _0x1a8a7e=_[_0x5778('0x28')](db[_0x5778('0x29')][_0x5778('0x2a')],function(_0x4e6666){return{'name':_0x4e6666[_0x5778('0x2b')],'type':_0x4e6666['type'][_0x5778('0x2c')]};});_0x58dcee[_0x5778('0x2d')]=_[_0x5778('0x28')](_0x1a8a7e,_0x5778('0x25'));_0x58dcee[_0x5778('0x2e')]=_[_0x5778('0x2f')](_0x279bfb[_0x5778('0x2e')]);_0x58dcee[_0x5778('0x30')]=_[_0x5778('0x31')](_0x58dcee['model'],_0x58dcee['query']);_0x4eedd7[_0x5778('0x32')]=_[_0x5778('0x31')](_0x58dcee[_0x5778('0x2d')],qs[_0x5778('0x33')](_0x279bfb[_0x5778('0x2e')][_0x5778('0x33')]));_0x4eedd7['attributes']=_0x4eedd7[_0x5778('0x32')][_0x5778('0x34')]?_0x4eedd7['attributes']:_0x58dcee[_0x5778('0x2d')];if(!_0x279bfb[_0x5778('0x2e')]['hasOwnProperty'](_0x5778('0x35'))){_0x4eedd7[_0x5778('0x19')]=qs[_0x5778('0x19')](_0x279bfb[_0x5778('0x2e')][_0x5778('0x19')]);_0x4eedd7[_0x5778('0x18')]=qs[_0x5778('0x18')](_0x279bfb[_0x5778('0x2e')][_0x5778('0x18')]);}_0x4eedd7[_0x5778('0x36')]=qs['sort'](_0x279bfb[_0x5778('0x2e')][_0x5778('0x37')]);_0x4eedd7[_0x5778('0x38')]=qs[_0x5778('0x30')](_[_0x5778('0x39')](_0x279bfb[_0x5778('0x2e')],_0x58dcee[_0x5778('0x30')]),_0x1a8a7e);if(_0x279bfb[_0x5778('0x2e')][_0x5778('0x3a')]){_0x4eedd7['where']=_['merge'](_0x4eedd7['where'],{'$or':_['map'](_0x1a8a7e,function(_0x5e06d8){if(_0x5e06d8['type']!==_0x5778('0x3b')){var _0x127c5d={};_0x127c5d[_0x5e06d8[_0x5778('0x25')]]={'$like':'%'+_0x279bfb[_0x5778('0x2e')][_0x5778('0x3a')]+'%'};return _0x127c5d;}})});}_0x4eedd7=_[_0x5778('0x3c')]({},_0x4eedd7,_0x279bfb[_0x5778('0x3d')]);var _0x560d9b={'where':_0x4eedd7[_0x5778('0x38')]};return db[_0x5778('0x29')][_0x5778('0x17')](_0x560d9b)[_0x5778('0x1d')](function(_0x1ed55e){_0x37aa7d['count']=_0x1ed55e;if(_0x279bfb[_0x5778('0x2e')]['includeAll']){_0x4eedd7[_0x5778('0x3e')]=[{'all':!![]}];}return db['Schedule'][_0x5778('0x3f')](_0x4eedd7);})['then'](function(_0x5a6795){_0x37aa7d[_0x5778('0x40')]=_0x5a6795;return _0x37aa7d;})[_0x5778('0x1d')](respondWithFilteredResult(_0x456579,_0x4eedd7))[_0x5778('0x41')](handleError(_0x456579,null));};exports[_0x5778('0x42')]=function(_0x35af97,_0x3584a7){var _0x41bbed={'raw':![],'where':{'id':_0x35af97[_0x5778('0x43')]['id']}},_0x2c5f91={};_0x2c5f91[_0x5778('0x2d')]=_['keys'](db[_0x5778('0x29')]['rawAttributes']);_0x2c5f91[_0x5778('0x2e')]=_[_0x5778('0x2f')](_0x35af97[_0x5778('0x2e')]);_0x2c5f91[_0x5778('0x30')]=_[_0x5778('0x31')](_0x2c5f91['model'],_0x2c5f91[_0x5778('0x2e')]);_0x41bbed[_0x5778('0x32')]=_[_0x5778('0x31')](_0x2c5f91[_0x5778('0x2d')],qs[_0x5778('0x33')](_0x35af97[_0x5778('0x2e')]['fields']));_0x41bbed[_0x5778('0x32')]=_0x41bbed[_0x5778('0x32')][_0x5778('0x34')]?_0x41bbed[_0x5778('0x32')]:_0x2c5f91[_0x5778('0x2d')];if(_0x35af97['query']['includeAll']){_0x41bbed[_0x5778('0x3e')]=[{'all':!![]}];}_0x41bbed=_[_0x5778('0x3c')]({},_0x41bbed,_0x35af97[_0x5778('0x3d')]);return db[_0x5778('0x29')][_0x5778('0x44')](_0x41bbed)[_0x5778('0x1d')](handleEntityNotFound(_0x3584a7,null))[_0x5778('0x1d')](respondWithResult(_0x3584a7,null))[_0x5778('0x41')](handleError(_0x3584a7,null));};exports['create']=function(_0xcc51e9,_0x30c9d7){return db[_0x5778('0x29')][_0x5778('0x45')](_0xcc51e9[_0x5778('0x46')],{})[_0x5778('0x1d')](function(_0x49abd1){var _0x4b2311=_0xcc51e9[_0x5778('0x47')][_0x5778('0x1f')]({'plain':!![]});if(!_0x4b2311)throw new Error(_0x5778('0x48'));if(_0x4b2311[_0x5778('0x49')]===_0x5778('0x47')){var _0x2cb27b=_0x49abd1[_0x5778('0x1f')]({'plain':!![]});var _0x56cd2d='Scheduler';return db['UserProfileSection'][_0x5778('0x44')]({'where':{'name':_0x56cd2d,'userProfileId':_0x4b2311[_0x5778('0x4a')]},'raw':!![]})[_0x5778('0x1d')](function(_0xd12570){if(_0xd12570&&_0xd12570['autoAssociation']===0x0){return db[_0x5778('0x21')][_0x5778('0x45')]({'name':_0x2cb27b[_0x5778('0x25')],'resourceId':_0x2cb27b['id'],'type':_0xd12570[_0x5778('0x25')],'sectionId':_0xd12570['id']},{})[_0x5778('0x1d')](function(){return _0x49abd1;});}else{return _0x49abd1;}})[_0x5778('0x41')](function(_0x1a809d){logger[_0x5778('0x23')](_0x5778('0x4b'),_0x1a809d);throw _0x1a809d;});}return _0x49abd1;})['then'](respondWithResult(_0x30c9d7,0xc9))['catch'](handleError(_0x30c9d7,null));};exports[_0x5778('0x1c')]=function(_0x49e01f,_0x5ad0b0){if(_0x49e01f[_0x5778('0x46')]['id']){delete _0x49e01f['body']['id'];}return db[_0x5778('0x29')][_0x5778('0x44')]({'where':{'id':_0x49e01f[_0x5778('0x43')]['id']}})[_0x5778('0x1d')](handleEntityNotFound(_0x5ad0b0,null))['then'](saveUpdates(_0x49e01f[_0x5778('0x46')],null))[_0x5778('0x1d')](respondWithResult(_0x5ad0b0,null))['catch'](handleError(_0x5ad0b0,null));};exports['destroy']=function(_0x14dde8,_0x515193){return db[_0x5778('0x29')][_0x5778('0x44')]({'where':{'id':_0x14dde8[_0x5778('0x43')]['id']}})[_0x5778('0x1d')](handleEntityNotFound(_0x515193,null))[_0x5778('0x1d')](removeEntity(_0x515193,null))['catch'](handleError(_0x515193,null));};exports[_0x5778('0x4c')]=function(_0x1e772d,_0x62ac31,_0x24ba7d){var _0x16a7e8=require(_0x5778('0x4d'));return db[_0x5778('0x29')][_0x5778('0x44')]({'where':{'id':_0x1e772d[_0x5778('0x43')]['id']},'raw':!![]})[_0x5778('0x1d')](handleEntityNotFound(_0x62ac31,null))[_0x5778('0x1d')](function(){_0x16a7e8['run'](_0x1e772d[_0x5778('0x43')]['id']);})[_0x5778('0x1d')](respondWithStatusCode(_0x62ac31,null))[_0x5778('0x41')](handleError(_0x62ac31,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 100f93b..9ddb358 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 _0x6d39=['./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4c5076,_0x52c9fc){var _0x58ac33=function(_0x1c38fc){while(--_0x1c38fc){_0x4c5076['push'](_0x4c5076['shift']());}};_0x58ac33(++_0x52c9fc);}(_0x6d39,0x16c));var _0x96d3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6d39[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x96d3('0x0'));var util=require(_0x96d3('0x1'));var logger=require(_0x96d3('0x2'))(_0x96d3('0x3'));var moment=require(_0x96d3('0x4'));var BPromise=require(_0x96d3('0x5'));var rp=require(_0x96d3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x96d3('0x8'));module[_0x96d3('0x9')]=function(_0x2328e2,_0x502145){return _0x2328e2[_0x96d3('0xa')]('Schedule',attributes,{'tableName':_0x96d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd83=['Schedule','tools_schedules','lodash','util','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define'];(function(_0x3c307c,_0x1b06c4){var _0x32cf08=function(_0x371144){while(--_0x371144){_0x3c307c['push'](_0x3c307c['shift']());}};_0x32cf08(++_0x1b06c4);}(_0xdd83,0x1e6));var _0x3dd8=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xdd83[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x3dd8('0x0'));var util=require(_0x3dd8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3dd8('0x2'));var rp=require(_0x3dd8('0x3'));var fs=require('fs');var path=require(_0x3dd8('0x4'));var rimraf=require(_0x3dd8('0x5'));var config=require('../../config/environment');var attributes=require(_0x3dd8('0x6'));module[_0x3dd8('0x7')]=function(_0x406f5b,_0xec5d94){return _0x406f5b[_0x3dd8('0x8')](_0x3dd8('0x9'),attributes,{'tableName':_0x3dd8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 0cfbb1e..352a237 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 _0x29d3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x29d3,0x76));var _0x329d=function(_0x339783,_0x3e0255){_0x339783=_0x339783-0x0;var _0x8c4d86=_0x29d3[_0x339783];return _0x8c4d86;};'use strict';var _=require(_0x329d('0x0'));var util=require('util');var moment=require(_0x329d('0x1'));var BPromise=require(_0x329d('0x2'));var rs=require(_0x329d('0x3'));var fs=require('fs');var Redis=require(_0x329d('0x4'));var db=require(_0x329d('0x5'))['db'];var utils=require(_0x329d('0x6'));var logger=require('../../config/logger')(_0x329d('0x7'));var config=require(_0x329d('0x8'));var jayson=require(_0x329d('0x9'));var client=jayson[_0x329d('0xa')][_0x329d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x490927,_0x263c2a,_0x143198){return new BPromise(function(_0x27523f,_0x247975){return client[_0x329d('0xc')](_0x490927,_0x143198)[_0x329d('0xd')](function(_0x230212){logger['info'](_0x329d('0xe'),_0x263c2a,_0x329d('0xf'));logger[_0x329d('0x10')](_0x329d('0x11'),_0x263c2a,_0x329d('0xf'),JSON[_0x329d('0x12')](_0x230212));if(_0x230212[_0x329d('0x13')]){if(_0x230212['error'][_0x329d('0x14')]===0x1f4){logger[_0x329d('0x13')](_0x329d('0xe'),_0x263c2a,_0x230212['error']['message']);return _0x247975(_0x230212[_0x329d('0x13')]['message']);}logger[_0x329d('0x13')]('Schedule,\x20%s,\x20%s',_0x263c2a,_0x230212[_0x329d('0x13')][_0x329d('0x15')]);return _0x27523f(_0x230212['error'][_0x329d('0x15')]);}else{logger[_0x329d('0x16')](_0x329d('0xe'),_0x263c2a,_0x329d('0xf'));_0x27523f(_0x230212[_0x329d('0x17')]['message']);}})['catch'](function(_0xb43afe){logger[_0x329d('0x13')](_0x329d('0xe'),_0x263c2a,_0xb43afe);_0x247975(_0xb43afe);});});} \ No newline at end of file +var _0xdf40=['error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x23f825,_0x2e29b7){var _0x172b9b=function(_0x1e472c){while(--_0x1e472c){_0x23f825['push'](_0x23f825['shift']());}};_0x172b9b(++_0x2e29b7);}(_0xdf40,0x81));var _0x0df4=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0xdf40[_0x4fda88];return _0xe37511;};'use strict';var _=require(_0x0df4('0x0'));var util=require(_0x0df4('0x1'));var moment=require(_0x0df4('0x2'));var BPromise=require(_0x0df4('0x3'));var rs=require(_0x0df4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0df4('0x5'))['db'];var utils=require(_0x0df4('0x6'));var logger=require(_0x0df4('0x7'))(_0x0df4('0x8'));var config=require('../../config/environment');var jayson=require(_0x0df4('0x9'));var client=jayson['client'][_0x0df4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20639c,_0x103b34,_0x4912b7){return new BPromise(function(_0x4b0076,_0x2ad0af){return client['request'](_0x20639c,_0x4912b7)[_0x0df4('0xb')](function(_0x587565){logger[_0x0df4('0xc')](_0x0df4('0xd'),_0x103b34,'request\x20sent');logger[_0x0df4('0xe')](_0x0df4('0xf'),_0x103b34,_0x0df4('0x10'),JSON[_0x0df4('0x11')](_0x587565));if(_0x587565[_0x0df4('0x12')]){if(_0x587565['error'][_0x0df4('0x13')]===0x1f4){logger['error'](_0x0df4('0xd'),_0x103b34,_0x587565[_0x0df4('0x12')][_0x0df4('0x14')]);return _0x2ad0af(_0x587565[_0x0df4('0x12')][_0x0df4('0x14')]);}logger[_0x0df4('0x12')](_0x0df4('0xd'),_0x103b34,_0x587565['error'][_0x0df4('0x14')]);return _0x4b0076(_0x587565['error'][_0x0df4('0x14')]);}else{logger[_0x0df4('0xc')](_0x0df4('0xd'),_0x103b34,_0x0df4('0x10'));_0x4b0076(_0x587565['result']['message']);}})['catch'](function(_0x50a731){logger['error']('Schedule,\x20%s,\x20%s',_0x103b34,_0x50a731);_0x2ad0af(_0x50a731);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 816efa4..2e81008 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 _0x0e9f=['Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','put','delete','destroy','exports','multer','util','path','express'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0e9f,0xa4));var _0xf0e9=function(_0x21e315,_0x5fbb5e){_0x21e315=_0x21e315-0x0;var _0x1fabfa=_0x0e9f[_0x21e315];return _0x1fabfa;};'use strict';var multer=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var path=require(_0xf0e9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0e9('0x3'));var router=express[_0xf0e9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf0e9('0x5'));var config=require(_0xf0e9('0x6'));var controller=require(_0xf0e9('0x7'));router[_0xf0e9('0x8')]('/',auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xa')]);router[_0xf0e9('0x8')](_0xf0e9('0xb'),auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xc')]);router[_0xf0e9('0x8')](_0xf0e9('0xd'),auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xe')]);router['get']('/:id/download',auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xf')]);router[_0xf0e9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf0e9('0x11')](_0xf0e9('0xd'),auth[_0xf0e9('0x9')](),controller['update']);router[_0xf0e9('0x12')](_0xf0e9('0xd'),auth['isAuthenticated'](),controller[_0xf0e9('0x13')]);module[_0xf0e9('0x14')]=router; \ No newline at end of file +var _0x8571=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create'];(function(_0x5a488c,_0x4cc470){var _0x53a7d6=function(_0x43a0d8){while(--_0x43a0d8){_0x5a488c['push'](_0x5a488c['shift']());}};_0x53a7d6(++_0x4cc470);}(_0x8571,0x1bd));var _0x1857=function(_0x2af7e6,_0x56c925){_0x2af7e6=_0x2af7e6-0x0;var _0x45b8fd=_0x8571[_0x2af7e6];return _0x45b8fd;};'use strict';var multer=require(_0x1857('0x0'));var util=require(_0x1857('0x1'));var path=require(_0x1857('0x2'));var timeout=require(_0x1857('0x3'));var express=require('express');var router=express[_0x1857('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1857('0x5'));router[_0x1857('0x6')]('/',auth['isAuthenticated'](),controller[_0x1857('0x7')]);router[_0x1857('0x6')](_0x1857('0x8'),auth[_0x1857('0x9')](),controller[_0x1857('0xa')]);router[_0x1857('0x6')](_0x1857('0xb'),auth[_0x1857('0x9')](),controller[_0x1857('0xc')]);router[_0x1857('0x6')](_0x1857('0xd'),auth['isAuthenticated'](),controller[_0x1857('0xe')]);router[_0x1857('0xf')]('/',auth[_0x1857('0x9')](),controller[_0x1857('0x10')]);router[_0x1857('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1857('0x12')]);router[_0x1857('0x13')]('/:id',auth[_0x1857('0x9')](),controller[_0x1857('0x14')]);module[_0x1857('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6fec0e8..95d67b8 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 _0xe5b3=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4ebd79,_0x271fd2){_0x4ebd79=_0x4ebd79-0x0;var _0x427292=_0xe5b3[_0x4ebd79];return _0x427292;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var config=require(_0x3e5b('0x2'));module[_0x3e5b('0x3')]={'format':{'type':Sequelize[_0x3e5b('0x4')],'get':function(){return this[_0x3e5b('0x5')](_0x3e5b('0x6'))?path[_0x3e5b('0x7')](this[_0x3e5b('0x5')](_0x3e5b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x3e5b('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3e5b('0x8')],'set':function(_0x5dcf55){var _0x534e7d=_0x5dcf55[_0x3e5b('0x9')](/\\/g,'/');this[_0x3e5b('0xa')](_0x3e5b('0x6'),_0x534e7d);}},'rating':{'type':Sequelize[_0x3e5b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4ed6bc){this[_0x3e5b('0xa')](_0x3e5b('0xc'),moment()[_0x3e5b('0xd')](_0x4ed6bc,'ms'));this[_0x3e5b('0xa')](_0x3e5b('0xe'),moment());this['setDataValue'](_0x3e5b('0xf'),_0x4ed6bc);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3e5b('0x5')](_0x3e5b('0xc')))[_0x3e5b('0x10')](_0x3e5b('0x11'))[_0x3e5b('0x12')]();}},'closedAt':{'type':Sequelize[_0x3e5b('0x13')],'get':function(){return moment(this[_0x3e5b('0x5')]('closedAt'))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3e5b('0x5')](_0x3e5b('0x14')))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3e5b('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x3e5b('0x15')))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3e5b('0x12')]();}}}; \ No newline at end of file +var _0x5636=['format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','DATE','startedAt'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5636,0x102));var _0x6563=function(_0x3d71e6,_0x53c2be){_0x3d71e6=_0x3d71e6-0x0;var _0x49a153=_0x5636[_0x3d71e6];return _0x49a153;};'use strict';var Sequelize=require(_0x6563('0x0'));var moment=require(_0x6563('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x6563('0x2')],'get':function(){return this[_0x6563('0x3')](_0x6563('0x4'))?path['extname'](this[_0x6563('0x3')](_0x6563('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x6563('0x5')]},'channel':{'type':Sequelize[_0x6563('0x5')]},'value':{'type':Sequelize[_0x6563('0x5')],'set':function(_0x193942){var _0x9884a9=_0x193942[_0x6563('0x6')](/\\/g,'/');this[_0x6563('0x7')](_0x6563('0x4'),_0x9884a9);}},'rating':{'type':Sequelize[_0x6563('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6563('0x8')],'set':function(_0x3ccb4e){this['setDataValue']('startedAt',moment()[_0x6563('0x9')](_0x3ccb4e,'ms'));this[_0x6563('0x7')]('closedAt',moment());this['setDataValue']('duration',_0x3ccb4e);}},'startedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xb')))[_0x6563('0xc')](_0x6563('0xd'))[_0x6563('0xe')]();}},'closedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xf')))['format'](_0x6563('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x10')))[_0x6563('0xc')]('MM-DD-YYYY\x20HH:mm')[_0x6563('0xe')]();}},'updatedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x11')))['format'](_0x6563('0xd'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index bfd3f1b..a7f8df9 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 _0x891b=['includeAll','include','findAll','rows','catch','show','params','options','find','create','body','duration','createdAt','closedAt','value','describe','download','join','root','server/files/screen_recordings','%s.cypher','existsSync','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','attributes','fields','length','nolimit','offset','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x3ac6a3,_0x3dc212){var _0x16951c=function(_0x3e3498){while(--_0x3e3498){_0x3ac6a3['push'](_0x3ac6a3['shift']());}};_0x16951c(++_0x3dc212);}(_0x891b,0x158));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb891('0x0'));var rimraf=require(_0xb891('0x1'));var zipdir=require(_0xb891('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb891('0x3'));var moment=require(_0xb891('0x4'));var BPromise=require(_0xb891('0x5'));var Mustache=require(_0xb891('0x6'));var util=require(_0xb891('0x7'));var path=require(_0xb891('0x8'));var sox=require(_0xb891('0x9'));var csv=require(_0xb891('0xa'));var ejs=require(_0xb891('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb891('0xc'));var crypto=require('crypto');var jsforce=require(_0xb891('0xd'));var deskjs=require(_0xb891('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb891('0xf'));var Papa=require('papaparse');var Redis=require(_0xb891('0x10'));var authService=require(_0xb891('0x11'));var qs=require(_0xb891('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb891('0x13'));var utils=require(_0xb891('0x14'));var config=require(_0xb891('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb891('0x16'))['db'];function respondWithStatusCode(_0x4e90dd,_0x11b25b){_0x11b25b=_0x11b25b||0xcc;return function(_0x51d37a){if(_0x51d37a){return _0x4e90dd[_0xb891('0x17')](_0x11b25b);}return _0x4e90dd['status'](_0x11b25b)[_0xb891('0x18')]();};}function respondWithResult(_0x5e5233,_0x59e787){_0x59e787=_0x59e787||0xc8;return function(_0x51cb36){if(_0x51cb36){return _0x5e5233[_0xb891('0x19')](_0x59e787)['json'](_0x51cb36);}};}function respondWithFilteredResult(_0x1a3069,_0x3c599b){return function(_0x3c9194){if(_0x3c9194){var _0x3a554a=_0x3c9194[_0xb891('0x1a')],_0x2b952e=_0x3c599b['offset'],_0x12c127=_0x3c599b['offset']+_0x3c599b[_0xb891('0x1b')],_0x3d27c5;if(_0x12c127>=_0x3a554a){_0x12c127=_0x3a554a;_0x3d27c5=0xc8;}else{_0x3d27c5=0xce;}_0x1a3069[_0xb891('0x19')](_0x3d27c5);return _0x1a3069[_0xb891('0x1c')](_0xb891('0x1d'),_0x2b952e+'-'+_0x12c127+'/'+_0x3a554a)[_0xb891('0x1e')](_0x3c9194);}return null;};}function patchUpdates(_0x39f38a){return function(_0x5c9ff8){try{jsonpatch['apply'](_0x5c9ff8,_0x39f38a,!![]);}catch(_0x426569){return BPromise[_0xb891('0x1f')](_0x426569);}return _0x5c9ff8[_0xb891('0x20')]();};}function saveUpdates(_0x4a1f31,_0x202574){return function(_0x39465d){if(_0x39465d){return _0x39465d[_0xb891('0x21')](_0x4a1f31)[_0xb891('0x22')](function(_0x1f242e){return _0x1f242e;});}return null;};}function removeEntity(_0x282a65,_0x53be7f){return function(_0x2b0b59){if(_0x2b0b59){return _0x2b0b59[_0xb891('0x23')]()['then'](function(){_0x282a65[_0xb891('0x19')](0xcc)[_0xb891('0x18')]();});}};}function handleEntityNotFound(_0x5dcab9,_0x351300){return function(_0x57a499){if(!_0x57a499){_0x5dcab9['sendStatus'](0x194);}return _0x57a499;};}function handleError(_0x40f174,_0x439fe3){_0x439fe3=_0x439fe3||0x1f4;return function(_0x3527f6){logger[_0xb891('0x24')](_0x3527f6[_0xb891('0x25')]);if(_0x3527f6[_0xb891('0x26')]){delete _0x3527f6[_0xb891('0x26')];}_0x40f174[_0xb891('0x19')](_0x439fe3)[_0xb891('0x27')](_0x3527f6);};}exports[_0xb891('0x28')]=function(_0x368ec6,_0x498cc5){var _0x16eca1={},_0x45cea3={},_0x35bf61={'count':0x0,'rows':[]};var _0x285adf=_[_0xb891('0x29')](db[_0xb891('0x2a')][_0xb891('0x2b')],function(_0x19a2e5){return{'name':_0x19a2e5[_0xb891('0x2c')],'type':_0x19a2e5[_0xb891('0x2d')][_0xb891('0x2e')]};});_0x45cea3[_0xb891('0x2f')]=_['differenceBy'](_['map'](_0x285adf,_0xb891('0x26')),[_0xb891('0x30')]);_0x45cea3[_0xb891('0x31')]=_[_0xb891('0x32')](_0x368ec6[_0xb891('0x31')]);_0x45cea3['filters']=_[_0xb891('0x33')](_0x45cea3[_0xb891('0x2f')],_0x45cea3[_0xb891('0x31')]);_0x16eca1[_0xb891('0x34')]=_[_0xb891('0x33')](_0x45cea3['model'],qs['fields'](_0x368ec6[_0xb891('0x31')][_0xb891('0x35')]));_0x16eca1[_0xb891('0x34')]=_0x16eca1[_0xb891('0x34')][_0xb891('0x36')]?_0x16eca1[_0xb891('0x34')]:_0x45cea3[_0xb891('0x2f')];if(!_0x368ec6['query']['hasOwnProperty'](_0xb891('0x37'))){_0x16eca1[_0xb891('0x1b')]=qs[_0xb891('0x1b')](_0x368ec6['query'][_0xb891('0x1b')]);_0x16eca1[_0xb891('0x38')]=qs[_0xb891('0x38')](_0x368ec6[_0xb891('0x31')][_0xb891('0x38')]);}_0x16eca1['order']=qs[_0xb891('0x39')](_0x368ec6[_0xb891('0x31')][_0xb891('0x39')]);_0x16eca1['where']=qs[_0xb891('0x3a')](_[_0xb891('0x3b')](_0x368ec6[_0xb891('0x31')],_0x45cea3[_0xb891('0x3a')]),_0x285adf);if(_0x368ec6[_0xb891('0x31')][_0xb891('0x3c')]){_0x16eca1[_0xb891('0x3d')]=_[_0xb891('0x3e')](_0x16eca1[_0xb891('0x3d')],{'$or':_[_0xb891('0x29')](_0x285adf,function(_0x10333c){if(_0x10333c['type']!==_0xb891('0x3f')){var _0x5e9934={};_0x5e9934[_0x10333c[_0xb891('0x26')]]={'$like':'%'+_0x368ec6[_0xb891('0x31')][_0xb891('0x3c')]+'%'};return _0x5e9934;}})});}_0x16eca1=_[_0xb891('0x3e')]({},_0x16eca1,_0x368ec6['options']);var _0xf67389={'where':_0x16eca1[_0xb891('0x3d')]};return db[_0xb891('0x2a')][_0xb891('0x1a')](_0xf67389)[_0xb891('0x22')](function(_0x21de6f){_0x35bf61[_0xb891('0x1a')]=_0x21de6f;if(_0x368ec6[_0xb891('0x31')][_0xb891('0x40')]){_0x16eca1[_0xb891('0x41')]=[{'all':!![]}];}return db[_0xb891('0x2a')][_0xb891('0x42')](_0x16eca1);})[_0xb891('0x22')](function(_0x196313){_0x35bf61[_0xb891('0x43')]=_0x196313;return _0x35bf61;})['then'](respondWithFilteredResult(_0x498cc5,_0x16eca1))[_0xb891('0x44')](handleError(_0x498cc5,null));};exports[_0xb891('0x45')]=function(_0xb2cec0,_0x805cc3){var _0x37fc35={'raw':![],'where':{'id':_0xb2cec0[_0xb891('0x46')]['id']}},_0x56e741={};_0x56e741[_0xb891('0x2f')]=_[_0xb891('0x32')](db[_0xb891('0x2a')][_0xb891('0x2b')]);_0x56e741[_0xb891('0x31')]=_['keys'](_0xb2cec0['query']);_0x56e741[_0xb891('0x3a')]=_[_0xb891('0x33')](_0x56e741['model'],_0x56e741[_0xb891('0x31')]);_0x37fc35[_0xb891('0x34')]=_[_0xb891('0x33')](_0x56e741[_0xb891('0x2f')],qs['fields'](_0xb2cec0[_0xb891('0x31')][_0xb891('0x35')]));_0x37fc35[_0xb891('0x34')]=_0x37fc35['attributes'][_0xb891('0x36')]?_0x37fc35[_0xb891('0x34')]:_0x56e741['model'];if(_0xb2cec0[_0xb891('0x31')][_0xb891('0x40')]){_0x37fc35['include']=[{'all':!![]}];}_0x37fc35=_['merge']({},_0x37fc35,_0xb2cec0[_0xb891('0x47')]);return db['ScreenRecording'][_0xb891('0x48')](_0x37fc35)[_0xb891('0x22')](handleEntityNotFound(_0x805cc3,null))[_0xb891('0x22')](respondWithResult(_0x805cc3,null))[_0xb891('0x44')](handleError(_0x805cc3,null));};exports[_0xb891('0x49')]=function(_0x1d27ec,_0x2a6da8){return db[_0xb891('0x2a')][_0xb891('0x49')](_0x1d27ec['body'],{})['then'](respondWithResult(_0x2a6da8,0xc9))['catch'](handleError(_0x2a6da8,null));};exports[_0xb891('0x21')]=function(_0x157c42,_0x1634d0){if(_0x157c42[_0xb891('0x4a')]['id']){delete _0x157c42['body']['id'];}delete _0x157c42[_0xb891('0x4a')][_0xb891('0x4b')];delete _0x157c42[_0xb891('0x4a')][_0xb891('0x4c')];delete _0x157c42['body'][_0xb891('0x4d')];delete _0x157c42[_0xb891('0x4a')][_0xb891('0x4e')];return db[_0xb891('0x2a')][_0xb891('0x48')]({'where':{'id':_0x157c42[_0xb891('0x46')]['id']}})[_0xb891('0x22')](handleEntityNotFound(_0x1634d0,null))['then'](saveUpdates(_0x157c42[_0xb891('0x4a')],null))[_0xb891('0x22')](respondWithResult(_0x1634d0,null))[_0xb891('0x44')](handleError(_0x1634d0,null));};exports[_0xb891('0x4f')]=function(_0xd5d568,_0x4ab68c){return db[_0xb891('0x2a')]['describe']()[_0xb891('0x22')](respondWithResult(_0x4ab68c,null))['catch'](handleError(_0x4ab68c,null));};exports[_0xb891('0x50')]=function(_0x457248,_0x3a14fd,_0xbb6b5b){var _0x129139=require('../../components/encryptor');var _0x3ddb4b=![];var _0x53c4bd={};if(_0x457248[_0xb891('0x31')][_0xb891('0x2d')]&&_0x457248[_0xb891('0x31')][_0xb891('0x2d')]==='uniqueid'){_0x53c4bd['uniqueid']=_0x457248[_0xb891('0x46')]['id'];}else{_0x53c4bd['id']=_0x457248['params']['id'];}return db[_0xb891('0x2a')][_0xb891('0x48')]({'where':_0x53c4bd,'attributes':['id',_0xb891('0x4e')],'raw':!![]})[_0xb891('0x22')](handleEntityNotFound(_0x3a14fd,null))[_0xb891('0x22')](function(_0x521203){if(_0x521203){var _0x576fc9=path[_0xb891('0x51')](config[_0xb891('0x52')],_0xb891('0x53'),_0x521203[_0xb891('0x4e')]);var _0xfd2ade=util[_0xb891('0x30')](_0xb891('0x54'),_0x576fc9);if(fs[_0xb891('0x55')](_0xfd2ade)){_0x3ddb4b=!![];return _0x129139['decryptFile'](_0xfd2ade,_0x576fc9,config['secrets'][_0xb891('0x56')])[_0xb891('0x22')](function(){return _0x521203;});}return _0x521203;}})[_0xb891('0x22')](function(_0x311f2a){if(_0x311f2a){var _0x2263a7=path[_0xb891('0x51')](config[_0xb891('0x52')],_0xb891('0x53'),_0x311f2a[_0xb891('0x4e')]);if(!fs[_0xb891('0x55')](_0x2263a7)){throw new db[(_0xb891('0x57'))][(_0xb891('0x58'))](_0xb891('0x59'));}if(_0x311f2a[_0xb891('0x5a')]){return _0x3a14fd[_0xb891('0x50')](_0x2263a7,_0x311f2a[_0xb891('0x5a')]+path[_0xb891('0x5b')](_0x2263a7),function(){if(_0x3ddb4b){fs[_0xb891('0x5c')](_0x2263a7);}});}else{return _0x3a14fd[_0xb891('0x50')](_0x2263a7,function(_0x128d61){if(_0x3ddb4b){fs[_0xb891('0x5c')](_0x2263a7);}});}}})[_0xb891('0x44')](function(_0x2fcf49){if(_0x2fcf49[_0xb891('0x5d')]===_0xb891('0x59')){_0x3a14fd[_0xb891('0x19')](0x194)['send'](_0xb891('0x5e'));}else{return handleError(_0x3a14fd,null);}});};exports[_0xb891('0x23')]=function(_0x1cfe97,_0x51cd1c){return db['ScreenRecording']['find']({'where':{'id':_0x1cfe97[_0xb891('0x46')]['id']}})[_0xb891('0x22')](function(_0x19e9cc){if(!_0x19e9cc)throw new ReferenceError(_0xb891('0x5f'));return _0x19e9cc;})[_0xb891('0x22')](function(_0x2f6d1c){var _0x48122c=path['join'](config[_0xb891('0x52')],_0xb891('0x53'),_0x2f6d1c[_0xb891('0x4e')]);logger['info'](_0xb891('0x60'),_0x48122c);if(!_['isNil'](_0x2f6d1c['value'])&&fs[_0xb891('0x55')](_0x48122c)){logger[_0xb891('0x61')](_0xb891('0x62')+_0x48122c+_0xb891('0x63'));fs[_0xb891('0x64')](_0x48122c);}_0x48122c=_0x48122c+_0xb891('0x65');if(!_['isNil'](_0x2f6d1c[_0xb891('0x4e')])&&fs[_0xb891('0x55')](_0x48122c)){logger['info'](_0xb891('0x62')+_0x48122c+_0xb891('0x63'));fs[_0xb891('0x64')](_0x48122c);}return _0x2f6d1c;})[_0xb891('0x22')](function(_0x530048){if(!_0x530048)throw new InternalError();return _0x530048[_0xb891('0x23')]();})[_0xb891('0x22')](function(){_0x51cd1c[_0xb891('0x19')](0xcc)['end']();})[_0xb891('0x44')](handleError(_0x51cd1c,null));}; \ No newline at end of file +var _0xe251=['pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','type','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where'];(function(_0x54ece6,_0x11a6c6){var _0x2cfd35=function(_0x8163c6){while(--_0x8163c6){_0x54ece6['push'](_0x54ece6['shift']());}};_0x2cfd35(++_0x11a6c6);}(_0xe251,0x1c0));var _0x1e25=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0xe251[_0x16b992];return _0x385c78;};'use strict';var pdf=require(_0x1e25('0x0'));var emlformat=require(_0x1e25('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e25('0x3'));var moment=require(_0x1e25('0x4'));var BPromise=require(_0x1e25('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1e25('0x6'));var csv=require('to-csv');var ejs=require(_0x1e25('0x7'));var fs=require('fs');var _=require(_0x1e25('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e25('0x9'));var deskjs=require(_0x1e25('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1e25('0xb'));var Papa=require('papaparse');var Redis=require(_0x1e25('0xc'));var authService=require(_0x1e25('0xd'));var qs=require(_0x1e25('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e25('0xf'));var logger=require(_0x1e25('0x10'))(_0x1e25('0x11'));var utils=require(_0x1e25('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1e25('0x13'));var db=require(_0x1e25('0x14'))['db'];function respondWithStatusCode(_0x3b0051,_0x325873){_0x325873=_0x325873||0xcc;return function(_0x393f9f){if(_0x393f9f){return _0x3b0051['sendStatus'](_0x325873);}return _0x3b0051['status'](_0x325873)['end']();};}function respondWithResult(_0x1b9f7e,_0x247498){_0x247498=_0x247498||0xc8;return function(_0x3817b2){if(_0x3817b2){return _0x1b9f7e[_0x1e25('0x15')](_0x247498)[_0x1e25('0x16')](_0x3817b2);}};}function respondWithFilteredResult(_0x405cf8,_0x3005a5){return function(_0x5704f2){if(_0x5704f2){var _0x1d8e25=_0x5704f2[_0x1e25('0x17')],_0x40bf18=_0x3005a5[_0x1e25('0x18')],_0x3abe83=_0x3005a5[_0x1e25('0x18')]+_0x3005a5[_0x1e25('0x19')],_0x141eb6;if(_0x3abe83>=_0x1d8e25){_0x3abe83=_0x1d8e25;_0x141eb6=0xc8;}else{_0x141eb6=0xce;}_0x405cf8[_0x1e25('0x15')](_0x141eb6);return _0x405cf8[_0x1e25('0x1a')](_0x1e25('0x1b'),_0x40bf18+'-'+_0x3abe83+'/'+_0x1d8e25)['json'](_0x5704f2);}return null;};}function patchUpdates(_0x61a470){return function(_0x3dcaf0){try{jsonpatch['apply'](_0x3dcaf0,_0x61a470,!![]);}catch(_0x5f0156){return BPromise[_0x1e25('0x1c')](_0x5f0156);}return _0x3dcaf0[_0x1e25('0x1d')]();};}function saveUpdates(_0x5d1f26,_0x4de212){return function(_0x57d74a){if(_0x57d74a){return _0x57d74a[_0x1e25('0x1e')](_0x5d1f26)[_0x1e25('0x1f')](function(_0x398e09){return _0x398e09;});}return null;};}function removeEntity(_0x2b9cc2,_0x5eb681){return function(_0x27d68b){if(_0x27d68b){return _0x27d68b[_0x1e25('0x20')]()[_0x1e25('0x1f')](function(){_0x2b9cc2[_0x1e25('0x15')](0xcc)[_0x1e25('0x21')]();});}};}function handleEntityNotFound(_0x1bc382,_0x1117a9){return function(_0x3e86e1){if(!_0x3e86e1){_0x1bc382['sendStatus'](0x194);}return _0x3e86e1;};}function handleError(_0x426525,_0x2180b7){_0x2180b7=_0x2180b7||0x1f4;return function(_0x23068f){logger[_0x1e25('0x22')](_0x23068f[_0x1e25('0x23')]);if(_0x23068f[_0x1e25('0x24')]){delete _0x23068f[_0x1e25('0x24')];}_0x426525['status'](_0x2180b7)[_0x1e25('0x25')](_0x23068f);};}exports[_0x1e25('0x26')]=function(_0x43b321,_0x15ab3c){var _0x520656={},_0xe36bd={},_0x8cf468={'count':0x0,'rows':[]};var _0x3f4cf0=_[_0x1e25('0x27')](db[_0x1e25('0x28')][_0x1e25('0x29')],function(_0x1716d0){return{'name':_0x1716d0[_0x1e25('0x2a')],'type':_0x1716d0['type'][_0x1e25('0x2b')]};});_0xe36bd['model']=_[_0x1e25('0x2c')](_[_0x1e25('0x27')](_0x3f4cf0,_0x1e25('0x24')),[_0x1e25('0x2d')]);_0xe36bd[_0x1e25('0x2e')]=_[_0x1e25('0x2f')](_0x43b321[_0x1e25('0x2e')]);_0xe36bd[_0x1e25('0x30')]=_[_0x1e25('0x31')](_0xe36bd[_0x1e25('0x32')],_0xe36bd[_0x1e25('0x2e')]);_0x520656[_0x1e25('0x33')]=_[_0x1e25('0x31')](_0xe36bd['model'],qs[_0x1e25('0x34')](_0x43b321['query'][_0x1e25('0x34')]));_0x520656['attributes']=_0x520656[_0x1e25('0x33')]['length']?_0x520656[_0x1e25('0x33')]:_0xe36bd[_0x1e25('0x32')];if(!_0x43b321[_0x1e25('0x2e')][_0x1e25('0x35')]('nolimit')){_0x520656['limit']=qs[_0x1e25('0x19')](_0x43b321[_0x1e25('0x2e')][_0x1e25('0x19')]);_0x520656[_0x1e25('0x18')]=qs[_0x1e25('0x18')](_0x43b321['query'][_0x1e25('0x18')]);}_0x520656[_0x1e25('0x36')]=qs[_0x1e25('0x37')](_0x43b321[_0x1e25('0x2e')][_0x1e25('0x37')]);_0x520656[_0x1e25('0x38')]=qs[_0x1e25('0x30')](_[_0x1e25('0x39')](_0x43b321[_0x1e25('0x2e')],_0xe36bd[_0x1e25('0x30')]),_0x3f4cf0);if(_0x43b321[_0x1e25('0x2e')][_0x1e25('0x3a')]){_0x520656[_0x1e25('0x38')]=_[_0x1e25('0x3b')](_0x520656['where'],{'$or':_[_0x1e25('0x27')](_0x3f4cf0,function(_0x277e57){if(_0x277e57['type']!==_0x1e25('0x3c')){var _0xe24231={};_0xe24231[_0x277e57[_0x1e25('0x24')]]={'$like':'%'+_0x43b321['query']['filter']+'%'};return _0xe24231;}})});}_0x520656=_[_0x1e25('0x3b')]({},_0x520656,_0x43b321[_0x1e25('0x3d')]);var _0x2e628f={'where':_0x520656[_0x1e25('0x38')]};return db[_0x1e25('0x28')][_0x1e25('0x17')](_0x2e628f)[_0x1e25('0x1f')](function(_0x20539d){_0x8cf468[_0x1e25('0x17')]=_0x20539d;if(_0x43b321[_0x1e25('0x2e')]['includeAll']){_0x520656[_0x1e25('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x520656);})[_0x1e25('0x1f')](function(_0x4b2ce9){_0x8cf468[_0x1e25('0x3f')]=_0x4b2ce9;return _0x8cf468;})['then'](respondWithFilteredResult(_0x15ab3c,_0x520656))[_0x1e25('0x40')](handleError(_0x15ab3c,null));};exports[_0x1e25('0x41')]=function(_0x64ff69,_0x1446a1){var _0x2615c8={'raw':![],'where':{'id':_0x64ff69[_0x1e25('0x42')]['id']}},_0x7ce347={};_0x7ce347['model']=_[_0x1e25('0x2f')](db[_0x1e25('0x28')]['rawAttributes']);_0x7ce347[_0x1e25('0x2e')]=_[_0x1e25('0x2f')](_0x64ff69['query']);_0x7ce347[_0x1e25('0x30')]=_[_0x1e25('0x31')](_0x7ce347['model'],_0x7ce347[_0x1e25('0x2e')]);_0x2615c8[_0x1e25('0x33')]=_[_0x1e25('0x31')](_0x7ce347['model'],qs[_0x1e25('0x34')](_0x64ff69[_0x1e25('0x2e')][_0x1e25('0x34')]));_0x2615c8[_0x1e25('0x33')]=_0x2615c8['attributes'][_0x1e25('0x43')]?_0x2615c8[_0x1e25('0x33')]:_0x7ce347['model'];if(_0x64ff69[_0x1e25('0x2e')][_0x1e25('0x44')]){_0x2615c8[_0x1e25('0x3e')]=[{'all':!![]}];}_0x2615c8=_[_0x1e25('0x3b')]({},_0x2615c8,_0x64ff69[_0x1e25('0x3d')]);return db['ScreenRecording'][_0x1e25('0x45')](_0x2615c8)[_0x1e25('0x1f')](handleEntityNotFound(_0x1446a1,null))[_0x1e25('0x1f')](respondWithResult(_0x1446a1,null))[_0x1e25('0x40')](handleError(_0x1446a1,null));};exports[_0x1e25('0x46')]=function(_0x46c367,_0x1b2156){return db[_0x1e25('0x28')][_0x1e25('0x46')](_0x46c367[_0x1e25('0x47')],{})[_0x1e25('0x1f')](respondWithResult(_0x1b2156,0xc9))['catch'](handleError(_0x1b2156,null));};exports[_0x1e25('0x1e')]=function(_0x53ba87,_0x543b16){if(_0x53ba87['body']['id']){delete _0x53ba87[_0x1e25('0x47')]['id'];}delete _0x53ba87[_0x1e25('0x47')][_0x1e25('0x48')];delete _0x53ba87['body'][_0x1e25('0x49')];delete _0x53ba87[_0x1e25('0x47')][_0x1e25('0x4a')];delete _0x53ba87['body'][_0x1e25('0x4b')];return db[_0x1e25('0x28')][_0x1e25('0x45')]({'where':{'id':_0x53ba87['params']['id']}})[_0x1e25('0x1f')](handleEntityNotFound(_0x543b16,null))[_0x1e25('0x1f')](saveUpdates(_0x53ba87[_0x1e25('0x47')],null))[_0x1e25('0x1f')](respondWithResult(_0x543b16,null))[_0x1e25('0x40')](handleError(_0x543b16,null));};exports[_0x1e25('0x4c')]=function(_0x2a24d0,_0x17f8ab){return db[_0x1e25('0x28')][_0x1e25('0x4c')]()[_0x1e25('0x1f')](respondWithResult(_0x17f8ab,null))[_0x1e25('0x40')](handleError(_0x17f8ab,null));};exports[_0x1e25('0x4d')]=function(_0x40ced6,_0x2e5b66,_0xc22476){var _0xb56904=require(_0x1e25('0x4e'));var _0x19b509=![];var _0x400a2b={};if(_0x40ced6[_0x1e25('0x2e')][_0x1e25('0x4f')]&&_0x40ced6[_0x1e25('0x2e')][_0x1e25('0x4f')]==='uniqueid'){_0x400a2b['uniqueid']=_0x40ced6[_0x1e25('0x42')]['id'];}else{_0x400a2b['id']=_0x40ced6[_0x1e25('0x42')]['id'];}return db['ScreenRecording'][_0x1e25('0x45')]({'where':_0x400a2b,'attributes':['id','value'],'raw':!![]})[_0x1e25('0x1f')](handleEntityNotFound(_0x2e5b66,null))[_0x1e25('0x1f')](function(_0x2705c9){if(_0x2705c9){var _0x41ecb8=path[_0x1e25('0x50')](config[_0x1e25('0x51')],_0x1e25('0x52'),_0x2705c9[_0x1e25('0x4b')]);var _0x24998f=util[_0x1e25('0x2d')](_0x1e25('0x53'),_0x41ecb8);if(fs[_0x1e25('0x54')](_0x24998f)){_0x19b509=!![];return _0xb56904[_0x1e25('0x55')](_0x24998f,_0x41ecb8,config['secrets'][_0x1e25('0x56')])[_0x1e25('0x1f')](function(){return _0x2705c9;});}return _0x2705c9;}})[_0x1e25('0x1f')](function(_0x2cc50b){if(_0x2cc50b){var _0x464409=path[_0x1e25('0x50')](config[_0x1e25('0x51')],_0x1e25('0x52'),_0x2cc50b['value']);if(!fs[_0x1e25('0x54')](_0x464409)){throw new db[(_0x1e25('0x57'))][(_0x1e25('0x58'))](_0x1e25('0x59'));}if(_0x2cc50b[_0x1e25('0x5a')]){return _0x2e5b66[_0x1e25('0x4d')](_0x464409,_0x2cc50b[_0x1e25('0x5a')]+path[_0x1e25('0x5b')](_0x464409),function(){if(_0x19b509){fs[_0x1e25('0x5c')](_0x464409);}});}else{return _0x2e5b66[_0x1e25('0x4d')](_0x464409,function(_0x2867f9){if(_0x19b509){fs['unlink'](_0x464409);}});}}})[_0x1e25('0x40')](function(_0x4d046f){if(_0x4d046f['message']==='ScreenRecording\x20not\x20found'){_0x2e5b66[_0x1e25('0x15')](0x194)[_0x1e25('0x25')](_0x1e25('0x5d'));}else{return handleError(_0x2e5b66,null);}});};exports[_0x1e25('0x20')]=function(_0x34033c,_0x5aa0cc){return db[_0x1e25('0x28')]['find']({'where':{'id':_0x34033c[_0x1e25('0x42')]['id']}})[_0x1e25('0x1f')](function(_0x402e17){if(!_0x402e17)throw new ReferenceError(_0x1e25('0x5e'));return _0x402e17;})[_0x1e25('0x1f')](function(_0x155680){var _0x56a6a9=path[_0x1e25('0x50')](config[_0x1e25('0x51')],'server/files/screen_recordings',_0x155680['value']);logger['info'](_0x1e25('0x5f'),_0x56a6a9);if(!_['isNil'](_0x155680[_0x1e25('0x4b')])&&fs[_0x1e25('0x54')](_0x56a6a9)){logger[_0x1e25('0x60')]('File:\x20\x22'+_0x56a6a9+_0x1e25('0x61'));fs[_0x1e25('0x62')](_0x56a6a9);}_0x56a6a9=_0x56a6a9+_0x1e25('0x63');if(!_[_0x1e25('0x64')](_0x155680[_0x1e25('0x4b')])&&fs[_0x1e25('0x54')](_0x56a6a9)){logger[_0x1e25('0x60')]('File:\x20\x22'+_0x56a6a9+_0x1e25('0x61'));fs[_0x1e25('0x62')](_0x56a6a9);}return _0x155680;})[_0x1e25('0x1f')](function(_0x5b66c9){if(!_0x5b66c9)throw new InternalError();return _0x5b66c9['destroy']();})[_0x1e25('0x1f')](function(){_0x5aa0cc['status'](0xcc)['end']();})[_0x1e25('0x40')](handleError(_0x5aa0cc,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e0bb625..bf4f884 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 _0x7d30=['interactionid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','screen_recordings'];(function(_0x58b666,_0x233adc){var _0x47bbbb=function(_0x4ce7be){while(--_0x4ce7be){_0x58b666['push'](_0x58b666['shift']());}};_0x47bbbb(++_0x233adc);}(_0x7d30,0x12d));var _0x07d3=function(_0x331652,_0x1265bc){_0x331652=_0x331652-0x0;var _0xd6ddf4=_0x7d30[_0x331652];return _0xd6ddf4;};'use strict';var _=require(_0x07d3('0x0'));var util=require(_0x07d3('0x1'));var logger=require(_0x07d3('0x2'))('api');var moment=require(_0x07d3('0x3'));var BPromise=require(_0x07d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07d3('0x5'));var rimraf=require(_0x07d3('0x6'));var config=require(_0x07d3('0x7'));var attributes=require(_0x07d3('0x8'));module[_0x07d3('0x9')]=function(_0x52b78b,_0xbd03a4){return _0x52b78b['define']('ScreenRecording',attributes,{'tableName':_0x07d3('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x07d3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85f1=['rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x85f1,0x125));var _0x185f=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x85f1[_0x1030ce];return _0x3367fd;};'use strict';var _=require('lodash');var util=require(_0x185f('0x0'));var logger=require(_0x185f('0x1'))(_0x185f('0x2'));var moment=require(_0x185f('0x3'));var BPromise=require(_0x185f('0x4'));var rp=require(_0x185f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x185f('0x6'));var config=require(_0x185f('0x7'));var attributes=require(_0x185f('0x8'));module[_0x185f('0x9')]=function(_0x556a98,_0x5aede2){return _0x556a98['define'](_0x185f('0xa'),attributes,{'tableName':_0x185f('0xb'),'paranoid':![],'indexes':[{'name':_0x185f('0xc'),'fields':[_0x185f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9dad38b..32337b1 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(_0x1d8c3d,_0x281e0b){var _0x54aee5=function(_0x51a8f9){while(--_0x51a8f9){_0x1d8c3d['push'](_0x1d8c3d['shift']());}};_0x54aee5(++_0x281e0b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x23b9c6,_0x4a4023){var _0x12ce86=function(_0x3e37d0){while(--_0x3e37d0){_0x23b9c6['push'](_0x23b9c6['shift']());}};_0x12ce86(++_0x4a4023);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6a73bd3..4886ad6 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 _0x9f5a=['../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','put','update','exports','util','path','connect-timeout','express','Router'];(function(_0x3d1890,_0x4aea4c){var _0x5e41fe=function(_0x21886b){while(--_0x21886b){_0x3d1890['push'](_0x3d1890['shift']());}};_0x5e41fe(++_0x4aea4c);}(_0x9f5a,0x1d4));var _0xa9f5=function(_0x20eeed,_0x3ac0fb){_0x20eeed=_0x20eeed-0x0;var _0x4cdcb3=_0x9f5a[_0x20eeed];return _0x4cdcb3;};'use strict';var multer=require('multer');var util=require(_0xa9f5('0x0'));var path=require(_0xa9f5('0x1'));var timeout=require(_0xa9f5('0x2'));var express=require(_0xa9f5('0x3'));var router=express[_0xa9f5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa9f5('0x5'));var config=require(_0xa9f5('0x6'));var controller=require(_0xa9f5('0x7'));router[_0xa9f5('0x8')]('/',auth[_0xa9f5('0x9')](),controller['index']);router['get'](_0xa9f5('0xa'),controller['getDate']);router[_0xa9f5('0x8')](_0xa9f5('0xb'),controller[_0xa9f5('0xc')]);router[_0xa9f5('0x8')](_0xa9f5('0xd'),controller[_0xa9f5('0xe')]);router[_0xa9f5('0x8')](_0xa9f5('0xf'),controller[_0xa9f5('0x10')]);router['get'](_0xa9f5('0x11'),controller[_0xa9f5('0x12')]);router[_0xa9f5('0x8')](_0xa9f5('0x13'),controller[_0xa9f5('0x14')]);router[_0xa9f5('0x8')](_0xa9f5('0x15'),controller[_0xa9f5('0x16')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x178367,_0x31334f,_0x371578){_0x371578(null,path[_0xa9f5('0x18')](config[_0xa9f5('0x19')],_0xa9f5('0x1a')));},'filename':function(_0xef1b58,_0x4ed672,_0x4ddc2b){_0x4ddc2b(null,util[_0xa9f5('0x1b')](_0xa9f5('0x1c'),_0xa9f5('0x1d'),path[_0xa9f5('0x1e')](_0x4ed672[_0xa9f5('0x1f')])));}})});router[_0xa9f5('0x20')](_0xa9f5('0xd'),upload[_0xa9f5('0x21')](_0xa9f5('0x22')),controller[_0xa9f5('0x23')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x28fbe8,_0x3c927b,_0xe2dac7){_0xe2dac7(null,path[_0xa9f5('0x18')](config['root'],_0xa9f5('0x1a')));},'filename':function(_0x3aef44,_0x4a07b5,_0x2acb05){_0x2acb05(null,util[_0xa9f5('0x1b')](_0xa9f5('0x1c'),_0xa9f5('0x24'),path[_0xa9f5('0x1e')](_0x4a07b5[_0xa9f5('0x1f')])));}})});router[_0xa9f5('0x20')](_0xa9f5('0xf'),upload['single']('file'),controller[_0xa9f5('0x25')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x3171a3,_0x2d81d8,_0x3f5f88){_0x3f5f88(null,path[_0xa9f5('0x18')](config['root'],_0xa9f5('0x1a')));},'filename':function(_0x46724d,_0x19e555,_0x58af05){_0x58af05(null,util[_0xa9f5('0x1b')]('%s%s',_0xa9f5('0x26'),path['extname'](_0x19e555['originalname'])));}})});router[_0xa9f5('0x20')](_0xa9f5('0x13'),upload['single']('file'),controller[_0xa9f5('0x27')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x2c7dba,_0xe79df1,_0x175625){_0x175625(null,path[_0xa9f5('0x18')](config['root'],_0xa9f5('0x1a')));},'filename':function(_0x165859,_0x17c451,_0xbf650a){_0xbf650a(null,util[_0xa9f5('0x1b')](_0xa9f5('0x1c'),'favicon',path[_0xa9f5('0x1e')](_0x17c451['originalname'])));}})});router[_0xa9f5('0x20')](_0xa9f5('0x15'),upload['single'](_0xa9f5('0x22')),controller['addFavicon']);router[_0xa9f5('0x28')]('/:id',auth[_0xa9f5('0x9')](),controller[_0xa9f5('0x29')]);module[_0xa9f5('0x2a')]=router; \ No newline at end of file +var _0x4fac=['index','get','getDate','show','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','/:id/logo','single','file','addLogo','join','logologin','post','/:id/logo_login','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./setting.controller'];(function(_0x3533c0,_0x4122af){var _0x567538=function(_0x1ceeab){while(--_0x1ceeab){_0x3533c0['push'](_0x3533c0['shift']());}};_0x567538(++_0x4122af);}(_0x4fac,0xf5));var _0xc4fa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4fac[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc4fa('0x0'));var util=require(_0xc4fa('0x1'));var path=require('path');var timeout=require(_0xc4fa('0x2'));var express=require(_0xc4fa('0x3'));var router=express[_0xc4fa('0x4')]();var auth=require(_0xc4fa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc4fa('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc4fa('0x7')]);router[_0xc4fa('0x8')]('/now',controller[_0xc4fa('0x9')]);router[_0xc4fa('0x8')]('/:id',controller[_0xc4fa('0xa')]);router['get']('/:id/logo',controller[_0xc4fa('0xb')]);router[_0xc4fa('0x8')]('/:id/logo_login',controller[_0xc4fa('0xc')]);router[_0xc4fa('0x8')](_0xc4fa('0xd'),controller[_0xc4fa('0xe')]);router['get'](_0xc4fa('0xf'),controller[_0xc4fa('0x10')]);router[_0xc4fa('0x8')](_0xc4fa('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc4fa('0x12')]({'destination':function(_0x306681,_0x308bbd,_0x46e99f){_0x46e99f(null,path['join'](config[_0xc4fa('0x13')],_0xc4fa('0x14')));},'filename':function(_0x2e44da,_0x1649ce,_0x8fc1f){_0x8fc1f(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x17'),path[_0xc4fa('0x18')](_0x1649ce[_0xc4fa('0x19')])));}})});router['post'](_0xc4fa('0x1a'),upload[_0xc4fa('0x1b')](_0xc4fa('0x1c')),controller[_0xc4fa('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ece97,_0x5ea7fc,_0x2f8e6f){_0x2f8e6f(null,path[_0xc4fa('0x1e')](config['root'],_0xc4fa('0x14')));},'filename':function(_0x4fb01d,_0x558365,_0xba3e77){_0xba3e77(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x1f'),path['extname'](_0x558365[_0xc4fa('0x19')])));}})});router[_0xc4fa('0x20')](_0xc4fa('0x21'),upload['single'](_0xc4fa('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3288c2,_0x3a6825,_0x5a93b7){_0x5a93b7(null,path[_0xc4fa('0x1e')](config[_0xc4fa('0x13')],'server/files/images/logos/'));},'filename':function(_0x5cd76b,_0x39c6c6,_0x51c346){_0x51c346(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x22'),path[_0xc4fa('0x18')](_0x39c6c6[_0xc4fa('0x19')])));}})});router['post'](_0xc4fa('0xf'),upload[_0xc4fa('0x1b')]('file'),controller[_0xc4fa('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a3097,_0xb883e9,_0x9db5d2){_0x9db5d2(null,path[_0xc4fa('0x1e')](config[_0xc4fa('0x13')],_0xc4fa('0x14')));},'filename':function(_0x5e4496,_0x3b8be0,_0x206d65){_0x206d65(null,util[_0xc4fa('0x15')](_0xc4fa('0x16'),_0xc4fa('0x24'),path[_0xc4fa('0x18')](_0x3b8be0[_0xc4fa('0x19')])));}})});router[_0xc4fa('0x20')](_0xc4fa('0x11'),upload['single'](_0xc4fa('0x1c')),controller[_0xc4fa('0x25')]);router[_0xc4fa('0x26')]('/:id',auth[_0xc4fa('0x27')](),controller[_0xc4fa('0x28')]);module[_0xc4fa('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7188573..930fe10 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 _0x5292=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','min_internal','min_mailbox','INTEGER','STRING'];(function(_0x2983e3,_0x1b1fdb){var _0x569feb=function(_0x1896ab){while(--_0x1896ab){_0x2983e3['push'](_0x2983e3['shift']());}};_0x569feb(++_0x1b1fdb);}(_0x5292,0xb9));var _0x2529=function(_0x58422c,_0x55903e){_0x58422c=_0x58422c-0x0;var _0x4f4554=_0x5292[_0x58422c];return _0x4f4554;};'use strict';var Sequelize=require('sequelize');module[_0x2529('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2529('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2529('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2529('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2529('0x4')],'defaultValue':_0x2529('0x5')},'logo':{'type':Sequelize[_0x2529('0x4')]},'defaultLogo':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2529('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2529('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2529('0x4')]},'turnaddr':{'type':Sequelize[_0x2529('0x4')]},'turnusername':{'type':Sequelize[_0x2529('0x4')]},'turnpassword':{'type':Sequelize[_0x2529('0x4')]},'pageTitle':{'type':Sequelize[_0x2529('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2529('0x4')],'defaultValue':_0x2529('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2529('0x4')],'defaultValue':_0x2529('0x8')},'chatTimeout':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2529('0x4')]},'defaultPreferred':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2529('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2529('0x4')]},'defaultFavicon':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2529('0x3')]},'transcribeRegion':{'type':Sequelize[_0x2529('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x2529('0x3')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2529('0x4')]},'bucket':{'type':Sequelize[_0x2529('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2529('0x3')](0x2)[_0x2529('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc95c=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x1adca0,_0x28434c){var _0x41200b=function(_0xc1a044){while(--_0xc1a044){_0x1adca0['push'](_0x1adca0['shift']());}};_0x41200b(++_0x28434c);}(_0xc95c,0x1bb));var _0xcc95=function(_0x33ee94,_0x1663a3){_0x33ee94=_0x33ee94-0x0;var _0xd269a0=_0xc95c[_0x33ee94];return _0xd269a0;};'use strict';var Sequelize=require(_0xcc95('0x0'));module[_0xcc95('0x1')]={'min_internal':{'type':Sequelize[_0xcc95('0x2')](0xb),'unique':_0xcc95('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xcc95('0x2')](0xb),'unique':_0xcc95('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xcc95('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xcc95('0x5')],'defaultValue':_0xcc95('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xcc95('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcc95('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xcc95('0x5')]},'turnaddr':{'type':Sequelize[_0xcc95('0x5')]},'turnusername':{'type':Sequelize[_0xcc95('0x5')]},'turnpassword':{'type':Sequelize[_0xcc95('0x5')]},'pageTitle':{'type':Sequelize[_0xcc95('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xcc95('0x5')],'defaultValue':_0xcc95('0x8')},'enableEmailPreview':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xcc95('0x9')},'chatTimeout':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xcc95('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xcc95('0x5')]},'defaultFavicon':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xcc95('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xcc95('0x2')]},'transcribeRegion':{'type':Sequelize[_0xcc95('0x5')]},'sentiment':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xcc95('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcc95('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xcc95('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xcc95('0x2')](0x2)[_0xcc95('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 09adec2..43c96fb 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 _0xbe13=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','end','status','json','count','offset','apply','reject','save','update','destroy','sendStatus','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','length','find','body','params','addLogo','file','logo','filename','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','defaultLoginLogo','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','default','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x472fbc,_0x441a89){var _0x27a335=function(_0x675cd7){while(--_0x675cd7){_0x472fbc['push'](_0x472fbc['shift']());}};_0x27a335(++_0x441a89);}(_0xbe13,0x69));var _0x3be1=function(_0x3d6f4f,_0x3a3f5f){_0x3d6f4f=_0x3d6f4f-0x0;var _0x560887=_0xbe13[_0x3d6f4f];return _0x560887;};'use strict';var pdf=require(_0x3be1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3be1('0x1'));var zipdir=require(_0x3be1('0x2'));var jsonpatch=require(_0x3be1('0x3'));var rp=require(_0x3be1('0x4'));var moment=require(_0x3be1('0x5'));var BPromise=require(_0x3be1('0x6'));var Mustache=require(_0x3be1('0x7'));var util=require(_0x3be1('0x8'));var path=require(_0x3be1('0x9'));var sox=require(_0x3be1('0xa'));var csv=require(_0x3be1('0xb'));var ejs=require(_0x3be1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3be1('0xd'));var jsforce=require(_0x3be1('0xe'));var deskjs=require(_0x3be1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3be1('0x10'));var Papa=require(_0x3be1('0x11'));var Redis=require(_0x3be1('0x12'));var authService=require(_0x3be1('0x13'));var qs=require(_0x3be1('0x14'));var as=require(_0x3be1('0x15'));var hardwareService=require(_0x3be1('0x16'));var logger=require('../../config/logger')(_0x3be1('0x17'));var utils=require('../../config/utils');var config=require(_0x3be1('0x18'));var licenseUtil=require(_0x3be1('0x19'));var db=require(_0x3be1('0x1a'))['db'];var jayson=require(_0x3be1('0x1b'));var client=jayson[_0x3be1('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1682fa,_0x193072,_0x48ac24,_0x139a86){return new BPromise(function(_0x22bc4b,_0x20cbeb){var _0x11978d=_0x139a86||client;return _0x11978d[_0x3be1('0x1d')](_0x1682fa,_0x48ac24)[_0x3be1('0x1e')](function(_0x3607fc){logger[_0x3be1('0x1f')](_0x3be1('0x20'),_0x193072,'request\x20sent');logger[_0x3be1('0x21')](_0x3be1('0x22'),_0x193072,'request\x20sent',JSON['stringify'](_0x3607fc));if(_0x3607fc[_0x3be1('0x23')]){if(_0x3607fc['error']['code']===0x1f4){logger['error'](_0x3be1('0x20'),_0x193072,_0x3607fc['error'][_0x3be1('0x24')]);return _0x20cbeb(_0x3607fc[_0x3be1('0x23')][_0x3be1('0x24')]);}logger['error'](_0x3be1('0x20'),_0x193072,_0x3607fc[_0x3be1('0x23')][_0x3be1('0x24')]);return _0x22bc4b(_0x3607fc[_0x3be1('0x23')]['message']);}else{logger[_0x3be1('0x1f')](_0x3be1('0x20'),_0x193072,_0x3be1('0x25'));_0x22bc4b(_0x3607fc[_0x3be1('0x26')][_0x3be1('0x24')]);}})[_0x3be1('0x27')](function(_0x2b6f14){logger[_0x3be1('0x23')](_0x3be1('0x20'),_0x193072,_0x2b6f14);_0x20cbeb(_0x2b6f14);});});}function respondWithStatusCode(_0x123359,_0x205b79){_0x205b79=_0x205b79||0xcc;return function(_0x2b37fa){if(_0x2b37fa){return _0x123359['sendStatus'](_0x205b79);}return _0x123359['status'](_0x205b79)[_0x3be1('0x28')]();};}function respondWithResult(_0x2bc052,_0x151d0a){_0x151d0a=_0x151d0a||0xc8;return function(_0x373706){if(_0x373706){return _0x2bc052[_0x3be1('0x29')](_0x151d0a)[_0x3be1('0x2a')](_0x373706);}};}function respondWithFilteredResult(_0x261d9c,_0x5b54a6){return function(_0x1cadb9){if(_0x1cadb9){var _0x49f0f3=_0x1cadb9[_0x3be1('0x2b')],_0x15cf75=_0x5b54a6[_0x3be1('0x2c')],_0x59f1ae=_0x5b54a6[_0x3be1('0x2c')]+_0x5b54a6['limit'],_0x5a8a20;if(_0x59f1ae>=_0x49f0f3){_0x59f1ae=_0x49f0f3;_0x5a8a20=0xc8;}else{_0x5a8a20=0xce;}_0x261d9c['status'](_0x5a8a20);return _0x261d9c['set']('Content-Range',_0x15cf75+'-'+_0x59f1ae+'/'+_0x49f0f3)['json'](_0x1cadb9);}return null;};}function patchUpdates(_0x271013){return function(_0x1776ab){try{jsonpatch[_0x3be1('0x2d')](_0x1776ab,_0x271013,!![]);}catch(_0x33db12){return BPromise[_0x3be1('0x2e')](_0x33db12);}return _0x1776ab[_0x3be1('0x2f')]();};}function saveUpdates(_0x5c2b91,_0xf024ca){return function(_0x178866){if(_0x178866){return _0x178866[_0x3be1('0x30')](_0x5c2b91)[_0x3be1('0x1e')](function(_0x18abe2){return _0x18abe2;});}return null;};}function removeEntity(_0x4d7419,_0x565c17){return function(_0x2f7fa0){if(_0x2f7fa0){return _0x2f7fa0[_0x3be1('0x31')]()['then'](function(){_0x4d7419['status'](0xcc)[_0x3be1('0x28')]();});}};}function handleEntityNotFound(_0x48d711,_0x2ea5e2){return function(_0x207f91){if(!_0x207f91){_0x48d711[_0x3be1('0x32')](0x194);}return _0x207f91;};}function handleError(_0x6c11ea,_0x5ed3d1){_0x5ed3d1=_0x5ed3d1||0x1f4;return function(_0x2c6995){logger[_0x3be1('0x23')](_0x2c6995[_0x3be1('0x33')]);if(_0x2c6995[_0x3be1('0x34')]){delete _0x2c6995['name'];}_0x6c11ea[_0x3be1('0x29')](_0x5ed3d1)['send'](_0x2c6995);};}exports['index']=function(_0xc56aab,_0x297e7a){var _0x17e232={},_0xe4d2f8={},_0x13aece={'count':0x0,'rows':[]};var _0x5368c1=_[_0x3be1('0x35')](db[_0x3be1('0x36')][_0x3be1('0x37')],function(_0x44797e){return{'name':_0x44797e[_0x3be1('0x38')],'type':_0x44797e[_0x3be1('0x39')][_0x3be1('0x3a')]};});_0xe4d2f8[_0x3be1('0x3b')]=_[_0x3be1('0x35')](_0x5368c1,'name');_0xe4d2f8[_0x3be1('0x3c')]=_[_0x3be1('0x3d')](_0xc56aab[_0x3be1('0x3c')]);_0xe4d2f8[_0x3be1('0x3e')]=_[_0x3be1('0x3f')](_0xe4d2f8['model'],_0xe4d2f8[_0x3be1('0x3c')]);_0x17e232['attributes']=_[_0x3be1('0x3f')](_0xe4d2f8[_0x3be1('0x3b')],qs[_0x3be1('0x40')](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x40')]));_0x17e232['attributes']=_0x17e232[_0x3be1('0x41')]['length']?_0x17e232[_0x3be1('0x41')]:_0xe4d2f8[_0x3be1('0x3b')];if(!_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x42')](_0x3be1('0x43'))){_0x17e232[_0x3be1('0x44')]=qs[_0x3be1('0x44')](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x44')]);_0x17e232[_0x3be1('0x2c')]=qs['offset'](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x2c')]);}_0x17e232['order']=qs[_0x3be1('0x45')](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x45')]);_0x17e232[_0x3be1('0x46')]=qs[_0x3be1('0x3e')](_[_0x3be1('0x47')](_0xc56aab[_0x3be1('0x3c')],_0xe4d2f8['filters']),_0x5368c1);if(_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x48')]){_0x17e232[_0x3be1('0x46')]=_[_0x3be1('0x49')](_0x17e232[_0x3be1('0x46')],{'$or':_[_0x3be1('0x35')](_0x5368c1,function(_0x1646bc){if(_0x1646bc[_0x3be1('0x39')]!==_0x3be1('0x4a')){var _0x1abef1={};_0x1abef1[_0x1646bc[_0x3be1('0x34')]]={'$like':'%'+_0xc56aab[_0x3be1('0x3c')]['filter']+'%'};return _0x1abef1;}})});}_0x17e232=_[_0x3be1('0x49')]({},_0x17e232,_0xc56aab[_0x3be1('0x4b')]);var _0xf2a054={'where':_0x17e232[_0x3be1('0x46')]};return db[_0x3be1('0x36')]['count'](_0xf2a054)['then'](function(_0x43449d){_0x13aece[_0x3be1('0x2b')]=_0x43449d;if(_0xc56aab['query'][_0x3be1('0x4c')]){_0x17e232[_0x3be1('0x4d')]=[{'all':!![]}];}return db[_0x3be1('0x36')]['findAll'](_0x17e232);})[_0x3be1('0x1e')](function(_0x2cbfee){_0x13aece[_0x3be1('0x4e')]=_0x2cbfee;return _0x13aece;})[_0x3be1('0x1e')](respondWithFilteredResult(_0x297e7a,_0x17e232))[_0x3be1('0x27')](handleError(_0x297e7a,null));};exports[_0x3be1('0x4f')]=function(_0x150c11,_0x538491){var _0x16e04b={'raw':![],'where':{'id':_0x150c11['params']['id']}},_0x4c3e03={};_0x4c3e03['model']=_[_0x3be1('0x3d')](db[_0x3be1('0x36')][_0x3be1('0x37')]);_0x4c3e03[_0x3be1('0x3c')]=_[_0x3be1('0x3d')](_0x150c11[_0x3be1('0x3c')]);_0x4c3e03[_0x3be1('0x3e')]=_['intersection'](_0x4c3e03['model'],_0x4c3e03[_0x3be1('0x3c')]);_0x16e04b[_0x3be1('0x41')]=_['intersection'](_0x4c3e03['model'],qs['fields'](_0x150c11[_0x3be1('0x3c')]['fields']));_0x16e04b[_0x3be1('0x41')]=_0x16e04b[_0x3be1('0x41')][_0x3be1('0x50')]?_0x16e04b[_0x3be1('0x41')]:_0x4c3e03['model'];if(_0x150c11[_0x3be1('0x3c')][_0x3be1('0x4c')]){_0x16e04b[_0x3be1('0x4d')]=[{'all':!![]}];}_0x16e04b=_[_0x3be1('0x49')]({},_0x16e04b,_0x150c11['options']);return db[_0x3be1('0x36')][_0x3be1('0x51')](_0x16e04b)[_0x3be1('0x1e')](handleEntityNotFound(_0x538491,null))[_0x3be1('0x1e')](respondWithResult(_0x538491,null))['catch'](handleError(_0x538491,null));};exports[_0x3be1('0x30')]=function(_0x27e2bf,_0x543168){if(_0x27e2bf[_0x3be1('0x52')]['id']){delete _0x27e2bf[_0x3be1('0x52')]['id'];}return db['Setting'][_0x3be1('0x51')]({'where':{'id':_0x27e2bf[_0x3be1('0x53')]['id']}})[_0x3be1('0x1e')](handleEntityNotFound(_0x543168,null))['then'](saveUpdates(_0x27e2bf[_0x3be1('0x52')],null))[_0x3be1('0x1e')](respondWithResult(_0x543168,null))[_0x3be1('0x27')](handleError(_0x543168,null));};exports[_0x3be1('0x54')]=function(_0x472160,_0x5796b3,_0x46f3f8){if(_0x472160['file']&&_0x472160[_0x3be1('0x55')]['filename']){_0x472160[_0x3be1('0x52')][_0x3be1('0x56')]=_0x472160['file'][_0x3be1('0x57')];}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x472160['params']['id']}})['then'](handleEntityNotFound(_0x5796b3,null))[_0x3be1('0x1e')](saveUpdates(_0x472160['body'],null))[_0x3be1('0x1e')](respondWithResult(_0x5796b3,null))[_0x3be1('0x27')](handleError(_0x5796b3,null));};exports[_0x3be1('0x58')]=function(_0x5ef1dc,_0x3736f8,_0x3e9301){if(_0x5ef1dc['file']&&_0x5ef1dc[_0x3be1('0x55')][_0x3be1('0x57')]){_0x5ef1dc['body'][_0x3be1('0x59')]=_0x5ef1dc[_0x3be1('0x55')][_0x3be1('0x57')];}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x5ef1dc[_0x3be1('0x53')]['id']}})[_0x3be1('0x1e')](handleEntityNotFound(_0x3736f8,null))['then'](saveUpdates(_0x5ef1dc[_0x3be1('0x52')],null))[_0x3be1('0x1e')](respondWithResult(_0x3736f8,null))['catch'](handleError(_0x3736f8,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x5d7b0c,_0x5956ba,_0x56861a){var _0x4efee2=_0x3be1('0x5a');var _0x49d760={'custom':![]};return utilLicense[_0x3be1('0x5b')]()[_0x3be1('0x1e')](function(_0xe9e1d0){if(_0xe9e1d0){_0x49d760=_0xe9e1d0;}return db['Setting']['find']({'where':{'id':_0x5d7b0c['params']['id']},'attributes':[_0x3be1('0x56'),_0x3be1('0x59'),_0x3be1('0x5c'),'favicon',_0x3be1('0x5d'),'defaultLoginLogo',_0x3be1('0x5e'),_0x3be1('0x5f')],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x5956ba,null))[_0x3be1('0x1e')](function(_0x24550c){if(_0x24550c){var _0x2aae3d=_0x24550c[_0x3be1('0x56')]&&fs[_0x3be1('0x60')](path[_0x3be1('0x61')](config['root'],_0x4efee2,_['toLower'](_0x24550c[_0x3be1('0x56')])))?path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x4efee2,_[_0x3be1('0x63')](_0x24550c[_0x3be1('0x56')])):path['join'](config[_0x3be1('0x62')],_0x4efee2,_[_0x3be1('0x63')](_0x3be1('0x64')));var _0x185c9f='default'+_[_0x3be1('0x65')](_0x3be1('0x56'));if(_0x24550c[_0x185c9f]||!_0x49d760['custom']){_0x2aae3d=path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x4efee2,_[_0x3be1('0x63')](_0x3be1('0x64')));}if(!fs[_0x3be1('0x60')](_0x2aae3d)){throw new db[(_0x3be1('0x66'))][(_0x3be1('0x67'))](_['upperFirst'](_0x3be1('0x56'))+_0x3be1('0x68'));}return _0x5956ba[_0x3be1('0x69')](_0x2aae3d);}})[_0x3be1('0x27')](handleError(_0x5956ba,null));};var utilLicense=require(_0x3be1('0x19'));exports[_0x3be1('0x6a')]=function(_0x295598,_0x40c717,_0x388f28){var _0x358ab6=_0x3be1('0x5a');var _0x413d3f={'custom':![]};return utilLicense[_0x3be1('0x5b')]()['then'](function(_0x1babf2){if(_0x1babf2){_0x413d3f=_0x1babf2;}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x295598[_0x3be1('0x53')]['id']},'attributes':[_0x3be1('0x56'),_0x3be1('0x59'),_0x3be1('0x5c'),_0x3be1('0x6b'),'defaultLogo',_0x3be1('0x6c'),_0x3be1('0x5e'),_0x3be1('0x5f')],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x40c717,null))[_0x3be1('0x1e')](function(_0x310e87){if(_0x310e87){var _0x1dfdd8=_0x310e87[_0x3be1('0x59')]&&fs['existsSync'](path[_0x3be1('0x61')](config['root'],_0x358ab6,_[_0x3be1('0x63')](_0x310e87[_0x3be1('0x59')])))?path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x358ab6,_[_0x3be1('0x63')](_0x310e87[_0x3be1('0x59')])):path[_0x3be1('0x61')](config['root'],_0x358ab6,_[_0x3be1('0x63')](_0x3be1('0x6d')));var _0x5391c4='default'+_[_0x3be1('0x65')]('loginLogo');if(_0x310e87[_0x5391c4]||!_0x413d3f[_0x3be1('0x6e')]){_0x1dfdd8=path['join'](config[_0x3be1('0x62')],_0x358ab6,_[_0x3be1('0x63')](_0x3be1('0x6d')));}if(!fs[_0x3be1('0x60')](_0x1dfdd8)){throw new db[(_0x3be1('0x66'))]['ValidationError'](_[_0x3be1('0x65')]('loginLogo')+_0x3be1('0x68'));}return _0x40c717[_0x3be1('0x69')](_0x1dfdd8);}})['catch'](handleError(_0x40c717,null));};exports[_0x3be1('0x6f')]=function(_0x579a7a,_0x401f9b){return db[_0x3be1('0x36')]['find']({'where':{'id':_0x579a7a[_0x3be1('0x53')]['id']},'attributes':[_0x3be1('0x70')]})['then'](respondWithResult(_0x401f9b,null))[_0x3be1('0x27')](handleError(_0x401f9b,null));};exports[_0x3be1('0x71')]=function(_0x3f8dae,_0x11ef6e,_0x44d5e0){if(_0x3f8dae[_0x3be1('0x55')]&&_0x3f8dae['file'][_0x3be1('0x57')]){_0x3f8dae[_0x3be1('0x52')][_0x3be1('0x5c')]=_0x3f8dae[_0x3be1('0x55')][_0x3be1('0x57')];}return db[_0x3be1('0x36')]['find']({'where':{'id':_0x3f8dae[_0x3be1('0x53')]['id']}})[_0x3be1('0x1e')](handleEntityNotFound(_0x11ef6e,null))[_0x3be1('0x1e')](saveUpdates(_0x3f8dae[_0x3be1('0x52')],null))[_0x3be1('0x1e')](respondWithResult(_0x11ef6e,null))['catch'](handleError(_0x11ef6e,null));};var utilLicense=require(_0x3be1('0x19'));exports[_0x3be1('0x72')]=function(_0x369f89,_0x568dfa,_0x33d9dc){var _0x32bd9a='server/files/images/logos';var _0x59c729={'custom':![]};return utilLicense[_0x3be1('0x5b')]()[_0x3be1('0x1e')](function(_0x378c42){if(_0x378c42){_0x59c729=_0x378c42;}return db[_0x3be1('0x36')]['find']({'where':{'id':_0x369f89[_0x3be1('0x53')]['id']},'attributes':[_0x3be1('0x56'),'loginLogo',_0x3be1('0x5c'),_0x3be1('0x6b'),'defaultLogo',_0x3be1('0x6c'),_0x3be1('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x568dfa,null))['then'](function(_0x558d61){if(_0x558d61){var _0x29d326=_0x558d61['preferred']&&fs[_0x3be1('0x60')](path['join'](config['root'],_0x32bd9a,_['toLower'](_0x558d61[_0x3be1('0x5c')])))?path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x32bd9a,_[_0x3be1('0x63')](_0x558d61[_0x3be1('0x5c')])):path[_0x3be1('0x61')](config['root'],_0x32bd9a,_['toLower'](_0x3be1('0x73')));var _0x5d1077='default'+_[_0x3be1('0x65')](_0x3be1('0x5c'));if(_0x558d61[_0x5d1077]||!_0x59c729[_0x3be1('0x6e')]||!_0x59c729[_0x3be1('0x5c')]){_0x29d326=path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x32bd9a,_[_0x3be1('0x63')]('default_preferred.png'));}if(!fs[_0x3be1('0x60')](_0x29d326)){throw new db[(_0x3be1('0x66'))][(_0x3be1('0x67'))](_[_0x3be1('0x65')](_0x3be1('0x5c'))+_0x3be1('0x68'));}return _0x568dfa[_0x3be1('0x69')](_0x29d326);}})['catch'](handleError(_0x568dfa,null));};exports[_0x3be1('0x74')]=function(_0x14162a,_0x2ec93,_0xff809b){if(_0x14162a[_0x3be1('0x55')]&&_0x14162a[_0x3be1('0x55')][_0x3be1('0x57')]){_0x14162a[_0x3be1('0x52')]['favicon']=_0x14162a[_0x3be1('0x55')][_0x3be1('0x57')];}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x14162a['params']['id']}})['then'](handleEntityNotFound(_0x2ec93,null))['then'](saveUpdates(_0x14162a['body'],null))[_0x3be1('0x1e')](respondWithResult(_0x2ec93,null))[_0x3be1('0x27')](handleError(_0x2ec93,null));};var utilLicense=require(_0x3be1('0x19'));exports['getFavicon']=function(_0x228508,_0x4050d8,_0x5e1d55){var _0x14e798=_0x3be1('0x5a');var _0xf7b63b={'custom':![]};return utilLicense[_0x3be1('0x5b')]()['then'](function(_0x17ebed){if(_0x17ebed){_0xf7b63b=_0x17ebed;}return db['Setting'][_0x3be1('0x51')]({'where':{'id':_0x228508['params']['id']},'attributes':[_0x3be1('0x56'),'loginLogo',_0x3be1('0x5c'),_0x3be1('0x6b'),_0x3be1('0x5d'),'defaultLoginLogo',_0x3be1('0x5e'),_0x3be1('0x5f')],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x4050d8,null))['then'](function(_0x5835c1){if(_0x5835c1){var _0x58bd98=_0x5835c1[_0x3be1('0x6b')]&&fs[_0x3be1('0x60')](path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x14e798,_[_0x3be1('0x63')](_0x5835c1[_0x3be1('0x6b')])))?path['join'](config[_0x3be1('0x62')],_0x14e798,_[_0x3be1('0x63')](_0x5835c1[_0x3be1('0x6b')])):path['join'](config['root'],_0x14e798,_[_0x3be1('0x63')](_0x3be1('0x75')));var _0x5128be=_0x3be1('0x76')+_[_0x3be1('0x65')]('favicon');if(_0x5835c1[_0x5128be]||!_0xf7b63b[_0x3be1('0x6e')]){_0x58bd98=path[_0x3be1('0x61')](config['root'],_0x14e798,_[_0x3be1('0x63')]('default_favicon.ico'));}if(!fs[_0x3be1('0x60')](_0x58bd98)){throw new db[(_0x3be1('0x66'))]['ValidationError'](_[_0x3be1('0x65')]('favicon')+'\x20not\x20found');}return _0x4050d8[_0x3be1('0x69')](_0x58bd98);}})[_0x3be1('0x27')](handleError(_0x4050d8,null));};exports[_0x3be1('0x77')]=function(_0x29fe16,_0x1a02b7){var _0x1b8cc1={'offset':moment()[_0x3be1('0x78')]()};_0x1b8cc1[_0x3be1('0x79')]=moment()['utcOffset'](_0x1b8cc1[_0x3be1('0x2c')])[_0x3be1('0x7a')](_0x3be1('0x7b'));return _0x1a02b7[_0x3be1('0x29')](0xc8)['send'](_0x1b8cc1);}; \ No newline at end of file +var _0x2215=['getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','count','limit','status','set','Content-Range','reject','save','update','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','attributes','intersection','length','nolimit','offset','order','sort','filters','where','merge','includeAll','include','findAll','rows','show','params','rawAttributes','fields','options','find','body','file','filename','logo','loginLogo','getLogo','preferred','defaultLogo','defaultPreferred','existsSync','join','root','toLower','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','server/files/images/logos','getLicense','defaultLoginLogo','defaultFavicon','default_loginLogo.svg','download','gdpr','securePassword','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon'];(function(_0x57fd18,_0x49ef9d){var _0x3c5930=function(_0x135268){while(--_0x135268){_0x57fd18['push'](_0x57fd18['shift']());}};_0x3c5930(++_0x49ef9d);}(_0x2215,0xf9));var _0x5221=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2215[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5221('0x0'));var rimraf=require(_0x5221('0x1'));var zipdir=require(_0x5221('0x2'));var jsonpatch=require(_0x5221('0x3'));var rp=require('request-promise');var moment=require(_0x5221('0x4'));var BPromise=require(_0x5221('0x5'));var Mustache=require(_0x5221('0x6'));var util=require(_0x5221('0x7'));var path=require(_0x5221('0x8'));var sox=require(_0x5221('0x9'));var csv=require(_0x5221('0xa'));var ejs=require(_0x5221('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5221('0xc'));var crypto=require(_0x5221('0xd'));var jsforce=require(_0x5221('0xe'));var deskjs=require(_0x5221('0xf'));var toCsv=require(_0x5221('0xa'));var querystring=require(_0x5221('0x10'));var Papa=require(_0x5221('0x11'));var Redis=require(_0x5221('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5221('0x13'));var as=require(_0x5221('0x14'));var hardwareService=require(_0x5221('0x15'));var logger=require(_0x5221('0x16'))(_0x5221('0x17'));var utils=require(_0x5221('0x18'));var config=require(_0x5221('0x19'));var licenseUtil=require(_0x5221('0x1a'));var db=require(_0x5221('0x1b'))['db'];var jayson=require(_0x5221('0x1c'));var client=jayson[_0x5221('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417c87,_0x269b7b,_0x1e250c,_0x36662a){return new BPromise(function(_0x1f02eb,_0x3814e0){var _0x53fe10=_0x36662a||client;return _0x53fe10[_0x5221('0x1e')](_0x417c87,_0x1e250c)[_0x5221('0x1f')](function(_0x1d8e7c){logger[_0x5221('0x20')](_0x5221('0x21'),_0x269b7b,_0x5221('0x22'));logger[_0x5221('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x269b7b,_0x5221('0x22'),JSON[_0x5221('0x24')](_0x1d8e7c));if(_0x1d8e7c[_0x5221('0x25')]){if(_0x1d8e7c[_0x5221('0x25')][_0x5221('0x26')]===0x1f4){logger[_0x5221('0x25')]('Setting,\x20%s,\x20%s',_0x269b7b,_0x1d8e7c[_0x5221('0x25')][_0x5221('0x27')]);return _0x3814e0(_0x1d8e7c[_0x5221('0x25')][_0x5221('0x27')]);}logger[_0x5221('0x25')](_0x5221('0x21'),_0x269b7b,_0x1d8e7c[_0x5221('0x25')][_0x5221('0x27')]);return _0x1f02eb(_0x1d8e7c[_0x5221('0x25')]['message']);}else{logger[_0x5221('0x20')](_0x5221('0x21'),_0x269b7b,_0x5221('0x22'));_0x1f02eb(_0x1d8e7c[_0x5221('0x28')][_0x5221('0x27')]);}})[_0x5221('0x29')](function(_0x5a9057){logger[_0x5221('0x25')](_0x5221('0x21'),_0x269b7b,_0x5a9057);_0x3814e0(_0x5a9057);});});}function respondWithStatusCode(_0x21d164,_0x49f57c){_0x49f57c=_0x49f57c||0xcc;return function(_0x586e65){if(_0x586e65){return _0x21d164['sendStatus'](_0x49f57c);}return _0x21d164['status'](_0x49f57c)[_0x5221('0x2a')]();};}function respondWithResult(_0x14a573,_0x53a133){_0x53a133=_0x53a133||0xc8;return function(_0x1f1896){if(_0x1f1896){return _0x14a573['status'](_0x53a133)[_0x5221('0x2b')](_0x1f1896);}};}function respondWithFilteredResult(_0x67ae35,_0x508bdc){return function(_0x6f769f){if(_0x6f769f){var _0x2b3841=_0x6f769f[_0x5221('0x2c')],_0x587318=_0x508bdc['offset'],_0x41509d=_0x508bdc['offset']+_0x508bdc[_0x5221('0x2d')],_0x932665;if(_0x41509d>=_0x2b3841){_0x41509d=_0x2b3841;_0x932665=0xc8;}else{_0x932665=0xce;}_0x67ae35[_0x5221('0x2e')](_0x932665);return _0x67ae35[_0x5221('0x2f')](_0x5221('0x30'),_0x587318+'-'+_0x41509d+'/'+_0x2b3841)[_0x5221('0x2b')](_0x6f769f);}return null;};}function patchUpdates(_0x53007e){return function(_0x2a913a){try{jsonpatch['apply'](_0x2a913a,_0x53007e,!![]);}catch(_0x580092){return BPromise[_0x5221('0x31')](_0x580092);}return _0x2a913a[_0x5221('0x32')]();};}function saveUpdates(_0xbf790c,_0x59923f){return function(_0x52ea04){if(_0x52ea04){return _0x52ea04[_0x5221('0x33')](_0xbf790c)['then'](function(_0x26abb6){return _0x26abb6;});}return null;};}function removeEntity(_0x4f01a3,_0x3da148){return function(_0x60b341){if(_0x60b341){return _0x60b341[_0x5221('0x34')]()[_0x5221('0x1f')](function(){_0x4f01a3[_0x5221('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7692,_0x81ca04){return function(_0x215ef2){if(!_0x215ef2){_0x2b7692['sendStatus'](0x194);}return _0x215ef2;};}function handleError(_0x3dfe04,_0xef6224){_0xef6224=_0xef6224||0x1f4;return function(_0x57ca4f){logger[_0x5221('0x25')](_0x57ca4f[_0x5221('0x35')]);if(_0x57ca4f[_0x5221('0x36')]){delete _0x57ca4f[_0x5221('0x36')];}_0x3dfe04[_0x5221('0x2e')](_0xef6224)['send'](_0x57ca4f);};}exports[_0x5221('0x37')]=function(_0x519472,_0x50b2d4){var _0x464332={},_0x269c3e={},_0x5e7ae1={'count':0x0,'rows':[]};var _0x373f7d=_[_0x5221('0x38')](db[_0x5221('0x39')]['rawAttributes'],function(_0x7a3cef){return{'name':_0x7a3cef[_0x5221('0x3a')],'type':_0x7a3cef[_0x5221('0x3b')][_0x5221('0x3c')]};});_0x269c3e[_0x5221('0x3d')]=_[_0x5221('0x38')](_0x373f7d,_0x5221('0x36'));_0x269c3e[_0x5221('0x3e')]=_[_0x5221('0x3f')](_0x519472[_0x5221('0x3e')]);_0x269c3e['filters']=_['intersection'](_0x269c3e[_0x5221('0x3d')],_0x269c3e[_0x5221('0x3e')]);_0x464332[_0x5221('0x40')]=_[_0x5221('0x41')](_0x269c3e[_0x5221('0x3d')],qs['fields'](_0x519472[_0x5221('0x3e')]['fields']));_0x464332[_0x5221('0x40')]=_0x464332['attributes'][_0x5221('0x42')]?_0x464332[_0x5221('0x40')]:_0x269c3e[_0x5221('0x3d')];if(!_0x519472[_0x5221('0x3e')]['hasOwnProperty'](_0x5221('0x43'))){_0x464332[_0x5221('0x2d')]=qs['limit'](_0x519472['query'][_0x5221('0x2d')]);_0x464332['offset']=qs[_0x5221('0x44')](_0x519472['query']['offset']);}_0x464332[_0x5221('0x45')]=qs['sort'](_0x519472[_0x5221('0x3e')][_0x5221('0x46')]);_0x464332['where']=qs[_0x5221('0x47')](_['pick'](_0x519472[_0x5221('0x3e')],_0x269c3e['filters']),_0x373f7d);if(_0x519472['query']['filter']){_0x464332[_0x5221('0x48')]=_[_0x5221('0x49')](_0x464332[_0x5221('0x48')],{'$or':_[_0x5221('0x38')](_0x373f7d,function(_0x350e1f){if(_0x350e1f['type']!=='VIRTUAL'){var _0x59ad0b={};_0x59ad0b[_0x350e1f[_0x5221('0x36')]]={'$like':'%'+_0x519472[_0x5221('0x3e')]['filter']+'%'};return _0x59ad0b;}})});}_0x464332=_[_0x5221('0x49')]({},_0x464332,_0x519472['options']);var _0xe1e671={'where':_0x464332['where']};return db[_0x5221('0x39')][_0x5221('0x2c')](_0xe1e671)['then'](function(_0x3eeb34){_0x5e7ae1[_0x5221('0x2c')]=_0x3eeb34;if(_0x519472['query'][_0x5221('0x4a')]){_0x464332[_0x5221('0x4b')]=[{'all':!![]}];}return db[_0x5221('0x39')][_0x5221('0x4c')](_0x464332);})[_0x5221('0x1f')](function(_0x4729dc){_0x5e7ae1[_0x5221('0x4d')]=_0x4729dc;return _0x5e7ae1;})[_0x5221('0x1f')](respondWithFilteredResult(_0x50b2d4,_0x464332))['catch'](handleError(_0x50b2d4,null));};exports[_0x5221('0x4e')]=function(_0x36b182,_0x38a28e){var _0x269c73={'raw':![],'where':{'id':_0x36b182[_0x5221('0x4f')]['id']}},_0x268f76={};_0x268f76[_0x5221('0x3d')]=_[_0x5221('0x3f')](db['Setting'][_0x5221('0x50')]);_0x268f76[_0x5221('0x3e')]=_[_0x5221('0x3f')](_0x36b182[_0x5221('0x3e')]);_0x268f76[_0x5221('0x47')]=_[_0x5221('0x41')](_0x268f76['model'],_0x268f76[_0x5221('0x3e')]);_0x269c73[_0x5221('0x40')]=_[_0x5221('0x41')](_0x268f76[_0x5221('0x3d')],qs[_0x5221('0x51')](_0x36b182['query'][_0x5221('0x51')]));_0x269c73[_0x5221('0x40')]=_0x269c73[_0x5221('0x40')][_0x5221('0x42')]?_0x269c73['attributes']:_0x268f76[_0x5221('0x3d')];if(_0x36b182[_0x5221('0x3e')][_0x5221('0x4a')]){_0x269c73[_0x5221('0x4b')]=[{'all':!![]}];}_0x269c73=_[_0x5221('0x49')]({},_0x269c73,_0x36b182[_0x5221('0x52')]);return db[_0x5221('0x39')][_0x5221('0x53')](_0x269c73)[_0x5221('0x1f')](handleEntityNotFound(_0x38a28e,null))[_0x5221('0x1f')](respondWithResult(_0x38a28e,null))[_0x5221('0x29')](handleError(_0x38a28e,null));};exports[_0x5221('0x33')]=function(_0xce1b4b,_0x27dc3a){if(_0xce1b4b[_0x5221('0x54')]['id']){delete _0xce1b4b[_0x5221('0x54')]['id'];}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0xce1b4b[_0x5221('0x4f')]['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x27dc3a,null))[_0x5221('0x1f')](saveUpdates(_0xce1b4b[_0x5221('0x54')],null))[_0x5221('0x1f')](respondWithResult(_0x27dc3a,null))[_0x5221('0x29')](handleError(_0x27dc3a,null));};exports['addLogo']=function(_0x386dcd,_0x279f1b,_0x276eac){if(_0x386dcd[_0x5221('0x55')]&&_0x386dcd[_0x5221('0x55')][_0x5221('0x56')]){_0x386dcd['body'][_0x5221('0x57')]=_0x386dcd[_0x5221('0x55')][_0x5221('0x56')];}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x386dcd['params']['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x279f1b,null))[_0x5221('0x1f')](saveUpdates(_0x386dcd[_0x5221('0x54')],null))[_0x5221('0x1f')](respondWithResult(_0x279f1b,null))[_0x5221('0x29')](handleError(_0x279f1b,null));};exports['addLogoLogin']=function(_0x564277,_0x4bad5b,_0x57f6b5){if(_0x564277[_0x5221('0x55')]&&_0x564277[_0x5221('0x55')][_0x5221('0x56')]){_0x564277[_0x5221('0x54')][_0x5221('0x58')]=_0x564277[_0x5221('0x55')][_0x5221('0x56')];}return db['Setting']['find']({'where':{'id':_0x564277[_0x5221('0x4f')]['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x4bad5b,null))['then'](saveUpdates(_0x564277[_0x5221('0x54')],null))[_0x5221('0x1f')](respondWithResult(_0x4bad5b,null))[_0x5221('0x29')](handleError(_0x4bad5b,null));};var utilLicense=require(_0x5221('0x1a'));exports[_0x5221('0x59')]=function(_0xbf1bc6,_0x5e4db8,_0x21e0ce){var _0x21d384='server/files/images/logos';var _0x4cd5c3={'custom':![]};return utilLicense['getLicense']()[_0x5221('0x1f')](function(_0x3997a7){if(_0x3997a7){_0x4cd5c3=_0x3997a7;}return db['Setting']['find']({'where':{'id':_0xbf1bc6[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x57'),_0x5221('0x58'),_0x5221('0x5a'),'favicon',_0x5221('0x5b'),'defaultLoginLogo',_0x5221('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x5e4db8,null))[_0x5221('0x1f')](function(_0xf2857f){if(_0xf2857f){var _0x4b64b9=_0xf2857f[_0x5221('0x57')]&&fs[_0x5221('0x5d')](path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')](_0xf2857f[_0x5221('0x57')])))?path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')](_0xf2857f[_0x5221('0x57')])):path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')]('default_logo.svg'));var _0x3d8abd=_0x5221('0x61')+_['upperFirst'](_0x5221('0x57'));if(_0xf2857f[_0x3d8abd]||!_0x4cd5c3[_0x5221('0x62')]){_0x4b64b9=path['join'](config[_0x5221('0x5f')],_0x21d384,_[_0x5221('0x60')]('default_logo.svg'));}if(!fs[_0x5221('0x5d')](_0x4b64b9)){throw new db[(_0x5221('0x63'))][(_0x5221('0x64'))](_[_0x5221('0x65')]('logo')+_0x5221('0x66'));}return _0x5e4db8['download'](_0x4b64b9);}})[_0x5221('0x29')](handleError(_0x5e4db8,null));};var utilLicense=require('../../config/license/util');exports[_0x5221('0x67')]=function(_0x378074,_0x1e8d76,_0x4af416){var _0x276121=_0x5221('0x68');var _0x3e575d={'custom':![]};return utilLicense[_0x5221('0x69')]()['then'](function(_0x916a17){if(_0x916a17){_0x3e575d=_0x916a17;}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x378074[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x57'),_0x5221('0x58'),_0x5221('0x5a'),'favicon',_0x5221('0x5b'),_0x5221('0x6a'),_0x5221('0x5c'),_0x5221('0x6b')],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x1e8d76,null))[_0x5221('0x1f')](function(_0x5dbc62){if(_0x5dbc62){var _0x5ce8ec=_0x5dbc62['loginLogo']&&fs[_0x5221('0x5d')](path['join'](config[_0x5221('0x5f')],_0x276121,_[_0x5221('0x60')](_0x5dbc62[_0x5221('0x58')])))?path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x276121,_[_0x5221('0x60')](_0x5dbc62['loginLogo'])):path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x276121,_[_0x5221('0x60')](_0x5221('0x6c')));var _0x5bc2ba='default'+_['upperFirst'](_0x5221('0x58'));if(_0x5dbc62[_0x5bc2ba]||!_0x3e575d[_0x5221('0x62')]){_0x5ce8ec=path['join'](config['root'],_0x276121,_[_0x5221('0x60')](_0x5221('0x6c')));}if(!fs[_0x5221('0x5d')](_0x5ce8ec)){throw new db['Sequelize'][(_0x5221('0x64'))](_[_0x5221('0x65')]('loginLogo')+_0x5221('0x66'));}return _0x1e8d76[_0x5221('0x6d')](_0x5ce8ec);}})[_0x5221('0x29')](handleError(_0x1e8d76,null));};exports[_0x5221('0x6e')]=function(_0x1f615d,_0x1de303){return db['Setting'][_0x5221('0x53')]({'where':{'id':_0x1f615d[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x6f')]})[_0x5221('0x1f')](respondWithResult(_0x1de303,null))[_0x5221('0x29')](handleError(_0x1de303,null));};exports['addPreferred']=function(_0x24ee15,_0x3fa4f6,_0x36a346){if(_0x24ee15[_0x5221('0x55')]&&_0x24ee15[_0x5221('0x55')][_0x5221('0x56')]){_0x24ee15['body']['preferred']=_0x24ee15[_0x5221('0x55')][_0x5221('0x56')];}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x24ee15[_0x5221('0x4f')]['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0x3fa4f6,null))[_0x5221('0x1f')](saveUpdates(_0x24ee15['body'],null))[_0x5221('0x1f')](respondWithResult(_0x3fa4f6,null))[_0x5221('0x29')](handleError(_0x3fa4f6,null));};var utilLicense=require(_0x5221('0x1a'));exports[_0x5221('0x70')]=function(_0x5ae576,_0x52b9e5,_0x47c4b7){var _0x2012c7=_0x5221('0x68');var _0x573a73={'custom':![]};return utilLicense[_0x5221('0x69')]()['then'](function(_0x2c6a2f){if(_0x2c6a2f){_0x573a73=_0x2c6a2f;}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x5ae576[_0x5221('0x4f')]['id']},'attributes':['logo',_0x5221('0x58'),_0x5221('0x5a'),_0x5221('0x71'),'defaultLogo',_0x5221('0x6a'),_0x5221('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x52b9e5,null))[_0x5221('0x1f')](function(_0x3e2860){if(_0x3e2860){var _0x45b56f=_0x3e2860[_0x5221('0x5a')]&&fs['existsSync'](path[_0x5221('0x5e')](config['root'],_0x2012c7,_[_0x5221('0x60')](_0x3e2860[_0x5221('0x5a')])))?path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0x2012c7,_[_0x5221('0x60')](_0x3e2860[_0x5221('0x5a')])):path[_0x5221('0x5e')](config['root'],_0x2012c7,_[_0x5221('0x60')](_0x5221('0x72')));var _0x1852c9=_0x5221('0x61')+_['upperFirst']('preferred');if(_0x3e2860[_0x1852c9]||!_0x573a73[_0x5221('0x62')]||!_0x573a73[_0x5221('0x5a')]){_0x45b56f=path['join'](config[_0x5221('0x5f')],_0x2012c7,_[_0x5221('0x60')]('default_preferred.png'));}if(!fs['existsSync'](_0x45b56f)){throw new db[(_0x5221('0x63'))][(_0x5221('0x64'))](_[_0x5221('0x65')](_0x5221('0x5a'))+_0x5221('0x66'));}return _0x52b9e5[_0x5221('0x6d')](_0x45b56f);}})['catch'](handleError(_0x52b9e5,null));};exports[_0x5221('0x73')]=function(_0x4328ad,_0xd444a6,_0x460603){if(_0x4328ad[_0x5221('0x55')]&&_0x4328ad[_0x5221('0x55')][_0x5221('0x56')]){_0x4328ad[_0x5221('0x54')][_0x5221('0x71')]=_0x4328ad['file'][_0x5221('0x56')];}return db[_0x5221('0x39')]['find']({'where':{'id':_0x4328ad['params']['id']}})[_0x5221('0x1f')](handleEntityNotFound(_0xd444a6,null))[_0x5221('0x1f')](saveUpdates(_0x4328ad[_0x5221('0x54')],null))['then'](respondWithResult(_0xd444a6,null))[_0x5221('0x29')](handleError(_0xd444a6,null));};var utilLicense=require(_0x5221('0x1a'));exports[_0x5221('0x74')]=function(_0x341629,_0x3e2333,_0x493da3){var _0xa0208c=_0x5221('0x68');var _0x525d32={'custom':![]};return utilLicense[_0x5221('0x69')]()['then'](function(_0x23f8d3){if(_0x23f8d3){_0x525d32=_0x23f8d3;}return db[_0x5221('0x39')][_0x5221('0x53')]({'where':{'id':_0x341629[_0x5221('0x4f')]['id']},'attributes':[_0x5221('0x57'),_0x5221('0x58'),_0x5221('0x5a'),_0x5221('0x71'),_0x5221('0x5b'),_0x5221('0x6a'),_0x5221('0x5c'),_0x5221('0x6b')],'raw':!![]});})[_0x5221('0x1f')](handleEntityNotFound(_0x3e2333,null))['then'](function(_0x43d858){if(_0x43d858){var _0x5361df=_0x43d858[_0x5221('0x71')]&&fs[_0x5221('0x5d')](path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0xa0208c,_[_0x5221('0x60')](_0x43d858['favicon'])))?path[_0x5221('0x5e')](config['root'],_0xa0208c,_[_0x5221('0x60')](_0x43d858['favicon'])):path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0xa0208c,_[_0x5221('0x60')]('default_favicon.ico'));var _0xe0f78='default'+_[_0x5221('0x65')](_0x5221('0x71'));if(_0x43d858[_0xe0f78]||!_0x525d32[_0x5221('0x62')]){_0x5361df=path[_0x5221('0x5e')](config[_0x5221('0x5f')],_0xa0208c,_[_0x5221('0x60')]('default_favicon.ico'));}if(!fs['existsSync'](_0x5361df)){throw new db['Sequelize'][(_0x5221('0x64'))](_[_0x5221('0x65')](_0x5221('0x71'))+_0x5221('0x66'));}return _0x3e2333['download'](_0x5361df);}})[_0x5221('0x29')](handleError(_0x3e2333,null));};exports[_0x5221('0x75')]=function(_0x2a914b,_0x153f27){var _0x58dec6={'offset':moment()[_0x5221('0x76')]()};_0x58dec6['now']=moment()[_0x5221('0x76')](_0x58dec6[_0x5221('0x44')])[_0x5221('0x77')](_0x5221('0x78'));return _0x153f27[_0x5221('0x2e')](0xc8)[_0x5221('0x79')](_0x58dec6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e4f26f1..2aed274 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 _0x55e0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Setting','lodash','util','api'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x55e0,0xa2));var _0x055e=function(_0x2224bf,_0x40e44d){_0x2224bf=_0x2224bf-0x0;var _0x4dc9bf=_0x55e0[_0x2224bf];return _0x4dc9bf;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require('../../config/logger')(_0x055e('0x2'));var moment=require(_0x055e('0x3'));var BPromise=require(_0x055e('0x4'));var rp=require(_0x055e('0x5'));var fs=require('fs');var path=require(_0x055e('0x6'));var rimraf=require(_0x055e('0x7'));var config=require(_0x055e('0x8'));var attributes=require('./setting.attributes');module[_0x055e('0x9')]=function(_0x4e3d47,_0x1d549a){return _0x4e3d47['define'](_0x055e('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7af3=['./setting.attributes','define','Setting','settings','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x16efc9,_0x4fa873){var _0x162eaf=function(_0x1db3d2){while(--_0x1db3d2){_0x16efc9['push'](_0x16efc9['shift']());}};_0x162eaf(++_0x4fa873);}(_0x7af3,0x176));var _0x37af=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7af3[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x37af('0x0'));var logger=require(_0x37af('0x1'))(_0x37af('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x37af('0x3'));var fs=require('fs');var path=require(_0x37af('0x4'));var rimraf=require('rimraf');var config=require(_0x37af('0x5'));var attributes=require(_0x37af('0x6'));module['exports']=function(_0x222e41,_0x2e3979){return _0x222e41[_0x37af('0x7')](_0x37af('0x8'),attributes,{'tableName':_0x37af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7728848..7be30e1 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 _0xf48c=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xf48c,0xb6));var _0xcf48=function(_0xdd75dd,_0x39a02d){_0xdd75dd=_0xdd75dd-0x0;var _0x18e303=_0xf48c[_0xdd75dd];return _0x18e303;};'use strict';var _=require('lodash');var util=require(_0xcf48('0x0'));var moment=require(_0xcf48('0x1'));var BPromise=require(_0xcf48('0x2'));var rs=require(_0xcf48('0x3'));var fs=require('fs');var Redis=require(_0xcf48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf48('0x5'));var logger=require(_0xcf48('0x6'))('rpc');var config=require(_0xcf48('0x7'));var jayson=require(_0xcf48('0x8'));var client=jayson['client'][_0xcf48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44c640,_0x4e17f2,_0x4085af){return new BPromise(function(_0x1f318b,_0x2e5ab3){return client['request'](_0x44c640,_0x4085af)[_0xcf48('0xa')](function(_0x3a9ab3){logger[_0xcf48('0xb')](_0xcf48('0xc'),_0x4e17f2,_0xcf48('0xd'));logger[_0xcf48('0xe')](_0xcf48('0xf'),_0x4e17f2,'request\x20sent',JSON[_0xcf48('0x10')](_0x3a9ab3));if(_0x3a9ab3[_0xcf48('0x11')]){if(_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x12')]===0x1f4){logger[_0xcf48('0x11')](_0xcf48('0xc'),_0x4e17f2,_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x13')]);return _0x2e5ab3(_0x3a9ab3[_0xcf48('0x11')]['message']);}logger[_0xcf48('0x11')](_0xcf48('0xc'),_0x4e17f2,_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x13')]);return _0x1f318b(_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x13')]);}else{logger[_0xcf48('0xb')](_0xcf48('0xc'),_0x4e17f2,_0xcf48('0xd'));_0x1f318b(_0x3a9ab3[_0xcf48('0x14')]['message']);}})[_0xcf48('0x15')](function(_0x282fb1){logger['error'](_0xcf48('0xc'),_0x4e17f2,_0x282fb1);_0x2e5ab3(_0x282fb1);});});} \ No newline at end of file +var _0x2507=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','bluebird'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0x2507,0x6f));var _0x7250=function(_0x485869,_0x3f0b71){_0x485869=_0x485869-0x0;var _0x52ee7a=_0x2507[_0x485869];return _0x52ee7a;};'use strict';var _=require(_0x7250('0x0'));var util=require(_0x7250('0x1'));var moment=require(_0x7250('0x2'));var BPromise=require(_0x7250('0x3'));var rs=require(_0x7250('0x4'));var fs=require('fs');var Redis=require(_0x7250('0x5'));var db=require(_0x7250('0x6'))['db'];var utils=require(_0x7250('0x7'));var logger=require(_0x7250('0x8'))(_0x7250('0x9'));var config=require(_0x7250('0xa'));var jayson=require(_0x7250('0xb'));var client=jayson[_0x7250('0xc')][_0x7250('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x457cf0,_0x2b9d69,_0x2fa096){return new BPromise(function(_0x5b3a39,_0x177cb0){return client[_0x7250('0xe')](_0x457cf0,_0x2fa096)[_0x7250('0xf')](function(_0xb0b986){logger[_0x7250('0x10')]('Setting,\x20%s,\x20%s',_0x2b9d69,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2b9d69,'request\x20sent',JSON[_0x7250('0x11')](_0xb0b986));if(_0xb0b986[_0x7250('0x12')]){if(_0xb0b986['error'][_0x7250('0x13')]===0x1f4){logger[_0x7250('0x12')](_0x7250('0x14'),_0x2b9d69,_0xb0b986[_0x7250('0x12')][_0x7250('0x15')]);return _0x177cb0(_0xb0b986[_0x7250('0x12')][_0x7250('0x15')]);}logger[_0x7250('0x12')](_0x7250('0x14'),_0x2b9d69,_0xb0b986[_0x7250('0x12')][_0x7250('0x15')]);return _0x5b3a39(_0xb0b986['error'][_0x7250('0x15')]);}else{logger[_0x7250('0x10')]('Setting,\x20%s,\x20%s',_0x2b9d69,_0x7250('0x16'));_0x5b3a39(_0xb0b986['result'][_0x7250('0x15')]);}})['catch'](function(_0x39aa32){logger[_0x7250('0x12')](_0x7250('0x14'),_0x2b9d69,_0x39aa32);_0x177cb0(_0x39aa32);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d2af3e2..cd1e63b 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 _0xb7e7=['/:id/status','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','status','addAgents','put','update','delete','removeAnswers','exports','multer','path','express','../../components/auth/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions'];(function(_0x3ffeba,_0x59c668){var _0x49a6fd=function(_0x1a9523){while(--_0x1a9523){_0x3ffeba['push'](_0x3ffeba['shift']());}};_0x49a6fd(++_0x59c668);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xb7e7[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['getDispositions']);router[_0x7b7e('0x6')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x6')](_0x7b7e('0xe'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x6')]('/:id/interactions',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x10')]);router['get'](_0x7b7e('0x11'),controller['statusGet']);router['get'](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x14')]('/',auth[_0x7b7e('0x8')](),controller['create']);router['post'](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x15')]);router[_0x7b7e('0x14')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x14')](_0x7b7e('0x17'),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x14')](_0x7b7e('0xe'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x19')]);router[_0x7b7e('0x14')](_0x7b7e('0x1a'),auth[_0x7b7e('0x8')](),controller['send']);router[_0x7b7e('0x14')](_0x7b7e('0x11'),controller[_0x7b7e('0x1b')]);router['post'](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1c')]);router[_0x7b7e('0x1d')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1e')]);router[_0x7b7e('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7b7e('0x1f')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x20')]);router[_0x7b7e('0x1f')](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller['removeAgents']);module[_0x7b7e('0x21')]=router; \ No newline at end of file +var _0x757a=['/:id/interactions','/:id/users','getAgents','post','create','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','/:id/status','status','addAgents','put','update','delete','removeAgents','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x552b03,_0x48e023){var _0x14ab19=function(_0x58fb5e){while(--_0x58fb5e){_0x552b03['push'](_0x552b03['shift']());}};_0x14ab19(++_0x48e023);}(_0x757a,0xde));var _0xa757=function(_0x3f5277,_0x564d83){_0x3f5277=_0x3f5277-0x0;var _0x1d8dd1=_0x757a[_0x3f5277];return _0x1d8dd1;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['get'](_0xa757('0xc'),auth[_0xa757('0x7')](),controller[_0xa757('0xd')]);router[_0xa757('0x6')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller[_0xa757('0xf')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xa757('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xa757('0x6')]('/:id/status',controller['statusGet']);router[_0xa757('0x6')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x12')]);router[_0xa757('0x13')]('/',auth[_0xa757('0x7')](),controller[_0xa757('0x14')]);router[_0xa757('0x13')](_0xa757('0xc'),auth[_0xa757('0x7')](),controller['addDisposition']);router[_0xa757('0x13')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['addAnswer']);router['post'](_0xa757('0x15'),controller[_0xa757('0x16')]);router[_0xa757('0x13')](_0xa757('0x17'),auth[_0xa757('0x7')](),controller[_0xa757('0x18')]);router['post'](_0xa757('0x19'),auth['isAuthenticated'](),controller[_0xa757('0x1a')]);router[_0xa757('0x13')](_0xa757('0x1b'),controller[_0xa757('0x1c')]);router['post']('/:id/users',auth[_0xa757('0x7')](),controller[_0xa757('0x1d')]);router[_0xa757('0x1e')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0x1f')]);router[_0xa757('0x20')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller['destroy']);router[_0xa757('0x20')]('/:id/dispositions',auth[_0xa757('0x7')](),controller['removeDispositions']);router[_0xa757('0x20')](_0xa757('0xe'),auth[_0xa757('0x7')](),controller['removeAnswers']);router[_0xa757('0x20')](_0xa757('0x11'),auth[_0xa757('0x7')](),controller[_0xa757('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index faa2463..b682714 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 _0xe73e=['csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell'];(function(_0x28d2a1,_0x1eef19){var _0x5708cf=function(_0x16eb4e){while(--_0x16eb4e){_0x28d2a1['push'](_0x28d2a1['shift']());}};_0x5708cf(++_0x1eef19);}(_0xe73e,0x196));var _0xee73=function(_0x106279,_0x4ba278){_0x106279=_0x106279-0x0;var _0x37402c=_0xe73e[_0x106279];return _0x37402c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xee73('0x0'));module[_0xee73('0x1')]={'name':{'type':Sequelize[_0xee73('0x2')],'unique':_0xee73('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xee73('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xee73('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xee73('0x2')],'defaultValue':function(){return rs[_0xee73('0x4')]();}},'phone':{'type':Sequelize[_0xee73('0x2')]},'type':{'type':Sequelize[_0xee73('0x5')](_0xee73('0x6'),_0xee73('0x7'),_0xee73('0x8'),_0xee73('0x9'),_0xee73('0xa'),_0xee73('0xb'),_0xee73('0xc'),_0xee73('0xd'),_0xee73('0xe'))},'accountSid':{'type':Sequelize[_0xee73('0x2')]},'authId':{'type':Sequelize[_0xee73('0x2')]},'authToken':{'type':Sequelize[_0xee73('0x2')]},'smsMethod':{'type':Sequelize[_0xee73('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xee73('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xee73('0x2')]},'senderString':{'type':Sequelize[_0xee73('0x2')]},'deliveryReport':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xee73('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xee73('0x10');}},'notificationSound':{'type':Sequelize[_0xee73('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xee73('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xee73('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xee73('0x11')],'comment':_0xee73('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![],'comment':_0xee73('0x13'),'set':function(_0x189fbd){if(!_0x189fbd)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xee73('0x14')](_0xee73('0x15'),_0x189fbd);}}}; \ No newline at end of file +var _0x9ded=['csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','skebby','plivo','clickatell'];(function(_0x39691e,_0x8d94d2){var _0x2a8fdf=function(_0x3e45d5){while(--_0x3e45d5){_0x39691e['push'](_0x39691e['shift']());}};_0x2a8fdf(++_0x8d94d2);}(_0x9ded,0x1ee));var _0xd9de=function(_0xa3f0c9,_0x281090){_0xa3f0c9=_0xa3f0c9-0x0;var _0x168a1a=_0x9ded[_0xa3f0c9];return _0x168a1a;};'use strict';var Sequelize=require(_0xd9de('0x0'));var rs=require(_0xd9de('0x1'));module[_0xd9de('0x2')]={'name':{'type':Sequelize[_0xd9de('0x3')],'unique':_0xd9de('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xd9de('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xd9de('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xd9de('0x3')],'defaultValue':function(){return rs[_0xd9de('0x5')]();}},'phone':{'type':Sequelize[_0xd9de('0x3')]},'type':{'type':Sequelize[_0xd9de('0x6')]('twilio',_0xd9de('0x7'),'connectel','clicksend',_0xd9de('0x8'),_0xd9de('0x9'),_0xd9de('0xa'),_0xd9de('0xb'),_0xd9de('0xc'))},'accountSid':{'type':Sequelize[_0xd9de('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xd9de('0x3')]},'smsMethod':{'type':Sequelize[_0xd9de('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd9de('0x3')]},'password':{'type':Sequelize[_0xd9de('0x3')]},'apiKey':{'type':Sequelize[_0xd9de('0x3')]},'senderString':{'type':Sequelize[_0xd9de('0x3')]},'deliveryReport':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xd9de('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd9de('0xe')],'defaultValue':function(){return _0xd9de('0xf');}},'notificationSound':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd9de('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd9de('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd9de('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd9de('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd9de('0x10')],'comment':_0xd9de('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xd9de('0xd')],'defaultValue':![],'comment':_0xd9de('0x12'),'set':function(_0x5286a0){if(!_0x5286a0)this['setDataValue'](_0xd9de('0x13'),null);this[_0xd9de('0x14')]('mandatoryDisposition',_0x5286a0);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a4631c5..d3b5d69 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 _0x8620=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','length','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','Contact','internal','Tag','tag','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','intelepeer','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x5b7327,_0x3da7cc){var _0x1518a1=function(_0x32345a){while(--_0x32345a){_0x5b7327['push'](_0x5b7327['shift']());}};_0x1518a1(++_0x3da7cc);}(_0x8620,0xd0));var _0x0862=function(_0x471ebf,_0x3ed3c0){_0x471ebf=_0x471ebf-0x0;var _0xc978df=_0x8620[_0x471ebf];return _0xc978df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0862('0x0'));var rimraf=require(_0x0862('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0862('0x2'));var moment=require(_0x0862('0x3'));var BPromise=require(_0x0862('0x4'));var Mustache=require(_0x0862('0x5'));var util=require(_0x0862('0x6'));var path=require(_0x0862('0x7'));var sox=require(_0x0862('0x8'));var csv=require(_0x0862('0x9'));var ejs=require(_0x0862('0xa'));var fs=require('fs');var _=require(_0x0862('0xb'));var squel=require(_0x0862('0xc'));var crypto=require(_0x0862('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0862('0xe'));var toCsv=require(_0x0862('0x9'));var querystring=require(_0x0862('0xf'));var Papa=require(_0x0862('0x10'));var Redis=require(_0x0862('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0862('0x12'));var as=require(_0x0862('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0862('0x14'))(_0x0862('0x15'));var utils=require(_0x0862('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0862('0x17'));var db=require(_0x0862('0x18'))['db'];config[_0x0862('0x19')]=_['defaults'](config[_0x0862('0x19')],{'host':_0x0862('0x1a'),'port':0x18eb});var socket=require(_0x0862('0x1b'))(new Redis(config[_0x0862('0x19')]));require('./smsAccount.socket')[_0x0862('0x1c')](socket);var jayson=require(_0x0862('0x1d'));var client=jayson[_0x0862('0x1e')][_0x0862('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x8d3b5c,_0x2f85c7,_0x3ac2ef,_0x9e8bd2){return new BPromise(function(_0x1cbea9,_0x1d0e9a){var _0x3e2efa=_0x9e8bd2||client;return _0x3e2efa[_0x0862('0x20')](_0x8d3b5c,_0x3ac2ef)['then'](function(_0x193d52){logger[_0x0862('0x21')](_0x0862('0x22'),_0x2f85c7,_0x0862('0x23'));logger[_0x0862('0x24')](_0x0862('0x25'),_0x2f85c7,_0x0862('0x23'),JSON[_0x0862('0x26')](_0x193d52));if(_0x193d52[_0x0862('0x27')]){if(_0x193d52[_0x0862('0x27')][_0x0862('0x28')]===0x1f4){logger[_0x0862('0x27')](_0x0862('0x22'),_0x2f85c7,_0x193d52[_0x0862('0x27')][_0x0862('0x29')]);return _0x1d0e9a(_0x193d52['error'][_0x0862('0x29')]);}logger[_0x0862('0x27')](_0x0862('0x22'),_0x2f85c7,_0x193d52['error'][_0x0862('0x29')]);return _0x1cbea9(_0x193d52[_0x0862('0x27')][_0x0862('0x29')]);}else{logger[_0x0862('0x21')]('SmsAccount,\x20%s,\x20%s',_0x2f85c7,'request\x20sent');_0x1cbea9(_0x193d52[_0x0862('0x2a')][_0x0862('0x29')]);}})['catch'](function(_0x1e9d07){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2f85c7,_0x1e9d07);_0x1d0e9a(_0x1e9d07);});});}function respondWithStatusCode(_0x4f0169,_0x1ee273){_0x1ee273=_0x1ee273||0xcc;return function(_0x1bea98){if(_0x1bea98){return _0x4f0169[_0x0862('0x2b')](_0x1ee273);}return _0x4f0169[_0x0862('0x2c')](_0x1ee273)['end']();};}function respondWithResult(_0x212fe3,_0x5b6582){_0x5b6582=_0x5b6582||0xc8;return function(_0x28bd7a){if(_0x28bd7a){return _0x212fe3[_0x0862('0x2c')](_0x5b6582)[_0x0862('0x2d')](_0x28bd7a);}};}function respondWithFilteredResult(_0x3d47c0,_0x6ee73e){return function(_0x2df62c){if(_0x2df62c){var _0x6dbef0=_0x2df62c[_0x0862('0x2e')],_0x5ed914=_0x6ee73e[_0x0862('0x2f')],_0x52e06c=_0x6ee73e[_0x0862('0x2f')]+_0x6ee73e[_0x0862('0x30')],_0x2fb7b3;if(_0x52e06c>=_0x6dbef0){_0x52e06c=_0x6dbef0;_0x2fb7b3=0xc8;}else{_0x2fb7b3=0xce;}_0x3d47c0[_0x0862('0x2c')](_0x2fb7b3);return _0x3d47c0[_0x0862('0x31')](_0x0862('0x32'),_0x5ed914+'-'+_0x52e06c+'/'+_0x6dbef0)['json'](_0x2df62c);}return null;};}function patchUpdates(_0x10beed){return function(_0x20d268){try{jsonpatch['apply'](_0x20d268,_0x10beed,!![]);}catch(_0x4a7888){return BPromise[_0x0862('0x33')](_0x4a7888);}return _0x20d268[_0x0862('0x34')]();};}function saveUpdates(_0x23cd3a,_0x3b1f14){return function(_0x10b2ab){if(_0x10b2ab){return _0x10b2ab[_0x0862('0x35')](_0x23cd3a)[_0x0862('0x36')](function(_0x5e061b){return _0x5e061b;});}return null;};}function removeEntity(_0x365d66,_0x26c77b){return function(_0x1c718a){if(_0x1c718a){return _0x1c718a[_0x0862('0x37')]()['then'](function(){var _0x27c834=_0x1c718a['get']({'plain':!![]});var _0x2cb952='SmsAccounts';return db['UserProfileResource'][_0x0862('0x37')]({'where':{'type':_0x2cb952,'resourceId':_0x27c834['id']}})[_0x0862('0x36')](function(){return _0x1c718a;});})[_0x0862('0x36')](function(){_0x365d66[_0x0862('0x2c')](0xcc)[_0x0862('0x38')]();});}};}function handleEntityNotFound(_0x56351c,_0x5aab6f){return function(_0x636887){if(!_0x636887){_0x56351c[_0x0862('0x2b')](0x194);}return _0x636887;};}function handleError(_0x12f2bc,_0x117505){_0x117505=_0x117505||0x1f4;return function(_0x60f2be){logger[_0x0862('0x27')](_0x60f2be['stack']);if(_0x60f2be[_0x0862('0x39')]){delete _0x60f2be[_0x0862('0x39')];}_0x12f2bc[_0x0862('0x2c')](_0x117505)[_0x0862('0x3a')](_0x60f2be);};}exports['index']=function(_0x1f2df8,_0x35d071){var _0x33901d={'include':[{'model':db[_0x0862('0x3b')],'as':_0x0862('0x3c')}]},_0x360fac={},_0x19e840={'count':0x0,'rows':[]};var _0x568922=_[_0x0862('0x3d')](db[_0x0862('0x3e')][_0x0862('0x3f')],function(_0x29136a){return{'name':_0x29136a[_0x0862('0x40')],'type':_0x29136a[_0x0862('0x41')][_0x0862('0x42')]};});_0x360fac[_0x0862('0x43')]=_[_0x0862('0x3d')](_0x568922,'name');_0x360fac[_0x0862('0x44')]=_[_0x0862('0x45')](_0x1f2df8['query']);_0x360fac[_0x0862('0x46')]=_[_0x0862('0x47')](_0x360fac[_0x0862('0x43')],_0x360fac[_0x0862('0x44')]);_0x33901d[_0x0862('0x48')]=_[_0x0862('0x47')](_0x360fac[_0x0862('0x43')],qs[_0x0862('0x49')](_0x1f2df8[_0x0862('0x44')][_0x0862('0x49')]));_0x33901d['attributes']=_0x33901d[_0x0862('0x48')]['length']?_0x33901d[_0x0862('0x48')]:_0x360fac['model'];if(!_0x1f2df8[_0x0862('0x44')][_0x0862('0x4a')]('nolimit')){_0x33901d[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x1f2df8[_0x0862('0x44')][_0x0862('0x30')]);_0x33901d[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0x1f2df8['query']['offset']);}_0x33901d[_0x0862('0x4b')]=qs[_0x0862('0x4c')](_0x1f2df8['query']['sort']);_0x33901d[_0x0862('0x4d')]=qs[_0x0862('0x46')](_[_0x0862('0x4e')](_0x1f2df8['query'],_0x360fac[_0x0862('0x46')]),_0x568922);if(_0x1f2df8[_0x0862('0x44')][_0x0862('0x4f')]){_0x33901d[_0x0862('0x4d')]=_[_0x0862('0x50')](_0x33901d[_0x0862('0x4d')],{'$or':_[_0x0862('0x3d')](_0x568922,function(_0xba4a16){if(_0xba4a16[_0x0862('0x41')]!==_0x0862('0x51')){var _0x4bb755={};_0x4bb755[_0xba4a16[_0x0862('0x39')]]={'$like':'%'+_0x1f2df8['query'][_0x0862('0x4f')]+'%'};return _0x4bb755;}})});}_0x33901d=_[_0x0862('0x50')]({},_0x33901d,_0x1f2df8[_0x0862('0x52')]);var _0x50b516={'where':_0x33901d[_0x0862('0x4d')]};return db[_0x0862('0x3e')][_0x0862('0x2e')](_0x50b516)[_0x0862('0x36')](function(_0x39c10b){_0x19e840[_0x0862('0x2e')]=_0x39c10b;if(_0x1f2df8['query']['includeAll']){_0x33901d['include']=[{'all':!![]}];}return db[_0x0862('0x3e')][_0x0862('0x53')](_0x33901d);})['then'](function(_0xa24826){_0x19e840[_0x0862('0x54')]=_0xa24826;return _0x19e840;})[_0x0862('0x36')](respondWithFilteredResult(_0x35d071,_0x33901d))[_0x0862('0x55')](handleError(_0x35d071,null));};exports[_0x0862('0x56')]=function(_0x34dee1,_0x1e66fc){var _0x35cfa1={'raw':![],'where':{'id':_0x34dee1[_0x0862('0x57')]['id']},'include':[{'model':db[_0x0862('0x3b')],'as':'mandatoryDispositionPause'}]},_0x1d19ba={};_0x1d19ba['model']=_['keys'](db[_0x0862('0x3e')]['rawAttributes']);_0x1d19ba[_0x0862('0x44')]=_[_0x0862('0x45')](_0x34dee1[_0x0862('0x44')]);_0x1d19ba[_0x0862('0x46')]=_[_0x0862('0x47')](_0x1d19ba[_0x0862('0x43')],_0x1d19ba[_0x0862('0x44')]);_0x35cfa1[_0x0862('0x48')]=_['intersection'](_0x1d19ba['model'],qs[_0x0862('0x49')](_0x34dee1[_0x0862('0x44')][_0x0862('0x49')]));_0x35cfa1['attributes']=_0x35cfa1[_0x0862('0x48')]['length']?_0x35cfa1[_0x0862('0x48')]:_0x1d19ba['model'];if(_0x34dee1[_0x0862('0x44')][_0x0862('0x58')]){_0x35cfa1[_0x0862('0x59')]=[{'all':!![]}];}_0x35cfa1=_[_0x0862('0x50')]({},_0x35cfa1,_0x34dee1['options']);return db[_0x0862('0x3e')][_0x0862('0x5a')](_0x35cfa1)[_0x0862('0x36')](handleEntityNotFound(_0x1e66fc,null))['then'](respondWithResult(_0x1e66fc,null))[_0x0862('0x55')](handleError(_0x1e66fc,null));};exports['create']=function(_0x3590d8,_0xf741ce){return db[_0x0862('0x3e')][_0x0862('0x5b')](_0x3590d8[_0x0862('0x5c')],{})[_0x0862('0x36')](function(_0x2c9f25){var _0x5c7a04=_0x3590d8[_0x0862('0x5d')][_0x0862('0x5e')]({'plain':!![]});if(!_0x5c7a04)throw new Error(_0x0862('0x5f'));if(_0x5c7a04[_0x0862('0x60')]==='user'){var _0x5b66c8=_0x2c9f25[_0x0862('0x5e')]({'plain':!![]});var _0x2e6c5d=_0x0862('0x61');return db[_0x0862('0x62')][_0x0862('0x5a')]({'where':{'name':_0x2e6c5d,'userProfileId':_0x5c7a04[_0x0862('0x63')]},'raw':!![]})[_0x0862('0x36')](function(_0xc7c59b){if(_0xc7c59b&&_0xc7c59b['autoAssociation']===0x0){return db[_0x0862('0x64')]['create']({'name':_0x5b66c8['name'],'resourceId':_0x5b66c8['id'],'type':_0xc7c59b[_0x0862('0x39')],'sectionId':_0xc7c59b['id']},{})['then'](function(){return _0x2c9f25;});}else{return _0x2c9f25;}})[_0x0862('0x55')](function(_0x14cd85){logger['error'](_0x0862('0x65'),_0x14cd85);throw _0x14cd85;});}return _0x2c9f25;})[_0x0862('0x36')](respondWithResult(_0xf741ce,0xc9))[_0x0862('0x55')](handleError(_0xf741ce,null));};exports[_0x0862('0x35')]=function(_0x369b05,_0x1bd498){if(_0x369b05['body']['id']){delete _0x369b05[_0x0862('0x5c')]['id'];}return db['SmsAccount'][_0x0862('0x5a')]({'where':{'id':_0x369b05['params']['id']},'include':[{'model':db[_0x0862('0x3b')],'as':_0x0862('0x3c')}]})['then'](handleEntityNotFound(_0x1bd498,null))['then'](saveUpdates(_0x369b05['body'],null))['then'](respondWithResult(_0x1bd498,null))[_0x0862('0x55')](handleError(_0x1bd498,null));};exports[_0x0862('0x37')]=function(_0x25f627,_0x338c7c){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x25f627[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x338c7c,null))['then'](removeEntity(_0x338c7c,null))['catch'](handleError(_0x338c7c,null));};exports[_0x0862('0x66')]=function(_0x7a5ec6,_0x578a27){return db[_0x0862('0x3e')][_0x0862('0x66')]()[_0x0862('0x36')](respondWithResult(_0x578a27,null))[_0x0862('0x55')](handleError(_0x578a27,null));};exports[_0x0862('0x67')]=function(_0x2f5713,_0x29c207,_0x476a1d){if(_0x2f5713[_0x0862('0x5c')]['id']){delete _0x2f5713['body']['id'];}return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x2f5713['params']['id']}})['then'](handleEntityNotFound(_0x29c207,null))[_0x0862('0x36')](function(_0x80abfb){if(_0x80abfb){_0x2f5713['body'][_0x0862('0x68')]=_0x80abfb['id'];return db[_0x0862('0x69')][_0x0862('0x5b')](_0x2f5713['body']);}})[_0x0862('0x36')](respondWithResult(_0x29c207,null))[_0x0862('0x55')](handleError(_0x29c207,null));};exports[_0x0862('0x6a')]=function(_0x20c261,_0x1d74c6,_0x4a1d10){var _0x2659a6={'raw':![],'where':{}};var _0x1fa039={};var _0x30f0dd={'count':0x0,'rows':[]};return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0x20c261[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x1d74c6,null))[_0x0862('0x36')](function(_0x4a335f){if(_0x4a335f){_0x1fa039[_0x0862('0x43')]=_['keys'](db[_0x0862('0x69')][_0x0862('0x3f')]);_0x1fa039[_0x0862('0x44')]=_[_0x0862('0x45')](_0x20c261['query']);_0x1fa039[_0x0862('0x46')]=_[_0x0862('0x47')](_0x1fa039[_0x0862('0x43')],_0x1fa039[_0x0862('0x44')]);_0x2659a6['attributes']=_[_0x0862('0x47')](_0x1fa039['model'],qs[_0x0862('0x49')](_0x20c261['query']['fields']));_0x2659a6[_0x0862('0x48')]=_0x2659a6[_0x0862('0x48')][_0x0862('0x6c')]?_0x2659a6['attributes']:_0x1fa039[_0x0862('0x43')];if(!_0x20c261[_0x0862('0x44')][_0x0862('0x4a')](_0x0862('0x6d'))){_0x2659a6[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x20c261[_0x0862('0x44')]['limit']);_0x2659a6[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0x20c261[_0x0862('0x44')][_0x0862('0x2f')]);}_0x2659a6[_0x0862('0x4b')]=qs['sort'](_0x20c261[_0x0862('0x44')][_0x0862('0x4c')]);_0x2659a6['where']=qs['filters'](_['pick'](_0x20c261['query'],_0x1fa039[_0x0862('0x46')]));_0x2659a6['where']['SmsAccountId']=_0x4a335f['id'];if(_0x20c261['query'][_0x0862('0x4f')]){_0x2659a6['where']=_[_0x0862('0x50')](_0x2659a6['where'],{'$or':_[_0x0862('0x3d')](_0x2659a6['attributes'],function(_0x2c3459){var _0x4fd86d={};_0x4fd86d[_0x2c3459]={'$like':'%'+_0x20c261[_0x0862('0x44')][_0x0862('0x4f')]+'%'};return _0x4fd86d;})});}_0x2659a6=_[_0x0862('0x50')]({},_0x2659a6,_0x20c261[_0x0862('0x52')]);return db['Disposition'][_0x0862('0x2e')]({'where':_0x2659a6[_0x0862('0x4d')]})['then'](function(_0x20f900){_0x30f0dd[_0x0862('0x2e')]=_0x20f900;if(_0x20c261[_0x0862('0x44')][_0x0862('0x58')]){_0x2659a6[_0x0862('0x59')]=[{'all':!![]}];}return db[_0x0862('0x69')][_0x0862('0x53')](_0x2659a6);})[_0x0862('0x36')](function(_0xf83652){_0x30f0dd[_0x0862('0x54')]=_0xf83652;return _0x30f0dd;});}})['then'](respondWithFilteredResult(_0x1d74c6,_0x2659a6))[_0x0862('0x55')](handleError(_0x1d74c6,null));};exports[_0x0862('0x6e')]=function(_0xb4f35b,_0x3998fb,_0x1325e2){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0xb4f35b['params']['id']}})['then'](handleEntityNotFound(_0x3998fb,null))[_0x0862('0x36')](function(_0x44cb37){if(_0x44cb37){return _0x44cb37['removeDispositions'](_0xb4f35b[_0x0862('0x44')][_0x0862('0x6f')]);}})[_0x0862('0x36')](respondWithStatusCode(_0x3998fb,null))[_0x0862('0x55')](handleError(_0x3998fb,null));};exports[_0x0862('0x70')]=function(_0x4b2d08,_0x184362,_0x97cb39){if(_0x4b2d08['body']['id']){delete _0x4b2d08[_0x0862('0x5c')]['id'];}return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x4b2d08['params']['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x184362,null))[_0x0862('0x36')](function(_0x32b564){if(_0x32b564){_0x4b2d08[_0x0862('0x5c')][_0x0862('0x68')]=_0x32b564['id'];return db[_0x0862('0x71')][_0x0862('0x5b')](_0x4b2d08[_0x0862('0x5c')]);}})[_0x0862('0x36')](respondWithResult(_0x184362,null))[_0x0862('0x55')](handleError(_0x184362,null));};exports['getAnswers']=function(_0x41748e,_0x45718a,_0x5b3fb1){var _0x178d7b={'raw':![],'where':{}};var _0x2118f7={};var _0x3e2c2e={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0862('0x6b')]({'where':{'id':_0x41748e[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x45718a,null))[_0x0862('0x36')](function(_0x189e0d){if(_0x189e0d){_0x2118f7[_0x0862('0x43')]=_[_0x0862('0x45')](db[_0x0862('0x71')]['rawAttributes']);_0x2118f7[_0x0862('0x44')]=_['keys'](_0x41748e[_0x0862('0x44')]);_0x2118f7[_0x0862('0x46')]=_['intersection'](_0x2118f7[_0x0862('0x43')],_0x2118f7[_0x0862('0x44')]);_0x178d7b[_0x0862('0x48')]=_[_0x0862('0x47')](_0x2118f7[_0x0862('0x43')],qs['fields'](_0x41748e[_0x0862('0x44')][_0x0862('0x49')]));_0x178d7b[_0x0862('0x48')]=_0x178d7b[_0x0862('0x48')][_0x0862('0x6c')]?_0x178d7b[_0x0862('0x48')]:_0x2118f7[_0x0862('0x43')];if(!_0x41748e['query']['hasOwnProperty'](_0x0862('0x6d'))){_0x178d7b[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x41748e['query'][_0x0862('0x30')]);_0x178d7b[_0x0862('0x2f')]=qs['offset'](_0x41748e[_0x0862('0x44')][_0x0862('0x2f')]);}_0x178d7b[_0x0862('0x4b')]=qs['sort'](_0x41748e[_0x0862('0x44')][_0x0862('0x4c')]);_0x178d7b['where']=qs[_0x0862('0x46')](_['pick'](_0x41748e[_0x0862('0x44')],_0x2118f7[_0x0862('0x46')]));_0x178d7b[_0x0862('0x4d')][_0x0862('0x68')]=_0x189e0d['id'];if(_0x41748e[_0x0862('0x44')][_0x0862('0x4f')]){_0x178d7b[_0x0862('0x4d')]=_[_0x0862('0x50')](_0x178d7b[_0x0862('0x4d')],{'$or':_['map'](_0x178d7b[_0x0862('0x48')],function(_0x2f147){var _0x223b5c={};_0x223b5c[_0x2f147]={'$like':'%'+_0x41748e[_0x0862('0x44')][_0x0862('0x4f')]+'%'};return _0x223b5c;})});}_0x178d7b=_['merge']({},_0x178d7b,_0x41748e[_0x0862('0x52')]);return db[_0x0862('0x71')][_0x0862('0x2e')]({'where':_0x178d7b[_0x0862('0x4d')]})['then'](function(_0x1a7755){_0x3e2c2e[_0x0862('0x2e')]=_0x1a7755;if(_0x41748e['query'][_0x0862('0x58')]){_0x178d7b[_0x0862('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0862('0x53')](_0x178d7b);})['then'](function(_0x1c6137){_0x3e2c2e[_0x0862('0x54')]=_0x1c6137;return _0x3e2c2e;});}})[_0x0862('0x36')](respondWithFilteredResult(_0x45718a,_0x178d7b))['catch'](handleError(_0x45718a,null));};exports[_0x0862('0x72')]=function(_0x44746f,_0x2817e7,_0x24c79d){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x44746f[_0x0862('0x57')]['id']}})['then'](handleEntityNotFound(_0x2817e7,null))[_0x0862('0x36')](function(_0x9c4c84){if(_0x9c4c84){return _0x9c4c84[_0x0862('0x72')](_0x44746f['query'][_0x0862('0x6f')]);}})[_0x0862('0x36')](respondWithStatusCode(_0x2817e7,null))['catch'](handleError(_0x2817e7,null));};exports[_0x0862('0x73')]=function(_0x21bed7,_0x1a52eb,_0x89d43d){var _0x24f464={'channel':_0x0862('0x74')};var _0x32a0f9=[];var _0x2508e6=[];var _0x2495fc={};return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x21bed7['params']['id']},'include':[{'model':db[_0x0862('0x75')],'as':_0x0862('0x76')}]})[_0x0862('0x36')](handleEntityNotFound(_0x1a52eb,null))[_0x0862('0x36')](function(_0x42ed49){_0x24f464[_0x0862('0x77')]=_0x42ed49;_0x24f464[_0x0862('0x78')]=_['orderBy'](_0x42ed49['Applications'],['priority'],[_0x0862('0x79')]);if(_0x24f464[_0x0862('0x77')][_0x0862('0x76')]){delete _0x24f464['account'][_0x0862('0x76')];}return db[_0x0862('0x7a')][_0x0862('0x66')]();})['then'](function(_0x4b5a8b){if(!_0x4b5a8b){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))]('no\x20available\x20attributes');}_0x32a0f9=_[_0x0862('0x7d')](_['keys'](_0x4b5a8b),[_0x0862('0x7e'),'updatedAt']);_0x2508e6=_['difference'](_[_0x0862('0x45')](_0x4b5a8b),[_0x0862('0x7e'),_0x0862('0x7f'),'CompanyId',_0x0862('0x80')]);_0x24f464['body']={'mapKey':_0x0862('0x81')};if(_0x24f464[_0x0862('0x77')][_0x0862('0x41')]){switch(_0x24f464['account'][_0x0862('0x41')]){case _0x0862('0x82'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x84')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x85')];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x87')];break;case _0x0862('0x88'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]='+'+_0x21bed7[_0x0862('0x5c')][_0x0862('0x89')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x8a')];break;case _0x0862('0x8b'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x83')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x29')];break;case'clicksend':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x83')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')]['body'];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7['body'][_0x0862('0x8c')];break;case _0x0862('0x8d'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')]['From'];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x8e')];_0x24f464[_0x0862('0x5c')]['messageId']=_0x21bed7['body'][_0x0862('0x8f')];break;case _0x0862('0x90'):_0x24f464['body']['from']='+'+_0x21bed7[_0x0862('0x5c')][_0x0862('0x91')][0x0][_0x0862('0x83')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7['body']['results'][0x0][_0x0862('0x8a')];_0x24f464['body'][_0x0862('0x86')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x91')][0x0][_0x0862('0x86')];break;case _0x0862('0x92'):_0x24f464[_0x0862('0x5c')]['from']=_0x21bed7[_0x0862('0x5c')][_0x0862('0x93')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')]['segmentedMessage']['message'];break;case _0x0862('0x94'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x95')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x8a')];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7['body'][_0x0862('0x96')];break;case'intelepeer':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')]['from'];_0x24f464['body']['body']=_0x21bed7[_0x0862('0x5c')]['message'];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7['body'][_0x0862('0x97')];break;}}if(_0x24f464['body']['id']){delete _0x24f464[_0x0862('0x5c')]['id'];}if(_[_0x0862('0x98')](_0x24f464[_0x0862('0x5c')][_0x0862('0x83')])){throw new db['Sequelize'][(_0x0862('0x7c'))](_0x0862('0x99'));}if(_[_0x0862('0x98')](_0x24f464['body'][_0x0862('0x5c')])||_0x24f464['body']['body']===''){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0862('0x98')](_0x24f464['body'][_0x0862('0x9a')])){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))](_0x0862('0x9b')+_0x2508e6);}if(!_[_0x0862('0x9c')](_0x2508e6,_0x24f464[_0x0862('0x5c')][_0x0862('0x9a')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2508e6);}_0x2495fc[_0x24f464[_0x0862('0x5c')][_0x0862('0x9a')]]=_0x24f464[_0x0862('0x5c')][_0x0862('0x83')];return db['CmList'][_0x0862('0x5a')]({'where':{'id':_0x24f464[_0x0862('0x77')][_0x0862('0x80')]},'include':[{'model':db[_0x0862('0x7a')],'as':'Contacts','where':_0x2495fc,'limit':0x1,'order':[[_0x0862('0x7f'),_0x0862('0x9d')]]}]});})[_0x0862('0x36')](handleEntityNotFound(_0x1a52eb,null))[_0x0862('0x36')](function(_0x334eca){if(_0x334eca){_0x24f464[_0x0862('0x9e')]=_[_0x0862('0x9f')](_0x334eca,['Contacts']);if(_0x334eca[_0x0862('0xa0')][_0x0862('0x6c')]){return _0x334eca[_0x0862('0xa0')][0x0];}var _0x22047b=_[_0x0862('0xa1')](_0x24f464['body'],{'firstName':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')],'ListId':_0x334eca['id']});_0x22047b[_0x24f464['body'][_0x0862('0x9a')]]=_0x24f464[_0x0862('0x5c')][_0x0862('0x83')];return db[_0x0862('0x7a')][_0x0862('0x5b')](_0x22047b,{'fields':_0x32a0f9,'raw':!![]});}})[_0x0862('0x36')](handleEntityNotFound(_0x1a52eb,null))[_0x0862('0x36')](function(_0x721d7f){if(_0x721d7f){_0x24f464[_0x0862('0xa2')]=_0x721d7f;var _0x1c1d81={'ContactId':_0x721d7f['id'],'phone':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')],'SmsAccountId':_0x21bed7[_0x0862('0x57')]['id']};var _0x45e544={'ContactId':_0x721d7f['id'],'SmsAccountId':_0x21bed7[_0x0862('0x57')]['id'],'closed':![]};return db[_0x0862('0xa3')][_0x0862('0x5a')]({'where':_0x45e544})[_0x0862('0x36')](function(_0x4cb2c5){if(_0x4cb2c5){return[_0x4cb2c5,![]];}return db[_0x0862('0xa3')][_0x0862('0x5b')](_0x1c1d81)['then'](function(_0x4eccbf){return[_0x4eccbf,!![]];});});}})[_0x0862('0xa4')](function(_0x688951,_0x156fc5){_0x24f464[_0x0862('0xa5')]=_0x688951[_0x0862('0x5e')]({'plain':!![]});_0x24f464[_0x0862('0xa5')][_0x0862('0xa6')]=![];if(_0x156fc5){if(_0x24f464[_0x0862('0x77')][_0x0862('0xa7')]){_0x24f464[_0x0862('0x78')][_0x0862('0xa8')]({'id':0x0,'priority':_0x24f464[_0x0862('0x78')][_0x0862('0x6c')]+0x1,'app':_0x0862('0xa9'),'appdata':_0x0862('0xaa'),'interval':'*,*,*,*'});}_0x24f464[_0x0862('0xa5')][_0x0862('0xa6')]=!![];}return db[_0x0862('0xab')]['create']({'phone':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')],'messageId':_0x24f464[_0x0862('0x5c')]['messageId'],'body':_0x24f464[_0x0862('0x5c')]['body'],'SmsAccountId':_0x21bed7[_0x0862('0x57')]['id'],'SmsInteractionId':_0x688951['id'],'direction':'in','ContactId':_0x688951[_0x0862('0xac')],'AttachmentId':_0x24f464['body'][_0x0862('0xad')]});})[_0x0862('0x36')](function(_0x2c2222){_0x24f464[_0x0862('0x29')]=_0x2c2222;if(_0x24f464['interaction'][_0x0862('0xae')]){return db[_0x0862('0xaf')][_0x0862('0x5a')]({'attributes':['id',_0x0862('0x39')],'where':{'id':_0x24f464[_0x0862('0xa5')][_0x0862('0xae')]}})[_0x0862('0x36')](function(_0x37deda){if(_0x37deda){_0x24f464[_0x0862('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0862('0xb0'),'appdata':_0x37deda[_0x0862('0x39')]+','+(_0x24f464[_0x0862('0x77')][_0x0862('0xb1')]||0xa),'interval':_0x0862('0xb2')});}return respondWithRpcPromise(_0x0862('0xb3'),_0x0862('0xb4'),_0x24f464);});}return respondWithRpcPromise(_0x0862('0xb3'),'startRouting',_0x24f464);})['then'](function(_0x38c278){if(_0x38c278){var _0x18a608=0xc8;var _0x43108d=_0x0862('0xb5');logger[_0x0862('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x43108d,_0x18a608,_0x0862('0xb6'));logger[_0x0862('0x24')](_0x0862('0xb7'),_0x43108d,_0x18a608,_0x0862('0xb6'),JSON[_0x0862('0x26')](_0x38c278));if(_0x24f464[_0x0862('0x77')][_0x0862('0x41')]===_0x0862('0x82')){return _0x1a52eb[_0x0862('0x2c')](_0x18a608)[_0x0862('0x31')]('Content-Type','text/xml')[_0x0862('0x3a')]('\x0a');}else{return _0x1a52eb[_0x0862('0x2c')](_0x18a608)['json'](_0x38c278);}}})[_0x0862('0x55')](handleError(_0x1a52eb,null));};exports['addApplications']=function(_0x1b3772,_0xf56a07,_0x3c3e1a){return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0x1b3772[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0xf56a07,null))[_0x0862('0x36')](function(_0x3df58a){if(_0x3df58a){return db[_0x0862('0xb8')][_0x0862('0xb9')](function(_0x286736){return db['SmsApplication'][_0x0862('0x37')]({'where':{'SmsAccountId':_0x1b3772[_0x0862('0x57')]['id']},'transaction':_0x286736})[_0x0862('0x36')](function(_0x45a0f0){var _0x32eab7=_[_0x0862('0x3d')](_0x1b3772[_0x0862('0x5c')],function(_0x40cca2){_0x40cca2[_0x0862('0x68')]=_0x1b3772[_0x0862('0x57')]['id'];return _0x40cca2;});return db[_0x0862('0x75')][_0x0862('0xba')](_0x32eab7,{'transaction':_0x286736});});})[_0x0862('0x36')](function(){return db[_0x0862('0x75')][_0x0862('0xbb')]({'where':{'SmsAccountId':_0x1b3772[_0x0862('0x57')]['id']},'order':_0x0862('0xbc')});});}})[_0x0862('0x36')](respondWithResult(_0xf56a07,null))[_0x0862('0x55')](handleError(_0xf56a07,null));};exports['getApplications']=function(_0x460a79,_0x1a96bf,_0x2e78e1){var _0x408874={};var _0x2f5be0={};var _0x416bbb;var _0x32609e;return db[_0x0862('0x3e')]['findOne']({'where':{'id':_0x460a79[_0x0862('0x57')]['id']}})['then'](handleEntityNotFound(_0x1a96bf,null))[_0x0862('0x36')](function(_0x5dde3e){if(_0x5dde3e){_0x416bbb=_0x5dde3e;_0x2f5be0['model']=_['keys'](db[_0x0862('0x75')][_0x0862('0x3f')]);_0x2f5be0[_0x0862('0x44')]=_[_0x0862('0x45')](_0x460a79['query']);_0x2f5be0[_0x0862('0x46')]=_[_0x0862('0x47')](_0x2f5be0[_0x0862('0x43')],_0x2f5be0[_0x0862('0x44')]);_0x408874[_0x0862('0x48')]=_[_0x0862('0x47')](_0x2f5be0[_0x0862('0x43')],qs[_0x0862('0x49')](_0x460a79[_0x0862('0x44')][_0x0862('0x49')]));_0x408874[_0x0862('0x48')]=_0x408874[_0x0862('0x48')][_0x0862('0x6c')]?_0x408874[_0x0862('0x48')]:_0x2f5be0[_0x0862('0x43')];_0x408874[_0x0862('0x4b')]=qs[_0x0862('0x4c')](_0x460a79[_0x0862('0x44')]['sort']);_0x408874[_0x0862('0x4d')]=qs[_0x0862('0x46')](_[_0x0862('0x4e')](_0x460a79[_0x0862('0x44')],_0x2f5be0[_0x0862('0x46')]));if(_0x460a79[_0x0862('0x44')]['filter']){_0x408874[_0x0862('0x4d')]=_['merge'](_0x408874[_0x0862('0x4d')],{'$or':_[_0x0862('0x3d')](_0x408874['attributes'],function(_0x1b7910){var _0x3cfd15={};_0x3cfd15[_0x1b7910]={'$like':'%'+_0x460a79['query'][_0x0862('0x4f')]+'%'};return _0x3cfd15;})});}_0x408874=_['merge']({},_0x408874,_0x460a79[_0x0862('0x52')]);return _0x416bbb[_0x0862('0xbd')](_0x408874);}})[_0x0862('0x36')](function(_0x512c59){if(_0x512c59){_0x32609e=_0x512c59[_0x0862('0x6c')];if(!_0x460a79[_0x0862('0x44')][_0x0862('0x4a')](_0x0862('0x6d'))){_0x408874[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x460a79[_0x0862('0x44')][_0x0862('0x30')]);_0x408874[_0x0862('0x2f')]=qs['offset'](_0x460a79[_0x0862('0x44')][_0x0862('0x2f')]);}return _0x416bbb['getApplications'](_0x408874);}})[_0x0862('0x36')](function(_0x162b7b){if(_0x162b7b){return _0x162b7b?{'count':_0x32609e,'rows':_0x162b7b}:null;}})[_0x0862('0x36')](respondWithResult(_0x1a96bf,null))[_0x0862('0x55')](handleError(_0x1a96bf,null));};exports['getInteractions']=function(_0xba722d,_0x3a3ddd,_0x26e71f){var _0x1db4a7={'raw':![],'where':{}};var _0x59979c={};var _0x158517={'count':0x0,'rows':[]};return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0xba722d['params']['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x3a3ddd,null))[_0x0862('0x36')](function(_0x361c9b){if(_0x361c9b){_0x59979c[_0x0862('0x43')]=_['keys'](db['SmsInteraction'][_0x0862('0x3f')]);_0x59979c['query']=_['keys'](_0xba722d[_0x0862('0x44')]);_0x59979c[_0x0862('0x46')]=_[_0x0862('0x47')](_0x59979c['model'],_0x59979c[_0x0862('0x44')]);_0x1db4a7[_0x0862('0x48')]=_['intersection'](_0x59979c['model'],qs[_0x0862('0x49')](_0xba722d[_0x0862('0x44')][_0x0862('0x49')]));_0x1db4a7['attributes']=_0x1db4a7['attributes']['length']?_0x1db4a7[_0x0862('0x48')]:_0x59979c[_0x0862('0x43')];if(!_0xba722d[_0x0862('0x44')][_0x0862('0x4a')](_0x0862('0x6d'))){_0x1db4a7[_0x0862('0x30')]=qs[_0x0862('0x30')](_0xba722d['query'][_0x0862('0x30')]);_0x1db4a7[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0xba722d[_0x0862('0x44')][_0x0862('0x2f')]);}_0x1db4a7['order']=qs[_0x0862('0x4c')](_0xba722d['query'][_0x0862('0x4c')]);_0x1db4a7['where']=qs[_0x0862('0x46')](_[_0x0862('0x4e')](_0xba722d['query'],_0x59979c['filters']));_0x1db4a7[_0x0862('0x4d')][_0x0862('0x68')]=_0x361c9b['id'];if(_0xba722d[_0x0862('0x44')][_0x0862('0x4f')]){_0x1db4a7['where']=_[_0x0862('0x50')](_0x1db4a7[_0x0862('0x4d')],{'$or':_['map'](_0x1db4a7[_0x0862('0x48')],function(_0x3220bf){var _0x30fbac={};_0x30fbac[_0x3220bf]={'$like':'%'+_0xba722d[_0x0862('0x44')][_0x0862('0x4f')]+'%'};return _0x30fbac;})});}_0x1db4a7=_[_0x0862('0x50')]({},_0x1db4a7,_0xba722d[_0x0862('0x52')]);return db[_0x0862('0xa3')][_0x0862('0x2e')]({'where':_0x1db4a7[_0x0862('0x4d')]})[_0x0862('0x36')](function(_0x584e35){_0x158517[_0x0862('0x2e')]=_0x584e35;if(_0xba722d[_0x0862('0x44')][_0x0862('0x58')]){_0x1db4a7[_0x0862('0x59')]=[{'model':db[_0x0862('0x7a')],'as':_0x0862('0xbe'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x0862('0x39'),'fullname',_0x0862('0xbf')],'required':![]},{'model':db[_0x0862('0xc0')],'as':'Tags','attributes':['id','name','color'],'where':_0xba722d['query'][_0x0862('0xc1')]?{'id':_0xba722d[_0x0862('0x44')][_0x0862('0xc1')]}:undefined,'required':_0xba722d[_0x0862('0x44')]['tag']?!![]:![]}];}return db[_0x0862('0xa3')]['findAll'](_0x1db4a7);})[_0x0862('0x36')](function(_0x4328e1){_0x158517[_0x0862('0x54')]=_0x4328e1;return _0x158517;});}})['then'](respondWithFilteredResult(_0x3a3ddd,_0x1db4a7))[_0x0862('0x55')](handleError(_0x3a3ddd,null));};exports[_0x0862('0x3a')]=function(_0x58bf90,_0x28bf33,_0x7f913f){var _0xc9be53,_0x4e9774,_0x4f6842;if(_['isNil'](_0x58bf90['body'][_0x0862('0x5c')])||_0x58bf90['body']['body']===''){throw new db['Sequelize'][(_0x0862('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0862('0x98')](_0x58bf90[_0x0862('0x5c')]['to'])){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))](_0x0862('0xc2'));}_0xc9be53=_0x58bf90[_0x0862('0x5c')]['to'];return db['SmsAccount'][_0x0862('0x5a')]({'where':{'id':_0x58bf90['params']['id']},'include':[{'model':db[_0x0862('0xc3')],'as':_0x0862('0xc4'),'include':[{'model':db[_0x0862('0x7a')],'as':'Contacts','where':{'mobile':_0xc9be53},'limit':0x1,'order':[['updatedAt',_0x0862('0x9d')]]}]}]})[_0x0862('0x36')](handleEntityNotFound(_0x28bf33,null))[_0x0862('0x36')](function(_0x4d57f6){if(_0x4d57f6&&_0x4d57f6[_0x0862('0xc4')]){_0x4e9774=_0x4d57f6[_0x0862('0x5e')]({'plain':!![]});if(_0x4e9774['List']&&_0x4e9774[_0x0862('0xc4')]['Contacts'][_0x0862('0x6c')]){return _0x4e9774['List'][_0x0862('0xa0')][0x0];}return db[_0x0862('0x7a')][_0x0862('0x5b')](_['defaults'](_0x58bf90[_0x0862('0x5c')],{'firstName':_0xc9be53,'mobile':_0xc9be53,'phone':_0xc9be53,'ListId':_0x4e9774[_0x0862('0x80')]}));}})[_0x0862('0x36')](handleEntityNotFound(_0x28bf33,null))['then'](function(_0x18f596){if(_0x18f596){_0x4f6842=_0x18f596;return db[_0x0862('0xa3')][_0x0862('0x5a')]({'where':{'ContactId':_0x4f6842['id'],'closed':![],'SmsAccountId':_0x4e9774['id']}})[_0x0862('0x36')](function(_0x35e3c2){if(_0x35e3c2){return[_0x35e3c2,![]];}return db['SmsInteraction'][_0x0862('0x5b')]({'UserId':_0x58bf90['user']['id'],'ContactId':_0x4f6842['id'],'SmsAccountId':_0x4e9774['id'],'phone':_0xc9be53,'firstMsgDirection':_0x0862('0xc5'),'Messages':[_['merge'](_0x58bf90[_0x0862('0x5c')],{'read':![],'body':_0x58bf90['body']['body'],'phone':_0xc9be53,'SmsAccountId':_0x4e9774['id'],'UserId':_0x58bf90['user']['id'],'ContactId':_0x4f6842['id']})]},{'include':[{'model':db[_0x0862('0xab')],'as':'Messages'}]})[_0x0862('0x36')](function(_0x14c28f){return[_0x14c28f,!![]];});});}})[_0x0862('0xa4')](function(_0x31e81e,_0x3ff0f9){if(_0x3ff0f9){return _0x31e81e;}return db[_0x0862('0xab')][_0x0862('0x5b')](_['merge'](_0x58bf90[_0x0862('0x5c')],{'read':![],'body':_0x58bf90[_0x0862('0x5c')][_0x0862('0x5c')],'phone':_0xc9be53,'SmsAccountId':_0x4e9774['id'],'SmsInteractionId':_0x31e81e['id'],'UserId':_0x58bf90[_0x0862('0x5d')]['id'],'ContactId':_0x4f6842['id']}))['then'](function(_0x588b0e){_0x31e81e[_0x0862('0xc6')][_0x0862('0xc7')]=[];_0x31e81e[_0x0862('0xc6')][_0x0862('0xc7')][_0x0862('0xa8')](_0x588b0e[_0x0862('0xc6')]);return _0x31e81e;});})[_0x0862('0x36')](respondWithResult(_0x28bf33,null))[_0x0862('0x55')](handleError(_0x28bf33,null));};exports['status']=function(_0x270aac,_0x3f7511,_0x363eaa){if(_0x270aac[_0x0862('0x5c')]['id']){delete _0x270aac['body']['id'];}console[_0x0862('0xc8')](_0x0862('0xc9'),_0x270aac[_0x0862('0x5c')]);var _0x1266ca,_0x15f51c,_0x48ba80;return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x270aac[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x3f7511,null))[_0x0862('0x36')](function(_0x25664b){if(_0x25664b){_0x48ba80=_0x25664b;logger[_0x0862('0x24')](_0x0862('0x25'),'status',_0x0862('0xca'),_0x25664b[_0x0862('0x41')],util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));switch(_0x25664b[_0x0862('0x41')]){case _0x0862('0x88'):if(_0x270aac[_0x0862('0x5c')][_0x0862('0xcc')]&&_0x270aac['body'][_0x0862('0x2c')]){_0x15f51c=_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x270aac['body'][_0x0862('0xcc')]}});}break;case'connectel':if(_0x270aac[_0x0862('0x5c')]['requestid']&&_0x270aac[_0x0862('0x5c')][_0x0862('0xcd')]){_0x15f51c=_0x270aac[_0x0862('0x5c')][_0x0862('0xcd')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0xce')]}});}break;case _0x0862('0xcf'):if(_0x270aac[_0x0862('0x5c')]['message_id']&&_0x270aac['body'][_0x0862('0xd0')]){_0x15f51c=_0x270aac[_0x0862('0x5c')]['status_code'];return db[_0x0862('0xab')]['find']({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0x8c')]}});}break;case _0x0862('0x90'):var _0xfafd13=_0x270aac[_0x0862('0x5c')][_0x0862('0x91')][0x0];if(_0xfafd13['messageId']&&_0xfafd13['status'][_0x0862('0xd1')]==='DELIVERED'){_0x15f51c=_0xfafd13['status'][_0x0862('0xd1')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0xfafd13[_0x0862('0x86')]}});}break;case'clickatell':if(_0x270aac[_0x0862('0x5c')]['messageId']&&_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')]){_0x15f51c=_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0x86')]}});}break;case _0x0862('0xd2'):if(_0x270aac[_0x0862('0x5c')]['redif']&&_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')]){_0x15f51c=_0x270aac[_0x0862('0x5c')]['status'];return db[_0x0862('0xab')]['find']({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0xd3')]}});}break;}}})[_0x0862('0x36')](handleEntityNotFound(_0x3f7511,null))[_0x0862('0x36')](function(_0x8fafc8){if(_0x8fafc8){_0x1266ca=_0x8fafc8;switch(_0x48ba80[_0x0862('0x41')]){case _0x0862('0x88'):if(_0x15f51c===_0x0862('0xd4')){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger[_0x0862('0x27')](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x88'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x15f51c==='1'){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger['error'](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x88'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x270aac[_0x0862('0x5c')][_0x0862('0xd5')]&&_0x15f51c>=0xc8&&_0x15f51c<=0xce){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger[_0x0862('0x27')](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0xcf'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x0862('0x90'):var _0x409f83=_0x270aac[_0x0862('0x5c')][_0x0862('0x91')][0x0];if(_0x409f83['status'][_0x0862('0xd1')]==='DELIVERED'){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger['error'](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x90'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x0862('0x94'):if(_0x15f51c==_0x0862('0xd6')||_0x15f51c==_0x0862('0xd7')){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger['error'](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x94'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x0862('0xd2'):if(_0x15f51c===_0x0862('0xd8')||_0x15f51c==='ACCEPTD'){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger[_0x0862('0x27')](_0x0862('0x25'),'status','intelepeer',util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1266ca;}})['then'](respondWithResult(_0x3f7511,null))[_0x0862('0x55')](handleError(_0x3f7511,null));};exports['statusGet']=function(_0x4f366b,_0xb0dbc1,_0x2672e0){var _0x3949ad,_0x4a64db,_0x184ca7;return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x4f366b['params']['id']}})[_0x0862('0x36')](handleEntityNotFound(_0xb0dbc1,null))[_0x0862('0x36')](function(_0x5e23dc){if(_0x5e23dc){_0x184ca7=_0x5e23dc;logger[_0x0862('0x24')](_0x0862('0x25'),_0x0862('0x2c'),'received\x20delivery\x20report\x20from',_0x5e23dc['type'],util[_0x0862('0xcb')](_0x4f366b['query'],{'showHidden':![],'depth':null}));switch(_0x5e23dc['type']){case _0x0862('0x92'):if(_0x4f366b[_0x0862('0x44')][_0x0862('0xd9')]&&_0x4f366b['query'][_0x0862('0xda')]){_0x4a64db=_0x4f366b['query'][_0x0862('0xda')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x4f366b[_0x0862('0x44')]['message-id']}});}break;}}})[_0x0862('0x36')](handleEntityNotFound(_0xb0dbc1,null))['then'](function(_0x5c8fce){if(_0x5c8fce){_0x3949ad=_0x5c8fce;switch(_0x184ca7[_0x0862('0x41')]){case _0x0862('0x92'):if(_0x4a64db==='2'||_0x4a64db==='6'){return _0x3949ad['update']({'read':!![]});}else{logger['error'](_0x0862('0x25'),'status','csc',util[_0x0862('0xcb')](_0x4f366b[_0x0862('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x3949ad;}})[_0x0862('0x36')](respondWithResult(_0xb0dbc1,null))[_0x0862('0x55')](handleError(_0xb0dbc1,null));};exports[_0x0862('0xdb')]=function(_0x5d0dc0,_0x31f7ae,_0x479064){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x5d0dc0[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x31f7ae,null))[_0x0862('0x36')](function(_0x14e503){if(_0x14e503){return _0x14e503['addAgents'](_0x5d0dc0[_0x0862('0x5c')][_0x0862('0x6f')],_[_0x0862('0x9f')](_0x5d0dc0[_0x0862('0x5c')],['ids','id'])||{})[_0x0862('0xa4')](function(_0x3744cb){for(var _0x2ea277=0x0;_0x2ea277<_0x5d0dc0['body'][_0x0862('0x6f')][_0x0862('0x6c')];_0x2ea277+=0x1){socket[_0x0862('0xdc')](_0x0862('0xdd'),{'UserId':_0x5d0dc0[_0x0862('0x5c')][_0x0862('0x6f')][_0x2ea277],'SmsAccountId':_0x5d0dc0[_0x0862('0x57')]['id']});}return _0x3744cb;});}})[_0x0862('0x36')](respondWithResult(_0x31f7ae,null))[_0x0862('0x55')](handleError(_0x31f7ae,null));};exports[_0x0862('0xde')]=function(_0x1d4339,_0x5706e0,_0x263696){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x1d4339[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x5706e0,null))[_0x0862('0x36')](function(_0x3f84da){if(_0x3f84da){return _0x3f84da[_0x0862('0xde')](_0x1d4339[_0x0862('0x44')][_0x0862('0x6f')])[_0x0862('0x36')](function(){if(_[_0x0862('0xdf')](_0x1d4339[_0x0862('0x44')][_0x0862('0x6f')])){for(var _0x33088a=0x0;_0x33088a<_0x1d4339[_0x0862('0x44')]['ids'][_0x0862('0x6c')];_0x33088a+=0x1){socket[_0x0862('0xdc')](_0x0862('0xe0'),{'UserId':Number(_0x1d4339['query'][_0x0862('0x6f')][_0x33088a]),'SmsAccountId':Number(_0x1d4339[_0x0862('0x57')]['id'])});}}else{socket[_0x0862('0xdc')](_0x0862('0xe0'),{'UserId':Number(_0x1d4339[_0x0862('0x44')][_0x0862('0x6f')]),'SmsAccountId':Number(_0x1d4339[_0x0862('0x57')]['id'])});}});}})[_0x0862('0x36')](respondWithStatusCode(_0x5706e0,null))['catch'](handleError(_0x5706e0,null));};exports['getAgents']=function(_0x2ab55d,_0x4b1b6f,_0x22c318){var _0x227ff0={};var _0x4ccbdb={};var _0x489b5b;var _0x3d8bd3;return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0x2ab55d[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x4b1b6f,null))['then'](function(_0x32f850){if(_0x32f850){_0x489b5b=_0x32f850;_0x4ccbdb[_0x0862('0x43')]=_[_0x0862('0x45')](db['User'][_0x0862('0x3f')]);_0x4ccbdb[_0x0862('0x44')]=_[_0x0862('0x45')](_0x2ab55d[_0x0862('0x44')]);_0x4ccbdb[_0x0862('0x46')]=_[_0x0862('0x47')](_0x4ccbdb[_0x0862('0x43')],_0x4ccbdb['query']);_0x227ff0[_0x0862('0x48')]=_['intersection'](_0x4ccbdb[_0x0862('0x43')],qs[_0x0862('0x49')](_0x2ab55d['query'][_0x0862('0x49')]));_0x227ff0[_0x0862('0x48')]=_0x227ff0[_0x0862('0x48')][_0x0862('0x6c')]?_0x227ff0[_0x0862('0x48')]:_0x4ccbdb[_0x0862('0x43')];_0x227ff0[_0x0862('0x4b')]=qs[_0x0862('0x4c')](_0x2ab55d[_0x0862('0x44')]['sort']);_0x227ff0[_0x0862('0x4d')]=qs['filters'](_[_0x0862('0x4e')](_0x2ab55d[_0x0862('0x44')],_0x4ccbdb[_0x0862('0x46')]));if(_0x2ab55d[_0x0862('0x44')][_0x0862('0x4f')]){_0x227ff0[_0x0862('0x4d')]=_[_0x0862('0x50')](_0x227ff0['where'],{'$or':_['map'](_0x227ff0['attributes'],function(_0x328477){var _0x1cc416={};_0x1cc416[_0x328477]={'$like':'%'+_0x2ab55d['query'][_0x0862('0x4f')]+'%'};return _0x1cc416;})});}_0x227ff0=_[_0x0862('0x50')]({},_0x227ff0,_0x2ab55d[_0x0862('0x52')]);return _0x489b5b[_0x0862('0xe1')](_0x227ff0);}})[_0x0862('0x36')](function(_0x3a3f0b){if(_0x3a3f0b){_0x3d8bd3=_0x3a3f0b[_0x0862('0x6c')];if(!_0x2ab55d[_0x0862('0x44')]['hasOwnProperty'](_0x0862('0x6d'))){_0x227ff0['limit']=qs[_0x0862('0x30')](_0x2ab55d[_0x0862('0x44')]['limit']);_0x227ff0[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0x2ab55d[_0x0862('0x44')][_0x0862('0x2f')]);}return _0x489b5b[_0x0862('0xe1')](_0x227ff0);}})[_0x0862('0x36')](function(_0x3370d7){if(_0x3370d7){return _0x3370d7?{'count':_0x3d8bd3,'rows':_0x3370d7}:null;}})['then'](respondWithResult(_0x4b1b6f,null))[_0x0862('0x55')](handleError(_0x4b1b6f,null));}; \ No newline at end of file +var _0x3a8a=['userSmsAccount:remove','getAgents','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','findAll','rows','show','params','keys','fields','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','sort','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','results','csc','originatingAddress','segmentedMessage','clickatell','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','applications','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','List','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','DELIVERED','intelepeer','redif','groupName','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x3a8a,0x1c5));var _0xa3a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3a8a[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xa3a8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3a8('0x1'));var zipdir=require(_0xa3a8('0x2'));var jsonpatch=require(_0xa3a8('0x3'));var rp=require(_0xa3a8('0x4'));var moment=require(_0xa3a8('0x5'));var BPromise=require(_0xa3a8('0x6'));var Mustache=require(_0xa3a8('0x7'));var util=require(_0xa3a8('0x8'));var path=require(_0xa3a8('0x9'));var sox=require(_0xa3a8('0xa'));var csv=require(_0xa3a8('0xb'));var ejs=require(_0xa3a8('0xc'));var fs=require('fs');var _=require(_0xa3a8('0xd'));var squel=require(_0xa3a8('0xe'));var crypto=require(_0xa3a8('0xf'));var jsforce=require(_0xa3a8('0x10'));var deskjs=require(_0xa3a8('0x11'));var toCsv=require(_0xa3a8('0xb'));var querystring=require(_0xa3a8('0x12'));var Papa=require(_0xa3a8('0x13'));var Redis=require(_0xa3a8('0x14'));var authService=require(_0xa3a8('0x15'));var qs=require(_0xa3a8('0x16'));var as=require(_0xa3a8('0x17'));var hardwareService=require(_0xa3a8('0x18'));var logger=require(_0xa3a8('0x19'))(_0xa3a8('0x1a'));var utils=require(_0xa3a8('0x1b'));var config=require(_0xa3a8('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3a8('0x1d'))['db'];config[_0xa3a8('0x1e')]=_[_0xa3a8('0x1f')](config['redis'],{'host':_0xa3a8('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3a8('0x1e')]));require('./smsAccount.socket')[_0xa3a8('0x21')](socket);var jayson=require(_0xa3a8('0x22'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x27c2b6,_0x43fc6c,_0x3f7150,_0x5f12ba){return new BPromise(function(_0x832230,_0x3a99e7){var _0x21673e=_0x5f12ba||client;return _0x21673e['request'](_0x27c2b6,_0x3f7150)[_0xa3a8('0x23')](function(_0x45d803){logger[_0xa3a8('0x24')]('SmsAccount,\x20%s,\x20%s',_0x43fc6c,'request\x20sent');logger[_0xa3a8('0x25')](_0xa3a8('0x26'),_0x43fc6c,_0xa3a8('0x27'),JSON[_0xa3a8('0x28')](_0x45d803));if(_0x45d803[_0xa3a8('0x29')]){if(_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2a')]===0x1f4){logger['error'](_0xa3a8('0x2b'),_0x43fc6c,_0x45d803[_0xa3a8('0x29')]['message']);return _0x3a99e7(_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2c')]);}logger[_0xa3a8('0x29')](_0xa3a8('0x2b'),_0x43fc6c,_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2c')]);return _0x832230(_0x45d803[_0xa3a8('0x29')][_0xa3a8('0x2c')]);}else{logger['info'](_0xa3a8('0x2b'),_0x43fc6c,'request\x20sent');_0x832230(_0x45d803[_0xa3a8('0x2d')][_0xa3a8('0x2c')]);}})[_0xa3a8('0x2e')](function(_0x9376f4){logger['error'](_0xa3a8('0x2b'),_0x43fc6c,_0x9376f4);_0x3a99e7(_0x9376f4);});});}function respondWithStatusCode(_0x228069,_0xd18f9b){_0xd18f9b=_0xd18f9b||0xcc;return function(_0x4feaf6){if(_0x4feaf6){return _0x228069['sendStatus'](_0xd18f9b);}return _0x228069[_0xa3a8('0x2f')](_0xd18f9b)['end']();};}function respondWithResult(_0x45fede,_0x5df38d){_0x5df38d=_0x5df38d||0xc8;return function(_0x3428f5){if(_0x3428f5){return _0x45fede[_0xa3a8('0x2f')](_0x5df38d)[_0xa3a8('0x30')](_0x3428f5);}};}function respondWithFilteredResult(_0x27c916,_0x37c1f8){return function(_0x189b42){if(_0x189b42){var _0x4b6d05=_0x189b42[_0xa3a8('0x31')],_0x22c6cf=_0x37c1f8['offset'],_0x48e5e3=_0x37c1f8[_0xa3a8('0x32')]+_0x37c1f8[_0xa3a8('0x33')],_0x329894;if(_0x48e5e3>=_0x4b6d05){_0x48e5e3=_0x4b6d05;_0x329894=0xc8;}else{_0x329894=0xce;}_0x27c916[_0xa3a8('0x2f')](_0x329894);return _0x27c916['set'](_0xa3a8('0x34'),_0x22c6cf+'-'+_0x48e5e3+'/'+_0x4b6d05)[_0xa3a8('0x30')](_0x189b42);}return null;};}function patchUpdates(_0x5da73c){return function(_0x5c9cac){try{jsonpatch[_0xa3a8('0x35')](_0x5c9cac,_0x5da73c,!![]);}catch(_0x131604){return BPromise[_0xa3a8('0x36')](_0x131604);}return _0x5c9cac[_0xa3a8('0x37')]();};}function saveUpdates(_0x1bfbf5,_0x52b9a0){return function(_0xf37155){if(_0xf37155){return _0xf37155[_0xa3a8('0x38')](_0x1bfbf5)[_0xa3a8('0x23')](function(_0x3c1fbc){return _0x3c1fbc;});}return null;};}function removeEntity(_0x11cd82,_0x12e370){return function(_0x214f05){if(_0x214f05){return _0x214f05['destroy']()[_0xa3a8('0x23')](function(){var _0x5e7bef=_0x214f05[_0xa3a8('0x39')]({'plain':!![]});var _0x40017a=_0xa3a8('0x3a');return db[_0xa3a8('0x3b')][_0xa3a8('0x3c')]({'where':{'type':_0x40017a,'resourceId':_0x5e7bef['id']}})[_0xa3a8('0x23')](function(){return _0x214f05;});})[_0xa3a8('0x23')](function(){_0x11cd82[_0xa3a8('0x2f')](0xcc)[_0xa3a8('0x3d')]();});}};}function handleEntityNotFound(_0x42fe35,_0x310d14){return function(_0x414c7e){if(!_0x414c7e){_0x42fe35[_0xa3a8('0x3e')](0x194);}return _0x414c7e;};}function handleError(_0x682ff2,_0x35a7b4){_0x35a7b4=_0x35a7b4||0x1f4;return function(_0x5d263a){logger[_0xa3a8('0x29')](_0x5d263a[_0xa3a8('0x3f')]);if(_0x5d263a[_0xa3a8('0x40')]){delete _0x5d263a[_0xa3a8('0x40')];}_0x682ff2['status'](_0x35a7b4)[_0xa3a8('0x41')](_0x5d263a);};}exports[_0xa3a8('0x42')]=function(_0x30fbea,_0x38f62a){var _0x8151d5={'include':[{'model':db[_0xa3a8('0x43')],'as':'mandatoryDispositionPause'}]},_0x5c5570={},_0x11a134={'count':0x0,'rows':[]};var _0x2d3e49=_[_0xa3a8('0x44')](db[_0xa3a8('0x45')][_0xa3a8('0x46')],function(_0x17ba86){return{'name':_0x17ba86['fieldName'],'type':_0x17ba86[_0xa3a8('0x47')]['key']};});_0x5c5570[_0xa3a8('0x48')]=_[_0xa3a8('0x44')](_0x2d3e49,_0xa3a8('0x40'));_0x5c5570[_0xa3a8('0x49')]=_['keys'](_0x30fbea['query']);_0x5c5570[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x5c5570[_0xa3a8('0x48')],_0x5c5570[_0xa3a8('0x49')]);_0x8151d5[_0xa3a8('0x4c')]=_['intersection'](_0x5c5570[_0xa3a8('0x48')],qs['fields'](_0x30fbea[_0xa3a8('0x49')]['fields']));_0x8151d5[_0xa3a8('0x4c')]=_0x8151d5[_0xa3a8('0x4c')]['length']?_0x8151d5[_0xa3a8('0x4c')]:_0x5c5570['model'];if(!_0x30fbea['query'][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x8151d5[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x30fbea[_0xa3a8('0x49')]['limit']);_0x8151d5[_0xa3a8('0x32')]=qs['offset'](_0x30fbea[_0xa3a8('0x49')][_0xa3a8('0x32')]);}_0x8151d5[_0xa3a8('0x4f')]=qs['sort'](_0x30fbea[_0xa3a8('0x49')]['sort']);_0x8151d5[_0xa3a8('0x50')]=qs['filters'](_['pick'](_0x30fbea[_0xa3a8('0x49')],_0x5c5570[_0xa3a8('0x4a')]),_0x2d3e49);if(_0x30fbea[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x8151d5[_0xa3a8('0x50')]=_['merge'](_0x8151d5[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x2d3e49,function(_0x29dbc1){if(_0x29dbc1[_0xa3a8('0x47')]!=='VIRTUAL'){var _0x3bf311={};_0x3bf311[_0x29dbc1['name']]={'$like':'%'+_0x30fbea['query'][_0xa3a8('0x51')]+'%'};return _0x3bf311;}})});}_0x8151d5=_[_0xa3a8('0x52')]({},_0x8151d5,_0x30fbea[_0xa3a8('0x53')]);var _0x49a16c={'where':_0x8151d5[_0xa3a8('0x50')]};return db[_0xa3a8('0x45')][_0xa3a8('0x31')](_0x49a16c)[_0xa3a8('0x23')](function(_0x54e71c){_0x11a134['count']=_0x54e71c;if(_0x30fbea[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x8151d5['include']=[{'all':!![]}];}return db[_0xa3a8('0x45')][_0xa3a8('0x55')](_0x8151d5);})[_0xa3a8('0x23')](function(_0x869b6){_0x11a134[_0xa3a8('0x56')]=_0x869b6;return _0x11a134;})[_0xa3a8('0x23')](respondWithFilteredResult(_0x38f62a,_0x8151d5))[_0xa3a8('0x2e')](handleError(_0x38f62a,null));};exports[_0xa3a8('0x57')]=function(_0x1965d9,_0x22a1e2){var _0x460dfd={'raw':![],'where':{'id':_0x1965d9[_0xa3a8('0x58')]['id']},'include':[{'model':db[_0xa3a8('0x43')],'as':'mandatoryDispositionPause'}]},_0x4e8791={};_0x4e8791[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db[_0xa3a8('0x45')]['rawAttributes']);_0x4e8791[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x1965d9['query']);_0x4e8791['filters']=_['intersection'](_0x4e8791[_0xa3a8('0x48')],_0x4e8791['query']);_0x460dfd['attributes']=_['intersection'](_0x4e8791[_0xa3a8('0x48')],qs[_0xa3a8('0x5a')](_0x1965d9[_0xa3a8('0x49')][_0xa3a8('0x5a')]));_0x460dfd['attributes']=_0x460dfd[_0xa3a8('0x4c')][_0xa3a8('0x5b')]?_0x460dfd[_0xa3a8('0x4c')]:_0x4e8791['model'];if(_0x1965d9[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x460dfd[_0xa3a8('0x5c')]=[{'all':!![]}];}_0x460dfd=_['merge']({},_0x460dfd,_0x1965d9['options']);return db['SmsAccount'][_0xa3a8('0x5d')](_0x460dfd)['then'](handleEntityNotFound(_0x22a1e2,null))[_0xa3a8('0x23')](respondWithResult(_0x22a1e2,null))[_0xa3a8('0x2e')](handleError(_0x22a1e2,null));};exports[_0xa3a8('0x5e')]=function(_0x5b8057,_0xc9ee85){return db[_0xa3a8('0x45')][_0xa3a8('0x5e')](_0x5b8057['body'],{})[_0xa3a8('0x23')](function(_0x2f3534){var _0x3fac24=_0x5b8057[_0xa3a8('0x5f')][_0xa3a8('0x39')]({'plain':!![]});if(!_0x3fac24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fac24[_0xa3a8('0x60')]===_0xa3a8('0x5f')){var _0x340a90=_0x2f3534[_0xa3a8('0x39')]({'plain':!![]});var _0x92a0dd=_0xa3a8('0x3a');return db[_0xa3a8('0x61')][_0xa3a8('0x5d')]({'where':{'name':_0x92a0dd,'userProfileId':_0x3fac24[_0xa3a8('0x62')]},'raw':!![]})[_0xa3a8('0x23')](function(_0x2eef98){if(_0x2eef98&&_0x2eef98[_0xa3a8('0x63')]===0x0){return db[_0xa3a8('0x3b')][_0xa3a8('0x5e')]({'name':_0x340a90[_0xa3a8('0x40')],'resourceId':_0x340a90['id'],'type':_0x2eef98[_0xa3a8('0x40')],'sectionId':_0x2eef98['id']},{})[_0xa3a8('0x23')](function(){return _0x2f3534;});}else{return _0x2f3534;}})[_0xa3a8('0x2e')](function(_0x753c19){logger['error'](_0xa3a8('0x64'),_0x753c19);throw _0x753c19;});}return _0x2f3534;})[_0xa3a8('0x23')](respondWithResult(_0xc9ee85,0xc9))[_0xa3a8('0x2e')](handleError(_0xc9ee85,null));};exports[_0xa3a8('0x38')]=function(_0x18bcf8,_0x1b2517){if(_0x18bcf8['body']['id']){delete _0x18bcf8[_0xa3a8('0x65')]['id'];}return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x18bcf8[_0xa3a8('0x58')]['id']},'include':[{'model':db[_0xa3a8('0x43')],'as':'mandatoryDispositionPause'}]})[_0xa3a8('0x23')](handleEntityNotFound(_0x1b2517,null))[_0xa3a8('0x23')](saveUpdates(_0x18bcf8[_0xa3a8('0x65')],null))[_0xa3a8('0x23')](respondWithResult(_0x1b2517,null))[_0xa3a8('0x2e')](handleError(_0x1b2517,null));};exports[_0xa3a8('0x3c')]=function(_0x19acb6,_0x2d73da){return db[_0xa3a8('0x45')]['find']({'where':{'id':_0x19acb6[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x2d73da,null))[_0xa3a8('0x23')](removeEntity(_0x2d73da,null))[_0xa3a8('0x2e')](handleError(_0x2d73da,null));};exports[_0xa3a8('0x66')]=function(_0x30d3a8,_0x4b98c8){return db[_0xa3a8('0x45')][_0xa3a8('0x66')]()[_0xa3a8('0x23')](respondWithResult(_0x4b98c8,null))['catch'](handleError(_0x4b98c8,null));};exports[_0xa3a8('0x67')]=function(_0x1ad902,_0x112715,_0x4917e6){if(_0x1ad902[_0xa3a8('0x65')]['id']){delete _0x1ad902[_0xa3a8('0x65')]['id'];}return db['SmsAccount'][_0xa3a8('0x5d')]({'where':{'id':_0x1ad902[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x112715,null))[_0xa3a8('0x23')](function(_0x12cc30){if(_0x12cc30){_0x1ad902[_0xa3a8('0x65')][_0xa3a8('0x68')]=_0x12cc30['id'];return db[_0xa3a8('0x69')][_0xa3a8('0x5e')](_0x1ad902[_0xa3a8('0x65')]);}})['then'](respondWithResult(_0x112715,null))[_0xa3a8('0x2e')](handleError(_0x112715,null));};exports[_0xa3a8('0x6a')]=function(_0x53e376,_0x289d13,_0x2180fc){var _0x4d9474={'raw':![],'where':{}};var _0x11e2a2={};var _0x2c214f={'count':0x0,'rows':[]};return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x53e376['params']['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x289d13,null))[_0xa3a8('0x23')](function(_0x5e02bc){if(_0x5e02bc){_0x11e2a2[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db['Disposition'][_0xa3a8('0x46')]);_0x11e2a2[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x53e376[_0xa3a8('0x49')]);_0x11e2a2[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x11e2a2['model'],_0x11e2a2[_0xa3a8('0x49')]);_0x4d9474[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x11e2a2[_0xa3a8('0x48')],qs[_0xa3a8('0x5a')](_0x53e376['query'][_0xa3a8('0x5a')]));_0x4d9474[_0xa3a8('0x4c')]=_0x4d9474[_0xa3a8('0x4c')]['length']?_0x4d9474[_0xa3a8('0x4c')]:_0x11e2a2[_0xa3a8('0x48')];if(!_0x53e376[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x4d9474[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x53e376[_0xa3a8('0x49')]['limit']);_0x4d9474[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0x53e376['query'][_0xa3a8('0x32')]);}_0x4d9474['order']=qs[_0xa3a8('0x6c')](_0x53e376[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x4d9474[_0xa3a8('0x50')]=qs['filters'](_[_0xa3a8('0x6d')](_0x53e376[_0xa3a8('0x49')],_0x11e2a2[_0xa3a8('0x4a')]));_0x4d9474['where'][_0xa3a8('0x68')]=_0x5e02bc['id'];if(_0x53e376[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x4d9474[_0xa3a8('0x50')]=_[_0xa3a8('0x52')](_0x4d9474['where'],{'$or':_[_0xa3a8('0x44')](_0x4d9474[_0xa3a8('0x4c')],function(_0x695a75){var _0x44118c={};_0x44118c[_0x695a75]={'$like':'%'+_0x53e376['query'][_0xa3a8('0x51')]+'%'};return _0x44118c;})});}_0x4d9474=_[_0xa3a8('0x52')]({},_0x4d9474,_0x53e376[_0xa3a8('0x53')]);return db['Disposition']['count']({'where':_0x4d9474[_0xa3a8('0x50')]})[_0xa3a8('0x23')](function(_0x1e1e34){_0x2c214f[_0xa3a8('0x31')]=_0x1e1e34;if(_0x53e376['query']['includeAll']){_0x4d9474[_0xa3a8('0x5c')]=[{'all':!![]}];}return db[_0xa3a8('0x69')]['findAll'](_0x4d9474);})['then'](function(_0x342c4c){_0x2c214f[_0xa3a8('0x56')]=_0x342c4c;return _0x2c214f;});}})[_0xa3a8('0x23')](respondWithFilteredResult(_0x289d13,_0x4d9474))[_0xa3a8('0x2e')](handleError(_0x289d13,null));};exports['removeDispositions']=function(_0x23febf,_0x2f6b10,_0x7bcdf4){return db['SmsAccount'][_0xa3a8('0x5d')]({'where':{'id':_0x23febf[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x2f6b10,null))[_0xa3a8('0x23')](function(_0x2de153){if(_0x2de153){return _0x2de153[_0xa3a8('0x6e')](_0x23febf[_0xa3a8('0x49')]['ids']);}})[_0xa3a8('0x23')](respondWithStatusCode(_0x2f6b10,null))['catch'](handleError(_0x2f6b10,null));};exports[_0xa3a8('0x6f')]=function(_0x212df3,_0x2c5219,_0x4cbb4d){if(_0x212df3[_0xa3a8('0x65')]['id']){delete _0x212df3[_0xa3a8('0x65')]['id'];}return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x212df3['params']['id']}})['then'](handleEntityNotFound(_0x2c5219,null))[_0xa3a8('0x23')](function(_0x5bf78c){if(_0x5bf78c){_0x212df3[_0xa3a8('0x65')][_0xa3a8('0x68')]=_0x5bf78c['id'];return db[_0xa3a8('0x70')][_0xa3a8('0x5e')](_0x212df3[_0xa3a8('0x65')]);}})[_0xa3a8('0x23')](respondWithResult(_0x2c5219,null))[_0xa3a8('0x2e')](handleError(_0x2c5219,null));};exports[_0xa3a8('0x71')]=function(_0x134ebb,_0x475319,_0x38e128){var _0x18a56c={'raw':![],'where':{}};var _0xf71546={};var _0x41c083={'count':0x0,'rows':[]};return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x134ebb['params']['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x475319,null))[_0xa3a8('0x23')](function(_0x49b28a){if(_0x49b28a){_0xf71546[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db['CannedAnswer'][_0xa3a8('0x46')]);_0xf71546['query']=_[_0xa3a8('0x59')](_0x134ebb[_0xa3a8('0x49')]);_0xf71546[_0xa3a8('0x4a')]=_['intersection'](_0xf71546[_0xa3a8('0x48')],_0xf71546['query']);_0x18a56c[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0xf71546['model'],qs['fields'](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x5a')]));_0x18a56c['attributes']=_0x18a56c[_0xa3a8('0x4c')][_0xa3a8('0x5b')]?_0x18a56c[_0xa3a8('0x4c')]:_0xf71546[_0xa3a8('0x48')];if(!_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x18a56c[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x33')]);_0x18a56c['offset']=qs[_0xa3a8('0x32')](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x32')]);}_0x18a56c['order']=qs['sort'](_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x18a56c[_0xa3a8('0x50')]=qs[_0xa3a8('0x4a')](_[_0xa3a8('0x6d')](_0x134ebb[_0xa3a8('0x49')],_0xf71546['filters']));_0x18a56c[_0xa3a8('0x50')][_0xa3a8('0x68')]=_0x49b28a['id'];if(_0x134ebb[_0xa3a8('0x49')]['filter']){_0x18a56c[_0xa3a8('0x50')]=_[_0xa3a8('0x52')](_0x18a56c[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x18a56c[_0xa3a8('0x4c')],function(_0x4b8361){var _0x5ba736={};_0x5ba736[_0x4b8361]={'$like':'%'+_0x134ebb['query'][_0xa3a8('0x51')]+'%'};return _0x5ba736;})});}_0x18a56c=_[_0xa3a8('0x52')]({},_0x18a56c,_0x134ebb[_0xa3a8('0x53')]);return db[_0xa3a8('0x70')]['count']({'where':_0x18a56c[_0xa3a8('0x50')]})[_0xa3a8('0x23')](function(_0x479751){_0x41c083[_0xa3a8('0x31')]=_0x479751;if(_0x134ebb[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x18a56c['include']=[{'all':!![]}];}return db[_0xa3a8('0x70')][_0xa3a8('0x55')](_0x18a56c);})['then'](function(_0x1acbc2){_0x41c083[_0xa3a8('0x56')]=_0x1acbc2;return _0x41c083;});}})[_0xa3a8('0x23')](respondWithFilteredResult(_0x475319,_0x18a56c))[_0xa3a8('0x2e')](handleError(_0x475319,null));};exports[_0xa3a8('0x72')]=function(_0x183490,_0x5952a7,_0x222c44){return db['SmsAccount']['find']({'where':{'id':_0x183490[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5952a7,null))[_0xa3a8('0x23')](function(_0x93731c){if(_0x93731c){return _0x93731c['removeAnswers'](_0x183490[_0xa3a8('0x49')][_0xa3a8('0x73')]);}})[_0xa3a8('0x23')](respondWithStatusCode(_0x5952a7,null))[_0xa3a8('0x2e')](handleError(_0x5952a7,null));};exports[_0xa3a8('0x74')]=function(_0x34a250,_0x4534a4,_0x5060c9){var _0x2c60de={'channel':'sms'};var _0x2e35d6=[];var _0xd202d5=[];var _0x24956b={};return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x34a250[_0xa3a8('0x58')]['id']},'include':[{'model':db[_0xa3a8('0x75')],'as':_0xa3a8('0x76')}]})[_0xa3a8('0x23')](handleEntityNotFound(_0x4534a4,null))[_0xa3a8('0x23')](function(_0x4ad955){_0x2c60de[_0xa3a8('0x77')]=_0x4ad955;_0x2c60de['applications']=_[_0xa3a8('0x78')](_0x4ad955[_0xa3a8('0x76')],[_0xa3a8('0x79')],[_0xa3a8('0x7a')]);if(_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x76')]){delete _0x2c60de['account']['Applications'];}return db[_0xa3a8('0x7b')][_0xa3a8('0x66')]();})[_0xa3a8('0x23')](function(_0x140859){if(!_0x140859){throw new db['Sequelize'][(_0xa3a8('0x7c'))](_0xa3a8('0x7d'));}_0x2e35d6=_[_0xa3a8('0x7e')](_[_0xa3a8('0x59')](_0x140859),['createdAt','updatedAt']);_0xd202d5=_[_0xa3a8('0x7e')](_[_0xa3a8('0x59')](_0x140859),['createdAt',_0xa3a8('0x7f'),_0xa3a8('0x80'),_0xa3a8('0x81')]);_0x2c60de[_0xa3a8('0x65')]={'mapKey':_0xa3a8('0x82')};if(_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x47')]){switch(_0x2c60de['account'][_0xa3a8('0x47')]){case _0xa3a8('0x83'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250['body']['From'];_0x2c60de['body'][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x85')];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250['body'][_0xa3a8('0x87')];break;case _0xa3a8('0x88'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]='+'+_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x89')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250['body'][_0xa3a8('0x8a')];break;case _0xa3a8('0x8b'):_0x2c60de['body'][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x2c')];break;case _0xa3a8('0x8c'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')]['body'];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x86')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8d')];break;case'plivo':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')]['From'];_0x2c60de[_0xa3a8('0x65')]['body']=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8e')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x86')]=_0x34a250[_0xa3a8('0x65')]['MessageUUID'];break;case'infobip':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]='+'+_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8f')][0x0][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')]['results'][0x0]['text'];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250[_0xa3a8('0x65')]['results'][0x0][_0xa3a8('0x86')];break;case _0xa3a8('0x90'):_0x2c60de['body'][_0xa3a8('0x84')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x91')];_0x2c60de['body'][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x92')][_0xa3a8('0x2c')];break;case _0xa3a8('0x93'):_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')]=_0x34a250['body']['fromNumber'];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x8a')];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250['body']['replyMessageId'];break;case'intelepeer':_0x2c60de[_0xa3a8('0x65')]['from']=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x84')];_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]=_0x34a250[_0xa3a8('0x65')][_0xa3a8('0x2c')];_0x2c60de['body'][_0xa3a8('0x86')]=_0x34a250['body'][_0xa3a8('0x94')];break;}}if(_0x2c60de[_0xa3a8('0x65')]['id']){delete _0x2c60de[_0xa3a8('0x65')]['id'];}if(_[_0xa3a8('0x95')](_0x2c60de['body'][_0xa3a8('0x84')])){throw new db['Sequelize'][(_0xa3a8('0x7c'))](_0xa3a8('0x96'));}if(_[_0xa3a8('0x95')](_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')])||_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')]===''){throw new db[(_0xa3a8('0x97'))][(_0xa3a8('0x7c'))](_0xa3a8('0x98'));}if(_[_0xa3a8('0x95')](_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x99')])){throw new db[(_0xa3a8('0x97'))][(_0xa3a8('0x7c'))](_0xa3a8('0x9a')+_0xd202d5);}if(!_['includes'](_0xd202d5,_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x99')])){throw new db['Sequelize'][(_0xa3a8('0x7c'))](_0xa3a8('0x9b')+_0xd202d5);}_0x24956b[_0x2c60de[_0xa3a8('0x65')]['mapKey']]=_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')];return db[_0xa3a8('0x9c')][_0xa3a8('0x5d')]({'where':{'id':_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x81')]},'include':[{'model':db['CmContact'],'as':_0xa3a8('0x9d'),'where':_0x24956b,'limit':0x1,'order':[[_0xa3a8('0x7f'),_0xa3a8('0x9e')]]}]});})['then'](handleEntityNotFound(_0x4534a4,null))[_0xa3a8('0x23')](function(_0x1bd773){if(_0x1bd773){_0x2c60de[_0xa3a8('0x9f')]=_[_0xa3a8('0xa0')](_0x1bd773,[_0xa3a8('0x9d')]);if(_0x1bd773[_0xa3a8('0x9d')]['length']){return _0x1bd773[_0xa3a8('0x9d')][0x0];}var _0x38ad67=_['defaults'](_0x2c60de[_0xa3a8('0x65')],{'firstName':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')],'ListId':_0x1bd773['id']});_0x38ad67[_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x99')]]=_0x2c60de['body'][_0xa3a8('0x84')];return db[_0xa3a8('0x7b')][_0xa3a8('0x5e')](_0x38ad67,{'fields':_0x2e35d6,'raw':!![]});}})['then'](handleEntityNotFound(_0x4534a4,null))[_0xa3a8('0x23')](function(_0x57315a){if(_0x57315a){_0x2c60de['contact']=_0x57315a;var _0x32d0bd={'ContactId':_0x57315a['id'],'phone':_0x2c60de['body'][_0xa3a8('0x84')],'SmsAccountId':_0x34a250[_0xa3a8('0x58')]['id']};var _0x398eb3={'ContactId':_0x57315a['id'],'SmsAccountId':_0x34a250[_0xa3a8('0x58')]['id'],'closed':![]};return db[_0xa3a8('0xa1')][_0xa3a8('0x5d')]({'where':_0x398eb3})[_0xa3a8('0x23')](function(_0x32a888){if(_0x32a888){return[_0x32a888,![]];}return db[_0xa3a8('0xa1')]['create'](_0x32d0bd)['then'](function(_0x1b30cf){return[_0x1b30cf,!![]];});});}})[_0xa3a8('0xa2')](function(_0x237e8a,_0x23db06){_0x2c60de[_0xa3a8('0xa3')]=_0x237e8a['get']({'plain':!![]});_0x2c60de['interaction']['created']=![];if(_0x23db06){if(_0x2c60de['account']['autoclose']){_0x2c60de[_0xa3a8('0xa4')][_0xa3a8('0xa5')]({'id':0x0,'priority':_0x2c60de[_0xa3a8('0xa4')]['length']+0x1,'app':_0xa3a8('0xa6'),'appdata':_0xa3a8('0xa7'),'interval':_0xa3a8('0xa8')});}_0x2c60de[_0xa3a8('0xa3')][_0xa3a8('0xa9')]=!![];}return db[_0xa3a8('0xaa')][_0xa3a8('0x5e')]({'phone':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x84')],'messageId':_0x2c60de[_0xa3a8('0x65')]['messageId'],'body':_0x2c60de[_0xa3a8('0x65')][_0xa3a8('0x65')],'SmsAccountId':_0x34a250[_0xa3a8('0x58')]['id'],'SmsInteractionId':_0x237e8a['id'],'direction':'in','ContactId':_0x237e8a[_0xa3a8('0xab')],'AttachmentId':_0x2c60de['body'][_0xa3a8('0xac')]});})[_0xa3a8('0x23')](function(_0x13c02e){_0x2c60de[_0xa3a8('0x2c')]=_0x13c02e;if(_0x2c60de[_0xa3a8('0xa3')][_0xa3a8('0xad')]){return db['User'][_0xa3a8('0x5d')]({'attributes':['id',_0xa3a8('0x40')],'where':{'id':_0x2c60de[_0xa3a8('0xa3')][_0xa3a8('0xad')]}})[_0xa3a8('0x23')](function(_0x2e0843){if(_0x2e0843){_0x2c60de[_0xa3a8('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2e0843[_0xa3a8('0x40')]+','+(_0x2c60de['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa3a8('0xae'),_0xa3a8('0xaf'),_0x2c60de);});}return respondWithRpcPromise(_0xa3a8('0xae'),_0xa3a8('0xaf'),_0x2c60de);})[_0xa3a8('0x23')](function(_0x54ac90){if(_0x54ac90){var _0x2c4e1=0xc8;var _0xc3ce3=_0xa3a8('0xb0');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc3ce3,_0x2c4e1,_0xa3a8('0xb1'));logger[_0xa3a8('0x25')](_0xa3a8('0xb2'),_0xc3ce3,_0x2c4e1,_0xa3a8('0xb1'),JSON[_0xa3a8('0x28')](_0x54ac90));if(_0x2c60de[_0xa3a8('0x77')][_0xa3a8('0x47')]==='twilio'){return _0x4534a4[_0xa3a8('0x2f')](_0x2c4e1)[_0xa3a8('0xb3')](_0xa3a8('0xb4'),_0xa3a8('0xb5'))['send']('\x0a');}else{return _0x4534a4[_0xa3a8('0x2f')](_0x2c4e1)[_0xa3a8('0x30')](_0x54ac90);}}})[_0xa3a8('0x2e')](handleError(_0x4534a4,null));};exports[_0xa3a8('0xb6')]=function(_0xfa0f77,_0x424175,_0x4c2f5e){return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0xfa0f77['params']['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x424175,null))[_0xa3a8('0x23')](function(_0x3e9c49){if(_0x3e9c49){return db[_0xa3a8('0xb7')]['transaction'](function(_0x95f955){return db[_0xa3a8('0x75')][_0xa3a8('0x3c')]({'where':{'SmsAccountId':_0xfa0f77[_0xa3a8('0x58')]['id']},'transaction':_0x95f955})[_0xa3a8('0x23')](function(_0x40d9d5){var _0x16d30e=_[_0xa3a8('0x44')](_0xfa0f77[_0xa3a8('0x65')],function(_0x255e33){_0x255e33[_0xa3a8('0x68')]=_0xfa0f77[_0xa3a8('0x58')]['id'];return _0x255e33;});return db['SmsApplication'][_0xa3a8('0xb8')](_0x16d30e,{'transaction':_0x95f955});});})[_0xa3a8('0x23')](function(){return db[_0xa3a8('0x75')][_0xa3a8('0xb9')]({'where':{'SmsAccountId':_0xfa0f77[_0xa3a8('0x58')]['id']},'order':_0xa3a8('0x79')});});}})[_0xa3a8('0x23')](respondWithResult(_0x424175,null))[_0xa3a8('0x2e')](handleError(_0x424175,null));};exports['getApplications']=function(_0xad3bad,_0x26bf82,_0x36f0f3){var _0x140a72={};var _0x344ae2={};var _0x4b7a4e;var _0x4e3955;return db[_0xa3a8('0x45')]['findOne']({'where':{'id':_0xad3bad[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x26bf82,null))['then'](function(_0x262f7f){if(_0x262f7f){_0x4b7a4e=_0x262f7f;_0x344ae2['model']=_[_0xa3a8('0x59')](db[_0xa3a8('0x75')][_0xa3a8('0x46')]);_0x344ae2['query']=_[_0xa3a8('0x59')](_0xad3bad[_0xa3a8('0x49')]);_0x344ae2[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x344ae2[_0xa3a8('0x48')],_0x344ae2['query']);_0x140a72[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x344ae2['model'],qs[_0xa3a8('0x5a')](_0xad3bad['query'][_0xa3a8('0x5a')]));_0x140a72[_0xa3a8('0x4c')]=_0x140a72[_0xa3a8('0x4c')]['length']?_0x140a72[_0xa3a8('0x4c')]:_0x344ae2[_0xa3a8('0x48')];_0x140a72[_0xa3a8('0x4f')]=qs[_0xa3a8('0x6c')](_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x140a72[_0xa3a8('0x50')]=qs['filters'](_[_0xa3a8('0x6d')](_0xad3bad[_0xa3a8('0x49')],_0x344ae2[_0xa3a8('0x4a')]));if(_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x140a72[_0xa3a8('0x50')]=_[_0xa3a8('0x52')](_0x140a72['where'],{'$or':_[_0xa3a8('0x44')](_0x140a72[_0xa3a8('0x4c')],function(_0x2c863b){var _0x19036f={};_0x19036f[_0x2c863b]={'$like':'%'+_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x51')]+'%'};return _0x19036f;})});}_0x140a72=_[_0xa3a8('0x52')]({},_0x140a72,_0xad3bad['options']);return _0x4b7a4e[_0xa3a8('0xba')](_0x140a72);}})[_0xa3a8('0x23')](function(_0x4bf85c){if(_0x4bf85c){_0x4e3955=_0x4bf85c[_0xa3a8('0x5b')];if(!_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x140a72[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0xad3bad[_0xa3a8('0x49')][_0xa3a8('0x33')]);_0x140a72[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0xad3bad[_0xa3a8('0x49')]['offset']);}return _0x4b7a4e[_0xa3a8('0xba')](_0x140a72);}})[_0xa3a8('0x23')](function(_0x4a2148){if(_0x4a2148){return _0x4a2148?{'count':_0x4e3955,'rows':_0x4a2148}:null;}})[_0xa3a8('0x23')](respondWithResult(_0x26bf82,null))['catch'](handleError(_0x26bf82,null));};exports['getInteractions']=function(_0x122817,_0x5dcf18,_0x1623ee){var _0x52bc62={'raw':![],'where':{}};var _0x2243f0={};var _0x278cca={'count':0x0,'rows':[]};return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x122817[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5dcf18,null))[_0xa3a8('0x23')](function(_0x1b6038){if(_0x1b6038){_0x2243f0[_0xa3a8('0x48')]=_['keys'](db[_0xa3a8('0xa1')][_0xa3a8('0x46')]);_0x2243f0[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x122817[_0xa3a8('0x49')]);_0x2243f0[_0xa3a8('0x4a')]=_[_0xa3a8('0x4b')](_0x2243f0[_0xa3a8('0x48')],_0x2243f0[_0xa3a8('0x49')]);_0x52bc62[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x2243f0['model'],qs['fields'](_0x122817[_0xa3a8('0x49')][_0xa3a8('0x5a')]));_0x52bc62[_0xa3a8('0x4c')]=_0x52bc62['attributes']['length']?_0x52bc62[_0xa3a8('0x4c')]:_0x2243f0[_0xa3a8('0x48')];if(!_0x122817[_0xa3a8('0x49')][_0xa3a8('0x4d')](_0xa3a8('0x4e'))){_0x52bc62['limit']=qs['limit'](_0x122817['query'][_0xa3a8('0x33')]);_0x52bc62[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0x122817[_0xa3a8('0x49')][_0xa3a8('0x32')]);}_0x52bc62[_0xa3a8('0x4f')]=qs['sort'](_0x122817[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x52bc62[_0xa3a8('0x50')]=qs[_0xa3a8('0x4a')](_[_0xa3a8('0x6d')](_0x122817['query'],_0x2243f0[_0xa3a8('0x4a')]));_0x52bc62[_0xa3a8('0x50')][_0xa3a8('0x68')]=_0x1b6038['id'];if(_0x122817[_0xa3a8('0x49')]['filter']){_0x52bc62['where']=_['merge'](_0x52bc62[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x52bc62[_0xa3a8('0x4c')],function(_0x2eb6dc){var _0x3ae86c={};_0x3ae86c[_0x2eb6dc]={'$like':'%'+_0x122817[_0xa3a8('0x49')][_0xa3a8('0x51')]+'%'};return _0x3ae86c;})});}_0x52bc62=_['merge']({},_0x52bc62,_0x122817[_0xa3a8('0x53')]);return db[_0xa3a8('0xa1')]['count']({'where':_0x52bc62[_0xa3a8('0x50')]})['then'](function(_0x324b8c){_0x278cca[_0xa3a8('0x31')]=_0x324b8c;if(_0x122817[_0xa3a8('0x49')][_0xa3a8('0x54')]){_0x52bc62[_0xa3a8('0x5c')]=[{'model':db[_0xa3a8('0x7b')],'as':_0xa3a8('0xbb'),'required':![]},{'model':db['User'],'as':_0xa3a8('0xbc'),'attributes':[_0xa3a8('0x40'),_0xa3a8('0xbd'),_0xa3a8('0xbe')],'required':![]},{'model':db[_0xa3a8('0xbf')],'as':_0xa3a8('0xc0'),'attributes':['id',_0xa3a8('0x40'),_0xa3a8('0xc1')],'where':_0x122817[_0xa3a8('0x49')]['tag']?{'id':_0x122817['query']['tag']}:undefined,'required':_0x122817[_0xa3a8('0x49')][_0xa3a8('0xc2')]?!![]:![]}];}return db[_0xa3a8('0xa1')][_0xa3a8('0x55')](_0x52bc62);})[_0xa3a8('0x23')](function(_0x49d8db){_0x278cca[_0xa3a8('0x56')]=_0x49d8db;return _0x278cca;});}})[_0xa3a8('0x23')](respondWithFilteredResult(_0x5dcf18,_0x52bc62))[_0xa3a8('0x2e')](handleError(_0x5dcf18,null));};exports[_0xa3a8('0x41')]=function(_0x495de8,_0x5e7dd1,_0x31b061){var _0x140440,_0x575482,_0x202079;if(_['isNil'](_0x495de8['body'][_0xa3a8('0x65')])||_0x495de8['body'][_0xa3a8('0x65')]===''){throw new db[(_0xa3a8('0x97'))][(_0xa3a8('0x7c'))](_0xa3a8('0x98'));}if(_[_0xa3a8('0x95')](_0x495de8[_0xa3a8('0x65')]['to'])){throw new db['Sequelize'][(_0xa3a8('0x7c'))]('to\x20is\x20mandatory');}_0x140440=_0x495de8[_0xa3a8('0x65')]['to'];return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x495de8[_0xa3a8('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xa3a8('0xc3'),'include':[{'model':db[_0xa3a8('0x7b')],'as':'Contacts','where':{'mobile':_0x140440},'limit':0x1,'order':[[_0xa3a8('0x7f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x5e7dd1,null))['then'](function(_0xb04135){if(_0xb04135&&_0xb04135[_0xa3a8('0xc3')]){_0x575482=_0xb04135[_0xa3a8('0x39')]({'plain':!![]});if(_0x575482[_0xa3a8('0xc3')]&&_0x575482['List'][_0xa3a8('0x9d')]['length']){return _0x575482[_0xa3a8('0xc3')][_0xa3a8('0x9d')][0x0];}return db['CmContact'][_0xa3a8('0x5e')](_[_0xa3a8('0x1f')](_0x495de8['body'],{'firstName':_0x140440,'mobile':_0x140440,'phone':_0x140440,'ListId':_0x575482['ListId']}));}})['then'](handleEntityNotFound(_0x5e7dd1,null))['then'](function(_0x52f5b0){if(_0x52f5b0){_0x202079=_0x52f5b0;return db['SmsInteraction'][_0xa3a8('0x5d')]({'where':{'ContactId':_0x202079['id'],'closed':![],'SmsAccountId':_0x575482['id']}})[_0xa3a8('0x23')](function(_0x2fb555){if(_0x2fb555){return[_0x2fb555,![]];}return db[_0xa3a8('0xa1')]['create']({'UserId':_0x495de8[_0xa3a8('0x5f')]['id'],'ContactId':_0x202079['id'],'SmsAccountId':_0x575482['id'],'phone':_0x140440,'firstMsgDirection':'out','Messages':[_[_0xa3a8('0x52')](_0x495de8[_0xa3a8('0x65')],{'read':![],'body':_0x495de8[_0xa3a8('0x65')][_0xa3a8('0x65')],'phone':_0x140440,'SmsAccountId':_0x575482['id'],'UserId':_0x495de8[_0xa3a8('0x5f')]['id'],'ContactId':_0x202079['id']})]},{'include':[{'model':db[_0xa3a8('0xaa')],'as':_0xa3a8('0xc4')}]})[_0xa3a8('0x23')](function(_0x129fb7){return[_0x129fb7,!![]];});});}})['spread'](function(_0x23ca24,_0x1e13a4){if(_0x1e13a4){return _0x23ca24;}return db['SmsMessage'][_0xa3a8('0x5e')](_[_0xa3a8('0x52')](_0x495de8['body'],{'read':![],'body':_0x495de8[_0xa3a8('0x65')][_0xa3a8('0x65')],'phone':_0x140440,'SmsAccountId':_0x575482['id'],'SmsInteractionId':_0x23ca24['id'],'UserId':_0x495de8[_0xa3a8('0x5f')]['id'],'ContactId':_0x202079['id']}))[_0xa3a8('0x23')](function(_0x3ec193){_0x23ca24[_0xa3a8('0xc5')]['Messages']=[];_0x23ca24['dataValues'][_0xa3a8('0xc4')]['push'](_0x3ec193[_0xa3a8('0xc5')]);return _0x23ca24;});})[_0xa3a8('0x23')](respondWithResult(_0x5e7dd1,null))[_0xa3a8('0x2e')](handleError(_0x5e7dd1,null));};exports['status']=function(_0x400e5f,_0x231a51,_0x49a059){if(_0x400e5f[_0xa3a8('0x65')]['id']){delete _0x400e5f['body']['id'];}console[_0xa3a8('0xc6')](_0xa3a8('0xc7'),_0x400e5f['body']);var _0x20914d,_0x281b85,_0x16ccbd;return db['SmsAccount']['find']({'where':{'id':_0x400e5f[_0xa3a8('0x58')]['id']}})['then'](handleEntityNotFound(_0x231a51,null))['then'](function(_0x24db46){if(_0x24db46){_0x16ccbd=_0x24db46;logger[_0xa3a8('0x25')](_0xa3a8('0x26'),'status',_0xa3a8('0xc8'),_0x24db46[_0xa3a8('0x47')],util[_0xa3a8('0xc9')](_0x400e5f[_0xa3a8('0x65')],{'showHidden':![],'depth':null}));switch(_0x24db46[_0xa3a8('0x47')]){case _0xa3a8('0x88'):if(_0x400e5f[_0xa3a8('0x65')]['skebby_dispatch_id']&&_0x400e5f[_0xa3a8('0x65')]['status']){_0x281b85=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x2f')];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xca')]}});}break;case _0xa3a8('0x8b'):if(_0x400e5f[_0xa3a8('0x65')]['requestid']&&_0x400e5f['body'][_0xa3a8('0xcb')]){_0x281b85=_0x400e5f[_0xa3a8('0x65')]['statusInt'];return db['SmsMessage'][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f['body'][_0xa3a8('0xcc')]}});}break;case'clicksend':if(_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x8d')]&&_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xcd')]){_0x281b85=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xcd')];return db['SmsMessage'][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f['body'][_0xa3a8('0x8d')]}});}break;case _0xa3a8('0xce'):var _0x2e5349=_0x400e5f[_0xa3a8('0x65')]['results'][0x0];if(_0x2e5349['messageId']&&_0x2e5349[_0xa3a8('0x2f')]['groupName']===_0xa3a8('0xcf')){_0x281b85=_0x2e5349[_0xa3a8('0x2f')]['groupName'];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x2e5349[_0xa3a8('0x86')]}});}break;case _0xa3a8('0x93'):if(_0x400e5f[_0xa3a8('0x65')]['messageId']&&_0x400e5f['body'][_0xa3a8('0x2f')]){_0x281b85=_0x400e5f['body'][_0xa3a8('0x2f')];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f['body'][_0xa3a8('0x86')]}});}break;case _0xa3a8('0xd0'):if(_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xd1')]&&_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x2f')]){_0x281b85=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x2f')];return db[_0xa3a8('0xaa')][_0xa3a8('0x5d')]({'where':{'messageId':_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0xd1')]}});}break;}}})[_0xa3a8('0x23')](handleEntityNotFound(_0x231a51,null))[_0xa3a8('0x23')](function(_0x3942c2){if(_0x3942c2){_0x20914d=_0x3942c2;switch(_0x16ccbd[_0xa3a8('0x47')]){case _0xa3a8('0x88'):if(_0x281b85===_0xa3a8('0xcf')){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),'skebby',util[_0xa3a8('0xc9')](_0x400e5f[_0xa3a8('0x65')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x281b85==='1'){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger[_0xa3a8('0x29')](_0xa3a8('0x26'),'status','skebby',util[_0xa3a8('0xc9')](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;case _0xa3a8('0x8c'):if(!_0x400e5f[_0xa3a8('0x65')]['error_code']&&_0x281b85>=0xc8&&_0x281b85<=0xce){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger[_0xa3a8('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),_0xa3a8('0x8c'),util['inspect'](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;case _0xa3a8('0xce'):var _0x3b6fb8=_0x400e5f[_0xa3a8('0x65')][_0xa3a8('0x8f')][0x0];if(_0x3b6fb8[_0xa3a8('0x2f')][_0xa3a8('0xd2')]===_0xa3a8('0xcf')){return _0x20914d[_0xa3a8('0x38')]({'read':!![]});}else{logger[_0xa3a8('0x29')](_0xa3a8('0x26'),_0xa3a8('0x2f'),_0xa3a8('0xce'),util[_0xa3a8('0xc9')](_0x400e5f[_0xa3a8('0x65')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x281b85=='DELIVERED_TO_GATEWAY'||_0x281b85==_0xa3a8('0xd3')){return _0x20914d['update']({'read':!![]});}else{logger['error'](_0xa3a8('0x26'),_0xa3a8('0x2f'),_0xa3a8('0x93'),util[_0xa3a8('0xc9')](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;case _0xa3a8('0xd0'):if(_0x281b85===_0xa3a8('0xd4')||_0x281b85===_0xa3a8('0xd5')){return _0x20914d['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),_0xa3a8('0xd0'),util[_0xa3a8('0xc9')](_0x400e5f['body'],{'showHidden':![],'depth':null}));}break;}return _0x20914d;}})[_0xa3a8('0x23')](respondWithResult(_0x231a51,null))[_0xa3a8('0x2e')](handleError(_0x231a51,null));};exports[_0xa3a8('0xd6')]=function(_0x434b71,_0x5f3cad,_0x37829f){var _0x5eb451,_0x13283b,_0x8d0448;return db['SmsAccount'][_0xa3a8('0x5d')]({'where':{'id':_0x434b71[_0xa3a8('0x58')]['id']}})['then'](handleEntityNotFound(_0x5f3cad,null))[_0xa3a8('0x23')](function(_0x2b651e){if(_0x2b651e){_0x8d0448=_0x2b651e;logger[_0xa3a8('0x25')](_0xa3a8('0x26'),_0xa3a8('0x2f'),_0xa3a8('0xc8'),_0x2b651e['type'],util['inspect'](_0x434b71[_0xa3a8('0x49')],{'showHidden':![],'depth':null}));switch(_0x2b651e[_0xa3a8('0x47')]){case _0xa3a8('0x90'):if(_0x434b71[_0xa3a8('0x49')]['message-id']&&_0x434b71[_0xa3a8('0x49')][_0xa3a8('0xd7')]){_0x13283b=_0x434b71[_0xa3a8('0x49')][_0xa3a8('0xd7')];return db[_0xa3a8('0xaa')]['find']({'where':{'messageId':_0x434b71[_0xa3a8('0x49')][_0xa3a8('0xd8')]}});}break;}}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5f3cad,null))['then'](function(_0x5333f8){if(_0x5333f8){_0x5eb451=_0x5333f8;switch(_0x8d0448['type']){case _0xa3a8('0x90'):if(_0x13283b==='2'||_0x13283b==='6'){return _0x5eb451[_0xa3a8('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a8('0x2f'),_0xa3a8('0x90'),util[_0xa3a8('0xc9')](_0x434b71[_0xa3a8('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x5eb451;}})[_0xa3a8('0x23')](respondWithResult(_0x5f3cad,null))['catch'](handleError(_0x5f3cad,null));};exports[_0xa3a8('0xd9')]=function(_0x4d74fe,_0x325398,_0x329424){return db[_0xa3a8('0x45')][_0xa3a8('0x5d')]({'where':{'id':_0x4d74fe[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x325398,null))[_0xa3a8('0x23')](function(_0x3287ab){if(_0x3287ab){return _0x3287ab['addAgents'](_0x4d74fe['body'][_0xa3a8('0x73')],_[_0xa3a8('0xa0')](_0x4d74fe[_0xa3a8('0x65')],[_0xa3a8('0x73'),'id'])||{})[_0xa3a8('0xa2')](function(_0x2a8b51){for(var _0x888b0e=0x0;_0x888b0e<_0x4d74fe[_0xa3a8('0x65')][_0xa3a8('0x73')][_0xa3a8('0x5b')];_0x888b0e+=0x1){socket['emit'](_0xa3a8('0xda'),{'UserId':_0x4d74fe[_0xa3a8('0x65')][_0xa3a8('0x73')][_0x888b0e],'SmsAccountId':_0x4d74fe[_0xa3a8('0x58')]['id']});}return _0x2a8b51;});}})['then'](respondWithResult(_0x325398,null))['catch'](handleError(_0x325398,null));};exports[_0xa3a8('0xdb')]=function(_0x3ea613,_0x450044,_0x1a7a54){return db[_0xa3a8('0x45')]['find']({'where':{'id':_0x3ea613[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x450044,null))[_0xa3a8('0x23')](function(_0x14bb1a){if(_0x14bb1a){return _0x14bb1a[_0xa3a8('0xdb')](_0x3ea613[_0xa3a8('0x49')][_0xa3a8('0x73')])[_0xa3a8('0x23')](function(){if(_[_0xa3a8('0xdc')](_0x3ea613[_0xa3a8('0x49')]['ids'])){for(var _0x1c1abb=0x0;_0x1c1abb<_0x3ea613[_0xa3a8('0x49')]['ids'][_0xa3a8('0x5b')];_0x1c1abb+=0x1){socket[_0xa3a8('0xdd')](_0xa3a8('0xde'),{'UserId':Number(_0x3ea613['query'][_0xa3a8('0x73')][_0x1c1abb]),'SmsAccountId':Number(_0x3ea613['params']['id'])});}}else{socket[_0xa3a8('0xdd')](_0xa3a8('0xde'),{'UserId':Number(_0x3ea613[_0xa3a8('0x49')]['ids']),'SmsAccountId':Number(_0x3ea613['params']['id'])});}});}})[_0xa3a8('0x23')](respondWithStatusCode(_0x450044,null))[_0xa3a8('0x2e')](handleError(_0x450044,null));};exports[_0xa3a8('0xdf')]=function(_0x82cd57,_0x5dfa66,_0xc279fd){var _0x2ff993={};var _0x43d4fc={};var _0xd379a6;var _0x4466c5;return db[_0xa3a8('0x45')][_0xa3a8('0x6b')]({'where':{'id':_0x82cd57[_0xa3a8('0x58')]['id']}})[_0xa3a8('0x23')](handleEntityNotFound(_0x5dfa66,null))['then'](function(_0x552514){if(_0x552514){_0xd379a6=_0x552514;_0x43d4fc[_0xa3a8('0x48')]=_[_0xa3a8('0x59')](db[_0xa3a8('0xe0')]['rawAttributes']);_0x43d4fc[_0xa3a8('0x49')]=_[_0xa3a8('0x59')](_0x82cd57[_0xa3a8('0x49')]);_0x43d4fc['filters']=_[_0xa3a8('0x4b')](_0x43d4fc[_0xa3a8('0x48')],_0x43d4fc[_0xa3a8('0x49')]);_0x2ff993[_0xa3a8('0x4c')]=_[_0xa3a8('0x4b')](_0x43d4fc[_0xa3a8('0x48')],qs[_0xa3a8('0x5a')](_0x82cd57['query'][_0xa3a8('0x5a')]));_0x2ff993[_0xa3a8('0x4c')]=_0x2ff993[_0xa3a8('0x4c')][_0xa3a8('0x5b')]?_0x2ff993[_0xa3a8('0x4c')]:_0x43d4fc['model'];_0x2ff993[_0xa3a8('0x4f')]=qs[_0xa3a8('0x6c')](_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x6c')]);_0x2ff993[_0xa3a8('0x50')]=qs[_0xa3a8('0x4a')](_[_0xa3a8('0x6d')](_0x82cd57['query'],_0x43d4fc[_0xa3a8('0x4a')]));if(_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x51')]){_0x2ff993['where']=_[_0xa3a8('0x52')](_0x2ff993[_0xa3a8('0x50')],{'$or':_[_0xa3a8('0x44')](_0x2ff993[_0xa3a8('0x4c')],function(_0x1974e6){var _0x490b7b={};_0x490b7b[_0x1974e6]={'$like':'%'+_0x82cd57['query'][_0xa3a8('0x51')]+'%'};return _0x490b7b;})});}_0x2ff993=_[_0xa3a8('0x52')]({},_0x2ff993,_0x82cd57[_0xa3a8('0x53')]);return _0xd379a6[_0xa3a8('0xdf')](_0x2ff993);}})[_0xa3a8('0x23')](function(_0x117612){if(_0x117612){_0x4466c5=_0x117612[_0xa3a8('0x5b')];if(!_0x82cd57['query']['hasOwnProperty'](_0xa3a8('0x4e'))){_0x2ff993[_0xa3a8('0x33')]=qs[_0xa3a8('0x33')](_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x33')]);_0x2ff993[_0xa3a8('0x32')]=qs[_0xa3a8('0x32')](_0x82cd57[_0xa3a8('0x49')][_0xa3a8('0x32')]);}return _0xd379a6['getAgents'](_0x2ff993);}})['then'](function(_0x53472a){if(_0x53472a){return _0x53472a?{'count':_0x4466c5,'rows':_0x53472a}:null;}})[_0xa3a8('0x23')](respondWithResult(_0x5dfa66,null))['catch'](handleError(_0x5dfa66,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c5feed7..e31ea72 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 _0x848a=['exports','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3513a0,_0x3bdc88){var _0x2bdeb9=function(_0x37f06d){while(--_0x37f06d){_0x3513a0['push'](_0x3513a0['shift']());}};_0x2bdeb9(++_0x3bdc88);}(_0x848a,0x15f));var _0xa848=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x848a[_0x4e783c];return _0x2fbd6d;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xa848('0x0'))['db'][_0xa848('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa848('0x2')](0x0);var events={'afterCreate':_0xa848('0x3'),'afterUpdate':_0xa848('0x4'),'afterDestroy':_0xa848('0x5')};function emitEvent(_0x4456f3){return function(_0x56a76e,_0x1f5aa9,_0x1a5538){SmsAccountEvents[_0xa848('0x6')](_0x4456f3+':'+_0x56a76e['id'],_0x56a76e);SmsAccountEvents[_0xa848('0x6')](_0x4456f3,_0x56a76e);_0x1a5538(null);};}for(var e in events){if(events[_0xa848('0x7')](e)){var event=events[e];SmsAccount[_0xa848('0x8')](e,emitEvent(event));}}module[_0xa848('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x93d6=['remove','emit','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0x5c7ea7,_0x4f7d6f){var _0x4c3cf1=function(_0x5d8516){while(--_0x5d8516){_0x5c7ea7['push'](_0x5c7ea7['shift']());}};_0x4c3cf1(++_0x4f7d6f);}(_0x93d6,0x10c));var _0x693d=function(_0x27f024,_0x5ade12){_0x27f024=_0x27f024-0x0;var _0x4410fd=_0x93d6[_0x27f024];return _0x4410fd;};'use strict';var EventEmitter=require(_0x693d('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x693d('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x693d('0x2')](0x0);var events={'afterCreate':_0x693d('0x3'),'afterUpdate':'update','afterDestroy':_0x693d('0x4')};function emitEvent(_0x40bfee){return function(_0x57e1bf,_0x5dcedd,_0x74a9ea){SmsAccountEvents['emit'](_0x40bfee+':'+_0x57e1bf['id'],_0x57e1bf);SmsAccountEvents[_0x693d('0x5')](_0x40bfee,_0x57e1bf);_0x74a9ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x693d('0x6')](e,emitEvent(event));}}module[_0x693d('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d75e11f..d5668cb 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 _0x31f7=['rimraf','./smsAccount.attributes','exports','define','lodash','../../config/logger','moment','bluebird','path'];(function(_0x102470,_0x199a01){var _0x558eaa=function(_0x12c74a){while(--_0x12c74a){_0x102470['push'](_0x102470['shift']());}};_0x558eaa(++_0x199a01);}(_0x31f7,0x175));var _0x731f=function(_0x2b4457,_0x176755){_0x2b4457=_0x2b4457-0x0;var _0x182d2c=_0x31f7[_0x2b4457];return _0x182d2c;};'use strict';var _=require(_0x731f('0x0'));var util=require('util');var logger=require(_0x731f('0x1'))('api');var moment=require(_0x731f('0x2'));var BPromise=require(_0x731f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x731f('0x4'));var rimraf=require(_0x731f('0x5'));var config=require('../../config/environment');var attributes=require(_0x731f('0x6'));module[_0x731f('0x7')]=function(_0x27ba34,_0x1ed4ff){return _0x27ba34[_0x731f('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd69=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','SmsAccount','sms_accounts'];(function(_0x44a3c1,_0x2ee8da){var _0x1ce6cd=function(_0x1c4519){while(--_0x1c4519){_0x44a3c1['push'](_0x44a3c1['shift']());}};_0x1ce6cd(++_0x2ee8da);}(_0xcd69,0x16b));var _0x9cd6=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xcd69[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9cd6('0x0'))(_0x9cd6('0x1'));var moment=require(_0x9cd6('0x2'));var BPromise=require(_0x9cd6('0x3'));var rp=require(_0x9cd6('0x4'));var fs=require('fs');var path=require(_0x9cd6('0x5'));var rimraf=require(_0x9cd6('0x6'));var config=require(_0x9cd6('0x7'));var attributes=require(_0x9cd6('0x8'));module['exports']=function(_0x4952e7,_0x45deec){return _0x4952e7['define'](_0x9cd6('0x9'),attributes,{'tableName':_0x9cd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 7258a84..78cddcc 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 _0x82f6=['redis','localhost','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','SmsAccount','find','options','raw','where','attributes','include','model','map','then','ShowSmsAccount','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0xf414e4,_0x569702){var _0x5db5d1=function(_0x3a7c91){while(--_0x3a7c91){_0xf414e4['push'](_0xf414e4['shift']());}};_0x5db5d1(++_0x569702);}(_0x82f6,0x14a));var _0x682f=function(_0x17ba6a,_0x1a2ce0){_0x17ba6a=_0x17ba6a-0x0;var _0x33ee87=_0x82f6[_0x17ba6a];return _0x33ee87;};'use strict';var _=require(_0x682f('0x0'));var util=require(_0x682f('0x1'));var moment=require(_0x682f('0x2'));var BPromise=require(_0x682f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x682f('0x4'));var db=require(_0x682f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x682f('0x6'))(_0x682f('0x7'));var config=require(_0x682f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x682f('0x9')][_0x682f('0xa')]({'port':0x232a});config['redis']=_[_0x682f('0xb')](config[_0x682f('0xc')],{'host':_0x682f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x682f('0xc')]));require('./smsAccount.socket')[_0x682f('0xe')](socket);function respondWithRpcPromise(_0x592371,_0x30c8ad,_0x1fcba9){return new BPromise(function(_0x6264f,_0x185bc2){return client[_0x682f('0xf')](_0x592371,_0x1fcba9)['then'](function(_0x6707f4){logger['info'](_0x682f('0x10'),_0x30c8ad,_0x682f('0x11'));logger[_0x682f('0x12')](_0x682f('0x13'),_0x30c8ad,_0x682f('0x11'),JSON[_0x682f('0x14')](_0x6707f4));if(_0x6707f4['error']){if(_0x6707f4['error'][_0x682f('0x15')]===0x1f4){logger[_0x682f('0x16')](_0x682f('0x10'),_0x30c8ad,_0x6707f4['error'][_0x682f('0x17')]);return _0x185bc2(_0x6707f4[_0x682f('0x16')][_0x682f('0x17')]);}logger['error'](_0x682f('0x10'),_0x30c8ad,_0x6707f4[_0x682f('0x16')][_0x682f('0x17')]);return _0x6264f(_0x6707f4[_0x682f('0x16')][_0x682f('0x17')]);}else{logger[_0x682f('0x18')]('SmsAccount,\x20%s,\x20%s',_0x30c8ad,_0x682f('0x11'));_0x6264f(_0x6707f4[_0x682f('0x19')][_0x682f('0x17')]);}})['catch'](function(_0x1431ac){logger[_0x682f('0x16')](_0x682f('0x10'),_0x30c8ad,_0x1431ac);_0x185bc2(_0x1431ac);});});}exports['ShowSmsAccount']=function(_0x4e452e){var _0xef5db9=this;return new Promise(function(_0x2d5903,_0x3109a3){return db[_0x682f('0x1a')][_0x682f('0x1b')]({'raw':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x1e')]||null:null,'attributes':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x1f')]||null:null,'include':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x20')]?_['map'](_0x4e452e[_0x682f('0x1c')][_0x682f('0x20')],function(_0x32e426){return{'model':db[_0x32e426[_0x682f('0x21')]],'as':_0x32e426['as'],'attributes':_0x32e426[_0x682f('0x1f')],'include':_0x32e426[_0x682f('0x20')]?_[_0x682f('0x22')](_0x32e426[_0x682f('0x20')],function(_0x134a76){return{'model':db[_0x134a76['model']],'as':_0x134a76['as'],'attributes':_0x134a76['attributes'],'include':_0x134a76[_0x682f('0x20')]?_[_0x682f('0x22')](_0x134a76[_0x682f('0x20')],function(_0x482128){return{'model':db[_0x482128[_0x682f('0x21')]],'as':_0x482128['as'],'attributes':_0x482128[_0x682f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x682f('0x23')](function(_0x1e9f21){logger[_0x682f('0x18')](_0x682f('0x24'),_0x4e452e);logger[_0x682f('0x12')](_0x682f('0x24'),_0x4e452e,JSON[_0x682f('0x14')](_0x1e9f21));_0x2d5903(_0x1e9f21);})[_0x682f('0x25')](function(_0x3ccb49){logger[_0x682f('0x16')]('ShowSmsAccount',_0x3ccb49['message'],_0x4e452e);_0x3109a3(_0xef5db9[_0x682f('0x16')](0x1f4,_0x3ccb49['message']));});});}; \ No newline at end of file +var _0x31d2=['attributes','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where'];(function(_0x1f652f,_0x20030d){var _0x314e5f=function(_0x2f3e51){while(--_0x2f3e51){_0x1f652f['push'](_0x1f652f['shift']());}};_0x314e5f(++_0x20030d);}(_0x31d2,0x180));var _0x231d=function(_0x6e0c08,_0x2c10e2){_0x6e0c08=_0x6e0c08-0x0;var _0x4e27a6=_0x31d2[_0x6e0c08];return _0x4e27a6;};'use strict';var _=require('lodash');var util=require(_0x231d('0x0'));var moment=require(_0x231d('0x1'));var BPromise=require('bluebird');var rs=require(_0x231d('0x2'));var fs=require('fs');var Redis=require(_0x231d('0x3'));var db=require(_0x231d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x231d('0x5'))(_0x231d('0x6'));var config=require(_0x231d('0x7'));var jayson=require(_0x231d('0x8'));var client=jayson[_0x231d('0x9')]['http']({'port':0x232a});config[_0x231d('0xa')]=_[_0x231d('0xb')](config[_0x231d('0xa')],{'host':_0x231d('0xc'),'port':0x18eb});var socket=require(_0x231d('0xd'))(new Redis(config[_0x231d('0xa')]));require(_0x231d('0xe'))[_0x231d('0xf')](socket);function respondWithRpcPromise(_0x476d92,_0x82c88c,_0x1f54a7){return new BPromise(function(_0x68d2bd,_0x155e42){return client[_0x231d('0x10')](_0x476d92,_0x1f54a7)[_0x231d('0x11')](function(_0x1b6fbe){logger[_0x231d('0x12')](_0x231d('0x13'),_0x82c88c,_0x231d('0x14'));logger[_0x231d('0x15')](_0x231d('0x16'),_0x82c88c,_0x231d('0x14'),JSON[_0x231d('0x17')](_0x1b6fbe));if(_0x1b6fbe[_0x231d('0x18')]){if(_0x1b6fbe['error'][_0x231d('0x19')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x82c88c,_0x1b6fbe[_0x231d('0x18')][_0x231d('0x1a')]);return _0x155e42(_0x1b6fbe[_0x231d('0x18')][_0x231d('0x1a')]);}logger[_0x231d('0x18')](_0x231d('0x13'),_0x82c88c,_0x1b6fbe['error'][_0x231d('0x1a')]);return _0x68d2bd(_0x1b6fbe[_0x231d('0x18')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x82c88c,_0x231d('0x14'));_0x68d2bd(_0x1b6fbe[_0x231d('0x1b')][_0x231d('0x1a')]);}})[_0x231d('0x1c')](function(_0x1ff17f){logger[_0x231d('0x18')]('SmsAccount,\x20%s,\x20%s',_0x82c88c,_0x1ff17f);_0x155e42(_0x1ff17f);});});}exports[_0x231d('0x1d')]=function(_0x4d004a){var _0x4a4b27=this;return new Promise(function(_0x28d7a9,_0x417e4a){return db['SmsAccount'][_0x231d('0x1e')]({'raw':_0x4d004a['options']?_0x4d004a[_0x231d('0x1f')][_0x231d('0x20')]===undefined?!![]:![]:!![],'where':_0x4d004a[_0x231d('0x1f')]?_0x4d004a[_0x231d('0x1f')][_0x231d('0x21')]||null:null,'attributes':_0x4d004a[_0x231d('0x1f')]?_0x4d004a['options'][_0x231d('0x22')]||null:null,'include':_0x4d004a[_0x231d('0x1f')]?_0x4d004a[_0x231d('0x1f')][_0x231d('0x23')]?_[_0x231d('0x24')](_0x4d004a[_0x231d('0x1f')][_0x231d('0x23')],function(_0x280d79){return{'model':db[_0x280d79[_0x231d('0x25')]],'as':_0x280d79['as'],'attributes':_0x280d79[_0x231d('0x22')],'include':_0x280d79[_0x231d('0x23')]?_[_0x231d('0x24')](_0x280d79[_0x231d('0x23')],function(_0x26ef61){return{'model':db[_0x26ef61[_0x231d('0x25')]],'as':_0x26ef61['as'],'attributes':_0x26ef61[_0x231d('0x22')],'include':_0x26ef61[_0x231d('0x23')]?_['map'](_0x26ef61[_0x231d('0x23')],function(_0x5950fb){return{'model':db[_0x5950fb[_0x231d('0x25')]],'as':_0x5950fb['as'],'attributes':_0x5950fb[_0x231d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x409950){logger['info'](_0x231d('0x1d'),_0x4d004a);logger[_0x231d('0x15')](_0x231d('0x1d'),_0x4d004a,JSON[_0x231d('0x17')](_0x409950));_0x28d7a9(_0x409950);})[_0x231d('0x1c')](function(_0x1739c7){logger[_0x231d('0x18')](_0x231d('0x1d'),_0x1739c7[_0x231d('0x1a')],_0x4d004a);_0x417e4a(_0x4a4b27['error'](0x1f4,_0x1739c7[_0x231d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2f68f06..b9f0f55 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 _0x68f5=['update','emit','removeListener','register','./smsAccount.events','save','remove'];(function(_0x479b45,_0x1a22b2){var _0x3eb9ee=function(_0x558acb){while(--_0x558acb){_0x479b45['push'](_0x479b45['shift']());}};_0x3eb9ee(++_0x1a22b2);}(_0x68f5,0x107));var _0x568f=function(_0x21b61d,_0x2946a1){_0x21b61d=_0x21b61d-0x0;var _0x168d2f=_0x68f5[_0x21b61d];return _0x168d2f;};'use strict';var SmsAccountEvents=require(_0x568f('0x0'));var events=[_0x568f('0x1'),_0x568f('0x2'),_0x568f('0x3')];function createListener(_0x382c63,_0x1a3e67){return function(_0x55743a){_0x1a3e67[_0x568f('0x4')](_0x382c63,_0x55743a);};}function removeListener(_0x19cf14,_0x567b91){return function(){SmsAccountEvents[_0x568f('0x5')](_0x19cf14,_0x567b91);};}exports[_0x568f('0x6')]=function(_0x69ee4){for(var _0x3e7488=0x0,_0x2c79ba=events['length'];_0x3e7488<_0x2c79ba;_0x3e7488++){var _0x4ad2b3=events[_0x3e7488];var _0x4d5830=createListener('smsAccount:'+_0x4ad2b3,_0x69ee4);SmsAccountEvents['on'](_0x4ad2b3,_0x4d5830);}}; \ No newline at end of file +var _0x70a8=['remove','update','emit','removeListener','register'];(function(_0x9c9f5d,_0x5c8e94){var _0x205f51=function(_0x2c08ec){while(--_0x2c08ec){_0x9c9f5d['push'](_0x9c9f5d['shift']());}};_0x205f51(++_0x5c8e94);}(_0x70a8,0x1f4));var _0x870a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x70a8[_0x397e5f];return _0x5302b8;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0x870a('0x0'),_0x870a('0x1')];function createListener(_0x4bb2bd,_0x32cc92){return function(_0x5450d8){_0x32cc92[_0x870a('0x2')](_0x4bb2bd,_0x5450d8);};}function removeListener(_0x5623fd,_0x3a3213){return function(){SmsAccountEvents[_0x870a('0x3')](_0x5623fd,_0x3a3213);};}exports[_0x870a('0x4')]=function(_0x14ff49){for(var _0x321a7b=0x0,_0x29f591=events['length'];_0x321a7b<_0x29f591;_0x321a7b++){var _0x2954e2=events[_0x321a7b];var _0x1df986=createListener('smsAccount:'+_0x2954e2,_0x14ff49);SmsAccountEvents['on'](_0x2954e2,_0x1df986);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index cc59f66..c45055f 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 _0xebe8=['../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x15b045,_0x4a8587){var _0x559bf3=function(_0x3da78e){while(--_0x3da78e){_0x15b045['push'](_0x15b045['shift']());}};_0x559bf3(++_0x4a8587);}(_0xebe8,0x73));var _0x8ebe=function(_0x3699a4,_0x2ce40a){_0x3699a4=_0x3699a4-0x0;var _0x291717=_0xebe8[_0x3699a4];return _0x291717;};'use strict';var multer=require('multer');var util=require(_0x8ebe('0x0'));var path=require(_0x8ebe('0x1'));var timeout=require(_0x8ebe('0x2'));var express=require(_0x8ebe('0x3'));var router=express[_0x8ebe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ebe('0x5'));var config=require('../../config/environment');var controller=require(_0x8ebe('0x6'));router[_0x8ebe('0x7')]('/',auth[_0x8ebe('0x8')](),controller['index']);router['get']('/:id',auth[_0x8ebe('0x8')](),controller['show']);router['post']('/',auth[_0x8ebe('0x8')](),controller['create']);router[_0x8ebe('0x9')](_0x8ebe('0xa'),auth[_0x8ebe('0x8')](),controller[_0x8ebe('0xb')]);router[_0x8ebe('0xc')](_0x8ebe('0xa'),auth[_0x8ebe('0x8')](),controller[_0x8ebe('0xd')]);module[_0x8ebe('0xe')]=router; \ No newline at end of file +var _0xba93=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0xba93,0xe7));var _0x3ba9=function(_0xdd6f76,_0xf7c748){_0xdd6f76=_0xdd6f76-0x0;var _0x1ff8a1=_0xba93[_0xdd6f76];return _0x1ff8a1;};'use strict';var multer=require(_0x3ba9('0x0'));var util=require(_0x3ba9('0x1'));var path=require(_0x3ba9('0x2'));var timeout=require(_0x3ba9('0x3'));var express=require('express');var router=express[_0x3ba9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ba9('0x5'));var config=require(_0x3ba9('0x6'));var controller=require('./smsApplication.controller');router[_0x3ba9('0x7')]('/',auth[_0x3ba9('0x8')](),controller[_0x3ba9('0x9')]);router[_0x3ba9('0x7')](_0x3ba9('0xa'),auth[_0x3ba9('0x8')](),controller[_0x3ba9('0xb')]);router[_0x3ba9('0xc')]('/',auth[_0x3ba9('0x8')](),controller[_0x3ba9('0xd')]);router['put'](_0x3ba9('0xa'),auth['isAuthenticated'](),controller[_0x3ba9('0xe')]);router[_0x3ba9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3ba9('0x10')]);module[_0x3ba9('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index fa54fde..055d333 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 _0xaa67=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xaa67,0xed));var _0x7aa6=function(_0x1091ff,_0xa5903c){_0x1091ff=_0x1091ff-0x0;var _0x10fa1e=_0xaa67[_0x1091ff];return _0x10fa1e;};'use strict';var Sequelize=require('sequelize');module[_0x7aa6('0x0')]={'priority':{'type':Sequelize[_0x7aa6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7aa6('0x2')],'allowNull':![],'defaultValue':_0x7aa6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7aa6('0x2')]},'interval':{'type':Sequelize[_0x7aa6('0x2')],'defaultValue':_0x7aa6('0x4')}}; \ No newline at end of file +var _0xd755=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x27ad60,_0x5c91c9){var _0x1ef090=function(_0x3bf0fa){while(--_0x3bf0fa){_0x27ad60['push'](_0x27ad60['shift']());}};_0x1ef090(++_0x5c91c9);}(_0xd755,0x1e9));var _0x5d75=function(_0x229cfd,_0x3d7b4c){_0x229cfd=_0x229cfd-0x0;var _0x5621a3=_0xd755[_0x229cfd];return _0x5621a3;};'use strict';var Sequelize=require(_0x5d75('0x0'));module[_0x5d75('0x1')]={'priority':{'type':Sequelize[_0x5d75('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5d75('0x3')],'allowNull':![],'defaultValue':_0x5d75('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5d75('0x3')]},'interval':{'type':Sequelize[_0x5d75('0x3')],'defaultValue':_0x5d75('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a622220..26bdb43 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 _0x7348=['path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2e890e,_0x1a22b7){var _0x5d2b7f=function(_0x464442){while(--_0x464442){_0x2e890e['push'](_0x2e890e['shift']());}};_0x5d2b7f(++_0x1a22b7);}(_0x7348,0x16b));var _0x8734=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7348[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8734('0x0'));var rimraf=require(_0x8734('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8734('0x2'));var rp=require(_0x8734('0x3'));var moment=require(_0x8734('0x4'));var BPromise=require(_0x8734('0x5'));var Mustache=require(_0x8734('0x6'));var util=require('util');var path=require(_0x8734('0x7'));var sox=require('sox');var csv=require(_0x8734('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8734('0x9'));var squel=require(_0x8734('0xa'));var crypto=require(_0x8734('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8734('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8734('0xd'));var Redis=require('ioredis');var authService=require(_0x8734('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8734('0xf'));var hardwareService=require(_0x8734('0x10'));var logger=require(_0x8734('0x11'))(_0x8734('0x12'));var utils=require('../../config/utils');var config=require(_0x8734('0x13'));var licenseUtil=require(_0x8734('0x14'));var db=require(_0x8734('0x15'))['db'];function respondWithStatusCode(_0x9c3bf3,_0xca1e47){_0xca1e47=_0xca1e47||0xcc;return function(_0x110e0f){if(_0x110e0f){return _0x9c3bf3[_0x8734('0x16')](_0xca1e47);}return _0x9c3bf3['status'](_0xca1e47)[_0x8734('0x17')]();};}function respondWithResult(_0x4986b6,_0x5b3360){_0x5b3360=_0x5b3360||0xc8;return function(_0x5750ae){if(_0x5750ae){return _0x4986b6[_0x8734('0x18')](_0x5b3360)[_0x8734('0x19')](_0x5750ae);}};}function respondWithFilteredResult(_0xcd2b64,_0x381cfb){return function(_0x642d54){if(_0x642d54){var _0x4a90aa=_0x642d54[_0x8734('0x1a')],_0x331872=_0x381cfb[_0x8734('0x1b')],_0x25fe2a=_0x381cfb[_0x8734('0x1b')]+_0x381cfb[_0x8734('0x1c')],_0x5b1663;if(_0x25fe2a>=_0x4a90aa){_0x25fe2a=_0x4a90aa;_0x5b1663=0xc8;}else{_0x5b1663=0xce;}_0xcd2b64[_0x8734('0x18')](_0x5b1663);return _0xcd2b64[_0x8734('0x1d')](_0x8734('0x1e'),_0x331872+'-'+_0x25fe2a+'/'+_0x4a90aa)['json'](_0x642d54);}return null;};}function patchUpdates(_0x564a92){return function(_0x3d2e95){try{jsonpatch[_0x8734('0x1f')](_0x3d2e95,_0x564a92,!![]);}catch(_0x363393){return BPromise[_0x8734('0x20')](_0x363393);}return _0x3d2e95[_0x8734('0x21')]();};}function saveUpdates(_0xdf974b,_0x4885c0){return function(_0x4892c9){if(_0x4892c9){return _0x4892c9['update'](_0xdf974b)[_0x8734('0x22')](function(_0x21fde7){return _0x21fde7;});}return null;};}function removeEntity(_0x5ee54a,_0x2d94d8){return function(_0x1cd22e){if(_0x1cd22e){return _0x1cd22e[_0x8734('0x23')]()[_0x8734('0x22')](function(){_0x5ee54a['status'](0xcc)[_0x8734('0x17')]();});}};}function handleEntityNotFound(_0x4a022e,_0x3fc8c8){return function(_0xa65ce6){if(!_0xa65ce6){_0x4a022e[_0x8734('0x16')](0x194);}return _0xa65ce6;};}function handleError(_0x316fe6,_0x440d4d){_0x440d4d=_0x440d4d||0x1f4;return function(_0x23b59e){logger[_0x8734('0x24')](_0x23b59e[_0x8734('0x25')]);if(_0x23b59e['name']){delete _0x23b59e[_0x8734('0x26')];}_0x316fe6[_0x8734('0x18')](_0x440d4d)[_0x8734('0x27')](_0x23b59e);};}exports[_0x8734('0x28')]=function(_0x14ea87,_0x232170){var _0xa831f3={},_0x3acb61={},_0x57530f={'count':0x0,'rows':[]};var _0xd12ca7=_[_0x8734('0x29')](db[_0x8734('0x2a')][_0x8734('0x2b')],function(_0x2c439d){return{'name':_0x2c439d[_0x8734('0x2c')],'type':_0x2c439d['type'][_0x8734('0x2d')]};});_0x3acb61[_0x8734('0x2e')]=_['map'](_0xd12ca7,_0x8734('0x26'));_0x3acb61['query']=_[_0x8734('0x2f')](_0x14ea87[_0x8734('0x30')]);_0x3acb61[_0x8734('0x31')]=_[_0x8734('0x32')](_0x3acb61[_0x8734('0x2e')],_0x3acb61[_0x8734('0x30')]);_0xa831f3[_0x8734('0x33')]=_['intersection'](_0x3acb61[_0x8734('0x2e')],qs[_0x8734('0x34')](_0x14ea87[_0x8734('0x30')]['fields']));_0xa831f3[_0x8734('0x33')]=_0xa831f3[_0x8734('0x33')][_0x8734('0x35')]?_0xa831f3[_0x8734('0x33')]:_0x3acb61[_0x8734('0x2e')];if(!_0x14ea87[_0x8734('0x30')][_0x8734('0x36')]('nolimit')){_0xa831f3['limit']=qs['limit'](_0x14ea87[_0x8734('0x30')][_0x8734('0x1c')]);_0xa831f3[_0x8734('0x1b')]=qs[_0x8734('0x1b')](_0x14ea87['query'][_0x8734('0x1b')]);}_0xa831f3[_0x8734('0x37')]=qs[_0x8734('0x38')](_0x14ea87[_0x8734('0x30')][_0x8734('0x38')]);_0xa831f3[_0x8734('0x39')]=qs['filters'](_[_0x8734('0x3a')](_0x14ea87['query'],_0x3acb61['filters']),_0xd12ca7);if(_0x14ea87['query'][_0x8734('0x3b')]){_0xa831f3[_0x8734('0x39')]=_[_0x8734('0x3c')](_0xa831f3[_0x8734('0x39')],{'$or':_[_0x8734('0x29')](_0xd12ca7,function(_0x4e6740){if(_0x4e6740[_0x8734('0x3d')]!==_0x8734('0x3e')){var _0x56af1b={};_0x56af1b[_0x4e6740[_0x8734('0x26')]]={'$like':'%'+_0x14ea87['query'][_0x8734('0x3b')]+'%'};return _0x56af1b;}})});}_0xa831f3=_[_0x8734('0x3c')]({},_0xa831f3,_0x14ea87['options']);var _0x25ae8f={'where':_0xa831f3['where']};return db[_0x8734('0x2a')][_0x8734('0x1a')](_0x25ae8f)[_0x8734('0x22')](function(_0x4428eb){_0x57530f[_0x8734('0x1a')]=_0x4428eb;if(_0x14ea87[_0x8734('0x30')][_0x8734('0x3f')]){_0xa831f3[_0x8734('0x40')]=[{'all':!![]}];}return db[_0x8734('0x2a')][_0x8734('0x41')](_0xa831f3);})[_0x8734('0x22')](function(_0x2fea68){_0x57530f['rows']=_0x2fea68;return _0x57530f;})[_0x8734('0x22')](respondWithFilteredResult(_0x232170,_0xa831f3))[_0x8734('0x42')](handleError(_0x232170,null));};exports[_0x8734('0x43')]=function(_0x37cdf2,_0x22dc22){var _0x3b3643={'raw':!![],'where':{'id':_0x37cdf2[_0x8734('0x44')]['id']}},_0x9008ce={};_0x9008ce[_0x8734('0x2e')]=_[_0x8734('0x2f')](db['SmsApplication'][_0x8734('0x2b')]);_0x9008ce[_0x8734('0x30')]=_[_0x8734('0x2f')](_0x37cdf2[_0x8734('0x30')]);_0x9008ce[_0x8734('0x31')]=_[_0x8734('0x32')](_0x9008ce['model'],_0x9008ce['query']);_0x3b3643['attributes']=_['intersection'](_0x9008ce[_0x8734('0x2e')],qs['fields'](_0x37cdf2[_0x8734('0x30')]['fields']));_0x3b3643[_0x8734('0x33')]=_0x3b3643[_0x8734('0x33')][_0x8734('0x35')]?_0x3b3643[_0x8734('0x33')]:_0x9008ce[_0x8734('0x2e')];if(_0x37cdf2[_0x8734('0x30')]['includeAll']){_0x3b3643[_0x8734('0x40')]=[{'all':!![]}];}_0x3b3643=_[_0x8734('0x3c')]({},_0x3b3643,_0x37cdf2[_0x8734('0x45')]);return db[_0x8734('0x2a')][_0x8734('0x46')](_0x3b3643)[_0x8734('0x22')](handleEntityNotFound(_0x22dc22,null))[_0x8734('0x22')](respondWithResult(_0x22dc22,null))[_0x8734('0x42')](handleError(_0x22dc22,null));};exports['create']=function(_0x3e6099,_0xe5bb27){return db[_0x8734('0x2a')][_0x8734('0x47')](_0x3e6099['body'],{})[_0x8734('0x22')](respondWithResult(_0xe5bb27,0xc9))[_0x8734('0x42')](handleError(_0xe5bb27,null));};exports[_0x8734('0x48')]=function(_0x46cbcd,_0x314055){if(_0x46cbcd['body']['id']){delete _0x46cbcd[_0x8734('0x49')]['id'];}return db['SmsApplication'][_0x8734('0x46')]({'where':{'id':_0x46cbcd['params']['id']}})[_0x8734('0x22')](handleEntityNotFound(_0x314055,null))['then'](saveUpdates(_0x46cbcd[_0x8734('0x49')],null))['then'](respondWithResult(_0x314055,null))['catch'](handleError(_0x314055,null));};exports['destroy']=function(_0x83039e,_0xe395f4){return db[_0x8734('0x2a')]['find']({'where':{'id':_0x83039e[_0x8734('0x44')]['id']}})[_0x8734('0x22')](handleEntityNotFound(_0xe395f4,null))[_0x8734('0x22')](removeEntity(_0xe395f4,null))['catch'](handleError(_0xe395f4,null));}; \ No newline at end of file +var _0x4bec=['create','body','find','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','filters','model','attributes','intersection','query','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','params','keys','length','includeAll'];(function(_0x513f3c,_0x146723){var _0x37b196=function(_0x43dfb3){while(--_0x43dfb3){_0x513f3c['push'](_0x513f3c['shift']());}};_0x37b196(++_0x146723);}(_0x4bec,0xdc));var _0xc4be=function(_0x33f40e,_0x43c383){_0x33f40e=_0x33f40e-0x0;var _0x35c72d=_0x4bec[_0x33f40e];return _0x35c72d;};'use strict';var pdf=require(_0xc4be('0x0'));var emlformat=require(_0xc4be('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc4be('0x2'));var jsonpatch=require(_0xc4be('0x3'));var rp=require(_0xc4be('0x4'));var moment=require(_0xc4be('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4be('0x6'));var util=require(_0xc4be('0x7'));var path=require(_0xc4be('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4be('0x9'));var fs=require('fs');var _=require(_0xc4be('0xa'));var squel=require('squel');var crypto=require(_0xc4be('0xb'));var jsforce=require(_0xc4be('0xc'));var deskjs=require(_0xc4be('0xd'));var toCsv=require(_0xc4be('0xe'));var querystring=require('querystring');var Papa=require(_0xc4be('0xf'));var Redis=require(_0xc4be('0x10'));var authService=require(_0xc4be('0x11'));var qs=require(_0xc4be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4be('0x13'));var logger=require(_0xc4be('0x14'))(_0xc4be('0x15'));var utils=require('../../config/utils');var config=require(_0xc4be('0x16'));var licenseUtil=require(_0xc4be('0x17'));var db=require(_0xc4be('0x18'))['db'];function respondWithStatusCode(_0x74bf32,_0x2bc750){_0x2bc750=_0x2bc750||0xcc;return function(_0xc54542){if(_0xc54542){return _0x74bf32[_0xc4be('0x19')](_0x2bc750);}return _0x74bf32[_0xc4be('0x1a')](_0x2bc750)['end']();};}function respondWithResult(_0x4e18ec,_0x3bc51f){_0x3bc51f=_0x3bc51f||0xc8;return function(_0x45187c){if(_0x45187c){return _0x4e18ec[_0xc4be('0x1a')](_0x3bc51f)[_0xc4be('0x1b')](_0x45187c);}};}function respondWithFilteredResult(_0x7680d2,_0xcdc9f5){return function(_0x525962){if(_0x525962){var _0x376769=_0x525962[_0xc4be('0x1c')],_0x129615=_0xcdc9f5['offset'],_0x43e811=_0xcdc9f5[_0xc4be('0x1d')]+_0xcdc9f5[_0xc4be('0x1e')],_0x1fec0f;if(_0x43e811>=_0x376769){_0x43e811=_0x376769;_0x1fec0f=0xc8;}else{_0x1fec0f=0xce;}_0x7680d2[_0xc4be('0x1a')](_0x1fec0f);return _0x7680d2['set'](_0xc4be('0x1f'),_0x129615+'-'+_0x43e811+'/'+_0x376769)['json'](_0x525962);}return null;};}function patchUpdates(_0x581fc6){return function(_0x2cf247){try{jsonpatch['apply'](_0x2cf247,_0x581fc6,!![]);}catch(_0x5f3d7f){return BPromise['reject'](_0x5f3d7f);}return _0x2cf247[_0xc4be('0x20')]();};}function saveUpdates(_0x3a7993,_0x3f16b7){return function(_0x2924c5){if(_0x2924c5){return _0x2924c5[_0xc4be('0x21')](_0x3a7993)[_0xc4be('0x22')](function(_0x2025a4){return _0x2025a4;});}return null;};}function removeEntity(_0x4cd94e,_0xf82f06){return function(_0x1b55d8){if(_0x1b55d8){return _0x1b55d8[_0xc4be('0x23')]()[_0xc4be('0x22')](function(){_0x4cd94e[_0xc4be('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154250,_0x5ad5b6){return function(_0x1443c6){if(!_0x1443c6){_0x154250[_0xc4be('0x19')](0x194);}return _0x1443c6;};}function handleError(_0x590c8e,_0x5b3482){_0x5b3482=_0x5b3482||0x1f4;return function(_0xe60ae4){logger[_0xc4be('0x24')](_0xe60ae4[_0xc4be('0x25')]);if(_0xe60ae4['name']){delete _0xe60ae4[_0xc4be('0x26')];}_0x590c8e[_0xc4be('0x1a')](_0x5b3482)[_0xc4be('0x27')](_0xe60ae4);};}exports[_0xc4be('0x28')]=function(_0x1710fd,_0x2c8cb8){var _0x408fca={},_0xaa8aff={},_0x16411c={'count':0x0,'rows':[]};var _0x49d919=_[_0xc4be('0x29')](db[_0xc4be('0x2a')][_0xc4be('0x2b')],function(_0x2702a4){return{'name':_0x2702a4['fieldName'],'type':_0x2702a4[_0xc4be('0x2c')][_0xc4be('0x2d')]};});_0xaa8aff['model']=_[_0xc4be('0x29')](_0x49d919,_0xc4be('0x26'));_0xaa8aff['query']=_['keys'](_0x1710fd['query']);_0xaa8aff[_0xc4be('0x2e')]=_['intersection'](_0xaa8aff[_0xc4be('0x2f')],_0xaa8aff['query']);_0x408fca[_0xc4be('0x30')]=_[_0xc4be('0x31')](_0xaa8aff[_0xc4be('0x2f')],qs['fields'](_0x1710fd[_0xc4be('0x32')][_0xc4be('0x33')]));_0x408fca[_0xc4be('0x30')]=_0x408fca[_0xc4be('0x30')]['length']?_0x408fca[_0xc4be('0x30')]:_0xaa8aff[_0xc4be('0x2f')];if(!_0x1710fd[_0xc4be('0x32')][_0xc4be('0x34')]('nolimit')){_0x408fca[_0xc4be('0x1e')]=qs[_0xc4be('0x1e')](_0x1710fd[_0xc4be('0x32')][_0xc4be('0x1e')]);_0x408fca[_0xc4be('0x1d')]=qs['offset'](_0x1710fd['query'][_0xc4be('0x1d')]);}_0x408fca[_0xc4be('0x35')]=qs[_0xc4be('0x36')](_0x1710fd['query'][_0xc4be('0x36')]);_0x408fca['where']=qs[_0xc4be('0x2e')](_[_0xc4be('0x37')](_0x1710fd[_0xc4be('0x32')],_0xaa8aff[_0xc4be('0x2e')]),_0x49d919);if(_0x1710fd[_0xc4be('0x32')][_0xc4be('0x38')]){_0x408fca[_0xc4be('0x39')]=_['merge'](_0x408fca['where'],{'$or':_['map'](_0x49d919,function(_0x2d1abf){if(_0x2d1abf[_0xc4be('0x2c')]!==_0xc4be('0x3a')){var _0x4886cf={};_0x4886cf[_0x2d1abf[_0xc4be('0x26')]]={'$like':'%'+_0x1710fd[_0xc4be('0x32')]['filter']+'%'};return _0x4886cf;}})});}_0x408fca=_[_0xc4be('0x3b')]({},_0x408fca,_0x1710fd[_0xc4be('0x3c')]);var _0x437ed1={'where':_0x408fca['where']};return db[_0xc4be('0x2a')][_0xc4be('0x1c')](_0x437ed1)[_0xc4be('0x22')](function(_0x1566c9){_0x16411c[_0xc4be('0x1c')]=_0x1566c9;if(_0x1710fd[_0xc4be('0x32')]['includeAll']){_0x408fca[_0xc4be('0x3d')]=[{'all':!![]}];}return db[_0xc4be('0x2a')][_0xc4be('0x3e')](_0x408fca);})[_0xc4be('0x22')](function(_0x4cb898){_0x16411c[_0xc4be('0x3f')]=_0x4cb898;return _0x16411c;})[_0xc4be('0x22')](respondWithFilteredResult(_0x2c8cb8,_0x408fca))['catch'](handleError(_0x2c8cb8,null));};exports['show']=function(_0x5e9065,_0x11bffb){var _0x1ac509={'raw':!![],'where':{'id':_0x5e9065[_0xc4be('0x40')]['id']}},_0x5aae93={};_0x5aae93['model']=_[_0xc4be('0x41')](db[_0xc4be('0x2a')][_0xc4be('0x2b')]);_0x5aae93[_0xc4be('0x32')]=_[_0xc4be('0x41')](_0x5e9065[_0xc4be('0x32')]);_0x5aae93[_0xc4be('0x2e')]=_[_0xc4be('0x31')](_0x5aae93[_0xc4be('0x2f')],_0x5aae93[_0xc4be('0x32')]);_0x1ac509[_0xc4be('0x30')]=_['intersection'](_0x5aae93[_0xc4be('0x2f')],qs['fields'](_0x5e9065[_0xc4be('0x32')][_0xc4be('0x33')]));_0x1ac509[_0xc4be('0x30')]=_0x1ac509[_0xc4be('0x30')][_0xc4be('0x42')]?_0x1ac509[_0xc4be('0x30')]:_0x5aae93[_0xc4be('0x2f')];if(_0x5e9065[_0xc4be('0x32')][_0xc4be('0x43')]){_0x1ac509[_0xc4be('0x3d')]=[{'all':!![]}];}_0x1ac509=_['merge']({},_0x1ac509,_0x5e9065['options']);return db['SmsApplication']['find'](_0x1ac509)[_0xc4be('0x22')](handleEntityNotFound(_0x11bffb,null))[_0xc4be('0x22')](respondWithResult(_0x11bffb,null))['catch'](handleError(_0x11bffb,null));};exports[_0xc4be('0x44')]=function(_0x4f9b04,_0x3a4c33){return db[_0xc4be('0x2a')]['create'](_0x4f9b04[_0xc4be('0x45')],{})[_0xc4be('0x22')](respondWithResult(_0x3a4c33,0xc9))['catch'](handleError(_0x3a4c33,null));};exports[_0xc4be('0x21')]=function(_0x38887f,_0x2dc5fa){if(_0x38887f[_0xc4be('0x45')]['id']){delete _0x38887f[_0xc4be('0x45')]['id'];}return db[_0xc4be('0x2a')][_0xc4be('0x46')]({'where':{'id':_0x38887f[_0xc4be('0x40')]['id']}})[_0xc4be('0x22')](handleEntityNotFound(_0x2dc5fa,null))['then'](saveUpdates(_0x38887f[_0xc4be('0x45')],null))[_0xc4be('0x22')](respondWithResult(_0x2dc5fa,null))[_0xc4be('0x47')](handleError(_0x2dc5fa,null));};exports[_0xc4be('0x23')]=function(_0x2a9c93,_0x25776a){return db[_0xc4be('0x2a')]['find']({'where':{'id':_0x2a9c93[_0xc4be('0x40')]['id']}})[_0xc4be('0x22')](handleEntityNotFound(_0x25776a,null))[_0xc4be('0x22')](removeEntity(_0x25776a,null))[_0xc4be('0x47')](handleError(_0x25776a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b530a74..9ce2742 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 _0x41f9=['api','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','lodash','util'];(function(_0x3385b3,_0x34c10b){var _0x2ed909=function(_0x345d3e){while(--_0x345d3e){_0x3385b3['push'](_0x3385b3['shift']());}};_0x2ed909(++_0x34c10b);}(_0x41f9,0xa6));var _0x941f=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x41f9[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x941f('0x0'));var util=require(_0x941f('0x1'));var logger=require('../../config/logger')(_0x941f('0x2'));var moment=require(_0x941f('0x3'));var BPromise=require(_0x941f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x941f('0x5'));var rimraf=require(_0x941f('0x6'));var config=require(_0x941f('0x7'));var attributes=require(_0x941f('0x8'));module[_0x941f('0x9')]=function(_0x57628b,_0x516706){return _0x57628b[_0x941f('0xa')]('SmsApplication',attributes,{'tableName':_0x941f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x29c3=['sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','SmsApplication'];(function(_0x424939,_0x1d73ac){var _0x205af5=function(_0x31ecf4){while(--_0x31ecf4){_0x424939['push'](_0x424939['shift']());}};_0x205af5(++_0x1d73ac);}(_0x29c3,0x1cb));var _0x329c=function(_0x2cbd0a,_0x2e3f2a){_0x2cbd0a=_0x2cbd0a-0x0;var _0x223ac9=_0x29c3[_0x2cbd0a];return _0x223ac9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x329c('0x0'))(_0x329c('0x1'));var moment=require(_0x329c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x329c('0x3'));var rimraf=require(_0x329c('0x4'));var config=require(_0x329c('0x5'));var attributes=require('./smsApplication.attributes');module[_0x329c('0x6')]=function(_0x23762f,_0x43a518){return _0x23762f[_0x329c('0x7')](_0x329c('0x8'),attributes,{'tableName':_0x329c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x329c('0xa'),'collate':_0x329c('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 33c58be..06b8919 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 _0x34f8=['http','request','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34f8,0x80));var _0x834f=function(_0x1e5d7e,_0x1406fc){_0x1e5d7e=_0x1e5d7e-0x0;var _0x1fdba6=_0x34f8[_0x1e5d7e];return _0x1fdba6;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var moment=require(_0x834f('0x2'));var BPromise=require(_0x834f('0x3'));var rs=require(_0x834f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x834f('0x5'));var logger=require(_0x834f('0x6'))('rpc');var config=require(_0x834f('0x7'));var jayson=require(_0x834f('0x8'));var client=jayson[_0x834f('0x9')][_0x834f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5378c4,_0x4cd107,_0xf778e4){return new BPromise(function(_0x2597c6,_0x20b504){return client[_0x834f('0xb')](_0x5378c4,_0xf778e4)['then'](function(_0x4210cf){logger[_0x834f('0xc')]('SmsApplication,\x20%s,\x20%s',_0x4cd107,_0x834f('0xd'));logger[_0x834f('0xe')](_0x834f('0xf'),_0x4cd107,_0x834f('0xd'),JSON[_0x834f('0x10')](_0x4210cf));if(_0x4210cf[_0x834f('0x11')]){if(_0x4210cf[_0x834f('0x11')][_0x834f('0x12')]===0x1f4){logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);return _0x20b504(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')]['message']);return _0x2597c6(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}else{logger['info'](_0x834f('0x13'),_0x4cd107,'request\x20sent');_0x2597c6(_0x4210cf[_0x834f('0x15')][_0x834f('0x14')]);}})[_0x834f('0x16')](function(_0x248924){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4cd107,_0x248924);_0x20b504(_0x248924);});});} \ No newline at end of file +var _0x106f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird'];(function(_0x9fc922,_0x1b72e9){var _0x170ccb=function(_0xb08662){while(--_0xb08662){_0x9fc922['push'](_0x9fc922['shift']());}};_0x170ccb(++_0x1b72e9);}(_0x106f,0x162));var _0xf106=function(_0x478b34,_0x484bda){_0x478b34=_0x478b34-0x0;var _0xd36963=_0x106f[_0x478b34];return _0xd36963;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var moment=require('moment');var BPromise=require(_0xf106('0x2'));var rs=require(_0xf106('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf106('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf106('0x5'))(_0xf106('0x6'));var config=require(_0xf106('0x7'));var jayson=require(_0xf106('0x8'));var client=jayson[_0xf106('0x9')][_0xf106('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc9588d,_0x546acc,_0x4ea3b8){return new BPromise(function(_0x3ac1bd,_0x5ea4f0){return client['request'](_0xc9588d,_0x4ea3b8)['then'](function(_0x4bd78d){logger['info'](_0xf106('0xb'),_0x546acc,_0xf106('0xc'));logger[_0xf106('0xd')](_0xf106('0xe'),_0x546acc,_0xf106('0xc'),JSON[_0xf106('0xf')](_0x4bd78d));if(_0x4bd78d[_0xf106('0x10')]){if(_0x4bd78d[_0xf106('0x10')][_0xf106('0x11')]===0x1f4){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x4bd78d['error'][_0xf106('0x12')]);return _0x5ea4f0(_0x4bd78d[_0xf106('0x10')]['message']);}logger['error'](_0xf106('0xb'),_0x546acc,_0x4bd78d[_0xf106('0x10')][_0xf106('0x12')]);return _0x3ac1bd(_0x4bd78d['error'][_0xf106('0x12')]);}else{logger[_0xf106('0x13')](_0xf106('0xb'),_0x546acc,'request\x20sent');_0x3ac1bd(_0x4bd78d[_0xf106('0x14')][_0xf106('0x12')]);}})['catch'](function(_0x134f6d){logger[_0xf106('0x10')](_0xf106('0xb'),_0x546acc,_0x134f6d);_0x5ea4f0(_0x134f6d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2626815..8162661 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 _0xdf55=['addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x37c032,_0x43c8be){var _0x5d9e9a=function(_0x26a42a){while(--_0x26a42a){_0x37c032['push'](_0x37c032['shift']());}};_0x5d9e9a(++_0x43c8be);}(_0xdf55,0x6a));var _0x5df5=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xdf55[_0x152136];return _0x20df44;};'use strict';var multer=require('multer');var util=require(_0x5df5('0x0'));var path=require(_0x5df5('0x1'));var timeout=require('connect-timeout');var express=require(_0x5df5('0x2'));var router=express[_0x5df5('0x3')]();var auth=require(_0x5df5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5df5('0x5'));var controller=require('./smsInteraction.controller');router[_0x5df5('0x6')]('/',auth[_0x5df5('0x7')](),controller[_0x5df5('0x8')]);router[_0x5df5('0x6')](_0x5df5('0x9'),auth[_0x5df5('0x7')](),controller['describe']);router[_0x5df5('0x6')](_0x5df5('0xa'),auth[_0x5df5('0x7')](),controller[_0x5df5('0xb')]);router['get'](_0x5df5('0xc'),auth['isAuthenticated'](),controller[_0x5df5('0xd')]);router['get'](_0x5df5('0xe'),auth[_0x5df5('0x7')](),controller[_0x5df5('0xf')]);router[_0x5df5('0x10')]('/',auth[_0x5df5('0x7')](),controller[_0x5df5('0x11')]);router[_0x5df5('0x10')](_0x5df5('0xc'),auth[_0x5df5('0x7')](),controller[_0x5df5('0x12')]);router[_0x5df5('0x10')](_0x5df5('0x13'),auth['isAuthenticated'](),interaction[_0x5df5('0x14')](_0x5df5('0x15'),_0x5df5('0x16')),controller['addTags']);router[_0x5df5('0x17')](_0x5df5('0xa'),auth[_0x5df5('0x7')](),interaction[_0x5df5('0x14')](_0x5df5('0x15'),_0x5df5('0x18')),controller[_0x5df5('0x19')]);router[_0x5df5('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x5df5('0x15'),_0x5df5('0x1b')),controller[_0x5df5('0x1c')]);router[_0x5df5('0x1a')](_0x5df5('0x13'),auth[_0x5df5('0x7')](),controller[_0x5df5('0x1d')]);module[_0x5df5('0x1e')]=router; \ No newline at end of file +var _0x507d=['removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','smsinteraction:destroy','destroy','delete','/:id/tags'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x507d,0x178));var _0xd507=function(_0x497c14,_0x317176){_0x497c14=_0x497c14-0x0;var _0x3cc8d7=_0x507d[_0x497c14];return _0x3cc8d7;};'use strict';var multer=require('multer');var util=require(_0xd507('0x0'));var path=require(_0xd507('0x1'));var timeout=require(_0xd507('0x2'));var express=require(_0xd507('0x3'));var router=express[_0xd507('0x4')]();var auth=require(_0xd507('0x5'));var interaction=require(_0xd507('0x6'));var config=require(_0xd507('0x7'));var controller=require(_0xd507('0x8'));router[_0xd507('0x9')]('/',auth[_0xd507('0xa')](),controller[_0xd507('0xb')]);router[_0xd507('0x9')]('/describe',auth[_0xd507('0xa')](),controller[_0xd507('0xc')]);router[_0xd507('0x9')](_0xd507('0xd'),auth[_0xd507('0xa')](),controller[_0xd507('0xe')]);router[_0xd507('0x9')]('/:id/messages',auth[_0xd507('0xa')](),controller[_0xd507('0xf')]);router[_0xd507('0x9')](_0xd507('0x10'),auth[_0xd507('0xa')](),controller[_0xd507('0x11')]);router[_0xd507('0x12')]('/',auth[_0xd507('0xa')](),controller[_0xd507('0x13')]);router['post'](_0xd507('0x14'),auth[_0xd507('0xa')](),controller[_0xd507('0x15')]);router[_0xd507('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xd507('0x16')](_0xd507('0x17'),_0xd507('0x18')),controller[_0xd507('0x19')]);router[_0xd507('0x1a')](_0xd507('0xd'),auth[_0xd507('0xa')](),interaction['tracked'](_0xd507('0x17'),_0xd507('0x1b')),controller['update']);router['delete'](_0xd507('0xd'),auth[_0xd507('0xa')](),interaction['tracked']('sms',_0xd507('0x1c')),controller[_0xd507('0x1d')]);router[_0xd507('0x1e')](_0xd507('0x1f'),auth[_0xd507('0xa')](),controller[_0xd507('0x20')]);module[_0xd507('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9ba6f0a..6f61a25 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 _0x8c82=['ENUM','out','moment','DATE','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8c82,0x15b));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x28c8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x28c8('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x28c8('0x2')]},'thirdDisposition':{'type':Sequelize[_0x28c8('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x28c8('0x2')]},'read1stAt':{'type':Sequelize[_0x28c8('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x28c8('0x3')]('in',_0x28c8('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x28c8('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x28c8('0x3')]('in',_0x28c8('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0d91=['ENUM','moment','DATE','STRING'];(function(_0x5079f6,_0x2e0e35){var _0x3c41c7=function(_0x50a20f){while(--_0x50a20f){_0x5079f6['push'](_0x5079f6['shift']());}};_0x3c41c7(++_0x2e0e35);}(_0x0d91,0xad));var _0x10d9=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x0d91[_0x2ec2bf];return _0x2c279c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x10d9('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x10d9('0x1')]},'disposition':{'type':Sequelize[_0x10d9('0x2')]},'secondDisposition':{'type':Sequelize[_0x10d9('0x2')]},'thirdDisposition':{'type':Sequelize[_0x10d9('0x2')]},'note':{'type':Sequelize[_0x10d9('0x2')]},'phone':{'type':Sequelize[_0x10d9('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x10d9('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x10d9('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a861a3d..051d0d9 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 _0xe49c=['join','server','files','tmp','attachments','CmContact','Contact','lastName','Messages','direction','secret','SmsAccount','Account','get','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','System','firstName','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','unlinkSync','html-pdf','eml-format','rimraf','request-promise','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','Users','fullname','TagIds','Tags','forEach','push','catch','index','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','user','i.SmsAccountId\x20IS\x20NULL','map','agent','SmsAccountId','sequelize','toString','count','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','include','create','destroy','describe','addMessage','SmsMessage','omit','ids','findOne','$gte','format','options','includeAll','findAll','rows','addTags','spread','emit','removeTags','download'];(function(_0x4c36dc,_0x89ebb6){var _0x4d9137=function(_0x4b947f){while(--_0x4b947f){_0x4c36dc['push'](_0x4c36dc['shift']());}};_0x4d9137(++_0x89ebb6);}(_0xe49c,0x1ef));var _0xce49=function(_0x33b62d,_0x507d01){_0x33b62d=_0x33b62d-0x0;var _0x215d79=_0xe49c[_0x33b62d];return _0x215d79;};'use strict';var pdf=require(_0xce49('0x0'));var emlformat=require(_0xce49('0x1'));var rimraf=require(_0xce49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce49('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce49('0x4'));var util=require(_0xce49('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xce49('0x6'));var ejs=require(_0xce49('0x7'));var fs=require('fs');var _=require(_0xce49('0x8'));var squel=require(_0xce49('0x9'));var crypto=require(_0xce49('0xa'));var jsforce=require(_0xce49('0xb'));var deskjs=require(_0xce49('0xc'));var toCsv=require(_0xce49('0x6'));var querystring=require('querystring');var Papa=require(_0xce49('0xd'));var Redis=require(_0xce49('0xe'));var authService=require(_0xce49('0xf'));var qs=require(_0xce49('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce49('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xce49('0x12'));var config=require(_0xce49('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xce49('0x14'))['db'];config[_0xce49('0x15')]=_[_0xce49('0x16')](config[_0xce49('0x15')],{'host':_0xce49('0x17'),'port':0x18eb});var socket=require(_0xce49('0x18'))(new Redis(config[_0xce49('0x15')]));require(_0xce49('0x19'))['register'](socket);function respondWithStatusCode(_0x3715ac,_0x1dcf32){_0x1dcf32=_0x1dcf32||0xcc;return function(_0x10baed){if(_0x10baed){return _0x3715ac[_0xce49('0x1a')](_0x1dcf32);}return _0x3715ac[_0xce49('0x1b')](_0x1dcf32)[_0xce49('0x1c')]();};}function respondWithResult(_0x4aabd7,_0x98f9a1){_0x98f9a1=_0x98f9a1||0xc8;return function(_0xdb6096){if(_0xdb6096){return _0x4aabd7[_0xce49('0x1b')](_0x98f9a1)[_0xce49('0x1d')](_0xdb6096);}};}function respondWithFilteredResult(_0x1acbc0,_0x4ddd58){return function(_0xc994a9){if(_0xc994a9){var _0x3619a2=_0xc994a9['count'],_0x6cbe8=_0x4ddd58['offset'],_0x1fcf4b=_0x4ddd58[_0xce49('0x1e')]+_0x4ddd58[_0xce49('0x1f')],_0x4e90bc;if(_0x1fcf4b>=_0x3619a2){_0x1fcf4b=_0x3619a2;_0x4e90bc=0xc8;}else{_0x4e90bc=0xce;}_0x1acbc0[_0xce49('0x1b')](_0x4e90bc);return _0x1acbc0[_0xce49('0x20')](_0xce49('0x21'),_0x6cbe8+'-'+_0x1fcf4b+'/'+_0x3619a2)[_0xce49('0x1d')](_0xc994a9);}return null;};}function patchUpdates(_0x33a470){return function(_0x15dcb1){try{jsonpatch[_0xce49('0x22')](_0x15dcb1,_0x33a470,!![]);}catch(_0xc78de2){return BPromise[_0xce49('0x23')](_0xc78de2);}return _0x15dcb1['save']();};}function saveUpdates(_0x2c1219,_0x28cc66){return function(_0x4c2975){if(_0x4c2975){return _0x4c2975[_0xce49('0x24')](_0x2c1219)[_0xce49('0x25')](function(_0x20ad9e){return _0x20ad9e;});}return null;};}function removeEntity(_0x330d99,_0x33fa36){return function(_0x4070ad){if(_0x4070ad){return _0x4070ad['destroy']()[_0xce49('0x25')](function(){_0x330d99[_0xce49('0x1b')](0xcc)[_0xce49('0x1c')]();});}};}function handleEntityNotFound(_0x47b3d1,_0x2e1772){return function(_0x1862b6){if(!_0x1862b6){_0x47b3d1[_0xce49('0x1a')](0x194);}return _0x1862b6;};}function handleError(_0x2469bc,_0x3970f0){_0x3970f0=_0x3970f0||0x1f4;return function(_0x52cedc){logger[_0xce49('0x26')](_0x52cedc[_0xce49('0x27')]);if(_0x52cedc['name']){delete _0x52cedc[_0xce49('0x28')];}_0x2469bc[_0xce49('0x1b')](_0x3970f0)['send'](_0x52cedc);};}function getInteractionUsers(_0x2686df,_0x1ee50c){return new BPromise(function(_0x5aaa79,_0x49ee54){try{if(_0x1ee50c[_0x2686df['id']]){_0x2686df[_0xce49('0x29')]=_['map'](_0x1ee50c[_0x2686df['id']],function(_0x1c1757){return{'id':_0x1c1757['id'],'fullname':_0x1c1757[_0xce49('0x2a')]};});}}catch(_0x556c1c){_0x49ee54(_0x556c1c);}_0x5aaa79(_0x2686df);});}function getInteractionTags(_0x5ab3a5,_0x47878b){return new BPromise(function(_0x3f7ad0,_0x4ec230){try{if(_0x5ab3a5[_0xce49('0x2b')]){_0x5ab3a5[_0xce49('0x2c')]=[];_0x5ab3a5['TagIds']['split'](',')[_0xce49('0x2d')](function(_0x3eb0f6){_0x5ab3a5[_0xce49('0x2c')][_0xce49('0x2e')](_0x47878b[_0x3eb0f6]);});}delete _0x5ab3a5[_0xce49('0x2b')];}catch(_0x3ed1a8){_0x4ec230(_0x3ed1a8);}_0x3f7ad0(_0x5ab3a5);});}function updateSmsInteraction(_0x444800,_0x4fa754,_0x26a374){return new BPromise(function(_0x2e8b44,_0x1763cd){return getInteractionUsers(_0x444800,_0x26a374)[_0xce49('0x25')](function(_0x5006e9){return getInteractionTags(_0x5006e9,_0x4fa754);})[_0xce49('0x25')](function(_0x5256cc){_0x2e8b44(_0x5256cc);})[_0xce49('0x2f')](function(_0x478704){_0x1763cd(_0x478704);});});}exports[_0xce49('0x30')]=function(_0x29b564,_0x4906ed){var _0x20499d={},_0x898edc={},_0x2295c5={'count':0x0,'rows':[]};var _0x1c76c2=_['map'](db['SmsInteraction'][_0xce49('0x31')],function(_0x19d7ba){return{'name':_0x19d7ba['fieldName'],'type':_0x19d7ba['type'][_0xce49('0x32')]};});_0x898edc[_0xce49('0x33')]=_['map'](_0x1c76c2,_0xce49('0x28'));_0x898edc[_0xce49('0x34')]=_['keys'](_0x29b564[_0xce49('0x34')]);_0x898edc[_0xce49('0x35')]=_[_0xce49('0x36')](_0x898edc[_0xce49('0x33')],_0x898edc['query']);_0x20499d[_0xce49('0x37')]=_[_0xce49('0x36')](_0x898edc[_0xce49('0x33')],qs[_0xce49('0x38')](_0x29b564['query'][_0xce49('0x38')]));_0x20499d[_0xce49('0x37')]=_0x20499d[_0xce49('0x37')][_0xce49('0x39')]?_0x20499d[_0xce49('0x37')]:_0x898edc[_0xce49('0x33')];if(!_0x29b564[_0xce49('0x34')][_0xce49('0x3a')](_0xce49('0x3b'))){_0x20499d['limit']=qs[_0xce49('0x1f')](_0x29b564[_0xce49('0x34')][_0xce49('0x1f')]);_0x20499d['offset']=qs[_0xce49('0x1e')](_0x29b564['query'][_0xce49('0x1e')]);}_0x20499d[_0xce49('0x3c')]=qs[_0xce49('0x3d')](_0x29b564[_0xce49('0x34')][_0xce49('0x3d')]);_0x20499d[_0xce49('0x3e')]=qs[_0xce49('0x35')](_[_0xce49('0x3f')](_0x29b564[_0xce49('0x34')],_0x898edc[_0xce49('0x35')]),_0x1c76c2);var _0x5d9ef4=[];var _0x304b06=squel[_0xce49('0x40')]()[_0xce49('0x41')]('id')['field'](_0xce49('0x28'))['field'](_0xce49('0x42'))[_0xce49('0x43')](_0xce49('0x44'));var _0x39b15c=squel[_0xce49('0x40')]()[_0xce49('0x41')](_0xce49('0x45'))['field']('u.fullname')[_0xce49('0x41')]('ui.SmsInteractionId')['from'](_0xce49('0x46'),'ui')[_0xce49('0x47')](_0xce49('0x48'),'u',_0xce49('0x49'));var _0xfc637e=squel[_0xce49('0x40')]()[_0xce49('0x43')]('sms_interactions','i')[_0xce49('0x47')]('cm_contacts','c',_0xce49('0x4a'))[_0xce49('0x47')](_0xce49('0x48'),'o',_0xce49('0x4b'))[_0xce49('0x47')](_0xce49('0x4c'),'a',_0xce49('0x4d'))[_0xce49('0x47')]('sms_messages','me',_0xce49('0x4e'))['left_join']('sms_interaction_has_tags','it',_0xce49('0x4f'))['left_join'](_0xce49('0x44'),'t',_0xce49('0x50'));var _0x1b41c4=squel[_0xce49('0x51')]();var _0x123ca5=[];var _0x39fd2c=squel['expr']();var _0x5bca2f;if(_0x29b564[_0xce49('0x34')]['search']){_0x5bca2f=as[_0xce49('0x52')](_0x29b564['query'][_0xce49('0x53')]);var _0x31a4dc=_0x5bca2f['sqlOperator'];for(var _0x423d22=0x0;_0x423d22<_0x5bca2f[_0xce49('0x54')][_0xce49('0x39')];_0x423d22++){var _0xa7bba4=_0x5bca2f['conditions'][_0x423d22];var _0x566e17='i';var _0x392334=_[_0xce49('0x55')](_0x1c76c2,[_0xce49('0x28'),_0xa7bba4[_0xce49('0x41')]]);if(!_0x392334){switch(_0xa7bba4[_0xce49('0x41')]){case _0xce49('0x56'):if(_0xa7bba4[_0xce49('0x57')]==0x1){_0xfc637e[_0xce49('0x58')]('`'+_0xa7bba4['field']+_0xce49('0x59'));}else{_0xfc637e['having']('`'+_0xa7bba4[_0xce49('0x41')]+_0xce49('0x5a'));}break;case'Contact':if(_0xa7bba4[_0xce49('0x5b')]===_0xce49('0x5c')){if(_0xa7bba4[_0xce49('0x57')][_0xce49('0x5d')]('\x20')[_0xce49('0x39')]>0x1){_0x1b41c4[_0x31a4dc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xa7bba4[_0xce49('0x57')]),null);}else{var _0x326744='%'+_0xa7bba4[_0xce49('0x57')]+'%';_0x1b41c4[_0x31a4dc](_0xce49('0x5e'),_0x326744,_0x326744,_0x326744);}}else{_0x392334=_[_0xce49('0x55')](_0x1c76c2,['name',_0xce49('0x5f')]);_0xa7bba4[_0xce49('0x41')]=_0xce49('0x5f');_0x130bab=as[_0xce49('0x60')](_0x566e17,_0x392334[_0xce49('0x61')],_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab[_0xce49('0x62')],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);}break;case _0xce49('0x64'):var _0x44e8c3=_0xa7bba4[_0xce49('0x57')][_0xce49('0x5d')](',')['map'](function(_0x438f80){return Number(_0x438f80);});_0x44e8c3[_0xce49('0x2d')](function(_0x3870cc){_0x39fd2c['or'](_0xce49('0x65'),'%,'+_0x3870cc+',%');});_0x123ca5=_[_0xce49('0x66')](_0x123ca5,_0x44e8c3);break;case _0xce49('0x67'):if(_0xa7bba4[_0xce49('0x5b')]===_0xce49('0x5c')){_0x1b41c4[_0x31a4dc](_0xce49('0x68'),'%'+_0xa7bba4[_0xce49('0x57')]+'%',null);}else{_0x392334=_[_0xce49('0x55')](_0x1c76c2,[_0xce49('0x28'),_0xce49('0x69')]);_0xa7bba4[_0xce49('0x41')]=_0xce49('0x69');_0x130bab=as[_0xce49('0x60')](_0x566e17,_0x392334['type'],_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab[_0xce49('0x62')],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);}break;case _0xce49('0x6a'):_0x130bab=as[_0xce49('0x60')]('me',null,_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab[_0xce49('0x62')],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);break;}}else{var _0x130bab=as['buildExpression'](_0x566e17,_0x392334[_0xce49('0x61')],_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab['text'],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);}}}else{var _0x1dc26b=_(_0x29b564[_0xce49('0x34')])[_0xce49('0x6b')]()['map'](function(_0x122191){return _[_0xce49('0x6c')](_0x1c76c2,[_0xce49('0x28'),_0x122191])?_0x122191:undefined;})['compact']()[_0xce49('0x57')]();if(!_['isEmpty'](_0x1dc26b)){_0x1dc26b[_0xce49('0x2d')](function(_0x207c48){if(_0x207c48==='SmsAccountId'){_0xfc637e[_0xce49('0x3e')](_0xce49('0x6d'),[]['concat'](_0x29b564[_0xce49('0x34')][_0x207c48]));}else if(_0x207c48===_0xce49('0x6e')){var _0x1c2d18=JSON[_0xce49('0x6f')](_0x29b564[_0xce49('0x34')][_0x207c48])['$gte'];var _0x483d85=JSON[_0xce49('0x6f')](_0x29b564[_0xce49('0x34')][_0x207c48])[_0xce49('0x70')];_0xfc637e[_0xce49('0x3e')](_0xce49('0x71'),_0x1c2d18,_0x483d85);}else{if(_0x29b564['query'][_0x207c48]===_0xce49('0x72')){_0xfc637e[_0xce49('0x3e')]('i.'+_0x207c48+_0xce49('0x73'));}else{_0xfc637e[_0xce49('0x3e')]('i.'+_0x207c48+_0xce49('0x74'),_0x29b564[_0xce49('0x34')][_0x207c48]);}}});}if(_0x29b564[_0xce49('0x34')][_0xce49('0x75')]){if(_0x29b564['query'][_0xce49('0x75')]==0x1){_0xfc637e[_0xce49('0x58')](_0xce49('0x76'));}else{_0xfc637e[_0xce49('0x58')](_0xce49('0x77'));}}if(_0x29b564[_0xce49('0x34')][_0xce49('0x78')]){_0x123ca5=_[_0xce49('0x79')](_0x29b564['query']['tag'])?_0x29b564[_0xce49('0x34')][_0xce49('0x78')]:new Array(_0x29b564[_0xce49('0x34')][_0xce49('0x78')]);_0x123ca5['forEach'](function(_0xd4f98d){_0x39fd2c['or'](_0xce49('0x65'),'%,'+_0xd4f98d+',%');});}if(_0x29b564[_0xce49('0x34')]['filter']){var _0x128edb=_0x29b564[_0xce49('0x34')][_0xce49('0x7a')][_0xce49('0x7b')]('\x5c','\x5c\x5c')[_0xce49('0x7b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x128edb)){_0x1b41c4['or']('i.id\x20LIKE\x20?',_0x128edb+'%')['or']('i.phone\x20LIKE\x20?',_0x128edb+'%');}else{_0x1b41c4['or'](_0xce49('0x7c'),qs[_0xce49('0x7d')](_0x128edb))['or'](_0xce49('0x7e'),_0x128edb+'%');}}}_0xfc637e[_0xce49('0x3e')](_0x1b41c4);_0xfc637e[_0xce49('0x7f')](_0xce49('0x80'));var _0x355e62={'type':db[_0xce49('0x81')][_0xce49('0x82')][_0xce49('0x83')],'raw':!![]};var _0x33e6b6=_0xfc637e[_0xce49('0x84')]();_0x33e6b6[_0xce49('0x41')]('i.id');_0x33e6b6[_0xce49('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xce49('0x56'));if(_0x20499d[_0xce49('0x3c')]){_0x20499d[_0xce49('0x3c')][_0xce49('0x2d')](function(_0x4ee2b6){var _0x5b845c=_0x4ee2b6[0x0]===_0xce49('0x85')?_0x4ee2b6[0x0]:'i.'+_0x4ee2b6[0x0];_0xfc637e[_0xce49('0x3c')](_0x5b845c,_0x4ee2b6[0x1]===_0xce49('0x86')?![]:!![]);});}if(!_[_0xce49('0x87')](_0x123ca5)){_0xfc637e[_0xce49('0x58')](_0x39fd2c);_0x33e6b6[_0xce49('0x3e')]('t.id\x20IN\x20?',_0x123ca5);}BPromise[_0xce49('0x88')]()[_0xce49('0x25')](function(){if(!_0x5bca2f){if(_0x29b564[_0xce49('0x34')]['SmsAccountId']||_0x29b564[_0xce49('0x34')][_0xce49('0x89')])return;_0x33e6b6['where'](_0xce49('0x8a'));_0xfc637e[_0xce49('0x3e')](_0xce49('0x8a'));return;}if(_0x29b564['user'][_0xce49('0x8b')]!=='agent')return;return _0x29b564[_0xce49('0x8c')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xce49('0x25')](function(_0x25bff9){if(_[_0xce49('0x87')](_0x25bff9)){_0x33e6b6['where']('i.SmsAccountId\x20IS\x20NULL');_0xfc637e[_0xce49('0x3e')](_0xce49('0x8d'));}else{_0x33e6b6[_0xce49('0x3e')]('i.SmsAccountId\x20IN\x20?',_[_0xce49('0x8e')](_0x25bff9,'id'));_0xfc637e[_0xce49('0x3e')](_0xce49('0x6d'),_['map'](_0x25bff9,'id'));}});})['then'](function(){if(_0x29b564['user'][_0xce49('0x8b')]===_0xce49('0x8f')&&!_0x5bca2f&&!_0x29b564[_0xce49('0x34')][_0xce49('0x90')])return[];return db[_0xce49('0x91')][_0xce49('0x34')](_0x33e6b6[_0xce49('0x92')](),_0x355e62);})[_0xce49('0x25')](function(_0x5c579f){_0x2295c5[_0xce49('0x93')]=_0x5c579f[_0xce49('0x39')];if(_0x2295c5[_0xce49('0x93')]===0x0)return[];return db[_0xce49('0x91')][_0xce49('0x34')](_0x304b06[_0xce49('0x92')](),_0x355e62)['then'](function(_0x25ba2e){_0x5d9ef4=_[_0xce49('0x94')](_0x25ba2e,'id');_0x355e62=_[_0xce49('0x95')](_0x355e62,{'model':db[_0xce49('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x29b564[_0xce49('0x34')][_0xce49('0x38')]){_0x20499d[_0xce49('0x37')][_0xce49('0x2d')](function(_0xe5995){_0xfc637e['field']('i.'+_0xe5995);});}else{_0xfc637e[_0xce49('0x41')](_0xce49('0x97'),_0xce49('0x56'));_0xfc637e[_0xce49('0x41')]('a.key',_0xce49('0x98'));_0xfc637e[_0xce49('0x41')](_0xce49('0x99'),_0xce49('0x9a'));_0xfc637e[_0xce49('0x41')](_0xce49('0x9b'),_0xce49('0x85'));_0xfc637e[_0xce49('0x41')](_0xce49('0x9c'));_0xfc637e[_0xce49('0x41')](_0xce49('0x9d'),'Contact.firstName');_0xfc637e['field'](_0xce49('0x9e'),'Contact.lastName');_0xfc637e[_0xce49('0x41')](_0xce49('0x9f'),_0xce49('0xa0'));_0xfc637e['field']('c.phone','Contact.phone');_0xfc637e['field'](_0xce49('0xa1'),_0xce49('0xa2'));_0xfc637e['field'](_0xce49('0xa3'),_0xce49('0xa4'));_0xfc637e[_0xce49('0x41')](_0xce49('0xa5'),_0xce49('0xa6'));_0xfc637e[_0xce49('0x41')]('o.internal',_0xce49('0xa7'));_0xfc637e['field'](_0xce49('0xa8'),_0xce49('0x2b'));}if(_0x20499d['limit'])_0xfc637e[_0xce49('0x1f')](_0x20499d[_0xce49('0x1f')]);if(_0x20499d['offset'])_0xfc637e[_0xce49('0x1e')](_0x20499d[_0xce49('0x1e')]);return db['sequelize'][_0xce49('0x34')](_0xfc637e['toString'](),_0x355e62);})[_0xce49('0x25')](function(_0x5e74dd){_0x39b15c[_0xce49('0x3e')](_0xce49('0xa9'),_['map'](_0x5e74dd,'id'));return db['sequelize'][_0xce49('0x34')](_0x39b15c['toString'](),_0x355e62)[_0xce49('0x25')](function(_0x3c0b68){var _0x3145bc=_[_0xce49('0xaa')](_0x3c0b68,_0xce49('0xab'));var _0x3755e3=[];_0x5e74dd[_0xce49('0x2d')](function(_0x3ea34d){_0x3755e3[_0xce49('0x2e')](updateSmsInteraction(_0x3ea34d,_0x5d9ef4,_0x3145bc));});return BPromise[_0xce49('0xac')](_0x3755e3);});});})[_0xce49('0x25')](function(_0x468db1){_0x2295c5['rows']=_0x468db1;return _0x2295c5;})[_0xce49('0x25')](respondWithFilteredResult(_0x4906ed,_0x20499d))[_0xce49('0x2f')](handleError(_0x4906ed,null));};exports[_0xce49('0xad')]=function(_0x493108,_0x16f8c7){var _0x451a53={'raw':![],'where':{'id':_0x493108[_0xce49('0xae')]['id']}},_0x253d06={};_0x253d06[_0xce49('0x33')]=_['keys'](db[_0xce49('0x96')][_0xce49('0x31')]);_0x253d06[_0xce49('0x34')]=_['keys'](_0x493108[_0xce49('0x34')]);_0x253d06[_0xce49('0x35')]=_['intersection'](_0x253d06[_0xce49('0x33')],_0x253d06[_0xce49('0x34')]);_0x451a53[_0xce49('0x37')]=_[_0xce49('0x36')](_0x253d06[_0xce49('0x33')],qs[_0xce49('0x38')](_0x493108[_0xce49('0x34')][_0xce49('0x38')]));_0x451a53['attributes']=_0x451a53[_0xce49('0x37')][_0xce49('0x39')]?_0x451a53['attributes']:_0x253d06[_0xce49('0x33')];if(_0x493108[_0xce49('0x34')]['includeAll']){_0x451a53[_0xce49('0xaf')]=[{'all':!![]}];}_0x451a53=_[_0xce49('0x95')]({},_0x451a53,_0x493108['options']);return db[_0xce49('0x96')][_0xce49('0x55')](_0x451a53)['then'](handleEntityNotFound(_0x16f8c7,null))[_0xce49('0x25')](respondWithResult(_0x16f8c7,null))['catch'](handleError(_0x16f8c7,null));};exports['create']=function(_0x262c81,_0xc4a443){return db[_0xce49('0x96')][_0xce49('0xb0')](_0x262c81[_0xce49('0x6a')],{})['then'](respondWithResult(_0xc4a443,0xc9))[_0xce49('0x2f')](handleError(_0xc4a443,null));};exports[_0xce49('0x24')]=function(_0x180964,_0x1d5782){if(_0x180964[_0xce49('0x6a')]['id']){delete _0x180964['body']['id'];}return db[_0xce49('0x96')]['find']({'where':{'id':_0x180964['params']['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x1d5782,null))[_0xce49('0x25')](saveUpdates(_0x180964[_0xce49('0x6a')],null))[_0xce49('0x25')](respondWithResult(_0x1d5782,null))[_0xce49('0x2f')](handleError(_0x1d5782,null));};exports[_0xce49('0xb1')]=function(_0x1051e,_0x2866cd){return db[_0xce49('0x96')][_0xce49('0x55')]({'where':{'id':_0x1051e['params']['id']}})['then'](handleEntityNotFound(_0x2866cd,null))[_0xce49('0x25')](removeEntity(_0x2866cd,null))['catch'](handleError(_0x2866cd,null));};exports[_0xce49('0xb2')]=function(_0x50ee4c,_0x62cde9){return db[_0xce49('0x96')][_0xce49('0xb2')]()['then'](respondWithResult(_0x62cde9,null))['catch'](handleError(_0x62cde9,null));};exports[_0xce49('0xb3')]=function(_0x4e2e4a,_0x42d95d,_0x4ef20a){return db[_0xce49('0xb4')][_0xce49('0x55')]({'where':{'id':_0x4e2e4a['params']['id']}})['then'](handleEntityNotFound(_0x42d95d,null))[_0xce49('0x25')](function(_0x5ca54b){if(_0x5ca54b){return _0x5ca54b[_0xce49('0xb3')](_0x4e2e4a['body']['ids'],_[_0xce49('0xb5')](_0x4e2e4a[_0xce49('0x6a')],[_0xce49('0xb6'),'id'])||{});}})[_0xce49('0x25')](respondWithResult(_0x42d95d,null))[_0xce49('0x2f')](handleError(_0x42d95d,null));};exports['getMessages']=function(_0x44118b,_0x9e0a15,_0x5f1fc2){var _0x7bbb7={'raw':![],'where':{}};var _0x428140={};var _0x5ce538={'count':0x0,'rows':[]};return db[_0xce49('0x96')][_0xce49('0xb7')]({'where':{'id':_0x44118b[_0xce49('0xae')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x9e0a15,null))[_0xce49('0x25')](function(_0x2da123){if(_0x2da123){_0x428140[_0xce49('0x33')]=_[_0xce49('0x6b')](db[_0xce49('0xb4')][_0xce49('0x31')]);_0x428140[_0xce49('0x34')]=_[_0xce49('0x6b')](_0x44118b[_0xce49('0x34')]);_0x428140[_0xce49('0x35')]=_['intersection'](_0x428140[_0xce49('0x33')],_0x428140[_0xce49('0x34')]);_0x7bbb7[_0xce49('0x37')]=_[_0xce49('0x36')](_0x428140[_0xce49('0x33')],qs['fields'](_0x44118b[_0xce49('0x34')][_0xce49('0x38')]));_0x7bbb7['attributes']=_0x7bbb7['attributes'][_0xce49('0x39')]?_0x7bbb7[_0xce49('0x37')]:_0x428140[_0xce49('0x33')];if(!_0x44118b[_0xce49('0x34')][_0xce49('0x3a')](_0xce49('0x3b'))){_0x7bbb7[_0xce49('0x1f')]=qs['limit'](_0x44118b[_0xce49('0x34')]['limit']);_0x7bbb7['offset']=qs[_0xce49('0x1e')](_0x44118b[_0xce49('0x34')][_0xce49('0x1e')]);}_0x7bbb7[_0xce49('0x3c')]=qs[_0xce49('0x3d')](_0x44118b[_0xce49('0x34')][_0xce49('0x3d')]);_0x7bbb7[_0xce49('0x3e')]=qs['filters'](_['pick'](_0x44118b[_0xce49('0x34')],_0x428140[_0xce49('0x35')]));_0x7bbb7[_0xce49('0x3e')][_0xce49('0xab')]=_0x2da123['id'];if(_0x44118b[_0xce49('0x34')][_0xce49('0x7a')]){_0x7bbb7[_0xce49('0x3e')]=_['merge'](_0x7bbb7[_0xce49('0x3e')],{'$or':_[_0xce49('0x8e')](_0x7bbb7[_0xce49('0x37')],function(_0x153c03){var _0x5eab29={};_0x5eab29[_0x153c03]={'$like':'%'+_0x44118b[_0xce49('0x34')]['filter']+'%'};return _0x5eab29;})});}if(_0x44118b['query'][_0xce49('0xb8')]){var _0x326ed6=_0x44118b[_0xce49('0x34')][_0xce49('0xb8')][_0xce49('0x5d')](',');var _0x3e0e7c={};_0x3e0e7c[_0x326ed6[0x0]]={'$gte':moment(_0x326ed6[0x1])[_0xce49('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7bbb7[_0xce49('0x3e')]=_[_0xce49('0x95')](_0x7bbb7[_0xce49('0x3e')],_0x3e0e7c);}_0x7bbb7=_[_0xce49('0x95')]({},_0x7bbb7,_0x44118b[_0xce49('0xba')]);return db['SmsMessage'][_0xce49('0x93')]({'where':_0x7bbb7[_0xce49('0x3e')]})[_0xce49('0x25')](function(_0x3478a1){_0x5ce538[_0xce49('0x93')]=_0x3478a1;if(_0x44118b[_0xce49('0x34')][_0xce49('0xbb')]){_0x7bbb7[_0xce49('0xaf')]=[{'all':!![]}];}return db[_0xce49('0xb4')][_0xce49('0xbc')](_0x7bbb7);})[_0xce49('0x25')](function(_0x532fd3){_0x5ce538[_0xce49('0xbd')]=_0x532fd3;return _0x5ce538;});}})[_0xce49('0x25')](respondWithFilteredResult(_0x9e0a15,_0x7bbb7))[_0xce49('0x2f')](handleError(_0x9e0a15,null));};exports[_0xce49('0xbe')]=function(_0x56c384,_0x223a54,_0x218dbd){return db[_0xce49('0x96')]['find']({'where':{'id':_0x56c384[_0xce49('0xae')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x223a54,null))[_0xce49('0x25')](function(_0x16533f){if(_0x16533f){return _0x16533f['setTags'](_0x56c384[_0xce49('0x6a')][_0xce49('0xb6')],_[_0xce49('0xb5')](_0x56c384[_0xce49('0x6a')],[_0xce49('0xb6'),'id'])||{})[_0xce49('0xbf')](function(){return db['Tag']['findAll']({'attributes':['id',_0xce49('0x28'),_0xce49('0x42')],'where':{'id':_0x56c384[_0xce49('0x6a')][_0xce49('0xb6')]}});})[_0xce49('0x25')](function(_0x4332b0){socket[_0xce49('0xc0')]('smsInteractionTags:save',{'id':Number(_0x56c384[_0xce49('0xae')]['id']),'tags':_0x4332b0||[]});return{'id':Number(_0x56c384[_0xce49('0xae')]['id']),'tags':_0x4332b0||[]};});}})[_0xce49('0x25')](respondWithResult(_0x223a54,null))[_0xce49('0x2f')](handleError(_0x223a54,null));};exports['removeTags']=function(_0x2c90fe,_0x53ef15,_0x10a518){return db[_0xce49('0x96')][_0xce49('0x55')]({'where':{'id':_0x2c90fe[_0xce49('0xae')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x53ef15,null))[_0xce49('0x25')](function(_0x278c8b){if(_0x278c8b){return _0x278c8b[_0xce49('0xc1')](_0x2c90fe['query'][_0xce49('0xb6')]);}})['then'](respondWithStatusCode(_0x53ef15,null))['catch'](handleError(_0x53ef15,null));};exports[_0xce49('0xc2')]=function(_0x2e7057,_0x104f78){var _0x8c7923=moment()['unix']()[_0xce49('0x92')]();var _0x29c1e5=path[_0xce49('0xc3')](config['root'],_0xce49('0xc4'),_0xce49('0xc5'),_0xce49('0xc6'));var _0x469f85=path[_0xce49('0xc3')](config['root'],_0xce49('0xc4'),_0xce49('0xc5'),_0xce49('0xc7'));var _0x2b68a4=path['join'](_0x29c1e5,_0x8c7923);var _0x42667b=util[_0xce49('0xb9')]('transcript-%d-%s.zip',_0x2e7057[_0xce49('0xae')]['id'],_0x8c7923);var _0x45bcb9=path[_0xce49('0xc3')](_0x29c1e5,_0x42667b);var _0x12fd44=[];_0x12fd44[_0xce49('0x2e')]({'model':db['User'],'as':_0xce49('0x67'),'attributes':['id',_0xce49('0x2a')],'raw':!![]});_0x12fd44[_0xce49('0x2e')]({'model':db[_0xce49('0xc8')],'as':_0xce49('0xc9'),'attributes':['id','firstName',_0xce49('0xca')],'raw':!![]});var _0x3bdbf4=[{'model':db[_0xce49('0xb4')],'as':_0xce49('0xcb'),'attributes':['id',_0xce49('0x6a'),_0xce49('0x6e'),_0xce49('0xcc'),_0xce49('0xcd'),_0xce49('0x75')],'include':_0x12fd44}];_0x3bdbf4[_0xce49('0x2e')]({'model':db[_0xce49('0xce')],'as':_0xce49('0xcf'),'attributes':['id',_0xce49('0x28')]});_0x3bdbf4[_0xce49('0x2e')]({'model':db[_0xce49('0x67')],'as':'Owner','attributes':['id','fullname']});return db[_0xce49('0x96')][_0xce49('0x55')]({'where':{'id':_0x2e7057[_0xce49('0xae')]['id']},'include':_0x3bdbf4})[_0xce49('0x25')](handleEntityNotFound(_0x104f78,null))[_0xce49('0x25')](function(_0x46d96c){if(_0x46d96c){var _0x513334=_0x46d96c[_0xce49('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x2b68a4);var _0x55dbb2={'format':'A4','border':_0xce49('0xd1'),'header':{'height':'40px','contents':{'first':_0xce49('0xd2')}},'footer':{'height':_0xce49('0xd3'),'contents':{'default':util[_0xce49('0xb9')](_0xce49('0xd4'),util[_0xce49('0xb9')](_0xce49('0xd5'),_0xce49('0xd6'),_0x513334['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x31c6e4={'channel':_0xce49('0xd6'),'account':_0x513334[_0xce49('0xcf')][_0xce49('0x28')],'agent':_0x513334[_0xce49('0xd7')]?_0x513334[_0xce49('0xd7')]['fullname']:_0xce49('0xd8'),'createdAt':moment(_0x513334[_0xce49('0x6e')])[_0xce49('0xb9')](_0xce49('0xd9'))[_0xce49('0x92')](),'closedAt':_0x513334['closed']?moment(_0x513334[_0xce49('0xda')])[_0xce49('0xb9')](_0xce49('0xd9'))[_0xce49('0x92')]():'','disposition':_0x513334[_0xce49('0xdb')],'messages':_(_0x513334[_0xce49('0xcb')])[_0xce49('0x7a')]({'secret':![]})[_0xce49('0x8e')](function(_0x57e360){return{'date':moment(_0x57e360['createdAt'])['format'](_0xce49('0xd9'))[_0xce49('0x92')](),'sender':_0x57e360[_0xce49('0xcc')]==='out'?_0x57e360[_0xce49('0x67')]?_0x57e360[_0xce49('0x67')][_0xce49('0x2a')]:_0xce49('0xdc'):_0x57e360[_0xce49('0xc9')][_0xce49('0xdd')]+(_0x57e360[_0xce49('0xc9')][_0xce49('0xca')]?'\x20'+_0x57e360[_0xce49('0xc9')][_0xce49('0xca')]:''),'body':_0x57e360[_0xce49('0x6a')],'direction':_0x57e360[_0xce49('0xcc')]===_0xce49('0xde')?'A':'C','secret':_0x57e360[_0xce49('0xcd')],'read':_0x57e360['read']};})[_0xce49('0x57')]()};return ejs[_0xce49('0xdf')](path[_0xce49('0xc3')](config['root'],'server',_0xce49('0xe0'),_0xce49('0xe1')),{'interaction':_0x31c6e4})[_0xce49('0x25')](function(_0x183be5){return new BPromise(function(_0x42a8e7,_0x6a5057){pdf['create'](_0x183be5,_0x55dbb2)[_0xce49('0xe2')](path[_0xce49('0xc3')](_0x2b68a4,_0xce49('0xe3')+_0x513334['id']+'-'+_0x8c7923+_0xce49('0xe4')),function(_0x764701,_0x1a94e4){if(_0x764701)return _0x6a5057(_0x764701);_0x42a8e7(_0x1a94e4);});});})[_0xce49('0x25')](function(){return new BPromise(function(_0x12e5f0,_0x50515f){zipdir(_0x2b68a4,{'saveTo':_0x45bcb9},function(_0x38b5c2,_0x26362a){if(_0x38b5c2)return _0x50515f(_0x38b5c2);return _0x12e5f0(_0x26362a);});})[_0xce49('0x25')](function(){return new BPromise(function(_0x2459e7,_0x5aac76){rimraf(_0x2b68a4,function(_0x539b7a){if(_0x539b7a)_0x5aac76(_0x539b7a);return _0x2459e7();});});})[_0xce49('0x25')](function(){return _0x104f78['download'](_0x45bcb9,_0x42667b,function(_0x15ea60){if(_0x15ea60){console['log']('err',_0x15ea60);}else{fs[_0xce49('0xe5')](_0x45bcb9);}});});});}else{return _0x104f78[_0xce49('0x1a')](0xc8);}})[_0xce49('0x2f')](handleError(_0x104f78,null));}; \ No newline at end of file +var _0xaf86=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','User','operator','UserId','start','body','compact','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','role','sequelize','toString','keyBy','merge','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','limit','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','keys','rawAttributes','includeAll','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','sort','findAll','spread','removeTags','download','unix','root','server','files','tmp','join','format','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','SmsAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Account','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','direction','out','System','firstName','renderFile','views','toFile','transcript-','.pdf','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash'];(function(_0x2335e5,_0x2703a7){var _0x3e5b5d=function(_0x51cc8b){while(--_0x51cc8b){_0x2335e5['push'](_0x2335e5['shift']());}};_0x3e5b5d(++_0x2703a7);}(_0xaf86,0x1ca));var _0x6af8=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xaf86[_0x2fbcf6];return _0x3e7265;};'use strict';var pdf=require(_0x6af8('0x0'));var emlformat=require(_0x6af8('0x1'));var rimraf=require(_0x6af8('0x2'));var zipdir=require(_0x6af8('0x3'));var jsonpatch=require(_0x6af8('0x4'));var rp=require('request-promise');var moment=require(_0x6af8('0x5'));var BPromise=require(_0x6af8('0x6'));var Mustache=require('mustache');var util=require(_0x6af8('0x7'));var path=require(_0x6af8('0x8'));var sox=require(_0x6af8('0x9'));var csv=require(_0x6af8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6af8('0xb'));var squel=require('squel');var crypto=require(_0x6af8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6af8('0xd'));var toCsv=require(_0x6af8('0xa'));var querystring=require(_0x6af8('0xe'));var Papa=require('papaparse');var Redis=require(_0x6af8('0xf'));var authService=require(_0x6af8('0x10'));var qs=require(_0x6af8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6af8('0x12'));var logger=require('../../config/logger')(_0x6af8('0x13'));var utils=require(_0x6af8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6af8('0x15'));var db=require(_0x6af8('0x16'))['db'];config[_0x6af8('0x17')]=_[_0x6af8('0x18')](config['redis'],{'host':_0x6af8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6af8('0x17')]));require(_0x6af8('0x1a'))[_0x6af8('0x1b')](socket);function respondWithStatusCode(_0x3ac9d1,_0x489665){_0x489665=_0x489665||0xcc;return function(_0x4f4923){if(_0x4f4923){return _0x3ac9d1['sendStatus'](_0x489665);}return _0x3ac9d1[_0x6af8('0x1c')](_0x489665)[_0x6af8('0x1d')]();};}function respondWithResult(_0x6058e7,_0x3bd814){_0x3bd814=_0x3bd814||0xc8;return function(_0x4faa43){if(_0x4faa43){return _0x6058e7[_0x6af8('0x1c')](_0x3bd814)[_0x6af8('0x1e')](_0x4faa43);}};}function respondWithFilteredResult(_0xa393f8,_0x3cd5c3){return function(_0x13f238){if(_0x13f238){var _0x2325f4=_0x13f238[_0x6af8('0x1f')],_0x11c422=_0x3cd5c3['offset'],_0x15025f=_0x3cd5c3[_0x6af8('0x20')]+_0x3cd5c3['limit'],_0x22ecd2;if(_0x15025f>=_0x2325f4){_0x15025f=_0x2325f4;_0x22ecd2=0xc8;}else{_0x22ecd2=0xce;}_0xa393f8[_0x6af8('0x1c')](_0x22ecd2);return _0xa393f8[_0x6af8('0x21')](_0x6af8('0x22'),_0x11c422+'-'+_0x15025f+'/'+_0x2325f4)[_0x6af8('0x1e')](_0x13f238);}return null;};}function patchUpdates(_0x16f83f){return function(_0x365eea){try{jsonpatch[_0x6af8('0x23')](_0x365eea,_0x16f83f,!![]);}catch(_0x3041fc){return BPromise[_0x6af8('0x24')](_0x3041fc);}return _0x365eea[_0x6af8('0x25')]();};}function saveUpdates(_0xfddd79,_0x4c1268){return function(_0x428b7f){if(_0x428b7f){return _0x428b7f[_0x6af8('0x26')](_0xfddd79)[_0x6af8('0x27')](function(_0x55b3f5){return _0x55b3f5;});}return null;};}function removeEntity(_0xda2264,_0x13c429){return function(_0x34c08b){if(_0x34c08b){return _0x34c08b[_0x6af8('0x28')]()['then'](function(){_0xda2264[_0x6af8('0x1c')](0xcc)[_0x6af8('0x1d')]();});}};}function handleEntityNotFound(_0x3c402f,_0x1e80e1){return function(_0x1bd3fc){if(!_0x1bd3fc){_0x3c402f['sendStatus'](0x194);}return _0x1bd3fc;};}function handleError(_0x363d6b,_0x38cd48){_0x38cd48=_0x38cd48||0x1f4;return function(_0x43e968){logger[_0x6af8('0x29')](_0x43e968[_0x6af8('0x2a')]);if(_0x43e968[_0x6af8('0x2b')]){delete _0x43e968[_0x6af8('0x2b')];}_0x363d6b[_0x6af8('0x1c')](_0x38cd48)[_0x6af8('0x2c')](_0x43e968);};}function getInteractionUsers(_0x117159,_0x1e7499){return new BPromise(function(_0x37df62,_0x15dc30){try{if(_0x1e7499[_0x117159['id']]){_0x117159[_0x6af8('0x2d')]=_[_0x6af8('0x2e')](_0x1e7499[_0x117159['id']],function(_0x2ee48b){return{'id':_0x2ee48b['id'],'fullname':_0x2ee48b[_0x6af8('0x2f')]};});}}catch(_0x2a810b){_0x15dc30(_0x2a810b);}_0x37df62(_0x117159);});}function getInteractionTags(_0x4b285d,_0x1b8813){return new BPromise(function(_0x26175b,_0x2926f0){try{if(_0x4b285d[_0x6af8('0x30')]){_0x4b285d[_0x6af8('0x31')]=[];_0x4b285d[_0x6af8('0x30')][_0x6af8('0x32')](',')[_0x6af8('0x33')](function(_0x122058){_0x4b285d[_0x6af8('0x31')][_0x6af8('0x34')](_0x1b8813[_0x122058]);});}delete _0x4b285d[_0x6af8('0x30')];}catch(_0x32dcfb){_0x2926f0(_0x32dcfb);}_0x26175b(_0x4b285d);});}function updateSmsInteraction(_0x4ec196,_0x49a08b,_0x21d904){return new BPromise(function(_0x3bc3f9,_0x695642){return getInteractionUsers(_0x4ec196,_0x21d904)['then'](function(_0x4528ec){return getInteractionTags(_0x4528ec,_0x49a08b);})['then'](function(_0x374b86){_0x3bc3f9(_0x374b86);})[_0x6af8('0x35')](function(_0x1725c1){_0x695642(_0x1725c1);});});}exports[_0x6af8('0x36')]=function(_0x5b3cfa,_0x194a3e){var _0x5e5e74={},_0x47a104={},_0xce3f0a={'count':0x0,'rows':[]};var _0x3d9c19=_[_0x6af8('0x2e')](db[_0x6af8('0x37')]['rawAttributes'],function(_0x853f77){return{'name':_0x853f77[_0x6af8('0x38')],'type':_0x853f77[_0x6af8('0x39')][_0x6af8('0x3a')]};});_0x47a104['model']=_[_0x6af8('0x2e')](_0x3d9c19,_0x6af8('0x2b'));_0x47a104[_0x6af8('0x3b')]=_['keys'](_0x5b3cfa[_0x6af8('0x3b')]);_0x47a104[_0x6af8('0x3c')]=_[_0x6af8('0x3d')](_0x47a104['model'],_0x47a104[_0x6af8('0x3b')]);_0x5e5e74[_0x6af8('0x3e')]=_[_0x6af8('0x3d')](_0x47a104[_0x6af8('0x3f')],qs[_0x6af8('0x40')](_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x40')]));_0x5e5e74[_0x6af8('0x3e')]=_0x5e5e74[_0x6af8('0x3e')][_0x6af8('0x41')]?_0x5e5e74['attributes']:_0x47a104[_0x6af8('0x3f')];if(!_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x42')](_0x6af8('0x43'))){_0x5e5e74['limit']=qs['limit'](_0x5b3cfa[_0x6af8('0x3b')]['limit']);_0x5e5e74[_0x6af8('0x20')]=qs['offset'](_0x5b3cfa['query'][_0x6af8('0x20')]);}_0x5e5e74[_0x6af8('0x44')]=qs['sort'](_0x5b3cfa[_0x6af8('0x3b')]['sort']);_0x5e5e74[_0x6af8('0x45')]=qs[_0x6af8('0x3c')](_[_0x6af8('0x46')](_0x5b3cfa[_0x6af8('0x3b')],_0x47a104[_0x6af8('0x3c')]),_0x3d9c19);var _0x364d6d=[];var _0x21a8b6=squel[_0x6af8('0x47')]()['field']('id')['field'](_0x6af8('0x2b'))[_0x6af8('0x48')](_0x6af8('0x49'))['from'](_0x6af8('0x4a'));var _0x21574c=squel['select']()[_0x6af8('0x48')](_0x6af8('0x4b'))[_0x6af8('0x48')](_0x6af8('0x4c'))[_0x6af8('0x48')]('ui.SmsInteractionId')[_0x6af8('0x4d')](_0x6af8('0x4e'),'ui')[_0x6af8('0x4f')](_0x6af8('0x50'),'u',_0x6af8('0x51'));var _0x3fdbcc=squel[_0x6af8('0x47')]()[_0x6af8('0x4d')](_0x6af8('0x52'),'i')[_0x6af8('0x4f')](_0x6af8('0x53'),'c',_0x6af8('0x54'))['left_join'](_0x6af8('0x50'),'o',_0x6af8('0x55'))[_0x6af8('0x4f')](_0x6af8('0x56'),'a',_0x6af8('0x57'))[_0x6af8('0x4f')](_0x6af8('0x58'),'me',_0x6af8('0x59'))[_0x6af8('0x4f')]('sms_interaction_has_tags','it',_0x6af8('0x5a'))[_0x6af8('0x4f')](_0x6af8('0x4a'),'t',_0x6af8('0x5b'));var _0x2b0021=squel[_0x6af8('0x5c')]();var _0x3d7185=[];var _0x329f57=squel['expr']();var _0x4cacc7;if(_0x5b3cfa['query'][_0x6af8('0x5d')]){_0x4cacc7=as[_0x6af8('0x5e')](_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x5d')]);var _0x1db15c=_0x4cacc7[_0x6af8('0x5f')];for(var _0x58b5f0=0x0;_0x58b5f0<_0x4cacc7[_0x6af8('0x60')][_0x6af8('0x41')];_0x58b5f0++){var _0x24bc76=_0x4cacc7[_0x6af8('0x60')][_0x58b5f0];var _0x4794fa='i';var _0x4f4559=_[_0x6af8('0x61')](_0x3d9c19,[_0x6af8('0x2b'),_0x24bc76[_0x6af8('0x48')]]);if(!_0x4f4559){switch(_0x24bc76[_0x6af8('0x48')]){case _0x6af8('0x62'):if(_0x24bc76[_0x6af8('0x63')]==0x1){_0x3fdbcc[_0x6af8('0x64')]('`'+_0x24bc76[_0x6af8('0x48')]+'`\x20=\x200');}else{_0x3fdbcc[_0x6af8('0x64')]('`'+_0x24bc76[_0x6af8('0x48')]+_0x6af8('0x65'));}break;case _0x6af8('0x66'):if(_0x24bc76['operator']===_0x6af8('0x67')){if(_0x24bc76[_0x6af8('0x63')][_0x6af8('0x32')]('\x20')['length']>0x1){_0x2b0021[_0x1db15c](_0x6af8('0x68'),qs[_0x6af8('0x69')](_0x24bc76[_0x6af8('0x63')]),null);}else{var _0xdb2001='%'+_0x24bc76['value']+'%';_0x2b0021[_0x1db15c](_0x6af8('0x6a'),_0xdb2001,_0xdb2001,_0xdb2001);}}else{_0x4f4559=_[_0x6af8('0x61')](_0x3d9c19,[_0x6af8('0x2b'),_0x6af8('0x6b')]);_0x24bc76[_0x6af8('0x48')]=_0x6af8('0x6b');_0x1e9486=as[_0x6af8('0x6c')](_0x4794fa,_0x4f4559[_0x6af8('0x39')],_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')]['start'],_0x1e9486['value'][_0x6af8('0x1d')]);}break;case _0x6af8('0x6e'):var _0x539fa2=_0x24bc76[_0x6af8('0x63')][_0x6af8('0x32')](',')[_0x6af8('0x2e')](function(_0x5a2280){return Number(_0x5a2280);});_0x539fa2['forEach'](function(_0x65a69a){_0x329f57['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x65a69a+',%');});_0x3d7185=_[_0x6af8('0x6f')](_0x3d7185,_0x539fa2);break;case _0x6af8('0x70'):if(_0x24bc76[_0x6af8('0x71')]===_0x6af8('0x67')){_0x2b0021[_0x1db15c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x24bc76['value']+'%',null);}else{_0x4f4559=_['find'](_0x3d9c19,['name',_0x6af8('0x72')]);_0x24bc76[_0x6af8('0x48')]=_0x6af8('0x72');_0x1e9486=as[_0x6af8('0x6c')](_0x4794fa,_0x4f4559[_0x6af8('0x39')],_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x73')],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x1d')]);}break;case _0x6af8('0x74'):_0x1e9486=as[_0x6af8('0x6c')]('me',null,_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x73')],_0x1e9486['value']['end']);break;}}else{var _0x1e9486=as[_0x6af8('0x6c')](_0x4794fa,_0x4f4559[_0x6af8('0x39')],_0x24bc76);_0x2b0021[_0x1db15c](_0x1e9486[_0x6af8('0x6d')],_0x1e9486[_0x6af8('0x63')]['start'],_0x1e9486[_0x6af8('0x63')][_0x6af8('0x1d')]);}}}else{var _0x5619d1=_(_0x5b3cfa[_0x6af8('0x3b')])['keys']()[_0x6af8('0x2e')](function(_0x41e5a2){return _['some'](_0x3d9c19,[_0x6af8('0x2b'),_0x41e5a2])?_0x41e5a2:undefined;})[_0x6af8('0x75')]()[_0x6af8('0x63')]();if(!_['isEmpty'](_0x5619d1)){_0x5619d1[_0x6af8('0x33')](function(_0x31fbfa){if(_0x31fbfa==='SmsAccountId'){_0x3fdbcc[_0x6af8('0x45')](_0x6af8('0x76'),[][_0x6af8('0x77')](_0x5b3cfa['query'][_0x31fbfa]));}else if(_0x31fbfa===_0x6af8('0x78')){var _0x5333d8=JSON[_0x6af8('0x79')](_0x5b3cfa[_0x6af8('0x3b')][_0x31fbfa])[_0x6af8('0x7a')];var _0x3b1a34=JSON[_0x6af8('0x79')](_0x5b3cfa['query'][_0x31fbfa])[_0x6af8('0x7b')];_0x3fdbcc[_0x6af8('0x45')](_0x6af8('0x7c'),_0x5333d8,_0x3b1a34);}else{if(_0x5b3cfa[_0x6af8('0x3b')][_0x31fbfa]===_0x6af8('0x7d')){_0x3fdbcc[_0x6af8('0x45')]('i.'+_0x31fbfa+_0x6af8('0x7e'));}else{_0x3fdbcc[_0x6af8('0x45')]('i.'+_0x31fbfa+_0x6af8('0x7f'),_0x5b3cfa[_0x6af8('0x3b')][_0x31fbfa]);}}});}if(_0x5b3cfa['query'][_0x6af8('0x80')]){if(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x80')]==0x1){_0x3fdbcc['having']('`unreadMessages`\x20=\x200');}else{_0x3fdbcc[_0x6af8('0x64')](_0x6af8('0x81'));}}if(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x82')]){_0x3d7185=_['isArray'](_0x5b3cfa[_0x6af8('0x3b')]['tag'])?_0x5b3cfa[_0x6af8('0x3b')]['tag']:new Array(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x82')]);_0x3d7185[_0x6af8('0x33')](function(_0x8c9573){_0x329f57['or'](_0x6af8('0x83'),'%,'+_0x8c9573+',%');});}if(_0x5b3cfa[_0x6af8('0x3b')]['filter']){var _0x44632b=_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6af8('0x85')](_0x44632b)){_0x2b0021['or'](_0x6af8('0x86'),_0x44632b+'%')['or'](_0x6af8('0x87'),_0x44632b+'%');}else{_0x2b0021['or'](_0x6af8('0x88'),qs['getFullTextValue'](_0x44632b))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44632b+'%');}}}_0x3fdbcc[_0x6af8('0x45')](_0x2b0021);_0x3fdbcc['group'](_0x6af8('0x89'));var _0x159a4c={'type':db[_0x6af8('0x8a')][_0x6af8('0x8b')][_0x6af8('0x8c')],'raw':!![]};var _0x4e2727=_0x3fdbcc['clone']();_0x4e2727['field'](_0x6af8('0x89'));_0x4e2727[_0x6af8('0x48')](_0x6af8('0x8d'),_0x6af8('0x62'));if(_0x5e5e74['order']){_0x5e5e74[_0x6af8('0x44')][_0x6af8('0x33')](function(_0x34d0e0){var _0x490665=_0x34d0e0[0x0]===_0x6af8('0x8e')?_0x34d0e0[0x0]:'i.'+_0x34d0e0[0x0];_0x3fdbcc[_0x6af8('0x44')](_0x490665,_0x34d0e0[0x1]===_0x6af8('0x8f')?![]:!![]);});}if(!_[_0x6af8('0x90')](_0x3d7185)){_0x3fdbcc['having'](_0x329f57);_0x4e2727[_0x6af8('0x45')](_0x6af8('0x91'),_0x3d7185);}BPromise[_0x6af8('0x92')]()[_0x6af8('0x27')](function(){if(!_0x4cacc7){if(_0x5b3cfa[_0x6af8('0x3b')][_0x6af8('0x93')]||_0x5b3cfa[_0x6af8('0x3b')]['journey'])return;_0x4e2727[_0x6af8('0x45')](_0x6af8('0x94'));_0x3fdbcc[_0x6af8('0x45')](_0x6af8('0x94'));return;}if(_0x5b3cfa[_0x6af8('0x95')]['role']!==_0x6af8('0x96'))return;return _0x5b3cfa[_0x6af8('0x95')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x3f0358){if(_[_0x6af8('0x90')](_0x3f0358)){_0x4e2727[_0x6af8('0x45')]('i.SmsAccountId\x20IS\x20NULL');_0x3fdbcc[_0x6af8('0x45')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x4e2727[_0x6af8('0x45')](_0x6af8('0x76'),_['map'](_0x3f0358,'id'));_0x3fdbcc[_0x6af8('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x6af8('0x2e')](_0x3f0358,'id'));}});})[_0x6af8('0x27')](function(){if(_0x5b3cfa[_0x6af8('0x95')][_0x6af8('0x97')]===_0x6af8('0x96')&&!_0x4cacc7&&!_0x5b3cfa['query'][_0x6af8('0x93')])return[];return db[_0x6af8('0x98')][_0x6af8('0x3b')](_0x4e2727[_0x6af8('0x99')](),_0x159a4c);})[_0x6af8('0x27')](function(_0x5688c2){_0xce3f0a[_0x6af8('0x1f')]=_0x5688c2[_0x6af8('0x41')];if(_0xce3f0a['count']===0x0)return[];return db[_0x6af8('0x98')][_0x6af8('0x3b')](_0x21a8b6[_0x6af8('0x99')](),_0x159a4c)['then'](function(_0x119346){_0x364d6d=_[_0x6af8('0x9a')](_0x119346,'id');_0x159a4c=_[_0x6af8('0x9b')](_0x159a4c,{'model':db[_0x6af8('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b3cfa[_0x6af8('0x3b')]['fields']){_0x5e5e74[_0x6af8('0x3e')][_0x6af8('0x33')](function(_0x118d46){_0x3fdbcc[_0x6af8('0x48')]('i.'+_0x118d46);});}else{_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0x8d'),_0x6af8('0x62'));_0x3fdbcc['field'](_0x6af8('0x9c'),_0x6af8('0x9d'));_0x3fdbcc[_0x6af8('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0x9e'),_0x6af8('0x8e'));_0x3fdbcc['field'](_0x6af8('0x9f'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa0'),_0x6af8('0xa1'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa2'),_0x6af8('0xa3'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa4'),_0x6af8('0xa5'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa6'),_0x6af8('0xa7'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xa8'),_0x6af8('0xa9'));_0x3fdbcc[_0x6af8('0x48')](_0x6af8('0xaa'),_0x6af8('0xab'));_0x3fdbcc[_0x6af8('0x48')]('o.fullname','Owner.fullname');_0x3fdbcc[_0x6af8('0x48')]('o.internal','Owner.internal');_0x3fdbcc[_0x6af8('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6af8('0x30'));}if(_0x5e5e74[_0x6af8('0xac')])_0x3fdbcc[_0x6af8('0xac')](_0x5e5e74[_0x6af8('0xac')]);if(_0x5e5e74[_0x6af8('0x20')])_0x3fdbcc[_0x6af8('0x20')](_0x5e5e74[_0x6af8('0x20')]);return db['sequelize'][_0x6af8('0x3b')](_0x3fdbcc[_0x6af8('0x99')](),_0x159a4c);})[_0x6af8('0x27')](function(_0x493666){_0x21574c[_0x6af8('0x45')](_0x6af8('0xad'),_[_0x6af8('0x2e')](_0x493666,'id'));return db[_0x6af8('0x98')]['query'](_0x21574c[_0x6af8('0x99')](),_0x159a4c)[_0x6af8('0x27')](function(_0x41d783){var _0xf2508=_[_0x6af8('0xae')](_0x41d783,_0x6af8('0xaf'));var _0x4972c7=[];_0x493666[_0x6af8('0x33')](function(_0x145bb2){_0x4972c7['push'](updateSmsInteraction(_0x145bb2,_0x364d6d,_0xf2508));});return BPromise[_0x6af8('0xb0')](_0x4972c7);});});})['then'](function(_0x21c9f5){_0xce3f0a[_0x6af8('0xb1')]=_0x21c9f5;return _0xce3f0a;})[_0x6af8('0x27')](respondWithFilteredResult(_0x194a3e,_0x5e5e74))['catch'](handleError(_0x194a3e,null));};exports['show']=function(_0x326bb2,_0x306002){var _0xb1cee8={'raw':![],'where':{'id':_0x326bb2[_0x6af8('0xb2')]['id']}},_0x1ee36e={};_0x1ee36e[_0x6af8('0x3f')]=_[_0x6af8('0xb3')](db[_0x6af8('0x37')][_0x6af8('0xb4')]);_0x1ee36e[_0x6af8('0x3b')]=_[_0x6af8('0xb3')](_0x326bb2[_0x6af8('0x3b')]);_0x1ee36e[_0x6af8('0x3c')]=_[_0x6af8('0x3d')](_0x1ee36e[_0x6af8('0x3f')],_0x1ee36e['query']);_0xb1cee8[_0x6af8('0x3e')]=_[_0x6af8('0x3d')](_0x1ee36e[_0x6af8('0x3f')],qs[_0x6af8('0x40')](_0x326bb2[_0x6af8('0x3b')][_0x6af8('0x40')]));_0xb1cee8[_0x6af8('0x3e')]=_0xb1cee8[_0x6af8('0x3e')]['length']?_0xb1cee8['attributes']:_0x1ee36e[_0x6af8('0x3f')];if(_0x326bb2[_0x6af8('0x3b')][_0x6af8('0xb5')]){_0xb1cee8['include']=[{'all':!![]}];}_0xb1cee8=_[_0x6af8('0x9b')]({},_0xb1cee8,_0x326bb2[_0x6af8('0xb6')]);return db['SmsInteraction'][_0x6af8('0x61')](_0xb1cee8)['then'](handleEntityNotFound(_0x306002,null))[_0x6af8('0x27')](respondWithResult(_0x306002,null))[_0x6af8('0x35')](handleError(_0x306002,null));};exports[_0x6af8('0xb7')]=function(_0x25576f,_0x5ef053){return db[_0x6af8('0x37')][_0x6af8('0xb7')](_0x25576f['body'],{})[_0x6af8('0x27')](respondWithResult(_0x5ef053,0xc9))['catch'](handleError(_0x5ef053,null));};exports[_0x6af8('0x26')]=function(_0x13146f,_0x22e5e0){if(_0x13146f[_0x6af8('0x74')]['id']){delete _0x13146f['body']['id'];}return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x13146f[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x22e5e0,null))[_0x6af8('0x27')](saveUpdates(_0x13146f['body'],null))[_0x6af8('0x27')](respondWithResult(_0x22e5e0,null))[_0x6af8('0x35')](handleError(_0x22e5e0,null));};exports[_0x6af8('0x28')]=function(_0x416ce5,_0x1564c8){return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x416ce5[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x1564c8,null))[_0x6af8('0x27')](removeEntity(_0x1564c8,null))[_0x6af8('0x35')](handleError(_0x1564c8,null));};exports[_0x6af8('0xb8')]=function(_0x663f93,_0x20023f){return db[_0x6af8('0x37')]['describe']()[_0x6af8('0x27')](respondWithResult(_0x20023f,null))[_0x6af8('0x35')](handleError(_0x20023f,null));};exports[_0x6af8('0xb9')]=function(_0x192e9e,_0x723943,_0x2868b4){return db[_0x6af8('0xba')][_0x6af8('0x61')]({'where':{'id':_0x192e9e['params']['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x723943,null))['then'](function(_0x11a881){if(_0x11a881){return _0x11a881[_0x6af8('0xb9')](_0x192e9e[_0x6af8('0x74')][_0x6af8('0xbb')],_[_0x6af8('0xbc')](_0x192e9e['body'],[_0x6af8('0xbb'),'id'])||{});}})[_0x6af8('0x27')](respondWithResult(_0x723943,null))[_0x6af8('0x35')](handleError(_0x723943,null));};exports[_0x6af8('0xbd')]=function(_0x10d4e2,_0x22576a,_0x3678aa){var _0x107c05={'raw':![],'where':{}};var _0x4827ea={};var _0x1de744={'count':0x0,'rows':[]};return db[_0x6af8('0x37')][_0x6af8('0xbe')]({'where':{'id':_0x10d4e2[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x22576a,null))[_0x6af8('0x27')](function(_0x18c513){if(_0x18c513){_0x4827ea[_0x6af8('0x3f')]=_[_0x6af8('0xb3')](db[_0x6af8('0xba')]['rawAttributes']);_0x4827ea[_0x6af8('0x3b')]=_['keys'](_0x10d4e2[_0x6af8('0x3b')]);_0x4827ea[_0x6af8('0x3c')]=_[_0x6af8('0x3d')](_0x4827ea[_0x6af8('0x3f')],_0x4827ea[_0x6af8('0x3b')]);_0x107c05['attributes']=_[_0x6af8('0x3d')](_0x4827ea['model'],qs[_0x6af8('0x40')](_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x40')]));_0x107c05[_0x6af8('0x3e')]=_0x107c05[_0x6af8('0x3e')][_0x6af8('0x41')]?_0x107c05['attributes']:_0x4827ea[_0x6af8('0x3f')];if(!_0x10d4e2['query'][_0x6af8('0x42')]('nolimit')){_0x107c05[_0x6af8('0xac')]=qs['limit'](_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0xac')]);_0x107c05[_0x6af8('0x20')]=qs['offset'](_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x20')]);}_0x107c05['order']=qs[_0x6af8('0xbf')](_0x10d4e2[_0x6af8('0x3b')]['sort']);_0x107c05['where']=qs[_0x6af8('0x3c')](_[_0x6af8('0x46')](_0x10d4e2[_0x6af8('0x3b')],_0x4827ea[_0x6af8('0x3c')]));_0x107c05[_0x6af8('0x45')]['SmsInteractionId']=_0x18c513['id'];if(_0x10d4e2['query']['filter']){_0x107c05[_0x6af8('0x45')]=_[_0x6af8('0x9b')](_0x107c05[_0x6af8('0x45')],{'$or':_[_0x6af8('0x2e')](_0x107c05['attributes'],function(_0x35c26a){var _0x553e55={};_0x553e55[_0x35c26a]={'$like':'%'+_0x10d4e2['query'][_0x6af8('0x84')]+'%'};return _0x553e55;})});}if(_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x7a')]){var _0x12064e=_0x10d4e2[_0x6af8('0x3b')][_0x6af8('0x7a')][_0x6af8('0x32')](',');var _0xb770d9={};_0xb770d9[_0x12064e[0x0]]={'$gte':moment(_0x12064e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x107c05[_0x6af8('0x45')]=_[_0x6af8('0x9b')](_0x107c05[_0x6af8('0x45')],_0xb770d9);}_0x107c05=_[_0x6af8('0x9b')]({},_0x107c05,_0x10d4e2[_0x6af8('0xb6')]);return db[_0x6af8('0xba')][_0x6af8('0x1f')]({'where':_0x107c05[_0x6af8('0x45')]})[_0x6af8('0x27')](function(_0x4ec737){_0x1de744['count']=_0x4ec737;if(_0x10d4e2['query'][_0x6af8('0xb5')]){_0x107c05['include']=[{'all':!![]}];}return db[_0x6af8('0xba')][_0x6af8('0xc0')](_0x107c05);})[_0x6af8('0x27')](function(_0x36b70c){_0x1de744['rows']=_0x36b70c;return _0x1de744;});}})[_0x6af8('0x27')](respondWithFilteredResult(_0x22576a,_0x107c05))[_0x6af8('0x35')](handleError(_0x22576a,null));};exports['addTags']=function(_0x45e358,_0x243b51,_0x17ef3a){return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x45e358[_0x6af8('0xb2')]['id']}})[_0x6af8('0x27')](handleEntityNotFound(_0x243b51,null))[_0x6af8('0x27')](function(_0x1684a0){if(_0x1684a0){return _0x1684a0['setTags'](_0x45e358['body'][_0x6af8('0xbb')],_[_0x6af8('0xbc')](_0x45e358[_0x6af8('0x74')],[_0x6af8('0xbb'),'id'])||{})[_0x6af8('0xc1')](function(){return db[_0x6af8('0x6e')][_0x6af8('0xc0')]({'attributes':['id',_0x6af8('0x2b'),_0x6af8('0x49')],'where':{'id':_0x45e358[_0x6af8('0x74')][_0x6af8('0xbb')]}});})[_0x6af8('0x27')](function(_0x1c3959){socket['emit']('smsInteractionTags:save',{'id':Number(_0x45e358[_0x6af8('0xb2')]['id']),'tags':_0x1c3959||[]});return{'id':Number(_0x45e358[_0x6af8('0xb2')]['id']),'tags':_0x1c3959||[]};});}})['then'](respondWithResult(_0x243b51,null))[_0x6af8('0x35')](handleError(_0x243b51,null));};exports[_0x6af8('0xc2')]=function(_0x1c6711,_0x4f51c0,_0x4df977){return db[_0x6af8('0x37')][_0x6af8('0x61')]({'where':{'id':_0x1c6711['params']['id']}})['then'](handleEntityNotFound(_0x4f51c0,null))[_0x6af8('0x27')](function(_0x5ce2a5){if(_0x5ce2a5){return _0x5ce2a5['removeTags'](_0x1c6711[_0x6af8('0x3b')][_0x6af8('0xbb')]);}})['then'](respondWithStatusCode(_0x4f51c0,null))[_0x6af8('0x35')](handleError(_0x4f51c0,null));};exports[_0x6af8('0xc3')]=function(_0x2b007f,_0x12af44){var _0x4a6f36=moment()[_0x6af8('0xc4')]()[_0x6af8('0x99')]();var _0x3ffd39=path['join'](config[_0x6af8('0xc5')],_0x6af8('0xc6'),_0x6af8('0xc7'),_0x6af8('0xc8'));var _0x4d2388=path[_0x6af8('0xc9')](config[_0x6af8('0xc5')],_0x6af8('0xc6'),_0x6af8('0xc7'),'attachments');var _0x106541=path[_0x6af8('0xc9')](_0x3ffd39,_0x4a6f36);var _0x41ac3a=util[_0x6af8('0xca')](_0x6af8('0xcb'),_0x2b007f['params']['id'],_0x4a6f36);var _0x5f4a9f=path[_0x6af8('0xc9')](_0x3ffd39,_0x41ac3a);var _0x5740f4=[];_0x5740f4[_0x6af8('0x34')]({'model':db[_0x6af8('0x70')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5740f4[_0x6af8('0x34')]({'model':db[_0x6af8('0xcc')],'as':'Contact','attributes':['id','firstName',_0x6af8('0xcd')],'raw':!![]});var _0x3ecda5=[{'model':db[_0x6af8('0xba')],'as':_0x6af8('0xce'),'attributes':['id',_0x6af8('0x74'),_0x6af8('0x78'),'direction',_0x6af8('0xcf'),'read'],'include':_0x5740f4}];_0x3ecda5[_0x6af8('0x34')]({'model':db[_0x6af8('0xd0')],'as':'Account','attributes':['id',_0x6af8('0x2b')]});_0x3ecda5[_0x6af8('0x34')]({'model':db[_0x6af8('0x70')],'as':_0x6af8('0xd1'),'attributes':['id',_0x6af8('0x2f')]});return db[_0x6af8('0x37')]['find']({'where':{'id':_0x2b007f['params']['id']},'include':_0x3ecda5})[_0x6af8('0x27')](handleEntityNotFound(_0x12af44,null))['then'](function(_0x17130c){if(_0x17130c){var _0x7c9272=_0x17130c[_0x6af8('0xd2')]({'plain':!![]});fs[_0x6af8('0xd3')](_0x106541);var _0x4c60c3={'format':'A4','border':_0x6af8('0xd4'),'header':{'height':_0x6af8('0xd5'),'contents':{'first':_0x6af8('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x6af8('0xca')](_0x6af8('0xd7'),util[_0x6af8('0xca')](_0x6af8('0xd8'),_0x6af8('0xd9'),_0x7c9272['id']),moment()['format'](_0x6af8('0xda'))['toString']())}}};var _0x559e6c={'channel':_0x6af8('0xd9'),'account':_0x7c9272[_0x6af8('0xdb')][_0x6af8('0x2b')],'agent':_0x7c9272[_0x6af8('0xd1')]?_0x7c9272[_0x6af8('0xd1')][_0x6af8('0x2f')]:_0x6af8('0xdc'),'createdAt':moment(_0x7c9272[_0x6af8('0x78')])[_0x6af8('0xca')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x7c9272[_0x6af8('0xdd')]?moment(_0x7c9272['closedAt'])['format'](_0x6af8('0xde'))['toString']():'','disposition':_0x7c9272[_0x6af8('0xdf')],'messages':_(_0x7c9272[_0x6af8('0xce')])[_0x6af8('0x84')]({'secret':![]})[_0x6af8('0x2e')](function(_0x1535bb){return{'date':moment(_0x1535bb[_0x6af8('0x78')])[_0x6af8('0xca')](_0x6af8('0xde'))['toString'](),'sender':_0x1535bb[_0x6af8('0xe0')]===_0x6af8('0xe1')?_0x1535bb['User']?_0x1535bb[_0x6af8('0x70')][_0x6af8('0x2f')]:_0x6af8('0xe2'):_0x1535bb[_0x6af8('0x66')][_0x6af8('0xe3')]+(_0x1535bb['Contact'][_0x6af8('0xcd')]?'\x20'+_0x1535bb[_0x6af8('0x66')][_0x6af8('0xcd')]:''),'body':_0x1535bb['body'],'direction':_0x1535bb[_0x6af8('0xe0')]===_0x6af8('0xe1')?'A':'C','secret':_0x1535bb[_0x6af8('0xcf')],'read':_0x1535bb[_0x6af8('0x80')]};})[_0x6af8('0x63')]()};return ejs[_0x6af8('0xe4')](path[_0x6af8('0xc9')](config[_0x6af8('0xc5')],_0x6af8('0xc6'),_0x6af8('0xe5'),'downloadInteraction.html'),{'interaction':_0x559e6c})[_0x6af8('0x27')](function(_0x553999){return new BPromise(function(_0x567990,_0x46dfd3){pdf['create'](_0x553999,_0x4c60c3)[_0x6af8('0xe6')](path[_0x6af8('0xc9')](_0x106541,_0x6af8('0xe7')+_0x7c9272['id']+'-'+_0x4a6f36+_0x6af8('0xe8')),function(_0x4150f0,_0x58ffe2){if(_0x4150f0)return _0x46dfd3(_0x4150f0);_0x567990(_0x58ffe2);});});})['then'](function(){return new BPromise(function(_0x7984ae,_0x310c78){zipdir(_0x106541,{'saveTo':_0x5f4a9f},function(_0x4434df,_0x58061c){if(_0x4434df)return _0x310c78(_0x4434df);return _0x7984ae(_0x58061c);});})[_0x6af8('0x27')](function(){return new BPromise(function(_0x326b51,_0x1df439){rimraf(_0x106541,function(_0xcff770){if(_0xcff770)_0x1df439(_0xcff770);return _0x326b51();});});})['then'](function(){return _0x12af44[_0x6af8('0xc3')](_0x5f4a9f,_0x41ac3a,function(_0x273323){if(_0x273323){console['log']('err',_0x273323);}else{fs[_0x6af8('0xe9')](_0x5f4a9f);}});});});}else{return _0x12af44[_0x6af8('0xea')](0xc8);}})[_0x6af8('0x35')](handleError(_0x12af44,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7689fcb..bc49fb2 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 _0x1cb9=['remove','getUsers','then','Users','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','update'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2ebcfb,_0x49ee4b){_0x2ebcfb=_0x2ebcfb-0x0;var _0x290603=_0x1cb9[_0x2ebcfb];return _0x290603;};'use strict';var EventEmitter=require(_0x91cb('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x91cb('0x1')];var SmsMessage=require(_0x91cb('0x2'))['db'][_0x91cb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x91cb('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x91cb('0x5'),'afterDestroy':_0x91cb('0x6')};function emitEvent(_0x5652cd){return function(_0x17c21c,_0x3640f9,_0x186dc3){_0x17c21c[_0x91cb('0x7')]({'attributes':['id'],'raw':!![]})[_0x91cb('0x8')](function(_0x8f8a3b){_0x17c21c['setDataValue'](_0x91cb('0x9'),_0x8f8a3b['map'](function(_0x2fdfce){return{'id':_0x2fdfce['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x17c21c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x91cb('0x8')](function(_0x317df0){_0x17c21c[_0x91cb('0xa')](_0x91cb('0xb'),_0x317df0[_0x91cb('0xc')]);SmsInteractionEvents[_0x91cb('0xd')](_0x5652cd+':'+_0x17c21c['id'],_0x17c21c);SmsInteractionEvents[_0x91cb('0xd')](_0x5652cd,_0x17c21c);_0x186dc3(null);})[_0x91cb('0xe')](_0x186dc3(null));};}for(var e in events){if(events[_0x91cb('0xf')](e)){var event=events[e];SmsInteraction[_0x91cb('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xac9d=['setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0xac9d,0x14d));var _0xdac9=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0xac9d[_0x41ed37];return _0x13f7ea;};'use strict';var EventEmitter=require(_0xdac9('0x0'));var SmsInteraction=require(_0xdac9('0x1'))['db'][_0xdac9('0x2')];var SmsMessage=require(_0xdac9('0x1'))['db'][_0xdac9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xdac9('0x4')](0x0);var events={'afterCreate':_0xdac9('0x5'),'afterUpdate':_0xdac9('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1c17a6){return function(_0x5a984a,_0x3d56ae,_0x1f8ff3){_0x5a984a[_0xdac9('0x7')]({'attributes':['id'],'raw':!![]})[_0xdac9('0x8')](function(_0x1c78c5){_0x5a984a[_0xdac9('0x9')]('Users',_0x1c78c5[_0xdac9('0xa')](function(_0x47d9fd){return{'id':_0x47d9fd['id']};}));return SmsMessage[_0xdac9('0xb')]({'where':{'SmsInteractionId':_0x5a984a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdac9('0x8')](function(_0x39c92c){_0x5a984a[_0xdac9('0x9')](_0xdac9('0xc'),_0x39c92c[_0xdac9('0xd')]);SmsInteractionEvents[_0xdac9('0xe')](_0x1c17a6+':'+_0x5a984a['id'],_0x5a984a);SmsInteractionEvents[_0xdac9('0xe')](_0x1c17a6,_0x5a984a);_0x1f8ff3(null);})[_0xdac9('0xf')](_0x1f8ff3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xdac9('0x10')](e,emitEvent(event));}}module[_0xdac9('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 11f55d0..f5598cd 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 _0xef18=['request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird'];(function(_0x2237bb,_0x46a955){var _0xdb379b=function(_0xc4c394){while(--_0xc4c394){_0x2237bb['push'](_0x2237bb['shift']());}};_0xdb379b(++_0x46a955);}(_0xef18,0x88));var _0x8ef1=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xef18[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require(_0x8ef1('0x0'));var logger=require(_0x8ef1('0x1'))(_0x8ef1('0x2'));var moment=require('moment');var BPromise=require(_0x8ef1('0x3'));var rp=require(_0x8ef1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ef1('0x5'));var config=require(_0x8ef1('0x6'));var attributes=require(_0x8ef1('0x7'));module[_0x8ef1('0x8')]=function(_0x334d72,_0x2a8a8c){return _0x334d72[_0x8ef1('0x9')](_0x8ef1('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7a56fc,_0x2ac93b,_0x20c6eb){if(_0x7a56fc['changed'](_0x8ef1('0xb'))){_0x7a56fc['closedAt']=moment()[_0x8ef1('0xc')](_0x8ef1('0xd'));}_0x20c6eb(null,_0x7a56fc);}}});}; \ No newline at end of file +var _0x84a5=['rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x84a5,0x138));var _0x584a=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x84a5[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x584a('0x0'));var util=require(_0x584a('0x1'));var logger=require(_0x584a('0x2'))(_0x584a('0x3'));var moment=require(_0x584a('0x4'));var BPromise=require(_0x584a('0x5'));var rp=require(_0x584a('0x6'));var fs=require('fs');var path=require(_0x584a('0x7'));var rimraf=require(_0x584a('0x8'));var config=require(_0x584a('0x9'));var attributes=require(_0x584a('0xa'));module[_0x584a('0xb')]=function(_0x58fafb,_0xb07f53){return _0x58fafb[_0x584a('0xc')](_0x584a('0xd'),attributes,{'tableName':_0x584a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15d59c,_0x36ff46,_0x2510ec){if(_0x15d59c[_0x584a('0xf')](_0x584a('0x10'))){_0x15d59c[_0x584a('0x11')]=moment()[_0x584a('0x12')](_0x584a('0x13'));}_0x2510ec(null,_0x15d59c);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index e1c7266..7538dd0 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 _0xc3c3=['body','options','raw','where','limit','stringify','SmsInteraction','find','omit','ids','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateSmsInteraction','update'];(function(_0xa0190e,_0x190c62){var _0x7240c1=function(_0x18e9c1){while(--_0x18e9c1){_0xa0190e['push'](_0xa0190e['shift']());}};_0x7240c1(++_0x190c62);}(_0xc3c3,0xad));var _0x3c3c=function(_0x178cc8,_0x469a36){_0x178cc8=_0x178cc8-0x0;var _0x4ec023=_0xc3c3[_0x178cc8];return _0x4ec023;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require(_0x3c3c('0x2'));var BPromise=require(_0x3c3c('0x3'));var rs=require(_0x3c3c('0x4'));var fs=require('fs');var Redis=require(_0x3c3c('0x5'));var db=require(_0x3c3c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c3c('0x7'))(_0x3c3c('0x8'));var config=require(_0x3c3c('0x9'));var jayson=require(_0x3c3c('0xa'));var client=jayson[_0x3c3c('0xb')][_0x3c3c('0xc')]({'port':0x232a});config[_0x3c3c('0xd')]=_['defaults'](config[_0x3c3c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c3c('0xe'))(new Redis(config[_0x3c3c('0xd')]));require(_0x3c3c('0xf'))[_0x3c3c('0x10')](socket);function respondWithRpcPromise(_0x5a8eca,_0x24694e,_0x5dbe89){return new BPromise(function(_0x280ada,_0x2c44d9){return client['request'](_0x5a8eca,_0x5dbe89)[_0x3c3c('0x11')](function(_0x2315f1){logger[_0x3c3c('0x12')](_0x3c3c('0x13'),_0x24694e,_0x3c3c('0x14'));logger['debug'](_0x3c3c('0x15'),_0x24694e,_0x3c3c('0x14'),JSON['stringify'](_0x2315f1));if(_0x2315f1[_0x3c3c('0x16')]){if(_0x2315f1['error']['code']===0x1f4){logger[_0x3c3c('0x16')](_0x3c3c('0x13'),_0x24694e,_0x2315f1[_0x3c3c('0x16')][_0x3c3c('0x17')]);return _0x2c44d9(_0x2315f1[_0x3c3c('0x16')]['message']);}logger[_0x3c3c('0x16')](_0x3c3c('0x13'),_0x24694e,_0x2315f1[_0x3c3c('0x16')][_0x3c3c('0x17')]);return _0x280ada(_0x2315f1[_0x3c3c('0x16')]['message']);}else{logger[_0x3c3c('0x12')](_0x3c3c('0x13'),_0x24694e,'request\x20sent');_0x280ada(_0x2315f1['result'][_0x3c3c('0x17')]);}})[_0x3c3c('0x18')](function(_0x44ee73){logger['error'](_0x3c3c('0x13'),_0x24694e,_0x44ee73);_0x2c44d9(_0x44ee73);});});}exports[_0x3c3c('0x19')]=function(_0x14f52a){var _0x3d47a3=this;return new Promise(function(_0xd4f01c,_0x173aa2){return db['SmsInteraction'][_0x3c3c('0x1a')](_0x14f52a[_0x3c3c('0x1b')],{'raw':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a['options'][_0x3c3c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a[_0x3c3c('0x1c')][_0x3c3c('0x1e')]||null:null,'attributes':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a[_0x3c3c('0x1c')]['attributes']||null:null,'limit':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a['options'][_0x3c3c('0x1f')]||null:null})[_0x3c3c('0x11')](function(_0x1b2a5d){logger[_0x3c3c('0x12')]('UpdateSmsInteraction',_0x14f52a);logger['debug']('UpdateSmsInteraction',_0x14f52a,JSON[_0x3c3c('0x20')](_0x1b2a5d));_0xd4f01c(_0x1b2a5d);})[_0x3c3c('0x18')](function(_0x2d1db4){logger[_0x3c3c('0x16')](_0x3c3c('0x19'),_0x2d1db4['message'],_0x14f52a);_0x173aa2(_0x3d47a3['error'](0x1f4,_0x2d1db4['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x677806){return new Promise(function(_0x55af49,_0x4ccbec){return db[_0x3c3c('0x21')][_0x3c3c('0x22')]({'where':_0x677806[_0x3c3c('0x1c')]?_0x677806[_0x3c3c('0x1c')][_0x3c3c('0x1e')]||null:null})[_0x3c3c('0x11')](function(_0x1148bb){if(_0x1148bb){return _0x1148bb['addTags'](_0x677806[_0x3c3c('0x1b')]['ids'],_[_0x3c3c('0x23')](_0x677806['body'],[_0x3c3c('0x24'),'id'])||{});}})[_0x3c3c('0x25')](function(_0xbd14c7){logger[_0x3c3c('0x12')]('AddTags',_0x677806);logger[_0x3c3c('0x26')]('AddTags',_0x677806,JSON[_0x3c3c('0x20')](_0xbd14c7));_0x55af49(_0xbd14c7);})[_0x3c3c('0x18')](function(_0x249796){logger[_0x3c3c('0x16')](_0x3c3c('0x27'),_0x249796['message'],_0x677806);_0x4ccbec(_this[_0x3c3c('0x16')](0x1f4,_0x249796['message']));});});}; \ No newline at end of file +var _0x34b9=['omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x34b9,0x9f));var _0x934b=function(_0x1fb130,_0x55b130){_0x1fb130=_0x1fb130-0x0;var _0x16d296=_0x34b9[_0x1fb130];return _0x16d296;};'use strict';var _=require('lodash');var util=require(_0x934b('0x0'));var moment=require('moment');var BPromise=require(_0x934b('0x1'));var rs=require(_0x934b('0x2'));var fs=require('fs');var Redis=require(_0x934b('0x3'));var db=require(_0x934b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x934b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x934b('0x6')][_0x934b('0x7')]({'port':0x232a});config[_0x934b('0x8')]=_[_0x934b('0x9')](config[_0x934b('0x8')],{'host':_0x934b('0xa'),'port':0x18eb});var socket=require(_0x934b('0xb'))(new Redis(config[_0x934b('0x8')]));require(_0x934b('0xc'))['register'](socket);function respondWithRpcPromise(_0x855845,_0x143a05,_0x1b5f96){return new BPromise(function(_0x2de259,_0x884eb4){return client[_0x934b('0xd')](_0x855845,_0x1b5f96)[_0x934b('0xe')](function(_0x3ec48a){logger[_0x934b('0xf')](_0x934b('0x10'),_0x143a05,'request\x20sent');logger[_0x934b('0x11')](_0x934b('0x12'),_0x143a05,'request\x20sent',JSON[_0x934b('0x13')](_0x3ec48a));if(_0x3ec48a['error']){if(_0x3ec48a[_0x934b('0x14')]['code']===0x1f4){logger[_0x934b('0x14')](_0x934b('0x10'),_0x143a05,_0x3ec48a[_0x934b('0x14')][_0x934b('0x15')]);return _0x884eb4(_0x3ec48a['error'][_0x934b('0x15')]);}logger['error'](_0x934b('0x10'),_0x143a05,_0x3ec48a[_0x934b('0x14')][_0x934b('0x15')]);return _0x2de259(_0x3ec48a[_0x934b('0x14')][_0x934b('0x15')]);}else{logger[_0x934b('0xf')](_0x934b('0x10'),_0x143a05,'request\x20sent');_0x2de259(_0x3ec48a['result'][_0x934b('0x15')]);}})[_0x934b('0x16')](function(_0x587a43){logger[_0x934b('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x143a05,_0x587a43);_0x884eb4(_0x587a43);});});}exports['UpdateSmsInteraction']=function(_0x57fbcb){var _0x56122c=this;return new Promise(function(_0x595188,_0x1e83a6){return db[_0x934b('0x17')][_0x934b('0x18')](_0x57fbcb[_0x934b('0x19')],{'raw':_0x57fbcb[_0x934b('0x1a')]?_0x57fbcb['options'][_0x934b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57fbcb[_0x934b('0x1a')]?_0x57fbcb['options'][_0x934b('0x1c')]||null:null,'attributes':_0x57fbcb['options']?_0x57fbcb[_0x934b('0x1a')][_0x934b('0x1d')]||null:null,'limit':_0x57fbcb[_0x934b('0x1a')]?_0x57fbcb[_0x934b('0x1a')][_0x934b('0x1e')]||null:null})[_0x934b('0xe')](function(_0x5b00b7){logger['info'](_0x934b('0x1f'),_0x57fbcb);logger['debug'](_0x934b('0x1f'),_0x57fbcb,JSON[_0x934b('0x13')](_0x5b00b7));_0x595188(_0x5b00b7);})[_0x934b('0x16')](function(_0x400d3b){logger['error'](_0x934b('0x1f'),_0x400d3b[_0x934b('0x15')],_0x57fbcb);_0x1e83a6(_0x56122c[_0x934b('0x14')](0x1f4,_0x400d3b['message']));});});};exports[_0x934b('0x20')]=function(_0x1e42d4){return new Promise(function(_0x569349,_0x368209){return db[_0x934b('0x17')][_0x934b('0x21')]({'where':_0x1e42d4[_0x934b('0x1a')]?_0x1e42d4[_0x934b('0x1a')][_0x934b('0x1c')]||null:null})[_0x934b('0xe')](function(_0x5f02fc){if(_0x5f02fc){return _0x5f02fc[_0x934b('0x22')](_0x1e42d4['body'][_0x934b('0x23')],_[_0x934b('0x24')](_0x1e42d4[_0x934b('0x19')],[_0x934b('0x23'),'id'])||{});}})[_0x934b('0x25')](function(_0x43c49e){logger['info'](_0x934b('0x26'),_0x1e42d4);logger[_0x934b('0x11')]('AddTags',_0x1e42d4,JSON[_0x934b('0x13')](_0x43c49e));_0x569349(_0x43c49e);})[_0x934b('0x16')](function(_0x492fa5){logger[_0x934b('0x14')](_0x934b('0x26'),_0x492fa5[_0x934b('0x15')],_0x1e42d4);_0x368209(_this[_0x934b('0x14')](0x1f4,_0x492fa5[_0x934b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 414f145..7a07440 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(_0x313f70,_0x56b687){var _0xc7d66a=function(_0x4ad4d9){while(--_0x4ad4d9){_0x313f70['push'](_0x313f70['shift']());}};_0xc7d66a(++_0x56b687);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb7e7[_0x5d80de];return _0x1c7556;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0x2032,0xd9));var _0x2203=function(_0x4d27c4,_0x1aff11){_0x4d27c4=_0x4d27c4-0x0;var _0x3bc86b=_0x2032[_0x4d27c4];return _0x3bc86b;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0e758eb..1eef011 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 _0x8539=['/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','tracked','create'];(function(_0x699200,_0x39c101){var _0x266fd1=function(_0x1a9368){while(--_0x1a9368){_0x699200['push'](_0x699200['shift']());}};_0x266fd1(++_0x39c101);}(_0x8539,0x1b2));var _0x9853=function(_0x1a9af1,_0x55d9f9){_0x1a9af1=_0x1a9af1-0x0;var _0x2243a9=_0x8539[_0x1a9af1];return _0x2243a9;};'use strict';var multer=require(_0x9853('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9853('0x1'));var express=require(_0x9853('0x2'));var router=express['Router']();var auth=require(_0x9853('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9853('0x4'));var controller=require(_0x9853('0x5'));router['get']('/',auth[_0x9853('0x6')](),controller[_0x9853('0x7')]);router['get'](_0x9853('0x8'),auth['isAuthenticated'](),controller[_0x9853('0x9')]);router[_0x9853('0xa')](_0x9853('0xb'),auth['isAuthenticated'](),controller[_0x9853('0xc')]);router[_0x9853('0xd')]('/',auth['isAuthenticated'](),interaction[_0x9853('0xe')]('sms','smsmessage:create'),controller[_0x9853('0xf')]);router[_0x9853('0xd')](_0x9853('0x10'),controller[_0x9853('0x11')]);router['put'](_0x9853('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9853('0x12')](_0x9853('0x13'),auth['isAuthenticated'](),controller[_0x9853('0x14')]);router['put'](_0x9853('0x15'),auth[_0x9853('0x6')](),controller['reject']);router[_0x9853('0x16')]('/:id',auth[_0x9853('0x6')](),controller[_0x9853('0x17')]);module[_0x9853('0x18')]=router; \ No newline at end of file +var _0x6041=['update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put'];(function(_0x1227fa,_0x1502d4){var _0x281e11=function(_0x2924db){while(--_0x2924db){_0x1227fa['push'](_0x1227fa['shift']());}};_0x281e11(++_0x1502d4);}(_0x6041,0x92));var _0x1604=function(_0x10e485,_0x4ee577){_0x10e485=_0x10e485-0x0;var _0x540f38=_0x6041[_0x10e485];return _0x540f38;};'use strict';var multer=require(_0x1604('0x0'));var util=require(_0x1604('0x1'));var path=require('path');var timeout=require(_0x1604('0x2'));var express=require(_0x1604('0x3'));var router=express[_0x1604('0x4')]();var auth=require(_0x1604('0x5'));var interaction=require(_0x1604('0x6'));var config=require(_0x1604('0x7'));var controller=require(_0x1604('0x8'));router[_0x1604('0x9')]('/',auth[_0x1604('0xa')](),controller['index']);router[_0x1604('0x9')](_0x1604('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1604('0xc'),auth[_0x1604('0xa')](),controller[_0x1604('0xd')]);router['post']('/',auth[_0x1604('0xa')](),interaction[_0x1604('0xe')](_0x1604('0xf'),_0x1604('0x10')),controller[_0x1604('0x11')]);router[_0x1604('0x12')](_0x1604('0x13'),controller[_0x1604('0x14')]);router[_0x1604('0x15')](_0x1604('0xc'),auth[_0x1604('0xa')](),controller[_0x1604('0x16')]);router[_0x1604('0x15')](_0x1604('0x17'),auth[_0x1604('0xa')](),controller[_0x1604('0x18')]);router[_0x1604('0x15')](_0x1604('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x1604('0x1a')]('/:id',auth[_0x1604('0xa')](),controller['destroy']);module[_0x1604('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 457b599..806bba4 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 _0xdd57=['BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x390b7c,_0x43ef0c){var _0x30bfc5=function(_0x419787){while(--_0x419787){_0x390b7c['push'](_0x390b7c['shift']());}};_0x30bfc5(++_0x43ef0c);}(_0xdd57,0x1c4));var _0x7dd5=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xdd57[_0x237f8b];return _0x423f94;};'use strict';var Sequelize=require(_0x7dd5('0x0'));module[_0x7dd5('0x1')]={'body':{'type':Sequelize[_0x7dd5('0x2')](_0x7dd5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7dd5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7dd5('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7dd5('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7dd5('0x7')]},'secret':{'type':Sequelize[_0x7dd5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7dd5('0x2')]}}; \ No newline at end of file +var _0xf113=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x4dec34,_0x455eef){var _0x35d630=function(_0x249eb9){while(--_0x249eb9){_0x4dec34['push'](_0x4dec34['shift']());}};_0x35d630(++_0x455eef);}(_0xf113,0x1e7));var _0x3f11=function(_0x41a03b,_0x170772){_0x41a03b=_0x41a03b-0x0;var _0x5c7a85=_0xf113[_0x41a03b];return _0x5c7a85;};'use strict';var Sequelize=require(_0x3f11('0x0'));module[_0x3f11('0x1')]={'body':{'type':Sequelize[_0x3f11('0x2')](_0x3f11('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3f11('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3f11('0x5')]('in',_0x3f11('0x6')),'defaultValue':_0x3f11('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3f11('0x7')]},'secret':{'type':Sequelize[_0x3f11('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3f11('0x8')]},'providerResponse':{'type':Sequelize[_0x3f11('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 33b48ea..abbb1fc 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 _0x250c=['http','request','then','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','index','map','SmsMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','SIP/%s','EventManager','acceptmessage','agent','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','client'];(function(_0x338b4c,_0x48f49e){var _0x3442f8=function(_0x2d81d4){while(--_0x2d81d4){_0x338b4c['push'](_0x338b4c['shift']());}};_0x3442f8(++_0x48f49e);}(_0x250c,0x68));var _0xc250=function(_0x3b032b,_0x5325a4){_0x3b032b=_0x3b032b-0x0;var _0x4dd549=_0x250c[_0x3b032b];return _0x4dd549;};'use strict';var pdf=require(_0xc250('0x0'));var emlformat=require(_0xc250('0x1'));var rimraf=require(_0xc250('0x2'));var zipdir=require(_0xc250('0x3'));var jsonpatch=require(_0xc250('0x4'));var rp=require(_0xc250('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc250('0x6'));var util=require(_0xc250('0x7'));var path=require(_0xc250('0x8'));var sox=require(_0xc250('0x9'));var csv=require(_0xc250('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc250('0xb'));var squel=require(_0xc250('0xc'));var crypto=require('crypto');var jsforce=require(_0xc250('0xd'));var deskjs=require(_0xc250('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc250('0xf'));var Redis=require('ioredis');var authService=require(_0xc250('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc250('0x11'));var logger=require(_0xc250('0x12'))(_0xc250('0x13'));var utils=require(_0xc250('0x14'));var config=require(_0xc250('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc250('0x16'))['db'];config['redis']=_[_0xc250('0x17')](config[_0xc250('0x18')],{'host':_0xc250('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc250('0x1a'))[_0xc250('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc250('0x1c')][_0xc250('0x1d')]({'port':0x232c});var client9002=jayson[_0xc250('0x1c')][_0xc250('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2873a5,_0x181566,_0x4b65ca,_0x43bb60){return new BPromise(function(_0x2999fd,_0x1e34d5){var _0x535162=_0x43bb60||client;return _0x535162[_0xc250('0x1e')](_0x2873a5,_0x4b65ca)[_0xc250('0x1f')](function(_0x34fb97){logger[_0xc250('0x20')]('SmsMessage,\x20%s,\x20%s',_0x181566,_0xc250('0x21'));logger[_0xc250('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x181566,_0xc250('0x21'),JSON[_0xc250('0x23')](_0x34fb97));if(_0x34fb97[_0xc250('0x24')]){if(_0x34fb97[_0xc250('0x24')][_0xc250('0x25')]===0x1f4){logger[_0xc250('0x24')](_0xc250('0x26'),_0x181566,_0x34fb97[_0xc250('0x24')][_0xc250('0x27')]);return _0x1e34d5(_0x34fb97[_0xc250('0x24')][_0xc250('0x27')]);}logger['error'](_0xc250('0x26'),_0x181566,_0x34fb97['error'][_0xc250('0x27')]);return _0x2999fd(_0x34fb97[_0xc250('0x24')]['message']);}else{logger[_0xc250('0x20')]('SmsMessage,\x20%s,\x20%s',_0x181566,_0xc250('0x21'));_0x2999fd(_0x34fb97['result'][_0xc250('0x27')]);}})[_0xc250('0x28')](function(_0x143ced){logger[_0xc250('0x24')](_0xc250('0x26'),_0x181566,_0x143ced);_0x1e34d5(_0x143ced);});});}function respondWithStatusCode(_0x5bf423,_0x438387){_0x438387=_0x438387||0xcc;return function(_0x3a511a){if(_0x3a511a){return _0x5bf423[_0xc250('0x29')](_0x438387);}return _0x5bf423[_0xc250('0x2a')](_0x438387)[_0xc250('0x2b')]();};}function respondWithResult(_0x55616b,_0x41c4e6){_0x41c4e6=_0x41c4e6||0xc8;return function(_0x3e847a){if(_0x3e847a){return _0x55616b[_0xc250('0x2a')](_0x41c4e6)[_0xc250('0x2c')](_0x3e847a);}};}function respondWithFilteredResult(_0x58ca14,_0x1688ef){return function(_0x562f38){if(_0x562f38){var _0x1e54f2=_0x562f38[_0xc250('0x2d')],_0x28736c=_0x1688ef[_0xc250('0x2e')],_0xeb936=_0x1688ef['offset']+_0x1688ef['limit'],_0x969aa3;if(_0xeb936>=_0x1e54f2){_0xeb936=_0x1e54f2;_0x969aa3=0xc8;}else{_0x969aa3=0xce;}_0x58ca14['status'](_0x969aa3);return _0x58ca14[_0xc250('0x2f')](_0xc250('0x30'),_0x28736c+'-'+_0xeb936+'/'+_0x1e54f2)['json'](_0x562f38);}return null;};}function patchUpdates(_0x1eae6a){return function(_0x547def){try{jsonpatch[_0xc250('0x31')](_0x547def,_0x1eae6a,!![]);}catch(_0x96831){return BPromise[_0xc250('0x32')](_0x96831);}return _0x547def[_0xc250('0x33')]();};}function saveUpdates(_0x2db0c9,_0x31e057){return function(_0x390139){if(_0x390139){return _0x390139[_0xc250('0x34')](_0x2db0c9)[_0xc250('0x1f')](function(_0x51611f){return _0x51611f;});}return null;};}function removeEntity(_0x2d90d2,_0x5e0409){return function(_0x34952c){if(_0x34952c){return _0x34952c['destroy']()['then'](function(){_0x2d90d2[_0xc250('0x2a')](0xcc)[_0xc250('0x2b')]();});}};}function handleEntityNotFound(_0x209fc9,_0x4583d0){return function(_0x1a83b2){if(!_0x1a83b2){_0x209fc9['sendStatus'](0x194);}return _0x1a83b2;};}function handleError(_0x428c6a,_0x455802){_0x455802=_0x455802||0x1f4;return function(_0x2b0041){logger[_0xc250('0x24')](_0x2b0041[_0xc250('0x35')]);if(_0x2b0041[_0xc250('0x36')]){delete _0x2b0041[_0xc250('0x36')];}_0x428c6a[_0xc250('0x2a')](_0x455802)['send'](_0x2b0041);};}exports[_0xc250('0x37')]=function(_0x3d61b0,_0x1b6252){var _0x21afb5={},_0x1bda14={},_0xea0ff8={'count':0x0,'rows':[]};var _0x10606f=_[_0xc250('0x38')](db[_0xc250('0x39')][_0xc250('0x3a')],function(_0x474f00){return{'name':_0x474f00['fieldName'],'type':_0x474f00[_0xc250('0x3b')][_0xc250('0x3c')]};});_0x1bda14[_0xc250('0x3d')]=_[_0xc250('0x38')](_0x10606f,_0xc250('0x36'));_0x1bda14['query']=_[_0xc250('0x3e')](_0x3d61b0[_0xc250('0x3f')]);_0x1bda14[_0xc250('0x40')]=_[_0xc250('0x41')](_0x1bda14[_0xc250('0x3d')],_0x1bda14['query']);_0x21afb5['attributes']=_[_0xc250('0x41')](_0x1bda14['model'],qs[_0xc250('0x42')](_0x3d61b0[_0xc250('0x3f')][_0xc250('0x42')]));_0x21afb5[_0xc250('0x43')]=_0x21afb5[_0xc250('0x43')]['length']?_0x21afb5[_0xc250('0x43')]:_0x1bda14[_0xc250('0x3d')];if(!_0x3d61b0['query'][_0xc250('0x44')](_0xc250('0x45'))){_0x21afb5['limit']=qs[_0xc250('0x46')](_0x3d61b0[_0xc250('0x3f')][_0xc250('0x46')]);_0x21afb5[_0xc250('0x2e')]=qs['offset'](_0x3d61b0[_0xc250('0x3f')][_0xc250('0x2e')]);}_0x21afb5[_0xc250('0x47')]=qs[_0xc250('0x48')](_0x3d61b0['query'][_0xc250('0x48')]);_0x21afb5['where']=qs[_0xc250('0x40')](_['pick'](_0x3d61b0[_0xc250('0x3f')],_0x1bda14[_0xc250('0x40')]),_0x10606f);if(_0x3d61b0[_0xc250('0x3f')][_0xc250('0x49')]){_0x21afb5[_0xc250('0x4a')]=_[_0xc250('0x4b')](_0x21afb5['where'],{'$or':_[_0xc250('0x38')](_0x10606f,function(_0x412483){if(_0x412483[_0xc250('0x3b')]!==_0xc250('0x4c')){var _0x422ddd={};_0x422ddd[_0x412483[_0xc250('0x36')]]={'$like':'%'+_0x3d61b0['query']['filter']+'%'};return _0x422ddd;}})});}_0x21afb5=_[_0xc250('0x4b')]({},_0x21afb5,_0x3d61b0['options']);var _0x1dec5d={'where':_0x21afb5['where']};return db['SmsMessage'][_0xc250('0x2d')](_0x1dec5d)[_0xc250('0x1f')](function(_0x2bb266){_0xea0ff8[_0xc250('0x2d')]=_0x2bb266;if(_0x3d61b0[_0xc250('0x3f')][_0xc250('0x4d')]){_0x21afb5[_0xc250('0x4e')]=[{'all':!![]}];}return db[_0xc250('0x39')][_0xc250('0x4f')](_0x21afb5);})[_0xc250('0x1f')](function(_0x42ef9c){_0xea0ff8[_0xc250('0x50')]=_0x42ef9c;return _0xea0ff8;})[_0xc250('0x1f')](respondWithFilteredResult(_0x1b6252,_0x21afb5))[_0xc250('0x28')](handleError(_0x1b6252,null));};exports[_0xc250('0x51')]=function(_0x355093,_0x350c15){var _0x1b7a70={'raw':!![],'where':{'id':_0x355093[_0xc250('0x52')]['id']}},_0x3da946={};_0x3da946[_0xc250('0x3d')]=_['keys'](db[_0xc250('0x39')][_0xc250('0x3a')]);_0x3da946[_0xc250('0x3f')]=_[_0xc250('0x3e')](_0x355093[_0xc250('0x3f')]);_0x3da946[_0xc250('0x40')]=_[_0xc250('0x41')](_0x3da946[_0xc250('0x3d')],_0x3da946[_0xc250('0x3f')]);_0x1b7a70[_0xc250('0x43')]=_[_0xc250('0x41')](_0x3da946[_0xc250('0x3d')],qs[_0xc250('0x42')](_0x355093[_0xc250('0x3f')]['fields']));_0x1b7a70[_0xc250('0x43')]=_0x1b7a70[_0xc250('0x43')][_0xc250('0x53')]?_0x1b7a70[_0xc250('0x43')]:_0x3da946[_0xc250('0x3d')];if(_0x355093[_0xc250('0x3f')]['includeAll']){_0x1b7a70[_0xc250('0x4e')]=[{'all':!![]}];}_0x1b7a70=_[_0xc250('0x4b')]({},_0x1b7a70,_0x355093[_0xc250('0x54')]);return db[_0xc250('0x39')]['find'](_0x1b7a70)['then'](handleEntityNotFound(_0x350c15,null))[_0xc250('0x1f')](respondWithResult(_0x350c15,null))[_0xc250('0x28')](handleError(_0x350c15,null));};exports[_0xc250('0x55')]=function(_0x3d2207,_0x3db0f0){return db['SmsMessage'][_0xc250('0x55')](_0x3d2207[_0xc250('0x56')],{})[_0xc250('0x1f')](respondWithResult(_0x3db0f0,0xc9))[_0xc250('0x28')](handleError(_0x3db0f0,null));};exports[_0xc250('0x34')]=function(_0x2dc52e,_0x53b138){if(_0x2dc52e[_0xc250('0x56')]['id']){delete _0x2dc52e[_0xc250('0x56')]['id'];}return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x2dc52e[_0xc250('0x52')]['id']}})[_0xc250('0x1f')](handleEntityNotFound(_0x53b138,null))[_0xc250('0x1f')](saveUpdates(_0x2dc52e[_0xc250('0x56')],null))[_0xc250('0x1f')](respondWithResult(_0x53b138,null))[_0xc250('0x28')](handleError(_0x53b138,null));};exports['destroy']=function(_0x2a2a20,_0x1f31d5){return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x2a2a20[_0xc250('0x52')]['id']}})['then'](handleEntityNotFound(_0x1f31d5,null))['then'](removeEntity(_0x1f31d5,null))['catch'](handleError(_0x1f31d5,null));};exports[_0xc250('0x58')]=function(_0x37ba76,_0x311e98){return db[_0xc250('0x39')][_0xc250('0x58')]()[_0xc250('0x1f')](respondWithResult(_0x311e98,null))[_0xc250('0x28')](handleError(_0x311e98,null));};var interaction_log=require('../../config/logger')(_0xc250('0x59'));exports[_0xc250('0x5a')]=function(_0x552251,_0x45dc91,_0x306425){var _0x3bd725={'channel':_0xc250('0x5b')};if(_0x552251[_0xc250('0x56')]['id']){delete _0x552251[_0xc250('0x56')]['id'];}_0x552251[_0xc250('0x56')][_0xc250('0x5c')]=!![];_0x552251[_0xc250('0x56')][_0xc250('0x5d')]=moment()[_0xc250('0x5e')](_0xc250('0x5f'));_0x552251[_0xc250('0x56')][_0xc250('0x60')]=_0x552251['body'][_0xc250('0x60')]||_0x552251[_0xc250('0x61')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x552251[_0xc250('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xc250('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x45dc91,null))[_0xc250('0x1f')](saveUpdates(_0x552251[_0xc250('0x56')],null))['then'](function(_0x3fd17c){if(_0x3fd17c){_0x3bd725[_0xc250('0x27')]=_0x3fd17c['get']({'plain':!![]});return db['SmsInteraction'][_0xc250('0x57')]({'where':{'id':_0x3fd17c['SmsInteractionId']}});}return null;})[_0xc250('0x1f')](handleEntityNotFound(_0x45dc91,null))[_0xc250('0x1f')](function(_0x56dcba){if(_0x56dcba){return _0x56dcba[_0xc250('0x34')]({'UserId':_0x552251[_0xc250('0x56')][_0xc250('0x60')],'read1stAt':_[_0xc250('0x63')](_0x56dcba['read1stAt'])?moment()[_0xc250('0x5e')](_0xc250('0x5f')):undefined});}return null;})[_0xc250('0x1f')](function(_0x1dca6d){if(_0x1dca6d){_0x3bd725[_0xc250('0x64')]=_0x1dca6d[_0xc250('0x65')]({'plain':!![]});interaction_log['info'](_0xc250('0x66'),_0x552251[_0xc250('0x61')]['id'],_0x552251[_0xc250('0x61')][_0xc250('0x36')],_0x552251[_0xc250('0x61')][_0xc250('0x67')],_0x3bd725[_0xc250('0x64')]['id'],_0x552251[_0xc250('0x56')]?JSON[_0xc250('0x23')](_0x552251['body']):_0xc250('0x68'));return respondWithRpcPromise('AcceptMessage',_0xc250('0x69'),_0x3bd725);}return null;})[_0xc250('0x1f')](function(_0x3ba283){if(_0x3ba283){if(_0x552251[_0xc250('0x56')][_0xc250('0x6a')]){_0x3bd725[_0xc250('0x27')]['interface']=util[_0xc250('0x5e')](_0xc250('0x6b'),_0x552251['user']['name']);_0x3bd725[_0xc250('0x27')]['channel']=_0x3bd725['channel'];_0x3bd725['message']['event']=_0xc250('0x5a');return respondWithRpcPromise('EventManager',_0xc250('0x6c'),{'event':_0xc250('0x6d'),'message':_0x3bd725[_0xc250('0x27')]},client9002)[_0xc250('0x1f')](function(){return _0x3bd725;});}return _0x3bd725;}return null;})[_0xc250('0x1f')](respondWithResult(_0x45dc91,null))[_0xc250('0x28')](handleError(_0x45dc91,null));};var interaction_log=require(_0xc250('0x12'))(_0xc250('0x59'));exports[_0xc250('0x32')]=function(_0x920f49,_0x2f7304,_0x5c600c){var _0x4b983c={'agent':{},'channel':_0xc250('0x5b')};if(_0x920f49[_0xc250('0x56')]['id']){delete _0x920f49[_0xc250('0x56')]['id'];}_0x920f49['body'][_0xc250('0x60')]=_0x920f49[_0xc250('0x56')][_0xc250('0x60')]||_0x920f49[_0xc250('0x61')]['id'];_0x4b983c[_0xc250('0x6e')]['id']=_0x920f49[_0xc250('0x56')][_0xc250('0x60')];return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x920f49[_0xc250('0x52')]['id'],'UserId':null}})[_0xc250('0x1f')](handleEntityNotFound(_0x2f7304,null))[_0xc250('0x1f')](function(_0x1a00eb){if(_0x1a00eb){_0x4b983c[_0xc250('0x27')]=_0x1a00eb['get']({'plain':!![]});return db[_0xc250('0x6f')]['find']({'where':{'id':_0x1a00eb[_0xc250('0x70')]}});}return null;})['then'](handleEntityNotFound(_0x2f7304,null))[_0xc250('0x1f')](function(_0x3e25f3){if(_0x3e25f3){_0x4b983c[_0xc250('0x64')]=_0x3e25f3[_0xc250('0x65')]({'plain':!![]});interaction_log[_0xc250('0x20')](_0xc250('0x71'),_0x920f49['user']['id'],_0x920f49[_0xc250('0x61')][_0xc250('0x36')],_0x920f49[_0xc250('0x61')][_0xc250('0x67')],_0x4b983c[_0xc250('0x64')]['id'],_0x920f49[_0xc250('0x56')]?JSON[_0xc250('0x23')](_0x920f49[_0xc250('0x56')]):'null');return respondWithRpcPromise(_0xc250('0x72'),_0xc250('0x73'),_0x4b983c);}return null;})[_0xc250('0x1f')](function(_0x186c8a){if(_0x186c8a){_0x186c8a[_0xc250('0x27')][_0xc250('0x74')]=util['format'](_0xc250('0x6b'),_0x920f49[_0xc250('0x61')][_0xc250('0x36')]);_0x186c8a[_0xc250('0x27')]['channel']=_0x4b983c['channel'];_0x186c8a[_0xc250('0x27')][_0xc250('0x75')]=_0xc250('0x32');respondWithRpcPromise(_0xc250('0x6c'),'EventManager',{'event':_0xc250('0x76'),'message':_0x186c8a[_0xc250('0x27')]},client9002);return _0x4b983c;}return null;})[_0xc250('0x1f')](respondWithResult(_0x2f7304,null))[_0xc250('0x28')](handleError(_0x2f7304,null));};exports['status']=function(_0x26ad3a,_0x4d4c3e,_0x133a7b){if(_0x26ad3a[_0xc250('0x56')]['id']){delete _0x26ad3a[_0xc250('0x56')]['id'];}var _0x3d95e2;return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x26ad3a['params']['id']}})[_0xc250('0x1f')](handleEntityNotFound(_0x4d4c3e,null))[_0xc250('0x1f')](function(_0x12fd98){if(_0x12fd98){_0x3d95e2=_0x12fd98;return db[_0xc250('0x77')]['find']({'where':{'id':_0x12fd98[_0xc250('0x78')]}});}})[_0xc250('0x1f')](handleEntityNotFound(_0x4d4c3e,null))[_0xc250('0x1f')](function(_0x5e5804){if(_0x5e5804){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc250('0x2a'),_0xc250('0x79'),_0x5e5804[_0xc250('0x3b')],util['inspect'](_0x26ad3a[_0xc250('0x56')],{'showHidden':![],'depth':null}));switch(_0x5e5804['type']){case'twilio':if(_0x26ad3a[_0xc250('0x56')][_0xc250('0x7a')]&&_0x26ad3a[_0xc250('0x56')][_0xc250('0x7a')]===_0x3d95e2[_0xc250('0x7b')]){return _0x3d95e2[_0xc250('0x34')]({'read':!![]});}else{logger[_0xc250('0x24')](_0xc250('0x7c'),_0xc250('0x2a'),'twilio',util[_0xc250('0x7d')](_0x26ad3a[_0xc250('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc250('0x7e'):if(_0x26ad3a[_0xc250('0x56')][_0xc250('0x7f')]&&_0x26ad3a[_0xc250('0x56')][_0xc250('0x7f')]===_0x3d95e2['messageId']&&_[_0xc250('0x80')](['sent','delivered'],_0x26ad3a[_0xc250('0x56')]['Status'])>=0x0){return _0x3d95e2[_0xc250('0x34')]({'read':!![]});}else{logger[_0xc250('0x24')](_0xc250('0x7c'),_0xc250('0x2a'),_0xc250('0x81'),util[_0xc250('0x7d')](_0x26ad3a[_0xc250('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc250('0x82'):var _0x2eae4e=_0x26ad3a[_0xc250('0x56')]['results'][0x0];if(_0x2eae4e[_0xc250('0x2a')][_0xc250('0x83')]===_0xc250('0x84')){return _0x3d95e2[_0xc250('0x34')]({'read':!![]});}else{logger[_0xc250('0x24')](_0xc250('0x7c'),_0xc250('0x2a'),_0xc250('0x82'),util['inspect'](_0x26ad3a['body'],{'showHidden':![],'depth':null}));}break;}return _0x3d95e2;}})[_0xc250('0x1f')](respondWithResult(_0x4d4c3e,null))['catch'](handleError(_0x4d4c3e,null));}; \ No newline at end of file +var _0x9dc3=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','SmsMessage','include','findAll','show','includeAll','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','event','debug','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json'];(function(_0x178ce4,_0x53dc65){var _0x25a4de=function(_0x5a3928){while(--_0x5a3928){_0x178ce4['push'](_0x178ce4['shift']());}};_0x25a4de(++_0x53dc65);}(_0x9dc3,0x15d));var _0x39dc=function(_0x362e87,_0x38d17c){_0x362e87=_0x362e87-0x0;var _0x334244=_0x9dc3[_0x362e87];return _0x334244;};'use strict';var pdf=require(_0x39dc('0x0'));var emlformat=require(_0x39dc('0x1'));var rimraf=require(_0x39dc('0x2'));var zipdir=require(_0x39dc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39dc('0x4'));var moment=require('moment');var BPromise=require(_0x39dc('0x5'));var Mustache=require(_0x39dc('0x6'));var util=require(_0x39dc('0x7'));var path=require(_0x39dc('0x8'));var sox=require(_0x39dc('0x9'));var csv=require('to-csv');var ejs=require(_0x39dc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x39dc('0xb'));var crypto=require(_0x39dc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x39dc('0xd'));var toCsv=require(_0x39dc('0xe'));var querystring=require(_0x39dc('0xf'));var Papa=require(_0x39dc('0x10'));var Redis=require(_0x39dc('0x11'));var authService=require(_0x39dc('0x12'));var qs=require(_0x39dc('0x13'));var as=require(_0x39dc('0x14'));var hardwareService=require(_0x39dc('0x15'));var logger=require(_0x39dc('0x16'))(_0x39dc('0x17'));var utils=require(_0x39dc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x39dc('0x19'));var db=require(_0x39dc('0x1a'))['db'];config[_0x39dc('0x1b')]=_[_0x39dc('0x1c')](config[_0x39dc('0x1b')],{'host':_0x39dc('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x39dc('0x1b')]));require(_0x39dc('0x1e'))['register'](socket);var jayson=require(_0x39dc('0x1f'));var client=jayson[_0x39dc('0x20')][_0x39dc('0x21')]({'port':0x232c});var client9002=jayson[_0x39dc('0x20')][_0x39dc('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xadf5d4,_0x2d1a5d,_0x5314ac,_0x353eb9){return new BPromise(function(_0x40a441,_0x60b474){var _0x4f8717=_0x353eb9||client;return _0x4f8717['request'](_0xadf5d4,_0x5314ac)['then'](function(_0x674008){logger['info'](_0x39dc('0x22'),_0x2d1a5d,_0x39dc('0x23'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2d1a5d,_0x39dc('0x23'),JSON[_0x39dc('0x24')](_0x674008));if(_0x674008['error']){if(_0x674008[_0x39dc('0x25')][_0x39dc('0x26')]===0x1f4){logger['error'](_0x39dc('0x22'),_0x2d1a5d,_0x674008['error'][_0x39dc('0x27')]);return _0x60b474(_0x674008[_0x39dc('0x25')][_0x39dc('0x27')]);}logger[_0x39dc('0x25')]('SmsMessage,\x20%s,\x20%s',_0x2d1a5d,_0x674008['error']['message']);return _0x40a441(_0x674008[_0x39dc('0x25')]['message']);}else{logger[_0x39dc('0x28')]('SmsMessage,\x20%s,\x20%s',_0x2d1a5d,_0x39dc('0x23'));_0x40a441(_0x674008[_0x39dc('0x29')][_0x39dc('0x27')]);}})[_0x39dc('0x2a')](function(_0x2f8319){logger[_0x39dc('0x25')](_0x39dc('0x22'),_0x2d1a5d,_0x2f8319);_0x60b474(_0x2f8319);});});}function respondWithStatusCode(_0x43968e,_0x1eb9b2){_0x1eb9b2=_0x1eb9b2||0xcc;return function(_0x2c4121){if(_0x2c4121){return _0x43968e[_0x39dc('0x2b')](_0x1eb9b2);}return _0x43968e[_0x39dc('0x2c')](_0x1eb9b2)[_0x39dc('0x2d')]();};}function respondWithResult(_0x1cee9f,_0x1de417){_0x1de417=_0x1de417||0xc8;return function(_0x44fe64){if(_0x44fe64){return _0x1cee9f[_0x39dc('0x2c')](_0x1de417)[_0x39dc('0x2e')](_0x44fe64);}};}function respondWithFilteredResult(_0x3dcaa9,_0x8e4666){return function(_0x50d6f7){if(_0x50d6f7){var _0x5e1c36=_0x50d6f7[_0x39dc('0x2f')],_0xf7367d=_0x8e4666[_0x39dc('0x30')],_0x48084d=_0x8e4666['offset']+_0x8e4666[_0x39dc('0x31')],_0x4f65ac;if(_0x48084d>=_0x5e1c36){_0x48084d=_0x5e1c36;_0x4f65ac=0xc8;}else{_0x4f65ac=0xce;}_0x3dcaa9[_0x39dc('0x2c')](_0x4f65ac);return _0x3dcaa9[_0x39dc('0x32')](_0x39dc('0x33'),_0xf7367d+'-'+_0x48084d+'/'+_0x5e1c36)['json'](_0x50d6f7);}return null;};}function patchUpdates(_0x47bbf5){return function(_0x4ee0d3){try{jsonpatch[_0x39dc('0x34')](_0x4ee0d3,_0x47bbf5,!![]);}catch(_0x4de211){return BPromise[_0x39dc('0x35')](_0x4de211);}return _0x4ee0d3[_0x39dc('0x36')]();};}function saveUpdates(_0x36f48b,_0x20b983){return function(_0x29f97c){if(_0x29f97c){return _0x29f97c[_0x39dc('0x37')](_0x36f48b)[_0x39dc('0x38')](function(_0x3db8f3){return _0x3db8f3;});}return null;};}function removeEntity(_0x3f6287,_0x41736e){return function(_0x44ffc4){if(_0x44ffc4){return _0x44ffc4[_0x39dc('0x39')]()['then'](function(){_0x3f6287['status'](0xcc)[_0x39dc('0x2d')]();});}};}function handleEntityNotFound(_0x496f11,_0x5429ef){return function(_0x1dfcbd){if(!_0x1dfcbd){_0x496f11[_0x39dc('0x2b')](0x194);}return _0x1dfcbd;};}function handleError(_0x5692df,_0x3dbb92){_0x3dbb92=_0x3dbb92||0x1f4;return function(_0x550513){logger['error'](_0x550513['stack']);if(_0x550513[_0x39dc('0x3a')]){delete _0x550513[_0x39dc('0x3a')];}_0x5692df[_0x39dc('0x2c')](_0x3dbb92)['send'](_0x550513);};}exports[_0x39dc('0x3b')]=function(_0x159a34,_0x5e32be){var _0x363c5c={},_0x1092c1={},_0x1dee71={'count':0x0,'rows':[]};var _0x56e35f=_['map'](db['SmsMessage'][_0x39dc('0x3c')],function(_0xd6fdb1){return{'name':_0xd6fdb1[_0x39dc('0x3d')],'type':_0xd6fdb1['type'][_0x39dc('0x3e')]};});_0x1092c1[_0x39dc('0x3f')]=_[_0x39dc('0x40')](_0x56e35f,_0x39dc('0x3a'));_0x1092c1[_0x39dc('0x41')]=_[_0x39dc('0x42')](_0x159a34[_0x39dc('0x41')]);_0x1092c1['filters']=_[_0x39dc('0x43')](_0x1092c1['model'],_0x1092c1[_0x39dc('0x41')]);_0x363c5c[_0x39dc('0x44')]=_[_0x39dc('0x43')](_0x1092c1['model'],qs[_0x39dc('0x45')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x45')]));_0x363c5c[_0x39dc('0x44')]=_0x363c5c['attributes'][_0x39dc('0x46')]?_0x363c5c[_0x39dc('0x44')]:_0x1092c1[_0x39dc('0x3f')];if(!_0x159a34[_0x39dc('0x41')][_0x39dc('0x47')](_0x39dc('0x48'))){_0x363c5c[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x31')]);_0x363c5c[_0x39dc('0x30')]=qs[_0x39dc('0x30')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x30')]);}_0x363c5c['order']=qs[_0x39dc('0x49')](_0x159a34[_0x39dc('0x41')][_0x39dc('0x49')]);_0x363c5c[_0x39dc('0x4a')]=qs[_0x39dc('0x4b')](_[_0x39dc('0x4c')](_0x159a34[_0x39dc('0x41')],_0x1092c1['filters']),_0x56e35f);if(_0x159a34[_0x39dc('0x41')]['filter']){_0x363c5c[_0x39dc('0x4a')]=_[_0x39dc('0x4d')](_0x363c5c['where'],{'$or':_[_0x39dc('0x40')](_0x56e35f,function(_0x427fa5){if(_0x427fa5[_0x39dc('0x4e')]!==_0x39dc('0x4f')){var _0xd34a0c={};_0xd34a0c[_0x427fa5[_0x39dc('0x3a')]]={'$like':'%'+_0x159a34[_0x39dc('0x41')][_0x39dc('0x50')]+'%'};return _0xd34a0c;}})});}_0x363c5c=_['merge']({},_0x363c5c,_0x159a34['options']);var _0x2c25e7={'where':_0x363c5c[_0x39dc('0x4a')]};return db[_0x39dc('0x51')][_0x39dc('0x2f')](_0x2c25e7)['then'](function(_0xaa2e7d){_0x1dee71[_0x39dc('0x2f')]=_0xaa2e7d;if(_0x159a34['query']['includeAll']){_0x363c5c[_0x39dc('0x52')]=[{'all':!![]}];}return db[_0x39dc('0x51')][_0x39dc('0x53')](_0x363c5c);})[_0x39dc('0x38')](function(_0x43b87c){_0x1dee71['rows']=_0x43b87c;return _0x1dee71;})[_0x39dc('0x38')](respondWithFilteredResult(_0x5e32be,_0x363c5c))[_0x39dc('0x2a')](handleError(_0x5e32be,null));};exports[_0x39dc('0x54')]=function(_0x272c54,_0x3eae5a){var _0x42e781={'raw':!![],'where':{'id':_0x272c54['params']['id']}},_0x1a995e={};_0x1a995e[_0x39dc('0x3f')]=_[_0x39dc('0x42')](db[_0x39dc('0x51')]['rawAttributes']);_0x1a995e[_0x39dc('0x41')]=_['keys'](_0x272c54[_0x39dc('0x41')]);_0x1a995e[_0x39dc('0x4b')]=_['intersection'](_0x1a995e[_0x39dc('0x3f')],_0x1a995e[_0x39dc('0x41')]);_0x42e781['attributes']=_[_0x39dc('0x43')](_0x1a995e['model'],qs[_0x39dc('0x45')](_0x272c54[_0x39dc('0x41')][_0x39dc('0x45')]));_0x42e781[_0x39dc('0x44')]=_0x42e781[_0x39dc('0x44')][_0x39dc('0x46')]?_0x42e781['attributes']:_0x1a995e['model'];if(_0x272c54[_0x39dc('0x41')][_0x39dc('0x55')]){_0x42e781[_0x39dc('0x52')]=[{'all':!![]}];}_0x42e781=_[_0x39dc('0x4d')]({},_0x42e781,_0x272c54['options']);return db[_0x39dc('0x51')][_0x39dc('0x56')](_0x42e781)[_0x39dc('0x38')](handleEntityNotFound(_0x3eae5a,null))[_0x39dc('0x38')](respondWithResult(_0x3eae5a,null))[_0x39dc('0x2a')](handleError(_0x3eae5a,null));};exports[_0x39dc('0x57')]=function(_0x18813d,_0x41c5de){return db[_0x39dc('0x51')]['create'](_0x18813d[_0x39dc('0x58')],{})['then'](respondWithResult(_0x41c5de,0xc9))['catch'](handleError(_0x41c5de,null));};exports['update']=function(_0x433890,_0x3d5ca4){if(_0x433890[_0x39dc('0x58')]['id']){delete _0x433890[_0x39dc('0x58')]['id'];}return db[_0x39dc('0x51')]['find']({'where':{'id':_0x433890[_0x39dc('0x59')]['id']}})[_0x39dc('0x38')](handleEntityNotFound(_0x3d5ca4,null))[_0x39dc('0x38')](saveUpdates(_0x433890['body'],null))['then'](respondWithResult(_0x3d5ca4,null))[_0x39dc('0x2a')](handleError(_0x3d5ca4,null));};exports[_0x39dc('0x39')]=function(_0x164bec,_0x2728dd){return db['SmsMessage'][_0x39dc('0x56')]({'where':{'id':_0x164bec[_0x39dc('0x59')]['id']}})[_0x39dc('0x38')](handleEntityNotFound(_0x2728dd,null))['then'](removeEntity(_0x2728dd,null))['catch'](handleError(_0x2728dd,null));};exports['describe']=function(_0x5fbb15,_0x576178){return db[_0x39dc('0x51')][_0x39dc('0x5a')]()[_0x39dc('0x38')](respondWithResult(_0x576178,null))[_0x39dc('0x2a')](handleError(_0x576178,null));};var interaction_log=require(_0x39dc('0x16'))(_0x39dc('0x5b'));exports[_0x39dc('0x5c')]=function(_0x1a9048,_0x4d60d7,_0x811a30){var _0x21193d={'channel':_0x39dc('0x5d')};if(_0x1a9048[_0x39dc('0x58')]['id']){delete _0x1a9048['body']['id'];}_0x1a9048[_0x39dc('0x58')][_0x39dc('0x5e')]=!![];_0x1a9048['body'][_0x39dc('0x5f')]=moment()[_0x39dc('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a9048[_0x39dc('0x58')][_0x39dc('0x61')]=_0x1a9048[_0x39dc('0x58')][_0x39dc('0x61')]||_0x1a9048[_0x39dc('0x62')]['id'];return db[_0x39dc('0x51')][_0x39dc('0x56')]({'where':{'id':_0x1a9048[_0x39dc('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x39dc('0x38')](handleEntityNotFound(_0x4d60d7,null))['then'](saveUpdates(_0x1a9048['body'],null))[_0x39dc('0x38')](function(_0x438697){if(_0x438697){_0x21193d[_0x39dc('0x27')]=_0x438697['get']({'plain':!![]});return db[_0x39dc('0x63')][_0x39dc('0x56')]({'where':{'id':_0x438697[_0x39dc('0x64')]}});}return null;})[_0x39dc('0x38')](handleEntityNotFound(_0x4d60d7,null))[_0x39dc('0x38')](function(_0x5bca81){if(_0x5bca81){return _0x5bca81[_0x39dc('0x37')]({'UserId':_0x1a9048[_0x39dc('0x58')][_0x39dc('0x61')],'read1stAt':_[_0x39dc('0x65')](_0x5bca81[_0x39dc('0x66')])?moment()[_0x39dc('0x60')](_0x39dc('0x67')):undefined});}return null;})[_0x39dc('0x38')](function(_0x459387){if(_0x459387){_0x21193d[_0x39dc('0x68')]=_0x459387[_0x39dc('0x69')]({'plain':!![]});interaction_log[_0x39dc('0x28')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a9048[_0x39dc('0x62')]['id'],_0x1a9048[_0x39dc('0x62')][_0x39dc('0x3a')],_0x1a9048[_0x39dc('0x62')][_0x39dc('0x6a')],_0x21193d[_0x39dc('0x68')]['id'],_0x1a9048[_0x39dc('0x58')]?JSON['stringify'](_0x1a9048[_0x39dc('0x58')]):_0x39dc('0x6b'));return respondWithRpcPromise(_0x39dc('0x6c'),_0x39dc('0x6d'),_0x21193d);}return null;})[_0x39dc('0x38')](function(_0x19fa49){if(_0x19fa49){if(_0x1a9048[_0x39dc('0x58')][_0x39dc('0x6e')]){_0x21193d[_0x39dc('0x27')]['interface']=util['format'](_0x39dc('0x6f'),_0x1a9048[_0x39dc('0x62')]['name']);_0x21193d[_0x39dc('0x27')][_0x39dc('0x70')]=_0x21193d[_0x39dc('0x70')];_0x21193d[_0x39dc('0x27')]['event']=_0x39dc('0x5c');return respondWithRpcPromise(_0x39dc('0x71'),_0x39dc('0x71'),{'event':_0x39dc('0x72'),'message':_0x21193d[_0x39dc('0x27')]},client9002)[_0x39dc('0x38')](function(){return _0x21193d;});}return _0x21193d;}return null;})[_0x39dc('0x38')](respondWithResult(_0x4d60d7,null))['catch'](handleError(_0x4d60d7,null));};var interaction_log=require(_0x39dc('0x16'))(_0x39dc('0x5b'));exports[_0x39dc('0x35')]=function(_0x732801,_0x171e7e,_0x5ea3a7){var _0x5ddbc2={'agent':{},'channel':_0x39dc('0x5d')};if(_0x732801[_0x39dc('0x58')]['id']){delete _0x732801[_0x39dc('0x58')]['id'];}_0x732801[_0x39dc('0x58')]['UserId']=_0x732801['body']['UserId']||_0x732801[_0x39dc('0x62')]['id'];_0x5ddbc2['agent']['id']=_0x732801[_0x39dc('0x58')][_0x39dc('0x61')];return db['SmsMessage'][_0x39dc('0x56')]({'where':{'id':_0x732801['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x171e7e,null))[_0x39dc('0x38')](function(_0x11e798){if(_0x11e798){_0x5ddbc2[_0x39dc('0x27')]=_0x11e798[_0x39dc('0x69')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x11e798['SmsInteractionId']}});}return null;})[_0x39dc('0x38')](handleEntityNotFound(_0x171e7e,null))[_0x39dc('0x38')](function(_0x469a2d){if(_0x469a2d){_0x5ddbc2['interaction']=_0x469a2d['get']({'plain':!![]});interaction_log[_0x39dc('0x28')](_0x39dc('0x73'),_0x732801[_0x39dc('0x62')]['id'],_0x732801[_0x39dc('0x62')][_0x39dc('0x3a')],_0x732801[_0x39dc('0x62')][_0x39dc('0x6a')],_0x5ddbc2[_0x39dc('0x68')]['id'],_0x732801[_0x39dc('0x58')]?JSON[_0x39dc('0x24')](_0x732801[_0x39dc('0x58')]):_0x39dc('0x6b'));return respondWithRpcPromise('RejectMessage',_0x39dc('0x74'),_0x5ddbc2);}return null;})['then'](function(_0x3d8d44){if(_0x3d8d44){_0x3d8d44[_0x39dc('0x27')][_0x39dc('0x75')]=util[_0x39dc('0x60')](_0x39dc('0x6f'),_0x732801['user']['name']);_0x3d8d44[_0x39dc('0x27')][_0x39dc('0x70')]=_0x5ddbc2[_0x39dc('0x70')];_0x3d8d44[_0x39dc('0x27')][_0x39dc('0x76')]='reject';respondWithRpcPromise(_0x39dc('0x71'),_0x39dc('0x71'),{'event':'rejectmessage','message':_0x3d8d44['message']},client9002);return _0x5ddbc2;}return null;})[_0x39dc('0x38')](respondWithResult(_0x171e7e,null))['catch'](handleError(_0x171e7e,null));};exports[_0x39dc('0x2c')]=function(_0x4f608c,_0x4bf7f6,_0x7b441f){if(_0x4f608c[_0x39dc('0x58')]['id']){delete _0x4f608c[_0x39dc('0x58')]['id'];}var _0x212bcd;return db['SmsMessage'][_0x39dc('0x56')]({'where':{'id':_0x4f608c[_0x39dc('0x59')]['id']}})['then'](handleEntityNotFound(_0x4bf7f6,null))[_0x39dc('0x38')](function(_0x3c6b20){if(_0x3c6b20){_0x212bcd=_0x3c6b20;return db['SmsAccount'][_0x39dc('0x56')]({'where':{'id':_0x3c6b20['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x4bf7f6,null))['then'](function(_0x141a54){if(_0x141a54){logger[_0x39dc('0x77')](_0x39dc('0x78'),_0x39dc('0x2c'),'received\x20delivery\x20report\x20from',_0x141a54[_0x39dc('0x4e')],util[_0x39dc('0x79')](_0x4f608c[_0x39dc('0x58')],{'showHidden':![],'depth':null}));switch(_0x141a54[_0x39dc('0x4e')]){case _0x39dc('0x7a'):if(_0x4f608c[_0x39dc('0x58')][_0x39dc('0x7b')]&&_0x4f608c[_0x39dc('0x58')]['MessageSid']===_0x212bcd[_0x39dc('0x7c')]){return _0x212bcd[_0x39dc('0x37')]({'read':!![]});}else{logger['error'](_0x39dc('0x7d'),_0x39dc('0x2c'),_0x39dc('0x7a'),util[_0x39dc('0x79')](_0x4f608c[_0x39dc('0x58')],{'showHidden':![],'depth':null}));}break;case _0x39dc('0x7e'):if(_0x4f608c[_0x39dc('0x58')][_0x39dc('0x7f')]&&_0x4f608c['body']['MessageUUID']===_0x212bcd[_0x39dc('0x7c')]&&_[_0x39dc('0x80')](['sent','delivered'],_0x4f608c['body']['Status'])>=0x0){return _0x212bcd[_0x39dc('0x37')]({'read':!![]});}else{logger[_0x39dc('0x25')](_0x39dc('0x7d'),_0x39dc('0x2c'),'plivio',util[_0x39dc('0x79')](_0x4f608c[_0x39dc('0x58')],{'showHidden':![],'depth':null}));}break;case _0x39dc('0x81'):var _0x3c1e39=_0x4f608c[_0x39dc('0x58')]['results'][0x0];if(_0x3c1e39['status'][_0x39dc('0x82')]===_0x39dc('0x83')){return _0x212bcd[_0x39dc('0x37')]({'read':!![]});}else{logger[_0x39dc('0x25')](_0x39dc('0x7d'),_0x39dc('0x2c'),'infobip',util['inspect'](_0x4f608c['body'],{'showHidden':![],'depth':null}));}break;}return _0x212bcd;}})[_0x39dc('0x38')](respondWithResult(_0x4bf7f6,null))[_0x39dc('0x2a')](handleError(_0x4bf7f6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 88e38e4..e6c69f2 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 _0x456e=['hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x456e,0x135));var _0xe456=function(_0x3b6e85,_0x1faf1a){_0x3b6e85=_0x3b6e85-0x0;var _0x373c4c=_0x456e[_0x3b6e85];return _0x373c4c;};'use strict';var EventEmitter=require(_0xe456('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xe456('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe456('0x2')](0x0);var events={'afterCreate':_0xe456('0x3'),'afterUpdate':_0xe456('0x4'),'afterDestroy':'remove'};function emitEvent(_0x124334){return function(_0x242a8f,_0x4f88d4,_0x35bfe9){SmsMessageEvents[_0xe456('0x5')](_0x124334+':'+_0x242a8f['id'],_0x242a8f);SmsMessageEvents[_0xe456('0x5')](_0x124334,_0x242a8f);_0x35bfe9(null);};}for(var e in events){if(events[_0xe456('0x6')](e)){var event=events[e];SmsMessage[_0xe456('0x7')](e,emitEvent(event));}}module[_0xe456('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x1b9c=['../../mysqldb','SmsMessage','update','emit','hook'];(function(_0xffa29a,_0x4c671e){var _0x2875c2=function(_0x40eca2){while(--_0x40eca2){_0xffa29a['push'](_0xffa29a['shift']());}};_0x2875c2(++_0x4c671e);}(_0x1b9c,0x15e));var _0xc1b9=function(_0x1e4433,_0x137702){_0x1e4433=_0x1e4433-0x0;var _0x47a678=_0x1b9c[_0x1e4433];return _0x47a678;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xc1b9('0x0'))['db'][_0xc1b9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1b9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5bf234){return function(_0x5d84f2,_0xbc1c14,_0x2d08e3){SmsMessageEvents[_0xc1b9('0x3')](_0x5bf234+':'+_0x5d84f2['id'],_0x5d84f2);SmsMessageEvents[_0xc1b9('0x3')](_0x5bf234,_0x5d84f2);_0x2d08e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xc1b9('0x4')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 509ab2c..ed668f8 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 _0x72cd=['Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','intelepeer','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','phone','messages','body','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','base64','http_code','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid'];(function(_0xe4574f,_0x1d06ea){var _0x248a50=function(_0x278d9a){while(--_0x278d9a){_0xe4574f['push'](_0xe4574f['shift']());}};_0x248a50(++_0x1d06ea);}(_0x72cd,0x107));var _0xd72c=function(_0x51db12,_0x3a006e){_0x51db12=_0x51db12-0x0;var _0x3301b5=_0x72cd[_0x51db12];return _0x3301b5;};'use strict';var _=require(_0xd72c('0x0'));var util=require(_0xd72c('0x1'));var logger=require(_0xd72c('0x2'))('api');var moment=require(_0xd72c('0x3'));var BPromise=require(_0xd72c('0x4'));var rp=require(_0xd72c('0x5'));var fs=require('fs');var path=require(_0xd72c('0x6'));var rimraf=require(_0xd72c('0x7'));var config=require(_0xd72c('0x8'));var attributes=require(_0xd72c('0x9'));module[_0xd72c('0xa')]=function(_0x15f1ad,_0x40f7f5){return _0x15f1ad['define'](_0xd72c('0xb'),attributes,{'tableName':_0xd72c('0xc'),'paranoid':![],'indexes':[{'name':_0xd72c('0xd'),'fields':[_0xd72c('0xd')]},{'name':'fti_sms_messages','fields':['body'],'type':_0xd72c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4201f6,_0x17e930,_0x3c19fe){var _0x54f738=_0x15f1ad[_0xd72c('0xf')];var _0x3ef526=_0x4201f6['get']({'plain':!![]});if(_0x3ef526['direction'][_0xd72c('0x10')]()==='in'||_0x3ef526[_0xd72c('0x11')]['toLowerCase']()===_0xd72c('0x12')&&!_0x3ef526[_0xd72c('0x13')]&&!_[_0xd72c('0x14')](_0x3ef526[_0xd72c('0x15')])){_0x54f738['SmsInteraction'][_0xd72c('0x16')]({'where':{'id':_0x3ef526[_0xd72c('0x17')]}})['then'](function(_0x5b8067){if(_0x5b8067){_0x5b8067[_0xd72c('0x18')]({'lastMsgAt':_0x3ef526[_0xd72c('0x19')],'lastMsgDirection':_0x3ef526[_0xd72c('0x11')][_0xd72c('0x10')]()});}})[_0xd72c('0x1a')](function(_0x489959){console[_0xd72c('0x1b')](_0x489959);});}if(_0x3ef526['direction']===_0xd72c('0x12')&&!_0x3ef526['secret']){var _0x1a8d5a;_0x54f738[_0xd72c('0x1c')][_0xd72c('0x1d')]({'where':{'id':_0x3ef526[_0xd72c('0x1e')]},'raw':!![]})[_0xd72c('0x1f')](function(_0x2d9c80){_0x1a8d5a=_0x2d9c80;if(_0x1a8d5a&&_0x1a8d5a[_0xd72c('0x20')]){switch(_0x1a8d5a[_0xd72c('0x20')]){case _0xd72c('0x21'):var _0x1d733f=require(_0xd72c('0x21'));if(_0x1a8d5a[_0xd72c('0x22')]&&_0x1a8d5a['authToken']&&_0x1a8d5a[_0xd72c('0x23')]){var _0x517931=new _0x1d733f(_0x1a8d5a[_0xd72c('0x22')],_0x1a8d5a['authToken']);_0x517931[_0xd72c('0x24')]['create']({'body':_0x3ef526[_0xd72c('0x25')],'to':_0x3ef526[_0xd72c('0x23')],'from':_0x1a8d5a[_0xd72c('0x23')],'statusCallback':_0x1a8d5a[_0xd72c('0x26')]+'/api/sms/messages/'+_0x3ef526['id']+'/status?token='+_0x1a8d5a[_0xd72c('0x27')]})[_0xd72c('0x1f')](function(_0x1ce36f){if(_0x1ce36f[_0xd72c('0x28')]){return _0x4201f6[_0xd72c('0x18')]({'messageId':_0x1ce36f[_0xd72c('0x28')]});}})[_0xd72c('0x1a')](function(_0x4f0f18){logger['error'](_0xd72c('0x29'),'afterCreate','twilio',util[_0xd72c('0x2a')](_0x4f0f18,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x21'),_0xd72c('0x2c'));}break;case _0xd72c('0x2d'):var _0x780bc0=_0xd72c('0x2e');if(_0x1a8d5a[_0xd72c('0x2f')]&&_0x1a8d5a[_0xd72c('0x30')]){var _0x3f2538={'recipient':[_0x3ef526[_0xd72c('0x23')]],'message':_0x3ef526[_0xd72c('0x25')],'message_type':_0x1a8d5a[_0xd72c('0x31')]};if(_0x1a8d5a[_0xd72c('0x31')]&&_0x1a8d5a['smsMethod']!=='SI'){_0x3f2538[_0xd72c('0x32')]=_0x1a8d5a[_0xd72c('0x23')];}var _0x4a12d6={'url':_0x780bc0+'login?username='+_0x1a8d5a[_0xd72c('0x2f')]+_0xd72c('0x33')+_0x1a8d5a['password'],'method':_0xd72c('0x34')};rp(_0x4a12d6)['then'](function(_0xb89609){var _0x4f03b6=_0xb89609[_0xd72c('0x35')](';');var _0xcee45c={'user_key':_0x4f03b6[0x0],'session_key':_0x4f03b6[0x1]};_0x4a12d6={'url':_0x780bc0+_0xd72c('0x36'),'method':_0xd72c('0x37'),'headers':{'user_key':_0xcee45c[_0xd72c('0x38')],'Session_key':_0xcee45c['session_key']},'json':!![],'body':_0x3f2538};return rp(_0x4a12d6);})[_0xd72c('0x1f')](function(_0x146d58){if(_0x146d58[_0xd72c('0x39')]>=0x1){var _0x7fe98e={'messageId':_0x146d58[_0xd72c('0x3a')]};if(_0x1a8d5a[_0xd72c('0x31')]!=='GP'||!_0x1a8d5a[_0xd72c('0x3b')]){_0x7fe98e[_0xd72c('0x3c')]=!![];}return _0x4201f6[_0xd72c('0x18')](_0x7fe98e);}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),'afterCreate',_0xd72c('0x2d'),util[_0xd72c('0x2a')](_0x146d58,{'showHidden':![],'depth':null}));}})[_0xd72c('0x1a')](function(_0x438c94){return logger['error'](_0xd72c('0x29'),'afterCreate','skebby',util[_0xd72c('0x2a')](_0x438c94,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x2d'),_0xd72c('0x3d'));}break;case _0xd72c('0x3e'):if(_0x1a8d5a[_0xd72c('0x3f')]){var _0x2a9291={'recipient':_0x3ef526[_0xd72c('0x23')],'message':_0x3ef526[_0xd72c('0x25')],'sender':_0x1a8d5a[_0xd72c('0x40')]||_0x1a8d5a[_0xd72c('0x23')],'authorization':_0x1a8d5a['authToken']};var _0x17e930={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2a9291,'json':!![]};rp(_0x17e930)['then'](function(_0x547ed0){var _0x48e439={'messageId':_0x547ed0[_0xd72c('0x41')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x48e439['read']=!![];}return _0x4201f6[_0xd72c('0x18')](_0x48e439);})[_0xd72c('0x1a')](function(_0x2eb454){logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x3e'),util[_0xd72c('0x2a')](_0x2eb454,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x3e'),_0xd72c('0x42'));}break;case _0xd72c('0x43'):if(_0x1a8d5a[_0xd72c('0x2f')]&&_0x1a8d5a['password']){var _0x2a9291={'messages':[{'source':_0xd72c('0x44'),'to':_0x3ef526[_0xd72c('0x23')],'body':_0x3ef526[_0xd72c('0x25')],'from':_0x1a8d5a['senderString']||_0x1a8d5a[_0xd72c('0x23')]}]};var _0x2f2def=util['format'](_0xd72c('0x45'),_0x1a8d5a[_0xd72c('0x2f')],_0x1a8d5a[_0xd72c('0x30')]);var _0x17e930={'method':_0xd72c('0x37'),'uri':_0xd72c('0x46'),'body':_0x2a9291,'headers':{'Authorization':util[_0xd72c('0x47')]('Basic\x20%s',new Buffer(_0x2f2def)['toString'](_0xd72c('0x48')))},'json':!![]};rp(_0x17e930)[_0xd72c('0x1f')](function(_0x38aafa){if(_0x38aafa[_0xd72c('0x49')]>=0xc8&&_0x38aafa[_0xd72c('0x49')]<=0xce){if(_0x38aafa['data']&&_0x38aafa['data'][_0xd72c('0x4a')]>0x0){var _0x37c0fc=_[_0xd72c('0x4b')](_0x38aafa['data'][_0xd72c('0x24')]);var _0x427ae9={'messageId':_0x37c0fc[_0xd72c('0x4c')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x427ae9[_0xd72c('0x3c')]=!![];}return _0x4201f6['update'](_0x427ae9);}else{logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x4d'),util['inspect'](_0x38aafa,{'showHidden':![],'depth':null}));}}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x4d'),util[_0xd72c('0x2a')](_0x38aafa,{'showHidden':![],'depth':null}));}})[_0xd72c('0x1a')](function(_0x13bc1f){logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x4d'),util[_0xd72c('0x2a')](_0x13bc1f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xd72c('0x4e'):if(_0x1a8d5a[_0xd72c('0x4f')]&&_0x1a8d5a[_0xd72c('0x3f')]){var _0x2a9291={'dst':_0x3ef526[_0xd72c('0x23')],'text':_0x3ef526[_0xd72c('0x25')],'src':_0x1a8d5a[_0xd72c('0x40')]||_0x1a8d5a[_0xd72c('0x23')],'url':_0x1a8d5a['remote']+_0xd72c('0x50')+_0x3ef526['id']+_0xd72c('0x51')+_0x1a8d5a['token']};var _0x2f2def=util[_0xd72c('0x47')]('%s:%s',_0x1a8d5a[_0xd72c('0x4f')],_0x1a8d5a[_0xd72c('0x3f')]);var _0x17e930={'method':_0xd72c('0x37'),'uri':util[_0xd72c('0x47')](_0xd72c('0x52'),_0x1a8d5a[_0xd72c('0x4f')]),'body':_0x2a9291,'headers':{'Authorization':util[_0xd72c('0x47')]('Basic\x20%s',new Buffer(_0x2f2def)[_0xd72c('0x53')](_0xd72c('0x48')))},'json':!![]};rp(_0x17e930)[_0xd72c('0x1f')](function(_0x9bf47c){var _0x5c4041={'messageId':_0x9bf47c[_0xd72c('0x54')][0x0]};return _0x4201f6['update'](_0x5c4041);})['catch'](function(_0x5d86f5){logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x4e'),util[_0xd72c('0x2a')](_0x5d86f5,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x4e'),_0xd72c('0x55'));}break;case _0xd72c('0x56'):if(_0x1a8d5a[_0xd72c('0x2f')]&&_0x1a8d5a[_0xd72c('0x30')]){if(_0x1a8d5a['baseUrl']){var _0x269e20={'method':'POST','uri':_0x1a8d5a[_0xd72c('0x57')]+_0xd72c('0x58'),'body':{'username':_0x1a8d5a[_0xd72c('0x2f')],'password':_0x1a8d5a[_0xd72c('0x30')]},'json':!![]};return rp(_0x269e20)[_0xd72c('0x1f')](function(_0x1f873e){var _0x59016d={'method':_0xd72c('0x37'),'uri':_0x1a8d5a[_0xd72c('0x57')]+_0xd72c('0x59'),'body':{'messages':[{'from':_0x1a8d5a[_0xd72c('0x23')],'destinations':[{'to':_0x3ef526[_0xd72c('0x23')]}],'text':_0x3ef526[_0xd72c('0x25')],'notifyUrl':_0x1a8d5a[_0xd72c('0x26')]+_0xd72c('0x50')+_0x3ef526['id']+_0xd72c('0x51')+_0x1a8d5a[_0xd72c('0x27')],'notifyContentType':'application/json','callbackData':_0x1a8d5a['phone']+';'+_0x3ef526[_0xd72c('0x25')]}]},'headers':{'Authorization':_0xd72c('0x5a')+_0x1f873e['token']},'json':!![]};return rp(_0x59016d)[_0xd72c('0x1f')](function(_0x3caac3){if(_0x3caac3[_0xd72c('0x24')]){var _0x2a5856={'messageId':_0x3caac3['messages'][0x0][_0xd72c('0xd')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x2a5856[_0xd72c('0x3c')]=!![];}return _0x4201f6[_0xd72c('0x18')](_0x2a5856);}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'infobip',util[_0xd72c('0x2a')](_0x3caac3,{'showHidden':![],'depth':null}));}});})[_0xd72c('0x1a')](function(_0x30abbc){return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'infobip',util[_0xd72c('0x2a')](_0x30abbc,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'infobip',_0xd72c('0x3d'));}break;case _0xd72c('0x5b'):var _0x31846a=require(_0xd72c('0x5c'));if(_0x1a8d5a[_0xd72c('0x5d')]){var _0x351776={};_0x351776[_0xd72c('0x5e')]=_0x1a8d5a[_0xd72c('0x2f')];_0x351776['phone']=_0x3ef526['phone'];_0x351776[_0xd72c('0x32')]=_0x1a8d5a[_0xd72c('0x23')];_0x351776['text']=_0x3ef526['body'];_0x351776[_0xd72c('0x5f')]=+new Date();var _0xbd640e='';var _0x35af33='';var _0xde7886=Object[_0xd72c('0x60')](_0x351776);_0xde7886[_0xd72c('0x61')]();for(var _0x12a137=0x0;_0x12a137<_0xde7886['length'];_0x12a137++){if(_0xbd640e!=''){_0xbd640e+='&';}_0xbd640e+=_0xde7886[_0x12a137]+'='+encodeURIComponent(_0x351776[_0xde7886[_0x12a137]]);_0x35af33+=_0x351776[_0xde7886[_0x12a137]];}_0x35af33+=_0x1a8d5a[_0xd72c('0x5d')];_0x35af33=_0x31846a[_0xd72c('0x62')]('md5')[_0xd72c('0x18')](_0x35af33)['digest'](_0xd72c('0x63'));if(_0xbd640e!==''){_0xbd640e+='&';}_0xbd640e+='signature='+_0x35af33;var _0x4a12d6={'method':_0xd72c('0x34'),'uri':_0x1a8d5a[_0xd72c('0x57')]+_0xd72c('0x64')+_0xbd640e,'json':!![]};return rp(_0x4a12d6)[_0xd72c('0x1f')](function(_0x1d606d){var _0x33caa6=Object[_0xd72c('0x60')](_0x1d606d);if(_0x1d606d[_0x33caa6[0x0]]['error']&&parseInt(_0x1d606d[_0x33caa6[0x0]][_0xd72c('0x1b')])===0x0){var _0x4f70e4={'messageId':_0x1d606d[_0x33caa6[0x0]][_0xd72c('0x65')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x4f70e4['read']=!![];}return _0x4201f6['update'](_0x4f70e4);}else{return logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x5b'),util[_0xd72c('0x2a')](_0x1d606d[_0xd72c('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x58a2ca){return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x5b'),util['inspect'](_0x58a2ca,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x5b'),_0xd72c('0x66'));}break;case _0xd72c('0x67'):if(_0x1a8d5a[_0xd72c('0x5d')]){var _0x217129={'method':_0xd72c('0x37'),'uri':_0xd72c('0x68'),'headers':{'Authorization':_0x1a8d5a[_0xd72c('0x5d')]},'body':{'content':_0x3ef526['body'],'to':[_0x3ef526[_0xd72c('0x23')]],'from':_0x1a8d5a[_0xd72c('0x23')],'binary':![],'clientMessageId':_0xd72c('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x217129)[_0xd72c('0x1f')](function(_0x5cb2dd){if(!_0x5cb2dd[_0xd72c('0x1b')]){var _0x4df1a0={'messageId':_0x5cb2dd[_0xd72c('0x24')][0x0]['apiMessageId']};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x4df1a0[_0xd72c('0x3c')]=!![];}return _0x4201f6[_0xd72c('0x18')](_0x4df1a0);}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x67'),util[_0xd72c('0x2a')](_0x5cb2dd['error'],{'showHidden':![],'depth':null}));}})[_0xd72c('0x1a')](function(_0x39434c){return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'clickatell',util[_0xd72c('0x2a')](_0x39434c,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd72c('0x67'),_0xd72c('0x66'));}break;case _0xd72c('0x6a'):if(_0x1a8d5a[_0xd72c('0x5d')]){var _0x180845={};var _0x4a12d6={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xd72c('0x6b')+_0x1a8d5a['apiKey'],'Content-Type':_0xd72c('0x6c')},'body':{'from':_0x1a8d5a[_0xd72c('0x23')],'to':_0x3ef526['phone'],'text':_0x3ef526[_0xd72c('0x25')]},'json':!![]};return rp(_0x4a12d6)['then'](function(_0x28afc0){if(_0x28afc0[_0xd72c('0x6d')]==0xca){_0x180845['message']=_0x28afc0;var _0x1a845e={'method':_0xd72c('0x37'),'uri':_0xd72c('0x6e'),'headers':{'Authorization':_0xd72c('0x6b')+_0x1a8d5a[_0xd72c('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x180845[_0xd72c('0x6f')][_0xd72c('0x70')]},'json':!![]};return rp(_0x1a845e)['then'](function(_0x2f293a){_0x180845['status']=_0x2f293a;var _0x9ba2a3={'messageId':_0x180845[_0xd72c('0x6f')]['refid'],'read':!![]};return _0x4201f6[_0xd72c('0x18')](_0x9ba2a3);});}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x6a'),util['inspect'](_0x28afc0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1f0a56){return logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),'intelepeer',util[_0xd72c('0x2a')](_0x1f0a56,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd72c('0x29'),'afterCreate',_0xd72c('0x6a'),'Token\x20not\x20received');}break;}}})[_0xd72c('0x71')](function(){_0x3c19fe();});}else{_0x3c19fe();}}},'charset':_0xd72c('0x72'),'collate':_0xd72c('0x73')});}; \ No newline at end of file +var _0xc2b7=['base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','POST','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','fti_sms_messages','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','find','type','twilio','authToken','create','body','phone','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','&password=','sms','user_key','session_key','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','then','requestid','deliveryReport','connectel','xCALLY\x20Motion','format','%s:%s','username','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2b7,0x119));var _0x7c2b=function(_0x3c21ba,_0x5f2565){_0x3c21ba=_0x3c21ba-0x0;var _0x4392ee=_0xc2b7[_0x3c21ba];return _0x4392ee;};'use strict';var _=require(_0x7c2b('0x0'));var util=require('util');var logger=require(_0x7c2b('0x1'))('api');var moment=require(_0x7c2b('0x2'));var BPromise=require(_0x7c2b('0x3'));var rp=require(_0x7c2b('0x4'));var fs=require('fs');var path=require(_0x7c2b('0x5'));var rimraf=require(_0x7c2b('0x6'));var config=require(_0x7c2b('0x7'));var attributes=require(_0x7c2b('0x8'));module[_0x7c2b('0x9')]=function(_0x31a0c7,_0x3f5cb0){return _0x31a0c7['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x7c2b('0xa'),'fields':['messageId']},{'name':_0x7c2b('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1996a9,_0x425d6d,_0xa81584){var _0x3e3bbd=_0x31a0c7[_0x7c2b('0xc')];var _0x238b16=_0x1996a9[_0x7c2b('0xd')]({'plain':!![]});if(_0x238b16[_0x7c2b('0xe')][_0x7c2b('0xf')]()==='in'||_0x238b16[_0x7c2b('0xe')][_0x7c2b('0xf')]()==='out'&&!_0x238b16[_0x7c2b('0x10')]&&!_[_0x7c2b('0x11')](_0x238b16[_0x7c2b('0x12')])){_0x3e3bbd[_0x7c2b('0x13')][_0x7c2b('0x14')]({'where':{'id':_0x238b16[_0x7c2b('0x15')]}})['then'](function(_0x1898ca){if(_0x1898ca){_0x1898ca[_0x7c2b('0x16')]({'lastMsgAt':_0x238b16[_0x7c2b('0x17')],'lastMsgDirection':_0x238b16[_0x7c2b('0xe')][_0x7c2b('0xf')]()});}})[_0x7c2b('0x18')](function(_0x156087){console[_0x7c2b('0x19')](_0x156087);});}if(_0x238b16[_0x7c2b('0xe')]==='out'&&!_0x238b16[_0x7c2b('0x10')]){var _0x36353b;_0x3e3bbd['SmsAccount'][_0x7c2b('0x1a')]({'where':{'id':_0x238b16['SmsAccountId']},'raw':!![]})['then'](function(_0x2e5b0c){_0x36353b=_0x2e5b0c;if(_0x36353b&&_0x36353b[_0x7c2b('0x1b')]){switch(_0x36353b[_0x7c2b('0x1b')]){case _0x7c2b('0x1c'):var _0x36ca35=require(_0x7c2b('0x1c'));if(_0x36353b['accountSid']&&_0x36353b[_0x7c2b('0x1d')]&&_0x36353b['phone']){var _0x20fa26=new _0x36ca35(_0x36353b['accountSid'],_0x36353b[_0x7c2b('0x1d')]);_0x20fa26['messages'][_0x7c2b('0x1e')]({'body':_0x238b16[_0x7c2b('0x1f')],'to':_0x238b16[_0x7c2b('0x20')],'from':_0x36353b[_0x7c2b('0x20')],'statusCallback':_0x36353b[_0x7c2b('0x21')]+_0x7c2b('0x22')+_0x238b16['id']+_0x7c2b('0x23')+_0x36353b[_0x7c2b('0x24')]})['then'](function(_0x15c228){if(_0x15c228[_0x7c2b('0x25')]){return _0x1996a9['update']({'messageId':_0x15c228[_0x7c2b('0x25')]});}})[_0x7c2b('0x18')](function(_0x2da4b4){logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),_0x7c2b('0x1c'),util[_0x7c2b('0x27')](_0x2da4b4,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x1c'),_0x7c2b('0x29'));}break;case _0x7c2b('0x2a'):var _0x130b0c=_0x7c2b('0x2b');if(_0x36353b['username']&&_0x36353b[_0x7c2b('0x2c')]){var _0x572e50={'recipient':[_0x238b16['phone']],'message':_0x238b16[_0x7c2b('0x1f')],'message_type':_0x36353b['smsMethod']};if(_0x36353b['smsMethod']&&_0x36353b[_0x7c2b('0x2d')]!=='SI'){_0x572e50[_0x7c2b('0x2e')]=_0x36353b[_0x7c2b('0x20')];}var _0xdbbdcc={'url':_0x130b0c+'login?username='+_0x36353b['username']+_0x7c2b('0x2f')+_0x36353b[_0x7c2b('0x2c')],'method':'GET'};rp(_0xdbbdcc)['then'](function(_0x2fb1a3){var _0x3a3388=_0x2fb1a3['split'](';');var _0x171a23={'user_key':_0x3a3388[0x0],'session_key':_0x3a3388[0x1]};_0xdbbdcc={'url':_0x130b0c+_0x7c2b('0x30'),'method':'POST','headers':{'user_key':_0x171a23[_0x7c2b('0x31')],'Session_key':_0x171a23[_0x7c2b('0x32')]},'json':!![],'body':_0x572e50};return rp(_0xdbbdcc);})['then'](function(_0x4628bc){if(_0x4628bc['total_sent']>=0x1){var _0x65f24c={'messageId':_0x4628bc[_0x7c2b('0x33')]};if(_0x36353b[_0x7c2b('0x2d')]!=='GP'||!_0x36353b['deliveryReport']){_0x65f24c[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x65f24c);}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x2a'),util['inspect'](_0x4628bc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x40949d){return logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),'skebby',util['inspect'](_0x40949d,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),'skebby',_0x7c2b('0x35'));}break;case'connectel':if(_0x36353b[_0x7c2b('0x1d')]){var _0xe3aea9={'recipient':_0x238b16['phone'],'message':_0x238b16[_0x7c2b('0x1f')],'sender':_0x36353b[_0x7c2b('0x36')]||_0x36353b[_0x7c2b('0x20')],'authorization':_0x36353b['authToken']};var _0x425d6d={'method':'POST','uri':_0x7c2b('0x37'),'body':_0xe3aea9,'json':!![]};rp(_0x425d6d)[_0x7c2b('0x38')](function(_0x4eeba5){var _0x56d0f5={'messageId':_0x4eeba5[_0x7c2b('0x39')]};if(!_0x36353b[_0x7c2b('0x3a')]){_0x56d0f5[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x56d0f5);})['catch'](function(_0x3d20e7){logger[_0x7c2b('0x19')](_0x7c2b('0x28'),'afterCreate',_0x7c2b('0x3b'),util[_0x7c2b('0x27')](_0x3d20e7,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x36353b['username']&&_0x36353b[_0x7c2b('0x2c')]){var _0xe3aea9={'messages':[{'source':_0x7c2b('0x3c'),'to':_0x238b16['phone'],'body':_0x238b16[_0x7c2b('0x1f')],'from':_0x36353b[_0x7c2b('0x36')]||_0x36353b[_0x7c2b('0x20')]}]};var _0x8d4ce0=util[_0x7c2b('0x3d')](_0x7c2b('0x3e'),_0x36353b[_0x7c2b('0x3f')],_0x36353b[_0x7c2b('0x2c')]);var _0x425d6d={'method':'POST','uri':_0x7c2b('0x40'),'body':_0xe3aea9,'headers':{'Authorization':util[_0x7c2b('0x3d')](_0x7c2b('0x41'),new Buffer(_0x8d4ce0)[_0x7c2b('0x42')](_0x7c2b('0x43')))},'json':!![]};rp(_0x425d6d)[_0x7c2b('0x38')](function(_0xf21ea8){if(_0xf21ea8[_0x7c2b('0x44')]>=0xc8&&_0xf21ea8[_0x7c2b('0x44')]<=0xce){if(_0xf21ea8[_0x7c2b('0x45')]&&_0xf21ea8[_0x7c2b('0x45')][_0x7c2b('0x46')]>0x0){var _0x5cd089=_[_0x7c2b('0x47')](_0xf21ea8['data'][_0x7c2b('0x48')]);var _0x432235={'messageId':_0x5cd089[_0x7c2b('0x49')]};if(!_0x36353b['deliveryReport']){_0x432235[_0x7c2b('0x34')]=!![];}return _0x1996a9['update'](_0x432235);}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4a'),util[_0x7c2b('0x27')](_0xf21ea8,{'showHidden':![],'depth':null}));}}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4a'),util[_0x7c2b('0x27')](_0xf21ea8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5a53f7){logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4a'),util[_0x7c2b('0x27')](_0x5a53f7,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),'afterCreate',_0x7c2b('0x4a'),_0x7c2b('0x35'));}break;case _0x7c2b('0x4b'):if(_0x36353b[_0x7c2b('0x4c')]&&_0x36353b[_0x7c2b('0x1d')]){var _0xe3aea9={'dst':_0x238b16['phone'],'text':_0x238b16[_0x7c2b('0x1f')],'src':_0x36353b[_0x7c2b('0x36')]||_0x36353b[_0x7c2b('0x20')],'url':_0x36353b[_0x7c2b('0x21')]+'/api/sms/messages/'+_0x238b16['id']+_0x7c2b('0x23')+_0x36353b['token']};var _0x8d4ce0=util['format'](_0x7c2b('0x3e'),_0x36353b['authId'],_0x36353b['authToken']);var _0x425d6d={'method':_0x7c2b('0x4d'),'uri':util[_0x7c2b('0x3d')](_0x7c2b('0x4e'),_0x36353b[_0x7c2b('0x4c')]),'body':_0xe3aea9,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x8d4ce0)[_0x7c2b('0x42')](_0x7c2b('0x43')))},'json':!![]};rp(_0x425d6d)[_0x7c2b('0x38')](function(_0x33f256){var _0x3f71ff={'messageId':_0x33f256[_0x7c2b('0x4f')][0x0]};return _0x1996a9['update'](_0x3f71ff);})[_0x7c2b('0x18')](function(_0x3e1b1c){logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x4b'),util['inspect'](_0x3e1b1c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x7c2b('0x50'):if(_0x36353b[_0x7c2b('0x3f')]&&_0x36353b[_0x7c2b('0x2c')]){if(_0x36353b['baseUrl']){var _0x101117={'method':_0x7c2b('0x4d'),'uri':_0x36353b[_0x7c2b('0x51')]+_0x7c2b('0x52'),'body':{'username':_0x36353b['username'],'password':_0x36353b[_0x7c2b('0x2c')]},'json':!![]};return rp(_0x101117)[_0x7c2b('0x38')](function(_0x35ad31){var _0x38ef33={'method':_0x7c2b('0x4d'),'uri':_0x36353b[_0x7c2b('0x51')]+_0x7c2b('0x53'),'body':{'messages':[{'from':_0x36353b[_0x7c2b('0x20')],'destinations':[{'to':_0x238b16[_0x7c2b('0x20')]}],'text':_0x238b16[_0x7c2b('0x1f')],'notifyUrl':_0x36353b[_0x7c2b('0x21')]+'/api/sms/messages/'+_0x238b16['id']+_0x7c2b('0x23')+_0x36353b[_0x7c2b('0x24')],'notifyContentType':'application/json','callbackData':_0x36353b[_0x7c2b('0x20')]+';'+_0x238b16['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x35ad31['token']},'json':!![]};return rp(_0x38ef33)[_0x7c2b('0x38')](function(_0x1a7943){if(_0x1a7943[_0x7c2b('0x48')]){var _0x38e362={'messageId':_0x1a7943[_0x7c2b('0x48')][0x0][_0x7c2b('0xa')]};if(!_0x36353b['deliveryReport']){_0x38e362[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x38e362);}else{return logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),_0x7c2b('0x50'),util[_0x7c2b('0x27')](_0x1a7943,{'showHidden':![],'depth':null}));}});})[_0x7c2b('0x18')](function(_0x4f0097){return logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x50'),util[_0x7c2b('0x27')](_0x4f0097,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),'infobip',_0x7c2b('0x54'));}}else{logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7c2b('0x50'),_0x7c2b('0x35'));}break;case _0x7c2b('0x55'):var _0x1ffce0=require(_0x7c2b('0x56'));if(_0x36353b[_0x7c2b('0x57')]){var _0x24e67b={};_0x24e67b[_0x7c2b('0x58')]=_0x36353b[_0x7c2b('0x3f')];_0x24e67b[_0x7c2b('0x20')]=_0x238b16['phone'];_0x24e67b[_0x7c2b('0x2e')]=_0x36353b['phone'];_0x24e67b[_0x7c2b('0x59')]=_0x238b16['body'];_0x24e67b[_0x7c2b('0x5a')]=+new Date();var _0xabd23='';var _0x404338='';var _0x3f2472=Object[_0x7c2b('0x5b')](_0x24e67b);_0x3f2472['sort']();for(var _0x4b889c=0x0;_0x4b889c<_0x3f2472[_0x7c2b('0x5c')];_0x4b889c++){if(_0xabd23!=''){_0xabd23+='&';}_0xabd23+=_0x3f2472[_0x4b889c]+'='+encodeURIComponent(_0x24e67b[_0x3f2472[_0x4b889c]]);_0x404338+=_0x24e67b[_0x3f2472[_0x4b889c]];}_0x404338+=_0x36353b['apiKey'];_0x404338=_0x1ffce0[_0x7c2b('0x5d')](_0x7c2b('0x5e'))['update'](_0x404338)[_0x7c2b('0x5f')](_0x7c2b('0x60'));if(_0xabd23!==''){_0xabd23+='&';}_0xabd23+=_0x7c2b('0x61')+_0x404338;var _0xdbbdcc={'method':'GET','uri':_0x36353b[_0x7c2b('0x51')]+_0x7c2b('0x62')+_0xabd23,'json':!![]};return rp(_0xdbbdcc)[_0x7c2b('0x38')](function(_0x146223){var _0x2ad9d4=Object[_0x7c2b('0x5b')](_0x146223);if(_0x146223[_0x2ad9d4[0x0]][_0x7c2b('0x19')]&&parseInt(_0x146223[_0x2ad9d4[0x0]][_0x7c2b('0x19')])===0x0){var _0x581615={'messageId':_0x146223[_0x2ad9d4[0x0]]['id_sms']};if(!_0x36353b[_0x7c2b('0x3a')]){_0x581615[_0x7c2b('0x34')]=!![];}return _0x1996a9['update'](_0x581615);}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),'csc',util[_0x7c2b('0x27')](_0x146223['error'],{'showHidden':![],'depth':null}));}})[_0x7c2b('0x18')](function(_0x1da630){return logger[_0x7c2b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c2b('0x26'),_0x7c2b('0x55'),util[_0x7c2b('0x27')](_0x1da630,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x55'),_0x7c2b('0x63'));}break;case'clickatell':if(_0x36353b[_0x7c2b('0x57')]){var _0x49b6b7={'method':_0x7c2b('0x4d'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x36353b['apiKey']},'body':{'content':_0x238b16['body'],'to':[_0x238b16[_0x7c2b('0x20')]],'from':_0x36353b[_0x7c2b('0x20')],'binary':![],'clientMessageId':_0x7c2b('0x64'),'charset':_0x7c2b('0x65')},'json':!![]};rp(_0x49b6b7)['then'](function(_0x5e6bb2){if(!_0x5e6bb2[_0x7c2b('0x19')]){var _0x1c3adb={'messageId':_0x5e6bb2[_0x7c2b('0x48')][0x0][_0x7c2b('0x66')]};if(!_0x36353b[_0x7c2b('0x3a')]){_0x1c3adb[_0x7c2b('0x34')]=!![];}return _0x1996a9[_0x7c2b('0x16')](_0x1c3adb);}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x67'),util['inspect'](_0x5e6bb2['error'],{'showHidden':![],'depth':null}));}})[_0x7c2b('0x18')](function(_0x489d4d){return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x67'),util[_0x7c2b('0x27')](_0x489d4d,{'showHidden':![],'depth':null}));});}else{logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x67'),_0x7c2b('0x63'));}break;case _0x7c2b('0x68'):if(_0x36353b[_0x7c2b('0x57')]){var _0x58fe36={};var _0xdbbdcc={'method':_0x7c2b('0x4d'),'uri':_0x7c2b('0x69'),'headers':{'Authorization':_0x7c2b('0x6a')+_0x36353b[_0x7c2b('0x57')],'Content-Type':'application/json'},'body':{'from':_0x36353b[_0x7c2b('0x20')],'to':_0x238b16[_0x7c2b('0x20')],'text':_0x238b16[_0x7c2b('0x1f')]},'json':!![]};return rp(_0xdbbdcc)['then'](function(_0x358078){if(_0x358078[_0x7c2b('0x6b')]==0xca){_0x58fe36['message']=_0x358078;var _0x3ec767={'method':_0x7c2b('0x4d'),'uri':_0x7c2b('0x6c'),'headers':{'Authorization':'Bearer\x20'+_0x36353b[_0x7c2b('0x57')],'Content-Type':_0x7c2b('0x6d')},'body':{'refid':_0x58fe36[_0x7c2b('0x6e')][_0x7c2b('0x6f')]},'json':!![]};return rp(_0x3ec767)['then'](function(_0x2e61b4){_0x58fe36[_0x7c2b('0x70')]=_0x2e61b4;var _0xacfbd={'messageId':_0x58fe36[_0x7c2b('0x6e')]['refid'],'read':!![]};return _0x1996a9[_0x7c2b('0x16')](_0xacfbd);});}else{return logger[_0x7c2b('0x19')](_0x7c2b('0x28'),_0x7c2b('0x26'),'intelepeer',util[_0x7c2b('0x27')](_0x358078,{'showHidden':![],'depth':null}));}})[_0x7c2b('0x18')](function(_0x37bf67){return logger['error'](_0x7c2b('0x28'),'afterCreate',_0x7c2b('0x68'),util[_0x7c2b('0x27')](_0x37bf67,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x7c2b('0x28'),_0x7c2b('0x26'),_0x7c2b('0x68'),'Token\x20not\x20received');}break;}}})[_0x7c2b('0x71')](function(){_0xa81584();});}else{_0xa81584();}}},'charset':_0x7c2b('0x72'),'collate':_0x7c2b('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1db0c81..70342f9 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 _0xfbcb=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1fcc15,_0xd3f011){var _0x59e54a=function(_0x3c9816){while(--_0x3c9816){_0x1fcc15['push'](_0x1fcc15['shift']());}};_0x59e54a(++_0xd3f011);}(_0xfbcb,0xc6));var _0xbfbc=function(_0x5d832f,_0x2de902){_0x5d832f=_0x5d832f-0x0;var _0x1cc73d=_0xfbcb[_0x5d832f];return _0x1cc73d;};'use strict';var _=require(_0xbfbc('0x0'));var util=require(_0xbfbc('0x1'));var moment=require(_0xbfbc('0x2'));var BPromise=require(_0xbfbc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfbc('0x4'));var db=require(_0xbfbc('0x5'))['db'];var utils=require(_0xbfbc('0x6'));var logger=require('../../config/logger')(_0xbfbc('0x7'));var config=require(_0xbfbc('0x8'));var jayson=require(_0xbfbc('0x9'));var client=jayson[_0xbfbc('0xa')][_0xbfbc('0xb')]({'port':0x232a});config[_0xbfbc('0xc')]=_['defaults'](config[_0xbfbc('0xc')],{'host':_0xbfbc('0xd'),'port':0x18eb});var socket=require(_0xbfbc('0xe'))(new Redis(config[_0xbfbc('0xc')]));require(_0xbfbc('0xf'))[_0xbfbc('0x10')](socket);function respondWithRpcPromise(_0x2d01bf,_0x82c56d,_0x21bb40){return new BPromise(function(_0x73bcb9,_0x40ad81){return client[_0xbfbc('0x11')](_0x2d01bf,_0x21bb40)[_0xbfbc('0x12')](function(_0x244f70){logger[_0xbfbc('0x13')](_0xbfbc('0x14'),_0x82c56d,_0xbfbc('0x15'));logger[_0xbfbc('0x16')](_0xbfbc('0x17'),_0x82c56d,_0xbfbc('0x15'),JSON[_0xbfbc('0x18')](_0x244f70));if(_0x244f70[_0xbfbc('0x19')]){if(_0x244f70['error'][_0xbfbc('0x1a')]===0x1f4){logger[_0xbfbc('0x19')](_0xbfbc('0x14'),_0x82c56d,_0x244f70['error']['message']);return _0x40ad81(_0x244f70[_0xbfbc('0x19')]['message']);}logger[_0xbfbc('0x19')](_0xbfbc('0x14'),_0x82c56d,_0x244f70[_0xbfbc('0x19')][_0xbfbc('0x1b')]);return _0x73bcb9(_0x244f70['error']['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x82c56d,_0xbfbc('0x15'));_0x73bcb9(_0x244f70['result'][_0xbfbc('0x1b')]);}})[_0xbfbc('0x1c')](function(_0x1aac7a){logger[_0xbfbc('0x19')](_0xbfbc('0x14'),_0x82c56d,_0x1aac7a);_0x40ad81(_0x1aac7a);});});}exports[_0xbfbc('0x1d')]=function(_0x4a8c88){var _0x277ef7=this;return new Promise(function(_0x696828,_0x2c160a){return db[_0xbfbc('0x1e')][_0xbfbc('0x1f')](_0x4a8c88['body'],{'raw':_0x4a8c88[_0xbfbc('0x20')]?_0x4a8c88[_0xbfbc('0x20')][_0xbfbc('0x21')]===undefined?!![]:![]:!![]})[_0xbfbc('0x12')](function(_0xfda261){logger[_0xbfbc('0x13')](_0xbfbc('0x1d'),_0x4a8c88);logger[_0xbfbc('0x16')](_0xbfbc('0x1d'),_0x4a8c88,JSON[_0xbfbc('0x18')](_0xfda261));_0x696828(_0xfda261);})['catch'](function(_0x1ed86f){logger['error'](_0xbfbc('0x1d'),_0x1ed86f[_0xbfbc('0x1b')],_0x4a8c88);_0x2c160a(_0x277ef7[_0xbfbc('0x19')](0x1f4,_0x1ed86f[_0xbfbc('0x1b')]));});});}; \ No newline at end of file +var _0x53fb=['rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4fa622,_0x4e2fe9){var _0xc754da=function(_0x117cd7){while(--_0x117cd7){_0x4fa622['push'](_0x4fa622['shift']());}};_0xc754da(++_0x4e2fe9);}(_0x53fb,0x1b3));var _0xb53f=function(_0x480a67,_0x4e7bde){_0x480a67=_0x480a67-0x0;var _0xa19779=_0x53fb[_0x480a67];return _0xa19779;};'use strict';var _=require(_0xb53f('0x0'));var util=require(_0xb53f('0x1'));var moment=require('moment');var BPromise=require(_0xb53f('0x2'));var rs=require(_0xb53f('0x3'));var fs=require('fs');var Redis=require(_0xb53f('0x4'));var db=require(_0xb53f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb53f('0x6'))(_0xb53f('0x7'));var config=require(_0xb53f('0x8'));var jayson=require(_0xb53f('0x9'));var client=jayson['client'][_0xb53f('0xa')]({'port':0x232a});config['redis']=_[_0xb53f('0xb')](config[_0xb53f('0xc')],{'host':_0xb53f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb53f('0xc')]));require(_0xb53f('0xe'))[_0xb53f('0xf')](socket);function respondWithRpcPromise(_0x385339,_0x71aabf,_0x2d7540){return new BPromise(function(_0x32affc,_0x1e1732){return client[_0xb53f('0x10')](_0x385339,_0x2d7540)['then'](function(_0x326671){logger[_0xb53f('0x11')](_0xb53f('0x12'),_0x71aabf,_0xb53f('0x13'));logger['debug'](_0xb53f('0x14'),_0x71aabf,_0xb53f('0x13'),JSON['stringify'](_0x326671));if(_0x326671[_0xb53f('0x15')]){if(_0x326671[_0xb53f('0x15')]['code']===0x1f4){logger[_0xb53f('0x15')](_0xb53f('0x12'),_0x71aabf,_0x326671['error'][_0xb53f('0x16')]);return _0x1e1732(_0x326671[_0xb53f('0x15')]['message']);}logger[_0xb53f('0x15')](_0xb53f('0x12'),_0x71aabf,_0x326671[_0xb53f('0x15')][_0xb53f('0x16')]);return _0x32affc(_0x326671[_0xb53f('0x15')][_0xb53f('0x16')]);}else{logger[_0xb53f('0x11')]('SmsMessage,\x20%s,\x20%s',_0x71aabf,_0xb53f('0x13'));_0x32affc(_0x326671[_0xb53f('0x17')][_0xb53f('0x16')]);}})[_0xb53f('0x18')](function(_0xf1608f){logger['error'](_0xb53f('0x12'),_0x71aabf,_0xf1608f);_0x1e1732(_0xf1608f);});});}exports[_0xb53f('0x19')]=function(_0x190d96){var _0x2138d0=this;return new Promise(function(_0xf84774,_0x3a8555){return db[_0xb53f('0x1a')][_0xb53f('0x1b')](_0x190d96[_0xb53f('0x1c')],{'raw':_0x190d96[_0xb53f('0x1d')]?_0x190d96[_0xb53f('0x1d')][_0xb53f('0x1e')]===undefined?!![]:![]:!![]})[_0xb53f('0x1f')](function(_0x3c8d8b){logger[_0xb53f('0x11')](_0xb53f('0x19'),_0x190d96);logger[_0xb53f('0x20')]('CreateSmsMessage',_0x190d96,JSON[_0xb53f('0x21')](_0x3c8d8b));_0xf84774(_0x3c8d8b);})[_0xb53f('0x18')](function(_0x46d9b2){logger['error'](_0xb53f('0x19'),_0x46d9b2['message'],_0x190d96);_0x3a8555(_0x2138d0['error'](0x1f4,_0x46d9b2[_0xb53f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 781aef1..6757aa0 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 _0x83b3=['removeListener','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x45e122,_0x30caa4){var _0x2c0693=function(_0x1a40f8){while(--_0x1a40f8){_0x45e122['push'](_0x45e122['shift']());}};_0x2c0693(++_0x30caa4);}(_0x83b3,0x7b));var _0x383b=function(_0xdb0eca,_0xea8e39){_0xdb0eca=_0xdb0eca-0x0;var _0x440a24=_0x83b3[_0xdb0eca];return _0x440a24;};'use strict';var SmsMessageEvents=require(_0x383b('0x0'));var events=[_0x383b('0x1'),_0x383b('0x2'),'update'];function createListener(_0x3db2fb,_0x4e5f74){return function(_0x908c52){_0x4e5f74['emit'](_0x3db2fb,_0x908c52);};}function removeListener(_0x169e36,_0x8705c9){return function(){SmsMessageEvents[_0x383b('0x3')](_0x169e36,_0x8705c9);};}exports['register']=function(_0x33d820){for(var _0x9bf9d7=0x0,_0x4f4b68=events[_0x383b('0x4')];_0x9bf9d7<_0x4f4b68;_0x9bf9d7++){var _0x559861=events[_0x9bf9d7];var _0x5600a9=createListener(_0x383b('0x5')+_0x559861,_0x33d820);SmsMessageEvents['on'](_0x559861,_0x5600a9);}}; \ No newline at end of file +var _0xe116=['update','removeListener','smsMessage:','./smsMessage.events','save','remove'];(function(_0x5cbe8e,_0x599120){var _0x53921d=function(_0x660f5a){while(--_0x660f5a){_0x5cbe8e['push'](_0x5cbe8e['shift']());}};_0x53921d(++_0x599120);}(_0xe116,0x1b3));var _0x6e11=function(_0x426618,_0x137a7f){_0x426618=_0x426618-0x0;var _0x20f9cd=_0xe116[_0x426618];return _0x20f9cd;};'use strict';var SmsMessageEvents=require(_0x6e11('0x0'));var events=[_0x6e11('0x1'),_0x6e11('0x2'),_0x6e11('0x3')];function createListener(_0x256492,_0x2c3641){return function(_0x1f1bc1){_0x2c3641['emit'](_0x256492,_0x1f1bc1);};}function removeListener(_0x71232e,_0x46774a){return function(){SmsMessageEvents[_0x6e11('0x4')](_0x71232e,_0x46774a);};}exports['register']=function(_0x215cb1){for(var _0x55a421=0x0,_0x4e4859=events['length'];_0x55a421<_0x4e4859;_0x55a421++){var _0xe2344c=events[_0x55a421];var _0x2ea552=createListener(_0x6e11('0x5')+_0xe2344c,_0x215cb1);SmsMessageEvents['on'](_0xe2344c,_0x2ea552);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7de5045..bd2b327 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 _0xf31b=['express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','index','/describe','isAuthenticated','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','addTeams','post','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf31b,0x1a0));var _0xbf31=function(_0x179bfe,_0x1c366b){_0x179bfe=_0x179bfe-0x0;var _0x2447b9=_0xf31b[_0x179bfe];return _0x2447b9;};'use strict';var multer=require(_0xbf31('0x0'));var util=require(_0xbf31('0x1'));var path=require(_0xbf31('0x2'));var timeout=require(_0xbf31('0x3'));var express=require(_0xbf31('0x4'));var router=express[_0xbf31('0x5')]();var auth=require(_0xbf31('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbf31('0x7'));var controller=require(_0xbf31('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbf31('0x9')]);router['get'](_0xbf31('0xa'),auth[_0xbf31('0xb')](),controller['describe']);router['get'](_0xbf31('0xc'),auth['isAuthenticated'](),controller[_0xbf31('0xd')]);router[_0xbf31('0xe')](_0xbf31('0xf'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x10')]);router[_0xbf31('0xe')](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x12')]);router[_0xbf31('0xe')](_0xbf31('0x13'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x15')]);router[_0xbf31('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf31('0x17')]);router[_0xbf31('0x18')](_0xbf31('0xc'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x19')]);router['delete'](_0xbf31('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xbf31('0x1a')](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x1b')]);router[_0xbf31('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf31('0x1c')]);module[_0xbf31('0x1d')]=router; \ No newline at end of file +var _0x18af=['get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','/:id/users','removeAgents','multer','path','express','../../config/environment','./smsQueue.controller'];(function(_0x12dd1e,_0x25dafe){var _0x119c18=function(_0x53219e){while(--_0x53219e){_0x12dd1e['push'](_0x12dd1e['shift']());}};_0x119c18(++_0x25dafe);}(_0x18af,0x8b));var _0xf18a=function(_0x555682,_0x1120e3){_0x555682=_0x555682-0x0;var _0x192fca=_0x18af[_0x555682];return _0x192fca;};'use strict';var multer=require(_0xf18a('0x0'));var util=require('util');var path=require(_0xf18a('0x1'));var timeout=require('connect-timeout');var express=require(_0xf18a('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf18a('0x3'));var controller=require(_0xf18a('0x4'));router[_0xf18a('0x5')]('/',auth[_0xf18a('0x6')](),controller['index']);router[_0xf18a('0x5')](_0xf18a('0x7'),auth[_0xf18a('0x6')](),controller['describe']);router[_0xf18a('0x5')](_0xf18a('0x8'),auth[_0xf18a('0x6')](),controller[_0xf18a('0x9')]);router[_0xf18a('0x5')](_0xf18a('0xa'),auth[_0xf18a('0x6')](),controller[_0xf18a('0xb')]);router[_0xf18a('0x5')](_0xf18a('0xc'),auth[_0xf18a('0x6')](),controller[_0xf18a('0xd')]);router[_0xf18a('0x5')]('/:id/users',auth[_0xf18a('0x6')](),controller[_0xf18a('0xe')]);router[_0xf18a('0xf')]('/',auth[_0xf18a('0x6')](),controller[_0xf18a('0x10')]);router['post'](_0xf18a('0xc'),auth[_0xf18a('0x6')](),controller['addTeams']);router[_0xf18a('0xf')]('/:id/users',auth[_0xf18a('0x6')](),controller[_0xf18a('0x11')]);router['put'](_0xf18a('0x8'),auth['isAuthenticated'](),controller[_0xf18a('0x12')]);router[_0xf18a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf18a('0x14')]);router[_0xf18a('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf18a('0x15')]);router[_0xf18a('0x13')](_0xf18a('0x16'),auth['isAuthenticated'](),controller[_0xf18a('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4b89b6a..27f16b0 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 _0x9eba=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x1c9ab8,_0x517680){var _0x5f2467=function(_0x40b430){while(--_0x40b430){_0x1c9ab8['push'](_0x1c9ab8['shift']());}};_0x5f2467(++_0x517680);}(_0x9eba,0x1d6));var _0xa9eb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9eba[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xa9eb('0x0'));module[_0xa9eb('0x1')]={'name':{'type':Sequelize[_0xa9eb('0x2')],'unique':_0xa9eb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa9eb('0x2')]},'timeout':{'type':Sequelize[_0xa9eb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa9eb('0x5')](_0xa9eb('0x6'),_0xa9eb('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x1de2=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x23d03a,_0x625eba){var _0x142157=function(_0x2e7033){while(--_0x2e7033){_0x23d03a['push'](_0x23d03a['shift']());}};_0x142157(++_0x625eba);}(_0x1de2,0x18c));var _0x21de=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x1de2[_0x120123];return _0x3bec4c;};'use strict';var Sequelize=require('sequelize');module[_0x21de('0x0')]={'name':{'type':Sequelize[_0x21de('0x1')],'unique':_0x21de('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x21de('0x1')]},'timeout':{'type':Sequelize[_0x21de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x21de('0x4')](_0x21de('0x5'),_0x21de('0x6'),_0x21de('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c8765a5..9717c6c 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 _0x207c=['json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserSmsQueue','pick','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','smsPause','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','transaction','findOrCreate','userSmsQueue:save','removeTeams','select','from','team_has_sms_queues','join','user_has_teams','sequelize','toString','QueryTypes','every','all','compact','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','emit','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status'];(function(_0x460ff2,_0x204460){var _0x59add2=function(_0x10343b){while(--_0x10343b){_0x460ff2['push'](_0x460ff2['shift']());}};_0x59add2(++_0x204460);}(_0x207c,0x1e8));var _0xc207=function(_0x261062,_0x4145b9){_0x261062=_0x261062-0x0;var _0x38ef4f=_0x207c[_0x261062];return _0x38ef4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc207('0x0'));var rimraf=require(_0xc207('0x1'));var zipdir=require(_0xc207('0x2'));var jsonpatch=require(_0xc207('0x3'));var rp=require(_0xc207('0x4'));var moment=require(_0xc207('0x5'));var BPromise=require(_0xc207('0x6'));var Mustache=require('mustache');var util=require(_0xc207('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc207('0x8'));var fs=require('fs');var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];config[_0xc207('0x16')]=_['defaults'](config[_0xc207('0x16')],{'host':_0xc207('0x17'),'port':0x18eb});var socket=require(_0xc207('0x18'))(new Redis(config[_0xc207('0x16')]));require(_0xc207('0x19'))['register'](socket);function respondWithStatusCode(_0xc62672,_0x3c77b7){_0x3c77b7=_0x3c77b7||0xcc;return function(_0x274bbd){if(_0x274bbd){return _0xc62672[_0xc207('0x1a')](_0x3c77b7);}return _0xc62672['status'](_0x3c77b7)['end']();};}function respondWithResult(_0x554e5c,_0x1cebfa){_0x1cebfa=_0x1cebfa||0xc8;return function(_0x6e793d){if(_0x6e793d){return _0x554e5c[_0xc207('0x1b')](_0x1cebfa)[_0xc207('0x1c')](_0x6e793d);}};}function respondWithFilteredResult(_0x4b8f44,_0x1bc70c){return function(_0x282595){if(_0x282595){var _0x217d5e=_0x282595[_0xc207('0x1d')],_0x5f288e=_0x1bc70c[_0xc207('0x1e')],_0x4129b8=_0x1bc70c[_0xc207('0x1e')]+_0x1bc70c[_0xc207('0x1f')],_0x488cc0;if(_0x4129b8>=_0x217d5e){_0x4129b8=_0x217d5e;_0x488cc0=0xc8;}else{_0x488cc0=0xce;}_0x4b8f44[_0xc207('0x1b')](_0x488cc0);return _0x4b8f44[_0xc207('0x20')](_0xc207('0x21'),_0x5f288e+'-'+_0x4129b8+'/'+_0x217d5e)[_0xc207('0x1c')](_0x282595);}return null;};}function patchUpdates(_0x212005){return function(_0x2bd2eb){try{jsonpatch[_0xc207('0x22')](_0x2bd2eb,_0x212005,!![]);}catch(_0xe227a){return BPromise[_0xc207('0x23')](_0xe227a);}return _0x2bd2eb['save']();};}function saveUpdates(_0x163b36,_0x5cda23){return function(_0x2e89c5){if(_0x2e89c5){return _0x2e89c5[_0xc207('0x24')](_0x163b36)[_0xc207('0x25')](function(_0x83253f){return _0x83253f;});}return null;};}function removeEntity(_0x3539f4,_0xd209ac){return function(_0x300718){if(_0x300718){return _0x300718[_0xc207('0x26')]()[_0xc207('0x25')](function(){var _0x2385f7=_0x300718[_0xc207('0x27')]({'plain':!![]});var _0x27df03=_0xc207('0x28');return db[_0xc207('0x29')][_0xc207('0x26')]({'where':{'type':_0x27df03,'resourceId':_0x2385f7['id']}})['then'](function(){return _0x300718;});})[_0xc207('0x25')](function(){_0x3539f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ef72,_0x3a05f3){return function(_0x2e41b1){if(!_0x2e41b1){_0x18ef72[_0xc207('0x1a')](0x194);}return _0x2e41b1;};}function handleError(_0x6a653d,_0x478af7){_0x478af7=_0x478af7||0x1f4;return function(_0xe5e848){logger[_0xc207('0x2a')](_0xe5e848[_0xc207('0x2b')]);if(_0xe5e848[_0xc207('0x2c')]){delete _0xe5e848[_0xc207('0x2c')];}_0x6a653d[_0xc207('0x1b')](_0x478af7)[_0xc207('0x2d')](_0xe5e848);};}exports[_0xc207('0x2e')]=function(_0xc6a7ce,_0x3f79e8){var _0x2043cf={},_0xaa1b54={},_0x3cd4b4={'count':0x0,'rows':[]};var _0x5824e5=_[_0xc207('0x2f')](db[_0xc207('0x30')][_0xc207('0x31')],function(_0x448df1){return{'name':_0x448df1[_0xc207('0x32')],'type':_0x448df1[_0xc207('0x33')]['key']};});_0xaa1b54[_0xc207('0x34')]=_[_0xc207('0x2f')](_0x5824e5,_0xc207('0x2c'));_0xaa1b54[_0xc207('0x35')]=_['keys'](_0xc6a7ce[_0xc207('0x35')]);_0xaa1b54[_0xc207('0x36')]=_[_0xc207('0x37')](_0xaa1b54[_0xc207('0x34')],_0xaa1b54[_0xc207('0x35')]);_0x2043cf[_0xc207('0x38')]=_[_0xc207('0x37')](_0xaa1b54[_0xc207('0x34')],qs[_0xc207('0x39')](_0xc6a7ce['query']['fields']));_0x2043cf[_0xc207('0x38')]=_0x2043cf[_0xc207('0x38')][_0xc207('0x3a')]?_0x2043cf[_0xc207('0x38')]:_0xaa1b54['model'];if(!_0xc6a7ce[_0xc207('0x35')][_0xc207('0x3b')](_0xc207('0x3c'))){_0x2043cf[_0xc207('0x1f')]=qs[_0xc207('0x1f')](_0xc6a7ce['query'][_0xc207('0x1f')]);_0x2043cf[_0xc207('0x1e')]=qs['offset'](_0xc6a7ce[_0xc207('0x35')]['offset']);}_0x2043cf[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0xc6a7ce['query'][_0xc207('0x3e')]);_0x2043cf[_0xc207('0x3f')]=qs[_0xc207('0x36')](_['pick'](_0xc6a7ce['query'],_0xaa1b54[_0xc207('0x36')]),_0x5824e5);if(_0xc6a7ce[_0xc207('0x35')][_0xc207('0x40')]){_0x2043cf[_0xc207('0x3f')]=_['merge'](_0x2043cf[_0xc207('0x3f')],{'$or':_['map'](_0x5824e5,function(_0x4cce4f){if(_0x4cce4f['type']!=='VIRTUAL'){var _0x20cb64={};_0x20cb64[_0x4cce4f[_0xc207('0x2c')]]={'$like':'%'+_0xc6a7ce[_0xc207('0x35')]['filter']+'%'};return _0x20cb64;}})});}_0x2043cf=_[_0xc207('0x41')]({},_0x2043cf,_0xc6a7ce[_0xc207('0x42')]);var _0x3e7cd9={'where':_0x2043cf[_0xc207('0x3f')]};return db['SmsQueue'][_0xc207('0x1d')](_0x3e7cd9)[_0xc207('0x25')](function(_0x123a46){_0x3cd4b4[_0xc207('0x1d')]=_0x123a46;if(_0xc6a7ce[_0xc207('0x35')]['includeAll']){_0x2043cf[_0xc207('0x43')]=[{'all':!![]}];}return db[_0xc207('0x30')][_0xc207('0x44')](_0x2043cf);})[_0xc207('0x25')](function(_0x153490){_0x3cd4b4[_0xc207('0x45')]=_0x153490;return _0x3cd4b4;})[_0xc207('0x25')](respondWithFilteredResult(_0x3f79e8,_0x2043cf))[_0xc207('0x46')](handleError(_0x3f79e8,null));};exports[_0xc207('0x47')]=function(_0x5bab9f,_0x3eafd7){var _0x16ed4f={'raw':!![],'where':{'id':_0x5bab9f[_0xc207('0x48')]['id']}},_0x4b50db={};_0x4b50db[_0xc207('0x34')]=_[_0xc207('0x49')](db[_0xc207('0x30')][_0xc207('0x31')]);_0x4b50db['query']=_[_0xc207('0x49')](_0x5bab9f[_0xc207('0x35')]);_0x4b50db[_0xc207('0x36')]=_['intersection'](_0x4b50db[_0xc207('0x34')],_0x4b50db[_0xc207('0x35')]);_0x16ed4f[_0xc207('0x38')]=_[_0xc207('0x37')](_0x4b50db['model'],qs['fields'](_0x5bab9f[_0xc207('0x35')][_0xc207('0x39')]));_0x16ed4f[_0xc207('0x38')]=_0x16ed4f[_0xc207('0x38')][_0xc207('0x3a')]?_0x16ed4f[_0xc207('0x38')]:_0x4b50db[_0xc207('0x34')];if(_0x5bab9f[_0xc207('0x35')][_0xc207('0x4a')]){_0x16ed4f[_0xc207('0x43')]=[{'all':!![]}];}_0x16ed4f=_[_0xc207('0x41')]({},_0x16ed4f,_0x5bab9f[_0xc207('0x42')]);return db['SmsQueue']['find'](_0x16ed4f)[_0xc207('0x25')](handleEntityNotFound(_0x3eafd7,null))[_0xc207('0x25')](respondWithResult(_0x3eafd7,null))[_0xc207('0x46')](handleError(_0x3eafd7,null));};exports['create']=function(_0x2b89e0,_0x3f712d){return db[_0xc207('0x30')][_0xc207('0x4b')](_0x2b89e0['body'],{})[_0xc207('0x25')](function(_0x50bdf1){var _0x202935=_0x2b89e0['user']['get']({'plain':!![]});if(!_0x202935)throw new Error(_0xc207('0x4c'));if(_0x202935[_0xc207('0x4d')]==='user'){var _0x552edd=_0x50bdf1['get']({'plain':!![]});var _0x1ecae0=_0xc207('0x28');return db[_0xc207('0x4e')][_0xc207('0x4f')]({'where':{'name':_0x1ecae0,'userProfileId':_0x202935[_0xc207('0x50')]},'raw':!![]})[_0xc207('0x25')](function(_0x3dc457){if(_0x3dc457&&_0x3dc457[_0xc207('0x51')]===0x0){return db['UserProfileResource'][_0xc207('0x4b')]({'name':_0x552edd[_0xc207('0x2c')],'resourceId':_0x552edd['id'],'type':_0x3dc457['name'],'sectionId':_0x3dc457['id']},{})['then'](function(){return _0x50bdf1;});}else{return _0x50bdf1;}})[_0xc207('0x46')](function(_0x47c630){logger['error'](_0xc207('0x52'),_0x47c630);throw _0x47c630;});}return _0x50bdf1;})[_0xc207('0x25')](respondWithResult(_0x3f712d,0xc9))[_0xc207('0x46')](handleError(_0x3f712d,null));};exports[_0xc207('0x24')]=function(_0x3583b8,_0x3b926e){if(_0x3583b8[_0xc207('0x53')]['id']){delete _0x3583b8[_0xc207('0x53')]['id'];}return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x3583b8[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b926e,null))['then'](saveUpdates(_0x3583b8[_0xc207('0x53')],null))[_0xc207('0x25')](respondWithResult(_0x3b926e,null))[_0xc207('0x46')](handleError(_0x3b926e,null));};exports[_0xc207('0x26')]=function(_0xaff7a0,_0x21c12b){return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0xaff7a0[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x21c12b,null))[_0xc207('0x25')](removeEntity(_0x21c12b,null))[_0xc207('0x46')](handleError(_0x21c12b,null));};exports[_0xc207('0x54')]=function(_0x6d387e,_0x569c85){return db[_0xc207('0x30')][_0xc207('0x54')]()[_0xc207('0x25')](respondWithResult(_0x569c85,null))[_0xc207('0x46')](handleError(_0x569c85,null));};exports[_0xc207('0x55')]=function(_0x45ad58,_0x3eb832,_0x547dee){var _0x305cab={'raw':!![],'where':{}},_0x3a9047={},_0x475a40;return db[_0xc207('0x30')]['findOne']({'where':{'id':_0x45ad58[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x3eb832,null))['then'](function(_0x31e321){if(_0x31e321){_0x475a40=_0x31e321[_0xc207('0x27')]({'plain':!![]});_0x3a9047[_0xc207('0x34')]=_[_0xc207('0x49')](db[_0xc207('0x56')][_0xc207('0x31')]);_0x3a9047[_0xc207('0x35')]=_[_0xc207('0x49')](_0x45ad58[_0xc207('0x35')]);_0x3a9047[_0xc207('0x36')]=_[_0xc207('0x37')](_0x3a9047[_0xc207('0x34')],_0x3a9047[_0xc207('0x35')]);_0x305cab[_0xc207('0x38')]=_[_0xc207('0x37')](_0x3a9047['model'],qs[_0xc207('0x39')](_0x45ad58['query'][_0xc207('0x39')]));_0x305cab[_0xc207('0x38')]=_0x305cab[_0xc207('0x38')]['length']?_0x305cab['attributes']:_0x3a9047[_0xc207('0x34')];if(!_0x45ad58[_0xc207('0x35')][_0xc207('0x3b')]('nolimit')){_0x305cab[_0xc207('0x1f')]=qs[_0xc207('0x1f')](_0x45ad58[_0xc207('0x35')]['limit']);_0x305cab['offset']=qs[_0xc207('0x1e')](_0x45ad58['query'][_0xc207('0x1e')]);}_0x305cab[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0x45ad58[_0xc207('0x35')][_0xc207('0x3e')]);_0x305cab[_0xc207('0x3f')]=qs[_0xc207('0x36')](_[_0xc207('0x57')](_0x45ad58['query'],_0x3a9047[_0xc207('0x36')]));_0x305cab[_0xc207('0x3f')][_0xc207('0x58')]=_0x31e321['id'];if(_0x45ad58[_0xc207('0x35')][_0xc207('0x40')]){_0x305cab[_0xc207('0x3f')]=_[_0xc207('0x41')](_0x305cab[_0xc207('0x3f')],{'$or':_[_0xc207('0x2f')](_0x305cab[_0xc207('0x38')],function(_0x203686){var _0x53a210={};_0x53a210[_0x203686]={'$like':'%'+_0x45ad58[_0xc207('0x35')][_0xc207('0x40')]+'%'};return _0x53a210;})});}_0x305cab=_[_0xc207('0x41')]({},_0x305cab,_0x45ad58[_0xc207('0x42')]);return db['UserSmsQueue']['findAll'](_0x305cab);}})[_0xc207('0x25')](function(_0x375518){if(_0x375518){return db[_0xc207('0x59')][_0xc207('0x5a')]({'where':{'id':_['map'](_0x375518,_0xc207('0x5b')),'role':_0xc207('0x5c')},'attributes':['id',_0xc207('0x2c'),'smsPause',_0xc207('0x5d'),_0xc207('0x5e')]});}})[_0xc207('0x25')](function(_0x5a8241){if(_0x5a8241){return{'count':_0x5a8241[_0xc207('0x1d')],'rows':_['map'](_0x5a8241[_0xc207('0x45')],function(_0x4d116b){return{'membername':_0x4d116b[_0xc207('0x2c')],'UserId':_0x4d116b['id'],'queue_name':_0x475a40[_0xc207('0x2c')],'SmsQueueId':_0x475a40['id'],'interface':util['format'](_0xc207('0x5f'),'SIP',_0x4d116b[_0xc207('0x2c')]),'penalty':0x0,'paused':_0x4d116b[_0xc207('0x60')],'createdAt':_0x4d116b[_0xc207('0x5e')],'updatedAt':_0x4d116b[_0xc207('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc207('0x25')](respondWithFilteredResult(_0x3eb832,_0x305cab))['catch'](handleError(_0x3eb832,null));};exports['getTeams']=function(_0x3d1659,_0x28b166,_0x5320a9){var _0x19aa62={};var _0x3971c8={};var _0x52d7f1;var _0x10ab93;return db[_0xc207('0x30')]['findOne']({'where':{'id':_0x3d1659[_0xc207('0x48')]['id']}})[_0xc207('0x25')](handleEntityNotFound(_0x28b166,null))[_0xc207('0x25')](function(_0x1d550d){if(_0x1d550d){_0x52d7f1=_0x1d550d;_0x3971c8[_0xc207('0x34')]=_[_0xc207('0x49')](db['Team']['rawAttributes']);_0x3971c8[_0xc207('0x35')]=_[_0xc207('0x49')](_0x3d1659[_0xc207('0x35')]);_0x3971c8[_0xc207('0x36')]=_[_0xc207('0x37')](_0x3971c8['model'],_0x3971c8[_0xc207('0x35')]);_0x19aa62['attributes']=_[_0xc207('0x37')](_0x3971c8[_0xc207('0x34')],qs[_0xc207('0x39')](_0x3d1659[_0xc207('0x35')][_0xc207('0x39')]));_0x19aa62[_0xc207('0x38')]=_0x19aa62['attributes'][_0xc207('0x3a')]?_0x19aa62[_0xc207('0x38')]:_0x3971c8['model'];_0x19aa62[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0x3d1659[_0xc207('0x35')][_0xc207('0x3e')]);_0x19aa62[_0xc207('0x3f')]=qs[_0xc207('0x36')](_[_0xc207('0x57')](_0x3d1659[_0xc207('0x35')],_0x3971c8[_0xc207('0x36')]));if(_0x3d1659[_0xc207('0x35')][_0xc207('0x40')]){_0x19aa62[_0xc207('0x3f')]=_[_0xc207('0x41')](_0x19aa62['where'],{'$or':_[_0xc207('0x2f')](_0x19aa62[_0xc207('0x38')],function(_0x2f4efd){var _0x266e65={};_0x266e65[_0x2f4efd]={'$like':'%'+_0x3d1659['query'][_0xc207('0x40')]+'%'};return _0x266e65;})});}_0x19aa62=_['merge']({},_0x19aa62,_0x3d1659[_0xc207('0x42')]);return _0x52d7f1['getTeams'](_0x19aa62);}})['then'](function(_0x2967e6){if(_0x2967e6){_0x10ab93=_0x2967e6[_0xc207('0x3a')];if(!_0x3d1659[_0xc207('0x35')][_0xc207('0x3b')](_0xc207('0x3c'))){_0x19aa62[_0xc207('0x1f')]=qs['limit'](_0x3d1659[_0xc207('0x35')]['limit']);_0x19aa62[_0xc207('0x1e')]=qs[_0xc207('0x1e')](_0x3d1659[_0xc207('0x35')][_0xc207('0x1e')]);}return _0x52d7f1['getTeams'](_0x19aa62);}})[_0xc207('0x25')](function(_0x444efa){if(_0x444efa){return _0x444efa?{'count':_0x10ab93,'rows':_0x444efa}:null;}})['then'](respondWithResult(_0x28b166,null))[_0xc207('0x46')](handleError(_0x28b166,null));};exports[_0xc207('0x61')]=function(_0xcc7f92,_0x1365f4,_0x5af9f6){var _0xc814f3=_0xcc7f92[_0xc207('0x53')][_0xc207('0x62')];return db[_0xc207('0x63')]['findAll']({'where':{'id':_0xc814f3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xc207('0x64'),_0xc207('0x65'),_0xc207('0x66')],'raw':!![]}]})[_0xc207('0x25')](function(_0x504c6b){if(_0x504c6b){var _0x4f928b=_[_0xc207('0x67')](_0x504c6b,function(_0x4a5b76){var _0x50f110=_0x4a5b76[_0xc207('0x27')]({'plain':!![]});return _0x50f110[_0xc207('0x68')];});return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0xcc7f92[_0xc207('0x48')]['id']}})['then'](function(_0x391e4f){return db['sequelize'][_0xc207('0x69')](function(_0x2d683e){return _0x391e4f[_0xc207('0x61')](_0xc814f3,{'transaction':_0x2d683e})['then'](function(){return BPromise['each'](_0x4f928b,function(_0x17783d){return db[_0xc207('0x56')][_0xc207('0x6a')]({'where':{'UserId':_0x17783d['id'],'SmsQueueId':_0xcc7f92[_0xc207('0x48')]['id']},'transaction':_0x2d683e});});})['then'](function(){_0x4f928b['forEach'](function(_0x3e8b84){socket['emit'](_0xc207('0x6b'),{'UserId':_0x3e8b84['id'],'SmsQueueId':_0x391e4f['id']});});});});});}})[_0xc207('0x25')](respondWithStatusCode(_0x1365f4,null))[_0xc207('0x46')](handleError(_0x1365f4,null));};exports[_0xc207('0x6c')]=function(_0x1d9b75,_0x5a7bc9,_0x2afdc9){return db[_0xc207('0x63')][_0xc207('0x44')]({'where':{'id':_0x1d9b75[_0xc207('0x35')][_0xc207('0x62')]},'attributes':['id'],'include':[{'model':db[_0xc207('0x59')],'as':_0xc207('0x68'),'attributes':['id'],'raw':!![]}]})[_0xc207('0x25')](handleEntityNotFound(_0x5a7bc9,null))[_0xc207('0x25')](function(_0x214516){var _0x48213b=_[_0xc207('0x2f')](_0x214516,'id');var _0x59d6f7=[];var _0x4a7dd2=[];var _0x22e47c=squel[_0xc207('0x6d')]();_0x22e47c['field']('tq.TeamId')[_0xc207('0x6e')](_0xc207('0x6f'),'tq')[_0xc207('0x70')](_0xc207('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc207('0x3f')]('SmsQueueId\x20=\x20?',_0x1d9b75[_0xc207('0x48')]['id']);for(var _0x1c7886=0x0;_0x1c7886<_0x214516[_0xc207('0x3a')];_0x1c7886+=0x1){let _0x1e48f3=_0x214516[_0x1c7886];for(var _0x3a449a=0x0;_0x3a449a<_0x1e48f3[_0xc207('0x68')]['length'];_0x3a449a+=0x1){let _0x1f293e=_0x1e48f3[_0xc207('0x68')][_0x3a449a];var _0x5e2df2=_0x22e47c['clone']();_0x5e2df2['where']('ut.UserId\x20=\x20?',_0x1f293e['id']);_0x4a7dd2['push'](db[_0xc207('0x72')][_0xc207('0x35')](_0x5e2df2[_0xc207('0x73')](),{'type':db['sequelize'][_0xc207('0x74')]['SELECT']})[_0xc207('0x25')](function(_0x1f1876){if(_0x1f1876[_0xc207('0x3a')]===0x1){return _0x1f293e['id'];}else{var _0x4fcd51=_[_0xc207('0x75')](_[_0xc207('0x2f')](_0x1f1876,'TeamId'),function(_0xbfed0b){return _['includes'](_0x48213b,_0xbfed0b);});if(_0x4fcd51){return _0x1f293e['id'];}}}));}}return BPromise[_0xc207('0x76')](_0x4a7dd2)['then'](function(_0x2b95f7){_0x59d6f7=_(_0x59d6f7)['union'](_0x2b95f7)[_0xc207('0x77')]()[_0xc207('0x78')]();return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x1d9b75[_0xc207('0x48')]['id']}})[_0xc207('0x25')](function(_0x50bc7e){return db[_0xc207('0x72')][_0xc207('0x69')](function(_0xe9177e){return _0x50bc7e[_0xc207('0x6c')](_0x1d9b75['query'][_0xc207('0x62')],{'transaction':_0xe9177e})[_0xc207('0x25')](function(){if(!_['isEmpty'](_0x59d6f7)){return _0x50bc7e[_0xc207('0x79')](_0x59d6f7,{'transaction':_0xe9177e});}})[_0xc207('0x25')](function(){_0x59d6f7[_0xc207('0x7a')](function(_0x308c6d){socket['emit'](_0xc207('0x7b'),{'UserId':_0x308c6d,'SmsQueueId':_0x50bc7e['id']});});});});});});})[_0xc207('0x25')](respondWithStatusCode(_0x5a7bc9,null))[_0xc207('0x46')](handleError(_0x5a7bc9,null));};exports[_0xc207('0x7c')]=function(_0x53a701,_0x1f6492,_0x4f8767){return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x53a701[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f6492,null))[_0xc207('0x25')](function(_0x235084){if(_0x235084){return _0x235084[_0xc207('0x7c')](_0x53a701[_0xc207('0x53')][_0xc207('0x62')],_[_0xc207('0x7d')](_0x53a701[_0xc207('0x53')],[_0xc207('0x62'),'id'])||{})['spread'](function(_0x2c38e0){for(var _0xc58cd3=0x0;_0xc58cd3<_0x53a701[_0xc207('0x53')][_0xc207('0x62')][_0xc207('0x3a')];_0xc58cd3+=0x1){socket[_0xc207('0x7e')](_0xc207('0x6b'),{'UserId':_0x53a701[_0xc207('0x53')][_0xc207('0x62')][_0xc58cd3],'SmsQueueId':_0x53a701[_0xc207('0x48')]['id']});}return _0x2c38e0;});}})['then'](respondWithResult(_0x1f6492,null))[_0xc207('0x46')](handleError(_0x1f6492,null));};exports[_0xc207('0x79')]=function(_0x30d790,_0x1381ef,_0x1c29f6){return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x30d790[_0xc207('0x48')]['id']}})[_0xc207('0x25')](handleEntityNotFound(_0x1381ef,null))[_0xc207('0x25')](function(_0x473b90){if(_0x473b90){return _0x473b90[_0xc207('0x79')](_0x30d790[_0xc207('0x35')]['ids'])[_0xc207('0x25')](function(){if(_['isArray'](_0x30d790['query'][_0xc207('0x62')])){for(var _0x130fd9=0x0;_0x130fd9<_0x30d790['query'][_0xc207('0x62')][_0xc207('0x3a')];_0x130fd9+=0x1){socket['emit'](_0xc207('0x7b'),{'UserId':Number(_0x30d790[_0xc207('0x35')]['ids'][_0x130fd9]),'SmsQueueId':Number(_0x30d790['params']['id'])});}}else{socket[_0xc207('0x7e')](_0xc207('0x7b'),{'UserId':Number(_0x30d790[_0xc207('0x35')][_0xc207('0x62')]),'SmsQueueId':Number(_0x30d790[_0xc207('0x48')]['id'])});}});}})[_0xc207('0x25')](respondWithStatusCode(_0x1381ef,null))[_0xc207('0x46')](handleError(_0x1381ef,null));};exports[_0xc207('0x7f')]=function(_0x4b6515,_0x2d41d3,_0x1c8189){var _0x17617c={};var _0x40738c={};var _0xe5b189;var _0x2b00af;return db[_0xc207('0x30')][_0xc207('0x80')]({'where':{'id':_0x4b6515[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d41d3,null))[_0xc207('0x25')](function(_0x541750){if(_0x541750){_0xe5b189=_0x541750;_0x40738c['model']=_[_0xc207('0x49')](db[_0xc207('0x59')][_0xc207('0x31')]);_0x40738c[_0xc207('0x35')]=_[_0xc207('0x49')](_0x4b6515['query']);_0x40738c[_0xc207('0x36')]=_[_0xc207('0x37')](_0x40738c['model'],_0x40738c['query']);_0x17617c[_0xc207('0x38')]=_['intersection'](_0x40738c[_0xc207('0x34')],qs[_0xc207('0x39')](_0x4b6515[_0xc207('0x35')]['fields']));_0x17617c[_0xc207('0x38')]=_0x17617c[_0xc207('0x38')][_0xc207('0x3a')]?_0x17617c[_0xc207('0x38')]:_0x40738c['model'];_0x17617c[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0x4b6515['query'][_0xc207('0x3e')]);_0x17617c[_0xc207('0x3f')]=qs['filters'](_[_0xc207('0x57')](_0x4b6515[_0xc207('0x35')],_0x40738c[_0xc207('0x36')]));if(_0x4b6515[_0xc207('0x35')][_0xc207('0x40')]){_0x17617c[_0xc207('0x3f')]=_[_0xc207('0x41')](_0x17617c[_0xc207('0x3f')],{'$or':_[_0xc207('0x2f')](_0x17617c['attributes'],function(_0xe603f8){var _0x3bdf16={};_0x3bdf16[_0xe603f8]={'$like':'%'+_0x4b6515[_0xc207('0x35')][_0xc207('0x40')]+'%'};return _0x3bdf16;})});}_0x17617c=_[_0xc207('0x41')]({},_0x17617c,_0x4b6515[_0xc207('0x42')]);return _0xe5b189[_0xc207('0x7f')](_0x17617c);}})[_0xc207('0x25')](function(_0x1874f6){if(_0x1874f6){_0x2b00af=_0x1874f6[_0xc207('0x3a')];if(!_0x4b6515[_0xc207('0x35')]['hasOwnProperty'](_0xc207('0x3c'))){_0x17617c['limit']=qs[_0xc207('0x1f')](_0x4b6515[_0xc207('0x35')][_0xc207('0x1f')]);_0x17617c[_0xc207('0x1e')]=qs['offset'](_0x4b6515['query'][_0xc207('0x1e')]);}return _0xe5b189[_0xc207('0x7f')](_0x17617c);}})[_0xc207('0x25')](function(_0x22491c){if(_0x22491c){return _0x22491c?{'count':_0x2b00af,'rows':_0x22491c}:null;}})[_0xc207('0x25')](respondWithResult(_0x2d41d3,null))[_0xc207('0x46')](handleError(_0x2d41d3,null));}; \ No newline at end of file +var _0x24ca=['path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsQueue.socket','register','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','pick','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x41bd01,_0x59569e){var _0x36cc76=function(_0x1f3ca8){while(--_0x1f3ca8){_0x41bd01['push'](_0x41bd01['shift']());}};_0x36cc76(++_0x59569e);}(_0x24ca,0x8c));var _0xa24c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x24ca[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require(_0xa24c('0x4'));var Mustache=require('mustache');var util=require(_0xa24c('0x5'));var path=require(_0xa24c('0x6'));var sox=require(_0xa24c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0xc'));var querystring=require(_0xa24c('0xd'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xe'));var authService=require(_0xa24c('0xf'));var qs=require(_0xa24c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x11'))(_0xa24c('0x12'));var utils=require(_0xa24c('0x13'));var config=require(_0xa24c('0x14'));var licenseUtil=require(_0xa24c('0x15'));var db=require(_0xa24c('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa24c('0x17'),'port':0x18eb});var socket=require(_0xa24c('0x18'))(new Redis(config[_0xa24c('0x19')]));require(_0xa24c('0x1a'))[_0xa24c('0x1b')](socket);function respondWithStatusCode(_0x4971af,_0x13076d){_0x13076d=_0x13076d||0xcc;return function(_0x488a78){if(_0x488a78){return _0x4971af['sendStatus'](_0x13076d);}return _0x4971af['status'](_0x13076d)[_0xa24c('0x1c')]();};}function respondWithResult(_0x2a4270,_0x3f762e){_0x3f762e=_0x3f762e||0xc8;return function(_0x267762){if(_0x267762){return _0x2a4270[_0xa24c('0x1d')](_0x3f762e)[_0xa24c('0x1e')](_0x267762);}};}function respondWithFilteredResult(_0x2197da,_0x32a226){return function(_0x14f0aa){if(_0x14f0aa){var _0x117177=_0x14f0aa[_0xa24c('0x1f')],_0x1970fc=_0x32a226['offset'],_0x1a667b=_0x32a226[_0xa24c('0x20')]+_0x32a226['limit'],_0x278cce;if(_0x1a667b>=_0x117177){_0x1a667b=_0x117177;_0x278cce=0xc8;}else{_0x278cce=0xce;}_0x2197da[_0xa24c('0x1d')](_0x278cce);return _0x2197da[_0xa24c('0x21')](_0xa24c('0x22'),_0x1970fc+'-'+_0x1a667b+'/'+_0x117177)[_0xa24c('0x1e')](_0x14f0aa);}return null;};}function patchUpdates(_0x240f6c){return function(_0x416dea){try{jsonpatch[_0xa24c('0x23')](_0x416dea,_0x240f6c,!![]);}catch(_0x432c15){return BPromise[_0xa24c('0x24')](_0x432c15);}return _0x416dea[_0xa24c('0x25')]();};}function saveUpdates(_0x2b471a,_0x53e729){return function(_0x4eadb2){if(_0x4eadb2){return _0x4eadb2[_0xa24c('0x26')](_0x2b471a)[_0xa24c('0x27')](function(_0x316a68){return _0x316a68;});}return null;};}function removeEntity(_0x1a04ff,_0x375c83){return function(_0xfb13c0){if(_0xfb13c0){return _0xfb13c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x304d6c=_0xfb13c0['get']({'plain':!![]});var _0x2290e1='SmsQueues';return db[_0xa24c('0x29')][_0xa24c('0x28')]({'where':{'type':_0x2290e1,'resourceId':_0x304d6c['id']}})[_0xa24c('0x27')](function(){return _0xfb13c0;});})[_0xa24c('0x27')](function(){_0x1a04ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c86c6,_0x4e5d2c){return function(_0x23fb79){if(!_0x23fb79){_0x4c86c6[_0xa24c('0x2a')](0x194);}return _0x23fb79;};}function handleError(_0xab6197,_0x1cdee4){_0x1cdee4=_0x1cdee4||0x1f4;return function(_0x37cbd3){logger['error'](_0x37cbd3['stack']);if(_0x37cbd3[_0xa24c('0x2b')]){delete _0x37cbd3[_0xa24c('0x2b')];}_0xab6197[_0xa24c('0x1d')](_0x1cdee4)[_0xa24c('0x2c')](_0x37cbd3);};}exports[_0xa24c('0x2d')]=function(_0x3f7102,_0xc0db8f){var _0x1e30a9={},_0x29f539={},_0x17a001={'count':0x0,'rows':[]};var _0x59526b=_[_0xa24c('0x2e')](db[_0xa24c('0x2f')]['rawAttributes'],function(_0x3c9649){return{'name':_0x3c9649[_0xa24c('0x30')],'type':_0x3c9649[_0xa24c('0x31')][_0xa24c('0x32')]};});_0x29f539[_0xa24c('0x33')]=_[_0xa24c('0x2e')](_0x59526b,_0xa24c('0x2b'));_0x29f539[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x3f7102[_0xa24c('0x34')]);_0x29f539['filters']=_['intersection'](_0x29f539['model'],_0x29f539[_0xa24c('0x34')]);_0x1e30a9['attributes']=_[_0xa24c('0x36')](_0x29f539[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x3f7102['query'][_0xa24c('0x37')]));_0x1e30a9[_0xa24c('0x38')]=_0x1e30a9[_0xa24c('0x38')]['length']?_0x1e30a9[_0xa24c('0x38')]:_0x29f539[_0xa24c('0x33')];if(!_0x3f7102['query'][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x1e30a9[_0xa24c('0x3b')]=qs['limit'](_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x1e30a9[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x3f7102[_0xa24c('0x34')]['offset']);}_0x1e30a9[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x3f7102['query'][_0xa24c('0x3d')]);_0x1e30a9[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x3f7102['query'],_0x29f539[_0xa24c('0x3f')]),_0x59526b);if(_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]){_0x1e30a9[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x1e30a9[_0xa24c('0x3e')],{'$or':_['map'](_0x59526b,function(_0x46c0bf){if(_0x46c0bf[_0xa24c('0x31')]!==_0xa24c('0x42')){var _0x137a1d={};_0x137a1d[_0x46c0bf['name']]={'$like':'%'+_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x137a1d;}})});}_0x1e30a9=_[_0xa24c('0x41')]({},_0x1e30a9,_0x3f7102[_0xa24c('0x43')]);var _0x103b50={'where':_0x1e30a9[_0xa24c('0x3e')]};return db[_0xa24c('0x2f')]['count'](_0x103b50)['then'](function(_0x22c57e){_0x17a001['count']=_0x22c57e;if(_0x3f7102[_0xa24c('0x34')]['includeAll']){_0x1e30a9[_0xa24c('0x44')]=[{'all':!![]}];}return db[_0xa24c('0x2f')][_0xa24c('0x45')](_0x1e30a9);})[_0xa24c('0x27')](function(_0x21328f){_0x17a001[_0xa24c('0x46')]=_0x21328f;return _0x17a001;})[_0xa24c('0x27')](respondWithFilteredResult(_0xc0db8f,_0x1e30a9))[_0xa24c('0x47')](handleError(_0xc0db8f,null));};exports[_0xa24c('0x48')]=function(_0x38791c,_0x45dd80){var _0x1f87b7={'raw':!![],'where':{'id':_0x38791c[_0xa24c('0x49')]['id']}},_0x2e2f06={};_0x2e2f06[_0xa24c('0x33')]=_[_0xa24c('0x35')](db['SmsQueue'][_0xa24c('0x4a')]);_0x2e2f06[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x38791c['query']);_0x2e2f06[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],_0x2e2f06[_0xa24c('0x34')]);_0x1f87b7['attributes']=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x38791c[_0xa24c('0x34')][_0xa24c('0x37')]));_0x1f87b7[_0xa24c('0x38')]=_0x1f87b7[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x1f87b7[_0xa24c('0x38')]:_0x2e2f06[_0xa24c('0x33')];if(_0x38791c[_0xa24c('0x34')][_0xa24c('0x4c')]){_0x1f87b7[_0xa24c('0x44')]=[{'all':!![]}];}_0x1f87b7=_['merge']({},_0x1f87b7,_0x38791c[_0xa24c('0x43')]);return db['SmsQueue'][_0xa24c('0x4d')](_0x1f87b7)[_0xa24c('0x27')](handleEntityNotFound(_0x45dd80,null))[_0xa24c('0x27')](respondWithResult(_0x45dd80,null))[_0xa24c('0x47')](handleError(_0x45dd80,null));};exports[_0xa24c('0x4e')]=function(_0x42d84b,_0x338877){return db[_0xa24c('0x2f')][_0xa24c('0x4e')](_0x42d84b[_0xa24c('0x4f')],{})[_0xa24c('0x27')](function(_0x390688){var _0x14c813=_0x42d84b['user'][_0xa24c('0x50')]({'plain':!![]});if(!_0x14c813)throw new Error(_0xa24c('0x51'));if(_0x14c813[_0xa24c('0x52')]===_0xa24c('0x53')){var _0x4b6cc0=_0x390688[_0xa24c('0x50')]({'plain':!![]});var _0xd09fd4=_0xa24c('0x54');return db['UserProfileSection']['find']({'where':{'name':_0xd09fd4,'userProfileId':_0x14c813[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x4992ee){if(_0x4992ee&&_0x4992ee[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x29')]['create']({'name':_0x4b6cc0[_0xa24c('0x2b')],'resourceId':_0x4b6cc0['id'],'type':_0x4992ee['name'],'sectionId':_0x4992ee['id']},{})['then'](function(){return _0x390688;});}else{return _0x390688;}})[_0xa24c('0x47')](function(_0x58f0e8){logger[_0xa24c('0x57')](_0xa24c('0x58'),_0x58f0e8);throw _0x58f0e8;});}return _0x390688;})['then'](respondWithResult(_0x338877,0xc9))[_0xa24c('0x47')](handleError(_0x338877,null));};exports[_0xa24c('0x26')]=function(_0x37379d,_0x2fe35e){if(_0x37379d['body']['id']){delete _0x37379d[_0xa24c('0x4f')]['id'];}return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x37379d[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fe35e,null))['then'](saveUpdates(_0x37379d[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x2fe35e,null))[_0xa24c('0x47')](handleError(_0x2fe35e,null));};exports[_0xa24c('0x28')]=function(_0x3aa9d7,_0x5f2564){return db[_0xa24c('0x2f')]['find']({'where':{'id':_0x3aa9d7[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f2564,null))['then'](removeEntity(_0x5f2564,null))['catch'](handleError(_0x5f2564,null));};exports[_0xa24c('0x59')]=function(_0x5c4834,_0x5d8086){return db[_0xa24c('0x2f')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x5d8086,null))[_0xa24c('0x47')](handleError(_0x5d8086,null));};exports[_0xa24c('0x5a')]=function(_0x14c819,_0x33c5f7,_0x29c643){var _0x45d2fd={'raw':!![],'where':{}},_0x366505={},_0x47a366;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x14c819[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x33c5f7,null))[_0xa24c('0x27')](function(_0x17d92d){if(_0x17d92d){_0x47a366=_0x17d92d['get']({'plain':!![]});_0x366505[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5c')]['rawAttributes']);_0x366505[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x14c819['query']);_0x366505[_0xa24c('0x3f')]=_['intersection'](_0x366505[_0xa24c('0x33')],_0x366505[_0xa24c('0x34')]);_0x45d2fd[_0xa24c('0x38')]=_[_0xa24c('0x36')](_0x366505[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x37')]));_0x45d2fd[_0xa24c('0x38')]=_0x45d2fd[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x45d2fd[_0xa24c('0x38')]:_0x366505[_0xa24c('0x33')];if(!_0x14c819[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x45d2fd[_0xa24c('0x3b')]=qs[_0xa24c('0x3b')](_0x14c819['query'][_0xa24c('0x3b')]);_0x45d2fd['offset']=qs[_0xa24c('0x20')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x20')]);}_0x45d2fd[_0xa24c('0x3c')]=qs['sort'](_0x14c819['query'][_0xa24c('0x3d')]);_0x45d2fd[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x14c819[_0xa24c('0x34')],_0x366505[_0xa24c('0x3f')]));_0x45d2fd[_0xa24c('0x3e')][_0xa24c('0x5d')]=_0x17d92d['id'];if(_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]){_0x45d2fd[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x45d2fd[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x45d2fd[_0xa24c('0x38')],function(_0x19c87a){var _0x3b68d7={};_0x3b68d7[_0x19c87a]={'$like':'%'+_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x3b68d7;})});}_0x45d2fd=_[_0xa24c('0x41')]({},_0x45d2fd,_0x14c819[_0xa24c('0x43')]);return db[_0xa24c('0x5c')][_0xa24c('0x45')](_0x45d2fd);}})[_0xa24c('0x27')](function(_0x333cb7){if(_0x333cb7){return db[_0xa24c('0x5e')][_0xa24c('0x5f')]({'where':{'id':_[_0xa24c('0x2e')](_0x333cb7,_0xa24c('0x60')),'role':_0xa24c('0x61')},'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x62'),_0xa24c('0x63'),_0xa24c('0x64')]});}})['then'](function(_0x37f25d){if(_0x37f25d){return{'count':_0x37f25d['count'],'rows':_[_0xa24c('0x2e')](_0x37f25d[_0xa24c('0x46')],function(_0x19a6f3){return{'membername':_0x19a6f3[_0xa24c('0x2b')],'UserId':_0x19a6f3['id'],'queue_name':_0x47a366['name'],'SmsQueueId':_0x47a366['id'],'interface':util[_0xa24c('0x65')](_0xa24c('0x66'),_0xa24c('0x67'),_0x19a6f3['name']),'penalty':0x0,'paused':_0x19a6f3[_0xa24c('0x62')],'createdAt':_0x19a6f3['createdAt'],'updatedAt':_0x19a6f3[_0xa24c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa24c('0x27')](respondWithFilteredResult(_0x33c5f7,_0x45d2fd))[_0xa24c('0x47')](handleError(_0x33c5f7,null));};exports['getTeams']=function(_0x2d1f56,_0x846186,_0x5ae89a){var _0x35fae7={};var _0x36e108={};var _0x316e26;var _0x2a189a;return db[_0xa24c('0x2f')][_0xa24c('0x5b')]({'where':{'id':_0x2d1f56[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x846186,null))[_0xa24c('0x27')](function(_0x327360){if(_0x327360){_0x316e26=_0x327360;_0x36e108[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x68')][_0xa24c('0x4a')]);_0x36e108[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2d1f56['query']);_0x36e108[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x36e108[_0xa24c('0x33')],_0x36e108[_0xa24c('0x34')]);_0x35fae7[_0xa24c('0x38')]=_['intersection'](_0x36e108['model'],qs[_0xa24c('0x37')](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x37')]));_0x35fae7[_0xa24c('0x38')]=_0x35fae7[_0xa24c('0x38')]['length']?_0x35fae7[_0xa24c('0x38')]:_0x36e108[_0xa24c('0x33')];_0x35fae7[_0xa24c('0x3c')]=qs['sort'](_0x2d1f56[_0xa24c('0x34')]['sort']);_0x35fae7['where']=qs['filters'](_[_0xa24c('0x69')](_0x2d1f56[_0xa24c('0x34')],_0x36e108[_0xa24c('0x3f')]));if(_0x2d1f56[_0xa24c('0x34')]['filter']){_0x35fae7[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x35fae7[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x35fae7[_0xa24c('0x38')],function(_0x4baa40){var _0x35f8e5={};_0x35f8e5[_0x4baa40]={'$like':'%'+_0x2d1f56[_0xa24c('0x34')]['filter']+'%'};return _0x35f8e5;})});}_0x35fae7=_['merge']({},_0x35fae7,_0x2d1f56[_0xa24c('0x43')]);return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})[_0xa24c('0x27')](function(_0x3479a9){if(_0x3479a9){_0x2a189a=_0x3479a9[_0xa24c('0x4b')];if(!_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x35fae7['limit']=qs['limit'](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x35fae7[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2d1f56[_0xa24c('0x34')]['offset']);}return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})['then'](function(_0x47f744){if(_0x47f744){return _0x47f744?{'count':_0x2a189a,'rows':_0x47f744}:null;}})[_0xa24c('0x27')](respondWithResult(_0x846186,null))[_0xa24c('0x47')](handleError(_0x846186,null));};exports['addTeams']=function(_0x32b835,_0x2915f1,_0x283f63){var _0x4c7ca1=_0x32b835[_0xa24c('0x4f')]['ids'];return db[_0xa24c('0x68')][_0xa24c('0x45')]({'where':{'id':_0x4c7ca1},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x6c'),_0xa24c('0x6d'),_0xa24c('0x6e')],'raw':!![]}]})[_0xa24c('0x27')](function(_0x286b89){if(_0x286b89){var _0x475526=_[_0xa24c('0x6f')](_0x286b89,function(_0xd11c2a){var _0x569475=_0xd11c2a['get']({'plain':!![]});return _0x569475[_0xa24c('0x6b')];});return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x32b835[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x4b4f88){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0x409f10){return _0x4b4f88[_0xa24c('0x72')](_0x4c7ca1,{'transaction':_0x409f10})[_0xa24c('0x27')](function(){return BPromise['each'](_0x475526,function(_0x1927c2){return db[_0xa24c('0x5c')][_0xa24c('0x73')]({'where':{'UserId':_0x1927c2['id'],'SmsQueueId':_0x32b835[_0xa24c('0x49')]['id']},'transaction':_0x409f10});});})[_0xa24c('0x27')](function(){_0x475526[_0xa24c('0x74')](function(_0x4bec32){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x4bec32['id'],'SmsQueueId':_0x4b4f88['id']});});});});});}})[_0xa24c('0x27')](respondWithStatusCode(_0x2915f1,null))['catch'](handleError(_0x2915f1,null));};exports[_0xa24c('0x77')]=function(_0x48edc9,_0x2c52fc,_0x43150f){return db[_0xa24c('0x68')]['findAll']({'where':{'id':_0x48edc9[_0xa24c('0x34')][_0xa24c('0x78')]},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa24c('0x27')](handleEntityNotFound(_0x2c52fc,null))[_0xa24c('0x27')](function(_0x3c364d){var _0x2813cc=_[_0xa24c('0x2e')](_0x3c364d,'id');var _0x230bba=[];var _0x2e95cb=[];var _0x2f89cc=squel['select']();_0x2f89cc[_0xa24c('0x79')](_0xa24c('0x7a'))[_0xa24c('0x7b')](_0xa24c('0x7c'),'tq')[_0xa24c('0x7d')]('user_has_teams','ut',_0xa24c('0x7e'))['where'](_0xa24c('0x7f'),_0x48edc9[_0xa24c('0x49')]['id']);for(var _0x3d5949=0x0;_0x3d5949<_0x3c364d['length'];_0x3d5949+=0x1){let _0x1eb531=_0x3c364d[_0x3d5949];for(var _0x4f033b=0x0;_0x4f033b<_0x1eb531[_0xa24c('0x6b')][_0xa24c('0x4b')];_0x4f033b+=0x1){let _0x1e469d=_0x1eb531['Agents'][_0x4f033b];var _0x31b6f9=_0x2f89cc[_0xa24c('0x80')]();_0x31b6f9['where'](_0xa24c('0x81'),_0x1e469d['id']);_0x2e95cb[_0xa24c('0x82')](db[_0xa24c('0x70')][_0xa24c('0x34')](_0x31b6f9[_0xa24c('0x83')](),{'type':db[_0xa24c('0x70')][_0xa24c('0x84')][_0xa24c('0x85')]})[_0xa24c('0x27')](function(_0x2f3c06){if(_0x2f3c06[_0xa24c('0x4b')]===0x1){return _0x1e469d['id'];}else{var _0x2cffcd=_['every'](_[_0xa24c('0x2e')](_0x2f3c06,_0xa24c('0x86')),function(_0x2d3953){return _['includes'](_0x2813cc,_0x2d3953);});if(_0x2cffcd){return _0x1e469d['id'];}}}));}}return BPromise[_0xa24c('0x87')](_0x2e95cb)[_0xa24c('0x27')](function(_0xcbebc5){_0x230bba=_(_0x230bba)['union'](_0xcbebc5)[_0xa24c('0x88')]()[_0xa24c('0x89')]();return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x48edc9[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x5a1c2e){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0xb4b74e){return _0x5a1c2e[_0xa24c('0x77')](_0x48edc9[_0xa24c('0x34')]['ids'],{'transaction':_0xb4b74e})[_0xa24c('0x27')](function(){if(!_[_0xa24c('0x8a')](_0x230bba)){return _0x5a1c2e[_0xa24c('0x8b')](_0x230bba,{'transaction':_0xb4b74e});}})[_0xa24c('0x27')](function(){_0x230bba[_0xa24c('0x74')](function(_0x494225){socket['emit'](_0xa24c('0x8c'),{'UserId':_0x494225,'SmsQueueId':_0x5a1c2e['id']});});});});});});})[_0xa24c('0x27')](respondWithStatusCode(_0x2c52fc,null))['catch'](handleError(_0x2c52fc,null));};exports[_0xa24c('0x8d')]=function(_0x25725d,_0x19a9d8,_0x39bfc5){return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x25725d[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x19a9d8,null))[_0xa24c('0x27')](function(_0x4a5fcd){if(_0x4a5fcd){return _0x4a5fcd['addAgents'](_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')],_[_0xa24c('0x8e')](_0x25725d[_0xa24c('0x4f')],['ids','id'])||{})[_0xa24c('0x8f')](function(_0x16f089){for(var _0x3b6a05=0x0;_0x3b6a05<_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0xa24c('0x4b')];_0x3b6a05+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0x3b6a05],'SmsQueueId':_0x25725d[_0xa24c('0x49')]['id']});}return _0x16f089;});}})[_0xa24c('0x27')](respondWithResult(_0x19a9d8,null))[_0xa24c('0x47')](handleError(_0x19a9d8,null));};exports['removeAgents']=function(_0x4538e6,_0x3bf62c,_0x2a3d0b){return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x4538e6['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x3bf62c,null))[_0xa24c('0x27')](function(_0x598d8e){if(_0x598d8e){return _0x598d8e['removeAgents'](_0x4538e6['query'][_0xa24c('0x78')])['then'](function(){if(_[_0xa24c('0x90')](_0x4538e6[_0xa24c('0x34')]['ids'])){for(var _0x30e24d=0x0;_0x30e24d<_0x4538e6[_0xa24c('0x34')]['ids']['length'];_0x30e24d+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6[_0xa24c('0x34')][_0xa24c('0x78')][_0x30e24d]),'SmsQueueId':Number(_0x4538e6['params']['id'])});}}else{socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6['query'][_0xa24c('0x78')]),'SmsQueueId':Number(_0x4538e6[_0xa24c('0x49')]['id'])});}});}})[_0xa24c('0x27')](respondWithStatusCode(_0x3bf62c,null))[_0xa24c('0x47')](handleError(_0x3bf62c,null));};exports[_0xa24c('0x91')]=function(_0x2bafac,_0x43e01a,_0x4e4788){var _0x55c670={};var _0x1e3114={};var _0x3bf57c;var _0x5c2235;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x2bafac[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x43e01a,null))['then'](function(_0x469d56){if(_0x469d56){_0x3bf57c=_0x469d56;_0x1e3114[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5e')][_0xa24c('0x4a')]);_0x1e3114[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2bafac[_0xa24c('0x34')]);_0x1e3114['filters']=_['intersection'](_0x1e3114[_0xa24c('0x33')],_0x1e3114[_0xa24c('0x34')]);_0x55c670['attributes']=_['intersection'](_0x1e3114[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x37')]));_0x55c670[_0xa24c('0x38')]=_0x55c670[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x55c670[_0xa24c('0x38')]:_0x1e3114['model'];_0x55c670[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3d')]);_0x55c670[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_[_0xa24c('0x69')](_0x2bafac[_0xa24c('0x34')],_0x1e3114[_0xa24c('0x3f')]));if(_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]){_0x55c670[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x55c670[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x55c670[_0xa24c('0x38')],function(_0x5eb0fa){var _0x5af5e4={};_0x5af5e4[_0x5eb0fa]={'$like':'%'+_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x5af5e4;})});}_0x55c670=_[_0xa24c('0x41')]({},_0x55c670,_0x2bafac[_0xa24c('0x43')]);return _0x3bf57c[_0xa24c('0x91')](_0x55c670);}})[_0xa24c('0x27')](function(_0x2d47ca){if(_0x2d47ca){_0x5c2235=_0x2d47ca['length'];if(!_0x2bafac['query']['hasOwnProperty']('nolimit')){_0x55c670['limit']=qs[_0xa24c('0x3b')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x55c670[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x20')]);}return _0x3bf57c['getAgents'](_0x55c670);}})[_0xa24c('0x27')](function(_0x54ba90){if(_0x54ba90){return _0x54ba90?{'count':_0x5c2235,'rows':_0x54ba90}:null;}})[_0xa24c('0x27')](respondWithResult(_0x43e01a,null))[_0xa24c('0x47')](handleError(_0x43e01a,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ed54909..1ea13aa 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 _0xd5a9=['save','update','remove','emit','hasOwnProperty','hook','SmsQueue','setMaxListeners'];(function(_0x5abe7d,_0x527c98){var _0x2ea0b7=function(_0x160668){while(--_0x160668){_0x5abe7d['push'](_0x5abe7d['shift']());}};_0x2ea0b7(++_0x527c98);}(_0xd5a9,0x116));var _0x9d5a=function(_0x4e411e,_0x5e114e){_0x4e411e=_0x4e411e-0x0;var _0x160a74=_0xd5a9[_0x4e411e];return _0x160a74;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x9d5a('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9d5a('0x1')](0x0);var events={'afterCreate':_0x9d5a('0x2'),'afterUpdate':_0x9d5a('0x3'),'afterDestroy':_0x9d5a('0x4')};function emitEvent(_0x239e24){return function(_0x29a84c,_0x32aab7,_0x2d39ac){SmsQueueEvents[_0x9d5a('0x5')](_0x239e24+':'+_0x29a84c['id'],_0x29a84c);SmsQueueEvents[_0x9d5a('0x5')](_0x239e24,_0x29a84c);_0x2d39ac(null);};}for(var e in events){if(events[_0x9d5a('0x6')](e)){var event=events[e];SmsQueue[_0x9d5a('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x6785=['update','remove','hasOwnProperty','hook','events','SmsQueue','setMaxListeners'];(function(_0x3965a8,_0x2247d4){var _0x397c25=function(_0x402017){while(--_0x402017){_0x3965a8['push'](_0x3965a8['shift']());}};_0x397c25(++_0x2247d4);}(_0x6785,0x1c4));var _0x5678=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x6785[_0x59d89e];return _0x554e93;};'use strict';var EventEmitter=require(_0x5678('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x5678('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5678('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5678('0x3'),'afterDestroy':_0x5678('0x4')};function emitEvent(_0x15f236){return function(_0x5a551e,_0xc4dafd,_0x2e2197){SmsQueueEvents['emit'](_0x15f236+':'+_0x5a551e['id'],_0x5a551e);SmsQueueEvents['emit'](_0x15f236,_0x5a551e);_0x2e2197(null);};}for(var e in events){if(events[_0x5678('0x5')](e)){var event=events[e];SmsQueue[_0x5678('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0f44fb0..568b0c1 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 _0x942a=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment'];(function(_0x19ef1e,_0x506bcb){var _0x10d295=function(_0x28ba1a){while(--_0x28ba1a){_0x19ef1e['push'](_0x19ef1e['shift']());}};_0x10d295(++_0x506bcb);}(_0x942a,0x175));var _0xa942=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x942a[_0x109371];return _0x4fd858;};'use strict';var _=require(_0xa942('0x0'));var util=require('util');var logger=require(_0xa942('0x1'))(_0xa942('0x2'));var moment=require(_0xa942('0x3'));var BPromise=require(_0xa942('0x4'));var rp=require(_0xa942('0x5'));var fs=require('fs');var path=require(_0xa942('0x6'));var rimraf=require(_0xa942('0x7'));var config=require(_0xa942('0x8'));var attributes=require(_0xa942('0x9'));module['exports']=function(_0xf71030,_0x1ee3c3){return _0xf71030[_0xa942('0xa')](_0xa942('0xb'),attributes,{'tableName':_0xa942('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7166=['sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x329c79,_0x35c249){var _0x491a86=function(_0x7cef96){while(--_0x7cef96){_0x329c79['push'](_0x329c79['shift']());}};_0x491a86(++_0x35c249);}(_0x7166,0x90));var _0x6716=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x7166[_0x44cb92];return _0x56b9e6;};'use strict';var _=require(_0x6716('0x0'));var util=require(_0x6716('0x1'));var logger=require(_0x6716('0x2'))('api');var moment=require(_0x6716('0x3'));var BPromise=require(_0x6716('0x4'));var rp=require(_0x6716('0x5'));var fs=require('fs');var path=require(_0x6716('0x6'));var rimraf=require('rimraf');var config=require(_0x6716('0x7'));var attributes=require(_0x6716('0x8'));module[_0x6716('0x9')]=function(_0x472e27,_0x3b4341){return _0x472e27[_0x6716('0xa')](_0x6716('0xb'),attributes,{'tableName':_0x6716('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 30b4e27..992de94 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 _0x7114=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','find','ShowSmsQueue','debug','util'];(function(_0x1b9eeb,_0x1c9ff0){var _0x4c04e7=function(_0x4f1bd9){while(--_0x4f1bd9){_0x1b9eeb['push'](_0x1b9eeb['shift']());}};_0x4c04e7(++_0x1c9ff0);}(_0x7114,0x77));var _0x4711=function(_0xb0767f,_0xebe474){_0xb0767f=_0xb0767f-0x0;var _0x511c9c=_0x7114[_0xb0767f];return _0x511c9c;};'use strict';var _=require('lodash');var util=require(_0x4711('0x0'));var moment=require(_0x4711('0x1'));var BPromise=require('bluebird');var rs=require(_0x4711('0x2'));var fs=require('fs');var Redis=require(_0x4711('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4711('0x4'));var logger=require(_0x4711('0x5'))('rpc');var config=require(_0x4711('0x6'));var jayson=require(_0x4711('0x7'));var client=jayson[_0x4711('0x8')][_0x4711('0x9')]({'port':0x232a});config['redis']=_[_0x4711('0xa')](config[_0x4711('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4711('0xc'))(new Redis(config[_0x4711('0xb')]));require(_0x4711('0xd'))[_0x4711('0xe')](socket);function respondWithRpcPromise(_0x1b0d2b,_0x26d4f2,_0x15e19e){return new BPromise(function(_0x36ca9d,_0x123c34){return client[_0x4711('0xf')](_0x1b0d2b,_0x15e19e)[_0x4711('0x10')](function(_0x1b37c1){logger[_0x4711('0x11')](_0x4711('0x12'),_0x26d4f2,_0x4711('0x13'));logger['debug'](_0x4711('0x14'),_0x26d4f2,_0x4711('0x13'),JSON[_0x4711('0x15')](_0x1b37c1));if(_0x1b37c1[_0x4711('0x16')]){if(_0x1b37c1['error'][_0x4711('0x17')]===0x1f4){logger[_0x4711('0x16')]('SmsQueue,\x20%s,\x20%s',_0x26d4f2,_0x1b37c1[_0x4711('0x16')]['message']);return _0x123c34(_0x1b37c1[_0x4711('0x16')][_0x4711('0x18')]);}logger[_0x4711('0x16')](_0x4711('0x12'),_0x26d4f2,_0x1b37c1[_0x4711('0x16')]['message']);return _0x36ca9d(_0x1b37c1['error']['message']);}else{logger[_0x4711('0x11')]('SmsQueue,\x20%s,\x20%s',_0x26d4f2,_0x4711('0x13'));_0x36ca9d(_0x1b37c1[_0x4711('0x19')][_0x4711('0x18')]);}})[_0x4711('0x1a')](function(_0x324669){logger[_0x4711('0x16')](_0x4711('0x12'),_0x26d4f2,_0x324669);_0x123c34(_0x324669);});});}exports[_0x4711('0x1b')]=function(_0x541012){var _0x25a259=this;return new Promise(function(_0x403de1,_0x598382){return db[_0x4711('0x1c')][_0x4711('0x1d')]({'raw':_0x541012[_0x4711('0x1e')]?_0x541012[_0x4711('0x1e')][_0x4711('0x1f')]===undefined?!![]:![]:!![],'where':_0x541012[_0x4711('0x1e')]?_0x541012[_0x4711('0x1e')]['where']||null:null,'attributes':_0x541012['options']?_0x541012[_0x4711('0x1e')][_0x4711('0x20')]||null:null,'limit':_0x541012['options']?_0x541012['options'][_0x4711('0x21')]||null:null,'include':_0x541012['options']?_0x541012['options'][_0x4711('0x22')]?_[_0x4711('0x23')](_0x541012[_0x4711('0x1e')][_0x4711('0x22')],function(_0x31941e){return{'model':db[_0x31941e[_0x4711('0x24')]],'as':_0x31941e['as'],'attributes':_0x31941e[_0x4711('0x20')],'include':_0x31941e[_0x4711('0x22')]?_['map'](_0x31941e[_0x4711('0x22')],function(_0x3875e5){return{'model':db[_0x3875e5['model']],'as':_0x3875e5['as'],'attributes':_0x3875e5[_0x4711('0x20')],'include':_0x3875e5['include']?_[_0x4711('0x23')](_0x3875e5[_0x4711('0x22')],function(_0x5d321b){return{'model':db[_0x5d321b[_0x4711('0x24')]],'as':_0x5d321b['as'],'attributes':_0x5d321b[_0x4711('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3db992){logger[_0x4711('0x11')](_0x4711('0x1b'),_0x541012);logger['debug']('GetSmsQueue',_0x541012,JSON[_0x4711('0x15')](_0x3db992));_0x403de1(_0x3db992);})[_0x4711('0x1a')](function(_0x508a4f){logger[_0x4711('0x16')](_0x4711('0x1b'),_0x508a4f['message'],_0x541012);_0x598382(_0x25a259['error'](0x1f4,_0x508a4f[_0x4711('0x18')]));});});};exports['ShowSmsQueue']=function(_0x18cf30){var _0x36e06a=this;return new Promise(function(_0x2f3656,_0x5ba013){return db[_0x4711('0x1c')][_0x4711('0x25')]({'raw':_0x18cf30[_0x4711('0x1e')]?_0x18cf30[_0x4711('0x1e')][_0x4711('0x1f')]===undefined?!![]:![]:!![],'where':_0x18cf30[_0x4711('0x1e')]?_0x18cf30['options']['where']||null:null,'attributes':_0x18cf30[_0x4711('0x1e')]?_0x18cf30[_0x4711('0x1e')][_0x4711('0x20')]||null:null,'include':_0x18cf30[_0x4711('0x1e')]?_0x18cf30[_0x4711('0x1e')][_0x4711('0x22')]?_[_0x4711('0x23')](_0x18cf30['options'][_0x4711('0x22')],function(_0x878b38){return{'model':db[_0x878b38[_0x4711('0x24')]],'as':_0x878b38['as'],'attributes':_0x878b38[_0x4711('0x20')],'include':_0x878b38[_0x4711('0x22')]?_[_0x4711('0x23')](_0x878b38[_0x4711('0x22')],function(_0x55fa8f){return{'model':db[_0x55fa8f['model']],'as':_0x55fa8f['as'],'attributes':_0x55fa8f[_0x4711('0x20')],'include':_0x55fa8f[_0x4711('0x22')]?_[_0x4711('0x23')](_0x55fa8f[_0x4711('0x22')],function(_0x1b7a52){return{'model':db[_0x1b7a52[_0x4711('0x24')]],'as':_0x1b7a52['as'],'attributes':_0x1b7a52[_0x4711('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4711('0x10')](function(_0x954246){logger['info'](_0x4711('0x26'),_0x18cf30);logger[_0x4711('0x27')](_0x4711('0x26'),_0x18cf30,JSON[_0x4711('0x15')](_0x954246));_0x2f3656(_0x954246);})['catch'](function(_0x1f47c4){logger[_0x4711('0x16')]('ShowSmsQueue',_0x1f47c4[_0x4711('0x18')],_0x18cf30);_0x5ba013(_0x36e06a['error'](0x1f4,_0x1f47c4[_0x4711('0x18')]));});});}; \ No newline at end of file +var _0xd6a0=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','GetSmsQueue','options','raw','where','attributes','limit','include','map','model','info','stringify','catch','ShowSmsQueue','SmsQueue','find','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6a0,0x131));var _0x0d6a=function(_0x6ade11,_0x2a272c){_0x6ade11=_0x6ade11-0x0;var _0x2d52ef=_0xd6a0[_0x6ade11];return _0x2d52ef;};'use strict';var _=require(_0x0d6a('0x0'));var util=require(_0x0d6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d6a('0x2'));var fs=require('fs');var Redis=require(_0x0d6a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d6a('0x4'));var logger=require(_0x0d6a('0x5'))(_0x0d6a('0x6'));var config=require(_0x0d6a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d6a('0x8')][_0x0d6a('0x9')]({'port':0x232a});config[_0x0d6a('0xa')]=_[_0x0d6a('0xb')](config[_0x0d6a('0xa')],{'host':_0x0d6a('0xc'),'port':0x18eb});var socket=require(_0x0d6a('0xd'))(new Redis(config[_0x0d6a('0xa')]));require(_0x0d6a('0xe'))[_0x0d6a('0xf')](socket);function respondWithRpcPromise(_0x552833,_0x119cf3,_0x47cbf0){return new BPromise(function(_0x121bff,_0x4a37f1){return client[_0x0d6a('0x10')](_0x552833,_0x47cbf0)[_0x0d6a('0x11')](function(_0x425bfa){logger['info'](_0x0d6a('0x12'),_0x119cf3,_0x0d6a('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x119cf3,_0x0d6a('0x13'),JSON['stringify'](_0x425bfa));if(_0x425bfa[_0x0d6a('0x14')]){if(_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x15')]===0x1f4){logger[_0x0d6a('0x14')](_0x0d6a('0x12'),_0x119cf3,_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);return _0x4a37f1(_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);}logger[_0x0d6a('0x14')](_0x0d6a('0x12'),_0x119cf3,_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);return _0x121bff(_0x425bfa[_0x0d6a('0x14')][_0x0d6a('0x16')]);}else{logger['info'](_0x0d6a('0x12'),_0x119cf3,_0x0d6a('0x13'));_0x121bff(_0x425bfa['result'][_0x0d6a('0x16')]);}})['catch'](function(_0x2c09f9){logger[_0x0d6a('0x14')](_0x0d6a('0x12'),_0x119cf3,_0x2c09f9);_0x4a37f1(_0x2c09f9);});});}exports[_0x0d6a('0x17')]=function(_0x3a80d1){var _0x50abcb=this;return new Promise(function(_0x5a66b5,_0x1c61c1){return db['SmsQueue']['findAll']({'raw':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x19')]===undefined?!![]:![]:!![],'where':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1a')]||null:null,'attributes':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1b')]||null:null,'limit':_0x3a80d1['options']?_0x3a80d1['options'][_0x0d6a('0x1c')]||null:null,'include':_0x3a80d1[_0x0d6a('0x18')]?_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1d')]?_['map'](_0x3a80d1[_0x0d6a('0x18')][_0x0d6a('0x1d')],function(_0xbe2168){return{'model':db[_0xbe2168['model']],'as':_0xbe2168['as'],'attributes':_0xbe2168[_0x0d6a('0x1b')],'include':_0xbe2168[_0x0d6a('0x1d')]?_[_0x0d6a('0x1e')](_0xbe2168['include'],function(_0x29aa6c){return{'model':db[_0x29aa6c[_0x0d6a('0x1f')]],'as':_0x29aa6c['as'],'attributes':_0x29aa6c[_0x0d6a('0x1b')],'include':_0x29aa6c[_0x0d6a('0x1d')]?_[_0x0d6a('0x1e')](_0x29aa6c[_0x0d6a('0x1d')],function(_0x416a94){return{'model':db[_0x416a94[_0x0d6a('0x1f')]],'as':_0x416a94['as'],'attributes':_0x416a94[_0x0d6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d6a('0x11')](function(_0x9ece38){logger[_0x0d6a('0x20')]('GetSmsQueue',_0x3a80d1);logger['debug']('GetSmsQueue',_0x3a80d1,JSON[_0x0d6a('0x21')](_0x9ece38));_0x5a66b5(_0x9ece38);})[_0x0d6a('0x22')](function(_0x442f79){logger['error'](_0x0d6a('0x17'),_0x442f79['message'],_0x3a80d1);_0x1c61c1(_0x50abcb[_0x0d6a('0x14')](0x1f4,_0x442f79['message']));});});};exports[_0x0d6a('0x23')]=function(_0x49d3b9){var _0x371e8e=this;return new Promise(function(_0xfebe63,_0x34db79){return db[_0x0d6a('0x24')][_0x0d6a('0x25')]({'raw':_0x49d3b9[_0x0d6a('0x18')]?_0x49d3b9[_0x0d6a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49d3b9[_0x0d6a('0x18')]?_0x49d3b9['options']['where']||null:null,'attributes':_0x49d3b9[_0x0d6a('0x18')]?_0x49d3b9[_0x0d6a('0x18')][_0x0d6a('0x1b')]||null:null,'include':_0x49d3b9['options']?_0x49d3b9[_0x0d6a('0x18')][_0x0d6a('0x1d')]?_['map'](_0x49d3b9[_0x0d6a('0x18')]['include'],function(_0x512b73){return{'model':db[_0x512b73[_0x0d6a('0x1f')]],'as':_0x512b73['as'],'attributes':_0x512b73[_0x0d6a('0x1b')],'include':_0x512b73[_0x0d6a('0x1d')]?_[_0x0d6a('0x1e')](_0x512b73[_0x0d6a('0x1d')],function(_0x31a45d){return{'model':db[_0x31a45d[_0x0d6a('0x1f')]],'as':_0x31a45d['as'],'attributes':_0x31a45d['attributes'],'include':_0x31a45d['include']?_[_0x0d6a('0x1e')](_0x31a45d[_0x0d6a('0x1d')],function(_0x561305){return{'model':db[_0x561305['model']],'as':_0x561305['as'],'attributes':_0x561305[_0x0d6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0d6a('0x11')](function(_0x53d9d7){logger[_0x0d6a('0x20')](_0x0d6a('0x23'),_0x49d3b9);logger[_0x0d6a('0x26')]('ShowSmsQueue',_0x49d3b9,JSON[_0x0d6a('0x21')](_0x53d9d7));_0xfebe63(_0x53d9d7);})[_0x0d6a('0x22')](function(_0x30ef36){logger['error'](_0x0d6a('0x23'),_0x30ef36[_0x0d6a('0x16')],_0x49d3b9);_0x34db79(_0x371e8e[_0x0d6a('0x14')](0x1f4,_0x30ef36[_0x0d6a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 07ce2da..5e39c03 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 _0x74c6=['removeListener','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x16b72f,_0x5eb70f){var _0x4cfa51=function(_0x305008){while(--_0x305008){_0x16b72f['push'](_0x16b72f['shift']());}};_0x4cfa51(++_0x5eb70f);}(_0x74c6,0xc6));var _0x674c=function(_0x5ba8a5,_0x5456b9){_0x5ba8a5=_0x5ba8a5-0x0;var _0x23ac1a=_0x74c6[_0x5ba8a5];return _0x23ac1a;};'use strict';var SmsQueueEvents=require(_0x674c('0x0'));var events=[_0x674c('0x1'),_0x674c('0x2'),_0x674c('0x3')];function createListener(_0x16e6af,_0x507b47){return function(_0x47d71b){_0x507b47[_0x674c('0x4')](_0x16e6af,_0x47d71b);};}function removeListener(_0x223af3,_0x2a7da3){return function(){SmsQueueEvents[_0x674c('0x5')](_0x223af3,_0x2a7da3);};}exports['register']=function(_0x1bbcc9){for(var _0xa4e574=0x0,_0x141b32=events['length'];_0xa4e574<_0x141b32;_0xa4e574++){var _0x579b02=events[_0xa4e574];var _0x89187e=createListener(_0x674c('0x6')+_0x579b02,_0x1bbcc9);SmsQueueEvents['on'](_0x579b02,_0x89187e);}}; \ No newline at end of file +var _0xf85e=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf85e,0xee));var _0xef85=function(_0x17a264,_0x489c04){_0x17a264=_0x17a264-0x0;var _0x2bbbf6=_0xf85e[_0x17a264];return _0x2bbbf6;};'use strict';var SmsQueueEvents=require(_0xef85('0x0'));var events=[_0xef85('0x1'),_0xef85('0x2'),_0xef85('0x3')];function createListener(_0x28046e,_0x270131){return function(_0x38fd70){_0x270131[_0xef85('0x4')](_0x28046e,_0x38fd70);};}function removeListener(_0x371801,_0x4f29f7){return function(){SmsQueueEvents[_0xef85('0x5')](_0x371801,_0x4f29f7);};}exports[_0xef85('0x6')]=function(_0x3bd6a0){for(var _0x3aed65=0x0,_0x54e202=events[_0xef85('0x7')];_0x3aed65<_0x54e202;_0x3aed65++){var _0x1444b5=events[_0x3aed65];var _0x55efb1=createListener(_0xef85('0x8')+_0x1444b5,_0x3bd6a0);SmsQueueEvents['on'](_0x1444b5,_0x55efb1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2ec21ca..36ec6d4 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 _0xfddc=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','exports'];(function(_0x24756e,_0x135d57){var _0x1ea92d=function(_0x41892e){while(--_0x41892e){_0x24756e['push'](_0x24756e['shift']());}};_0x1ea92d(++_0x135d57);}(_0xfddc,0x1b8));var _0xcfdd=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xfddc[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0xcfdd('0x0'));var util=require(_0xcfdd('0x1'));var path=require('path');var timeout=require(_0xcfdd('0x2'));var express=require(_0xcfdd('0x3'));var router=express[_0xcfdd('0x4')]();var auth=require(_0xcfdd('0x5'));var interaction=require(_0xcfdd('0x6'));var config=require(_0xcfdd('0x7'));var controller=require(_0xcfdd('0x8'));router[_0xcfdd('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfdd('0xa')]);router['get']('/describe',auth[_0xcfdd('0xb')](),controller['describe']);router[_0xcfdd('0x9')](_0xcfdd('0xc'),auth[_0xcfdd('0xb')](),controller[_0xcfdd('0xd')]);router[_0xcfdd('0xe')]('/',auth[_0xcfdd('0xb')](),controller[_0xcfdd('0xf')]);router[_0xcfdd('0x10')](_0xcfdd('0xc'),auth['isAuthenticated'](),controller[_0xcfdd('0x11')]);router[_0xcfdd('0x12')](_0xcfdd('0xc'),auth[_0xcfdd('0xb')](),controller['destroy']);module[_0xcfdd('0x13')]=router; \ No newline at end of file +var _0x7bf4=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5c5043,_0x4ad678){var _0x2dd68f=function(_0x331faa){while(--_0x331faa){_0x5c5043['push'](_0x5c5043['shift']());}};_0x2dd68f(++_0x4ad678);}(_0x7bf4,0x188));var _0x47bf=function(_0x523cbf,_0x5f30ab){_0x523cbf=_0x523cbf-0x0;var _0x363509=_0x7bf4[_0x523cbf];return _0x363509;};'use strict';var multer=require(_0x47bf('0x0'));var util=require(_0x47bf('0x1'));var path=require(_0x47bf('0x2'));var timeout=require(_0x47bf('0x3'));var express=require(_0x47bf('0x4'));var router=express[_0x47bf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x47bf('0x6'));var config=require(_0x47bf('0x7'));var controller=require(_0x47bf('0x8'));router[_0x47bf('0x9')]('/',auth[_0x47bf('0xa')](),controller['index']);router[_0x47bf('0x9')](_0x47bf('0xb'),auth[_0x47bf('0xa')](),controller[_0x47bf('0xc')]);router['get'](_0x47bf('0xd'),auth['isAuthenticated'](),controller[_0x47bf('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x47bf('0xf')]);router[_0x47bf('0x10')](_0x47bf('0xd'),auth['isAuthenticated'](),controller[_0x47bf('0x11')]);router[_0x47bf('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x47bf('0x13')]);module[_0x47bf('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 960cf39..e8a135c 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 _0x92c2=['STRING','DATE','moment','exports'];(function(_0x9fd734,_0x4ab3ad){var _0x323151=function(_0x241b9f){while(--_0x241b9f){_0x9fd734['push'](_0x9fd734['shift']());}};_0x323151(++_0x4ab3ad);}(_0x92c2,0x13a));var _0x292c=function(_0x2d0787,_0x4d8f96){_0x2d0787=_0x2d0787-0x0;var _0xdbd864=_0x92c2[_0x2d0787];return _0xdbd864;};'use strict';var moment=require(_0x292c('0x0'));var Sequelize=require('sequelize');module[_0x292c('0x1')]={'uniqueid':{'type':Sequelize[_0x292c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x292c('0x2')]},'joinAt':{'type':Sequelize[_0x292c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x292c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x292c('0x2')]}}; \ No newline at end of file +var _0x952c=['DATE','sequelize','STRING'];(function(_0xb73c76,_0x59963f){var _0xe37125=function(_0x1d64b7){while(--_0x1d64b7){_0xb73c76['push'](_0xb73c76['shift']());}};_0xe37125(++_0x59963f);}(_0x952c,0x1d2));var _0xc952=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0x952c[_0x2c27ed];return _0x597bd1;};'use strict';var moment=require('moment');var Sequelize=require(_0xc952('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc952('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc952('0x2')]},'exitAt':{'type':Sequelize[_0xc952('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 348f28b..fa0ede1 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 _0xb039=['sort','where','pick','filter','VIRTUAL','options','includeAll','include','SmsQueueReport','show','params','merge','catch','create','update','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0x42bddc,_0x50d2bb){var _0x30cd86=function(_0x20164d){while(--_0x20164d){_0x42bddc['push'](_0x42bddc['shift']());}};_0x30cd86(++_0x50d2bb);}(_0xb039,0xa7));var _0x9b03=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xb039[_0x1e4f2d];return _0xd05ce5;};'use strict';var pdf=require(_0x9b03('0x0'));var emlformat=require(_0x9b03('0x1'));var rimraf=require(_0x9b03('0x2'));var zipdir=require(_0x9b03('0x3'));var jsonpatch=require(_0x9b03('0x4'));var rp=require(_0x9b03('0x5'));var moment=require(_0x9b03('0x6'));var BPromise=require(_0x9b03('0x7'));var Mustache=require('mustache');var util=require(_0x9b03('0x8'));var path=require(_0x9b03('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9b03('0xa'));var fs=require('fs');var _=require(_0x9b03('0xb'));var squel=require(_0x9b03('0xc'));var crypto=require(_0x9b03('0xd'));var jsforce=require(_0x9b03('0xe'));var deskjs=require(_0x9b03('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9b03('0x10'));var Papa=require('papaparse');var Redis=require(_0x9b03('0x11'));var authService=require(_0x9b03('0x12'));var qs=require(_0x9b03('0x13'));var as=require(_0x9b03('0x14'));var hardwareService=require(_0x9b03('0x15'));var logger=require('../../config/logger')(_0x9b03('0x16'));var utils=require(_0x9b03('0x17'));var config=require(_0x9b03('0x18'));var licenseUtil=require(_0x9b03('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a8d49,_0x29a78c){_0x29a78c=_0x29a78c||0xcc;return function(_0x4300c5){if(_0x4300c5){return _0x1a8d49[_0x9b03('0x1a')](_0x29a78c);}return _0x1a8d49[_0x9b03('0x1b')](_0x29a78c)[_0x9b03('0x1c')]();};}function respondWithResult(_0x27a308,_0x7d8ab7){_0x7d8ab7=_0x7d8ab7||0xc8;return function(_0x49846e){if(_0x49846e){return _0x27a308['status'](_0x7d8ab7)[_0x9b03('0x1d')](_0x49846e);}};}function respondWithFilteredResult(_0x4e2c73,_0x25a9b4){return function(_0x48ed8b){if(_0x48ed8b){var _0x15b7bb=_0x48ed8b[_0x9b03('0x1e')],_0x2bae3d=_0x25a9b4[_0x9b03('0x1f')],_0x5066ec=_0x25a9b4[_0x9b03('0x1f')]+_0x25a9b4[_0x9b03('0x20')],_0xea1cd8;if(_0x5066ec>=_0x15b7bb){_0x5066ec=_0x15b7bb;_0xea1cd8=0xc8;}else{_0xea1cd8=0xce;}_0x4e2c73[_0x9b03('0x1b')](_0xea1cd8);return _0x4e2c73[_0x9b03('0x21')](_0x9b03('0x22'),_0x2bae3d+'-'+_0x5066ec+'/'+_0x15b7bb)[_0x9b03('0x1d')](_0x48ed8b);}return null;};}function patchUpdates(_0x2d9fff){return function(_0x21b03b){try{jsonpatch['apply'](_0x21b03b,_0x2d9fff,!![]);}catch(_0x4f74db){return BPromise[_0x9b03('0x23')](_0x4f74db);}return _0x21b03b['save']();};}function saveUpdates(_0x5c3127,_0x4b8064){return function(_0xead3a0){if(_0xead3a0){return _0xead3a0['update'](_0x5c3127)[_0x9b03('0x24')](function(_0x2adc9e){return _0x2adc9e;});}return null;};}function removeEntity(_0x1f86f7,_0xf41c43){return function(_0x3d6b07){if(_0x3d6b07){return _0x3d6b07['destroy']()['then'](function(){_0x1f86f7[_0x9b03('0x1b')](0xcc)[_0x9b03('0x1c')]();});}};}function handleEntityNotFound(_0x607a94,_0x242a1b){return function(_0x33f519){if(!_0x33f519){_0x607a94['sendStatus'](0x194);}return _0x33f519;};}function handleError(_0x10e6f7,_0x58366b){_0x58366b=_0x58366b||0x1f4;return function(_0x116ddb){logger[_0x9b03('0x25')](_0x116ddb[_0x9b03('0x26')]);if(_0x116ddb[_0x9b03('0x27')]){delete _0x116ddb[_0x9b03('0x27')];}_0x10e6f7[_0x9b03('0x1b')](_0x58366b)['send'](_0x116ddb);};}exports[_0x9b03('0x28')]=function(_0xa7fc88,_0x545d13){var _0x2145b3={},_0x472f24={},_0x5637a7={'count':0x0,'rows':[]};var _0x5af8a5=_[_0x9b03('0x29')](db['SmsQueueReport'][_0x9b03('0x2a')],function(_0x548adf){return{'name':_0x548adf['fieldName'],'type':_0x548adf[_0x9b03('0x2b')][_0x9b03('0x2c')]};});_0x472f24[_0x9b03('0x2d')]=_['map'](_0x5af8a5,'name');_0x472f24[_0x9b03('0x2e')]=_[_0x9b03('0x2f')](_0xa7fc88['query']);_0x472f24[_0x9b03('0x30')]=_['intersection'](_0x472f24[_0x9b03('0x2d')],_0x472f24[_0x9b03('0x2e')]);_0x2145b3[_0x9b03('0x31')]=_[_0x9b03('0x32')](_0x472f24[_0x9b03('0x2d')],qs[_0x9b03('0x33')](_0xa7fc88['query'][_0x9b03('0x33')]));_0x2145b3[_0x9b03('0x31')]=_0x2145b3[_0x9b03('0x31')][_0x9b03('0x34')]?_0x2145b3[_0x9b03('0x31')]:_0x472f24[_0x9b03('0x2d')];if(!_0xa7fc88[_0x9b03('0x2e')]['hasOwnProperty'](_0x9b03('0x35'))){_0x2145b3[_0x9b03('0x20')]=qs[_0x9b03('0x20')](_0xa7fc88['query'][_0x9b03('0x20')]);_0x2145b3[_0x9b03('0x1f')]=qs[_0x9b03('0x1f')](_0xa7fc88['query'][_0x9b03('0x1f')]);}_0x2145b3[_0x9b03('0x36')]=qs[_0x9b03('0x37')](_0xa7fc88['query'][_0x9b03('0x37')]);_0x2145b3[_0x9b03('0x38')]=qs['filters'](_[_0x9b03('0x39')](_0xa7fc88['query'],_0x472f24['filters']),_0x5af8a5);if(_0xa7fc88[_0x9b03('0x2e')][_0x9b03('0x3a')]){_0x2145b3[_0x9b03('0x38')]=_['merge'](_0x2145b3['where'],{'$or':_['map'](_0x5af8a5,function(_0x333b1f){if(_0x333b1f[_0x9b03('0x2b')]!==_0x9b03('0x3b')){var _0x5a9aa9={};_0x5a9aa9[_0x333b1f[_0x9b03('0x27')]]={'$like':'%'+_0xa7fc88[_0x9b03('0x2e')]['filter']+'%'};return _0x5a9aa9;}})});}_0x2145b3=_['merge']({},_0x2145b3,_0xa7fc88[_0x9b03('0x3c')]);var _0x4123bc={'where':_0x2145b3[_0x9b03('0x38')]};return db['SmsQueueReport']['count'](_0x4123bc)[_0x9b03('0x24')](function(_0x352c3a){_0x5637a7['count']=_0x352c3a;if(_0xa7fc88[_0x9b03('0x2e')][_0x9b03('0x3d')]){_0x2145b3[_0x9b03('0x3e')]=[{'all':!![]}];}return db[_0x9b03('0x3f')]['findAll'](_0x2145b3);})[_0x9b03('0x24')](function(_0x461436){_0x5637a7['rows']=_0x461436;return _0x5637a7;})[_0x9b03('0x24')](respondWithFilteredResult(_0x545d13,_0x2145b3))['catch'](handleError(_0x545d13,null));};exports[_0x9b03('0x40')]=function(_0x5076d3,_0x28d6f5){var _0x1b3946={'raw':!![],'where':{'id':_0x5076d3[_0x9b03('0x41')]['id']}},_0x3a7778={};_0x3a7778['model']=_[_0x9b03('0x2f')](db[_0x9b03('0x3f')][_0x9b03('0x2a')]);_0x3a7778[_0x9b03('0x2e')]=_[_0x9b03('0x2f')](_0x5076d3[_0x9b03('0x2e')]);_0x3a7778[_0x9b03('0x30')]=_[_0x9b03('0x32')](_0x3a7778[_0x9b03('0x2d')],_0x3a7778[_0x9b03('0x2e')]);_0x1b3946[_0x9b03('0x31')]=_['intersection'](_0x3a7778[_0x9b03('0x2d')],qs[_0x9b03('0x33')](_0x5076d3['query'][_0x9b03('0x33')]));_0x1b3946['attributes']=_0x1b3946[_0x9b03('0x31')][_0x9b03('0x34')]?_0x1b3946[_0x9b03('0x31')]:_0x3a7778[_0x9b03('0x2d')];if(_0x5076d3[_0x9b03('0x2e')]['includeAll']){_0x1b3946[_0x9b03('0x3e')]=[{'all':!![]}];}_0x1b3946=_[_0x9b03('0x42')]({},_0x1b3946,_0x5076d3[_0x9b03('0x3c')]);return db[_0x9b03('0x3f')]['find'](_0x1b3946)[_0x9b03('0x24')](handleEntityNotFound(_0x28d6f5,null))[_0x9b03('0x24')](respondWithResult(_0x28d6f5,null))[_0x9b03('0x43')](handleError(_0x28d6f5,null));};exports['create']=function(_0x5a57b2,_0x4416d7){return db[_0x9b03('0x3f')][_0x9b03('0x44')](_0x5a57b2['body'],{})[_0x9b03('0x24')](respondWithResult(_0x4416d7,0xc9))[_0x9b03('0x43')](handleError(_0x4416d7,null));};exports[_0x9b03('0x45')]=function(_0x4df8c4,_0xe3c7e1){if(_0x4df8c4[_0x9b03('0x46')]['id']){delete _0x4df8c4['body']['id'];}return db[_0x9b03('0x3f')][_0x9b03('0x47')]({'where':{'id':_0x4df8c4[_0x9b03('0x41')]['id']}})['then'](handleEntityNotFound(_0xe3c7e1,null))[_0x9b03('0x24')](saveUpdates(_0x4df8c4['body'],null))['then'](respondWithResult(_0xe3c7e1,null))['catch'](handleError(_0xe3c7e1,null));};exports[_0x9b03('0x48')]=function(_0x1e1944,_0x2ff280){return db['SmsQueueReport'][_0x9b03('0x47')]({'where':{'id':_0x1e1944[_0x9b03('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ff280,null))['then'](removeEntity(_0x2ff280,null))[_0x9b03('0x43')](handleError(_0x2ff280,null));};exports[_0x9b03('0x49')]=function(_0x37a958,_0x6d69bb){return db['SmsQueueReport'][_0x9b03('0x49')]()[_0x9b03('0x24')](respondWithResult(_0x6d69bb,null))[_0x9b03('0x43')](handleError(_0x6d69bb,null));}; \ No newline at end of file +var _0xdfd1=['VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters'];(function(_0x3da2c1,_0x5534ec){var _0x53c430=function(_0x4f1e57){while(--_0x4f1e57){_0x3da2c1['push'](_0x3da2c1['shift']());}};_0x53c430(++_0x5534ec);}(_0xdfd1,0x1e4));var _0x1dfd=function(_0x3c4a2b,_0x553598){_0x3c4a2b=_0x3c4a2b-0x0;var _0x30add8=_0xdfd1[_0x3c4a2b];return _0x30add8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1dfd('0x0'));var rimraf=require(_0x1dfd('0x1'));var zipdir=require(_0x1dfd('0x2'));var jsonpatch=require(_0x1dfd('0x3'));var rp=require(_0x1dfd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1dfd('0x5'));var util=require(_0x1dfd('0x6'));var path=require(_0x1dfd('0x7'));var sox=require(_0x1dfd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1dfd('0x9'));var squel=require(_0x1dfd('0xa'));var crypto=require(_0x1dfd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1dfd('0xc'));var toCsv=require(_0x1dfd('0xd'));var querystring=require(_0x1dfd('0xe'));var Papa=require(_0x1dfd('0xf'));var Redis=require(_0x1dfd('0x10'));var authService=require(_0x1dfd('0x11'));var qs=require(_0x1dfd('0x12'));var as=require(_0x1dfd('0x13'));var hardwareService=require(_0x1dfd('0x14'));var logger=require(_0x1dfd('0x15'))(_0x1dfd('0x16'));var utils=require(_0x1dfd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1dfd('0x18'));var db=require(_0x1dfd('0x19'))['db'];function respondWithStatusCode(_0x82dd1f,_0x1ebbff){_0x1ebbff=_0x1ebbff||0xcc;return function(_0x373a7b){if(_0x373a7b){return _0x82dd1f[_0x1dfd('0x1a')](_0x1ebbff);}return _0x82dd1f[_0x1dfd('0x1b')](_0x1ebbff)[_0x1dfd('0x1c')]();};}function respondWithResult(_0x3decde,_0x2ea3d5){_0x2ea3d5=_0x2ea3d5||0xc8;return function(_0x30a715){if(_0x30a715){return _0x3decde[_0x1dfd('0x1b')](_0x2ea3d5)[_0x1dfd('0x1d')](_0x30a715);}};}function respondWithFilteredResult(_0x28a118,_0x4e3ed5){return function(_0x540893){if(_0x540893){var _0x210f73=_0x540893['count'],_0x434937=_0x4e3ed5[_0x1dfd('0x1e')],_0x16c6c1=_0x4e3ed5[_0x1dfd('0x1e')]+_0x4e3ed5['limit'],_0x43ed0a;if(_0x16c6c1>=_0x210f73){_0x16c6c1=_0x210f73;_0x43ed0a=0xc8;}else{_0x43ed0a=0xce;}_0x28a118[_0x1dfd('0x1b')](_0x43ed0a);return _0x28a118['set'](_0x1dfd('0x1f'),_0x434937+'-'+_0x16c6c1+'/'+_0x210f73)[_0x1dfd('0x1d')](_0x540893);}return null;};}function patchUpdates(_0x3de2df){return function(_0x4ca5f9){try{jsonpatch[_0x1dfd('0x20')](_0x4ca5f9,_0x3de2df,!![]);}catch(_0x4342a0){return BPromise[_0x1dfd('0x21')](_0x4342a0);}return _0x4ca5f9[_0x1dfd('0x22')]();};}function saveUpdates(_0x2c4a11,_0xc21776){return function(_0x43c3f1){if(_0x43c3f1){return _0x43c3f1[_0x1dfd('0x23')](_0x2c4a11)[_0x1dfd('0x24')](function(_0x132ab8){return _0x132ab8;});}return null;};}function removeEntity(_0x50f81d,_0x433848){return function(_0x2df1d4){if(_0x2df1d4){return _0x2df1d4[_0x1dfd('0x25')]()[_0x1dfd('0x24')](function(){_0x50f81d[_0x1dfd('0x1b')](0xcc)[_0x1dfd('0x1c')]();});}};}function handleEntityNotFound(_0x338db4,_0x571fa5){return function(_0x29e665){if(!_0x29e665){_0x338db4[_0x1dfd('0x1a')](0x194);}return _0x29e665;};}function handleError(_0x38a6c6,_0x4a26f0){_0x4a26f0=_0x4a26f0||0x1f4;return function(_0x1b7b06){logger[_0x1dfd('0x26')](_0x1b7b06[_0x1dfd('0x27')]);if(_0x1b7b06[_0x1dfd('0x28')]){delete _0x1b7b06[_0x1dfd('0x28')];}_0x38a6c6['status'](_0x4a26f0)['send'](_0x1b7b06);};}exports[_0x1dfd('0x29')]=function(_0x342ce5,_0x4944ed){var _0x19bb03={},_0x4f4e64={},_0x50db73={'count':0x0,'rows':[]};var _0xa1554=_[_0x1dfd('0x2a')](db[_0x1dfd('0x2b')][_0x1dfd('0x2c')],function(_0x37ac44){return{'name':_0x37ac44[_0x1dfd('0x2d')],'type':_0x37ac44[_0x1dfd('0x2e')][_0x1dfd('0x2f')]};});_0x4f4e64['model']=_[_0x1dfd('0x2a')](_0xa1554,_0x1dfd('0x28'));_0x4f4e64[_0x1dfd('0x30')]=_[_0x1dfd('0x31')](_0x342ce5['query']);_0x4f4e64['filters']=_['intersection'](_0x4f4e64['model'],_0x4f4e64[_0x1dfd('0x30')]);_0x19bb03[_0x1dfd('0x32')]=_[_0x1dfd('0x33')](_0x4f4e64[_0x1dfd('0x34')],qs[_0x1dfd('0x35')](_0x342ce5[_0x1dfd('0x30')]['fields']));_0x19bb03[_0x1dfd('0x32')]=_0x19bb03[_0x1dfd('0x32')][_0x1dfd('0x36')]?_0x19bb03[_0x1dfd('0x32')]:_0x4f4e64[_0x1dfd('0x34')];if(!_0x342ce5[_0x1dfd('0x30')][_0x1dfd('0x37')](_0x1dfd('0x38'))){_0x19bb03[_0x1dfd('0x39')]=qs[_0x1dfd('0x39')](_0x342ce5[_0x1dfd('0x30')][_0x1dfd('0x39')]);_0x19bb03[_0x1dfd('0x1e')]=qs[_0x1dfd('0x1e')](_0x342ce5['query'][_0x1dfd('0x1e')]);}_0x19bb03[_0x1dfd('0x3a')]=qs[_0x1dfd('0x3b')](_0x342ce5[_0x1dfd('0x30')][_0x1dfd('0x3b')]);_0x19bb03[_0x1dfd('0x3c')]=qs[_0x1dfd('0x3d')](_['pick'](_0x342ce5['query'],_0x4f4e64['filters']),_0xa1554);if(_0x342ce5[_0x1dfd('0x30')]['filter']){_0x19bb03[_0x1dfd('0x3c')]=_['merge'](_0x19bb03['where'],{'$or':_[_0x1dfd('0x2a')](_0xa1554,function(_0x510c8c){if(_0x510c8c['type']!==_0x1dfd('0x3e')){var _0x3a1b64={};_0x3a1b64[_0x510c8c[_0x1dfd('0x28')]]={'$like':'%'+_0x342ce5['query'][_0x1dfd('0x3f')]+'%'};return _0x3a1b64;}})});}_0x19bb03=_[_0x1dfd('0x40')]({},_0x19bb03,_0x342ce5[_0x1dfd('0x41')]);var _0xfeee3b={'where':_0x19bb03[_0x1dfd('0x3c')]};return db[_0x1dfd('0x2b')][_0x1dfd('0x42')](_0xfeee3b)[_0x1dfd('0x24')](function(_0x21b49b){_0x50db73[_0x1dfd('0x42')]=_0x21b49b;if(_0x342ce5['query'][_0x1dfd('0x43')]){_0x19bb03[_0x1dfd('0x44')]=[{'all':!![]}];}return db[_0x1dfd('0x2b')][_0x1dfd('0x45')](_0x19bb03);})[_0x1dfd('0x24')](function(_0x37790c){_0x50db73[_0x1dfd('0x46')]=_0x37790c;return _0x50db73;})[_0x1dfd('0x24')](respondWithFilteredResult(_0x4944ed,_0x19bb03))[_0x1dfd('0x47')](handleError(_0x4944ed,null));};exports[_0x1dfd('0x48')]=function(_0x3a215d,_0x1af836){var _0x420a19={'raw':!![],'where':{'id':_0x3a215d[_0x1dfd('0x49')]['id']}},_0x58e0e8={};_0x58e0e8[_0x1dfd('0x34')]=_[_0x1dfd('0x31')](db[_0x1dfd('0x2b')][_0x1dfd('0x2c')]);_0x58e0e8[_0x1dfd('0x30')]=_['keys'](_0x3a215d[_0x1dfd('0x30')]);_0x58e0e8[_0x1dfd('0x3d')]=_[_0x1dfd('0x33')](_0x58e0e8['model'],_0x58e0e8[_0x1dfd('0x30')]);_0x420a19['attributes']=_['intersection'](_0x58e0e8['model'],qs['fields'](_0x3a215d[_0x1dfd('0x30')]['fields']));_0x420a19[_0x1dfd('0x32')]=_0x420a19[_0x1dfd('0x32')]['length']?_0x420a19[_0x1dfd('0x32')]:_0x58e0e8[_0x1dfd('0x34')];if(_0x3a215d[_0x1dfd('0x30')][_0x1dfd('0x43')]){_0x420a19[_0x1dfd('0x44')]=[{'all':!![]}];}_0x420a19=_[_0x1dfd('0x40')]({},_0x420a19,_0x3a215d[_0x1dfd('0x41')]);return db['SmsQueueReport'][_0x1dfd('0x4a')](_0x420a19)[_0x1dfd('0x24')](handleEntityNotFound(_0x1af836,null))['then'](respondWithResult(_0x1af836,null))[_0x1dfd('0x47')](handleError(_0x1af836,null));};exports[_0x1dfd('0x4b')]=function(_0x185429,_0x18fb71){return db['SmsQueueReport'][_0x1dfd('0x4b')](_0x185429[_0x1dfd('0x4c')],{})['then'](respondWithResult(_0x18fb71,0xc9))['catch'](handleError(_0x18fb71,null));};exports['update']=function(_0x2147a3,_0x441eca){if(_0x2147a3['body']['id']){delete _0x2147a3[_0x1dfd('0x4c')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x2147a3[_0x1dfd('0x49')]['id']}})[_0x1dfd('0x24')](handleEntityNotFound(_0x441eca,null))[_0x1dfd('0x24')](saveUpdates(_0x2147a3[_0x1dfd('0x4c')],null))[_0x1dfd('0x24')](respondWithResult(_0x441eca,null))['catch'](handleError(_0x441eca,null));};exports['destroy']=function(_0x3132a5,_0x5492af){return db[_0x1dfd('0x2b')][_0x1dfd('0x4a')]({'where':{'id':_0x3132a5['params']['id']}})['then'](handleEntityNotFound(_0x5492af,null))[_0x1dfd('0x24')](removeEntity(_0x5492af,null))[_0x1dfd('0x47')](handleError(_0x5492af,null));};exports[_0x1dfd('0x4d')]=function(_0x4dbfdb,_0x180ab1){return db['SmsQueueReport'][_0x1dfd('0x4d')]()['then'](respondWithResult(_0x180ab1,null))['catch'](handleError(_0x180ab1,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 186a455..1c55caa 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 _0x3893=['moment','bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports','SmsQueueReport','uniqueid','../../config/logger','api'];(function(_0x40cb8c,_0x2b5a24){var _0x275fd2=function(_0x187c3d){while(--_0x187c3d){_0x40cb8c['push'](_0x40cb8c['shift']());}};_0x275fd2(++_0x2b5a24);}(_0x3893,0x169));var _0x3389=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x3893[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3389('0x0'))(_0x3389('0x1'));var moment=require(_0x3389('0x2'));var BPromise=require(_0x3389('0x3'));var rp=require(_0x3389('0x4'));var fs=require('fs');var path=require(_0x3389('0x5'));var rimraf=require('rimraf');var config=require(_0x3389('0x6'));var attributes=require(_0x3389('0x7'));module[_0x3389('0x8')]=function(_0x241e2f,_0x28865f){return _0x241e2f['define'](_0x3389('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3389('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c06=['uniqueid','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','report_sms_queue'];(function(_0x2ac432,_0x34f760){var _0x50d1b2=function(_0x359514){while(--_0x359514){_0x2ac432['push'](_0x2ac432['shift']());}};_0x50d1b2(++_0x34f760);}(_0x4c06,0x9a));var _0x64c0=function(_0x185d2a,_0x308609){_0x185d2a=_0x185d2a-0x0;var _0x4dea27=_0x4c06[_0x185d2a];return _0x4dea27;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x64c0('0x0'));var moment=require(_0x64c0('0x1'));var BPromise=require(_0x64c0('0x2'));var rp=require(_0x64c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64c0('0x4'));var config=require(_0x64c0('0x5'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x82a4e6,_0x2b52a8){return _0x82a4e6[_0x64c0('0x6')]('SmsQueueReport',attributes,{'tableName':_0x64c0('0x7'),'paranoid':![],'indexes':[{'name':_0x64c0('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7c53e6f..af497a1 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 _0x1095=['options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SmsQueueReport','create','body'];(function(_0x2c1e2e,_0x1e8b2a){var _0x536e3b=function(_0x1cd555){while(--_0x1cd555){_0x2c1e2e['push'](_0x2c1e2e['shift']());}};_0x536e3b(++_0x1e8b2a);}(_0x1095,0x140));var _0x5109=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x1095[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x5109('0x0'));var util=require('util');var moment=require(_0x5109('0x1'));var BPromise=require(_0x5109('0x2'));var rs=require(_0x5109('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5109('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5109('0x5'))(_0x5109('0x6'));var config=require(_0x5109('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5109('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cd829,_0x488eb8,_0x4a6919){return new BPromise(function(_0x5cdfea,_0x17f3a6){return client['request'](_0x4cd829,_0x4a6919)['then'](function(_0x54d968){logger[_0x5109('0x9')](_0x5109('0xa'),_0x488eb8,_0x5109('0xb'));logger[_0x5109('0xc')](_0x5109('0xd'),_0x488eb8,_0x5109('0xb'),JSON['stringify'](_0x54d968));if(_0x54d968['error']){if(_0x54d968[_0x5109('0xe')][_0x5109('0xf')]===0x1f4){logger[_0x5109('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x488eb8,_0x54d968[_0x5109('0xe')][_0x5109('0x10')]);return _0x17f3a6(_0x54d968[_0x5109('0xe')][_0x5109('0x10')]);}logger['error'](_0x5109('0xa'),_0x488eb8,_0x54d968[_0x5109('0xe')][_0x5109('0x10')]);return _0x5cdfea(_0x54d968['error']['message']);}else{logger[_0x5109('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x488eb8,_0x5109('0xb'));_0x5cdfea(_0x54d968['result'][_0x5109('0x10')]);}})[_0x5109('0x11')](function(_0x298965){logger[_0x5109('0xe')](_0x5109('0xa'),_0x488eb8,_0x298965);_0x17f3a6(_0x298965);});});}exports['CreateSmsQueueReport']=function(_0x35e0fe){var _0x5212db=this;return new Promise(function(_0x42a7db,_0xf03595){return db[_0x5109('0x12')][_0x5109('0x13')](_0x35e0fe[_0x5109('0x14')],{'raw':_0x35e0fe[_0x5109('0x15')]?_0x35e0fe[_0x5109('0x15')][_0x5109('0x16')]===undefined?!![]:![]:!![]})[_0x5109('0x17')](function(_0x15959f){logger[_0x5109('0x9')](_0x5109('0x18'),_0x35e0fe);logger[_0x5109('0xc')](_0x5109('0x18'),_0x35e0fe,JSON['stringify'](_0x15959f));_0x42a7db(_0x15959f);})['catch'](function(_0x22ad1b){logger[_0x5109('0xe')](_0x5109('0x18'),_0x22ad1b[_0x5109('0x10')],_0x35e0fe);_0xf03595(_0x5212db['error'](0x1f4,_0x22ad1b[_0x5109('0x10')]));});});};exports[_0x5109('0x19')]=function(_0x47ea33){var _0x3f58f8=this;return new Promise(function(_0x1466ab,_0x584c5f){return db[_0x5109('0x12')][_0x5109('0x1a')](_0x47ea33[_0x5109('0x14')],{'raw':_0x47ea33[_0x5109('0x15')]?_0x47ea33[_0x5109('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ea33['options']?_0x47ea33[_0x5109('0x15')][_0x5109('0x1b')]||null:null,'attributes':_0x47ea33[_0x5109('0x15')]?_0x47ea33[_0x5109('0x15')][_0x5109('0x1c')]||null:null,'limit':_0x47ea33[_0x5109('0x15')]?_0x47ea33[_0x5109('0x15')][_0x5109('0x1d')]||null:null})[_0x5109('0x17')](function(_0xdfd6a0){logger[_0x5109('0x9')](_0x5109('0x19'),_0x47ea33);logger['debug']('UpdateSmsQueueReport',_0x47ea33,JSON[_0x5109('0x1e')](_0xdfd6a0));_0x1466ab(_0xdfd6a0);})[_0x5109('0x11')](function(_0x4865c2){logger['error'](_0x5109('0x19'),_0x4865c2[_0x5109('0x10')],_0x47ea33);_0x584c5f(_0x3f58f8[_0x5109('0xe')](0x1f4,_0x4865c2['message']));});});}; \ No newline at end of file +var _0x238f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','debug','UpdateSmsQueueReport','update','body','where','attributes','limit','stringify','lodash','util','moment'];(function(_0x499ca5,_0x4986cf){var _0x7bfd9c=function(_0x36fe88){while(--_0x36fe88){_0x499ca5['push'](_0x499ca5['shift']());}};_0x7bfd9c(++_0x4986cf);}(_0x238f,0x66));var _0xf238=function(_0x29f229,_0x5ada66){_0x29f229=_0x29f229-0x0;var _0x27ae41=_0x238f[_0x29f229];return _0x27ae41;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var moment=require(_0xf238('0x2'));var BPromise=require(_0xf238('0x3'));var rs=require(_0xf238('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf238('0x5'))['db'];var utils=require(_0xf238('0x6'));var logger=require(_0xf238('0x7'))(_0xf238('0x8'));var config=require(_0xf238('0x9'));var jayson=require(_0xf238('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x131c73,_0x150e9a,_0x10ebb3){return new BPromise(function(_0x316cdb,_0x1e1005){return client[_0xf238('0xb')](_0x131c73,_0x10ebb3)[_0xf238('0xc')](function(_0x49364c){logger['info'](_0xf238('0xd'),_0x150e9a,_0xf238('0xe'));logger['debug'](_0xf238('0xf'),_0x150e9a,_0xf238('0xe'),JSON['stringify'](_0x49364c));if(_0x49364c[_0xf238('0x10')]){if(_0x49364c[_0xf238('0x10')][_0xf238('0x11')]===0x1f4){logger[_0xf238('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x150e9a,_0x49364c[_0xf238('0x10')][_0xf238('0x12')]);return _0x1e1005(_0x49364c[_0xf238('0x10')][_0xf238('0x12')]);}logger[_0xf238('0x10')](_0xf238('0xd'),_0x150e9a,_0x49364c[_0xf238('0x10')]['message']);return _0x316cdb(_0x49364c[_0xf238('0x10')]['message']);}else{logger[_0xf238('0x13')](_0xf238('0xd'),_0x150e9a,_0xf238('0xe'));_0x316cdb(_0x49364c[_0xf238('0x14')][_0xf238('0x12')]);}})[_0xf238('0x15')](function(_0x2a3e10){logger[_0xf238('0x10')](_0xf238('0xd'),_0x150e9a,_0x2a3e10);_0x1e1005(_0x2a3e10);});});}exports[_0xf238('0x16')]=function(_0x26e87e){var _0xa0d2f3=this;return new Promise(function(_0x1eda38,_0x545992){return db[_0xf238('0x17')][_0xf238('0x18')](_0x26e87e['body'],{'raw':_0x26e87e[_0xf238('0x19')]?_0x26e87e[_0xf238('0x19')][_0xf238('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x164971){logger[_0xf238('0x13')](_0xf238('0x16'),_0x26e87e);logger[_0xf238('0x1b')](_0xf238('0x16'),_0x26e87e,JSON['stringify'](_0x164971));_0x1eda38(_0x164971);})[_0xf238('0x15')](function(_0x5eca38){logger[_0xf238('0x10')]('CreateSmsQueueReport',_0x5eca38[_0xf238('0x12')],_0x26e87e);_0x545992(_0xa0d2f3[_0xf238('0x10')](0x1f4,_0x5eca38['message']));});});};exports[_0xf238('0x1c')]=function(_0x8bd04b){var _0x57890f=this;return new Promise(function(_0x280680,_0x4829ae){return db[_0xf238('0x17')][_0xf238('0x1d')](_0x8bd04b[_0xf238('0x1e')],{'raw':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b[_0xf238('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b[_0xf238('0x19')][_0xf238('0x1f')]||null:null,'attributes':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b['options'][_0xf238('0x20')]||null:null,'limit':_0x8bd04b[_0xf238('0x19')]?_0x8bd04b['options'][_0xf238('0x21')]||null:null})[_0xf238('0xc')](function(_0x441798){logger['info'](_0xf238('0x1c'),_0x8bd04b);logger[_0xf238('0x1b')](_0xf238('0x1c'),_0x8bd04b,JSON[_0xf238('0x22')](_0x441798));_0x280680(_0x441798);})['catch'](function(_0x5e3029){logger[_0xf238('0x10')](_0xf238('0x1c'),_0x5e3029[_0xf238('0x12')],_0x8bd04b);_0x4829ae(_0x57890f['error'](0x1f4,_0x5e3029[_0xf238('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9d3b4ad..49da676 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 _0xd7d1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x4d3f5f,_0x550c84){_0x4d3f5f=_0x4d3f5f-0x0;var _0x5e1c01=_0xd7d1[_0x4d3f5f];return _0x5e1c01;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var auth=require(_0x1d7d('0x6'));var interaction=require(_0x1d7d('0x7'));var config=require(_0x1d7d('0x8'));var controller=require(_0x1d7d('0x9'));router[_0x1d7d('0xa')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xc')]);router['get'](_0x1d7d('0xd'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xa')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0x13')]('/:id',auth[_0x1d7d('0xb')](),controller['update']);router[_0x1d7d('0x14')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1339=['./smsTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x1339,0x1ed));var _0x9133=function(_0x20ac67,_0x237d66){_0x20ac67=_0x20ac67-0x0;var _0x4b165e=_0x1339[_0x20ac67];return _0x4b165e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var auth=require(_0x9133('0x4'));var interaction=require(_0x9133('0x5'));var config=require(_0x9133('0x6'));var controller=require(_0x9133('0x7'));router['get']('/',auth[_0x9133('0x8')](),controller[_0x9133('0x9')]);router[_0x9133('0xa')]('/describe',auth[_0x9133('0x8')](),controller[_0x9133('0xb')]);router[_0x9133('0xa')](_0x9133('0xc'),auth[_0x9133('0x8')](),controller[_0x9133('0xd')]);router[_0x9133('0xe')]('/',auth[_0x9133('0x8')](),controller[_0x9133('0xf')]);router[_0x9133('0x10')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xc'),auth[_0x9133('0x8')](),controller[_0x9133('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 4c906f6..652609f 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 _0x4c3e=['queue','DATE','NOW','exports','ENUM','account','agent'];(function(_0xfd4c63,_0x30aa74){var _0x24225a=function(_0x1ac8da){while(--_0x1ac8da){_0xfd4c63['push'](_0xfd4c63['shift']());}};_0x24225a(++_0x30aa74);}(_0x4c3e,0x1ae));var _0xe4c3=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4c3e[_0x47b58b];return _0x46bebe;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe4c3('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe4c3('0x1')](_0xe4c3('0x2'),_0xe4c3('0x3'),_0xe4c3('0x4')),'allowNull':![],'defaultValue':_0xe4c3('0x4')},'transferredAt':{'type':Sequelize[_0xe4c3('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe4c3('0x6')]}}; \ No newline at end of file +var _0x728f=['agent','queue','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1ca040,_0x3c9f94){var _0x24ba3f=function(_0x299609){while(--_0x299609){_0x1ca040['push'](_0x1ca040['shift']());}};_0x24ba3f(++_0x3c9f94);}(_0x728f,0xd3));var _0xf728=function(_0x3a11ce,_0x3b203e){_0x3a11ce=_0x3a11ce-0x0;var _0x159267=_0x728f[_0x3a11ce];return _0x159267;};'use strict';var moment=require(_0xf728('0x0'));var Sequelize=require(_0xf728('0x1'));module[_0xf728('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf728('0x3')](_0xf728('0x4'),_0xf728('0x5'),'queue'),'allowNull':![],'defaultValue':_0xf728('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf728('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b4e230c..dac32db 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 _0x323b=['Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','SmsTransferReport','rawAttributes','key','name','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1f51e2,_0x3b40af){var _0x579f54=function(_0x4d4e9c){while(--_0x4d4e9c){_0x1f51e2['push'](_0x1f51e2['shift']());}};_0x579f54(++_0x3b40af);}(_0x323b,0x1ad));var _0xb323=function(_0x27ff8d,_0x3a5f5a){_0x27ff8d=_0x27ff8d-0x0;var _0x33ff86=_0x323b[_0x27ff8d];return _0x33ff86;};'use strict';var pdf=require(_0xb323('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb323('0x1'));var zipdir=require(_0xb323('0x2'));var jsonpatch=require(_0xb323('0x3'));var rp=require('request-promise');var moment=require(_0xb323('0x4'));var BPromise=require(_0xb323('0x5'));var Mustache=require(_0xb323('0x6'));var util=require(_0xb323('0x7'));var path=require(_0xb323('0x8'));var sox=require(_0xb323('0x9'));var csv=require(_0xb323('0xa'));var ejs=require(_0xb323('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb323('0xc'));var jsforce=require(_0xb323('0xd'));var deskjs=require(_0xb323('0xe'));var toCsv=require(_0xb323('0xa'));var querystring=require('querystring');var Papa=require(_0xb323('0xf'));var Redis=require(_0xb323('0x10'));var authService=require(_0xb323('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb323('0x12'));var hardwareService=require(_0xb323('0x13'));var logger=require(_0xb323('0x14'))(_0xb323('0x15'));var utils=require(_0xb323('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb323('0x17'));var db=require(_0xb323('0x18'))['db'];function respondWithStatusCode(_0x4c1bf1,_0x2f03f0){_0x2f03f0=_0x2f03f0||0xcc;return function(_0x524bf7){if(_0x524bf7){return _0x4c1bf1[_0xb323('0x19')](_0x2f03f0);}return _0x4c1bf1[_0xb323('0x1a')](_0x2f03f0)[_0xb323('0x1b')]();};}function respondWithResult(_0x51117c,_0x3a4c5f){_0x3a4c5f=_0x3a4c5f||0xc8;return function(_0x18c341){if(_0x18c341){return _0x51117c[_0xb323('0x1a')](_0x3a4c5f)[_0xb323('0x1c')](_0x18c341);}};}function respondWithFilteredResult(_0x41a47d,_0x57e9a0){return function(_0xb56df2){if(_0xb56df2){var _0xb3dd4=_0xb56df2[_0xb323('0x1d')],_0x3584e3=_0x57e9a0[_0xb323('0x1e')],_0x2701ce=_0x57e9a0['offset']+_0x57e9a0[_0xb323('0x1f')],_0x4a813b;if(_0x2701ce>=_0xb3dd4){_0x2701ce=_0xb3dd4;_0x4a813b=0xc8;}else{_0x4a813b=0xce;}_0x41a47d[_0xb323('0x1a')](_0x4a813b);return _0x41a47d[_0xb323('0x20')](_0xb323('0x21'),_0x3584e3+'-'+_0x2701ce+'/'+_0xb3dd4)[_0xb323('0x1c')](_0xb56df2);}return null;};}function patchUpdates(_0x57aeb1){return function(_0x3efcf7){try{jsonpatch[_0xb323('0x22')](_0x3efcf7,_0x57aeb1,!![]);}catch(_0x472399){return BPromise['reject'](_0x472399);}return _0x3efcf7[_0xb323('0x23')]();};}function saveUpdates(_0x5d5f32,_0x2fc9a5){return function(_0x316b69){if(_0x316b69){return _0x316b69[_0xb323('0x24')](_0x5d5f32)[_0xb323('0x25')](function(_0x308134){return _0x308134;});}return null;};}function removeEntity(_0x4afcd0,_0x5318a2){return function(_0x16b127){if(_0x16b127){return _0x16b127[_0xb323('0x26')]()[_0xb323('0x25')](function(){_0x4afcd0['status'](0xcc)[_0xb323('0x1b')]();});}};}function handleEntityNotFound(_0x14b549,_0x2b5ea2){return function(_0x41ccca){if(!_0x41ccca){_0x14b549[_0xb323('0x19')](0x194);}return _0x41ccca;};}function handleError(_0x4bffd0,_0x2c2c5e){_0x2c2c5e=_0x2c2c5e||0x1f4;return function(_0x5ea703){logger[_0xb323('0x27')](_0x5ea703[_0xb323('0x28')]);if(_0x5ea703['name']){delete _0x5ea703['name'];}_0x4bffd0['status'](_0x2c2c5e)[_0xb323('0x29')](_0x5ea703);};}exports[_0xb323('0x2a')]=function(_0x4466be,_0x28317e){var _0x3961dc={},_0x4406a0={},_0x8e6f8f={'count':0x0,'rows':[]};var _0x3e887b=_[_0xb323('0x2b')](db[_0xb323('0x2c')][_0xb323('0x2d')],function(_0x45bd66){return{'name':_0x45bd66['fieldName'],'type':_0x45bd66['type'][_0xb323('0x2e')]};});_0x4406a0['model']=_[_0xb323('0x2b')](_0x3e887b,_0xb323('0x2f'));_0x4406a0['query']=_[_0xb323('0x30')](_0x4466be[_0xb323('0x31')]);_0x4406a0['filters']=_[_0xb323('0x32')](_0x4406a0['model'],_0x4406a0[_0xb323('0x31')]);_0x3961dc[_0xb323('0x33')]=_[_0xb323('0x32')](_0x4406a0[_0xb323('0x34')],qs[_0xb323('0x35')](_0x4466be[_0xb323('0x31')][_0xb323('0x35')]));_0x3961dc[_0xb323('0x33')]=_0x3961dc[_0xb323('0x33')]['length']?_0x3961dc['attributes']:_0x4406a0[_0xb323('0x34')];if(!_0x4466be[_0xb323('0x31')][_0xb323('0x36')](_0xb323('0x37'))){_0x3961dc[_0xb323('0x1f')]=qs[_0xb323('0x1f')](_0x4466be['query']['limit']);_0x3961dc[_0xb323('0x1e')]=qs[_0xb323('0x1e')](_0x4466be[_0xb323('0x31')][_0xb323('0x1e')]);}_0x3961dc[_0xb323('0x38')]=qs[_0xb323('0x39')](_0x4466be['query'][_0xb323('0x39')]);_0x3961dc['where']=qs[_0xb323('0x3a')](_[_0xb323('0x3b')](_0x4466be[_0xb323('0x31')],_0x4406a0[_0xb323('0x3a')]),_0x3e887b);if(_0x4466be[_0xb323('0x31')][_0xb323('0x3c')]){_0x3961dc[_0xb323('0x3d')]=_[_0xb323('0x3e')](_0x3961dc[_0xb323('0x3d')],{'$or':_['map'](_0x3e887b,function(_0x40e311){if(_0x40e311[_0xb323('0x3f')]!==_0xb323('0x40')){var _0x306ff5={};_0x306ff5[_0x40e311['name']]={'$like':'%'+_0x4466be[_0xb323('0x31')]['filter']+'%'};return _0x306ff5;}})});}_0x3961dc=_[_0xb323('0x3e')]({},_0x3961dc,_0x4466be['options']);var _0x49d066={'where':_0x3961dc[_0xb323('0x3d')]};return db['SmsTransferReport'][_0xb323('0x1d')](_0x49d066)[_0xb323('0x25')](function(_0x10881f){_0x8e6f8f[_0xb323('0x1d')]=_0x10881f;if(_0x4466be[_0xb323('0x31')][_0xb323('0x41')]){_0x3961dc[_0xb323('0x42')]=[{'all':!![]}];}return db[_0xb323('0x2c')][_0xb323('0x43')](_0x3961dc);})[_0xb323('0x25')](function(_0x43f8a3){_0x8e6f8f[_0xb323('0x44')]=_0x43f8a3;return _0x8e6f8f;})['then'](respondWithFilteredResult(_0x28317e,_0x3961dc))[_0xb323('0x45')](handleError(_0x28317e,null));};exports['show']=function(_0x2026f5,_0x4c4b8b){var _0x5e427e={'raw':!![],'where':{'id':_0x2026f5[_0xb323('0x46')]['id']}},_0x478a14={};_0x478a14[_0xb323('0x34')]=_['keys'](db[_0xb323('0x2c')][_0xb323('0x2d')]);_0x478a14[_0xb323('0x31')]=_[_0xb323('0x30')](_0x2026f5['query']);_0x478a14[_0xb323('0x3a')]=_[_0xb323('0x32')](_0x478a14[_0xb323('0x34')],_0x478a14[_0xb323('0x31')]);_0x5e427e['attributes']=_[_0xb323('0x32')](_0x478a14[_0xb323('0x34')],qs[_0xb323('0x35')](_0x2026f5[_0xb323('0x31')]['fields']));_0x5e427e[_0xb323('0x33')]=_0x5e427e['attributes'][_0xb323('0x47')]?_0x5e427e[_0xb323('0x33')]:_0x478a14['model'];if(_0x2026f5[_0xb323('0x31')][_0xb323('0x41')]){_0x5e427e[_0xb323('0x42')]=[{'all':!![]}];}_0x5e427e=_['merge']({},_0x5e427e,_0x2026f5[_0xb323('0x48')]);return db[_0xb323('0x2c')]['find'](_0x5e427e)['then'](handleEntityNotFound(_0x4c4b8b,null))[_0xb323('0x25')](respondWithResult(_0x4c4b8b,null))[_0xb323('0x45')](handleError(_0x4c4b8b,null));};exports['create']=function(_0x53965d,_0x8954ae){return db[_0xb323('0x2c')][_0xb323('0x49')](_0x53965d[_0xb323('0x4a')],{})[_0xb323('0x25')](respondWithResult(_0x8954ae,0xc9))[_0xb323('0x45')](handleError(_0x8954ae,null));};exports[_0xb323('0x24')]=function(_0x3346ac,_0x5bc9c3){if(_0x3346ac[_0xb323('0x4a')]['id']){delete _0x3346ac[_0xb323('0x4a')]['id'];}return db['SmsTransferReport'][_0xb323('0x4b')]({'where':{'id':_0x3346ac[_0xb323('0x46')]['id']}})[_0xb323('0x25')](handleEntityNotFound(_0x5bc9c3,null))['then'](saveUpdates(_0x3346ac['body'],null))[_0xb323('0x25')](respondWithResult(_0x5bc9c3,null))[_0xb323('0x45')](handleError(_0x5bc9c3,null));};exports[_0xb323('0x26')]=function(_0x1489c7,_0x437c87){return db[_0xb323('0x2c')][_0xb323('0x4b')]({'where':{'id':_0x1489c7[_0xb323('0x46')]['id']}})[_0xb323('0x25')](handleEntityNotFound(_0x437c87,null))[_0xb323('0x25')](removeEntity(_0x437c87,null))[_0xb323('0x45')](handleError(_0x437c87,null));};exports[_0xb323('0x4c')]=function(_0x3edf0b,_0x241562){return db[_0xb323('0x2c')][_0xb323('0x4c')]()[_0xb323('0x25')](respondWithResult(_0x241562,null))['catch'](handleError(_0x241562,null));}; \ No newline at end of file +var _0x13c0=['sendStatus','end','status','count','offset','limit','set','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x13c0,0x79));var _0x013c=function(_0x2724e5,_0x229d74){_0x2724e5=_0x2724e5-0x0;var _0x4b6621=_0x13c0[_0x2724e5];return _0x4b6621;};'use strict';var pdf=require(_0x013c('0x0'));var emlformat=require(_0x013c('0x1'));var rimraf=require(_0x013c('0x2'));var zipdir=require(_0x013c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x013c('0x4'));var Mustache=require(_0x013c('0x5'));var util=require(_0x013c('0x6'));var path=require(_0x013c('0x7'));var sox=require(_0x013c('0x8'));var csv=require(_0x013c('0x9'));var ejs=require(_0x013c('0xa'));var fs=require('fs');var _=require(_0x013c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013c('0xc'));var toCsv=require(_0x013c('0x9'));var querystring=require('querystring');var Papa=require(_0x013c('0xd'));var Redis=require(_0x013c('0xe'));var authService=require(_0x013c('0xf'));var qs=require(_0x013c('0x10'));var as=require(_0x013c('0x11'));var hardwareService=require(_0x013c('0x12'));var logger=require(_0x013c('0x13'))(_0x013c('0x14'));var utils=require(_0x013c('0x15'));var config=require(_0x013c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce456f,_0x4631c5){_0x4631c5=_0x4631c5||0xcc;return function(_0x1ee348){if(_0x1ee348){return _0xce456f[_0x013c('0x17')](_0x4631c5);}return _0xce456f['status'](_0x4631c5)[_0x013c('0x18')]();};}function respondWithResult(_0x2313de,_0xcfe81a){_0xcfe81a=_0xcfe81a||0xc8;return function(_0x17b085){if(_0x17b085){return _0x2313de[_0x013c('0x19')](_0xcfe81a)['json'](_0x17b085);}};}function respondWithFilteredResult(_0x307f34,_0x1c2e11){return function(_0x84244){if(_0x84244){var _0x92c3ca=_0x84244[_0x013c('0x1a')],_0x1a5e16=_0x1c2e11[_0x013c('0x1b')],_0x1038d6=_0x1c2e11[_0x013c('0x1b')]+_0x1c2e11[_0x013c('0x1c')],_0x6b8b5;if(_0x1038d6>=_0x92c3ca){_0x1038d6=_0x92c3ca;_0x6b8b5=0xc8;}else{_0x6b8b5=0xce;}_0x307f34[_0x013c('0x19')](_0x6b8b5);return _0x307f34[_0x013c('0x1d')]('Content-Range',_0x1a5e16+'-'+_0x1038d6+'/'+_0x92c3ca)['json'](_0x84244);}return null;};}function patchUpdates(_0x42d0a1){return function(_0x153b0a){try{jsonpatch['apply'](_0x153b0a,_0x42d0a1,!![]);}catch(_0x260006){return BPromise[_0x013c('0x1e')](_0x260006);}return _0x153b0a[_0x013c('0x1f')]();};}function saveUpdates(_0x38bac2,_0xb87452){return function(_0x56796a){if(_0x56796a){return _0x56796a[_0x013c('0x20')](_0x38bac2)[_0x013c('0x21')](function(_0x48e6af){return _0x48e6af;});}return null;};}function removeEntity(_0x1df9d2,_0x82f9f1){return function(_0x53fbbd){if(_0x53fbbd){return _0x53fbbd['destroy']()[_0x013c('0x21')](function(){_0x1df9d2[_0x013c('0x19')](0xcc)[_0x013c('0x18')]();});}};}function handleEntityNotFound(_0x447c0b,_0x20aff2){return function(_0x2c28a7){if(!_0x2c28a7){_0x447c0b[_0x013c('0x17')](0x194);}return _0x2c28a7;};}function handleError(_0x1b9bdc,_0x4ffb6d){_0x4ffb6d=_0x4ffb6d||0x1f4;return function(_0x468fe7){logger[_0x013c('0x22')](_0x468fe7[_0x013c('0x23')]);if(_0x468fe7[_0x013c('0x24')]){delete _0x468fe7[_0x013c('0x24')];}_0x1b9bdc[_0x013c('0x19')](_0x4ffb6d)['send'](_0x468fe7);};}exports[_0x013c('0x25')]=function(_0xd85349,_0x21c86e){var _0x5f251b={},_0xa74f05={},_0x4f062f={'count':0x0,'rows':[]};var _0x395081=_[_0x013c('0x26')](db['SmsTransferReport'][_0x013c('0x27')],function(_0x32da8c){return{'name':_0x32da8c[_0x013c('0x28')],'type':_0x32da8c[_0x013c('0x29')][_0x013c('0x2a')]};});_0xa74f05[_0x013c('0x2b')]=_[_0x013c('0x26')](_0x395081,_0x013c('0x24'));_0xa74f05[_0x013c('0x2c')]=_[_0x013c('0x2d')](_0xd85349['query']);_0xa74f05[_0x013c('0x2e')]=_[_0x013c('0x2f')](_0xa74f05[_0x013c('0x2b')],_0xa74f05[_0x013c('0x2c')]);_0x5f251b[_0x013c('0x30')]=_['intersection'](_0xa74f05[_0x013c('0x2b')],qs[_0x013c('0x31')](_0xd85349[_0x013c('0x2c')][_0x013c('0x31')]));_0x5f251b['attributes']=_0x5f251b['attributes']['length']?_0x5f251b[_0x013c('0x30')]:_0xa74f05[_0x013c('0x2b')];if(!_0xd85349[_0x013c('0x2c')][_0x013c('0x32')](_0x013c('0x33'))){_0x5f251b[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0xd85349[_0x013c('0x2c')][_0x013c('0x1c')]);_0x5f251b[_0x013c('0x1b')]=qs[_0x013c('0x1b')](_0xd85349[_0x013c('0x2c')]['offset']);}_0x5f251b['order']=qs[_0x013c('0x34')](_0xd85349[_0x013c('0x2c')][_0x013c('0x34')]);_0x5f251b[_0x013c('0x35')]=qs['filters'](_[_0x013c('0x36')](_0xd85349[_0x013c('0x2c')],_0xa74f05[_0x013c('0x2e')]),_0x395081);if(_0xd85349[_0x013c('0x2c')]['filter']){_0x5f251b[_0x013c('0x35')]=_[_0x013c('0x37')](_0x5f251b['where'],{'$or':_[_0x013c('0x26')](_0x395081,function(_0x4a3565){if(_0x4a3565[_0x013c('0x29')]!==_0x013c('0x38')){var _0x447aae={};_0x447aae[_0x4a3565[_0x013c('0x24')]]={'$like':'%'+_0xd85349['query'][_0x013c('0x39')]+'%'};return _0x447aae;}})});}_0x5f251b=_[_0x013c('0x37')]({},_0x5f251b,_0xd85349[_0x013c('0x3a')]);var _0x2f6044={'where':_0x5f251b[_0x013c('0x35')]};return db[_0x013c('0x3b')][_0x013c('0x1a')](_0x2f6044)[_0x013c('0x21')](function(_0x3de22f){_0x4f062f['count']=_0x3de22f;if(_0xd85349[_0x013c('0x2c')][_0x013c('0x3c')]){_0x5f251b['include']=[{'all':!![]}];}return db[_0x013c('0x3b')][_0x013c('0x3d')](_0x5f251b);})['then'](function(_0x4212f3){_0x4f062f[_0x013c('0x3e')]=_0x4212f3;return _0x4f062f;})[_0x013c('0x21')](respondWithFilteredResult(_0x21c86e,_0x5f251b))[_0x013c('0x3f')](handleError(_0x21c86e,null));};exports[_0x013c('0x40')]=function(_0x5eb1db,_0x3d0ffd){var _0x4ea6c3={'raw':!![],'where':{'id':_0x5eb1db['params']['id']}},_0x59629e={};_0x59629e['model']=_[_0x013c('0x2d')](db[_0x013c('0x3b')][_0x013c('0x27')]);_0x59629e['query']=_[_0x013c('0x2d')](_0x5eb1db[_0x013c('0x2c')]);_0x59629e[_0x013c('0x2e')]=_[_0x013c('0x2f')](_0x59629e[_0x013c('0x2b')],_0x59629e['query']);_0x4ea6c3[_0x013c('0x30')]=_[_0x013c('0x2f')](_0x59629e['model'],qs['fields'](_0x5eb1db['query']['fields']));_0x4ea6c3[_0x013c('0x30')]=_0x4ea6c3[_0x013c('0x30')]['length']?_0x4ea6c3[_0x013c('0x30')]:_0x59629e[_0x013c('0x2b')];if(_0x5eb1db['query'][_0x013c('0x3c')]){_0x4ea6c3[_0x013c('0x41')]=[{'all':!![]}];}_0x4ea6c3=_[_0x013c('0x37')]({},_0x4ea6c3,_0x5eb1db[_0x013c('0x3a')]);return db[_0x013c('0x3b')][_0x013c('0x42')](_0x4ea6c3)[_0x013c('0x21')](handleEntityNotFound(_0x3d0ffd,null))[_0x013c('0x21')](respondWithResult(_0x3d0ffd,null))['catch'](handleError(_0x3d0ffd,null));};exports[_0x013c('0x43')]=function(_0x499f0d,_0x31fbad){return db['SmsTransferReport']['create'](_0x499f0d[_0x013c('0x44')],{})['then'](respondWithResult(_0x31fbad,0xc9))[_0x013c('0x3f')](handleError(_0x31fbad,null));};exports[_0x013c('0x20')]=function(_0x3352c3,_0x29e8c6){if(_0x3352c3['body']['id']){delete _0x3352c3['body']['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x3352c3[_0x013c('0x45')]['id']}})['then'](handleEntityNotFound(_0x29e8c6,null))[_0x013c('0x21')](saveUpdates(_0x3352c3[_0x013c('0x44')],null))[_0x013c('0x21')](respondWithResult(_0x29e8c6,null))[_0x013c('0x3f')](handleError(_0x29e8c6,null));};exports[_0x013c('0x46')]=function(_0x2e99db,_0x2ef3ec){return db[_0x013c('0x3b')][_0x013c('0x42')]({'where':{'id':_0x2e99db['params']['id']}})[_0x013c('0x21')](handleEntityNotFound(_0x2ef3ec,null))['then'](removeEntity(_0x2ef3ec,null))['catch'](handleError(_0x2ef3ec,null));};exports[_0x013c('0x47')]=function(_0x5f2b11,_0x551433){return db[_0x013c('0x3b')][_0x013c('0x47')]()['then'](respondWithResult(_0x551433,null))[_0x013c('0x3f')](handleError(_0x551433,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 5be9b3d..4d3195e 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 _0xa46e=['path','../../config/environment','exports','define','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x44bd2f,_0x42655f){var _0x2929e8=function(_0x418c90){while(--_0x418c90){_0x44bd2f['push'](_0x44bd2f['shift']());}};_0x2929e8(++_0x42655f);}(_0xa46e,0x8a));var _0xea46=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xa46e[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('SmsTransferReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','define'];(function(_0x328428,_0x215933){var _0x4cfa3d=function(_0x35a1a6){while(--_0x35a1a6){_0x328428['push'](_0x328428['shift']());}};_0x4cfa3d(++_0x215933);}(_0x82c4,0x1ca));var _0x482c=function(_0x3def55,_0x53ce57){_0x3def55=_0x3def55-0x0;var _0xf4cb7d=_0x82c4[_0x3def55];return _0xf4cb7d;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 91ae620..6fb3c3c 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 _0xb4bc=['jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','../../config/utils','rpc'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xb4bc,0xcb));var _0xcb4b=function(_0x5615d8,_0xe7d055){_0x5615d8=_0x5615d8-0x0;var _0x13f4e1=_0xb4bc[_0x5615d8];return _0x13f4e1;};'use strict';var _=require(_0xcb4b('0x0'));var util=require(_0xcb4b('0x1'));var moment=require(_0xcb4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcb4b('0x4'));var logger=require('../../config/logger')(_0xcb4b('0x5'));var config=require('../../config/environment');var jayson=require(_0xcb4b('0x6'));var client=jayson[_0xcb4b('0x7')][_0xcb4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x192cbd,_0x5d9918,_0x454dbe){return new BPromise(function(_0x118d45,_0x47f7e8){return client[_0xcb4b('0x9')](_0x192cbd,_0x454dbe)[_0xcb4b('0xa')](function(_0x120fee){logger[_0xcb4b('0xb')](_0xcb4b('0xc'),_0x5d9918,_0xcb4b('0xd'));logger[_0xcb4b('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5d9918,'request\x20sent',JSON[_0xcb4b('0xf')](_0x120fee));if(_0x120fee[_0xcb4b('0x10')]){if(_0x120fee['error']['code']===0x1f4){logger[_0xcb4b('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9918,_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);return _0x47f7e8(_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);}logger[_0xcb4b('0x10')](_0xcb4b('0xc'),_0x5d9918,_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);return _0x118d45(_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);}else{logger[_0xcb4b('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9918,'request\x20sent');_0x118d45(_0x120fee[_0xcb4b('0x12')]['message']);}})['catch'](function(_0x1a17de){logger[_0xcb4b('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9918,_0x1a17de);_0x47f7e8(_0x1a17de);});});} \ No newline at end of file +var _0x9978=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','code','error','message','SmsTransferReport,\x20%s,\x20%s','result','catch'];(function(_0x2e9515,_0x5c76b6){var _0x187fca=function(_0x28943){while(--_0x28943){_0x2e9515['push'](_0x2e9515['shift']());}};_0x187fca(++_0x5c76b6);}(_0x9978,0x176));var _0x8997=function(_0x3e7265,_0x935c3c){_0x3e7265=_0x3e7265-0x0;var _0x2fc9da=_0x9978[_0x3e7265];return _0x2fc9da;};'use strict';var _=require('lodash');var util=require(_0x8997('0x0'));var moment=require(_0x8997('0x1'));var BPromise=require(_0x8997('0x2'));var rs=require(_0x8997('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8997('0x4'))['db'];var utils=require(_0x8997('0x5'));var logger=require(_0x8997('0x6'))(_0x8997('0x7'));var config=require(_0x8997('0x8'));var jayson=require(_0x8997('0x9'));var client=jayson[_0x8997('0xa')][_0x8997('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x584833,_0x3b3651,_0x4c9687){return new BPromise(function(_0x5cbb79,_0x44c539){return client[_0x8997('0xc')](_0x584833,_0x4c9687)['then'](function(_0x4a87cb){logger[_0x8997('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x3b3651,_0x8997('0xe'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3b3651,_0x8997('0xe'),JSON[_0x8997('0xf')](_0x4a87cb));if(_0x4a87cb['error']){if(_0x4a87cb['error'][_0x8997('0x10')]===0x1f4){logger[_0x8997('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x3b3651,_0x4a87cb[_0x8997('0x11')][_0x8997('0x12')]);return _0x44c539(_0x4a87cb['error']['message']);}logger[_0x8997('0x11')](_0x8997('0x13'),_0x3b3651,_0x4a87cb['error']['message']);return _0x5cbb79(_0x4a87cb[_0x8997('0x11')][_0x8997('0x12')]);}else{logger[_0x8997('0xd')](_0x8997('0x13'),_0x3b3651,_0x8997('0xe'));_0x5cbb79(_0x4a87cb[_0x8997('0x14')][_0x8997('0x12')]);}})[_0x8997('0x15')](function(_0x3321ce){logger[_0x8997('0x11')](_0x8997('0x13'),_0x3b3651,_0x3321ce);_0x44c539(_0x3321ce);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a86620e..04e780a 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 _0x338f=['/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','single','file','put','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x338f,0xde));var _0xf338=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x338f[_0x163040];return _0x364667;};'use strict';var multer=require('multer');var util=require(_0xf338('0x0'));var path=require(_0xf338('0x1'));var timeout=require(_0xf338('0x2'));var express=require('express');var router=express[_0xf338('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf338('0x4'));var config=require(_0xf338('0x5'));var controller=require(_0xf338('0x6'));router[_0xf338('0x7')]('/',auth[_0xf338('0x8')](),controller[_0xf338('0x9')]);router[_0xf338('0x7')](_0xf338('0xa'),auth[_0xf338('0x8')](),controller['show']);router['get'](_0xf338('0xb'),auth['isAuthenticated'](),controller[_0xf338('0xc')]);var upload=multer({'storage':multer[_0xf338('0xd')]({'destination':function(_0x34816f,_0xc9d7d5,_0x55a68b){_0x55a68b(null,path[_0xf338('0xe')](config[_0xf338('0xf')],_0xf338('0x10')));},'filename':function(_0x1d2e45,_0x358acb,_0x51bb05){_0x358acb[_0xf338('0x11')]=_0x358acb[_0xf338('0x11')][_0xf338('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x51bb05(null,util['format'](_0xf338('0x13'),path[_0xf338('0x14')](_0x358acb[_0xf338('0x11')],path['extname'](_0x358acb[_0xf338('0x11')])),Date[_0xf338('0x15')](),path[_0xf338('0x16')](_0x358acb[_0xf338('0x11')])));}})});router['post']('/',upload[_0xf338('0x17')](_0xf338('0x18')),controller['create']);router[_0xf338('0x19')](_0xf338('0xa'),auth[_0xf338('0x8')](),controller[_0xf338('0x1a')]);router[_0xf338('0x1b')](_0xf338('0xa'),auth['isAuthenticated'](),controller[_0xf338('0x1b')]);module[_0xf338('0x1c')]=router; \ No newline at end of file +var _0xeeee=['server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xeeee,0x72));var _0xeeee=function(_0x26004d,_0x41a35c){_0x26004d=_0x26004d-0x0;var _0x3147ff=_0xeeee[_0x26004d];return _0x3147ff;};'use strict';var multer=require(_0xeeee('0x0'));var util=require(_0xeeee('0x1'));var path=require(_0xeeee('0x2'));var timeout=require(_0xeeee('0x3'));var express=require(_0xeeee('0x4'));var router=express[_0xeeee('0x5')]();var auth=require(_0xeeee('0x6'));var interaction=require(_0xeeee('0x7'));var config=require('../../config/environment');var controller=require(_0xeeee('0x8'));router[_0xeeee('0x9')]('/',auth['isAuthenticated'](),controller[_0xeeee('0xa')]);router[_0xeeee('0x9')](_0xeeee('0xb'),auth[_0xeeee('0xc')](),controller[_0xeeee('0xd')]);router[_0xeeee('0x9')](_0xeeee('0xe'),auth[_0xeeee('0xc')](),controller['download']);var upload=multer({'storage':multer[_0xeeee('0xf')]({'destination':function(_0x2dea1c,_0x16e75c,_0x2f1c72){_0x2f1c72(null,path[_0xeeee('0x10')](config[_0xeeee('0x11')],_0xeeee('0x12')));},'filename':function(_0x2380d9,_0x4f9523,_0x16bd6e){_0x4f9523[_0xeeee('0x13')]=_0x4f9523[_0xeeee('0x13')][_0xeeee('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16bd6e(null,util[_0xeeee('0x15')](_0xeeee('0x16'),path[_0xeeee('0x17')](_0x4f9523[_0xeeee('0x13')],path[_0xeeee('0x18')](_0x4f9523[_0xeeee('0x13')])),Date[_0xeeee('0x19')](),path[_0xeeee('0x18')](_0x4f9523[_0xeeee('0x13')])));}})});router[_0xeeee('0x1a')]('/',upload[_0xeeee('0x1b')](_0xeeee('0x1c')),controller[_0xeeee('0x1d')]);router[_0xeeee('0x1e')](_0xeeee('0xb'),auth[_0xeeee('0xc')](),controller['update']);router[_0xeeee('0x1f')](_0xeeee('0xb'),auth[_0xeeee('0xc')](),controller[_0xeeee('0x1f')]);module[_0xeeee('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c043905..cbb29f2 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 _0xa414=['exports','STRING','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa414,0x185));var _0x4a41=function(_0x5d5d1f,_0x3b53a1){_0x5d5d1f=_0x5d5d1f-0x0;var _0x29fd04=_0xa414[_0x5d5d1f];return _0x29fd04;};'use strict';var Sequelize=require(_0x4a41('0x0'));module[_0x4a41('0x1')]={'name':{'type':Sequelize[_0x4a41('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x4a41('0x2')]},'display_name':{'type':Sequelize[_0x4a41('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4a41('0x2')]},'original_format':{'type':Sequelize[_0x4a41('0x2')]},'original_duration':{'type':Sequelize[_0x4a41('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x4a41('0x4')]},'original_bitRate':{'type':Sequelize[_0x4a41('0x5')]},'original_sampleRate':{'type':Sequelize[_0x4a41('0x4')]},'converted_format':{'type':Sequelize[_0x4a41('0x2')]},'converted_duration':{'type':Sequelize[_0x4a41('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x4a41('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4a41('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x4a41('0x4')]}}; \ No newline at end of file +var _0xbfb0=['INTEGER','BIGINT','FLOAT','exports','name','STRING'];(function(_0x29a5e8,_0x3511bc){var _0x28513b=function(_0x4647b4){while(--_0x4647b4){_0x29a5e8['push'](_0x29a5e8['shift']());}};_0x28513b(++_0x3511bc);}(_0xbfb0,0x1d1));var _0x0bfb=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xbfb0[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require('sequelize');module[_0x0bfb('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0bfb('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0bfb('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x0bfb('0x2')]},'original_format':{'type':Sequelize[_0x0bfb('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x0bfb('0x3')]},'original_bitRate':{'type':Sequelize[_0x0bfb('0x4')]},'original_sampleRate':{'type':Sequelize[_0x0bfb('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x0bfb('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x0bfb('0x4')]},'converted_channelCount':{'type':Sequelize[_0x0bfb('0x3')]},'converted_bitRate':{'type':Sequelize[_0x0bfb('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x0bfb('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index e79049d..9899a70 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 _0xb71c=['Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','error','stack','name','index','Sound','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','download','converted_format','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','root','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','unlinkSync','send','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','end','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','description','delete','destroy','original_format','html-pdf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set'];(function(_0x5e2f8f,_0x4aef23){var _0x1b9989=function(_0xcaab8f){while(--_0xcaab8f){_0x5e2f8f['push'](_0x5e2f8f['shift']());}};_0x1b9989(++_0x4aef23);}(_0xb71c,0x1c7));var _0xcb71=function(_0x4e2521,_0x19d67b){_0x4e2521=_0x4e2521-0x0;var _0x8606f7=_0xb71c[_0x4e2521];return _0x8606f7;};'use strict';var pdf=require(_0xcb71('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb71('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb71('0x3'));var util=require(_0xcb71('0x4'));var path=require(_0xcb71('0x5'));var sox=require('sox');var csv=require(_0xcb71('0x6'));var ejs=require(_0xcb71('0x7'));var fs=require('fs');var _=require(_0xcb71('0x8'));var squel=require('squel');var crypto=require(_0xcb71('0x9'));var jsforce=require(_0xcb71('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xcb71('0x6'));var querystring=require(_0xcb71('0xb'));var Papa=require('papaparse');var Redis=require(_0xcb71('0xc'));var authService=require(_0xcb71('0xd'));var qs=require(_0xcb71('0xe'));var as=require(_0xcb71('0xf'));var hardwareService=require(_0xcb71('0x10'));var logger=require(_0xcb71('0x11'))(_0xcb71('0x12'));var utils=require('../../config/utils');var config=require(_0xcb71('0x13'));var licenseUtil=require(_0xcb71('0x14'));var db=require(_0xcb71('0x15'))['db'];function respondWithStatusCode(_0x4ea9de,_0x15cb80){_0x15cb80=_0x15cb80||0xcc;return function(_0x1feddc){if(_0x1feddc){return _0x4ea9de[_0xcb71('0x16')](_0x15cb80);}return _0x4ea9de[_0xcb71('0x17')](_0x15cb80)['end']();};}function respondWithResult(_0x24af30,_0xdac67f){_0xdac67f=_0xdac67f||0xc8;return function(_0x21ff9c){if(_0x21ff9c){return _0x24af30[_0xcb71('0x17')](_0xdac67f)[_0xcb71('0x18')](_0x21ff9c);}};}function respondWithFilteredResult(_0xcf2d61,_0x7eb889){return function(_0x43140a){if(_0x43140a){var _0x1da9db=_0x43140a[_0xcb71('0x19')],_0x3b5d38=_0x7eb889[_0xcb71('0x1a')],_0x5cf983=_0x7eb889['offset']+_0x7eb889[_0xcb71('0x1b')],_0x1ad719;if(_0x5cf983>=_0x1da9db){_0x5cf983=_0x1da9db;_0x1ad719=0xc8;}else{_0x1ad719=0xce;}_0xcf2d61[_0xcb71('0x17')](_0x1ad719);return _0xcf2d61[_0xcb71('0x1c')](_0xcb71('0x1d'),_0x3b5d38+'-'+_0x5cf983+'/'+_0x1da9db)[_0xcb71('0x18')](_0x43140a);}return null;};}function patchUpdates(_0x1ccb24){return function(_0x137946){try{jsonpatch[_0xcb71('0x1e')](_0x137946,_0x1ccb24,!![]);}catch(_0x1e1747){return BPromise[_0xcb71('0x1f')](_0x1e1747);}return _0x137946[_0xcb71('0x20')]();};}function saveUpdates(_0x4181b0,_0x3c2ed4){return function(_0x2ef7bf){if(_0x2ef7bf){return _0x2ef7bf[_0xcb71('0x21')](_0x4181b0)[_0xcb71('0x22')](function(_0x22b71e){return _0x22b71e;});}return null;};}function removeEntity(_0x2e481e,_0x21ca82){return function(_0x29b048){if(_0x29b048){return _0x29b048['destroy']()[_0xcb71('0x22')](function(){var _0x2e3279=_0x29b048[_0xcb71('0x23')]({'plain':!![]});var _0x5d33cd=_0xcb71('0x24');return db[_0xcb71('0x25')]['destroy']({'where':{'type':_0x5d33cd,'resourceId':_0x2e3279['id']}})[_0xcb71('0x22')](function(){return _0x29b048;});})[_0xcb71('0x22')](function(){_0x2e481e[_0xcb71('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x646998,_0xe54c44){return function(_0x570895){if(!_0x570895){_0x646998[_0xcb71('0x16')](0x194);}return _0x570895;};}function handleError(_0x50b5b8,_0x21970a){_0x21970a=_0x21970a||0x1f4;return function(_0x2a9410){logger[_0xcb71('0x26')](_0x2a9410[_0xcb71('0x27')]);if(_0x2a9410[_0xcb71('0x28')]){delete _0x2a9410[_0xcb71('0x28')];}_0x50b5b8[_0xcb71('0x17')](_0x21970a)['send'](_0x2a9410);};}exports[_0xcb71('0x29')]=function(_0xa19394,_0x4ad2f6){var _0x4b67ea={},_0x334ed9={},_0x2cc198={'count':0x0,'rows':[]};var _0x51c9f9=_['map'](db[_0xcb71('0x2a')][_0xcb71('0x2b')],function(_0x22885a){return{'name':_0x22885a[_0xcb71('0x2c')],'type':_0x22885a['type'][_0xcb71('0x2d')]};});_0x334ed9[_0xcb71('0x2e')]=_['map'](_0x51c9f9,_0xcb71('0x28'));_0x334ed9[_0xcb71('0x2f')]=_[_0xcb71('0x30')](_0xa19394['query']);_0x334ed9['filters']=_['intersection'](_0x334ed9[_0xcb71('0x2e')],_0x334ed9[_0xcb71('0x2f')]);_0x4b67ea['attributes']=_[_0xcb71('0x31')](_0x334ed9[_0xcb71('0x2e')],qs[_0xcb71('0x32')](_0xa19394[_0xcb71('0x2f')][_0xcb71('0x32')]));_0x4b67ea[_0xcb71('0x33')]=_0x4b67ea['attributes'][_0xcb71('0x34')]?_0x4b67ea[_0xcb71('0x33')]:_0x334ed9[_0xcb71('0x2e')];if(!_0xa19394[_0xcb71('0x2f')][_0xcb71('0x35')](_0xcb71('0x36'))){_0x4b67ea[_0xcb71('0x1b')]=qs[_0xcb71('0x1b')](_0xa19394[_0xcb71('0x2f')][_0xcb71('0x1b')]);_0x4b67ea['offset']=qs['offset'](_0xa19394[_0xcb71('0x2f')][_0xcb71('0x1a')]);}_0x4b67ea[_0xcb71('0x37')]=qs[_0xcb71('0x38')](_0xa19394['query'][_0xcb71('0x38')]);_0x4b67ea[_0xcb71('0x39')]=qs[_0xcb71('0x3a')](_[_0xcb71('0x3b')](_0xa19394[_0xcb71('0x2f')],_0x334ed9['filters']),_0x51c9f9);if(_0xa19394[_0xcb71('0x2f')][_0xcb71('0x3c')]){_0x4b67ea['where']=_[_0xcb71('0x3d')](_0x4b67ea[_0xcb71('0x39')],{'$or':_[_0xcb71('0x3e')](_0x51c9f9,function(_0x8147b5){if(_0x8147b5[_0xcb71('0x3f')]!==_0xcb71('0x40')){var _0x16cbe6={};_0x16cbe6[_0x8147b5[_0xcb71('0x28')]]={'$like':'%'+_0xa19394[_0xcb71('0x2f')][_0xcb71('0x3c')]+'%'};return _0x16cbe6;}})});}_0x4b67ea=_[_0xcb71('0x3d')]({},_0x4b67ea,_0xa19394[_0xcb71('0x41')]);var _0x2c8a09={'where':_0x4b67ea[_0xcb71('0x39')]};return db[_0xcb71('0x2a')][_0xcb71('0x19')](_0x2c8a09)['then'](function(_0x5415dd){_0x2cc198['count']=_0x5415dd;if(_0xa19394[_0xcb71('0x2f')]['includeAll']){_0x4b67ea['include']=[{'all':!![]}];}return db[_0xcb71('0x2a')][_0xcb71('0x42')](_0x4b67ea);})[_0xcb71('0x22')](function(_0x86146d){_0x2cc198[_0xcb71('0x43')]=_0x86146d;return _0x2cc198;})[_0xcb71('0x22')](respondWithFilteredResult(_0x4ad2f6,_0x4b67ea))[_0xcb71('0x44')](handleError(_0x4ad2f6,null));};exports['show']=function(_0x555736,_0x44a45f){var _0x320745={'raw':!![],'where':{'id':_0x555736[_0xcb71('0x45')]['id']}},_0x18a59b={};_0x18a59b[_0xcb71('0x2e')]=_[_0xcb71('0x30')](db[_0xcb71('0x2a')]['rawAttributes']);_0x18a59b[_0xcb71('0x2f')]=_['keys'](_0x555736[_0xcb71('0x2f')]);_0x18a59b[_0xcb71('0x3a')]=_[_0xcb71('0x31')](_0x18a59b[_0xcb71('0x2e')],_0x18a59b[_0xcb71('0x2f')]);_0x320745[_0xcb71('0x33')]=_[_0xcb71('0x31')](_0x18a59b[_0xcb71('0x2e')],qs[_0xcb71('0x32')](_0x555736[_0xcb71('0x2f')][_0xcb71('0x32')]));_0x320745[_0xcb71('0x33')]=_0x320745['attributes']['length']?_0x320745[_0xcb71('0x33')]:_0x18a59b[_0xcb71('0x2e')];if(_0x555736[_0xcb71('0x2f')][_0xcb71('0x46')]){_0x320745[_0xcb71('0x47')]=[{'all':!![]}];}_0x320745=_[_0xcb71('0x3d')]({},_0x320745,_0x555736[_0xcb71('0x41')]);return db['Sound'][_0xcb71('0x48')](_0x320745)[_0xcb71('0x22')](handleEntityNotFound(_0x44a45f,null))[_0xcb71('0x22')](respondWithResult(_0x44a45f,null))[_0xcb71('0x44')](handleError(_0x44a45f,null));};exports[_0xcb71('0x49')]=function(_0x3a4e98,_0x9c7b39,_0x2022f4){return db[_0xcb71('0x2a')][_0xcb71('0x48')]({'where':{'id':_0x3a4e98['params']['id']},'attributes':[_0xcb71('0x28'),'save_name',_0xcb71('0x4a')],'raw':!![]})[_0xcb71('0x22')](handleEntityNotFound(_0x9c7b39,null))[_0xcb71('0x22')](function(_0x5f48d9){if(_0x5f48d9){if(!fs['existsSync'](path[_0xcb71('0x4b')](config['root'],_0xcb71('0x4c'),_0x5f48d9[_0xcb71('0x4d')]+'.'+_0x5f48d9[_0xcb71('0x4a')]))){throw new db[(_0xcb71('0x4e'))][(_0xcb71('0x4f'))]('Sound\x20not\x20found');}return _0x9c7b39[_0xcb71('0x49')](path[_0xcb71('0x4b')](config[_0xcb71('0x50')],_0xcb71('0x4c'),util[_0xcb71('0x51')](_0xcb71('0x52'),_0x5f48d9[_0xcb71('0x4d')],_0x5f48d9['converted_format'])),util[_0xcb71('0x51')](_0xcb71('0x52'),_0x5f48d9[_0xcb71('0x28')],_0x5f48d9[_0xcb71('0x4a')]));}return null;})[_0xcb71('0x44')](handleError(_0x9c7b39,null));};exports['create']=function(_0x4feefc,_0x41e073,_0xcb9ac){var _0xa8663={'name':path[_0xcb71('0x53')](_0x4feefc['file'][_0xcb71('0x54')],path[_0xcb71('0x55')](_0x4feefc[_0xcb71('0x56')]['originalname'])),'save_name':path[_0xcb71('0x53')](_0x4feefc[_0xcb71('0x56')][_0xcb71('0x57')],path[_0xcb71('0x55')](_0x4feefc[_0xcb71('0x56')][_0xcb71('0x57')])),'original_format':path[_0xcb71('0x55')](_0x4feefc['file']['originalname'])[_0xcb71('0x58')](0x1),'converted_format':_0xcb71('0x59')};var _0x5de57e=path[_0xcb71('0x4b')](config[_0xcb71('0x50')],_0xcb71('0x5a'),_0x4feefc[_0xcb71('0x56')]['filename']);var _0xa7c9e6=path[_0xcb71('0x4b')](config[_0xcb71('0x50')],_0xcb71('0x4c'),util[_0xcb71('0x51')](_0xcb71('0x52'),path[_0xcb71('0x53')](_0x4feefc[_0xcb71('0x56')][_0xcb71('0x57')],path[_0xcb71('0x55')](_0x4feefc['file']['filename'])),_0xa8663['converted_format']));logger[_0xcb71('0x5b')](_0xcb71('0x5c'),_0x5de57e);logger[_0xcb71('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0xa7c9e6);try{fs['chmodSync'](_0x5de57e,parseInt('0777',0x8));var _0xf70168=sox['transcode'](_0x5de57e,_0xa7c9e6,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf70168['on'](_0xcb71('0x26'),function(_0x2ee5b3){fs[_0xcb71('0x5d')](_0x5de57e);_0x41e073[_0xcb71('0x17')](0x1f4)[_0xcb71('0x5e')](_0x2ee5b3);});_0xf70168['on']('src',function(_0x2df7f9){_0xa8663['original_duration']=isNaN(_0x2df7f9[_0xcb71('0x5f')])?null:_0x2df7f9[_0xcb71('0x5f')]*0x3e8;_0xa8663[_0xcb71('0x60')]=isNaN(_0x2df7f9[_0xcb71('0x61')])?null:_0x2df7f9[_0xcb71('0x61')];_0xa8663['original_channelCount']=isNaN(_0x2df7f9[_0xcb71('0x62')])?null:_0x2df7f9['channelCount'];_0xa8663[_0xcb71('0x63')]=isNaN(_0x2df7f9[_0xcb71('0x64')])?null:_0x2df7f9['bitRate'];_0xa8663[_0xcb71('0x65')]=isNaN(_0x2df7f9[_0xcb71('0x66')])?null:_0x2df7f9['sampleRate'];});_0xf70168['on']('dest',function(_0x395080){_0xa8663[_0xcb71('0x67')]=isNaN(_0x395080['duration'])?null:_0x395080[_0xcb71('0x5f')]*0x3e8;_0xa8663['converted_sampleCount']=isNaN(_0x395080[_0xcb71('0x61')])?null:_0x395080[_0xcb71('0x61')];_0xa8663[_0xcb71('0x68')]=isNaN(_0x395080[_0xcb71('0x62')])?null:_0x395080[_0xcb71('0x62')];_0xa8663[_0xcb71('0x69')]=isNaN(_0x395080[_0xcb71('0x64')])?null:_0x395080[_0xcb71('0x64')];_0xa8663[_0xcb71('0x6a')]=isNaN(_0x395080[_0xcb71('0x66')])?null:_0x395080[_0xcb71('0x66')];});_0xf70168['on'](_0xcb71('0x6b'),function(){fs['chmodSync'](_0xa7c9e6,parseInt('0777',0x8));return db[_0xcb71('0x2a')]['create'](_0xa8663)['then'](function(_0x3f1779){var _0x424980={'role':_0x4feefc['body'][_0xcb71('0x6c')],'userProfileId':_0x4feefc['body'][_0xcb71('0x6d')]};if(!_0x424980)throw new Error(_0xcb71('0x6e'));if(_0x424980[_0xcb71('0x6c')]===_0xcb71('0x6f')){var _0x22bb31=_0x3f1779[_0xcb71('0x23')]({'plain':!![]});return db[_0xcb71('0x70')][_0xcb71('0x48')]({'where':{'name':'Sounds','userProfileId':_0x424980[_0xcb71('0x6d')]},'raw':!![]})[_0xcb71('0x22')](function(_0x5e7c32){if(_0x5e7c32&&_0x5e7c32[_0xcb71('0x71')]===0x0){return db[_0xcb71('0x25')][_0xcb71('0x72')]({'name':_0x22bb31[_0xcb71('0x28')],'resourceId':_0x22bb31['id'],'type':_0x5e7c32['name'],'sectionId':_0x5e7c32['id']},{})[_0xcb71('0x22')](function(){return _0x3f1779;});}else{return _0x3f1779;}})[_0xcb71('0x44')](function(_0x241016){logger[_0xcb71('0x26')](_0xcb71('0x73'),_0x241016);throw _0x241016;});}return _0x3f1779;})[_0xcb71('0x22')](respondWithResult(_0x41e073,null))['catch'](handleError(_0x41e073,null));});_0xf70168['start']();}catch(_0x366c47){_0x41e073[_0xcb71('0x17')](0x1f4)[_0xcb71('0x5e')](_0x366c47);}};exports[_0xcb71('0x21')]=function(_0x41fdec,_0x2ef72c,_0x1c29bd){return db[_0xcb71('0x2a')][_0xcb71('0x48')]({'where':{'id':_0x41fdec[_0xcb71('0x45')]['id']}})[_0xcb71('0x22')](handleEntityNotFound(_0x2ef72c,null))[_0xcb71('0x22')](saveUpdates(_[_0xcb71('0x3b')](_0x41fdec[_0xcb71('0x74')],[_0xcb71('0x28'),_0xcb71('0x75')]),null))[_0xcb71('0x22')](respondWithResult(_0x2ef72c,null))[_0xcb71('0x44')](handleError(_0x2ef72c,null));};exports[_0xcb71('0x76')]=function(_0x4bd415,_0x2aaad8,_0x4dbdef){return db[_0xcb71('0x2a')]['find']({'where':{'id':_0x4bd415[_0xcb71('0x45')]['id']}})[_0xcb71('0x22')](function(_0x46c63d){if(_0x46c63d){return _0x46c63d[_0xcb71('0x77')]();}})['then'](function(_0x30aab7){var _0x2615f7=path[_0xcb71('0x4b')](config[_0xcb71('0x50')],'server/files/sounds/original',util[_0xcb71('0x51')](_0xcb71('0x52'),_0x30aab7['save_name'],_0x30aab7[_0xcb71('0x78')]));var _0x22e824=path[_0xcb71('0x4b')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',_0x30aab7[_0xcb71('0x4d')],_0x30aab7['converted_format']));fs[_0xcb71('0x5d')](_0x2615f7);fs[_0xcb71('0x5d')](_0x22e824);return _0x30aab7;})[_0xcb71('0x22')](function(_0xad1109){if(_0xad1109){return _0x2aaad8[_0xcb71('0x17')](0xcc)['end']();}})[_0xcb71('0x22')](handleEntityNotFound(_0x2aaad8,null))[_0xcb71('0x44')](handleError(_0x2aaad8,null));}; \ No newline at end of file +var _0x98c8=['Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','VIRTUAL','includeAll','findAll','rows','show','params','include','merge','options','find','catch','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98c8,0xa5));var _0x898c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x98c8[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x898c('0x0'));var emlformat=require(_0x898c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x898c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x898c('0x3'));var moment=require(_0x898c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x898c('0x5'));var util=require(_0x898c('0x6'));var path=require(_0x898c('0x7'));var sox=require('sox');var csv=require(_0x898c('0x8'));var ejs=require(_0x898c('0x9'));var fs=require('fs');var _=require(_0x898c('0xa'));var squel=require('squel');var crypto=require(_0x898c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x898c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x898c('0xd'));var Redis=require(_0x898c('0xe'));var authService=require(_0x898c('0xf'));var qs=require(_0x898c('0x10'));var as=require(_0x898c('0x11'));var hardwareService=require(_0x898c('0x12'));var logger=require(_0x898c('0x13'))(_0x898c('0x14'));var utils=require(_0x898c('0x15'));var config=require(_0x898c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x898c('0x17'))['db'];function respondWithStatusCode(_0xc57139,_0x275c76){_0x275c76=_0x275c76||0xcc;return function(_0x16e15d){if(_0x16e15d){return _0xc57139[_0x898c('0x18')](_0x275c76);}return _0xc57139[_0x898c('0x19')](_0x275c76)[_0x898c('0x1a')]();};}function respondWithResult(_0x2b37c7,_0x4a8eac){_0x4a8eac=_0x4a8eac||0xc8;return function(_0x2af29f){if(_0x2af29f){return _0x2b37c7[_0x898c('0x19')](_0x4a8eac)[_0x898c('0x1b')](_0x2af29f);}};}function respondWithFilteredResult(_0xe19cb4,_0x250ab4){return function(_0x8759e1){if(_0x8759e1){var _0x180d19=_0x8759e1[_0x898c('0x1c')],_0x488555=_0x250ab4[_0x898c('0x1d')],_0x250c6f=_0x250ab4[_0x898c('0x1d')]+_0x250ab4['limit'],_0x3512e9;if(_0x250c6f>=_0x180d19){_0x250c6f=_0x180d19;_0x3512e9=0xc8;}else{_0x3512e9=0xce;}_0xe19cb4['status'](_0x3512e9);return _0xe19cb4[_0x898c('0x1e')](_0x898c('0x1f'),_0x488555+'-'+_0x250c6f+'/'+_0x180d19)['json'](_0x8759e1);}return null;};}function patchUpdates(_0x2a28f6){return function(_0x4e4102){try{jsonpatch[_0x898c('0x20')](_0x4e4102,_0x2a28f6,!![]);}catch(_0x176b60){return BPromise[_0x898c('0x21')](_0x176b60);}return _0x4e4102['save']();};}function saveUpdates(_0x48a0f1,_0x551277){return function(_0x4a9042){if(_0x4a9042){return _0x4a9042[_0x898c('0x22')](_0x48a0f1)[_0x898c('0x23')](function(_0x52aae5){return _0x52aae5;});}return null;};}function removeEntity(_0x440eb8,_0x188500){return function(_0x24002a){if(_0x24002a){return _0x24002a[_0x898c('0x24')]()['then'](function(){var _0x5092f4=_0x24002a[_0x898c('0x25')]({'plain':!![]});var _0x386d4d=_0x898c('0x26');return db['UserProfileResource'][_0x898c('0x24')]({'where':{'type':_0x386d4d,'resourceId':_0x5092f4['id']}})['then'](function(){return _0x24002a;});})[_0x898c('0x23')](function(){_0x440eb8[_0x898c('0x19')](0xcc)[_0x898c('0x1a')]();});}};}function handleEntityNotFound(_0x4a1b72,_0x1b7569){return function(_0x1e0bcf){if(!_0x1e0bcf){_0x4a1b72[_0x898c('0x18')](0x194);}return _0x1e0bcf;};}function handleError(_0x360e28,_0x14c997){_0x14c997=_0x14c997||0x1f4;return function(_0x4ac2ab){logger['error'](_0x4ac2ab[_0x898c('0x27')]);if(_0x4ac2ab[_0x898c('0x28')]){delete _0x4ac2ab[_0x898c('0x28')];}_0x360e28[_0x898c('0x19')](_0x14c997)[_0x898c('0x29')](_0x4ac2ab);};}exports[_0x898c('0x2a')]=function(_0x1febc6,_0x51d883){var _0x3b25fa={},_0xf81ca6={},_0x695d5d={'count':0x0,'rows':[]};var _0x17a586=_['map'](db[_0x898c('0x2b')][_0x898c('0x2c')],function(_0x164890){return{'name':_0x164890[_0x898c('0x2d')],'type':_0x164890[_0x898c('0x2e')][_0x898c('0x2f')]};});_0xf81ca6[_0x898c('0x30')]=_[_0x898c('0x31')](_0x17a586,_0x898c('0x28'));_0xf81ca6[_0x898c('0x32')]=_[_0x898c('0x33')](_0x1febc6[_0x898c('0x32')]);_0xf81ca6[_0x898c('0x34')]=_[_0x898c('0x35')](_0xf81ca6['model'],_0xf81ca6['query']);_0x3b25fa[_0x898c('0x36')]=_[_0x898c('0x35')](_0xf81ca6[_0x898c('0x30')],qs[_0x898c('0x37')](_0x1febc6[_0x898c('0x32')]['fields']));_0x3b25fa['attributes']=_0x3b25fa[_0x898c('0x36')][_0x898c('0x38')]?_0x3b25fa['attributes']:_0xf81ca6[_0x898c('0x30')];if(!_0x1febc6[_0x898c('0x32')]['hasOwnProperty'](_0x898c('0x39'))){_0x3b25fa[_0x898c('0x3a')]=qs[_0x898c('0x3a')](_0x1febc6[_0x898c('0x32')][_0x898c('0x3a')]);_0x3b25fa[_0x898c('0x1d')]=qs[_0x898c('0x1d')](_0x1febc6[_0x898c('0x32')][_0x898c('0x1d')]);}_0x3b25fa[_0x898c('0x3b')]=qs['sort'](_0x1febc6[_0x898c('0x32')][_0x898c('0x3c')]);_0x3b25fa[_0x898c('0x3d')]=qs[_0x898c('0x34')](_['pick'](_0x1febc6[_0x898c('0x32')],_0xf81ca6[_0x898c('0x34')]),_0x17a586);if(_0x1febc6['query']['filter']){_0x3b25fa[_0x898c('0x3d')]=_['merge'](_0x3b25fa[_0x898c('0x3d')],{'$or':_[_0x898c('0x31')](_0x17a586,function(_0x1dd890){if(_0x1dd890[_0x898c('0x2e')]!==_0x898c('0x3e')){var _0x42bbf5={};_0x42bbf5[_0x1dd890[_0x898c('0x28')]]={'$like':'%'+_0x1febc6[_0x898c('0x32')]['filter']+'%'};return _0x42bbf5;}})});}_0x3b25fa=_['merge']({},_0x3b25fa,_0x1febc6['options']);var _0x582b62={'where':_0x3b25fa['where']};return db['Sound'][_0x898c('0x1c')](_0x582b62)[_0x898c('0x23')](function(_0x138b7b){_0x695d5d['count']=_0x138b7b;if(_0x1febc6['query'][_0x898c('0x3f')]){_0x3b25fa['include']=[{'all':!![]}];}return db[_0x898c('0x2b')][_0x898c('0x40')](_0x3b25fa);})[_0x898c('0x23')](function(_0x36699d){_0x695d5d[_0x898c('0x41')]=_0x36699d;return _0x695d5d;})['then'](respondWithFilteredResult(_0x51d883,_0x3b25fa))['catch'](handleError(_0x51d883,null));};exports[_0x898c('0x42')]=function(_0x1ea111,_0x19187f){var _0x28c7de={'raw':!![],'where':{'id':_0x1ea111[_0x898c('0x43')]['id']}},_0x25f3b5={};_0x25f3b5[_0x898c('0x30')]=_[_0x898c('0x33')](db['Sound'][_0x898c('0x2c')]);_0x25f3b5[_0x898c('0x32')]=_[_0x898c('0x33')](_0x1ea111['query']);_0x25f3b5[_0x898c('0x34')]=_['intersection'](_0x25f3b5[_0x898c('0x30')],_0x25f3b5['query']);_0x28c7de[_0x898c('0x36')]=_['intersection'](_0x25f3b5[_0x898c('0x30')],qs[_0x898c('0x37')](_0x1ea111[_0x898c('0x32')][_0x898c('0x37')]));_0x28c7de['attributes']=_0x28c7de[_0x898c('0x36')][_0x898c('0x38')]?_0x28c7de['attributes']:_0x25f3b5[_0x898c('0x30')];if(_0x1ea111['query'][_0x898c('0x3f')]){_0x28c7de[_0x898c('0x44')]=[{'all':!![]}];}_0x28c7de=_[_0x898c('0x45')]({},_0x28c7de,_0x1ea111[_0x898c('0x46')]);return db[_0x898c('0x2b')][_0x898c('0x47')](_0x28c7de)[_0x898c('0x23')](handleEntityNotFound(_0x19187f,null))[_0x898c('0x23')](respondWithResult(_0x19187f,null))[_0x898c('0x48')](handleError(_0x19187f,null));};exports['download']=function(_0x3ec796,_0x4bcc38,_0x132384){return db[_0x898c('0x2b')]['find']({'where':{'id':_0x3ec796['params']['id']},'attributes':[_0x898c('0x28'),'save_name','converted_format'],'raw':!![]})[_0x898c('0x23')](handleEntityNotFound(_0x4bcc38,null))[_0x898c('0x23')](function(_0x57297c){if(_0x57297c){if(!fs[_0x898c('0x49')](path[_0x898c('0x4a')](config[_0x898c('0x4b')],_0x898c('0x4c'),_0x57297c[_0x898c('0x4d')]+'.'+_0x57297c[_0x898c('0x4e')]))){throw new db[(_0x898c('0x4f'))][(_0x898c('0x50'))](_0x898c('0x51'));}return _0x4bcc38['download'](path[_0x898c('0x4a')](config[_0x898c('0x4b')],_0x898c('0x4c'),util[_0x898c('0x52')]('%s.%s',_0x57297c['save_name'],_0x57297c[_0x898c('0x4e')])),util['format'](_0x898c('0x53'),_0x57297c['name'],_0x57297c[_0x898c('0x4e')]));}return null;})[_0x898c('0x48')](handleError(_0x4bcc38,null));};exports[_0x898c('0x54')]=function(_0x4ded56,_0x3b2654,_0x4e0086){var _0x13da45={'name':path[_0x898c('0x55')](_0x4ded56[_0x898c('0x56')][_0x898c('0x57')],path[_0x898c('0x58')](_0x4ded56[_0x898c('0x56')][_0x898c('0x57')])),'save_name':path[_0x898c('0x55')](_0x4ded56[_0x898c('0x56')]['filename'],path[_0x898c('0x58')](_0x4ded56['file'][_0x898c('0x59')])),'original_format':path['extname'](_0x4ded56['file'][_0x898c('0x57')])['substring'](0x1),'converted_format':_0x898c('0x5a')};var _0x5af8c6=path['join'](config[_0x898c('0x4b')],_0x898c('0x5b'),_0x4ded56['file']['filename']);var _0x23b922=path[_0x898c('0x4a')](config['root'],_0x898c('0x4c'),util['format'](_0x898c('0x53'),path[_0x898c('0x55')](_0x4ded56[_0x898c('0x56')][_0x898c('0x59')],path['extname'](_0x4ded56[_0x898c('0x56')][_0x898c('0x59')])),_0x13da45[_0x898c('0x4e')]));logger['info'](_0x898c('0x5c'),_0x5af8c6);logger[_0x898c('0x5d')](_0x898c('0x5e'),_0x23b922);try{fs[_0x898c('0x5f')](_0x5af8c6,parseInt(_0x898c('0x60'),0x8));var _0x40eeea=sox[_0x898c('0x61')](_0x5af8c6,_0x23b922,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x40eeea['on'](_0x898c('0x62'),function(_0x2a9953){fs[_0x898c('0x63')](_0x5af8c6);_0x3b2654[_0x898c('0x19')](0x1f4)['send'](_0x2a9953);});_0x40eeea['on']('src',function(_0x53e7c4){_0x13da45[_0x898c('0x64')]=isNaN(_0x53e7c4['duration'])?null:_0x53e7c4[_0x898c('0x65')]*0x3e8;_0x13da45['original_sampleCount']=isNaN(_0x53e7c4[_0x898c('0x66')])?null:_0x53e7c4['sampleCount'];_0x13da45[_0x898c('0x67')]=isNaN(_0x53e7c4[_0x898c('0x68')])?null:_0x53e7c4['channelCount'];_0x13da45['original_bitRate']=isNaN(_0x53e7c4[_0x898c('0x69')])?null:_0x53e7c4[_0x898c('0x69')];_0x13da45[_0x898c('0x6a')]=isNaN(_0x53e7c4[_0x898c('0x6b')])?null:_0x53e7c4[_0x898c('0x6b')];});_0x40eeea['on'](_0x898c('0x6c'),function(_0x1f99f1){_0x13da45[_0x898c('0x6d')]=isNaN(_0x1f99f1['duration'])?null:_0x1f99f1['duration']*0x3e8;_0x13da45['converted_sampleCount']=isNaN(_0x1f99f1['sampleCount'])?null:_0x1f99f1[_0x898c('0x66')];_0x13da45[_0x898c('0x6e')]=isNaN(_0x1f99f1[_0x898c('0x68')])?null:_0x1f99f1[_0x898c('0x68')];_0x13da45[_0x898c('0x6f')]=isNaN(_0x1f99f1['bitRate'])?null:_0x1f99f1['bitRate'];_0x13da45[_0x898c('0x70')]=isNaN(_0x1f99f1[_0x898c('0x6b')])?null:_0x1f99f1[_0x898c('0x6b')];});_0x40eeea['on'](_0x898c('0x1a'),function(){fs[_0x898c('0x5f')](_0x23b922,parseInt(_0x898c('0x60'),0x8));return db[_0x898c('0x2b')]['create'](_0x13da45)[_0x898c('0x23')](function(_0x4e278d){var _0x4a91e8={'role':_0x4ded56[_0x898c('0x71')]['role'],'userProfileId':_0x4ded56[_0x898c('0x71')][_0x898c('0x72')]};if(!_0x4a91e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a91e8[_0x898c('0x73')]===_0x898c('0x74')){var _0x4886d9=_0x4e278d[_0x898c('0x25')]({'plain':!![]});return db[_0x898c('0x75')]['find']({'where':{'name':_0x898c('0x26'),'userProfileId':_0x4a91e8[_0x898c('0x72')]},'raw':!![]})[_0x898c('0x23')](function(_0x1199eb){if(_0x1199eb&&_0x1199eb[_0x898c('0x76')]===0x0){return db[_0x898c('0x77')]['create']({'name':_0x4886d9[_0x898c('0x28')],'resourceId':_0x4886d9['id'],'type':_0x1199eb[_0x898c('0x28')],'sectionId':_0x1199eb['id']},{})[_0x898c('0x23')](function(){return _0x4e278d;});}else{return _0x4e278d;}})['catch'](function(_0x28dc65){logger[_0x898c('0x62')](_0x898c('0x78'),_0x28dc65);throw _0x28dc65;});}return _0x4e278d;})[_0x898c('0x23')](respondWithResult(_0x3b2654,null))[_0x898c('0x48')](handleError(_0x3b2654,null));});_0x40eeea['start']();}catch(_0x450328){_0x3b2654[_0x898c('0x19')](0x1f4)[_0x898c('0x29')](_0x450328);}};exports[_0x898c('0x22')]=function(_0x430f73,_0x12535d,_0x1342ea){return db[_0x898c('0x2b')][_0x898c('0x47')]({'where':{'id':_0x430f73[_0x898c('0x43')]['id']}})[_0x898c('0x23')](handleEntityNotFound(_0x12535d,null))[_0x898c('0x23')](saveUpdates(_['pick'](_0x430f73['body'],[_0x898c('0x28'),_0x898c('0x79')]),null))['then'](respondWithResult(_0x12535d,null))[_0x898c('0x48')](handleError(_0x12535d,null));};exports[_0x898c('0x7a')]=function(_0x41c743,_0x308f19,_0xd8f91b){return db[_0x898c('0x2b')]['find']({'where':{'id':_0x41c743[_0x898c('0x43')]['id']}})[_0x898c('0x23')](function(_0x18f328){if(_0x18f328){return _0x18f328[_0x898c('0x24')]();}})['then'](function(_0x2c047e){var _0x177a88=path[_0x898c('0x4a')](config['root'],_0x898c('0x5b'),util[_0x898c('0x52')](_0x898c('0x53'),_0x2c047e[_0x898c('0x4d')],_0x2c047e['original_format']));var _0x17ff86=path[_0x898c('0x4a')](config['root'],_0x898c('0x4c'),util['format']('%s.%s',_0x2c047e[_0x898c('0x4d')],_0x2c047e[_0x898c('0x4e')]));fs[_0x898c('0x63')](_0x177a88);fs[_0x898c('0x63')](_0x17ff86);return _0x2c047e;})['then'](function(_0x50766d){if(_0x50766d){return _0x308f19['status'](0xcc)[_0x898c('0x1a')]();}})[_0x898c('0x23')](handleEntityNotFound(_0x308f19,null))['catch'](handleError(_0x308f19,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 690cd8a..9e8b50d 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 _0x6948=['exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c4446,_0x37e1aa){var _0x1d283f=function(_0x298ab4){while(--_0x298ab4){_0x5c4446['push'](_0x5c4446['shift']());}};_0x1d283f(++_0x37e1aa);}(_0x6948,0x1ca));var _0x8694=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6948[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x8694('0x0'));var util=require(_0x8694('0x1'));var logger=require(_0x8694('0x2'))(_0x8694('0x3'));var moment=require(_0x8694('0x4'));var BPromise=require(_0x8694('0x5'));var rp=require(_0x8694('0x6'));var fs=require('fs');var path=require(_0x8694('0x7'));var rimraf=require(_0x8694('0x8'));var config=require(_0x8694('0x9'));var attributes=require('./sound.attributes');module[_0x8694('0xa')]=function(_0x2840ed,_0x45ba08){return _0x2840ed[_0x8694('0xb')]('Sound',attributes,{'tableName':_0x8694('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdd3=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound','lodash'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0xfdd3,0x1ac));var _0x3fdd=function(_0x4b0f03,_0x226591){_0x4b0f03=_0x4b0f03-0x0;var _0x3a609c=_0xfdd3[_0x4b0f03];return _0x3a609c;};'use strict';var _=require(_0x3fdd('0x0'));var util=require(_0x3fdd('0x1'));var logger=require(_0x3fdd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3fdd('0x3'));var rp=require(_0x3fdd('0x4'));var fs=require('fs');var path=require(_0x3fdd('0x5'));var rimraf=require('rimraf');var config=require(_0x3fdd('0x6'));var attributes=require(_0x3fdd('0x7'));module[_0x3fdd('0x8')]=function(_0x464022,_0x19bb4f){return _0x464022[_0x3fdd('0x9')](_0x3fdd('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 04ebab8..22c3bd3 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 _0xc85e=['where','attributes','include','model','map','ShowSound','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result','Sound','options','raw'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc85e,0xa7));var _0xec85=function(_0x2c4420,_0x79e62){_0x2c4420=_0x2c4420-0x0;var _0x5f43da=_0xc85e[_0x2c4420];return _0x5f43da;};'use strict';var _=require(_0xec85('0x0'));var util=require(_0xec85('0x1'));var moment=require(_0xec85('0x2'));var BPromise=require(_0xec85('0x3'));var rs=require(_0xec85('0x4'));var fs=require('fs');var Redis=require(_0xec85('0x5'));var db=require(_0xec85('0x6'))['db'];var utils=require(_0xec85('0x7'));var logger=require(_0xec85('0x8'))(_0xec85('0x9'));var config=require(_0xec85('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53e8e3,_0xffa10a,_0x353e7f){return new BPromise(function(_0x5e03e2,_0x12d309){return client[_0xec85('0xb')](_0x53e8e3,_0x353e7f)[_0xec85('0xc')](function(_0x208f0e){logger[_0xec85('0xd')]('Sound,\x20%s,\x20%s',_0xffa10a,_0xec85('0xe'));logger[_0xec85('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0xffa10a,'request\x20sent',JSON[_0xec85('0x10')](_0x208f0e));if(_0x208f0e[_0xec85('0x11')]){if(_0x208f0e['error'][_0xec85('0x12')]===0x1f4){logger['error'](_0xec85('0x13'),_0xffa10a,_0x208f0e[_0xec85('0x11')][_0xec85('0x14')]);return _0x12d309(_0x208f0e['error']['message']);}logger[_0xec85('0x11')](_0xec85('0x13'),_0xffa10a,_0x208f0e[_0xec85('0x11')][_0xec85('0x14')]);return _0x5e03e2(_0x208f0e[_0xec85('0x11')][_0xec85('0x14')]);}else{logger[_0xec85('0xd')](_0xec85('0x13'),_0xffa10a,'request\x20sent');_0x5e03e2(_0x208f0e[_0xec85('0x15')]['message']);}})['catch'](function(_0x481475){logger[_0xec85('0x11')](_0xec85('0x13'),_0xffa10a,_0x481475);_0x12d309(_0x481475);});});}exports['ShowSound']=function(_0x384ed7){var _0x2f4519=this;return new Promise(function(_0x5cb6da,_0x65c425){return db[_0xec85('0x16')]['find']({'raw':_0x384ed7[_0xec85('0x17')]?_0x384ed7[_0xec85('0x17')][_0xec85('0x18')]===undefined?!![]:![]:!![],'where':_0x384ed7[_0xec85('0x17')]?_0x384ed7[_0xec85('0x17')][_0xec85('0x19')]||null:null,'attributes':_0x384ed7['options']?_0x384ed7[_0xec85('0x17')][_0xec85('0x1a')]||null:null,'include':_0x384ed7[_0xec85('0x17')]?_0x384ed7['options']['include']?_['map'](_0x384ed7[_0xec85('0x17')][_0xec85('0x1b')],function(_0x302765){return{'model':db[_0x302765[_0xec85('0x1c')]],'as':_0x302765['as'],'attributes':_0x302765[_0xec85('0x1a')],'include':_0x302765[_0xec85('0x1b')]?_[_0xec85('0x1d')](_0x302765[_0xec85('0x1b')],function(_0x4a01fb){return{'model':db[_0x4a01fb[_0xec85('0x1c')]],'as':_0x4a01fb['as'],'attributes':_0x4a01fb[_0xec85('0x1a')],'include':_0x4a01fb[_0xec85('0x1b')]?_[_0xec85('0x1d')](_0x4a01fb[_0xec85('0x1b')],function(_0x5ace1e){return{'model':db[_0x5ace1e[_0xec85('0x1c')]],'as':_0x5ace1e['as'],'attributes':_0x5ace1e[_0xec85('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xec85('0xc')](function(_0x324be6){logger['info'](_0xec85('0x1e'),_0x384ed7);logger[_0xec85('0xf')](_0xec85('0x1e'),_0x384ed7,JSON['stringify'](_0x324be6));_0x5cb6da(_0x324be6);})[_0xec85('0x1f')](function(_0x2a712d){logger[_0xec85('0x11')](_0xec85('0x1e'),_0x2a712d[_0xec85('0x14')],_0x384ed7);_0x65c425(_0x2f4519[_0xec85('0x11')](0x1f4,_0x2a712d['message']));});});}; \ No newline at end of file +var _0x2379=['request','then','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','ShowSound','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2379,0xb5));var _0x9237=function(_0x5ee70d,_0x1e227d){_0x5ee70d=_0x5ee70d-0x0;var _0x12cf6a=_0x2379[_0x5ee70d];return _0x12cf6a;};'use strict';var _=require(_0x9237('0x0'));var util=require(_0x9237('0x1'));var moment=require(_0x9237('0x2'));var BPromise=require(_0x9237('0x3'));var rs=require(_0x9237('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9237('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9237('0x6'))(_0x9237('0x7'));var config=require(_0x9237('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9237('0x9')][_0x9237('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x562802,_0x536124,_0x4475d7){return new BPromise(function(_0x3ac6a2,_0x6dad0a){return client[_0x9237('0xb')](_0x562802,_0x4475d7)[_0x9237('0xc')](function(_0x362c12){logger['info']('Sound,\x20%s,\x20%s',_0x536124,_0x9237('0xd'));logger[_0x9237('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x536124,_0x9237('0xd'),JSON[_0x9237('0xf')](_0x362c12));if(_0x362c12[_0x9237('0x10')]){if(_0x362c12[_0x9237('0x10')][_0x9237('0x11')]===0x1f4){logger[_0x9237('0x10')](_0x9237('0x12'),_0x536124,_0x362c12[_0x9237('0x10')][_0x9237('0x13')]);return _0x6dad0a(_0x362c12[_0x9237('0x10')][_0x9237('0x13')]);}logger[_0x9237('0x10')](_0x9237('0x12'),_0x536124,_0x362c12[_0x9237('0x10')]['message']);return _0x3ac6a2(_0x362c12[_0x9237('0x10')][_0x9237('0x13')]);}else{logger[_0x9237('0x14')](_0x9237('0x12'),_0x536124,_0x9237('0xd'));_0x3ac6a2(_0x362c12[_0x9237('0x15')]['message']);}})['catch'](function(_0x7b5e0e){logger[_0x9237('0x10')](_0x9237('0x12'),_0x536124,_0x7b5e0e);_0x6dad0a(_0x7b5e0e);});});}exports[_0x9237('0x16')]=function(_0x57ba5d){var _0xcd9dc2=this;return new Promise(function(_0x8e240c,_0x1dca95){return db['Sound'][_0x9237('0x17')]({'raw':_0x57ba5d[_0x9237('0x18')]?_0x57ba5d['options'][_0x9237('0x19')]===undefined?!![]:![]:!![],'where':_0x57ba5d[_0x9237('0x18')]?_0x57ba5d[_0x9237('0x18')][_0x9237('0x1a')]||null:null,'attributes':_0x57ba5d[_0x9237('0x18')]?_0x57ba5d[_0x9237('0x18')][_0x9237('0x1b')]||null:null,'include':_0x57ba5d['options']?_0x57ba5d[_0x9237('0x18')][_0x9237('0x1c')]?_[_0x9237('0x1d')](_0x57ba5d[_0x9237('0x18')]['include'],function(_0x2a0356){return{'model':db[_0x2a0356[_0x9237('0x1e')]],'as':_0x2a0356['as'],'attributes':_0x2a0356[_0x9237('0x1b')],'include':_0x2a0356['include']?_[_0x9237('0x1d')](_0x2a0356[_0x9237('0x1c')],function(_0x4f3abf){return{'model':db[_0x4f3abf[_0x9237('0x1e')]],'as':_0x4f3abf['as'],'attributes':_0x4f3abf['attributes'],'include':_0x4f3abf[_0x9237('0x1c')]?_[_0x9237('0x1d')](_0x4f3abf['include'],function(_0x230454){return{'model':db[_0x230454[_0x9237('0x1e')]],'as':_0x230454['as'],'attributes':_0x230454['attributes']};}):[]};}):[]};}):[]:[]})[_0x9237('0xc')](function(_0x89ea67){logger[_0x9237('0x14')]('ShowSound',_0x57ba5d);logger[_0x9237('0xe')](_0x9237('0x16'),_0x57ba5d,JSON['stringify'](_0x89ea67));_0x8e240c(_0x89ea67);})[_0x9237('0x1f')](function(_0x3ba6d0){logger[_0x9237('0x10')]('ShowSound',_0x3ba6d0[_0x9237('0x13')],_0x57ba5d);_0x1dca95(_0xcd9dc2[_0x9237('0x10')](0x1f4,_0x3ba6d0['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 4e04591..5fb5749 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 _0x3055=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x3753d9,_0x5a50ce){var _0x22e295=function(_0xf07355){while(--_0xf07355){_0x3753d9['push'](_0x3753d9['shift']());}};_0x22e295(++_0x5a50ce);}(_0x3055,0x79));var _0x5305=function(_0x2b0a4a,_0x2f5a81){_0x2b0a4a=_0x2b0a4a-0x0;var _0x10442b=_0x3055[_0x2b0a4a];return _0x10442b;};'use strict';var multer=require(_0x5305('0x0'));var util=require(_0x5305('0x1'));var path=require(_0x5305('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5305('0x3')]();var auth=require(_0x5305('0x4'));var interaction=require(_0x5305('0x5'));var config=require(_0x5305('0x6'));var controller=require(_0x5305('0x7'));router['get']('/',auth[_0x5305('0x8')](),controller[_0x5305('0x9')]);router[_0x5305('0xa')](_0x5305('0xb'),auth[_0x5305('0x8')](),controller[_0x5305('0xc')]);router['post']('/',auth[_0x5305('0x8')](),controller[_0x5305('0xd')]);router[_0x5305('0xe')](_0x5305('0xb'),auth[_0x5305('0x8')](),controller['update']);router['delete'](_0x5305('0xb'),auth[_0x5305('0x8')](),controller[_0x5305('0xf')]);module[_0x5305('0x10')]=router; \ No newline at end of file +var _0xe59e=['../../config/environment','./squareMessage.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x3ba4b3,_0x584dac){var _0x53bb31=function(_0xb70ac7){while(--_0xb70ac7){_0x3ba4b3['push'](_0x3ba4b3['shift']());}};_0x53bb31(++_0x584dac);}(_0xe59e,0xdc));var _0xee59=function(_0x1d9a77,_0x1299e4){_0x1d9a77=_0x1d9a77-0x0;var _0x272852=_0xe59e[_0x1d9a77];return _0x272852;};'use strict';var multer=require('multer');var util=require(_0xee59('0x0'));var path=require('path');var timeout=require(_0xee59('0x1'));var express=require('express');var router=express[_0xee59('0x2')]();var auth=require(_0xee59('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xee59('0x4'));var controller=require(_0xee59('0x5'));router[_0xee59('0x6')]('/',auth[_0xee59('0x7')](),controller['index']);router[_0xee59('0x6')]('/:id',auth[_0xee59('0x7')](),controller[_0xee59('0x8')]);router[_0xee59('0x9')]('/',auth[_0xee59('0x7')](),controller[_0xee59('0xa')]);router[_0xee59('0xb')](_0xee59('0xc'),auth[_0xee59('0x7')](),controller[_0xee59('0xd')]);router['delete'](_0xee59('0xc'),auth[_0xee59('0x7')](),controller[_0xee59('0xe')]);module[_0xee59('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e58e59c..99eb7fe 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 _0x0ba7=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x458dd2,_0xb2c6e6){var _0x470f65=function(_0x506bc9){while(--_0x506bc9){_0x458dd2['push'](_0x458dd2['shift']());}};_0x470f65(++_0xb2c6e6);}(_0x0ba7,0x16d));var _0x70ba=function(_0x415b3b,_0xc53743){_0x415b3b=_0x415b3b-0x0;var _0x22d596=_0x0ba7[_0x415b3b];return _0x22d596;};'use strict';var Sequelize=require(_0x70ba('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x70ba('0x1')]},'body':{'type':Sequelize[_0x70ba('0x2')](_0x70ba('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x70ba('0x4')]('in','out'),'defaultValue':_0x70ba('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x70ba('0x1')]},'providerResponse':{'type':Sequelize[_0x70ba('0x2')]}}; \ No newline at end of file +var _0xaba6=['out','TEXT','sequelize','exports'];(function(_0x2c8be4,_0x380f0e){var _0x442531=function(_0x5ee501){while(--_0x5ee501){_0x2c8be4['push'](_0x2c8be4['shift']());}};_0x442531(++_0x380f0e);}(_0xaba6,0xe2));var _0x6aba=function(_0x4eeb43,_0x3fd58d){_0x4eeb43=_0x4eeb43-0x0;var _0x559af8=_0xaba6[_0x4eeb43];return _0x559af8;};'use strict';var Sequelize=require(_0x6aba('0x0'));module[_0x6aba('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6aba('0x2')),'defaultValue':_0x6aba('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6aba('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0cf8025..1893000 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 _0x7998=['squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','include','show','rawAttributes','fields','includeAll','merge','find','create','catch','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x5a81e3,_0x2a419c){var _0x115d3f=function(_0x65a684){while(--_0x65a684){_0x5a81e3['push'](_0x5a81e3['shift']());}};_0x115d3f(++_0x2a419c);}(_0x7998,0x17d));var _0x8799=function(_0xeae82f,_0x5139bb){_0xeae82f=_0xeae82f-0x0;var _0x561707=_0x7998[_0xeae82f];return _0x561707;};'use strict';var pdf=require(_0x8799('0x0'));var emlformat=require(_0x8799('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8799('0x2'));var jsonpatch=require(_0x8799('0x3'));var rp=require(_0x8799('0x4'));var moment=require(_0x8799('0x5'));var BPromise=require(_0x8799('0x6'));var Mustache=require(_0x8799('0x7'));var util=require(_0x8799('0x8'));var path=require(_0x8799('0x9'));var sox=require(_0x8799('0xa'));var csv=require(_0x8799('0xb'));var ejs=require(_0x8799('0xc'));var fs=require('fs');var _=require(_0x8799('0xd'));var squel=require(_0x8799('0xe'));var crypto=require('crypto');var jsforce=require(_0x8799('0xf'));var deskjs=require(_0x8799('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8799('0x11'));var Papa=require('papaparse');var Redis=require(_0x8799('0x12'));var authService=require(_0x8799('0x13'));var qs=require(_0x8799('0x14'));var as=require(_0x8799('0x15'));var hardwareService=require(_0x8799('0x16'));var logger=require('../../config/logger')(_0x8799('0x17'));var utils=require(_0x8799('0x18'));var config=require(_0x8799('0x19'));var licenseUtil=require(_0x8799('0x1a'));var db=require(_0x8799('0x1b'))['db'];function respondWithStatusCode(_0x56e3a1,_0x3e3d17){_0x3e3d17=_0x3e3d17||0xcc;return function(_0x5360ad){if(_0x5360ad){return _0x56e3a1[_0x8799('0x1c')](_0x3e3d17);}return _0x56e3a1[_0x8799('0x1d')](_0x3e3d17)[_0x8799('0x1e')]();};}function respondWithResult(_0x377673,_0x19a1f9){_0x19a1f9=_0x19a1f9||0xc8;return function(_0x2b136a){if(_0x2b136a){return _0x377673[_0x8799('0x1d')](_0x19a1f9)[_0x8799('0x1f')](_0x2b136a);}};}function respondWithFilteredResult(_0x593549,_0x1b2180){return function(_0x5b26c2){if(_0x5b26c2){var _0x11818d=_0x5b26c2['count'],_0x577290=_0x1b2180[_0x8799('0x20')],_0x3e9ff4=_0x1b2180[_0x8799('0x20')]+_0x1b2180[_0x8799('0x21')],_0x5e5b29;if(_0x3e9ff4>=_0x11818d){_0x3e9ff4=_0x11818d;_0x5e5b29=0xc8;}else{_0x5e5b29=0xce;}_0x593549['status'](_0x5e5b29);return _0x593549[_0x8799('0x22')](_0x8799('0x23'),_0x577290+'-'+_0x3e9ff4+'/'+_0x11818d)[_0x8799('0x1f')](_0x5b26c2);}return null;};}function patchUpdates(_0x80edce){return function(_0x470842){try{jsonpatch['apply'](_0x470842,_0x80edce,!![]);}catch(_0x50fe6d){return BPromise[_0x8799('0x24')](_0x50fe6d);}return _0x470842[_0x8799('0x25')]();};}function saveUpdates(_0x397db8,_0x11e819){return function(_0x10f0a8){if(_0x10f0a8){return _0x10f0a8[_0x8799('0x26')](_0x397db8)[_0x8799('0x27')](function(_0x576501){return _0x576501;});}return null;};}function removeEntity(_0xdc1594,_0xf83af3){return function(_0x46746f){if(_0x46746f){return _0x46746f[_0x8799('0x28')]()[_0x8799('0x27')](function(){_0xdc1594[_0x8799('0x1d')](0xcc)[_0x8799('0x1e')]();});}};}function handleEntityNotFound(_0x3a4304,_0x29322a){return function(_0x3e4286){if(!_0x3e4286){_0x3a4304['sendStatus'](0x194);}return _0x3e4286;};}function handleError(_0x3173e4,_0x10acb3){_0x10acb3=_0x10acb3||0x1f4;return function(_0x527be7){logger[_0x8799('0x29')](_0x527be7[_0x8799('0x2a')]);if(_0x527be7[_0x8799('0x2b')]){delete _0x527be7['name'];}_0x3173e4['status'](_0x10acb3)[_0x8799('0x2c')](_0x527be7);};}exports[_0x8799('0x2d')]=function(_0x392aea,_0x47c98e){var _0x1ee8d2={},_0x567c55={},_0x305f68={'count':0x0,'rows':[]};var _0x2d4a02=_[_0x8799('0x2e')](db[_0x8799('0x2f')]['rawAttributes'],function(_0x42b318){return{'name':_0x42b318[_0x8799('0x30')],'type':_0x42b318[_0x8799('0x31')][_0x8799('0x32')]};});_0x567c55['model']=_[_0x8799('0x2e')](_0x2d4a02,'name');_0x567c55[_0x8799('0x33')]=_[_0x8799('0x34')](_0x392aea[_0x8799('0x33')]);_0x567c55[_0x8799('0x35')]=_['intersection'](_0x567c55[_0x8799('0x36')],_0x567c55[_0x8799('0x33')]);_0x1ee8d2[_0x8799('0x37')]=_[_0x8799('0x38')](_0x567c55[_0x8799('0x36')],qs['fields'](_0x392aea['query']['fields']));_0x1ee8d2[_0x8799('0x37')]=_0x1ee8d2[_0x8799('0x37')][_0x8799('0x39')]?_0x1ee8d2['attributes']:_0x567c55['model'];if(!_0x392aea[_0x8799('0x33')][_0x8799('0x3a')](_0x8799('0x3b'))){_0x1ee8d2[_0x8799('0x21')]=qs[_0x8799('0x21')](_0x392aea[_0x8799('0x33')][_0x8799('0x21')]);_0x1ee8d2['offset']=qs[_0x8799('0x20')](_0x392aea[_0x8799('0x33')]['offset']);}_0x1ee8d2[_0x8799('0x3c')]=qs[_0x8799('0x3d')](_0x392aea['query'][_0x8799('0x3d')]);_0x1ee8d2[_0x8799('0x3e')]=qs['filters'](_[_0x8799('0x3f')](_0x392aea['query'],_0x567c55[_0x8799('0x35')]),_0x2d4a02);if(_0x392aea[_0x8799('0x33')][_0x8799('0x40')]){_0x1ee8d2[_0x8799('0x3e')]=_['merge'](_0x1ee8d2[_0x8799('0x3e')],{'$or':_[_0x8799('0x2e')](_0x2d4a02,function(_0x24aea5){if(_0x24aea5[_0x8799('0x31')]!==_0x8799('0x41')){var _0x5f10b8={};_0x5f10b8[_0x24aea5[_0x8799('0x2b')]]={'$like':'%'+_0x392aea[_0x8799('0x33')][_0x8799('0x40')]+'%'};return _0x5f10b8;}})});}_0x1ee8d2=_['merge']({},_0x1ee8d2,_0x392aea[_0x8799('0x42')]);var _0x1f47d9={'where':_0x1ee8d2[_0x8799('0x3e')]};return db[_0x8799('0x2f')][_0x8799('0x43')](_0x1f47d9)[_0x8799('0x27')](function(_0x910ffa){_0x305f68[_0x8799('0x43')]=_0x910ffa;if(_0x392aea[_0x8799('0x33')]['includeAll']){_0x1ee8d2[_0x8799('0x44')]=[{'all':!![]}];}return db[_0x8799('0x2f')]['findAll'](_0x1ee8d2);})[_0x8799('0x27')](function(_0xd4fd44){_0x305f68['rows']=_0xd4fd44;return _0x305f68;})[_0x8799('0x27')](respondWithFilteredResult(_0x47c98e,_0x1ee8d2))['catch'](handleError(_0x47c98e,null));};exports[_0x8799('0x45')]=function(_0x55568f,_0x579135){var _0x2c7989={'raw':!![],'where':{'id':_0x55568f['params']['id']}},_0x580b53={};_0x580b53['model']=_[_0x8799('0x34')](db[_0x8799('0x2f')][_0x8799('0x46')]);_0x580b53[_0x8799('0x33')]=_[_0x8799('0x34')](_0x55568f['query']);_0x580b53[_0x8799('0x35')]=_['intersection'](_0x580b53[_0x8799('0x36')],_0x580b53[_0x8799('0x33')]);_0x2c7989['attributes']=_[_0x8799('0x38')](_0x580b53[_0x8799('0x36')],qs[_0x8799('0x47')](_0x55568f[_0x8799('0x33')][_0x8799('0x47')]));_0x2c7989[_0x8799('0x37')]=_0x2c7989['attributes'][_0x8799('0x39')]?_0x2c7989[_0x8799('0x37')]:_0x580b53[_0x8799('0x36')];if(_0x55568f[_0x8799('0x33')][_0x8799('0x48')]){_0x2c7989[_0x8799('0x44')]=[{'all':!![]}];}_0x2c7989=_[_0x8799('0x49')]({},_0x2c7989,_0x55568f[_0x8799('0x42')]);return db[_0x8799('0x2f')][_0x8799('0x4a')](_0x2c7989)['then'](handleEntityNotFound(_0x579135,null))[_0x8799('0x27')](respondWithResult(_0x579135,null))['catch'](handleError(_0x579135,null));};exports[_0x8799('0x4b')]=function(_0x10cb1e,_0x3ab813){return db['SquareMessage'][_0x8799('0x4b')](_0x10cb1e['body'],{})['then'](respondWithResult(_0x3ab813,0xc9))[_0x8799('0x4c')](handleError(_0x3ab813,null));};exports['update']=function(_0x5aec0e,_0x5a3ae6){if(_0x5aec0e['body']['id']){delete _0x5aec0e[_0x8799('0x4d')]['id'];}return db[_0x8799('0x2f')][_0x8799('0x4a')]({'where':{'id':_0x5aec0e[_0x8799('0x4e')]['id']}})[_0x8799('0x27')](handleEntityNotFound(_0x5a3ae6,null))[_0x8799('0x27')](saveUpdates(_0x5aec0e['body'],null))[_0x8799('0x27')](respondWithResult(_0x5a3ae6,null))[_0x8799('0x4c')](handleError(_0x5a3ae6,null));};exports['destroy']=function(_0x1f197f,_0x44bd81){return db[_0x8799('0x2f')][_0x8799('0x4a')]({'where':{'id':_0x1f197f['params']['id']}})[_0x8799('0x27')](handleEntityNotFound(_0x44bd81,null))[_0x8799('0x27')](removeEntity(_0x44bd81,null))['catch'](handleError(_0x44bd81,null));}; \ No newline at end of file +var _0xbab0=['type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName'];(function(_0x184857,_0x20486d){var _0x51439c=function(_0x3f349a){while(--_0x3f349a){_0x184857['push'](_0x184857['shift']());}};_0x51439c(++_0x20486d);}(_0xbab0,0x6c));var _0x0bab=function(_0x283fe2,_0x557533){_0x283fe2=_0x283fe2-0x0;var _0x5a1e15=_0xbab0[_0x283fe2];return _0x5a1e15;};'use strict';var pdf=require(_0x0bab('0x0'));var emlformat=require(_0x0bab('0x1'));var rimraf=require(_0x0bab('0x2'));var zipdir=require(_0x0bab('0x3'));var jsonpatch=require(_0x0bab('0x4'));var rp=require(_0x0bab('0x5'));var moment=require(_0x0bab('0x6'));var BPromise=require(_0x0bab('0x7'));var Mustache=require(_0x0bab('0x8'));var util=require(_0x0bab('0x9'));var path=require(_0x0bab('0xa'));var sox=require('sox');var csv=require(_0x0bab('0xb'));var ejs=require(_0x0bab('0xc'));var fs=require('fs');var _=require(_0x0bab('0xd'));var squel=require(_0x0bab('0xe'));var crypto=require(_0x0bab('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0bab('0x10'));var toCsv=require(_0x0bab('0xb'));var querystring=require(_0x0bab('0x11'));var Papa=require(_0x0bab('0x12'));var Redis=require(_0x0bab('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bab('0x14'));var hardwareService=require(_0x0bab('0x15'));var logger=require(_0x0bab('0x16'))('api');var utils=require(_0x0bab('0x17'));var config=require(_0x0bab('0x18'));var licenseUtil=require(_0x0bab('0x19'));var db=require(_0x0bab('0x1a'))['db'];function respondWithStatusCode(_0xa77229,_0x52b646){_0x52b646=_0x52b646||0xcc;return function(_0x38b978){if(_0x38b978){return _0xa77229[_0x0bab('0x1b')](_0x52b646);}return _0xa77229[_0x0bab('0x1c')](_0x52b646)['end']();};}function respondWithResult(_0x118d7e,_0xc0ea78){_0xc0ea78=_0xc0ea78||0xc8;return function(_0x1cb6e5){if(_0x1cb6e5){return _0x118d7e['status'](_0xc0ea78)['json'](_0x1cb6e5);}};}function respondWithFilteredResult(_0x362856,_0x3d67b1){return function(_0x241bbd){if(_0x241bbd){var _0x2095be=_0x241bbd[_0x0bab('0x1d')],_0x3bad2a=_0x3d67b1['offset'],_0x187702=_0x3d67b1[_0x0bab('0x1e')]+_0x3d67b1[_0x0bab('0x1f')],_0x3531a8;if(_0x187702>=_0x2095be){_0x187702=_0x2095be;_0x3531a8=0xc8;}else{_0x3531a8=0xce;}_0x362856['status'](_0x3531a8);return _0x362856[_0x0bab('0x20')]('Content-Range',_0x3bad2a+'-'+_0x187702+'/'+_0x2095be)[_0x0bab('0x21')](_0x241bbd);}return null;};}function patchUpdates(_0x122d42){return function(_0x293f3b){try{jsonpatch[_0x0bab('0x22')](_0x293f3b,_0x122d42,!![]);}catch(_0x275fed){return BPromise[_0x0bab('0x23')](_0x275fed);}return _0x293f3b[_0x0bab('0x24')]();};}function saveUpdates(_0x13fae7,_0x30cf0d){return function(_0x17b8d2){if(_0x17b8d2){return _0x17b8d2[_0x0bab('0x25')](_0x13fae7)[_0x0bab('0x26')](function(_0x2d8566){return _0x2d8566;});}return null;};}function removeEntity(_0x1e5f6b,_0x28dd78){return function(_0x5ae3c8){if(_0x5ae3c8){return _0x5ae3c8[_0x0bab('0x27')]()[_0x0bab('0x26')](function(){_0x1e5f6b[_0x0bab('0x1c')](0xcc)[_0x0bab('0x28')]();});}};}function handleEntityNotFound(_0x5d4e82,_0x42c599){return function(_0x596aa3){if(!_0x596aa3){_0x5d4e82['sendStatus'](0x194);}return _0x596aa3;};}function handleError(_0x4e2f10,_0x4622e0){_0x4622e0=_0x4622e0||0x1f4;return function(_0x51a82c){logger[_0x0bab('0x29')](_0x51a82c[_0x0bab('0x2a')]);if(_0x51a82c[_0x0bab('0x2b')]){delete _0x51a82c[_0x0bab('0x2b')];}_0x4e2f10[_0x0bab('0x1c')](_0x4622e0)[_0x0bab('0x2c')](_0x51a82c);};}exports[_0x0bab('0x2d')]=function(_0x3c15d8,_0x9f6942){var _0x4e4623={},_0x2dc122={},_0x50a5dc={'count':0x0,'rows':[]};var _0x2a551b=_[_0x0bab('0x2e')](db[_0x0bab('0x2f')][_0x0bab('0x30')],function(_0x482ffc){return{'name':_0x482ffc[_0x0bab('0x31')],'type':_0x482ffc[_0x0bab('0x32')][_0x0bab('0x33')]};});_0x2dc122['model']=_[_0x0bab('0x2e')](_0x2a551b,'name');_0x2dc122['query']=_[_0x0bab('0x34')](_0x3c15d8['query']);_0x2dc122[_0x0bab('0x35')]=_[_0x0bab('0x36')](_0x2dc122[_0x0bab('0x37')],_0x2dc122[_0x0bab('0x38')]);_0x4e4623[_0x0bab('0x39')]=_[_0x0bab('0x36')](_0x2dc122[_0x0bab('0x37')],qs[_0x0bab('0x3a')](_0x3c15d8['query'][_0x0bab('0x3a')]));_0x4e4623[_0x0bab('0x39')]=_0x4e4623['attributes'][_0x0bab('0x3b')]?_0x4e4623[_0x0bab('0x39')]:_0x2dc122[_0x0bab('0x37')];if(!_0x3c15d8['query'][_0x0bab('0x3c')](_0x0bab('0x3d'))){_0x4e4623[_0x0bab('0x1f')]=qs[_0x0bab('0x1f')](_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x1f')]);_0x4e4623[_0x0bab('0x1e')]=qs['offset'](_0x3c15d8['query'][_0x0bab('0x1e')]);}_0x4e4623[_0x0bab('0x3e')]=qs['sort'](_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x3f')]);_0x4e4623[_0x0bab('0x40')]=qs[_0x0bab('0x35')](_[_0x0bab('0x41')](_0x3c15d8[_0x0bab('0x38')],_0x2dc122['filters']),_0x2a551b);if(_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x42')]){_0x4e4623[_0x0bab('0x40')]=_[_0x0bab('0x43')](_0x4e4623[_0x0bab('0x40')],{'$or':_[_0x0bab('0x2e')](_0x2a551b,function(_0x84b3c5){if(_0x84b3c5[_0x0bab('0x32')]!==_0x0bab('0x44')){var _0x3baf73={};_0x3baf73[_0x84b3c5[_0x0bab('0x2b')]]={'$like':'%'+_0x3c15d8[_0x0bab('0x38')][_0x0bab('0x42')]+'%'};return _0x3baf73;}})});}_0x4e4623=_['merge']({},_0x4e4623,_0x3c15d8[_0x0bab('0x45')]);var _0xf6bd2c={'where':_0x4e4623[_0x0bab('0x40')]};return db[_0x0bab('0x2f')][_0x0bab('0x1d')](_0xf6bd2c)[_0x0bab('0x26')](function(_0x4881e3){_0x50a5dc[_0x0bab('0x1d')]=_0x4881e3;if(_0x3c15d8['query'][_0x0bab('0x46')]){_0x4e4623['include']=[{'all':!![]}];}return db[_0x0bab('0x2f')][_0x0bab('0x47')](_0x4e4623);})[_0x0bab('0x26')](function(_0x406839){_0x50a5dc['rows']=_0x406839;return _0x50a5dc;})['then'](respondWithFilteredResult(_0x9f6942,_0x4e4623))['catch'](handleError(_0x9f6942,null));};exports[_0x0bab('0x48')]=function(_0x40787b,_0x430258){var _0x189ebb={'raw':!![],'where':{'id':_0x40787b[_0x0bab('0x49')]['id']}},_0x234d9f={};_0x234d9f[_0x0bab('0x37')]=_[_0x0bab('0x34')](db[_0x0bab('0x2f')]['rawAttributes']);_0x234d9f[_0x0bab('0x38')]=_['keys'](_0x40787b[_0x0bab('0x38')]);_0x234d9f['filters']=_[_0x0bab('0x36')](_0x234d9f['model'],_0x234d9f[_0x0bab('0x38')]);_0x189ebb[_0x0bab('0x39')]=_[_0x0bab('0x36')](_0x234d9f[_0x0bab('0x37')],qs[_0x0bab('0x3a')](_0x40787b[_0x0bab('0x38')]['fields']));_0x189ebb['attributes']=_0x189ebb['attributes'][_0x0bab('0x3b')]?_0x189ebb[_0x0bab('0x39')]:_0x234d9f[_0x0bab('0x37')];if(_0x40787b[_0x0bab('0x38')][_0x0bab('0x46')]){_0x189ebb[_0x0bab('0x4a')]=[{'all':!![]}];}_0x189ebb=_[_0x0bab('0x43')]({},_0x189ebb,_0x40787b[_0x0bab('0x45')]);return db[_0x0bab('0x2f')][_0x0bab('0x4b')](_0x189ebb)[_0x0bab('0x26')](handleEntityNotFound(_0x430258,null))['then'](respondWithResult(_0x430258,null))[_0x0bab('0x4c')](handleError(_0x430258,null));};exports['create']=function(_0x245429,_0x1d1975){return db['SquareMessage'][_0x0bab('0x4d')](_0x245429[_0x0bab('0x4e')],{})[_0x0bab('0x26')](respondWithResult(_0x1d1975,0xc9))[_0x0bab('0x4c')](handleError(_0x1d1975,null));};exports[_0x0bab('0x25')]=function(_0x4f4ff2,_0x40195a){if(_0x4f4ff2[_0x0bab('0x4e')]['id']){delete _0x4f4ff2[_0x0bab('0x4e')]['id'];}return db[_0x0bab('0x2f')][_0x0bab('0x4b')]({'where':{'id':_0x4f4ff2[_0x0bab('0x49')]['id']}})['then'](handleEntityNotFound(_0x40195a,null))['then'](saveUpdates(_0x4f4ff2[_0x0bab('0x4e')],null))[_0x0bab('0x26')](respondWithResult(_0x40195a,null))['catch'](handleError(_0x40195a,null));};exports[_0x0bab('0x27')]=function(_0x137153,_0x41f045){return db[_0x0bab('0x2f')]['find']({'where':{'id':_0x137153[_0x0bab('0x49')]['id']}})[_0x0bab('0x26')](handleEntityNotFound(_0x41f045,null))['then'](removeEntity(_0x41f045,null))[_0x0bab('0x4c')](handleError(_0x41f045,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d90ba42..de3fc86 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 _0x52e1=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','define','square_messages'];(function(_0x3bc9c9,_0x449922){var _0x10fe8d=function(_0x569df3){while(--_0x569df3){_0x3bc9c9['push'](_0x3bc9c9['shift']());}};_0x10fe8d(++_0x449922);}(_0x52e1,0x120));var _0x152e=function(_0x340e24,_0xde71e){_0x340e24=_0x340e24-0x0;var _0x1808a=_0x52e1[_0x340e24];return _0x1808a;};'use strict';var _=require(_0x152e('0x0'));var util=require(_0x152e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x152e('0x2'));var rp=require(_0x152e('0x3'));var fs=require('fs');var path=require(_0x152e('0x4'));var rimraf=require(_0x152e('0x5'));var config=require(_0x152e('0x6'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x3d25d1,_0x14665f){return _0x3d25d1[_0x152e('0x7')]('SquareMessage',attributes,{'tableName':_0x152e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27dd=['path','rimraf','../../config/environment','exports','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x8cd7,_0x2cf434){var _0x262c9f=function(_0x14c21d){while(--_0x14c21d){_0x8cd7['push'](_0x8cd7['shift']());}};_0x262c9f(++_0x2cf434);}(_0x27dd,0xf4));var _0xd27d=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x27dd[_0x2a56ad];return _0x425175;};'use strict';var _=require(_0xd27d('0x0'));var util=require(_0xd27d('0x1'));var logger=require(_0xd27d('0x2'))(_0xd27d('0x3'));var moment=require(_0xd27d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd27d('0x5'));var fs=require('fs');var path=require(_0xd27d('0x6'));var rimraf=require(_0xd27d('0x7'));var config=require(_0xd27d('0x8'));var attributes=require('./squareMessage.attributes');module[_0xd27d('0x9')]=function(_0x4f1d54,_0x4c2c61){return _0x4f1d54['define']('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 25f364d..004603a 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(_0x32e7e7,_0x4348e9){var _0x1729b7=function(_0x5d3420){while(--_0x5d3420){_0x32e7e7['push'](_0x32e7e7['shift']());}};_0x1729b7(++_0x4348e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x357fcd,_0x33513f){var _0xcb2a49=function(_0x1d589a){while(--_0x1d589a){_0x357fcd['push'](_0x357fcd['shift']());}};_0xcb2a49(++_0x33513f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f0ef9ac..51256ce 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 _0x0b34=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post','update','destroy','exports','util','path','connect-timeout'];(function(_0x2a5073,_0x302753){var _0x41420b=function(_0x579a16){while(--_0x579a16){_0x2a5073['push'](_0x2a5073['shift']());}};_0x41420b(++_0x302753);}(_0x0b34,0x1eb));var _0x40b3=function(_0x1f11ca,_0x20846f){_0x1f11ca=_0x1f11ca-0x0;var _0x4c2eaf=_0x0b34[_0x1f11ca];return _0x4c2eaf;};'use strict';var multer=require('multer');var util=require(_0x40b3('0x0'));var path=require(_0x40b3('0x1'));var timeout=require(_0x40b3('0x2'));var express=require('express');var router=express[_0x40b3('0x3')]();var auth=require(_0x40b3('0x4'));var interaction=require(_0x40b3('0x5'));var config=require(_0x40b3('0x6'));var controller=require(_0x40b3('0x7'));router[_0x40b3('0x8')]('/',auth[_0x40b3('0x9')](),controller[_0x40b3('0xa')]);router[_0x40b3('0x8')](_0x40b3('0xb'),auth[_0x40b3('0x9')](),controller[_0x40b3('0xc')]);router[_0x40b3('0x8')]('/:id/test',auth['isAuthenticated'](),timeout(_0x40b3('0xd')),controller[_0x40b3('0xe')]);router[_0x40b3('0xf')]('/',auth[_0x40b3('0x9')](),controller['create']);router['put'](_0x40b3('0xb'),auth[_0x40b3('0x9')](),controller[_0x40b3('0x10')]);router['delete'](_0x40b3('0xb'),auth[_0x40b3('0x9')](),controller[_0x40b3('0x11')]);module[_0x40b3('0x12')]=router; \ No newline at end of file +var _0x4021=['/:id/test','15s','test','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0xae6bc9,_0x49dc6f){var _0x13516f=function(_0x510897){while(--_0x510897){_0xae6bc9['push'](_0xae6bc9['shift']());}};_0x13516f(++_0x49dc6f);}(_0x4021,0x79));var _0x1402=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0x4021[_0xcb19e1];return _0x121872;};'use strict';var multer=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var path=require('path');var timeout=require(_0x1402('0x2'));var express=require(_0x1402('0x3'));var router=express[_0x1402('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1402('0x5'));var config=require(_0x1402('0x6'));var controller=require(_0x1402('0x7'));router[_0x1402('0x8')]('/',auth[_0x1402('0x9')](),controller[_0x1402('0xa')]);router[_0x1402('0x8')](_0x1402('0xb'),auth[_0x1402('0x9')](),controller['show']);router[_0x1402('0x8')](_0x1402('0xc'),auth[_0x1402('0x9')](),timeout(_0x1402('0xd')),controller[_0x1402('0xe')]);router['post']('/',auth[_0x1402('0x9')](),controller[_0x1402('0xf')]);router[_0x1402('0x10')](_0x1402('0xb'),auth[_0x1402('0x9')](),controller['update']);router[_0x1402('0x11')](_0x1402('0xb'),auth[_0x1402('0x9')](),controller['destroy']);module[_0x1402('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 7fc6c61..18da739 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 _0x57f3=['name','STRING'];(function(_0x3a23d3,_0x4088d8){var _0x10803b=function(_0x333328){while(--_0x333328){_0x3a23d3['push'](_0x3a23d3['shift']());}};_0x10803b(++_0x4088d8);}(_0x57f3,0x6a));var _0x357f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x57f3[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x357f('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0x357f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xabed=['STRING','name','sequelize','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xabed,0x15a));var _0xdabe=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xabed[_0x469ac7];return _0x22f3b0;};'use strict';var Sequelize=require(_0xdabe('0x0'));module[_0xdabe('0x1')]={'name':{'type':Sequelize[_0xdabe('0x2')],'unique':_0xdabe('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xdabe('0x2')]},'description':{'type':Sequelize[_0xdabe('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e54acce..82419ee 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 _0x0ca4=['count','offset','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','end','stack','name','send','index','map','SquareOdbc','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','destroy','test','dsn','odbc','openSync','closeSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json'];(function(_0x3ef91e,_0x33898b){var _0x13e95b=function(_0x1603e3){while(--_0x1603e3){_0x3ef91e['push'](_0x3ef91e['shift']());}};_0x13e95b(++_0x33898b);}(_0x0ca4,0x13a));var _0x40ca=function(_0x5e0455,_0x4089fd){_0x5e0455=_0x5e0455-0x0;var _0x485dcc=_0x0ca4[_0x5e0455];return _0x485dcc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x40ca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x40ca('0x1'));var rp=require(_0x40ca('0x2'));var moment=require('moment');var BPromise=require(_0x40ca('0x3'));var Mustache=require(_0x40ca('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x40ca('0x5'));var fs=require('fs');var _=require(_0x40ca('0x6'));var squel=require(_0x40ca('0x7'));var crypto=require(_0x40ca('0x8'));var jsforce=require(_0x40ca('0x9'));var deskjs=require(_0x40ca('0xa'));var toCsv=require(_0x40ca('0xb'));var querystring=require(_0x40ca('0xc'));var Papa=require(_0x40ca('0xd'));var Redis=require(_0x40ca('0xe'));var authService=require(_0x40ca('0xf'));var qs=require(_0x40ca('0x10'));var as=require(_0x40ca('0x11'));var hardwareService=require(_0x40ca('0x12'));var logger=require(_0x40ca('0x13'))(_0x40ca('0x14'));var utils=require(_0x40ca('0x15'));var config=require(_0x40ca('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4120f1,_0x51b420){_0x51b420=_0x51b420||0xcc;return function(_0x159620){if(_0x159620){return _0x4120f1[_0x40ca('0x17')](_0x51b420);}return _0x4120f1[_0x40ca('0x18')](_0x51b420)['end']();};}function respondWithResult(_0x548b3b,_0x3bbcbb){_0x3bbcbb=_0x3bbcbb||0xc8;return function(_0x27d821){if(_0x27d821){return _0x548b3b['status'](_0x3bbcbb)[_0x40ca('0x19')](_0x27d821);}};}function respondWithFilteredResult(_0x5d9b8a,_0x5c0ecb){return function(_0x5a4464){if(_0x5a4464){var _0x4e1ad3=_0x5a4464[_0x40ca('0x1a')],_0xbd9ae0=_0x5c0ecb[_0x40ca('0x1b')],_0xc9a7bb=_0x5c0ecb[_0x40ca('0x1b')]+_0x5c0ecb['limit'],_0x5c17e8;if(_0xc9a7bb>=_0x4e1ad3){_0xc9a7bb=_0x4e1ad3;_0x5c17e8=0xc8;}else{_0x5c17e8=0xce;}_0x5d9b8a[_0x40ca('0x18')](_0x5c17e8);return _0x5d9b8a[_0x40ca('0x1c')](_0x40ca('0x1d'),_0xbd9ae0+'-'+_0xc9a7bb+'/'+_0x4e1ad3)[_0x40ca('0x19')](_0x5a4464);}return null;};}function patchUpdates(_0x17bc88){return function(_0x54f6ba){try{jsonpatch[_0x40ca('0x1e')](_0x54f6ba,_0x17bc88,!![]);}catch(_0x5f1abd){return BPromise[_0x40ca('0x1f')](_0x5f1abd);}return _0x54f6ba[_0x40ca('0x20')]();};}function saveUpdates(_0x58e752,_0x1c4065){return function(_0x11ee7e){if(_0x11ee7e){return _0x11ee7e[_0x40ca('0x21')](_0x58e752)[_0x40ca('0x22')](function(_0x2c7086){return _0x2c7086;});}return null;};}function removeEntity(_0x54d02a,_0x557a43){return function(_0x228f19){if(_0x228f19){return _0x228f19['destroy']()[_0x40ca('0x22')](function(){var _0x14d395=_0x228f19[_0x40ca('0x23')]({'plain':!![]});var _0x48d706=_0x40ca('0x24');return db[_0x40ca('0x25')]['destroy']({'where':{'type':_0x48d706,'resourceId':_0x14d395['id']}})[_0x40ca('0x22')](function(){return _0x228f19;});})['then'](function(){_0x54d02a[_0x40ca('0x18')](0xcc)[_0x40ca('0x26')]();});}};}function handleEntityNotFound(_0x1cfbb9,_0xee4ac7){return function(_0x376428){if(!_0x376428){_0x1cfbb9[_0x40ca('0x17')](0x194);}return _0x376428;};}function handleError(_0x4186c8,_0x3200ee){_0x3200ee=_0x3200ee||0x1f4;return function(_0x4086c1){logger['error'](_0x4086c1[_0x40ca('0x27')]);if(_0x4086c1[_0x40ca('0x28')]){delete _0x4086c1[_0x40ca('0x28')];}_0x4186c8['status'](_0x3200ee)[_0x40ca('0x29')](_0x4086c1);};}exports[_0x40ca('0x2a')]=function(_0x20c389,_0x4d5415){var _0x370907={},_0x2990b9={},_0xa4dc37={'count':0x0,'rows':[]};var _0x3ffeba=_[_0x40ca('0x2b')](db[_0x40ca('0x2c')][_0x40ca('0x2d')],function(_0x338fed){return{'name':_0x338fed['fieldName'],'type':_0x338fed['type']['key']};});_0x2990b9[_0x40ca('0x2e')]=_[_0x40ca('0x2b')](_0x3ffeba,_0x40ca('0x28'));_0x2990b9[_0x40ca('0x2f')]=_[_0x40ca('0x30')](_0x20c389['query']);_0x2990b9[_0x40ca('0x31')]=_[_0x40ca('0x32')](_0x2990b9[_0x40ca('0x2e')],_0x2990b9[_0x40ca('0x2f')]);_0x370907[_0x40ca('0x33')]=_['intersection'](_0x2990b9[_0x40ca('0x2e')],qs[_0x40ca('0x34')](_0x20c389[_0x40ca('0x2f')][_0x40ca('0x34')]));_0x370907[_0x40ca('0x33')]=_0x370907['attributes'][_0x40ca('0x35')]?_0x370907['attributes']:_0x2990b9[_0x40ca('0x2e')];if(!_0x20c389[_0x40ca('0x2f')][_0x40ca('0x36')](_0x40ca('0x37'))){_0x370907[_0x40ca('0x38')]=qs[_0x40ca('0x38')](_0x20c389[_0x40ca('0x2f')][_0x40ca('0x38')]);_0x370907[_0x40ca('0x1b')]=qs['offset'](_0x20c389[_0x40ca('0x2f')][_0x40ca('0x1b')]);}_0x370907[_0x40ca('0x39')]=qs['sort'](_0x20c389[_0x40ca('0x2f')]['sort']);_0x370907[_0x40ca('0x3a')]=qs[_0x40ca('0x31')](_[_0x40ca('0x3b')](_0x20c389['query'],_0x2990b9[_0x40ca('0x31')]),_0x3ffeba);if(_0x20c389[_0x40ca('0x2f')]['filter']){_0x370907['where']=_[_0x40ca('0x3c')](_0x370907['where'],{'$or':_['map'](_0x3ffeba,function(_0x2d0754){if(_0x2d0754[_0x40ca('0x3d')]!==_0x40ca('0x3e')){var _0x18ff88={};_0x18ff88[_0x2d0754[_0x40ca('0x28')]]={'$like':'%'+_0x20c389['query'][_0x40ca('0x3f')]+'%'};return _0x18ff88;}})});}_0x370907=_[_0x40ca('0x3c')]({},_0x370907,_0x20c389[_0x40ca('0x40')]);var _0x4e3ba2={'where':_0x370907[_0x40ca('0x3a')]};return db[_0x40ca('0x2c')][_0x40ca('0x1a')](_0x4e3ba2)[_0x40ca('0x22')](function(_0x9b4d56){_0xa4dc37['count']=_0x9b4d56;if(_0x20c389[_0x40ca('0x2f')][_0x40ca('0x41')]){_0x370907['include']=[{'all':!![]}];}return db[_0x40ca('0x2c')][_0x40ca('0x42')](_0x370907);})[_0x40ca('0x22')](function(_0x405889){_0xa4dc37['rows']=_0x405889;return _0xa4dc37;})[_0x40ca('0x22')](respondWithFilteredResult(_0x4d5415,_0x370907))[_0x40ca('0x43')](handleError(_0x4d5415,null));};exports['show']=function(_0x2c6dfd,_0x330880){var _0x2a9099={'raw':!![],'where':{'id':_0x2c6dfd[_0x40ca('0x44')]['id']}},_0x14d6ff={};_0x14d6ff['model']=_['keys'](db[_0x40ca('0x2c')][_0x40ca('0x2d')]);_0x14d6ff[_0x40ca('0x2f')]=_[_0x40ca('0x30')](_0x2c6dfd[_0x40ca('0x2f')]);_0x14d6ff[_0x40ca('0x31')]=_[_0x40ca('0x32')](_0x14d6ff[_0x40ca('0x2e')],_0x14d6ff[_0x40ca('0x2f')]);_0x2a9099[_0x40ca('0x33')]=_[_0x40ca('0x32')](_0x14d6ff[_0x40ca('0x2e')],qs[_0x40ca('0x34')](_0x2c6dfd[_0x40ca('0x2f')][_0x40ca('0x34')]));_0x2a9099['attributes']=_0x2a9099[_0x40ca('0x33')]['length']?_0x2a9099[_0x40ca('0x33')]:_0x14d6ff[_0x40ca('0x2e')];if(_0x2c6dfd[_0x40ca('0x2f')][_0x40ca('0x41')]){_0x2a9099['include']=[{'all':!![]}];}_0x2a9099=_[_0x40ca('0x3c')]({},_0x2a9099,_0x2c6dfd[_0x40ca('0x40')]);return db[_0x40ca('0x2c')][_0x40ca('0x45')](_0x2a9099)['then'](handleEntityNotFound(_0x330880,null))[_0x40ca('0x22')](respondWithResult(_0x330880,null))[_0x40ca('0x43')](handleError(_0x330880,null));};exports[_0x40ca('0x46')]=function(_0xb8ac72,_0x555657){return db[_0x40ca('0x2c')]['create'](_0xb8ac72[_0x40ca('0x47')],{})[_0x40ca('0x22')](function(_0x51d371){var _0x304c0a=_0xb8ac72['user'][_0x40ca('0x23')]({'plain':!![]});if(!_0x304c0a)throw new Error(_0x40ca('0x48'));if(_0x304c0a[_0x40ca('0x49')]===_0x40ca('0x4a')){var _0x508aed=_0x51d371[_0x40ca('0x23')]({'plain':!![]});var _0x1d86ca=_0x40ca('0x24');return db[_0x40ca('0x4b')][_0x40ca('0x45')]({'where':{'name':_0x1d86ca,'userProfileId':_0x304c0a[_0x40ca('0x4c')]},'raw':!![]})['then'](function(_0x1728c4){if(_0x1728c4&&_0x1728c4[_0x40ca('0x4d')]===0x0){return db[_0x40ca('0x25')][_0x40ca('0x46')]({'name':_0x508aed[_0x40ca('0x28')],'resourceId':_0x508aed['id'],'type':_0x1728c4[_0x40ca('0x28')],'sectionId':_0x1728c4['id']},{})[_0x40ca('0x22')](function(){return _0x51d371;});}else{return _0x51d371;}})[_0x40ca('0x43')](function(_0x2c3572){logger[_0x40ca('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c3572);throw _0x2c3572;});}return _0x51d371;})['then'](respondWithResult(_0x555657,0xc9))[_0x40ca('0x43')](handleError(_0x555657,null));};exports[_0x40ca('0x21')]=function(_0x1cf8f4,_0x15b069){if(_0x1cf8f4[_0x40ca('0x47')]['id']){delete _0x1cf8f4['body']['id'];}return db['SquareOdbc'][_0x40ca('0x45')]({'where':{'id':_0x1cf8f4[_0x40ca('0x44')]['id']}})[_0x40ca('0x22')](handleEntityNotFound(_0x15b069,null))[_0x40ca('0x22')](saveUpdates(_0x1cf8f4['body'],null))[_0x40ca('0x22')](respondWithResult(_0x15b069,null))[_0x40ca('0x43')](handleError(_0x15b069,null));};exports[_0x40ca('0x4f')]=function(_0x30145d,_0x54f4c4){return db[_0x40ca('0x2c')][_0x40ca('0x45')]({'where':{'id':_0x30145d[_0x40ca('0x44')]['id']}})[_0x40ca('0x22')](handleEntityNotFound(_0x54f4c4,null))[_0x40ca('0x22')](removeEntity(_0x54f4c4,null))[_0x40ca('0x43')](handleError(_0x54f4c4,null));};exports[_0x40ca('0x50')]=function(_0x184a58,_0x4cc6e6,_0x1033a4){var _0x3abb83;return db[_0x40ca('0x2c')][_0x40ca('0x45')]({'where':{'id':_0x184a58[_0x40ca('0x44')]['id']},'attributes':['id',_0x40ca('0x51')]})['then'](handleEntityNotFound(_0x4cc6e6,null))['then'](function(_0x1f0687){if(_0x1f0687){var _0x237d40=require(_0x40ca('0x52'))();_0x237d40[_0x40ca('0x53')](_0x1f0687[_0x40ca('0x51')]);_0x237d40[_0x40ca('0x54')]();return _0x1f0687;}})[_0x40ca('0x22')](respondWithResult(_0x4cc6e6,null))[_0x40ca('0x43')](handleError(_0x4cc6e6,null));}; \ No newline at end of file +var _0x71f1=['fields','length','sort','where','filter','merge','options','includeAll','include','SquareOdbc','findAll','show','params','keys','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','set','reject','save','update','then','destroy','get','UserProfileResource','status','error','stack','name','index','map','type','key','model','query','filters','attributes','intersection'];(function(_0x232f63,_0x78c100){var _0x4664f9=function(_0x27679e){while(--_0x27679e){_0x232f63['push'](_0x232f63['shift']());}};_0x4664f9(++_0x78c100);}(_0x71f1,0x166));var _0x171f=function(_0x5fe5ca,_0x4e92d3){_0x5fe5ca=_0x5fe5ca-0x0;var _0x42f45f=_0x71f1[_0x5fe5ca];return _0x42f45f;};'use strict';var pdf=require(_0x171f('0x0'));var emlformat=require(_0x171f('0x1'));var rimraf=require(_0x171f('0x2'));var zipdir=require(_0x171f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x171f('0x4'));var moment=require(_0x171f('0x5'));var BPromise=require(_0x171f('0x6'));var Mustache=require(_0x171f('0x7'));var util=require(_0x171f('0x8'));var path=require(_0x171f('0x9'));var sox=require(_0x171f('0xa'));var csv=require(_0x171f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x171f('0xc'));var crypto=require(_0x171f('0xd'));var jsforce=require(_0x171f('0xe'));var deskjs=require(_0x171f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x171f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x171f('0x11'));var as=require(_0x171f('0x12'));var hardwareService=require(_0x171f('0x13'));var logger=require('../../config/logger')(_0x171f('0x14'));var utils=require(_0x171f('0x15'));var config=require(_0x171f('0x16'));var licenseUtil=require(_0x171f('0x17'));var db=require(_0x171f('0x18'))['db'];function respondWithStatusCode(_0x25c868,_0x378c26){_0x378c26=_0x378c26||0xcc;return function(_0x3d8b52){if(_0x3d8b52){return _0x25c868[_0x171f('0x19')](_0x378c26);}return _0x25c868['status'](_0x378c26)[_0x171f('0x1a')]();};}function respondWithResult(_0x2f5cd3,_0x3af28d){_0x3af28d=_0x3af28d||0xc8;return function(_0x48b45b){if(_0x48b45b){return _0x2f5cd3['status'](_0x3af28d)[_0x171f('0x1b')](_0x48b45b);}};}function respondWithFilteredResult(_0x331fa2,_0x4c69fc){return function(_0x2beeec){if(_0x2beeec){var _0x2bbef5=_0x2beeec[_0x171f('0x1c')],_0x256c5c=_0x4c69fc['offset'],_0x581608=_0x4c69fc[_0x171f('0x1d')]+_0x4c69fc[_0x171f('0x1e')],_0x183afc;if(_0x581608>=_0x2bbef5){_0x581608=_0x2bbef5;_0x183afc=0xc8;}else{_0x183afc=0xce;}_0x331fa2['status'](_0x183afc);return _0x331fa2[_0x171f('0x1f')]('Content-Range',_0x256c5c+'-'+_0x581608+'/'+_0x2bbef5)[_0x171f('0x1b')](_0x2beeec);}return null;};}function patchUpdates(_0x45ed3e){return function(_0x44fd74){try{jsonpatch['apply'](_0x44fd74,_0x45ed3e,!![]);}catch(_0x1ccbfc){return BPromise[_0x171f('0x20')](_0x1ccbfc);}return _0x44fd74[_0x171f('0x21')]();};}function saveUpdates(_0x580a25,_0x529ee3){return function(_0x5896d7){if(_0x5896d7){return _0x5896d7[_0x171f('0x22')](_0x580a25)[_0x171f('0x23')](function(_0x4007d9){return _0x4007d9;});}return null;};}function removeEntity(_0x4d7ac9,_0x24dea5){return function(_0x3cef51){if(_0x3cef51){return _0x3cef51[_0x171f('0x24')]()[_0x171f('0x23')](function(){var _0x5370c9=_0x3cef51[_0x171f('0x25')]({'plain':!![]});var _0x12c83b='ODBC';return db[_0x171f('0x26')][_0x171f('0x24')]({'where':{'type':_0x12c83b,'resourceId':_0x5370c9['id']}})[_0x171f('0x23')](function(){return _0x3cef51;});})['then'](function(){_0x4d7ac9[_0x171f('0x27')](0xcc)[_0x171f('0x1a')]();});}};}function handleEntityNotFound(_0x2a18fc,_0x53964f){return function(_0x2ced51){if(!_0x2ced51){_0x2a18fc[_0x171f('0x19')](0x194);}return _0x2ced51;};}function handleError(_0x5c82f4,_0x5c31c9){_0x5c31c9=_0x5c31c9||0x1f4;return function(_0x313c9c){logger[_0x171f('0x28')](_0x313c9c[_0x171f('0x29')]);if(_0x313c9c[_0x171f('0x2a')]){delete _0x313c9c[_0x171f('0x2a')];}_0x5c82f4[_0x171f('0x27')](_0x5c31c9)['send'](_0x313c9c);};}exports[_0x171f('0x2b')]=function(_0x179a5a,_0x3e8a89){var _0x46844c={},_0x436974={},_0x2cbe55={'count':0x0,'rows':[]};var _0x3ea9cf=_[_0x171f('0x2c')](db['SquareOdbc']['rawAttributes'],function(_0x1e6132){return{'name':_0x1e6132['fieldName'],'type':_0x1e6132[_0x171f('0x2d')][_0x171f('0x2e')]};});_0x436974[_0x171f('0x2f')]=_[_0x171f('0x2c')](_0x3ea9cf,_0x171f('0x2a'));_0x436974[_0x171f('0x30')]=_['keys'](_0x179a5a[_0x171f('0x30')]);_0x436974[_0x171f('0x31')]=_['intersection'](_0x436974['model'],_0x436974[_0x171f('0x30')]);_0x46844c[_0x171f('0x32')]=_[_0x171f('0x33')](_0x436974[_0x171f('0x2f')],qs[_0x171f('0x34')](_0x179a5a['query'][_0x171f('0x34')]));_0x46844c[_0x171f('0x32')]=_0x46844c['attributes'][_0x171f('0x35')]?_0x46844c[_0x171f('0x32')]:_0x436974[_0x171f('0x2f')];if(!_0x179a5a[_0x171f('0x30')]['hasOwnProperty']('nolimit')){_0x46844c['limit']=qs[_0x171f('0x1e')](_0x179a5a[_0x171f('0x30')][_0x171f('0x1e')]);_0x46844c[_0x171f('0x1d')]=qs['offset'](_0x179a5a[_0x171f('0x30')][_0x171f('0x1d')]);}_0x46844c['order']=qs[_0x171f('0x36')](_0x179a5a[_0x171f('0x30')]['sort']);_0x46844c[_0x171f('0x37')]=qs['filters'](_['pick'](_0x179a5a[_0x171f('0x30')],_0x436974[_0x171f('0x31')]),_0x3ea9cf);if(_0x179a5a[_0x171f('0x30')]['filter']){_0x46844c[_0x171f('0x37')]=_['merge'](_0x46844c[_0x171f('0x37')],{'$or':_['map'](_0x3ea9cf,function(_0x1de09e){if(_0x1de09e[_0x171f('0x2d')]!=='VIRTUAL'){var _0x3d2f94={};_0x3d2f94[_0x1de09e[_0x171f('0x2a')]]={'$like':'%'+_0x179a5a[_0x171f('0x30')][_0x171f('0x38')]+'%'};return _0x3d2f94;}})});}_0x46844c=_[_0x171f('0x39')]({},_0x46844c,_0x179a5a[_0x171f('0x3a')]);var _0x81d08a={'where':_0x46844c[_0x171f('0x37')]};return db['SquareOdbc']['count'](_0x81d08a)['then'](function(_0x4780c9){_0x2cbe55[_0x171f('0x1c')]=_0x4780c9;if(_0x179a5a[_0x171f('0x30')][_0x171f('0x3b')]){_0x46844c[_0x171f('0x3c')]=[{'all':!![]}];}return db[_0x171f('0x3d')][_0x171f('0x3e')](_0x46844c);})['then'](function(_0x306bc4){_0x2cbe55['rows']=_0x306bc4;return _0x2cbe55;})[_0x171f('0x23')](respondWithFilteredResult(_0x3e8a89,_0x46844c))['catch'](handleError(_0x3e8a89,null));};exports[_0x171f('0x3f')]=function(_0x2e6de3,_0x3d9f63){var _0x4bb576={'raw':!![],'where':{'id':_0x2e6de3[_0x171f('0x40')]['id']}},_0x49e7fb={};_0x49e7fb[_0x171f('0x2f')]=_[_0x171f('0x41')](db[_0x171f('0x3d')][_0x171f('0x42')]);_0x49e7fb[_0x171f('0x30')]=_[_0x171f('0x41')](_0x2e6de3[_0x171f('0x30')]);_0x49e7fb[_0x171f('0x31')]=_[_0x171f('0x33')](_0x49e7fb[_0x171f('0x2f')],_0x49e7fb[_0x171f('0x30')]);_0x4bb576[_0x171f('0x32')]=_[_0x171f('0x33')](_0x49e7fb['model'],qs['fields'](_0x2e6de3[_0x171f('0x30')]['fields']));_0x4bb576['attributes']=_0x4bb576['attributes'][_0x171f('0x35')]?_0x4bb576['attributes']:_0x49e7fb[_0x171f('0x2f')];if(_0x2e6de3[_0x171f('0x30')][_0x171f('0x3b')]){_0x4bb576['include']=[{'all':!![]}];}_0x4bb576=_[_0x171f('0x39')]({},_0x4bb576,_0x2e6de3[_0x171f('0x3a')]);return db[_0x171f('0x3d')]['find'](_0x4bb576)[_0x171f('0x23')](handleEntityNotFound(_0x3d9f63,null))[_0x171f('0x23')](respondWithResult(_0x3d9f63,null))[_0x171f('0x43')](handleError(_0x3d9f63,null));};exports['create']=function(_0x508ca9,_0x3292d9){return db[_0x171f('0x3d')][_0x171f('0x44')](_0x508ca9[_0x171f('0x45')],{})[_0x171f('0x23')](function(_0x51d47d){var _0x204447=_0x508ca9['user'][_0x171f('0x25')]({'plain':!![]});if(!_0x204447)throw new Error(_0x171f('0x46'));if(_0x204447[_0x171f('0x47')]===_0x171f('0x48')){var _0xd85742=_0x51d47d[_0x171f('0x25')]({'plain':!![]});var _0x2ded7a=_0x171f('0x49');return db['UserProfileSection'][_0x171f('0x4a')]({'where':{'name':_0x2ded7a,'userProfileId':_0x204447['userProfileId']},'raw':!![]})[_0x171f('0x23')](function(_0x5be899){if(_0x5be899&&_0x5be899[_0x171f('0x4b')]===0x0){return db[_0x171f('0x26')]['create']({'name':_0xd85742['name'],'resourceId':_0xd85742['id'],'type':_0x5be899[_0x171f('0x2a')],'sectionId':_0x5be899['id']},{})[_0x171f('0x23')](function(){return _0x51d47d;});}else{return _0x51d47d;}})[_0x171f('0x43')](function(_0x53ec8a){logger[_0x171f('0x28')](_0x171f('0x4c'),_0x53ec8a);throw _0x53ec8a;});}return _0x51d47d;})[_0x171f('0x23')](respondWithResult(_0x3292d9,0xc9))[_0x171f('0x43')](handleError(_0x3292d9,null));};exports[_0x171f('0x22')]=function(_0x56c2ef,_0x1d5902){if(_0x56c2ef['body']['id']){delete _0x56c2ef[_0x171f('0x45')]['id'];}return db['SquareOdbc'][_0x171f('0x4a')]({'where':{'id':_0x56c2ef[_0x171f('0x40')]['id']}})[_0x171f('0x23')](handleEntityNotFound(_0x1d5902,null))[_0x171f('0x23')](saveUpdates(_0x56c2ef['body'],null))[_0x171f('0x23')](respondWithResult(_0x1d5902,null))[_0x171f('0x43')](handleError(_0x1d5902,null));};exports[_0x171f('0x24')]=function(_0x35c6d2,_0x3e25ca){return db['SquareOdbc']['find']({'where':{'id':_0x35c6d2['params']['id']}})[_0x171f('0x23')](handleEntityNotFound(_0x3e25ca,null))[_0x171f('0x23')](removeEntity(_0x3e25ca,null))[_0x171f('0x43')](handleError(_0x3e25ca,null));};exports[_0x171f('0x4d')]=function(_0x15e9f2,_0x56fecf,_0x3d0eb2){var _0x2a1037;return db[_0x171f('0x3d')]['find']({'where':{'id':_0x15e9f2[_0x171f('0x40')]['id']},'attributes':['id',_0x171f('0x4e')]})['then'](handleEntityNotFound(_0x56fecf,null))['then'](function(_0x534717){if(_0x534717){var _0x3ed900=require(_0x171f('0x4f'))();_0x3ed900[_0x171f('0x50')](_0x534717[_0x171f('0x4e')]);_0x3ed900[_0x171f('0x51')]();return _0x534717;}})['then'](respondWithResult(_0x56fecf,null))[_0x171f('0x43')](handleError(_0x56fecf,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index de96a0b..5204ceb 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 _0x0289=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','api','moment','bluebird','request-promise'];(function(_0x10d323,_0x268ecb){var _0xa6acff=function(_0x5cc2b4){while(--_0x5cc2b4){_0x10d323['push'](_0x10d323['shift']());}};_0xa6acff(++_0x268ecb);}(_0x0289,0x14c));var _0x9028=function(_0x5bef0a,_0x1fb747){_0x5bef0a=_0x5bef0a-0x0;var _0x1a02ea=_0x0289[_0x5bef0a];return _0x1a02ea;};'use strict';var _=require(_0x9028('0x0'));var util=require(_0x9028('0x1'));var logger=require('../../config/logger')(_0x9028('0x2'));var moment=require(_0x9028('0x3'));var BPromise=require(_0x9028('0x4'));var rp=require(_0x9028('0x5'));var fs=require('fs');var path=require(_0x9028('0x6'));var rimraf=require(_0x9028('0x7'));var config=require(_0x9028('0x8'));var attributes=require(_0x9028('0x9'));module[_0x9028('0xa')]=function(_0x163a19,_0x14bd40){return _0x163a19[_0x9028('0xb')]('SquareOdbc',attributes,{'tableName':_0x9028('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc97f=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2878d5,_0x4539de){var _0x1b86b0=function(_0x5a8ce8){while(--_0x5a8ce8){_0x2878d5['push'](_0x2878d5['shift']());}};_0x1b86b0(++_0x4539de);}(_0xc97f,0x102));var _0xfc97=function(_0x13db5f,_0x4ea2c6){_0x13db5f=_0x13db5f-0x0;var _0x8b35b0=_0xc97f[_0x13db5f];return _0x8b35b0;};'use strict';var _=require(_0xfc97('0x0'));var util=require('util');var logger=require(_0xfc97('0x1'))(_0xfc97('0x2'));var moment=require(_0xfc97('0x3'));var BPromise=require(_0xfc97('0x4'));var rp=require(_0xfc97('0x5'));var fs=require('fs');var path=require(_0xfc97('0x6'));var rimraf=require(_0xfc97('0x7'));var config=require(_0xfc97('0x8'));var attributes=require(_0xfc97('0x9'));module[_0xfc97('0xa')]=function(_0x10c0db,_0x44704f){return _0x10c0db[_0xfc97('0xb')](_0xfc97('0xc'),attributes,{'tableName':_0xfc97('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index ee96637..4567c6a 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x3cca44,_0x3e1ddb){var _0x533dce=function(_0x44530f){while(--_0x44530f){_0x3cca44['push'](_0x3cca44['shift']());}};_0x533dce(++_0x3e1ddb);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['SquareOdbc'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x4fd156,_0x146f0a){var _0x325bea=function(_0x5743fe){while(--_0x5743fe){_0x4fd156['push'](_0x4fd156['shift']());}};_0x325bea(++_0x146f0a);}(_0x7217,0x19e));var _0x7721=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x7217[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 74b8e94..2de9ced 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 _0x924f=['removeUsers','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','getUsers','post','addUsers','put','/:id','update','delete','/:id/users'];(function(_0x20b363,_0x4cc17f){var _0x3ed46a=function(_0x14834c){while(--_0x14834c){_0x20b363['push'](_0x20b363['shift']());}};_0x3ed46a(++_0x4cc17f);}(_0x924f,0x128));var _0xf924=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x924f[_0x5224ba];return _0x459bd2;};'use strict';var multer=require(_0xf924('0x0'));var util=require(_0xf924('0x1'));var path=require(_0xf924('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf924('0x3'));var interaction=require(_0xf924('0x4'));var config=require(_0xf924('0x5'));var controller=require(_0xf924('0x6'));router[_0xf924('0x7')]('/',auth[_0xf924('0x8')](),controller[_0xf924('0x9')]);router['get']('/:id',auth[_0xf924('0x8')](),controller[_0xf924('0xa')]);router[_0xf924('0x7')]('/:id/users',auth[_0xf924('0x8')](),controller[_0xf924('0xb')]);router['post']('/',auth[_0xf924('0x8')](),controller['create']);router[_0xf924('0xc')]('/:id/users',auth['isAuthenticated'](),controller[_0xf924('0xd')]);router[_0xf924('0xe')](_0xf924('0xf'),auth['isAuthenticated'](),controller[_0xf924('0x10')]);router[_0xf924('0x11')]('/:id',auth[_0xf924('0x8')](),controller['destroy']);router['delete'](_0xf924('0x12'),auth[_0xf924('0x8')](),controller[_0xf924('0x13')]);module[_0xf924('0x14')]=router; \ No newline at end of file +var _0x7910=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','/:id/users','put','update','destroy','delete','removeUsers','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2779ba,_0x29dfd3){var _0x5952ff=function(_0x9d0459){while(--_0x9d0459){_0x2779ba['push'](_0x2779ba['shift']());}};_0x5952ff(++_0x29dfd3);}(_0x7910,0xcd));var _0x0791=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x7910[_0x1d7300];return _0x46ee98;};'use strict';var multer=require(_0x0791('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0791('0x1'));var express=require(_0x0791('0x2'));var router=express[_0x0791('0x3')]();var auth=require(_0x0791('0x4'));var interaction=require(_0x0791('0x5'));var config=require(_0x0791('0x6'));var controller=require('./squareProject.controller');router[_0x0791('0x7')]('/',auth[_0x0791('0x8')](),controller[_0x0791('0x9')]);router[_0x0791('0x7')](_0x0791('0xa'),auth[_0x0791('0x8')](),controller[_0x0791('0xb')]);router[_0x0791('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x0791('0xc')]('/',auth[_0x0791('0x8')](),controller[_0x0791('0xd')]);router[_0x0791('0xc')](_0x0791('0xe'),auth[_0x0791('0x8')](),controller['addUsers']);router[_0x0791('0xf')]('/:id',auth[_0x0791('0x8')](),controller[_0x0791('0x10')]);router['delete'](_0x0791('0xa'),auth[_0x0791('0x8')](),controller[_0x0791('0x11')]);router[_0x0791('0x12')]('/:id/users',auth[_0x0791('0x8')](),controller[_0x0791('0x13')]);module[_0x0791('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index b0b7db6..de676f0 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 _0x13c2=['sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE'];(function(_0x32cd08,_0x289c34){var _0x2f3df3=function(_0x19d805){while(--_0x19d805){_0x32cd08['push'](_0x32cd08['shift']());}};_0x2f3df3(++_0x289c34);}(_0x13c2,0x138));var _0x213c=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x13c2[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x213c('0x0'));module[_0x213c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x213c('0x2')]},'notes':{'type':Sequelize[_0x213c('0x3')]},'preproduction':{'type':Sequelize[_0x213c('0x4')](_0x213c('0x5')),'get':function(){if(this[_0x213c('0x6')](_0x213c('0x7'))){return this[_0x213c('0x6')]('preproduction')[_0x213c('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x213c('0x4')](_0x213c('0x5')),'get':function(){if(this['getDataValue'](_0x213c('0x9'))){return this[_0x213c('0x6')](_0x213c('0x9'))['toString'](_0x213c('0xa'));}}},'savedAt':{'type':Sequelize[_0x213c('0xb')]},'publishedAt':{'type':Sequelize[_0x213c('0xb')]}}; \ No newline at end of file +var _0xd187=['name','TEXT','BLOB','preproduction','getDataValue','toString','utf8','long','production','DATE','exports','STRING'];(function(_0x5f0937,_0x1bb8d7){var _0x82117e=function(_0x1acb23){while(--_0x1acb23){_0x5f0937['push'](_0x5f0937['shift']());}};_0x82117e(++_0x1bb8d7);}(_0xd187,0x1ba));var _0x7d18=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0xd187[_0x56daff];return _0x132c82;};'use strict';var Sequelize=require('sequelize');module[_0x7d18('0x0')]={'name':{'type':Sequelize[_0x7d18('0x1')],'unique':_0x7d18('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7d18('0x1')]},'notes':{'type':Sequelize[_0x7d18('0x3')]},'preproduction':{'type':Sequelize[_0x7d18('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x7d18('0x5'))){return this[_0x7d18('0x6')](_0x7d18('0x5'))[_0x7d18('0x7')](_0x7d18('0x8'));}}},'production':{'type':Sequelize[_0x7d18('0x4')](_0x7d18('0x9')),'get':function(){if(this[_0x7d18('0x6')](_0x7d18('0xa'))){return this[_0x7d18('0x6')](_0x7d18('0xa'))[_0x7d18('0x7')](_0x7d18('0x8'));}}},'savedAt':{'type':Sequelize[_0x7d18('0xb')]},'publishedAt':{'type':Sequelize[_0x7d18('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bc7916f..b92debf 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 _0x4c59=['apply','reject','update','then','get','SquareProjects','UserProfileResource','destroy','error','stack','send','index','map','SquareProject','rawAttributes','fieldName','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','filters','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','status','offset','limit','Content-Range'];(function(_0x6cb268,_0x476500){var _0x45a5c1=function(_0x2a33ed){while(--_0x2a33ed){_0x6cb268['push'](_0x6cb268['shift']());}};_0x45a5c1(++_0x476500);}(_0x4c59,0x19d));var _0x94c5=function(_0x2f35a2,_0x9c1ac){_0x2f35a2=_0x2f35a2-0x0;var _0x503004=_0x4c59[_0x2f35a2];return _0x503004;};'use strict';var pdf=require(_0x94c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94c5('0x1'));var zipdir=require(_0x94c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94c5('0x3'));var BPromise=require(_0x94c5('0x4'));var Mustache=require('mustache');var util=require(_0x94c5('0x5'));var path=require(_0x94c5('0x6'));var sox=require(_0x94c5('0x7'));var csv=require(_0x94c5('0x8'));var ejs=require(_0x94c5('0x9'));var fs=require('fs');var _=require(_0x94c5('0xa'));var squel=require(_0x94c5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x94c5('0x8'));var querystring=require(_0x94c5('0xc'));var Papa=require(_0x94c5('0xd'));var Redis=require('ioredis');var authService=require(_0x94c5('0xe'));var qs=require(_0x94c5('0xf'));var as=require(_0x94c5('0x10'));var hardwareService=require(_0x94c5('0x11'));var logger=require('../../config/logger')(_0x94c5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x94c5('0x13'));var db=require(_0x94c5('0x14'))['db'];config[_0x94c5('0x15')]=_[_0x94c5('0x16')](config[_0x94c5('0x15')],{'host':_0x94c5('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94c5('0x15')]));require(_0x94c5('0x18'))[_0x94c5('0x19')](socket);function respondWithStatusCode(_0x783f2a,_0x1c66dd){_0x1c66dd=_0x1c66dd||0xcc;return function(_0x144362){if(_0x144362){return _0x783f2a[_0x94c5('0x1a')](_0x1c66dd);}return _0x783f2a['status'](_0x1c66dd)[_0x94c5('0x1b')]();};}function respondWithResult(_0x38d003,_0x1ca77b){_0x1ca77b=_0x1ca77b||0xc8;return function(_0x33803c){if(_0x33803c){return _0x38d003[_0x94c5('0x1c')](_0x1ca77b)['json'](_0x33803c);}};}function respondWithFilteredResult(_0x5afc90,_0x34e925){return function(_0x77709f){if(_0x77709f){var _0x2bd87d=_0x77709f['count'],_0x13f1d9=_0x34e925[_0x94c5('0x1d')],_0x6b28fe=_0x34e925[_0x94c5('0x1d')]+_0x34e925[_0x94c5('0x1e')],_0x44f7bd;if(_0x6b28fe>=_0x2bd87d){_0x6b28fe=_0x2bd87d;_0x44f7bd=0xc8;}else{_0x44f7bd=0xce;}_0x5afc90['status'](_0x44f7bd);return _0x5afc90['set'](_0x94c5('0x1f'),_0x13f1d9+'-'+_0x6b28fe+'/'+_0x2bd87d)['json'](_0x77709f);}return null;};}function patchUpdates(_0x41b70d){return function(_0x72e955){try{jsonpatch[_0x94c5('0x20')](_0x72e955,_0x41b70d,!![]);}catch(_0x2c5203){return BPromise[_0x94c5('0x21')](_0x2c5203);}return _0x72e955['save']();};}function saveUpdates(_0x47cc2c,_0x220cd8){return function(_0x28d7d2){if(_0x28d7d2){return _0x28d7d2[_0x94c5('0x22')](_0x47cc2c)[_0x94c5('0x23')](function(_0x583267){return _0x583267;});}return null;};}function removeEntity(_0x24b1cf,_0x455be6){return function(_0x5befaa){if(_0x5befaa){return _0x5befaa['destroy']()['then'](function(){var _0xa8242d=_0x5befaa[_0x94c5('0x24')]({'plain':!![]});var _0x12d27d=_0x94c5('0x25');return db[_0x94c5('0x26')][_0x94c5('0x27')]({'where':{'type':_0x12d27d,'resourceId':_0xa8242d['id']}})[_0x94c5('0x23')](function(){return _0x5befaa;});})[_0x94c5('0x23')](function(){_0x24b1cf['status'](0xcc)[_0x94c5('0x1b')]();});}};}function handleEntityNotFound(_0x452732,_0x1b0dd0){return function(_0x1e6da1){if(!_0x1e6da1){_0x452732[_0x94c5('0x1a')](0x194);}return _0x1e6da1;};}function handleError(_0x28a8d3,_0x297c42){_0x297c42=_0x297c42||0x1f4;return function(_0x276365){logger[_0x94c5('0x28')](_0x276365[_0x94c5('0x29')]);if(_0x276365['name']){delete _0x276365['name'];}_0x28a8d3[_0x94c5('0x1c')](_0x297c42)[_0x94c5('0x2a')](_0x276365);};}exports[_0x94c5('0x2b')]=function(_0x22e54a,_0x3f8f3b){var _0x28846b={},_0x2b0535={},_0x1bdd66={'count':0x0,'rows':[]};var _0x29d78a=_[_0x94c5('0x2c')](db[_0x94c5('0x2d')][_0x94c5('0x2e')],function(_0x225c1b){return{'name':_0x225c1b[_0x94c5('0x2f')],'type':_0x225c1b['type']['key']};});_0x2b0535[_0x94c5('0x30')]=_[_0x94c5('0x2c')](_0x29d78a,_0x94c5('0x31'));_0x2b0535['query']=_[_0x94c5('0x32')](_0x22e54a[_0x94c5('0x33')]);_0x2b0535['filters']=_[_0x94c5('0x34')](_0x2b0535['model'],_0x2b0535[_0x94c5('0x33')]);_0x28846b['attributes']=_[_0x94c5('0x34')](_0x2b0535[_0x94c5('0x30')],qs[_0x94c5('0x35')](_0x22e54a['query'][_0x94c5('0x35')]));_0x28846b[_0x94c5('0x36')]=_0x28846b[_0x94c5('0x36')][_0x94c5('0x37')]?_0x28846b[_0x94c5('0x36')]:_0x2b0535[_0x94c5('0x30')];if(!_0x22e54a[_0x94c5('0x33')][_0x94c5('0x38')](_0x94c5('0x39'))){_0x28846b[_0x94c5('0x1e')]=qs[_0x94c5('0x1e')](_0x22e54a[_0x94c5('0x33')][_0x94c5('0x1e')]);_0x28846b[_0x94c5('0x1d')]=qs['offset'](_0x22e54a[_0x94c5('0x33')][_0x94c5('0x1d')]);}_0x28846b[_0x94c5('0x3a')]=qs[_0x94c5('0x3b')](_0x22e54a[_0x94c5('0x33')]['sort']);_0x28846b[_0x94c5('0x3c')]=qs['filters'](_['pick'](_0x22e54a[_0x94c5('0x33')],_0x2b0535['filters']),_0x29d78a);if(_0x22e54a[_0x94c5('0x33')]['filter']){_0x28846b[_0x94c5('0x3c')]=_[_0x94c5('0x3d')](_0x28846b[_0x94c5('0x3c')],{'$or':_['map'](_0x29d78a,function(_0x5e5b2b){if(_0x5e5b2b['type']!==_0x94c5('0x3e')){var _0x2b950f={};_0x2b950f[_0x5e5b2b[_0x94c5('0x31')]]={'$like':'%'+_0x22e54a['query'][_0x94c5('0x3f')]+'%'};return _0x2b950f;}})});}_0x28846b=_[_0x94c5('0x3d')]({},_0x28846b,_0x22e54a[_0x94c5('0x40')]);var _0x49ae5b={'where':_0x28846b[_0x94c5('0x3c')]};return db[_0x94c5('0x2d')]['count'](_0x49ae5b)[_0x94c5('0x23')](function(_0x437455){_0x1bdd66['count']=_0x437455;if(_0x22e54a[_0x94c5('0x33')][_0x94c5('0x41')]){_0x28846b['include']=[{'all':!![]}];}return db[_0x94c5('0x2d')][_0x94c5('0x42')](_0x28846b);})[_0x94c5('0x23')](function(_0x1444a0){_0x1bdd66[_0x94c5('0x43')]=_0x1444a0;return _0x1bdd66;})[_0x94c5('0x23')](respondWithFilteredResult(_0x3f8f3b,_0x28846b))[_0x94c5('0x44')](handleError(_0x3f8f3b,null));};exports[_0x94c5('0x45')]=function(_0x39c2c2,_0x438dac){var _0x1fb509={'raw':![],'where':{'id':_0x39c2c2[_0x94c5('0x46')]['id']}},_0x2872b6={};_0x2872b6[_0x94c5('0x30')]=_[_0x94c5('0x32')](db['SquareProject']['rawAttributes']);_0x2872b6[_0x94c5('0x33')]=_[_0x94c5('0x32')](_0x39c2c2[_0x94c5('0x33')]);_0x2872b6[_0x94c5('0x47')]=_['intersection'](_0x2872b6[_0x94c5('0x30')],_0x2872b6[_0x94c5('0x33')]);_0x1fb509[_0x94c5('0x36')]=_[_0x94c5('0x34')](_0x2872b6[_0x94c5('0x30')],qs['fields'](_0x39c2c2[_0x94c5('0x33')][_0x94c5('0x35')]));_0x1fb509[_0x94c5('0x36')]=_0x1fb509[_0x94c5('0x36')][_0x94c5('0x37')]?_0x1fb509[_0x94c5('0x36')]:_0x2872b6[_0x94c5('0x30')];if(_0x39c2c2[_0x94c5('0x33')][_0x94c5('0x41')]){_0x1fb509[_0x94c5('0x48')]=[{'all':!![]}];}_0x1fb509=_[_0x94c5('0x3d')]({},_0x1fb509,_0x39c2c2[_0x94c5('0x40')]);return db[_0x94c5('0x2d')][_0x94c5('0x49')](_0x1fb509)[_0x94c5('0x23')](handleEntityNotFound(_0x438dac,null))['then'](respondWithResult(_0x438dac,null))[_0x94c5('0x44')](handleError(_0x438dac,null));};exports[_0x94c5('0x4a')]=function(_0x181a89,_0x1d4ab3){return db['SquareProject']['create'](_0x181a89['body'],{})[_0x94c5('0x23')](function(_0x5dedb2){var _0x57fae1=_0x181a89[_0x94c5('0x4b')][_0x94c5('0x24')]({'plain':!![]});if(!_0x57fae1)throw new Error(_0x94c5('0x4c'));if(_0x57fae1[_0x94c5('0x4d')]===_0x94c5('0x4b')){var _0x1221a1=_0x5dedb2['get']({'plain':!![]});var _0x3bc0e3=_0x94c5('0x25');return db[_0x94c5('0x4e')][_0x94c5('0x49')]({'where':{'name':_0x3bc0e3,'userProfileId':_0x57fae1['userProfileId']},'raw':!![]})[_0x94c5('0x23')](function(_0x176d90){if(_0x176d90&&_0x176d90[_0x94c5('0x4f')]===0x0){return db[_0x94c5('0x26')][_0x94c5('0x4a')]({'name':_0x1221a1[_0x94c5('0x31')],'resourceId':_0x1221a1['id'],'type':_0x176d90[_0x94c5('0x31')],'sectionId':_0x176d90['id']},{})['then'](function(){return _0x5dedb2;});}else{return _0x5dedb2;}})['catch'](function(_0x271f77){logger[_0x94c5('0x28')](_0x94c5('0x50'),_0x271f77);throw _0x271f77;});}return _0x5dedb2;})['then'](respondWithResult(_0x1d4ab3,0xc9))[_0x94c5('0x44')](handleError(_0x1d4ab3,null));};exports[_0x94c5('0x22')]=function(_0x5accd7,_0x57cb4d){if(_0x5accd7[_0x94c5('0x51')]['id']){delete _0x5accd7[_0x94c5('0x51')]['id'];}return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x5accd7['params']['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x57cb4d,null))[_0x94c5('0x23')](saveUpdates(_0x5accd7[_0x94c5('0x51')],null))['then'](respondWithResult(_0x57cb4d,null))[_0x94c5('0x44')](handleError(_0x57cb4d,null));};exports[_0x94c5('0x27')]=function(_0x36da6b,_0x2cc62f){return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x36da6b['params']['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x2cc62f,null))[_0x94c5('0x23')](removeEntity(_0x2cc62f,null))['catch'](handleError(_0x2cc62f,null));};exports[_0x94c5('0x52')]=function(_0x5a8870,_0x25e8b6,_0x5de873){return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x5a8870['params']['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x25e8b6,null))['then'](function(_0x3bd5ed){if(_0x3bd5ed){return _0x3bd5ed[_0x94c5('0x52')](_0x5a8870[_0x94c5('0x51')][_0x94c5('0x53')],_[_0x94c5('0x54')](_0x5a8870[_0x94c5('0x51')],[_0x94c5('0x53'),'id'])||{});}})['then'](respondWithResult(_0x25e8b6,null))[_0x94c5('0x44')](handleError(_0x25e8b6,null));};exports[_0x94c5('0x55')]=function(_0x4858f0,_0x1cceb4,_0x4f48f6){return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x4858f0[_0x94c5('0x46')]['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x1cceb4,null))[_0x94c5('0x23')](function(_0x20e939){if(_0x20e939){return _0x20e939[_0x94c5('0x55')](_0x4858f0[_0x94c5('0x33')]['ids'])[_0x94c5('0x23')](function(){if(_['isArray'](_0x4858f0['query']['ids'])){for(var _0x533922=0x0;_0x533922<_0x4858f0[_0x94c5('0x33')][_0x94c5('0x53')][_0x94c5('0x37')];_0x533922+=0x1){socket[_0x94c5('0x56')](_0x94c5('0x57'),{'UserId':Number(_0x4858f0[_0x94c5('0x33')][_0x94c5('0x53')][_0x533922]),'SquareProjectId':Number(_0x4858f0['params']['id'])});}}else{socket[_0x94c5('0x56')](_0x94c5('0x57'),{'UserId':Number(_0x4858f0[_0x94c5('0x33')][_0x94c5('0x53')]),'SquareProjectId':Number(_0x4858f0[_0x94c5('0x46')]['id'])});}});}})[_0x94c5('0x23')](respondWithStatusCode(_0x1cceb4,null))[_0x94c5('0x44')](handleError(_0x1cceb4,null));};exports['getUsers']=function(_0xc1f4ff,_0x50ef6d,_0x409855){var _0x51f8b5={};var _0x2f140d={};var _0x38ac47;var _0x4e9d2c;return db['SquareProject']['findOne']({'where':{'id':_0xc1f4ff[_0x94c5('0x46')]['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x50ef6d,null))[_0x94c5('0x23')](function(_0x1def41){if(_0x1def41){_0x38ac47=_0x1def41;_0x2f140d['model']=_[_0x94c5('0x32')](db['User'][_0x94c5('0x2e')]);_0x2f140d[_0x94c5('0x33')]=_['keys'](_0xc1f4ff[_0x94c5('0x33')]);_0x2f140d['filters']=_[_0x94c5('0x34')](_0x2f140d[_0x94c5('0x30')],_0x2f140d['query']);_0x51f8b5['attributes']=_[_0x94c5('0x34')](_0x2f140d[_0x94c5('0x30')],qs['fields'](_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x35')]));_0x51f8b5['attributes']=_0x51f8b5['attributes'][_0x94c5('0x37')]?_0x51f8b5[_0x94c5('0x36')]:_0x2f140d[_0x94c5('0x30')];_0x51f8b5['order']=qs[_0x94c5('0x3b')](_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x3b')]);_0x51f8b5[_0x94c5('0x3c')]=qs['filters'](_['pick'](_0xc1f4ff[_0x94c5('0x33')],_0x2f140d[_0x94c5('0x47')]));if(_0xc1f4ff['query']['filter']){_0x51f8b5[_0x94c5('0x3c')]=_['merge'](_0x51f8b5[_0x94c5('0x3c')],{'$or':_[_0x94c5('0x2c')](_0x51f8b5['attributes'],function(_0x4d0360){var _0x288fcc={};_0x288fcc[_0x4d0360]={'$like':'%'+_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x3f')]+'%'};return _0x288fcc;})});}_0x51f8b5=_[_0x94c5('0x3d')]({},_0x51f8b5,_0xc1f4ff[_0x94c5('0x40')]);return _0x38ac47[_0x94c5('0x58')](_0x51f8b5);}})[_0x94c5('0x23')](function(_0x263291){if(_0x263291){_0x4e9d2c=_0x263291[_0x94c5('0x37')];if(!_0xc1f4ff['query'][_0x94c5('0x38')]('nolimit')){_0x51f8b5[_0x94c5('0x1e')]=qs['limit'](_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x1e')]);_0x51f8b5[_0x94c5('0x1d')]=qs[_0x94c5('0x1d')](_0xc1f4ff[_0x94c5('0x33')]['offset']);}return _0x38ac47['getUsers'](_0x51f8b5);}})[_0x94c5('0x23')](function(_0x40d0de){if(_0x40d0de){return _0x40d0de?{'count':_0x4e9d2c,'rows':_0x40d0de}:null;}})[_0x94c5('0x23')](respondWithResult(_0x50ef6d,null))[_0x94c5('0x44')](handleError(_0x50ef6d,null));}; \ No newline at end of file +var _0xcc32=['include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','addUsers','ids','omit','removeUsers','userSquareProject:remove','emit','getUsers','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./squareProject.socket','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','SquareProjects','end','error','stack','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xcc32,0x138));var _0x2cc3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcc32[_0x1d1779];return _0x2377e9;};'use strict';var pdf=require(_0x2cc3('0x0'));var emlformat=require(_0x2cc3('0x1'));var rimraf=require(_0x2cc3('0x2'));var zipdir=require(_0x2cc3('0x3'));var jsonpatch=require(_0x2cc3('0x4'));var rp=require(_0x2cc3('0x5'));var moment=require(_0x2cc3('0x6'));var BPromise=require(_0x2cc3('0x7'));var Mustache=require('mustache');var util=require(_0x2cc3('0x8'));var path=require(_0x2cc3('0x9'));var sox=require(_0x2cc3('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2cc3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2cc3('0xc'));var toCsv=require(_0x2cc3('0xd'));var querystring=require(_0x2cc3('0xe'));var Papa=require(_0x2cc3('0xf'));var Redis=require(_0x2cc3('0x10'));var authService=require(_0x2cc3('0x11'));var qs=require(_0x2cc3('0x12'));var as=require(_0x2cc3('0x13'));var hardwareService=require(_0x2cc3('0x14'));var logger=require(_0x2cc3('0x15'))(_0x2cc3('0x16'));var utils=require(_0x2cc3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2cc3('0x18'));var db=require(_0x2cc3('0x19'))['db'];config[_0x2cc3('0x1a')]=_[_0x2cc3('0x1b')](config[_0x2cc3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cc3('0x1a')]));require(_0x2cc3('0x1c'))['register'](socket);function respondWithStatusCode(_0x45d54f,_0x3e17a7){_0x3e17a7=_0x3e17a7||0xcc;return function(_0x4f6e76){if(_0x4f6e76){return _0x45d54f[_0x2cc3('0x1d')](_0x3e17a7);}return _0x45d54f[_0x2cc3('0x1e')](_0x3e17a7)['end']();};}function respondWithResult(_0x142255,_0x3cdf30){_0x3cdf30=_0x3cdf30||0xc8;return function(_0x5c5767){if(_0x5c5767){return _0x142255['status'](_0x3cdf30)[_0x2cc3('0x1f')](_0x5c5767);}};}function respondWithFilteredResult(_0x536b3c,_0x37ccfe){return function(_0x4baf3e){if(_0x4baf3e){var _0x5d4ac2=_0x4baf3e[_0x2cc3('0x20')],_0x4aa660=_0x37ccfe[_0x2cc3('0x21')],_0x3f7f7e=_0x37ccfe[_0x2cc3('0x21')]+_0x37ccfe[_0x2cc3('0x22')],_0x1843b7;if(_0x3f7f7e>=_0x5d4ac2){_0x3f7f7e=_0x5d4ac2;_0x1843b7=0xc8;}else{_0x1843b7=0xce;}_0x536b3c['status'](_0x1843b7);return _0x536b3c['set']('Content-Range',_0x4aa660+'-'+_0x3f7f7e+'/'+_0x5d4ac2)[_0x2cc3('0x1f')](_0x4baf3e);}return null;};}function patchUpdates(_0x5114d2){return function(_0x37cb2d){try{jsonpatch[_0x2cc3('0x23')](_0x37cb2d,_0x5114d2,!![]);}catch(_0x17a405){return BPromise[_0x2cc3('0x24')](_0x17a405);}return _0x37cb2d[_0x2cc3('0x25')]();};}function saveUpdates(_0x3f3d2e,_0x2d7278){return function(_0x3e0b71){if(_0x3e0b71){return _0x3e0b71[_0x2cc3('0x26')](_0x3f3d2e)[_0x2cc3('0x27')](function(_0xa268ba){return _0xa268ba;});}return null;};}function removeEntity(_0x3fdd0b,_0x2a189f){return function(_0x32b066){if(_0x32b066){return _0x32b066[_0x2cc3('0x28')]()[_0x2cc3('0x27')](function(){var _0x3320de=_0x32b066['get']({'plain':!![]});var _0x94a91f=_0x2cc3('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x94a91f,'resourceId':_0x3320de['id']}})['then'](function(){return _0x32b066;});})[_0x2cc3('0x27')](function(){_0x3fdd0b['status'](0xcc)[_0x2cc3('0x2a')]();});}};}function handleEntityNotFound(_0x4e9dfc,_0x257db6){return function(_0x2be55f){if(!_0x2be55f){_0x4e9dfc['sendStatus'](0x194);}return _0x2be55f;};}function handleError(_0xda24f6,_0x2f4d03){_0x2f4d03=_0x2f4d03||0x1f4;return function(_0x5bb21e){logger[_0x2cc3('0x2b')](_0x5bb21e[_0x2cc3('0x2c')]);if(_0x5bb21e['name']){delete _0x5bb21e['name'];}_0xda24f6['status'](_0x2f4d03)[_0x2cc3('0x2d')](_0x5bb21e);};}exports[_0x2cc3('0x2e')]=function(_0x1a99a4,_0x4d9bf0){var _0x3c20d5={},_0x41ed80={},_0x59f76c={'count':0x0,'rows':[]};var _0x421576=_[_0x2cc3('0x2f')](db[_0x2cc3('0x30')][_0x2cc3('0x31')],function(_0x5623d8){return{'name':_0x5623d8[_0x2cc3('0x32')],'type':_0x5623d8[_0x2cc3('0x33')][_0x2cc3('0x34')]};});_0x41ed80[_0x2cc3('0x35')]=_[_0x2cc3('0x2f')](_0x421576,_0x2cc3('0x36'));_0x41ed80['query']=_[_0x2cc3('0x37')](_0x1a99a4[_0x2cc3('0x38')]);_0x41ed80['filters']=_['intersection'](_0x41ed80[_0x2cc3('0x35')],_0x41ed80[_0x2cc3('0x38')]);_0x3c20d5[_0x2cc3('0x39')]=_[_0x2cc3('0x3a')](_0x41ed80['model'],qs['fields'](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x3b')]));_0x3c20d5[_0x2cc3('0x39')]=_0x3c20d5['attributes'][_0x2cc3('0x3c')]?_0x3c20d5[_0x2cc3('0x39')]:_0x41ed80[_0x2cc3('0x35')];if(!_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x3d')](_0x2cc3('0x3e'))){_0x3c20d5['limit']=qs[_0x2cc3('0x22')](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x22')]);_0x3c20d5[_0x2cc3('0x21')]=qs[_0x2cc3('0x21')](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x21')]);}_0x3c20d5[_0x2cc3('0x3f')]=qs[_0x2cc3('0x40')](_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x40')]);_0x3c20d5[_0x2cc3('0x41')]=qs[_0x2cc3('0x42')](_[_0x2cc3('0x43')](_0x1a99a4['query'],_0x41ed80[_0x2cc3('0x42')]),_0x421576);if(_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x44')]){_0x3c20d5['where']=_[_0x2cc3('0x45')](_0x3c20d5[_0x2cc3('0x41')],{'$or':_[_0x2cc3('0x2f')](_0x421576,function(_0x569c5b){if(_0x569c5b['type']!=='VIRTUAL'){var _0x3e5813={};_0x3e5813[_0x569c5b[_0x2cc3('0x36')]]={'$like':'%'+_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x44')]+'%'};return _0x3e5813;}})});}_0x3c20d5=_['merge']({},_0x3c20d5,_0x1a99a4[_0x2cc3('0x46')]);var _0x238ddf={'where':_0x3c20d5[_0x2cc3('0x41')]};return db[_0x2cc3('0x30')][_0x2cc3('0x20')](_0x238ddf)[_0x2cc3('0x27')](function(_0x2996b6){_0x59f76c[_0x2cc3('0x20')]=_0x2996b6;if(_0x1a99a4[_0x2cc3('0x38')][_0x2cc3('0x47')]){_0x3c20d5[_0x2cc3('0x48')]=[{'all':!![]}];}return db[_0x2cc3('0x30')][_0x2cc3('0x49')](_0x3c20d5);})[_0x2cc3('0x27')](function(_0x839970){_0x59f76c[_0x2cc3('0x4a')]=_0x839970;return _0x59f76c;})['then'](respondWithFilteredResult(_0x4d9bf0,_0x3c20d5))[_0x2cc3('0x4b')](handleError(_0x4d9bf0,null));};exports[_0x2cc3('0x4c')]=function(_0x561bd0,_0x350b08){var _0x582951={'raw':![],'where':{'id':_0x561bd0[_0x2cc3('0x4d')]['id']}},_0x5a4f4c={};_0x5a4f4c[_0x2cc3('0x35')]=_[_0x2cc3('0x37')](db[_0x2cc3('0x30')]['rawAttributes']);_0x5a4f4c['query']=_[_0x2cc3('0x37')](_0x561bd0[_0x2cc3('0x38')]);_0x5a4f4c[_0x2cc3('0x42')]=_['intersection'](_0x5a4f4c['model'],_0x5a4f4c[_0x2cc3('0x38')]);_0x582951[_0x2cc3('0x39')]=_[_0x2cc3('0x3a')](_0x5a4f4c[_0x2cc3('0x35')],qs[_0x2cc3('0x3b')](_0x561bd0[_0x2cc3('0x38')]['fields']));_0x582951[_0x2cc3('0x39')]=_0x582951[_0x2cc3('0x39')][_0x2cc3('0x3c')]?_0x582951['attributes']:_0x5a4f4c[_0x2cc3('0x35')];if(_0x561bd0[_0x2cc3('0x38')][_0x2cc3('0x47')]){_0x582951[_0x2cc3('0x48')]=[{'all':!![]}];}_0x582951=_['merge']({},_0x582951,_0x561bd0['options']);return db[_0x2cc3('0x30')]['find'](_0x582951)[_0x2cc3('0x27')](handleEntityNotFound(_0x350b08,null))[_0x2cc3('0x27')](respondWithResult(_0x350b08,null))[_0x2cc3('0x4b')](handleError(_0x350b08,null));};exports[_0x2cc3('0x4e')]=function(_0x1dfedf,_0x4a15a4){return db[_0x2cc3('0x30')][_0x2cc3('0x4e')](_0x1dfedf[_0x2cc3('0x4f')],{})[_0x2cc3('0x27')](function(_0x3da920){var _0xefb65d=_0x1dfedf[_0x2cc3('0x50')][_0x2cc3('0x51')]({'plain':!![]});if(!_0xefb65d)throw new Error(_0x2cc3('0x52'));if(_0xefb65d['role']===_0x2cc3('0x50')){var _0xc43329=_0x3da920[_0x2cc3('0x51')]({'plain':!![]});var _0x3a7455='SquareProjects';return db[_0x2cc3('0x53')][_0x2cc3('0x54')]({'where':{'name':_0x3a7455,'userProfileId':_0xefb65d[_0x2cc3('0x55')]},'raw':!![]})['then'](function(_0x40fb1b){if(_0x40fb1b&&_0x40fb1b[_0x2cc3('0x56')]===0x0){return db[_0x2cc3('0x57')][_0x2cc3('0x4e')]({'name':_0xc43329[_0x2cc3('0x36')],'resourceId':_0xc43329['id'],'type':_0x40fb1b[_0x2cc3('0x36')],'sectionId':_0x40fb1b['id']},{})[_0x2cc3('0x27')](function(){return _0x3da920;});}else{return _0x3da920;}})[_0x2cc3('0x4b')](function(_0x103b3b){logger[_0x2cc3('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x103b3b);throw _0x103b3b;});}return _0x3da920;})[_0x2cc3('0x27')](respondWithResult(_0x4a15a4,0xc9))['catch'](handleError(_0x4a15a4,null));};exports[_0x2cc3('0x26')]=function(_0x41ee17,_0x419f2a){if(_0x41ee17[_0x2cc3('0x4f')]['id']){delete _0x41ee17[_0x2cc3('0x4f')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x41ee17['params']['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x419f2a,null))[_0x2cc3('0x27')](saveUpdates(_0x41ee17[_0x2cc3('0x4f')],null))[_0x2cc3('0x27')](respondWithResult(_0x419f2a,null))[_0x2cc3('0x4b')](handleError(_0x419f2a,null));};exports['destroy']=function(_0x3c0687,_0xb97838){return db['SquareProject'][_0x2cc3('0x54')]({'where':{'id':_0x3c0687['params']['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0xb97838,null))['then'](removeEntity(_0xb97838,null))[_0x2cc3('0x4b')](handleError(_0xb97838,null));};exports[_0x2cc3('0x58')]=function(_0x2aa5e2,_0x2e4991,_0x13b3d4){return db[_0x2cc3('0x30')]['find']({'where':{'id':_0x2aa5e2[_0x2cc3('0x4d')]['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x2e4991,null))[_0x2cc3('0x27')](function(_0x358994){if(_0x358994){return _0x358994[_0x2cc3('0x58')](_0x2aa5e2['body'][_0x2cc3('0x59')],_[_0x2cc3('0x5a')](_0x2aa5e2['body'],['ids','id'])||{});}})[_0x2cc3('0x27')](respondWithResult(_0x2e4991,null))[_0x2cc3('0x4b')](handleError(_0x2e4991,null));};exports[_0x2cc3('0x5b')]=function(_0x511ecf,_0x259d31,_0x2f35a0){return db[_0x2cc3('0x30')]['find']({'where':{'id':_0x511ecf[_0x2cc3('0x4d')]['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x259d31,null))[_0x2cc3('0x27')](function(_0x2d190b){if(_0x2d190b){return _0x2d190b['removeUsers'](_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')])[_0x2cc3('0x27')](function(){if(_['isArray'](_0x511ecf['query']['ids'])){for(var _0x4e7a77=0x0;_0x4e7a77<_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')][_0x2cc3('0x3c')];_0x4e7a77+=0x1){socket['emit'](_0x2cc3('0x5c'),{'UserId':Number(_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')][_0x4e7a77]),'SquareProjectId':Number(_0x511ecf[_0x2cc3('0x4d')]['id'])});}}else{socket[_0x2cc3('0x5d')](_0x2cc3('0x5c'),{'UserId':Number(_0x511ecf[_0x2cc3('0x38')][_0x2cc3('0x59')]),'SquareProjectId':Number(_0x511ecf[_0x2cc3('0x4d')]['id'])});}});}})[_0x2cc3('0x27')](respondWithStatusCode(_0x259d31,null))['catch'](handleError(_0x259d31,null));};exports[_0x2cc3('0x5e')]=function(_0x3af10c,_0x4fb9cc,_0x2e83e1){var _0x533824={};var _0x5beb8e={};var _0x5e095a;var _0x318423;return db['SquareProject']['findOne']({'where':{'id':_0x3af10c[_0x2cc3('0x4d')]['id']}})[_0x2cc3('0x27')](handleEntityNotFound(_0x4fb9cc,null))[_0x2cc3('0x27')](function(_0x1806aa){if(_0x1806aa){_0x5e095a=_0x1806aa;_0x5beb8e[_0x2cc3('0x35')]=_[_0x2cc3('0x37')](db[_0x2cc3('0x5f')][_0x2cc3('0x31')]);_0x5beb8e['query']=_[_0x2cc3('0x37')](_0x3af10c[_0x2cc3('0x38')]);_0x5beb8e[_0x2cc3('0x42')]=_[_0x2cc3('0x3a')](_0x5beb8e[_0x2cc3('0x35')],_0x5beb8e[_0x2cc3('0x38')]);_0x533824[_0x2cc3('0x39')]=_[_0x2cc3('0x3a')](_0x5beb8e[_0x2cc3('0x35')],qs['fields'](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x3b')]));_0x533824['attributes']=_0x533824[_0x2cc3('0x39')][_0x2cc3('0x3c')]?_0x533824[_0x2cc3('0x39')]:_0x5beb8e['model'];_0x533824[_0x2cc3('0x3f')]=qs[_0x2cc3('0x40')](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x40')]);_0x533824[_0x2cc3('0x41')]=qs[_0x2cc3('0x42')](_['pick'](_0x3af10c[_0x2cc3('0x38')],_0x5beb8e[_0x2cc3('0x42')]));if(_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x44')]){_0x533824[_0x2cc3('0x41')]=_[_0x2cc3('0x45')](_0x533824[_0x2cc3('0x41')],{'$or':_['map'](_0x533824[_0x2cc3('0x39')],function(_0x47f493){var _0x474833={};_0x474833[_0x47f493]={'$like':'%'+_0x3af10c[_0x2cc3('0x38')]['filter']+'%'};return _0x474833;})});}_0x533824=_[_0x2cc3('0x45')]({},_0x533824,_0x3af10c[_0x2cc3('0x46')]);return _0x5e095a[_0x2cc3('0x5e')](_0x533824);}})[_0x2cc3('0x27')](function(_0x547761){if(_0x547761){_0x318423=_0x547761['length'];if(!_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x3d')](_0x2cc3('0x3e'))){_0x533824[_0x2cc3('0x22')]=qs[_0x2cc3('0x22')](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x22')]);_0x533824[_0x2cc3('0x21')]=qs[_0x2cc3('0x21')](_0x3af10c[_0x2cc3('0x38')][_0x2cc3('0x21')]);}return _0x5e095a['getUsers'](_0x533824);}})['then'](function(_0x506a32){if(_0x506a32){return _0x506a32?{'count':_0x318423,'rows':_0x506a32}:null;}})[_0x2cc3('0x27')](respondWithResult(_0x4fb9cc,null))['catch'](handleError(_0x4fb9cc,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3ec95d9..317901e 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 _0xf53b=['exports','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2caad7,_0x449a4d){var _0x341cc2=function(_0x1df65d){while(--_0x1df65d){_0x2caad7['push'](_0x2caad7['shift']());}};_0x341cc2(++_0x449a4d);}(_0xf53b,0x189));var _0xbf53=function(_0x5ce29a,_0x5c6a08){_0x5ce29a=_0x5ce29a-0x0;var _0x4cfb0d=_0xf53b[_0x5ce29a];return _0x4cfb0d;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xbf53('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbf53('0x1')](0x0);var events={'afterCreate':_0xbf53('0x2'),'afterUpdate':_0xbf53('0x3'),'afterDestroy':_0xbf53('0x4')};function emitEvent(_0xc01868){return function(_0x413647,_0x105eb8,_0x3fbb33){SquareProjectEvents[_0xbf53('0x5')](_0xc01868+':'+_0x413647['id'],_0x413647);SquareProjectEvents[_0xbf53('0x5')](_0xc01868,_0x413647);_0x3fbb33(null);};}for(var e in events){if(events[_0xbf53('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xbf53('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xd246=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x1837da,_0x5e3681){var _0x3b0ba2=function(_0x2ed3b6){while(--_0x2ed3b6){_0x1837da['push'](_0x1837da['shift']());}};_0x3b0ba2(++_0x5e3681);}(_0xd246,0xf5));var _0x6d24=function(_0x1394a2,_0x533264){_0x1394a2=_0x1394a2-0x0;var _0x31dcd1=_0xd246[_0x1394a2];return _0x31dcd1;};'use strict';var EventEmitter=require(_0x6d24('0x0'));var SquareProject=require(_0x6d24('0x1'))['db'][_0x6d24('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6d24('0x3')](0x0);var events={'afterCreate':_0x6d24('0x4'),'afterUpdate':_0x6d24('0x5'),'afterDestroy':_0x6d24('0x6')};function emitEvent(_0x51c18f){return function(_0x4e76e1,_0xfa68f3,_0x58e7fc){SquareProjectEvents[_0x6d24('0x7')](_0x51c18f+':'+_0x4e76e1['id'],_0x4e76e1);SquareProjectEvents['emit'](_0x51c18f,_0x4e76e1);_0x58e7fc(null);};}for(var e in events){if(events[_0x6d24('0x8')](e)){var event=events[e];SquareProject[_0x6d24('0x9')](e,emitEvent(event));}}module[_0x6d24('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 24f8cb1..f5b89fe 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 _0x668b=['moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x668b,0x140));var _0xb668=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x668b[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f01bc,_0x517fc5,_0x11bb5e){if(_0x3f01bc[_0xb668('0xb')](_0xb668('0xc'))){_0x3f01bc[_0xb668('0xd')]=moment()[_0xb668('0xe')](_0xb668('0xf'));}if(_0x3f01bc[_0xb668('0xb')](_0xb668('0x10'))){_0x3f01bc['publishedAt']=moment()[_0xb668('0xe')](_0xb668('0xf'));}_0x11bb5e(null,_0x3f01bc);}}});}; \ No newline at end of file +var _0xae79=['square_projects','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x409c70,_0x1e5d8d){var _0x1891bb=function(_0x311388){while(--_0x311388){_0x409c70['push'](_0x409c70['shift']());}};_0x1891bb(++_0x1e5d8d);}(_0xae79,0x1d3));var _0x9ae7=function(_0x2c66da,_0x1e24b4){_0x2c66da=_0x2c66da-0x0;var _0xde8333=_0xae79[_0x2c66da];return _0xde8333;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var logger=require(_0x9ae7('0x2'))(_0x9ae7('0x3'));var moment=require(_0x9ae7('0x4'));var BPromise=require(_0x9ae7('0x5'));var rp=require(_0x9ae7('0x6'));var fs=require('fs');var path=require(_0x9ae7('0x7'));var rimraf=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var attributes=require(_0x9ae7('0xa'));module[_0x9ae7('0xb')]=function(_0x3e98cf,_0x396863){return _0x3e98cf[_0x9ae7('0xc')]('SquareProject',attributes,{'tableName':_0x9ae7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47774e,_0x3c7738,_0x113cab){if(_0x47774e[_0x9ae7('0xe')](_0x9ae7('0xf'))){_0x47774e['savedAt']=moment()[_0x9ae7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x47774e[_0x9ae7('0xe')](_0x9ae7('0x11'))){_0x47774e[_0x9ae7('0x12')]=moment()[_0x9ae7('0x10')](_0x9ae7('0x13'));}_0x113cab(null,_0x47774e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a9c9d30..cad5215 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 _0xc6e7=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','info','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xc6e7,0x123));var _0x7c6e=function(_0x54b6aa,_0x88558c){_0x54b6aa=_0x54b6aa-0x0;var _0x5a09c7=_0xc6e7[_0x54b6aa];return _0x5a09c7;};'use strict';var _=require(_0x7c6e('0x0'));var util=require(_0x7c6e('0x1'));var moment=require(_0x7c6e('0x2'));var BPromise=require(_0x7c6e('0x3'));var rs=require(_0x7c6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c6e('0x5'));var logger=require('../../config/logger')(_0x7c6e('0x6'));var config=require(_0x7c6e('0x7'));var jayson=require(_0x7c6e('0x8'));var client=jayson['client'][_0x7c6e('0x9')]({'port':0x232a});config[_0x7c6e('0xa')]=_[_0x7c6e('0xb')](config[_0x7c6e('0xa')],{'host':_0x7c6e('0xc'),'port':0x18eb});var socket=require(_0x7c6e('0xd'))(new Redis(config[_0x7c6e('0xa')]));require(_0x7c6e('0xe'))['register'](socket);function respondWithRpcPromise(_0x2896d7,_0x479387,_0x28069a){return new BPromise(function(_0xa7f7b2,_0x41c7bd){return client[_0x7c6e('0xf')](_0x2896d7,_0x28069a)[_0x7c6e('0x10')](function(_0x1d5480){logger['info']('SquareProject,\x20%s,\x20%s',_0x479387,_0x7c6e('0x11'));logger[_0x7c6e('0x12')](_0x7c6e('0x13'),_0x479387,'request\x20sent',JSON[_0x7c6e('0x14')](_0x1d5480));if(_0x1d5480[_0x7c6e('0x15')]){if(_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x16')]===0x1f4){logger['error'](_0x7c6e('0x17'),_0x479387,_0x1d5480[_0x7c6e('0x15')]['message']);return _0x41c7bd(_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x18')]);}logger[_0x7c6e('0x15')](_0x7c6e('0x17'),_0x479387,_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x18')]);return _0xa7f7b2(_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x18')]);}else{logger[_0x7c6e('0x19')](_0x7c6e('0x17'),_0x479387,'request\x20sent');_0xa7f7b2(_0x1d5480[_0x7c6e('0x1a')]['message']);}})[_0x7c6e('0x1b')](function(_0x111b91){logger[_0x7c6e('0x15')]('SquareProject,\x20%s,\x20%s',_0x479387,_0x111b91);_0x41c7bd(_0x111b91);});});}exports[_0x7c6e('0x1c')]=function(_0x4cd0fe){var _0x1813bd=this;return new Promise(function(_0x1750a3,_0x5945e1){return db[_0x7c6e('0x1d')][_0x7c6e('0x1e')]({'raw':_0x4cd0fe['options']?_0x4cd0fe[_0x7c6e('0x1f')][_0x7c6e('0x20')]===undefined?!![]:![]:!![],'where':_0x4cd0fe[_0x7c6e('0x1f')]?_0x4cd0fe[_0x7c6e('0x1f')]['where']||null:null,'attributes':_0x4cd0fe['options']?_0x4cd0fe[_0x7c6e('0x1f')][_0x7c6e('0x21')]||null:null,'include':_0x4cd0fe[_0x7c6e('0x1f')]?_0x4cd0fe[_0x7c6e('0x1f')]['include']?_['map'](_0x4cd0fe[_0x7c6e('0x1f')]['include'],function(_0x908adb){return{'model':db[_0x908adb['model']],'as':_0x908adb['as'],'attributes':_0x908adb[_0x7c6e('0x21')],'include':_0x908adb[_0x7c6e('0x22')]?_[_0x7c6e('0x23')](_0x908adb[_0x7c6e('0x22')],function(_0x5c8e0f){return{'model':db[_0x5c8e0f[_0x7c6e('0x24')]],'as':_0x5c8e0f['as'],'attributes':_0x5c8e0f[_0x7c6e('0x21')],'include':_0x5c8e0f['include']?_[_0x7c6e('0x23')](_0x5c8e0f['include'],function(_0x42fb7a){return{'model':db[_0x42fb7a[_0x7c6e('0x24')]],'as':_0x42fb7a['as'],'attributes':_0x42fb7a[_0x7c6e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a635b){logger[_0x7c6e('0x19')]('ShowSquareProject',_0x4cd0fe);logger['debug']('ShowSquareProject',_0x4cd0fe,JSON[_0x7c6e('0x14')](_0x1a635b));_0x1750a3(_0x1a635b);})[_0x7c6e('0x1b')](function(_0x14c084){logger['error']('ShowSquareProject',_0x14c084[_0x7c6e('0x18')],_0x4cd0fe);_0x5945e1(_0x1813bd[_0x7c6e('0x15')](0x1f4,_0x14c084[_0x7c6e('0x18')]));});});}; \ No newline at end of file +var _0x7b21=['request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s'];(function(_0x3b29f3,_0xc2389c){var _0x2ccf8e=function(_0x437a76){while(--_0x437a76){_0x3b29f3['push'](_0x3b29f3['shift']());}};_0x2ccf8e(++_0xc2389c);}(_0x7b21,0x11b));var _0x17b2=function(_0x2838b5,_0x5e9b2c){_0x2838b5=_0x2838b5-0x0;var _0x8a341=_0x7b21[_0x2838b5];return _0x8a341;};'use strict';var _=require(_0x17b2('0x0'));var util=require(_0x17b2('0x1'));var moment=require(_0x17b2('0x2'));var BPromise=require('bluebird');var rs=require(_0x17b2('0x3'));var fs=require('fs');var Redis=require(_0x17b2('0x4'));var db=require(_0x17b2('0x5'))['db'];var utils=require(_0x17b2('0x6'));var logger=require(_0x17b2('0x7'))(_0x17b2('0x8'));var config=require(_0x17b2('0x9'));var jayson=require(_0x17b2('0xa'));var client=jayson[_0x17b2('0xb')][_0x17b2('0xc')]({'port':0x232a});config[_0x17b2('0xd')]=_[_0x17b2('0xe')](config['redis'],{'host':_0x17b2('0xf'),'port':0x18eb});var socket=require(_0x17b2('0x10'))(new Redis(config[_0x17b2('0xd')]));require(_0x17b2('0x11'))['register'](socket);function respondWithRpcPromise(_0x15ceda,_0x16e5ab,_0x4d9d2c){return new BPromise(function(_0xa3bbaf,_0x28fec0){return client['request'](_0x15ceda,_0x4d9d2c)[_0x17b2('0x12')](function(_0x1a2075){logger[_0x17b2('0x13')](_0x17b2('0x14'),_0x16e5ab,_0x17b2('0x15'));logger['debug'](_0x17b2('0x16'),_0x16e5ab,_0x17b2('0x15'),JSON[_0x17b2('0x17')](_0x1a2075));if(_0x1a2075['error']){if(_0x1a2075['error'][_0x17b2('0x18')]===0x1f4){logger[_0x17b2('0x19')](_0x17b2('0x14'),_0x16e5ab,_0x1a2075[_0x17b2('0x19')][_0x17b2('0x1a')]);return _0x28fec0(_0x1a2075[_0x17b2('0x19')][_0x17b2('0x1a')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x16e5ab,_0x1a2075['error']['message']);return _0xa3bbaf(_0x1a2075[_0x17b2('0x19')]['message']);}else{logger[_0x17b2('0x13')]('SquareProject,\x20%s,\x20%s',_0x16e5ab,'request\x20sent');_0xa3bbaf(_0x1a2075['result']['message']);}})[_0x17b2('0x1b')](function(_0x31b339){logger[_0x17b2('0x19')](_0x17b2('0x14'),_0x16e5ab,_0x31b339);_0x28fec0(_0x31b339);});});}exports[_0x17b2('0x1c')]=function(_0x458f25){var _0x4df3b5=this;return new Promise(function(_0x18c52c,_0x1f8563){return db[_0x17b2('0x1d')][_0x17b2('0x1e')]({'raw':_0x458f25[_0x17b2('0x1f')]?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x20')]===undefined?!![]:![]:!![],'where':_0x458f25[_0x17b2('0x1f')]?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x21')]||null:null,'attributes':_0x458f25[_0x17b2('0x1f')]?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x22')]||null:null,'include':_0x458f25['options']?_0x458f25[_0x17b2('0x1f')][_0x17b2('0x23')]?_[_0x17b2('0x24')](_0x458f25[_0x17b2('0x1f')]['include'],function(_0x4b2d2e){return{'model':db[_0x4b2d2e[_0x17b2('0x25')]],'as':_0x4b2d2e['as'],'attributes':_0x4b2d2e[_0x17b2('0x22')],'include':_0x4b2d2e['include']?_[_0x17b2('0x24')](_0x4b2d2e[_0x17b2('0x23')],function(_0x44767e){return{'model':db[_0x44767e[_0x17b2('0x25')]],'as':_0x44767e['as'],'attributes':_0x44767e['attributes'],'include':_0x44767e['include']?_[_0x17b2('0x24')](_0x44767e[_0x17b2('0x23')],function(_0x53c106){return{'model':db[_0x53c106[_0x17b2('0x25')]],'as':_0x53c106['as'],'attributes':_0x53c106[_0x17b2('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59af37){logger[_0x17b2('0x13')](_0x17b2('0x1c'),_0x458f25);logger['debug'](_0x17b2('0x1c'),_0x458f25,JSON[_0x17b2('0x17')](_0x59af37));_0x18c52c(_0x59af37);})['catch'](function(_0x42f7a6){logger[_0x17b2('0x19')](_0x17b2('0x1c'),_0x42f7a6['message'],_0x458f25);_0x1f8563(_0x4df3b5[_0x17b2('0x19')](0x1f4,_0x42f7a6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a9f9f63..f108c8d 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 _0x71ab=['length','squareProject:','save','update','emit','removeListener','register'];(function(_0x251caf,_0x511b7a){var _0x3bd89c=function(_0x47ac7e){while(--_0x47ac7e){_0x251caf['push'](_0x251caf['shift']());}};_0x3bd89c(++_0x511b7a);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb71a('0x0'),'remove',_0xb71a('0x1')];function createListener(_0x5bdf89,_0x3e985a){return function(_0x3f0529){_0x3e985a[_0xb71a('0x2')](_0x5bdf89,_0x3f0529);};}function removeListener(_0x4094b2,_0x37ce74){return function(){SquareProjectEvents[_0xb71a('0x3')](_0x4094b2,_0x37ce74);};}exports[_0xb71a('0x4')]=function(_0x38d931){for(var _0x22c072=0x0,_0x35a84e=events[_0xb71a('0x5')];_0x22c072<_0x35a84e;_0x22c072++){var _0x2a4c86=events[_0x22c072];var _0x43ca14=createListener(_0xb71a('0x6')+_0x2a4c86,_0x38d931);SquareProjectEvents['on'](_0x2a4c86,_0x43ca14);}}; \ No newline at end of file +var _0xb016=['register','./squareProject.events','save','emit'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xb016,0x159));var _0x6b01=function(_0x4f8f68,_0x39ff0e){_0x4f8f68=_0x4f8f68-0x0;var _0x252f44=_0xb016[_0x4f8f68];return _0x252f44;};'use strict';var SquareProjectEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){SquareProjectEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('squareProject:'+_0x374aab,_0x65407a);SquareProjectEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9c32013..278b50f 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 _0x9bb2=['get','isAuthenticated','index','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller'];(function(_0x3ad75a,_0x527689){var _0x25a16f=function(_0x2688d0){while(--_0x2688d0){_0x3ad75a['push'](_0x3ad75a['shift']());}};_0x25a16f(++_0x527689);}(_0x9bb2,0x16c));var _0x29bb=function(_0x52c2a2,_0x1fcb97){_0x52c2a2=_0x52c2a2-0x0;var _0x4b589c=_0x9bb2[_0x52c2a2];return _0x4b589c;};'use strict';var multer=require(_0x29bb('0x0'));var util=require(_0x29bb('0x1'));var path=require(_0x29bb('0x2'));var timeout=require(_0x29bb('0x3'));var express=require(_0x29bb('0x4'));var router=express[_0x29bb('0x5')]();var auth=require(_0x29bb('0x6'));var interaction=require(_0x29bb('0x7'));var config=require(_0x29bb('0x8'));var controller=require(_0x29bb('0x9'));router[_0x29bb('0xa')]('/',auth[_0x29bb('0xb')](),controller[_0x29bb('0xc')]);router[_0x29bb('0xa')]('/:id',auth[_0x29bb('0xb')](),controller[_0x29bb('0xd')]);router[_0x29bb('0xa')](_0x29bb('0xe'),auth['isAuthenticated'](),controller[_0x29bb('0xf')]);router[_0x29bb('0x10')]('/',auth['isAuthenticated'](),controller[_0x29bb('0x11')]);router[_0x29bb('0x12')]('/:id',auth[_0x29bb('0xb')](),controller['update']);router[_0x29bb('0x13')]('/:id/delete',auth[_0x29bb('0xb')](),controller[_0x29bb('0x14')]);module[_0x29bb('0x15')]=router; \ No newline at end of file +var _0x2fee=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','/:id/delete'];(function(_0x48f361,_0x30baa6){var _0x3b32b5=function(_0x3c7684){while(--_0x3c7684){_0x48f361['push'](_0x48f361['shift']());}};_0x3b32b5(++_0x30baa6);}(_0x2fee,0x11a));var _0xe2fe=function(_0x314ee0,_0x2c854d){_0x314ee0=_0x314ee0-0x0;var _0x2c618a=_0x2fee[_0x314ee0];return _0x2c618a;};'use strict';var multer=require(_0xe2fe('0x0'));var util=require('util');var path=require(_0xe2fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2fe('0x2'));var router=express['Router']();var auth=require(_0xe2fe('0x3'));var interaction=require(_0xe2fe('0x4'));var config=require('../../config/environment');var controller=require(_0xe2fe('0x5'));router[_0xe2fe('0x6')]('/',auth[_0xe2fe('0x7')](),controller['index']);router[_0xe2fe('0x6')](_0xe2fe('0x8'),auth[_0xe2fe('0x7')](),controller[_0xe2fe('0x9')]);router[_0xe2fe('0x6')](_0xe2fe('0xa'),auth['isAuthenticated'](),controller[_0xe2fe('0xb')]);router[_0xe2fe('0xc')]('/',auth['isAuthenticated'](),controller[_0xe2fe('0xd')]);router[_0xe2fe('0xe')](_0xe2fe('0x8'),auth[_0xe2fe('0x7')](),controller[_0xe2fe('0xf')]);router[_0xe2fe('0x10')](_0xe2fe('0x11'),auth[_0xe2fe('0x7')](),controller[_0xe2fe('0x12')]);module[_0xe2fe('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b1a995a..954860b 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 _0x3249=['sequelize','exports','STRING','getDataValue','substring','lastIndexOf'];(function(_0x43b21d,_0x5d5677){var _0x1de400=function(_0x405b75){while(--_0x405b75){_0x43b21d['push'](_0x43b21d['shift']());}};_0x1de400(++_0x5d5677);}(_0x3249,0xd2));var _0x9324=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x3249[_0x15c421];return _0x5e5ed5;};'use strict';var Sequelize=require(_0x9324('0x0'));module[_0x9324('0x1')]={'uniqueid':{'type':Sequelize[_0x9324('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9324('0x2')]},'context':{'type':Sequelize[_0x9324('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x9324('0x2')]},'projectName':{'type':Sequelize[_0x9324('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x9324('0x2')]},'savePath':{'type':Sequelize[_0x9324('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5743c5='';var _0x3b73a0=this[_0x9324('0x3')]('savePath');if(_0x3b73a0){_0x5743c5=_0x3b73a0[_0x9324('0x4')](_0x3b73a0[_0x9324('0x5')]('.'));}return _0x5743c5;}}}; \ No newline at end of file +var _0x2149=['VIRTUAL','getDataValue','substring','sequelize','exports','STRING'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x2149,0x1e3));var _0x9214=function(_0x2b0e5b,_0x3532b1){_0x2b0e5b=_0x2b0e5b-0x0;var _0x319989=_0x2149[_0x2b0e5b];return _0x319989;};'use strict';var Sequelize=require(_0x9214('0x0'));module[_0x9214('0x1')]={'uniqueid':{'type':Sequelize[_0x9214('0x2')]},'callerid':{'type':Sequelize[_0x9214('0x2')]},'calleridname':{'type':Sequelize[_0x9214('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9214('0x2')]},'priority':{'type':Sequelize[_0x9214('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x9214('0x2')]},'projectName':{'type':Sequelize[_0x9214('0x2')]},'saveName':{'type':Sequelize[_0x9214('0x2')]},'filename':{'type':Sequelize[_0x9214('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x9214('0x3')],'get':function(){var _0x48a610='';var _0x85e7b1=this[_0x9214('0x4')]('savePath');if(_0x85e7b1){_0x48a610=_0x85e7b1[_0x9214('0x5')](_0x85e7b1['lastIndexOf']('.'));}return _0x48a610;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c81a59c..3aa2710 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 _0xfeb9=['json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','catch','show','params','keys','rawAttributes','include','options','find','create','body','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','download','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status'];(function(_0x3017e0,_0x399ed9){var _0x865461=function(_0x19cfc3){while(--_0x19cfc3){_0x3017e0['push'](_0x3017e0['shift']());}};_0x865461(++_0x399ed9);}(_0xfeb9,0x1c0));var _0x9feb=function(_0x3037dd,_0x52d9d5){_0x3037dd=_0x3037dd-0x0;var _0xace26=_0xfeb9[_0x3037dd];return _0xace26;};'use strict';var pdf=require(_0x9feb('0x0'));var emlformat=require(_0x9feb('0x1'));var rimraf=require(_0x9feb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9feb('0x3'));var rp=require(_0x9feb('0x4'));var moment=require(_0x9feb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9feb('0x6'));var util=require(_0x9feb('0x7'));var path=require(_0x9feb('0x8'));var sox=require(_0x9feb('0x9'));var csv=require(_0x9feb('0xa'));var ejs=require(_0x9feb('0xb'));var fs=require('fs');var _=require(_0x9feb('0xc'));var squel=require(_0x9feb('0xd'));var crypto=require(_0x9feb('0xe'));var jsforce=require(_0x9feb('0xf'));var deskjs=require(_0x9feb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9feb('0x11'));var Papa=require(_0x9feb('0x12'));var Redis=require(_0x9feb('0x13'));var authService=require(_0x9feb('0x14'));var qs=require(_0x9feb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9feb('0x16'));var logger=require(_0x9feb('0x17'))(_0x9feb('0x18'));var utils=require(_0x9feb('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0346,_0x175be8){_0x175be8=_0x175be8||0xcc;return function(_0x47a3c5){if(_0x47a3c5){return _0x1d0346['sendStatus'](_0x175be8);}return _0x1d0346[_0x9feb('0x1a')](_0x175be8)['end']();};}function respondWithResult(_0x2f3f1b,_0x1159a7){_0x1159a7=_0x1159a7||0xc8;return function(_0x1982a6){if(_0x1982a6){return _0x2f3f1b[_0x9feb('0x1a')](_0x1159a7)[_0x9feb('0x1b')](_0x1982a6);}};}function respondWithFilteredResult(_0x490948,_0x14b488){return function(_0x5e9d6a){if(_0x5e9d6a){var _0x1b2c0c=_0x5e9d6a[_0x9feb('0x1c')],_0x3335f8=_0x14b488['offset'],_0x40a526=_0x14b488[_0x9feb('0x1d')]+_0x14b488[_0x9feb('0x1e')],_0x2a1cb1;if(_0x40a526>=_0x1b2c0c){_0x40a526=_0x1b2c0c;_0x2a1cb1=0xc8;}else{_0x2a1cb1=0xce;}_0x490948[_0x9feb('0x1a')](_0x2a1cb1);return _0x490948['set'](_0x9feb('0x1f'),_0x3335f8+'-'+_0x40a526+'/'+_0x1b2c0c)[_0x9feb('0x1b')](_0x5e9d6a);}return null;};}function patchUpdates(_0x137d2b){return function(_0x5f46d0){try{jsonpatch['apply'](_0x5f46d0,_0x137d2b,!![]);}catch(_0x911c1e){return BPromise[_0x9feb('0x20')](_0x911c1e);}return _0x5f46d0[_0x9feb('0x21')]();};}function saveUpdates(_0x46d429,_0x3bcb80){return function(_0x1fe1ab){if(_0x1fe1ab){return _0x1fe1ab[_0x9feb('0x22')](_0x46d429)[_0x9feb('0x23')](function(_0x24ced6){return _0x24ced6;});}return null;};}function removeEntity(_0x5e7ab9,_0x126e8f){return function(_0x32d633){if(_0x32d633){return _0x32d633[_0x9feb('0x24')]()[_0x9feb('0x23')](function(){_0x5e7ab9[_0x9feb('0x1a')](0xcc)[_0x9feb('0x25')]();});}};}function handleEntityNotFound(_0x549607,_0x429bc4){return function(_0x2de64d){if(!_0x2de64d){_0x549607['sendStatus'](0x194);}return _0x2de64d;};}function handleError(_0x30fff9,_0x5df7fd){_0x5df7fd=_0x5df7fd||0x1f4;return function(_0x583ddb){logger[_0x9feb('0x26')](_0x583ddb[_0x9feb('0x27')]);if(_0x583ddb[_0x9feb('0x28')]){delete _0x583ddb[_0x9feb('0x28')];}_0x30fff9[_0x9feb('0x1a')](_0x5df7fd)[_0x9feb('0x29')](_0x583ddb);};}exports[_0x9feb('0x2a')]=function(_0x48ab3b,_0x383c54){var _0x293b0f={},_0x512e6d={},_0x22c23e={'count':0x0,'rows':[]};var _0x111ca2=_[_0x9feb('0x2b')](db[_0x9feb('0x2c')]['rawAttributes'],function(_0x3def41){return{'name':_0x3def41[_0x9feb('0x2d')],'type':_0x3def41[_0x9feb('0x2e')][_0x9feb('0x2f')]};});_0x512e6d['model']=_[_0x9feb('0x2b')](_0x111ca2,_0x9feb('0x28'));_0x512e6d[_0x9feb('0x30')]=_['keys'](_0x48ab3b[_0x9feb('0x30')]);_0x512e6d[_0x9feb('0x31')]=_[_0x9feb('0x32')](_0x512e6d[_0x9feb('0x33')],_0x512e6d[_0x9feb('0x30')]);_0x293b0f[_0x9feb('0x34')]=_[_0x9feb('0x32')](_0x512e6d[_0x9feb('0x33')],qs[_0x9feb('0x35')](_0x48ab3b['query'][_0x9feb('0x35')]));_0x293b0f[_0x9feb('0x34')]=_0x293b0f[_0x9feb('0x34')][_0x9feb('0x36')]?_0x293b0f[_0x9feb('0x34')]:_0x512e6d[_0x9feb('0x33')];if(!_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x37')]('nolimit')){_0x293b0f[_0x9feb('0x1e')]=qs[_0x9feb('0x1e')](_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x1e')]);_0x293b0f[_0x9feb('0x1d')]=qs[_0x9feb('0x1d')](_0x48ab3b[_0x9feb('0x30')]['offset']);}_0x293b0f[_0x9feb('0x38')]=qs[_0x9feb('0x39')](_0x48ab3b[_0x9feb('0x30')]['sort']);_0x293b0f[_0x9feb('0x3a')]=qs[_0x9feb('0x31')](_[_0x9feb('0x3b')](_0x48ab3b[_0x9feb('0x30')],_0x512e6d[_0x9feb('0x31')]),_0x111ca2);if(_0x48ab3b[_0x9feb('0x30')]['filter']){_0x293b0f['where']=_['merge'](_0x293b0f[_0x9feb('0x3a')],{'$or':_[_0x9feb('0x2b')](_0x111ca2,function(_0x2fd4b8){if(_0x2fd4b8[_0x9feb('0x2e')]!==_0x9feb('0x3c')){var _0x898d5b={};_0x898d5b[_0x2fd4b8[_0x9feb('0x28')]]={'$like':'%'+_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x3d')]+'%'};return _0x898d5b;}})});}_0x293b0f=_[_0x9feb('0x3e')]({},_0x293b0f,_0x48ab3b['options']);var _0x3a1c12={'where':_0x293b0f['where']};return db['SquareRecording'][_0x9feb('0x1c')](_0x3a1c12)[_0x9feb('0x23')](function(_0x2a2f74){_0x22c23e[_0x9feb('0x1c')]=_0x2a2f74;if(_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x3f')]){_0x293b0f['include']=[{'all':!![]}];}return db[_0x9feb('0x2c')]['findAll'](_0x293b0f);})['then'](function(_0x40b5c3){_0x22c23e['rows']=_0x40b5c3;return _0x22c23e;})[_0x9feb('0x23')](respondWithFilteredResult(_0x383c54,_0x293b0f))[_0x9feb('0x40')](handleError(_0x383c54,null));};exports[_0x9feb('0x41')]=function(_0x21d048,_0x2b6342){var _0x467f0b={'raw':!![],'where':{'id':_0x21d048[_0x9feb('0x42')]['id']}},_0x1471ab={};_0x1471ab[_0x9feb('0x33')]=_[_0x9feb('0x43')](db[_0x9feb('0x2c')][_0x9feb('0x44')]);_0x1471ab[_0x9feb('0x30')]=_[_0x9feb('0x43')](_0x21d048[_0x9feb('0x30')]);_0x1471ab[_0x9feb('0x31')]=_['intersection'](_0x1471ab['model'],_0x1471ab[_0x9feb('0x30')]);_0x467f0b[_0x9feb('0x34')]=_[_0x9feb('0x32')](_0x1471ab[_0x9feb('0x33')],qs[_0x9feb('0x35')](_0x21d048[_0x9feb('0x30')][_0x9feb('0x35')]));_0x467f0b[_0x9feb('0x34')]=_0x467f0b['attributes'][_0x9feb('0x36')]?_0x467f0b['attributes']:_0x1471ab[_0x9feb('0x33')];if(_0x21d048[_0x9feb('0x30')][_0x9feb('0x3f')]){_0x467f0b[_0x9feb('0x45')]=[{'all':!![]}];}_0x467f0b=_[_0x9feb('0x3e')]({},_0x467f0b,_0x21d048[_0x9feb('0x46')]);return db['SquareRecording'][_0x9feb('0x47')](_0x467f0b)[_0x9feb('0x23')](handleEntityNotFound(_0x2b6342,null))[_0x9feb('0x23')](respondWithResult(_0x2b6342,null))[_0x9feb('0x40')](handleError(_0x2b6342,null));};exports['create']=function(_0x138c01,_0x4cb49a){return db[_0x9feb('0x2c')][_0x9feb('0x48')](_0x138c01[_0x9feb('0x49')],{})[_0x9feb('0x23')](respondWithResult(_0x4cb49a,0xc9))[_0x9feb('0x40')](handleError(_0x4cb49a,null));};exports[_0x9feb('0x22')]=function(_0x486939,_0xd938c0){if(_0x486939[_0x9feb('0x49')]['id']){delete _0x486939[_0x9feb('0x49')]['id'];}return db[_0x9feb('0x2c')][_0x9feb('0x47')]({'where':{'id':_0x486939['params']['id']}})[_0x9feb('0x23')](handleEntityNotFound(_0xd938c0,null))[_0x9feb('0x23')](saveUpdates(_0x486939[_0x9feb('0x49')],null))['then'](respondWithResult(_0xd938c0,null))[_0x9feb('0x40')](handleError(_0xd938c0,null));};exports['download']=function(_0x3640fb,_0x34f5cc,_0x5859f2){var _0x3db826=require('../../components/encryptor');var _0x2c10d8=![];var _0x9613c6={};if(_0x3640fb[_0x9feb('0x30')][_0x9feb('0x2e')]&&_0x3640fb[_0x9feb('0x30')][_0x9feb('0x2e')]===_0x9feb('0x4a')){_0x9613c6['uniqueid']=_0x3640fb[_0x9feb('0x42')]['id'];}else{_0x9613c6['id']=_0x3640fb[_0x9feb('0x42')]['id'];}return db['SquareRecording']['find']({'where':_0x9613c6,'attributes':['id',_0x9feb('0x4b'),_0x9feb('0x4c')],'raw':!![]})[_0x9feb('0x23')](handleEntityNotFound(_0x34f5cc,null))[_0x9feb('0x23')](function(_0x4f25f8){if(_0x4f25f8){var _0x61e786=_0x4f25f8['savePath'];var _0x10da15=util[_0x9feb('0x4d')](_0x9feb('0x4e'),_0x61e786);if(fs[_0x9feb('0x4f')](_0x10da15)){_0x2c10d8=!![];return _0x3db826[_0x9feb('0x50')](_0x10da15,_0x61e786,config[_0x9feb('0x51')][_0x9feb('0x52')])[_0x9feb('0x23')](function(){return _0x4f25f8;});}return _0x4f25f8;}})[_0x9feb('0x23')](function(_0x38d589){if(_0x38d589){var _0x50dc68=_0x38d589['savePath'];if(!fs['existsSync'](_0x50dc68)){throw new db[(_0x9feb('0x53'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x38d589[_0x9feb('0x4c')]){return _0x34f5cc[_0x9feb('0x54')](_0x50dc68,_0x38d589[_0x9feb('0x4c')]+path['extname'](_0x50dc68),function(){if(_0x2c10d8){fs[_0x9feb('0x55')](_0x50dc68);}});}else{return _0x34f5cc[_0x9feb('0x54')](_0x50dc68,function(_0x6700a7){if(_0x2c10d8){fs[_0x9feb('0x55')](_0x50dc68);}});}}})[_0x9feb('0x40')](function(_0x4e9cce){if(_0x4e9cce[_0x9feb('0x56')]==='SquareRecording\x20not\x20found'){_0x34f5cc[_0x9feb('0x1a')](0x194)[_0x9feb('0x29')](_0x9feb('0x57'));}else{return handleError(_0x34f5cc,null);}});};exports['destroy']=function(_0x1a6f14,_0x249f66){return db[_0x9feb('0x2c')][_0x9feb('0x47')]({'where':{'id':_0x1a6f14[_0x9feb('0x42')]['id']}})[_0x9feb('0x23')](function(_0x3d78fe){if(!_0x3d78fe)throw new ReferenceError(_0x9feb('0x58'));return _0x3d78fe;})[_0x9feb('0x23')](function(_0x287826){var _0x40280c=_0x287826[_0x9feb('0x4b')];logger[_0x9feb('0x59')](_0x9feb('0x5a'),_0x40280c);if(!_['isNil'](_0x287826[_0x9feb('0x4b')])&&fs['existsSync'](_0x40280c)){logger[_0x9feb('0x59')](_0x9feb('0x5b')+_0x40280c+_0x9feb('0x5c'));fs[_0x9feb('0x5d')](_0x40280c);}_0x40280c=_0x40280c+'.cypher';if(!_[_0x9feb('0x5e')](_0x287826['savePath'])&&fs[_0x9feb('0x4f')](_0x40280c)){logger['info'](_0x9feb('0x5b')+_0x40280c+_0x9feb('0x5c'));fs[_0x9feb('0x5d')](_0x40280c);}return _0x287826;})[_0x9feb('0x23')](function(_0x35aff6){if(!_0x35aff6)throw new InternalError();return _0x35aff6[_0x9feb('0x24')]();})[_0x9feb('0x23')](function(){_0x249f66[_0x9feb('0x1a')](0xcc)[_0x9feb('0x25')]();})['catch'](handleError(_0x249f66,null));}; \ No newline at end of file +var _0x1ab2=['find','catch','create','body','params','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','recording','SquareRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','SquareRecording','findAll','rows','show','keys','fields'];(function(_0xd970da,_0x3ce3d9){var _0x29bdbd=function(_0x6f9cf2){while(--_0x6f9cf2){_0xd970da['push'](_0xd970da['shift']());}};_0x29bdbd(++_0x3ce3d9);}(_0x1ab2,0x198));var _0x21ab=function(_0x23b4b5,_0xd7ea37){_0x23b4b5=_0x23b4b5-0x0;var _0x2a041a=_0x1ab2[_0x23b4b5];return _0x2a041a;};'use strict';var pdf=require(_0x21ab('0x0'));var emlformat=require(_0x21ab('0x1'));var rimraf=require(_0x21ab('0x2'));var zipdir=require(_0x21ab('0x3'));var jsonpatch=require(_0x21ab('0x4'));var rp=require('request-promise');var moment=require(_0x21ab('0x5'));var BPromise=require(_0x21ab('0x6'));var Mustache=require(_0x21ab('0x7'));var util=require(_0x21ab('0x8'));var path=require('path');var sox=require(_0x21ab('0x9'));var csv=require(_0x21ab('0xa'));var ejs=require(_0x21ab('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x21ab('0xc'));var deskjs=require(_0x21ab('0xd'));var toCsv=require(_0x21ab('0xa'));var querystring=require(_0x21ab('0xe'));var Papa=require('papaparse');var Redis=require(_0x21ab('0xf'));var authService=require(_0x21ab('0x10'));var qs=require(_0x21ab('0x11'));var as=require(_0x21ab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21ab('0x13'))(_0x21ab('0x14'));var utils=require(_0x21ab('0x15'));var config=require(_0x21ab('0x16'));var licenseUtil=require(_0x21ab('0x17'));var db=require(_0x21ab('0x18'))['db'];function respondWithStatusCode(_0x23f187,_0x44477a){_0x44477a=_0x44477a||0xcc;return function(_0x574626){if(_0x574626){return _0x23f187[_0x21ab('0x19')](_0x44477a);}return _0x23f187[_0x21ab('0x1a')](_0x44477a)[_0x21ab('0x1b')]();};}function respondWithResult(_0x2720b4,_0x4d655f){_0x4d655f=_0x4d655f||0xc8;return function(_0x3a7741){if(_0x3a7741){return _0x2720b4[_0x21ab('0x1a')](_0x4d655f)[_0x21ab('0x1c')](_0x3a7741);}};}function respondWithFilteredResult(_0x412345,_0x2d4b90){return function(_0x3784a6){if(_0x3784a6){var _0x2292a8=_0x3784a6[_0x21ab('0x1d')],_0x3414ec=_0x2d4b90[_0x21ab('0x1e')],_0x596e8a=_0x2d4b90[_0x21ab('0x1e')]+_0x2d4b90[_0x21ab('0x1f')],_0x9aa4ef;if(_0x596e8a>=_0x2292a8){_0x596e8a=_0x2292a8;_0x9aa4ef=0xc8;}else{_0x9aa4ef=0xce;}_0x412345[_0x21ab('0x1a')](_0x9aa4ef);return _0x412345[_0x21ab('0x20')](_0x21ab('0x21'),_0x3414ec+'-'+_0x596e8a+'/'+_0x2292a8)[_0x21ab('0x1c')](_0x3784a6);}return null;};}function patchUpdates(_0x49061f){return function(_0x3ac3e7){try{jsonpatch[_0x21ab('0x22')](_0x3ac3e7,_0x49061f,!![]);}catch(_0x36f474){return BPromise[_0x21ab('0x23')](_0x36f474);}return _0x3ac3e7[_0x21ab('0x24')]();};}function saveUpdates(_0x11e005,_0x5df8de){return function(_0xeae02e){if(_0xeae02e){return _0xeae02e[_0x21ab('0x25')](_0x11e005)[_0x21ab('0x26')](function(_0xcf7bca){return _0xcf7bca;});}return null;};}function removeEntity(_0x3e7ad8,_0x11a316){return function(_0x4bd5f1){if(_0x4bd5f1){return _0x4bd5f1[_0x21ab('0x27')]()[_0x21ab('0x26')](function(){_0x3e7ad8['status'](0xcc)[_0x21ab('0x1b')]();});}};}function handleEntityNotFound(_0x59b216,_0x18601b){return function(_0x205ce9){if(!_0x205ce9){_0x59b216[_0x21ab('0x19')](0x194);}return _0x205ce9;};}function handleError(_0x211e59,_0x4e5157){_0x4e5157=_0x4e5157||0x1f4;return function(_0x22685a){logger[_0x21ab('0x28')](_0x22685a[_0x21ab('0x29')]);if(_0x22685a[_0x21ab('0x2a')]){delete _0x22685a[_0x21ab('0x2a')];}_0x211e59['status'](_0x4e5157)['send'](_0x22685a);};}exports[_0x21ab('0x2b')]=function(_0x2263bc,_0x2e5740){var _0x3efd47={},_0x407d01={},_0x42e897={'count':0x0,'rows':[]};var _0x29d5cb=_['map'](db['SquareRecording'][_0x21ab('0x2c')],function(_0x13bed4){return{'name':_0x13bed4[_0x21ab('0x2d')],'type':_0x13bed4['type'][_0x21ab('0x2e')]};});_0x407d01['model']=_[_0x21ab('0x2f')](_0x29d5cb,_0x21ab('0x2a'));_0x407d01['query']=_['keys'](_0x2263bc[_0x21ab('0x30')]);_0x407d01[_0x21ab('0x31')]=_[_0x21ab('0x32')](_0x407d01[_0x21ab('0x33')],_0x407d01[_0x21ab('0x30')]);_0x3efd47[_0x21ab('0x34')]=_[_0x21ab('0x32')](_0x407d01[_0x21ab('0x33')],qs['fields'](_0x2263bc[_0x21ab('0x30')]['fields']));_0x3efd47[_0x21ab('0x34')]=_0x3efd47['attributes'][_0x21ab('0x35')]?_0x3efd47[_0x21ab('0x34')]:_0x407d01[_0x21ab('0x33')];if(!_0x2263bc['query'][_0x21ab('0x36')]('nolimit')){_0x3efd47[_0x21ab('0x1f')]=qs['limit'](_0x2263bc[_0x21ab('0x30')][_0x21ab('0x1f')]);_0x3efd47[_0x21ab('0x1e')]=qs[_0x21ab('0x1e')](_0x2263bc[_0x21ab('0x30')][_0x21ab('0x1e')]);}_0x3efd47[_0x21ab('0x37')]=qs['sort'](_0x2263bc[_0x21ab('0x30')][_0x21ab('0x38')]);_0x3efd47['where']=qs[_0x21ab('0x31')](_[_0x21ab('0x39')](_0x2263bc[_0x21ab('0x30')],_0x407d01['filters']),_0x29d5cb);if(_0x2263bc[_0x21ab('0x30')][_0x21ab('0x3a')]){_0x3efd47[_0x21ab('0x3b')]=_[_0x21ab('0x3c')](_0x3efd47[_0x21ab('0x3b')],{'$or':_[_0x21ab('0x2f')](_0x29d5cb,function(_0x4e297a){if(_0x4e297a[_0x21ab('0x3d')]!==_0x21ab('0x3e')){var _0x5cf0cc={};_0x5cf0cc[_0x4e297a[_0x21ab('0x2a')]]={'$like':'%'+_0x2263bc['query'][_0x21ab('0x3a')]+'%'};return _0x5cf0cc;}})});}_0x3efd47=_[_0x21ab('0x3c')]({},_0x3efd47,_0x2263bc[_0x21ab('0x3f')]);var _0x268d6a={'where':_0x3efd47[_0x21ab('0x3b')]};return db['SquareRecording'][_0x21ab('0x1d')](_0x268d6a)[_0x21ab('0x26')](function(_0x1dc674){_0x42e897['count']=_0x1dc674;if(_0x2263bc['query'][_0x21ab('0x40')]){_0x3efd47[_0x21ab('0x41')]=[{'all':!![]}];}return db[_0x21ab('0x42')][_0x21ab('0x43')](_0x3efd47);})[_0x21ab('0x26')](function(_0x3d7373){_0x42e897[_0x21ab('0x44')]=_0x3d7373;return _0x42e897;})[_0x21ab('0x26')](respondWithFilteredResult(_0x2e5740,_0x3efd47))['catch'](handleError(_0x2e5740,null));};exports[_0x21ab('0x45')]=function(_0x50c533,_0x276031){var _0x157a47={'raw':!![],'where':{'id':_0x50c533['params']['id']}},_0x35b707={};_0x35b707[_0x21ab('0x33')]=_['keys'](db[_0x21ab('0x42')][_0x21ab('0x2c')]);_0x35b707[_0x21ab('0x30')]=_[_0x21ab('0x46')](_0x50c533[_0x21ab('0x30')]);_0x35b707[_0x21ab('0x31')]=_[_0x21ab('0x32')](_0x35b707[_0x21ab('0x33')],_0x35b707['query']);_0x157a47[_0x21ab('0x34')]=_['intersection'](_0x35b707['model'],qs[_0x21ab('0x47')](_0x50c533[_0x21ab('0x30')][_0x21ab('0x47')]));_0x157a47[_0x21ab('0x34')]=_0x157a47['attributes']['length']?_0x157a47[_0x21ab('0x34')]:_0x35b707['model'];if(_0x50c533[_0x21ab('0x30')][_0x21ab('0x40')]){_0x157a47[_0x21ab('0x41')]=[{'all':!![]}];}_0x157a47=_['merge']({},_0x157a47,_0x50c533['options']);return db[_0x21ab('0x42')][_0x21ab('0x48')](_0x157a47)[_0x21ab('0x26')](handleEntityNotFound(_0x276031,null))[_0x21ab('0x26')](respondWithResult(_0x276031,null))[_0x21ab('0x49')](handleError(_0x276031,null));};exports[_0x21ab('0x4a')]=function(_0x433aa7,_0x3cd07c){return db[_0x21ab('0x42')]['create'](_0x433aa7[_0x21ab('0x4b')],{})[_0x21ab('0x26')](respondWithResult(_0x3cd07c,0xc9))[_0x21ab('0x49')](handleError(_0x3cd07c,null));};exports['update']=function(_0x142862,_0x484eba){if(_0x142862[_0x21ab('0x4b')]['id']){delete _0x142862[_0x21ab('0x4b')]['id'];}return db[_0x21ab('0x42')]['find']({'where':{'id':_0x142862[_0x21ab('0x4c')]['id']}})[_0x21ab('0x26')](handleEntityNotFound(_0x484eba,null))[_0x21ab('0x26')](saveUpdates(_0x142862[_0x21ab('0x4b')],null))['then'](respondWithResult(_0x484eba,null))['catch'](handleError(_0x484eba,null));};exports[_0x21ab('0x4d')]=function(_0x210c2e,_0x4c5cea,_0x46f471){var _0x2d4675=require(_0x21ab('0x4e'));var _0x2b86d1=![];var _0x3c7c8c={};if(_0x210c2e[_0x21ab('0x30')][_0x21ab('0x3d')]&&_0x210c2e[_0x21ab('0x30')][_0x21ab('0x3d')]==='uniqueid'){_0x3c7c8c[_0x21ab('0x4f')]=_0x210c2e[_0x21ab('0x4c')]['id'];}else{_0x3c7c8c['id']=_0x210c2e[_0x21ab('0x4c')]['id'];}return db[_0x21ab('0x42')]['find']({'where':_0x3c7c8c,'attributes':['id',_0x21ab('0x50'),'filename'],'raw':!![]})[_0x21ab('0x26')](handleEntityNotFound(_0x4c5cea,null))[_0x21ab('0x26')](function(_0x28e9d4){if(_0x28e9d4){var _0x42a5ce=_0x28e9d4['savePath'];var _0x3f646c=util['format'](_0x21ab('0x51'),_0x42a5ce);if(fs[_0x21ab('0x52')](_0x3f646c)){_0x2b86d1=!![];return _0x2d4675[_0x21ab('0x53')](_0x3f646c,_0x42a5ce,config['secrets'][_0x21ab('0x54')])[_0x21ab('0x26')](function(){return _0x28e9d4;});}return _0x28e9d4;}})[_0x21ab('0x26')](function(_0x4e5c82){if(_0x4e5c82){var _0x4d48cf=_0x4e5c82[_0x21ab('0x50')];if(!fs[_0x21ab('0x52')](_0x4d48cf)){throw new db['Sequelize']['ValidationError'](_0x21ab('0x55'));}if(_0x4e5c82[_0x21ab('0x56')]){return _0x4c5cea[_0x21ab('0x4d')](_0x4d48cf,_0x4e5c82[_0x21ab('0x56')]+path[_0x21ab('0x57')](_0x4d48cf),function(){if(_0x2b86d1){fs[_0x21ab('0x58')](_0x4d48cf);}});}else{return _0x4c5cea[_0x21ab('0x4d')](_0x4d48cf,function(_0xac4075){if(_0x2b86d1){fs[_0x21ab('0x58')](_0x4d48cf);}});}}})[_0x21ab('0x49')](function(_0x1a07eb){if(_0x1a07eb['message']===_0x21ab('0x55')){_0x4c5cea[_0x21ab('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x4c5cea,null);}});};exports[_0x21ab('0x27')]=function(_0x25aa0f,_0x253774){return db[_0x21ab('0x42')][_0x21ab('0x48')]({'where':{'id':_0x25aa0f[_0x21ab('0x4c')]['id']}})['then'](function(_0x1c79a3){if(!_0x1c79a3)throw new ReferenceError(_0x21ab('0x59'));return _0x1c79a3;})[_0x21ab('0x26')](function(_0x6e4705){var _0x54e077=_0x6e4705['savePath'];logger['info'](_0x21ab('0x5a'),_0x54e077);if(!_[_0x21ab('0x5b')](_0x6e4705[_0x21ab('0x50')])&&fs['existsSync'](_0x54e077)){logger[_0x21ab('0x5c')](_0x21ab('0x5d')+_0x54e077+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x21ab('0x5e')](_0x54e077);}_0x54e077=_0x54e077+'.cypher';if(!_[_0x21ab('0x5b')](_0x6e4705[_0x21ab('0x50')])&&fs[_0x21ab('0x52')](_0x54e077)){logger[_0x21ab('0x5c')](_0x21ab('0x5d')+_0x54e077+_0x21ab('0x5f'));fs[_0x21ab('0x5e')](_0x54e077);}return _0x6e4705;})[_0x21ab('0x26')](function(_0x5857b2){if(!_0x5857b2)throw new InternalError();return _0x5857b2[_0x21ab('0x27')]();})['then'](function(){_0x253774[_0x21ab('0x1a')](0xcc)[_0x21ab('0x1b')]();})[_0x21ab('0x49')](handleError(_0x253774,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c407389..3445b5e 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 _0xba37=['SquareRecording','square_recordings','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x18a66f,_0x304cc4){var _0x145d10=function(_0x4e07c2){while(--_0x4e07c2){_0x18a66f['push'](_0x18a66f['shift']());}};_0x145d10(++_0x304cc4);}(_0xba37,0xb6));var _0x7ba3=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xba37[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x7ba3('0x0'));var util=require('util');var logger=require(_0x7ba3('0x1'))('api');var moment=require(_0x7ba3('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ba3('0x3'));var fs=require('fs');var path=require(_0x7ba3('0x4'));var rimraf=require(_0x7ba3('0x5'));var config=require(_0x7ba3('0x6'));var attributes=require(_0x7ba3('0x7'));module['exports']=function(_0x401c33,_0x47b38c){return _0x401c33['define'](_0x7ba3('0x8'),attributes,{'tableName':_0x7ba3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ace=['api','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger'];(function(_0x493f9c,_0x428966){var _0x1b32f6=function(_0x222c98){while(--_0x222c98){_0x493f9c['push'](_0x493f9c['shift']());}};_0x1b32f6(++_0x428966);}(_0x2ace,0x17e));var _0xe2ac=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2ace[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var moment=require('moment');var BPromise=require(_0xe2ac('0x3'));var rp=require(_0xe2ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var attributes=require(_0xe2ac('0x7'));module[_0xe2ac('0x8')]=function(_0x386b18,_0x46e9f3){return _0x386b18[_0xe2ac('0x9')](_0xe2ac('0xa'),attributes,{'tableName':_0xe2ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 275c1dd..6ab73a9 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 _0x1d0e=['code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x396b44,_0x53777a){var _0x170b96=function(_0x17e8eb){while(--_0x17e8eb){_0x396b44['push'](_0x396b44['shift']());}};_0x170b96(++_0x53777a);}(_0x1d0e,0x138));var _0xe1d0=function(_0x9d34b,_0x29fc8a){_0x9d34b=_0x9d34b-0x0;var _0x4f3df4=_0x1d0e[_0x9d34b];return _0x4f3df4;};'use strict';var _=require(_0xe1d0('0x0'));var util=require(_0xe1d0('0x1'));var moment=require(_0xe1d0('0x2'));var BPromise=require(_0xe1d0('0x3'));var rs=require(_0xe1d0('0x4'));var fs=require('fs');var Redis=require(_0xe1d0('0x5'));var db=require(_0xe1d0('0x6'))['db'];var utils=require(_0xe1d0('0x7'));var logger=require(_0xe1d0('0x8'))(_0xe1d0('0x9'));var config=require(_0xe1d0('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe1d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24644f,_0x398a4c,_0x13e0f9){return new BPromise(function(_0x375a56,_0x5708b3){return client['request'](_0x24644f,_0x13e0f9)[_0xe1d0('0xc')](function(_0x4ae456){logger[_0xe1d0('0xd')](_0xe1d0('0xe'),_0x398a4c,'request\x20sent');logger['debug'](_0xe1d0('0xf'),_0x398a4c,_0xe1d0('0x10'),JSON['stringify'](_0x4ae456));if(_0x4ae456[_0xe1d0('0x11')]){if(_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x12')]===0x1f4){logger[_0xe1d0('0x11')](_0xe1d0('0xe'),_0x398a4c,_0x4ae456[_0xe1d0('0x11')]['message']);return _0x5708b3(_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x13')]);}logger[_0xe1d0('0x11')](_0xe1d0('0xe'),_0x398a4c,_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x13')]);return _0x375a56(_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x13')]);}else{logger[_0xe1d0('0xd')](_0xe1d0('0xe'),_0x398a4c,_0xe1d0('0x10'));_0x375a56(_0x4ae456[_0xe1d0('0x14')][_0xe1d0('0x13')]);}})[_0xe1d0('0x15')](function(_0x3f3b3b){logger[_0xe1d0('0x11')](_0xe1d0('0xe'),_0x398a4c,_0x3f3b3b);_0x5708b3(_0x3f3b3b);});});}exports[_0xe1d0('0x16')]=function(_0x38ee4c){var _0x8774aa=this;return new Promise(function(_0x513981,_0x382e9f){return db[_0xe1d0('0x17')][_0xe1d0('0x18')](_0x38ee4c[_0xe1d0('0x19')],{'raw':_0x38ee4c[_0xe1d0('0x1a')]?_0x38ee4c[_0xe1d0('0x1a')][_0xe1d0('0x1b')]===undefined?!![]:![]:!![]})[_0xe1d0('0xc')](function(_0x328be4){logger[_0xe1d0('0xd')](_0xe1d0('0x16'),_0x38ee4c);logger[_0xe1d0('0x1c')](_0xe1d0('0x16'),_0x38ee4c,JSON[_0xe1d0('0x1d')](_0x328be4));_0x513981(_0x328be4);})[_0xe1d0('0x15')](function(_0x1fefe6){logger[_0xe1d0('0x11')]('CreateSquareRecording',_0x1fefe6[_0xe1d0('0x13')],_0x38ee4c);_0x382e9f(_0x8774aa['error'](0x1f4,_0x1fefe6['message']));});});}; \ No newline at end of file +var _0xfaec=['stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x5173b2,_0x2b2911){var _0x6be46f=function(_0x1d62c6){while(--_0x1d62c6){_0x5173b2['push'](_0x5173b2['shift']());}};_0x6be46f(++_0x2b2911);}(_0xfaec,0xc5));var _0xcfae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfaec[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xcfae('0x0'));var moment=require(_0xcfae('0x1'));var BPromise=require(_0xcfae('0x2'));var rs=require(_0xcfae('0x3'));var fs=require('fs');var Redis=require(_0xcfae('0x4'));var db=require(_0xcfae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfae('0x6'))(_0xcfae('0x7'));var config=require(_0xcfae('0x8'));var jayson=require(_0xcfae('0x9'));var client=jayson[_0xcfae('0xa')][_0xcfae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369bae,_0x18a107,_0x2fac66){return new BPromise(function(_0x4f15cb,_0x2b8a8d){return client[_0xcfae('0xc')](_0x369bae,_0x2fac66)[_0xcfae('0xd')](function(_0x25c828){logger[_0xcfae('0xe')](_0xcfae('0xf'),_0x18a107,_0xcfae('0x10'));logger[_0xcfae('0x11')](_0xcfae('0x12'),_0x18a107,_0xcfae('0x10'),JSON[_0xcfae('0x13')](_0x25c828));if(_0x25c828[_0xcfae('0x14')]){if(_0x25c828[_0xcfae('0x14')]['code']===0x1f4){logger[_0xcfae('0x14')]('SquareRecording,\x20%s,\x20%s',_0x18a107,_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);return _0x2b8a8d(_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);}logger[_0xcfae('0x14')]('SquareRecording,\x20%s,\x20%s',_0x18a107,_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);return _0x4f15cb(_0x25c828[_0xcfae('0x14')][_0xcfae('0x15')]);}else{logger[_0xcfae('0xe')](_0xcfae('0xf'),_0x18a107,'request\x20sent');_0x4f15cb(_0x25c828['result'][_0xcfae('0x15')]);}})[_0xcfae('0x16')](function(_0x43c9fd){logger[_0xcfae('0x14')](_0xcfae('0xf'),_0x18a107,_0x43c9fd);_0x2b8a8d(_0x43c9fd);});});}exports[_0xcfae('0x17')]=function(_0x2b5ff5){var _0x52bd32=this;return new Promise(function(_0x447c5b,_0x53f9d1){return db[_0xcfae('0x18')][_0xcfae('0x19')](_0x2b5ff5['body'],{'raw':_0x2b5ff5[_0xcfae('0x1a')]?_0x2b5ff5[_0xcfae('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d0463){logger['info'](_0xcfae('0x17'),_0x2b5ff5);logger[_0xcfae('0x11')](_0xcfae('0x17'),_0x2b5ff5,JSON['stringify'](_0x3d0463));_0x447c5b(_0x3d0463);})[_0xcfae('0x16')](function(_0x8f9c11){logger[_0xcfae('0x14')](_0xcfae('0x17'),_0x8f9c11[_0xcfae('0x15')],_0x2b5ff5);_0x53f9d1(_0x52bd32['error'](0x1f4,_0x8f9c11[_0xcfae('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e9f07d4..2de7aa4 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 _0xdb02=['update','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','put'];(function(_0x5e32e5,_0xaacbf5){var _0x35569b=function(_0x58b211){while(--_0x58b211){_0x5e32e5['push'](_0x5e32e5['shift']());}};_0x35569b(++_0xaacbf5);}(_0xdb02,0x102));var _0x2db0=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0xdb02[_0x54c10d];return _0x1fa703;};'use strict';var multer=require(_0x2db0('0x0'));var util=require(_0x2db0('0x1'));var path=require(_0x2db0('0x2'));var timeout=require(_0x2db0('0x3'));var express=require(_0x2db0('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2db0('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x2db0('0x6')](),controller['index']);router[_0x2db0('0x7')](_0x2db0('0x8'),auth['isAuthenticated'](),controller[_0x2db0('0x9')]);router[_0x2db0('0x7')](_0x2db0('0xa'),auth[_0x2db0('0x6')](),controller[_0x2db0('0xb')]);router[_0x2db0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2db0('0xd')](_0x2db0('0xa'),auth[_0x2db0('0x6')](),controller[_0x2db0('0xe')]);router['delete'](_0x2db0('0xa'),auth[_0x2db0('0x6')](),controller[_0x2db0('0xf')]);module[_0x2db0('0x10')]=router; \ No newline at end of file +var _0x7f2a=['get','/describe','describe','/:id','post','create','delete','exports','connect-timeout','express','Router','../../config/environment','isAuthenticated','index'];(function(_0x29aa84,_0x25a260){var _0x46cc12=function(_0x1a11f3){while(--_0x1a11f3){_0x29aa84['push'](_0x29aa84['shift']());}};_0x46cc12(++_0x25a260);}(_0x7f2a,0x120));var _0xa7f2=function(_0xb1162f,_0x5a6159){_0xb1162f=_0xb1162f-0x0;var _0xb16c3d=_0x7f2a[_0xb1162f];return _0xb16c3d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa7f2('0x0'));var express=require(_0xa7f2('0x1'));var router=express[_0xa7f2('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa7f2('0x3'));var controller=require('./squareReport.controller');router['get']('/',auth[_0xa7f2('0x4')](),controller[_0xa7f2('0x5')]);router[_0xa7f2('0x6')](_0xa7f2('0x7'),auth[_0xa7f2('0x4')](),controller[_0xa7f2('0x8')]);router[_0xa7f2('0x6')](_0xa7f2('0x9'),auth[_0xa7f2('0x4')](),controller['show']);router[_0xa7f2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa7f2('0xb')]);router['put'](_0xa7f2('0x9'),auth[_0xa7f2('0x4')](),controller['update']);router[_0xa7f2('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa7f2('0xd')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index dbf4d93..813925c 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 _0x63a2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63a2,0x131));var _0x263a=function(_0x43a1d8,_0xdb2471){_0x43a1d8=_0x43a1d8-0x0;var _0x464272=_0x63a2[_0x43a1d8];return _0x464272;};'use strict';var Sequelize=require(_0x263a('0x0'));module[_0x263a('0x1')]={'network':{'type':Sequelize[_0x263a('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x263a('0x2')]},'channel':{'type':Sequelize[_0x263a('0x2')]},'language':{'type':Sequelize[_0x263a('0x2')]},'type':{'type':Sequelize[_0x263a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x263a('0x2')]},'callingpres':{'type':Sequelize[_0x263a('0x2')]},'callingani2':{'type':Sequelize[_0x263a('0x2')]},'callington':{'type':Sequelize[_0x263a('0x2')]},'callingtns':{'type':Sequelize[_0x263a('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x263a('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x263a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x263a('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x263a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x263a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xefac=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xefac,0x7c));var _0xcefa=function(_0x14d969,_0x522c63){_0x14d969=_0x14d969-0x0;var _0x55d55c=_0xefac[_0x14d969];return _0x55d55c;};'use strict';var Sequelize=require(_0xcefa('0x0'));module[_0xcefa('0x1')]={'network':{'type':Sequelize[_0xcefa('0x2')]},'network_script':{'type':Sequelize[_0xcefa('0x2')]},'request':{'type':Sequelize[_0xcefa('0x2')]},'channel':{'type':Sequelize[_0xcefa('0x2')]},'language':{'type':Sequelize[_0xcefa('0x2')]},'type':{'type':Sequelize[_0xcefa('0x2')]},'uniqueid':{'type':Sequelize[_0xcefa('0x2')]},'version':{'type':Sequelize[_0xcefa('0x2')]},'callerid':{'type':Sequelize[_0xcefa('0x2')]},'calleridname':{'type':Sequelize[_0xcefa('0x2')]},'callingpres':{'type':Sequelize[_0xcefa('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xcefa('0x2')]},'dnid':{'type':Sequelize[_0xcefa('0x2')]},'rdnis':{'type':Sequelize[_0xcefa('0x2')]},'context':{'type':Sequelize[_0xcefa('0x2')]},'extension':{'type':Sequelize[_0xcefa('0x2')]},'priority':{'type':Sequelize[_0xcefa('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcefa('0x2')]},'threadid':{'type':Sequelize[_0xcefa('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcefa('0x3')]},'leaveAt':{'type':Sequelize[_0xcefa('0x3')]},'bot':{'type':Sequelize[_0xcefa('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 0b89ead..8f291c3 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 _0x87f1=['util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','SquareReport','count','includeAll','include','findAll','then','rows','catch','show','params','intersection','options','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x31fe44,_0x33271b){var _0x424745=function(_0x1e5b97){while(--_0x1e5b97){_0x31fe44['push'](_0x31fe44['shift']());}};_0x424745(++_0x33271b);}(_0x87f1,0x170));var _0x187f=function(_0x5e2f80,_0x2afd67){_0x5e2f80=_0x5e2f80-0x0;var _0x15d05e=_0x87f1[_0x5e2f80];return _0x15d05e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x187f('0x0'));var rimraf=require(_0x187f('0x1'));var zipdir=require(_0x187f('0x2'));var jsonpatch=require(_0x187f('0x3'));var rp=require(_0x187f('0x4'));var moment=require(_0x187f('0x5'));var BPromise=require(_0x187f('0x6'));var Mustache=require('mustache');var util=require(_0x187f('0x7'));var path=require('path');var sox=require(_0x187f('0x8'));var csv=require('to-csv');var ejs=require(_0x187f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x187f('0xa'));var crypto=require(_0x187f('0xb'));var jsforce=require(_0x187f('0xc'));var deskjs=require(_0x187f('0xd'));var toCsv=require(_0x187f('0xe'));var querystring=require(_0x187f('0xf'));var Papa=require('papaparse');var Redis=require(_0x187f('0x10'));var authService=require(_0x187f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x187f('0x12'));var logger=require(_0x187f('0x13'))(_0x187f('0x14'));var utils=require(_0x187f('0x15'));var config=require(_0x187f('0x16'));var licenseUtil=require(_0x187f('0x17'));var db=require(_0x187f('0x18'))['db'];function respondWithStatusCode(_0x1298f5,_0x7f7067){_0x7f7067=_0x7f7067||0xcc;return function(_0x83b3a0){if(_0x83b3a0){return _0x1298f5['sendStatus'](_0x7f7067);}return _0x1298f5['status'](_0x7f7067)[_0x187f('0x19')]();};}function respondWithResult(_0x176fae,_0x4683fd){_0x4683fd=_0x4683fd||0xc8;return function(_0x2eee87){if(_0x2eee87){return _0x176fae[_0x187f('0x1a')](_0x4683fd)[_0x187f('0x1b')](_0x2eee87);}};}function respondWithFilteredResult(_0xf3600,_0x557047){return function(_0x11c254){if(_0x11c254){var _0x4e232d=_0x11c254['count'],_0x508b69=_0x557047[_0x187f('0x1c')],_0x35d742=_0x557047['offset']+_0x557047['limit'],_0x1d7014;if(_0x35d742>=_0x4e232d){_0x35d742=_0x4e232d;_0x1d7014=0xc8;}else{_0x1d7014=0xce;}_0xf3600[_0x187f('0x1a')](_0x1d7014);return _0xf3600[_0x187f('0x1d')](_0x187f('0x1e'),_0x508b69+'-'+_0x35d742+'/'+_0x4e232d)[_0x187f('0x1b')](_0x11c254);}return null;};}function patchUpdates(_0x539e07){return function(_0x5ecdc0){try{jsonpatch[_0x187f('0x1f')](_0x5ecdc0,_0x539e07,!![]);}catch(_0x3763ed){return BPromise[_0x187f('0x20')](_0x3763ed);}return _0x5ecdc0['save']();};}function saveUpdates(_0x546c4c,_0x503101){return function(_0x1e2755){if(_0x1e2755){return _0x1e2755[_0x187f('0x21')](_0x546c4c)['then'](function(_0x445fe1){return _0x445fe1;});}return null;};}function removeEntity(_0xbc434c,_0x354453){return function(_0x4e069b){if(_0x4e069b){return _0x4e069b[_0x187f('0x22')]()['then'](function(){_0xbc434c[_0x187f('0x1a')](0xcc)[_0x187f('0x19')]();});}};}function handleEntityNotFound(_0x2a8299,_0x48730e){return function(_0x3cc4a6){if(!_0x3cc4a6){_0x2a8299[_0x187f('0x23')](0x194);}return _0x3cc4a6;};}function handleError(_0x178f48,_0x3e82c5){_0x3e82c5=_0x3e82c5||0x1f4;return function(_0x2b0e76){logger['error'](_0x2b0e76['stack']);if(_0x2b0e76[_0x187f('0x24')]){delete _0x2b0e76[_0x187f('0x24')];}_0x178f48[_0x187f('0x1a')](_0x3e82c5)[_0x187f('0x25')](_0x2b0e76);};}exports[_0x187f('0x26')]=function(_0xa04563,_0x250044){var _0x32378d={},_0x2fc179={},_0x5946be={'count':0x0,'rows':[]};var _0x17b3c3=_[_0x187f('0x27')](db['SquareReport'][_0x187f('0x28')],function(_0x3c00dd){return{'name':_0x3c00dd[_0x187f('0x29')],'type':_0x3c00dd[_0x187f('0x2a')][_0x187f('0x2b')]};});_0x2fc179['model']=_[_0x187f('0x27')](_0x17b3c3,_0x187f('0x24'));_0x2fc179['query']=_[_0x187f('0x2c')](_0xa04563[_0x187f('0x2d')]);_0x2fc179[_0x187f('0x2e')]=_['intersection'](_0x2fc179['model'],_0x2fc179[_0x187f('0x2d')]);_0x32378d[_0x187f('0x2f')]=_['intersection'](_0x2fc179['model'],qs[_0x187f('0x30')](_0xa04563[_0x187f('0x2d')][_0x187f('0x30')]));_0x32378d[_0x187f('0x2f')]=_0x32378d[_0x187f('0x2f')][_0x187f('0x31')]?_0x32378d[_0x187f('0x2f')]:_0x2fc179[_0x187f('0x32')];if(!_0xa04563[_0x187f('0x2d')][_0x187f('0x33')](_0x187f('0x34'))){_0x32378d[_0x187f('0x35')]=qs[_0x187f('0x35')](_0xa04563[_0x187f('0x2d')]['limit']);_0x32378d['offset']=qs[_0x187f('0x1c')](_0xa04563[_0x187f('0x2d')][_0x187f('0x1c')]);}_0x32378d[_0x187f('0x36')]=qs[_0x187f('0x37')](_0xa04563[_0x187f('0x2d')][_0x187f('0x37')]);_0x32378d['where']=qs['filters'](_[_0x187f('0x38')](_0xa04563[_0x187f('0x2d')],_0x2fc179['filters']),_0x17b3c3);if(_0xa04563[_0x187f('0x2d')][_0x187f('0x39')]){_0x32378d['where']=_[_0x187f('0x3a')](_0x32378d[_0x187f('0x3b')],{'$or':_[_0x187f('0x27')](_0x17b3c3,function(_0xb4e917){if(_0xb4e917[_0x187f('0x2a')]!==_0x187f('0x3c')){var _0x10e250={};_0x10e250[_0xb4e917['name']]={'$like':'%'+_0xa04563[_0x187f('0x2d')][_0x187f('0x39')]+'%'};return _0x10e250;}})});}_0x32378d=_[_0x187f('0x3a')]({},_0x32378d,_0xa04563['options']);var _0x392941={'where':_0x32378d[_0x187f('0x3b')]};return db[_0x187f('0x3d')][_0x187f('0x3e')](_0x392941)['then'](function(_0x41112c){_0x5946be[_0x187f('0x3e')]=_0x41112c;if(_0xa04563[_0x187f('0x2d')][_0x187f('0x3f')]){_0x32378d[_0x187f('0x40')]=[{'all':!![]}];}return db[_0x187f('0x3d')][_0x187f('0x41')](_0x32378d);})[_0x187f('0x42')](function(_0x246bda){_0x5946be[_0x187f('0x43')]=_0x246bda;return _0x5946be;})[_0x187f('0x42')](respondWithFilteredResult(_0x250044,_0x32378d))[_0x187f('0x44')](handleError(_0x250044,null));};exports[_0x187f('0x45')]=function(_0x13384a,_0xeb8193){var _0x16fe20={'raw':!![],'where':{'id':_0x13384a[_0x187f('0x46')]['id']}},_0x2d8d6={};_0x2d8d6[_0x187f('0x32')]=_[_0x187f('0x2c')](db[_0x187f('0x3d')][_0x187f('0x28')]);_0x2d8d6['query']=_[_0x187f('0x2c')](_0x13384a[_0x187f('0x2d')]);_0x2d8d6[_0x187f('0x2e')]=_[_0x187f('0x47')](_0x2d8d6['model'],_0x2d8d6['query']);_0x16fe20[_0x187f('0x2f')]=_['intersection'](_0x2d8d6[_0x187f('0x32')],qs[_0x187f('0x30')](_0x13384a[_0x187f('0x2d')][_0x187f('0x30')]));_0x16fe20['attributes']=_0x16fe20[_0x187f('0x2f')]['length']?_0x16fe20[_0x187f('0x2f')]:_0x2d8d6[_0x187f('0x32')];if(_0x13384a[_0x187f('0x2d')][_0x187f('0x3f')]){_0x16fe20[_0x187f('0x40')]=[{'all':!![]}];}_0x16fe20=_['merge']({},_0x16fe20,_0x13384a[_0x187f('0x48')]);return db[_0x187f('0x3d')]['find'](_0x16fe20)[_0x187f('0x42')](handleEntityNotFound(_0xeb8193,null))[_0x187f('0x42')](respondWithResult(_0xeb8193,null))['catch'](handleError(_0xeb8193,null));};exports['create']=function(_0x472e43,_0x1576c1){return db[_0x187f('0x3d')]['create'](_0x472e43[_0x187f('0x49')],{})[_0x187f('0x42')](respondWithResult(_0x1576c1,0xc9))[_0x187f('0x44')](handleError(_0x1576c1,null));};exports['update']=function(_0x47df81,_0x20111d){if(_0x47df81[_0x187f('0x49')]['id']){delete _0x47df81[_0x187f('0x49')]['id'];}return db[_0x187f('0x3d')][_0x187f('0x4a')]({'where':{'id':_0x47df81[_0x187f('0x46')]['id']}})[_0x187f('0x42')](handleEntityNotFound(_0x20111d,null))[_0x187f('0x42')](saveUpdates(_0x47df81[_0x187f('0x49')],null))[_0x187f('0x42')](respondWithResult(_0x20111d,null))[_0x187f('0x44')](handleError(_0x20111d,null));};exports['destroy']=function(_0x9908a3,_0x47ecbd){return db['SquareReport'][_0x187f('0x4a')]({'where':{'id':_0x9908a3[_0x187f('0x46')]['id']}})[_0x187f('0x42')](handleEntityNotFound(_0x47ecbd,null))[_0x187f('0x42')](removeEntity(_0x47ecbd,null))['catch'](handleError(_0x47ecbd,null));};exports['describe']=function(_0x510044,_0x21d4b4){return db[_0x187f('0x3d')]['describe']()[_0x187f('0x42')](respondWithResult(_0x21d4b4,null))[_0x187f('0x44')](handleError(_0x21d4b4,null));}; \ No newline at end of file +var _0x1a38=['filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','count','include','findAll','rows','catch','show','rawAttributes','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','fieldName','type','query','keys'];(function(_0x697afd,_0x2b09d8){var _0x167358=function(_0x41bdfe){while(--_0x41bdfe){_0x697afd['push'](_0x697afd['shift']());}};_0x167358(++_0x2b09d8);}(_0x1a38,0xb0));var _0x81a3=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x1a38[_0x474bc0];return _0x4b24cf;};'use strict';var pdf=require(_0x81a3('0x0'));var emlformat=require(_0x81a3('0x1'));var rimraf=require(_0x81a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x81a3('0x3'));var BPromise=require(_0x81a3('0x4'));var Mustache=require(_0x81a3('0x5'));var util=require(_0x81a3('0x6'));var path=require(_0x81a3('0x7'));var sox=require(_0x81a3('0x8'));var csv=require(_0x81a3('0x9'));var ejs=require(_0x81a3('0xa'));var fs=require('fs');var _=require(_0x81a3('0xb'));var squel=require(_0x81a3('0xc'));var crypto=require(_0x81a3('0xd'));var jsforce=require(_0x81a3('0xe'));var deskjs=require(_0x81a3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x81a3('0x10'));var Papa=require(_0x81a3('0x11'));var Redis=require(_0x81a3('0x12'));var authService=require(_0x81a3('0x13'));var qs=require(_0x81a3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81a3('0x15'));var logger=require(_0x81a3('0x16'))(_0x81a3('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x81a3('0x18'));var db=require(_0x81a3('0x19'))['db'];function respondWithStatusCode(_0x44ac21,_0x45004e){_0x45004e=_0x45004e||0xcc;return function(_0x199fa0){if(_0x199fa0){return _0x44ac21[_0x81a3('0x1a')](_0x45004e);}return _0x44ac21[_0x81a3('0x1b')](_0x45004e)[_0x81a3('0x1c')]();};}function respondWithResult(_0x3305a9,_0x17fa02){_0x17fa02=_0x17fa02||0xc8;return function(_0x2683f3){if(_0x2683f3){return _0x3305a9[_0x81a3('0x1b')](_0x17fa02)['json'](_0x2683f3);}};}function respondWithFilteredResult(_0x168cf1,_0x277e02){return function(_0x2c5a34){if(_0x2c5a34){var _0x2a0b2c=_0x2c5a34['count'],_0x4fe29c=_0x277e02[_0x81a3('0x1d')],_0x44da7e=_0x277e02['offset']+_0x277e02['limit'],_0x18fc8d;if(_0x44da7e>=_0x2a0b2c){_0x44da7e=_0x2a0b2c;_0x18fc8d=0xc8;}else{_0x18fc8d=0xce;}_0x168cf1[_0x81a3('0x1b')](_0x18fc8d);return _0x168cf1[_0x81a3('0x1e')](_0x81a3('0x1f'),_0x4fe29c+'-'+_0x44da7e+'/'+_0x2a0b2c)[_0x81a3('0x20')](_0x2c5a34);}return null;};}function patchUpdates(_0x1c3f9c){return function(_0x2aaa65){try{jsonpatch[_0x81a3('0x21')](_0x2aaa65,_0x1c3f9c,!![]);}catch(_0xbb1c60){return BPromise['reject'](_0xbb1c60);}return _0x2aaa65[_0x81a3('0x22')]();};}function saveUpdates(_0x324706,_0x4ef0c4){return function(_0x457bd0){if(_0x457bd0){return _0x457bd0[_0x81a3('0x23')](_0x324706)[_0x81a3('0x24')](function(_0x172afa){return _0x172afa;});}return null;};}function removeEntity(_0x58b63d,_0x316d48){return function(_0x3f15ca){if(_0x3f15ca){return _0x3f15ca[_0x81a3('0x25')]()['then'](function(){_0x58b63d['status'](0xcc)[_0x81a3('0x1c')]();});}};}function handleEntityNotFound(_0x328b0d,_0x19d2e1){return function(_0x40aaec){if(!_0x40aaec){_0x328b0d['sendStatus'](0x194);}return _0x40aaec;};}function handleError(_0x57dcca,_0x488a07){_0x488a07=_0x488a07||0x1f4;return function(_0x1583fd){logger[_0x81a3('0x26')](_0x1583fd[_0x81a3('0x27')]);if(_0x1583fd[_0x81a3('0x28')]){delete _0x1583fd[_0x81a3('0x28')];}_0x57dcca[_0x81a3('0x1b')](_0x488a07)[_0x81a3('0x29')](_0x1583fd);};}exports[_0x81a3('0x2a')]=function(_0x46a4d0,_0x1852e4){var _0x113863={},_0x3cfad2={},_0x52fcfc={'count':0x0,'rows':[]};var _0x40032e=_[_0x81a3('0x2b')](db[_0x81a3('0x2c')]['rawAttributes'],function(_0x4afd80){return{'name':_0x4afd80[_0x81a3('0x2d')],'type':_0x4afd80[_0x81a3('0x2e')]['key']};});_0x3cfad2['model']=_['map'](_0x40032e,_0x81a3('0x28'));_0x3cfad2[_0x81a3('0x2f')]=_[_0x81a3('0x30')](_0x46a4d0[_0x81a3('0x2f')]);_0x3cfad2[_0x81a3('0x31')]=_[_0x81a3('0x32')](_0x3cfad2['model'],_0x3cfad2[_0x81a3('0x2f')]);_0x113863['attributes']=_[_0x81a3('0x32')](_0x3cfad2[_0x81a3('0x33')],qs[_0x81a3('0x34')](_0x46a4d0[_0x81a3('0x2f')][_0x81a3('0x34')]));_0x113863[_0x81a3('0x35')]=_0x113863[_0x81a3('0x35')][_0x81a3('0x36')]?_0x113863[_0x81a3('0x35')]:_0x3cfad2['model'];if(!_0x46a4d0['query'][_0x81a3('0x37')]('nolimit')){_0x113863[_0x81a3('0x38')]=qs['limit'](_0x46a4d0['query'][_0x81a3('0x38')]);_0x113863[_0x81a3('0x1d')]=qs[_0x81a3('0x1d')](_0x46a4d0[_0x81a3('0x2f')]['offset']);}_0x113863[_0x81a3('0x39')]=qs[_0x81a3('0x3a')](_0x46a4d0[_0x81a3('0x2f')]['sort']);_0x113863[_0x81a3('0x3b')]=qs['filters'](_['pick'](_0x46a4d0['query'],_0x3cfad2[_0x81a3('0x31')]),_0x40032e);if(_0x46a4d0[_0x81a3('0x2f')]['filter']){_0x113863[_0x81a3('0x3b')]=_[_0x81a3('0x3c')](_0x113863[_0x81a3('0x3b')],{'$or':_['map'](_0x40032e,function(_0x503707){if(_0x503707[_0x81a3('0x2e')]!==_0x81a3('0x3d')){var _0x525e3b={};_0x525e3b[_0x503707[_0x81a3('0x28')]]={'$like':'%'+_0x46a4d0[_0x81a3('0x2f')]['filter']+'%'};return _0x525e3b;}})});}_0x113863=_[_0x81a3('0x3c')]({},_0x113863,_0x46a4d0['options']);var _0x53cf9f={'where':_0x113863['where']};return db[_0x81a3('0x2c')][_0x81a3('0x3e')](_0x53cf9f)[_0x81a3('0x24')](function(_0x1fe25c){_0x52fcfc[_0x81a3('0x3e')]=_0x1fe25c;if(_0x46a4d0[_0x81a3('0x2f')]['includeAll']){_0x113863[_0x81a3('0x3f')]=[{'all':!![]}];}return db[_0x81a3('0x2c')][_0x81a3('0x40')](_0x113863);})[_0x81a3('0x24')](function(_0x3ad129){_0x52fcfc[_0x81a3('0x41')]=_0x3ad129;return _0x52fcfc;})['then'](respondWithFilteredResult(_0x1852e4,_0x113863))[_0x81a3('0x42')](handleError(_0x1852e4,null));};exports[_0x81a3('0x43')]=function(_0x51315e,_0x45bc48){var _0x24fca3={'raw':!![],'where':{'id':_0x51315e['params']['id']}},_0x11551a={};_0x11551a[_0x81a3('0x33')]=_[_0x81a3('0x30')](db['SquareReport'][_0x81a3('0x44')]);_0x11551a[_0x81a3('0x2f')]=_[_0x81a3('0x30')](_0x51315e[_0x81a3('0x2f')]);_0x11551a[_0x81a3('0x31')]=_[_0x81a3('0x32')](_0x11551a[_0x81a3('0x33')],_0x11551a['query']);_0x24fca3['attributes']=_['intersection'](_0x11551a[_0x81a3('0x33')],qs[_0x81a3('0x34')](_0x51315e[_0x81a3('0x2f')]['fields']));_0x24fca3[_0x81a3('0x35')]=_0x24fca3[_0x81a3('0x35')]['length']?_0x24fca3[_0x81a3('0x35')]:_0x11551a[_0x81a3('0x33')];if(_0x51315e[_0x81a3('0x2f')]['includeAll']){_0x24fca3[_0x81a3('0x3f')]=[{'all':!![]}];}_0x24fca3=_['merge']({},_0x24fca3,_0x51315e[_0x81a3('0x45')]);return db[_0x81a3('0x2c')]['find'](_0x24fca3)['then'](handleEntityNotFound(_0x45bc48,null))[_0x81a3('0x24')](respondWithResult(_0x45bc48,null))[_0x81a3('0x42')](handleError(_0x45bc48,null));};exports['create']=function(_0xb7ce17,_0x32ed17){return db[_0x81a3('0x2c')][_0x81a3('0x46')](_0xb7ce17[_0x81a3('0x47')],{})[_0x81a3('0x24')](respondWithResult(_0x32ed17,0xc9))['catch'](handleError(_0x32ed17,null));};exports[_0x81a3('0x23')]=function(_0x48a1be,_0x496901){if(_0x48a1be[_0x81a3('0x47')]['id']){delete _0x48a1be['body']['id'];}return db[_0x81a3('0x2c')][_0x81a3('0x48')]({'where':{'id':_0x48a1be[_0x81a3('0x49')]['id']}})['then'](handleEntityNotFound(_0x496901,null))[_0x81a3('0x24')](saveUpdates(_0x48a1be[_0x81a3('0x47')],null))[_0x81a3('0x24')](respondWithResult(_0x496901,null))[_0x81a3('0x42')](handleError(_0x496901,null));};exports[_0x81a3('0x25')]=function(_0x35b792,_0x5b4a72){return db[_0x81a3('0x2c')][_0x81a3('0x48')]({'where':{'id':_0x35b792['params']['id']}})['then'](handleEntityNotFound(_0x5b4a72,null))[_0x81a3('0x24')](removeEntity(_0x5b4a72,null))[_0x81a3('0x42')](handleError(_0x5b4a72,null));};exports[_0x81a3('0x4a')]=function(_0x380932,_0x356dd4){return db[_0x81a3('0x2c')][_0x81a3('0x4a')]()[_0x81a3('0x24')](respondWithResult(_0x356dd4,null))[_0x81a3('0x42')](handleError(_0x356dd4,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index be49276..e49fc47 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 _0x306f=['rimraf','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2471e9,_0x192403){var _0x5f4ae1=function(_0x5227cc){while(--_0x5227cc){_0x2471e9['push'](_0x2471e9['shift']());}};_0x5f4ae1(++_0x192403);}(_0x306f,0x68));var _0xf306=function(_0x36075c,_0x3714c8){_0x36075c=_0x36075c-0x0;var _0x50bd75=_0x306f[_0x36075c];return _0x50bd75;};'use strict';var _=require(_0xf306('0x0'));var util=require(_0xf306('0x1'));var logger=require(_0xf306('0x2'))(_0xf306('0x3'));var moment=require(_0xf306('0x4'));var BPromise=require(_0xf306('0x5'));var rp=require(_0xf306('0x6'));var fs=require('fs');var path=require(_0xf306('0x7'));var rimraf=require(_0xf306('0x8'));var config=require('../../config/environment');var attributes=require(_0xf306('0x9'));module[_0xf306('0xa')]=function(_0x37905c,_0x14c8d0){return _0x37905c['define'](_0xf306('0xb'),attributes,{'tableName':_0xf306('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xf306('0xd'),_0xf306('0xe')]},{'name':_0xf306('0xf'),'fields':[_0xf306('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcec0=['leaveAt','lodash','util','../../config/logger','api','moment','bluebird','exports','define','report_square','uid_pname','uniqueid','project_name'];(function(_0xb2e5e0,_0x41e736){var _0x1cc01e=function(_0x1d3628){while(--_0x1d3628){_0xb2e5e0['push'](_0xb2e5e0['shift']());}};_0x1cc01e(++_0x41e736);}(_0xcec0,0x1bb));var _0x0cec=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xcec0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0cec('0x0'));var util=require(_0x0cec('0x1'));var logger=require(_0x0cec('0x2'))(_0x0cec('0x3'));var moment=require(_0x0cec('0x4'));var BPromise=require(_0x0cec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x0cec('0x6')]=function(_0x32e693,_0x126f30){return _0x32e693[_0x0cec('0x7')]('SquareReport',attributes,{'tableName':_0x0cec('0x8'),'paranoid':![],'indexes':[{'name':_0x0cec('0x9'),'fields':[_0x0cec('0xa'),_0x0cec('0xb')]},{'name':_0x0cec('0xc'),'fields':[_0x0cec('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4f3117b..78ff29d 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 _0x008c=['client','http','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareReport,\x20%s,\x20%s','message','catch','create','then','stringify','CreateSquareReport','SquareReport','options','raw','limit','UpdateSquareReport','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5c965e,_0x2556b7){var _0x1e1e49=function(_0x4b717c){while(--_0x4b717c){_0x5c965e['push'](_0x5c965e['shift']());}};_0x1e1e49(++_0x2556b7);}(_0x008c,0x188));var _0xc008=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x008c[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['CreateSquareReport']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareReport'][_0xc008('0x15')](_0x540e45['body'],{'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![]})[_0xc008('0x16')](function(_0x4b9726){logger['info']('CreateSquareReport',_0x540e45);logger['debug']('CreateSquareReport',_0x540e45,JSON[_0xc008('0x17')](_0x4b9726));_0x46042b(_0x4b9726);})[_0xc008('0x14')](function(_0x251db2){logger[_0xc008('0x10')](_0xc008('0x18'),_0x251db2[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668['error'](0x1f4,_0x251db2[_0xc008('0x13')]));});});};exports['UpdateSquareReport']=function(_0x58a6ea){var _0x218599=this;return new Promise(function(_0x36f358,_0x2e3cfb){return db[_0xc008('0x19')]['update'](_0x58a6ea['body'],{'raw':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a6ea[_0xc008('0x1a')]?_0x58a6ea[_0xc008('0x1a')]['where']||null:null,'attributes':_0x58a6ea['options']?_0x58a6ea['options']['attributes']||null:null,'limit':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1c')]||null:null})[_0xc008('0x16')](function(_0x529961){logger[_0xc008('0xd')](_0xc008('0x1d'),_0x58a6ea);logger[_0xc008('0x1e')](_0xc008('0x1d'),_0x58a6ea,JSON['stringify'](_0x529961));_0x36f358(_0x529961);})[_0xc008('0x14')](function(_0x2e0b4e){logger['error']('UpdateSquareReport',_0x2e0b4e['message'],_0x58a6ea);_0x2e3cfb(_0x218599[_0xc008('0x10')](0x1f4,_0x2e0b4e[_0xc008('0x13')]));});});}; \ No newline at end of file +var _0x31f0=['attributes','limit','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','then','UpdateSquareReport'];(function(_0x36a36c,_0x2dfc5a){var _0x110321=function(_0x334a22){while(--_0x334a22){_0x36a36c['push'](_0x36a36c['shift']());}};_0x110321(++_0x2dfc5a);}(_0x31f0,0xb7));var _0x031f=function(_0x5de495,_0x2a4df0){_0x5de495=_0x5de495-0x0;var _0xcfe56f=_0x31f0[_0x5de495];return _0xcfe56f;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('SquareReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});}exports[_0x031f('0x13')]=function(_0x535e70){var _0x421f75=this;return new Promise(function(_0x5f2199,_0x563bc8){return db[_0x031f('0x14')][_0x031f('0x15')](_0x535e70[_0x031f('0x16')],{'raw':_0x535e70[_0x031f('0x17')]?_0x535e70[_0x031f('0x17')][_0x031f('0x18')]===undefined?!![]:![]:!![]})[_0x031f('0x19')](function(_0x29dd6e){logger['info'](_0x031f('0x13'),_0x535e70);logger[_0x031f('0xc')](_0x031f('0x13'),_0x535e70,JSON['stringify'](_0x29dd6e));_0x5f2199(_0x29dd6e);})['catch'](function(_0xa11a2b){logger['error'](_0x031f('0x13'),_0xa11a2b['message'],_0x535e70);_0x563bc8(_0x421f75['error'](0x1f4,_0xa11a2b['message']));});});};exports[_0x031f('0x1a')]=function(_0x12c406){var _0x2920cd=this;return new Promise(function(_0x4c8126,_0x494568){return db[_0x031f('0x14')]['update'](_0x12c406[_0x031f('0x16')],{'raw':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')]['where']||null:null,'attributes':_0x12c406[_0x031f('0x17')]?_0x12c406[_0x031f('0x17')][_0x031f('0x1b')]||null:null,'limit':_0x12c406['options']?_0x12c406[_0x031f('0x17')][_0x031f('0x1c')]||null:null})[_0x031f('0x19')](function(_0xaf5bea){logger[_0x031f('0x9')](_0x031f('0x1a'),_0x12c406);logger['debug'](_0x031f('0x1a'),_0x12c406,JSON[_0x031f('0xe')](_0xaf5bea));_0x4c8126(_0xaf5bea);})[_0x031f('0x1d')](function(_0x2ea861){logger[_0x031f('0xf')](_0x031f('0x1a'),_0x2ea861[_0x031f('0x11')],_0x12c406);_0x494568(_0x2920cd[_0x031f('0xf')](0x1f4,_0x2ea861[_0x031f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d348041..d7e5d90 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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x814b,0x1a2));var _0xb814=function(_0x3cb21e,_0x11849a){_0x3cb21e=_0x3cb21e-0x0;var _0xeacd6a=_0x814b[_0x3cb21e];return _0xeacd6a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x2a84ef,_0x2e57bc){var _0x23143d=function(_0x4df86a){while(--_0x4df86a){_0x2a84ef['push'](_0x2a84ef['shift']());}};_0x23143d(++_0x2e57bc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12d121,_0x1ef59d){_0x12d121=_0x12d121-0x0;var _0x1af836=_0x5f2f[_0x12d121];return _0x1af836;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index ea57490..dc30ece 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 _0xcb8d=['exports','STRING','TEXT'];(function(_0xf1d61f,_0x39d009){var _0x1892d7=function(_0x4d032f){while(--_0x4d032f){_0xf1d61f['push'](_0xf1d61f['shift']());}};_0x1892d7(++_0x39d009);}(_0xcb8d,0xd5));var _0xdcb8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcb8d[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0xdcb8('0x0')]={'uniqueid':{'type':Sequelize[_0xdcb8('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xdcb8('0x1')]},'data':{'type':Sequelize[_0xdcb8('0x2')]},'project_name':{'type':Sequelize[_0xdcb8('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1861=['exports','STRING','sequelize'];(function(_0x209acb,_0x51399f){var _0x45ab6a=function(_0x3a6a99){while(--_0x3a6a99){_0x209acb['push'](_0x209acb['shift']());}};_0x45ab6a(++_0x51399f);}(_0x1861,0xe0));var _0x1186=function(_0x3aed1e,_0x154b6a){_0x3aed1e=_0x3aed1e-0x0;var _0x25a6f0=_0x1861[_0x3aed1e];return _0x25a6f0;};'use strict';var Sequelize=require(_0x1186('0x0'));module[_0x1186('0x1')]={'uniqueid':{'type':Sequelize[_0x1186('0x2')]},'node':{'type':Sequelize[_0x1186('0x2')]},'application':{'type':Sequelize[_0x1186('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1186('0x2')]},'callerid':{'type':Sequelize[_0x1186('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f804f1a..e82075a 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 _0xbbcd=['options','then','includeAll','include','catch','show','filters','length','find','create','body','update','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','sendStatus','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x444962,_0x931e2d){var _0x429b11=function(_0x30eaf1){while(--_0x30eaf1){_0x444962['push'](_0x444962['shift']());}};_0x429b11(++_0x931e2d);}(_0xbbcd,0xa1));var _0xdbbc=function(_0x43ac14,_0x3415a4){_0x43ac14=_0x43ac14-0x0;var _0x35adb8=_0xbbcd[_0x43ac14];return _0x35adb8;};'use strict';var pdf=require(_0xdbbc('0x0'));var emlformat=require(_0xdbbc('0x1'));var rimraf=require(_0xdbbc('0x2'));var zipdir=require(_0xdbbc('0x3'));var jsonpatch=require(_0xdbbc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbbc('0x5'));var Mustache=require(_0xdbbc('0x6'));var util=require('util');var path=require(_0xdbbc('0x7'));var sox=require(_0xdbbc('0x8'));var csv=require(_0xdbbc('0x9'));var ejs=require(_0xdbbc('0xa'));var fs=require('fs');var _=require(_0xdbbc('0xb'));var squel=require(_0xdbbc('0xc'));var crypto=require(_0xdbbc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdbbc('0x9'));var querystring=require(_0xdbbc('0xe'));var Papa=require(_0xdbbc('0xf'));var Redis=require(_0xdbbc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdbbc('0x11'));var as=require(_0xdbbc('0x12'));var hardwareService=require(_0xdbbc('0x13'));var logger=require(_0xdbbc('0x14'))(_0xdbbc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdbbc('0x16'));var db=require(_0xdbbc('0x17'))['db'];function respondWithStatusCode(_0x149a4c,_0x12fa32){_0x12fa32=_0x12fa32||0xcc;return function(_0x2e768d){if(_0x2e768d){return _0x149a4c['sendStatus'](_0x12fa32);}return _0x149a4c['status'](_0x12fa32)[_0xdbbc('0x18')]();};}function respondWithResult(_0x566466,_0x49b987){_0x49b987=_0x49b987||0xc8;return function(_0x5f3b15){if(_0x5f3b15){return _0x566466[_0xdbbc('0x19')](_0x49b987)[_0xdbbc('0x1a')](_0x5f3b15);}};}function respondWithFilteredResult(_0x206b68,_0x1ee62a){return function(_0x3cbcce){if(_0x3cbcce){var _0x333cb0=_0x3cbcce[_0xdbbc('0x1b')],_0x4cf30a=_0x1ee62a[_0xdbbc('0x1c')],_0x6bdbf4=_0x1ee62a['offset']+_0x1ee62a[_0xdbbc('0x1d')],_0x21d037;if(_0x6bdbf4>=_0x333cb0){_0x6bdbf4=_0x333cb0;_0x21d037=0xc8;}else{_0x21d037=0xce;}_0x206b68[_0xdbbc('0x19')](_0x21d037);return _0x206b68[_0xdbbc('0x1e')]('Content-Range',_0x4cf30a+'-'+_0x6bdbf4+'/'+_0x333cb0)[_0xdbbc('0x1a')](_0x3cbcce);}return null;};}function patchUpdates(_0x2d8302){return function(_0x48a874){try{jsonpatch[_0xdbbc('0x1f')](_0x48a874,_0x2d8302,!![]);}catch(_0x30d469){return BPromise[_0xdbbc('0x20')](_0x30d469);}return _0x48a874['save']();};}function saveUpdates(_0x88f9f7,_0x5cbda8){return function(_0x19cdd0){if(_0x19cdd0){return _0x19cdd0['update'](_0x88f9f7)['then'](function(_0x483cb7){return _0x483cb7;});}return null;};}function removeEntity(_0x13b23e,_0x80eee4){return function(_0x318a8c){if(_0x318a8c){return _0x318a8c['destroy']()['then'](function(){_0x13b23e[_0xdbbc('0x19')](0xcc)[_0xdbbc('0x18')]();});}};}function handleEntityNotFound(_0x45a839,_0x294feb){return function(_0x32068a){if(!_0x32068a){_0x45a839[_0xdbbc('0x21')](0x194);}return _0x32068a;};}function handleError(_0x5cc868,_0x423285){_0x423285=_0x423285||0x1f4;return function(_0x3ef7bd){logger[_0xdbbc('0x22')](_0x3ef7bd['stack']);if(_0x3ef7bd[_0xdbbc('0x23')]){delete _0x3ef7bd[_0xdbbc('0x23')];}_0x5cc868[_0xdbbc('0x19')](_0x423285)[_0xdbbc('0x24')](_0x3ef7bd);};}exports[_0xdbbc('0x25')]=function(_0x4a0241,_0x2f9818){var _0x593573={},_0x448800={},_0x5c1854={'count':0x0,'rows':[]};var _0x1c1386=_[_0xdbbc('0x26')](db[_0xdbbc('0x27')][_0xdbbc('0x28')],function(_0x9cf5db){return{'name':_0x9cf5db[_0xdbbc('0x29')],'type':_0x9cf5db[_0xdbbc('0x2a')]['key']};});_0x448800['model']=_[_0xdbbc('0x26')](_0x1c1386,_0xdbbc('0x23'));_0x448800['query']=_[_0xdbbc('0x2b')](_0x4a0241[_0xdbbc('0x2c')]);_0x448800['filters']=_[_0xdbbc('0x2d')](_0x448800[_0xdbbc('0x2e')],_0x448800[_0xdbbc('0x2c')]);_0x593573[_0xdbbc('0x2f')]=_[_0xdbbc('0x2d')](_0x448800[_0xdbbc('0x2e')],qs[_0xdbbc('0x30')](_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x30')]));_0x593573[_0xdbbc('0x2f')]=_0x593573['attributes']['length']?_0x593573['attributes']:_0x448800[_0xdbbc('0x2e')];if(!_0x4a0241['query'][_0xdbbc('0x31')](_0xdbbc('0x32'))){_0x593573['limit']=qs[_0xdbbc('0x1d')](_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x1d')]);_0x593573[_0xdbbc('0x1c')]=qs['offset'](_0x4a0241['query'][_0xdbbc('0x1c')]);}_0x593573[_0xdbbc('0x33')]=qs[_0xdbbc('0x34')](_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x34')]);_0x593573[_0xdbbc('0x35')]=qs['filters'](_[_0xdbbc('0x36')](_0x4a0241[_0xdbbc('0x2c')],_0x448800['filters']),_0x1c1386);if(_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x37')]){_0x593573[_0xdbbc('0x35')]=_[_0xdbbc('0x38')](_0x593573[_0xdbbc('0x35')],{'$or':_[_0xdbbc('0x26')](_0x1c1386,function(_0x20c1e1){if(_0x20c1e1[_0xdbbc('0x2a')]!==_0xdbbc('0x39')){var _0x24bcab={};_0x24bcab[_0x20c1e1[_0xdbbc('0x23')]]={'$like':'%'+_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x37')]+'%'};return _0x24bcab;}})});}_0x593573=_[_0xdbbc('0x38')]({},_0x593573,_0x4a0241[_0xdbbc('0x3a')]);var _0x1ea11d={'where':_0x593573[_0xdbbc('0x35')]};return db[_0xdbbc('0x27')][_0xdbbc('0x1b')](_0x1ea11d)[_0xdbbc('0x3b')](function(_0x523c78){_0x5c1854['count']=_0x523c78;if(_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x3c')]){_0x593573[_0xdbbc('0x3d')]=[{'all':!![]}];}return db[_0xdbbc('0x27')]['findAll'](_0x593573);})[_0xdbbc('0x3b')](function(_0x21fcbb){_0x5c1854['rows']=_0x21fcbb;return _0x5c1854;})[_0xdbbc('0x3b')](respondWithFilteredResult(_0x2f9818,_0x593573))[_0xdbbc('0x3e')](handleError(_0x2f9818,null));};exports[_0xdbbc('0x3f')]=function(_0x1ed817,_0x3d4fb3){var _0x27c799={'raw':!![],'where':{'id':_0x1ed817['params']['id']}},_0x10e70c={};_0x10e70c['model']=_['keys'](db[_0xdbbc('0x27')][_0xdbbc('0x28')]);_0x10e70c[_0xdbbc('0x2c')]=_['keys'](_0x1ed817[_0xdbbc('0x2c')]);_0x10e70c[_0xdbbc('0x40')]=_['intersection'](_0x10e70c[_0xdbbc('0x2e')],_0x10e70c['query']);_0x27c799[_0xdbbc('0x2f')]=_[_0xdbbc('0x2d')](_0x10e70c[_0xdbbc('0x2e')],qs[_0xdbbc('0x30')](_0x1ed817['query'][_0xdbbc('0x30')]));_0x27c799['attributes']=_0x27c799[_0xdbbc('0x2f')][_0xdbbc('0x41')]?_0x27c799['attributes']:_0x10e70c[_0xdbbc('0x2e')];if(_0x1ed817[_0xdbbc('0x2c')][_0xdbbc('0x3c')]){_0x27c799[_0xdbbc('0x3d')]=[{'all':!![]}];}_0x27c799=_[_0xdbbc('0x38')]({},_0x27c799,_0x1ed817[_0xdbbc('0x3a')]);return db[_0xdbbc('0x27')][_0xdbbc('0x42')](_0x27c799)[_0xdbbc('0x3b')](handleEntityNotFound(_0x3d4fb3,null))[_0xdbbc('0x3b')](respondWithResult(_0x3d4fb3,null))[_0xdbbc('0x3e')](handleError(_0x3d4fb3,null));};exports['create']=function(_0x40f0be,_0x4dbc3f){return db[_0xdbbc('0x27')][_0xdbbc('0x43')](_0x40f0be[_0xdbbc('0x44')],{})['then'](respondWithResult(_0x4dbc3f,0xc9))[_0xdbbc('0x3e')](handleError(_0x4dbc3f,null));};exports[_0xdbbc('0x45')]=function(_0x45b1ad,_0x5db855){if(_0x45b1ad[_0xdbbc('0x44')]['id']){delete _0x45b1ad['body']['id'];}return db[_0xdbbc('0x27')][_0xdbbc('0x42')]({'where':{'id':_0x45b1ad[_0xdbbc('0x46')]['id']}})[_0xdbbc('0x3b')](handleEntityNotFound(_0x5db855,null))[_0xdbbc('0x3b')](saveUpdates(_0x45b1ad[_0xdbbc('0x44')],null))[_0xdbbc('0x3b')](respondWithResult(_0x5db855,null))['catch'](handleError(_0x5db855,null));};exports[_0xdbbc('0x47')]=function(_0x1763b2,_0x47ccc9){return db[_0xdbbc('0x27')][_0xdbbc('0x42')]({'where':{'id':_0x1763b2['params']['id']}})['then'](handleEntityNotFound(_0x47ccc9,null))[_0xdbbc('0x3b')](removeEntity(_0x47ccc9,null))['catch'](handleError(_0x47ccc9,null));};exports['describe']=function(_0xb6f8b,_0x3de18f){return db[_0xdbbc('0x27')][_0xdbbc('0x48')]()[_0xdbbc('0x3b')](respondWithResult(_0x3de18f,null))['catch'](handleError(_0x3de18f,null));}; \ No newline at end of file +var _0x5b92=['fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','index','map','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','SquareDetailsReport','catch','show','params','rawAttributes','includeAll','include','create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x3812e7,_0x33da43){var _0x4d70d9=function(_0x5d2784){while(--_0x5d2784){_0x3812e7['push'](_0x3812e7['shift']());}};_0x4d70d9(++_0x33da43);}(_0x5b92,0x1a0));var _0x25b9=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x5b92[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x25b9('0x0'));var emlformat=require(_0x25b9('0x1'));var rimraf=require(_0x25b9('0x2'));var zipdir=require(_0x25b9('0x3'));var jsonpatch=require(_0x25b9('0x4'));var rp=require('request-promise');var moment=require(_0x25b9('0x5'));var BPromise=require(_0x25b9('0x6'));var Mustache=require('mustache');var util=require(_0x25b9('0x7'));var path=require(_0x25b9('0x8'));var sox=require('sox');var csv=require(_0x25b9('0x9'));var ejs=require(_0x25b9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25b9('0xb'));var crypto=require(_0x25b9('0xc'));var jsforce=require(_0x25b9('0xd'));var deskjs=require(_0x25b9('0xe'));var toCsv=require(_0x25b9('0x9'));var querystring=require(_0x25b9('0xf'));var Papa=require('papaparse');var Redis=require(_0x25b9('0x10'));var authService=require(_0x25b9('0x11'));var qs=require(_0x25b9('0x12'));var as=require(_0x25b9('0x13'));var hardwareService=require(_0x25b9('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x25b9('0x15'));var config=require(_0x25b9('0x16'));var licenseUtil=require(_0x25b9('0x17'));var db=require(_0x25b9('0x18'))['db'];function respondWithStatusCode(_0x158b60,_0x294991){_0x294991=_0x294991||0xcc;return function(_0x3e3655){if(_0x3e3655){return _0x158b60['sendStatus'](_0x294991);}return _0x158b60[_0x25b9('0x19')](_0x294991)[_0x25b9('0x1a')]();};}function respondWithResult(_0x4b1083,_0x4871ba){_0x4871ba=_0x4871ba||0xc8;return function(_0x1666e7){if(_0x1666e7){return _0x4b1083['status'](_0x4871ba)['json'](_0x1666e7);}};}function respondWithFilteredResult(_0x3ca9fe,_0x3876b3){return function(_0x45b41b){if(_0x45b41b){var _0x26758d=_0x45b41b[_0x25b9('0x1b')],_0x3f4f4e=_0x3876b3[_0x25b9('0x1c')],_0x246d99=_0x3876b3[_0x25b9('0x1c')]+_0x3876b3[_0x25b9('0x1d')],_0x2ac891;if(_0x246d99>=_0x26758d){_0x246d99=_0x26758d;_0x2ac891=0xc8;}else{_0x2ac891=0xce;}_0x3ca9fe[_0x25b9('0x19')](_0x2ac891);return _0x3ca9fe[_0x25b9('0x1e')](_0x25b9('0x1f'),_0x3f4f4e+'-'+_0x246d99+'/'+_0x26758d)['json'](_0x45b41b);}return null;};}function patchUpdates(_0x4d35c2){return function(_0xc5a9f6){try{jsonpatch[_0x25b9('0x20')](_0xc5a9f6,_0x4d35c2,!![]);}catch(_0x5f098c){return BPromise[_0x25b9('0x21')](_0x5f098c);}return _0xc5a9f6[_0x25b9('0x22')]();};}function saveUpdates(_0x3a2b86,_0x5e3058){return function(_0x57e012){if(_0x57e012){return _0x57e012['update'](_0x3a2b86)['then'](function(_0x47fba3){return _0x47fba3;});}return null;};}function removeEntity(_0x4a7449,_0x349140){return function(_0x37e65f){if(_0x37e65f){return _0x37e65f[_0x25b9('0x23')]()[_0x25b9('0x24')](function(){_0x4a7449[_0x25b9('0x19')](0xcc)[_0x25b9('0x1a')]();});}};}function handleEntityNotFound(_0x46b3d1,_0x136c17){return function(_0x326ea6){if(!_0x326ea6){_0x46b3d1[_0x25b9('0x25')](0x194);}return _0x326ea6;};}function handleError(_0x35a76c,_0x126aca){_0x126aca=_0x126aca||0x1f4;return function(_0x326000){logger[_0x25b9('0x26')](_0x326000[_0x25b9('0x27')]);if(_0x326000[_0x25b9('0x28')]){delete _0x326000[_0x25b9('0x28')];}_0x35a76c[_0x25b9('0x19')](_0x126aca)['send'](_0x326000);};}exports[_0x25b9('0x29')]=function(_0x407eae,_0x787544){var _0xbff519={},_0x3af628={},_0x222470={'count':0x0,'rows':[]};var _0x35b540=_[_0x25b9('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x1ba165){return{'name':_0x1ba165['fieldName'],'type':_0x1ba165['type']['key']};});_0x3af628[_0x25b9('0x2b')]=_[_0x25b9('0x2a')](_0x35b540,_0x25b9('0x28'));_0x3af628[_0x25b9('0x2c')]=_[_0x25b9('0x2d')](_0x407eae['query']);_0x3af628[_0x25b9('0x2e')]=_[_0x25b9('0x2f')](_0x3af628[_0x25b9('0x2b')],_0x3af628[_0x25b9('0x2c')]);_0xbff519[_0x25b9('0x30')]=_[_0x25b9('0x2f')](_0x3af628[_0x25b9('0x2b')],qs[_0x25b9('0x31')](_0x407eae[_0x25b9('0x2c')][_0x25b9('0x31')]));_0xbff519['attributes']=_0xbff519['attributes'][_0x25b9('0x32')]?_0xbff519[_0x25b9('0x30')]:_0x3af628['model'];if(!_0x407eae[_0x25b9('0x2c')][_0x25b9('0x33')](_0x25b9('0x34'))){_0xbff519['limit']=qs['limit'](_0x407eae['query'][_0x25b9('0x1d')]);_0xbff519[_0x25b9('0x1c')]=qs[_0x25b9('0x1c')](_0x407eae[_0x25b9('0x2c')][_0x25b9('0x1c')]);}_0xbff519[_0x25b9('0x35')]=qs['sort'](_0x407eae[_0x25b9('0x2c')]['sort']);_0xbff519[_0x25b9('0x36')]=qs['filters'](_['pick'](_0x407eae[_0x25b9('0x2c')],_0x3af628[_0x25b9('0x2e')]),_0x35b540);if(_0x407eae[_0x25b9('0x2c')][_0x25b9('0x37')]){_0xbff519[_0x25b9('0x36')]=_[_0x25b9('0x38')](_0xbff519[_0x25b9('0x36')],{'$or':_[_0x25b9('0x2a')](_0x35b540,function(_0x182765){if(_0x182765[_0x25b9('0x39')]!=='VIRTUAL'){var _0x2fd300={};_0x2fd300[_0x182765[_0x25b9('0x28')]]={'$like':'%'+_0x407eae[_0x25b9('0x2c')]['filter']+'%'};return _0x2fd300;}})});}_0xbff519=_[_0x25b9('0x38')]({},_0xbff519,_0x407eae['options']);var _0x214c88={'where':_0xbff519[_0x25b9('0x36')]};return db['SquareDetailsReport']['count'](_0x214c88)[_0x25b9('0x24')](function(_0x359153){_0x222470[_0x25b9('0x1b')]=_0x359153;if(_0x407eae[_0x25b9('0x2c')]['includeAll']){_0xbff519['include']=[{'all':!![]}];}return db[_0x25b9('0x3a')]['findAll'](_0xbff519);})[_0x25b9('0x24')](function(_0x3cc3bc){_0x222470['rows']=_0x3cc3bc;return _0x222470;})[_0x25b9('0x24')](respondWithFilteredResult(_0x787544,_0xbff519))[_0x25b9('0x3b')](handleError(_0x787544,null));};exports[_0x25b9('0x3c')]=function(_0x4644d3,_0xc80da4){var _0x1f2fd8={'raw':!![],'where':{'id':_0x4644d3[_0x25b9('0x3d')]['id']}},_0x2dce4f={};_0x2dce4f[_0x25b9('0x2b')]=_[_0x25b9('0x2d')](db['SquareDetailsReport'][_0x25b9('0x3e')]);_0x2dce4f[_0x25b9('0x2c')]=_[_0x25b9('0x2d')](_0x4644d3[_0x25b9('0x2c')]);_0x2dce4f['filters']=_[_0x25b9('0x2f')](_0x2dce4f[_0x25b9('0x2b')],_0x2dce4f[_0x25b9('0x2c')]);_0x1f2fd8[_0x25b9('0x30')]=_[_0x25b9('0x2f')](_0x2dce4f[_0x25b9('0x2b')],qs[_0x25b9('0x31')](_0x4644d3['query'][_0x25b9('0x31')]));_0x1f2fd8[_0x25b9('0x30')]=_0x1f2fd8[_0x25b9('0x30')]['length']?_0x1f2fd8[_0x25b9('0x30')]:_0x2dce4f['model'];if(_0x4644d3[_0x25b9('0x2c')][_0x25b9('0x3f')]){_0x1f2fd8[_0x25b9('0x40')]=[{'all':!![]}];}_0x1f2fd8=_['merge']({},_0x1f2fd8,_0x4644d3['options']);return db[_0x25b9('0x3a')]['find'](_0x1f2fd8)['then'](handleEntityNotFound(_0xc80da4,null))[_0x25b9('0x24')](respondWithResult(_0xc80da4,null))[_0x25b9('0x3b')](handleError(_0xc80da4,null));};exports[_0x25b9('0x41')]=function(_0x11937f,_0x4328dc){return db[_0x25b9('0x3a')][_0x25b9('0x41')](_0x11937f['body'],{})['then'](respondWithResult(_0x4328dc,0xc9))[_0x25b9('0x3b')](handleError(_0x4328dc,null));};exports[_0x25b9('0x42')]=function(_0x36d484,_0x592361){if(_0x36d484[_0x25b9('0x43')]['id']){delete _0x36d484['body']['id'];}return db[_0x25b9('0x3a')][_0x25b9('0x44')]({'where':{'id':_0x36d484[_0x25b9('0x3d')]['id']}})[_0x25b9('0x24')](handleEntityNotFound(_0x592361,null))['then'](saveUpdates(_0x36d484[_0x25b9('0x43')],null))[_0x25b9('0x24')](respondWithResult(_0x592361,null))[_0x25b9('0x3b')](handleError(_0x592361,null));};exports[_0x25b9('0x23')]=function(_0x3af9bb,_0x11b5fe){return db[_0x25b9('0x3a')][_0x25b9('0x44')]({'where':{'id':_0x3af9bb[_0x25b9('0x3d')]['id']}})[_0x25b9('0x24')](handleEntityNotFound(_0x11b5fe,null))['then'](removeEntity(_0x11b5fe,null))['catch'](handleError(_0x11b5fe,null));};exports[_0x25b9('0x45')]=function(_0x183603,_0x1899ba){return db[_0x25b9('0x3a')][_0x25b9('0x45')]()[_0x25b9('0x24')](respondWithResult(_0x1899ba,null))[_0x25b9('0x3b')](handleError(_0x1899ba,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ad652b4..0438508 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 _0xa612=['bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','SquareDetailsReport','lodash','util','../../config/logger','api','moment'];(function(_0x4498ac,_0x30e301){var _0x4bf1b6=function(_0x117f33){while(--_0x117f33){_0x4498ac['push'](_0x4498ac['shift']());}};_0x4bf1b6(++_0x30e301);}(_0xa612,0x187));var _0x2a61=function(_0x5710a0,_0x3e13f1){_0x5710a0=_0x5710a0-0x0;var _0x3ec2ac=_0xa612[_0x5710a0];return _0x3ec2ac;};'use strict';var _=require(_0x2a61('0x0'));var util=require(_0x2a61('0x1'));var logger=require(_0x2a61('0x2'))(_0x2a61('0x3'));var moment=require(_0x2a61('0x4'));var BPromise=require(_0x2a61('0x5'));var rp=require(_0x2a61('0x6'));var fs=require('fs');var path=require(_0x2a61('0x7'));var rimraf=require(_0x2a61('0x8'));var config=require('../../config/environment');var attributes=require(_0x2a61('0x9'));module['exports']=function(_0x132413,_0x5e2ea9){return _0x132413['define'](_0x2a61('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7198=['moment','request-promise','path','rimraf','../../config/environment','define','SquareDetailsReport','util','api'];(function(_0x646625,_0x4b7e5f){var _0x1a067c=function(_0x3323d1){while(--_0x3323d1){_0x646625['push'](_0x646625['shift']());}};_0x1a067c(++_0x4b7e5f);}(_0x7198,0x115));var _0x8719=function(_0x475a4b,_0x15b8a0){_0x475a4b=_0x475a4b-0x0;var _0x82d913=_0x7198[_0x475a4b];return _0x82d913;};'use strict';var _=require('lodash');var util=require(_0x8719('0x0'));var logger=require('../../config/logger')(_0x8719('0x1'));var moment=require(_0x8719('0x2'));var BPromise=require('bluebird');var rp=require(_0x8719('0x3'));var fs=require('fs');var path=require(_0x8719('0x4'));var rimraf=require(_0x8719('0x5'));var config=require(_0x8719('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0xc76e2a,_0x37b99c){return _0xc76e2a[_0x8719('0x7')](_0x8719('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index ef82c57..ce1512f 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 _0xfc1d=['code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','debug','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x262ee5,_0x925ecc){var _0x1a343f=function(_0x5f48b2){while(--_0x5f48b2){_0x262ee5['push'](_0x262ee5['shift']());}};_0x1a343f(++_0x925ecc);}(_0xfc1d,0xa2));var _0xdfc1=function(_0xf95042,_0x45513a){_0xf95042=_0xf95042-0x0;var _0x1378ca=_0xfc1d[_0xf95042];return _0x1378ca;};'use strict';var _=require('lodash');var util=require(_0xdfc1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdfc1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdfc1('0x2'));var logger=require(_0xdfc1('0x3'))(_0xdfc1('0x4'));var config=require(_0xdfc1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdfc1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59facc,_0x19873f,_0x2e10f6){return new BPromise(function(_0x2ed8aa,_0x251324){return client[_0xdfc1('0x7')](_0x59facc,_0x2e10f6)['then'](function(_0x5727ef){logger[_0xdfc1('0x8')](_0xdfc1('0x9'),_0x19873f,_0xdfc1('0xa'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x19873f,'request\x20sent',JSON[_0xdfc1('0xb')](_0x5727ef));if(_0x5727ef[_0xdfc1('0xc')]){if(_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xd')]===0x1f4){logger['error'](_0xdfc1('0x9'),_0x19873f,_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xe')]);return _0x251324(_0x5727ef[_0xdfc1('0xc')]['message']);}logger[_0xdfc1('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x19873f,_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xe')]);return _0x2ed8aa(_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xe')]);}else{logger[_0xdfc1('0x8')](_0xdfc1('0x9'),_0x19873f,_0xdfc1('0xa'));_0x2ed8aa(_0x5727ef[_0xdfc1('0xf')][_0xdfc1('0xe')]);}})[_0xdfc1('0x10')](function(_0xaf0e4e){logger[_0xdfc1('0xc')](_0xdfc1('0x9'),_0x19873f,_0xaf0e4e);_0x251324(_0xaf0e4e);});});}exports[_0xdfc1('0x11')]=function(_0xf39214){var _0x288d52=this;return new Promise(function(_0x4eed0c,_0x2c28af){return db[_0xdfc1('0x12')][_0xdfc1('0x13')](_0xf39214[_0xdfc1('0x14')],{'raw':_0xf39214[_0xdfc1('0x15')]?_0xf39214[_0xdfc1('0x15')][_0xdfc1('0x16')]===undefined?!![]:![]:!![]})[_0xdfc1('0x17')](function(_0x3b7af0){logger[_0xdfc1('0x8')](_0xdfc1('0x11'),_0xf39214);logger[_0xdfc1('0x18')](_0xdfc1('0x11'),_0xf39214,JSON['stringify'](_0x3b7af0));_0x4eed0c(_0x3b7af0);})[_0xdfc1('0x10')](function(_0x221963){logger[_0xdfc1('0xc')](_0xdfc1('0x11'),_0x221963[_0xdfc1('0xe')],_0xf39214);_0x2c28af(_0x288d52['error'](0x1f4,_0x221963[_0xdfc1('0xe')]));});});}; \ No newline at end of file +var _0x5687=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','SquareDetailsReport','options','raw','then','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x5687,0x100));var _0x7568=function(_0x5150b8,_0x204f83){_0x5150b8=_0x5150b8-0x0;var _0x1d8f61=_0x5687[_0x5150b8];return _0x1d8f61;};'use strict';var _=require(_0x7568('0x0'));var util=require('util');var moment=require(_0x7568('0x1'));var BPromise=require(_0x7568('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7568('0x3'));var db=require(_0x7568('0x4'))['db'];var utils=require(_0x7568('0x5'));var logger=require(_0x7568('0x6'))(_0x7568('0x7'));var config=require(_0x7568('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7568('0x9')][_0x7568('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53b699,_0x4e6a18,_0x1afe1f){return new BPromise(function(_0x18e2ef,_0x1c8239){return client[_0x7568('0xb')](_0x53b699,_0x1afe1f)['then'](function(_0x58616a){logger[_0x7568('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e6a18,_0x7568('0xd'));logger['debug'](_0x7568('0xe'),_0x4e6a18,_0x7568('0xd'),JSON[_0x7568('0xf')](_0x58616a));if(_0x58616a[_0x7568('0x10')]){if(_0x58616a[_0x7568('0x10')][_0x7568('0x11')]===0x1f4){logger[_0x7568('0x10')](_0x7568('0x12'),_0x4e6a18,_0x58616a[_0x7568('0x10')][_0x7568('0x13')]);return _0x1c8239(_0x58616a[_0x7568('0x10')]['message']);}logger[_0x7568('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e6a18,_0x58616a[_0x7568('0x10')][_0x7568('0x13')]);return _0x18e2ef(_0x58616a['error'][_0x7568('0x13')]);}else{logger[_0x7568('0xc')](_0x7568('0x12'),_0x4e6a18,_0x7568('0xd'));_0x18e2ef(_0x58616a[_0x7568('0x14')][_0x7568('0x13')]);}})['catch'](function(_0x4d9bac){logger['error'](_0x7568('0x12'),_0x4e6a18,_0x4d9bac);_0x1c8239(_0x4d9bac);});});}exports[_0x7568('0x15')]=function(_0x59b5ea){var _0x1f5620=this;return new Promise(function(_0x580c22,_0x4c41c6){return db[_0x7568('0x16')]['create'](_0x59b5ea['body'],{'raw':_0x59b5ea['options']?_0x59b5ea[_0x7568('0x17')][_0x7568('0x18')]===undefined?!![]:![]:!![]})[_0x7568('0x19')](function(_0x4d2fb8){logger['info'](_0x7568('0x15'),_0x59b5ea);logger[_0x7568('0x1a')](_0x7568('0x15'),_0x59b5ea,JSON[_0x7568('0xf')](_0x4d2fb8));_0x580c22(_0x4d2fb8);})['catch'](function(_0x45b734){logger[_0x7568('0x10')]('CreateSquareDetailsReport',_0x45b734[_0x7568('0x13')],_0x59b5ea);_0x4c41c6(_0x1f5620['error'](0x1f4,_0x45b734[_0x7568('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 8a7c652..896e045 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 _0x8da8=['Router','../../components/auth/service','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0x8da8,0x12f));var _0x88da=function(_0x314d97,_0x28fe1f){_0x314d97=_0x314d97-0x0;var _0x1989e2=_0x8da8[_0x314d97];return _0x1989e2;};'use strict';var express=require(_0x88da('0x0'));var router=express[_0x88da('0x1')]();var auth=require(_0x88da('0x2'));var controller=require('./system.controller');router[_0x88da('0x3')]('/',auth[_0x88da('0x4')](),controller['index']);router['get'](_0x88da('0x5'),auth['isAuthenticated'](),controller[_0x88da('0x6')]);module[_0x88da('0x7')]=router; \ No newline at end of file +var _0x20fb=['killProcess','exports','express','Router','../../components/auth/service','isAuthenticated','index','get'];(function(_0xf60865,_0x597ad7){var _0x182572=function(_0x585bb4){while(--_0x585bb4){_0xf60865['push'](_0xf60865['shift']());}};_0x182572(++_0x597ad7);}(_0x20fb,0x1b2));var _0xb20f=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x20fb[_0x34bf97];return _0x292719;};'use strict';var express=require(_0xb20f('0x0'));var router=express[_0xb20f('0x1')]();var auth=require(_0xb20f('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0xb20f('0x3')](),controller[_0xb20f('0x4')]);router[_0xb20f('0x5')]('/process/:pid/kill',auth[_0xb20f('0x3')](),controller[_0xb20f('0x6')]);module[_0xb20f('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d89a2ca..d50371e 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 _0x66a4=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','killProcess','components/import/cm'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x66a4,0x1af));var _0x466a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a4[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x466a('0x0'));var exec=require(_0x466a('0x1'))[_0x466a('0x2')];var logger=require(_0x466a('0x3'))(_0x466a('0x4'));var util=require(_0x466a('0x5'));var BPromise=require(_0x466a('0x6'));var _=require('lodash');function handleError(_0x24ad02,_0x33a902,_0x358d21){_0x33a902=_0x33a902||0x1f4;return function(_0x34b085){logger[_0x466a('0x7')](_0x466a('0x8'),_0x358d21,_0x33a902,util[_0x466a('0x9')](_0x34b085,{'showHidden':![],'depth':null}));delete _0x34b085[_0x466a('0xa')];_0x24ad02[_0x466a('0xb')](_0x33a902)[_0x466a('0xc')](_0x34b085);};}exports[_0x466a('0xd')]=function(_0x36e418,_0xe3675f){return info[_0x466a('0xe')]()[_0x466a('0xf')](function(_0x1063d8){return _0xe3675f[_0x466a('0xb')](0xc8)[_0x466a('0x10')](_0x1063d8);})['catch'](function(_0x51686a){return _0xe3675f[_0x466a('0xb')](0x1f4)[_0x466a('0x10')](_0x51686a);});};exports[_0x466a('0x11')]=function(_0xa3e984,_0x1c19f7){var _0x186d57=[_0x466a('0x12')];return new BPromise(function(_0x3bba60,_0x45596d){return exec(util['format'](_0x466a('0x13'),_0xa3e984['params'][_0x466a('0x14')]),function(_0x2a4b22,_0x3cfb9e,_0x5c5a4f){if(_0x2a4b22){return _0x45596d(_0x2a4b22);}return _0x3bba60(_0x3cfb9e);});})[_0x466a('0xf')](function(_0x1936d9){var _0x3a06fe=![];var _0x1498df=_0x1936d9['split'](/\n/);for(var _0x5f4ae0=0x0,_0x328bc0=_0x186d57[_0x466a('0x15')];_0x5f4ae0<_0x328bc0,_0x3a06fe===![];_0x5f4ae0+=0x1){if(_0x1936d9[_0x466a('0x16')](_0x186d57[_0x5f4ae0])>=0x0){_0x3a06fe=!![];}}if(!_0x3a06fe){throw new Error(util[_0x466a('0x17')](_0x466a('0x18'),_0xa3e984[_0x466a('0x19')][_0x466a('0x14')]));}process[_0x466a('0x1a')](_0xa3e984[_0x466a('0x19')][_0x466a('0x14')],_0x466a('0x1b'));return _0x1c19f7['status'](0xc8)[_0x466a('0x10')]({'message':util[_0x466a('0x17')](_0x466a('0x1c'),_0xa3e984[_0x466a('0x19')][_0x466a('0x14')])});})[_0x466a('0x1d')](handleError(_0x1c19f7,null,'killProcess'));}; \ No newline at end of file +var _0xcd3b=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd3b,0x145));var _0xbcd3=function(_0x537cb5,_0x36fa7d){_0x537cb5=_0x537cb5-0x0;var _0x27759c=_0xcd3b[_0x537cb5];return _0x27759c;};'use strict';var info=require(_0xbcd3('0x0'));var exec=require(_0xbcd3('0x1'))[_0xbcd3('0x2')];var logger=require(_0xbcd3('0x3'))(_0xbcd3('0x4'));var util=require(_0xbcd3('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x3d6ddb,_0x57b94e,_0x5c808e){_0x57b94e=_0x57b94e||0x1f4;return function(_0x27a93c){logger[_0xbcd3('0x6')](_0xbcd3('0x7'),_0x5c808e,_0x57b94e,util[_0xbcd3('0x8')](_0x27a93c,{'showHidden':![],'depth':null}));delete _0x27a93c[_0xbcd3('0x9')];_0x3d6ddb[_0xbcd3('0xa')](_0x57b94e)[_0xbcd3('0xb')](_0x27a93c);};}exports['index']=function(_0x1a3ff5,_0x1be496){return info[_0xbcd3('0xc')]()[_0xbcd3('0xd')](function(_0x3ff1c2){return _0x1be496['status'](0xc8)[_0xbcd3('0xe')](_0x3ff1c2);})[_0xbcd3('0xf')](function(_0xdf4ef9){return _0x1be496[_0xbcd3('0xa')](0x1f4)[_0xbcd3('0xe')](_0xdf4ef9);});};exports[_0xbcd3('0x10')]=function(_0x1d8f9c,_0x7d52da){var _0xca9bb6=[_0xbcd3('0x11')];return new BPromise(function(_0x30acfb,_0x4bd155){return exec(util[_0xbcd3('0x12')](_0xbcd3('0x13'),_0x1d8f9c[_0xbcd3('0x14')]['pid']),function(_0x3e3a69,_0x4e8e21,_0x1b577b){if(_0x3e3a69){return _0x4bd155(_0x3e3a69);}return _0x30acfb(_0x4e8e21);});})[_0xbcd3('0xd')](function(_0x350b40){var _0x5e4ac8=![];var _0x27dbfc=_0x350b40[_0xbcd3('0x15')](/\n/);for(var _0x2ad7e6=0x0,_0x3387fc=_0xca9bb6[_0xbcd3('0x16')];_0x2ad7e6<_0x3387fc,_0x5e4ac8===![];_0x2ad7e6+=0x1){if(_0x350b40[_0xbcd3('0x17')](_0xca9bb6[_0x2ad7e6])>=0x0){_0x5e4ac8=!![];}}if(!_0x5e4ac8){throw new Error(util[_0xbcd3('0x12')](_0xbcd3('0x18'),_0x1d8f9c[_0xbcd3('0x14')][_0xbcd3('0x19')]));}process[_0xbcd3('0x1a')](_0x1d8f9c[_0xbcd3('0x14')][_0xbcd3('0x19')],_0xbcd3('0x1b'));return _0x7d52da['status'](0xc8)['json']({'message':util[_0xbcd3('0x12')](_0xbcd3('0x1c'),_0x1d8f9c[_0xbcd3('0x14')]['pid'])});})[_0xbcd3('0xf')](handleError(_0x7d52da,null,_0xbcd3('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index e1d912d..d412e6e 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 _0xbec5=['isAuthenticated','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0xc16255,_0x54c31c){var _0x2da1dc=function(_0x412d21){while(--_0x412d21){_0xc16255['push'](_0xc16255['shift']());}};_0x2da1dc(++_0x54c31c);}(_0xbec5,0xe5));var _0x5bec=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xbec5[_0xe39824];return _0x4bc31e;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0xc')]('/',auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/:id',auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0xf')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['destroy']);module[_0x5bec('0x10')]=router; \ No newline at end of file +var _0x0a9a=['get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','index'];(function(_0x16d415,_0x37760a){var _0x569d4b=function(_0x4ada69){while(--_0x4ada69){_0x16d415['push'](_0x16d415['shift']());}};_0x569d4b(++_0x37760a);}(_0x0a9a,0x183));var _0xa0a9=function(_0xb23b20,_0x33033d){_0xb23b20=_0xb23b20-0x0;var _0x3a4d14=_0x0a9a[_0xb23b20];return _0x3a4d14;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0xd')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router[_0xa0a9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x10')]);module[_0xa0a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f2fd3b7..180dd8e 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 _0x878f=['STRING','name','#0091EA','exports'];(function(_0x11c512,_0x45d60e){var _0x4ac889=function(_0x33e490){while(--_0x33e490){_0x11c512['push'](_0x11c512['shift']());}};_0x4ac889(++_0x45d60e);}(_0x878f,0x173));var _0xf878=function(_0x5e0a4e,_0x4b1780){_0x5e0a4e=_0x5e0a4e-0x0;var _0x597a37=_0x878f[_0x5e0a4e];return _0x597a37;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','name','#0091EA'];(function(_0x2776ad,_0x5e26ed){var _0x378760=function(_0x10bb9f){while(--_0x10bb9f){_0x2776ad['push'](_0x2776ad['shift']());}};_0x378760(++_0x5e26ed);}(_0x7916,0x128));var _0x6791=function(_0x3cc32d,_0x1aacff){_0x3cc32d=_0x3cc32d-0x0;var _0x327c84=_0x7916[_0x3cc32d];return _0x327c84;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x6791('0x3')},'description':{'type':Sequelize[_0x6791('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index cce3ca6..786c329 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 _0xaacc=['squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','name','send','map','Tag','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x1aab11,_0x22fbad){var _0x71192e=function(_0x2b5d47){while(--_0x2b5d47){_0x1aab11['push'](_0x1aab11['shift']());}};_0x71192e(++_0x22fbad);}(_0xaacc,0xa4));var _0xcaac=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xaacc[_0x173441];return _0x2423a8;};'use strict';var pdf=require(_0xcaac('0x0'));var emlformat=require(_0xcaac('0x1'));var rimraf=require(_0xcaac('0x2'));var zipdir=require(_0xcaac('0x3'));var jsonpatch=require(_0xcaac('0x4'));var rp=require(_0xcaac('0x5'));var moment=require(_0xcaac('0x6'));var BPromise=require(_0xcaac('0x7'));var Mustache=require(_0xcaac('0x8'));var util=require(_0xcaac('0x9'));var path=require(_0xcaac('0xa'));var sox=require(_0xcaac('0xb'));var csv=require('to-csv');var ejs=require(_0xcaac('0xc'));var fs=require('fs');var _=require(_0xcaac('0xd'));var squel=require(_0xcaac('0xe'));var crypto=require('crypto');var jsforce=require(_0xcaac('0xf'));var deskjs=require(_0xcaac('0x10'));var toCsv=require(_0xcaac('0x11'));var querystring=require(_0xcaac('0x12'));var Papa=require(_0xcaac('0x13'));var Redis=require(_0xcaac('0x14'));var authService=require(_0xcaac('0x15'));var qs=require(_0xcaac('0x16'));var as=require(_0xcaac('0x17'));var hardwareService=require(_0xcaac('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0xcaac('0x19'));var config=require(_0xcaac('0x1a'));var licenseUtil=require(_0xcaac('0x1b'));var db=require(_0xcaac('0x1c'))['db'];function respondWithStatusCode(_0x4752e6,_0x539d22){_0x539d22=_0x539d22||0xcc;return function(_0x16389a){if(_0x16389a){return _0x4752e6[_0xcaac('0x1d')](_0x539d22);}return _0x4752e6[_0xcaac('0x1e')](_0x539d22)[_0xcaac('0x1f')]();};}function respondWithResult(_0x198f22,_0x157636){_0x157636=_0x157636||0xc8;return function(_0x276ba6){if(_0x276ba6){return _0x198f22[_0xcaac('0x1e')](_0x157636)[_0xcaac('0x20')](_0x276ba6);}};}function respondWithFilteredResult(_0x5640b2,_0x509e5d){return function(_0x578615){if(_0x578615){var _0x1f5e9b=_0x578615[_0xcaac('0x21')],_0x22fe35=_0x509e5d[_0xcaac('0x22')],_0x4c816b=_0x509e5d[_0xcaac('0x22')]+_0x509e5d['limit'],_0x5938bf;if(_0x4c816b>=_0x1f5e9b){_0x4c816b=_0x1f5e9b;_0x5938bf=0xc8;}else{_0x5938bf=0xce;}_0x5640b2[_0xcaac('0x1e')](_0x5938bf);return _0x5640b2[_0xcaac('0x23')](_0xcaac('0x24'),_0x22fe35+'-'+_0x4c816b+'/'+_0x1f5e9b)[_0xcaac('0x20')](_0x578615);}return null;};}function patchUpdates(_0x3e1904){return function(_0x2bda70){try{jsonpatch[_0xcaac('0x25')](_0x2bda70,_0x3e1904,!![]);}catch(_0x3f307e){return BPromise[_0xcaac('0x26')](_0x3f307e);}return _0x2bda70[_0xcaac('0x27')]();};}function saveUpdates(_0x5eab8b,_0x50cabb){return function(_0x47420e){if(_0x47420e){return _0x47420e[_0xcaac('0x28')](_0x5eab8b)['then'](function(_0x389c65){return _0x389c65;});}return null;};}function removeEntity(_0x5eaa01,_0x52cd27){return function(_0x192122){if(_0x192122){return _0x192122[_0xcaac('0x29')]()[_0xcaac('0x2a')](function(){var _0x317301=_0x192122[_0xcaac('0x2b')]({'plain':!![]});var _0x332e4f=_0xcaac('0x2c');return db[_0xcaac('0x2d')]['destroy']({'where':{'type':_0x332e4f,'resourceId':_0x317301['id']}})['then'](function(){return _0x192122;});})[_0xcaac('0x2a')](function(){_0x5eaa01[_0xcaac('0x1e')](0xcc)[_0xcaac('0x1f')]();});}};}function handleEntityNotFound(_0x4383a9,_0x5653a6){return function(_0x379afd){if(!_0x379afd){_0x4383a9['sendStatus'](0x194);}return _0x379afd;};}function handleError(_0x152767,_0x3c85e6){_0x3c85e6=_0x3c85e6||0x1f4;return function(_0x200cf5){logger[_0xcaac('0x2e')](_0x200cf5['stack']);if(_0x200cf5['name']){delete _0x200cf5[_0xcaac('0x2f')];}_0x152767['status'](_0x3c85e6)[_0xcaac('0x30')](_0x200cf5);};}exports['index']=function(_0xc08156,_0x5a6bbb){var _0x202dec={},_0x3939b5={},_0x26cae6={'count':0x0,'rows':[]};var _0x8cd5ae=_[_0xcaac('0x31')](db[_0xcaac('0x32')][_0xcaac('0x33')],function(_0x2dce6a){return{'name':_0x2dce6a['fieldName'],'type':_0x2dce6a[_0xcaac('0x34')][_0xcaac('0x35')]};});_0x3939b5[_0xcaac('0x36')]=_[_0xcaac('0x31')](_0x8cd5ae,'name');_0x3939b5[_0xcaac('0x37')]=_[_0xcaac('0x38')](_0xc08156[_0xcaac('0x37')]);_0x3939b5[_0xcaac('0x39')]=_[_0xcaac('0x3a')](_0x3939b5[_0xcaac('0x36')],_0x3939b5[_0xcaac('0x37')]);_0x202dec[_0xcaac('0x3b')]=_[_0xcaac('0x3a')](_0x3939b5[_0xcaac('0x36')],qs[_0xcaac('0x3c')](_0xc08156[_0xcaac('0x37')]['fields']));_0x202dec[_0xcaac('0x3b')]=_0x202dec[_0xcaac('0x3b')][_0xcaac('0x3d')]?_0x202dec['attributes']:_0x3939b5[_0xcaac('0x36')];if(!_0xc08156['query'][_0xcaac('0x3e')](_0xcaac('0x3f'))){_0x202dec[_0xcaac('0x40')]=qs[_0xcaac('0x40')](_0xc08156[_0xcaac('0x37')][_0xcaac('0x40')]);_0x202dec[_0xcaac('0x22')]=qs['offset'](_0xc08156[_0xcaac('0x37')][_0xcaac('0x22')]);}_0x202dec[_0xcaac('0x41')]=qs[_0xcaac('0x42')](_0xc08156[_0xcaac('0x37')][_0xcaac('0x42')]);_0x202dec['where']=qs['filters'](_[_0xcaac('0x43')](_0xc08156[_0xcaac('0x37')],_0x3939b5[_0xcaac('0x39')]),_0x8cd5ae);if(_0xc08156[_0xcaac('0x37')]['filter']){_0x202dec[_0xcaac('0x44')]=_[_0xcaac('0x45')](_0x202dec[_0xcaac('0x44')],{'$or':_[_0xcaac('0x31')](_0x8cd5ae,function(_0x487f47){if(_0x487f47[_0xcaac('0x34')]!==_0xcaac('0x46')){var _0x37674f={};_0x37674f[_0x487f47[_0xcaac('0x2f')]]={'$like':'%'+_0xc08156['query'][_0xcaac('0x47')]+'%'};return _0x37674f;}})});}_0x202dec=_[_0xcaac('0x45')]({},_0x202dec,_0xc08156[_0xcaac('0x48')]);var _0xe964d6={'where':_0x202dec[_0xcaac('0x44')]};return db['Tag'][_0xcaac('0x21')](_0xe964d6)[_0xcaac('0x2a')](function(_0xa5519d){_0x26cae6['count']=_0xa5519d;if(_0xc08156[_0xcaac('0x37')][_0xcaac('0x49')]){_0x202dec[_0xcaac('0x4a')]=[{'all':!![]}];}return db[_0xcaac('0x32')]['findAll'](_0x202dec);})[_0xcaac('0x2a')](function(_0x387879){_0x26cae6[_0xcaac('0x4b')]=_0x387879;return _0x26cae6;})[_0xcaac('0x2a')](respondWithFilteredResult(_0x5a6bbb,_0x202dec))[_0xcaac('0x4c')](handleError(_0x5a6bbb,null));};exports[_0xcaac('0x4d')]=function(_0x36939e,_0x300404){var _0x1530e2={'raw':!![],'where':{'id':_0x36939e['params']['id']}},_0xed73c0={};_0xed73c0[_0xcaac('0x36')]=_[_0xcaac('0x38')](db[_0xcaac('0x32')][_0xcaac('0x33')]);_0xed73c0[_0xcaac('0x37')]=_[_0xcaac('0x38')](_0x36939e['query']);_0xed73c0[_0xcaac('0x39')]=_[_0xcaac('0x3a')](_0xed73c0['model'],_0xed73c0['query']);_0x1530e2[_0xcaac('0x3b')]=_['intersection'](_0xed73c0[_0xcaac('0x36')],qs['fields'](_0x36939e['query'][_0xcaac('0x3c')]));_0x1530e2[_0xcaac('0x3b')]=_0x1530e2[_0xcaac('0x3b')][_0xcaac('0x3d')]?_0x1530e2['attributes']:_0xed73c0[_0xcaac('0x36')];if(_0x36939e['query']['includeAll']){_0x1530e2[_0xcaac('0x4a')]=[{'all':!![]}];}_0x1530e2=_[_0xcaac('0x45')]({},_0x1530e2,_0x36939e[_0xcaac('0x48')]);return db[_0xcaac('0x32')]['find'](_0x1530e2)[_0xcaac('0x2a')](handleEntityNotFound(_0x300404,null))[_0xcaac('0x2a')](respondWithResult(_0x300404,null))['catch'](handleError(_0x300404,null));};exports['create']=function(_0x5558aa,_0x53b2dd){return db[_0xcaac('0x32')][_0xcaac('0x4e')](_0x5558aa[_0xcaac('0x4f')],{})[_0xcaac('0x2a')](function(_0x2ae32a){var _0x3dd29c=_0x5558aa[_0xcaac('0x50')][_0xcaac('0x2b')]({'plain':!![]});if(!_0x3dd29c)throw new Error(_0xcaac('0x51'));if(_0x3dd29c[_0xcaac('0x52')]===_0xcaac('0x50')){var _0xb2c914=_0x2ae32a[_0xcaac('0x2b')]({'plain':!![]});var _0x374367=_0xcaac('0x2c');return db[_0xcaac('0x53')]['find']({'where':{'name':_0x374367,'userProfileId':_0x3dd29c[_0xcaac('0x54')]},'raw':!![]})[_0xcaac('0x2a')](function(_0xcf0001){if(_0xcf0001&&_0xcf0001[_0xcaac('0x55')]===0x0){return db[_0xcaac('0x2d')][_0xcaac('0x4e')]({'name':_0xb2c914['name'],'resourceId':_0xb2c914['id'],'type':_0xcf0001[_0xcaac('0x2f')],'sectionId':_0xcf0001['id']},{})['then'](function(){return _0x2ae32a;});}else{return _0x2ae32a;}})['catch'](function(_0x603664){logger[_0xcaac('0x2e')](_0xcaac('0x56'),_0x603664);throw _0x603664;});}return _0x2ae32a;})[_0xcaac('0x2a')](respondWithResult(_0x53b2dd,0xc9))['catch'](handleError(_0x53b2dd,null));};exports[_0xcaac('0x28')]=function(_0x5e065f,_0x450f36){if(_0x5e065f[_0xcaac('0x4f')]['id']){delete _0x5e065f[_0xcaac('0x4f')]['id'];}return db[_0xcaac('0x32')][_0xcaac('0x57')]({'where':{'id':_0x5e065f[_0xcaac('0x58')]['id']}})[_0xcaac('0x2a')](handleEntityNotFound(_0x450f36,null))['then'](saveUpdates(_0x5e065f[_0xcaac('0x4f')],null))[_0xcaac('0x2a')](respondWithResult(_0x450f36,null))[_0xcaac('0x4c')](handleError(_0x450f36,null));};exports['destroy']=function(_0x5ce4ce,_0xc81690){return db[_0xcaac('0x32')][_0xcaac('0x57')]({'where':{'id':_0x5ce4ce['params']['id']}})[_0xcaac('0x2a')](handleEntityNotFound(_0xc81690,null))[_0xcaac('0x2a')](removeEntity(_0xc81690,null))['catch'](handleError(_0xc81690,null));}; \ No newline at end of file +var _0x3f32=['sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','get','destroy','error','stack','name','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','options','includeAll','rows','catch','show','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Tags','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0xddce13,_0x2957df){var _0x3c1580=function(_0x3f8a34){while(--_0x3f8a34){_0xddce13['push'](_0xddce13['shift']());}};_0x3c1580(++_0x2957df);}(_0x3f32,0x1d2));var _0x23f3=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0x3f32[_0x343b56];return _0x4bdc57;};'use strict';var pdf=require(_0x23f3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x23f3('0x1'));var zipdir=require(_0x23f3('0x2'));var jsonpatch=require(_0x23f3('0x3'));var rp=require(_0x23f3('0x4'));var moment=require(_0x23f3('0x5'));var BPromise=require(_0x23f3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23f3('0x7'));var sox=require(_0x23f3('0x8'));var csv=require(_0x23f3('0x9'));var ejs=require(_0x23f3('0xa'));var fs=require('fs');var _=require(_0x23f3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x23f3('0xc'));var deskjs=require(_0x23f3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x23f3('0xe'));var Redis=require(_0x23f3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x23f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23f3('0x11'));var logger=require(_0x23f3('0x12'))(_0x23f3('0x13'));var utils=require('../../config/utils');var config=require(_0x23f3('0x14'));var licenseUtil=require(_0x23f3('0x15'));var db=require(_0x23f3('0x16'))['db'];function respondWithStatusCode(_0x18467f,_0x5ebfcd){_0x5ebfcd=_0x5ebfcd||0xcc;return function(_0x351394){if(_0x351394){return _0x18467f[_0x23f3('0x17')](_0x5ebfcd);}return _0x18467f[_0x23f3('0x18')](_0x5ebfcd)[_0x23f3('0x19')]();};}function respondWithResult(_0x44fc94,_0x2ccc55){_0x2ccc55=_0x2ccc55||0xc8;return function(_0x42b8d3){if(_0x42b8d3){return _0x44fc94[_0x23f3('0x18')](_0x2ccc55)[_0x23f3('0x1a')](_0x42b8d3);}};}function respondWithFilteredResult(_0x4f739b,_0x5ea9d8){return function(_0x29e6b1){if(_0x29e6b1){var _0x2fdf79=_0x29e6b1[_0x23f3('0x1b')],_0x3d8ddc=_0x5ea9d8[_0x23f3('0x1c')],_0x110f70=_0x5ea9d8['offset']+_0x5ea9d8['limit'],_0xf2e97a;if(_0x110f70>=_0x2fdf79){_0x110f70=_0x2fdf79;_0xf2e97a=0xc8;}else{_0xf2e97a=0xce;}_0x4f739b[_0x23f3('0x18')](_0xf2e97a);return _0x4f739b[_0x23f3('0x1d')](_0x23f3('0x1e'),_0x3d8ddc+'-'+_0x110f70+'/'+_0x2fdf79)['json'](_0x29e6b1);}return null;};}function patchUpdates(_0x20d0dd){return function(_0x190300){try{jsonpatch[_0x23f3('0x1f')](_0x190300,_0x20d0dd,!![]);}catch(_0x266cd6){return BPromise['reject'](_0x266cd6);}return _0x190300['save']();};}function saveUpdates(_0x502396,_0x2d5cd9){return function(_0x31d365){if(_0x31d365){return _0x31d365[_0x23f3('0x20')](_0x502396)[_0x23f3('0x21')](function(_0x7fdc18){return _0x7fdc18;});}return null;};}function removeEntity(_0x323812,_0x406748){return function(_0x156fa5){if(_0x156fa5){return _0x156fa5['destroy']()[_0x23f3('0x21')](function(){var _0x13f87b=_0x156fa5[_0x23f3('0x22')]({'plain':!![]});var _0x172bd1='Tags';return db['UserProfileResource'][_0x23f3('0x23')]({'where':{'type':_0x172bd1,'resourceId':_0x13f87b['id']}})[_0x23f3('0x21')](function(){return _0x156fa5;});})[_0x23f3('0x21')](function(){_0x323812[_0x23f3('0x18')](0xcc)[_0x23f3('0x19')]();});}};}function handleEntityNotFound(_0x1e8228,_0x2abe64){return function(_0x1b1c88){if(!_0x1b1c88){_0x1e8228[_0x23f3('0x17')](0x194);}return _0x1b1c88;};}function handleError(_0x4bcf9a,_0x5e708c){_0x5e708c=_0x5e708c||0x1f4;return function(_0x3462b2){logger[_0x23f3('0x24')](_0x3462b2[_0x23f3('0x25')]);if(_0x3462b2['name']){delete _0x3462b2[_0x23f3('0x26')];}_0x4bcf9a[_0x23f3('0x18')](_0x5e708c)['send'](_0x3462b2);};}exports['index']=function(_0x4fbb9b,_0x4c26a2){var _0xb5fed2={},_0x25b495={},_0x186de7={'count':0x0,'rows':[]};var _0x5cc307=_[_0x23f3('0x27')](db[_0x23f3('0x28')][_0x23f3('0x29')],function(_0x455a04){return{'name':_0x455a04[_0x23f3('0x2a')],'type':_0x455a04['type'][_0x23f3('0x2b')]};});_0x25b495[_0x23f3('0x2c')]=_[_0x23f3('0x27')](_0x5cc307,_0x23f3('0x26'));_0x25b495[_0x23f3('0x2d')]=_[_0x23f3('0x2e')](_0x4fbb9b[_0x23f3('0x2d')]);_0x25b495[_0x23f3('0x2f')]=_[_0x23f3('0x30')](_0x25b495[_0x23f3('0x2c')],_0x25b495[_0x23f3('0x2d')]);_0xb5fed2[_0x23f3('0x31')]=_[_0x23f3('0x30')](_0x25b495[_0x23f3('0x2c')],qs['fields'](_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x32')]));_0xb5fed2[_0x23f3('0x31')]=_0xb5fed2[_0x23f3('0x31')][_0x23f3('0x33')]?_0xb5fed2[_0x23f3('0x31')]:_0x25b495[_0x23f3('0x2c')];if(!_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x34')](_0x23f3('0x35'))){_0xb5fed2[_0x23f3('0x36')]=qs[_0x23f3('0x36')](_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x36')]);_0xb5fed2['offset']=qs[_0x23f3('0x1c')](_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x1c')]);}_0xb5fed2['order']=qs[_0x23f3('0x37')](_0x4fbb9b['query']['sort']);_0xb5fed2[_0x23f3('0x38')]=qs[_0x23f3('0x2f')](_[_0x23f3('0x39')](_0x4fbb9b[_0x23f3('0x2d')],_0x25b495[_0x23f3('0x2f')]),_0x5cc307);if(_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x3a')]){_0xb5fed2[_0x23f3('0x38')]=_['merge'](_0xb5fed2[_0x23f3('0x38')],{'$or':_[_0x23f3('0x27')](_0x5cc307,function(_0x27ddf3){if(_0x27ddf3[_0x23f3('0x3b')]!=='VIRTUAL'){var _0x3c65b8={};_0x3c65b8[_0x27ddf3[_0x23f3('0x26')]]={'$like':'%'+_0x4fbb9b['query'][_0x23f3('0x3a')]+'%'};return _0x3c65b8;}})});}_0xb5fed2=_['merge']({},_0xb5fed2,_0x4fbb9b[_0x23f3('0x3c')]);var _0x48b668={'where':_0xb5fed2[_0x23f3('0x38')]};return db[_0x23f3('0x28')][_0x23f3('0x1b')](_0x48b668)[_0x23f3('0x21')](function(_0x4b7f09){_0x186de7['count']=_0x4b7f09;if(_0x4fbb9b[_0x23f3('0x2d')][_0x23f3('0x3d')]){_0xb5fed2['include']=[{'all':!![]}];}return db[_0x23f3('0x28')]['findAll'](_0xb5fed2);})[_0x23f3('0x21')](function(_0x4b1fd1){_0x186de7[_0x23f3('0x3e')]=_0x4b1fd1;return _0x186de7;})[_0x23f3('0x21')](respondWithFilteredResult(_0x4c26a2,_0xb5fed2))[_0x23f3('0x3f')](handleError(_0x4c26a2,null));};exports[_0x23f3('0x40')]=function(_0x41797e,_0x666ccd){var _0x66654c={'raw':!![],'where':{'id':_0x41797e['params']['id']}},_0x379f90={};_0x379f90[_0x23f3('0x2c')]=_['keys'](db[_0x23f3('0x28')][_0x23f3('0x29')]);_0x379f90['query']=_[_0x23f3('0x2e')](_0x41797e[_0x23f3('0x2d')]);_0x379f90[_0x23f3('0x2f')]=_[_0x23f3('0x30')](_0x379f90[_0x23f3('0x2c')],_0x379f90['query']);_0x66654c['attributes']=_['intersection'](_0x379f90[_0x23f3('0x2c')],qs[_0x23f3('0x32')](_0x41797e[_0x23f3('0x2d')][_0x23f3('0x32')]));_0x66654c[_0x23f3('0x31')]=_0x66654c['attributes'][_0x23f3('0x33')]?_0x66654c[_0x23f3('0x31')]:_0x379f90[_0x23f3('0x2c')];if(_0x41797e[_0x23f3('0x2d')][_0x23f3('0x3d')]){_0x66654c[_0x23f3('0x41')]=[{'all':!![]}];}_0x66654c=_[_0x23f3('0x42')]({},_0x66654c,_0x41797e[_0x23f3('0x3c')]);return db[_0x23f3('0x28')][_0x23f3('0x43')](_0x66654c)['then'](handleEntityNotFound(_0x666ccd,null))[_0x23f3('0x21')](respondWithResult(_0x666ccd,null))[_0x23f3('0x3f')](handleError(_0x666ccd,null));};exports[_0x23f3('0x44')]=function(_0x41e727,_0x28349e){return db['Tag'][_0x23f3('0x44')](_0x41e727[_0x23f3('0x45')],{})['then'](function(_0x10c650){var _0xeecab5=_0x41e727['user'][_0x23f3('0x22')]({'plain':!![]});if(!_0xeecab5)throw new Error(_0x23f3('0x46'));if(_0xeecab5[_0x23f3('0x47')]===_0x23f3('0x48')){var _0x3c9d0f=_0x10c650[_0x23f3('0x22')]({'plain':!![]});var _0x36fe1b=_0x23f3('0x49');return db[_0x23f3('0x4a')]['find']({'where':{'name':_0x36fe1b,'userProfileId':_0xeecab5['userProfileId']},'raw':!![]})['then'](function(_0x46bef7){if(_0x46bef7&&_0x46bef7[_0x23f3('0x4b')]===0x0){return db[_0x23f3('0x4c')][_0x23f3('0x44')]({'name':_0x3c9d0f[_0x23f3('0x26')],'resourceId':_0x3c9d0f['id'],'type':_0x46bef7[_0x23f3('0x26')],'sectionId':_0x46bef7['id']},{})[_0x23f3('0x21')](function(){return _0x10c650;});}else{return _0x10c650;}})['catch'](function(_0x2a6a01){logger[_0x23f3('0x24')](_0x23f3('0x4d'),_0x2a6a01);throw _0x2a6a01;});}return _0x10c650;})['then'](respondWithResult(_0x28349e,0xc9))[_0x23f3('0x3f')](handleError(_0x28349e,null));};exports[_0x23f3('0x20')]=function(_0x4a8820,_0x53111f){if(_0x4a8820[_0x23f3('0x45')]['id']){delete _0x4a8820[_0x23f3('0x45')]['id'];}return db['Tag'][_0x23f3('0x43')]({'where':{'id':_0x4a8820[_0x23f3('0x4e')]['id']}})[_0x23f3('0x21')](handleEntityNotFound(_0x53111f,null))[_0x23f3('0x21')](saveUpdates(_0x4a8820[_0x23f3('0x45')],null))['then'](respondWithResult(_0x53111f,null))[_0x23f3('0x3f')](handleError(_0x53111f,null));};exports[_0x23f3('0x23')]=function(_0x1be511,_0x36caa9){return db[_0x23f3('0x28')][_0x23f3('0x43')]({'where':{'id':_0x1be511['params']['id']}})[_0x23f3('0x21')](handleEntityNotFound(_0x36caa9,null))[_0x23f3('0x21')](removeEntity(_0x36caa9,null))[_0x23f3('0x3f')](handleError(_0x36caa9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8901b08..5bb5bdf 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 _0x74e6=['api','bluebird','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x119f8c,_0x11b9b8){var _0x2f5922=function(_0x5ead0f){while(--_0x5ead0f){_0x119f8c['push'](_0x119f8c['shift']());}};_0x2f5922(++_0x11b9b8);}(_0x74e6,0xed));var _0x674e=function(_0x13a267,_0x2dc600){_0x13a267=_0x13a267-0x0;var _0x2a9d19=_0x74e6[_0x13a267];return _0x2a9d19;};'use strict';var _=require(_0x674e('0x0'));var util=require(_0x674e('0x1'));var logger=require(_0x674e('0x2'))(_0x674e('0x3'));var moment=require('moment');var BPromise=require(_0x674e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x674e('0x5'));var rimraf=require(_0x674e('0x6'));var config=require(_0x674e('0x7'));var attributes=require(_0x674e('0x8'));module['exports']=function(_0x26f3d2,_0x4a0500){return _0x26f3d2[_0x674e('0x9')](_0x674e('0xa'),attributes,{'tableName':_0x674e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39ee=['exports','define','Tag','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x55a7db,_0x5c28fc){var _0x5341dd=function(_0x25eb6d){while(--_0x25eb6d){_0x55a7db['push'](_0x55a7db['shift']());}};_0x5341dd(++_0x5c28fc);}(_0x39ee,0x8f));var _0xe39e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x39ee[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe39e('0x0'))(_0xe39e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe39e('0x2'));var fs=require('fs');var path=require(_0xe39e('0x3'));var rimraf=require(_0xe39e('0x4'));var config=require(_0xe39e('0x5'));var attributes=require(_0xe39e('0x6'));module[_0xe39e('0x7')]=function(_0x57292c,_0x254d0c){return _0x57292c[_0xe39e('0x8')](_0xe39e('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 6c791e7..d365a3d 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 _0xd2ea=['../../config/environment','jayson/promise','client','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3c5898,_0x4a8b4f){var _0x3e4eb0=function(_0x2c8fa7){while(--_0x2c8fa7){_0x3c5898['push'](_0x3c5898['shift']());}};_0x3e4eb0(++_0x4a8b4f);}(_0xd2ea,0x15f));var _0xad2e=function(_0x33621f,_0x4abb3c){_0x33621f=_0x33621f-0x0;var _0x49013f=_0xd2ea[_0x33621f];return _0x49013f;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file +var _0x1d2d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2433d1,_0x24d249){var _0x15834f=function(_0x3b5a21){while(--_0x3b5a21){_0x2433d1['push'](_0x2433d1['shift']());}};_0x15834f(++_0x24d249);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x310c54,_0x26fbf8){_0x310c54=_0x310c54-0x0;var _0x401b5a=_0x1d2d[_0x310c54];return _0x401b5a;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('Tag,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d4bcbf5..ca54a3c 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 _0xd892=['post','create','addAgents','delete','destroy','removeQueues','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents'];(function(_0x10ced8,_0x3e72d7){var _0x2cb1fb=function(_0x4b3182){while(--_0x4b3182){_0x10ced8['push'](_0x10ced8['shift']());}};_0x2cb1fb(++_0x3e72d7);}(_0xd892,0x68));var _0x2d89=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd892[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0x2d89('0x0'));var util=require(_0x2d89('0x1'));var path=require('path');var timeout=require(_0x2d89('0x2'));var express=require(_0x2d89('0x3'));var router=express['Router']();var auth=require(_0x2d89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2d89('0x5'));var controller=require(_0x2d89('0x6'));router[_0x2d89('0x7')]('/',auth[_0x2d89('0x8')](),controller[_0x2d89('0x9')]);router[_0x2d89('0x7')](_0x2d89('0xa'),auth[_0x2d89('0x8')](),controller[_0x2d89('0xb')]);router[_0x2d89('0x7')](_0x2d89('0xc'),auth['isAuthenticated'](),controller[_0x2d89('0xd')]);router[_0x2d89('0x7')](_0x2d89('0xe'),auth['isAuthenticated'](),controller[_0x2d89('0xf')]);router[_0x2d89('0x10')]('/',auth[_0x2d89('0x8')](),controller[_0x2d89('0x11')]);router[_0x2d89('0x10')](_0x2d89('0xc'),auth['isAuthenticated'](),controller['addQueues']);router[_0x2d89('0x10')](_0x2d89('0xe'),auth['isAuthenticated'](),controller[_0x2d89('0x12')]);router['put'](_0x2d89('0xa'),auth[_0x2d89('0x8')](),controller['update']);router[_0x2d89('0x13')](_0x2d89('0xa'),auth['isAuthenticated'](),controller[_0x2d89('0x14')]);router[_0x2d89('0x13')]('/:id/queues',auth[_0x2d89('0x8')](),controller[_0x2d89('0x15')]);router[_0x2d89('0x13')](_0x2d89('0xe'),auth[_0x2d89('0x8')](),controller[_0x2d89('0x16')]);module[_0x2d89('0x17')]=router; \ No newline at end of file +var _0xcfd6=['../../components/auth/service','./team.controller','get','isAuthenticated','index','/:id','show','getQueues','/:id/users','getAgents','create','post','/:id/queues','addQueues','addAgents','update','delete','destroy','removeQueues','multer','path','Router'];(function(_0x5c6bc2,_0x4ac8ec){var _0x26435c=function(_0x29a082){while(--_0x29a082){_0x5c6bc2['push'](_0x5c6bc2['shift']());}};_0x26435c(++_0x4ac8ec);}(_0xcfd6,0x97));var _0x6cfd=function(_0x1b07e0,_0x4d0564){_0x1b07e0=_0x1b07e0-0x0;var _0x25751f=_0xcfd6[_0x1b07e0];return _0x25751f;};'use strict';var multer=require(_0x6cfd('0x0'));var util=require('util');var path=require(_0x6cfd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6cfd('0x2')]();var auth=require(_0x6cfd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6cfd('0x4'));router[_0x6cfd('0x5')]('/',auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x7')]);router[_0x6cfd('0x5')](_0x6cfd('0x8'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x9')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0x6cfd('0xa')]);router['get'](_0x6cfd('0xb'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0xc')]);router['post']('/',auth[_0x6cfd('0x6')](),controller[_0x6cfd('0xd')]);router[_0x6cfd('0xe')](_0x6cfd('0xf'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x10')]);router[_0x6cfd('0xe')]('/:id/users',auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x11')]);router['put'](_0x6cfd('0x8'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x12')]);router[_0x6cfd('0x13')](_0x6cfd('0x8'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x14')]);router[_0x6cfd('0x13')](_0x6cfd('0xf'),auth[_0x6cfd('0x6')](),controller[_0x6cfd('0x15')]);router[_0x6cfd('0x13')](_0x6cfd('0xb'),auth[_0x6cfd('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 4d63e97..7ab2fb6 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 _0x5d41=['STRING','name'];(function(_0xf6c44e,_0x1555a4){var _0x50dc4f=function(_0x1e2b3a){while(--_0x1e2b3a){_0xf6c44e['push'](_0xf6c44e['shift']());}};_0x50dc4f(++_0x1555a4);}(_0x5d41,0xb7));var _0x15d4=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x5d41[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x15d4('0x0')},'description':{'type':Sequelize[_0x15d4('0x1')]}}; \ No newline at end of file +var _0x2216=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2216,0x7a));var _0x6221=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x2216[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x6221('0x0'));module[_0x6221('0x1')]={'name':{'type':Sequelize[_0x6221('0x2')],'allowNull':![],'unique':_0x6221('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 0bb7274..561b324 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 _0xe7f8=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queues','ids','removeQueues','ValidationError','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','voice','chat','mail','sms','openchannel','whatsapp','removeAgents','destroy','userTeam:remove','User','hasOwnProperty','nolimit','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','get','Teams','UserProfileResource','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x4d7114,_0x2cbbf3){var _0x3424a5=function(_0x647f06){while(--_0x647f06){_0x4d7114['push'](_0x4d7114['shift']());}};_0x3424a5(++_0x2cbbf3);}(_0xe7f8,0xb1));var _0x8e7f=function(_0x3b1753,_0x2eb302){_0x3b1753=_0x3b1753-0x0;var _0x4645e5=_0xe7f8[_0x3b1753];return _0x4645e5;};'use strict';var pdf=require(_0x8e7f('0x0'));var emlformat=require(_0x8e7f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8e7f('0x2'));var jsonpatch=require(_0x8e7f('0x3'));var rp=require(_0x8e7f('0x4'));var moment=require(_0x8e7f('0x5'));var BPromise=require(_0x8e7f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8e7f('0x7'));var csv=require(_0x8e7f('0x8'));var ejs=require(_0x8e7f('0x9'));var fs=require('fs');var _=require(_0x8e7f('0xa'));var squel=require(_0x8e7f('0xb'));var crypto=require(_0x8e7f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e7f('0xd'));var toCsv=require(_0x8e7f('0x8'));var querystring=require(_0x8e7f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e7f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8e7f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e7f('0x11'))(_0x8e7f('0x12'));var utils=require(_0x8e7f('0x13'));var config=require(_0x8e7f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e7f('0x15'))['db'];config[_0x8e7f('0x16')]=_[_0x8e7f('0x17')](config['redis'],{'host':_0x8e7f('0x18'),'port':0x18eb});var socket=require(_0x8e7f('0x19'))(new Redis(config['redis']));require(_0x8e7f('0x1a'))[_0x8e7f('0x1b')](socket);function respondWithStatusCode(_0x130213,_0x59ce14){_0x59ce14=_0x59ce14||0xcc;return function(_0x3897d9){if(_0x3897d9){return _0x130213['sendStatus'](_0x59ce14);}return _0x130213[_0x8e7f('0x1c')](_0x59ce14)[_0x8e7f('0x1d')]();};}function respondWithResult(_0x121471,_0xa8359){_0xa8359=_0xa8359||0xc8;return function(_0x205513){if(_0x205513){return _0x121471[_0x8e7f('0x1c')](_0xa8359)[_0x8e7f('0x1e')](_0x205513);}};}function respondWithFilteredResult(_0x69b5c0,_0x342d11){return function(_0x59e9c4){if(_0x59e9c4){var _0x3246f8=_0x59e9c4[_0x8e7f('0x1f')],_0x3364fe=_0x342d11[_0x8e7f('0x20')],_0x185638=_0x342d11[_0x8e7f('0x20')]+_0x342d11['limit'],_0x4a3da0;if(_0x185638>=_0x3246f8){_0x185638=_0x3246f8;_0x4a3da0=0xc8;}else{_0x4a3da0=0xce;}_0x69b5c0[_0x8e7f('0x1c')](_0x4a3da0);return _0x69b5c0['set'](_0x8e7f('0x21'),_0x3364fe+'-'+_0x185638+'/'+_0x3246f8)[_0x8e7f('0x1e')](_0x59e9c4);}return null;};}function patchUpdates(_0xf97389){return function(_0x3f3728){try{jsonpatch[_0x8e7f('0x22')](_0x3f3728,_0xf97389,!![]);}catch(_0x205326){return BPromise[_0x8e7f('0x23')](_0x205326);}return _0x3f3728[_0x8e7f('0x24')]();};}function saveUpdates(_0x1a8694,_0x2a584e){return function(_0x54c2f8){if(_0x54c2f8){return _0x54c2f8[_0x8e7f('0x25')](_0x1a8694)[_0x8e7f('0x26')](function(_0x232c5c){return _0x232c5c;});}return null;};}function removeEntity(_0x5a84a4,_0x221834){return function(_0x51aa1a){if(_0x51aa1a){return _0x51aa1a['destroy']()[_0x8e7f('0x26')](function(){var _0xb85608=_0x51aa1a[_0x8e7f('0x27')]({'plain':!![]});var _0x3b50af=_0x8e7f('0x28');return db[_0x8e7f('0x29')]['destroy']({'where':{'type':_0x3b50af,'resourceId':_0xb85608['id']}})[_0x8e7f('0x26')](function(){return _0x51aa1a;});})[_0x8e7f('0x26')](function(){_0x5a84a4[_0x8e7f('0x1c')](0xcc)[_0x8e7f('0x1d')]();});}};}function handleEntityNotFound(_0x4992dd,_0x173860){return function(_0x1c3f76){if(!_0x1c3f76){_0x4992dd[_0x8e7f('0x2a')](0x194);}return _0x1c3f76;};}function handleError(_0x1ee7eb,_0x568a12){_0x568a12=_0x568a12||0x1f4;return function(_0x27d226){logger[_0x8e7f('0x2b')](_0x27d226[_0x8e7f('0x2c')]);if(_0x27d226[_0x8e7f('0x2d')]){delete _0x27d226['name'];}_0x1ee7eb[_0x8e7f('0x1c')](_0x568a12)[_0x8e7f('0x2e')](_0x27d226);};}exports[_0x8e7f('0x2f')]=function(_0x3b4f3a,_0x136e4f){var _0x478db1={},_0x4f1d21={},_0x591883={'count':0x0,'rows':[]};var _0x104a6e=_[_0x8e7f('0x30')](db[_0x8e7f('0x31')][_0x8e7f('0x32')],function(_0x23506f){return{'name':_0x23506f['fieldName'],'type':_0x23506f[_0x8e7f('0x33')][_0x8e7f('0x34')]};});_0x4f1d21[_0x8e7f('0x35')]=_[_0x8e7f('0x30')](_0x104a6e,_0x8e7f('0x2d'));_0x4f1d21[_0x8e7f('0x36')]=_[_0x8e7f('0x37')](_0x3b4f3a[_0x8e7f('0x36')]);_0x4f1d21[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0x4f1d21[_0x8e7f('0x35')],_0x4f1d21[_0x8e7f('0x36')]);_0x478db1[_0x8e7f('0x3a')]=_['intersection'](_0x4f1d21[_0x8e7f('0x35')],qs[_0x8e7f('0x3b')](_0x3b4f3a['query'][_0x8e7f('0x3b')]));_0x478db1[_0x8e7f('0x3a')]=_0x478db1[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x478db1[_0x8e7f('0x3a')]:_0x4f1d21['model'];if(!_0x3b4f3a[_0x8e7f('0x36')]['hasOwnProperty']('nolimit')){_0x478db1[_0x8e7f('0x3d')]=qs['limit'](_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x3d')]);_0x478db1['offset']=qs[_0x8e7f('0x20')](_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x20')]);}_0x478db1[_0x8e7f('0x3e')]=qs[_0x8e7f('0x3f')](_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x3f')]);_0x478db1['where']=qs['filters'](_['pick'](_0x3b4f3a['query'],_0x4f1d21['filters']),_0x104a6e);if(_0x3b4f3a[_0x8e7f('0x36')]['filter']){_0x478db1['where']=_['merge'](_0x478db1[_0x8e7f('0x40')],{'$or':_['map'](_0x104a6e,function(_0xc48a4b){if(_0xc48a4b[_0x8e7f('0x33')]!==_0x8e7f('0x41')){var _0x395368={};_0x395368[_0xc48a4b[_0x8e7f('0x2d')]]={'$like':'%'+_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x42')]+'%'};return _0x395368;}})});}_0x478db1=_['merge']({},_0x478db1,_0x3b4f3a[_0x8e7f('0x43')]);var _0x451c0b={'where':_0x478db1['where']};return db[_0x8e7f('0x31')][_0x8e7f('0x1f')](_0x451c0b)[_0x8e7f('0x26')](function(_0x41801b){_0x591883['count']=_0x41801b;if(_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x44')]){_0x478db1[_0x8e7f('0x45')]=[{'all':!![]}];}return db['Team'][_0x8e7f('0x46')](_0x478db1);})[_0x8e7f('0x26')](function(_0x189265){_0x591883['rows']=_0x189265;return _0x591883;})['then'](respondWithFilteredResult(_0x136e4f,_0x478db1))[_0x8e7f('0x47')](handleError(_0x136e4f,null));};exports[_0x8e7f('0x48')]=function(_0x235c4a,_0x5291c2){var _0x4452fd={'raw':![],'where':{'id':_0x235c4a[_0x8e7f('0x49')]['id']}},_0xbf8439={};_0xbf8439['model']=_[_0x8e7f('0x37')](db[_0x8e7f('0x31')][_0x8e7f('0x32')]);_0xbf8439['query']=_[_0x8e7f('0x37')](_0x235c4a[_0x8e7f('0x36')]);_0xbf8439[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0xbf8439['model'],_0xbf8439['query']);_0x4452fd['attributes']=_[_0x8e7f('0x39')](_0xbf8439[_0x8e7f('0x35')],qs[_0x8e7f('0x3b')](_0x235c4a[_0x8e7f('0x36')]['fields']));_0x4452fd[_0x8e7f('0x3a')]=_0x4452fd[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x4452fd[_0x8e7f('0x3a')]:_0xbf8439['model'];if(_0x235c4a[_0x8e7f('0x36')][_0x8e7f('0x44')]){_0x4452fd[_0x8e7f('0x45')]=[{'all':!![]}];}_0x4452fd=_[_0x8e7f('0x4a')]({},_0x4452fd,_0x235c4a[_0x8e7f('0x43')]);return db['Team'][_0x8e7f('0x4b')](_0x4452fd)[_0x8e7f('0x26')](handleEntityNotFound(_0x5291c2,null))[_0x8e7f('0x26')](respondWithResult(_0x5291c2,null))[_0x8e7f('0x47')](handleError(_0x5291c2,null));};exports[_0x8e7f('0x4c')]=function(_0x58a947,_0x1973cc){return db[_0x8e7f('0x31')][_0x8e7f('0x4c')](_0x58a947[_0x8e7f('0x4d')],{})['then'](function(_0xfa1e6c){var _0x4ca0fb=_0x58a947[_0x8e7f('0x4e')][_0x8e7f('0x27')]({'plain':!![]});if(!_0x4ca0fb)throw new Error(_0x8e7f('0x4f'));if(_0x4ca0fb['role']===_0x8e7f('0x4e')){var _0x4f1b5c=_0xfa1e6c[_0x8e7f('0x27')]({'plain':!![]});var _0x2c5217=_0x8e7f('0x28');return db[_0x8e7f('0x50')][_0x8e7f('0x4b')]({'where':{'name':_0x2c5217,'userProfileId':_0x4ca0fb['userProfileId']},'raw':!![]})[_0x8e7f('0x26')](function(_0x854ebc){if(_0x854ebc&&_0x854ebc[_0x8e7f('0x51')]===0x0){return db[_0x8e7f('0x29')][_0x8e7f('0x4c')]({'name':_0x4f1b5c[_0x8e7f('0x2d')],'resourceId':_0x4f1b5c['id'],'type':_0x854ebc[_0x8e7f('0x2d')],'sectionId':_0x854ebc['id']},{})['then'](function(){return _0xfa1e6c;});}else{return _0xfa1e6c;}})[_0x8e7f('0x47')](function(_0x254f3d){logger[_0x8e7f('0x2b')](_0x8e7f('0x52'),_0x254f3d);throw _0x254f3d;});}return _0xfa1e6c;})[_0x8e7f('0x26')](respondWithResult(_0x1973cc,0xc9))[_0x8e7f('0x47')](handleError(_0x1973cc,null));};exports[_0x8e7f('0x25')]=function(_0x4b6565,_0x4fa6ab){if(_0x4b6565[_0x8e7f('0x4d')]['id']){delete _0x4b6565[_0x8e7f('0x4d')]['id'];}return db[_0x8e7f('0x31')][_0x8e7f('0x4b')]({'where':{'id':_0x4b6565[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x4fa6ab,null))[_0x8e7f('0x26')](saveUpdates(_0x4b6565[_0x8e7f('0x4d')],null))['then'](respondWithResult(_0x4fa6ab,null))[_0x8e7f('0x47')](handleError(_0x4fa6ab,null));};exports['destroy']=function(_0x2f7acd,_0x451f0d){return db[_0x8e7f('0x31')][_0x8e7f('0x4b')]({'where':{'id':_0x2f7acd[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x451f0d,null))[_0x8e7f('0x26')](removeEntity(_0x451f0d,null))['catch'](handleError(_0x451f0d,null));};exports[_0x8e7f('0x53')]=function(_0x34c8b9,_0x48546e,_0x18bea7){return db[_0x8e7f('0x31')][_0x8e7f('0x54')]({'where':{'id':_0x34c8b9[_0x8e7f('0x49')]['id']}})['then'](handleEntityNotFound(_0x48546e,null))[_0x8e7f('0x26')](function(_0x4d50e9){if(!_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x55')]||!utils[_0x8e7f('0x56')](_0x34c8b9['query'][_0x8e7f('0x55')])){throw new db[(_0x8e7f('0x57'))]['ValidationError'](_0x8e7f('0x58'));}var _0x4bd2bf={};var _0x2de18c={};_0x2de18c[_0x8e7f('0x35')]=_['keys'](db[_[_0x8e7f('0x59')](_0x34c8b9['query'][_0x8e7f('0x55')][_0x8e7f('0x5a')]())+'Queue'][_0x8e7f('0x32')]);_0x2de18c[_0x8e7f('0x36')]=_['keys'](_0x34c8b9[_0x8e7f('0x36')]);_0x2de18c[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0x2de18c['model'],_0x2de18c[_0x8e7f('0x36')]);_0x4bd2bf[_0x8e7f('0x3a')]=_[_0x8e7f('0x39')](_0x2de18c['model'],qs[_0x8e7f('0x3b')](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x3b')]));_0x4bd2bf[_0x8e7f('0x3a')]=_0x4bd2bf[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x4bd2bf[_0x8e7f('0x3a')]:_0x2de18c[_0x8e7f('0x35')];_0x4bd2bf['limit']=qs[_0x8e7f('0x3d')](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x3d')]);_0x4bd2bf[_0x8e7f('0x20')]=qs['offset'](_0x34c8b9['query'][_0x8e7f('0x20')]);_0x4bd2bf[_0x8e7f('0x3e')]=qs[_0x8e7f('0x3f')](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x3f')]);_0x4bd2bf[_0x8e7f('0x40')]=qs[_0x8e7f('0x38')](_['pick'](_0x34c8b9[_0x8e7f('0x36')],_0x2de18c['filters']));_0x4bd2bf=_['merge']({},_0x4bd2bf,_0x34c8b9[_0x8e7f('0x43')]);return _0x4d50e9['get'+_['capitalize'](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x55')][_0x8e7f('0x5a')]())+'Queues'](_0x4bd2bf);})[_0x8e7f('0x26')](respondWithResult(_0x48546e,null))[_0x8e7f('0x47')](handleError(_0x48546e,null));};exports['addQueues']=function(_0x4c0fc8,_0x2aee99,_0x2d9ee6){return db[_0x8e7f('0x31')]['findOne']({'where':{'id':_0x4c0fc8[_0x8e7f('0x49')]['id']}})['then'](function(_0x551178){if(_0x551178){if(!_0x4c0fc8[_0x8e7f('0x4d')][_0x8e7f('0x55')]||!utils[_0x8e7f('0x56')](_0x4c0fc8['body'][_0x8e7f('0x55')])){throw new db['Sequelize']['ValidationError'](_0x8e7f('0x58'));}return _0x551178['add'+_[_0x8e7f('0x59')](_0x4c0fc8['body']['channel'][_0x8e7f('0x5a')]())+_0x8e7f('0x5b')](_0x4c0fc8[_0x8e7f('0x4d')][_0x8e7f('0x5c')]);}return null;})[_0x8e7f('0x26')](handleEntityNotFound(_0x2aee99,null))[_0x8e7f('0x26')](respondWithStatusCode(_0x2aee99,null))[_0x8e7f('0x47')](handleError(_0x2aee99,null));};exports[_0x8e7f('0x5d')]=function(_0x36f595,_0x296dd4,_0x2345ae){return db[_0x8e7f('0x31')][_0x8e7f('0x54')]({'where':{'id':_0x36f595[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](function(_0x168e81){if(_0x168e81){if(!_0x36f595[_0x8e7f('0x36')]['channel']||!utils['isValidChannel'](_0x36f595[_0x8e7f('0x36')][_0x8e7f('0x55')])){throw new db[(_0x8e7f('0x57'))][(_0x8e7f('0x5e'))]('Unknown\x20channel');}return _0x168e81[_0x8e7f('0x5f')+_[_0x8e7f('0x59')](_0x36f595['query'][_0x8e7f('0x55')]['toLowerCase']())+'Queues'](_0x36f595['query'][_0x8e7f('0x5c')]);}return null;})[_0x8e7f('0x26')](handleEntityNotFound(_0x296dd4,null))[_0x8e7f('0x26')](respondWithStatusCode(_0x296dd4,null))[_0x8e7f('0x47')](handleError(_0x296dd4,null));};exports[_0x8e7f('0x60')]=function(_0x5a1944,_0x4c981f,_0x3f1776){return db['Team'][_0x8e7f('0x4b')]({'where':{'id':_0x5a1944[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x4c981f,null))['then'](function(_0x503798){if(_0x503798){var _0x1ae8a6=[_0x8e7f('0x61'),_0x8e7f('0x62'),_0x8e7f('0x63'),_0x8e7f('0x64'),_0x8e7f('0x65'),_0x8e7f('0x66'),_0x8e7f('0x67')];return BPromise[_0x8e7f('0x68')](_0x1ae8a6,function(_0x8abec6){return _0x503798[_0x8e7f('0x27')+_0x8abec6+_0x8e7f('0x5b')]({'attributes':['id',_0x8e7f('0x2d')]})[_0x8e7f('0x26')](function(_0x32ab34){return BPromise['each'](_0x32ab34,function(_0x57b50d){return _0x57b50d[_0x8e7f('0x60')](_0x5a1944[_0x8e7f('0x4d')]['ids'])[_0x8e7f('0x26')](function(){if(_0x8abec6===_0x8e7f('0x61')){return db['User'][_0x8e7f('0x46')]({'where':{'id':_0x5a1944[_0x8e7f('0x4d')]['ids']},'attributes':['id',_0x8e7f('0x2d'),'online',_0x8e7f('0x69'),_0x8e7f('0x6a')],'raw':!![]})['then'](function(_0x5a6f5a){return BPromise['each'](_['filter'](_0x5a6f5a,{'online':0x1}),function(_0x2b3872){return db[_0x8e7f('0x6b')][_0x8e7f('0x6c')]({'membername':_0x2b3872[_0x8e7f('0x2d')],'UserId':_0x2b3872['id'],'queue_name':_0x57b50d[_0x8e7f('0x2d')],'VoiceQueueId':_0x57b50d['id'],'interface':_[_0x8e7f('0x6d')](_0x2b3872[_0x8e7f('0x6a')])?util[_0x8e7f('0x6e')](_0x8e7f('0x6f'),_0x2b3872[_0x8e7f('0x2d')]):_0x2b3872['interface'],'paused':_0x2b3872[_0x8e7f('0x69')]||![],'penalty':0x0});});});}});});})[_0x8e7f('0x26')](function(){return _0x503798;});})[_0x8e7f('0x26')](function(){return _0x503798;});}})['then'](function(_0x427031){if(_0x427031){return _0x427031[_0x8e7f('0x60')](_0x5a1944[_0x8e7f('0x4d')]['ids'],_[_0x8e7f('0x70')](_0x5a1944[_0x8e7f('0x4d')],[_0x8e7f('0x5c'),'id'])||{})[_0x8e7f('0x71')](function(_0x569604){for(var _0x1ecc25=0x0;_0x1ecc25<_0x5a1944[_0x8e7f('0x4d')]['ids'][_0x8e7f('0x3c')];_0x1ecc25+=0x1){socket[_0x8e7f('0x72')](_0x8e7f('0x73'),{'UserId':_0x5a1944[_0x8e7f('0x4d')][_0x8e7f('0x5c')][_0x1ecc25],'TeamId':_0x5a1944[_0x8e7f('0x49')]['id']});}return _0x569604;});}})[_0x8e7f('0x26')](respondWithResult(_0x4c981f,null))[_0x8e7f('0x47')](handleError(_0x4c981f,null));};exports['removeAgents']=function(_0x398e6e,_0x5a18d4,_0x16ffb9){return db[_0x8e7f('0x31')]['find']({'where':{'id':_0x398e6e['params']['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x5a18d4,null))['then'](function(_0x11ca55){if(_0x11ca55){return BPromise[_0x8e7f('0x68')]([_0x8e7f('0x74'),_0x8e7f('0x75'),_0x8e7f('0x76'),_0x8e7f('0x77'),'fax',_0x8e7f('0x78'),_0x8e7f('0x79')],function(_0x277c38){return _0x11ca55[_0x8e7f('0x27')+_[_0x8e7f('0x59')](_0x277c38)+_0x8e7f('0x5b')]({'attributes':['id',_0x8e7f('0x2d')]})[_0x8e7f('0x26')](function(_0x213399){return BPromise[_0x8e7f('0x68')](_0x213399,function(_0x389489){return _0x389489[_0x8e7f('0x7a')](_0x398e6e['query'][_0x8e7f('0x5c')])[_0x8e7f('0x26')](function(){if(_0x277c38===_0x8e7f('0x74')){return db[_0x8e7f('0x6b')][_0x8e7f('0x7b')]({'where':{'VoiceQueueId':_0x389489['id'],'UserId':_0x398e6e['query'][_0x8e7f('0x5c')]}});}});});})[_0x8e7f('0x26')](function(){return _0x11ca55;});})[_0x8e7f('0x26')](function(){return _0x11ca55;});}})['then'](function(_0x5f2164){if(_0x5f2164){return _0x5f2164[_0x8e7f('0x7a')](_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')])[_0x8e7f('0x26')](function(){if(_['isArray'](_0x398e6e[_0x8e7f('0x36')]['ids'])){for(var _0x5caf4c=0x0;_0x5caf4c<_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')][_0x8e7f('0x3c')];_0x5caf4c+=0x1){socket[_0x8e7f('0x72')](_0x8e7f('0x7c'),{'UserId':Number(_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')][_0x5caf4c]),'TeamId':Number(_0x398e6e[_0x8e7f('0x49')]['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')]),'TeamId':Number(_0x398e6e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5a18d4,null))['catch'](handleError(_0x5a18d4,null));};exports['getAgents']=function(_0x3060ec,_0x31d388,_0x1bddde){var _0x20d99b={};var _0x225634={};var _0x3f10f1;var _0x46a907;return db[_0x8e7f('0x31')][_0x8e7f('0x54')]({'where':{'id':_0x3060ec[_0x8e7f('0x49')]['id']}})['then'](handleEntityNotFound(_0x31d388,null))['then'](function(_0x5943a8){if(_0x5943a8){_0x3f10f1=_0x5943a8;_0x225634[_0x8e7f('0x35')]=_[_0x8e7f('0x37')](db[_0x8e7f('0x7d')][_0x8e7f('0x32')]);_0x225634[_0x8e7f('0x36')]=_[_0x8e7f('0x37')](_0x3060ec['query']);_0x225634[_0x8e7f('0x38')]=_['intersection'](_0x225634[_0x8e7f('0x35')],_0x225634[_0x8e7f('0x36')]);_0x20d99b[_0x8e7f('0x3a')]=_['intersection'](_0x225634[_0x8e7f('0x35')],qs['fields'](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x3b')]));_0x20d99b['attributes']=_0x20d99b[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x20d99b[_0x8e7f('0x3a')]:_0x225634[_0x8e7f('0x35')];_0x20d99b['order']=qs[_0x8e7f('0x3f')](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x3f')]);_0x20d99b[_0x8e7f('0x40')]=qs['filters'](_['pick'](_0x3060ec[_0x8e7f('0x36')],_0x225634[_0x8e7f('0x38')]));if(_0x3060ec['query'][_0x8e7f('0x42')]){_0x20d99b['where']=_[_0x8e7f('0x4a')](_0x20d99b[_0x8e7f('0x40')],{'$or':_[_0x8e7f('0x30')](_0x20d99b[_0x8e7f('0x3a')],function(_0xd9715c){var _0x4829ba={};_0x4829ba[_0xd9715c]={'$like':'%'+_0x3060ec[_0x8e7f('0x36')]['filter']+'%'};return _0x4829ba;})});}_0x20d99b=_['merge']({},_0x20d99b,_0x3060ec['options']);return _0x3f10f1['getAgents'](_0x20d99b);}})['then'](function(_0xf62561){if(_0xf62561){_0x46a907=_0xf62561[_0x8e7f('0x3c')];if(!_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x7e')](_0x8e7f('0x7f'))){_0x20d99b[_0x8e7f('0x3d')]=qs[_0x8e7f('0x3d')](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x3d')]);_0x20d99b[_0x8e7f('0x20')]=qs[_0x8e7f('0x20')](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x20')]);}return _0x3f10f1[_0x8e7f('0x80')](_0x20d99b);}})['then'](function(_0x222fad){if(_0x222fad){return _0x222fad?{'count':_0x46a907,'rows':_0x222fad}:null;}})[_0x8e7f('0x26')](respondWithResult(_0x31d388,null))[_0x8e7f('0x47')](handleError(_0x31d388,null));}; \ No newline at end of file +var _0x3a34=['role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','order','toLowerCase','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Voice','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','upsert','isNil','SIP/%s','omit','spread','emit','removeAgents','sms','fax','whatsapp','voice','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','get','Teams','UserProfileResource','then','stack','name','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5be1ac,_0x5ee1f4){var _0x21b996=function(_0x377104){while(--_0x377104){_0x5be1ac['push'](_0x5be1ac['shift']());}};_0x21b996(++_0x5ee1f4);}(_0x3a34,0xb3));var _0x43a3=function(_0x2e440b,_0x540f27){_0x2e440b=_0x2e440b-0x0;var _0x46e1a4=_0x3a34[_0x2e440b];return _0x46e1a4;};'use strict';var pdf=require(_0x43a3('0x0'));var emlformat=require(_0x43a3('0x1'));var rimraf=require(_0x43a3('0x2'));var zipdir=require(_0x43a3('0x3'));var jsonpatch=require(_0x43a3('0x4'));var rp=require(_0x43a3('0x5'));var moment=require('moment');var BPromise=require(_0x43a3('0x6'));var Mustache=require(_0x43a3('0x7'));var util=require(_0x43a3('0x8'));var path=require('path');var sox=require(_0x43a3('0x9'));var csv=require('to-csv');var ejs=require(_0x43a3('0xa'));var fs=require('fs');var _=require(_0x43a3('0xb'));var squel=require(_0x43a3('0xc'));var crypto=require(_0x43a3('0xd'));var jsforce=require(_0x43a3('0xe'));var deskjs=require(_0x43a3('0xf'));var toCsv=require(_0x43a3('0x10'));var querystring=require('querystring');var Papa=require(_0x43a3('0x11'));var Redis=require('ioredis');var authService=require(_0x43a3('0x12'));var qs=require(_0x43a3('0x13'));var as=require(_0x43a3('0x14'));var hardwareService=require(_0x43a3('0x15'));var logger=require('../../config/logger')(_0x43a3('0x16'));var utils=require(_0x43a3('0x17'));var config=require(_0x43a3('0x18'));var licenseUtil=require(_0x43a3('0x19'));var db=require(_0x43a3('0x1a'))['db'];config[_0x43a3('0x1b')]=_[_0x43a3('0x1c')](config[_0x43a3('0x1b')],{'host':_0x43a3('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x43a3('0x1e'))['register'](socket);function respondWithStatusCode(_0x2bbbeb,_0x20b93a){_0x20b93a=_0x20b93a||0xcc;return function(_0x429138){if(_0x429138){return _0x2bbbeb[_0x43a3('0x1f')](_0x20b93a);}return _0x2bbbeb['status'](_0x20b93a)[_0x43a3('0x20')]();};}function respondWithResult(_0x11633c,_0x525fb2){_0x525fb2=_0x525fb2||0xc8;return function(_0x3f7346){if(_0x3f7346){return _0x11633c[_0x43a3('0x21')](_0x525fb2)['json'](_0x3f7346);}};}function respondWithFilteredResult(_0x577552,_0x4588b9){return function(_0x1a0e43){if(_0x1a0e43){var _0x5773d3=_0x1a0e43[_0x43a3('0x22')],_0x4a26a4=_0x4588b9[_0x43a3('0x23')],_0x9f22b9=_0x4588b9[_0x43a3('0x23')]+_0x4588b9[_0x43a3('0x24')],_0x4af6e3;if(_0x9f22b9>=_0x5773d3){_0x9f22b9=_0x5773d3;_0x4af6e3=0xc8;}else{_0x4af6e3=0xce;}_0x577552['status'](_0x4af6e3);return _0x577552[_0x43a3('0x25')](_0x43a3('0x26'),_0x4a26a4+'-'+_0x9f22b9+'/'+_0x5773d3)[_0x43a3('0x27')](_0x1a0e43);}return null;};}function patchUpdates(_0x42c6a3){return function(_0x4e758b){try{jsonpatch['apply'](_0x4e758b,_0x42c6a3,!![]);}catch(_0x31b748){return BPromise[_0x43a3('0x28')](_0x31b748);}return _0x4e758b[_0x43a3('0x29')]();};}function saveUpdates(_0x24ff97,_0x3d5d2c){return function(_0x5b42e9){if(_0x5b42e9){return _0x5b42e9[_0x43a3('0x2a')](_0x24ff97)['then'](function(_0x3c5b6b){return _0x3c5b6b;});}return null;};}function removeEntity(_0x4bb7e7,_0x1a016b){return function(_0x21b015){if(_0x21b015){return _0x21b015[_0x43a3('0x2b')]()['then'](function(){var _0x4184df=_0x21b015[_0x43a3('0x2c')]({'plain':!![]});var _0xabcddc=_0x43a3('0x2d');return db[_0x43a3('0x2e')]['destroy']({'where':{'type':_0xabcddc,'resourceId':_0x4184df['id']}})[_0x43a3('0x2f')](function(){return _0x21b015;});})[_0x43a3('0x2f')](function(){_0x4bb7e7[_0x43a3('0x21')](0xcc)[_0x43a3('0x20')]();});}};}function handleEntityNotFound(_0x286be4,_0x14cd43){return function(_0x5c4e31){if(!_0x5c4e31){_0x286be4[_0x43a3('0x1f')](0x194);}return _0x5c4e31;};}function handleError(_0x39b380,_0x3ab218){_0x3ab218=_0x3ab218||0x1f4;return function(_0x1384dc){logger['error'](_0x1384dc[_0x43a3('0x30')]);if(_0x1384dc[_0x43a3('0x31')]){delete _0x1384dc['name'];}_0x39b380[_0x43a3('0x21')](_0x3ab218)['send'](_0x1384dc);};}exports['index']=function(_0x1fe3b6,_0x67e299){var _0x3bca53={},_0xb1a9f0={},_0x4d4036={'count':0x0,'rows':[]};var _0x30d6d6=_['map'](db['Team']['rawAttributes'],function(_0x16373a){return{'name':_0x16373a['fieldName'],'type':_0x16373a[_0x43a3('0x32')][_0x43a3('0x33')]};});_0xb1a9f0[_0x43a3('0x34')]=_['map'](_0x30d6d6,'name');_0xb1a9f0[_0x43a3('0x35')]=_[_0x43a3('0x36')](_0x1fe3b6['query']);_0xb1a9f0[_0x43a3('0x37')]=_['intersection'](_0xb1a9f0[_0x43a3('0x34')],_0xb1a9f0[_0x43a3('0x35')]);_0x3bca53[_0x43a3('0x38')]=_['intersection'](_0xb1a9f0[_0x43a3('0x34')],qs[_0x43a3('0x39')](_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x39')]));_0x3bca53[_0x43a3('0x38')]=_0x3bca53['attributes'][_0x43a3('0x3a')]?_0x3bca53[_0x43a3('0x38')]:_0xb1a9f0[_0x43a3('0x34')];if(!_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x3b')](_0x43a3('0x3c'))){_0x3bca53['limit']=qs[_0x43a3('0x24')](_0x1fe3b6['query'][_0x43a3('0x24')]);_0x3bca53[_0x43a3('0x23')]=qs[_0x43a3('0x23')](_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x23')]);}_0x3bca53['order']=qs[_0x43a3('0x3d')](_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x3d')]);_0x3bca53['where']=qs[_0x43a3('0x37')](_[_0x43a3('0x3e')](_0x1fe3b6[_0x43a3('0x35')],_0xb1a9f0[_0x43a3('0x37')]),_0x30d6d6);if(_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x3f')]){_0x3bca53[_0x43a3('0x40')]=_[_0x43a3('0x41')](_0x3bca53[_0x43a3('0x40')],{'$or':_[_0x43a3('0x42')](_0x30d6d6,function(_0x2ada71){if(_0x2ada71[_0x43a3('0x32')]!==_0x43a3('0x43')){var _0x348aa5={};_0x348aa5[_0x2ada71['name']]={'$like':'%'+_0x1fe3b6['query'][_0x43a3('0x3f')]+'%'};return _0x348aa5;}})});}_0x3bca53=_[_0x43a3('0x41')]({},_0x3bca53,_0x1fe3b6[_0x43a3('0x44')]);var _0x2c595e={'where':_0x3bca53[_0x43a3('0x40')]};return db[_0x43a3('0x45')]['count'](_0x2c595e)['then'](function(_0x157d22){_0x4d4036[_0x43a3('0x22')]=_0x157d22;if(_0x1fe3b6[_0x43a3('0x35')][_0x43a3('0x46')]){_0x3bca53[_0x43a3('0x47')]=[{'all':!![]}];}return db[_0x43a3('0x45')][_0x43a3('0x48')](_0x3bca53);})[_0x43a3('0x2f')](function(_0x4ae273){_0x4d4036[_0x43a3('0x49')]=_0x4ae273;return _0x4d4036;})[_0x43a3('0x2f')](respondWithFilteredResult(_0x67e299,_0x3bca53))[_0x43a3('0x4a')](handleError(_0x67e299,null));};exports[_0x43a3('0x4b')]=function(_0x5e3716,_0x403e71){var _0x46d122={'raw':![],'where':{'id':_0x5e3716[_0x43a3('0x4c')]['id']}},_0x5cb571={};_0x5cb571[_0x43a3('0x34')]=_[_0x43a3('0x36')](db[_0x43a3('0x45')][_0x43a3('0x4d')]);_0x5cb571[_0x43a3('0x35')]=_['keys'](_0x5e3716[_0x43a3('0x35')]);_0x5cb571[_0x43a3('0x37')]=_[_0x43a3('0x4e')](_0x5cb571[_0x43a3('0x34')],_0x5cb571[_0x43a3('0x35')]);_0x46d122[_0x43a3('0x38')]=_[_0x43a3('0x4e')](_0x5cb571['model'],qs['fields'](_0x5e3716['query']['fields']));_0x46d122[_0x43a3('0x38')]=_0x46d122[_0x43a3('0x38')][_0x43a3('0x3a')]?_0x46d122[_0x43a3('0x38')]:_0x5cb571[_0x43a3('0x34')];if(_0x5e3716[_0x43a3('0x35')][_0x43a3('0x46')]){_0x46d122['include']=[{'all':!![]}];}_0x46d122=_[_0x43a3('0x41')]({},_0x46d122,_0x5e3716[_0x43a3('0x44')]);return db['Team'][_0x43a3('0x4f')](_0x46d122)[_0x43a3('0x2f')](handleEntityNotFound(_0x403e71,null))[_0x43a3('0x2f')](respondWithResult(_0x403e71,null))[_0x43a3('0x4a')](handleError(_0x403e71,null));};exports[_0x43a3('0x50')]=function(_0xd36bc1,_0xef0314){return db[_0x43a3('0x45')]['create'](_0xd36bc1['body'],{})[_0x43a3('0x2f')](function(_0x32d467){var _0x59ec44=_0xd36bc1[_0x43a3('0x51')][_0x43a3('0x2c')]({'plain':!![]});if(!_0x59ec44)throw new Error(_0x43a3('0x52'));if(_0x59ec44[_0x43a3('0x53')]===_0x43a3('0x51')){var _0x156736=_0x32d467[_0x43a3('0x2c')]({'plain':!![]});var _0x1bcd71=_0x43a3('0x2d');return db[_0x43a3('0x54')][_0x43a3('0x4f')]({'where':{'name':_0x1bcd71,'userProfileId':_0x59ec44[_0x43a3('0x55')]},'raw':!![]})['then'](function(_0x523e84){if(_0x523e84&&_0x523e84['autoAssociation']===0x0){return db[_0x43a3('0x2e')][_0x43a3('0x50')]({'name':_0x156736[_0x43a3('0x31')],'resourceId':_0x156736['id'],'type':_0x523e84[_0x43a3('0x31')],'sectionId':_0x523e84['id']},{})[_0x43a3('0x2f')](function(){return _0x32d467;});}else{return _0x32d467;}})[_0x43a3('0x4a')](function(_0x226f32){logger[_0x43a3('0x56')](_0x43a3('0x57'),_0x226f32);throw _0x226f32;});}return _0x32d467;})[_0x43a3('0x2f')](respondWithResult(_0xef0314,0xc9))[_0x43a3('0x4a')](handleError(_0xef0314,null));};exports[_0x43a3('0x2a')]=function(_0x59fd22,_0x5aa68f){if(_0x59fd22['body']['id']){delete _0x59fd22[_0x43a3('0x58')]['id'];}return db[_0x43a3('0x45')][_0x43a3('0x4f')]({'where':{'id':_0x59fd22[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x5aa68f,null))['then'](saveUpdates(_0x59fd22[_0x43a3('0x58')],null))[_0x43a3('0x2f')](respondWithResult(_0x5aa68f,null))[_0x43a3('0x4a')](handleError(_0x5aa68f,null));};exports[_0x43a3('0x2b')]=function(_0x5b8f9e,_0x22f4e6){return db[_0x43a3('0x45')][_0x43a3('0x4f')]({'where':{'id':_0x5b8f9e[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x22f4e6,null))[_0x43a3('0x2f')](removeEntity(_0x22f4e6,null))[_0x43a3('0x4a')](handleError(_0x22f4e6,null));};exports[_0x43a3('0x59')]=function(_0x241550,_0x96522c,_0x363da0){return db[_0x43a3('0x45')][_0x43a3('0x5a')]({'where':{'id':_0x241550['params']['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x96522c,null))[_0x43a3('0x2f')](function(_0x2d780e){if(!_0x241550[_0x43a3('0x35')][_0x43a3('0x5b')]||!utils[_0x43a3('0x5c')](_0x241550[_0x43a3('0x35')][_0x43a3('0x5b')])){throw new db[(_0x43a3('0x5d'))][(_0x43a3('0x5e'))](_0x43a3('0x5f'));}var _0x5631f6={};var _0x1168ed={};_0x1168ed['model']=_[_0x43a3('0x36')](db[_[_0x43a3('0x60')](_0x241550['query']['channel']['toLowerCase']())+_0x43a3('0x61')][_0x43a3('0x4d')]);_0x1168ed[_0x43a3('0x35')]=_['keys'](_0x241550[_0x43a3('0x35')]);_0x1168ed[_0x43a3('0x37')]=_[_0x43a3('0x4e')](_0x1168ed[_0x43a3('0x34')],_0x1168ed[_0x43a3('0x35')]);_0x5631f6[_0x43a3('0x38')]=_[_0x43a3('0x4e')](_0x1168ed[_0x43a3('0x34')],qs['fields'](_0x241550[_0x43a3('0x35')][_0x43a3('0x39')]));_0x5631f6[_0x43a3('0x38')]=_0x5631f6[_0x43a3('0x38')]['length']?_0x5631f6[_0x43a3('0x38')]:_0x1168ed[_0x43a3('0x34')];_0x5631f6[_0x43a3('0x24')]=qs[_0x43a3('0x24')](_0x241550[_0x43a3('0x35')][_0x43a3('0x24')]);_0x5631f6['offset']=qs['offset'](_0x241550[_0x43a3('0x35')][_0x43a3('0x23')]);_0x5631f6[_0x43a3('0x62')]=qs['sort'](_0x241550[_0x43a3('0x35')][_0x43a3('0x3d')]);_0x5631f6[_0x43a3('0x40')]=qs['filters'](_[_0x43a3('0x3e')](_0x241550[_0x43a3('0x35')],_0x1168ed[_0x43a3('0x37')]));_0x5631f6=_['merge']({},_0x5631f6,_0x241550['options']);return _0x2d780e[_0x43a3('0x2c')+_['capitalize'](_0x241550[_0x43a3('0x35')]['channel'][_0x43a3('0x63')]())+_0x43a3('0x64')](_0x5631f6);})[_0x43a3('0x2f')](respondWithResult(_0x96522c,null))[_0x43a3('0x4a')](handleError(_0x96522c,null));};exports[_0x43a3('0x65')]=function(_0x3e5cff,_0x747206,_0x124597){return db[_0x43a3('0x45')]['findOne']({'where':{'id':_0x3e5cff[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](function(_0x208c86){if(_0x208c86){if(!_0x3e5cff[_0x43a3('0x58')]['channel']||!utils[_0x43a3('0x5c')](_0x3e5cff['body']['channel'])){throw new db[(_0x43a3('0x5d'))]['ValidationError'](_0x43a3('0x5f'));}return _0x208c86[_0x43a3('0x66')+_[_0x43a3('0x60')](_0x3e5cff[_0x43a3('0x58')][_0x43a3('0x5b')][_0x43a3('0x63')]())+_0x43a3('0x64')](_0x3e5cff[_0x43a3('0x58')][_0x43a3('0x67')]);}return null;})['then'](handleEntityNotFound(_0x747206,null))[_0x43a3('0x2f')](respondWithStatusCode(_0x747206,null))[_0x43a3('0x4a')](handleError(_0x747206,null));};exports[_0x43a3('0x68')]=function(_0x2edf60,_0x2b8be0,_0x20bdf6){return db[_0x43a3('0x45')]['findOne']({'where':{'id':_0x2edf60[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](function(_0xa2c299){if(_0xa2c299){if(!_0x2edf60[_0x43a3('0x35')]['channel']||!utils['isValidChannel'](_0x2edf60[_0x43a3('0x35')]['channel'])){throw new db['Sequelize'][(_0x43a3('0x5e'))]('Unknown\x20channel');}return _0xa2c299[_0x43a3('0x69')+_['capitalize'](_0x2edf60['query'][_0x43a3('0x5b')][_0x43a3('0x63')]())+'Queues'](_0x2edf60[_0x43a3('0x35')][_0x43a3('0x67')]);}return null;})[_0x43a3('0x2f')](handleEntityNotFound(_0x2b8be0,null))[_0x43a3('0x2f')](respondWithStatusCode(_0x2b8be0,null))['catch'](handleError(_0x2b8be0,null));};exports[_0x43a3('0x6a')]=function(_0x294ec2,_0x8576e8,_0x5961b7){return db[_0x43a3('0x45')][_0x43a3('0x4f')]({'where':{'id':_0x294ec2[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x8576e8,null))['then'](function(_0x459809){if(_0x459809){var _0x591ea5=[_0x43a3('0x6b'),'Chat','Mail','Sms',_0x43a3('0x6c'),_0x43a3('0x6d'),_0x43a3('0x6e')];return BPromise[_0x43a3('0x6f')](_0x591ea5,function(_0xfe3353){return _0x459809[_0x43a3('0x2c')+_0xfe3353+'Queues']({'attributes':['id',_0x43a3('0x31')]})[_0x43a3('0x2f')](function(_0x15340a){return BPromise[_0x43a3('0x6f')](_0x15340a,function(_0x12f8c0){return _0x12f8c0[_0x43a3('0x6a')](_0x294ec2['body'][_0x43a3('0x67')])[_0x43a3('0x2f')](function(){if(_0xfe3353===_0x43a3('0x6b')){return db[_0x43a3('0x70')][_0x43a3('0x48')]({'where':{'id':_0x294ec2[_0x43a3('0x58')]['ids']},'attributes':['id','name',_0x43a3('0x71'),_0x43a3('0x72'),_0x43a3('0x73')],'raw':!![]})[_0x43a3('0x2f')](function(_0x7f0668){return BPromise[_0x43a3('0x6f')](_['filter'](_0x7f0668,{'online':0x1}),function(_0x295b76){return db['UserVoiceQueueRt'][_0x43a3('0x74')]({'membername':_0x295b76['name'],'UserId':_0x295b76['id'],'queue_name':_0x12f8c0[_0x43a3('0x31')],'VoiceQueueId':_0x12f8c0['id'],'interface':_[_0x43a3('0x75')](_0x295b76['interface'])?util['format'](_0x43a3('0x76'),_0x295b76['name']):_0x295b76['interface'],'paused':_0x295b76[_0x43a3('0x72')]||![],'penalty':0x0});});});}});});})[_0x43a3('0x2f')](function(){return _0x459809;});})[_0x43a3('0x2f')](function(){return _0x459809;});}})['then'](function(_0xf472f1){if(_0xf472f1){return _0xf472f1['addAgents'](_0x294ec2[_0x43a3('0x58')][_0x43a3('0x67')],_[_0x43a3('0x77')](_0x294ec2[_0x43a3('0x58')],[_0x43a3('0x67'),'id'])||{})[_0x43a3('0x78')](function(_0x10d07d){for(var _0x3ca3bb=0x0;_0x3ca3bb<_0x294ec2['body'][_0x43a3('0x67')][_0x43a3('0x3a')];_0x3ca3bb+=0x1){socket[_0x43a3('0x79')]('userTeam:save',{'UserId':_0x294ec2[_0x43a3('0x58')]['ids'][_0x3ca3bb],'TeamId':_0x294ec2['params']['id']});}return _0x10d07d;});}})[_0x43a3('0x2f')](respondWithResult(_0x8576e8,null))[_0x43a3('0x4a')](handleError(_0x8576e8,null));};exports[_0x43a3('0x7a')]=function(_0x5952d8,_0x48c96d,_0x38e2a9){return db[_0x43a3('0x45')]['find']({'where':{'id':_0x5952d8[_0x43a3('0x4c')]['id']}})[_0x43a3('0x2f')](handleEntityNotFound(_0x48c96d,null))['then'](function(_0x56a7d8){if(_0x56a7d8){return BPromise[_0x43a3('0x6f')](['voice','chat','mail',_0x43a3('0x7b'),_0x43a3('0x7c'),'openchannel',_0x43a3('0x7d')],function(_0x14a02e){return _0x56a7d8['get'+_[_0x43a3('0x60')](_0x14a02e)+_0x43a3('0x64')]({'attributes':['id',_0x43a3('0x31')]})['then'](function(_0x4a8a24){return BPromise[_0x43a3('0x6f')](_0x4a8a24,function(_0x3c375c){return _0x3c375c[_0x43a3('0x7a')](_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')])['then'](function(){if(_0x14a02e===_0x43a3('0x7e')){return db[_0x43a3('0x7f')][_0x43a3('0x2b')]({'where':{'VoiceQueueId':_0x3c375c['id'],'UserId':_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')]}});}});});})['then'](function(){return _0x56a7d8;});})['then'](function(){return _0x56a7d8;});}})[_0x43a3('0x2f')](function(_0x2cc09a){if(_0x2cc09a){return _0x2cc09a['removeAgents'](_0x5952d8['query'][_0x43a3('0x67')])[_0x43a3('0x2f')](function(){if(_[_0x43a3('0x80')](_0x5952d8[_0x43a3('0x35')]['ids'])){for(var _0x1d97f5=0x0;_0x1d97f5<_0x5952d8['query'][_0x43a3('0x67')][_0x43a3('0x3a')];_0x1d97f5+=0x1){socket[_0x43a3('0x79')](_0x43a3('0x81'),{'UserId':Number(_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')][_0x1d97f5]),'TeamId':Number(_0x5952d8['params']['id'])});}}else{socket['emit'](_0x43a3('0x81'),{'UserId':Number(_0x5952d8[_0x43a3('0x35')][_0x43a3('0x67')]),'TeamId':Number(_0x5952d8[_0x43a3('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x48c96d,null))['catch'](handleError(_0x48c96d,null));};exports['getAgents']=function(_0x229528,_0x4cebfd,_0x3ba298){var _0x2b81de={};var _0x1cbbbb={};var _0x171f38;var _0x2dd54f;return db[_0x43a3('0x45')][_0x43a3('0x5a')]({'where':{'id':_0x229528[_0x43a3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4cebfd,null))[_0x43a3('0x2f')](function(_0x52b540){if(_0x52b540){_0x171f38=_0x52b540;_0x1cbbbb[_0x43a3('0x34')]=_[_0x43a3('0x36')](db['User'][_0x43a3('0x4d')]);_0x1cbbbb['query']=_['keys'](_0x229528[_0x43a3('0x35')]);_0x1cbbbb[_0x43a3('0x37')]=_[_0x43a3('0x4e')](_0x1cbbbb['model'],_0x1cbbbb[_0x43a3('0x35')]);_0x2b81de[_0x43a3('0x38')]=_[_0x43a3('0x4e')](_0x1cbbbb[_0x43a3('0x34')],qs[_0x43a3('0x39')](_0x229528['query'][_0x43a3('0x39')]));_0x2b81de['attributes']=_0x2b81de[_0x43a3('0x38')]['length']?_0x2b81de[_0x43a3('0x38')]:_0x1cbbbb[_0x43a3('0x34')];_0x2b81de[_0x43a3('0x62')]=qs[_0x43a3('0x3d')](_0x229528[_0x43a3('0x35')]['sort']);_0x2b81de[_0x43a3('0x40')]=qs[_0x43a3('0x37')](_[_0x43a3('0x3e')](_0x229528[_0x43a3('0x35')],_0x1cbbbb['filters']));if(_0x229528[_0x43a3('0x35')]['filter']){_0x2b81de[_0x43a3('0x40')]=_['merge'](_0x2b81de[_0x43a3('0x40')],{'$or':_['map'](_0x2b81de[_0x43a3('0x38')],function(_0x906258){var _0x2fe586={};_0x2fe586[_0x906258]={'$like':'%'+_0x229528[_0x43a3('0x35')]['filter']+'%'};return _0x2fe586;})});}_0x2b81de=_[_0x43a3('0x41')]({},_0x2b81de,_0x229528[_0x43a3('0x44')]);return _0x171f38[_0x43a3('0x82')](_0x2b81de);}})[_0x43a3('0x2f')](function(_0x482d04){if(_0x482d04){_0x2dd54f=_0x482d04[_0x43a3('0x3a')];if(!_0x229528[_0x43a3('0x35')]['hasOwnProperty'](_0x43a3('0x3c'))){_0x2b81de[_0x43a3('0x24')]=qs[_0x43a3('0x24')](_0x229528[_0x43a3('0x35')][_0x43a3('0x24')]);_0x2b81de[_0x43a3('0x23')]=qs['offset'](_0x229528[_0x43a3('0x35')][_0x43a3('0x23')]);}return _0x171f38[_0x43a3('0x82')](_0x2b81de);}})[_0x43a3('0x2f')](function(_0x12db7b){if(_0x12db7b){return _0x12db7b?{'count':_0x2dd54f,'rows':_0x12db7b}:null;}})[_0x43a3('0x2f')](respondWithResult(_0x4cebfd,null))[_0x43a3('0x4a')](handleError(_0x4cebfd,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 3ec9cac..c694c86 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 _0x3482=['Team','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x117987,_0x483ede){var _0x139f17=function(_0x3cbe98){while(--_0x3cbe98){_0x117987['push'](_0x117987['shift']());}};_0x139f17(++_0x483ede);}(_0x3482,0xea));var _0x2348=function(_0x21b14f,_0x3ed9b9){_0x21b14f=_0x21b14f-0x0;var _0x4c0fd0=_0x3482[_0x21b14f];return _0x4c0fd0;};'use strict';var EventEmitter=require('events');var Team=require(_0x2348('0x0'))['db'][_0x2348('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2348('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3f9f4c){return function(_0x2e3dd4,_0x5c6044,_0x178adb){TeamEvents[_0x2348('0x3')](_0x3f9f4c+':'+_0x2e3dd4['id'],_0x2e3dd4);TeamEvents[_0x2348('0x3')](_0x3f9f4c,_0x2e3dd4);_0x178adb(null);};}for(var e in events){if(events[_0x2348('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xa058=['save','update','hook','exports','events','Team','setMaxListeners'];(function(_0x3b247d,_0xbe4218){var _0x131bcf=function(_0x4882f4){while(--_0x4882f4){_0x3b247d['push'](_0x3b247d['shift']());}};_0x131bcf(++_0xbe4218);}(_0xa058,0x13f));var _0x8a05=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0xa058[_0x5f12fd];return _0x58bd80;};'use strict';var EventEmitter=require(_0x8a05('0x0'));var Team=require('../../mysqldb')['db'][_0x8a05('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x8a05('0x2')](0x0);var events={'afterCreate':_0x8a05('0x3'),'afterUpdate':_0x8a05('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c22a1){return function(_0x1e2be2,_0x525b23,_0x17a00e){TeamEvents['emit'](_0x2c22a1+':'+_0x1e2be2['id'],_0x1e2be2);TeamEvents['emit'](_0x2c22a1,_0x1e2be2);_0x17a00e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x8a05('0x5')](e,emitEvent(event));}}module[_0x8a05('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 3247f9b..35cdfeb 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 _0xea98=['./team.attributes','exports','define','Team','teams','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xea98,0xad));var _0x8ea9=function(_0x18000d,_0x468002){_0x18000d=_0x18000d-0x0;var _0xd06ac0=_0xea98[_0x18000d];return _0xd06ac0;};'use strict';var _=require('lodash');var util=require(_0x8ea9('0x0'));var logger=require(_0x8ea9('0x1'))(_0x8ea9('0x2'));var moment=require(_0x8ea9('0x3'));var BPromise=require(_0x8ea9('0x4'));var rp=require(_0x8ea9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ea9('0x6'));var attributes=require(_0x8ea9('0x7'));module[_0x8ea9('0x8')]=function(_0x292777,_0x5564f5){return _0x292777[_0x8ea9('0x9')](_0x8ea9('0xa'),attributes,{'tableName':_0x8ea9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5163=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x65aab5,_0x46628f){var _0x26fcb0=function(_0x406b40){while(--_0x406b40){_0x65aab5['push'](_0x65aab5['shift']());}};_0x26fcb0(++_0x46628f);}(_0x5163,0x132));var _0x3516=function(_0x4b62e6,_0xf60f50){_0x4b62e6=_0x4b62e6-0x0;var _0x44263d=_0x5163[_0x4b62e6];return _0x44263d;};'use strict';var _=require(_0x3516('0x0'));var util=require(_0x3516('0x1'));var logger=require(_0x3516('0x2'))(_0x3516('0x3'));var moment=require('moment');var BPromise=require(_0x3516('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3516('0x5'));var rimraf=require(_0x3516('0x6'));var config=require(_0x3516('0x7'));var attributes=require(_0x3516('0x8'));module[_0x3516('0x9')]=function(_0x544a0b,_0x1011f2){return _0x544a0b[_0x3516('0xa')](_0x3516('0xb'),attributes,{'tableName':_0x3516('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 359a293..4b18ae9 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 _0x9f5a=['Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then'];(function(_0x111991,_0x383d2f){var _0x45045e=function(_0x20fc9c){while(--_0x20fc9c){_0x111991['push'](_0x111991['shift']());}};_0x45045e(++_0x383d2f);}(_0x9f5a,0xd5));var _0xa9f5=function(_0x37f292,_0x57eb3a){_0x37f292=_0x37f292-0x0;var _0x58540a=_0x9f5a[_0x37f292];return _0x58540a;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var moment=require(_0xa9f5('0x2'));var BPromise=require(_0xa9f5('0x3'));var rs=require(_0xa9f5('0x4'));var fs=require('fs');var Redis=require(_0xa9f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9f5('0x6'));var logger=require(_0xa9f5('0x7'))(_0xa9f5('0x8'));var config=require(_0xa9f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa9f5('0xa')][_0xa9f5('0xb')]({'port':0x232a});config[_0xa9f5('0xc')]=_[_0xa9f5('0xd')](config[_0xa9f5('0xc')],{'host':_0xa9f5('0xe'),'port':0x18eb});var socket=require(_0xa9f5('0xf'))(new Redis(config[_0xa9f5('0xc')]));require(_0xa9f5('0x10'))[_0xa9f5('0x11')](socket);function respondWithRpcPromise(_0x13f17a,_0x2f520c,_0x5c1551){return new BPromise(function(_0x26094a,_0x5e026b){return client['request'](_0x13f17a,_0x5c1551)[_0xa9f5('0x12')](function(_0x2f8686){logger['info'](_0xa9f5('0x13'),_0x2f520c,_0xa9f5('0x14'));logger[_0xa9f5('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x2f520c,_0xa9f5('0x14'),JSON[_0xa9f5('0x16')](_0x2f8686));if(_0x2f8686[_0xa9f5('0x17')]){if(_0x2f8686[_0xa9f5('0x17')][_0xa9f5('0x18')]===0x1f4){logger[_0xa9f5('0x17')](_0xa9f5('0x13'),_0x2f520c,_0x2f8686['error'][_0xa9f5('0x19')]);return _0x5e026b(_0x2f8686[_0xa9f5('0x17')][_0xa9f5('0x19')]);}logger[_0xa9f5('0x17')](_0xa9f5('0x13'),_0x2f520c,_0x2f8686['error'][_0xa9f5('0x19')]);return _0x26094a(_0x2f8686['error']['message']);}else{logger[_0xa9f5('0x1a')]('Team,\x20%s,\x20%s',_0x2f520c,_0xa9f5('0x14'));_0x26094a(_0x2f8686[_0xa9f5('0x1b')][_0xa9f5('0x19')]);}})[_0xa9f5('0x1c')](function(_0x1e81de){logger[_0xa9f5('0x17')]('Team,\x20%s,\x20%s',_0x2f520c,_0x1e81de);_0x5e026b(_0x1e81de);});});} \ No newline at end of file +var _0xfbb4=['request','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xfbb4,0xc1));var _0x4fbb=function(_0x4587bb,_0x14c42b){_0x4587bb=_0x4587bb-0x0;var _0x3ca16a=_0xfbb4[_0x4587bb];return _0x3ca16a;};'use strict';var _=require(_0x4fbb('0x0'));var util=require('util');var moment=require(_0x4fbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4fbb('0x3'));var logger=require(_0x4fbb('0x4'))(_0x4fbb('0x5'));var config=require(_0x4fbb('0x6'));var jayson=require(_0x4fbb('0x7'));var client=jayson[_0x4fbb('0x8')]['http']({'port':0x232a});config[_0x4fbb('0x9')]=_[_0x4fbb('0xa')](config['redis'],{'host':_0x4fbb('0xb'),'port':0x18eb});var socket=require(_0x4fbb('0xc'))(new Redis(config['redis']));require(_0x4fbb('0xd'))[_0x4fbb('0xe')](socket);function respondWithRpcPromise(_0x497316,_0x3b59cb,_0x29d586){return new BPromise(function(_0x2ba535,_0x13c3ff){return client[_0x4fbb('0xf')](_0x497316,_0x29d586)[_0x4fbb('0x10')](function(_0x4abf2a){logger[_0x4fbb('0x11')]('Team,\x20%s,\x20%s',_0x3b59cb,_0x4fbb('0x12'));logger[_0x4fbb('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x3b59cb,'request\x20sent',JSON[_0x4fbb('0x14')](_0x4abf2a));if(_0x4abf2a[_0x4fbb('0x15')]){if(_0x4abf2a[_0x4fbb('0x15')]['code']===0x1f4){logger[_0x4fbb('0x15')](_0x4fbb('0x16'),_0x3b59cb,_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);return _0x13c3ff(_0x4abf2a['error'][_0x4fbb('0x17')]);}logger[_0x4fbb('0x15')](_0x4fbb('0x16'),_0x3b59cb,_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);return _0x2ba535(_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);}else{logger[_0x4fbb('0x11')](_0x4fbb('0x16'),_0x3b59cb,_0x4fbb('0x12'));_0x2ba535(_0x4abf2a[_0x4fbb('0x18')][_0x4fbb('0x17')]);}})[_0x4fbb('0x19')](function(_0x16e71f){logger['error'](_0x4fbb('0x16'),_0x3b59cb,_0x16e71f);_0x13c3ff(_0x16e71f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d169601..d605b79 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 _0x7ad3=['./team.events','save','remove','update','length','team:'];(function(_0x5cd271,_0x40014a){var _0x3e8023=function(_0x4b8ce7){while(--_0x4b8ce7){_0x5cd271['push'](_0x5cd271['shift']());}};_0x3e8023(++_0x40014a);}(_0x7ad3,0x108));var _0x37ad=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x7ad3[_0x120376];return _0x28c529;};'use strict';var TeamEvents=require(_0x37ad('0x0'));var events=[_0x37ad('0x1'),_0x37ad('0x2'),_0x37ad('0x3')];function createListener(_0x59b2ad,_0x30c8cf){return function(_0x4e59f0){_0x30c8cf['emit'](_0x59b2ad,_0x4e59f0);};}function removeListener(_0x1853b6,_0x57ce4c){return function(){TeamEvents['removeListener'](_0x1853b6,_0x57ce4c);};}exports['register']=function(_0x341527){for(var _0x9cb624=0x0,_0x39d395=events[_0x37ad('0x4')];_0x9cb624<_0x39d395;_0x9cb624++){var _0xd8b0fe=events[_0x9cb624];var _0x2b361a=createListener(_0x37ad('0x5')+_0xd8b0fe,_0x341527);TeamEvents['on'](_0xd8b0fe,_0x2b361a);}}; \ No newline at end of file +var _0x1a38=['./team.events','save','remove','emit','removeListener','register','length','team:'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1a38,0xb0));var _0x81a3=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x1a38[_0x2fdf82];return _0x2382f5;};'use strict';var TeamEvents=require(_0x81a3('0x0'));var events=[_0x81a3('0x1'),_0x81a3('0x2'),'update'];function createListener(_0x57f36a,_0x538035){return function(_0x477513){_0x538035[_0x81a3('0x3')](_0x57f36a,_0x477513);};}function removeListener(_0x2faf46,_0x28fd86){return function(){TeamEvents[_0x81a3('0x4')](_0x2faf46,_0x28fd86);};}exports[_0x81a3('0x5')]=function(_0x2f0a07){for(var _0x189c2b=0x0,_0x3153ee=events[_0x81a3('0x6')];_0x189c2b<_0x3153ee;_0x189c2b++){var _0x207345=events[_0x189c2b];var _0xe10e0a=createListener(_0x81a3('0x7')+_0x207345,_0x2f0a07);TeamEvents['on'](_0x207345,_0xe10e0a);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3729063..134fddc 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 _0x66e7=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x310110,_0x3f0f38){var _0x278948=function(_0x430959){while(--_0x430959){_0x310110['push'](_0x310110['shift']());}};_0x278948(++_0x3f0f38);}(_0x66e7,0x1a3));var _0x766e=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x66e7[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0x766e('0x0'));var util=require(_0x766e('0x1'));var path=require('path');var timeout=require(_0x766e('0x2'));var express=require('express');var router=express[_0x766e('0x3')]();var auth=require(_0x766e('0x4'));var interaction=require(_0x766e('0x5'));var config=require(_0x766e('0x6'));var controller=require('./template.controller');router['get']('/',auth[_0x766e('0x7')](),controller[_0x766e('0x8')]);router[_0x766e('0x9')](_0x766e('0xa'),auth[_0x766e('0x7')](),controller[_0x766e('0xb')]);router[_0x766e('0xc')]('/',auth[_0x766e('0x7')](),controller[_0x766e('0xd')]);router[_0x766e('0xe')](_0x766e('0xa'),auth[_0x766e('0x7')](),controller[_0x766e('0xf')]);router[_0x766e('0x10')](_0x766e('0xa'),auth[_0x766e('0x7')](),controller[_0x766e('0x11')]);module[_0x766e('0x12')]=router; \ No newline at end of file +var _0xdd11=['isAuthenticated','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id'];(function(_0x4aba2a,_0x58bc97){var _0x38bbcb=function(_0x4a50e1){while(--_0x4a50e1){_0x4aba2a['push'](_0x4aba2a['shift']());}};_0x38bbcb(++_0x58bc97);}(_0xdd11,0x15d));var _0x1dd1=function(_0x131d7e,_0x1376ad){_0x131d7e=_0x131d7e-0x0;var _0xdb586e=_0xdd11[_0x131d7e];return _0xdb586e;};'use strict';var multer=require(_0x1dd1('0x0'));var util=require(_0x1dd1('0x1'));var path=require('path');var timeout=require(_0x1dd1('0x2'));var express=require(_0x1dd1('0x3'));var router=express[_0x1dd1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1dd1('0x5'));var config=require(_0x1dd1('0x6'));var controller=require(_0x1dd1('0x7'));router[_0x1dd1('0x8')]('/',auth['isAuthenticated'](),controller[_0x1dd1('0x9')]);router['get'](_0x1dd1('0xa'),auth[_0x1dd1('0xb')](),controller[_0x1dd1('0xc')]);router[_0x1dd1('0xd')]('/',auth[_0x1dd1('0xb')](),controller[_0x1dd1('0xe')]);router['put'](_0x1dd1('0xa'),auth[_0x1dd1('0xb')](),controller[_0x1dd1('0xf')]);router['delete'](_0x1dd1('0xa'),auth[_0x1dd1('0xb')](),controller[_0x1dd1('0x10')]);module[_0x1dd1('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index be37b13..a61873b 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 _0xa129=['STRING','sequelize'];(function(_0x431102,_0x52e1a9){var _0xb33928=function(_0xb66213){while(--_0xb66213){_0x431102['push'](_0x431102['shift']());}};_0xb33928(++_0x52e1a9);}(_0xa129,0x199));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9a12('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9a12('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xaf34=['exports','STRING','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaf34,0x186));var _0x4af3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xaf34[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module[_0x4af3('0x0')]={'name':{'type':Sequelize[_0x4af3('0x1')]},'description':{'type':Sequelize[_0x4af3('0x1')]},'html':{'type':Sequelize[_0x4af3('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5e5702b..215b254 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 _0x1261=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy','get','name','send','index','Template','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x52bc95,_0x10add2){var _0x343dc5=function(_0xfb064e){while(--_0xfb064e){_0x52bc95['push'](_0x52bc95['shift']());}};_0x343dc5(++_0x10add2);}(_0x1261,0x144));var _0x1126=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x1261[_0x14d250];return _0xb991d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=_0x45149c['count'],_0x35fe9f=_0x4be0c6[_0x1126('0x1c')],_0x42f379=_0x4be0c6[_0x1126('0x1c')]+_0x4be0c6['limit'],_0x257b5f;if(_0x42f379>=_0x4794a7){_0x42f379=_0x4794a7;_0x257b5f=0xc8;}else{_0x257b5f=0xce;}_0x279455['status'](_0x257b5f);return _0x279455[_0x1126('0x1d')](_0x1126('0x1e'),_0x35fe9f+'-'+_0x42f379+'/'+_0x4794a7)['json'](_0x45149c);}return null;};}function patchUpdates(_0x548359){return function(_0x4564c0){try{jsonpatch['apply'](_0x4564c0,_0x548359,!![]);}catch(_0x22ed37){return BPromise[_0x1126('0x1f')](_0x22ed37);}return _0x4564c0[_0x1126('0x20')]();};}function saveUpdates(_0x54400a,_0x2a08ba){return function(_0x49d209){if(_0x49d209){return _0x49d209['update'](_0x54400a)[_0x1126('0x21')](function(_0x3a9bed){return _0x3a9bed;});}return null;};}function removeEntity(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x22')]()[_0x1126('0x21')](function(){var _0x48a08d=_0x526ca1[_0x1126('0x23')]({'plain':!![]});var _0x59cd8e='Templates';return db['UserProfileResource'][_0x1126('0x22')]({'where':{'type':_0x59cd8e,'resourceId':_0x48a08d['id']}})[_0x1126('0x21')](function(){return _0x526ca1;});})[_0x1126('0x21')](function(){_0x25b24b[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x1b07a7,_0xea0971){return function(_0x38119d){if(!_0x38119d){_0x1b07a7['sendStatus'](0x194);}return _0x38119d;};}function handleError(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0x1f4;return function(_0xa293f4){logger['error'](_0xa293f4['stack']);if(_0xa293f4[_0x1126('0x24')]){delete _0xa293f4[_0x1126('0x24')];}_0x35eec3['status'](_0x375e59)[_0x1126('0x25')](_0xa293f4);};}exports[_0x1126('0x26')]=function(_0x4a334a,_0x3fa694){var _0x4bf807={},_0xc62460={},_0x4bd50b={'count':0x0,'rows':[]};var _0x771bb8=_['map'](db[_0x1126('0x27')]['rawAttributes'],function(_0x5252e0){return{'name':_0x5252e0['fieldName'],'type':_0x5252e0[_0x1126('0x28')][_0x1126('0x29')]};});_0xc62460[_0x1126('0x2a')]=_['map'](_0x771bb8,_0x1126('0x24'));_0xc62460[_0x1126('0x2b')]=_['keys'](_0x4a334a[_0x1126('0x2b')]);_0xc62460[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],_0xc62460['query']);_0x4bf807['attributes']=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],qs[_0x1126('0x2e')](_0x4a334a[_0x1126('0x2b')]['fields']));_0x4bf807[_0x1126('0x2f')]=_0x4bf807[_0x1126('0x2f')][_0x1126('0x30')]?_0x4bf807[_0x1126('0x2f')]:_0xc62460[_0x1126('0x2a')];if(!_0x4a334a['query'][_0x1126('0x31')](_0x1126('0x32'))){_0x4bf807[_0x1126('0x33')]=qs[_0x1126('0x33')](_0x4a334a['query']['limit']);_0x4bf807[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x4a334a['query'][_0x1126('0x1c')]);}_0x4bf807[_0x1126('0x34')]=qs[_0x1126('0x35')](_0x4a334a['query']['sort']);_0x4bf807[_0x1126('0x36')]=qs[_0x1126('0x2c')](_[_0x1126('0x37')](_0x4a334a[_0x1126('0x2b')],_0xc62460['filters']),_0x771bb8);if(_0x4a334a[_0x1126('0x2b')]['filter']){_0x4bf807[_0x1126('0x36')]=_[_0x1126('0x38')](_0x4bf807[_0x1126('0x36')],{'$or':_[_0x1126('0x39')](_0x771bb8,function(_0x57e5d2){if(_0x57e5d2['type']!==_0x1126('0x3a')){var _0x3ea9de={};_0x3ea9de[_0x57e5d2[_0x1126('0x24')]]={'$like':'%'+_0x4a334a[_0x1126('0x2b')][_0x1126('0x3b')]+'%'};return _0x3ea9de;}})});}_0x4bf807=_[_0x1126('0x38')]({},_0x4bf807,_0x4a334a[_0x1126('0x3c')]);var _0x4faaa3={'where':_0x4bf807[_0x1126('0x36')]};return db[_0x1126('0x27')][_0x1126('0x3d')](_0x4faaa3)[_0x1126('0x21')](function(_0xcf0483){_0x4bd50b['count']=_0xcf0483;if(_0x4a334a['query'][_0x1126('0x3e')]){_0x4bf807[_0x1126('0x3f')]=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x40')](_0x4bf807);})[_0x1126('0x21')](function(_0x276fd5){_0x4bd50b['rows']=_0x276fd5;return _0x4bd50b;})['then'](respondWithFilteredResult(_0x3fa694,_0x4bf807))['catch'](handleError(_0x3fa694,null));};exports[_0x1126('0x41')]=function(_0x5d4194,_0xf84005){var _0x462da8={'raw':!![],'where':{'id':_0x5d4194[_0x1126('0x42')]['id']}},_0x3584a3={};_0x3584a3['model']=_['keys'](db[_0x1126('0x27')][_0x1126('0x43')]);_0x3584a3[_0x1126('0x2b')]=_['keys'](_0x5d4194[_0x1126('0x2b')]);_0x3584a3['filters']=_[_0x1126('0x2d')](_0x3584a3['model'],_0x3584a3[_0x1126('0x2b')]);_0x462da8[_0x1126('0x2f')]=_[_0x1126('0x2d')](_0x3584a3['model'],qs[_0x1126('0x2e')](_0x5d4194[_0x1126('0x2b')][_0x1126('0x2e')]));_0x462da8['attributes']=_0x462da8['attributes']['length']?_0x462da8[_0x1126('0x2f')]:_0x3584a3['model'];if(_0x5d4194[_0x1126('0x2b')]['includeAll']){_0x462da8[_0x1126('0x3f')]=[{'all':!![]}];}_0x462da8=_[_0x1126('0x38')]({},_0x462da8,_0x5d4194[_0x1126('0x3c')]);return db[_0x1126('0x27')][_0x1126('0x44')](_0x462da8)['then'](handleEntityNotFound(_0xf84005,null))[_0x1126('0x21')](respondWithResult(_0xf84005,null))[_0x1126('0x45')](handleError(_0xf84005,null));};exports['create']=function(_0x1a15f8,_0x13dc39){return db['Template'][_0x1126('0x46')](_0x1a15f8[_0x1126('0x47')],{})['then'](function(_0x3e4eeb){var _0xbdde58=_0x1a15f8[_0x1126('0x48')]['get']({'plain':!![]});if(!_0xbdde58)throw new Error(_0x1126('0x49'));if(_0xbdde58[_0x1126('0x4a')]===_0x1126('0x48')){var _0x5878bb=_0x3e4eeb[_0x1126('0x23')]({'plain':!![]});var _0x2081f2=_0x1126('0x4b');return db[_0x1126('0x4c')]['find']({'where':{'name':_0x2081f2,'userProfileId':_0xbdde58[_0x1126('0x4d')]},'raw':!![]})['then'](function(_0x40168e){if(_0x40168e&&_0x40168e[_0x1126('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5878bb[_0x1126('0x24')],'resourceId':_0x5878bb['id'],'type':_0x40168e[_0x1126('0x24')],'sectionId':_0x40168e['id']},{})[_0x1126('0x21')](function(){return _0x3e4eeb;});}else{return _0x3e4eeb;}})['catch'](function(_0x3cb44c){logger[_0x1126('0x4f')](_0x1126('0x50'),_0x3cb44c);throw _0x3cb44c;});}return _0x3e4eeb;})[_0x1126('0x21')](respondWithResult(_0x13dc39,0xc9))['catch'](handleError(_0x13dc39,null));};exports[_0x1126('0x51')]=function(_0x46551f,_0x5c36b9){if(_0x46551f['body']['id']){delete _0x46551f['body']['id'];}return db['Template'][_0x1126('0x44')]({'where':{'id':_0x46551f[_0x1126('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c36b9,null))[_0x1126('0x21')](saveUpdates(_0x46551f[_0x1126('0x47')],null))[_0x1126('0x21')](respondWithResult(_0x5c36b9,null))[_0x1126('0x45')](handleError(_0x5c36b9,null));};exports[_0x1126('0x22')]=function(_0x4e4d49,_0x41cbb6){return db[_0x1126('0x27')]['find']({'where':{'id':_0x4e4d49[_0x1126('0x42')]['id']}})[_0x1126('0x21')](handleEntityNotFound(_0x41cbb6,null))[_0x1126('0x21')](removeEntity(_0x41cbb6,null))[_0x1126('0x45')](handleError(_0x41cbb6,null));}; \ No newline at end of file +var _0x7217=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Template','count','includeAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x31a1cd,_0x502703){var _0xc69b39=function(_0x3cbe53){while(--_0x3cbe53){_0x31a1cd['push'](_0x31a1cd['shift']());}};_0xc69b39(++_0x502703);}(_0x7217,0x19e));var _0x7721=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7217[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=_0x4b183e['count'],_0x25a628=_0x4e199a[_0x7721('0x1f')],_0x3cc909=_0x4e199a['offset']+_0x4e199a[_0x7721('0x20')],_0x32550d;if(_0x3cc909>=_0x5ed54){_0x3cc909=_0x5ed54;_0x32550d=0xc8;}else{_0x32550d=0xce;}_0x534f1b['status'](_0x32550d);return _0x534f1b[_0x7721('0x21')](_0x7721('0x22'),_0x25a628+'-'+_0x3cc909+'/'+_0x5ed54)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0x3e140d){return function(_0x2286e5){try{jsonpatch[_0x7721('0x23')](_0x2286e5,_0x3e140d,!![]);}catch(_0x402820){return BPromise[_0x7721('0x24')](_0x402820);}return _0x2286e5[_0x7721('0x25')]();};}function saveUpdates(_0xaeccc4,_0x4ce1db){return function(_0x288f7e){if(_0x288f7e){return _0x288f7e[_0x7721('0x26')](_0xaeccc4)[_0x7721('0x27')](function(_0xd8ad3c){return _0xd8ad3c;});}return null;};}function removeEntity(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')]()[_0x7721('0x27')](function(){var _0x3e8a4e=_0x512f31[_0x7721('0x29')]({'plain':!![]});var _0x121cc4=_0x7721('0x2a');return db[_0x7721('0x2b')]['destroy']({'where':{'type':_0x121cc4,'resourceId':_0x3e8a4e['id']}})[_0x7721('0x27')](function(){return _0x512f31;});})[_0x7721('0x27')](function(){_0x57140c[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x40d550,_0x16355a){return function(_0x424e05){if(!_0x424e05){_0x40d550[_0x7721('0x2c')](0x194);}return _0x424e05;};}function handleError(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0x1f4;return function(_0x258ddf){logger['error'](_0x258ddf['stack']);if(_0x258ddf[_0x7721('0x2d')]){delete _0x258ddf[_0x7721('0x2d')];}_0x40f367[_0x7721('0x1c')](_0x52316e)[_0x7721('0x2e')](_0x258ddf);};}exports[_0x7721('0x2f')]=function(_0x37b9f0,_0xd7d703){var _0x1da2d8={},_0x5c54f0={},_0x471651={'count':0x0,'rows':[]};var _0x2871c5=_['map'](db['Template'][_0x7721('0x30')],function(_0x220bbf){return{'name':_0x220bbf['fieldName'],'type':_0x220bbf[_0x7721('0x31')][_0x7721('0x32')]};});_0x5c54f0[_0x7721('0x33')]=_['map'](_0x2871c5,_0x7721('0x2d'));_0x5c54f0[_0x7721('0x34')]=_[_0x7721('0x35')](_0x37b9f0[_0x7721('0x34')]);_0x5c54f0[_0x7721('0x36')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],_0x5c54f0[_0x7721('0x34')]);_0x1da2d8[_0x7721('0x37')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],qs[_0x7721('0x38')](_0x37b9f0['query'][_0x7721('0x38')]));_0x1da2d8['attributes']=_0x1da2d8[_0x7721('0x37')][_0x7721('0x39')]?_0x1da2d8[_0x7721('0x37')]:_0x5c54f0[_0x7721('0x33')];if(!_0x37b9f0[_0x7721('0x34')][_0x7721('0x3a')](_0x7721('0x3b'))){_0x1da2d8[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x20')]);_0x1da2d8['offset']=qs[_0x7721('0x1f')](_0x37b9f0['query'][_0x7721('0x1f')]);}_0x1da2d8[_0x7721('0x3c')]=qs[_0x7721('0x3d')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x3d')]);_0x1da2d8[_0x7721('0x3e')]=qs['filters'](_['pick'](_0x37b9f0['query'],_0x5c54f0['filters']),_0x2871c5);if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x3f')]){_0x1da2d8[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x1da2d8['where'],{'$or':_[_0x7721('0x41')](_0x2871c5,function(_0x4cf659){if(_0x4cf659[_0x7721('0x31')]!==_0x7721('0x42')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x2d')]]={'$like':'%'+_0x37b9f0[_0x7721('0x34')]['filter']+'%'};return _0x5a278e;}})});}_0x1da2d8=_['merge']({},_0x1da2d8,_0x37b9f0[_0x7721('0x43')]);var _0xfc4dc4={'where':_0x1da2d8[_0x7721('0x3e')]};return db[_0x7721('0x44')]['count'](_0xfc4dc4)[_0x7721('0x27')](function(_0x120de9){_0x471651[_0x7721('0x45')]=_0x120de9;if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x46')]){_0x1da2d8['include']=[{'all':!![]}];}return db[_0x7721('0x44')]['findAll'](_0x1da2d8);})[_0x7721('0x27')](function(_0x4a5b59){_0x471651[_0x7721('0x47')]=_0x4a5b59;return _0x471651;})[_0x7721('0x27')](respondWithFilteredResult(_0xd7d703,_0x1da2d8))[_0x7721('0x48')](handleError(_0xd7d703,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':!![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x35')](db[_0x7721('0x44')][_0x7721('0x30')]);_0x481fa8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x34')]);_0x1ad315[_0x7721('0x37')]=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x38')](_0x1453d4[_0x7721('0x34')][_0x7721('0x38')]));_0x1ad315[_0x7721('0x37')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x37')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x34')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x40')]({},_0x1ad315,_0x1453d4[_0x7721('0x43')]);return db['Template'][_0x7721('0x4b')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x27')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4c')]=function(_0x196be4,_0xf17c40){return db['Template'][_0x7721('0x4c')](_0x196be4[_0x7721('0x4d')],{})['then'](function(_0x223d93){var _0x1196c2=_0x196be4[_0x7721('0x4e')]['get']({'plain':!![]});if(!_0x1196c2)throw new Error(_0x7721('0x4f'));if(_0x1196c2['role']===_0x7721('0x4e')){var _0x310549=_0x223d93[_0x7721('0x29')]({'plain':!![]});var _0x443503=_0x7721('0x2a');return db[_0x7721('0x50')][_0x7721('0x4b')]({'where':{'name':_0x443503,'userProfileId':_0x1196c2[_0x7721('0x51')]},'raw':!![]})[_0x7721('0x27')](function(_0x3386aa){if(_0x3386aa&&_0x3386aa[_0x7721('0x52')]===0x0){return db[_0x7721('0x2b')][_0x7721('0x4c')]({'name':_0x310549[_0x7721('0x2d')],'resourceId':_0x310549['id'],'type':_0x3386aa[_0x7721('0x2d')],'sectionId':_0x3386aa['id']},{})['then'](function(){return _0x223d93;});}else{return _0x223d93;}})[_0x7721('0x48')](function(_0x2f6f30){logger[_0x7721('0x53')](_0x7721('0x54'),_0x2f6f30);throw _0x2f6f30;});}return _0x223d93;})[_0x7721('0x27')](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x26')]=function(_0x57484c,_0x234bee){if(_0x57484c[_0x7721('0x4d')]['id']){delete _0x57484c[_0x7721('0x4d')]['id'];}return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x57484c[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0x234bee,null))[_0x7721('0x27')](saveUpdates(_0x57484c[_0x7721('0x4d')],null))[_0x7721('0x27')](respondWithResult(_0x234bee,null))[_0x7721('0x48')](handleError(_0x234bee,null));};exports['destroy']=function(_0x421c27,_0xadb365){return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x421c27[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0xadb365,null))[_0x7721('0x27')](removeEntity(_0xadb365,null))[_0x7721('0x48')](handleError(_0xadb365,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 803283e..19fbe2e 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 _0x6763=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','Template','lodash','util'];(function(_0x10e3f1,_0x1b3a0a){var _0x1ffec6=function(_0x3f0f3f){while(--_0x3f0f3f){_0x10e3f1['push'](_0x10e3f1['shift']());}};_0x1ffec6(++_0x1b3a0a);}(_0x6763,0x82));var _0x3676=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0x6763[_0x3c6c1b];return _0x15170e;};'use strict';var _=require(_0x3676('0x0'));var util=require(_0x3676('0x1'));var logger=require(_0x3676('0x2'))(_0x3676('0x3'));var moment=require(_0x3676('0x4'));var BPromise=require(_0x3676('0x5'));var rp=require(_0x3676('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3676('0x7'));var attributes=require('./template.attributes');module[_0x3676('0x8')]=function(_0x2733de,_0x754c27){return _0x2733de[_0x3676('0x9')](_0x3676('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaf8=['api','request-promise','path','rimraf','../../config/environment','exports','define','Template'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xfaf8,0x178));var _0x8faf=function(_0x492ecf,_0x27167e){_0x492ecf=_0x492ecf-0x0;var _0xa4189c=_0xfaf8[_0x492ecf];return _0xa4189c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8faf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8faf('0x1'));var fs=require('fs');var path=require(_0x8faf('0x2'));var rimraf=require(_0x8faf('0x3'));var config=require(_0x8faf('0x4'));var attributes=require('./template.attributes');module[_0x8faf('0x5')]=function(_0xe0e102,_0x9f88e3){return _0xe0e102[_0x8faf('0x6')](_0x8faf('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index d814cca..8c8f78b 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 _0x29e5=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code','Template,\x20%s,\x20%s','message','info','result','catch','GetTemplate','Template'];(function(_0x33a596,_0xe4dcb0){var _0x2a6c22=function(_0xf242db){while(--_0xf242db){_0x33a596['push'](_0x33a596['shift']());}};_0x2a6c22(++_0xe4dcb0);}(_0x29e5,0x12a));var _0x529e=function(_0x4f9c26,_0x98ab50){_0x4f9c26=_0x4f9c26-0x0;var _0x265624=_0x29e5[_0x4f9c26];return _0x265624;};'use strict';var _=require('lodash');var util=require(_0x529e('0x0'));var moment=require(_0x529e('0x1'));var BPromise=require('bluebird');var rs=require(_0x529e('0x2'));var fs=require('fs');var Redis=require(_0x529e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x529e('0x4'));var logger=require(_0x529e('0x5'))('rpc');var config=require(_0x529e('0x6'));var jayson=require(_0x529e('0x7'));var client=jayson[_0x529e('0x8')][_0x529e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b2605,_0x265ee1,_0x476e17){return new BPromise(function(_0x4162ae,_0x55048e){return client['request'](_0x3b2605,_0x476e17)[_0x529e('0xa')](function(_0x31cd50){logger['info']('Template,\x20%s,\x20%s',_0x265ee1,_0x529e('0xb'));logger[_0x529e('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x265ee1,_0x529e('0xb'),JSON['stringify'](_0x31cd50));if(_0x31cd50[_0x529e('0xd')]){if(_0x31cd50[_0x529e('0xd')][_0x529e('0xe')]===0x1f4){logger['error'](_0x529e('0xf'),_0x265ee1,_0x31cd50[_0x529e('0xd')][_0x529e('0x10')]);return _0x55048e(_0x31cd50[_0x529e('0xd')]['message']);}logger[_0x529e('0xd')](_0x529e('0xf'),_0x265ee1,_0x31cd50[_0x529e('0xd')][_0x529e('0x10')]);return _0x4162ae(_0x31cd50[_0x529e('0xd')][_0x529e('0x10')]);}else{logger[_0x529e('0x11')]('Template,\x20%s,\x20%s',_0x265ee1,_0x529e('0xb'));_0x4162ae(_0x31cd50[_0x529e('0x12')][_0x529e('0x10')]);}})[_0x529e('0x13')](function(_0x28bdbf){logger[_0x529e('0xd')](_0x529e('0xf'),_0x265ee1,_0x28bdbf);_0x55048e(_0x28bdbf);});});}exports[_0x529e('0x14')]=function(_0x3a344a){var _0x4bfa62=this;return new Promise(function(_0x2ba1c7,_0x131f5b){return db[_0x529e('0x15')][_0x529e('0x16')]({'raw':_0x3a344a[_0x529e('0x17')]?_0x3a344a['options'][_0x529e('0x18')]===undefined?!![]:![]:!![],'where':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x19')]||null:null,'attributes':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x1a')]||null:null,'limit':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x1b')]||null:null,'include':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x1c')]?_['map'](_0x3a344a[_0x529e('0x17')][_0x529e('0x1c')],function(_0x288c17){return{'model':db[_0x288c17[_0x529e('0x1d')]],'as':_0x288c17['as'],'attributes':_0x288c17['attributes'],'include':_0x288c17[_0x529e('0x1c')]?_[_0x529e('0x1e')](_0x288c17[_0x529e('0x1c')],function(_0x8f10e2){return{'model':db[_0x8f10e2[_0x529e('0x1d')]],'as':_0x8f10e2['as'],'attributes':_0x8f10e2[_0x529e('0x1a')],'include':_0x8f10e2[_0x529e('0x1c')]?_[_0x529e('0x1e')](_0x8f10e2[_0x529e('0x1c')],function(_0x2322ab){return{'model':db[_0x2322ab['model']],'as':_0x2322ab['as'],'attributes':_0x2322ab[_0x529e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x529e('0xa')](function(_0x4be2e1){logger['info'](_0x529e('0x14'),_0x3a344a);logger[_0x529e('0xc')]('GetTemplate',_0x3a344a,JSON[_0x529e('0x1f')](_0x4be2e1));_0x2ba1c7(_0x4be2e1);})[_0x529e('0x13')](function(_0x4b17b6){logger[_0x529e('0xd')](_0x529e('0x14'),_0x4b17b6[_0x529e('0x10')],_0x3a344a);_0x131f5b(_0x4bfa62['error'](0x1f4,_0x4b17b6['message']));});});}; \ No newline at end of file +var _0xdad7=['where','limit','include','map','model','attributes','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','raw','options'];(function(_0x18e590,_0x47b7f7){var _0x43890c=function(_0x141946){while(--_0x141946){_0x18e590['push'](_0x18e590['shift']());}};_0x43890c(++_0x47b7f7);}(_0xdad7,0x12f));var _0x7dad=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xdad7[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7dad('0x0'));var util=require('util');var moment=require(_0x7dad('0x1'));var BPromise=require(_0x7dad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dad('0x4'));var logger=require('../../config/logger')(_0x7dad('0x5'));var config=require(_0x7dad('0x6'));var jayson=require(_0x7dad('0x7'));var client=jayson[_0x7dad('0x8')][_0x7dad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4852ed,_0x4a0ef6,_0x902996){return new BPromise(function(_0x1e56d5,_0x377a47){return client['request'](_0x4852ed,_0x902996)[_0x7dad('0xa')](function(_0xb13ab5){logger[_0x7dad('0xb')]('Template,\x20%s,\x20%s',_0x4a0ef6,_0x7dad('0xc'));logger[_0x7dad('0xd')](_0x7dad('0xe'),_0x4a0ef6,_0x7dad('0xc'),JSON[_0x7dad('0xf')](_0xb13ab5));if(_0xb13ab5['error']){if(_0xb13ab5['error'][_0x7dad('0x10')]===0x1f4){logger[_0x7dad('0x11')](_0x7dad('0x12'),_0x4a0ef6,_0xb13ab5['error'][_0x7dad('0x13')]);return _0x377a47(_0xb13ab5[_0x7dad('0x11')][_0x7dad('0x13')]);}logger[_0x7dad('0x11')](_0x7dad('0x12'),_0x4a0ef6,_0xb13ab5['error'][_0x7dad('0x13')]);return _0x1e56d5(_0xb13ab5[_0x7dad('0x11')][_0x7dad('0x13')]);}else{logger[_0x7dad('0xb')](_0x7dad('0x12'),_0x4a0ef6,_0x7dad('0xc'));_0x1e56d5(_0xb13ab5[_0x7dad('0x14')]['message']);}})[_0x7dad('0x15')](function(_0x4936c6){logger[_0x7dad('0x11')](_0x7dad('0x12'),_0x4a0ef6,_0x4936c6);_0x377a47(_0x4936c6);});});}exports[_0x7dad('0x16')]=function(_0x5a8b13){var _0x3e8aa1=this;return new Promise(function(_0x3fe062,_0x483e41){return db[_0x7dad('0x17')][_0x7dad('0x18')]({'raw':_0x5a8b13['options']?_0x5a8b13['options'][_0x7dad('0x19')]===undefined?!![]:![]:!![],'where':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')][_0x7dad('0x1b')]||null:null,'attributes':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')]['attributes']||null:null,'limit':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')][_0x7dad('0x1c')]||null:null,'include':_0x5a8b13[_0x7dad('0x1a')]?_0x5a8b13[_0x7dad('0x1a')][_0x7dad('0x1d')]?_[_0x7dad('0x1e')](_0x5a8b13['options'][_0x7dad('0x1d')],function(_0x5f41df){return{'model':db[_0x5f41df[_0x7dad('0x1f')]],'as':_0x5f41df['as'],'attributes':_0x5f41df[_0x7dad('0x20')],'include':_0x5f41df['include']?_[_0x7dad('0x1e')](_0x5f41df[_0x7dad('0x1d')],function(_0x4a3074){return{'model':db[_0x4a3074['model']],'as':_0x4a3074['as'],'attributes':_0x4a3074[_0x7dad('0x20')],'include':_0x4a3074[_0x7dad('0x1d')]?_[_0x7dad('0x1e')](_0x4a3074['include'],function(_0x1bf96e){return{'model':db[_0x1bf96e['model']],'as':_0x1bf96e['as'],'attributes':_0x1bf96e[_0x7dad('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7dad('0xa')](function(_0x4be53c){logger[_0x7dad('0xb')](_0x7dad('0x16'),_0x5a8b13);logger['debug'](_0x7dad('0x16'),_0x5a8b13,JSON[_0x7dad('0xf')](_0x4be53c));_0x3fe062(_0x4be53c);})['catch'](function(_0x17cda0){logger[_0x7dad('0x11')](_0x7dad('0x16'),_0x17cda0[_0x7dad('0x13')],_0x5a8b13);_0x483e41(_0x3e8aa1[_0x7dad('0x11')](0x1f4,_0x17cda0[_0x7dad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index ce595ab..baf8e4e 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 _0x0574=['/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','addAllCondition','post','addAnyCondition','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index'];(function(_0x2de886,_0x3cb4b7){var _0x34412a=function(_0x3e0f5a){while(--_0x3e0f5a){_0x2de886['push'](_0x2de886['shift']());}};_0x34412a(++_0x3cb4b7);}(_0x0574,0x1a0));var _0x4057=function(_0x5bb49c,_0xbe6c36){_0x5bb49c=_0x5bb49c-0x0;var _0x417421=_0x0574[_0x5bb49c];return _0x417421;};'use strict';var multer=require(_0x4057('0x0'));var util=require(_0x4057('0x1'));var path=require(_0x4057('0x2'));var timeout=require(_0x4057('0x3'));var express=require(_0x4057('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4057('0x5'));var config=require(_0x4057('0x6'));var controller=require('./trigger.controller');router[_0x4057('0x7')]('/',auth['isAuthenticated'](),controller[_0x4057('0x8')]);router[_0x4057('0x7')](_0x4057('0x9'),auth[_0x4057('0xa')](),controller[_0x4057('0xb')]);router['get'](_0x4057('0xc'),auth[_0x4057('0xa')](),controller[_0x4057('0xd')]);router[_0x4057('0x7')](_0x4057('0xe'),auth[_0x4057('0xa')](),controller['getAnyConditions']);router[_0x4057('0x7')](_0x4057('0xf'),auth['isAuthenticated'](),controller[_0x4057('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4057('0x11')]);router['post'](_0x4057('0xc'),auth[_0x4057('0xa')](),controller[_0x4057('0x12')]);router[_0x4057('0x13')]('/:id/any_conditions',auth[_0x4057('0xa')](),controller[_0x4057('0x14')]);router[_0x4057('0x13')](_0x4057('0xf'),auth[_0x4057('0xa')](),controller['addAction']);router[_0x4057('0x15')](_0x4057('0x9'),auth[_0x4057('0xa')](),controller['update']);router[_0x4057('0x16')](_0x4057('0x9'),auth['isAuthenticated'](),controller[_0x4057('0x17')]);module[_0x4057('0x18')]=router; \ No newline at end of file +var _0x86dc=['post','addAllCondition','addAnyCondition','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions'];(function(_0x3c45c9,_0x551fd3){var _0x38390d=function(_0x294c14){while(--_0x294c14){_0x3c45c9['push'](_0x3c45c9['shift']());}};_0x38390d(++_0x551fd3);}(_0x86dc,0x18e));var _0xc86d=function(_0x2e89d7,_0x52243d){_0x2e89d7=_0x2e89d7-0x0;var _0xc9b37a=_0x86dc[_0x2e89d7];return _0xc9b37a;};'use strict';var multer=require('multer');var util=require(_0xc86d('0x0'));var path=require(_0xc86d('0x1'));var timeout=require(_0xc86d('0x2'));var express=require(_0xc86d('0x3'));var router=express['Router']();var auth=require(_0xc86d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc86d('0x5'));router[_0xc86d('0x6')]('/',auth[_0xc86d('0x7')](),controller[_0xc86d('0x8')]);router[_0xc86d('0x6')](_0xc86d('0x9'),auth[_0xc86d('0x7')](),controller[_0xc86d('0xa')]);router['get'](_0xc86d('0xb'),auth[_0xc86d('0x7')](),controller[_0xc86d('0xc')]);router[_0xc86d('0x6')](_0xc86d('0xd'),auth[_0xc86d('0x7')](),controller[_0xc86d('0xe')]);router[_0xc86d('0x6')]('/:id/actions',auth[_0xc86d('0x7')](),controller[_0xc86d('0xf')]);router[_0xc86d('0x10')]('/',auth[_0xc86d('0x7')](),controller['create']);router['post'](_0xc86d('0xb'),auth[_0xc86d('0x7')](),controller[_0xc86d('0x11')]);router[_0xc86d('0x10')]('/:id/any_conditions',auth[_0xc86d('0x7')](),controller[_0xc86d('0x12')]);router[_0xc86d('0x10')]('/:id/actions',auth[_0xc86d('0x7')](),controller['addAction']);router[_0xc86d('0x13')](_0xc86d('0x9'),auth[_0xc86d('0x7')](),controller['update']);router[_0xc86d('0x14')](_0xc86d('0x9'),auth[_0xc86d('0x7')](),controller[_0xc86d('0x15')]);module[_0xc86d('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 97f4316..8015479 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 _0x4e2c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x26712d,_0x30ac1b){var _0x256a12=function(_0x4a46e2){while(--_0x4a46e2){_0x26712d['push'](_0x26712d['shift']());}};_0x256a12(++_0x30ac1b);}(_0x4e2c,0x1a6));var _0xc4e2=function(_0x258472,_0x30cbe7){_0x258472=_0x258472-0x0;var _0x2546aa=_0x4e2c[_0x258472];return _0x2546aa;};'use strict';var Sequelize=require(_0xc4e2('0x0'));module[_0xc4e2('0x1')]={'name':{'type':Sequelize[_0xc4e2('0x2')]},'channel':{'type':Sequelize[_0xc4e2('0x2')]},'description':{'type':Sequelize[_0xc4e2('0x2')]},'status':{'type':Sequelize[_0xc4e2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xfb00=['exports','STRING','BOOLEAN','sequelize'];(function(_0x458656,_0x4292d8){var _0x24e475=function(_0x15f497){while(--_0x15f497){_0x458656['push'](_0x458656['shift']());}};_0x24e475(++_0x4292d8);}(_0xfb00,0xdf));var _0x0fb0=function(_0x5d4906,_0x537ec){_0x5d4906=_0x5d4906-0x0;var _0x98fb41=_0xfb00[_0x5d4906];return _0x98fb41;};'use strict';var Sequelize=require(_0x0fb0('0x0'));module[_0x0fb0('0x1')]={'name':{'type':Sequelize[_0x0fb0('0x2')]},'channel':{'type':Sequelize[_0x0fb0('0x2')]},'description':{'type':Sequelize[_0x0fb0('0x2')]},'status':{'type':Sequelize[_0x0fb0('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 371aa74..15252ca 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 _0x9f7a=['stack','name','send','index','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','count','include','Trigger','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','order','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','destroy','get','then','error'];(function(_0x5921c7,_0x4b5384){var _0x6405e9=function(_0x2d39e8){while(--_0x2d39e8){_0x5921c7['push'](_0x5921c7['shift']());}};_0x6405e9(++_0x4b5384);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x9f7a[_0x1f9f37];return _0x21c080;};'use strict';var pdf=require(_0xa9f7('0x0'));var emlformat=require(_0xa9f7('0x1'));var rimraf=require(_0xa9f7('0x2'));var zipdir=require(_0xa9f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9f7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa9f7('0x5'));var path=require(_0xa9f7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9f7('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9f7('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xa9f7('0x9'));var querystring=require(_0xa9f7('0xa'));var Papa=require(_0xa9f7('0xb'));var Redis=require('ioredis');var authService=require(_0xa9f7('0xc'));var qs=require(_0xa9f7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9f7('0xe'));var logger=require(_0xa9f7('0xf'))(_0xa9f7('0x10'));var utils=require(_0xa9f7('0x11'));var config=require(_0xa9f7('0x12'));var licenseUtil=require(_0xa9f7('0x13'));var db=require(_0xa9f7('0x14'))['db'];function respondWithStatusCode(_0x52e4d4,_0x532485){_0x532485=_0x532485||0xcc;return function(_0x5462c6){if(_0x5462c6){return _0x52e4d4[_0xa9f7('0x15')](_0x532485);}return _0x52e4d4[_0xa9f7('0x16')](_0x532485)[_0xa9f7('0x17')]();};}function respondWithResult(_0x4fb93c,_0x5f097c){_0x5f097c=_0x5f097c||0xc8;return function(_0xe56a20){if(_0xe56a20){return _0x4fb93c['status'](_0x5f097c)['json'](_0xe56a20);}};}function respondWithFilteredResult(_0x188f8a,_0x3987a5){return function(_0x30b935){if(_0x30b935){var _0x4cc9f3=_0x30b935['count'],_0x3f620b=_0x3987a5[_0xa9f7('0x18')],_0x153493=_0x3987a5[_0xa9f7('0x18')]+_0x3987a5[_0xa9f7('0x19')],_0x2aeadd;if(_0x153493>=_0x4cc9f3){_0x153493=_0x4cc9f3;_0x2aeadd=0xc8;}else{_0x2aeadd=0xce;}_0x188f8a[_0xa9f7('0x16')](_0x2aeadd);return _0x188f8a[_0xa9f7('0x1a')](_0xa9f7('0x1b'),_0x3f620b+'-'+_0x153493+'/'+_0x4cc9f3)[_0xa9f7('0x1c')](_0x30b935);}return null;};}function patchUpdates(_0x1c0496){return function(_0x2d0a7b){try{jsonpatch['apply'](_0x2d0a7b,_0x1c0496,!![]);}catch(_0x8ce3ac){return BPromise[_0xa9f7('0x1d')](_0x8ce3ac);}return _0x2d0a7b[_0xa9f7('0x1e')]();};}function saveUpdates(_0x28590b,_0x402c6d){return function(_0x5e7c7b){if(_0x5e7c7b){return _0x5e7c7b['update'](_0x28590b)['then'](function(_0x50b73c){return _0x50b73c;});}return null;};}function removeEntity(_0x4edaf9,_0x4b7202){return function(_0x5c9e4f){if(_0x5c9e4f){return _0x5c9e4f[_0xa9f7('0x1f')]()['then'](function(){var _0x5a62ba=_0x5c9e4f[_0xa9f7('0x20')]({'plain':!![]});var _0x530992='Triggers';return db['UserProfileResource'][_0xa9f7('0x1f')]({'where':{'type':_0x530992,'resourceId':_0x5a62ba['id']}})[_0xa9f7('0x21')](function(){return _0x5c9e4f;});})[_0xa9f7('0x21')](function(){_0x4edaf9['status'](0xcc)[_0xa9f7('0x17')]();});}};}function handleEntityNotFound(_0x112446,_0x42d6b4){return function(_0x5555f6){if(!_0x5555f6){_0x112446[_0xa9f7('0x15')](0x194);}return _0x5555f6;};}function handleError(_0x52bb0a,_0x1292ec){_0x1292ec=_0x1292ec||0x1f4;return function(_0x5ab865){logger[_0xa9f7('0x22')](_0x5ab865[_0xa9f7('0x23')]);if(_0x5ab865[_0xa9f7('0x24')]){delete _0x5ab865[_0xa9f7('0x24')];}_0x52bb0a['status'](_0x1292ec)[_0xa9f7('0x25')](_0x5ab865);};}exports[_0xa9f7('0x26')]=function(_0x16437e,_0x312084){var _0xc9684a={},_0x471c3c={},_0x40cad3={'count':0x0,'rows':[]};var _0x18a788=_['map'](db['Trigger']['rawAttributes'],function(_0x224f2e){return{'name':_0x224f2e[_0xa9f7('0x27')],'type':_0x224f2e['type'][_0xa9f7('0x28')]};});_0x471c3c['model']=_['map'](_0x18a788,'name');_0x471c3c[_0xa9f7('0x29')]=_['keys'](_0x16437e[_0xa9f7('0x29')]);_0x471c3c[_0xa9f7('0x2a')]=_[_0xa9f7('0x2b')](_0x471c3c[_0xa9f7('0x2c')],_0x471c3c[_0xa9f7('0x29')]);_0xc9684a['attributes']=_[_0xa9f7('0x2b')](_0x471c3c[_0xa9f7('0x2c')],qs['fields'](_0x16437e[_0xa9f7('0x29')][_0xa9f7('0x2d')]));_0xc9684a['attributes']=_0xc9684a[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0xc9684a[_0xa9f7('0x2e')]:_0x471c3c['model'];if(!_0x16437e['query'][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0xc9684a[_0xa9f7('0x19')]=qs[_0xa9f7('0x19')](_0x16437e[_0xa9f7('0x29')]['limit']);_0xc9684a[_0xa9f7('0x18')]=qs[_0xa9f7('0x18')](_0x16437e[_0xa9f7('0x29')]['offset']);}_0xc9684a['order']=qs[_0xa9f7('0x32')](_0x16437e['query'][_0xa9f7('0x32')]);_0xc9684a[_0xa9f7('0x33')]=qs[_0xa9f7('0x2a')](_[_0xa9f7('0x34')](_0x16437e['query'],_0x471c3c[_0xa9f7('0x2a')]),_0x18a788);if(_0x16437e[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0xc9684a[_0xa9f7('0x33')]=_[_0xa9f7('0x36')](_0xc9684a[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x18a788,function(_0x492b73){if(_0x492b73[_0xa9f7('0x38')]!==_0xa9f7('0x39')){var _0x4e43a6={};_0x4e43a6[_0x492b73[_0xa9f7('0x24')]]={'$like':'%'+_0x16437e[_0xa9f7('0x29')][_0xa9f7('0x35')]+'%'};return _0x4e43a6;}})});}_0xc9684a=_[_0xa9f7('0x36')]({},_0xc9684a,_0x16437e[_0xa9f7('0x3a')]);var _0xaf5272={'where':_0xc9684a[_0xa9f7('0x33')]};return db['Trigger'][_0xa9f7('0x3b')](_0xaf5272)[_0xa9f7('0x21')](function(_0x30374d){_0x40cad3['count']=_0x30374d;if(_0x16437e[_0xa9f7('0x29')]['includeAll']){_0xc9684a[_0xa9f7('0x3c')]=[{'all':!![]}];}return db[_0xa9f7('0x3d')]['findAll'](_0xc9684a);})[_0xa9f7('0x21')](function(_0x216112){_0x40cad3[_0xa9f7('0x3e')]=_0x216112;return _0x40cad3;})[_0xa9f7('0x21')](respondWithFilteredResult(_0x312084,_0xc9684a))[_0xa9f7('0x3f')](handleError(_0x312084,null));};exports['show']=function(_0x3fb0d6,_0x2d9e79){var _0x309883={'raw':![],'where':{'id':_0x3fb0d6[_0xa9f7('0x40')]['id']}},_0x3c0748={};_0x3c0748[_0xa9f7('0x2c')]=_[_0xa9f7('0x41')](db[_0xa9f7('0x3d')][_0xa9f7('0x42')]);_0x3c0748[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x3fb0d6[_0xa9f7('0x29')]);_0x3c0748['filters']=_['intersection'](_0x3c0748[_0xa9f7('0x2c')],_0x3c0748[_0xa9f7('0x29')]);_0x309883[_0xa9f7('0x2e')]=_[_0xa9f7('0x2b')](_0x3c0748[_0xa9f7('0x2c')],qs[_0xa9f7('0x2d')](_0x3fb0d6[_0xa9f7('0x29')][_0xa9f7('0x2d')]));_0x309883['attributes']=_0x309883[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0x309883[_0xa9f7('0x2e')]:_0x3c0748['model'];if(_0x3fb0d6['query'][_0xa9f7('0x43')]){_0x309883['include']=[{'all':!![]}];}_0x309883=_[_0xa9f7('0x36')]({},_0x309883,_0x3fb0d6[_0xa9f7('0x3a')]);return db[_0xa9f7('0x3d')][_0xa9f7('0x44')](_0x309883)['then'](handleEntityNotFound(_0x2d9e79,null))[_0xa9f7('0x21')](respondWithResult(_0x2d9e79,null))['catch'](handleError(_0x2d9e79,null));};exports[_0xa9f7('0x45')]=function(_0x37f146,_0x3a64b5){return db[_0xa9f7('0x3d')][_0xa9f7('0x45')](_0x37f146[_0xa9f7('0x46')],{})[_0xa9f7('0x21')](function(_0x232371){var _0x11e37d=_0x37f146['user'][_0xa9f7('0x20')]({'plain':!![]});if(!_0x11e37d)throw new Error(_0xa9f7('0x47'));if(_0x11e37d[_0xa9f7('0x48')]==='user'){var _0x3f6998=_0x232371[_0xa9f7('0x20')]({'plain':!![]});var _0x421023=_0xa9f7('0x49');return db[_0xa9f7('0x4a')][_0xa9f7('0x44')]({'where':{'name':_0x421023,'userProfileId':_0x11e37d[_0xa9f7('0x4b')]},'raw':!![]})[_0xa9f7('0x21')](function(_0x280104){if(_0x280104&&_0x280104[_0xa9f7('0x4c')]===0x0){return db[_0xa9f7('0x4d')]['create']({'name':_0x3f6998[_0xa9f7('0x24')],'resourceId':_0x3f6998['id'],'type':_0x280104[_0xa9f7('0x24')],'sectionId':_0x280104['id']},{})[_0xa9f7('0x21')](function(){return _0x232371;});}else{return _0x232371;}})['catch'](function(_0x121394){logger[_0xa9f7('0x22')](_0xa9f7('0x4e'),_0x121394);throw _0x121394;});}return _0x232371;})[_0xa9f7('0x21')](respondWithResult(_0x3a64b5,0xc9))[_0xa9f7('0x3f')](handleError(_0x3a64b5,null));};exports[_0xa9f7('0x4f')]=function(_0x303553,_0x5783cd){if(_0x303553[_0xa9f7('0x46')]['id']){delete _0x303553[_0xa9f7('0x46')]['id'];}return db[_0xa9f7('0x3d')][_0xa9f7('0x44')]({'where':{'id':_0x303553['params']['id']}})['then'](handleEntityNotFound(_0x5783cd,null))[_0xa9f7('0x21')](saveUpdates(_0x303553[_0xa9f7('0x46')],null))['then'](respondWithResult(_0x5783cd,null))[_0xa9f7('0x3f')](handleError(_0x5783cd,null));};exports[_0xa9f7('0x1f')]=function(_0x379b44,_0x281fdd){return db[_0xa9f7('0x3d')][_0xa9f7('0x44')]({'where':{'id':_0x379b44['params']['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x281fdd,null))[_0xa9f7('0x21')](removeEntity(_0x281fdd,null))[_0xa9f7('0x3f')](handleError(_0x281fdd,null));};exports[_0xa9f7('0x50')]=function(_0x2b7a1f,_0xed6ce3,_0x54f320){if(_0x2b7a1f['body']['id']){delete _0x2b7a1f[_0xa9f7('0x46')]['id'];}return db[_0xa9f7('0x3d')][_0xa9f7('0x44')]({'where':{'id':_0x2b7a1f[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0xed6ce3,null))[_0xa9f7('0x21')](function(_0x3d2f29){if(_0x3d2f29){_0x2b7a1f['body'][_0xa9f7('0x51')]=_0x3d2f29['id'];return db[_0xa9f7('0x52')][_0xa9f7('0x45')](_0x2b7a1f[_0xa9f7('0x46')]);}})[_0xa9f7('0x21')](respondWithResult(_0xed6ce3,null))[_0xa9f7('0x3f')](handleError(_0xed6ce3,null));};exports[_0xa9f7('0x53')]=function(_0x24e920,_0x313165,_0x5e1b3a){if(_0x24e920[_0xa9f7('0x46')]['id']){delete _0x24e920['body']['id'];}return db[_0xa9f7('0x3d')]['find']({'where':{'id':_0x24e920[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x313165,null))[_0xa9f7('0x21')](function(_0xafb61a){if(_0xafb61a){_0x24e920[_0xa9f7('0x46')]['TriggerAnyId']=_0xafb61a['id'];return db[_0xa9f7('0x52')][_0xa9f7('0x45')](_0x24e920[_0xa9f7('0x46')]);}})['then'](respondWithResult(_0x313165,null))[_0xa9f7('0x3f')](handleError(_0x313165,null));};exports['getAllConditions']=function(_0x3af9eb,_0xe7754e,_0x3a8d50){var _0x50c073={};var _0x3c0df7={};var _0x142808;var _0x351b4f;return db['Trigger']['findOne']({'where':{'id':_0x3af9eb['params']['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0xe7754e,null))[_0xa9f7('0x21')](function(_0x4544e6){if(_0x4544e6){_0x142808=_0x4544e6;_0x3c0df7['model']=_[_0xa9f7('0x41')](db[_0xa9f7('0x52')][_0xa9f7('0x42')]);_0x3c0df7[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x3af9eb[_0xa9f7('0x29')]);_0x3c0df7[_0xa9f7('0x2a')]=_[_0xa9f7('0x2b')](_0x3c0df7[_0xa9f7('0x2c')],_0x3c0df7['query']);_0x50c073[_0xa9f7('0x2e')]=_[_0xa9f7('0x2b')](_0x3c0df7[_0xa9f7('0x2c')],qs[_0xa9f7('0x2d')](_0x3af9eb[_0xa9f7('0x29')]['fields']));_0x50c073['attributes']=_0x50c073[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0x50c073[_0xa9f7('0x2e')]:_0x3c0df7[_0xa9f7('0x2c')];_0x50c073[_0xa9f7('0x54')]=qs[_0xa9f7('0x32')](_0x3af9eb[_0xa9f7('0x29')][_0xa9f7('0x32')]);_0x50c073[_0xa9f7('0x33')]=qs[_0xa9f7('0x2a')](_['pick'](_0x3af9eb[_0xa9f7('0x29')],_0x3c0df7[_0xa9f7('0x2a')]));if(_0x3af9eb[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0x50c073['where']=_[_0xa9f7('0x36')](_0x50c073[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x50c073[_0xa9f7('0x2e')],function(_0x2f1c91){var _0x4bbd56={};_0x4bbd56[_0x2f1c91]={'$like':'%'+_0x3af9eb['query'][_0xa9f7('0x35')]+'%'};return _0x4bbd56;})});}_0x50c073=_[_0xa9f7('0x36')]({},_0x50c073,_0x3af9eb['options']);return _0x142808[_0xa9f7('0x55')](_0x50c073);}})[_0xa9f7('0x21')](function(_0x273e3b){if(_0x273e3b){_0x351b4f=_0x273e3b[_0xa9f7('0x2f')];if(!_0x3af9eb['query'][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0x50c073['limit']=qs['limit'](_0x3af9eb[_0xa9f7('0x29')][_0xa9f7('0x19')]);_0x50c073['offset']=qs['offset'](_0x3af9eb['query'][_0xa9f7('0x18')]);}return _0x142808['getAllConditions'](_0x50c073);}})['then'](function(_0x258ba4){if(_0x258ba4){return _0x258ba4?{'count':_0x351b4f,'rows':_0x258ba4}:null;}})[_0xa9f7('0x21')](respondWithResult(_0xe7754e,null))['catch'](handleError(_0xe7754e,null));};exports[_0xa9f7('0x56')]=function(_0x57e905,_0x17a032,_0x57ca92){var _0x2d9d0e={};var _0x92b7ad={};var _0x4070d4;var _0x15aae0;return db[_0xa9f7('0x3d')][_0xa9f7('0x57')]({'where':{'id':_0x57e905[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x17a032,null))[_0xa9f7('0x21')](function(_0x2f7061){if(_0x2f7061){_0x4070d4=_0x2f7061;_0x92b7ad[_0xa9f7('0x2c')]=_[_0xa9f7('0x41')](db[_0xa9f7('0x52')]['rawAttributes']);_0x92b7ad[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x57e905[_0xa9f7('0x29')]);_0x92b7ad[_0xa9f7('0x2a')]=_[_0xa9f7('0x2b')](_0x92b7ad[_0xa9f7('0x2c')],_0x92b7ad['query']);_0x2d9d0e[_0xa9f7('0x2e')]=_[_0xa9f7('0x2b')](_0x92b7ad[_0xa9f7('0x2c')],qs[_0xa9f7('0x2d')](_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x2d')]));_0x2d9d0e[_0xa9f7('0x2e')]=_0x2d9d0e['attributes'][_0xa9f7('0x2f')]?_0x2d9d0e[_0xa9f7('0x2e')]:_0x92b7ad[_0xa9f7('0x2c')];_0x2d9d0e['order']=qs[_0xa9f7('0x32')](_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x32')]);_0x2d9d0e['where']=qs[_0xa9f7('0x2a')](_[_0xa9f7('0x34')](_0x57e905[_0xa9f7('0x29')],_0x92b7ad[_0xa9f7('0x2a')]));if(_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0x2d9d0e['where']=_[_0xa9f7('0x36')](_0x2d9d0e[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x2d9d0e['attributes'],function(_0x154f2e){var _0x4c62e0={};_0x4c62e0[_0x154f2e]={'$like':'%'+_0x57e905['query'][_0xa9f7('0x35')]+'%'};return _0x4c62e0;})});}_0x2d9d0e=_[_0xa9f7('0x36')]({},_0x2d9d0e,_0x57e905[_0xa9f7('0x3a')]);return _0x4070d4[_0xa9f7('0x56')](_0x2d9d0e);}})['then'](function(_0x59ca22){if(_0x59ca22){_0x15aae0=_0x59ca22[_0xa9f7('0x2f')];if(!_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0x2d9d0e[_0xa9f7('0x19')]=qs[_0xa9f7('0x19')](_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x19')]);_0x2d9d0e[_0xa9f7('0x18')]=qs[_0xa9f7('0x18')](_0x57e905['query'][_0xa9f7('0x18')]);}return _0x4070d4[_0xa9f7('0x56')](_0x2d9d0e);}})[_0xa9f7('0x21')](function(_0x189a76){if(_0x189a76){return _0x189a76?{'count':_0x15aae0,'rows':_0x189a76}:null;}})[_0xa9f7('0x21')](respondWithResult(_0x17a032,null))['catch'](handleError(_0x17a032,null));};exports[_0xa9f7('0x58')]=function(_0x5e0402,_0x1aa897,_0x254af6){if(_0x5e0402[_0xa9f7('0x46')]['id']){delete _0x5e0402[_0xa9f7('0x46')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5e0402[_0xa9f7('0x40')]['id']}})['then'](handleEntityNotFound(_0x1aa897,null))[_0xa9f7('0x21')](function(_0x286b71){if(_0x286b71){_0x5e0402[_0xa9f7('0x46')][_0xa9f7('0x59')]=_0x286b71['id'];return db[_0xa9f7('0x5a')][_0xa9f7('0x45')](_0x5e0402[_0xa9f7('0x46')]);}})[_0xa9f7('0x21')](respondWithResult(_0x1aa897,null))[_0xa9f7('0x3f')](handleError(_0x1aa897,null));};exports[_0xa9f7('0x5b')]=function(_0x458663,_0x146318,_0x6285bd){var _0x840ef8={};var _0x1c41d6={};var _0x5674c1;var _0x1c90e3;return db[_0xa9f7('0x3d')][_0xa9f7('0x57')]({'where':{'id':_0x458663[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x146318,null))['then'](function(_0x20b5d3){if(_0x20b5d3){_0x5674c1=_0x20b5d3;_0x1c41d6[_0xa9f7('0x2c')]=_[_0xa9f7('0x41')](db[_0xa9f7('0x5a')][_0xa9f7('0x42')]);_0x1c41d6[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x458663[_0xa9f7('0x29')]);_0x1c41d6['filters']=_[_0xa9f7('0x2b')](_0x1c41d6[_0xa9f7('0x2c')],_0x1c41d6[_0xa9f7('0x29')]);_0x840ef8[_0xa9f7('0x2e')]=_['intersection'](_0x1c41d6['model'],qs[_0xa9f7('0x2d')](_0x458663['query'][_0xa9f7('0x2d')]));_0x840ef8[_0xa9f7('0x2e')]=_0x840ef8[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0x840ef8[_0xa9f7('0x2e')]:_0x1c41d6[_0xa9f7('0x2c')];_0x840ef8[_0xa9f7('0x54')]=qs[_0xa9f7('0x32')](_0x458663['query'][_0xa9f7('0x32')]);_0x840ef8[_0xa9f7('0x33')]=qs[_0xa9f7('0x2a')](_['pick'](_0x458663[_0xa9f7('0x29')],_0x1c41d6['filters']));if(_0x458663[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0x840ef8['where']=_[_0xa9f7('0x36')](_0x840ef8[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x840ef8[_0xa9f7('0x2e')],function(_0x1ed30e){var _0x595762={};_0x595762[_0x1ed30e]={'$like':'%'+_0x458663[_0xa9f7('0x29')][_0xa9f7('0x35')]+'%'};return _0x595762;})});}_0x840ef8=_[_0xa9f7('0x36')]({},_0x840ef8,_0x458663[_0xa9f7('0x3a')]);return _0x5674c1[_0xa9f7('0x5b')](_0x840ef8);}})[_0xa9f7('0x21')](function(_0x15f652){if(_0x15f652){_0x1c90e3=_0x15f652['length'];if(!_0x458663[_0xa9f7('0x29')][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0x840ef8[_0xa9f7('0x19')]=qs[_0xa9f7('0x19')](_0x458663[_0xa9f7('0x29')][_0xa9f7('0x19')]);_0x840ef8[_0xa9f7('0x18')]=qs[_0xa9f7('0x18')](_0x458663['query']['offset']);}return _0x5674c1['getActions'](_0x840ef8);}})[_0xa9f7('0x21')](function(_0x149fcc){if(_0x149fcc){return _0x149fcc?{'count':_0x1c90e3,'rows':_0x149fcc}:null;}})[_0xa9f7('0x21')](respondWithResult(_0x146318,null))['catch'](handleError(_0x146318,null));}; \ No newline at end of file +var _0xfcbd=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','then','destroy','Triggers','UserProfileResource','error','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','type','merge','options','Trigger','include','findAll','rows','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','sort','nolimit','getAnyConditions','TriggerId','getActions','Action','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x42aaf4,_0x26474c){var _0x4d2105=function(_0x103468){while(--_0x103468){_0x42aaf4['push'](_0x42aaf4['shift']());}};_0x4d2105(++_0x26474c);}(_0xfcbd,0x160));var _0xdfcb=function(_0x26d467,_0x864bb1){_0x26d467=_0x26d467-0x0;var _0x5b86dd=_0xfcbd[_0x26d467];return _0x5b86dd;};'use strict';var pdf=require(_0xdfcb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdfcb('0x1'));var jsonpatch=require(_0xdfcb('0x2'));var rp=require(_0xdfcb('0x3'));var moment=require(_0xdfcb('0x4'));var BPromise=require(_0xdfcb('0x5'));var Mustache=require(_0xdfcb('0x6'));var util=require(_0xdfcb('0x7'));var path=require(_0xdfcb('0x8'));var sox=require(_0xdfcb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdfcb('0xa'));var squel=require(_0xdfcb('0xb'));var crypto=require(_0xdfcb('0xc'));var jsforce=require(_0xdfcb('0xd'));var deskjs=require(_0xdfcb('0xe'));var toCsv=require(_0xdfcb('0xf'));var querystring=require(_0xdfcb('0x10'));var Papa=require('papaparse');var Redis=require(_0xdfcb('0x11'));var authService=require(_0xdfcb('0x12'));var qs=require(_0xdfcb('0x13'));var as=require(_0xdfcb('0x14'));var hardwareService=require(_0xdfcb('0x15'));var logger=require(_0xdfcb('0x16'))(_0xdfcb('0x17'));var utils=require(_0xdfcb('0x18'));var config=require(_0xdfcb('0x19'));var licenseUtil=require(_0xdfcb('0x1a'));var db=require(_0xdfcb('0x1b'))['db'];function respondWithStatusCode(_0x4efab3,_0x47404b){_0x47404b=_0x47404b||0xcc;return function(_0x2e33ab){if(_0x2e33ab){return _0x4efab3[_0xdfcb('0x1c')](_0x47404b);}return _0x4efab3[_0xdfcb('0x1d')](_0x47404b)[_0xdfcb('0x1e')]();};}function respondWithResult(_0x5d10d3,_0xd8c73d){_0xd8c73d=_0xd8c73d||0xc8;return function(_0x391bf4){if(_0x391bf4){return _0x5d10d3[_0xdfcb('0x1d')](_0xd8c73d)[_0xdfcb('0x1f')](_0x391bf4);}};}function respondWithFilteredResult(_0x336866,_0x519cef){return function(_0x3afbd2){if(_0x3afbd2){var _0x421054=_0x3afbd2[_0xdfcb('0x20')],_0x1b48fa=_0x519cef[_0xdfcb('0x21')],_0x65ec83=_0x519cef[_0xdfcb('0x21')]+_0x519cef[_0xdfcb('0x22')],_0x11437d;if(_0x65ec83>=_0x421054){_0x65ec83=_0x421054;_0x11437d=0xc8;}else{_0x11437d=0xce;}_0x336866[_0xdfcb('0x1d')](_0x11437d);return _0x336866['set']('Content-Range',_0x1b48fa+'-'+_0x65ec83+'/'+_0x421054)[_0xdfcb('0x1f')](_0x3afbd2);}return null;};}function patchUpdates(_0x19051f){return function(_0x4a395c){try{jsonpatch[_0xdfcb('0x23')](_0x4a395c,_0x19051f,!![]);}catch(_0x14ffea){return BPromise['reject'](_0x14ffea);}return _0x4a395c['save']();};}function saveUpdates(_0x33ecab,_0x497db4){return function(_0x58e054){if(_0x58e054){return _0x58e054['update'](_0x33ecab)[_0xdfcb('0x24')](function(_0x206ee1){return _0x206ee1;});}return null;};}function removeEntity(_0x3e90f3,_0x52a572){return function(_0x31e168){if(_0x31e168){return _0x31e168[_0xdfcb('0x25')]()[_0xdfcb('0x24')](function(){var _0x4fa977=_0x31e168['get']({'plain':!![]});var _0x4de7f1=_0xdfcb('0x26');return db[_0xdfcb('0x27')][_0xdfcb('0x25')]({'where':{'type':_0x4de7f1,'resourceId':_0x4fa977['id']}})[_0xdfcb('0x24')](function(){return _0x31e168;});})[_0xdfcb('0x24')](function(){_0x3e90f3[_0xdfcb('0x1d')](0xcc)[_0xdfcb('0x1e')]();});}};}function handleEntityNotFound(_0xd59237,_0xcc70ee){return function(_0x3cca71){if(!_0x3cca71){_0xd59237[_0xdfcb('0x1c')](0x194);}return _0x3cca71;};}function handleError(_0x17de12,_0xb2ef1f){_0xb2ef1f=_0xb2ef1f||0x1f4;return function(_0x20cbcd){logger[_0xdfcb('0x28')](_0x20cbcd['stack']);if(_0x20cbcd[_0xdfcb('0x29')]){delete _0x20cbcd[_0xdfcb('0x29')];}_0x17de12[_0xdfcb('0x1d')](_0xb2ef1f)[_0xdfcb('0x2a')](_0x20cbcd);};}exports['index']=function(_0x241f11,_0x531918){var _0x57bc52={},_0x29ce66={},_0x28682c={'count':0x0,'rows':[]};var _0x629381=_[_0xdfcb('0x2b')](db['Trigger'][_0xdfcb('0x2c')],function(_0x5e2945){return{'name':_0x5e2945[_0xdfcb('0x2d')],'type':_0x5e2945['type'][_0xdfcb('0x2e')]};});_0x29ce66[_0xdfcb('0x2f')]=_[_0xdfcb('0x2b')](_0x629381,'name');_0x29ce66['query']=_[_0xdfcb('0x30')](_0x241f11[_0xdfcb('0x31')]);_0x29ce66[_0xdfcb('0x32')]=_[_0xdfcb('0x33')](_0x29ce66[_0xdfcb('0x2f')],_0x29ce66[_0xdfcb('0x31')]);_0x57bc52[_0xdfcb('0x34')]=_['intersection'](_0x29ce66[_0xdfcb('0x2f')],qs[_0xdfcb('0x35')](_0x241f11['query']['fields']));_0x57bc52[_0xdfcb('0x34')]=_0x57bc52[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x57bc52[_0xdfcb('0x34')]:_0x29ce66['model'];if(!_0x241f11['query'][_0xdfcb('0x37')]('nolimit')){_0x57bc52['limit']=qs['limit'](_0x241f11[_0xdfcb('0x31')][_0xdfcb('0x22')]);_0x57bc52['offset']=qs['offset'](_0x241f11['query'][_0xdfcb('0x21')]);}_0x57bc52[_0xdfcb('0x38')]=qs['sort'](_0x241f11['query']['sort']);_0x57bc52[_0xdfcb('0x39')]=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0x241f11[_0xdfcb('0x31')],_0x29ce66[_0xdfcb('0x32')]),_0x629381);if(_0x241f11[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x57bc52['where']=_['merge'](_0x57bc52[_0xdfcb('0x39')],{'$or':_[_0xdfcb('0x2b')](_0x629381,function(_0x3634cc){if(_0x3634cc[_0xdfcb('0x3c')]!=='VIRTUAL'){var _0x293973={};_0x293973[_0x3634cc[_0xdfcb('0x29')]]={'$like':'%'+_0x241f11['query'][_0xdfcb('0x3b')]+'%'};return _0x293973;}})});}_0x57bc52=_[_0xdfcb('0x3d')]({},_0x57bc52,_0x241f11[_0xdfcb('0x3e')]);var _0x2f73af={'where':_0x57bc52['where']};return db[_0xdfcb('0x3f')][_0xdfcb('0x20')](_0x2f73af)[_0xdfcb('0x24')](function(_0x33c0db){_0x28682c['count']=_0x33c0db;if(_0x241f11[_0xdfcb('0x31')]['includeAll']){_0x57bc52[_0xdfcb('0x40')]=[{'all':!![]}];}return db[_0xdfcb('0x3f')][_0xdfcb('0x41')](_0x57bc52);})[_0xdfcb('0x24')](function(_0x294efb){_0x28682c[_0xdfcb('0x42')]=_0x294efb;return _0x28682c;})['then'](respondWithFilteredResult(_0x531918,_0x57bc52))['catch'](handleError(_0x531918,null));};exports['show']=function(_0x176ec5,_0x2c45b5){var _0x3abf85={'raw':![],'where':{'id':_0x176ec5[_0xdfcb('0x43')]['id']}},_0x1d36b0={};_0x1d36b0[_0xdfcb('0x2f')]=_[_0xdfcb('0x30')](db[_0xdfcb('0x3f')][_0xdfcb('0x2c')]);_0x1d36b0['query']=_[_0xdfcb('0x30')](_0x176ec5['query']);_0x1d36b0[_0xdfcb('0x32')]=_['intersection'](_0x1d36b0[_0xdfcb('0x2f')],_0x1d36b0['query']);_0x3abf85[_0xdfcb('0x34')]=_[_0xdfcb('0x33')](_0x1d36b0[_0xdfcb('0x2f')],qs['fields'](_0x176ec5[_0xdfcb('0x31')][_0xdfcb('0x35')]));_0x3abf85[_0xdfcb('0x34')]=_0x3abf85[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x3abf85['attributes']:_0x1d36b0[_0xdfcb('0x2f')];if(_0x176ec5['query'][_0xdfcb('0x44')]){_0x3abf85['include']=[{'all':!![]}];}_0x3abf85=_[_0xdfcb('0x3d')]({},_0x3abf85,_0x176ec5['options']);return db[_0xdfcb('0x3f')]['find'](_0x3abf85)['then'](handleEntityNotFound(_0x2c45b5,null))['then'](respondWithResult(_0x2c45b5,null))[_0xdfcb('0x45')](handleError(_0x2c45b5,null));};exports[_0xdfcb('0x46')]=function(_0x5831da,_0xf380c6){return db[_0xdfcb('0x3f')][_0xdfcb('0x46')](_0x5831da[_0xdfcb('0x47')],{})[_0xdfcb('0x24')](function(_0x14716d){var _0x5ae111=_0x5831da[_0xdfcb('0x48')]['get']({'plain':!![]});if(!_0x5ae111)throw new Error(_0xdfcb('0x49'));if(_0x5ae111['role']===_0xdfcb('0x48')){var _0x2de51c=_0x14716d[_0xdfcb('0x4a')]({'plain':!![]});var _0x51129a=_0xdfcb('0x26');return db[_0xdfcb('0x4b')][_0xdfcb('0x4c')]({'where':{'name':_0x51129a,'userProfileId':_0x5ae111[_0xdfcb('0x4d')]},'raw':!![]})[_0xdfcb('0x24')](function(_0x5c2176){if(_0x5c2176&&_0x5c2176[_0xdfcb('0x4e')]===0x0){return db[_0xdfcb('0x27')][_0xdfcb('0x46')]({'name':_0x2de51c['name'],'resourceId':_0x2de51c['id'],'type':_0x5c2176[_0xdfcb('0x29')],'sectionId':_0x5c2176['id']},{})[_0xdfcb('0x24')](function(){return _0x14716d;});}else{return _0x14716d;}})[_0xdfcb('0x45')](function(_0x5bb87c){logger[_0xdfcb('0x28')](_0xdfcb('0x4f'),_0x5bb87c);throw _0x5bb87c;});}return _0x14716d;})[_0xdfcb('0x24')](respondWithResult(_0xf380c6,0xc9))['catch'](handleError(_0xf380c6,null));};exports[_0xdfcb('0x50')]=function(_0x13b922,_0x55e1a9){if(_0x13b922[_0xdfcb('0x47')]['id']){delete _0x13b922[_0xdfcb('0x47')]['id'];}return db['Trigger'][_0xdfcb('0x4c')]({'where':{'id':_0x13b922['params']['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x55e1a9,null))[_0xdfcb('0x24')](saveUpdates(_0x13b922[_0xdfcb('0x47')],null))[_0xdfcb('0x24')](respondWithResult(_0x55e1a9,null))[_0xdfcb('0x45')](handleError(_0x55e1a9,null));};exports[_0xdfcb('0x25')]=function(_0x9f88ea,_0x1fe021){return db[_0xdfcb('0x3f')][_0xdfcb('0x4c')]({'where':{'id':_0x9f88ea['params']['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x1fe021,null))[_0xdfcb('0x24')](removeEntity(_0x1fe021,null))['catch'](handleError(_0x1fe021,null));};exports[_0xdfcb('0x51')]=function(_0xea12af,_0x4badac,_0x1d8719){if(_0xea12af[_0xdfcb('0x47')]['id']){delete _0xea12af[_0xdfcb('0x47')]['id'];}return db[_0xdfcb('0x3f')]['find']({'where':{'id':_0xea12af[_0xdfcb('0x43')]['id']}})['then'](handleEntityNotFound(_0x4badac,null))[_0xdfcb('0x24')](function(_0x72390f){if(_0x72390f){_0xea12af[_0xdfcb('0x47')]['TriggerAllId']=_0x72390f['id'];return db[_0xdfcb('0x52')][_0xdfcb('0x46')](_0xea12af[_0xdfcb('0x47')]);}})[_0xdfcb('0x24')](respondWithResult(_0x4badac,null))[_0xdfcb('0x45')](handleError(_0x4badac,null));};exports[_0xdfcb('0x53')]=function(_0x59b218,_0x2f41c2,_0x26e5ab){if(_0x59b218[_0xdfcb('0x47')]['id']){delete _0x59b218[_0xdfcb('0x47')]['id'];}return db[_0xdfcb('0x3f')][_0xdfcb('0x4c')]({'where':{'id':_0x59b218[_0xdfcb('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f41c2,null))[_0xdfcb('0x24')](function(_0x5a317b){if(_0x5a317b){_0x59b218[_0xdfcb('0x47')]['TriggerAnyId']=_0x5a317b['id'];return db['Condition'][_0xdfcb('0x46')](_0x59b218['body']);}})['then'](respondWithResult(_0x2f41c2,null))[_0xdfcb('0x45')](handleError(_0x2f41c2,null));};exports[_0xdfcb('0x54')]=function(_0x2b6af7,_0x137030,_0x2361b3){var _0x5c073d={};var _0x1b6fcd={};var _0x11346e;var _0x437e7d;return db[_0xdfcb('0x3f')][_0xdfcb('0x55')]({'where':{'id':_0x2b6af7['params']['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x137030,null))['then'](function(_0x3b6cb8){if(_0x3b6cb8){_0x11346e=_0x3b6cb8;_0x1b6fcd[_0xdfcb('0x2f')]=_[_0xdfcb('0x30')](db[_0xdfcb('0x52')]['rawAttributes']);_0x1b6fcd[_0xdfcb('0x31')]=_['keys'](_0x2b6af7[_0xdfcb('0x31')]);_0x1b6fcd['filters']=_[_0xdfcb('0x33')](_0x1b6fcd[_0xdfcb('0x2f')],_0x1b6fcd[_0xdfcb('0x31')]);_0x5c073d['attributes']=_['intersection'](_0x1b6fcd['model'],qs[_0xdfcb('0x35')](_0x2b6af7['query'][_0xdfcb('0x35')]));_0x5c073d[_0xdfcb('0x34')]=_0x5c073d[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x5c073d[_0xdfcb('0x34')]:_0x1b6fcd[_0xdfcb('0x2f')];_0x5c073d['order']=qs['sort'](_0x2b6af7['query'][_0xdfcb('0x56')]);_0x5c073d[_0xdfcb('0x39')]=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0x2b6af7['query'],_0x1b6fcd[_0xdfcb('0x32')]));if(_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x5c073d[_0xdfcb('0x39')]=_[_0xdfcb('0x3d')](_0x5c073d[_0xdfcb('0x39')],{'$or':_[_0xdfcb('0x2b')](_0x5c073d[_0xdfcb('0x34')],function(_0x300337){var _0x2a2d15={};_0x2a2d15[_0x300337]={'$like':'%'+_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x3b')]+'%'};return _0x2a2d15;})});}_0x5c073d=_['merge']({},_0x5c073d,_0x2b6af7[_0xdfcb('0x3e')]);return _0x11346e[_0xdfcb('0x54')](_0x5c073d);}})[_0xdfcb('0x24')](function(_0xf539fd){if(_0xf539fd){_0x437e7d=_0xf539fd[_0xdfcb('0x36')];if(!_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x37')](_0xdfcb('0x57'))){_0x5c073d[_0xdfcb('0x22')]=qs[_0xdfcb('0x22')](_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x22')]);_0x5c073d[_0xdfcb('0x21')]=qs[_0xdfcb('0x21')](_0x2b6af7[_0xdfcb('0x31')][_0xdfcb('0x21')]);}return _0x11346e[_0xdfcb('0x54')](_0x5c073d);}})[_0xdfcb('0x24')](function(_0x52651f){if(_0x52651f){return _0x52651f?{'count':_0x437e7d,'rows':_0x52651f}:null;}})[_0xdfcb('0x24')](respondWithResult(_0x137030,null))[_0xdfcb('0x45')](handleError(_0x137030,null));};exports[_0xdfcb('0x58')]=function(_0xf4175e,_0x29c2d4,_0x24808c){var _0x2f5f65={};var _0x47ff09={};var _0x3fc3b0;var _0x2d2f36;return db[_0xdfcb('0x3f')]['findOne']({'where':{'id':_0xf4175e[_0xdfcb('0x43')]['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x29c2d4,null))[_0xdfcb('0x24')](function(_0x4c808f){if(_0x4c808f){_0x3fc3b0=_0x4c808f;_0x47ff09[_0xdfcb('0x2f')]=_['keys'](db['Condition'][_0xdfcb('0x2c')]);_0x47ff09[_0xdfcb('0x31')]=_[_0xdfcb('0x30')](_0xf4175e[_0xdfcb('0x31')]);_0x47ff09[_0xdfcb('0x32')]=_[_0xdfcb('0x33')](_0x47ff09['model'],_0x47ff09[_0xdfcb('0x31')]);_0x2f5f65['attributes']=_['intersection'](_0x47ff09['model'],qs[_0xdfcb('0x35')](_0xf4175e[_0xdfcb('0x31')]['fields']));_0x2f5f65[_0xdfcb('0x34')]=_0x2f5f65['attributes']['length']?_0x2f5f65['attributes']:_0x47ff09[_0xdfcb('0x2f')];_0x2f5f65['order']=qs['sort'](_0xf4175e['query']['sort']);_0x2f5f65[_0xdfcb('0x39')]=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0xf4175e[_0xdfcb('0x31')],_0x47ff09['filters']));if(_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x2f5f65[_0xdfcb('0x39')]=_[_0xdfcb('0x3d')](_0x2f5f65[_0xdfcb('0x39')],{'$or':_[_0xdfcb('0x2b')](_0x2f5f65['attributes'],function(_0x4e9326){var _0x523a59={};_0x523a59[_0x4e9326]={'$like':'%'+_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x3b')]+'%'};return _0x523a59;})});}_0x2f5f65=_[_0xdfcb('0x3d')]({},_0x2f5f65,_0xf4175e['options']);return _0x3fc3b0[_0xdfcb('0x58')](_0x2f5f65);}})[_0xdfcb('0x24')](function(_0xf359cc){if(_0xf359cc){_0x2d2f36=_0xf359cc[_0xdfcb('0x36')];if(!_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x37')]('nolimit')){_0x2f5f65[_0xdfcb('0x22')]=qs['limit'](_0xf4175e['query'][_0xdfcb('0x22')]);_0x2f5f65[_0xdfcb('0x21')]=qs[_0xdfcb('0x21')](_0xf4175e[_0xdfcb('0x31')][_0xdfcb('0x21')]);}return _0x3fc3b0[_0xdfcb('0x58')](_0x2f5f65);}})[_0xdfcb('0x24')](function(_0x191223){if(_0x191223){return _0x191223?{'count':_0x2d2f36,'rows':_0x191223}:null;}})['then'](respondWithResult(_0x29c2d4,null))['catch'](handleError(_0x29c2d4,null));};exports['addAction']=function(_0x10310f,_0x353a36,_0x50b139){if(_0x10310f[_0xdfcb('0x47')]['id']){delete _0x10310f[_0xdfcb('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0x10310f[_0xdfcb('0x43')]['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x353a36,null))[_0xdfcb('0x24')](function(_0x4bb934){if(_0x4bb934){_0x10310f[_0xdfcb('0x47')][_0xdfcb('0x59')]=_0x4bb934['id'];return db['Action'][_0xdfcb('0x46')](_0x10310f[_0xdfcb('0x47')]);}})[_0xdfcb('0x24')](respondWithResult(_0x353a36,null))[_0xdfcb('0x45')](handleError(_0x353a36,null));};exports[_0xdfcb('0x5a')]=function(_0x17c33d,_0x102b07,_0x1b3c38){var _0x5e2499={};var _0x3e8a01={};var _0x1cb735;var _0x78ee20;return db['Trigger']['findOne']({'where':{'id':_0x17c33d[_0xdfcb('0x43')]['id']}})[_0xdfcb('0x24')](handleEntityNotFound(_0x102b07,null))[_0xdfcb('0x24')](function(_0x11ed12){if(_0x11ed12){_0x1cb735=_0x11ed12;_0x3e8a01['model']=_[_0xdfcb('0x30')](db[_0xdfcb('0x5b')]['rawAttributes']);_0x3e8a01['query']=_['keys'](_0x17c33d['query']);_0x3e8a01['filters']=_['intersection'](_0x3e8a01['model'],_0x3e8a01[_0xdfcb('0x31')]);_0x5e2499[_0xdfcb('0x34')]=_[_0xdfcb('0x33')](_0x3e8a01['model'],qs[_0xdfcb('0x35')](_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x35')]));_0x5e2499['attributes']=_0x5e2499[_0xdfcb('0x34')][_0xdfcb('0x36')]?_0x5e2499[_0xdfcb('0x34')]:_0x3e8a01[_0xdfcb('0x2f')];_0x5e2499[_0xdfcb('0x38')]=qs[_0xdfcb('0x56')](_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x56')]);_0x5e2499['where']=qs[_0xdfcb('0x32')](_[_0xdfcb('0x3a')](_0x17c33d[_0xdfcb('0x31')],_0x3e8a01[_0xdfcb('0x32')]));if(_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x3b')]){_0x5e2499[_0xdfcb('0x39')]=_['merge'](_0x5e2499['where'],{'$or':_[_0xdfcb('0x2b')](_0x5e2499[_0xdfcb('0x34')],function(_0x1123ec){var _0x6b9109={};_0x6b9109[_0x1123ec]={'$like':'%'+_0x17c33d['query'][_0xdfcb('0x3b')]+'%'};return _0x6b9109;})});}_0x5e2499=_[_0xdfcb('0x3d')]({},_0x5e2499,_0x17c33d[_0xdfcb('0x3e')]);return _0x1cb735['getActions'](_0x5e2499);}})[_0xdfcb('0x24')](function(_0x4f2b4b){if(_0x4f2b4b){_0x78ee20=_0x4f2b4b[_0xdfcb('0x36')];if(!_0x17c33d['query'][_0xdfcb('0x37')](_0xdfcb('0x57'))){_0x5e2499[_0xdfcb('0x22')]=qs['limit'](_0x17c33d[_0xdfcb('0x31')][_0xdfcb('0x22')]);_0x5e2499['offset']=qs['offset'](_0x17c33d['query'][_0xdfcb('0x21')]);}return _0x1cb735[_0xdfcb('0x5a')](_0x5e2499);}})['then'](function(_0x1ad126){if(_0x1ad126){return _0x1ad126?{'count':_0x78ee20,'rows':_0x1ad126}:null;}})[_0xdfcb('0x24')](respondWithResult(_0x102b07,null))['catch'](handleError(_0x102b07,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 02f323d..6106025 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 _0xaaf8=['rimraf','../../config/environment','./trigger.attributes','exports','Trigger','lodash','util','api','moment','request-promise','path'];(function(_0xe85862,_0x10097d){var _0x14e5c5=function(_0x56f0d0){while(--_0x56f0d0){_0xe85862['push'](_0xe85862['shift']());}};_0x14e5c5(++_0x10097d);}(_0xaaf8,0xb5));var _0x8aaf=function(_0x14a7fd,_0x2bf7a0){_0x14a7fd=_0x14a7fd-0x0;var _0xc45a5=_0xaaf8[_0x14a7fd];return _0xc45a5;};'use strict';var _=require(_0x8aaf('0x0'));var util=require(_0x8aaf('0x1'));var logger=require('../../config/logger')(_0x8aaf('0x2'));var moment=require(_0x8aaf('0x3'));var BPromise=require('bluebird');var rp=require(_0x8aaf('0x4'));var fs=require('fs');var path=require(_0x8aaf('0x5'));var rimraf=require(_0x8aaf('0x6'));var config=require(_0x8aaf('0x7'));var attributes=require(_0x8aaf('0x8'));module[_0x8aaf('0x9')]=function(_0x46d670,_0x266444){return _0x46d670['define'](_0x8aaf('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58d0=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash'];(function(_0x22f72e,_0x54cdad){var _0x56c4bf=function(_0x1979ec){while(--_0x1979ec){_0x22f72e['push'](_0x22f72e['shift']());}};_0x56c4bf(++_0x54cdad);}(_0x58d0,0xd0));var _0x058d=function(_0x100dc5,_0xc853e9){_0x100dc5=_0x100dc5-0x0;var _0x1dc4f6=_0x58d0[_0x100dc5];return _0x1dc4f6;};'use strict';var _=require(_0x058d('0x0'));var util=require(_0x058d('0x1'));var logger=require(_0x058d('0x2'))(_0x058d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x058d('0x4'));var fs=require('fs');var path=require(_0x058d('0x5'));var rimraf=require(_0x058d('0x6'));var config=require(_0x058d('0x7'));var attributes=require('./trigger.attributes');module[_0x058d('0x8')]=function(_0x26c5ae,_0xbc40ae){return _0x26c5ae['define'](_0x058d('0x9'),attributes,{'tableName':_0x058d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index ec993f6..ade63e2 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 _0x1d2d=['error','code','message','result','catch','Trigger','findAll','raw','where','options','attributes','limit','map','include','model','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44353d,_0x267761){var _0x93dd90=function(_0x218cc1){while(--_0x218cc1){_0x44353d['push'](_0x44353d['shift']());}};_0x93dd90(++_0x267761);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x2ded98,_0x3b87f5){_0x2ded98=_0x2ded98-0x0;var _0x40d5e1=_0x1d2d[_0x2ded98];return _0x40d5e1;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('Trigger,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});}exports['GetTrigger']=function(_0x3be186){var _0x55320b=this;return new Promise(function(_0x247b3a,_0x42565b){return db[_0xd1d2('0x18')][_0xd1d2('0x19')]({'raw':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1b')]||null:null,'attributes':_0x3be186[_0xd1d2('0x1c')]?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'limit':_0x3be186['options']?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1e')]||null:null,'include':_0x3be186[_0xd1d2('0x1c')]?_0x3be186['options']['include']?_[_0xd1d2('0x1f')](_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x20')],function(_0x2f92ee){return{'model':db[_0x2f92ee[_0xd1d2('0x21')]],'as':_0x2f92ee['as'],'attributes':_0x2f92ee[_0xd1d2('0x1d')],'include':_0x2f92ee[_0xd1d2('0x20')]?_['map'](_0x2f92ee[_0xd1d2('0x20')],function(_0x42da6d){return{'model':db[_0x42da6d[_0xd1d2('0x21')]],'as':_0x42da6d['as'],'attributes':_0x42da6d[_0xd1d2('0x1d')],'include':_0x42da6d[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x42da6d[_0xd1d2('0x20')],function(_0x34faf7){return{'model':db[_0x34faf7[_0xd1d2('0x21')]],'as':_0x34faf7['as'],'attributes':_0x34faf7[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x4e1bc2){logger['info'](_0xd1d2('0x22'),_0x3be186);logger[_0xd1d2('0x10')](_0xd1d2('0x22'),_0x3be186,JSON[_0xd1d2('0x12')](_0x4e1bc2));_0x247b3a(_0x4e1bc2);})[_0xd1d2('0x17')](function(_0x48ade1){logger[_0xd1d2('0x13')](_0xd1d2('0x22'),_0x48ade1[_0xd1d2('0x15')],_0x3be186);_0x42565b(_0x55320b['error'](0x1f4,_0x48ade1[_0xd1d2('0x15')]));});});};exports[_0xd1d2('0x23')]=function(_0xbd855a){var _0x56557d=this;return new Promise(function(_0x419db7,_0x18528f){return db[_0xd1d2('0x18')][_0xd1d2('0x24')]({'raw':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1b')]||null:null,'attributes':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'include':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0xbd855a[_0xd1d2('0x1c')]['include'],function(_0x1541ff){return{'model':db[_0x1541ff[_0xd1d2('0x21')]],'as':_0x1541ff['as'],'attributes':_0x1541ff[_0xd1d2('0x1d')],'include':_0x1541ff['include']?_[_0xd1d2('0x1f')](_0x1541ff['include'],function(_0x57a7fb){return{'model':db[_0x57a7fb[_0xd1d2('0x21')]],'as':_0x57a7fb['as'],'attributes':_0x57a7fb[_0xd1d2('0x1d')],'include':_0x57a7fb[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x57a7fb[_0xd1d2('0x20')],function(_0x2d2d12){return{'model':db[_0x2d2d12['model']],'as':_0x2d2d12['as'],'attributes':_0x2d2d12[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x5bdf40){logger[_0xd1d2('0xd')](_0xd1d2('0x23'),_0xbd855a);logger[_0xd1d2('0x10')](_0xd1d2('0x23'),_0xbd855a,JSON['stringify'](_0x5bdf40));_0x419db7(_0x5bdf40);})['catch'](function(_0x2fd2c5){logger['error']('ShowTrigger',_0x2fd2c5['message'],_0xbd855a);_0x18528f(_0x56557d[_0xd1d2('0x13')](0x1f4,_0x2fd2c5['message']));});});}; \ No newline at end of file +var _0x9354=['catch','GetTrigger','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowTrigger','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x53fc50,_0x46b346){var _0xf287e=function(_0x473943){while(--_0x473943){_0x53fc50['push'](_0x53fc50['shift']());}};_0xf287e(++_0x46b346);}(_0x9354,0x96));var _0x4935=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x9354[_0x38537f];return _0x141e23;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});}exports[_0x4935('0x15')]=function(_0x429ef3){var _0x4ebc63=this;return new Promise(function(_0xd70eff,_0x145277){return db['Trigger'][_0x4935('0x16')]({'raw':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x18')]||null:null,'attributes':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x19')]||null:null,'limit':_0x429ef3[_0x4935('0x17')]?_0x429ef3[_0x4935('0x17')][_0x4935('0x1a')]||null:null,'include':_0x429ef3['options']?_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x429ef3[_0x4935('0x17')][_0x4935('0x1b')],function(_0x53530f){return{'model':db[_0x53530f['model']],'as':_0x53530f['as'],'attributes':_0x53530f[_0x4935('0x19')],'include':_0x53530f[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x53530f[_0x4935('0x1b')],function(_0x344e51){return{'model':db[_0x344e51[_0x4935('0x1d')]],'as':_0x344e51['as'],'attributes':_0x344e51[_0x4935('0x19')],'include':_0x344e51[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x344e51[_0x4935('0x1b')],function(_0x1d08b5){return{'model':db[_0x1d08b5[_0x4935('0x1d')]],'as':_0x1d08b5['as'],'attributes':_0x1d08b5[_0x4935('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x359522){logger['info']('GetTrigger',_0x429ef3);logger['debug'](_0x4935('0x15'),_0x429ef3,JSON[_0x4935('0x1f')](_0x359522));_0xd70eff(_0x359522);})['catch'](function(_0x3f0707){logger[_0x4935('0x11')](_0x4935('0x15'),_0x3f0707[_0x4935('0x12')],_0x429ef3);_0x145277(_0x4ebc63[_0x4935('0x11')](0x1f4,_0x3f0707[_0x4935('0x12')]));});});};exports[_0x4935('0x20')]=function(_0x2fe6da){var _0x5b3c8e=this;return new Promise(function(_0xb7fe2a,_0x2dcb0b){return db['Trigger']['find']({'raw':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da['options'][_0x4935('0x21')]===undefined?!![]:![]:!![],'where':_0x2fe6da[_0x4935('0x17')]?_0x2fe6da[_0x4935('0x17')]['where']||null:null,'attributes':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x19')]||null:null,'include':_0x2fe6da['options']?_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x2fe6da[_0x4935('0x17')][_0x4935('0x1b')],function(_0x4a69bc){return{'model':db[_0x4a69bc['model']],'as':_0x4a69bc['as'],'attributes':_0x4a69bc[_0x4935('0x19')],'include':_0x4a69bc[_0x4935('0x1b')]?_['map'](_0x4a69bc['include'],function(_0xb3d934){return{'model':db[_0xb3d934['model']],'as':_0xb3d934['as'],'attributes':_0xb3d934[_0x4935('0x19')],'include':_0xb3d934[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0xb3d934[_0x4935('0x1b')],function(_0x1d77b8){return{'model':db[_0x1d77b8[_0x4935('0x1d')]],'as':_0x1d77b8['as'],'attributes':_0x1d77b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4935('0x1e')](function(_0x51b7ac){logger[_0x4935('0xc')]('ShowTrigger',_0x2fe6da);logger[_0x4935('0xf')]('ShowTrigger',_0x2fe6da,JSON[_0x4935('0x1f')](_0x51b7ac));_0xb7fe2a(_0x51b7ac);})[_0x4935('0x14')](function(_0x352679){logger[_0x4935('0x11')](_0x4935('0x20'),_0x352679[_0x4935('0x12')],_0x2fe6da);_0x2dcb0b(_0x5b3c8e[_0x4935('0x11')](0x1f4,_0x352679['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 9a9ac79..83cca04 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 _0x4c4e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x4c4e,0x152));var _0xe4c4=function(_0x31c07a,_0xbfbc6e){_0x31c07a=_0x31c07a-0x0;var _0x7b15e0=_0x4c4e[_0x31c07a];return _0x7b15e0;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var auth=require(_0xe4c4('0x4'));var interaction=require(_0xe4c4('0x5'));var config=require(_0xe4c4('0x6'));var controller=require('./trunk.controller');router[_0xe4c4('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4c4('0x8')]);router[_0xe4c4('0x7')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xb')]);router[_0xe4c4('0xc')](_0xe4c4('0xd'),auth[_0xe4c4('0xa')](),controller['clone']);router['post']('/',auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xe')]);router[_0xe4c4('0xf')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x10')]);router['delete'](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x11')]);module[_0xe4c4('0x12')]=router; \ No newline at end of file +var _0xedd9=['get','isAuthenticated','index','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26fe41,_0x22b289){var _0x212c15=function(_0xc3e6fd){while(--_0xc3e6fd){_0x26fe41['push'](_0x26fe41['shift']());}};_0x212c15(++_0x22b289);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d6d32,_0x87e471){_0x5d6d32=_0x5d6d32-0x0;var _0x1baccb=_0xedd9[_0x5d6d32];return _0x1baccb;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./trunk.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')](_0x9edd('0xc'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xd')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);module[_0x9edd('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 078ea20..be25c63 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 _0x6b1f=['always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','name','ENUM','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','nonat','update','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER'];(function(_0x10d049,_0x39dbd2){var _0x1a3e86=function(_0x36f5c6){while(--_0x36f5c6){_0x10d049['push'](_0x10d049['shift']());}};_0x1a3e86(++_0x39dbd2);}(_0x6b1f,0x108));var _0xf6b1=function(_0x5a9000,_0x52f954){_0x5a9000=_0x5a9000-0x0;var _0x158623=_0x6b1f[_0x5a9000];return _0x158623;};'use strict';var Sequelize=require(_0xf6b1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf6b1('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x3'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf6b1('0x4')],'allowNull':![],'defaultValue':_0xf6b1('0x5')},'callingpres':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x6'),_0xf6b1('0x7'),_0xf6b1('0x8'),_0xf6b1('0x9'),'PROHIB_NOT_SCREENED',_0xf6b1('0xa'),_0xf6b1('0xb'),_0xf6b1('0xc'))},'deny':{'type':Sequelize[_0xf6b1('0x4')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf6b1('0x4')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':_0xf6b1('0xd'),'set':function(_0x3e46d5){this['setDataValue'](_0xf6b1('0xe'),_0x3e46d5?_0x3e46d5[_0xf6b1('0xf')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xf6b1('0x10')](_0xf6b1('0xe'))[_0xf6b1('0x11')](','):null;},'comment':_0xf6b1('0x12')},'dtmfmode':{'type':Sequelize[_0xf6b1('0x2')]('rfc2833',_0xf6b1('0x13'),_0xf6b1('0x14'),_0xf6b1('0x15'),_0xf6b1('0x16')),'defaultValue':_0xf6b1('0x17')},'directmedia':{'type':Sequelize[_0xf6b1('0x2')]('yes','no',_0xf6b1('0x18'),_0xf6b1('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xf6b1('0x4')]},'nat':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':_0xf6b1('0x1b'),'set':function(_0x40e5d5){this[_0xf6b1('0x1c')]('nat',_0x40e5d5?_0x40e5d5[_0xf6b1('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xf6b1('0x1d'))?this[_0xf6b1('0x10')]('nat')[_0xf6b1('0x11')](','):null;},'comment':_0xf6b1('0x1e')},'callgroup':{'type':Sequelize[_0xf6b1('0x4')]},'namedcallgroup':{'type':Sequelize[_0xf6b1('0x4')]},'pickupgroup':{'type':Sequelize[_0xf6b1('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xf6b1('0x4')]},'language':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf6b1('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf6b1('0x4')],'allowNull':![],'defaultValue':_0xf6b1('0x1f'),'set':function(_0x17caef){this[_0xf6b1('0x1c')]('allow',_0x17caef?_0x17caef[_0xf6b1('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf6b1('0x10')](_0xf6b1('0x20'))?this[_0xf6b1('0x10')](_0xf6b1('0x20'))[_0xf6b1('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'insecure':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'port,invite','set':function(_0x4ba06b){this[_0xf6b1('0x1c')](_0xf6b1('0x21'),_0x4ba06b?_0x4ba06b['join'](','):null);},'get':function(){return this[_0xf6b1('0x10')]('insecure')?this['getDataValue'](_0xf6b1('0x21'))[_0xf6b1('0x11')](','):null;},'comment':_0xf6b1('0x22')},'trustrpid':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'setvar':{'type':Sequelize[_0xf6b1('0x4')]},'callerid':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xf6b1('0x4')]},'callcounter':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no'),'defaultValue':_0xf6b1('0x1a')},'busylevel':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf6b1('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xf6b1('0x4')]},'template':{'type':Sequelize[_0xf6b1('0x4')]},'videosupport':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no',_0xf6b1('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xf6b1('0x4')]},'session_timers':{'type':Sequelize['ENUM'](_0xf6b1('0x25'),_0xf6b1('0x26'),_0xf6b1('0x27'))},'session_expires':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x28'),_0xf6b1('0x29')),'defaultValue':_0xf6b1('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xf6b1('0x4')]},'regexten':{'type':Sequelize[_0xf6b1('0x4')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf6b1('0x4')]},'port':{'type':Sequelize[_0xf6b1('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':_0xf6b1('0x1a')},'keepalive':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xf6b1('0x4')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no',_0xf6b1('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf6b1('0x4')]},'callbackextension':{'type':Sequelize[_0xf6b1('0x4')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xf6b1('0x4')]},'contactdeny':{'type':Sequelize[_0xf6b1('0x4')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf6b1('0x4')]},'use_q850_reason':{'type':Sequelize[_0xf6b1('0x4')]},'maxforwards':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xf6b1('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no','fingerprint',_0xf6b1('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf6b1('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0xf6b1('0x4')]},'dtlscipher':{'type':Sequelize[_0xf6b1('0x4')]},'dtlscafile':{'type':Sequelize[_0xf6b1('0x4')]},'dtlscapath':{'type':Sequelize[_0xf6b1('0x4')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf6b1('0x2c'),_0xf6b1('0x2d'),_0xf6b1('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf6b1('0x4')]},'usereqphone':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf6b1('0x4')]},'recordofffeature':{'type':Sequelize[_0xf6b1('0x4')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xf6b1('0x4')]},'mohsuggest':{'type':Sequelize[_0xf6b1('0x4')]},'parkinglot':{'type':Sequelize[_0xf6b1('0x4')]},'description':{'type':Sequelize[_0xf6b1('0x4')]},'host':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':_0xf6b1('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no',_0xf6b1('0x18'),_0xf6b1('0x19'),_0xf6b1('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf6b1('0x4')]},'otherFields':{'type':Sequelize[_0xf6b1('0x4')]},'active':{'type':Sequelize[_0xf6b1('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4c0f=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','ENUM','user','peer','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c0f,0x12d));var _0xf4c0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4c0f[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xf4c0('0x0'));module[_0xf4c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf4c0('0x2')]('friend',_0xf4c0('0x3'),_0xf4c0('0x4')),'allowNull':![],'defaultValue':_0xf4c0('0x5')},'context':{'type':Sequelize[_0xf4c0('0x6')],'allowNull':![],'defaultValue':_0xf4c0('0x7')},'callingpres':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x8'),_0xf4c0('0x9'),'ALLOWED_FAILED_SCREEN',_0xf4c0('0xa'),_0xf4c0('0xb'),_0xf4c0('0xc'),_0xf4c0('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xf4c0('0x6')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf4c0('0x6')]},'md5secret':{'type':Sequelize[_0xf4c0('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5df37f){this[_0xf4c0('0xe')](_0xf4c0('0xf'),_0x5df37f?_0x5df37f[_0xf4c0('0x10')](','):null);},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0xf'))?this[_0xf4c0('0x11')](_0xf4c0('0xf'))[_0xf4c0('0x12')](','):null;},'comment':_0xf4c0('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf4c0('0x14'),_0xf4c0('0x15'),_0xf4c0('0x16'),_0xf4c0('0x17'),_0xf4c0('0x18')),'defaultValue':_0xf4c0('0x14')},'directmedia':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no','nonat',_0xf4c0('0x1a'),_0xf4c0('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf4c0('0x6')]},'directmediadeny':{'type':Sequelize[_0xf4c0('0x6')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x2700c6){this['setDataValue'](_0xf4c0('0x1c'),_0x2700c6?_0x2700c6[_0xf4c0('0x10')](','):null);},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0x1c'))?this[_0xf4c0('0x11')](_0xf4c0('0x1c'))[_0xf4c0('0x12')](','):null;},'comment':_0xf4c0('0x1d')},'callgroup':{'type':Sequelize[_0xf4c0('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xf4c0('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xf4c0('0x6')]},'language':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf4c0('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':_0xf4c0('0x1e')},'allow':{'type':Sequelize[_0xf4c0('0x6')],'allowNull':![],'defaultValue':_0xf4c0('0x1f'),'set':function(_0x1717d4){this[_0xf4c0('0xe')](_0xf4c0('0x20'),_0x1717d4?_0x1717d4[_0xf4c0('0x10')](';'):_0xf4c0('0x1f'));},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0x20'))?this['getDataValue'](_0xf4c0('0x20'))['split'](';'):null;},'comment':_0xf4c0('0x21')},'autoframing':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'insecure':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':'port,invite','set':function(_0x1bedf3){this['setDataValue'](_0xf4c0('0x22'),_0x1bedf3?_0x1bedf3[_0xf4c0('0x10')](','):null);},'get':function(){return this[_0xf4c0('0x11')](_0xf4c0('0x22'))?this['getDataValue']('insecure')[_0xf4c0('0x12')](','):null;},'comment':_0xf4c0('0x23')},'trustrpid':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf4c0('0x2')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'accountcode':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'setvar':{'type':Sequelize[_0xf4c0('0x6')]},'callerid':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':_0xf4c0('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':_0xf4c0('0x19')},'busylevel':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xf4c0('0x6')]},'template':{'type':Sequelize[_0xf4c0('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no',_0xf4c0('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf4c0('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x27'),_0xf4c0('0x28'),_0xf4c0('0x29'))},'session_expires':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x2a'),_0xf4c0('0x2b')),'defaultValue':_0xf4c0('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xf4c0('0x6')]},'regexten':{'type':Sequelize[_0xf4c0('0x6')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf4c0('0x6')]},'port':{'type':Sequelize[_0xf4c0('0x24')](0x5)},'qualify':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':_0xf4c0('0x19')},'keepalive':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xf4c0('0x6')]},'defaultuser':{'type':Sequelize[_0xf4c0('0x6')]},'rtptimeout':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no',_0xf4c0('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'timerb':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xf4c0('0x6')]},'contactdeny':{'type':Sequelize[_0xf4c0('0x6')]},'contactacl':{'type':Sequelize[_0xf4c0('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xf4c0('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf4c0('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf4c0('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no',_0xf4c0('0x2d'),_0xf4c0('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xf4c0('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf4c0('0x6')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xf4c0('0x6')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x2f'),_0xf4c0('0x30'),_0xf4c0('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf4c0('0x6')]},'usereqphone':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf4c0('0x6')]},'recordofffeature':{'type':Sequelize[_0xf4c0('0x6')]},'call_limit':{'type':Sequelize[_0xf4c0('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xf4c0('0x2')](_0xf4c0('0x19'),'no')},'vmexten':{'type':Sequelize[_0xf4c0('0x6')]},'mohinterpret':{'type':Sequelize[_0xf4c0('0x6')]},'mohsuggest':{'type':Sequelize[_0xf4c0('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf4c0('0x6')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xf4c0('0x32')},'canreinvite':{'type':Sequelize[_0xf4c0('0x2')]('yes','no','nonat',_0xf4c0('0x1a'),_0xf4c0('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf4c0('0x6')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf4c0('0x6')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 6785fd8..34a3bbe 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 _0x62f0=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','end','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','pick','filters','merge','where','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','keys','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','readFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x308ff9,_0x3148cb){var _0x148225=function(_0x1c006b){while(--_0x1c006b){_0x308ff9['push'](_0x308ff9['shift']());}};_0x148225(++_0x3148cb);}(_0x62f0,0xd9));var _0x062f=function(_0xa223ad,_0x5a574b){_0xa223ad=_0xa223ad-0x0;var _0x306d47=_0x62f0[_0xa223ad];return _0x306d47;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x062f('0x0'));var rimraf=require(_0x062f('0x1'));var zipdir=require(_0x062f('0x2'));var jsonpatch=require(_0x062f('0x3'));var rp=require(_0x062f('0x4'));var moment=require(_0x062f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x062f('0x6'));var util=require(_0x062f('0x7'));var path=require(_0x062f('0x8'));var sox=require(_0x062f('0x9'));var csv=require('to-csv');var ejs=require(_0x062f('0xa'));var fs=require('fs');var _=require(_0x062f('0xb'));var squel=require(_0x062f('0xc'));var crypto=require(_0x062f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x062f('0xe'));var toCsv=require(_0x062f('0xf'));var querystring=require(_0x062f('0x10'));var Papa=require(_0x062f('0x11'));var Redis=require('ioredis');var authService=require(_0x062f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x062f('0x13'));var hardwareService=require(_0x062f('0x14'));var logger=require(_0x062f('0x15'))(_0x062f('0x16'));var utils=require(_0x062f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x062f('0x18'));var db=require(_0x062f('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x062f('0x1a')][_0x062f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x39ee41,_0x1862e9,_0x1be55e,_0x68c04f){return new BPromise(function(_0x493ea8,_0x1e1f28){var _0x4c4e55=_0x68c04f||client;return _0x4c4e55[_0x062f('0x1c')](_0x39ee41,_0x1be55e)[_0x062f('0x1d')](function(_0x5e8ac5){logger['info'](_0x062f('0x1e'),_0x1862e9,_0x062f('0x1f'));logger[_0x062f('0x20')](_0x062f('0x21'),_0x1862e9,_0x062f('0x1f'),JSON['stringify'](_0x5e8ac5));if(_0x5e8ac5['error']){if(_0x5e8ac5[_0x062f('0x22')][_0x062f('0x23')]===0x1f4){logger[_0x062f('0x22')](_0x062f('0x1e'),_0x1862e9,_0x5e8ac5['error'][_0x062f('0x24')]);return _0x1e1f28(_0x5e8ac5[_0x062f('0x22')][_0x062f('0x24')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1862e9,_0x5e8ac5[_0x062f('0x22')][_0x062f('0x24')]);return _0x493ea8(_0x5e8ac5[_0x062f('0x22')]['message']);}else{logger[_0x062f('0x25')](_0x062f('0x1e'),_0x1862e9,'request\x20sent');_0x493ea8(_0x5e8ac5[_0x062f('0x26')][_0x062f('0x24')]);}})[_0x062f('0x27')](function(_0x3883c6){logger[_0x062f('0x22')](_0x062f('0x1e'),_0x1862e9,_0x3883c6);_0x1e1f28(_0x3883c6);});});}function respondWithStatusCode(_0x402ec4,_0x58b2bc){_0x58b2bc=_0x58b2bc||0xcc;return function(_0x158752){if(_0x158752){return _0x402ec4[_0x062f('0x28')](_0x58b2bc);}return _0x402ec4[_0x062f('0x29')](_0x58b2bc)['end']();};}function respondWithResult(_0x1c6b7d,_0x2c8c59){_0x2c8c59=_0x2c8c59||0xc8;return function(_0x3a728b){if(_0x3a728b){return _0x1c6b7d[_0x062f('0x29')](_0x2c8c59)[_0x062f('0x2a')](_0x3a728b);}};}function respondWithFilteredResult(_0x5171d4,_0x26322c){return function(_0x1186cd){if(_0x1186cd){var _0x51e9df=_0x1186cd['count'],_0x631a2d=_0x26322c[_0x062f('0x2b')],_0x4543d3=_0x26322c['offset']+_0x26322c[_0x062f('0x2c')],_0x3a2bd8;if(_0x4543d3>=_0x51e9df){_0x4543d3=_0x51e9df;_0x3a2bd8=0xc8;}else{_0x3a2bd8=0xce;}_0x5171d4[_0x062f('0x29')](_0x3a2bd8);return _0x5171d4[_0x062f('0x2d')](_0x062f('0x2e'),_0x631a2d+'-'+_0x4543d3+'/'+_0x51e9df)['json'](_0x1186cd);}return null;};}function patchUpdates(_0x2e8b05){return function(_0x36c710){try{jsonpatch[_0x062f('0x2f')](_0x36c710,_0x2e8b05,!![]);}catch(_0x591efc){return BPromise[_0x062f('0x30')](_0x591efc);}return _0x36c710['save']();};}function saveUpdates(_0xca884d,_0x278437){return function(_0x450c06){if(_0x450c06){return _0x450c06[_0x062f('0x31')](_0xca884d)[_0x062f('0x1d')](function(_0x27fa30){return _0x27fa30;});}return null;};}function removeEntity(_0x30fb68,_0x344854){return function(_0xdd0a7){if(_0xdd0a7){return _0xdd0a7[_0x062f('0x32')]()[_0x062f('0x1d')](function(){var _0x57a27a=_0xdd0a7[_0x062f('0x33')]({'plain':!![]});var _0x4370d5=_0x062f('0x34');return db[_0x062f('0x35')][_0x062f('0x32')]({'where':{'type':_0x4370d5,'resourceId':_0x57a27a['id']}})[_0x062f('0x1d')](function(){return _0xdd0a7;});})[_0x062f('0x1d')](function(){_0x30fb68[_0x062f('0x29')](0xcc)[_0x062f('0x36')]();});}};}function handleEntityNotFound(_0x460514,_0x2330b4){return function(_0xecdc51){if(!_0xecdc51){_0x460514[_0x062f('0x28')](0x194);}return _0xecdc51;};}function handleError(_0x199cdc,_0x62751d){_0x62751d=_0x62751d||0x1f4;return function(_0x4f37f2){logger[_0x062f('0x22')](_0x4f37f2[_0x062f('0x37')]);if(_0x4f37f2[_0x062f('0x38')]){delete _0x4f37f2[_0x062f('0x38')];}_0x199cdc[_0x062f('0x29')](_0x62751d)[_0x062f('0x39')](_0x4f37f2);};}exports['index']=function(_0x37484c,_0x41eee9){var _0x499cfd={},_0x513a27={},_0x1de8a2={'count':0x0,'rows':[]};var _0x1c9d38=_[_0x062f('0x3a')](db[_0x062f('0x3b')][_0x062f('0x3c')],function(_0x543b26){return{'name':_0x543b26[_0x062f('0x3d')],'type':_0x543b26[_0x062f('0x3e')][_0x062f('0x3f')]};});_0x513a27[_0x062f('0x40')]=_[_0x062f('0x3a')](_0x1c9d38,'name');_0x513a27[_0x062f('0x41')]=_['keys'](_0x37484c[_0x062f('0x41')]);_0x513a27['filters']=_[_0x062f('0x42')](_0x513a27[_0x062f('0x40')],_0x513a27[_0x062f('0x41')]);_0x499cfd['attributes']=_['intersection'](_0x513a27['model'],qs[_0x062f('0x43')](_0x37484c[_0x062f('0x41')][_0x062f('0x43')]));_0x499cfd[_0x062f('0x44')]=_0x499cfd[_0x062f('0x44')][_0x062f('0x45')]?_0x499cfd[_0x062f('0x44')]:_0x513a27[_0x062f('0x40')];if(!_0x37484c[_0x062f('0x41')]['hasOwnProperty'](_0x062f('0x46'))){_0x499cfd[_0x062f('0x2c')]=qs[_0x062f('0x2c')](_0x37484c[_0x062f('0x41')][_0x062f('0x2c')]);_0x499cfd[_0x062f('0x2b')]=qs[_0x062f('0x2b')](_0x37484c[_0x062f('0x41')][_0x062f('0x2b')]);}_0x499cfd[_0x062f('0x47')]=qs['sort'](_0x37484c['query'][_0x062f('0x48')]);_0x499cfd['where']=qs['filters'](_[_0x062f('0x49')](_0x37484c['query'],_0x513a27[_0x062f('0x4a')]),_0x1c9d38);if(_0x37484c[_0x062f('0x41')]['filter']){_0x499cfd['where']=_[_0x062f('0x4b')](_0x499cfd[_0x062f('0x4c')],{'$or':_[_0x062f('0x3a')](_0x1c9d38,function(_0x26fc72){if(_0x26fc72[_0x062f('0x3e')]!==_0x062f('0x4d')){var _0x30516e={};_0x30516e[_0x26fc72['name']]={'$like':'%'+_0x37484c['query'][_0x062f('0x4e')]+'%'};return _0x30516e;}})});}_0x499cfd=_['merge']({},_0x499cfd,_0x37484c[_0x062f('0x4f')]);var _0x3614d6={'where':_0x499cfd[_0x062f('0x4c')]};return db[_0x062f('0x3b')][_0x062f('0x50')](_0x3614d6)['then'](function(_0x5dd822){_0x1de8a2[_0x062f('0x50')]=_0x5dd822;if(_0x37484c[_0x062f('0x41')][_0x062f('0x51')]){_0x499cfd[_0x062f('0x52')]=[{'all':!![]}];}return db[_0x062f('0x3b')]['findAll'](_0x499cfd);})[_0x062f('0x1d')](function(_0xd4915){_0x1de8a2[_0x062f('0x53')]=_0xd4915;return _0x1de8a2;})[_0x062f('0x1d')](respondWithFilteredResult(_0x41eee9,_0x499cfd))['catch'](handleError(_0x41eee9,null));};exports[_0x062f('0x54')]=function(_0x1fe70e,_0x39f8a1){var _0x478db4={'raw':![],'where':{'id':_0x1fe70e[_0x062f('0x55')]['id']}},_0x4ea60c={};_0x4ea60c['model']=_[_0x062f('0x56')](db[_0x062f('0x3b')][_0x062f('0x3c')]);_0x4ea60c[_0x062f('0x41')]=_[_0x062f('0x56')](_0x1fe70e[_0x062f('0x41')]);_0x4ea60c[_0x062f('0x4a')]=_[_0x062f('0x42')](_0x4ea60c['model'],_0x4ea60c[_0x062f('0x41')]);_0x478db4[_0x062f('0x44')]=_[_0x062f('0x42')](_0x4ea60c[_0x062f('0x40')],qs['fields'](_0x1fe70e['query']['fields']));_0x478db4[_0x062f('0x44')]=_0x478db4['attributes'][_0x062f('0x45')]?_0x478db4[_0x062f('0x44')]:_0x4ea60c['model'];if(_0x1fe70e['query']['includeAll']){_0x478db4[_0x062f('0x52')]=[{'all':!![]}];}_0x478db4=_['merge']({},_0x478db4,_0x1fe70e[_0x062f('0x4f')]);return db[_0x062f('0x3b')][_0x062f('0x57')](_0x478db4)[_0x062f('0x1d')](handleEntityNotFound(_0x39f8a1,null))[_0x062f('0x1d')](respondWithResult(_0x39f8a1,null))[_0x062f('0x27')](handleError(_0x39f8a1,null));};exports[_0x062f('0x58')]=function(_0x541f3e,_0x4eb2f2){var _0x2e2358={'where':{'id':_0x541f3e[_0x062f('0x55')]['id']}},_0x55722d={};_0x55722d[_0x062f('0x40')]=_[_0x062f('0x56')](db[_0x062f('0x3b')]['rawAttributes']);_0x2e2358[_0x062f('0x44')]=_['intersection'](_0x55722d['model'],qs[_0x062f('0x43')](_0x541f3e[_0x062f('0x41')]['fields']));_0x2e2358[_0x062f('0x44')]=_0x2e2358[_0x062f('0x44')]['length']?_0x2e2358[_0x062f('0x44')]:_0x55722d[_0x062f('0x40')];if(_0x541f3e[_0x062f('0x41')][_0x062f('0x51')]){_0x2e2358['include']=[{'all':!![]}];}_0x2e2358=_[_0x062f('0x4b')]({},_0x2e2358,_0x541f3e['options']);return db[_0x062f('0x3b')][_0x062f('0x57')](_0x2e2358)[_0x062f('0x1d')](handleEntityNotFound(_0x4eb2f2,null))[_0x062f('0x1d')](function(_0x5e101a){if(_0x5e101a){var _0x282955=_0x5e101a[_0x062f('0x33')]({'plain':!![]});_0x282955=qs[_0x062f('0x59')](_0x282955,['id',_0x062f('0x5a'),_0x062f('0x5b')]);_0x541f3e[_0x062f('0x5c')]=_[_0x062f('0x59')](_0x541f3e['body'],['id',_0x062f('0x5a'),'updatedAt']);return db[_0x062f('0x3b')][_0x062f('0x5d')](_[_0x062f('0x4b')](_0x282955,_0x541f3e[_0x062f('0x5c')]),{'include':_0x541f3e[_0x062f('0x41')][_0x062f('0x51')]?[{'all':!![]}]:undefined})[_0x062f('0x1d')](function(_0x46f77a){var _0x441f2d=_0x541f3e[_0x062f('0x5e')][_0x062f('0x33')]({'plain':!![]});if(!_0x441f2d)throw new Error(_0x062f('0x5f'));if(_0x441f2d[_0x062f('0x60')]===_0x062f('0x5e')){var _0x44542e=_0x46f77a['get']({'plain':!![]});var _0x1a5bc5='Trunks';return db[_0x062f('0x61')][_0x062f('0x57')]({'where':{'name':_0x1a5bc5,'userProfileId':_0x441f2d[_0x062f('0x62')]},'raw':!![]})[_0x062f('0x1d')](function(_0x12ccd3){if(_0x12ccd3&&_0x12ccd3[_0x062f('0x63')]===0x0){return db[_0x062f('0x35')][_0x062f('0x5d')]({'name':_0x44542e[_0x062f('0x38')],'resourceId':_0x44542e['id'],'type':_0x12ccd3[_0x062f('0x38')],'sectionId':_0x12ccd3['id']},{})[_0x062f('0x1d')](function(){return _0x46f77a;});}else{return _0x46f77a;}})[_0x062f('0x27')](function(_0x92fb54){logger[_0x062f('0x22')](_0x062f('0x64'),_0x92fb54);throw _0x92fb54;});}return _0x46f77a;});}})[_0x062f('0x1d')](respondWithResult(_0x4eb2f2,0xc9))['catch'](handleError(_0x4eb2f2,null));};exports[_0x062f('0x5d')]=function(_0xa03778,_0x41481e,_0xc41eaa){var _0x4460bd;return db[_0x062f('0x3b')][_0x062f('0x5d')](_0xa03778[_0x062f('0x5c')],{'raw':!![]})[_0x062f('0x1d')](function(_0x5c1e47){_0x4460bd=_0x5c1e47;return db[_0x062f('0x3b')][_0x062f('0x65')]({'raw':!![]});})[_0x062f('0x1d')](function(_0x301f2c){var _0x2e61d6=fs['readFileSync'](path[_0x062f('0x66')](config[_0x062f('0x67')],_0x062f('0x68')),_0x062f('0x69'));var _0x3c8a92=fs['readFileSync'](path[_0x062f('0x66')](config[_0x062f('0x67')],_0x062f('0x6a')),'utf8');var _0x361cb2=ejs[_0x062f('0x6b')](_0x2e61d6,{'trunks':_0x301f2c||[]});fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x361cb2);if(_0x4460bd[_0x062f('0x6d')]){var _0x219816=ejs['render'](_0x3c8a92,{'trunks':_0x301f2c||[]});fs['writeFileSync'](_0x062f('0x6e'),_0x219816);}})['then'](function(){return respondWithRpcPromise(_0x062f('0x6f'),_0x062f('0x5d'),{'module':_0x062f('0x70')});})[_0x062f('0x1d')](function(){var _0xbcdc92=_0xa03778[_0x062f('0x5e')][_0x062f('0x33')]({'plain':!![]});if(!_0xbcdc92)throw new Error(_0x062f('0x5f'));if(_0xbcdc92['role']==='user'){var _0x4d9a39=_0x4460bd[_0x062f('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x062f('0x57')]({'where':{'name':'Trunks','userProfileId':_0xbcdc92['userProfileId']},'raw':!![]})['then'](function(_0x237605){if(_0x237605&&_0x237605[_0x062f('0x63')]===0x0){return db[_0x062f('0x35')]['create']({'name':_0x4d9a39[_0x062f('0x38')],'resourceId':_0x4d9a39['id'],'type':_0x237605['name'],'sectionId':_0x237605['id']},{})['then'](function(){return _0x4460bd;});}else{return _0x4460bd;}})[_0x062f('0x27')](function(_0x853351){logger[_0x062f('0x22')](_0x062f('0x64'),_0x853351);throw _0x853351;});}return _0x4460bd;})[_0x062f('0x1d')](respondWithResult(_0x41481e,0xc9))[_0x062f('0x27')](handleError(_0x41481e,null));};exports['update']=function(_0x454c87,_0x409b3c,_0x540bda){var _0x49c401;return db['Trunk'][_0x062f('0x57')]({'where':{'id':_0x454c87[_0x062f('0x55')]['id']}})[_0x062f('0x1d')](handleEntityNotFound(_0x409b3c,null))[_0x062f('0x1d')](saveUpdates(_0x454c87[_0x062f('0x5c')],null))[_0x062f('0x1d')](function(_0x5e2da4){if(_0x5e2da4){_0x49c401=_0x5e2da4;return db[_0x062f('0x3b')][_0x062f('0x65')]({'raw':!![]});}})[_0x062f('0x1d')](function(_0x420e12){if(_0x420e12){var _0x247a03=fs[_0x062f('0x71')](path['join'](config[_0x062f('0x67')],'server/files/templates/trunk.ejs'),_0x062f('0x69'));var _0x3172ea=fs[_0x062f('0x71')](path['join'](config[_0x062f('0x67')],_0x062f('0x6a')),_0x062f('0x69'));var _0xcd7efa=ejs[_0x062f('0x6b')](_0x247a03,{'trunks':_0x420e12||[]});fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0xcd7efa);var _0x43c1f1=ejs[_0x062f('0x6b')](_0x3172ea,{'trunks':_0x420e12||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x43c1f1);return respondWithRpcPromise(_0x062f('0x6f'),_0x062f('0x31'),{'module':_0x062f('0x70')});}return null;})[_0x062f('0x1d')](function(_0xdb3b04){if(_0xdb3b04){return _0x49c401;}})[_0x062f('0x1d')](respondWithResult(_0x409b3c,null))['catch'](handleError(_0x409b3c,null));};exports[_0x062f('0x32')]=function(_0x3bbba2,_0x301c98,_0x33f2b1){var _0x23b9d5;return db['Trunk'][_0x062f('0x57')]({'where':{'id':_0x3bbba2[_0x062f('0x55')]['id']}})[_0x062f('0x1d')](handleEntityNotFound(_0x301c98,null))[_0x062f('0x1d')](removeEntity(_0x301c98,null))[_0x062f('0x1d')](function(){return db['Trunk'][_0x062f('0x65')]({'raw':!![]});})[_0x062f('0x1d')](function(_0x3f1bed){var _0x3259c3=fs[_0x062f('0x71')](path[_0x062f('0x66')](config[_0x062f('0x67')],_0x062f('0x68')),_0x062f('0x69'));var _0x49f4c8=fs[_0x062f('0x71')](path[_0x062f('0x66')](config['root'],_0x062f('0x6a')),_0x062f('0x69'));var _0x5a82d8=ejs['render'](_0x3259c3,{'trunks':_0x3f1bed});var _0x3ead8a=ejs[_0x062f('0x6b')](_0x49f4c8,{'trunks':_0x3f1bed});fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5a82d8);fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x3ead8a);return respondWithRpcPromise(_0x062f('0x6f'),'destroy',{'module':'chan_sip.so'});})[_0x062f('0x27')](handleError(_0x301c98,null));}; \ No newline at end of file +var _0xf647=['rawAttributes','includeAll','find','length','omit','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','UserProfileSection','join','chan_sip.so','server/files/templates/registry.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','get','UserProfileResource','destroy','stack','name','send','index','map','fieldName','key','keys','query','filters','intersection','model','attributes','fields','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','Trunk','include','rows','show','params'];(function(_0x1eaf8c,_0xae6572){var _0x515157=function(_0x1ecb90){while(--_0x1ecb90){_0x1eaf8c['push'](_0x1eaf8c['shift']());}};_0x515157(++_0xae6572);}(_0xf647,0xf5));var _0x7f64=function(_0x2a9be5,_0x4dd8fb){_0x2a9be5=_0x2a9be5-0x0;var _0x29a093=_0xf647[_0x2a9be5];return _0x29a093;};'use strict';var pdf=require(_0x7f64('0x0'));var emlformat=require(_0x7f64('0x1'));var rimraf=require(_0x7f64('0x2'));var zipdir=require(_0x7f64('0x3'));var jsonpatch=require(_0x7f64('0x4'));var rp=require(_0x7f64('0x5'));var moment=require('moment');var BPromise=require(_0x7f64('0x6'));var Mustache=require('mustache');var util=require(_0x7f64('0x7'));var path=require(_0x7f64('0x8'));var sox=require(_0x7f64('0x9'));var csv=require(_0x7f64('0xa'));var ejs=require(_0x7f64('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f64('0xc'));var jsforce=require(_0x7f64('0xd'));var deskjs=require(_0x7f64('0xe'));var toCsv=require(_0x7f64('0xa'));var querystring=require('querystring');var Papa=require(_0x7f64('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f64('0x10'));var as=require(_0x7f64('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7f64('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7f64('0x13'));var db=require(_0x7f64('0x14'))['db'];var jayson=require(_0x7f64('0x15'));var client=jayson[_0x7f64('0x16')][_0x7f64('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x553155,_0x1f9a1d,_0x4a80bf,_0x2054bc){return new BPromise(function(_0x121c1f,_0x4331b8){var _0x12a442=_0x2054bc||client;return _0x12a442['request'](_0x553155,_0x4a80bf)[_0x7f64('0x18')](function(_0x2b40aa){logger[_0x7f64('0x19')](_0x7f64('0x1a'),_0x1f9a1d,_0x7f64('0x1b'));logger[_0x7f64('0x1c')](_0x7f64('0x1d'),_0x1f9a1d,_0x7f64('0x1b'),JSON[_0x7f64('0x1e')](_0x2b40aa));if(_0x2b40aa['error']){if(_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x20')]===0x1f4){logger[_0x7f64('0x1f')](_0x7f64('0x1a'),_0x1f9a1d,_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x21')]);return _0x4331b8(_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x21')]);}logger[_0x7f64('0x1f')]('Trunk,\x20%s,\x20%s',_0x1f9a1d,_0x2b40aa[_0x7f64('0x1f')]['message']);return _0x121c1f(_0x2b40aa[_0x7f64('0x1f')][_0x7f64('0x21')]);}else{logger[_0x7f64('0x19')](_0x7f64('0x1a'),_0x1f9a1d,_0x7f64('0x1b'));_0x121c1f(_0x2b40aa['result'][_0x7f64('0x21')]);}})[_0x7f64('0x22')](function(_0x4073e2){logger[_0x7f64('0x1f')](_0x7f64('0x1a'),_0x1f9a1d,_0x4073e2);_0x4331b8(_0x4073e2);});});}function respondWithStatusCode(_0x1f5b89,_0x443afd){_0x443afd=_0x443afd||0xcc;return function(_0x3e91df){if(_0x3e91df){return _0x1f5b89[_0x7f64('0x23')](_0x443afd);}return _0x1f5b89[_0x7f64('0x24')](_0x443afd)[_0x7f64('0x25')]();};}function respondWithResult(_0x3abb5b,_0x47354d){_0x47354d=_0x47354d||0xc8;return function(_0x4306e5){if(_0x4306e5){return _0x3abb5b[_0x7f64('0x24')](_0x47354d)[_0x7f64('0x26')](_0x4306e5);}};}function respondWithFilteredResult(_0x3be493,_0x425099){return function(_0x5ecd79){if(_0x5ecd79){var _0x3d0ca3=_0x5ecd79[_0x7f64('0x27')],_0x2d78aa=_0x425099[_0x7f64('0x28')],_0x4aec9d=_0x425099['offset']+_0x425099['limit'],_0x22e865;if(_0x4aec9d>=_0x3d0ca3){_0x4aec9d=_0x3d0ca3;_0x22e865=0xc8;}else{_0x22e865=0xce;}_0x3be493[_0x7f64('0x24')](_0x22e865);return _0x3be493[_0x7f64('0x29')](_0x7f64('0x2a'),_0x2d78aa+'-'+_0x4aec9d+'/'+_0x3d0ca3)[_0x7f64('0x26')](_0x5ecd79);}return null;};}function patchUpdates(_0x16a830){return function(_0x20512d){try{jsonpatch[_0x7f64('0x2b')](_0x20512d,_0x16a830,!![]);}catch(_0x54b134){return BPromise['reject'](_0x54b134);}return _0x20512d['save']();};}function saveUpdates(_0x5b90ad,_0x3fd871){return function(_0x58c11d){if(_0x58c11d){return _0x58c11d[_0x7f64('0x2c')](_0x5b90ad)['then'](function(_0x159201){return _0x159201;});}return null;};}function removeEntity(_0x13f689,_0x1c67f4){return function(_0x27acd8){if(_0x27acd8){return _0x27acd8['destroy']()[_0x7f64('0x18')](function(){var _0x55709d=_0x27acd8[_0x7f64('0x2d')]({'plain':!![]});var _0x282516='Trunks';return db[_0x7f64('0x2e')][_0x7f64('0x2f')]({'where':{'type':_0x282516,'resourceId':_0x55709d['id']}})[_0x7f64('0x18')](function(){return _0x27acd8;});})['then'](function(){_0x13f689[_0x7f64('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148aa4,_0x4750dc){return function(_0x30a91c){if(!_0x30a91c){_0x148aa4[_0x7f64('0x23')](0x194);}return _0x30a91c;};}function handleError(_0x517bbd,_0x3f711b){_0x3f711b=_0x3f711b||0x1f4;return function(_0x2a96ff){logger[_0x7f64('0x1f')](_0x2a96ff[_0x7f64('0x30')]);if(_0x2a96ff[_0x7f64('0x31')]){delete _0x2a96ff['name'];}_0x517bbd['status'](_0x3f711b)[_0x7f64('0x32')](_0x2a96ff);};}exports[_0x7f64('0x33')]=function(_0x21958c,_0x2464c4){var _0x5d67aa={},_0x4da21f={},_0x2849f6={'count':0x0,'rows':[]};var _0x565788=_[_0x7f64('0x34')](db['Trunk']['rawAttributes'],function(_0x3d22d9){return{'name':_0x3d22d9[_0x7f64('0x35')],'type':_0x3d22d9['type'][_0x7f64('0x36')]};});_0x4da21f['model']=_['map'](_0x565788,_0x7f64('0x31'));_0x4da21f['query']=_[_0x7f64('0x37')](_0x21958c[_0x7f64('0x38')]);_0x4da21f[_0x7f64('0x39')]=_[_0x7f64('0x3a')](_0x4da21f[_0x7f64('0x3b')],_0x4da21f[_0x7f64('0x38')]);_0x5d67aa[_0x7f64('0x3c')]=_[_0x7f64('0x3a')](_0x4da21f[_0x7f64('0x3b')],qs[_0x7f64('0x3d')](_0x21958c[_0x7f64('0x38')]['fields']));_0x5d67aa[_0x7f64('0x3c')]=_0x5d67aa[_0x7f64('0x3c')]['length']?_0x5d67aa[_0x7f64('0x3c')]:_0x4da21f['model'];if(!_0x21958c['query']['hasOwnProperty']('nolimit')){_0x5d67aa[_0x7f64('0x3e')]=qs['limit'](_0x21958c[_0x7f64('0x38')][_0x7f64('0x3e')]);_0x5d67aa[_0x7f64('0x28')]=qs[_0x7f64('0x28')](_0x21958c['query'][_0x7f64('0x28')]);}_0x5d67aa[_0x7f64('0x3f')]=qs[_0x7f64('0x40')](_0x21958c['query'][_0x7f64('0x40')]);_0x5d67aa[_0x7f64('0x41')]=qs[_0x7f64('0x39')](_[_0x7f64('0x42')](_0x21958c['query'],_0x4da21f[_0x7f64('0x39')]),_0x565788);if(_0x21958c[_0x7f64('0x38')]['filter']){_0x5d67aa[_0x7f64('0x41')]=_[_0x7f64('0x43')](_0x5d67aa['where'],{'$or':_['map'](_0x565788,function(_0x19ea0a){if(_0x19ea0a['type']!==_0x7f64('0x44')){var _0x3731e1={};_0x3731e1[_0x19ea0a[_0x7f64('0x31')]]={'$like':'%'+_0x21958c[_0x7f64('0x38')][_0x7f64('0x45')]+'%'};return _0x3731e1;}})});}_0x5d67aa=_[_0x7f64('0x43')]({},_0x5d67aa,_0x21958c[_0x7f64('0x46')]);var _0x37891f={'where':_0x5d67aa[_0x7f64('0x41')]};return db[_0x7f64('0x47')][_0x7f64('0x27')](_0x37891f)['then'](function(_0x3c7f09){_0x2849f6['count']=_0x3c7f09;if(_0x21958c['query']['includeAll']){_0x5d67aa[_0x7f64('0x48')]=[{'all':!![]}];}return db[_0x7f64('0x47')]['findAll'](_0x5d67aa);})[_0x7f64('0x18')](function(_0x11348a){_0x2849f6[_0x7f64('0x49')]=_0x11348a;return _0x2849f6;})[_0x7f64('0x18')](respondWithFilteredResult(_0x2464c4,_0x5d67aa))['catch'](handleError(_0x2464c4,null));};exports[_0x7f64('0x4a')]=function(_0xbef562,_0x38e43a){var _0x233c40={'raw':![],'where':{'id':_0xbef562[_0x7f64('0x4b')]['id']}},_0x3d7b6a={};_0x3d7b6a[_0x7f64('0x3b')]=_['keys'](db[_0x7f64('0x47')][_0x7f64('0x4c')]);_0x3d7b6a[_0x7f64('0x38')]=_[_0x7f64('0x37')](_0xbef562[_0x7f64('0x38')]);_0x3d7b6a[_0x7f64('0x39')]=_['intersection'](_0x3d7b6a[_0x7f64('0x3b')],_0x3d7b6a['query']);_0x233c40[_0x7f64('0x3c')]=_[_0x7f64('0x3a')](_0x3d7b6a[_0x7f64('0x3b')],qs[_0x7f64('0x3d')](_0xbef562['query'][_0x7f64('0x3d')]));_0x233c40[_0x7f64('0x3c')]=_0x233c40[_0x7f64('0x3c')]['length']?_0x233c40[_0x7f64('0x3c')]:_0x3d7b6a[_0x7f64('0x3b')];if(_0xbef562[_0x7f64('0x38')][_0x7f64('0x4d')]){_0x233c40[_0x7f64('0x48')]=[{'all':!![]}];}_0x233c40=_[_0x7f64('0x43')]({},_0x233c40,_0xbef562[_0x7f64('0x46')]);return db[_0x7f64('0x47')][_0x7f64('0x4e')](_0x233c40)[_0x7f64('0x18')](handleEntityNotFound(_0x38e43a,null))[_0x7f64('0x18')](respondWithResult(_0x38e43a,null))[_0x7f64('0x22')](handleError(_0x38e43a,null));};exports['clone']=function(_0x2eaeb9,_0x526030){var _0xd78a87={'where':{'id':_0x2eaeb9[_0x7f64('0x4b')]['id']}},_0x5ae00e={};_0x5ae00e[_0x7f64('0x3b')]=_[_0x7f64('0x37')](db[_0x7f64('0x47')][_0x7f64('0x4c')]);_0xd78a87[_0x7f64('0x3c')]=_['intersection'](_0x5ae00e[_0x7f64('0x3b')],qs['fields'](_0x2eaeb9['query'][_0x7f64('0x3d')]));_0xd78a87['attributes']=_0xd78a87[_0x7f64('0x3c')][_0x7f64('0x4f')]?_0xd78a87['attributes']:_0x5ae00e[_0x7f64('0x3b')];if(_0x2eaeb9[_0x7f64('0x38')][_0x7f64('0x4d')]){_0xd78a87[_0x7f64('0x48')]=[{'all':!![]}];}_0xd78a87=_[_0x7f64('0x43')]({},_0xd78a87,_0x2eaeb9[_0x7f64('0x46')]);return db[_0x7f64('0x47')][_0x7f64('0x4e')](_0xd78a87)[_0x7f64('0x18')](handleEntityNotFound(_0x526030,null))[_0x7f64('0x18')](function(_0x4f0c13){if(_0x4f0c13){var _0x25d53b=_0x4f0c13['get']({'plain':!![]});_0x25d53b=qs[_0x7f64('0x50')](_0x25d53b,['id','createdAt',_0x7f64('0x51')]);_0x2eaeb9[_0x7f64('0x52')]=_['omit'](_0x2eaeb9[_0x7f64('0x52')],['id',_0x7f64('0x53'),_0x7f64('0x51')]);return db[_0x7f64('0x47')][_0x7f64('0x54')](_[_0x7f64('0x43')](_0x25d53b,_0x2eaeb9['body']),{'include':_0x2eaeb9[_0x7f64('0x38')][_0x7f64('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x38326f){var _0x5c339b=_0x2eaeb9[_0x7f64('0x55')][_0x7f64('0x2d')]({'plain':!![]});if(!_0x5c339b)throw new Error(_0x7f64('0x56'));if(_0x5c339b[_0x7f64('0x57')]===_0x7f64('0x55')){var _0x51594c=_0x38326f['get']({'plain':!![]});var _0x2c5c65=_0x7f64('0x58');return db['UserProfileSection']['find']({'where':{'name':_0x2c5c65,'userProfileId':_0x5c339b[_0x7f64('0x59')]},'raw':!![]})[_0x7f64('0x18')](function(_0x95e242){if(_0x95e242&&_0x95e242[_0x7f64('0x5a')]===0x0){return db[_0x7f64('0x2e')][_0x7f64('0x54')]({'name':_0x51594c[_0x7f64('0x31')],'resourceId':_0x51594c['id'],'type':_0x95e242[_0x7f64('0x31')],'sectionId':_0x95e242['id']},{})[_0x7f64('0x18')](function(){return _0x38326f;});}else{return _0x38326f;}})['catch'](function(_0x3903d6){logger[_0x7f64('0x1f')](_0x7f64('0x5b'),_0x3903d6);throw _0x3903d6;});}return _0x38326f;});}})[_0x7f64('0x18')](respondWithResult(_0x526030,0xc9))[_0x7f64('0x22')](handleError(_0x526030,null));};exports[_0x7f64('0x54')]=function(_0x4631a4,_0x3ce7cc,_0x5dbfbd){var _0x4d112b;return db['Trunk'][_0x7f64('0x54')](_0x4631a4[_0x7f64('0x52')],{'raw':!![]})[_0x7f64('0x18')](function(_0xf58f1e){_0x4d112b=_0xf58f1e;return db[_0x7f64('0x47')][_0x7f64('0x5c')]({'raw':!![]});})[_0x7f64('0x18')](function(_0x5bdb5e){var _0x326fe8=fs[_0x7f64('0x5d')](path['join'](config[_0x7f64('0x5e')],_0x7f64('0x5f')),_0x7f64('0x60'));var _0x54c4c2=fs[_0x7f64('0x5d')](path['join'](config[_0x7f64('0x5e')],'server/files/templates/registry.ejs'),_0x7f64('0x60'));var _0x137f45=ejs[_0x7f64('0x61')](_0x326fe8,{'trunks':_0x5bdb5e||[]});fs[_0x7f64('0x62')](_0x7f64('0x63'),_0x137f45);if(_0x4d112b[_0x7f64('0x64')]){var _0x2821fd=ejs[_0x7f64('0x61')](_0x54c4c2,{'trunks':_0x5bdb5e||[]});fs['writeFileSync'](_0x7f64('0x65'),_0x2821fd);}})[_0x7f64('0x18')](function(){return respondWithRpcPromise(_0x7f64('0x66'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x3ea5fb=_0x4631a4[_0x7f64('0x55')][_0x7f64('0x2d')]({'plain':!![]});if(!_0x3ea5fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ea5fb[_0x7f64('0x57')]===_0x7f64('0x55')){var _0xd4a50c=_0x4d112b[_0x7f64('0x2d')]({'plain':!![]});return db[_0x7f64('0x67')][_0x7f64('0x4e')]({'where':{'name':'Trunks','userProfileId':_0x3ea5fb['userProfileId']},'raw':!![]})[_0x7f64('0x18')](function(_0x381732){if(_0x381732&&_0x381732[_0x7f64('0x5a')]===0x0){return db['UserProfileResource'][_0x7f64('0x54')]({'name':_0xd4a50c[_0x7f64('0x31')],'resourceId':_0xd4a50c['id'],'type':_0x381732[_0x7f64('0x31')],'sectionId':_0x381732['id']},{})[_0x7f64('0x18')](function(){return _0x4d112b;});}else{return _0x4d112b;}})[_0x7f64('0x22')](function(_0x5f2b3e){logger[_0x7f64('0x1f')](_0x7f64('0x5b'),_0x5f2b3e);throw _0x5f2b3e;});}return _0x4d112b;})['then'](respondWithResult(_0x3ce7cc,0xc9))[_0x7f64('0x22')](handleError(_0x3ce7cc,null));};exports['update']=function(_0x54c683,_0x2cb5ed,_0x214001){var _0x1bb1da;return db[_0x7f64('0x47')][_0x7f64('0x4e')]({'where':{'id':_0x54c683[_0x7f64('0x4b')]['id']}})[_0x7f64('0x18')](handleEntityNotFound(_0x2cb5ed,null))[_0x7f64('0x18')](saveUpdates(_0x54c683['body'],null))[_0x7f64('0x18')](function(_0x1232aa){if(_0x1232aa){_0x1bb1da=_0x1232aa;return db[_0x7f64('0x47')]['findAll']({'raw':!![]});}})[_0x7f64('0x18')](function(_0x427d9f){if(_0x427d9f){var _0x538777=fs['readFileSync'](path[_0x7f64('0x68')](config[_0x7f64('0x5e')],_0x7f64('0x5f')),_0x7f64('0x60'));var _0x3c0549=fs[_0x7f64('0x5d')](path[_0x7f64('0x68')](config[_0x7f64('0x5e')],'server/files/templates/registry.ejs'),'utf8');var _0x558441=ejs['render'](_0x538777,{'trunks':_0x427d9f||[]});fs[_0x7f64('0x62')](_0x7f64('0x63'),_0x558441);var _0x4198b5=ejs[_0x7f64('0x61')](_0x3c0549,{'trunks':_0x427d9f||[]});fs[_0x7f64('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x4198b5);return respondWithRpcPromise(_0x7f64('0x66'),_0x7f64('0x2c'),{'module':_0x7f64('0x69')});}return null;})['then'](function(_0x25c553){if(_0x25c553){return _0x1bb1da;}})[_0x7f64('0x18')](respondWithResult(_0x2cb5ed,null))[_0x7f64('0x22')](handleError(_0x2cb5ed,null));};exports[_0x7f64('0x2f')]=function(_0x268153,_0x47c450,_0x37f5ad){var _0x3d297a;return db['Trunk']['find']({'where':{'id':_0x268153[_0x7f64('0x4b')]['id']}})[_0x7f64('0x18')](handleEntityNotFound(_0x47c450,null))[_0x7f64('0x18')](removeEntity(_0x47c450,null))[_0x7f64('0x18')](function(){return db['Trunk'][_0x7f64('0x5c')]({'raw':!![]});})[_0x7f64('0x18')](function(_0x29f746){var _0x1f9fd9=fs[_0x7f64('0x5d')](path[_0x7f64('0x68')](config[_0x7f64('0x5e')],_0x7f64('0x5f')),_0x7f64('0x60'));var _0x5d8dee=fs[_0x7f64('0x5d')](path[_0x7f64('0x68')](config['root'],_0x7f64('0x6a')),'utf8');var _0x23dd55=ejs[_0x7f64('0x61')](_0x1f9fd9,{'trunks':_0x29f746});var _0x7e1fbd=ejs[_0x7f64('0x61')](_0x5d8dee,{'trunks':_0x29f746});fs['writeFileSync'](_0x7f64('0x63'),_0x23dd55);fs[_0x7f64('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x7e1fbd);return respondWithRpcPromise(_0x7f64('0x66'),_0x7f64('0x2f'),{'module':_0x7f64('0x69')});})[_0x7f64('0x22')](handleError(_0x47c450,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 40da4fd..05eb55c 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 _0xa4d0=['moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','lodash','util','../../config/logger','api'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa4d0,0x164));var _0x0a4d=function(_0x1fdab2,_0x3cc8a){_0x1fdab2=_0x1fdab2-0x0;var _0x5bf605=_0xa4d0[_0x1fdab2];return _0x5bf605;};'use strict';var _=require(_0x0a4d('0x0'));var util=require(_0x0a4d('0x1'));var logger=require(_0x0a4d('0x2'))(_0x0a4d('0x3'));var moment=require(_0x0a4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x0a4d('0x5'));var fs=require('fs');var path=require(_0x0a4d('0x6'));var rimraf=require(_0x0a4d('0x7'));var config=require(_0x0a4d('0x8'));var attributes=require(_0x0a4d('0x9'));module[_0x0a4d('0xa')]=function(_0x24431e,_0x3c03e3){return _0x24431e['define'](_0x0a4d('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf878=['define','Trunk','tools_trunks','lodash','util','moment','request-promise','../../config/environment','exports'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xf878,0x6f));var _0x8f87=function(_0x55b91b,_0x3fd726){_0x55b91b=_0x55b91b-0x0;var _0x447d14=_0xf878[_0x55b91b];return _0x447d14;};'use strict';var _=require(_0x8f87('0x0'));var util=require(_0x8f87('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f87('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f87('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f87('0x4'));var attributes=require('./trunk.attributes');module[_0x8f87('0x5')]=function(_0x18c08d,_0xf621e7){return _0x18c08d[_0x8f87('0x6')](_0x8f87('0x7'),attributes,{'tableName':_0x8f87('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 2b33fb6..f433d1a 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 _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xda2d=['../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x445024,_0x36dca6){var _0x5ab19a=function(_0x598957){while(--_0x598957){_0x445024['push'](_0x445024['shift']());}};_0x5ab19a(++_0x36dca6);}(_0xda2d,0x102));var _0xdda2=function(_0x93ff2c,_0x3881b6){_0x93ff2c=_0x93ff2c-0x0;var _0x408fa7=_0xda2d[_0x93ff2c];return _0x408fa7;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowTrunk']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['Trunk'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowTrunk',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7c3f371..1772870 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 _0xd26a=['/:id/avatar','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','addQueues','join','root','server/files/images/','format','%s-%s','now'];(function(_0x273df5,_0x179810){var _0x208939=function(_0x4d167a){while(--_0x4d167a){_0x273df5['push'](_0x273df5['shift']());}};_0x208939(++_0x179810);}(_0xd26a,0x112));var _0xad26=function(_0x52decf,_0x181cbc){_0x52decf=_0x52decf-0x0;var _0x5e4568=_0xd26a[_0x52decf];return _0x5e4568;};'use strict';var multer=require(_0xad26('0x0'));var util=require(_0xad26('0x1'));var path=require('path');var timeout=require(_0xad26('0x2'));var express=require(_0xad26('0x3'));var router=express[_0xad26('0x4')]();var auth=require(_0xad26('0x5'));var interaction=require(_0xad26('0x6'));var config=require(_0xad26('0x7'));var controller=require(_0xad26('0x8'));router[_0xad26('0x9')]('/',auth[_0xad26('0xa')](),controller[_0xad26('0xb')]);router['get'](_0xad26('0xc'),auth[_0xad26('0xa')](),controller['describe']);router['get'](_0xad26('0xd'),auth[_0xad26('0xa')](),controller[_0xad26('0xe')]);router[_0xad26('0x9')](_0xad26('0xf'),auth['isAuthenticated'](),controller[_0xad26('0x10')]);router[_0xad26('0x9')]('/:id/avatar',controller[_0xad26('0x11')]);router[_0xad26('0x9')](_0xad26('0x12'),auth['isAuthenticated'](),controller[_0xad26('0x13')]);router[_0xad26('0x9')](_0xad26('0x14'),auth[_0xad26('0xa')](),controller[_0xad26('0x15')]);router[_0xad26('0x9')](_0xad26('0x16'),auth[_0xad26('0xa')](),controller[_0xad26('0x17')]);router['get'](_0xad26('0x18'),auth[_0xad26('0xa')](),controller[_0xad26('0x19')]);router['get'](_0xad26('0x1a'),auth['isAuthenticated'](),controller['getRecordings']);router['get'](_0xad26('0x1b'),auth['isAuthenticated'](),controller[_0xad26('0x1c')]);router[_0xad26('0x9')](_0xad26('0x1d'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xad26('0x9')](_0xad26('0x1e'),auth[_0xad26('0xa')](),controller[_0xad26('0x1f')]);router[_0xad26('0x9')](_0xad26('0x20'),auth[_0xad26('0xa')](),controller[_0xad26('0x21')]);router[_0xad26('0x9')]('/:id/sms/interactions',auth[_0xad26('0xa')](),controller['getSmsInteractions']);router[_0xad26('0x9')](_0xad26('0x22'),auth[_0xad26('0xa')](),controller[_0xad26('0x23')]);router[_0xad26('0x9')]('/:id/whatsapp/interactions',auth[_0xad26('0xa')](),controller[_0xad26('0x24')]);router[_0xad26('0x9')]('/:id/teams',auth[_0xad26('0xa')](),controller['getTeams']);router[_0xad26('0x9')](_0xad26('0x25'),auth[_0xad26('0xa')](),controller['getLists']);router[_0xad26('0x9')](_0xad26('0x26'),auth[_0xad26('0xa')](),controller[_0xad26('0x27')]);router[_0xad26('0x9')](_0xad26('0x28'),auth['isAuthenticated'](),controller[_0xad26('0x29')]);router[_0xad26('0x9')](_0xad26('0x2a'),auth[_0xad26('0xa')](),controller[_0xad26('0x2b')]);router[_0xad26('0x9')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xad26('0x2c')]);router[_0xad26('0x9')]('/:id/openchannel_accounts',auth[_0xad26('0xa')](),controller[_0xad26('0x2d')]);router[_0xad26('0x9')](_0xad26('0x2e'),auth[_0xad26('0xa')](),controller['getSmsAccounts']);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xad26('0x2f')]);router[_0xad26('0x9')](_0xad26('0x30'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get'](_0xad26('0x31'),auth[_0xad26('0xa')](),controller['getSquareProjects']);router[_0xad26('0x9')](_0xad26('0x32'),auth['isAuthenticated'](),controller[_0xad26('0x33')]);router[_0xad26('0x9')](_0xad26('0x34'),auth[_0xad26('0xa')](),controller['getApiKey']);router[_0xad26('0x35')](_0xad26('0x12'),auth[_0xad26('0xa')](),controller[_0xad26('0x36')]);router[_0xad26('0x35')]('/',auth[_0xad26('0xa')](),controller['create']);router['post']('/create_many',auth[_0xad26('0xa')](),controller['bulkCreate']);router[_0xad26('0x35')](_0xad26('0x14'),auth[_0xad26('0xa')](),controller[_0xad26('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x141ac5,_0x4b3424,_0x3af0f8){_0x3af0f8(null,path[_0xad26('0x38')](config[_0xad26('0x39')],_0xad26('0x3a')));},'filename':function(_0x42bca4,_0x36962d,_0x12474f){_0x12474f(null,util[_0xad26('0x3b')](_0xad26('0x3c'),Date[_0xad26('0x3d')](),_0x36962d['originalname']));}})});router[_0xad26('0x35')](_0xad26('0x3e'),upload[_0xad26('0x3f')]('file'),controller[_0xad26('0x40')]);router[_0xad26('0x35')](_0xad26('0x41'),auth[_0xad26('0xa')](),controller[_0xad26('0x42')]);router[_0xad26('0x35')](_0xad26('0x43'),auth['isAuthenticated'](),controller[_0xad26('0x44')]);router[_0xad26('0x35')](_0xad26('0x45'),auth['isAuthenticated'](),controller[_0xad26('0x46')]);router[_0xad26('0x35')](_0xad26('0x47'),auth[_0xad26('0xa')](),controller[_0xad26('0x48')]);router[_0xad26('0x35')](_0xad26('0x49'),auth[_0xad26('0xa')](),controller[_0xad26('0x4a')]);router[_0xad26('0x35')](_0xad26('0x4b'),auth[_0xad26('0xa')](),controller[_0xad26('0x4c')]);router['post']('/:id/mail_interactions',auth[_0xad26('0xa')](),controller['addMailInteractions']);router['post'](_0xad26('0x4d'),auth[_0xad26('0xa')](),controller[_0xad26('0x4e')]);router[_0xad26('0x35')](_0xad26('0x4f'),auth[_0xad26('0xa')](),controller[_0xad26('0x50')]);router[_0xad26('0x35')]('/:id/openchannel_interactions',auth[_0xad26('0xa')](),controller[_0xad26('0x51')]);router[_0xad26('0x35')](_0xad26('0x52'),auth[_0xad26('0xa')](),controller[_0xad26('0x53')]);router[_0xad26('0x35')](_0xad26('0x2a'),auth['isAuthenticated'](),controller[_0xad26('0x54')]);router[_0xad26('0x35')](_0xad26('0x55'),auth[_0xad26('0xa')](),controller[_0xad26('0x56')]);router['post']('/:id/openchannel_accounts',auth[_0xad26('0xa')](),controller['addOpenchannelAccounts']);router[_0xad26('0x35')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xad26('0x57')]);router[_0xad26('0x35')](_0xad26('0x58'),auth[_0xad26('0xa')](),controller[_0xad26('0x59')]);router[_0xad26('0x35')](_0xad26('0x30'),auth[_0xad26('0xa')](),controller[_0xad26('0x5a')]);router[_0xad26('0x35')](_0xad26('0x31'),auth['isAuthenticated'](),controller[_0xad26('0x5b')]);router[_0xad26('0x35')](_0xad26('0x34'),auth[_0xad26('0xa')](),controller['createApiKey']);router[_0xad26('0x5c')](_0xad26('0xf'),auth[_0xad26('0xa')](),controller[_0xad26('0x5d')]);router['put'](_0xad26('0x5e'),auth[_0xad26('0xa')](),controller[_0xad26('0x5f')]);router[_0xad26('0x60')](_0xad26('0x14'),auth[_0xad26('0xa')](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0xad26('0xa')](),controller[_0xad26('0x61')]);router[_0xad26('0x60')](_0xad26('0xf'),auth['isAuthenticated'](),controller[_0xad26('0x62')]);router[_0xad26('0x60')](_0xad26('0x4b'),auth[_0xad26('0xa')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xad26('0x63')]);router[_0xad26('0x60')](_0xad26('0x4d'),auth[_0xad26('0xa')](),controller[_0xad26('0x64')]);router[_0xad26('0x60')]('/:id/sms_interactions',auth[_0xad26('0xa')](),controller[_0xad26('0x65')]);router['delete'](_0xad26('0x66'),auth[_0xad26('0xa')](),controller['removeOpenchannelInteractions']);router['delete'](_0xad26('0x52'),auth[_0xad26('0xa')](),controller[_0xad26('0x67')]);router[_0xad26('0x60')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xad26('0x60')](_0xad26('0x55'),auth[_0xad26('0xa')](),controller[_0xad26('0x68')]);router[_0xad26('0x60')](_0xad26('0x69'),auth[_0xad26('0xa')](),controller[_0xad26('0x6a')]);router[_0xad26('0x60')](_0xad26('0x2e'),auth[_0xad26('0xa')](),controller[_0xad26('0x6b')]);router[_0xad26('0x60')]('/:id/chat_websites',auth[_0xad26('0xa')](),controller[_0xad26('0x6c')]);router[_0xad26('0x60')](_0xad26('0x30'),auth[_0xad26('0xa')](),controller[_0xad26('0x6d')]);router[_0xad26('0x60')]('/:id/square_projects',auth[_0xad26('0xa')](),controller[_0xad26('0x6e')]);router[_0xad26('0x60')](_0xad26('0x34'),auth['isAuthenticated'](),controller[_0xad26('0x6f')]);module['exports']=router; \ No newline at end of file +var _0xfbcb=['getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','join','format','%s-%s','now','originalname','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','delete','removeQueues','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0xfbcb,0x19e));var _0xbfbc=function(_0x1e25db,_0x3d9d8d){_0x1e25db=_0x1e25db-0x0;var _0x245fd4=_0xfbcb[_0x1e25db];return _0x245fd4;};'use strict';var multer=require(_0xbfbc('0x0'));var util=require(_0xbfbc('0x1'));var path=require(_0xbfbc('0x2'));var timeout=require(_0xbfbc('0x3'));var express=require(_0xbfbc('0x4'));var router=express[_0xbfbc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbfbc('0x6'));var config=require(_0xbfbc('0x7'));var controller=require(_0xbfbc('0x8'));router[_0xbfbc('0x9')]('/',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0xb')]);router['get'](_0xbfbc('0xc'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0xd')]);router[_0xbfbc('0x9')](_0xbfbc('0xe'),auth[_0xbfbc('0xa')](),controller['whoami']);router[_0xbfbc('0x9')](_0xbfbc('0xf'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x10')]);router[_0xbfbc('0x9')](_0xbfbc('0x11'),controller[_0xbfbc('0x12')]);router['get']('/:id/contacts',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x13')]);router[_0xbfbc('0x9')]('/:id/queues',auth[_0xbfbc('0xa')](),controller['getQueues']);router[_0xbfbc('0x9')](_0xbfbc('0x14'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x15')]);router['get'](_0xbfbc('0x16'),auth[_0xbfbc('0xa')](),controller['getGroups']);router['get'](_0xbfbc('0x17'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x18')]);router[_0xbfbc('0x9')](_0xbfbc('0x19'),auth[_0xbfbc('0xa')](),controller['getScreenRecordings']);router[_0xbfbc('0x9')](_0xbfbc('0x1a'),auth['isAuthenticated'](),controller[_0xbfbc('0x1b')]);router[_0xbfbc('0x9')](_0xbfbc('0x1c'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x1d')]);router[_0xbfbc('0x9')](_0xbfbc('0x1e'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x1f')]);router[_0xbfbc('0x9')](_0xbfbc('0x20'),auth['isAuthenticated'](),controller[_0xbfbc('0x21')]);router[_0xbfbc('0x9')](_0xbfbc('0x22'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x23')]);router[_0xbfbc('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xbfbc('0x24')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xbfbc('0x25')]);router[_0xbfbc('0x9')](_0xbfbc('0x26'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x27')]);router[_0xbfbc('0x9')](_0xbfbc('0x28'),auth['isAuthenticated'](),controller[_0xbfbc('0x29')]);router[_0xbfbc('0x9')](_0xbfbc('0x2a'),auth[_0xbfbc('0xa')](),controller['getVoicePrefixes']);router[_0xbfbc('0x9')](_0xbfbc('0x2b'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x2c')]);router[_0xbfbc('0x9')](_0xbfbc('0x2d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x2e')]);router[_0xbfbc('0x9')](_0xbfbc('0x2f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x30')]);router[_0xbfbc('0x9')]('/:id/sms_accounts',auth[_0xbfbc('0xa')](),controller['getSmsAccounts']);router['get'](_0xbfbc('0x31'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x32')]);router['get']('/:id/whatsapp_accounts',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x33')]);router['get'](_0xbfbc('0x34'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xbfbc('0x9')](_0xbfbc('0x35'),auth['isAuthenticated'](),controller[_0xbfbc('0x36')]);router[_0xbfbc('0x9')](_0xbfbc('0x37'),auth['isAuthenticated'](),controller[_0xbfbc('0x38')]);router[_0xbfbc('0x39')](_0xbfbc('0x3a'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x3b')]);router[_0xbfbc('0x39')]('/',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x3c')]);router['post'](_0xbfbc('0x3d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x3e')]);router['post'](_0xbfbc('0x3f'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xbfbc('0x40')]({'destination':function(_0x2c625f,_0x29c182,_0x1e9ef9){_0x1e9ef9(null,path[_0xbfbc('0x41')](config['root'],'server/files/images/'));},'filename':function(_0x54be7b,_0x354fbd,_0x49bbae){_0x49bbae(null,util[_0xbfbc('0x42')](_0xbfbc('0x43'),Date[_0xbfbc('0x44')](),_0x354fbd[_0xbfbc('0x45')]));}})});router[_0xbfbc('0x39')](_0xbfbc('0x11'),upload['single'](_0xbfbc('0x46')),controller[_0xbfbc('0x47')]);router[_0xbfbc('0x39')]('/:id/login',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x48')]);router[_0xbfbc('0x39')](_0xbfbc('0x49'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x4a')]);router[_0xbfbc('0x39')](_0xbfbc('0x4b'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x4c')]);router[_0xbfbc('0x39')](_0xbfbc('0x4d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x4e')]);router['post'](_0xbfbc('0x4f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x50')]);router['post'](_0xbfbc('0x51'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x52')]);router[_0xbfbc('0x39')](_0xbfbc('0x53'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x54')]);router[_0xbfbc('0x39')](_0xbfbc('0x55'),auth[_0xbfbc('0xa')](),controller['addFaxInteractions']);router[_0xbfbc('0x39')](_0xbfbc('0x56'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x57')]);router[_0xbfbc('0x39')](_0xbfbc('0x58'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x59')]);router[_0xbfbc('0x39')](_0xbfbc('0x5a'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x5b')]);router[_0xbfbc('0x39')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xbfbc('0x5c')]);router[_0xbfbc('0x39')]('/:id/mail_accounts',auth[_0xbfbc('0xa')](),controller['addMailAccounts']);router[_0xbfbc('0x39')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xbfbc('0x39')](_0xbfbc('0x5d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x5e')]);router[_0xbfbc('0x39')](_0xbfbc('0x31'),auth[_0xbfbc('0xa')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xbfbc('0x5f')]);router['post'](_0xbfbc('0x34'),auth['isAuthenticated'](),controller[_0xbfbc('0x60')]);router[_0xbfbc('0x39')](_0xbfbc('0x37'),auth['isAuthenticated'](),controller[_0xbfbc('0x61')]);router[_0xbfbc('0x62')](_0xbfbc('0xf'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x63')]);router[_0xbfbc('0x62')](_0xbfbc('0x64'),auth[_0xbfbc('0xa')](),controller['changePassword']);router[_0xbfbc('0x65')](_0xbfbc('0x3f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x66')]);router['delete'](_0xbfbc('0x4f'),auth[_0xbfbc('0xa')](),controller['removeTeams']);router[_0xbfbc('0x65')]('/:id',auth[_0xbfbc('0xa')](),controller['destroy']);router[_0xbfbc('0x65')]('/:id/chat_interactions',auth[_0xbfbc('0xa')](),controller['removeChatInteractions']);router['delete'](_0xbfbc('0x53'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x67')]);router[_0xbfbc('0x65')](_0xbfbc('0x55'),auth['isAuthenticated'](),controller[_0xbfbc('0x68')]);router[_0xbfbc('0x65')](_0xbfbc('0x56'),auth[_0xbfbc('0xa')](),controller['removeSmsInteractions']);router[_0xbfbc('0x65')]('/:id/openchannel_interactions',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x69')]);router[_0xbfbc('0x65')](_0xbfbc('0x5a'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6a')]);router[_0xbfbc('0x65')](_0xbfbc('0x2b'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6b')]);router[_0xbfbc('0x65')](_0xbfbc('0x2d'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6c')]);router[_0xbfbc('0x65')](_0xbfbc('0x2f'),auth[_0xbfbc('0xa')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6d')]);router[_0xbfbc('0x65')]('/:id/chat_websites',auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x6e')]);router[_0xbfbc('0x65')](_0xbfbc('0x6f'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x70')]);router[_0xbfbc('0x65')]('/:id/square_projects',auth[_0xbfbc('0xa')](),controller['removeSquareProjects']);router[_0xbfbc('0x65')](_0xbfbc('0x37'),auth[_0xbfbc('0xa')](),controller[_0xbfbc('0x71')]);module[_0xbfbc('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5aff422..f7c37a8 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 _0x638d=['udp','transport','join','getDataValue','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','accept','originate','uac','uas','passive','actpass','update,nonat','DATE','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','dtlsverify','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'];(function(_0x2fb26c,_0x41607d){var _0x4c063d=function(_0x1967e7){while(--_0x1967e7){_0x2fb26c['push'](_0x2fb26c['shift']());}};_0x4c063d(++_0x41607d);}(_0x638d,0x1dd));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd638('0x0'));var moment=require('moment');var util=require('util');var _=require(_0xd638('0x1'));module[_0xd638('0x2')]={'name':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'unique':_0xd638('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1d12b3){this[_0xd638('0x5')](_0xd638('0x4'),_0x1d12b3);this[_0xd638('0x5')](_0xd638('0x6'),_0x1d12b3);},'comment':_0xd638('0x7')},'fullname':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'set':function(_0x57c13c){this['setDataValue'](_0xd638('0x8'),_0x57c13c);this[_0xd638('0x5')](_0xd638('0x9'),util[_0xd638('0xa')](_0xd638('0xb'),_0x57c13c,this['getDataValue'](_0xd638('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'unique':_0xd638('0xd'),'validate':{'isEmail':!![]},'set':function(_0x59bd6e){if(_0x59bd6e){this[_0xd638('0x5')](_0xd638('0xd'),_0x59bd6e[_0xd638('0xe')]());}}},'role':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x10'),_0xd638('0x11'),_0xd638('0x12'),_0xd638('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xd638('0x14')},'internal':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':![],'unique':_0xd638('0xc'),'set':function(_0x2a415e){this['setDataValue'](_0xd638('0xc'),_0x2a415e);this['setDataValue'](_0xd638('0x16'),_0x2a415e);this[_0xd638('0x5')](_0xd638('0x9'),util[_0xd638('0xa')](_0xd638('0xb'),this['getDataValue'](_0xd638('0x8')),_0x2a415e));}},'salt':{'type':Sequelize[_0xd638('0x3')]},'phone':{'type':Sequelize[_0xd638('0x3')]},'mobile':{'type':Sequelize[_0xd638('0x3')]},'address':{'type':Sequelize[_0xd638('0x3')]},'zipcode':{'type':Sequelize[_0xd638('0x3')]},'userpic':{'type':Sequelize[_0xd638('0x3')]},'city':{'type':Sequelize[_0xd638('0x3')]},'country':{'type':Sequelize[_0xd638('0x3')]},'online':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xd638('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd638('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd638('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xd638('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x19'),'user','peer'),'allowNull':!![],'defaultValue':_0xd638('0x19')},'context':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'defaultValue':_0xd638('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0xd638('0x1b'),_0xd638('0x1c'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xd638('0x1d'),_0xd638('0x1e'),_0xd638('0x1f'),_0xd638('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd638('0x21'),'set':function(_0x262207){this[_0xd638('0x5')](_0xd638('0x22'),_0x262207?_0x262207[_0xd638('0x23')](','):null);},'get':function(){return this[_0xd638('0x24')](_0xd638('0x22'))?this[_0xd638('0x24')](_0xd638('0x22'))[_0xd638('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xd638('0x26'),_0xd638('0x27'),'shortinfo',_0xd638('0x28'),_0xd638('0x29')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no',_0xd638('0x2b'),_0xd638('0x2c'),_0xd638('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x488442){this[_0xd638('0x5')]('nat',_0x488442?_0x488442[_0xd638('0x23')](','):null);},'get':function(){return this[_0xd638('0x24')]('nat')?this[_0xd638('0x24')](_0xd638('0x2e'))[_0xd638('0x25')](','):null;},'comment':_0xd638('0x2f')},'callgroup':{'type':Sequelize[_0xd638('0x3')]},'namedcallgroup':{'type':Sequelize[_0xd638('0x3')]},'pickupgroup':{'type':Sequelize[_0xd638('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd638('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd638('0x30')},'allow':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'defaultValue':_0xd638('0x31'),'set':function(_0x290671){this[_0xd638('0x5')]('allow',_0x290671?_0x290671[_0xd638('0x23')](';'):_0xd638('0x31'));},'get':function(){return this[_0xd638('0x24')](_0xd638('0x32'))?this[_0xd638('0x24')](_0xd638('0x32'))['split'](';'):null;},'comment':_0xd638('0x33')},'autoframing':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'set':function(_0x430882){this[_0xd638('0x5')]('insecure',_0x430882?_0x430882[_0xd638('0x23')](','):null);},'get':function(){return this[_0xd638('0x24')](_0xd638('0x34'))?this[_0xd638('0x24')](_0xd638('0x34'))[_0xd638('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xd638('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd638('0xf')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd638('0x35'),'refuse',_0xd638('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x37'),_0xd638('0x38')),'allowNull':!![],'defaultValue':_0xd638('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xd638('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd638('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd638('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd638('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd638('0xf')]('active',_0xd638('0x39'),_0xd638('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no',_0xd638('0x2b'),'update',_0xd638('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd638('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xd638('0x3c')]},'passwordResetAt':{'type':Sequelize[_0xd638('0x3c')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd638('0x3')]},'showWebBar':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0,'set':function(_0x10aeb1){this[_0xd638('0x5')]('showWebBar',_0x10aeb1);var _0x3cea18=this[_0xd638('0x3d')]({'plain':!![]});switch(_0x10aeb1){case 0x0:case 0x1:var _0x142e2a=_0x3cea18[_0xd638('0x22')]?_[_0xd638('0x3e')](_0x3cea18[_0xd638('0x22')])?_0x3cea18[_0xd638('0x22')][_0xd638('0x23')]():_0x3cea18[_0xd638('0x22')]:_0xd638('0x21');if(_0x142e2a===_0xd638('0x3f')){_0x142e2a=_0xd638('0x21');}this[_0xd638('0x5')]('transport',_0x142e2a);this[_0xd638('0x5')](_0xd638('0x40'),'no');this[_0xd638('0x5')](_0xd638('0x41'),null);this[_0xd638('0x5')](_0xd638('0x42'),null);this['setDataValue'](_0xd638('0x43'),null);this['setDataValue'](_0xd638('0x44'),null);this[_0xd638('0x5')]('dtlsverify',null);this[_0xd638('0x5')]('dtlssetup',null);this[_0xd638('0x5')](_0xd638('0x45'),null);this[_0xd638('0x5')](_0xd638('0x46'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xd638('0x5')]('transport',_0xd638('0x3f'));this[_0xd638('0x5')](_0xd638('0x40'),_0xd638('0x2a'));this[_0xd638('0x5')](_0xd638('0x41'),_0xd638('0x2a'));this[_0xd638('0x5')]('force_avp','yes');this[_0xd638('0x5')](_0xd638('0x43'),'yes');this[_0xd638('0x5')](_0xd638('0x44'),_0xd638('0x2a'));this[_0xd638('0x5')](_0xd638('0x47'),'no');this[_0xd638('0x5')](_0xd638('0x48'),'actpass');this['setDataValue'](_0xd638('0x45'),_0x3cea18[_0xd638('0x45')]||_0xd638('0x49'));this[_0xd638('0x5')](_0xd638('0x46'),_0x3cea18[_0xd638('0x46')]||_0xd638('0x4a'));this[_0xd638('0x5')](_0xd638('0x4b'),_0xd638('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x7ecf35){this['setDataValue']('permissions',_0x7ecf35?_0x7ecf35[_0xd638('0x23')](','):[]);},'get':function(){return this[_0xd638('0x24')](_0xd638('0x4c'))?_[_0xd638('0x4d')](this['getDataValue'](_0xd638('0x4c'))[_0xd638('0x25')](','),function(_0x39bc06){return parseInt(_0x39bc06,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd638('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xd638('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd638('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd638('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd638('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd638('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd638('0x4e')],'get':function(){return this[_0xd638('0x24')](_0xd638('0x4f'))?this['getDataValue'](_0xd638('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xd638('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![],'set':function(_0x381b63){if(typeof _0x381b63==='string'){var _0x548efb=_0x381b63==='1'?!![]:_0x381b63==='0'?![]:_0x381b63==='true'?!![]:_0x381b63===_0xd638('0x50')?![]:![];this[_0xd638('0x5')](_0xd638('0x51'),_0x548efb);}else{this[_0xd638('0x5')](_0xd638('0x51'),_0x381b63);}}},'blocked':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![],'set':function(_0x127b64){this[_0xd638('0x5')](_0xd638('0x52'),_0x127b64);if(_0x127b64===!![]){this[_0xd638('0x5')]('blockedAt',moment());this[_0xd638('0x5')](_0xd638('0x53'),0x0);}else{this[_0xd638('0x5')](_0xd638('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0xd638('0x3c')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3ae5=['user','telephone','local','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','passive','update','update,nonat','showWebBar','get','isArray','encryption','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','wss','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3ae5,0xfc));var _0x53ae=function(_0x459ca3,_0x40be58){_0x459ca3=_0x459ca3-0x0;var _0x3a75ca=_0x3ae5[_0x459ca3];return _0x3a75ca;};'use strict';var Sequelize=require(_0x53ae('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'unique':_0x53ae('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x248ada){this[_0x53ae('0x3')](_0x53ae('0x2'),_0x248ada);this['setDataValue'](_0x53ae('0x4'),_0x248ada);},'comment':_0x53ae('0x5')},'fullname':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'set':function(_0x386ed1){this[_0x53ae('0x3')](_0x53ae('0x6'),_0x386ed1);this[_0x53ae('0x3')](_0x53ae('0x7'),util['format'](_0x53ae('0x8'),_0x386ed1,this[_0x53ae('0x9')](_0x53ae('0xa'))));}},'alias':{'type':Sequelize[_0x53ae('0x1')]},'email':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'unique':_0x53ae('0xb'),'validate':{'isEmail':!![]},'set':function(_0x34feb0){if(_0x34feb0){this[_0x53ae('0x3')]('email',_0x34feb0[_0x53ae('0xc')]());}}},'role':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0xe'),_0x53ae('0xf'),'agent',_0x53ae('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x53ae('0x1')],'defaultValue':_0x53ae('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x53ae('0xa'),'set':function(_0x1a4e04){this[_0x53ae('0x3')](_0x53ae('0xa'),_0x1a4e04);this[_0x53ae('0x3')]('accountcode',_0x1a4e04);this[_0x53ae('0x3')](_0x53ae('0x7'),util[_0x53ae('0x12')](_0x53ae('0x8'),this[_0x53ae('0x9')](_0x53ae('0x6')),_0x1a4e04));}},'salt':{'type':Sequelize[_0x53ae('0x1')]},'phone':{'type':Sequelize[_0x53ae('0x1')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x53ae('0x1')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x53ae('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x53ae('0x14')]},'voicePause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x53ae('0x1')],'defaultValue':_0x53ae('0x15')},'lastPauseAt':{'type':Sequelize[_0x53ae('0x14')]},'chatCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x53ae('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x53ae('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x53ae('0x17')},'ipaddr':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x18'),_0x53ae('0xf'),_0x53ae('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'defaultValue':_0x53ae('0x1a')},'callingpres':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x1b'),_0x53ae('0x1c'),_0x53ae('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED',_0x53ae('0x1e'),_0x53ae('0x1f'),_0x53ae('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'secret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x53ae('0x21'),'set':function(_0x5ac050){this[_0x53ae('0x3')](_0x53ae('0x22'),_0x5ac050?_0x5ac050[_0x53ae('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x53ae('0x22'))?this[_0x53ae('0x9')](_0x53ae('0x22'))[_0x53ae('0x24')](','):null;},'comment':_0x53ae('0x25')},'dtmfmode':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x26'),_0x53ae('0x27'),_0x53ae('0x28'),_0x53ae('0x29'),_0x53ae('0x2a')),'allowNull':!![],'defaultValue':_0x53ae('0x26')},'directmedia':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no',_0x53ae('0x2c'),'update',_0x53ae('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'defaultValue':_0x53ae('0x2e'),'set':function(_0x2fb607){this[_0x53ae('0x3')]('nat',_0x2fb607?_0x2fb607[_0x53ae('0x23')](','):null);},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x2f'))?this[_0x53ae('0x9')](_0x53ae('0x2f'))[_0x53ae('0x24')](','):null;},'comment':_0x53ae('0x30')},'callgroup':{'type':Sequelize[_0x53ae('0x1')]},'namedcallgroup':{'type':Sequelize[_0x53ae('0x1')]},'pickupgroup':{'type':Sequelize[_0x53ae('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x53ae('0x1')]},'disallow':{'type':Sequelize[_0x53ae('0x1')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x53ae('0x31'),'set':function(_0x3323db){this[_0x53ae('0x3')](_0x53ae('0x32'),_0x3323db?_0x3323db[_0x53ae('0x23')](';'):_0x53ae('0x31'));},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x32'))?this[_0x53ae('0x9')]('allow')[_0x53ae('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'set':function(_0x4417f6){this[_0x53ae('0x3')]('insecure',_0x4417f6?_0x4417f6[_0x53ae('0x23')](','):null);},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x33'))?this[_0x53ae('0x9')](_0x53ae('0x33'))[_0x53ae('0x24')](','):null;},'comment':_0x53ae('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x53ae('0xd')]('yes','no',_0x53ae('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![],'defaultValue':_0x53ae('0x36')},'amaflags':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x53ae('0x2b')},'busylevel':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no',_0x53ae('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x38'),_0x53ae('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x3a'),_0x53ae('0x3b')),'allowNull':!![],'defaultValue':_0x53ae('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x53ae('0x2b')},'keepalive':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x53ae('0xd')]('yes','no',_0x53ae('0x3c'),_0x53ae('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x53ae('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x53ae('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x53ae('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x53ae('0xd')](_0x53ae('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x53ae('0xd')]('yes','no',_0x53ae('0x2c'),_0x53ae('0x3f'),_0x53ae('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x53ae('0x1')]},'resetPasswordExpires':{'type':Sequelize[_0x53ae('0x14')]},'passwordResetAt':{'type':Sequelize[_0x53ae('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x53ae('0x1')]},'showWebBar':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0,'set':function(_0x1c31be){this[_0x53ae('0x3')](_0x53ae('0x41'),_0x1c31be);var _0x4a4d65=this[_0x53ae('0x42')]({'plain':!![]});switch(_0x1c31be){case 0x0:case 0x1:var _0x56190b=_0x4a4d65[_0x53ae('0x22')]?_[_0x53ae('0x43')](_0x4a4d65[_0x53ae('0x22')])?_0x4a4d65['transport'][_0x53ae('0x23')]():_0x4a4d65[_0x53ae('0x22')]:_0x53ae('0x21');if(_0x56190b==='wss'){_0x56190b=_0x53ae('0x21');}this[_0x53ae('0x3')]('transport',_0x56190b);this[_0x53ae('0x3')](_0x53ae('0x44'),'no');this[_0x53ae('0x3')]('avpf',null);this[_0x53ae('0x3')](_0x53ae('0x45'),null);this[_0x53ae('0x3')]('icesupport',null);this[_0x53ae('0x3')](_0x53ae('0x46'),null);this[_0x53ae('0x3')](_0x53ae('0x47'),null);this[_0x53ae('0x3')](_0x53ae('0x48'),null);this[_0x53ae('0x3')]('dtlscertfile',null);this[_0x53ae('0x3')](_0x53ae('0x49'),null);this[_0x53ae('0x3')](_0x53ae('0x4a'),'no');break;case 0x2:this['setDataValue']('transport',_0x53ae('0x4b'));this[_0x53ae('0x3')](_0x53ae('0x44'),_0x53ae('0x2b'));this[_0x53ae('0x3')]('avpf',_0x53ae('0x2b'));this[_0x53ae('0x3')](_0x53ae('0x45'),_0x53ae('0x2b'));this[_0x53ae('0x3')]('icesupport',_0x53ae('0x2b'));this['setDataValue'](_0x53ae('0x46'),'yes');this[_0x53ae('0x3')]('dtlsverify','no');this[_0x53ae('0x3')](_0x53ae('0x48'),_0x53ae('0x4c'));this[_0x53ae('0x3')](_0x53ae('0x4d'),_0x4a4d65[_0x53ae('0x4d')]||'/etc/pki/tls/certs/motion.crt');this[_0x53ae('0x3')](_0x53ae('0x49'),_0x4a4d65[_0x53ae('0x49')]||_0x53ae('0x4e'));this[_0x53ae('0x3')](_0x53ae('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5790b7){this[_0x53ae('0x3')](_0x53ae('0x4f'),_0x5790b7?_0x5790b7[_0x53ae('0x23')](','):[]);},'get':function(){return this[_0x53ae('0x9')](_0x53ae('0x4f'))?_[_0x53ae('0x50')](this['getDataValue'](_0x53ae('0x4f'))[_0x53ae('0x24')](','),function(_0x473ba1){return parseInt(_0x473ba1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x53ae('0x1')]},'phoneBarBusyNumber':{'type':Sequelize[_0x53ae('0x1')]},'phoneBarUnconditional':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x53ae('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x53ae('0x1')]},'phoneBarEnableJaws':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x53ae('0x51')],'get':function(){return this[_0x53ae('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0x53ae('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x53ae('0x1')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x13466a){if(typeof _0x13466a===_0x53ae('0x52')){var _0xf3fbdb=_0x13466a==='1'?!![]:_0x13466a==='0'?![]:_0x13466a===_0x53ae('0x53')?!![]:_0x13466a===_0x53ae('0x54')?![]:![];this[_0x53ae('0x3')](_0x53ae('0x55'),_0xf3fbdb);}else{this[_0x53ae('0x3')](_0x53ae('0x55'),_0x13466a);}}},'blocked':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![],'set':function(_0x2b362c){this['setDataValue'](_0x53ae('0x56'),_0x2b362c);if(_0x2b362c===!![]){this[_0x53ae('0x3')](_0x53ae('0x57'),moment());this['setDataValue'](_0x53ae('0x58'),0x0);}else{this[_0x53ae('0x3')](_0x53ae('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x53ae('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x53ae('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x53ae('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1ef7379..5cee5da 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 _0xb7ff=['getTeams','addTeams','omit','setDataValue','Voice','getChatQueues','Chat','Mail','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','getVoiceQueues','getMailQueues','getSmsQueues','Queue:remove','getLists','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','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','token','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','message','User,\x20%s,\x20%s','result','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','get','role','admin','Users','Agents','agent','Telephones','filter','ignore','value','includes','find','name','stack','send','index','map','User','fieldName','type','key','model','differenceBy','password','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','where','merge','sequelize','lower','col','options','includeAll','include','findAll','rows','catch','show','salt','length','body','params','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','fullname','email','permissions','102','113','105','106','108','109','100','111','114','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','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','all','each','VoiceMail','telephone','isEmpty','compact','push','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','channel','loginInPause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','spread','QueueId','emit','Queue:save','voice','online','SIP/%s','voicePause','penalty','upsert','removeQueues','remove','capitalize','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','CmContact','rawAttributes','sort','CmList','List','Tag','Tags','color','tag','findOne','Queue','getVoiceQueuesRt','UserVoiceQueueRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','isMiddleware','resolve','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','mail','chat','fax','sms','whatsapp','openchannel','%s%s','Team'];(function(_0x1060ef,_0x432dd4){var _0x240222=function(_0x28f9db){while(--_0x28f9db){_0x1060ef['push'](_0x1060ef['shift']());}};_0x240222(++_0x432dd4);}(_0xb7ff,0x6e));var _0xfb7f=function(_0x10e7c3,_0x558d6d){_0x10e7c3=_0x10e7c3-0x0;var _0x2deccb=_0xb7ff[_0x10e7c3];return _0x2deccb;};'use strict';var pdf=require(_0xfb7f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfb7f('0x1'));var zipdir=require(_0xfb7f('0x2'));var jsonpatch=require(_0xfb7f('0x3'));var rp=require('request-promise');var moment=require(_0xfb7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfb7f('0x5'));var util=require(_0xfb7f('0x6'));var path=require('path');var sox=require(_0xfb7f('0x7'));var csv=require(_0xfb7f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb7f('0x9'));var squel=require('squel');var crypto=require(_0xfb7f('0xa'));var jsforce=require(_0xfb7f('0xb'));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(_0xfb7f('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb7f('0xd'));var logger=require(_0xfb7f('0xe'))('api');var utils=require(_0xfb7f('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xfb7f('0x10'));var db=require(_0xfb7f('0x11'))['db'];config[_0xfb7f('0x12')]=_[_0xfb7f('0x13')](config[_0xfb7f('0x12')],{'host':_0xfb7f('0x14'),'port':0x18eb});var socket=require(_0xfb7f('0x15'))(new Redis(config[_0xfb7f('0x12')]));require(_0xfb7f('0x16'))[_0xfb7f('0x17')](socket);var jayson=require(_0xfb7f('0x18'));var client=jayson['client'][_0xfb7f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x56b397,_0x38bc2d,_0x131ab3,_0x50d1e7){return new BPromise(function(_0xf54442,_0x3d7a1){var _0x281190=_0x50d1e7||client;return _0x281190[_0xfb7f('0x1a')](_0x56b397,_0x131ab3)['then'](function(_0x54214a){logger[_0xfb7f('0x1b')]('User,\x20%s,\x20%s',_0x38bc2d,_0xfb7f('0x1c'));logger[_0xfb7f('0x1d')]('User,\x20%s,\x20%s,\x20%s',_0x38bc2d,'request\x20sent',JSON[_0xfb7f('0x1e')](_0x54214a));if(_0x54214a[_0xfb7f('0x1f')]){if(_0x54214a[_0xfb7f('0x1f')]['code']===0x1f4){logger[_0xfb7f('0x1f')]('User,\x20%s,\x20%s',_0x38bc2d,_0x54214a[_0xfb7f('0x1f')][_0xfb7f('0x20')]);return _0x3d7a1(_0x54214a[_0xfb7f('0x1f')]['message']);}logger[_0xfb7f('0x1f')](_0xfb7f('0x21'),_0x38bc2d,_0x54214a[_0xfb7f('0x1f')]['message']);return _0xf54442(_0x54214a['error'][_0xfb7f('0x20')]);}else{logger[_0xfb7f('0x1b')](_0xfb7f('0x21'),_0x38bc2d,_0xfb7f('0x1c'));_0xf54442(_0x54214a[_0xfb7f('0x22')][_0xfb7f('0x20')]);}})['catch'](function(_0x50c085){logger['error'](_0xfb7f('0x21'),_0x38bc2d,_0x50c085);_0x3d7a1(_0x50c085);});});}function respondWithStatusCode(_0x2c4291,_0xec7477){_0xec7477=_0xec7477||0xcc;return function(_0x188aa1){if(_0x188aa1){return _0x2c4291[_0xfb7f('0x23')](_0xec7477);}return _0x2c4291['status'](_0xec7477)[_0xfb7f('0x24')]();};}function respondWithResult(_0x1e9fc7,_0x5dedde){_0x5dedde=_0x5dedde||0xc8;return function(_0x671f8a){if(_0x671f8a){return _0x1e9fc7['status'](_0x5dedde)[_0xfb7f('0x25')](_0x671f8a);}};}function respondWithFilteredResult(_0x14e307,_0x517167){return function(_0xb1c747){if(_0xb1c747){var _0xf38b9f=_0xb1c747[_0xfb7f('0x26')],_0x37cfde=_0x517167[_0xfb7f('0x27')],_0x5d66dd=_0x517167[_0xfb7f('0x27')]+_0x517167[_0xfb7f('0x28')],_0xb4ce58;if(_0x5d66dd>=_0xf38b9f){_0x5d66dd=_0xf38b9f;_0xb4ce58=0xc8;}else{_0xb4ce58=0xce;}_0x14e307[_0xfb7f('0x29')](_0xb4ce58);return _0x14e307[_0xfb7f('0x2a')]('Content-Range',_0x37cfde+'-'+_0x5d66dd+'/'+_0xf38b9f)['json'](_0xb1c747);}return null;};}function patchUpdates(_0x9c2dc){return function(_0x449862){try{jsonpatch[_0xfb7f('0x2b')](_0x449862,_0x9c2dc,!![]);}catch(_0x38da1b){return BPromise[_0xfb7f('0x2c')](_0x38da1b);}return _0x449862[_0xfb7f('0x2d')]();};}function saveUpdates(_0x12937b,_0x1537ce){return function(_0x22f4ba){if(_0x22f4ba){return _0x22f4ba[_0xfb7f('0x2e')](_0x12937b)[_0xfb7f('0x2f')](function(_0x44486e){return _0x44486e;});}return null;};}function removeEntity(_0x29fb1d,_0x31a6db){return function(_0x3f8c93){if(_0x3f8c93){return _0x3f8c93[_0xfb7f('0x30')]()[_0xfb7f('0x2f')](function(){var _0x21691c=_0x3f8c93[_0xfb7f('0x31')]({'plain':!![]});if(_0x21691c[_0xfb7f('0x32')]===_0xfb7f('0x33'))return;var _0x2fcaf2=[{'name':_0xfb7f('0x34'),'value':'user','ignore':!![]},{'name':_0xfb7f('0x35'),'value':_0xfb7f('0x36'),'ignore':![]},{'name':_0xfb7f('0x37'),'value':'telephone','ignore':![]}];var _0x136012=_(_0x2fcaf2)[_0xfb7f('0x38')](_0xfb7f('0x39'))['map'](_0xfb7f('0x3a'))['value']();if(_[_0xfb7f('0x3b')](_0x136012,_0x21691c[_0xfb7f('0x32')])){return;}var _0x1aeebb=_[_0xfb7f('0x3c')](_0x2fcaf2,[_0xfb7f('0x3a'),_0x21691c['role']])[_0xfb7f('0x3d')];return db['UserProfileResource'][_0xfb7f('0x30')]({'where':{'type':_0x1aeebb,'resourceId':_0x21691c['id']}})[_0xfb7f('0x2f')](function(){return _0x3f8c93;});})[_0xfb7f('0x2f')](function(){_0x29fb1d[_0xfb7f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230c60,_0x1e6bd2){return function(_0x31c301){if(!_0x31c301){_0x230c60[_0xfb7f('0x23')](0x194);}return _0x31c301;};}function handleError(_0x3c8248,_0x15c47a){_0x15c47a=_0x15c47a||0x1f4;return function(_0x56e665){logger['error'](_0x56e665[_0xfb7f('0x3e')]);if(_0x56e665[_0xfb7f('0x3d')]){delete _0x56e665[_0xfb7f('0x3d')];}_0x3c8248[_0xfb7f('0x29')](_0x15c47a)[_0xfb7f('0x3f')](_0x56e665);};}exports[_0xfb7f('0x40')]=function(_0x1ae6de,_0x37d48f){var _0x11634e={},_0x30fa18={},_0x23e84f={'count':0x0,'rows':[]};var _0x1a0b90=_[_0xfb7f('0x41')](db[_0xfb7f('0x42')]['rawAttributes'],function(_0x121d28){return{'name':_0x121d28[_0xfb7f('0x43')],'type':_0x121d28[_0xfb7f('0x44')][_0xfb7f('0x45')]};});_0x30fa18[_0xfb7f('0x46')]=_[_0xfb7f('0x47')](_['map'](_0x1a0b90,_0xfb7f('0x3d')),[_0xfb7f('0x48'),'salt']);_0x30fa18['query']=_[_0xfb7f('0x49')](_0x1ae6de['query']);_0x30fa18['filters']=_[_0xfb7f('0x4a')](_0x30fa18[_0xfb7f('0x46')],_0x30fa18[_0xfb7f('0x4b')]);_0x11634e[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x30fa18[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x11634e[_0xfb7f('0x4c')]=_0x11634e[_0xfb7f('0x4c')]['length']?_0x11634e[_0xfb7f('0x4c')]:_0x30fa18[_0xfb7f('0x46')];if(!_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x11634e['limit']=qs['limit'](_0x1ae6de['query'][_0xfb7f('0x28')]);_0x11634e[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}_0x11634e[_0xfb7f('0x50')]=qs['sort'](_0x1ae6de[_0xfb7f('0x4b')]['sort']);_0x11634e['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x1ae6de[_0xfb7f('0x4b')],_0x30fa18[_0xfb7f('0x51')]),_0x1a0b90);if(_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x11634e[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x11634e[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x1a0b90,function(_0x3cc5d5){if(_0x3cc5d5[_0xfb7f('0x44')]!=='VIRTUAL'){return db[_0xfb7f('0x55')][_0xfb7f('0x53')](db[_0xfb7f('0x55')]['fn'](_0xfb7f('0x56'),db[_0xfb7f('0x55')][_0xfb7f('0x57')](_0x3cc5d5['name'])),{'$like':db['sequelize']['fn'](_0xfb7f('0x56'),'%'+_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%')});}})});}_0x11634e=_[_0xfb7f('0x54')]({},_0x11634e,_0x1ae6de[_0xfb7f('0x58')]);var _0x2f9672={'where':_0x11634e[_0xfb7f('0x53')]};return db[_0xfb7f('0x42')][_0xfb7f('0x26')](_0x2f9672)[_0xfb7f('0x2f')](function(_0x18869b){_0x23e84f[_0xfb7f('0x26')]=_0x18869b;if(_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x59')]){_0x11634e[_0xfb7f('0x5a')]=[{'all':!![]}];}return db[_0xfb7f('0x42')][_0xfb7f('0x5b')](_0x11634e);})[_0xfb7f('0x2f')](function(_0xac5ecd){_0x23e84f[_0xfb7f('0x5c')]=_0xac5ecd;return _0x23e84f;})[_0xfb7f('0x2f')](respondWithFilteredResult(_0x37d48f,_0x11634e))[_0xfb7f('0x5d')](handleError(_0x37d48f,null));};exports[_0xfb7f('0x5e')]=function(_0x1f8d27,_0x2685d4){var _0x1aae46={'raw':![],'where':{'id':_0x1f8d27['params']['id']}},_0x149ae2={};_0x149ae2['model']=_[_0xfb7f('0x47')](_[_0xfb7f('0x49')](db[_0xfb7f('0x42')]['rawAttributes']),['password',_0xfb7f('0x5f')]);_0x149ae2[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1f8d27['query']);_0x149ae2['filters']=_[_0xfb7f('0x4a')](_0x149ae2[_0xfb7f('0x46')],_0x149ae2[_0xfb7f('0x4b')]);_0x1aae46['attributes']=_[_0xfb7f('0x4a')](_0x149ae2['model'],qs[_0xfb7f('0x4d')](_0x1f8d27[_0xfb7f('0x4b')]['fields']));_0x1aae46[_0xfb7f('0x4c')]=_0x1aae46['attributes'][_0xfb7f('0x60')]?_0x1aae46['attributes']:_0x149ae2['model'];if(_0x1f8d27['query'][_0xfb7f('0x59')]){_0x1aae46['include']=[{'all':!![]}];}_0x1aae46=_['merge']({},_0x1aae46,_0x1f8d27[_0xfb7f('0x58')]);return db[_0xfb7f('0x42')][_0xfb7f('0x3c')](_0x1aae46)['then'](handleEntityNotFound(_0x2685d4,null))['then'](respondWithResult(_0x2685d4,null))[_0xfb7f('0x5d')](handleError(_0x2685d4,null));};exports[_0xfb7f('0x2e')]=function(_0x48da63,_0x426b49){if(_0x48da63[_0xfb7f('0x61')]['id']){delete _0x48da63['body']['id'];}delete _0x48da63[_0xfb7f('0x61')]['role'];return db['User'][_0xfb7f('0x3c')]({'where':{'id':_0x48da63[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x426b49,null))[_0xfb7f('0x2f')](saveUpdates(_0x48da63[_0xfb7f('0x61')],null))[_0xfb7f('0x2f')](respondWithResult(_0x426b49,null))[_0xfb7f('0x5d')](handleError(_0x426b49,null));};exports[_0xfb7f('0x63')]=function(_0x3ef87a,_0x110e7f){return db[_0xfb7f('0x42')]['describe']()['then'](respondWithResult(_0x110e7f,null))[_0xfb7f('0x5d')](handleError(_0x110e7f,null));};exports[_0xfb7f('0x64')]=function(_0x13ab2e,_0x444423,_0x56da88){return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x13ab2e[_0xfb7f('0x62')]['id']}})['then'](handleEntityNotFound(_0x444423,null))[_0xfb7f('0x2f')](function(_0x157ddc){if(_0x157ddc){return _0x157ddc['addContacts'](_0x13ab2e['body'][_0xfb7f('0x65')],_['omit'](_0x13ab2e[_0xfb7f('0x61')],[_0xfb7f('0x65'),'id'])||{});}})[_0xfb7f('0x2f')](respondWithResult(_0x444423,null))[_0xfb7f('0x5d')](handleError(_0x444423,null));};function validateUser(_0x4ee148){return new BPromise(function(_0x4d13f8,_0x1891e1){if(_0x4ee148[_0xfb7f('0x66')])return _0x4d13f8(_0x4ee148);return db[_0xfb7f('0x67')][_0xfb7f('0x68')](0x1)[_0xfb7f('0x2f')](function(_0x13869f){if(_0x13869f[_0xfb7f('0x69')])authService[_0xfb7f('0x6a')](_0x4ee148[_0xfb7f('0x48')]);db[_0xfb7f('0x42')][_0xfb7f('0x6b')](_0xfb7f('0x66'))[_0xfb7f('0x2f')](function(_0x53d7e1){if(_[_0xfb7f('0x6c')](_0x53d7e1)){_0x4ee148[_0xfb7f('0x66')]=_0x13869f[_0xfb7f('0x6d')]||0x1;return;}if(_[_0xfb7f('0x6c')](_0x13869f[_0xfb7f('0x6d')])||_0x13869f[_0xfb7f('0x6d')]===_0x53d7e1){_0x4ee148[_0xfb7f('0x66')]=_0x53d7e1+0x1;return;}if(_0x13869f[_0xfb7f('0x6d')]>_0x53d7e1){_0x4ee148[_0xfb7f('0x66')]=_0x13869f['min_internal'];return;}return db['sequelize'][_0xfb7f('0x4b')](_0xfb7f('0x6e'),{'type':db[_0xfb7f('0x55')][_0xfb7f('0x6f')][_0xfb7f('0x70')]})[_0xfb7f('0x2f')](function(_0x1adfb2){if(_0x1adfb2&&_0x1adfb2['length']){for(var _0x3eb5e2=0x0,_0x25324d=_0x1adfb2[_0xfb7f('0x60')];_0x3eb5e2<_0x25324d&&_[_0xfb7f('0x6c')](_0x4ee148[_0xfb7f('0x66')]);_0x3eb5e2++){if(_0x13869f['min_internal']<=_0x1adfb2[_0x3eb5e2]['from']){_0x4ee148[_0xfb7f('0x66')]=_0x1adfb2[_0x3eb5e2][_0xfb7f('0x71')];}else if(_0x13869f[_0xfb7f('0x6d')]>_0x1adfb2[_0x3eb5e2][_0xfb7f('0x71')]&&_0x13869f[_0xfb7f('0x6d')]<=_0x1adfb2[_0x3eb5e2]['to']){_0x4ee148[_0xfb7f('0x66')]=_0x13869f[_0xfb7f('0x6d')];}}}if(_[_0xfb7f('0x6c')](_0x4ee148[_0xfb7f('0x66')])){_0x4ee148[_0xfb7f('0x66')]=_0x53d7e1+0x1;}return _0x4d13f8(_0x4ee148);});});})[_0xfb7f('0x5d')](function(_0x19f894){_0x1891e1(_0x19f894);});});}function updateUser(_0x4356da){return new BPromise(function(_0x581293,_0x956778){try{if(_0x4356da[_0xfb7f('0x72')]){_0x4356da['mailbox']=_0x4356da[_0xfb7f('0x66')];_0x4356da['VoiceMail']={'mailbox':_0x4356da['internal'],'password':_0x4356da[_0xfb7f('0x48')],'fullname':_0x4356da[_0xfb7f('0x73')],'email':_0x4356da[_0xfb7f('0x74')]};}if(_0x4356da['role']===_0xfb7f('0x36')){if(!_0x4356da[_0xfb7f('0x75')])_0x4356da[_0xfb7f('0x75')]=['101',_0xfb7f('0x76'),'103',_0xfb7f('0x77'),'110','104',_0xfb7f('0x78'),_0xfb7f('0x79'),'107',_0xfb7f('0x7a'),_0xfb7f('0x7b'),_0xfb7f('0x7c'),_0xfb7f('0x7d'),_0xfb7f('0x7e')];}_0x581293(_0x4356da);}catch(_0x301434){_0x956778(_0x301434);}});}exports[_0xfb7f('0x7f')]=function(_0x103c8a,_0x484416){if(_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x32')]===_0xfb7f('0x36'))throw new Error(_0xfb7f('0x81'));if(_0x103c8a['body'][_0xfb7f('0x32')]===_0xfb7f('0x80')&&_0x103c8a[_0xfb7f('0x80')]['role']!==_0xfb7f('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x103c8a[_0xfb7f('0x61')][_0xfb7f('0x32')]===_0xfb7f('0x33')&&_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x32')]!=='admin'){throw new Error(_0xfb7f('0x82'));}return licenseUtil[_0xfb7f('0x83')]([_0x103c8a[_0xfb7f('0x61')]])[_0xfb7f('0x2f')](function(){return validateUser(_0x103c8a['body']);})[_0xfb7f('0x2f')](function(_0x5b97f7){return updateUser(_0x5b97f7)[_0xfb7f('0x2f')](function(_0x144b0c){if(_0x144b0c[_0xfb7f('0x32')]===_0xfb7f('0x33')){_0x144b0c[_0xfb7f('0x84')]=_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x84')];delete _0x144b0c[_0xfb7f('0x85')];}return _0x144b0c;});})[_0xfb7f('0x2f')](function(_0x884d80){return db[_0xfb7f('0x42')][_0xfb7f('0x7f')](_0x884d80,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x277228){if(_0x103c8a[_0xfb7f('0x61')][_0xfb7f('0x32')]===_0xfb7f('0x80'))return _0x277228;if(_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x32')]!==_0xfb7f('0x80'))return _0x277228;return db['UserProfileSection'][_0xfb7f('0x3c')]({'where':{'name':_0x277228[_0xfb7f('0x32')]===_0xfb7f('0x36')?_0xfb7f('0x35'):_0xfb7f('0x37'),'userProfileId':_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x85')]},'raw':!![]})[_0xfb7f('0x2f')](function(_0x5090e6){if(!_0x5090e6||_0x5090e6[_0xfb7f('0x86')]!=0x0)return _0x277228;return db[_0xfb7f('0x87')][_0xfb7f('0x7f')]({'name':_0x277228[_0xfb7f('0x3d')],'resourceId':_0x277228['id'],'type':_0x5090e6[_0xfb7f('0x3d')],'sectionId':_0x5090e6['id']},{})[_0xfb7f('0x2f')](function(){return _0x277228;});})[_0xfb7f('0x5d')](function(_0x85b21a){logger[_0xfb7f('0x1f')](_0xfb7f('0x88'),_0x85b21a);throw _0x85b21a;});})[_0xfb7f('0x2f')](respondWithResult(_0x484416,0xc9))[_0xfb7f('0x5d')](handleError(_0x484416,null));};exports[_0xfb7f('0x89')]=function(_0x5a4f3d,_0x5c6ef2){var _0x3b1dc2=_0x5a4f3d['body'];var _0x298ab0=[];if(_0x5a4f3d[_0xfb7f('0x80')][_0xfb7f('0x32')]===_0xfb7f('0x36'))throw new Error('Unauthorized');if(_[_0xfb7f('0x8a')](_0x3b1dc2,[_0xfb7f('0x32'),_0xfb7f('0x80')])&&_0x5a4f3d['user'][_0xfb7f('0x32')]!=='admin'){throw new Error(_0xfb7f('0x8b'));}if(_['some'](_0x3b1dc2,['role',_0xfb7f('0x33')])&&_0x5a4f3d[_0xfb7f('0x80')][_0xfb7f('0x32')]!==_0xfb7f('0x33')){throw new Error(_0xfb7f('0x8c'));}return licenseUtil[_0xfb7f('0x83')](_0x3b1dc2)['then'](function(){return validateUser(_0x3b1dc2[0x0]);})[_0xfb7f('0x2f')](function(){for(var _0x2b6faa=0x1;_0x2b6faa<_0x3b1dc2[_0xfb7f('0x60')];_0x2b6faa++){var _0x53beec=_0x3b1dc2[_0x2b6faa-0x1][_0xfb7f('0x66')];if(!_0x3b1dc2[_0x2b6faa][_0xfb7f('0x66')])_0x3b1dc2[_0x2b6faa][_0xfb7f('0x66')]=_0x53beec+0x1;_0x298ab0['push'](validateUser(_0x3b1dc2[_0x2b6faa]));}return BPromise['all'](_0x298ab0);})['then'](function(){_0x298ab0=[];for(var _0x39d2b8=0x0;_0x39d2b8<_0x3b1dc2[_0xfb7f('0x60')];_0x39d2b8++){_0x298ab0['push'](updateUser(_0x3b1dc2[_0x39d2b8]));}return BPromise[_0xfb7f('0x8d')](_0x298ab0);})[_0xfb7f('0x2f')](function(){return BPromise[_0xfb7f('0x8e')](_0x3b1dc2,function(_0x51a259){return db[_0xfb7f('0x42')][_0xfb7f('0x7f')](_0x51a259,{'include':[{'model':db[_0xfb7f('0x8f')],'as':_0xfb7f('0x8f')}]})['then'](function(_0x946a14){_0x51a259['id']=_0x946a14['id'];return _0x51a259;});});})[_0xfb7f('0x2f')](function(_0x11e334){if(_0x5a4f3d['body'][_0xfb7f('0x32')]===_0xfb7f('0x80'))return _0x11e334;if(_0x5a4f3d[_0xfb7f('0x80')]['role']!==_0xfb7f('0x80'))return _0x11e334;var _0x2eb072=_[_0xfb7f('0x8a')](_0x11e334,function(_0x80f830){return _0x80f830[_0xfb7f('0x32')]===_0xfb7f('0x36')||_0x80f830[_0xfb7f('0x32')]===_0xfb7f('0x90');});if(!_0x2eb072)return _0x11e334;return db['UserProfileSection'][_0xfb7f('0x5b')]({'where':{'name':{'$or':[_0xfb7f('0x35'),_0xfb7f('0x37')]},'userProfileId':_0x5a4f3d[_0xfb7f('0x80')][_0xfb7f('0x85')]},'raw':!![]})['then'](function(_0x171dda){if(_[_0xfb7f('0x91')](_0x171dda)||!_[_0xfb7f('0x8a')](_0x171dda,[_0xfb7f('0x86'),0x0]))return _0x11e334;_0x298ab0=[];var _0x4c5024=_(_0x171dda)['map'](function(_0x4d4a61){if(_0x4d4a61[_0xfb7f('0x86')]===0x1)return;return _0x4d4a61[_0xfb7f('0x3d')]===_0xfb7f('0x35')?_0xfb7f('0x36'):'telephone';})[_0xfb7f('0x92')]()[_0xfb7f('0x3a')]();for(var _0x116b12=0x0;_0x116b12<_0x11e334[_0xfb7f('0x60')];_0x116b12++){if(!_[_0xfb7f('0x3b')](_0x4c5024,_0x11e334[_0x116b12][_0xfb7f('0x32')]))return;var _0x4d863c=_0x11e334[_0x116b12]['role']===_0xfb7f('0x36')?_0xfb7f('0x35'):_0xfb7f('0x37');_0x298ab0[_0xfb7f('0x93')](db[_0xfb7f('0x87')][_0xfb7f('0x7f')]({'name':_0x11e334[_0x116b12][_0xfb7f('0x3d')],'resourceId':_0x11e334[_0x116b12]['id'],'type':_0x4d863c,'sectionId':_['find'](_0x171dda,[_0xfb7f('0x3d'),_0x4d863c])['id']},{}));}return BPromise[_0xfb7f('0x8d')](_0x298ab0);})[_0xfb7f('0x2f')](respondWithResult(_0x5c6ef2,0xc9))[_0xfb7f('0x5d')](handleError(_0x5c6ef2,null));});};exports[_0xfb7f('0x94')]=function(_0x212cce,_0x4d8697,_0x449e73){if(_0x212cce[_0xfb7f('0x61')]['id']){delete _0x212cce['body']['id'];}return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x212cce[_0xfb7f('0x62')]['id']}})['then'](function(_0x24defa){if(!_0x24defa)return null;if(_0x24defa['id']===_0x212cce[_0xfb7f('0x80')]['id']){if(!_0x212cce['body']['oldPassword']||!_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x95')]){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x98'));}if(!_0x24defa['authenticate'](_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x99')])){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x9a'));}if(_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x99')]===_0x212cce[_0xfb7f('0x61')]['newPassword']){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x9b'));}}else if(_0x212cce[_0xfb7f('0x80')][_0xfb7f('0x32')]===_0xfb7f('0x33')){if(!_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x95')]){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x9c'));}}else if(_0x212cce['user']['role']===_0xfb7f('0x80')){if(!_0x212cce[_0xfb7f('0x61')]['newPassword']){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x24defa[_0xfb7f('0x32')]!==_0xfb7f('0x36')){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x81'));}}else{throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x81'));}return _0x24defa;})[_0xfb7f('0x2f')](handleEntityNotFound(_0x4d8697,null))[_0xfb7f('0x2f')](function(_0x5bd855){return db['Setting']['findOne']({'attributes':['id',_0xfb7f('0x69'),'enforcePasswordHistory',_0xfb7f('0x9d')]})['then'](function(_0x24dd85){if(_0x24dd85[_0xfb7f('0x69')])authService[_0xfb7f('0x6a')](_0x212cce[_0xfb7f('0x61')]['newPassword']);if(!_0x24dd85['enforcePasswordHistory']||!_0x5bd855[_0xfb7f('0x9e')])return _0x5bd855;authService['validatePasswordHistory'](_0x212cce['body']['newPassword'],_0x5bd855['previousPasswords'],_0x24dd85[_0xfb7f('0x9d')]);return _0x5bd855;})[_0xfb7f('0x2f')](saveUpdates({'password':_0x212cce['body']['newPassword'],'passwordResetAt':_0x212cce[_0xfb7f('0x80')]['id']==_0x212cce[_0xfb7f('0x62')]['id']?moment():null,'previousPasswords':authService[_0xfb7f('0x9f')](_0x212cce[_0xfb7f('0x61')]['newPassword'],_0x5bd855['previousPasswords'])},null));})[_0xfb7f('0x2f')](respondWithResult(_0x4d8697,null))[_0xfb7f('0x5d')](handleError(_0x4d8697,null));};exports['addQueues']=function(_0x4fac4a,_0x4ee434,_0x121f2f){var _0x2ba431=_0x4fac4a[_0xfb7f('0x61')][_0xfb7f('0xa0')];return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x4fac4a[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),'role','online',_0xfb7f('0xa1'),'voicePause',_0xfb7f('0xa2')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x4ee434,null))[_0xfb7f('0x2f')](function(_0x5c94d9){if(_0x5c94d9){if(!utils[_0xfb7f('0xa3')](_0x2ba431)){throw new db[(_0xfb7f('0x96'))]['ValidationError'](_0xfb7f('0xa4'));}return _0x5c94d9[_0xfb7f('0xa5')+_['capitalize'](_0x2ba431[_0xfb7f('0xa6')]())+_0xfb7f('0xa7')](_0x4fac4a['body'][_0xfb7f('0x65')],{'penalty':_0x4fac4a[_0xfb7f('0x61')]['penalty']||0x0})[_0xfb7f('0xa8')](function(_0x51bc7c){for(var _0x37af7e=0x0;_0x37af7e<_0x4fac4a['body'][_0xfb7f('0x65')]['length'];_0x37af7e+=0x1){var _0x2005a3={'UserId':_0x4fac4a[_0xfb7f('0x62')]['id']};_0x2005a3[_['capitalize'](_0x2ba431[_0xfb7f('0xa6')]())+_0xfb7f('0xa9')]=_0x4fac4a['body'][_0xfb7f('0x65')][_0x37af7e];socket[_0xfb7f('0xaa')](_0xfb7f('0x80')+_['capitalize'](_0x2ba431[_0xfb7f('0xa6')]())+_0xfb7f('0xab'),_0x2005a3);}return _0x51bc7c;})[_0xfb7f('0x2f')](function(){if(_0x2ba431===_0xfb7f('0xac')){return db['VoiceQueue'][_0xfb7f('0x5b')]({'where':{'id':_0x4fac4a[_0xfb7f('0x61')][_0xfb7f('0x65')]||[]},'raw':!![],'attributes':['id',_0xfb7f('0x3d')]});}})['then'](function(_0x2099b1){var _0xd9191=_0x5c94d9[_0xfb7f('0x31')]({'plain':!![]});var _0x477bba=[];if(_0x2ba431===_0xfb7f('0xac')&&_0xd9191[_0xfb7f('0x32')]==='agent'&&_0xd9191[_0xfb7f('0xad')]){for(var _0x2f8bfd=0x0;_0x2f8bfd<_0x2099b1[_0xfb7f('0x60')];_0x2f8bfd+=0x1){_0x477bba[_0xfb7f('0x93')]({'membername':_0xd9191[_0xfb7f('0x3d')],'UserId':_0xd9191['id'],'queue_name':_0x2099b1[_0x2f8bfd][_0xfb7f('0x3d')],'VoiceQueueId':_0x2099b1[_0x2f8bfd]['id'],'interface':_[_0xfb7f('0x6c')](_0xd9191[_0xfb7f('0xa2')])?util['format'](_0xfb7f('0xae'),_0xd9191['name']):_0xd9191[_0xfb7f('0xa2')],'paused':_0xd9191[_0xfb7f('0xaf')]||![],'penalty':_0x4fac4a[_0xfb7f('0x61')][_0xfb7f('0xb0')]||0x0});}return BPromise[_0xfb7f('0x8e')](_0x477bba,function(_0x179bb3){return db['UserVoiceQueueRt'][_0xfb7f('0xb1')](_0x179bb3);});}return _0x5c94d9;});}})[_0xfb7f('0x2f')](respondWithStatusCode(_0x4ee434,null))['catch'](handleError(_0x4ee434,null));};exports[_0xfb7f('0xb2')]=function(_0x526370,_0x205af4,_0x3e63bd){var _0xcd06ab;return db[_0xfb7f('0x42')]['find']({'where':{'id':_0x526370[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x205af4,null))['then'](function(_0x1c4470){if(_0x1c4470){_0xcd06ab=_0x1c4470;if(!_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]||!utils[_0xfb7f('0xa3')](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')])){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0xa4'));}return _0x1c4470[_0xfb7f('0xb3')+_['capitalize'](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]['toLowerCase']())+_0xfb7f('0xa7')](_0x526370['query']['ids']);}})[_0xfb7f('0x2f')](function(_0x235680){for(var _0x1c9b16=0x0;_0x1c9b16<_0x526370['query']['ids'][_0xfb7f('0x60')];_0x1c9b16+=0x1){var _0x20fe0f={'UserId':_0x526370[_0xfb7f('0x62')]['id']};_0x20fe0f[_[_0xfb7f('0xb4')](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]['toLowerCase']())+'QueueId']=_0x526370[_0xfb7f('0x4b')][_0xfb7f('0x65')][_0x1c9b16];socket['emit'](_0xfb7f('0x80')+_['capitalize'](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')][_0xfb7f('0xa6')]())+'Queue:remove',_0x20fe0f);}return _0x235680;})[_0xfb7f('0x2f')](function(){if(_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]===_0xfb7f('0xac')){return db['UserVoiceQueueRt'][_0xfb7f('0x30')]({'where':{'UserId':_0x526370[_0xfb7f('0x62')]['id'],'VoiceQueueId':_0x526370[_0xfb7f('0x4b')][_0xfb7f('0x65')]},'individualHooks':!![]})[_0xfb7f('0x2f')](function(){return _0xcd06ab;});}return _0xcd06ab;})[_0xfb7f('0x2f')](respondWithStatusCode(_0x205af4,null))[_0xfb7f('0x5d')](handleError(_0x205af4,null));};exports[_0xfb7f('0xb5')]=function(_0x100553,_0x4a6be6,_0x52894c){_0x100553[_0xfb7f('0x61')][_0xfb7f('0xb6')]=_0x100553['file'][_0xfb7f('0xb7')];return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x100553[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x4a6be6,null))[_0xfb7f('0x2f')](saveUpdates(_0x100553[_0xfb7f('0x61')],null))['then'](respondWithResult(_0x4a6be6,null))[_0xfb7f('0x5d')](handleError(_0x4a6be6,null));};exports[_0xfb7f('0xb8')]=function(_0x9819f9,_0x348d15,_0x53e599){var _0x2c4805=path[_0xfb7f('0xb9')](config[_0xfb7f('0xba')],_0xfb7f('0xbb'));return db[_0xfb7f('0x42')]['find']({'where':{'id':_0x9819f9[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x348d15,null))[_0xfb7f('0x2f')](function(_0x27f94f){if(_0x27f94f){if(_[_0xfb7f('0x6c')](_0x27f94f['userpic'])){return _0x348d15[_0xfb7f('0xbc')](_0x2c4805);}else{if(!fs[_0xfb7f('0xbd')](path[_0xfb7f('0xb9')](config[_0xfb7f('0xba')],_0xfb7f('0xbe'),_0x27f94f[_0xfb7f('0xb6')]))){return _0x348d15[_0xfb7f('0xbc')](_0x2c4805);}return _0x348d15[_0xfb7f('0xbc')](path[_0xfb7f('0xb9')](config[_0xfb7f('0xba')],_0xfb7f('0xbe'),_0x27f94f[_0xfb7f('0xb6')]));}}})[_0xfb7f('0x5d')](handleError(_0x348d15,null));};exports[_0xfb7f('0xbf')]=function(_0x1ed713,_0x2d89e4,_0x3ebf3a){var _0x574a98={};var _0x5a8f25={};var _0x373cdb;var _0x1f0955;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x1ed713['params']['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2d89e4,null))['then'](function(_0x4d5b58){if(_0x4d5b58){_0x373cdb=_0x4d5b58;_0x5a8f25[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xc0')][_0xfb7f('0xc1')]);_0x5a8f25['query']=_[_0xfb7f('0x49')](_0x1ed713['query']);_0x5a8f25['filters']=_[_0xfb7f('0x4a')](_0x5a8f25[_0xfb7f('0x46')],_0x5a8f25[_0xfb7f('0x4b')]);_0x574a98[_0xfb7f('0x4c')]=_['intersection'](_0x5a8f25[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1ed713[_0xfb7f('0x4b')]['fields']));_0x574a98[_0xfb7f('0x4c')]=_0x574a98[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x574a98[_0xfb7f('0x4c')]:_0x5a8f25[_0xfb7f('0x46')];_0x574a98['order']=qs[_0xfb7f('0xc2')](_0x1ed713[_0xfb7f('0x4b')]['sort']);_0x574a98[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x1ed713[_0xfb7f('0x4b')],_0x5a8f25[_0xfb7f('0x51')]));if(_0x1ed713['query']['filter']){_0x574a98[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x574a98[_0xfb7f('0x53')],{'$or':_['map'](_0x574a98['attributes'],function(_0x56991c){var _0x3582ec={};_0x3582ec[_0x56991c]={'$like':'%'+_0x1ed713[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x3582ec;})});}_0x574a98=_[_0xfb7f('0x54')]({},_0x574a98,_0x1ed713[_0xfb7f('0x58')]);return _0x373cdb['getContacts'](_0x574a98);}})['then'](function(_0x2e8b2e){if(_0x2e8b2e){_0x1f0955=_0x2e8b2e[_0xfb7f('0x60')];if(_0x1ed713['query'][_0xfb7f('0x4e')](_0xfb7f('0x59'))){_0x574a98[_0xfb7f('0x5a')]=[{'model':db[_0xfb7f('0xc3')],'as':_0xfb7f('0xc4'),'required':![]},{'model':db[_0xfb7f('0xc5')],'as':_0xfb7f('0xc6'),'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0xc7')],'where':_0x1ed713['query'][_0xfb7f('0xc8')]?{'id':_0x1ed713[_0xfb7f('0x4b')]['tag']}:undefined,'required':_0x1ed713[_0xfb7f('0x4b')][_0xfb7f('0xc8')]?!![]:![]}];}if(!_0x1ed713[_0xfb7f('0x4b')]['hasOwnProperty']('nolimit')){_0x574a98['limit']=qs[_0xfb7f('0x28')](_0x1ed713['query'][_0xfb7f('0x28')]);_0x574a98[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1ed713[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x373cdb['getContacts'](_0x574a98);}})['then'](function(_0x12b84d){if(_0x12b84d){return _0x12b84d?{'count':_0x1f0955,'rows':_0x12b84d}:null;}})['then'](respondWithResult(_0x2d89e4,null))[_0xfb7f('0x5d')](handleError(_0x2d89e4,null));};exports['getQueues']=function(_0x3e2bd9,_0x3a68f7,_0x3b2ab3){var _0x41ce95;var _0x18c59c;var _0x57e12c={};var _0xb8b504;return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x3e2bd9[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),'role']})['then'](handleEntityNotFound(_0x3a68f7,null))[_0xfb7f('0x2f')](function(_0x12a82c){if(!utils['isValidChannel'](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])){throw new db[(_0xfb7f('0x96'))]['ValidationError'](_0xfb7f('0xa4'));}_0x41ce95=_0x12a82c;var _0x41b47a={};_0x41b47a[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])+'Queue'][_0xfb7f('0xc1')]);_0x41b47a['query']=_[_0xfb7f('0x49')](_0x3e2bd9[_0xfb7f('0x4b')]);_0x41b47a[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x41b47a[_0xfb7f('0x46')],_0x41b47a[_0xfb7f('0x4b')]);_0x57e12c[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x41b47a['model'],qs[_0xfb7f('0x4d')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x57e12c[_0xfb7f('0x4c')]=_0x57e12c[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x57e12c[_0xfb7f('0x4c')]:_0x41b47a[_0xfb7f('0x46')];_0x57e12c[_0xfb7f('0x50')]=qs['sort'](_0x3e2bd9['query'][_0xfb7f('0xc2')]);_0x57e12c[_0xfb7f('0x53')]=qs['filters'](_[_0xfb7f('0x52')](_0x3e2bd9[_0xfb7f('0x4b')],_0x41b47a[_0xfb7f('0x51')]));if(_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x57e12c['where']=_[_0xfb7f('0x54')](_0x57e12c[_0xfb7f('0x53')],{'$or':_['map'](_0x57e12c[_0xfb7f('0x4c')],function(_0x2c875e){var _0x421b2c={};_0x421b2c[_0x2c875e]={'$like':'%'+_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x421b2c;})});}_0x57e12c=_[_0xfb7f('0x54')]({},_0x57e12c,_0x3e2bd9['options']);switch(_0x41ce95[_0xfb7f('0x32')]){case _0xfb7f('0x33'):return db[_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])+_0xfb7f('0xca')]['findAll'](_0x57e12c);case _0xfb7f('0x80'):case'agent':return _0x41ce95[_0xfb7f('0x31')+_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])+_0xfb7f('0xa7')](_0x57e12c);default:throw new db['Sequelize'][(_0xfb7f('0x97'))]('Unknown\x20role');}})['then'](function(_0x517edf){_0xb8b504=_0x517edf[_0xfb7f('0x60')];if(!_0x3e2bd9[_0xfb7f('0x4b')]['hasOwnProperty']('nolimit')){_0x57e12c[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x57e12c[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x3e2bd9[_0xfb7f('0x4b')]['offset']);}switch(_0x41ce95[_0xfb7f('0x32')]){case _0xfb7f('0x33'):return db[_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')]['channel'])+'Queue'][_0xfb7f('0x5b')](_0x57e12c);case'user':case'agent':return _0x41ce95[_0xfb7f('0x31')+_[_0xfb7f('0xb4')](_0x3e2bd9['query'][_0xfb7f('0xa0')])+_0xfb7f('0xa7')](_0x57e12c);}})['then'](function(_0x1ac4a1){return{'count':_0xb8b504,'rows':_0x1ac4a1};})[_0xfb7f('0x2f')](respondWithResult(_0x3a68f7,null))[_0xfb7f('0x5d')](handleError(_0x3a68f7,null));};exports[_0xfb7f('0xcb')]=function(_0x452902,_0x2f614d,_0x3cbc36){var _0x18d3b0={};var _0x1a3dcb={};var _0x5172f1;var _0x1a68eb;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x452902[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2f614d,null))['then'](function(_0x48ddbb){if(_0x48ddbb){_0x5172f1=_0x48ddbb;_0x1a3dcb[_0xfb7f('0x46')]=_['keys'](db[_0xfb7f('0xcc')]['rawAttributes']);_0x1a3dcb[_0xfb7f('0x4b')]=_['keys'](_0x452902[_0xfb7f('0x4b')]);_0x1a3dcb[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x1a3dcb['model'],_0x1a3dcb[_0xfb7f('0x4b')]);_0x18d3b0[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x1a3dcb[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x452902[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x18d3b0['attributes']=_0x18d3b0['attributes'][_0xfb7f('0x60')]?_0x18d3b0[_0xfb7f('0x4c')]:_0x1a3dcb[_0xfb7f('0x46')];_0x18d3b0[_0xfb7f('0x50')]=qs['sort'](_0x452902[_0xfb7f('0x4b')]['sort']);_0x18d3b0[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x452902[_0xfb7f('0x4b')],_0x1a3dcb[_0xfb7f('0x51')]));if(_0x452902['query'][_0xfb7f('0x38')]){_0x18d3b0[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x18d3b0[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x18d3b0[_0xfb7f('0x4c')],function(_0x172888){var _0x1c13cd={};_0x1c13cd[_0x172888]={'$like':'%'+_0x452902[_0xfb7f('0x4b')]['filter']+'%'};return _0x1c13cd;})});}_0x18d3b0=_[_0xfb7f('0x54')]({},_0x18d3b0,_0x452902[_0xfb7f('0x58')]);return _0x5172f1[_0xfb7f('0xcb')](_0x18d3b0);}})[_0xfb7f('0x2f')](function(_0x4de275){if(_0x4de275){_0x1a68eb=_0x4de275[_0xfb7f('0x60')];if(!_0x452902['query'][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x18d3b0['limit']=qs[_0xfb7f('0x28')](_0x452902[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x18d3b0['offset']=qs[_0xfb7f('0x27')](_0x452902[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x5172f1['getVoiceQueuesRt'](_0x18d3b0);}})['then'](function(_0x23bd04){if(_0x23bd04){return _0x23bd04?{'count':_0x1a68eb,'rows':_0x23bd04}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x2f614d,null))['catch'](handleError(_0x2f614d,null));};exports[_0xfb7f('0xcd')]=function(_0x3d14c4,_0x2bfd95,_0x46da3d){var _0x557cb0={};var _0x1fff93={};var _0x1eff17;var _0x3fc390;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x3d14c4['params']['id']}})['then'](handleEntityNotFound(_0x2bfd95,null))[_0xfb7f('0x2f')](function(_0x23356b){if(_0x23356b){_0x1eff17=_0x23356b;_0x1fff93[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xce')]['rawAttributes']);_0x1fff93['query']=_[_0xfb7f('0x49')](_0x3d14c4[_0xfb7f('0x4b')]);_0x1fff93[_0xfb7f('0x51')]=_['intersection'](_0x1fff93['model'],_0x1fff93['query']);_0x557cb0[_0xfb7f('0x4c')]=_['intersection'](_0x1fff93[_0xfb7f('0x46')],qs['fields'](_0x3d14c4['query'][_0xfb7f('0x4d')]));_0x557cb0['attributes']=_0x557cb0[_0xfb7f('0x4c')]['length']?_0x557cb0[_0xfb7f('0x4c')]:_0x1fff93[_0xfb7f('0x46')];_0x557cb0[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x557cb0[_0xfb7f('0x53')]=qs['filters'](_['pick'](_0x3d14c4[_0xfb7f('0x4b')],_0x1fff93[_0xfb7f('0x51')]));if(_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x557cb0[_0xfb7f('0x53')]=_['merge'](_0x557cb0[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x557cb0[_0xfb7f('0x4c')],function(_0x336980){var _0x1e30a2={};_0x1e30a2[_0x336980]={'$like':'%'+_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x1e30a2;})});}_0x557cb0=_['merge']({},_0x557cb0,_0x3d14c4['options']);return _0x1eff17['getGroups'](_0x557cb0);}})[_0xfb7f('0x2f')](function(_0x4ea526){if(_0x4ea526){_0x3fc390=_0x4ea526[_0xfb7f('0x60')];if(!_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0x4e')]('nolimit')){_0x557cb0[_0xfb7f('0x28')]=qs['limit'](_0x3d14c4['query'][_0xfb7f('0x28')]);_0x557cb0[_0xfb7f('0x27')]=qs['offset'](_0x3d14c4['query'][_0xfb7f('0x27')]);}return _0x1eff17[_0xfb7f('0xcd')](_0x557cb0);}})[_0xfb7f('0x2f')](function(_0x5537a7){if(_0x5537a7){return _0x5537a7?{'count':_0x3fc390,'rows':_0x5537a7}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x2bfd95,null))[_0xfb7f('0x5d')](handleError(_0x2bfd95,null));};exports[_0xfb7f('0xcf')]=function(_0x17cf63,_0x2d16a0,_0x494b56){var _0x5ac319={'raw':!![],'where':{}};var _0x1ef785={};var _0x5ec5c={'count':0x0,'rows':[]};return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x17cf63[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2d16a0,null))[_0xfb7f('0x2f')](function(_0xed876b){if(_0xed876b){_0x1ef785[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xd0')][_0xfb7f('0xc1')]);_0x1ef785['query']=_['keys'](_0x17cf63[_0xfb7f('0x4b')]);_0x1ef785[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x1ef785[_0xfb7f('0x46')],_0x1ef785['query']);_0x5ac319[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x1ef785[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x5ac319[_0xfb7f('0x4c')]=_0x5ac319[_0xfb7f('0x4c')]['length']?_0x5ac319['attributes']:_0x1ef785[_0xfb7f('0x46')];if(!_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x4e')]('nolimit')){_0x5ac319['limit']=qs['limit'](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x5ac319[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}_0x5ac319[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x5ac319[_0xfb7f('0x53')]=qs['filters'](_['pick'](_0x17cf63[_0xfb7f('0x4b')],_0x1ef785[_0xfb7f('0x51')]));_0x5ac319[_0xfb7f('0x53')][_0xfb7f('0xd1')]=_0xed876b['id'];if(_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x5ac319[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x5ac319['where'],{'$or':_[_0xfb7f('0x41')](_0x5ac319['attributes'],function(_0x57f536){var _0x85cc76={};_0x85cc76[_0x57f536]={'$like':'%'+_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x85cc76;})});}_0x5ac319=_[_0xfb7f('0x54')]({},_0x5ac319,_0x17cf63[_0xfb7f('0x58')]);return db[_0xfb7f('0xd0')][_0xfb7f('0x26')]({'where':_0x5ac319[_0xfb7f('0x53')]})[_0xfb7f('0x2f')](function(_0x2a2b2f){_0x5ec5c['count']=_0x2a2b2f;if(_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x59')]){_0x5ac319[_0xfb7f('0x5a')]=[{'all':!![]}];}return db[_0xfb7f('0xd0')]['findAll'](_0x5ac319);})[_0xfb7f('0x2f')](function(_0x16d013){_0x5ec5c[_0xfb7f('0x5c')]=_0x16d013;return _0x5ec5c;});}})['then'](respondWithFilteredResult(_0x2d16a0,_0x5ac319))[_0xfb7f('0x5d')](handleError(_0x2d16a0,null));};exports[_0xfb7f('0xd2')]=function(_0x16a508,_0x37f630,_0x2742eb){var _0x27c717={'raw':!![],'where':{}};var _0x191ab2={};var _0x183b1a={'count':0x0,'rows':[]};return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x16a508[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x37f630,null))[_0xfb7f('0x2f')](function(_0xaa80d7){if(_0xaa80d7){_0x191ab2['model']=_['keys'](db[_0xfb7f('0xd3')]['rawAttributes']);_0x191ab2['query']=_[_0xfb7f('0x49')](_0x16a508[_0xfb7f('0x4b')]);_0x191ab2[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x191ab2['model'],_0x191ab2['query']);_0x27c717['attributes']=_[_0xfb7f('0x4a')](_0x191ab2[_0xfb7f('0x46')],qs['fields'](_0x16a508[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x27c717[_0xfb7f('0x4c')]=_0x27c717[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x27c717[_0xfb7f('0x4c')]:_0x191ab2['model'];if(!_0x16a508['query'][_0xfb7f('0x4e')]('nolimit')){_0x27c717[_0xfb7f('0x28')]=qs['limit'](_0x16a508[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x27c717[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x16a508['query'][_0xfb7f('0x27')]);}_0x27c717['order']=qs[_0xfb7f('0xc2')](_0x16a508[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x27c717[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x16a508[_0xfb7f('0x4b')],_0x191ab2[_0xfb7f('0x51')]));_0x27c717[_0xfb7f('0x53')][_0xfb7f('0xd1')]=_0xaa80d7['id'];if(_0x16a508['query'][_0xfb7f('0x38')]){_0x27c717[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x27c717[_0xfb7f('0x53')],{'$or':_['map'](_0x27c717[_0xfb7f('0x4c')],function(_0x20a2d9){var _0x2abfcf={};_0x2abfcf[_0x20a2d9]={'$like':'%'+_0x16a508[_0xfb7f('0x4b')]['filter']+'%'};return _0x2abfcf;})});}_0x27c717=_[_0xfb7f('0x54')]({},_0x27c717,_0x16a508[_0xfb7f('0x58')]);return db[_0xfb7f('0xd3')]['count']({'where':_0x27c717['where']})[_0xfb7f('0x2f')](function(_0x4279af){_0x183b1a[_0xfb7f('0x26')]=_0x4279af;if(_0x16a508['query'][_0xfb7f('0x59')]){_0x27c717['include']=[{'all':!![]}];}return db[_0xfb7f('0xd3')][_0xfb7f('0x5b')](_0x27c717);})[_0xfb7f('0x2f')](function(_0x4aa602){_0x183b1a['rows']=_0x4aa602;return _0x183b1a;});}})[_0xfb7f('0x2f')](respondWithFilteredResult(_0x37f630,_0x27c717))[_0xfb7f('0x5d')](handleError(_0x37f630,null));};exports[_0xfb7f('0xd4')]=function(_0x1a5c5d,_0x1770f4,_0x25ec5a){var _0x345b0c={};var _0x3ea735={};var _0x14ff8a;var _0x21723b;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x1a5c5d['params']['id']}})['then'](handleEntityNotFound(_0x1770f4,null))[_0xfb7f('0x2f')](function(_0xd42b00){if(_0xd42b00){_0x14ff8a=_0xd42b00;_0x3ea735[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db['ChatInteraction'][_0xfb7f('0xc1')]);_0x3ea735[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1a5c5d['query']);_0x3ea735[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x3ea735['model'],_0x3ea735['query']);_0x345b0c[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x3ea735[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x345b0c[_0xfb7f('0x4c')]=_0x345b0c[_0xfb7f('0x4c')]['length']?_0x345b0c[_0xfb7f('0x4c')]:_0x3ea735[_0xfb7f('0x46')];_0x345b0c[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x345b0c['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x1a5c5d['query'],_0x3ea735[_0xfb7f('0x51')]));if(_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x345b0c[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x345b0c[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x345b0c['attributes'],function(_0x269255){var _0x4e7b5e={};_0x4e7b5e[_0x269255]={'$like':'%'+_0x1a5c5d[_0xfb7f('0x4b')]['filter']+'%'};return _0x4e7b5e;})});}_0x345b0c=_[_0xfb7f('0x54')]({},_0x345b0c,_0x1a5c5d[_0xfb7f('0x58')]);return _0x14ff8a[_0xfb7f('0xd4')](_0x345b0c);}})[_0xfb7f('0x2f')](function(_0x5e90c0){if(_0x5e90c0){_0x21723b=_0x5e90c0[_0xfb7f('0x60')];if(!_0x1a5c5d['query']['hasOwnProperty'](_0xfb7f('0x4f'))){_0x345b0c[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x345b0c[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1a5c5d['query']['offset']);}return _0x14ff8a['getChatInteractions'](_0x345b0c);}})['then'](function(_0x41aaf7){if(_0x41aaf7){return _0x41aaf7?{'count':_0x21723b,'rows':_0x41aaf7}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x1770f4,null))['catch'](handleError(_0x1770f4,null));};exports[_0xfb7f('0xd5')]=function(_0x33ca6a,_0x2d6f77,_0x5e90ed){var _0x2ead82={};var _0x36486d={};var _0x3084ab;var _0x3131e2;return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x33ca6a[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2d6f77,null))[_0xfb7f('0x2f')](function(_0x144d3d){if(_0x144d3d){_0x3084ab=_0x144d3d;_0x36486d[_0xfb7f('0x46')]=_['keys'](db[_0xfb7f('0xd6')][_0xfb7f('0xc1')]);_0x36486d[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x33ca6a[_0xfb7f('0x4b')]);_0x36486d[_0xfb7f('0x51')]=_['intersection'](_0x36486d[_0xfb7f('0x46')],_0x36486d[_0xfb7f('0x4b')]);_0x2ead82[_0xfb7f('0x4c')]=_['intersection'](_0x36486d['model'],qs['fields'](_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x2ead82[_0xfb7f('0x4c')]=_0x2ead82[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x2ead82[_0xfb7f('0x4c')]:_0x36486d[_0xfb7f('0x46')];_0x2ead82[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x33ca6a[_0xfb7f('0x4b')]['sort']);_0x2ead82[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_['pick'](_0x33ca6a[_0xfb7f('0x4b')],_0x36486d['filters']));if(_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x2ead82[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x2ead82[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x2ead82['attributes'],function(_0x22b5f6){var _0x39a952={};_0x39a952[_0x22b5f6]={'$like':'%'+_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x39a952;})});}_0x2ead82=_['merge']({},_0x2ead82,_0x33ca6a[_0xfb7f('0x58')]);return _0x3084ab[_0xfb7f('0xd5')](_0x2ead82);}})['then'](function(_0x5d4f8a){if(_0x5d4f8a){_0x3131e2=_0x5d4f8a[_0xfb7f('0x60')];if(!_0x33ca6a[_0xfb7f('0x4b')]['hasOwnProperty'](_0xfb7f('0x4f'))){_0x2ead82[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x2ead82[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x33ca6a['query']['offset']);}return _0x3084ab[_0xfb7f('0xd5')](_0x2ead82);}})[_0xfb7f('0x2f')](function(_0x1881bf){if(_0x1881bf){return _0x1881bf?{'count':_0x3131e2,'rows':_0x1881bf}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x2d6f77,null))['catch'](handleError(_0x2d6f77,null));};exports['getMailInteractions']=function(_0x17238b,_0x378bc6,_0x23e8b0){var _0x3b2922={'raw':!![],'where':{}};var _0x4b81ae={};var _0x14dfc6={'count':0x0,'rows':[]};return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x17238b[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x378bc6,null))[_0xfb7f('0x2f')](function(_0x47d9b0){if(_0x47d9b0){_0x4b81ae[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xd7')][_0xfb7f('0xc1')]);_0x4b81ae[_0xfb7f('0x4b')]=_['keys'](_0x17238b['query']);_0x4b81ae[_0xfb7f('0x51')]=_['intersection'](_0x4b81ae[_0xfb7f('0x46')],_0x4b81ae[_0xfb7f('0x4b')]);_0x3b2922[_0xfb7f('0x4c')]=_['intersection'](_0x4b81ae[_0xfb7f('0x46')],qs['fields'](_0x17238b[_0xfb7f('0x4b')]['fields']));_0x3b2922[_0xfb7f('0x4c')]=_0x3b2922[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x3b2922[_0xfb7f('0x4c')]:_0x4b81ae[_0xfb7f('0x46')];if(!_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x3b2922[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x3b2922[_0xfb7f('0x27')]=qs['offset'](_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}_0x3b2922['order']=qs['sort'](_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x3b2922['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x17238b[_0xfb7f('0x4b')],_0x4b81ae['filters']));_0x3b2922[_0xfb7f('0x53')][_0xfb7f('0xd1')]=_0x47d9b0['id'];if(_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x3b2922[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x3b2922[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x3b2922[_0xfb7f('0x4c')],function(_0x560c6d){var _0x28857e={};_0x28857e[_0x560c6d]={'$like':'%'+_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x28857e;})});}_0x3b2922=_[_0xfb7f('0x54')]({},_0x3b2922,_0x17238b[_0xfb7f('0x58')]);return db[_0xfb7f('0xd7')][_0xfb7f('0x26')]({'where':_0x3b2922[_0xfb7f('0x53')]})['then'](function(_0x4601ea){_0x14dfc6[_0xfb7f('0x26')]=_0x4601ea;if(_0x17238b['query']['includeAll']){_0x3b2922[_0xfb7f('0x5a')]=[{'all':!![]}];}return db['MailInteraction'][_0xfb7f('0x5b')](_0x3b2922);})[_0xfb7f('0x2f')](function(_0x2094ba){_0x14dfc6[_0xfb7f('0x5c')]=_0x2094ba;return _0x14dfc6;});}})[_0xfb7f('0x2f')](respondWithFilteredResult(_0x378bc6,_0x3b2922))[_0xfb7f('0x5d')](handleError(_0x378bc6,null));};exports[_0xfb7f('0xd8')]=function(_0x425b0b,_0x454258,_0x1cf4a1){var _0x72681f={};var _0x55db27={};var _0x2d68ca;var _0x309efb;return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x425b0b[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x454258,null))[_0xfb7f('0x2f')](function(_0x3c96a8){if(_0x3c96a8){_0x2d68ca=_0x3c96a8;_0x55db27[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xd9')]['rawAttributes']);_0x55db27[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x425b0b['query']);_0x55db27[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x55db27[_0xfb7f('0x46')],_0x55db27[_0xfb7f('0x4b')]);_0x72681f['attributes']=_[_0xfb7f('0x4a')](_0x55db27[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x425b0b[_0xfb7f('0x4b')]['fields']));_0x72681f[_0xfb7f('0x4c')]=_0x72681f['attributes']['length']?_0x72681f[_0xfb7f('0x4c')]:_0x55db27[_0xfb7f('0x46')];_0x72681f['order']=qs[_0xfb7f('0xc2')](_0x425b0b[_0xfb7f('0x4b')]['sort']);_0x72681f[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x425b0b['query'],_0x55db27['filters']));if(_0x425b0b['query'][_0xfb7f('0x38')]){_0x72681f[_0xfb7f('0x53')]=_['merge'](_0x72681f[_0xfb7f('0x53')],{'$or':_['map'](_0x72681f[_0xfb7f('0x4c')],function(_0x1f6786){var _0x46df7a={};_0x46df7a[_0x1f6786]={'$like':'%'+_0x425b0b[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x46df7a;})});}_0x72681f=_['merge']({},_0x72681f,_0x425b0b[_0xfb7f('0x58')]);return _0x2d68ca[_0xfb7f('0xd8')](_0x72681f);}})['then'](function(_0xca6abb){if(_0xca6abb){_0x309efb=_0xca6abb['length'];if(!_0x425b0b[_0xfb7f('0x4b')]['hasOwnProperty'](_0xfb7f('0x4f'))){_0x72681f['limit']=qs[_0xfb7f('0x28')](_0x425b0b['query'][_0xfb7f('0x28')]);_0x72681f[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x425b0b[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x2d68ca['getSmsInteractions'](_0x72681f);}})['then'](function(_0xfa033d){if(_0xfa033d){return _0xfa033d?{'count':_0x309efb,'rows':_0xfa033d}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x454258,null))[_0xfb7f('0x5d')](handleError(_0x454258,null));};exports[_0xfb7f('0xda')]=function(_0x2a054a,_0x109f0d,_0x197292){var _0xa4cf8a={};var _0xef5b3d={};var _0x3ecb10;var _0x5494d7;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x2a054a[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x109f0d,null))[_0xfb7f('0x2f')](function(_0x681ff5){if(_0x681ff5){_0x3ecb10=_0x681ff5;_0xef5b3d[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xdb')][_0xfb7f('0xc1')]);_0xef5b3d['query']=_[_0xfb7f('0x49')](_0x2a054a['query']);_0xef5b3d['filters']=_[_0xfb7f('0x4a')](_0xef5b3d[_0xfb7f('0x46')],_0xef5b3d['query']);_0xa4cf8a['attributes']=_[_0xfb7f('0x4a')](_0xef5b3d[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x2a054a[_0xfb7f('0x4b')]['fields']));_0xa4cf8a[_0xfb7f('0x4c')]=_0xa4cf8a[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0xa4cf8a[_0xfb7f('0x4c')]:_0xef5b3d['model'];_0xa4cf8a[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x2a054a[_0xfb7f('0x4b')]['sort']);_0xa4cf8a['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x2a054a[_0xfb7f('0x4b')],_0xef5b3d[_0xfb7f('0x51')]));if(_0x2a054a[_0xfb7f('0x4b')]['filter']){_0xa4cf8a[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0xa4cf8a[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0xa4cf8a[_0xfb7f('0x4c')],function(_0x57f7f3){var _0x49e7cb={};_0x49e7cb[_0x57f7f3]={'$like':'%'+_0x2a054a[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x49e7cb;})});}_0xa4cf8a=_[_0xfb7f('0x54')]({},_0xa4cf8a,_0x2a054a['options']);return _0x3ecb10['getFaxInteractions'](_0xa4cf8a);}})['then'](function(_0x94d722){if(_0x94d722){_0x5494d7=_0x94d722[_0xfb7f('0x60')];if(!_0x2a054a['query'][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0xa4cf8a[_0xfb7f('0x28')]=qs['limit'](_0x2a054a['query'][_0xfb7f('0x28')]);_0xa4cf8a[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x2a054a[_0xfb7f('0x4b')]['offset']);}return _0x3ecb10[_0xfb7f('0xda')](_0xa4cf8a);}})[_0xfb7f('0x2f')](function(_0x57a045){if(_0x57a045){return _0x57a045?{'count':_0x5494d7,'rows':_0x57a045}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x109f0d,null))['catch'](handleError(_0x109f0d,null));};exports['getWhatsappInteractions']=function(_0x1e4579,_0x39ace0,_0x4a9712){var _0x5e3385={};var _0x34f78e={};var _0x3ffd5c;var _0x344a63;return db['User']['findOne']({'where':{'id':_0x1e4579['params']['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x39ace0,null))[_0xfb7f('0x2f')](function(_0x15ba73){if(_0x15ba73){_0x3ffd5c=_0x15ba73;_0x34f78e[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xdc')][_0xfb7f('0xc1')]);_0x34f78e[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1e4579[_0xfb7f('0x4b')]);_0x34f78e['filters']=_[_0xfb7f('0x4a')](_0x34f78e[_0xfb7f('0x46')],_0x34f78e[_0xfb7f('0x4b')]);_0x5e3385[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x34f78e[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x5e3385[_0xfb7f('0x4c')]=_0x5e3385[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x5e3385[_0xfb7f('0x4c')]:_0x34f78e[_0xfb7f('0x46')];_0x5e3385['order']=qs[_0xfb7f('0xc2')](_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x5e3385['where']=qs[_0xfb7f('0x51')](_['pick'](_0x1e4579['query'],_0x34f78e[_0xfb7f('0x51')]));if(_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x5e3385[_0xfb7f('0x53')]=_['merge'](_0x5e3385[_0xfb7f('0x53')],{'$or':_['map'](_0x5e3385[_0xfb7f('0x4c')],function(_0x4f21a7){var _0x335156={};_0x335156[_0x4f21a7]={'$like':'%'+_0x1e4579['query'][_0xfb7f('0x38')]+'%'};return _0x335156;})});}_0x5e3385=_[_0xfb7f('0x54')]({},_0x5e3385,_0x1e4579[_0xfb7f('0x58')]);return _0x3ffd5c[_0xfb7f('0xdd')](_0x5e3385);}})['then'](function(_0xd8aa79){if(_0xd8aa79){_0x344a63=_0xd8aa79[_0xfb7f('0x60')];if(!_0x1e4579['query'][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x5e3385[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x1e4579['query'][_0xfb7f('0x28')]);_0x5e3385[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x3ffd5c[_0xfb7f('0xdd')](_0x5e3385);}})[_0xfb7f('0x2f')](function(_0x1e01ed){if(_0x1e01ed){return _0x1e01ed?{'count':_0x344a63,'rows':_0x1e01ed}:null;}})['then'](respondWithResult(_0x39ace0,null))[_0xfb7f('0x5d')](handleError(_0x39ace0,null));};exports[_0xfb7f('0xde')]=function(_0x51f97b,_0x5cd1f2,_0x2ea9f6){var _0x5d83b2;var _0x1350c1;var _0x3a999d;var _0x47aabc=!_[_0xfb7f('0x6c')](_0x51f97b[_0xfb7f('0x62')]['id'])?_0x51f97b[_0xfb7f('0x62')]['id']:!_[_0xfb7f('0x6c')](_0x51f97b['user']['id'])?_0x51f97b[_0xfb7f('0x80')]['id']:null;return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x47aabc,'role':{'$or':[_0xfb7f('0x33'),_0xfb7f('0x80'),_0xfb7f('0x36')]}},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0xdf'),_0xfb7f('0xe0'),_0xfb7f('0x32'),_0xfb7f('0x66'),_0xfb7f('0xa1')]})['then'](function(_0x204e02){if(_0x204e02){if(_0x204e02[_0xfb7f('0x32')]===_0xfb7f('0x36')){_0x5d83b2=_0x204e02;if(_0x51f97b['body'][_0xfb7f('0xa2')]){_0x3a999d=util[_0xfb7f('0xe1')](_0xfb7f('0xe2'),_0x5d83b2[_0x51f97b[_0xfb7f('0x61')]['interface']]);}else if(_0x51f97b[_0xfb7f('0x61')][_0xfb7f('0xe3')]){_0x3a999d=util[_0xfb7f('0xe1')](_0xfb7f('0xae'),_0x51f97b[_0xfb7f('0x61')][_0xfb7f('0xe3')]);}else{_0x3a999d=util[_0xfb7f('0xe1')](_0xfb7f('0xae'),_0x5d83b2['name']);}socket['to'](util[_0xfb7f('0xe1')]('user:%s',_0x5d83b2[_0xfb7f('0x3d')]))[_0xfb7f('0xaa')](_0xfb7f('0xe4'),{'ip':_0x51f97b[_0xfb7f('0xe5')][_0xfb7f('0xe6')]||_0x51f97b[_0xfb7f('0xe7')][_0xfb7f('0xe8')]||_0x51f97b[_0xfb7f('0xe9')][_0xfb7f('0xe8')]||_0x51f97b[_0xfb7f('0xe7')][_0xfb7f('0xe9')][_0xfb7f('0xe8')]});return db[_0xfb7f('0xcc')]['destroy']({'where':{'membername':_0x5d83b2[_0xfb7f('0x3d')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xfb7f('0x97'))](_0xfb7f('0xea'));}})[_0xfb7f('0x2f')](function(){if(_0x5d83b2){return _0x5d83b2['getVoiceQueues']({'raw':!![]});}})[_0xfb7f('0x2f')](function(_0x303527){if(_0x5d83b2){var _0xbd255d=[];if(_0x303527){_0x1350c1=_0x303527;if(_0x1350c1[_0xfb7f('0x60')]){for(var _0x291943=0x0;_0x291943<_0x1350c1[_0xfb7f('0x60')];_0x291943++){_0xbd255d[_0xfb7f('0x93')]({'membername':_0x5d83b2[_0xfb7f('0x3d')],'UserId':_0x5d83b2['id'],'queue_name':_0x1350c1[_0x291943]['name'],'VoiceQueueId':_0x1350c1[_0x291943]['id'],'interface':_0x3a999d,'paused':_0x5d83b2[_0xfb7f('0xa1')]||![],'penalty':_0x1350c1[_0x291943][_0xfb7f('0xeb')]||0x0});}return BPromise[_0xfb7f('0x8e')](_0xbd255d,function(_0x4df81f){return db[_0xfb7f('0xcc')][_0xfb7f('0xb1')](_0x4df81f);});}}}})['then'](function(){if(_0x5d83b2){return db['MemberReport'][_0xfb7f('0x5b')]({'where':{'membername':_0x5d83b2[_0xfb7f('0x3d')],'exitAt':null}});}})[_0xfb7f('0x2f')](function(_0x4d97fa){if(_0x5d83b2){var _0x22f4f3=[];_0x4d97fa[_0xfb7f('0xec')](function(_0x3bc895){_0x22f4f3[_0xfb7f('0x93')](_0x3bc895['update']({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed'))}));});return BPromise['all'](_0x22f4f3);}})[_0xfb7f('0x2f')](function(){if(_0x5d83b2){var _0x540a39=[];var _0x58da61=[];var _0x1751a8=utils[_0xfb7f('0xee')]();var _0x19092d={'membername':_0x5d83b2['name'],'interface':_0x3a999d,'enterAt':moment()[_0xfb7f('0xe1')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5d83b2[_0xfb7f('0x32')],'internal':_0x5d83b2[_0xfb7f('0x66')]};_0x1751a8[_0xfb7f('0xec')](function(_0x503ce9){_0x540a39['push'](_[_0xfb7f('0x54')]({'channel':_0x503ce9,'type':_0xfb7f('0xef'),'data1':_0x51f97b[_0xfb7f('0x61')][_0xfb7f('0xf0')],'data2':_0x3a999d},_0x19092d));if(_0x5d83b2[_0xfb7f('0xa1')]){_0x58da61['push'](_[_0xfb7f('0x54')]({'channel':_0x503ce9,'type':_0xfb7f('0xf1'),'data1':_0xfb7f('0xf2')},_0x19092d));}});return db[_0xfb7f('0xf3')][_0xfb7f('0x89')](_0x540a39['concat'](_0x58da61),{'individualHooks':!![]});}})[_0xfb7f('0x2f')](function(){if(_0x5d83b2){return _0x5d83b2['update']({'online':!![],'lastLoginAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'voicePause':_0x5d83b2[_0xfb7f('0xa1')]||![],'mailPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'chatPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'faxPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'smsPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'openchannelPause':_0x5d83b2['loginInPause']||![],'whatsappPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'pauseType':_0x5d83b2['loginInPause']?'LOGININPAUSE':null,'interface':_0x3a999d,'lastPauseAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed'))});}})['then'](function(_0x249deb){if(_0x51f97b[_0xfb7f('0xf4')]){return _0x2ea9f6();}else{return BPromise[_0xfb7f('0xf5')](_0x249deb)['then'](respondWithResult(_0x5cd1f2,null));}})[_0xfb7f('0x5d')](handleError(_0x5cd1f2,null));};exports['logout']=function(_0x46b407,_0x299095,_0x41ebee){var _0x54b31d;return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x46b407[_0xfb7f('0x62')]['id'],'role':_0xfb7f('0x36')},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x299095,null))['then'](function(_0x4ad8b8){if(_0x4ad8b8){_0x54b31d=_0x4ad8b8;return db[_0xfb7f('0xcc')][_0xfb7f('0x30')]({'where':{'membername':_0x54b31d[_0xfb7f('0x3d')]},'individualHooks':!![]});}})[_0xfb7f('0x2f')](function(){return db[_0xfb7f('0xf3')][_0xfb7f('0x5b')]({'where':{'membername':_0x54b31d[_0xfb7f('0x3d')],'exitAt':null}});})[_0xfb7f('0x2f')](function(_0x4f0a1d){var _0x369802=[];_0x4f0a1d[_0xfb7f('0xec')](function(_0x368681){_0x369802[_0xfb7f('0x93')](_0x368681[_0xfb7f('0x2e')]({'exitAt':moment()['format'](_0xfb7f('0xed'))}));});return BPromise['all'](_0x369802);})[_0xfb7f('0x2f')](function(){return _0x54b31d[_0xfb7f('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x299095,null))['catch'](handleError(_0x299095,null));};exports[_0xfb7f('0xf6')]=function(_0x467eae,_0x563d65,_0x5c1a5e){var _0x39f2c8;return db['UserVoiceQueueRt'][_0xfb7f('0x2e')]({'paused':0x1},{'where':{'UserId':_0x467eae[_0xfb7f('0x62')]['id']},'individualHooks':!![]})[_0xfb7f('0x2f')](function(){return db['User']['find']({'where':{'id':_0x467eae[_0xfb7f('0x62')]['id'],'role':'agent'},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32'),_0xfb7f('0x66'),_0xfb7f('0xa2')]});})['then'](handleEntityNotFound(_0x563d65,null))['then'](function(_0x20e280){if(_0x20e280){_0x39f2c8=_0x20e280;return respondWithRpcPromise(_0xfb7f('0xf7'),_0xfb7f('0xf6'),{'id':_0x39f2c8['id'],'name':_0x39f2c8[_0xfb7f('0x3d')],'pause':!![]});}})[_0xfb7f('0x2f')](function(){if(_0x39f2c8){return db[_0xfb7f('0xf3')][_0xfb7f('0x5b')]({'where':{'membername':_0x39f2c8[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}});}})[_0xfb7f('0x2f')](function(_0x7f0612){if(_0x7f0612['length']){var _0x4cf418=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1c2b32=0x0,_0x58a3a2=_0x7f0612['length'];_0x1c2b32<_0x58a3a2;_0x1c2b32++){_0x7f0612[_0x1c2b32][_0xfb7f('0xf8')]({'exitAt':_0x4cf418});}}})[_0xfb7f('0x2f')](function(){var _0x481c54=[];var _0x4e9a81=utils[_0xfb7f('0xee')]();_0x4e9a81[_0xfb7f('0xec')](function(_0x5149e8){_0x481c54[_0xfb7f('0x93')]({'channel':_0x5149e8,'membername':_0x39f2c8[_0xfb7f('0x3d')],'interface':_[_0xfb7f('0x6c')](_0x39f2c8['interface'])?util[_0xfb7f('0xe1')](_0xfb7f('0xae'),_0x39f2c8[_0xfb7f('0x3d')]):_0x39f2c8[_0xfb7f('0xa2')],'type':_0xfb7f('0xf1'),'enterAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data1':_0x467eae[_0xfb7f('0x61')][_0xfb7f('0x44')]||_0xfb7f('0xf9'),'role':_0x39f2c8[_0xfb7f('0x32')],'internal':_0x39f2c8[_0xfb7f('0x66')]});});return db[_0xfb7f('0xf3')][_0xfb7f('0x89')](_0x481c54,{'individualHooks':!![]});})['then'](function(){return _0x39f2c8['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x467eae['body'][_0xfb7f('0x44')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xfb7f('0xed'))});})[_0xfb7f('0x2f')](respondWithResult(_0x563d65,null))[_0xfb7f('0x5d')](handleError(_0x563d65,null));};exports[_0xfb7f('0xfa')]=function(_0x1fbe3b,_0x2228e3,_0x367196){var _0x41d3fc;return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x1fbe3b[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32'),_0xfb7f('0xaf'),_0xfb7f('0xfb'),'chatPause',_0xfb7f('0xfc'),_0xfb7f('0xfd'),_0xfb7f('0xfe'),'whatsapppause',_0xfb7f('0xff'),_0xfb7f('0x100')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2228e3,null))[_0xfb7f('0x2f')](function(_0x21a44e){if(_0x21a44e){_0x41d3fc=_0x21a44e;if(_0x1fbe3b['body'][_0xfb7f('0xa0')]&&!utils[_0xfb7f('0xa3')](_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')])){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0xa4'));}switch(_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')]){case _0xfb7f('0xac'):return respondWithRpcPromise(_0xfb7f('0xf7'),_0xfb7f('0xfa'),{'id':_0x41d3fc['id'],'name':_0x41d3fc['name'],'pause':![]})[_0xfb7f('0x2f')](function(){return db['UserVoiceQueueRt'][_0xfb7f('0x2e')]({'paused':0x0},{'where':{'UserId':_0x41d3fc['id']},'individualHooks':!![]});})[_0xfb7f('0x2f')](function(){return db[_0xfb7f('0xf3')][_0xfb7f('0x3c')]({'where':{'channel':_0x1fbe3b[_0xfb7f('0x61')]['channel'],'membername':_0x41d3fc[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}});})[_0xfb7f('0x2f')](function(_0x47c3b7){if(_0x47c3b7){return _0x47c3b7[_0xfb7f('0x2e')]({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data2':_0xfb7f('0x101')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x41d3fc['update']({'voicePause':![]});});case _0xfb7f('0x102'):case _0xfb7f('0x103'):case _0xfb7f('0x104'):case _0xfb7f('0x105'):case _0xfb7f('0x106'):case _0xfb7f('0x107'):return db[_0xfb7f('0xf3')][_0xfb7f('0x3c')]({'where':{'channel':_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')],'membername':_0x41d3fc[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}})[_0xfb7f('0x2f')](function(_0x5b83c6){if(_0x5b83c6){return _0x5b83c6[_0xfb7f('0x2e')]({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data2':_0xfb7f('0x101')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x58a15c={};_['set'](_0x58a15c,util[_0xfb7f('0xe1')](_0xfb7f('0x108'),_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')],'Pause'),![]);return _0x41d3fc['update'](_0x58a15c);});default:return respondWithRpcPromise(_0xfb7f('0xf7'),_0xfb7f('0xfa'),{'id':_0x41d3fc['id'],'name':_0x41d3fc['name'],'pause':![]})['then'](function(){return db[_0xfb7f('0xcc')][_0xfb7f('0x2e')]({'paused':0x0},{'where':{'UserId':_0x41d3fc['id']}});})[_0xfb7f('0x2f')](function(){return db[_0xfb7f('0xf3')]['findAll']({'where':{'membername':_0x41d3fc[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}});})[_0xfb7f('0x2f')](function(_0x5e0ec0){var _0x1b6a21=[];_0x5e0ec0[_0xfb7f('0xec')](function(_0x132a5f){_0x1b6a21[_0xfb7f('0x93')](_0x132a5f[_0xfb7f('0x2e')]({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data2':_0xfb7f('0x101')}));});return BPromise[_0xfb7f('0x8d')](_0x1b6a21);})[_0xfb7f('0x2f')](function(){return _0x41d3fc[_0xfb7f('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xfb7f('0x2f')](respondWithResult(_0x2228e3,null))[_0xfb7f('0x5d')](handleError(_0x2228e3,null));};exports['getTeams']=function(_0x1d7836,_0xfcf1ef,_0x11bacf){var _0x5dc435={};var _0x4683db={};var _0x828f3;var _0x28423d;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x1d7836[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0xfcf1ef,null))[_0xfb7f('0x2f')](function(_0x24fd56){if(_0x24fd56){_0x828f3=_0x24fd56;_0x4683db['model']=_[_0xfb7f('0x49')](db[_0xfb7f('0x109')][_0xfb7f('0xc1')]);_0x4683db[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1d7836[_0xfb7f('0x4b')]);_0x4683db['filters']=_[_0xfb7f('0x4a')](_0x4683db['model'],_0x4683db[_0xfb7f('0x4b')]);_0x5dc435['attributes']=_[_0xfb7f('0x4a')](_0x4683db[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1d7836['query']['fields']));_0x5dc435['attributes']=_0x5dc435['attributes'][_0xfb7f('0x60')]?_0x5dc435[_0xfb7f('0x4c')]:_0x4683db['model'];_0x5dc435[_0xfb7f('0x50')]=qs['sort'](_0x1d7836[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x5dc435['where']=qs[_0xfb7f('0x51')](_['pick'](_0x1d7836[_0xfb7f('0x4b')],_0x4683db['filters']));if(_0x1d7836[_0xfb7f('0x4b')]['filter']){_0x5dc435[_0xfb7f('0x53')]=_['merge'](_0x5dc435[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x5dc435['attributes'],function(_0x200f20){var _0x44749f={};_0x44749f[_0x200f20]={'$like':'%'+_0x1d7836['query'][_0xfb7f('0x38')]+'%'};return _0x44749f;})});}_0x5dc435=_[_0xfb7f('0x54')]({},_0x5dc435,_0x1d7836[_0xfb7f('0x58')]);return _0x828f3[_0xfb7f('0x10a')](_0x5dc435);}})['then'](function(_0x3c4d2c){if(_0x3c4d2c){_0x28423d=_0x3c4d2c[_0xfb7f('0x60')];if(!_0x1d7836['query']['hasOwnProperty'](_0xfb7f('0x4f'))){_0x5dc435['limit']=qs[_0xfb7f('0x28')](_0x1d7836['query'][_0xfb7f('0x28')]);_0x5dc435[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1d7836[_0xfb7f('0x4b')]['offset']);}return _0x828f3[_0xfb7f('0x10a')](_0x5dc435);}})[_0xfb7f('0x2f')](function(_0x12b21f){if(_0x12b21f){return _0x12b21f?{'count':_0x28423d,'rows':_0x12b21f}:null;}})['then'](respondWithResult(_0xfcf1ef,null))[_0xfb7f('0x5d')](handleError(_0xfcf1ef,null));};exports['addTeams']=function(_0x26d0db,_0x189a19){return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x26d0db[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x189a19,null))[_0xfb7f('0x2f')](function(_0x3363ef){if(_0x3363ef){var _0xa15301=_0x3363ef['get']({'plain':!![]});return _0x3363ef[_0xfb7f('0x10b')](_0x26d0db[_0xfb7f('0x61')][_0xfb7f('0x65')],_[_0xfb7f('0x10c')](_0x26d0db[_0xfb7f('0x61')],[_0xfb7f('0x65'),'id'])||{})[_0xfb7f('0x2f')](function(){for(var _0x1e895f=0x0;_0x1e895f<_0x26d0db[_0xfb7f('0x61')]['ids'][_0xfb7f('0x60')];_0x1e895f++){var _0x4887fa=[];db[_0xfb7f('0x109')][_0xfb7f('0xc9')]({'where':{'id':_0x26d0db[_0xfb7f('0x61')]['ids'][_0x1e895f]}})[_0xfb7f('0x2f')](function(_0x68b3d3){_0x4887fa['push'](_0x68b3d3['getVoiceQueues']()[_0xfb7f('0x2f')](function(_0x4a8ced){for(var _0x53dc80=0x0;_0x53dc80<_0x4a8ced[_0xfb7f('0x60')];_0x53dc80++){_0x4a8ced[_0x53dc80][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x10e'));}return _0x4a8ced;}));_0x4887fa[_0xfb7f('0x93')](_0x68b3d3[_0xfb7f('0x10f')]()[_0xfb7f('0x2f')](function(_0x134ec2){for(var _0x1c3ead=0x0;_0x1c3ead<_0x134ec2[_0xfb7f('0x60')];_0x1c3ead++){_0x134ec2[_0x1c3ead][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x110'));}return _0x134ec2;}));_0x4887fa[_0xfb7f('0x93')](_0x68b3d3['getMailQueues']()[_0xfb7f('0x2f')](function(_0xa9b4ab){for(var _0x389e7e=0x0;_0x389e7e<_0xa9b4ab[_0xfb7f('0x60')];_0x389e7e++){_0xa9b4ab[_0x389e7e][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x111'));}return _0xa9b4ab;}));_0x4887fa['push'](_0x68b3d3['getSmsQueues']()[_0xfb7f('0x2f')](function(_0x4e9677){for(var _0x4364c4=0x0;_0x4364c4<_0x4e9677[_0xfb7f('0x60')];_0x4364c4++){_0x4e9677[_0x4364c4][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x112'));}return _0x4e9677;}));_0x4887fa[_0xfb7f('0x93')](_0x68b3d3['getWhatsappQueues']()[_0xfb7f('0x2f')](function(_0x1899d6){for(var _0x334b32=0x0;_0x334b32<_0x1899d6[_0xfb7f('0x60')];_0x334b32++){_0x1899d6[_0x334b32][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x113'));}return _0x1899d6;}));_0x4887fa['push'](_0x68b3d3[_0xfb7f('0x114')]()[_0xfb7f('0x2f')](function(_0x517daa){for(var _0x34bf86=0x0;_0x34bf86<_0x517daa[_0xfb7f('0x60')];_0x34bf86++){_0x517daa[_0x34bf86]['setDataValue'](_0xfb7f('0xa0'),_0xfb7f('0x115'));}return _0x517daa;}));_0x4887fa['push'](_0x68b3d3[_0xfb7f('0x116')]()[_0xfb7f('0x2f')](function(_0xdc7b64){for(var _0x41d3e3=0x0;_0x41d3e3<_0xdc7b64[_0xfb7f('0x60')];_0x41d3e3++){_0xdc7b64[_0x41d3e3][_0xfb7f('0x10d')]('channel',_0xfb7f('0x117'));}return _0xdc7b64;}));return BPromise[_0xfb7f('0x8d')](_0x4887fa);})[_0xfb7f('0x2f')](function(_0x2338e9){var _0x37a397=_[_0xfb7f('0x118')](_0x2338e9);_0x4887fa=[];return db[_0xfb7f('0x55')][_0xfb7f('0x119')](function(_0x298995){for(var _0x5583af=0x0;_0x5583af<_0x37a397[_0xfb7f('0x60')];_0x5583af++){_0x4887fa['push'](_0x37a397[_0x5583af][_0xfb7f('0x11a')](_0xa15301['id']),{'transaction':_0x298995});}return BPromise[_0xfb7f('0x8d')](_0x4887fa)[_0xfb7f('0x2f')](function(){if(_0xa15301[_0xfb7f('0xad')]){return BPromise[_0xfb7f('0x8e')](_[_0xfb7f('0x38')](_0x37a397,function(_0x674b83){return _0x674b83[_0xfb7f('0x11b')](_0xfb7f('0xa0'))===_0xfb7f('0x10e');}),function(_0x350ad7){return db[_0xfb7f('0xcc')][_0xfb7f('0xb1')]({'membername':_0xa15301[_0xfb7f('0x3d')],'UserId':_0xa15301['id'],'queue_name':_0x350ad7[_0xfb7f('0x3d')],'VoiceQueueId':_0x350ad7['id'],'interface':_[_0xfb7f('0x6c')](_0xa15301['interface'])?util[_0xfb7f('0xe1')]('SIP/%s',_0xa15301[_0xfb7f('0x3d')]):_0xa15301[_0xfb7f('0xa2')],'paused':_0xa15301[_0xfb7f('0xaf')]||![],'penalty':_0xa15301[_0xfb7f('0xb0')]},{'transaction':_0x298995});});}else{return;}})[_0xfb7f('0x2f')](function(){for(var _0x3b3e26=0x0;_0x3b3e26<_0x37a397[_0xfb7f('0x60')];_0x3b3e26++){var _0x42d9c8=_0x37a397[_0x3b3e26][_0xfb7f('0x11b')](_0xfb7f('0xa0'));var _0x2e6994=_0x42d9c8+'QueueId';socket['emit'](_0xfb7f('0x80')+_0x42d9c8+_0xfb7f('0xab'),{'UserId':_0xa15301['id'],['queueField']:_0x37a397[_0x3b3e26]['id']});}});});});}});}})[_0xfb7f('0x2f')](respondWithStatusCode(_0x189a19,null))['catch'](handleError(_0x189a19,null));};exports[_0xfb7f('0x11c')]=function(_0x4c075e,_0x3df3d8){return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x4c075e[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x3df3d8,null))[_0xfb7f('0x2f')](function(_0x39e287){if(_0x39e287){var _0x46279b=_0x39e287['get']({'plain':!![]});var _0x4ac89c=_0x4c075e[_0xfb7f('0x4b')]['ids'];return _0x39e287['removeTeams'](_0x4ac89c)['then'](function(){for(var _0x41f8a3=0x0;_0x41f8a3<_0x4ac89c[_0xfb7f('0x60')];_0x41f8a3++){var _0x14615d=[];db[_0xfb7f('0x109')]['findOne']({'where':{'id':_0x4ac89c[_0x41f8a3]}})[_0xfb7f('0x2f')](function(_0x550471){_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x11d')]()[_0xfb7f('0x2f')](function(_0x142966){for(var _0x3280a1=0x0;_0x3280a1<_0x142966[_0xfb7f('0x60')];_0x3280a1++){_0x142966[_0x3280a1][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x10e'));}return _0x142966;}));_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x10f')]()[_0xfb7f('0x2f')](function(_0x4da35f){for(var _0x3e3fa4=0x0;_0x3e3fa4<_0x4da35f[_0xfb7f('0x60')];_0x3e3fa4++){_0x4da35f[_0x3e3fa4][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x110'));}return _0x4da35f;}));_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x11e')]()[_0xfb7f('0x2f')](function(_0x179f9e){for(var _0x37952f=0x0;_0x37952f<_0x179f9e[_0xfb7f('0x60')];_0x37952f++){_0x179f9e[_0x37952f][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x111'));}return _0x179f9e;}));_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x11f')]()['then'](function(_0x1b5536){for(var _0x571fae=0x0;_0x571fae<_0x1b5536[_0xfb7f('0x60')];_0x571fae++){_0x1b5536[_0x571fae]['setDataValue']('channel','Sms');}return _0x1b5536;}));_0x14615d[_0xfb7f('0x93')](_0x550471['getWhatsappQueues']()[_0xfb7f('0x2f')](function(_0x41885c){for(var _0x54abbf=0x0;_0x54abbf<_0x41885c[_0xfb7f('0x60')];_0x54abbf++){_0x41885c[_0x54abbf][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x113'));}return _0x41885c;}));_0x14615d[_0xfb7f('0x93')](_0x550471['getFaxQueues']()[_0xfb7f('0x2f')](function(_0x21b66a){for(var _0x4e45a2=0x0;_0x4e45a2<_0x21b66a[_0xfb7f('0x60')];_0x4e45a2++){_0x21b66a[_0x4e45a2][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x115'));}return _0x21b66a;}));_0x14615d[_0xfb7f('0x93')](_0x550471['getOpenchannelQueues']()['then'](function(_0x35249d){for(var _0xb787a2=0x0;_0xb787a2<_0x35249d[_0xfb7f('0x60')];_0xb787a2++){_0x35249d[_0xb787a2][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x117'));}return _0x35249d;}));return BPromise[_0xfb7f('0x8d')](_0x14615d);})[_0xfb7f('0x2f')](function(_0x4292e2){var _0x57c100=_[_0xfb7f('0x118')](_0x4292e2);_0x14615d=[];return db[_0xfb7f('0x55')][_0xfb7f('0x119')](function(_0x573a7e){for(var _0x46b5f2=0x0;_0x46b5f2<_0x57c100['length'];_0x46b5f2++){_0x14615d[_0xfb7f('0x93')](_0x57c100[_0x46b5f2]['removeAgent'](_0x46279b['id']),{'transaction':_0x573a7e});}return BPromise[_0xfb7f('0x8d')](_0x14615d)['then'](function(){if(_0x46279b['online']){return BPromise[_0xfb7f('0x8e')](_['filter'](_0x57c100,function(_0x5340d3){return _0x5340d3[_0xfb7f('0x11b')](_0xfb7f('0xa0'))===_0xfb7f('0x10e');}),function(_0x48e00c){return db[_0xfb7f('0xcc')][_0xfb7f('0x30')]({'where':{'VoiceQueueId':_0x48e00c['id'],'UserId':_0x46279b['id']},'transaction':_0x573a7e});});}else{return;}})[_0xfb7f('0x2f')](function(){for(var _0x225672=0x0;_0x225672<_0x57c100[_0xfb7f('0x60')];_0x225672++){var _0x20f8a9=_0x57c100[_0x225672][_0xfb7f('0x11b')](_0xfb7f('0xa0'));var _0x475c46=_0x20f8a9+_0xfb7f('0xa9');socket['emit'](_0xfb7f('0x80')+_0x20f8a9+_0xfb7f('0x120'),{'UserId':_0x46279b['id'],['queueField']:_0x57c100[_0x225672]['id']});}});});});}});}})[_0xfb7f('0x2f')](respondWithStatusCode(_0x3df3d8,null))[_0xfb7f('0x5d')](handleError(_0x3df3d8,null));};exports['getLists']=function(_0x4d3e24,_0xcd79f9,_0x46d032){var _0x585bdc={};var _0x42f05b={};var _0x1e80f0;var _0x498c92;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x4d3e24[_0xfb7f('0x62')]['id']}})['then'](handleEntityNotFound(_0xcd79f9,null))[_0xfb7f('0x2f')](function(_0x19e945){if(_0x19e945){_0x1e80f0=_0x19e945;_0x42f05b[_0xfb7f('0x46')]=_['keys'](db[_0xfb7f('0xc3')][_0xfb7f('0xc1')]);_0x42f05b['query']=_[_0xfb7f('0x49')](_0x4d3e24[_0xfb7f('0x4b')]);_0x42f05b[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x42f05b[_0xfb7f('0x46')],_0x42f05b[_0xfb7f('0x4b')]);_0x585bdc['attributes']=_[_0xfb7f('0x4a')](_0x42f05b['model'],qs[_0xfb7f('0x4d')](_0x4d3e24['query'][_0xfb7f('0x4d')]));_0x585bdc['attributes']=_0x585bdc['attributes']['length']?_0x585bdc[_0xfb7f('0x4c')]:_0x42f05b['model'];_0x585bdc[_0xfb7f('0x50')]=qs['sort'](_0x4d3e24[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x585bdc['where']=qs['filters'](_['pick'](_0x4d3e24[_0xfb7f('0x4b')],_0x42f05b['filters']));if(_0x4d3e24[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x585bdc[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x585bdc[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x585bdc[_0xfb7f('0x4c')],function(_0x511de5){var _0x5ec108={};_0x5ec108[_0x511de5]={'$like':'%'+_0x4d3e24[_0xfb7f('0x4b')]['filter']+'%'};return _0x5ec108;})});}_0x585bdc=_[_0xfb7f('0x54')]({},_0x585bdc,_0x4d3e24['options']);return _0x1e80f0[_0xfb7f('0x121')](_0x585bdc);}})[_0xfb7f('0x2f')](function(_0x30045b){if(_0x30045b){_0x498c92=_0x30045b[_0xfb7f('0x60')];if(!_0x4d3e24[_0xfb7f('0x4b')][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x585bdc[_0xfb7f('0x28')]=qs['limit'](_0x4d3e24['query']['limit']);_0x585bdc['offset']=qs[_0xfb7f('0x27')](_0x4d3e24['query'][_0xfb7f('0x27')]);}return _0x1e80f0[_0xfb7f('0x121')](_0x585bdc);}})[_0xfb7f('0x2f')](function(_0xa1410a){if(_0xa1410a){return _0xa1410a?{'count':_0x498c92,'rows':_0xa1410a}:null;}})['then'](respondWithResult(_0xcd79f9,null))['catch'](handleError(_0xcd79f9,null));};exports['getAgents']=function(_0x5d6db7,_0x762720,_0x530e0c){var _0x20abc1={};var _0x33a841={};var _0x4a07b1;var _0x49cf82;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x5d6db7[_0xfb7f('0x62')]['id']}})['then'](handleEntityNotFound(_0x762720,null))[_0xfb7f('0x2f')](function(_0x2d066c){if(_0x2d066c){_0x4a07b1=_0x2d066c;_0x33a841['model']=_['keys'](db['User'][_0xfb7f('0xc1')]);_0x33a841['query']=_['keys'](_0x5d6db7[_0xfb7f('0x4b')]);_0x33a841['filters']=_[_0xfb7f('0x4a')](_0x33a841[_0xfb7f('0x46')],_0x33a841[_0xfb7f('0x4b')]);_0x20abc1[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x33a841[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x5d6db7[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x20abc1[_0xfb7f('0x4c')]=_0x20abc1[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x20abc1['attributes']:_0x33a841['model'];_0x20abc1[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x5d6db7[_0xfb7f('0x4b')]['sort']);_0x20abc1[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x5d6db7[_0xfb7f('0x4b')],_0x33a841[_0xfb7f('0x51')]));if(_0x5d6db7[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x20abc1[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x20abc1['where'],{'$or':_[_0xfb7f('0x41')](_0x20abc1[_0xfb7f('0x4c')],function(_0x5c603e){var _0x4febd7={};_0x4febd7[_0x5c603e]={'$like':'%'+_0x5d6db7[_0xfb7f('0x4b')]['filter']+'%'};return _0x4febd7;})});}_0x20abc1[_0xfb7f('0x46')]=db['User'];_0x20abc1['as']=_0xfb7f('0x35');_0x20abc1=_['merge']({},_0x20abc1,_0x5d6db7[_0xfb7f('0x58')]);return _0x4a07b1[_0xfb7f('0x11d')]({'include':[_0x20abc1]});}})[_0xfb7f('0x2f')](function(_0x13e8fe){if(_0x13e8fe){var _0x3d4198={},_0x1981e8=[],_0x1cd794=0x0;for(var _0x422d3f=0x0;_0x422d3f<_0x13e8fe[_0xfb7f('0x60')];_0x422d3f+=0x1){for(var _0x5dcfe0=0x0,_0x2681f7;_0x5dcfe0<_0x13e8fe[_0x422d3f]['Agents'][_0xfb7f('0x60')];_0x5dcfe0+=0x1){_0x2681f7=_0x13e8fe[_0x422d3f][_0xfb7f('0x35')][_0x5dcfe0][_0xfb7f('0x31')]({'plain':!![]});_0x3d4198[_0x2681f7['id']]=_0x2681f7;}}_0x3d4198=_[_0xfb7f('0x122')](_0x3d4198);for(var _0xcd1b92=qs[_0xfb7f('0x27')](_0x5d6db7[_0xfb7f('0x4b')]['offset']);_0xcd1b92<_0x3d4198[_0xfb7f('0x60')]&&_0x1981e8['length']=_0x17f12b){_0x595366=_0x17f12b;_0x247916=0xc8;}else{_0x247916=0xce;}_0x2201cc[_0x2a4c('0x28')](_0x247916);return _0x2201cc[_0x2a4c('0x2e')](_0x2a4c('0x2f'),_0x233d3c+'-'+_0x595366+'/'+_0x17f12b)[_0x2a4c('0x2a')](_0x5b3466);}return null;};}function patchUpdates(_0xc0f174){return function(_0x564ad9){try{jsonpatch[_0x2a4c('0x30')](_0x564ad9,_0xc0f174,!![]);}catch(_0x187fb6){return BPromise[_0x2a4c('0x31')](_0x187fb6);}return _0x564ad9['save']();};}function saveUpdates(_0x2757fb,_0x4288b4){return function(_0x4e0c9b){if(_0x4e0c9b){return _0x4e0c9b[_0x2a4c('0x32')](_0x2757fb)[_0x2a4c('0x33')](function(_0x543c1){return _0x543c1;});}return null;};}function removeEntity(_0x25b596,_0x1956ff){return function(_0xcdde3e){if(_0xcdde3e){return _0xcdde3e[_0x2a4c('0x34')]()[_0x2a4c('0x33')](function(){var _0x2036c2=_0xcdde3e[_0x2a4c('0x35')]({'plain':!![]});if(_0x2036c2['role']===_0x2a4c('0x36'))return;var _0x1af000=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x2a4c('0x37'),'value':_0x2a4c('0x38'),'ignore':![]},{'name':'Telephones','value':_0x2a4c('0x39'),'ignore':![]}];var _0x4360d2=_(_0x1af000)[_0x2a4c('0x3a')]('ignore')[_0x2a4c('0x3b')](_0x2a4c('0x3c'))[_0x2a4c('0x3c')]();if(_[_0x2a4c('0x3d')](_0x4360d2,_0x2036c2[_0x2a4c('0x3e')])){return;}var _0x1aa6f1=_['find'](_0x1af000,[_0x2a4c('0x3c'),_0x2036c2['role']])['name'];return db[_0x2a4c('0x3f')]['destroy']({'where':{'type':_0x1aa6f1,'resourceId':_0x2036c2['id']}})['then'](function(){return _0xcdde3e;});})[_0x2a4c('0x33')](function(){_0x25b596[_0x2a4c('0x28')](0xcc)[_0x2a4c('0x29')]();});}};}function handleEntityNotFound(_0x329880,_0x57deca){return function(_0x50a17e){if(!_0x50a17e){_0x329880[_0x2a4c('0x27')](0x194);}return _0x50a17e;};}function handleError(_0x1c94d4,_0x19b6b6){_0x19b6b6=_0x19b6b6||0x1f4;return function(_0xe4fdca){logger[_0x2a4c('0x21')](_0xe4fdca[_0x2a4c('0x40')]);if(_0xe4fdca[_0x2a4c('0x41')]){delete _0xe4fdca[_0x2a4c('0x41')];}_0x1c94d4[_0x2a4c('0x28')](_0x19b6b6)[_0x2a4c('0x42')](_0xe4fdca);};}exports[_0x2a4c('0x43')]=function(_0x486fe6,_0x308698){var _0x3f0078={},_0x2eab91={},_0x2f8fe8={'count':0x0,'rows':[]};var _0x2ba413=_[_0x2a4c('0x3b')](db[_0x2a4c('0x44')][_0x2a4c('0x45')],function(_0x19bcad){return{'name':_0x19bcad['fieldName'],'type':_0x19bcad[_0x2a4c('0x46')]['key']};});_0x2eab91[_0x2a4c('0x47')]=_[_0x2a4c('0x48')](_[_0x2a4c('0x3b')](_0x2ba413,_0x2a4c('0x41')),['password',_0x2a4c('0x49')]);_0x2eab91[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x486fe6['query']);_0x2eab91[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x2eab91[_0x2a4c('0x47')],_0x2eab91[_0x2a4c('0x4a')]);_0x3f0078['attributes']=_[_0x2a4c('0x4d')](_0x2eab91['model'],qs[_0x2a4c('0x4e')](_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x3f0078[_0x2a4c('0x4f')]=_0x3f0078['attributes']['length']?_0x3f0078[_0x2a4c('0x4f')]:_0x2eab91['model'];if(!_0x486fe6['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x3f0078['limit']=qs[_0x2a4c('0x2d')](_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x3f0078[_0x2a4c('0x2c')]=qs['offset'](_0x486fe6[_0x2a4c('0x4a')]['offset']);}_0x3f0078['order']=qs['sort'](_0x486fe6['query'][_0x2a4c('0x52')]);_0x3f0078[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x486fe6[_0x2a4c('0x4a')],_0x2eab91[_0x2a4c('0x4c')]),_0x2ba413);if(_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x3f0078[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x3f0078['where'],{'$or':_[_0x2a4c('0x3b')](_0x2ba413,function(_0x133ca7){if(_0x133ca7[_0x2a4c('0x46')]!==_0x2a4c('0x56')){return db[_0x2a4c('0x57')][_0x2a4c('0x53')](db['sequelize']['fn']('lower',db[_0x2a4c('0x57')][_0x2a4c('0x58')](_0x133ca7[_0x2a4c('0x41')])),{'$like':db[_0x2a4c('0x57')]['fn']('lower','%'+_0x486fe6[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%')});}})});}_0x3f0078=_[_0x2a4c('0x55')]({},_0x3f0078,_0x486fe6[_0x2a4c('0x59')]);var _0x17a332={'where':_0x3f0078[_0x2a4c('0x53')]};return db[_0x2a4c('0x44')][_0x2a4c('0x2b')](_0x17a332)['then'](function(_0x5e67d8){_0x2f8fe8[_0x2a4c('0x2b')]=_0x5e67d8;if(_0x486fe6['query'][_0x2a4c('0x5a')]){_0x3f0078[_0x2a4c('0x5b')]=[{'all':!![]}];}return db['User'][_0x2a4c('0x5c')](_0x3f0078);})[_0x2a4c('0x33')](function(_0x2205e9){_0x2f8fe8[_0x2a4c('0x5d')]=_0x2205e9;return _0x2f8fe8;})[_0x2a4c('0x33')](respondWithFilteredResult(_0x308698,_0x3f0078))[_0x2a4c('0x5e')](handleError(_0x308698,null));};exports[_0x2a4c('0x5f')]=function(_0x148787,_0x566a93){var _0xe1c829={'raw':![],'where':{'id':_0x148787['params']['id']}},_0x51452a={};_0x51452a['model']=_[_0x2a4c('0x48')](_['keys'](db[_0x2a4c('0x44')][_0x2a4c('0x45')]),[_0x2a4c('0x60'),'salt']);_0x51452a['query']=_[_0x2a4c('0x4b')](_0x148787[_0x2a4c('0x4a')]);_0x51452a[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x51452a['model'],_0x51452a[_0x2a4c('0x4a')]);_0xe1c829[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x51452a[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x148787['query'][_0x2a4c('0x4e')]));_0xe1c829['attributes']=_0xe1c829[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0xe1c829[_0x2a4c('0x4f')]:_0x51452a[_0x2a4c('0x47')];if(_0x148787[_0x2a4c('0x4a')][_0x2a4c('0x5a')]){_0xe1c829[_0x2a4c('0x5b')]=[{'all':!![]}];}_0xe1c829=_[_0x2a4c('0x55')]({},_0xe1c829,_0x148787[_0x2a4c('0x59')]);return db['User'][_0x2a4c('0x62')](_0xe1c829)[_0x2a4c('0x33')](handleEntityNotFound(_0x566a93,null))[_0x2a4c('0x33')](respondWithResult(_0x566a93,null))[_0x2a4c('0x5e')](handleError(_0x566a93,null));};exports[_0x2a4c('0x32')]=function(_0x446d5e,_0x44ca34){if(_0x446d5e[_0x2a4c('0x63')]['id']){delete _0x446d5e[_0x2a4c('0x63')]['id'];}delete _0x446d5e[_0x2a4c('0x63')]['role'];return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x446d5e[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x44ca34,null))[_0x2a4c('0x33')](saveUpdates(_0x446d5e[_0x2a4c('0x63')],null))[_0x2a4c('0x33')](respondWithResult(_0x44ca34,null))[_0x2a4c('0x5e')](handleError(_0x44ca34,null));};exports['describe']=function(_0x109357,_0x284d7c){return db[_0x2a4c('0x44')][_0x2a4c('0x65')]()[_0x2a4c('0x33')](respondWithResult(_0x284d7c,null))[_0x2a4c('0x5e')](handleError(_0x284d7c,null));};exports[_0x2a4c('0x66')]=function(_0x20951e,_0x7f06b0,_0x1b5b88){return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x20951e[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x7f06b0,null))['then'](function(_0x3844df){if(_0x3844df){return _0x3844df['addContacts'](_0x20951e[_0x2a4c('0x63')]['ids'],_[_0x2a4c('0x67')](_0x20951e[_0x2a4c('0x63')],['ids','id'])||{});}})['then'](respondWithResult(_0x7f06b0,null))['catch'](handleError(_0x7f06b0,null));};function validateUser(_0x184345){return new BPromise(function(_0x4d64bb,_0x1c2896){if(_0x184345[_0x2a4c('0x68')])return _0x4d64bb(_0x184345);return db['Setting'][_0x2a4c('0x69')](0x1)[_0x2a4c('0x33')](function(_0x5abf4b){if(_0x5abf4b[_0x2a4c('0x6a')])authService['validatePasswordPattern'](_0x184345[_0x2a4c('0x60')]);db[_0x2a4c('0x44')][_0x2a4c('0x6b')](_0x2a4c('0x68'))[_0x2a4c('0x33')](function(_0x5a316c){if(_[_0x2a4c('0x6c')](_0x5a316c)){_0x184345[_0x2a4c('0x68')]=_0x5abf4b[_0x2a4c('0x6d')]||0x1;return;}if(_[_0x2a4c('0x6c')](_0x5abf4b['min_internal'])||_0x5abf4b[_0x2a4c('0x6d')]===_0x5a316c){_0x184345['internal']=_0x5a316c+0x1;return;}if(_0x5abf4b[_0x2a4c('0x6d')]>_0x5a316c){_0x184345[_0x2a4c('0x68')]=_0x5abf4b[_0x2a4c('0x6d')];return;}return db[_0x2a4c('0x57')][_0x2a4c('0x4a')](_0x2a4c('0x6e'),{'type':db[_0x2a4c('0x57')][_0x2a4c('0x6f')][_0x2a4c('0x70')]})[_0x2a4c('0x33')](function(_0x4afe5b){if(_0x4afe5b&&_0x4afe5b[_0x2a4c('0x61')]){for(var _0x10abd2=0x0,_0x36acd7=_0x4afe5b[_0x2a4c('0x61')];_0x10abd2<_0x36acd7&&_[_0x2a4c('0x6c')](_0x184345[_0x2a4c('0x68')]);_0x10abd2++){if(_0x5abf4b['min_internal']<=_0x4afe5b[_0x10abd2][_0x2a4c('0x71')]){_0x184345['internal']=_0x4afe5b[_0x10abd2]['from'];}else if(_0x5abf4b[_0x2a4c('0x6d')]>_0x4afe5b[_0x10abd2][_0x2a4c('0x71')]&&_0x5abf4b[_0x2a4c('0x6d')]<=_0x4afe5b[_0x10abd2]['to']){_0x184345['internal']=_0x5abf4b[_0x2a4c('0x6d')];}}}if(_[_0x2a4c('0x6c')](_0x184345[_0x2a4c('0x68')])){_0x184345['internal']=_0x5a316c+0x1;}return _0x4d64bb(_0x184345);});});})['catch'](function(_0x2cbddc){_0x1c2896(_0x2cbddc);});});}function updateUser(_0x246dc1){return new BPromise(function(_0x3c3520,_0x5a0742){try{if(_0x246dc1[_0x2a4c('0x72')]){_0x246dc1['mailbox']=_0x246dc1['internal'];_0x246dc1['VoiceMail']={'mailbox':_0x246dc1['internal'],'password':_0x246dc1['password'],'fullname':_0x246dc1[_0x2a4c('0x73')],'email':_0x246dc1[_0x2a4c('0x74')]};}if(_0x246dc1[_0x2a4c('0x3e')]==='agent'){if(!_0x246dc1[_0x2a4c('0x75')])_0x246dc1[_0x2a4c('0x75')]=[_0x2a4c('0x76'),_0x2a4c('0x77'),'103',_0x2a4c('0x78'),_0x2a4c('0x79'),_0x2a4c('0x7a'),'105',_0x2a4c('0x7b'),_0x2a4c('0x7c'),_0x2a4c('0x7d'),_0x2a4c('0x7e'),'100',_0x2a4c('0x7f'),'114'];}_0x3c3520(_0x246dc1);}catch(_0x122906){_0x5a0742(_0x122906);}});}exports[_0x2a4c('0x80')]=function(_0x53f31b,_0x452f5b){if(_0x53f31b[_0x2a4c('0x81')]['role']==='agent')throw new Error(_0x2a4c('0x82'));if(_0x53f31b[_0x2a4c('0x63')][_0x2a4c('0x3e')]===_0x2a4c('0x81')&&_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x3e')]!==_0x2a4c('0x36')){throw new Error(_0x2a4c('0x83'));}if(_0x53f31b[_0x2a4c('0x63')][_0x2a4c('0x3e')]===_0x2a4c('0x36')&&_0x53f31b['user'][_0x2a4c('0x3e')]!=='admin'){throw new Error(_0x2a4c('0x84'));}return licenseUtil[_0x2a4c('0x85')]([_0x53f31b[_0x2a4c('0x63')]])[_0x2a4c('0x33')](function(){return validateUser(_0x53f31b[_0x2a4c('0x63')]);})[_0x2a4c('0x33')](function(_0x5f3af1){return updateUser(_0x5f3af1)['then'](function(_0x4bef5f){if(_0x4bef5f[_0x2a4c('0x3e')]===_0x2a4c('0x36')){_0x4bef5f[_0x2a4c('0x86')]=_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x86')];delete _0x4bef5f[_0x2a4c('0x87')];}return _0x4bef5f;});})[_0x2a4c('0x33')](function(_0x28ac92){return db[_0x2a4c('0x44')][_0x2a4c('0x80')](_0x28ac92,{'include':[{'model':db[_0x2a4c('0x88')],'as':_0x2a4c('0x88')}]});})[_0x2a4c('0x33')](function(_0x39bb89){if(_0x53f31b[_0x2a4c('0x63')][_0x2a4c('0x3e')]===_0x2a4c('0x81'))return _0x39bb89;if(_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x3e')]!=='user')return _0x39bb89;return db[_0x2a4c('0x89')][_0x2a4c('0x62')]({'where':{'name':_0x39bb89['role']===_0x2a4c('0x38')?_0x2a4c('0x37'):_0x2a4c('0x8a'),'userProfileId':_0x53f31b[_0x2a4c('0x81')][_0x2a4c('0x87')]},'raw':!![]})[_0x2a4c('0x33')](function(_0x57df28){if(!_0x57df28||_0x57df28[_0x2a4c('0x8b')]!=0x0)return _0x39bb89;return db[_0x2a4c('0x3f')][_0x2a4c('0x80')]({'name':_0x39bb89[_0x2a4c('0x41')],'resourceId':_0x39bb89['id'],'type':_0x57df28[_0x2a4c('0x41')],'sectionId':_0x57df28['id']},{})[_0x2a4c('0x33')](function(){return _0x39bb89;});})[_0x2a4c('0x5e')](function(_0x1b38a4){logger[_0x2a4c('0x21')](_0x2a4c('0x8c'),_0x1b38a4);throw _0x1b38a4;});})[_0x2a4c('0x33')](respondWithResult(_0x452f5b,0xc9))['catch'](handleError(_0x452f5b,null));};exports[_0x2a4c('0x8d')]=function(_0x4e4f9e,_0x2e1ffb){var _0x202e16=_0x4e4f9e['body'];var _0x50c1c4=[];if(_0x4e4f9e['user']['role']==='agent')throw new Error('Unauthorized');if(_[_0x2a4c('0x8e')](_0x202e16,[_0x2a4c('0x3e'),'user'])&&_0x4e4f9e['user']['role']!==_0x2a4c('0x36')){throw new Error(_0x2a4c('0x83'));}if(_['some'](_0x202e16,[_0x2a4c('0x3e'),_0x2a4c('0x36')])&&_0x4e4f9e[_0x2a4c('0x81')][_0x2a4c('0x3e')]!==_0x2a4c('0x36')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x202e16)[_0x2a4c('0x33')](function(){return validateUser(_0x202e16[0x0]);})[_0x2a4c('0x33')](function(){for(var _0x16ad43=0x1;_0x16ad43<_0x202e16[_0x2a4c('0x61')];_0x16ad43++){var _0x3240ae=_0x202e16[_0x16ad43-0x1][_0x2a4c('0x68')];if(!_0x202e16[_0x16ad43][_0x2a4c('0x68')])_0x202e16[_0x16ad43]['internal']=_0x3240ae+0x1;_0x50c1c4[_0x2a4c('0x8f')](validateUser(_0x202e16[_0x16ad43]));}return BPromise[_0x2a4c('0x90')](_0x50c1c4);})[_0x2a4c('0x33')](function(){_0x50c1c4=[];for(var _0x2a7423=0x0;_0x2a7423<_0x202e16[_0x2a4c('0x61')];_0x2a7423++){_0x50c1c4[_0x2a4c('0x8f')](updateUser(_0x202e16[_0x2a7423]));}return BPromise[_0x2a4c('0x90')](_0x50c1c4);})[_0x2a4c('0x33')](function(){return BPromise[_0x2a4c('0x91')](_0x202e16,function(_0x5295da){return db[_0x2a4c('0x44')][_0x2a4c('0x80')](_0x5295da,{'include':[{'model':db[_0x2a4c('0x88')],'as':_0x2a4c('0x88')}]})[_0x2a4c('0x33')](function(_0x40dc03){_0x5295da['id']=_0x40dc03['id'];return _0x5295da;});});})[_0x2a4c('0x33')](function(_0x111c4c){if(_0x4e4f9e['body']['role']===_0x2a4c('0x81'))return _0x111c4c;if(_0x4e4f9e[_0x2a4c('0x81')][_0x2a4c('0x3e')]!=='user')return _0x111c4c;var _0x2cb13f=_[_0x2a4c('0x8e')](_0x111c4c,function(_0x249820){return _0x249820[_0x2a4c('0x3e')]===_0x2a4c('0x38')||_0x249820[_0x2a4c('0x3e')]===_0x2a4c('0x39');});if(!_0x2cb13f)return _0x111c4c;return db[_0x2a4c('0x89')][_0x2a4c('0x5c')]({'where':{'name':{'$or':[_0x2a4c('0x37'),'Telephones']},'userProfileId':_0x4e4f9e[_0x2a4c('0x81')][_0x2a4c('0x87')]},'raw':!![]})[_0x2a4c('0x33')](function(_0x419388){if(_[_0x2a4c('0x92')](_0x419388)||!_[_0x2a4c('0x8e')](_0x419388,[_0x2a4c('0x8b'),0x0]))return _0x111c4c;_0x50c1c4=[];var _0x335e04=_(_0x419388)[_0x2a4c('0x3b')](function(_0x4acacb){if(_0x4acacb[_0x2a4c('0x8b')]===0x1)return;return _0x4acacb['name']===_0x2a4c('0x37')?_0x2a4c('0x38'):_0x2a4c('0x39');})['compact']()['value']();for(var _0x3d69de=0x0;_0x3d69de<_0x111c4c[_0x2a4c('0x61')];_0x3d69de++){if(!_[_0x2a4c('0x3d')](_0x335e04,_0x111c4c[_0x3d69de][_0x2a4c('0x3e')]))return;var _0x402d50=_0x111c4c[_0x3d69de][_0x2a4c('0x3e')]===_0x2a4c('0x38')?_0x2a4c('0x37'):_0x2a4c('0x8a');_0x50c1c4['push'](db[_0x2a4c('0x3f')]['create']({'name':_0x111c4c[_0x3d69de][_0x2a4c('0x41')],'resourceId':_0x111c4c[_0x3d69de]['id'],'type':_0x402d50,'sectionId':_[_0x2a4c('0x62')](_0x419388,[_0x2a4c('0x41'),_0x402d50])['id']},{}));}return BPromise[_0x2a4c('0x90')](_0x50c1c4);})[_0x2a4c('0x33')](respondWithResult(_0x2e1ffb,0xc9))[_0x2a4c('0x5e')](handleError(_0x2e1ffb,null));});};exports[_0x2a4c('0x93')]=function(_0x389338,_0x15ab1d,_0x43af90){if(_0x389338[_0x2a4c('0x63')]['id']){delete _0x389338[_0x2a4c('0x63')]['id'];}return db['User']['find']({'where':{'id':_0x389338['params']['id']}})[_0x2a4c('0x33')](function(_0x7d81fe){if(!_0x7d81fe)return null;if(_0x7d81fe['id']===_0x389338[_0x2a4c('0x81')]['id']){if(!_0x389338[_0x2a4c('0x63')][_0x2a4c('0x94')]||!_0x389338['body']['newPassword']){throw new db[(_0x2a4c('0x95'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x7d81fe[_0x2a4c('0x96')](_0x389338['body'][_0x2a4c('0x94')])){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0x98'));}if(_0x389338['body'][_0x2a4c('0x94')]===_0x389338['body'][_0x2a4c('0x99')]){throw new db['Sequelize'][(_0x2a4c('0x97'))](_0x2a4c('0x9a'));}}else if(_0x389338['user'][_0x2a4c('0x3e')]==='admin'){if(!_0x389338[_0x2a4c('0x63')]['newPassword']){throw new db['Sequelize'][(_0x2a4c('0x97'))](_0x2a4c('0x9b'));}}else if(_0x389338['user'][_0x2a4c('0x3e')]===_0x2a4c('0x81')){if(!_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')]){throw new db['Sequelize'][(_0x2a4c('0x97'))](_0x2a4c('0x9b'));}if(_0x7d81fe['role']!==_0x2a4c('0x38')){throw new db[(_0x2a4c('0x95'))]['ValidationError'](_0x2a4c('0x82'));}}else{throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0x82'));}return _0x7d81fe;})[_0x2a4c('0x33')](handleEntityNotFound(_0x15ab1d,null))[_0x2a4c('0x33')](function(_0x1596c2){return db[_0x2a4c('0x9c')]['findOne']({'attributes':['id',_0x2a4c('0x6a'),_0x2a4c('0x9d'),'passwordHistoryLimit']})['then'](function(_0x14b29f){if(_0x14b29f['securePassword'])authService[_0x2a4c('0x9e')](_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')]);if(!_0x14b29f[_0x2a4c('0x9d')]||!_0x1596c2[_0x2a4c('0x9f')])return _0x1596c2;authService[_0x2a4c('0xa0')](_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')],_0x1596c2[_0x2a4c('0x9f')],_0x14b29f[_0x2a4c('0xa1')]);return _0x1596c2;})[_0x2a4c('0x33')](saveUpdates({'password':_0x389338['body']['newPassword'],'passwordResetAt':_0x389338['user']['id']==_0x389338[_0x2a4c('0x64')]['id']?moment():null,'previousPasswords':authService[_0x2a4c('0xa2')](_0x389338[_0x2a4c('0x63')][_0x2a4c('0x99')],_0x1596c2[_0x2a4c('0x9f')])},null));})[_0x2a4c('0x33')](respondWithResult(_0x15ab1d,null))[_0x2a4c('0x5e')](handleError(_0x15ab1d,null));};exports[_0x2a4c('0xa3')]=function(_0x273d31,_0x2b95ce,_0x2aadbc){var _0x19fd48=_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xa4')];return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x273d31[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0x41'),'role',_0x2a4c('0xa5'),_0x2a4c('0xa6'),'voicePause','interface']})[_0x2a4c('0x33')](handleEntityNotFound(_0x2b95ce,null))[_0x2a4c('0x33')](function(_0x1e5354){if(_0x1e5354){if(!utils[_0x2a4c('0xa7')](_0x19fd48)){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xa8'));}return _0x1e5354[_0x2a4c('0xa9')+_[_0x2a4c('0xaa')](_0x19fd48[_0x2a4c('0xab')]())+'Queues'](_0x273d31['body'][_0x2a4c('0xac')],{'penalty':_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xad')]||0x0})[_0x2a4c('0xae')](function(_0x32f2c3){for(var _0x5f4487=0x0;_0x5f4487<_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xac')]['length'];_0x5f4487+=0x1){var _0x597126={'UserId':_0x273d31[_0x2a4c('0x64')]['id']};_0x597126[_[_0x2a4c('0xaa')](_0x19fd48[_0x2a4c('0xab')]())+_0x2a4c('0xaf')]=_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xac')][_0x5f4487];socket[_0x2a4c('0xb0')]('user'+_[_0x2a4c('0xaa')](_0x19fd48[_0x2a4c('0xab')]())+'Queue:save',_0x597126);}return _0x32f2c3;})[_0x2a4c('0x33')](function(){if(_0x19fd48===_0x2a4c('0xb1')){return db[_0x2a4c('0xb2')][_0x2a4c('0x5c')]({'where':{'id':_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xac')]||[]},'raw':!![],'attributes':['id',_0x2a4c('0x41')]});}})['then'](function(_0x3ad766){var _0x38ac9a=_0x1e5354[_0x2a4c('0x35')]({'plain':!![]});var _0x322fa=[];if(_0x19fd48===_0x2a4c('0xb1')&&_0x38ac9a[_0x2a4c('0x3e')]===_0x2a4c('0x38')&&_0x38ac9a[_0x2a4c('0xa5')]){for(var _0x4c4143=0x0;_0x4c4143<_0x3ad766[_0x2a4c('0x61')];_0x4c4143+=0x1){_0x322fa[_0x2a4c('0x8f')]({'membername':_0x38ac9a[_0x2a4c('0x41')],'UserId':_0x38ac9a['id'],'queue_name':_0x3ad766[_0x4c4143][_0x2a4c('0x41')],'VoiceQueueId':_0x3ad766[_0x4c4143]['id'],'interface':_[_0x2a4c('0x6c')](_0x38ac9a[_0x2a4c('0xb3')])?util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x38ac9a[_0x2a4c('0x41')]):_0x38ac9a[_0x2a4c('0xb3')],'paused':_0x38ac9a['voicePause']||![],'penalty':_0x273d31[_0x2a4c('0x63')][_0x2a4c('0xad')]||0x0});}return BPromise[_0x2a4c('0x91')](_0x322fa,function(_0x3aba6f){return db[_0x2a4c('0xb6')][_0x2a4c('0xb7')](_0x3aba6f);});}return _0x1e5354;});}})[_0x2a4c('0x33')](respondWithStatusCode(_0x2b95ce,null))[_0x2a4c('0x5e')](handleError(_0x2b95ce,null));};exports[_0x2a4c('0xb8')]=function(_0x23e43d,_0xfea979,_0x34598f){var _0x5b1401;return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x23e43d[_0x2a4c('0x64')]['id']},'attributes':['id','name',_0x2a4c('0x3e')]})[_0x2a4c('0x33')](handleEntityNotFound(_0xfea979,null))[_0x2a4c('0x33')](function(_0x49f625){if(_0x49f625){_0x5b1401=_0x49f625;if(!_0x23e43d['query']['channel']||!utils['isValidChannel'](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')])){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xa8'));}return _0x49f625[_0x2a4c('0xb9')+_[_0x2a4c('0xaa')](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')][_0x2a4c('0xab')]())+_0x2a4c('0xba')](_0x23e43d[_0x2a4c('0x4a')]['ids']);}})[_0x2a4c('0x33')](function(_0x9a1313){for(var _0x5ee07f=0x0;_0x5ee07f<_0x23e43d[_0x2a4c('0x4a')]['ids'][_0x2a4c('0x61')];_0x5ee07f+=0x1){var _0x571b4d={'UserId':_0x23e43d[_0x2a4c('0x64')]['id']};_0x571b4d[_['capitalize'](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')][_0x2a4c('0xab')]())+'QueueId']=_0x23e43d['query'][_0x2a4c('0xac')][_0x5ee07f];socket[_0x2a4c('0xb0')](_0x2a4c('0x81')+_[_0x2a4c('0xaa')](_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')][_0x2a4c('0xab')]())+_0x2a4c('0xbb'),_0x571b4d);}return _0x9a1313;})['then'](function(){if(_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xa4')]===_0x2a4c('0xb1')){return db[_0x2a4c('0xb6')][_0x2a4c('0x34')]({'where':{'UserId':_0x23e43d[_0x2a4c('0x64')]['id'],'VoiceQueueId':_0x23e43d[_0x2a4c('0x4a')][_0x2a4c('0xac')]},'individualHooks':!![]})[_0x2a4c('0x33')](function(){return _0x5b1401;});}return _0x5b1401;})['then'](respondWithStatusCode(_0xfea979,null))[_0x2a4c('0x5e')](handleError(_0xfea979,null));};exports['addAvatar']=function(_0x44d1ba,_0x2be84f,_0x132e29){_0x44d1ba[_0x2a4c('0x63')][_0x2a4c('0xbc')]=_0x44d1ba['file'][_0x2a4c('0xbd')];return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x44d1ba[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x2be84f,null))['then'](saveUpdates(_0x44d1ba[_0x2a4c('0x63')],null))[_0x2a4c('0x33')](respondWithResult(_0x2be84f,null))[_0x2a4c('0x5e')](handleError(_0x2be84f,null));};exports[_0x2a4c('0xbe')]=function(_0x228249,_0xdb9305,_0xf33a77){var _0x36848f=path[_0x2a4c('0xbf')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x228249[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0xbc')],'raw':!![]})['then'](handleEntityNotFound(_0xdb9305,null))['then'](function(_0x10f3b4){if(_0x10f3b4){if(_['isNil'](_0x10f3b4[_0x2a4c('0xbc')])){return _0xdb9305['download'](_0x36848f);}else{if(!fs['existsSync'](path[_0x2a4c('0xbf')](config[_0x2a4c('0xc0')],_0x2a4c('0xc1'),_0x10f3b4[_0x2a4c('0xbc')]))){return _0xdb9305['download'](_0x36848f);}return _0xdb9305[_0x2a4c('0xc2')](path[_0x2a4c('0xbf')](config['root'],_0x2a4c('0xc1'),_0x10f3b4['userpic']));}}})[_0x2a4c('0x5e')](handleError(_0xdb9305,null));};exports['getContacts']=function(_0x377687,_0x50ea26,_0x3c6e49){var _0x49f3b7={};var _0x41ba74={};var _0x5a8f9e;var _0x401d64;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x377687[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x50ea26,null))['then'](function(_0x298fcf){if(_0x298fcf){_0x5a8f9e=_0x298fcf;_0x41ba74['model']=_[_0x2a4c('0x4b')](db[_0x2a4c('0xc4')][_0x2a4c('0x45')]);_0x41ba74[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x377687['query']);_0x41ba74[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x41ba74[_0x2a4c('0x47')],_0x41ba74[_0x2a4c('0x4a')]);_0x49f3b7[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x41ba74['model'],qs[_0x2a4c('0x4e')](_0x377687[_0x2a4c('0x4a')]['fields']));_0x49f3b7['attributes']=_0x49f3b7[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x49f3b7['attributes']:_0x41ba74[_0x2a4c('0x47')];_0x49f3b7[_0x2a4c('0xc5')]=qs['sort'](_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x49f3b7[_0x2a4c('0x53')]=qs['filters'](_['pick'](_0x377687[_0x2a4c('0x4a')],_0x41ba74[_0x2a4c('0x4c')]));if(_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x49f3b7[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x49f3b7['where'],{'$or':_[_0x2a4c('0x3b')](_0x49f3b7['attributes'],function(_0x237282){var _0x8017e={};_0x8017e[_0x237282]={'$like':'%'+_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x8017e;})});}_0x49f3b7=_[_0x2a4c('0x55')]({},_0x49f3b7,_0x377687['options']);return _0x5a8f9e[_0x2a4c('0xc6')](_0x49f3b7);}})[_0x2a4c('0x33')](function(_0x5a38b2){if(_0x5a38b2){_0x401d64=_0x5a38b2[_0x2a4c('0x61')];if(_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x50')]('includeAll')){_0x49f3b7[_0x2a4c('0x5b')]=[{'model':db['CmList'],'as':_0x2a4c('0xc7'),'required':![]},{'model':db[_0x2a4c('0xc8')],'as':_0x2a4c('0xc9'),'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0xca')],'where':_0x377687[_0x2a4c('0x4a')][_0x2a4c('0xcb')]?{'id':_0x377687[_0x2a4c('0x4a')][_0x2a4c('0xcb')]}:undefined,'required':_0x377687[_0x2a4c('0x4a')][_0x2a4c('0xcb')]?!![]:![]}];}if(!_0x377687[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x49f3b7['limit']=qs[_0x2a4c('0x2d')](_0x377687['query'][_0x2a4c('0x2d')]);_0x49f3b7[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x377687[_0x2a4c('0x4a')]['offset']);}return _0x5a8f9e[_0x2a4c('0xc6')](_0x49f3b7);}})[_0x2a4c('0x33')](function(_0x4886b7){if(_0x4886b7){return _0x4886b7?{'count':_0x401d64,'rows':_0x4886b7}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x50ea26,null))['catch'](handleError(_0x50ea26,null));};exports[_0x2a4c('0xcc')]=function(_0x2491dd,_0x1ee943,_0x157994){var _0x50ace6;var _0x302cc9;var _0x525ca4={};var _0x523915;return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x2491dd[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0x3e')]})[_0x2a4c('0x33')](handleEntityNotFound(_0x1ee943,null))[_0x2a4c('0x33')](function(_0xd697f0){if(!utils['isValidChannel'](_0x2491dd['query'][_0x2a4c('0xa4')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}_0x50ace6=_0xd697f0;var _0x32bb8d={};_0x32bb8d[_0x2a4c('0x47')]=_['keys'](db[_[_0x2a4c('0xaa')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0xa4')])+'Queue'][_0x2a4c('0x45')]);_0x32bb8d['query']=_[_0x2a4c('0x4b')](_0x2491dd['query']);_0x32bb8d[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x32bb8d[_0x2a4c('0x47')],_0x32bb8d[_0x2a4c('0x4a')]);_0x525ca4[_0x2a4c('0x4f')]=_['intersection'](_0x32bb8d['model'],qs[_0x2a4c('0x4e')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x525ca4[_0x2a4c('0x4f')]=_0x525ca4[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x525ca4[_0x2a4c('0x4f')]:_0x32bb8d[_0x2a4c('0x47')];_0x525ca4['order']=qs[_0x2a4c('0x52')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x525ca4[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x2491dd['query'],_0x32bb8d[_0x2a4c('0x4c')]));if(_0x2491dd['query'][_0x2a4c('0x3a')]){_0x525ca4[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x525ca4[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x525ca4[_0x2a4c('0x4f')],function(_0x3a4287){var _0x1c8769={};_0x1c8769[_0x3a4287]={'$like':'%'+_0x2491dd[_0x2a4c('0x4a')]['filter']+'%'};return _0x1c8769;})});}_0x525ca4=_[_0x2a4c('0x55')]({},_0x525ca4,_0x2491dd[_0x2a4c('0x59')]);switch(_0x50ace6[_0x2a4c('0x3e')]){case'admin':return db[_[_0x2a4c('0xaa')](_0x2491dd['query'][_0x2a4c('0xa4')])+_0x2a4c('0xcd')][_0x2a4c('0x5c')](_0x525ca4);case _0x2a4c('0x81'):case'agent':return _0x50ace6[_0x2a4c('0x35')+_[_0x2a4c('0xaa')](_0x2491dd[_0x2a4c('0x4a')]['channel'])+_0x2a4c('0xba')](_0x525ca4);default:throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xce'));}})[_0x2a4c('0x33')](function(_0x3cdcaf){_0x523915=_0x3cdcaf['length'];if(!_0x2491dd['query'][_0x2a4c('0x50')]('nolimit')){_0x525ca4['limit']=qs[_0x2a4c('0x2d')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x525ca4[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}switch(_0x50ace6[_0x2a4c('0x3e')]){case _0x2a4c('0x36'):return db[_[_0x2a4c('0xaa')](_0x2491dd[_0x2a4c('0x4a')][_0x2a4c('0xa4')])+_0x2a4c('0xcd')][_0x2a4c('0x5c')](_0x525ca4);case _0x2a4c('0x81'):case _0x2a4c('0x38'):return _0x50ace6[_0x2a4c('0x35')+_[_0x2a4c('0xaa')](_0x2491dd['query'][_0x2a4c('0xa4')])+_0x2a4c('0xba')](_0x525ca4);}})['then'](function(_0x1cb290){return{'count':_0x523915,'rows':_0x1cb290};})['then'](respondWithResult(_0x1ee943,null))['catch'](handleError(_0x1ee943,null));};exports[_0x2a4c('0xcf')]=function(_0x71b3d6,_0x511793,_0x1eddb8){var _0x41bb03={};var _0x594f1c={};var _0x52aa4f;var _0x2b2d4c;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x71b3d6[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x511793,null))[_0x2a4c('0x33')](function(_0x55b2d1){if(_0x55b2d1){_0x52aa4f=_0x55b2d1;_0x594f1c[_0x2a4c('0x47')]=_['keys'](db[_0x2a4c('0xb6')]['rawAttributes']);_0x594f1c[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x71b3d6[_0x2a4c('0x4a')]);_0x594f1c[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x594f1c[_0x2a4c('0x47')],_0x594f1c[_0x2a4c('0x4a')]);_0x41bb03[_0x2a4c('0x4f')]=_['intersection'](_0x594f1c['model'],qs['fields'](_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x41bb03[_0x2a4c('0x4f')]=_0x41bb03['attributes']['length']?_0x41bb03['attributes']:_0x594f1c[_0x2a4c('0x47')];_0x41bb03[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x41bb03[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_['pick'](_0x71b3d6[_0x2a4c('0x4a')],_0x594f1c[_0x2a4c('0x4c')]));if(_0x71b3d6[_0x2a4c('0x4a')]['filter']){_0x41bb03[_0x2a4c('0x53')]=_['merge'](_0x41bb03['where'],{'$or':_['map'](_0x41bb03[_0x2a4c('0x4f')],function(_0x431ed2){var _0x3b2769={};_0x3b2769[_0x431ed2]={'$like':'%'+_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x3b2769;})});}_0x41bb03=_[_0x2a4c('0x55')]({},_0x41bb03,_0x71b3d6[_0x2a4c('0x59')]);return _0x52aa4f['getVoiceQueuesRt'](_0x41bb03);}})['then'](function(_0x1b10f8){if(_0x1b10f8){_0x2b2d4c=_0x1b10f8[_0x2a4c('0x61')];if(!_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x41bb03[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x71b3d6[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x41bb03[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x71b3d6['query'][_0x2a4c('0x2c')]);}return _0x52aa4f[_0x2a4c('0xcf')](_0x41bb03);}})['then'](function(_0x13f5ac){if(_0x13f5ac){return _0x13f5ac?{'count':_0x2b2d4c,'rows':_0x13f5ac}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x511793,null))['catch'](handleError(_0x511793,null));};exports['getGroups']=function(_0x3bc796,_0x22d571,_0x29d663){var _0x44b57d={};var _0x4f6a9f={};var _0x4e881b;var _0x10e7b4;return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x3bc796['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x22d571,null))[_0x2a4c('0x33')](function(_0x31cccb){if(_0x31cccb){_0x4e881b=_0x31cccb;_0x4f6a9f['model']=_['keys'](db[_0x2a4c('0xd0')][_0x2a4c('0x45')]);_0x4f6a9f['query']=_[_0x2a4c('0x4b')](_0x3bc796[_0x2a4c('0x4a')]);_0x4f6a9f[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x4f6a9f[_0x2a4c('0x47')],_0x4f6a9f[_0x2a4c('0x4a')]);_0x44b57d['attributes']=_[_0x2a4c('0x4d')](_0x4f6a9f[_0x2a4c('0x47')],qs['fields'](_0x3bc796['query'][_0x2a4c('0x4e')]));_0x44b57d[_0x2a4c('0x4f')]=_0x44b57d[_0x2a4c('0x4f')]['length']?_0x44b57d[_0x2a4c('0x4f')]:_0x4f6a9f[_0x2a4c('0x47')];_0x44b57d[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x3bc796['query'][_0x2a4c('0x52')]);_0x44b57d['where']=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x3bc796[_0x2a4c('0x4a')],_0x4f6a9f[_0x2a4c('0x4c')]));if(_0x3bc796[_0x2a4c('0x4a')]['filter']){_0x44b57d[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x44b57d['where'],{'$or':_['map'](_0x44b57d['attributes'],function(_0x385f1e){var _0x2c6f92={};_0x2c6f92[_0x385f1e]={'$like':'%'+_0x3bc796['query'][_0x2a4c('0x3a')]+'%'};return _0x2c6f92;})});}_0x44b57d=_[_0x2a4c('0x55')]({},_0x44b57d,_0x3bc796['options']);return _0x4e881b[_0x2a4c('0xd1')](_0x44b57d);}})[_0x2a4c('0x33')](function(_0xbd010){if(_0xbd010){_0x10e7b4=_0xbd010[_0x2a4c('0x61')];if(!_0x3bc796['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x44b57d[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x3bc796[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x44b57d[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x3bc796[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x4e881b[_0x2a4c('0xd1')](_0x44b57d);}})[_0x2a4c('0x33')](function(_0x212a80){if(_0x212a80){return _0x212a80?{'count':_0x10e7b4,'rows':_0x212a80}:null;}})['then'](respondWithResult(_0x22d571,null))[_0x2a4c('0x5e')](handleError(_0x22d571,null));};exports[_0x2a4c('0xd2')]=function(_0x24dfcb,_0x215c36,_0x422da6){var _0xb34686={'raw':!![],'where':{}};var _0x5c13ac={};var _0x3f7146={'count':0x0,'rows':[]};return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x24dfcb['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x215c36,null))[_0x2a4c('0x33')](function(_0x14580c){if(_0x14580c){_0x5c13ac[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xd3')][_0x2a4c('0x45')]);_0x5c13ac[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x24dfcb[_0x2a4c('0x4a')]);_0x5c13ac[_0x2a4c('0x4c')]=_['intersection'](_0x5c13ac[_0x2a4c('0x47')],_0x5c13ac[_0x2a4c('0x4a')]);_0xb34686[_0x2a4c('0x4f')]=_['intersection'](_0x5c13ac['model'],qs[_0x2a4c('0x4e')](_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0xb34686[_0x2a4c('0x4f')]=_0xb34686[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0xb34686['attributes']:_0x5c13ac[_0x2a4c('0x47')];if(!_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0xb34686[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x24dfcb[_0x2a4c('0x4a')]['limit']);_0xb34686['offset']=qs['offset'](_0x24dfcb[_0x2a4c('0x4a')]['offset']);}_0xb34686['order']=qs[_0x2a4c('0x52')](_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0xb34686[_0x2a4c('0x53')]=qs['filters'](_[_0x2a4c('0x54')](_0x24dfcb[_0x2a4c('0x4a')],_0x5c13ac[_0x2a4c('0x4c')]));_0xb34686[_0x2a4c('0x53')][_0x2a4c('0xd4')]=_0x14580c['id'];if(_0x24dfcb['query']['filter']){_0xb34686[_0x2a4c('0x53')]=_['merge'](_0xb34686[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0xb34686['attributes'],function(_0x2b32e0){var _0x1e942b={};_0x1e942b[_0x2b32e0]={'$like':'%'+_0x24dfcb['query'][_0x2a4c('0x3a')]+'%'};return _0x1e942b;})});}_0xb34686=_[_0x2a4c('0x55')]({},_0xb34686,_0x24dfcb['options']);return db[_0x2a4c('0xd3')][_0x2a4c('0x2b')]({'where':_0xb34686['where']})[_0x2a4c('0x33')](function(_0x2f2a63){_0x3f7146['count']=_0x2f2a63;if(_0x24dfcb[_0x2a4c('0x4a')][_0x2a4c('0x5a')]){_0xb34686[_0x2a4c('0x5b')]=[{'all':!![]}];}return db[_0x2a4c('0xd3')][_0x2a4c('0x5c')](_0xb34686);})['then'](function(_0x14c5da){_0x3f7146[_0x2a4c('0x5d')]=_0x14c5da;return _0x3f7146;});}})['then'](respondWithFilteredResult(_0x215c36,_0xb34686))[_0x2a4c('0x5e')](handleError(_0x215c36,null));};exports[_0x2a4c('0xd5')]=function(_0x1f4d82,_0x1fab8a,_0x27c954){var _0x327705={'raw':!![],'where':{}};var _0x423945={};var _0xfebdb9={'count':0x0,'rows':[]};return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x1f4d82['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x1fab8a,null))[_0x2a4c('0x33')](function(_0x140421){if(_0x140421){_0x423945[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db['ScreenRecording'][_0x2a4c('0x45')]);_0x423945['query']=_['keys'](_0x1f4d82[_0x2a4c('0x4a')]);_0x423945[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x423945[_0x2a4c('0x47')],_0x423945[_0x2a4c('0x4a')]);_0x327705['attributes']=_[_0x2a4c('0x4d')](_0x423945['model'],qs[_0x2a4c('0x4e')](_0x1f4d82[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x327705[_0x2a4c('0x4f')]=_0x327705[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x327705[_0x2a4c('0x4f')]:_0x423945[_0x2a4c('0x47')];if(!_0x1f4d82['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x327705[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x1f4d82[_0x2a4c('0x4a')]['limit']);_0x327705['offset']=qs['offset'](_0x1f4d82[_0x2a4c('0x4a')]['offset']);}_0x327705[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1f4d82[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x327705[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x1f4d82[_0x2a4c('0x4a')],_0x423945[_0x2a4c('0x4c')]));_0x327705['where'][_0x2a4c('0xd4')]=_0x140421['id'];if(_0x1f4d82[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x327705[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x327705['where'],{'$or':_[_0x2a4c('0x3b')](_0x327705['attributes'],function(_0x648f56){var _0x12306c={};_0x12306c[_0x648f56]={'$like':'%'+_0x1f4d82[_0x2a4c('0x4a')]['filter']+'%'};return _0x12306c;})});}_0x327705=_[_0x2a4c('0x55')]({},_0x327705,_0x1f4d82['options']);return db[_0x2a4c('0xd6')]['count']({'where':_0x327705[_0x2a4c('0x53')]})[_0x2a4c('0x33')](function(_0x4091a4){_0xfebdb9[_0x2a4c('0x2b')]=_0x4091a4;if(_0x1f4d82[_0x2a4c('0x4a')]['includeAll']){_0x327705['include']=[{'all':!![]}];}return db[_0x2a4c('0xd6')][_0x2a4c('0x5c')](_0x327705);})['then'](function(_0x37d723){_0xfebdb9[_0x2a4c('0x5d')]=_0x37d723;return _0xfebdb9;});}})['then'](respondWithFilteredResult(_0x1fab8a,_0x327705))[_0x2a4c('0x5e')](handleError(_0x1fab8a,null));};exports['getChatInteractions']=function(_0x439dd4,_0x29e43b,_0x53d6c){var _0x3898cc={};var _0x27861c={};var _0xa5d9a6;var _0x99ef25;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x439dd4[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x29e43b,null))['then'](function(_0x2ce345){if(_0x2ce345){_0xa5d9a6=_0x2ce345;_0x27861c[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xd7')]['rawAttributes']);_0x27861c[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x439dd4['query']);_0x27861c[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x27861c[_0x2a4c('0x47')],_0x27861c['query']);_0x3898cc[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x27861c[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x439dd4[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x3898cc[_0x2a4c('0x4f')]=_0x3898cc[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x3898cc['attributes']:_0x27861c[_0x2a4c('0x47')];_0x3898cc[_0x2a4c('0xc5')]=qs['sort'](_0x439dd4[_0x2a4c('0x4a')]['sort']);_0x3898cc['where']=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x439dd4[_0x2a4c('0x4a')],_0x27861c[_0x2a4c('0x4c')]));if(_0x439dd4[_0x2a4c('0x4a')]['filter']){_0x3898cc[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x3898cc[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x3898cc[_0x2a4c('0x4f')],function(_0x5e229d){var _0xbb601e={};_0xbb601e[_0x5e229d]={'$like':'%'+_0x439dd4[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0xbb601e;})});}_0x3898cc=_[_0x2a4c('0x55')]({},_0x3898cc,_0x439dd4['options']);return _0xa5d9a6[_0x2a4c('0xd8')](_0x3898cc);}})[_0x2a4c('0x33')](function(_0x1c7b05){if(_0x1c7b05){_0x99ef25=_0x1c7b05[_0x2a4c('0x61')];if(!_0x439dd4[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x3898cc['limit']=qs['limit'](_0x439dd4[_0x2a4c('0x4a')]['limit']);_0x3898cc['offset']=qs[_0x2a4c('0x2c')](_0x439dd4['query'][_0x2a4c('0x2c')]);}return _0xa5d9a6['getChatInteractions'](_0x3898cc);}})[_0x2a4c('0x33')](function(_0x368ce9){if(_0x368ce9){return _0x368ce9?{'count':_0x99ef25,'rows':_0x368ce9}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x29e43b,null))[_0x2a4c('0x5e')](handleError(_0x29e43b,null));};exports[_0x2a4c('0xd9')]=function(_0x3a7178,_0x535201,_0x53ccf3){var _0x1eca31={};var _0x35f28d={};var _0x581321;var _0x4ec7b2;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x3a7178[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x535201,null))[_0x2a4c('0x33')](function(_0x38e334){if(_0x38e334){_0x581321=_0x38e334;_0x35f28d[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xda')][_0x2a4c('0x45')]);_0x35f28d[_0x2a4c('0x4a')]=_['keys'](_0x3a7178[_0x2a4c('0x4a')]);_0x35f28d[_0x2a4c('0x4c')]=_['intersection'](_0x35f28d[_0x2a4c('0x47')],_0x35f28d['query']);_0x1eca31[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x35f28d[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x1eca31[_0x2a4c('0x4f')]=_0x1eca31['attributes'][_0x2a4c('0x61')]?_0x1eca31['attributes']:_0x35f28d[_0x2a4c('0x47')];_0x1eca31['order']=qs[_0x2a4c('0x52')](_0x3a7178['query'][_0x2a4c('0x52')]);_0x1eca31[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x3a7178[_0x2a4c('0x4a')],_0x35f28d['filters']));if(_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x1eca31['where']=_[_0x2a4c('0x55')](_0x1eca31[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x1eca31[_0x2a4c('0x4f')],function(_0x4617a7){var _0x2c3a05={};_0x2c3a05[_0x4617a7]={'$like':'%'+_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x2c3a05;})});}_0x1eca31=_[_0x2a4c('0x55')]({},_0x1eca31,_0x3a7178[_0x2a4c('0x59')]);return _0x581321[_0x2a4c('0xd9')](_0x1eca31);}})[_0x2a4c('0x33')](function(_0x54e7a8){if(_0x54e7a8){_0x4ec7b2=_0x54e7a8[_0x2a4c('0x61')];if(!_0x3a7178['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x1eca31['limit']=qs['limit'](_0x3a7178['query'][_0x2a4c('0x2d')]);_0x1eca31[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x3a7178[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x581321[_0x2a4c('0xd9')](_0x1eca31);}})[_0x2a4c('0x33')](function(_0x677040){if(_0x677040){return _0x677040?{'count':_0x4ec7b2,'rows':_0x677040}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x535201,null))[_0x2a4c('0x5e')](handleError(_0x535201,null));};exports[_0x2a4c('0xdb')]=function(_0x1a2aca,_0xdc56cf,_0x133eba){var _0x78037b={'raw':!![],'where':{}};var _0x38dddf={};var _0x5279cc={'count':0x0,'rows':[]};return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x1a2aca['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0xdc56cf,null))['then'](function(_0x5a3ed3){if(_0x5a3ed3){_0x38dddf[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xdc')]['rawAttributes']);_0x38dddf[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x1a2aca[_0x2a4c('0x4a')]);_0x38dddf['filters']=_['intersection'](_0x38dddf[_0x2a4c('0x47')],_0x38dddf[_0x2a4c('0x4a')]);_0x78037b[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x38dddf[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x78037b[_0x2a4c('0x4f')]=_0x78037b[_0x2a4c('0x4f')]['length']?_0x78037b[_0x2a4c('0x4f')]:_0x38dddf[_0x2a4c('0x47')];if(!_0x1a2aca['query'][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x78037b[_0x2a4c('0x2d')]=qs['limit'](_0x1a2aca['query'][_0x2a4c('0x2d')]);_0x78037b[_0x2a4c('0x2c')]=qs['offset'](_0x1a2aca['query'][_0x2a4c('0x2c')]);}_0x78037b[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x78037b[_0x2a4c('0x53')]=qs['filters'](_['pick'](_0x1a2aca[_0x2a4c('0x4a')],_0x38dddf[_0x2a4c('0x4c')]));_0x78037b[_0x2a4c('0x53')]['UserId']=_0x5a3ed3['id'];if(_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x78037b['where']=_['merge'](_0x78037b[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x78037b['attributes'],function(_0x4c7650){var _0x148321={};_0x148321[_0x4c7650]={'$like':'%'+_0x1a2aca[_0x2a4c('0x4a')]['filter']+'%'};return _0x148321;})});}_0x78037b=_[_0x2a4c('0x55')]({},_0x78037b,_0x1a2aca['options']);return db[_0x2a4c('0xdc')]['count']({'where':_0x78037b[_0x2a4c('0x53')]})['then'](function(_0x3401fc){_0x5279cc[_0x2a4c('0x2b')]=_0x3401fc;if(_0x1a2aca[_0x2a4c('0x4a')][_0x2a4c('0x5a')]){_0x78037b['include']=[{'all':!![]}];}return db['MailInteraction'][_0x2a4c('0x5c')](_0x78037b);})[_0x2a4c('0x33')](function(_0xeffb76){_0x5279cc['rows']=_0xeffb76;return _0x5279cc;});}})[_0x2a4c('0x33')](respondWithFilteredResult(_0xdc56cf,_0x78037b))['catch'](handleError(_0xdc56cf,null));};exports[_0x2a4c('0xdd')]=function(_0x1ec760,_0x9f1f7b,_0x3d131b){var _0x3ab224={};var _0x5b89ae={};var _0xcf7a30;var _0x24e7e5;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x1ec760[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x9f1f7b,null))[_0x2a4c('0x33')](function(_0x576811){if(_0x576811){_0xcf7a30=_0x576811;_0x5b89ae[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db['SmsInteraction'][_0x2a4c('0x45')]);_0x5b89ae[_0x2a4c('0x4a')]=_['keys'](_0x1ec760[_0x2a4c('0x4a')]);_0x5b89ae['filters']=_[_0x2a4c('0x4d')](_0x5b89ae[_0x2a4c('0x47')],_0x5b89ae[_0x2a4c('0x4a')]);_0x3ab224[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x5b89ae[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x1ec760[_0x2a4c('0x4a')]['fields']));_0x3ab224[_0x2a4c('0x4f')]=_0x3ab224[_0x2a4c('0x4f')]['length']?_0x3ab224[_0x2a4c('0x4f')]:_0x5b89ae[_0x2a4c('0x47')];_0x3ab224[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1ec760['query'][_0x2a4c('0x52')]);_0x3ab224[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x1ec760[_0x2a4c('0x4a')],_0x5b89ae[_0x2a4c('0x4c')]));if(_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x3ab224[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x3ab224['where'],{'$or':_[_0x2a4c('0x3b')](_0x3ab224[_0x2a4c('0x4f')],function(_0x50d5aa){var _0x37df97={};_0x37df97[_0x50d5aa]={'$like':'%'+_0x1ec760[_0x2a4c('0x4a')]['filter']+'%'};return _0x37df97;})});}_0x3ab224=_[_0x2a4c('0x55')]({},_0x3ab224,_0x1ec760[_0x2a4c('0x59')]);return _0xcf7a30['getSmsInteractions'](_0x3ab224);}})['then'](function(_0xd058b2){if(_0xd058b2){_0x24e7e5=_0xd058b2['length'];if(!_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x50')](_0x2a4c('0x51'))){_0x3ab224[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x3ab224[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x1ec760[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0xcf7a30[_0x2a4c('0xdd')](_0x3ab224);}})[_0x2a4c('0x33')](function(_0x54841f){if(_0x54841f){return _0x54841f?{'count':_0x24e7e5,'rows':_0x54841f}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x9f1f7b,null))[_0x2a4c('0x5e')](handleError(_0x9f1f7b,null));};exports[_0x2a4c('0xde')]=function(_0x28f45e,_0xe2a6e3,_0x7e0104){var _0x26d77c={};var _0x48ed4b={};var _0x54a260;var _0x5e1078;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0x28f45e[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0xe2a6e3,null))[_0x2a4c('0x33')](function(_0x1bb830){if(_0x1bb830){_0x54a260=_0x1bb830;_0x48ed4b['model']=_[_0x2a4c('0x4b')](db[_0x2a4c('0xdf')]['rawAttributes']);_0x48ed4b[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x28f45e['query']);_0x48ed4b[_0x2a4c('0x4c')]=_['intersection'](_0x48ed4b[_0x2a4c('0x47')],_0x48ed4b['query']);_0x26d77c[_0x2a4c('0x4f')]=_[_0x2a4c('0x4d')](_0x48ed4b[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x28f45e[_0x2a4c('0x4a')]['fields']));_0x26d77c[_0x2a4c('0x4f')]=_0x26d77c[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x26d77c[_0x2a4c('0x4f')]:_0x48ed4b[_0x2a4c('0x47')];_0x26d77c[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x26d77c[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x28f45e[_0x2a4c('0x4a')],_0x48ed4b['filters']));if(_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x26d77c[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x26d77c[_0x2a4c('0x53')],{'$or':_['map'](_0x26d77c[_0x2a4c('0x4f')],function(_0x4edc91){var _0x4c6dbc={};_0x4c6dbc[_0x4edc91]={'$like':'%'+_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0x4c6dbc;})});}_0x26d77c=_['merge']({},_0x26d77c,_0x28f45e[_0x2a4c('0x59')]);return _0x54a260[_0x2a4c('0xde')](_0x26d77c);}})[_0x2a4c('0x33')](function(_0x5acd06){if(_0x5acd06){_0x5e1078=_0x5acd06[_0x2a4c('0x61')];if(!_0x28f45e[_0x2a4c('0x4a')]['hasOwnProperty'](_0x2a4c('0x51'))){_0x26d77c[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x2d')]);_0x26d77c['offset']=qs['offset'](_0x28f45e[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x54a260[_0x2a4c('0xde')](_0x26d77c);}})[_0x2a4c('0x33')](function(_0x351d3c){if(_0x351d3c){return _0x351d3c?{'count':_0x5e1078,'rows':_0x351d3c}:null;}})[_0x2a4c('0x33')](respondWithResult(_0xe2a6e3,null))[_0x2a4c('0x5e')](handleError(_0xe2a6e3,null));};exports[_0x2a4c('0xe0')]=function(_0xb34b25,_0x214b37,_0x1828d1){var _0x44fe0c={};var _0x4b4a2f={};var _0x251a0b;var _0x5111be;return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0xb34b25['params']['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x214b37,null))[_0x2a4c('0x33')](function(_0x3e4301){if(_0x3e4301){_0x251a0b=_0x3e4301;_0x4b4a2f[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0xe1')][_0x2a4c('0x45')]);_0x4b4a2f[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0xb34b25[_0x2a4c('0x4a')]);_0x4b4a2f['filters']=_[_0x2a4c('0x4d')](_0x4b4a2f[_0x2a4c('0x47')],_0x4b4a2f[_0x2a4c('0x4a')]);_0x44fe0c[_0x2a4c('0x4f')]=_['intersection'](_0x4b4a2f['model'],qs['fields'](_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x44fe0c[_0x2a4c('0x4f')]=_0x44fe0c[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x44fe0c[_0x2a4c('0x4f')]:_0x4b4a2f[_0x2a4c('0x47')];_0x44fe0c[_0x2a4c('0xc5')]=qs['sort'](_0xb34b25['query']['sort']);_0x44fe0c[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_['pick'](_0xb34b25[_0x2a4c('0x4a')],_0x4b4a2f[_0x2a4c('0x4c')]));if(_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x44fe0c['where']=_[_0x2a4c('0x55')](_0x44fe0c['where'],{'$or':_[_0x2a4c('0x3b')](_0x44fe0c[_0x2a4c('0x4f')],function(_0x2d1d6f){var _0x4cf57d={};_0x4cf57d[_0x2d1d6f]={'$like':'%'+_0xb34b25[_0x2a4c('0x4a')]['filter']+'%'};return _0x4cf57d;})});}_0x44fe0c=_[_0x2a4c('0x55')]({},_0x44fe0c,_0xb34b25[_0x2a4c('0x59')]);return _0x251a0b['getWhatsappInteractions'](_0x44fe0c);}})[_0x2a4c('0x33')](function(_0xadd4f5){if(_0xadd4f5){_0x5111be=_0xadd4f5[_0x2a4c('0x61')];if(!_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x50')]('nolimit')){_0x44fe0c[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0xb34b25[_0x2a4c('0x4a')]['limit']);_0x44fe0c[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0xb34b25[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x251a0b[_0x2a4c('0xe0')](_0x44fe0c);}})[_0x2a4c('0x33')](function(_0x2b3e99){if(_0x2b3e99){return _0x2b3e99?{'count':_0x5111be,'rows':_0x2b3e99}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x214b37,null))[_0x2a4c('0x5e')](handleError(_0x214b37,null));};exports['login']=function(_0x43b85f,_0x59a92c,_0x223ba2){var _0x24adfe;var _0x19231d;var _0x47ba54;var _0x39aba1=!_[_0x2a4c('0x6c')](_0x43b85f['params']['id'])?_0x43b85f[_0x2a4c('0x64')]['id']:!_[_0x2a4c('0x6c')](_0x43b85f['user']['id'])?_0x43b85f[_0x2a4c('0x81')]['id']:null;return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x39aba1,'role':{'$or':[_0x2a4c('0x36'),_0x2a4c('0x81'),_0x2a4c('0x38')]}},'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0xe2'),_0x2a4c('0xe3'),_0x2a4c('0x3e'),_0x2a4c('0x68'),_0x2a4c('0xa6')]})['then'](function(_0x1826db){if(_0x1826db){if(_0x1826db['role']===_0x2a4c('0x38')){_0x24adfe=_0x1826db;if(_0x43b85f[_0x2a4c('0x63')]['interface']){_0x47ba54=util[_0x2a4c('0xb4')](_0x2a4c('0xe4'),_0x24adfe[_0x43b85f[_0x2a4c('0x63')][_0x2a4c('0xb3')]]);}else if(_0x43b85f['body'][_0x2a4c('0xe5')]){_0x47ba54=util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x43b85f[_0x2a4c('0x63')]['intrf']);}else{_0x47ba54=util[_0x2a4c('0xb4')]('SIP/%s',_0x24adfe['name']);}socket['to'](util['format'](_0x2a4c('0xe6'),_0x24adfe[_0x2a4c('0x41')]))[_0x2a4c('0xb0')]('user:forcelogout',{'ip':_0x43b85f[_0x2a4c('0xe7')]['x-forwarded-for']||_0x43b85f['connection'][_0x2a4c('0xe8')]||_0x43b85f['socket'][_0x2a4c('0xe8')]||_0x43b85f[_0x2a4c('0xe9')][_0x2a4c('0xea')][_0x2a4c('0xe8')]});return db[_0x2a4c('0xb6')]['destroy']({'where':{'membername':_0x24adfe[_0x2a4c('0x41')]},'individualHooks':!![]});}}else{throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2a4c('0x33')](function(){if(_0x24adfe){return _0x24adfe[_0x2a4c('0xeb')]({'raw':!![]});}})['then'](function(_0x5db196){if(_0x24adfe){var _0x10cff6=[];if(_0x5db196){_0x19231d=_0x5db196;if(_0x19231d['length']){for(var _0x37bbf0=0x0;_0x37bbf0<_0x19231d['length'];_0x37bbf0++){_0x10cff6[_0x2a4c('0x8f')]({'membername':_0x24adfe[_0x2a4c('0x41')],'UserId':_0x24adfe['id'],'queue_name':_0x19231d[_0x37bbf0][_0x2a4c('0x41')],'VoiceQueueId':_0x19231d[_0x37bbf0]['id'],'interface':_0x47ba54,'paused':_0x24adfe['loginInPause']||![],'penalty':_0x19231d[_0x37bbf0][_0x2a4c('0xec')]||0x0});}return BPromise[_0x2a4c('0x91')](_0x10cff6,function(_0x440114){return db[_0x2a4c('0xb6')]['upsert'](_0x440114);});}}}})['then'](function(){if(_0x24adfe){return db[_0x2a4c('0xed')][_0x2a4c('0x5c')]({'where':{'membername':_0x24adfe[_0x2a4c('0x41')],'exitAt':null}});}})[_0x2a4c('0x33')](function(_0x4a5fae){if(_0x24adfe){var _0x4b2f7b=[];_0x4a5fae[_0x2a4c('0xee')](function(_0x4a3cf8){_0x4b2f7b[_0x2a4c('0x8f')](_0x4a3cf8['update']({'exitAt':moment()['format'](_0x2a4c('0xef'))}));});return BPromise[_0x2a4c('0x90')](_0x4b2f7b);}})['then'](function(){if(_0x24adfe){var _0x1024bd=[];var _0x473077=[];var _0x72e480=utils[_0x2a4c('0xf0')]();var _0x3ed45d={'membername':_0x24adfe['name'],'interface':_0x47ba54,'enterAt':moment()['format'](_0x2a4c('0xef')),'role':_0x24adfe['role'],'internal':_0x24adfe[_0x2a4c('0x68')]};_0x72e480['forEach'](function(_0x39b95b){_0x1024bd[_0x2a4c('0x8f')](_[_0x2a4c('0x55')]({'channel':_0x39b95b,'type':_0x2a4c('0xf1'),'data1':_0x43b85f[_0x2a4c('0x63')][_0x2a4c('0xf2')],'data2':_0x47ba54},_0x3ed45d));if(_0x24adfe['loginInPause']){_0x473077['push'](_[_0x2a4c('0x55')]({'channel':_0x39b95b,'type':_0x2a4c('0xf3'),'data1':_0x2a4c('0xf4')},_0x3ed45d));}});return db[_0x2a4c('0xed')][_0x2a4c('0x8d')](_0x1024bd[_0x2a4c('0xf5')](_0x473077),{'individualHooks':!![]});}})[_0x2a4c('0x33')](function(){if(_0x24adfe){return _0x24adfe['update']({'online':!![],'lastLoginAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef')),'voicePause':_0x24adfe[_0x2a4c('0xa6')]||![],'mailPause':_0x24adfe[_0x2a4c('0xa6')]||![],'chatPause':_0x24adfe[_0x2a4c('0xa6')]||![],'faxPause':_0x24adfe[_0x2a4c('0xa6')]||![],'smsPause':_0x24adfe[_0x2a4c('0xa6')]||![],'openchannelPause':_0x24adfe[_0x2a4c('0xa6')]||![],'whatsappPause':_0x24adfe['loginInPause']||![],'pauseType':_0x24adfe['loginInPause']?'LOGININPAUSE':null,'interface':_0x47ba54,'lastPauseAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef'))});}})['then'](function(_0xac1d21){if(_0x43b85f[_0x2a4c('0xf6')]){return _0x223ba2();}else{return BPromise[_0x2a4c('0xf7')](_0xac1d21)['then'](respondWithResult(_0x59a92c,null));}})[_0x2a4c('0x5e')](handleError(_0x59a92c,null));};exports[_0x2a4c('0xf8')]=function(_0x27127d,_0x60496d,_0xc986d9){var _0x529068;return db[_0x2a4c('0x44')][_0x2a4c('0x62')]({'where':{'id':_0x27127d['params']['id'],'role':_0x2a4c('0x38')},'attributes':['id',_0x2a4c('0x41'),'role']})[_0x2a4c('0x33')](handleEntityNotFound(_0x60496d,null))[_0x2a4c('0x33')](function(_0x3f3f29){if(_0x3f3f29){_0x529068=_0x3f3f29;return db[_0x2a4c('0xb6')][_0x2a4c('0x34')]({'where':{'membername':_0x529068[_0x2a4c('0x41')]},'individualHooks':!![]});}})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xed')]['findAll']({'where':{'membername':_0x529068[_0x2a4c('0x41')],'exitAt':null}});})['then'](function(_0x217509){var _0x4f9eaf=[];_0x217509[_0x2a4c('0xee')](function(_0x51fb40){_0x4f9eaf['push'](_0x51fb40[_0x2a4c('0x32')]({'exitAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef'))}));});return BPromise['all'](_0x4f9eaf);})[_0x2a4c('0x33')](function(){return _0x529068[_0x2a4c('0x32')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2a4c('0x33')](respondWithResult(_0x60496d,null))[_0x2a4c('0x5e')](handleError(_0x60496d,null));};exports['pause']=function(_0x1a93a5,_0x5215d6,_0x2aa204){var _0x3b9d27;return db[_0x2a4c('0xb6')][_0x2a4c('0x32')]({'paused':0x1},{'where':{'UserId':_0x1a93a5[_0x2a4c('0x64')]['id']},'individualHooks':!![]})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0x44')]['find']({'where':{'id':_0x1a93a5['params']['id'],'role':'agent'},'attributes':['id',_0x2a4c('0x41'),'role',_0x2a4c('0x68'),_0x2a4c('0xb3')]});})[_0x2a4c('0x33')](handleEntityNotFound(_0x5215d6,null))[_0x2a4c('0x33')](function(_0x39b96b){if(_0x39b96b){_0x3b9d27=_0x39b96b;return respondWithRpcPromise(_0x2a4c('0xf9'),'pause',{'id':_0x3b9d27['id'],'name':_0x3b9d27[_0x2a4c('0x41')],'pause':!![]});}})['then'](function(){if(_0x3b9d27){return db[_0x2a4c('0xed')]['findAll']({'where':{'membername':_0x3b9d27['name'],'type':_0x2a4c('0xf3'),'exitAt':null}});}})['then'](function(_0x4d2dac){if(_0x4d2dac[_0x2a4c('0x61')]){var _0xe92ea9=moment()[_0x2a4c('0xb4')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x31bc04=0x0,_0x366676=_0x4d2dac[_0x2a4c('0x61')];_0x31bc04<_0x366676;_0x31bc04++){_0x4d2dac[_0x31bc04]['updateAttributes']({'exitAt':_0xe92ea9});}}})[_0x2a4c('0x33')](function(){var _0x2b03db=[];var _0x324843=utils[_0x2a4c('0xf0')]();_0x324843[_0x2a4c('0xee')](function(_0x379c45){_0x2b03db[_0x2a4c('0x8f')]({'channel':_0x379c45,'membername':_0x3b9d27['name'],'interface':_[_0x2a4c('0x6c')](_0x3b9d27[_0x2a4c('0xb3')])?util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x3b9d27[_0x2a4c('0x41')]):_0x3b9d27[_0x2a4c('0xb3')],'type':_0x2a4c('0xf3'),'enterAt':moment()[_0x2a4c('0xb4')](_0x2a4c('0xef')),'data1':_0x1a93a5[_0x2a4c('0x63')]['type']||_0x2a4c('0xfa'),'role':_0x3b9d27[_0x2a4c('0x3e')],'internal':_0x3b9d27[_0x2a4c('0x68')]});});return db[_0x2a4c('0xed')]['bulkCreate'](_0x2b03db,{'individualHooks':!![]});})[_0x2a4c('0x33')](function(){return _0x3b9d27[_0x2a4c('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a93a5[_0x2a4c('0x63')][_0x2a4c('0x46')]||_0x2a4c('0xfa'),'lastPauseAt':moment()['format'](_0x2a4c('0xef'))});})[_0x2a4c('0x33')](respondWithResult(_0x5215d6,null))[_0x2a4c('0x5e')](handleError(_0x5215d6,null));};exports['unpause']=function(_0x3dbffc,_0x14b55d,_0x15c992){var _0x5107a1;return db['User'][_0x2a4c('0x62')]({'where':{'id':_0x3dbffc[_0x2a4c('0x64')]['id']},'attributes':['id',_0x2a4c('0x41'),_0x2a4c('0x3e'),_0x2a4c('0xfb'),'mailPause',_0x2a4c('0xfc'),_0x2a4c('0xfd'),'openchannelPause',_0x2a4c('0xfe'),'whatsapppause',_0x2a4c('0xff'),_0x2a4c('0x100')]})[_0x2a4c('0x33')](handleEntityNotFound(_0x14b55d,null))[_0x2a4c('0x33')](function(_0x593e91){if(_0x593e91){_0x5107a1=_0x593e91;if(_0x3dbffc[_0x2a4c('0x63')]['channel']&&!utils['isValidChannel'](_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')])){throw new db[(_0x2a4c('0x95'))][(_0x2a4c('0x97'))](_0x2a4c('0xa8'));}switch(_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')]){case'voice':return respondWithRpcPromise(_0x2a4c('0xf9'),_0x2a4c('0x101'),{'id':_0x5107a1['id'],'name':_0x5107a1[_0x2a4c('0x41')],'pause':![]})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xb6')][_0x2a4c('0x32')]({'paused':0x0},{'where':{'UserId':_0x5107a1['id']},'individualHooks':!![]});})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xed')]['find']({'where':{'channel':_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')],'membername':_0x5107a1['name'],'type':_0x2a4c('0xf3'),'exitAt':null}});})[_0x2a4c('0x33')](function(_0x50642d){if(_0x50642d){return _0x50642d[_0x2a4c('0x32')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2a4c('0x102')},{'individualHooks':!![]});}return null;})[_0x2a4c('0x33')](function(){return _0x5107a1['update']({'voicePause':![]});});case'mail':case _0x2a4c('0x103'):case _0x2a4c('0x104'):case'sms':case _0x2a4c('0x105'):case _0x2a4c('0x106'):return db[_0x2a4c('0xed')][_0x2a4c('0x62')]({'where':{'channel':_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')],'membername':_0x5107a1[_0x2a4c('0x41')],'type':'PAUSE','exitAt':null}})[_0x2a4c('0x33')](function(_0x23b546){if(_0x23b546){return _0x23b546['update']({'exitAt':moment()[_0x2a4c('0xb4')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2a4c('0x102')},{'individualHooks':!![]});}return null;})[_0x2a4c('0x33')](function(){var _0x656f94={};_['set'](_0x656f94,util[_0x2a4c('0xb4')](_0x2a4c('0x107'),_0x3dbffc[_0x2a4c('0x63')][_0x2a4c('0xa4')],_0x2a4c('0x108')),![]);return _0x5107a1[_0x2a4c('0x32')](_0x656f94);});default:return respondWithRpcPromise(_0x2a4c('0xf9'),_0x2a4c('0x101'),{'id':_0x5107a1['id'],'name':_0x5107a1[_0x2a4c('0x41')],'pause':![]})[_0x2a4c('0x33')](function(){return db[_0x2a4c('0xb6')][_0x2a4c('0x32')]({'paused':0x0},{'where':{'UserId':_0x5107a1['id']}});})[_0x2a4c('0x33')](function(){return db['MemberReport'][_0x2a4c('0x5c')]({'where':{'membername':_0x5107a1[_0x2a4c('0x41')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x392d9e){var _0x2118fe=[];_0x392d9e['forEach'](function(_0x288a63){_0x2118fe[_0x2a4c('0x8f')](_0x288a63['update']({'exitAt':moment()[_0x2a4c('0xb4')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise[_0x2a4c('0x90')](_0x2118fe);})[_0x2a4c('0x33')](function(){return _0x5107a1['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2a4c('0x33')](respondWithResult(_0x14b55d,null))[_0x2a4c('0x5e')](handleError(_0x14b55d,null));};exports[_0x2a4c('0x109')]=function(_0x588061,_0x500945,_0x42a284){var _0x342bae={};var _0x583b16={};var _0x676aa7;var _0x528ee7;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x588061[_0x2a4c('0x64')]['id']}})['then'](handleEntityNotFound(_0x500945,null))['then'](function(_0x370fcf){if(_0x370fcf){_0x676aa7=_0x370fcf;_0x583b16['model']=_[_0x2a4c('0x4b')](db['Team'][_0x2a4c('0x45')]);_0x583b16[_0x2a4c('0x4a')]=_[_0x2a4c('0x4b')](_0x588061[_0x2a4c('0x4a')]);_0x583b16[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0x583b16[_0x2a4c('0x47')],_0x583b16[_0x2a4c('0x4a')]);_0x342bae[_0x2a4c('0x4f')]=_['intersection'](_0x583b16[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x342bae['attributes']=_0x342bae['attributes']['length']?_0x342bae['attributes']:_0x583b16['model'];_0x342bae[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x342bae[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_['pick'](_0x588061['query'],_0x583b16[_0x2a4c('0x4c')]));if(_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x342bae[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x342bae[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x342bae[_0x2a4c('0x4f')],function(_0x459e28){var _0x19e35b={};_0x19e35b[_0x459e28]={'$like':'%'+_0x588061['query'][_0x2a4c('0x3a')]+'%'};return _0x19e35b;})});}_0x342bae=_[_0x2a4c('0x55')]({},_0x342bae,_0x588061[_0x2a4c('0x59')]);return _0x676aa7[_0x2a4c('0x109')](_0x342bae);}})['then'](function(_0x92cb58){if(_0x92cb58){_0x528ee7=_0x92cb58[_0x2a4c('0x61')];if(!_0x588061[_0x2a4c('0x4a')]['hasOwnProperty'](_0x2a4c('0x51'))){_0x342bae[_0x2a4c('0x2d')]=qs[_0x2a4c('0x2d')](_0x588061['query'][_0x2a4c('0x2d')]);_0x342bae[_0x2a4c('0x2c')]=qs[_0x2a4c('0x2c')](_0x588061[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);}return _0x676aa7[_0x2a4c('0x109')](_0x342bae);}})[_0x2a4c('0x33')](function(_0x565772){if(_0x565772){return _0x565772?{'count':_0x528ee7,'rows':_0x565772}:null;}})[_0x2a4c('0x33')](respondWithResult(_0x500945,null))[_0x2a4c('0x5e')](handleError(_0x500945,null));};exports[_0x2a4c('0x10a')]=function(_0xf04222,_0x5f0951){return db[_0x2a4c('0x44')]['find']({'where':{'id':_0xf04222[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x5f0951,null))[_0x2a4c('0x33')](function(_0x5d48a4){if(_0x5d48a4){var _0x29b24b=_0x5d48a4[_0x2a4c('0x35')]({'plain':!![]});return _0x5d48a4[_0x2a4c('0x10a')](_0xf04222[_0x2a4c('0x63')][_0x2a4c('0xac')],_['omit'](_0xf04222[_0x2a4c('0x63')],[_0x2a4c('0xac'),'id'])||{})[_0x2a4c('0x33')](function(){for(var _0x3e0b63=0x0;_0x3e0b63<_0xf04222[_0x2a4c('0x63')][_0x2a4c('0xac')][_0x2a4c('0x61')];_0x3e0b63++){var _0x391198=[];db[_0x2a4c('0x10b')]['findOne']({'where':{'id':_0xf04222[_0x2a4c('0x63')]['ids'][_0x3e0b63]}})[_0x2a4c('0x33')](function(_0x43128e){_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0xeb')]()['then'](function(_0x28a9e2){for(var _0x565ddb=0x0;_0x565ddb<_0x28a9e2['length'];_0x565ddb++){_0x28a9e2[_0x565ddb][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x10d'));}return _0x28a9e2;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x10e')]()[_0x2a4c('0x33')](function(_0x20b5c4){for(var _0x3bec35=0x0;_0x3bec35<_0x20b5c4[_0x2a4c('0x61')];_0x3bec35++){_0x20b5c4[_0x3bec35][_0x2a4c('0x10c')](_0x2a4c('0xa4'),'Chat');}return _0x20b5c4;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x10f')]()[_0x2a4c('0x33')](function(_0x1c24ec){for(var _0xfdc846=0x0;_0xfdc846<_0x1c24ec[_0x2a4c('0x61')];_0xfdc846++){_0x1c24ec[_0xfdc846][_0x2a4c('0x10c')]('channel',_0x2a4c('0x110'));}return _0x1c24ec;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x111')]()[_0x2a4c('0x33')](function(_0x4e5ab0){for(var _0x252ac4=0x0;_0x252ac4<_0x4e5ab0['length'];_0x252ac4++){_0x4e5ab0[_0x252ac4][_0x2a4c('0x10c')](_0x2a4c('0xa4'),'Sms');}return _0x4e5ab0;}));_0x391198['push'](_0x43128e[_0x2a4c('0x112')]()['then'](function(_0xdcd5f8){for(var _0x1b4b2c=0x0;_0x1b4b2c<_0xdcd5f8[_0x2a4c('0x61')];_0x1b4b2c++){_0xdcd5f8[_0x1b4b2c][_0x2a4c('0x10c')]('channel',_0x2a4c('0x113'));}return _0xdcd5f8;}));_0x391198['push'](_0x43128e[_0x2a4c('0x114')]()[_0x2a4c('0x33')](function(_0x510982){for(var _0x36ed6e=0x0;_0x36ed6e<_0x510982[_0x2a4c('0x61')];_0x36ed6e++){_0x510982[_0x36ed6e][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x115'));}return _0x510982;}));_0x391198[_0x2a4c('0x8f')](_0x43128e[_0x2a4c('0x116')]()[_0x2a4c('0x33')](function(_0x5ebd42){for(var _0x389cef=0x0;_0x389cef<_0x5ebd42[_0x2a4c('0x61')];_0x389cef++){_0x5ebd42[_0x389cef][_0x2a4c('0x10c')](_0x2a4c('0xa4'),'Openchannel');}return _0x5ebd42;}));return BPromise[_0x2a4c('0x90')](_0x391198);})[_0x2a4c('0x33')](function(_0x440f43){var _0x94e6cd=_[_0x2a4c('0x117')](_0x440f43);_0x391198=[];return db[_0x2a4c('0x57')][_0x2a4c('0x118')](function(_0x228f63){for(var _0x5a5f6b=0x0;_0x5a5f6b<_0x94e6cd[_0x2a4c('0x61')];_0x5a5f6b++){_0x391198[_0x2a4c('0x8f')](_0x94e6cd[_0x5a5f6b]['addAgent'](_0x29b24b['id']),{'transaction':_0x228f63});}return BPromise[_0x2a4c('0x90')](_0x391198)[_0x2a4c('0x33')](function(){if(_0x29b24b[_0x2a4c('0xa5')]){return BPromise[_0x2a4c('0x91')](_['filter'](_0x94e6cd,function(_0x399357){return _0x399357['getDataValue'](_0x2a4c('0xa4'))==='Voice';}),function(_0x5979bf){return db[_0x2a4c('0xb6')][_0x2a4c('0xb7')]({'membername':_0x29b24b[_0x2a4c('0x41')],'UserId':_0x29b24b['id'],'queue_name':_0x5979bf[_0x2a4c('0x41')],'VoiceQueueId':_0x5979bf['id'],'interface':_[_0x2a4c('0x6c')](_0x29b24b[_0x2a4c('0xb3')])?util[_0x2a4c('0xb4')](_0x2a4c('0xb5'),_0x29b24b[_0x2a4c('0x41')]):_0x29b24b['interface'],'paused':_0x29b24b[_0x2a4c('0xfb')]||![],'penalty':_0x29b24b[_0x2a4c('0xad')]},{'transaction':_0x228f63});});}else{return;}})[_0x2a4c('0x33')](function(){for(var _0x47c0a8=0x0;_0x47c0a8<_0x94e6cd[_0x2a4c('0x61')];_0x47c0a8++){var _0x37e85c=_0x94e6cd[_0x47c0a8][_0x2a4c('0x119')](_0x2a4c('0xa4'));var _0x5cdb55=_0x37e85c+_0x2a4c('0xaf');socket[_0x2a4c('0xb0')](_0x2a4c('0x81')+_0x37e85c+_0x2a4c('0x11a'),{'UserId':_0x29b24b['id'],['queueField']:_0x94e6cd[_0x47c0a8]['id']});}});});});}});}})[_0x2a4c('0x33')](respondWithStatusCode(_0x5f0951,null))['catch'](handleError(_0x5f0951,null));};exports[_0x2a4c('0x11b')]=function(_0x4ec8b3,_0x429f78){return db['User'][_0x2a4c('0xc3')]({'where':{'id':_0x4ec8b3[_0x2a4c('0x64')]['id']}})['then'](handleEntityNotFound(_0x429f78,null))[_0x2a4c('0x33')](function(_0x12442c){if(_0x12442c){var _0x5e1b48=_0x12442c[_0x2a4c('0x35')]({'plain':!![]});var _0x5af4ff=_0x4ec8b3['query'][_0x2a4c('0xac')];return _0x12442c['removeTeams'](_0x5af4ff)[_0x2a4c('0x33')](function(){for(var _0xfe15c8=0x0;_0xfe15c8<_0x5af4ff['length'];_0xfe15c8++){var _0x5cf231=[];db[_0x2a4c('0x10b')]['findOne']({'where':{'id':_0x5af4ff[_0xfe15c8]}})[_0x2a4c('0x33')](function(_0x13585c){_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0xeb')]()[_0x2a4c('0x33')](function(_0x2711a5){for(var _0xb1b9d7=0x0;_0xb1b9d7<_0x2711a5[_0x2a4c('0x61')];_0xb1b9d7++){_0x2711a5[_0xb1b9d7][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x10d'));}return _0x2711a5;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x10e')]()['then'](function(_0xab490a){for(var _0x419cb2=0x0;_0x419cb2<_0xab490a[_0x2a4c('0x61')];_0x419cb2++){_0xab490a[_0x419cb2][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x11c'));}return _0xab490a;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c['getMailQueues']()[_0x2a4c('0x33')](function(_0xc73644){for(var _0xdcf68f=0x0;_0xdcf68f<_0xc73644[_0x2a4c('0x61')];_0xdcf68f++){_0xc73644[_0xdcf68f][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x110'));}return _0xc73644;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x111')]()[_0x2a4c('0x33')](function(_0x174dcc){for(var _0x1e18f9=0x0;_0x1e18f9<_0x174dcc[_0x2a4c('0x61')];_0x1e18f9++){_0x174dcc[_0x1e18f9][_0x2a4c('0x10c')]('channel',_0x2a4c('0x11d'));}return _0x174dcc;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x112')]()['then'](function(_0x52cdbb){for(var _0xd2bd5b=0x0;_0xd2bd5b<_0x52cdbb['length'];_0xd2bd5b++){_0x52cdbb[_0xd2bd5b][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x113'));}return _0x52cdbb;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c['getFaxQueues']()['then'](function(_0x5daa2d){for(var _0x217202=0x0;_0x217202<_0x5daa2d[_0x2a4c('0x61')];_0x217202++){_0x5daa2d[_0x217202][_0x2a4c('0x10c')](_0x2a4c('0xa4'),_0x2a4c('0x115'));}return _0x5daa2d;}));_0x5cf231[_0x2a4c('0x8f')](_0x13585c[_0x2a4c('0x116')]()[_0x2a4c('0x33')](function(_0x5da253){for(var _0x5cab77=0x0;_0x5cab77<_0x5da253[_0x2a4c('0x61')];_0x5cab77++){_0x5da253[_0x5cab77]['setDataValue'](_0x2a4c('0xa4'),_0x2a4c('0x11e'));}return _0x5da253;}));return BPromise[_0x2a4c('0x90')](_0x5cf231);})[_0x2a4c('0x33')](function(_0x5aa8e6){var _0x47b34e=_[_0x2a4c('0x117')](_0x5aa8e6);_0x5cf231=[];return db[_0x2a4c('0x57')][_0x2a4c('0x118')](function(_0x32700d){for(var _0x309d4e=0x0;_0x309d4e<_0x47b34e[_0x2a4c('0x61')];_0x309d4e++){_0x5cf231['push'](_0x47b34e[_0x309d4e][_0x2a4c('0x11f')](_0x5e1b48['id']),{'transaction':_0x32700d});}return BPromise[_0x2a4c('0x90')](_0x5cf231)[_0x2a4c('0x33')](function(){if(_0x5e1b48[_0x2a4c('0xa5')]){return BPromise[_0x2a4c('0x91')](_[_0x2a4c('0x3a')](_0x47b34e,function(_0x4db0b4){return _0x4db0b4[_0x2a4c('0x119')](_0x2a4c('0xa4'))===_0x2a4c('0x10d');}),function(_0x26c2e6){return db[_0x2a4c('0xb6')][_0x2a4c('0x34')]({'where':{'VoiceQueueId':_0x26c2e6['id'],'UserId':_0x5e1b48['id']},'transaction':_0x32700d});});}else{return;}})[_0x2a4c('0x33')](function(){for(var _0x2cceb6=0x0;_0x2cceb6<_0x47b34e[_0x2a4c('0x61')];_0x2cceb6++){var _0x6f73a8=_0x47b34e[_0x2cceb6][_0x2a4c('0x119')](_0x2a4c('0xa4'));var _0x1c9901=_0x6f73a8+_0x2a4c('0xaf');socket[_0x2a4c('0xb0')](_0x2a4c('0x81')+_0x6f73a8+'Queue:remove',{'UserId':_0x5e1b48['id'],['queueField']:_0x47b34e[_0x2cceb6]['id']});}});});});}});}})[_0x2a4c('0x33')](respondWithStatusCode(_0x429f78,null))['catch'](handleError(_0x429f78,null));};exports['getLists']=function(_0xe7b65f,_0x111693,_0x4b9f0b){var _0x2c6246={};var _0xa9e0f6={};var _0x123bfd;var _0xc7bbd2;return db[_0x2a4c('0x44')][_0x2a4c('0xc3')]({'where':{'id':_0xe7b65f[_0x2a4c('0x64')]['id']}})[_0x2a4c('0x33')](handleEntityNotFound(_0x111693,null))[_0x2a4c('0x33')](function(_0x4317c1){if(_0x4317c1){_0x123bfd=_0x4317c1;_0xa9e0f6[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0x120')]['rawAttributes']);_0xa9e0f6[_0x2a4c('0x4a')]=_['keys'](_0xe7b65f['query']);_0xa9e0f6[_0x2a4c('0x4c')]=_[_0x2a4c('0x4d')](_0xa9e0f6[_0x2a4c('0x47')],_0xa9e0f6[_0x2a4c('0x4a')]);_0x2c6246[_0x2a4c('0x4f')]=_['intersection'](_0xa9e0f6[_0x2a4c('0x47')],qs[_0x2a4c('0x4e')](_0xe7b65f[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x2c6246['attributes']=_0x2c6246[_0x2a4c('0x4f')]['length']?_0x2c6246['attributes']:_0xa9e0f6[_0x2a4c('0x47')];_0x2c6246[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0xe7b65f['query'][_0x2a4c('0x52')]);_0x2c6246[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0xe7b65f[_0x2a4c('0x4a')],_0xa9e0f6[_0x2a4c('0x4c')]));if(_0xe7b65f['query']['filter']){_0x2c6246[_0x2a4c('0x53')]=_[_0x2a4c('0x55')](_0x2c6246['where'],{'$or':_[_0x2a4c('0x3b')](_0x2c6246[_0x2a4c('0x4f')],function(_0x2c6aaa){var _0x1854b6={};_0x1854b6[_0x2c6aaa]={'$like':'%'+_0xe7b65f['query'][_0x2a4c('0x3a')]+'%'};return _0x1854b6;})});}_0x2c6246=_[_0x2a4c('0x55')]({},_0x2c6246,_0xe7b65f[_0x2a4c('0x59')]);return _0x123bfd[_0x2a4c('0x121')](_0x2c6246);}})[_0x2a4c('0x33')](function(_0x302ed8){if(_0x302ed8){_0xc7bbd2=_0x302ed8[_0x2a4c('0x61')];if(!_0xe7b65f[_0x2a4c('0x4a')][_0x2a4c('0x50')]('nolimit')){_0x2c6246['limit']=qs[_0x2a4c('0x2d')](_0xe7b65f['query'][_0x2a4c('0x2d')]);_0x2c6246[_0x2a4c('0x2c')]=qs['offset'](_0xe7b65f[_0x2a4c('0x4a')]['offset']);}return _0x123bfd[_0x2a4c('0x121')](_0x2c6246);}})['then'](function(_0x2997c9){if(_0x2997c9){return _0x2997c9?{'count':_0xc7bbd2,'rows':_0x2997c9}:null;}})['then'](respondWithResult(_0x111693,null))[_0x2a4c('0x5e')](handleError(_0x111693,null));};exports[_0x2a4c('0x122')]=function(_0x1623df,_0x45d4dd,_0x3cfd9f){var _0x40fabb={};var _0x572b53={};var _0xc8bb1e;var _0x328ca0;return db[_0x2a4c('0x44')]['findOne']({'where':{'id':_0x1623df['params']['id']}})['then'](handleEntityNotFound(_0x45d4dd,null))[_0x2a4c('0x33')](function(_0x3c7fb1){if(_0x3c7fb1){_0xc8bb1e=_0x3c7fb1;_0x572b53[_0x2a4c('0x47')]=_[_0x2a4c('0x4b')](db[_0x2a4c('0x44')][_0x2a4c('0x45')]);_0x572b53[_0x2a4c('0x4a')]=_['keys'](_0x1623df['query']);_0x572b53[_0x2a4c('0x4c')]=_['intersection'](_0x572b53[_0x2a4c('0x47')],_0x572b53[_0x2a4c('0x4a')]);_0x40fabb[_0x2a4c('0x4f')]=_['intersection'](_0x572b53['model'],qs[_0x2a4c('0x4e')](_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x4e')]));_0x40fabb[_0x2a4c('0x4f')]=_0x40fabb[_0x2a4c('0x4f')][_0x2a4c('0x61')]?_0x40fabb[_0x2a4c('0x4f')]:_0x572b53[_0x2a4c('0x47')];_0x40fabb[_0x2a4c('0xc5')]=qs[_0x2a4c('0x52')](_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x52')]);_0x40fabb[_0x2a4c('0x53')]=qs[_0x2a4c('0x4c')](_[_0x2a4c('0x54')](_0x1623df['query'],_0x572b53[_0x2a4c('0x4c')]));if(_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x3a')]){_0x40fabb[_0x2a4c('0x53')]=_['merge'](_0x40fabb[_0x2a4c('0x53')],{'$or':_[_0x2a4c('0x3b')](_0x40fabb[_0x2a4c('0x4f')],function(_0x116ea7){var _0xe109e={};_0xe109e[_0x116ea7]={'$like':'%'+_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x3a')]+'%'};return _0xe109e;})});}_0x40fabb['model']=db[_0x2a4c('0x44')];_0x40fabb['as']='Agents';_0x40fabb=_[_0x2a4c('0x55')]({},_0x40fabb,_0x1623df[_0x2a4c('0x59')]);return _0xc8bb1e[_0x2a4c('0xeb')]({'include':[_0x40fabb]});}})[_0x2a4c('0x33')](function(_0x4f580d){if(_0x4f580d){var _0x542ccf={},_0x2a424c=[],_0x59e623=0x0;for(var _0x2f1abe=0x0;_0x2f1abe<_0x4f580d[_0x2a4c('0x61')];_0x2f1abe+=0x1){for(var _0x406b94=0x0,_0x4ef33f;_0x406b94<_0x4f580d[_0x2f1abe][_0x2a4c('0x37')][_0x2a4c('0x61')];_0x406b94+=0x1){_0x4ef33f=_0x4f580d[_0x2f1abe][_0x2a4c('0x37')][_0x406b94][_0x2a4c('0x35')]({'plain':!![]});_0x542ccf[_0x4ef33f['id']]=_0x4ef33f;}}_0x542ccf=_[_0x2a4c('0x123')](_0x542ccf);for(var _0x35ec52=qs['offset'](_0x1623df[_0x2a4c('0x4a')][_0x2a4c('0x2c')]);_0x35ec52<_0x542ccf['length']&&_0x2a424c[_0x2a4c('0x61')]=_0x2aa1dc['agents']){throw new Error(_0x37df('0x56'));}})['then'](function(){if(_0x41452c){return db[_0x37df('0x29')][_0x37df('0x4c')]({'where':{'membername':_0x41452c[_0x37df('0x32')]},'individualHooks':!![]});}})['then'](function(){if(_0x41452c){return _0x41452c['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2d49ed){if(_0x41452c){if(_0x2d49ed){var _0x5a8fb4=[];_0x375524=_0x2d49ed;if(_0x375524['length']){for(var _0x10e656=0x0;_0x10e656<_0x375524['length'];_0x10e656++){_0x5a8fb4['push'](db[_0x37df('0x29')][_0x37df('0x57')]({'membername':_0x41452c[_0x37df('0x32')],'UserId':_0x41452c['id'],'queue_name':_0x375524[_0x10e656][_0x37df('0x32')],'VoiceQueueId':_0x375524[_0x10e656]['id'],'interface':_0x380d62,'paused':_0x41452c[_0x37df('0x50')]||![],'penalty':_0x375524[_0x10e656][_0x37df('0x58')]||0x0}));}return BPromise[_0x37df('0x4a')](_0x5a8fb4);}}}})[_0x37df('0xf')](function(){if(_0x41452c){return db[_0x37df('0x2b')]['findAll']({'where':{'membername':_0x41452c['name'],'exitAt':null}});}})['then'](function(_0x36ec07){if(_0x41452c){if(_0x36ec07&&_0x36ec07[_0x37df('0x2e')]){var _0x534035=[];_0x36ec07[_0x37df('0x49')](function(_0x355ff2){_0x534035[_0x37df('0x31')](_0x355ff2['update']({'exitAt':moment()[_0x37df('0x2d')](_0x37df('0x3a'))}));});return BPromise['all'](_0x534035);}}})[_0x37df('0xf')](function(_0x3aa8ea){if(_0x41452c){var _0xc4a685=[];var _0x3ba427=[];var _0x91c94b=utils[_0x37df('0x30')]();var _0x4d3f9f={'membername':_0x41452c[_0x37df('0x32')],'interface':_0x380d62,'enterAt':moment()[_0x37df('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x41452c['role'],'internal':_0x41452c[_0x37df('0x28')]};_0x91c94b['forEach'](function(_0x48f726){_0xc4a685[_0x37df('0x31')](_[_0x37df('0x59')]({'channel':_0x48f726,'type':'LOGIN','data1':'callysquare','data2':_0x380d62},_0x4d3f9f));if(_0x41452c[_0x37df('0x50')]){_0x3ba427[_0x37df('0x31')](_[_0x37df('0x59')]({'channel':_0x48f726,'type':_0x37df('0x2c'),'data1':_0x37df('0x5a')},_0x4d3f9f));}});return db[_0x37df('0x2b')][_0x37df('0x39')](_0xc4a685[_0x37df('0x5b')](_0x3ba427),{'individualHooks':!![]});}})['then'](function(){if(_0x41452c){return _0x41452c[_0x37df('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x37df('0x3a')),'voicePause':_0x41452c[_0x37df('0x50')]||![],'mailPause':_0x41452c['loginInPause']||![],'chatPause':_0x41452c[_0x37df('0x50')]||![],'faxPause':_0x41452c[_0x37df('0x50')]||![],'smsPause':_0x41452c[_0x37df('0x50')]||![],'openchannelPause':_0x41452c[_0x37df('0x50')]||![],'pauseType':_0x41452c[_0x37df('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x37df('0x2d')](_0x37df('0x3a')),'interface':_0x380d62});}})[_0x37df('0xf')](function(_0x47c0e3){_0x3e8328(_0x47c0e3);})['catch'](function(_0x38f6a8){_0x32f728(_0x5b288f[_0x37df('0x14')](0x1f4,_0x38f6a8[_0x37df('0x16')]));});});}; \ No newline at end of file +var _0xd5c8=['User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','User','findAll','options','raw','where','attributes','limit','map','model','include','GetUser','ShowUser','find','PauseUser','role','internal','interface','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','name','SIP/%s','body','type','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','voice','PAUSE','system','mail','chat','fax','sms','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd5c8,0x166));var _0x8d5c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd5c8[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d5c('0x0'));var BPromise=require(_0x8d5c('0x1'));var rs=require(_0x8d5c('0x2'));var fs=require('fs');var Redis=require(_0x8d5c('0x3'));var db=require(_0x8d5c('0x4'))['db'];var utils=require(_0x8d5c('0x5'));var logger=require(_0x8d5c('0x6'))(_0x8d5c('0x7'));var config=require(_0x8d5c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8d5c('0x9')]['http']({'port':0x232a});config['redis']=_[_0x8d5c('0xa')](config[_0x8d5c('0xb')],{'host':_0x8d5c('0xc'),'port':0x18eb});var socket=require(_0x8d5c('0xd'))(new Redis(config['redis']));require('./user.socket')[_0x8d5c('0xe')](socket);function respondWithRpcPromise(_0x56bea7,_0x3e0937,_0xe38c0a){return new BPromise(function(_0x29737a,_0x303965){return client[_0x8d5c('0xf')](_0x56bea7,_0xe38c0a)[_0x8d5c('0x10')](function(_0x8408da){logger[_0x8d5c('0x11')](_0x8d5c('0x12'),_0x3e0937,_0x8d5c('0x13'));logger[_0x8d5c('0x14')](_0x8d5c('0x15'),_0x3e0937,'request\x20sent',JSON[_0x8d5c('0x16')](_0x8408da));if(_0x8408da[_0x8d5c('0x17')]){if(_0x8408da[_0x8d5c('0x17')][_0x8d5c('0x18')]===0x1f4){logger[_0x8d5c('0x17')](_0x8d5c('0x12'),_0x3e0937,_0x8408da[_0x8d5c('0x17')][_0x8d5c('0x19')]);return _0x303965(_0x8408da['error'][_0x8d5c('0x19')]);}logger[_0x8d5c('0x17')]('User,\x20%s,\x20%s',_0x3e0937,_0x8408da['error'][_0x8d5c('0x19')]);return _0x29737a(_0x8408da['error']['message']);}else{logger['info'](_0x8d5c('0x12'),_0x3e0937,_0x8d5c('0x13'));_0x29737a(_0x8408da[_0x8d5c('0x1a')][_0x8d5c('0x19')]);}})[_0x8d5c('0x1b')](function(_0x29820e){logger['error']('User,\x20%s,\x20%s',_0x3e0937,_0x29820e);_0x303965(_0x29820e);});});}exports['GetUser']=function(_0x4e4c5c){var _0x379bfb=this;return new Promise(function(_0x71b3fd,_0x31cd31){return db[_0x8d5c('0x1c')][_0x8d5c('0x1d')]({'raw':_0x4e4c5c[_0x8d5c('0x1e')]?_0x4e4c5c[_0x8d5c('0x1e')][_0x8d5c('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e4c5c[_0x8d5c('0x1e')]?_0x4e4c5c[_0x8d5c('0x1e')][_0x8d5c('0x20')]||null:null,'attributes':_0x4e4c5c['options']?_0x4e4c5c[_0x8d5c('0x1e')][_0x8d5c('0x21')]||null:null,'limit':_0x4e4c5c['options']?_0x4e4c5c[_0x8d5c('0x1e')][_0x8d5c('0x22')]||null:null,'include':_0x4e4c5c[_0x8d5c('0x1e')]?_0x4e4c5c[_0x8d5c('0x1e')]['include']?_[_0x8d5c('0x23')](_0x4e4c5c[_0x8d5c('0x1e')]['include'],function(_0x5e0daa){return{'model':db[_0x5e0daa[_0x8d5c('0x24')]],'as':_0x5e0daa['as'],'attributes':_0x5e0daa[_0x8d5c('0x21')],'include':_0x5e0daa['include']?_['map'](_0x5e0daa[_0x8d5c('0x25')],function(_0x5ab95b){return{'model':db[_0x5ab95b[_0x8d5c('0x24')]],'as':_0x5ab95b['as'],'attributes':_0x5ab95b[_0x8d5c('0x21')],'include':_0x5ab95b[_0x8d5c('0x25')]?_[_0x8d5c('0x23')](_0x5ab95b[_0x8d5c('0x25')],function(_0xd060b1){return{'model':db[_0xd060b1[_0x8d5c('0x24')]],'as':_0xd060b1['as'],'attributes':_0xd060b1[_0x8d5c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8d5c('0x10')](function(_0x56153f){logger[_0x8d5c('0x11')](_0x8d5c('0x26'),_0x4e4c5c);logger[_0x8d5c('0x14')]('GetUser',_0x4e4c5c,JSON[_0x8d5c('0x16')](_0x56153f));_0x71b3fd(_0x56153f);})[_0x8d5c('0x1b')](function(_0x3f9d1a){logger[_0x8d5c('0x17')](_0x8d5c('0x26'),_0x3f9d1a[_0x8d5c('0x19')],_0x4e4c5c);_0x31cd31(_0x379bfb[_0x8d5c('0x17')](0x1f4,_0x3f9d1a[_0x8d5c('0x19')]));});});};exports[_0x8d5c('0x27')]=function(_0x417d87){var _0x2c1464=this;return new Promise(function(_0x3036a9,_0x383f8c){return db[_0x8d5c('0x1c')][_0x8d5c('0x28')]({'raw':_0x417d87[_0x8d5c('0x1e')]?_0x417d87[_0x8d5c('0x1e')][_0x8d5c('0x1f')]===undefined?!![]:![]:!![],'where':_0x417d87['options']?_0x417d87['options']['where']||null:null,'attributes':_0x417d87['options']?_0x417d87[_0x8d5c('0x1e')][_0x8d5c('0x21')]||null:null,'include':_0x417d87[_0x8d5c('0x1e')]?_0x417d87['options'][_0x8d5c('0x25')]?_[_0x8d5c('0x23')](_0x417d87[_0x8d5c('0x1e')][_0x8d5c('0x25')],function(_0x57d2e1){return{'model':db[_0x57d2e1[_0x8d5c('0x24')]],'as':_0x57d2e1['as'],'attributes':_0x57d2e1['attributes'],'include':_0x57d2e1[_0x8d5c('0x25')]?_[_0x8d5c('0x23')](_0x57d2e1['include'],function(_0x21e114){return{'model':db[_0x21e114[_0x8d5c('0x24')]],'as':_0x21e114['as'],'attributes':_0x21e114[_0x8d5c('0x21')],'include':_0x21e114[_0x8d5c('0x25')]?_[_0x8d5c('0x23')](_0x21e114[_0x8d5c('0x25')],function(_0x84997d){return{'model':db[_0x84997d[_0x8d5c('0x24')]],'as':_0x84997d['as'],'attributes':_0x84997d[_0x8d5c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8d5c('0x10')](function(_0x293540){logger[_0x8d5c('0x11')]('ShowUser',_0x417d87);logger['debug']('ShowUser',_0x417d87,JSON['stringify'](_0x293540));_0x3036a9(_0x293540);})['catch'](function(_0x283a21){logger[_0x8d5c('0x17')]('ShowUser',_0x283a21[_0x8d5c('0x19')],_0x417d87);_0x383f8c(_0x2c1464[_0x8d5c('0x17')](0x1f4,_0x283a21[_0x8d5c('0x19')]));});});};exports[_0x8d5c('0x29')]=function(_0x12b218){var _0x6aa7d=this;return new Promise(function(_0x4ca52d,_0x56f15b){var _0x210134;return db[_0x8d5c('0x1c')][_0x8d5c('0x28')]({'where':_0x12b218[_0x8d5c('0x1e')][_0x8d5c('0x20')]||{},'attributes':['id','name',_0x8d5c('0x2a'),_0x8d5c('0x2b'),_0x8d5c('0x2c')]})['then'](function(_0x549d2c){if(_0x549d2c){_0x210134=_0x549d2c;return db[_0x8d5c('0x2d')][_0x8d5c('0x2e')]({'paused':0x1},{'where':{'UserId':_0x210134['id']},'individualHooks':!![]});}})[_0x8d5c('0x10')](function(){if(_0x210134){return db[_0x8d5c('0x2f')]['findAll']({'where':{'membername':_0x210134['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x3ce85a){if(_0x210134){if(_0x3ce85a&&_0x3ce85a[_0x8d5c('0x30')]){var _0x3516cb=moment()[_0x8d5c('0x31')](_0x8d5c('0x32'));for(var _0x13de8f=0x0,_0x5a041d=_0x3ce85a[_0x8d5c('0x30')];_0x13de8f<_0x5a041d;_0x13de8f++){_0x3ce85a[_0x13de8f][_0x8d5c('0x33')]({'exitAt':_0x3516cb});}}}})[_0x8d5c('0x10')](function(){if(_0x210134){var _0x389fb9=[];var _0x153fe0=utils[_0x8d5c('0x34')]();_0x153fe0[_0x8d5c('0x35')](function(_0x533176){_0x389fb9[_0x8d5c('0x36')]({'channel':_0x533176,'membername':_0x210134[_0x8d5c('0x37')],'interface':_['isNil'](_0x210134[_0x8d5c('0x2c')])?util['format'](_0x8d5c('0x38'),_0x210134[_0x8d5c('0x37')]):_0x210134[_0x8d5c('0x2c')],'type':'PAUSE','enterAt':moment()[_0x8d5c('0x31')](_0x8d5c('0x32')),'data1':_0x12b218[_0x8d5c('0x39')][_0x8d5c('0x3a')]||'DEFAULT\x20PAUSE','role':_0x210134['role'],'internal':_0x210134[_0x8d5c('0x2b')],'uniqueid':_0x12b218[_0x8d5c('0x39')]['uniqueid']||null});});return db[_0x8d5c('0x2f')][_0x8d5c('0x3b')](_0x389fb9,{'individualHooks':!![]});}})[_0x8d5c('0x10')](function(){if(_0x210134){return _0x210134[_0x8d5c('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x12b218[_0x8d5c('0x39')]['type']||_0x8d5c('0x3c'),'lastPauseAt':moment()[_0x8d5c('0x31')](_0x8d5c('0x32'))});}})[_0x8d5c('0x10')](function(_0x326a1c){_0x4ca52d(_0x326a1c);})[_0x8d5c('0x1b')](function(_0x3f5f32){_0x56f15b(_0x6aa7d['error'](0x1f4,_0x3f5f32[_0x8d5c('0x19')]));});});};exports[_0x8d5c('0x3d')]=function(_0x28a472){var _0x428bcb=this;return new Promise(function(_0x29bfd2,_0x11fd1a){var _0x10879c;return db[_0x8d5c('0x1c')][_0x8d5c('0x3e')]({'where':_0x28a472[_0x8d5c('0x1e')][_0x8d5c('0x20')]||{},'attributes':['id',_0x8d5c('0x37')]})[_0x8d5c('0x10')](function(_0x51b621){if(_0x51b621){_0x10879c=_0x51b621;if(_0x28a472[_0x8d5c('0x39')][_0x8d5c('0x3f')]&&!utils[_0x8d5c('0x40')](_0x28a472[_0x8d5c('0x39')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x28a472[_0x8d5c('0x39')][_0x8d5c('0x3f')]){case _0x8d5c('0x41'):return db[_0x8d5c('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x10879c['id']}})[_0x8d5c('0x10')](function(){return db[_0x8d5c('0x2f')][_0x8d5c('0x28')]({'where':{'channel':_0x28a472[_0x8d5c('0x39')][_0x8d5c('0x3f')],'membername':_0x10879c[_0x8d5c('0x37')],'type':_0x8d5c('0x42'),'exitAt':null}});})[_0x8d5c('0x10')](function(_0x2e2523){if(_0x2e2523){return _0x2e2523[_0x8d5c('0x2e')]({'exitAt':moment()[_0x8d5c('0x31')](_0x8d5c('0x32')),'data2':_0x8d5c('0x43')},{'individualHooks':!![]});}return null;})[_0x8d5c('0x10')](function(){return _0x10879c[_0x8d5c('0x2e')]({'voicePause':![]});});case _0x8d5c('0x44'):case _0x8d5c('0x45'):case _0x8d5c('0x46'):case _0x8d5c('0x47'):case'openchannel':case'whatsapp':return db[_0x8d5c('0x2f')][_0x8d5c('0x28')]({'where':{'channel':_0x28a472[_0x8d5c('0x39')][_0x8d5c('0x3f')],'membername':_0x10879c[_0x8d5c('0x37')],'type':_0x8d5c('0x42'),'exitAt':null}})[_0x8d5c('0x10')](function(_0x450fbc){return _0x450fbc[_0x8d5c('0x2e')]({'exitAt':moment()[_0x8d5c('0x31')](_0x8d5c('0x32')),'data2':_0x8d5c('0x43')},{'individualHooks':!![]});})[_0x8d5c('0x10')](function(){var _0xe8a602={};_[_0x8d5c('0x48')](_0xe8a602,util[_0x8d5c('0x31')](_0x8d5c('0x49'),_0x28a472[_0x8d5c('0x39')][_0x8d5c('0x3f')],_0x8d5c('0x4a')),![]);return _0x10879c[_0x8d5c('0x2e')](_0xe8a602);});default:return db['UserVoiceQueueRt'][_0x8d5c('0x2e')]({'paused':0x0},{'where':{'UserId':_0x10879c['id']}})['then'](function(){return db[_0x8d5c('0x2f')][_0x8d5c('0x1d')]({'where':{'membername':_0x10879c[_0x8d5c('0x37')],'type':_0x8d5c('0x42'),'exitAt':null}});})[_0x8d5c('0x10')](function(_0x5dfa4c){var _0x4efec4=[];_0x5dfa4c[_0x8d5c('0x35')](function(_0x17dd6d){_0x4efec4[_0x8d5c('0x36')](_0x17dd6d[_0x8d5c('0x2e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8d5c('0x43')}));});return BPromise[_0x8d5c('0x4b')](_0x4efec4);})[_0x8d5c('0x10')](function(){return _0x10879c[_0x8d5c('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x8d5c('0x10')](function(_0x1e5207){_0x29bfd2(_0x1e5207);})['catch'](function(_0x33c8b5){_0x11fd1a(_0x428bcb[_0x8d5c('0x17')](0x1f4,_0x33c8b5['message']));});});};exports[_0x8d5c('0x4c')]=function(_0x4cc59b){var _0x18e448=this;return new Promise(function(_0x4523fd,_0x2a46b2){var _0x4edc62;return db['User']['findOne']({'where':_0x4cc59b['options'][_0x8d5c('0x20')]||{},'attributes':['id',_0x8d5c('0x37')]})[_0x8d5c('0x10')](function(_0x7cd63d){if(_0x7cd63d){_0x4edc62=_0x7cd63d;return db[_0x8d5c('0x2d')][_0x8d5c('0x4d')]({'where':{'membername':_0x4edc62['name']},'individualHooks':!![]});}})[_0x8d5c('0x10')](function(){if(_0x4edc62){return db['MemberReport'][_0x8d5c('0x1d')]({'where':{'membername':_0x4edc62[_0x8d5c('0x37')],'exitAt':null}});}})[_0x8d5c('0x10')](function(_0x3c6227){if(_0x4edc62){if(_0x3c6227&&_0x3c6227[_0x8d5c('0x30')]){var _0x221697=[];_0x3c6227[_0x8d5c('0x35')](function(_0x58a377){_0x221697['push'](_0x58a377[_0x8d5c('0x2e')]({'exitAt':moment()[_0x8d5c('0x31')](_0x8d5c('0x32'))}));});return BPromise[_0x8d5c('0x4b')](_0x221697);}}})[_0x8d5c('0x10')](function(){if(_0x4edc62){return _0x4edc62[_0x8d5c('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x8d5c('0x10')](function(_0x5abe96){_0x4523fd(_0x5abe96);})[_0x8d5c('0x1b')](function(_0x46eb29){_0x2a46b2(_0x18e448[_0x8d5c('0x17')](0x1f4,_0x46eb29[_0x8d5c('0x19')]));});});};exports[_0x8d5c('0x4e')]=function(_0x4e2ed7){var _0x2f0bef=this;return new Promise(function(_0x5c1f62,_0x227046){var _0x2c0cdd;var _0x43596a;var _0x157da5;var _0x2e816e;return db[_0x8d5c('0x1c')][_0x8d5c('0x3e')]({'where':_0x4e2ed7[_0x8d5c('0x1e')][_0x8d5c('0x20')]||{},'attributes':['id',_0x8d5c('0x37'),_0x8d5c('0x2a'),_0x8d5c('0x4f'),_0x8d5c('0x50'),_0x8d5c('0x2b'),_0x8d5c('0x51'),_0x8d5c('0x2c')]})['then'](function(_0x29463a){if(_0x29463a){_0x2c0cdd=_0x29463a;_0x2e816e=_0x4e2ed7[_0x8d5c('0x39')]['interface']?_0x4e2ed7[_0x8d5c('0x39')]['interface']:util['format'](_0x8d5c('0x38'),_0x2c0cdd[_0x8d5c('0x37')]);return db[_0x8d5c('0x1c')][_0x8d5c('0x52')]({'where':{'role':_0x8d5c('0x53'),'online':!![],'id':{'$ne':_0x2c0cdd['id']}}});}})['then'](function(_0x2194ee){if(_0x2194ee){_0x157da5=_0x2194ee;return require(_0x8d5c('0x54'))[_0x8d5c('0x55')]();}})['then'](function(_0x18b3fe){if(_0x18b3fe&&_0x18b3fe[_0x8d5c('0x56')]&&_0x157da5>=_0x18b3fe[_0x8d5c('0x56')]){throw new Error(_0x8d5c('0x57'));}})['then'](function(){if(_0x2c0cdd){return db[_0x8d5c('0x2d')][_0x8d5c('0x4d')]({'where':{'membername':_0x2c0cdd[_0x8d5c('0x37')]},'individualHooks':!![]});}})[_0x8d5c('0x10')](function(){if(_0x2c0cdd){return _0x2c0cdd[_0x8d5c('0x58')]({'raw':!![]});}})[_0x8d5c('0x10')](function(_0x117551){if(_0x2c0cdd){if(_0x117551){var _0x4f59c1=[];_0x43596a=_0x117551;if(_0x43596a[_0x8d5c('0x30')]){for(var _0x439502=0x0;_0x439502<_0x43596a[_0x8d5c('0x30')];_0x439502++){_0x4f59c1[_0x8d5c('0x36')](db[_0x8d5c('0x2d')][_0x8d5c('0x59')]({'membername':_0x2c0cdd[_0x8d5c('0x37')],'UserId':_0x2c0cdd['id'],'queue_name':_0x43596a[_0x439502][_0x8d5c('0x37')],'VoiceQueueId':_0x43596a[_0x439502]['id'],'interface':_0x2e816e,'paused':_0x2c0cdd['loginInPause']||![],'penalty':_0x43596a[_0x439502][_0x8d5c('0x5a')]||0x0}));}return BPromise['all'](_0x4f59c1);}}}})['then'](function(){if(_0x2c0cdd){return db['MemberReport'][_0x8d5c('0x1d')]({'where':{'membername':_0x2c0cdd[_0x8d5c('0x37')],'exitAt':null}});}})[_0x8d5c('0x10')](function(_0x490935){if(_0x2c0cdd){if(_0x490935&&_0x490935[_0x8d5c('0x30')]){var _0x5e86f5=[];_0x490935[_0x8d5c('0x35')](function(_0x50241a){_0x5e86f5[_0x8d5c('0x36')](_0x50241a[_0x8d5c('0x2e')]({'exitAt':moment()['format'](_0x8d5c('0x32'))}));});return BPromise[_0x8d5c('0x4b')](_0x5e86f5);}}})[_0x8d5c('0x10')](function(_0x3e5850){if(_0x2c0cdd){var _0x33a6a5=[];var _0x58bac6=[];var _0x100d0=utils[_0x8d5c('0x34')]();var _0xfc4a61={'membername':_0x2c0cdd[_0x8d5c('0x37')],'interface':_0x2e816e,'enterAt':moment()[_0x8d5c('0x31')](_0x8d5c('0x32')),'role':_0x2c0cdd[_0x8d5c('0x2a')],'internal':_0x2c0cdd[_0x8d5c('0x2b')]};_0x100d0[_0x8d5c('0x35')](function(_0x9f1fb5){_0x33a6a5[_0x8d5c('0x36')](_[_0x8d5c('0x5b')]({'channel':_0x9f1fb5,'type':_0x8d5c('0x5c'),'data1':'callysquare','data2':_0x2e816e},_0xfc4a61));if(_0x2c0cdd[_0x8d5c('0x51')]){_0x58bac6['push'](_[_0x8d5c('0x5b')]({'channel':_0x9f1fb5,'type':_0x8d5c('0x42'),'data1':_0x8d5c('0x5d')},_0xfc4a61));}});return db[_0x8d5c('0x2f')][_0x8d5c('0x3b')](_0x33a6a5['concat'](_0x58bac6),{'individualHooks':!![]});}})[_0x8d5c('0x10')](function(){if(_0x2c0cdd){return _0x2c0cdd[_0x8d5c('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x8d5c('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2c0cdd[_0x8d5c('0x51')]||![],'mailPause':_0x2c0cdd['loginInPause']||![],'chatPause':_0x2c0cdd['loginInPause']||![],'faxPause':_0x2c0cdd[_0x8d5c('0x51')]||![],'smsPause':_0x2c0cdd['loginInPause']||![],'openchannelPause':_0x2c0cdd[_0x8d5c('0x51')]||![],'pauseType':_0x2c0cdd['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x8d5c('0x32')),'interface':_0x2e816e});}})[_0x8d5c('0x10')](function(_0x29910b){_0x5c1f62(_0x29910b);})[_0x8d5c('0x1b')](function(_0x24f331){_0x227046(_0x2f0bef['error'](0x1f4,_0x24f331[_0x8d5c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 00d2b3c..706ed37 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 _0xe675=['update','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x187dce,_0x733b40){var _0x52a5eb=function(_0x164d07){while(--_0x164d07){_0x187dce['push'](_0x187dce['shift']());}};_0x52a5eb(++_0x733b40);}(_0xe675,0x185));var _0x5e67=function(_0x4fb38a,_0x36f5ba){_0x4fb38a=_0x4fb38a-0x0;var _0x17d645=_0xe675[_0x4fb38a];return _0x17d645;};'use strict';var UserEvents=require(_0x5e67('0x0'));var events=[_0x5e67('0x1'),_0x5e67('0x2'),_0x5e67('0x3')];function createListener(_0x3cf806,_0x5adef1){return function(_0x44039e){_0x5adef1['emit'](_0x3cf806,_0x44039e);};}function removeListener(_0x1de7c8,_0x374853){return function(){UserEvents[_0x5e67('0x4')](_0x1de7c8,_0x374853);};}exports[_0x5e67('0x5')]=function(_0x279ba0){for(var _0x3697b7=0x0,_0xaa063b=events[_0x5e67('0x6')];_0x3697b7<_0xaa063b;_0x3697b7++){var _0x5d3f73=events[_0x3697b7];var _0x269a36=createListener(_0x5e67('0x7')+_0x5d3f73,_0x279ba0);UserEvents['on'](_0x5d3f73,_0x269a36);}}; \ No newline at end of file +var _0xdbab=['removeListener','register','save','remove','update','emit'];(function(_0x30b057,_0x1d1505){var _0x331671=function(_0x30bcdf){while(--_0x30bcdf){_0x30b057['push'](_0x30b057['shift']());}};_0x331671(++_0x1d1505);}(_0xdbab,0x146));var _0xbdba=function(_0x2570b1,_0x3fed7f){_0x2570b1=_0x2570b1-0x0;var _0x5b4e74=_0xdbab[_0x2570b1];return _0x5b4e74;};'use strict';var UserEvents=require('./user.events');var events=[_0xbdba('0x0'),_0xbdba('0x1'),_0xbdba('0x2')];function createListener(_0x2b6d60,_0x964638){return function(_0xa8aaf1){_0x964638[_0xbdba('0x3')](_0x2b6d60,_0xa8aaf1);};}function removeListener(_0x5b646c,_0x1205da){return function(){UserEvents[_0xbdba('0x4')](_0x5b646c,_0x1205da);};}exports[_0xbdba('0x5')]=function(_0x2ca05f){for(var _0x470e0a=0x0,_0x5f4654=events['length'];_0x470e0a<_0x5f4654;_0x470e0a++){var _0x16b54f=events[_0x470e0a];var _0x2235cc=createListener('user:'+_0x16b54f,_0x2ca05f);UserEvents['on'](_0x16b54f,_0x2235cc);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 81430c1..3d3655b 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 _0x1ddd=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5002e9,_0x5a4a4d){var _0x3ac090=function(_0x4e1847){while(--_0x4e1847){_0x5002e9['push'](_0x5002e9['shift']());}};_0x3ac090(++_0x5a4a4d);}(_0x1ddd,0xda));var _0xd1dd=function(_0x4ce746,_0x49bb33){_0x4ce746=_0x4ce746-0x0;var _0x273004=_0x1ddd[_0x4ce746];return _0x273004;};'use strict';var multer=require(_0xd1dd('0x0'));var util=require(_0xd1dd('0x1'));var path=require(_0xd1dd('0x2'));var timeout=require(_0xd1dd('0x3'));var express=require(_0xd1dd('0x4'));var router=express[_0xd1dd('0x5')]();var auth=require(_0xd1dd('0x6'));var interaction=require(_0xd1dd('0x7'));var config=require('../../config/environment');module[_0xd1dd('0x8')]=router; \ No newline at end of file +var _0x4a70=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0xebf298,_0x4a09a1){var _0x41c764=function(_0x1e885f){while(--_0x1e885f){_0xebf298['push'](_0xebf298['shift']());}};_0x41c764(++_0x4a09a1);}(_0x4a70,0x77));var _0x04a7=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x4a70[_0x104e21];return _0x605b37;};'use strict';var multer=require(_0x04a7('0x0'));var util=require(_0x04a7('0x1'));var path=require(_0x04a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x04a7('0x3'));var router=express['Router']();var auth=require(_0x04a7('0x4'));var interaction=require(_0x04a7('0x5'));var config=require(_0x04a7('0x6'));module[_0x04a7('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6beb562..b4fe19f 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x39f279,_0xb88a67){var _0x13520c=function(_0x44a1da){while(--_0x44a1da){_0x39f279['push'](_0x39f279['shift']());}};_0x13520c(++_0xb88a67);}(_0xe706,0xa3));var _0x6e70=function(_0x14bdfb,_0x7ebb3c){_0x14bdfb=_0x14bdfb-0x0;var _0x433477=_0xe706[_0x14bdfb];return _0x433477;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x40a0ce,_0x36a40f){var _0x48e121=function(_0x4622b2){while(--_0x4622b2){_0x40a0ce['push'](_0x40a0ce['shift']());}};_0x48e121(++_0x36a40f);}(_0xb10b,0x12a));var _0xbb10=function(_0xe7a99e,_0x4902a1){_0xe7a99e=_0xe7a99e-0x0;var _0x3bef5c=_0xb10b[_0xe7a99e];return _0x3bef5c;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 49734b1..2bfd00a 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 _0x47c2=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x25cc00,_0x1c93db){var _0x3462cc=function(_0xb3bbe8){while(--_0xb3bbe8){_0x25cc00['push'](_0x25cc00['shift']());}};_0x3462cc(++_0x1c93db);}(_0x47c2,0x1c4));var _0x247c=function(_0x4c9531,_0x2dd203){_0x4c9531=_0x4c9531-0x0;var _0x25b23a=_0x47c2[_0x4c9531];return _0x25b23a;};'use strict';var _=require(_0x247c('0x0'));var util=require(_0x247c('0x1'));var logger=require('../../config/logger')(_0x247c('0x2'));var moment=require(_0x247c('0x3'));var BPromise=require(_0x247c('0x4'));var rp=require(_0x247c('0x5'));var fs=require('fs');var path=require(_0x247c('0x6'));var rimraf=require(_0x247c('0x7'));var config=require(_0x247c('0x8'));var attributes=require(_0x247c('0x9'));module[_0x247c('0xa')]=function(_0x2d955f,_0x17a410){return _0x2d955f[_0x247c('0xb')](_0x247c('0xc'),attributes,{'tableName':_0x247c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x219d=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x26eecf,_0x362106){var _0x2ea204=function(_0x4a5d1f){while(--_0x4a5d1f){_0x26eecf['push'](_0x26eecf['shift']());}};_0x2ea204(++_0x362106);}(_0x219d,0xa4));var _0xd219=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x219d[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xd219('0x0'));var util=require(_0xd219('0x1'));var logger=require(_0xd219('0x2'))(_0xd219('0x3'));var moment=require(_0xd219('0x4'));var BPromise=require(_0xd219('0x5'));var rp=require(_0xd219('0x6'));var fs=require('fs');var path=require(_0xd219('0x7'));var rimraf=require(_0xd219('0x8'));var config=require(_0xd219('0x9'));var attributes=require(_0xd219('0xa'));module['exports']=function(_0x4f325f,_0x2658a2){return _0x4f325f[_0xd219('0xb')]('UserChatQueue',attributes,{'tableName':_0xd219('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 5961bb1..53a8d2b 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 _0x388b=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x388b,0xa5));var _0xb388=function(_0x5f51a7,_0x2038ec){_0x5f51a7=_0x5f51a7-0x0;var _0x13eeb8=_0x388b[_0x5f51a7];return _0x13eeb8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb388('0x0'));var fs=require('fs');var Redis=require(_0xb388('0x1'));var db=require(_0xb388('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb388('0x3'));var config=require(_0xb388('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb388('0x5')][_0xb388('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x22f38a,_0x2d0a6c,_0x4d6cd1){return new BPromise(function(_0x3a26a6,_0x8f8dc2){return client[_0xb388('0x7')](_0x22f38a,_0x4d6cd1)[_0xb388('0x8')](function(_0x59b741){logger[_0xb388('0x9')](_0xb388('0xa'),_0x2d0a6c,_0xb388('0xb'));logger[_0xb388('0xc')](_0xb388('0xd'),_0x2d0a6c,_0xb388('0xb'),JSON['stringify'](_0x59b741));if(_0x59b741['error']){if(_0x59b741[_0xb388('0xe')][_0xb388('0xf')]===0x1f4){logger[_0xb388('0xe')](_0xb388('0xa'),_0x2d0a6c,_0x59b741[_0xb388('0xe')]['message']);return _0x8f8dc2(_0x59b741['error'][_0xb388('0x10')]);}logger['error'](_0xb388('0xa'),_0x2d0a6c,_0x59b741[_0xb388('0xe')]['message']);return _0x3a26a6(_0x59b741[_0xb388('0xe')][_0xb388('0x10')]);}else{logger[_0xb388('0x9')](_0xb388('0xa'),_0x2d0a6c,'request\x20sent');_0x3a26a6(_0x59b741[_0xb388('0x11')][_0xb388('0x10')]);}})[_0xb388('0x12')](function(_0x4482b4){logger[_0xb388('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2d0a6c,_0x4482b4);_0x8f8dc2(_0x4482b4);});});} \ No newline at end of file +var _0xc329=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment'];(function(_0x18dc34,_0x205f71){var _0x4ab15b=function(_0x50572f){while(--_0x50572f){_0x18dc34['push'](_0x18dc34['shift']());}};_0x4ab15b(++_0x205f71);}(_0xc329,0x105));var _0x9c32=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xc329[_0x4eaa4c];return _0x15aec6;};'use strict';var _=require(_0x9c32('0x0'));var util=require(_0x9c32('0x1'));var moment=require(_0x9c32('0x2'));var BPromise=require(_0x9c32('0x3'));var rs=require(_0x9c32('0x4'));var fs=require('fs');var Redis=require(_0x9c32('0x5'));var db=require(_0x9c32('0x6'))['db'];var utils=require(_0x9c32('0x7'));var logger=require(_0x9c32('0x8'))(_0x9c32('0x9'));var config=require(_0x9c32('0xa'));var jayson=require(_0x9c32('0xb'));var client=jayson[_0x9c32('0xc')][_0x9c32('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x366200,_0x16203a,_0x57219b){return new BPromise(function(_0x4ef77c,_0x206912){return client[_0x9c32('0xe')](_0x366200,_0x57219b)['then'](function(_0x3976e0){logger[_0x9c32('0xf')](_0x9c32('0x10'),_0x16203a,_0x9c32('0x11'));logger[_0x9c32('0x12')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x16203a,_0x9c32('0x11'),JSON['stringify'](_0x3976e0));if(_0x3976e0['error']){if(_0x3976e0[_0x9c32('0x13')][_0x9c32('0x14')]===0x1f4){logger['error'](_0x9c32('0x10'),_0x16203a,_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);return _0x206912(_0x3976e0[_0x9c32('0x13')]['message']);}logger['error'](_0x9c32('0x10'),_0x16203a,_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);return _0x4ef77c(_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);}else{logger[_0x9c32('0xf')](_0x9c32('0x10'),_0x16203a,_0x9c32('0x11'));_0x4ef77c(_0x3976e0[_0x9c32('0x16')][_0x9c32('0x15')]);}})[_0x9c32('0x17')](function(_0xcd14df){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x16203a,_0xcd14df);_0x206912(_0xcd14df);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 376e334..881c3b8 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 _0xba18=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express'];(function(_0x287cac,_0x3fa61){var _0x4a5d11=function(_0x530890){while(--_0x530890){_0x287cac['push'](_0x287cac['shift']());}};_0x4a5d11(++_0x3fa61);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var path=require(_0x8ba1('0x2'));var timeout=require(_0x8ba1('0x3'));var express=require(_0x8ba1('0x4'));var router=express[_0x8ba1('0x5')]();var auth=require(_0x8ba1('0x6'));var interaction=require(_0x8ba1('0x7'));var config=require('../../config/environment');module[_0x8ba1('0x8')]=router; \ No newline at end of file +var _0x6435=['multer','util','../../components/auth/service','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6435,0xb4));var _0x5643=function(_0x1cd0af,_0x33cd9d){_0x1cd0af=_0x1cd0af-0x0;var _0x3a7880=_0x6435[_0x1cd0af];return _0x3a7880;};'use strict';var multer=require(_0x5643('0x0'));var util=require(_0x5643('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x5643('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x5643('0x3'));module[_0x5643('0x4')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 598a70a..51e301b 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 _0x0598=['exports','INTEGER','sequelize'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x0598,0x92));var _0x8059=function(_0x128aa5,_0x3d9106){_0x128aa5=_0x128aa5-0x0;var _0x278ca9=_0x0598[_0x128aa5];return _0x278ca9;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8059('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x96cc=['STRING','sequelize','INTEGER'];(function(_0x572165,_0x6a45cc){var _0x8c8709=function(_0x43faab){while(--_0x43faab){_0x572165['push'](_0x572165['shift']());}};_0x8c8709(++_0x6a45cc);}(_0x96cc,0x16c));var _0xc96c=function(_0x6b15e9,_0x20eaa3){_0x6b15e9=_0x6b15e9-0x0;var _0x630fd6=_0x96cc[_0x6b15e9];return _0x630fd6;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc96c('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8e1f9c5..3c0c803 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 _0x95e6=['path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','moment','bluebird','request-promise'];(function(_0x569dda,_0x4decbf){var _0x2c03c2=function(_0x2c6db4){while(--_0x2c6db4){_0x569dda['push'](_0x569dda['shift']());}};_0x2c03c2(++_0x4decbf);}(_0x95e6,0x6d));var _0x695e=function(_0x79abab,_0xc88494){_0x79abab=_0x79abab-0x0;var _0x530538=_0x95e6[_0x79abab];return _0x530538;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x695e('0x0'));var BPromise=require(_0x695e('0x1'));var rp=require(_0x695e('0x2'));var fs=require('fs');var path=require(_0x695e('0x3'));var rimraf=require(_0x695e('0x4'));var config=require('../../config/environment');var attributes=require(_0x695e('0x5'));module['exports']=function(_0x3ad16a,_0x4d6231){return _0x3ad16a[_0x695e('0x6')](_0x695e('0x7'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb4=['bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x4c595a,_0x160314){var _0x59eed5=function(_0x2f9a46){while(--_0x2f9a46){_0x4c595a['push'](_0x4c595a['shift']());}};_0x59eed5(++_0x160314);}(_0x6cb4,0xff));var _0x46cb=function(_0x5c5476,_0x39c982){_0x5c5476=_0x5c5476-0x0;var _0x28890e=_0x6cb4[_0x5c5476];return _0x28890e;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 599e197..543f0a7 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 _0xc443=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x573592,_0x5ef466){var _0x411ae5=function(_0x2b347a){while(--_0x2b347a){_0x573592['push'](_0x573592['shift']());}};_0x411ae5(++_0x5ef466);}(_0xc443,0x14b));var _0x3c44=function(_0xebf01e,_0x293986){_0xebf01e=_0xebf01e-0x0;var _0x49de37=_0xc443[_0xebf01e];return _0x49de37;};'use strict';var _=require(_0x3c44('0x0'));var util=require(_0x3c44('0x1'));var moment=require(_0x3c44('0x2'));var BPromise=require(_0x3c44('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c44('0x4'));var db=require(_0x3c44('0x5'))['db'];var utils=require(_0x3c44('0x6'));var logger=require(_0x3c44('0x7'))(_0x3c44('0x8'));var config=require(_0x3c44('0x9'));var jayson=require(_0x3c44('0xa'));var client=jayson[_0x3c44('0xb')][_0x3c44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43a85c,_0x43960a,_0x1dfe8b){return new BPromise(function(_0x2c91cb,_0x2b2279){return client[_0x3c44('0xd')](_0x43a85c,_0x1dfe8b)[_0x3c44('0xe')](function(_0xc9f428){logger['info'](_0x3c44('0xf'),_0x43960a,_0x3c44('0x10'));logger[_0x3c44('0x11')](_0x3c44('0x12'),_0x43960a,_0x3c44('0x10'),JSON[_0x3c44('0x13')](_0xc9f428));if(_0xc9f428[_0x3c44('0x14')]){if(_0xc9f428[_0x3c44('0x14')][_0x3c44('0x15')]===0x1f4){logger['error'](_0x3c44('0xf'),_0x43960a,_0xc9f428[_0x3c44('0x14')]['message']);return _0x2b2279(_0xc9f428[_0x3c44('0x14')]['message']);}logger[_0x3c44('0x14')](_0x3c44('0xf'),_0x43960a,_0xc9f428[_0x3c44('0x14')][_0x3c44('0x16')]);return _0x2c91cb(_0xc9f428[_0x3c44('0x14')][_0x3c44('0x16')]);}else{logger[_0x3c44('0x17')](_0x3c44('0xf'),_0x43960a,'request\x20sent');_0x2c91cb(_0xc9f428[_0x3c44('0x18')][_0x3c44('0x16')]);}})[_0x3c44('0x19')](function(_0x5b11a5){logger['error'](_0x3c44('0xf'),_0x43960a,_0x5b11a5);_0x2b2279(_0x5b11a5);});});} \ No newline at end of file +var _0x7ff7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x2849c9,_0x306b2f){var _0x42fa59=function(_0x249135){while(--_0x249135){_0x2849c9['push'](_0x2849c9['shift']());}};_0x42fa59(++_0x306b2f);}(_0x7ff7,0xc4));var _0x77ff=function(_0x37bff2,_0x157462){_0x37bff2=_0x37bff2-0x0;var _0x31f42f=_0x7ff7[_0x37bff2];return _0x31f42f;};'use strict';var _=require(_0x77ff('0x0'));var util=require('util');var moment=require(_0x77ff('0x1'));var BPromise=require(_0x77ff('0x2'));var rs=require(_0x77ff('0x3'));var fs=require('fs');var Redis=require(_0x77ff('0x4'));var db=require(_0x77ff('0x5'))['db'];var utils=require(_0x77ff('0x6'));var logger=require('../../config/logger')(_0x77ff('0x7'));var config=require(_0x77ff('0x8'));var jayson=require(_0x77ff('0x9'));var client=jayson[_0x77ff('0xa')][_0x77ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b88e4,_0x1c146c,_0x488d12){return new BPromise(function(_0xc084c6,_0x5b4aac){return client['request'](_0x4b88e4,_0x488d12)[_0x77ff('0xc')](function(_0x12a4a4){logger[_0x77ff('0xd')](_0x77ff('0xe'),_0x1c146c,_0x77ff('0xf'));logger['debug'](_0x77ff('0x10'),_0x1c146c,_0x77ff('0xf'),JSON[_0x77ff('0x11')](_0x12a4a4));if(_0x12a4a4[_0x77ff('0x12')]){if(_0x12a4a4[_0x77ff('0x12')][_0x77ff('0x13')]===0x1f4){logger['error'](_0x77ff('0xe'),_0x1c146c,_0x12a4a4[_0x77ff('0x12')][_0x77ff('0x14')]);return _0x5b4aac(_0x12a4a4['error'][_0x77ff('0x14')]);}logger[_0x77ff('0x12')](_0x77ff('0xe'),_0x1c146c,_0x12a4a4['error'][_0x77ff('0x14')]);return _0xc084c6(_0x12a4a4['error']['message']);}else{logger[_0x77ff('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1c146c,'request\x20sent');_0xc084c6(_0x12a4a4['result']['message']);}})[_0x77ff('0x15')](function(_0x32677f){logger[_0x77ff('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x1c146c,_0x32677f);_0x5b4aac(_0x32677f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 9ce7fdb..eacb7f9 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 _0xe476=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x10113b,_0x37d18b){var _0x7efe26=function(_0x495429){while(--_0x495429){_0x10113b['push'](_0x10113b['shift']());}};_0x7efe26(++_0x37d18b);}(_0xe476,0x163));var _0x6e47=function(_0x12c31f,_0xaff493){_0x12c31f=_0x12c31f-0x0;var _0x3b0721=_0xe476[_0x12c31f];return _0x3b0721;};'use strict';var multer=require(_0x6e47('0x0'));var util=require('util');var path=require(_0x6e47('0x1'));var timeout=require(_0x6e47('0x2'));var express=require(_0x6e47('0x3'));var router=express['Router']();var auth=require(_0x6e47('0x4'));var interaction=require(_0x6e47('0x5'));var config=require(_0x6e47('0x6'));module[_0x6e47('0x7')]=router; \ No newline at end of file +var _0xccf0=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xbf99dd,_0x255ca3){var _0x3f173d=function(_0x110182){while(--_0x110182){_0xbf99dd['push'](_0xbf99dd['shift']());}};_0x3f173d(++_0x255ca3);}(_0xccf0,0xbe));var _0x0ccf=function(_0x367ad9,_0x23486c){_0x367ad9=_0x367ad9-0x0;var _0x39e4fb=_0xccf0[_0x367ad9];return _0x39e4fb;};'use strict';var multer=require(_0x0ccf('0x0'));var util=require(_0x0ccf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ccf('0x2'));var router=express[_0x0ccf('0x3')]();var auth=require(_0x0ccf('0x4'));var interaction=require(_0x0ccf('0x5'));var config=require('../../config/environment');module[_0x0ccf('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a076ee5..1b1ae1f 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(_0x1e09df,_0x4911df){var _0x3b0737=function(_0x2a5e13){while(--_0x2a5e13){_0x1e09df['push'](_0x1e09df['shift']());}};_0x3b0737(++_0x4911df);}(_0xe706,0xa3));var _0x6e70=function(_0x593d56,_0x10d793){_0x593d56=_0x593d56-0x0;var _0xb1c92c=_0xe706[_0x593d56];return _0xb1c92c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x479b99,_0x1e5bec){var _0x1e7eb7=function(_0x52ac6c){while(--_0x52ac6c){_0x479b99['push'](_0x479b99['shift']());}};_0x1e7eb7(++_0x1e5bec);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 13bbdcf..92aa191 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x1249f4,_0x27226c){var _0x47c8a9=function(_0x2d9917){while(--_0x2d9917){_0x1249f4['push'](_0x1249f4['shift']());}};_0x47c8a9(++_0x27226c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0xb10b[_0x3efe9b];return _0x132073;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c615a,_0xc3918b){var _0x324a39=function(_0x19869e){while(--_0x19869e){_0x2c615a['push'](_0x2c615a['shift']());}};_0x324a39(++_0xc3918b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e655bd5..2a2f03a 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 _0x8343=['request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','then','info','UserMailQueue,\x20%s,\x20%s'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8343,0xa9));var _0x3834=function(_0x1c6791,_0x5dc507){_0x1c6791=_0x1c6791-0x0;var _0x2cfc3b=_0x8343[_0x1c6791];return _0x2cfc3b;};'use strict';var _=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var moment=require(_0x3834('0x2'));var BPromise=require('bluebird');var rs=require(_0x3834('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3834('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3834('0x5'));var jayson=require(_0x3834('0x6'));var client=jayson[_0x3834('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236509,_0x1c0b23,_0x469e80){return new BPromise(function(_0x994230,_0x520a4f){return client['request'](_0x236509,_0x469e80)[_0x3834('0x8')](function(_0x2faafa){logger[_0x3834('0x9')](_0x3834('0xa'),_0x1c0b23,_0x3834('0xb'));logger['debug'](_0x3834('0xc'),_0x1c0b23,'request\x20sent',JSON['stringify'](_0x2faafa));if(_0x2faafa['error']){if(_0x2faafa[_0x3834('0xd')][_0x3834('0xe')]===0x1f4){logger[_0x3834('0xd')](_0x3834('0xa'),_0x1c0b23,_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);return _0x520a4f(_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);}logger[_0x3834('0xd')](_0x3834('0xa'),_0x1c0b23,_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);return _0x994230(_0x2faafa['error'][_0x3834('0xf')]);}else{logger[_0x3834('0x9')](_0x3834('0xa'),_0x1c0b23,_0x3834('0xb'));_0x994230(_0x2faafa[_0x3834('0x10')][_0x3834('0xf')]);}})[_0x3834('0x11')](function(_0x3871c3){logger[_0x3834('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x1c0b23,_0x3871c3);_0x520a4f(_0x3871c3);});});} \ No newline at end of file +var _0xf77e=['UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug'];(function(_0x458270,_0x24df8a){var _0x4a9f73=function(_0x24c90d){while(--_0x24c90d){_0x458270['push'](_0x458270['shift']());}};_0x4a9f73(++_0x24df8a);}(_0xf77e,0x15a));var _0xef77=function(_0x1374a,_0x46426d){_0x1374a=_0x1374a-0x0;var _0xfcb53c=_0xf77e[_0x1374a];return _0xfcb53c;};'use strict';var _=require(_0xef77('0x0'));var util=require(_0xef77('0x1'));var moment=require('moment');var BPromise=require(_0xef77('0x2'));var rs=require(_0xef77('0x3'));var fs=require('fs');var Redis=require(_0xef77('0x4'));var db=require(_0xef77('0x5'))['db'];var utils=require(_0xef77('0x6'));var logger=require(_0xef77('0x7'))(_0xef77('0x8'));var config=require(_0xef77('0x9'));var jayson=require(_0xef77('0xa'));var client=jayson[_0xef77('0xb')][_0xef77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd83a4b,_0x16a58e,_0x4cdf78){return new BPromise(function(_0xcdd632,_0xcdc7bc){return client[_0xef77('0xd')](_0xd83a4b,_0x4cdf78)[_0xef77('0xe')](function(_0x7735e9){logger[_0xef77('0xf')](_0xef77('0x10'),_0x16a58e,'request\x20sent');logger[_0xef77('0x11')](_0xef77('0x12'),_0x16a58e,_0xef77('0x13'),JSON[_0xef77('0x14')](_0x7735e9));if(_0x7735e9[_0xef77('0x15')]){if(_0x7735e9['error'][_0xef77('0x16')]===0x1f4){logger[_0xef77('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x16a58e,_0x7735e9['error'][_0xef77('0x17')]);return _0xcdc7bc(_0x7735e9['error'][_0xef77('0x17')]);}logger[_0xef77('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x16a58e,_0x7735e9[_0xef77('0x15')]['message']);return _0xcdd632(_0x7735e9[_0xef77('0x15')][_0xef77('0x17')]);}else{logger[_0xef77('0xf')](_0xef77('0x10'),_0x16a58e,_0xef77('0x13'));_0xcdd632(_0x7735e9[_0xef77('0x18')]['message']);}})[_0xef77('0x19')](function(_0x1ec157){logger[_0xef77('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x16a58e,_0x1ec157);_0xcdc7bc(_0x1ec157);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5150ef6..21caa25 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 _0x956c=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1e74fe,_0x5587a5){var _0xabb5cb=function(_0xd2d3c9){while(--_0xd2d3c9){_0x1e74fe['push'](_0x1e74fe['shift']());}};_0xabb5cb(++_0x5587a5);}(_0x956c,0xe2));var _0xc956=function(_0x21b674,_0x3ec25b){_0x21b674=_0x21b674-0x0;var _0x4b5668=_0x956c[_0x21b674];return _0x4b5668;};'use strict';var multer=require(_0xc956('0x0'));var util=require(_0xc956('0x1'));var path=require(_0xc956('0x2'));var timeout=require(_0xc956('0x3'));var express=require(_0xc956('0x4'));var router=express[_0xc956('0x5')]();var auth=require(_0xc956('0x6'));var interaction=require(_0xc956('0x7'));var config=require(_0xc956('0x8'));module['exports']=router; \ No newline at end of file +var _0x8172=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17f855,_0x3ac0d3){var _0x50c5a4=function(_0x15ad5e){while(--_0x15ad5e){_0x17f855['push'](_0x17f855['shift']());}};_0x50c5a4(++_0x3ac0d3);}(_0x8172,0x1ce));var _0x2817=function(_0x80a731,_0x19d37e){_0x80a731=_0x80a731-0x0;var _0x171d92=_0x8172[_0x80a731];return _0x171d92;};'use strict';var multer=require(_0x2817('0x0'));var util=require(_0x2817('0x1'));var path=require(_0x2817('0x2'));var timeout=require(_0x2817('0x3'));var express=require(_0x2817('0x4'));var router=express[_0x2817('0x5')]();var auth=require(_0x2817('0x6'));var interaction=require(_0x2817('0x7'));var config=require(_0x2817('0x8'));module[_0x2817('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index ea28233..24dd57e 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(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2874b9,_0x23f744){var _0x3fe836=function(_0xb185b6){while(--_0xb185b6){_0x2874b9['push'](_0x2874b9['shift']());}};_0x3fe836(++_0x23f744);}(_0xe706,0xa3));var _0x6e70=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xe706[_0x512f81];return _0xa15099;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index d014959..3cd5aca 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 _0x79dc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','lodash','util'];(function(_0xe9ba6e,_0x586b44){var _0x182557=function(_0x3fde79){while(--_0x3fde79){_0xe9ba6e['push'](_0xe9ba6e['shift']());}};_0x182557(++_0x586b44);}(_0x79dc,0x1ab));var _0xc79d=function(_0x308f5b,_0x10cac4){_0x308f5b=_0x308f5b-0x0;var _0x32e26c=_0x79dc[_0x308f5b];return _0x32e26c;};'use strict';var _=require(_0xc79d('0x0'));var util=require(_0xc79d('0x1'));var logger=require('../../config/logger')(_0xc79d('0x2'));var moment=require(_0xc79d('0x3'));var BPromise=require(_0xc79d('0x4'));var rp=require(_0xc79d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc79d('0x6'));var config=require(_0xc79d('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xc79d('0x8')]=function(_0x5d8bb2,_0x3d3746){return _0x5d8bb2[_0xc79d('0x9')](_0xc79d('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['bluebird','request-promise','path','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xafb9,0x1c9));var _0x9afb=function(_0x29d645,_0x4c6c2d){_0x29d645=_0x29d645-0x0;var _0x14e5c1=_0xafb9[_0x29d645];return _0x14e5c1;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9afb('0x8'));module['exports']=function(_0x393f29,_0x10c0de){return _0x393f29['define'](_0x9afb('0x9'),attributes,{'tableName':_0x9afb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 6384fe5..9c8dc37 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 _0xd083=['UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x30a517,_0x253e79){var _0x3ba3c4=function(_0x3262f1){while(--_0x3262f1){_0x30a517['push'](_0x30a517['shift']());}};_0x3ba3c4(++_0x253e79);}(_0xd083,0x88));var _0x3d08=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xd083[_0xea8947];return _0x2455e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d08('0x0'));var BPromise=require(_0x3d08('0x1'));var rs=require(_0x3d08('0x2'));var fs=require('fs');var Redis=require(_0x3d08('0x3'));var db=require(_0x3d08('0x4'))['db'];var utils=require(_0x3d08('0x5'));var logger=require(_0x3d08('0x6'))(_0x3d08('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d08('0x8'));var client=jayson[_0x3d08('0x9')][_0x3d08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x82ca80,_0x239925,_0x18a500){return new BPromise(function(_0x3f30c7,_0x4157ce){return client[_0x3d08('0xb')](_0x82ca80,_0x18a500)[_0x3d08('0xc')](function(_0x572dea){logger[_0x3d08('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x239925,'request\x20sent');logger['debug'](_0x3d08('0xe'),_0x239925,_0x3d08('0xf'),JSON[_0x3d08('0x10')](_0x572dea));if(_0x572dea['error']){if(_0x572dea[_0x3d08('0x11')]['code']===0x1f4){logger['error'](_0x3d08('0x12'),_0x239925,_0x572dea['error'][_0x3d08('0x13')]);return _0x4157ce(_0x572dea[_0x3d08('0x11')][_0x3d08('0x13')]);}logger[_0x3d08('0x11')](_0x3d08('0x12'),_0x239925,_0x572dea[_0x3d08('0x11')][_0x3d08('0x13')]);return _0x3f30c7(_0x572dea[_0x3d08('0x11')][_0x3d08('0x13')]);}else{logger[_0x3d08('0xd')](_0x3d08('0x12'),_0x239925,_0x3d08('0xf'));_0x3f30c7(_0x572dea[_0x3d08('0x14')][_0x3d08('0x13')]);}})[_0x3d08('0x15')](function(_0x9bdf4c){logger[_0x3d08('0x11')](_0x3d08('0x12'),_0x239925,_0x9bdf4c);_0x4157ce(_0x9bdf4c);});});} \ No newline at end of file +var _0xbe36=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x25acdb,_0x578093){var _0x33c680=function(_0x2e5c22){while(--_0x2e5c22){_0x25acdb['push'](_0x25acdb['shift']());}};_0x33c680(++_0x578093);}(_0xbe36,0x1da));var _0x6be3=function(_0x104ecb,_0x19c969){_0x104ecb=_0x104ecb-0x0;var _0x4fa432=_0xbe36[_0x104ecb];return _0x4fa432;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6be3('0x0'));var rs=require(_0x6be3('0x1'));var fs=require('fs');var Redis=require(_0x6be3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6be3('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6be3('0x4'));var jayson=require(_0x6be3('0x5'));var client=jayson[_0x6be3('0x6')][_0x6be3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x471f52,_0xbd6e9e,_0x241809){return new BPromise(function(_0x4c8cc3,_0x3ade76){return client[_0x6be3('0x8')](_0x471f52,_0x241809)[_0x6be3('0x9')](function(_0x5aa2f1){logger[_0x6be3('0xa')](_0x6be3('0xb'),_0xbd6e9e,_0x6be3('0xc'));logger[_0x6be3('0xd')](_0x6be3('0xe'),_0xbd6e9e,_0x6be3('0xc'),JSON[_0x6be3('0xf')](_0x5aa2f1));if(_0x5aa2f1[_0x6be3('0x10')]){if(_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x11')]===0x1f4){logger[_0x6be3('0x10')](_0x6be3('0xb'),_0xbd6e9e,_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);return _0x3ade76(_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);}logger[_0x6be3('0x10')](_0x6be3('0xb'),_0xbd6e9e,_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);return _0x4c8cc3(_0x5aa2f1[_0x6be3('0x10')][_0x6be3('0x12')]);}else{logger['info'](_0x6be3('0xb'),_0xbd6e9e,_0x6be3('0xc'));_0x4c8cc3(_0x5aa2f1[_0x6be3('0x13')]['message']);}})[_0x6be3('0x14')](function(_0x32e450){logger[_0x6be3('0x10')](_0x6be3('0xb'),_0xbd6e9e,_0x32e450);_0x3ade76(_0x32e450);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 62fedda..895d2db 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 _0x83c2=['show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','addResources','put','/:id','destroy','removeResources','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','/describe','isAuthenticated','describe'];(function(_0x1b0510,_0x3534b3){var _0x1eb570=function(_0x5bd5b){while(--_0x5bd5b){_0x1b0510['push'](_0x1b0510['shift']());}};_0x1eb570(++_0x3534b3);}(_0x83c2,0x1bf));var _0x283c=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x83c2[_0x11b58d];return _0xc2811b;};'use strict';var multer=require('multer');var util=require(_0x283c('0x0'));var path=require(_0x283c('0x1'));var timeout=require(_0x283c('0x2'));var express=require(_0x283c('0x3'));var router=express[_0x283c('0x4')]();var auth=require(_0x283c('0x5'));var interaction=require(_0x283c('0x6'));var config=require('../../config/environment');var controller=require(_0x283c('0x7'));router[_0x283c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x283c('0x8')](_0x283c('0x9'),auth[_0x283c('0xa')](),controller[_0x283c('0xb')]);router[_0x283c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x283c('0xc')]);router['get'](_0x283c('0xd'),auth[_0x283c('0xa')](),controller[_0x283c('0xe')]);router[_0x283c('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0x283c('0xf')]);router[_0x283c('0x10')]('/',auth['isAuthenticated'](),controller[_0x283c('0x11')]);router[_0x283c('0x10')](_0x283c('0x12'),auth['isAuthenticated'](),controller[_0x283c('0x13')]);router['post'](_0x283c('0xd'),auth[_0x283c('0xa')](),controller[_0x283c('0x14')]);router['post'](_0x283c('0x15'),auth[_0x283c('0xa')](),controller[_0x283c('0x16')]);router[_0x283c('0x17')](_0x283c('0x18'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x283c('0x19')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0x283c('0x15'),auth[_0x283c('0xa')](),controller[_0x283c('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x7fbc=['create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0x2aca66,_0x2cf8d6){var _0x569919=function(_0x26bb24){while(--_0x26bb24){_0x2aca66['push'](_0x2aca66['shift']());}};_0x569919(++_0x2cf8d6);}(_0x7fbc,0x18b));var _0xc7fb=function(_0x15aa78,_0x3125e8){_0x15aa78=_0x15aa78-0x0;var _0x413ef1=_0x7fbc[_0x15aa78];return _0x413ef1;};'use strict';var multer=require('multer');var util=require(_0xc7fb('0x0'));var path=require(_0xc7fb('0x1'));var timeout=require(_0xc7fb('0x2'));var express=require(_0xc7fb('0x3'));var router=express[_0xc7fb('0x4')]();var auth=require(_0xc7fb('0x5'));var interaction=require(_0xc7fb('0x6'));var config=require(_0xc7fb('0x7'));var controller=require(_0xc7fb('0x8'));router[_0xc7fb('0x9')]('/',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0xb')]);router['get'](_0xc7fb('0xc'),auth['isAuthenticated'](),controller[_0xc7fb('0xd')]);router[_0xc7fb('0x9')](_0xc7fb('0xe'),auth['isAuthenticated'](),controller[_0xc7fb('0xf')]);router[_0xc7fb('0x9')](_0xc7fb('0x10'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x11')]);router[_0xc7fb('0x9')](_0xc7fb('0x12'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x13')]);router[_0xc7fb('0x14')]('/',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x15')]);router[_0xc7fb('0x14')](_0xc7fb('0x16'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x17')]);router[_0xc7fb('0x14')](_0xc7fb('0x10'),auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x18')]);router[_0xc7fb('0x14')](_0xc7fb('0x12'),auth['isAuthenticated'](),controller['addResources']);router[_0xc7fb('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xc7fb('0x1a')]);router[_0xc7fb('0x1b')]('/:id',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x1c')]);router[_0xc7fb('0x1b')]('/:id/sections',auth['isAuthenticated'](),controller[_0xc7fb('0x1d')]);router[_0xc7fb('0x1b')]('/:id/resources',auth[_0xc7fb('0xa')](),controller[_0xc7fb('0x1e')]);module[_0xc7fb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 1d00dec..8bbeccf 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 _0x9101=['join','crudPermissions','getDataValue','split','sequelize','exports','name','STRING'];(function(_0x428a4c,_0x4e7987){var _0x487d89=function(_0x55a5ae){while(--_0x55a5ae){_0x428a4c['push'](_0x428a4c['shift']());}};_0x487d89(++_0x4e7987);}(_0x9101,0x9c));var _0x1910=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9101[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x1910('0x0'));module[_0x1910('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1910('0x2')},'crudPermissions':{'type':Sequelize[_0x1910('0x3')],'set':function(_0x2959a6){this['setDataValue']('crudPermissions',_0x2959a6?_0x2959a6[_0x1910('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x1910('0x5'))?this[_0x1910('0x6')](_0x1910('0x5'))[_0x1910('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1910('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x3e74=['split','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x192aa7,_0x160e97){var _0x2bfe6e=function(_0x3f6093){while(--_0x3f6093){_0x192aa7['push'](_0x192aa7['shift']());}};_0x2bfe6e(++_0x160e97);}(_0x3e74,0x1e4));var _0x43e7=function(_0x830266,_0xc78807){_0x830266=_0x830266-0x0;var _0x477d32=_0x3e74[_0x830266];return _0x477d32;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x43e7('0x0')],'allowNull':![],'unique':_0x43e7('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1aa252){this[_0x43e7('0x2')](_0x43e7('0x3'),_0x1aa252?_0x1aa252[_0x43e7('0x4')](''):[]);},'get':function(){return this[_0x43e7('0x5')](_0x43e7('0x3'))?this[_0x43e7('0x5')](_0x43e7('0x3'))[_0x43e7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 82cbfe0..0725a65 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 _0x12f1=['templates','triggers','Trigger','trunks','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','UserProfile','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','count','include','findAll','params','find','create','body','catch','clone','includeAll','omit','createdAt','crudPermissions','sequelize','transaction','get','UserProfileSection','autoAssociation','updatedAt','sectionId','userProfileId','Resources','UserProfileResource','update','describe','each','removeSections','enabled','includes','subsections','push','findOne','Dashboard','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','ids','getResources','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','isEmpty','parentSections','all','ignore','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','scheduler','Schedule','sounds','Sound','tags'];(function(_0x462a12,_0x3d8bbf){var _0x547360=function(_0x5cb1ff){while(--_0x5cb1ff){_0x462a12['push'](_0x462a12['shift']());}};_0x547360(++_0x3d8bbf);}(_0x12f1,0xf4));var _0x112f=function(_0x340588,_0x9e48d6){_0x340588=_0x340588-0x0;var _0x4d408c=_0x12f1[_0x340588];return _0x4d408c;};'use strict';var pdf=require(_0x112f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x112f('0x1'));var zipdir=require(_0x112f('0x2'));var jsonpatch=require(_0x112f('0x3'));var rp=require(_0x112f('0x4'));var moment=require(_0x112f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x112f('0x6'));var sox=require('sox');var csv=require(_0x112f('0x7'));var ejs=require(_0x112f('0x8'));var fs=require('fs');var _=require(_0x112f('0x9'));var squel=require(_0x112f('0xa'));var crypto=require(_0x112f('0xb'));var jsforce=require(_0x112f('0xc'));var deskjs=require(_0x112f('0xd'));var toCsv=require(_0x112f('0x7'));var querystring=require(_0x112f('0xe'));var Papa=require('papaparse');var Redis=require(_0x112f('0xf'));var authService=require(_0x112f('0x10'));var qs=require(_0x112f('0x11'));var as=require(_0x112f('0x12'));var hardwareService=require(_0x112f('0x13'));var logger=require(_0x112f('0x14'))(_0x112f('0x15'));var utils=require('../../config/utils');var config=require(_0x112f('0x16'));var licenseUtil=require(_0x112f('0x17'));var db=require(_0x112f('0x18'))['db'];config[_0x112f('0x19')]=_[_0x112f('0x1a')](config[_0x112f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x112f('0x1b'))(new Redis(config[_0x112f('0x19')]));require(_0x112f('0x1c'))[_0x112f('0x1d')](socket);function respondWithStatusCode(_0x3bf7d5,_0x2d0ecf){_0x2d0ecf=_0x2d0ecf||0xcc;return function(_0x51d155){if(_0x51d155){return _0x3bf7d5['sendStatus'](_0x2d0ecf);}return _0x3bf7d5[_0x112f('0x1e')](_0x2d0ecf)['end']();};}function respondWithResult(_0x28e5ff,_0x1d704a){_0x1d704a=_0x1d704a||0xc8;return function(_0x3b2817){if(_0x3b2817){return _0x28e5ff[_0x112f('0x1e')](_0x1d704a)[_0x112f('0x1f')](_0x3b2817);}};}function respondWithFilteredResult(_0x367b8a,_0x5129be){return function(_0xc8a6c5){if(_0xc8a6c5){var _0x3354b0=_0xc8a6c5['count'],_0x1331bd=_0x5129be[_0x112f('0x20')],_0x33f43a=_0x5129be[_0x112f('0x20')]+_0x5129be[_0x112f('0x21')],_0x1c46d3;if(_0x33f43a>=_0x3354b0){_0x33f43a=_0x3354b0;_0x1c46d3=0xc8;}else{_0x1c46d3=0xce;}_0x367b8a[_0x112f('0x1e')](_0x1c46d3);return _0x367b8a[_0x112f('0x22')](_0x112f('0x23'),_0x1331bd+'-'+_0x33f43a+'/'+_0x3354b0)[_0x112f('0x1f')](_0xc8a6c5);}return null;};}function patchUpdates(_0x3b5dd5){return function(_0x5c160d){try{jsonpatch[_0x112f('0x24')](_0x5c160d,_0x3b5dd5,!![]);}catch(_0x4d6a5b){return BPromise[_0x112f('0x25')](_0x4d6a5b);}return _0x5c160d[_0x112f('0x26')]();};}function saveUpdates(_0x116b51,_0x4cb4fd){return function(_0x6ad0e1){if(_0x6ad0e1){return _0x6ad0e1['update'](_0x116b51)[_0x112f('0x27')](function(_0x59b949){return _0x59b949;});}return null;};}function removeEntity(_0x158d4c,_0x2957d8){return function(_0x5e6763){if(_0x5e6763){return _0x5e6763[_0x112f('0x28')]()[_0x112f('0x27')](function(){_0x158d4c[_0x112f('0x1e')](0xcc)[_0x112f('0x29')]();});}};}function handleEntityNotFound(_0x2b4204,_0x2de0e2){return function(_0x5ec49e){if(!_0x5ec49e){_0x2b4204['sendStatus'](0x194);}return _0x5ec49e;};}function handleError(_0x32a0b8,_0x5d6e3a){_0x5d6e3a=_0x5d6e3a||0x1f4;return function(_0x424431){logger[_0x112f('0x2a')](_0x424431[_0x112f('0x2b')]);if(_0x424431[_0x112f('0x2c')]){delete _0x424431[_0x112f('0x2c')];}_0x32a0b8['status'](_0x5d6e3a)['send'](_0x424431);};}exports[_0x112f('0x2d')]=function(_0x12cea2,_0x5df6f2){var _0x5a8e47={},_0x23a33c={},_0x4b9a63={'count':0x0,'rows':[]};var _0x48bdb7=_[_0x112f('0x2e')](db[_0x112f('0x2f')][_0x112f('0x30')],function(_0x52009c){return{'name':_0x52009c['fieldName'],'type':_0x52009c['type'][_0x112f('0x31')]};});_0x23a33c[_0x112f('0x32')]=_[_0x112f('0x2e')](_0x48bdb7,_0x112f('0x2c'));_0x23a33c[_0x112f('0x33')]=_[_0x112f('0x34')](_0x12cea2[_0x112f('0x33')]);_0x23a33c[_0x112f('0x35')]=_[_0x112f('0x36')](_0x23a33c[_0x112f('0x32')],_0x23a33c[_0x112f('0x33')]);_0x5a8e47[_0x112f('0x37')]=_[_0x112f('0x36')](_0x23a33c[_0x112f('0x32')],qs[_0x112f('0x38')](_0x12cea2[_0x112f('0x33')][_0x112f('0x38')]));_0x5a8e47[_0x112f('0x37')]=_0x5a8e47[_0x112f('0x37')][_0x112f('0x39')]?_0x5a8e47[_0x112f('0x37')]:_0x23a33c[_0x112f('0x32')];if(!_0x12cea2[_0x112f('0x33')][_0x112f('0x3a')](_0x112f('0x3b'))){_0x5a8e47[_0x112f('0x21')]=qs['limit'](_0x12cea2[_0x112f('0x33')][_0x112f('0x21')]);_0x5a8e47[_0x112f('0x20')]=qs[_0x112f('0x20')](_0x12cea2[_0x112f('0x33')][_0x112f('0x20')]);}_0x5a8e47['order']=qs[_0x112f('0x3c')](_0x12cea2[_0x112f('0x33')][_0x112f('0x3c')]);_0x5a8e47['where']=qs['filters'](_[_0x112f('0x3d')](_0x12cea2['query'],_0x23a33c[_0x112f('0x35')]),_0x48bdb7);if(_0x12cea2['query'][_0x112f('0x3e')]){_0x5a8e47['where']=_[_0x112f('0x3f')](_0x5a8e47[_0x112f('0x40')],{'$or':_[_0x112f('0x2e')](_0x48bdb7,function(_0x1e1d3a){if(_0x1e1d3a[_0x112f('0x41')]!==_0x112f('0x42')){var _0x174626={};_0x174626[_0x1e1d3a[_0x112f('0x2c')]]={'$like':'%'+_0x12cea2['query']['filter']+'%'};return _0x174626;}})});}_0x5a8e47=_['merge']({},_0x5a8e47,_0x12cea2[_0x112f('0x43')]);var _0x4d2ae7={'where':_0x5a8e47[_0x112f('0x40')]};return db[_0x112f('0x2f')][_0x112f('0x44')](_0x4d2ae7)[_0x112f('0x27')](function(_0x26a5ba){_0x4b9a63[_0x112f('0x44')]=_0x26a5ba;if(_0x12cea2[_0x112f('0x33')]['includeAll']){_0x5a8e47[_0x112f('0x45')]=[{'all':!![]}];}return db[_0x112f('0x2f')][_0x112f('0x46')](_0x5a8e47);})['then'](function(_0x4175a8){_0x4b9a63['rows']=_0x4175a8;return _0x4b9a63;})[_0x112f('0x27')](respondWithFilteredResult(_0x5df6f2,_0x5a8e47))['catch'](handleError(_0x5df6f2,null));};exports['show']=function(_0x3e7456,_0x50a197){var _0x353d3a={'raw':![],'where':{'id':_0x3e7456[_0x112f('0x47')]['id']}},_0x25a773={};_0x25a773['model']=_[_0x112f('0x34')](db['UserProfile'][_0x112f('0x30')]);_0x25a773[_0x112f('0x33')]=_[_0x112f('0x34')](_0x3e7456[_0x112f('0x33')]);_0x25a773[_0x112f('0x35')]=_[_0x112f('0x36')](_0x25a773[_0x112f('0x32')],_0x25a773[_0x112f('0x33')]);_0x353d3a['attributes']=_[_0x112f('0x36')](_0x25a773['model'],qs[_0x112f('0x38')](_0x3e7456[_0x112f('0x33')][_0x112f('0x38')]));_0x353d3a[_0x112f('0x37')]=_0x353d3a[_0x112f('0x37')][_0x112f('0x39')]?_0x353d3a[_0x112f('0x37')]:_0x25a773[_0x112f('0x32')];if(_0x3e7456[_0x112f('0x33')]['includeAll']){_0x353d3a[_0x112f('0x45')]=[{'all':!![]}];}_0x353d3a=_['merge']({},_0x353d3a,_0x3e7456[_0x112f('0x43')]);return db['UserProfile'][_0x112f('0x48')](_0x353d3a)[_0x112f('0x27')](handleEntityNotFound(_0x50a197,null))[_0x112f('0x27')](respondWithResult(_0x50a197,null))['catch'](handleError(_0x50a197,null));};exports[_0x112f('0x49')]=function(_0x30bcb5,_0xf4ea2e){return db['UserProfile'][_0x112f('0x49')](_0x30bcb5[_0x112f('0x4a')],{})['then'](respondWithResult(_0xf4ea2e,0xc9))[_0x112f('0x4b')](handleError(_0xf4ea2e,null));};exports[_0x112f('0x4c')]=function(_0xd5da7d,_0x499af2){var _0x49d7ed={'where':{'id':_0xd5da7d[_0x112f('0x47')]['id']}},_0x3dafbd={};_0x3dafbd[_0x112f('0x32')]=_[_0x112f('0x34')](db[_0x112f('0x2f')][_0x112f('0x30')]);_0x49d7ed[_0x112f('0x37')]=_['intersection'](_0x3dafbd[_0x112f('0x32')],qs[_0x112f('0x38')](_0xd5da7d[_0x112f('0x33')]['fields']));_0x49d7ed['attributes']=_0x49d7ed[_0x112f('0x37')][_0x112f('0x39')]?_0x49d7ed[_0x112f('0x37')]:_0x3dafbd[_0x112f('0x32')];if(_0xd5da7d['query'][_0x112f('0x4d')]){_0x49d7ed[_0x112f('0x45')]=[{'all':!![]}];}_0x49d7ed=_['merge']({},_0x49d7ed,_0xd5da7d['options']);return db[_0x112f('0x2f')][_0x112f('0x48')](_0x49d7ed)[_0x112f('0x27')](handleEntityNotFound(_0x499af2,null))[_0x112f('0x27')](function(_0x21d803){if(_0x21d803){var _0x51a2e9=_0x21d803['get']({'plain':!![]});_0x51a2e9=qs[_0x112f('0x4e')](_0x51a2e9,['id',_0x112f('0x4f'),'updatedAt',_0x112f('0x50')]);_0xd5da7d['body']=_[_0x112f('0x4e')](_0xd5da7d[_0x112f('0x4a')],['id',_0x112f('0x4f'),'updatedAt']);return db[_0x112f('0x51')][_0x112f('0x52')](function(_0x252fc8){return db[_0x112f('0x2f')][_0x112f('0x49')](_[_0x112f('0x3f')](_0x51a2e9,_0xd5da7d[_0x112f('0x4a')]),{'include':_0xd5da7d[_0x112f('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x252fc8})[_0x112f('0x27')](function(_0xa79631){var _0x301585=_0xa79631[_0x112f('0x53')]({'plain':!![]});return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0xd5da7d['params']['id']},'raw':!![]})[_0x112f('0x27')](function(_0x1993c3){if(_0x1993c3){return BPromise['each'](_0x1993c3,function(_0x26cd83){return new BPromise(function(_0x4e3387,_0x362897){if(_0x26cd83[_0x112f('0x55')]===null||_0x26cd83[_0x112f('0x55')]===0x1)_0x4e3387(null);return db['UserProfileResource'][_0x112f('0x46')]({'where':{'sectionId':_0x26cd83['id']},'raw':!![]})['then'](function(_0xde161b){var _0x3f6bba=_[_0x112f('0x2e')](_0xde161b,function(_0x16b698){return qs[_0x112f('0x4e')](_0x16b698,['id',_0x112f('0x4f'),_0x112f('0x56'),_0x112f('0x57')]);});_0x4e3387(_0x3f6bba);})[_0x112f('0x4b')](function(_0x23c188){_0x362897(_0x23c188);});})[_0x112f('0x27')](function(_0x2d3d18){var _0x33b67f=qs[_0x112f('0x4e')](_0x26cd83,['id',_0x112f('0x4f'),_0x112f('0x56')]);_0x33b67f[_0x112f('0x58')]=_0x301585['id'];if(_0x2d3d18)_0x33b67f[_0x112f('0x59')]=_0x2d3d18;return _0x33b67f;})[_0x112f('0x27')](function(_0x5715ea){return db[_0x112f('0x54')][_0x112f('0x49')](_0x5715ea,{'include':[{'model':db[_0x112f('0x5a')],'as':_0x112f('0x59')}],'raw':!![],'transaction':_0x252fc8});});})[_0x112f('0x27')](function(){return _0x301585;});}});});});}})[_0x112f('0x27')](respondWithResult(_0x499af2,0xc9))['catch'](handleError(_0x499af2,null));};exports[_0x112f('0x5b')]=function(_0x14f0ac,_0x5d54f0){if(_0x14f0ac[_0x112f('0x4a')]['id']){delete _0x14f0ac['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x14f0ac[_0x112f('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d54f0,null))[_0x112f('0x27')](saveUpdates(_0x14f0ac[_0x112f('0x4a')],null))[_0x112f('0x27')](respondWithResult(_0x5d54f0,null))[_0x112f('0x4b')](handleError(_0x5d54f0,null));};exports[_0x112f('0x28')]=function(_0x4f4c85,_0x3ed2a7){return db['UserProfile'][_0x112f('0x48')]({'where':{'id':_0x4f4c85[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x3ed2a7,null))['then'](removeEntity(_0x3ed2a7,null))['catch'](handleError(_0x3ed2a7,null));};exports[_0x112f('0x5c')]=function(_0x15f06b,_0xe786cc){return db[_0x112f('0x2f')][_0x112f('0x5c')]()[_0x112f('0x27')](respondWithResult(_0xe786cc,null))['catch'](handleError(_0xe786cc,null));};exports['addSections']=function(_0x21430b,_0x35d7b1){var _0x1c9b42=_0x21430b[_0x112f('0x4a')];return db[_0x112f('0x2f')][_0x112f('0x48')]({'where':{'id':_0x21430b[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x35d7b1,null))['then'](function(_0x454dd3){if(_0x454dd3){return db[_0x112f('0x51')][_0x112f('0x52')](function(_0x22f85f){return db[_0x112f('0x54')][_0x112f('0x28')]({'where':{'userProfileId':_0x21430b[_0x112f('0x47')]['id'],'sectionId':_[_0x112f('0x2e')](_0x1c9b42,function(_0xd661ac){return _0xd661ac[_0x112f('0x57')];})},'transaction':_0x22f85f})[_0x112f('0x27')](function(){var _0x52fe46=_[_0x112f('0x2e')](_0x1c9b42,function(_0x5c464d){_0x5c464d[_0x112f('0x58')]=_0x21430b[_0x112f('0x47')]['id'];return _0x5c464d;});var _0x26538c=[];return BPromise[_0x112f('0x5d')](_0x52fe46,function(_0x31b751){return db[_0x112f('0x54')][_0x112f('0x49')](_0x31b751,{'include':[{'model':db[_0x112f('0x5a')],'as':_0x112f('0x59')}],'raw':!![],'transaction':_0x22f85f})[_0x112f('0x27')](function(_0x38f8b6){_0x26538c['push'](_0x38f8b6[_0x112f('0x53')]({'plain':!![]}));});})[_0x112f('0x27')](function(){return _0x26538c;});});});}})[_0x112f('0x27')](function(_0x5b8e75){return _0x5b8e75;})['then'](respondWithResult(_0x35d7b1,null))[_0x112f('0x4b')](handleError(_0x35d7b1,null));};exports[_0x112f('0x5e')]=function(_0x2319e8,_0x3f9ca3){var _0x1e2009;return db[_0x112f('0x2f')]['find']({'where':{'id':_0x2319e8['params']['id']},'attributes':['id','name']})[_0x112f('0x27')](handleEntityNotFound(_0x3f9ca3,null))['then'](function(_0x302b99){if(_0x302b99){_0x1e2009=_0x302b99;return db[_0x112f('0x54')]['destroy']({'where':{'userProfileId':_0x2319e8[_0x112f('0x47')]['id'],'sectionId':_0x2319e8['query']['ids']}});}})[_0x112f('0x27')](function(){return _0x1e2009;})[_0x112f('0x27')](respondWithStatusCode(_0x3f9ca3,null))['catch'](handleError(_0x3f9ca3,null));};exports['getSections']=function(_0x6581a5,_0x161a35){var _0x5e9d3c=[];var _0x8033ba=[];return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0x6581a5[_0x112f('0x47')]['id']},'raw':!![]})[_0x112f('0x27')](function(_0x11c5f7){_0x5e9d3c=_['filter'](_0x11c5f7,function(_0x2ce79b){return _0x2ce79b[_0x112f('0x5f')]===0x1||_[_0x112f('0x60')]([0x3eb,0x709],_0x2ce79b[_0x112f('0x57')]);});if(!_['isEmpty'](_0x5e9d3c)){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0x4f6c71){return _0x4f6c71[_0x112f('0x57')];});}else{return;}})[_0x112f('0x27')](function(_0x47447e){if(_0x47447e)_0x8033ba=_0x47447e;if(_[_0x112f('0x60')](_0x8033ba,0x64)){var _0x1bb3cd=_[_0x112f('0x48')](_0x5e9d3c,{'sectionId':0x64});return hasDefaultDashboard(_0x1bb3cd)[_0x112f('0x27')](function(_0x2baebc){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0x3f9708){if(_0x3f9708[_0x112f('0x57')]===0x64){_0x3f9708[_0x112f('0x61')]=_0x2baebc;}return _0x3f9708;});});}else{return;}})['then'](function(_0x1c5a2e){if(_0x1c5a2e)_0x5e9d3c=_0x1c5a2e;if(_[_0x112f('0x60')](_0x8033ba,0x3eb)){var _0x24dd00=_['find'](_0x5e9d3c,{'sectionId':0x3eb});return getCustomDashboards(_0x24dd00)['then'](function(_0xbd802c){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0xfa98f2){if(_0x24dd00[_0x112f('0x5f')]){if(_0xfa98f2[_0x112f('0x57')]===0x3eb){_0xfa98f2[_0x112f('0x61')]=_0xbd802c;}}else{if(_0xfa98f2[_0x112f('0x57')]===0x64){_0xfa98f2[_0x112f('0x61')]=_0xbd802c;}}return _0xfa98f2;});});}else{return;}})[_0x112f('0x27')](function(_0x54ed83){if(_0x54ed83)_0x5e9d3c=_0x54ed83;if(_['includes'](_0x8033ba,0x709)){var _0x42dd63=_[_0x112f('0x48')](_0x5e9d3c,{'sectionId':0x709});return getPlugins(_0x42dd63)['then'](function(_0xa7773b){if(_0x42dd63[_0x112f('0x5f')]){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0x21d5c0){if(_0x21d5c0[_0x112f('0x57')]===0x709){_0x21d5c0[_0x112f('0x61')]=_0xa7773b;}return _0x21d5c0;});}else{var _0x1e99b3={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa7773b};var _0x456390=_[_0x112f('0x2e')](_0x5e9d3c);_0x456390[_0x112f('0x62')](_0x1e99b3);return _0x456390;}});}else{return;}})['then'](function(_0x35dc4b){if(_0x35dc4b)_0x5e9d3c=_0x35dc4b;return _[_0x112f('0x3e')](_0x5e9d3c,['enabled',0x1]);})[_0x112f('0x27')](respondWithResult(_0x161a35,null))['catch'](handleError(_0x161a35,null));};function hasDefaultDashboard(_0x56437c){var _0x8c6a19=[0x65];return new BPromise(function(_0x1d46fe,_0x349838){try{if(_0x56437c['autoAssociation']){_0x1d46fe(_0x8c6a19);}else{return db[_0x112f('0x5a')][_0x112f('0x63')]({'where':{'sectionId':_0x56437c['id']},'raw':!![]})[_0x112f('0x27')](function(_0x1be558){_0x1be558?_0x1d46fe(_0x8c6a19):_0x1d46fe();});}}catch(_0xbec1a5){_0x349838(_0xbec1a5);}});}function getCustomDashboards(_0xb89fa4){var _0x55bf80=[];return new BPromise(function(_0x52e51f,_0x75bc39){try{if(_0xb89fa4[_0x112f('0x55')]){return db[_0x112f('0x64')][_0x112f('0x46')]({'raw':!![]})[_0x112f('0x27')](function(_0x1d9e56){_0x1d9e56['forEach'](function(_0x474abb){_0x55bf80['push'](_0x474abb['id']+0x1869f);});_0x52e51f(_0x55bf80);});}else{return db[_0x112f('0x5a')][_0x112f('0x46')]({'where':{'sectionId':_0xb89fa4['id']},'raw':!![]})[_0x112f('0x27')](function(_0x39fffc){_0x39fffc['forEach'](function(_0x4447d6){_0x55bf80[_0x112f('0x62')](_0x4447d6[_0x112f('0x65')]+0x1869f);});_0x52e51f(_0x55bf80);});}}catch(_0x183fff){_0x75bc39(_0x183fff);}});}function getPlugins(_0x40a9cf){var _0x45cac8=[];return new BPromise(function(_0x4be655,_0x293595){try{if(_0x40a9cf[_0x112f('0x55')]){return db[_0x112f('0x66')][_0x112f('0x46')]({'raw':!![]})[_0x112f('0x27')](function(_0x93c979){_0x93c979[_0x112f('0x67')](function(_0x1b0ac7){_0x45cac8[_0x112f('0x62')](_0x1b0ac7['id']+0x15b38);});_0x4be655(_0x45cac8);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x40a9cf['id']},'raw':!![]})[_0x112f('0x27')](function(_0x3a5100){_0x3a5100[_0x112f('0x67')](function(_0x2aa667){_0x45cac8[_0x112f('0x62')](_0x2aa667[_0x112f('0x65')]+0x15b38);});_0x4be655(_0x45cac8);});}}catch(_0x577420){_0x293595(_0x577420);}});}exports[_0x112f('0x68')]=function(_0x450255,_0x3a1380){return db[_0x112f('0x2f')][_0x112f('0x48')]({'where':{'id':_0x450255[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x3a1380,null))[_0x112f('0x27')](function(_0xe8647e){if(_0xe8647e){return db['sequelize'][_0x112f('0x52')](function(_0x4a7999){return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0x450255['params']['id']},'attributes':['id'],'raw':!![]})[_0x112f('0x27')](function(_0x27ee69){if(_0x27ee69){return db[_0x112f('0x54')][_0x112f('0x28')]({'where':{'userProfileId':_0x450255[_0x112f('0x47')]['id'],'id':_['map'](_0x27ee69,function(_0x29270d){return _0x29270d['id'];})},'transaction':_0x4a7999});}})['then'](function(_0x49ad56){var _0x205a7c=_[_0x112f('0x2e')](_0x450255['body'],function(_0x27ee18){_0x27ee18[_0x112f('0x58')]=_0x450255[_0x112f('0x47')]['id'];return _0x27ee18;});return db['UserProfileSection'][_0x112f('0x69')](_0x205a7c,{'raw':!![],'transaction':_0x4a7999});})[_0x112f('0x27')](function(_0x4df9e9){var _0x5e0826=_[_0x112f('0x3e')](_[_0x112f('0x2e')](_0x4df9e9,function(_0x5ba7e3){return _0x5ba7e3[_0x112f('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x5e0826){return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0x450255['params']['id'],'sectionId':_[_0x112f('0x2e')](_0x5e0826,function(_0x1abe82){return _0x1abe82[_0x112f('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x112f('0x27')](function(_0x4e4353){var _0x118e14=_['map'](_0x450255[_0x112f('0x4a')],function(_0xdbb3d0){_0xdbb3d0[_0x112f('0x58')]=_0x450255[_0x112f('0x47')]['id'];return _0xdbb3d0;});return db[_0x112f('0x5a')][_0x112f('0x69')](_0x118e14,{'raw':!![],'transaction':_0x4a7999});});}})['catch'](handleError(_0x3a1380,null));});}})['then'](function(_0x2e4c20){var _0x2d2d55=_[_0x112f('0x2e')](_0x2e4c20,function(_0xad7480){return _0xad7480['get']({'plain':!![]});});})[_0x112f('0x27')](respondWithResult(_0x3a1380,null))[_0x112f('0x4b')](handleError(_0x3a1380,null));};exports[_0x112f('0x6a')]=function(_0x4b6b4f,_0x59e834,_0x2e1ce0){return db['UserProfile'][_0x112f('0x48')]({'where':{'id':_0x4b6b4f['params']['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x59e834,null))['then'](function(_0xa4a6ab){if(_0xa4a6ab){return _0xa4a6ab[_0x112f('0x6a')](_0x4b6b4f[_0x112f('0x33')][_0x112f('0x6b')]);}})[_0x112f('0x27')](respondWithStatusCode(_0x59e834,null))['catch'](handleError(_0x59e834,null));};exports[_0x112f('0x6c')]=function(_0x2f5696,_0x2a7c4d){var _0x3005ff={'raw':![],'where':{}};var _0x16bff0={};var _0x3c6b64={'count':0x0,'rows':[]};var _0x252c29=_0x2f5696[_0x112f('0x33')]['section'];if(typeof _0x252c29==='undefined'){throw new db[(_0x112f('0x6d'))][(_0x112f('0x6e'))](_0x112f('0x6f'));}var _0x17d3cd=_0x2f5696[_0x112f('0x33')][_0x112f('0x70')]||![];var _0x1b0d88=getQueryModels(_0x252c29,_0x17d3cd);if(typeof _0x1b0d88[_0x112f('0x71')]===_0x112f('0x72')){throw new db[(_0x112f('0x6d'))]['ValidationError']('Invalid\x20section\x20\x27'+_0x252c29+'\x27');}var _0x41de93=[];if(!_[_0x112f('0x73')](_0x1b0d88[_0x112f('0x74')])){_0x41de93=_0x1b0d88[_0x112f('0x74')];}else{_0x41de93=[{'name':_0x252c29}];}return db[_0x112f('0x2f')][_0x112f('0x63')]({'where':{'id':_0x2f5696[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x2a7c4d,null))['then'](function(_0x30471f){if(_0x30471f){var _0x1c55ef=[];for(var _0x16690c=0x0;_0x16690c<_0x41de93[_0x112f('0x39')];_0x16690c++){_0x1c55ef[_0x112f('0x62')](db[_0x112f('0x54')][_0x112f('0x63')]({'where':{'userProfileId':_0x30471f['id'],'name':_0x41de93[_0x16690c][_0x112f('0x2c')]},'raw':!![]}));}return BPromise[_0x112f('0x75')](_0x1c55ef);}})[_0x112f('0x27')](function(_0x435f48){var _0x2b9a77=_['filter'](_0x435f48,function(_0xc15175){return _0xc15175?_0xc15175:undefined;});var _0x3e03d9=_['filter'](_0x41de93,['ignore',!![]]);var _0x353404=_[_0x112f('0x73')](_0x2b9a77)&&_['isEmpty'](_0x3e03d9)?null:_['union'](_0x3e03d9,_0x2b9a77);if(_0x353404){var _0x482054=[];for(var _0x54f031=0x0;_0x54f031<_0x353404[_0x112f('0x39')];_0x54f031++){var _0x3be8bf=_[_0x112f('0x48')](_0x41de93,function(_0x56c2e6){return _0x353404[_0x54f031]?_0x56c2e6['name']===_0x353404[_0x54f031][_0x112f('0x2c')]:null;});if(_0x3be8bf){if(_0x353404[_0x54f031][_0x112f('0x76')]){_0x482054[_0x112f('0x62')](getAllResources(_0x1b0d88[_0x112f('0x71')],_0x353404[_0x54f031]));}else{if(!_0x353404[_0x54f031][_0x112f('0x55')]){_0x482054['push'](getAllowedResources(_0x3be8bf,_0x353404[_0x54f031],_0x1b0d88['childModel']));}else{if(_0x3be8bf[_0x112f('0x32')]){_0x482054[_0x112f('0x62')](getAllFilteredResources(_0x3be8bf,_0x353404[_0x54f031]));}}}}}return BPromise[_0x112f('0x75')](_0x482054);}else{return null;}})[_0x112f('0x27')](function(_0x4a8ca9){var _0x24f63e=_0x4a8ca9;var _0x595ac6=null;if(_0x24f63e){_0x595ac6=_0x24f63e[_0x112f('0x39')]===0x1?_0x24f63e[0x0]:null;}if(_0x595ac6||_0x24f63e){var _0x372180=db[_0x1b0d88['childModel']][_0x112f('0x30')];_0x16bff0[_0x112f('0x32')]=_[_0x112f('0x34')](_0x372180);_0x16bff0[_0x112f('0x33')]=_[_0x112f('0x34')](_0x2f5696[_0x112f('0x33')]);_0x16bff0[_0x112f('0x35')]=_[_0x112f('0x36')](_0x16bff0[_0x112f('0x32')],_0x16bff0[_0x112f('0x33')]);_0x3005ff['attributes']=_[_0x112f('0x36')](_0x16bff0[_0x112f('0x32')],qs[_0x112f('0x38')](_0x2f5696[_0x112f('0x33')][_0x112f('0x38')]));_0x3005ff['attributes']=_0x3005ff[_0x112f('0x37')][_0x112f('0x39')]?_0x3005ff[_0x112f('0x37')]:_0x16bff0[_0x112f('0x32')];if(!_0x2f5696['query'][_0x112f('0x3a')](_0x112f('0x3b'))){_0x3005ff[_0x112f('0x21')]=qs[_0x112f('0x21')](_0x2f5696[_0x112f('0x33')][_0x112f('0x21')]);_0x3005ff[_0x112f('0x20')]=qs[_0x112f('0x20')](_0x2f5696[_0x112f('0x33')]['offset']);}_0x3005ff['order']=qs[_0x112f('0x3c')](_0x2f5696['query'][_0x112f('0x3c')]);_0x3005ff[_0x112f('0x40')]=qs[_0x112f('0x35')](_[_0x112f('0x3d')](_0x2f5696[_0x112f('0x33')],_0x16bff0[_0x112f('0x35')]));if(_0x2f5696[_0x112f('0x33')][_0x112f('0x3e')]){_0x3005ff[_0x112f('0x40')]=_[_0x112f('0x3f')](_0x3005ff[_0x112f('0x40')],{'$or':_['map'](_0x372180,function(_0x437d07){if(_0x437d07['type']['key']!==_0x112f('0x42')){var _0x35109c={};_0x35109c[_0x437d07[_0x112f('0x77')]]={'$like':'%'+_0x2f5696[_0x112f('0x33')][_0x112f('0x3e')]+'%'};return _0x35109c;}})});}var _0x200fa5=[];if(_0x595ac6){var _0x17a19c=_['find'](_0x41de93,[_0x112f('0x2c'),_0x595ac6[_0x112f('0x2c')]]);if(_0x17a19c[_0x112f('0x77')]){var _0x266e71={};if(_0x1b0d88[_0x112f('0x71')]===_0x112f('0x78')){_0x266e71[_0x17a19c['foreignKey']]=_[_0x112f('0x2e')](_0x595ac6['associatedResources'],'id');}else{_0x266e71[_0x17a19c[_0x112f('0x79')]]=_0x595ac6[_0x112f('0x7a')];}_0x200fa5[_0x112f('0x62')](_0x266e71);}else{_0x3005ff[_0x112f('0x40')]['id']=_0x595ac6[_0x112f('0x7a')];}}else{for(var _0x8399d5=0x0;_0x8399d5<_0x24f63e[_0x112f('0x39')];_0x8399d5++){var _0x17a19c=_[_0x112f('0x48')](_0x41de93,[_0x112f('0x2c'),_0x24f63e[_0x8399d5][_0x112f('0x2c')]]);if(_0x17a19c[_0x112f('0x77')]){var _0x266e71={};_0x266e71[_0x17a19c[_0x112f('0x79')]]=_0x24f63e[_0x8399d5][_0x112f('0x7a')];_0x200fa5[_0x112f('0x62')](_0x266e71);}else{if(!_0x3005ff[_0x112f('0x40')]['id'])_0x3005ff[_0x112f('0x40')]['id']=[];_0x24f63e[_0x8399d5]['associatedResources'][_0x112f('0x67')](function(_0x1af757){_0x3005ff[_0x112f('0x40')]['id']['push'](_0x1af757);});}}}if(!_[_0x112f('0x73')](_0x200fa5)){_0x3005ff['where']=_[_0x112f('0x3f')](_0x3005ff[_0x112f('0x40')],{'$and':{'$or':_0x200fa5}});}_0x3005ff=_[_0x112f('0x3f')]({},_0x3005ff,_0x2f5696['options']);if(_0x595ac6&&!_0x595ac6['autoAssociation']&&_0x1b0d88[_0x112f('0x71')]===_0x112f('0x78')){if(_0x2f5696[_0x112f('0x33')][_0x112f('0x4d')]){_0x3005ff['include']=[{'all':!![]}];}return db[_0x1b0d88[_0x112f('0x71')]][_0x112f('0x46')](_0x3005ff)[_0x112f('0x27')](function(_0x455edc){var _0x49b9d3=[];_0x455edc[_0x112f('0x67')](function(_0x1629fe){var _0x3f38c7;switch(_0x1629fe[_0x112f('0x7b')]){case _0x112f('0x7c'):_0x3f38c7=_[_0x112f('0x48')](_0x595ac6['associatedResources'],function(_0x2829cf){return _0x2829cf['id']===_0x1629fe[_0x112f('0x7d')]&&_0x2829cf['type']===_0x112f('0x7e');});break;case'custom':_0x3f38c7=_['find'](_0x595ac6[_0x112f('0x7a')],function(_0x1bfe9f){return _0x1bfe9f['id']===_0x1629fe['reportId']&&_0x1bfe9f[_0x112f('0x41')]===_0x112f('0x7f');});break;}if(_0x3f38c7)_0x49b9d3[_0x112f('0x62')](_0x1629fe);});_0x3c6b64['count']=_0x49b9d3['length'];_0x3c6b64[_0x112f('0x80')]=_0x49b9d3;return _0x3c6b64;});}else{return db[_0x1b0d88[_0x112f('0x71')]]['count']({'where':_0x3005ff[_0x112f('0x40')]})['then'](function(_0x417f83){_0x3c6b64[_0x112f('0x44')]=_0x417f83;if(_0x2f5696[_0x112f('0x33')][_0x112f('0x4d')]){if(_0x1b0d88[_0x112f('0x71')]===_0x112f('0x81')){_0x3005ff[_0x112f('0x45')]=[{'model':db[_0x112f('0x82')],'as':_0x112f('0x83'),'attributes':['id',_0x112f('0x2c'),_0x112f('0x84')],'required':_0x2f5696[_0x112f('0x33')][_0x112f('0x85')]?!![]:![]},{'model':db[_0x112f('0x82')],'as':_0x112f('0x86'),'attributes':['id','name',_0x112f('0x84')],'through':_0x2f5696[_0x112f('0x33')][_0x112f('0x85')]?{'attributes':[],'where':{'TagId':_0x2f5696['query'][_0x112f('0x85')]||undefined}}:{},'required':_0x2f5696[_0x112f('0x33')]['tag']?!![]:![]}];}else{_0x3005ff[_0x112f('0x45')]=[{'all':!![]}];}}return db[_0x1b0d88[_0x112f('0x71')]][_0x112f('0x46')](_0x3005ff);})[_0x112f('0x27')](function(_0x3ba334){_0x3c6b64[_0x112f('0x80')]=_0x3ba334;return _0x3c6b64;});}}else{return _0x3c6b64;}})['then'](respondWithFilteredResult(_0x2a7c4d,_0x3005ff))[_0x112f('0x4b')](handleError(_0x2a7c4d,null));};function getAllResources(_0xefbd48,_0x5f5ddb){return new BPromise(function(_0x3eba30,_0x7a009f){if(_0x5f5ddb){var _0x314de5=_0x5f5ddb[_0x112f('0x3e')]?{[_0x5f5ddb['filter']['field']]:_0x5f5ddb[_0x112f('0x3e')][_0x112f('0x87')]}:undefined;return db[_0xefbd48][_0x112f('0x46')]({'where':_0x314de5,'raw':!![]})[_0x112f('0x27')](function(_0x220de6){_0x5f5ddb[_0x112f('0x7a')]=_[_0x112f('0x2e')](_0x220de6,'id');_0x3eba30(_0x5f5ddb);})[_0x112f('0x4b')](function(_0x6c0cf7){_0x7a009f(_0x6c0cf7);});}else{_0x3eba30(null);}});}function getAllFilteredResources(_0x2a8675,_0xd6281e){return new BPromise(function(_0xccf98b,_0xa2512b){var _0x4034ae=_0x2a8675[_0x112f('0x3e')]?{[_0x2a8675[_0x112f('0x3e')][_0x112f('0x77')]]:_0x2a8675[_0x112f('0x3e')][_0x112f('0x87')]}:undefined;return db[_0x2a8675[_0x112f('0x32')]][_0x112f('0x46')]({'where':_0x4034ae,'raw':!![]})[_0x112f('0x27')](function(_0x1defa2){_0xd6281e['associatedResources']=_['map'](_0x1defa2,function(_0x43c558){return _0x43c558[_0x112f('0x2c')];});_0xccf98b(_0xd6281e);})[_0x112f('0x4b')](function(_0x1e8284){_0xa2512b(_0x1e8284);});});}function getAllowedResources(_0x34f428,_0x37e829,_0x4ca88d){return new BPromise(function(_0x537590,_0x179064){if(_0x37e829){return db['UserProfileResource'][_0x112f('0x46')]({'where':{'sectionId':_0x37e829['id']},'raw':!![]})['then'](function(_0x579e3c){if(_0x34f428[_0x112f('0x77')]&&_0x34f428[_0x112f('0x77')]!=='id'){_0x37e829['associatedResources']=_[_0x112f('0x2e')](_0x579e3c,function(_0x493659){return _0x493659[_0x34f428[_0x112f('0x77')]];});}else{if(_0x4ca88d===_0x112f('0x78')){_0x37e829[_0x112f('0x7a')]=_['map'](_0x579e3c,function(_0x27a916){return{'id':_0x27a916['resourceId'],'type':_0x27a916[_0x112f('0x41')]};});}else{_0x37e829[_0x112f('0x7a')]=_[_0x112f('0x2e')](_0x579e3c,function(_0x1b6d46){return _0x1b6d46['resourceId'];});}}_0x537590(_0x37e829);})[_0x112f('0x4b')](function(_0x48288a){_0x179064(_0x48288a);});}else{_0x537590(null);}});}function getQueryModels(_0x3062e9,_0x3f9ca0){var _0x481b31=_0x3062e9['toLowerCase']();var _0x27854e={'childModel':undefined,'parentSections':[]};switch(_0x481b31){case _0x112f('0x88'):_0x27854e['childModel']=_0x112f('0x89');break;case _0x112f('0x8a'):_0x27854e[_0x112f('0x71')]=_0x112f('0x8b');break;case'squarerecordings':_0x27854e[_0x112f('0x71')]='SquareRecording';_0x27854e[_0x112f('0x74')]=[{'name':'SquareProjects','field':_0x112f('0x2c'),'foreignKey':_0x112f('0x8c')}];break;case _0x112f('0x8d'):_0x27854e['childModel']=_0x112f('0x8e');break;case _0x112f('0x8f'):_0x27854e[_0x112f('0x71')]='CmContact';_0x27854e[_0x112f('0x74')]=[{'name':'Lists','field':'id','foreignKey':_0x112f('0x90')}];break;case _0x112f('0x91'):_0x27854e[_0x112f('0x71')]=_0x112f('0x92');break;case _0x112f('0x93'):_0x27854e['childModel']=_0x112f('0x94');break;case _0x112f('0x95'):_0x27854e['childModel']=_0x112f('0x96');break;case'chatqueues':_0x27854e[_0x112f('0x71')]=_0x112f('0x97');break;case'chatwebsites':_0x27854e[_0x112f('0x71')]=_0x112f('0x98');break;case _0x112f('0x99'):_0x27854e[_0x112f('0x71')]=_0x112f('0x9a');break;case _0x112f('0x9b'):_0x27854e[_0x112f('0x71')]='FaxAccount';break;case'inboundroutes':case _0x112f('0x9c'):case'outboundroutes':_0x27854e[_0x112f('0x71')]=_0x112f('0x9d');break;case _0x112f('0x9e'):_0x27854e[_0x112f('0x71')]=_0x112f('0x9f');break;case _0x112f('0xa0'):_0x27854e[_0x112f('0x71')]=_0x112f('0xa1');break;case'voicerecordings':_0x27854e[_0x112f('0x71')]=_0x112f('0xa2');_0x27854e[_0x112f('0x74')]=[{'name':'Agents','field':_0x112f('0x2c'),'foreignKey':_0x112f('0xa3'),'model':_0x112f('0xa4'),'filter':{'field':_0x112f('0xa5'),'value':['agent']}},{'name':_0x112f('0xa6'),'field':_0x112f('0x2c'),'foreignKey':_0x112f('0xa3'),'model':_0x112f('0xa4'),'filter':{'field':_0x112f('0xa5'),'value':['telephone']}},{'name':_0x112f('0xa7'),'field':'name','foreignKey':_0x112f('0xa8'),'model':_0x112f('0xa9'),'filter':{'field':_0x112f('0x41'),'value':['inbound']}},{'name':_0x112f('0xaa'),'field':_0x112f('0x2c'),'foreignKey':'queue','model':_0x112f('0xa9'),'filter':{'field':'type','value':[_0x112f('0xab')]}}];break;case _0x112f('0xac'):_0x27854e[_0x112f('0x71')]=_0x112f('0xad');break;case'chanspies':_0x27854e[_0x112f('0x71')]='VoiceChanSpy';break;case'voiceprefixes':_0x27854e[_0x112f('0x71')]=_0x112f('0xae');break;case'ivrcampaigns':_0x27854e[_0x112f('0x71')]=_0x112f('0xaf');break;case _0x112f('0xb0'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb1');break;case _0x112f('0xb2'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb3');break;case _0x112f('0xb4'):_0x27854e[_0x112f('0x71')]='MailSubstatus';break;case _0x112f('0xb5'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb6');break;case _0x112f('0xb7'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb8');break;case _0x112f('0xb9'):_0x27854e[_0x112f('0x71')]=_0x112f('0xba');break;case _0x112f('0xbb'):_0x27854e[_0x112f('0x71')]='SmsAccount';break;case _0x112f('0xbc'):_0x27854e[_0x112f('0x71')]=_0x112f('0xbd');break;case _0x112f('0xbe'):_0x27854e[_0x112f('0x71')]=_0x112f('0xbf');break;case _0x112f('0xc0'):_0x27854e[_0x112f('0x71')]=_0x112f('0xc1');break;case'voicequeues':case _0x112f('0xc2'):_0x27854e['childModel']=_0x112f('0xa9');if(_0x3f9ca0){_0x27854e[_0x112f('0x74')]=[{'name':_0x112f('0xa7')},{'name':_0x112f('0xaa')}];}break;case _0x112f('0xc3'):case _0x112f('0xc4'):case _0x112f('0xc5'):_0x27854e['childModel']='User';if(_0x3f9ca0){_0x27854e[_0x112f('0x74')]=[{'name':_0x112f('0xc6'),'filter':{'field':'role','value':[_0x112f('0xc7'),_0x112f('0xc8')]},'ignore':!![]},{'name':_0x112f('0xc9')},{'name':_0x112f('0xa6')}];}break;case _0x112f('0xca'):_0x27854e['childModel']=_0x112f('0xcb');break;case _0x112f('0xcc'):_0x27854e[_0x112f('0x71')]='SalesforceAccount';break;case _0x112f('0xcd'):_0x27854e[_0x112f('0x71')]='FreshdeskAccount';break;case _0x112f('0xce'):_0x27854e['childModel']=_0x112f('0xcf');break;case _0x112f('0xd0'):_0x27854e['childModel']='DeskAccount';break;case'zohoaccounts':_0x27854e[_0x112f('0x71')]=_0x112f('0xd1');break;case'vtigeraccounts':_0x27854e[_0x112f('0x71')]='User';break;case _0x112f('0xd2'):_0x27854e[_0x112f('0x71')]=_0x112f('0xd3');break;case _0x112f('0xd4'):_0x27854e[_0x112f('0x71')]=_0x112f('0xd5');break;case _0x112f('0xd6'):_0x27854e[_0x112f('0x71')]='Dashboard';break;case _0x112f('0xd7'):_0x27854e[_0x112f('0x71')]=_0x112f('0xd8');break;case'pauses':_0x27854e[_0x112f('0x71')]='Pause';break;case _0x112f('0xd9'):_0x27854e[_0x112f('0x71')]=_0x112f('0xda');break;case _0x112f('0xdb'):_0x27854e['childModel']=_0x112f('0xdc');break;case _0x112f('0xdd'):_0x27854e[_0x112f('0x71')]=_0x112f('0x82');break;case _0x112f('0xde'):_0x27854e['childModel']='Template';break;case _0x112f('0xdf'):_0x27854e[_0x112f('0x71')]=_0x112f('0xe0');break;case _0x112f('0xe1'):_0x27854e[_0x112f('0x71')]='Trunk';break;case _0x112f('0xe2'):_0x27854e[_0x112f('0x71')]=_0x112f('0xe3');break;case _0x112f('0xe4'):_0x27854e['childModel']=_0x112f('0x66');break;case _0x112f('0xe5'):_0x27854e[_0x112f('0x71')]=_0x112f('0x78');_0x27854e['parentSections']=[{'name':_0x112f('0xe6'),'field':'id','foreignKey':_0x112f('0x7d')}];break;case _0x112f('0xe7'):_0x27854e['childModel']=_0x112f('0xe8');break;case _0x112f('0xbe'):_0x27854e[_0x112f('0x71')]=_0x112f('0xbf');break;default:return _0x27854e;}return _0x27854e;} \ No newline at end of file +var _0x70c2=['model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','catch','create','body','clone','length','options','find','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','Invalid\x20section\x20\x27','parentSections','all','ignore','union','hasOwnProperty','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','companies','globalcustomfields','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','User','agent','Telephones','membername','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','admin','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','intervals','Interval','Pause','scheduler','sounds','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','AnalyticMetric','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','UserProfile','rawAttributes','fieldName','type','key'];(function(_0x3d0144,_0x38639f){var _0x33527e=function(_0x4086c5){while(--_0x4086c5){_0x3d0144['push'](_0x3d0144['shift']());}};_0x33527e(++_0x38639f);}(_0x70c2,0xb8));var _0x270c=function(_0x45b9bc,_0x447c93){_0x45b9bc=_0x45b9bc-0x0;var _0x354665=_0x70c2[_0x45b9bc];return _0x354665;};'use strict';var pdf=require(_0x270c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x270c('0x1'));var jsonpatch=require(_0x270c('0x2'));var rp=require(_0x270c('0x3'));var moment=require(_0x270c('0x4'));var BPromise=require(_0x270c('0x5'));var Mustache=require('mustache');var util=require(_0x270c('0x6'));var path=require(_0x270c('0x7'));var sox=require(_0x270c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x270c('0x9'));var squel=require(_0x270c('0xa'));var crypto=require('crypto');var jsforce=require(_0x270c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x270c('0xc'));var querystring=require(_0x270c('0xd'));var Papa=require(_0x270c('0xe'));var Redis=require(_0x270c('0xf'));var authService=require(_0x270c('0x10'));var qs=require(_0x270c('0x11'));var as=require(_0x270c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x270c('0x13'))(_0x270c('0x14'));var utils=require(_0x270c('0x15'));var config=require(_0x270c('0x16'));var licenseUtil=require(_0x270c('0x17'));var db=require(_0x270c('0x18'))['db'];config[_0x270c('0x19')]=_[_0x270c('0x1a')](config[_0x270c('0x19')],{'host':_0x270c('0x1b'),'port':0x18eb});var socket=require(_0x270c('0x1c'))(new Redis(config[_0x270c('0x19')]));require('./userProfile.socket')[_0x270c('0x1d')](socket);function respondWithStatusCode(_0x534b4e,_0x17865a){_0x17865a=_0x17865a||0xcc;return function(_0x217c55){if(_0x217c55){return _0x534b4e[_0x270c('0x1e')](_0x17865a);}return _0x534b4e[_0x270c('0x1f')](_0x17865a)[_0x270c('0x20')]();};}function respondWithResult(_0x1ffb6c,_0x3ab2a3){_0x3ab2a3=_0x3ab2a3||0xc8;return function(_0x316c7b){if(_0x316c7b){return _0x1ffb6c[_0x270c('0x1f')](_0x3ab2a3)[_0x270c('0x21')](_0x316c7b);}};}function respondWithFilteredResult(_0x38bb4b,_0x5876d2){return function(_0x219fe1){if(_0x219fe1){var _0x47386b=_0x219fe1[_0x270c('0x22')],_0x3d0d0a=_0x5876d2[_0x270c('0x23')],_0x3c1e64=_0x5876d2[_0x270c('0x23')]+_0x5876d2[_0x270c('0x24')],_0x2e2688;if(_0x3c1e64>=_0x47386b){_0x3c1e64=_0x47386b;_0x2e2688=0xc8;}else{_0x2e2688=0xce;}_0x38bb4b[_0x270c('0x1f')](_0x2e2688);return _0x38bb4b[_0x270c('0x25')](_0x270c('0x26'),_0x3d0d0a+'-'+_0x3c1e64+'/'+_0x47386b)['json'](_0x219fe1);}return null;};}function patchUpdates(_0x3673f4){return function(_0x387296){try{jsonpatch[_0x270c('0x27')](_0x387296,_0x3673f4,!![]);}catch(_0x1c295f){return BPromise[_0x270c('0x28')](_0x1c295f);}return _0x387296[_0x270c('0x29')]();};}function saveUpdates(_0x3e1f00,_0x169c34){return function(_0x277c94){if(_0x277c94){return _0x277c94['update'](_0x3e1f00)[_0x270c('0x2a')](function(_0x325b45){return _0x325b45;});}return null;};}function removeEntity(_0x3e6418,_0x4366d1){return function(_0x4f948c){if(_0x4f948c){return _0x4f948c[_0x270c('0x2b')]()[_0x270c('0x2a')](function(){_0x3e6418[_0x270c('0x1f')](0xcc)[_0x270c('0x20')]();});}};}function handleEntityNotFound(_0x3a20ab,_0x59dc95){return function(_0x3030dd){if(!_0x3030dd){_0x3a20ab[_0x270c('0x1e')](0x194);}return _0x3030dd;};}function handleError(_0x2a6534,_0x12821b){_0x12821b=_0x12821b||0x1f4;return function(_0x5f3fff){logger[_0x270c('0x2c')](_0x5f3fff['stack']);if(_0x5f3fff['name']){delete _0x5f3fff[_0x270c('0x2d')];}_0x2a6534[_0x270c('0x1f')](_0x12821b)['send'](_0x5f3fff);};}exports[_0x270c('0x2e')]=function(_0x1ccddb,_0x383410){var _0x3e1d04={},_0xe4547e={},_0x21023b={'count':0x0,'rows':[]};var _0x1d1375=_['map'](db[_0x270c('0x2f')][_0x270c('0x30')],function(_0x247433){return{'name':_0x247433[_0x270c('0x31')],'type':_0x247433[_0x270c('0x32')][_0x270c('0x33')]};});_0xe4547e[_0x270c('0x34')]=_[_0x270c('0x35')](_0x1d1375,_0x270c('0x2d'));_0xe4547e['query']=_[_0x270c('0x36')](_0x1ccddb[_0x270c('0x37')]);_0xe4547e[_0x270c('0x38')]=_[_0x270c('0x39')](_0xe4547e[_0x270c('0x34')],_0xe4547e[_0x270c('0x37')]);_0x3e1d04[_0x270c('0x3a')]=_['intersection'](_0xe4547e[_0x270c('0x34')],qs[_0x270c('0x3b')](_0x1ccddb['query'][_0x270c('0x3b')]));_0x3e1d04[_0x270c('0x3a')]=_0x3e1d04['attributes']['length']?_0x3e1d04[_0x270c('0x3a')]:_0xe4547e[_0x270c('0x34')];if(!_0x1ccddb[_0x270c('0x37')]['hasOwnProperty'](_0x270c('0x3c'))){_0x3e1d04[_0x270c('0x24')]=qs[_0x270c('0x24')](_0x1ccddb[_0x270c('0x37')]['limit']);_0x3e1d04[_0x270c('0x23')]=qs[_0x270c('0x23')](_0x1ccddb['query'][_0x270c('0x23')]);}_0x3e1d04[_0x270c('0x3d')]=qs[_0x270c('0x3e')](_0x1ccddb[_0x270c('0x37')][_0x270c('0x3e')]);_0x3e1d04['where']=qs['filters'](_['pick'](_0x1ccddb[_0x270c('0x37')],_0xe4547e['filters']),_0x1d1375);if(_0x1ccddb['query'][_0x270c('0x3f')]){_0x3e1d04['where']=_['merge'](_0x3e1d04[_0x270c('0x40')],{'$or':_[_0x270c('0x35')](_0x1d1375,function(_0x4b0357){if(_0x4b0357[_0x270c('0x32')]!==_0x270c('0x41')){var _0x45680c={};_0x45680c[_0x4b0357[_0x270c('0x2d')]]={'$like':'%'+_0x1ccddb[_0x270c('0x37')]['filter']+'%'};return _0x45680c;}})});}_0x3e1d04=_[_0x270c('0x42')]({},_0x3e1d04,_0x1ccddb['options']);var _0x370631={'where':_0x3e1d04[_0x270c('0x40')]};return db[_0x270c('0x2f')][_0x270c('0x22')](_0x370631)[_0x270c('0x2a')](function(_0x48ad28){_0x21023b['count']=_0x48ad28;if(_0x1ccddb['query'][_0x270c('0x43')]){_0x3e1d04['include']=[{'all':!![]}];}return db[_0x270c('0x2f')][_0x270c('0x44')](_0x3e1d04);})['then'](function(_0x293734){_0x21023b[_0x270c('0x45')]=_0x293734;return _0x21023b;})[_0x270c('0x2a')](respondWithFilteredResult(_0x383410,_0x3e1d04))['catch'](handleError(_0x383410,null));};exports[_0x270c('0x46')]=function(_0x556e97,_0xb0df6e){var _0xb2fb15={'raw':![],'where':{'id':_0x556e97[_0x270c('0x47')]['id']}},_0x11793f={};_0x11793f['model']=_[_0x270c('0x36')](db[_0x270c('0x2f')][_0x270c('0x30')]);_0x11793f[_0x270c('0x37')]=_[_0x270c('0x36')](_0x556e97['query']);_0x11793f['filters']=_[_0x270c('0x39')](_0x11793f[_0x270c('0x34')],_0x11793f[_0x270c('0x37')]);_0xb2fb15[_0x270c('0x3a')]=_[_0x270c('0x39')](_0x11793f[_0x270c('0x34')],qs['fields'](_0x556e97[_0x270c('0x37')][_0x270c('0x3b')]));_0xb2fb15['attributes']=_0xb2fb15['attributes']['length']?_0xb2fb15['attributes']:_0x11793f['model'];if(_0x556e97[_0x270c('0x37')][_0x270c('0x43')]){_0xb2fb15[_0x270c('0x48')]=[{'all':!![]}];}_0xb2fb15=_[_0x270c('0x42')]({},_0xb2fb15,_0x556e97['options']);return db[_0x270c('0x2f')]['find'](_0xb2fb15)[_0x270c('0x2a')](handleEntityNotFound(_0xb0df6e,null))[_0x270c('0x2a')](respondWithResult(_0xb0df6e,null))[_0x270c('0x49')](handleError(_0xb0df6e,null));};exports[_0x270c('0x4a')]=function(_0x4b0553,_0x16d662){return db['UserProfile']['create'](_0x4b0553[_0x270c('0x4b')],{})[_0x270c('0x2a')](respondWithResult(_0x16d662,0xc9))[_0x270c('0x49')](handleError(_0x16d662,null));};exports[_0x270c('0x4c')]=function(_0x5bdc07,_0x305ea4){var _0x19da5f={'where':{'id':_0x5bdc07[_0x270c('0x47')]['id']}},_0x215212={};_0x215212[_0x270c('0x34')]=_[_0x270c('0x36')](db[_0x270c('0x2f')][_0x270c('0x30')]);_0x19da5f[_0x270c('0x3a')]=_['intersection'](_0x215212[_0x270c('0x34')],qs[_0x270c('0x3b')](_0x5bdc07[_0x270c('0x37')][_0x270c('0x3b')]));_0x19da5f['attributes']=_0x19da5f[_0x270c('0x3a')][_0x270c('0x4d')]?_0x19da5f[_0x270c('0x3a')]:_0x215212[_0x270c('0x34')];if(_0x5bdc07['query'][_0x270c('0x43')]){_0x19da5f['include']=[{'all':!![]}];}_0x19da5f=_['merge']({},_0x19da5f,_0x5bdc07[_0x270c('0x4e')]);return db[_0x270c('0x2f')][_0x270c('0x4f')](_0x19da5f)[_0x270c('0x2a')](handleEntityNotFound(_0x305ea4,null))[_0x270c('0x2a')](function(_0x2a48e2){if(_0x2a48e2){var _0x4b97ce=_0x2a48e2['get']({'plain':!![]});_0x4b97ce=qs['omit'](_0x4b97ce,['id',_0x270c('0x50'),_0x270c('0x51'),_0x270c('0x52')]);_0x5bdc07[_0x270c('0x4b')]=_[_0x270c('0x53')](_0x5bdc07[_0x270c('0x4b')],['id',_0x270c('0x50'),'updatedAt']);return db[_0x270c('0x54')][_0x270c('0x55')](function(_0x38d06d){return db['UserProfile'][_0x270c('0x4a')](_[_0x270c('0x42')](_0x4b97ce,_0x5bdc07['body']),{'include':_0x5bdc07['query'][_0x270c('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x38d06d})[_0x270c('0x2a')](function(_0x115b3c){var _0x43a871=_0x115b3c[_0x270c('0x56')]({'plain':!![]});return db[_0x270c('0x57')][_0x270c('0x44')]({'where':{'userProfileId':_0x5bdc07['params']['id']},'raw':!![]})['then'](function(_0xc7455c){if(_0xc7455c){return BPromise[_0x270c('0x58')](_0xc7455c,function(_0x968435){return new BPromise(function(_0xfad987,_0x1a2f1d){if(_0x968435['autoAssociation']===null||_0x968435[_0x270c('0x59')]===0x1)_0xfad987(null);return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x968435['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x24ddb3){var _0xdc3c70=_['map'](_0x24ddb3,function(_0x4f6444){return qs[_0x270c('0x53')](_0x4f6444,['id',_0x270c('0x50'),_0x270c('0x51'),_0x270c('0x5b')]);});_0xfad987(_0xdc3c70);})[_0x270c('0x49')](function(_0x2d8e0f){_0x1a2f1d(_0x2d8e0f);});})['then'](function(_0x33eb51){var _0x256690=qs['omit'](_0x968435,['id',_0x270c('0x50'),_0x270c('0x51')]);_0x256690[_0x270c('0x5c')]=_0x43a871['id'];if(_0x33eb51)_0x256690[_0x270c('0x5d')]=_0x33eb51;return _0x256690;})[_0x270c('0x2a')](function(_0x55186d){return db[_0x270c('0x57')]['create'](_0x55186d,{'include':[{'model':db[_0x270c('0x5a')],'as':_0x270c('0x5d')}],'raw':!![],'transaction':_0x38d06d});});})[_0x270c('0x2a')](function(){return _0x43a871;});}});});});}})['then'](respondWithResult(_0x305ea4,0xc9))['catch'](handleError(_0x305ea4,null));};exports[_0x270c('0x5e')]=function(_0x212cc2,_0xac93b5){if(_0x212cc2[_0x270c('0x4b')]['id']){delete _0x212cc2[_0x270c('0x4b')]['id'];}return db[_0x270c('0x2f')]['find']({'where':{'id':_0x212cc2[_0x270c('0x47')]['id']}})['then'](handleEntityNotFound(_0xac93b5,null))[_0x270c('0x2a')](saveUpdates(_0x212cc2[_0x270c('0x4b')],null))[_0x270c('0x2a')](respondWithResult(_0xac93b5,null))[_0x270c('0x49')](handleError(_0xac93b5,null));};exports[_0x270c('0x2b')]=function(_0x1e9bd2,_0x5cefec){return db[_0x270c('0x2f')][_0x270c('0x4f')]({'where':{'id':_0x1e9bd2[_0x270c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cefec,null))['then'](removeEntity(_0x5cefec,null))[_0x270c('0x49')](handleError(_0x5cefec,null));};exports[_0x270c('0x5f')]=function(_0x35e750,_0x59e037){return db[_0x270c('0x2f')][_0x270c('0x5f')]()[_0x270c('0x2a')](respondWithResult(_0x59e037,null))['catch'](handleError(_0x59e037,null));};exports['addSections']=function(_0x17167a,_0x38b715){var _0x5db546=_0x17167a[_0x270c('0x4b')];return db['UserProfile']['find']({'where':{'id':_0x17167a[_0x270c('0x47')]['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x38b715,null))[_0x270c('0x2a')](function(_0x3429a9){if(_0x3429a9){return db[_0x270c('0x54')][_0x270c('0x55')](function(_0x41012b){return db[_0x270c('0x57')][_0x270c('0x2b')]({'where':{'userProfileId':_0x17167a['params']['id'],'sectionId':_[_0x270c('0x35')](_0x5db546,function(_0x3488b5){return _0x3488b5[_0x270c('0x5b')];})},'transaction':_0x41012b})[_0x270c('0x2a')](function(){var _0x42642d=_[_0x270c('0x35')](_0x5db546,function(_0x4b33dc){_0x4b33dc[_0x270c('0x5c')]=_0x17167a[_0x270c('0x47')]['id'];return _0x4b33dc;});var _0x536064=[];return BPromise['each'](_0x42642d,function(_0x1652b5){return db[_0x270c('0x57')][_0x270c('0x4a')](_0x1652b5,{'include':[{'model':db[_0x270c('0x5a')],'as':_0x270c('0x5d')}],'raw':!![],'transaction':_0x41012b})[_0x270c('0x2a')](function(_0x2f6fab){_0x536064[_0x270c('0x60')](_0x2f6fab[_0x270c('0x56')]({'plain':!![]}));});})[_0x270c('0x2a')](function(){return _0x536064;});});});}})[_0x270c('0x2a')](function(_0xa7e44f){return _0xa7e44f;})[_0x270c('0x2a')](respondWithResult(_0x38b715,null))[_0x270c('0x49')](handleError(_0x38b715,null));};exports[_0x270c('0x61')]=function(_0x4c78d3,_0x1abbad){var _0x35d37f;return db[_0x270c('0x2f')][_0x270c('0x4f')]({'where':{'id':_0x4c78d3[_0x270c('0x47')]['id']},'attributes':['id','name']})[_0x270c('0x2a')](handleEntityNotFound(_0x1abbad,null))['then'](function(_0x6936cf){if(_0x6936cf){_0x35d37f=_0x6936cf;return db[_0x270c('0x57')][_0x270c('0x2b')]({'where':{'userProfileId':_0x4c78d3[_0x270c('0x47')]['id'],'sectionId':_0x4c78d3[_0x270c('0x37')][_0x270c('0x62')]}});}})[_0x270c('0x2a')](function(){return _0x35d37f;})['then'](respondWithStatusCode(_0x1abbad,null))['catch'](handleError(_0x1abbad,null));};exports[_0x270c('0x63')]=function(_0xb7dd80,_0xd18b2e){var _0xfda686=[];var _0x172f36=[];return db[_0x270c('0x57')]['findAll']({'where':{'userProfileId':_0xb7dd80[_0x270c('0x47')]['id']},'raw':!![]})['then'](function(_0x1a8394){_0xfda686=_[_0x270c('0x3f')](_0x1a8394,function(_0x4fc231){return _0x4fc231[_0x270c('0x64')]===0x1||_[_0x270c('0x65')]([0x3eb,0x709],_0x4fc231[_0x270c('0x5b')]);});if(!_[_0x270c('0x66')](_0xfda686)){return _[_0x270c('0x35')](_0xfda686,function(_0x1d2c8d){return _0x1d2c8d[_0x270c('0x5b')];});}else{return;}})[_0x270c('0x2a')](function(_0x31912f){if(_0x31912f)_0x172f36=_0x31912f;if(_[_0x270c('0x65')](_0x172f36,0x64)){var _0x100b77=_[_0x270c('0x4f')](_0xfda686,{'sectionId':0x64});return hasDefaultDashboard(_0x100b77)['then'](function(_0x222776){return _[_0x270c('0x35')](_0xfda686,function(_0x29627c){if(_0x29627c[_0x270c('0x5b')]===0x64){_0x29627c[_0x270c('0x67')]=_0x222776;}return _0x29627c;});});}else{return;}})[_0x270c('0x2a')](function(_0x2b1dcf){if(_0x2b1dcf)_0xfda686=_0x2b1dcf;if(_[_0x270c('0x65')](_0x172f36,0x3eb)){var _0x10ce2d=_['find'](_0xfda686,{'sectionId':0x3eb});return getCustomDashboards(_0x10ce2d)[_0x270c('0x2a')](function(_0x564462){return _[_0x270c('0x35')](_0xfda686,function(_0x4c60ec){if(_0x10ce2d['enabled']){if(_0x4c60ec['sectionId']===0x3eb){_0x4c60ec[_0x270c('0x67')]=_0x564462;}}else{if(_0x4c60ec[_0x270c('0x5b')]===0x64){_0x4c60ec[_0x270c('0x67')]=_0x564462;}}return _0x4c60ec;});});}else{return;}})['then'](function(_0x263c13){if(_0x263c13)_0xfda686=_0x263c13;if(_[_0x270c('0x65')](_0x172f36,0x709)){var _0x5df1b6=_[_0x270c('0x4f')](_0xfda686,{'sectionId':0x709});return getPlugins(_0x5df1b6)[_0x270c('0x2a')](function(_0x27caf2){if(_0x5df1b6[_0x270c('0x64')]){return _[_0x270c('0x35')](_0xfda686,function(_0x1d66b1){if(_0x1d66b1[_0x270c('0x5b')]===0x709){_0x1d66b1['subsections']=_0x27caf2;}return _0x1d66b1;});}else{var _0x4dc8f0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x27caf2};var _0x599f11=_[_0x270c('0x35')](_0xfda686);_0x599f11[_0x270c('0x60')](_0x4dc8f0);return _0x599f11;}});}else{return;}})[_0x270c('0x2a')](function(_0x45ff12){if(_0x45ff12)_0xfda686=_0x45ff12;return _['filter'](_0xfda686,[_0x270c('0x64'),0x1]);})[_0x270c('0x2a')](respondWithResult(_0xd18b2e,null))[_0x270c('0x49')](handleError(_0xd18b2e,null));};function hasDefaultDashboard(_0x4ee91c){var _0x5ef0fa=[0x65];return new BPromise(function(_0x297134,_0x23cbce){try{if(_0x4ee91c['autoAssociation']){_0x297134(_0x5ef0fa);}else{return db[_0x270c('0x5a')][_0x270c('0x68')]({'where':{'sectionId':_0x4ee91c['id']},'raw':!![]})['then'](function(_0x54da50){_0x54da50?_0x297134(_0x5ef0fa):_0x297134();});}}catch(_0x367aad){_0x23cbce(_0x367aad);}});}function getCustomDashboards(_0x1c0587){var _0x367258=[];return new BPromise(function(_0x456733,_0x5693a7){try{if(_0x1c0587[_0x270c('0x59')]){return db[_0x270c('0x69')]['findAll']({'raw':!![]})['then'](function(_0x2b1b03){_0x2b1b03[_0x270c('0x6a')](function(_0x4707d3){_0x367258[_0x270c('0x60')](_0x4707d3['id']+0x1869f);});_0x456733(_0x367258);});}else{return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x1c0587['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x548b22){_0x548b22['forEach'](function(_0x2aa916){_0x367258[_0x270c('0x60')](_0x2aa916[_0x270c('0x6b')]+0x1869f);});_0x456733(_0x367258);});}}catch(_0x46d2f9){_0x5693a7(_0x46d2f9);}});}function getPlugins(_0x2a173d){var _0x59060b=[];return new BPromise(function(_0x1c10b7,_0x4e869a){try{if(_0x2a173d[_0x270c('0x59')]){return db[_0x270c('0x6c')][_0x270c('0x44')]({'raw':!![]})[_0x270c('0x2a')](function(_0x514e85){_0x514e85['forEach'](function(_0xb27f6b){_0x59060b[_0x270c('0x60')](_0xb27f6b['id']+0x15b38);});_0x1c10b7(_0x59060b);});}else{return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x2a173d['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x651cf6){_0x651cf6[_0x270c('0x6a')](function(_0x74fac9){_0x59060b['push'](_0x74fac9[_0x270c('0x6b')]+0x15b38);});_0x1c10b7(_0x59060b);});}}catch(_0x553177){_0x4e869a(_0x553177);}});}exports[_0x270c('0x6d')]=function(_0x4447ba,_0x43a8c5){return db[_0x270c('0x2f')]['find']({'where':{'id':_0x4447ba[_0x270c('0x47')]['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x43a8c5,null))[_0x270c('0x2a')](function(_0x23603c){if(_0x23603c){return db[_0x270c('0x54')]['transaction'](function(_0x45879c){return db[_0x270c('0x57')][_0x270c('0x44')]({'where':{'userProfileId':_0x4447ba[_0x270c('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x270c('0x2a')](function(_0x33950d){if(_0x33950d){return db[_0x270c('0x57')][_0x270c('0x2b')]({'where':{'userProfileId':_0x4447ba[_0x270c('0x47')]['id'],'id':_['map'](_0x33950d,function(_0x4cbeb8){return _0x4cbeb8['id'];})},'transaction':_0x45879c});}})[_0x270c('0x2a')](function(_0x22a8ca){var _0x35b4d6=_['map'](_0x4447ba[_0x270c('0x4b')],function(_0x21a089){_0x21a089['userProfileId']=_0x4447ba[_0x270c('0x47')]['id'];return _0x21a089;});return db[_0x270c('0x57')][_0x270c('0x6e')](_0x35b4d6,{'raw':!![],'transaction':_0x45879c});})[_0x270c('0x2a')](function(_0x158ccc){var _0x549642=_['filter'](_[_0x270c('0x35')](_0x158ccc,function(_0x564015){return _0x564015[_0x270c('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x549642){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4447ba['params']['id'],'sectionId':_[_0x270c('0x35')](_0x549642,function(_0x23290f){return _0x23290f[_0x270c('0x5b')];})},'attributes':['id',_0x270c('0x5b')],'raw':!![]})['then'](function(_0x35b9cb){var _0x5069d5=_[_0x270c('0x35')](_0x4447ba[_0x270c('0x4b')],function(_0x4e060e){_0x4e060e['userProfileId']=_0x4447ba[_0x270c('0x47')]['id'];return _0x4e060e;});return db[_0x270c('0x5a')][_0x270c('0x6e')](_0x5069d5,{'raw':!![],'transaction':_0x45879c});});}})[_0x270c('0x49')](handleError(_0x43a8c5,null));});}})[_0x270c('0x2a')](function(_0x47427a){var _0x48ab11=_[_0x270c('0x35')](_0x47427a,function(_0x151d72){return _0x151d72['get']({'plain':!![]});});})[_0x270c('0x2a')](respondWithResult(_0x43a8c5,null))[_0x270c('0x49')](handleError(_0x43a8c5,null));};exports['removeResources']=function(_0x3c9f3e,_0x5d00a5,_0x4c943a){return db['UserProfile']['find']({'where':{'id':_0x3c9f3e[_0x270c('0x47')]['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x5d00a5,null))[_0x270c('0x2a')](function(_0x1ac56e){if(_0x1ac56e){return _0x1ac56e[_0x270c('0x6f')](_0x3c9f3e[_0x270c('0x37')][_0x270c('0x62')]);}})[_0x270c('0x2a')](respondWithStatusCode(_0x5d00a5,null))[_0x270c('0x49')](handleError(_0x5d00a5,null));};exports[_0x270c('0x70')]=function(_0x5ca179,_0x5e7d43){var _0x328997={'raw':![],'where':{}};var _0x3d42ed={};var _0x3ad4e1={'count':0x0,'rows':[]};var _0x3acea0=_0x5ca179[_0x270c('0x37')][_0x270c('0x71')];if(typeof _0x3acea0==='undefined'){throw new db[(_0x270c('0x72'))][(_0x270c('0x73'))](_0x270c('0x74'));}var _0x46c535=_0x5ca179[_0x270c('0x37')][_0x270c('0x75')]||![];var _0x467ba8=getQueryModels(_0x3acea0,_0x46c535);if(typeof _0x467ba8[_0x270c('0x76')]===_0x270c('0x77')){throw new db[(_0x270c('0x72'))][(_0x270c('0x73'))](_0x270c('0x78')+_0x3acea0+'\x27');}var _0x41ecae=[];if(!_[_0x270c('0x66')](_0x467ba8['parentSections'])){_0x41ecae=_0x467ba8[_0x270c('0x79')];}else{_0x41ecae=[{'name':_0x3acea0}];}return db[_0x270c('0x2f')][_0x270c('0x68')]({'where':{'id':_0x5ca179['params']['id']}})[_0x270c('0x2a')](handleEntityNotFound(_0x5e7d43,null))[_0x270c('0x2a')](function(_0xfa3041){if(_0xfa3041){var _0xbdb16=[];for(var _0x5d5cb0=0x0;_0x5d5cb0<_0x41ecae[_0x270c('0x4d')];_0x5d5cb0++){_0xbdb16[_0x270c('0x60')](db[_0x270c('0x57')][_0x270c('0x68')]({'where':{'userProfileId':_0xfa3041['id'],'name':_0x41ecae[_0x5d5cb0][_0x270c('0x2d')]},'raw':!![]}));}return BPromise[_0x270c('0x7a')](_0xbdb16);}})['then'](function(_0x1608c4){var _0x498386=_['filter'](_0x1608c4,function(_0x4bdd9b){return _0x4bdd9b?_0x4bdd9b:undefined;});var _0x3c932b=_[_0x270c('0x3f')](_0x41ecae,[_0x270c('0x7b'),!![]]);var _0x55750a=_['isEmpty'](_0x498386)&&_[_0x270c('0x66')](_0x3c932b)?null:_[_0x270c('0x7c')](_0x3c932b,_0x498386);if(_0x55750a){var _0x10fbaf=[];for(var _0x414fa8=0x0;_0x414fa8<_0x55750a[_0x270c('0x4d')];_0x414fa8++){var _0x1fe8e7=_[_0x270c('0x4f')](_0x41ecae,function(_0x384f22){return _0x55750a[_0x414fa8]?_0x384f22[_0x270c('0x2d')]===_0x55750a[_0x414fa8]['name']:null;});if(_0x1fe8e7){if(_0x55750a[_0x414fa8][_0x270c('0x7b')]){_0x10fbaf[_0x270c('0x60')](getAllResources(_0x467ba8[_0x270c('0x76')],_0x55750a[_0x414fa8]));}else{if(!_0x55750a[_0x414fa8]['autoAssociation']){_0x10fbaf[_0x270c('0x60')](getAllowedResources(_0x1fe8e7,_0x55750a[_0x414fa8],_0x467ba8[_0x270c('0x76')]));}else{if(_0x1fe8e7[_0x270c('0x34')]){_0x10fbaf[_0x270c('0x60')](getAllFilteredResources(_0x1fe8e7,_0x55750a[_0x414fa8]));}}}}}return BPromise['all'](_0x10fbaf);}else{return null;}})[_0x270c('0x2a')](function(_0x5179ad){var _0x58447e=_0x5179ad;var _0x13aecb=null;if(_0x58447e){_0x13aecb=_0x58447e[_0x270c('0x4d')]===0x1?_0x58447e[0x0]:null;}if(_0x13aecb||_0x58447e){var _0x51f4b3=db[_0x467ba8[_0x270c('0x76')]][_0x270c('0x30')];_0x3d42ed[_0x270c('0x34')]=_[_0x270c('0x36')](_0x51f4b3);_0x3d42ed[_0x270c('0x37')]=_[_0x270c('0x36')](_0x5ca179[_0x270c('0x37')]);_0x3d42ed[_0x270c('0x38')]=_[_0x270c('0x39')](_0x3d42ed[_0x270c('0x34')],_0x3d42ed[_0x270c('0x37')]);_0x328997[_0x270c('0x3a')]=_['intersection'](_0x3d42ed[_0x270c('0x34')],qs[_0x270c('0x3b')](_0x5ca179[_0x270c('0x37')][_0x270c('0x3b')]));_0x328997[_0x270c('0x3a')]=_0x328997['attributes'][_0x270c('0x4d')]?_0x328997[_0x270c('0x3a')]:_0x3d42ed[_0x270c('0x34')];if(!_0x5ca179['query'][_0x270c('0x7d')](_0x270c('0x3c'))){_0x328997['limit']=qs[_0x270c('0x24')](_0x5ca179[_0x270c('0x37')][_0x270c('0x24')]);_0x328997[_0x270c('0x23')]=qs[_0x270c('0x23')](_0x5ca179['query']['offset']);}_0x328997[_0x270c('0x3d')]=qs['sort'](_0x5ca179[_0x270c('0x37')]['sort']);_0x328997[_0x270c('0x40')]=qs[_0x270c('0x38')](_[_0x270c('0x7e')](_0x5ca179[_0x270c('0x37')],_0x3d42ed[_0x270c('0x38')]));if(_0x5ca179['query'][_0x270c('0x3f')]){_0x328997[_0x270c('0x40')]=_[_0x270c('0x42')](_0x328997[_0x270c('0x40')],{'$or':_[_0x270c('0x35')](_0x51f4b3,function(_0x4a1fc4){if(_0x4a1fc4[_0x270c('0x32')][_0x270c('0x33')]!=='VIRTUAL'){var _0x22763b={};_0x22763b[_0x4a1fc4[_0x270c('0x7f')]]={'$like':'%'+_0x5ca179[_0x270c('0x37')][_0x270c('0x3f')]+'%'};return _0x22763b;}})});}var _0xc73609=[];if(_0x13aecb){var _0x1c34f5=_['find'](_0x41ecae,[_0x270c('0x2d'),_0x13aecb[_0x270c('0x2d')]]);if(_0x1c34f5['field']){var _0x27361={};if(_0x467ba8[_0x270c('0x76')]===_0x270c('0x80')){_0x27361[_0x1c34f5[_0x270c('0x81')]]=_['map'](_0x13aecb[_0x270c('0x82')],'id');}else{_0x27361[_0x1c34f5[_0x270c('0x81')]]=_0x13aecb['associatedResources'];}_0xc73609[_0x270c('0x60')](_0x27361);}else{_0x328997[_0x270c('0x40')]['id']=_0x13aecb['associatedResources'];}}else{for(var _0x3bfa94=0x0;_0x3bfa94<_0x58447e['length'];_0x3bfa94++){var _0x1c34f5=_[_0x270c('0x4f')](_0x41ecae,['name',_0x58447e[_0x3bfa94]['name']]);if(_0x1c34f5[_0x270c('0x7f')]){var _0x27361={};_0x27361[_0x1c34f5[_0x270c('0x81')]]=_0x58447e[_0x3bfa94][_0x270c('0x82')];_0xc73609[_0x270c('0x60')](_0x27361);}else{if(!_0x328997[_0x270c('0x40')]['id'])_0x328997[_0x270c('0x40')]['id']=[];_0x58447e[_0x3bfa94][_0x270c('0x82')][_0x270c('0x6a')](function(_0x4753b9){_0x328997[_0x270c('0x40')]['id'][_0x270c('0x60')](_0x4753b9);});}}}if(!_[_0x270c('0x66')](_0xc73609)){_0x328997[_0x270c('0x40')]=_[_0x270c('0x42')](_0x328997[_0x270c('0x40')],{'$and':{'$or':_0xc73609}});}_0x328997=_[_0x270c('0x42')]({},_0x328997,_0x5ca179[_0x270c('0x4e')]);if(_0x13aecb&&!_0x13aecb['autoAssociation']&&_0x467ba8['childModel']==='AnalyticExtractedReport'){if(_0x5ca179['query'][_0x270c('0x43')]){_0x328997[_0x270c('0x48')]=[{'all':!![]}];}return db[_0x467ba8[_0x270c('0x76')]][_0x270c('0x44')](_0x328997)['then'](function(_0x471c60){var _0x5309b3=[];_0x471c60[_0x270c('0x6a')](function(_0xe5bc35){var _0x43bdc0;switch(_0xe5bc35[_0x270c('0x83')]){case _0x270c('0x84'):_0x43bdc0=_[_0x270c('0x4f')](_0x13aecb['associatedResources'],function(_0x576664){return _0x576664['id']===_0xe5bc35[_0x270c('0x85')]&&_0x576664[_0x270c('0x32')]===_0x270c('0x86');});break;case _0x270c('0x87'):_0x43bdc0=_[_0x270c('0x4f')](_0x13aecb[_0x270c('0x82')],function(_0x15e7e6){return _0x15e7e6['id']===_0xe5bc35[_0x270c('0x85')]&&_0x15e7e6[_0x270c('0x32')]==='CustomReports';});break;}if(_0x43bdc0)_0x5309b3[_0x270c('0x60')](_0xe5bc35);});_0x3ad4e1[_0x270c('0x22')]=_0x5309b3[_0x270c('0x4d')];_0x3ad4e1[_0x270c('0x45')]=_0x5309b3;return _0x3ad4e1;});}else{return db[_0x467ba8[_0x270c('0x76')]]['count']({'where':_0x328997[_0x270c('0x40')]})['then'](function(_0x35f5d4){_0x3ad4e1[_0x270c('0x22')]=_0x35f5d4;if(_0x5ca179[_0x270c('0x37')]['includeAll']){if(_0x467ba8['childModel']===_0x270c('0x88')){_0x328997[_0x270c('0x48')]=[{'model':db[_0x270c('0x89')],'as':_0x270c('0x8a'),'attributes':['id',_0x270c('0x2d'),_0x270c('0x8b')],'required':_0x5ca179[_0x270c('0x37')][_0x270c('0x8c')]?!![]:![]},{'model':db[_0x270c('0x89')],'as':_0x270c('0x8d'),'attributes':['id',_0x270c('0x2d'),'color'],'through':_0x5ca179[_0x270c('0x37')]['tag']?{'attributes':[],'where':{'TagId':_0x5ca179[_0x270c('0x37')]['tag']||undefined}}:{},'required':_0x5ca179[_0x270c('0x37')]['tag']?!![]:![]}];}else{_0x328997[_0x270c('0x48')]=[{'all':!![]}];}}return db[_0x467ba8[_0x270c('0x76')]][_0x270c('0x44')](_0x328997);})[_0x270c('0x2a')](function(_0x526332){_0x3ad4e1[_0x270c('0x45')]=_0x526332;return _0x3ad4e1;});}}else{return _0x3ad4e1;}})[_0x270c('0x2a')](respondWithFilteredResult(_0x5e7d43,_0x328997))[_0x270c('0x49')](handleError(_0x5e7d43,null));};function getAllResources(_0x19d824,_0x397961){return new BPromise(function(_0x3edbb2,_0x5d9718){if(_0x397961){var _0x3e693d=_0x397961['filter']?{[_0x397961[_0x270c('0x3f')][_0x270c('0x7f')]]:_0x397961[_0x270c('0x3f')]['value']}:undefined;return db[_0x19d824]['findAll']({'where':_0x3e693d,'raw':!![]})[_0x270c('0x2a')](function(_0x5bc1c2){_0x397961['associatedResources']=_[_0x270c('0x35')](_0x5bc1c2,'id');_0x3edbb2(_0x397961);})[_0x270c('0x49')](function(_0xfd84f0){_0x5d9718(_0xfd84f0);});}else{_0x3edbb2(null);}});}function getAllFilteredResources(_0x1fae64,_0x451985){return new BPromise(function(_0x1f0df0,_0x4791fe){var _0x39edae=_0x1fae64[_0x270c('0x3f')]?{[_0x1fae64['filter'][_0x270c('0x7f')]]:_0x1fae64['filter'][_0x270c('0x8e')]}:undefined;return db[_0x1fae64[_0x270c('0x34')]]['findAll']({'where':_0x39edae,'raw':!![]})['then'](function(_0x107080){_0x451985[_0x270c('0x82')]=_['map'](_0x107080,function(_0x3cb636){return _0x3cb636[_0x270c('0x2d')];});_0x1f0df0(_0x451985);})['catch'](function(_0x452d9b){_0x4791fe(_0x452d9b);});});}function getAllowedResources(_0x3753b7,_0x4bb734,_0x29f8f5){return new BPromise(function(_0x4a98fc,_0x13feec){if(_0x4bb734){return db[_0x270c('0x5a')][_0x270c('0x44')]({'where':{'sectionId':_0x4bb734['id']},'raw':!![]})[_0x270c('0x2a')](function(_0x54f918){if(_0x3753b7[_0x270c('0x7f')]&&_0x3753b7[_0x270c('0x7f')]!=='id'){_0x4bb734[_0x270c('0x82')]=_[_0x270c('0x35')](_0x54f918,function(_0x7622e8){return _0x7622e8[_0x3753b7[_0x270c('0x7f')]];});}else{if(_0x29f8f5===_0x270c('0x80')){_0x4bb734[_0x270c('0x82')]=_[_0x270c('0x35')](_0x54f918,function(_0xdbe896){return{'id':_0xdbe896[_0x270c('0x6b')],'type':_0xdbe896[_0x270c('0x32')]};});}else{_0x4bb734[_0x270c('0x82')]=_[_0x270c('0x35')](_0x54f918,function(_0x3e1fdc){return _0x3e1fdc[_0x270c('0x6b')];});}}_0x4a98fc(_0x4bb734);})['catch'](function(_0x53c9fc){_0x13feec(_0x53c9fc);});}else{_0x4a98fc(null);}});}function getQueryModels(_0x5da11e,_0x141809){var _0x1f3db1=_0x5da11e['toLowerCase']();var _0x3756d3={'childModel':undefined,'parentSections':[]};switch(_0x1f3db1){case _0x270c('0x8f'):_0x3756d3[_0x270c('0x76')]=_0x270c('0x90');break;case'odbc':_0x3756d3[_0x270c('0x76')]=_0x270c('0x91');break;case'squarerecordings':_0x3756d3[_0x270c('0x76')]=_0x270c('0x92');_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0x93'),'field':'name','foreignKey':_0x270c('0x94')}];break;case _0x270c('0x95'):_0x3756d3[_0x270c('0x76')]=_0x270c('0x96');break;case _0x270c('0x97'):_0x3756d3[_0x270c('0x76')]='CmContact';_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0x98'),'field':'id','foreignKey':_0x270c('0x99')}];break;case _0x270c('0x9a'):_0x3756d3[_0x270c('0x76')]='CmList';break;case _0x270c('0x9b'):_0x3756d3[_0x270c('0x76')]='CmCompany';break;case _0x270c('0x9c'):_0x3756d3['childModel']='CmCustomField';break;case _0x270c('0x9d'):_0x3756d3['childModel']=_0x270c('0x9e');break;case'chatwebsites':_0x3756d3[_0x270c('0x76')]='ChatWebsite';break;case _0x270c('0x9f'):_0x3756d3['childModel']=_0x270c('0xa0');break;case _0x270c('0xa1'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xa2');break;case _0x270c('0xa3'):case _0x270c('0xa4'):case _0x270c('0xa5'):_0x3756d3['childModel']='VoiceExtension';break;case _0x270c('0xa6'):_0x3756d3['childModel']=_0x270c('0xa7');break;case _0x270c('0xa8'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xa9');break;case _0x270c('0xaa'):_0x3756d3['childModel']='VoiceRecording';_0x3756d3[_0x270c('0x79')]=[{'name':'Agents','field':_0x270c('0x2d'),'foreignKey':'membername','model':_0x270c('0xab'),'filter':{'field':'role','value':[_0x270c('0xac')]}},{'name':_0x270c('0xad'),'field':'name','foreignKey':_0x270c('0xae'),'model':_0x270c('0xab'),'filter':{'field':_0x270c('0xaf'),'value':[_0x270c('0xb0')]}},{'name':_0x270c('0xb1'),'field':'name','foreignKey':_0x270c('0xb2'),'model':_0x270c('0xb3'),'filter':{'field':_0x270c('0x32'),'value':[_0x270c('0xb4')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x270c('0xb2'),'model':'VoiceQueue','filter':{'field':'type','value':['outbound']}}];break;case _0x270c('0xb5'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xb6');break;case'chanspies':_0x3756d3[_0x270c('0x76')]=_0x270c('0xb7');break;case _0x270c('0xb8'):_0x3756d3['childModel']=_0x270c('0xb9');break;case'ivrcampaigns':_0x3756d3[_0x270c('0x76')]=_0x270c('0xba');break;case _0x270c('0xbb'):_0x3756d3[_0x270c('0x76')]='MailQueue';break;case'mailaccounts':_0x3756d3[_0x270c('0x76')]=_0x270c('0xbc');break;case _0x270c('0xbd'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xbe');break;case'openchannelqueues':_0x3756d3['childModel']=_0x270c('0xbf');break;case'openchannelaccounts':_0x3756d3[_0x270c('0x76')]=_0x270c('0xc0');break;case _0x270c('0xc1'):_0x3756d3[_0x270c('0x76')]='SmsQueue';break;case _0x270c('0xc2'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xc3');break;case _0x270c('0xc4'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xc5');break;case _0x270c('0xc6'):_0x3756d3['childModel']=_0x270c('0xc7');break;case'teams':_0x3756d3[_0x270c('0x76')]=_0x270c('0xc8');break;case _0x270c('0xc9'):case _0x270c('0xca'):_0x3756d3['childModel']='VoiceQueue';if(_0x141809){_0x3756d3[_0x270c('0x79')]=[{'name':'VoiceQueues'},{'name':_0x270c('0xcb')}];}break;case _0x270c('0xcc'):case _0x270c('0xcd'):case _0x270c('0xce'):_0x3756d3['childModel']='User';if(_0x141809){_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0xcf'),'filter':{'field':_0x270c('0xaf'),'value':[_0x270c('0xd0'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x270c('0xad')}];}break;case _0x270c('0xd1'):_0x3756d3[_0x270c('0x76')]='ZendeskAccount';break;case'salesforceaccounts':_0x3756d3['childModel']=_0x270c('0xd2');break;case _0x270c('0xd3'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xd4');break;case'sugarcrmaccounts':_0x3756d3[_0x270c('0x76')]='SugarcrmAccount';break;case'deskaccounts':_0x3756d3[_0x270c('0x76')]=_0x270c('0xd5');break;case _0x270c('0xd6'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xd7');break;case _0x270c('0xd8'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xab');break;case _0x270c('0xd9'):_0x3756d3[_0x270c('0x76')]='CannedAnswer';break;case _0x270c('0xda'):_0x3756d3['childModel']='Disposition';break;case _0x270c('0xdb'):_0x3756d3['childModel']=_0x270c('0x69');break;case _0x270c('0xdc'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xdd');break;case'pauses':_0x3756d3['childModel']=_0x270c('0xde');break;case _0x270c('0xdf'):_0x3756d3[_0x270c('0x76')]='Schedule';break;case _0x270c('0xe0'):_0x3756d3[_0x270c('0x76')]='Sound';break;case _0x270c('0xe1'):_0x3756d3['childModel']=_0x270c('0x89');break;case _0x270c('0xe2'):_0x3756d3['childModel']='Template';break;case _0x270c('0xe3'):_0x3756d3[_0x270c('0x76')]=_0x270c('0xe4');break;case _0x270c('0xe5'):_0x3756d3['childModel']=_0x270c('0xe6');break;case _0x270c('0xe7'):_0x3756d3['childModel']=_0x270c('0xe8');break;case _0x270c('0xe9'):_0x3756d3[_0x270c('0x76')]=_0x270c('0x6c');break;case'extractedreports':_0x3756d3[_0x270c('0x76')]=_0x270c('0x80');_0x3756d3[_0x270c('0x79')]=[{'name':_0x270c('0xea'),'field':'id','foreignKey':_0x270c('0x85')}];break;case'metrics':_0x3756d3['childModel']=_0x270c('0xeb');break;case _0x270c('0xc6'):_0x3756d3[_0x270c('0x76')]='WhatsappAccount';break;default:return _0x3756d3;}return _0x3756d3;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f5b073c..d81e7af 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 _0xb68c=['events','UserProfile','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x69edd5,_0x26206a){var _0x1772c0=function(_0x338b4f){while(--_0x338b4f){_0x69edd5['push'](_0x69edd5['shift']());}};_0x1772c0(++_0x26206a);}(_0xb68c,0x1c8));var _0xcb68=function(_0x1084c4,_0x5ef9e8){_0x1084c4=_0x1084c4-0x0;var _0x3d5a9d=_0xb68c[_0x1084c4];return _0x3d5a9d;};'use strict';var EventEmitter=require(_0xcb68('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xcb68('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcb68('0x2')](0x0);var events={'afterCreate':_0xcb68('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5054de){return function(_0x3fee01,_0x52c5d3,_0x3cef91){UserProfileEvents['emit'](_0x5054de+':'+_0x3fee01['id'],_0x3fee01);UserProfileEvents[_0xcb68('0x4')](_0x5054de,_0x3fee01);_0x3cef91(null);};}for(var e in events){if(events[_0xcb68('0x5')](e)){var event=events[e];UserProfile[_0xcb68('0x6')](e,emitEvent(event));}}module[_0xcb68('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xf54c=['events','../../mysqldb','UserProfile','setMaxListeners','update','emit','hook'];(function(_0x2bf4db,_0x935f73){var _0x75830c=function(_0x4cffef){while(--_0x4cffef){_0x2bf4db['push'](_0x2bf4db['shift']());}};_0x75830c(++_0x935f73);}(_0xf54c,0x150));var _0xcf54=function(_0x22960c,_0x352028){_0x22960c=_0x22960c-0x0;var _0x330529=_0xf54c[_0x22960c];return _0x330529;};'use strict';var EventEmitter=require(_0xcf54('0x0'));var UserProfile=require(_0xcf54('0x1'))['db'][_0xcf54('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcf54('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf54('0x4'),'afterDestroy':'remove'};function emitEvent(_0x318b80){return function(_0x323046,_0x501a68,_0x2e069e){UserProfileEvents[_0xcf54('0x5')](_0x318b80+':'+_0x323046['id'],_0x323046);UserProfileEvents[_0xcf54('0x5')](_0x318b80,_0x323046);_0x2e069e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcf54('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b8be386..2ca4ada 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 _0xd165=['exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3c1246,_0x3f4b9f){var _0x3e7c5b=function(_0x3b0872){while(--_0x3b0872){_0x3c1246['push'](_0x3c1246['shift']());}};_0x3e7c5b(++_0x3f4b9f);}(_0xd165,0x197));var _0x5d16=function(_0x5c5c11,_0x5a0cfc){_0x5c5c11=_0x5c5c11-0x0;var _0x3380d7=_0xd165[_0x5c5c11];return _0x3380d7;};'use strict';var _=require(_0x5d16('0x0'));var util=require(_0x5d16('0x1'));var logger=require(_0x5d16('0x2'))(_0x5d16('0x3'));var moment=require(_0x5d16('0x4'));var BPromise=require(_0x5d16('0x5'));var rp=require(_0x5d16('0x6'));var fs=require('fs');var path=require(_0x5d16('0x7'));var rimraf=require('rimraf');var config=require(_0x5d16('0x8'));var attributes=require('./userProfile.attributes');module[_0x5d16('0x9')]=function(_0x5b940c,_0xfe1137){return _0x5b940c[_0x5d16('0xa')](_0x5d16('0xb'),attributes,{'tableName':_0x5d16('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a00=['user_profiles','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfile.attributes','define','UserProfile'];(function(_0x187e4e,_0x8d4f4b){var _0x43b7f4=function(_0x4805de){while(--_0x4805de){_0x187e4e['push'](_0x187e4e['shift']());}};_0x43b7f4(++_0x8d4f4b);}(_0x8a00,0x121));var _0x08a0=function(_0x4bcf2a,_0x2c2d5a){_0x4bcf2a=_0x4bcf2a-0x0;var _0x28ba88=_0x8a00[_0x4bcf2a];return _0x28ba88;};'use strict';var _=require(_0x08a0('0x0'));var util=require(_0x08a0('0x1'));var logger=require('../../config/logger')(_0x08a0('0x2'));var moment=require(_0x08a0('0x3'));var BPromise=require(_0x08a0('0x4'));var rp=require(_0x08a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08a0('0x6'));var config=require(_0x08a0('0x7'));var attributes=require(_0x08a0('0x8'));module['exports']=function(_0x53df6b,_0x40762d){return _0x53df6b[_0x08a0('0x9')](_0x08a0('0xa'),attributes,{'tableName':_0x08a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5e5bbfc..a24fd7d 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 _0x6f47=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info'];(function(_0x595b74,_0x1c9aec){var _0x133c95=function(_0xe65fd3){while(--_0xe65fd3){_0x595b74['push'](_0x595b74['shift']());}};_0x133c95(++_0x1c9aec);}(_0x6f47,0xc7));var _0x76f4=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x6f47[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});config[_0x76f4('0x9')]=_[_0x76f4('0xa')](config['redis'],{'host':_0x76f4('0xb'),'port':0x18eb});var socket=require(_0x76f4('0xc'))(new Redis(config[_0x76f4('0x9')]));require(_0x76f4('0xd'))[_0x76f4('0xe')](socket);function respondWithRpcPromise(_0x4c6b5c,_0x5367d6,_0x3347ef){return new BPromise(function(_0x18e41a,_0x5af83c){return client['request'](_0x4c6b5c,_0x3347ef)[_0x76f4('0xf')](function(_0x458c22){logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));logger[_0x76f4('0x13')](_0x76f4('0x14'),_0x5367d6,_0x76f4('0x12'),JSON[_0x76f4('0x15')](_0x458c22));if(_0x458c22['error']){if(_0x458c22[_0x76f4('0x16')][_0x76f4('0x17')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x5367d6,_0x458c22['error'][_0x76f4('0x18')]);return _0x5af83c(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);return _0x18e41a(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}else{logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));_0x18e41a(_0x458c22[_0x76f4('0x19')][_0x76f4('0x18')]);}})[_0x76f4('0x1a')](function(_0x397360){logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x397360);_0x5af83c(_0x397360);});});} \ No newline at end of file +var _0xeec6=['localhost','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x3bff47,_0x43601f){var _0x531204=function(_0x14526b){while(--_0x14526b){_0x3bff47['push'](_0x3bff47['shift']());}};_0x531204(++_0x43601f);}(_0xeec6,0x1c2));var _0x6eec=function(_0x399849,_0x3b630d){_0x399849=_0x399849-0x0;var _0xfbb04=_0xeec6[_0x399849];return _0xfbb04;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('UserProfile,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('UserProfile,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 11a1bdb..ad99fba 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 _0xfb10=['register','length','userProfile:','./userProfile.events','save','remove','update','removeListener'];(function(_0x251fac,_0x1f10cd){var _0x4521d2=function(_0x4f18be){while(--_0x4f18be){_0x251fac['push'](_0x251fac['shift']());}};_0x4521d2(++_0x1f10cd);}(_0xfb10,0x11b));var _0x0fb1=function(_0x223885,_0x14ba6e){_0x223885=_0x223885-0x0;var _0x2c0ed8=_0xfb10[_0x223885];return _0x2c0ed8;};'use strict';var UserProfileEvents=require(_0x0fb1('0x0'));var events=[_0x0fb1('0x1'),_0x0fb1('0x2'),_0x0fb1('0x3')];function createListener(_0x356a62,_0x239c17){return function(_0x905fff){_0x239c17['emit'](_0x356a62,_0x905fff);};}function removeListener(_0x32d2fc,_0x54ad4c){return function(){UserProfileEvents[_0x0fb1('0x4')](_0x32d2fc,_0x54ad4c);};}exports[_0x0fb1('0x5')]=function(_0x55fe62){for(var _0x1e6689=0x0,_0x1cef6a=events[_0x0fb1('0x6')];_0x1e6689<_0x1cef6a;_0x1e6689++){var _0x941b9d=events[_0x1e6689];var _0x46fda0=createListener(_0x0fb1('0x7')+_0x941b9d,_0x55fe62);UserProfileEvents['on'](_0x941b9d,_0x46fda0);}}; \ No newline at end of file +var _0xa41a=['length','./userProfile.events','save','remove','emit','removeListener','register'];(function(_0x18ff42,_0x4a3b2d){var _0x1b850c=function(_0x5907ee){while(--_0x5907ee){_0x18ff42['push'](_0x18ff42['shift']());}};_0x1b850c(++_0x4a3b2d);}(_0xa41a,0x16d));var _0xaa41=function(_0x37a443,_0x5228e4){_0x37a443=_0x37a443-0x0;var _0xb631c=_0xa41a[_0x37a443];return _0xb631c;};'use strict';var UserProfileEvents=require(_0xaa41('0x0'));var events=[_0xaa41('0x1'),_0xaa41('0x2'),'update'];function createListener(_0xdc90c7,_0x2d82b6){return function(_0x501302){_0x2d82b6[_0xaa41('0x3')](_0xdc90c7,_0x501302);};}function removeListener(_0x3dfaac,_0xd7106f){return function(){UserProfileEvents[_0xaa41('0x4')](_0x3dfaac,_0xd7106f);};}exports[_0xaa41('0x5')]=function(_0x4d7706){for(var _0x835ee4=0x0,_0x459ce5=events[_0xaa41('0x6')];_0x835ee4<_0x459ce5;_0x835ee4++){var _0x37f05a=events[_0x835ee4];var _0x398fe2=createListener('userProfile:'+_0x37f05a,_0x4d7706);UserProfileEvents['on'](_0x37f05a,_0x398fe2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a42ff46..eaf6ed4 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 _0x63a5=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x63a5,0x18e));var _0x563a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x63a5[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var path=require(_0x563a('0x2'));var timeout=require('connect-timeout');var express=require(_0x563a('0x3'));var router=express['Router']();var auth=require(_0x563a('0x4'));var interaction=require(_0x563a('0x5'));var config=require(_0x563a('0x6'));var controller=require(_0x563a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x563a('0x8')]);router['get'](_0x563a('0x9'),auth[_0x563a('0xa')](),controller['describe']);router['get'](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0xc')]);router[_0x563a('0xd')]('/',auth[_0x563a('0xa')](),controller[_0x563a('0xe')]);router[_0x563a('0xf')](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0x10')]);router[_0x563a('0x11')](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa2cb=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x344de0,_0x42e2c1){var _0xe4d01b=function(_0x18f109){while(--_0x18f109){_0x344de0['push'](_0x344de0['shift']());}};_0xe4d01b(++_0x42e2c1);}(_0xa2cb,0x7d));var _0xba2c=function(_0x2ed279,_0x208b52){_0x2ed279=_0x2ed279-0x0;var _0x14c267=_0xa2cb[_0x2ed279];return _0x14c267;};'use strict';var multer=require(_0xba2c('0x0'));var util=require(_0xba2c('0x1'));var path=require('path');var timeout=require(_0xba2c('0x2'));var express=require(_0xba2c('0x3'));var router=express[_0xba2c('0x4')]();var auth=require(_0xba2c('0x5'));var interaction=require(_0xba2c('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xba2c('0x7')]('/describe',auth[_0xba2c('0x8')](),controller['describe']);router[_0xba2c('0x7')](_0xba2c('0x9'),auth['isAuthenticated'](),controller[_0xba2c('0xa')]);router[_0xba2c('0xb')]('/',auth['isAuthenticated'](),controller[_0xba2c('0xc')]);router[_0xba2c('0xd')](_0xba2c('0x9'),auth[_0xba2c('0x8')](),controller['update']);router[_0xba2c('0xe')](_0xba2c('0x9'),auth[_0xba2c('0x8')](),controller[_0xba2c('0xf')]);module[_0xba2c('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 30f1e80..f54754a 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 _0x7be9=['sequelize','exports','STRING','INTEGER'];(function(_0x18c7db,_0x1525fa){var _0x19a1cf=function(_0x53493d){while(--_0x53493d){_0x18c7db['push'](_0x18c7db['shift']());}};_0x19a1cf(++_0x1525fa);}(_0x7be9,0x70));var _0x97be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x97be('0x0'));module[_0x97be('0x1')]={'name':{'type':Sequelize[_0x97be('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x97be('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7fbf=['exports','STRING','sequelize'];(function(_0x57c8d8,_0x44344d){var _0xda7dbe=function(_0x3ab316){while(--_0x3ab316){_0x57c8d8['push'](_0x57c8d8['shift']());}};_0xda7dbe(++_0x44344d);}(_0x7fbf,0xad));var _0xf7fb=function(_0x2d4ee1,_0x45988e){_0x2d4ee1=_0x2d4ee1-0x0;var _0x37d5b5=_0x7fbf[_0x2d4ee1];return _0x37d5b5;};'use strict';var Sequelize=require(_0xf7fb('0x0'));module[_0xf7fb('0x1')]={'name':{'type':Sequelize[_0xf7fb('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 5d3824c..0c728d8 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 _0xe14b=['catch','create','body','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','rows','show','fields','length','include','options','find'];(function(_0x2f0239,_0x4b27ea){var _0x5095b4=function(_0x185656){while(--_0x185656){_0x2f0239['push'](_0x2f0239['shift']());}};_0x5095b4(++_0x4b27ea);}(_0xe14b,0x93));var _0xbe14=function(_0x2c3dd7,_0x596705){_0x2c3dd7=_0x2c3dd7-0x0;var _0x24611d=_0xe14b[_0x2c3dd7];return _0x24611d;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x505dbd,_0x2da350){return function(_0x4d4190){if(!_0x4d4190){_0x505dbd[_0xbe14('0x16')](0x194);}return _0x4d4190;};}function handleError(_0x4851f8,_0x36a21e){_0x36a21e=_0x36a21e||0x1f4;return function(_0x5fa043){logger[_0xbe14('0x22')](_0x5fa043[_0xbe14('0x23')]);if(_0x5fa043[_0xbe14('0x24')]){delete _0x5fa043[_0xbe14('0x24')];}_0x4851f8['status'](_0x36a21e)[_0xbe14('0x25')](_0x5fa043);};}exports[_0xbe14('0x26')]=function(_0x391556,_0x169369){var _0x5dd475={},_0x16f884={},_0x29fc64={'count':0x0,'rows':[]};var _0x59bf34=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x19252f){return{'name':_0x19252f[_0xbe14('0x2a')],'type':_0x19252f[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x16f884[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x59bf34,_0xbe14('0x24'));_0x16f884[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x391556[_0xbe14('0x2e')]);_0x16f884[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],_0x16f884[_0xbe14('0x2e')]);_0x5dd475[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],qs['fields'](_0x391556[_0xbe14('0x2e')]['fields']));_0x5dd475['attributes']=_0x5dd475[_0xbe14('0x32')]['length']?_0x5dd475[_0xbe14('0x32')]:_0x16f884[_0xbe14('0x2d')];if(!_0x391556['query']['hasOwnProperty']('nolimit')){_0x5dd475[_0xbe14('0x1b')]=qs[_0xbe14('0x1b')](_0x391556['query'][_0xbe14('0x1b')]);_0x5dd475[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x391556[_0xbe14('0x2e')][_0xbe14('0x1a')]);}_0x5dd475['order']=qs['sort'](_0x391556[_0xbe14('0x2e')]['sort']);_0x5dd475['where']=qs['filters'](_[_0xbe14('0x33')](_0x391556[_0xbe14('0x2e')],_0x16f884[_0xbe14('0x30')]),_0x59bf34);if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]){_0x5dd475[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x5dd475[_0xbe14('0x35')],{'$or':_[_0xbe14('0x27')](_0x59bf34,function(_0x2dfd5a){if(_0x2dfd5a[_0xbe14('0x2b')]!==_0xbe14('0x37')){var _0x539c41={};_0x539c41[_0x2dfd5a['name']]={'$like':'%'+_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]+'%'};return _0x539c41;}})});}_0x5dd475=_[_0xbe14('0x36')]({},_0x5dd475,_0x391556['options']);var _0x326329={'where':_0x5dd475[_0xbe14('0x35')]};return db[_0xbe14('0x28')][_0xbe14('0x19')](_0x326329)[_0xbe14('0x38')](function(_0x25ee1f){_0x29fc64[_0xbe14('0x19')]=_0x25ee1f;if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x39')]){_0x5dd475['include']=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x3a')](_0x5dd475);})[_0xbe14('0x38')](function(_0x1b3118){_0x29fc64[_0xbe14('0x3b')]=_0x1b3118;return _0x29fc64;})[_0xbe14('0x38')](respondWithFilteredResult(_0x169369,_0x5dd475))['catch'](handleError(_0x169369,null));};exports[_0xbe14('0x3c')]=function(_0x1974a4,_0x1220c9){var _0x36263c={'raw':![],'where':{'id':_0x1974a4['params']['id']}},_0x5cf713={};_0x5cf713[_0xbe14('0x2d')]=_[_0xbe14('0x2f')](db[_0xbe14('0x28')]['rawAttributes']);_0x5cf713['query']=_[_0xbe14('0x2f')](_0x1974a4['query']);_0x5cf713['filters']=_[_0xbe14('0x31')](_0x5cf713[_0xbe14('0x2d')],_0x5cf713[_0xbe14('0x2e')]);_0x36263c['attributes']=_['intersection'](_0x5cf713['model'],qs[_0xbe14('0x3d')](_0x1974a4[_0xbe14('0x2e')][_0xbe14('0x3d')]));_0x36263c['attributes']=_0x36263c[_0xbe14('0x32')][_0xbe14('0x3e')]?_0x36263c[_0xbe14('0x32')]:_0x5cf713[_0xbe14('0x2d')];if(_0x1974a4['query']['includeAll']){_0x36263c[_0xbe14('0x3f')]=[{'all':!![]}];}_0x36263c=_[_0xbe14('0x36')]({},_0x36263c,_0x1974a4[_0xbe14('0x40')]);return db[_0xbe14('0x28')][_0xbe14('0x41')](_0x36263c)['then'](handleEntityNotFound(_0x1220c9,null))['then'](respondWithResult(_0x1220c9,null))[_0xbe14('0x42')](handleError(_0x1220c9,null));};exports[_0xbe14('0x43')]=function(_0x238c60,_0x2a3b35){return db['UserProfileResource'][_0xbe14('0x43')](_0x238c60[_0xbe14('0x44')],{})['then'](respondWithResult(_0x2a3b35,0xc9))[_0xbe14('0x42')](handleError(_0x2a3b35,null));};exports[_0xbe14('0x20')]=function(_0x2d6ee8,_0x36c20c){if(_0x2d6ee8['body']['id']){delete _0x2d6ee8['body']['id'];}return db[_0xbe14('0x28')][_0xbe14('0x41')]({'where':{'id':_0x2d6ee8['params']['id']}})['then'](handleEntityNotFound(_0x36c20c,null))[_0xbe14('0x38')](saveUpdates(_0x2d6ee8[_0xbe14('0x44')],null))[_0xbe14('0x38')](respondWithResult(_0x36c20c,null))[_0xbe14('0x42')](handleError(_0x36c20c,null));};exports[_0xbe14('0x21')]=function(_0xd04fd5,_0x10cd86){return db['UserProfileResource'][_0xbe14('0x41')]({'where':{'id':_0xd04fd5[_0xbe14('0x45')]['id']}})[_0xbe14('0x38')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x38')](removeEntity(_0x10cd86,null))[_0xbe14('0x42')](handleError(_0x10cd86,null));};exports['describe']=function(_0x3a221b,_0x3d419a){return db[_0xbe14('0x28')][_0xbe14('0x46')]()[_0xbe14('0x38')](respondWithResult(_0x3d419a,null))[_0xbe14('0x42')](handleError(_0x3d419a,null));}; \ No newline at end of file +var _0x9c5a=['params','keys','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch'];(function(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2cb411,_0x4f88a2){_0x2cb411=_0x2cb411-0x0;var _0x115d18=_0x9c5a[_0x2cb411];return _0x115d18;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=_0x19a43e[_0xa9c5('0x1b')],_0x4bb57e=_0x40b001['offset'],_0x2b0d73=_0x40b001[_0xa9c5('0x1c')]+_0x40b001[_0xa9c5('0x1d')],_0xd85c32;if(_0x2b0d73>=_0xcf13f2){_0x2b0d73=_0xcf13f2;_0xd85c32=0xc8;}else{_0xd85c32=0xce;}_0x251099[_0xa9c5('0x19')](_0xd85c32);return _0x251099[_0xa9c5('0x1e')](_0xa9c5('0x1f'),_0x4bb57e+'-'+_0x2b0d73+'/'+_0xcf13f2)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x3b8d4d){return function(_0x1e5ce6){try{jsonpatch[_0xa9c5('0x20')](_0x1e5ce6,_0x3b8d4d,!![]);}catch(_0x36c486){return BPromise[_0xa9c5('0x21')](_0x36c486);}return _0x1e5ce6[_0xa9c5('0x22')]();};}function saveUpdates(_0x54f8b9,_0x1115ad){return function(_0x21ab50){if(_0x21ab50){return _0x21ab50['update'](_0x54f8b9)['then'](function(_0xce9af6){return _0xce9af6;});}return null;};}function removeEntity(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')]()[_0xa9c5('0x24')](function(){_0x366f5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4e1b,_0x11d395){return function(_0x4b0f05){if(!_0x4b0f05){_0x3d4e1b[_0xa9c5('0x17')](0x194);}return _0x4b0f05;};}function handleError(_0x424b4c,_0x306c9b){_0x306c9b=_0x306c9b||0x1f4;return function(_0x32fc7d){logger[_0xa9c5('0x25')](_0x32fc7d[_0xa9c5('0x26')]);if(_0x32fc7d[_0xa9c5('0x27')]){delete _0x32fc7d['name'];}_0x424b4c['status'](_0x306c9b)[_0xa9c5('0x28')](_0x32fc7d);};}exports['index']=function(_0x1762ac,_0x830bad){var _0x4caefa={},_0x11a723={},_0x320dc0={'count':0x0,'rows':[]};var _0x5f468b=_[_0xa9c5('0x29')](db[_0xa9c5('0x2a')][_0xa9c5('0x2b')],function(_0x185eb8){return{'name':_0x185eb8[_0xa9c5('0x2c')],'type':_0x185eb8['type'][_0xa9c5('0x2d')]};});_0x11a723['model']=_[_0xa9c5('0x29')](_0x5f468b,_0xa9c5('0x27'));_0x11a723[_0xa9c5('0x2e')]=_['keys'](_0x1762ac[_0xa9c5('0x2e')]);_0x11a723[_0xa9c5('0x2f')]=_['intersection'](_0x11a723[_0xa9c5('0x30')],_0x11a723[_0xa9c5('0x2e')]);_0x4caefa[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x11a723[_0xa9c5('0x30')],qs[_0xa9c5('0x33')](_0x1762ac[_0xa9c5('0x2e')]['fields']));_0x4caefa[_0xa9c5('0x31')]=_0x4caefa[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x4caefa[_0xa9c5('0x31')]:_0x11a723[_0xa9c5('0x30')];if(!_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x4caefa['limit']=qs['limit'](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1d')]);_0x4caefa[_0xa9c5('0x1c')]=qs[_0xa9c5('0x1c')](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1c')]);}_0x4caefa['order']=qs['sort'](_0x1762ac['query'][_0xa9c5('0x37')]);_0x4caefa[_0xa9c5('0x38')]=qs['filters'](_[_0xa9c5('0x39')](_0x1762ac['query'],_0x11a723[_0xa9c5('0x2f')]),_0x5f468b);if(_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x4caefa[_0xa9c5('0x38')]=_['merge'](_0x4caefa[_0xa9c5('0x38')],{'$or':_[_0xa9c5('0x29')](_0x5f468b,function(_0x191153){if(_0x191153[_0xa9c5('0x3b')]!==_0xa9c5('0x3c')){var _0x17ef8e={};_0x17ef8e[_0x191153[_0xa9c5('0x27')]]={'$like':'%'+_0x1762ac[_0xa9c5('0x2e')]['filter']+'%'};return _0x17ef8e;}})});}_0x4caefa=_[_0xa9c5('0x3d')]({},_0x4caefa,_0x1762ac[_0xa9c5('0x3e')]);var _0x841c18={'where':_0x4caefa[_0xa9c5('0x38')]};return db[_0xa9c5('0x2a')][_0xa9c5('0x1b')](_0x841c18)['then'](function(_0x307736){_0x320dc0['count']=_0x307736;if(_0x1762ac[_0xa9c5('0x2e')]['includeAll']){_0x4caefa[_0xa9c5('0x3f')]=[{'all':!![]}];}return db[_0xa9c5('0x2a')][_0xa9c5('0x40')](_0x4caefa);})['then'](function(_0x12e19c){_0x320dc0[_0xa9c5('0x41')]=_0x12e19c;return _0x320dc0;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x830bad,_0x4caefa))[_0xa9c5('0x42')](handleError(_0x830bad,null));};exports['show']=function(_0x2dbb48,_0x97803f){var _0x3db918={'raw':![],'where':{'id':_0x2dbb48[_0xa9c5('0x43')]['id']}},_0x45668e={};_0x45668e['model']=_[_0xa9c5('0x44')](db['UserProfileResource'][_0xa9c5('0x2b')]);_0x45668e[_0xa9c5('0x2e')]=_[_0xa9c5('0x44')](_0x2dbb48[_0xa9c5('0x2e')]);_0x45668e[_0xa9c5('0x2f')]=_[_0xa9c5('0x32')](_0x45668e[_0xa9c5('0x30')],_0x45668e[_0xa9c5('0x2e')]);_0x3db918[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x45668e['model'],qs[_0xa9c5('0x33')](_0x2dbb48[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x3db918[_0xa9c5('0x31')]=_0x3db918[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x3db918['attributes']:_0x45668e[_0xa9c5('0x30')];if(_0x2dbb48[_0xa9c5('0x2e')]['includeAll']){_0x3db918['include']=[{'all':!![]}];}_0x3db918=_['merge']({},_0x3db918,_0x2dbb48['options']);return db['UserProfileResource'][_0xa9c5('0x45')](_0x3db918)[_0xa9c5('0x24')](handleEntityNotFound(_0x97803f,null))[_0xa9c5('0x24')](respondWithResult(_0x97803f,null))[_0xa9c5('0x42')](handleError(_0x97803f,null));};exports[_0xa9c5('0x46')]=function(_0x240c40,_0xec9c4){return db[_0xa9c5('0x2a')][_0xa9c5('0x46')](_0x240c40[_0xa9c5('0x47')],{})[_0xa9c5('0x24')](respondWithResult(_0xec9c4,0xc9))[_0xa9c5('0x42')](handleError(_0xec9c4,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){if(_0x4bf8b4['body']['id']){delete _0x4bf8b4[_0xa9c5('0x47')]['id'];}return db[_0xa9c5('0x2a')]['find']({'where':{'id':_0x4bf8b4['params']['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x1108f0,null))[_0xa9c5('0x24')](saveUpdates(_0x4bf8b4[_0xa9c5('0x47')],null))['then'](respondWithResult(_0x1108f0,null))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0xd03cec,_0x481f9c){return db[_0xa9c5('0x2a')][_0xa9c5('0x45')]({'where':{'id':_0xd03cec[_0xa9c5('0x43')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x481f9c,null))[_0xa9c5('0x24')](removeEntity(_0x481f9c,null))[_0xa9c5('0x42')](handleError(_0x481f9c,null));};exports['describe']=function(_0x4cd8e4,_0x54c60c){return db[_0xa9c5('0x2a')][_0xa9c5('0x49')]()[_0xa9c5('0x24')](respondWithResult(_0x54c60c,null))[_0xa9c5('0x42')](handleError(_0x54c60c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 449cb4a..e3e0ab1 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 _0x0fd4=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x2f2ecf,_0x367dd6){var _0x568cf6=function(_0x3c4601){while(--_0x3c4601){_0x2f2ecf['push'](_0x2f2ecf['shift']());}};_0x568cf6(++_0x367dd6);}(_0x0fd4,0x193));var _0x40fd=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0x0fd4[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0x40fd('0x0'));var util=require(_0x40fd('0x1'));var logger=require(_0x40fd('0x2'))('api');var moment=require(_0x40fd('0x3'));var BPromise=require(_0x40fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40fd('0x5'));var rimraf=require('rimraf');var config=require(_0x40fd('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x40fd('0x7')]=function(_0x520d3c,_0x172d0f){return _0x520d3c['define'](_0x40fd('0x8'),attributes,{'tableName':_0x40fd('0x9'),'paranoid':![],'indexes':[{'name':_0x40fd('0xa'),'fields':[_0x40fd('0xb'),_0x40fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e2=['bluebird','request-promise','path','../../config/environment','exports','define','compositeIndex','sectionId','util','api','moment'];(function(_0x3ef201,_0x8a2dbc){var _0x4337ff=function(_0x417877){while(--_0x417877){_0x3ef201['push'](_0x3ef201['shift']());}};_0x4337ff(++_0x8a2dbc);}(_0xc1e2,0x1aa));var _0x2c1e=function(_0x240745,_0x28a86d){_0x240745=_0x240745-0x0;var _0x1582fb=_0xc1e2[_0x240745];return _0x1582fb;};'use strict';var _=require('lodash');var util=require(_0x2c1e('0x0'));var logger=require('../../config/logger')(_0x2c1e('0x1'));var moment=require(_0x2c1e('0x2'));var BPromise=require(_0x2c1e('0x3'));var rp=require(_0x2c1e('0x4'));var fs=require('fs');var path=require(_0x2c1e('0x5'));var rimraf=require('rimraf');var config=require(_0x2c1e('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x2c1e('0x7')]=function(_0x2e5b3e,_0x3a4a9f){return _0x2e5b3e[_0x2c1e('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2c1e('0x9'),'fields':['resourceId',_0x2c1e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 40d23f0..306b2c1 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 _0xd0d3=['code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cec45,_0x37d817){var _0x51d691=function(_0x2c671f){while(--_0x2c671f){_0x3cec45['push'](_0x3cec45['shift']());}};_0x51d691(++_0x37d817);}(_0xd0d3,0xc3));var _0x3d0d=function(_0x5785fc,_0x434437){_0x5785fc=_0x5785fc-0x0;var _0x59fbf7=_0xd0d3[_0x5785fc];return _0x59fbf7;};'use strict';var _=require(_0x3d0d('0x0'));var util=require(_0x3d0d('0x1'));var moment=require(_0x3d0d('0x2'));var BPromise=require(_0x3d0d('0x3'));var rs=require(_0x3d0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d0d('0x5'));var logger=require(_0x3d0d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d0d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353207,_0x441018,_0x428978){return new BPromise(function(_0x5d4062,_0x3269c8){return client['request'](_0x353207,_0x428978)[_0x3d0d('0x8')](function(_0x906c5f){logger[_0x3d0d('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x441018,_0x3d0d('0xa'));logger['debug'](_0x3d0d('0xb'),_0x441018,_0x3d0d('0xa'),JSON[_0x3d0d('0xc')](_0x906c5f));if(_0x906c5f['error']){if(_0x906c5f[_0x3d0d('0xd')][_0x3d0d('0xe')]===0x1f4){logger['error'](_0x3d0d('0xf'),_0x441018,_0x906c5f[_0x3d0d('0xd')][_0x3d0d('0x10')]);return _0x3269c8(_0x906c5f[_0x3d0d('0xd')]['message']);}logger[_0x3d0d('0xd')](_0x3d0d('0xf'),_0x441018,_0x906c5f[_0x3d0d('0xd')][_0x3d0d('0x10')]);return _0x5d4062(_0x906c5f[_0x3d0d('0xd')]['message']);}else{logger[_0x3d0d('0x9')](_0x3d0d('0xf'),_0x441018,_0x3d0d('0xa'));_0x5d4062(_0x906c5f[_0x3d0d('0x11')]['message']);}})[_0x3d0d('0x12')](function(_0x343572){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x441018,_0x343572);_0x3269c8(_0x343572);});});} \ No newline at end of file +var _0x9d5d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x41f841,_0x4929ef){var _0x3f8bdf=function(_0x179c56){while(--_0x179c56){_0x41f841['push'](_0x41f841['shift']());}};_0x3f8bdf(++_0x4929ef);}(_0x9d5d,0x15c));var _0xd9d5=function(_0x2829ef,_0x552e3d){_0x2829ef=_0x2829ef-0x0;var _0x1a7597=_0x9d5d[_0x2829ef];return _0x1a7597;};'use strict';var _=require(_0xd9d5('0x0'));var util=require(_0xd9d5('0x1'));var moment=require(_0xd9d5('0x2'));var BPromise=require(_0xd9d5('0x3'));var rs=require(_0xd9d5('0x4'));var fs=require('fs');var Redis=require(_0xd9d5('0x5'));var db=require(_0xd9d5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9d5('0x7'))('rpc');var config=require(_0xd9d5('0x8'));var jayson=require(_0xd9d5('0x9'));var client=jayson[_0xd9d5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2492d5,_0xfb0ffb,_0x45db57){return new BPromise(function(_0x1ae95c,_0x2095bc){return client[_0xd9d5('0xb')](_0x2492d5,_0x45db57)[_0xd9d5('0xc')](function(_0x2a2575){logger[_0xd9d5('0xd')](_0xd9d5('0xe'),_0xfb0ffb,_0xd9d5('0xf'));logger['debug'](_0xd9d5('0x10'),_0xfb0ffb,_0xd9d5('0xf'),JSON[_0xd9d5('0x11')](_0x2a2575));if(_0x2a2575[_0xd9d5('0x12')]){if(_0x2a2575[_0xd9d5('0x12')][_0xd9d5('0x13')]===0x1f4){logger['error'](_0xd9d5('0xe'),_0xfb0ffb,_0x2a2575[_0xd9d5('0x12')]['message']);return _0x2095bc(_0x2a2575['error']['message']);}logger[_0xd9d5('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xfb0ffb,_0x2a2575['error'][_0xd9d5('0x14')]);return _0x1ae95c(_0x2a2575[_0xd9d5('0x12')][_0xd9d5('0x14')]);}else{logger[_0xd9d5('0xd')](_0xd9d5('0xe'),_0xfb0ffb,_0xd9d5('0xf'));_0x1ae95c(_0x2a2575[_0xd9d5('0x15')][_0xd9d5('0x14')]);}})[_0xd9d5('0x16')](function(_0x15e3dd){logger[_0xd9d5('0x12')](_0xd9d5('0xe'),_0xfb0ffb,_0x15e3dd);_0x2095bc(_0x15e3dd);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4096e84..90ab3e0 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 _0xc29d=['create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc29d,0x149));var _0xdc29=function(_0x3d74b3,_0x409080){_0x3d74b3=_0x3d74b3-0x0;var _0x2972aa=_0xc29d[_0x3d74b3];return _0x2972aa;};'use strict';var multer=require(_0xdc29('0x0'));var util=require(_0xdc29('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc29('0x2')]();var auth=require(_0xdc29('0x3'));var interaction=require(_0xdc29('0x4'));var config=require(_0xdc29('0x5'));var controller=require(_0xdc29('0x6'));router['get']('/',auth[_0xdc29('0x7')](),controller['index']);router['get'](_0xdc29('0x8'),auth[_0xdc29('0x7')](),controller[_0xdc29('0x9')]);router[_0xdc29('0xa')](_0xdc29('0xb'),auth[_0xdc29('0x7')](),controller[_0xdc29('0xc')]);router['post']('/',auth[_0xdc29('0x7')](),controller[_0xdc29('0xd')]);router[_0xdc29('0xe')](_0xdc29('0xb'),auth[_0xdc29('0x7')](),controller[_0xdc29('0xf')]);router[_0xdc29('0x10')](_0xdc29('0xb'),auth[_0xdc29('0x7')](),controller[_0xdc29('0x11')]);module[_0xdc29('0x12')]=router; \ No newline at end of file +var _0x657f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','path','connect-timeout'];(function(_0x2a1cc2,_0x15fea0){var _0x20f8c4=function(_0x514fb0){while(--_0x514fb0){_0x2a1cc2['push'](_0x2a1cc2['shift']());}};_0x20f8c4(++_0x15fea0);}(_0x657f,0x1d9));var _0xf657=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0x657f[_0x5401ae];return _0x286068;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf657('0x0'));var timeout=require(_0xf657('0x1'));var express=require(_0xf657('0x2'));var router=express['Router']();var auth=require(_0xf657('0x3'));var interaction=require(_0xf657('0x4'));var config=require(_0xf657('0x5'));var controller=require(_0xf657('0x6'));router[_0xf657('0x7')]('/',auth[_0xf657('0x8')](),controller[_0xf657('0x9')]);router[_0xf657('0x7')](_0xf657('0xa'),auth[_0xf657('0x8')](),controller[_0xf657('0xb')]);router[_0xf657('0x7')](_0xf657('0xc'),auth[_0xf657('0x8')](),controller[_0xf657('0xd')]);router[_0xf657('0xe')]('/',auth[_0xf657('0x8')](),controller['create']);router[_0xf657('0xf')](_0xf657('0xc'),auth[_0xf657('0x8')](),controller[_0xf657('0x10')]);router['delete'](_0xf657('0xc'),auth[_0xf657('0x8')](),controller[_0xf657('0x11')]);module[_0xf657('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3776fd1..85b015a 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 _0x1782=['setDataValue','getDataValue','crudPermissions','sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x467002,_0x36be1a){var _0x1c1ed4=function(_0x3fdf3d){while(--_0x3fdf3d){_0x467002['push'](_0x467002['shift']());}};_0x1c1ed4(++_0x36be1a);}(_0x1782,0x13e));var _0x2178=function(_0x4c87fb,_0x4c29a4){_0x4c87fb=_0x4c87fb-0x0;var _0x2c3cc9=_0x1782[_0x4c87fb];return _0x2c3cc9;};'use strict';var Sequelize=require(_0x2178('0x0'));module['exports']={'name':{'type':Sequelize[_0x2178('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2178('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2178('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x2178('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x2178('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x601378){this[_0x2178('0x4')]('crudPermissions',_0x601378?_0x601378['join'](''):[]);},'get':function(){return this[_0x2178('0x5')](_0x2178('0x6'))?this['getDataValue']('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0x5afe=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue'];(function(_0x2ffa8d,_0x216e8a){var _0x4a4403=function(_0x2f62c7){while(--_0x2f62c7){_0x2ffa8d['push'](_0x2ffa8d['shift']());}};_0x4a4403(++_0x216e8a);}(_0x5afe,0x1ab));var _0xe5af=function(_0x3330b8,_0x19b32a){_0x3330b8=_0x3330b8-0x0;var _0x191799=_0x5afe[_0x3330b8];return _0x191799;};'use strict';var Sequelize=require(_0xe5af('0x0'));module[_0xe5af('0x1')]={'name':{'type':Sequelize[_0xe5af('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xe5af('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xe5af('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe5af('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe5af('0x2')],'set':function(_0xda9de7){this[_0xe5af('0x4')](_0xe5af('0x5'),_0xda9de7?_0xda9de7[_0xe5af('0x6')](''):[]);},'get':function(){return this[_0xe5af('0x7')](_0xe5af('0x5'))?this['getDataValue']('crudPermissions')[_0xe5af('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8ed929f..b4e0cb9 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 _0xf5cc=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x2ab5fa,_0x2d9aed){var _0x43d5e4=function(_0x2f0240){while(--_0x2f0240){_0x2ab5fa['push'](_0x2ab5fa['shift']());}};_0x43d5e4(++_0x2d9aed);}(_0xf5cc,0x179));var _0xcf5c=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xf5cc[_0x1a0daa];return _0x1dbe15;};'use strict';var pdf=require(_0xcf5c('0x0'));var emlformat=require(_0xcf5c('0x1'));var rimraf=require(_0xcf5c('0x2'));var zipdir=require(_0xcf5c('0x3'));var jsonpatch=require(_0xcf5c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf5c('0x5'));var Mustache=require(_0xcf5c('0x6'));var util=require(_0xcf5c('0x7'));var path=require('path');var sox=require(_0xcf5c('0x8'));var csv=require(_0xcf5c('0x9'));var ejs=require(_0xcf5c('0xa'));var fs=require('fs');var _=require(_0xcf5c('0xb'));var squel=require(_0xcf5c('0xc'));var crypto=require('crypto');var jsforce=require(_0xcf5c('0xd'));var deskjs=require(_0xcf5c('0xe'));var toCsv=require(_0xcf5c('0x9'));var querystring=require(_0xcf5c('0xf'));var Papa=require(_0xcf5c('0x10'));var Redis=require(_0xcf5c('0x11'));var authService=require(_0xcf5c('0x12'));var qs=require(_0xcf5c('0x13'));var as=require(_0xcf5c('0x14'));var hardwareService=require(_0xcf5c('0x15'));var logger=require(_0xcf5c('0x16'))('api');var utils=require(_0xcf5c('0x17'));var config=require(_0xcf5c('0x18'));var licenseUtil=require(_0xcf5c('0x19'));var db=require(_0xcf5c('0x1a'))['db'];function respondWithStatusCode(_0x221de2,_0x5a819d){_0x5a819d=_0x5a819d||0xcc;return function(_0x39241e){if(_0x39241e){return _0x221de2['sendStatus'](_0x5a819d);}return _0x221de2[_0xcf5c('0x1b')](_0x5a819d)[_0xcf5c('0x1c')]();};}function respondWithResult(_0x1476aa,_0x461bee){_0x461bee=_0x461bee||0xc8;return function(_0x503d85){if(_0x503d85){return _0x1476aa[_0xcf5c('0x1b')](_0x461bee)['json'](_0x503d85);}};}function respondWithFilteredResult(_0x2af593,_0x214192){return function(_0xd3a90c){if(_0xd3a90c){var _0x2b68f8=_0xd3a90c[_0xcf5c('0x1d')],_0x2308fd=_0x214192[_0xcf5c('0x1e')],_0x4775e8=_0x214192['offset']+_0x214192[_0xcf5c('0x1f')],_0x39be6e;if(_0x4775e8>=_0x2b68f8){_0x4775e8=_0x2b68f8;_0x39be6e=0xc8;}else{_0x39be6e=0xce;}_0x2af593[_0xcf5c('0x1b')](_0x39be6e);return _0x2af593[_0xcf5c('0x20')](_0xcf5c('0x21'),_0x2308fd+'-'+_0x4775e8+'/'+_0x2b68f8)['json'](_0xd3a90c);}return null;};}function patchUpdates(_0x59a30a){return function(_0x2815d7){try{jsonpatch[_0xcf5c('0x22')](_0x2815d7,_0x59a30a,!![]);}catch(_0x5926a6){return BPromise[_0xcf5c('0x23')](_0x5926a6);}return _0x2815d7['save']();};}function saveUpdates(_0x43830e,_0x411944){return function(_0x14bf60){if(_0x14bf60){return _0x14bf60[_0xcf5c('0x24')](_0x43830e)['then'](function(_0x319bba){return _0x319bba;});}return null;};}function removeEntity(_0x4192e7,_0x369d1e){return function(_0x4addc2){if(_0x4addc2){return _0x4addc2[_0xcf5c('0x25')]()[_0xcf5c('0x26')](function(){_0x4192e7[_0xcf5c('0x1b')](0xcc)[_0xcf5c('0x1c')]();});}};}function handleEntityNotFound(_0x360313,_0x3b4d24){return function(_0x2fa5fa){if(!_0x2fa5fa){_0x360313[_0xcf5c('0x27')](0x194);}return _0x2fa5fa;};}function handleError(_0x20d830,_0x2ca90b){_0x2ca90b=_0x2ca90b||0x1f4;return function(_0x2ed3be){logger['error'](_0x2ed3be[_0xcf5c('0x28')]);if(_0x2ed3be[_0xcf5c('0x29')]){delete _0x2ed3be[_0xcf5c('0x29')];}_0x20d830[_0xcf5c('0x1b')](_0x2ca90b)[_0xcf5c('0x2a')](_0x2ed3be);};}exports[_0xcf5c('0x2b')]=function(_0x32abc4,_0xaa7785){var _0x5631a0={},_0x549602={},_0x293bff={'count':0x0,'rows':[]};var _0x4e1e8b=_[_0xcf5c('0x2c')](db['UserProfileSection'][_0xcf5c('0x2d')],function(_0x4a62e9){return{'name':_0x4a62e9[_0xcf5c('0x2e')],'type':_0x4a62e9[_0xcf5c('0x2f')][_0xcf5c('0x30')]};});_0x549602[_0xcf5c('0x31')]=_[_0xcf5c('0x2c')](_0x4e1e8b,_0xcf5c('0x29'));_0x549602[_0xcf5c('0x32')]=_['keys'](_0x32abc4[_0xcf5c('0x32')]);_0x549602[_0xcf5c('0x33')]=_[_0xcf5c('0x34')](_0x549602[_0xcf5c('0x31')],_0x549602['query']);_0x5631a0[_0xcf5c('0x35')]=_[_0xcf5c('0x34')](_0x549602['model'],qs['fields'](_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x36')]));_0x5631a0[_0xcf5c('0x35')]=_0x5631a0['attributes'][_0xcf5c('0x37')]?_0x5631a0['attributes']:_0x549602[_0xcf5c('0x31')];if(!_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x38')](_0xcf5c('0x39'))){_0x5631a0[_0xcf5c('0x1f')]=qs[_0xcf5c('0x1f')](_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x1f')]);_0x5631a0[_0xcf5c('0x1e')]=qs[_0xcf5c('0x1e')](_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x1e')]);}_0x5631a0[_0xcf5c('0x3a')]=qs[_0xcf5c('0x3b')](_0x32abc4['query'][_0xcf5c('0x3b')]);_0x5631a0[_0xcf5c('0x3c')]=qs['filters'](_['pick'](_0x32abc4[_0xcf5c('0x32')],_0x549602[_0xcf5c('0x33')]),_0x4e1e8b);if(_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x3d')]){_0x5631a0[_0xcf5c('0x3c')]=_[_0xcf5c('0x3e')](_0x5631a0[_0xcf5c('0x3c')],{'$or':_[_0xcf5c('0x2c')](_0x4e1e8b,function(_0xeaa76d){if(_0xeaa76d[_0xcf5c('0x2f')]!==_0xcf5c('0x3f')){var _0x61051={};_0x61051[_0xeaa76d[_0xcf5c('0x29')]]={'$like':'%'+_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x3d')]+'%'};return _0x61051;}})});}_0x5631a0=_[_0xcf5c('0x3e')]({},_0x5631a0,_0x32abc4[_0xcf5c('0x40')]);var _0x39e303={'where':_0x5631a0[_0xcf5c('0x3c')]};return db[_0xcf5c('0x41')]['count'](_0x39e303)[_0xcf5c('0x26')](function(_0x4bba08){_0x293bff[_0xcf5c('0x1d')]=_0x4bba08;if(_0x32abc4['query'][_0xcf5c('0x42')]){_0x5631a0[_0xcf5c('0x43')]=[{'all':!![]}];}return db['UserProfileSection'][_0xcf5c('0x44')](_0x5631a0);})[_0xcf5c('0x26')](function(_0x37e7ac){_0x293bff[_0xcf5c('0x45')]=_0x37e7ac;return _0x293bff;})[_0xcf5c('0x26')](respondWithFilteredResult(_0xaa7785,_0x5631a0))['catch'](handleError(_0xaa7785,null));};exports[_0xcf5c('0x46')]=function(_0x813ba0,_0x43e54e){var _0x488fab={'raw':![],'where':{'id':_0x813ba0[_0xcf5c('0x47')]['id']}},_0x562120={};_0x562120[_0xcf5c('0x31')]=_[_0xcf5c('0x48')](db[_0xcf5c('0x41')]['rawAttributes']);_0x562120[_0xcf5c('0x32')]=_['keys'](_0x813ba0[_0xcf5c('0x32')]);_0x562120[_0xcf5c('0x33')]=_[_0xcf5c('0x34')](_0x562120['model'],_0x562120[_0xcf5c('0x32')]);_0x488fab['attributes']=_[_0xcf5c('0x34')](_0x562120[_0xcf5c('0x31')],qs[_0xcf5c('0x36')](_0x813ba0[_0xcf5c('0x32')][_0xcf5c('0x36')]));_0x488fab[_0xcf5c('0x35')]=_0x488fab['attributes'][_0xcf5c('0x37')]?_0x488fab[_0xcf5c('0x35')]:_0x562120[_0xcf5c('0x31')];if(_0x813ba0[_0xcf5c('0x32')][_0xcf5c('0x42')]){_0x488fab['include']=[{'all':!![]}];}_0x488fab=_['merge']({},_0x488fab,_0x813ba0['options']);return db[_0xcf5c('0x41')][_0xcf5c('0x49')](_0x488fab)[_0xcf5c('0x26')](handleEntityNotFound(_0x43e54e,null))[_0xcf5c('0x26')](respondWithResult(_0x43e54e,null))[_0xcf5c('0x4a')](handleError(_0x43e54e,null));};exports[_0xcf5c('0x4b')]=function(_0xf307a6,_0x2c3590){return db[_0xcf5c('0x41')][_0xcf5c('0x4b')](_0xf307a6[_0xcf5c('0x4c')],{})[_0xcf5c('0x26')](respondWithResult(_0x2c3590,0xc9))[_0xcf5c('0x4a')](handleError(_0x2c3590,null));};exports[_0xcf5c('0x24')]=function(_0x4907b7,_0x16f28f){if(_0x4907b7[_0xcf5c('0x4c')]['id']){delete _0x4907b7[_0xcf5c('0x4c')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x4907b7['params']['id']}})[_0xcf5c('0x26')](handleEntityNotFound(_0x16f28f,null))[_0xcf5c('0x26')](saveUpdates(_0x4907b7[_0xcf5c('0x4c')],null))[_0xcf5c('0x26')](respondWithResult(_0x16f28f,null))[_0xcf5c('0x4a')](handleError(_0x16f28f,null));};exports['destroy']=function(_0x4733df,_0x3b9cf3){return db['UserProfileSection'][_0xcf5c('0x49')]({'where':{'id':_0x4733df[_0xcf5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b9cf3,null))['then'](removeEntity(_0x3b9cf3,null))[_0xcf5c('0x4a')](handleError(_0x3b9cf3,null));};exports['describe']=function(_0x58662d,_0x29504c){return db[_0xcf5c('0x41')][_0xcf5c('0x4d')]()[_0xcf5c('0x26')](respondWithResult(_0x29504c,null))[_0xcf5c('0x4a')](handleError(_0x29504c,null));}; \ No newline at end of file +var _0xcaa1=['pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','catch','show','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x275266,_0x5288e0){var _0x4a044a=function(_0xa79a37){while(--_0xa79a37){_0x275266['push'](_0x275266['shift']());}};_0x4a044a(++_0x5288e0);}(_0xcaa1,0x13f));var _0x1caa=function(_0x355399,_0x143077){_0x355399=_0x355399-0x0;var _0x378e13=_0xcaa1[_0x355399];return _0x378e13;};'use strict';var pdf=require(_0x1caa('0x0'));var emlformat=require(_0x1caa('0x1'));var rimraf=require(_0x1caa('0x2'));var zipdir=require(_0x1caa('0x3'));var jsonpatch=require(_0x1caa('0x4'));var rp=require(_0x1caa('0x5'));var moment=require(_0x1caa('0x6'));var BPromise=require(_0x1caa('0x7'));var Mustache=require(_0x1caa('0x8'));var util=require(_0x1caa('0x9'));var path=require(_0x1caa('0xa'));var sox=require(_0x1caa('0xb'));var csv=require(_0x1caa('0xc'));var ejs=require(_0x1caa('0xd'));var fs=require('fs');var _=require(_0x1caa('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1caa('0xf'));var deskjs=require(_0x1caa('0x10'));var toCsv=require(_0x1caa('0xc'));var querystring=require(_0x1caa('0x11'));var Papa=require('papaparse');var Redis=require(_0x1caa('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1caa('0x13'))(_0x1caa('0x14'));var utils=require(_0x1caa('0x15'));var config=require(_0x1caa('0x16'));var licenseUtil=require(_0x1caa('0x17'));var db=require(_0x1caa('0x18'))['db'];function respondWithStatusCode(_0x12b582,_0x3380cc){_0x3380cc=_0x3380cc||0xcc;return function(_0x41f976){if(_0x41f976){return _0x12b582[_0x1caa('0x19')](_0x3380cc);}return _0x12b582[_0x1caa('0x1a')](_0x3380cc)[_0x1caa('0x1b')]();};}function respondWithResult(_0x17cc35,_0x38d2c8){_0x38d2c8=_0x38d2c8||0xc8;return function(_0x5fcbe1){if(_0x5fcbe1){return _0x17cc35[_0x1caa('0x1a')](_0x38d2c8)[_0x1caa('0x1c')](_0x5fcbe1);}};}function respondWithFilteredResult(_0x39f5f5,_0x216e74){return function(_0x23e5c8){if(_0x23e5c8){var _0x25cacd=_0x23e5c8[_0x1caa('0x1d')],_0x2a76a8=_0x216e74[_0x1caa('0x1e')],_0x58c088=_0x216e74[_0x1caa('0x1e')]+_0x216e74[_0x1caa('0x1f')],_0x1c96bf;if(_0x58c088>=_0x25cacd){_0x58c088=_0x25cacd;_0x1c96bf=0xc8;}else{_0x1c96bf=0xce;}_0x39f5f5[_0x1caa('0x1a')](_0x1c96bf);return _0x39f5f5[_0x1caa('0x20')](_0x1caa('0x21'),_0x2a76a8+'-'+_0x58c088+'/'+_0x25cacd)['json'](_0x23e5c8);}return null;};}function patchUpdates(_0x4c1b9c){return function(_0x453e52){try{jsonpatch[_0x1caa('0x22')](_0x453e52,_0x4c1b9c,!![]);}catch(_0x41b1c3){return BPromise[_0x1caa('0x23')](_0x41b1c3);}return _0x453e52[_0x1caa('0x24')]();};}function saveUpdates(_0x2bab7c,_0x42e263){return function(_0x1443c8){if(_0x1443c8){return _0x1443c8[_0x1caa('0x25')](_0x2bab7c)[_0x1caa('0x26')](function(_0x55f71f){return _0x55f71f;});}return null;};}function removeEntity(_0x57237c,_0x7c2634){return function(_0x49cf1f){if(_0x49cf1f){return _0x49cf1f[_0x1caa('0x27')]()['then'](function(){_0x57237c[_0x1caa('0x1a')](0xcc)[_0x1caa('0x1b')]();});}};}function handleEntityNotFound(_0x106c7b,_0x320814){return function(_0x222f57){if(!_0x222f57){_0x106c7b['sendStatus'](0x194);}return _0x222f57;};}function handleError(_0x580dac,_0x18aa91){_0x18aa91=_0x18aa91||0x1f4;return function(_0x2e39a0){logger[_0x1caa('0x28')](_0x2e39a0['stack']);if(_0x2e39a0['name']){delete _0x2e39a0[_0x1caa('0x29')];}_0x580dac['status'](_0x18aa91)[_0x1caa('0x2a')](_0x2e39a0);};}exports['index']=function(_0x3d0a57,_0x2358ee){var _0x19ddca={},_0x412d7e={},_0x5065e9={'count':0x0,'rows':[]};var _0xaf0d27=_[_0x1caa('0x2b')](db['UserProfileSection'][_0x1caa('0x2c')],function(_0x374646){return{'name':_0x374646[_0x1caa('0x2d')],'type':_0x374646[_0x1caa('0x2e')][_0x1caa('0x2f')]};});_0x412d7e[_0x1caa('0x30')]=_[_0x1caa('0x2b')](_0xaf0d27,_0x1caa('0x29'));_0x412d7e[_0x1caa('0x31')]=_[_0x1caa('0x32')](_0x3d0a57['query']);_0x412d7e[_0x1caa('0x33')]=_[_0x1caa('0x34')](_0x412d7e[_0x1caa('0x30')],_0x412d7e[_0x1caa('0x31')]);_0x19ddca[_0x1caa('0x35')]=_[_0x1caa('0x34')](_0x412d7e[_0x1caa('0x30')],qs[_0x1caa('0x36')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x36')]));_0x19ddca[_0x1caa('0x35')]=_0x19ddca[_0x1caa('0x35')][_0x1caa('0x37')]?_0x19ddca[_0x1caa('0x35')]:_0x412d7e[_0x1caa('0x30')];if(!_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x38')](_0x1caa('0x39'))){_0x19ddca[_0x1caa('0x1f')]=qs[_0x1caa('0x1f')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x1f')]);_0x19ddca[_0x1caa('0x1e')]=qs[_0x1caa('0x1e')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x1e')]);}_0x19ddca[_0x1caa('0x3a')]=qs[_0x1caa('0x3b')](_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x3b')]);_0x19ddca[_0x1caa('0x3c')]=qs['filters'](_[_0x1caa('0x3d')](_0x3d0a57[_0x1caa('0x31')],_0x412d7e[_0x1caa('0x33')]),_0xaf0d27);if(_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x3e')]){_0x19ddca[_0x1caa('0x3c')]=_[_0x1caa('0x3f')](_0x19ddca['where'],{'$or':_[_0x1caa('0x2b')](_0xaf0d27,function(_0x43794f){if(_0x43794f[_0x1caa('0x2e')]!==_0x1caa('0x40')){var _0x918a84={};_0x918a84[_0x43794f[_0x1caa('0x29')]]={'$like':'%'+_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x3e')]+'%'};return _0x918a84;}})});}_0x19ddca=_[_0x1caa('0x3f')]({},_0x19ddca,_0x3d0a57[_0x1caa('0x41')]);var _0x5edda9={'where':_0x19ddca[_0x1caa('0x3c')]};return db[_0x1caa('0x42')][_0x1caa('0x1d')](_0x5edda9)[_0x1caa('0x26')](function(_0x25eb46){_0x5065e9[_0x1caa('0x1d')]=_0x25eb46;if(_0x3d0a57[_0x1caa('0x31')][_0x1caa('0x43')]){_0x19ddca[_0x1caa('0x44')]=[{'all':!![]}];}return db[_0x1caa('0x42')][_0x1caa('0x45')](_0x19ddca);})['then'](function(_0x383ded){_0x5065e9['rows']=_0x383ded;return _0x5065e9;})[_0x1caa('0x26')](respondWithFilteredResult(_0x2358ee,_0x19ddca))[_0x1caa('0x46')](handleError(_0x2358ee,null));};exports[_0x1caa('0x47')]=function(_0x3f8c51,_0xd87dfc){var _0x4b57b8={'raw':![],'where':{'id':_0x3f8c51['params']['id']}},_0x381af5={};_0x381af5[_0x1caa('0x30')]=_[_0x1caa('0x32')](db[_0x1caa('0x42')][_0x1caa('0x2c')]);_0x381af5['query']=_[_0x1caa('0x32')](_0x3f8c51['query']);_0x381af5[_0x1caa('0x33')]=_[_0x1caa('0x34')](_0x381af5[_0x1caa('0x30')],_0x381af5[_0x1caa('0x31')]);_0x4b57b8[_0x1caa('0x35')]=_[_0x1caa('0x34')](_0x381af5[_0x1caa('0x30')],qs['fields'](_0x3f8c51[_0x1caa('0x31')][_0x1caa('0x36')]));_0x4b57b8[_0x1caa('0x35')]=_0x4b57b8[_0x1caa('0x35')]['length']?_0x4b57b8[_0x1caa('0x35')]:_0x381af5[_0x1caa('0x30')];if(_0x3f8c51[_0x1caa('0x31')][_0x1caa('0x43')]){_0x4b57b8['include']=[{'all':!![]}];}_0x4b57b8=_[_0x1caa('0x3f')]({},_0x4b57b8,_0x3f8c51[_0x1caa('0x41')]);return db[_0x1caa('0x42')][_0x1caa('0x48')](_0x4b57b8)[_0x1caa('0x26')](handleEntityNotFound(_0xd87dfc,null))['then'](respondWithResult(_0xd87dfc,null))[_0x1caa('0x46')](handleError(_0xd87dfc,null));};exports['create']=function(_0x354e5b,_0x6a4a77){return db[_0x1caa('0x42')]['create'](_0x354e5b[_0x1caa('0x49')],{})['then'](respondWithResult(_0x6a4a77,0xc9))[_0x1caa('0x46')](handleError(_0x6a4a77,null));};exports['update']=function(_0x599ec1,_0x231ecd){if(_0x599ec1[_0x1caa('0x49')]['id']){delete _0x599ec1[_0x1caa('0x49')]['id'];}return db[_0x1caa('0x42')][_0x1caa('0x48')]({'where':{'id':_0x599ec1[_0x1caa('0x4a')]['id']}})[_0x1caa('0x26')](handleEntityNotFound(_0x231ecd,null))[_0x1caa('0x26')](saveUpdates(_0x599ec1[_0x1caa('0x49')],null))[_0x1caa('0x26')](respondWithResult(_0x231ecd,null))[_0x1caa('0x46')](handleError(_0x231ecd,null));};exports[_0x1caa('0x27')]=function(_0x382fa7,_0x35f7e8){return db['UserProfileSection'][_0x1caa('0x48')]({'where':{'id':_0x382fa7[_0x1caa('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35f7e8,null))[_0x1caa('0x26')](removeEntity(_0x35f7e8,null))[_0x1caa('0x46')](handleError(_0x35f7e8,null));};exports[_0x1caa('0x4b')]=function(_0x2fb825,_0x201e35){return db['UserProfileSection']['describe']()[_0x1caa('0x26')](respondWithResult(_0x201e35,null))[_0x1caa('0x46')](handleError(_0x201e35,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 558c6ed..671d98c 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 _0xa470=['api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','util','../../config/logger'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xa470,0xe8));var _0x0a47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa470[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0a47('0x0'));var logger=require(_0x0a47('0x1'))(_0x0a47('0x2'));var moment=require(_0x0a47('0x3'));var BPromise=require(_0x0a47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a47('0x5'));var rimraf=require(_0x0a47('0x6'));var config=require(_0x0a47('0x7'));var attributes=require(_0x0a47('0x8'));module[_0x0a47('0x9')]=function(_0xa32a76,_0x2eaa25){return _0xa32a76[_0x0a47('0xa')]('UserProfileSection',attributes,{'tableName':_0x0a47('0xb'),'paranoid':![],'indexes':[{'name':_0x0a47('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x61d7=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0x52d61b,_0x430fb9){var _0x31b5f7=function(_0x3a7164){while(--_0x3a7164){_0x52d61b['push'](_0x52d61b['shift']());}};_0x31b5f7(++_0x430fb9);}(_0x61d7,0xef));var _0x761d=function(_0x17b2cd,_0x543996){_0x17b2cd=_0x17b2cd-0x0;var _0x539069=_0x61d7[_0x17b2cd];return _0x539069;};'use strict';var _=require(_0x761d('0x0'));var util=require('util');var logger=require(_0x761d('0x1'))(_0x761d('0x2'));var moment=require('moment');var BPromise=require(_0x761d('0x3'));var rp=require(_0x761d('0x4'));var fs=require('fs');var path=require(_0x761d('0x5'));var rimraf=require(_0x761d('0x6'));var config=require('../../config/environment');var attributes=require(_0x761d('0x7'));module[_0x761d('0x8')]=function(_0x17c295,_0x13e509){return _0x17c295['define']('UserProfileSection',attributes,{'tableName':_0x761d('0x9'),'paranoid':![],'indexes':[{'name':_0x761d('0xa'),'fields':[_0x761d('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ce056e7..0324707 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 _0x1a4f=['UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x3029ec,_0x3b3337){var _0x2ecf1b=function(_0x32ec31){while(--_0x32ec31){_0x3029ec['push'](_0x3029ec['shift']());}};_0x2ecf1b(++_0x3b3337);}(_0x1a4f,0x184));var _0xf1a4=function(_0x295833,_0x345a8d){_0x295833=_0x295833-0x0;var _0x17724d=_0x1a4f[_0x295833];return _0x17724d;};'use strict';var _=require('lodash');var util=require(_0xf1a4('0x0'));var moment=require('moment');var BPromise=require(_0xf1a4('0x1'));var rs=require(_0xf1a4('0x2'));var fs=require('fs');var Redis=require(_0xf1a4('0x3'));var db=require(_0xf1a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1a4('0x5'))(_0xf1a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xf1a4('0x7'));var client=jayson[_0xf1a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32214d,_0x1573b0,_0x382fbe){return new BPromise(function(_0x4041f9,_0x1ef7b9){return client[_0xf1a4('0x9')](_0x32214d,_0x382fbe)[_0xf1a4('0xa')](function(_0x3899fb){logger['info'](_0xf1a4('0xb'),_0x1573b0,_0xf1a4('0xc'));logger[_0xf1a4('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1573b0,_0xf1a4('0xc'),JSON[_0xf1a4('0xe')](_0x3899fb));if(_0x3899fb['error']){if(_0x3899fb[_0xf1a4('0xf')][_0xf1a4('0x10')]===0x1f4){logger[_0xf1a4('0xf')](_0xf1a4('0xb'),_0x1573b0,_0x3899fb['error'][_0xf1a4('0x11')]);return _0x1ef7b9(_0x3899fb[_0xf1a4('0xf')][_0xf1a4('0x11')]);}logger[_0xf1a4('0xf')](_0xf1a4('0xb'),_0x1573b0,_0x3899fb[_0xf1a4('0xf')][_0xf1a4('0x11')]);return _0x4041f9(_0x3899fb[_0xf1a4('0xf')]['message']);}else{logger[_0xf1a4('0x12')](_0xf1a4('0xb'),_0x1573b0,'request\x20sent');_0x4041f9(_0x3899fb[_0xf1a4('0x13')][_0xf1a4('0x11')]);}})[_0xf1a4('0x14')](function(_0x34d3da){logger[_0xf1a4('0xf')](_0xf1a4('0xb'),_0x1573b0,_0x34d3da);_0x1ef7b9(_0x34d3da);});});} \ No newline at end of file +var _0x6f76=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x55ac35,_0xe3de64){var _0x149f53=function(_0x458866){while(--_0x458866){_0x55ac35['push'](_0x55ac35['shift']());}};_0x149f53(++_0xe3de64);}(_0x6f76,0x14a));var _0x66f7=function(_0x326902,_0x31c562){_0x326902=_0x326902-0x0;var _0x3ec109=_0x6f76[_0x326902];return _0x3ec109;};'use strict';var _=require(_0x66f7('0x0'));var util=require('util');var moment=require(_0x66f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x66f7('0x2'));var fs=require('fs');var Redis=require(_0x66f7('0x3'));var db=require(_0x66f7('0x4'))['db'];var utils=require(_0x66f7('0x5'));var logger=require(_0x66f7('0x6'))('rpc');var config=require(_0x66f7('0x7'));var jayson=require(_0x66f7('0x8'));var client=jayson[_0x66f7('0x9')][_0x66f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c32a,_0x34d73f,_0x34cdb5){return new BPromise(function(_0x4cbf9d,_0x5693f5){return client['request'](_0x7c32a,_0x34cdb5)[_0x66f7('0xb')](function(_0x3e30a9){logger[_0x66f7('0xc')](_0x66f7('0xd'),_0x34d73f,_0x66f7('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x34d73f,_0x66f7('0xe'),JSON[_0x66f7('0xf')](_0x3e30a9));if(_0x3e30a9['error']){if(_0x3e30a9[_0x66f7('0x10')][_0x66f7('0x11')]===0x1f4){logger[_0x66f7('0x10')](_0x66f7('0xd'),_0x34d73f,_0x3e30a9[_0x66f7('0x10')]['message']);return _0x5693f5(_0x3e30a9[_0x66f7('0x10')][_0x66f7('0x12')]);}logger['error'](_0x66f7('0xd'),_0x34d73f,_0x3e30a9[_0x66f7('0x10')][_0x66f7('0x12')]);return _0x4cbf9d(_0x3e30a9[_0x66f7('0x10')]['message']);}else{logger['info'](_0x66f7('0xd'),_0x34d73f,'request\x20sent');_0x4cbf9d(_0x3e30a9[_0x66f7('0x13')]['message']);}})[_0x66f7('0x14')](function(_0x444f9f){logger[_0x66f7('0x10')](_0x66f7('0xd'),_0x34d73f,_0x444f9f);_0x5693f5(_0x444f9f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 361dc88..09ef26a 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 _0x1e1d=['path','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0x1e1d,0x8e));var _0xd1e1=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1e1d[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xd1e1('0x0'));var util=require(_0xd1e1('0x1'));var path=require(_0xd1e1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1e1('0x3'));var router=express[_0xd1e1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd1e1('0x5'));var config=require(_0xd1e1('0x6'));module[_0xd1e1('0x7')]=router; \ No newline at end of file +var _0x2a40=['multer','util','path','connect-timeout','express','exports'];(function(_0x432169,_0x7ffbe9){var _0x28e745=function(_0x810c68){while(--_0x810c68){_0x432169['push'](_0x432169['shift']());}};_0x28e745(++_0x7ffbe9);}(_0x2a40,0x14a));var _0x02a4=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x2a40[_0x3c22e0];return _0x215811;};'use strict';var multer=require(_0x02a4('0x0'));var util=require(_0x02a4('0x1'));var path=require(_0x02a4('0x2'));var timeout=require(_0x02a4('0x3'));var express=require(_0x02a4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x02a4('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5403669..69c324c 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x1d8a5d,_0x59a110){var _0x54d59f=function(_0x54ce10){while(--_0x54ce10){_0x1d8a5d['push'](_0x1d8a5d['shift']());}};_0x54d59f(++_0x59a110);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 4ab439a..9471312 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 _0x58fd=['exports','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x23707a,_0x4c5296){var _0x3eeea8=function(_0x1018c3){while(--_0x1018c3){_0x23707a['push'](_0x23707a['shift']());}};_0x3eeea8(++_0x4c5296);}(_0x58fd,0xd3));var _0xd58f=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x58fd[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0xd58f('0x0'));var util=require(_0xd58f('0x1'));var logger=require(_0xd58f('0x2'))(_0xd58f('0x3'));var moment=require('moment');var BPromise=require(_0xd58f('0x4'));var rp=require(_0xd58f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd58f('0x6'));var config=require(_0xd58f('0x7'));var attributes=require(_0xd58f('0x8'));module[_0xd58f('0x9')]=function(_0x197e77,_0x51cefe){return _0x197e77['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cd0=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1cd0,0x100));var _0x01cd=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x1cd0[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x01cd('0x0'));var util=require(_0x01cd('0x1'));var logger=require(_0x01cd('0x2'))('api');var moment=require(_0x01cd('0x3'));var BPromise=require(_0x01cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01cd('0x5'));var rimraf=require(_0x01cd('0x6'));var config=require(_0x01cd('0x7'));var attributes=require(_0x01cd('0x8'));module[_0x01cd('0x9')]=function(_0x5717b3,_0x57ee49){return _0x5717b3['define'](_0x01cd('0xa'),attributes,{'tableName':_0x01cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index fdb62ac..77a832e 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 _0x8e40=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0xb4ec3a,_0x2bace0){var _0x1b83db=function(_0x5278f3){while(--_0x5278f3){_0xb4ec3a['push'](_0xb4ec3a['shift']());}};_0x1b83db(++_0x2bace0);}(_0x8e40,0x163));var _0x08e4=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x8e40[_0x56138f];return _0x1acaf7;};'use strict';var _=require(_0x08e4('0x0'));var util=require(_0x08e4('0x1'));var moment=require(_0x08e4('0x2'));var BPromise=require(_0x08e4('0x3'));var rs=require(_0x08e4('0x4'));var fs=require('fs');var Redis=require(_0x08e4('0x5'));var db=require(_0x08e4('0x6'))['db'];var utils=require(_0x08e4('0x7'));var logger=require(_0x08e4('0x8'))(_0x08e4('0x9'));var config=require(_0x08e4('0xa'));var jayson=require(_0x08e4('0xb'));var client=jayson[_0x08e4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38f5f3,_0x2d159e,_0x34316d){return new BPromise(function(_0xf77b2f,_0x38c757){return client[_0x08e4('0xd')](_0x38f5f3,_0x34316d)[_0x08e4('0xe')](function(_0x175fcf){logger[_0x08e4('0xf')](_0x08e4('0x10'),_0x2d159e,'request\x20sent');logger[_0x08e4('0x11')](_0x08e4('0x12'),_0x2d159e,'request\x20sent',JSON['stringify'](_0x175fcf));if(_0x175fcf[_0x08e4('0x13')]){if(_0x175fcf['error'][_0x08e4('0x14')]===0x1f4){logger['error'](_0x08e4('0x10'),_0x2d159e,_0x175fcf[_0x08e4('0x13')]['message']);return _0x38c757(_0x175fcf['error'][_0x08e4('0x15')]);}logger[_0x08e4('0x13')](_0x08e4('0x10'),_0x2d159e,_0x175fcf[_0x08e4('0x13')][_0x08e4('0x15')]);return _0xf77b2f(_0x175fcf[_0x08e4('0x13')][_0x08e4('0x15')]);}else{logger['info'](_0x08e4('0x10'),_0x2d159e,_0x08e4('0x16'));_0xf77b2f(_0x175fcf[_0x08e4('0x17')][_0x08e4('0x15')]);}})[_0x08e4('0x18')](function(_0x36c7b4){logger[_0x08e4('0x13')](_0x08e4('0x10'),_0x2d159e,_0x36c7b4);_0x38c757(_0x36c7b4);});});} \ No newline at end of file +var _0xe220=['../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4aeb08,_0x3096ab){var _0x22c98d=function(_0x40c75b){while(--_0x40c75b){_0x4aeb08['push'](_0x4aeb08['shift']());}};_0x22c98d(++_0x3096ab);}(_0xe220,0x19a));var _0x0e22=function(_0x401779,_0x4ebb68){_0x401779=_0x401779-0x0;var _0x5e28e4=_0xe220[_0x401779];return _0x5e28e4;};'use strict';var _=require(_0x0e22('0x0'));var util=require('util');var moment=require(_0x0e22('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e22('0x2'));var fs=require('fs');var Redis=require(_0x0e22('0x3'));var db=require(_0x0e22('0x4'))['db'];var utils=require(_0x0e22('0x5'));var logger=require(_0x0e22('0x6'))(_0x0e22('0x7'));var config=require(_0x0e22('0x8'));var jayson=require(_0x0e22('0x9'));var client=jayson['client'][_0x0e22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e4a25,_0x2baafe,_0x4a236b){return new BPromise(function(_0x260256,_0x18b83a){return client[_0x0e22('0xb')](_0x1e4a25,_0x4a236b)[_0x0e22('0xc')](function(_0x9c4417){logger[_0x0e22('0xd')](_0x0e22('0xe'),_0x2baafe,_0x0e22('0xf'));logger[_0x0e22('0x10')](_0x0e22('0x11'),_0x2baafe,_0x0e22('0xf'),JSON[_0x0e22('0x12')](_0x9c4417));if(_0x9c4417['error']){if(_0x9c4417[_0x0e22('0x13')][_0x0e22('0x14')]===0x1f4){logger[_0x0e22('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2baafe,_0x9c4417['error'][_0x0e22('0x15')]);return _0x18b83a(_0x9c4417['error'][_0x0e22('0x15')]);}logger[_0x0e22('0x13')](_0x0e22('0xe'),_0x2baafe,_0x9c4417['error'][_0x0e22('0x15')]);return _0x260256(_0x9c4417[_0x0e22('0x13')]['message']);}else{logger[_0x0e22('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x2baafe,'request\x20sent');_0x260256(_0x9c4417['result']['message']);}})['catch'](function(_0x5975fb){logger[_0x0e22('0x13')](_0x0e22('0xe'),_0x2baafe,_0x5975fb);_0x18b83a(_0x5975fb);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9551a1d..16b4714 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 _0xb306=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb306,0x12e));var _0x6b30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb306[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6b30('0x0'));var util=require('util');var path=require(_0x6b30('0x1'));var timeout=require(_0x6b30('0x2'));var express=require(_0x6b30('0x3'));var router=express[_0x6b30('0x4')]();var auth=require(_0x6b30('0x5'));var interaction=require(_0x6b30('0x6'));var config=require(_0x6b30('0x7'));module['exports']=router; \ No newline at end of file +var _0xc501=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0xc501,0x9d));var _0x1c50=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0xc501[_0x587693];return _0x510a1a;};'use strict';var multer=require(_0x1c50('0x0'));var util=require(_0x1c50('0x1'));var path=require(_0x1c50('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c50('0x3'));var router=express[_0x1c50('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1c50('0x5'));var config=require(_0x1c50('0x6'));module[_0x1c50('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4731535..60fe6d5 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x23b1d5,_0x3043fa){var _0x3f5702=function(_0xc9b7eb){while(--_0xc9b7eb){_0x23b1d5['push'](_0x23b1d5['shift']());}};_0x3f5702(++_0x3043fa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0xe7d655,_0x184955){var _0x3e4804=function(_0x5cebfb){while(--_0x5cebfb){_0xe7d655['push'](_0xe7d655['shift']());}};_0x3e4804(++_0x184955);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 96a0b8e..0ecfc2c 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 _0x55ca=['./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x55ca,0x126));var _0xa55c=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x55ca[_0x378891];return _0xfbfda2;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9a19,0x114));var _0x99a1=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x9a19[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2b48bdf..f5b5e58 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 _0xf703=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','code','error','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x588453,_0x37f0fc){var _0x40bad8=function(_0x4462ff){while(--_0x4462ff){_0x588453['push'](_0x588453['shift']());}};_0x40bad8(++_0x37f0fc);}(_0xf703,0xf9));var _0x3f70=function(_0x2e13ca,_0x502bb8){_0x2e13ca=_0x2e13ca-0x0;var _0x4763be=_0xf703[_0x2e13ca];return _0x4763be;};'use strict';var _=require(_0x3f70('0x0'));var util=require(_0x3f70('0x1'));var moment=require(_0x3f70('0x2'));var BPromise=require(_0x3f70('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f70('0x4'));var db=require(_0x3f70('0x5'))['db'];var utils=require(_0x3f70('0x6'));var logger=require(_0x3f70('0x7'))(_0x3f70('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f70('0x9'));var client=jayson[_0x3f70('0xa')][_0x3f70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a0ab,_0x4841af,_0x322294){return new BPromise(function(_0x3e25a6,_0x469003){return client[_0x3f70('0xc')](_0x44a0ab,_0x322294)['then'](function(_0x1f3e47){logger[_0x3f70('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4841af,_0x3f70('0xe'));logger['debug'](_0x3f70('0xf'),_0x4841af,_0x3f70('0xe'),JSON['stringify'](_0x1f3e47));if(_0x1f3e47['error']){if(_0x1f3e47['error'][_0x3f70('0x10')]===0x1f4){logger[_0x3f70('0x11')](_0x3f70('0x12'),_0x4841af,_0x1f3e47[_0x3f70('0x11')][_0x3f70('0x13')]);return _0x469003(_0x1f3e47[_0x3f70('0x11')][_0x3f70('0x13')]);}logger['error'](_0x3f70('0x12'),_0x4841af,_0x1f3e47[_0x3f70('0x11')][_0x3f70('0x13')]);return _0x3e25a6(_0x1f3e47[_0x3f70('0x11')]['message']);}else{logger[_0x3f70('0xd')](_0x3f70('0x12'),_0x4841af,_0x3f70('0xe'));_0x3e25a6(_0x1f3e47['result'][_0x3f70('0x13')]);}})[_0x3f70('0x14')](function(_0x1688c4){logger[_0x3f70('0x11')](_0x3f70('0x12'),_0x4841af,_0x1688c4);_0x469003(_0x1688c4);});});} \ No newline at end of file +var _0xb9df=['info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0xb9df,0x7e));var _0xfb9d=function(_0x38aa7e,_0x285604){_0x38aa7e=_0x38aa7e-0x0;var _0x5dc22a=_0xb9df[_0x38aa7e];return _0x5dc22a;};'use strict';var _=require(_0xfb9d('0x0'));var util=require(_0xfb9d('0x1'));var moment=require(_0xfb9d('0x2'));var BPromise=require(_0xfb9d('0x3'));var rs=require(_0xfb9d('0x4'));var fs=require('fs');var Redis=require(_0xfb9d('0x5'));var db=require(_0xfb9d('0x6'))['db'];var utils=require(_0xfb9d('0x7'));var logger=require(_0xfb9d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfb9d('0x9'));var client=jayson[_0xfb9d('0xa')][_0xfb9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5effa6,_0x2807bd,_0x30db38){return new BPromise(function(_0x117c96,_0x4bf30d){return client['request'](_0x5effa6,_0x30db38)['then'](function(_0x24d039){logger[_0xfb9d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2807bd,_0xfb9d('0xd'));logger[_0xfb9d('0xe')](_0xfb9d('0xf'),_0x2807bd,_0xfb9d('0xd'),JSON[_0xfb9d('0x10')](_0x24d039));if(_0x24d039['error']){if(_0x24d039[_0xfb9d('0x11')][_0xfb9d('0x12')]===0x1f4){logger[_0xfb9d('0x11')](_0xfb9d('0x13'),_0x2807bd,_0x24d039['error'][_0xfb9d('0x14')]);return _0x4bf30d(_0x24d039[_0xfb9d('0x11')][_0xfb9d('0x14')]);}logger['error'](_0xfb9d('0x13'),_0x2807bd,_0x24d039['error'][_0xfb9d('0x14')]);return _0x117c96(_0x24d039[_0xfb9d('0x11')][_0xfb9d('0x14')]);}else{logger[_0xfb9d('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2807bd,_0xfb9d('0xd'));_0x117c96(_0x24d039[_0xfb9d('0x15')][_0xfb9d('0x14')]);}})[_0xfb9d('0x16')](function(_0x71ad65){logger[_0xfb9d('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x2807bd,_0x71ad65);_0x4bf30d(_0x71ad65);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 76abc79..da42269 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 _0xaad2=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x349af1,_0x4b5174){var _0x5c4a60=function(_0x279384){while(--_0x279384){_0x349af1['push'](_0x349af1['shift']());}};_0x5c4a60(++_0x4b5174);}(_0xaad2,0xc4));var _0x2aad=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xaad2[_0x438685];return _0x41cca2;};'use strict';var multer=require(_0x2aad('0x0'));var util=require('util');var path=require(_0x2aad('0x1'));var timeout=require(_0x2aad('0x2'));var express=require(_0x2aad('0x3'));var router=express[_0x2aad('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2aad('0x5'));var config=require(_0x2aad('0x6'));module['exports']=router; \ No newline at end of file +var _0x833e=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x3bcf7b,_0x2c0854){var _0x5ac4ea=function(_0x4d713a){while(--_0x4d713a){_0x3bcf7b['push'](_0x3bcf7b['shift']());}};_0x5ac4ea(++_0x2c0854);}(_0x833e,0x189));var _0xe833=function(_0x1e08cb,_0x50f0bf){_0x1e08cb=_0x1e08cb-0x0;var _0x5abcd5=_0x833e[_0x1e08cb];return _0x5abcd5;};'use strict';var multer=require(_0xe833('0x0'));var util=require(_0xe833('0x1'));var path=require(_0xe833('0x2'));var timeout=require(_0xe833('0x3'));var express=require(_0xe833('0x4'));var router=express[_0xe833('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe833('0x6'));var config=require(_0xe833('0x7'));module[_0xe833('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6a797ed..f6d1f8d 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 _0x7df1=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3ea4f8,_0x11271f){var _0xf214c0=function(_0x54aa4c){while(--_0x54aa4c){_0x3ea4f8['push'](_0x3ea4f8['shift']());}};_0xf214c0(++_0x11271f);}(_0x7df1,0x1b8));var _0x17df=function(_0x58eb97,_0x1c3545){_0x58eb97=_0x58eb97-0x0;var _0x5d45f0=_0x7df1[_0x58eb97];return _0x5d45f0;};'use strict';var Sequelize=require(_0x17df('0x0'));module[_0x17df('0x1')]={'uniqueid':{'type':Sequelize[_0x17df('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x17df('0x3')},'membername':{'type':Sequelize[_0x17df('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x17df('0x4')],'allowNull':![],'unique':_0x17df('0x5'),'comment':_0x17df('0x3')},'VoiceQueueId':{'type':Sequelize[_0x17df('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x17df('0x4')],'allowNull':![],'unique':_0x17df('0x5'),'comment':_0x17df('0x3')},'penalty':{'type':Sequelize[_0x17df('0x2')](0xb),'defaultValue':0x0,'comment':_0x17df('0x3')},'paused':{'type':Sequelize[_0x17df('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xf820=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0xf820,0x160));var _0x0f82=function(_0x29a30c,_0x1f8372){_0x29a30c=_0x29a30c-0x0;var _0x5865f6=_0xf820[_0x29a30c];return _0x5865f6;};'use strict';var Sequelize=require(_0x0f82('0x0'));module[_0x0f82('0x1')]={'uniqueid':{'type':Sequelize[_0x0f82('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0f82('0x3')},'membername':{'type':Sequelize[_0x0f82('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0f82('0x4')],'allowNull':![],'unique':_0x0f82('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x0f82('0x4')],'allowNull':![],'unique':_0x0f82('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x0f82('0x2')](0xb),'defaultValue':0x0,'comment':_0x0f82('0x3')},'paused':{'type':Sequelize[_0x0f82('0x2')](0xb),'defaultValue':0x0,'comment':_0x0f82('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f5f102c..0c581bf 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 _0xd430=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1ec6b3,_0x4d613c){var _0x7f842c=function(_0x3e1c27){while(--_0x3e1c27){_0x1ec6b3['push'](_0x1ec6b3['shift']());}};_0x7f842c(++_0x4d613c);}(_0xd430,0x159));var _0x0d43=function(_0x532685,_0x1a38c2){_0x532685=_0x532685-0x0;var _0x21426a=_0xd430[_0x532685];return _0x21426a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x0d43('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0d43('0x1')](0x0);var events={'afterCreate':_0x0d43('0x2'),'afterUpdate':_0x0d43('0x3'),'afterDestroy':_0x0d43('0x4')};function emitEvent(_0x3f6ccb){return function(_0xf9823e,_0x184652,_0x47152c){UserVoiceQueueRtEvents[_0x0d43('0x5')](_0x3f6ccb+':'+_0xf9823e['id'],_0xf9823e);UserVoiceQueueRtEvents['emit'](_0x3f6ccb,_0xf9823e);_0x47152c(null);};}for(var e in events){if(events[_0x0d43('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x0d43('0x7')](e,emitEvent(event));}}module[_0x0d43('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xdd7e=['UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook','events','../../mysqldb'];(function(_0x414c90,_0x1d0460){var _0x1eb68a=function(_0x45ab26){while(--_0x45ab26){_0x414c90['push'](_0x414c90['shift']());}};_0x1eb68a(++_0x1d0460);}(_0xdd7e,0x9e));var _0xedd7=function(_0x4b3f65,_0x58f149){_0x4b3f65=_0x4b3f65-0x0;var _0x2e75c9=_0xdd7e[_0x4b3f65];return _0x2e75c9;};'use strict';var EventEmitter=require(_0xedd7('0x0'));var UserVoiceQueueRt=require(_0xedd7('0x1'))['db'][_0xedd7('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xedd7('0x3')](0x0);var events={'afterCreate':_0xedd7('0x4'),'afterUpdate':'update','afterDestroy':_0xedd7('0x5')};function emitEvent(_0x478d10){return function(_0x2f6e90,_0x4c6497,_0x94488f){UserVoiceQueueRtEvents['emit'](_0x478d10+':'+_0x2f6e90['id'],_0x2f6e90);UserVoiceQueueRtEvents[_0xedd7('0x6')](_0x478d10,_0x2f6e90);_0x94488f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xedd7('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f5aaa68..7d39051 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 _0x5531=['lodash','util','api','bluebird','request-promise','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x105b20,_0x388d13){var _0x357455=function(_0x5b28d7){while(--_0x5b28d7){_0x105b20['push'](_0x105b20['shift']());}};_0x357455(++_0x388d13);}(_0x5531,0x14a));var _0x1553=function(_0x4cfad8,_0x35f750){_0x4cfad8=_0x4cfad8-0x0;var _0x4875ca=_0x5531[_0x4cfad8];return _0x4875ca;};'use strict';var _=require(_0x1553('0x0'));var util=require(_0x1553('0x1'));var logger=require('../../config/logger')(_0x1553('0x2'));var moment=require('moment');var BPromise=require(_0x1553('0x3'));var rp=require(_0x1553('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1553('0x5'));var config=require('../../config/environment');var attributes=require(_0x1553('0x6'));module['exports']=function(_0x5b54a0,_0x367094){return _0x5b54a0[_0x1553('0x7')](_0x1553('0x8'),attributes,{'tableName':_0x1553('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a43=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt'];(function(_0x2bae23,_0x3295e8){var _0x3aae9b=function(_0x1b57f4){while(--_0x1b57f4){_0x2bae23['push'](_0x2bae23['shift']());}};_0x3aae9b(++_0x3295e8);}(_0x9a43,0xb4));var _0x39a4=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x9a43[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require('lodash');var util=require(_0x39a4('0x0'));var logger=require(_0x39a4('0x1'))(_0x39a4('0x2'));var moment=require(_0x39a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x39a4('0x4'));var fs=require('fs');var path=require(_0x39a4('0x5'));var rimraf=require('rimraf');var config=require(_0x39a4('0x6'));var attributes=require(_0x39a4('0x7'));module['exports']=function(_0x221045,_0x5448ce){return _0x221045['define'](_0x39a4('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 7bb7db5..3a7b315 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 _0x53e1=['GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x44332b,_0x1a1108){var _0x34be23=function(_0x969560){while(--_0x969560){_0x44332b['push'](_0x44332b['shift']());}};_0x34be23(++_0x1a1108);}(_0x53e1,0x108));var _0x153e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x53e1[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x153e('0x0'));var moment=require('moment');var BPromise=require(_0x153e('0x1'));var rs=require(_0x153e('0x2'));var fs=require('fs');var Redis=require(_0x153e('0x3'));var db=require(_0x153e('0x4'))['db'];var utils=require(_0x153e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x153e('0x6'));var client=jayson[_0x153e('0x7')]['http']({'port':0x232a});config[_0x153e('0x8')]=_[_0x153e('0x9')](config[_0x153e('0x8')],{'host':_0x153e('0xa'),'port':0x18eb});var socket=require(_0x153e('0xb'))(new Redis(config['redis']));require(_0x153e('0xc'))['register'](socket);function respondWithRpcPromise(_0x1381e3,_0x3be119,_0x11f8fa){return new BPromise(function(_0x49bded,_0x5a4179){return client['request'](_0x1381e3,_0x11f8fa)[_0x153e('0xd')](function(_0x21b86c){logger[_0x153e('0xe')](_0x153e('0xf'),_0x3be119,_0x153e('0x10'));logger[_0x153e('0x11')](_0x153e('0x12'),_0x3be119,_0x153e('0x10'),JSON[_0x153e('0x13')](_0x21b86c));if(_0x21b86c['error']){if(_0x21b86c[_0x153e('0x14')]['code']===0x1f4){logger['error'](_0x153e('0xf'),_0x3be119,_0x21b86c['error'][_0x153e('0x15')]);return _0x5a4179(_0x21b86c['error'][_0x153e('0x15')]);}logger[_0x153e('0x14')](_0x153e('0xf'),_0x3be119,_0x21b86c[_0x153e('0x14')]['message']);return _0x49bded(_0x21b86c['error'][_0x153e('0x15')]);}else{logger[_0x153e('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3be119,_0x153e('0x10'));_0x49bded(_0x21b86c[_0x153e('0x16')]['message']);}})[_0x153e('0x17')](function(_0x200359){logger[_0x153e('0x14')](_0x153e('0xf'),_0x3be119,_0x200359);_0x5a4179(_0x200359);});});}exports[_0x153e('0x18')]=function(_0x38aae5){var _0x1d6e1e=this;return new Promise(function(_0x1e7d6a,_0x5ee56d){return db[_0x153e('0x19')]['findAll']({'raw':_0x38aae5[_0x153e('0x1a')]?_0x38aae5['options']['raw']===undefined?!![]:![]:!![],'where':_0x38aae5[_0x153e('0x1a')]?_0x38aae5[_0x153e('0x1a')][_0x153e('0x1b')]||null:null,'attributes':[[db[_0x153e('0x1c')]['fn'](_0x153e('0x1d'),db[_0x153e('0x1c')]['fn']('IF',db[_0x153e('0x1c')][_0x153e('0x1e')](_0x153e('0x1f')))),'outboundQueuePauses']]})[_0x153e('0xd')](function(_0x240502){logger[_0x153e('0xe')](_0x153e('0x18'),_0x38aae5);logger[_0x153e('0x11')](_0x153e('0x18'),_0x38aae5,JSON['stringify'](_0x240502));_0x1e7d6a(_0x240502);})['catch'](function(_0x26c873){logger[_0x153e('0x14')]('GetVoiceQueueRtPauses',_0x26c873[_0x153e('0x15')],_0x38aae5);_0x5ee56d(_0x1d6e1e[_0x153e('0x14')](0x1f4,_0x26c873[_0x153e('0x15')]));});});}; \ No newline at end of file +var _0x868f=['sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UserVoiceQueueRt','findAll','options','raw','where'];(function(_0x5c0cc1,_0xe5a5b8){var _0x235a5e=function(_0x431069){while(--_0x431069){_0x5c0cc1['push'](_0x5c0cc1['shift']());}};_0x235a5e(++_0xe5a5b8);}(_0x868f,0xef));var _0xf868=function(_0x29386d,_0x2c069b){_0x29386d=_0x29386d-0x0;var _0x1c2754=_0x868f[_0x29386d];return _0x1c2754;};'use strict';var _=require(_0xf868('0x0'));var util=require(_0xf868('0x1'));var moment=require(_0xf868('0x2'));var BPromise=require('bluebird');var rs=require(_0xf868('0x3'));var fs=require('fs');var Redis=require(_0xf868('0x4'));var db=require(_0xf868('0x5'))['db'];var utils=require(_0xf868('0x6'));var logger=require(_0xf868('0x7'))(_0xf868('0x8'));var config=require(_0xf868('0x9'));var jayson=require(_0xf868('0xa'));var client=jayson['client'][_0xf868('0xb')]({'port':0x232a});config[_0xf868('0xc')]=_[_0xf868('0xd')](config[_0xf868('0xc')],{'host':_0xf868('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf868('0xc')]));require(_0xf868('0xf'))[_0xf868('0x10')](socket);function respondWithRpcPromise(_0x8fa4f4,_0xc05e08,_0x2cf84b){return new BPromise(function(_0x568b8a,_0x3bce63){return client[_0xf868('0x11')](_0x8fa4f4,_0x2cf84b)[_0xf868('0x12')](function(_0x4cb774){logger[_0xf868('0x13')](_0xf868('0x14'),_0xc05e08,_0xf868('0x15'));logger[_0xf868('0x16')](_0xf868('0x17'),_0xc05e08,_0xf868('0x15'),JSON[_0xf868('0x18')](_0x4cb774));if(_0x4cb774['error']){if(_0x4cb774['error'][_0xf868('0x19')]===0x1f4){logger[_0xf868('0x1a')](_0xf868('0x14'),_0xc05e08,_0x4cb774[_0xf868('0x1a')][_0xf868('0x1b')]);return _0x3bce63(_0x4cb774['error'][_0xf868('0x1b')]);}logger[_0xf868('0x1a')](_0xf868('0x14'),_0xc05e08,_0x4cb774[_0xf868('0x1a')][_0xf868('0x1b')]);return _0x568b8a(_0x4cb774[_0xf868('0x1a')][_0xf868('0x1b')]);}else{logger[_0xf868('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc05e08,_0xf868('0x15'));_0x568b8a(_0x4cb774['result'][_0xf868('0x1b')]);}})[_0xf868('0x1c')](function(_0x18378f){logger[_0xf868('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc05e08,_0x18378f);_0x3bce63(_0x18378f);});});}exports['GetVoiceQueueRtPauses']=function(_0x3810c7){var _0x2b8a1b=this;return new Promise(function(_0x5dbba1,_0x4ff306){return db[_0xf868('0x1d')][_0xf868('0x1e')]({'raw':_0x3810c7[_0xf868('0x1f')]?_0x3810c7[_0xf868('0x1f')][_0xf868('0x20')]===undefined?!![]:![]:!![],'where':_0x3810c7[_0xf868('0x1f')]?_0x3810c7[_0xf868('0x1f')][_0xf868('0x21')]||null:null,'attributes':[[db[_0xf868('0x22')]['fn']('COUNT',db[_0xf868('0x22')]['fn']('IF',db['sequelize'][_0xf868('0x23')](_0xf868('0x24')))),_0xf868('0x25')]]})[_0xf868('0x12')](function(_0x423663){logger[_0xf868('0x13')](_0xf868('0x26'),_0x3810c7);logger['debug'](_0xf868('0x26'),_0x3810c7,JSON[_0xf868('0x18')](_0x423663));_0x5dbba1(_0x423663);})[_0xf868('0x1c')](function(_0x1dc4c9){logger[_0xf868('0x1a')](_0xf868('0x26'),_0x1dc4c9[_0xf868('0x1b')],_0x3810c7);_0x4ff306(_0x2b8a1b[_0xf868('0x1a')](0x1f4,_0x1dc4c9[_0xf868('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 93cda7c..6c91faa 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 _0xa690=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x5ceee7,_0x488be0){var _0x256d69=function(_0x2a274a){while(--_0x2a274a){_0x5ceee7['push'](_0x5ceee7['shift']());}};_0x256d69(++_0x488be0);}(_0xa690,0x1dc));var _0x0a69=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xa690[_0x602ca8];return _0x26e8ab;};'use strict';var UserVoiceQueueRtEvents=require(_0x0a69('0x0'));var events=[_0x0a69('0x1'),_0x0a69('0x2'),_0x0a69('0x3')];function createListener(_0x108a56,_0x9fa4ca){return function(_0x56dbca){_0x9fa4ca[_0x0a69('0x4')](_0x108a56,_0x56dbca);};}function removeListener(_0x5550f6,_0xc94fef){return function(){UserVoiceQueueRtEvents[_0x0a69('0x5')](_0x5550f6,_0xc94fef);};}exports['register']=function(_0xf435b6){for(var _0x23dc4c=0x0,_0x43f220=events[_0x0a69('0x6')];_0x23dc4c<_0x43f220;_0x23dc4c++){var _0x574ebc=events[_0x23dc4c];var _0x3ee811=createListener(_0x0a69('0x7')+_0x574ebc,_0xf435b6);UserVoiceQueueRtEvents['on'](_0x574ebc,_0x3ee811);}}; \ No newline at end of file +var _0xa523=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x3a068f,_0x43e2c7){var _0x6aaabe=function(_0x158760){while(--_0x158760){_0x3a068f['push'](_0x3a068f['shift']());}};_0x6aaabe(++_0x43e2c7);}(_0xa523,0x1e3));var _0x3a52=function(_0x41cdf7,_0xa6abb5){_0x41cdf7=_0x41cdf7-0x0;var _0x2155d1=_0xa523[_0x41cdf7];return _0x2155d1;};'use strict';var UserVoiceQueueRtEvents=require(_0x3a52('0x0'));var events=[_0x3a52('0x1'),_0x3a52('0x2'),_0x3a52('0x3')];function createListener(_0x1d6b84,_0x1d665f){return function(_0x468e78){_0x1d665f[_0x3a52('0x4')](_0x1d6b84,_0x468e78);};}function removeListener(_0x145114,_0x3fef6d){return function(){UserVoiceQueueRtEvents[_0x3a52('0x5')](_0x145114,_0x3fef6d);};}exports[_0x3a52('0x6')]=function(_0x5f253d){for(var _0x10717f=0x0,_0x4ed213=events['length'];_0x10717f<_0x4ed213;_0x10717f++){var _0x711706=events[_0x10717f];var _0x1cade2=createListener(_0x3a52('0x7')+_0x711706,_0x5f253d);UserVoiceQueueRtEvents['on'](_0x711706,_0x1cade2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index c3b509a..4893ccf 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 _0xbd8d=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x32622a,_0x5951b1){var _0x5ca77d=function(_0x5f247f){while(--_0x5f247f){_0x32622a['push'](_0x32622a['shift']());}};_0x5ca77d(++_0x5951b1);}(_0xbd8d,0xe4));var _0xdbd8=function(_0x39de23,_0x67e006){_0x39de23=_0x39de23-0x0;var _0x2698a7=_0xbd8d[_0x39de23];return _0x2698a7;};'use strict';var multer=require(_0xdbd8('0x0'));var util=require(_0xdbd8('0x1'));var path=require('path');var timeout=require(_0xdbd8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdbd8('0x3'));var interaction=require(_0xdbd8('0x4'));var config=require(_0xdbd8('0x5'));module[_0xdbd8('0x6')]=router; \ No newline at end of file +var _0x6615=['express','Router','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x1b924a,_0x2d1442){var _0x5206bf=function(_0x4a1dae){while(--_0x4a1dae){_0x1b924a['push'](_0x1b924a['shift']());}};_0x5206bf(++_0x2d1442);}(_0x6615,0xec));var _0x5661=function(_0x21cd08,_0x16cd11){_0x21cd08=_0x21cd08-0x0;var _0x1d77ba=_0x6615[_0x21cd08];return _0x1d77ba;};'use strict';var multer=require(_0x5661('0x0'));var util=require(_0x5661('0x1'));var path=require(_0x5661('0x2'));var timeout=require(_0x5661('0x3'));var express=require(_0x5661('0x4'));var router=express[_0x5661('0x5')]();var auth=require(_0x5661('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x5661('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 39563a8..96aeca5 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x1d3046,_0x8b14e1){var _0x3b9b62=function(_0xb69d69){while(--_0xb69d69){_0x1d3046['push'](_0x1d3046['shift']());}};_0x3b9b62(++_0x8b14e1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x3866b4,_0x3b0e0d){var _0xb8c195=function(_0x5ecb1d){while(--_0x5ecb1d){_0x3866b4['push'](_0x3866b4['shift']());}};_0xb8c195(++_0x3b0e0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index ecd4dcc..70350b3 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 _0x7916=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','UserWhatsappQueue','lodash'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x7916,0x128));var _0x6791=function(_0x361e41,_0x18140d){_0x361e41=_0x361e41-0x0;var _0x52cfdc=_0x7916[_0x361e41];return _0x52cfdc;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36ee=['UserWhatsappQueue','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 89590eb..26615c5 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(_0x344824,_0x15ca4d){var _0x4b93db=function(_0xdd9af8){while(--_0xdd9af8){_0x344824['push'](_0x344824['shift']());}};_0x4b93db(++_0x15ca4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3367a8,_0xb20e68){var _0x4e4d44=function(_0x5891c0){while(--_0x5891c0){_0x3367a8['push'](_0x3367a8['shift']());}};_0x4e4d44(++_0xb20e68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 1f02e74..5f1707a 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 _0x09bc=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./variable.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy'];(function(_0x39285d,_0x4e7c32){var _0x5b809b=function(_0x1c0b21){while(--_0x1c0b21){_0x39285d['push'](_0x39285d['shift']());}};_0x5b809b(++_0x4e7c32);}(_0x09bc,0x121));var _0xc09b=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x09bc[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0xc09b('0x0'));var util=require(_0xc09b('0x1'));var path=require(_0xc09b('0x2'));var timeout=require(_0xc09b('0x3'));var express=require('express');var router=express[_0xc09b('0x4')]();var auth=require(_0xc09b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc09b('0x6'));router['get']('/',auth[_0xc09b('0x7')](),controller['index']);router[_0xc09b('0x8')]('/:id',auth[_0xc09b('0x7')](),controller[_0xc09b('0x9')]);router[_0xc09b('0xa')]('/',auth[_0xc09b('0x7')](),controller[_0xc09b('0xb')]);router[_0xc09b('0xc')](_0xc09b('0xd'),auth[_0xc09b('0x7')](),controller[_0xc09b('0xe')]);router[_0xc09b('0xf')](_0xc09b('0xd'),auth[_0xc09b('0x7')](),controller[_0xc09b('0x10')]);module[_0xc09b('0x11')]=router; \ No newline at end of file +var _0x6cc0=['../../components/interaction/service','./variable.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x7414f7,_0x25e231){var _0x107e8d=function(_0x31987a){while(--_0x31987a){_0x7414f7['push'](_0x7414f7['shift']());}};_0x107e8d(++_0x25e231);}(_0x6cc0,0x12d));var _0x06cc=function(_0x2f2601,_0x10b8be){_0x2f2601=_0x2f2601-0x0;var _0x3c6e6=_0x6cc0[_0x2f2601];return _0x3c6e6;};'use strict';var multer=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var path=require(_0x06cc('0x2'));var timeout=require(_0x06cc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x06cc('0x4'));var interaction=require(_0x06cc('0x5'));var config=require('../../config/environment');var controller=require(_0x06cc('0x6'));router[_0x06cc('0x7')]('/',auth['isAuthenticated'](),controller[_0x06cc('0x8')]);router[_0x06cc('0x7')](_0x06cc('0x9'),auth[_0x06cc('0xa')](),controller[_0x06cc('0xb')]);router[_0x06cc('0xc')]('/',auth[_0x06cc('0xa')](),controller[_0x06cc('0xd')]);router['put']('/:id',auth[_0x06cc('0xa')](),controller[_0x06cc('0xe')]);router[_0x06cc('0xf')](_0x06cc('0x9'),auth['isAuthenticated'](),controller[_0x06cc('0x10')]);module[_0x06cc('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 2f415fb..0182643 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 _0xf4c5=['exports','STRING','name','sequelize'];(function(_0x2ac13,_0x3f98a5){var _0x2a5c5f=function(_0x55f050){while(--_0x55f050){_0x2ac13['push'](_0x2ac13['shift']());}};_0x2a5c5f(++_0x3f98a5);}(_0xf4c5,0x123));var _0x5f4c=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0xf4c5[_0x1d9163];return _0xb42197;};'use strict';var Sequelize=require(_0x5f4c('0x0'));module[_0x5f4c('0x1')]={'name':{'type':Sequelize[_0x5f4c('0x2')],'unique':_0x5f4c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5f4c('0x2')]}}; \ No newline at end of file +var _0xff3c=['STRING','name','sequelize','exports'];(function(_0x572fcf,_0x4022f3){var _0x30dda7=function(_0x51e3ca){while(--_0x51e3ca){_0x572fcf['push'](_0x572fcf['shift']());}};_0x30dda7(++_0x4022f3);}(_0xff3c,0xc2));var _0xcff3=function(_0x4cdf87,_0x200caf){_0x4cdf87=_0x4cdf87-0x0;var _0x14d49d=_0xff3c[_0x4cdf87];return _0x14d49d;};'use strict';var Sequelize=require(_0xcff3('0x0'));module[_0xcff3('0x1')]={'name':{'type':Sequelize[_0xcff3('0x2')],'unique':_0xcff3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcff3('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 422c46f..4d075cc 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 _0x82e8=['map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','then','get','Variables','UserProfileResource','destroy','end','error','stack','name','index','Variable','rawAttributes','type','model'];(function(_0x17cf02,_0x554107){var _0x4b9510=function(_0x12badf){while(--_0x12badf){_0x17cf02['push'](_0x17cf02['shift']());}};_0x4b9510(++_0x554107);}(_0x82e8,0xbe));var _0x882e=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x82e8[_0x35d4e9];return _0x5c2770;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x882e('0x0'));var rimraf=require(_0x882e('0x1'));var zipdir=require(_0x882e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882e('0x3'));var moment=require(_0x882e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x882e('0x5'));var util=require(_0x882e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x882e('0x7'));var ejs=require(_0x882e('0x8'));var fs=require('fs');var _=require(_0x882e('0x9'));var squel=require(_0x882e('0xa'));var crypto=require('crypto');var jsforce=require(_0x882e('0xb'));var deskjs=require(_0x882e('0xc'));var toCsv=require(_0x882e('0x7'));var querystring=require(_0x882e('0xd'));var Papa=require(_0x882e('0xe'));var Redis=require(_0x882e('0xf'));var authService=require(_0x882e('0x10'));var qs=require(_0x882e('0x11'));var as=require(_0x882e('0x12'));var hardwareService=require(_0x882e('0x13'));var logger=require(_0x882e('0x14'))('api');var utils=require(_0x882e('0x15'));var config=require(_0x882e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x882e('0x17'))['db'];function respondWithStatusCode(_0x31392b,_0x2be1cc){_0x2be1cc=_0x2be1cc||0xcc;return function(_0x1dab7e){if(_0x1dab7e){return _0x31392b[_0x882e('0x18')](_0x2be1cc);}return _0x31392b[_0x882e('0x19')](_0x2be1cc)['end']();};}function respondWithResult(_0x125b21,_0x4f15be){_0x4f15be=_0x4f15be||0xc8;return function(_0x33e977){if(_0x33e977){return _0x125b21[_0x882e('0x19')](_0x4f15be)[_0x882e('0x1a')](_0x33e977);}};}function respondWithFilteredResult(_0x368bed,_0x4937af){return function(_0x47a5d3){if(_0x47a5d3){var _0x35f488=_0x47a5d3[_0x882e('0x1b')],_0x2a52cc=_0x4937af[_0x882e('0x1c')],_0x50a009=_0x4937af[_0x882e('0x1c')]+_0x4937af['limit'],_0x50d763;if(_0x50a009>=_0x35f488){_0x50a009=_0x35f488;_0x50d763=0xc8;}else{_0x50d763=0xce;}_0x368bed['status'](_0x50d763);return _0x368bed[_0x882e('0x1d')]('Content-Range',_0x2a52cc+'-'+_0x50a009+'/'+_0x35f488)[_0x882e('0x1a')](_0x47a5d3);}return null;};}function patchUpdates(_0x4b0123){return function(_0x3b2209){try{jsonpatch[_0x882e('0x1e')](_0x3b2209,_0x4b0123,!![]);}catch(_0x475752){return BPromise[_0x882e('0x1f')](_0x475752);}return _0x3b2209[_0x882e('0x20')]();};}function saveUpdates(_0x5b2ab7,_0x4a10be){return function(_0x1d4887){if(_0x1d4887){return _0x1d4887['update'](_0x5b2ab7)[_0x882e('0x21')](function(_0x2b5ef6){return _0x2b5ef6;});}return null;};}function removeEntity(_0x47e6d9,_0x1b288e){return function(_0x12c9f9){if(_0x12c9f9){return _0x12c9f9['destroy']()[_0x882e('0x21')](function(){var _0xaecb33=_0x12c9f9[_0x882e('0x22')]({'plain':!![]});var _0x2b57d9=_0x882e('0x23');return db[_0x882e('0x24')][_0x882e('0x25')]({'where':{'type':_0x2b57d9,'resourceId':_0xaecb33['id']}})[_0x882e('0x21')](function(){return _0x12c9f9;});})[_0x882e('0x21')](function(){_0x47e6d9[_0x882e('0x19')](0xcc)[_0x882e('0x26')]();});}};}function handleEntityNotFound(_0x26515c,_0x1a2ae3){return function(_0x4c7da3){if(!_0x4c7da3){_0x26515c[_0x882e('0x18')](0x194);}return _0x4c7da3;};}function handleError(_0x33c9f5,_0x2490b1){_0x2490b1=_0x2490b1||0x1f4;return function(_0x59d69e){logger[_0x882e('0x27')](_0x59d69e[_0x882e('0x28')]);if(_0x59d69e[_0x882e('0x29')]){delete _0x59d69e['name'];}_0x33c9f5[_0x882e('0x19')](_0x2490b1)['send'](_0x59d69e);};}exports[_0x882e('0x2a')]=function(_0x185041,_0xbf441f){var _0x18c13f={},_0x1ce8df={},_0x564365={'count':0x0,'rows':[]};var _0x270bef=_['map'](db[_0x882e('0x2b')][_0x882e('0x2c')],function(_0x401e37){return{'name':_0x401e37['fieldName'],'type':_0x401e37[_0x882e('0x2d')]['key']};});_0x1ce8df[_0x882e('0x2e')]=_[_0x882e('0x2f')](_0x270bef,_0x882e('0x29'));_0x1ce8df['query']=_[_0x882e('0x30')](_0x185041['query']);_0x1ce8df[_0x882e('0x31')]=_[_0x882e('0x32')](_0x1ce8df['model'],_0x1ce8df[_0x882e('0x33')]);_0x18c13f['attributes']=_['intersection'](_0x1ce8df[_0x882e('0x2e')],qs['fields'](_0x185041[_0x882e('0x33')]['fields']));_0x18c13f['attributes']=_0x18c13f[_0x882e('0x34')][_0x882e('0x35')]?_0x18c13f[_0x882e('0x34')]:_0x1ce8df['model'];if(!_0x185041[_0x882e('0x33')][_0x882e('0x36')](_0x882e('0x37'))){_0x18c13f['limit']=qs[_0x882e('0x38')](_0x185041[_0x882e('0x33')][_0x882e('0x38')]);_0x18c13f[_0x882e('0x1c')]=qs[_0x882e('0x1c')](_0x185041[_0x882e('0x33')]['offset']);}_0x18c13f[_0x882e('0x39')]=qs[_0x882e('0x3a')](_0x185041['query'][_0x882e('0x3a')]);_0x18c13f['where']=qs['filters'](_[_0x882e('0x3b')](_0x185041[_0x882e('0x33')],_0x1ce8df[_0x882e('0x31')]),_0x270bef);if(_0x185041['query'][_0x882e('0x3c')]){_0x18c13f['where']=_[_0x882e('0x3d')](_0x18c13f[_0x882e('0x3e')],{'$or':_[_0x882e('0x2f')](_0x270bef,function(_0x96bd6c){if(_0x96bd6c[_0x882e('0x2d')]!==_0x882e('0x3f')){var _0x3f35db={};_0x3f35db[_0x96bd6c[_0x882e('0x29')]]={'$like':'%'+_0x185041[_0x882e('0x33')][_0x882e('0x3c')]+'%'};return _0x3f35db;}})});}_0x18c13f=_['merge']({},_0x18c13f,_0x185041[_0x882e('0x40')]);var _0x410652={'where':_0x18c13f[_0x882e('0x3e')]};return db[_0x882e('0x2b')]['count'](_0x410652)['then'](function(_0x151b03){_0x564365[_0x882e('0x1b')]=_0x151b03;if(_0x185041[_0x882e('0x33')][_0x882e('0x41')]){_0x18c13f['include']=[{'all':!![]}];}return db[_0x882e('0x2b')][_0x882e('0x42')](_0x18c13f);})[_0x882e('0x21')](function(_0x529b49){_0x564365['rows']=_0x529b49;return _0x564365;})[_0x882e('0x21')](respondWithFilteredResult(_0xbf441f,_0x18c13f))[_0x882e('0x43')](handleError(_0xbf441f,null));};exports[_0x882e('0x44')]=function(_0x5c53d7,_0x340e61){var _0x5bfefc={'raw':!![],'where':{'id':_0x5c53d7[_0x882e('0x45')]['id']}},_0x4c55e7={};_0x4c55e7[_0x882e('0x2e')]=_[_0x882e('0x30')](db['Variable'][_0x882e('0x2c')]);_0x4c55e7[_0x882e('0x33')]=_[_0x882e('0x30')](_0x5c53d7[_0x882e('0x33')]);_0x4c55e7[_0x882e('0x31')]=_['intersection'](_0x4c55e7[_0x882e('0x2e')],_0x4c55e7[_0x882e('0x33')]);_0x5bfefc['attributes']=_['intersection'](_0x4c55e7[_0x882e('0x2e')],qs[_0x882e('0x46')](_0x5c53d7[_0x882e('0x33')]['fields']));_0x5bfefc[_0x882e('0x34')]=_0x5bfefc[_0x882e('0x34')][_0x882e('0x35')]?_0x5bfefc['attributes']:_0x4c55e7[_0x882e('0x2e')];if(_0x5c53d7[_0x882e('0x33')][_0x882e('0x41')]){_0x5bfefc[_0x882e('0x47')]=[{'all':!![]}];}_0x5bfefc=_['merge']({},_0x5bfefc,_0x5c53d7[_0x882e('0x40')]);return db[_0x882e('0x2b')][_0x882e('0x48')](_0x5bfefc)[_0x882e('0x21')](handleEntityNotFound(_0x340e61,null))[_0x882e('0x21')](respondWithResult(_0x340e61,null))['catch'](handleError(_0x340e61,null));};exports[_0x882e('0x49')]=function(_0xe2ccb8,_0x38db16){return db[_0x882e('0x2b')]['create'](_0xe2ccb8[_0x882e('0x4a')],{})['then'](function(_0x545b9b){var _0x11e19c=_0xe2ccb8[_0x882e('0x4b')][_0x882e('0x22')]({'plain':!![]});if(!_0x11e19c)throw new Error(_0x882e('0x4c'));if(_0x11e19c['role']===_0x882e('0x4b')){var _0x7bbc38=_0x545b9b['get']({'plain':!![]});var _0x2ed10c=_0x882e('0x23');return db[_0x882e('0x4d')][_0x882e('0x48')]({'where':{'name':_0x2ed10c,'userProfileId':_0x11e19c['userProfileId']},'raw':!![]})['then'](function(_0x2ef300){if(_0x2ef300&&_0x2ef300[_0x882e('0x4e')]===0x0){return db['UserProfileResource'][_0x882e('0x49')]({'name':_0x7bbc38[_0x882e('0x29')],'resourceId':_0x7bbc38['id'],'type':_0x2ef300[_0x882e('0x29')],'sectionId':_0x2ef300['id']},{})[_0x882e('0x21')](function(){return _0x545b9b;});}else{return _0x545b9b;}})[_0x882e('0x43')](function(_0x4e3023){logger[_0x882e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e3023);throw _0x4e3023;});}return _0x545b9b;})['then'](respondWithResult(_0x38db16,0xc9))[_0x882e('0x43')](handleError(_0x38db16,null));};exports['update']=function(_0x218fe4,_0x223679){if(_0x218fe4['body']['id']){delete _0x218fe4[_0x882e('0x4a')]['id'];}return db['Variable']['find']({'where':{'id':_0x218fe4[_0x882e('0x45')]['id']}})[_0x882e('0x21')](handleEntityNotFound(_0x223679,null))[_0x882e('0x21')](saveUpdates(_0x218fe4['body'],null))['then'](respondWithResult(_0x223679,null))[_0x882e('0x43')](handleError(_0x223679,null));};exports[_0x882e('0x25')]=function(_0x246dc3,_0x20482a){return db[_0x882e('0x2b')]['find']({'where':{'id':_0x246dc3[_0x882e('0x45')]['id']}})[_0x882e('0x21')](handleEntityNotFound(_0x20482a,null))['then'](removeEntity(_0x20482a,null))[_0x882e('0x43')](handleError(_0x20482a,null));}; \ No newline at end of file +var _0xea97=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','stack','name','index','map','Variable','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0xea97,0xeb));var _0x7ea9=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xea97[_0x2235bf];return _0x4c3a64;};'use strict';var pdf=require(_0x7ea9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7ea9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ea9('0x2'));var rp=require(_0x7ea9('0x3'));var moment=require(_0x7ea9('0x4'));var BPromise=require(_0x7ea9('0x5'));var Mustache=require('mustache');var util=require(_0x7ea9('0x6'));var path=require(_0x7ea9('0x7'));var sox=require('sox');var csv=require(_0x7ea9('0x8'));var ejs=require(_0x7ea9('0x9'));var fs=require('fs');var _=require(_0x7ea9('0xa'));var squel=require(_0x7ea9('0xb'));var crypto=require(_0x7ea9('0xc'));var jsforce=require(_0x7ea9('0xd'));var deskjs=require(_0x7ea9('0xe'));var toCsv=require(_0x7ea9('0x8'));var querystring=require(_0x7ea9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ea9('0x10'));var qs=require(_0x7ea9('0x11'));var as=require(_0x7ea9('0x12'));var hardwareService=require(_0x7ea9('0x13'));var logger=require(_0x7ea9('0x14'))(_0x7ea9('0x15'));var utils=require(_0x7ea9('0x16'));var config=require(_0x7ea9('0x17'));var licenseUtil=require(_0x7ea9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e9d33,_0x492d88){_0x492d88=_0x492d88||0xcc;return function(_0x4541f7){if(_0x4541f7){return _0x1e9d33[_0x7ea9('0x19')](_0x492d88);}return _0x1e9d33[_0x7ea9('0x1a')](_0x492d88)[_0x7ea9('0x1b')]();};}function respondWithResult(_0x184dc2,_0x3dae7b){_0x3dae7b=_0x3dae7b||0xc8;return function(_0x2af29f){if(_0x2af29f){return _0x184dc2[_0x7ea9('0x1a')](_0x3dae7b)[_0x7ea9('0x1c')](_0x2af29f);}};}function respondWithFilteredResult(_0x3f793a,_0x59fcd8){return function(_0x35bc84){if(_0x35bc84){var _0x58a405=_0x35bc84[_0x7ea9('0x1d')],_0x2e2a7e=_0x59fcd8[_0x7ea9('0x1e')],_0x545ddd=_0x59fcd8[_0x7ea9('0x1e')]+_0x59fcd8[_0x7ea9('0x1f')],_0x20ecb8;if(_0x545ddd>=_0x58a405){_0x545ddd=_0x58a405;_0x20ecb8=0xc8;}else{_0x20ecb8=0xce;}_0x3f793a[_0x7ea9('0x1a')](_0x20ecb8);return _0x3f793a[_0x7ea9('0x20')](_0x7ea9('0x21'),_0x2e2a7e+'-'+_0x545ddd+'/'+_0x58a405)[_0x7ea9('0x1c')](_0x35bc84);}return null;};}function patchUpdates(_0x335b48){return function(_0x1e1c55){try{jsonpatch[_0x7ea9('0x22')](_0x1e1c55,_0x335b48,!![]);}catch(_0x2ef563){return BPromise[_0x7ea9('0x23')](_0x2ef563);}return _0x1e1c55['save']();};}function saveUpdates(_0x391169,_0x2baf50){return function(_0x28a67a){if(_0x28a67a){return _0x28a67a[_0x7ea9('0x24')](_0x391169)[_0x7ea9('0x25')](function(_0x445598){return _0x445598;});}return null;};}function removeEntity(_0xeb3051,_0x3562ad){return function(_0x53ef88){if(_0x53ef88){return _0x53ef88[_0x7ea9('0x26')]()[_0x7ea9('0x25')](function(){var _0x1b214d=_0x53ef88[_0x7ea9('0x27')]({'plain':!![]});var _0x531ca0=_0x7ea9('0x28');return db[_0x7ea9('0x29')][_0x7ea9('0x26')]({'where':{'type':_0x531ca0,'resourceId':_0x1b214d['id']}})['then'](function(){return _0x53ef88;});})[_0x7ea9('0x25')](function(){_0xeb3051[_0x7ea9('0x1a')](0xcc)[_0x7ea9('0x1b')]();});}};}function handleEntityNotFound(_0x1e11c6,_0x511946){return function(_0x9b1357){if(!_0x9b1357){_0x1e11c6[_0x7ea9('0x19')](0x194);}return _0x9b1357;};}function handleError(_0x3ab18f,_0x1878c3){_0x1878c3=_0x1878c3||0x1f4;return function(_0x5da73e){logger['error'](_0x5da73e[_0x7ea9('0x2a')]);if(_0x5da73e[_0x7ea9('0x2b')]){delete _0x5da73e[_0x7ea9('0x2b')];}_0x3ab18f[_0x7ea9('0x1a')](_0x1878c3)['send'](_0x5da73e);};}exports[_0x7ea9('0x2c')]=function(_0x29bb85,_0x221831){var _0x1f21ca={},_0x4955f2={},_0x151181={'count':0x0,'rows':[]};var _0x3ed5f8=_[_0x7ea9('0x2d')](db[_0x7ea9('0x2e')][_0x7ea9('0x2f')],function(_0x1adca2){return{'name':_0x1adca2['fieldName'],'type':_0x1adca2['type'][_0x7ea9('0x30')]};});_0x4955f2[_0x7ea9('0x31')]=_['map'](_0x3ed5f8,_0x7ea9('0x2b'));_0x4955f2[_0x7ea9('0x32')]=_[_0x7ea9('0x33')](_0x29bb85[_0x7ea9('0x32')]);_0x4955f2[_0x7ea9('0x34')]=_[_0x7ea9('0x35')](_0x4955f2['model'],_0x4955f2[_0x7ea9('0x32')]);_0x1f21ca['attributes']=_[_0x7ea9('0x35')](_0x4955f2[_0x7ea9('0x31')],qs[_0x7ea9('0x36')](_0x29bb85['query'][_0x7ea9('0x36')]));_0x1f21ca[_0x7ea9('0x37')]=_0x1f21ca[_0x7ea9('0x37')][_0x7ea9('0x38')]?_0x1f21ca[_0x7ea9('0x37')]:_0x4955f2[_0x7ea9('0x31')];if(!_0x29bb85[_0x7ea9('0x32')]['hasOwnProperty'](_0x7ea9('0x39'))){_0x1f21ca[_0x7ea9('0x1f')]=qs[_0x7ea9('0x1f')](_0x29bb85['query']['limit']);_0x1f21ca[_0x7ea9('0x1e')]=qs[_0x7ea9('0x1e')](_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x1e')]);}_0x1f21ca[_0x7ea9('0x3a')]=qs[_0x7ea9('0x3b')](_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x3b')]);_0x1f21ca[_0x7ea9('0x3c')]=qs['filters'](_[_0x7ea9('0x3d')](_0x29bb85[_0x7ea9('0x32')],_0x4955f2[_0x7ea9('0x34')]),_0x3ed5f8);if(_0x29bb85[_0x7ea9('0x32')]['filter']){_0x1f21ca[_0x7ea9('0x3c')]=_[_0x7ea9('0x3e')](_0x1f21ca[_0x7ea9('0x3c')],{'$or':_[_0x7ea9('0x2d')](_0x3ed5f8,function(_0x495b86){if(_0x495b86[_0x7ea9('0x3f')]!==_0x7ea9('0x40')){var _0x804e76={};_0x804e76[_0x495b86[_0x7ea9('0x2b')]]={'$like':'%'+_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x41')]+'%'};return _0x804e76;}})});}_0x1f21ca=_[_0x7ea9('0x3e')]({},_0x1f21ca,_0x29bb85[_0x7ea9('0x42')]);var _0x3320bc={'where':_0x1f21ca[_0x7ea9('0x3c')]};return db[_0x7ea9('0x2e')][_0x7ea9('0x1d')](_0x3320bc)[_0x7ea9('0x25')](function(_0x57991d){_0x151181[_0x7ea9('0x1d')]=_0x57991d;if(_0x29bb85[_0x7ea9('0x32')][_0x7ea9('0x43')]){_0x1f21ca[_0x7ea9('0x44')]=[{'all':!![]}];}return db['Variable'][_0x7ea9('0x45')](_0x1f21ca);})[_0x7ea9('0x25')](function(_0x5d71bd){_0x151181[_0x7ea9('0x46')]=_0x5d71bd;return _0x151181;})[_0x7ea9('0x25')](respondWithFilteredResult(_0x221831,_0x1f21ca))[_0x7ea9('0x47')](handleError(_0x221831,null));};exports[_0x7ea9('0x48')]=function(_0x107484,_0x8c27eb){var _0x316ca1={'raw':!![],'where':{'id':_0x107484[_0x7ea9('0x49')]['id']}},_0x2bef0f={};_0x2bef0f[_0x7ea9('0x31')]=_[_0x7ea9('0x33')](db[_0x7ea9('0x2e')][_0x7ea9('0x2f')]);_0x2bef0f['query']=_[_0x7ea9('0x33')](_0x107484['query']);_0x2bef0f['filters']=_[_0x7ea9('0x35')](_0x2bef0f[_0x7ea9('0x31')],_0x2bef0f[_0x7ea9('0x32')]);_0x316ca1[_0x7ea9('0x37')]=_[_0x7ea9('0x35')](_0x2bef0f[_0x7ea9('0x31')],qs[_0x7ea9('0x36')](_0x107484[_0x7ea9('0x32')]['fields']));_0x316ca1[_0x7ea9('0x37')]=_0x316ca1[_0x7ea9('0x37')]['length']?_0x316ca1[_0x7ea9('0x37')]:_0x2bef0f[_0x7ea9('0x31')];if(_0x107484[_0x7ea9('0x32')]['includeAll']){_0x316ca1[_0x7ea9('0x44')]=[{'all':!![]}];}_0x316ca1=_[_0x7ea9('0x3e')]({},_0x316ca1,_0x107484[_0x7ea9('0x42')]);return db[_0x7ea9('0x2e')][_0x7ea9('0x4a')](_0x316ca1)[_0x7ea9('0x25')](handleEntityNotFound(_0x8c27eb,null))[_0x7ea9('0x25')](respondWithResult(_0x8c27eb,null))[_0x7ea9('0x47')](handleError(_0x8c27eb,null));};exports[_0x7ea9('0x4b')]=function(_0x4cb1d0,_0x1bde8f){return db[_0x7ea9('0x2e')]['create'](_0x4cb1d0[_0x7ea9('0x4c')],{})[_0x7ea9('0x25')](function(_0x23abd3){var _0x36d310=_0x4cb1d0[_0x7ea9('0x4d')][_0x7ea9('0x27')]({'plain':!![]});if(!_0x36d310)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36d310[_0x7ea9('0x4e')]===_0x7ea9('0x4d')){var _0x3ea173=_0x23abd3[_0x7ea9('0x27')]({'plain':!![]});var _0x2646c3='Variables';return db[_0x7ea9('0x4f')][_0x7ea9('0x4a')]({'where':{'name':_0x2646c3,'userProfileId':_0x36d310[_0x7ea9('0x50')]},'raw':!![]})[_0x7ea9('0x25')](function(_0x16bd9f){if(_0x16bd9f&&_0x16bd9f[_0x7ea9('0x51')]===0x0){return db[_0x7ea9('0x29')]['create']({'name':_0x3ea173[_0x7ea9('0x2b')],'resourceId':_0x3ea173['id'],'type':_0x16bd9f['name'],'sectionId':_0x16bd9f['id']},{})[_0x7ea9('0x25')](function(){return _0x23abd3;});}else{return _0x23abd3;}})['catch'](function(_0x2a3417){logger[_0x7ea9('0x52')](_0x7ea9('0x53'),_0x2a3417);throw _0x2a3417;});}return _0x23abd3;})['then'](respondWithResult(_0x1bde8f,0xc9))[_0x7ea9('0x47')](handleError(_0x1bde8f,null));};exports[_0x7ea9('0x24')]=function(_0x2565d8,_0x4b48ff){if(_0x2565d8[_0x7ea9('0x4c')]['id']){delete _0x2565d8[_0x7ea9('0x4c')]['id'];}return db[_0x7ea9('0x2e')][_0x7ea9('0x4a')]({'where':{'id':_0x2565d8['params']['id']}})[_0x7ea9('0x25')](handleEntityNotFound(_0x4b48ff,null))[_0x7ea9('0x25')](saveUpdates(_0x2565d8[_0x7ea9('0x4c')],null))['then'](respondWithResult(_0x4b48ff,null))[_0x7ea9('0x47')](handleError(_0x4b48ff,null));};exports[_0x7ea9('0x26')]=function(_0x5e49ff,_0x3b3891){return db['Variable'][_0x7ea9('0x4a')]({'where':{'id':_0x5e49ff[_0x7ea9('0x49')]['id']}})[_0x7ea9('0x25')](handleEntityNotFound(_0x3b3891,null))[_0x7ea9('0x25')](removeEntity(_0x3b3891,null))['catch'](handleError(_0x3b3891,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 819ca3e..5ff6a76 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 _0x876b=['tools_variables','../../config/logger','api','request-promise','path','../../config/environment','./variable.attributes','exports','define'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x876b,0x1ba));var _0xb876=function(_0x44bb1c,_0x53afbb){_0x44bb1c=_0x44bb1c-0x0;var _0x560ed6=_0x876b[_0x44bb1c];return _0x560ed6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb876('0x0'))(_0xb876('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb876('0x2'));var fs=require('fs');var path=require(_0xb876('0x3'));var rimraf=require('rimraf');var config=require(_0xb876('0x4'));var attributes=require(_0xb876('0x5'));module[_0xb876('0x6')]=function(_0x5e1da8,_0x275125){return _0x5e1da8[_0xb876('0x7')]('Variable',attributes,{'tableName':_0xb876('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe80c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','define','tools_variables','util'];(function(_0x35062a,_0x13683e){var _0x415190=function(_0x17d6be){while(--_0x17d6be){_0x35062a['push'](_0x35062a['shift']());}};_0x415190(++_0x13683e);}(_0xe80c,0x1c2));var _0xce80=function(_0x1bd57a,_0x2c8970){_0x1bd57a=_0x1bd57a-0x0;var _0x47ff4c=_0xe80c[_0x1bd57a];return _0x47ff4c;};'use strict';var _=require('lodash');var util=require(_0xce80('0x0'));var logger=require(_0xce80('0x1'))(_0xce80('0x2'));var moment=require(_0xce80('0x3'));var BPromise=require(_0xce80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce80('0x5'));var rimraf=require(_0xce80('0x6'));var config=require(_0xce80('0x7'));var attributes=require(_0xce80('0x8'));module['exports']=function(_0xb10325,_0x150f6a){return _0xb10325[_0xce80('0x9')]('Variable',attributes,{'tableName':_0xce80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index d824606..e283362 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 _0x3a23=['ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Variable','find','options','where','attributes','include','map','model','then'];(function(_0x2fdfcf,_0x3497fa){var _0x7eb4f7=function(_0x38eb80){while(--_0x38eb80){_0x2fdfcf['push'](_0x2fdfcf['shift']());}};_0x7eb4f7(++_0x3497fa);}(_0x3a23,0x85));var _0x33a2=function(_0x11229a,_0x3fef7a){_0x11229a=_0x11229a-0x0;var _0xeafaae=_0x3a23[_0x11229a];return _0xeafaae;};'use strict';var _=require(_0x33a2('0x0'));var util=require('util');var moment=require(_0x33a2('0x1'));var BPromise=require(_0x33a2('0x2'));var rs=require(_0x33a2('0x3'));var fs=require('fs');var Redis=require(_0x33a2('0x4'));var db=require(_0x33a2('0x5'))['db'];var utils=require(_0x33a2('0x6'));var logger=require(_0x33a2('0x7'))(_0x33a2('0x8'));var config=require(_0x33a2('0x9'));var jayson=require(_0x33a2('0xa'));var client=jayson[_0x33a2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b035,_0x515994,_0x591fa4){return new BPromise(function(_0x5208e4,_0x4c8a5b){return client[_0x33a2('0xc')](_0x50b035,_0x591fa4)['then'](function(_0x28c5a2){logger[_0x33a2('0xd')](_0x33a2('0xe'),_0x515994,_0x33a2('0xf'));logger[_0x33a2('0x10')](_0x33a2('0x11'),_0x515994,_0x33a2('0xf'),JSON[_0x33a2('0x12')](_0x28c5a2));if(_0x28c5a2[_0x33a2('0x13')]){if(_0x28c5a2[_0x33a2('0x13')][_0x33a2('0x14')]===0x1f4){logger['error'](_0x33a2('0xe'),_0x515994,_0x28c5a2['error'][_0x33a2('0x15')]);return _0x4c8a5b(_0x28c5a2[_0x33a2('0x13')]['message']);}logger[_0x33a2('0x13')](_0x33a2('0xe'),_0x515994,_0x28c5a2[_0x33a2('0x13')][_0x33a2('0x15')]);return _0x5208e4(_0x28c5a2['error'][_0x33a2('0x15')]);}else{logger[_0x33a2('0xd')](_0x33a2('0xe'),_0x515994,_0x33a2('0xf'));_0x5208e4(_0x28c5a2['result']['message']);}})[_0x33a2('0x16')](function(_0x3b2543){logger[_0x33a2('0x13')](_0x33a2('0xe'),_0x515994,_0x3b2543);_0x4c8a5b(_0x3b2543);});});}exports['ShowVariable']=function(_0x581401){var _0x54fa1c=this;return new Promise(function(_0x3c8d76,_0x301629){return db[_0x33a2('0x17')][_0x33a2('0x18')]({'raw':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')][_0x33a2('0x1a')]||null:null,'attributes':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')][_0x33a2('0x1b')]||null:null,'include':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')][_0x33a2('0x1c')]?_[_0x33a2('0x1d')](_0x581401[_0x33a2('0x19')]['include'],function(_0x4cbcd5){return{'model':db[_0x4cbcd5['model']],'as':_0x4cbcd5['as'],'attributes':_0x4cbcd5[_0x33a2('0x1b')],'include':_0x4cbcd5['include']?_[_0x33a2('0x1d')](_0x4cbcd5[_0x33a2('0x1c')],function(_0x4a6ed8){return{'model':db[_0x4a6ed8[_0x33a2('0x1e')]],'as':_0x4a6ed8['as'],'attributes':_0x4a6ed8[_0x33a2('0x1b')],'include':_0x4a6ed8[_0x33a2('0x1c')]?_['map'](_0x4a6ed8[_0x33a2('0x1c')],function(_0x4108a2){return{'model':db[_0x4108a2[_0x33a2('0x1e')]],'as':_0x4108a2['as'],'attributes':_0x4108a2[_0x33a2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x33a2('0x1f')](function(_0x53ad74){logger[_0x33a2('0xd')](_0x33a2('0x20'),_0x581401);logger[_0x33a2('0x10')](_0x33a2('0x20'),_0x581401,JSON[_0x33a2('0x12')](_0x53ad74));_0x3c8d76(_0x53ad74);})[_0x33a2('0x16')](function(_0x2a03be){logger[_0x33a2('0x13')]('ShowVariable',_0x2a03be['message'],_0x581401);_0x301629(_0x54fa1c['error'](0x1f4,_0x2a03be[_0x33a2('0x15')]));});});}; \ No newline at end of file +var _0x983a=['jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','include','map','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa601e7,_0x403e5e){var _0x217d3b=function(_0x2c53f1){while(--_0x2c53f1){_0xa601e7['push'](_0xa601e7['shift']());}};_0x217d3b(++_0x403e5e);}(_0x983a,0x1ca));var _0xa983=function(_0x55608d,_0x14235b){_0x55608d=_0x55608d-0x0;var _0x3bc3d4=_0x983a[_0x55608d];return _0x3bc3d4;};'use strict';var _=require(_0xa983('0x0'));var util=require(_0xa983('0x1'));var moment=require(_0xa983('0x2'));var BPromise=require(_0xa983('0x3'));var rs=require(_0xa983('0x4'));var fs=require('fs');var Redis=require(_0xa983('0x5'));var db=require(_0xa983('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa983('0x7'));var client=jayson[_0xa983('0x8')][_0xa983('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e953,_0x39e990,_0x3ece3e){return new BPromise(function(_0x44c8b1,_0x3fd748){return client[_0xa983('0xa')](_0x31e953,_0x3ece3e)['then'](function(_0x5cafba){logger[_0xa983('0xb')](_0xa983('0xc'),_0x39e990,_0xa983('0xd'));logger[_0xa983('0xe')](_0xa983('0xf'),_0x39e990,_0xa983('0xd'),JSON[_0xa983('0x10')](_0x5cafba));if(_0x5cafba[_0xa983('0x11')]){if(_0x5cafba[_0xa983('0x11')][_0xa983('0x12')]===0x1f4){logger[_0xa983('0x11')](_0xa983('0xc'),_0x39e990,_0x5cafba[_0xa983('0x11')][_0xa983('0x13')]);return _0x3fd748(_0x5cafba[_0xa983('0x11')][_0xa983('0x13')]);}logger[_0xa983('0x11')](_0xa983('0xc'),_0x39e990,_0x5cafba[_0xa983('0x11')]['message']);return _0x44c8b1(_0x5cafba[_0xa983('0x11')][_0xa983('0x13')]);}else{logger['info'](_0xa983('0xc'),_0x39e990,_0xa983('0xd'));_0x44c8b1(_0x5cafba[_0xa983('0x14')][_0xa983('0x13')]);}})[_0xa983('0x15')](function(_0x4cb156){logger[_0xa983('0x11')](_0xa983('0xc'),_0x39e990,_0x4cb156);_0x3fd748(_0x4cb156);});});}exports[_0xa983('0x16')]=function(_0x1930f4){var _0x2be3b2=this;return new Promise(function(_0x264d70,_0x391612){return db['Variable'][_0xa983('0x17')]({'raw':_0x1930f4[_0xa983('0x18')]?_0x1930f4[_0xa983('0x18')][_0xa983('0x19')]===undefined?!![]:![]:!![],'where':_0x1930f4[_0xa983('0x18')]?_0x1930f4['options']['where']||null:null,'attributes':_0x1930f4[_0xa983('0x18')]?_0x1930f4[_0xa983('0x18')]['attributes']||null:null,'include':_0x1930f4[_0xa983('0x18')]?_0x1930f4['options'][_0xa983('0x1a')]?_[_0xa983('0x1b')](_0x1930f4[_0xa983('0x18')][_0xa983('0x1a')],function(_0x265009){return{'model':db[_0x265009[_0xa983('0x1c')]],'as':_0x265009['as'],'attributes':_0x265009['attributes'],'include':_0x265009[_0xa983('0x1a')]?_['map'](_0x265009[_0xa983('0x1a')],function(_0x12f30c){return{'model':db[_0x12f30c[_0xa983('0x1c')]],'as':_0x12f30c['as'],'attributes':_0x12f30c[_0xa983('0x1d')],'include':_0x12f30c['include']?_['map'](_0x12f30c['include'],function(_0xc35931){return{'model':db[_0xc35931[_0xa983('0x1c')]],'as':_0xc35931['as'],'attributes':_0xc35931[_0xa983('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa983('0x1e')](function(_0x5c936d){logger[_0xa983('0xb')](_0xa983('0x16'),_0x1930f4);logger[_0xa983('0xe')]('ShowVariable',_0x1930f4,JSON['stringify'](_0x5c936d));_0x264d70(_0x5c936d);})['catch'](function(_0x12b72e){logger['error']('ShowVariable',_0x12b72e['message'],_0x1930f4);_0x391612(_0x2be3b2[_0xa983('0x11')](0x1f4,_0x12b72e['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c075641..59ded35 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 _0x6bb4=['restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6bb4,0x147));var _0x46bb=function(_0x563407,_0x5c3e62){_0x563407=_0x563407-0x0;var _0x22bbf4=_0x6bb4[_0x563407];return _0x22bbf4;};'use strict';var express=require(_0x46bb('0x0'));var router=express[_0x46bb('0x1')]();var auth=require(_0x46bb('0x2'));var controller=require(_0x46bb('0x3'));router[_0x46bb('0x4')]('/',controller[_0x46bb('0x5')]);router[_0x46bb('0x4')](_0x46bb('0x6'),auth[_0x46bb('0x7')](),auth[_0x46bb('0x8')](),controller[_0x46bb('0x9')]);router[_0x46bb('0x4')](_0x46bb('0xa'),auth[_0x46bb('0x7')](),auth[_0x46bb('0x8')](),controller['reset']);router[_0x46bb('0x4')](_0x46bb('0xb'),auth[_0x46bb('0x7')](),auth['canUpdate'](),controller[_0x46bb('0xc')]);router[_0x46bb('0x4')]('/restart',auth['isAuthenticated'](),controller[_0x46bb('0xd')]);router[_0x46bb('0x4')](_0x46bb('0xe'),controller[_0x46bb('0xf')]);module[_0x46bb('0x10')]=router; \ No newline at end of file +var _0xcd57=['index','isAuthenticated','/reset','canUpdate','reset','/pull','/restart','restart','migrations','exports','Router','../../components/auth/service','./version.controller','get'];(function(_0x34bc89,_0x1d8652){var _0x38ad3f=function(_0x2b6215){while(--_0x2b6215){_0x34bc89['push'](_0x34bc89['shift']());}};_0x38ad3f(++_0x1d8652);}(_0xcd57,0x1ae));var _0x7cd5=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0xcd57[_0x230951];return _0xeb26b1;};'use strict';var express=require('express');var router=express[_0x7cd5('0x0')]();var auth=require(_0x7cd5('0x1'));var controller=require(_0x7cd5('0x2'));router[_0x7cd5('0x3')]('/',controller[_0x7cd5('0x4')]);router[_0x7cd5('0x3')]('/fetch',auth[_0x7cd5('0x5')](),auth['canUpdate'](),controller['fetch']);router[_0x7cd5('0x3')](_0x7cd5('0x6'),auth[_0x7cd5('0x5')](),auth[_0x7cd5('0x7')](),controller[_0x7cd5('0x8')]);router['get'](_0x7cd5('0x9'),auth[_0x7cd5('0x5')](),auth[_0x7cd5('0x7')](),controller['pull']);router[_0x7cd5('0x3')](_0x7cd5('0xa'),auth[_0x7cd5('0x5')](),controller[_0x7cd5('0xb')]);router[_0x7cd5('0x3')]('/migrations',controller[_0x7cd5('0xc')]);module[_0x7cd5('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5b3c31f..8ad6249 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 _0xf0f4=['../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','root','migrations','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','path','version','compare-versions','exec','../../mysqldb','../../config/environment'];(function(_0x2a19c1,_0x876541){var _0x3acb57=function(_0x4f30fe){while(--_0x4f30fe){_0x2a19c1['push'](_0x2a19c1['shift']());}};_0x3acb57(++_0x876541);}(_0xf0f4,0x182));var _0x4f0f=function(_0x4f1f76,_0x4466d4){_0x4f1f76=_0x4f1f76-0x0;var _0x1eae72=_0xf0f4[_0x4f1f76];return _0x1eae72;};'use strict';var Umzug=require('umzug');var path=require(_0x4f0f('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x4f0f('0x1'));var compareVersions=require(_0x4f0f('0x2'));var exec=require('child_process')[_0x4f0f('0x3')];var db=require(_0x4f0f('0x4'))['db'];var config=require(_0x4f0f('0x5'));var pm2=require(_0x4f0f('0x6'));var logger=require(_0x4f0f('0x7'))(_0x4f0f('0x8'));var git=require(_0x4f0f('0x9'))(config['root']);exports[_0x4f0f('0xa')]=function(_0x1dd6bd,_0x95b1cf){var _0x5da92f={'current':module[_0x4f0f('0xb')][_0x4f0f('0x1')],'phonebar':0x2};if(_0x1dd6bd[_0x4f0f('0xc')]&&_0x1dd6bd[_0x4f0f('0xc')][_0x4f0f('0xd')]){return git[_0x4f0f('0xe')]()[_0x4f0f('0xf')](function(_0x2b2e49,_0x4bf11d){_0x5da92f[_0x4f0f('0xd')]=(_0x2b2e49?module[_0x4f0f('0xb')][_0x4f0f('0x1')]:_0x4bf11d[_0x4f0f('0xd')])||_0x4f0f('0x10');return _0x95b1cf[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')](_0x5da92f);});}else{return _0x95b1cf[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')](_0x5da92f);}};exports[_0x4f0f('0xe')]=function(_0x3fc985,_0x4e1e26){return git[_0x4f0f('0xe')]([_0x4f0f('0x13'),_0x4f0f('0x14')],function(_0x22de68){if(_0x22de68){logger['error'](_0x22de68);return _0x4e1e26[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x22de68);}logger[_0x4f0f('0x15')](_0x4f0f('0x16'));return _0x4e1e26[_0x4f0f('0x11')](0xc8)['json']({'output':_0x4f0f('0x17')});});};exports[_0x4f0f('0x18')]=function(_0x20423e,_0x566049){return git[_0x4f0f('0x18')]([_0x4f0f('0x19'),_0x4f0f('0x1a')],function(_0x5f5363){if(_0x5f5363){logger[_0x4f0f('0x1b')](_0x5f5363);return _0x566049[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x5f5363);}logger[_0x4f0f('0x15')](_0x4f0f('0x1c'));return _0x566049[_0x4f0f('0x11')](0xc8)['json']({'output':_0x4f0f('0x1d')});});};exports['pull']=function(_0x3a6f22,_0x21ebad){exec('npm\x20install\x20--production',function(_0x4e4b28,_0x1bdfb4,_0x55d318){logger[_0x4f0f('0x15')](_0x1bdfb4);logger[_0x4f0f('0x15')](_0x55d318);if(_0x4e4b28){logger[_0x4f0f('0x1b')](_0x4e4b28);return _0x21ebad[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x4e4b28);}return _0x21ebad[_0x4f0f('0x11')](0xc8)['json']({'output':_0x1bdfb4});});};exports[_0x4f0f('0x1e')]=function(_0xcdcd05,_0x37aefe){return pm2[_0x4f0f('0x1e')](_0x4f0f('0x1f'))[_0x4f0f('0x20')](function(_0x166ea6){logger[_0x4f0f('0x15')](_0x4f0f('0x21'),_0x166ea6);return _0x37aefe[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')]({'output':_0x4f0f('0x22')});})[_0x4f0f('0x23')](function(_0x5c13d1){logger[_0x4f0f('0x1b')](_0x5c13d1);return _0x37aefe[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x5c13d1);});};exports['migrations']=function(_0xa8a240,_0x4e5f0d){var _0x449788=fs[_0x4f0f('0x24')](path['join'](config['root'],_0x4f0f('0x25'),'migrations'));var _0x1a005e=[];for(var _0x9319c0=0x0;_0x9319c0<_0x449788['length'];_0x9319c0++){var _0x3d3762=_0x449788[_0x9319c0][_0x4f0f('0x26')](_0x4f0f('0x27'),'');if(compareVersions(module[_0x4f0f('0xb')]['version'],_0x3d3762)===-0x1){_0x1a005e[_0x4f0f('0x28')](_0x3d3762);}}if(_0x1a005e[_0x4f0f('0x29')]){var _0x3c4462=_0x1a005e[_0x4f0f('0x2a')](compareVersions);var _0x5ea512=new Umzug({'storage':_0x4f0f('0x2b'),'storageOptions':{'model':db[_0x4f0f('0x2c')],'modelName':_0x4f0f('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x4f0f('0x2b')][_0x4f0f('0x2d')](),db['sequelize'][_0x4f0f('0x2e')],function(){throw new Error(_0x4f0f('0x2f'));}],'path':path[_0x4f0f('0x30')](config[_0x4f0f('0x31')],'server',_0x4f0f('0x32')),'pattern':/\.js$/}});_0x5ea512['up']({'migrations':_[_0x4f0f('0x33')](_0x3c4462,function(_0x35611d){return _0x35611d+_0x4f0f('0x27');})})[_0x4f0f('0x20')](function(){return _0x4e5f0d[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')]({'output':_0x4f0f('0x34')+module['exports'][_0x4f0f('0x1')]+_0x4f0f('0x35')+_[_0x4f0f('0x36')](_0x3c4462),'migrations':_[_0x4f0f('0x30')](_0x3c4462)});})[_0x4f0f('0x23')](function(_0x3e2cb6){if(_0x3e2cb6 instanceof db[_0x4f0f('0x2b')]['UniqueConstraintError']){return _0x4e5f0d[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')]({'output':_0x4f0f('0x37')});}else{return _0x4e5f0d['status'](0x1f4)[_0x4f0f('0x12')](_0x3e2cb6);}});}else{return _0x4e5f0d['status'](0xc8)[_0x4f0f('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xe3da=['info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','push','sequelize','Migration','getQueryInterface','constructor','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','2.0.0','status','json','origin','error'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var Umzug=require(_0xae3d('0x0'));var path=require(_0xae3d('0x1'));var fs=require('fs');var _=require(_0xae3d('0x2'));var pkginfo=require(_0xae3d('0x3'))(module,_0xae3d('0x4'));var compareVersions=require(_0xae3d('0x5'));var exec=require(_0xae3d('0x6'))[_0xae3d('0x7')];var db=require(_0xae3d('0x8'))['db'];var config=require(_0xae3d('0x9'));var pm2=require(_0xae3d('0xa'));var logger=require(_0xae3d('0xb'))(_0xae3d('0xc'));var git=require(_0xae3d('0xd'))(config[_0xae3d('0xe')]);exports[_0xae3d('0xf')]=function(_0x583b98,_0x2a5c45){var _0x3d6650={'current':module['exports']['version'],'phonebar':0x2};if(_0x583b98[_0xae3d('0x10')]&&_0x583b98[_0xae3d('0x10')][_0xae3d('0x11')]){return git[_0xae3d('0x12')]()[_0xae3d('0x13')](function(_0x15d6da,_0x4bd4ec){_0x3d6650[_0xae3d('0x11')]=(_0x15d6da?module['exports'][_0xae3d('0x4')]:_0x4bd4ec[_0xae3d('0x11')])||_0xae3d('0x14');return _0x2a5c45[_0xae3d('0x15')](0xc8)['json'](_0x3d6650);});}else{return _0x2a5c45[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')](_0x3d6650);}};exports[_0xae3d('0x12')]=function(_0x1605ac,_0x2afdd3){return git[_0xae3d('0x12')]([_0xae3d('0x17'),'master'],function(_0x1fb7a9){if(_0x1fb7a9){logger[_0xae3d('0x18')](_0x1fb7a9);return _0x2afdd3[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x1fb7a9);}logger[_0xae3d('0x19')](_0xae3d('0x1a'));return _0x2afdd3['status'](0xc8)[_0xae3d('0x16')]({'output':_0xae3d('0x1b')});});};exports[_0xae3d('0x1c')]=function(_0x5303c2,_0x3f8cf9){return git[_0xae3d('0x1c')](['--hard','FETCH_HEAD'],function(_0x8a37cc){if(_0x8a37cc){logger[_0xae3d('0x18')](_0x8a37cc);return _0x3f8cf9[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x8a37cc);}logger[_0xae3d('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3f8cf9[_0xae3d('0x15')](0xc8)['json']({'output':_0xae3d('0x1d')});});};exports[_0xae3d('0x1e')]=function(_0x1415e8,_0x263b0e){exec(_0xae3d('0x1f'),function(_0x3e7afc,_0x26c419,_0x155099){logger[_0xae3d('0x19')](_0x26c419);logger[_0xae3d('0x19')](_0x155099);if(_0x3e7afc){logger[_0xae3d('0x18')](_0x3e7afc);return _0x263b0e[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x3e7afc);}return _0x263b0e[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')]({'output':_0x26c419});});};exports[_0xae3d('0x20')]=function(_0xfb54f6,_0x21b608){return pm2[_0xae3d('0x20')](_0xae3d('0x21'))['then'](function(_0x16c014){logger[_0xae3d('0x19')](_0xae3d('0x22'),_0x16c014);return _0x21b608[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')]({'output':_0xae3d('0x23')});})[_0xae3d('0x24')](function(_0x54c1e1){logger['error'](_0x54c1e1);return _0x21b608[_0xae3d('0x15')](0x1f4)[_0xae3d('0x16')](_0x54c1e1);});};exports[_0xae3d('0x25')]=function(_0x3114f9,_0xb69ec9){var _0x561371=fs[_0xae3d('0x26')](path[_0xae3d('0x27')](config['root'],_0xae3d('0x28'),_0xae3d('0x25')));var _0x2cf750=[];for(var _0x46f484=0x0;_0x46f484<_0x561371[_0xae3d('0x29')];_0x46f484++){var _0x6ef13c=_0x561371[_0x46f484]['replace']('.js','');if(compareVersions(module['exports'][_0xae3d('0x4')],_0x6ef13c)===-0x1){_0x2cf750[_0xae3d('0x2a')](_0x6ef13c);}}if(_0x2cf750[_0xae3d('0x29')]){var _0x270043=_0x2cf750['sort'](compareVersions);var _0x31af1b=new Umzug({'storage':_0xae3d('0x2b'),'storageOptions':{'model':db[_0xae3d('0x2c')],'modelName':_0xae3d('0x2c'),'columnName':_0xae3d('0x4')},'migrations':{'params':[db[_0xae3d('0x2b')][_0xae3d('0x2d')](),db['sequelize'][_0xae3d('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0xae3d('0xe')],'server',_0xae3d('0x25')),'pattern':/\.js$/}});_0x31af1b['up']({'migrations':_['map'](_0x270043,function(_0x59425f){return _0x59425f+_0xae3d('0x2f');})})[_0xae3d('0x30')](function(){return _0xb69ec9[_0xae3d('0x15')](0xc8)['json']({'output':_0xae3d('0x31')+module['exports'][_0xae3d('0x4')]+_0xae3d('0x32')+_[_0xae3d('0x33')](_0x270043),'migrations':_[_0xae3d('0x27')](_0x270043)});})[_0xae3d('0x24')](function(_0x3fc3c0){if(_0x3fc3c0 instanceof db[_0xae3d('0x2b')][_0xae3d('0x34')]){return _0xb69ec9[_0xae3d('0x15')](0xc8)[_0xae3d('0x16')]({'output':_0xae3d('0x35')});}else{return _0xb69ec9['status'](0x1f4)['json'](_0x3fc3c0);}});}else{return _0xb69ec9[_0xae3d('0x15')](0xc8)['json']({'output':_0xae3d('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ee1f615..3c1a705 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 _0xbb30=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','util','path'];(function(_0x54d164,_0x3be5ba){var _0xf58243=function(_0x58faf5){while(--_0x58faf5){_0x54d164['push'](_0x54d164['shift']());}};_0xf58243(++_0x3be5ba);}(_0xbb30,0xe2));var _0x0bb3=function(_0x4ddf0f,_0x2f092f){_0x4ddf0f=_0x4ddf0f-0x0;var _0x45ab71=_0xbb30[_0x4ddf0f];return _0x45ab71;};'use strict';var multer=require('multer');var util=require(_0x0bb3('0x0'));var path=require(_0x0bb3('0x1'));var timeout=require(_0x0bb3('0x2'));var express=require(_0x0bb3('0x3'));var router=express[_0x0bb3('0x4')]();var auth=require(_0x0bb3('0x5'));var interaction=require(_0x0bb3('0x6'));var config=require('../../config/environment');var controller=require(_0x0bb3('0x7'));router[_0x0bb3('0x8')]('/',auth[_0x0bb3('0x9')](),controller['index']);router[_0x0bb3('0x8')](_0x0bb3('0xa'),auth[_0x0bb3('0x9')](),controller[_0x0bb3('0xb')]);router['get'](_0x0bb3('0xc'),auth[_0x0bb3('0x9')](),controller[_0x0bb3('0xd')]);router[_0x0bb3('0xe')]('/',auth['isAuthenticated'](),controller[_0x0bb3('0xf')]);router['put'](_0x0bb3('0xc'),auth[_0x0bb3('0x9')](),controller[_0x0bb3('0x10')]);router[_0x0bb3('0x11')](_0x0bb3('0xc'),auth['isAuthenticated'](),controller[_0x0bb3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x012a=['../../config/environment','isAuthenticated','get','/describe','/:id','show','post','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4097a6,_0x44c830){var _0xfed555=function(_0x3d7ae6){while(--_0x3d7ae6){_0x4097a6['push'](_0x4097a6['shift']());}};_0xfed555(++_0x44c830);}(_0x012a,0x1dc));var _0xa012=function(_0x15cf23,_0x4f90d5){_0x15cf23=_0x15cf23-0x0;var _0x19cf58=_0x012a[_0x15cf23];return _0x19cf58;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa012('0x0'));var express=require('express');var router=express[_0xa012('0x1')]();var auth=require(_0xa012('0x2'));var interaction=require(_0xa012('0x3'));var config=require(_0xa012('0x4'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xa012('0x5')](),controller['index']);router[_0xa012('0x6')](_0xa012('0x7'),auth[_0xa012('0x5')](),controller['describe']);router[_0xa012('0x6')](_0xa012('0x8'),auth['isAuthenticated'](),controller[_0xa012('0x9')]);router[_0xa012('0xa')]('/',auth[_0xa012('0x5')](),controller['create']);router[_0xa012('0xb')]('/:id',auth[_0xa012('0x5')](),controller[_0xa012('0xc')]);router[_0xa012('0xd')]('/:id',auth[_0xa012('0x5')](),controller[_0xa012('0xe')]);module[_0xa012('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index bd34d91..5aa348c 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 _0xed1f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xed1f,0x6a));var _0xfed1=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xed1f[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'type':{'type':Sequelize[_0xfed1('0x2')]},'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'calleridnum':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'queue':{'type':Sequelize[_0xfed1('0x2')]},'interface':{'type':Sequelize[_0xfed1('0x2')]},'membername':{'type':Sequelize[_0xfed1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfed1('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfed1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xfed1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfed1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfed1('0x3')]},'holdtime':{'type':Sequelize[_0xfed1('0x4')]},'agentcomplete':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfed1('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xfed1('0x2')]},'channel':{'type':Sequelize[_0xfed1('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfed1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfed1('0x2')]},'language':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfed1('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfed1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfed1('0x2')]},'destpriority':{'type':Sequelize[_0xfed1('0x2')]},'destuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfed1('0x6')},'transferexten':{'type':Sequelize[_0xfed1('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xe14b,0x93));var _0xbe14=function(_0x407ffb,_0x5d6dbc){_0x407ffb=_0x407ffb-0x0;var _0x4d4206=_0xe14b[_0x407ffb];return _0x4d4206;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbe14('0x2')]},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbe14('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbe14('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbe14('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xbe14('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbe14('0x3')]},'holdtime':{'type':Sequelize[_0xbe14('0x4')]},'agentcomplete':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbe14('0x4')]},'reason':{'type':Sequelize[_0xbe14('0x2')]},'lastevent':{'type':Sequelize[_0xbe14('0x2')]},'channel':{'type':Sequelize[_0xbe14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'connectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'exten':{'type':Sequelize[_0xbe14('0x2')]},'priority':{'type':Sequelize[_0xbe14('0x2')]},'destchannel':{'type':Sequelize[_0xbe14('0x2')]},'destchannelstate':{'type':Sequelize[_0xbe14('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridname':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'destlanguage':{'type':Sequelize[_0xbe14('0x2')]},'destaccountcode':{'type':Sequelize[_0xbe14('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xbe14('0x2')]},'destuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xbe14('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbe14('0x2')],'comment':_0xbe14('0x6')},'transferexten':{'type':Sequelize[_0xbe14('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'agententerreason':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 66aa7fc..f2606fd 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 _0xd607=['status','offset','limit','set','Content-Range','json','apply','reject','destroy','then','end','sendStatus','stack','name','send','map','VoiceAgentReport','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4ca003,_0x1c9265){var _0x2162d4=function(_0x47c3de){while(--_0x47c3de){_0x4ca003['push'](_0x4ca003['shift']());}};_0x2162d4(++_0x1c9265);}(_0xd607,0x158));var _0x7d60=function(_0x4d0ad2,_0x3cbd24){_0x4d0ad2=_0x4d0ad2-0x0;var _0x3c3f5f=_0xd607[_0x4d0ad2];return _0x3c3f5f;};'use strict';var pdf=require(_0x7d60('0x0'));var emlformat=require(_0x7d60('0x1'));var rimraf=require(_0x7d60('0x2'));var zipdir=require(_0x7d60('0x3'));var jsonpatch=require(_0x7d60('0x4'));var rp=require(_0x7d60('0x5'));var moment=require('moment');var BPromise=require(_0x7d60('0x6'));var Mustache=require('mustache');var util=require(_0x7d60('0x7'));var path=require(_0x7d60('0x8'));var sox=require(_0x7d60('0x9'));var csv=require('to-csv');var ejs=require(_0x7d60('0xa'));var fs=require('fs');var _=require(_0x7d60('0xb'));var squel=require(_0x7d60('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d60('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7d60('0xe'));var Papa=require(_0x7d60('0xf'));var Redis=require(_0x7d60('0x10'));var authService=require(_0x7d60('0x11'));var qs=require(_0x7d60('0x12'));var as=require(_0x7d60('0x13'));var hardwareService=require(_0x7d60('0x14'));var logger=require(_0x7d60('0x15'))(_0x7d60('0x16'));var utils=require(_0x7d60('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7d60('0x18'));var db=require(_0x7d60('0x19'))['db'];function respondWithStatusCode(_0x1c201d,_0x4cc2ea){_0x4cc2ea=_0x4cc2ea||0xcc;return function(_0x4a2edc){if(_0x4a2edc){return _0x1c201d['sendStatus'](_0x4cc2ea);}return _0x1c201d[_0x7d60('0x1a')](_0x4cc2ea)['end']();};}function respondWithResult(_0x26e4dc,_0x4d8c57){_0x4d8c57=_0x4d8c57||0xc8;return function(_0x558f18){if(_0x558f18){return _0x26e4dc[_0x7d60('0x1a')](_0x4d8c57)['json'](_0x558f18);}};}function respondWithFilteredResult(_0x310913,_0x18a3da){return function(_0x3299b9){if(_0x3299b9){var _0x1ac48c=_0x3299b9['count'],_0x51462d=_0x18a3da[_0x7d60('0x1b')],_0x3004bf=_0x18a3da[_0x7d60('0x1b')]+_0x18a3da[_0x7d60('0x1c')],_0xc099d9;if(_0x3004bf>=_0x1ac48c){_0x3004bf=_0x1ac48c;_0xc099d9=0xc8;}else{_0xc099d9=0xce;}_0x310913[_0x7d60('0x1a')](_0xc099d9);return _0x310913[_0x7d60('0x1d')](_0x7d60('0x1e'),_0x51462d+'-'+_0x3004bf+'/'+_0x1ac48c)[_0x7d60('0x1f')](_0x3299b9);}return null;};}function patchUpdates(_0x24ea3f){return function(_0x417246){try{jsonpatch[_0x7d60('0x20')](_0x417246,_0x24ea3f,!![]);}catch(_0x37005b){return BPromise[_0x7d60('0x21')](_0x37005b);}return _0x417246['save']();};}function saveUpdates(_0x159606,_0x5839a1){return function(_0x3d5859){if(_0x3d5859){return _0x3d5859['update'](_0x159606)['then'](function(_0x68b9d9){return _0x68b9d9;});}return null;};}function removeEntity(_0x4bc0ba,_0x9028a6){return function(_0x44ee66){if(_0x44ee66){return _0x44ee66[_0x7d60('0x22')]()[_0x7d60('0x23')](function(){_0x4bc0ba[_0x7d60('0x1a')](0xcc)[_0x7d60('0x24')]();});}};}function handleEntityNotFound(_0x55d7b7,_0xa236d7){return function(_0x334e39){if(!_0x334e39){_0x55d7b7[_0x7d60('0x25')](0x194);}return _0x334e39;};}function handleError(_0x2124e3,_0x5f3758){_0x5f3758=_0x5f3758||0x1f4;return function(_0x235c82){logger['error'](_0x235c82[_0x7d60('0x26')]);if(_0x235c82[_0x7d60('0x27')]){delete _0x235c82[_0x7d60('0x27')];}_0x2124e3[_0x7d60('0x1a')](_0x5f3758)[_0x7d60('0x28')](_0x235c82);};}exports['index']=function(_0x3148b3,_0x190eaf){var _0x3f8e05={},_0x5c5b8d={},_0x5b2a8e={'count':0x0,'rows':[]};var _0x3b4337=_[_0x7d60('0x29')](db[_0x7d60('0x2a')]['rawAttributes'],function(_0x20fbe3){return{'name':_0x20fbe3['fieldName'],'type':_0x20fbe3['type'][_0x7d60('0x2b')]};});_0x5c5b8d['model']=_[_0x7d60('0x29')](_0x3b4337,'name');_0x5c5b8d[_0x7d60('0x2c')]=_[_0x7d60('0x2d')](_0x3148b3[_0x7d60('0x2c')]);_0x5c5b8d[_0x7d60('0x2e')]=_['intersection'](_0x5c5b8d[_0x7d60('0x2f')],_0x5c5b8d[_0x7d60('0x2c')]);_0x3f8e05[_0x7d60('0x30')]=_['intersection'](_0x5c5b8d[_0x7d60('0x2f')],qs[_0x7d60('0x31')](_0x3148b3['query']['fields']));_0x3f8e05['attributes']=_0x3f8e05[_0x7d60('0x30')]['length']?_0x3f8e05[_0x7d60('0x30')]:_0x5c5b8d[_0x7d60('0x2f')];if(!_0x3148b3['query'][_0x7d60('0x32')](_0x7d60('0x33'))){_0x3f8e05[_0x7d60('0x1c')]=qs['limit'](_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x1c')]);_0x3f8e05[_0x7d60('0x1b')]=qs[_0x7d60('0x1b')](_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x1b')]);}_0x3f8e05[_0x7d60('0x34')]=qs[_0x7d60('0x35')](_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x35')]);_0x3f8e05[_0x7d60('0x36')]=qs[_0x7d60('0x2e')](_['pick'](_0x3148b3['query'],_0x5c5b8d[_0x7d60('0x2e')]),_0x3b4337);if(_0x3148b3['query'][_0x7d60('0x37')]){_0x3f8e05[_0x7d60('0x36')]=_[_0x7d60('0x38')](_0x3f8e05[_0x7d60('0x36')],{'$or':_[_0x7d60('0x29')](_0x3b4337,function(_0x1e9e63){if(_0x1e9e63[_0x7d60('0x39')]!==_0x7d60('0x3a')){var _0x1efd29={};_0x1efd29[_0x1e9e63[_0x7d60('0x27')]]={'$like':'%'+_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x37')]+'%'};return _0x1efd29;}})});}_0x3f8e05=_[_0x7d60('0x38')]({},_0x3f8e05,_0x3148b3[_0x7d60('0x3b')]);var _0xa22668={'where':_0x3f8e05[_0x7d60('0x36')]};return db['VoiceAgentReport'][_0x7d60('0x3c')](_0xa22668)['then'](function(_0x1fe505){_0x5b2a8e['count']=_0x1fe505;if(_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x3d')]){_0x3f8e05[_0x7d60('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x7d60('0x3f')](_0x3f8e05);})[_0x7d60('0x23')](function(_0x1067b8){_0x5b2a8e[_0x7d60('0x40')]=_0x1067b8;return _0x5b2a8e;})[_0x7d60('0x23')](respondWithFilteredResult(_0x190eaf,_0x3f8e05))[_0x7d60('0x41')](handleError(_0x190eaf,null));};exports['show']=function(_0x55b00f,_0x3bc833){var _0x4fffcf={'raw':![],'where':{'id':_0x55b00f[_0x7d60('0x42')]['id']}},_0x4933d5={};_0x4933d5[_0x7d60('0x2f')]=_[_0x7d60('0x2d')](db[_0x7d60('0x2a')][_0x7d60('0x43')]);_0x4933d5[_0x7d60('0x2c')]=_['keys'](_0x55b00f['query']);_0x4933d5['filters']=_[_0x7d60('0x44')](_0x4933d5[_0x7d60('0x2f')],_0x4933d5[_0x7d60('0x2c')]);_0x4fffcf[_0x7d60('0x30')]=_[_0x7d60('0x44')](_0x4933d5[_0x7d60('0x2f')],qs[_0x7d60('0x31')](_0x55b00f[_0x7d60('0x2c')][_0x7d60('0x31')]));_0x4fffcf['attributes']=_0x4fffcf[_0x7d60('0x30')][_0x7d60('0x45')]?_0x4fffcf[_0x7d60('0x30')]:_0x4933d5[_0x7d60('0x2f')];if(_0x55b00f['query']['includeAll']){_0x4fffcf[_0x7d60('0x3e')]=[{'all':!![]}];}_0x4fffcf=_[_0x7d60('0x38')]({},_0x4fffcf,_0x55b00f['options']);return db[_0x7d60('0x2a')][_0x7d60('0x46')](_0x4fffcf)['then'](handleEntityNotFound(_0x3bc833,null))[_0x7d60('0x23')](respondWithResult(_0x3bc833,null))[_0x7d60('0x41')](handleError(_0x3bc833,null));};exports[_0x7d60('0x47')]=function(_0x160735,_0x3db6cc){return db[_0x7d60('0x2a')][_0x7d60('0x47')](_0x160735[_0x7d60('0x48')],{})['then'](respondWithResult(_0x3db6cc,0xc9))[_0x7d60('0x41')](handleError(_0x3db6cc,null));};exports['update']=function(_0x10a740,_0x32c547){if(_0x10a740[_0x7d60('0x48')]['id']){delete _0x10a740[_0x7d60('0x48')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x10a740[_0x7d60('0x42')]['id']}})[_0x7d60('0x23')](handleEntityNotFound(_0x32c547,null))[_0x7d60('0x23')](saveUpdates(_0x10a740['body'],null))[_0x7d60('0x23')](respondWithResult(_0x32c547,null))['catch'](handleError(_0x32c547,null));};exports[_0x7d60('0x22')]=function(_0x54537f,_0xb10ebc){return db[_0x7d60('0x2a')][_0x7d60('0x46')]({'where':{'id':_0x54537f['params']['id']}})[_0x7d60('0x23')](handleEntityNotFound(_0xb10ebc,null))[_0x7d60('0x23')](removeEntity(_0xb10ebc,null))[_0x7d60('0x41')](handleError(_0xb10ebc,null));};exports[_0x7d60('0x49')]=function(_0x4d1d19,_0x3feb0b){return db[_0x7d60('0x2a')][_0x7d60('0x49')]()[_0x7d60('0x23')](respondWithResult(_0x3feb0b,null))[_0x7d60('0x41')](handleError(_0x3feb0b,null));}; \ No newline at end of file +var _0x86d0=['rawAttributes','intersection','find','body','update','describe','html-pdf','request-promise','moment','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','error','stack','name','send','index','VoiceAgentReport','fieldName','type','key','model','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','options','include','rows','catch','show','params'];(function(_0x57c601,_0x3293a2){var _0x10d301=function(_0x37c889){while(--_0x37c889){_0x57c601['push'](_0x57c601['shift']());}};_0x10d301(++_0x3293a2);}(_0x86d0,0x1db));var _0x086d=function(_0x28bfdc,_0x50fd27){_0x28bfdc=_0x28bfdc-0x0;var _0x25bf45=_0x86d0[_0x28bfdc];return _0x25bf45;};'use strict';var pdf=require(_0x086d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x086d('0x1'));var moment=require(_0x086d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x086d('0x3'));var sox=require('sox');var csv=require(_0x086d('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x086d('0x5'));var squel=require(_0x086d('0x6'));var crypto=require(_0x086d('0x7'));var jsforce=require(_0x086d('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x086d('0x9'));var Papa=require('papaparse');var Redis=require(_0x086d('0xa'));var authService=require(_0x086d('0xb'));var qs=require(_0x086d('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x086d('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x086d('0xe'));var config=require(_0x086d('0xf'));var licenseUtil=require(_0x086d('0x10'));var db=require(_0x086d('0x11'))['db'];function respondWithStatusCode(_0x5c7fed,_0x90ef23){_0x90ef23=_0x90ef23||0xcc;return function(_0x4e1197){if(_0x4e1197){return _0x5c7fed[_0x086d('0x12')](_0x90ef23);}return _0x5c7fed[_0x086d('0x13')](_0x90ef23)[_0x086d('0x14')]();};}function respondWithResult(_0x10ccb5,_0x108f71){_0x108f71=_0x108f71||0xc8;return function(_0x57fbeb){if(_0x57fbeb){return _0x10ccb5['status'](_0x108f71)[_0x086d('0x15')](_0x57fbeb);}};}function respondWithFilteredResult(_0x576538,_0x5cd610){return function(_0x17d9b9){if(_0x17d9b9){var _0x11c320=_0x17d9b9[_0x086d('0x16')],_0x3cdc99=_0x5cd610[_0x086d('0x17')],_0x4c5e70=_0x5cd610[_0x086d('0x17')]+_0x5cd610[_0x086d('0x18')],_0x4a107c;if(_0x4c5e70>=_0x11c320){_0x4c5e70=_0x11c320;_0x4a107c=0xc8;}else{_0x4a107c=0xce;}_0x576538[_0x086d('0x13')](_0x4a107c);return _0x576538[_0x086d('0x19')]('Content-Range',_0x3cdc99+'-'+_0x4c5e70+'/'+_0x11c320)[_0x086d('0x15')](_0x17d9b9);}return null;};}function patchUpdates(_0x4c80ff){return function(_0x30cae4){try{jsonpatch[_0x086d('0x1a')](_0x30cae4,_0x4c80ff,!![]);}catch(_0x163a96){return BPromise['reject'](_0x163a96);}return _0x30cae4[_0x086d('0x1b')]();};}function saveUpdates(_0x5346ba,_0x301f30){return function(_0x6e5b2c){if(_0x6e5b2c){return _0x6e5b2c['update'](_0x5346ba)[_0x086d('0x1c')](function(_0x387bf2){return _0x387bf2;});}return null;};}function removeEntity(_0x35bc4c,_0x5d41e8){return function(_0x4ea047){if(_0x4ea047){return _0x4ea047[_0x086d('0x1d')]()[_0x086d('0x1c')](function(){_0x35bc4c[_0x086d('0x13')](0xcc)[_0x086d('0x14')]();});}};}function handleEntityNotFound(_0x2c0e50,_0x33fa25){return function(_0x5759fc){if(!_0x5759fc){_0x2c0e50[_0x086d('0x12')](0x194);}return _0x5759fc;};}function handleError(_0x340a95,_0x37d244){_0x37d244=_0x37d244||0x1f4;return function(_0x447169){logger[_0x086d('0x1e')](_0x447169[_0x086d('0x1f')]);if(_0x447169[_0x086d('0x20')]){delete _0x447169[_0x086d('0x20')];}_0x340a95[_0x086d('0x13')](_0x37d244)[_0x086d('0x21')](_0x447169);};}exports[_0x086d('0x22')]=function(_0x1ef173,_0x1d794a){var _0x2a0cd3={},_0x5515ab={},_0x77170a={'count':0x0,'rows':[]};var _0xc34a3a=_['map'](db[_0x086d('0x23')]['rawAttributes'],function(_0xd1da74){return{'name':_0xd1da74[_0x086d('0x24')],'type':_0xd1da74[_0x086d('0x25')][_0x086d('0x26')]};});_0x5515ab[_0x086d('0x27')]=_['map'](_0xc34a3a,_0x086d('0x20'));_0x5515ab['query']=_[_0x086d('0x28')](_0x1ef173['query']);_0x5515ab[_0x086d('0x29')]=_['intersection'](_0x5515ab[_0x086d('0x27')],_0x5515ab['query']);_0x2a0cd3[_0x086d('0x2a')]=_['intersection'](_0x5515ab['model'],qs[_0x086d('0x2b')](_0x1ef173[_0x086d('0x2c')]['fields']));_0x2a0cd3[_0x086d('0x2a')]=_0x2a0cd3[_0x086d('0x2a')][_0x086d('0x2d')]?_0x2a0cd3[_0x086d('0x2a')]:_0x5515ab[_0x086d('0x27')];if(!_0x1ef173['query'][_0x086d('0x2e')](_0x086d('0x2f'))){_0x2a0cd3[_0x086d('0x18')]=qs[_0x086d('0x18')](_0x1ef173['query'][_0x086d('0x18')]);_0x2a0cd3[_0x086d('0x17')]=qs[_0x086d('0x17')](_0x1ef173['query'][_0x086d('0x17')]);}_0x2a0cd3[_0x086d('0x30')]=qs[_0x086d('0x31')](_0x1ef173[_0x086d('0x2c')][_0x086d('0x31')]);_0x2a0cd3['where']=qs['filters'](_[_0x086d('0x32')](_0x1ef173[_0x086d('0x2c')],_0x5515ab[_0x086d('0x29')]),_0xc34a3a);if(_0x1ef173[_0x086d('0x2c')]['filter']){_0x2a0cd3[_0x086d('0x33')]=_[_0x086d('0x34')](_0x2a0cd3[_0x086d('0x33')],{'$or':_[_0x086d('0x35')](_0xc34a3a,function(_0x26c02a){if(_0x26c02a[_0x086d('0x25')]!==_0x086d('0x36')){var _0x9e08fe={};_0x9e08fe[_0x26c02a['name']]={'$like':'%'+_0x1ef173['query']['filter']+'%'};return _0x9e08fe;}})});}_0x2a0cd3=_['merge']({},_0x2a0cd3,_0x1ef173[_0x086d('0x37')]);var _0x3d405a={'where':_0x2a0cd3[_0x086d('0x33')]};return db[_0x086d('0x23')]['count'](_0x3d405a)[_0x086d('0x1c')](function(_0x90c7af){_0x77170a[_0x086d('0x16')]=_0x90c7af;if(_0x1ef173[_0x086d('0x2c')]['includeAll']){_0x2a0cd3[_0x086d('0x38')]=[{'all':!![]}];}return db[_0x086d('0x23')]['findAll'](_0x2a0cd3);})[_0x086d('0x1c')](function(_0x2a5b7b){_0x77170a[_0x086d('0x39')]=_0x2a5b7b;return _0x77170a;})[_0x086d('0x1c')](respondWithFilteredResult(_0x1d794a,_0x2a0cd3))[_0x086d('0x3a')](handleError(_0x1d794a,null));};exports[_0x086d('0x3b')]=function(_0x319e9b,_0x4ec943){var _0x5b3199={'raw':![],'where':{'id':_0x319e9b[_0x086d('0x3c')]['id']}},_0x71ea92={};_0x71ea92[_0x086d('0x27')]=_[_0x086d('0x28')](db[_0x086d('0x23')][_0x086d('0x3d')]);_0x71ea92[_0x086d('0x2c')]=_[_0x086d('0x28')](_0x319e9b[_0x086d('0x2c')]);_0x71ea92[_0x086d('0x29')]=_[_0x086d('0x3e')](_0x71ea92[_0x086d('0x27')],_0x71ea92[_0x086d('0x2c')]);_0x5b3199[_0x086d('0x2a')]=_[_0x086d('0x3e')](_0x71ea92[_0x086d('0x27')],qs[_0x086d('0x2b')](_0x319e9b[_0x086d('0x2c')][_0x086d('0x2b')]));_0x5b3199['attributes']=_0x5b3199[_0x086d('0x2a')][_0x086d('0x2d')]?_0x5b3199[_0x086d('0x2a')]:_0x71ea92[_0x086d('0x27')];if(_0x319e9b[_0x086d('0x2c')]['includeAll']){_0x5b3199[_0x086d('0x38')]=[{'all':!![]}];}_0x5b3199=_[_0x086d('0x34')]({},_0x5b3199,_0x319e9b['options']);return db[_0x086d('0x23')][_0x086d('0x3f')](_0x5b3199)[_0x086d('0x1c')](handleEntityNotFound(_0x4ec943,null))[_0x086d('0x1c')](respondWithResult(_0x4ec943,null))['catch'](handleError(_0x4ec943,null));};exports['create']=function(_0xf5b990,_0x746a66){return db[_0x086d('0x23')]['create'](_0xf5b990[_0x086d('0x40')],{})[_0x086d('0x1c')](respondWithResult(_0x746a66,0xc9))[_0x086d('0x3a')](handleError(_0x746a66,null));};exports[_0x086d('0x41')]=function(_0x422305,_0x1d2e0b){if(_0x422305[_0x086d('0x40')]['id']){delete _0x422305['body']['id'];}return db[_0x086d('0x23')][_0x086d('0x3f')]({'where':{'id':_0x422305[_0x086d('0x3c')]['id']}})[_0x086d('0x1c')](handleEntityNotFound(_0x1d2e0b,null))[_0x086d('0x1c')](saveUpdates(_0x422305[_0x086d('0x40')],null))[_0x086d('0x1c')](respondWithResult(_0x1d2e0b,null))[_0x086d('0x3a')](handleError(_0x1d2e0b,null));};exports[_0x086d('0x1d')]=function(_0x3f1b7d,_0x1f2417){return db[_0x086d('0x23')][_0x086d('0x3f')]({'where':{'id':_0x3f1b7d[_0x086d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1f2417,null))[_0x086d('0x1c')](removeEntity(_0x1f2417,null))['catch'](handleError(_0x1f2417,null));};exports[_0x086d('0x42')]=function(_0x604b44,_0x504e9c){return db[_0x086d('0x23')]['describe']()[_0x086d('0x1c')](respondWithResult(_0x504e9c,null))[_0x086d('0x3a')](handleError(_0x504e9c,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index b988dc6..a3a2e9a 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 _0x60fe=['exports','define','VoiceAgentReport','report_agent','api','moment','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x4e192e,_0x54f7bf){var _0x195b34=function(_0x124f06){while(--_0x124f06){_0x4e192e['push'](_0x4e192e['shift']());}};_0x195b34(++_0x54f7bf);}(_0x60fe,0x176));var _0xe60f=function(_0x539709,_0x2c9edd){_0x539709=_0x539709-0x0;var _0x73cc7e=_0x60fe[_0x539709];return _0x73cc7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe60f('0x0'));var moment=require(_0xe60f('0x1'));var BPromise=require(_0xe60f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe60f('0x3'));var config=require(_0xe60f('0x4'));var attributes=require(_0xe60f('0x5'));module[_0xe60f('0x6')]=function(_0x10df6e,_0x1f585c){return _0x10df6e[_0xe60f('0x7')](_0xe60f('0x8'),attributes,{'tableName':_0xe60f('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf249=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','api','moment'];(function(_0x394d90,_0xbac20e){var _0x4b6870=function(_0x9b45f7){while(--_0x9b45f7){_0x394d90['push'](_0x394d90['shift']());}};_0x4b6870(++_0xbac20e);}(_0xf249,0x172));var _0x9f24=function(_0xee4e16,_0x4a5df0){_0xee4e16=_0xee4e16-0x0;var _0x37570d=_0xf249[_0xee4e16];return _0x37570d;};'use strict';var _=require(_0x9f24('0x0'));var util=require(_0x9f24('0x1'));var logger=require('../../config/logger')(_0x9f24('0x2'));var moment=require(_0x9f24('0x3'));var BPromise=require(_0x9f24('0x4'));var rp=require(_0x9f24('0x5'));var fs=require('fs');var path=require(_0x9f24('0x6'));var rimraf=require(_0x9f24('0x7'));var config=require(_0x9f24('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x9f24('0x9')]=function(_0x188fd9,_0x5ba79a){return _0x188fd9[_0x9f24('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 64de896..0c5ef71 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 _0xb95f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','attributes','limit','lodash','util','moment','ioredis'];(function(_0xdb0dfa,_0x58614e){var _0x1c7f4b=function(_0x430203){while(--_0x430203){_0xdb0dfa['push'](_0xdb0dfa['shift']());}};_0x1c7f4b(++_0x58614e);}(_0xb95f,0x11c));var _0xfb95=function(_0x58e899,_0x547284){_0x58e899=_0x58e899-0x0;var _0x34da9c=_0xb95f[_0x58e899];return _0x34da9c;};'use strict';var _=require(_0xfb95('0x0'));var util=require(_0xfb95('0x1'));var moment=require(_0xfb95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb95('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb95('0x4'));var logger=require(_0xfb95('0x5'))(_0xfb95('0x6'));var config=require(_0xfb95('0x7'));var jayson=require(_0xfb95('0x8'));var client=jayson[_0xfb95('0x9')][_0xfb95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12f460,_0x461f7c,_0x1dfc00){return new BPromise(function(_0x4ad205,_0x850b46){return client[_0xfb95('0xb')](_0x12f460,_0x1dfc00)[_0xfb95('0xc')](function(_0x2ef881){logger[_0xfb95('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x461f7c,_0xfb95('0xe'));logger[_0xfb95('0xf')](_0xfb95('0x10'),_0x461f7c,_0xfb95('0xe'),JSON[_0xfb95('0x11')](_0x2ef881));if(_0x2ef881[_0xfb95('0x12')]){if(_0x2ef881[_0xfb95('0x12')][_0xfb95('0x13')]===0x1f4){logger[_0xfb95('0x12')](_0xfb95('0x14'),_0x461f7c,_0x2ef881[_0xfb95('0x12')][_0xfb95('0x15')]);return _0x850b46(_0x2ef881[_0xfb95('0x12')]['message']);}logger[_0xfb95('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x461f7c,_0x2ef881['error'][_0xfb95('0x15')]);return _0x4ad205(_0x2ef881[_0xfb95('0x12')]['message']);}else{logger[_0xfb95('0xd')](_0xfb95('0x14'),_0x461f7c,_0xfb95('0xe'));_0x4ad205(_0x2ef881[_0xfb95('0x16')]['message']);}})[_0xfb95('0x17')](function(_0xec6984){logger['error'](_0xfb95('0x14'),_0x461f7c,_0xec6984);_0x850b46(_0xec6984);});});}exports['CreateVoiceAgentReport']=function(_0x1e6ef2){var _0x2a8c29=this;return new Promise(function(_0x351984,_0xef5734){return db['VoiceAgentReport']['create'](_0x1e6ef2[_0xfb95('0x18')],{'raw':_0x1e6ef2[_0xfb95('0x19')]?_0x1e6ef2[_0xfb95('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xfb95('0xc')](function(_0x3f604e){logger[_0xfb95('0xd')]('CreateVoiceAgentReport',_0x1e6ef2);logger[_0xfb95('0xf')](_0xfb95('0x1a'),_0x1e6ef2,JSON[_0xfb95('0x11')](_0x3f604e));_0x351984(_0x3f604e);})[_0xfb95('0x17')](function(_0x5aff71){logger['error'](_0xfb95('0x1a'),_0x5aff71[_0xfb95('0x15')],_0x1e6ef2);_0xef5734(_0x2a8c29['error'](0x1f4,_0x5aff71['message']));});});};exports[_0xfb95('0x1b')]=function(_0x18e368){var _0x21541f=this;return new Promise(function(_0x27e3a8,_0x188b00){return db[_0xfb95('0x1c')][_0xfb95('0x1d')](_0x18e368['body'],{'raw':_0x18e368[_0xfb95('0x19')]?_0x18e368['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18e368['options']?_0x18e368[_0xfb95('0x19')]['where']||null:null,'attributes':_0x18e368[_0xfb95('0x19')]?_0x18e368[_0xfb95('0x19')][_0xfb95('0x1e')]||null:null,'limit':_0x18e368[_0xfb95('0x19')]?_0x18e368[_0xfb95('0x19')][_0xfb95('0x1f')]||null:null})['then'](function(_0x143eb0){logger[_0xfb95('0xd')](_0xfb95('0x1b'),_0x18e368);logger['debug'](_0xfb95('0x1b'),_0x18e368,JSON[_0xfb95('0x11')](_0x143eb0));_0x27e3a8(_0x143eb0);})[_0xfb95('0x17')](function(_0x124291){logger[_0xfb95('0x12')](_0xfb95('0x1b'),_0x124291['message'],_0x18e368);_0x188b00(_0x21541f[_0xfb95('0x12')](0x1f4,_0x124291[_0xfb95('0x15')]));});});}; \ No newline at end of file +var _0xabca=['then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b9b34,_0x41c0f2){var _0x2e1a4=function(_0x57c151){while(--_0x57c151){_0x5b9b34['push'](_0x5b9b34['shift']());}};_0x2e1a4(++_0x41c0f2);}(_0xabca,0x94));var _0xaabc=function(_0x53c279,_0x46f50d){_0x53c279=_0x53c279-0x0;var _0x3b3f03=_0xabca[_0x53c279];return _0x3b3f03;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaabc('0x0'));var BPromise=require(_0xaabc('0x1'));var rs=require(_0xaabc('0x2'));var fs=require('fs');var Redis=require(_0xaabc('0x3'));var db=require(_0xaabc('0x4'))['db'];var utils=require(_0xaabc('0x5'));var logger=require(_0xaabc('0x6'))(_0xaabc('0x7'));var config=require(_0xaabc('0x8'));var jayson=require(_0xaabc('0x9'));var client=jayson[_0xaabc('0xa')][_0xaabc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45c8de,_0x39f08e,_0x3c606e){return new BPromise(function(_0x360dde,_0x1b5348){return client['request'](_0x45c8de,_0x3c606e)[_0xaabc('0xc')](function(_0x4e7024){logger['info'](_0xaabc('0xd'),_0x39f08e,_0xaabc('0xe'));logger[_0xaabc('0xf')](_0xaabc('0x10'),_0x39f08e,_0xaabc('0xe'),JSON[_0xaabc('0x11')](_0x4e7024));if(_0x4e7024[_0xaabc('0x12')]){if(_0x4e7024[_0xaabc('0x12')][_0xaabc('0x13')]===0x1f4){logger[_0xaabc('0x12')](_0xaabc('0xd'),_0x39f08e,_0x4e7024[_0xaabc('0x12')][_0xaabc('0x14')]);return _0x1b5348(_0x4e7024['error'][_0xaabc('0x14')]);}logger[_0xaabc('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x39f08e,_0x4e7024[_0xaabc('0x12')][_0xaabc('0x14')]);return _0x360dde(_0x4e7024[_0xaabc('0x12')][_0xaabc('0x14')]);}else{logger[_0xaabc('0x15')](_0xaabc('0xd'),_0x39f08e,_0xaabc('0xe'));_0x360dde(_0x4e7024[_0xaabc('0x16')][_0xaabc('0x14')]);}})[_0xaabc('0x17')](function(_0x855233){logger[_0xaabc('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x39f08e,_0x855233);_0x1b5348(_0x855233);});});}exports[_0xaabc('0x18')]=function(_0x31820b){var _0xcf67f=this;return new Promise(function(_0x164c19,_0x1fa33a){return db[_0xaabc('0x19')][_0xaabc('0x1a')](_0x31820b[_0xaabc('0x1b')],{'raw':_0x31820b[_0xaabc('0x1c')]?_0x31820b['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x36dce2){logger[_0xaabc('0x15')](_0xaabc('0x18'),_0x31820b);logger[_0xaabc('0xf')](_0xaabc('0x18'),_0x31820b,JSON['stringify'](_0x36dce2));_0x164c19(_0x36dce2);})['catch'](function(_0x22d761){logger[_0xaabc('0x12')]('CreateVoiceAgentReport',_0x22d761[_0xaabc('0x14')],_0x31820b);_0x1fa33a(_0xcf67f[_0xaabc('0x12')](0x1f4,_0x22d761['message']));});});};exports[_0xaabc('0x1d')]=function(_0x5d489d){var _0xc5d9a1=this;return new Promise(function(_0x12a54a,_0x1289ca){return db[_0xaabc('0x19')]['update'](_0x5d489d[_0xaabc('0x1b')],{'raw':_0x5d489d[_0xaabc('0x1c')]?_0x5d489d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d489d['options']?_0x5d489d[_0xaabc('0x1c')][_0xaabc('0x1e')]||null:null,'attributes':_0x5d489d[_0xaabc('0x1c')]?_0x5d489d[_0xaabc('0x1c')]['attributes']||null:null,'limit':_0x5d489d[_0xaabc('0x1c')]?_0x5d489d['options'][_0xaabc('0x1f')]||null:null})[_0xaabc('0xc')](function(_0x58022c){logger[_0xaabc('0x15')]('UpdateVoiceAgentReport',_0x5d489d);logger[_0xaabc('0xf')]('UpdateVoiceAgentReport',_0x5d489d,JSON[_0xaabc('0x11')](_0x58022c));_0x12a54a(_0x58022c);})[_0xaabc('0x17')](function(_0x3a9ff6){logger['error'](_0xaabc('0x1d'),_0x3a9ff6['message'],_0x5d489d);_0x1289ca(_0xc5d9a1[_0xaabc('0x12')](0x1f4,_0x3a9ff6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e906a19..51ba35f 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 _0xc88b=['/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x1c7502,_0x5d2c70){var _0x2165fa=function(_0x5a64a2){while(--_0x5a64a2){_0x1c7502['push'](_0x1c7502['shift']());}};_0x2165fa(++_0x5d2c70);}(_0xc88b,0x9c));var _0xbc88=function(_0x23bade,_0x4fd17e){_0x23bade=_0x23bade-0x0;var _0x4b6128=_0xc88b[_0x23bade];return _0x4b6128;};'use strict';var multer=require(_0xbc88('0x0'));var util=require(_0xbc88('0x1'));var path=require(_0xbc88('0x2'));var timeout=require(_0xbc88('0x3'));var express=require(_0xbc88('0x4'));var router=express[_0xbc88('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc88('0x6'));var config=require(_0xbc88('0x7'));var controller=require(_0xbc88('0x8'));router[_0xbc88('0x9')]('/',auth[_0xbc88('0xa')](),controller[_0xbc88('0xb')]);router[_0xbc88('0x9')](_0xbc88('0xc'),auth['isAuthenticated'](),controller[_0xbc88('0xd')]);router[_0xbc88('0x9')](_0xbc88('0xe'),auth[_0xbc88('0xa')](),controller[_0xbc88('0xf')]);router[_0xbc88('0x10')]('/',auth['isAuthenticated'](),controller[_0xbc88('0x11')]);router['put'](_0xbc88('0xe'),auth[_0xbc88('0xa')](),controller[_0xbc88('0x12')]);router[_0xbc88('0x13')](_0xbc88('0xe'),auth[_0xbc88('0xa')](),controller[_0xbc88('0x14')]);module['exports']=router; \ No newline at end of file +var _0xead8=['../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0xead8,0x173));var _0x8ead=function(_0x18a16d,_0x199976){_0x18a16d=_0x18a16d-0x0;var _0x21cf0c=_0xead8[_0x18a16d];return _0x21cf0c;};'use strict';var multer=require(_0x8ead('0x0'));var util=require(_0x8ead('0x1'));var path=require('path');var timeout=require(_0x8ead('0x2'));var express=require(_0x8ead('0x3'));var router=express[_0x8ead('0x4')]();var auth=require(_0x8ead('0x5'));var interaction=require(_0x8ead('0x6'));var config=require(_0x8ead('0x7'));var controller=require(_0x8ead('0x8'));router[_0x8ead('0x9')]('/',auth[_0x8ead('0xa')](),controller['index']);router[_0x8ead('0x9')](_0x8ead('0xb'),auth['isAuthenticated'](),controller[_0x8ead('0xc')]);router[_0x8ead('0x9')]('/:id',auth[_0x8ead('0xa')](),controller[_0x8ead('0xd')]);router[_0x8ead('0xe')]('/',auth[_0x8ead('0xa')](),controller[_0x8ead('0xf')]);router[_0x8ead('0x10')](_0x8ead('0x11'),auth['isAuthenticated'](),controller[_0x8ead('0x12')]);router[_0x8ead('0x13')](_0x8ead('0x11'),auth[_0x8ead('0xa')](),controller[_0x8ead('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 77f923f..ca8fd61 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 _0xfdbd=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports'];(function(_0xd5a9c8,_0x183ef0){var _0x25eecc=function(_0x475374){while(--_0x475374){_0xd5a9c8['push'](_0xd5a9c8['shift']());}};_0x25eecc(++_0x183ef0);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xfdbd[_0xe3e0af];return _0x4828e9;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'uniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'type':{'type':Sequelize[_0xdfdb('0x3')](_0xdfdb('0x4'),_0xdfdb('0x5'),_0xdfdb('0x6'),_0xdfdb('0x7'),_0xdfdb('0x8'),'dialer')},'tag':{'type':Sequelize[_0xdfdb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xdfdb('0x2')]},'destination':{'type':Sequelize[_0xdfdb('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xdfdb('0x2')]},'lastapplication':{'type':Sequelize[_0xdfdb('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xdfdb('0x9')]},'systemanswertime':{'type':Sequelize[_0xdfdb('0x9')]},'answertime':{'type':Sequelize[_0xdfdb('0x9')]},'endtime':{'type':Sequelize[_0xdfdb('0x9')]},'duration':{'type':Sequelize[_0xdfdb('0xa')]},'billableseconds':{'type':Sequelize[_0xdfdb('0xa')]},'mohtime':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xdfdb('0x2')]},'userfield':{'type':Sequelize[_0xdfdb('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xdfdb('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xdfdb('0x2')]},'note':{'type':Sequelize[_0xdfdb('0x2')]},'prefix':{'type':Sequelize[_0xdfdb('0x2')]},'routeid':{'type':Sequelize[_0xdfdb('0xa')]},'sipcallid':{'type':Sequelize[_0xdfdb('0x2')]}}; \ No newline at end of file +var _0x5fd1=['INTEGER','sequelize','STRING','ENUM','inbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x15ada9,_0x50f0a2){var _0x587361=function(_0x332a97){while(--_0x332a97){_0x15ada9['push'](_0x15ada9['shift']());}};_0x587361(++_0x50f0a2);}(_0x5fd1,0x155));var _0x15fd=function(_0x2f2c8a,_0x2e8530){_0x2f2c8a=_0x2f2c8a-0x0;var _0x257dcc=_0x5fd1[_0x2f2c8a];return _0x257dcc;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'type':{'type':Sequelize[_0x15fd('0x2')](_0x15fd('0x3'),'internal','outbound',_0x15fd('0x4'),_0x15fd('0x5'),_0x15fd('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'source':{'type':Sequelize[_0x15fd('0x1')]},'destination':{'type':Sequelize[_0x15fd('0x1')]},'destinationcontext':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x15fd('0x1')]},'lastapplication':{'type':Sequelize[_0x15fd('0x1')]},'lastdata':{'type':Sequelize[_0x15fd('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x15fd('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x15fd('0x8')]},'duration':{'type':Sequelize[_0x15fd('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x15fd('0x1')]},'userfield':{'type':Sequelize[_0x15fd('0x1')]},'userDisposition':{'type':Sequelize[_0x15fd('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x15fd('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x15fd('0x1')]},'note':{'type':Sequelize[_0x15fd('0x1')]},'prefix':{'type':Sequelize[_0x15fd('0x1')]},'routeid':{'type':Sequelize[_0x15fd('0x9')]},'sipcallid':{'type':Sequelize[_0x15fd('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3e0ddf8..81b10cb 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c57385b..c2e9b07 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 _0x2987=['./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x5f30b5,_0x44f528){var _0x37d206=function(_0x13c754){while(--_0x13c754){_0x5f30b5['push'](_0x5f30b5['shift']());}};_0x37d206(++_0x44f528);}(_0x2987,0x101));var _0x7298=function(_0x44c801,_0x5ad314){_0x44c801=_0x44c801-0x0;var _0x3f3468=_0x2987[_0x44c801];return _0x3f3468;};'use strict';var _=require(_0x7298('0x0'));var util=require(_0x7298('0x1'));var logger=require(_0x7298('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7298('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7298('0x4'));var rimraf=require(_0x7298('0x5'));var config=require(_0x7298('0x6'));var attributes=require(_0x7298('0x7'));module['exports']=function(_0x5ff126,_0x28a114){return _0x5ff126[_0x7298('0x8')](_0x7298('0x9'),attributes,{'tableName':_0x7298('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7298('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca37=['VoiceCallReport','report_call','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x190c49,_0x103457){var _0x475b9a=function(_0x44f13c){while(--_0x44f13c){_0x190c49['push'](_0x190c49['shift']());}};_0x475b9a(++_0x103457);}(_0xca37,0x160));var _0x7ca3=function(_0xf2d40,_0x4dafc0){_0xf2d40=_0xf2d40-0x0;var _0x4676bd=_0xca37[_0xf2d40];return _0x4676bd;};'use strict';var _=require(_0x7ca3('0x0'));var util=require('util');var logger=require(_0x7ca3('0x1'))(_0x7ca3('0x2'));var moment=require('moment');var BPromise=require(_0x7ca3('0x3'));var rp=require(_0x7ca3('0x4'));var fs=require('fs');var path=require(_0x7ca3('0x5'));var rimraf=require(_0x7ca3('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x7ca3('0x7')]=function(_0x278165,_0x40d6cf){return _0x278165['define'](_0x7ca3('0x8'),attributes,{'tableName':_0x7ca3('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e689ef6..40af492 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 _0xecdf=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceCallReport','findAll','options','where','attributes','limit','map','include','model','then','GetVoiceCallReport','stringify','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9117ad,_0x386be4){var _0x540f0c=function(_0x4e117a){while(--_0x4e117a){_0x9117ad['push'](_0x9117ad['shift']());}};_0x540f0c(++_0x386be4);}(_0xecdf,0x8f));var _0xfecd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xecdf[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xfecd('0x0'));var moment=require(_0xfecd('0x1'));var BPromise=require(_0xfecd('0x2'));var rs=require(_0xfecd('0x3'));var fs=require('fs');var Redis=require(_0xfecd('0x4'));var db=require(_0xfecd('0x5'))['db'];var utils=require(_0xfecd('0x6'));var logger=require(_0xfecd('0x7'))(_0xfecd('0x8'));var config=require('../../config/environment');var jayson=require(_0xfecd('0x9'));var client=jayson[_0xfecd('0xa')][_0xfecd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23bd3a,_0x10828b,_0x24c427){return new BPromise(function(_0x50077f,_0x428e7d){return client[_0xfecd('0xc')](_0x23bd3a,_0x24c427)['then'](function(_0x34ddbd){logger[_0xfecd('0xd')](_0xfecd('0xe'),_0x10828b,_0xfecd('0xf'));logger[_0xfecd('0x10')](_0xfecd('0x11'),_0x10828b,_0xfecd('0xf'),JSON['stringify'](_0x34ddbd));if(_0x34ddbd[_0xfecd('0x12')]){if(_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x13')]===0x1f4){logger[_0xfecd('0x12')](_0xfecd('0xe'),_0x10828b,_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x14')]);return _0x428e7d(_0x34ddbd[_0xfecd('0x12')]['message']);}logger[_0xfecd('0x12')](_0xfecd('0xe'),_0x10828b,_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x14')]);return _0x50077f(_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x14')]);}else{logger[_0xfecd('0xd')](_0xfecd('0xe'),_0x10828b,_0xfecd('0xf'));_0x50077f(_0x34ddbd['result'][_0xfecd('0x14')]);}})['catch'](function(_0x3637ab){logger[_0xfecd('0x12')](_0xfecd('0xe'),_0x10828b,_0x3637ab);_0x428e7d(_0x3637ab);});});}exports['GetVoiceCallReport']=function(_0x422178){var _0x19f4cf=this;return new Promise(function(_0x188ac6,_0x349353){return db[_0xfecd('0x15')][_0xfecd('0x16')]({'raw':_0x422178['options']?_0x422178[_0xfecd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x422178['options']?_0x422178[_0xfecd('0x17')][_0xfecd('0x18')]||null:null,'attributes':_0x422178[_0xfecd('0x17')]?_0x422178[_0xfecd('0x17')][_0xfecd('0x19')]||null:null,'limit':_0x422178[_0xfecd('0x17')]?_0x422178[_0xfecd('0x17')][_0xfecd('0x1a')]||null:null,'include':_0x422178[_0xfecd('0x17')]?_0x422178['options']['include']?_[_0xfecd('0x1b')](_0x422178[_0xfecd('0x17')][_0xfecd('0x1c')],function(_0x3a05c9){return{'model':db[_0x3a05c9[_0xfecd('0x1d')]],'as':_0x3a05c9['as'],'attributes':_0x3a05c9[_0xfecd('0x19')],'include':_0x3a05c9['include']?_[_0xfecd('0x1b')](_0x3a05c9['include'],function(_0x1e3120){return{'model':db[_0x1e3120[_0xfecd('0x1d')]],'as':_0x1e3120['as'],'attributes':_0x1e3120['attributes'],'include':_0x1e3120[_0xfecd('0x1c')]?_[_0xfecd('0x1b')](_0x1e3120[_0xfecd('0x1c')],function(_0x154a6a){return{'model':db[_0x154a6a[_0xfecd('0x1d')]],'as':_0x154a6a['as'],'attributes':_0x154a6a[_0xfecd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfecd('0x1e')](function(_0x1460c4){logger[_0xfecd('0xd')](_0xfecd('0x1f'),_0x422178);logger[_0xfecd('0x10')](_0xfecd('0x1f'),_0x422178,JSON[_0xfecd('0x20')](_0x1460c4));_0x188ac6(_0x1460c4);})[_0xfecd('0x21')](function(_0x1baace){logger[_0xfecd('0x12')](_0xfecd('0x1f'),_0x1baace[_0xfecd('0x14')],_0x422178);_0x349353(_0x19f4cf[_0xfecd('0x12')](0x1f4,_0x1baace[_0xfecd('0x14')]));});});};exports[_0xfecd('0x22')]=function(_0x19caef){var _0x49dd09=this;return new Promise(function(_0x46bfe5,_0x254dc2){return db['VoiceCallReport'][_0xfecd('0x23')](_0x19caef[_0xfecd('0x24')],{'raw':_0x19caef['options']?_0x19caef[_0xfecd('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xfecd('0x1e')](function(_0x568054){logger[_0xfecd('0xd')]('CreateVoiceCallReport',_0x19caef);logger[_0xfecd('0x10')](_0xfecd('0x22'),_0x19caef,JSON[_0xfecd('0x20')](_0x568054));_0x46bfe5(_0x568054);})[_0xfecd('0x21')](function(_0x50e4f9){logger[_0xfecd('0x12')]('CreateVoiceCallReport',_0x50e4f9['message'],_0x19caef);_0x254dc2(_0x49dd09[_0xfecd('0x12')](0x1f4,_0x50e4f9[_0xfecd('0x14')]));});});};exports[_0xfecd('0x25')]=function(_0x1b3a60){var _0x464800=this;return new Promise(function(_0x5e874c,_0x327a91){return db[_0xfecd('0x15')][_0xfecd('0x26')](_0x1b3a60['body'],{'raw':_0x1b3a60[_0xfecd('0x17')]?_0x1b3a60['options'][_0xfecd('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b3a60['options']?_0x1b3a60[_0xfecd('0x17')][_0xfecd('0x18')]||null:null,'attributes':_0x1b3a60[_0xfecd('0x17')]?_0x1b3a60['options'][_0xfecd('0x19')]||null:null,'limit':_0x1b3a60[_0xfecd('0x17')]?_0x1b3a60[_0xfecd('0x17')][_0xfecd('0x1a')]||null:null})[_0xfecd('0x1e')](function(_0x21e518){logger['info'](_0xfecd('0x25'),_0x1b3a60);logger[_0xfecd('0x10')](_0xfecd('0x25'),_0x1b3a60,JSON[_0xfecd('0x20')](_0x21e518));_0x5e874c(_0x21e518);})[_0xfecd('0x21')](function(_0xded5e2){logger[_0xfecd('0x12')](_0xfecd('0x25'),_0xded5e2[_0xfecd('0x14')],_0x1b3a60);_0x327a91(_0x464800[_0xfecd('0x12')](0x1f4,_0xded5e2[_0xfecd('0x14')]));});});}; \ No newline at end of file +var _0x9e3d=['CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','raw','options','where','attributes','limit','map','include','model','then','debug','VoiceCallReport','body'];(function(_0x31919d,_0x17512e){var _0x1ce999=function(_0xd277c0){while(--_0xd277c0){_0x31919d['push'](_0x31919d['shift']());}};_0x1ce999(++_0x17512e);}(_0x9e3d,0x1be));var _0xd9e3=function(_0x2e63ef,_0x150cba){_0x2e63ef=_0x2e63ef-0x0;var _0x582539=_0x9e3d[_0x2e63ef];return _0x582539;};'use strict';var _=require(_0xd9e3('0x0'));var util=require(_0xd9e3('0x1'));var moment=require('moment');var BPromise=require(_0xd9e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e3('0x3'));var db=require(_0xd9e3('0x4'))['db'];var utils=require(_0xd9e3('0x5'));var logger=require(_0xd9e3('0x6'))('rpc');var config=require(_0xd9e3('0x7'));var jayson=require(_0xd9e3('0x8'));var client=jayson['client'][_0xd9e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27e756,_0x5b035f,_0x5be4b9){return new BPromise(function(_0x570ddf,_0x93a9bb){return client[_0xd9e3('0xa')](_0x27e756,_0x5be4b9)['then'](function(_0x4635b8){logger[_0xd9e3('0xb')](_0xd9e3('0xc'),_0x5b035f,_0xd9e3('0xd'));logger['debug'](_0xd9e3('0xe'),_0x5b035f,_0xd9e3('0xd'),JSON[_0xd9e3('0xf')](_0x4635b8));if(_0x4635b8[_0xd9e3('0x10')]){if(_0x4635b8[_0xd9e3('0x10')][_0xd9e3('0x11')]===0x1f4){logger[_0xd9e3('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5b035f,_0x4635b8['error'][_0xd9e3('0x12')]);return _0x93a9bb(_0x4635b8['error'][_0xd9e3('0x12')]);}logger[_0xd9e3('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5b035f,_0x4635b8[_0xd9e3('0x10')][_0xd9e3('0x12')]);return _0x570ddf(_0x4635b8['error'][_0xd9e3('0x12')]);}else{logger[_0xd9e3('0xb')](_0xd9e3('0xc'),_0x5b035f,_0xd9e3('0xd'));_0x570ddf(_0x4635b8[_0xd9e3('0x13')][_0xd9e3('0x12')]);}})[_0xd9e3('0x14')](function(_0x31a97d){logger[_0xd9e3('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5b035f,_0x31a97d);_0x93a9bb(_0x31a97d);});});}exports[_0xd9e3('0x15')]=function(_0x5c55d6){var _0x38e8e0=this;return new Promise(function(_0x38c9c2,_0x2efa34){return db['VoiceCallReport'][_0xd9e3('0x16')]({'raw':_0x5c55d6['options']?_0x5c55d6['options'][_0xd9e3('0x17')]===undefined?!![]:![]:!![],'where':_0x5c55d6['options']?_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x19')]||null:null,'attributes':_0x5c55d6[_0xd9e3('0x18')]?_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x1a')]||null:null,'limit':_0x5c55d6[_0xd9e3('0x18')]?_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x1b')]||null:null,'include':_0x5c55d6['options']?_0x5c55d6[_0xd9e3('0x18')]['include']?_[_0xd9e3('0x1c')](_0x5c55d6[_0xd9e3('0x18')][_0xd9e3('0x1d')],function(_0x55cf93){return{'model':db[_0x55cf93[_0xd9e3('0x1e')]],'as':_0x55cf93['as'],'attributes':_0x55cf93[_0xd9e3('0x1a')],'include':_0x55cf93[_0xd9e3('0x1d')]?_['map'](_0x55cf93[_0xd9e3('0x1d')],function(_0x58c254){return{'model':db[_0x58c254[_0xd9e3('0x1e')]],'as':_0x58c254['as'],'attributes':_0x58c254[_0xd9e3('0x1a')],'include':_0x58c254['include']?_[_0xd9e3('0x1c')](_0x58c254[_0xd9e3('0x1d')],function(_0x28babc){return{'model':db[_0x28babc['model']],'as':_0x28babc['as'],'attributes':_0x28babc[_0xd9e3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd9e3('0x1f')](function(_0x1a46af){logger['info'](_0xd9e3('0x15'),_0x5c55d6);logger[_0xd9e3('0x20')](_0xd9e3('0x15'),_0x5c55d6,JSON[_0xd9e3('0xf')](_0x1a46af));_0x38c9c2(_0x1a46af);})[_0xd9e3('0x14')](function(_0x4c1845){logger[_0xd9e3('0x10')](_0xd9e3('0x15'),_0x4c1845[_0xd9e3('0x12')],_0x5c55d6);_0x2efa34(_0x38e8e0['error'](0x1f4,_0x4c1845['message']));});});};exports['CreateVoiceCallReport']=function(_0x1ce396){var _0x177150=this;return new Promise(function(_0x33533d,_0x22e643){return db[_0xd9e3('0x21')]['create'](_0x1ce396[_0xd9e3('0x22')],{'raw':_0x1ce396['options']?_0x1ce396[_0xd9e3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd9e3('0x1f')](function(_0x1d14ee){logger['info']('CreateVoiceCallReport',_0x1ce396);logger['debug'](_0xd9e3('0x23'),_0x1ce396,JSON[_0xd9e3('0xf')](_0x1d14ee));_0x33533d(_0x1d14ee);})[_0xd9e3('0x14')](function(_0x2c5e7f){logger['error']('CreateVoiceCallReport',_0x2c5e7f[_0xd9e3('0x12')],_0x1ce396);_0x22e643(_0x177150[_0xd9e3('0x10')](0x1f4,_0x2c5e7f[_0xd9e3('0x12')]));});});};exports[_0xd9e3('0x24')]=function(_0x105b8c){var _0x17e9a6=this;return new Promise(function(_0x3af597,_0x4f6282){return db[_0xd9e3('0x21')]['update'](_0x105b8c[_0xd9e3('0x22')],{'raw':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c[_0xd9e3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c['options'][_0xd9e3('0x19')]||null:null,'attributes':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c[_0xd9e3('0x18')][_0xd9e3('0x1a')]||null:null,'limit':_0x105b8c[_0xd9e3('0x18')]?_0x105b8c['options'][_0xd9e3('0x1b')]||null:null})['then'](function(_0x2c2f6f){logger[_0xd9e3('0xb')]('UpdateVoiceCallReport',_0x105b8c);logger[_0xd9e3('0x20')]('UpdateVoiceCallReport',_0x105b8c,JSON[_0xd9e3('0xf')](_0x2c2f6f));_0x3af597(_0x2c2f6f);})['catch'](function(_0x4a17ea){logger[_0xd9e3('0x10')](_0xd9e3('0x24'),_0x4a17ea[_0xd9e3('0x12')],_0x105b8c);_0x4f6282(_0x17e9a6['error'](0x1f4,_0x4a17ea[_0xd9e3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 39c912b..d962a8b 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 _0xfbaf=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x23bc0f,_0x37b33a){var _0x1cb38e=function(_0x5e22a9){while(--_0x5e22a9){_0x23bc0f['push'](_0x23bc0f['shift']());}};_0x1cb38e(++_0x37b33a);}(_0xfbaf,0xcb));var _0xffba=function(_0x26360e,_0x3ebad8){_0x26360e=_0x26360e-0x0;var _0x3bdaf9=_0xfbaf[_0x26360e];return _0x3bdaf9;};'use strict';var multer=require(_0xffba('0x0'));var util=require(_0xffba('0x1'));var path=require('path');var timeout=require(_0xffba('0x2'));var express=require(_0xffba('0x3'));var router=express['Router']();var auth=require(_0xffba('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xffba('0x5'));var controller=require(_0xffba('0x6'));router[_0xffba('0x7')]('/',auth[_0xffba('0x8')](),controller[_0xffba('0x9')]);router[_0xffba('0x7')](_0xffba('0xa'),auth[_0xffba('0x8')](),controller[_0xffba('0xb')]);router[_0xffba('0xc')]('/',auth[_0xffba('0x8')](),controller[_0xffba('0xd')]);router[_0xffba('0xe')]('/:id',auth[_0xffba('0x8')](),controller[_0xffba('0xf')]);router[_0xffba('0x10')]('/:id',auth[_0xffba('0x8')](),controller[_0xffba('0x11')]);module[_0xffba('0x12')]=router; \ No newline at end of file +var _0x1caf=['destroy','multer','path','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','show','create','put','delete'];(function(_0x17256e,_0x48f146){var _0x44be7c=function(_0x36b851){while(--_0x36b851){_0x17256e['push'](_0x17256e['shift']());}};_0x44be7c(++_0x48f146);}(_0x1caf,0x1e1));var _0xf1ca=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x1caf[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0xf1ca('0x0'));var util=require('util');var path=require(_0xf1ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf1ca('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf1ca('0x3'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf1ca('0x4')]);router['get'](_0xf1ca('0x5'),auth[_0xf1ca('0x6')](),controller[_0xf1ca('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf1ca('0x8')]);router[_0xf1ca('0x9')](_0xf1ca('0x5'),auth['isAuthenticated'](),controller['update']);router[_0xf1ca('0xa')](_0xf1ca('0x5'),auth[_0xf1ca('0x6')](),controller[_0xf1ca('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c7337ae..ab281bf 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 _0xd020=['options','join','getDataValue','split','BOOLEAN','STRING','setDataValue'];(function(_0x3209fe,_0x2bb16b){var _0x11897d=function(_0x2bc4b9){while(--_0x2bc4b9){_0x3209fe['push'](_0x3209fe['shift']());}};_0x11897d(++_0x2bb16b);}(_0xd020,0x147));var _0x0d02=function(_0x216b8a,_0x459a11){_0x216b8a=_0x216b8a-0x0;var _0x344626=_0xd020[_0x216b8a];return _0x344626;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0d02('0x0')]},'prefix':{'type':Sequelize[_0x0d02('0x0')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x0d02('0x0')],'set':function(_0x40f591){this[_0x0d02('0x1')](_0x0d02('0x2'),_0x40f591?_0x40f591[_0x0d02('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x0d02('0x2'))?this[_0x0d02('0x4')](_0x0d02('0x2'))[_0x0d02('0x5')](''):[];}},'auth':{'type':Sequelize[_0x0d02('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x0d02('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0d02('0x0')]}}; \ No newline at end of file +var _0xc516=['BOOLEAN','sequelize','exports','STRING','setDataValue','join','getDataValue','options','split'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xc516,0x118));var _0x6c51=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xc516[_0x5a7d5f];return _0x5dcded;};'use strict';var Sequelize=require(_0x6c51('0x0'));module[_0x6c51('0x1')]={'name':{'type':Sequelize[_0x6c51('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x6c51('0x2')],'set':function(_0xa93701){this[_0x6c51('0x3')]('options',_0xa93701?_0xa93701[_0x6c51('0x4')](''):[]);},'get':function(){return this[_0x6c51('0x5')](_0x6c51('0x6'))?this[_0x6c51('0x5')](_0x6c51('0x6'))[_0x6c51('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6c51('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6c51('0x2')]},'record':{'type':Sequelize[_0x6c51('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6c51('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index fbfd52f..2dc1312 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 _0x4092=['keys','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x4092,0xaf));var _0x2409=function(_0x2e5249,_0xa4eed1){_0x2e5249=_0x2e5249-0x0;var _0x3f59fc=_0x4092[_0x2e5249];return _0x3f59fc;};'use strict';var pdf=require(_0x2409('0x0'));var emlformat=require(_0x2409('0x1'));var rimraf=require(_0x2409('0x2'));var zipdir=require(_0x2409('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2409('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2409('0x5'));var sox=require(_0x2409('0x6'));var csv=require(_0x2409('0x7'));var ejs=require(_0x2409('0x8'));var fs=require('fs');var _=require(_0x2409('0x9'));var squel=require(_0x2409('0xa'));var crypto=require(_0x2409('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2409('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2409('0xd'));var Papa=require(_0x2409('0xe'));var Redis=require(_0x2409('0xf'));var authService=require(_0x2409('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2409('0x11'));var logger=require(_0x2409('0x12'))('api');var utils=require(_0x2409('0x13'));var config=require(_0x2409('0x14'));var licenseUtil=require(_0x2409('0x15'));var db=require(_0x2409('0x16'))['db'];function respondWithStatusCode(_0x305d5f,_0x28cb74){_0x28cb74=_0x28cb74||0xcc;return function(_0xef14f8){if(_0xef14f8){return _0x305d5f[_0x2409('0x17')](_0x28cb74);}return _0x305d5f[_0x2409('0x18')](_0x28cb74)[_0x2409('0x19')]();};}function respondWithResult(_0x5be378,_0x469314){_0x469314=_0x469314||0xc8;return function(_0x5085da){if(_0x5085da){return _0x5be378[_0x2409('0x18')](_0x469314)['json'](_0x5085da);}};}function respondWithFilteredResult(_0x338bbc,_0xdaea49){return function(_0x30ca08){if(_0x30ca08){var _0x157e04=_0x30ca08[_0x2409('0x1a')],_0xd8e47=_0xdaea49[_0x2409('0x1b')],_0x4b7ca0=_0xdaea49['offset']+_0xdaea49[_0x2409('0x1c')],_0x1b9abd;if(_0x4b7ca0>=_0x157e04){_0x4b7ca0=_0x157e04;_0x1b9abd=0xc8;}else{_0x1b9abd=0xce;}_0x338bbc[_0x2409('0x18')](_0x1b9abd);return _0x338bbc['set']('Content-Range',_0xd8e47+'-'+_0x4b7ca0+'/'+_0x157e04)['json'](_0x30ca08);}return null;};}function patchUpdates(_0xfdcd4){return function(_0xec96ed){try{jsonpatch[_0x2409('0x1d')](_0xec96ed,_0xfdcd4,!![]);}catch(_0x6429c7){return BPromise[_0x2409('0x1e')](_0x6429c7);}return _0xec96ed['save']();};}function saveUpdates(_0x34d2d6,_0x4e47f7){return function(_0x275734){if(_0x275734){return _0x275734['update'](_0x34d2d6)[_0x2409('0x1f')](function(_0x1c4c8a){return _0x1c4c8a;});}return null;};}function removeEntity(_0x4cfe26,_0x15dfe0){return function(_0x4b9032){if(_0x4b9032){return _0x4b9032[_0x2409('0x20')]()[_0x2409('0x1f')](function(){var _0x2d9db2=_0x4b9032[_0x2409('0x21')]({'plain':!![]});var _0x41f4db='ChanSpies';return db[_0x2409('0x22')]['destroy']({'where':{'type':_0x41f4db,'resourceId':_0x2d9db2['id']}})[_0x2409('0x1f')](function(){return _0x4b9032;});})[_0x2409('0x1f')](function(){_0x4cfe26['status'](0xcc)[_0x2409('0x19')]();});}};}function handleEntityNotFound(_0x598e99,_0x42a88d){return function(_0x33be80){if(!_0x33be80){_0x598e99[_0x2409('0x17')](0x194);}return _0x33be80;};}function handleError(_0x13b279,_0x46ff08){_0x46ff08=_0x46ff08||0x1f4;return function(_0x58310a){logger[_0x2409('0x23')](_0x58310a[_0x2409('0x24')]);if(_0x58310a[_0x2409('0x25')]){delete _0x58310a[_0x2409('0x25')];}_0x13b279['status'](_0x46ff08)[_0x2409('0x26')](_0x58310a);};}exports[_0x2409('0x27')]=function(_0xc00466,_0x232061){var _0x5a5032={},_0x4a7851={},_0x415eb4={'count':0x0,'rows':[]};var _0x2e16ed=_['map'](db[_0x2409('0x28')][_0x2409('0x29')],function(_0x23c9aa){return{'name':_0x23c9aa[_0x2409('0x2a')],'type':_0x23c9aa['type'][_0x2409('0x2b')]};});_0x4a7851[_0x2409('0x2c')]=_[_0x2409('0x2d')](_0x2e16ed,_0x2409('0x25'));_0x4a7851[_0x2409('0x2e')]=_['keys'](_0xc00466[_0x2409('0x2e')]);_0x4a7851[_0x2409('0x2f')]=_[_0x2409('0x30')](_0x4a7851['model'],_0x4a7851['query']);_0x5a5032[_0x2409('0x31')]=_['intersection'](_0x4a7851[_0x2409('0x2c')],qs[_0x2409('0x32')](_0xc00466[_0x2409('0x2e')][_0x2409('0x32')]));_0x5a5032[_0x2409('0x31')]=_0x5a5032[_0x2409('0x31')][_0x2409('0x33')]?_0x5a5032[_0x2409('0x31')]:_0x4a7851['model'];if(!_0xc00466['query'][_0x2409('0x34')](_0x2409('0x35'))){_0x5a5032[_0x2409('0x1c')]=qs[_0x2409('0x1c')](_0xc00466[_0x2409('0x2e')][_0x2409('0x1c')]);_0x5a5032[_0x2409('0x1b')]=qs[_0x2409('0x1b')](_0xc00466['query'][_0x2409('0x1b')]);}_0x5a5032[_0x2409('0x36')]=qs[_0x2409('0x37')](_0xc00466[_0x2409('0x2e')][_0x2409('0x37')]);_0x5a5032[_0x2409('0x38')]=qs[_0x2409('0x2f')](_['pick'](_0xc00466[_0x2409('0x2e')],_0x4a7851[_0x2409('0x2f')]),_0x2e16ed);if(_0xc00466[_0x2409('0x2e')][_0x2409('0x39')]){_0x5a5032[_0x2409('0x38')]=_[_0x2409('0x3a')](_0x5a5032[_0x2409('0x38')],{'$or':_['map'](_0x2e16ed,function(_0x42f9a0){if(_0x42f9a0[_0x2409('0x3b')]!==_0x2409('0x3c')){var _0x515087={};_0x515087[_0x42f9a0[_0x2409('0x25')]]={'$like':'%'+_0xc00466[_0x2409('0x2e')]['filter']+'%'};return _0x515087;}})});}_0x5a5032=_['merge']({},_0x5a5032,_0xc00466[_0x2409('0x3d')]);var _0x4cc724={'where':_0x5a5032[_0x2409('0x38')]};return db['VoiceChanSpy'][_0x2409('0x1a')](_0x4cc724)['then'](function(_0x58d2bb){_0x415eb4[_0x2409('0x1a')]=_0x58d2bb;if(_0xc00466[_0x2409('0x2e')][_0x2409('0x3e')]){_0x5a5032['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x2409('0x3f')](_0x5a5032);})['then'](function(_0x27538b){_0x415eb4[_0x2409('0x40')]=_0x27538b;return _0x415eb4;})[_0x2409('0x1f')](respondWithFilteredResult(_0x232061,_0x5a5032))[_0x2409('0x41')](handleError(_0x232061,null));};exports[_0x2409('0x42')]=function(_0x39dbfd,_0x3c8e8a){var _0x186db5={'raw':![],'where':{'id':_0x39dbfd[_0x2409('0x43')]['id']}},_0x19106a={};_0x19106a[_0x2409('0x2c')]=_[_0x2409('0x44')](db['VoiceChanSpy']['rawAttributes']);_0x19106a[_0x2409('0x2e')]=_['keys'](_0x39dbfd[_0x2409('0x2e')]);_0x19106a[_0x2409('0x2f')]=_[_0x2409('0x30')](_0x19106a['model'],_0x19106a[_0x2409('0x2e')]);_0x186db5[_0x2409('0x31')]=_[_0x2409('0x30')](_0x19106a[_0x2409('0x2c')],qs[_0x2409('0x32')](_0x39dbfd[_0x2409('0x2e')][_0x2409('0x32')]));_0x186db5[_0x2409('0x31')]=_0x186db5[_0x2409('0x31')][_0x2409('0x33')]?_0x186db5['attributes']:_0x19106a['model'];if(_0x39dbfd[_0x2409('0x2e')]['includeAll']){_0x186db5[_0x2409('0x45')]=[{'all':!![]}];}_0x186db5=_[_0x2409('0x3a')]({},_0x186db5,_0x39dbfd[_0x2409('0x3d')]);return db[_0x2409('0x28')][_0x2409('0x46')](_0x186db5)[_0x2409('0x1f')](handleEntityNotFound(_0x3c8e8a,null))['then'](respondWithResult(_0x3c8e8a,null))[_0x2409('0x41')](handleError(_0x3c8e8a,null));};exports['create']=function(_0x2edc20,_0x3c46d4){return db[_0x2409('0x28')]['create'](_0x2edc20[_0x2409('0x47')],{})[_0x2409('0x1f')](function(_0x131a0c){var _0x54b4bd=_0x2edc20['user']['get']({'plain':!![]});if(!_0x54b4bd)throw new Error(_0x2409('0x48'));if(_0x54b4bd[_0x2409('0x49')]===_0x2409('0x4a')){var _0x10c43b=_0x131a0c['get']({'plain':!![]});var _0x59b736=_0x2409('0x4b');return db[_0x2409('0x4c')]['find']({'where':{'name':_0x59b736,'userProfileId':_0x54b4bd[_0x2409('0x4d')]},'raw':!![]})[_0x2409('0x1f')](function(_0x4db70f){if(_0x4db70f&&_0x4db70f[_0x2409('0x4e')]===0x0){return db['UserProfileResource'][_0x2409('0x4f')]({'name':_0x10c43b['name'],'resourceId':_0x10c43b['id'],'type':_0x4db70f[_0x2409('0x25')],'sectionId':_0x4db70f['id']},{})[_0x2409('0x1f')](function(){return _0x131a0c;});}else{return _0x131a0c;}})[_0x2409('0x41')](function(_0x3a138e){logger[_0x2409('0x23')](_0x2409('0x50'),_0x3a138e);throw _0x3a138e;});}return _0x131a0c;})[_0x2409('0x1f')](respondWithResult(_0x3c46d4,0xc9))[_0x2409('0x41')](handleError(_0x3c46d4,null));};exports['update']=function(_0x3cf755,_0x8f0e73){if(_0x3cf755[_0x2409('0x47')]['id']){delete _0x3cf755[_0x2409('0x47')]['id'];}return db[_0x2409('0x28')][_0x2409('0x46')]({'where':{'id':_0x3cf755[_0x2409('0x43')]['id']}})[_0x2409('0x1f')](handleEntityNotFound(_0x8f0e73,null))[_0x2409('0x1f')](saveUpdates(_0x3cf755['body'],null))['then'](respondWithResult(_0x8f0e73,null))[_0x2409('0x41')](handleError(_0x8f0e73,null));};exports[_0x2409('0x20')]=function(_0x2a19a9,_0x589ad6){return db[_0x2409('0x28')][_0x2409('0x46')]({'where':{'id':_0x2a19a9['params']['id']}})['then'](handleEntityNotFound(_0x589ad6,null))[_0x2409('0x1f')](removeEntity(_0x589ad6,null))[_0x2409('0x41')](handleError(_0x589ad6,null));}; \ No newline at end of file +var _0x83cb=['index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceChanSpy','findAll','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','ChanSpies','UserProfileResource','then','error','name','send'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x83cb,0x11f));var _0xb83c=function(_0x488814,_0x3fec59){_0x488814=_0x488814-0x0;var _0x58138b=_0x83cb[_0x488814];return _0x58138b;};'use strict';var pdf=require(_0xb83c('0x0'));var emlformat=require(_0xb83c('0x1'));var rimraf=require(_0xb83c('0x2'));var zipdir=require(_0xb83c('0x3'));var jsonpatch=require(_0xb83c('0x4'));var rp=require(_0xb83c('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb83c('0x6'));var util=require('util');var path=require(_0xb83c('0x7'));var sox=require(_0xb83c('0x8'));var csv=require(_0xb83c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb83c('0xa'));var squel=require(_0xb83c('0xb'));var crypto=require(_0xb83c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb83c('0xd'));var toCsv=require(_0xb83c('0x9'));var querystring=require(_0xb83c('0xe'));var Papa=require('papaparse');var Redis=require(_0xb83c('0xf'));var authService=require(_0xb83c('0x10'));var qs=require(_0xb83c('0x11'));var as=require(_0xb83c('0x12'));var hardwareService=require(_0xb83c('0x13'));var logger=require(_0xb83c('0x14'))('api');var utils=require(_0xb83c('0x15'));var config=require(_0xb83c('0x16'));var licenseUtil=require(_0xb83c('0x17'));var db=require(_0xb83c('0x18'))['db'];function respondWithStatusCode(_0xc83411,_0x56e255){_0x56e255=_0x56e255||0xcc;return function(_0x49e1ce){if(_0x49e1ce){return _0xc83411[_0xb83c('0x19')](_0x56e255);}return _0xc83411[_0xb83c('0x1a')](_0x56e255)[_0xb83c('0x1b')]();};}function respondWithResult(_0x556366,_0x57d61d){_0x57d61d=_0x57d61d||0xc8;return function(_0x232101){if(_0x232101){return _0x556366['status'](_0x57d61d)[_0xb83c('0x1c')](_0x232101);}};}function respondWithFilteredResult(_0x1e9e31,_0x5f3cd1){return function(_0xfef76c){if(_0xfef76c){var _0x4f8d01=_0xfef76c[_0xb83c('0x1d')],_0xb2b5ae=_0x5f3cd1[_0xb83c('0x1e')],_0x5dbd58=_0x5f3cd1['offset']+_0x5f3cd1[_0xb83c('0x1f')],_0x1aff82;if(_0x5dbd58>=_0x4f8d01){_0x5dbd58=_0x4f8d01;_0x1aff82=0xc8;}else{_0x1aff82=0xce;}_0x1e9e31[_0xb83c('0x1a')](_0x1aff82);return _0x1e9e31[_0xb83c('0x20')](_0xb83c('0x21'),_0xb2b5ae+'-'+_0x5dbd58+'/'+_0x4f8d01)[_0xb83c('0x1c')](_0xfef76c);}return null;};}function patchUpdates(_0x5cb5d2){return function(_0x542cde){try{jsonpatch[_0xb83c('0x22')](_0x542cde,_0x5cb5d2,!![]);}catch(_0x4ace71){return BPromise[_0xb83c('0x23')](_0x4ace71);}return _0x542cde['save']();};}function saveUpdates(_0x3410aa,_0x435fcb){return function(_0x3dccfa){if(_0x3dccfa){return _0x3dccfa[_0xb83c('0x24')](_0x3410aa)['then'](function(_0x568f36){return _0x568f36;});}return null;};}function removeEntity(_0x4f21ef,_0x26b8c3){return function(_0x3aa25b){if(_0x3aa25b){return _0x3aa25b[_0xb83c('0x25')]()['then'](function(){var _0x592870=_0x3aa25b[_0xb83c('0x26')]({'plain':!![]});var _0xdf9e76=_0xb83c('0x27');return db[_0xb83c('0x28')][_0xb83c('0x25')]({'where':{'type':_0xdf9e76,'resourceId':_0x592870['id']}})[_0xb83c('0x29')](function(){return _0x3aa25b;});})['then'](function(){_0x4f21ef[_0xb83c('0x1a')](0xcc)[_0xb83c('0x1b')]();});}};}function handleEntityNotFound(_0x36fdd7,_0x1232e2){return function(_0x554c0c){if(!_0x554c0c){_0x36fdd7['sendStatus'](0x194);}return _0x554c0c;};}function handleError(_0x16c047,_0x3d6a9b){_0x3d6a9b=_0x3d6a9b||0x1f4;return function(_0x2d4ce7){logger[_0xb83c('0x2a')](_0x2d4ce7['stack']);if(_0x2d4ce7[_0xb83c('0x2b')]){delete _0x2d4ce7[_0xb83c('0x2b')];}_0x16c047[_0xb83c('0x1a')](_0x3d6a9b)[_0xb83c('0x2c')](_0x2d4ce7);};}exports[_0xb83c('0x2d')]=function(_0x1e0735,_0x5a4032){var _0x25ed3f={},_0x40b600={},_0x3e6e90={'count':0x0,'rows':[]};var _0x341cfd=_[_0xb83c('0x2e')](db['VoiceChanSpy'][_0xb83c('0x2f')],function(_0x4b7539){return{'name':_0x4b7539[_0xb83c('0x30')],'type':_0x4b7539[_0xb83c('0x31')][_0xb83c('0x32')]};});_0x40b600['model']=_['map'](_0x341cfd,'name');_0x40b600[_0xb83c('0x33')]=_[_0xb83c('0x34')](_0x1e0735['query']);_0x40b600[_0xb83c('0x35')]=_['intersection'](_0x40b600[_0xb83c('0x36')],_0x40b600[_0xb83c('0x33')]);_0x25ed3f[_0xb83c('0x37')]=_['intersection'](_0x40b600['model'],qs[_0xb83c('0x38')](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x38')]));_0x25ed3f[_0xb83c('0x37')]=_0x25ed3f[_0xb83c('0x37')][_0xb83c('0x39')]?_0x25ed3f[_0xb83c('0x37')]:_0x40b600[_0xb83c('0x36')];if(!_0x1e0735['query']['hasOwnProperty'](_0xb83c('0x3a'))){_0x25ed3f[_0xb83c('0x1f')]=qs['limit'](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x1f')]);_0x25ed3f[_0xb83c('0x1e')]=qs[_0xb83c('0x1e')](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x1e')]);}_0x25ed3f['order']=qs[_0xb83c('0x3b')](_0x1e0735[_0xb83c('0x33')][_0xb83c('0x3b')]);_0x25ed3f[_0xb83c('0x3c')]=qs[_0xb83c('0x35')](_[_0xb83c('0x3d')](_0x1e0735[_0xb83c('0x33')],_0x40b600[_0xb83c('0x35')]),_0x341cfd);if(_0x1e0735[_0xb83c('0x33')][_0xb83c('0x3e')]){_0x25ed3f[_0xb83c('0x3c')]=_[_0xb83c('0x3f')](_0x25ed3f[_0xb83c('0x3c')],{'$or':_[_0xb83c('0x2e')](_0x341cfd,function(_0x9bbfb8){if(_0x9bbfb8[_0xb83c('0x31')]!==_0xb83c('0x40')){var _0xfd7c8b={};_0xfd7c8b[_0x9bbfb8[_0xb83c('0x2b')]]={'$like':'%'+_0x1e0735[_0xb83c('0x33')][_0xb83c('0x3e')]+'%'};return _0xfd7c8b;}})});}_0x25ed3f=_[_0xb83c('0x3f')]({},_0x25ed3f,_0x1e0735[_0xb83c('0x41')]);var _0x3c3384={'where':_0x25ed3f['where']};return db['VoiceChanSpy'][_0xb83c('0x1d')](_0x3c3384)[_0xb83c('0x29')](function(_0xeae298){_0x3e6e90[_0xb83c('0x1d')]=_0xeae298;if(_0x1e0735[_0xb83c('0x33')][_0xb83c('0x42')]){_0x25ed3f[_0xb83c('0x43')]=[{'all':!![]}];}return db[_0xb83c('0x44')][_0xb83c('0x45')](_0x25ed3f);})[_0xb83c('0x29')](function(_0x2ab5f0){_0x3e6e90['rows']=_0x2ab5f0;return _0x3e6e90;})['then'](respondWithFilteredResult(_0x5a4032,_0x25ed3f))[_0xb83c('0x46')](handleError(_0x5a4032,null));};exports['show']=function(_0xa6e6ec,_0x1805b4){var _0x1b0b1f={'raw':![],'where':{'id':_0xa6e6ec[_0xb83c('0x47')]['id']}},_0x114a60={};_0x114a60[_0xb83c('0x36')]=_[_0xb83c('0x34')](db['VoiceChanSpy']['rawAttributes']);_0x114a60[_0xb83c('0x33')]=_[_0xb83c('0x34')](_0xa6e6ec[_0xb83c('0x33')]);_0x114a60[_0xb83c('0x35')]=_['intersection'](_0x114a60[_0xb83c('0x36')],_0x114a60[_0xb83c('0x33')]);_0x1b0b1f[_0xb83c('0x37')]=_[_0xb83c('0x48')](_0x114a60['model'],qs[_0xb83c('0x38')](_0xa6e6ec['query'][_0xb83c('0x38')]));_0x1b0b1f[_0xb83c('0x37')]=_0x1b0b1f[_0xb83c('0x37')][_0xb83c('0x39')]?_0x1b0b1f[_0xb83c('0x37')]:_0x114a60[_0xb83c('0x36')];if(_0xa6e6ec['query'][_0xb83c('0x42')]){_0x1b0b1f[_0xb83c('0x43')]=[{'all':!![]}];}_0x1b0b1f=_[_0xb83c('0x3f')]({},_0x1b0b1f,_0xa6e6ec[_0xb83c('0x41')]);return db[_0xb83c('0x44')][_0xb83c('0x49')](_0x1b0b1f)[_0xb83c('0x29')](handleEntityNotFound(_0x1805b4,null))[_0xb83c('0x29')](respondWithResult(_0x1805b4,null))['catch'](handleError(_0x1805b4,null));};exports[_0xb83c('0x4a')]=function(_0x527f6c,_0x4be780){return db['VoiceChanSpy'][_0xb83c('0x4a')](_0x527f6c[_0xb83c('0x4b')],{})['then'](function(_0x3cce6b){var _0x5b2e8f=_0x527f6c[_0xb83c('0x4c')]['get']({'plain':!![]});if(!_0x5b2e8f)throw new Error(_0xb83c('0x4d'));if(_0x5b2e8f[_0xb83c('0x4e')]===_0xb83c('0x4c')){var _0x26cab8=_0x3cce6b['get']({'plain':!![]});var _0x3d9069=_0xb83c('0x27');return db[_0xb83c('0x4f')][_0xb83c('0x49')]({'where':{'name':_0x3d9069,'userProfileId':_0x5b2e8f[_0xb83c('0x50')]},'raw':!![]})['then'](function(_0x259dfd){if(_0x259dfd&&_0x259dfd[_0xb83c('0x51')]===0x0){return db[_0xb83c('0x28')][_0xb83c('0x4a')]({'name':_0x26cab8[_0xb83c('0x2b')],'resourceId':_0x26cab8['id'],'type':_0x259dfd['name'],'sectionId':_0x259dfd['id']},{})['then'](function(){return _0x3cce6b;});}else{return _0x3cce6b;}})[_0xb83c('0x46')](function(_0x2e8945){logger[_0xb83c('0x2a')](_0xb83c('0x52'),_0x2e8945);throw _0x2e8945;});}return _0x3cce6b;})[_0xb83c('0x29')](respondWithResult(_0x4be780,0xc9))[_0xb83c('0x46')](handleError(_0x4be780,null));};exports[_0xb83c('0x24')]=function(_0x3884a6,_0x27dbf6){if(_0x3884a6[_0xb83c('0x4b')]['id']){delete _0x3884a6['body']['id'];}return db[_0xb83c('0x44')][_0xb83c('0x49')]({'where':{'id':_0x3884a6['params']['id']}})[_0xb83c('0x29')](handleEntityNotFound(_0x27dbf6,null))['then'](saveUpdates(_0x3884a6[_0xb83c('0x4b')],null))[_0xb83c('0x29')](respondWithResult(_0x27dbf6,null))[_0xb83c('0x46')](handleError(_0x27dbf6,null));};exports[_0xb83c('0x25')]=function(_0x271478,_0x161ff3){return db[_0xb83c('0x44')][_0xb83c('0x49')]({'where':{'id':_0x271478[_0xb83c('0x47')]['id']}})[_0xb83c('0x29')](handleEntityNotFound(_0x161ff3,null))[_0xb83c('0x29')](removeEntity(_0x161ff3,null))[_0xb83c('0x46')](handleError(_0x161ff3,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 457fa11..1d1dd92 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 _0x51f4=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','password','SIP/%s,%s','name','options','join','concat','agent','catch','models','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','length','lodash','util','bluebird','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy'];(function(_0x31b287,_0xdc3071){var _0x12f98d=function(_0x5cf48e){while(--_0x5cf48e){_0x31b287['push'](_0x31b287['shift']());}};_0x12f98d(++_0xdc3071);}(_0x51f4,0x1c2));var _0x451f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x51f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x451f('0x0'));var util=require(_0x451f('0x1'));var BPromise=require(_0x451f('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xace018,_0x444171,_0x1e75d1){var _0x48f14d=0x1;var _0x2e4ede=[];var _0x4dcf23={'context':_0x444171[_0x451f('0x3')]||_0x451f('0x4'),'exten':util[_0x451f('0x5')]('%s%s',_0xace018[_0x451f('0x6')],_0x1e75d1),'type':_0x451f('0x7'),'isApp':![],'ChanSpyId':_0xace018['id'],'UserId':_0x444171['id']};_0x2e4ede[_0x451f('0x8')](_['merge']({'app':_0x451f('0x9'),'appdata':util[_0x451f('0x5')](_0x451f('0xa'),_0x451f('0xb')),'priority':_0x48f14d++},_0x4dcf23));if(_0xace018['record']){_0x2e4ede[_0x451f('0x8')](_['merge']({'app':_0x451f('0xc'),'appdata':util[_0x451f('0x5')](_0x451f('0xd'),_0xace018[_0x451f('0xe')]),'priority':_0x48f14d++},_0x4dcf23));}if(_0xace018[_0x451f('0xf')]){_0x2e4ede[_0x451f('0x8')](_[_0x451f('0x10')]({'app':'Authenticate','appdata':_0xace018[_0x451f('0x11')],'priority':_0x48f14d++},_0x4dcf23));}_0x2e4ede[_0x451f('0x8')](_[_0x451f('0x10')]({'app':'ChanSpy','appdata':util[_0x451f('0x5')](_0x451f('0x12'),_0x444171[_0x451f('0x13')],_0xace018[_0x451f('0x14')]?_0xace018['options'][_0x451f('0x15')](''):''),'priority':_0x48f14d++},_0x4dcf23));if(_0xace018['record']){_0x2e4ede[_0x451f('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x48f14d++},_0x4dcf23));}return _0x2e4ede;};var getChanSpyApplications=function(_0x242390,_0x522b9c){var _0x18ca77=[];for(var _0x53b34a=0x0,_0x5a6605=0x1;_0x53b34a<_0x522b9c['length'];_0x53b34a++,_0x5a6605=0x1){_0x18ca77=_0x18ca77[_0x451f('0x16')](getUserApplications(_0x242390,_0x522b9c[_0x53b34a],_0x522b9c[_0x53b34a]['internal']));if(_0x522b9c[_0x53b34a]['internal']!=_0x522b9c[_0x53b34a][_0x451f('0x13')]){_0x18ca77=_0x18ca77[_0x451f('0x16')](getUserApplications(_0x242390,_0x522b9c[_0x53b34a],_0x522b9c[_0x53b34a][_0x451f('0x13')]));}}return _0x18ca77;};var getChanSpyPromise=function(_0x54774e,_0x15896f){return new BPromise(function(_0x2d6281,_0x29ad73){return _0x54774e['User']['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x451f('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2182a3){if(_0x2182a3){return _0x2d6281(getChanSpyApplications(_0x15896f,_0x2182a3));}return _0x2d6281([]);})[_0x451f('0x18')](function(_0x5b762b){_0x29ad73(_0x5b762b);});});};module['exports']=function(_0x5f5589,_0x4b051b){var _0x74fe04=_0x5f5589[_0x451f('0x19')];return _0x5f5589['define'](_0x451f('0x1a'),attributes,{'tableName':_0x451f('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd8ce4,_0x2f2d45,_0x2fcb00){return getChanSpyPromise(_0x74fe04,_0xd8ce4)[_0x451f('0x1c')](function(_0x2e85e1){if(_0x2e85e1&&_0x2e85e1['length']){return _0x74fe04['VoiceExtension'][_0x451f('0x1d')](_0x2e85e1);}})[_0x451f('0x1c')](function(){_0x2fcb00();})[_0x451f('0x18')](function(_0x5a215a){_0x2fcb00(_0x5a215a);});},'afterUpdate':function(_0x12d19f,_0x53bf4a,_0x4492e0){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1f')]({'where':{'ChanSpyId':_0x12d19f['id']}})[_0x451f('0x1c')](function(){return getChanSpyPromise(_0x74fe04,_0x12d19f);})[_0x451f('0x1c')](function(_0x4d4071){if(_0x4d4071&&_0x4d4071[_0x451f('0x20')]){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1d')](_0x4d4071);}})[_0x451f('0x1c')](function(){_0x4492e0();})[_0x451f('0x18')](function(_0xd40efe){_0x4492e0(_0xd40efe);});},'afterDestroy':function(_0x154ce1,_0x3dcd93,_0x1eb65d){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1f')]({'where':{'ChanSpyId':_0x154ce1['id']}})[_0x451f('0x1c')](function(){_0x1eb65d();})[_0x451f('0x18')](function(_0x5c2bfd){_0x1eb65d(_0x5c2bfd);});}}});}; \ No newline at end of file +var _0x682e=['Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth'];(function(_0x7df4cb,_0x5d824d){var _0x10b458=function(_0x16c220){while(--_0x16c220){_0x7df4cb['push'](_0x7df4cb['shift']());}};_0x10b458(++_0x5d824d);}(_0x682e,0x119));var _0xe682=function(_0x10d022,_0x584e10){_0x10d022=_0x10d022-0x0;var _0x1d72c7=_0x682e[_0x10d022];return _0x1d72c7;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var BPromise=require(_0xe682('0x1'));var attributes=require(_0xe682('0x2'));var getUserApplications=function(_0x19be16,_0x106a11,_0x449cca){var _0x2f6e97=0x1;var _0x24e27f=[];var _0x2b636c={'context':_0x106a11[_0xe682('0x3')]||_0xe682('0x4'),'exten':util[_0xe682('0x5')]('%s%s',_0x19be16[_0xe682('0x6')],_0x449cca),'type':_0xe682('0x7'),'isApp':![],'ChanSpyId':_0x19be16['id'],'UserId':_0x106a11['id']};_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':'Set','appdata':util[_0xe682('0x5')](_0xe682('0xa'),_0xe682('0xb')),'priority':_0x2f6e97++},_0x2b636c));if(_0x19be16[_0xe682('0xc')]){_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':'MixMonitor','appdata':util[_0xe682('0x5')](_0xe682('0xd'),_0x19be16['recordingFormat']),'priority':_0x2f6e97++},_0x2b636c));}if(_0x19be16[_0xe682('0xe')]){_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':_0xe682('0xf'),'appdata':_0x19be16[_0xe682('0x10')],'priority':_0x2f6e97++},_0x2b636c));}_0x24e27f[_0xe682('0x8')](_[_0xe682('0x9')]({'app':'ChanSpy','appdata':util[_0xe682('0x5')](_0xe682('0x11'),_0x106a11[_0xe682('0x12')],_0x19be16[_0xe682('0x13')]?_0x19be16[_0xe682('0x13')][_0xe682('0x14')](''):''),'priority':_0x2f6e97++},_0x2b636c));if(_0x19be16[_0xe682('0xc')]){_0x24e27f['push'](_['merge']({'app':_0xe682('0x15'),'priority':_0x2f6e97++},_0x2b636c));}return _0x24e27f;};var getChanSpyApplications=function(_0xd0f68e,_0xaf406e){var _0x4df79a=[];for(var _0x11b0aa=0x0,_0x2c12ff=0x1;_0x11b0aa<_0xaf406e[_0xe682('0x16')];_0x11b0aa++,_0x2c12ff=0x1){_0x4df79a=_0x4df79a[_0xe682('0x17')](getUserApplications(_0xd0f68e,_0xaf406e[_0x11b0aa],_0xaf406e[_0x11b0aa]['internal']));if(_0xaf406e[_0x11b0aa][_0xe682('0x18')]!=_0xaf406e[_0x11b0aa][_0xe682('0x12')]){_0x4df79a=_0x4df79a['concat'](getUserApplications(_0xd0f68e,_0xaf406e[_0x11b0aa],_0xaf406e[_0x11b0aa]['name']));}}return _0x4df79a;};var getChanSpyPromise=function(_0x46b2f0,_0x3e824c){return new BPromise(function(_0x161f58,_0x2f3915){return _0x46b2f0[_0xe682('0x19')][_0xe682('0x1a')]({'attributes':['id','name',_0xe682('0x18')],'where':{'role':_0xe682('0x1b'),'chanspy':!![]},'raw':!![]})[_0xe682('0x1c')](function(_0x194c24){if(_0x194c24){return _0x161f58(getChanSpyApplications(_0x3e824c,_0x194c24));}return _0x161f58([]);})['catch'](function(_0x4d5bd4){_0x2f3915(_0x4d5bd4);});});};module[_0xe682('0x1d')]=function(_0x5456c3,_0x10ada7){var _0x3bc14c=_0x5456c3['models'];return _0x5456c3[_0xe682('0x1e')](_0xe682('0x1f'),attributes,{'tableName':_0xe682('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x380234,_0x549250,_0x4d2909){return getChanSpyPromise(_0x3bc14c,_0x380234)[_0xe682('0x1c')](function(_0x427a63){if(_0x427a63&&_0x427a63[_0xe682('0x16')]){return _0x3bc14c[_0xe682('0x21')][_0xe682('0x22')](_0x427a63);}})[_0xe682('0x1c')](function(){_0x4d2909();})[_0xe682('0x23')](function(_0x232f2d){_0x4d2909(_0x232f2d);});},'afterUpdate':function(_0x4f9a8d,_0x1edf45,_0x1b0818){return _0x3bc14c[_0xe682('0x21')]['destroy']({'where':{'ChanSpyId':_0x4f9a8d['id']}})['then'](function(){return getChanSpyPromise(_0x3bc14c,_0x4f9a8d);})[_0xe682('0x1c')](function(_0x2d5132){if(_0x2d5132&&_0x2d5132[_0xe682('0x16')]){return _0x3bc14c['VoiceExtension'][_0xe682('0x22')](_0x2d5132);}})[_0xe682('0x1c')](function(){_0x1b0818();})[_0xe682('0x23')](function(_0x5b4545){_0x1b0818(_0x5b4545);});},'afterDestroy':function(_0x4e057d,_0x513c7a,_0x5134ea){return _0x3bc14c['VoiceExtension'][_0xe682('0x24')]({'where':{'ChanSpyId':_0x4e057d['id']}})[_0xe682('0x1c')](function(){_0x5134ea();})[_0xe682('0x23')](function(_0xcd6b0){_0x5134ea(_0xcd6b0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4765302..6857e80 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 _0x4393=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4393,0x139));var _0x3439=function(_0x54d395,_0x104967){_0x54d395=_0x54d395-0x0;var _0x3db071=_0x4393[_0x54d395];return _0x3db071;};'use strict';var _=require('lodash');var util=require(_0x3439('0x0'));var moment=require(_0x3439('0x1'));var BPromise=require(_0x3439('0x2'));var rs=require(_0x3439('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3439('0x4'))['db'];var utils=require(_0x3439('0x5'));var logger=require(_0x3439('0x6'))(_0x3439('0x7'));var config=require(_0x3439('0x8'));var jayson=require(_0x3439('0x9'));var client=jayson[_0x3439('0xa')][_0x3439('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ff01f,_0x969431,_0x5a1307){return new BPromise(function(_0x40e2b9,_0x5bc38b){return client[_0x3439('0xc')](_0x4ff01f,_0x5a1307)[_0x3439('0xd')](function(_0x39f305){logger[_0x3439('0xe')](_0x3439('0xf'),_0x969431,_0x3439('0x10'));logger[_0x3439('0x11')](_0x3439('0x12'),_0x969431,_0x3439('0x10'),JSON[_0x3439('0x13')](_0x39f305));if(_0x39f305[_0x3439('0x14')]){if(_0x39f305[_0x3439('0x14')]['code']===0x1f4){logger['error'](_0x3439('0xf'),_0x969431,_0x39f305[_0x3439('0x14')]['message']);return _0x5bc38b(_0x39f305[_0x3439('0x14')]['message']);}logger[_0x3439('0x14')](_0x3439('0xf'),_0x969431,_0x39f305[_0x3439('0x14')][_0x3439('0x15')]);return _0x40e2b9(_0x39f305[_0x3439('0x14')][_0x3439('0x15')]);}else{logger[_0x3439('0xe')](_0x3439('0xf'),_0x969431,_0x3439('0x10'));_0x40e2b9(_0x39f305[_0x3439('0x16')][_0x3439('0x15')]);}})[_0x3439('0x17')](function(_0x15812e){logger[_0x3439('0x14')](_0x3439('0xf'),_0x969431,_0x15812e);_0x5bc38b(_0x15812e);});});} \ No newline at end of file +var _0x7ac2=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0x585044,_0x1bee79){var _0x3ff468=function(_0x3220a4){while(--_0x3220a4){_0x585044['push'](_0x585044['shift']());}};_0x3ff468(++_0x1bee79);}(_0x7ac2,0xca));var _0x27ac=function(_0x283802,_0x29807b){_0x283802=_0x283802-0x0;var _0x3104b3=_0x7ac2[_0x283802];return _0x3104b3;};'use strict';var _=require(_0x27ac('0x0'));var util=require(_0x27ac('0x1'));var moment=require(_0x27ac('0x2'));var BPromise=require(_0x27ac('0x3'));var rs=require(_0x27ac('0x4'));var fs=require('fs');var Redis=require(_0x27ac('0x5'));var db=require(_0x27ac('0x6'))['db'];var utils=require(_0x27ac('0x7'));var logger=require(_0x27ac('0x8'))(_0x27ac('0x9'));var config=require('../../config/environment');var jayson=require(_0x27ac('0xa'));var client=jayson[_0x27ac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54df41,_0x53ae29,_0x495049){return new BPromise(function(_0x349767,_0x3a47c0){return client[_0x27ac('0xc')](_0x54df41,_0x495049)[_0x27ac('0xd')](function(_0x1163d9){logger[_0x27ac('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x53ae29,_0x27ac('0xf'));logger[_0x27ac('0x10')](_0x27ac('0x11'),_0x53ae29,'request\x20sent',JSON[_0x27ac('0x12')](_0x1163d9));if(_0x1163d9[_0x27ac('0x13')]){if(_0x1163d9[_0x27ac('0x13')][_0x27ac('0x14')]===0x1f4){logger['error'](_0x27ac('0x15'),_0x53ae29,_0x1163d9[_0x27ac('0x13')]['message']);return _0x3a47c0(_0x1163d9[_0x27ac('0x13')]['message']);}logger[_0x27ac('0x13')](_0x27ac('0x15'),_0x53ae29,_0x1163d9[_0x27ac('0x13')][_0x27ac('0x16')]);return _0x349767(_0x1163d9['error']['message']);}else{logger[_0x27ac('0xe')](_0x27ac('0x15'),_0x53ae29,_0x27ac('0xf'));_0x349767(_0x1163d9[_0x27ac('0x17')][_0x27ac('0x16')]);}})[_0x27ac('0x18')](function(_0x51fbd4){logger[_0x27ac('0x13')](_0x27ac('0x15'),_0x53ae29,_0x51fbd4);_0x3a47c0(_0x51fbd4);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 35ba939..e38e90e 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 _0xc594=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x5e2151,_0x53a474){var _0x56885d=function(_0x394553){while(--_0x394553){_0x5e2151['push'](_0x5e2151['shift']());}};_0x56885d(++_0x53a474);}(_0xc594,0x151));var _0x4c59=function(_0x4ab5aa,_0x568fb4){_0x4ab5aa=_0x4ab5aa-0x0;var _0x135c93=_0xc594[_0x4ab5aa];return _0x135c93;};'use strict';var multer=require(_0x4c59('0x0'));var util=require(_0x4c59('0x1'));var path=require(_0x4c59('0x2'));var timeout=require(_0x4c59('0x3'));var express=require(_0x4c59('0x4'));var router=express[_0x4c59('0x5')]();var auth=require(_0x4c59('0x6'));var interaction=require(_0x4c59('0x7'));var config=require(_0x4c59('0x8'));var controller=require(_0x4c59('0x9'));router[_0x4c59('0xa')]('/',auth[_0x4c59('0xb')](),controller['index']);router['get']('/:id',auth[_0x4c59('0xb')](),controller[_0x4c59('0xc')]);router[_0x4c59('0xd')]('/',auth[_0x4c59('0xb')](),controller[_0x4c59('0xe')]);router[_0x4c59('0xf')](_0x4c59('0x10'),auth['isAuthenticated'](),controller[_0x4c59('0x11')]);router[_0x4c59('0x12')](_0x4c59('0x10'),auth[_0x4c59('0xb')](),controller[_0x4c59('0x13')]);module[_0x4c59('0x14')]=router; \ No newline at end of file +var _0x2b32=['create','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x1e5ff4,_0x4e4d54){var _0x14a510=function(_0x11b30d){while(--_0x11b30d){_0x1e5ff4['push'](_0x1e5ff4['shift']());}};_0x14a510(++_0x4e4d54);}(_0x2b32,0x16f));var _0x22b3=function(_0x21cd08,_0x16cd11){_0x21cd08=_0x21cd08-0x0;var _0x1d77ba=_0x2b32[_0x21cd08];return _0x1d77ba;};'use strict';var multer=require(_0x22b3('0x0'));var util=require('util');var path=require(_0x22b3('0x1'));var timeout=require(_0x22b3('0x2'));var express=require(_0x22b3('0x3'));var router=express[_0x22b3('0x4')]();var auth=require(_0x22b3('0x5'));var interaction=require(_0x22b3('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x22b3('0x7')]('/',auth[_0x22b3('0x8')](),controller['index']);router[_0x22b3('0x7')](_0x22b3('0x9'),auth[_0x22b3('0x8')](),controller[_0x22b3('0xa')]);router['post']('/',auth[_0x22b3('0x8')](),controller[_0x22b3('0xb')]);router['put'](_0x22b3('0x9'),auth[_0x22b3('0x8')](),controller[_0x22b3('0xc')]);router['delete'](_0x22b3('0x9'),auth[_0x22b3('0x8')](),controller[_0x22b3('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 132e30f..efb88ce 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x2c5fbb,_0x25165f){var _0x2dddb5=function(_0x1af264){while(--_0x1af264){_0x2c5fbb['push'](_0x2c5fbb['shift']());}};_0x2dddb5(++_0x25165f);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x502cb2,_0x556594){var _0x12a5b7=function(_0x4a0754){while(--_0x4a0754){_0x502cb2['push'](_0x502cb2['shift']());}};_0x12a5b7(++_0x556594);}(_0x34e8,0x12c));var _0x834e=function(_0xc3a841,_0x55628d){_0xc3a841=_0xc3a841-0x0;var _0x1af893=_0x34e8[_0xc3a841];return _0x1af893;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index e6d5287..b81bb62 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 _0x9063=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','render','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','rawAttributes','intersection','find','create','body','join','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x9063,0x1a2));var _0x3906=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x9063[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0x3906('0x0'));var emlformat=require(_0x3906('0x1'));var rimraf=require(_0x3906('0x2'));var zipdir=require(_0x3906('0x3'));var jsonpatch=require(_0x3906('0x4'));var rp=require(_0x3906('0x5'));var moment=require(_0x3906('0x6'));var BPromise=require(_0x3906('0x7'));var Mustache=require('mustache');var util=require(_0x3906('0x8'));var path=require(_0x3906('0x9'));var sox=require(_0x3906('0xa'));var csv=require(_0x3906('0xb'));var ejs=require(_0x3906('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3906('0xd'));var deskjs=require(_0x3906('0xe'));var toCsv=require(_0x3906('0xb'));var querystring=require('querystring');var Papa=require(_0x3906('0xf'));var Redis=require(_0x3906('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3906('0x11'));var as=require(_0x3906('0x12'));var hardwareService=require(_0x3906('0x13'));var logger=require('../../config/logger')(_0x3906('0x14'));var utils=require(_0x3906('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3906('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3906('0x17')][_0x3906('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x490696,_0x59a437,_0x18e220,_0x3e69a4){return new BPromise(function(_0x4a741f,_0x57d5e4){var _0x11c2f8=_0x3e69a4||client;return _0x11c2f8[_0x3906('0x19')](_0x490696,_0x18e220)[_0x3906('0x1a')](function(_0x28211f){logger[_0x3906('0x1b')](_0x3906('0x1c'),_0x59a437,_0x3906('0x1d'));logger[_0x3906('0x1e')](_0x3906('0x1f'),_0x59a437,_0x3906('0x1d'),JSON['stringify'](_0x28211f));if(_0x28211f[_0x3906('0x20')]){if(_0x28211f['error'][_0x3906('0x21')]===0x1f4){logger[_0x3906('0x20')](_0x3906('0x1c'),_0x59a437,_0x28211f[_0x3906('0x20')]['message']);return _0x57d5e4(_0x28211f[_0x3906('0x20')][_0x3906('0x22')]);}logger[_0x3906('0x20')](_0x3906('0x1c'),_0x59a437,_0x28211f[_0x3906('0x20')]['message']);return _0x4a741f(_0x28211f[_0x3906('0x20')][_0x3906('0x22')]);}else{logger[_0x3906('0x1b')](_0x3906('0x1c'),_0x59a437,'request\x20sent');_0x4a741f(_0x28211f[_0x3906('0x23')][_0x3906('0x22')]);}})[_0x3906('0x24')](function(_0x342ff9){logger['error']('VoiceContext,\x20%s,\x20%s',_0x59a437,_0x342ff9);_0x57d5e4(_0x342ff9);});});}function respondWithStatusCode(_0x2027ee,_0x33edf1){_0x33edf1=_0x33edf1||0xcc;return function(_0x343821){if(_0x343821){return _0x2027ee[_0x3906('0x25')](_0x33edf1);}return _0x2027ee['status'](_0x33edf1)[_0x3906('0x26')]();};}function respondWithResult(_0x233a79,_0x5a471c){_0x5a471c=_0x5a471c||0xc8;return function(_0x4a2eea){if(_0x4a2eea){return _0x233a79[_0x3906('0x27')](_0x5a471c)[_0x3906('0x28')](_0x4a2eea);}};}function respondWithFilteredResult(_0x30f75b,_0x5911af){return function(_0x150d6b){if(_0x150d6b){var _0x26370d=_0x150d6b[_0x3906('0x29')],_0x118827=_0x5911af['offset'],_0x1909cf=_0x5911af[_0x3906('0x2a')]+_0x5911af['limit'],_0x53d2fc;if(_0x1909cf>=_0x26370d){_0x1909cf=_0x26370d;_0x53d2fc=0xc8;}else{_0x53d2fc=0xce;}_0x30f75b['status'](_0x53d2fc);return _0x30f75b[_0x3906('0x2b')](_0x3906('0x2c'),_0x118827+'-'+_0x1909cf+'/'+_0x26370d)[_0x3906('0x28')](_0x150d6b);}return null;};}function patchUpdates(_0x4878db){return function(_0x5bace2){try{jsonpatch[_0x3906('0x2d')](_0x5bace2,_0x4878db,!![]);}catch(_0x1c8d3b){return BPromise[_0x3906('0x2e')](_0x1c8d3b);}return _0x5bace2[_0x3906('0x2f')]();};}function saveUpdates(_0x2e266a,_0x289660){return function(_0x482bb1){if(_0x482bb1){return _0x482bb1[_0x3906('0x30')](_0x2e266a)[_0x3906('0x1a')](function(_0x51e04f){return _0x51e04f;});}return null;};}function removeEntity(_0x50eaa0,_0x191e30){return function(_0x566f1d){if(_0x566f1d){return _0x566f1d[_0x3906('0x31')]()[_0x3906('0x1a')](function(){var _0x4e618a=_0x566f1d[_0x3906('0x32')]({'plain':!![]});var _0x12afb1=_0x3906('0x33');return db[_0x3906('0x34')][_0x3906('0x31')]({'where':{'type':_0x12afb1,'resourceId':_0x4e618a['id']}})[_0x3906('0x1a')](function(){return _0x566f1d;});})[_0x3906('0x1a')](function(){_0x50eaa0[_0x3906('0x27')](0xcc)[_0x3906('0x26')]();});}};}function handleEntityNotFound(_0x2092f2,_0x5c5d5b){return function(_0x43f2c0){if(!_0x43f2c0){_0x2092f2[_0x3906('0x25')](0x194);}return _0x43f2c0;};}function handleError(_0x114883,_0x1f93c5){_0x1f93c5=_0x1f93c5||0x1f4;return function(_0x4aa6fd){logger[_0x3906('0x20')](_0x4aa6fd[_0x3906('0x35')]);if(_0x4aa6fd[_0x3906('0x36')]){delete _0x4aa6fd[_0x3906('0x36')];}_0x114883[_0x3906('0x27')](_0x1f93c5)[_0x3906('0x37')](_0x4aa6fd);};}exports[_0x3906('0x38')]=function(_0x2b01e8,_0x19d5b0){var _0x3ba3a3={},_0x273199={},_0x3610f1={'count':0x0,'rows':[]};var _0x2889e0=_[_0x3906('0x39')](db['VoiceContext']['rawAttributes'],function(_0x15f028){return{'name':_0x15f028[_0x3906('0x3a')],'type':_0x15f028['type'][_0x3906('0x3b')]};});_0x273199[_0x3906('0x3c')]=_['map'](_0x2889e0,_0x3906('0x36'));_0x273199[_0x3906('0x3d')]=_[_0x3906('0x3e')](_0x2b01e8['query']);_0x273199[_0x3906('0x3f')]=_['intersection'](_0x273199[_0x3906('0x3c')],_0x273199['query']);_0x3ba3a3[_0x3906('0x40')]=_['intersection'](_0x273199['model'],qs[_0x3906('0x41')](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x41')]));_0x3ba3a3[_0x3906('0x40')]=_0x3ba3a3['attributes'][_0x3906('0x42')]?_0x3ba3a3[_0x3906('0x40')]:_0x273199[_0x3906('0x3c')];if(!_0x2b01e8[_0x3906('0x3d')][_0x3906('0x43')]('nolimit')){_0x3ba3a3[_0x3906('0x44')]=qs['limit'](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x44')]);_0x3ba3a3['offset']=qs['offset'](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x2a')]);}_0x3ba3a3[_0x3906('0x45')]=qs[_0x3906('0x46')](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x46')]);_0x3ba3a3[_0x3906('0x47')]=qs[_0x3906('0x3f')](_[_0x3906('0x48')](_0x2b01e8[_0x3906('0x3d')],_0x273199[_0x3906('0x3f')]),_0x2889e0);if(_0x2b01e8[_0x3906('0x3d')][_0x3906('0x49')]){_0x3ba3a3[_0x3906('0x47')]=_[_0x3906('0x4a')](_0x3ba3a3[_0x3906('0x47')],{'$or':_[_0x3906('0x39')](_0x2889e0,function(_0x4565cd){if(_0x4565cd['type']!==_0x3906('0x4b')){var _0x3e6e35={};_0x3e6e35[_0x4565cd[_0x3906('0x36')]]={'$like':'%'+_0x2b01e8['query']['filter']+'%'};return _0x3e6e35;}})});}_0x3ba3a3=_[_0x3906('0x4a')]({},_0x3ba3a3,_0x2b01e8[_0x3906('0x4c')]);var _0x30529e={'where':_0x3ba3a3[_0x3906('0x47')]};return db[_0x3906('0x4d')]['count'](_0x30529e)[_0x3906('0x1a')](function(_0x56c22f){_0x3610f1[_0x3906('0x29')]=_0x56c22f;if(_0x2b01e8[_0x3906('0x3d')][_0x3906('0x4e')]){_0x3ba3a3[_0x3906('0x4f')]=[{'all':!![]}];}return db[_0x3906('0x4d')][_0x3906('0x50')](_0x3ba3a3);})[_0x3906('0x1a')](function(_0x54b2bf){_0x3610f1[_0x3906('0x51')]=_0x54b2bf;return _0x3610f1;})['then'](respondWithFilteredResult(_0x19d5b0,_0x3ba3a3))[_0x3906('0x24')](handleError(_0x19d5b0,null));};exports['show']=function(_0x5fea3b,_0x34644b){var _0x12fa22={'raw':![],'where':{'id':_0x5fea3b['params']['id']}},_0x859c1c={};_0x859c1c[_0x3906('0x3c')]=_[_0x3906('0x3e')](db[_0x3906('0x4d')][_0x3906('0x52')]);_0x859c1c[_0x3906('0x3d')]=_['keys'](_0x5fea3b[_0x3906('0x3d')]);_0x859c1c['filters']=_['intersection'](_0x859c1c[_0x3906('0x3c')],_0x859c1c['query']);_0x12fa22[_0x3906('0x40')]=_[_0x3906('0x53')](_0x859c1c[_0x3906('0x3c')],qs[_0x3906('0x41')](_0x5fea3b[_0x3906('0x3d')][_0x3906('0x41')]));_0x12fa22[_0x3906('0x40')]=_0x12fa22['attributes'][_0x3906('0x42')]?_0x12fa22[_0x3906('0x40')]:_0x859c1c[_0x3906('0x3c')];if(_0x5fea3b['query'][_0x3906('0x4e')]){_0x12fa22[_0x3906('0x4f')]=[{'all':!![]}];}_0x12fa22=_[_0x3906('0x4a')]({},_0x12fa22,_0x5fea3b[_0x3906('0x4c')]);return db['VoiceContext'][_0x3906('0x54')](_0x12fa22)[_0x3906('0x1a')](handleEntityNotFound(_0x34644b,null))[_0x3906('0x1a')](respondWithResult(_0x34644b,null))[_0x3906('0x24')](handleError(_0x34644b,null));};exports[_0x3906('0x55')]=function(_0x816a5e,_0x181a4a,_0xa95eb4){var _0x28b505;return db[_0x3906('0x4d')][_0x3906('0x55')](_0x816a5e[_0x3906('0x56')],{'raw':!![]})[_0x3906('0x1a')](function(_0xf5b653){_0x28b505=_0xf5b653;return db[_0x3906('0x4d')][_0x3906('0x50')]({'raw':!![]});})[_0x3906('0x1a')](function(_0xac57f1){var _0x5486e1=fs['readFileSync'](path[_0x3906('0x57')](config['root'],_0x3906('0x58')),_0x3906('0x59'));var _0xe8a32c=ejs['render'](_0x5486e1,{'contexts':_0xac57f1||[]});fs[_0x3906('0x5a')](_0x3906('0x5b'),_0xe8a32c);})['then'](function(){return respondWithRpcPromise(_0x3906('0x5c'),_0x3906('0x55'),{'module':_0x3906('0x5d')});})[_0x3906('0x1a')](function(){var _0x517cdb=_0x816a5e[_0x3906('0x5e')][_0x3906('0x32')]({'plain':!![]});if(!_0x517cdb)throw new Error(_0x3906('0x5f'));if(_0x517cdb[_0x3906('0x60')]==='user'){var _0x3204ce=_0x28b505[_0x3906('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x3906('0x54')]({'where':{'name':_0x3906('0x33'),'userProfileId':_0x517cdb['userProfileId']},'raw':!![]})['then'](function(_0x52ded9){if(_0x52ded9&&_0x52ded9[_0x3906('0x61')]===0x0){return db['UserProfileResource'][_0x3906('0x55')]({'name':_0x3204ce[_0x3906('0x36')],'resourceId':_0x3204ce['id'],'type':_0x52ded9[_0x3906('0x36')],'sectionId':_0x52ded9['id']},{})['then'](function(){return _0x28b505;});}else{return _0x28b505;}})[_0x3906('0x24')](function(_0x48e639){logger[_0x3906('0x20')](_0x3906('0x62'),_0x48e639);throw _0x48e639;});}return _0x28b505;})[_0x3906('0x1a')](respondWithResult(_0x181a4a,0xc9))['catch'](handleError(_0x181a4a,null));};exports['update']=function(_0x50dab0,_0x1f2b1a,_0xb939f8){var _0x2ea539;return db[_0x3906('0x4d')]['find']({'where':{'id':_0x50dab0['params']['id']}})[_0x3906('0x1a')](handleEntityNotFound(_0x1f2b1a,null))[_0x3906('0x1a')](saveUpdates(_0x50dab0[_0x3906('0x56')],null))['then'](function(_0x9d1e90){if(_0x9d1e90){_0x2ea539=_0x9d1e90;return db[_0x3906('0x4d')][_0x3906('0x50')]({'raw':!![]});}})[_0x3906('0x1a')](function(_0x8ffb6a){var _0x181e2f=fs[_0x3906('0x63')](path[_0x3906('0x57')](config[_0x3906('0x64')],_0x3906('0x58')),'utf8');var _0x544b6e=ejs[_0x3906('0x65')](_0x181e2f,{'contexts':_0x8ffb6a||[]});fs[_0x3906('0x5a')](_0x3906('0x5b'),_0x544b6e);})[_0x3906('0x1a')](function(){return respondWithRpcPromise(_0x3906('0x5c'),_0x3906('0x30'),{'module':_0x3906('0x5d')});})[_0x3906('0x1a')](function(){return _0x2ea539;})[_0x3906('0x1a')](respondWithResult(_0x1f2b1a,null))['catch'](handleError(_0x1f2b1a,null));};exports[_0x3906('0x31')]=function(_0x4c6310,_0x2a0743,_0xe8d63a){var _0x488a23;return db[_0x3906('0x4d')]['find']({'where':{'id':_0x4c6310[_0x3906('0x66')]['id']}})[_0x3906('0x1a')](handleEntityNotFound(_0x2a0743,null))[_0x3906('0x1a')](removeEntity(_0x2a0743,null))[_0x3906('0x1a')](function(){return db[_0x3906('0x4d')][_0x3906('0x50')]({'raw':!![]});})[_0x3906('0x1a')](function(_0x58000e){var _0x5ea887=fs[_0x3906('0x63')](path['join'](config[_0x3906('0x64')],'server/files/templates/context.ejs'),_0x3906('0x59'));var _0x12133d=ejs['render'](_0x5ea887,{'contexts':_0x58000e});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x12133d);return respondWithRpcPromise('Reload',_0x3906('0x31'),{'module':_0x3906('0x5d')});})['catch'](handleError(_0x2a0743,null));}; \ No newline at end of file +var _0x37b4=['fields','length','nolimit','limit','offset','order','sort','filters','pick','where','merge','VIRTUAL','filter','VoiceContext','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','readFileSync','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','utf8','join','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','sendStatus','status','end','json','count','Content-Range','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','intersection','attributes'];(function(_0x9d5738,_0x32a371){var _0x2ebe63=function(_0x323d7a){while(--_0x323d7a){_0x9d5738['push'](_0x9d5738['shift']());}};_0x2ebe63(++_0x32a371);}(_0x37b4,0xef));var _0x437b=function(_0x17c487,_0x2b72f1){_0x17c487=_0x17c487-0x0;var _0x3feeb8=_0x37b4[_0x17c487];return _0x3feeb8;};'use strict';var pdf=require(_0x437b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x437b('0x1'));var zipdir=require(_0x437b('0x2'));var jsonpatch=require(_0x437b('0x3'));var rp=require('request-promise');var moment=require(_0x437b('0x4'));var BPromise=require(_0x437b('0x5'));var Mustache=require(_0x437b('0x6'));var util=require(_0x437b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x437b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x437b('0x9'));var squel=require('squel');var crypto=require(_0x437b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x437b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x437b('0xc'));var Redis=require(_0x437b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x437b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x437b('0xf'))(_0x437b('0x10'));var utils=require(_0x437b('0x11'));var config=require(_0x437b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x437b('0x13'))['db'];var jayson=require(_0x437b('0x14'));var client=jayson[_0x437b('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x90c515,_0x40c6ee,_0x42bcf9,_0x4d72ec){return new BPromise(function(_0x29b972,_0x56524c){var _0x368067=_0x4d72ec||client;return _0x368067[_0x437b('0x16')](_0x90c515,_0x42bcf9)[_0x437b('0x17')](function(_0x5f328b){logger[_0x437b('0x18')](_0x437b('0x19'),_0x40c6ee,_0x437b('0x1a'));logger[_0x437b('0x1b')](_0x437b('0x1c'),_0x40c6ee,_0x437b('0x1a'),JSON['stringify'](_0x5f328b));if(_0x5f328b[_0x437b('0x1d')]){if(_0x5f328b['error'][_0x437b('0x1e')]===0x1f4){logger[_0x437b('0x1d')](_0x437b('0x19'),_0x40c6ee,_0x5f328b[_0x437b('0x1d')]['message']);return _0x56524c(_0x5f328b['error']['message']);}logger['error'](_0x437b('0x19'),_0x40c6ee,_0x5f328b[_0x437b('0x1d')]['message']);return _0x29b972(_0x5f328b[_0x437b('0x1d')]['message']);}else{logger[_0x437b('0x18')](_0x437b('0x19'),_0x40c6ee,_0x437b('0x1a'));_0x29b972(_0x5f328b['result']['message']);}})['catch'](function(_0x46b278){logger[_0x437b('0x1d')](_0x437b('0x19'),_0x40c6ee,_0x46b278);_0x56524c(_0x46b278);});});}function respondWithStatusCode(_0x4440e6,_0x8c5852){_0x8c5852=_0x8c5852||0xcc;return function(_0xd95668){if(_0xd95668){return _0x4440e6[_0x437b('0x1f')](_0x8c5852);}return _0x4440e6[_0x437b('0x20')](_0x8c5852)[_0x437b('0x21')]();};}function respondWithResult(_0x3b9961,_0x258198){_0x258198=_0x258198||0xc8;return function(_0x5a0c38){if(_0x5a0c38){return _0x3b9961[_0x437b('0x20')](_0x258198)[_0x437b('0x22')](_0x5a0c38);}};}function respondWithFilteredResult(_0xce162e,_0x430be0){return function(_0x17092c){if(_0x17092c){var _0x586df9=_0x17092c[_0x437b('0x23')],_0x14f755=_0x430be0['offset'],_0x2dbeb6=_0x430be0['offset']+_0x430be0['limit'],_0x4a7d0b;if(_0x2dbeb6>=_0x586df9){_0x2dbeb6=_0x586df9;_0x4a7d0b=0xc8;}else{_0x4a7d0b=0xce;}_0xce162e[_0x437b('0x20')](_0x4a7d0b);return _0xce162e['set'](_0x437b('0x24'),_0x14f755+'-'+_0x2dbeb6+'/'+_0x586df9)[_0x437b('0x22')](_0x17092c);}return null;};}function patchUpdates(_0x2b2e4f){return function(_0x5885e1){try{jsonpatch['apply'](_0x5885e1,_0x2b2e4f,!![]);}catch(_0x2c9931){return BPromise[_0x437b('0x25')](_0x2c9931);}return _0x5885e1[_0x437b('0x26')]();};}function saveUpdates(_0x3b7302,_0x730a34){return function(_0x60af){if(_0x60af){return _0x60af[_0x437b('0x27')](_0x3b7302)[_0x437b('0x17')](function(_0xb4abd5){return _0xb4abd5;});}return null;};}function removeEntity(_0x210292,_0x12b542){return function(_0x5a6677){if(_0x5a6677){return _0x5a6677[_0x437b('0x28')]()[_0x437b('0x17')](function(){var _0x156773=_0x5a6677['get']({'plain':!![]});var _0x317bdf=_0x437b('0x29');return db[_0x437b('0x2a')]['destroy']({'where':{'type':_0x317bdf,'resourceId':_0x156773['id']}})[_0x437b('0x17')](function(){return _0x5a6677;});})['then'](function(){_0x210292[_0x437b('0x20')](0xcc)[_0x437b('0x21')]();});}};}function handleEntityNotFound(_0x163315,_0x425a9c){return function(_0x385a1d){if(!_0x385a1d){_0x163315[_0x437b('0x1f')](0x194);}return _0x385a1d;};}function handleError(_0x561dcc,_0x453306){_0x453306=_0x453306||0x1f4;return function(_0x43f35f){logger[_0x437b('0x1d')](_0x43f35f[_0x437b('0x2b')]);if(_0x43f35f[_0x437b('0x2c')]){delete _0x43f35f[_0x437b('0x2c')];}_0x561dcc[_0x437b('0x20')](_0x453306)[_0x437b('0x2d')](_0x43f35f);};}exports[_0x437b('0x2e')]=function(_0x1690f7,_0x2a8f23){var _0x4e7461={},_0x273b64={},_0x4e48f2={'count':0x0,'rows':[]};var _0x1ed9bf=_['map'](db['VoiceContext'][_0x437b('0x2f')],function(_0x1f169c){return{'name':_0x1f169c[_0x437b('0x30')],'type':_0x1f169c[_0x437b('0x31')]['key']};});_0x273b64[_0x437b('0x32')]=_[_0x437b('0x33')](_0x1ed9bf,_0x437b('0x2c'));_0x273b64[_0x437b('0x34')]=_['keys'](_0x1690f7['query']);_0x273b64['filters']=_[_0x437b('0x35')](_0x273b64[_0x437b('0x32')],_0x273b64[_0x437b('0x34')]);_0x4e7461[_0x437b('0x36')]=_[_0x437b('0x35')](_0x273b64[_0x437b('0x32')],qs['fields'](_0x1690f7[_0x437b('0x34')][_0x437b('0x37')]));_0x4e7461[_0x437b('0x36')]=_0x4e7461['attributes'][_0x437b('0x38')]?_0x4e7461[_0x437b('0x36')]:_0x273b64['model'];if(!_0x1690f7['query']['hasOwnProperty'](_0x437b('0x39'))){_0x4e7461[_0x437b('0x3a')]=qs['limit'](_0x1690f7['query'][_0x437b('0x3a')]);_0x4e7461['offset']=qs[_0x437b('0x3b')](_0x1690f7['query']['offset']);}_0x4e7461[_0x437b('0x3c')]=qs[_0x437b('0x3d')](_0x1690f7['query'][_0x437b('0x3d')]);_0x4e7461['where']=qs[_0x437b('0x3e')](_[_0x437b('0x3f')](_0x1690f7['query'],_0x273b64[_0x437b('0x3e')]),_0x1ed9bf);if(_0x1690f7[_0x437b('0x34')]['filter']){_0x4e7461[_0x437b('0x40')]=_[_0x437b('0x41')](_0x4e7461[_0x437b('0x40')],{'$or':_[_0x437b('0x33')](_0x1ed9bf,function(_0x5daa70){if(_0x5daa70[_0x437b('0x31')]!==_0x437b('0x42')){var _0x12c07e={};_0x12c07e[_0x5daa70['name']]={'$like':'%'+_0x1690f7['query'][_0x437b('0x43')]+'%'};return _0x12c07e;}})});}_0x4e7461=_['merge']({},_0x4e7461,_0x1690f7['options']);var _0x1c306a={'where':_0x4e7461[_0x437b('0x40')]};return db[_0x437b('0x44')][_0x437b('0x23')](_0x1c306a)[_0x437b('0x17')](function(_0x49b019){_0x4e48f2[_0x437b('0x23')]=_0x49b019;if(_0x1690f7[_0x437b('0x34')][_0x437b('0x45')]){_0x4e7461[_0x437b('0x46')]=[{'all':!![]}];}return db[_0x437b('0x44')][_0x437b('0x47')](_0x4e7461);})['then'](function(_0x481a57){_0x4e48f2[_0x437b('0x48')]=_0x481a57;return _0x4e48f2;})['then'](respondWithFilteredResult(_0x2a8f23,_0x4e7461))[_0x437b('0x49')](handleError(_0x2a8f23,null));};exports[_0x437b('0x4a')]=function(_0x4f8f76,_0x1aa7e1){var _0x1f0395={'raw':![],'where':{'id':_0x4f8f76[_0x437b('0x4b')]['id']}},_0x5ef10e={};_0x5ef10e[_0x437b('0x32')]=_[_0x437b('0x4c')](db[_0x437b('0x44')][_0x437b('0x2f')]);_0x5ef10e['query']=_[_0x437b('0x4c')](_0x4f8f76[_0x437b('0x34')]);_0x5ef10e['filters']=_[_0x437b('0x35')](_0x5ef10e[_0x437b('0x32')],_0x5ef10e['query']);_0x1f0395['attributes']=_[_0x437b('0x35')](_0x5ef10e[_0x437b('0x32')],qs[_0x437b('0x37')](_0x4f8f76[_0x437b('0x34')]['fields']));_0x1f0395[_0x437b('0x36')]=_0x1f0395[_0x437b('0x36')][_0x437b('0x38')]?_0x1f0395[_0x437b('0x36')]:_0x5ef10e[_0x437b('0x32')];if(_0x4f8f76[_0x437b('0x34')][_0x437b('0x45')]){_0x1f0395['include']=[{'all':!![]}];}_0x1f0395=_[_0x437b('0x41')]({},_0x1f0395,_0x4f8f76[_0x437b('0x4d')]);return db['VoiceContext'][_0x437b('0x4e')](_0x1f0395)[_0x437b('0x17')](handleEntityNotFound(_0x1aa7e1,null))['then'](respondWithResult(_0x1aa7e1,null))['catch'](handleError(_0x1aa7e1,null));};exports[_0x437b('0x4f')]=function(_0x546553,_0x356d3b,_0x582b1e){var _0x542ac9;return db['VoiceContext'][_0x437b('0x4f')](_0x546553[_0x437b('0x50')],{'raw':!![]})[_0x437b('0x17')](function(_0x26bab8){_0x542ac9=_0x26bab8;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x437b('0x17')](function(_0x598c9d){var _0x3817ba=fs[_0x437b('0x51')](path['join'](config['root'],_0x437b('0x52')),'utf8');var _0x3c25e2=ejs[_0x437b('0x53')](_0x3817ba,{'contexts':_0x598c9d||[]});fs[_0x437b('0x54')](_0x437b('0x55'),_0x3c25e2);})[_0x437b('0x17')](function(){return respondWithRpcPromise(_0x437b('0x56'),_0x437b('0x4f'),{'module':_0x437b('0x57')});})['then'](function(){var _0x218ea7=_0x546553[_0x437b('0x58')][_0x437b('0x59')]({'plain':!![]});if(!_0x218ea7)throw new Error(_0x437b('0x5a'));if(_0x218ea7[_0x437b('0x5b')]===_0x437b('0x58')){var _0x2bd48f=_0x542ac9['get']({'plain':!![]});return db[_0x437b('0x5c')]['find']({'where':{'name':_0x437b('0x29'),'userProfileId':_0x218ea7[_0x437b('0x5d')]},'raw':!![]})['then'](function(_0x36452f){if(_0x36452f&&_0x36452f['autoAssociation']===0x0){return db[_0x437b('0x2a')][_0x437b('0x4f')]({'name':_0x2bd48f[_0x437b('0x2c')],'resourceId':_0x2bd48f['id'],'type':_0x36452f[_0x437b('0x2c')],'sectionId':_0x36452f['id']},{})['then'](function(){return _0x542ac9;});}else{return _0x542ac9;}})[_0x437b('0x49')](function(_0x5e45f7){logger['error'](_0x437b('0x5e'),_0x5e45f7);throw _0x5e45f7;});}return _0x542ac9;})[_0x437b('0x17')](respondWithResult(_0x356d3b,0xc9))['catch'](handleError(_0x356d3b,null));};exports[_0x437b('0x27')]=function(_0x1eb81b,_0x50721c,_0xb1ab3a){var _0x2d15e5;return db[_0x437b('0x44')]['find']({'where':{'id':_0x1eb81b[_0x437b('0x4b')]['id']}})[_0x437b('0x17')](handleEntityNotFound(_0x50721c,null))['then'](saveUpdates(_0x1eb81b[_0x437b('0x50')],null))[_0x437b('0x17')](function(_0xf9cff){if(_0xf9cff){_0x2d15e5=_0xf9cff;return db[_0x437b('0x44')]['findAll']({'raw':!![]});}})[_0x437b('0x17')](function(_0x4eba08){var _0x30afd2=fs[_0x437b('0x51')](path['join'](config[_0x437b('0x5f')],_0x437b('0x52')),_0x437b('0x60'));var _0x3714f6=ejs[_0x437b('0x53')](_0x30afd2,{'contexts':_0x4eba08||[]});fs[_0x437b('0x54')](_0x437b('0x55'),_0x3714f6);})[_0x437b('0x17')](function(){return respondWithRpcPromise(_0x437b('0x56'),_0x437b('0x27'),{'module':_0x437b('0x57')});})[_0x437b('0x17')](function(){return _0x2d15e5;})[_0x437b('0x17')](respondWithResult(_0x50721c,null))[_0x437b('0x49')](handleError(_0x50721c,null));};exports[_0x437b('0x28')]=function(_0x1a905,_0x16de80,_0x118a2f){var _0x25cd54;return db['VoiceContext'][_0x437b('0x4e')]({'where':{'id':_0x1a905['params']['id']}})[_0x437b('0x17')](handleEntityNotFound(_0x16de80,null))[_0x437b('0x17')](removeEntity(_0x16de80,null))['then'](function(){return db[_0x437b('0x44')]['findAll']({'raw':!![]});})['then'](function(_0x53f5d1){var _0x2bcae5=fs['readFileSync'](path[_0x437b('0x61')](config[_0x437b('0x5f')],_0x437b('0x52')),_0x437b('0x60'));var _0x14c0aa=ejs[_0x437b('0x53')](_0x2bcae5,{'contexts':_0x53f5d1});fs[_0x437b('0x54')](_0x437b('0x55'),_0x14c0aa);return respondWithRpcPromise('Reload',_0x437b('0x28'),{'module':_0x437b('0x57')});})[_0x437b('0x49')](handleError(_0x16de80,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index acdb5ef..bd65ddc 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 _0x2a49=['request-promise','path','rimraf','exports','VoiceContext','lodash','util','api','moment','bluebird'];(function(_0xef7f3b,_0x4f689f){var _0x5bc9e3=function(_0x247b0d){while(--_0x247b0d){_0xef7f3b['push'](_0xef7f3b['shift']());}};_0x5bc9e3(++_0x4f689f);}(_0x2a49,0x1db));var _0x92a4=function(_0x3ebcb9,_0x34c8ce){_0x3ebcb9=_0x3ebcb9-0x0;var _0x317a8e=_0x2a49[_0x3ebcb9];return _0x317a8e;};'use strict';var _=require(_0x92a4('0x0'));var util=require(_0x92a4('0x1'));var logger=require('../../config/logger')(_0x92a4('0x2'));var moment=require(_0x92a4('0x3'));var BPromise=require(_0x92a4('0x4'));var rp=require(_0x92a4('0x5'));var fs=require('fs');var path=require(_0x92a4('0x6'));var rimraf=require(_0x92a4('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x92a4('0x8')]=function(_0x2f64d9,_0x447a2d){return _0x2f64d9['define'](_0x92a4('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf8b=['define','VoiceContext','voice_contexts','util','../../config/logger','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x4dade6,_0x16b01d){var _0x513270=function(_0x1d4a7f){while(--_0x1d4a7f){_0x4dade6['push'](_0x4dade6['shift']());}};_0x513270(++_0x16b01d);}(_0xaf8b,0xc0));var _0xbaf8=function(_0x3526e9,_0x21faf1){_0x3526e9=_0x3526e9-0x0;var _0x2d62de=_0xaf8b[_0x3526e9];return _0x2d62de;};'use strict';var _=require('lodash');var util=require(_0xbaf8('0x0'));var logger=require(_0xbaf8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaf8('0x2'));var rimraf=require(_0xbaf8('0x3'));var config=require(_0xbaf8('0x4'));var attributes=require(_0xbaf8('0x5'));module['exports']=function(_0x2f6d2a,_0x246627){return _0x2f6d2a[_0xbaf8('0x6')](_0xbaf8('0x7'),attributes,{'tableName':_0xbaf8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 47cd7ce..cd2372c 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 _0x8b89=['../../config/logger','rpc','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x55c09c,_0x406cfe){var _0x35c8ed=function(_0x2d3612){while(--_0x2d3612){_0x55c09c['push'](_0x55c09c['shift']());}};_0x35c8ed(++_0x406cfe);}(_0x8b89,0x148));var _0x98b8=function(_0x3b53e1,_0x4ee81e){_0x3b53e1=_0x3b53e1-0x0;var _0x559267=_0x8b89[_0x3b53e1];return _0x559267;};'use strict';var _=require(_0x98b8('0x0'));var util=require(_0x98b8('0x1'));var moment=require(_0x98b8('0x2'));var BPromise=require(_0x98b8('0x3'));var rs=require(_0x98b8('0x4'));var fs=require('fs');var Redis=require(_0x98b8('0x5'));var db=require(_0x98b8('0x6'))['db'];var utils=require(_0x98b8('0x7'));var logger=require(_0x98b8('0x8'))(_0x98b8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x98b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353d3e,_0x3f3600,_0xeb2bf7){return new BPromise(function(_0x2aa785,_0x477c09){return client[_0x98b8('0xb')](_0x353d3e,_0xeb2bf7)['then'](function(_0x3aa2e5){logger[_0x98b8('0xc')](_0x98b8('0xd'),_0x3f3600,_0x98b8('0xe'));logger[_0x98b8('0xf')](_0x98b8('0x10'),_0x3f3600,_0x98b8('0xe'),JSON['stringify'](_0x3aa2e5));if(_0x3aa2e5[_0x98b8('0x11')]){if(_0x3aa2e5[_0x98b8('0x11')]['code']===0x1f4){logger[_0x98b8('0x11')](_0x98b8('0xd'),_0x3f3600,_0x3aa2e5['error'][_0x98b8('0x12')]);return _0x477c09(_0x3aa2e5['error'][_0x98b8('0x12')]);}logger[_0x98b8('0x11')](_0x98b8('0xd'),_0x3f3600,_0x3aa2e5[_0x98b8('0x11')][_0x98b8('0x12')]);return _0x2aa785(_0x3aa2e5['error'][_0x98b8('0x12')]);}else{logger[_0x98b8('0xc')]('VoiceContext,\x20%s,\x20%s',_0x3f3600,'request\x20sent');_0x2aa785(_0x3aa2e5[_0x98b8('0x13')]['message']);}})[_0x98b8('0x14')](function(_0x135643){logger[_0x98b8('0x11')](_0x98b8('0xd'),_0x3f3600,_0x135643);_0x477c09(_0x135643);});});} \ No newline at end of file +var _0x171d=['VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x456aa3,_0x198c86){var _0x328027=function(_0x557117){while(--_0x557117){_0x456aa3['push'](_0x456aa3['shift']());}};_0x328027(++_0x198c86);}(_0x171d,0x124));var _0xd171=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x171d[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0xd171('0x0'));var util=require(_0xd171('0x1'));var moment=require(_0xd171('0x2'));var BPromise=require(_0xd171('0x3'));var rs=require(_0xd171('0x4'));var fs=require('fs');var Redis=require(_0xd171('0x5'));var db=require(_0xd171('0x6'))['db'];var utils=require(_0xd171('0x7'));var logger=require('../../config/logger')(_0xd171('0x8'));var config=require(_0xd171('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd171('0xa')][_0xd171('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2a5fd,_0x568798,_0x2dcdfa){return new BPromise(function(_0x513096,_0x47240f){return client['request'](_0xa2a5fd,_0x2dcdfa)[_0xd171('0xc')](function(_0x4668d5){logger[_0xd171('0xd')]('VoiceContext,\x20%s,\x20%s',_0x568798,_0xd171('0xe'));logger[_0xd171('0xf')](_0xd171('0x10'),_0x568798,_0xd171('0xe'),JSON[_0xd171('0x11')](_0x4668d5));if(_0x4668d5[_0xd171('0x12')]){if(_0x4668d5[_0xd171('0x12')][_0xd171('0x13')]===0x1f4){logger[_0xd171('0x12')](_0xd171('0x14'),_0x568798,_0x4668d5[_0xd171('0x12')][_0xd171('0x15')]);return _0x47240f(_0x4668d5[_0xd171('0x12')]['message']);}logger[_0xd171('0x12')](_0xd171('0x14'),_0x568798,_0x4668d5[_0xd171('0x12')]['message']);return _0x513096(_0x4668d5['error']['message']);}else{logger['info'](_0xd171('0x14'),_0x568798,'request\x20sent');_0x513096(_0x4668d5[_0xd171('0x16')][_0xd171('0x15')]);}})[_0xd171('0x17')](function(_0x10d8d9){logger[_0xd171('0x12')]('VoiceContext,\x20%s,\x20%s',_0x568798,_0x10d8d9);_0x47240f(_0x10d8d9);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1a2a416..a9177cd 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 _0xd78d=['describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd78d,0x107));var _0xdd78=function(_0xccf98b,_0x35565d){_0xccf98b=_0xccf98b-0x0;var _0x3a7624=_0xd78d[_0xccf98b];return _0x3a7624;};'use strict';var multer=require(_0xdd78('0x0'));var util=require(_0xdd78('0x1'));var path=require(_0xdd78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd78('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdd78('0x4'));var config=require('../../config/environment');var controller=require(_0xdd78('0x5'));router[_0xdd78('0x6')]('/',auth[_0xdd78('0x7')](),controller[_0xdd78('0x8')]);router['get']('/describe',auth[_0xdd78('0x7')](),controller[_0xdd78('0x9')]);router[_0xdd78('0x6')](_0xdd78('0xa'),auth[_0xdd78('0x7')](),controller[_0xdd78('0xb')]);router[_0xdd78('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdd78('0xd')](_0xdd78('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdd78('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xdd78('0xf')]);module[_0xdd78('0x10')]=router; \ No newline at end of file +var _0xa54f=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xa54f,0x142));var _0xfa54=function(_0x1aa832,_0x93f678){_0x1aa832=_0x1aa832-0x0;var _0x334378=_0xa54f[_0x1aa832];return _0x334378;};'use strict';var multer=require('multer');var util=require(_0xfa54('0x0'));var path=require(_0xfa54('0x1'));var timeout=require(_0xfa54('0x2'));var express=require(_0xfa54('0x3'));var router=express[_0xfa54('0x4')]();var auth=require(_0xfa54('0x5'));var interaction=require(_0xfa54('0x6'));var config=require(_0xfa54('0x7'));var controller=require('./voiceDialReport.controller');router[_0xfa54('0x8')]('/',auth[_0xfa54('0x9')](),controller[_0xfa54('0xa')]);router[_0xfa54('0x8')](_0xfa54('0xb'),auth[_0xfa54('0x9')](),controller[_0xfa54('0xc')]);router[_0xfa54('0x8')]('/:id',auth[_0xfa54('0x9')](),controller['show']);router[_0xfa54('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa54('0xe')]);router[_0xfa54('0xf')](_0xfa54('0x10'),auth['isAuthenticated'](),controller[_0xfa54('0x11')]);router[_0xfa54('0x12')](_0xfa54('0x10'),auth[_0xfa54('0x9')](),controller[_0xfa54('0x13')]);module[_0xfa54('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 36b3875..ac0eb4b 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 _0x474c=['INTEGER','DATE','called,connect,complete','sequelize','STRING'];(function(_0x1aaad1,_0x43d722){var _0x517832=function(_0x4928f4){while(--_0x4928f4){_0x1aaad1['push'](_0x1aaad1['shift']());}};_0x517832(++_0x43d722);}(_0x474c,0x1b6));var _0xc474=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x474c[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xc474('0x0'));module['exports']={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc474('0x1')]},'channelstate':{'type':Sequelize[_0xc474('0x2')]},'channelstatedesc':{'type':Sequelize[_0xc474('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc474('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc474('0x1')]},'connectedlinename':{'type':Sequelize[_0xc474('0x1')]},'language':{'type':Sequelize[_0xc474('0x1')]},'accountcode':{'type':Sequelize[_0xc474('0x1')]},'context':{'type':Sequelize[_0xc474('0x1')]},'exten':{'type':Sequelize[_0xc474('0x1')]},'priority':{'type':Sequelize[_0xc474('0x2')]},'uniqueid':{'type':Sequelize[_0xc474('0x1')]},'linkedid':{'type':Sequelize[_0xc474('0x1')]},'destchannel':{'type':Sequelize[_0xc474('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc474('0x1')]},'destcalleridname':{'type':Sequelize[_0xc474('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc474('0x1')]},'destaccountcode':{'type':Sequelize[_0xc474('0x1')]},'destcontext':{'type':Sequelize[_0xc474('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc474('0x2')]},'destuniqueid':{'type':Sequelize[_0xc474('0x1')]},'destlinkedid':{'type':Sequelize[_0xc474('0x1')]},'dialstring':{'type':Sequelize[_0xc474('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc474('0x3')]},'answertime':{'type':Sequelize[_0xc474('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0xc474('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xc474('0x2')]},'holdtime':{'type':Sequelize[_0xc474('0x2')]},'billableseconds':{'type':Sequelize[_0xc474('0x2')]}}; \ No newline at end of file +var _0xbdf2=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x459511,_0x5dd714){var _0x27837b=function(_0x3b150e){while(--_0x3b150e){_0x459511['push'](_0x459511['shift']());}};_0x27837b(++_0x5dd714);}(_0xbdf2,0x68));var _0x2bdf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbdf2[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x2bdf('0x0')]={'privilege':{'type':Sequelize[_0x2bdf('0x1')]},'channel':{'type':Sequelize[_0x2bdf('0x1')]},'channelstate':{'type':Sequelize[_0x2bdf('0x2')]},'channelstatedesc':{'type':Sequelize[_0x2bdf('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2bdf('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2bdf('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2bdf('0x1')]},'context':{'type':Sequelize[_0x2bdf('0x1')]},'exten':{'type':Sequelize[_0x2bdf('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x2bdf('0x1')]},'linkedid':{'type':Sequelize[_0x2bdf('0x1')]},'destchannel':{'type':Sequelize[_0x2bdf('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x2bdf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2bdf('0x1')]},'destcalleridname':{'type':Sequelize[_0x2bdf('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2bdf('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x2bdf('0x1')]},'destlanguage':{'type':Sequelize[_0x2bdf('0x1')]},'destaccountcode':{'type':Sequelize[_0x2bdf('0x1')]},'destcontext':{'type':Sequelize[_0x2bdf('0x1')]},'destexten':{'type':Sequelize[_0x2bdf('0x1')]},'destpriority':{'type':Sequelize[_0x2bdf('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x2bdf('0x1')]},'dialstatus':{'type':Sequelize[_0x2bdf('0x1')]},'starttime':{'type':Sequelize[_0x2bdf('0x3')]},'answertime':{'type':Sequelize[_0x2bdf('0x3')]},'endtime':{'type':Sequelize[_0x2bdf('0x3')]},'lastevent':{'type':Sequelize[_0x2bdf('0x1')],'comment':_0x2bdf('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x2bdf('0x2')]},'billableseconds':{'type':Sequelize[_0x2bdf('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e802a32..7cf57a0 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 _0xf5e7=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','VoiceDialReport','options','find','create','update','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x46a459,_0x281d24){var _0x37979b=function(_0x49f680){while(--_0x49f680){_0x46a459['push'](_0x46a459['shift']());}};_0x37979b(++_0x281d24);}(_0xf5e7,0x177));var _0x7f5e=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xf5e7[_0x249d99];return _0x5bfb05;};'use strict';var pdf=require(_0x7f5e('0x0'));var emlformat=require(_0x7f5e('0x1'));var rimraf=require(_0x7f5e('0x2'));var zipdir=require(_0x7f5e('0x3'));var jsonpatch=require(_0x7f5e('0x4'));var rp=require(_0x7f5e('0x5'));var moment=require(_0x7f5e('0x6'));var BPromise=require(_0x7f5e('0x7'));var Mustache=require(_0x7f5e('0x8'));var util=require(_0x7f5e('0x9'));var path=require(_0x7f5e('0xa'));var sox=require('sox');var csv=require(_0x7f5e('0xb'));var ejs=require(_0x7f5e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f5e('0xd'));var crypto=require(_0x7f5e('0xe'));var jsforce=require(_0x7f5e('0xf'));var deskjs=require(_0x7f5e('0x10'));var toCsv=require(_0x7f5e('0xb'));var querystring=require(_0x7f5e('0x11'));var Papa=require('papaparse');var Redis=require(_0x7f5e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7f5e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f5e('0x14'));var logger=require(_0x7f5e('0x15'))(_0x7f5e('0x16'));var utils=require(_0x7f5e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7f5e('0x18'));var db=require(_0x7f5e('0x19'))['db'];function respondWithStatusCode(_0x131108,_0x1e8fd3){_0x1e8fd3=_0x1e8fd3||0xcc;return function(_0x264bd8){if(_0x264bd8){return _0x131108['sendStatus'](_0x1e8fd3);}return _0x131108['status'](_0x1e8fd3)[_0x7f5e('0x1a')]();};}function respondWithResult(_0x104f20,_0x32c58b){_0x32c58b=_0x32c58b||0xc8;return function(_0x37466c){if(_0x37466c){return _0x104f20[_0x7f5e('0x1b')](_0x32c58b)['json'](_0x37466c);}};}function respondWithFilteredResult(_0x2c8889,_0x2e911e){return function(_0x4a5fe1){if(_0x4a5fe1){var _0x3804f1=_0x4a5fe1[_0x7f5e('0x1c')],_0x371ded=_0x2e911e[_0x7f5e('0x1d')],_0x1fd8ed=_0x2e911e['offset']+_0x2e911e[_0x7f5e('0x1e')],_0x3012c5;if(_0x1fd8ed>=_0x3804f1){_0x1fd8ed=_0x3804f1;_0x3012c5=0xc8;}else{_0x3012c5=0xce;}_0x2c8889['status'](_0x3012c5);return _0x2c8889[_0x7f5e('0x1f')](_0x7f5e('0x20'),_0x371ded+'-'+_0x1fd8ed+'/'+_0x3804f1)[_0x7f5e('0x21')](_0x4a5fe1);}return null;};}function patchUpdates(_0x5305e3){return function(_0x13f29b){try{jsonpatch[_0x7f5e('0x22')](_0x13f29b,_0x5305e3,!![]);}catch(_0x2ccb5d){return BPromise['reject'](_0x2ccb5d);}return _0x13f29b[_0x7f5e('0x23')]();};}function saveUpdates(_0x8dcf3a,_0xefbd8b){return function(_0x48498f){if(_0x48498f){return _0x48498f['update'](_0x8dcf3a)['then'](function(_0x1e0bb5){return _0x1e0bb5;});}return null;};}function removeEntity(_0x31d3a0,_0x109017){return function(_0x23fd13){if(_0x23fd13){return _0x23fd13['destroy']()[_0x7f5e('0x24')](function(){_0x31d3a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188fe2,_0x5cad18){return function(_0x148886){if(!_0x148886){_0x188fe2[_0x7f5e('0x25')](0x194);}return _0x148886;};}function handleError(_0x2eeb78,_0x1621e5){_0x1621e5=_0x1621e5||0x1f4;return function(_0x5112c1){logger[_0x7f5e('0x26')](_0x5112c1[_0x7f5e('0x27')]);if(_0x5112c1['name']){delete _0x5112c1[_0x7f5e('0x28')];}_0x2eeb78['status'](_0x1621e5)[_0x7f5e('0x29')](_0x5112c1);};}exports[_0x7f5e('0x2a')]=function(_0x289608,_0x5ad5e8){var _0x5d178c={},_0x462f92={},_0x52cd2f={'count':0x0,'rows':[]};var _0x47b4a4=_[_0x7f5e('0x2b')](db['VoiceDialReport'][_0x7f5e('0x2c')],function(_0x8b4590){return{'name':_0x8b4590[_0x7f5e('0x2d')],'type':_0x8b4590['type'][_0x7f5e('0x2e')]};});_0x462f92[_0x7f5e('0x2f')]=_[_0x7f5e('0x2b')](_0x47b4a4,'name');_0x462f92[_0x7f5e('0x30')]=_['keys'](_0x289608['query']);_0x462f92[_0x7f5e('0x31')]=_[_0x7f5e('0x32')](_0x462f92[_0x7f5e('0x2f')],_0x462f92[_0x7f5e('0x30')]);_0x5d178c['attributes']=_[_0x7f5e('0x32')](_0x462f92[_0x7f5e('0x2f')],qs['fields'](_0x289608[_0x7f5e('0x30')][_0x7f5e('0x33')]));_0x5d178c[_0x7f5e('0x34')]=_0x5d178c[_0x7f5e('0x34')][_0x7f5e('0x35')]?_0x5d178c[_0x7f5e('0x34')]:_0x462f92['model'];if(!_0x289608['query'][_0x7f5e('0x36')](_0x7f5e('0x37'))){_0x5d178c['limit']=qs[_0x7f5e('0x1e')](_0x289608[_0x7f5e('0x30')][_0x7f5e('0x1e')]);_0x5d178c[_0x7f5e('0x1d')]=qs[_0x7f5e('0x1d')](_0x289608[_0x7f5e('0x30')][_0x7f5e('0x1d')]);}_0x5d178c['order']=qs[_0x7f5e('0x38')](_0x289608[_0x7f5e('0x30')]['sort']);_0x5d178c[_0x7f5e('0x39')]=qs[_0x7f5e('0x31')](_['pick'](_0x289608[_0x7f5e('0x30')],_0x462f92[_0x7f5e('0x31')]),_0x47b4a4);if(_0x289608['query'][_0x7f5e('0x3a')]){_0x5d178c['where']=_[_0x7f5e('0x3b')](_0x5d178c[_0x7f5e('0x39')],{'$or':_[_0x7f5e('0x2b')](_0x47b4a4,function(_0x5de97d){if(_0x5de97d[_0x7f5e('0x3c')]!==_0x7f5e('0x3d')){var _0x560872={};_0x560872[_0x5de97d['name']]={'$like':'%'+_0x289608[_0x7f5e('0x30')][_0x7f5e('0x3a')]+'%'};return _0x560872;}})});}_0x5d178c=_[_0x7f5e('0x3b')]({},_0x5d178c,_0x289608['options']);var _0x585d08={'where':_0x5d178c[_0x7f5e('0x39')]};return db['VoiceDialReport'][_0x7f5e('0x1c')](_0x585d08)[_0x7f5e('0x24')](function(_0x409b76){_0x52cd2f[_0x7f5e('0x1c')]=_0x409b76;if(_0x289608[_0x7f5e('0x30')][_0x7f5e('0x3e')]){_0x5d178c[_0x7f5e('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x7f5e('0x40')](_0x5d178c);})['then'](function(_0x3cb8ab){_0x52cd2f['rows']=_0x3cb8ab;return _0x52cd2f;})[_0x7f5e('0x24')](respondWithFilteredResult(_0x5ad5e8,_0x5d178c))[_0x7f5e('0x41')](handleError(_0x5ad5e8,null));};exports[_0x7f5e('0x42')]=function(_0x47738,_0x159c71){var _0x87c3f={'raw':!![],'where':{'id':_0x47738['params']['id']}},_0xd5ff3c={};_0xd5ff3c[_0x7f5e('0x2f')]=_['keys'](db[_0x7f5e('0x43')][_0x7f5e('0x2c')]);_0xd5ff3c[_0x7f5e('0x30')]=_['keys'](_0x47738[_0x7f5e('0x30')]);_0xd5ff3c[_0x7f5e('0x31')]=_['intersection'](_0xd5ff3c[_0x7f5e('0x2f')],_0xd5ff3c[_0x7f5e('0x30')]);_0x87c3f[_0x7f5e('0x34')]=_[_0x7f5e('0x32')](_0xd5ff3c['model'],qs[_0x7f5e('0x33')](_0x47738[_0x7f5e('0x30')][_0x7f5e('0x33')]));_0x87c3f[_0x7f5e('0x34')]=_0x87c3f[_0x7f5e('0x34')]['length']?_0x87c3f[_0x7f5e('0x34')]:_0xd5ff3c[_0x7f5e('0x2f')];if(_0x47738['query'][_0x7f5e('0x3e')]){_0x87c3f[_0x7f5e('0x3f')]=[{'all':!![]}];}_0x87c3f=_['merge']({},_0x87c3f,_0x47738[_0x7f5e('0x44')]);return db[_0x7f5e('0x43')][_0x7f5e('0x45')](_0x87c3f)[_0x7f5e('0x24')](handleEntityNotFound(_0x159c71,null))['then'](respondWithResult(_0x159c71,null))[_0x7f5e('0x41')](handleError(_0x159c71,null));};exports[_0x7f5e('0x46')]=function(_0x3bcf1c,_0x50972e){return db[_0x7f5e('0x43')][_0x7f5e('0x46')](_0x3bcf1c['body'],{})['then'](respondWithResult(_0x50972e,0xc9))[_0x7f5e('0x41')](handleError(_0x50972e,null));};exports[_0x7f5e('0x47')]=function(_0xdd7385,_0x51dd17){if(_0xdd7385[_0x7f5e('0x48')]['id']){delete _0xdd7385['body']['id'];}return db[_0x7f5e('0x43')][_0x7f5e('0x45')]({'where':{'id':_0xdd7385[_0x7f5e('0x49')]['id']}})['then'](handleEntityNotFound(_0x51dd17,null))['then'](saveUpdates(_0xdd7385['body'],null))[_0x7f5e('0x24')](respondWithResult(_0x51dd17,null))[_0x7f5e('0x41')](handleError(_0x51dd17,null));};exports[_0x7f5e('0x4a')]=function(_0x2b7e36,_0x344c73){return db[_0x7f5e('0x43')][_0x7f5e('0x45')]({'where':{'id':_0x2b7e36[_0x7f5e('0x49')]['id']}})[_0x7f5e('0x24')](handleEntityNotFound(_0x344c73,null))[_0x7f5e('0x24')](removeEntity(_0x344c73,null))[_0x7f5e('0x41')](handleError(_0x344c73,null));};exports[_0x7f5e('0x4b')]=function(_0x5afca0,_0x583ce0){return db[_0x7f5e('0x43')][_0x7f5e('0x4b')]()['then'](respondWithResult(_0x583ce0,null))[_0x7f5e('0x41')](handleError(_0x583ce0,null));}; \ No newline at end of file +var _0xe7b0=['order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','then','destroy','end','error','name','index','map','VoiceDialReport','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xe7b0,0x183));var _0x0e7b=function(_0x3f48e0,_0x453a44){_0x3f48e0=_0x3f48e0-0x0;var _0x2333e1=_0xe7b0[_0x3f48e0];return _0x2333e1;};'use strict';var pdf=require(_0x0e7b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e7b('0x1'));var zipdir=require(_0x0e7b('0x2'));var jsonpatch=require(_0x0e7b('0x3'));var rp=require(_0x0e7b('0x4'));var moment=require(_0x0e7b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0e7b('0x6'));var util=require(_0x0e7b('0x7'));var path=require(_0x0e7b('0x8'));var sox=require(_0x0e7b('0x9'));var csv=require(_0x0e7b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e7b('0xb'));var squel=require('squel');var crypto=require(_0x0e7b('0xc'));var jsforce=require(_0x0e7b('0xd'));var deskjs=require(_0x0e7b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0e7b('0xf'));var Papa=require(_0x0e7b('0x10'));var Redis=require(_0x0e7b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e7b('0x12'));var as=require(_0x0e7b('0x13'));var hardwareService=require(_0x0e7b('0x14'));var logger=require(_0x0e7b('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e7b('0x16'));var db=require(_0x0e7b('0x17'))['db'];function respondWithStatusCode(_0x3fee18,_0x1ff20e){_0x1ff20e=_0x1ff20e||0xcc;return function(_0x31a99b){if(_0x31a99b){return _0x3fee18[_0x0e7b('0x18')](_0x1ff20e);}return _0x3fee18[_0x0e7b('0x19')](_0x1ff20e)['end']();};}function respondWithResult(_0x2e5686,_0xe3cdf3){_0xe3cdf3=_0xe3cdf3||0xc8;return function(_0x50319d){if(_0x50319d){return _0x2e5686[_0x0e7b('0x19')](_0xe3cdf3)[_0x0e7b('0x1a')](_0x50319d);}};}function respondWithFilteredResult(_0xce805c,_0x5f0baa){return function(_0x3b645c){if(_0x3b645c){var _0x974e9d=_0x3b645c['count'],_0x1acc37=_0x5f0baa[_0x0e7b('0x1b')],_0xd03af4=_0x5f0baa[_0x0e7b('0x1b')]+_0x5f0baa[_0x0e7b('0x1c')],_0x22b373;if(_0xd03af4>=_0x974e9d){_0xd03af4=_0x974e9d;_0x22b373=0xc8;}else{_0x22b373=0xce;}_0xce805c[_0x0e7b('0x19')](_0x22b373);return _0xce805c[_0x0e7b('0x1d')]('Content-Range',_0x1acc37+'-'+_0xd03af4+'/'+_0x974e9d)[_0x0e7b('0x1a')](_0x3b645c);}return null;};}function patchUpdates(_0x324482){return function(_0x57b2a3){try{jsonpatch['apply'](_0x57b2a3,_0x324482,!![]);}catch(_0x501596){return BPromise[_0x0e7b('0x1e')](_0x501596);}return _0x57b2a3['save']();};}function saveUpdates(_0x65cc9c,_0x35106a){return function(_0x224d14){if(_0x224d14){return _0x224d14['update'](_0x65cc9c)[_0x0e7b('0x1f')](function(_0xc6da51){return _0xc6da51;});}return null;};}function removeEntity(_0x2a18c7,_0x1154d7){return function(_0x1e7f3b){if(_0x1e7f3b){return _0x1e7f3b[_0x0e7b('0x20')]()[_0x0e7b('0x1f')](function(){_0x2a18c7[_0x0e7b('0x19')](0xcc)[_0x0e7b('0x21')]();});}};}function handleEntityNotFound(_0x1ace0d,_0x49f3a){return function(_0xa18567){if(!_0xa18567){_0x1ace0d[_0x0e7b('0x18')](0x194);}return _0xa18567;};}function handleError(_0x47a77b,_0x1666c6){_0x1666c6=_0x1666c6||0x1f4;return function(_0x3d3130){logger[_0x0e7b('0x22')](_0x3d3130['stack']);if(_0x3d3130[_0x0e7b('0x23')]){delete _0x3d3130[_0x0e7b('0x23')];}_0x47a77b[_0x0e7b('0x19')](_0x1666c6)['send'](_0x3d3130);};}exports[_0x0e7b('0x24')]=function(_0x370f1a,_0x4013d3){var _0x9bf736={},_0x40d0a5={},_0x47bbf0={'count':0x0,'rows':[]};var _0x24f8f4=_[_0x0e7b('0x25')](db[_0x0e7b('0x26')]['rawAttributes'],function(_0x4056b4){return{'name':_0x4056b4[_0x0e7b('0x27')],'type':_0x4056b4[_0x0e7b('0x28')]['key']};});_0x40d0a5[_0x0e7b('0x29')]=_[_0x0e7b('0x25')](_0x24f8f4,_0x0e7b('0x23'));_0x40d0a5['query']=_[_0x0e7b('0x2a')](_0x370f1a[_0x0e7b('0x2b')]);_0x40d0a5[_0x0e7b('0x2c')]=_[_0x0e7b('0x2d')](_0x40d0a5['model'],_0x40d0a5[_0x0e7b('0x2b')]);_0x9bf736[_0x0e7b('0x2e')]=_[_0x0e7b('0x2d')](_0x40d0a5['model'],qs[_0x0e7b('0x2f')](_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x2f')]));_0x9bf736[_0x0e7b('0x2e')]=_0x9bf736['attributes'][_0x0e7b('0x30')]?_0x9bf736[_0x0e7b('0x2e')]:_0x40d0a5[_0x0e7b('0x29')];if(!_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x31')](_0x0e7b('0x32'))){_0x9bf736['limit']=qs[_0x0e7b('0x1c')](_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x1c')]);_0x9bf736[_0x0e7b('0x1b')]=qs['offset'](_0x370f1a[_0x0e7b('0x2b')]['offset']);}_0x9bf736[_0x0e7b('0x33')]=qs[_0x0e7b('0x34')](_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x34')]);_0x9bf736[_0x0e7b('0x35')]=qs[_0x0e7b('0x2c')](_[_0x0e7b('0x36')](_0x370f1a['query'],_0x40d0a5[_0x0e7b('0x2c')]),_0x24f8f4);if(_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x37')]){_0x9bf736[_0x0e7b('0x35')]=_['merge'](_0x9bf736[_0x0e7b('0x35')],{'$or':_[_0x0e7b('0x25')](_0x24f8f4,function(_0x95c52a){if(_0x95c52a['type']!==_0x0e7b('0x38')){var _0xf238cf={};_0xf238cf[_0x95c52a[_0x0e7b('0x23')]]={'$like':'%'+_0x370f1a[_0x0e7b('0x2b')][_0x0e7b('0x37')]+'%'};return _0xf238cf;}})});}_0x9bf736=_[_0x0e7b('0x39')]({},_0x9bf736,_0x370f1a[_0x0e7b('0x3a')]);var _0x33cf67={'where':_0x9bf736['where']};return db[_0x0e7b('0x26')][_0x0e7b('0x3b')](_0x33cf67)[_0x0e7b('0x1f')](function(_0xcc3963){_0x47bbf0[_0x0e7b('0x3b')]=_0xcc3963;if(_0x370f1a['query'][_0x0e7b('0x3c')]){_0x9bf736['include']=[{'all':!![]}];}return db[_0x0e7b('0x26')][_0x0e7b('0x3d')](_0x9bf736);})[_0x0e7b('0x1f')](function(_0x1db0a2){_0x47bbf0[_0x0e7b('0x3e')]=_0x1db0a2;return _0x47bbf0;})[_0x0e7b('0x1f')](respondWithFilteredResult(_0x4013d3,_0x9bf736))[_0x0e7b('0x3f')](handleError(_0x4013d3,null));};exports[_0x0e7b('0x40')]=function(_0xc19d4a,_0x52f29a){var _0x5e7dee={'raw':!![],'where':{'id':_0xc19d4a[_0x0e7b('0x41')]['id']}},_0x44b3d8={};_0x44b3d8[_0x0e7b('0x29')]=_[_0x0e7b('0x2a')](db[_0x0e7b('0x26')][_0x0e7b('0x42')]);_0x44b3d8[_0x0e7b('0x2b')]=_[_0x0e7b('0x2a')](_0xc19d4a[_0x0e7b('0x2b')]);_0x44b3d8[_0x0e7b('0x2c')]=_['intersection'](_0x44b3d8[_0x0e7b('0x29')],_0x44b3d8[_0x0e7b('0x2b')]);_0x5e7dee[_0x0e7b('0x2e')]=_['intersection'](_0x44b3d8[_0x0e7b('0x29')],qs[_0x0e7b('0x2f')](_0xc19d4a['query'][_0x0e7b('0x2f')]));_0x5e7dee[_0x0e7b('0x2e')]=_0x5e7dee[_0x0e7b('0x2e')][_0x0e7b('0x30')]?_0x5e7dee[_0x0e7b('0x2e')]:_0x44b3d8[_0x0e7b('0x29')];if(_0xc19d4a[_0x0e7b('0x2b')][_0x0e7b('0x3c')]){_0x5e7dee[_0x0e7b('0x43')]=[{'all':!![]}];}_0x5e7dee=_['merge']({},_0x5e7dee,_0xc19d4a[_0x0e7b('0x3a')]);return db[_0x0e7b('0x26')][_0x0e7b('0x44')](_0x5e7dee)[_0x0e7b('0x1f')](handleEntityNotFound(_0x52f29a,null))[_0x0e7b('0x1f')](respondWithResult(_0x52f29a,null))[_0x0e7b('0x3f')](handleError(_0x52f29a,null));};exports['create']=function(_0x4daaca,_0x4424d3){return db[_0x0e7b('0x26')][_0x0e7b('0x45')](_0x4daaca[_0x0e7b('0x46')],{})[_0x0e7b('0x1f')](respondWithResult(_0x4424d3,0xc9))[_0x0e7b('0x3f')](handleError(_0x4424d3,null));};exports[_0x0e7b('0x47')]=function(_0x7191c3,_0x4c0452){if(_0x7191c3[_0x0e7b('0x46')]['id']){delete _0x7191c3[_0x0e7b('0x46')]['id'];}return db[_0x0e7b('0x26')][_0x0e7b('0x44')]({'where':{'id':_0x7191c3[_0x0e7b('0x41')]['id']}})[_0x0e7b('0x1f')](handleEntityNotFound(_0x4c0452,null))[_0x0e7b('0x1f')](saveUpdates(_0x7191c3['body'],null))['then'](respondWithResult(_0x4c0452,null))[_0x0e7b('0x3f')](handleError(_0x4c0452,null));};exports[_0x0e7b('0x20')]=function(_0x41733c,_0x455ed2){return db['VoiceDialReport']['find']({'where':{'id':_0x41733c[_0x0e7b('0x41')]['id']}})['then'](handleEntityNotFound(_0x455ed2,null))['then'](removeEntity(_0x455ed2,null))[_0x0e7b('0x3f')](handleError(_0x455ed2,null));};exports[_0x0e7b('0x48')]=function(_0x3db837,_0x45c8a5){return db['VoiceDialReport']['describe']()[_0x0e7b('0x1f')](respondWithResult(_0x45c8a5,null))[_0x0e7b('0x3f')](handleError(_0x45c8a5,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d600743..013f25d 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 _0xd315=['VoiceDialReport','report_dial','uniqueid','util','../../config/logger','moment','path','../../config/environment'];(function(_0x24cf1d,_0x2c044d){var _0x14f6d1=function(_0x1c5282){while(--_0x1c5282){_0x24cf1d['push'](_0x24cf1d['shift']());}};_0x14f6d1(++_0x2c044d);}(_0xd315,0xdb));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5d31('0x0'));var logger=require(_0x5d31('0x1'))('api');var moment=require(_0x5d31('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d31('0x3'));var rimraf=require('rimraf');var config=require(_0x5d31('0x4'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x26640b,_0x103eda){return _0x26640b['define'](_0x5d31('0x5'),attributes,{'tableName':_0x5d31('0x6'),'paranoid':![],'indexes':[{'fields':[_0x5d31('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe24=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x422baa,_0x98d34a){var _0x31c810=function(_0xa554fe){while(--_0xa554fe){_0x422baa['push'](_0x422baa['shift']());}};_0x31c810(++_0x98d34a);}(_0xfe24,0x145));var _0x4fe2=function(_0x1986d6,_0x325bbf){_0x1986d6=_0x1986d6-0x0;var _0x51ba3c=_0xfe24[_0x1986d6];return _0x51ba3c;};'use strict';var _=require(_0x4fe2('0x0'));var util=require('util');var logger=require(_0x4fe2('0x1'))(_0x4fe2('0x2'));var moment=require('moment');var BPromise=require(_0x4fe2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fe2('0x4'));var rimraf=require(_0x4fe2('0x5'));var config=require(_0x4fe2('0x6'));var attributes=require(_0x4fe2('0x7'));module[_0x4fe2('0x8')]=function(_0x5ea0ae,_0x19f9fc){return _0x5ea0ae[_0x4fe2('0x9')](_0x4fe2('0xa'),attributes,{'tableName':_0x4fe2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4fe2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6f34e7b..6c955bc 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 _0x8878=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','debug','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x4fdee1,_0x3f290c){var _0x87826e=function(_0x2cbeaa){while(--_0x2cbeaa){_0x4fdee1['push'](_0x4fdee1['shift']());}};_0x87826e(++_0x3f290c);}(_0x8878,0xfc));var _0x8887=function(_0x1a78f0,_0x398b53){_0x1a78f0=_0x1a78f0-0x0;var _0x3704e5=_0x8878[_0x1a78f0];return _0x3704e5;};'use strict';var _=require(_0x8887('0x0'));var util=require(_0x8887('0x1'));var moment=require(_0x8887('0x2'));var BPromise=require(_0x8887('0x3'));var rs=require(_0x8887('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8887('0x5'))['db'];var utils=require(_0x8887('0x6'));var logger=require(_0x8887('0x7'))(_0x8887('0x8'));var config=require(_0x8887('0x9'));var jayson=require(_0x8887('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427879,_0x2e10b9,_0x145729){return new BPromise(function(_0x45f7c7,_0x35997c){return client[_0x8887('0xb')](_0x427879,_0x145729)[_0x8887('0xc')](function(_0x455e62){logger[_0x8887('0xd')](_0x8887('0xe'),_0x2e10b9,_0x8887('0xf'));logger['debug'](_0x8887('0x10'),_0x2e10b9,_0x8887('0xf'),JSON[_0x8887('0x11')](_0x455e62));if(_0x455e62[_0x8887('0x12')]){if(_0x455e62[_0x8887('0x12')][_0x8887('0x13')]===0x1f4){logger['error'](_0x8887('0xe'),_0x2e10b9,_0x455e62[_0x8887('0x12')][_0x8887('0x14')]);return _0x35997c(_0x455e62['error'][_0x8887('0x14')]);}logger['error'](_0x8887('0xe'),_0x2e10b9,_0x455e62['error'][_0x8887('0x14')]);return _0x45f7c7(_0x455e62[_0x8887('0x12')]['message']);}else{logger[_0x8887('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x2e10b9,_0x8887('0xf'));_0x45f7c7(_0x455e62['result']['message']);}})[_0x8887('0x15')](function(_0x12c3b4){logger[_0x8887('0x12')](_0x8887('0xe'),_0x2e10b9,_0x12c3b4);_0x35997c(_0x12c3b4);});});}exports[_0x8887('0x16')]=function(_0x1ac98a){var _0x2feb09=this;return new Promise(function(_0x5612ae,_0x4394e4){return db[_0x8887('0x17')]['create'](_0x1ac98a[_0x8887('0x18')],{'raw':_0x1ac98a[_0x8887('0x19')]?_0x1ac98a[_0x8887('0x19')][_0x8887('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x52b09e){logger[_0x8887('0xd')]('CreateVoiceDialReport',_0x1ac98a);logger[_0x8887('0x1b')](_0x8887('0x16'),_0x1ac98a,JSON[_0x8887('0x11')](_0x52b09e));_0x5612ae(_0x52b09e);})['catch'](function(_0x37ed37){logger[_0x8887('0x12')](_0x8887('0x16'),_0x37ed37[_0x8887('0x14')],_0x1ac98a);_0x4394e4(_0x2feb09[_0x8887('0x12')](0x1f4,_0x37ed37['message']));});});};exports['UpdateVoiceDialReport']=function(_0x2a4bb9){var _0x36b06e=this;return new Promise(function(_0x4036e6,_0xb18456){return db['VoiceDialReport'][_0x8887('0x1c')](_0x2a4bb9[_0x8887('0x18')],{'raw':_0x2a4bb9[_0x8887('0x19')]?_0x2a4bb9['options'][_0x8887('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4bb9[_0x8887('0x19')]?_0x2a4bb9[_0x8887('0x19')][_0x8887('0x1d')]||null:null,'attributes':_0x2a4bb9[_0x8887('0x19')]?_0x2a4bb9[_0x8887('0x19')][_0x8887('0x1e')]||null:null,'limit':_0x2a4bb9['options']?_0x2a4bb9[_0x8887('0x19')][_0x8887('0x1f')]||null:null})[_0x8887('0xc')](function(_0x21b80f){logger[_0x8887('0xd')](_0x8887('0x20'),_0x2a4bb9);logger[_0x8887('0x1b')](_0x8887('0x20'),_0x2a4bb9,JSON[_0x8887('0x11')](_0x21b80f));_0x4036e6(_0x21b80f);})[_0x8887('0x15')](function(_0x2f37a6){logger[_0x8887('0x12')]('UpdateVoiceDialReport',_0x2f37a6[_0x8887('0x14')],_0x2a4bb9);_0xb18456(_0x36b06e[_0x8887('0x12')](0x1f4,_0x2f37a6['message']));});});}; \ No newline at end of file +var _0xcb36=['options','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceDialReport','create','body','raw','debug','VoiceDialReport'];(function(_0x3d9740,_0x32dd79){var _0x58b687=function(_0x366584){while(--_0x366584){_0x3d9740['push'](_0x3d9740['shift']());}};_0x58b687(++_0x32dd79);}(_0xcb36,0x126));var _0x6cb3=function(_0x2aaebe,_0x7b241f){_0x2aaebe=_0x2aaebe-0x0;var _0x50c5ab=_0xcb36[_0x2aaebe];return _0x50c5ab;};'use strict';var _=require(_0x6cb3('0x0'));var util=require(_0x6cb3('0x1'));var moment=require(_0x6cb3('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cb3('0x4'));var logger=require(_0x6cb3('0x5'))(_0x6cb3('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cb3('0x7'));var client=jayson[_0x6cb3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f6803,_0x9cce96,_0x5606fc){return new BPromise(function(_0x1fa4b9,_0x56ccc0){return client[_0x6cb3('0x9')](_0x4f6803,_0x5606fc)[_0x6cb3('0xa')](function(_0x5e21ea){logger[_0x6cb3('0xb')](_0x6cb3('0xc'),_0x9cce96,_0x6cb3('0xd'));logger['debug'](_0x6cb3('0xe'),_0x9cce96,_0x6cb3('0xd'),JSON[_0x6cb3('0xf')](_0x5e21ea));if(_0x5e21ea[_0x6cb3('0x10')]){if(_0x5e21ea['error']['code']===0x1f4){logger[_0x6cb3('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x9cce96,_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);return _0x56ccc0(_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x9cce96,_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);return _0x1fa4b9(_0x5e21ea[_0x6cb3('0x10')][_0x6cb3('0x11')]);}else{logger[_0x6cb3('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x9cce96,_0x6cb3('0xd'));_0x1fa4b9(_0x5e21ea['result']['message']);}})[_0x6cb3('0x12')](function(_0x3539b5){logger[_0x6cb3('0x10')](_0x6cb3('0xc'),_0x9cce96,_0x3539b5);_0x56ccc0(_0x3539b5);});});}exports[_0x6cb3('0x13')]=function(_0x1bff16){var _0x572513=this;return new Promise(function(_0x4d05b6,_0x5bcc53){return db['VoiceDialReport'][_0x6cb3('0x14')](_0x1bff16[_0x6cb3('0x15')],{'raw':_0x1bff16['options']?_0x1bff16['options'][_0x6cb3('0x16')]===undefined?!![]:![]:!![]})[_0x6cb3('0xa')](function(_0x50870d){logger[_0x6cb3('0xb')](_0x6cb3('0x13'),_0x1bff16);logger[_0x6cb3('0x17')](_0x6cb3('0x13'),_0x1bff16,JSON[_0x6cb3('0xf')](_0x50870d));_0x4d05b6(_0x50870d);})[_0x6cb3('0x12')](function(_0x44c799){logger[_0x6cb3('0x10')](_0x6cb3('0x13'),_0x44c799[_0x6cb3('0x11')],_0x1bff16);_0x5bcc53(_0x572513[_0x6cb3('0x10')](0x1f4,_0x44c799[_0x6cb3('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x1855b5){var _0x5e537d=this;return new Promise(function(_0x5009ba,_0x310dca){return db[_0x6cb3('0x18')]['update'](_0x1855b5['body'],{'raw':_0x1855b5[_0x6cb3('0x19')]?_0x1855b5[_0x6cb3('0x19')][_0x6cb3('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1855b5[_0x6cb3('0x19')]?_0x1855b5[_0x6cb3('0x19')]['where']||null:null,'attributes':_0x1855b5[_0x6cb3('0x19')]?_0x1855b5[_0x6cb3('0x19')][_0x6cb3('0x1a')]||null:null,'limit':_0x1855b5['options']?_0x1855b5[_0x6cb3('0x19')][_0x6cb3('0x1b')]||null:null})[_0x6cb3('0xa')](function(_0x4ef413){logger['info'](_0x6cb3('0x1c'),_0x1855b5);logger[_0x6cb3('0x17')](_0x6cb3('0x1c'),_0x1855b5,JSON['stringify'](_0x4ef413));_0x5009ba(_0x4ef413);})[_0x6cb3('0x12')](function(_0x1f9ed9){logger[_0x6cb3('0x10')](_0x6cb3('0x1c'),_0x1f9ed9['message'],_0x1855b5);_0x310dca(_0x5e537d['error'](0x1f4,_0x1f9ed9[_0x6cb3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e7e21eb..f4b8d0c 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 _0xae41=['post','/:id/applications','update','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','create'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xae41,0xaf));var _0x1ae4=function(_0x4e7d76,_0x643721){_0x4e7d76=_0x4e7d76-0x0;var _0x5e6d37=_0xae41[_0x4e7d76];return _0x5e6d37;};'use strict';var multer=require(_0x1ae4('0x0'));var util=require(_0x1ae4('0x1'));var path=require(_0x1ae4('0x2'));var timeout=require(_0x1ae4('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1ae4('0x4'));var config=require('../../config/environment');var controller=require(_0x1ae4('0x5'));router[_0x1ae4('0x6')]('/',auth['isAuthenticated'](),controller[_0x1ae4('0x7')]);router['get'](_0x1ae4('0x8'),auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xa')]);router['post']('/',auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xb')]);router[_0x1ae4('0xc')](_0x1ae4('0xd'),auth[_0x1ae4('0x9')](),controller['addApplications']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1ae4('0xe')]);router['delete'](_0x1ae4('0x8'),auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xf')]);module[_0x1ae4('0x10')]=router; \ No newline at end of file +var _0xa0c8=['addApplications','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','/:id/applications'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa0c8,0xf2));var _0x8a0c=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0xa0c8[_0x3fbb91];return _0x3eb213;};'use strict';var multer=require(_0x8a0c('0x0'));var util=require(_0x8a0c('0x1'));var path=require('path');var timeout=require(_0x8a0c('0x2'));var express=require(_0x8a0c('0x3'));var router=express[_0x8a0c('0x4')]();var auth=require(_0x8a0c('0x5'));var interaction=require(_0x8a0c('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x8a0c('0x7')](),controller[_0x8a0c('0x8')]);router[_0x8a0c('0x9')](_0x8a0c('0xa'),auth[_0x8a0c('0x7')](),controller[_0x8a0c('0xb')]);router['post']('/',auth[_0x8a0c('0x7')](),controller['create']);router[_0x8a0c('0xc')](_0x8a0c('0xd'),auth[_0x8a0c('0x7')](),controller[_0x8a0c('0xe')]);router['put'](_0x8a0c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8a0c('0x7')](),controller[_0x8a0c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d59374a..bdfea73 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(_0x14933c,_0x1221ef){var _0x18a785=function(_0x43e1ab){while(--_0x43e1ab){_0x14933c['push'](_0x14933c['shift']());}};_0x18a785(++_0x1221ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1b5c63,_0x5a08b2){var _0x25753e=function(_0x45a839){while(--_0x45a839){_0x1b5c63['push'](_0x1b5c63['shift']());}};_0x25753e(++_0x5a08b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 457613b..5b1f957 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 _0xc896=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','set','apply','reject','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','map','value','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceExtension','rawAttributes','fieldName','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','filters','pick','where','VIRTUAL','merge','options','count','includeAll','catch','show','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x3dfc6a,_0x3f5c71){var _0x1872ba=function(_0x27f009){while(--_0x27f009){_0x3dfc6a['push'](_0x3dfc6a['shift']());}};_0x1872ba(++_0x3f5c71);}(_0xc896,0x184));var _0x6c89=function(_0x59c4e8,_0x4a736b){_0x59c4e8=_0x59c4e8-0x0;var _0x1c15e8=_0xc896[_0x59c4e8];return _0x1c15e8;};'use strict';var pdf=require(_0x6c89('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6c89('0x1'));var zipdir=require(_0x6c89('0x2'));var jsonpatch=require(_0x6c89('0x3'));var rp=require(_0x6c89('0x4'));var moment=require(_0x6c89('0x5'));var BPromise=require(_0x6c89('0x6'));var Mustache=require('mustache');var util=require(_0x6c89('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6c89('0x8'));var ejs=require(_0x6c89('0x9'));var fs=require('fs');var _=require(_0x6c89('0xa'));var squel=require(_0x6c89('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c89('0xc'));var deskjs=require(_0x6c89('0xd'));var toCsv=require(_0x6c89('0x8'));var querystring=require('querystring');var Papa=require(_0x6c89('0xe'));var Redis=require(_0x6c89('0xf'));var authService=require(_0x6c89('0x10'));var qs=require(_0x6c89('0x11'));var as=require(_0x6c89('0x12'));var hardwareService=require(_0x6c89('0x13'));var logger=require(_0x6c89('0x14'))(_0x6c89('0x15'));var utils=require('../../config/utils');var config=require(_0x6c89('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c89('0x17'))['db'];config[_0x6c89('0x18')]=_[_0x6c89('0x19')](config['redis'],{'host':_0x6c89('0x1a'),'port':0x18eb});var socket=require(_0x6c89('0x1b'))(new Redis(config[_0x6c89('0x18')]));require(_0x6c89('0x1c'))[_0x6c89('0x1d')](socket);function respondWithStatusCode(_0x4c66f1,_0x1e3463){_0x1e3463=_0x1e3463||0xcc;return function(_0x37add9){if(_0x37add9){return _0x4c66f1[_0x6c89('0x1e')](_0x1e3463);}return _0x4c66f1[_0x6c89('0x1f')](_0x1e3463)['end']();};}function respondWithResult(_0x469f66,_0x18152f){_0x18152f=_0x18152f||0xc8;return function(_0x46ba02){if(_0x46ba02){return _0x469f66['status'](_0x18152f)[_0x6c89('0x20')](_0x46ba02);}};}function respondWithFilteredResult(_0x684e4f,_0x14ada5){return function(_0x3a2d62){if(_0x3a2d62){var _0x3ad539=_0x3a2d62['count'],_0x496daa=_0x14ada5[_0x6c89('0x21')],_0x265a21=_0x14ada5[_0x6c89('0x21')]+_0x14ada5['limit'],_0x4bc10e;if(_0x265a21>=_0x3ad539){_0x265a21=_0x3ad539;_0x4bc10e=0xc8;}else{_0x4bc10e=0xce;}_0x684e4f[_0x6c89('0x1f')](_0x4bc10e);return _0x684e4f[_0x6c89('0x22')]('Content-Range',_0x496daa+'-'+_0x265a21+'/'+_0x3ad539)['json'](_0x3a2d62);}return null;};}function patchUpdates(_0x1fbee6){return function(_0x290f4b){try{jsonpatch[_0x6c89('0x23')](_0x290f4b,_0x1fbee6,!![]);}catch(_0x1f8287){return BPromise[_0x6c89('0x24')](_0x1f8287);}return _0x290f4b[_0x6c89('0x25')]();};}function saveUpdates(_0x1b217f,_0x237104){return function(_0x2b36ab){if(_0x2b36ab){return _0x2b36ab[_0x6c89('0x26')](_0x1b217f)[_0x6c89('0x27')](function(_0x1d99c7){return _0x1d99c7;});}return null;};}function removeEntity(_0x53759f,_0x5173df){return function(_0x496109){if(_0x496109){return _0x496109['destroy']()[_0x6c89('0x27')](function(){var _0x4043c2=_0x496109[_0x6c89('0x28')]({'plain':!![]});var _0x3040bc=[{'name':_0x6c89('0x29'),'value':_0x6c89('0x2a'),'ignore':![]},{'name':_0x6c89('0x2b'),'value':_0x6c89('0x2c'),'ignore':![]},{'name':'InternalRoutes','value':_0x6c89('0x2d'),'ignore':![]}];var _0x55ad12=_(_0x3040bc)[_0x6c89('0x2e')]('ignore')[_0x6c89('0x2f')](_0x6c89('0x30'))[_0x6c89('0x30')]();if(_['includes'](_0x55ad12,_0x4043c2[_0x6c89('0x31')])){return;}var _0x444fb0=_[_0x6c89('0x32')](_0x3040bc,[_0x6c89('0x30'),_0x4043c2[_0x6c89('0x31')]])[_0x6c89('0x33')];return db[_0x6c89('0x34')][_0x6c89('0x35')]({'where':{'type':_0x444fb0,'resourceId':_0x4043c2['id']}})['then'](function(){return _0x496109;});})[_0x6c89('0x27')](function(){_0x53759f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x186cec,_0x2b7341){return function(_0x4518d3){if(!_0x4518d3){_0x186cec['sendStatus'](0x194);}return _0x4518d3;};}function handleError(_0x5b99e7,_0x471857){_0x471857=_0x471857||0x1f4;return function(_0x561afc){logger[_0x6c89('0x36')](_0x561afc[_0x6c89('0x37')]);if(_0x561afc['name']){delete _0x561afc[_0x6c89('0x33')];}_0x5b99e7[_0x6c89('0x1f')](_0x471857)['send'](_0x561afc);};}exports[_0x6c89('0x38')]=function(_0x218d77,_0x32e8af){var _0x85b0eb={},_0x2ac279={},_0x1cc3ba={'count':0x0,'rows':[]};var _0x448195=_['map'](db[_0x6c89('0x39')][_0x6c89('0x3a')],function(_0x23c9f8){return{'name':_0x23c9f8[_0x6c89('0x3b')],'type':_0x23c9f8[_0x6c89('0x31')]['key']};});_0x2ac279['model']=_[_0x6c89('0x2f')](_0x448195,_0x6c89('0x33'));_0x2ac279[_0x6c89('0x3c')]=_[_0x6c89('0x3d')](_0x218d77[_0x6c89('0x3c')]);_0x2ac279['filters']=_[_0x6c89('0x3e')](_0x2ac279[_0x6c89('0x3f')],_0x2ac279[_0x6c89('0x3c')]);_0x85b0eb['attributes']=_[_0x6c89('0x3e')](_0x2ac279[_0x6c89('0x3f')],qs[_0x6c89('0x40')](_0x218d77[_0x6c89('0x3c')]['fields']));_0x85b0eb[_0x6c89('0x41')]=_0x85b0eb[_0x6c89('0x41')][_0x6c89('0x42')]?_0x85b0eb[_0x6c89('0x41')]:_0x2ac279['model'];if(!_0x218d77['query'][_0x6c89('0x43')](_0x6c89('0x44'))){_0x85b0eb[_0x6c89('0x45')]=qs[_0x6c89('0x45')](_0x218d77['query']['limit']);_0x85b0eb['offset']=qs[_0x6c89('0x21')](_0x218d77['query'][_0x6c89('0x21')]);}_0x85b0eb[_0x6c89('0x46')]=qs['sort'](_0x218d77[_0x6c89('0x3c')]['sort']);_0x85b0eb['where']=qs[_0x6c89('0x47')](_[_0x6c89('0x48')](_0x218d77[_0x6c89('0x3c')],_0x2ac279[_0x6c89('0x47')]),_0x448195);if(_0x218d77[_0x6c89('0x3c')][_0x6c89('0x2e')]){_0x85b0eb[_0x6c89('0x49')]=_['merge'](_0x85b0eb[_0x6c89('0x49')],{'$or':_[_0x6c89('0x2f')](_0x448195,function(_0x343620){if(_0x343620[_0x6c89('0x31')]!==_0x6c89('0x4a')){var _0x39a9da={};_0x39a9da[_0x343620[_0x6c89('0x33')]]={'$like':'%'+_0x218d77['query'][_0x6c89('0x2e')]+'%'};return _0x39a9da;}})});}_0x85b0eb=_[_0x6c89('0x4b')]({},_0x85b0eb,_0x218d77[_0x6c89('0x4c')]);var _0x59b941={'where':_0x85b0eb[_0x6c89('0x49')]};return db[_0x6c89('0x39')][_0x6c89('0x4d')](_0x59b941)['then'](function(_0x2ad8e7){_0x1cc3ba[_0x6c89('0x4d')]=_0x2ad8e7;if(_0x218d77[_0x6c89('0x3c')][_0x6c89('0x4e')]){_0x85b0eb['include']=[{'all':!![]}];}return db[_0x6c89('0x39')]['findAll'](_0x85b0eb);})[_0x6c89('0x27')](function(_0x437066){_0x1cc3ba['rows']=_0x437066;return _0x1cc3ba;})['then'](respondWithFilteredResult(_0x32e8af,_0x85b0eb))[_0x6c89('0x4f')](handleError(_0x32e8af,null));};exports[_0x6c89('0x50')]=function(_0x39a357,_0x49afc2){var _0x46257c={'raw':![],'where':{'id':_0x39a357['params']['id']}},_0x583953={};_0x583953[_0x6c89('0x3f')]=_[_0x6c89('0x3d')](db[_0x6c89('0x39')][_0x6c89('0x3a')]);_0x583953[_0x6c89('0x3c')]=_[_0x6c89('0x3d')](_0x39a357['query']);_0x583953[_0x6c89('0x47')]=_[_0x6c89('0x3e')](_0x583953[_0x6c89('0x3f')],_0x583953['query']);_0x46257c['attributes']=_[_0x6c89('0x3e')](_0x583953['model'],qs[_0x6c89('0x40')](_0x39a357[_0x6c89('0x3c')][_0x6c89('0x40')]));_0x46257c['attributes']=_0x46257c[_0x6c89('0x41')][_0x6c89('0x42')]?_0x46257c['attributes']:_0x583953[_0x6c89('0x3f')];if(_0x39a357[_0x6c89('0x3c')]['includeAll']){_0x46257c['include']=[{'all':!![]}];}_0x46257c=_[_0x6c89('0x4b')]({},_0x46257c,_0x39a357[_0x6c89('0x4c')]);return db[_0x6c89('0x39')][_0x6c89('0x32')](_0x46257c)['then'](handleEntityNotFound(_0x49afc2,null))[_0x6c89('0x27')](respondWithResult(_0x49afc2,null))[_0x6c89('0x4f')](handleError(_0x49afc2,null));};exports[_0x6c89('0x35')]=function(_0x57e557,_0x4308b0){return db[_0x6c89('0x39')][_0x6c89('0x32')]({'where':{'id':_0x57e557['params']['id']}})[_0x6c89('0x27')](handleEntityNotFound(_0x4308b0,null))['then'](removeEntity(_0x4308b0,null))['catch'](handleError(_0x4308b0,null));};exports[_0x6c89('0x51')]=function(_0x42a67c,_0xf0055f){if(_0x42a67c[_0x6c89('0x52')]['type']===_0x6c89('0x2c')&&!_['startsWith'](_0x42a67c['body']['exten'],'_')){_0x42a67c[_0x6c89('0x52')][_0x6c89('0x53')]='_'[_0x6c89('0x54')](_0x42a67c[_0x6c89('0x52')][_0x6c89('0x53')]);}return db[_0x6c89('0x39')]['create'](_0x42a67c['body'],{'raw':![]})['then'](function(_0x1d43d0){var _0x167204=_0x42a67c[_0x6c89('0x55')][_0x6c89('0x28')]({'plain':!![]});if(!_0x167204)throw new Error(_0x6c89('0x56'));if(_0x167204[_0x6c89('0x57')]==='user'){var _0x15b34a=_0x1d43d0[_0x6c89('0x28')]({'plain':!![]});var _0x4d9b98=[{'name':_0x6c89('0x29'),'value':_0x6c89('0x2a')},{'name':_0x6c89('0x2b'),'value':_0x6c89('0x2c')},{'name':'InternalRoutes','value':'internal'}];var _0x34d329=_[_0x6c89('0x32')](_0x4d9b98,[_0x6c89('0x30'),_0x15b34a[_0x6c89('0x31')]])[_0x6c89('0x33')];return db[_0x6c89('0x58')][_0x6c89('0x32')]({'where':{'name':_0x34d329,'userProfileId':_0x167204['userProfileId']},'raw':!![]})[_0x6c89('0x27')](function(_0x55aca9){if(_0x55aca9&&_0x55aca9['autoAssociation']===0x0){return db[_0x6c89('0x34')][_0x6c89('0x51')]({'name':_0x15b34a[_0x6c89('0x33')],'resourceId':_0x15b34a['id'],'type':_0x55aca9[_0x6c89('0x33')],'sectionId':_0x55aca9['id']},{})['then'](function(){return _0x1d43d0;});}else{return _0x1d43d0;}})['catch'](function(_0x48fcb8){logger[_0x6c89('0x36')](_0x6c89('0x59'),_0x48fcb8);throw _0x48fcb8;});}return _0x1d43d0;})[_0x6c89('0x27')](respondWithResult(_0xf0055f,0xc9))[_0x6c89('0x4f')](handleError(_0xf0055f,null));};exports[_0x6c89('0x26')]=function(_0x30f837,_0x180437){if(_0x30f837[_0x6c89('0x52')]['id']){delete _0x30f837[_0x6c89('0x52')]['id'];}return db['VoiceExtension'][_0x6c89('0x32')]({'where':{'id':_0x30f837[_0x6c89('0x5a')]['id']}})[_0x6c89('0x27')](handleEntityNotFound(_0x180437,null))['then'](function(_0xabc05b){if(_0xabc05b){return db[_0x6c89('0x39')][_0x6c89('0x26')](_[_0x6c89('0x48')](_0x30f837[_0x6c89('0x52')],[_0x6c89('0x53'),'context',_0x6c89('0x5b'),_0x6c89('0x5c'),_0x6c89('0x5d'),_0x6c89('0x5e')]),{'where':{'context':_0xabc05b['context'],'exten':_0xabc05b[_0x6c89('0x53')]},'individualHooks':!![]})[_0x6c89('0x27')](function(_0x2e0c3c){return _0x2e0c3c;});}return null;})[_0x6c89('0x27')](respondWithStatusCode(_0x180437,null))['catch'](handleError(_0x180437,null));};exports[_0x6c89('0x5f')]=function(_0x32a73c,_0x5303ae,_0x27d901){return db[_0x6c89('0x39')][_0x6c89('0x60')]({'where':{'id':_0x32a73c['params']['id']}})[_0x6c89('0x27')](handleEntityNotFound(_0x5303ae,null))[_0x6c89('0x27')](function(_0x12f584){if(_0x12f584){return db[_0x6c89('0x61')][_0x6c89('0x62')](function(_0x7d786c){return db[_0x6c89('0x39')][_0x6c89('0x35')]({'where':{'VoiceExtensionId':_0x32a73c['params']['id']},'transaction':_0x7d786c})[_0x6c89('0x27')](function(_0xf6290d){var _0x17fa89=_[_0x6c89('0x2f')](_0x32a73c[_0x6c89('0x52')],function(_0x38dbf4){_0x38dbf4[_0x6c89('0x63')]=_0x32a73c['params']['id'];return _0x38dbf4;});return db[_0x6c89('0x39')]['bulkCreate'](_0x17fa89,{'transaction':_0x7d786c});});})[_0x6c89('0x27')](function(){return db[_0x6c89('0x39')][_0x6c89('0x64')]({'where':{'isApp':!![],'VoiceExtensionId':_0x32a73c[_0x6c89('0x5a')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x5303ae,null))[_0x6c89('0x4f')](handleError(_0x5303ae,null));}; \ No newline at end of file +var _0x283a=['InboundRoutes','OutboundRoutes','outbound','internal','filter','ignore','map','value','type','name','UserProfileResource','sendStatus','error','stack','send','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','where','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','VoiceExtensionId','findAndCountAll','html-pdf','eml-format','zip-dir','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','set','reject','save','update','then','destroy','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x283a,0x168));var _0xa283=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x283a[_0x2bf888];return _0x3038d6;};'use strict';var pdf=require(_0xa283('0x0'));var emlformat=require(_0xa283('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa283('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa283('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa283('0x4'));var util=require(_0xa283('0x5'));var path=require(_0xa283('0x6'));var sox=require('sox');var csv=require(_0xa283('0x7'));var ejs=require(_0xa283('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa283('0x9'));var crypto=require(_0xa283('0xa'));var jsforce=require(_0xa283('0xb'));var deskjs=require(_0xa283('0xc'));var toCsv=require(_0xa283('0x7'));var querystring=require(_0xa283('0xd'));var Papa=require('papaparse');var Redis=require(_0xa283('0xe'));var authService=require(_0xa283('0xf'));var qs=require(_0xa283('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa283('0x11'));var logger=require(_0xa283('0x12'))(_0xa283('0x13'));var utils=require('../../config/utils');var config=require(_0xa283('0x14'));var licenseUtil=require(_0xa283('0x15'));var db=require(_0xa283('0x16'))['db'];config[_0xa283('0x17')]=_[_0xa283('0x18')](config['redis'],{'host':_0xa283('0x19'),'port':0x18eb});var socket=require(_0xa283('0x1a'))(new Redis(config[_0xa283('0x17')]));require('./voiceExtension.socket')[_0xa283('0x1b')](socket);function respondWithStatusCode(_0x51150c,_0x5cc910){_0x5cc910=_0x5cc910||0xcc;return function(_0xf5ff4c){if(_0xf5ff4c){return _0x51150c['sendStatus'](_0x5cc910);}return _0x51150c[_0xa283('0x1c')](_0x5cc910)[_0xa283('0x1d')]();};}function respondWithResult(_0x53154e,_0x42140f){_0x42140f=_0x42140f||0xc8;return function(_0x73dbe5){if(_0x73dbe5){return _0x53154e[_0xa283('0x1c')](_0x42140f)[_0xa283('0x1e')](_0x73dbe5);}};}function respondWithFilteredResult(_0x4ef539,_0xb54080){return function(_0x1e4c6a){if(_0x1e4c6a){var _0x8685f=_0x1e4c6a[_0xa283('0x1f')],_0x1d3ab7=_0xb54080[_0xa283('0x20')],_0x9cc0f3=_0xb54080[_0xa283('0x20')]+_0xb54080['limit'],_0x4fa55d;if(_0x9cc0f3>=_0x8685f){_0x9cc0f3=_0x8685f;_0x4fa55d=0xc8;}else{_0x4fa55d=0xce;}_0x4ef539[_0xa283('0x1c')](_0x4fa55d);return _0x4ef539[_0xa283('0x21')]('Content-Range',_0x1d3ab7+'-'+_0x9cc0f3+'/'+_0x8685f)['json'](_0x1e4c6a);}return null;};}function patchUpdates(_0x459188){return function(_0x4c6775){try{jsonpatch['apply'](_0x4c6775,_0x459188,!![]);}catch(_0x4dc653){return BPromise[_0xa283('0x22')](_0x4dc653);}return _0x4c6775[_0xa283('0x23')]();};}function saveUpdates(_0x461a38,_0x762e98){return function(_0x413578){if(_0x413578){return _0x413578[_0xa283('0x24')](_0x461a38)[_0xa283('0x25')](function(_0x2f37a8){return _0x2f37a8;});}return null;};}function removeEntity(_0x8cde70,_0x2a6567){return function(_0x42e0ae){if(_0x42e0ae){return _0x42e0ae[_0xa283('0x26')]()['then'](function(){var _0x5f41d0=_0x42e0ae[_0xa283('0x27')]({'plain':!![]});var _0x5e826a=[{'name':_0xa283('0x28'),'value':'inbound','ignore':![]},{'name':_0xa283('0x29'),'value':_0xa283('0x2a'),'ignore':![]},{'name':'InternalRoutes','value':_0xa283('0x2b'),'ignore':![]}];var _0x515889=_(_0x5e826a)[_0xa283('0x2c')](_0xa283('0x2d'))[_0xa283('0x2e')]('value')[_0xa283('0x2f')]();if(_['includes'](_0x515889,_0x5f41d0[_0xa283('0x30')])){return;}var _0x36c94c=_['find'](_0x5e826a,['value',_0x5f41d0[_0xa283('0x30')]])[_0xa283('0x31')];return db[_0xa283('0x32')][_0xa283('0x26')]({'where':{'type':_0x36c94c,'resourceId':_0x5f41d0['id']}})[_0xa283('0x25')](function(){return _0x42e0ae;});})[_0xa283('0x25')](function(){_0x8cde70[_0xa283('0x1c')](0xcc)[_0xa283('0x1d')]();});}};}function handleEntityNotFound(_0x3bd74c,_0x215105){return function(_0x18ffe1){if(!_0x18ffe1){_0x3bd74c[_0xa283('0x33')](0x194);}return _0x18ffe1;};}function handleError(_0x4f68fd,_0x3c53f9){_0x3c53f9=_0x3c53f9||0x1f4;return function(_0x21dace){logger[_0xa283('0x34')](_0x21dace[_0xa283('0x35')]);if(_0x21dace[_0xa283('0x31')]){delete _0x21dace[_0xa283('0x31')];}_0x4f68fd['status'](_0x3c53f9)[_0xa283('0x36')](_0x21dace);};}exports['index']=function(_0xb679ab,_0x2f343f){var _0x10d0f0={},_0x5bd797={},_0x5c4182={'count':0x0,'rows':[]};var _0x44342e=_[_0xa283('0x2e')](db['VoiceExtension']['rawAttributes'],function(_0x2444e6){return{'name':_0x2444e6['fieldName'],'type':_0x2444e6[_0xa283('0x30')]['key']};});_0x5bd797[_0xa283('0x37')]=_[_0xa283('0x2e')](_0x44342e,_0xa283('0x31'));_0x5bd797['query']=_['keys'](_0xb679ab[_0xa283('0x38')]);_0x5bd797['filters']=_[_0xa283('0x39')](_0x5bd797[_0xa283('0x37')],_0x5bd797['query']);_0x10d0f0[_0xa283('0x3a')]=_[_0xa283('0x39')](_0x5bd797[_0xa283('0x37')],qs['fields'](_0xb679ab[_0xa283('0x38')][_0xa283('0x3b')]));_0x10d0f0[_0xa283('0x3a')]=_0x10d0f0[_0xa283('0x3a')][_0xa283('0x3c')]?_0x10d0f0[_0xa283('0x3a')]:_0x5bd797[_0xa283('0x37')];if(!_0xb679ab[_0xa283('0x38')][_0xa283('0x3d')]('nolimit')){_0x10d0f0[_0xa283('0x3e')]=qs['limit'](_0xb679ab[_0xa283('0x38')][_0xa283('0x3e')]);_0x10d0f0[_0xa283('0x20')]=qs[_0xa283('0x20')](_0xb679ab['query'][_0xa283('0x20')]);}_0x10d0f0[_0xa283('0x3f')]=qs['sort'](_0xb679ab[_0xa283('0x38')][_0xa283('0x40')]);_0x10d0f0['where']=qs[_0xa283('0x41')](_['pick'](_0xb679ab[_0xa283('0x38')],_0x5bd797['filters']),_0x44342e);if(_0xb679ab[_0xa283('0x38')]['filter']){_0x10d0f0[_0xa283('0x42')]=_[_0xa283('0x43')](_0x10d0f0['where'],{'$or':_[_0xa283('0x2e')](_0x44342e,function(_0x131d9e){if(_0x131d9e['type']!==_0xa283('0x44')){var _0x435fc5={};_0x435fc5[_0x131d9e[_0xa283('0x31')]]={'$like':'%'+_0xb679ab[_0xa283('0x38')]['filter']+'%'};return _0x435fc5;}})});}_0x10d0f0=_['merge']({},_0x10d0f0,_0xb679ab[_0xa283('0x45')]);var _0x43071c={'where':_0x10d0f0[_0xa283('0x42')]};return db[_0xa283('0x46')][_0xa283('0x1f')](_0x43071c)[_0xa283('0x25')](function(_0x5234fb){_0x5c4182[_0xa283('0x1f')]=_0x5234fb;if(_0xb679ab[_0xa283('0x38')]['includeAll']){_0x10d0f0[_0xa283('0x47')]=[{'all':!![]}];}return db['VoiceExtension'][_0xa283('0x48')](_0x10d0f0);})[_0xa283('0x25')](function(_0x95c63b){_0x5c4182[_0xa283('0x49')]=_0x95c63b;return _0x5c4182;})[_0xa283('0x25')](respondWithFilteredResult(_0x2f343f,_0x10d0f0))[_0xa283('0x4a')](handleError(_0x2f343f,null));};exports[_0xa283('0x4b')]=function(_0x18e5de,_0x2975e4){var _0x51de34={'raw':![],'where':{'id':_0x18e5de[_0xa283('0x4c')]['id']}},_0x363aa0={};_0x363aa0['model']=_['keys'](db[_0xa283('0x46')][_0xa283('0x4d')]);_0x363aa0['query']=_['keys'](_0x18e5de[_0xa283('0x38')]);_0x363aa0['filters']=_[_0xa283('0x39')](_0x363aa0[_0xa283('0x37')],_0x363aa0[_0xa283('0x38')]);_0x51de34[_0xa283('0x3a')]=_[_0xa283('0x39')](_0x363aa0['model'],qs['fields'](_0x18e5de[_0xa283('0x38')][_0xa283('0x3b')]));_0x51de34[_0xa283('0x3a')]=_0x51de34['attributes'][_0xa283('0x3c')]?_0x51de34[_0xa283('0x3a')]:_0x363aa0[_0xa283('0x37')];if(_0x18e5de[_0xa283('0x38')][_0xa283('0x4e')]){_0x51de34[_0xa283('0x47')]=[{'all':!![]}];}_0x51de34=_[_0xa283('0x43')]({},_0x51de34,_0x18e5de['options']);return db[_0xa283('0x46')]['find'](_0x51de34)[_0xa283('0x25')](handleEntityNotFound(_0x2975e4,null))[_0xa283('0x25')](respondWithResult(_0x2975e4,null))[_0xa283('0x4a')](handleError(_0x2975e4,null));};exports[_0xa283('0x26')]=function(_0x2334fd,_0x34d7d5){return db['VoiceExtension']['find']({'where':{'id':_0x2334fd[_0xa283('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34d7d5,null))['then'](removeEntity(_0x34d7d5,null))[_0xa283('0x4a')](handleError(_0x34d7d5,null));};exports[_0xa283('0x4f')]=function(_0x1ab106,_0xa25bfe){if(_0x1ab106[_0xa283('0x50')][_0xa283('0x30')]===_0xa283('0x2a')&&!_[_0xa283('0x51')](_0x1ab106['body'][_0xa283('0x52')],'_')){_0x1ab106[_0xa283('0x50')]['exten']='_'[_0xa283('0x53')](_0x1ab106[_0xa283('0x50')]['exten']);}return db['VoiceExtension']['create'](_0x1ab106[_0xa283('0x50')],{'raw':![]})['then'](function(_0x4eda32){var _0x58778f=_0x1ab106['user'][_0xa283('0x27')]({'plain':!![]});if(!_0x58778f)throw new Error(_0xa283('0x54'));if(_0x58778f[_0xa283('0x55')]==='user'){var _0x288b69=_0x4eda32[_0xa283('0x27')]({'plain':!![]});var _0x12a31b=[{'name':_0xa283('0x28'),'value':'inbound'},{'name':_0xa283('0x29'),'value':_0xa283('0x2a')},{'name':'InternalRoutes','value':_0xa283('0x2b')}];var _0x29a331=_[_0xa283('0x56')](_0x12a31b,[_0xa283('0x2f'),_0x288b69[_0xa283('0x30')]])[_0xa283('0x31')];return db[_0xa283('0x57')][_0xa283('0x56')]({'where':{'name':_0x29a331,'userProfileId':_0x58778f['userProfileId']},'raw':!![]})['then'](function(_0x3232d1){if(_0x3232d1&&_0x3232d1[_0xa283('0x58')]===0x0){return db[_0xa283('0x32')][_0xa283('0x4f')]({'name':_0x288b69['name'],'resourceId':_0x288b69['id'],'type':_0x3232d1['name'],'sectionId':_0x3232d1['id']},{})[_0xa283('0x25')](function(){return _0x4eda32;});}else{return _0x4eda32;}})[_0xa283('0x4a')](function(_0xfc3141){logger[_0xa283('0x34')](_0xa283('0x59'),_0xfc3141);throw _0xfc3141;});}return _0x4eda32;})[_0xa283('0x25')](respondWithResult(_0xa25bfe,0xc9))[_0xa283('0x4a')](handleError(_0xa25bfe,null));};exports[_0xa283('0x24')]=function(_0x5965a2,_0x211140){if(_0x5965a2['body']['id']){delete _0x5965a2[_0xa283('0x50')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x5965a2[_0xa283('0x4c')]['id']}})[_0xa283('0x25')](handleEntityNotFound(_0x211140,null))['then'](function(_0x3a16f1){if(_0x3a16f1){return db[_0xa283('0x46')][_0xa283('0x24')](_[_0xa283('0x5a')](_0x5965a2[_0xa283('0x50')],[_0xa283('0x52'),_0xa283('0x5b'),_0xa283('0x5c'),_0xa283('0x5d'),_0xa283('0x5e'),_0xa283('0x5f')]),{'where':{'context':_0x3a16f1[_0xa283('0x5b')],'exten':_0x3a16f1['exten']},'individualHooks':!![]})[_0xa283('0x25')](function(_0x449b68){return _0x449b68;});}return null;})['then'](respondWithStatusCode(_0x211140,null))[_0xa283('0x4a')](handleError(_0x211140,null));};exports[_0xa283('0x60')]=function(_0x4cd126,_0xf490a4,_0x32f912){return db[_0xa283('0x46')]['findOne']({'where':{'id':_0x4cd126[_0xa283('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf490a4,null))['then'](function(_0xb8c1f6){if(_0xb8c1f6){return db[_0xa283('0x61')]['transaction'](function(_0x536c9d){return db[_0xa283('0x46')][_0xa283('0x26')]({'where':{'VoiceExtensionId':_0x4cd126[_0xa283('0x4c')]['id']},'transaction':_0x536c9d})['then'](function(_0x31d079){var _0x13e8da=_['map'](_0x4cd126[_0xa283('0x50')],function(_0x1eb625){_0x1eb625[_0xa283('0x62')]=_0x4cd126[_0xa283('0x4c')]['id'];return _0x1eb625;});return db[_0xa283('0x46')]['bulkCreate'](_0x13e8da,{'transaction':_0x536c9d});});})[_0xa283('0x25')](function(){return db[_0xa283('0x46')][_0xa283('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4cd126[_0xa283('0x4c')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xa283('0x25')](respondWithResult(_0xf490a4,null))['catch'](handleError(_0xf490a4,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7624d5f..236d72d 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 _0x261b=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','remove'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x261b,0x93));var _0xb261=function(_0x25e1b1,_0x3e3d6f){_0x25e1b1=_0x25e1b1-0x0;var _0x17fb64=_0x261b[_0x25e1b1];return _0x17fb64;};'use strict';var EventEmitter=require(_0xb261('0x0'));var VoiceExtension=require(_0xb261('0x1'))['db'][_0xb261('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb261('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb261('0x4')};function emitEvent(_0x2a41d7){return function(_0x40a342,_0x3e882e,_0x34fdf9){VoiceExtensionEvents[_0xb261('0x5')](_0x2a41d7+':'+_0x40a342['id'],_0x40a342);VoiceExtensionEvents[_0xb261('0x5')](_0x2a41d7,_0x40a342);_0x34fdf9(null);};}for(var e in events){if(events[_0xb261('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xb261('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x36ee=['VoiceExtension','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xe36e('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe36e('0x1'),'afterUpdate':_0xe36e('0x2'),'afterDestroy':_0xe36e('0x3')};function emitEvent(_0xe3bee0){return function(_0x567a84,_0x1118af,_0x29e692){VoiceExtensionEvents[_0xe36e('0x4')](_0xe3bee0+':'+_0x567a84['id'],_0x567a84);VoiceExtensionEvents[_0xe36e('0x4')](_0xe3bee0,_0x567a84);_0x29e692(null);};}for(var e in events){if(events[_0xe36e('0x5')](e)){var event=events[e];VoiceExtension[_0xe36e('0x6')](e,emitEvent(event));}}module[_0xe36e('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 0803702..a3eee5e 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 _0xb5c0=['VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x39f658,_0x464923){var _0x287392=function(_0x222f3c){while(--_0x222f3c){_0x39f658['push'](_0x39f658['shift']());}};_0x287392(++_0x464923);}(_0xb5c0,0x1b2));var _0x0b5c=function(_0x2fc728,_0x47d2d9){_0x2fc728=_0x2fc728-0x0;var _0x1e0132=_0xb5c0[_0x2fc728];return _0x1e0132;};'use strict';var _=require(_0x0b5c('0x0'));var util=require(_0x0b5c('0x1'));var logger=require(_0x0b5c('0x2'))(_0x0b5c('0x3'));var moment=require(_0x0b5c('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b5c('0x5'));var fs=require('fs');var path=require(_0x0b5c('0x6'));var rimraf=require(_0x0b5c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module[_0x0b5c('0x8')]=function(_0x59e920,_0x46d2a1){return _0x59e920[_0x0b5c('0x9')](_0x0b5c('0xa'),attributes,{'tableName':_0x0b5c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd856=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define'];(function(_0x315203,_0x440f52){var _0x28d70c=function(_0x12d61e){while(--_0x12d61e){_0x315203['push'](_0x315203['shift']());}};_0x28d70c(++_0x440f52);}(_0xd856,0xfc));var _0x6d85=function(_0x548fc3,_0xab9be9){_0x548fc3=_0x548fc3-0x0;var _0x3a2650=_0xd856[_0x548fc3];return _0x3a2650;};'use strict';var _=require(_0x6d85('0x0'));var util=require(_0x6d85('0x1'));var logger=require(_0x6d85('0x2'))(_0x6d85('0x3'));var moment=require(_0x6d85('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d85('0x5'));var fs=require('fs');var path=require(_0x6d85('0x6'));var rimraf=require(_0x6d85('0x7'));var config=require(_0x6d85('0x8'));var attributes=require(_0x6d85('0x9'));module[_0x6d85('0xa')]=function(_0x24c175,_0x2a0a61){return _0x24c175[_0x6d85('0xb')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ef7268a..1ed54f4 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 _0x13c1=['request','then','info','debug','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter'];(function(_0x2bcb9f,_0x275ce9){var _0x3e6211=function(_0x2fd62b){while(--_0x2fd62b){_0x2bcb9f['push'](_0x2bcb9f['shift']());}};_0x3e6211(++_0x275ce9);}(_0x13c1,0x82));var _0x113c=function(_0x357dad,_0x5b95d0){_0x357dad=_0x357dad-0x0;var _0x4bc43e=_0x13c1[_0x357dad];return _0x4bc43e;};'use strict';var _=require(_0x113c('0x0'));var util=require(_0x113c('0x1'));var moment=require(_0x113c('0x2'));var BPromise=require(_0x113c('0x3'));var rs=require(_0x113c('0x4'));var fs=require('fs');var Redis=require(_0x113c('0x5'));var db=require(_0x113c('0x6'))['db'];var utils=require(_0x113c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x113c('0x8'));var jayson=require(_0x113c('0x9'));var client=jayson[_0x113c('0xa')][_0x113c('0xb')]({'port':0x232a});config[_0x113c('0xc')]=_['defaults'](config[_0x113c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x113c('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x24f4e6,_0x45973e,_0x1a1fa3){return new BPromise(function(_0x473fcf,_0x3a9798){return client[_0x113c('0xe')](_0x24f4e6,_0x1a1fa3)[_0x113c('0xf')](function(_0x3686d7){logger[_0x113c('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x45973e,'request\x20sent');logger[_0x113c('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x45973e,_0x113c('0x12'),JSON['stringify'](_0x3686d7));if(_0x3686d7[_0x113c('0x13')]){if(_0x3686d7['error'][_0x113c('0x14')]===0x1f4){logger['error'](_0x113c('0x15'),_0x45973e,_0x3686d7[_0x113c('0x13')][_0x113c('0x16')]);return _0x3a9798(_0x3686d7[_0x113c('0x13')][_0x113c('0x16')]);}logger[_0x113c('0x13')](_0x113c('0x15'),_0x45973e,_0x3686d7[_0x113c('0x13')]['message']);return _0x473fcf(_0x3686d7[_0x113c('0x13')][_0x113c('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x45973e,'request\x20sent');_0x473fcf(_0x3686d7[_0x113c('0x17')][_0x113c('0x16')]);}})[_0x113c('0x18')](function(_0x462cd9){logger[_0x113c('0x13')](_0x113c('0x15'),_0x45973e,_0x462cd9);_0x3a9798(_0x462cd9);});});}exports[_0x113c('0x19')]=function(_0x266edd){var _0x3dac11=this;return new Promise(function(_0x140e18,_0xa2ff8c){return db[_0x113c('0x1a')][_0x113c('0x1b')]({'raw':_0x266edd['options']?_0x266edd[_0x113c('0x1c')][_0x113c('0x1d')]===undefined?!![]:![]:!![],'where':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')][_0x113c('0x1e')]||null:null,'attributes':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')][_0x113c('0x1f')]||null:null,'limit':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')][_0x113c('0x20')]||null:null,'include':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')]['include']?_['map'](_0x266edd[_0x113c('0x1c')][_0x113c('0x21')],function(_0x18b93d){return{'model':db[_0x18b93d[_0x113c('0x22')]],'as':_0x18b93d['as'],'attributes':_0x18b93d[_0x113c('0x1f')],'include':_0x18b93d[_0x113c('0x21')]?_[_0x113c('0x23')](_0x18b93d[_0x113c('0x21')],function(_0x5458cc){return{'model':db[_0x5458cc[_0x113c('0x22')]],'as':_0x5458cc['as'],'attributes':_0x5458cc['attributes'],'include':_0x5458cc['include']?_['map'](_0x5458cc['include'],function(_0x4d44d3){return{'model':db[_0x4d44d3[_0x113c('0x22')]],'as':_0x4d44d3['as'],'attributes':_0x4d44d3[_0x113c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x113c('0xf')](function(_0x3aba4d){logger[_0x113c('0x10')](_0x113c('0x19'),_0x266edd);logger[_0x113c('0x11')](_0x113c('0x19'),_0x266edd,JSON['stringify'](_0x3aba4d));_0x140e18(_0x3aba4d);})[_0x113c('0x18')](function(_0x1e9428){logger['error'](_0x113c('0x19'),_0x1e9428[_0x113c('0x16')],_0x266edd);_0xa2ff8c(_0x3dac11[_0x113c('0x13')](0x1f4,_0x1e9428[_0x113c('0x16')]));});});}; \ No newline at end of file +var _0x78fc=['redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','map','model','include','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http'];(function(_0x7040e3,_0x56f4e5){var _0x35e343=function(_0x17f787){while(--_0x17f787){_0x7040e3['push'](_0x7040e3['shift']());}};_0x35e343(++_0x56f4e5);}(_0x78fc,0xd0));var _0xc78f=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x78fc[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0xc78f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc78f('0x1'));var rs=require(_0xc78f('0x2'));var fs=require('fs');var Redis=require(_0xc78f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc78f('0x4'));var logger=require(_0xc78f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc78f('0x6')][_0xc78f('0x7')]({'port':0x232a});config[_0xc78f('0x8')]=_[_0xc78f('0x9')](config['redis'],{'host':_0xc78f('0xa'),'port':0x18eb});var socket=require(_0xc78f('0xb'))(new Redis(config[_0xc78f('0x8')]));require(_0xc78f('0xc'))[_0xc78f('0xd')](socket);function respondWithRpcPromise(_0x23a9d1,_0x311222,_0x20245b){return new BPromise(function(_0xb847a3,_0x43b5de){return client[_0xc78f('0xe')](_0x23a9d1,_0x20245b)[_0xc78f('0xf')](function(_0x137aad){logger[_0xc78f('0x10')](_0xc78f('0x11'),_0x311222,'request\x20sent');logger[_0xc78f('0x12')](_0xc78f('0x13'),_0x311222,_0xc78f('0x14'),JSON[_0xc78f('0x15')](_0x137aad));if(_0x137aad[_0xc78f('0x16')]){if(_0x137aad[_0xc78f('0x16')][_0xc78f('0x17')]===0x1f4){logger['error'](_0xc78f('0x11'),_0x311222,_0x137aad['error'][_0xc78f('0x18')]);return _0x43b5de(_0x137aad[_0xc78f('0x16')][_0xc78f('0x18')]);}logger[_0xc78f('0x16')](_0xc78f('0x11'),_0x311222,_0x137aad[_0xc78f('0x16')][_0xc78f('0x18')]);return _0xb847a3(_0x137aad['error']['message']);}else{logger[_0xc78f('0x10')](_0xc78f('0x11'),_0x311222,_0xc78f('0x14'));_0xb847a3(_0x137aad[_0xc78f('0x19')][_0xc78f('0x18')]);}})['catch'](function(_0x3a52a4){logger['error'](_0xc78f('0x11'),_0x311222,_0x3a52a4);_0x43b5de(_0x3a52a4);});});}exports[_0xc78f('0x1a')]=function(_0x224f01){var _0x794f8e=this;return new Promise(function(_0x835a10,_0xc87646){return db[_0xc78f('0x1b')][_0xc78f('0x1c')]({'raw':_0x224f01[_0xc78f('0x1d')]?_0x224f01[_0xc78f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x224f01[_0xc78f('0x1d')]?_0x224f01[_0xc78f('0x1d')][_0xc78f('0x1e')]||null:null,'attributes':_0x224f01[_0xc78f('0x1d')]?_0x224f01[_0xc78f('0x1d')][_0xc78f('0x1f')]||null:null,'limit':_0x224f01['options']?_0x224f01[_0xc78f('0x1d')][_0xc78f('0x20')]||null:null,'include':_0x224f01[_0xc78f('0x1d')]?_0x224f01['options']['include']?_[_0xc78f('0x21')](_0x224f01['options']['include'],function(_0xd5a38c){return{'model':db[_0xd5a38c[_0xc78f('0x22')]],'as':_0xd5a38c['as'],'attributes':_0xd5a38c[_0xc78f('0x1f')],'include':_0xd5a38c[_0xc78f('0x23')]?_[_0xc78f('0x21')](_0xd5a38c['include'],function(_0x59a420){return{'model':db[_0x59a420[_0xc78f('0x22')]],'as':_0x59a420['as'],'attributes':_0x59a420[_0xc78f('0x1f')],'include':_0x59a420[_0xc78f('0x23')]?_[_0xc78f('0x21')](_0x59a420['include'],function(_0x19b181){return{'model':db[_0x19b181[_0xc78f('0x22')]],'as':_0x19b181['as'],'attributes':_0x19b181[_0xc78f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc78f('0xf')](function(_0x2662d0){logger[_0xc78f('0x10')](_0xc78f('0x1a'),_0x224f01);logger[_0xc78f('0x12')]('GetVoiceExtension',_0x224f01,JSON['stringify'](_0x2662d0));_0x835a10(_0x2662d0);})['catch'](function(_0x591aba){logger[_0xc78f('0x16')]('GetVoiceExtension',_0x591aba['message'],_0x224f01);_0xc87646(_0x794f8e[_0xc78f('0x16')](0x1f4,_0x591aba[_0xc78f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index de63cc3..b1553dc 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 _0x7df1=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7df1,0x1be));var _0x17df=function(_0x3a69a2,_0x40fd91){_0x3a69a2=_0x3a69a2-0x0;var _0x4ecee3=_0x7df1[_0x3a69a2];return _0x4ecee3;};'use strict';var VoiceExtensionEvents=require(_0x17df('0x0'));var events=[_0x17df('0x1'),'remove',_0x17df('0x2')];function createListener(_0x5ad3b0,_0x21fb69){return function(_0xe04492){_0x21fb69[_0x17df('0x3')](_0x5ad3b0,_0xe04492);};}function removeListener(_0x1e7113,_0x483375){return function(){VoiceExtensionEvents[_0x17df('0x4')](_0x1e7113,_0x483375);};}exports[_0x17df('0x5')]=function(_0x5a4a3a){for(var _0x2a52dd=0x0,_0x336a5f=events[_0x17df('0x6')];_0x2a52dd<_0x336a5f;_0x2a52dd++){var _0x3e2812=events[_0x2a52dd];var _0x1ee414=createListener(_0x17df('0x7')+_0x3e2812,_0x5a4a3a);VoiceExtensionEvents['on'](_0x3e2812,_0x1ee414);}}; \ No newline at end of file +var _0xf50b=['remove','update','register','length','./voiceExtension.events','save'];(function(_0x37039c,_0x3f4cf3){var _0x171602=function(_0x50ccdd){while(--_0x50ccdd){_0x37039c['push'](_0x37039c['shift']());}};_0x171602(++_0x3f4cf3);}(_0xf50b,0xd6));var _0xbf50=function(_0x5169c7,_0x325c9b){_0x5169c7=_0x5169c7-0x0;var _0x53a3cf=_0xf50b[_0x5169c7];return _0x53a3cf;};'use strict';var VoiceExtensionEvents=require(_0xbf50('0x0'));var events=[_0xbf50('0x1'),_0xbf50('0x2'),_0xbf50('0x3')];function createListener(_0x76a75d,_0x2056a3){return function(_0x145ae4){_0x2056a3['emit'](_0x76a75d,_0x145ae4);};}function removeListener(_0x25dca0,_0x5640b0){return function(){VoiceExtensionEvents['removeListener'](_0x25dca0,_0x5640b0);};}exports[_0xbf50('0x4')]=function(_0x445ee1){for(var _0x2a029a=0x0,_0x2a0cef=events[_0xbf50('0x5')];_0x2a029a<_0x2a0cef;_0x2a029a++){var _0x3233ef=events[_0x2a029a];var _0x401262=createListener('voiceExtension:'+_0x3233ef,_0x445ee1);VoiceExtensionEvents['on'](_0x3233ef,_0x401262);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3d93209..4c535ca 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 _0xd7cc=['index','show','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','../../config/environment','get','isAuthenticated'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0xd7cc,0x94));var _0xcd7c=function(_0x370814,_0x5cbe2f){_0x370814=_0x370814-0x0;var _0x2cb786=_0xd7cc[_0x370814];return _0x2cb786;};'use strict';var multer=require('multer');var util=require(_0xcd7c('0x0'));var path=require('path');var timeout=require(_0xcd7c('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd7c('0x2'));var controller=require('./voiceMail.controller');router[_0xcd7c('0x3')]('/',auth[_0xcd7c('0x4')](),controller[_0xcd7c('0x5')]);router[_0xcd7c('0x3')]('/:id',auth['isAuthenticated'](),controller[_0xcd7c('0x6')]);router[_0xcd7c('0x3')](_0xcd7c('0x7'),auth[_0xcd7c('0x4')](),controller[_0xcd7c('0x8')]);router[_0xcd7c('0x9')]('/',auth[_0xcd7c('0x4')](),controller[_0xcd7c('0xa')]);router[_0xcd7c('0xb')](_0xcd7c('0xc'),auth[_0xcd7c('0x4')](),controller[_0xcd7c('0xd')]);router[_0xcd7c('0xe')](_0xcd7c('0xc'),auth['isAuthenticated'](),controller[_0xcd7c('0xf')]);module[_0xcd7c('0x10')]=router; \ No newline at end of file +var _0x9e2f=['post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../config/environment','./voiceMail.controller','get','show','isAuthenticated','getMessages'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x9e2f,0x170));var _0xf9e2=function(_0x1cff33,_0x32fb7b){_0x1cff33=_0x1cff33-0x0;var _0xf0becd=_0x9e2f[_0x1cff33];return _0xf0becd;};'use strict';var multer=require(_0xf9e2('0x0'));var util=require('util');var path=require(_0xf9e2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf9e2('0x2'));var router=express[_0xf9e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf9e2('0x4'));var controller=require(_0xf9e2('0x5'));router[_0xf9e2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf9e2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xf9e2('0x7')]);router[_0xf9e2('0x6')]('/:id/messages',auth[_0xf9e2('0x8')](),controller[_0xf9e2('0x9')]);router[_0xf9e2('0xa')]('/',auth[_0xf9e2('0x8')](),controller[_0xf9e2('0xb')]);router[_0xf9e2('0xc')](_0xf9e2('0xd'),auth[_0xf9e2('0x8')](),controller[_0xf9e2('0xe')]);router[_0xf9e2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf9e2('0x10')]);module[_0xf9e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ba9326f..ecfa170 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 _0x757a=['email','string','trim','central','ENUM','yes','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','contest_mailbox'];(function(_0x5089f2,_0x3d903c){var _0x31dff2=function(_0x2136d2){while(--_0x2136d2){_0x5089f2['push'](_0x5089f2['shift']());}};_0x31dff2(++_0x3d903c);}(_0x757a,0xde));var _0xa757=function(_0x27fad2,_0x32afc3){_0x27fad2=_0x27fad2-0x0;var _0x13b574=_0x757a[_0x27fad2];return _0x13b574;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'customer_id':{'type':Sequelize[_0xa757('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa757('0x1')],'defaultValue':'','allowNull':![],'unique':_0xa757('0x2')},'password':{'type':Sequelize[_0xa757('0x1')]},'fullname':{'type':Sequelize[_0xa757('0x1')]},'email':{'type':Sequelize[_0xa757('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3caeb0){this['setDataValue'](_0xa757('0x3'),typeof _0x3caeb0===_0xa757('0x4')&&_0x3caeb0['trim']()?_0x3caeb0[_0xa757('0x5')]():null);}},'pager':{'type':Sequelize[_0xa757('0x1')]},'tz':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x6')},'attach':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':_0xa757('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':_0xa757('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa757('0x1')]},'callback':{'type':Sequelize[_0xa757('0x1')]},'review':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xa757('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':_0xa757('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xa757('0x9')},'emailsubject':{'type':Sequelize[_0xa757('0x1')]},'emailbody':{'type':Sequelize[_0xa757('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa757('0xa')],'get':function(){return this[_0xa757('0xb')](_0xa757('0xc'))+_0xa757('0xd')+this[_0xa757('0xb')](_0xa757('0xe'));}}}; \ No newline at end of file +var _0x878f=['contest_mailbox','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail'];(function(_0x2ed4ab,_0x263b99){var _0x488532=function(_0x42993f){while(--_0x42993f){_0x2ed4ab['push'](_0x2ed4ab['shift']());}};_0x488532(++_0x263b99);}(_0x878f,0x173));var _0xf878=function(_0x3de456,_0x359969){_0x3de456=_0x3de456-0x0;var _0x571f57=_0x878f[_0x3de456];return _0x571f57;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'customer_id':{'type':Sequelize[_0xf878('0x1')]},'context':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x2'),'unique':_0xf878('0x3')},'mailbox':{'type':Sequelize[_0xf878('0x1')],'defaultValue':'','allowNull':![],'unique':_0xf878('0x3')},'password':{'type':Sequelize[_0xf878('0x1')]},'fullname':{'type':Sequelize[_0xf878('0x1')]},'email':{'type':Sequelize[_0xf878('0x1')],'validate':{'isEmail':!![]},'set':function(_0x27ae4d){this['setDataValue']('email',typeof _0x27ae4d===_0xf878('0x4')&&_0x27ae4d[_0xf878('0x5')]()?_0x27ae4d['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xf878('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf878('0x1')]},'callback':{'type':Sequelize[_0xf878('0x1')]},'review':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf878('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'stamp':{'type':_0xf878('0xa')},'emailsubject':{'type':Sequelize[_0xf878('0x1')]},'emailbody':{'type':Sequelize[_0xf878('0x1')]},'maxsecs':{'type':Sequelize[_0xf878('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf878('0xc')],'get':function(){return this[_0xf878('0xd')](_0xf878('0xe'))+_0xf878('0xf')+this[_0xf878('0xd')](_0xf878('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e4a4c89..f19975c 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 _0xd4ad=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','UserProfileResource','stack','send','index','VoiceMail','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x2a76be,_0x267372){var _0x18436a=function(_0x510f97){while(--_0x510f97){_0x2a76be['push'](_0x2a76be['shift']());}};_0x18436a(++_0x267372);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x169779,_0x390356){_0x169779=_0x169779-0x0;var _0x34b153=_0xd4ad[_0x169779];return _0x34b153;};'use strict';var pdf=require(_0xdd4a('0x0'));var emlformat=require(_0xdd4a('0x1'));var rimraf=require(_0xdd4a('0x2'));var zipdir=require(_0xdd4a('0x3'));var jsonpatch=require(_0xdd4a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd4a('0x5'));var Mustache=require(_0xdd4a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdd4a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdd4a('0x8'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0x9'));var deskjs=require(_0xdd4a('0xa'));var toCsv=require(_0xdd4a('0xb'));var querystring=require(_0xdd4a('0xc'));var Papa=require(_0xdd4a('0xd'));var Redis=require(_0xdd4a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdd4a('0xf'));var as=require(_0xdd4a('0x10'));var hardwareService=require(_0xdd4a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdd4a('0x12'));var config=require(_0xdd4a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x14'))['db'];function respondWithStatusCode(_0x51c6f4,_0x140867){_0x140867=_0x140867||0xcc;return function(_0x219616){if(_0x219616){return _0x51c6f4[_0xdd4a('0x15')](_0x140867);}return _0x51c6f4[_0xdd4a('0x16')](_0x140867)[_0xdd4a('0x17')]();};}function respondWithResult(_0x3d3656,_0x25e88a){_0x25e88a=_0x25e88a||0xc8;return function(_0x5483cd){if(_0x5483cd){return _0x3d3656[_0xdd4a('0x16')](_0x25e88a)[_0xdd4a('0x18')](_0x5483cd);}};}function respondWithFilteredResult(_0x1614b3,_0x1859f4){return function(_0x229a65){if(_0x229a65){var _0xe59be3=_0x229a65[_0xdd4a('0x19')],_0x5d72a1=_0x1859f4[_0xdd4a('0x1a')],_0x31551d=_0x1859f4[_0xdd4a('0x1a')]+_0x1859f4[_0xdd4a('0x1b')],_0x42bc93;if(_0x31551d>=_0xe59be3){_0x31551d=_0xe59be3;_0x42bc93=0xc8;}else{_0x42bc93=0xce;}_0x1614b3[_0xdd4a('0x16')](_0x42bc93);return _0x1614b3[_0xdd4a('0x1c')](_0xdd4a('0x1d'),_0x5d72a1+'-'+_0x31551d+'/'+_0xe59be3)[_0xdd4a('0x18')](_0x229a65);}return null;};}function patchUpdates(_0x49c234){return function(_0x31a80a){try{jsonpatch['apply'](_0x31a80a,_0x49c234,!![]);}catch(_0x52a229){return BPromise[_0xdd4a('0x1e')](_0x52a229);}return _0x31a80a['save']();};}function saveUpdates(_0x384539,_0x534e91){return function(_0x51fc8c){if(_0x51fc8c){return _0x51fc8c[_0xdd4a('0x1f')](_0x384539)[_0xdd4a('0x20')](function(_0x26b15b){return _0x26b15b;});}return null;};}function removeEntity(_0x21b4fc,_0x55b94f){return function(_0x4e67a5){if(_0x4e67a5){return _0x4e67a5[_0xdd4a('0x21')]()[_0xdd4a('0x20')](function(){var _0x547721=_0x4e67a5['get']({'plain':!![]});var _0x3d2b3a='Voicemails';return db[_0xdd4a('0x22')][_0xdd4a('0x21')]({'where':{'type':_0x3d2b3a,'resourceId':_0x547721['id']}})[_0xdd4a('0x20')](function(){return _0x4e67a5;});})[_0xdd4a('0x20')](function(){_0x21b4fc[_0xdd4a('0x16')](0xcc)[_0xdd4a('0x17')]();});}};}function handleEntityNotFound(_0x2173a9,_0x29304a){return function(_0x49a49f){if(!_0x49a49f){_0x2173a9[_0xdd4a('0x15')](0x194);}return _0x49a49f;};}function handleError(_0x313454,_0x2074a0){_0x2074a0=_0x2074a0||0x1f4;return function(_0x5d8da0){logger['error'](_0x5d8da0[_0xdd4a('0x23')]);if(_0x5d8da0['name']){delete _0x5d8da0['name'];}_0x313454['status'](_0x2074a0)[_0xdd4a('0x24')](_0x5d8da0);};}exports[_0xdd4a('0x25')]=function(_0x154d3c,_0x3a5033){var _0xaf03e2={},_0x10cb68={},_0x1fb4d1={'count':0x0,'rows':[]};var _0x117ba7=_['map'](db[_0xdd4a('0x26')][_0xdd4a('0x27')],function(_0x19619b){return{'name':_0x19619b[_0xdd4a('0x28')],'type':_0x19619b['type'][_0xdd4a('0x29')]};});_0x10cb68[_0xdd4a('0x2a')]=_[_0xdd4a('0x2b')](_0x117ba7,_0xdd4a('0x2c'));_0x10cb68[_0xdd4a('0x2d')]=_['keys'](_0x154d3c[_0xdd4a('0x2d')]);_0x10cb68[_0xdd4a('0x2e')]=_[_0xdd4a('0x2f')](_0x10cb68[_0xdd4a('0x2a')],_0x10cb68['query']);_0xaf03e2['attributes']=_['intersection'](_0x10cb68[_0xdd4a('0x2a')],qs[_0xdd4a('0x30')](_0x154d3c['query']['fields']));_0xaf03e2[_0xdd4a('0x31')]=_0xaf03e2[_0xdd4a('0x31')][_0xdd4a('0x32')]?_0xaf03e2['attributes']:_0x10cb68['model'];if(!_0x154d3c[_0xdd4a('0x2d')]['hasOwnProperty'](_0xdd4a('0x33'))){_0xaf03e2[_0xdd4a('0x1b')]=qs['limit'](_0x154d3c[_0xdd4a('0x2d')]['limit']);_0xaf03e2['offset']=qs['offset'](_0x154d3c[_0xdd4a('0x2d')][_0xdd4a('0x1a')]);}_0xaf03e2[_0xdd4a('0x34')]=qs[_0xdd4a('0x35')](_0x154d3c[_0xdd4a('0x2d')][_0xdd4a('0x35')]);_0xaf03e2[_0xdd4a('0x36')]=qs[_0xdd4a('0x2e')](_['pick'](_0x154d3c[_0xdd4a('0x2d')],_0x10cb68['filters']),_0x117ba7);if(_0x154d3c['query'][_0xdd4a('0x37')]){_0xaf03e2[_0xdd4a('0x36')]=_[_0xdd4a('0x38')](_0xaf03e2[_0xdd4a('0x36')],{'$or':_['map'](_0x117ba7,function(_0xeff918){if(_0xeff918[_0xdd4a('0x39')]!=='VIRTUAL'){var _0x333929={};_0x333929[_0xeff918[_0xdd4a('0x2c')]]={'$like':'%'+_0x154d3c['query'][_0xdd4a('0x37')]+'%'};return _0x333929;}})});}_0xaf03e2=_['merge']({},_0xaf03e2,_0x154d3c[_0xdd4a('0x3a')]);var _0x5cb89e={'where':_0xaf03e2['where']};return db[_0xdd4a('0x26')][_0xdd4a('0x19')](_0x5cb89e)[_0xdd4a('0x20')](function(_0x5d18fc){_0x1fb4d1[_0xdd4a('0x19')]=_0x5d18fc;if(_0x154d3c[_0xdd4a('0x2d')][_0xdd4a('0x3b')]){_0xaf03e2[_0xdd4a('0x3c')]=[{'all':!![]}];}return db[_0xdd4a('0x26')][_0xdd4a('0x3d')](_0xaf03e2);})[_0xdd4a('0x20')](function(_0xdfa6d7){_0x1fb4d1[_0xdd4a('0x3e')]=_0xdfa6d7;return _0x1fb4d1;})[_0xdd4a('0x20')](respondWithFilteredResult(_0x3a5033,_0xaf03e2))[_0xdd4a('0x3f')](handleError(_0x3a5033,null));};exports[_0xdd4a('0x40')]=function(_0x513451,_0x59441c){var _0x53fa21={'raw':!![],'where':{'id':_0x513451[_0xdd4a('0x41')]['id']}},_0x4e1c3f={};_0x4e1c3f[_0xdd4a('0x2a')]=_[_0xdd4a('0x42')](db['VoiceMail'][_0xdd4a('0x27')]);_0x4e1c3f[_0xdd4a('0x2d')]=_['keys'](_0x513451['query']);_0x4e1c3f[_0xdd4a('0x2e')]=_['intersection'](_0x4e1c3f['model'],_0x4e1c3f[_0xdd4a('0x2d')]);_0x53fa21['attributes']=_[_0xdd4a('0x2f')](_0x4e1c3f['model'],qs[_0xdd4a('0x30')](_0x513451['query'][_0xdd4a('0x30')]));_0x53fa21[_0xdd4a('0x31')]=_0x53fa21[_0xdd4a('0x31')]['length']?_0x53fa21[_0xdd4a('0x31')]:_0x4e1c3f[_0xdd4a('0x2a')];if(_0x513451['query'][_0xdd4a('0x3b')]){_0x53fa21['include']=[{'all':!![]}];}_0x53fa21=_[_0xdd4a('0x38')]({},_0x53fa21,_0x513451[_0xdd4a('0x3a')]);return db['VoiceMail'][_0xdd4a('0x43')](_0x53fa21)[_0xdd4a('0x20')](handleEntityNotFound(_0x59441c,null))[_0xdd4a('0x20')](respondWithResult(_0x59441c,null))[_0xdd4a('0x3f')](handleError(_0x59441c,null));};exports[_0xdd4a('0x44')]=function(_0x5f633a,_0x5f2d8d){return db['VoiceMail'][_0xdd4a('0x44')](_0x5f633a[_0xdd4a('0x45')],{})[_0xdd4a('0x20')](function(_0x3deac1){var _0x4efe80=_0x5f633a['user'][_0xdd4a('0x46')]({'plain':!![]});if(!_0x4efe80)throw new Error(_0xdd4a('0x47'));if(_0x4efe80[_0xdd4a('0x48')]==='user'){var _0x25bda5=_0x3deac1[_0xdd4a('0x46')]({'plain':!![]});var _0x2c2f7a=_0xdd4a('0x49');return db[_0xdd4a('0x4a')][_0xdd4a('0x43')]({'where':{'name':_0x2c2f7a,'userProfileId':_0x4efe80[_0xdd4a('0x4b')]},'raw':!![]})['then'](function(_0x4e822e){if(_0x4e822e&&_0x4e822e[_0xdd4a('0x4c')]===0x0){return db['UserProfileResource'][_0xdd4a('0x44')]({'name':_0x25bda5[_0xdd4a('0x2c')],'resourceId':_0x25bda5['id'],'type':_0x4e822e[_0xdd4a('0x2c')],'sectionId':_0x4e822e['id']},{})[_0xdd4a('0x20')](function(){return _0x3deac1;});}else{return _0x3deac1;}})[_0xdd4a('0x3f')](function(_0x51dc71){logger[_0xdd4a('0x4d')](_0xdd4a('0x4e'),_0x51dc71);throw _0x51dc71;});}return _0x3deac1;})[_0xdd4a('0x20')](respondWithResult(_0x5f2d8d,0xc9))['catch'](handleError(_0x5f2d8d,null));};exports['update']=function(_0x3db887,_0x3109d3){if(_0x3db887[_0xdd4a('0x45')]['id']){delete _0x3db887[_0xdd4a('0x45')]['id'];}return db[_0xdd4a('0x26')]['find']({'where':{'id':_0x3db887[_0xdd4a('0x41')]['id']}})[_0xdd4a('0x20')](handleEntityNotFound(_0x3109d3,null))[_0xdd4a('0x20')](saveUpdates(_0x3db887[_0xdd4a('0x45')],null))[_0xdd4a('0x20')](respondWithResult(_0x3109d3,null))[_0xdd4a('0x3f')](handleError(_0x3109d3,null));};exports[_0xdd4a('0x21')]=function(_0x278b11,_0x19baf3){return db[_0xdd4a('0x26')][_0xdd4a('0x43')]({'where':{'id':_0x278b11[_0xdd4a('0x41')]['id']}})[_0xdd4a('0x20')](handleEntityNotFound(_0x19baf3,null))[_0xdd4a('0x20')](removeEntity(_0x19baf3,null))[_0xdd4a('0x3f')](handleError(_0x19baf3,null));};exports[_0xdd4a('0x4f')]=function(_0x55fa76,_0x5151a8,_0x52e3f3){return db[_0xdd4a('0x26')][_0xdd4a('0x50')]({'where':{'id':_0x55fa76[_0xdd4a('0x41')]['id']}})[_0xdd4a('0x20')](handleEntityNotFound(_0x5151a8,null))[_0xdd4a('0x20')](function(_0x3088cd){var _0x4fc6bb;var _0x11b59b={},_0x36da4a={};_0x36da4a['model']=_[_0xdd4a('0x42')](db['VoiceMailMessage']['rawAttributes']);_0x36da4a[_0xdd4a('0x2d')]=_[_0xdd4a('0x42')](_0x55fa76['query']);_0x36da4a[_0xdd4a('0x2e')]=_['intersection'](_0x36da4a[_0xdd4a('0x2a')],_0x36da4a['query']);_0x11b59b[_0xdd4a('0x31')]=_[_0xdd4a('0x2f')](_0x36da4a[_0xdd4a('0x2a')],qs['fields'](_0x55fa76[_0xdd4a('0x2d')][_0xdd4a('0x30')]));_0x11b59b[_0xdd4a('0x31')]=_0x11b59b[_0xdd4a('0x31')][_0xdd4a('0x32')]?_0x11b59b[_0xdd4a('0x31')]:_0x36da4a[_0xdd4a('0x2a')];if(!_0x55fa76['query']['hasOwnProperty']('nolimit')){_0x11b59b['limit']=qs[_0xdd4a('0x1b')](_0x55fa76['query'][_0xdd4a('0x1b')]);_0x11b59b[_0xdd4a('0x1a')]=qs[_0xdd4a('0x1a')](_0x55fa76['query']['offset']);}_0x11b59b[_0xdd4a('0x34')]=qs[_0xdd4a('0x35')](_0x55fa76[_0xdd4a('0x2d')]['sort']);_0x11b59b[_0xdd4a('0x36')]=qs[_0xdd4a('0x2e')](_[_0xdd4a('0x51')](_0x55fa76[_0xdd4a('0x2d')],_0x36da4a[_0xdd4a('0x2e')]));if(_0x55fa76[_0xdd4a('0x2d')][_0xdd4a('0x37')]){_0x11b59b[_0xdd4a('0x36')]=_[_0xdd4a('0x38')](_0x11b59b[_0xdd4a('0x36')],{'$or':_['map'](_0x11b59b['attributes'],function(_0x121879){var _0x2858ed={};_0x2858ed[_0x121879]={'$like':'%'+_0x55fa76['query'][_0xdd4a('0x37')]+'%'};return _0x2858ed;})});}_0x11b59b[_0xdd4a('0x36')]=_['merge'](_0x11b59b['where'],{'mailboxuser':_0x3088cd['mailbox']});_0x11b59b=_[_0xdd4a('0x38')]({},_0x11b59b,_0x55fa76[_0xdd4a('0x3a')]);return db[_0xdd4a('0x52')][_0xdd4a('0x53')](_0x11b59b)['then'](respondWithFilteredResult(_0x5151a8,_0x11b59b));})[_0xdd4a('0x3f')](handleError(_0x5151a8,null));}; \ No newline at end of file +var _0xf4ce=['moment','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Voicemails','sendStatus','error','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','options','find','create','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','order','findAndCountAll','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x3fb48c,_0x22045a){var _0x4e05f8=function(_0x7559ae){while(--_0x7559ae){_0x3fb48c['push'](_0x3fb48c['shift']());}};_0x4e05f8(++_0x22045a);}(_0xf4ce,0xf2));var _0xef4c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4ce[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xef4c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef4c('0x1'));var jsonpatch=require(_0xef4c('0x2'));var rp=require(_0xef4c('0x3'));var moment=require(_0xef4c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xef4c('0x5'));var ejs=require(_0xef4c('0x6'));var fs=require('fs');var _=require(_0xef4c('0x7'));var squel=require(_0xef4c('0x8'));var crypto=require(_0xef4c('0x9'));var jsforce=require(_0xef4c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xef4c('0x5'));var querystring=require(_0xef4c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xef4c('0xc'));var as=require(_0xef4c('0xd'));var hardwareService=require(_0xef4c('0xe'));var logger=require(_0xef4c('0xf'))('api');var utils=require(_0xef4c('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xef4c('0x11'))['db'];function respondWithStatusCode(_0x3bda49,_0x2bfe28){_0x2bfe28=_0x2bfe28||0xcc;return function(_0x6a1290){if(_0x6a1290){return _0x3bda49['sendStatus'](_0x2bfe28);}return _0x3bda49[_0xef4c('0x12')](_0x2bfe28)[_0xef4c('0x13')]();};}function respondWithResult(_0x12d7a6,_0x417f67){_0x417f67=_0x417f67||0xc8;return function(_0x2a2631){if(_0x2a2631){return _0x12d7a6[_0xef4c('0x12')](_0x417f67)[_0xef4c('0x14')](_0x2a2631);}};}function respondWithFilteredResult(_0x1c7633,_0x5dc6a3){return function(_0x55a7aa){if(_0x55a7aa){var _0x3637ce=_0x55a7aa[_0xef4c('0x15')],_0x40a344=_0x5dc6a3[_0xef4c('0x16')],_0x4141a0=_0x5dc6a3[_0xef4c('0x16')]+_0x5dc6a3[_0xef4c('0x17')],_0x18a238;if(_0x4141a0>=_0x3637ce){_0x4141a0=_0x3637ce;_0x18a238=0xc8;}else{_0x18a238=0xce;}_0x1c7633[_0xef4c('0x12')](_0x18a238);return _0x1c7633[_0xef4c('0x18')](_0xef4c('0x19'),_0x40a344+'-'+_0x4141a0+'/'+_0x3637ce)[_0xef4c('0x14')](_0x55a7aa);}return null;};}function patchUpdates(_0x2f309d){return function(_0x560486){try{jsonpatch[_0xef4c('0x1a')](_0x560486,_0x2f309d,!![]);}catch(_0x550011){return BPromise[_0xef4c('0x1b')](_0x550011);}return _0x560486[_0xef4c('0x1c')]();};}function saveUpdates(_0x46f556,_0xd4e0a){return function(_0x4d5888){if(_0x4d5888){return _0x4d5888[_0xef4c('0x1d')](_0x46f556)['then'](function(_0xd8c54e){return _0xd8c54e;});}return null;};}function removeEntity(_0x460860,_0x500bd3){return function(_0x251e29){if(_0x251e29){return _0x251e29[_0xef4c('0x1e')]()[_0xef4c('0x1f')](function(){var _0x4f4a3a=_0x251e29[_0xef4c('0x20')]({'plain':!![]});var _0x17c816=_0xef4c('0x21');return db['UserProfileResource'][_0xef4c('0x1e')]({'where':{'type':_0x17c816,'resourceId':_0x4f4a3a['id']}})[_0xef4c('0x1f')](function(){return _0x251e29;});})[_0xef4c('0x1f')](function(){_0x460860[_0xef4c('0x12')](0xcc)[_0xef4c('0x13')]();});}};}function handleEntityNotFound(_0x26f523,_0x4befda){return function(_0x7e3dd8){if(!_0x7e3dd8){_0x26f523[_0xef4c('0x22')](0x194);}return _0x7e3dd8;};}function handleError(_0x35f404,_0x20211f){_0x20211f=_0x20211f||0x1f4;return function(_0x53368d){logger[_0xef4c('0x23')](_0x53368d['stack']);if(_0x53368d[_0xef4c('0x24')]){delete _0x53368d['name'];}_0x35f404[_0xef4c('0x12')](_0x20211f)[_0xef4c('0x25')](_0x53368d);};}exports[_0xef4c('0x26')]=function(_0x13eb57,_0x8fe191){var _0xb10f30={},_0x539486={},_0x4d4c5d={'count':0x0,'rows':[]};var _0x5ae737=_['map'](db[_0xef4c('0x27')][_0xef4c('0x28')],function(_0x32ee4a){return{'name':_0x32ee4a[_0xef4c('0x29')],'type':_0x32ee4a[_0xef4c('0x2a')][_0xef4c('0x2b')]};});_0x539486[_0xef4c('0x2c')]=_[_0xef4c('0x2d')](_0x5ae737,_0xef4c('0x24'));_0x539486[_0xef4c('0x2e')]=_[_0xef4c('0x2f')](_0x13eb57[_0xef4c('0x2e')]);_0x539486['filters']=_['intersection'](_0x539486[_0xef4c('0x2c')],_0x539486[_0xef4c('0x2e')]);_0xb10f30['attributes']=_[_0xef4c('0x30')](_0x539486[_0xef4c('0x2c')],qs['fields'](_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x31')]));_0xb10f30[_0xef4c('0x32')]=_0xb10f30[_0xef4c('0x32')]['length']?_0xb10f30[_0xef4c('0x32')]:_0x539486[_0xef4c('0x2c')];if(!_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x33')](_0xef4c('0x34'))){_0xb10f30[_0xef4c('0x17')]=qs[_0xef4c('0x17')](_0x13eb57['query'][_0xef4c('0x17')]);_0xb10f30[_0xef4c('0x16')]=qs[_0xef4c('0x16')](_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x16')]);}_0xb10f30['order']=qs['sort'](_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x35')]);_0xb10f30[_0xef4c('0x36')]=qs[_0xef4c('0x37')](_[_0xef4c('0x38')](_0x13eb57[_0xef4c('0x2e')],_0x539486[_0xef4c('0x37')]),_0x5ae737);if(_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x39')]){_0xb10f30['where']=_['merge'](_0xb10f30[_0xef4c('0x36')],{'$or':_[_0xef4c('0x2d')](_0x5ae737,function(_0x226c85){if(_0x226c85[_0xef4c('0x2a')]!==_0xef4c('0x3a')){var _0x145498={};_0x145498[_0x226c85[_0xef4c('0x24')]]={'$like':'%'+_0x13eb57[_0xef4c('0x2e')][_0xef4c('0x39')]+'%'};return _0x145498;}})});}_0xb10f30=_[_0xef4c('0x3b')]({},_0xb10f30,_0x13eb57['options']);var _0x5605ec={'where':_0xb10f30['where']};return db[_0xef4c('0x27')]['count'](_0x5605ec)['then'](function(_0x5a85fe){_0x4d4c5d['count']=_0x5a85fe;if(_0x13eb57['query']['includeAll']){_0xb10f30[_0xef4c('0x3c')]=[{'all':!![]}];}return db[_0xef4c('0x27')][_0xef4c('0x3d')](_0xb10f30);})[_0xef4c('0x1f')](function(_0x1335a7){_0x4d4c5d[_0xef4c('0x3e')]=_0x1335a7;return _0x4d4c5d;})['then'](respondWithFilteredResult(_0x8fe191,_0xb10f30))[_0xef4c('0x3f')](handleError(_0x8fe191,null));};exports[_0xef4c('0x40')]=function(_0x1ec099,_0x1f7a13){var _0x57f3d0={'raw':!![],'where':{'id':_0x1ec099[_0xef4c('0x41')]['id']}},_0x5520b5={};_0x5520b5[_0xef4c('0x2c')]=_[_0xef4c('0x2f')](db[_0xef4c('0x27')][_0xef4c('0x28')]);_0x5520b5[_0xef4c('0x2e')]=_[_0xef4c('0x2f')](_0x1ec099[_0xef4c('0x2e')]);_0x5520b5['filters']=_['intersection'](_0x5520b5[_0xef4c('0x2c')],_0x5520b5['query']);_0x57f3d0[_0xef4c('0x32')]=_[_0xef4c('0x30')](_0x5520b5[_0xef4c('0x2c')],qs[_0xef4c('0x31')](_0x1ec099[_0xef4c('0x2e')][_0xef4c('0x31')]));_0x57f3d0[_0xef4c('0x32')]=_0x57f3d0[_0xef4c('0x32')][_0xef4c('0x42')]?_0x57f3d0[_0xef4c('0x32')]:_0x5520b5[_0xef4c('0x2c')];if(_0x1ec099[_0xef4c('0x2e')]['includeAll']){_0x57f3d0[_0xef4c('0x3c')]=[{'all':!![]}];}_0x57f3d0=_[_0xef4c('0x3b')]({},_0x57f3d0,_0x1ec099[_0xef4c('0x43')]);return db[_0xef4c('0x27')][_0xef4c('0x44')](_0x57f3d0)[_0xef4c('0x1f')](handleEntityNotFound(_0x1f7a13,null))['then'](respondWithResult(_0x1f7a13,null))[_0xef4c('0x3f')](handleError(_0x1f7a13,null));};exports[_0xef4c('0x45')]=function(_0x1d921f,_0x1619b6){return db['VoiceMail'][_0xef4c('0x45')](_0x1d921f['body'],{})[_0xef4c('0x1f')](function(_0x2eb3ad){var _0x5e89de=_0x1d921f[_0xef4c('0x46')][_0xef4c('0x20')]({'plain':!![]});if(!_0x5e89de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e89de[_0xef4c('0x47')]===_0xef4c('0x46')){var _0x42ec1d=_0x2eb3ad['get']({'plain':!![]});var _0x225a9e=_0xef4c('0x21');return db[_0xef4c('0x48')][_0xef4c('0x44')]({'where':{'name':_0x225a9e,'userProfileId':_0x5e89de[_0xef4c('0x49')]},'raw':!![]})[_0xef4c('0x1f')](function(_0x46d41a){if(_0x46d41a&&_0x46d41a['autoAssociation']===0x0){return db[_0xef4c('0x4a')][_0xef4c('0x45')]({'name':_0x42ec1d[_0xef4c('0x24')],'resourceId':_0x42ec1d['id'],'type':_0x46d41a[_0xef4c('0x24')],'sectionId':_0x46d41a['id']},{})[_0xef4c('0x1f')](function(){return _0x2eb3ad;});}else{return _0x2eb3ad;}})[_0xef4c('0x3f')](function(_0x4ac496){logger[_0xef4c('0x23')](_0xef4c('0x4b'),_0x4ac496);throw _0x4ac496;});}return _0x2eb3ad;})[_0xef4c('0x1f')](respondWithResult(_0x1619b6,0xc9))['catch'](handleError(_0x1619b6,null));};exports[_0xef4c('0x1d')]=function(_0x5724a0,_0x2c0c34){if(_0x5724a0[_0xef4c('0x4c')]['id']){delete _0x5724a0[_0xef4c('0x4c')]['id'];}return db['VoiceMail'][_0xef4c('0x44')]({'where':{'id':_0x5724a0[_0xef4c('0x41')]['id']}})[_0xef4c('0x1f')](handleEntityNotFound(_0x2c0c34,null))[_0xef4c('0x1f')](saveUpdates(_0x5724a0[_0xef4c('0x4c')],null))['then'](respondWithResult(_0x2c0c34,null))[_0xef4c('0x3f')](handleError(_0x2c0c34,null));};exports[_0xef4c('0x1e')]=function(_0x2f5f94,_0xb4abe6){return db[_0xef4c('0x27')][_0xef4c('0x44')]({'where':{'id':_0x2f5f94[_0xef4c('0x41')]['id']}})[_0xef4c('0x1f')](handleEntityNotFound(_0xb4abe6,null))[_0xef4c('0x1f')](removeEntity(_0xb4abe6,null))[_0xef4c('0x3f')](handleError(_0xb4abe6,null));};exports[_0xef4c('0x4d')]=function(_0x73943e,_0x351bf6,_0x3f6a36){return db[_0xef4c('0x27')][_0xef4c('0x4e')]({'where':{'id':_0x73943e[_0xef4c('0x41')]['id']}})[_0xef4c('0x1f')](handleEntityNotFound(_0x351bf6,null))[_0xef4c('0x1f')](function(_0x2af46d){var _0x2f4fb1;var _0xc494d={},_0x25d8e8={};_0x25d8e8['model']=_[_0xef4c('0x2f')](db[_0xef4c('0x4f')][_0xef4c('0x28')]);_0x25d8e8[_0xef4c('0x2e')]=_['keys'](_0x73943e[_0xef4c('0x2e')]);_0x25d8e8['filters']=_[_0xef4c('0x30')](_0x25d8e8[_0xef4c('0x2c')],_0x25d8e8[_0xef4c('0x2e')]);_0xc494d[_0xef4c('0x32')]=_[_0xef4c('0x30')](_0x25d8e8[_0xef4c('0x2c')],qs['fields'](_0x73943e[_0xef4c('0x2e')][_0xef4c('0x31')]));_0xc494d[_0xef4c('0x32')]=_0xc494d[_0xef4c('0x32')][_0xef4c('0x42')]?_0xc494d[_0xef4c('0x32')]:_0x25d8e8['model'];if(!_0x73943e[_0xef4c('0x2e')]['hasOwnProperty'](_0xef4c('0x34'))){_0xc494d[_0xef4c('0x17')]=qs['limit'](_0x73943e[_0xef4c('0x2e')][_0xef4c('0x17')]);_0xc494d['offset']=qs['offset'](_0x73943e['query']['offset']);}_0xc494d[_0xef4c('0x50')]=qs['sort'](_0x73943e[_0xef4c('0x2e')][_0xef4c('0x35')]);_0xc494d[_0xef4c('0x36')]=qs[_0xef4c('0x37')](_[_0xef4c('0x38')](_0x73943e['query'],_0x25d8e8[_0xef4c('0x37')]));if(_0x73943e['query']['filter']){_0xc494d[_0xef4c('0x36')]=_[_0xef4c('0x3b')](_0xc494d[_0xef4c('0x36')],{'$or':_[_0xef4c('0x2d')](_0xc494d['attributes'],function(_0x3455c0){var _0x1e5732={};_0x1e5732[_0x3455c0]={'$like':'%'+_0x73943e['query'][_0xef4c('0x39')]+'%'};return _0x1e5732;})});}_0xc494d['where']=_['merge'](_0xc494d[_0xef4c('0x36')],{'mailboxuser':_0x2af46d['mailbox']});_0xc494d=_[_0xef4c('0x3b')]({},_0xc494d,_0x73943e['options']);return db[_0xef4c('0x4f')][_0xef4c('0x51')](_0xc494d)[_0xef4c('0x1f')](respondWithFilteredResult(_0x351bf6,_0xc494d));})[_0xef4c('0x3f')](handleError(_0x351bf6,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0feb996..88760a9 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 _0x68f5=['util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceMail.attributes','exports','define','lodash'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x68f5,0x107));var _0x568f=function(_0x4e7a58,_0x5104d9){_0x4e7a58=_0x4e7a58-0x0;var _0x22e4b6=_0x68f5[_0x4e7a58];return _0x22e4b6;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))(_0x568f('0x3'));var moment=require(_0x568f('0x4'));var BPromise=require(_0x568f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x69ee4,_0x3e7488){return _0x69ee4[_0x568f('0xa')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4a9=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','api','moment'];(function(_0x4cb231,_0x3d3c5b){var _0x4d5063=function(_0x4af9d0){while(--_0x4af9d0){_0x4cb231['push'](_0x4cb231['shift']());}};_0x4d5063(++_0x3d3c5b);}(_0xf4a9,0x164));var _0x9f4a=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xf4a9[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0x9f4a('0x0'));var util=require(_0x9f4a('0x1'));var logger=require('../../config/logger')(_0x9f4a('0x2'));var moment=require(_0x9f4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f4a('0x4'));var fs=require('fs');var path=require(_0x9f4a('0x5'));var rimraf=require(_0x9f4a('0x6'));var config=require(_0x9f4a('0x7'));var attributes=require(_0x9f4a('0x8'));module[_0x9f4a('0x9')]=function(_0x2b3b2c,_0x12aec2){return _0x2b3b2c[_0x9f4a('0xa')](_0x9f4a('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9f4a('0xc'),'fields':[_0x9f4a('0xd'),_0x9f4a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d5e3437..8f81e1a 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 _0x08b9=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceMail,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent'];(function(_0x589e5e,_0x441fc4){var _0x2c73f1=function(_0x59a727){while(--_0x59a727){_0x589e5e['push'](_0x589e5e['shift']());}};_0x2c73f1(++_0x441fc4);}(_0x08b9,0xa3));var _0x908b=function(_0x52156d,_0x164227){_0x52156d=_0x52156d-0x0;var _0x354442=_0x08b9[_0x52156d];return _0x354442;};'use strict';var _=require(_0x908b('0x0'));var util=require(_0x908b('0x1'));var moment=require(_0x908b('0x2'));var BPromise=require(_0x908b('0x3'));var rs=require(_0x908b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x908b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x908b('0x6'))(_0x908b('0x7'));var config=require('../../config/environment');var jayson=require(_0x908b('0x8'));var client=jayson[_0x908b('0x9')][_0x908b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2923c8,_0x477c4d,_0x24eb1c){return new BPromise(function(_0x281c7d,_0x52692b){return client[_0x908b('0xb')](_0x2923c8,_0x24eb1c)['then'](function(_0x437312){logger['info']('VoiceMail,\x20%s,\x20%s',_0x477c4d,_0x908b('0xc'));logger[_0x908b('0xd')](_0x908b('0xe'),_0x477c4d,_0x908b('0xc'),JSON[_0x908b('0xf')](_0x437312));if(_0x437312[_0x908b('0x10')]){if(_0x437312[_0x908b('0x10')]['code']===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x477c4d,_0x437312['error'][_0x908b('0x11')]);return _0x52692b(_0x437312['error'][_0x908b('0x11')]);}logger[_0x908b('0x10')](_0x908b('0x12'),_0x477c4d,_0x437312[_0x908b('0x10')][_0x908b('0x11')]);return _0x281c7d(_0x437312[_0x908b('0x10')][_0x908b('0x11')]);}else{logger[_0x908b('0x13')](_0x908b('0x12'),_0x477c4d,_0x908b('0xc'));_0x281c7d(_0x437312[_0x908b('0x14')][_0x908b('0x11')]);}})[_0x908b('0x15')](function(_0x40f764){logger['error']('VoiceMail,\x20%s,\x20%s',_0x477c4d,_0x40f764);_0x52692b(_0x40f764);});});} \ No newline at end of file +var _0x2296=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a249e,_0x30c270){var _0x4168a4=function(_0x21a830){while(--_0x21a830){_0x4a249e['push'](_0x4a249e['shift']());}};_0x4168a4(++_0x30c270);}(_0x2296,0x1bc));var _0x6229=function(_0x566b53,_0x25de30){_0x566b53=_0x566b53-0x0;var _0x29c174=_0x2296[_0x566b53];return _0x29c174;};'use strict';var _=require(_0x6229('0x0'));var util=require(_0x6229('0x1'));var moment=require('moment');var BPromise=require(_0x6229('0x2'));var rs=require(_0x6229('0x3'));var fs=require('fs');var Redis=require(_0x6229('0x4'));var db=require(_0x6229('0x5'))['db'];var utils=require(_0x6229('0x6'));var logger=require(_0x6229('0x7'))(_0x6229('0x8'));var config=require(_0x6229('0x9'));var jayson=require(_0x6229('0xa'));var client=jayson[_0x6229('0xb')][_0x6229('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ecb88,_0x1224ec,_0x16dba8){return new BPromise(function(_0x181818,_0x57ee81){return client[_0x6229('0xd')](_0x1ecb88,_0x16dba8)[_0x6229('0xe')](function(_0x265569){logger[_0x6229('0xf')](_0x6229('0x10'),_0x1224ec,_0x6229('0x11'));logger[_0x6229('0x12')](_0x6229('0x13'),_0x1224ec,_0x6229('0x11'),JSON[_0x6229('0x14')](_0x265569));if(_0x265569['error']){if(_0x265569[_0x6229('0x15')]['code']===0x1f4){logger[_0x6229('0x15')]('VoiceMail,\x20%s,\x20%s',_0x1224ec,_0x265569[_0x6229('0x15')][_0x6229('0x16')]);return _0x57ee81(_0x265569['error'][_0x6229('0x16')]);}logger[_0x6229('0x15')](_0x6229('0x10'),_0x1224ec,_0x265569['error']['message']);return _0x181818(_0x265569[_0x6229('0x15')]['message']);}else{logger[_0x6229('0xf')]('VoiceMail,\x20%s,\x20%s',_0x1224ec,_0x6229('0x11'));_0x181818(_0x265569[_0x6229('0x17')][_0x6229('0x16')]);}})[_0x6229('0x18')](function(_0x4ae43c){logger[_0x6229('0x15')](_0x6229('0x10'),_0x1224ec,_0x4ae43c);_0x57ee81(_0x4ae43c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8254b99..6e9d2d9 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x814b,0x1a2));var _0xb814=function(_0x1081a3,_0x2ac784){_0x1081a3=_0x1081a3-0x0;var _0x5696a2=_0x814b[_0x1081a3];return _0x5696a2;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0xc6ac=['show','download','post','create','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x1f31f8,_0x50eadd){var _0x4c3697=function(_0x10b075){while(--_0x10b075){_0x1f31f8['push'](_0x1f31f8['shift']());}};_0x4c3697(++_0x50eadd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5ecc3b,_0x597ddd){_0x5ecc3b=_0x5ecc3b-0x0;var _0xa6571d=_0xc6ac[_0x5ecc3b];return _0xa6571d;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xa')]('/:id/download',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xe')]);router[_0xcc6a('0xf')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x10')]);router['put'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6e1e94d..b448427 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 _0x3e88=['BLOB','sequelize','exports','VIRTUAL','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x3e88,0x12d));var _0x83e8=function(_0x131592,_0x5e3bcf){_0x131592=_0x131592-0x0;var _0xce6cbc=_0x3e88[_0x131592];return _0xce6cbc;};'use strict';var Sequelize=require(_0x83e8('0x0'));module[_0x83e8('0x1')]={'name':{'type':Sequelize[_0x83e8('0x2')],'get':function(_0xf86a11){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x83e8('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x2cb8=['VIRTUAL','getDataValue','INTEGER','STRING','sequelize','exports'];(function(_0x4eab61,_0x1a6e6d){var _0x342426=function(_0xc6338a){while(--_0xc6338a){_0x4eab61['push'](_0x4eab61['shift']());}};_0x342426(++_0x1a6e6d);}(_0x2cb8,0xa0));var _0x82cb=function(_0x23dbb6,_0x47d37e){_0x23dbb6=_0x23dbb6-0x0;var _0x437650=_0x2cb8[_0x23dbb6];return _0x437650;};'use strict';var Sequelize=require(_0x82cb('0x0'));module[_0x82cb('0x1')]={'name':{'type':Sequelize[_0x82cb('0x2')],'get':function(_0xbb5b15){return this[_0x82cb('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x82cb('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x82cb('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4f5e332..d7a9fad 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 _0xda53=['download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body'];(function(_0x38ac39,_0x44d712){var _0x24097c=function(_0x2132d1){while(--_0x2132d1){_0x38ac39['push'](_0x38ac39['shift']());}};_0x24097c(++_0x44d712);}(_0xda53,0x162));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3da5('0x0'));var rimraf=require(_0x3da5('0x1'));var zipdir=require(_0x3da5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3da5('0x3'));var moment=require(_0x3da5('0x4'));var BPromise=require(_0x3da5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3da5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3da5('0x7'));var fs=require('fs');var _=require(_0x3da5('0x8'));var squel=require(_0x3da5('0x9'));var crypto=require(_0x3da5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3da5('0xb'));var toCsv=require(_0x3da5('0xc'));var querystring=require(_0x3da5('0xd'));var Papa=require(_0x3da5('0xe'));var Redis=require(_0x3da5('0xf'));var authService=require(_0x3da5('0x10'));var qs=require(_0x3da5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3da5('0x12'))(_0x3da5('0x13'));var utils=require(_0x3da5('0x14'));var config=require(_0x3da5('0x15'));var licenseUtil=require(_0x3da5('0x16'));var db=require(_0x3da5('0x17'))['db'];function respondWithStatusCode(_0x71fb6d,_0x6da486){_0x6da486=_0x6da486||0xcc;return function(_0x8ddb07){if(_0x8ddb07){return _0x71fb6d[_0x3da5('0x18')](_0x6da486);}return _0x71fb6d[_0x3da5('0x19')](_0x6da486)[_0x3da5('0x1a')]();};}function respondWithResult(_0x431768,_0x400dc3){_0x400dc3=_0x400dc3||0xc8;return function(_0x431197){if(_0x431197){return _0x431768[_0x3da5('0x19')](_0x400dc3)[_0x3da5('0x1b')](_0x431197);}};}function respondWithFilteredResult(_0x3b5237,_0x922742){return function(_0x3ed80f){if(_0x3ed80f){var _0x5916f3=_0x3ed80f['count'],_0x355f0e=_0x922742[_0x3da5('0x1c')],_0x4e57a1=_0x922742[_0x3da5('0x1c')]+_0x922742[_0x3da5('0x1d')],_0x4781c7;if(_0x4e57a1>=_0x5916f3){_0x4e57a1=_0x5916f3;_0x4781c7=0xc8;}else{_0x4781c7=0xce;}_0x3b5237[_0x3da5('0x19')](_0x4781c7);return _0x3b5237[_0x3da5('0x1e')](_0x3da5('0x1f'),_0x355f0e+'-'+_0x4e57a1+'/'+_0x5916f3)[_0x3da5('0x1b')](_0x3ed80f);}return null;};}function patchUpdates(_0x4258e4){return function(_0x4cefeb){try{jsonpatch[_0x3da5('0x20')](_0x4cefeb,_0x4258e4,!![]);}catch(_0xf38807){return BPromise[_0x3da5('0x21')](_0xf38807);}return _0x4cefeb['save']();};}function saveUpdates(_0x33ed5c,_0x895bec){return function(_0x23e593){if(_0x23e593){return _0x23e593[_0x3da5('0x22')](_0x33ed5c)[_0x3da5('0x23')](function(_0x2d76e4){return _0x2d76e4;});}return null;};}function removeEntity(_0x4ba64d,_0x195f7c){return function(_0x3646c0){if(_0x3646c0){return _0x3646c0[_0x3da5('0x24')]()['then'](function(){_0x4ba64d['status'](0xcc)[_0x3da5('0x1a')]();});}};}function handleEntityNotFound(_0x113f9f,_0x489508){return function(_0x2b8e45){if(!_0x2b8e45){_0x113f9f['sendStatus'](0x194);}return _0x2b8e45;};}function handleError(_0x465aae,_0x381d8e){_0x381d8e=_0x381d8e||0x1f4;return function(_0x8d9052){logger[_0x3da5('0x25')](_0x8d9052[_0x3da5('0x26')]);if(_0x8d9052['name']){delete _0x8d9052['name'];}_0x465aae[_0x3da5('0x19')](_0x381d8e)[_0x3da5('0x27')](_0x8d9052);};}exports[_0x3da5('0x28')]=function(_0x59989b,_0x3f93fa){var _0x578ff2={},_0x357d86={},_0x401053={'count':0x0,'rows':[]};var _0x52130c=_[_0x3da5('0x29')](db[_0x3da5('0x2a')]['rawAttributes'],function(_0x4abf27){return{'name':_0x4abf27[_0x3da5('0x2b')],'type':_0x4abf27[_0x3da5('0x2c')]['key']};});_0x357d86[_0x3da5('0x2d')]=_[_0x3da5('0x2e')](_['map'](_0x52130c,'name'),[_0x3da5('0x2f')]);_0x357d86[_0x3da5('0x30')]=_['keys'](_0x59989b[_0x3da5('0x30')]);_0x357d86[_0x3da5('0x31')]=_['intersection'](_0x357d86[_0x3da5('0x2d')],_0x357d86[_0x3da5('0x30')]);_0x578ff2[_0x3da5('0x32')]=_[_0x3da5('0x33')](_0x357d86[_0x3da5('0x2d')],qs[_0x3da5('0x34')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x34')]));_0x578ff2['attributes']=_0x578ff2[_0x3da5('0x32')][_0x3da5('0x35')]?_0x578ff2[_0x3da5('0x32')]:_0x357d86[_0x3da5('0x2d')];if(!_0x59989b[_0x3da5('0x30')][_0x3da5('0x36')](_0x3da5('0x37'))){_0x578ff2[_0x3da5('0x1d')]=qs[_0x3da5('0x1d')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x1d')]);_0x578ff2[_0x3da5('0x1c')]=qs[_0x3da5('0x1c')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x1c')]);}_0x578ff2[_0x3da5('0x38')]=qs[_0x3da5('0x39')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x39')]);_0x578ff2[_0x3da5('0x3a')]=qs[_0x3da5('0x31')](_[_0x3da5('0x3b')](_0x59989b['query'],_0x357d86[_0x3da5('0x31')]),_0x52130c);if(_0x59989b[_0x3da5('0x30')][_0x3da5('0x3c')]){_0x578ff2[_0x3da5('0x3a')]=_[_0x3da5('0x3d')](_0x578ff2[_0x3da5('0x3a')],{'$or':_[_0x3da5('0x29')](_0x52130c,function(_0x551477){if(_0x551477[_0x3da5('0x2c')]!=='VIRTUAL'){var _0x4cced5={};_0x4cced5[_0x551477[_0x3da5('0x2f')]]={'$like':'%'+_0x59989b[_0x3da5('0x30')][_0x3da5('0x3c')]+'%'};return _0x4cced5;}})});}_0x578ff2=_[_0x3da5('0x3d')]({},_0x578ff2,_0x59989b['options']);var _0x5b32ea={'where':_0x578ff2[_0x3da5('0x3a')]};return db[_0x3da5('0x2a')][_0x3da5('0x3e')](_0x5b32ea)[_0x3da5('0x23')](function(_0x3937d4){_0x401053[_0x3da5('0x3e')]=_0x3937d4;if(_0x59989b[_0x3da5('0x30')][_0x3da5('0x3f')]){_0x578ff2[_0x3da5('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x3da5('0x41')](_0x578ff2);})['then'](function(_0x1d4a29){_0x401053[_0x3da5('0x42')]=_0x1d4a29;return _0x401053;})[_0x3da5('0x23')](respondWithFilteredResult(_0x3f93fa,_0x578ff2))[_0x3da5('0x43')](handleError(_0x3f93fa,null));};exports[_0x3da5('0x44')]=function(_0x458868,_0x3da0c3){var _0x23a92b={'raw':!![],'where':{'id':_0x458868[_0x3da5('0x45')]['id']}},_0x1bc619={};_0x1bc619['model']=_[_0x3da5('0x46')](db[_0x3da5('0x2a')][_0x3da5('0x47')]);_0x1bc619['query']=_[_0x3da5('0x46')](_0x458868['query']);_0x1bc619[_0x3da5('0x31')]=_[_0x3da5('0x33')](_0x1bc619[_0x3da5('0x2d')],_0x1bc619[_0x3da5('0x30')]);_0x23a92b[_0x3da5('0x32')]=_[_0x3da5('0x33')](_0x1bc619[_0x3da5('0x2d')],qs['fields'](_0x458868[_0x3da5('0x30')][_0x3da5('0x34')]));_0x23a92b[_0x3da5('0x32')]=_0x23a92b[_0x3da5('0x32')][_0x3da5('0x35')]?_0x23a92b['attributes']:_0x1bc619[_0x3da5('0x2d')];if(_0x458868[_0x3da5('0x30')][_0x3da5('0x3f')]){_0x23a92b['include']=[{'all':!![]}];}_0x23a92b=_[_0x3da5('0x3d')]({},_0x23a92b,_0x458868[_0x3da5('0x48')]);return db[_0x3da5('0x2a')][_0x3da5('0x49')](_0x23a92b)['then'](handleEntityNotFound(_0x3da0c3,null))['then'](respondWithResult(_0x3da0c3,null))['catch'](handleError(_0x3da0c3,null));};exports[_0x3da5('0x4a')]=function(_0x1f22cb,_0x34709b){return db['VoiceMailMessage']['create'](_0x1f22cb['body'],{})['then'](respondWithResult(_0x34709b,0xc9))['catch'](handleError(_0x34709b,null));};exports[_0x3da5('0x22')]=function(_0x27db13,_0x26ec87){if(_0x27db13[_0x3da5('0x4b')]['id']){delete _0x27db13[_0x3da5('0x4b')]['id'];}return db[_0x3da5('0x2a')][_0x3da5('0x49')]({'where':{'id':_0x27db13[_0x3da5('0x45')]['id']}})[_0x3da5('0x23')](handleEntityNotFound(_0x26ec87,null))[_0x3da5('0x23')](saveUpdates(_0x27db13[_0x3da5('0x4b')],null))['then'](respondWithResult(_0x26ec87,null))['catch'](handleError(_0x26ec87,null));};exports['destroy']=function(_0x2b95ae,_0x42763b){return db[_0x3da5('0x2a')][_0x3da5('0x49')]({'where':{'id':_0x2b95ae[_0x3da5('0x45')]['id']}})[_0x3da5('0x23')](handleEntityNotFound(_0x42763b,null))[_0x3da5('0x23')](removeEntity(_0x42763b,null))[_0x3da5('0x43')](handleError(_0x42763b,null));};exports[_0x3da5('0x4c')]=function(_0x1a8158,_0x4bb4c4,_0x48fdce){return db[_0x3da5('0x2a')][_0x3da5('0x49')]({'where':{'id':_0x1a8158[_0x3da5('0x45')]['id']},'attributes':['id',_0x3da5('0x4d'),_0x3da5('0x4e')]})[_0x3da5('0x23')](handleEntityNotFound(_0x4bb4c4,null))[_0x3da5('0x23')](function(_0x16289d){if(_0x16289d){if(!_0x16289d['recording']){throw new db[(_0x3da5('0x4f'))][(_0x3da5('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x44a0c9={'Content-Type':_0x3da5('0x51'),'Content-Disposition':_0x3da5('0x52')};if(_0x16289d[_0x3da5('0x4e')]){_0x44a0c9[_0x3da5('0x53')]=_0x3da5('0x54')+_0x16289d[_0x3da5('0x4e')]+_0x3da5('0x55');}_0x4bb4c4[_0x3da5('0x1e')](_0x44a0c9);return _0x4bb4c4['send'](new Buffer(_0x16289d[_0x3da5('0x4d')]));}})[_0x3da5('0x43')](handleError(_0x4bb4c4,null));}; \ No newline at end of file +var _0xb6c7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','sendStatus','error','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','find','create','body','catch','destroy','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','html-pdf'];(function(_0x4a7193,_0x556c6a){var _0xc33d94=function(_0x3b7b34){while(--_0x3b7b34){_0x4a7193['push'](_0x4a7193['shift']());}};_0xc33d94(++_0x556c6a);}(_0xb6c7,0xf5));var _0x7b6c=function(_0x224148,_0x5ab314){_0x224148=_0x224148-0x0;var _0x6d0fbc=_0xb6c7[_0x224148];return _0x6d0fbc;};'use strict';var pdf=require(_0x7b6c('0x0'));var emlformat=require(_0x7b6c('0x1'));var rimraf=require(_0x7b6c('0x2'));var zipdir=require(_0x7b6c('0x3'));var jsonpatch=require(_0x7b6c('0x4'));var rp=require(_0x7b6c('0x5'));var moment=require('moment');var BPromise=require(_0x7b6c('0x6'));var Mustache=require(_0x7b6c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7b6c('0x8'));var csv=require('to-csv');var ejs=require(_0x7b6c('0x9'));var fs=require('fs');var _=require(_0x7b6c('0xa'));var squel=require(_0x7b6c('0xb'));var crypto=require(_0x7b6c('0xc'));var jsforce=require(_0x7b6c('0xd'));var deskjs=require(_0x7b6c('0xe'));var toCsv=require(_0x7b6c('0xf'));var querystring=require(_0x7b6c('0x10'));var Papa=require(_0x7b6c('0x11'));var Redis=require(_0x7b6c('0x12'));var authService=require(_0x7b6c('0x13'));var qs=require(_0x7b6c('0x14'));var as=require(_0x7b6c('0x15'));var hardwareService=require(_0x7b6c('0x16'));var logger=require(_0x7b6c('0x17'))('api');var utils=require(_0x7b6c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7b6c('0x19'));var db=require(_0x7b6c('0x1a'))['db'];function respondWithStatusCode(_0x2dbcf7,_0x5bab05){_0x5bab05=_0x5bab05||0xcc;return function(_0x3b3596){if(_0x3b3596){return _0x2dbcf7['sendStatus'](_0x5bab05);}return _0x2dbcf7[_0x7b6c('0x1b')](_0x5bab05)[_0x7b6c('0x1c')]();};}function respondWithResult(_0x2cdabb,_0x346a02){_0x346a02=_0x346a02||0xc8;return function(_0x325918){if(_0x325918){return _0x2cdabb[_0x7b6c('0x1b')](_0x346a02)['json'](_0x325918);}};}function respondWithFilteredResult(_0x42fb58,_0x2e2657){return function(_0x25d0cd){if(_0x25d0cd){var _0x5abc81=_0x25d0cd[_0x7b6c('0x1d')],_0x1eae3e=_0x2e2657[_0x7b6c('0x1e')],_0xe5c739=_0x2e2657[_0x7b6c('0x1e')]+_0x2e2657[_0x7b6c('0x1f')],_0x8df8f0;if(_0xe5c739>=_0x5abc81){_0xe5c739=_0x5abc81;_0x8df8f0=0xc8;}else{_0x8df8f0=0xce;}_0x42fb58['status'](_0x8df8f0);return _0x42fb58[_0x7b6c('0x20')](_0x7b6c('0x21'),_0x1eae3e+'-'+_0xe5c739+'/'+_0x5abc81)[_0x7b6c('0x22')](_0x25d0cd);}return null;};}function patchUpdates(_0x2f4b27){return function(_0x5299c4){try{jsonpatch['apply'](_0x5299c4,_0x2f4b27,!![]);}catch(_0x1ef1f2){return BPromise[_0x7b6c('0x23')](_0x1ef1f2);}return _0x5299c4['save']();};}function saveUpdates(_0x58586d,_0x1ee615){return function(_0x58ec7a){if(_0x58ec7a){return _0x58ec7a[_0x7b6c('0x24')](_0x58586d)[_0x7b6c('0x25')](function(_0x60b8c8){return _0x60b8c8;});}return null;};}function removeEntity(_0x1aabad,_0x39deb5){return function(_0xaa5b0){if(_0xaa5b0){return _0xaa5b0['destroy']()[_0x7b6c('0x25')](function(){_0x1aabad[_0x7b6c('0x1b')](0xcc)[_0x7b6c('0x1c')]();});}};}function handleEntityNotFound(_0x9c3d62,_0x4fa556){return function(_0xae220d){if(!_0xae220d){_0x9c3d62[_0x7b6c('0x26')](0x194);}return _0xae220d;};}function handleError(_0x114a21,_0x36dd7e){_0x36dd7e=_0x36dd7e||0x1f4;return function(_0x240aa0){logger[_0x7b6c('0x27')](_0x240aa0['stack']);if(_0x240aa0[_0x7b6c('0x28')]){delete _0x240aa0[_0x7b6c('0x28')];}_0x114a21[_0x7b6c('0x1b')](_0x36dd7e)[_0x7b6c('0x29')](_0x240aa0);};}exports[_0x7b6c('0x2a')]=function(_0x3051aa,_0x34d1e7){var _0x500d71={},_0x5a9800={},_0x2e373={'count':0x0,'rows':[]};var _0x4bfb63=_[_0x7b6c('0x2b')](db[_0x7b6c('0x2c')][_0x7b6c('0x2d')],function(_0x248055){return{'name':_0x248055['fieldName'],'type':_0x248055[_0x7b6c('0x2e')][_0x7b6c('0x2f')]};});_0x5a9800['model']=_['differenceBy'](_[_0x7b6c('0x2b')](_0x4bfb63,_0x7b6c('0x28')),[_0x7b6c('0x28')]);_0x5a9800[_0x7b6c('0x30')]=_[_0x7b6c('0x31')](_0x3051aa[_0x7b6c('0x30')]);_0x5a9800['filters']=_['intersection'](_0x5a9800[_0x7b6c('0x32')],_0x5a9800['query']);_0x500d71[_0x7b6c('0x33')]=_[_0x7b6c('0x34')](_0x5a9800[_0x7b6c('0x32')],qs[_0x7b6c('0x35')](_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x35')]));_0x500d71[_0x7b6c('0x33')]=_0x500d71['attributes'][_0x7b6c('0x36')]?_0x500d71[_0x7b6c('0x33')]:_0x5a9800[_0x7b6c('0x32')];if(!_0x3051aa['query'][_0x7b6c('0x37')]('nolimit')){_0x500d71[_0x7b6c('0x1f')]=qs[_0x7b6c('0x1f')](_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x1f')]);_0x500d71[_0x7b6c('0x1e')]=qs[_0x7b6c('0x1e')](_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x1e')]);}_0x500d71['order']=qs[_0x7b6c('0x38')](_0x3051aa['query'][_0x7b6c('0x38')]);_0x500d71['where']=qs[_0x7b6c('0x39')](_[_0x7b6c('0x3a')](_0x3051aa[_0x7b6c('0x30')],_0x5a9800[_0x7b6c('0x39')]),_0x4bfb63);if(_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x3b')]){_0x500d71[_0x7b6c('0x3c')]=_['merge'](_0x500d71[_0x7b6c('0x3c')],{'$or':_[_0x7b6c('0x2b')](_0x4bfb63,function(_0x572f70){if(_0x572f70['type']!==_0x7b6c('0x3d')){var _0x1fcbb9={};_0x1fcbb9[_0x572f70['name']]={'$like':'%'+_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x3b')]+'%'};return _0x1fcbb9;}})});}_0x500d71=_[_0x7b6c('0x3e')]({},_0x500d71,_0x3051aa[_0x7b6c('0x3f')]);var _0xa85169={'where':_0x500d71[_0x7b6c('0x3c')]};return db[_0x7b6c('0x2c')][_0x7b6c('0x1d')](_0xa85169)[_0x7b6c('0x25')](function(_0x1c767c){_0x2e373[_0x7b6c('0x1d')]=_0x1c767c;if(_0x3051aa[_0x7b6c('0x30')][_0x7b6c('0x40')]){_0x500d71[_0x7b6c('0x41')]=[{'all':!![]}];}return db[_0x7b6c('0x2c')]['findAll'](_0x500d71);})['then'](function(_0x56b8f4){_0x2e373[_0x7b6c('0x42')]=_0x56b8f4;return _0x2e373;})['then'](respondWithFilteredResult(_0x34d1e7,_0x500d71))['catch'](handleError(_0x34d1e7,null));};exports[_0x7b6c('0x43')]=function(_0x3aad48,_0x5b05fe){var _0x26e146={'raw':!![],'where':{'id':_0x3aad48['params']['id']}},_0x386967={};_0x386967[_0x7b6c('0x32')]=_[_0x7b6c('0x31')](db['VoiceMailMessage'][_0x7b6c('0x2d')]);_0x386967[_0x7b6c('0x30')]=_[_0x7b6c('0x31')](_0x3aad48[_0x7b6c('0x30')]);_0x386967['filters']=_[_0x7b6c('0x34')](_0x386967[_0x7b6c('0x32')],_0x386967[_0x7b6c('0x30')]);_0x26e146['attributes']=_[_0x7b6c('0x34')](_0x386967[_0x7b6c('0x32')],qs[_0x7b6c('0x35')](_0x3aad48[_0x7b6c('0x30')][_0x7b6c('0x35')]));_0x26e146[_0x7b6c('0x33')]=_0x26e146[_0x7b6c('0x33')][_0x7b6c('0x36')]?_0x26e146[_0x7b6c('0x33')]:_0x386967[_0x7b6c('0x32')];if(_0x3aad48['query'][_0x7b6c('0x40')]){_0x26e146[_0x7b6c('0x41')]=[{'all':!![]}];}_0x26e146=_[_0x7b6c('0x3e')]({},_0x26e146,_0x3aad48[_0x7b6c('0x3f')]);return db[_0x7b6c('0x2c')][_0x7b6c('0x44')](_0x26e146)[_0x7b6c('0x25')](handleEntityNotFound(_0x5b05fe,null))['then'](respondWithResult(_0x5b05fe,null))['catch'](handleError(_0x5b05fe,null));};exports[_0x7b6c('0x45')]=function(_0x2d027f,_0x5ee3bf){return db[_0x7b6c('0x2c')][_0x7b6c('0x45')](_0x2d027f[_0x7b6c('0x46')],{})[_0x7b6c('0x25')](respondWithResult(_0x5ee3bf,0xc9))[_0x7b6c('0x47')](handleError(_0x5ee3bf,null));};exports['update']=function(_0x37424b,_0x4dc04c){if(_0x37424b[_0x7b6c('0x46')]['id']){delete _0x37424b[_0x7b6c('0x46')]['id'];}return db['VoiceMailMessage'][_0x7b6c('0x44')]({'where':{'id':_0x37424b['params']['id']}})[_0x7b6c('0x25')](handleEntityNotFound(_0x4dc04c,null))[_0x7b6c('0x25')](saveUpdates(_0x37424b[_0x7b6c('0x46')],null))['then'](respondWithResult(_0x4dc04c,null))[_0x7b6c('0x47')](handleError(_0x4dc04c,null));};exports[_0x7b6c('0x48')]=function(_0x65105e,_0x143f67){return db[_0x7b6c('0x2c')][_0x7b6c('0x44')]({'where':{'id':_0x65105e[_0x7b6c('0x49')]['id']}})[_0x7b6c('0x25')](handleEntityNotFound(_0x143f67,null))[_0x7b6c('0x25')](removeEntity(_0x143f67,null))[_0x7b6c('0x47')](handleError(_0x143f67,null));};exports[_0x7b6c('0x4a')]=function(_0x1243cc,_0x530787,_0x3f1046){return db[_0x7b6c('0x2c')][_0x7b6c('0x44')]({'where':{'id':_0x1243cc[_0x7b6c('0x49')]['id']},'attributes':['id',_0x7b6c('0x4b'),_0x7b6c('0x4c')]})['then'](handleEntityNotFound(_0x530787,null))['then'](function(_0x50ac0b){if(_0x50ac0b){if(!_0x50ac0b[_0x7b6c('0x4b')]){throw new db[(_0x7b6c('0x4d'))]['ValidationError'](_0x7b6c('0x4e'));}var _0x1b9a65={'Content-Type':'audio/wav','Content-Disposition':_0x7b6c('0x4f')};if(_0x50ac0b[_0x7b6c('0x4c')]){_0x1b9a65[_0x7b6c('0x50')]='attachment;\x20filename=\x22'+_0x50ac0b[_0x7b6c('0x4c')]+_0x7b6c('0x51');}_0x530787['set'](_0x1b9a65);return _0x530787[_0x7b6c('0x29')](new Buffer(_0x50ac0b['recording']));}})['catch'](handleError(_0x530787,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0df7619..e0d5a2d 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 _0x7455=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x7455,0x16e));var _0x5745=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7455[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5745('0x0'));var util=require(_0x5745('0x1'));var logger=require(_0x5745('0x2'))(_0x5745('0x3'));var moment=require(_0x5745('0x4'));var BPromise=require('bluebird');var rp=require(_0x5745('0x5'));var fs=require('fs');var path=require(_0x5745('0x6'));var rimraf=require(_0x5745('0x7'));var config=require(_0x5745('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x5745('0x9')]=function(_0x1f4144,_0x379c54){return _0x1f4144[_0x5745('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x5745('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x5745('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x67cf=['bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash','util','api'];(function(_0x3d71f1,_0x28168d){var _0x22108d=function(_0x1bc86e){while(--_0x1bc86e){_0x3d71f1['push'](_0x3d71f1['shift']());}};_0x22108d(++_0x28168d);}(_0x67cf,0xad));var _0xf67c=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0x67cf[_0x1f1fb4];return _0x12fa15;};'use strict';var _=require(_0xf67c('0x0'));var util=require(_0xf67c('0x1'));var logger=require('../../config/logger')(_0xf67c('0x2'));var moment=require('moment');var BPromise=require(_0xf67c('0x3'));var rp=require(_0xf67c('0x4'));var fs=require('fs');var path=require(_0xf67c('0x5'));var rimraf=require(_0xf67c('0x6'));var config=require('../../config/environment');var attributes=require(_0xf67c('0x7'));module['exports']=function(_0x527b25,_0x1a4afe){return _0x527b25[_0xf67c('0x8')]('VoiceMailMessage',attributes,{'tableName':_0xf67c('0x9'),'paranoid':![],'indexes':[{'name':_0xf67c('0xa'),'fields':[_0xf67c('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 517ffa7..f2348a9 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 _0x0295=['client','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e79fa,_0x4c532d){var _0x12ea3b=function(_0x222648){while(--_0x222648){_0x2e79fa['push'](_0x2e79fa['shift']());}};_0x12ea3b(++_0x4c532d);}(_0x0295,0x1f0));var _0x5029=function(_0x56188d,_0x514566){_0x56188d=_0x56188d-0x0;var _0x6004b1=_0x0295[_0x56188d];return _0x6004b1;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0xb78f74,_0x2548d1){var _0x465eb1=function(_0x590567){while(--_0x590567){_0xb78f74['push'](_0xb78f74['shift']());}};_0x465eb1(++_0x2548d1);}(_0x14a0,0x8e));var _0x014a=function(_0x485c75,_0x3cb4d7){_0x485c75=_0x485c75-0x0;var _0x44ff37=_0x14a0[_0x485c75];return _0x44ff37;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 90af67a..b11fe12 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 _0x583d=['/:id','show','/:id/sounds','getSounds','post','put','destroy','delete','removeSound','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4a63fc,_0x167a02){var _0x30d4c3=function(_0x3eecb2){while(--_0x3eecb2){_0x4a63fc['push'](_0x4a63fc['shift']());}};_0x30d4c3(++_0x167a02);}(_0x583d,0x139));var _0xd583=function(_0x35c2a9,_0x4e8953){_0x35c2a9=_0x35c2a9-0x0;var _0x5ab481=_0x583d[_0x35c2a9];return _0x5ab481;};'use strict';var multer=require(_0xd583('0x0'));var util=require(_0xd583('0x1'));var path=require(_0xd583('0x2'));var timeout=require(_0xd583('0x3'));var express=require(_0xd583('0x4'));var router=express[_0xd583('0x5')]();var auth=require(_0xd583('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd583('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xd583('0x8')]('/',auth[_0xd583('0x9')](),controller['index']);router['get'](_0xd583('0xa'),auth[_0xd583('0x9')](),controller[_0xd583('0xb')]);router[_0xd583('0x8')](_0xd583('0xc'),auth[_0xd583('0x9')](),controller[_0xd583('0xd')]);router[_0xd583('0xe')]('/',auth[_0xd583('0x9')](),controller['create']);router[_0xd583('0xe')](_0xd583('0xc'),auth[_0xd583('0x9')](),controller['addSound']);router[_0xd583('0xf')](_0xd583('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd583('0xa'),auth[_0xd583('0x9')](),controller[_0xd583('0x10')]);router[_0xd583('0x11')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xd583('0x12')]);module['exports']=router; \ No newline at end of file +var _0x66cd=['removeSound','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x1a31a8,_0x3b5148){var _0x3bf43d=function(_0x385a58){while(--_0x385a58){_0x1a31a8['push'](_0x1a31a8['shift']());}};_0x3bf43d(++_0x3b5148);}(_0x66cd,0x1b2));var _0xd66c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x66cd[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xd66c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd66c('0x1'));var express=require(_0xd66c('0x2'));var router=express[_0xd66c('0x3')]();var auth=require(_0xd66c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd66c('0x5'));var controller=require(_0xd66c('0x6'));router[_0xd66c('0x7')]('/',auth[_0xd66c('0x8')](),controller[_0xd66c('0x9')]);router['get'](_0xd66c('0xa'),auth[_0xd66c('0x8')](),controller[_0xd66c('0xb')]);router[_0xd66c('0x7')](_0xd66c('0xc'),auth['isAuthenticated'](),controller[_0xd66c('0xd')]);router[_0xd66c('0xe')]('/',auth[_0xd66c('0x8')](),controller[_0xd66c('0xf')]);router['post'](_0xd66c('0xc'),auth[_0xd66c('0x8')](),controller[_0xd66c('0x10')]);router[_0xd66c('0x11')](_0xd66c('0xa'),auth[_0xd66c('0x8')](),controller[_0xd66c('0x12')]);router[_0xd66c('0x13')](_0xd66c('0xa'),auth['isAuthenticated'](),controller[_0xd66c('0x14')]);router[_0xd66c('0x13')](_0xd66c('0x15'),auth[_0xd66c('0x8')](),controller[_0xd66c('0x16')]);module[_0xd66c('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index be20d5d..7b72a43 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 _0x8ecb=['mp3','alpha','sequelize','exports','STRING','files','quietmp3'];(function(_0x4c697d,_0x480cab){var _0x2e99b0=function(_0x2f847f){while(--_0x2f847f){_0x4c697d['push'](_0x4c697d['shift']());}};_0x2e99b0(++_0x480cab);}(_0x8ecb,0x64));var _0xb8ec=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8ecb[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xb8ec('0x0'));module[_0xb8ec('0x1')]={'name':{'type':Sequelize[_0xb8ec('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom',_0xb8ec('0x3'),'mp3nb','quietmp3nb',_0xb8ec('0x4'),_0xb8ec('0x5')),'allowNull':!![],'defaultValue':_0xb8ec('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xb8ec('0x2')],'allowNull':!![],'defaultValue':_0xb8ec('0x6')},'format':{'type':Sequelize[_0xb8ec('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2455=['alpha','BOOLEAN','sequelize','exports','STRING','name','files','mp3nb','quietmp3','mp3'];(function(_0x5b7fb9,_0x2204b3){var _0x104667=function(_0x546b83){while(--_0x546b83){_0x5b7fb9['push'](_0x5b7fb9['shift']());}};_0x104667(++_0x2204b3);}(_0x2455,0x19c));var _0x5245=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x2455[_0x2defb5];return _0x229c53;};'use strict';var Sequelize=require(_0x5245('0x0'));module[_0x5245('0x1')]={'name':{'type':Sequelize[_0x5245('0x2')],'allowNull':![],'unique':_0x5245('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x5245('0x4'),_0x5245('0x5'),'quietmp3nb',_0x5245('0x6'),_0x5245('0x7')),'allowNull':!![],'defaultValue':_0x5245('0x4')},'directory':{'type':Sequelize[_0x5245('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x5245('0x2')],'allowNull':!![],'defaultValue':_0x5245('0x8')},'format':{'type':Sequelize[_0x5245('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x5245('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index f85c1b8..ff634ce 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 _0x4278=['show','params','keys','rawAttributes','includeAll','include','find','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','readdirSync','forEach','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','extname','format','symlinkSync','message','removeSound','id2','%s.%s','getSounds','where','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filters','merge','VIRTUAL','filter','options','findAll','rows','catch'];(function(_0x443069,_0x603fd6){var _0x1a3a1b=function(_0x259361){while(--_0x259361){_0x443069['push'](_0x443069['shift']());}};_0x1a3a1b(++_0x603fd6);}(_0x4278,0x9c));var _0x8427=function(_0x1ce0d4,_0x37b0da){_0x1ce0d4=_0x1ce0d4-0x0;var _0x5ea7f7=_0x4278[_0x1ce0d4];return _0x5ea7f7;};'use strict';var pdf=require(_0x8427('0x0'));var emlformat=require(_0x8427('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8427('0x2'));var jsonpatch=require(_0x8427('0x3'));var rp=require(_0x8427('0x4'));var moment=require(_0x8427('0x5'));var BPromise=require(_0x8427('0x6'));var Mustache=require(_0x8427('0x7'));var util=require(_0x8427('0x8'));var path=require('path');var sox=require(_0x8427('0x9'));var csv=require(_0x8427('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8427('0xb'));var crypto=require(_0x8427('0xc'));var jsforce=require(_0x8427('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8427('0xa'));var querystring=require(_0x8427('0xe'));var Papa=require('papaparse');var Redis=require(_0x8427('0xf'));var authService=require(_0x8427('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8427('0x11'));var logger=require(_0x8427('0x12'))('api');var utils=require(_0x8427('0x13'));var config=require(_0x8427('0x14'));var licenseUtil=require(_0x8427('0x15'));var db=require(_0x8427('0x16'))['db'];function respondWithStatusCode(_0x3f7dd9,_0x32b930){_0x32b930=_0x32b930||0xcc;return function(_0x1220dd){if(_0x1220dd){return _0x3f7dd9[_0x8427('0x17')](_0x32b930);}return _0x3f7dd9[_0x8427('0x18')](_0x32b930)['end']();};}function respondWithResult(_0x46e670,_0x19c9c6){_0x19c9c6=_0x19c9c6||0xc8;return function(_0x4b0ddb){if(_0x4b0ddb){return _0x46e670['status'](_0x19c9c6)[_0x8427('0x19')](_0x4b0ddb);}};}function respondWithFilteredResult(_0x211ac5,_0x5a6609){return function(_0x35f65d){if(_0x35f65d){var _0x46400b=_0x35f65d[_0x8427('0x1a')],_0x13cb73=_0x5a6609['offset'],_0x2693b0=_0x5a6609[_0x8427('0x1b')]+_0x5a6609[_0x8427('0x1c')],_0x13d2cf;if(_0x2693b0>=_0x46400b){_0x2693b0=_0x46400b;_0x13d2cf=0xc8;}else{_0x13d2cf=0xce;}_0x211ac5[_0x8427('0x18')](_0x13d2cf);return _0x211ac5[_0x8427('0x1d')]('Content-Range',_0x13cb73+'-'+_0x2693b0+'/'+_0x46400b)[_0x8427('0x19')](_0x35f65d);}return null;};}function patchUpdates(_0x5aca8b){return function(_0x5e7a06){try{jsonpatch[_0x8427('0x1e')](_0x5e7a06,_0x5aca8b,!![]);}catch(_0x31cccd){return BPromise['reject'](_0x31cccd);}return _0x5e7a06[_0x8427('0x1f')]();};}function saveUpdates(_0x52d5de,_0x303fe5){return function(_0x189f56){if(_0x189f56){return _0x189f56[_0x8427('0x20')](_0x52d5de)[_0x8427('0x21')](function(_0x207de3){return _0x207de3;});}return null;};}function removeEntity(_0xf6977d,_0x29bab0){return function(_0x161406){if(_0x161406){return _0x161406[_0x8427('0x22')]()[_0x8427('0x21')](function(){var _0x242319=_0x161406[_0x8427('0x23')]({'plain':!![]});var _0x332db3=_0x8427('0x24');return db[_0x8427('0x25')][_0x8427('0x22')]({'where':{'type':_0x332db3,'resourceId':_0x242319['id']}})[_0x8427('0x21')](function(){return _0x161406;});})[_0x8427('0x21')](function(){_0xf6977d['status'](0xcc)[_0x8427('0x26')]();});}};}function handleEntityNotFound(_0xb08886,_0xb4987b){return function(_0x6eb771){if(!_0x6eb771){_0xb08886[_0x8427('0x17')](0x194);}return _0x6eb771;};}function handleError(_0x4b7a07,_0x3f2bc5){_0x3f2bc5=_0x3f2bc5||0x1f4;return function(_0x7f4f08){logger[_0x8427('0x27')](_0x7f4f08[_0x8427('0x28')]);if(_0x7f4f08['name']){delete _0x7f4f08[_0x8427('0x29')];}_0x4b7a07[_0x8427('0x18')](_0x3f2bc5)[_0x8427('0x2a')](_0x7f4f08);};}exports[_0x8427('0x2b')]=function(_0x2ed354,_0x47ee2b){var _0x513da9={},_0x15ca6e={},_0x4fbdfb={'count':0x0,'rows':[]};var _0x5e600d=_[_0x8427('0x2c')](db[_0x8427('0x2d')]['rawAttributes'],function(_0x24c27c){return{'name':_0x24c27c[_0x8427('0x2e')],'type':_0x24c27c[_0x8427('0x2f')][_0x8427('0x30')]};});_0x15ca6e['model']=_['map'](_0x5e600d,_0x8427('0x29'));_0x15ca6e['query']=_['keys'](_0x2ed354['query']);_0x15ca6e['filters']=_[_0x8427('0x31')](_0x15ca6e[_0x8427('0x32')],_0x15ca6e['query']);_0x513da9[_0x8427('0x33')]=_[_0x8427('0x31')](_0x15ca6e[_0x8427('0x32')],qs[_0x8427('0x34')](_0x2ed354[_0x8427('0x35')][_0x8427('0x34')]));_0x513da9['attributes']=_0x513da9['attributes'][_0x8427('0x36')]?_0x513da9['attributes']:_0x15ca6e['model'];if(!_0x2ed354[_0x8427('0x35')][_0x8427('0x37')](_0x8427('0x38'))){_0x513da9[_0x8427('0x1c')]=qs['limit'](_0x2ed354['query'][_0x8427('0x1c')]);_0x513da9['offset']=qs[_0x8427('0x1b')](_0x2ed354[_0x8427('0x35')]['offset']);}_0x513da9[_0x8427('0x39')]=qs[_0x8427('0x3a')](_0x2ed354[_0x8427('0x35')][_0x8427('0x3a')]);_0x513da9['where']=qs['filters'](_[_0x8427('0x3b')](_0x2ed354[_0x8427('0x35')],_0x15ca6e[_0x8427('0x3c')]),_0x5e600d);if(_0x2ed354[_0x8427('0x35')]['filter']){_0x513da9['where']=_[_0x8427('0x3d')](_0x513da9['where'],{'$or':_['map'](_0x5e600d,function(_0x1fc7ac){if(_0x1fc7ac['type']!==_0x8427('0x3e')){var _0x5aba17={};_0x5aba17[_0x1fc7ac[_0x8427('0x29')]]={'$like':'%'+_0x2ed354['query'][_0x8427('0x3f')]+'%'};return _0x5aba17;}})});}_0x513da9=_[_0x8427('0x3d')]({},_0x513da9,_0x2ed354[_0x8427('0x40')]);var _0x54b5ef={'where':_0x513da9['where']};return db['VoiceMusicOnHold'][_0x8427('0x1a')](_0x54b5ef)[_0x8427('0x21')](function(_0x310868){_0x4fbdfb['count']=_0x310868;if(_0x2ed354[_0x8427('0x35')]['includeAll']){_0x513da9['include']=[{'all':!![]}];}return db[_0x8427('0x2d')][_0x8427('0x41')](_0x513da9);})[_0x8427('0x21')](function(_0x358215){_0x4fbdfb[_0x8427('0x42')]=_0x358215;return _0x4fbdfb;})[_0x8427('0x21')](respondWithFilteredResult(_0x47ee2b,_0x513da9))[_0x8427('0x43')](handleError(_0x47ee2b,null));};exports[_0x8427('0x44')]=function(_0x4fdc10,_0x13576c){var _0x243771={'raw':![],'where':{'id':_0x4fdc10[_0x8427('0x45')]['id']}},_0x22f4fc={};_0x22f4fc[_0x8427('0x32')]=_[_0x8427('0x46')](db['VoiceMusicOnHold'][_0x8427('0x47')]);_0x22f4fc[_0x8427('0x35')]=_[_0x8427('0x46')](_0x4fdc10[_0x8427('0x35')]);_0x22f4fc[_0x8427('0x3c')]=_[_0x8427('0x31')](_0x22f4fc['model'],_0x22f4fc[_0x8427('0x35')]);_0x243771[_0x8427('0x33')]=_[_0x8427('0x31')](_0x22f4fc[_0x8427('0x32')],qs['fields'](_0x4fdc10[_0x8427('0x35')]['fields']));_0x243771[_0x8427('0x33')]=_0x243771['attributes'][_0x8427('0x36')]?_0x243771[_0x8427('0x33')]:_0x22f4fc[_0x8427('0x32')];if(_0x4fdc10[_0x8427('0x35')][_0x8427('0x48')]){_0x243771[_0x8427('0x49')]=[{'all':!![]}];}_0x243771=_[_0x8427('0x3d')]({},_0x243771,_0x4fdc10[_0x8427('0x40')]);return db[_0x8427('0x2d')][_0x8427('0x4a')](_0x243771)[_0x8427('0x21')](handleEntityNotFound(_0x13576c,null))[_0x8427('0x21')](respondWithResult(_0x13576c,null))[_0x8427('0x43')](handleError(_0x13576c,null));};exports[_0x8427('0x20')]=function(_0x44e35b,_0x2c9107){if(_0x44e35b[_0x8427('0x4b')]['id']){delete _0x44e35b[_0x8427('0x4b')]['id'];}return db[_0x8427('0x2d')][_0x8427('0x4a')]({'where':{'id':_0x44e35b[_0x8427('0x45')]['id']}})[_0x8427('0x21')](handleEntityNotFound(_0x2c9107,null))[_0x8427('0x21')](saveUpdates(_0x44e35b[_0x8427('0x4b')],null))[_0x8427('0x21')](respondWithResult(_0x2c9107,null))[_0x8427('0x43')](handleError(_0x2c9107,null));};exports[_0x8427('0x4c')]=function(_0x41816f,_0xc7f9c9,_0x32faec){return db[_0x8427('0x4d')][_0x8427('0x4e')](function(_0x4b33f2){if(_0x41816f[_0x8427('0x4b')][_0x8427('0x4f')]===_0x8427('0x50')){_0x41816f['body']['directory']=path[_0x8427('0x51')](config[_0x8427('0x52')],_0x8427('0x53'),_0x41816f[_0x8427('0x4b')][_0x8427('0x29')]);}return db[_0x8427('0x2d')][_0x8427('0x4c')](_0x41816f[_0x8427('0x4b')],{'transaction':_0x4b33f2})[_0x8427('0x21')](function(_0x1fbd39){if(_0x41816f[_0x8427('0x4b')]['mode']===_0x8427('0x50')){fs[_0x8427('0x54')](_0x1fbd39[_0x8427('0x55')],parseInt(_0x8427('0x56'),0x8));}var _0x344666=_0x41816f['user'][_0x8427('0x23')]({'plain':!![]});if(!_0x344666)throw new Error(_0x8427('0x57'));if(_0x344666[_0x8427('0x58')]===_0x8427('0x59')){var _0x5578ab=_0x1fbd39['get']({'plain':!![]});return db[_0x8427('0x5a')][_0x8427('0x4a')]({'where':{'name':_0x8427('0x24'),'userProfileId':_0x344666[_0x8427('0x5b')]},'raw':!![]})[_0x8427('0x21')](function(_0x177fd6){if(_0x177fd6&&_0x177fd6[_0x8427('0x5c')]===0x0){return db[_0x8427('0x25')][_0x8427('0x4c')]({'name':_0x5578ab[_0x8427('0x29')],'resourceId':_0x5578ab['id'],'type':_0x177fd6['name'],'sectionId':_0x177fd6['id']},{})['then'](function(){return _0x1fbd39;});}else{return _0x1fbd39;}})['catch'](function(_0x263d54){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x263d54);});}return _0x1fbd39;});})[_0x8427('0x21')](respondWithResult(_0xc7f9c9,0xc9))[_0x8427('0x43')](handleError(_0xc7f9c9,null));};exports['destroy']=function(_0x5929a0,_0x4045fb,_0x7ef85e){var _0x40da9a;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5929a0[_0x8427('0x45')]['id']}})['then'](function(_0x31d29e){if(_0x31d29e){return db['sequelize'][_0x8427('0x4e')](function(_0x79561){return _0x31d29e[_0x8427('0x22')]({'transaction':_0x79561,'raw':!![]})['then'](function(_0x91800e){if(_0x91800e[_0x8427('0x55')]){fs[_0x8427('0x5d')](_0x91800e[_0x8427('0x55')])[_0x8427('0x5e')](function(_0x271bd0){fs['unlinkSync'](path[_0x8427('0x51')](_0x91800e[_0x8427('0x55')],_0x271bd0));});fs['rmdirSync'](_0x91800e[_0x8427('0x55')]);}return _0x91800e;});})[_0x8427('0x43')](function(_0x421e28){throw new db[(_0x8427('0x5f'))][(_0x8427('0x60'))](_0x421e28['message']);});}})[_0x8427('0x21')](handleEntityNotFound(_0x4045fb,null))['then'](removeEntity(_0x4045fb,null))[_0x8427('0x43')](handleError(_0x4045fb,null));};exports[_0x8427('0x61')]=function(_0x1b772b,_0x492105,_0x1c24da){return db['sequelize']['transaction'](function(_0x592c02){var _0x38549c;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x1b772b['params']['id']}})['then'](function(_0x135c76){if(_0x135c76){_0x38549c=_0x135c76;return _0x135c76[_0x8427('0x61')](_0x1b772b['body']['id'],{'transaction':_0x592c02});}})[_0x8427('0x21')](function(_0x189272){if(_0x189272){return db[_0x8427('0x62')][_0x8427('0x63')]({'where':{'id':_0x1b772b[_0x8427('0x4b')]['id']},'attributes':['id',_0x8427('0x29'),_0x8427('0x64'),_0x8427('0x65'),_0x8427('0x66')],'raw':!![]});}})['then'](function(_0x4203fd){if(_0x4203fd){var _0x42c9b4=path[_0x8427('0x51')](config[_0x8427('0x52')],'server/files/sounds/converted',util['format']('%s.%s',path['basename'](_0x4203fd[_0x8427('0x64')],path[_0x8427('0x67')](_0x4203fd['save_name'])),_0x4203fd[_0x8427('0x65')]));var _0x335afb=path[_0x8427('0x51')](config[_0x8427('0x52')],_0x8427('0x53'),_0x38549c['name'],util[_0x8427('0x68')]('%s.%s',_0x4203fd[_0x8427('0x29')],_0x4203fd[_0x8427('0x65')]));fs[_0x8427('0x69')](_0x42c9b4,_0x335afb);return _0x4203fd;}})[_0x8427('0x43')](function(_0xc81516){throw new db[(_0x8427('0x5f'))][(_0x8427('0x60'))](_0xc81516[_0x8427('0x6a')]);});})[_0x8427('0x21')](handleEntityNotFound(_0x492105,null))[_0x8427('0x21')](respondWithResult(_0x492105,0xc9))['catch'](handleError(_0x492105,null));};exports['removeSound']=function(_0x19618f,_0x51bce2,_0x12dee8){return db['sequelize'][_0x8427('0x4e')](function(_0x4e47c8){var _0x564d08;return db[_0x8427('0x2d')][_0x8427('0x63')]({'where':{'id':_0x19618f[_0x8427('0x45')]['id']}})[_0x8427('0x21')](handleEntityNotFound(_0x51bce2,null))[_0x8427('0x21')](function(_0x39f145){if(_0x39f145){_0x564d08=_0x39f145;return _0x39f145[_0x8427('0x6b')](_0x19618f[_0x8427('0x45')][_0x8427('0x6c')]);}})[_0x8427('0x21')](function(_0x3c59e5){if(_0x3c59e5){return db[_0x8427('0x62')][_0x8427('0x63')]({'where':{'id':_0x19618f['params']['id2']},'attributes':['id',_0x8427('0x29'),_0x8427('0x64'),'converted_format',_0x8427('0x66')],'raw':!![]});}})['then'](function(_0x51a7c7){if(_0x51a7c7){fs['unlinkSync'](path[_0x8427('0x51')](_0x564d08[_0x8427('0x55')],util['format'](_0x8427('0x6d'),_0x51a7c7['name'],_0x51a7c7[_0x8427('0x65')])));return _0x51a7c7;}})[_0x8427('0x43')](function(_0xdc7257){throw new db[(_0x8427('0x5f'))][(_0x8427('0x60'))](_0xdc7257[_0x8427('0x6a')]);});})[_0x8427('0x21')](handleEntityNotFound(_0x51bce2,null))['then'](respondWithStatusCode(_0x51bce2,0xcc))['catch'](handleError(_0x51bce2,null));};exports[_0x8427('0x6e')]=function(_0x3f790e,_0x23cf9f,_0x478594){var _0x4cceca={};var _0x233b0f={};var _0x2caad3;var _0x1ed9b8;return db[_0x8427('0x2d')][_0x8427('0x63')]({'where':{'id':_0x3f790e[_0x8427('0x45')]['id']}})[_0x8427('0x21')](handleEntityNotFound(_0x23cf9f,null))[_0x8427('0x21')](function(_0x5a8ce6){if(_0x5a8ce6){_0x2caad3=_0x5a8ce6;_0x233b0f[_0x8427('0x32')]=_[_0x8427('0x46')](db['Sound'][_0x8427('0x47')]);_0x233b0f[_0x8427('0x35')]=_[_0x8427('0x46')](_0x3f790e[_0x8427('0x35')]);_0x233b0f[_0x8427('0x3c')]=_[_0x8427('0x31')](_0x233b0f[_0x8427('0x32')],_0x233b0f[_0x8427('0x35')]);_0x4cceca[_0x8427('0x33')]=_[_0x8427('0x31')](_0x233b0f[_0x8427('0x32')],qs[_0x8427('0x34')](_0x3f790e[_0x8427('0x35')][_0x8427('0x34')]));_0x4cceca[_0x8427('0x33')]=_0x4cceca[_0x8427('0x33')][_0x8427('0x36')]?_0x4cceca[_0x8427('0x33')]:_0x233b0f[_0x8427('0x32')];_0x4cceca[_0x8427('0x39')]=qs[_0x8427('0x3a')](_0x3f790e[_0x8427('0x35')][_0x8427('0x3a')]);_0x4cceca[_0x8427('0x6f')]=qs[_0x8427('0x3c')](_[_0x8427('0x3b')](_0x3f790e[_0x8427('0x35')],_0x233b0f[_0x8427('0x3c')]));if(_0x3f790e[_0x8427('0x35')][_0x8427('0x3f')]){_0x4cceca['where']=_[_0x8427('0x3d')](_0x4cceca['where'],{'$or':_[_0x8427('0x2c')](_0x4cceca[_0x8427('0x33')],function(_0x3684ca){var _0x53225c={};_0x53225c[_0x3684ca]={'$like':'%'+_0x3f790e[_0x8427('0x35')][_0x8427('0x3f')]+'%'};return _0x53225c;})});}_0x4cceca=_['merge']({},_0x4cceca,_0x3f790e[_0x8427('0x40')]);return _0x2caad3[_0x8427('0x6e')](_0x4cceca);}})[_0x8427('0x21')](function(_0x34a531){if(_0x34a531){_0x1ed9b8=_0x34a531[_0x8427('0x36')];if(!_0x3f790e[_0x8427('0x35')]['hasOwnProperty'](_0x8427('0x38'))){_0x4cceca[_0x8427('0x1c')]=qs[_0x8427('0x1c')](_0x3f790e[_0x8427('0x35')][_0x8427('0x1c')]);_0x4cceca['offset']=qs[_0x8427('0x1b')](_0x3f790e[_0x8427('0x35')]['offset']);}return _0x2caad3['getSounds'](_0x4cceca);}})['then'](function(_0x28199d){if(_0x28199d){return _0x28199d?{'count':_0x1ed9b8,'rows':_0x28199d}:null;}})[_0x8427('0x21')](respondWithResult(_0x23cf9f,null))['catch'](handleError(_0x23cf9f,null));}; \ No newline at end of file +var _0xd9e0=['UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','join','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','removeSound','id2','unlinkSync','getSounds','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','transaction','mode','directory','root','server/files/moh','files','mkdirSync','0777','user','role'];(function(_0x4a720e,_0x935be0){var _0x54f945=function(_0x268f44){while(--_0x268f44){_0x4a720e['push'](_0x4a720e['shift']());}};_0x54f945(++_0x935be0);}(_0xd9e0,0xfa));var _0x0d9e=function(_0x39c48b,_0x7db13b){_0x39c48b=_0x39c48b-0x0;var _0x2dbb34=_0xd9e0[_0x39c48b];return _0x2dbb34;};'use strict';var pdf=require(_0x0d9e('0x0'));var emlformat=require(_0x0d9e('0x1'));var rimraf=require(_0x0d9e('0x2'));var zipdir=require(_0x0d9e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d9e('0x4'));var moment=require(_0x0d9e('0x5'));var BPromise=require(_0x0d9e('0x6'));var Mustache=require(_0x0d9e('0x7'));var util=require(_0x0d9e('0x8'));var path=require('path');var sox=require(_0x0d9e('0x9'));var csv=require(_0x0d9e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d9e('0xb'));var squel=require(_0x0d9e('0xc'));var crypto=require(_0x0d9e('0xd'));var jsforce=require(_0x0d9e('0xe'));var deskjs=require(_0x0d9e('0xf'));var toCsv=require(_0x0d9e('0xa'));var querystring=require(_0x0d9e('0x10'));var Papa=require('papaparse');var Redis=require(_0x0d9e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0d9e('0x12'));var hardwareService=require(_0x0d9e('0x13'));var logger=require(_0x0d9e('0x14'))(_0x0d9e('0x15'));var utils=require(_0x0d9e('0x16'));var config=require(_0x0d9e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d9e('0x18'))['db'];function respondWithStatusCode(_0x3c03e1,_0x13fabd){_0x13fabd=_0x13fabd||0xcc;return function(_0x20086a){if(_0x20086a){return _0x3c03e1[_0x0d9e('0x19')](_0x13fabd);}return _0x3c03e1[_0x0d9e('0x1a')](_0x13fabd)[_0x0d9e('0x1b')]();};}function respondWithResult(_0x3f5dd9,_0x46cc1d){_0x46cc1d=_0x46cc1d||0xc8;return function(_0x4ac741){if(_0x4ac741){return _0x3f5dd9[_0x0d9e('0x1a')](_0x46cc1d)['json'](_0x4ac741);}};}function respondWithFilteredResult(_0x57a7d6,_0x46ff07){return function(_0x36ade0){if(_0x36ade0){var _0x3e68b6=_0x36ade0[_0x0d9e('0x1c')],_0x4bb709=_0x46ff07[_0x0d9e('0x1d')],_0x59ffe8=_0x46ff07[_0x0d9e('0x1d')]+_0x46ff07[_0x0d9e('0x1e')],_0xacd96a;if(_0x59ffe8>=_0x3e68b6){_0x59ffe8=_0x3e68b6;_0xacd96a=0xc8;}else{_0xacd96a=0xce;}_0x57a7d6['status'](_0xacd96a);return _0x57a7d6[_0x0d9e('0x1f')](_0x0d9e('0x20'),_0x4bb709+'-'+_0x59ffe8+'/'+_0x3e68b6)[_0x0d9e('0x21')](_0x36ade0);}return null;};}function patchUpdates(_0x56b8c7){return function(_0x3b3f32){try{jsonpatch['apply'](_0x3b3f32,_0x56b8c7,!![]);}catch(_0x120e1f){return BPromise[_0x0d9e('0x22')](_0x120e1f);}return _0x3b3f32[_0x0d9e('0x23')]();};}function saveUpdates(_0x2fb675,_0x2a0616){return function(_0x34f3b6){if(_0x34f3b6){return _0x34f3b6[_0x0d9e('0x24')](_0x2fb675)[_0x0d9e('0x25')](function(_0x2b39b9){return _0x2b39b9;});}return null;};}function removeEntity(_0x5d5a49,_0x483e02){return function(_0x448a00){if(_0x448a00){return _0x448a00['destroy']()[_0x0d9e('0x25')](function(){var _0x1f2a46=_0x448a00[_0x0d9e('0x26')]({'plain':!![]});var _0x56473d=_0x0d9e('0x27');return db[_0x0d9e('0x28')][_0x0d9e('0x29')]({'where':{'type':_0x56473d,'resourceId':_0x1f2a46['id']}})[_0x0d9e('0x25')](function(){return _0x448a00;});})['then'](function(){_0x5d5a49[_0x0d9e('0x1a')](0xcc)[_0x0d9e('0x1b')]();});}};}function handleEntityNotFound(_0x57b01d,_0x7711a1){return function(_0x5b0480){if(!_0x5b0480){_0x57b01d[_0x0d9e('0x19')](0x194);}return _0x5b0480;};}function handleError(_0x38768a,_0x179a10){_0x179a10=_0x179a10||0x1f4;return function(_0x16dd49){logger['error'](_0x16dd49[_0x0d9e('0x2a')]);if(_0x16dd49[_0x0d9e('0x2b')]){delete _0x16dd49[_0x0d9e('0x2b')];}_0x38768a[_0x0d9e('0x1a')](_0x179a10)[_0x0d9e('0x2c')](_0x16dd49);};}exports['index']=function(_0x34b103,_0x33a7f0){var _0x1678d5={},_0x324993={},_0x402b2f={'count':0x0,'rows':[]};var _0x103b10=_[_0x0d9e('0x2d')](db[_0x0d9e('0x2e')][_0x0d9e('0x2f')],function(_0x4f1401){return{'name':_0x4f1401[_0x0d9e('0x30')],'type':_0x4f1401[_0x0d9e('0x31')][_0x0d9e('0x32')]};});_0x324993[_0x0d9e('0x33')]=_[_0x0d9e('0x2d')](_0x103b10,_0x0d9e('0x2b'));_0x324993[_0x0d9e('0x34')]=_[_0x0d9e('0x35')](_0x34b103[_0x0d9e('0x34')]);_0x324993[_0x0d9e('0x36')]=_[_0x0d9e('0x37')](_0x324993[_0x0d9e('0x33')],_0x324993[_0x0d9e('0x34')]);_0x1678d5['attributes']=_[_0x0d9e('0x37')](_0x324993[_0x0d9e('0x33')],qs['fields'](_0x34b103['query'][_0x0d9e('0x38')]));_0x1678d5['attributes']=_0x1678d5[_0x0d9e('0x39')][_0x0d9e('0x3a')]?_0x1678d5[_0x0d9e('0x39')]:_0x324993[_0x0d9e('0x33')];if(!_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x3b')](_0x0d9e('0x3c'))){_0x1678d5[_0x0d9e('0x1e')]=qs['limit'](_0x34b103[_0x0d9e('0x34')]['limit']);_0x1678d5[_0x0d9e('0x1d')]=qs[_0x0d9e('0x1d')](_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x1d')]);}_0x1678d5[_0x0d9e('0x3d')]=qs[_0x0d9e('0x3e')](_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x3e')]);_0x1678d5[_0x0d9e('0x3f')]=qs[_0x0d9e('0x36')](_[_0x0d9e('0x40')](_0x34b103[_0x0d9e('0x34')],_0x324993[_0x0d9e('0x36')]),_0x103b10);if(_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x41')]){_0x1678d5[_0x0d9e('0x3f')]=_[_0x0d9e('0x42')](_0x1678d5[_0x0d9e('0x3f')],{'$or':_[_0x0d9e('0x2d')](_0x103b10,function(_0x3c9908){if(_0x3c9908[_0x0d9e('0x31')]!=='VIRTUAL'){var _0x2ffbc5={};_0x2ffbc5[_0x3c9908[_0x0d9e('0x2b')]]={'$like':'%'+_0x34b103[_0x0d9e('0x34')]['filter']+'%'};return _0x2ffbc5;}})});}_0x1678d5=_['merge']({},_0x1678d5,_0x34b103[_0x0d9e('0x43')]);var _0x22422f={'where':_0x1678d5[_0x0d9e('0x3f')]};return db[_0x0d9e('0x2e')][_0x0d9e('0x1c')](_0x22422f)['then'](function(_0xd577ba){_0x402b2f[_0x0d9e('0x1c')]=_0xd577ba;if(_0x34b103[_0x0d9e('0x34')][_0x0d9e('0x44')]){_0x1678d5[_0x0d9e('0x45')]=[{'all':!![]}];}return db[_0x0d9e('0x2e')][_0x0d9e('0x46')](_0x1678d5);})[_0x0d9e('0x25')](function(_0x343ff1){_0x402b2f[_0x0d9e('0x47')]=_0x343ff1;return _0x402b2f;})['then'](respondWithFilteredResult(_0x33a7f0,_0x1678d5))[_0x0d9e('0x48')](handleError(_0x33a7f0,null));};exports[_0x0d9e('0x49')]=function(_0xb9a0b3,_0x53ee9d){var _0x457c3b={'raw':![],'where':{'id':_0xb9a0b3[_0x0d9e('0x4a')]['id']}},_0x762434={};_0x762434[_0x0d9e('0x33')]=_[_0x0d9e('0x35')](db[_0x0d9e('0x2e')][_0x0d9e('0x2f')]);_0x762434[_0x0d9e('0x34')]=_[_0x0d9e('0x35')](_0xb9a0b3[_0x0d9e('0x34')]);_0x762434[_0x0d9e('0x36')]=_[_0x0d9e('0x37')](_0x762434[_0x0d9e('0x33')],_0x762434['query']);_0x457c3b['attributes']=_[_0x0d9e('0x37')](_0x762434[_0x0d9e('0x33')],qs['fields'](_0xb9a0b3[_0x0d9e('0x34')][_0x0d9e('0x38')]));_0x457c3b[_0x0d9e('0x39')]=_0x457c3b[_0x0d9e('0x39')][_0x0d9e('0x3a')]?_0x457c3b[_0x0d9e('0x39')]:_0x762434[_0x0d9e('0x33')];if(_0xb9a0b3[_0x0d9e('0x34')]['includeAll']){_0x457c3b[_0x0d9e('0x45')]=[{'all':!![]}];}_0x457c3b=_[_0x0d9e('0x42')]({},_0x457c3b,_0xb9a0b3['options']);return db[_0x0d9e('0x2e')]['find'](_0x457c3b)[_0x0d9e('0x25')](handleEntityNotFound(_0x53ee9d,null))[_0x0d9e('0x25')](respondWithResult(_0x53ee9d,null))[_0x0d9e('0x48')](handleError(_0x53ee9d,null));};exports[_0x0d9e('0x24')]=function(_0x590aa3,_0x784187){if(_0x590aa3[_0x0d9e('0x4b')]['id']){delete _0x590aa3[_0x0d9e('0x4b')]['id'];}return db[_0x0d9e('0x2e')][_0x0d9e('0x4c')]({'where':{'id':_0x590aa3[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](handleEntityNotFound(_0x784187,null))[_0x0d9e('0x25')](saveUpdates(_0x590aa3[_0x0d9e('0x4b')],null))[_0x0d9e('0x25')](respondWithResult(_0x784187,null))[_0x0d9e('0x48')](handleError(_0x784187,null));};exports[_0x0d9e('0x4d')]=function(_0x47105d,_0x4084a8,_0x12230b){return db[_0x0d9e('0x4e')][_0x0d9e('0x4f')](function(_0x109385){if(_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x50')]==='files'){_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x51')]=path['join'](config[_0x0d9e('0x52')],_0x0d9e('0x53'),_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x2b')]);}return db[_0x0d9e('0x2e')][_0x0d9e('0x4d')](_0x47105d[_0x0d9e('0x4b')],{'transaction':_0x109385})[_0x0d9e('0x25')](function(_0x28c7ee){if(_0x47105d[_0x0d9e('0x4b')][_0x0d9e('0x50')]===_0x0d9e('0x54')){fs[_0x0d9e('0x55')](_0x28c7ee[_0x0d9e('0x51')],parseInt(_0x0d9e('0x56'),0x8));}var _0x87de99=_0x47105d[_0x0d9e('0x57')][_0x0d9e('0x26')]({'plain':!![]});if(!_0x87de99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x87de99[_0x0d9e('0x58')]===_0x0d9e('0x57')){var _0x2ffb22=_0x28c7ee[_0x0d9e('0x26')]({'plain':!![]});return db[_0x0d9e('0x59')][_0x0d9e('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x87de99['userProfileId']},'raw':!![]})[_0x0d9e('0x25')](function(_0x139760){if(_0x139760&&_0x139760['autoAssociation']===0x0){return db['UserProfileResource'][_0x0d9e('0x4d')]({'name':_0x2ffb22['name'],'resourceId':_0x2ffb22['id'],'type':_0x139760['name'],'sectionId':_0x139760['id']},{})[_0x0d9e('0x25')](function(){return _0x28c7ee;});}else{return _0x28c7ee;}})['catch'](function(_0x3e7606){logger[_0x0d9e('0x5a')](_0x0d9e('0x5b'),_0x3e7606);});}return _0x28c7ee;});})['then'](respondWithResult(_0x4084a8,0xc9))[_0x0d9e('0x48')](handleError(_0x4084a8,null));};exports[_0x0d9e('0x29')]=function(_0x430556,_0x414744,_0x5e2163){var _0x41024d;return db[_0x0d9e('0x2e')][_0x0d9e('0x4c')]({'where':{'id':_0x430556[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](function(_0xc58ab6){if(_0xc58ab6){return db[_0x0d9e('0x4e')][_0x0d9e('0x4f')](function(_0x409e4f){return _0xc58ab6[_0x0d9e('0x29')]({'transaction':_0x409e4f,'raw':!![]})[_0x0d9e('0x25')](function(_0x319db2){if(_0x319db2[_0x0d9e('0x51')]){fs['readdirSync'](_0x319db2[_0x0d9e('0x51')])['forEach'](function(_0x2e6dd1){fs['unlinkSync'](path['join'](_0x319db2['directory'],_0x2e6dd1));});fs[_0x0d9e('0x5c')](_0x319db2[_0x0d9e('0x51')]);}return _0x319db2;});})['catch'](function(_0x5a76a6){throw new db[(_0x0d9e('0x5d'))][(_0x0d9e('0x5e'))](_0x5a76a6[_0x0d9e('0x5f')]);});}})[_0x0d9e('0x25')](handleEntityNotFound(_0x414744,null))[_0x0d9e('0x25')](removeEntity(_0x414744,null))['catch'](handleError(_0x414744,null));};exports[_0x0d9e('0x60')]=function(_0x356d62,_0x297b98,_0x9a94d6){return db[_0x0d9e('0x4e')][_0x0d9e('0x4f')](function(_0x2037ce){var _0x16c4d5;return db[_0x0d9e('0x2e')]['find']({'where':{'id':_0x356d62[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](function(_0x1d8e3f){if(_0x1d8e3f){_0x16c4d5=_0x1d8e3f;return _0x1d8e3f[_0x0d9e('0x60')](_0x356d62[_0x0d9e('0x4b')]['id'],{'transaction':_0x2037ce});}})[_0x0d9e('0x25')](function(_0x4dabfe){if(_0x4dabfe){return db[_0x0d9e('0x61')][_0x0d9e('0x62')]({'where':{'id':_0x356d62[_0x0d9e('0x4b')]['id']},'attributes':['id',_0x0d9e('0x2b'),_0x0d9e('0x63'),_0x0d9e('0x64'),_0x0d9e('0x65')],'raw':!![]});}})[_0x0d9e('0x25')](function(_0x30c8a0){if(_0x30c8a0){var _0x10b54a=path[_0x0d9e('0x66')](config[_0x0d9e('0x52')],_0x0d9e('0x67'),util[_0x0d9e('0x68')]('%s.%s',path[_0x0d9e('0x69')](_0x30c8a0[_0x0d9e('0x63')],path[_0x0d9e('0x6a')](_0x30c8a0['save_name'])),_0x30c8a0[_0x0d9e('0x64')]));var _0x59dfa9=path[_0x0d9e('0x66')](config[_0x0d9e('0x52')],_0x0d9e('0x53'),_0x16c4d5[_0x0d9e('0x2b')],util[_0x0d9e('0x68')](_0x0d9e('0x6b'),_0x30c8a0[_0x0d9e('0x2b')],_0x30c8a0[_0x0d9e('0x64')]));fs[_0x0d9e('0x6c')](_0x10b54a,_0x59dfa9);return _0x30c8a0;}})[_0x0d9e('0x48')](function(_0x491a4b){throw new db[(_0x0d9e('0x5d'))][(_0x0d9e('0x5e'))](_0x491a4b['message']);});})['then'](handleEntityNotFound(_0x297b98,null))[_0x0d9e('0x25')](respondWithResult(_0x297b98,0xc9))[_0x0d9e('0x48')](handleError(_0x297b98,null));};exports[_0x0d9e('0x6d')]=function(_0x11c33b,_0x3e5954,_0x2a55a5){return db['sequelize']['transaction'](function(_0x117abe){var _0x4eb8e2;return db['VoiceMusicOnHold'][_0x0d9e('0x62')]({'where':{'id':_0x11c33b[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](handleEntityNotFound(_0x3e5954,null))[_0x0d9e('0x25')](function(_0x3a15b2){if(_0x3a15b2){_0x4eb8e2=_0x3a15b2;return _0x3a15b2[_0x0d9e('0x6d')](_0x11c33b[_0x0d9e('0x4a')][_0x0d9e('0x6e')]);}})[_0x0d9e('0x25')](function(_0x3f7bb5){if(_0x3f7bb5){return db['Sound']['findOne']({'where':{'id':_0x11c33b[_0x0d9e('0x4a')][_0x0d9e('0x6e')]},'attributes':['id','name',_0x0d9e('0x63'),'converted_format',_0x0d9e('0x65')],'raw':!![]});}})[_0x0d9e('0x25')](function(_0x1ab7b5){if(_0x1ab7b5){fs[_0x0d9e('0x6f')](path['join'](_0x4eb8e2['directory'],util['format'](_0x0d9e('0x6b'),_0x1ab7b5[_0x0d9e('0x2b')],_0x1ab7b5[_0x0d9e('0x64')])));return _0x1ab7b5;}})[_0x0d9e('0x48')](function(_0x1f4963){throw new db[(_0x0d9e('0x5d'))]['ValidationError'](_0x1f4963['message']);});})['then'](handleEntityNotFound(_0x3e5954,null))['then'](respondWithStatusCode(_0x3e5954,0xcc))['catch'](handleError(_0x3e5954,null));};exports[_0x0d9e('0x70')]=function(_0x554a23,_0x3cec93,_0x304ce3){var _0x32d8c0={};var _0x2fcd54={};var _0x9ad5a5;var _0x511ff8;return db[_0x0d9e('0x2e')][_0x0d9e('0x62')]({'where':{'id':_0x554a23[_0x0d9e('0x4a')]['id']}})[_0x0d9e('0x25')](handleEntityNotFound(_0x3cec93,null))['then'](function(_0x2a5f51){if(_0x2a5f51){_0x9ad5a5=_0x2a5f51;_0x2fcd54[_0x0d9e('0x33')]=_[_0x0d9e('0x35')](db[_0x0d9e('0x61')][_0x0d9e('0x2f')]);_0x2fcd54['query']=_[_0x0d9e('0x35')](_0x554a23[_0x0d9e('0x34')]);_0x2fcd54[_0x0d9e('0x36')]=_[_0x0d9e('0x37')](_0x2fcd54[_0x0d9e('0x33')],_0x2fcd54[_0x0d9e('0x34')]);_0x32d8c0[_0x0d9e('0x39')]=_[_0x0d9e('0x37')](_0x2fcd54[_0x0d9e('0x33')],qs[_0x0d9e('0x38')](_0x554a23[_0x0d9e('0x34')]['fields']));_0x32d8c0[_0x0d9e('0x39')]=_0x32d8c0[_0x0d9e('0x39')]['length']?_0x32d8c0[_0x0d9e('0x39')]:_0x2fcd54[_0x0d9e('0x33')];_0x32d8c0[_0x0d9e('0x3d')]=qs['sort'](_0x554a23[_0x0d9e('0x34')][_0x0d9e('0x3e')]);_0x32d8c0[_0x0d9e('0x3f')]=qs[_0x0d9e('0x36')](_[_0x0d9e('0x40')](_0x554a23['query'],_0x2fcd54[_0x0d9e('0x36')]));if(_0x554a23[_0x0d9e('0x34')][_0x0d9e('0x41')]){_0x32d8c0[_0x0d9e('0x3f')]=_[_0x0d9e('0x42')](_0x32d8c0['where'],{'$or':_[_0x0d9e('0x2d')](_0x32d8c0[_0x0d9e('0x39')],function(_0x49b095){var _0x3ffcd4={};_0x3ffcd4[_0x49b095]={'$like':'%'+_0x554a23['query'][_0x0d9e('0x41')]+'%'};return _0x3ffcd4;})});}_0x32d8c0=_[_0x0d9e('0x42')]({},_0x32d8c0,_0x554a23[_0x0d9e('0x43')]);return _0x9ad5a5[_0x0d9e('0x70')](_0x32d8c0);}})[_0x0d9e('0x25')](function(_0x382812){if(_0x382812){_0x511ff8=_0x382812[_0x0d9e('0x3a')];if(!_0x554a23[_0x0d9e('0x34')][_0x0d9e('0x3b')](_0x0d9e('0x3c'))){_0x32d8c0[_0x0d9e('0x1e')]=qs[_0x0d9e('0x1e')](_0x554a23['query']['limit']);_0x32d8c0[_0x0d9e('0x1d')]=qs[_0x0d9e('0x1d')](_0x554a23[_0x0d9e('0x34')]['offset']);}return _0x9ad5a5[_0x0d9e('0x70')](_0x32d8c0);}})[_0x0d9e('0x25')](function(_0x392501){if(_0x392501){return _0x392501?{'count':_0x511ff8,'rows':_0x392501}:null;}})['then'](respondWithResult(_0x3cec93,null))['catch'](handleError(_0x3cec93,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ab86b11..5f573d7 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 _0x994b=['exports','define','voice_musiconhold','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x994b,0x81));var _0xb994=function(_0x321e39,_0x2f99c8){_0x321e39=_0x321e39-0x0;var _0x2e5be2=_0x994b[_0x321e39];return _0x2e5be2;};'use strict';var _=require('lodash');var util=require(_0xb994('0x0'));var logger=require(_0xb994('0x1'))(_0xb994('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb994('0x3'));var rimraf=require(_0xb994('0x4'));var config=require(_0xb994('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xb994('0x6')]=function(_0x50cbbc,_0x22ca61){return _0x50cbbc[_0xb994('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0xb994('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cdc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7cdc,0x138));var _0xc7cd=function(_0x51de61,_0x3d76fe){_0x51de61=_0x51de61-0x0;var _0x519381=_0x7cdc[_0x51de61];return _0x519381;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var logger=require(_0xc7cd('0x1'))(_0xc7cd('0x2'));var moment=require(_0xc7cd('0x3'));var BPromise=require(_0xc7cd('0x4'));var rp=require(_0xc7cd('0x5'));var fs=require('fs');var path=require(_0xc7cd('0x6'));var rimraf=require(_0xc7cd('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7cd('0x8'));module['exports']=function(_0x48eac5,_0x1af0fd){return _0x48eac5[_0xc7cd('0x9')](_0xc7cd('0xa'),attributes,{'tableName':_0xc7cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 8b34666..f6eee00 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 _0x6a3f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x6a3f,0x1cb));var _0xf6a3=function(_0x47cb8c,_0xd2b94){_0x47cb8c=_0x47cb8c-0x0;var _0x1d0207=_0x6a3f[_0x47cb8c];return _0x1d0207;};'use strict';var _=require(_0xf6a3('0x0'));var util=require(_0xf6a3('0x1'));var moment=require('moment');var BPromise=require(_0xf6a3('0x2'));var rs=require(_0xf6a3('0x3'));var fs=require('fs');var Redis=require(_0xf6a3('0x4'));var db=require(_0xf6a3('0x5'))['db'];var utils=require(_0xf6a3('0x6'));var logger=require(_0xf6a3('0x7'))(_0xf6a3('0x8'));var config=require(_0xf6a3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fb2fa,_0x3d2b10,_0x4676cc){return new BPromise(function(_0x5d6dc1,_0x49930a){return client[_0xf6a3('0xb')](_0x1fb2fa,_0x4676cc)[_0xf6a3('0xc')](function(_0x2ca331){logger[_0xf6a3('0xd')](_0xf6a3('0xe'),_0x3d2b10,_0xf6a3('0xf'));logger[_0xf6a3('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x3d2b10,_0xf6a3('0xf'),JSON['stringify'](_0x2ca331));if(_0x2ca331[_0xf6a3('0x11')]){if(_0x2ca331[_0xf6a3('0x11')][_0xf6a3('0x12')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3d2b10,_0x2ca331[_0xf6a3('0x11')]['message']);return _0x49930a(_0x2ca331[_0xf6a3('0x11')]['message']);}logger[_0xf6a3('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3d2b10,_0x2ca331[_0xf6a3('0x11')][_0xf6a3('0x13')]);return _0x5d6dc1(_0x2ca331['error'][_0xf6a3('0x13')]);}else{logger[_0xf6a3('0xd')](_0xf6a3('0xe'),_0x3d2b10,_0xf6a3('0xf'));_0x5d6dc1(_0x2ca331['result'][_0xf6a3('0x13')]);}})[_0xf6a3('0x14')](function(_0x4392c2){logger[_0xf6a3('0x11')](_0xf6a3('0xe'),_0x3d2b10,_0x4392c2);_0x49930a(_0x4392c2);});});} \ No newline at end of file +var _0x06cd=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0xeeb409,_0x47b3e8){var _0x10a59a=function(_0x3a80ef){while(--_0x3a80ef){_0xeeb409['push'](_0xeeb409['shift']());}};_0x10a59a(++_0x47b3e8);}(_0x06cd,0xde));var _0xd06c=function(_0x28c091,_0x136b63){_0x28c091=_0x28c091-0x0;var _0x3ed9ab=_0x06cd[_0x28c091];return _0x3ed9ab;};'use strict';var _=require(_0xd06c('0x0'));var util=require('util');var moment=require(_0xd06c('0x1'));var BPromise=require(_0xd06c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd06c('0x3'));var db=require(_0xd06c('0x4'))['db'];var utils=require(_0xd06c('0x5'));var logger=require(_0xd06c('0x6'))('rpc');var config=require(_0xd06c('0x7'));var jayson=require(_0xd06c('0x8'));var client=jayson[_0xd06c('0x9')][_0xd06c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47c4bd,_0x1b20f5,_0x419f78){return new BPromise(function(_0x31dd41,_0x9d6c57){return client[_0xd06c('0xb')](_0x47c4bd,_0x419f78)[_0xd06c('0xc')](function(_0x3d1e5b){logger['info'](_0xd06c('0xd'),_0x1b20f5,_0xd06c('0xe'));logger[_0xd06c('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x1b20f5,_0xd06c('0xe'),JSON[_0xd06c('0x10')](_0x3d1e5b));if(_0x3d1e5b['error']){if(_0x3d1e5b[_0xd06c('0x11')]['code']===0x1f4){logger[_0xd06c('0x11')](_0xd06c('0xd'),_0x1b20f5,_0x3d1e5b['error'][_0xd06c('0x12')]);return _0x9d6c57(_0x3d1e5b[_0xd06c('0x11')][_0xd06c('0x12')]);}logger[_0xd06c('0x11')](_0xd06c('0xd'),_0x1b20f5,_0x3d1e5b['error'][_0xd06c('0x12')]);return _0x31dd41(_0x3d1e5b['error'][_0xd06c('0x12')]);}else{logger[_0xd06c('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1b20f5,_0xd06c('0xe'));_0x31dd41(_0x3d1e5b[_0xd06c('0x14')]['message']);}})[_0xd06c('0x15')](function(_0x57c22a){logger[_0xd06c('0x11')](_0xd06c('0xd'),_0x1b20f5,_0x57c22a);_0x9d6c57(_0x57c22a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 66b882b..3ec7839 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 _0xc755=['describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','delete','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc755,0x182));var _0x5c75=function(_0x566901,_0x4ae7f9){_0x566901=_0x566901-0x0;var _0x264942=_0xc755[_0x566901];return _0x264942;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5c75('0x0'));var express=require(_0x5c75('0x1'));var router=express[_0x5c75('0x2')]();var auth=require(_0x5c75('0x3'));var interaction=require(_0x5c75('0x4'));var config=require(_0x5c75('0x5'));var controller=require(_0x5c75('0x6'));router[_0x5c75('0x7')]('/',auth[_0x5c75('0x8')](),controller['index']);router[_0x5c75('0x7')](_0x5c75('0x9'),auth[_0x5c75('0x8')](),controller[_0x5c75('0xa')]);router[_0x5c75('0x7')](_0x5c75('0xb'),auth['isAuthenticated'](),controller[_0x5c75('0xc')]);router[_0x5c75('0x7')](_0x5c75('0xd'),auth[_0x5c75('0x8')](),controller[_0x5c75('0xe')]);router[_0x5c75('0xf')]('/',auth[_0x5c75('0x8')](),controller[_0x5c75('0x10')]);router[_0x5c75('0xf')](_0x5c75('0xd'),auth[_0x5c75('0x8')](),controller[_0x5c75('0x11')]);router[_0x5c75('0x12')](_0x5c75('0xb'),auth[_0x5c75('0x8')](),controller['update']);router[_0x5c75('0x13')](_0x5c75('0xb'),auth[_0x5c75('0x8')](),controller['destroy']);router[_0x5c75('0x13')](_0x5c75('0xd'),auth['isAuthenticated'](),controller[_0x5c75('0x14')]);module[_0x5c75('0x15')]=router; \ No newline at end of file +var _0xedba=['destroy','delete','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','post','addAgents','put'];(function(_0x57a122,_0x5d6cc3){var _0xc3922b=function(_0x3869a9){while(--_0x3869a9){_0x57a122['push'](_0x57a122['shift']());}};_0xc3922b(++_0x5d6cc3);}(_0xedba,0x1bd));var _0xaedb=function(_0x51110c,_0x2ae398){_0x51110c=_0x51110c-0x0;var _0x4abf50=_0xedba[_0x51110c];return _0x4abf50;};'use strict';var multer=require(_0xaedb('0x0'));var util=require(_0xaedb('0x1'));var path=require('path');var timeout=require(_0xaedb('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xaedb('0x3'));var interaction=require(_0xaedb('0x4'));var config=require('../../config/environment');var controller=require(_0xaedb('0x5'));router[_0xaedb('0x6')]('/',auth[_0xaedb('0x7')](),controller[_0xaedb('0x8')]);router[_0xaedb('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xaedb('0x9')]);router[_0xaedb('0x6')](_0xaedb('0xa'),auth[_0xaedb('0x7')](),controller[_0xaedb('0xb')]);router['get'](_0xaedb('0xc'),auth[_0xaedb('0x7')](),controller[_0xaedb('0xd')]);router[_0xaedb('0xe')]('/',auth[_0xaedb('0x7')](),controller['create']);router[_0xaedb('0xe')]('/:id/users',auth[_0xaedb('0x7')](),controller[_0xaedb('0xf')]);router[_0xaedb('0x10')]('/:id',auth[_0xaedb('0x7')](),controller['update']);router['delete'](_0xaedb('0xa'),auth[_0xaedb('0x7')](),controller[_0xaedb('0x11')]);router[_0xaedb('0x12')](_0xaedb('0xc'),auth[_0xaedb('0x7')](),controller[_0xaedb('0x13')]);module[_0xaedb('0x14')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index dbd0fcc..89c616e 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 _0xb722=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x2f075c,_0x19b726){var _0x3615c7=function(_0xcaf9f7){while(--_0xcaf9f7){_0x2f075c['push'](_0x2f075c['shift']());}};_0x3615c7(++_0x19b726);}(_0xb722,0x191));var _0x2b72=function(_0x204c3e,_0x49192c){_0x204c3e=_0x204c3e-0x0;var _0x10b6e8=_0xb722[_0x204c3e];return _0x10b6e8;};'use strict';var Sequelize=require(_0x2b72('0x0'));module['exports']={'name':{'type':Sequelize[_0x2b72('0x1')],'allowNull':![],'unique':_0x2b72('0x2')},'prefix':{'type':Sequelize[_0x2b72('0x3')],'get':function(_0x2fe2c2){return _0x2b72('0x4')+this[_0x2b72('0x5')](_0x2b72('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2b72('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x2b72('0x6')]}}; \ No newline at end of file +var _0x56f7=['name','VIRTUAL','getDataValue','STRING','INTEGER','sequelize'];(function(_0x110f5e,_0x371987){var _0x58a28d=function(_0x8c8c15){while(--_0x8c8c15){_0x110f5e['push'](_0x110f5e['shift']());}};_0x58a28d(++_0x371987);}(_0x56f7,0xcb));var _0x756f=function(_0x29b4cc,_0x5b9996){_0x29b4cc=_0x29b4cc-0x0;var _0x595f88=_0x56f7[_0x29b4cc];return _0x595f88;};'use strict';var Sequelize=require(_0x756f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x756f('0x1')},'prefix':{'type':Sequelize[_0x756f('0x2')],'get':function(_0x5c6aa7){return'system-'+this[_0x756f('0x3')](_0x756f('0x1'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x756f('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x756f('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 94e53de..5cd5f29 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 _0x68fd=['findById','omit','ids','spread','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','limit','set','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','VoicePrefix','count','includeAll','include','findAll','catch','show','params','keys','merge','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','priority','appdata','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','update'];(function(_0x6bc85d,_0x4cab15){var _0x207923=function(_0x3a0a1e){while(--_0x3a0a1e){_0x6bc85d['push'](_0x6bc85d['shift']());}};_0x207923(++_0x4cab15);}(_0x68fd,0x1e9));var _0xd68f=function(_0x5904de,_0x35590a){_0x5904de=_0x5904de-0x0;var _0x3723c6=_0x68fd[_0x5904de];return _0x3723c6;};'use strict';var pdf=require(_0xd68f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd68f('0x1'));var zipdir=require(_0xd68f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd68f('0x3'));var moment=require(_0xd68f('0x4'));var BPromise=require(_0xd68f('0x5'));var Mustache=require(_0xd68f('0x6'));var util=require(_0xd68f('0x7'));var path=require(_0xd68f('0x8'));var sox=require(_0xd68f('0x9'));var csv=require(_0xd68f('0xa'));var ejs=require(_0xd68f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd68f('0xc'));var crypto=require(_0xd68f('0xd'));var jsforce=require(_0xd68f('0xe'));var deskjs=require(_0xd68f('0xf'));var toCsv=require(_0xd68f('0xa'));var querystring=require(_0xd68f('0x10'));var Papa=require(_0xd68f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd68f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd68f('0x13'));var logger=require(_0xd68f('0x14'))(_0xd68f('0x15'));var utils=require(_0xd68f('0x16'));var config=require(_0xd68f('0x17'));var licenseUtil=require(_0xd68f('0x18'));var db=require(_0xd68f('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd68f('0x1a'))(new Redis(config[_0xd68f('0x1b')]));require('./voicePrefix.socket')[_0xd68f('0x1c')](socket);function respondWithStatusCode(_0x8297c,_0x18bdae){_0x18bdae=_0x18bdae||0xcc;return function(_0x36441f){if(_0x36441f){return _0x8297c[_0xd68f('0x1d')](_0x18bdae);}return _0x8297c[_0xd68f('0x1e')](_0x18bdae)[_0xd68f('0x1f')]();};}function respondWithResult(_0x53aed0,_0x1ba1ce){_0x1ba1ce=_0x1ba1ce||0xc8;return function(_0x4946bd){if(_0x4946bd){return _0x53aed0['status'](_0x1ba1ce)[_0xd68f('0x20')](_0x4946bd);}};}function respondWithFilteredResult(_0x3115f3,_0x451450){return function(_0x3fdfbf){if(_0x3fdfbf){var _0x44e849=_0x3fdfbf['count'],_0xb01ed=_0x451450[_0xd68f('0x21')],_0xa09f23=_0x451450[_0xd68f('0x21')]+_0x451450[_0xd68f('0x22')],_0x47fdbc;if(_0xa09f23>=_0x44e849){_0xa09f23=_0x44e849;_0x47fdbc=0xc8;}else{_0x47fdbc=0xce;}_0x3115f3[_0xd68f('0x1e')](_0x47fdbc);return _0x3115f3[_0xd68f('0x23')]('Content-Range',_0xb01ed+'-'+_0xa09f23+'/'+_0x44e849)[_0xd68f('0x20')](_0x3fdfbf);}return null;};}function patchUpdates(_0x32c45d){return function(_0x3fbc0b){try{jsonpatch['apply'](_0x3fbc0b,_0x32c45d,!![]);}catch(_0x464238){return BPromise[_0xd68f('0x24')](_0x464238);}return _0x3fbc0b[_0xd68f('0x25')]();};}function saveUpdates(_0x590e04,_0x555e25){return function(_0x30b102){if(_0x30b102){return _0x30b102['update'](_0x590e04)['then'](function(_0x3cf02f){return _0x3cf02f;});}return null;};}function removeEntity(_0x1ef099,_0xde6c97){return function(_0x3f11f9){if(_0x3f11f9){return _0x3f11f9[_0xd68f('0x26')]()[_0xd68f('0x27')](function(){var _0x169dea=_0x3f11f9[_0xd68f('0x28')]({'plain':!![]});var _0xaceeb8=_0xd68f('0x29');return db[_0xd68f('0x2a')][_0xd68f('0x26')]({'where':{'type':_0xaceeb8,'resourceId':_0x169dea['id']}})[_0xd68f('0x27')](function(){return _0x3f11f9;});})['then'](function(){_0x1ef099[_0xd68f('0x1e')](0xcc)[_0xd68f('0x1f')]();});}};}function handleEntityNotFound(_0x4b1515,_0x39b64b){return function(_0x5412d7){if(!_0x5412d7){_0x4b1515['sendStatus'](0x194);}return _0x5412d7;};}function handleError(_0xcfadd4,_0x42f8d2){_0x42f8d2=_0x42f8d2||0x1f4;return function(_0x1eaebc){logger['error'](_0x1eaebc[_0xd68f('0x2b')]);if(_0x1eaebc['name']){delete _0x1eaebc[_0xd68f('0x2c')];}_0xcfadd4['status'](_0x42f8d2)[_0xd68f('0x2d')](_0x1eaebc);};}exports[_0xd68f('0x2e')]=function(_0x426ad2,_0x3827c9){var _0x38df7f={},_0x58aeda={},_0x131082={'count':0x0,'rows':[]};var _0x53b4f7=_[_0xd68f('0x2f')](db['VoicePrefix'][_0xd68f('0x30')],function(_0x2d3b04){return{'name':_0x2d3b04[_0xd68f('0x31')],'type':_0x2d3b04[_0xd68f('0x32')]['key']};});_0x58aeda[_0xd68f('0x33')]=_[_0xd68f('0x2f')](_0x53b4f7,_0xd68f('0x2c'));_0x58aeda[_0xd68f('0x34')]=_['keys'](_0x426ad2[_0xd68f('0x34')]);_0x58aeda[_0xd68f('0x35')]=_[_0xd68f('0x36')](_0x58aeda[_0xd68f('0x33')],_0x58aeda[_0xd68f('0x34')]);_0x38df7f[_0xd68f('0x37')]=_[_0xd68f('0x36')](_0x58aeda[_0xd68f('0x33')],qs['fields'](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x38')]));_0x38df7f[_0xd68f('0x37')]=_0x38df7f[_0xd68f('0x37')][_0xd68f('0x39')]?_0x38df7f[_0xd68f('0x37')]:_0x58aeda[_0xd68f('0x33')];if(!_0x426ad2[_0xd68f('0x34')]['hasOwnProperty'](_0xd68f('0x3a'))){_0x38df7f[_0xd68f('0x22')]=qs[_0xd68f('0x22')](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x22')]);_0x38df7f['offset']=qs[_0xd68f('0x21')](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x21')]);}_0x38df7f[_0xd68f('0x3b')]=qs[_0xd68f('0x3c')](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x3c')]);_0x38df7f[_0xd68f('0x3d')]=qs['filters'](_[_0xd68f('0x3e')](_0x426ad2[_0xd68f('0x34')],_0x58aeda[_0xd68f('0x35')]),_0x53b4f7);if(_0x426ad2[_0xd68f('0x34')][_0xd68f('0x3f')]){_0x38df7f[_0xd68f('0x3d')]=_['merge'](_0x38df7f[_0xd68f('0x3d')],{'$or':_[_0xd68f('0x2f')](_0x53b4f7,function(_0x1e7cac){if(_0x1e7cac[_0xd68f('0x32')]!==_0xd68f('0x40')){var _0x9768f={};_0x9768f[_0x1e7cac['name']]={'$like':'%'+_0x426ad2[_0xd68f('0x34')][_0xd68f('0x3f')]+'%'};return _0x9768f;}})});}_0x38df7f=_['merge']({},_0x38df7f,_0x426ad2[_0xd68f('0x41')]);var _0x5dcdcb={'where':_0x38df7f['where']};return db[_0xd68f('0x42')][_0xd68f('0x43')](_0x5dcdcb)['then'](function(_0x33a46f){_0x131082[_0xd68f('0x43')]=_0x33a46f;if(_0x426ad2['query'][_0xd68f('0x44')]){_0x38df7f[_0xd68f('0x45')]=[{'all':!![]}];}return db[_0xd68f('0x42')][_0xd68f('0x46')](_0x38df7f);})['then'](function(_0x4f2048){_0x131082['rows']=_0x4f2048;return _0x131082;})[_0xd68f('0x27')](respondWithFilteredResult(_0x3827c9,_0x38df7f))[_0xd68f('0x47')](handleError(_0x3827c9,null));};exports[_0xd68f('0x48')]=function(_0x61e58d,_0xa90f29){var _0x24ff95={'raw':![],'where':{'id':_0x61e58d[_0xd68f('0x49')]['id']}},_0x2f95de={};_0x2f95de[_0xd68f('0x33')]=_[_0xd68f('0x4a')](db[_0xd68f('0x42')]['rawAttributes']);_0x2f95de['query']=_[_0xd68f('0x4a')](_0x61e58d[_0xd68f('0x34')]);_0x2f95de[_0xd68f('0x35')]=_[_0xd68f('0x36')](_0x2f95de[_0xd68f('0x33')],_0x2f95de[_0xd68f('0x34')]);_0x24ff95['attributes']=_[_0xd68f('0x36')](_0x2f95de[_0xd68f('0x33')],qs[_0xd68f('0x38')](_0x61e58d[_0xd68f('0x34')][_0xd68f('0x38')]));_0x24ff95[_0xd68f('0x37')]=_0x24ff95['attributes'][_0xd68f('0x39')]?_0x24ff95[_0xd68f('0x37')]:_0x2f95de[_0xd68f('0x33')];if(_0x61e58d[_0xd68f('0x34')][_0xd68f('0x44')]){_0x24ff95[_0xd68f('0x45')]=[{'all':!![]}];}_0x24ff95=_[_0xd68f('0x4b')]({},_0x24ff95,_0x61e58d[_0xd68f('0x41')]);return db[_0xd68f('0x42')]['find'](_0x24ff95)[_0xd68f('0x27')](handleEntityNotFound(_0xa90f29,null))[_0xd68f('0x27')](respondWithResult(_0xa90f29,null))[_0xd68f('0x47')](handleError(_0xa90f29,null));};exports['destroy']=function(_0x3113bd,_0x29a399){return db[_0xd68f('0x42')][_0xd68f('0x4c')]({'where':{'id':_0x3113bd[_0xd68f('0x49')]['id']}})['then'](handleEntityNotFound(_0x29a399,null))['then'](removeEntity(_0x29a399,null))['catch'](handleError(_0x29a399,null));};exports[_0xd68f('0x4d')]=function(_0x3136d3,_0x4e4cee){return db[_0xd68f('0x42')][_0xd68f('0x4d')]()[_0xd68f('0x27')](respondWithResult(_0x4e4cee,null))[_0xd68f('0x47')](handleError(_0x4e4cee,null));};exports[_0xd68f('0x4e')]=function(_0x377a8e,_0x13071d){var _0x241008;return db[_0xd68f('0x4f')]['transaction'](function(_0x28fb40){return db[_0xd68f('0x42')][_0xd68f('0x4e')](_0x377a8e[_0xd68f('0x50')],{'transaction':_0x28fb40})[_0xd68f('0x27')](function(_0x141e97){_0x241008=_0x141e97[_0xd68f('0x28')]({'plain':!![]});return db[_0xd68f('0x51')][_0xd68f('0x4c')]({'where':{'id':_0x241008[_0xd68f('0x52')]},'raw':!![]})[_0xd68f('0x27')](function(_0x537fbd){return createVoicePrefixExtensions(_0x241008,_0x537fbd,_0x28fb40);});});})['then'](function(){var _0x31876f=_0x377a8e[_0xd68f('0x53')][_0xd68f('0x28')]({'plain':!![]});if(!_0x31876f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31876f[_0xd68f('0x54')]==='user'){var _0x2fc840=_0x241008;return db[_0xd68f('0x55')][_0xd68f('0x4c')]({'where':{'name':_0xd68f('0x29'),'userProfileId':_0x31876f[_0xd68f('0x56')]},'raw':!![]})[_0xd68f('0x27')](function(_0x30dace){if(_0x30dace&&_0x30dace[_0xd68f('0x57')]===0x0){return db['UserProfileResource'][_0xd68f('0x4e')]({'name':_0x2fc840[_0xd68f('0x2c')],'resourceId':_0x2fc840['id'],'type':_0x30dace[_0xd68f('0x2c')],'sectionId':_0x30dace['id']},{})[_0xd68f('0x27')](function(){return _0x241008;});}else{return _0x241008;}})[_0xd68f('0x47')](function(_0xa154f9){logger[_0xd68f('0x58')](_0xd68f('0x59'),_0xa154f9);throw _0xa154f9;});}return _0x241008;})[_0xd68f('0x27')](respondWithResult(_0x13071d,null))[_0xd68f('0x47')](handleError(_0x13071d,null));};function Extension(_0x59a90e,_0x368cb4,_0x5b25aa,_0x5a113d){this['context']=_0xd68f('0x5a');this['exten']=_0x59a90e;this[_0xd68f('0x5b')]=_0x5b25aa;this[_0xd68f('0x32')]='system';this[_0xd68f('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd68f('0x5d')]=_0x368cb4;this[_0xd68f('0x5e')]=_0x5a113d;}function createVoicePrefixExtensions(_0x29d8de,_0x54350d,_0x8224ec){return new BPromise(function(_0x1a19db,_0x54e085){var _0x52e615=new Extension(formatPrefixName(_0x29d8de['prefix']),0x1,_0xd68f('0x5f'),'Voice\x20Prefix');_0x52e615['VoicePrefixId']=_0x29d8de['id'];return db[_0xd68f('0x51')][_0xd68f('0x4e')](_0x52e615,{'transaction':_0x8224ec})[_0xd68f('0x27')](function(_0xa0c662){var _0xe7a0ee=_0xa0c662[_0xd68f('0x28')]({'plain':!![]});var _0x28452d=_[_0xd68f('0x2f')](addVoicePrefixExtensions(_0x29d8de,_0x54350d),function(_0x7f4345){_0x7f4345['VoiceExtensionId']=_0xe7a0ee['id'];_0x7f4345[_0xd68f('0x60')]=_0x29d8de['id'];return _0x7f4345;});return db[_0xd68f('0x51')][_0xd68f('0x61')](_0x28452d,{'transaction':_0x8224ec})[_0xd68f('0x27')](function(_0x346c10){if(!_0x346c10){return _0x54e085(_0xd68f('0x62'));}else{return _0x1a19db(_0x346c10);}})[_0xd68f('0x47')](function(_0x53c613){return _0x54e085(_0x53c613);});});;});};function addVoicePrefixExtensions(_0x260f46,_0x17c909){var _0x3f0079=[];var _0x594cff=formatPrefixName(_0x260f46[_0xd68f('0x63')]);_0x3f0079[_0xd68f('0x64')](new Extension(_0x594cff,0x2,_0xd68f('0x65'),_0xd68f('0x66')+_0x260f46[_0xd68f('0x2c')]));if(_0x260f46[_0xd68f('0x67')]){_0x3f0079[_0xd68f('0x64')](new Extension(_0x594cff,0x3,'Set',_0xd68f('0x68')+_0x260f46[_0xd68f('0x67')]));}else{_0x3f0079['push'](new Extension(_0x594cff,0x3,_0xd68f('0x5f'),_0xd68f('0x69')));}_0x3f0079[_0xd68f('0x64')](new Extension(_0x594cff,0x4,_0xd68f('0x6a'),_0x17c909[_0xd68f('0x6b')]+','+_0xd68f('0x6c')+(0x8+_0x260f46['name'][_0xd68f('0x39')])+'}'+','+0x1));return _0x3f0079;}function formatPrefixName(_0x27718c){var _0x271103='_';for(var _0x331e8c=0x0;_0x331e8c<_0x27718c[_0xd68f('0x39')];_0x331e8c++){if(_0x27718c['charAt'](_0x331e8c)=='-'){_0x271103+=_0x27718c['charAt'](_0x331e8c);}else{_0x271103+='['+_0x27718c[_0xd68f('0x6d')](_0x331e8c)+']';}}_0x271103+='.';return _0x271103;}exports[_0xd68f('0x6e')]=function(_0xe4bcae,_0x2f8777,_0x19d47a){var _0x157d54=_0xe4bcae[_0xd68f('0x50')];_0x157d54[_0xd68f('0x63')]='system-'+_0x157d54[_0xd68f('0x2c')]+'-';return db['sequelize']['transaction'](function(_0x278120){return db['VoicePrefix'][_0xd68f('0x6e')](_0x157d54,{'where':{'id':_0x157d54['id']},'transaction':_0x278120})['then'](function(){return db[_0xd68f('0x51')][_0xd68f('0x26')]({'where':{'VoicePrefixId':_0x157d54['id']},'transaction':_0x278120})[_0xd68f('0x27')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x157d54[_0xd68f('0x52')]},'raw':!![]})[_0xd68f('0x27')](function(_0x1bd8cd){return createVoicePrefixExtensions(_0x157d54,_0x1bd8cd,_0x278120);});});});})[_0xd68f('0x27')](function(){return db['VoicePrefix'][_0xd68f('0x6f')](_0x157d54['id']);})['then'](respondWithResult(_0x2f8777,null))['catch'](handleError(_0x2f8777,null));};exports['addAgents']=function(_0x445b2d,_0x352a18,_0x24d00b){return db['VoicePrefix'][_0xd68f('0x4c')]({'where':{'id':_0x445b2d[_0xd68f('0x49')]['id']}})[_0xd68f('0x27')](handleEntityNotFound(_0x352a18,null))[_0xd68f('0x27')](function(_0x12e65a){if(_0x12e65a){return _0x12e65a['addAgents'](_0x445b2d['body']['ids'],_[_0xd68f('0x70')](_0x445b2d[_0xd68f('0x50')],[_0xd68f('0x71'),'id'])||{})[_0xd68f('0x72')](function(_0x1b4f55){for(var _0x1c60d0=0x0;_0x1c60d0<_0x445b2d['body']['ids'][_0xd68f('0x39')];_0x1c60d0+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x445b2d[_0xd68f('0x50')][_0xd68f('0x71')][_0x1c60d0],'VoicePrefixId':_0x445b2d[_0xd68f('0x49')]['id']});}return _0x1b4f55;});}})[_0xd68f('0x27')](respondWithResult(_0x352a18,null))[_0xd68f('0x47')](handleError(_0x352a18,null));};exports['removeAgents']=function(_0x35f926,_0x11c7e9,_0x3aca42){return db[_0xd68f('0x42')][_0xd68f('0x4c')]({'where':{'id':_0x35f926[_0xd68f('0x49')]['id']}})[_0xd68f('0x27')](handleEntityNotFound(_0x11c7e9,null))[_0xd68f('0x27')](function(_0x43f292){if(_0x43f292){return _0x43f292[_0xd68f('0x73')](_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')])[_0xd68f('0x27')](function(){if(_[_0xd68f('0x74')](_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')])){for(var _0x33e6df=0x0;_0x33e6df<_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')][_0xd68f('0x39')];_0x33e6df+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')][_0x33e6df]),'VoicePrefixId':Number(_0x35f926[_0xd68f('0x49')]['id'])});}}else{socket['emit'](_0xd68f('0x75'),{'UserId':Number(_0x35f926['query']['ids']),'VoicePrefixId':Number(_0x35f926[_0xd68f('0x49')]['id'])});}});}})[_0xd68f('0x27')](respondWithStatusCode(_0x11c7e9,null))[_0xd68f('0x47')](handleError(_0x11c7e9,null));};exports[_0xd68f('0x76')]=function(_0x46f6fc,_0x593a59,_0x1390cc){var _0x4f7f05={};var _0x811f37={};var _0x2517f1;var _0x21e60f;return db[_0xd68f('0x42')]['findOne']({'where':{'id':_0x46f6fc[_0xd68f('0x49')]['id']}})[_0xd68f('0x27')](handleEntityNotFound(_0x593a59,null))[_0xd68f('0x27')](function(_0xf51473){if(_0xf51473){_0x2517f1=_0xf51473;_0x811f37[_0xd68f('0x33')]=_[_0xd68f('0x4a')](db[_0xd68f('0x77')][_0xd68f('0x30')]);_0x811f37[_0xd68f('0x34')]=_[_0xd68f('0x4a')](_0x46f6fc[_0xd68f('0x34')]);_0x811f37[_0xd68f('0x35')]=_['intersection'](_0x811f37[_0xd68f('0x33')],_0x811f37[_0xd68f('0x34')]);_0x4f7f05['attributes']=_[_0xd68f('0x36')](_0x811f37['model'],qs[_0xd68f('0x38')](_0x46f6fc[_0xd68f('0x34')]['fields']));_0x4f7f05['attributes']=_0x4f7f05[_0xd68f('0x37')][_0xd68f('0x39')]?_0x4f7f05['attributes']:_0x811f37[_0xd68f('0x33')];_0x4f7f05['order']=qs['sort'](_0x46f6fc['query'][_0xd68f('0x3c')]);_0x4f7f05['where']=qs['filters'](_[_0xd68f('0x3e')](_0x46f6fc[_0xd68f('0x34')],_0x811f37[_0xd68f('0x35')]));if(_0x46f6fc[_0xd68f('0x34')][_0xd68f('0x3f')]){_0x4f7f05[_0xd68f('0x3d')]=_[_0xd68f('0x4b')](_0x4f7f05[_0xd68f('0x3d')],{'$or':_['map'](_0x4f7f05[_0xd68f('0x37')],function(_0x278b10){var _0x100163={};_0x100163[_0x278b10]={'$like':'%'+_0x46f6fc['query'][_0xd68f('0x3f')]+'%'};return _0x100163;})});}_0x4f7f05=_[_0xd68f('0x4b')]({},_0x4f7f05,_0x46f6fc['options']);return _0x2517f1['getAgents'](_0x4f7f05);}})[_0xd68f('0x27')](function(_0x11f1df){if(_0x11f1df){_0x21e60f=_0x11f1df[_0xd68f('0x39')];if(!_0x46f6fc[_0xd68f('0x34')]['hasOwnProperty'](_0xd68f('0x3a'))){_0x4f7f05[_0xd68f('0x22')]=qs[_0xd68f('0x22')](_0x46f6fc[_0xd68f('0x34')]['limit']);_0x4f7f05[_0xd68f('0x21')]=qs[_0xd68f('0x21')](_0x46f6fc[_0xd68f('0x34')][_0xd68f('0x21')]);}return _0x2517f1[_0xd68f('0x76')](_0x4f7f05);}})[_0xd68f('0x27')](function(_0x424d08){if(_0x424d08){return _0x424d08?{'count':_0x21e60f,'rows':_0x424d08}:null;}})[_0xd68f('0x27')](respondWithResult(_0x593a59,null))[_0xd68f('0x47')](handleError(_0x593a59,null));}; \ No newline at end of file +var _0x9e54=['Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','transaction','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','html-pdf','eml-format','request-promise','moment','bluebird','util','path','to-csv','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','index','VoicePrefix','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','describe','create','sequelize','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','context','exten','app','system','description','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push'];(function(_0x32f380,_0x65a1ea){var _0x2c5a0e=function(_0x49b821){while(--_0x49b821){_0x32f380['push'](_0x32f380['shift']());}};_0x2c5a0e(++_0x65a1ea);}(_0x9e54,0x88));var _0x49e5=function(_0x285260,_0x15f9ad){_0x285260=_0x285260-0x0;var _0xa73eb5=_0x9e54[_0x285260];return _0xa73eb5;};'use strict';var pdf=require(_0x49e5('0x0'));var emlformat=require(_0x49e5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49e5('0x2'));var moment=require(_0x49e5('0x3'));var BPromise=require(_0x49e5('0x4'));var Mustache=require('mustache');var util=require(_0x49e5('0x5'));var path=require(_0x49e5('0x6'));var sox=require('sox');var csv=require(_0x49e5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x49e5('0x8'));var crypto=require('crypto');var jsforce=require(_0x49e5('0x9'));var deskjs=require(_0x49e5('0xa'));var toCsv=require(_0x49e5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x49e5('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x49e5('0xc'));var as=require(_0x49e5('0xd'));var hardwareService=require(_0x49e5('0xe'));var logger=require(_0x49e5('0xf'))(_0x49e5('0x10'));var utils=require('../../config/utils');var config=require(_0x49e5('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x49e5('0x12'))['db'];config[_0x49e5('0x13')]=_[_0x49e5('0x14')](config[_0x49e5('0x13')],{'host':_0x49e5('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x49e5('0x16'))[_0x49e5('0x17')](socket);function respondWithStatusCode(_0x5ea43e,_0x56ae34){_0x56ae34=_0x56ae34||0xcc;return function(_0x3b7cd4){if(_0x3b7cd4){return _0x5ea43e['sendStatus'](_0x56ae34);}return _0x5ea43e[_0x49e5('0x18')](_0x56ae34)['end']();};}function respondWithResult(_0x2cc353,_0x13bc7f){_0x13bc7f=_0x13bc7f||0xc8;return function(_0x375488){if(_0x375488){return _0x2cc353['status'](_0x13bc7f)[_0x49e5('0x19')](_0x375488);}};}function respondWithFilteredResult(_0x273023,_0x37c0d3){return function(_0x1e2723){if(_0x1e2723){var _0xfc4935=_0x1e2723[_0x49e5('0x1a')],_0xff869e=_0x37c0d3[_0x49e5('0x1b')],_0x3ba258=_0x37c0d3['offset']+_0x37c0d3[_0x49e5('0x1c')],_0x4dca4f;if(_0x3ba258>=_0xfc4935){_0x3ba258=_0xfc4935;_0x4dca4f=0xc8;}else{_0x4dca4f=0xce;}_0x273023['status'](_0x4dca4f);return _0x273023[_0x49e5('0x1d')](_0x49e5('0x1e'),_0xff869e+'-'+_0x3ba258+'/'+_0xfc4935)['json'](_0x1e2723);}return null;};}function patchUpdates(_0x136838){return function(_0x41c6d0){try{jsonpatch[_0x49e5('0x1f')](_0x41c6d0,_0x136838,!![]);}catch(_0x21ce13){return BPromise[_0x49e5('0x20')](_0x21ce13);}return _0x41c6d0[_0x49e5('0x21')]();};}function saveUpdates(_0x5e8569,_0x1a2f8e){return function(_0x5c3062){if(_0x5c3062){return _0x5c3062[_0x49e5('0x22')](_0x5e8569)[_0x49e5('0x23')](function(_0x1033ed){return _0x1033ed;});}return null;};}function removeEntity(_0x2d1d63,_0x25ecb9){return function(_0xe5b1ea){if(_0xe5b1ea){return _0xe5b1ea['destroy']()['then'](function(){var _0xd96520=_0xe5b1ea[_0x49e5('0x24')]({'plain':!![]});var _0x5531bf=_0x49e5('0x25');return db[_0x49e5('0x26')][_0x49e5('0x27')]({'where':{'type':_0x5531bf,'resourceId':_0xd96520['id']}})[_0x49e5('0x23')](function(){return _0xe5b1ea;});})[_0x49e5('0x23')](function(){_0x2d1d63[_0x49e5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xadf789,_0x18db07){return function(_0x3cb351){if(!_0x3cb351){_0xadf789['sendStatus'](0x194);}return _0x3cb351;};}function handleError(_0x300754,_0x4cab78){_0x4cab78=_0x4cab78||0x1f4;return function(_0x365aeb){logger[_0x49e5('0x28')](_0x365aeb['stack']);if(_0x365aeb['name']){delete _0x365aeb[_0x49e5('0x29')];}_0x300754[_0x49e5('0x18')](_0x4cab78)['send'](_0x365aeb);};}exports[_0x49e5('0x2a')]=function(_0x5c0cb8,_0x36d49e){var _0x1ce332={},_0x9408b6={},_0x3167c5={'count':0x0,'rows':[]};var _0x141cba=_['map'](db[_0x49e5('0x2b')][_0x49e5('0x2c')],function(_0x412d7f){return{'name':_0x412d7f[_0x49e5('0x2d')],'type':_0x412d7f[_0x49e5('0x2e')]['key']};});_0x9408b6[_0x49e5('0x2f')]=_[_0x49e5('0x30')](_0x141cba,'name');_0x9408b6[_0x49e5('0x31')]=_['keys'](_0x5c0cb8['query']);_0x9408b6[_0x49e5('0x32')]=_[_0x49e5('0x33')](_0x9408b6['model'],_0x9408b6['query']);_0x1ce332[_0x49e5('0x34')]=_['intersection'](_0x9408b6[_0x49e5('0x2f')],qs[_0x49e5('0x35')](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x35')]));_0x1ce332[_0x49e5('0x34')]=_0x1ce332[_0x49e5('0x34')][_0x49e5('0x36')]?_0x1ce332[_0x49e5('0x34')]:_0x9408b6[_0x49e5('0x2f')];if(!_0x5c0cb8[_0x49e5('0x31')]['hasOwnProperty'](_0x49e5('0x37'))){_0x1ce332['limit']=qs['limit'](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x1c')]);_0x1ce332[_0x49e5('0x1b')]=qs[_0x49e5('0x1b')](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x1b')]);}_0x1ce332[_0x49e5('0x38')]=qs[_0x49e5('0x39')](_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x39')]);_0x1ce332[_0x49e5('0x3a')]=qs[_0x49e5('0x32')](_[_0x49e5('0x3b')](_0x5c0cb8[_0x49e5('0x31')],_0x9408b6[_0x49e5('0x32')]),_0x141cba);if(_0x5c0cb8['query'][_0x49e5('0x3c')]){_0x1ce332['where']=_[_0x49e5('0x3d')](_0x1ce332[_0x49e5('0x3a')],{'$or':_['map'](_0x141cba,function(_0x19d78f){if(_0x19d78f[_0x49e5('0x2e')]!=='VIRTUAL'){var _0xa2c50c={};_0xa2c50c[_0x19d78f['name']]={'$like':'%'+_0x5c0cb8[_0x49e5('0x31')][_0x49e5('0x3c')]+'%'};return _0xa2c50c;}})});}_0x1ce332=_[_0x49e5('0x3d')]({},_0x1ce332,_0x5c0cb8['options']);var _0x3f451f={'where':_0x1ce332[_0x49e5('0x3a')]};return db[_0x49e5('0x2b')]['count'](_0x3f451f)[_0x49e5('0x23')](function(_0x54d2a0){_0x3167c5[_0x49e5('0x1a')]=_0x54d2a0;if(_0x5c0cb8['query'][_0x49e5('0x3e')]){_0x1ce332[_0x49e5('0x3f')]=[{'all':!![]}];}return db[_0x49e5('0x2b')][_0x49e5('0x40')](_0x1ce332);})[_0x49e5('0x23')](function(_0x13fbb6){_0x3167c5[_0x49e5('0x41')]=_0x13fbb6;return _0x3167c5;})[_0x49e5('0x23')](respondWithFilteredResult(_0x36d49e,_0x1ce332))[_0x49e5('0x42')](handleError(_0x36d49e,null));};exports[_0x49e5('0x43')]=function(_0x5714b5,_0x29d769){var _0x227add={'raw':![],'where':{'id':_0x5714b5[_0x49e5('0x44')]['id']}},_0x56b617={};_0x56b617[_0x49e5('0x2f')]=_[_0x49e5('0x45')](db['VoicePrefix'][_0x49e5('0x2c')]);_0x56b617[_0x49e5('0x31')]=_['keys'](_0x5714b5[_0x49e5('0x31')]);_0x56b617[_0x49e5('0x32')]=_[_0x49e5('0x33')](_0x56b617['model'],_0x56b617[_0x49e5('0x31')]);_0x227add[_0x49e5('0x34')]=_[_0x49e5('0x33')](_0x56b617[_0x49e5('0x2f')],qs[_0x49e5('0x35')](_0x5714b5[_0x49e5('0x31')][_0x49e5('0x35')]));_0x227add[_0x49e5('0x34')]=_0x227add['attributes'][_0x49e5('0x36')]?_0x227add[_0x49e5('0x34')]:_0x56b617[_0x49e5('0x2f')];if(_0x5714b5[_0x49e5('0x31')][_0x49e5('0x3e')]){_0x227add[_0x49e5('0x3f')]=[{'all':!![]}];}_0x227add=_[_0x49e5('0x3d')]({},_0x227add,_0x5714b5[_0x49e5('0x46')]);return db[_0x49e5('0x2b')][_0x49e5('0x47')](_0x227add)[_0x49e5('0x23')](handleEntityNotFound(_0x29d769,null))[_0x49e5('0x23')](respondWithResult(_0x29d769,null))[_0x49e5('0x42')](handleError(_0x29d769,null));};exports['destroy']=function(_0x24a352,_0x46fef6){return db[_0x49e5('0x2b')][_0x49e5('0x47')]({'where':{'id':_0x24a352['params']['id']}})[_0x49e5('0x23')](handleEntityNotFound(_0x46fef6,null))[_0x49e5('0x23')](removeEntity(_0x46fef6,null))[_0x49e5('0x42')](handleError(_0x46fef6,null));};exports[_0x49e5('0x48')]=function(_0x56b43e,_0x464074){return db[_0x49e5('0x2b')][_0x49e5('0x48')]()[_0x49e5('0x23')](respondWithResult(_0x464074,null))['catch'](handleError(_0x464074,null));};exports[_0x49e5('0x49')]=function(_0x224984,_0x283cad){var _0x262e7d;return db[_0x49e5('0x4a')]['transaction'](function(_0x1c8ba7){return db[_0x49e5('0x2b')][_0x49e5('0x49')](_0x224984[_0x49e5('0x4b')],{'transaction':_0x1c8ba7})[_0x49e5('0x23')](function(_0x399c79){_0x262e7d=_0x399c79[_0x49e5('0x24')]({'plain':!![]});return db[_0x49e5('0x4c')]['find']({'where':{'id':_0x262e7d['VoiceExtensionId']},'raw':!![]})['then'](function(_0x15508e){return createVoicePrefixExtensions(_0x262e7d,_0x15508e,_0x1c8ba7);});});})['then'](function(){var _0x280c81=_0x224984[_0x49e5('0x4d')]['get']({'plain':!![]});if(!_0x280c81)throw new Error(_0x49e5('0x4e'));if(_0x280c81['role']===_0x49e5('0x4d')){var _0x474467=_0x262e7d;return db[_0x49e5('0x4f')][_0x49e5('0x47')]({'where':{'name':_0x49e5('0x25'),'userProfileId':_0x280c81[_0x49e5('0x50')]},'raw':!![]})[_0x49e5('0x23')](function(_0x5ea366){if(_0x5ea366&&_0x5ea366[_0x49e5('0x51')]===0x0){return db[_0x49e5('0x26')][_0x49e5('0x49')]({'name':_0x474467[_0x49e5('0x29')],'resourceId':_0x474467['id'],'type':_0x5ea366[_0x49e5('0x29')],'sectionId':_0x5ea366['id']},{})['then'](function(){return _0x262e7d;});}else{return _0x262e7d;}})[_0x49e5('0x42')](function(_0xf4d626){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf4d626);throw _0xf4d626;});}return _0x262e7d;})[_0x49e5('0x23')](respondWithResult(_0x283cad,null))['catch'](handleError(_0x283cad,null));};function Extension(_0x5dfc26,_0x176688,_0x34b19e,_0x264cb9){this[_0x49e5('0x52')]='from-sip';this[_0x49e5('0x53')]=_0x5dfc26;this[_0x49e5('0x54')]=_0x34b19e;this[_0x49e5('0x2e')]=_0x49e5('0x55');this[_0x49e5('0x56')]='Voice\x20Prefix\x20Extension';this['priority']=_0x176688;this['appdata']=_0x264cb9;}function createVoicePrefixExtensions(_0x5c362f,_0x5b1309,_0x489428){return new BPromise(function(_0x54f90a,_0x3ab15a){var _0x2cd700=new Extension(formatPrefixName(_0x5c362f[_0x49e5('0x57')]),0x1,_0x49e5('0x58'),_0x49e5('0x59'));_0x2cd700[_0x49e5('0x5a')]=_0x5c362f['id'];return db[_0x49e5('0x4c')][_0x49e5('0x49')](_0x2cd700,{'transaction':_0x489428})[_0x49e5('0x23')](function(_0x13841d){var _0x2428bd=_0x13841d[_0x49e5('0x24')]({'plain':!![]});var _0x13c2b3=_[_0x49e5('0x30')](addVoicePrefixExtensions(_0x5c362f,_0x5b1309),function(_0x12c926){_0x12c926['VoiceExtensionId']=_0x2428bd['id'];_0x12c926['VoicePrefixId']=_0x5c362f['id'];return _0x12c926;});return db[_0x49e5('0x4c')][_0x49e5('0x5b')](_0x13c2b3,{'transaction':_0x489428})[_0x49e5('0x23')](function(_0x56075c){if(!_0x56075c){return _0x3ab15a(_0x49e5('0x5c'));}else{return _0x54f90a(_0x56075c);}})[_0x49e5('0x42')](function(_0xb5e9d1){return _0x3ab15a(_0xb5e9d1);});});;});};function addVoicePrefixExtensions(_0x5ad8df,_0x1697a0){var _0x12286f=[];var _0x2c73de=formatPrefixName(_0x5ad8df[_0x49e5('0x57')]);_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x2,_0x49e5('0x5e'),_0x49e5('0x5f')+_0x5ad8df[_0x49e5('0x29')]));if(_0x5ad8df['callerIdAll']){_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x3,_0x49e5('0x5e'),_0x49e5('0x60')+_0x5ad8df[_0x49e5('0x61')]));}else{_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x3,_0x49e5('0x58'),_0x49e5('0x62')));}_0x12286f[_0x49e5('0x5d')](new Extension(_0x2c73de,0x4,_0x49e5('0x63'),_0x1697a0[_0x49e5('0x52')]+','+_0x49e5('0x64')+(0x8+_0x5ad8df[_0x49e5('0x29')][_0x49e5('0x36')])+'}'+','+0x1));return _0x12286f;}function formatPrefixName(_0xff2d12){var _0x292cbe='_';for(var _0x47e48c=0x0;_0x47e48c<_0xff2d12[_0x49e5('0x36')];_0x47e48c++){if(_0xff2d12[_0x49e5('0x65')](_0x47e48c)=='-'){_0x292cbe+=_0xff2d12[_0x49e5('0x65')](_0x47e48c);}else{_0x292cbe+='['+_0xff2d12[_0x49e5('0x65')](_0x47e48c)+']';}}_0x292cbe+='.';return _0x292cbe;}exports[_0x49e5('0x22')]=function(_0x211d57,_0x56a6ce,_0x3a8105){var _0xc57d21=_0x211d57['body'];_0xc57d21[_0x49e5('0x57')]=_0x49e5('0x66')+_0xc57d21[_0x49e5('0x29')]+'-';return db['sequelize'][_0x49e5('0x67')](function(_0x5311e6){return db[_0x49e5('0x2b')]['update'](_0xc57d21,{'where':{'id':_0xc57d21['id']},'transaction':_0x5311e6})['then'](function(){return db[_0x49e5('0x4c')][_0x49e5('0x27')]({'where':{'VoicePrefixId':_0xc57d21['id']},'transaction':_0x5311e6})['then'](function(){return db[_0x49e5('0x4c')][_0x49e5('0x47')]({'where':{'id':_0xc57d21['VoiceExtensionId']},'raw':!![]})['then'](function(_0x359de7){return createVoicePrefixExtensions(_0xc57d21,_0x359de7,_0x5311e6);});});});})[_0x49e5('0x23')](function(){return db[_0x49e5('0x2b')]['findById'](_0xc57d21['id']);})[_0x49e5('0x23')](respondWithResult(_0x56a6ce,null))[_0x49e5('0x42')](handleError(_0x56a6ce,null));};exports[_0x49e5('0x68')]=function(_0xc1f743,_0x552592,_0x45cb25){return db['VoicePrefix'][_0x49e5('0x47')]({'where':{'id':_0xc1f743['params']['id']}})[_0x49e5('0x23')](handleEntityNotFound(_0x552592,null))[_0x49e5('0x23')](function(_0x1d65f3){if(_0x1d65f3){return _0x1d65f3[_0x49e5('0x68')](_0xc1f743[_0x49e5('0x4b')][_0x49e5('0x69')],_['omit'](_0xc1f743[_0x49e5('0x4b')],[_0x49e5('0x69'),'id'])||{})[_0x49e5('0x6a')](function(_0x40c04e){for(var _0xb5149b=0x0;_0xb5149b<_0xc1f743[_0x49e5('0x4b')]['ids'][_0x49e5('0x36')];_0xb5149b+=0x1){socket[_0x49e5('0x6b')](_0x49e5('0x6c'),{'UserId':_0xc1f743[_0x49e5('0x4b')][_0x49e5('0x69')][_0xb5149b],'VoicePrefixId':_0xc1f743[_0x49e5('0x44')]['id']});}return _0x40c04e;});}})[_0x49e5('0x23')](respondWithResult(_0x552592,null))[_0x49e5('0x42')](handleError(_0x552592,null));};exports[_0x49e5('0x6d')]=function(_0x1b9c54,_0x473fd8,_0x24947c){return db[_0x49e5('0x2b')][_0x49e5('0x47')]({'where':{'id':_0x1b9c54['params']['id']}})['then'](handleEntityNotFound(_0x473fd8,null))[_0x49e5('0x23')](function(_0x434e25){if(_0x434e25){return _0x434e25['removeAgents'](_0x1b9c54[_0x49e5('0x31')][_0x49e5('0x69')])[_0x49e5('0x23')](function(){if(_[_0x49e5('0x6e')](_0x1b9c54[_0x49e5('0x31')][_0x49e5('0x69')])){for(var _0x5bd697=0x0;_0x5bd697<_0x1b9c54[_0x49e5('0x31')]['ids'][_0x49e5('0x36')];_0x5bd697+=0x1){socket[_0x49e5('0x6b')](_0x49e5('0x6f'),{'UserId':Number(_0x1b9c54[_0x49e5('0x31')]['ids'][_0x5bd697]),'VoicePrefixId':Number(_0x1b9c54[_0x49e5('0x44')]['id'])});}}else{socket[_0x49e5('0x6b')](_0x49e5('0x6f'),{'UserId':Number(_0x1b9c54[_0x49e5('0x31')]['ids']),'VoicePrefixId':Number(_0x1b9c54[_0x49e5('0x44')]['id'])});}});}})[_0x49e5('0x23')](respondWithStatusCode(_0x473fd8,null))['catch'](handleError(_0x473fd8,null));};exports[_0x49e5('0x70')]=function(_0x45adbb,_0x37cf49,_0x2de3af){var _0x552e46={};var _0x136fcb={};var _0x20fde5;var _0x40f03d;return db[_0x49e5('0x2b')][_0x49e5('0x71')]({'where':{'id':_0x45adbb[_0x49e5('0x44')]['id']}})[_0x49e5('0x23')](handleEntityNotFound(_0x37cf49,null))[_0x49e5('0x23')](function(_0x3bde6f){if(_0x3bde6f){_0x20fde5=_0x3bde6f;_0x136fcb[_0x49e5('0x2f')]=_[_0x49e5('0x45')](db['User'][_0x49e5('0x2c')]);_0x136fcb[_0x49e5('0x31')]=_['keys'](_0x45adbb[_0x49e5('0x31')]);_0x136fcb[_0x49e5('0x32')]=_['intersection'](_0x136fcb['model'],_0x136fcb[_0x49e5('0x31')]);_0x552e46['attributes']=_[_0x49e5('0x33')](_0x136fcb[_0x49e5('0x2f')],qs[_0x49e5('0x35')](_0x45adbb['query']['fields']));_0x552e46[_0x49e5('0x34')]=_0x552e46[_0x49e5('0x34')][_0x49e5('0x36')]?_0x552e46[_0x49e5('0x34')]:_0x136fcb[_0x49e5('0x2f')];_0x552e46['order']=qs[_0x49e5('0x39')](_0x45adbb[_0x49e5('0x31')][_0x49e5('0x39')]);_0x552e46[_0x49e5('0x3a')]=qs[_0x49e5('0x32')](_[_0x49e5('0x3b')](_0x45adbb[_0x49e5('0x31')],_0x136fcb[_0x49e5('0x32')]));if(_0x45adbb[_0x49e5('0x31')][_0x49e5('0x3c')]){_0x552e46[_0x49e5('0x3a')]=_[_0x49e5('0x3d')](_0x552e46[_0x49e5('0x3a')],{'$or':_[_0x49e5('0x30')](_0x552e46[_0x49e5('0x34')],function(_0x3a3da6){var _0x5aba07={};_0x5aba07[_0x3a3da6]={'$like':'%'+_0x45adbb['query']['filter']+'%'};return _0x5aba07;})});}_0x552e46=_['merge']({},_0x552e46,_0x45adbb['options']);return _0x20fde5[_0x49e5('0x70')](_0x552e46);}})['then'](function(_0x47c207){if(_0x47c207){_0x40f03d=_0x47c207['length'];if(!_0x45adbb[_0x49e5('0x31')][_0x49e5('0x72')](_0x49e5('0x37'))){_0x552e46[_0x49e5('0x1c')]=qs['limit'](_0x45adbb[_0x49e5('0x31')][_0x49e5('0x1c')]);_0x552e46[_0x49e5('0x1b')]=qs[_0x49e5('0x1b')](_0x45adbb[_0x49e5('0x31')]['offset']);}return _0x20fde5[_0x49e5('0x70')](_0x552e46);}})[_0x49e5('0x23')](function(_0x15187f){if(_0x15187f){return _0x15187f?{'count':_0x40f03d,'rows':_0x15187f}:null;}})['then'](respondWithResult(_0x37cf49,null))[_0x49e5('0x42')](handleError(_0x37cf49,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 989840b..8478cc3 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x34e8,0x12c));var _0x834e=function(_0x4bcda4,_0x110be3){_0x4bcda4=_0x4bcda4-0x0;var _0x1c2215=_0x34e8[_0x4bcda4];return _0x1c2215;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x3b7b72,_0x2f770d){var _0x5b1680=function(_0xcec6f6){while(--_0xcec6f6){_0x3b7b72['push'](_0x3b7b72['shift']());}};_0x5b1680(++_0x2f770d);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9ebd43b..0105239 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 _0x7e59=['moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e59,0x18c));var _0x97e5=function(_0x3086d7,_0x5a5eca){_0x3086d7=_0x3086d7-0x0;var _0x5f27c0=_0x7e59[_0x3086d7];return _0x5f27c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x97e5('0x0'));var BPromise=require(_0x97e5('0x1'));var rp=require(_0x97e5('0x2'));var fs=require('fs');var path=require(_0x97e5('0x3'));var rimraf=require('rimraf');var config=require(_0x97e5('0x4'));var attributes=require(_0x97e5('0x5'));module[_0x97e5('0x6')]=function(_0xa8de50,_0x54a8cf){return _0xa8de50[_0x97e5('0x7')]('VoicePrefix',attributes,{'tableName':_0x97e5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39fd=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x1a8396,_0x280126){var _0x29ce3=function(_0x2a205a){while(--_0x2a205a){_0x1a8396['push'](_0x1a8396['shift']());}};_0x29ce3(++_0x280126);}(_0x39fd,0x145));var _0xd39f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x39fd[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd39f('0x0'));var util=require(_0xd39f('0x1'));var logger=require('../../config/logger')(_0xd39f('0x2'));var moment=require(_0xd39f('0x3'));var BPromise=require(_0xd39f('0x4'));var rp=require(_0xd39f('0x5'));var fs=require('fs');var path=require(_0xd39f('0x6'));var rimraf=require(_0xd39f('0x7'));var config=require(_0xd39f('0x8'));var attributes=require(_0xd39f('0x9'));module['exports']=function(_0x12f99e,_0x421738){return _0x12f99e[_0xd39f('0xa')](_0xd39f('0xb'),attributes,{'tableName':_0xd39f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 63fead9..a96271d 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 _0xf564=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','request\x20sent'];(function(_0x3c0e41,_0x286501){var _0x3b576c=function(_0x4d8a12){while(--_0x4d8a12){_0x3c0e41['push'](_0x3c0e41['shift']());}};_0x3b576c(++_0x286501);}(_0xf564,0x11f));var _0x4f56=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xf564[_0x3f2a90];return _0xb46279;};'use strict';var _=require(_0x4f56('0x0'));var util=require(_0x4f56('0x1'));var moment=require('moment');var BPromise=require(_0x4f56('0x2'));var rs=require(_0x4f56('0x3'));var fs=require('fs');var Redis=require(_0x4f56('0x4'));var db=require(_0x4f56('0x5'))['db'];var utils=require(_0x4f56('0x6'));var logger=require(_0x4f56('0x7'))(_0x4f56('0x8'));var config=require(_0x4f56('0x9'));var jayson=require(_0x4f56('0xa'));var client=jayson[_0x4f56('0xb')]['http']({'port':0x232a});config[_0x4f56('0xc')]=_[_0x4f56('0xd')](config['redis'],{'host':_0x4f56('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f56('0xc')]));require(_0x4f56('0xf'))[_0x4f56('0x10')](socket);function respondWithRpcPromise(_0x246fa4,_0x578820,_0x2ac324){return new BPromise(function(_0x372791,_0x35e11a){return client[_0x4f56('0x11')](_0x246fa4,_0x2ac324)[_0x4f56('0x12')](function(_0x2ca4c3){logger[_0x4f56('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x578820,_0x4f56('0x14'));logger[_0x4f56('0x15')](_0x4f56('0x16'),_0x578820,_0x4f56('0x14'),JSON[_0x4f56('0x17')](_0x2ca4c3));if(_0x2ca4c3[_0x4f56('0x18')]){if(_0x2ca4c3[_0x4f56('0x18')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x578820,_0x2ca4c3[_0x4f56('0x18')]['message']);return _0x35e11a(_0x2ca4c3[_0x4f56('0x18')]['message']);}logger[_0x4f56('0x18')](_0x4f56('0x19'),_0x578820,_0x2ca4c3[_0x4f56('0x18')][_0x4f56('0x1a')]);return _0x372791(_0x2ca4c3['error']['message']);}else{logger['info'](_0x4f56('0x19'),_0x578820,_0x4f56('0x14'));_0x372791(_0x2ca4c3[_0x4f56('0x1b')][_0x4f56('0x1a')]);}})['catch'](function(_0x2603d3){logger[_0x4f56('0x18')](_0x4f56('0x19'),_0x578820,_0x2603d3);_0x35e11a(_0x2603d3);});});} \ No newline at end of file +var _0x0216=['client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','VoicePrefix,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xd3aca5,_0x36777f){var _0x302f8e=function(_0x51ba7f){while(--_0x51ba7f){_0xd3aca5['push'](_0xd3aca5['shift']());}};_0x302f8e(++_0x36777f);}(_0x0216,0x149));var _0x6021=function(_0x5b66ce,_0x4818ba){_0x5b66ce=_0x5b66ce-0x0;var _0x316e77=_0x0216[_0x5b66ce];return _0x316e77;};'use strict';var _=require(_0x6021('0x0'));var util=require(_0x6021('0x1'));var moment=require('moment');var BPromise=require(_0x6021('0x2'));var rs=require(_0x6021('0x3'));var fs=require('fs');var Redis=require(_0x6021('0x4'));var db=require(_0x6021('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6021('0x6'))(_0x6021('0x7'));var config=require(_0x6021('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6021('0x9')][_0x6021('0xa')]({'port':0x232a});config['redis']=_[_0x6021('0xb')](config['redis'],{'host':_0x6021('0xc'),'port':0x18eb});var socket=require(_0x6021('0xd'))(new Redis(config[_0x6021('0xe')]));require('./voicePrefix.socket')[_0x6021('0xf')](socket);function respondWithRpcPromise(_0x4e1073,_0x37b6a1,_0x35ecbd){return new BPromise(function(_0xf52738,_0x47cbe1){return client['request'](_0x4e1073,_0x35ecbd)[_0x6021('0x10')](function(_0x1a46a5){logger[_0x6021('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x6021('0x12'));logger[_0x6021('0x13')](_0x6021('0x14'),_0x37b6a1,_0x6021('0x12'),JSON['stringify'](_0x1a46a5));if(_0x1a46a5['error']){if(_0x1a46a5[_0x6021('0x15')][_0x6021('0x16')]===0x1f4){logger[_0x6021('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x1a46a5[_0x6021('0x15')]['message']);return _0x47cbe1(_0x1a46a5[_0x6021('0x15')][_0x6021('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x1a46a5[_0x6021('0x15')][_0x6021('0x17')]);return _0xf52738(_0x1a46a5[_0x6021('0x15')]['message']);}else{logger['info'](_0x6021('0x18'),_0x37b6a1,'request\x20sent');_0xf52738(_0x1a46a5['result'][_0x6021('0x17')]);}})[_0x6021('0x19')](function(_0x35d076){logger[_0x6021('0x15')](_0x6021('0x18'),_0x37b6a1,_0x35d076);_0x47cbe1(_0x35d076);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 10df96a..7bfe2f1 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 _0x1042=['remove','register','voicePrefix:','./voicePrefix.events'];(function(_0x2b3c33,_0x55a820){var _0x169cfb=function(_0x1f277b){while(--_0x1f277b){_0x2b3c33['push'](_0x2b3c33['shift']());}};_0x169cfb(++_0x55a820);}(_0x1042,0xab));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0x2104('0x0'));var events=['save',_0x2104('0x1'),'update'];function createListener(_0x4c18dc,_0x5cbcb3){return function(_0x53110f){_0x5cbcb3['emit'](_0x4c18dc,_0x53110f);};}function removeListener(_0x239c3d,_0x538d8c){return function(){VoicePrefixEvents['removeListener'](_0x239c3d,_0x538d8c);};}exports[_0x2104('0x2')]=function(_0x3d5f4b){for(var _0x51b30d=0x0,_0x4a8ff3=events['length'];_0x51b30d<_0x4a8ff3;_0x51b30d++){var _0x1f8394=events[_0x51b30d];var _0x2e06c7=createListener(_0x2104('0x3')+_0x1f8394,_0x3d5f4b);VoicePrefixEvents['on'](_0x1f8394,_0x2e06c7);}}; \ No newline at end of file +var _0xb358=['length','voicePrefix:','update','emit','removeListener','register'];(function(_0x5d54d0,_0x137acc){var _0x23840e=function(_0x2b9258){while(--_0x2b9258){_0x5d54d0['push'](_0x5d54d0['shift']());}};_0x23840e(++_0x137acc);}(_0xb358,0xda));var _0x8b35=function(_0x31661f,_0x11d5a1){_0x31661f=_0x31661f-0x0;var _0xab6fec=_0xb358[_0x31661f];return _0xab6fec;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save','remove',_0x8b35('0x0')];function createListener(_0xd8364a,_0x64e83d){return function(_0x526cd3){_0x64e83d[_0x8b35('0x1')](_0xd8364a,_0x526cd3);};}function removeListener(_0x5f2ca9,_0x49308a){return function(){VoicePrefixEvents[_0x8b35('0x2')](_0x5f2ca9,_0x49308a);};}exports[_0x8b35('0x3')]=function(_0x18e302){for(var _0x3947af=0x0,_0x56542c=events[_0x8b35('0x4')];_0x3947af<_0x56542c;_0x3947af++){var _0x5d7fd8=events[_0x3947af];var _0x108527=createListener(_0x8b35('0x5')+_0x5d7fd8,_0x18e302);VoicePrefixEvents['on'](_0x5d7fd8,_0x108527);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0690671..136005d 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 _0x0f74=['getBlackLists','post','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists','/:id/blacklists','addBlackLists','destroy','delete','removeAgents','removeLists','removeBlackLists','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','getMembers','/:id/lists'];(function(_0x321811,_0x4d2670){var _0x4cbd5d=function(_0x1efcf3){while(--_0x1efcf3){_0x321811['push'](_0x321811['shift']());}};_0x4cbd5d(++_0x4d2670);}(_0x0f74,0x8b));var _0x40f7=function(_0x428d5f,_0x44fab1){_0x428d5f=_0x428d5f-0x0;var _0x2831c6=_0x0f74[_0x428d5f];return _0x2831c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40f7('0x0'));var timeout=require(_0x40f7('0x1'));var express=require(_0x40f7('0x2'));var router=express[_0x40f7('0x3')]();var auth=require(_0x40f7('0x4'));var interaction=require(_0x40f7('0x5'));var config=require(_0x40f7('0x6'));var controller=require(_0x40f7('0x7'));router['get']('/',auth[_0x40f7('0x8')](),controller[_0x40f7('0x9')]);router[_0x40f7('0xa')](_0x40f7('0xb'),auth['isAuthenticated'](),controller[_0x40f7('0xc')]);router[_0x40f7('0xa')](_0x40f7('0xd'),auth[_0x40f7('0x8')](),controller[_0x40f7('0xe')]);router[_0x40f7('0xa')](_0x40f7('0xf'),auth[_0x40f7('0x8')](),controller['getHopperHistories']);router[_0x40f7('0xa')](_0x40f7('0x10'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x11')]);router[_0x40f7('0xa')](_0x40f7('0x12'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x13')]);router['get'](_0x40f7('0x14'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x15')]);router[_0x40f7('0xa')]('/:id/users',auth[_0x40f7('0x8')](),controller[_0x40f7('0x16')]);router[_0x40f7('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x40f7('0x17')]);router['get'](_0x40f7('0x18'),auth[_0x40f7('0x8')](),controller['getLists']);router[_0x40f7('0xa')]('/:id/blacklists',auth[_0x40f7('0x8')](),controller[_0x40f7('0x19')]);router[_0x40f7('0x1a')]('/',auth[_0x40f7('0x8')](),controller['create']);router[_0x40f7('0x1a')](_0x40f7('0x1b'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x1c')]);router['post'](_0x40f7('0x14'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x1d')]);router['post'](_0x40f7('0x1e'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x1f')]);router[_0x40f7('0x1a')](_0x40f7('0x18'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x20')]);router[_0x40f7('0x1a')](_0x40f7('0x21'),auth['isAuthenticated'](),controller[_0x40f7('0x22')]);router['put'](_0x40f7('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x40f7('0x23')]);router[_0x40f7('0x24')](_0x40f7('0x14'),auth[_0x40f7('0x8')](),controller['removeTeams']);router[_0x40f7('0x24')](_0x40f7('0x1e'),auth['isAuthenticated'](),controller[_0x40f7('0x25')]);router[_0x40f7('0x24')](_0x40f7('0x18'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x26')]);router[_0x40f7('0x24')](_0x40f7('0x21'),auth['isAuthenticated'](),controller[_0x40f7('0x27')]);module[_0x40f7('0x28')]=router; \ No newline at end of file +var _0xc992=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/teams','getTeams','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','/:id/clone','addTeams','addAgents','/:id/lists','/:id/blacklists','put','update','destroy','delete','removeTeams','/:id/users','removeAgents','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','get','/:id','/:id/hoppers'];(function(_0x1c73a4,_0x1c4858){var _0x402bc9=function(_0x443b1e){while(--_0x443b1e){_0x1c73a4['push'](_0x1c73a4['shift']());}};_0x402bc9(++_0x1c4858);}(_0xc992,0x93));var _0x2c99=function(_0x2b1975,_0x245d12){_0x2b1975=_0x2b1975-0x0;var _0x51a4e7=_0xc992[_0x2b1975];return _0x51a4e7;};'use strict';var multer=require('multer');var util=require(_0x2c99('0x0'));var path=require(_0x2c99('0x1'));var timeout=require(_0x2c99('0x2'));var express=require(_0x2c99('0x3'));var router=express[_0x2c99('0x4')]();var auth=require(_0x2c99('0x5'));var interaction=require(_0x2c99('0x6'));var config=require(_0x2c99('0x7'));var controller=require(_0x2c99('0x8'));router['get']('/',auth[_0x2c99('0x9')](),controller['index']);router[_0x2c99('0xa')](_0x2c99('0xb'),auth[_0x2c99('0x9')](),controller['show']);router[_0x2c99('0xa')](_0x2c99('0xc'),auth[_0x2c99('0x9')](),controller[_0x2c99('0xd')]);router[_0x2c99('0xa')](_0x2c99('0xe'),auth[_0x2c99('0x9')](),controller[_0x2c99('0xf')]);router[_0x2c99('0xa')](_0x2c99('0x10'),auth['isAuthenticated'](),controller[_0x2c99('0x11')]);router[_0x2c99('0xa')]('/:id/hopper_black',auth[_0x2c99('0x9')](),controller['getHopperBlacks']);router[_0x2c99('0xa')](_0x2c99('0x12'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x13')]);router['get']('/:id/users',auth[_0x2c99('0x9')](),controller[_0x2c99('0x14')]);router[_0x2c99('0xa')](_0x2c99('0x15'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x16')]);router[_0x2c99('0xa')]('/:id/lists',auth[_0x2c99('0x9')](),controller[_0x2c99('0x17')]);router[_0x2c99('0xa')]('/:id/blacklists',auth[_0x2c99('0x9')](),controller[_0x2c99('0x18')]);router[_0x2c99('0x19')]('/',auth[_0x2c99('0x9')](),controller['create']);router[_0x2c99('0x19')](_0x2c99('0x1a'),auth[_0x2c99('0x9')](),controller['clone']);router[_0x2c99('0x19')](_0x2c99('0x12'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x1b')]);router['post']('/:id/users',auth[_0x2c99('0x9')](),controller[_0x2c99('0x1c')]);router['post'](_0x2c99('0x1d'),auth[_0x2c99('0x9')](),controller['addLists']);router['post'](_0x2c99('0x1e'),auth[_0x2c99('0x9')](),controller['addBlackLists']);router[_0x2c99('0x1f')](_0x2c99('0xb'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x20')]);router['delete'](_0x2c99('0xb'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x21')]);router[_0x2c99('0x22')](_0x2c99('0x12'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x23')]);router[_0x2c99('0x22')](_0x2c99('0x24'),auth[_0x2c99('0x9')](),controller[_0x2c99('0x25')]);router[_0x2c99('0x22')](_0x2c99('0x1d'),auth['isAuthenticated'](),controller['removeLists']);router['delete']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x2c99('0x26')]);module[_0x2c99('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 48dcc08..df716f4 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(_0x23bfbb,_0x3b0fa2){var _0x383576=function(_0x116419){while(--_0x116419){_0x23bfbb['push'](_0x23bfbb['shift']());}};_0x383576(++_0x3b0fa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x494dad,_0x2456ec){var _0x47d36a=function(_0x149b07){while(--_0x149b07){_0x494dad['push'](_0x494dad['shift']());}};_0x47d36a(++_0x2456ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ed4de78..5e3572d 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 _0xd9a7=['value','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','nolimit','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','forEach','penalty','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','interface','format','SIP/%s','emit','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isNil','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','toString','ListId','NOW()','deletedAt\x20IS\x20NULL','CmListId','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd9a7,0x87));var _0x7d9a=function(_0x18b0fc,_0x6886d6){_0x18b0fc=_0x18b0fc-0x0;var _0xddc75c=_0xd9a7[_0x18b0fc];return _0xddc75c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d9a('0x0'));var rimraf=require(_0x7d9a('0x1'));var zipdir=require(_0x7d9a('0x2'));var jsonpatch=require(_0x7d9a('0x3'));var rp=require(_0x7d9a('0x4'));var moment=require(_0x7d9a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7d9a('0x6'));var sox=require(_0x7d9a('0x7'));var csv=require(_0x7d9a('0x8'));var ejs=require(_0x7d9a('0x9'));var fs=require('fs');var _=require(_0x7d9a('0xa'));var squel=require(_0x7d9a('0xb'));var crypto=require(_0x7d9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d9a('0xd'));var toCsv=require(_0x7d9a('0x8'));var querystring=require(_0x7d9a('0xe'));var Papa=require(_0x7d9a('0xf'));var Redis=require(_0x7d9a('0x10'));var authService=require(_0x7d9a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d9a('0x12'));var utils=require(_0x7d9a('0x13'));var config=require(_0x7d9a('0x14'));var licenseUtil=require(_0x7d9a('0x15'));var db=require(_0x7d9a('0x16'))['db'];config['redis']=_['defaults'](config[_0x7d9a('0x17')],{'host':_0x7d9a('0x18'),'port':0x18eb});var socket=require(_0x7d9a('0x19'))(new Redis(config[_0x7d9a('0x17')]));require(_0x7d9a('0x1a'))[_0x7d9a('0x1b')](socket);function respondWithStatusCode(_0x2679a5,_0x1ee4c8){_0x1ee4c8=_0x1ee4c8||0xcc;return function(_0x297c23){if(_0x297c23){return _0x2679a5[_0x7d9a('0x1c')](_0x1ee4c8);}return _0x2679a5[_0x7d9a('0x1d')](_0x1ee4c8)[_0x7d9a('0x1e')]();};}function respondWithResult(_0xa42197,_0x23087){_0x23087=_0x23087||0xc8;return function(_0x4c042f){if(_0x4c042f){return _0xa42197[_0x7d9a('0x1d')](_0x23087)[_0x7d9a('0x1f')](_0x4c042f);}};}function respondWithFilteredResult(_0x38a81d,_0x8d3a2a){return function(_0x999180){if(_0x999180){var _0x493bf0=_0x999180[_0x7d9a('0x20')],_0x4e17d6=_0x8d3a2a[_0x7d9a('0x21')],_0x58e6e4=_0x8d3a2a[_0x7d9a('0x21')]+_0x8d3a2a['limit'],_0x403efe;if(_0x58e6e4>=_0x493bf0){_0x58e6e4=_0x493bf0;_0x403efe=0xc8;}else{_0x403efe=0xce;}_0x38a81d[_0x7d9a('0x1d')](_0x403efe);return _0x38a81d[_0x7d9a('0x22')](_0x7d9a('0x23'),_0x4e17d6+'-'+_0x58e6e4+'/'+_0x493bf0)[_0x7d9a('0x1f')](_0x999180);}return null;};}function patchUpdates(_0x4e489c){return function(_0x45fda1){try{jsonpatch[_0x7d9a('0x24')](_0x45fda1,_0x4e489c,!![]);}catch(_0x5ebf00){return BPromise[_0x7d9a('0x25')](_0x5ebf00);}return _0x45fda1['save']();};}function saveUpdates(_0x2afb99,_0x31db8c){return function(_0x267779){if(_0x267779){return _0x267779['update'](_0x2afb99)[_0x7d9a('0x26')](function(_0x4dc28d){return _0x4dc28d;});}return null;};}function removeEntity(_0x4cffb0,_0x29d35d){return function(_0x326822){if(_0x326822){return _0x326822[_0x7d9a('0x27')]()[_0x7d9a('0x26')](function(){var _0x14d41e=_0x326822[_0x7d9a('0x28')]({'plain':!![]});var _0x45fdc5=[{'name':_0x7d9a('0x29'),'value':_0x7d9a('0x2a'),'ignore':![]},{'name':_0x7d9a('0x2b'),'value':'outbound','ignore':![]}];var _0x26acfe=_(_0x45fdc5)[_0x7d9a('0x2c')]('ignore')[_0x7d9a('0x2d')](_0x7d9a('0x2e'))[_0x7d9a('0x2e')]();if(_['includes'](_0x26acfe,_0x14d41e[_0x7d9a('0x2f')])){return;}var _0x35a268=_['find'](_0x45fdc5,[_0x7d9a('0x2e'),_0x14d41e[_0x7d9a('0x2f')]])[_0x7d9a('0x30')];return db[_0x7d9a('0x31')][_0x7d9a('0x27')]({'where':{'type':_0x35a268,'resourceId':_0x14d41e['id']}})['then'](function(){return _0x326822;});})[_0x7d9a('0x26')](function(){_0x4cffb0[_0x7d9a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19947a,_0x10fbb4){return function(_0x762242){if(!_0x762242){_0x19947a['sendStatus'](0x194);}return _0x762242;};}function handleError(_0x50ab78,_0x69ee53){_0x69ee53=_0x69ee53||0x1f4;return function(_0x5b4899){logger[_0x7d9a('0x32')](_0x5b4899['stack']);if(_0x5b4899[_0x7d9a('0x30')]){delete _0x5b4899[_0x7d9a('0x30')];}_0x50ab78[_0x7d9a('0x1d')](_0x69ee53)[_0x7d9a('0x33')](_0x5b4899);};}exports[_0x7d9a('0x34')]=function(_0xba7d0d,_0x6e5af){var _0x121db5={},_0x5b5558={},_0x38d2f1={'count':0x0,'rows':[]};var _0x375c70=_[_0x7d9a('0x2d')](db[_0x7d9a('0x35')][_0x7d9a('0x36')],function(_0x437461){return{'name':_0x437461[_0x7d9a('0x37')],'type':_0x437461['type'][_0x7d9a('0x38')]};});_0x5b5558[_0x7d9a('0x39')]=_['map'](_0x375c70,_0x7d9a('0x30'));_0x5b5558[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0xba7d0d[_0x7d9a('0x3a')]);_0x5b5558['filters']=_[_0x7d9a('0x3c')](_0x5b5558[_0x7d9a('0x39')],_0x5b5558[_0x7d9a('0x3a')]);_0x121db5['attributes']=_[_0x7d9a('0x3c')](_0x5b5558[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0xba7d0d[_0x7d9a('0x3a')]['fields']));_0x121db5[_0x7d9a('0x3e')]=_0x121db5[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x121db5[_0x7d9a('0x3e')]:_0x5b5558[_0x7d9a('0x39')];if(!_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x40')]('nolimit')){_0x121db5[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x121db5[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x121db5[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x121db5[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0xba7d0d[_0x7d9a('0x3a')],_0x5b5558['filters']),_0x375c70);if(_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x121db5[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x121db5['where'],{'$or':_[_0x7d9a('0x2d')](_0x375c70,function(_0x438f91){if(_0x438f91['type']!==_0x7d9a('0x48')){var _0x30a658={};_0x30a658[_0x438f91[_0x7d9a('0x30')]]={'$like':'%'+_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x30a658;}})});}_0x121db5=_[_0x7d9a('0x47')]({},_0x121db5,_0xba7d0d[_0x7d9a('0x49')]);var _0x22d7ad={'where':_0x121db5[_0x7d9a('0x44')]};return db[_0x7d9a('0x35')][_0x7d9a('0x20')](_0x22d7ad)['then'](function(_0x5a4c0c){_0x38d2f1[_0x7d9a('0x20')]=_0x5a4c0c;if(_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x121db5['include']=[{'all':!![]}];}return db[_0x7d9a('0x35')]['findAll'](_0x121db5);})['then'](function(_0x480031){_0x38d2f1[_0x7d9a('0x4b')]=_0x480031;return _0x38d2f1;})['then'](respondWithFilteredResult(_0x6e5af,_0x121db5))[_0x7d9a('0x4c')](handleError(_0x6e5af,null));};exports[_0x7d9a('0x4d')]=function(_0x4ed2f8,_0x1fcff9){var _0x391660={'raw':![],'where':{'id':_0x4ed2f8['params']['id']}},_0x5bd773={};_0x5bd773[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db[_0x7d9a('0x35')][_0x7d9a('0x36')]);_0x5bd773[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x4ed2f8['query']);_0x5bd773['filters']=_[_0x7d9a('0x3c')](_0x5bd773[_0x7d9a('0x39')],_0x5bd773[_0x7d9a('0x3a')]);_0x391660[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0x5bd773[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x4ed2f8[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x391660[_0x7d9a('0x3e')]=_0x391660[_0x7d9a('0x3e')]['length']?_0x391660[_0x7d9a('0x3e')]:_0x5bd773[_0x7d9a('0x39')];if(_0x4ed2f8[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x391660[_0x7d9a('0x4e')]=[{'all':!![]}];}_0x391660=_[_0x7d9a('0x47')]({},_0x391660,_0x4ed2f8[_0x7d9a('0x49')]);return db[_0x7d9a('0x35')][_0x7d9a('0x4f')](_0x391660)[_0x7d9a('0x26')](handleEntityNotFound(_0x1fcff9,null))[_0x7d9a('0x26')](respondWithResult(_0x1fcff9,null))[_0x7d9a('0x4c')](handleError(_0x1fcff9,null));};exports[_0x7d9a('0x50')]=function(_0x58f3c3,_0x227401){return db[_0x7d9a('0x35')][_0x7d9a('0x50')](_0x58f3c3[_0x7d9a('0x51')],{})[_0x7d9a('0x26')](function(_0x4e84fb){var _0x1d0242=_0x58f3c3[_0x7d9a('0x52')]['get']({'plain':!![]});if(!_0x1d0242)throw new Error(_0x7d9a('0x53'));if(_0x1d0242[_0x7d9a('0x54')]===_0x7d9a('0x52')){var _0x50f3dd=_0x4e84fb[_0x7d9a('0x28')]({'plain':!![]});var _0x14fab5=[{'name':'VoiceQueues','value':_0x7d9a('0x2a')},{'name':'QueueCampaigns','value':_0x7d9a('0x55')}];var _0xea0c86=_[_0x7d9a('0x4f')](_0x14fab5,['value',_0x50f3dd[_0x7d9a('0x2f')]])['name'];return db[_0x7d9a('0x56')]['find']({'where':{'name':_0xea0c86,'userProfileId':_0x1d0242[_0x7d9a('0x57')]},'raw':!![]})['then'](function(_0x2f3c08){if(_0x2f3c08&&_0x2f3c08['autoAssociation']===0x0){return db[_0x7d9a('0x31')][_0x7d9a('0x50')]({'name':_0x50f3dd[_0x7d9a('0x30')],'resourceId':_0x50f3dd['id'],'type':_0x2f3c08[_0x7d9a('0x30')],'sectionId':_0x2f3c08['id']},{})[_0x7d9a('0x26')](function(){return _0x4e84fb;});}else{return _0x4e84fb;}})[_0x7d9a('0x4c')](function(_0x2b93a2){logger[_0x7d9a('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b93a2);throw _0x2b93a2;});}return _0x4e84fb;})[_0x7d9a('0x26')](respondWithResult(_0x227401,0xc9))['catch'](handleError(_0x227401,null));};exports[_0x7d9a('0x58')]=function(_0x4e091d,_0x52f533){var _0x49e256={'where':{'id':_0x4e091d['params']['id']}},_0x5a8dee={};_0x5a8dee[_0x7d9a('0x39')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x49e256['attributes']=_[_0x7d9a('0x3c')](_0x5a8dee[_0x7d9a('0x39')],qs['fields'](_0x4e091d['query'][_0x7d9a('0x3d')]));_0x49e256[_0x7d9a('0x3e')]=_0x49e256['attributes'][_0x7d9a('0x3f')]?_0x49e256[_0x7d9a('0x3e')]:_0x5a8dee[_0x7d9a('0x39')];if(_0x4e091d[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x49e256[_0x7d9a('0x4e')]=[{'all':!![]}];}_0x49e256=_[_0x7d9a('0x47')]({},_0x49e256,_0x4e091d['options']);return db[_0x7d9a('0x35')][_0x7d9a('0x4f')](_0x49e256)['then'](handleEntityNotFound(_0x52f533,null))[_0x7d9a('0x26')](function(_0x2e61e6){if(_0x2e61e6){var _0x454035=_0x2e61e6[_0x7d9a('0x28')]({'plain':!![]});_0x454035=qs[_0x7d9a('0x59')](_0x454035,['id',_0x7d9a('0x5a'),_0x7d9a('0x5b')]);_0x4e091d[_0x7d9a('0x51')]=_[_0x7d9a('0x59')](_0x4e091d['body'],['id',_0x7d9a('0x5a'),_0x7d9a('0x5b')]);return db[_0x7d9a('0x35')]['create'](_['merge'](_0x454035,_0x4e091d[_0x7d9a('0x51')]),{'include':_0x4e091d['query'][_0x7d9a('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x5889cf){var _0x4d1fc5=_0x4e091d[_0x7d9a('0x52')][_0x7d9a('0x28')]({'plain':!![]});if(!_0x4d1fc5)throw new Error(_0x7d9a('0x53'));if(_0x4d1fc5[_0x7d9a('0x54')]===_0x7d9a('0x52')){var _0xf0f690=_0x5889cf[_0x7d9a('0x28')]({'plain':!![]});var _0x573acf=[{'name':_0x7d9a('0x29'),'value':_0x7d9a('0x2a')},{'name':_0x7d9a('0x2b'),'value':_0x7d9a('0x55')}];var _0x51fe67=_[_0x7d9a('0x4f')](_0x573acf,['value',_0xf0f690['type']])[_0x7d9a('0x30')];return db[_0x7d9a('0x56')][_0x7d9a('0x4f')]({'where':{'name':_0x51fe67,'userProfileId':_0x4d1fc5[_0x7d9a('0x57')]},'raw':!![]})[_0x7d9a('0x26')](function(_0x37f9a6){if(_0x37f9a6&&_0x37f9a6[_0x7d9a('0x5c')]===0x0){return db[_0x7d9a('0x31')][_0x7d9a('0x50')]({'name':_0xf0f690[_0x7d9a('0x30')],'resourceId':_0xf0f690['id'],'type':_0x37f9a6[_0x7d9a('0x30')],'sectionId':_0x37f9a6['id']},{})[_0x7d9a('0x26')](function(){return _0x5889cf;});}else{return _0x5889cf;}})[_0x7d9a('0x4c')](function(_0x7b0764){logger[_0x7d9a('0x32')](_0x7d9a('0x5d'),_0x7b0764);throw _0x7b0764;});}return _0x5889cf;});}})['then'](respondWithResult(_0x52f533,0xc9))[_0x7d9a('0x4c')](handleError(_0x52f533,null));};exports[_0x7d9a('0x5e')]=function(_0x2b999b,_0x49be12){if(_0x2b999b[_0x7d9a('0x51')]['id']){delete _0x2b999b[_0x7d9a('0x51')]['id'];}return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x2b999b[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x49be12,null))[_0x7d9a('0x26')](saveUpdates(_0x2b999b[_0x7d9a('0x51')],null))['then'](respondWithResult(_0x49be12,null))[_0x7d9a('0x4c')](handleError(_0x49be12,null));};exports[_0x7d9a('0x27')]=function(_0x317402,_0x1fbb7b){return db[_0x7d9a('0x35')][_0x7d9a('0x4f')]({'where':{'id':_0x317402[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x1fbb7b,null))[_0x7d9a('0x26')](removeEntity(_0x1fbb7b,null))['catch'](handleError(_0x1fbb7b,null));};exports[_0x7d9a('0x60')]=function(_0x128372,_0x26bff1,_0x1aab06){var _0x47cb61={'raw':![],'where':{}};var _0xc5182e={};var _0x2af10f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7d9a('0x61')]({'where':{'id':_0x128372[_0x7d9a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x26bff1,null))[_0x7d9a('0x26')](function(_0x2b89c5){if(_0x2b89c5){_0xc5182e[_0x7d9a('0x39')]=_['keys'](db['CmHopper'][_0x7d9a('0x36')]);_0xc5182e[_0x7d9a('0x3a')]=_['keys'](_0x128372[_0x7d9a('0x3a')]);_0xc5182e['filters']=_[_0x7d9a('0x3c')](_0xc5182e[_0x7d9a('0x39')],_0xc5182e[_0x7d9a('0x3a')]);_0x47cb61[_0x7d9a('0x3e')]=_['intersection'](_0xc5182e['model'],qs[_0x7d9a('0x3d')](_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x47cb61[_0x7d9a('0x3e')]=_0x47cb61[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x47cb61['attributes']:_0xc5182e['model'];if(!_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x47cb61[_0x7d9a('0x41')]=qs['limit'](_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x47cb61[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x47cb61[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x128372[_0x7d9a('0x3a')]['sort']);_0x47cb61[_0x7d9a('0x44')]=qs['filters'](_['pick'](_0x128372[_0x7d9a('0x3a')],_0xc5182e[_0x7d9a('0x45')]));_0x47cb61[_0x7d9a('0x44')][_0x7d9a('0x63')]=_0x2b89c5['id'];if(_0x128372['query'][_0x7d9a('0x2c')]){_0x47cb61[_0x7d9a('0x44')]=_['merge'](_0x47cb61[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x47cb61[_0x7d9a('0x3e')],function(_0x290b35){var _0x1a62bc={};_0x1a62bc[_0x290b35]={'$like':'%'+_0x128372[_0x7d9a('0x3a')]['filter']+'%'};return _0x1a62bc;})});}_0x47cb61=_[_0x7d9a('0x47')]({},_0x47cb61,_0x128372['options']);return db[_0x7d9a('0x64')][_0x7d9a('0x20')]({'where':_0x47cb61[_0x7d9a('0x44')]})[_0x7d9a('0x26')](function(_0x1677e5){_0x2af10f[_0x7d9a('0x20')]=_0x1677e5;if(_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x47cb61['include']=[{'all':!![]}];}return db[_0x7d9a('0x64')][_0x7d9a('0x65')](_0x47cb61);})['then'](function(_0x4f2a9d){_0x2af10f[_0x7d9a('0x4b')]=_0x4f2a9d;return _0x2af10f;});}})[_0x7d9a('0x26')](respondWithFilteredResult(_0x26bff1,_0x47cb61))[_0x7d9a('0x4c')](handleError(_0x26bff1,null));};exports[_0x7d9a('0x66')]=function(_0x24b1ab,_0x5d89e6,_0x2baab8){var _0x3ef1c3={'raw':!![],'where':{}};var _0xaf98a8={};var _0x26fd0b={'count':0x0,'rows':[]};return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x24b1ab[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x5d89e6,null))[_0x7d9a('0x26')](function(_0x58452f){if(_0x58452f){_0xaf98a8[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db['CmHopperHistory'][_0x7d9a('0x36')]);_0xaf98a8[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x24b1ab['query']);_0xaf98a8[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0xaf98a8[_0x7d9a('0x39')],_0xaf98a8[_0x7d9a('0x3a')]);_0x3ef1c3[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0xaf98a8[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x24b1ab['query']['fields']));_0x3ef1c3[_0x7d9a('0x3e')]=_0x3ef1c3[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x3ef1c3['attributes']:_0xaf98a8[_0x7d9a('0x39')];if(!_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x3ef1c3['limit']=qs[_0x7d9a('0x41')](_0x24b1ab['query'][_0x7d9a('0x41')]);_0x3ef1c3[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x24b1ab['query'][_0x7d9a('0x21')]);}_0x3ef1c3['order']=qs['sort'](_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x3ef1c3[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_['pick'](_0x24b1ab[_0x7d9a('0x3a')],_0xaf98a8['filters']));_0x3ef1c3[_0x7d9a('0x44')][_0x7d9a('0x63')]=_0x58452f['id'];if(_0x24b1ab['query'][_0x7d9a('0x2c')]){_0x3ef1c3[_0x7d9a('0x44')]=_['merge'](_0x3ef1c3['where'],{'$or':_['map'](_0x3ef1c3[_0x7d9a('0x3e')],function(_0x499d43){var _0x1a7339={};_0x1a7339[_0x499d43]={'$like':'%'+_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x1a7339;})});}_0x3ef1c3=_[_0x7d9a('0x47')]({},_0x3ef1c3,_0x24b1ab[_0x7d9a('0x49')]);return db[_0x7d9a('0x67')][_0x7d9a('0x20')]({'where':_0x3ef1c3[_0x7d9a('0x44')]})['then'](function(_0x20ec9f){_0x26fd0b[_0x7d9a('0x20')]=_0x20ec9f;if(_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x3ef1c3[_0x7d9a('0x4e')]=[{'all':!![]}];}return db[_0x7d9a('0x67')][_0x7d9a('0x65')](_0x3ef1c3);})[_0x7d9a('0x26')](function(_0x4ed908){_0x26fd0b[_0x7d9a('0x4b')]=_0x4ed908;return _0x26fd0b;});}})[_0x7d9a('0x26')](respondWithFilteredResult(_0x5d89e6,_0x3ef1c3))[_0x7d9a('0x4c')](handleError(_0x5d89e6,null));};exports['getHopperFinals']=function(_0x16e9b8,_0x35ae2e,_0x229e43){var _0x41efd1={'raw':!![],'where':{}};var _0x359f60={};var _0xb2bb40={'count':0x0,'rows':[]};return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x16e9b8[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x35ae2e,null))[_0x7d9a('0x26')](function(_0x59327c){if(_0x59327c){_0x359f60[_0x7d9a('0x39')]=_['keys'](db[_0x7d9a('0x68')][_0x7d9a('0x36')]);_0x359f60[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x16e9b8[_0x7d9a('0x3a')]);_0x359f60[_0x7d9a('0x45')]=_['intersection'](_0x359f60[_0x7d9a('0x39')],_0x359f60['query']);_0x41efd1['attributes']=_[_0x7d9a('0x3c')](_0x359f60[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x16e9b8[_0x7d9a('0x3a')]['fields']));_0x41efd1[_0x7d9a('0x3e')]=_0x41efd1['attributes'][_0x7d9a('0x3f')]?_0x41efd1['attributes']:_0x359f60[_0x7d9a('0x39')];if(!_0x16e9b8['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x41efd1[_0x7d9a('0x41')]=qs['limit'](_0x16e9b8[_0x7d9a('0x3a')]['limit']);_0x41efd1['offset']=qs[_0x7d9a('0x21')](_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x41efd1[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x41efd1[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_['pick'](_0x16e9b8[_0x7d9a('0x3a')],_0x359f60['filters']));_0x41efd1[_0x7d9a('0x44')]['VoiceQueueId']=_0x59327c['id'];if(_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x41efd1[_0x7d9a('0x44')]=_['merge'](_0x41efd1[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x41efd1[_0x7d9a('0x3e')],function(_0x1dacfc){var _0x2818ae={};_0x2818ae[_0x1dacfc]={'$like':'%'+_0x16e9b8['query']['filter']+'%'};return _0x2818ae;})});}_0x41efd1=_[_0x7d9a('0x47')]({},_0x41efd1,_0x16e9b8['options']);return db[_0x7d9a('0x68')][_0x7d9a('0x20')]({'where':_0x41efd1[_0x7d9a('0x44')]})[_0x7d9a('0x26')](function(_0x5bb444){_0xb2bb40['count']=_0x5bb444;if(_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x41efd1[_0x7d9a('0x4e')]=[{'all':!![]}];}return db[_0x7d9a('0x68')][_0x7d9a('0x65')](_0x41efd1);})['then'](function(_0xda61b5){_0xb2bb40[_0x7d9a('0x4b')]=_0xda61b5;return _0xb2bb40;});}})[_0x7d9a('0x26')](respondWithFilteredResult(_0x35ae2e,_0x41efd1))[_0x7d9a('0x4c')](handleError(_0x35ae2e,null));};exports['getHopperBlacks']=function(_0x1c5802,_0xd5946d,_0x510b65){var _0x4faebc={'raw':!![],'where':{}};var _0xf3ed8f={};var _0x46fd0d={'count':0x0,'rows':[]};return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x1c5802['params']['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0xd5946d,null))['then'](function(_0x2e7061){if(_0x2e7061){_0xf3ed8f['model']=_[_0x7d9a('0x3b')](db[_0x7d9a('0x69')][_0x7d9a('0x36')]);_0xf3ed8f[_0x7d9a('0x3a')]=_['keys'](_0x1c5802[_0x7d9a('0x3a')]);_0xf3ed8f['filters']=_['intersection'](_0xf3ed8f[_0x7d9a('0x39')],_0xf3ed8f['query']);_0x4faebc[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0xf3ed8f[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x4faebc[_0x7d9a('0x3e')]=_0x4faebc[_0x7d9a('0x3e')]['length']?_0x4faebc[_0x7d9a('0x3e')]:_0xf3ed8f[_0x7d9a('0x39')];if(!_0x1c5802['query']['hasOwnProperty'](_0x7d9a('0x62'))){_0x4faebc['limit']=qs[_0x7d9a('0x41')](_0x1c5802['query'][_0x7d9a('0x41')]);_0x4faebc[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x4faebc[_0x7d9a('0x42')]=qs['sort'](_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x4faebc[_0x7d9a('0x44')]=qs['filters'](_['pick'](_0x1c5802[_0x7d9a('0x3a')],_0xf3ed8f[_0x7d9a('0x45')]));_0x4faebc[_0x7d9a('0x44')][_0x7d9a('0x63')]=_0x2e7061['id'];if(_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x4faebc['where']=_[_0x7d9a('0x47')](_0x4faebc[_0x7d9a('0x44')],{'$or':_['map'](_0x4faebc[_0x7d9a('0x3e')],function(_0x2a0751){var _0x582d24={};_0x582d24[_0x2a0751]={'$like':'%'+_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x582d24;})});}_0x4faebc=_[_0x7d9a('0x47')]({},_0x4faebc,_0x1c5802[_0x7d9a('0x49')]);return db['CmHopperBlack'][_0x7d9a('0x20')]({'where':_0x4faebc[_0x7d9a('0x44')]})[_0x7d9a('0x26')](function(_0x4299bb){_0x46fd0d[_0x7d9a('0x20')]=_0x4299bb;if(_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x4faebc[_0x7d9a('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7d9a('0x65')](_0x4faebc);})['then'](function(_0x540bfa){_0x46fd0d[_0x7d9a('0x4b')]=_0x540bfa;return _0x46fd0d;});}})['then'](respondWithFilteredResult(_0xd5946d,_0x4faebc))[_0x7d9a('0x4c')](handleError(_0xd5946d,null));};exports[_0x7d9a('0x6a')]=function(_0x55ce9f,_0xc5aa95,_0x1c2612){var _0x4172ee={};var _0x3043b6={};var _0x229523;var _0x19f109;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x55ce9f['params']['id']}})['then'](handleEntityNotFound(_0xc5aa95,null))['then'](function(_0x49c52a){if(_0x49c52a){_0x229523=_0x49c52a;_0x3043b6[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db[_0x7d9a('0x6b')]['rawAttributes']);_0x3043b6[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x55ce9f[_0x7d9a('0x3a')]);_0x3043b6[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x3043b6[_0x7d9a('0x39')],_0x3043b6[_0x7d9a('0x3a')]);_0x4172ee[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0x3043b6[_0x7d9a('0x39')],qs['fields'](_0x55ce9f[_0x7d9a('0x3a')]['fields']));_0x4172ee[_0x7d9a('0x3e')]=_0x4172ee[_0x7d9a('0x3e')]['length']?_0x4172ee[_0x7d9a('0x3e')]:_0x3043b6[_0x7d9a('0x39')];_0x4172ee['order']=qs[_0x7d9a('0x43')](_0x55ce9f[_0x7d9a('0x3a')]['sort']);_0x4172ee[_0x7d9a('0x44')]=qs['filters'](_['pick'](_0x55ce9f[_0x7d9a('0x3a')],_0x3043b6[_0x7d9a('0x45')]));if(_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x4172ee[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x4172ee['where'],{'$or':_['map'](_0x4172ee[_0x7d9a('0x3e')],function(_0x3bb1f9){var _0x27419c={};_0x27419c[_0x3bb1f9]={'$like':'%'+_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x27419c;})});}_0x4172ee=_[_0x7d9a('0x47')]({},_0x4172ee,_0x55ce9f[_0x7d9a('0x49')]);return _0x229523['getTeams'](_0x4172ee);}})[_0x7d9a('0x26')](function(_0x5d5f74){if(_0x5d5f74){_0x19f109=_0x5d5f74['length'];if(!_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x4172ee[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x4172ee[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}return _0x229523['getTeams'](_0x4172ee);}})[_0x7d9a('0x26')](function(_0x58d353){if(_0x58d353){return _0x58d353?{'count':_0x19f109,'rows':_0x58d353}:null;}})['then'](respondWithResult(_0xc5aa95,null))[_0x7d9a('0x4c')](handleError(_0xc5aa95,null));};exports[_0x7d9a('0x6c')]=function(_0x44b34c,_0x430a24,_0x328151){var _0x257956=_0x44b34c[_0x7d9a('0x51')][_0x7d9a('0x6d')];var _0x4aa765=_[_0x7d9a('0x2d')](_0x257956,'id');return db[_0x7d9a('0x6b')][_0x7d9a('0x65')]({'where':{'id':_0x4aa765},'attributes':['id'],'include':[{'model':db[_0x7d9a('0x6e')],'as':_0x7d9a('0x6f'),'attributes':['id',_0x7d9a('0x30'),_0x7d9a('0x70'),_0x7d9a('0x71'),'interface'],'raw':!![]}]})[_0x7d9a('0x26')](function(_0x550888){if(_0x550888){var _0x2689e7=_['flatMap'](_0x550888,function(_0xa4b66d){var _0x3a54cc=_0xa4b66d[_0x7d9a('0x28')]({'plain':!![]});_0x3a54cc['Agents'][_0x7d9a('0x72')](function(_0x5ea96e){_0x5ea96e[_0x7d9a('0x73')]=_[_0x7d9a('0x4f')](_0x257956,{'id':_0x3a54cc['id']})[_0x7d9a('0x73')];});return _0x3a54cc[_0x7d9a('0x6f')];});return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x44b34c['params']['id']}})[_0x7d9a('0x26')](function(_0x5d1ff5){return db['sequelize']['transaction'](function(_0x4ef66e){return _0x5d1ff5[_0x7d9a('0x6c')](_0x4aa765,{'transaction':_0x4ef66e})[_0x7d9a('0x26')](function(){return BPromise[_0x7d9a('0x74')](_0x2689e7,function(_0x4c79ca){return db[_0x7d9a('0x75')][_0x7d9a('0x76')]({'where':{'UserId':_0x4c79ca['id'],'VoiceQueueId':_0x44b34c[_0x7d9a('0x5f')]['id']},'defaults':{'penalty':_0x4c79ca[_0x7d9a('0x73')]},'transaction':_0x4ef66e});});})[_0x7d9a('0x26')](function(){return BPromise['each'](_[_0x7d9a('0x2c')](_0x2689e7,{'online':!![]}),function(_0x52f0f2){return db[_0x7d9a('0x77')][_0x7d9a('0x78')]({'membername':_0x52f0f2[_0x7d9a('0x30')],'UserId':_0x52f0f2['id'],'queue_name':_0x5d1ff5['name'],'VoiceQueueId':_0x5d1ff5['id'],'interface':_['isNil'](_0x52f0f2[_0x7d9a('0x79')])?util[_0x7d9a('0x7a')](_0x7d9a('0x7b'),_0x52f0f2[_0x7d9a('0x30')]):_0x52f0f2[_0x7d9a('0x79')],'paused':_0x52f0f2[_0x7d9a('0x71')]||![],'penalty':_0x52f0f2[_0x7d9a('0x73')]},{'transaction':_0x4ef66e});});})[_0x7d9a('0x26')](function(){_0x2689e7[_0x7d9a('0x72')](function(_0x45dbb4){socket[_0x7d9a('0x7c')]('userVoiceQueue:save',{'UserId':_0x45dbb4['id'],'VoiceQueueId':_0x5d1ff5['id']});});});});});}})[_0x7d9a('0x26')](respondWithStatusCode(_0x430a24,null))[_0x7d9a('0x4c')](handleError(_0x430a24,null));};exports[_0x7d9a('0x7d')]=function(_0x19ac5b,_0x25f5ec,_0x467a44){return db[_0x7d9a('0x6b')][_0x7d9a('0x65')]({'where':{'id':_0x19ac5b['query'][_0x7d9a('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x7d9a('0x6e')],'as':_0x7d9a('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x7d9a('0x26')](handleEntityNotFound(_0x25f5ec,null))[_0x7d9a('0x26')](function(_0x5a5b80){var _0x4de577=_['map'](_0x5a5b80,'id');var _0x10e750=[];var _0x2d939a=[];var _0x1a536e=squel['select']();_0x1a536e[_0x7d9a('0x7f')](_0x7d9a('0x80'))[_0x7d9a('0x81')](_0x7d9a('0x82'),'tq')[_0x7d9a('0x83')](_0x7d9a('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7d9a('0x44')](_0x7d9a('0x85'),_0x19ac5b[_0x7d9a('0x5f')]['id']);for(var _0x336e28=0x0;_0x336e28<_0x5a5b80[_0x7d9a('0x3f')];_0x336e28+=0x1){let _0x1c20ad=_0x5a5b80[_0x336e28];for(var _0x359420=0x0;_0x359420<_0x1c20ad[_0x7d9a('0x6f')]['length'];_0x359420+=0x1){let _0x3d2f18=_0x1c20ad['Agents'][_0x359420];var _0x2df180=_0x1a536e[_0x7d9a('0x58')]();_0x2df180[_0x7d9a('0x44')]('ut.UserId\x20=\x20?',_0x3d2f18['id']);_0x2d939a[_0x7d9a('0x86')](db[_0x7d9a('0x87')][_0x7d9a('0x3a')](_0x2df180['toString'](),{'type':db['sequelize'][_0x7d9a('0x88')][_0x7d9a('0x89')]})[_0x7d9a('0x26')](function(_0x48d90e){if(_0x48d90e[_0x7d9a('0x3f')]===0x1){return _0x3d2f18['id'];}else{var _0x2e2a11=_[_0x7d9a('0x8a')](_['map'](_0x48d90e,_0x7d9a('0x8b')),function(_0x2699a8){return _['includes'](_0x4de577,_0x2699a8);});if(_0x2e2a11){return _0x3d2f18['id'];}}}));}}return BPromise[_0x7d9a('0x8c')](_0x2d939a)['then'](function(_0x39349c){_0x10e750=_(_0x10e750)[_0x7d9a('0x8d')](_0x39349c)['compact']()[_0x7d9a('0x2e')]();return db[_0x7d9a('0x35')]['find']({'where':{'id':_0x19ac5b['params']['id']}})[_0x7d9a('0x26')](function(_0x4bc5e6){return db['sequelize'][_0x7d9a('0x8e')](function(_0x4a26c5){return _0x4bc5e6[_0x7d9a('0x7d')](_0x19ac5b[_0x7d9a('0x3a')][_0x7d9a('0x7e')],{'transaction':_0x4a26c5})[_0x7d9a('0x26')](function(){if(!_[_0x7d9a('0x8f')](_0x10e750)){return _0x4bc5e6[_0x7d9a('0x90')](_0x10e750,{'transaction':_0x4a26c5})['then'](function(){return db['UserVoiceQueueRt'][_0x7d9a('0x27')]({'where':{'VoiceQueueId':_0x19ac5b[_0x7d9a('0x5f')]['id'],'UserId':_0x10e750},'transaction':_0x4a26c5});});}})['then'](function(){_0x10e750[_0x7d9a('0x72')](function(_0x35c268){socket[_0x7d9a('0x7c')](_0x7d9a('0x91'),{'UserId':_0x35c268,'VoiceQueueId':_0x4bc5e6['id']});});});});});});})[_0x7d9a('0x26')](respondWithStatusCode(_0x25f5ec,null))[_0x7d9a('0x4c')](handleError(_0x25f5ec,null));};exports[_0x7d9a('0x92')]=function(_0x164f9c,_0x84efe8,_0x2f0bfc){var _0x5ce9c3,_0x3ed8fe;return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x164f9c[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x84efe8,null))[_0x7d9a('0x26')](function(_0x57e5aa){if(_0x57e5aa){_0x3ed8fe=_0x57e5aa;return _0x57e5aa['addAgents'](_0x164f9c[_0x7d9a('0x51')][_0x7d9a('0x7e')],_[_0x7d9a('0x59')](_0x164f9c[_0x7d9a('0x51')],['ids','id'])||{})[_0x7d9a('0x93')](function(_0xfd701a){for(var _0xbf559f=0x0;_0xbf559f<_0x164f9c[_0x7d9a('0x51')][_0x7d9a('0x7e')][_0x7d9a('0x3f')];_0xbf559f+=0x1){socket[_0x7d9a('0x7c')](_0x7d9a('0x94'),{'UserId':_0x164f9c[_0x7d9a('0x51')]['ids'][_0xbf559f],'VoiceQueueId':_0x164f9c['params']['id']});}return _0xfd701a;});}})['then'](function(_0x55b40e){_0x5ce9c3=_0x55b40e||[];if(_0x3ed8fe){return db['User'][_0x7d9a('0x65')]({'where':{'id':_0x164f9c[_0x7d9a('0x51')][_0x7d9a('0x7e')]},'attributes':['id','name','online',_0x7d9a('0x71'),_0x7d9a('0x79')],'raw':!![]});}})['then'](function(_0x7f7bbf){if(!_[_0x7d9a('0x8f')](_0x7f7bbf)){var _0x4825b9=[];for(var _0x4a6ce5=0x0;_0x4a6ce5<_0x7f7bbf[_0x7d9a('0x3f')];_0x4a6ce5++){if(_0x7f7bbf[_0x4a6ce5]['online']){_0x4825b9['push'](db['UserVoiceQueueRt'][_0x7d9a('0x78')]({'membername':_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x30')],'UserId':_0x7f7bbf[_0x4a6ce5]['id'],'queue_name':_0x3ed8fe['name'],'VoiceQueueId':_0x3ed8fe['id'],'interface':_[_0x7d9a('0x95')](_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x79')])?util['format'](_0x7d9a('0x7b'),_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x30')]):_0x7f7bbf[_0x4a6ce5]['interface'],'paused':_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x71')]||![],'penalty':_0x164f9c['body'][_0x7d9a('0x73')]||0x0}));}}return BPromise['all'](_0x4825b9);}})['then'](function(){return _0x5ce9c3;})['then'](respondWithResult(_0x84efe8,null))[_0x7d9a('0x4c')](handleError(_0x84efe8,null));};exports['removeAgents']=function(_0x281f02,_0x2eb60c,_0x41ec3f){return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x281f02[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x2eb60c,null))[_0x7d9a('0x26')](function(_0x58dc87){if(_0x58dc87){return _0x58dc87['removeAgents'](_0x281f02[_0x7d9a('0x3a')][_0x7d9a('0x7e')])[_0x7d9a('0x26')](function(){if(_['isArray'](_0x281f02[_0x7d9a('0x3a')][_0x7d9a('0x7e')])){for(var _0x4eebe0=0x0;_0x4eebe0<_0x281f02['query'][_0x7d9a('0x7e')]['length'];_0x4eebe0+=0x1){socket[_0x7d9a('0x7c')](_0x7d9a('0x91'),{'UserId':Number(_0x281f02['query']['ids'][_0x4eebe0]),'VoiceQueueId':Number(_0x281f02[_0x7d9a('0x5f')]['id'])});}}else{socket[_0x7d9a('0x7c')](_0x7d9a('0x91'),{'UserId':Number(_0x281f02[_0x7d9a('0x3a')][_0x7d9a('0x7e')]),'VoiceQueueId':Number(_0x281f02['params']['id'])});}});}})['then'](function(_0x2a45b1){return db[_0x7d9a('0x77')][_0x7d9a('0x27')]({'where':{'VoiceQueueId':_0x281f02['params']['id'],'UserId':_0x281f02['query']['ids']}})[_0x7d9a('0x26')](function(){return _0x2a45b1;});})[_0x7d9a('0x26')](respondWithStatusCode(_0x2eb60c,null))['catch'](handleError(_0x2eb60c,null));};exports['getAgents']=function(_0x410e9f,_0xe5a865,_0x1ebb1c){var _0x4e4fa6={};var _0x352a29={};var _0x28ff2e;var _0x4e2567;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x410e9f[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0xe5a865,null))[_0x7d9a('0x26')](function(_0x599d98){if(_0x599d98){_0x28ff2e=_0x599d98;_0x352a29['model']=_[_0x7d9a('0x3b')](db[_0x7d9a('0x6e')]['rawAttributes']);_0x352a29['query']=_[_0x7d9a('0x3b')](_0x410e9f[_0x7d9a('0x3a')]);_0x352a29[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x352a29['model'],_0x352a29[_0x7d9a('0x3a')]);_0x4e4fa6[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0x352a29['model'],qs[_0x7d9a('0x3d')](_0x410e9f['query'][_0x7d9a('0x3d')]));_0x4e4fa6['attributes']=_0x4e4fa6['attributes'][_0x7d9a('0x3f')]?_0x4e4fa6[_0x7d9a('0x3e')]:_0x352a29['model'];_0x4e4fa6[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x410e9f['query']['sort']);_0x4e4fa6['where']=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0x410e9f[_0x7d9a('0x3a')],_0x352a29['filters']));if(_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x4e4fa6['where']=_[_0x7d9a('0x47')](_0x4e4fa6['where'],{'$or':_['map'](_0x4e4fa6['attributes'],function(_0x159fe9){var _0x32510e={};_0x32510e[_0x159fe9]={'$like':'%'+_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x32510e;})});}_0x4e4fa6=_[_0x7d9a('0x47')]({},_0x4e4fa6,_0x410e9f[_0x7d9a('0x49')]);return _0x28ff2e[_0x7d9a('0x96')](_0x4e4fa6);}})[_0x7d9a('0x26')](function(_0x808107){if(_0x808107){_0x4e2567=_0x808107[_0x7d9a('0x3f')];if(!_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x4e4fa6[_0x7d9a('0x41')]=qs['limit'](_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x4e4fa6[_0x7d9a('0x21')]=qs['offset'](_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}return _0x28ff2e['getAgents'](_0x4e4fa6);}})[_0x7d9a('0x26')](function(_0xe42153){if(_0xe42153){return _0xe42153?{'count':_0x4e2567,'rows':_0xe42153}:null;}})['then'](respondWithResult(_0xe5a865,null))[_0x7d9a('0x4c')](handleError(_0xe5a865,null));};exports[_0x7d9a('0x97')]=function(_0x2e9661,_0x387c35,_0x2c2f53){var _0x43b248={};var _0x2be01c={};var _0x5720ea;var _0x279765;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x2e9661[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x387c35,null))[_0x7d9a('0x26')](function(_0x5bafdf){if(_0x5bafdf){_0x5720ea=_0x5bafdf;_0x2be01c[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db[_0x7d9a('0x77')][_0x7d9a('0x36')]);_0x2be01c['query']=_['keys'](_0x2e9661[_0x7d9a('0x3a')]);_0x2be01c[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x2be01c['model'],_0x2be01c[_0x7d9a('0x3a')]);_0x43b248['attributes']=_[_0x7d9a('0x3c')](_0x2be01c[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x2e9661[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x43b248[_0x7d9a('0x3e')]=_0x43b248[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x43b248['attributes']:_0x2be01c['model'];_0x43b248[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x2e9661[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x43b248[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0x2e9661[_0x7d9a('0x3a')],_0x2be01c['filters']));if(_0x2e9661[_0x7d9a('0x3a')]['filter']){_0x43b248['where']=_[_0x7d9a('0x47')](_0x43b248[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x43b248[_0x7d9a('0x3e')],function(_0x313c3b){var _0xc4c6e0={};_0xc4c6e0[_0x313c3b]={'$like':'%'+_0x2e9661[_0x7d9a('0x3a')]['filter']+'%'};return _0xc4c6e0;})});}_0x43b248=_[_0x7d9a('0x47')]({},_0x43b248,_0x2e9661['options']);return _0x5720ea[_0x7d9a('0x97')](_0x43b248);}})['then'](function(_0x22c3a7){if(_0x22c3a7){_0x279765=_0x22c3a7['length'];if(!_0x2e9661['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x43b248[_0x7d9a('0x41')]=qs['limit'](_0x2e9661['query'][_0x7d9a('0x41')]);_0x43b248['offset']=qs[_0x7d9a('0x21')](_0x2e9661[_0x7d9a('0x3a')]['offset']);}return _0x5720ea['getMembers'](_0x43b248);}})[_0x7d9a('0x26')](function(_0x3ed72a){return _0x3ed72a?{'count':_0x279765,'rows':_0x3ed72a}:null;})[_0x7d9a('0x26')](respondWithResult(_0x387c35,null))[_0x7d9a('0x4c')](handleError(_0x387c35,null));};exports[_0x7d9a('0x98')]=function(_0x457a79,_0x3aa685,_0x2c5ee9){var _0x396200={};var _0x3620c0={};var _0x5778f2;var _0x3ae7a8;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x457a79[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x3aa685,null))[_0x7d9a('0x26')](function(_0x4e2cc5){if(_0x4e2cc5){_0x5778f2=_0x4e2cc5;_0x3620c0[_0x7d9a('0x39')]=_['keys'](db[_0x7d9a('0x99')][_0x7d9a('0x36')]);_0x3620c0[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x457a79[_0x7d9a('0x3a')]);_0x3620c0[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x3620c0['model'],_0x3620c0[_0x7d9a('0x3a')]);_0x396200[_0x7d9a('0x3e')]=_['intersection'](_0x3620c0[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x457a79[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x396200[_0x7d9a('0x3e')]=_0x396200[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x396200[_0x7d9a('0x3e')]:_0x3620c0[_0x7d9a('0x39')];_0x396200[_0x7d9a('0x42')]=qs['sort'](_0x457a79['query'][_0x7d9a('0x43')]);_0x396200['where']=qs[_0x7d9a('0x45')](_['pick'](_0x457a79['query'],_0x3620c0[_0x7d9a('0x45')]));if(_0x457a79[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x396200[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x396200[_0x7d9a('0x44')],{'$or':_['map'](_0x396200[_0x7d9a('0x3e')],function(_0x2aeac0){var _0x143a36={};_0x143a36[_0x2aeac0]={'$like':'%'+_0x457a79['query'][_0x7d9a('0x2c')]+'%'};return _0x143a36;})});}_0x396200=_[_0x7d9a('0x47')]({},_0x396200,_0x457a79['options']);return _0x5778f2[_0x7d9a('0x98')](_0x396200);}})['then'](function(_0x2d474b){if(_0x2d474b){_0x3ae7a8=_0x2d474b[_0x7d9a('0x3f')];if(!_0x457a79['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x396200[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0x457a79['query']['limit']);_0x396200['offset']=qs['offset'](_0x457a79['query']['offset']);}return _0x5778f2[_0x7d9a('0x98')](_0x396200);}})[_0x7d9a('0x26')](function(_0x44fc60){if(_0x44fc60){return _0x44fc60?{'count':_0x3ae7a8,'rows':_0x44fc60}:null;}})[_0x7d9a('0x26')](respondWithResult(_0x3aa685,null))[_0x7d9a('0x4c')](handleError(_0x3aa685,null));};exports[_0x7d9a('0x9a')]=function(_0x21d91f,_0x43f22d,_0x1528bd){var _0x4625c1,_0x2b6ec0;return db[_0x7d9a('0x35')][_0x7d9a('0x4f')]({'where':{'id':_0x21d91f[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x43f22d,null))[_0x7d9a('0x26')](function(_0x1e52e7){if(_0x1e52e7){_0x2b6ec0=_0x1e52e7;return _0x1e52e7['addLists'](_0x21d91f[_0x7d9a('0x51')][_0x7d9a('0x7e')],_[_0x7d9a('0x59')](_0x21d91f[_0x7d9a('0x51')],[_0x7d9a('0x7e'),'id'])||{});}return null;})[_0x7d9a('0x93')](function(_0x3001e7){var _0x45c469;_0x4625c1=_0x3001e7||[];var _0x54eaa3=[];if(_0x3001e7){for(var _0x68ebfc=0x0;_0x68ebfc<_0x3001e7['length'];_0x68ebfc+=0x1){var _0x18264a=_0x3001e7[_0x68ebfc][_0x7d9a('0x28')]({'plain':!![]});_0x2b6ec0[_0x7d9a('0x9b')]=_0x21d91f[_0x7d9a('0x51')][_0x7d9a('0x9b')]?_0x21d91f['body'][_0x7d9a('0x9b')]:_0x2b6ec0[_0x7d9a('0x9b')];switch(_0x2b6ec0[_0x7d9a('0x9b')]){case'always':_0x45c469=squel[_0x7d9a('0x9c')]()[_0x7d9a('0x9d')](_0x7d9a('0x9e'))[_0x7d9a('0x9f')]([_0x7d9a('0xa0'),_0x7d9a('0xa1'),_0x7d9a('0xa2'),'ListId','VoiceQueueId',_0x7d9a('0x5a'),_0x7d9a('0x5b')],squel[_0x7d9a('0xa3')]()[_0x7d9a('0x7f')](_0x7d9a('0xa0'),'phone')[_0x7d9a('0x7f')]('NOW()',_0x7d9a('0xa1'))[_0x7d9a('0x7f')]('id',_0x7d9a('0xa2'))['field'](_0x18264a['CmListId'][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))['field'](_0x21d91f[_0x7d9a('0x5f')]['id']['toString'](),'VoiceQueueId')['field'](_0x7d9a('0xa6'),'createdAt')[_0x7d9a('0x7f')](_0x7d9a('0xa6'),'updatedAt')['from']('cm_contacts')[_0x7d9a('0x44')](_0x7d9a('0xa7'))[_0x7d9a('0x44')]('ListId\x20=\x20?',_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')]())[_0x7d9a('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x7d9a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7d9a('0xa3')]()[_0x7d9a('0x7f')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x7d9a('0xa9'))[_0x7d9a('0x44')]('VoiceQueueId\x20=\x20?',_0x21d91f[_0x7d9a('0x5f')]['id'][_0x7d9a('0xa4')]()))[_0x7d9a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x7d9a('0xaa'))[_0x7d9a('0x81')](_0x7d9a('0x9e'))[_0x7d9a('0x44')](_0x7d9a('0x85'),_0x21d91f['params']['id']['toString']())))[_0x7d9a('0xa4')]();break;case _0x7d9a('0xab'):_0x45c469=squel[_0x7d9a('0x9c')]()[_0x7d9a('0x9d')](_0x7d9a('0x9e'))[_0x7d9a('0x9f')](['phone',_0x7d9a('0xa1'),_0x7d9a('0xa2'),'ListId',_0x7d9a('0x63'),_0x7d9a('0x5a'),_0x7d9a('0x5b')],squel[_0x7d9a('0xa3')]()['field'](_0x7d9a('0xa0'),_0x7d9a('0xa0'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),_0x7d9a('0xa1'))[_0x7d9a('0x7f')]('id','ContactId')[_0x7d9a('0x7f')](_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))[_0x7d9a('0x7f')](_0x21d91f[_0x7d9a('0x5f')]['id'][_0x7d9a('0xa4')](),'VoiceQueueId')['field'](_0x7d9a('0xa6'),_0x7d9a('0x5a'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),_0x7d9a('0x5b'))[_0x7d9a('0x81')](_0x7d9a('0xac'))[_0x7d9a('0x44')](_0x7d9a('0xa7'))[_0x7d9a('0x44')](_0x7d9a('0xad'),_0x18264a[_0x7d9a('0xa8')]['toString']())[_0x7d9a('0x44')](_0x7d9a('0xae'))[_0x7d9a('0x44')](_0x7d9a('0xaf'),squel['select']()[_0x7d9a('0x7f')](_0x7d9a('0xaa'))[_0x7d9a('0x81')](_0x7d9a('0x9e'))[_0x7d9a('0x44')](_0x7d9a('0x85'),_0x21d91f[_0x7d9a('0x5f')]['id']['toString']())))[_0x7d9a('0xa4')]();break;default:_0x45c469=squel['insert']()['into'](_0x7d9a('0x9e'))[_0x7d9a('0x9f')]([_0x7d9a('0xa0'),_0x7d9a('0xa1'),'ContactId','ListId',_0x7d9a('0x63'),_0x7d9a('0x5a'),_0x7d9a('0x5b')],squel[_0x7d9a('0xa3')]()[_0x7d9a('0x7f')](_0x7d9a('0xa0'),_0x7d9a('0xa0'))['field'](_0x7d9a('0xa6'),'scheduledAt')['field']('id','ContactId')[_0x7d9a('0x7f')](_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))[_0x7d9a('0x7f')](_0x21d91f[_0x7d9a('0x5f')]['id']['toString'](),_0x7d9a('0x63'))['field'](_0x7d9a('0xa6'),_0x7d9a('0x5a'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),_0x7d9a('0x5b'))[_0x7d9a('0x81')]('cm_contacts')[_0x7d9a('0x44')](_0x7d9a('0xa7'))['where'](_0x7d9a('0xad'),_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')]())[_0x7d9a('0x44')](_0x7d9a('0xae')))[_0x7d9a('0xa4')]();}_0x54eaa3[_0x7d9a('0x86')](db[_0x7d9a('0x87')][_0x7d9a('0x3a')](_0x45c469));}return BPromise[_0x7d9a('0x8c')](_0x54eaa3);}})[_0x7d9a('0x26')](function(){return _0x4625c1;})[_0x7d9a('0x26')](respondWithResult(_0x43f22d,null))[_0x7d9a('0x4c')](handleError(_0x43f22d,null));};exports[_0x7d9a('0xb0')]=function(_0x155c1c,_0x280a96,_0x3d2d52){return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x155c1c[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x280a96,null))['then'](function(_0x40ff47){if(_0x40ff47){return _0x40ff47[_0x7d9a('0xb0')](_0x155c1c[_0x7d9a('0x3a')][_0x7d9a('0x7e')]);}})[_0x7d9a('0x26')](function(_0x3d66bc){if(_0x3d66bc){return db[_0x7d9a('0x64')][_0x7d9a('0x27')]({'where':{'ListId':_0x155c1c[_0x7d9a('0x3a')]['ids'],'VoiceQueueId':_0x155c1c[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](function(){return _0x3d66bc;});}})['then'](respondWithStatusCode(_0x280a96,null))['catch'](handleError(_0x280a96,null));};exports[_0x7d9a('0xb1')]=function(_0x334652,_0x58fb56,_0x33d54e){var _0x253c71={};var _0x4824={};var _0x297073;var _0x2fa74a;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x334652[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x58fb56,null))[_0x7d9a('0x26')](function(_0x49000f){if(_0x49000f){_0x297073=_0x49000f;_0x4824[_0x7d9a('0x39')]=_['keys'](db['CmList'][_0x7d9a('0x36')]);_0x4824[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x334652[_0x7d9a('0x3a')]);_0x4824[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x4824[_0x7d9a('0x39')],_0x4824['query']);_0x253c71['attributes']=_[_0x7d9a('0x3c')](_0x4824[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x334652[_0x7d9a('0x3a')]['fields']));_0x253c71[_0x7d9a('0x3e')]=_0x253c71['attributes'][_0x7d9a('0x3f')]?_0x253c71[_0x7d9a('0x3e')]:_0x4824[_0x7d9a('0x39')];_0x253c71['order']=qs[_0x7d9a('0x43')](_0x334652[_0x7d9a('0x3a')]['sort']);_0x253c71['where']=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0x334652['query'],_0x4824[_0x7d9a('0x45')]));if(_0x334652[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x253c71[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x253c71[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x253c71[_0x7d9a('0x3e')],function(_0x11a35f){var _0x9fab70={};_0x9fab70[_0x11a35f]={'$like':'%'+_0x334652[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x9fab70;})});}_0x253c71=_[_0x7d9a('0x47')]({},_0x253c71,_0x334652[_0x7d9a('0x49')]);return _0x297073[_0x7d9a('0xb1')](_0x253c71);}})[_0x7d9a('0x26')](function(_0x21643f){if(_0x21643f){_0x2fa74a=_0x21643f[_0x7d9a('0x3f')];if(!_0x334652['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x253c71[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0x334652[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x253c71[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x334652['query'][_0x7d9a('0x21')]);}return _0x297073[_0x7d9a('0xb1')](_0x253c71);}})[_0x7d9a('0x26')](function(_0x426fee){if(_0x426fee){return _0x426fee?{'count':_0x2fa74a,'rows':_0x426fee}:null;}})[_0x7d9a('0x26')](respondWithResult(_0x58fb56,null))[_0x7d9a('0x4c')](handleError(_0x58fb56,null));};exports[_0x7d9a('0xb2')]=function(_0x18b253,_0x4bdce1,_0x9acaa0){var _0x2311f7,_0xd86bf8;return db[_0x7d9a('0x35')]['find']({'where':{'id':_0x18b253[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x4bdce1,null))[_0x7d9a('0x26')](function(_0x3e3b67){if(_0x3e3b67){_0xd86bf8=_0x3e3b67;return _0x3e3b67[_0x7d9a('0xb2')](_0x18b253['body'][_0x7d9a('0x7e')],_['omit'](_0x18b253['body'],[_0x7d9a('0x7e'),'id'])||{});}return null;})[_0x7d9a('0x93')](function(_0x3566fe){var _0x457978;_0x2311f7=_0x3566fe||[];var _0xe106fe=[];if(_0x3566fe){for(var _0x32db8a=0x0;_0x32db8a<_0x3566fe[_0x7d9a('0x3f')];_0x32db8a+=0x1){var _0x19d65d=_0x3566fe[_0x32db8a]['get']({'plain':!![]});_0x457978=squel[_0x7d9a('0x9c')]()[_0x7d9a('0x9d')](_0x7d9a('0xb3'))[_0x7d9a('0x9f')]([_0x7d9a('0xa0'),_0x7d9a('0xa2'),_0x7d9a('0xa5'),_0x7d9a('0x63'),'createdAt',_0x7d9a('0x5b')],squel['select']()['field'](_0x7d9a('0xa0'),_0x7d9a('0xa0'))[_0x7d9a('0x7f')]('id',_0x7d9a('0xa2'))[_0x7d9a('0x7f')](_0x19d65d['CmListId'][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))[_0x7d9a('0x7f')](_0x18b253['params']['id'][_0x7d9a('0xa4')](),'VoiceQueueId')['field']('NOW()',_0x7d9a('0x5a'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),'updatedAt')[_0x7d9a('0x81')](_0x7d9a('0xac'))[_0x7d9a('0x44')](_0x7d9a('0xa7'))['where'](_0x7d9a('0xad'),_0x19d65d['CmListId']['toString']())['where'](_0x7d9a('0xae')))[_0x7d9a('0xa4')]();_0xe106fe[_0x7d9a('0x86')](db[_0x7d9a('0x87')][_0x7d9a('0x3a')](_0x457978));}return BPromise[_0x7d9a('0x8c')](_0xe106fe);}})[_0x7d9a('0x26')](function(){return _0x2311f7;})[_0x7d9a('0x26')](respondWithResult(_0x4bdce1,null))[_0x7d9a('0x4c')](handleError(_0x4bdce1,null));};exports[_0x7d9a('0xb4')]=function(_0x4a0dbc,_0x11ce45,_0x216fbf){return db[_0x7d9a('0x35')][_0x7d9a('0x4f')]({'where':{'id':_0x4a0dbc[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x11ce45,null))[_0x7d9a('0x26')](function(_0x1ab86b){if(_0x1ab86b){return _0x1ab86b[_0x7d9a('0xb4')](_0x4a0dbc[_0x7d9a('0x3a')][_0x7d9a('0x7e')]);}})[_0x7d9a('0x26')](function(_0x216036){if(_0x216036){return db['CmHopperBlack'][_0x7d9a('0x27')]({'where':{'ListId':_0x4a0dbc['query'][_0x7d9a('0x7e')],'VoiceQueueId':_0x4a0dbc['params']['id']}})[_0x7d9a('0x26')](function(){return _0x216036;});}})[_0x7d9a('0x26')](respondWithStatusCode(_0x11ce45,null))[_0x7d9a('0x4c')](handleError(_0x11ce45,null));}; \ No newline at end of file +var _0x91e3=['nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','VoiceQueue','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','role','getHoppers','findOne','CmHopper','order','VoiceQueueId','getHopperHistories','CmHopperHistory','options','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','addTeams','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','push','getAgents','getMembers','CmList','getLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','then','sendStatus','send','index','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x34f8ba,_0x2bb6a8){var _0xa5ed05=function(_0x497771){while(--_0x497771){_0x34f8ba['push'](_0x34f8ba['shift']());}};_0xa5ed05(++_0x2bb6a8);}(_0x91e3,0x132));var _0x391e=function(_0xe7d30b,_0x525bf2){_0xe7d30b=_0xe7d30b-0x0;var _0x2bf356=_0x91e3[_0xe7d30b];return _0x2bf356;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x391e('0x0'));var rimraf=require(_0x391e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x391e('0x2'));var rp=require(_0x391e('0x3'));var moment=require(_0x391e('0x4'));var BPromise=require(_0x391e('0x5'));var Mustache=require(_0x391e('0x6'));var util=require(_0x391e('0x7'));var path=require(_0x391e('0x8'));var sox=require(_0x391e('0x9'));var csv=require('to-csv');var ejs=require(_0x391e('0xa'));var fs=require('fs');var _=require(_0x391e('0xb'));var squel=require(_0x391e('0xc'));var crypto=require(_0x391e('0xd'));var jsforce=require(_0x391e('0xe'));var deskjs=require(_0x391e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x391e('0x10'));var Papa=require(_0x391e('0x11'));var Redis=require(_0x391e('0x12'));var authService=require(_0x391e('0x13'));var qs=require(_0x391e('0x14'));var as=require(_0x391e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x391e('0x16'))(_0x391e('0x17'));var utils=require(_0x391e('0x18'));var config=require(_0x391e('0x19'));var licenseUtil=require(_0x391e('0x1a'));var db=require(_0x391e('0x1b'))['db'];config[_0x391e('0x1c')]=_['defaults'](config[_0x391e('0x1c')],{'host':_0x391e('0x1d'),'port':0x18eb});var socket=require(_0x391e('0x1e'))(new Redis(config[_0x391e('0x1c')]));require(_0x391e('0x1f'))['register'](socket);function respondWithStatusCode(_0x83e07f,_0x265258){_0x265258=_0x265258||0xcc;return function(_0x538412){if(_0x538412){return _0x83e07f['sendStatus'](_0x265258);}return _0x83e07f['status'](_0x265258)[_0x391e('0x20')]();};}function respondWithResult(_0x5d958c,_0x4be201){_0x4be201=_0x4be201||0xc8;return function(_0x392dcd){if(_0x392dcd){return _0x5d958c[_0x391e('0x21')](_0x4be201)[_0x391e('0x22')](_0x392dcd);}};}function respondWithFilteredResult(_0x462a76,_0x228d6e){return function(_0x6cb4c7){if(_0x6cb4c7){var _0x30af10=_0x6cb4c7[_0x391e('0x23')],_0x4cde58=_0x228d6e[_0x391e('0x24')],_0x498289=_0x228d6e[_0x391e('0x24')]+_0x228d6e[_0x391e('0x25')],_0x2e2c6e;if(_0x498289>=_0x30af10){_0x498289=_0x30af10;_0x2e2c6e=0xc8;}else{_0x2e2c6e=0xce;}_0x462a76['status'](_0x2e2c6e);return _0x462a76[_0x391e('0x26')](_0x391e('0x27'),_0x4cde58+'-'+_0x498289+'/'+_0x30af10)[_0x391e('0x22')](_0x6cb4c7);}return null;};}function patchUpdates(_0x70e597){return function(_0x55d8dd){try{jsonpatch[_0x391e('0x28')](_0x55d8dd,_0x70e597,!![]);}catch(_0x62fc19){return BPromise[_0x391e('0x29')](_0x62fc19);}return _0x55d8dd[_0x391e('0x2a')]();};}function saveUpdates(_0x3ce1c5,_0x1fbd4c){return function(_0x46265d){if(_0x46265d){return _0x46265d[_0x391e('0x2b')](_0x3ce1c5)['then'](function(_0x48cd15){return _0x48cd15;});}return null;};}function removeEntity(_0x431b5f,_0x35b008){return function(_0x3aac2b){if(_0x3aac2b){return _0x3aac2b['destroy']()['then'](function(){var _0x27b65a=_0x3aac2b[_0x391e('0x2c')]({'plain':!![]});var _0x5d77f7=[{'name':_0x391e('0x2d'),'value':_0x391e('0x2e'),'ignore':![]},{'name':_0x391e('0x2f'),'value':_0x391e('0x30'),'ignore':![]}];var _0xe2e34a=_(_0x5d77f7)[_0x391e('0x31')](_0x391e('0x32'))[_0x391e('0x33')](_0x391e('0x34'))['value']();if(_[_0x391e('0x35')](_0xe2e34a,_0x27b65a[_0x391e('0x36')])){return;}var _0x49532c=_[_0x391e('0x37')](_0x5d77f7,[_0x391e('0x34'),_0x27b65a[_0x391e('0x36')]])[_0x391e('0x38')];return db[_0x391e('0x39')][_0x391e('0x3a')]({'where':{'type':_0x49532c,'resourceId':_0x27b65a['id']}})['then'](function(){return _0x3aac2b;});})[_0x391e('0x3b')](function(){_0x431b5f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bd63,_0x41f55a){return function(_0x1225b8){if(!_0x1225b8){_0x47bd63[_0x391e('0x3c')](0x194);}return _0x1225b8;};}function handleError(_0x122d7a,_0x42d090){_0x42d090=_0x42d090||0x1f4;return function(_0xbfa1f3){logger['error'](_0xbfa1f3['stack']);if(_0xbfa1f3['name']){delete _0xbfa1f3[_0x391e('0x38')];}_0x122d7a[_0x391e('0x21')](_0x42d090)[_0x391e('0x3d')](_0xbfa1f3);};}exports[_0x391e('0x3e')]=function(_0x190758,_0x599745){var _0x451d9b={},_0x445c80={},_0x5ea82c={'count':0x0,'rows':[]};var _0xc5af4a=_[_0x391e('0x33')](db['VoiceQueue']['rawAttributes'],function(_0xa780e5){return{'name':_0xa780e5[_0x391e('0x3f')],'type':_0xa780e5[_0x391e('0x36')][_0x391e('0x40')]};});_0x445c80['model']=_['map'](_0xc5af4a,_0x391e('0x38'));_0x445c80['query']=_[_0x391e('0x41')](_0x190758[_0x391e('0x42')]);_0x445c80[_0x391e('0x43')]=_[_0x391e('0x44')](_0x445c80[_0x391e('0x45')],_0x445c80[_0x391e('0x42')]);_0x451d9b[_0x391e('0x46')]=_[_0x391e('0x44')](_0x445c80[_0x391e('0x45')],qs[_0x391e('0x47')](_0x190758[_0x391e('0x42')][_0x391e('0x47')]));_0x451d9b['attributes']=_0x451d9b[_0x391e('0x46')][_0x391e('0x48')]?_0x451d9b[_0x391e('0x46')]:_0x445c80['model'];if(!_0x190758[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x451d9b[_0x391e('0x25')]=qs['limit'](_0x190758[_0x391e('0x42')][_0x391e('0x25')]);_0x451d9b['offset']=qs[_0x391e('0x24')](_0x190758[_0x391e('0x42')][_0x391e('0x24')]);}_0x451d9b['order']=qs[_0x391e('0x4b')](_0x190758[_0x391e('0x42')][_0x391e('0x4b')]);_0x451d9b[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x190758[_0x391e('0x42')],_0x445c80[_0x391e('0x43')]),_0xc5af4a);if(_0x190758[_0x391e('0x42')][_0x391e('0x31')]){_0x451d9b[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x451d9b[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0xc5af4a,function(_0x2d8142){if(_0x2d8142[_0x391e('0x36')]!==_0x391e('0x4f')){var _0x5e3e49={};_0x5e3e49[_0x2d8142[_0x391e('0x38')]]={'$like':'%'+_0x190758[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x5e3e49;}})});}_0x451d9b=_[_0x391e('0x4e')]({},_0x451d9b,_0x190758['options']);var _0x41f39c={'where':_0x451d9b[_0x391e('0x4c')]};return db['VoiceQueue'][_0x391e('0x23')](_0x41f39c)['then'](function(_0x4073b4){_0x5ea82c[_0x391e('0x23')]=_0x4073b4;if(_0x190758['query'][_0x391e('0x50')]){_0x451d9b[_0x391e('0x51')]=[{'all':!![]}];}return db[_0x391e('0x52')][_0x391e('0x53')](_0x451d9b);})['then'](function(_0xf2324c){_0x5ea82c[_0x391e('0x54')]=_0xf2324c;return _0x5ea82c;})['then'](respondWithFilteredResult(_0x599745,_0x451d9b))[_0x391e('0x55')](handleError(_0x599745,null));};exports[_0x391e('0x56')]=function(_0x265586,_0x51567){var _0x431227={'raw':![],'where':{'id':_0x265586[_0x391e('0x57')]['id']}},_0x24c270={};_0x24c270[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x52')][_0x391e('0x58')]);_0x24c270['query']=_[_0x391e('0x41')](_0x265586['query']);_0x24c270[_0x391e('0x43')]=_[_0x391e('0x44')](_0x24c270['model'],_0x24c270[_0x391e('0x42')]);_0x431227['attributes']=_[_0x391e('0x44')](_0x24c270[_0x391e('0x45')],qs['fields'](_0x265586['query']['fields']));_0x431227['attributes']=_0x431227['attributes'][_0x391e('0x48')]?_0x431227[_0x391e('0x46')]:_0x24c270[_0x391e('0x45')];if(_0x265586[_0x391e('0x42')][_0x391e('0x50')]){_0x431227[_0x391e('0x51')]=[{'all':!![]}];}_0x431227=_['merge']({},_0x431227,_0x265586['options']);return db[_0x391e('0x52')]['find'](_0x431227)[_0x391e('0x3b')](handleEntityNotFound(_0x51567,null))[_0x391e('0x3b')](respondWithResult(_0x51567,null))[_0x391e('0x55')](handleError(_0x51567,null));};exports[_0x391e('0x59')]=function(_0x1adb23,_0x5f3c54){return db[_0x391e('0x52')][_0x391e('0x59')](_0x1adb23[_0x391e('0x5a')],{})[_0x391e('0x3b')](function(_0x3a0f80){var _0x357f7e=_0x1adb23[_0x391e('0x5b')][_0x391e('0x2c')]({'plain':!![]});if(!_0x357f7e)throw new Error(_0x391e('0x5c'));if(_0x357f7e['role']===_0x391e('0x5b')){var _0x4cedea=_0x3a0f80[_0x391e('0x2c')]({'plain':!![]});var _0x5f25a9=[{'name':_0x391e('0x2d'),'value':_0x391e('0x2e')},{'name':_0x391e('0x2f'),'value':_0x391e('0x30')}];var _0x3c9a6b=_[_0x391e('0x37')](_0x5f25a9,[_0x391e('0x34'),_0x4cedea[_0x391e('0x36')]])['name'];return db['UserProfileSection'][_0x391e('0x37')]({'where':{'name':_0x3c9a6b,'userProfileId':_0x357f7e[_0x391e('0x5d')]},'raw':!![]})[_0x391e('0x3b')](function(_0x11f301){if(_0x11f301&&_0x11f301[_0x391e('0x5e')]===0x0){return db[_0x391e('0x39')][_0x391e('0x59')]({'name':_0x4cedea[_0x391e('0x38')],'resourceId':_0x4cedea['id'],'type':_0x11f301[_0x391e('0x38')],'sectionId':_0x11f301['id']},{})[_0x391e('0x3b')](function(){return _0x3a0f80;});}else{return _0x3a0f80;}})[_0x391e('0x55')](function(_0x280224){logger[_0x391e('0x5f')](_0x391e('0x60'),_0x280224);throw _0x280224;});}return _0x3a0f80;})['then'](respondWithResult(_0x5f3c54,0xc9))[_0x391e('0x55')](handleError(_0x5f3c54,null));};exports[_0x391e('0x61')]=function(_0x418d64,_0x3cb59c){var _0xbd18ba={'where':{'id':_0x418d64[_0x391e('0x57')]['id']}},_0xd07466={};_0xd07466['model']=_[_0x391e('0x41')](db['VoiceQueue'][_0x391e('0x58')]);_0xbd18ba['attributes']=_[_0x391e('0x44')](_0xd07466[_0x391e('0x45')],qs['fields'](_0x418d64['query']['fields']));_0xbd18ba[_0x391e('0x46')]=_0xbd18ba[_0x391e('0x46')][_0x391e('0x48')]?_0xbd18ba['attributes']:_0xd07466[_0x391e('0x45')];if(_0x418d64[_0x391e('0x42')][_0x391e('0x50')]){_0xbd18ba[_0x391e('0x51')]=[{'all':!![]}];}_0xbd18ba=_[_0x391e('0x4e')]({},_0xbd18ba,_0x418d64['options']);return db[_0x391e('0x52')][_0x391e('0x37')](_0xbd18ba)['then'](handleEntityNotFound(_0x3cb59c,null))[_0x391e('0x3b')](function(_0xbb8ad3){if(_0xbb8ad3){var _0x31a846=_0xbb8ad3['get']({'plain':!![]});_0x31a846=qs['omit'](_0x31a846,['id',_0x391e('0x62'),_0x391e('0x63')]);_0x418d64[_0x391e('0x5a')]=_[_0x391e('0x64')](_0x418d64[_0x391e('0x5a')],['id',_0x391e('0x62'),_0x391e('0x63')]);return db['VoiceQueue'][_0x391e('0x59')](_[_0x391e('0x4e')](_0x31a846,_0x418d64[_0x391e('0x5a')]),{'include':_0x418d64[_0x391e('0x42')][_0x391e('0x50')]?[{'all':!![]}]:undefined})[_0x391e('0x3b')](function(_0x199a13){var _0x4c8c27=_0x418d64[_0x391e('0x5b')]['get']({'plain':!![]});if(!_0x4c8c27)throw new Error(_0x391e('0x5c'));if(_0x4c8c27[_0x391e('0x65')]==='user'){var _0xd2af40=_0x199a13[_0x391e('0x2c')]({'plain':!![]});var _0x1c7eac=[{'name':_0x391e('0x2d'),'value':_0x391e('0x2e')},{'name':'QueueCampaigns','value':_0x391e('0x30')}];var _0x596643=_[_0x391e('0x37')](_0x1c7eac,[_0x391e('0x34'),_0xd2af40[_0x391e('0x36')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x596643,'userProfileId':_0x4c8c27['userProfileId']},'raw':!![]})[_0x391e('0x3b')](function(_0x2f9e5a){if(_0x2f9e5a&&_0x2f9e5a[_0x391e('0x5e')]===0x0){return db[_0x391e('0x39')]['create']({'name':_0xd2af40[_0x391e('0x38')],'resourceId':_0xd2af40['id'],'type':_0x2f9e5a[_0x391e('0x38')],'sectionId':_0x2f9e5a['id']},{})[_0x391e('0x3b')](function(){return _0x199a13;});}else{return _0x199a13;}})[_0x391e('0x55')](function(_0x36e05c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36e05c);throw _0x36e05c;});}return _0x199a13;});}})['then'](respondWithResult(_0x3cb59c,0xc9))['catch'](handleError(_0x3cb59c,null));};exports[_0x391e('0x2b')]=function(_0xefec2b,_0x75bca8){if(_0xefec2b['body']['id']){delete _0xefec2b['body']['id'];}return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0xefec2b['params']['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x75bca8,null))[_0x391e('0x3b')](saveUpdates(_0xefec2b[_0x391e('0x5a')],null))[_0x391e('0x3b')](respondWithResult(_0x75bca8,null))[_0x391e('0x55')](handleError(_0x75bca8,null));};exports['destroy']=function(_0x334b6d,_0x4e028d){return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x334b6d[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x4e028d,null))[_0x391e('0x3b')](removeEntity(_0x4e028d,null))['catch'](handleError(_0x4e028d,null));};exports[_0x391e('0x66')]=function(_0x5888b9,_0x280819,_0x5b49a1){var _0x38d3c3={'raw':![],'where':{}};var _0x3d28b6={};var _0x4725e1={'count':0x0,'rows':[]};return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x5888b9[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x280819,null))[_0x391e('0x3b')](function(_0x3bbfa7){if(_0x3bbfa7){_0x3d28b6['model']=_[_0x391e('0x41')](db[_0x391e('0x68')]['rawAttributes']);_0x3d28b6[_0x391e('0x42')]=_[_0x391e('0x41')](_0x5888b9['query']);_0x3d28b6[_0x391e('0x43')]=_['intersection'](_0x3d28b6['model'],_0x3d28b6[_0x391e('0x42')]);_0x38d3c3[_0x391e('0x46')]=_[_0x391e('0x44')](_0x3d28b6[_0x391e('0x45')],qs[_0x391e('0x47')](_0x5888b9['query'][_0x391e('0x47')]));_0x38d3c3[_0x391e('0x46')]=_0x38d3c3['attributes'][_0x391e('0x48')]?_0x38d3c3[_0x391e('0x46')]:_0x3d28b6[_0x391e('0x45')];if(!_0x5888b9[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x38d3c3[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x5888b9[_0x391e('0x42')]['limit']);_0x38d3c3[_0x391e('0x24')]=qs['offset'](_0x5888b9['query']['offset']);}_0x38d3c3[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x5888b9[_0x391e('0x42')][_0x391e('0x4b')]);_0x38d3c3[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x5888b9[_0x391e('0x42')],_0x3d28b6['filters']));_0x38d3c3[_0x391e('0x4c')][_0x391e('0x6a')]=_0x3bbfa7['id'];if(_0x5888b9[_0x391e('0x42')]['filter']){_0x38d3c3['where']=_['merge'](_0x38d3c3['where'],{'$or':_[_0x391e('0x33')](_0x38d3c3[_0x391e('0x46')],function(_0x435704){var _0x3fef45={};_0x3fef45[_0x435704]={'$like':'%'+_0x5888b9[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x3fef45;})});}_0x38d3c3=_[_0x391e('0x4e')]({},_0x38d3c3,_0x5888b9['options']);return db[_0x391e('0x68')][_0x391e('0x23')]({'where':_0x38d3c3['where']})[_0x391e('0x3b')](function(_0x464722){_0x4725e1['count']=_0x464722;if(_0x5888b9[_0x391e('0x42')]['includeAll']){_0x38d3c3['include']=[{'all':!![]}];}return db['CmHopper'][_0x391e('0x53')](_0x38d3c3);})[_0x391e('0x3b')](function(_0xfac130){_0x4725e1[_0x391e('0x54')]=_0xfac130;return _0x4725e1;});}})[_0x391e('0x3b')](respondWithFilteredResult(_0x280819,_0x38d3c3))[_0x391e('0x55')](handleError(_0x280819,null));};exports[_0x391e('0x6b')]=function(_0x1d383d,_0x49fd4c,_0x32f7a8){var _0x50ed8b={'raw':!![],'where':{}};var _0x135520={};var _0x3fe131={'count':0x0,'rows':[]};return db[_0x391e('0x52')]['findOne']({'where':{'id':_0x1d383d[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x49fd4c,null))[_0x391e('0x3b')](function(_0x52e1dd){if(_0x52e1dd){_0x135520[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x6c')][_0x391e('0x58')]);_0x135520[_0x391e('0x42')]=_[_0x391e('0x41')](_0x1d383d[_0x391e('0x42')]);_0x135520[_0x391e('0x43')]=_[_0x391e('0x44')](_0x135520[_0x391e('0x45')],_0x135520[_0x391e('0x42')]);_0x50ed8b[_0x391e('0x46')]=_[_0x391e('0x44')](_0x135520[_0x391e('0x45')],qs['fields'](_0x1d383d[_0x391e('0x42')][_0x391e('0x47')]));_0x50ed8b[_0x391e('0x46')]=_0x50ed8b[_0x391e('0x46')][_0x391e('0x48')]?_0x50ed8b[_0x391e('0x46')]:_0x135520['model'];if(!_0x1d383d[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x50ed8b[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x1d383d['query']['limit']);_0x50ed8b[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x1d383d[_0x391e('0x42')]['offset']);}_0x50ed8b['order']=qs[_0x391e('0x4b')](_0x1d383d[_0x391e('0x42')][_0x391e('0x4b')]);_0x50ed8b['where']=qs['filters'](_['pick'](_0x1d383d[_0x391e('0x42')],_0x135520['filters']));_0x50ed8b[_0x391e('0x4c')][_0x391e('0x6a')]=_0x52e1dd['id'];if(_0x1d383d[_0x391e('0x42')][_0x391e('0x31')]){_0x50ed8b['where']=_['merge'](_0x50ed8b[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x50ed8b[_0x391e('0x46')],function(_0x394d66){var _0x54544f={};_0x54544f[_0x394d66]={'$like':'%'+_0x1d383d['query'][_0x391e('0x31')]+'%'};return _0x54544f;})});}_0x50ed8b=_[_0x391e('0x4e')]({},_0x50ed8b,_0x1d383d[_0x391e('0x6d')]);return db[_0x391e('0x6c')][_0x391e('0x23')]({'where':_0x50ed8b['where']})[_0x391e('0x3b')](function(_0x2dfd44){_0x3fe131[_0x391e('0x23')]=_0x2dfd44;if(_0x1d383d[_0x391e('0x42')]['includeAll']){_0x50ed8b[_0x391e('0x51')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x391e('0x53')](_0x50ed8b);})[_0x391e('0x3b')](function(_0x1505f0){_0x3fe131['rows']=_0x1505f0;return _0x3fe131;});}})[_0x391e('0x3b')](respondWithFilteredResult(_0x49fd4c,_0x50ed8b))[_0x391e('0x55')](handleError(_0x49fd4c,null));};exports[_0x391e('0x6e')]=function(_0x159ca2,_0x24a293,_0x237582){var _0x38b217={'raw':!![],'where':{}};var _0x2188f4={};var _0x16ac44={'count':0x0,'rows':[]};return db[_0x391e('0x52')]['findOne']({'where':{'id':_0x159ca2[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x24a293,null))[_0x391e('0x3b')](function(_0x52fc4b){if(_0x52fc4b){_0x2188f4[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x6f')][_0x391e('0x58')]);_0x2188f4[_0x391e('0x42')]=_[_0x391e('0x41')](_0x159ca2[_0x391e('0x42')]);_0x2188f4[_0x391e('0x43')]=_[_0x391e('0x44')](_0x2188f4[_0x391e('0x45')],_0x2188f4['query']);_0x38b217[_0x391e('0x46')]=_['intersection'](_0x2188f4[_0x391e('0x45')],qs[_0x391e('0x47')](_0x159ca2[_0x391e('0x42')][_0x391e('0x47')]));_0x38b217[_0x391e('0x46')]=_0x38b217[_0x391e('0x46')][_0x391e('0x48')]?_0x38b217[_0x391e('0x46')]:_0x2188f4[_0x391e('0x45')];if(!_0x159ca2[_0x391e('0x42')]['hasOwnProperty']('nolimit')){_0x38b217[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x159ca2[_0x391e('0x42')][_0x391e('0x25')]);_0x38b217[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x159ca2[_0x391e('0x42')][_0x391e('0x24')]);}_0x38b217[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x159ca2[_0x391e('0x42')][_0x391e('0x4b')]);_0x38b217[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x159ca2[_0x391e('0x42')],_0x2188f4[_0x391e('0x43')]));_0x38b217[_0x391e('0x4c')][_0x391e('0x6a')]=_0x52fc4b['id'];if(_0x159ca2['query'][_0x391e('0x31')]){_0x38b217[_0x391e('0x4c')]=_['merge'](_0x38b217['where'],{'$or':_[_0x391e('0x33')](_0x38b217['attributes'],function(_0x44d839){var _0x4d9e35={};_0x4d9e35[_0x44d839]={'$like':'%'+_0x159ca2[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x4d9e35;})});}_0x38b217=_[_0x391e('0x4e')]({},_0x38b217,_0x159ca2[_0x391e('0x6d')]);return db[_0x391e('0x6f')][_0x391e('0x23')]({'where':_0x38b217[_0x391e('0x4c')]})[_0x391e('0x3b')](function(_0x3fb38d){_0x16ac44[_0x391e('0x23')]=_0x3fb38d;if(_0x159ca2['query'][_0x391e('0x50')]){_0x38b217[_0x391e('0x51')]=[{'all':!![]}];}return db[_0x391e('0x6f')][_0x391e('0x53')](_0x38b217);})[_0x391e('0x3b')](function(_0x5a7d9c){_0x16ac44[_0x391e('0x54')]=_0x5a7d9c;return _0x16ac44;});}})[_0x391e('0x3b')](respondWithFilteredResult(_0x24a293,_0x38b217))[_0x391e('0x55')](handleError(_0x24a293,null));};exports[_0x391e('0x70')]=function(_0x4fb3d9,_0x3b8123,_0x22f602){var _0x13a5be={'raw':!![],'where':{}};var _0xaf5785={};var _0x86737d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x391e('0x67')]({'where':{'id':_0x4fb3d9[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b8123,null))[_0x391e('0x3b')](function(_0x2dcef1){if(_0x2dcef1){_0xaf5785['model']=_[_0x391e('0x41')](db['CmHopperBlack'][_0x391e('0x58')]);_0xaf5785[_0x391e('0x42')]=_[_0x391e('0x41')](_0x4fb3d9[_0x391e('0x42')]);_0xaf5785[_0x391e('0x43')]=_[_0x391e('0x44')](_0xaf5785[_0x391e('0x45')],_0xaf5785[_0x391e('0x42')]);_0x13a5be[_0x391e('0x46')]=_[_0x391e('0x44')](_0xaf5785[_0x391e('0x45')],qs[_0x391e('0x47')](_0x4fb3d9[_0x391e('0x42')]['fields']));_0x13a5be['attributes']=_0x13a5be[_0x391e('0x46')]['length']?_0x13a5be[_0x391e('0x46')]:_0xaf5785[_0x391e('0x45')];if(!_0x4fb3d9[_0x391e('0x42')][_0x391e('0x49')]('nolimit')){_0x13a5be[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x4fb3d9[_0x391e('0x42')]['limit']);_0x13a5be[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x4fb3d9[_0x391e('0x42')][_0x391e('0x24')]);}_0x13a5be[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x4fb3d9[_0x391e('0x42')]['sort']);_0x13a5be['where']=qs['filters'](_[_0x391e('0x4d')](_0x4fb3d9[_0x391e('0x42')],_0xaf5785[_0x391e('0x43')]));_0x13a5be[_0x391e('0x4c')][_0x391e('0x6a')]=_0x2dcef1['id'];if(_0x4fb3d9[_0x391e('0x42')][_0x391e('0x31')]){_0x13a5be[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x13a5be[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x13a5be[_0x391e('0x46')],function(_0x593e2c){var _0x5cb687={};_0x5cb687[_0x593e2c]={'$like':'%'+_0x4fb3d9[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x5cb687;})});}_0x13a5be=_[_0x391e('0x4e')]({},_0x13a5be,_0x4fb3d9['options']);return db[_0x391e('0x71')][_0x391e('0x23')]({'where':_0x13a5be[_0x391e('0x4c')]})[_0x391e('0x3b')](function(_0x483510){_0x86737d[_0x391e('0x23')]=_0x483510;if(_0x4fb3d9[_0x391e('0x42')][_0x391e('0x50')]){_0x13a5be[_0x391e('0x51')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x13a5be);})[_0x391e('0x3b')](function(_0x2f4ea0){_0x86737d[_0x391e('0x54')]=_0x2f4ea0;return _0x86737d;});}})['then'](respondWithFilteredResult(_0x3b8123,_0x13a5be))[_0x391e('0x55')](handleError(_0x3b8123,null));};exports['getTeams']=function(_0x5f1652,_0x364ead,_0x4691ca){var _0x372499={};var _0x20a5bd={};var _0x26f428;var _0x3b6d51;return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x5f1652[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x364ead,null))[_0x391e('0x3b')](function(_0x2795ac){if(_0x2795ac){_0x26f428=_0x2795ac;_0x20a5bd[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x72')][_0x391e('0x58')]);_0x20a5bd[_0x391e('0x42')]=_[_0x391e('0x41')](_0x5f1652[_0x391e('0x42')]);_0x20a5bd['filters']=_[_0x391e('0x44')](_0x20a5bd['model'],_0x20a5bd[_0x391e('0x42')]);_0x372499[_0x391e('0x46')]=_['intersection'](_0x20a5bd[_0x391e('0x45')],qs['fields'](_0x5f1652[_0x391e('0x42')]['fields']));_0x372499[_0x391e('0x46')]=_0x372499['attributes'][_0x391e('0x48')]?_0x372499[_0x391e('0x46')]:_0x20a5bd[_0x391e('0x45')];_0x372499['order']=qs[_0x391e('0x4b')](_0x5f1652[_0x391e('0x42')][_0x391e('0x4b')]);_0x372499[_0x391e('0x4c')]=qs[_0x391e('0x43')](_['pick'](_0x5f1652[_0x391e('0x42')],_0x20a5bd[_0x391e('0x43')]));if(_0x5f1652[_0x391e('0x42')][_0x391e('0x31')]){_0x372499['where']=_[_0x391e('0x4e')](_0x372499['where'],{'$or':_[_0x391e('0x33')](_0x372499['attributes'],function(_0x54309d){var _0x2a8d81={};_0x2a8d81[_0x54309d]={'$like':'%'+_0x5f1652[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x2a8d81;})});}_0x372499=_['merge']({},_0x372499,_0x5f1652['options']);return _0x26f428[_0x391e('0x73')](_0x372499);}})[_0x391e('0x3b')](function(_0x2e387f){if(_0x2e387f){_0x3b6d51=_0x2e387f[_0x391e('0x48')];if(!_0x5f1652['query'][_0x391e('0x49')](_0x391e('0x4a'))){_0x372499[_0x391e('0x25')]=qs['limit'](_0x5f1652[_0x391e('0x42')][_0x391e('0x25')]);_0x372499[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x5f1652[_0x391e('0x42')]['offset']);}return _0x26f428[_0x391e('0x73')](_0x372499);}})['then'](function(_0x6cfce6){if(_0x6cfce6){return _0x6cfce6?{'count':_0x3b6d51,'rows':_0x6cfce6}:null;}})[_0x391e('0x3b')](respondWithResult(_0x364ead,null))['catch'](handleError(_0x364ead,null));};exports['addTeams']=function(_0x417159,_0xbc433a,_0x561c17){var _0x1a7d2c=_0x417159['body'][_0x391e('0x74')];var _0xfbc0a5=_[_0x391e('0x33')](_0x1a7d2c,'id');return db[_0x391e('0x72')][_0x391e('0x53')]({'where':{'id':_0xfbc0a5},'attributes':['id'],'include':[{'model':db[_0x391e('0x75')],'as':_0x391e('0x76'),'attributes':['id','name',_0x391e('0x77'),_0x391e('0x78'),_0x391e('0x79')],'raw':!![]}]})[_0x391e('0x3b')](function(_0x5a70bc){if(_0x5a70bc){var _0x534aa6=_[_0x391e('0x7a')](_0x5a70bc,function(_0x47e86d){var _0x1eed4a=_0x47e86d['get']({'plain':!![]});_0x1eed4a[_0x391e('0x76')]['forEach'](function(_0x3bf713){_0x3bf713[_0x391e('0x7b')]=_['find'](_0x1a7d2c,{'id':_0x1eed4a['id']})[_0x391e('0x7b')];});return _0x1eed4a[_0x391e('0x76')];});return db['VoiceQueue'][_0x391e('0x37')]({'where':{'id':_0x417159[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](function(_0x50d822){return db[_0x391e('0x7c')]['transaction'](function(_0x2a6055){return _0x50d822[_0x391e('0x7d')](_0xfbc0a5,{'transaction':_0x2a6055})['then'](function(){return BPromise[_0x391e('0x7e')](_0x534aa6,function(_0x5f1ab2){return db['UserVoiceQueue'][_0x391e('0x7f')]({'where':{'UserId':_0x5f1ab2['id'],'VoiceQueueId':_0x417159[_0x391e('0x57')]['id']},'defaults':{'penalty':_0x5f1ab2[_0x391e('0x7b')]},'transaction':_0x2a6055});});})[_0x391e('0x3b')](function(){return BPromise[_0x391e('0x7e')](_['filter'](_0x534aa6,{'online':!![]}),function(_0x12963f){return db[_0x391e('0x80')][_0x391e('0x81')]({'membername':_0x12963f['name'],'UserId':_0x12963f['id'],'queue_name':_0x50d822[_0x391e('0x38')],'VoiceQueueId':_0x50d822['id'],'interface':_[_0x391e('0x82')](_0x12963f['interface'])?util[_0x391e('0x83')](_0x391e('0x84'),_0x12963f[_0x391e('0x38')]):_0x12963f['interface'],'paused':_0x12963f[_0x391e('0x78')]||![],'penalty':_0x12963f[_0x391e('0x7b')]},{'transaction':_0x2a6055});});})[_0x391e('0x3b')](function(){_0x534aa6[_0x391e('0x85')](function(_0x363818){socket[_0x391e('0x86')](_0x391e('0x87'),{'UserId':_0x363818['id'],'VoiceQueueId':_0x50d822['id']});});});});});}})['then'](respondWithStatusCode(_0xbc433a,null))['catch'](handleError(_0xbc433a,null));};exports[_0x391e('0x88')]=function(_0x1cedff,_0x203a5c,_0x300d5d){return db[_0x391e('0x72')][_0x391e('0x53')]({'where':{'id':_0x1cedff['query'][_0x391e('0x89')]},'attributes':['id'],'include':[{'model':db[_0x391e('0x75')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x203a5c,null))[_0x391e('0x3b')](function(_0x1fadf4){var _0x16a8b4=_[_0x391e('0x33')](_0x1fadf4,'id');var _0x4842a7=[];var _0x8355e3=[];var _0x4614ac=squel[_0x391e('0x8a')]();_0x4614ac[_0x391e('0x8b')]('tq.TeamId')['from'](_0x391e('0x8c'),'tq')[_0x391e('0x8d')](_0x391e('0x8e'),'ut',_0x391e('0x8f'))['where'](_0x391e('0x90'),_0x1cedff[_0x391e('0x57')]['id']);for(var _0x448d5f=0x0;_0x448d5f<_0x1fadf4[_0x391e('0x48')];_0x448d5f+=0x1){let _0x20333f=_0x1fadf4[_0x448d5f];for(var _0x1af784=0x0;_0x1af784<_0x20333f[_0x391e('0x76')][_0x391e('0x48')];_0x1af784+=0x1){let _0x532611=_0x20333f[_0x391e('0x76')][_0x1af784];var _0x43fb47=_0x4614ac[_0x391e('0x61')]();_0x43fb47[_0x391e('0x4c')](_0x391e('0x91'),_0x532611['id']);_0x8355e3['push'](db['sequelize']['query'](_0x43fb47['toString'](),{'type':db[_0x391e('0x7c')]['QueryTypes'][_0x391e('0x92')]})[_0x391e('0x3b')](function(_0x147d81){if(_0x147d81[_0x391e('0x48')]===0x1){return _0x532611['id'];}else{var _0x108c66=_[_0x391e('0x93')](_[_0x391e('0x33')](_0x147d81,'TeamId'),function(_0x5b4899){return _[_0x391e('0x35')](_0x16a8b4,_0x5b4899);});if(_0x108c66){return _0x532611['id'];}}}));}}return BPromise[_0x391e('0x94')](_0x8355e3)[_0x391e('0x3b')](function(_0xf6c6ec){_0x4842a7=_(_0x4842a7)[_0x391e('0x95')](_0xf6c6ec)[_0x391e('0x96')]()[_0x391e('0x34')]();return db['VoiceQueue'][_0x391e('0x37')]({'where':{'id':_0x1cedff[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](function(_0x50df4e){return db['sequelize'][_0x391e('0x97')](function(_0x4b494d){return _0x50df4e[_0x391e('0x88')](_0x1cedff[_0x391e('0x42')]['ids'],{'transaction':_0x4b494d})[_0x391e('0x3b')](function(){if(!_[_0x391e('0x98')](_0x4842a7)){return _0x50df4e[_0x391e('0x99')](_0x4842a7,{'transaction':_0x4b494d})[_0x391e('0x3b')](function(){return db[_0x391e('0x80')][_0x391e('0x3a')]({'where':{'VoiceQueueId':_0x1cedff['params']['id'],'UserId':_0x4842a7},'transaction':_0x4b494d});});}})[_0x391e('0x3b')](function(){_0x4842a7[_0x391e('0x85')](function(_0x361717){socket[_0x391e('0x86')](_0x391e('0x9a'),{'UserId':_0x361717,'VoiceQueueId':_0x50df4e['id']});});});});});});})[_0x391e('0x3b')](respondWithStatusCode(_0x203a5c,null))['catch'](handleError(_0x203a5c,null));};exports[_0x391e('0x9b')]=function(_0x5e0188,_0x2b237e,_0x420871){var _0x48cd2d,_0x5635bc;return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x5e0188[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x2b237e,null))['then'](function(_0x5ba0d5){if(_0x5ba0d5){_0x5635bc=_0x5ba0d5;return _0x5ba0d5[_0x391e('0x9b')](_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')],_[_0x391e('0x64')](_0x5e0188[_0x391e('0x5a')],[_0x391e('0x89'),'id'])||{})[_0x391e('0x9c')](function(_0x3d1b7e){for(var _0x2bbdca=0x0;_0x2bbdca<_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')][_0x391e('0x48')];_0x2bbdca+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')][_0x2bbdca],'VoiceQueueId':_0x5e0188[_0x391e('0x57')]['id']});}return _0x3d1b7e;});}})[_0x391e('0x3b')](function(_0x4b90e7){_0x48cd2d=_0x4b90e7||[];if(_0x5635bc){return db[_0x391e('0x75')][_0x391e('0x53')]({'where':{'id':_0x5e0188[_0x391e('0x5a')][_0x391e('0x89')]},'attributes':['id','name',_0x391e('0x77'),_0x391e('0x78'),'interface'],'raw':!![]});}})[_0x391e('0x3b')](function(_0x32821d){if(!_[_0x391e('0x98')](_0x32821d)){var _0x4b5428=[];for(var _0x14cbc8=0x0;_0x14cbc8<_0x32821d[_0x391e('0x48')];_0x14cbc8++){if(_0x32821d[_0x14cbc8][_0x391e('0x77')]){_0x4b5428[_0x391e('0x9d')](db[_0x391e('0x80')][_0x391e('0x81')]({'membername':_0x32821d[_0x14cbc8][_0x391e('0x38')],'UserId':_0x32821d[_0x14cbc8]['id'],'queue_name':_0x5635bc[_0x391e('0x38')],'VoiceQueueId':_0x5635bc['id'],'interface':_['isNil'](_0x32821d[_0x14cbc8][_0x391e('0x79')])?util[_0x391e('0x83')](_0x391e('0x84'),_0x32821d[_0x14cbc8][_0x391e('0x38')]):_0x32821d[_0x14cbc8][_0x391e('0x79')],'paused':_0x32821d[_0x14cbc8]['voicePause']||![],'penalty':_0x5e0188['body'][_0x391e('0x7b')]||0x0}));}}return BPromise[_0x391e('0x94')](_0x4b5428);}})[_0x391e('0x3b')](function(){return _0x48cd2d;})['then'](respondWithResult(_0x2b237e,null))[_0x391e('0x55')](handleError(_0x2b237e,null));};exports[_0x391e('0x99')]=function(_0x4fd6b9,_0x3fe037,_0x17a2df){return db[_0x391e('0x52')]['find']({'where':{'id':_0x4fd6b9[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x3fe037,null))[_0x391e('0x3b')](function(_0x230a87){if(_0x230a87){return _0x230a87[_0x391e('0x99')](_0x4fd6b9['query'][_0x391e('0x89')])[_0x391e('0x3b')](function(){if(_['isArray'](_0x4fd6b9[_0x391e('0x42')]['ids'])){for(var _0x3c4f11=0x0;_0x3c4f11<_0x4fd6b9[_0x391e('0x42')][_0x391e('0x89')][_0x391e('0x48')];_0x3c4f11+=0x1){socket[_0x391e('0x86')](_0x391e('0x9a'),{'UserId':Number(_0x4fd6b9[_0x391e('0x42')][_0x391e('0x89')][_0x3c4f11]),'VoiceQueueId':Number(_0x4fd6b9['params']['id'])});}}else{socket[_0x391e('0x86')]('userVoiceQueue:remove',{'UserId':Number(_0x4fd6b9[_0x391e('0x42')][_0x391e('0x89')]),'VoiceQueueId':Number(_0x4fd6b9[_0x391e('0x57')]['id'])});}});}})[_0x391e('0x3b')](function(_0x42d239){return db[_0x391e('0x80')][_0x391e('0x3a')]({'where':{'VoiceQueueId':_0x4fd6b9[_0x391e('0x57')]['id'],'UserId':_0x4fd6b9[_0x391e('0x42')]['ids']}})[_0x391e('0x3b')](function(){return _0x42d239;});})[_0x391e('0x3b')](respondWithStatusCode(_0x3fe037,null))[_0x391e('0x55')](handleError(_0x3fe037,null));};exports['getAgents']=function(_0x4a14fa,_0x14ffc1,_0x545088){var _0x4d19c6={};var _0x5a1e1e={};var _0x307bbe;var _0xefb93b;return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x4a14fa[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x14ffc1,null))[_0x391e('0x3b')](function(_0xe397){if(_0xe397){_0x307bbe=_0xe397;_0x5a1e1e[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0x75')][_0x391e('0x58')]);_0x5a1e1e[_0x391e('0x42')]=_[_0x391e('0x41')](_0x4a14fa[_0x391e('0x42')]);_0x5a1e1e[_0x391e('0x43')]=_[_0x391e('0x44')](_0x5a1e1e[_0x391e('0x45')],_0x5a1e1e['query']);_0x4d19c6[_0x391e('0x46')]=_['intersection'](_0x5a1e1e[_0x391e('0x45')],qs[_0x391e('0x47')](_0x4a14fa['query'][_0x391e('0x47')]));_0x4d19c6['attributes']=_0x4d19c6['attributes'][_0x391e('0x48')]?_0x4d19c6['attributes']:_0x5a1e1e[_0x391e('0x45')];_0x4d19c6[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x4a14fa[_0x391e('0x42')]['sort']);_0x4d19c6[_0x391e('0x4c')]=qs['filters'](_[_0x391e('0x4d')](_0x4a14fa[_0x391e('0x42')],_0x5a1e1e[_0x391e('0x43')]));if(_0x4a14fa[_0x391e('0x42')]['filter']){_0x4d19c6[_0x391e('0x4c')]=_['merge'](_0x4d19c6[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x4d19c6[_0x391e('0x46')],function(_0x2f66b4){var _0x31af83={};_0x31af83[_0x2f66b4]={'$like':'%'+_0x4a14fa[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x31af83;})});}_0x4d19c6=_[_0x391e('0x4e')]({},_0x4d19c6,_0x4a14fa[_0x391e('0x6d')]);return _0x307bbe[_0x391e('0x9e')](_0x4d19c6);}})['then'](function(_0x379755){if(_0x379755){_0xefb93b=_0x379755[_0x391e('0x48')];if(!_0x4a14fa[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x4d19c6[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x4a14fa[_0x391e('0x42')][_0x391e('0x25')]);_0x4d19c6['offset']=qs[_0x391e('0x24')](_0x4a14fa[_0x391e('0x42')][_0x391e('0x24')]);}return _0x307bbe[_0x391e('0x9e')](_0x4d19c6);}})[_0x391e('0x3b')](function(_0x184210){if(_0x184210){return _0x184210?{'count':_0xefb93b,'rows':_0x184210}:null;}})[_0x391e('0x3b')](respondWithResult(_0x14ffc1,null))['catch'](handleError(_0x14ffc1,null));};exports[_0x391e('0x9f')]=function(_0x104268,_0x2583ed,_0x4f91cd){var _0x59ca35={};var _0x3eadfb={};var _0x892590;var _0x4982cc;return db[_0x391e('0x52')]['findOne']({'where':{'id':_0x104268[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x2583ed,null))[_0x391e('0x3b')](function(_0x38ac22){if(_0x38ac22){_0x892590=_0x38ac22;_0x3eadfb['model']=_['keys'](db[_0x391e('0x80')][_0x391e('0x58')]);_0x3eadfb['query']=_[_0x391e('0x41')](_0x104268[_0x391e('0x42')]);_0x3eadfb[_0x391e('0x43')]=_[_0x391e('0x44')](_0x3eadfb[_0x391e('0x45')],_0x3eadfb[_0x391e('0x42')]);_0x59ca35[_0x391e('0x46')]=_[_0x391e('0x44')](_0x3eadfb['model'],qs['fields'](_0x104268[_0x391e('0x42')][_0x391e('0x47')]));_0x59ca35[_0x391e('0x46')]=_0x59ca35[_0x391e('0x46')][_0x391e('0x48')]?_0x59ca35[_0x391e('0x46')]:_0x3eadfb[_0x391e('0x45')];_0x59ca35[_0x391e('0x69')]=qs[_0x391e('0x4b')](_0x104268['query'][_0x391e('0x4b')]);_0x59ca35[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x104268[_0x391e('0x42')],_0x3eadfb[_0x391e('0x43')]));if(_0x104268['query'][_0x391e('0x31')]){_0x59ca35['where']=_[_0x391e('0x4e')](_0x59ca35[_0x391e('0x4c')],{'$or':_['map'](_0x59ca35[_0x391e('0x46')],function(_0x1234b8){var _0x57ee74={};_0x57ee74[_0x1234b8]={'$like':'%'+_0x104268[_0x391e('0x42')]['filter']+'%'};return _0x57ee74;})});}_0x59ca35=_[_0x391e('0x4e')]({},_0x59ca35,_0x104268['options']);return _0x892590[_0x391e('0x9f')](_0x59ca35);}})[_0x391e('0x3b')](function(_0x2fd246){if(_0x2fd246){_0x4982cc=_0x2fd246['length'];if(!_0x104268[_0x391e('0x42')][_0x391e('0x49')](_0x391e('0x4a'))){_0x59ca35[_0x391e('0x25')]=qs[_0x391e('0x25')](_0x104268[_0x391e('0x42')]['limit']);_0x59ca35['offset']=qs[_0x391e('0x24')](_0x104268[_0x391e('0x42')][_0x391e('0x24')]);}return _0x892590[_0x391e('0x9f')](_0x59ca35);}})[_0x391e('0x3b')](function(_0x59657f){return _0x59657f?{'count':_0x4982cc,'rows':_0x59657f}:null;})[_0x391e('0x3b')](respondWithResult(_0x2583ed,null))[_0x391e('0x55')](handleError(_0x2583ed,null));};exports['getLists']=function(_0x5d289d,_0x3786c8,_0x5be12d){var _0x596f40={};var _0x5d7b94={};var _0x47dfdd;var _0x4cc9b5;return db['VoiceQueue'][_0x391e('0x67')]({'where':{'id':_0x5d289d[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x3786c8,null))[_0x391e('0x3b')](function(_0x60676c){if(_0x60676c){_0x47dfdd=_0x60676c;_0x5d7b94[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0xa0')]['rawAttributes']);_0x5d7b94[_0x391e('0x42')]=_[_0x391e('0x41')](_0x5d289d[_0x391e('0x42')]);_0x5d7b94['filters']=_[_0x391e('0x44')](_0x5d7b94['model'],_0x5d7b94[_0x391e('0x42')]);_0x596f40['attributes']=_[_0x391e('0x44')](_0x5d7b94[_0x391e('0x45')],qs[_0x391e('0x47')](_0x5d289d[_0x391e('0x42')]['fields']));_0x596f40['attributes']=_0x596f40[_0x391e('0x46')][_0x391e('0x48')]?_0x596f40[_0x391e('0x46')]:_0x5d7b94[_0x391e('0x45')];_0x596f40[_0x391e('0x69')]=qs['sort'](_0x5d289d[_0x391e('0x42')][_0x391e('0x4b')]);_0x596f40[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x5d289d['query'],_0x5d7b94[_0x391e('0x43')]));if(_0x5d289d[_0x391e('0x42')][_0x391e('0x31')]){_0x596f40[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x596f40[_0x391e('0x4c')],{'$or':_[_0x391e('0x33')](_0x596f40[_0x391e('0x46')],function(_0x286be2){var _0x321e88={};_0x321e88[_0x286be2]={'$like':'%'+_0x5d289d['query'][_0x391e('0x31')]+'%'};return _0x321e88;})});}_0x596f40=_['merge']({},_0x596f40,_0x5d289d[_0x391e('0x6d')]);return _0x47dfdd['getLists'](_0x596f40);}})[_0x391e('0x3b')](function(_0x52542e){if(_0x52542e){_0x4cc9b5=_0x52542e[_0x391e('0x48')];if(!_0x5d289d[_0x391e('0x42')]['hasOwnProperty']('nolimit')){_0x596f40['limit']=qs[_0x391e('0x25')](_0x5d289d['query'][_0x391e('0x25')]);_0x596f40[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x5d289d[_0x391e('0x42')][_0x391e('0x24')]);}return _0x47dfdd[_0x391e('0xa1')](_0x596f40);}})[_0x391e('0x3b')](function(_0xcf708b){if(_0xcf708b){return _0xcf708b?{'count':_0x4cc9b5,'rows':_0xcf708b}:null;}})['then'](respondWithResult(_0x3786c8,null))['catch'](handleError(_0x3786c8,null));};exports['addLists']=function(_0x4edf6c,_0x187536,_0x3ddbbb){var _0x5ee694,_0x40fa74;return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x4edf6c[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x187536,null))[_0x391e('0x3b')](function(_0x1d3044){if(_0x1d3044){_0x40fa74=_0x1d3044;return _0x1d3044['addLists'](_0x4edf6c[_0x391e('0x5a')][_0x391e('0x89')],_[_0x391e('0x64')](_0x4edf6c[_0x391e('0x5a')],[_0x391e('0x89'),'id'])||{});}return null;})[_0x391e('0x9c')](function(_0x2cad68){var _0x3648af;_0x5ee694=_0x2cad68||[];var _0x1491db=[];if(_0x2cad68){for(var _0x1d25eb=0x0;_0x1d25eb<_0x2cad68[_0x391e('0x48')];_0x1d25eb+=0x1){var _0xd69dbb=_0x2cad68[_0x1d25eb][_0x391e('0x2c')]({'plain':!![]});_0x40fa74[_0x391e('0xa2')]=_0x4edf6c[_0x391e('0x5a')][_0x391e('0xa2')]?_0x4edf6c[_0x391e('0x5a')][_0x391e('0xa2')]:_0x40fa74[_0x391e('0xa2')];switch(_0x40fa74[_0x391e('0xa2')]){case _0x391e('0xa3'):_0x3648af=squel[_0x391e('0xa4')]()[_0x391e('0xa5')]('cm_hopper')[_0x391e('0xa6')]([_0x391e('0xa7'),_0x391e('0xa8'),'ContactId',_0x391e('0xa9'),_0x391e('0x6a'),_0x391e('0x62'),_0x391e('0x63')],squel['select']()[_0x391e('0x8b')](_0x391e('0xa7'),'phone')[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0xa8'))[_0x391e('0x8b')]('id',_0x391e('0xab'))['field'](_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')](),_0x391e('0xa9'))[_0x391e('0x8b')](_0x4edf6c[_0x391e('0x57')]['id'][_0x391e('0xad')](),_0x391e('0x6a'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x62'))[_0x391e('0x8b')]('NOW()',_0x391e('0x63'))[_0x391e('0xae')](_0x391e('0xaf'))['where'](_0x391e('0xb0'))[_0x391e('0x4c')](_0x391e('0xb1'),_0xd69dbb['CmListId']['toString']())[_0x391e('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x391e('0x4c')](_0x391e('0xb2'),squel[_0x391e('0x8a')]()[_0x391e('0x8b')](_0x391e('0xb3'))[_0x391e('0xae')](_0x391e('0xb4'))[_0x391e('0x4c')]('VoiceQueueId\x20=\x20?',_0x4edf6c['params']['id'][_0x391e('0xad')]()))[_0x391e('0x4c')](_0x391e('0xb2'),squel[_0x391e('0x8a')]()['field'](_0x391e('0xb5'))['from'](_0x391e('0xb6'))[_0x391e('0x4c')](_0x391e('0x90'),_0x4edf6c['params']['id'][_0x391e('0xad')]())))['toString']();break;case _0x391e('0xb7'):_0x3648af=squel[_0x391e('0xa4')]()[_0x391e('0xa5')](_0x391e('0xb6'))[_0x391e('0xa6')]([_0x391e('0xa7'),'scheduledAt',_0x391e('0xab'),'ListId',_0x391e('0x6a'),_0x391e('0x62'),_0x391e('0x63')],squel[_0x391e('0x8a')]()[_0x391e('0x8b')]('phone',_0x391e('0xa7'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0xa8'))[_0x391e('0x8b')]('id',_0x391e('0xab'))['field'](_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')](),_0x391e('0xa9'))[_0x391e('0x8b')](_0x4edf6c['params']['id']['toString'](),_0x391e('0x6a'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x62'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x63'))[_0x391e('0xae')](_0x391e('0xaf'))['where'](_0x391e('0xb0'))['where']('ListId\x20=\x20?',_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')]())[_0x391e('0x4c')](_0x391e('0xb8'))[_0x391e('0x4c')](_0x391e('0xb2'),squel['select']()[_0x391e('0x8b')](_0x391e('0xb5'))[_0x391e('0xae')]('cm_hopper')[_0x391e('0x4c')](_0x391e('0x90'),_0x4edf6c[_0x391e('0x57')]['id'][_0x391e('0xad')]())))[_0x391e('0xad')]();break;default:_0x3648af=squel['insert']()[_0x391e('0xa5')](_0x391e('0xb6'))['fromQuery']([_0x391e('0xa7'),'scheduledAt',_0x391e('0xab'),'ListId',_0x391e('0x6a'),'createdAt',_0x391e('0x63')],squel[_0x391e('0x8a')]()[_0x391e('0x8b')](_0x391e('0xa7'),_0x391e('0xa7'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0xa8'))[_0x391e('0x8b')]('id',_0x391e('0xab'))[_0x391e('0x8b')](_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')](),_0x391e('0xa9'))[_0x391e('0x8b')](_0x4edf6c[_0x391e('0x57')]['id'][_0x391e('0xad')](),_0x391e('0x6a'))[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x62'))[_0x391e('0x8b')]('NOW()',_0x391e('0x63'))[_0x391e('0xae')]('cm_contacts')[_0x391e('0x4c')]('deletedAt\x20IS\x20NULL')[_0x391e('0x4c')](_0x391e('0xb1'),_0xd69dbb[_0x391e('0xac')][_0x391e('0xad')]())['where'](_0x391e('0xb8')))['toString']();}_0x1491db[_0x391e('0x9d')](db[_0x391e('0x7c')]['query'](_0x3648af));}return BPromise[_0x391e('0x94')](_0x1491db);}})[_0x391e('0x3b')](function(){return _0x5ee694;})[_0x391e('0x3b')](respondWithResult(_0x187536,null))['catch'](handleError(_0x187536,null));};exports[_0x391e('0xb9')]=function(_0x9897ed,_0x3af73c,_0x191d36){return db[_0x391e('0x52')][_0x391e('0x37')]({'where':{'id':_0x9897ed[_0x391e('0x57')]['id']}})['then'](handleEntityNotFound(_0x3af73c,null))['then'](function(_0x2fd264){if(_0x2fd264){return _0x2fd264[_0x391e('0xb9')](_0x9897ed[_0x391e('0x42')][_0x391e('0x89')]);}})[_0x391e('0x3b')](function(_0x3d4ed8){if(_0x3d4ed8){return db[_0x391e('0x68')][_0x391e('0x3a')]({'where':{'ListId':_0x9897ed[_0x391e('0x42')][_0x391e('0x89')],'VoiceQueueId':_0x9897ed[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](function(){return _0x3d4ed8;});}})[_0x391e('0x3b')](respondWithStatusCode(_0x3af73c,null))[_0x391e('0x55')](handleError(_0x3af73c,null));};exports['getBlackLists']=function(_0x9b81e5,_0x2f5316,_0x5f4f78){var _0x18d5f7={};var _0x4f09ec={};var _0x48ae75;var _0x3655bf;return db[_0x391e('0x52')][_0x391e('0x67')]({'where':{'id':_0x9b81e5['params']['id']}})['then'](handleEntityNotFound(_0x2f5316,null))[_0x391e('0x3b')](function(_0x14db6f){if(_0x14db6f){_0x48ae75=_0x14db6f;_0x4f09ec[_0x391e('0x45')]=_[_0x391e('0x41')](db[_0x391e('0xa0')][_0x391e('0x58')]);_0x4f09ec[_0x391e('0x42')]=_[_0x391e('0x41')](_0x9b81e5[_0x391e('0x42')]);_0x4f09ec[_0x391e('0x43')]=_['intersection'](_0x4f09ec['model'],_0x4f09ec[_0x391e('0x42')]);_0x18d5f7['attributes']=_[_0x391e('0x44')](_0x4f09ec[_0x391e('0x45')],qs['fields'](_0x9b81e5[_0x391e('0x42')][_0x391e('0x47')]));_0x18d5f7[_0x391e('0x46')]=_0x18d5f7['attributes'][_0x391e('0x48')]?_0x18d5f7[_0x391e('0x46')]:_0x4f09ec[_0x391e('0x45')];_0x18d5f7[_0x391e('0x69')]=qs['sort'](_0x9b81e5[_0x391e('0x42')][_0x391e('0x4b')]);_0x18d5f7[_0x391e('0x4c')]=qs[_0x391e('0x43')](_[_0x391e('0x4d')](_0x9b81e5[_0x391e('0x42')],_0x4f09ec['filters']));if(_0x9b81e5[_0x391e('0x42')][_0x391e('0x31')]){_0x18d5f7[_0x391e('0x4c')]=_[_0x391e('0x4e')](_0x18d5f7['where'],{'$or':_[_0x391e('0x33')](_0x18d5f7[_0x391e('0x46')],function(_0x42f36c){var _0x4a23bc={};_0x4a23bc[_0x42f36c]={'$like':'%'+_0x9b81e5[_0x391e('0x42')][_0x391e('0x31')]+'%'};return _0x4a23bc;})});}_0x18d5f7=_[_0x391e('0x4e')]({},_0x18d5f7,_0x9b81e5[_0x391e('0x6d')]);return _0x48ae75['getBlackLists'](_0x18d5f7);}})[_0x391e('0x3b')](function(_0x63433a){if(_0x63433a){_0x3655bf=_0x63433a[_0x391e('0x48')];if(!_0x9b81e5[_0x391e('0x42')]['hasOwnProperty'](_0x391e('0x4a'))){_0x18d5f7['limit']=qs['limit'](_0x9b81e5[_0x391e('0x42')]['limit']);_0x18d5f7[_0x391e('0x24')]=qs[_0x391e('0x24')](_0x9b81e5[_0x391e('0x42')][_0x391e('0x24')]);}return _0x48ae75[_0x391e('0xba')](_0x18d5f7);}})[_0x391e('0x3b')](function(_0xe7c266){if(_0xe7c266){return _0xe7c266?{'count':_0x3655bf,'rows':_0xe7c266}:null;}})[_0x391e('0x3b')](respondWithResult(_0x2f5316,null))[_0x391e('0x55')](handleError(_0x2f5316,null));};exports[_0x391e('0xbb')]=function(_0x50bea7,_0x1429df,_0x2dc57a){var _0x17a1b2,_0x35f467;return db['VoiceQueue'][_0x391e('0x37')]({'where':{'id':_0x50bea7[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x1429df,null))['then'](function(_0x4fe3a6){if(_0x4fe3a6){_0x35f467=_0x4fe3a6;return _0x4fe3a6[_0x391e('0xbb')](_0x50bea7['body'][_0x391e('0x89')],_[_0x391e('0x64')](_0x50bea7[_0x391e('0x5a')],[_0x391e('0x89'),'id'])||{});}return null;})[_0x391e('0x9c')](function(_0x4c42f1){var _0x5ce899;_0x17a1b2=_0x4c42f1||[];var _0x47dcbb=[];if(_0x4c42f1){for(var _0x35eaa9=0x0;_0x35eaa9<_0x4c42f1[_0x391e('0x48')];_0x35eaa9+=0x1){var _0x4a4e01=_0x4c42f1[_0x35eaa9][_0x391e('0x2c')]({'plain':!![]});_0x5ce899=squel[_0x391e('0xa4')]()[_0x391e('0xa5')](_0x391e('0xbc'))[_0x391e('0xa6')]([_0x391e('0xa7'),_0x391e('0xab'),'ListId',_0x391e('0x6a'),_0x391e('0x62'),'updatedAt'],squel[_0x391e('0x8a')]()[_0x391e('0x8b')](_0x391e('0xa7'),'phone')[_0x391e('0x8b')]('id',_0x391e('0xab'))[_0x391e('0x8b')](_0x4a4e01['CmListId'][_0x391e('0xad')](),_0x391e('0xa9'))['field'](_0x50bea7[_0x391e('0x57')]['id']['toString'](),'VoiceQueueId')[_0x391e('0x8b')](_0x391e('0xaa'),'createdAt')[_0x391e('0x8b')](_0x391e('0xaa'),_0x391e('0x63'))[_0x391e('0xae')](_0x391e('0xaf'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x391e('0xb1'),_0x4a4e01[_0x391e('0xac')][_0x391e('0xad')]())[_0x391e('0x4c')]('phone\x20IS\x20NOT\x20NULL'))[_0x391e('0xad')]();_0x47dcbb['push'](db['sequelize'][_0x391e('0x42')](_0x5ce899));}return BPromise[_0x391e('0x94')](_0x47dcbb);}})[_0x391e('0x3b')](function(){return _0x17a1b2;})[_0x391e('0x3b')](respondWithResult(_0x1429df,null))['catch'](handleError(_0x1429df,null));};exports[_0x391e('0xbd')]=function(_0x16d56a,_0x15e3a3,_0x31442c){return db[_0x391e('0x52')]['find']({'where':{'id':_0x16d56a[_0x391e('0x57')]['id']}})[_0x391e('0x3b')](handleEntityNotFound(_0x15e3a3,null))[_0x391e('0x3b')](function(_0xe3b29f){if(_0xe3b29f){return _0xe3b29f[_0x391e('0xbd')](_0x16d56a[_0x391e('0x42')][_0x391e('0x89')]);}})[_0x391e('0x3b')](function(_0x585b22){if(_0x585b22){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x16d56a['query'][_0x391e('0x89')],'VoiceQueueId':_0x16d56a[_0x391e('0x57')]['id']}})['then'](function(){return _0x585b22;});}})[_0x391e('0x3b')](respondWithStatusCode(_0x15e3a3,null))['catch'](handleError(_0x15e3a3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2d96419..790f1ca 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 _0x7c3f=['hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x37606e,_0x41534e){var _0x15084e=function(_0x322e33){while(--_0x322e33){_0x37606e['push'](_0x37606e['shift']());}};_0x15084e(++_0x41534e);}(_0x7c3f,0xb8));var _0xf7c3=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x7c3f[_0x1e7701];return _0x3ab707;};'use strict';var EventEmitter=require(_0xf7c3('0x0'));var VoiceQueue=require(_0xf7c3('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7c3('0x2'),'afterUpdate':'update','afterDestroy':_0xf7c3('0x3')};function emitEvent(_0x4aa78d){return function(_0x3322b0,_0x1e52fe,_0x6b7375){VoiceQueueEvents[_0xf7c3('0x4')](_0x4aa78d+':'+_0x3322b0['id'],_0x3322b0);VoiceQueueEvents['emit'](_0x4aa78d,_0x3322b0);_0x6b7375(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xf7c3('0x5')](e,emitEvent(event));}}module[_0xf7c3('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x6d6c=['save','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x19c047,_0x4eaad9){var _0x5b3a25=function(_0x165158){while(--_0x165158){_0x19c047['push'](_0x19c047['shift']());}};_0x5b3a25(++_0x4eaad9);}(_0x6d6c,0xa5));var _0xc6d6=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x6d6c[_0x31b5a5];return _0x364cc9;};'use strict';var EventEmitter=require(_0xc6d6('0x0'));var VoiceQueue=require(_0xc6d6('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc6d6('0x2')](0x0);var events={'afterCreate':_0xc6d6('0x3'),'afterUpdate':'update','afterDestroy':_0xc6d6('0x4')};function emitEvent(_0x585ceb){return function(_0x53d5f2,_0x3a02e4,_0x30ac79){VoiceQueueEvents[_0xc6d6('0x5')](_0x585ceb+':'+_0x53d5f2['id'],_0x53d5f2);VoiceQueueEvents[_0xc6d6('0x5')](_0x585ceb,_0x53d5f2);_0x30ac79(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xc6d6('0x6')](e,emitEvent(event));}}module[_0xc6d6('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b01e9f6..e7fa4e6 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 _0x0569=['path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','lodash','../../config/logger','api','moment'];(function(_0x1ee938,_0x22267f){var _0x3ebf3b=function(_0x10611e){while(--_0x10611e){_0x1ee938['push'](_0x1ee938['shift']());}};_0x3ebf3b(++_0x22267f);}(_0x0569,0x1c7));var _0x9056=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0x0569[_0x47a12a];return _0x30cd40;};'use strict';var _=require(_0x9056('0x0'));var util=require('util');var logger=require(_0x9056('0x1'))(_0x9056('0x2'));var moment=require(_0x9056('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9056('0x4'));var rimraf=require(_0x9056('0x5'));var config=require('../../config/environment');var attributes=require(_0x9056('0x6'));module[_0x9056('0x7')]=function(_0x41ab3b,_0x389091){return _0x41ab3b['define'](_0x9056('0x8'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a0e=['./voiceQueue.attributes','define','VoiceQueue','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x354a87,_0x248b8a){var _0x37c23a=function(_0x3e4fc0){while(--_0x3e4fc0){_0x354a87['push'](_0x354a87['shift']());}};_0x37c23a(++_0x248b8a);}(_0x8a0e,0xfd));var _0xe8a0=function(_0x270c56,_0x43be30){_0x270c56=_0x270c56-0x0;var _0x3b47ee=_0x8a0e[_0x270c56];return _0x3b47ee;};'use strict';var _=require(_0xe8a0('0x0'));var util=require('util');var logger=require(_0xe8a0('0x1'))('api');var moment=require(_0xe8a0('0x2'));var BPromise=require(_0xe8a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8a0('0x4'));var rimraf=require(_0xe8a0('0x5'));var config=require(_0xe8a0('0x6'));var attributes=require(_0xe8a0('0x7'));module['exports']=function(_0x3cc156,_0x3b2fa9){return _0x3cc156[_0xe8a0('0x8')](_0xe8a0('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d3e188b..1990b30 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 _0xf061=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceQueue,\x20%s,\x20%s','message','info','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','include','map','model','debug','find','ShowVoiceQueue','util','moment','randomstring'];(function(_0x50fb75,_0x379974){var _0x531b40=function(_0x28554b){while(--_0x28554b){_0x50fb75['push'](_0x50fb75['shift']());}};_0x531b40(++_0x379974);}(_0xf061,0x165));var _0x1f06=function(_0x5d7006,_0x4f7094){_0x5d7006=_0x5d7006-0x0;var _0x5ed777=_0xf061[_0x5d7006];return _0x5ed777;};'use strict';var _=require('lodash');var util=require(_0x1f06('0x0'));var moment=require(_0x1f06('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f06('0x2'));var fs=require('fs');var Redis=require(_0x1f06('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f06('0x4'));var logger=require(_0x1f06('0x5'))(_0x1f06('0x6'));var config=require(_0x1f06('0x7'));var jayson=require(_0x1f06('0x8'));var client=jayson[_0x1f06('0x9')][_0x1f06('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1f06('0xb')],{'host':_0x1f06('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f06('0xb')]));require(_0x1f06('0xd'))['register'](socket);function respondWithRpcPromise(_0x1acfe9,_0x61562f,_0x4f78a2){return new BPromise(function(_0x4a02df,_0xdd90bb){return client[_0x1f06('0xe')](_0x1acfe9,_0x4f78a2)[_0x1f06('0xf')](function(_0x163a5e){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x61562f,'request\x20sent');logger['debug'](_0x1f06('0x10'),_0x61562f,_0x1f06('0x11'),JSON[_0x1f06('0x12')](_0x163a5e));if(_0x163a5e['error']){if(_0x163a5e['error'][_0x1f06('0x13')]===0x1f4){logger[_0x1f06('0x14')](_0x1f06('0x15'),_0x61562f,_0x163a5e[_0x1f06('0x14')][_0x1f06('0x16')]);return _0xdd90bb(_0x163a5e[_0x1f06('0x14')][_0x1f06('0x16')]);}logger[_0x1f06('0x14')](_0x1f06('0x15'),_0x61562f,_0x163a5e[_0x1f06('0x14')]['message']);return _0x4a02df(_0x163a5e[_0x1f06('0x14')][_0x1f06('0x16')]);}else{logger[_0x1f06('0x17')](_0x1f06('0x15'),_0x61562f,_0x1f06('0x11'));_0x4a02df(_0x163a5e['result']['message']);}})[_0x1f06('0x18')](function(_0xa8f94d){logger[_0x1f06('0x14')](_0x1f06('0x15'),_0x61562f,_0xa8f94d);_0xdd90bb(_0xa8f94d);});});}exports[_0x1f06('0x19')]=function(_0x3e257e){var _0x4ef8d1=this;return new Promise(function(_0x4440f9,_0x54b584){return db[_0x1f06('0x1a')]['findAll']({'raw':_0x3e257e['options']?_0x3e257e[_0x1f06('0x1b')][_0x1f06('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e[_0x1f06('0x1b')]['where']||null:null,'attributes':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e[_0x1f06('0x1b')][_0x1f06('0x1d')]||null:null,'limit':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e['options']['limit']||null:null,'include':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e[_0x1f06('0x1b')][_0x1f06('0x1e')]?_[_0x1f06('0x1f')](_0x3e257e[_0x1f06('0x1b')]['include'],function(_0x3bfae3){return{'model':db[_0x3bfae3[_0x1f06('0x20')]],'as':_0x3bfae3['as'],'attributes':_0x3bfae3[_0x1f06('0x1d')],'include':_0x3bfae3['include']?_[_0x1f06('0x1f')](_0x3bfae3[_0x1f06('0x1e')],function(_0x2dbc33){return{'model':db[_0x2dbc33[_0x1f06('0x20')]],'as':_0x2dbc33['as'],'attributes':_0x2dbc33['attributes'],'include':_0x2dbc33[_0x1f06('0x1e')]?_[_0x1f06('0x1f')](_0x2dbc33[_0x1f06('0x1e')],function(_0x3cbb76){return{'model':db[_0x3cbb76[_0x1f06('0x20')]],'as':_0x3cbb76['as'],'attributes':_0x3cbb76[_0x1f06('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1f06('0xf')](function(_0x2cf229){logger[_0x1f06('0x17')](_0x1f06('0x19'),_0x3e257e);logger[_0x1f06('0x21')](_0x1f06('0x19'),_0x3e257e,JSON[_0x1f06('0x12')](_0x2cf229));_0x4440f9(_0x2cf229);})[_0x1f06('0x18')](function(_0xaec1d4){logger[_0x1f06('0x14')]('GetVoiceQueue',_0xaec1d4[_0x1f06('0x16')],_0x3e257e);_0x54b584(_0x4ef8d1[_0x1f06('0x14')](0x1f4,_0xaec1d4[_0x1f06('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x236597){var _0xfe0c75=this;return new Promise(function(_0x1144ec,_0x199ee4){return db[_0x1f06('0x1a')][_0x1f06('0x22')]({'raw':_0x236597['options']?_0x236597['options'][_0x1f06('0x1c')]===undefined?!![]:![]:!![],'where':_0x236597[_0x1f06('0x1b')]?_0x236597['options']['where']||null:null,'attributes':_0x236597[_0x1f06('0x1b')]?_0x236597[_0x1f06('0x1b')][_0x1f06('0x1d')]||null:null,'include':_0x236597[_0x1f06('0x1b')]?_0x236597['options'][_0x1f06('0x1e')]?_['map'](_0x236597['options']['include'],function(_0x41995b){return{'model':db[_0x41995b['model']],'as':_0x41995b['as'],'attributes':_0x41995b[_0x1f06('0x1d')],'include':_0x41995b[_0x1f06('0x1e')]?_['map'](_0x41995b[_0x1f06('0x1e')],function(_0x3921b8){return{'model':db[_0x3921b8['model']],'as':_0x3921b8['as'],'attributes':_0x3921b8['attributes'],'include':_0x3921b8[_0x1f06('0x1e')]?_[_0x1f06('0x1f')](_0x3921b8[_0x1f06('0x1e')],function(_0x121246){return{'model':db[_0x121246['model']],'as':_0x121246['as'],'attributes':_0x121246[_0x1f06('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1f06('0xf')](function(_0x22ff50){logger[_0x1f06('0x17')]('ShowVoiceQueue',_0x236597);logger[_0x1f06('0x21')](_0x1f06('0x23'),_0x236597,JSON[_0x1f06('0x12')](_0x22ff50));_0x1144ec(_0x22ff50);})[_0x1f06('0x18')](function(_0x4e60d4){logger[_0x1f06('0x14')](_0x1f06('0x23'),_0x4e60d4['message'],_0x236597);_0x199ee4(_0xfe0c75[_0x1f06('0x14')](0x1f4,_0x4e60d4[_0x1f06('0x16')]));});});}; \ No newline at end of file +var _0x69a4=['find','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceQueue','findAll','raw','options','where','limit','map','include','model','attributes','GetVoiceQueue','ShowVoiceQueue'];(function(_0x45be7a,_0x150ca7){var _0x4a9234=function(_0x59f220){while(--_0x59f220){_0x45be7a['push'](_0x45be7a['shift']());}};_0x4a9234(++_0x150ca7);}(_0x69a4,0x76));var _0x469a=function(_0x3be169,_0x2f4727){_0x3be169=_0x3be169-0x0;var _0x4849d8=_0x69a4[_0x3be169];return _0x4849d8;};'use strict';var _=require('lodash');var util=require(_0x469a('0x0'));var moment=require(_0x469a('0x1'));var BPromise=require('bluebird');var rs=require(_0x469a('0x2'));var fs=require('fs');var Redis=require(_0x469a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x469a('0x4'))(_0x469a('0x5'));var config=require('../../config/environment');var jayson=require(_0x469a('0x6'));var client=jayson[_0x469a('0x7')][_0x469a('0x8')]({'port':0x232a});config[_0x469a('0x9')]=_[_0x469a('0xa')](config[_0x469a('0x9')],{'host':_0x469a('0xb'),'port':0x18eb});var socket=require(_0x469a('0xc'))(new Redis(config[_0x469a('0x9')]));require('./voiceQueue.socket')[_0x469a('0xd')](socket);function respondWithRpcPromise(_0x1a26a3,_0x4de19f,_0x49d74a){return new BPromise(function(_0xd3fcce,_0x8aa78){return client[_0x469a('0xe')](_0x1a26a3,_0x49d74a)[_0x469a('0xf')](function(_0xc3dc5e){logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));logger[_0x469a('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4de19f,'request\x20sent',JSON[_0x469a('0x14')](_0xc3dc5e));if(_0xc3dc5e[_0x469a('0x15')]){if(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x16')]===0x1f4){logger[_0x469a('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0x8aa78(_0xc3dc5e[_0x469a('0x15')][_0x469a('0x17')]);}logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0xc3dc5e['error'][_0x469a('0x17')]);return _0xd3fcce(_0xc3dc5e['error'][_0x469a('0x17')]);}else{logger[_0x469a('0x10')](_0x469a('0x11'),_0x4de19f,_0x469a('0x12'));_0xd3fcce(_0xc3dc5e[_0x469a('0x18')]['message']);}})[_0x469a('0x19')](function(_0x440040){logger[_0x469a('0x15')](_0x469a('0x11'),_0x4de19f,_0x440040);_0x8aa78(_0x440040);});});}exports['GetVoiceQueue']=function(_0x524a77){var _0x126c5=this;return new Promise(function(_0x4ab05a,_0x5f122a){return db[_0x469a('0x1a')][_0x469a('0x1b')]({'raw':_0x524a77['options']?_0x524a77['options'][_0x469a('0x1c')]===undefined?!![]:![]:!![],'where':_0x524a77[_0x469a('0x1d')]?_0x524a77[_0x469a('0x1d')][_0x469a('0x1e')]||null:null,'attributes':_0x524a77['options']?_0x524a77[_0x469a('0x1d')]['attributes']||null:null,'limit':_0x524a77['options']?_0x524a77[_0x469a('0x1d')][_0x469a('0x1f')]||null:null,'include':_0x524a77[_0x469a('0x1d')]?_0x524a77[_0x469a('0x1d')]['include']?_[_0x469a('0x20')](_0x524a77[_0x469a('0x1d')][_0x469a('0x21')],function(_0x40555c){return{'model':db[_0x40555c[_0x469a('0x22')]],'as':_0x40555c['as'],'attributes':_0x40555c[_0x469a('0x23')],'include':_0x40555c['include']?_[_0x469a('0x20')](_0x40555c['include'],function(_0x103497){return{'model':db[_0x103497[_0x469a('0x22')]],'as':_0x103497['as'],'attributes':_0x103497[_0x469a('0x23')],'include':_0x103497[_0x469a('0x21')]?_[_0x469a('0x20')](_0x103497[_0x469a('0x21')],function(_0x4de8b0){return{'model':db[_0x4de8b0[_0x469a('0x22')]],'as':_0x4de8b0['as'],'attributes':_0x4de8b0[_0x469a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x469a('0xf')](function(_0x414fca){logger[_0x469a('0x10')]('GetVoiceQueue',_0x524a77);logger[_0x469a('0x13')](_0x469a('0x24'),_0x524a77,JSON[_0x469a('0x14')](_0x414fca));_0x4ab05a(_0x414fca);})[_0x469a('0x19')](function(_0xdf9336){logger['error'](_0x469a('0x24'),_0xdf9336['message'],_0x524a77);_0x5f122a(_0x126c5[_0x469a('0x15')](0x1f4,_0xdf9336[_0x469a('0x17')]));});});};exports[_0x469a('0x25')]=function(_0x4deb07){var _0x557240=this;return new Promise(function(_0x1ed10b,_0x38154a){return db[_0x469a('0x1a')][_0x469a('0x26')]({'raw':_0x4deb07[_0x469a('0x1d')]?_0x4deb07[_0x469a('0x1d')][_0x469a('0x1c')]===undefined?!![]:![]:!![],'where':_0x4deb07[_0x469a('0x1d')]?_0x4deb07['options'][_0x469a('0x1e')]||null:null,'attributes':_0x4deb07[_0x469a('0x1d')]?_0x4deb07['options'][_0x469a('0x23')]||null:null,'include':_0x4deb07['options']?_0x4deb07['options'][_0x469a('0x21')]?_[_0x469a('0x20')](_0x4deb07[_0x469a('0x1d')][_0x469a('0x21')],function(_0x3f9a9a){return{'model':db[_0x3f9a9a[_0x469a('0x22')]],'as':_0x3f9a9a['as'],'attributes':_0x3f9a9a[_0x469a('0x23')],'include':_0x3f9a9a['include']?_[_0x469a('0x20')](_0x3f9a9a['include'],function(_0x21a3d2){return{'model':db[_0x21a3d2[_0x469a('0x22')]],'as':_0x21a3d2['as'],'attributes':_0x21a3d2[_0x469a('0x23')],'include':_0x21a3d2[_0x469a('0x21')]?_[_0x469a('0x20')](_0x21a3d2['include'],function(_0x22b43d){return{'model':db[_0x22b43d[_0x469a('0x22')]],'as':_0x22b43d['as'],'attributes':_0x22b43d[_0x469a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x233eb2){logger['info'](_0x469a('0x25'),_0x4deb07);logger[_0x469a('0x13')](_0x469a('0x25'),_0x4deb07,JSON['stringify'](_0x233eb2));_0x1ed10b(_0x233eb2);})['catch'](function(_0x35bbe6){logger['error'](_0x469a('0x25'),_0x35bbe6[_0x469a('0x17')],_0x4deb07);_0x38154a(_0x557240[_0x469a('0x15')](0x1f4,_0x35bbe6[_0x469a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 460739c..165127e 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 _0x4849=['length','voiceQueue:','./voiceQueue.events','save','update','emit','removeListener','register'];(function(_0x59ec0f,_0x59f7f5){var _0x53525b=function(_0x2f9464){while(--_0x2f9464){_0x59ec0f['push'](_0x59ec0f['shift']());}};_0x53525b(++_0x59f7f5);}(_0x4849,0x152));var _0x9484=function(_0x2e8c98,_0x45d156){_0x2e8c98=_0x2e8c98-0x0;var _0x50ef24=_0x4849[_0x2e8c98];return _0x50ef24;};'use strict';var VoiceQueueEvents=require(_0x9484('0x0'));var events=[_0x9484('0x1'),'remove',_0x9484('0x2')];function createListener(_0x466077,_0x5ded8d){return function(_0x37da6b){_0x5ded8d[_0x9484('0x3')](_0x466077,_0x37da6b);};}function removeListener(_0x415085,_0x5cdaa2){return function(){VoiceQueueEvents[_0x9484('0x4')](_0x415085,_0x5cdaa2);};}exports[_0x9484('0x5')]=function(_0x2dafd8){for(var _0x50979c=0x0,_0x16864b=events[_0x9484('0x6')];_0x50979c<_0x16864b;_0x50979c++){var _0x2f6b47=events[_0x50979c];var _0x5b2e3b=createListener(_0x9484('0x7')+_0x2f6b47,_0x2dafd8);VoiceQueueEvents['on'](_0x2f6b47,_0x5b2e3b);}}; \ No newline at end of file +var _0xc5ab=['register','length','voiceQueue:','save','remove','removeListener'];(function(_0x477c8a,_0x3cc6a7){var _0x584721=function(_0x3efcb3){while(--_0x3efcb3){_0x477c8a['push'](_0x477c8a['shift']());}};_0x584721(++_0x3cc6a7);}(_0xc5ab,0x19b));var _0xbc5a=function(_0x5a6e35,_0x557945){_0x5a6e35=_0x5a6e35-0x0;var _0x1d63c6=_0xc5ab[_0x5a6e35];return _0x1d63c6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xbc5a('0x0'),_0xbc5a('0x1'),'update'];function createListener(_0x1dc817,_0x118552){return function(_0x13612b){_0x118552['emit'](_0x1dc817,_0x13612b);};}function removeListener(_0x1debfa,_0x178d65){return function(){VoiceQueueEvents[_0xbc5a('0x2')](_0x1debfa,_0x178d65);};}exports[_0xbc5a('0x3')]=function(_0x57f412){for(var _0x4433f5=0x0,_0x1702ba=events[_0xbc5a('0x4')];_0x4433f5<_0x1702ba;_0x4433f5++){var _0x53d940=events[_0x4433f5];var _0xb600e0=createListener(_0xbc5a('0x5')+_0x53d940,_0x57f412);VoiceQueueEvents['on'](_0x53d940,_0xb600e0);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bab40a0..a50317b 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 _0xfd20=['show','post','create','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x57494f,_0x494f0d){var _0x2ec665=function(_0x498756){while(--_0x498756){_0x57494f['push'](_0x57494f['shift']());}};_0x2ec665(++_0x494f0d);}(_0xfd20,0x66));var _0x0fd2=function(_0x31f739,_0x468cf6){_0x31f739=_0x31f739-0x0;var _0x3d0ac1=_0xfd20[_0x31f739];return _0x3d0ac1;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fd2('0x3'));var config=require('../../config/environment');var controller=require(_0x0fd2('0x4'));router[_0x0fd2('0x5')]('/',auth[_0x0fd2('0x6')](),controller[_0x0fd2('0x7')]);router[_0x0fd2('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x0fd2('0x8')]);router[_0x0fd2('0x5')](_0x0fd2('0x9'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0xa')]);router[_0x0fd2('0x5')](_0x0fd2('0xb'),auth['isAuthenticated'](),controller[_0x0fd2('0xc')]);router[_0x0fd2('0xd')]('/',auth['isAuthenticated'](),controller[_0x0fd2('0xe')]);router['put'](_0x0fd2('0xb'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0xf')]);router[_0x0fd2('0x10')](_0x0fd2('0xb'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0x11')]);module[_0x0fd2('0x12')]=router; \ No newline at end of file +var _0x1261=['/index','isAuthenticated','getVoiceQueuesReport','/:id','show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','describe'];(function(_0x237a99,_0x3e4ff9){var _0x2ae3ca=function(_0x27efc1){while(--_0x27efc1){_0x237a99['push'](_0x237a99['shift']());}};_0x2ae3ca(++_0x3e4ff9);}(_0x1261,0x144));var _0x1126=function(_0x188bfe,_0x2517cc){_0x188bfe=_0x188bfe-0x0;var _0x1a9efa=_0x1261[_0x188bfe];return _0x1a9efa;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['get'](_0x1126('0xf'),auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router['post']('/',auth[_0x1126('0xd')](),controller['create']);router['put'](_0x1126('0xf'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);router[_0x1126('0x12')](_0x1126('0xf'),auth[_0x1126('0xd')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 94a572e..163a72e 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 _0xd8b0=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0d8b('0x2')]},'calleridname':{'type':Sequelize[_0x0d8b('0x2')]},'queue':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x577834){var _0x5e15e6=moment(_0x577834);var _0x3f8b6f=moment(this[_0x0d8b('0x4')](_0x0d8b('0x5')))['format'](_0x0d8b('0x6'));var _0x284169=_0x5e15e6['diff'](_0x3f8b6f,_0x0d8b('0x7'));this[_0x0d8b('0x8')](_0x0d8b('0x9'),_0x577834);this[_0x0d8b('0x8')](_0x0d8b('0xa'),_0x284169||null);}},'position':{'type':Sequelize[_0x0d8b('0xb')]},'count':{'type':Sequelize[_0x0d8b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xd')},'originalposition':{'type':Sequelize[_0x0d8b('0xb')]},'channel':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d8b('0x2')]},'accountcode':{'type':Sequelize[_0x0d8b('0x2')]},'context':{'type':Sequelize[_0x0d8b('0x2')]},'exten':{'type':Sequelize[_0x0d8b('0x2')]},'priority':{'type':Sequelize[_0x0d8b('0x2')]},'holdtime':{'type':Sequelize[_0x0d8b('0xb')]},'mohtime':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0d8b('0x2')]},'transfer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xe')},'transferexten':{'type':Sequelize[_0x0d8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'secondDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x6ed5fb,_0x4f8459){var _0x113009=function(_0x2f14a5){while(--_0x2f14a5){_0x6ed5fb['push'](_0x6ed5fb['shift']());}};_0x113009(++_0x4f8459);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 3ee8b69..fdacf56 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(_0x492721,_0x204dc9){var _0x4e4094=function(_0x2e2698){while(--_0x2e2698){_0x492721['push'](_0x492721['shift']());}};_0x4e4094(++_0x204dc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0xe01c24,_0x508d50){var _0x18c6fe=function(_0x5b2f67){while(--_0x5b2f67){_0xe01c24['push'](_0xe01c24['shift']());}};_0x18c6fe(++_0x508d50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3fb9d4c..338f473 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 _0x9d91=['VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x9d91,0x74));var _0x19d9=function(_0x2c5618,_0x206397){_0x2c5618=_0x2c5618-0x0;var _0x22472b=_0x9d91[_0x2c5618];return _0x22472b;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x19d9('0x0'))['db'][_0x19d9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x19d9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x19d9('0x3'),'afterDestroy':_0x19d9('0x4')};function emitEvent(_0x259f2d){return function(_0x234b31,_0xec6f,_0x4bec7a){VoiceQueueReportEvents[_0x19d9('0x5')](_0x259f2d+':'+_0x234b31['id'],_0x234b31);VoiceQueueReportEvents[_0x19d9('0x5')](_0x259f2d,_0x234b31);_0x4bec7a(null);};}for(var e in events){if(events[_0x19d9('0x6')](e)){var event=events[e];VoiceQueueReport[_0x19d9('0x7')](e,emitEvent(event));}}module[_0x19d9('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xa467=['update','remove','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0xa467,0x6b));var _0x7a46=function(_0x1c4d05,_0x43815e){_0x1c4d05=_0x1c4d05-0x0;var _0x58ae23=_0xa467[_0x1c4d05];return _0x58ae23;};'use strict';var EventEmitter=require(_0x7a46('0x0'));var VoiceQueueReport=require(_0x7a46('0x1'))['db'][_0x7a46('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7a46('0x3')](0x0);var events={'afterCreate':_0x7a46('0x4'),'afterUpdate':_0x7a46('0x5'),'afterDestroy':_0x7a46('0x6')};function emitEvent(_0x15f50e){return function(_0x268e52,_0xbe9c62,_0x563dee){VoiceQueueReportEvents['emit'](_0x15f50e+':'+_0x268e52['id'],_0x268e52);VoiceQueueReportEvents['emit'](_0x15f50e,_0x268e52);_0x563dee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x7a46('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 338e456..61ef420 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 _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x33a00c,_0x124a7a){var _0x582540=function(_0x48c639){while(--_0x48c639){_0x33a00c['push'](_0x33a00c['shift']());}};_0x582540(++_0x124a7a);}(_0x757a,0xde));var _0xa757=function(_0x39d754,_0x1006a5){_0x39d754=_0x39d754-0x0;var _0x163cb2=_0x757a[_0x39d754];return _0x163cb2;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x5a3bc1,_0x3d289a){var _0xbe775c=function(_0x4fd858){while(--_0x4fd858){_0x5a3bc1['push'](_0x5a3bc1['shift']());}};_0xbe775c(++_0x3d289a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x0b0e[_0x5774be];return _0x4914b4;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index de19d7b..e691463 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 _0xecc8=['model','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map'];(function(_0x4befae,_0x55b079){var _0x76c573=function(_0x4e3546){while(--_0x4e3546){_0x4befae['push'](_0x4befae['shift']());}};_0x76c573(++_0x55b079);}(_0xecc8,0x111));var _0x8ecc=function(_0x811db8,_0x27f388){_0x811db8=_0x811db8-0x0;var _0x49d638=_0xecc8[_0x811db8];return _0x49d638;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8ecc('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ecc('0x1'))['db'];var utils=require(_0x8ecc('0x2'));var logger=require(_0x8ecc('0x3'))('rpc');var config=require(_0x8ecc('0x4'));var jayson=require(_0x8ecc('0x5'));var client=jayson[_0x8ecc('0x6')][_0x8ecc('0x7')]({'port':0x232a});config[_0x8ecc('0x8')]=_['defaults'](config[_0x8ecc('0x8')],{'host':_0x8ecc('0x9'),'port':0x18eb});var socket=require(_0x8ecc('0xa'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x8ecc('0xb')](socket);function respondWithRpcPromise(_0x131f12,_0x38297a,_0x29e67c){return new BPromise(function(_0x34858e,_0x7db1b5){return client[_0x8ecc('0xc')](_0x131f12,_0x29e67c)['then'](function(_0x83c867){logger[_0x8ecc('0xd')](_0x8ecc('0xe'),_0x38297a,_0x8ecc('0xf'));logger[_0x8ecc('0x10')](_0x8ecc('0x11'),_0x38297a,'request\x20sent',JSON[_0x8ecc('0x12')](_0x83c867));if(_0x83c867[_0x8ecc('0x13')]){if(_0x83c867[_0x8ecc('0x13')]['code']===0x1f4){logger['error'](_0x8ecc('0xe'),_0x38297a,_0x83c867['error'][_0x8ecc('0x14')]);return _0x7db1b5(_0x83c867['error'][_0x8ecc('0x14')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x38297a,_0x83c867[_0x8ecc('0x13')][_0x8ecc('0x14')]);return _0x34858e(_0x83c867['error'][_0x8ecc('0x14')]);}else{logger[_0x8ecc('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0x38297a,_0x8ecc('0xf'));_0x34858e(_0x83c867['result'][_0x8ecc('0x14')]);}})[_0x8ecc('0x15')](function(_0x2f44d4){logger[_0x8ecc('0x13')](_0x8ecc('0xe'),_0x38297a,_0x2f44d4);_0x7db1b5(_0x2f44d4);});});}exports[_0x8ecc('0x16')]=function(_0x4bdecd){var _0x11c274=this;return new Promise(function(_0x4e05c4,_0x365f3d){return db[_0x8ecc('0x17')]['findAll']({'raw':_0x4bdecd[_0x8ecc('0x18')]?_0x4bdecd['options'][_0x8ecc('0x19')]===undefined?!![]:![]:!![],'where':_0x4bdecd['options']?_0x4bdecd[_0x8ecc('0x18')][_0x8ecc('0x1a')]||null:null,'attributes':_0x4bdecd[_0x8ecc('0x18')]?_0x4bdecd[_0x8ecc('0x18')][_0x8ecc('0x1b')]||null:null,'limit':_0x4bdecd['options']?_0x4bdecd[_0x8ecc('0x18')][_0x8ecc('0x1c')]||null:null,'include':_0x4bdecd['options']?_0x4bdecd['options'][_0x8ecc('0x1d')]?_['map'](_0x4bdecd['options']['include'],function(_0x57c979){return{'model':db[_0x57c979['model']],'as':_0x57c979['as'],'attributes':_0x57c979[_0x8ecc('0x1b')],'include':_0x57c979[_0x8ecc('0x1d')]?_[_0x8ecc('0x1e')](_0x57c979[_0x8ecc('0x1d')],function(_0x29b591){return{'model':db[_0x29b591[_0x8ecc('0x1f')]],'as':_0x29b591['as'],'attributes':_0x29b591[_0x8ecc('0x1b')],'include':_0x29b591['include']?_[_0x8ecc('0x1e')](_0x29b591['include'],function(_0x83b54b){return{'model':db[_0x83b54b[_0x8ecc('0x1f')]],'as':_0x83b54b['as'],'attributes':_0x83b54b[_0x8ecc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f0c7e){logger[_0x8ecc('0xd')](_0x8ecc('0x16'),_0x4bdecd);logger[_0x8ecc('0x10')](_0x8ecc('0x16'),_0x4bdecd,JSON[_0x8ecc('0x12')](_0x5f0c7e));_0x4e05c4(_0x5f0c7e);})[_0x8ecc('0x15')](function(_0x252154){logger[_0x8ecc('0x13')]('GetVoiceQueueReport',_0x252154[_0x8ecc('0x14')],_0x4bdecd);_0x365f3d(_0x11c274['error'](0x1f4,_0x252154[_0x8ecc('0x14')]));});});};exports['CreateVoiceQueueReport']=function(_0x2e53d3){var _0x1d0c35=this;return new Promise(function(_0x628d84,_0x334455){return db[_0x8ecc('0x17')][_0x8ecc('0x20')](_0x2e53d3[_0x8ecc('0x21')],{'raw':_0x2e53d3['options']?_0x2e53d3[_0x8ecc('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x8ecc('0x22')](function(_0x98343f){logger[_0x8ecc('0xd')]('CreateVoiceQueueReport',_0x2e53d3);logger[_0x8ecc('0x10')](_0x8ecc('0x23'),_0x2e53d3,JSON[_0x8ecc('0x12')](_0x98343f));_0x628d84(_0x98343f);})[_0x8ecc('0x15')](function(_0x6704fd){logger[_0x8ecc('0x13')](_0x8ecc('0x23'),_0x6704fd[_0x8ecc('0x14')],_0x2e53d3);_0x334455(_0x1d0c35['error'](0x1f4,_0x6704fd[_0x8ecc('0x14')]));});});};exports[_0x8ecc('0x24')]=function(_0x28ea3d){var _0x254165=this;return new Promise(function(_0x40c2a4,_0x5b1949){return db['VoiceQueueReport'][_0x8ecc('0x25')](_0x28ea3d[_0x8ecc('0x21')],{'raw':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x1a')]||null:null,'attributes':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x1b')]||null:null,'limit':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x1c')]||null:null})[_0x8ecc('0x22')](function(_0x5e1ac9){logger[_0x8ecc('0xd')](_0x8ecc('0x24'),_0x28ea3d);logger[_0x8ecc('0x10')](_0x8ecc('0x24'),_0x28ea3d,JSON[_0x8ecc('0x12')](_0x5e1ac9));_0x40c2a4(_0x5e1ac9);})[_0x8ecc('0x15')](function(_0x123e8f){logger[_0x8ecc('0x13')](_0x8ecc('0x24'),_0x123e8f[_0x8ecc('0x14')],_0x28ea3d);_0x5b1949(_0x254165[_0x8ecc('0x13')](0x1f4,_0x123e8f[_0x8ecc('0x14')]));});});}; \ No newline at end of file +var _0xed42=['redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','where','limit','include','map','model','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3cecd4,_0xb0bcf6){var _0x3d3577=function(_0x10a3fe){while(--_0x10a3fe){_0x3cecd4['push'](_0x3cecd4['shift']());}};_0x3d3577(++_0xb0bcf6);}(_0xed42,0xc9));var _0x2ed4=function(_0x121e52,_0x48e0d2){_0x121e52=_0x121e52-0x0;var _0x5b6f18=_0xed42[_0x121e52];return _0x5b6f18;};'use strict';var _=require(_0x2ed4('0x0'));var util=require(_0x2ed4('0x1'));var moment=require('moment');var BPromise=require(_0x2ed4('0x2'));var rs=require(_0x2ed4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2ed4('0x4'));var logger=require(_0x2ed4('0x5'))(_0x2ed4('0x6'));var config=require(_0x2ed4('0x7'));var jayson=require(_0x2ed4('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x2ed4('0x9')]=_['defaults'](config[_0x2ed4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ed4('0xa'))(new Redis(config[_0x2ed4('0x9')]));require(_0x2ed4('0xb'))[_0x2ed4('0xc')](socket);function respondWithRpcPromise(_0x4dc77c,_0x53ea89,_0x2274f6){return new BPromise(function(_0x2d0d5b,_0x368109){return client[_0x2ed4('0xd')](_0x4dc77c,_0x2274f6)[_0x2ed4('0xe')](function(_0x2143a6){logger[_0x2ed4('0xf')](_0x2ed4('0x10'),_0x53ea89,_0x2ed4('0x11'));logger[_0x2ed4('0x12')](_0x2ed4('0x13'),_0x53ea89,_0x2ed4('0x11'),JSON[_0x2ed4('0x14')](_0x2143a6));if(_0x2143a6[_0x2ed4('0x15')]){if(_0x2143a6[_0x2ed4('0x15')][_0x2ed4('0x16')]===0x1f4){logger[_0x2ed4('0x15')](_0x2ed4('0x10'),_0x53ea89,_0x2143a6[_0x2ed4('0x15')][_0x2ed4('0x17')]);return _0x368109(_0x2143a6[_0x2ed4('0x15')]['message']);}logger[_0x2ed4('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x53ea89,_0x2143a6['error'][_0x2ed4('0x17')]);return _0x2d0d5b(_0x2143a6[_0x2ed4('0x15')][_0x2ed4('0x17')]);}else{logger[_0x2ed4('0xf')](_0x2ed4('0x10'),_0x53ea89,_0x2ed4('0x11'));_0x2d0d5b(_0x2143a6[_0x2ed4('0x18')][_0x2ed4('0x17')]);}})[_0x2ed4('0x19')](function(_0x517e7a){logger[_0x2ed4('0x15')](_0x2ed4('0x10'),_0x53ea89,_0x517e7a);_0x368109(_0x517e7a);});});}exports[_0x2ed4('0x1a')]=function(_0x46c8a0){var _0x2548bc=this;return new Promise(function(_0x23625e,_0x37631f){return db['VoiceQueueReport'][_0x2ed4('0x1b')]({'raw':_0x46c8a0['options']?_0x46c8a0[_0x2ed4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x46c8a0[_0x2ed4('0x1c')]?_0x46c8a0[_0x2ed4('0x1c')][_0x2ed4('0x1d')]||null:null,'attributes':_0x46c8a0['options']?_0x46c8a0[_0x2ed4('0x1c')]['attributes']||null:null,'limit':_0x46c8a0[_0x2ed4('0x1c')]?_0x46c8a0[_0x2ed4('0x1c')][_0x2ed4('0x1e')]||null:null,'include':_0x46c8a0['options']?_0x46c8a0[_0x2ed4('0x1c')][_0x2ed4('0x1f')]?_[_0x2ed4('0x20')](_0x46c8a0['options']['include'],function(_0x26c49b){return{'model':db[_0x26c49b[_0x2ed4('0x21')]],'as':_0x26c49b['as'],'attributes':_0x26c49b[_0x2ed4('0x22')],'include':_0x26c49b[_0x2ed4('0x1f')]?_['map'](_0x26c49b[_0x2ed4('0x1f')],function(_0x2c2bdc){return{'model':db[_0x2c2bdc[_0x2ed4('0x21')]],'as':_0x2c2bdc['as'],'attributes':_0x2c2bdc[_0x2ed4('0x22')],'include':_0x2c2bdc[_0x2ed4('0x1f')]?_[_0x2ed4('0x20')](_0x2c2bdc[_0x2ed4('0x1f')],function(_0x3b3f64){return{'model':db[_0x3b3f64['model']],'as':_0x3b3f64['as'],'attributes':_0x3b3f64[_0x2ed4('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41ce5b){logger[_0x2ed4('0xf')](_0x2ed4('0x1a'),_0x46c8a0);logger[_0x2ed4('0x12')](_0x2ed4('0x1a'),_0x46c8a0,JSON[_0x2ed4('0x14')](_0x41ce5b));_0x23625e(_0x41ce5b);})[_0x2ed4('0x19')](function(_0x5d1ae5){logger[_0x2ed4('0x15')](_0x2ed4('0x1a'),_0x5d1ae5[_0x2ed4('0x17')],_0x46c8a0);_0x37631f(_0x2548bc[_0x2ed4('0x15')](0x1f4,_0x5d1ae5['message']));});});};exports[_0x2ed4('0x23')]=function(_0x16255c){var _0x2075a2=this;return new Promise(function(_0x1d5f35,_0x418671){return db[_0x2ed4('0x24')][_0x2ed4('0x25')](_0x16255c[_0x2ed4('0x26')],{'raw':_0x16255c['options']?_0x16255c[_0x2ed4('0x1c')][_0x2ed4('0x27')]===undefined?!![]:![]:!![]})[_0x2ed4('0xe')](function(_0x4f5949){logger[_0x2ed4('0xf')](_0x2ed4('0x23'),_0x16255c);logger[_0x2ed4('0x12')](_0x2ed4('0x23'),_0x16255c,JSON[_0x2ed4('0x14')](_0x4f5949));_0x1d5f35(_0x4f5949);})[_0x2ed4('0x19')](function(_0x805d54){logger[_0x2ed4('0x15')](_0x2ed4('0x23'),_0x805d54[_0x2ed4('0x17')],_0x16255c);_0x418671(_0x2075a2[_0x2ed4('0x15')](0x1f4,_0x805d54[_0x2ed4('0x17')]));});});};exports[_0x2ed4('0x28')]=function(_0xd47ce5){var _0x2c08de=this;return new Promise(function(_0x5f2b74,_0xe56427){return db[_0x2ed4('0x24')][_0x2ed4('0x29')](_0xd47ce5[_0x2ed4('0x26')],{'raw':_0xd47ce5['options']?_0xd47ce5[_0x2ed4('0x1c')][_0x2ed4('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd47ce5['options']?_0xd47ce5[_0x2ed4('0x1c')][_0x2ed4('0x1d')]||null:null,'attributes':_0xd47ce5[_0x2ed4('0x1c')]?_0xd47ce5[_0x2ed4('0x1c')][_0x2ed4('0x22')]||null:null,'limit':_0xd47ce5[_0x2ed4('0x1c')]?_0xd47ce5['options'][_0x2ed4('0x1e')]||null:null})[_0x2ed4('0xe')](function(_0xeeb042){logger[_0x2ed4('0xf')]('UpdateVoiceQueueReport',_0xd47ce5);logger['debug'](_0x2ed4('0x28'),_0xd47ce5,JSON['stringify'](_0xeeb042));_0x5f2b74(_0xeeb042);})['catch'](function(_0x4e7e62){logger[_0x2ed4('0x15')](_0x2ed4('0x28'),_0x4e7e62[_0x2ed4('0x17')],_0xd47ce5);_0xe56427(_0x2c08de[_0x2ed4('0x15')](0x1f4,_0x4e7e62['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 80a2007..ad240b4 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 _0x0541=['voiceQueueReport:','remove','update','emit','removeListener','register','length'];(function(_0x19ae71,_0x1bc73f){var _0x42026f=function(_0x2943a9){while(--_0x2943a9){_0x19ae71['push'](_0x19ae71['shift']());}};_0x42026f(++_0x1bc73f);}(_0x0541,0x86));var _0x1054=function(_0xac9b71,_0x4c8fa2){_0xac9b71=_0xac9b71-0x0;var _0x276103=_0x0541[_0xac9b71];return _0x276103;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x1054('0x0'),_0x1054('0x1')];function createListener(_0x29fda8,_0x3b56fc){return function(_0x231cb1){_0x3b56fc[_0x1054('0x2')](_0x29fda8,_0x231cb1);};}function removeListener(_0x58c5ff,_0x2bb8ad){return function(){VoiceQueueReportEvents[_0x1054('0x3')](_0x58c5ff,_0x2bb8ad);};}exports[_0x1054('0x4')]=function(_0x5cf411){for(var _0x3b9d9d=0x0,_0x1bdd69=events[_0x1054('0x5')];_0x3b9d9d<_0x1bdd69;_0x3b9d9d++){var _0xcb15a3=events[_0x3b9d9d];var _0x1a0c57=createListener(_0x1054('0x6')+_0xcb15a3,_0x5cf411);VoiceQueueReportEvents['on'](_0xcb15a3,_0x1a0c57);}}; \ No newline at end of file +var _0xfe5f=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x133c36,_0xecec59){var _0x507a82=function(_0x3fe923){while(--_0x3fe923){_0x133c36['push'](_0x133c36['shift']());}};_0x507a82(++_0xecec59);}(_0xfe5f,0x1b5));var _0xffe5=function(_0x4a931d,_0x1846f9){_0x4a931d=_0x4a931d-0x0;var _0x56ab49=_0xfe5f[_0x4a931d];return _0x56ab49;};'use strict';var VoiceQueueReportEvents=require(_0xffe5('0x0'));var events=[_0xffe5('0x1'),_0xffe5('0x2'),_0xffe5('0x3')];function createListener(_0x3fa311,_0x336a9e){return function(_0x4fa8e5){_0x336a9e['emit'](_0x3fa311,_0x4fa8e5);};}function removeListener(_0x172b77,_0x4ac03c){return function(){VoiceQueueReportEvents['removeListener'](_0x172b77,_0x4ac03c);};}exports[_0xffe5('0x4')]=function(_0x5e8689){for(var _0x10f39c=0x0,_0x48d8a6=events[_0xffe5('0x5')];_0x10f39c<_0x48d8a6;_0x10f39c++){var _0x1cba76=events[_0x10f39c];var _0x25484b=createListener(_0xffe5('0x6')+_0x1cba76,_0x5e8689);VoiceQueueReportEvents['on'](_0x1cba76,_0x25484b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9ce14d6..079932a 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 _0xad37=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','/:id','show'];(function(_0x109c40,_0x3463fa){var _0x3d5aed=function(_0x236b3f){while(--_0x236b3f){_0x109c40['push'](_0x109c40['shift']());}};_0x3d5aed(++_0x3463fa);}(_0xad37,0xaf));var _0x7ad3=function(_0x4f23f4,_0x218ef3){_0x4f23f4=_0x4f23f4-0x0;var _0x440743=_0xad37[_0x4f23f4];return _0x440743;};'use strict';var multer=require(_0x7ad3('0x0'));var util=require(_0x7ad3('0x1'));var path=require(_0x7ad3('0x2'));var timeout=require(_0x7ad3('0x3'));var express=require(_0x7ad3('0x4'));var router=express[_0x7ad3('0x5')]();var auth=require(_0x7ad3('0x6'));var interaction=require(_0x7ad3('0x7'));var config=require(_0x7ad3('0x8'));var controller=require(_0x7ad3('0x9'));router['get']('/',auth[_0x7ad3('0xa')](),controller[_0x7ad3('0xb')]);router['get'](_0x7ad3('0xc'),auth[_0x7ad3('0xa')](),controller[_0x7ad3('0xd')]);router[_0x7ad3('0xe')]('/',auth[_0x7ad3('0xa')](),controller[_0x7ad3('0xf')]);router[_0x7ad3('0x10')](_0x7ad3('0xc'),auth[_0x7ad3('0xa')](),controller[_0x7ad3('0x11')]);router[_0x7ad3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7ad3('0x13')]);module[_0x7ad3('0x14')]=router; \ No newline at end of file +var _0xc431=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc431,0x15c));var _0x1c43=function(_0x5e2d7d,_0x3ed5f9){_0x5e2d7d=_0x5e2d7d-0x0;var _0x1d5e07=_0xc431[_0x5e2d7d];return _0x1d5e07;};'use strict';var multer=require(_0x1c43('0x0'));var util=require(_0x1c43('0x1'));var path=require(_0x1c43('0x2'));var timeout=require(_0x1c43('0x3'));var express=require('express');var router=express[_0x1c43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1c43('0x5'));var config=require(_0x1c43('0x6'));var controller=require(_0x1c43('0x7'));router['get']('/',auth[_0x1c43('0x8')](),controller[_0x1c43('0x9')]);router[_0x1c43('0xa')](_0x1c43('0xb'),auth[_0x1c43('0x8')](),controller[_0x1c43('0xc')]);router['post']('/',auth[_0x1c43('0x8')](),controller[_0x1c43('0xd')]);router[_0x1c43('0xe')](_0x1c43('0xb'),auth['isAuthenticated'](),controller[_0x1c43('0xf')]);router[_0x1c43('0x10')](_0x1c43('0xb'),auth[_0x1c43('0x8')](),controller[_0x1c43('0x11')]);module[_0x1c43('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2285733..e4da767 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 _0x3c59=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x15f49e,_0x5360dd){var _0x968c0c=function(_0x5aeaae){while(--_0x5aeaae){_0x15f49e['push'](_0x15f49e['shift']());}};_0x968c0c(++_0x5360dd);}(_0x3c59,0x106));var _0x93c5=function(_0x1800cb,_0xba50f9){_0x1800cb=_0x1800cb-0x0;var _0x3b5e95=_0x3c59[_0x1800cb];return _0x3b5e95;};'use strict';var Sequelize=require(_0x93c5('0x0'));var moment=require(_0x93c5('0x1'));module['exports']={'time':{'type':Sequelize[_0x93c5('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x93c5('0x3')](_0x93c5('0x4'))}}; \ No newline at end of file +var _0x43e7=['sequelize','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x43e7,0x1e8));var _0x743e=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0x43e7[_0xd816e2];return _0x1f5924;};'use strict';var Sequelize=require(_0x743e('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x743e('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x743e('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x743e('0x2')],'allowNull':![],'defaultValue':moment()['format'](_0x743e('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f2628ee..4190084 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 _0xd05c=['zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','includeAll','findAll','catch','show','params','length','include','find','create','body','destroy','html-pdf','eml-format','rimraf'];(function(_0xef5841,_0x24d3cf){var _0x288b5d=function(_0x3fc602){while(--_0x3fc602){_0xef5841['push'](_0xef5841['shift']());}};_0x288b5d(++_0x24d3cf);}(_0xd05c,0x179));var _0xcd05=function(_0x33ab9f,_0xefe0c7){_0x33ab9f=_0x33ab9f-0x0;var _0x1aae3f=_0xd05c[_0x33ab9f];return _0x1aae3f;};'use strict';var pdf=require(_0xcd05('0x0'));var emlformat=require(_0xcd05('0x1'));var rimraf=require(_0xcd05('0x2'));var zipdir=require(_0xcd05('0x3'));var jsonpatch=require(_0xcd05('0x4'));var rp=require('request-promise');var moment=require(_0xcd05('0x5'));var BPromise=require(_0xcd05('0x6'));var Mustache=require('mustache');var util=require(_0xcd05('0x7'));var path=require(_0xcd05('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd05('0x9'));var fs=require('fs');var _=require(_0xcd05('0xa'));var squel=require(_0xcd05('0xb'));var crypto=require(_0xcd05('0xc'));var jsforce=require(_0xcd05('0xd'));var deskjs=require(_0xcd05('0xe'));var toCsv=require(_0xcd05('0xf'));var querystring=require('querystring');var Papa=require(_0xcd05('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd05('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd05('0x12'))(_0xcd05('0x13'));var utils=require(_0xcd05('0x14'));var config=require(_0xcd05('0x15'));var licenseUtil=require(_0xcd05('0x16'));var db=require(_0xcd05('0x17'))['db'];function respondWithStatusCode(_0x4c1081,_0x294475){_0x294475=_0x294475||0xcc;return function(_0x571250){if(_0x571250){return _0x4c1081[_0xcd05('0x18')](_0x294475);}return _0x4c1081[_0xcd05('0x19')](_0x294475)[_0xcd05('0x1a')]();};}function respondWithResult(_0x202ad1,_0x1b44c4){_0x1b44c4=_0x1b44c4||0xc8;return function(_0x2833a1){if(_0x2833a1){return _0x202ad1[_0xcd05('0x19')](_0x1b44c4)[_0xcd05('0x1b')](_0x2833a1);}};}function respondWithFilteredResult(_0x3f37ae,_0x1521f0){return function(_0x4e572d){if(_0x4e572d){var _0x38ad74=_0x4e572d[_0xcd05('0x1c')],_0x457426=_0x1521f0[_0xcd05('0x1d')],_0x1ec500=_0x1521f0['offset']+_0x1521f0[_0xcd05('0x1e')],_0x1a2979;if(_0x1ec500>=_0x38ad74){_0x1ec500=_0x38ad74;_0x1a2979=0xc8;}else{_0x1a2979=0xce;}_0x3f37ae['status'](_0x1a2979);return _0x3f37ae[_0xcd05('0x1f')](_0xcd05('0x20'),_0x457426+'-'+_0x1ec500+'/'+_0x38ad74)[_0xcd05('0x1b')](_0x4e572d);}return null;};}function patchUpdates(_0x3d89d0){return function(_0x238fb9){try{jsonpatch[_0xcd05('0x21')](_0x238fb9,_0x3d89d0,!![]);}catch(_0x456429){return BPromise[_0xcd05('0x22')](_0x456429);}return _0x238fb9[_0xcd05('0x23')]();};}function saveUpdates(_0x44801c,_0x352ef5){return function(_0x3182fd){if(_0x3182fd){return _0x3182fd[_0xcd05('0x24')](_0x44801c)[_0xcd05('0x25')](function(_0x2a7e8f){return _0x2a7e8f;});}return null;};}function removeEntity(_0x3c3bda,_0x497911){return function(_0x2af58f){if(_0x2af58f){return _0x2af58f['destroy']()['then'](function(){_0x3c3bda[_0xcd05('0x19')](0xcc)[_0xcd05('0x1a')]();});}};}function handleEntityNotFound(_0x922307,_0x107653){return function(_0x5c5160){if(!_0x5c5160){_0x922307[_0xcd05('0x18')](0x194);}return _0x5c5160;};}function handleError(_0x4ebbb7,_0x6628b0){_0x6628b0=_0x6628b0||0x1f4;return function(_0x37c2e8){logger[_0xcd05('0x26')](_0x37c2e8[_0xcd05('0x27')]);if(_0x37c2e8[_0xcd05('0x28')]){delete _0x37c2e8['name'];}_0x4ebbb7['status'](_0x6628b0)[_0xcd05('0x29')](_0x37c2e8);};}exports[_0xcd05('0x2a')]=function(_0x703c3f,_0x4a8906){var _0x2f40a0={},_0x2d2075={},_0x120867={'count':0x0,'rows':[]};var _0x49dbd3=_[_0xcd05('0x2b')](db['VoiceQueuesLog'][_0xcd05('0x2c')],function(_0x48a11e){return{'name':_0x48a11e['fieldName'],'type':_0x48a11e['type'][_0xcd05('0x2d')]};});_0x2d2075[_0xcd05('0x2e')]=_['map'](_0x49dbd3,'name');_0x2d2075[_0xcd05('0x2f')]=_[_0xcd05('0x30')](_0x703c3f[_0xcd05('0x2f')]);_0x2d2075['filters']=_[_0xcd05('0x31')](_0x2d2075['model'],_0x2d2075[_0xcd05('0x2f')]);_0x2f40a0['attributes']=_[_0xcd05('0x31')](_0x2d2075[_0xcd05('0x2e')],qs[_0xcd05('0x32')](_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x32')]));_0x2f40a0[_0xcd05('0x33')]=_0x2f40a0[_0xcd05('0x33')]['length']?_0x2f40a0['attributes']:_0x2d2075[_0xcd05('0x2e')];if(!_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x34')](_0xcd05('0x35'))){_0x2f40a0['limit']=qs[_0xcd05('0x1e')](_0x703c3f[_0xcd05('0x2f')]['limit']);_0x2f40a0[_0xcd05('0x1d')]=qs[_0xcd05('0x1d')](_0x703c3f[_0xcd05('0x2f')]['offset']);}_0x2f40a0[_0xcd05('0x36')]=qs['sort'](_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x37')]);_0x2f40a0[_0xcd05('0x38')]=qs[_0xcd05('0x39')](_[_0xcd05('0x3a')](_0x703c3f[_0xcd05('0x2f')],_0x2d2075['filters']),_0x49dbd3);if(_0x703c3f['query'][_0xcd05('0x3b')]){_0x2f40a0['where']=_[_0xcd05('0x3c')](_0x2f40a0[_0xcd05('0x38')],{'$or':_['map'](_0x49dbd3,function(_0x3a6a37){if(_0x3a6a37[_0xcd05('0x3d')]!==_0xcd05('0x3e')){var _0x55b2cd={};_0x55b2cd[_0x3a6a37[_0xcd05('0x28')]]={'$like':'%'+_0x703c3f['query'][_0xcd05('0x3b')]+'%'};return _0x55b2cd;}})});}_0x2f40a0=_[_0xcd05('0x3c')]({},_0x2f40a0,_0x703c3f[_0xcd05('0x3f')]);var _0x277e52={'where':_0x2f40a0[_0xcd05('0x38')]};return db[_0xcd05('0x40')][_0xcd05('0x1c')](_0x277e52)[_0xcd05('0x25')](function(_0x383795){_0x120867['count']=_0x383795;if(_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x41')]){_0x2f40a0['include']=[{'all':!![]}];}return db[_0xcd05('0x40')][_0xcd05('0x42')](_0x2f40a0);})[_0xcd05('0x25')](function(_0x3cf848){_0x120867['rows']=_0x3cf848;return _0x120867;})['then'](respondWithFilteredResult(_0x4a8906,_0x2f40a0))[_0xcd05('0x43')](handleError(_0x4a8906,null));};exports[_0xcd05('0x44')]=function(_0x26d14c,_0xa90c1b){var _0x55506f={'raw':!![],'where':{'id':_0x26d14c[_0xcd05('0x45')]['id']}},_0x2df1e1={};_0x2df1e1['model']=_[_0xcd05('0x30')](db[_0xcd05('0x40')]['rawAttributes']);_0x2df1e1[_0xcd05('0x2f')]=_[_0xcd05('0x30')](_0x26d14c[_0xcd05('0x2f')]);_0x2df1e1[_0xcd05('0x39')]=_[_0xcd05('0x31')](_0x2df1e1['model'],_0x2df1e1[_0xcd05('0x2f')]);_0x55506f[_0xcd05('0x33')]=_[_0xcd05('0x31')](_0x2df1e1[_0xcd05('0x2e')],qs[_0xcd05('0x32')](_0x26d14c['query'][_0xcd05('0x32')]));_0x55506f[_0xcd05('0x33')]=_0x55506f[_0xcd05('0x33')][_0xcd05('0x46')]?_0x55506f[_0xcd05('0x33')]:_0x2df1e1[_0xcd05('0x2e')];if(_0x26d14c[_0xcd05('0x2f')][_0xcd05('0x41')]){_0x55506f[_0xcd05('0x47')]=[{'all':!![]}];}_0x55506f=_[_0xcd05('0x3c')]({},_0x55506f,_0x26d14c[_0xcd05('0x3f')]);return db[_0xcd05('0x40')][_0xcd05('0x48')](_0x55506f)[_0xcd05('0x25')](handleEntityNotFound(_0xa90c1b,null))['then'](respondWithResult(_0xa90c1b,null))['catch'](handleError(_0xa90c1b,null));};exports[_0xcd05('0x49')]=function(_0x38b5ff,_0x51af5b){return db[_0xcd05('0x40')][_0xcd05('0x49')](_0x38b5ff[_0xcd05('0x4a')],{})[_0xcd05('0x25')](respondWithResult(_0x51af5b,0xc9))[_0xcd05('0x43')](handleError(_0x51af5b,null));};exports[_0xcd05('0x24')]=function(_0x1d477d,_0x2462cf){if(_0x1d477d[_0xcd05('0x4a')]['id']){delete _0x1d477d['body']['id'];}return db[_0xcd05('0x40')][_0xcd05('0x48')]({'where':{'id':_0x1d477d[_0xcd05('0x45')]['id']}})[_0xcd05('0x25')](handleEntityNotFound(_0x2462cf,null))[_0xcd05('0x25')](saveUpdates(_0x1d477d[_0xcd05('0x4a')],null))[_0xcd05('0x25')](respondWithResult(_0x2462cf,null))[_0xcd05('0x43')](handleError(_0x2462cf,null));};exports[_0xcd05('0x4b')]=function(_0x25baab,_0x4bcb4a){return db[_0xcd05('0x40')][_0xcd05('0x48')]({'where':{'id':_0x25baab[_0xcd05('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bcb4a,null))[_0xcd05('0x25')](removeEntity(_0x4bcb4a,null))['catch'](handleError(_0x4bcb4a,null));}; \ No newline at end of file +var _0x1a23=['Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','VoiceQueuesLog','findAll','catch','show','rawAttributes','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set'];(function(_0x47f2ce,_0x1ec3f6){var _0x3d4480=function(_0x385f7d){while(--_0x385f7d){_0x47f2ce['push'](_0x47f2ce['shift']());}};_0x3d4480(++_0x1ec3f6);}(_0x1a23,0xc3));var _0x31a2=function(_0x5be1a6,_0x469fda){_0x5be1a6=_0x5be1a6-0x0;var _0x5b40f1=_0x1a23[_0x5be1a6];return _0x5b40f1;};'use strict';var pdf=require(_0x31a2('0x0'));var emlformat=require(_0x31a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31a2('0x2'));var jsonpatch=require(_0x31a2('0x3'));var rp=require(_0x31a2('0x4'));var moment=require(_0x31a2('0x5'));var BPromise=require(_0x31a2('0x6'));var Mustache=require(_0x31a2('0x7'));var util=require(_0x31a2('0x8'));var path=require(_0x31a2('0x9'));var sox=require(_0x31a2('0xa'));var csv=require(_0x31a2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x31a2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x31a2('0xd'));var deskjs=require(_0x31a2('0xe'));var toCsv=require(_0x31a2('0xb'));var querystring=require(_0x31a2('0xf'));var Papa=require(_0x31a2('0x10'));var Redis=require(_0x31a2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x31a2('0x12'));var as=require(_0x31a2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x31a2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x31a2('0x15'));var db=require(_0x31a2('0x16'))['db'];function respondWithStatusCode(_0x1a4c7b,_0x486380){_0x486380=_0x486380||0xcc;return function(_0x37dc47){if(_0x37dc47){return _0x1a4c7b['sendStatus'](_0x486380);}return _0x1a4c7b[_0x31a2('0x17')](_0x486380)[_0x31a2('0x18')]();};}function respondWithResult(_0xae4d1a,_0x6491ff){_0x6491ff=_0x6491ff||0xc8;return function(_0x465e32){if(_0x465e32){return _0xae4d1a['status'](_0x6491ff)[_0x31a2('0x19')](_0x465e32);}};}function respondWithFilteredResult(_0x39d206,_0x4e6959){return function(_0x1937bf){if(_0x1937bf){var _0x719991=_0x1937bf[_0x31a2('0x1a')],_0x1fef77=_0x4e6959[_0x31a2('0x1b')],_0x498ca6=_0x4e6959[_0x31a2('0x1b')]+_0x4e6959[_0x31a2('0x1c')],_0x4cb0e4;if(_0x498ca6>=_0x719991){_0x498ca6=_0x719991;_0x4cb0e4=0xc8;}else{_0x4cb0e4=0xce;}_0x39d206[_0x31a2('0x17')](_0x4cb0e4);return _0x39d206[_0x31a2('0x1d')](_0x31a2('0x1e'),_0x1fef77+'-'+_0x498ca6+'/'+_0x719991)[_0x31a2('0x19')](_0x1937bf);}return null;};}function patchUpdates(_0x7d8857){return function(_0x411496){try{jsonpatch[_0x31a2('0x1f')](_0x411496,_0x7d8857,!![]);}catch(_0xccae86){return BPromise[_0x31a2('0x20')](_0xccae86);}return _0x411496[_0x31a2('0x21')]();};}function saveUpdates(_0x236e39,_0x331376){return function(_0x4720b9){if(_0x4720b9){return _0x4720b9[_0x31a2('0x22')](_0x236e39)['then'](function(_0xee928a){return _0xee928a;});}return null;};}function removeEntity(_0x48b681,_0x160031){return function(_0x829f49){if(_0x829f49){return _0x829f49[_0x31a2('0x23')]()[_0x31a2('0x24')](function(){_0x48b681[_0x31a2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6d96,_0x3d2e35){return function(_0x1a2661){if(!_0x1a2661){_0x1c6d96[_0x31a2('0x25')](0x194);}return _0x1a2661;};}function handleError(_0x45a161,_0x306aa6){_0x306aa6=_0x306aa6||0x1f4;return function(_0x3b5aa3){logger[_0x31a2('0x26')](_0x3b5aa3[_0x31a2('0x27')]);if(_0x3b5aa3[_0x31a2('0x28')]){delete _0x3b5aa3['name'];}_0x45a161[_0x31a2('0x17')](_0x306aa6)[_0x31a2('0x29')](_0x3b5aa3);};}exports[_0x31a2('0x2a')]=function(_0x12af55,_0x5d478f){var _0x43d0e7={},_0x18d9b0={},_0x208ebe={'count':0x0,'rows':[]};var _0x25256d=_[_0x31a2('0x2b')](db['VoiceQueuesLog']['rawAttributes'],function(_0x110ba2){return{'name':_0x110ba2[_0x31a2('0x2c')],'type':_0x110ba2[_0x31a2('0x2d')][_0x31a2('0x2e')]};});_0x18d9b0[_0x31a2('0x2f')]=_[_0x31a2('0x2b')](_0x25256d,_0x31a2('0x28'));_0x18d9b0[_0x31a2('0x30')]=_[_0x31a2('0x31')](_0x12af55[_0x31a2('0x30')]);_0x18d9b0['filters']=_[_0x31a2('0x32')](_0x18d9b0[_0x31a2('0x2f')],_0x18d9b0[_0x31a2('0x30')]);_0x43d0e7['attributes']=_[_0x31a2('0x32')](_0x18d9b0['model'],qs[_0x31a2('0x33')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x33')]));_0x43d0e7[_0x31a2('0x34')]=_0x43d0e7[_0x31a2('0x34')]['length']?_0x43d0e7[_0x31a2('0x34')]:_0x18d9b0[_0x31a2('0x2f')];if(!_0x12af55[_0x31a2('0x30')][_0x31a2('0x35')](_0x31a2('0x36'))){_0x43d0e7['limit']=qs[_0x31a2('0x1c')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x1c')]);_0x43d0e7[_0x31a2('0x1b')]=qs[_0x31a2('0x1b')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x1b')]);}_0x43d0e7[_0x31a2('0x37')]=qs[_0x31a2('0x38')](_0x12af55[_0x31a2('0x30')][_0x31a2('0x38')]);_0x43d0e7[_0x31a2('0x39')]=qs[_0x31a2('0x3a')](_[_0x31a2('0x3b')](_0x12af55[_0x31a2('0x30')],_0x18d9b0[_0x31a2('0x3a')]),_0x25256d);if(_0x12af55[_0x31a2('0x30')][_0x31a2('0x3c')]){_0x43d0e7[_0x31a2('0x39')]=_['merge'](_0x43d0e7['where'],{'$or':_['map'](_0x25256d,function(_0x4cfe1a){if(_0x4cfe1a[_0x31a2('0x2d')]!==_0x31a2('0x3d')){var _0x19614e={};_0x19614e[_0x4cfe1a[_0x31a2('0x28')]]={'$like':'%'+_0x12af55[_0x31a2('0x30')][_0x31a2('0x3c')]+'%'};return _0x19614e;}})});}_0x43d0e7=_[_0x31a2('0x3e')]({},_0x43d0e7,_0x12af55[_0x31a2('0x3f')]);var _0xc100={'where':_0x43d0e7[_0x31a2('0x39')]};return db['VoiceQueuesLog'][_0x31a2('0x1a')](_0xc100)[_0x31a2('0x24')](function(_0x401b58){_0x208ebe[_0x31a2('0x1a')]=_0x401b58;if(_0x12af55[_0x31a2('0x30')][_0x31a2('0x40')]){_0x43d0e7[_0x31a2('0x41')]=[{'all':!![]}];}return db[_0x31a2('0x42')][_0x31a2('0x43')](_0x43d0e7);})['then'](function(_0x3da238){_0x208ebe['rows']=_0x3da238;return _0x208ebe;})[_0x31a2('0x24')](respondWithFilteredResult(_0x5d478f,_0x43d0e7))[_0x31a2('0x44')](handleError(_0x5d478f,null));};exports[_0x31a2('0x45')]=function(_0x148b79,_0x383db7){var _0x84bc84={'raw':!![],'where':{'id':_0x148b79['params']['id']}},_0x5308cd={};_0x5308cd[_0x31a2('0x2f')]=_[_0x31a2('0x31')](db['VoiceQueuesLog'][_0x31a2('0x46')]);_0x5308cd[_0x31a2('0x30')]=_['keys'](_0x148b79[_0x31a2('0x30')]);_0x5308cd[_0x31a2('0x3a')]=_[_0x31a2('0x32')](_0x5308cd[_0x31a2('0x2f')],_0x5308cd['query']);_0x84bc84[_0x31a2('0x34')]=_['intersection'](_0x5308cd[_0x31a2('0x2f')],qs[_0x31a2('0x33')](_0x148b79['query'][_0x31a2('0x33')]));_0x84bc84[_0x31a2('0x34')]=_0x84bc84[_0x31a2('0x34')]['length']?_0x84bc84[_0x31a2('0x34')]:_0x5308cd['model'];if(_0x148b79[_0x31a2('0x30')]['includeAll']){_0x84bc84['include']=[{'all':!![]}];}_0x84bc84=_[_0x31a2('0x3e')]({},_0x84bc84,_0x148b79[_0x31a2('0x3f')]);return db[_0x31a2('0x42')][_0x31a2('0x47')](_0x84bc84)[_0x31a2('0x24')](handleEntityNotFound(_0x383db7,null))['then'](respondWithResult(_0x383db7,null))[_0x31a2('0x44')](handleError(_0x383db7,null));};exports[_0x31a2('0x48')]=function(_0x2df850,_0x15349f){return db[_0x31a2('0x42')][_0x31a2('0x48')](_0x2df850['body'],{})[_0x31a2('0x24')](respondWithResult(_0x15349f,0xc9))[_0x31a2('0x44')](handleError(_0x15349f,null));};exports[_0x31a2('0x22')]=function(_0x35e509,_0x52edd7){if(_0x35e509[_0x31a2('0x49')]['id']){delete _0x35e509[_0x31a2('0x49')]['id'];}return db['VoiceQueuesLog'][_0x31a2('0x47')]({'where':{'id':_0x35e509['params']['id']}})[_0x31a2('0x24')](handleEntityNotFound(_0x52edd7,null))[_0x31a2('0x24')](saveUpdates(_0x35e509[_0x31a2('0x49')],null))[_0x31a2('0x24')](respondWithResult(_0x52edd7,null))['catch'](handleError(_0x52edd7,null));};exports['destroy']=function(_0x5558a9,_0x4554b2){return db['VoiceQueuesLog'][_0x31a2('0x47')]({'where':{'id':_0x5558a9[_0x31a2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4554b2,null))[_0x31a2('0x24')](removeEntity(_0x4554b2,null))['catch'](handleError(_0x4554b2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c85dce8..8213fe1 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 _0xe107=['./voiceQueuesLog.attributes','exports','define','event_dtm','dtm','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe107,0x1cd));var _0x7e10=function(_0x370466,_0x44cc7d){_0x370466=_0x370466-0x0;var _0x1812e7=_0xe107[_0x370466];return _0x1812e7;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require(_0x7e10('0x5'));var rimraf=require('rimraf');var config=require(_0x7e10('0x6'));var attributes=require(_0x7e10('0x7'));module[_0x7e10('0x8')]=function(_0x2bdd9f,_0x1dbe59){return _0x2bdd9f[_0x7e10('0x9')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x7e10('0xa'),'fields':['event',_0x7e10('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1a59=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x358c86,_0x38a8a2){var _0x52edc5=function(_0x560096){while(--_0x560096){_0x358c86['push'](_0x358c86['shift']());}};_0x52edc5(++_0x38a8a2);}(_0x1a59,0x124));var _0x91a5=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x1a59[_0x5a7112];return _0x3147f7;};'use strict';var _=require(_0x91a5('0x0'));var util=require(_0x91a5('0x1'));var logger=require(_0x91a5('0x2'))('api');var moment=require(_0x91a5('0x3'));var BPromise=require(_0x91a5('0x4'));var rp=require(_0x91a5('0x5'));var fs=require('fs');var path=require(_0x91a5('0x6'));var rimraf=require(_0x91a5('0x7'));var config=require('../../config/environment');var attributes=require(_0x91a5('0x8'));module[_0x91a5('0x9')]=function(_0x3d3fa7,_0x1be1bc){return _0x3d3fa7[_0x91a5('0xa')](_0x91a5('0xb'),attributes,{'tableName':_0x91a5('0xc'),'paranoid':![],'indexes':[{'name':_0x91a5('0xd'),'fields':[_0x91a5('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index cf6db0a..f8bf5c9 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 _0xd139=['../../config/logger','rpc','../../config/environment','client','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e3cd3,_0x59639c){var _0x211c5f=function(_0xad79e1){while(--_0xad79e1){_0x5e3cd3['push'](_0x5e3cd3['shift']());}};_0x211c5f(++_0x59639c);}(_0xd139,0x14e));var _0x9d13=function(_0x469037,_0x3b6b21){_0x469037=_0x469037-0x0;var _0x2204c6=_0xd139[_0x469037];return _0x2204c6;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x2'));var fs=require('fs');var Redis=require(_0x9d13('0x3'));var db=require(_0x9d13('0x4'))['db'];var utils=require(_0x9d13('0x5'));var logger=require(_0x9d13('0x6'))(_0x9d13('0x7'));var config=require(_0x9d13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d13('0x9')][_0x9d13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50294b,_0x198d7d,_0x4b3db0){return new BPromise(function(_0x434ef6,_0x524947){return client['request'](_0x50294b,_0x4b3db0)['then'](function(_0x3ccdf9){logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,_0x9d13('0xd'));logger[_0x9d13('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x198d7d,_0x9d13('0xd'),JSON[_0x9d13('0xf')](_0x3ccdf9));if(_0x3ccdf9[_0x9d13('0x10')]){if(_0x3ccdf9['error']['code']===0x1f4){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x524947(_0x3ccdf9[_0x9d13('0x10')]['message']);}logger['error'](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x434ef6(_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);}else{logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,'request\x20sent');_0x434ef6(_0x3ccdf9[_0x9d13('0x12')][_0x9d13('0x11')]);}})[_0x9d13('0x13')](function(_0x250234){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x250234);_0x524947(_0x250234);});});} \ No newline at end of file +var _0x2547=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x2547,0x1cd));var _0x7254=function(_0x4e81d0,_0x15b3c0){_0x4e81d0=_0x4e81d0-0x0;var _0x3523f8=_0x2547[_0x4e81d0];return _0x3523f8;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 946739e..24f4b3e 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 _0x38e4=['/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x23fdd2,_0x3d9cb8){var _0x42d623=function(_0x33aebf){while(--_0x33aebf){_0x23fdd2['push'](_0x23fdd2['shift']());}};_0x42d623(++_0x3d9cb8);}(_0x38e4,0x114));var _0x438e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x38e4[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var path=require(_0x438e('0x2'));var timeout=require('connect-timeout');var express=require(_0x438e('0x3'));var router=express[_0x438e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x438e('0x5'));var controller=require('./voiceRecording.controller');router[_0x438e('0x6')]('/',auth[_0x438e('0x7')](),controller['index']);router['get'](_0x438e('0x8'),auth['isAuthenticated'](),controller[_0x438e('0x9')]);router[_0x438e('0x6')](_0x438e('0xa'),auth[_0x438e('0x7')](),controller[_0x438e('0xb')]);router[_0x438e('0x6')](_0x438e('0xc'),auth[_0x438e('0x7')](),controller[_0x438e('0xd')]);router[_0x438e('0x6')](_0x438e('0xe'),controller[_0x438e('0xf')]);router[_0x438e('0x6')]('/:id/transcribe',auth[_0x438e('0x7')](),controller[_0x438e('0x10')]);router[_0x438e('0x11')]('/',auth[_0x438e('0x7')](),controller[_0x438e('0x12')]);router[_0x438e('0x11')](_0x438e('0x13'),auth[_0x438e('0x7')](),controller['runTranscribe']);router['put'](_0x438e('0xa'),auth[_0x438e('0x7')](),controller[_0x438e('0x14')]);router[_0x438e('0x15')]('/:id',auth[_0x438e('0x7')](),controller[_0x438e('0x16')]);module[_0x438e('0x17')]=router; \ No newline at end of file +var _0x49c6=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x654345,_0x4d01b5){var _0x3cf347=function(_0x104f52){while(--_0x104f52){_0x654345['push'](_0x654345['shift']());}};_0x3cf347(++_0x4d01b5);}(_0x49c6,0x140));var _0x649c=function(_0x5356b6,_0x4d16c9){_0x5356b6=_0x5356b6-0x0;var _0x2e4285=_0x49c6[_0x5356b6];return _0x2e4285;};'use strict';var multer=require(_0x649c('0x0'));var util=require('util');var path=require(_0x649c('0x1'));var timeout=require(_0x649c('0x2'));var express=require(_0x649c('0x3'));var router=express[_0x649c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x649c('0x5'));var config=require(_0x649c('0x6'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x649c('0x7')](),controller[_0x649c('0x8')]);router[_0x649c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x649c('0xa')]);router[_0x649c('0x9')]('/:id',auth[_0x649c('0x7')](),controller['show']);router[_0x649c('0x9')](_0x649c('0xb'),auth[_0x649c('0x7')](),controller[_0x649c('0xc')]);router['get'](_0x649c('0xd'),controller[_0x649c('0xe')]);router['get'](_0x649c('0xf'),auth[_0x649c('0x7')](),controller[_0x649c('0x10')]);router[_0x649c('0x11')]('/',auth[_0x649c('0x7')](),controller[_0x649c('0x12')]);router[_0x649c('0x11')](_0x649c('0xf'),auth[_0x649c('0x7')](),controller[_0x649c('0x13')]);router[_0x649c('0x14')](_0x649c('0x15'),auth['isAuthenticated'](),controller[_0x649c('0x16')]);router[_0x649c('0x17')](_0x649c('0x15'),auth['isAuthenticated'](),controller[_0x649c('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 0a26897..9801b41 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 _0x538b=['toString','DATE','updatedAt','format','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','channel','INTEGER','TEXT','NEW','FLOAT','BOOLEAN'];(function(_0x3dd896,_0x50c479){var _0x24a905=function(_0x2b7782){while(--_0x2b7782){_0x3dd896['push'](_0x3dd896['shift']());}};_0x24a905(++_0x50c479);}(_0x538b,0x11d));var _0xb538=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x538b[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xb538('0x0'));var moment=require(_0xb538('0x1'));var path=require(_0xb538('0x2'));module[_0xb538('0x3')]={'format':{'type':Sequelize[_0xb538('0x4')],'get':function(){return this[_0xb538('0x5')](_0xb538('0x6'))?path[_0xb538('0x7')](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xb538('0x8')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x163842){if(_0x163842){this['setDataValue'](_0xb538('0x9'),_0x163842);this['setDataValue']('membername',_0x163842['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb538('0x8')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb538('0x8')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb538('0x8')]},'value':{'type':Sequelize[_0xb538('0x8')]},'type':{'type':Sequelize[_0xb538('0x8')]},'rating':{'type':Sequelize[_0xb538('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xb538('0x8')]},'userDisposition':{'type':Sequelize[_0xb538('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xb538('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xb538('0x8')]},'location':{'type':Sequelize[_0xb538('0xb')]},'transcribeName':{'type':Sequelize[_0xb538('0x8')]},'transcribeStatus':{'type':Sequelize[_0xb538('0x8')],'defaultValue':_0xb538('0xc')},'fileUri':{'type':Sequelize[_0xb538('0xb')]},'fileText':{'type':Sequelize[_0xb538('0xb')]},'failureReason':{'type':Sequelize[_0xb538('0xb')]},'sentiment':{'type':Sequelize[_0xb538('0x8')]},'sPositive':{'type':Sequelize[_0xb538('0xd')]},'sNegative':{'type':Sequelize[_0xb538('0xd')]},'sNeutral':{'type':Sequelize[_0xb538('0xd')]},'sMixed':{'type':Sequelize[_0xb538('0xd')]},'tempSentiment':{'type':Sequelize[_0xb538('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb538('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xb538('0xf')]();}},'updatedAt':{'type':Sequelize[_0xb538('0x10')],'get':function(){return moment(this[_0xb538('0x5')](_0xb538('0x11')))[_0xb538('0x12')](_0xb538('0x13'))[_0xb538('0xf')]();}}}; \ No newline at end of file +var _0xbde7=['channel','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','format','sequelize','exports','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x5aa966,_0x3f694f){var _0x48a4a0=function(_0x576452){while(--_0x576452){_0x5aa966['push'](_0x5aa966['shift']());}};_0x48a4a0(++_0x3f694f);}(_0xbde7,0x1b1));var _0x7bde=function(_0x380e21,_0x3782a7){_0x380e21=_0x380e21-0x0;var _0x46b982=_0xbde7[_0x380e21];return _0x46b982;};'use strict';var Sequelize=require(_0x7bde('0x0'));var moment=require('moment');var path=require('path');module[_0x7bde('0x1')]={'format':{'type':Sequelize[_0x7bde('0x2')],'get':function(){return this[_0x7bde('0x3')](_0x7bde('0x4'))?path[_0x7bde('0x5')](this[_0x7bde('0x3')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x7bde('0x6')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x147d5e){if(_0x147d5e){this['setDataValue'](_0x7bde('0x7'),_0x147d5e);this[_0x7bde('0x8')](_0x7bde('0x9'),_0x147d5e[_0x7bde('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7bde('0x6')]},'calleridnum':{'type':Sequelize[_0x7bde('0x6')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7bde('0x6')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7bde('0x6')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7bde('0x6')]},'type':{'type':Sequelize[_0x7bde('0x6')]},'rating':{'type':Sequelize[_0x7bde('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x7bde('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7bde('0x6')]},'location':{'type':Sequelize[_0x7bde('0xc')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x7bde('0x6')],'defaultValue':_0x7bde('0xd')},'fileUri':{'type':Sequelize[_0x7bde('0xc')]},'fileText':{'type':Sequelize[_0x7bde('0xc')]},'failureReason':{'type':Sequelize[_0x7bde('0xc')]},'sentiment':{'type':Sequelize[_0x7bde('0x6')]},'sPositive':{'type':Sequelize[_0x7bde('0xe')]},'sNegative':{'type':Sequelize[_0x7bde('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x7bde('0xe')]},'tempSentiment':{'type':Sequelize[_0x7bde('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x7bde('0x10')))['format'](_0x7bde('0x11'))[_0x7bde('0x12')]();}},'updatedAt':{'type':Sequelize[_0x7bde('0x13')],'get':function(){return moment(this['getDataValue'](_0x7bde('0x14')))[_0x7bde('0x15')]('MM-DD-YYYY\x20HH:mm')[_0x7bde('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index b0d61ba..59a4f0f 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 _0xb5b3=['index','map','VoiceRecording','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','rawAttributes','length','options','find','catch','create','body','params','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','sequelize','MD5','col','$and','push','%s.cypher','Sequelize','Entity\x20not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','end','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','IN_PROGRESS','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send'];(function(_0x2e7f1e,_0x32f286){var _0x3dffa5=function(_0x920dc5){while(--_0x920dc5){_0x2e7f1e['push'](_0x2e7f1e['shift']());}};_0x3dffa5(++_0x32f286);}(_0xb5b3,0x19f));var _0x3b5b=function(_0xdbd063,_0x4b27bb){_0xdbd063=_0xdbd063-0x0;var _0x1e2756=_0xb5b3[_0xdbd063];return _0x1e2756;};'use strict';var pdf=require(_0x3b5b('0x0'));var emlformat=require(_0x3b5b('0x1'));var rimraf=require(_0x3b5b('0x2'));var zipdir=require(_0x3b5b('0x3'));var jsonpatch=require(_0x3b5b('0x4'));var rp=require(_0x3b5b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b5b('0x6'));var util=require(_0x3b5b('0x7'));var path=require(_0x3b5b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b5b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3b5b('0xa'));var crypto=require(_0x3b5b('0xb'));var jsforce=require(_0x3b5b('0xc'));var deskjs=require(_0x3b5b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b5b('0xe'));var AWS=require(_0x3b5b('0xf'));var uuidv4=require(_0x3b5b('0x10'));var Redis=require(_0x3b5b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b5b('0x12'));var hardwareService=require(_0x3b5b('0x13'));var logger=require(_0x3b5b('0x14'))('api');var utils=require(_0x3b5b('0x15'));var config=require(_0x3b5b('0x16'));var licenseUtil=require(_0x3b5b('0x17'));var db=require(_0x3b5b('0x18'))['db'];function respondWithStatusCode(_0x5dd80f,_0x3a8146){_0x3a8146=_0x3a8146||0xcc;return function(_0x576363){if(_0x576363){return _0x5dd80f[_0x3b5b('0x19')](_0x3a8146);}return _0x5dd80f[_0x3b5b('0x1a')](_0x3a8146)['end']();};}function respondWithResult(_0x259815,_0x3bf46a){_0x3bf46a=_0x3bf46a||0xc8;return function(_0x1a6040){if(_0x1a6040){return _0x259815[_0x3b5b('0x1a')](_0x3bf46a)[_0x3b5b('0x1b')](_0x1a6040);}};}function respondWithFilteredResult(_0xac59e1,_0x108603){return function(_0x4bcde9){if(_0x4bcde9){var _0x3a9c33=_0x4bcde9[_0x3b5b('0x1c')],_0x3818b8=_0x108603[_0x3b5b('0x1d')],_0x111aab=_0x108603[_0x3b5b('0x1d')]+_0x108603[_0x3b5b('0x1e')],_0x34eca6;if(_0x111aab>=_0x3a9c33){_0x111aab=_0x3a9c33;_0x34eca6=0xc8;}else{_0x34eca6=0xce;}_0xac59e1[_0x3b5b('0x1a')](_0x34eca6);return _0xac59e1[_0x3b5b('0x1f')](_0x3b5b('0x20'),_0x3818b8+'-'+_0x111aab+'/'+_0x3a9c33)[_0x3b5b('0x1b')](_0x4bcde9);}return null;};}function patchUpdates(_0x4a507a){return function(_0x237819){try{jsonpatch[_0x3b5b('0x21')](_0x237819,_0x4a507a,!![]);}catch(_0x57b965){return BPromise[_0x3b5b('0x22')](_0x57b965);}return _0x237819[_0x3b5b('0x23')]();};}function saveUpdates(_0x3a1291,_0x3ff6e5){return function(_0xa50a){if(_0xa50a){return _0xa50a[_0x3b5b('0x24')](_0x3a1291)[_0x3b5b('0x25')](function(_0x231e07){return _0x231e07;});}return null;};}function removeEntity(_0x43e22a,_0x39a92c){return function(_0x56e217){if(_0x56e217){return _0x56e217[_0x3b5b('0x26')]()['then'](function(){_0x43e22a[_0x3b5b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353c3d,_0x1d0e1a){return function(_0x2d0605){if(!_0x2d0605){_0x353c3d[_0x3b5b('0x19')](0x194);}return _0x2d0605;};}function handleError(_0x1c0716,_0x18cf6d){_0x18cf6d=_0x18cf6d||0x1f4;return function(_0x10b9b4){logger['error'](_0x10b9b4['stack']);if(_0x10b9b4[_0x3b5b('0x27')]){delete _0x10b9b4[_0x3b5b('0x27')];}_0x1c0716[_0x3b5b('0x1a')](_0x18cf6d)[_0x3b5b('0x28')](_0x10b9b4);};}exports[_0x3b5b('0x29')]=function(_0x473af9,_0x1220fa){var _0x13b53b={},_0x2d43bb={},_0x298bce={'count':0x0,'rows':[]};var _0x169872=_[_0x3b5b('0x2a')](db[_0x3b5b('0x2b')]['rawAttributes'],function(_0x439c5e){return{'name':_0x439c5e[_0x3b5b('0x2c')],'type':_0x439c5e['type']['key']};});_0x2d43bb['model']=_['differenceBy'](_['map'](_0x169872,'name'),['format']);_0x2d43bb[_0x3b5b('0x2d')]=_[_0x3b5b('0x2e')](_0x473af9[_0x3b5b('0x2d')]);_0x2d43bb[_0x3b5b('0x2f')]=_[_0x3b5b('0x30')](_0x2d43bb[_0x3b5b('0x31')],_0x2d43bb[_0x3b5b('0x2d')]);_0x13b53b[_0x3b5b('0x32')]=_[_0x3b5b('0x30')](_0x2d43bb['model'],qs[_0x3b5b('0x33')](_0x473af9['query'][_0x3b5b('0x33')]));_0x13b53b[_0x3b5b('0x32')]=_0x13b53b[_0x3b5b('0x32')]['length']?_0x13b53b['attributes']:_0x2d43bb[_0x3b5b('0x31')];if(!_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x34')](_0x3b5b('0x35'))){_0x13b53b[_0x3b5b('0x1e')]=qs[_0x3b5b('0x1e')](_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x1e')]);_0x13b53b[_0x3b5b('0x1d')]=qs[_0x3b5b('0x1d')](_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x1d')]);}_0x13b53b[_0x3b5b('0x36')]=qs['sort'](_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x37')]);_0x13b53b[_0x3b5b('0x38')]=qs[_0x3b5b('0x2f')](_[_0x3b5b('0x39')](_0x473af9[_0x3b5b('0x2d')],_0x2d43bb[_0x3b5b('0x2f')]),_0x169872);if(_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x3a')]){_0x13b53b['where']=_['merge'](_0x13b53b[_0x3b5b('0x38')],{'$or':_[_0x3b5b('0x2a')](_0x169872,function(_0x114655){if(_0x114655[_0x3b5b('0x3b')]!==_0x3b5b('0x3c')){var _0x49a629={};_0x49a629[_0x114655['name']]={'$like':'%'+_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x3a')]+'%'};return _0x49a629;}})});}_0x13b53b=_[_0x3b5b('0x3d')]({},_0x13b53b,_0x473af9['options']);var _0xbc8346={'where':_0x13b53b[_0x3b5b('0x38')]};return db[_0x3b5b('0x2b')][_0x3b5b('0x1c')](_0xbc8346)[_0x3b5b('0x25')](function(_0x42d57a){_0x298bce[_0x3b5b('0x1c')]=_0x42d57a;if(_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x3e')]){_0x13b53b[_0x3b5b('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x3b5b('0x40')](_0x13b53b);})[_0x3b5b('0x25')](function(_0x43e3b4){_0x298bce[_0x3b5b('0x41')]=_0x43e3b4;return _0x298bce;})[_0x3b5b('0x25')](respondWithFilteredResult(_0x1220fa,_0x13b53b))['catch'](handleError(_0x1220fa,null));};exports[_0x3b5b('0x42')]=function(_0x3bc50d,_0x162f78){var _0x26b567={'raw':![],'where':{'id':_0x3bc50d['params']['id']}},_0x33a0fc={};_0x33a0fc['model']=_[_0x3b5b('0x2e')](db['VoiceRecording'][_0x3b5b('0x43')]);_0x33a0fc[_0x3b5b('0x2d')]=_[_0x3b5b('0x2e')](_0x3bc50d[_0x3b5b('0x2d')]);_0x33a0fc[_0x3b5b('0x2f')]=_[_0x3b5b('0x30')](_0x33a0fc[_0x3b5b('0x31')],_0x33a0fc[_0x3b5b('0x2d')]);_0x26b567[_0x3b5b('0x32')]=_[_0x3b5b('0x30')](_0x33a0fc[_0x3b5b('0x31')],qs['fields'](_0x3bc50d[_0x3b5b('0x2d')]['fields']));_0x26b567[_0x3b5b('0x32')]=_0x26b567['attributes'][_0x3b5b('0x44')]?_0x26b567[_0x3b5b('0x32')]:_0x33a0fc[_0x3b5b('0x31')];if(_0x3bc50d['query'][_0x3b5b('0x3e')]){_0x26b567[_0x3b5b('0x3f')]=[{'all':!![]}];}_0x26b567=_[_0x3b5b('0x3d')]({},_0x26b567,_0x3bc50d[_0x3b5b('0x45')]);return db['VoiceRecording'][_0x3b5b('0x46')](_0x26b567)[_0x3b5b('0x25')](handleEntityNotFound(_0x162f78,null))[_0x3b5b('0x25')](respondWithResult(_0x162f78,null))[_0x3b5b('0x47')](handleError(_0x162f78,null));};exports['create']=function(_0x1faeb4,_0x578986){return db['VoiceRecording'][_0x3b5b('0x48')](_0x1faeb4[_0x3b5b('0x49')],{})[_0x3b5b('0x25')](respondWithResult(_0x578986,0xc9))['catch'](handleError(_0x578986,null));};exports[_0x3b5b('0x24')]=function(_0x2a7d3f,_0x59a160){if(_0x2a7d3f[_0x3b5b('0x49')]['id']){delete _0x2a7d3f['body']['id'];}return db[_0x3b5b('0x2b')]['find']({'where':{'id':_0x2a7d3f[_0x3b5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x59a160,null))['then'](saveUpdates(_0x2a7d3f[_0x3b5b('0x49')],null))[_0x3b5b('0x25')](respondWithResult(_0x59a160,null))[_0x3b5b('0x47')](handleError(_0x59a160,null));};exports[_0x3b5b('0x4b')]=function(_0x433830,_0x1b1a94){return db[_0x3b5b('0x2b')]['describe']()[_0x3b5b('0x25')](respondWithResult(_0x1b1a94,null))[_0x3b5b('0x47')](handleError(_0x1b1a94,null));};exports[_0x3b5b('0x4c')]=function(_0x380fdb,_0x2ec0c2,_0x7961a){var _0x3e07a8=require(_0x3b5b('0x4d'));var _0x57ab78=![];var _0x4e5790={};if(_0x380fdb[_0x3b5b('0x2d')][_0x3b5b('0x3b')]&&_0x380fdb['query']['type']===_0x3b5b('0x4e')){_0x4e5790[_0x3b5b('0x4e')]=_0x380fdb['params']['id'];}else{_0x4e5790['id']=_0x380fdb[_0x3b5b('0x4a')]['id'];}return db[_0x3b5b('0x2b')][_0x3b5b('0x46')]({'where':_0x4e5790,'attributes':['id',_0x3b5b('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x2ec0c2,null))['then'](function(_0x55af0e){if(_0x55af0e){var _0x161101=_0x55af0e[_0x3b5b('0x4f')];var _0x107c07=util[_0x3b5b('0x50')]('%s.cypher',_0x161101);if(fs[_0x3b5b('0x51')](_0x107c07)){_0x57ab78=!![];return _0x3e07a8[_0x3b5b('0x52')](_0x107c07,_0x161101,config[_0x3b5b('0x53')][_0x3b5b('0x54')])[_0x3b5b('0x25')](function(){return _0x55af0e;});}return _0x55af0e;}})[_0x3b5b('0x25')](function(_0xa1681a){if(_0xa1681a){var _0x40f3b2=_0xa1681a[_0x3b5b('0x4f')];if(!fs[_0x3b5b('0x51')](_0x40f3b2)){throw new db['Sequelize'][(_0x3b5b('0x55'))]('VoiceRecording\x20not\x20found');}if(_0xa1681a['filename']){return _0x2ec0c2[_0x3b5b('0x4c')](_0x40f3b2,_0xa1681a[_0x3b5b('0x56')]+path[_0x3b5b('0x57')](_0x40f3b2),function(){if(_0x57ab78){fs[_0x3b5b('0x58')](_0x40f3b2);}});}else{return _0x2ec0c2[_0x3b5b('0x4c')](_0x40f3b2,function(_0x9f1121){if(_0x57ab78){fs[_0x3b5b('0x58')](_0x40f3b2);}});}}})[_0x3b5b('0x47')](function(_0x569906){if(_0x569906[_0x3b5b('0x59')]===_0x3b5b('0x5a')){_0x2ec0c2['status'](0x194)[_0x3b5b('0x28')]('Not\x20found');}else{return handleError(_0x2ec0c2,null);}});};exports['downloads']=function(_0x14af5b,_0x59610e,_0x1cfe93){var _0x2767be=require(_0x3b5b('0x4d'));var _0x4dc861=![];var _0x123a0d={'$and':[db[_0x3b5b('0x5b')][_0x3b5b('0x38')](db['sequelize']['fn'](_0x3b5b('0x5c'),db[_0x3b5b('0x5b')][_0x3b5b('0x5d')](_0x3b5b('0x4e'))),_0x14af5b[_0x3b5b('0x2d')]['token'])]};if(_0x14af5b[_0x3b5b('0x2d')][_0x3b5b('0x3b')]&&_0x14af5b['query'][_0x3b5b('0x3b')]===_0x3b5b('0x4e')){_0x123a0d[_0x3b5b('0x5e')]['push']({'uniqueid':_0x14af5b[_0x3b5b('0x4a')]['id']});}else{_0x123a0d['$and'][_0x3b5b('0x5f')]({'id':_0x14af5b[_0x3b5b('0x4a')]['id']});}return db[_0x3b5b('0x2b')][_0x3b5b('0x46')]({'where':_0x123a0d,'attributes':['id',_0x3b5b('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x59610e,null))[_0x3b5b('0x25')](function(_0x39fbee){if(_0x39fbee){var _0x1aeee7=util['format'](_0x3b5b('0x60'),_0x39fbee[_0x3b5b('0x4f')]);if(fs[_0x3b5b('0x51')](_0x1aeee7)){_0x4dc861=!![];return _0x2767be[_0x3b5b('0x52')](_0x1aeee7,_0x39fbee[_0x3b5b('0x4f')],config[_0x3b5b('0x53')][_0x3b5b('0x54')])[_0x3b5b('0x25')](function(){return _0x39fbee;});}return _0x39fbee;}})[_0x3b5b('0x25')](function(_0x3da00c){if(_0x3da00c){if(!fs[_0x3b5b('0x51')](_0x3da00c[_0x3b5b('0x4f')])){throw new db[(_0x3b5b('0x61'))][(_0x3b5b('0x55'))](_0x3b5b('0x5a'));}if(_0x3da00c[_0x3b5b('0x56')]){return _0x59610e[_0x3b5b('0x4c')](_0x3da00c[_0x3b5b('0x4f')],_0x3da00c[_0x3b5b('0x56')]+path[_0x3b5b('0x57')](_0x3da00c[_0x3b5b('0x4f')]),function(){if(_0x4dc861){fs[_0x3b5b('0x58')](_0x3da00c[_0x3b5b('0x4f')]);}});}else{return _0x59610e[_0x3b5b('0x4c')](_0x3da00c['value'],function(_0x3d4cce){if(_0x4dc861){fs['unlink'](_0x3da00c[_0x3b5b('0x4f')]);}});}}})['catch'](handleError(_0x59610e,null));};exports[_0x3b5b('0x26')]=function(_0x5186d5,_0x2ab936){return db[_0x3b5b('0x2b')][_0x3b5b('0x46')]({'where':{'id':_0x5186d5[_0x3b5b('0x4a')]['id']}})[_0x3b5b('0x25')](function(_0x5cf8aa){if(!_0x5cf8aa)throw new ReferenceError(_0x3b5b('0x62'));return _0x5cf8aa;})[_0x3b5b('0x25')](function(_0x176818){var _0x394245=_0x176818[_0x3b5b('0x4f')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x394245);if(!_[_0x3b5b('0x63')](_0x176818[_0x3b5b('0x4f')])&&fs[_0x3b5b('0x51')](_0x394245)){logger[_0x3b5b('0x64')](_0x3b5b('0x65')+_0x394245+_0x3b5b('0x66'));fs['unlinkSync'](_0x394245);}_0x394245=_0x394245+_0x3b5b('0x67');if(!_[_0x3b5b('0x63')](_0x176818[_0x3b5b('0x4f')])&&fs[_0x3b5b('0x51')](_0x394245)){logger[_0x3b5b('0x64')](_0x3b5b('0x65')+_0x394245+_0x3b5b('0x66'));fs[_0x3b5b('0x68')](_0x394245);}return _0x176818;})[_0x3b5b('0x25')](function(_0x70cc03){if(!_0x70cc03)throw new InternalError();return _0x70cc03[_0x3b5b('0x26')]();})[_0x3b5b('0x25')](function(){_0x2ab936['status'](0xcc)[_0x3b5b('0x69')]();})[_0x3b5b('0x47')](handleError(_0x2ab936,null));};function getBucketslist(_0x966040,_0x5caf23,_0x3ca565){return new Promise(function(_0x282ec6,_0x4247f9){var _0xfc1848=new AWS['S3']({'accessKeyId':_0x5caf23,'secretAccessKey':_0x966040,'region':_0x3ca565});_0xfc1848[_0x3b5b('0x6a')]({},function(_0x4682e0,_0x23fb9a){if(_0x4682e0){return _0x4247f9(_0x4682e0);}else{return _0x282ec6(_0x23fb9a);}});});}function createBucket(_0x167767,_0x599b5d,_0x241ea4,_0x1ca11e){return new Promise(function(_0x1179d1,_0x172c38){var _0x228eed=new AWS['S3']({'accessKeyId':_0x599b5d,'secretAccessKey':_0x167767,'region':_0x241ea4});_0x228eed[_0x3b5b('0x6b')]({'Bucket':_0x1ca11e},function(_0xc9e685,_0x3b6d82){if(_0xc9e685){return _0x172c38(_0xc9e685);}else{return _0x1179d1(_0x3b6d82);}});});}function uploadFile(_0x59a29b,_0x545a90,_0xeeb82c,_0x94e202,_0x55e413,_0x5dff9c){return new Promise(function(_0x2d992d,_0x435ad3){var _0x4b698c=new AWS['S3']({'accessKeyId':_0x545a90,'secretAccessKey':_0x59a29b,'region':_0xeeb82c});_0x4b698c[_0x3b5b('0x6c')]({'Bucket':_0x94e202,'Key':_0x55e413,'Body':_0x5dff9c},function(_0x5c99f8,_0x36cfb2){if(_0x5c99f8){return _0x435ad3(_0x5c99f8);}else{return _0x2d992d(_0x36cfb2);}});});}function startTranscribe(_0xff3db6,_0x1344f2,_0x2382ce,_0x297d51,_0x2d0ae4,_0x222ec9){return new Promise(function(_0x6a76eb,_0x314b6c){var _0x64b6e9=new AWS[(_0x3b5b('0x6d'))]({'accessKeyId':_0x1344f2,'secretAccessKey':_0xff3db6,'region':_0x2382ce});_0x64b6e9[_0x3b5b('0x6e')]({'TranscriptionJobName':_0x297d51,'LanguageCode':_0x2d0ae4,'Media':{'MediaFileUri':_0x222ec9}},function(_0x487905,_0xcfc794){if(_0x487905){return _0x314b6c(_0x487905);}else{return _0x6a76eb(_0xcfc794);}});});}function transcribe(_0x2c02c6,_0x6f746f,_0x322ae7,_0x4dadc9,_0x928d23,_0xcdd4a,_0x36ad24){return new Promise(function(_0x1dc092,_0x3a4b3d){var _0x549d12={};logger[_0x3b5b('0x64')](util[_0x3b5b('0x50')](_0x3b5b('0x6f'),_0x2c02c6,_0x928d23));return uploadFile(_0x6f746f,_0x322ae7,_0x4dadc9,_0x928d23,path[_0x3b5b('0x70')](_0xcdd4a),fs[_0x3b5b('0x71')](_0xcdd4a))[_0x3b5b('0x25')](function(_0x1d758d){logger[_0x3b5b('0x64')](util[_0x3b5b('0x50')](_0x3b5b('0x72'),_0x2c02c6,_0x928d23,_0x1d758d[_0x3b5b('0x73')]));_0x549d12['bucket']=_0x1d758d[_0x3b5b('0x74')];_0x549d12[_0x3b5b('0x75')]=_0x1d758d[_0x3b5b('0x73')];logger['info'](util['format'](_0x3b5b('0x76'),_0x2c02c6));return startTranscribe(_0x6f746f,_0x322ae7,_0x4dadc9,uuidv4(),_0x36ad24,_0x1d758d['Location']);})['then'](function(_0x45ae5c){logger[_0x3b5b('0x64')](util[_0x3b5b('0x50')](_0x3b5b('0x77'),_0x2c02c6,_0x45ae5c[_0x3b5b('0x78')][_0x3b5b('0x79')]));_0x549d12[_0x3b5b('0x7a')]=_0x45ae5c[_0x3b5b('0x78')][_0x3b5b('0x79')];_0x549d12['transcribeStatus']=_0x45ae5c['TranscriptionJob'][_0x3b5b('0x7b')];return _0x1dc092(_0x549d12);})[_0x3b5b('0x47')](function(_0x1d0321){return _0x3a4b3d(_0x1d0321);});});}exports[_0x3b5b('0x7c')]=function(_0x3015a7,_0x34ed22,_0x584941){var _0x5a8b03;var _0x561809;var _0x4bb9ab;var _0x45c536=require(_0x3b5b('0x4d'));return db[_0x3b5b('0x2b')][_0x3b5b('0x7d')]({'where':{'id':_0x3015a7[_0x3b5b('0x4a')]['id']}})['then'](function(_0x500b79){if(_0x500b79){var _0x3b813c=util['format'](_0x3b5b('0x60'),_0x500b79[_0x3b5b('0x4f')]);if(fs[_0x3b5b('0x51')](_0x3b813c)){cypher=!![];return _0x45c536[_0x3b5b('0x52')](_0x3b813c,_0x500b79[_0x3b5b('0x4f')],config[_0x3b5b('0x53')][_0x3b5b('0x54')])[_0x3b5b('0x25')](function(){return _0x500b79;});}return _0x500b79;}})[_0x3b5b('0x25')](function(_0x51156c){if(!_0x51156c){throw new db[(_0x3b5b('0x61'))][(_0x3b5b('0x55'))](_0x3b5b('0x7e'));}_0x561809=_0x51156c;return db[_0x3b5b('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x3b5b('0x25')](handleEntityNotFound(_0x34ed22,null))[_0x3b5b('0x25')](function(_0xaebc83){if(_0xaebc83){_0x5a8b03=_0xaebc83;if(!_0x5a8b03[_0x3b5b('0x80')]||!_0x5a8b03[_0x3b5b('0x81')]||!_0x5a8b03[_0x3b5b('0x82')]||!_0x5a8b03[_0x3b5b('0x83')]||!_0x5a8b03[_0x3b5b('0x84')]){throw new db['Sequelize'][(_0x3b5b('0x55'))](_0x3b5b('0x85'));}if(_0x3015a7[_0x3b5b('0x49')][_0x3b5b('0x86')]&&(!_0x5a8b03['sentiment']||!_0x5a8b03[_0x3b5b('0x87')]||!_0x5a8b03[_0x3b5b('0x88')]||!_0x5a8b03['language']||!_0x5a8b03['bucket'])){throw new db[(_0x3b5b('0x61'))]['ValidationError'](_0x3b5b('0x89'));}return db[_0x3b5b('0x8a')]['findOne']({'where':{'id':_0x5a8b03[_0x3b5b('0x81')]}});}})['then'](function(_0x15b018){if(!_0x15b018){throw new db['Sequelize'][(_0x3b5b('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x15b018[_0x3b5b('0x8b')]||!_0x15b018['data2']){throw new db[(_0x3b5b('0x61'))]['ValidationError'](_0x3b5b('0x8c'));}_0x4bb9ab=_0x15b018;return getBucketslist(_0x4bb9ab[_0x3b5b('0x8b')],_0x4bb9ab[_0x3b5b('0x8d')],_0x5a8b03[_0x3b5b('0x82')]);})[_0x3b5b('0x25')](function(_0x1cdce2){if(_0x1cdce2&&_0x1cdce2[_0x3b5b('0x8e')]){var _0x5c5a46=_[_0x3b5b('0x46')](_0x1cdce2[_0x3b5b('0x8e')],function(_0x3794b2){return _0x3794b2['Name']===_0x5a8b03[_0x3b5b('0x84')];});if(!_0x5c5a46){logger['info'](util[_0x3b5b('0x50')](_0x3b5b('0x8f'),_0x3015a7[_0x3b5b('0x4a')]['id'],_0x5a8b03['bucket']));return createBucket(_0x4bb9ab[_0x3b5b('0x8b')],_0x4bb9ab[_0x3b5b('0x8d')],_0x5a8b03['transcribeRegion'],_0x5a8b03[_0x3b5b('0x84')]);}logger['info'](util[_0x3b5b('0x50')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x3015a7['params']['id'],_0x5a8b03[_0x3b5b('0x84')]));return;}})[_0x3b5b('0x25')](function(_0x4d80c0){if(_0x561809[_0x3b5b('0x90')]===_0x3b5b('0x91')){return transcribe(_0x3015a7[_0x3b5b('0x4a')]['id'],_0x4bb9ab[_0x3b5b('0x8b')],_0x4bb9ab[_0x3b5b('0x8d')],_0x5a8b03[_0x3b5b('0x82')],_0x5a8b03[_0x3b5b('0x84')],_0x561809['value'],_0x5a8b03[_0x3b5b('0x83')]);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3015a7[_0x3b5b('0x4a')]['id']));return{'transcribeStatus':_0x3b5b('0x92')};}})[_0x3b5b('0x25')](function(_0x50c65d){if(_0x50c65d){_0x50c65d['tempSentiment']=_0x3015a7['body']['runSentiment'];return _0x561809['updateAttributes'](_0x50c65d);}})[_0x3b5b('0x25')](respondWithResult(_0x34ed22,null))['catch'](handleError(_0x34ed22,null));};function writeFile(_0xfedc89,_0x41bac1){return new Promise(function(_0xd7a87d,_0x22607e){fs[_0x3b5b('0x93')](_0x41bac1,_0xfedc89,function(_0x482364,_0x39a808){if(_0x482364){return _0x22607e(_0x482364);}else{return _0xd7a87d(_0x39a808);}});});}exports[_0x3b5b('0x94')]=function(_0x31beda,_0x58ba4e,_0x1f8101){return db[_0x3b5b('0x2b')]['findOne']({'where':{'id':_0x31beda[_0x3b5b('0x4a')]['id']}})[_0x3b5b('0x25')](handleEntityNotFound(_0x58ba4e))[_0x3b5b('0x25')](function(_0x30a6a1){if(_0x30a6a1&&_0x30a6a1[_0x3b5b('0x95')]){var _0x592c80=_0x30a6a1[_0x3b5b('0x95')];var _0x59ebda=config['root']+_0x3b5b('0x96')+_0x30a6a1['id']+_0x3b5b('0x97');if(fs[_0x3b5b('0x51')](_0x59ebda)){return _0x59ebda;}return writeFile(_0x592c80,_0x59ebda)[_0x3b5b('0x25')](function(){return _0x59ebda;});}else{throw new db['Sequelize'][(_0x3b5b('0x55'))]('Transcript\x20not\x20available');}})[_0x3b5b('0x25')](function(_0x7f5f09){return _0x58ba4e[_0x3b5b('0x4c')](_0x7f5f09);})[_0x3b5b('0x47')](handleError(_0x58ba4e));}; \ No newline at end of file +var _0x5f9a=['language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','aws-sdk','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','VoiceRecording','fieldName','type','model','differenceBy','map','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','findAll','rows','rawAttributes','include','find','catch','create','body','params','describe','../../components/encryptor','uniqueid','existsSync','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','col','token','push','$and','%s.cypher','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','info','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5f9a,0x1dc));var _0xa5f9=function(_0x44daef,_0x203b11){_0x44daef=_0x44daef-0x0;var _0x6af5fe=_0x5f9a[_0x44daef];return _0x6af5fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa5f9('0x0'));var rimraf=require(_0xa5f9('0x1'));var zipdir=require(_0xa5f9('0x2'));var jsonpatch=require(_0xa5f9('0x3'));var rp=require('request-promise');var moment=require(_0xa5f9('0x4'));var BPromise=require(_0xa5f9('0x5'));var Mustache=require(_0xa5f9('0x6'));var util=require(_0xa5f9('0x7'));var path=require('path');var sox=require(_0xa5f9('0x8'));var csv=require('to-csv');var ejs=require(_0xa5f9('0x9'));var fs=require('fs');var _=require(_0xa5f9('0xa'));var squel=require(_0xa5f9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5f9('0xc'));var toCsv=require(_0xa5f9('0xd'));var querystring=require('querystring');var Papa=require(_0xa5f9('0xe'));var AWS=require(_0xa5f9('0xf'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0xa5f9('0x10'));var qs=require(_0xa5f9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5f9('0x12'));var logger=require(_0xa5f9('0x13'))(_0xa5f9('0x14'));var utils=require(_0xa5f9('0x15'));var config=require(_0xa5f9('0x16'));var licenseUtil=require(_0xa5f9('0x17'));var db=require(_0xa5f9('0x18'))['db'];function respondWithStatusCode(_0x320c0f,_0x4f274a){_0x4f274a=_0x4f274a||0xcc;return function(_0x433a8e){if(_0x433a8e){return _0x320c0f[_0xa5f9('0x19')](_0x4f274a);}return _0x320c0f[_0xa5f9('0x1a')](_0x4f274a)['end']();};}function respondWithResult(_0x42c023,_0xd2d62){_0xd2d62=_0xd2d62||0xc8;return function(_0x218a5d){if(_0x218a5d){return _0x42c023[_0xa5f9('0x1a')](_0xd2d62)[_0xa5f9('0x1b')](_0x218a5d);}};}function respondWithFilteredResult(_0x3b4078,_0x102a0b){return function(_0x2dab95){if(_0x2dab95){var _0x31f069=_0x2dab95[_0xa5f9('0x1c')],_0x3ab0a7=_0x102a0b[_0xa5f9('0x1d')],_0x176046=_0x102a0b[_0xa5f9('0x1d')]+_0x102a0b[_0xa5f9('0x1e')],_0x3c620e;if(_0x176046>=_0x31f069){_0x176046=_0x31f069;_0x3c620e=0xc8;}else{_0x3c620e=0xce;}_0x3b4078['status'](_0x3c620e);return _0x3b4078[_0xa5f9('0x1f')](_0xa5f9('0x20'),_0x3ab0a7+'-'+_0x176046+'/'+_0x31f069)[_0xa5f9('0x1b')](_0x2dab95);}return null;};}function patchUpdates(_0x2fcb5e){return function(_0x5392c2){try{jsonpatch[_0xa5f9('0x21')](_0x5392c2,_0x2fcb5e,!![]);}catch(_0x492e51){return BPromise[_0xa5f9('0x22')](_0x492e51);}return _0x5392c2['save']();};}function saveUpdates(_0x71a374,_0x1935a7){return function(_0x5a9f59){if(_0x5a9f59){return _0x5a9f59[_0xa5f9('0x23')](_0x71a374)[_0xa5f9('0x24')](function(_0xddc408){return _0xddc408;});}return null;};}function removeEntity(_0x57f87c,_0x260a91){return function(_0x5b1fad){if(_0x5b1fad){return _0x5b1fad[_0xa5f9('0x25')]()[_0xa5f9('0x24')](function(){_0x57f87c[_0xa5f9('0x1a')](0xcc)[_0xa5f9('0x26')]();});}};}function handleEntityNotFound(_0x57355f,_0x4caec8){return function(_0x5f7766){if(!_0x5f7766){_0x57355f[_0xa5f9('0x19')](0x194);}return _0x5f7766;};}function handleError(_0x2e710d,_0x417cae){_0x417cae=_0x417cae||0x1f4;return function(_0x3c90fe){logger[_0xa5f9('0x27')](_0x3c90fe[_0xa5f9('0x28')]);if(_0x3c90fe[_0xa5f9('0x29')]){delete _0x3c90fe[_0xa5f9('0x29')];}_0x2e710d[_0xa5f9('0x1a')](_0x417cae)['send'](_0x3c90fe);};}exports[_0xa5f9('0x2a')]=function(_0x3e0732,_0x45b84e){var _0x59aa16={},_0x5675db={},_0x47712e={'count':0x0,'rows':[]};var _0x2f1d44=_['map'](db[_0xa5f9('0x2b')]['rawAttributes'],function(_0x1b3158){return{'name':_0x1b3158[_0xa5f9('0x2c')],'type':_0x1b3158[_0xa5f9('0x2d')]['key']};});_0x5675db[_0xa5f9('0x2e')]=_[_0xa5f9('0x2f')](_[_0xa5f9('0x30')](_0x2f1d44,'name'),[_0xa5f9('0x31')]);_0x5675db[_0xa5f9('0x32')]=_[_0xa5f9('0x33')](_0x3e0732[_0xa5f9('0x32')]);_0x5675db['filters']=_[_0xa5f9('0x34')](_0x5675db[_0xa5f9('0x2e')],_0x5675db[_0xa5f9('0x32')]);_0x59aa16[_0xa5f9('0x35')]=_[_0xa5f9('0x34')](_0x5675db[_0xa5f9('0x2e')],qs[_0xa5f9('0x36')](_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x36')]));_0x59aa16['attributes']=_0x59aa16[_0xa5f9('0x35')][_0xa5f9('0x37')]?_0x59aa16[_0xa5f9('0x35')]:_0x5675db[_0xa5f9('0x2e')];if(!_0x3e0732['query'][_0xa5f9('0x38')](_0xa5f9('0x39'))){_0x59aa16['limit']=qs[_0xa5f9('0x1e')](_0x3e0732[_0xa5f9('0x32')]['limit']);_0x59aa16[_0xa5f9('0x1d')]=qs[_0xa5f9('0x1d')](_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x1d')]);}_0x59aa16['order']=qs[_0xa5f9('0x3a')](_0x3e0732['query'][_0xa5f9('0x3a')]);_0x59aa16[_0xa5f9('0x3b')]=qs[_0xa5f9('0x3c')](_['pick'](_0x3e0732['query'],_0x5675db[_0xa5f9('0x3c')]),_0x2f1d44);if(_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x3d')]){_0x59aa16[_0xa5f9('0x3b')]=_[_0xa5f9('0x3e')](_0x59aa16['where'],{'$or':_[_0xa5f9('0x30')](_0x2f1d44,function(_0x159408){if(_0x159408[_0xa5f9('0x2d')]!=='VIRTUAL'){var _0x135092={};_0x135092[_0x159408['name']]={'$like':'%'+_0x3e0732[_0xa5f9('0x32')]['filter']+'%'};return _0x135092;}})});}_0x59aa16=_['merge']({},_0x59aa16,_0x3e0732[_0xa5f9('0x3f')]);var _0x49d9b3={'where':_0x59aa16[_0xa5f9('0x3b')]};return db[_0xa5f9('0x2b')][_0xa5f9('0x1c')](_0x49d9b3)[_0xa5f9('0x24')](function(_0x355858){_0x47712e[_0xa5f9('0x1c')]=_0x355858;if(_0x3e0732[_0xa5f9('0x32')][_0xa5f9('0x40')]){_0x59aa16['include']=[{'all':!![]}];}return db[_0xa5f9('0x2b')][_0xa5f9('0x41')](_0x59aa16);})[_0xa5f9('0x24')](function(_0x3ca86a){_0x47712e[_0xa5f9('0x42')]=_0x3ca86a;return _0x47712e;})[_0xa5f9('0x24')](respondWithFilteredResult(_0x45b84e,_0x59aa16))['catch'](handleError(_0x45b84e,null));};exports['show']=function(_0x404ab7,_0x1b7ab4){var _0x5211cf={'raw':![],'where':{'id':_0x404ab7['params']['id']}},_0x2bde2e={};_0x2bde2e[_0xa5f9('0x2e')]=_[_0xa5f9('0x33')](db[_0xa5f9('0x2b')][_0xa5f9('0x43')]);_0x2bde2e[_0xa5f9('0x32')]=_[_0xa5f9('0x33')](_0x404ab7[_0xa5f9('0x32')]);_0x2bde2e['filters']=_[_0xa5f9('0x34')](_0x2bde2e[_0xa5f9('0x2e')],_0x2bde2e['query']);_0x5211cf['attributes']=_[_0xa5f9('0x34')](_0x2bde2e[_0xa5f9('0x2e')],qs[_0xa5f9('0x36')](_0x404ab7[_0xa5f9('0x32')][_0xa5f9('0x36')]));_0x5211cf['attributes']=_0x5211cf['attributes'][_0xa5f9('0x37')]?_0x5211cf[_0xa5f9('0x35')]:_0x2bde2e[_0xa5f9('0x2e')];if(_0x404ab7[_0xa5f9('0x32')][_0xa5f9('0x40')]){_0x5211cf[_0xa5f9('0x44')]=[{'all':!![]}];}_0x5211cf=_[_0xa5f9('0x3e')]({},_0x5211cf,_0x404ab7[_0xa5f9('0x3f')]);return db[_0xa5f9('0x2b')][_0xa5f9('0x45')](_0x5211cf)[_0xa5f9('0x24')](handleEntityNotFound(_0x1b7ab4,null))['then'](respondWithResult(_0x1b7ab4,null))[_0xa5f9('0x46')](handleError(_0x1b7ab4,null));};exports[_0xa5f9('0x47')]=function(_0x6a34b0,_0x12d089){return db[_0xa5f9('0x2b')][_0xa5f9('0x47')](_0x6a34b0['body'],{})['then'](respondWithResult(_0x12d089,0xc9))[_0xa5f9('0x46')](handleError(_0x12d089,null));};exports[_0xa5f9('0x23')]=function(_0xbaf9fd,_0x5504bb){if(_0xbaf9fd['body']['id']){delete _0xbaf9fd[_0xa5f9('0x48')]['id'];}return db[_0xa5f9('0x2b')][_0xa5f9('0x45')]({'where':{'id':_0xbaf9fd[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](handleEntityNotFound(_0x5504bb,null))['then'](saveUpdates(_0xbaf9fd[_0xa5f9('0x48')],null))[_0xa5f9('0x24')](respondWithResult(_0x5504bb,null))[_0xa5f9('0x46')](handleError(_0x5504bb,null));};exports[_0xa5f9('0x4a')]=function(_0x2d9213,_0x15a202){return db[_0xa5f9('0x2b')][_0xa5f9('0x4a')]()[_0xa5f9('0x24')](respondWithResult(_0x15a202,null))[_0xa5f9('0x46')](handleError(_0x15a202,null));};exports['download']=function(_0xdc07cf,_0x5ec2a3,_0x4413a3){var _0x200099=require(_0xa5f9('0x4b'));var _0x5b547a=![];var _0x3ca7c5={};if(_0xdc07cf[_0xa5f9('0x32')][_0xa5f9('0x2d')]&&_0xdc07cf[_0xa5f9('0x32')]['type']===_0xa5f9('0x4c')){_0x3ca7c5[_0xa5f9('0x4c')]=_0xdc07cf[_0xa5f9('0x49')]['id'];}else{_0x3ca7c5['id']=_0xdc07cf[_0xa5f9('0x49')]['id'];}return db[_0xa5f9('0x2b')][_0xa5f9('0x45')]({'where':_0x3ca7c5,'attributes':['id','value'],'raw':!![]})[_0xa5f9('0x24')](handleEntityNotFound(_0x5ec2a3,null))[_0xa5f9('0x24')](function(_0x5dada3){if(_0x5dada3){var _0x37de1b=_0x5dada3['value'];var _0x2ab298=util['format']('%s.cypher',_0x37de1b);if(fs[_0xa5f9('0x4d')](_0x2ab298)){_0x5b547a=!![];return _0x200099[_0xa5f9('0x4e')](_0x2ab298,_0x37de1b,config[_0xa5f9('0x4f')][_0xa5f9('0x50')])[_0xa5f9('0x24')](function(){return _0x5dada3;});}return _0x5dada3;}})[_0xa5f9('0x24')](function(_0x3977a0){if(_0x3977a0){var _0x2b1904=_0x3977a0[_0xa5f9('0x51')];if(!fs['existsSync'](_0x2b1904)){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x54'));}if(_0x3977a0[_0xa5f9('0x55')]){return _0x5ec2a3[_0xa5f9('0x56')](_0x2b1904,_0x3977a0[_0xa5f9('0x55')]+path[_0xa5f9('0x57')](_0x2b1904),function(){if(_0x5b547a){fs[_0xa5f9('0x58')](_0x2b1904);}});}else{return _0x5ec2a3[_0xa5f9('0x56')](_0x2b1904,function(_0x2b0e16){if(_0x5b547a){fs['unlink'](_0x2b1904);}});}}})[_0xa5f9('0x46')](function(_0x103979){if(_0x103979[_0xa5f9('0x59')]===_0xa5f9('0x54')){_0x5ec2a3[_0xa5f9('0x1a')](0x194)['send'](_0xa5f9('0x5a'));}else{return handleError(_0x5ec2a3,null);}});};exports[_0xa5f9('0x5b')]=function(_0x51ca19,_0x4de90e,_0x39826d){var _0x18977e=require(_0xa5f9('0x4b'));var _0x5127aa=![];var _0x42f0d2={'$and':[db[_0xa5f9('0x5c')][_0xa5f9('0x3b')](db[_0xa5f9('0x5c')]['fn']('MD5',db['sequelize'][_0xa5f9('0x5d')](_0xa5f9('0x4c'))),_0x51ca19[_0xa5f9('0x32')][_0xa5f9('0x5e')])]};if(_0x51ca19[_0xa5f9('0x32')][_0xa5f9('0x2d')]&&_0x51ca19[_0xa5f9('0x32')]['type']===_0xa5f9('0x4c')){_0x42f0d2['$and'][_0xa5f9('0x5f')]({'uniqueid':_0x51ca19[_0xa5f9('0x49')]['id']});}else{_0x42f0d2[_0xa5f9('0x60')][_0xa5f9('0x5f')]({'id':_0x51ca19[_0xa5f9('0x49')]['id']});}return db['VoiceRecording'][_0xa5f9('0x45')]({'where':_0x42f0d2,'attributes':['id',_0xa5f9('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x4de90e,null))[_0xa5f9('0x24')](function(_0x47bab7){if(_0x47bab7){var _0x5d1b67=util[_0xa5f9('0x31')](_0xa5f9('0x61'),_0x47bab7[_0xa5f9('0x51')]);if(fs[_0xa5f9('0x4d')](_0x5d1b67)){_0x5127aa=!![];return _0x18977e[_0xa5f9('0x4e')](_0x5d1b67,_0x47bab7[_0xa5f9('0x51')],config[_0xa5f9('0x4f')][_0xa5f9('0x50')])[_0xa5f9('0x24')](function(){return _0x47bab7;});}return _0x47bab7;}})[_0xa5f9('0x24')](function(_0x16f808){if(_0x16f808){if(!fs[_0xa5f9('0x4d')](_0x16f808[_0xa5f9('0x51')])){throw new db['Sequelize'][(_0xa5f9('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x16f808[_0xa5f9('0x55')]){return _0x4de90e[_0xa5f9('0x56')](_0x16f808[_0xa5f9('0x51')],_0x16f808['filename']+path[_0xa5f9('0x57')](_0x16f808[_0xa5f9('0x51')]),function(){if(_0x5127aa){fs[_0xa5f9('0x58')](_0x16f808[_0xa5f9('0x51')]);}});}else{return _0x4de90e[_0xa5f9('0x56')](_0x16f808[_0xa5f9('0x51')],function(_0x23c5d0){if(_0x5127aa){fs[_0xa5f9('0x58')](_0x16f808[_0xa5f9('0x51')]);}});}}})[_0xa5f9('0x46')](handleError(_0x4de90e,null));};exports['destroy']=function(_0x3ff35f,_0x45af2c){return db[_0xa5f9('0x2b')][_0xa5f9('0x45')]({'where':{'id':_0x3ff35f[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](function(_0x4692da){if(!_0x4692da)throw new ReferenceError(_0xa5f9('0x62'));return _0x4692da;})[_0xa5f9('0x24')](function(_0x5f4d0d){var _0x17e689=_0x5f4d0d[_0xa5f9('0x51')];logger['info'](_0xa5f9('0x63'),_0x17e689);if(!_[_0xa5f9('0x64')](_0x5f4d0d['value'])&&fs[_0xa5f9('0x4d')](_0x17e689)){logger['info'](_0xa5f9('0x65')+_0x17e689+_0xa5f9('0x66'));fs[_0xa5f9('0x67')](_0x17e689);}_0x17e689=_0x17e689+'.cypher';if(!_[_0xa5f9('0x64')](_0x5f4d0d[_0xa5f9('0x51')])&&fs[_0xa5f9('0x4d')](_0x17e689)){logger[_0xa5f9('0x68')](_0xa5f9('0x65')+_0x17e689+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa5f9('0x67')](_0x17e689);}return _0x5f4d0d;})[_0xa5f9('0x24')](function(_0x3e45cd){if(!_0x3e45cd)throw new InternalError();return _0x3e45cd[_0xa5f9('0x25')]();})['then'](function(){_0x45af2c[_0xa5f9('0x1a')](0xcc)[_0xa5f9('0x26')]();})['catch'](handleError(_0x45af2c,null));};function getBucketslist(_0x5d391a,_0x272f07,_0x5b75b6){return new Promise(function(_0x236b7c,_0x49e506){var _0x17303e=new AWS['S3']({'accessKeyId':_0x272f07,'secretAccessKey':_0x5d391a,'region':_0x5b75b6});_0x17303e['listBuckets']({},function(_0x294037,_0x8ca735){if(_0x294037){return _0x49e506(_0x294037);}else{return _0x236b7c(_0x8ca735);}});});}function createBucket(_0x1cb61e,_0x398b5a,_0x5c4f58,_0x1b9ee9){return new Promise(function(_0x24f505,_0x53308f){var _0x3a1b75=new AWS['S3']({'accessKeyId':_0x398b5a,'secretAccessKey':_0x1cb61e,'region':_0x5c4f58});_0x3a1b75[_0xa5f9('0x69')]({'Bucket':_0x1b9ee9},function(_0x5d4e32,_0x1c9404){if(_0x5d4e32){return _0x53308f(_0x5d4e32);}else{return _0x24f505(_0x1c9404);}});});}function uploadFile(_0x3eb878,_0x1095da,_0xd9b6eb,_0x478a0b,_0xbd46bd,_0x151c8e){return new Promise(function(_0x56b332,_0x13c8bb){var _0x2686a3=new AWS['S3']({'accessKeyId':_0x1095da,'secretAccessKey':_0x3eb878,'region':_0xd9b6eb});_0x2686a3['upload']({'Bucket':_0x478a0b,'Key':_0xbd46bd,'Body':_0x151c8e},function(_0x497810,_0x25f004){if(_0x497810){return _0x13c8bb(_0x497810);}else{return _0x56b332(_0x25f004);}});});}function startTranscribe(_0x79a5ae,_0x4f439f,_0x59bbd4,_0x43938a,_0x557533,_0x2ec1d3){return new Promise(function(_0x17414a,_0x2e997b){var _0x5f032c=new AWS[(_0xa5f9('0x6a'))]({'accessKeyId':_0x4f439f,'secretAccessKey':_0x79a5ae,'region':_0x59bbd4});_0x5f032c[_0xa5f9('0x6b')]({'TranscriptionJobName':_0x43938a,'LanguageCode':_0x557533,'Media':{'MediaFileUri':_0x2ec1d3}},function(_0x2546ae,_0x1471c7){if(_0x2546ae){return _0x2e997b(_0x2546ae);}else{return _0x17414a(_0x1471c7);}});});}function transcribe(_0x2e801d,_0x34a70e,_0x4cfcda,_0x4fd0b3,_0xb7495,_0x28484c,_0x3d992c){return new Promise(function(_0x205c56,_0x1f6366){var _0x41e10a={};logger['info'](util[_0xa5f9('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2e801d,_0xb7495));return uploadFile(_0x34a70e,_0x4cfcda,_0x4fd0b3,_0xb7495,path[_0xa5f9('0x6c')](_0x28484c),fs[_0xa5f9('0x6d')](_0x28484c))['then'](function(_0x2082eb){logger['info'](util[_0xa5f9('0x31')](_0xa5f9('0x6e'),_0x2e801d,_0xb7495,_0x2082eb[_0xa5f9('0x6f')]));_0x41e10a['bucket']=_0x2082eb[_0xa5f9('0x70')];_0x41e10a[_0xa5f9('0x71')]=_0x2082eb[_0xa5f9('0x6f')];logger['info'](util[_0xa5f9('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2e801d));return startTranscribe(_0x34a70e,_0x4cfcda,_0x4fd0b3,uuidv4(),_0x3d992c,_0x2082eb[_0xa5f9('0x6f')]);})['then'](function(_0x3c50b8){logger[_0xa5f9('0x68')](util[_0xa5f9('0x31')](_0xa5f9('0x72'),_0x2e801d,_0x3c50b8[_0xa5f9('0x73')][_0xa5f9('0x74')]));_0x41e10a[_0xa5f9('0x75')]=_0x3c50b8[_0xa5f9('0x73')][_0xa5f9('0x74')];_0x41e10a[_0xa5f9('0x76')]=_0x3c50b8[_0xa5f9('0x73')]['TranscriptionJobStatus'];return _0x205c56(_0x41e10a);})[_0xa5f9('0x46')](function(_0x8a93e0){return _0x1f6366(_0x8a93e0);});});}exports[_0xa5f9('0x77')]=function(_0x4fbb0a,_0x1d1b6d,_0x41ce46){var _0x285975;var _0x2f4473;var _0x3675dd;var _0x149c6b=require(_0xa5f9('0x4b'));return db[_0xa5f9('0x2b')]['findOne']({'where':{'id':_0x4fbb0a[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](function(_0x1f967a){if(_0x1f967a){var _0x4a15fb=util['format'](_0xa5f9('0x61'),_0x1f967a[_0xa5f9('0x51')]);if(fs['existsSync'](_0x4a15fb)){cypher=!![];return _0x149c6b[_0xa5f9('0x4e')](_0x4a15fb,_0x1f967a[_0xa5f9('0x51')],config['secrets'][_0xa5f9('0x50')])[_0xa5f9('0x24')](function(){return _0x1f967a;});}return _0x1f967a;}})[_0xa5f9('0x24')](function(_0xf84d4a){if(!_0xf84d4a){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x78'));}_0x2f4473=_0xf84d4a;return db[_0xa5f9('0x79')][_0xa5f9('0x7a')]({'where':{'id':0x1}});})[_0xa5f9('0x24')](handleEntityNotFound(_0x1d1b6d,null))['then'](function(_0x461b9d){if(_0x461b9d){_0x285975=_0x461b9d;if(!_0x285975[_0xa5f9('0x7b')]||!_0x285975['transcribeAccountId']||!_0x285975['transcribeRegion']||!_0x285975[_0xa5f9('0x7c')]||!_0x285975[_0xa5f9('0x7d')]){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x7e'));}if(_0x4fbb0a['body'][_0xa5f9('0x7f')]&&(!_0x285975[_0xa5f9('0x80')]||!_0x285975[_0xa5f9('0x81')]||!_0x285975[_0xa5f9('0x82')]||!_0x285975['language']||!_0x285975[_0xa5f9('0x7d')])){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x83'));}return db['CloudProvider'][_0xa5f9('0x7a')]({'where':{'id':_0x285975[_0xa5f9('0x84')]}});}})['then'](function(_0x409a4d){if(!_0x409a4d){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x85'));}if(!_0x409a4d[_0xa5f9('0x86')]||!_0x409a4d['data2']){throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x87'));}_0x3675dd=_0x409a4d;return getBucketslist(_0x3675dd[_0xa5f9('0x86')],_0x3675dd['data2'],_0x285975[_0xa5f9('0x88')]);})['then'](function(_0x217d97){if(_0x217d97&&_0x217d97[_0xa5f9('0x89')]){var _0x1441b6=_['find'](_0x217d97['Buckets'],function(_0x3bdcbc){return _0x3bdcbc[_0xa5f9('0x8a')]===_0x285975[_0xa5f9('0x7d')];});if(!_0x1441b6){logger[_0xa5f9('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4fbb0a[_0xa5f9('0x49')]['id'],_0x285975['bucket']));return createBucket(_0x3675dd[_0xa5f9('0x86')],_0x3675dd[_0xa5f9('0x8b')],_0x285975[_0xa5f9('0x88')],_0x285975[_0xa5f9('0x7d')]);}logger[_0xa5f9('0x68')](util['format'](_0xa5f9('0x8c'),_0x4fbb0a[_0xa5f9('0x49')]['id'],_0x285975[_0xa5f9('0x7d')]));return;}})['then'](function(_0x5b15b2){if(_0x2f4473[_0xa5f9('0x76')]===_0xa5f9('0x8d')){return transcribe(_0x4fbb0a[_0xa5f9('0x49')]['id'],_0x3675dd['data1'],_0x3675dd[_0xa5f9('0x8b')],_0x285975[_0xa5f9('0x88')],_0x285975[_0xa5f9('0x7d')],_0x2f4473[_0xa5f9('0x51')],_0x285975[_0xa5f9('0x7c')]);}else{logger['info'](util['format'](_0xa5f9('0x8e'),_0x4fbb0a['params']['id']));return{'transcribeStatus':_0xa5f9('0x8f')};}})[_0xa5f9('0x24')](function(_0x37ee33){if(_0x37ee33){_0x37ee33['tempSentiment']=_0x4fbb0a[_0xa5f9('0x48')][_0xa5f9('0x7f')];return _0x2f4473[_0xa5f9('0x90')](_0x37ee33);}})[_0xa5f9('0x24')](respondWithResult(_0x1d1b6d,null))[_0xa5f9('0x46')](handleError(_0x1d1b6d,null));};function writeFile(_0x1e6c06,_0x1975b8){return new Promise(function(_0x3fc970,_0x2493de){fs[_0xa5f9('0x91')](_0x1975b8,_0x1e6c06,function(_0x35aebf,_0x574390){if(_0x35aebf){return _0x2493de(_0x35aebf);}else{return _0x3fc970(_0x574390);}});});}exports['downloadTranscribe']=function(_0x4a2d4b,_0x4ba17b,_0x1eeac3){return db[_0xa5f9('0x2b')][_0xa5f9('0x7a')]({'where':{'id':_0x4a2d4b[_0xa5f9('0x49')]['id']}})[_0xa5f9('0x24')](handleEntityNotFound(_0x4ba17b))[_0xa5f9('0x24')](function(_0x3bd6d0){if(_0x3bd6d0&&_0x3bd6d0['fileText']){var _0x5103cf=_0x3bd6d0[_0xa5f9('0x92')];var _0x23a702=config[_0xa5f9('0x93')]+_0xa5f9('0x94')+_0x3bd6d0['id']+'.txt';if(fs['existsSync'](_0x23a702)){return _0x23a702;}return writeFile(_0x5103cf,_0x23a702)[_0xa5f9('0x24')](function(){return _0x23a702;});}else{throw new db[(_0xa5f9('0x52'))][(_0xa5f9('0x53'))](_0xa5f9('0x95'));}})[_0xa5f9('0x24')](function(_0x292775){return _0x4ba17b['download'](_0x292775);})[_0xa5f9('0x46')](handleError(_0x4ba17b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f91b8d8..2cfd937 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 _0x68e5=['VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','path','rimraf','../../config/environment','./voiceRecording.attributes','define'];(function(_0x56d77a,_0xbdef93){var _0x29e636=function(_0x5510b7){while(--_0x5510b7){_0x56d77a['push'](_0x56d77a['shift']());}};_0x29e636(++_0xbdef93);}(_0x68e5,0x1a5));var _0x568e=function(_0x55ee84,_0x94622c){_0x55ee84=_0x55ee84-0x0;var _0x2c6608=_0x68e5[_0x55ee84];return _0x2c6608;};'use strict';var _=require(_0x568e('0x0'));var util=require('util');var logger=require(_0x568e('0x1'))(_0x568e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x568e('0x3'));var rimraf=require(_0x568e('0x4'));var config=require(_0x568e('0x5'));var attributes=require(_0x568e('0x6'));module['exports']=function(_0x1651da,_0x466fa3){return _0x1651da[_0x568e('0x7')](_0x568e('0x8'),attributes,{'tableName':_0x568e('0x9'),'paranoid':![],'indexes':[{'name':_0x568e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1660=['exports','define','VoiceRecording','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x472ba6,_0x30c67d){var _0x2fb0b4=function(_0x5acb17){while(--_0x5acb17){_0x472ba6['push'](_0x472ba6['shift']());}};_0x2fb0b4(++_0x30c67d);}(_0x1660,0x189));var _0x0166=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x1660[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x0166('0x0'));var util=require(_0x0166('0x1'));var logger=require(_0x0166('0x2'))('api');var moment=require(_0x0166('0x3'));var BPromise=require(_0x0166('0x4'));var rp=require(_0x0166('0x5'));var fs=require('fs');var path=require(_0x0166('0x6'));var rimraf=require(_0x0166('0x7'));var config=require(_0x0166('0x8'));var attributes=require(_0x0166('0x9'));module[_0x0166('0xa')]=function(_0x4c8c31,_0x5bb43a){return _0x4c8c31[_0x0166('0xb')](_0x0166('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 420f84d..056cd4f 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(_0xe33b12,_0x2a9761){var _0x30699d=function(_0x209952){while(--_0x209952){_0xe33b12['push'](_0xe33b12['shift']());}};_0x30699d(++_0x2a9761);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x167295,_0x555a81){var _0x400be6=function(_0x1edcba){while(--_0x1edcba){_0x167295['push'](_0x167295['shift']());}};_0x400be6(++_0x555a81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 906341b..e72d59c 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 _0xeda8=['isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x455c0f,_0x298fb9){var _0x37dfc6=function(_0x20be75){while(--_0x20be75){_0x455c0f['push'](_0x455c0f['shift']());}};_0x37dfc6(++_0x298fb9);}(_0xeda8,0x104));var _0x8eda=function(_0x2678d5,_0x53e63b){_0x2678d5=_0x2678d5-0x0;var _0x2dbe63=_0xeda8[_0x2678d5];return _0x2dbe63;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0xe')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8eda('0x10')](_0x8eda('0xc'),auth[_0x8eda('0xa')](),controller['destroy']);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x84847d,_0x2d9e2b){var _0x1abffa=function(_0x3c112f){while(--_0x3c112f){_0x84847d['push'](_0x84847d['shift']());}};_0x1abffa(++_0x2d9e2b);}(_0x187d,0x93));var _0xd187=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x187d[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b85bce3..b9411fc 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 _0x3656=['sequelize','moment','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x1ac663,_0x50f7ac){var _0x2a9338=function(_0x283d45){while(--_0x283d45){_0x1ac663['push'](_0x1ac663['shift']());}};_0x2a9338(++_0x50f7ac);}(_0x3656,0xa0));var _0x6365=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3656[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x6365('0x0'));var moment=require(_0x6365('0x1'));module[_0x6365('0x2')]={'type':{'type':Sequelize[_0x6365('0x3')](_0x6365('0x4'),_0x6365('0x5'))},'result':{'type':Sequelize[_0x6365('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x6365('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6365('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x6365('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x6365('0x6')]},'transfererexten':{'type':Sequelize[_0x6365('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x6365('0x6')]},'transfereechannel':{'type':Sequelize[_0x6365('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x6365('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x6365('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x6365('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x6365('0x6')]},'transfereeexten':{'type':Sequelize[_0x6365('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x6365('0x3')](_0x6365('0x7'),'No')},'context':{'type':Sequelize[_0x6365('0x6')]},'extension':{'type':Sequelize[_0x6365('0x6')]}}; \ No newline at end of file +var _0xb977=['exports','ENUM','attended','STRING','Yes'];(function(_0x23c993,_0x253858){var _0x4b24e6=function(_0xf39a57){while(--_0xf39a57){_0x23c993['push'](_0x23c993['shift']());}};_0x4b24e6(++_0x253858);}(_0xb977,0x113));var _0x7b97=function(_0x546807,_0x474398){_0x546807=_0x546807-0x0;var _0x37fe4a=_0xb977[_0x546807];return _0x37fe4a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x7b97('0x0')]={'type':{'type':Sequelize[_0x7b97('0x1')]('blind',_0x7b97('0x2'))},'result':{'type':Sequelize[_0x7b97('0x3')]},'transfererchannel':{'type':Sequelize[_0x7b97('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x7b97('0x3')]},'transferercalleridname':{'type':Sequelize[_0x7b97('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x7b97('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x7b97('0x3')]},'transferercontext':{'type':Sequelize[_0x7b97('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x7b97('0x3')]},'transfereechannel':{'type':Sequelize[_0x7b97('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x7b97('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x7b97('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x7b97('0x3')]},'isexternal':{'type':Sequelize[_0x7b97('0x1')](_0x7b97('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 478c221..ab2e950 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 _0x46db=['util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','update','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','intersection','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x46db,0x113));var _0xb46d=function(_0xf1153e,_0x20f96d){_0xf1153e=_0xf1153e-0x0;var _0x23c210=_0x46db[_0xf1153e];return _0x23c210;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb46d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb46d('0x1'));var jsonpatch=require(_0xb46d('0x2'));var rp=require(_0xb46d('0x3'));var moment=require(_0xb46d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb46d('0x5'));var path=require(_0xb46d('0x6'));var sox=require(_0xb46d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb46d('0x8'));var crypto=require(_0xb46d('0x9'));var jsforce=require(_0xb46d('0xa'));var deskjs=require(_0xb46d('0xb'));var toCsv=require(_0xb46d('0xc'));var querystring=require(_0xb46d('0xd'));var Papa=require(_0xb46d('0xe'));var Redis=require(_0xb46d('0xf'));var authService=require(_0xb46d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb46d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb46d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb46d('0x13'));var db=require(_0xb46d('0x14'))['db'];function respondWithStatusCode(_0x286f45,_0x5ec023){_0x5ec023=_0x5ec023||0xcc;return function(_0x3370a9){if(_0x3370a9){return _0x286f45[_0xb46d('0x15')](_0x5ec023);}return _0x286f45[_0xb46d('0x16')](_0x5ec023)[_0xb46d('0x17')]();};}function respondWithResult(_0x34560f,_0x52533e){_0x52533e=_0x52533e||0xc8;return function(_0x23b48b){if(_0x23b48b){return _0x34560f['status'](_0x52533e)['json'](_0x23b48b);}};}function respondWithFilteredResult(_0xdb1769,_0x9bf1de){return function(_0x56ad54){if(_0x56ad54){var _0x27b703=_0x56ad54['count'],_0x399e58=_0x9bf1de['offset'],_0x18c55c=_0x9bf1de[_0xb46d('0x18')]+_0x9bf1de[_0xb46d('0x19')],_0x11eb70;if(_0x18c55c>=_0x27b703){_0x18c55c=_0x27b703;_0x11eb70=0xc8;}else{_0x11eb70=0xce;}_0xdb1769[_0xb46d('0x16')](_0x11eb70);return _0xdb1769['set'](_0xb46d('0x1a'),_0x399e58+'-'+_0x18c55c+'/'+_0x27b703)['json'](_0x56ad54);}return null;};}function patchUpdates(_0x25dfef){return function(_0x4e884e){try{jsonpatch[_0xb46d('0x1b')](_0x4e884e,_0x25dfef,!![]);}catch(_0x250906){return BPromise['reject'](_0x250906);}return _0x4e884e['save']();};}function saveUpdates(_0x5b5ee4,_0x208e14){return function(_0x47114a){if(_0x47114a){return _0x47114a[_0xb46d('0x1c')](_0x5b5ee4)[_0xb46d('0x1d')](function(_0x675913){return _0x675913;});}return null;};}function removeEntity(_0x4552d8,_0x3b9031){return function(_0x4b3f8e){if(_0x4b3f8e){return _0x4b3f8e[_0xb46d('0x1e')]()[_0xb46d('0x1d')](function(){_0x4552d8[_0xb46d('0x16')](0xcc)[_0xb46d('0x17')]();});}};}function handleEntityNotFound(_0x7fe5bf,_0x59ffe4){return function(_0x5276d3){if(!_0x5276d3){_0x7fe5bf[_0xb46d('0x15')](0x194);}return _0x5276d3;};}function handleError(_0x2e5d61,_0x213737){_0x213737=_0x213737||0x1f4;return function(_0x15cb20){logger[_0xb46d('0x1f')](_0x15cb20['stack']);if(_0x15cb20['name']){delete _0x15cb20[_0xb46d('0x20')];}_0x2e5d61[_0xb46d('0x16')](_0x213737)[_0xb46d('0x21')](_0x15cb20);};}exports[_0xb46d('0x22')]=function(_0x5c4268,_0x39ac3d){var _0x22588d={},_0x10b7c4={},_0x320c20={'count':0x0,'rows':[]};var _0x3c1da3=_[_0xb46d('0x23')](db[_0xb46d('0x24')][_0xb46d('0x25')],function(_0x1ceb59){return{'name':_0x1ceb59[_0xb46d('0x26')],'type':_0x1ceb59[_0xb46d('0x27')][_0xb46d('0x28')]};});_0x10b7c4[_0xb46d('0x29')]=_[_0xb46d('0x23')](_0x3c1da3,_0xb46d('0x20'));_0x10b7c4[_0xb46d('0x2a')]=_['keys'](_0x5c4268[_0xb46d('0x2a')]);_0x10b7c4[_0xb46d('0x2b')]=_['intersection'](_0x10b7c4['model'],_0x10b7c4[_0xb46d('0x2a')]);_0x22588d[_0xb46d('0x2c')]=_['intersection'](_0x10b7c4['model'],qs['fields'](_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x2d')]));_0x22588d[_0xb46d('0x2c')]=_0x22588d['attributes']['length']?_0x22588d[_0xb46d('0x2c')]:_0x10b7c4[_0xb46d('0x29')];if(!_0x5c4268['query'][_0xb46d('0x2e')](_0xb46d('0x2f'))){_0x22588d['limit']=qs[_0xb46d('0x19')](_0x5c4268[_0xb46d('0x2a')]['limit']);_0x22588d[_0xb46d('0x18')]=qs[_0xb46d('0x18')](_0x5c4268['query'][_0xb46d('0x18')]);}_0x22588d[_0xb46d('0x30')]=qs[_0xb46d('0x31')](_0x5c4268[_0xb46d('0x2a')]['sort']);_0x22588d[_0xb46d('0x32')]=qs[_0xb46d('0x2b')](_[_0xb46d('0x33')](_0x5c4268['query'],_0x10b7c4[_0xb46d('0x2b')]),_0x3c1da3);if(_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x34')]){_0x22588d['where']=_[_0xb46d('0x35')](_0x22588d[_0xb46d('0x32')],{'$or':_['map'](_0x3c1da3,function(_0x4d4ad7){if(_0x4d4ad7[_0xb46d('0x27')]!==_0xb46d('0x36')){var _0xf85847={};_0xf85847[_0x4d4ad7[_0xb46d('0x20')]]={'$like':'%'+_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x34')]+'%'};return _0xf85847;}})});}_0x22588d=_[_0xb46d('0x35')]({},_0x22588d,_0x5c4268[_0xb46d('0x37')]);var _0x1d80fd={'where':_0x22588d[_0xb46d('0x32')]};return db[_0xb46d('0x24')][_0xb46d('0x38')](_0x1d80fd)[_0xb46d('0x1d')](function(_0x127a60){_0x320c20[_0xb46d('0x38')]=_0x127a60;if(_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x39')]){_0x22588d[_0xb46d('0x3a')]=[{'all':!![]}];}return db[_0xb46d('0x24')][_0xb46d('0x3b')](_0x22588d);})[_0xb46d('0x1d')](function(_0x1e14da){_0x320c20[_0xb46d('0x3c')]=_0x1e14da;return _0x320c20;})['then'](respondWithFilteredResult(_0x39ac3d,_0x22588d))[_0xb46d('0x3d')](handleError(_0x39ac3d,null));};exports[_0xb46d('0x3e')]=function(_0x26139f,_0x379376){var _0x5b7cc5={'raw':!![],'where':{'id':_0x26139f['params']['id']}},_0x5bf502={};_0x5bf502[_0xb46d('0x29')]=_[_0xb46d('0x3f')](db[_0xb46d('0x24')][_0xb46d('0x25')]);_0x5bf502['query']=_[_0xb46d('0x3f')](_0x26139f['query']);_0x5bf502['filters']=_[_0xb46d('0x40')](_0x5bf502[_0xb46d('0x29')],_0x5bf502[_0xb46d('0x2a')]);_0x5b7cc5['attributes']=_[_0xb46d('0x40')](_0x5bf502['model'],qs[_0xb46d('0x2d')](_0x26139f[_0xb46d('0x2a')][_0xb46d('0x2d')]));_0x5b7cc5[_0xb46d('0x2c')]=_0x5b7cc5[_0xb46d('0x2c')][_0xb46d('0x41')]?_0x5b7cc5[_0xb46d('0x2c')]:_0x5bf502[_0xb46d('0x29')];if(_0x26139f[_0xb46d('0x2a')]['includeAll']){_0x5b7cc5[_0xb46d('0x3a')]=[{'all':!![]}];}_0x5b7cc5=_[_0xb46d('0x35')]({},_0x5b7cc5,_0x26139f[_0xb46d('0x37')]);return db[_0xb46d('0x24')][_0xb46d('0x42')](_0x5b7cc5)['then'](handleEntityNotFound(_0x379376,null))[_0xb46d('0x1d')](respondWithResult(_0x379376,null))[_0xb46d('0x3d')](handleError(_0x379376,null));};exports[_0xb46d('0x43')]=function(_0x11e507,_0x1c29f2){return db[_0xb46d('0x24')][_0xb46d('0x43')](_0x11e507[_0xb46d('0x44')],{})[_0xb46d('0x1d')](respondWithResult(_0x1c29f2,0xc9))[_0xb46d('0x3d')](handleError(_0x1c29f2,null));};exports[_0xb46d('0x1c')]=function(_0x42a67f,_0x184a29){if(_0x42a67f['body']['id']){delete _0x42a67f[_0xb46d('0x44')]['id'];}return db[_0xb46d('0x24')][_0xb46d('0x42')]({'where':{'id':_0x42a67f['params']['id']}})['then'](handleEntityNotFound(_0x184a29,null))[_0xb46d('0x1d')](saveUpdates(_0x42a67f[_0xb46d('0x44')],null))['then'](respondWithResult(_0x184a29,null))[_0xb46d('0x3d')](handleError(_0x184a29,null));};exports['destroy']=function(_0x3ae2ea,_0x5067a1){return db[_0xb46d('0x24')][_0xb46d('0x42')]({'where':{'id':_0x3ae2ea[_0xb46d('0x45')]['id']}})[_0xb46d('0x1d')](handleEntityNotFound(_0x5067a1,null))[_0xb46d('0x1d')](removeEntity(_0x5067a1,null))['catch'](handleError(_0x5067a1,null));}; \ No newline at end of file +var _0xe617=['rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','rows','catch','params','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','stack','name','index','map','VoiceTransferReport'];(function(_0x775002,_0x5aa509){var _0x1d7e19=function(_0x29a628){while(--_0x29a628){_0x775002['push'](_0x775002['shift']());}};_0x1d7e19(++_0x5aa509);}(_0xe617,0x1ef));var _0x7e61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe617[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7e61('0x0'));var zipdir=require(_0x7e61('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e61('0x2'));var moment=require(_0x7e61('0x3'));var BPromise=require(_0x7e61('0x4'));var Mustache=require(_0x7e61('0x5'));var util=require(_0x7e61('0x6'));var path=require('path');var sox=require(_0x7e61('0x7'));var csv=require(_0x7e61('0x8'));var ejs=require(_0x7e61('0x9'));var fs=require('fs');var _=require(_0x7e61('0xa'));var squel=require(_0x7e61('0xb'));var crypto=require('crypto');var jsforce=require(_0x7e61('0xc'));var deskjs=require(_0x7e61('0xd'));var toCsv=require(_0x7e61('0x8'));var querystring=require(_0x7e61('0xe'));var Papa=require(_0x7e61('0xf'));var Redis=require(_0x7e61('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7e61('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e61('0x12'))(_0x7e61('0x13'));var utils=require(_0x7e61('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7e61('0x15'));var db=require(_0x7e61('0x16'))['db'];function respondWithStatusCode(_0x17e51f,_0x53c6b0){_0x53c6b0=_0x53c6b0||0xcc;return function(_0x54b368){if(_0x54b368){return _0x17e51f[_0x7e61('0x17')](_0x53c6b0);}return _0x17e51f[_0x7e61('0x18')](_0x53c6b0)[_0x7e61('0x19')]();};}function respondWithResult(_0x78d7c1,_0xdba8f3){_0xdba8f3=_0xdba8f3||0xc8;return function(_0x41979e){if(_0x41979e){return _0x78d7c1[_0x7e61('0x18')](_0xdba8f3)[_0x7e61('0x1a')](_0x41979e);}};}function respondWithFilteredResult(_0x4d9dcf,_0x5b1b9b){return function(_0x4c1721){if(_0x4c1721){var _0x570efa=_0x4c1721[_0x7e61('0x1b')],_0x4426f2=_0x5b1b9b[_0x7e61('0x1c')],_0x143917=_0x5b1b9b['offset']+_0x5b1b9b[_0x7e61('0x1d')],_0x2721aa;if(_0x143917>=_0x570efa){_0x143917=_0x570efa;_0x2721aa=0xc8;}else{_0x2721aa=0xce;}_0x4d9dcf[_0x7e61('0x18')](_0x2721aa);return _0x4d9dcf[_0x7e61('0x1e')](_0x7e61('0x1f'),_0x4426f2+'-'+_0x143917+'/'+_0x570efa)['json'](_0x4c1721);}return null;};}function patchUpdates(_0x3c53dc){return function(_0x2b7c22){try{jsonpatch[_0x7e61('0x20')](_0x2b7c22,_0x3c53dc,!![]);}catch(_0x3ba82d){return BPromise['reject'](_0x3ba82d);}return _0x2b7c22['save']();};}function saveUpdates(_0x7e8a3e,_0xca0816){return function(_0x376d53){if(_0x376d53){return _0x376d53[_0x7e61('0x21')](_0x7e8a3e)['then'](function(_0x238990){return _0x238990;});}return null;};}function removeEntity(_0x36d3bd,_0x45e20b){return function(_0xde6a3f){if(_0xde6a3f){return _0xde6a3f[_0x7e61('0x22')]()[_0x7e61('0x23')](function(){_0x36d3bd[_0x7e61('0x18')](0xcc)[_0x7e61('0x19')]();});}};}function handleEntityNotFound(_0x45d25b,_0x1baf8f){return function(_0x282c90){if(!_0x282c90){_0x45d25b[_0x7e61('0x17')](0x194);}return _0x282c90;};}function handleError(_0x28e944,_0x26529a){_0x26529a=_0x26529a||0x1f4;return function(_0x241cab){logger['error'](_0x241cab[_0x7e61('0x24')]);if(_0x241cab[_0x7e61('0x25')]){delete _0x241cab[_0x7e61('0x25')];}_0x28e944[_0x7e61('0x18')](_0x26529a)['send'](_0x241cab);};}exports[_0x7e61('0x26')]=function(_0x139a07,_0x202938){var _0x2f5a2a={},_0x466438={},_0x13145a={'count':0x0,'rows':[]};var _0x870518=_[_0x7e61('0x27')](db[_0x7e61('0x28')][_0x7e61('0x29')],function(_0x1ec8dd){return{'name':_0x1ec8dd[_0x7e61('0x2a')],'type':_0x1ec8dd['type']['key']};});_0x466438[_0x7e61('0x2b')]=_[_0x7e61('0x27')](_0x870518,_0x7e61('0x25'));_0x466438[_0x7e61('0x2c')]=_[_0x7e61('0x2d')](_0x139a07[_0x7e61('0x2c')]);_0x466438[_0x7e61('0x2e')]=_[_0x7e61('0x2f')](_0x466438[_0x7e61('0x2b')],_0x466438['query']);_0x2f5a2a['attributes']=_[_0x7e61('0x2f')](_0x466438['model'],qs[_0x7e61('0x30')](_0x139a07['query'][_0x7e61('0x30')]));_0x2f5a2a[_0x7e61('0x31')]=_0x2f5a2a['attributes'][_0x7e61('0x32')]?_0x2f5a2a[_0x7e61('0x31')]:_0x466438[_0x7e61('0x2b')];if(!_0x139a07[_0x7e61('0x2c')]['hasOwnProperty'](_0x7e61('0x33'))){_0x2f5a2a[_0x7e61('0x1d')]=qs['limit'](_0x139a07['query'][_0x7e61('0x1d')]);_0x2f5a2a[_0x7e61('0x1c')]=qs['offset'](_0x139a07[_0x7e61('0x2c')]['offset']);}_0x2f5a2a['order']=qs[_0x7e61('0x34')](_0x139a07[_0x7e61('0x2c')][_0x7e61('0x34')]);_0x2f5a2a['where']=qs[_0x7e61('0x2e')](_[_0x7e61('0x35')](_0x139a07[_0x7e61('0x2c')],_0x466438[_0x7e61('0x2e')]),_0x870518);if(_0x139a07[_0x7e61('0x2c')][_0x7e61('0x36')]){_0x2f5a2a[_0x7e61('0x37')]=_[_0x7e61('0x38')](_0x2f5a2a[_0x7e61('0x37')],{'$or':_[_0x7e61('0x27')](_0x870518,function(_0x319dc4){if(_0x319dc4[_0x7e61('0x39')]!==_0x7e61('0x3a')){var _0x22a1d8={};_0x22a1d8[_0x319dc4[_0x7e61('0x25')]]={'$like':'%'+_0x139a07[_0x7e61('0x2c')][_0x7e61('0x36')]+'%'};return _0x22a1d8;}})});}_0x2f5a2a=_['merge']({},_0x2f5a2a,_0x139a07[_0x7e61('0x3b')]);var _0x49a916={'where':_0x2f5a2a[_0x7e61('0x37')]};return db[_0x7e61('0x28')][_0x7e61('0x1b')](_0x49a916)['then'](function(_0x3efc17){_0x13145a['count']=_0x3efc17;if(_0x139a07[_0x7e61('0x2c')]['includeAll']){_0x2f5a2a[_0x7e61('0x3c')]=[{'all':!![]}];}return db[_0x7e61('0x28')]['findAll'](_0x2f5a2a);})['then'](function(_0x5120cd){_0x13145a[_0x7e61('0x3d')]=_0x5120cd;return _0x13145a;})['then'](respondWithFilteredResult(_0x202938,_0x2f5a2a))[_0x7e61('0x3e')](handleError(_0x202938,null));};exports['show']=function(_0x1178fb,_0x3bbaf9){var _0x24a0f5={'raw':!![],'where':{'id':_0x1178fb[_0x7e61('0x3f')]['id']}},_0x3f50e0={};_0x3f50e0[_0x7e61('0x2b')]=_['keys'](db[_0x7e61('0x28')]['rawAttributes']);_0x3f50e0[_0x7e61('0x2c')]=_[_0x7e61('0x2d')](_0x1178fb[_0x7e61('0x2c')]);_0x3f50e0[_0x7e61('0x2e')]=_[_0x7e61('0x2f')](_0x3f50e0[_0x7e61('0x2b')],_0x3f50e0['query']);_0x24a0f5[_0x7e61('0x31')]=_[_0x7e61('0x2f')](_0x3f50e0[_0x7e61('0x2b')],qs[_0x7e61('0x30')](_0x1178fb[_0x7e61('0x2c')][_0x7e61('0x30')]));_0x24a0f5[_0x7e61('0x31')]=_0x24a0f5['attributes'][_0x7e61('0x32')]?_0x24a0f5['attributes']:_0x3f50e0[_0x7e61('0x2b')];if(_0x1178fb['query']['includeAll']){_0x24a0f5[_0x7e61('0x3c')]=[{'all':!![]}];}_0x24a0f5=_[_0x7e61('0x38')]({},_0x24a0f5,_0x1178fb['options']);return db[_0x7e61('0x28')][_0x7e61('0x40')](_0x24a0f5)[_0x7e61('0x23')](handleEntityNotFound(_0x3bbaf9,null))[_0x7e61('0x23')](respondWithResult(_0x3bbaf9,null))[_0x7e61('0x3e')](handleError(_0x3bbaf9,null));};exports['create']=function(_0x39d975,_0x538e67){return db[_0x7e61('0x28')][_0x7e61('0x41')](_0x39d975[_0x7e61('0x42')],{})[_0x7e61('0x23')](respondWithResult(_0x538e67,0xc9))[_0x7e61('0x3e')](handleError(_0x538e67,null));};exports[_0x7e61('0x21')]=function(_0x1c3246,_0x15a9da){if(_0x1c3246[_0x7e61('0x42')]['id']){delete _0x1c3246[_0x7e61('0x42')]['id'];}return db['VoiceTransferReport'][_0x7e61('0x40')]({'where':{'id':_0x1c3246[_0x7e61('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15a9da,null))[_0x7e61('0x23')](saveUpdates(_0x1c3246[_0x7e61('0x42')],null))[_0x7e61('0x23')](respondWithResult(_0x15a9da,null))[_0x7e61('0x3e')](handleError(_0x15a9da,null));};exports[_0x7e61('0x22')]=function(_0x25c954,_0x43dd35){return db[_0x7e61('0x28')][_0x7e61('0x40')]({'where':{'id':_0x25c954[_0x7e61('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43dd35,null))['then'](removeEntity(_0x43dd35,null))[_0x7e61('0x3e')](handleError(_0x43dd35,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 40d5561..b64fbff 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 _0x953a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x12f9ab,_0x427446){var _0x4b751a=function(_0x3730dc){while(--_0x3730dc){_0x12f9ab['push'](_0x12f9ab['shift']());}};_0x4b751a(++_0x427446);}(_0x953a,0x72));var _0xa953=function(_0x579d7d,_0x1198ef){_0x579d7d=_0x579d7d-0x0;var _0x2b7725=_0x953a[_0x579d7d];return _0x2b7725;};'use strict';var _=require(_0xa953('0x0'));var util=require(_0xa953('0x1'));var logger=require(_0xa953('0x2'))(_0xa953('0x3'));var moment=require(_0xa953('0x4'));var BPromise=require(_0xa953('0x5'));var rp=require(_0xa953('0x6'));var fs=require('fs');var path=require(_0xa953('0x7'));var rimraf=require(_0xa953('0x8'));var config=require(_0xa953('0x9'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x510ebb,_0xd40742){return _0x510ebb[_0xa953('0xa')](_0xa953('0xb'),attributes,{'tableName':_0xa953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x061a=['path','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13a3b4,_0x4cc510){var _0x480775=function(_0x2d516c){while(--_0x2d516c){_0x13a3b4['push'](_0x13a3b4['shift']());}};_0x480775(++_0x4cc510);}(_0x061a,0x13e));var _0xa061=function(_0x168fb5,_0x167bb8){_0x168fb5=_0x168fb5-0x0;var _0x3bde51=_0x061a[_0x168fb5];return _0x3bde51;};'use strict';var _=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var logger=require(_0xa061('0x2'))(_0xa061('0x3'));var moment=require(_0xa061('0x4'));var BPromise=require(_0xa061('0x5'));var rp=require(_0xa061('0x6'));var fs=require('fs');var path=require(_0xa061('0x7'));var rimraf=require('rimraf');var config=require(_0xa061('0x8'));var attributes=require(_0xa061('0x9'));module['exports']=function(_0xa0e0b4,_0x31a2c4){return _0xa0e0b4[_0xa061('0xa')](_0xa061('0xb'),attributes,{'tableName':_0xa061('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index dab92f3..21b0c6f 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 _0x90ae=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','stringify','lodash'];(function(_0x4cc1b2,_0x5bc9a1){var _0x2ee265=function(_0x2cf29a){while(--_0x2cf29a){_0x4cc1b2['push'](_0x4cc1b2['shift']());}};_0x2ee265(++_0x5bc9a1);}(_0x90ae,0x195));var _0xe90a=function(_0x4550e2,_0x1570bf){_0x4550e2=_0x4550e2-0x0;var _0x20ede1=_0x90ae[_0x4550e2];return _0x20ede1;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var moment=require(_0xe90a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe90a('0x3'));var fs=require('fs');var Redis=require(_0xe90a('0x4'));var db=require(_0xe90a('0x5'))['db'];var utils=require(_0xe90a('0x6'));var logger=require(_0xe90a('0x7'))(_0xe90a('0x8'));var config=require(_0xe90a('0x9'));var jayson=require(_0xe90a('0xa'));var client=jayson[_0xe90a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203575,_0x280721,_0x24b470){return new BPromise(function(_0x42fb64,_0x11cd54){return client[_0xe90a('0xc')](_0x203575,_0x24b470)['then'](function(_0x24c73f){logger[_0xe90a('0xd')](_0xe90a('0xe'),_0x280721,_0xe90a('0xf'));logger[_0xe90a('0x10')](_0xe90a('0x11'),_0x280721,_0xe90a('0xf'),JSON['stringify'](_0x24c73f));if(_0x24c73f[_0xe90a('0x12')]){if(_0x24c73f[_0xe90a('0x12')]['code']===0x1f4){logger['error'](_0xe90a('0xe'),_0x280721,_0x24c73f[_0xe90a('0x12')]['message']);return _0x11cd54(_0x24c73f[_0xe90a('0x12')][_0xe90a('0x13')]);}logger[_0xe90a('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x280721,_0x24c73f[_0xe90a('0x12')][_0xe90a('0x13')]);return _0x42fb64(_0x24c73f['error'][_0xe90a('0x13')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x280721,'request\x20sent');_0x42fb64(_0x24c73f[_0xe90a('0x14')][_0xe90a('0x13')]);}})[_0xe90a('0x15')](function(_0x22602f){logger[_0xe90a('0x12')](_0xe90a('0xe'),_0x280721,_0x22602f);_0x11cd54(_0x22602f);});});}exports[_0xe90a('0x16')]=function(_0x1363cd){var _0x330172=this;return new Promise(function(_0x80477a,_0x219a7a){return db[_0xe90a('0x17')][_0xe90a('0x18')](_0x1363cd['body'],{'raw':_0x1363cd[_0xe90a('0x19')]?_0x1363cd[_0xe90a('0x19')][_0xe90a('0x1a')]===undefined?!![]:![]:!![]})[_0xe90a('0x1b')](function(_0x4cfb63){logger[_0xe90a('0xd')](_0xe90a('0x16'),_0x1363cd);logger[_0xe90a('0x10')]('CreateVoiceTransferReport',_0x1363cd,JSON[_0xe90a('0x1c')](_0x4cfb63));_0x80477a(_0x4cfb63);})[_0xe90a('0x15')](function(_0x3c58cd){logger[_0xe90a('0x12')](_0xe90a('0x16'),_0x3c58cd[_0xe90a('0x13')],_0x1363cd);_0x219a7a(_0x330172['error'](0x1f4,_0x3c58cd[_0xe90a('0x13')]));});});}; \ No newline at end of file +var _0xf0a3=['info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x431a00,_0x4ec75f){var _0x50c633=function(_0x820657){while(--_0x820657){_0x431a00['push'](_0x431a00['shift']());}};_0x50c633(++_0x4ec75f);}(_0xf0a3,0xe1));var _0x3f0a=function(_0x39666d,_0x31b50d){_0x39666d=_0x39666d-0x0;var _0x2f8e05=_0xf0a3[_0x39666d];return _0x2f8e05;};'use strict';var _=require(_0x3f0a('0x0'));var util=require(_0x3f0a('0x1'));var moment=require(_0x3f0a('0x2'));var BPromise=require(_0x3f0a('0x3'));var rs=require(_0x3f0a('0x4'));var fs=require('fs');var Redis=require(_0x3f0a('0x5'));var db=require(_0x3f0a('0x6'))['db'];var utils=require(_0x3f0a('0x7'));var logger=require(_0x3f0a('0x8'))(_0x3f0a('0x9'));var config=require(_0x3f0a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3f0a('0xb')][_0x3f0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a21e8,_0x4ea112,_0x468a2c){return new BPromise(function(_0x241efa,_0x3e4475){return client[_0x3f0a('0xd')](_0x1a21e8,_0x468a2c)[_0x3f0a('0xe')](function(_0x38173d){logger[_0x3f0a('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x4ea112,_0x3f0a('0x10'));logger['debug'](_0x3f0a('0x11'),_0x4ea112,'request\x20sent',JSON[_0x3f0a('0x12')](_0x38173d));if(_0x38173d['error']){if(_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x14')]===0x1f4){logger[_0x3f0a('0x13')](_0x3f0a('0x15'),_0x4ea112,_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x16')]);return _0x3e4475(_0x38173d['error'][_0x3f0a('0x16')]);}logger[_0x3f0a('0x13')](_0x3f0a('0x15'),_0x4ea112,_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x16')]);return _0x241efa(_0x38173d[_0x3f0a('0x13')][_0x3f0a('0x16')]);}else{logger[_0x3f0a('0xf')](_0x3f0a('0x15'),_0x4ea112,'request\x20sent');_0x241efa(_0x38173d[_0x3f0a('0x17')][_0x3f0a('0x16')]);}})[_0x3f0a('0x18')](function(_0x43103c){logger[_0x3f0a('0x13')](_0x3f0a('0x15'),_0x4ea112,_0x43103c);_0x3e4475(_0x43103c);});});}exports['CreateVoiceTransferReport']=function(_0x449c70){var _0x2de44c=this;return new Promise(function(_0x38a73c,_0x42f388){return db[_0x3f0a('0x19')][_0x3f0a('0x1a')](_0x449c70[_0x3f0a('0x1b')],{'raw':_0x449c70['options']?_0x449c70[_0x3f0a('0x1c')][_0x3f0a('0x1d')]===undefined?!![]:![]:!![]})[_0x3f0a('0xe')](function(_0x5621f8){logger[_0x3f0a('0xf')]('CreateVoiceTransferReport',_0x449c70);logger['debug']('CreateVoiceTransferReport',_0x449c70,JSON['stringify'](_0x5621f8));_0x38a73c(_0x5621f8);})[_0x3f0a('0x18')](function(_0x35ba09){logger['error']('CreateVoiceTransferReport',_0x35ba09[_0x3f0a('0x16')],_0x449c70);_0x42f388(_0x2de44c['error'](0x1f4,_0x35ba09[_0x3f0a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 20a8a98..900f0ac 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 _0x9d02=['/answer','answer','/unhold','/calls','calls','/transfer','transfer','express','../../components/auth/service','post','isAuthenticated','canUpdate','/hangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d02,0x118));var _0x29d0=function(_0x680c68,_0x265368){_0x680c68=_0x680c68-0x0;var _0x1f4c2f=_0x9d02[_0x680c68];return _0x1f4c2f;};'use strict';var express=require(_0x29d0('0x0'));var router=express['Router']();var auth=require(_0x29d0('0x1'));var controller=require('./webbar.controller');router[_0x29d0('0x2')]('/originate',auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller['originate']);router[_0x29d0('0x2')](_0x29d0('0x5'),auth[_0x29d0('0x3')](),auth['canUpdate'](),controller['hangup']);router['post'](_0x29d0('0x6'),auth[_0x29d0('0x3')](),auth['canUpdate'](),controller[_0x29d0('0x7')]);router[_0x29d0('0x2')]('/hold',auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller['hold']);router[_0x29d0('0x2')](_0x29d0('0x8'),auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller['unhold']);router['post'](_0x29d0('0x9'),auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller[_0x29d0('0xa')]);router[_0x29d0('0x2')](_0x29d0('0xb'),auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller[_0x29d0('0xc')]);module['exports']=router; \ No newline at end of file +var _0xb790=['/hold','/unhold','unhold','/transfer','exports','Router','/originate','originate','post','isAuthenticated','canUpdate','hangup','/answer','answer'];(function(_0x2b1b0c,_0xf718d2){var _0x4cdbb4=function(_0x32ba68){while(--_0x32ba68){_0x2b1b0c['push'](_0x2b1b0c['shift']());}};_0x4cdbb4(++_0xf718d2);}(_0xb790,0xe5));var _0x0b79=function(_0x3d8812,_0x24b648){_0x3d8812=_0x3d8812-0x0;var _0x3aa4ee=_0xb790[_0x3d8812];return _0x3aa4ee;};'use strict';var express=require('express');var router=express[_0x0b79('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0x0b79('0x1'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x0b79('0x2')]);router[_0x0b79('0x3')]('/hangup',auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller[_0x0b79('0x6')]);router[_0x0b79('0x3')](_0x0b79('0x7'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller[_0x0b79('0x8')]);router[_0x0b79('0x3')](_0x0b79('0x9'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller['hold']);router['post'](_0x0b79('0xa'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller[_0x0b79('0xb')]);router[_0x0b79('0x3')]('/calls',auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller['calls']);router[_0x0b79('0x3')](_0x0b79('0xc'),auth[_0x0b79('0x4')](),auth[_0x0b79('0x5')](),controller['transfer']);module[_0x0b79('0xd')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index aef29e1..12f3f7b 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 _0xe0c3=['util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','error','stack','name','status','send','NotFound','message','result','catch','User','findOne','agent','then','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','webbar:hangup','answer','format','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment'];(function(_0x5ad7c3,_0x1a59d8){var _0x5a23c0=function(_0x23e857){while(--_0x23e857){_0x5ad7c3['push'](_0x5ad7c3['shift']());}};_0x5a23c0(++_0x1a59d8);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x3e0c('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x3e0c('0x1'))['db'];var config=require(_0x3e0c('0x2'));var util=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var jayson=require(_0x3e0c('0x5'));var amiClient=jayson[_0x3e0c('0x6')][_0x3e0c('0x7')]({'port':0x232a});var logger=require(_0x3e0c('0x8'))(_0x3e0c('0x9'));var Redis=require('ioredis');config['redis']=_[_0x3e0c('0xa')](config[_0x3e0c('0xb')],{'host':_0x3e0c('0xc'),'port':0x18eb});var io=require(_0x3e0c('0xd'))(new Redis(config[_0x3e0c('0xb')]));var Schema=require(_0x3e0c('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'callNumber':{'type':_0x3e0c('0x11'),'required':[!![],_0x3e0c('0x12')]},'callerId':{'type':_0x3e0c('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':'string','required':[!![],_0x3e0c('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x3e0c('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]}});function emit(_0x274d75,_0x42b1bd,_0x87e3f9){logger[_0x3e0c('0x15')](_0x274d75,_0x42b1bd,JSON['stringify'](_0x87e3f9));io['to'](_0x274d75)['emit'](_0x42b1bd,_0x87e3f9);}function handleError(_0x20db28){return function(_0x216993){console[_0x3e0c('0x16')](_0x3e0c('0x17'),_0x216993,_0x216993 instanceof RangeError);logger[_0x3e0c('0x18')](_0x216993[_0x3e0c('0x19')]);if(_0x216993 instanceof RangeError){if(_0x216993['name']){delete _0x216993[_0x3e0c('0x1a')];}_0x20db28[_0x3e0c('0x1b')](0x194)[_0x3e0c('0x1c')](_0x216993);}else{if(_0x216993['name']){delete _0x216993[_0x3e0c('0x1a')];}_0x20db28['status'](0x1f4)['send'](_0x216993);}};}function checkError(){return function(_0x11810e){if(!_0x11810e){throw new RangeError(_0x3e0c('0x1d'));}return _0x11810e;};}function respondWithRpcPromise(_0x6fa8f9,_0x410b09){return new BPromise(function(_0x4f8d38,_0x4cd447){var _0x3320c6=amiClient;return _0x3320c6['request'](_0x6fa8f9,_0x410b09)['then'](function(_0x3fd7de){if(_0x3fd7de[_0x3e0c('0x18')]){if(_0x3fd7de[_0x3e0c('0x18')]['code']===0x1f4){return _0x4cd447(_0x3fd7de[_0x3e0c('0x18')][_0x3e0c('0x1e')]);}return _0x4f8d38(_0x3fd7de['error'][_0x3e0c('0x1e')]);}else{_0x4f8d38(_0x3fd7de[_0x3e0c('0x1f')]);}})[_0x3e0c('0x20')](function(_0x1db945){_0x4cd447(_0x1db945);});});}function getAgent(_0x53f8f6){return db[_0x3e0c('0x21')][_0x3e0c('0x22')]({'where':{'id':_0x53f8f6,'role':_0x3e0c('0x23')}})[_0x3e0c('0x24')](checkError());}function getAgentCheckSession(_0x4c4bc3,_0x15c294){return new BPromise(function(_0x47b15d,_0x50de5c){var _0x477ebc=respondWithRpcPromise(_0x3e0c('0x25'));var _0x4d3ce2=getAgent(_0x4c4bc3);Promise[_0x3e0c('0x26')]([_0x477ebc,_0x4d3ce2])[_0x3e0c('0x24')](function(_0x21d7a0){var _0x59c22f=_0x21d7a0[0x0];var _0x44ecad=_0x21d7a0[0x1];var _0x1caf48=_['filter'](_0x59c22f[_0x3e0c('0x27')],function(_0x2f31ad){return _0x2f31ad[_0x3e0c('0x28')]==_0x44ecad['id']&&_0x2f31ad[_0x3e0c('0x29')]==_0x15c294;});if(_0x1caf48['length']==0x1){_0x47b15d(_0x44ecad);}else{_0x50de5c(new RangeError(_0x3e0c('0x2a')+_0x15c294+_0x3e0c('0x2b')));}});});}exports[_0x3e0c('0x2c')]=function(_0x5c8061,_0x1dcfe2){logger[_0x3e0c('0x15')](_0x3e0c('0x2d'),_0x5c8061['body']);var _0x206bb2=originateValidation[_0x3e0c('0xe')](_0x5c8061[_0x3e0c('0x2e')]);if(_0x206bb2[_0x3e0c('0x2f')]>0x0){return _0x1dcfe2[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x206bb2);}var _0x1abd73=_0x5c8061[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x3b41dd=_0x5c8061[_0x3e0c('0x2e')][_0x3e0c('0x32')];var _0x33dcd2=_0x5c8061[_0x3e0c('0x2e')]['callerId'];var _0x1bf622=_0x5c8061[_0x3e0c('0x2e')][_0x3e0c('0x33')];return getAgent(_0x1abd73)[_0x3e0c('0x24')](function(_0xd89af9){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0xd89af9[_0x3e0c('0x1a')]);emit(util['format']('user:%s',_0xd89af9[_0x3e0c('0x1a')]),_0x3e0c('0x35'),{'callNumber':_0x3b41dd,'callerId':_0x33dcd2,'callbackUrl':_0x1bf622});return _0x1dcfe2[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x36')});})[_0x3e0c('0x20')](handleError(_0x1dcfe2));};exports['hangup']=function(_0x2a91e3,_0x168784){logger['info']('hangup\x20fired:',_0x2a91e3['body']);var _0x42ddac=hangupValidation[_0x3e0c('0xe')](_0x2a91e3[_0x3e0c('0x2e')]);if(_0x42ddac[_0x3e0c('0x2f')]>0x0){return _0x168784[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x42ddac);}var _0x6242e5=_0x2a91e3[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0xb38f09=_0x2a91e3[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x6242e5)['then'](function(_0x539fa2){logger['info'](_0x3e0c('0x34'),_0x539fa2[_0x3e0c('0x1a')]);emit(util['format']('user:%s',_0x539fa2[_0x3e0c('0x1a')]),_0x3e0c('0x37'),{'sessionId':_0xb38f09});return _0x168784[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'error':![],'message':'hangup\x20executed!'});})[_0x3e0c('0x20')](handleError(_0x168784));};exports[_0x3e0c('0x38')]=function(_0x81da81,_0x12cf58){logger[_0x3e0c('0x15')]('answer\x20fired:',_0x81da81[_0x3e0c('0x2e')]);var _0x5f4274=answerValidation[_0x3e0c('0xe')](_0x81da81[_0x3e0c('0x2e')]);if(_0x5f4274['length']>0x0){return _0x12cf58['status'](0x190)[_0x3e0c('0x30')](_0x5f4274);}var _0x43a18e=_0x81da81['body'][_0x3e0c('0x31')];var _0x2190d2=_0x81da81[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x43a18e)[_0x3e0c('0x24')](function(_0x126185){logger['info'](_0x3e0c('0x34'),_0x126185[_0x3e0c('0x1a')]);emit(util[_0x3e0c('0x39')](_0x3e0c('0x3a'),_0x126185[_0x3e0c('0x1a')]),_0x3e0c('0x3b'),{'sessionId':_0x2190d2});return _0x12cf58['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x3c')});})[_0x3e0c('0x20')](handleError(_0x12cf58));};exports['hold']=function(_0x1f00d5,_0x36b805){logger['info'](_0x3e0c('0x3d'),_0x1f00d5[_0x3e0c('0x2e')]);var _0x2fe20f=holdValidation['validate'](_0x1f00d5[_0x3e0c('0x2e')]);if(_0x2fe20f[_0x3e0c('0x2f')]>0x0){return _0x36b805[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x2fe20f);}var _0x109078=_0x1f00d5[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x41f068=_0x1f00d5[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x109078)[_0x3e0c('0x24')](function(_0x4efbf2){logger[_0x3e0c('0x15')]('entityFound:',_0x4efbf2['name']);emit(util[_0x3e0c('0x39')]('user:%s',_0x4efbf2[_0x3e0c('0x1a')]),_0x3e0c('0x3e'),{'sessionId':_0x41f068});return _0x36b805['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x3f')});})['catch'](handleError(_0x36b805));};exports[_0x3e0c('0x40')]=function(_0x3e04c9,_0x166203){logger[_0x3e0c('0x15')](_0x3e0c('0x41'),_0x3e04c9[_0x3e0c('0x2e')]);var _0x15f16a=unholdValidation[_0x3e0c('0xe')](_0x3e04c9[_0x3e0c('0x2e')]);if(_0x15f16a[_0x3e0c('0x2f')]>0x0){return _0x166203['status'](0x190)[_0x3e0c('0x30')](_0x15f16a);}var _0x2b9a4e=_0x3e04c9[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x1a2cf2=_0x3e04c9[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x2b9a4e)[_0x3e0c('0x24')](function(_0x34762e){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0x34762e[_0x3e0c('0x1a')]);emit(util[_0x3e0c('0x39')](_0x3e0c('0x3a'),_0x34762e['name']),_0x3e0c('0x42'),{'sessionId':_0x1a2cf2});return _0x166203[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x3e0c('0x20')](handleError(_0x166203));};exports[_0x3e0c('0x43')]=function(_0x52832b,_0x173d10){logger[_0x3e0c('0x15')](_0x3e0c('0x44'),_0x173d10[_0x3e0c('0x2e')]);var _0x29cedc=callsValidation[_0x3e0c('0xe')](_0x52832b[_0x3e0c('0x2e')]);if(_0x29cedc['length']>0x0){return _0x173d10[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x29cedc);}var _0x53c6b6=_0x52832b[_0x3e0c('0x2e')]['userId'];var _0x13840a=respondWithRpcPromise(_0x3e0c('0x25'));var _0x28b2d5=getAgent(_0x53c6b6);return Promise[_0x3e0c('0x26')]([_0x13840a,_0x28b2d5])[_0x3e0c('0x24')](function(_0x34fde8){var _0x46b51d=_0x34fde8[0x0];var _0x4399a0=_0x34fde8[0x1];var _0x11c90f=_[_0x3e0c('0x45')](_0x46b51d[_0x3e0c('0x27')],function(_0x3b6c40){return _0x3b6c40[_0x3e0c('0x28')]==_0x4399a0['id'];});return _0x173d10[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'count':_0x11c90f[_0x3e0c('0x2f')],'rows':_0x11c90f});})[_0x3e0c('0x20')](handleError(_0x173d10));};exports[_0x3e0c('0x46')]=function(_0x1fb4c2,_0x1939f8){logger[_0x3e0c('0x15')](_0x3e0c('0x47'),_0x1fb4c2[_0x3e0c('0x2e')]);var _0x157ba4=conferenceValidation[_0x3e0c('0xe')](_0x1fb4c2[_0x3e0c('0x2e')]);if(_0x157ba4['length']>0x0){return _0x1939f8[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x157ba4);}var _0x4760f2=_0x1fb4c2[_0x3e0c('0x2e')]['userId'];return getAgent(_0x4760f2)[_0x3e0c('0x24')](function(_0x42637d){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0x42637d[_0x3e0c('0x1a')]);emit(util[_0x3e0c('0x39')]('user:%s',_0x42637d[_0x3e0c('0x1a')]),_0x3e0c('0x48'));return _0x1939f8['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x49')});})[_0x3e0c('0x20')](handleError(_0x1939f8));};exports[_0x3e0c('0x4a')]=function(_0x194dc9,_0x4f92f8){logger['info'](_0x3e0c('0x4b'),_0x194dc9[_0x3e0c('0x2e')]);var _0x4c07a8=transferValidation['validate'](_0x194dc9['body']);if(_0x4c07a8[_0x3e0c('0x2f')]>0x0){return _0x4f92f8[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x4c07a8);}var _0x2fc7c7=_0x194dc9[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x99c095=_0x194dc9[_0x3e0c('0x2e')][_0x3e0c('0x29')];var _0x1cff92=_0x194dc9[_0x3e0c('0x2e')][_0x3e0c('0x4c')];return getAgent(_0x2fc7c7)[_0x3e0c('0x24')](function(_0x425235){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0x425235[_0x3e0c('0x1a')]);emit(util['format'](_0x3e0c('0x3a'),_0x425235[_0x3e0c('0x1a')]),_0x3e0c('0x4d'),{'sessionId':_0x99c095,'transferNumber':_0x1cff92});return _0x4f92f8['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x4e')});})[_0x3e0c('0x20')](handleError(_0x4f92f8));}; \ No newline at end of file +var _0xbf04=['then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','userId','callerId','callbackUrl','entityFound:','format','user:%s','json','originate\x20executed!','hangup','hangup\x20fired:','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','../../config/logger','webbarapi','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send','NotFound'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0xbf04,0xc1));var _0x4bf0=function(_0x33fa54,_0x749f02){_0x33fa54=_0x33fa54-0x0;var _0x4f517a=_0xbf04[_0x33fa54];return _0x4f517a;};'use strict';var path=require(_0x4bf0('0x0'));var fs=require('fs');var _=require(_0x4bf0('0x1'));var db=require(_0x4bf0('0x2'))['db'];var config=require(_0x4bf0('0x3'));var util=require('util');var BPromise=require(_0x4bf0('0x4'));var jayson=require(_0x4bf0('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x4bf0('0x6'))(_0x4bf0('0x7'));var Redis=require('ioredis');config[_0x4bf0('0x8')]=_[_0x4bf0('0x9')](config[_0x4bf0('0x8')],{'host':_0x4bf0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4bf0('0x8')]));var Schema=require(_0x4bf0('0xb'));var originateValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'callNumber':{'type':_0x4bf0('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x4bf0('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4bf0('0xe'),'required':[!![],_0x4bf0('0xf')]},'transferNumber':{'type':_0x4bf0('0xe'),'required':[!![],_0x4bf0('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]},'sessionId':{'type':_0x4bf0('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4bf0('0xc'),'required':[!![],_0x4bf0('0xd')]}});function emit(_0x56c73a,_0x11e0fb,_0x5e678c){logger['info'](_0x56c73a,_0x11e0fb,JSON[_0x4bf0('0x11')](_0x5e678c));io['to'](_0x56c73a)['emit'](_0x11e0fb,_0x5e678c);}function handleError(_0x8d8802){return function(_0x365e72){console[_0x4bf0('0x12')](_0x4bf0('0x13'),_0x365e72,_0x365e72 instanceof RangeError);logger[_0x4bf0('0x14')](_0x365e72[_0x4bf0('0x15')]);if(_0x365e72 instanceof RangeError){if(_0x365e72['name']){delete _0x365e72[_0x4bf0('0x16')];}_0x8d8802[_0x4bf0('0x17')](0x194)[_0x4bf0('0x18')](_0x365e72);}else{if(_0x365e72['name']){delete _0x365e72['name'];}_0x8d8802[_0x4bf0('0x17')](0x1f4)['send'](_0x365e72);}};}function checkError(){return function(_0x25a1d1){if(!_0x25a1d1){throw new RangeError(_0x4bf0('0x19'));}return _0x25a1d1;};}function respondWithRpcPromise(_0x5e3fdd,_0x1c269c){return new BPromise(function(_0x488b71,_0x4a5be8){var _0x35cbee=amiClient;return _0x35cbee['request'](_0x5e3fdd,_0x1c269c)[_0x4bf0('0x1a')](function(_0x4c2835){if(_0x4c2835[_0x4bf0('0x14')]){if(_0x4c2835[_0x4bf0('0x14')][_0x4bf0('0x1b')]===0x1f4){return _0x4a5be8(_0x4c2835['error'][_0x4bf0('0x1c')]);}return _0x488b71(_0x4c2835[_0x4bf0('0x14')][_0x4bf0('0x1c')]);}else{_0x488b71(_0x4c2835[_0x4bf0('0x1d')]);}})[_0x4bf0('0x1e')](function(_0x2ec628){_0x4a5be8(_0x2ec628);});});}function getAgent(_0x3b535f){return db[_0x4bf0('0x1f')][_0x4bf0('0x20')]({'where':{'id':_0x3b535f,'role':'agent'}})[_0x4bf0('0x1a')](checkError());}function getAgentCheckSession(_0xd86467,_0x4af1cd){return new BPromise(function(_0x1d4e37,_0x4d8e60){var _0x2773da=respondWithRpcPromise(_0x4bf0('0x21'));var _0x4de014=getAgent(_0xd86467);Promise[_0x4bf0('0x22')]([_0x2773da,_0x4de014])[_0x4bf0('0x1a')](function(_0x479cdf){var _0x4e53f2=_0x479cdf[0x0];var _0x5dda42=_0x479cdf[0x1];var _0x332a66=_[_0x4bf0('0x23')](_0x4e53f2[_0x4bf0('0x24')],function(_0x25909){return _0x25909[_0x4bf0('0x25')]==_0x5dda42['id']&&_0x25909[_0x4bf0('0x26')]==_0x4af1cd;});if(_0x332a66[_0x4bf0('0x27')]==0x1){_0x1d4e37(_0x5dda42);}else{_0x4d8e60(new RangeError(_0x4bf0('0x28')+_0x4af1cd+_0x4bf0('0x29')));}});});}exports['originate']=function(_0x2abc1e,_0x1868e4){logger[_0x4bf0('0x2a')](_0x4bf0('0x2b'),_0x2abc1e[_0x4bf0('0x2c')]);var _0x522b80=originateValidation[_0x4bf0('0xb')](_0x2abc1e[_0x4bf0('0x2c')]);if(_0x522b80[_0x4bf0('0x27')]>0x0){return _0x1868e4[_0x4bf0('0x17')](0x190)['json'](_0x522b80);}var _0x18c916=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x22ad76=_0x2abc1e['body']['callNumber'];var _0x5f4b85=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2e')];var _0x3cdf5f=_0x2abc1e[_0x4bf0('0x2c')][_0x4bf0('0x2f')];return getAgent(_0x18c916)[_0x4bf0('0x1a')](function(_0x2c6d89){logger['info'](_0x4bf0('0x30'),_0x2c6d89[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x2c6d89[_0x4bf0('0x16')]),'webbar:originate',{'callNumber':_0x22ad76,'callerId':_0x5f4b85,'callbackUrl':_0x3cdf5f});return _0x1868e4[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x34')});})['catch'](handleError(_0x1868e4));};exports[_0x4bf0('0x35')]=function(_0x2ba575,_0x578ca9){logger[_0x4bf0('0x2a')](_0x4bf0('0x36'),_0x2ba575['body']);var _0x34f478=hangupValidation['validate'](_0x2ba575['body']);if(_0x34f478[_0x4bf0('0x27')]>0x0){return _0x578ca9['status'](0x190)[_0x4bf0('0x33')](_0x34f478);}var _0x59bb06=_0x2ba575[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x218c32=_0x2ba575[_0x4bf0('0x2c')]['sessionId'];return getAgent(_0x59bb06)[_0x4bf0('0x1a')](function(_0x493da4){logger['info'](_0x4bf0('0x30'),_0x493da4[_0x4bf0('0x16')]);emit(util['format'](_0x4bf0('0x32'),_0x493da4[_0x4bf0('0x16')]),'webbar:hangup',{'sessionId':_0x218c32});return _0x578ca9[_0x4bf0('0x17')](0xc8)['json']({'error':![],'message':_0x4bf0('0x37')});})[_0x4bf0('0x1e')](handleError(_0x578ca9));};exports[_0x4bf0('0x38')]=function(_0xc31c13,_0x13ca49){logger['info']('answer\x20fired:',_0xc31c13['body']);var _0x458911=answerValidation['validate'](_0xc31c13[_0x4bf0('0x2c')]);if(_0x458911[_0x4bf0('0x27')]>0x0){return _0x13ca49['status'](0x190)[_0x4bf0('0x33')](_0x458911);}var _0x564c5a=_0xc31c13[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x3b02c5=_0xc31c13[_0x4bf0('0x2c')][_0x4bf0('0x26')];return getAgent(_0x564c5a)[_0x4bf0('0x1a')](function(_0x422b63){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x422b63[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')]('user:%s',_0x422b63[_0x4bf0('0x16')]),_0x4bf0('0x39'),{'sessionId':_0x3b02c5});return _0x13ca49[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x3a')});})[_0x4bf0('0x1e')](handleError(_0x13ca49));};exports[_0x4bf0('0x3b')]=function(_0x3ed00b,_0x47521f){logger[_0x4bf0('0x2a')]('hold\x20fired:',_0x3ed00b[_0x4bf0('0x2c')]);var _0x622e4b=holdValidation[_0x4bf0('0xb')](_0x3ed00b[_0x4bf0('0x2c')]);if(_0x622e4b[_0x4bf0('0x27')]>0x0){return _0x47521f[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x622e4b);}var _0x5c5157=_0x3ed00b[_0x4bf0('0x2c')]['userId'];var _0x254a8d=_0x3ed00b[_0x4bf0('0x2c')][_0x4bf0('0x26')];return getAgent(_0x5c5157)[_0x4bf0('0x1a')](function(_0x52dc0){logger['info'](_0x4bf0('0x30'),_0x52dc0['name']);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x52dc0[_0x4bf0('0x16')]),_0x4bf0('0x3c'),{'sessionId':_0x254a8d});return _0x47521f[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x47521f));};exports[_0x4bf0('0x3d')]=function(_0x4209a5,_0xd3611c){logger[_0x4bf0('0x2a')](_0x4bf0('0x3e'),_0x4209a5['body']);var _0x566fe9=unholdValidation[_0x4bf0('0xb')](_0x4209a5['body']);if(_0x566fe9[_0x4bf0('0x27')]>0x0){return _0xd3611c[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x566fe9);}var _0x24af84=_0x4209a5[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x274a31=_0x4209a5[_0x4bf0('0x2c')]['sessionId'];return getAgent(_0x24af84)[_0x4bf0('0x1a')](function(_0x3e4755){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x3e4755[_0x4bf0('0x16')]);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x3e4755[_0x4bf0('0x16')]),_0x4bf0('0x3f'),{'sessionId':_0x274a31});return _0xd3611c['status'](0xc8)[_0x4bf0('0x33')]({'error':![],'message':'unhold\x20executed!'});})[_0x4bf0('0x1e')](handleError(_0xd3611c));};exports['calls']=function(_0x1f3df3,_0x5150c0){logger[_0x4bf0('0x2a')](_0x4bf0('0x40'),_0x5150c0[_0x4bf0('0x2c')]);var _0x311ad4=callsValidation[_0x4bf0('0xb')](_0x1f3df3['body']);if(_0x311ad4['length']>0x0){return _0x5150c0[_0x4bf0('0x17')](0x190)['json'](_0x311ad4);}var _0x3c26b5=_0x1f3df3['body']['userId'];var _0x2a4550=respondWithRpcPromise('VoiceChannels');var _0x560064=getAgent(_0x3c26b5);return Promise[_0x4bf0('0x22')]([_0x2a4550,_0x560064])['then'](function(_0x243527){var _0x293ff0=_0x243527[0x0];var _0x502bfa=_0x243527[0x1];var _0x57b45f=_[_0x4bf0('0x23')](_0x293ff0[_0x4bf0('0x24')],function(_0xbf04f7){return _0xbf04f7['UserId']==_0x502bfa['id'];});return _0x5150c0[_0x4bf0('0x17')](0xc8)[_0x4bf0('0x33')]({'count':_0x57b45f[_0x4bf0('0x27')],'rows':_0x57b45f});})['catch'](handleError(_0x5150c0));};exports[_0x4bf0('0x41')]=function(_0x1a625a,_0x3d4863){logger[_0x4bf0('0x2a')](_0x4bf0('0x42'),_0x1a625a[_0x4bf0('0x2c')]);var _0x3a1b0b=conferenceValidation[_0x4bf0('0xb')](_0x1a625a['body']);if(_0x3a1b0b['length']>0x0){return _0x3d4863[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x3a1b0b);}var _0x33834c=_0x1a625a[_0x4bf0('0x2c')][_0x4bf0('0x2d')];return getAgent(_0x33834c)['then'](function(_0x164288){logger[_0x4bf0('0x2a')](_0x4bf0('0x30'),_0x164288['name']);emit(util[_0x4bf0('0x31')](_0x4bf0('0x32'),_0x164288['name']),_0x4bf0('0x43'));return _0x3d4863[_0x4bf0('0x17')](0xc8)['json']({'error':![],'message':_0x4bf0('0x44')});})[_0x4bf0('0x1e')](handleError(_0x3d4863));};exports[_0x4bf0('0x45')]=function(_0x4ec516,_0x23afd1){logger[_0x4bf0('0x2a')](_0x4bf0('0x46'),_0x4ec516[_0x4bf0('0x2c')]);var _0x2cdee4=transferValidation[_0x4bf0('0xb')](_0x4ec516['body']);if(_0x2cdee4['length']>0x0){return _0x23afd1[_0x4bf0('0x17')](0x190)[_0x4bf0('0x33')](_0x2cdee4);}var _0x531808=_0x4ec516[_0x4bf0('0x2c')][_0x4bf0('0x2d')];var _0x37aef7=_0x4ec516[_0x4bf0('0x2c')][_0x4bf0('0x26')];var _0x1d8843=_0x4ec516[_0x4bf0('0x2c')]['transferNumber'];return getAgent(_0x531808)[_0x4bf0('0x1a')](function(_0x3ba6c5){logger[_0x4bf0('0x2a')]('entityFound:',_0x3ba6c5['name']);emit(util['format'](_0x4bf0('0x32'),_0x3ba6c5[_0x4bf0('0x16')]),_0x4bf0('0x47'),{'sessionId':_0x37aef7,'transferNumber':_0x1d8843});return _0x23afd1['status'](0xc8)[_0x4bf0('0x33')]({'error':![],'message':_0x4bf0('0x48')});})[_0x4bf0('0x1e')](handleError(_0x23afd1));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c98e1da..2d77bfc 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 _0xed3c=['/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer'];(function(_0x2103ac,_0x5cf6e6){var _0x47c8ea=function(_0x47b25e){while(--_0x47b25e){_0x2103ac['push'](_0x2103ac['shift']());}};_0x47c8ea(++_0x5cf6e6);}(_0xed3c,0x1a6));var _0xced3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xed3c[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var auth=require(_0xced3('0x5'));var interaction=require(_0xced3('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xced3('0x7')]('/',auth[_0xced3('0x8')](),controller[_0xced3('0x9')]);router[_0xced3('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xced3('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xced3('0x7')](_0xced3('0xa'),auth[_0xced3('0x8')](),controller[_0xced3('0xb')]);router[_0xced3('0x7')]('/:id/canned_answers',auth[_0xced3('0x8')](),controller[_0xced3('0xc')]);router[_0xced3('0x7')]('/:id/users',auth[_0xced3('0x8')](),controller[_0xced3('0xd')]);router[_0xced3('0x7')](_0xced3('0xe'),auth[_0xced3('0x8')](),controller[_0xced3('0xf')]);router[_0xced3('0x10')]('/',auth['isAuthenticated'](),controller[_0xced3('0x11')]);router['post'](_0xced3('0xa'),auth[_0xced3('0x8')](),controller[_0xced3('0x12')]);router[_0xced3('0x10')]('/:id/canned_answers',auth[_0xced3('0x8')](),controller[_0xced3('0x13')]);router['post'](_0xced3('0x14'),auth[_0xced3('0x8')](),controller[_0xced3('0x15')]);router[_0xced3('0x10')]('/:id/applications',auth[_0xced3('0x8')](),controller['addApplications']);router[_0xced3('0x10')](_0xced3('0x16'),controller[_0xced3('0x17')]);router[_0xced3('0x10')](_0xced3('0x18'),auth[_0xced3('0x8')](),controller[_0xced3('0x19')]);router[_0xced3('0x1a')](_0xced3('0x1b'),auth[_0xced3('0x8')](),controller[_0xced3('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xced3('0x1d')]);router[_0xced3('0x1e')](_0xced3('0xa'),auth['isAuthenticated'](),controller[_0xced3('0x1f')]);router[_0xced3('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xced3('0x20')]);router[_0xced3('0x1e')](_0xced3('0x14'),auth[_0xced3('0x8')](),controller['removeAgents']);module[_0xced3('0x21')]=router; \ No newline at end of file +var _0xe1e3=['/:id/applications','addApplications','/:id/notify','send','put','delete','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','create','post','/:id/dispositions','addAnswer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x12bfb4,_0x21b6d9){_0x12bfb4=_0x12bfb4-0x0;var _0x41ec50=_0xe1e3[_0x12bfb4];return _0x41ec50;};'use strict';var multer=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var path=require('path');var timeout=require(_0x3e1e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3e1e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3e1e('0x4'));var controller=require(_0x3e1e('0x5'));router[_0x3e1e('0x6')]('/',auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x8')]);router[_0x3e1e('0x6')]('/describe',auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x9')]);router[_0x3e1e('0x6')](_0x3e1e('0xa'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0xb')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3e1e('0xc')]);router['get'](_0x3e1e('0xd'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0xe')]);router['get'](_0x3e1e('0xf'),auth['isAuthenticated'](),controller['getAgents']);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x3e1e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3e1e('0x11')]);router[_0x3e1e('0x12')](_0x3e1e('0x13'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x3e1e('0x12')](_0x3e1e('0xd'),auth['isAuthenticated'](),controller[_0x3e1e('0x14')]);router[_0x3e1e('0x12')]('/:id/users',auth[_0x3e1e('0x7')](),controller['addAgents']);router[_0x3e1e('0x12')](_0x3e1e('0x15'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x16')]);router[_0x3e1e('0x12')](_0x3e1e('0x17'),controller['notify']);router['post']('/:id/send',auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x18')]);router[_0x3e1e('0x19')]('/:id',auth[_0x3e1e('0x7')](),controller['update']);router[_0x3e1e('0x1a')](_0x3e1e('0xa'),auth[_0x3e1e('0x7')](),controller['destroy']);router[_0x3e1e('0x1a')](_0x3e1e('0x13'),auth[_0x3e1e('0x7')](),controller['removeDispositions']);router['delete'](_0x3e1e('0xd'),auth[_0x3e1e('0x7')](),controller['removeAnswers']);router[_0x3e1e('0x1a')](_0x3e1e('0xf'),auth[_0x3e1e('0x7')](),controller[_0x3e1e('0x1b')]);module[_0x3e1e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1b176a3..6a2105a 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 _0x238b=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','BOOLEAN'];(function(_0x2859a9,_0x4f3d52){var _0x211886=function(_0x25bbed){while(--_0x25bbed){_0x2859a9['push'](_0x2859a9['shift']());}};_0x211886(++_0x4f3d52);}(_0x238b,0x1e4));var _0xb238=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x238b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb238('0x0'));module[_0xb238('0x1')]={'name':{'type':Sequelize[_0xb238('0x2')],'unique':_0xb238('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb238('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xb238('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xb238('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xb238('0x2')]},'type':{'type':Sequelize[_0xb238('0x4')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb238('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb238('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb238('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb238('0x6')],'comment':_0xb238('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb238('0x8'),'set':function(_0x342317){if(!_0x342317){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xb238('0x9'),_0x342317);}},'description':{'type':Sequelize[_0xb238('0x2')]}}; \ No newline at end of file +var _0x8a5c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8a5c,0x103));var _0xc8a5=function(_0xb6c692,_0x4faa5e){_0xb6c692=_0xb6c692-0x0;var _0x16b7f0=_0x8a5c[_0xb6c692];return _0x16b7f0;};'use strict';var Sequelize=require(_0xc8a5('0x0'));var rs=require(_0xc8a5('0x1'));module[_0xc8a5('0x2')]={'name':{'type':Sequelize[_0xc8a5('0x3')],'unique':_0xc8a5('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xc8a5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc8a5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc8a5('0x3')],'defaultValue':function(){return rs[_0xc8a5('0x5')]();}},'phone':{'type':Sequelize[_0xc8a5('0x3')]},'type':{'type':Sequelize[_0xc8a5('0x6')](_0xc8a5('0x7'))},'accountSid':{'type':Sequelize[_0xc8a5('0x3')]},'authToken':{'type':Sequelize[_0xc8a5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc8a5('0x8')],'defaultValue':function(){return _0xc8a5('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc8a5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc8a5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc8a5('0xb')],'comment':_0xc8a5('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xc8a5('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x57562f){if(!_0x57562f){this[_0xc8a5('0xd')](_0xc8a5('0xe'),null);}this[_0xc8a5('0xd')]('mandatoryDisposition',_0x57562f);}},'description':{'type':Sequelize[_0xc8a5('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 09be626..ffc3f17 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 _0x1ae9=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappAccount.socket','register','client','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','get','WhatsappAccounts','UserProfileResource','destroy','then','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','show','params','intersection','length','includeAll','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','rawAttributes','WhatsappAccountId','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','updatedAt','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','WhatsappMessage','messageId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5072e5,_0x16ce32){var _0x423130=function(_0x2a15ea){while(--_0x2a15ea){_0x5072e5['push'](_0x5072e5['shift']());}};_0x423130(++_0x16ce32);}(_0x1ae9,0xa5));var _0x91ae=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x1ae9[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x91ae('0x0'));var emlformat=require(_0x91ae('0x1'));var rimraf=require(_0x91ae('0x2'));var zipdir=require(_0x91ae('0x3'));var jsonpatch=require(_0x91ae('0x4'));var rp=require(_0x91ae('0x5'));var moment=require(_0x91ae('0x6'));var BPromise=require(_0x91ae('0x7'));var Mustache=require(_0x91ae('0x8'));var util=require(_0x91ae('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x91ae('0xa'));var ejs=require(_0x91ae('0xb'));var fs=require('fs');var _=require(_0x91ae('0xc'));var squel=require(_0x91ae('0xd'));var crypto=require(_0x91ae('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x91ae('0xa'));var querystring=require(_0x91ae('0xf'));var Papa=require(_0x91ae('0x10'));var Redis=require(_0x91ae('0x11'));var authService=require(_0x91ae('0x12'));var qs=require(_0x91ae('0x13'));var as=require(_0x91ae('0x14'));var hardwareService=require(_0x91ae('0x15'));var logger=require('../../config/logger')(_0x91ae('0x16'));var utils=require(_0x91ae('0x17'));var config=require(_0x91ae('0x18'));var licenseUtil=require(_0x91ae('0x19'));var db=require('../../mysqldb')['db'];config[_0x91ae('0x1a')]=_[_0x91ae('0x1b')](config[_0x91ae('0x1a')],{'host':_0x91ae('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91ae('0x1a')]));require(_0x91ae('0x1d'))[_0x91ae('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x91ae('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x38d112,_0x2d1fcb,_0x54d20b,_0x521b73){return new BPromise(function(_0x442f12,_0x7858c8){var _0x692ce9=_0x521b73||client;return _0x692ce9[_0x91ae('0x20')](_0x38d112,_0x54d20b)['then'](function(_0xc58ac1){logger[_0x91ae('0x21')](_0x91ae('0x22'),_0x2d1fcb,_0x91ae('0x23'));logger[_0x91ae('0x24')](_0x91ae('0x25'),_0x2d1fcb,_0x91ae('0x23'),JSON['stringify'](_0xc58ac1));if(_0xc58ac1[_0x91ae('0x26')]){if(_0xc58ac1['error']['code']===0x1f4){logger[_0x91ae('0x26')](_0x91ae('0x22'),_0x2d1fcb,_0xc58ac1[_0x91ae('0x26')][_0x91ae('0x27')]);return _0x7858c8(_0xc58ac1[_0x91ae('0x26')][_0x91ae('0x27')]);}logger[_0x91ae('0x26')](_0x91ae('0x22'),_0x2d1fcb,_0xc58ac1[_0x91ae('0x26')]['message']);return _0x442f12(_0xc58ac1[_0x91ae('0x26')][_0x91ae('0x27')]);}else{logger[_0x91ae('0x21')](_0x91ae('0x22'),_0x2d1fcb,_0x91ae('0x23'));_0x442f12(_0xc58ac1[_0x91ae('0x28')]['message']);}})[_0x91ae('0x29')](function(_0x48ac35){logger['error'](_0x91ae('0x22'),_0x2d1fcb,_0x48ac35);_0x7858c8(_0x48ac35);});});}function respondWithStatusCode(_0x228490,_0x42a80d){_0x42a80d=_0x42a80d||0xcc;return function(_0x58d205){if(_0x58d205){return _0x228490['sendStatus'](_0x42a80d);}return _0x228490[_0x91ae('0x2a')](_0x42a80d)[_0x91ae('0x2b')]();};}function respondWithResult(_0x18abb9,_0x5373ae){_0x5373ae=_0x5373ae||0xc8;return function(_0x5d2ac2){if(_0x5d2ac2){return _0x18abb9[_0x91ae('0x2a')](_0x5373ae)['json'](_0x5d2ac2);}};}function respondWithFilteredResult(_0x30cafc,_0x259606){return function(_0x3936d3){if(_0x3936d3){var _0x761c46=_0x3936d3[_0x91ae('0x2c')],_0x49cb29=_0x259606['offset'],_0x57577a=_0x259606[_0x91ae('0x2d')]+_0x259606[_0x91ae('0x2e')],_0x1a7ac1;if(_0x57577a>=_0x761c46){_0x57577a=_0x761c46;_0x1a7ac1=0xc8;}else{_0x1a7ac1=0xce;}_0x30cafc[_0x91ae('0x2a')](_0x1a7ac1);return _0x30cafc[_0x91ae('0x2f')](_0x91ae('0x30'),_0x49cb29+'-'+_0x57577a+'/'+_0x761c46)[_0x91ae('0x31')](_0x3936d3);}return null;};}function patchUpdates(_0x41e1c5){return function(_0x817f15){try{jsonpatch[_0x91ae('0x32')](_0x817f15,_0x41e1c5,!![]);}catch(_0x1daad1){return BPromise[_0x91ae('0x33')](_0x1daad1);}return _0x817f15['save']();};}function saveUpdates(_0x581cf2,_0x45ebba){return function(_0x2c4bb5){if(_0x2c4bb5){return _0x2c4bb5[_0x91ae('0x34')](_0x581cf2)['then'](function(_0x2cf990){return _0x2cf990;});}return null;};}function removeEntity(_0x39fcde,_0x56b92f){return function(_0x159826){if(_0x159826){return _0x159826['destroy']()['then'](function(){var _0x3d98b0=_0x159826[_0x91ae('0x35')]({'plain':!![]});var _0x1df1dc=_0x91ae('0x36');return db[_0x91ae('0x37')][_0x91ae('0x38')]({'where':{'type':_0x1df1dc,'resourceId':_0x3d98b0['id']}})[_0x91ae('0x39')](function(){return _0x159826;});})[_0x91ae('0x39')](function(){_0x39fcde[_0x91ae('0x2a')](0xcc)[_0x91ae('0x2b')]();});}};}function handleEntityNotFound(_0x2de8ca,_0x1362e4){return function(_0x139097){if(!_0x139097){_0x2de8ca['sendStatus'](0x194);}return _0x139097;};}function handleError(_0x590902,_0x591e62){_0x591e62=_0x591e62||0x1f4;return function(_0xb19e30){logger[_0x91ae('0x26')](_0xb19e30['stack']);if(_0xb19e30[_0x91ae('0x3a')]){delete _0xb19e30[_0x91ae('0x3a')];}_0x590902[_0x91ae('0x2a')](_0x591e62)[_0x91ae('0x3b')](_0xb19e30);};}exports[_0x91ae('0x3c')]=function(_0xda71cb,_0x8d6d28){var _0x53e0b2={'include':[{'model':db[_0x91ae('0x3d')],'as':_0x91ae('0x3e')}]},_0x29ddf0={},_0x45be77={'count':0x0,'rows':[]};var _0x454a31=_['map'](db[_0x91ae('0x3f')]['rawAttributes'],function(_0x6b05d9){return{'name':_0x6b05d9[_0x91ae('0x40')],'type':_0x6b05d9[_0x91ae('0x41')][_0x91ae('0x42')]};});_0x29ddf0['model']=_['map'](_0x454a31,_0x91ae('0x3a'));_0x29ddf0[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0xda71cb[_0x91ae('0x43')]);_0x29ddf0[_0x91ae('0x45')]=_['intersection'](_0x29ddf0[_0x91ae('0x46')],_0x29ddf0[_0x91ae('0x43')]);_0x53e0b2['attributes']=_['intersection'](_0x29ddf0['model'],qs[_0x91ae('0x47')](_0xda71cb['query'][_0x91ae('0x47')]));_0x53e0b2[_0x91ae('0x48')]=_0x53e0b2[_0x91ae('0x48')]['length']?_0x53e0b2[_0x91ae('0x48')]:_0x29ddf0[_0x91ae('0x46')];if(!_0xda71cb[_0x91ae('0x43')][_0x91ae('0x49')](_0x91ae('0x4a'))){_0x53e0b2[_0x91ae('0x2e')]=qs['limit'](_0xda71cb[_0x91ae('0x43')][_0x91ae('0x2e')]);_0x53e0b2[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0xda71cb[_0x91ae('0x43')]['offset']);}_0x53e0b2[_0x91ae('0x4b')]=qs[_0x91ae('0x4c')](_0xda71cb[_0x91ae('0x43')][_0x91ae('0x4c')]);_0x53e0b2[_0x91ae('0x4d')]=qs[_0x91ae('0x45')](_[_0x91ae('0x4e')](_0xda71cb[_0x91ae('0x43')],_0x29ddf0[_0x91ae('0x45')]),_0x454a31);if(_0xda71cb['query']['filter']){_0x53e0b2[_0x91ae('0x4d')]=_[_0x91ae('0x4f')](_0x53e0b2[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0x454a31,function(_0x162924){if(_0x162924[_0x91ae('0x41')]!==_0x91ae('0x51')){var _0x325d9f={};_0x325d9f[_0x162924[_0x91ae('0x3a')]]={'$like':'%'+_0xda71cb[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x325d9f;}})});}_0x53e0b2=_[_0x91ae('0x4f')]({},_0x53e0b2,_0xda71cb[_0x91ae('0x53')]);var _0x5f3bf4={'where':_0x53e0b2['where']};return db[_0x91ae('0x3f')][_0x91ae('0x2c')](_0x5f3bf4)['then'](function(_0x586e95){_0x45be77[_0x91ae('0x2c')]=_0x586e95;if(_0xda71cb[_0x91ae('0x43')]['includeAll']){_0x53e0b2[_0x91ae('0x54')]=[{'all':!![]}];}return db[_0x91ae('0x3f')][_0x91ae('0x55')](_0x53e0b2);})[_0x91ae('0x39')](function(_0x2c3009){_0x45be77[_0x91ae('0x56')]=_0x2c3009;return _0x45be77;})['then'](respondWithFilteredResult(_0x8d6d28,_0x53e0b2))[_0x91ae('0x29')](handleError(_0x8d6d28,null));};exports[_0x91ae('0x57')]=function(_0x4c970f,_0x48cbc2){var _0x28b7ad={'raw':![],'where':{'id':_0x4c970f[_0x91ae('0x58')]['id']},'include':[{'model':db[_0x91ae('0x3d')],'as':_0x91ae('0x3e')}]},_0x3919b8={};_0x3919b8['model']=_['keys'](db[_0x91ae('0x3f')]['rawAttributes']);_0x3919b8[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x4c970f[_0x91ae('0x43')]);_0x3919b8[_0x91ae('0x45')]=_[_0x91ae('0x59')](_0x3919b8[_0x91ae('0x46')],_0x3919b8[_0x91ae('0x43')]);_0x28b7ad[_0x91ae('0x48')]=_[_0x91ae('0x59')](_0x3919b8[_0x91ae('0x46')],qs['fields'](_0x4c970f[_0x91ae('0x43')]['fields']));_0x28b7ad['attributes']=_0x28b7ad['attributes'][_0x91ae('0x5a')]?_0x28b7ad[_0x91ae('0x48')]:_0x3919b8[_0x91ae('0x46')];if(_0x4c970f[_0x91ae('0x43')][_0x91ae('0x5b')]){_0x28b7ad[_0x91ae('0x54')]=[{'all':!![]}];}_0x28b7ad=_[_0x91ae('0x4f')]({},_0x28b7ad,_0x4c970f['options']);return db[_0x91ae('0x3f')]['find'](_0x28b7ad)[_0x91ae('0x39')](handleEntityNotFound(_0x48cbc2,null))[_0x91ae('0x39')](respondWithResult(_0x48cbc2,null))[_0x91ae('0x29')](handleError(_0x48cbc2,null));};exports[_0x91ae('0x5c')]=function(_0x31b2fb,_0x266131){return db[_0x91ae('0x3f')]['create'](_0x31b2fb[_0x91ae('0x5d')],{})[_0x91ae('0x39')](function(_0x2ad265){var _0x5bc8fe=_0x31b2fb[_0x91ae('0x5e')][_0x91ae('0x35')]({'plain':!![]});if(!_0x5bc8fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bc8fe[_0x91ae('0x5f')]===_0x91ae('0x5e')){var _0x36fb05=_0x2ad265[_0x91ae('0x35')]({'plain':!![]});var _0x6284d1=_0x91ae('0x36');return db[_0x91ae('0x60')][_0x91ae('0x61')]({'where':{'name':_0x6284d1,'userProfileId':_0x5bc8fe['userProfileId']},'raw':!![]})[_0x91ae('0x39')](function(_0x5e1c21){if(_0x5e1c21&&_0x5e1c21[_0x91ae('0x62')]===0x0){return db[_0x91ae('0x37')][_0x91ae('0x5c')]({'name':_0x36fb05[_0x91ae('0x3a')],'resourceId':_0x36fb05['id'],'type':_0x5e1c21['name'],'sectionId':_0x5e1c21['id']},{})[_0x91ae('0x39')](function(){return _0x2ad265;});}else{return _0x2ad265;}})['catch'](function(_0x44c2aa){logger['error'](_0x91ae('0x63'),_0x44c2aa);throw _0x44c2aa;});}return _0x2ad265;})[_0x91ae('0x39')](respondWithResult(_0x266131,0xc9))[_0x91ae('0x29')](handleError(_0x266131,null));};exports[_0x91ae('0x34')]=function(_0x157bb2,_0x4cacd1){if(_0x157bb2['body']['id']){delete _0x157bb2[_0x91ae('0x5d')]['id'];}return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x157bb2[_0x91ae('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x91ae('0x39')](handleEntityNotFound(_0x4cacd1,null))[_0x91ae('0x39')](saveUpdates(_0x157bb2[_0x91ae('0x5d')],null))[_0x91ae('0x39')](respondWithResult(_0x4cacd1,null))[_0x91ae('0x29')](handleError(_0x4cacd1,null));};exports['destroy']=function(_0x7ecb03,_0x376b87){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x7ecb03['params']['id']}})['then'](handleEntityNotFound(_0x376b87,null))[_0x91ae('0x39')](removeEntity(_0x376b87,null))[_0x91ae('0x29')](handleError(_0x376b87,null));};exports[_0x91ae('0x64')]=function(_0x19f1c6,_0x301bfb){return db['WhatsappAccount'][_0x91ae('0x64')]()['then'](respondWithResult(_0x301bfb,null))[_0x91ae('0x29')](handleError(_0x301bfb,null));};exports[_0x91ae('0x65')]=function(_0x491339,_0x56543c,_0x18ffee){if(_0x491339[_0x91ae('0x5d')]['id']){delete _0x491339['body']['id'];}return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x491339[_0x91ae('0x58')]['id']}})['then'](handleEntityNotFound(_0x56543c,null))[_0x91ae('0x39')](function(_0x1c1f19){if(_0x1c1f19){_0x491339[_0x91ae('0x5d')]['WhatsappAccountId']=_0x1c1f19['id'];return db[_0x91ae('0x66')][_0x91ae('0x5c')](_0x491339[_0x91ae('0x5d')]);}})[_0x91ae('0x39')](respondWithResult(_0x56543c,null))[_0x91ae('0x29')](handleError(_0x56543c,null));};exports[_0x91ae('0x67')]=function(_0x3d19d0,_0x16398c,_0x3d2fb0){var _0x402bb8={'raw':![],'where':{}};var _0x467e16={};var _0x31d2d6={'count':0x0,'rows':[]};return db[_0x91ae('0x3f')]['findOne']({'where':{'id':_0x3d19d0['params']['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x16398c,null))[_0x91ae('0x39')](function(_0x1c080c){if(_0x1c080c){_0x467e16[_0x91ae('0x46')]=_[_0x91ae('0x44')](db['Disposition'][_0x91ae('0x68')]);_0x467e16[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x3d19d0['query']);_0x467e16['filters']=_[_0x91ae('0x59')](_0x467e16['model'],_0x467e16['query']);_0x402bb8[_0x91ae('0x48')]=_[_0x91ae('0x59')](_0x467e16['model'],qs[_0x91ae('0x47')](_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x47')]));_0x402bb8[_0x91ae('0x48')]=_0x402bb8[_0x91ae('0x48')]['length']?_0x402bb8[_0x91ae('0x48')]:_0x467e16[_0x91ae('0x46')];if(!_0x3d19d0[_0x91ae('0x43')]['hasOwnProperty'](_0x91ae('0x4a'))){_0x402bb8[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x2e')]);_0x402bb8[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0x3d19d0['query']['offset']);}_0x402bb8[_0x91ae('0x4b')]=qs[_0x91ae('0x4c')](_0x3d19d0['query']['sort']);_0x402bb8[_0x91ae('0x4d')]=qs[_0x91ae('0x45')](_['pick'](_0x3d19d0[_0x91ae('0x43')],_0x467e16['filters']));_0x402bb8['where'][_0x91ae('0x69')]=_0x1c080c['id'];if(_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x52')]){_0x402bb8['where']=_[_0x91ae('0x4f')](_0x402bb8[_0x91ae('0x4d')],{'$or':_['map'](_0x402bb8[_0x91ae('0x48')],function(_0x538484){var _0x296503={};_0x296503[_0x538484]={'$like':'%'+_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x296503;})});}_0x402bb8=_['merge']({},_0x402bb8,_0x3d19d0[_0x91ae('0x53')]);return db[_0x91ae('0x66')]['count']({'where':_0x402bb8[_0x91ae('0x4d')]})[_0x91ae('0x39')](function(_0x31e8cc){_0x31d2d6[_0x91ae('0x2c')]=_0x31e8cc;if(_0x3d19d0['query'][_0x91ae('0x5b')]){_0x402bb8[_0x91ae('0x54')]=[{'all':!![]}];}return db[_0x91ae('0x66')]['findAll'](_0x402bb8);})['then'](function(_0x3202c0){_0x31d2d6[_0x91ae('0x56')]=_0x3202c0;return _0x31d2d6;});}})[_0x91ae('0x39')](respondWithFilteredResult(_0x16398c,_0x402bb8))[_0x91ae('0x29')](handleError(_0x16398c,null));};exports[_0x91ae('0x6a')]=function(_0x40832e,_0x145dd7,_0x3861ef){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x40832e[_0x91ae('0x58')]['id']}})['then'](handleEntityNotFound(_0x145dd7,null))['then'](function(_0x374577){if(_0x374577){return _0x374577[_0x91ae('0x6a')](_0x40832e[_0x91ae('0x43')][_0x91ae('0x6b')]);}})['then'](respondWithStatusCode(_0x145dd7,null))['catch'](handleError(_0x145dd7,null));};exports['addAnswer']=function(_0x2b8c40,_0x148b45,_0x3f290e){if(_0x2b8c40[_0x91ae('0x5d')]['id']){delete _0x2b8c40[_0x91ae('0x5d')]['id'];}return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x2b8c40[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x148b45,null))[_0x91ae('0x39')](function(_0x55425b){if(_0x55425b){_0x2b8c40['body'][_0x91ae('0x69')]=_0x55425b['id'];return db[_0x91ae('0x6c')][_0x91ae('0x5c')](_0x2b8c40['body']);}})['then'](respondWithResult(_0x148b45,null))[_0x91ae('0x29')](handleError(_0x148b45,null));};exports['getAnswers']=function(_0x524861,_0x5227f2,_0x2ddb3b){var _0xe9684e={'raw':![],'where':{}};var _0x39bf9e={};var _0x51f8a9={'count':0x0,'rows':[]};return db[_0x91ae('0x3f')][_0x91ae('0x6d')]({'where':{'id':_0x524861[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x5227f2,null))[_0x91ae('0x39')](function(_0x1d9ef3){if(_0x1d9ef3){_0x39bf9e[_0x91ae('0x46')]=_[_0x91ae('0x44')](db[_0x91ae('0x6c')][_0x91ae('0x68')]);_0x39bf9e['query']=_[_0x91ae('0x44')](_0x524861[_0x91ae('0x43')]);_0x39bf9e['filters']=_[_0x91ae('0x59')](_0x39bf9e[_0x91ae('0x46')],_0x39bf9e[_0x91ae('0x43')]);_0xe9684e[_0x91ae('0x48')]=_[_0x91ae('0x59')](_0x39bf9e['model'],qs[_0x91ae('0x47')](_0x524861['query'][_0x91ae('0x47')]));_0xe9684e[_0x91ae('0x48')]=_0xe9684e[_0x91ae('0x48')]['length']?_0xe9684e['attributes']:_0x39bf9e['model'];if(!_0x524861[_0x91ae('0x43')][_0x91ae('0x49')](_0x91ae('0x4a'))){_0xe9684e[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x524861[_0x91ae('0x43')][_0x91ae('0x2e')]);_0xe9684e[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0x524861[_0x91ae('0x43')][_0x91ae('0x2d')]);}_0xe9684e[_0x91ae('0x4b')]=qs['sort'](_0x524861[_0x91ae('0x43')]['sort']);_0xe9684e[_0x91ae('0x4d')]=qs[_0x91ae('0x45')](_[_0x91ae('0x4e')](_0x524861['query'],_0x39bf9e[_0x91ae('0x45')]));_0xe9684e['where'][_0x91ae('0x69')]=_0x1d9ef3['id'];if(_0x524861['query']['filter']){_0xe9684e['where']=_[_0x91ae('0x4f')](_0xe9684e[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0xe9684e[_0x91ae('0x48')],function(_0x4f8c87){var _0x1adb08={};_0x1adb08[_0x4f8c87]={'$like':'%'+_0x524861[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x1adb08;})});}_0xe9684e=_['merge']({},_0xe9684e,_0x524861[_0x91ae('0x53')]);return db[_0x91ae('0x6c')][_0x91ae('0x2c')]({'where':_0xe9684e[_0x91ae('0x4d')]})[_0x91ae('0x39')](function(_0x364cb5){_0x51f8a9[_0x91ae('0x2c')]=_0x364cb5;if(_0x524861[_0x91ae('0x43')][_0x91ae('0x5b')]){_0xe9684e[_0x91ae('0x54')]=[{'all':!![]}];}return db[_0x91ae('0x6c')][_0x91ae('0x55')](_0xe9684e);})[_0x91ae('0x39')](function(_0x190225){_0x51f8a9[_0x91ae('0x56')]=_0x190225;return _0x51f8a9;});}})['then'](respondWithFilteredResult(_0x5227f2,_0xe9684e))[_0x91ae('0x29')](handleError(_0x5227f2,null));};exports[_0x91ae('0x6e')]=function(_0x370fab,_0x28ba8a,_0x5da5bf){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x370fab[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x28ba8a,null))[_0x91ae('0x39')](function(_0x36f1e4){if(_0x36f1e4){return _0x36f1e4[_0x91ae('0x6e')](_0x370fab[_0x91ae('0x43')]['ids']);}})[_0x91ae('0x39')](respondWithStatusCode(_0x28ba8a,null))[_0x91ae('0x29')](handleError(_0x28ba8a,null));};exports['addAgents']=function(_0x57d180,_0x2a4edf,_0x59e421){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x57d180['params']['id']}})['then'](handleEntityNotFound(_0x2a4edf,null))[_0x91ae('0x39')](function(_0x187a9a){if(_0x187a9a){return _0x187a9a['addAgents'](_0x57d180[_0x91ae('0x5d')][_0x91ae('0x6b')],_['omit'](_0x57d180[_0x91ae('0x5d')],[_0x91ae('0x6b'),'id'])||{})[_0x91ae('0x6f')](function(_0x4e90ff){for(var _0x4fb947=0x0;_0x4fb947<_0x57d180['body'][_0x91ae('0x6b')][_0x91ae('0x5a')];_0x4fb947+=0x1){socket[_0x91ae('0x70')]('userWhatsappAccount:save',{'UserId':_0x57d180[_0x91ae('0x5d')][_0x91ae('0x6b')][_0x4fb947],'WhatsappAccountId':_0x57d180[_0x91ae('0x58')]['id']});}return _0x4e90ff;});}})['then'](respondWithResult(_0x2a4edf,null))[_0x91ae('0x29')](handleError(_0x2a4edf,null));};exports[_0x91ae('0x71')]=function(_0x3717ae,_0xa7a121,_0x8a72d1){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x3717ae['params']['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0xa7a121,null))[_0x91ae('0x39')](function(_0x1915e6){if(_0x1915e6){return _0x1915e6[_0x91ae('0x71')](_0x3717ae[_0x91ae('0x43')]['ids'])[_0x91ae('0x39')](function(){if(_[_0x91ae('0x72')](_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')])){for(var _0x20b0c8=0x0;_0x20b0c8<_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')][_0x91ae('0x5a')];_0x20b0c8+=0x1){socket[_0x91ae('0x70')](_0x91ae('0x73'),{'UserId':Number(_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')][_0x20b0c8]),'WhatsappAccountId':Number(_0x3717ae[_0x91ae('0x58')]['id'])});}}else{socket[_0x91ae('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')]),'WhatsappAccountId':Number(_0x3717ae['params']['id'])});}});}})['then'](respondWithStatusCode(_0xa7a121,null))[_0x91ae('0x29')](handleError(_0xa7a121,null));};exports[_0x91ae('0x74')]=function(_0x359d8c,_0x10ff91,_0x13cd8b){var _0x4c8a34={};var _0x2f5ffc={};var _0x275acf;var _0x25d011;return db[_0x91ae('0x3f')]['findOne']({'where':{'id':_0x359d8c[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x10ff91,null))[_0x91ae('0x39')](function(_0x5923bd){if(_0x5923bd){_0x275acf=_0x5923bd;_0x2f5ffc[_0x91ae('0x46')]=_[_0x91ae('0x44')](db[_0x91ae('0x75')][_0x91ae('0x68')]);_0x2f5ffc[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x359d8c['query']);_0x2f5ffc[_0x91ae('0x45')]=_['intersection'](_0x2f5ffc[_0x91ae('0x46')],_0x2f5ffc[_0x91ae('0x43')]);_0x4c8a34[_0x91ae('0x48')]=_['intersection'](_0x2f5ffc['model'],qs['fields'](_0x359d8c[_0x91ae('0x43')][_0x91ae('0x47')]));_0x4c8a34[_0x91ae('0x48')]=_0x4c8a34[_0x91ae('0x48')][_0x91ae('0x5a')]?_0x4c8a34['attributes']:_0x2f5ffc[_0x91ae('0x46')];_0x4c8a34['order']=qs[_0x91ae('0x4c')](_0x359d8c[_0x91ae('0x43')]['sort']);_0x4c8a34['where']=qs['filters'](_[_0x91ae('0x4e')](_0x359d8c[_0x91ae('0x43')],_0x2f5ffc['filters']));if(_0x359d8c['query'][_0x91ae('0x52')]){_0x4c8a34[_0x91ae('0x4d')]=_['merge'](_0x4c8a34[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0x4c8a34[_0x91ae('0x48')],function(_0x44d115){var _0x6df52f={};_0x6df52f[_0x44d115]={'$like':'%'+_0x359d8c[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x6df52f;})});}_0x4c8a34=_[_0x91ae('0x4f')]({},_0x4c8a34,_0x359d8c[_0x91ae('0x53')]);return _0x275acf[_0x91ae('0x74')](_0x4c8a34);}})[_0x91ae('0x39')](function(_0x1ed26f){if(_0x1ed26f){_0x25d011=_0x1ed26f[_0x91ae('0x5a')];if(!_0x359d8c['query'][_0x91ae('0x49')](_0x91ae('0x4a'))){_0x4c8a34[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x359d8c[_0x91ae('0x43')]['limit']);_0x4c8a34[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0x359d8c['query'][_0x91ae('0x2d')]);}return _0x275acf[_0x91ae('0x74')](_0x4c8a34);}})['then'](function(_0x41b5b9){if(_0x41b5b9){return _0x41b5b9?{'count':_0x25d011,'rows':_0x41b5b9}:null;}})['then'](respondWithResult(_0x10ff91,null))[_0x91ae('0x29')](handleError(_0x10ff91,null));};exports[_0x91ae('0x76')]=function(_0x16422a,_0x228b65,_0x4e34ab){return db[_0x91ae('0x3f')][_0x91ae('0x6d')]({'where':{'id':_0x16422a['params']['id']}})['then'](handleEntityNotFound(_0x228b65,null))[_0x91ae('0x39')](function(_0x6cbc4f){if(_0x6cbc4f){return db[_0x91ae('0x77')]['transaction'](function(_0x23abca){return db[_0x91ae('0x78')][_0x91ae('0x38')]({'where':{'WhatsappAccountId':_0x16422a[_0x91ae('0x58')]['id']},'transaction':_0x23abca})['then'](function(_0x4e1f8c){var _0x35df09=_[_0x91ae('0x50')](_0x16422a[_0x91ae('0x5d')],function(_0x368450){_0x368450[_0x91ae('0x69')]=_0x16422a['params']['id'];return _0x368450;});return db[_0x91ae('0x78')][_0x91ae('0x79')](_0x35df09,{'transaction':_0x23abca});});})[_0x91ae('0x39')](function(){return db[_0x91ae('0x78')][_0x91ae('0x7a')]({'where':{'WhatsappAccountId':_0x16422a['params']['id']},'order':_0x91ae('0x7b')});});}})['then'](respondWithResult(_0x228b65,null))[_0x91ae('0x29')](handleError(_0x228b65,null));};exports[_0x91ae('0x7c')]=function(_0x29511f,_0x5030ad,_0x5de57f){var _0x31ffdc={};var _0xc9a7c5={};var _0x3362e2;var _0x3e8e26;return db[_0x91ae('0x3f')][_0x91ae('0x6d')]({'where':{'id':_0x29511f[_0x91ae('0x58')]['id']}})['then'](handleEntityNotFound(_0x5030ad,null))[_0x91ae('0x39')](function(_0xeed332){if(_0xeed332){_0x3362e2=_0xeed332;_0xc9a7c5[_0x91ae('0x46')]=_[_0x91ae('0x44')](db[_0x91ae('0x78')]['rawAttributes']);_0xc9a7c5[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x29511f[_0x91ae('0x43')]);_0xc9a7c5[_0x91ae('0x45')]=_[_0x91ae('0x59')](_0xc9a7c5[_0x91ae('0x46')],_0xc9a7c5[_0x91ae('0x43')]);_0x31ffdc[_0x91ae('0x48')]=_['intersection'](_0xc9a7c5['model'],qs[_0x91ae('0x47')](_0x29511f[_0x91ae('0x43')][_0x91ae('0x47')]));_0x31ffdc[_0x91ae('0x48')]=_0x31ffdc[_0x91ae('0x48')]['length']?_0x31ffdc[_0x91ae('0x48')]:_0xc9a7c5[_0x91ae('0x46')];_0x31ffdc[_0x91ae('0x4b')]=qs[_0x91ae('0x4c')](_0x29511f['query'][_0x91ae('0x4c')]);_0x31ffdc[_0x91ae('0x4d')]=qs['filters'](_[_0x91ae('0x4e')](_0x29511f[_0x91ae('0x43')],_0xc9a7c5[_0x91ae('0x45')]));if(_0x29511f[_0x91ae('0x43')]['filter']){_0x31ffdc[_0x91ae('0x4d')]=_[_0x91ae('0x4f')](_0x31ffdc[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0x31ffdc[_0x91ae('0x48')],function(_0x16b30c){var _0x4f386b={};_0x4f386b[_0x16b30c]={'$like':'%'+_0x29511f[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x4f386b;})});}_0x31ffdc=_[_0x91ae('0x4f')]({},_0x31ffdc,_0x29511f[_0x91ae('0x53')]);return _0x3362e2[_0x91ae('0x7c')](_0x31ffdc);}})[_0x91ae('0x39')](function(_0x2f2521){if(_0x2f2521){_0x3e8e26=_0x2f2521['length'];if(!_0x29511f[_0x91ae('0x43')][_0x91ae('0x49')](_0x91ae('0x4a'))){_0x31ffdc[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x29511f[_0x91ae('0x43')][_0x91ae('0x2e')]);_0x31ffdc['offset']=qs[_0x91ae('0x2d')](_0x29511f[_0x91ae('0x43')][_0x91ae('0x2d')]);}return _0x3362e2['getApplications'](_0x31ffdc);}})['then'](function(_0x5551c2){if(_0x5551c2){return _0x5551c2?{'count':_0x3e8e26,'rows':_0x5551c2}:null;}})['then'](respondWithResult(_0x5030ad,null))[_0x91ae('0x29')](handleError(_0x5030ad,null));};exports[_0x91ae('0x7d')]=function(_0x354d41,_0x3c94c2,_0x1acbe){var _0x59d2f0={'channel':_0x91ae('0x7e')};var _0x27ae46=[];var _0xb5cf30=[];var _0x27a58e={};return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x354d41['params']['id']},'include':[{'model':db[_0x91ae('0x78')],'as':_0x91ae('0x7f')}]})['then'](handleEntityNotFound(_0x3c94c2,null))[_0x91ae('0x39')](function(_0x138ef6){_0x59d2f0[_0x91ae('0x80')]=_0x138ef6;_0x59d2f0[_0x91ae('0x81')]=_[_0x91ae('0x82')](_0x138ef6[_0x91ae('0x7f')],['priority'],['asc']);if(_0x59d2f0[_0x91ae('0x80')][_0x91ae('0x7f')]){delete _0x59d2f0['account']['Applications'];}return db['CmContact']['describe']();})[_0x91ae('0x39')](function(_0x1ae4e0){if(!_0x1ae4e0){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x85'));}_0x27ae46=_[_0x91ae('0x86')](_[_0x91ae('0x44')](_0x1ae4e0),[_0x91ae('0x87'),'updatedAt']);_0xb5cf30=_[_0x91ae('0x86')](_['keys'](_0x1ae4e0),[_0x91ae('0x87'),'updatedAt',_0x91ae('0x88'),_0x91ae('0x89')]);_0x59d2f0['body']={'mapKey':_0x91ae('0x8a')};if(_0x59d2f0[_0x91ae('0x80')]['type']&&_0x59d2f0[_0x91ae('0x80')]['type']===_0x91ae('0x8b')){_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')]=_0x354d41[_0x91ae('0x5d')]['From']['replace'](_0x91ae('0x8d'),'');_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')]=_0x354d41['body'][_0x91ae('0x8e')];_0x59d2f0[_0x91ae('0x5d')]['messageId']=_0x354d41[_0x91ae('0x5d')][_0x91ae('0x8f')];}if(_0x59d2f0['body']['id']){delete _0x59d2f0[_0x91ae('0x5d')]['id'];}if(_[_0x91ae('0x90')](_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')])){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x91'));}if(_[_0x91ae('0x90')](_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')])||_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')]===''){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x92'));}if(_['isNil'](_0x59d2f0['body']['mapKey'])){throw new db['Sequelize'][(_0x91ae('0x84'))](_0x91ae('0x93')+_0xb5cf30);}if(!_[_0x91ae('0x94')](_0xb5cf30,_0x59d2f0['body'][_0x91ae('0x95')])){throw new db['Sequelize']['ValidationError'](_0x91ae('0x96')+_0xb5cf30);}_0x27a58e[_0x59d2f0[_0x91ae('0x5d')]['mapKey']]=_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')];return db[_0x91ae('0x97')][_0x91ae('0x61')]({'where':{'id':_0x59d2f0[_0x91ae('0x80')][_0x91ae('0x89')]},'include':[{'model':db[_0x91ae('0x98')],'as':_0x91ae('0x99'),'where':_0x27a58e,'limit':0x1,'order':[[_0x91ae('0x9a'),'DESC']]}]});})['then'](handleEntityNotFound(_0x3c94c2,null))[_0x91ae('0x39')](function(_0x1b0224){if(_0x1b0224){_0x59d2f0['list']=_[_0x91ae('0x9b')](_0x1b0224,[_0x91ae('0x99')]);if(_0x1b0224['Contacts']['length']){return _0x1b0224['Contacts'][0x0];}var _0x44ed20=_[_0x91ae('0x1b')](_0x59d2f0['body'],{'firstName':_0x59d2f0['body'][_0x91ae('0x8c')],'ListId':_0x1b0224['id']});_0x44ed20[_0x59d2f0[_0x91ae('0x5d')]['mapKey']]=_0x59d2f0[_0x91ae('0x5d')]['from'];return db[_0x91ae('0x98')][_0x91ae('0x5c')](_0x44ed20,{'fields':_0x27ae46,'raw':!![]});}})[_0x91ae('0x39')](handleEntityNotFound(_0x3c94c2,null))['then'](function(_0x535e08){if(_0x535e08){_0x59d2f0[_0x91ae('0x9c')]=_0x535e08;var _0x286912={'ContactId':_0x535e08['id'],'phone':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')],'WhatsappAccountId':_0x354d41['params']['id']};var _0x5257a9={'ContactId':_0x535e08['id'],'WhatsappAccountId':_0x354d41['params']['id'],'closed':![]};return db[_0x91ae('0x9d')][_0x91ae('0x61')]({'where':_0x5257a9})[_0x91ae('0x39')](function(_0x3cec5f){if(_0x3cec5f){return[_0x3cec5f,![]];}return db[_0x91ae('0x9d')][_0x91ae('0x5c')](_0x286912)[_0x91ae('0x39')](function(_0x3f74d5){return[_0x3f74d5,!![]];});});}})[_0x91ae('0x6f')](function(_0x3c582b,_0x3c70d6){_0x59d2f0[_0x91ae('0x9e')]=_0x3c582b[_0x91ae('0x35')]({'plain':!![]});_0x59d2f0[_0x91ae('0x9e')][_0x91ae('0x9f')]=![];if(_0x3c70d6){if(_0x59d2f0['account'][_0x91ae('0xa0')]){_0x59d2f0['applications'][_0x91ae('0xa1')]({'id':0x0,'priority':_0x59d2f0[_0x91ae('0x81')][_0x91ae('0x5a')]+0x1,'app':'close','appdata':_0x91ae('0xa2'),'interval':_0x91ae('0xa3')});}_0x59d2f0[_0x91ae('0x9e')]['created']=!![];}return db[_0x91ae('0xa4')][_0x91ae('0x5c')]({'phone':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')],'messageId':_0x59d2f0['body'][_0x91ae('0xa5')],'body':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')],'WhatsappAccountId':_0x354d41[_0x91ae('0x58')]['id'],'WhatsappInteractionId':_0x3c582b['id'],'direction':'in','ContactId':_0x3c582b['ContactId'],'AttachmentId':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0xa6')]});})[_0x91ae('0x39')](function(_0xfc5dc0){_0x59d2f0[_0x91ae('0x27')]=_0xfc5dc0;if(_0x59d2f0[_0x91ae('0x9e')][_0x91ae('0xa7')]){return db[_0x91ae('0x75')][_0x91ae('0x61')]({'attributes':['id',_0x91ae('0x3a')],'where':{'id':_0x59d2f0[_0x91ae('0x9e')][_0x91ae('0xa7')]}})[_0x91ae('0x39')](function(_0x14499b){if(_0x14499b){_0x59d2f0[_0x91ae('0x81')][_0x91ae('0xa8')]({'id':0x0,'priority':0x0,'app':_0x91ae('0xa9'),'appdata':_0x14499b[_0x91ae('0x3a')]+','+(_0x59d2f0['account'][_0x91ae('0xaa')]||0xa),'interval':_0x91ae('0xa3')});}return respondWithRpcPromise(_0x91ae('0xab'),'startRouting',_0x59d2f0);});}return respondWithRpcPromise(_0x91ae('0xab'),_0x91ae('0xac'),_0x59d2f0);})[_0x91ae('0x39')](function(_0x1e9f15){if(_0x1e9f15){var _0x471f3a=0xc8;var _0x20f24e=_0x91ae('0xad');logger['info'](_0x91ae('0x25'),_0x20f24e,_0x471f3a,_0x91ae('0xae'));logger[_0x91ae('0x24')](_0x91ae('0xaf'),_0x20f24e,_0x471f3a,_0x91ae('0xae'),JSON[_0x91ae('0xb0')](_0x1e9f15));if(_0x59d2f0[_0x91ae('0x80')][_0x91ae('0x41')]==='twilio'){return _0x3c94c2[_0x91ae('0x2a')](_0x471f3a)[_0x91ae('0x2f')](_0x91ae('0xb1'),_0x91ae('0xb2'))[_0x91ae('0x3b')]('\x0a');}else{return _0x3c94c2[_0x91ae('0x2a')](_0x471f3a)[_0x91ae('0x31')](_0x1e9f15);}}})['catch'](handleError(_0x3c94c2,null));};exports[_0x91ae('0x3b')]=function(_0x1370e9,_0x2068ee,_0x5ec4fe){var _0x5dbf68,_0x2e4dcf,_0x5efc0c;if(_[_0x91ae('0x90')](_0x1370e9['body'][_0x91ae('0x5d')])||_0x1370e9['body'][_0x91ae('0x5d')]===''){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x92'));}if(_[_0x91ae('0x90')](_0x1370e9[_0x91ae('0x5d')]['to'])){throw new db[(_0x91ae('0x83'))]['ValidationError'](_0x91ae('0xb3'));}_0x5dbf68=_0x1370e9[_0x91ae('0x5d')]['to'];return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x1370e9[_0x91ae('0x58')]['id']},'include':[{'model':db[_0x91ae('0x97')],'as':_0x91ae('0xb4'),'include':[{'model':db['CmContact'],'as':_0x91ae('0x99'),'where':{'mobile':_0x5dbf68},'limit':0x1,'order':[[_0x91ae('0x9a'),_0x91ae('0xb5')]]}]}]})[_0x91ae('0x39')](handleEntityNotFound(_0x2068ee,null))['then'](function(_0x55030e){if(_0x55030e&&_0x55030e[_0x91ae('0xb4')]){_0x2e4dcf=_0x55030e[_0x91ae('0x35')]({'plain':!![]});if(_0x2e4dcf[_0x91ae('0xb4')]&&_0x2e4dcf[_0x91ae('0xb4')]['Contacts'][_0x91ae('0x5a')]){return _0x2e4dcf[_0x91ae('0xb4')][_0x91ae('0x99')][0x0];}return db[_0x91ae('0x98')][_0x91ae('0x5c')](_[_0x91ae('0x1b')](_0x1370e9[_0x91ae('0x5d')],{'firstName':_0x5dbf68,'mobile':_0x5dbf68,'phone':_0x5dbf68,'ListId':_0x2e4dcf['ListId']}));}})[_0x91ae('0x39')](handleEntityNotFound(_0x2068ee,null))['then'](function(_0x1df836){if(_0x1df836){_0x5efc0c=_0x1df836;return db[_0x91ae('0x9d')][_0x91ae('0x61')]({'where':{'ContactId':_0x5efc0c['id'],'closed':![],'WhatsappAccountId':_0x2e4dcf['id']}})[_0x91ae('0x39')](function(_0x5a3207){if(_0x5a3207){return[_0x5a3207,![]];}return db['WhatsappInteraction'][_0x91ae('0x5c')]({'UserId':_0x1370e9['user']['id'],'ContactId':_0x5efc0c['id'],'WhatsappAccountId':_0x2e4dcf['id'],'phone':_0x5dbf68,'firstMsgDirection':_0x91ae('0xb6'),'Messages':[_[_0x91ae('0x4f')](_0x1370e9['body'],{'read':![],'body':_0x1370e9['body'][_0x91ae('0x5d')],'phone':_0x5dbf68,'WhatsappAccountId':_0x2e4dcf['id'],'UserId':_0x1370e9[_0x91ae('0x5e')]['id'],'ContactId':_0x5efc0c['id']})]},{'include':[{'model':db[_0x91ae('0xa4')],'as':_0x91ae('0xb7')}]})[_0x91ae('0x39')](function(_0x59aca7){return[_0x59aca7,!![]];});});}})[_0x91ae('0x6f')](function(_0x292eab,_0x276871){if(_0x276871){return _0x292eab;}return db[_0x91ae('0xa4')][_0x91ae('0x5c')](_[_0x91ae('0x4f')](_0x1370e9[_0x91ae('0x5d')],{'read':![],'body':_0x1370e9['body'][_0x91ae('0x5d')],'phone':_0x5dbf68,'WhatsappAccountId':_0x2e4dcf['id'],'WhatsappInteractionId':_0x292eab['id'],'UserId':_0x1370e9[_0x91ae('0x5e')]['id'],'ContactId':_0x5efc0c['id']}))[_0x91ae('0x39')](function(_0x202814){_0x292eab['dataValues'][_0x91ae('0xb7')]=[];_0x292eab[_0x91ae('0xb8')][_0x91ae('0xb7')]['push'](_0x202814[_0x91ae('0xb8')]);return _0x292eab;});})['then'](respondWithResult(_0x2068ee,null))[_0x91ae('0x29')](handleError(_0x2068ee,null));}; \ No newline at end of file +var _0xded3=['order','sort','where','filters','filter','merge','type','VIRTUAL','options','WhatsappAccount','count','includeAll','findAll','rows','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','pick','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','priority','getApplications','whatsapp','account','orderBy','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','Sequelize','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','applications','close','unmanaged','WhatsappMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','defaults','out','Messages','dataValues','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','Content-Range','reject','update','then','destroy','get','WhatsappAccounts','stack','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xded3,0x75));var _0x3ded=function(_0x4ca538,_0xe09873){_0x4ca538=_0x4ca538-0x0;var _0x3c2324=_0xded3[_0x4ca538];return _0x3c2324;};'use strict';var pdf=require(_0x3ded('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ded('0x1'));var zipdir=require(_0x3ded('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ded('0x3'));var moment=require(_0x3ded('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ded('0x5'));var util=require(_0x3ded('0x6'));var path=require(_0x3ded('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ded('0x8'));var fs=require('fs');var _=require(_0x3ded('0x9'));var squel=require(_0x3ded('0xa'));var crypto=require(_0x3ded('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3ded('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3ded('0xd'));var Papa=require(_0x3ded('0xe'));var Redis=require(_0x3ded('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3ded('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ded('0x11'));var logger=require(_0x3ded('0x12'))(_0x3ded('0x13'));var utils=require(_0x3ded('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3ded('0x15'));var db=require(_0x3ded('0x16'))['db'];config[_0x3ded('0x17')]=_['defaults'](config[_0x3ded('0x17')],{'host':_0x3ded('0x18'),'port':0x18eb});var socket=require(_0x3ded('0x19'))(new Redis(config[_0x3ded('0x17')]));require('./whatsappAccount.socket')[_0x3ded('0x1a')](socket);var jayson=require(_0x3ded('0x1b'));var client=jayson[_0x3ded('0x1c')][_0x3ded('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x17cbf8,_0x3b4da3,_0x1f0ff8,_0x3591eb){return new BPromise(function(_0x58b133,_0x1d6c11){var _0x3371c6=_0x3591eb||client;return _0x3371c6[_0x3ded('0x1e')](_0x17cbf8,_0x1f0ff8)['then'](function(_0x3034a8){logger[_0x3ded('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x3b4da3,'request\x20sent');logger['debug'](_0x3ded('0x20'),_0x3b4da3,_0x3ded('0x21'),JSON['stringify'](_0x3034a8));if(_0x3034a8[_0x3ded('0x22')]){if(_0x3034a8[_0x3ded('0x22')][_0x3ded('0x23')]===0x1f4){logger[_0x3ded('0x22')](_0x3ded('0x24'),_0x3b4da3,_0x3034a8['error'][_0x3ded('0x25')]);return _0x1d6c11(_0x3034a8[_0x3ded('0x22')]['message']);}logger['error'](_0x3ded('0x24'),_0x3b4da3,_0x3034a8[_0x3ded('0x22')][_0x3ded('0x25')]);return _0x58b133(_0x3034a8[_0x3ded('0x22')][_0x3ded('0x25')]);}else{logger[_0x3ded('0x1f')](_0x3ded('0x24'),_0x3b4da3,'request\x20sent');_0x58b133(_0x3034a8[_0x3ded('0x26')][_0x3ded('0x25')]);}})[_0x3ded('0x27')](function(_0x511ab5){logger['error'](_0x3ded('0x24'),_0x3b4da3,_0x511ab5);_0x1d6c11(_0x511ab5);});});}function respondWithStatusCode(_0x29217a,_0x59367a){_0x59367a=_0x59367a||0xcc;return function(_0xea3add){if(_0xea3add){return _0x29217a['sendStatus'](_0x59367a);}return _0x29217a[_0x3ded('0x28')](_0x59367a)[_0x3ded('0x29')]();};}function respondWithResult(_0x3e0b78,_0x1d1c45){_0x1d1c45=_0x1d1c45||0xc8;return function(_0x89b1f9){if(_0x89b1f9){return _0x3e0b78[_0x3ded('0x28')](_0x1d1c45)[_0x3ded('0x2a')](_0x89b1f9);}};}function respondWithFilteredResult(_0x1229b0,_0x53ad47){return function(_0x5be6bf){if(_0x5be6bf){var _0x5b524a=_0x5be6bf['count'],_0x2b008e=_0x53ad47[_0x3ded('0x2b')],_0x2cbf98=_0x53ad47[_0x3ded('0x2b')]+_0x53ad47[_0x3ded('0x2c')],_0x284285;if(_0x2cbf98>=_0x5b524a){_0x2cbf98=_0x5b524a;_0x284285=0xc8;}else{_0x284285=0xce;}_0x1229b0['status'](_0x284285);return _0x1229b0['set'](_0x3ded('0x2d'),_0x2b008e+'-'+_0x2cbf98+'/'+_0x5b524a)[_0x3ded('0x2a')](_0x5be6bf);}return null;};}function patchUpdates(_0x41b797){return function(_0x4728ff){try{jsonpatch['apply'](_0x4728ff,_0x41b797,!![]);}catch(_0x2e3293){return BPromise[_0x3ded('0x2e')](_0x2e3293);}return _0x4728ff['save']();};}function saveUpdates(_0x3a22ee,_0xf57f41){return function(_0x255e61){if(_0x255e61){return _0x255e61[_0x3ded('0x2f')](_0x3a22ee)[_0x3ded('0x30')](function(_0x564244){return _0x564244;});}return null;};}function removeEntity(_0x5056c4,_0xc4d763){return function(_0x43b50b){if(_0x43b50b){return _0x43b50b[_0x3ded('0x31')]()[_0x3ded('0x30')](function(){var _0x17c381=_0x43b50b[_0x3ded('0x32')]({'plain':!![]});var _0x5d217a=_0x3ded('0x33');return db['UserProfileResource'][_0x3ded('0x31')]({'where':{'type':_0x5d217a,'resourceId':_0x17c381['id']}})[_0x3ded('0x30')](function(){return _0x43b50b;});})[_0x3ded('0x30')](function(){_0x5056c4[_0x3ded('0x28')](0xcc)[_0x3ded('0x29')]();});}};}function handleEntityNotFound(_0x43ea6b,_0x290313){return function(_0x5f0814){if(!_0x5f0814){_0x43ea6b['sendStatus'](0x194);}return _0x5f0814;};}function handleError(_0x15db66,_0x156621){_0x156621=_0x156621||0x1f4;return function(_0x11f89b){logger['error'](_0x11f89b[_0x3ded('0x34')]);if(_0x11f89b[_0x3ded('0x35')]){delete _0x11f89b[_0x3ded('0x35')];}_0x15db66[_0x3ded('0x28')](_0x156621)[_0x3ded('0x36')](_0x11f89b);};}exports['index']=function(_0x26edc5,_0x261627){var _0x306be4={'include':[{'model':db['Pause'],'as':_0x3ded('0x37')}]},_0x37b36e={},_0x4f6634={'count':0x0,'rows':[]};var _0x109386=_[_0x3ded('0x38')](db['WhatsappAccount'][_0x3ded('0x39')],function(_0xe43cbc){return{'name':_0xe43cbc[_0x3ded('0x3a')],'type':_0xe43cbc['type'][_0x3ded('0x3b')]};});_0x37b36e[_0x3ded('0x3c')]=_['map'](_0x109386,_0x3ded('0x35'));_0x37b36e[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x26edc5[_0x3ded('0x3d')]);_0x37b36e['filters']=_[_0x3ded('0x3f')](_0x37b36e[_0x3ded('0x3c')],_0x37b36e[_0x3ded('0x3d')]);_0x306be4[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x37b36e[_0x3ded('0x3c')],qs[_0x3ded('0x41')](_0x26edc5['query']['fields']));_0x306be4[_0x3ded('0x40')]=_0x306be4[_0x3ded('0x40')][_0x3ded('0x42')]?_0x306be4[_0x3ded('0x40')]:_0x37b36e['model'];if(!_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x43')]('nolimit')){_0x306be4[_0x3ded('0x2c')]=qs[_0x3ded('0x2c')](_0x26edc5['query']['limit']);_0x306be4[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x2b')]);}_0x306be4[_0x3ded('0x44')]=qs[_0x3ded('0x45')](_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x45')]);_0x306be4[_0x3ded('0x46')]=qs[_0x3ded('0x47')](_['pick'](_0x26edc5[_0x3ded('0x3d')],_0x37b36e[_0x3ded('0x47')]),_0x109386);if(_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x48')]){_0x306be4['where']=_[_0x3ded('0x49')](_0x306be4[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x109386,function(_0x2368a7){if(_0x2368a7[_0x3ded('0x4a')]!==_0x3ded('0x4b')){var _0x31718f={};_0x31718f[_0x2368a7[_0x3ded('0x35')]]={'$like':'%'+_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x48')]+'%'};return _0x31718f;}})});}_0x306be4=_[_0x3ded('0x49')]({},_0x306be4,_0x26edc5[_0x3ded('0x4c')]);var _0x1571d8={'where':_0x306be4[_0x3ded('0x46')]};return db[_0x3ded('0x4d')]['count'](_0x1571d8)[_0x3ded('0x30')](function(_0xb8c308){_0x4f6634[_0x3ded('0x4e')]=_0xb8c308;if(_0x26edc5[_0x3ded('0x3d')][_0x3ded('0x4f')]){_0x306be4['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x3ded('0x50')](_0x306be4);})[_0x3ded('0x30')](function(_0x4fc0f8){_0x4f6634[_0x3ded('0x51')]=_0x4fc0f8;return _0x4f6634;})[_0x3ded('0x30')](respondWithFilteredResult(_0x261627,_0x306be4))[_0x3ded('0x27')](handleError(_0x261627,null));};exports[_0x3ded('0x52')]=function(_0x3bd6d4,_0x1ebe33){var _0xf7861b={'raw':![],'where':{'id':_0x3bd6d4[_0x3ded('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x3ded('0x37')}]},_0x5cb0c8={};_0x5cb0c8[_0x3ded('0x3c')]=_['keys'](db[_0x3ded('0x4d')][_0x3ded('0x39')]);_0x5cb0c8['query']=_[_0x3ded('0x3e')](_0x3bd6d4[_0x3ded('0x3d')]);_0x5cb0c8[_0x3ded('0x47')]=_['intersection'](_0x5cb0c8['model'],_0x5cb0c8[_0x3ded('0x3d')]);_0xf7861b[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x5cb0c8[_0x3ded('0x3c')],qs['fields'](_0x3bd6d4[_0x3ded('0x3d')][_0x3ded('0x41')]));_0xf7861b['attributes']=_0xf7861b[_0x3ded('0x40')][_0x3ded('0x42')]?_0xf7861b[_0x3ded('0x40')]:_0x5cb0c8[_0x3ded('0x3c')];if(_0x3bd6d4[_0x3ded('0x3d')]['includeAll']){_0xf7861b['include']=[{'all':!![]}];}_0xf7861b=_[_0x3ded('0x49')]({},_0xf7861b,_0x3bd6d4['options']);return db[_0x3ded('0x4d')][_0x3ded('0x54')](_0xf7861b)[_0x3ded('0x30')](handleEntityNotFound(_0x1ebe33,null))[_0x3ded('0x30')](respondWithResult(_0x1ebe33,null))['catch'](handleError(_0x1ebe33,null));};exports['create']=function(_0x4c4c1a,_0x32cf1b){return db[_0x3ded('0x4d')][_0x3ded('0x55')](_0x4c4c1a['body'],{})['then'](function(_0xdba0e0){var _0x36837e=_0x4c4c1a[_0x3ded('0x56')]['get']({'plain':!![]});if(!_0x36837e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36837e[_0x3ded('0x57')]===_0x3ded('0x56')){var _0x33fd89=_0xdba0e0[_0x3ded('0x32')]({'plain':!![]});var _0x452828='WhatsappAccounts';return db[_0x3ded('0x58')]['find']({'where':{'name':_0x452828,'userProfileId':_0x36837e[_0x3ded('0x59')]},'raw':!![]})[_0x3ded('0x30')](function(_0x5835a6){if(_0x5835a6&&_0x5835a6[_0x3ded('0x5a')]===0x0){return db[_0x3ded('0x5b')]['create']({'name':_0x33fd89[_0x3ded('0x35')],'resourceId':_0x33fd89['id'],'type':_0x5835a6['name'],'sectionId':_0x5835a6['id']},{})[_0x3ded('0x30')](function(){return _0xdba0e0;});}else{return _0xdba0e0;}})['catch'](function(_0x579f78){logger[_0x3ded('0x22')](_0x3ded('0x5c'),_0x579f78);throw _0x579f78;});}return _0xdba0e0;})[_0x3ded('0x30')](respondWithResult(_0x32cf1b,0xc9))[_0x3ded('0x27')](handleError(_0x32cf1b,null));};exports[_0x3ded('0x2f')]=function(_0x2f2459,_0x159059){if(_0x2f2459[_0x3ded('0x5d')]['id']){delete _0x2f2459['body']['id'];}return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x2f2459[_0x3ded('0x53')]['id']},'include':[{'model':db[_0x3ded('0x5e')],'as':_0x3ded('0x37')}]})[_0x3ded('0x30')](handleEntityNotFound(_0x159059,null))[_0x3ded('0x30')](saveUpdates(_0x2f2459[_0x3ded('0x5d')],null))[_0x3ded('0x30')](respondWithResult(_0x159059,null))['catch'](handleError(_0x159059,null));};exports[_0x3ded('0x31')]=function(_0x6161da,_0x34c5a9){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x6161da[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x34c5a9,null))[_0x3ded('0x30')](removeEntity(_0x34c5a9,null))['catch'](handleError(_0x34c5a9,null));};exports[_0x3ded('0x5f')]=function(_0x28330e,_0x4d2647){return db[_0x3ded('0x4d')][_0x3ded('0x5f')]()[_0x3ded('0x30')](respondWithResult(_0x4d2647,null))['catch'](handleError(_0x4d2647,null));};exports[_0x3ded('0x60')]=function(_0x5d6482,_0x4de14f,_0x12002a){if(_0x5d6482[_0x3ded('0x5d')]['id']){delete _0x5d6482['body']['id'];}return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x5d6482[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x4de14f,null))[_0x3ded('0x30')](function(_0x4f3576){if(_0x4f3576){_0x5d6482[_0x3ded('0x5d')][_0x3ded('0x61')]=_0x4f3576['id'];return db['Disposition']['create'](_0x5d6482[_0x3ded('0x5d')]);}})[_0x3ded('0x30')](respondWithResult(_0x4de14f,null))['catch'](handleError(_0x4de14f,null));};exports[_0x3ded('0x62')]=function(_0x57ecf2,_0x57f1f1,_0x5e1e25){var _0x3524a0={'raw':![],'where':{}};var _0x4159d1={};var _0xc7596d={'count':0x0,'rows':[]};return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x57ecf2[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x57f1f1,null))['then'](function(_0x53d5f0){if(_0x53d5f0){_0x4159d1['model']=_[_0x3ded('0x3e')](db[_0x3ded('0x64')][_0x3ded('0x39')]);_0x4159d1[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x57ecf2[_0x3ded('0x3d')]);_0x4159d1[_0x3ded('0x47')]=_[_0x3ded('0x3f')](_0x4159d1['model'],_0x4159d1['query']);_0x3524a0[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x4159d1[_0x3ded('0x3c')],qs[_0x3ded('0x41')](_0x57ecf2['query']['fields']));_0x3524a0[_0x3ded('0x40')]=_0x3524a0['attributes'][_0x3ded('0x42')]?_0x3524a0[_0x3ded('0x40')]:_0x4159d1[_0x3ded('0x3c')];if(!_0x57ecf2[_0x3ded('0x3d')][_0x3ded('0x43')]('nolimit')){_0x3524a0[_0x3ded('0x2c')]=qs['limit'](_0x57ecf2[_0x3ded('0x3d')]['limit']);_0x3524a0['offset']=qs['offset'](_0x57ecf2[_0x3ded('0x3d')]['offset']);}_0x3524a0[_0x3ded('0x44')]=qs['sort'](_0x57ecf2[_0x3ded('0x3d')]['sort']);_0x3524a0['where']=qs[_0x3ded('0x47')](_[_0x3ded('0x65')](_0x57ecf2['query'],_0x4159d1[_0x3ded('0x47')]));_0x3524a0[_0x3ded('0x46')]['WhatsappAccountId']=_0x53d5f0['id'];if(_0x57ecf2[_0x3ded('0x3d')][_0x3ded('0x48')]){_0x3524a0[_0x3ded('0x46')]=_[_0x3ded('0x49')](_0x3524a0[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x3524a0[_0x3ded('0x40')],function(_0x1fd6d1){var _0x5c68f1={};_0x5c68f1[_0x1fd6d1]={'$like':'%'+_0x57ecf2[_0x3ded('0x3d')]['filter']+'%'};return _0x5c68f1;})});}_0x3524a0=_[_0x3ded('0x49')]({},_0x3524a0,_0x57ecf2[_0x3ded('0x4c')]);return db['Disposition']['count']({'where':_0x3524a0['where']})[_0x3ded('0x30')](function(_0x5846f6){_0xc7596d[_0x3ded('0x4e')]=_0x5846f6;if(_0x57ecf2['query'][_0x3ded('0x4f')]){_0x3524a0[_0x3ded('0x66')]=[{'all':!![]}];}return db[_0x3ded('0x64')][_0x3ded('0x50')](_0x3524a0);})[_0x3ded('0x30')](function(_0xa28714){_0xc7596d['rows']=_0xa28714;return _0xc7596d;});}})[_0x3ded('0x30')](respondWithFilteredResult(_0x57f1f1,_0x3524a0))['catch'](handleError(_0x57f1f1,null));};exports[_0x3ded('0x67')]=function(_0x576ca2,_0x25e818,_0x69003d){return db['WhatsappAccount'][_0x3ded('0x54')]({'where':{'id':_0x576ca2[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x25e818,null))[_0x3ded('0x30')](function(_0x237071){if(_0x237071){return _0x237071[_0x3ded('0x67')](_0x576ca2['query'][_0x3ded('0x68')]);}})['then'](respondWithStatusCode(_0x25e818,null))[_0x3ded('0x27')](handleError(_0x25e818,null));};exports[_0x3ded('0x69')]=function(_0x1e23b2,_0x3f8059,_0x2938e9){if(_0x1e23b2[_0x3ded('0x5d')]['id']){delete _0x1e23b2[_0x3ded('0x5d')]['id'];}return db['WhatsappAccount'][_0x3ded('0x54')]({'where':{'id':_0x1e23b2['params']['id']}})['then'](handleEntityNotFound(_0x3f8059,null))['then'](function(_0x1565fd){if(_0x1565fd){_0x1e23b2['body']['WhatsappAccountId']=_0x1565fd['id'];return db[_0x3ded('0x6a')][_0x3ded('0x55')](_0x1e23b2[_0x3ded('0x5d')]);}})['then'](respondWithResult(_0x3f8059,null))[_0x3ded('0x27')](handleError(_0x3f8059,null));};exports[_0x3ded('0x6b')]=function(_0x238b8d,_0x59a426,_0x1b879f){var _0x5b1ade={'raw':![],'where':{}};var _0x11cfef={};var _0x2ba577={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3ded('0x63')]({'where':{'id':_0x238b8d[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x59a426,null))[_0x3ded('0x30')](function(_0xf3a323){if(_0xf3a323){_0x11cfef['model']=_[_0x3ded('0x3e')](db[_0x3ded('0x6a')][_0x3ded('0x39')]);_0x11cfef[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x238b8d[_0x3ded('0x3d')]);_0x11cfef['filters']=_['intersection'](_0x11cfef[_0x3ded('0x3c')],_0x11cfef[_0x3ded('0x3d')]);_0x5b1ade[_0x3ded('0x40')]=_['intersection'](_0x11cfef[_0x3ded('0x3c')],qs[_0x3ded('0x41')](_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x41')]));_0x5b1ade['attributes']=_0x5b1ade[_0x3ded('0x40')]['length']?_0x5b1ade['attributes']:_0x11cfef[_0x3ded('0x3c')];if(!_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x43')](_0x3ded('0x6c'))){_0x5b1ade[_0x3ded('0x2c')]=qs[_0x3ded('0x2c')](_0x238b8d[_0x3ded('0x3d')]['limit']);_0x5b1ade[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x2b')]);}_0x5b1ade[_0x3ded('0x44')]=qs[_0x3ded('0x45')](_0x238b8d[_0x3ded('0x3d')][_0x3ded('0x45')]);_0x5b1ade['where']=qs['filters'](_['pick'](_0x238b8d['query'],_0x11cfef['filters']));_0x5b1ade[_0x3ded('0x46')][_0x3ded('0x61')]=_0xf3a323['id'];if(_0x238b8d['query'][_0x3ded('0x48')]){_0x5b1ade[_0x3ded('0x46')]=_[_0x3ded('0x49')](_0x5b1ade[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x5b1ade['attributes'],function(_0x3d59a7){var _0x1c456c={};_0x1c456c[_0x3d59a7]={'$like':'%'+_0x238b8d['query']['filter']+'%'};return _0x1c456c;})});}_0x5b1ade=_['merge']({},_0x5b1ade,_0x238b8d[_0x3ded('0x4c')]);return db[_0x3ded('0x6a')]['count']({'where':_0x5b1ade['where']})[_0x3ded('0x30')](function(_0x4aed63){_0x2ba577['count']=_0x4aed63;if(_0x238b8d[_0x3ded('0x3d')]['includeAll']){_0x5b1ade[_0x3ded('0x66')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3ded('0x50')](_0x5b1ade);})[_0x3ded('0x30')](function(_0x29af19){_0x2ba577[_0x3ded('0x51')]=_0x29af19;return _0x2ba577;});}})[_0x3ded('0x30')](respondWithFilteredResult(_0x59a426,_0x5b1ade))[_0x3ded('0x27')](handleError(_0x59a426,null));};exports[_0x3ded('0x6d')]=function(_0x2a3891,_0x435aa5,_0x19434){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x2a3891[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x435aa5,null))['then'](function(_0x268a19){if(_0x268a19){return _0x268a19[_0x3ded('0x6d')](_0x2a3891[_0x3ded('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x435aa5,null))['catch'](handleError(_0x435aa5,null));};exports[_0x3ded('0x6e')]=function(_0xbb1a15,_0x2641d0,_0x2a9aa7){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0xbb1a15[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x2641d0,null))['then'](function(_0xd546b7){if(_0xd546b7){return _0xd546b7[_0x3ded('0x6e')](_0xbb1a15['body'][_0x3ded('0x68')],_[_0x3ded('0x6f')](_0xbb1a15['body'],['ids','id'])||{})[_0x3ded('0x70')](function(_0x153179){for(var _0xc46bca=0x0;_0xc46bca<_0xbb1a15[_0x3ded('0x5d')]['ids'][_0x3ded('0x42')];_0xc46bca+=0x1){socket[_0x3ded('0x71')](_0x3ded('0x72'),{'UserId':_0xbb1a15['body'][_0x3ded('0x68')][_0xc46bca],'WhatsappAccountId':_0xbb1a15[_0x3ded('0x53')]['id']});}return _0x153179;});}})[_0x3ded('0x30')](respondWithResult(_0x2641d0,null))[_0x3ded('0x27')](handleError(_0x2641d0,null));};exports['removeAgents']=function(_0x441cb2,_0x40ea57,_0x5e40af){return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x441cb2[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x40ea57,null))['then'](function(_0x1fa03c){if(_0x1fa03c){return _0x1fa03c[_0x3ded('0x73')](_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')])[_0x3ded('0x30')](function(){if(_['isArray'](_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')])){for(var _0x370744=0x0;_0x370744<_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')]['length'];_0x370744+=0x1){socket[_0x3ded('0x71')](_0x3ded('0x74'),{'UserId':Number(_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')][_0x370744]),'WhatsappAccountId':Number(_0x441cb2['params']['id'])});}}else{socket[_0x3ded('0x71')](_0x3ded('0x74'),{'UserId':Number(_0x441cb2[_0x3ded('0x3d')][_0x3ded('0x68')]),'WhatsappAccountId':Number(_0x441cb2['params']['id'])});}});}})[_0x3ded('0x30')](respondWithStatusCode(_0x40ea57,null))[_0x3ded('0x27')](handleError(_0x40ea57,null));};exports['getAgents']=function(_0x11ad5d,_0x29d829,_0x47fb00){var _0x341c84={};var _0x164aa9={};var _0x257a79;var _0x126a04;return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x11ad5d['params']['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x29d829,null))[_0x3ded('0x30')](function(_0x36a0ad){if(_0x36a0ad){_0x257a79=_0x36a0ad;_0x164aa9[_0x3ded('0x3c')]=_[_0x3ded('0x3e')](db['User']['rawAttributes']);_0x164aa9['query']=_[_0x3ded('0x3e')](_0x11ad5d[_0x3ded('0x3d')]);_0x164aa9['filters']=_[_0x3ded('0x3f')](_0x164aa9['model'],_0x164aa9[_0x3ded('0x3d')]);_0x341c84[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x164aa9['model'],qs[_0x3ded('0x41')](_0x11ad5d[_0x3ded('0x3d')]['fields']));_0x341c84[_0x3ded('0x40')]=_0x341c84[_0x3ded('0x40')][_0x3ded('0x42')]?_0x341c84[_0x3ded('0x40')]:_0x164aa9[_0x3ded('0x3c')];_0x341c84[_0x3ded('0x44')]=qs[_0x3ded('0x45')](_0x11ad5d[_0x3ded('0x3d')][_0x3ded('0x45')]);_0x341c84[_0x3ded('0x46')]=qs[_0x3ded('0x47')](_[_0x3ded('0x65')](_0x11ad5d[_0x3ded('0x3d')],_0x164aa9[_0x3ded('0x47')]));if(_0x11ad5d[_0x3ded('0x3d')]['filter']){_0x341c84['where']=_[_0x3ded('0x49')](_0x341c84[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x341c84[_0x3ded('0x40')],function(_0x41e98d){var _0x9d62d2={};_0x9d62d2[_0x41e98d]={'$like':'%'+_0x11ad5d[_0x3ded('0x3d')][_0x3ded('0x48')]+'%'};return _0x9d62d2;})});}_0x341c84=_[_0x3ded('0x49')]({},_0x341c84,_0x11ad5d['options']);return _0x257a79[_0x3ded('0x75')](_0x341c84);}})[_0x3ded('0x30')](function(_0x21f7b0){if(_0x21f7b0){_0x126a04=_0x21f7b0[_0x3ded('0x42')];if(!_0x11ad5d['query']['hasOwnProperty']('nolimit')){_0x341c84[_0x3ded('0x2c')]=qs['limit'](_0x11ad5d[_0x3ded('0x3d')][_0x3ded('0x2c')]);_0x341c84[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x11ad5d['query'][_0x3ded('0x2b')]);}return _0x257a79['getAgents'](_0x341c84);}})[_0x3ded('0x30')](function(_0x22b059){if(_0x22b059){return _0x22b059?{'count':_0x126a04,'rows':_0x22b059}:null;}})[_0x3ded('0x30')](respondWithResult(_0x29d829,null))[_0x3ded('0x27')](handleError(_0x29d829,null));};exports[_0x3ded('0x76')]=function(_0x49a7a6,_0x4b1267,_0x59a252){return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x49a7a6[_0x3ded('0x53')]['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x4b1267,null))['then'](function(_0x4142bc){if(_0x4142bc){return db[_0x3ded('0x77')][_0x3ded('0x78')](function(_0xe18939){return db['WhatsappApplication'][_0x3ded('0x31')]({'where':{'WhatsappAccountId':_0x49a7a6[_0x3ded('0x53')]['id']},'transaction':_0xe18939})[_0x3ded('0x30')](function(_0x508855){var _0x23305d=_['map'](_0x49a7a6[_0x3ded('0x5d')],function(_0x20f330){_0x20f330[_0x3ded('0x61')]=_0x49a7a6['params']['id'];return _0x20f330;});return db[_0x3ded('0x79')]['bulkCreate'](_0x23305d,{'transaction':_0xe18939});});})[_0x3ded('0x30')](function(){return db[_0x3ded('0x79')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x49a7a6['params']['id']},'order':_0x3ded('0x7a')});});}})['then'](respondWithResult(_0x4b1267,null))[_0x3ded('0x27')](handleError(_0x4b1267,null));};exports['getApplications']=function(_0x6ec866,_0x1e924d,_0x539ec9){var _0x688429={};var _0x4b959b={};var _0x50692f;var _0x3f1b85;return db[_0x3ded('0x4d')][_0x3ded('0x63')]({'where':{'id':_0x6ec866['params']['id']}})[_0x3ded('0x30')](handleEntityNotFound(_0x1e924d,null))['then'](function(_0x457ff5){if(_0x457ff5){_0x50692f=_0x457ff5;_0x4b959b[_0x3ded('0x3c')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x4b959b[_0x3ded('0x3d')]=_[_0x3ded('0x3e')](_0x6ec866['query']);_0x4b959b[_0x3ded('0x47')]=_['intersection'](_0x4b959b[_0x3ded('0x3c')],_0x4b959b[_0x3ded('0x3d')]);_0x688429[_0x3ded('0x40')]=_[_0x3ded('0x3f')](_0x4b959b['model'],qs[_0x3ded('0x41')](_0x6ec866[_0x3ded('0x3d')]['fields']));_0x688429[_0x3ded('0x40')]=_0x688429[_0x3ded('0x40')]['length']?_0x688429['attributes']:_0x4b959b[_0x3ded('0x3c')];_0x688429[_0x3ded('0x44')]=qs['sort'](_0x6ec866['query'][_0x3ded('0x45')]);_0x688429['where']=qs[_0x3ded('0x47')](_[_0x3ded('0x65')](_0x6ec866[_0x3ded('0x3d')],_0x4b959b['filters']));if(_0x6ec866[_0x3ded('0x3d')][_0x3ded('0x48')]){_0x688429['where']=_['merge'](_0x688429[_0x3ded('0x46')],{'$or':_[_0x3ded('0x38')](_0x688429[_0x3ded('0x40')],function(_0x78ddcb){var _0x3cca00={};_0x3cca00[_0x78ddcb]={'$like':'%'+_0x6ec866[_0x3ded('0x3d')][_0x3ded('0x48')]+'%'};return _0x3cca00;})});}_0x688429=_[_0x3ded('0x49')]({},_0x688429,_0x6ec866[_0x3ded('0x4c')]);return _0x50692f[_0x3ded('0x7b')](_0x688429);}})['then'](function(_0x1e2241){if(_0x1e2241){_0x3f1b85=_0x1e2241[_0x3ded('0x42')];if(!_0x6ec866[_0x3ded('0x3d')][_0x3ded('0x43')](_0x3ded('0x6c'))){_0x688429[_0x3ded('0x2c')]=qs[_0x3ded('0x2c')](_0x6ec866['query'][_0x3ded('0x2c')]);_0x688429[_0x3ded('0x2b')]=qs[_0x3ded('0x2b')](_0x6ec866[_0x3ded('0x3d')]['offset']);}return _0x50692f[_0x3ded('0x7b')](_0x688429);}})[_0x3ded('0x30')](function(_0x382440){if(_0x382440){return _0x382440?{'count':_0x3f1b85,'rows':_0x382440}:null;}})[_0x3ded('0x30')](respondWithResult(_0x1e924d,null))[_0x3ded('0x27')](handleError(_0x1e924d,null));};exports['notify']=function(_0x2c86f4,_0x31dfc2,_0x1d6cc5){var _0x2dd494={'channel':_0x3ded('0x7c')};var _0x9e4ee=[];var _0x19e274=[];var _0x33a10b={};return db['WhatsappAccount'][_0x3ded('0x54')]({'where':{'id':_0x2c86f4[_0x3ded('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x3ded('0x30')](handleEntityNotFound(_0x31dfc2,null))[_0x3ded('0x30')](function(_0xac8b7b){_0x2dd494[_0x3ded('0x7d')]=_0xac8b7b;_0x2dd494['applications']=_[_0x3ded('0x7e')](_0xac8b7b[_0x3ded('0x7f')],[_0x3ded('0x7a')],[_0x3ded('0x80')]);if(_0x2dd494[_0x3ded('0x7d')][_0x3ded('0x7f')]){delete _0x2dd494[_0x3ded('0x7d')][_0x3ded('0x7f')];}return db[_0x3ded('0x81')]['describe']();})[_0x3ded('0x30')](function(_0x4eb617){if(!_0x4eb617){throw new db['Sequelize'][(_0x3ded('0x82'))](_0x3ded('0x83'));}_0x9e4ee=_[_0x3ded('0x84')](_['keys'](_0x4eb617),[_0x3ded('0x85'),_0x3ded('0x86')]);_0x19e274=_[_0x3ded('0x84')](_[_0x3ded('0x3e')](_0x4eb617),[_0x3ded('0x85'),_0x3ded('0x86'),_0x3ded('0x87'),_0x3ded('0x88')]);_0x2dd494[_0x3ded('0x5d')]={'mapKey':_0x3ded('0x89')};if(_0x2dd494[_0x3ded('0x7d')][_0x3ded('0x4a')]&&_0x2dd494[_0x3ded('0x7d')][_0x3ded('0x4a')]===_0x3ded('0x8a')){_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')]=_0x2c86f4[_0x3ded('0x5d')][_0x3ded('0x8c')][_0x3ded('0x8d')](_0x3ded('0x8e'),'');_0x2dd494[_0x3ded('0x5d')]['body']=_0x2c86f4[_0x3ded('0x5d')][_0x3ded('0x8f')];_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x90')]=_0x2c86f4[_0x3ded('0x5d')][_0x3ded('0x91')];}if(_0x2dd494['body']['id']){delete _0x2dd494[_0x3ded('0x5d')]['id'];}if(_['isNil'](_0x2dd494['body'][_0x3ded('0x8b')])){throw new db[(_0x3ded('0x92'))][(_0x3ded('0x82'))](_0x3ded('0x93'));}if(_[_0x3ded('0x94')](_0x2dd494['body'][_0x3ded('0x5d')])||_0x2dd494[_0x3ded('0x5d')]['body']===''){throw new db[(_0x3ded('0x92'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2dd494['body']['mapKey'])){throw new db['Sequelize'][(_0x3ded('0x82'))](_0x3ded('0x95')+_0x19e274);}if(!_[_0x3ded('0x96')](_0x19e274,_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x97')])){throw new db[(_0x3ded('0x92'))][(_0x3ded('0x82'))](_0x3ded('0x98')+_0x19e274);}_0x33a10b[_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x97')]]=_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')];return db[_0x3ded('0x99')][_0x3ded('0x54')]({'where':{'id':_0x2dd494[_0x3ded('0x7d')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x3ded('0x9a'),'where':_0x33a10b,'limit':0x1,'order':[['updatedAt',_0x3ded('0x9b')]]}]});})[_0x3ded('0x30')](handleEntityNotFound(_0x31dfc2,null))['then'](function(_0x515a9b){if(_0x515a9b){_0x2dd494['list']=_[_0x3ded('0x6f')](_0x515a9b,[_0x3ded('0x9a')]);if(_0x515a9b[_0x3ded('0x9a')][_0x3ded('0x42')]){return _0x515a9b['Contacts'][0x0];}var _0x1a9afd=_['defaults'](_0x2dd494[_0x3ded('0x5d')],{'firstName':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')],'ListId':_0x515a9b['id']});_0x1a9afd[_0x2dd494[_0x3ded('0x5d')]['mapKey']]=_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')];return db[_0x3ded('0x81')][_0x3ded('0x55')](_0x1a9afd,{'fields':_0x9e4ee,'raw':!![]});}})['then'](handleEntityNotFound(_0x31dfc2,null))[_0x3ded('0x30')](function(_0x4d3a16){if(_0x4d3a16){_0x2dd494[_0x3ded('0x9c')]=_0x4d3a16;var _0x3de40a={'ContactId':_0x4d3a16['id'],'phone':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')],'WhatsappAccountId':_0x2c86f4[_0x3ded('0x53')]['id']};var _0x59f4e9={'ContactId':_0x4d3a16['id'],'WhatsappAccountId':_0x2c86f4[_0x3ded('0x53')]['id'],'closed':![]};return db[_0x3ded('0x9d')][_0x3ded('0x54')]({'where':_0x59f4e9})[_0x3ded('0x30')](function(_0x3a8c02){if(_0x3a8c02){return[_0x3a8c02,![]];}return db[_0x3ded('0x9d')][_0x3ded('0x55')](_0x3de40a)[_0x3ded('0x30')](function(_0x18151a){return[_0x18151a,!![]];});});}})[_0x3ded('0x70')](function(_0x5715c7,_0x964556){_0x2dd494['interaction']=_0x5715c7[_0x3ded('0x32')]({'plain':!![]});_0x2dd494[_0x3ded('0x9e')][_0x3ded('0x9f')]=![];if(_0x964556){if(_0x2dd494['account'][_0x3ded('0xa0')]){_0x2dd494[_0x3ded('0xa1')]['push']({'id':0x0,'priority':_0x2dd494[_0x3ded('0xa1')][_0x3ded('0x42')]+0x1,'app':_0x3ded('0xa2'),'appdata':_0x3ded('0xa3'),'interval':'*,*,*,*'});}_0x2dd494[_0x3ded('0x9e')][_0x3ded('0x9f')]=!![];}return db[_0x3ded('0xa4')]['create']({'phone':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x8b')],'messageId':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x90')],'body':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0x5d')],'WhatsappAccountId':_0x2c86f4[_0x3ded('0x53')]['id'],'WhatsappInteractionId':_0x5715c7['id'],'direction':'in','ContactId':_0x5715c7['ContactId'],'AttachmentId':_0x2dd494[_0x3ded('0x5d')][_0x3ded('0xa5')]});})[_0x3ded('0x30')](function(_0x28c54c){_0x2dd494[_0x3ded('0x25')]=_0x28c54c;if(_0x2dd494[_0x3ded('0x9e')]['UserId']){return db[_0x3ded('0xa6')][_0x3ded('0x54')]({'attributes':['id',_0x3ded('0x35')],'where':{'id':_0x2dd494[_0x3ded('0x9e')][_0x3ded('0xa7')]}})['then'](function(_0x2cf480){if(_0x2cf480){_0x2dd494['applications'][_0x3ded('0xa8')]({'id':0x0,'priority':0x0,'app':_0x3ded('0xa9'),'appdata':_0x2cf480[_0x3ded('0x35')]+','+(_0x2dd494[_0x3ded('0x7d')][_0x3ded('0xaa')]||0xa),'interval':_0x3ded('0xab')});}return respondWithRpcPromise(_0x3ded('0xac'),_0x3ded('0xad'),_0x2dd494);});}return respondWithRpcPromise('Start',_0x3ded('0xad'),_0x2dd494);})[_0x3ded('0x30')](function(_0x1b69cf){if(_0x1b69cf){var _0x211426=0xc8;var _0x1e0581=_0x3ded('0xae');logger[_0x3ded('0x1f')](_0x3ded('0x20'),_0x1e0581,_0x211426,_0x3ded('0xaf'));logger['debug'](_0x3ded('0xb0'),_0x1e0581,_0x211426,_0x3ded('0xaf'),JSON['stringify'](_0x1b69cf));if(_0x2dd494[_0x3ded('0x7d')]['type']===_0x3ded('0x8a')){return _0x31dfc2['status'](_0x211426)[_0x3ded('0xb1')]('Content-Type','text/xml')[_0x3ded('0x36')](_0x3ded('0xb2'));}else{return _0x31dfc2[_0x3ded('0x28')](_0x211426)[_0x3ded('0x2a')](_0x1b69cf);}}})[_0x3ded('0x27')](handleError(_0x31dfc2,null));};exports[_0x3ded('0x36')]=function(_0x3e6972,_0x34a525,_0x381e01){var _0xffab00,_0x46a5e7,_0x353c30;if(_[_0x3ded('0x94')](_0x3e6972[_0x3ded('0x5d')][_0x3ded('0x5d')])||_0x3e6972[_0x3ded('0x5d')][_0x3ded('0x5d')]===''){throw new db['Sequelize'][(_0x3ded('0x82'))](_0x3ded('0xb3'));}if(_[_0x3ded('0x94')](_0x3e6972[_0x3ded('0x5d')]['to'])){throw new db[(_0x3ded('0x92'))][(_0x3ded('0x82'))]('to\x20is\x20mandatory');}_0xffab00=_0x3e6972[_0x3ded('0x5d')]['to'];return db[_0x3ded('0x4d')][_0x3ded('0x54')]({'where':{'id':_0x3e6972[_0x3ded('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x3ded('0xb4'),'include':[{'model':db[_0x3ded('0x81')],'as':_0x3ded('0x9a'),'where':{'mobile':_0xffab00},'limit':0x1,'order':[[_0x3ded('0x86'),'DESC']]}]}]})[_0x3ded('0x30')](handleEntityNotFound(_0x34a525,null))['then'](function(_0x480ad5){if(_0x480ad5&&_0x480ad5[_0x3ded('0xb4')]){_0x46a5e7=_0x480ad5[_0x3ded('0x32')]({'plain':!![]});if(_0x46a5e7[_0x3ded('0xb4')]&&_0x46a5e7[_0x3ded('0xb4')][_0x3ded('0x9a')]['length']){return _0x46a5e7['List'][_0x3ded('0x9a')][0x0];}return db[_0x3ded('0x81')]['create'](_[_0x3ded('0xb5')](_0x3e6972[_0x3ded('0x5d')],{'firstName':_0xffab00,'mobile':_0xffab00,'phone':_0xffab00,'ListId':_0x46a5e7[_0x3ded('0x88')]}));}})[_0x3ded('0x30')](handleEntityNotFound(_0x34a525,null))['then'](function(_0x4d7032){if(_0x4d7032){_0x353c30=_0x4d7032;return db[_0x3ded('0x9d')]['find']({'where':{'ContactId':_0x353c30['id'],'closed':![],'WhatsappAccountId':_0x46a5e7['id']}})[_0x3ded('0x30')](function(_0x20246f){if(_0x20246f){return[_0x20246f,![]];}return db[_0x3ded('0x9d')][_0x3ded('0x55')]({'UserId':_0x3e6972['user']['id'],'ContactId':_0x353c30['id'],'WhatsappAccountId':_0x46a5e7['id'],'phone':_0xffab00,'firstMsgDirection':_0x3ded('0xb6'),'Messages':[_[_0x3ded('0x49')](_0x3e6972['body'],{'read':![],'body':_0x3e6972['body'][_0x3ded('0x5d')],'phone':_0xffab00,'WhatsappAccountId':_0x46a5e7['id'],'UserId':_0x3e6972[_0x3ded('0x56')]['id'],'ContactId':_0x353c30['id']})]},{'include':[{'model':db[_0x3ded('0xa4')],'as':_0x3ded('0xb7')}]})['then'](function(_0x2d57d2){return[_0x2d57d2,!![]];});});}})[_0x3ded('0x70')](function(_0x55a679,_0x4a00ec){if(_0x4a00ec){return _0x55a679;}return db[_0x3ded('0xa4')][_0x3ded('0x55')](_[_0x3ded('0x49')](_0x3e6972[_0x3ded('0x5d')],{'read':![],'body':_0x3e6972[_0x3ded('0x5d')][_0x3ded('0x5d')],'phone':_0xffab00,'WhatsappAccountId':_0x46a5e7['id'],'WhatsappInteractionId':_0x55a679['id'],'UserId':_0x3e6972['user']['id'],'ContactId':_0x353c30['id']}))[_0x3ded('0x30')](function(_0x29a65a){_0x55a679[_0x3ded('0xb8')][_0x3ded('0xb7')]=[];_0x55a679[_0x3ded('0xb8')][_0x3ded('0xb7')]['push'](_0x29a65a['dataValues']);return _0x55a679;});})['then'](respondWithResult(_0x34a525,null))[_0x3ded('0x27')](handleError(_0x34a525,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 553fbc4..4a95cb4 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 _0xb145=['exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xa38b7e,_0x251c86){var _0x1afd2e=function(_0x4c5ad6){while(--_0x4c5ad6){_0xa38b7e['push'](_0xa38b7e['shift']());}};_0x1afd2e(++_0x251c86);}(_0xb145,0xa3));var _0x5b14=function(_0x223814,_0x1685f0){_0x223814=_0x223814-0x0;var _0x4759cb=_0xb145[_0x223814];return _0x4759cb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x5b14('0x0'))['db'][_0x5b14('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5b14('0x2')](0x0);var events={'afterCreate':_0x5b14('0x3'),'afterUpdate':_0x5b14('0x4'),'afterDestroy':_0x5b14('0x5')};function emitEvent(_0x31f6f0){return function(_0x34b4cd,_0x5111cd,_0x1e0b5b){WhatsappAccountEvents[_0x5b14('0x6')](_0x31f6f0+':'+_0x34b4cd['id'],_0x34b4cd);WhatsappAccountEvents[_0x5b14('0x6')](_0x31f6f0,_0x34b4cd);_0x1e0b5b(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x5b14('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9a5a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x9a5a,0x194));var _0xa9a5=function(_0x4a9fe1,_0x223e97){_0x4a9fe1=_0x4a9fe1-0x0;var _0x538d1b=_0x9a5a[_0x4a9fe1];return _0x538d1b;};'use strict';var EventEmitter=require(_0xa9a5('0x0'));var WhatsappAccount=require(_0xa9a5('0x1'))['db'][_0xa9a5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa9a5('0x3')](0x0);var events={'afterCreate':_0xa9a5('0x4'),'afterUpdate':'update','afterDestroy':_0xa9a5('0x5')};function emitEvent(_0x1e6fb1){return function(_0x230710,_0x1080a9,_0x31e823){WhatsappAccountEvents[_0xa9a5('0x6')](_0x1e6fb1+':'+_0x230710['id'],_0x230710);WhatsappAccountEvents['emit'](_0x1e6fb1,_0x230710);_0x31e823(null);};}for(var e in events){if(events[_0xa9a5('0x7')](e)){var event=events[e];WhatsappAccount[_0xa9a5('0x8')](e,emitEvent(event));}}module[_0xa9a5('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 7bb26f1..bd1cfa8 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 _0xa1b5=['WhatsappAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x1fb8f5,_0x539718){var _0x137401=function(_0x139a89){while(--_0x139a89){_0x1fb8f5['push'](_0x1fb8f5['shift']());}};_0x137401(++_0x539718);}(_0xa1b5,0x12d));var _0x5a1b=function(_0x502aad,_0x43bd0c){_0x502aad=_0x502aad-0x0;var _0x1ed0aa=_0xa1b5[_0x502aad];return _0x1ed0aa;};'use strict';var _=require(_0x5a1b('0x0'));var util=require(_0x5a1b('0x1'));var logger=require(_0x5a1b('0x2'))(_0x5a1b('0x3'));var moment=require(_0x5a1b('0x4'));var BPromise=require(_0x5a1b('0x5'));var rp=require(_0x5a1b('0x6'));var fs=require('fs');var path=require(_0x5a1b('0x7'));var rimraf=require(_0x5a1b('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a1b('0x9'));module[_0x5a1b('0xa')]=function(_0x21a3cc,_0x3a831c){return _0x21a3cc['define'](_0x5a1b('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9e5=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x4c085e,_0x32fb7b){var _0x379b1f=function(_0x4667c9){while(--_0x4667c9){_0x4c085e['push'](_0x4c085e['shift']());}};_0x379b1f(++_0x32fb7b);}(_0xf9e5,0x1a1));var _0x5f9e=function(_0x32fb9b,_0x17db74){_0x32fb9b=_0x32fb9b-0x0;var _0x28f534=_0xf9e5[_0x32fb9b];return _0x28f534;};'use strict';var _=require(_0x5f9e('0x0'));var util=require(_0x5f9e('0x1'));var logger=require(_0x5f9e('0x2'))(_0x5f9e('0x3'));var moment=require(_0x5f9e('0x4'));var BPromise=require('bluebird');var rp=require(_0x5f9e('0x5'));var fs=require('fs');var path=require(_0x5f9e('0x6'));var rimraf=require(_0x5f9e('0x7'));var config=require(_0x5f9e('0x8'));var attributes=require(_0x5f9e('0x9'));module[_0x5f9e('0xa')]=function(_0x2ada6e,_0x5f5061){return _0x2ada6e[_0x5f9e('0xb')](_0x5f9e('0xc'),attributes,{'tableName':_0x5f9e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 83a767c..dbf99a2 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 _0x1042=['redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappAccount','options','attributes','include','map','model','debug','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf30c68,_0x4b405c){var _0x7f69ce=function(_0x7b81fd){while(--_0x7b81fd){_0xf30c68['push'](_0xf30c68['shift']());}};_0x7f69ce(++_0x4b405c);}(_0x1042,0x1de));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2104('0x0'));var util=require(_0x2104('0x1'));var moment=require(_0x2104('0x2'));var BPromise=require(_0x2104('0x3'));var rs=require(_0x2104('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2104('0x5'));var logger=require(_0x2104('0x6'))(_0x2104('0x7'));var config=require(_0x2104('0x8'));var jayson=require(_0x2104('0x9'));var client=jayson[_0x2104('0xa')][_0x2104('0xb')]({'port':0x232a});config[_0x2104('0xc')]=_['defaults'](config[_0x2104('0xc')],{'host':_0x2104('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2104('0xc')]));require(_0x2104('0xe'))[_0x2104('0xf')](socket);function respondWithRpcPromise(_0x354de5,_0x48c085,_0x30f357){return new BPromise(function(_0x7e43fc,_0x4236da){return client[_0x2104('0x10')](_0x354de5,_0x30f357)[_0x2104('0x11')](function(_0x5aa360){logger[_0x2104('0x12')](_0x2104('0x13'),_0x48c085,_0x2104('0x14'));logger['debug'](_0x2104('0x15'),_0x48c085,'request\x20sent',JSON[_0x2104('0x16')](_0x5aa360));if(_0x5aa360['error']){if(_0x5aa360[_0x2104('0x17')][_0x2104('0x18')]===0x1f4){logger[_0x2104('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x48c085,_0x5aa360[_0x2104('0x17')][_0x2104('0x19')]);return _0x4236da(_0x5aa360[_0x2104('0x17')]['message']);}logger[_0x2104('0x17')](_0x2104('0x13'),_0x48c085,_0x5aa360[_0x2104('0x17')]['message']);return _0x7e43fc(_0x5aa360[_0x2104('0x17')][_0x2104('0x19')]);}else{logger[_0x2104('0x12')](_0x2104('0x13'),_0x48c085,_0x2104('0x14'));_0x7e43fc(_0x5aa360['result'][_0x2104('0x19')]);}})[_0x2104('0x1a')](function(_0x3332b1){logger['error'](_0x2104('0x13'),_0x48c085,_0x3332b1);_0x4236da(_0x3332b1);});});}exports['ShowWhatsappAccount']=function(_0x31600a){var _0x4b72f3=this;return new Promise(function(_0x40ccfe,_0x2cedf5){return db[_0x2104('0x1b')]['find']({'raw':_0x31600a[_0x2104('0x1c')]?_0x31600a[_0x2104('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x31600a[_0x2104('0x1c')]?_0x31600a[_0x2104('0x1c')]['where']||null:null,'attributes':_0x31600a[_0x2104('0x1c')]?_0x31600a[_0x2104('0x1c')][_0x2104('0x1d')]||null:null,'include':_0x31600a[_0x2104('0x1c')]?_0x31600a['options'][_0x2104('0x1e')]?_[_0x2104('0x1f')](_0x31600a[_0x2104('0x1c')][_0x2104('0x1e')],function(_0x297f89){return{'model':db[_0x297f89['model']],'as':_0x297f89['as'],'attributes':_0x297f89['attributes'],'include':_0x297f89[_0x2104('0x1e')]?_['map'](_0x297f89[_0x2104('0x1e')],function(_0x2eb316){return{'model':db[_0x2eb316[_0x2104('0x20')]],'as':_0x2eb316['as'],'attributes':_0x2eb316[_0x2104('0x1d')],'include':_0x2eb316[_0x2104('0x1e')]?_[_0x2104('0x1f')](_0x2eb316[_0x2104('0x1e')],function(_0x175bd8){return{'model':db[_0x175bd8[_0x2104('0x20')]],'as':_0x175bd8['as'],'attributes':_0x175bd8[_0x2104('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4269cf){logger[_0x2104('0x12')]('ShowWhatsappAccount',_0x31600a);logger[_0x2104('0x21')](_0x2104('0x22'),_0x31600a,JSON[_0x2104('0x16')](_0x4269cf));_0x40ccfe(_0x4269cf);})['catch'](function(_0x2f11e0){logger[_0x2104('0x17')]('ShowWhatsappAccount',_0x2f11e0[_0x2104('0x19')],_0x31600a);_0x2cedf5(_0x4b72f3[_0x2104('0x17')](0x1f4,_0x2f11e0['message']));});});}; \ No newline at end of file +var _0x7f3c=['request','then','info','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','model','attributes','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register'];(function(_0x14c340,_0x26308e){var _0x4717f1=function(_0x23d6b2){while(--_0x23d6b2){_0x14c340['push'](_0x14c340['shift']());}};_0x4717f1(++_0x26308e);}(_0x7f3c,0x1d3));var _0xc7f3=function(_0xbe0bad,_0x242e22){_0xbe0bad=_0xbe0bad-0x0;var _0x2a18cc=_0x7f3c[_0xbe0bad];return _0x2a18cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc7f3('0x0'));var BPromise=require('bluebird');var rs=require(_0xc7f3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7f3('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7f3('0x3'));var config=require(_0xc7f3('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xc7f3('0x5')][_0xc7f3('0x6')]({'port':0x232a});config['redis']=_[_0xc7f3('0x7')](config['redis'],{'host':_0xc7f3('0x8'),'port':0x18eb});var socket=require(_0xc7f3('0x9'))(new Redis(config[_0xc7f3('0xa')]));require(_0xc7f3('0xb'))[_0xc7f3('0xc')](socket);function respondWithRpcPromise(_0x156e9a,_0x3c93ce,_0xa17e6a){return new BPromise(function(_0x187fac,_0x18f348){return client[_0xc7f3('0xd')](_0x156e9a,_0xa17e6a)[_0xc7f3('0xe')](function(_0x563661){logger[_0xc7f3('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x3c93ce,_0xc7f3('0x10'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3c93ce,_0xc7f3('0x10'),JSON[_0xc7f3('0x11')](_0x563661));if(_0x563661[_0xc7f3('0x12')]){if(_0x563661['error']['code']===0x1f4){logger['error'](_0xc7f3('0x13'),_0x3c93ce,_0x563661['error'][_0xc7f3('0x14')]);return _0x18f348(_0x563661[_0xc7f3('0x12')][_0xc7f3('0x14')]);}logger[_0xc7f3('0x12')](_0xc7f3('0x13'),_0x3c93ce,_0x563661['error'][_0xc7f3('0x14')]);return _0x187fac(_0x563661[_0xc7f3('0x12')][_0xc7f3('0x14')]);}else{logger[_0xc7f3('0xf')](_0xc7f3('0x13'),_0x3c93ce,_0xc7f3('0x10'));_0x187fac(_0x563661['result'][_0xc7f3('0x14')]);}})[_0xc7f3('0x15')](function(_0x576cb5){logger[_0xc7f3('0x12')](_0xc7f3('0x13'),_0x3c93ce,_0x576cb5);_0x18f348(_0x576cb5);});});}exports[_0xc7f3('0x16')]=function(_0x3c8979){var _0x3609c5=this;return new Promise(function(_0x2668de,_0x4efee9){return db[_0xc7f3('0x17')][_0xc7f3('0x18')]({'raw':_0x3c8979['options']?_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c8979['options']?_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1b')]||null:null,'attributes':_0x3c8979[_0xc7f3('0x19')]?_0x3c8979[_0xc7f3('0x19')]['attributes']||null:null,'include':_0x3c8979[_0xc7f3('0x19')]?_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1c')]?_[_0xc7f3('0x1d')](_0x3c8979[_0xc7f3('0x19')][_0xc7f3('0x1c')],function(_0x28202a){return{'model':db[_0x28202a[_0xc7f3('0x1e')]],'as':_0x28202a['as'],'attributes':_0x28202a[_0xc7f3('0x1f')],'include':_0x28202a[_0xc7f3('0x1c')]?_['map'](_0x28202a[_0xc7f3('0x1c')],function(_0x17211f){return{'model':db[_0x17211f[_0xc7f3('0x1e')]],'as':_0x17211f['as'],'attributes':_0x17211f['attributes'],'include':_0x17211f[_0xc7f3('0x1c')]?_['map'](_0x17211f[_0xc7f3('0x1c')],function(_0x4a6aad){return{'model':db[_0x4a6aad['model']],'as':_0x4a6aad['as'],'attributes':_0x4a6aad[_0xc7f3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc7f3('0xe')](function(_0x1c32df){logger['info']('ShowWhatsappAccount',_0x3c8979);logger['debug'](_0xc7f3('0x16'),_0x3c8979,JSON[_0xc7f3('0x11')](_0x1c32df));_0x2668de(_0x1c32df);})[_0xc7f3('0x15')](function(_0x3566a3){logger['error']('ShowWhatsappAccount',_0x3566a3[_0xc7f3('0x14')],_0x3c8979);_0x4efee9(_0x3609c5[_0xc7f3('0x12')](0x1f4,_0x3566a3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index dc73ae9..dae1fc2 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 _0x4740=['whatsappAccount:','save','remove','emit','removeListener','register','length'];(function(_0x4fde03,_0x2ddb25){var _0x49921d=function(_0x10b400){while(--_0x10b400){_0x4fde03['push'](_0x4fde03['shift']());}};_0x49921d(++_0x2ddb25);}(_0x4740,0x1ac));var _0x0474=function(_0x2b4059,_0x14d581){_0x2b4059=_0x2b4059-0x0;var _0x7ab0fb=_0x4740[_0x2b4059];return _0x7ab0fb;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x0474('0x0'),_0x0474('0x1'),'update'];function createListener(_0x588f86,_0xbb9fb8){return function(_0x4a6909){_0xbb9fb8[_0x0474('0x2')](_0x588f86,_0x4a6909);};}function removeListener(_0x292afe,_0xf6cb0f){return function(){WhatsappAccountEvents[_0x0474('0x3')](_0x292afe,_0xf6cb0f);};}exports[_0x0474('0x4')]=function(_0x2fbef8){for(var _0x51c737=0x0,_0x2b70de=events[_0x0474('0x5')];_0x51c737<_0x2b70de;_0x51c737++){var _0x180bff=events[_0x51c737];var _0x5dbb84=createListener(_0x0474('0x6')+_0x180bff,_0x2fbef8);WhatsappAccountEvents['on'](_0x180bff,_0x5dbb84);}}; \ No newline at end of file +var _0xa3e1=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x20393d,_0x2b030e){var _0x5dd080=function(_0x1dd4a8){while(--_0x1dd4a8){_0x20393d['push'](_0x20393d['shift']());}};_0x5dd080(++_0x2b030e);}(_0xa3e1,0xe5));var _0x1a3e=function(_0x59e1b8,_0x3906af){_0x59e1b8=_0x59e1b8-0x0;var _0xdcbac8=_0xa3e1[_0x59e1b8];return _0xdcbac8;};'use strict';var WhatsappAccountEvents=require(_0x1a3e('0x0'));var events=[_0x1a3e('0x1'),_0x1a3e('0x2'),_0x1a3e('0x3')];function createListener(_0x242e22,_0x42b363){return function(_0x42995d){_0x42b363[_0x1a3e('0x4')](_0x242e22,_0x42995d);};}function removeListener(_0x328cd9,_0x348444){return function(){WhatsappAccountEvents[_0x1a3e('0x5')](_0x328cd9,_0x348444);};}exports[_0x1a3e('0x6')]=function(_0x1f6a65){for(var _0x58f266=0x0,_0x5ad7e2=events[_0x1a3e('0x7')];_0x58f266<_0x5ad7e2;_0x58f266++){var _0x348da8=events[_0x58f266];var _0x19a859=createListener(_0x1a3e('0x8')+_0x348da8,_0x1f6a65);WhatsappAccountEvents['on'](_0x348da8,_0x19a859);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5775731..b8b0c35 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 _0x7bc8=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bc8,0xa2));var _0x87bc=function(_0x496111,_0xe5fa2){_0x496111=_0x496111-0x0;var _0x102688=_0x7bc8[_0x496111];return _0x102688;};'use strict';var multer=require(_0x87bc('0x0'));var util=require(_0x87bc('0x1'));var path=require(_0x87bc('0x2'));var timeout=require(_0x87bc('0x3'));var express=require('express');var router=express[_0x87bc('0x4')]();var auth=require(_0x87bc('0x5'));var interaction=require(_0x87bc('0x6'));var config=require(_0x87bc('0x7'));var controller=require(_0x87bc('0x8'));router['get']('/',auth[_0x87bc('0x9')](),controller[_0x87bc('0xa')]);router['get'](_0x87bc('0xb'),auth[_0x87bc('0x9')](),controller[_0x87bc('0xc')]);router[_0x87bc('0xd')]('/',auth[_0x87bc('0x9')](),controller[_0x87bc('0xe')]);router[_0x87bc('0xf')]('/:id',auth[_0x87bc('0x9')](),controller[_0x87bc('0x10')]);router[_0x87bc('0x11')](_0x87bc('0xb'),auth['isAuthenticated'](),controller[_0x87bc('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4747=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','post','create','/:id','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4747,0x1a0));var _0x7474=function(_0x5b0208,_0x58666d){_0x5b0208=_0x5b0208-0x0;var _0x5800b4=_0x4747[_0x5b0208];return _0x5800b4;};'use strict';var multer=require(_0x7474('0x0'));var util=require(_0x7474('0x1'));var path=require(_0x7474('0x2'));var timeout=require(_0x7474('0x3'));var express=require('express');var router=express[_0x7474('0x4')]();var auth=require(_0x7474('0x5'));var interaction=require(_0x7474('0x6'));var config=require(_0x7474('0x7'));var controller=require(_0x7474('0x8'));router[_0x7474('0x9')]('/',auth[_0x7474('0xa')](),controller[_0x7474('0xb')]);router[_0x7474('0x9')]('/:id',auth[_0x7474('0xa')](),controller['show']);router[_0x7474('0xc')]('/',auth['isAuthenticated'](),controller[_0x7474('0xd')]);router['put'](_0x7474('0xe'),auth[_0x7474('0xa')](),controller['update']);router[_0x7474('0xf')](_0x7474('0xe'),auth[_0x7474('0xa')](),controller[_0x7474('0x10')]);module[_0x7474('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7a5470a..3f3e48b 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 _0x6e0e=['exports','STRING','noop','TEXT','sequelize'];(function(_0xb1d5f3,_0x255f2f){var _0x5a89e0=function(_0x19755b){while(--_0x19755b){_0xb1d5f3['push'](_0xb1d5f3['shift']());}};_0x5a89e0(++_0x255f2f);}(_0x6e0e,0x112));var _0xe6e0=function(_0x14634f,_0x5c3b5b){_0x14634f=_0x14634f-0x0;var _0x452ced=_0x6e0e[_0x14634f];return _0x452ced;};'use strict';var Sequelize=require(_0xe6e0('0x0'));module[_0xe6e0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe6e0('0x2')],'allowNull':![],'defaultValue':_0xe6e0('0x3')},'appdata':{'type':Sequelize[_0xe6e0('0x4')]()},'description':{'type':Sequelize[_0xe6e0('0x2')]},'interval':{'type':Sequelize[_0xe6e0('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x790c=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x4e6a4f,_0x204514){var _0x18a324=function(_0x5dded6){while(--_0x5dded6){_0x4e6a4f['push'](_0x4e6a4f['shift']());}};_0x18a324(++_0x204514);}(_0x790c,0x6f));var _0xc790=function(_0x5ef9ea,_0x217535){_0x5ef9ea=_0x5ef9ea-0x0;var _0x1d1f90=_0x790c[_0x5ef9ea];return _0x1d1f90;};'use strict';var Sequelize=require(_0xc790('0x0'));module[_0xc790('0x1')]={'priority':{'type':Sequelize[_0xc790('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc790('0x3')],'allowNull':![],'defaultValue':_0xc790('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc790('0x3')]},'interval':{'type':Sequelize[_0xc790('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index b05a3fb..53681c3 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 _0x78f1=['sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','params','find','create','body','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x378529,_0x7e6ce3){var _0x161c6b=function(_0xe26e87){while(--_0xe26e87){_0x378529['push'](_0x378529['shift']());}};_0x161c6b(++_0x7e6ce3);}(_0x78f1,0x10f));var _0x178f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x78f1[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0x178f('0x0'));var emlformat=require(_0x178f('0x1'));var rimraf=require(_0x178f('0x2'));var zipdir=require(_0x178f('0x3'));var jsonpatch=require(_0x178f('0x4'));var rp=require(_0x178f('0x5'));var moment=require(_0x178f('0x6'));var BPromise=require(_0x178f('0x7'));var Mustache=require(_0x178f('0x8'));var util=require('util');var path=require(_0x178f('0x9'));var sox=require(_0x178f('0xa'));var csv=require(_0x178f('0xb'));var ejs=require(_0x178f('0xc'));var fs=require('fs');var _=require(_0x178f('0xd'));var squel=require(_0x178f('0xe'));var crypto=require(_0x178f('0xf'));var jsforce=require(_0x178f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x178f('0xb'));var querystring=require('querystring');var Papa=require(_0x178f('0x11'));var Redis=require(_0x178f('0x12'));var authService=require(_0x178f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x178f('0x14'));var utils=require(_0x178f('0x15'));var config=require(_0x178f('0x16'));var licenseUtil=require(_0x178f('0x17'));var db=require(_0x178f('0x18'))['db'];function respondWithStatusCode(_0x3b2ba5,_0x5c19ee){_0x5c19ee=_0x5c19ee||0xcc;return function(_0x17e395){if(_0x17e395){return _0x3b2ba5[_0x178f('0x19')](_0x5c19ee);}return _0x3b2ba5[_0x178f('0x1a')](_0x5c19ee)[_0x178f('0x1b')]();};}function respondWithResult(_0x357fd3,_0xbc8a78){_0xbc8a78=_0xbc8a78||0xc8;return function(_0x5383c2){if(_0x5383c2){return _0x357fd3[_0x178f('0x1a')](_0xbc8a78)['json'](_0x5383c2);}};}function respondWithFilteredResult(_0x3a0d18,_0x21455b){return function(_0x34b043){if(_0x34b043){var _0xf4eddc=_0x34b043['count'],_0x485098=_0x21455b[_0x178f('0x1c')],_0x2199b8=_0x21455b[_0x178f('0x1c')]+_0x21455b[_0x178f('0x1d')],_0x4c847d;if(_0x2199b8>=_0xf4eddc){_0x2199b8=_0xf4eddc;_0x4c847d=0xc8;}else{_0x4c847d=0xce;}_0x3a0d18[_0x178f('0x1a')](_0x4c847d);return _0x3a0d18[_0x178f('0x1e')]('Content-Range',_0x485098+'-'+_0x2199b8+'/'+_0xf4eddc)[_0x178f('0x1f')](_0x34b043);}return null;};}function patchUpdates(_0xf3154b){return function(_0x1b8796){try{jsonpatch[_0x178f('0x20')](_0x1b8796,_0xf3154b,!![]);}catch(_0xd6cfad){return BPromise[_0x178f('0x21')](_0xd6cfad);}return _0x1b8796[_0x178f('0x22')]();};}function saveUpdates(_0x4d17db,_0xd33b3b){return function(_0x4ec7ed){if(_0x4ec7ed){return _0x4ec7ed[_0x178f('0x23')](_0x4d17db)['then'](function(_0x353481){return _0x353481;});}return null;};}function removeEntity(_0x3e3d1f,_0x4f1c26){return function(_0x184f1d){if(_0x184f1d){return _0x184f1d['destroy']()[_0x178f('0x24')](function(){_0x3e3d1f[_0x178f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d66b0,_0x3e9142){return function(_0x303f9a){if(!_0x303f9a){_0x5d66b0[_0x178f('0x19')](0x194);}return _0x303f9a;};}function handleError(_0x5c3d09,_0x7196e8){_0x7196e8=_0x7196e8||0x1f4;return function(_0x21234d){logger[_0x178f('0x25')](_0x21234d[_0x178f('0x26')]);if(_0x21234d[_0x178f('0x27')]){delete _0x21234d[_0x178f('0x27')];}_0x5c3d09['status'](_0x7196e8)[_0x178f('0x28')](_0x21234d);};}exports[_0x178f('0x29')]=function(_0x149525,_0x122dfc){var _0x16e097={},_0x5c1229={},_0x26fcbd={'count':0x0,'rows':[]};var _0x13a164=_[_0x178f('0x2a')](db[_0x178f('0x2b')][_0x178f('0x2c')],function(_0x504177){return{'name':_0x504177[_0x178f('0x2d')],'type':_0x504177[_0x178f('0x2e')][_0x178f('0x2f')]};});_0x5c1229[_0x178f('0x30')]=_[_0x178f('0x2a')](_0x13a164,_0x178f('0x27'));_0x5c1229['query']=_[_0x178f('0x31')](_0x149525[_0x178f('0x32')]);_0x5c1229[_0x178f('0x33')]=_[_0x178f('0x34')](_0x5c1229[_0x178f('0x30')],_0x5c1229[_0x178f('0x32')]);_0x16e097[_0x178f('0x35')]=_['intersection'](_0x5c1229['model'],qs[_0x178f('0x36')](_0x149525[_0x178f('0x32')][_0x178f('0x36')]));_0x16e097[_0x178f('0x35')]=_0x16e097[_0x178f('0x35')][_0x178f('0x37')]?_0x16e097[_0x178f('0x35')]:_0x5c1229['model'];if(!_0x149525['query'][_0x178f('0x38')]('nolimit')){_0x16e097['limit']=qs[_0x178f('0x1d')](_0x149525[_0x178f('0x32')]['limit']);_0x16e097[_0x178f('0x1c')]=qs[_0x178f('0x1c')](_0x149525[_0x178f('0x32')][_0x178f('0x1c')]);}_0x16e097[_0x178f('0x39')]=qs[_0x178f('0x3a')](_0x149525[_0x178f('0x32')][_0x178f('0x3a')]);_0x16e097['where']=qs[_0x178f('0x33')](_[_0x178f('0x3b')](_0x149525[_0x178f('0x32')],_0x5c1229[_0x178f('0x33')]),_0x13a164);if(_0x149525[_0x178f('0x32')]['filter']){_0x16e097[_0x178f('0x3c')]=_[_0x178f('0x3d')](_0x16e097[_0x178f('0x3c')],{'$or':_[_0x178f('0x2a')](_0x13a164,function(_0xb66a0){if(_0xb66a0[_0x178f('0x2e')]!==_0x178f('0x3e')){var _0x742675={};_0x742675[_0xb66a0[_0x178f('0x27')]]={'$like':'%'+_0x149525[_0x178f('0x32')][_0x178f('0x3f')]+'%'};return _0x742675;}})});}_0x16e097=_[_0x178f('0x3d')]({},_0x16e097,_0x149525[_0x178f('0x40')]);var _0x1c5ee1={'where':_0x16e097[_0x178f('0x3c')]};return db[_0x178f('0x2b')][_0x178f('0x41')](_0x1c5ee1)[_0x178f('0x24')](function(_0x643e57){_0x26fcbd['count']=_0x643e57;if(_0x149525[_0x178f('0x32')][_0x178f('0x42')]){_0x16e097[_0x178f('0x43')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x16e097);})[_0x178f('0x24')](function(_0x45d9bd){_0x26fcbd['rows']=_0x45d9bd;return _0x26fcbd;})[_0x178f('0x24')](respondWithFilteredResult(_0x122dfc,_0x16e097))['catch'](handleError(_0x122dfc,null));};exports['show']=function(_0x19324a,_0x1d5a7e){var _0x28484a={'raw':!![],'where':{'id':_0x19324a[_0x178f('0x44')]['id']}},_0x1a2055={};_0x1a2055[_0x178f('0x30')]=_['keys'](db[_0x178f('0x2b')][_0x178f('0x2c')]);_0x1a2055[_0x178f('0x32')]=_[_0x178f('0x31')](_0x19324a[_0x178f('0x32')]);_0x1a2055['filters']=_[_0x178f('0x34')](_0x1a2055[_0x178f('0x30')],_0x1a2055[_0x178f('0x32')]);_0x28484a[_0x178f('0x35')]=_['intersection'](_0x1a2055['model'],qs[_0x178f('0x36')](_0x19324a[_0x178f('0x32')]['fields']));_0x28484a['attributes']=_0x28484a['attributes'][_0x178f('0x37')]?_0x28484a[_0x178f('0x35')]:_0x1a2055['model'];if(_0x19324a['query'][_0x178f('0x42')]){_0x28484a[_0x178f('0x43')]=[{'all':!![]}];}_0x28484a=_[_0x178f('0x3d')]({},_0x28484a,_0x19324a[_0x178f('0x40')]);return db[_0x178f('0x2b')][_0x178f('0x45')](_0x28484a)[_0x178f('0x24')](handleEntityNotFound(_0x1d5a7e,null))[_0x178f('0x24')](respondWithResult(_0x1d5a7e,null))['catch'](handleError(_0x1d5a7e,null));};exports['create']=function(_0x5f162a,_0x5d3768){return db[_0x178f('0x2b')][_0x178f('0x46')](_0x5f162a[_0x178f('0x47')],{})[_0x178f('0x24')](respondWithResult(_0x5d3768,0xc9))[_0x178f('0x48')](handleError(_0x5d3768,null));};exports['update']=function(_0x5e4c53,_0x4732a1){if(_0x5e4c53[_0x178f('0x47')]['id']){delete _0x5e4c53[_0x178f('0x47')]['id'];}return db['WhatsappApplication'][_0x178f('0x45')]({'where':{'id':_0x5e4c53[_0x178f('0x44')]['id']}})[_0x178f('0x24')](handleEntityNotFound(_0x4732a1,null))[_0x178f('0x24')](saveUpdates(_0x5e4c53[_0x178f('0x47')],null))[_0x178f('0x24')](respondWithResult(_0x4732a1,null))[_0x178f('0x48')](handleError(_0x4732a1,null));};exports[_0x178f('0x49')]=function(_0x526f24,_0x36a6de){return db[_0x178f('0x2b')]['find']({'where':{'id':_0x526f24[_0x178f('0x44')]['id']}})['then'](handleEntityNotFound(_0x36a6de,null))['then'](removeEntity(_0x36a6de,null))[_0x178f('0x48')](handleError(_0x36a6de,null));}; \ No newline at end of file +var _0xad6a=['key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','merge','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','index','map','WhatsappApplication','rawAttributes','fieldName'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0xad6a,0x18e));var _0xaad6=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xad6a[_0x725b8e];return _0x43ac45;};'use strict';var pdf=require(_0xaad6('0x0'));var emlformat=require(_0xaad6('0x1'));var rimraf=require(_0xaad6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaad6('0x3'));var rp=require(_0xaad6('0x4'));var moment=require(_0xaad6('0x5'));var BPromise=require(_0xaad6('0x6'));var Mustache=require(_0xaad6('0x7'));var util=require(_0xaad6('0x8'));var path=require('path');var sox=require(_0xaad6('0x9'));var csv=require(_0xaad6('0xa'));var ejs=require(_0xaad6('0xb'));var fs=require('fs');var _=require(_0xaad6('0xc'));var squel=require('squel');var crypto=require(_0xaad6('0xd'));var jsforce=require(_0xaad6('0xe'));var deskjs=require(_0xaad6('0xf'));var toCsv=require(_0xaad6('0xa'));var querystring=require(_0xaad6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaad6('0x11'));var qs=require(_0xaad6('0x12'));var as=require(_0xaad6('0x13'));var hardwareService=require(_0xaad6('0x14'));var logger=require(_0xaad6('0x15'))(_0xaad6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaad6('0x17'));var db=require(_0xaad6('0x18'))['db'];function respondWithStatusCode(_0x15000a,_0x498ff8){_0x498ff8=_0x498ff8||0xcc;return function(_0x114adf){if(_0x114adf){return _0x15000a[_0xaad6('0x19')](_0x498ff8);}return _0x15000a[_0xaad6('0x1a')](_0x498ff8)[_0xaad6('0x1b')]();};}function respondWithResult(_0x5c160e,_0x50d615){_0x50d615=_0x50d615||0xc8;return function(_0xcf3ba0){if(_0xcf3ba0){return _0x5c160e[_0xaad6('0x1a')](_0x50d615)[_0xaad6('0x1c')](_0xcf3ba0);}};}function respondWithFilteredResult(_0x262303,_0x51cb88){return function(_0x4f6a47){if(_0x4f6a47){var _0x2403fb=_0x4f6a47[_0xaad6('0x1d')],_0x18cbea=_0x51cb88[_0xaad6('0x1e')],_0x284a8c=_0x51cb88[_0xaad6('0x1e')]+_0x51cb88[_0xaad6('0x1f')],_0x50a1cc;if(_0x284a8c>=_0x2403fb){_0x284a8c=_0x2403fb;_0x50a1cc=0xc8;}else{_0x50a1cc=0xce;}_0x262303[_0xaad6('0x1a')](_0x50a1cc);return _0x262303[_0xaad6('0x20')](_0xaad6('0x21'),_0x18cbea+'-'+_0x284a8c+'/'+_0x2403fb)[_0xaad6('0x1c')](_0x4f6a47);}return null;};}function patchUpdates(_0x296da2){return function(_0xb72a60){try{jsonpatch[_0xaad6('0x22')](_0xb72a60,_0x296da2,!![]);}catch(_0x3b5133){return BPromise[_0xaad6('0x23')](_0x3b5133);}return _0xb72a60[_0xaad6('0x24')]();};}function saveUpdates(_0x3d16c8,_0x1b5c1c){return function(_0x407cbc){if(_0x407cbc){return _0x407cbc[_0xaad6('0x25')](_0x3d16c8)['then'](function(_0x36d3b0){return _0x36d3b0;});}return null;};}function removeEntity(_0x3b27ec,_0x5c9d6c){return function(_0x3e6d9f){if(_0x3e6d9f){return _0x3e6d9f[_0xaad6('0x26')]()[_0xaad6('0x27')](function(){_0x3b27ec[_0xaad6('0x1a')](0xcc)[_0xaad6('0x1b')]();});}};}function handleEntityNotFound(_0x46bef9,_0x193900){return function(_0x278be7){if(!_0x278be7){_0x46bef9[_0xaad6('0x19')](0x194);}return _0x278be7;};}function handleError(_0x1660cb,_0x519853){_0x519853=_0x519853||0x1f4;return function(_0x6e68df){logger['error'](_0x6e68df['stack']);if(_0x6e68df['name']){delete _0x6e68df[_0xaad6('0x28')];}_0x1660cb[_0xaad6('0x1a')](_0x519853)['send'](_0x6e68df);};}exports[_0xaad6('0x29')]=function(_0x2b512b,_0x1f564b){var _0x2324be={},_0x1c3e68={},_0x175ba3={'count':0x0,'rows':[]};var _0x149e91=_[_0xaad6('0x2a')](db[_0xaad6('0x2b')][_0xaad6('0x2c')],function(_0x56d6b6){return{'name':_0x56d6b6[_0xaad6('0x2d')],'type':_0x56d6b6['type'][_0xaad6('0x2e')]};});_0x1c3e68[_0xaad6('0x2f')]=_[_0xaad6('0x2a')](_0x149e91,_0xaad6('0x28'));_0x1c3e68[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0x2b512b[_0xaad6('0x30')]);_0x1c3e68[_0xaad6('0x32')]=_['intersection'](_0x1c3e68['model'],_0x1c3e68[_0xaad6('0x30')]);_0x2324be['attributes']=_['intersection'](_0x1c3e68[_0xaad6('0x2f')],qs['fields'](_0x2b512b[_0xaad6('0x30')][_0xaad6('0x33')]));_0x2324be[_0xaad6('0x34')]=_0x2324be[_0xaad6('0x34')][_0xaad6('0x35')]?_0x2324be['attributes']:_0x1c3e68[_0xaad6('0x2f')];if(!_0x2b512b[_0xaad6('0x30')][_0xaad6('0x36')](_0xaad6('0x37'))){_0x2324be['limit']=qs['limit'](_0x2b512b['query']['limit']);_0x2324be[_0xaad6('0x1e')]=qs[_0xaad6('0x1e')](_0x2b512b[_0xaad6('0x30')][_0xaad6('0x1e')]);}_0x2324be[_0xaad6('0x38')]=qs['sort'](_0x2b512b[_0xaad6('0x30')][_0xaad6('0x39')]);_0x2324be[_0xaad6('0x3a')]=qs[_0xaad6('0x32')](_['pick'](_0x2b512b[_0xaad6('0x30')],_0x1c3e68[_0xaad6('0x32')]),_0x149e91);if(_0x2b512b['query'][_0xaad6('0x3b')]){_0x2324be['where']=_['merge'](_0x2324be[_0xaad6('0x3a')],{'$or':_[_0xaad6('0x2a')](_0x149e91,function(_0x5c1a29){if(_0x5c1a29[_0xaad6('0x3c')]!==_0xaad6('0x3d')){var _0x25f37f={};_0x25f37f[_0x5c1a29['name']]={'$like':'%'+_0x2b512b[_0xaad6('0x30')]['filter']+'%'};return _0x25f37f;}})});}_0x2324be=_['merge']({},_0x2324be,_0x2b512b[_0xaad6('0x3e')]);var _0xaaf607={'where':_0x2324be[_0xaad6('0x3a')]};return db[_0xaad6('0x2b')][_0xaad6('0x1d')](_0xaaf607)['then'](function(_0x3e5631){_0x175ba3['count']=_0x3e5631;if(_0x2b512b[_0xaad6('0x30')][_0xaad6('0x3f')]){_0x2324be[_0xaad6('0x40')]=[{'all':!![]}];}return db[_0xaad6('0x2b')][_0xaad6('0x41')](_0x2324be);})[_0xaad6('0x27')](function(_0x6f037f){_0x175ba3['rows']=_0x6f037f;return _0x175ba3;})[_0xaad6('0x27')](respondWithFilteredResult(_0x1f564b,_0x2324be))[_0xaad6('0x42')](handleError(_0x1f564b,null));};exports[_0xaad6('0x43')]=function(_0xbf008,_0x2e3641){var _0x201f5b={'raw':!![],'where':{'id':_0xbf008[_0xaad6('0x44')]['id']}},_0x152a40={};_0x152a40[_0xaad6('0x2f')]=_[_0xaad6('0x31')](db[_0xaad6('0x2b')][_0xaad6('0x2c')]);_0x152a40[_0xaad6('0x30')]=_[_0xaad6('0x31')](_0xbf008[_0xaad6('0x30')]);_0x152a40['filters']=_[_0xaad6('0x45')](_0x152a40[_0xaad6('0x2f')],_0x152a40[_0xaad6('0x30')]);_0x201f5b['attributes']=_[_0xaad6('0x45')](_0x152a40[_0xaad6('0x2f')],qs[_0xaad6('0x33')](_0xbf008[_0xaad6('0x30')][_0xaad6('0x33')]));_0x201f5b['attributes']=_0x201f5b[_0xaad6('0x34')][_0xaad6('0x35')]?_0x201f5b['attributes']:_0x152a40[_0xaad6('0x2f')];if(_0xbf008[_0xaad6('0x30')][_0xaad6('0x3f')]){_0x201f5b[_0xaad6('0x40')]=[{'all':!![]}];}_0x201f5b=_[_0xaad6('0x46')]({},_0x201f5b,_0xbf008[_0xaad6('0x3e')]);return db[_0xaad6('0x2b')][_0xaad6('0x47')](_0x201f5b)[_0xaad6('0x27')](handleEntityNotFound(_0x2e3641,null))[_0xaad6('0x27')](respondWithResult(_0x2e3641,null))['catch'](handleError(_0x2e3641,null));};exports[_0xaad6('0x48')]=function(_0x581a18,_0x53ebea){return db[_0xaad6('0x2b')][_0xaad6('0x48')](_0x581a18[_0xaad6('0x49')],{})[_0xaad6('0x27')](respondWithResult(_0x53ebea,0xc9))['catch'](handleError(_0x53ebea,null));};exports['update']=function(_0x3717b4,_0x4aefb9){if(_0x3717b4['body']['id']){delete _0x3717b4[_0xaad6('0x49')]['id'];}return db[_0xaad6('0x2b')]['find']({'where':{'id':_0x3717b4['params']['id']}})['then'](handleEntityNotFound(_0x4aefb9,null))['then'](saveUpdates(_0x3717b4['body'],null))[_0xaad6('0x27')](respondWithResult(_0x4aefb9,null))[_0xaad6('0x42')](handleError(_0x4aefb9,null));};exports[_0xaad6('0x26')]=function(_0x21021c,_0x51a0f1){return db[_0xaad6('0x2b')]['find']({'where':{'id':_0x21021c[_0xaad6('0x44')]['id']}})[_0xaad6('0x27')](handleEntityNotFound(_0x51a0f1,null))[_0xaad6('0x27')](removeEntity(_0x51a0f1,null))['catch'](handleError(_0x51a0f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 78cbf8b..d2893ed 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 _0x7d86=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise'];(function(_0x26707f,_0x2bcfd5){var _0x3a19df=function(_0x2124cd){while(--_0x2124cd){_0x26707f['push'](_0x26707f['shift']());}};_0x3a19df(++_0x2bcfd5);}(_0x7d86,0x1f3));var _0x67d8=function(_0x3f4bea,_0x16b7d2){_0x3f4bea=_0x3f4bea-0x0;var _0x2cff0c=_0x7d86[_0x3f4bea];return _0x2cff0c;};'use strict';var _=require(_0x67d8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x67d8('0x1'));var moment=require(_0x67d8('0x2'));var BPromise=require(_0x67d8('0x3'));var rp=require(_0x67d8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67d8('0x5'));var config=require(_0x67d8('0x6'));var attributes=require(_0x67d8('0x7'));module[_0x67d8('0x8')]=function(_0x58943f,_0x1b804a){return _0x58943f[_0x67d8('0x9')](_0x67d8('0xa'),attributes,{'tableName':_0x67d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x67d8('0xc'),'collate':_0x67d8('0xd')});}; \ No newline at end of file +var _0xd642=['rimraf','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0xd642,0x89));var _0x2d64=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xd642[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x2d64('0x0'));var util=require(_0x2d64('0x1'));var logger=require(_0x2d64('0x2'))(_0x2d64('0x3'));var moment=require('moment');var BPromise=require(_0x2d64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d64('0x5'));var rimraf=require(_0x2d64('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d64('0x7'));module[_0x2d64('0x8')]=function(_0x4cdeca,_0x476c05){return _0x4cdeca[_0x2d64('0x9')]('WhatsappApplication',attributes,{'tableName':_0x2d64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d64('0xb'),'collate':_0x2d64('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 4617cd2..d806bdd 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 _0x199c=['then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0xf753ac,_0x19b4fc){var _0x5dc554=function(_0x4aaded){while(--_0x4aaded){_0xf753ac['push'](_0xf753ac['shift']());}};_0x5dc554(++_0x19b4fc);}(_0x199c,0x1d8));var _0xc199=function(_0x26c132,_0x104b47){_0x26c132=_0x26c132-0x0;var _0x5ab720=_0x199c[_0x26c132];return _0x5ab720;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc199('0x0'));var BPromise=require(_0xc199('0x1'));var rs=require(_0xc199('0x2'));var fs=require('fs');var Redis=require(_0xc199('0x3'));var db=require(_0xc199('0x4'))['db'];var utils=require(_0xc199('0x5'));var logger=require(_0xc199('0x6'))(_0xc199('0x7'));var config=require('../../config/environment');var jayson=require(_0xc199('0x8'));var client=jayson[_0xc199('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd9cb,_0xc2b40a,_0x126236){return new BPromise(function(_0x12d6df,_0x2619ea){return client[_0xc199('0xa')](_0x4cd9cb,_0x126236)[_0xc199('0xb')](function(_0x211733){logger[_0xc199('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0xc2b40a,_0xc199('0xd'));logger[_0xc199('0xe')](_0xc199('0xf'),_0xc2b40a,_0xc199('0xd'),JSON[_0xc199('0x10')](_0x211733));if(_0x211733[_0xc199('0x11')]){if(_0x211733['error'][_0xc199('0x12')]===0x1f4){logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x211733[_0xc199('0x11')][_0xc199('0x14')]);return _0x2619ea(_0x211733['error'][_0xc199('0x14')]);}logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x211733[_0xc199('0x11')][_0xc199('0x14')]);return _0x12d6df(_0x211733['error']['message']);}else{logger[_0xc199('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0xc2b40a,_0xc199('0xd'));_0x12d6df(_0x211733[_0xc199('0x15')]['message']);}})[_0xc199('0x16')](function(_0x4f268d){logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x4f268d);_0x2619ea(_0x4f268d);});});} \ No newline at end of file +var _0x7ed1=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x7ed1,0xca));var _0x17ed=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x7ed1[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0x17ed('0x0'));var util=require('util');var moment=require(_0x17ed('0x1'));var BPromise=require(_0x17ed('0x2'));var rs=require(_0x17ed('0x3'));var fs=require('fs');var Redis=require(_0x17ed('0x4'));var db=require(_0x17ed('0x5'))['db'];var utils=require(_0x17ed('0x6'));var logger=require('../../config/logger')(_0x17ed('0x7'));var config=require(_0x17ed('0x8'));var jayson=require(_0x17ed('0x9'));var client=jayson[_0x17ed('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566a07,_0x3f6dca,_0x408fc2){return new BPromise(function(_0xcd3d39,_0x6e2d89){return client['request'](_0x566a07,_0x408fc2)[_0x17ed('0xb')](function(_0x321cd2){logger[_0x17ed('0xc')](_0x17ed('0xd'),_0x3f6dca,_0x17ed('0xe'));logger[_0x17ed('0xf')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x3f6dca,_0x17ed('0xe'),JSON['stringify'](_0x321cd2));if(_0x321cd2['error']){if(_0x321cd2[_0x17ed('0x10')][_0x17ed('0x11')]===0x1f4){logger[_0x17ed('0x10')](_0x17ed('0xd'),_0x3f6dca,_0x321cd2[_0x17ed('0x10')]['message']);return _0x6e2d89(_0x321cd2[_0x17ed('0x10')][_0x17ed('0x12')]);}logger[_0x17ed('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x3f6dca,_0x321cd2[_0x17ed('0x10')]['message']);return _0xcd3d39(_0x321cd2['error'][_0x17ed('0x12')]);}else{logger['info'](_0x17ed('0xd'),_0x3f6dca,_0x17ed('0xe'));_0xcd3d39(_0x321cd2[_0x17ed('0x13')][_0x17ed('0x12')]);}})['catch'](function(_0x897d4b){logger[_0x17ed('0x10')](_0x17ed('0xd'),_0x3f6dca,_0x897d4b);_0x6e2d89(_0x897d4b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 22e4598..81efecd 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 _0xf3d2=['./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31b9b9,_0x52195e){var _0x3af70f=function(_0x57ad86){while(--_0x57ad86){_0x31b9b9['push'](_0x31b9b9['shift']());}};_0x3af70f(++_0x52195e);}(_0xf3d2,0x1d3));var _0x2f3d=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0xf3d2[_0x1c73ee];return _0x154f05;};'use strict';var multer=require(_0x2f3d('0x0'));var util=require(_0x2f3d('0x1'));var path=require(_0x2f3d('0x2'));var timeout=require(_0x2f3d('0x3'));var express=require(_0x2f3d('0x4'));var router=express[_0x2f3d('0x5')]();var auth=require(_0x2f3d('0x6'));var interaction=require(_0x2f3d('0x7'));var config=require(_0x2f3d('0x8'));var controller=require(_0x2f3d('0x9'));router[_0x2f3d('0xa')]('/',auth[_0x2f3d('0xb')](),controller[_0x2f3d('0xc')]);router[_0x2f3d('0xa')](_0x2f3d('0xd'),auth[_0x2f3d('0xb')](),controller[_0x2f3d('0xe')]);router[_0x2f3d('0xa')]('/:id',auth[_0x2f3d('0xb')](),controller[_0x2f3d('0xf')]);router[_0x2f3d('0xa')](_0x2f3d('0x10'),auth[_0x2f3d('0xb')](),controller[_0x2f3d('0x11')]);router['get'](_0x2f3d('0x12'),auth['isAuthenticated'](),controller['download']);router[_0x2f3d('0x13')]('/',auth['isAuthenticated'](),controller[_0x2f3d('0x14')]);router[_0x2f3d('0x13')]('/:id/messages',auth[_0x2f3d('0xb')](),controller[_0x2f3d('0x15')]);router[_0x2f3d('0x13')]('/:id/tags',auth[_0x2f3d('0xb')](),interaction[_0x2f3d('0x16')](_0x2f3d('0x17'),_0x2f3d('0x18')),controller[_0x2f3d('0x19')]);router[_0x2f3d('0x1a')](_0x2f3d('0x1b'),auth[_0x2f3d('0xb')](),interaction['tracked'](_0x2f3d('0x17'),_0x2f3d('0x1c')),controller[_0x2f3d('0x1d')]);router[_0x2f3d('0x1e')](_0x2f3d('0x1b'),auth[_0x2f3d('0xb')](),interaction[_0x2f3d('0x16')](_0x2f3d('0x17'),_0x2f3d('0x1f')),controller[_0x2f3d('0x20')]);router['delete'](_0x2f3d('0x21'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x52c3=['post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','multer','path','connect-timeout','Router','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x2219a2,_0x37d194){var _0x3e4a29=function(_0x1da431){while(--_0x1da431){_0x2219a2['push'](_0x2219a2['shift']());}};_0x3e4a29(++_0x37d194);}(_0x52c3,0x151));var _0x352c=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0x52c3[_0x27c068];return _0xe5a67f;};'use strict';var multer=require(_0x352c('0x0'));var util=require('util');var path=require(_0x352c('0x1'));var timeout=require(_0x352c('0x2'));var express=require('express');var router=express[_0x352c('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x352c('0x4'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x352c('0x5')](),controller[_0x352c('0x6')]);router['get']('/describe',auth[_0x352c('0x5')](),controller['describe']);router[_0x352c('0x7')](_0x352c('0x8'),auth['isAuthenticated'](),controller[_0x352c('0x9')]);router[_0x352c('0x7')](_0x352c('0xa'),auth[_0x352c('0x5')](),controller[_0x352c('0xb')]);router['get'](_0x352c('0xc'),auth[_0x352c('0x5')](),controller[_0x352c('0xd')]);router[_0x352c('0xe')]('/',auth[_0x352c('0x5')](),controller[_0x352c('0xf')]);router[_0x352c('0xe')](_0x352c('0xa'),auth[_0x352c('0x5')](),controller[_0x352c('0x10')]);router[_0x352c('0xe')](_0x352c('0x11'),auth[_0x352c('0x5')](),interaction[_0x352c('0x12')]('whatsapp',_0x352c('0x13')),controller[_0x352c('0x14')]);router['put']('/:id',auth[_0x352c('0x5')](),interaction[_0x352c('0x12')](_0x352c('0x15'),_0x352c('0x16')),controller[_0x352c('0x17')]);router['delete'](_0x352c('0x8'),auth[_0x352c('0x5')](),interaction['tracked'](_0x352c('0x15'),_0x352c('0x18')),controller[_0x352c('0x19')]);router[_0x352c('0x1a')]('/:id/tags',auth[_0x352c('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b1e6b6e..be9f061 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 _0xb11e=['moment','exports','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x7a7529,_0x1c6b42){var _0x1648b0=function(_0x5b1062){while(--_0x5b1062){_0x7a7529['push'](_0x7a7529['shift']());}};_0x1648b0(++_0x1c6b42);}(_0xb11e,0x7d));var _0xeb11=function(_0x4afa99,_0x455051){_0x4afa99=_0x4afa99-0x0;var _0x2dc99f=_0xb11e[_0x4afa99];return _0x2dc99f;};'use strict';var Sequelize=require(_0xeb11('0x0'));var moment=require(_0xeb11('0x1'));module[_0xeb11('0x2')]={'closed':{'type':Sequelize[_0xeb11('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeb11('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xeb11('0x5')]},'note':{'type':Sequelize[_0xeb11('0x5')]},'phone':{'type':Sequelize[_0xeb11('0x5')]},'read1stAt':{'type':Sequelize[_0xeb11('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb11('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb11('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5aba=['ENUM','sequelize','BOOLEAN','STRING'];(function(_0x427697,_0x2a395c){var _0x159793=function(_0x5d9152){while(--_0x5d9152){_0x427697['push'](_0x427697['shift']());}};_0x159793(++_0x2a395c);}(_0x5aba,0x69));var _0xa5ab=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x5aba[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0xa5ab('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xa5ab('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa5ab('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa5ab('0x2')]},'note':{'type':Sequelize[_0xa5ab('0x2')]},'phone':{'type':Sequelize[_0xa5ab('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa5ab('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 035f4b4..9fd7b9c 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 _0xa0e5=['compact','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','WhatsappInteractionId','all','rows','show','params','attributes','includeAll','options','create','describe','addMessage','WhatsappMessage','ids','omit','findOne','pick','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','YYYY-MM-DD','closed','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','renderFile','downloadInteraction.html','toFile','.pdf','download','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','./whatsappInteraction.socket','register','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','WhatsappInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','User','operator','buildExpression','body','some'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0xa0e5,0x7d));var _0x5a0e=function(_0x3f882c,_0x28690c){_0x3f882c=_0x3f882c-0x0;var _0x5d82a3=_0xa0e5[_0x3f882c];return _0x5d82a3;};'use strict';var pdf=require(_0x5a0e('0x0'));var emlformat=require(_0x5a0e('0x1'));var rimraf=require(_0x5a0e('0x2'));var zipdir=require(_0x5a0e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a0e('0x4'));var moment=require(_0x5a0e('0x5'));var BPromise=require(_0x5a0e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5a0e('0x7'));var csv=require(_0x5a0e('0x8'));var ejs=require(_0x5a0e('0x9'));var fs=require('fs');var _=require(_0x5a0e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a0e('0xb'));var deskjs=require(_0x5a0e('0xc'));var toCsv=require(_0x5a0e('0x8'));var querystring=require(_0x5a0e('0xd'));var Papa=require(_0x5a0e('0xe'));var Redis=require(_0x5a0e('0xf'));var authService=require(_0x5a0e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5a0e('0x11'));var hardwareService=require(_0x5a0e('0x12'));var logger=require(_0x5a0e('0x13'))(_0x5a0e('0x14'));var utils=require('../../config/utils');var config=require(_0x5a0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a0e('0x16'))['db'];config['redis']=_['defaults'](config[_0x5a0e('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a0e('0x17')]));require(_0x5a0e('0x18'))[_0x5a0e('0x19')](socket);function respondWithStatusCode(_0x32f67a,_0x1c0c29){_0x1c0c29=_0x1c0c29||0xcc;return function(_0x1a90a9){if(_0x1a90a9){return _0x32f67a[_0x5a0e('0x1a')](_0x1c0c29);}return _0x32f67a[_0x5a0e('0x1b')](_0x1c0c29)[_0x5a0e('0x1c')]();};}function respondWithResult(_0x2b19e8,_0x41db37){_0x41db37=_0x41db37||0xc8;return function(_0x191542){if(_0x191542){return _0x2b19e8['status'](_0x41db37)['json'](_0x191542);}};}function respondWithFilteredResult(_0x2e6680,_0x294a16){return function(_0x346ad4){if(_0x346ad4){var _0x5b6b57=_0x346ad4[_0x5a0e('0x1d')],_0x14508c=_0x294a16['offset'],_0x1e06a1=_0x294a16[_0x5a0e('0x1e')]+_0x294a16['limit'],_0x106a09;if(_0x1e06a1>=_0x5b6b57){_0x1e06a1=_0x5b6b57;_0x106a09=0xc8;}else{_0x106a09=0xce;}_0x2e6680[_0x5a0e('0x1b')](_0x106a09);return _0x2e6680['set'](_0x5a0e('0x1f'),_0x14508c+'-'+_0x1e06a1+'/'+_0x5b6b57)[_0x5a0e('0x20')](_0x346ad4);}return null;};}function patchUpdates(_0x433515){return function(_0x2b5012){try{jsonpatch[_0x5a0e('0x21')](_0x2b5012,_0x433515,!![]);}catch(_0x22c63d){return BPromise[_0x5a0e('0x22')](_0x22c63d);}return _0x2b5012[_0x5a0e('0x23')]();};}function saveUpdates(_0x1d0afc,_0x2ce9e4){return function(_0x4a8877){if(_0x4a8877){return _0x4a8877[_0x5a0e('0x24')](_0x1d0afc)[_0x5a0e('0x25')](function(_0x36eb5a){return _0x36eb5a;});}return null;};}function removeEntity(_0x46f411,_0x10e739){return function(_0x167149){if(_0x167149){return _0x167149[_0x5a0e('0x26')]()[_0x5a0e('0x25')](function(){_0x46f411['status'](0xcc)[_0x5a0e('0x1c')]();});}};}function handleEntityNotFound(_0x52d5b9,_0x5059f3){return function(_0x8550ca){if(!_0x8550ca){_0x52d5b9[_0x5a0e('0x1a')](0x194);}return _0x8550ca;};}function handleError(_0x2a510a,_0x5499c6){_0x5499c6=_0x5499c6||0x1f4;return function(_0x2f4d8a){logger[_0x5a0e('0x27')](_0x2f4d8a[_0x5a0e('0x28')]);if(_0x2f4d8a[_0x5a0e('0x29')]){delete _0x2f4d8a[_0x5a0e('0x29')];}_0x2a510a[_0x5a0e('0x1b')](_0x5499c6)[_0x5a0e('0x2a')](_0x2f4d8a);};}function getInteractionUsers(_0xa19344,_0xa0946a){return new BPromise(function(_0xeab878,_0x428e57){try{if(_0xa0946a[_0xa19344['id']]){_0xa19344[_0x5a0e('0x2b')]=_['map'](_0xa0946a[_0xa19344['id']],function(_0x217227){return{'id':_0x217227['id'],'fullname':_0x217227[_0x5a0e('0x2c')]};});}}catch(_0x2a53b2){_0x428e57(_0x2a53b2);}_0xeab878(_0xa19344);});}function getInteractionTags(_0x3709b1,_0x3f3de0){return new BPromise(function(_0x153b70,_0x19d115){try{if(_0x3709b1[_0x5a0e('0x2d')]){_0x3709b1[_0x5a0e('0x2e')]=[];_0x3709b1[_0x5a0e('0x2d')][_0x5a0e('0x2f')](',')[_0x5a0e('0x30')](function(_0x547daa){_0x3709b1[_0x5a0e('0x2e')][_0x5a0e('0x31')](_0x3f3de0[_0x547daa]);});}delete _0x3709b1[_0x5a0e('0x2d')];}catch(_0x170d60){_0x19d115(_0x170d60);}_0x153b70(_0x3709b1);});}function updateWhatsappInteraction(_0x4fec5e,_0x561bdf,_0x2a56b6){return new BPromise(function(_0xefee3d,_0x31eec2){return getInteractionUsers(_0x4fec5e,_0x2a56b6)['then'](function(_0x5722d0){return getInteractionTags(_0x5722d0,_0x561bdf);})[_0x5a0e('0x25')](function(_0x52d264){_0xefee3d(_0x52d264);})[_0x5a0e('0x32')](function(_0x1934ec){_0x31eec2(_0x1934ec);});});}exports['index']=function(_0x50a680,_0x2d371e){var _0x493a12={},_0x5392e5={},_0x30bf27={'count':0x0,'rows':[]};var _0x476788=_[_0x5a0e('0x33')](db[_0x5a0e('0x34')][_0x5a0e('0x35')],function(_0x3dfdac){return{'name':_0x3dfdac['fieldName'],'type':_0x3dfdac[_0x5a0e('0x36')][_0x5a0e('0x37')]};});_0x5392e5['model']=_[_0x5a0e('0x33')](_0x476788,_0x5a0e('0x29'));_0x5392e5[_0x5a0e('0x38')]=_[_0x5a0e('0x39')](_0x50a680['query']);_0x5392e5[_0x5a0e('0x3a')]=_[_0x5a0e('0x3b')](_0x5392e5[_0x5a0e('0x3c')],_0x5392e5[_0x5a0e('0x38')]);_0x493a12['attributes']=_['intersection'](_0x5392e5[_0x5a0e('0x3c')],qs['fields'](_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x3d')]));_0x493a12['attributes']=_0x493a12['attributes'][_0x5a0e('0x3e')]?_0x493a12['attributes']:_0x5392e5[_0x5a0e('0x3c')];if(!_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x3f')](_0x5a0e('0x40'))){_0x493a12['limit']=qs[_0x5a0e('0x41')](_0x50a680['query'][_0x5a0e('0x41')]);_0x493a12[_0x5a0e('0x1e')]=qs[_0x5a0e('0x1e')](_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x1e')]);}_0x493a12[_0x5a0e('0x42')]=qs[_0x5a0e('0x43')](_0x50a680[_0x5a0e('0x38')]['sort']);_0x493a12[_0x5a0e('0x44')]=qs[_0x5a0e('0x3a')](_['pick'](_0x50a680[_0x5a0e('0x38')],_0x5392e5[_0x5a0e('0x3a')]),_0x476788);var _0x386db5=[];var _0x4ed4ae=squel[_0x5a0e('0x45')]()[_0x5a0e('0x46')]('id')[_0x5a0e('0x46')]('name')[_0x5a0e('0x46')]('color')[_0x5a0e('0x47')](_0x5a0e('0x48'));var _0x406fb5=squel[_0x5a0e('0x45')]()['field'](_0x5a0e('0x49'))[_0x5a0e('0x46')](_0x5a0e('0x4a'))[_0x5a0e('0x46')](_0x5a0e('0x4b'))[_0x5a0e('0x47')](_0x5a0e('0x4c'),'ui')['left_join'](_0x5a0e('0x4d'),'u',_0x5a0e('0x4e'));var _0x2fff61=squel[_0x5a0e('0x45')]()[_0x5a0e('0x47')]('whatsapp_interactions','i')[_0x5a0e('0x4f')](_0x5a0e('0x50'),'c',_0x5a0e('0x51'))[_0x5a0e('0x4f')](_0x5a0e('0x4d'),'o','o.id\x20=\x20i.UserId')[_0x5a0e('0x4f')](_0x5a0e('0x52'),'a',_0x5a0e('0x53'))[_0x5a0e('0x4f')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x5a0e('0x54'),'it',_0x5a0e('0x55'))['left_join'](_0x5a0e('0x48'),'t',_0x5a0e('0x56'));var _0x30b07b=squel[_0x5a0e('0x57')]();var _0x1a3626=[];var _0x1ce145=squel[_0x5a0e('0x57')]();var _0x56d98b;if(_0x50a680['query'][_0x5a0e('0x58')]){_0x56d98b=as[_0x5a0e('0x59')](_0x50a680[_0x5a0e('0x38')]['search']);var _0x115015=_0x56d98b[_0x5a0e('0x5a')];for(var _0x433a35=0x0;_0x433a35<_0x56d98b[_0x5a0e('0x5b')][_0x5a0e('0x3e')];_0x433a35++){var _0x379e70=_0x56d98b[_0x5a0e('0x5b')][_0x433a35];var _0x5df9e4='i';var _0x2aa1a6=_[_0x5a0e('0x5c')](_0x476788,[_0x5a0e('0x29'),_0x379e70[_0x5a0e('0x46')]]);if(!_0x2aa1a6){switch(_0x379e70[_0x5a0e('0x46')]){case _0x5a0e('0x5d'):if(_0x379e70['value']==0x1){_0x2fff61[_0x5a0e('0x5e')]('`'+_0x379e70[_0x5a0e('0x46')]+_0x5a0e('0x5f'));}else{_0x2fff61['having']('`'+_0x379e70[_0x5a0e('0x46')]+'`\x20>\x200');}break;case'Contact':if(_0x379e70['operator']===_0x5a0e('0x60')){if(_0x379e70[_0x5a0e('0x61')][_0x5a0e('0x2f')]('\x20')[_0x5a0e('0x3e')]>0x1){_0x30b07b[_0x115015](_0x5a0e('0x62'),qs[_0x5a0e('0x63')](_0x379e70[_0x5a0e('0x61')]),null);}else{var _0x17c7d5='%'+_0x379e70[_0x5a0e('0x61')]+'%';_0x30b07b[_0x115015](_0x5a0e('0x64'),_0x17c7d5,_0x17c7d5,_0x17c7d5);}}else{_0x2aa1a6=_['find'](_0x476788,['name',_0x5a0e('0x65')]);_0x379e70[_0x5a0e('0x46')]=_0x5a0e('0x65');_0x2841e0=as['buildExpression'](_0x5df9e4,_0x2aa1a6['type'],_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0[_0x5a0e('0x61')][_0x5a0e('0x67')],_0x2841e0[_0x5a0e('0x61')]['end']);}break;case _0x5a0e('0x68'):var _0x43a434=_0x379e70['value'][_0x5a0e('0x2f')](',')[_0x5a0e('0x33')](function(_0x1feebf){return Number(_0x1feebf);});_0x43a434['forEach'](function(_0x4b94c3){_0x1ce145['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b94c3+',%');});_0x1a3626=_[_0x5a0e('0x69')](_0x1a3626,_0x43a434);break;case _0x5a0e('0x6a'):if(_0x379e70[_0x5a0e('0x6b')]===_0x5a0e('0x60')){_0x30b07b[_0x115015]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x379e70[_0x5a0e('0x61')]+'%',null);}else{_0x2aa1a6=_[_0x5a0e('0x5c')](_0x476788,[_0x5a0e('0x29'),'UserId']);_0x379e70[_0x5a0e('0x46')]='UserId';_0x2841e0=as[_0x5a0e('0x6c')](_0x5df9e4,_0x2aa1a6[_0x5a0e('0x36')],_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0[_0x5a0e('0x61')][_0x5a0e('0x67')],_0x2841e0['value'][_0x5a0e('0x1c')]);}break;case _0x5a0e('0x6d'):_0x2841e0=as[_0x5a0e('0x6c')]('me',null,_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0[_0x5a0e('0x61')]['start'],_0x2841e0[_0x5a0e('0x61')]['end']);break;}}else{var _0x2841e0=as[_0x5a0e('0x6c')](_0x5df9e4,_0x2aa1a6[_0x5a0e('0x36')],_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0['value'][_0x5a0e('0x67')],_0x2841e0['value'][_0x5a0e('0x1c')]);}}}else{var _0x37a465=_(_0x50a680[_0x5a0e('0x38')])[_0x5a0e('0x39')]()['map'](function(_0x3b1378){return _[_0x5a0e('0x6e')](_0x476788,[_0x5a0e('0x29'),_0x3b1378])?_0x3b1378:undefined;})[_0x5a0e('0x6f')]()['value']();if(!_['isEmpty'](_0x37a465)){_0x37a465[_0x5a0e('0x30')](function(_0x2e0d77){if(_0x2e0d77==='WhatsappAccountId'){_0x2fff61[_0x5a0e('0x44')](_0x5a0e('0x70'),[][_0x5a0e('0x71')](_0x50a680[_0x5a0e('0x38')][_0x2e0d77]));}else if(_0x2e0d77==='createdAt'){var _0x519a47=JSON[_0x5a0e('0x72')](_0x50a680[_0x5a0e('0x38')][_0x2e0d77])[_0x5a0e('0x73')];var _0x1ebbf5=JSON['parse'](_0x50a680[_0x5a0e('0x38')][_0x2e0d77])[_0x5a0e('0x74')];_0x2fff61[_0x5a0e('0x44')](_0x5a0e('0x75'),_0x519a47,_0x1ebbf5);}else{if(_0x50a680[_0x5a0e('0x38')][_0x2e0d77]===_0x5a0e('0x76')){_0x2fff61['where']('i.'+_0x2e0d77+_0x5a0e('0x77'));}else{_0x2fff61['where']('i.'+_0x2e0d77+_0x5a0e('0x78'),_0x50a680[_0x5a0e('0x38')][_0x2e0d77]);}}});}if(_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x79')]){if(_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x79')]==0x1){_0x2fff61[_0x5a0e('0x5e')](_0x5a0e('0x7a'));}else{_0x2fff61[_0x5a0e('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x50a680[_0x5a0e('0x38')]['tag']){_0x1a3626=_[_0x5a0e('0x7b')](_0x50a680[_0x5a0e('0x38')]['tag'])?_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x7c')]:new Array(_0x50a680['query'][_0x5a0e('0x7c')]);_0x1a3626['forEach'](function(_0x3cfbb5){_0x1ce145['or'](_0x5a0e('0x7d'),'%,'+_0x3cfbb5+',%');});}if(_0x50a680[_0x5a0e('0x38')]['filter']){var _0x7f5d1e=_0x50a680[_0x5a0e('0x38')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5a0e('0x7e')](_0x7f5d1e)){_0x30b07b['or']('i.id\x20LIKE\x20?',_0x7f5d1e+'%')['or'](_0x5a0e('0x7f'),_0x7f5d1e+'%');}else{_0x30b07b['or'](_0x5a0e('0x80'),qs[_0x5a0e('0x63')](_0x7f5d1e))['or'](_0x5a0e('0x81'),_0x7f5d1e+'%');}}}_0x2fff61['where'](_0x30b07b);_0x2fff61['group'](_0x5a0e('0x82'));var _0x2358a8={'type':db[_0x5a0e('0x83')]['QueryTypes'][_0x5a0e('0x84')],'raw':!![]};var _0x1ad302=_0x2fff61[_0x5a0e('0x85')]();_0x1ad302[_0x5a0e('0x46')](_0x5a0e('0x82'));_0x1ad302['field'](_0x5a0e('0x86'),_0x5a0e('0x5d'));if(_0x493a12['order']){_0x493a12[_0x5a0e('0x42')][_0x5a0e('0x30')](function(_0x36817c){var _0x443cf7=_0x36817c[0x0]===_0x5a0e('0x87')?_0x36817c[0x0]:'i.'+_0x36817c[0x0];_0x2fff61[_0x5a0e('0x42')](_0x443cf7,_0x36817c[0x1]===_0x5a0e('0x88')?![]:!![]);});}if(!_[_0x5a0e('0x89')](_0x1a3626)){_0x2fff61[_0x5a0e('0x5e')](_0x1ce145);_0x1ad302[_0x5a0e('0x44')]('t.id\x20IN\x20?',_0x1a3626);}BPromise[_0x5a0e('0x8a')]()[_0x5a0e('0x25')](function(){if(!_0x56d98b){if(_0x50a680[_0x5a0e('0x38')]['WhatsappAccountId']||_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x8b')])return;_0x1ad302[_0x5a0e('0x44')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x2fff61['where'](_0x5a0e('0x8c'));return;}if(_0x50a680[_0x5a0e('0x8d')][_0x5a0e('0x8e')]!=='agent')return;return _0x50a680[_0x5a0e('0x8d')][_0x5a0e('0x8f')]({'attributes':['id'],'raw':!![]})[_0x5a0e('0x25')](function(_0x9bb5df){if(_[_0x5a0e('0x89')](_0x9bb5df)){_0x1ad302[_0x5a0e('0x44')](_0x5a0e('0x90'));_0x2fff61[_0x5a0e('0x44')](_0x5a0e('0x90'));}else{_0x1ad302[_0x5a0e('0x44')](_0x5a0e('0x70'),_['map'](_0x9bb5df,'id'));_0x2fff61['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x5a0e('0x33')](_0x9bb5df,'id'));}});})['then'](function(){if(_0x50a680['user'][_0x5a0e('0x8e')]===_0x5a0e('0x91')&&!_0x56d98b&&!_0x50a680['query']['WhatsappAccountId'])return[];return db['sequelize'][_0x5a0e('0x38')](_0x1ad302[_0x5a0e('0x92')](),_0x2358a8);})['then'](function(_0x217892){_0x30bf27[_0x5a0e('0x1d')]=_0x217892[_0x5a0e('0x3e')];if(_0x30bf27['count']===0x0)return[];return db['sequelize'][_0x5a0e('0x38')](_0x4ed4ae[_0x5a0e('0x92')](),_0x2358a8)['then'](function(_0x14b2d0){_0x386db5=_['keyBy'](_0x14b2d0,'id');_0x2358a8=_[_0x5a0e('0x93')](_0x2358a8,{'model':db[_0x5a0e('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50a680[_0x5a0e('0x38')]['fields']){_0x493a12['attributes']['forEach'](function(_0x400172){_0x2fff61[_0x5a0e('0x46')]('i.'+_0x400172);});}else{_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x86'),_0x5a0e('0x5d'));_0x2fff61['field'](_0x5a0e('0x94'),'Account.key');_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x95'),_0x5a0e('0x96'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x97'),_0x5a0e('0x87'));_0x2fff61['field'](_0x5a0e('0x98'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x99'),_0x5a0e('0x9a'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x9b'),_0x5a0e('0x9c'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x9d'),_0x5a0e('0x9e'));_0x2fff61['field']('c.phone',_0x5a0e('0x9f'));_0x2fff61['field'](_0x5a0e('0xa0'),_0x5a0e('0xa1'));_0x2fff61['field'](_0x5a0e('0xa2'),_0x5a0e('0xa3'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0xa4'),_0x5a0e('0xa5'));_0x2fff61['field']('o.internal',_0x5a0e('0xa6'));_0x2fff61['field'](_0x5a0e('0xa7'),_0x5a0e('0x2d'));}if(_0x493a12[_0x5a0e('0x41')])_0x2fff61[_0x5a0e('0x41')](_0x493a12[_0x5a0e('0x41')]);if(_0x493a12[_0x5a0e('0x1e')])_0x2fff61[_0x5a0e('0x1e')](_0x493a12[_0x5a0e('0x1e')]);return db[_0x5a0e('0xa8')][_0x5a0e('0x38')](_0x2fff61[_0x5a0e('0x92')](),_0x2358a8);})['then'](function(_0x52145b){_0x406fb5[_0x5a0e('0x44')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x5a0e('0x33')](_0x52145b,'id'));return db[_0x5a0e('0xa8')]['query'](_0x406fb5[_0x5a0e('0x92')](),_0x2358a8)[_0x5a0e('0x25')](function(_0xe624a8){var _0x302c34=_[_0x5a0e('0xa9')](_0xe624a8,_0x5a0e('0xaa'));var _0x4a7cbf=[];_0x52145b[_0x5a0e('0x30')](function(_0x45d7e3){_0x4a7cbf[_0x5a0e('0x31')](updateWhatsappInteraction(_0x45d7e3,_0x386db5,_0x302c34));});return BPromise[_0x5a0e('0xab')](_0x4a7cbf);});});})[_0x5a0e('0x25')](function(_0x1da970){_0x30bf27[_0x5a0e('0xac')]=_0x1da970;return _0x30bf27;})[_0x5a0e('0x25')](respondWithFilteredResult(_0x2d371e,_0x493a12))[_0x5a0e('0x32')](handleError(_0x2d371e,null));};exports[_0x5a0e('0xad')]=function(_0x309d27,_0x531b45){var _0x52171e={'raw':![],'where':{'id':_0x309d27[_0x5a0e('0xae')]['id']}},_0x301460={};_0x301460[_0x5a0e('0x3c')]=_['keys'](db[_0x5a0e('0x34')][_0x5a0e('0x35')]);_0x301460[_0x5a0e('0x38')]=_[_0x5a0e('0x39')](_0x309d27['query']);_0x301460[_0x5a0e('0x3a')]=_[_0x5a0e('0x3b')](_0x301460[_0x5a0e('0x3c')],_0x301460[_0x5a0e('0x38')]);_0x52171e['attributes']=_[_0x5a0e('0x3b')](_0x301460['model'],qs[_0x5a0e('0x3d')](_0x309d27['query']['fields']));_0x52171e[_0x5a0e('0xaf')]=_0x52171e[_0x5a0e('0xaf')][_0x5a0e('0x3e')]?_0x52171e['attributes']:_0x301460[_0x5a0e('0x3c')];if(_0x309d27['query'][_0x5a0e('0xb0')]){_0x52171e['include']=[{'all':!![]}];}_0x52171e=_[_0x5a0e('0x93')]({},_0x52171e,_0x309d27[_0x5a0e('0xb1')]);return db[_0x5a0e('0x34')][_0x5a0e('0x5c')](_0x52171e)[_0x5a0e('0x25')](handleEntityNotFound(_0x531b45,null))[_0x5a0e('0x25')](respondWithResult(_0x531b45,null))[_0x5a0e('0x32')](handleError(_0x531b45,null));};exports[_0x5a0e('0xb2')]=function(_0x234b0e,_0x236401){return db[_0x5a0e('0x34')][_0x5a0e('0xb2')](_0x234b0e[_0x5a0e('0x6d')],{})[_0x5a0e('0x25')](respondWithResult(_0x236401,0xc9))[_0x5a0e('0x32')](handleError(_0x236401,null));};exports[_0x5a0e('0x24')]=function(_0x1b5927,_0x1ea37f){if(_0x1b5927[_0x5a0e('0x6d')]['id']){delete _0x1b5927[_0x5a0e('0x6d')]['id'];}return db[_0x5a0e('0x34')]['find']({'where':{'id':_0x1b5927[_0x5a0e('0xae')]['id']}})['then'](handleEntityNotFound(_0x1ea37f,null))[_0x5a0e('0x25')](saveUpdates(_0x1b5927[_0x5a0e('0x6d')],null))[_0x5a0e('0x25')](respondWithResult(_0x1ea37f,null))[_0x5a0e('0x32')](handleError(_0x1ea37f,null));};exports[_0x5a0e('0x26')]=function(_0x3efdfe,_0x1388e1){return db['WhatsappInteraction'][_0x5a0e('0x5c')]({'where':{'id':_0x3efdfe[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x1388e1,null))[_0x5a0e('0x25')](removeEntity(_0x1388e1,null))[_0x5a0e('0x32')](handleError(_0x1388e1,null));};exports[_0x5a0e('0xb3')]=function(_0x17f3ca,_0x181f07){return db[_0x5a0e('0x34')][_0x5a0e('0xb3')]()[_0x5a0e('0x25')](respondWithResult(_0x181f07,null))[_0x5a0e('0x32')](handleError(_0x181f07,null));};exports[_0x5a0e('0xb4')]=function(_0x3fc901,_0x3140f0,_0x495d85){return db[_0x5a0e('0xb5')]['find']({'where':{'id':_0x3fc901[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x3140f0,null))[_0x5a0e('0x25')](function(_0x26e314){if(_0x26e314){return _0x26e314[_0x5a0e('0xb4')](_0x3fc901[_0x5a0e('0x6d')][_0x5a0e('0xb6')],_[_0x5a0e('0xb7')](_0x3fc901[_0x5a0e('0x6d')],[_0x5a0e('0xb6'),'id'])||{});}})[_0x5a0e('0x25')](respondWithResult(_0x3140f0,null))[_0x5a0e('0x32')](handleError(_0x3140f0,null));};exports['getMessages']=function(_0x179775,_0x3c3966,_0x262486){var _0x38d79e={'raw':![],'where':{}};var _0x426c8b={};var _0x37b930={'count':0x0,'rows':[]};return db[_0x5a0e('0x34')][_0x5a0e('0xb8')]({'where':{'id':_0x179775[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x3c3966,null))['then'](function(_0x3d8b4a){if(_0x3d8b4a){_0x426c8b[_0x5a0e('0x3c')]=_[_0x5a0e('0x39')](db[_0x5a0e('0xb5')]['rawAttributes']);_0x426c8b[_0x5a0e('0x38')]=_[_0x5a0e('0x39')](_0x179775[_0x5a0e('0x38')]);_0x426c8b[_0x5a0e('0x3a')]=_[_0x5a0e('0x3b')](_0x426c8b[_0x5a0e('0x3c')],_0x426c8b[_0x5a0e('0x38')]);_0x38d79e[_0x5a0e('0xaf')]=_[_0x5a0e('0x3b')](_0x426c8b[_0x5a0e('0x3c')],qs[_0x5a0e('0x3d')](_0x179775[_0x5a0e('0x38')]['fields']));_0x38d79e[_0x5a0e('0xaf')]=_0x38d79e[_0x5a0e('0xaf')][_0x5a0e('0x3e')]?_0x38d79e[_0x5a0e('0xaf')]:_0x426c8b[_0x5a0e('0x3c')];if(!_0x179775[_0x5a0e('0x38')][_0x5a0e('0x3f')](_0x5a0e('0x40'))){_0x38d79e[_0x5a0e('0x41')]=qs[_0x5a0e('0x41')](_0x179775[_0x5a0e('0x38')]['limit']);_0x38d79e['offset']=qs['offset'](_0x179775['query'][_0x5a0e('0x1e')]);}_0x38d79e['order']=qs['sort'](_0x179775[_0x5a0e('0x38')][_0x5a0e('0x43')]);_0x38d79e['where']=qs['filters'](_[_0x5a0e('0xb9')](_0x179775[_0x5a0e('0x38')],_0x426c8b[_0x5a0e('0x3a')]));_0x38d79e['where']['WhatsappInteractionId']=_0x3d8b4a['id'];if(_0x179775[_0x5a0e('0x38')]['filter']){_0x38d79e['where']=_['merge'](_0x38d79e[_0x5a0e('0x44')],{'$or':_[_0x5a0e('0x33')](_0x38d79e[_0x5a0e('0xaf')],function(_0x3c06fa){var _0x48a280={};_0x48a280[_0x3c06fa]={'$like':'%'+_0x179775['query'][_0x5a0e('0xba')]+'%'};return _0x48a280;})});}if(_0x179775[_0x5a0e('0x38')][_0x5a0e('0x73')]){var _0x202cae=_0x179775[_0x5a0e('0x38')][_0x5a0e('0x73')]['split'](',');var _0x42bb69={};_0x42bb69[_0x202cae[0x0]]={'$gte':moment(_0x202cae[0x1])[_0x5a0e('0xbb')](_0x5a0e('0xbc'))};_0x38d79e[_0x5a0e('0x44')]=_[_0x5a0e('0x93')](_0x38d79e['where'],_0x42bb69);}_0x38d79e=_[_0x5a0e('0x93')]({},_0x38d79e,_0x179775[_0x5a0e('0xb1')]);return db[_0x5a0e('0xb5')][_0x5a0e('0x1d')]({'where':_0x38d79e[_0x5a0e('0x44')]})[_0x5a0e('0x25')](function(_0x2164e3){_0x37b930[_0x5a0e('0x1d')]=_0x2164e3;if(_0x179775['query'][_0x5a0e('0xb0')]){_0x38d79e['include']=[{'all':!![]}];}return db[_0x5a0e('0xb5')][_0x5a0e('0xbd')](_0x38d79e);})[_0x5a0e('0x25')](function(_0x112914){_0x37b930[_0x5a0e('0xac')]=_0x112914;return _0x37b930;});}})['then'](respondWithFilteredResult(_0x3c3966,_0x38d79e))['catch'](handleError(_0x3c3966,null));};exports['addTags']=function(_0x590ca7,_0x1b0943,_0x13ef5d){return db[_0x5a0e('0x34')][_0x5a0e('0x5c')]({'where':{'id':_0x590ca7['params']['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x1b0943,null))[_0x5a0e('0x25')](function(_0x41eb67){if(_0x41eb67){return _0x41eb67[_0x5a0e('0xbe')](_0x590ca7[_0x5a0e('0x6d')][_0x5a0e('0xb6')],_[_0x5a0e('0xb7')](_0x590ca7[_0x5a0e('0x6d')],[_0x5a0e('0xb6'),'id'])||{})[_0x5a0e('0xbf')](function(){return db['Tag']['findAll']({'attributes':['id',_0x5a0e('0x29'),_0x5a0e('0xc0')],'where':{'id':_0x590ca7['body'][_0x5a0e('0xb6')]}});})[_0x5a0e('0x25')](function(_0x35cf2c){socket[_0x5a0e('0xc1')](_0x5a0e('0xc2'),{'id':Number(_0x590ca7[_0x5a0e('0xae')]['id']),'tags':_0x35cf2c||[]});return{'id':Number(_0x590ca7[_0x5a0e('0xae')]['id']),'tags':_0x35cf2c||[]};});}})[_0x5a0e('0x25')](respondWithResult(_0x1b0943,null))[_0x5a0e('0x32')](handleError(_0x1b0943,null));};exports[_0x5a0e('0xc3')]=function(_0x361d39,_0x19cbdd,_0x492c28){return db[_0x5a0e('0x34')][_0x5a0e('0x5c')]({'where':{'id':_0x361d39[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x19cbdd,null))[_0x5a0e('0x25')](function(_0x189445){if(_0x189445){return _0x189445[_0x5a0e('0xc3')](_0x361d39[_0x5a0e('0x38')][_0x5a0e('0xb6')]);}})[_0x5a0e('0x25')](respondWithStatusCode(_0x19cbdd,null))['catch'](handleError(_0x19cbdd,null));};exports['download']=function(_0x10f3a2,_0x25ba28){var _0x366de3=moment()[_0x5a0e('0xc4')]()['toString']();var _0x4a8b63=path[_0x5a0e('0xc5')](config[_0x5a0e('0xc6')],'server',_0x5a0e('0xc7'),_0x5a0e('0xc8'));var _0x43c307=path[_0x5a0e('0xc5')](config[_0x5a0e('0xc6')],_0x5a0e('0xc9'),_0x5a0e('0xc7'),_0x5a0e('0xca'));var _0x2df01b=path[_0x5a0e('0xc5')](_0x4a8b63,_0x366de3);var _0x5b2c91=util[_0x5a0e('0xbb')]('transcript-%d-%s.zip',_0x10f3a2['params']['id'],_0x366de3);var _0x48cea1=path[_0x5a0e('0xc5')](_0x4a8b63,_0x5b2c91);var _0x270907=[];_0x270907[_0x5a0e('0x31')]({'model':db[_0x5a0e('0x6a')],'as':_0x5a0e('0x6a'),'attributes':['id',_0x5a0e('0x2c')],'raw':!![]});_0x270907['push']({'model':db[_0x5a0e('0xcb')],'as':_0x5a0e('0xcc'),'attributes':['id',_0x5a0e('0xcd'),_0x5a0e('0xce')],'raw':!![]});if(_0x10f3a2['query'][_0x5a0e('0xca')]){_0x270907[_0x5a0e('0x31')]({'model':db[_0x5a0e('0xcf')],'as':_0x5a0e('0xcf'),'raw':!![]});}var _0x3f5063=[{'model':db[_0x5a0e('0xb5')],'as':_0x5a0e('0xd0'),'attributes':['id',_0x5a0e('0x6d'),_0x5a0e('0xd1'),_0x5a0e('0xd2'),_0x5a0e('0xd3'),_0x5a0e('0x79')],'include':_0x270907}];_0x3f5063[_0x5a0e('0x31')]({'model':db['WhatsappAccount'],'as':_0x5a0e('0xd4'),'attributes':['id',_0x5a0e('0x29')]});_0x3f5063[_0x5a0e('0x31')]({'model':db[_0x5a0e('0x6a')],'as':_0x5a0e('0xd5'),'attributes':['id',_0x5a0e('0x2c')]});return db[_0x5a0e('0x34')][_0x5a0e('0x5c')]({'where':{'id':_0x10f3a2[_0x5a0e('0xae')]['id']},'include':_0x3f5063})['then'](handleEntityNotFound(_0x25ba28,null))[_0x5a0e('0x25')](function(_0x276d9f){if(_0x276d9f){var _0x4cfa96=_0x276d9f[_0x5a0e('0xd6')]({'plain':!![]});fs[_0x5a0e('0xd7')](_0x2df01b);var _0x56af6f={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x5a0e('0xd8')}},'footer':{'height':_0x5a0e('0xd9'),'contents':{'default':util['format'](_0x5a0e('0xda'),util[_0x5a0e('0xbb')]('%s\x20#%d',_0x5a0e('0xdb'),_0x4cfa96['id']),moment()[_0x5a0e('0xbb')](_0x5a0e('0xdc'))[_0x5a0e('0x92')]())}}};var _0x14c7c6={'channel':_0x5a0e('0xdb'),'account':_0x4cfa96[_0x5a0e('0xd4')][_0x5a0e('0x29')],'agent':_0x4cfa96['Owner']?_0x4cfa96['Owner'][_0x5a0e('0x2c')]:'N.A.','createdAt':moment(_0x4cfa96[_0x5a0e('0xd1')])[_0x5a0e('0xbb')](_0x5a0e('0xbc'))[_0x5a0e('0x92')](),'closedAt':_0x4cfa96[_0x5a0e('0xdd')]?moment(_0x4cfa96[_0x5a0e('0xde')])[_0x5a0e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5a0e('0x92')]():'','disposition':_0x4cfa96[_0x5a0e('0xdf')],'messages':_(_0x4cfa96[_0x5a0e('0xd0')])[_0x5a0e('0xba')]({'secret':![]})[_0x5a0e('0x33')](function(_0xa116af){if(_0xa116af[_0x5a0e('0xcf')]){var _0x3d87f9=path[_0x5a0e('0xc5')](_0x43c307,_0xa116af['Attachment'][_0x5a0e('0xe0')]);if(fs[_0x5a0e('0xe1')](_0x3d87f9)){fs[_0x5a0e('0xe2')](_0x3d87f9)['pipe'](fs[_0x5a0e('0xe3')](path[_0x5a0e('0xc5')](_0x2df01b,_0xa116af[_0x5a0e('0xcf')][_0x5a0e('0xe0')])));}}return{'date':moment(_0xa116af[_0x5a0e('0xd1')])[_0x5a0e('0xbb')](_0x5a0e('0xbc'))[_0x5a0e('0x92')](),'sender':_0xa116af['direction']===_0x5a0e('0xe4')?_0xa116af[_0x5a0e('0x6a')]?_0xa116af['User'][_0x5a0e('0x2c')]:'System':_0xa116af[_0x5a0e('0xcc')][_0x5a0e('0xcd')]+(_0xa116af[_0x5a0e('0xcc')][_0x5a0e('0xce')]?'\x20'+_0xa116af['Contact'][_0x5a0e('0xce')]:''),'body':_0xa116af[_0x5a0e('0xcf')]?_0xa116af['Attachment'][_0x5a0e('0xe0')]:_0xa116af[_0x5a0e('0x6d')],'direction':_0xa116af['direction']===_0x5a0e('0xe4')?'A':'C','secret':_0xa116af[_0x5a0e('0xd3')],'read':_0xa116af[_0x5a0e('0x79')],'attachment':_0xa116af[_0x5a0e('0xcf')]};})[_0x5a0e('0x61')]()};return ejs[_0x5a0e('0xe5')](path[_0x5a0e('0xc5')](config[_0x5a0e('0xc6')],_0x5a0e('0xc9'),'views',_0x5a0e('0xe6')),{'interaction':_0x14c7c6})['then'](function(_0x5ed9b8){return new BPromise(function(_0x4d5e72,_0x3125f6){pdf[_0x5a0e('0xb2')](_0x5ed9b8,_0x56af6f)[_0x5a0e('0xe7')](path[_0x5a0e('0xc5')](_0x2df01b,'transcript-'+_0x4cfa96['id']+'-'+_0x366de3+_0x5a0e('0xe8')),function(_0x88391a,_0x14d7e0){if(_0x88391a)return _0x3125f6(_0x88391a);_0x4d5e72(_0x14d7e0);});});})[_0x5a0e('0x25')](function(){return new BPromise(function(_0x178360,_0x21676d){zipdir(_0x2df01b,{'saveTo':_0x48cea1},function(_0x52d5f2,_0x2568eb){if(_0x52d5f2)return _0x21676d(_0x52d5f2);return _0x178360(_0x2568eb);});})[_0x5a0e('0x25')](function(){return new BPromise(function(_0x1a5be0,_0x5c5c17){rimraf(_0x2df01b,function(_0x468471){if(_0x468471)_0x5c5c17(_0x468471);return _0x1a5be0();});});})[_0x5a0e('0x25')](function(){return _0x25ba28[_0x5a0e('0xe9')](_0x48cea1,_0x5b2c91,function(_0xfeb4a3){if(_0xfeb4a3){console[_0x5a0e('0xea')](_0x5a0e('0xeb'),_0xfeb4a3);}else{fs['unlinkSync'](_0x48cea1);}});});});}else{return _0x25ba28[_0x5a0e('0x1a')](0xc8);}})[_0x5a0e('0x32')](handleError(_0x25ba28,null));}; \ No newline at end of file +var _0xf8e3=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','params','include','options','create','describe','addMessage','WhatsappMessage','ids','findOne','hasOwnProperty','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','CmContact','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','YYYY-MM-DD','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','out','System','direction','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','Contact','operator','$substring','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User'];(function(_0x54425a,_0x174718){var _0x1c796e=function(_0xd089bf){while(--_0xd089bf){_0x54425a['push'](_0x54425a['shift']());}};_0x1c796e(++_0x174718);}(_0xf8e3,0x83));var _0x3f8e=function(_0x530804,_0x44e860){_0x530804=_0x530804-0x0;var _0x3c0f69=_0xf8e3[_0x530804];return _0x3c0f69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f8e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3f8e('0x1'));var rp=require(_0x3f8e('0x2'));var moment=require(_0x3f8e('0x3'));var BPromise=require(_0x3f8e('0x4'));var Mustache=require(_0x3f8e('0x5'));var util=require(_0x3f8e('0x6'));var path=require('path');var sox=require(_0x3f8e('0x7'));var csv=require(_0x3f8e('0x8'));var ejs=require(_0x3f8e('0x9'));var fs=require('fs');var _=require(_0x3f8e('0xa'));var squel=require(_0x3f8e('0xb'));var crypto=require('crypto');var jsforce=require(_0x3f8e('0xc'));var deskjs=require(_0x3f8e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3f8e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f8e('0xf'));var as=require(_0x3f8e('0x10'));var hardwareService=require(_0x3f8e('0x11'));var logger=require(_0x3f8e('0x12'))(_0x3f8e('0x13'));var utils=require('../../config/utils');var config=require(_0x3f8e('0x14'));var licenseUtil=require(_0x3f8e('0x15'));var db=require('../../mysqldb')['db'];config[_0x3f8e('0x16')]=_[_0x3f8e('0x17')](config['redis'],{'host':_0x3f8e('0x18'),'port':0x18eb});var socket=require(_0x3f8e('0x19'))(new Redis(config[_0x3f8e('0x16')]));require(_0x3f8e('0x1a'))[_0x3f8e('0x1b')](socket);function respondWithStatusCode(_0x518965,_0x32fd67){_0x32fd67=_0x32fd67||0xcc;return function(_0x21a815){if(_0x21a815){return _0x518965[_0x3f8e('0x1c')](_0x32fd67);}return _0x518965[_0x3f8e('0x1d')](_0x32fd67)[_0x3f8e('0x1e')]();};}function respondWithResult(_0x36c583,_0x35f276){_0x35f276=_0x35f276||0xc8;return function(_0x243951){if(_0x243951){return _0x36c583['status'](_0x35f276)[_0x3f8e('0x1f')](_0x243951);}};}function respondWithFilteredResult(_0x4770ba,_0x32e43d){return function(_0x3a3c42){if(_0x3a3c42){var _0x16096e=_0x3a3c42[_0x3f8e('0x20')],_0x345a2c=_0x32e43d[_0x3f8e('0x21')],_0x56a3d0=_0x32e43d[_0x3f8e('0x21')]+_0x32e43d[_0x3f8e('0x22')],_0x24a612;if(_0x56a3d0>=_0x16096e){_0x56a3d0=_0x16096e;_0x24a612=0xc8;}else{_0x24a612=0xce;}_0x4770ba[_0x3f8e('0x1d')](_0x24a612);return _0x4770ba['set'](_0x3f8e('0x23'),_0x345a2c+'-'+_0x56a3d0+'/'+_0x16096e)['json'](_0x3a3c42);}return null;};}function patchUpdates(_0xbafb82){return function(_0x1c68bd){try{jsonpatch[_0x3f8e('0x24')](_0x1c68bd,_0xbafb82,!![]);}catch(_0x72cc86){return BPromise[_0x3f8e('0x25')](_0x72cc86);}return _0x1c68bd[_0x3f8e('0x26')]();};}function saveUpdates(_0xb66f95,_0x5279f9){return function(_0x14d778){if(_0x14d778){return _0x14d778[_0x3f8e('0x27')](_0xb66f95)['then'](function(_0x4970c7){return _0x4970c7;});}return null;};}function removeEntity(_0x5ad075,_0x224b2c){return function(_0x470b7c){if(_0x470b7c){return _0x470b7c[_0x3f8e('0x28')]()[_0x3f8e('0x29')](function(){_0x5ad075['status'](0xcc)[_0x3f8e('0x1e')]();});}};}function handleEntityNotFound(_0x1c38f9,_0x15c176){return function(_0x16281f){if(!_0x16281f){_0x1c38f9['sendStatus'](0x194);}return _0x16281f;};}function handleError(_0x466755,_0x599295){_0x599295=_0x599295||0x1f4;return function(_0x424d38){logger[_0x3f8e('0x2a')](_0x424d38['stack']);if(_0x424d38['name']){delete _0x424d38[_0x3f8e('0x2b')];}_0x466755[_0x3f8e('0x1d')](_0x599295)['send'](_0x424d38);};}function getInteractionUsers(_0x488f99,_0x1fe098){return new BPromise(function(_0x5daf74,_0x26c2cc){try{if(_0x1fe098[_0x488f99['id']]){_0x488f99[_0x3f8e('0x2c')]=_[_0x3f8e('0x2d')](_0x1fe098[_0x488f99['id']],function(_0x3eb7b1){return{'id':_0x3eb7b1['id'],'fullname':_0x3eb7b1[_0x3f8e('0x2e')]};});}}catch(_0x1ca409){_0x26c2cc(_0x1ca409);}_0x5daf74(_0x488f99);});}function getInteractionTags(_0x210ae7,_0x4123ba){return new BPromise(function(_0x5bd1a7,_0xbef04d){try{if(_0x210ae7[_0x3f8e('0x2f')]){_0x210ae7[_0x3f8e('0x30')]=[];_0x210ae7[_0x3f8e('0x2f')][_0x3f8e('0x31')](',')[_0x3f8e('0x32')](function(_0x43654b){_0x210ae7[_0x3f8e('0x30')]['push'](_0x4123ba[_0x43654b]);});}delete _0x210ae7[_0x3f8e('0x2f')];}catch(_0x180b4a){_0xbef04d(_0x180b4a);}_0x5bd1a7(_0x210ae7);});}function updateWhatsappInteraction(_0x1568ff,_0x3cef7c,_0x1b2362){return new BPromise(function(_0x417420,_0x4aa42a){return getInteractionUsers(_0x1568ff,_0x1b2362)[_0x3f8e('0x29')](function(_0x3b7cb7){return getInteractionTags(_0x3b7cb7,_0x3cef7c);})['then'](function(_0x490000){_0x417420(_0x490000);})[_0x3f8e('0x33')](function(_0x158d28){_0x4aa42a(_0x158d28);});});}exports[_0x3f8e('0x34')]=function(_0xae122e,_0x217a39){var _0x5e1335={},_0x2946ec={},_0x14cfb7={'count':0x0,'rows':[]};var _0x1ad255=_[_0x3f8e('0x2d')](db[_0x3f8e('0x35')][_0x3f8e('0x36')],function(_0x3dd9b3){return{'name':_0x3dd9b3[_0x3f8e('0x37')],'type':_0x3dd9b3['type'][_0x3f8e('0x38')]};});_0x2946ec['model']=_[_0x3f8e('0x2d')](_0x1ad255,_0x3f8e('0x2b'));_0x2946ec[_0x3f8e('0x39')]=_[_0x3f8e('0x3a')](_0xae122e[_0x3f8e('0x39')]);_0x2946ec[_0x3f8e('0x3b')]=_['intersection'](_0x2946ec[_0x3f8e('0x3c')],_0x2946ec[_0x3f8e('0x39')]);_0x5e1335['attributes']=_[_0x3f8e('0x3d')](_0x2946ec[_0x3f8e('0x3c')],qs[_0x3f8e('0x3e')](_0xae122e['query'][_0x3f8e('0x3e')]));_0x5e1335[_0x3f8e('0x3f')]=_0x5e1335[_0x3f8e('0x3f')][_0x3f8e('0x40')]?_0x5e1335[_0x3f8e('0x3f')]:_0x2946ec[_0x3f8e('0x3c')];if(!_0xae122e['query']['hasOwnProperty'](_0x3f8e('0x41'))){_0x5e1335[_0x3f8e('0x22')]=qs[_0x3f8e('0x22')](_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x22')]);_0x5e1335[_0x3f8e('0x21')]=qs[_0x3f8e('0x21')](_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x21')]);}_0x5e1335[_0x3f8e('0x42')]=qs['sort'](_0xae122e[_0x3f8e('0x39')]['sort']);_0x5e1335[_0x3f8e('0x43')]=qs[_0x3f8e('0x3b')](_[_0x3f8e('0x44')](_0xae122e[_0x3f8e('0x39')],_0x2946ec[_0x3f8e('0x3b')]),_0x1ad255);var _0xbf0642=[];var _0x3ec5c3=squel['select']()[_0x3f8e('0x45')]('id')[_0x3f8e('0x45')](_0x3f8e('0x2b'))[_0x3f8e('0x45')](_0x3f8e('0x46'))[_0x3f8e('0x47')](_0x3f8e('0x48'));var _0x279fc4=squel[_0x3f8e('0x49')]()['field'](_0x3f8e('0x4a'))[_0x3f8e('0x45')](_0x3f8e('0x4b'))[_0x3f8e('0x45')](_0x3f8e('0x4c'))[_0x3f8e('0x47')](_0x3f8e('0x4d'),'ui')[_0x3f8e('0x4e')](_0x3f8e('0x4f'),'u',_0x3f8e('0x50'));var _0x249d53=squel[_0x3f8e('0x49')]()[_0x3f8e('0x47')](_0x3f8e('0x51'),'i')[_0x3f8e('0x4e')](_0x3f8e('0x52'),'c',_0x3f8e('0x53'))[_0x3f8e('0x4e')](_0x3f8e('0x4f'),'o',_0x3f8e('0x54'))[_0x3f8e('0x4e')](_0x3f8e('0x55'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x3f8e('0x4e')](_0x3f8e('0x56'),'me',_0x3f8e('0x57'))[_0x3f8e('0x4e')]('whatsapp_interaction_has_tags','it',_0x3f8e('0x58'))[_0x3f8e('0x4e')]('tools_tags','t',_0x3f8e('0x59'));var _0x1d2176=squel[_0x3f8e('0x5a')]();var _0xb78474=[];var _0x50af9c=squel['expr']();var _0x29ac98;if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x5b')]){_0x29ac98=as[_0x3f8e('0x5c')](_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x5b')]);var _0x3d56dd=_0x29ac98[_0x3f8e('0x5d')];for(var _0x32cb6d=0x0;_0x32cb6d<_0x29ac98[_0x3f8e('0x5e')][_0x3f8e('0x40')];_0x32cb6d++){var _0xd9b06=_0x29ac98[_0x3f8e('0x5e')][_0x32cb6d];var _0x2d61ac='i';var _0xa56151=_[_0x3f8e('0x5f')](_0x1ad255,[_0x3f8e('0x2b'),_0xd9b06['field']]);if(!_0xa56151){switch(_0xd9b06[_0x3f8e('0x45')]){case'unreadMessages':if(_0xd9b06['value']==0x1){_0x249d53[_0x3f8e('0x60')]('`'+_0xd9b06[_0x3f8e('0x45')]+_0x3f8e('0x61'));}else{_0x249d53[_0x3f8e('0x60')]('`'+_0xd9b06['field']+'`\x20>\x200');}break;case _0x3f8e('0x62'):if(_0xd9b06[_0x3f8e('0x63')]===_0x3f8e('0x64')){if(_0xd9b06['value'][_0x3f8e('0x31')]('\x20')['length']>0x1){_0x1d2176[_0x3d56dd]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3f8e('0x65')](_0xd9b06[_0x3f8e('0x66')]),null);}else{var _0x25fa94='%'+_0xd9b06[_0x3f8e('0x66')]+'%';_0x1d2176[_0x3d56dd](_0x3f8e('0x67'),_0x25fa94,_0x25fa94,_0x25fa94);}}else{_0xa56151=_[_0x3f8e('0x5f')](_0x1ad255,[_0x3f8e('0x2b'),_0x3f8e('0x68')]);_0xd9b06['field']='ContactId';_0x13c657=as['buildExpression'](_0x2d61ac,_0xa56151[_0x3f8e('0x69')],_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657['text'],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x6a')],_0x13c657[_0x3f8e('0x66')]['end']);}break;case _0x3f8e('0x6b'):var _0x744c56=_0xd9b06[_0x3f8e('0x66')]['split'](',')[_0x3f8e('0x2d')](function(_0x49126b){return Number(_0x49126b);});_0x744c56[_0x3f8e('0x32')](function(_0xb1704f){_0x50af9c['or'](_0x3f8e('0x6c'),'%,'+_0xb1704f+',%');});_0xb78474=_['union'](_0xb78474,_0x744c56);break;case _0x3f8e('0x6d'):if(_0xd9b06[_0x3f8e('0x63')]===_0x3f8e('0x64')){_0x1d2176[_0x3d56dd](_0x3f8e('0x6e'),'%'+_0xd9b06[_0x3f8e('0x66')]+'%',null);}else{_0xa56151=_['find'](_0x1ad255,[_0x3f8e('0x2b'),_0x3f8e('0x6f')]);_0xd9b06[_0x3f8e('0x45')]=_0x3f8e('0x6f');_0x13c657=as['buildExpression'](_0x2d61ac,_0xa56151[_0x3f8e('0x69')],_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657[_0x3f8e('0x70')],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x6a')],_0x13c657[_0x3f8e('0x66')]['end']);}break;case _0x3f8e('0x71'):_0x13c657=as['buildExpression']('me',null,_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657['text'],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x6a')],_0x13c657[_0x3f8e('0x66')][_0x3f8e('0x1e')]);break;}}else{var _0x13c657=as['buildExpression'](_0x2d61ac,_0xa56151['type'],_0xd9b06);_0x1d2176[_0x3d56dd](_0x13c657[_0x3f8e('0x70')],_0x13c657[_0x3f8e('0x66')]['start'],_0x13c657[_0x3f8e('0x66')]['end']);}}}else{var _0x25c8a5=_(_0xae122e[_0x3f8e('0x39')])[_0x3f8e('0x3a')]()[_0x3f8e('0x2d')](function(_0x100cae){return _[_0x3f8e('0x72')](_0x1ad255,[_0x3f8e('0x2b'),_0x100cae])?_0x100cae:undefined;})[_0x3f8e('0x73')]()['value']();if(!_[_0x3f8e('0x74')](_0x25c8a5)){_0x25c8a5[_0x3f8e('0x32')](function(_0x394ef4){if(_0x394ef4===_0x3f8e('0x75')){_0x249d53[_0x3f8e('0x43')]('i.WhatsappAccountId\x20IN\x20?',[][_0x3f8e('0x76')](_0xae122e[_0x3f8e('0x39')][_0x394ef4]));}else if(_0x394ef4===_0x3f8e('0x77')){var _0x4953b4=JSON[_0x3f8e('0x78')](_0xae122e[_0x3f8e('0x39')][_0x394ef4])[_0x3f8e('0x79')];var _0x31a4a3=JSON[_0x3f8e('0x78')](_0xae122e['query'][_0x394ef4])['$lte'];_0x249d53[_0x3f8e('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4953b4,_0x31a4a3);}else{if(_0xae122e['query'][_0x394ef4]===_0x3f8e('0x7a')){_0x249d53[_0x3f8e('0x43')]('i.'+_0x394ef4+_0x3f8e('0x7b'));}else{_0x249d53[_0x3f8e('0x43')]('i.'+_0x394ef4+_0x3f8e('0x7c'),_0xae122e[_0x3f8e('0x39')][_0x394ef4]);}}});}if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x7d')]){if(_0xae122e['query']['read']==0x1){_0x249d53['having'](_0x3f8e('0x7e'));}else{_0x249d53[_0x3f8e('0x60')](_0x3f8e('0x7f'));}}if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x80')]){_0xb78474=_[_0x3f8e('0x81')](_0xae122e[_0x3f8e('0x39')]['tag'])?_0xae122e['query'][_0x3f8e('0x80')]:new Array(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x80')]);_0xb78474[_0x3f8e('0x32')](function(_0x403c6c){_0x50af9c['or'](_0x3f8e('0x6c'),'%,'+_0x403c6c+',%');});}if(_0xae122e[_0x3f8e('0x39')][_0x3f8e('0x82')]){var _0x2faf02=_0xae122e['query'][_0x3f8e('0x82')][_0x3f8e('0x83')]('\x5c','\x5c\x5c')[_0x3f8e('0x83')](/'/g,'\x27\x27');if(qs[_0x3f8e('0x84')](_0x2faf02)){_0x1d2176['or'](_0x3f8e('0x85'),_0x2faf02+'%')['or'](_0x3f8e('0x86'),_0x2faf02+'%');}else{_0x1d2176['or'](_0x3f8e('0x87'),qs[_0x3f8e('0x65')](_0x2faf02))['or'](_0x3f8e('0x88'),_0x2faf02+'%');}}}_0x249d53[_0x3f8e('0x43')](_0x1d2176);_0x249d53[_0x3f8e('0x89')](_0x3f8e('0x8a'));var _0x18b8c4={'type':db[_0x3f8e('0x8b')][_0x3f8e('0x8c')][_0x3f8e('0x8d')],'raw':!![]};var _0x1ecc3b=_0x249d53[_0x3f8e('0x8e')]();_0x1ecc3b[_0x3f8e('0x45')](_0x3f8e('0x8a'));_0x1ecc3b['field'](_0x3f8e('0x8f'),'unreadMessages');if(_0x5e1335['order']){_0x5e1335['order'][_0x3f8e('0x32')](function(_0x116686){var _0x106e91=_0x116686[0x0]===_0x3f8e('0x90')?_0x116686[0x0]:'i.'+_0x116686[0x0];_0x249d53[_0x3f8e('0x42')](_0x106e91,_0x116686[0x1]===_0x3f8e('0x91')?![]:!![]);});}if(!_[_0x3f8e('0x74')](_0xb78474)){_0x249d53[_0x3f8e('0x60')](_0x50af9c);_0x1ecc3b[_0x3f8e('0x43')]('t.id\x20IN\x20?',_0xb78474);}BPromise[_0x3f8e('0x92')]()[_0x3f8e('0x29')](function(){if(!_0x29ac98){if(_0xae122e['query'][_0x3f8e('0x75')]||_0xae122e['query']['journey'])return;_0x1ecc3b[_0x3f8e('0x43')](_0x3f8e('0x93'));_0x249d53[_0x3f8e('0x43')](_0x3f8e('0x93'));return;}if(_0xae122e['user'][_0x3f8e('0x94')]!==_0x3f8e('0x95'))return;return _0xae122e[_0x3f8e('0x96')][_0x3f8e('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4082d6){if(_[_0x3f8e('0x74')](_0x4082d6)){_0x1ecc3b[_0x3f8e('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');_0x249d53[_0x3f8e('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1ecc3b[_0x3f8e('0x43')](_0x3f8e('0x98'),_[_0x3f8e('0x2d')](_0x4082d6,'id'));_0x249d53[_0x3f8e('0x43')](_0x3f8e('0x98'),_[_0x3f8e('0x2d')](_0x4082d6,'id'));}});})[_0x3f8e('0x29')](function(){if(_0xae122e[_0x3f8e('0x96')][_0x3f8e('0x94')]==='agent'&&!_0x29ac98&&!_0xae122e['query'][_0x3f8e('0x75')])return[];return db[_0x3f8e('0x99')][_0x3f8e('0x39')](_0x1ecc3b['toString'](),_0x18b8c4);})[_0x3f8e('0x29')](function(_0x3c1ae1){_0x14cfb7['count']=_0x3c1ae1['length'];if(_0x14cfb7[_0x3f8e('0x20')]===0x0)return[];return db[_0x3f8e('0x99')][_0x3f8e('0x39')](_0x3ec5c3[_0x3f8e('0x9a')](),_0x18b8c4)[_0x3f8e('0x29')](function(_0x1da4f7){_0xbf0642=_[_0x3f8e('0x9b')](_0x1da4f7,'id');_0x18b8c4=_[_0x3f8e('0x9c')](_0x18b8c4,{'model':db[_0x3f8e('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xae122e['query'][_0x3f8e('0x3e')]){_0x5e1335[_0x3f8e('0x3f')][_0x3f8e('0x32')](function(_0x376441){_0x249d53[_0x3f8e('0x45')]('i.'+_0x376441);});}else{_0x249d53['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3f8e('0x9d'));_0x249d53[_0x3f8e('0x45')]('a.key',_0x3f8e('0x9e'));_0x249d53['field'](_0x3f8e('0x9f'),_0x3f8e('0xa0'));_0x249d53[_0x3f8e('0x45')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3f8e('0x90'));_0x249d53['field']('i.*');_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xa1'),_0x3f8e('0xa2'));_0x249d53['field'](_0x3f8e('0xa3'),_0x3f8e('0xa4'));_0x249d53[_0x3f8e('0x45')]('c.email',_0x3f8e('0xa5'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xa6'),_0x3f8e('0xa7'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xa8'),_0x3f8e('0xa9'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xaa'),_0x3f8e('0xab'));_0x249d53['field'](_0x3f8e('0xac'),_0x3f8e('0xad'));_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xae'),'Owner.internal');_0x249d53[_0x3f8e('0x45')](_0x3f8e('0xaf'),_0x3f8e('0x2f'));}if(_0x5e1335[_0x3f8e('0x22')])_0x249d53[_0x3f8e('0x22')](_0x5e1335[_0x3f8e('0x22')]);if(_0x5e1335[_0x3f8e('0x21')])_0x249d53[_0x3f8e('0x21')](_0x5e1335[_0x3f8e('0x21')]);return db[_0x3f8e('0x99')][_0x3f8e('0x39')](_0x249d53[_0x3f8e('0x9a')](),_0x18b8c4);})['then'](function(_0x29ea44){_0x279fc4[_0x3f8e('0x43')](_0x3f8e('0xb0'),_[_0x3f8e('0x2d')](_0x29ea44,'id'));return db['sequelize']['query'](_0x279fc4[_0x3f8e('0x9a')](),_0x18b8c4)['then'](function(_0x2b0bf0){var _0x4ce817=_[_0x3f8e('0xb1')](_0x2b0bf0,_0x3f8e('0xb2'));var _0xedcb4e=[];_0x29ea44[_0x3f8e('0x32')](function(_0x22ba30){_0xedcb4e[_0x3f8e('0xb3')](updateWhatsappInteraction(_0x22ba30,_0xbf0642,_0x4ce817));});return BPromise[_0x3f8e('0xb4')](_0xedcb4e);});});})['then'](function(_0x1c957d){_0x14cfb7[_0x3f8e('0xb5')]=_0x1c957d;return _0x14cfb7;})[_0x3f8e('0x29')](respondWithFilteredResult(_0x217a39,_0x5e1335))[_0x3f8e('0x33')](handleError(_0x217a39,null));};exports[_0x3f8e('0xb6')]=function(_0x472e49,_0x207672){var _0x57fe2f={'raw':![],'where':{'id':_0x472e49[_0x3f8e('0xb7')]['id']}},_0x15b0f6={};_0x15b0f6[_0x3f8e('0x3c')]=_[_0x3f8e('0x3a')](db[_0x3f8e('0x35')]['rawAttributes']);_0x15b0f6['query']=_[_0x3f8e('0x3a')](_0x472e49[_0x3f8e('0x39')]);_0x15b0f6[_0x3f8e('0x3b')]=_[_0x3f8e('0x3d')](_0x15b0f6[_0x3f8e('0x3c')],_0x15b0f6[_0x3f8e('0x39')]);_0x57fe2f['attributes']=_[_0x3f8e('0x3d')](_0x15b0f6[_0x3f8e('0x3c')],qs['fields'](_0x472e49['query'][_0x3f8e('0x3e')]));_0x57fe2f[_0x3f8e('0x3f')]=_0x57fe2f['attributes']['length']?_0x57fe2f['attributes']:_0x15b0f6[_0x3f8e('0x3c')];if(_0x472e49['query']['includeAll']){_0x57fe2f[_0x3f8e('0xb8')]=[{'all':!![]}];}_0x57fe2f=_[_0x3f8e('0x9c')]({},_0x57fe2f,_0x472e49[_0x3f8e('0xb9')]);return db[_0x3f8e('0x35')][_0x3f8e('0x5f')](_0x57fe2f)[_0x3f8e('0x29')](handleEntityNotFound(_0x207672,null))[_0x3f8e('0x29')](respondWithResult(_0x207672,null))[_0x3f8e('0x33')](handleError(_0x207672,null));};exports[_0x3f8e('0xba')]=function(_0x3db161,_0x189a2a){return db[_0x3f8e('0x35')]['create'](_0x3db161[_0x3f8e('0x71')],{})[_0x3f8e('0x29')](respondWithResult(_0x189a2a,0xc9))[_0x3f8e('0x33')](handleError(_0x189a2a,null));};exports[_0x3f8e('0x27')]=function(_0x54fd58,_0x1f7ad7){if(_0x54fd58[_0x3f8e('0x71')]['id']){delete _0x54fd58[_0x3f8e('0x71')]['id'];}return db[_0x3f8e('0x35')]['find']({'where':{'id':_0x54fd58[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x1f7ad7,null))[_0x3f8e('0x29')](saveUpdates(_0x54fd58[_0x3f8e('0x71')],null))[_0x3f8e('0x29')](respondWithResult(_0x1f7ad7,null))[_0x3f8e('0x33')](handleError(_0x1f7ad7,null));};exports[_0x3f8e('0x28')]=function(_0x3ac5d0,_0x332e8c){return db[_0x3f8e('0x35')][_0x3f8e('0x5f')]({'where':{'id':_0x3ac5d0[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x332e8c,null))[_0x3f8e('0x29')](removeEntity(_0x332e8c,null))[_0x3f8e('0x33')](handleError(_0x332e8c,null));};exports[_0x3f8e('0xbb')]=function(_0x57312c,_0x5cd592){return db[_0x3f8e('0x35')][_0x3f8e('0xbb')]()[_0x3f8e('0x29')](respondWithResult(_0x5cd592,null))[_0x3f8e('0x33')](handleError(_0x5cd592,null));};exports[_0x3f8e('0xbc')]=function(_0x1879b6,_0x13e537,_0xb982ae){return db[_0x3f8e('0xbd')]['find']({'where':{'id':_0x1879b6[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x13e537,null))[_0x3f8e('0x29')](function(_0x5509fb){if(_0x5509fb){return _0x5509fb[_0x3f8e('0xbc')](_0x1879b6[_0x3f8e('0x71')][_0x3f8e('0xbe')],_['omit'](_0x1879b6[_0x3f8e('0x71')],[_0x3f8e('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x13e537,null))['catch'](handleError(_0x13e537,null));};exports['getMessages']=function(_0x43f69b,_0x577fdf,_0x207a86){var _0x4c5f8b={'raw':![],'where':{}};var _0x4447c9={};var _0x2d9ca6={'count':0x0,'rows':[]};return db[_0x3f8e('0x35')][_0x3f8e('0xbf')]({'where':{'id':_0x43f69b[_0x3f8e('0xb7')]['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x577fdf,null))[_0x3f8e('0x29')](function(_0x318023){if(_0x318023){_0x4447c9['model']=_['keys'](db[_0x3f8e('0xbd')][_0x3f8e('0x36')]);_0x4447c9['query']=_[_0x3f8e('0x3a')](_0x43f69b[_0x3f8e('0x39')]);_0x4447c9['filters']=_[_0x3f8e('0x3d')](_0x4447c9['model'],_0x4447c9['query']);_0x4c5f8b[_0x3f8e('0x3f')]=_[_0x3f8e('0x3d')](_0x4447c9[_0x3f8e('0x3c')],qs[_0x3f8e('0x3e')](_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0x3e')]));_0x4c5f8b[_0x3f8e('0x3f')]=_0x4c5f8b['attributes'][_0x3f8e('0x40')]?_0x4c5f8b[_0x3f8e('0x3f')]:_0x4447c9['model'];if(!_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0xc0')](_0x3f8e('0x41'))){_0x4c5f8b[_0x3f8e('0x22')]=qs[_0x3f8e('0x22')](_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0x22')]);_0x4c5f8b[_0x3f8e('0x21')]=qs[_0x3f8e('0x21')](_0x43f69b['query'][_0x3f8e('0x21')]);}_0x4c5f8b[_0x3f8e('0x42')]=qs[_0x3f8e('0xc1')](_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0xc1')]);_0x4c5f8b[_0x3f8e('0x43')]=qs['filters'](_[_0x3f8e('0x44')](_0x43f69b['query'],_0x4447c9[_0x3f8e('0x3b')]));_0x4c5f8b[_0x3f8e('0x43')][_0x3f8e('0xb2')]=_0x318023['id'];if(_0x43f69b['query'][_0x3f8e('0x82')]){_0x4c5f8b[_0x3f8e('0x43')]=_[_0x3f8e('0x9c')](_0x4c5f8b['where'],{'$or':_['map'](_0x4c5f8b[_0x3f8e('0x3f')],function(_0x113ba6){var _0x360f66={};_0x360f66[_0x113ba6]={'$like':'%'+_0x43f69b['query'][_0x3f8e('0x82')]+'%'};return _0x360f66;})});}if(_0x43f69b[_0x3f8e('0x39')][_0x3f8e('0x79')]){var _0x5cf2c4=_0x43f69b['query']['$gte'][_0x3f8e('0x31')](',');var _0x3f0df5={};_0x3f0df5[_0x5cf2c4[0x0]]={'$gte':moment(_0x5cf2c4[0x1])[_0x3f8e('0xc2')](_0x3f8e('0xc3'))};_0x4c5f8b['where']=_['merge'](_0x4c5f8b[_0x3f8e('0x43')],_0x3f0df5);}_0x4c5f8b=_[_0x3f8e('0x9c')]({},_0x4c5f8b,_0x43f69b[_0x3f8e('0xb9')]);return db[_0x3f8e('0xbd')][_0x3f8e('0x20')]({'where':_0x4c5f8b[_0x3f8e('0x43')]})[_0x3f8e('0x29')](function(_0x5cd932){_0x2d9ca6['count']=_0x5cd932;if(_0x43f69b[_0x3f8e('0x39')]['includeAll']){_0x4c5f8b[_0x3f8e('0xb8')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3f8e('0xc4')](_0x4c5f8b);})[_0x3f8e('0x29')](function(_0x1bdc37){_0x2d9ca6[_0x3f8e('0xb5')]=_0x1bdc37;return _0x2d9ca6;});}})[_0x3f8e('0x29')](respondWithFilteredResult(_0x577fdf,_0x4c5f8b))['catch'](handleError(_0x577fdf,null));};exports['addTags']=function(_0x4cd174,_0x3dca0a,_0xa30b97){return db[_0x3f8e('0x35')]['find']({'where':{'id':_0x4cd174['params']['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x3dca0a,null))['then'](function(_0x579cc4){if(_0x579cc4){return _0x579cc4[_0x3f8e('0xc5')](_0x4cd174[_0x3f8e('0x71')][_0x3f8e('0xbe')],_['omit'](_0x4cd174[_0x3f8e('0x71')],[_0x3f8e('0xbe'),'id'])||{})[_0x3f8e('0xc6')](function(){return db[_0x3f8e('0x6b')][_0x3f8e('0xc4')]({'attributes':['id',_0x3f8e('0x2b'),_0x3f8e('0x46')],'where':{'id':_0x4cd174[_0x3f8e('0x71')][_0x3f8e('0xbe')]}});})[_0x3f8e('0x29')](function(_0x39e959){socket[_0x3f8e('0xc7')]('whatsappInteractionTags:save',{'id':Number(_0x4cd174[_0x3f8e('0xb7')]['id']),'tags':_0x39e959||[]});return{'id':Number(_0x4cd174['params']['id']),'tags':_0x39e959||[]};});}})[_0x3f8e('0x29')](respondWithResult(_0x3dca0a,null))['catch'](handleError(_0x3dca0a,null));};exports[_0x3f8e('0xc8')]=function(_0xcd2964,_0x41edca,_0x14db1b){return db[_0x3f8e('0x35')][_0x3f8e('0x5f')]({'where':{'id':_0xcd2964['params']['id']}})[_0x3f8e('0x29')](handleEntityNotFound(_0x41edca,null))[_0x3f8e('0x29')](function(_0x5dc63e){if(_0x5dc63e){return _0x5dc63e[_0x3f8e('0xc8')](_0xcd2964[_0x3f8e('0x39')]['ids']);}})[_0x3f8e('0x29')](respondWithStatusCode(_0x41edca,null))[_0x3f8e('0x33')](handleError(_0x41edca,null));};exports[_0x3f8e('0xc9')]=function(_0x11b5c6,_0x5a56f0){var _0x59f9c2=moment()[_0x3f8e('0xca')]()[_0x3f8e('0x9a')]();var _0x4cf742=path[_0x3f8e('0xcb')](config[_0x3f8e('0xcc')],_0x3f8e('0xcd'),_0x3f8e('0xce'),'tmp');var _0x8f09f=path['join'](config[_0x3f8e('0xcc')],_0x3f8e('0xcd'),_0x3f8e('0xce'),_0x3f8e('0xcf'));var _0x25595b=path[_0x3f8e('0xcb')](_0x4cf742,_0x59f9c2);var _0x531d6c=util[_0x3f8e('0xc2')]('transcript-%d-%s.zip',_0x11b5c6[_0x3f8e('0xb7')]['id'],_0x59f9c2);var _0x2d92e2=path['join'](_0x4cf742,_0x531d6c);var _0x1f4e21=[];_0x1f4e21[_0x3f8e('0xb3')]({'model':db[_0x3f8e('0x6d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1f4e21['push']({'model':db[_0x3f8e('0xd0')],'as':'Contact','attributes':['id',_0x3f8e('0xd1'),_0x3f8e('0xd2')],'raw':!![]});if(_0x11b5c6[_0x3f8e('0x39')][_0x3f8e('0xcf')]){_0x1f4e21['push']({'model':db[_0x3f8e('0xd3')],'as':_0x3f8e('0xd3'),'raw':!![]});}var _0xbd2502=[{'model':db[_0x3f8e('0xbd')],'as':_0x3f8e('0xd4'),'attributes':['id',_0x3f8e('0x71'),_0x3f8e('0x77'),'direction',_0x3f8e('0xd5'),_0x3f8e('0x7d')],'include':_0x1f4e21}];_0xbd2502[_0x3f8e('0xb3')]({'model':db[_0x3f8e('0xd6')],'as':_0x3f8e('0xd7'),'attributes':['id',_0x3f8e('0x2b')]});_0xbd2502[_0x3f8e('0xb3')]({'model':db['User'],'as':_0x3f8e('0xd8'),'attributes':['id',_0x3f8e('0x2e')]});return db[_0x3f8e('0x35')]['find']({'where':{'id':_0x11b5c6[_0x3f8e('0xb7')]['id']},'include':_0xbd2502})['then'](handleEntityNotFound(_0x5a56f0,null))[_0x3f8e('0x29')](function(_0x24e31f){if(_0x24e31f){var _0x337811=_0x24e31f['get']({'plain':!![]});fs['mkdirSync'](_0x25595b);var _0x23ba79={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x3f8e('0xd9')}},'footer':{'height':_0x3f8e('0xda'),'contents':{'default':util[_0x3f8e('0xc2')](_0x3f8e('0xdb'),util['format']('%s\x20#%d','Whatsapp',_0x337811['id']),moment()[_0x3f8e('0xc2')](_0x3f8e('0xdc'))[_0x3f8e('0x9a')]())}}};var _0x102f33={'channel':_0x3f8e('0xdd'),'account':_0x337811[_0x3f8e('0xd7')][_0x3f8e('0x2b')],'agent':_0x337811[_0x3f8e('0xd8')]?_0x337811[_0x3f8e('0xd8')][_0x3f8e('0x2e')]:_0x3f8e('0xde'),'createdAt':moment(_0x337811[_0x3f8e('0x77')])[_0x3f8e('0xc2')](_0x3f8e('0xc3'))[_0x3f8e('0x9a')](),'closedAt':_0x337811[_0x3f8e('0xdf')]?moment(_0x337811[_0x3f8e('0xe0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3f8e('0x9a')]():'','disposition':_0x337811[_0x3f8e('0xe1')],'messages':_(_0x337811[_0x3f8e('0xd4')])[_0x3f8e('0x82')]({'secret':![]})[_0x3f8e('0x2d')](function(_0x277b49){if(_0x277b49['Attachment']){var _0x4dc35f=path[_0x3f8e('0xcb')](_0x8f09f,_0x277b49['Attachment'][_0x3f8e('0xe2')]);if(fs[_0x3f8e('0xe3')](_0x4dc35f)){fs['createReadStream'](_0x4dc35f)[_0x3f8e('0xe4')](fs[_0x3f8e('0xe5')](path['join'](_0x25595b,_0x277b49['Attachment'][_0x3f8e('0xe2')])));}}return{'date':moment(_0x277b49[_0x3f8e('0x77')])[_0x3f8e('0xc2')](_0x3f8e('0xc3'))[_0x3f8e('0x9a')](),'sender':_0x277b49['direction']===_0x3f8e('0xe6')?_0x277b49[_0x3f8e('0x6d')]?_0x277b49['User'][_0x3f8e('0x2e')]:_0x3f8e('0xe7'):_0x277b49['Contact'][_0x3f8e('0xd1')]+(_0x277b49[_0x3f8e('0x62')][_0x3f8e('0xd2')]?'\x20'+_0x277b49['Contact'][_0x3f8e('0xd2')]:''),'body':_0x277b49['Attachment']?_0x277b49[_0x3f8e('0xd3')]['basename']:_0x277b49[_0x3f8e('0x71')],'direction':_0x277b49[_0x3f8e('0xe8')]===_0x3f8e('0xe6')?'A':'C','secret':_0x277b49[_0x3f8e('0xd5')],'read':_0x277b49[_0x3f8e('0x7d')],'attachment':_0x277b49[_0x3f8e('0xd3')]};})[_0x3f8e('0x66')]()};return ejs[_0x3f8e('0xe9')](path[_0x3f8e('0xcb')](config['root'],_0x3f8e('0xcd'),_0x3f8e('0xea'),_0x3f8e('0xeb')),{'interaction':_0x102f33})['then'](function(_0x1426ed){return new BPromise(function(_0x597df9,_0x207ae7){pdf[_0x3f8e('0xba')](_0x1426ed,_0x23ba79)['toFile'](path[_0x3f8e('0xcb')](_0x25595b,_0x3f8e('0xec')+_0x337811['id']+'-'+_0x59f9c2+_0x3f8e('0xed')),function(_0x5a01c2,_0x122f73){if(_0x5a01c2)return _0x207ae7(_0x5a01c2);_0x597df9(_0x122f73);});});})[_0x3f8e('0x29')](function(){return new BPromise(function(_0x5b2778,_0x510434){zipdir(_0x25595b,{'saveTo':_0x2d92e2},function(_0x587cdf,_0x33f00b){if(_0x587cdf)return _0x510434(_0x587cdf);return _0x5b2778(_0x33f00b);});})[_0x3f8e('0x29')](function(){return new BPromise(function(_0xa971e4,_0x5c9c4f){rimraf(_0x25595b,function(_0x494505){if(_0x494505)_0x5c9c4f(_0x494505);return _0xa971e4();});});})[_0x3f8e('0x29')](function(){return _0x5a56f0[_0x3f8e('0xc9')](_0x2d92e2,_0x531d6c,function(_0x262f0a){if(_0x262f0a){console[_0x3f8e('0xee')](_0x3f8e('0xef'),_0x262f0a);}else{fs[_0x3f8e('0xf0')](_0x2d92e2);}});});});}else{return _0x5a56f0[_0x3f8e('0x1c')](0xc8);}})[_0x3f8e('0x33')](handleError(_0x5a56f0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f6254a2..d7042a5 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 _0x983b=['save','update','remove','then','Users','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x274c27,_0x1478e8){var _0x35da66=function(_0x5c0095){while(--_0x5c0095){_0x274c27['push'](_0x274c27['shift']());}};_0x35da66(++_0x1478e8);}(_0x983b,0x67));var _0xb983=function(_0x2f30b7,_0xf9b6f6){_0x2f30b7=_0x2f30b7-0x0;var _0x9c3e12=_0x983b[_0x2f30b7];return _0x9c3e12;};'use strict';var EventEmitter=require(_0xb983('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb983('0x1')];var WhatsappMessage=require(_0xb983('0x2'))['db'][_0xb983('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb983('0x4')](0x0);var events={'afterCreate':_0xb983('0x5'),'afterUpdate':_0xb983('0x6'),'afterDestroy':_0xb983('0x7')};function emitEvent(_0x2df134){return function(_0x55e6cd,_0x23811d,_0x49a626){_0x55e6cd['getUsers']({'attributes':['id'],'raw':!![]})[_0xb983('0x8')](function(_0x547018){_0x55e6cd['setDataValue'](_0xb983('0x9'),_0x547018['map'](function(_0x278e55){return{'id':_0x278e55['id']};}));return WhatsappMessage[_0xb983('0xa')]({'where':{'WhatsappInteractionId':_0x55e6cd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb983('0x8')](function(_0x4db71d){_0x55e6cd[_0xb983('0xb')](_0xb983('0xc'),_0x4db71d[_0xb983('0xd')]);WhatsappInteractionEvents[_0xb983('0xe')](_0x2df134+':'+_0x55e6cd['id'],_0x55e6cd);WhatsappInteractionEvents[_0xb983('0xe')](_0x2df134,_0x55e6cd);_0x49a626(null);})['catch'](_0x49a626(null));};}for(var e in events){if(events[_0xb983('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb983('0x10')](e,emitEvent(event));}}module[_0xb983('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xac69=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xac69,0xcc));var _0x9ac6=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xac69[_0x23e7c1];return _0x1add43;};'use strict';var EventEmitter=require(_0x9ac6('0x0'));var WhatsappInteraction=require(_0x9ac6('0x1'))['db'][_0x9ac6('0x2')];var WhatsappMessage=require(_0x9ac6('0x1'))['db'][_0x9ac6('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9ac6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9ac6('0x5'),'afterDestroy':_0x9ac6('0x6')};function emitEvent(_0x55a675){return function(_0x3e9fd7,_0x207789,_0x4eda2f){_0x3e9fd7[_0x9ac6('0x7')]({'attributes':['id'],'raw':!![]})[_0x9ac6('0x8')](function(_0x4ed153){_0x3e9fd7[_0x9ac6('0x9')]('Users',_0x4ed153[_0x9ac6('0xa')](function(_0x4a1c44){return{'id':_0x4a1c44['id']};}));return WhatsappMessage[_0x9ac6('0xb')]({'where':{'WhatsappInteractionId':_0x3e9fd7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x297a91){_0x3e9fd7[_0x9ac6('0x9')](_0x9ac6('0xc'),_0x297a91['length']);WhatsappInteractionEvents[_0x9ac6('0xd')](_0x55a675+':'+_0x3e9fd7['id'],_0x3e9fd7);WhatsappInteractionEvents[_0x9ac6('0xd')](_0x55a675,_0x3e9fd7);_0x4eda2f(null);})[_0x9ac6('0xe')](_0x4eda2f(null));};}for(var e in events){if(events[_0x9ac6('0xf')](e)){var event=events[e];WhatsappInteraction[_0x9ac6('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 27158bb..6f21999 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 _0x3a3e=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3b7606,_0x2b354f){var _0x1acab4=function(_0x166b38){while(--_0x166b38){_0x3b7606['push'](_0x3b7606['shift']());}};_0x1acab4(++_0x2b354f);}(_0x3a3e,0x1a7));var _0xe3a3=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x3a3e[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xe3a3('0x0'));var util=require(_0xe3a3('0x1'));var logger=require(_0xe3a3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe3a3('0x3'));var rp=require(_0xe3a3('0x4'));var fs=require('fs');var path=require(_0xe3a3('0x5'));var rimraf=require(_0xe3a3('0x6'));var config=require(_0xe3a3('0x7'));var attributes=require(_0xe3a3('0x8'));module[_0xe3a3('0x9')]=function(_0x35e610,_0x58c763){return _0x35e610[_0xe3a3('0xa')](_0xe3a3('0xb'),attributes,{'tableName':_0xe3a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x370383,_0x5d3911,_0x30edb5){if(_0x370383[_0xe3a3('0xd')](_0xe3a3('0xe'))){_0x370383['closedAt']=moment()[_0xe3a3('0xf')](_0xe3a3('0x10'));}_0x30edb5(null,_0x370383);}}});}; \ No newline at end of file +var _0xead0=['closed','closedAt','format','lodash','../../config/logger','api','request-promise','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x150fe7,_0x114149){var _0x56114c=function(_0x5d0b06){while(--_0x5d0b06){_0x150fe7['push'](_0x150fe7['shift']());}};_0x56114c(++_0x114149);}(_0xead0,0x73));var _0x0ead=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xead0[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0x0ead('0x0'));var util=require('util');var logger=require(_0x0ead('0x1'))(_0x0ead('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ead('0x3'));var fs=require('fs');var path=require(_0x0ead('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ead('0x5'));module[_0x0ead('0x6')]=function(_0x381661,_0x565a32){return _0x381661[_0x0ead('0x7')](_0x0ead('0x8'),attributes,{'tableName':_0x0ead('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e7725,_0x39842b,_0x53e61e){if(_0x1e7725[_0x0ead('0xa')](_0x0ead('0xb'))){_0x1e7725[_0x0ead('0xc')]=moment()[_0x0ead('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x53e61e(null,_0x1e7725);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5a0821d..f22f1dc 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 _0x83ca=['http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x4ef314,_0x3fa079){var _0x50bde9=function(_0xb032de){while(--_0xb032de){_0x4ef314['push'](_0x4ef314['shift']());}};_0x50bde9(++_0x3fa079);}(_0x83ca,0x147));var _0xa83c=function(_0x48d79d,_0x505a3a){_0x48d79d=_0x48d79d-0x0;var _0x501e86=_0x83ca[_0x48d79d];return _0x501e86;};'use strict';var _=require(_0xa83c('0x0'));var util=require(_0xa83c('0x1'));var moment=require(_0xa83c('0x2'));var BPromise=require(_0xa83c('0x3'));var rs=require(_0xa83c('0x4'));var fs=require('fs');var Redis=require(_0xa83c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa83c('0x6'));var config=require(_0xa83c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa83c('0x8')][_0xa83c('0x9')]({'port':0x232a});config[_0xa83c('0xa')]=_[_0xa83c('0xb')](config[_0xa83c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa83c('0xc'))(new Redis(config['redis']));require(_0xa83c('0xd'))[_0xa83c('0xe')](socket);function respondWithRpcPromise(_0xb67733,_0x522ac4,_0x2dd228){return new BPromise(function(_0x486ce1,_0x14d97f){return client[_0xa83c('0xf')](_0xb67733,_0x2dd228)[_0xa83c('0x10')](function(_0x337c09){logger[_0xa83c('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x522ac4,'request\x20sent');logger[_0xa83c('0x12')](_0xa83c('0x13'),_0x522ac4,'request\x20sent',JSON[_0xa83c('0x14')](_0x337c09));if(_0x337c09[_0xa83c('0x15')]){if(_0x337c09[_0xa83c('0x15')]['code']===0x1f4){logger[_0xa83c('0x15')](_0xa83c('0x16'),_0x522ac4,_0x337c09['error'][_0xa83c('0x17')]);return _0x14d97f(_0x337c09[_0xa83c('0x15')][_0xa83c('0x17')]);}logger[_0xa83c('0x15')](_0xa83c('0x16'),_0x522ac4,_0x337c09['error'][_0xa83c('0x17')]);return _0x486ce1(_0x337c09[_0xa83c('0x15')][_0xa83c('0x17')]);}else{logger['info'](_0xa83c('0x16'),_0x522ac4,_0xa83c('0x18'));_0x486ce1(_0x337c09[_0xa83c('0x19')][_0xa83c('0x17')]);}})[_0xa83c('0x1a')](function(_0x31db98){logger[_0xa83c('0x15')](_0xa83c('0x16'),_0x522ac4,_0x31db98);_0x14d97f(_0x31db98);});});}exports[_0xa83c('0x1b')]=function(_0x4ed287){var _0x3ec347=this;return new Promise(function(_0x3e2f3b,_0x4a4f3a){return db[_0xa83c('0x1c')][_0xa83c('0x1d')](_0x4ed287['body'],{'raw':_0x4ed287[_0xa83c('0x1e')]?_0x4ed287['options'][_0xa83c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed287['options']?_0x4ed287[_0xa83c('0x1e')]['where']||null:null,'attributes':_0x4ed287[_0xa83c('0x1e')]?_0x4ed287[_0xa83c('0x1e')][_0xa83c('0x20')]||null:null,'limit':_0x4ed287[_0xa83c('0x1e')]?_0x4ed287['options'][_0xa83c('0x21')]||null:null})['then'](function(_0x4578ea){logger[_0xa83c('0x11')](_0xa83c('0x1b'),_0x4ed287);logger[_0xa83c('0x12')](_0xa83c('0x1b'),_0x4ed287,JSON[_0xa83c('0x14')](_0x4578ea));_0x3e2f3b(_0x4578ea);})['catch'](function(_0x64cb71){logger[_0xa83c('0x15')]('UpdateWhatsappInteraction',_0x64cb71[_0xa83c('0x17')],_0x4ed287);_0x4a4f3a(_0x3ec347[_0xa83c('0x15')](0x1f4,_0x64cb71['message']));});});};exports[_0xa83c('0x22')]=function(_0x40204c){return new Promise(function(_0x14dad5,_0x10b8a8){return db[_0xa83c('0x1c')][_0xa83c('0x23')]({'where':_0x40204c['options']?_0x40204c[_0xa83c('0x1e')]['where']||null:null})[_0xa83c('0x10')](function(_0x1a26cd){if(_0x1a26cd){return _0x1a26cd[_0xa83c('0x24')](_0x40204c[_0xa83c('0x25')][_0xa83c('0x26')],_[_0xa83c('0x27')](_0x40204c[_0xa83c('0x25')],['ids','id'])||{});}})[_0xa83c('0x28')](function(_0x32fd34){logger['info'](_0xa83c('0x29'),_0x40204c);logger['debug']('AddTags',_0x40204c,JSON[_0xa83c('0x14')](_0x32fd34));_0x14dad5(_0x32fd34);})['catch'](function(_0x14ba02){logger[_0xa83c('0x15')]('AddTags',_0x14ba02[_0xa83c('0x17')],_0x40204c);_0x10b8a8(_this[_0xa83c('0x15')](0x1f4,_0x14ba02[_0xa83c('0x17')]));});});}; \ No newline at end of file +var _0xa281=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','WhatsappInteraction,\x20%s,\x20%s','error','message','result','update','body','options','where','attributes','UpdateWhatsappInteraction','catch','WhatsappInteraction','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent'];(function(_0x469da2,_0xf6297e){var _0x1573b8=function(_0x27190f){while(--_0x27190f){_0x469da2['push'](_0x469da2['shift']());}};_0x1573b8(++_0xf6297e);}(_0xa281,0x186));var _0x1a28=function(_0x4fc11f,_0x165b8a){_0x4fc11f=_0x4fc11f-0x0;var _0x30380e=_0xa281[_0x4fc11f];return _0x30380e;};'use strict';var _=require(_0x1a28('0x0'));var util=require(_0x1a28('0x1'));var moment=require(_0x1a28('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a28('0x3'));var db=require(_0x1a28('0x4'))['db'];var utils=require(_0x1a28('0x5'));var logger=require(_0x1a28('0x6'))(_0x1a28('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a28('0x8')]({'port':0x232a});config[_0x1a28('0x9')]=_[_0x1a28('0xa')](config['redis'],{'host':_0x1a28('0xb'),'port':0x18eb});var socket=require(_0x1a28('0xc'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x642c99,_0x3001e6,_0x56050d){return new BPromise(function(_0x1179ca,_0x3ca233){return client[_0x1a28('0xd')](_0x642c99,_0x56050d)[_0x1a28('0xe')](function(_0x1282b8){logger[_0x1a28('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x3001e6,_0x1a28('0x10'));logger[_0x1a28('0x11')](_0x1a28('0x12'),_0x3001e6,_0x1a28('0x10'),JSON[_0x1a28('0x13')](_0x1282b8));if(_0x1282b8['error']){if(_0x1282b8['error'][_0x1a28('0x14')]===0x1f4){logger['error'](_0x1a28('0x15'),_0x3001e6,_0x1282b8[_0x1a28('0x16')]['message']);return _0x3ca233(_0x1282b8[_0x1a28('0x16')][_0x1a28('0x17')]);}logger['error'](_0x1a28('0x15'),_0x3001e6,_0x1282b8['error'][_0x1a28('0x17')]);return _0x1179ca(_0x1282b8[_0x1a28('0x16')][_0x1a28('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3001e6,_0x1a28('0x10'));_0x1179ca(_0x1282b8[_0x1a28('0x18')]['message']);}})['catch'](function(_0x44ec5c){logger[_0x1a28('0x16')](_0x1a28('0x15'),_0x3001e6,_0x44ec5c);_0x3ca233(_0x44ec5c);});});}exports['UpdateWhatsappInteraction']=function(_0x2f3742){var _0x41b7ca=this;return new Promise(function(_0x1c0496,_0x4b2d1d){return db['WhatsappInteraction'][_0x1a28('0x19')](_0x2f3742[_0x1a28('0x1a')],{'raw':_0x2f3742[_0x1a28('0x1b')]?_0x2f3742['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f3742[_0x1a28('0x1b')]?_0x2f3742[_0x1a28('0x1b')][_0x1a28('0x1c')]||null:null,'attributes':_0x2f3742['options']?_0x2f3742[_0x1a28('0x1b')][_0x1a28('0x1d')]||null:null,'limit':_0x2f3742['options']?_0x2f3742[_0x1a28('0x1b')]['limit']||null:null})[_0x1a28('0xe')](function(_0x3c15d4){logger[_0x1a28('0xf')](_0x1a28('0x1e'),_0x2f3742);logger[_0x1a28('0x11')](_0x1a28('0x1e'),_0x2f3742,JSON['stringify'](_0x3c15d4));_0x1c0496(_0x3c15d4);})[_0x1a28('0x1f')](function(_0x437a5b){logger[_0x1a28('0x16')]('UpdateWhatsappInteraction',_0x437a5b['message'],_0x2f3742);_0x4b2d1d(_0x41b7ca[_0x1a28('0x16')](0x1f4,_0x437a5b[_0x1a28('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x33eded){return new Promise(function(_0x101612,_0xf1b82f){return db[_0x1a28('0x20')]['find']({'where':_0x33eded[_0x1a28('0x1b')]?_0x33eded[_0x1a28('0x1b')][_0x1a28('0x1c')]||null:null})[_0x1a28('0xe')](function(_0x5118c1){if(_0x5118c1){return _0x5118c1[_0x1a28('0x21')](_0x33eded[_0x1a28('0x1a')]['ids'],_['omit'](_0x33eded[_0x1a28('0x1a')],[_0x1a28('0x22'),'id'])||{});}})[_0x1a28('0x23')](function(_0x5d3f7f){logger[_0x1a28('0xf')](_0x1a28('0x24'),_0x33eded);logger[_0x1a28('0x11')](_0x1a28('0x24'),_0x33eded,JSON[_0x1a28('0x13')](_0x5d3f7f));_0x101612(_0x5d3f7f);})['catch'](function(_0x2fea58){logger['error'](_0x1a28('0x24'),_0x2fea58['message'],_0x33eded);_0xf1b82f(_this[_0x1a28('0x16')](0x1f4,_0x2fea58['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4f2c4ce..d0b807a 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 _0xaa4b=['update','emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x198ae8,_0x1a8b21){var _0x36f5c1=function(_0x5b239f){while(--_0x5b239f){_0x198ae8['push'](_0x198ae8['shift']());}};_0x36f5c1(++_0x1a8b21);}(_0xaa4b,0xb5));var _0xbaa4=function(_0x5c4b05,_0x5335bc){_0x5c4b05=_0x5c4b05-0x0;var _0x29c39e=_0xaa4b[_0x5c4b05];return _0x29c39e;};'use strict';var WhatsappInteractionEvents=require(_0xbaa4('0x0'));var events=[_0xbaa4('0x1'),_0xbaa4('0x2'),_0xbaa4('0x3')];function createListener(_0x10395c,_0x324616){return function(_0x4a96f3){_0x324616[_0xbaa4('0x4')](_0x10395c,_0x4a96f3);};}function removeListener(_0x5e1cd4,_0x2885d4){return function(){WhatsappInteractionEvents[_0xbaa4('0x5')](_0x5e1cd4,_0x2885d4);};}exports['register']=function(_0x4ee893){for(var _0x1498a2=0x0,_0x4b2503=events[_0xbaa4('0x6')];_0x1498a2<_0x4b2503;_0x1498a2++){var _0x33aa7f=events[_0x1498a2];var _0x19007f=createListener(_0xbaa4('0x7')+_0x33aa7f,_0x4ee893);WhatsappInteractionEvents['on'](_0x33aa7f,_0x19007f);}}; \ No newline at end of file +var _0xe676=['save','remove','update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x53c645,_0x264b02){var _0x42208a=function(_0x2dd8c2){while(--_0x2dd8c2){_0x53c645['push'](_0x53c645['shift']());}};_0x42208a(++_0x264b02);}(_0xe676,0x137));var _0x6e67=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xe676[_0x5e8eae];return _0xdd09cd;};'use strict';var WhatsappInteractionEvents=require(_0x6e67('0x0'));var events=[_0x6e67('0x1'),_0x6e67('0x2'),_0x6e67('0x3')];function createListener(_0x3dfb3e,_0x37d79b){return function(_0x8e5f7c){_0x37d79b['emit'](_0x3dfb3e,_0x8e5f7c);};}function removeListener(_0x1f4850,_0x150be3){return function(){WhatsappInteractionEvents[_0x6e67('0x4')](_0x1f4850,_0x150be3);};}exports[_0x6e67('0x5')]=function(_0x81843){for(var _0x4509b6=0x0,_0x128427=events[_0x6e67('0x6')];_0x4509b6<_0x128427;_0x4509b6++){var _0x2d91da=events[_0x4509b6];var _0x3bacd4=createListener(_0x6e67('0x7')+_0x2d91da,_0x81843);WhatsappInteractionEvents['on'](_0x2d91da,_0x3bacd4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 574e16f..5de9c3d 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 _0x73a3=['isAuthenticated','index','/describe','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x4e4005,_0x375bfe){var _0x560f3c=function(_0x521444){while(--_0x521444){_0x4e4005['push'](_0x4e4005['shift']());}};_0x560f3c(++_0x375bfe);}(_0x73a3,0x66));var _0x373a=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x73a3[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x373a('0x0'));var util=require(_0x373a('0x1'));var path=require(_0x373a('0x2'));var timeout=require(_0x373a('0x3'));var express=require(_0x373a('0x4'));var router=express[_0x373a('0x5')]();var auth=require(_0x373a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x373a('0x7'));var controller=require(_0x373a('0x8'));router[_0x373a('0x9')]('/',auth[_0x373a('0xa')](),controller[_0x373a('0xb')]);router[_0x373a('0x9')](_0x373a('0xc'),auth[_0x373a('0xa')](),controller[_0x373a('0xd')]);router['get']('/:id',auth[_0x373a('0xa')](),controller[_0x373a('0xe')]);router[_0x373a('0xf')]('/',auth[_0x373a('0xa')](),interaction[_0x373a('0x10')](_0x373a('0x11'),_0x373a('0x12')),controller[_0x373a('0x13')]);router[_0x373a('0xf')](_0x373a('0x14'),controller[_0x373a('0x15')]);router[_0x373a('0x16')]('/:id',auth[_0x373a('0xa')](),controller['update']);router[_0x373a('0x16')](_0x373a('0x17'),auth['isAuthenticated'](),controller[_0x373a('0x18')]);router[_0x373a('0x16')]('/:id/reject',auth[_0x373a('0xa')](),controller[_0x373a('0x19')]);router['delete']('/:id',auth[_0x373a('0xa')](),controller[_0x373a('0x1a')]);module[_0x373a('0x1b')]=router; \ No newline at end of file +var _0xb3e0=['reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x4453d3,_0x2f5ae8){var _0xd83d3=function(_0x1954d0){while(--_0x1954d0){_0x4453d3['push'](_0x4453d3['shift']());}};_0xd83d3(++_0x2f5ae8);}(_0xb3e0,0x19a));var _0x0b3e=function(_0x11e6d6,_0x93cb1){_0x11e6d6=_0x11e6d6-0x0;var _0x4df6bb=_0xb3e0[_0x11e6d6];return _0x4df6bb;};'use strict';var multer=require(_0x0b3e('0x0'));var util=require('util');var path=require(_0x0b3e('0x1'));var timeout=require(_0x0b3e('0x2'));var express=require(_0x0b3e('0x3'));var router=express['Router']();var auth=require(_0x0b3e('0x4'));var interaction=require(_0x0b3e('0x5'));var config=require(_0x0b3e('0x6'));var controller=require(_0x0b3e('0x7'));router[_0x0b3e('0x8')]('/',auth[_0x0b3e('0x9')](),controller[_0x0b3e('0xa')]);router[_0x0b3e('0x8')](_0x0b3e('0xb'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0xc')]);router['get'](_0x0b3e('0xd'),auth[_0x0b3e('0x9')](),controller['show']);router[_0x0b3e('0xe')]('/',auth[_0x0b3e('0x9')](),interaction[_0x0b3e('0xf')](_0x0b3e('0x10'),_0x0b3e('0x11')),controller[_0x0b3e('0x12')]);router['post'](_0x0b3e('0x13'),controller[_0x0b3e('0x14')]);router[_0x0b3e('0x15')](_0x0b3e('0xd'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x16')]);router[_0x0b3e('0x15')](_0x0b3e('0x17'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x18')]);router['put']('/:id/reject',auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x19')]);router[_0x0b3e('0x1a')](_0x0b3e('0xd'),auth[_0x0b3e('0x9')](),controller[_0x0b3e('0x1b')]);module[_0x0b3e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7743278..b2eb5e8 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 _0x1ee4=['out','DATE','sequelize','TEXT','BOOLEAN','ENUM'];(function(_0xe5366,_0x32ea05){var _0x3dfd7d=function(_0x3aeb41){while(--_0x3aeb41){_0xe5366['push'](_0xe5366['shift']());}};_0x3dfd7d(++_0x32ea05);}(_0x1ee4,0x1dc));var _0x41ee=function(_0x5102f5,_0xf6e54d){_0x5102f5=_0x5102f5-0x0;var _0x43b298=_0x1ee4[_0x5102f5];return _0x43b298;};'use strict';var Sequelize=require(_0x41ee('0x0'));module['exports']={'body':{'type':Sequelize[_0x41ee('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x41ee('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x41ee('0x3')]('in','out'),'defaultValue':_0x41ee('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x41ee('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x41ee('0x1')]}}; \ No newline at end of file +var _0xdd3b=['BOOLEAN','out','STRING','DATE','exports','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xdd3b,0x1d8));var _0xbdd3=function(_0x22bf47,_0x5b3cfd){_0x22bf47=_0x22bf47-0x0;var _0x63e280=_0xdd3b[_0x22bf47];return _0x63e280;};'use strict';var Sequelize=require('sequelize');module[_0xbdd3('0x0')]={'body':{'type':Sequelize[_0xbdd3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbdd3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbdd3('0x3')),'defaultValue':_0xbdd3('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbdd3('0x4')]},'readAt':{'type':Sequelize[_0xbdd3('0x5')]},'secret':{'type':Sequelize[_0xbdd3('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbdd3('0x4')]},'providerResponse':{'type':Sequelize[_0xbdd3('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 26953e1..6eeb6bc 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 _0xadb5=['create','body','update','find','params','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','format','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','request','WhatsappMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show'];(function(_0x12dc5d,_0x2d256e){var _0x2418b6=function(_0x44b285){while(--_0x44b285){_0x12dc5d['push'](_0x12dc5d['shift']());}};_0x2418b6(++_0x2d256e);}(_0xadb5,0xad));var _0x5adb=function(_0xdd5792,_0x1fa7e0){_0xdd5792=_0xdd5792-0x0;var _0x343237=_0xadb5[_0xdd5792];return _0x343237;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];config[_0x5adb('0x18')]=_['defaults'](config[_0x5adb('0x18')],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config['redis']));require(_0x5adb('0x1b'))[_0x5adb('0x1c')](socket);var jayson=require(_0x5adb('0x1d'));var client=jayson['client'][_0x5adb('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5adb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x42a482,_0x30614e,_0x304784,_0x1c0f97){return new BPromise(function(_0x39d24d,_0xa29dc){var _0x42f4c6=_0x1c0f97||client;return _0x42f4c6[_0x5adb('0x1f')](_0x42a482,_0x304784)['then'](function(_0x3fff62){logger['info'](_0x5adb('0x20'),_0x30614e,'request\x20sent');logger[_0x5adb('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x30614e,'request\x20sent',JSON[_0x5adb('0x22')](_0x3fff62));if(_0x3fff62[_0x5adb('0x23')]){if(_0x3fff62[_0x5adb('0x23')][_0x5adb('0x24')]===0x1f4){logger[_0x5adb('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x30614e,_0x3fff62[_0x5adb('0x23')]['message']);return _0xa29dc(_0x3fff62['error'][_0x5adb('0x25')]);}logger[_0x5adb('0x23')](_0x5adb('0x20'),_0x30614e,_0x3fff62[_0x5adb('0x23')][_0x5adb('0x25')]);return _0x39d24d(_0x3fff62[_0x5adb('0x23')][_0x5adb('0x25')]);}else{logger['info'](_0x5adb('0x20'),_0x30614e,_0x5adb('0x26'));_0x39d24d(_0x3fff62[_0x5adb('0x27')][_0x5adb('0x25')]);}})[_0x5adb('0x28')](function(_0x49f203){logger[_0x5adb('0x23')](_0x5adb('0x20'),_0x30614e,_0x49f203);_0xa29dc(_0x49f203);});});}function respondWithStatusCode(_0x5aed76,_0x1feecf){_0x1feecf=_0x1feecf||0xcc;return function(_0x1ded9f){if(_0x1ded9f){return _0x5aed76[_0x5adb('0x29')](_0x1feecf);}return _0x5aed76['status'](_0x1feecf)[_0x5adb('0x2a')]();};}function respondWithResult(_0xbe21b1,_0x3a4fca){_0x3a4fca=_0x3a4fca||0xc8;return function(_0x2c64a3){if(_0x2c64a3){return _0xbe21b1[_0x5adb('0x2b')](_0x3a4fca)[_0x5adb('0x2c')](_0x2c64a3);}};}function respondWithFilteredResult(_0x4a5d46,_0x49992e){return function(_0x5d457e){if(_0x5d457e){var _0x39bddd=_0x5d457e[_0x5adb('0x2d')],_0x1eac55=_0x49992e['offset'],_0x60a672=_0x49992e[_0x5adb('0x2e')]+_0x49992e[_0x5adb('0x2f')],_0x512bab;if(_0x60a672>=_0x39bddd){_0x60a672=_0x39bddd;_0x512bab=0xc8;}else{_0x512bab=0xce;}_0x4a5d46[_0x5adb('0x2b')](_0x512bab);return _0x4a5d46[_0x5adb('0x30')](_0x5adb('0x31'),_0x1eac55+'-'+_0x60a672+'/'+_0x39bddd)[_0x5adb('0x2c')](_0x5d457e);}return null;};}function patchUpdates(_0x28190d){return function(_0x28bf1f){try{jsonpatch[_0x5adb('0x32')](_0x28bf1f,_0x28190d,!![]);}catch(_0x260295){return BPromise['reject'](_0x260295);}return _0x28bf1f[_0x5adb('0x33')]();};}function saveUpdates(_0x4c8b2e,_0x12424d){return function(_0x20cde6){if(_0x20cde6){return _0x20cde6['update'](_0x4c8b2e)[_0x5adb('0x34')](function(_0xe389ca){return _0xe389ca;});}return null;};}function removeEntity(_0x461a39,_0x4a3661){return function(_0x173789){if(_0x173789){return _0x173789[_0x5adb('0x35')]()['then'](function(){_0x461a39['status'](0xcc)[_0x5adb('0x2a')]();});}};}function handleEntityNotFound(_0x49dd03,_0x663ea0){return function(_0x222568){if(!_0x222568){_0x49dd03[_0x5adb('0x29')](0x194);}return _0x222568;};}function handleError(_0x2da912,_0x9bdece){_0x9bdece=_0x9bdece||0x1f4;return function(_0x5ece39){logger[_0x5adb('0x23')](_0x5ece39[_0x5adb('0x36')]);if(_0x5ece39[_0x5adb('0x37')]){delete _0x5ece39['name'];}_0x2da912['status'](_0x9bdece)[_0x5adb('0x38')](_0x5ece39);};}exports[_0x5adb('0x39')]=function(_0x586820,_0x2355bc){var _0x4a4260={},_0x199d3b={},_0x58cc5d={'count':0x0,'rows':[]};var _0x11cb37=_['map'](db[_0x5adb('0x3a')][_0x5adb('0x3b')],function(_0x4ccb27){return{'name':_0x4ccb27[_0x5adb('0x3c')],'type':_0x4ccb27['type'][_0x5adb('0x3d')]};});_0x199d3b[_0x5adb('0x3e')]=_[_0x5adb('0x3f')](_0x11cb37,'name');_0x199d3b[_0x5adb('0x40')]=_[_0x5adb('0x41')](_0x586820[_0x5adb('0x40')]);_0x199d3b[_0x5adb('0x42')]=_[_0x5adb('0x43')](_0x199d3b['model'],_0x199d3b['query']);_0x4a4260['attributes']=_['intersection'](_0x199d3b[_0x5adb('0x3e')],qs[_0x5adb('0x44')](_0x586820[_0x5adb('0x40')][_0x5adb('0x44')]));_0x4a4260[_0x5adb('0x45')]=_0x4a4260[_0x5adb('0x45')][_0x5adb('0x46')]?_0x4a4260[_0x5adb('0x45')]:_0x199d3b['model'];if(!_0x586820['query'][_0x5adb('0x47')]('nolimit')){_0x4a4260[_0x5adb('0x2f')]=qs[_0x5adb('0x2f')](_0x586820[_0x5adb('0x40')][_0x5adb('0x2f')]);_0x4a4260[_0x5adb('0x2e')]=qs['offset'](_0x586820[_0x5adb('0x40')][_0x5adb('0x2e')]);}_0x4a4260['order']=qs[_0x5adb('0x48')](_0x586820[_0x5adb('0x40')]['sort']);_0x4a4260[_0x5adb('0x49')]=qs[_0x5adb('0x42')](_[_0x5adb('0x4a')](_0x586820[_0x5adb('0x40')],_0x199d3b[_0x5adb('0x42')]),_0x11cb37);if(_0x586820[_0x5adb('0x40')][_0x5adb('0x4b')]){_0x4a4260['where']=_['merge'](_0x4a4260[_0x5adb('0x49')],{'$or':_[_0x5adb('0x3f')](_0x11cb37,function(_0x1cd0a3){if(_0x1cd0a3[_0x5adb('0x4c')]!=='VIRTUAL'){var _0x507e48={};_0x507e48[_0x1cd0a3[_0x5adb('0x37')]]={'$like':'%'+_0x586820[_0x5adb('0x40')][_0x5adb('0x4b')]+'%'};return _0x507e48;}})});}_0x4a4260=_[_0x5adb('0x4d')]({},_0x4a4260,_0x586820[_0x5adb('0x4e')]);var _0x5358c0={'where':_0x4a4260[_0x5adb('0x49')]};return db[_0x5adb('0x3a')]['count'](_0x5358c0)[_0x5adb('0x34')](function(_0x251f45){_0x58cc5d[_0x5adb('0x2d')]=_0x251f45;if(_0x586820[_0x5adb('0x40')][_0x5adb('0x4f')]){_0x4a4260[_0x5adb('0x50')]=[{'all':!![]}];}return db[_0x5adb('0x3a')][_0x5adb('0x51')](_0x4a4260);})['then'](function(_0x3a925b){_0x58cc5d['rows']=_0x3a925b;return _0x58cc5d;})['then'](respondWithFilteredResult(_0x2355bc,_0x4a4260))['catch'](handleError(_0x2355bc,null));};exports[_0x5adb('0x52')]=function(_0x3fbac8,_0x207a81){var _0x4ba0b5={'raw':!![],'where':{'id':_0x3fbac8['params']['id']}},_0x2ad69d={};_0x2ad69d[_0x5adb('0x3e')]=_[_0x5adb('0x41')](db[_0x5adb('0x3a')]['rawAttributes']);_0x2ad69d[_0x5adb('0x40')]=_['keys'](_0x3fbac8[_0x5adb('0x40')]);_0x2ad69d[_0x5adb('0x42')]=_['intersection'](_0x2ad69d[_0x5adb('0x3e')],_0x2ad69d[_0x5adb('0x40')]);_0x4ba0b5[_0x5adb('0x45')]=_[_0x5adb('0x43')](_0x2ad69d[_0x5adb('0x3e')],qs['fields'](_0x3fbac8[_0x5adb('0x40')][_0x5adb('0x44')]));_0x4ba0b5[_0x5adb('0x45')]=_0x4ba0b5[_0x5adb('0x45')]['length']?_0x4ba0b5[_0x5adb('0x45')]:_0x2ad69d[_0x5adb('0x3e')];if(_0x3fbac8[_0x5adb('0x40')]['includeAll']){_0x4ba0b5[_0x5adb('0x50')]=[{'all':!![]}];}_0x4ba0b5=_[_0x5adb('0x4d')]({},_0x4ba0b5,_0x3fbac8[_0x5adb('0x4e')]);return db[_0x5adb('0x3a')]['find'](_0x4ba0b5)[_0x5adb('0x34')](handleEntityNotFound(_0x207a81,null))[_0x5adb('0x34')](respondWithResult(_0x207a81,null))[_0x5adb('0x28')](handleError(_0x207a81,null));};exports[_0x5adb('0x53')]=function(_0xa25ac3,_0x5c570b){return db[_0x5adb('0x3a')]['create'](_0xa25ac3[_0x5adb('0x54')],{})['then'](respondWithResult(_0x5c570b,0xc9))[_0x5adb('0x28')](handleError(_0x5c570b,null));};exports[_0x5adb('0x55')]=function(_0x1a9358,_0x42f6d9){if(_0x1a9358['body']['id']){delete _0x1a9358[_0x5adb('0x54')]['id'];}return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0x1a9358['params']['id']}})['then'](handleEntityNotFound(_0x42f6d9,null))['then'](saveUpdates(_0x1a9358[_0x5adb('0x54')],null))[_0x5adb('0x34')](respondWithResult(_0x42f6d9,null))[_0x5adb('0x28')](handleError(_0x42f6d9,null));};exports[_0x5adb('0x35')]=function(_0xa833f4,_0xb06bee){return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0xa833f4[_0x5adb('0x57')]['id']}})[_0x5adb('0x34')](handleEntityNotFound(_0xb06bee,null))[_0x5adb('0x34')](removeEntity(_0xb06bee,null))[_0x5adb('0x28')](handleError(_0xb06bee,null));};exports[_0x5adb('0x58')]=function(_0x511746,_0x49f4c8){return db[_0x5adb('0x3a')][_0x5adb('0x58')]()[_0x5adb('0x34')](respondWithResult(_0x49f4c8,null))[_0x5adb('0x28')](handleError(_0x49f4c8,null));};var interaction_log=require('../../config/logger')(_0x5adb('0x59'));exports[_0x5adb('0x5a')]=function(_0x5d2d2f,_0x5cb50e,_0x476e62){var _0x1505f7={'channel':'whatsapp'};if(_0x5d2d2f[_0x5adb('0x54')]['id']){delete _0x5d2d2f[_0x5adb('0x54')]['id'];}_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5b')]=!![];_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5c')]=moment()['format'](_0x5adb('0x5d'));_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5e')]=_0x5d2d2f['body'][_0x5adb('0x5e')]||_0x5d2d2f[_0x5adb('0x5f')]['id'];return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x5d2d2f[_0x5adb('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x5adb('0x60')}]})[_0x5adb('0x34')](handleEntityNotFound(_0x5cb50e,null))[_0x5adb('0x34')](saveUpdates(_0x5d2d2f['body'],null))[_0x5adb('0x34')](function(_0x3627d1){if(_0x3627d1){_0x1505f7['message']=_0x3627d1[_0x5adb('0x61')]({'plain':!![]});return db[_0x5adb('0x62')][_0x5adb('0x56')]({'where':{'id':_0x3627d1[_0x5adb('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5cb50e,null))[_0x5adb('0x34')](function(_0x2b8298){if(_0x2b8298){return _0x2b8298[_0x5adb('0x55')]({'UserId':_0x5d2d2f[_0x5adb('0x54')]['UserId'],'read1stAt':_['isNil'](_0x2b8298[_0x5adb('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x174a83){if(_0x174a83){_0x1505f7[_0x5adb('0x65')]=_0x174a83['get']({'plain':!![]});interaction_log[_0x5adb('0x66')](_0x5adb('0x67'),_0x5d2d2f[_0x5adb('0x5f')]['id'],_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x37')],_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x68')],_0x1505f7[_0x5adb('0x65')]['id'],_0x5d2d2f['body']?JSON['stringify'](_0x5d2d2f['body']):_0x5adb('0x69'));return respondWithRpcPromise(_0x5adb('0x6a'),_0x5adb('0x6b'),_0x1505f7);}return null;})[_0x5adb('0x34')](function(_0x1f59bb){if(_0x1f59bb){if(_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x6c')]){_0x1505f7[_0x5adb('0x25')]['interface']=util['format'](_0x5adb('0x6d'),_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x37')]);_0x1505f7[_0x5adb('0x25')][_0x5adb('0x6e')]=_0x1505f7[_0x5adb('0x6e')];_0x1505f7[_0x5adb('0x25')][_0x5adb('0x6f')]=_0x5adb('0x5a');return respondWithRpcPromise(_0x5adb('0x70'),'EventManager',{'event':_0x5adb('0x71'),'message':_0x1505f7[_0x5adb('0x25')]},client9002)[_0x5adb('0x34')](function(){return _0x1505f7;});}return _0x1505f7;}return null;})['then'](respondWithResult(_0x5cb50e,null))[_0x5adb('0x28')](handleError(_0x5cb50e,null));};var interaction_log=require(_0x5adb('0x14'))('whatsapp-interactions');exports[_0x5adb('0x72')]=function(_0x494526,_0x473538,_0x31555a){var _0x5ea16a={'agent':{},'channel':_0x5adb('0x73')};if(_0x494526[_0x5adb('0x54')]['id']){delete _0x494526[_0x5adb('0x54')]['id'];}_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')]=_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')]||_0x494526[_0x5adb('0x5f')]['id'];_0x5ea16a['agent']['id']=_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')];return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x494526['params']['id'],'UserId':null}})[_0x5adb('0x34')](handleEntityNotFound(_0x473538,null))['then'](function(_0x27d3d8){if(_0x27d3d8){_0x5ea16a[_0x5adb('0x25')]=_0x27d3d8[_0x5adb('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x5adb('0x56')]({'where':{'id':_0x27d3d8[_0x5adb('0x63')]}});}return null;})[_0x5adb('0x34')](handleEntityNotFound(_0x473538,null))[_0x5adb('0x34')](function(_0x3ed654){if(_0x3ed654){_0x5ea16a['interaction']=_0x3ed654[_0x5adb('0x61')]({'plain':!![]});interaction_log[_0x5adb('0x66')](_0x5adb('0x74'),_0x494526[_0x5adb('0x5f')]['id'],_0x494526['user'][_0x5adb('0x37')],_0x494526[_0x5adb('0x5f')][_0x5adb('0x68')],_0x5ea16a[_0x5adb('0x65')]['id'],_0x494526[_0x5adb('0x54')]?JSON[_0x5adb('0x22')](_0x494526[_0x5adb('0x54')]):'null');return respondWithRpcPromise(_0x5adb('0x75'),_0x5adb('0x76'),_0x5ea16a);}return null;})['then'](function(_0x44f940){if(_0x44f940){_0x44f940[_0x5adb('0x25')]['interface']=util[_0x5adb('0x77')]('SIP/%s',_0x494526[_0x5adb('0x5f')][_0x5adb('0x37')]);_0x44f940['message'][_0x5adb('0x6e')]=_0x5ea16a['channel'];_0x44f940[_0x5adb('0x25')][_0x5adb('0x6f')]=_0x5adb('0x72');respondWithRpcPromise(_0x5adb('0x70'),_0x5adb('0x70'),{'event':'rejectmessage','message':_0x44f940[_0x5adb('0x25')]},client9002);return _0x5ea16a;}return null;})[_0x5adb('0x34')](respondWithResult(_0x473538,null))[_0x5adb('0x28')](handleError(_0x473538,null));};exports[_0x5adb('0x2b')]=function(_0x47c631,_0x5e875c,_0x3f3db9){if(_0x47c631[_0x5adb('0x54')]['id']){delete _0x47c631[_0x5adb('0x54')]['id'];}var _0xa1d7c8;return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0x47c631[_0x5adb('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e875c,null))[_0x5adb('0x34')](function(_0x14bada){if(_0x14bada){_0xa1d7c8=_0x14bada;return db[_0x5adb('0x78')][_0x5adb('0x56')]({'where':{'id':_0x14bada['WhatsappAccountId']}});}})[_0x5adb('0x34')](handleEntityNotFound(_0x5e875c,null))[_0x5adb('0x34')](function(_0x243016){if(_0x243016){logger[_0x5adb('0x21')](_0x5adb('0x79'),_0x5adb('0x2b'),_0x5adb('0x7a'),_0x243016[_0x5adb('0x4c')],util[_0x5adb('0x7b')](_0x47c631['body'],{'showHidden':![],'depth':null}));switch(_0x243016[_0x5adb('0x4c')]){case _0x5adb('0x7c'):if(_0x47c631['body'][_0x5adb('0x7d')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7d')]===_0xa1d7c8[_0x5adb('0x7e')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7f')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7f')]==='read'){return _0xa1d7c8[_0x5adb('0x55')]({'read':!![]});}else{logger[_0x5adb('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5adb('0x2b'),_0x5adb('0x7c'),util[_0x5adb('0x7b')](_0x47c631['body'],{'showHidden':![],'depth':null}));}break;}return _0xa1d7c8;}})['then'](respondWithResult(_0x5e875c,null))[_0x5adb('0x28')](handleError(_0x5e875c,null));}; \ No newline at end of file +var _0xda2d=['WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','destroy','end','stack','send','index','map','rawAttributes','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','WhatsappMessage','rows','keys','includeAll','include','find','create','update','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','params','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','role','acceptMessage','interface','SIP/%s','channel','EventManager','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','event','rejectmessage','WhatsappAccount'];(function(_0x1046ae,_0x3bcbee){var _0xb213a8=function(_0x485e2c){while(--_0x485e2c){_0x1046ae['push'](_0x1046ae['shift']());}};_0xb213a8(++_0x3bcbee);}(_0xda2d,0x102));var _0xdda2=function(_0x33e47e,_0x17f834){_0x33e47e=_0x33e47e-0x0;var _0x470eb6=_0xda2d[_0x33e47e];return _0x470eb6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdda2('0x19')](config[_0xdda2('0x1a')],{'host':_0xdda2('0x1b'),'port':0x18eb});var socket=require(_0xdda2('0x1c'))(new Redis(config[_0xdda2('0x1a')]));require(_0xdda2('0x1d'))[_0xdda2('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdda2('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xdda2('0x1f')][_0xdda2('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3553d5,_0x457764,_0x1922b1,_0x5d8a83){return new BPromise(function(_0x55d674,_0x43f67b){var _0x518c6d=_0x5d8a83||client;return _0x518c6d[_0xdda2('0x21')](_0x3553d5,_0x1922b1)[_0xdda2('0x22')](function(_0x335fb5){logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x457764,_0xdda2('0x25'));logger[_0xdda2('0x26')](_0xdda2('0x27'),_0x457764,_0xdda2('0x25'),JSON[_0xdda2('0x28')](_0x335fb5));if(_0x335fb5[_0xdda2('0x29')]){if(_0x335fb5[_0xdda2('0x29')]['code']===0x1f4){logger[_0xdda2('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x457764,_0x335fb5[_0xdda2('0x29')][_0xdda2('0x2a')]);return _0x43f67b(_0x335fb5[_0xdda2('0x29')]['message']);}logger[_0xdda2('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x457764,_0x335fb5[_0xdda2('0x29')][_0xdda2('0x2a')]);return _0x55d674(_0x335fb5['error'][_0xdda2('0x2a')]);}else{logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x457764,_0xdda2('0x25'));_0x55d674(_0x335fb5[_0xdda2('0x2b')]['message']);}})[_0xdda2('0x2c')](function(_0x4be5ea){logger[_0xdda2('0x29')](_0xdda2('0x24'),_0x457764,_0x4be5ea);_0x43f67b(_0x4be5ea);});});}function respondWithStatusCode(_0x5436d1,_0x4e97dc){_0x4e97dc=_0x4e97dc||0xcc;return function(_0x28da54){if(_0x28da54){return _0x5436d1[_0xdda2('0x2d')](_0x4e97dc);}return _0x5436d1[_0xdda2('0x2e')](_0x4e97dc)['end']();};}function respondWithResult(_0x90d919,_0x5d26ae){_0x5d26ae=_0x5d26ae||0xc8;return function(_0x2e755b){if(_0x2e755b){return _0x90d919[_0xdda2('0x2e')](_0x5d26ae)[_0xdda2('0x2f')](_0x2e755b);}};}function respondWithFilteredResult(_0x91b41a,_0x4bb8a4){return function(_0x24c37d){if(_0x24c37d){var _0x255bbc=_0x24c37d[_0xdda2('0x30')],_0x53acb5=_0x4bb8a4[_0xdda2('0x31')],_0x45e800=_0x4bb8a4['offset']+_0x4bb8a4[_0xdda2('0x32')],_0x2cfaca;if(_0x45e800>=_0x255bbc){_0x45e800=_0x255bbc;_0x2cfaca=0xc8;}else{_0x2cfaca=0xce;}_0x91b41a[_0xdda2('0x2e')](_0x2cfaca);return _0x91b41a['set'](_0xdda2('0x33'),_0x53acb5+'-'+_0x45e800+'/'+_0x255bbc)['json'](_0x24c37d);}return null;};}function patchUpdates(_0x2b8cd6){return function(_0x55809a){try{jsonpatch['apply'](_0x55809a,_0x2b8cd6,!![]);}catch(_0x510b7b){return BPromise[_0xdda2('0x34')](_0x510b7b);}return _0x55809a['save']();};}function saveUpdates(_0x1b13f4,_0x508664){return function(_0x5cba58){if(_0x5cba58){return _0x5cba58['update'](_0x1b13f4)[_0xdda2('0x22')](function(_0x567717){return _0x567717;});}return null;};}function removeEntity(_0xca6046,_0x2fd592){return function(_0x12e96d){if(_0x12e96d){return _0x12e96d[_0xdda2('0x35')]()[_0xdda2('0x22')](function(){_0xca6046[_0xdda2('0x2e')](0xcc)[_0xdda2('0x36')]();});}};}function handleEntityNotFound(_0x2bcf47,_0x4a32ea){return function(_0x461621){if(!_0x461621){_0x2bcf47[_0xdda2('0x2d')](0x194);}return _0x461621;};}function handleError(_0x2f8674,_0x3d510c){_0x3d510c=_0x3d510c||0x1f4;return function(_0x392373){logger[_0xdda2('0x29')](_0x392373[_0xdda2('0x37')]);if(_0x392373['name']){delete _0x392373['name'];}_0x2f8674[_0xdda2('0x2e')](_0x3d510c)[_0xdda2('0x38')](_0x392373);};}exports[_0xdda2('0x39')]=function(_0x4811d2,_0x54e211){var _0x871054={},_0x35a0f6={},_0x2d7a21={'count':0x0,'rows':[]};var _0x11f1f6=_[_0xdda2('0x3a')](db['WhatsappMessage'][_0xdda2('0x3b')],function(_0x21fc6d){return{'name':_0x21fc6d['fieldName'],'type':_0x21fc6d['type'][_0xdda2('0x3c')]};});_0x35a0f6[_0xdda2('0x3d')]=_[_0xdda2('0x3a')](_0x11f1f6,_0xdda2('0x3e'));_0x35a0f6[_0xdda2('0x3f')]=_['keys'](_0x4811d2[_0xdda2('0x3f')]);_0x35a0f6[_0xdda2('0x40')]=_[_0xdda2('0x41')](_0x35a0f6[_0xdda2('0x3d')],_0x35a0f6['query']);_0x871054['attributes']=_[_0xdda2('0x41')](_0x35a0f6[_0xdda2('0x3d')],qs[_0xdda2('0x42')](_0x4811d2['query'][_0xdda2('0x42')]));_0x871054['attributes']=_0x871054[_0xdda2('0x43')]['length']?_0x871054[_0xdda2('0x43')]:_0x35a0f6[_0xdda2('0x3d')];if(!_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x44')]('nolimit')){_0x871054[_0xdda2('0x32')]=qs['limit'](_0x4811d2[_0xdda2('0x3f')]['limit']);_0x871054[_0xdda2('0x31')]=qs[_0xdda2('0x31')](_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x31')]);}_0x871054[_0xdda2('0x45')]=qs['sort'](_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x46')]);_0x871054['where']=qs[_0xdda2('0x40')](_['pick'](_0x4811d2[_0xdda2('0x3f')],_0x35a0f6[_0xdda2('0x40')]),_0x11f1f6);if(_0x4811d2[_0xdda2('0x3f')][_0xdda2('0x47')]){_0x871054[_0xdda2('0x48')]=_[_0xdda2('0x49')](_0x871054[_0xdda2('0x48')],{'$or':_[_0xdda2('0x3a')](_0x11f1f6,function(_0xff55){if(_0xff55[_0xdda2('0x4a')]!==_0xdda2('0x4b')){var _0x224eac={};_0x224eac[_0xff55[_0xdda2('0x3e')]]={'$like':'%'+_0x4811d2['query']['filter']+'%'};return _0x224eac;}})});}_0x871054=_['merge']({},_0x871054,_0x4811d2[_0xdda2('0x4c')]);var _0x383536={'where':_0x871054['where']};return db[_0xdda2('0x4d')][_0xdda2('0x30')](_0x383536)[_0xdda2('0x22')](function(_0x5e56a8){_0x2d7a21[_0xdda2('0x30')]=_0x5e56a8;if(_0x4811d2[_0xdda2('0x3f')]['includeAll']){_0x871054['include']=[{'all':!![]}];}return db[_0xdda2('0x4d')]['findAll'](_0x871054);})[_0xdda2('0x22')](function(_0x4b778b){_0x2d7a21[_0xdda2('0x4e')]=_0x4b778b;return _0x2d7a21;})[_0xdda2('0x22')](respondWithFilteredResult(_0x54e211,_0x871054))['catch'](handleError(_0x54e211,null));};exports['show']=function(_0x3506ff,_0x413f8a){var _0x375741={'raw':!![],'where':{'id':_0x3506ff['params']['id']}},_0x33f0b4={};_0x33f0b4[_0xdda2('0x3d')]=_[_0xdda2('0x4f')](db[_0xdda2('0x4d')][_0xdda2('0x3b')]);_0x33f0b4[_0xdda2('0x3f')]=_['keys'](_0x3506ff[_0xdda2('0x3f')]);_0x33f0b4[_0xdda2('0x40')]=_['intersection'](_0x33f0b4[_0xdda2('0x3d')],_0x33f0b4[_0xdda2('0x3f')]);_0x375741[_0xdda2('0x43')]=_[_0xdda2('0x41')](_0x33f0b4[_0xdda2('0x3d')],qs[_0xdda2('0x42')](_0x3506ff['query'][_0xdda2('0x42')]));_0x375741['attributes']=_0x375741[_0xdda2('0x43')]['length']?_0x375741[_0xdda2('0x43')]:_0x33f0b4['model'];if(_0x3506ff[_0xdda2('0x3f')][_0xdda2('0x50')]){_0x375741[_0xdda2('0x51')]=[{'all':!![]}];}_0x375741=_[_0xdda2('0x49')]({},_0x375741,_0x3506ff[_0xdda2('0x4c')]);return db[_0xdda2('0x4d')][_0xdda2('0x52')](_0x375741)[_0xdda2('0x22')](handleEntityNotFound(_0x413f8a,null))['then'](respondWithResult(_0x413f8a,null))[_0xdda2('0x2c')](handleError(_0x413f8a,null));};exports[_0xdda2('0x53')]=function(_0x1b24f2,_0x560f20){return db[_0xdda2('0x4d')][_0xdda2('0x53')](_0x1b24f2['body'],{})[_0xdda2('0x22')](respondWithResult(_0x560f20,0xc9))['catch'](handleError(_0x560f20,null));};exports[_0xdda2('0x54')]=function(_0x10fbac,_0x378704){if(_0x10fbac[_0xdda2('0x55')]['id']){delete _0x10fbac[_0xdda2('0x55')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x10fbac['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x378704,null))[_0xdda2('0x22')](saveUpdates(_0x10fbac['body'],null))[_0xdda2('0x22')](respondWithResult(_0x378704,null))[_0xdda2('0x2c')](handleError(_0x378704,null));};exports[_0xdda2('0x35')]=function(_0x4b067e,_0x3fd76c){return db[_0xdda2('0x4d')][_0xdda2('0x52')]({'where':{'id':_0x4b067e['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x3fd76c,null))[_0xdda2('0x22')](removeEntity(_0x3fd76c,null))[_0xdda2('0x2c')](handleError(_0x3fd76c,null));};exports[_0xdda2('0x56')]=function(_0x5d8602,_0x4645f8){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x4645f8,null))[_0xdda2('0x2c')](handleError(_0x4645f8,null));};var interaction_log=require(_0xdda2('0x15'))(_0xdda2('0x57'));exports[_0xdda2('0x58')]=function(_0x3f511d,_0x16cc37,_0x29a739){var _0x3ac33a={'channel':_0xdda2('0x59')};if(_0x3f511d[_0xdda2('0x55')]['id']){delete _0x3f511d[_0xdda2('0x55')]['id'];}_0x3f511d['body'][_0xdda2('0x5a')]=!![];_0x3f511d[_0xdda2('0x55')][_0xdda2('0x5b')]=moment()[_0xdda2('0x5c')](_0xdda2('0x5d'));_0x3f511d[_0xdda2('0x55')][_0xdda2('0x5e')]=_0x3f511d['body'][_0xdda2('0x5e')]||_0x3f511d[_0xdda2('0x5f')]['id'];return db[_0xdda2('0x4d')][_0xdda2('0x52')]({'where':{'id':_0x3f511d[_0xdda2('0x60')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xdda2('0x61')}]})[_0xdda2('0x22')](handleEntityNotFound(_0x16cc37,null))[_0xdda2('0x22')](saveUpdates(_0x3f511d[_0xdda2('0x55')],null))[_0xdda2('0x22')](function(_0x4a6f28){if(_0x4a6f28){_0x3ac33a[_0xdda2('0x2a')]=_0x4a6f28[_0xdda2('0x62')]({'plain':!![]});return db[_0xdda2('0x63')][_0xdda2('0x52')]({'where':{'id':_0x4a6f28[_0xdda2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x16cc37,null))[_0xdda2('0x22')](function(_0x3d7951){if(_0x3d7951){return _0x3d7951[_0xdda2('0x54')]({'UserId':_0x3f511d['body'][_0xdda2('0x5e')],'read1stAt':_['isNil'](_0x3d7951[_0xdda2('0x65')])?moment()[_0xdda2('0x5c')](_0xdda2('0x5d')):undefined});}return null;})['then'](function(_0x28ee2b){if(_0x28ee2b){_0x3ac33a[_0xdda2('0x66')]=_0x28ee2b['get']({'plain':!![]});interaction_log[_0xdda2('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3f511d[_0xdda2('0x5f')]['id'],_0x3f511d[_0xdda2('0x5f')][_0xdda2('0x3e')],_0x3f511d[_0xdda2('0x5f')][_0xdda2('0x67')],_0x3ac33a['interaction']['id'],_0x3f511d['body']?JSON[_0xdda2('0x28')](_0x3f511d[_0xdda2('0x55')]):'null');return respondWithRpcPromise('AcceptMessage',_0xdda2('0x68'),_0x3ac33a);}return null;})['then'](function(_0x12a052){if(_0x12a052){if(_0x3f511d[_0xdda2('0x55')]['manual']){_0x3ac33a[_0xdda2('0x2a')][_0xdda2('0x69')]=util[_0xdda2('0x5c')](_0xdda2('0x6a'),_0x3f511d[_0xdda2('0x5f')][_0xdda2('0x3e')]);_0x3ac33a['message'][_0xdda2('0x6b')]=_0x3ac33a[_0xdda2('0x6b')];_0x3ac33a[_0xdda2('0x2a')]['event']=_0xdda2('0x58');return respondWithRpcPromise(_0xdda2('0x6c'),'EventManager',{'event':'acceptmessage','message':_0x3ac33a[_0xdda2('0x2a')]},client9002)[_0xdda2('0x22')](function(){return _0x3ac33a;});}return _0x3ac33a;}return null;})[_0xdda2('0x22')](respondWithResult(_0x16cc37,null))['catch'](handleError(_0x16cc37,null));};var interaction_log=require('../../config/logger')(_0xdda2('0x57'));exports['reject']=function(_0x18edab,_0x150dcd,_0x19d92e){var _0x12fd67={'agent':{},'channel':_0xdda2('0x59')};if(_0x18edab[_0xdda2('0x55')]['id']){delete _0x18edab['body']['id'];}_0x18edab['body'][_0xdda2('0x5e')]=_0x18edab['body'][_0xdda2('0x5e')]||_0x18edab[_0xdda2('0x5f')]['id'];_0x12fd67[_0xdda2('0x6d')]['id']=_0x18edab[_0xdda2('0x55')][_0xdda2('0x5e')];return db[_0xdda2('0x4d')][_0xdda2('0x52')]({'where':{'id':_0x18edab[_0xdda2('0x60')]['id'],'UserId':null}})[_0xdda2('0x22')](handleEntityNotFound(_0x150dcd,null))['then'](function(_0x152b1c){if(_0x152b1c){_0x12fd67[_0xdda2('0x2a')]=_0x152b1c[_0xdda2('0x62')]({'plain':!![]});return db[_0xdda2('0x63')]['find']({'where':{'id':_0x152b1c[_0xdda2('0x64')]}});}return null;})[_0xdda2('0x22')](handleEntityNotFound(_0x150dcd,null))[_0xdda2('0x22')](function(_0x34a8ee){if(_0x34a8ee){_0x12fd67['interaction']=_0x34a8ee['get']({'plain':!![]});interaction_log[_0xdda2('0x23')](_0xdda2('0x6e'),_0x18edab[_0xdda2('0x5f')]['id'],_0x18edab[_0xdda2('0x5f')]['name'],_0x18edab[_0xdda2('0x5f')][_0xdda2('0x67')],_0x12fd67[_0xdda2('0x66')]['id'],_0x18edab[_0xdda2('0x55')]?JSON[_0xdda2('0x28')](_0x18edab[_0xdda2('0x55')]):_0xdda2('0x6f'));return respondWithRpcPromise(_0xdda2('0x70'),_0xdda2('0x71'),_0x12fd67);}return null;})[_0xdda2('0x22')](function(_0x12ff97){if(_0x12ff97){_0x12ff97[_0xdda2('0x2a')][_0xdda2('0x69')]=util[_0xdda2('0x5c')](_0xdda2('0x6a'),_0x18edab['user'][_0xdda2('0x3e')]);_0x12ff97[_0xdda2('0x2a')]['channel']=_0x12fd67['channel'];_0x12ff97[_0xdda2('0x2a')][_0xdda2('0x72')]=_0xdda2('0x34');respondWithRpcPromise(_0xdda2('0x6c'),_0xdda2('0x6c'),{'event':_0xdda2('0x73'),'message':_0x12ff97['message']},client9002);return _0x12fd67;}return null;})[_0xdda2('0x22')](respondWithResult(_0x150dcd,null))[_0xdda2('0x2c')](handleError(_0x150dcd,null));};exports[_0xdda2('0x2e')]=function(_0x2bb4f3,_0x563be8,_0xbf1248){if(_0x2bb4f3['body']['id']){delete _0x2bb4f3[_0xdda2('0x55')]['id'];}var _0x6b6dad;return db['WhatsappMessage'][_0xdda2('0x52')]({'where':{'id':_0x2bb4f3[_0xdda2('0x60')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x563be8,null))[_0xdda2('0x22')](function(_0x222099){if(_0x222099){_0x6b6dad=_0x222099;return db[_0xdda2('0x74')][_0xdda2('0x52')]({'where':{'id':_0x222099[_0xdda2('0x75')]}});}})[_0xdda2('0x22')](handleEntityNotFound(_0x563be8,null))[_0xdda2('0x22')](function(_0xb875f6){if(_0xb875f6){logger['debug'](_0xdda2('0x76'),_0xdda2('0x2e'),_0xdda2('0x77'),_0xb875f6[_0xdda2('0x4a')],util[_0xdda2('0x78')](_0x2bb4f3['body'],{'showHidden':![],'depth':null}));switch(_0xb875f6[_0xdda2('0x4a')]){case _0xdda2('0x79'):if(_0x2bb4f3['body'][_0xdda2('0x7a')]&&_0x2bb4f3[_0xdda2('0x55')]['MessageSid']===_0x6b6dad['messageId']&&_0x2bb4f3[_0xdda2('0x55')][_0xdda2('0x7b')]&&_0x2bb4f3[_0xdda2('0x55')][_0xdda2('0x7b')]===_0xdda2('0x5a')){return _0x6b6dad[_0xdda2('0x54')]({'read':!![]});}else{logger['error'](_0xdda2('0x7c'),_0xdda2('0x2e'),'twilio',util[_0xdda2('0x78')](_0x2bb4f3[_0xdda2('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x6b6dad;}})['then'](respondWithResult(_0x563be8,null))[_0xdda2('0x2c')](handleError(_0x563be8,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 55968ab..a53e51d 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x1492d7,_0x5b7372){var _0x33ea12=function(_0x2b5973){while(--_0x2b5973){_0x1492d7['push'](_0x1492d7['shift']());}};_0x33ea12(++_0x5b7372);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d075a,_0x507f04){_0x3d075a=_0x3d075a-0x0;var _0x418be1=_0xb10b[_0x3d075a];return _0x418be1;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x3930e0,_0x2ab4b8){var _0x365e8f=function(_0x1200c2){while(--_0x1200c2){_0x3930e0['push'](_0x3930e0['shift']());}};_0x365e8f(++_0x2ab4b8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x320000,_0x2d4067){_0x320000=_0x320000-0x0;var _0x1f6901=_0x5f2f[_0x320000];return _0x1f6901;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 2f71ee2..3f85c4d 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 _0x079d=['messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','rimraf','../../config/environment','exports','define','WhatsappMessage'];(function(_0x225b34,_0x287a4f){var _0x27df8f=function(_0x5a6cb2){while(--_0x5a6cb2){_0x225b34['push'](_0x225b34['shift']());}};_0x27df8f(++_0x287a4f);}(_0x079d,0xd8));var _0xd079=function(_0x41cf76,_0x42850a){_0x41cf76=_0x41cf76-0x0;var _0x84f90e=_0x079d[_0x41cf76];return _0x84f90e;};'use strict';var _=require(_0xd079('0x0'));var util=require(_0xd079('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd079('0x2'));var BPromise=require('bluebird');var rp=require(_0xd079('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd079('0x4'));var config=require(_0xd079('0x5'));var attributes=require('./whatsappMessage.attributes');module[_0xd079('0x6')]=function(_0xe38eb7,_0x1cdd86){return _0xe38eb7[_0xd079('0x7')](_0xd079('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd079('0x9'),'fields':['messageId']},{'name':_0xd079('0xa'),'fields':[_0xd079('0xb')],'type':_0xd079('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a82ad,_0x3871a8,_0x24b065){var _0x1a77aa=_0xe38eb7[_0xd079('0xd')];var _0x47e082=_0x5a82ad[_0xd079('0xe')]({'plain':!![]});if(_0x47e082[_0xd079('0xf')][_0xd079('0x10')]()==='in'||_0x47e082[_0xd079('0xf')][_0xd079('0x10')]()===_0xd079('0x11')&&!_0x47e082[_0xd079('0x12')]&&!_[_0xd079('0x13')](_0x47e082['UserId'])){_0x1a77aa[_0xd079('0x14')][_0xd079('0x15')]({'where':{'id':_0x47e082['WhatsappInteractionId']}})[_0xd079('0x16')](function(_0x2390ec){if(_0x2390ec){_0x2390ec[_0xd079('0x17')]({'lastMsgAt':_0x47e082[_0xd079('0x18')],'lastMsgDirection':_0x47e082[_0xd079('0xf')][_0xd079('0x10')]()});}})[_0xd079('0x19')](function(_0x1f6d5d){console[_0xd079('0x1a')](_0x1f6d5d);});}if(_0x47e082[_0xd079('0xf')]===_0xd079('0x11')&&!_0x47e082['secret']){var _0x2cc204;_0x1a77aa[_0xd079('0x1b')]['find']({'where':{'id':_0x47e082['WhatsappAccountId']},'raw':!![]})[_0xd079('0x16')](function(_0x2f5b28){_0x2cc204=_0x2f5b28;if(_0x2cc204&&_0x2cc204[_0xd079('0x1c')]){switch(_0x2cc204[_0xd079('0x1c')]){case'twilio':var _0x24a9c9=require(_0xd079('0x1d'));if(_0x2cc204[_0xd079('0x1e')]&&_0x2cc204[_0xd079('0x1f')]&&_0x2cc204[_0xd079('0x20')]){var _0x3998ac=new _0x24a9c9(_0x2cc204[_0xd079('0x1e')],_0x2cc204['authToken']);_0x3998ac[_0xd079('0x21')][_0xd079('0x22')]({'body':_0x47e082[_0xd079('0xb')],'to':_0xd079('0x23')+_0x47e082[_0xd079('0x20')],'from':_0xd079('0x23')+_0x2cc204['phone'],'statusCallback':_0x2cc204[_0xd079('0x24')]+'/api/whatsapp/messages/'+_0x47e082['id']+_0xd079('0x25')+_0x2cc204['token']})[_0xd079('0x16')](function(_0x46fabf){if(_0x46fabf[_0xd079('0x26')]){return _0x5a82ad['update']({'messageId':_0x46fabf['sid']});}})[_0xd079('0x19')](function(_0x3a9c08){logger[_0xd079('0x1a')](_0xd079('0x27'),_0xd079('0x28'),_0xd079('0x1d'),util[_0xd079('0x29')](_0x3a9c08,{'showHidden':![],'depth':null}));});}else{logger[_0xd079('0x1a')](_0xd079('0x27'),_0xd079('0x28'),_0xd079('0x1d'),_0xd079('0x2a'));}break;}}})['finally'](function(){_0x24b065();});}else{_0x24b065();}}},'charset':_0xd079('0x2b'),'collate':_0xd079('0x2c')});}; \ No newline at end of file +var _0x2643=['accountSid','create','whatsapp:','/api/whatsapp/messages/','/status?token=','sid','update','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio'];(function(_0x3cc72f,_0x1c8617){var _0x45031e=function(_0x426639){while(--_0x426639){_0x3cc72f['push'](_0x3cc72f['shift']());}};_0x45031e(++_0x1c8617);}(_0x2643,0x197));var _0x3264=function(_0xd26128,_0x34ef84){_0xd26128=_0xd26128-0x0;var _0x4b492f=_0x2643[_0xd26128];return _0x4b492f;};'use strict';var _=require(_0x3264('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3264('0x1'));var moment=require(_0x3264('0x2'));var BPromise=require(_0x3264('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3264('0x4'));var rimraf=require(_0x3264('0x5'));var config=require(_0x3264('0x6'));var attributes=require(_0x3264('0x7'));module[_0x3264('0x8')]=function(_0x1dfbb7,_0x28f0aa){return _0x1dfbb7['define'](_0x3264('0x9'),attributes,{'tableName':_0x3264('0xa'),'paranoid':![],'indexes':[{'name':_0x3264('0xb'),'fields':[_0x3264('0xb')]},{'name':_0x3264('0xc'),'fields':[_0x3264('0xd')],'type':_0x3264('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9432f6,_0x4e0255,_0x33a632){var _0x40bd7d=_0x1dfbb7[_0x3264('0xf')];var _0x184f8a=_0x9432f6[_0x3264('0x10')]({'plain':!![]});if(_0x184f8a[_0x3264('0x11')][_0x3264('0x12')]()==='in'||_0x184f8a[_0x3264('0x11')][_0x3264('0x12')]()===_0x3264('0x13')&&!_0x184f8a[_0x3264('0x14')]&&!_[_0x3264('0x15')](_0x184f8a[_0x3264('0x16')])){_0x40bd7d[_0x3264('0x17')][_0x3264('0x18')]({'where':{'id':_0x184f8a[_0x3264('0x19')]}})[_0x3264('0x1a')](function(_0x517b43){if(_0x517b43){_0x517b43['update']({'lastMsgAt':_0x184f8a[_0x3264('0x1b')],'lastMsgDirection':_0x184f8a[_0x3264('0x11')][_0x3264('0x12')]()});}})[_0x3264('0x1c')](function(_0x12cc49){console['error'](_0x12cc49);});}if(_0x184f8a['direction']===_0x3264('0x13')&&!_0x184f8a[_0x3264('0x14')]){var _0x13e6c4;_0x40bd7d[_0x3264('0x1d')][_0x3264('0x1e')]({'where':{'id':_0x184f8a[_0x3264('0x1f')]},'raw':!![]})[_0x3264('0x1a')](function(_0x4b2398){_0x13e6c4=_0x4b2398;if(_0x13e6c4&&_0x13e6c4[_0x3264('0x20')]){switch(_0x13e6c4['type']){case _0x3264('0x21'):var _0x3d0f3f=require(_0x3264('0x21'));if(_0x13e6c4[_0x3264('0x22')]&&_0x13e6c4['authToken']&&_0x13e6c4['phone']){var _0x291589=new _0x3d0f3f(_0x13e6c4[_0x3264('0x22')],_0x13e6c4['authToken']);_0x291589['messages'][_0x3264('0x23')]({'body':_0x184f8a[_0x3264('0xd')],'to':_0x3264('0x24')+_0x184f8a['phone'],'from':'whatsapp:'+_0x13e6c4['phone'],'statusCallback':_0x13e6c4['remote']+_0x3264('0x25')+_0x184f8a['id']+_0x3264('0x26')+_0x13e6c4['token']})[_0x3264('0x1a')](function(_0x42d775){if(_0x42d775[_0x3264('0x27')]){return _0x9432f6[_0x3264('0x28')]({'messageId':_0x42d775[_0x3264('0x27')]});}})['catch'](function(_0x365b3b){logger[_0x3264('0x29')](_0x3264('0x2a'),_0x3264('0x2b'),'twilio',util[_0x3264('0x2c')](_0x365b3b,{'showHidden':![],'depth':null}));});}else{logger[_0x3264('0x29')](_0x3264('0x2a'),_0x3264('0x2b'),_0x3264('0x21'),_0x3264('0x2d'));}break;}}})[_0x3264('0x2e')](function(){_0x33a632();});}else{_0x33a632();}}},'charset':_0x3264('0x2f'),'collate':_0x3264('0x30')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 587cbf3..44a444b 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 _0x0202=['redis','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateWhatsappMessage','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter'];(function(_0x420ad3,_0x596d82){var _0xcd2d0c=function(_0x451ce9){while(--_0x451ce9){_0x420ad3['push'](_0x420ad3['shift']());}};_0xcd2d0c(++_0x596d82);}(_0x0202,0x92));var _0x2020=function(_0xb47556,_0x55438d){_0xb47556=_0xb47556-0x0;var _0x8a3773=_0x0202[_0xb47556];return _0x8a3773;};'use strict';var _=require(_0x2020('0x0'));var util=require(_0x2020('0x1'));var moment=require('moment');var BPromise=require(_0x2020('0x2'));var rs=require(_0x2020('0x3'));var fs=require('fs');var Redis=require(_0x2020('0x4'));var db=require(_0x2020('0x5'))['db'];var utils=require(_0x2020('0x6'));var logger=require(_0x2020('0x7'))(_0x2020('0x8'));var config=require('../../config/environment');var jayson=require(_0x2020('0x9'));var client=jayson[_0x2020('0xa')][_0x2020('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2020('0xc'),'port':0x18eb});var socket=require(_0x2020('0xd'))(new Redis(config[_0x2020('0xe')]));require(_0x2020('0xf'))[_0x2020('0x10')](socket);function respondWithRpcPromise(_0x1bc9af,_0x103320,_0x541520){return new BPromise(function(_0x1dbf08,_0x18a1b4){return client[_0x2020('0x11')](_0x1bc9af,_0x541520)[_0x2020('0x12')](function(_0xe6b799){logger[_0x2020('0x13')](_0x2020('0x14'),_0x103320,_0x2020('0x15'));logger['debug'](_0x2020('0x16'),_0x103320,_0x2020('0x15'),JSON['stringify'](_0xe6b799));if(_0xe6b799[_0x2020('0x17')]){if(_0xe6b799[_0x2020('0x17')][_0x2020('0x18')]===0x1f4){logger[_0x2020('0x17')](_0x2020('0x14'),_0x103320,_0xe6b799[_0x2020('0x17')][_0x2020('0x19')]);return _0x18a1b4(_0xe6b799['error']['message']);}logger[_0x2020('0x17')](_0x2020('0x14'),_0x103320,_0xe6b799[_0x2020('0x17')][_0x2020('0x19')]);return _0x1dbf08(_0xe6b799['error'][_0x2020('0x19')]);}else{logger[_0x2020('0x13')](_0x2020('0x14'),_0x103320,'request\x20sent');_0x1dbf08(_0xe6b799['result'][_0x2020('0x19')]);}})[_0x2020('0x1a')](function(_0xce05c8){logger[_0x2020('0x17')](_0x2020('0x14'),_0x103320,_0xce05c8);_0x18a1b4(_0xce05c8);});});}exports[_0x2020('0x1b')]=function(_0x3c81ee){var _0x50be87=this;return new Promise(function(_0x4d3173,_0x4c6ad1){return db['WhatsappMessage']['create'](_0x3c81ee[_0x2020('0x1c')],{'raw':_0x3c81ee[_0x2020('0x1d')]?_0x3c81ee[_0x2020('0x1d')][_0x2020('0x1e')]===undefined?!![]:![]:!![]})[_0x2020('0x12')](function(_0x21bdd1){logger['info'](_0x2020('0x1b'),_0x3c81ee);logger[_0x2020('0x1f')]('CreateWhatsappMessage',_0x3c81ee,JSON['stringify'](_0x21bdd1));_0x4d3173(_0x21bdd1);})[_0x2020('0x1a')](function(_0x493d7b){logger[_0x2020('0x17')](_0x2020('0x1b'),_0x493d7b[_0x2020('0x19')],_0x3c81ee);_0x4c6ad1(_0x50be87[_0x2020('0x17')](0x1f4,_0x493d7b[_0x2020('0x19')]));});});}; \ No newline at end of file +var _0x6fe3=['../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x171ac7,_0x339c8d){var _0x94478d=function(_0xedf6e6){while(--_0xedf6e6){_0x171ac7['push'](_0x171ac7['shift']());}};_0x94478d(++_0x339c8d);}(_0x6fe3,0xb3));var _0x36fe=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x6fe3[_0x11a220];return _0x20d8fe;};'use strict';var _=require(_0x36fe('0x0'));var util=require(_0x36fe('0x1'));var moment=require(_0x36fe('0x2'));var BPromise=require(_0x36fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36fe('0x4'))['db'];var utils=require(_0x36fe('0x5'));var logger=require('../../config/logger')(_0x36fe('0x6'));var config=require(_0x36fe('0x7'));var jayson=require(_0x36fe('0x8'));var client=jayson[_0x36fe('0x9')][_0x36fe('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x36fe('0xb'),'port':0x18eb});var socket=require(_0x36fe('0xc'))(new Redis(config[_0x36fe('0xd')]));require(_0x36fe('0xe'))[_0x36fe('0xf')](socket);function respondWithRpcPromise(_0x2dc081,_0x50b39d,_0x452d27){return new BPromise(function(_0x2057ee,_0x4fca1b){return client['request'](_0x2dc081,_0x452d27)[_0x36fe('0x10')](function(_0x1afa00){logger['info'](_0x36fe('0x11'),_0x50b39d,'request\x20sent');logger[_0x36fe('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x50b39d,_0x36fe('0x13'),JSON[_0x36fe('0x14')](_0x1afa00));if(_0x1afa00['error']){if(_0x1afa00[_0x36fe('0x15')][_0x36fe('0x16')]===0x1f4){logger[_0x36fe('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x50b39d,_0x1afa00['error'][_0x36fe('0x17')]);return _0x4fca1b(_0x1afa00['error'][_0x36fe('0x17')]);}logger[_0x36fe('0x15')](_0x36fe('0x11'),_0x50b39d,_0x1afa00[_0x36fe('0x15')][_0x36fe('0x17')]);return _0x2057ee(_0x1afa00['error']['message']);}else{logger[_0x36fe('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x50b39d,_0x36fe('0x13'));_0x2057ee(_0x1afa00['result'][_0x36fe('0x17')]);}})[_0x36fe('0x19')](function(_0x369743){logger['error'](_0x36fe('0x11'),_0x50b39d,_0x369743);_0x4fca1b(_0x369743);});});}exports[_0x36fe('0x1a')]=function(_0x15c89c){var _0x46ba7c=this;return new Promise(function(_0xb902f1,_0x597223){return db[_0x36fe('0x1b')][_0x36fe('0x1c')](_0x15c89c['body'],{'raw':_0x15c89c[_0x36fe('0x1d')]?_0x15c89c[_0x36fe('0x1d')][_0x36fe('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x375489){logger['info'](_0x36fe('0x1a'),_0x15c89c);logger[_0x36fe('0x12')](_0x36fe('0x1a'),_0x15c89c,JSON[_0x36fe('0x14')](_0x375489));_0xb902f1(_0x375489);})[_0x36fe('0x19')](function(_0x20a705){logger[_0x36fe('0x15')](_0x36fe('0x1a'),_0x20a705[_0x36fe('0x17')],_0x15c89c);_0x597223(_0x46ba7c[_0x36fe('0x15')](0x1f4,_0x20a705['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6d97923..1d67946 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 _0x6925=['emit','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x131317,_0x2f91cf){var _0x2a6d1b=function(_0x567e3e){while(--_0x567e3e){_0x131317['push'](_0x131317['shift']());}};_0x2a6d1b(++_0x2f91cf);}(_0x6925,0x6f));var _0x5692=function(_0x4d3f47,_0xf05619){_0x4d3f47=_0x4d3f47-0x0;var _0x2b1323=_0x6925[_0x4d3f47];return _0x2b1323;};'use strict';var WhatsappMessageEvents=require(_0x5692('0x0'));var events=[_0x5692('0x1'),_0x5692('0x2'),'update'];function createListener(_0x203a35,_0x287e3b){return function(_0x1c4537){_0x287e3b[_0x5692('0x3')](_0x203a35,_0x1c4537);};}function removeListener(_0x58a2d5,_0x5f4558){return function(){WhatsappMessageEvents['removeListener'](_0x58a2d5,_0x5f4558);};}exports['register']=function(_0x4937d1){for(var _0x12fa86=0x0,_0x5c717e=events[_0x5692('0x4')];_0x12fa86<_0x5c717e;_0x12fa86++){var _0x51eb2e=events[_0x12fa86];var _0x3bc336=createListener(_0x5692('0x5')+_0x51eb2e,_0x4937d1);WhatsappMessageEvents['on'](_0x51eb2e,_0x3bc336);}}; \ No newline at end of file +var _0x3abc=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3abc,0x1ef));var _0xc3ab=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x3abc[_0x376b45];return _0x2341b3;};'use strict';var WhatsappMessageEvents=require(_0xc3ab('0x0'));var events=[_0xc3ab('0x1'),'remove',_0xc3ab('0x2')];function createListener(_0x29fb65,_0x5de433){return function(_0x525868){_0x5de433[_0xc3ab('0x3')](_0x29fb65,_0x525868);};}function removeListener(_0x362dd4,_0x2b0b8a){return function(){WhatsappMessageEvents['removeListener'](_0x362dd4,_0x2b0b8a);};}exports[_0xc3ab('0x4')]=function(_0x37ddaa){for(var _0x4195fe=0x0,_0x5d993f=events[_0xc3ab('0x5')];_0x4195fe<_0x5d993f;_0x4195fe++){var _0x5d5b14=events[_0x4195fe];var _0x22e6c2=createListener(_0xc3ab('0x6')+_0x5d5b14,_0x37ddaa);WhatsappMessageEvents['on'](_0x5d5b14,_0x22e6c2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f3f0cd7..01c5533 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 _0x4f44=['/describe','describe','/:id/members','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','/:id','destroy','removeTeams','removeAgents','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x139a70,_0xe5e463){var _0x579610=function(_0x522496){while(--_0x522496){_0x139a70['push'](_0x139a70['shift']());}};_0x579610(++_0xe5e463);}(_0x4f44,0x94));var _0x44f4=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4f44[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x44f4('0x0'));var timeout=require(_0x44f4('0x1'));var express=require('express');var router=express[_0x44f4('0x2')]();var auth=require(_0x44f4('0x3'));var interaction=require(_0x44f4('0x4'));var config=require(_0x44f4('0x5'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x44f4('0x6')](),controller['index']);router[_0x44f4('0x7')](_0x44f4('0x8'),auth['isAuthenticated'](),controller[_0x44f4('0x9')]);router[_0x44f4('0x7')]('/:id',auth[_0x44f4('0x6')](),controller['show']);router[_0x44f4('0x7')](_0x44f4('0xa'),auth[_0x44f4('0x6')](),controller[_0x44f4('0xb')]);router[_0x44f4('0x7')](_0x44f4('0xc'),auth[_0x44f4('0x6')](),controller['getTeams']);router[_0x44f4('0x7')]('/:id/users',auth[_0x44f4('0x6')](),controller[_0x44f4('0xd')]);router['post']('/',auth[_0x44f4('0x6')](),controller[_0x44f4('0xe')]);router[_0x44f4('0xf')](_0x44f4('0xc'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x10')]);router[_0x44f4('0xf')](_0x44f4('0x11'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x44f4('0x13')]);router[_0x44f4('0x14')](_0x44f4('0x15'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x16')]);router[_0x44f4('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x44f4('0x17')]);router[_0x44f4('0x14')](_0x44f4('0x11'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x18')]);module[_0x44f4('0x19')]=router; \ No newline at end of file +var _0x0db4=['isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller'];(function(_0xc4038f,_0xdb8b49){var _0x780c5b=function(_0x14caa4){while(--_0x14caa4){_0xc4038f['push'](_0xc4038f['shift']());}};_0x780c5b(++_0xdb8b49);}(_0x0db4,0x118));var _0x40db=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x0db4[_0x3b5049];return _0x12454e;};'use strict';var multer=require('multer');var util=require(_0x40db('0x0'));var path=require('path');var timeout=require(_0x40db('0x1'));var express=require(_0x40db('0x2'));var router=express['Router']();var auth=require(_0x40db('0x3'));var interaction=require(_0x40db('0x4'));var config=require('../../config/environment');var controller=require(_0x40db('0x5'));router['get']('/',auth[_0x40db('0x6')](),controller[_0x40db('0x7')]);router[_0x40db('0x8')](_0x40db('0x9'),auth[_0x40db('0x6')](),controller[_0x40db('0xa')]);router[_0x40db('0x8')](_0x40db('0xb'),auth[_0x40db('0x6')](),controller['show']);router['get'](_0x40db('0xc'),auth[_0x40db('0x6')](),controller['getMembers']);router[_0x40db('0x8')]('/:id/teams',auth[_0x40db('0x6')](),controller[_0x40db('0xd')]);router['get'](_0x40db('0xe'),auth[_0x40db('0x6')](),controller[_0x40db('0xf')]);router[_0x40db('0x10')]('/',auth[_0x40db('0x6')](),controller[_0x40db('0x11')]);router[_0x40db('0x10')](_0x40db('0x12'),auth[_0x40db('0x6')](),controller[_0x40db('0x13')]);router[_0x40db('0x10')](_0x40db('0xe'),auth[_0x40db('0x6')](),controller[_0x40db('0x14')]);router[_0x40db('0x15')](_0x40db('0xb'),auth[_0x40db('0x6')](),controller['update']);router[_0x40db('0x16')](_0x40db('0xb'),auth['isAuthenticated'](),controller[_0x40db('0x17')]);router[_0x40db('0x16')]('/:id/teams',auth[_0x40db('0x6')](),controller[_0x40db('0x18')]);router[_0x40db('0x16')](_0x40db('0xe'),auth[_0x40db('0x6')](),controller[_0x40db('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 768eda7..f6a9a9f 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 _0x1605=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1605,0x19a));var _0x5160=function(_0x30c1ab,_0x5d4287){_0x30c1ab=_0x30c1ab-0x0;var _0x2fe812=_0x1605[_0x30c1ab];return _0x2fe812;};'use strict';var Sequelize=require('sequelize');module[_0x5160('0x0')]={'name':{'type':Sequelize[_0x5160('0x1')],'unique':_0x5160('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5160('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5160('0x4')](_0x5160('0x5'),_0x5160('0x6'),_0x5160('0x7'))},'description':{'type':Sequelize[_0x5160('0x1')]}}; \ No newline at end of file +var _0x5e33=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x252782,_0x5b7839){var _0x5123ea=function(_0xbace4b){while(--_0xbace4b){_0x252782['push'](_0x252782['shift']());}};_0x5123ea(++_0x5b7839);}(_0x5e33,0x17f));var _0x35e3=function(_0x5c88be,_0x50952e){_0x5c88be=_0x5c88be-0x0;var _0x4f9281=_0x5e33[_0x5c88be];return _0x4f9281;};'use strict';var Sequelize=require(_0x35e3('0x0'));module[_0x35e3('0x1')]={'name':{'type':Sequelize[_0x35e3('0x2')],'unique':_0x35e3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x35e3('0x4')](_0x35e3('0x5'),_0x35e3('0x6'),_0x35e3('0x7'))},'description':{'type':Sequelize[_0x35e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8c4b263..29b9db6 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 _0xca32=['omit','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','includes','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents'];(function(_0x279478,_0x5d9207){var _0x141575=function(_0x2d8142){while(--_0x2d8142){_0x279478['push'](_0x279478['shift']());}};_0x141575(++_0x5d9207);}(_0xca32,0x1a8));var _0x2ca3=function(_0x47e048,_0x59cfce){_0x47e048=_0x47e048-0x0;var _0xb3e171=_0xca32[_0x47e048];return _0xb3e171;};'use strict';var pdf=require(_0x2ca3('0x0'));var emlformat=require(_0x2ca3('0x1'));var rimraf=require(_0x2ca3('0x2'));var zipdir=require(_0x2ca3('0x3'));var jsonpatch=require(_0x2ca3('0x4'));var rp=require(_0x2ca3('0x5'));var moment=require(_0x2ca3('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2ca3('0x7'));var sox=require(_0x2ca3('0x8'));var csv=require(_0x2ca3('0x9'));var ejs=require(_0x2ca3('0xa'));var fs=require('fs');var _=require(_0x2ca3('0xb'));var squel=require(_0x2ca3('0xc'));var crypto=require(_0x2ca3('0xd'));var jsforce=require(_0x2ca3('0xe'));var deskjs=require(_0x2ca3('0xf'));var toCsv=require(_0x2ca3('0x9'));var querystring=require('querystring');var Papa=require(_0x2ca3('0x10'));var Redis=require(_0x2ca3('0x11'));var authService=require(_0x2ca3('0x12'));var qs=require(_0x2ca3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ca3('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2ca3('0x15'));var licenseUtil=require(_0x2ca3('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2ca3('0x17')](config['redis'],{'host':_0x2ca3('0x18'),'port':0x18eb});var socket=require(_0x2ca3('0x19'))(new Redis(config[_0x2ca3('0x1a')]));require(_0x2ca3('0x1b'))[_0x2ca3('0x1c')](socket);function respondWithStatusCode(_0x1c93d5,_0x3f0b95){_0x3f0b95=_0x3f0b95||0xcc;return function(_0x4dfa6c){if(_0x4dfa6c){return _0x1c93d5[_0x2ca3('0x1d')](_0x3f0b95);}return _0x1c93d5[_0x2ca3('0x1e')](_0x3f0b95)[_0x2ca3('0x1f')]();};}function respondWithResult(_0x1e1e5b,_0x579d1a){_0x579d1a=_0x579d1a||0xc8;return function(_0x550b8b){if(_0x550b8b){return _0x1e1e5b[_0x2ca3('0x1e')](_0x579d1a)[_0x2ca3('0x20')](_0x550b8b);}};}function respondWithFilteredResult(_0xacad96,_0xf21af0){return function(_0x32d61e){if(_0x32d61e){var _0x2d6121=_0x32d61e[_0x2ca3('0x21')],_0x124a20=_0xf21af0[_0x2ca3('0x22')],_0x2559a6=_0xf21af0['offset']+_0xf21af0[_0x2ca3('0x23')],_0x6397a0;if(_0x2559a6>=_0x2d6121){_0x2559a6=_0x2d6121;_0x6397a0=0xc8;}else{_0x6397a0=0xce;}_0xacad96[_0x2ca3('0x1e')](_0x6397a0);return _0xacad96[_0x2ca3('0x24')](_0x2ca3('0x25'),_0x124a20+'-'+_0x2559a6+'/'+_0x2d6121)[_0x2ca3('0x20')](_0x32d61e);}return null;};}function patchUpdates(_0x55d6de){return function(_0x55af88){try{jsonpatch[_0x2ca3('0x26')](_0x55af88,_0x55d6de,!![]);}catch(_0x410322){return BPromise['reject'](_0x410322);}return _0x55af88[_0x2ca3('0x27')]();};}function saveUpdates(_0x5789bc,_0x19f0c7){return function(_0x33ff00){if(_0x33ff00){return _0x33ff00[_0x2ca3('0x28')](_0x5789bc)[_0x2ca3('0x29')](function(_0x5b025a){return _0x5b025a;});}return null;};}function removeEntity(_0x535843,_0x3b7f0f){return function(_0x26d898){if(_0x26d898){return _0x26d898[_0x2ca3('0x2a')]()[_0x2ca3('0x29')](function(){var _0x3bb5a8=_0x26d898['get']({'plain':!![]});var _0x2694ec=_0x2ca3('0x2b');return db[_0x2ca3('0x2c')][_0x2ca3('0x2a')]({'where':{'type':_0x2694ec,'resourceId':_0x3bb5a8['id']}})['then'](function(){return _0x26d898;});})[_0x2ca3('0x29')](function(){_0x535843['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2730,_0x16f7f4){return function(_0x236a03){if(!_0x236a03){_0x5f2730['sendStatus'](0x194);}return _0x236a03;};}function handleError(_0x573584,_0x226704){_0x226704=_0x226704||0x1f4;return function(_0x547a40){logger['error'](_0x547a40[_0x2ca3('0x2d')]);if(_0x547a40['name']){delete _0x547a40[_0x2ca3('0x2e')];}_0x573584[_0x2ca3('0x1e')](_0x226704)[_0x2ca3('0x2f')](_0x547a40);};}exports[_0x2ca3('0x30')]=function(_0x5ca1e5,_0x2ccf1b){var _0x2e33ee={},_0x5a1324={},_0x1a8f0e={'count':0x0,'rows':[]};var _0x215e8d=_[_0x2ca3('0x31')](db[_0x2ca3('0x32')][_0x2ca3('0x33')],function(_0x1e34ec){return{'name':_0x1e34ec['fieldName'],'type':_0x1e34ec[_0x2ca3('0x34')][_0x2ca3('0x35')]};});_0x5a1324[_0x2ca3('0x36')]=_[_0x2ca3('0x31')](_0x215e8d,'name');_0x5a1324['query']=_[_0x2ca3('0x37')](_0x5ca1e5[_0x2ca3('0x38')]);_0x5a1324[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x5a1324[_0x2ca3('0x36')],_0x5a1324['query']);_0x2e33ee['attributes']=_[_0x2ca3('0x3a')](_0x5a1324[_0x2ca3('0x36')],qs['fields'](_0x5ca1e5['query'][_0x2ca3('0x3b')]));_0x2e33ee[_0x2ca3('0x3c')]=_0x2e33ee[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x2e33ee[_0x2ca3('0x3c')]:_0x5a1324['model'];if(!_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x3e')]('nolimit')){_0x2e33ee[_0x2ca3('0x23')]=qs[_0x2ca3('0x23')](_0x5ca1e5[_0x2ca3('0x38')]['limit']);_0x2e33ee[_0x2ca3('0x22')]=qs[_0x2ca3('0x22')](_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x22')]);}_0x2e33ee[_0x2ca3('0x3f')]=qs[_0x2ca3('0x40')](_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x40')]);_0x2e33ee[_0x2ca3('0x41')]=qs[_0x2ca3('0x39')](_[_0x2ca3('0x42')](_0x5ca1e5[_0x2ca3('0x38')],_0x5a1324['filters']),_0x215e8d);if(_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x43')]){_0x2e33ee[_0x2ca3('0x41')]=_[_0x2ca3('0x44')](_0x2e33ee['where'],{'$or':_[_0x2ca3('0x31')](_0x215e8d,function(_0x134d1c){if(_0x134d1c[_0x2ca3('0x34')]!=='VIRTUAL'){var _0x34ce39={};_0x34ce39[_0x134d1c[_0x2ca3('0x2e')]]={'$like':'%'+_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x43')]+'%'};return _0x34ce39;}})});}_0x2e33ee=_[_0x2ca3('0x44')]({},_0x2e33ee,_0x5ca1e5['options']);var _0xf3f55={'where':_0x2e33ee[_0x2ca3('0x41')]};return db[_0x2ca3('0x32')][_0x2ca3('0x21')](_0xf3f55)[_0x2ca3('0x29')](function(_0x42a0ab){_0x1a8f0e[_0x2ca3('0x21')]=_0x42a0ab;if(_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x45')]){_0x2e33ee[_0x2ca3('0x46')]=[{'all':!![]}];}return db[_0x2ca3('0x32')]['findAll'](_0x2e33ee);})[_0x2ca3('0x29')](function(_0x463ce5){_0x1a8f0e[_0x2ca3('0x47')]=_0x463ce5;return _0x1a8f0e;})['then'](respondWithFilteredResult(_0x2ccf1b,_0x2e33ee))[_0x2ca3('0x48')](handleError(_0x2ccf1b,null));};exports[_0x2ca3('0x49')]=function(_0x38739a,_0x649ee3){var _0x455365={'raw':!![],'where':{'id':_0x38739a[_0x2ca3('0x4a')]['id']}},_0x38ccb0={};_0x38ccb0[_0x2ca3('0x36')]=_[_0x2ca3('0x37')](db[_0x2ca3('0x32')][_0x2ca3('0x33')]);_0x38ccb0[_0x2ca3('0x38')]=_[_0x2ca3('0x37')](_0x38739a[_0x2ca3('0x38')]);_0x38ccb0['filters']=_[_0x2ca3('0x3a')](_0x38ccb0[_0x2ca3('0x36')],_0x38ccb0['query']);_0x455365['attributes']=_[_0x2ca3('0x3a')](_0x38ccb0[_0x2ca3('0x36')],qs[_0x2ca3('0x3b')](_0x38739a[_0x2ca3('0x38')]['fields']));_0x455365['attributes']=_0x455365[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x455365[_0x2ca3('0x3c')]:_0x38ccb0[_0x2ca3('0x36')];if(_0x38739a[_0x2ca3('0x38')][_0x2ca3('0x45')]){_0x455365['include']=[{'all':!![]}];}_0x455365=_[_0x2ca3('0x44')]({},_0x455365,_0x38739a[_0x2ca3('0x4b')]);return db[_0x2ca3('0x32')][_0x2ca3('0x4c')](_0x455365)[_0x2ca3('0x29')](handleEntityNotFound(_0x649ee3,null))['then'](respondWithResult(_0x649ee3,null))[_0x2ca3('0x48')](handleError(_0x649ee3,null));};exports[_0x2ca3('0x4d')]=function(_0x2cc33f,_0x405c67){return db[_0x2ca3('0x32')][_0x2ca3('0x4d')](_0x2cc33f[_0x2ca3('0x4e')],{})['then'](function(_0x1150e5){var _0x42f6b9=_0x2cc33f[_0x2ca3('0x4f')][_0x2ca3('0x50')]({'plain':!![]});if(!_0x42f6b9)throw new Error(_0x2ca3('0x51'));if(_0x42f6b9[_0x2ca3('0x52')]===_0x2ca3('0x4f')){var _0x67ba80=_0x1150e5['get']({'plain':!![]});var _0x3a6222=_0x2ca3('0x2b');return db[_0x2ca3('0x53')][_0x2ca3('0x4c')]({'where':{'name':_0x3a6222,'userProfileId':_0x42f6b9[_0x2ca3('0x54')]},'raw':!![]})[_0x2ca3('0x29')](function(_0x57d679){if(_0x57d679&&_0x57d679[_0x2ca3('0x55')]===0x0){return db[_0x2ca3('0x2c')]['create']({'name':_0x67ba80[_0x2ca3('0x2e')],'resourceId':_0x67ba80['id'],'type':_0x57d679[_0x2ca3('0x2e')],'sectionId':_0x57d679['id']},{})['then'](function(){return _0x1150e5;});}else{return _0x1150e5;}})['catch'](function(_0x3f6729){logger['error'](_0x2ca3('0x56'),_0x3f6729);throw _0x3f6729;});}return _0x1150e5;})[_0x2ca3('0x29')](respondWithResult(_0x405c67,0xc9))['catch'](handleError(_0x405c67,null));};exports[_0x2ca3('0x28')]=function(_0x2e2ccb,_0x21cf0a){if(_0x2e2ccb[_0x2ca3('0x4e')]['id']){delete _0x2e2ccb[_0x2ca3('0x4e')]['id'];}return db[_0x2ca3('0x32')]['find']({'where':{'id':_0x2e2ccb[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x21cf0a,null))['then'](saveUpdates(_0x2e2ccb['body'],null))[_0x2ca3('0x29')](respondWithResult(_0x21cf0a,null))[_0x2ca3('0x48')](handleError(_0x21cf0a,null));};exports[_0x2ca3('0x2a')]=function(_0x2f9a2a,_0x451365){return db[_0x2ca3('0x32')][_0x2ca3('0x4c')]({'where':{'id':_0x2f9a2a[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x451365,null))['then'](removeEntity(_0x451365,null))['catch'](handleError(_0x451365,null));};exports[_0x2ca3('0x57')]=function(_0x4f438e,_0x43a9f8){return db[_0x2ca3('0x32')][_0x2ca3('0x57')]()[_0x2ca3('0x29')](respondWithResult(_0x43a9f8,null))['catch'](handleError(_0x43a9f8,null));};exports[_0x2ca3('0x58')]=function(_0x4bf224,_0x330762,_0x514174){var _0x36cb8e={'raw':!![],'where':{}},_0x92c374={},_0x33151e;return db[_0x2ca3('0x32')][_0x2ca3('0x59')]({'where':{'id':_0x4bf224[_0x2ca3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x330762,null))['then'](function(_0x1725bb){if(_0x1725bb){_0x33151e=_0x1725bb[_0x2ca3('0x50')]({'plain':!![]});_0x92c374[_0x2ca3('0x36')]=_[_0x2ca3('0x37')](db[_0x2ca3('0x5a')][_0x2ca3('0x33')]);_0x92c374['query']=_[_0x2ca3('0x37')](_0x4bf224['query']);_0x92c374[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x92c374['model'],_0x92c374[_0x2ca3('0x38')]);_0x36cb8e['attributes']=_[_0x2ca3('0x3a')](_0x92c374['model'],qs['fields'](_0x4bf224[_0x2ca3('0x38')]['fields']));_0x36cb8e['attributes']=_0x36cb8e['attributes'][_0x2ca3('0x3d')]?_0x36cb8e[_0x2ca3('0x3c')]:_0x92c374[_0x2ca3('0x36')];if(!_0x4bf224['query']['hasOwnProperty'](_0x2ca3('0x5b'))){_0x36cb8e[_0x2ca3('0x23')]=qs['limit'](_0x4bf224[_0x2ca3('0x38')]['limit']);_0x36cb8e[_0x2ca3('0x22')]=qs[_0x2ca3('0x22')](_0x4bf224[_0x2ca3('0x38')][_0x2ca3('0x22')]);}_0x36cb8e['order']=qs[_0x2ca3('0x40')](_0x4bf224[_0x2ca3('0x38')][_0x2ca3('0x40')]);_0x36cb8e['where']=qs[_0x2ca3('0x39')](_[_0x2ca3('0x42')](_0x4bf224[_0x2ca3('0x38')],_0x92c374[_0x2ca3('0x39')]));_0x36cb8e['where'][_0x2ca3('0x5c')]=_0x1725bb['id'];if(_0x4bf224['query'][_0x2ca3('0x43')]){_0x36cb8e[_0x2ca3('0x41')]=_[_0x2ca3('0x44')](_0x36cb8e[_0x2ca3('0x41')],{'$or':_['map'](_0x36cb8e['attributes'],function(_0x495336){var _0x5d075f={};_0x5d075f[_0x495336]={'$like':'%'+_0x4bf224[_0x2ca3('0x38')]['filter']+'%'};return _0x5d075f;})});}_0x36cb8e=_[_0x2ca3('0x44')]({},_0x36cb8e,_0x4bf224[_0x2ca3('0x4b')]);return db['UserWhatsappQueue'][_0x2ca3('0x5d')](_0x36cb8e);}})[_0x2ca3('0x29')](function(_0x135eec){if(_0x135eec){return db[_0x2ca3('0x5e')][_0x2ca3('0x5f')]({'where':{'id':_[_0x2ca3('0x31')](_0x135eec,_0x2ca3('0x60')),'role':_0x2ca3('0x61')},'attributes':['id','name',_0x2ca3('0x62'),_0x2ca3('0x63'),_0x2ca3('0x64')]});}})[_0x2ca3('0x29')](function(_0x2143d3){if(_0x2143d3){return{'count':_0x2143d3[_0x2ca3('0x21')],'rows':_[_0x2ca3('0x31')](_0x2143d3['rows'],function(_0x2ff8bb){return{'membername':_0x2ff8bb[_0x2ca3('0x2e')],'UserId':_0x2ff8bb['id'],'queue_name':_0x33151e[_0x2ca3('0x2e')],'WhatsappQueueId':_0x33151e['id'],'interface':util[_0x2ca3('0x65')]('%s/%s',_0x2ca3('0x66'),_0x2ff8bb[_0x2ca3('0x2e')]),'penalty':0x0,'paused':_0x2ff8bb['whatsappPause'],'createdAt':_0x2ff8bb['createdAt'],'updatedAt':_0x2ff8bb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x330762,_0x36cb8e))[_0x2ca3('0x48')](handleError(_0x330762,null));};exports[_0x2ca3('0x67')]=function(_0x89187,_0x1e0515,_0x54de34){var _0x2f3413={};var _0x28c610={};var _0x15c8b1;var _0x231c08;return db['WhatsappQueue']['findOne']({'where':{'id':_0x89187['params']['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x1e0515,null))['then'](function(_0x36534c){if(_0x36534c){_0x15c8b1=_0x36534c;_0x28c610[_0x2ca3('0x36')]=_[_0x2ca3('0x37')](db['Team'][_0x2ca3('0x33')]);_0x28c610[_0x2ca3('0x38')]=_[_0x2ca3('0x37')](_0x89187[_0x2ca3('0x38')]);_0x28c610[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x28c610['model'],_0x28c610[_0x2ca3('0x38')]);_0x2f3413[_0x2ca3('0x3c')]=_[_0x2ca3('0x3a')](_0x28c610[_0x2ca3('0x36')],qs['fields'](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x3b')]));_0x2f3413[_0x2ca3('0x3c')]=_0x2f3413[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x2f3413[_0x2ca3('0x3c')]:_0x28c610['model'];_0x2f3413[_0x2ca3('0x3f')]=qs[_0x2ca3('0x40')](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x40')]);_0x2f3413[_0x2ca3('0x41')]=qs['filters'](_[_0x2ca3('0x42')](_0x89187[_0x2ca3('0x38')],_0x28c610['filters']));if(_0x89187[_0x2ca3('0x38')]['filter']){_0x2f3413[_0x2ca3('0x41')]=_[_0x2ca3('0x44')](_0x2f3413[_0x2ca3('0x41')],{'$or':_['map'](_0x2f3413[_0x2ca3('0x3c')],function(_0x4f4097){var _0x2f3031={};_0x2f3031[_0x4f4097]={'$like':'%'+_0x89187[_0x2ca3('0x38')][_0x2ca3('0x43')]+'%'};return _0x2f3031;})});}_0x2f3413=_[_0x2ca3('0x44')]({},_0x2f3413,_0x89187['options']);return _0x15c8b1[_0x2ca3('0x67')](_0x2f3413);}})[_0x2ca3('0x29')](function(_0xcbd29e){if(_0xcbd29e){_0x231c08=_0xcbd29e[_0x2ca3('0x3d')];if(!_0x89187[_0x2ca3('0x38')][_0x2ca3('0x3e')](_0x2ca3('0x5b'))){_0x2f3413['limit']=qs['limit'](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x23')]);_0x2f3413[_0x2ca3('0x22')]=qs['offset'](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x22')]);}return _0x15c8b1[_0x2ca3('0x67')](_0x2f3413);}})[_0x2ca3('0x29')](function(_0x3d1588){if(_0x3d1588){return _0x3d1588?{'count':_0x231c08,'rows':_0x3d1588}:null;}})['then'](respondWithResult(_0x1e0515,null))[_0x2ca3('0x48')](handleError(_0x1e0515,null));};exports[_0x2ca3('0x68')]=function(_0x1a32ea,_0x3fea3d,_0x565370){var _0x234703=_0x1a32ea[_0x2ca3('0x4e')][_0x2ca3('0x69')];return db[_0x2ca3('0x6a')]['findAll']({'where':{'id':_0x234703},'attributes':['id'],'include':[{'model':db[_0x2ca3('0x5e')],'as':_0x2ca3('0x6b'),'attributes':['id',_0x2ca3('0x2e'),_0x2ca3('0x6c'),_0x2ca3('0x6d'),_0x2ca3('0x6e')],'raw':!![]}]})['then'](function(_0x4d9357){if(_0x4d9357){var _0x26e354=_[_0x2ca3('0x6f')](_0x4d9357,function(_0x545641){var _0x34b351=_0x545641[_0x2ca3('0x50')]({'plain':!![]});return _0x34b351[_0x2ca3('0x6b')];});return db[_0x2ca3('0x32')][_0x2ca3('0x4c')]({'where':{'id':_0x1a32ea[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](function(_0x38d9c7){return db[_0x2ca3('0x70')][_0x2ca3('0x71')](function(_0x27eb8a){return _0x38d9c7['addTeams'](_0x234703,{'transaction':_0x27eb8a})[_0x2ca3('0x29')](function(){return BPromise[_0x2ca3('0x72')](_0x26e354,function(_0x484605){return db['UserWhatsappQueue'][_0x2ca3('0x73')]({'where':{'UserId':_0x484605['id'],'WhatsappQueueId':_0x1a32ea[_0x2ca3('0x4a')]['id']},'transaction':_0x27eb8a});});})[_0x2ca3('0x29')](function(){_0x26e354[_0x2ca3('0x74')](function(_0x555699){socket[_0x2ca3('0x75')](_0x2ca3('0x76'),{'UserId':_0x555699['id'],'WhatsappQueueId':_0x38d9c7['id']});});});});});}})['then'](respondWithStatusCode(_0x3fea3d,null))[_0x2ca3('0x48')](handleError(_0x3fea3d,null));};exports[_0x2ca3('0x77')]=function(_0x19f340,_0x4f45af,_0x50911e){return db[_0x2ca3('0x6a')][_0x2ca3('0x5d')]({'where':{'id':_0x19f340['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2ca3('0x5e')],'as':_0x2ca3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x2ca3('0x29')](handleEntityNotFound(_0x4f45af,null))[_0x2ca3('0x29')](function(_0x54bbd2){var _0x16aeaa=_['map'](_0x54bbd2,'id');var _0x247ef0=[];var _0x2a911b=[];var _0x4b48c0=squel['select']();_0x4b48c0[_0x2ca3('0x78')]('tq.TeamId')[_0x2ca3('0x79')]('team_has_whatsapp_queues','tq')[_0x2ca3('0x7a')]('user_has_teams','ut',_0x2ca3('0x7b'))[_0x2ca3('0x41')](_0x2ca3('0x7c'),_0x19f340[_0x2ca3('0x4a')]['id']);for(var _0x2de4c3=0x0;_0x2de4c3<_0x54bbd2[_0x2ca3('0x3d')];_0x2de4c3+=0x1){let _0x3cf961=_0x54bbd2[_0x2de4c3];for(var _0x3563d6=0x0;_0x3563d6<_0x3cf961[_0x2ca3('0x6b')][_0x2ca3('0x3d')];_0x3563d6+=0x1){let _0x5b844f=_0x3cf961['Agents'][_0x3563d6];var _0x156182=_0x4b48c0[_0x2ca3('0x7d')]();_0x156182[_0x2ca3('0x41')](_0x2ca3('0x7e'),_0x5b844f['id']);_0x2a911b['push'](db['sequelize'][_0x2ca3('0x38')](_0x156182['toString'](),{'type':db[_0x2ca3('0x70')][_0x2ca3('0x7f')]['SELECT']})['then'](function(_0x43f061){if(_0x43f061['length']===0x1){return _0x5b844f['id'];}else{var _0x1d54e0=_[_0x2ca3('0x80')](_['map'](_0x43f061,'TeamId'),function(_0x29b59e){return _[_0x2ca3('0x81')](_0x16aeaa,_0x29b59e);});if(_0x1d54e0){return _0x5b844f['id'];}}}));}}return BPromise['all'](_0x2a911b)[_0x2ca3('0x29')](function(_0x3e2e2a){_0x247ef0=_(_0x247ef0)[_0x2ca3('0x82')](_0x3e2e2a)[_0x2ca3('0x83')]()[_0x2ca3('0x84')]();return db[_0x2ca3('0x32')]['find']({'where':{'id':_0x19f340[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](function(_0x126bdd){return db[_0x2ca3('0x70')][_0x2ca3('0x71')](function(_0x6b58d6){return _0x126bdd[_0x2ca3('0x77')](_0x19f340['query'][_0x2ca3('0x69')],{'transaction':_0x6b58d6})['then'](function(){if(!_[_0x2ca3('0x85')](_0x247ef0)){return _0x126bdd['removeAgents'](_0x247ef0,{'transaction':_0x6b58d6});}})[_0x2ca3('0x29')](function(){_0x247ef0[_0x2ca3('0x74')](function(_0x119e0d){socket['emit'](_0x2ca3('0x86'),{'UserId':_0x119e0d,'WhatsappQueueId':_0x126bdd['id']});});});});});});})[_0x2ca3('0x29')](respondWithStatusCode(_0x4f45af,null))[_0x2ca3('0x48')](handleError(_0x4f45af,null));};exports['addAgents']=function(_0x1dd6f4,_0x78a6a1,_0x6188e3){return db[_0x2ca3('0x32')]['find']({'where':{'id':_0x1dd6f4[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x78a6a1,null))[_0x2ca3('0x29')](function(_0x2b3bda){if(_0x2b3bda){return _0x2b3bda[_0x2ca3('0x87')](_0x1dd6f4['body'][_0x2ca3('0x69')],_[_0x2ca3('0x88')](_0x1dd6f4[_0x2ca3('0x4e')],['ids','id'])||{})[_0x2ca3('0x89')](function(_0x3e3ab4){for(var _0x43574d=0x0;_0x43574d<_0x1dd6f4[_0x2ca3('0x4e')]['ids'][_0x2ca3('0x3d')];_0x43574d+=0x1){socket[_0x2ca3('0x75')](_0x2ca3('0x76'),{'UserId':_0x1dd6f4[_0x2ca3('0x4e')][_0x2ca3('0x69')][_0x43574d],'WhatsappQueueId':_0x1dd6f4[_0x2ca3('0x4a')]['id']});}return _0x3e3ab4;});}})['then'](respondWithResult(_0x78a6a1,null))[_0x2ca3('0x48')](handleError(_0x78a6a1,null));};exports[_0x2ca3('0x8a')]=function(_0x20ac0b,_0x19092d,_0x46cb4e){return db['WhatsappQueue'][_0x2ca3('0x4c')]({'where':{'id':_0x20ac0b['params']['id']}})['then'](handleEntityNotFound(_0x19092d,null))[_0x2ca3('0x29')](function(_0x4fa4a7){if(_0x4fa4a7){return _0x4fa4a7[_0x2ca3('0x8a')](_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')])[_0x2ca3('0x29')](function(){if(_['isArray'](_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')])){for(var _0x59662d=0x0;_0x59662d<_0x20ac0b['query'][_0x2ca3('0x69')][_0x2ca3('0x3d')];_0x59662d+=0x1){socket[_0x2ca3('0x75')](_0x2ca3('0x86'),{'UserId':Number(_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')][_0x59662d]),'WhatsappQueueId':Number(_0x20ac0b[_0x2ca3('0x4a')]['id'])});}}else{socket[_0x2ca3('0x75')](_0x2ca3('0x86'),{'UserId':Number(_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')]),'WhatsappQueueId':Number(_0x20ac0b[_0x2ca3('0x4a')]['id'])});}});}})[_0x2ca3('0x29')](respondWithStatusCode(_0x19092d,null))[_0x2ca3('0x48')](handleError(_0x19092d,null));};exports[_0x2ca3('0x8b')]=function(_0x333716,_0x24524f,_0x43a5ee){var _0x46965f={};var _0x3b4f7f={};var _0x4b9f81;var _0x358254;return db['WhatsappQueue'][_0x2ca3('0x59')]({'where':{'id':_0x333716['params']['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x24524f,null))[_0x2ca3('0x29')](function(_0x18cce9){if(_0x18cce9){_0x4b9f81=_0x18cce9;_0x3b4f7f[_0x2ca3('0x36')]=_['keys'](db[_0x2ca3('0x5e')][_0x2ca3('0x33')]);_0x3b4f7f[_0x2ca3('0x38')]=_[_0x2ca3('0x37')](_0x333716[_0x2ca3('0x38')]);_0x3b4f7f[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x3b4f7f[_0x2ca3('0x36')],_0x3b4f7f[_0x2ca3('0x38')]);_0x46965f[_0x2ca3('0x3c')]=_[_0x2ca3('0x3a')](_0x3b4f7f[_0x2ca3('0x36')],qs[_0x2ca3('0x3b')](_0x333716[_0x2ca3('0x38')][_0x2ca3('0x3b')]));_0x46965f[_0x2ca3('0x3c')]=_0x46965f[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x46965f[_0x2ca3('0x3c')]:_0x3b4f7f[_0x2ca3('0x36')];_0x46965f['order']=qs[_0x2ca3('0x40')](_0x333716['query'][_0x2ca3('0x40')]);_0x46965f[_0x2ca3('0x41')]=qs[_0x2ca3('0x39')](_['pick'](_0x333716['query'],_0x3b4f7f['filters']));if(_0x333716['query']['filter']){_0x46965f[_0x2ca3('0x41')]=_['merge'](_0x46965f[_0x2ca3('0x41')],{'$or':_[_0x2ca3('0x31')](_0x46965f[_0x2ca3('0x3c')],function(_0x1b4226){var _0x2f83d3={};_0x2f83d3[_0x1b4226]={'$like':'%'+_0x333716[_0x2ca3('0x38')][_0x2ca3('0x43')]+'%'};return _0x2f83d3;})});}_0x46965f=_[_0x2ca3('0x44')]({},_0x46965f,_0x333716[_0x2ca3('0x4b')]);return _0x4b9f81[_0x2ca3('0x8b')](_0x46965f);}})['then'](function(_0x16a102){if(_0x16a102){_0x358254=_0x16a102[_0x2ca3('0x3d')];if(!_0x333716[_0x2ca3('0x38')][_0x2ca3('0x3e')](_0x2ca3('0x5b'))){_0x46965f[_0x2ca3('0x23')]=qs[_0x2ca3('0x23')](_0x333716['query'][_0x2ca3('0x23')]);_0x46965f[_0x2ca3('0x22')]=qs[_0x2ca3('0x22')](_0x333716['query'][_0x2ca3('0x22')]);}return _0x4b9f81[_0x2ca3('0x8b')](_0x46965f);}})[_0x2ca3('0x29')](function(_0x40bd95){if(_0x40bd95){return _0x40bd95?{'count':_0x358254,'rows':_0x40bd95}:null;}})[_0x2ca3('0x29')](respondWithResult(_0x24524f,null))[_0x2ca3('0x48')](handleError(_0x24524f,null));}; \ No newline at end of file +var _0x5a28=['./whatsappQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','send','index','map','WhatsappQueue','rawAttributes','fieldName','model','name','query','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','agent','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','findAll','Agents','online','voicePause','interface','sequelize','transaction','each','emit','userWhatsappQueue:save','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','value','removeTeams','isEmpty','removeAgents','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0xb18948,_0x44499c){var _0x3eb80e=function(_0x1c09bb){while(--_0x1c09bb){_0xb18948['push'](_0xb18948['shift']());}};_0x3eb80e(++_0x44499c);}(_0x5a28,0x184));var _0x85a2=function(_0x24d711,_0x3cdb28){_0x24d711=_0x24d711-0x0;var _0x3491b4=_0x5a28[_0x24d711];return _0x3491b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x85a2('0x0'));var rimraf=require(_0x85a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85a2('0x2'));var rp=require(_0x85a2('0x3'));var moment=require(_0x85a2('0x4'));var BPromise=require(_0x85a2('0x5'));var Mustache=require(_0x85a2('0x6'));var util=require(_0x85a2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x85a2('0x8'));var ejs=require(_0x85a2('0x9'));var fs=require('fs');var _=require(_0x85a2('0xa'));var squel=require('squel');var crypto=require(_0x85a2('0xb'));var jsforce=require(_0x85a2('0xc'));var deskjs=require(_0x85a2('0xd'));var toCsv=require(_0x85a2('0x8'));var querystring=require(_0x85a2('0xe'));var Papa=require(_0x85a2('0xf'));var Redis=require('ioredis');var authService=require(_0x85a2('0x10'));var qs=require(_0x85a2('0x11'));var as=require(_0x85a2('0x12'));var hardwareService=require(_0x85a2('0x13'));var logger=require(_0x85a2('0x14'))(_0x85a2('0x15'));var utils=require(_0x85a2('0x16'));var config=require(_0x85a2('0x17'));var licenseUtil=require(_0x85a2('0x18'));var db=require(_0x85a2('0x19'))['db'];config[_0x85a2('0x1a')]=_[_0x85a2('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85a2('0x1c'))(new Redis(config['redis']));require(_0x85a2('0x1d'))[_0x85a2('0x1e')](socket);function respondWithStatusCode(_0x5a0144,_0x231a04){_0x231a04=_0x231a04||0xcc;return function(_0x79d1a2){if(_0x79d1a2){return _0x5a0144[_0x85a2('0x1f')](_0x231a04);}return _0x5a0144[_0x85a2('0x20')](_0x231a04)[_0x85a2('0x21')]();};}function respondWithResult(_0x4ccc94,_0x1a1856){_0x1a1856=_0x1a1856||0xc8;return function(_0x26530d){if(_0x26530d){return _0x4ccc94[_0x85a2('0x20')](_0x1a1856)['json'](_0x26530d);}};}function respondWithFilteredResult(_0x4dd91b,_0x2d2716){return function(_0xab09f7){if(_0xab09f7){var _0x2640c6=_0xab09f7[_0x85a2('0x22')],_0x19df45=_0x2d2716[_0x85a2('0x23')],_0x2ad6cb=_0x2d2716[_0x85a2('0x23')]+_0x2d2716['limit'],_0x1888e0;if(_0x2ad6cb>=_0x2640c6){_0x2ad6cb=_0x2640c6;_0x1888e0=0xc8;}else{_0x1888e0=0xce;}_0x4dd91b[_0x85a2('0x20')](_0x1888e0);return _0x4dd91b[_0x85a2('0x24')](_0x85a2('0x25'),_0x19df45+'-'+_0x2ad6cb+'/'+_0x2640c6)['json'](_0xab09f7);}return null;};}function patchUpdates(_0x10bffa){return function(_0x41b75f){try{jsonpatch[_0x85a2('0x26')](_0x41b75f,_0x10bffa,!![]);}catch(_0x2d4a12){return BPromise[_0x85a2('0x27')](_0x2d4a12);}return _0x41b75f[_0x85a2('0x28')]();};}function saveUpdates(_0x18a872,_0x2b2baf){return function(_0x5c6df9){if(_0x5c6df9){return _0x5c6df9[_0x85a2('0x29')](_0x18a872)['then'](function(_0x5757e7){return _0x5757e7;});}return null;};}function removeEntity(_0x1f5300,_0x206606){return function(_0x43da56){if(_0x43da56){return _0x43da56[_0x85a2('0x2a')]()['then'](function(){var _0x32346e=_0x43da56[_0x85a2('0x2b')]({'plain':!![]});var _0x44714d='WhatsappQueues';return db[_0x85a2('0x2c')][_0x85a2('0x2a')]({'where':{'type':_0x44714d,'resourceId':_0x32346e['id']}})[_0x85a2('0x2d')](function(){return _0x43da56;});})[_0x85a2('0x2d')](function(){_0x1f5300[_0x85a2('0x20')](0xcc)[_0x85a2('0x21')]();});}};}function handleEntityNotFound(_0x5d6642,_0x2e0de9){return function(_0x3564ae){if(!_0x3564ae){_0x5d6642[_0x85a2('0x1f')](0x194);}return _0x3564ae;};}function handleError(_0x17b435,_0xfd771b){_0xfd771b=_0xfd771b||0x1f4;return function(_0x5c38a9){logger[_0x85a2('0x2e')](_0x5c38a9['stack']);if(_0x5c38a9['name']){delete _0x5c38a9['name'];}_0x17b435[_0x85a2('0x20')](_0xfd771b)[_0x85a2('0x2f')](_0x5c38a9);};}exports[_0x85a2('0x30')]=function(_0x3287e2,_0x2b4631){var _0x3f0e6c={},_0x3d36e4={},_0x45986a={'count':0x0,'rows':[]};var _0x537058=_[_0x85a2('0x31')](db[_0x85a2('0x32')][_0x85a2('0x33')],function(_0xc4bd86){return{'name':_0xc4bd86[_0x85a2('0x34')],'type':_0xc4bd86['type']['key']};});_0x3d36e4[_0x85a2('0x35')]=_[_0x85a2('0x31')](_0x537058,_0x85a2('0x36'));_0x3d36e4['query']=_['keys'](_0x3287e2[_0x85a2('0x37')]);_0x3d36e4[_0x85a2('0x38')]=_['intersection'](_0x3d36e4[_0x85a2('0x35')],_0x3d36e4[_0x85a2('0x37')]);_0x3f0e6c[_0x85a2('0x39')]=_[_0x85a2('0x3a')](_0x3d36e4[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x3b')]));_0x3f0e6c[_0x85a2('0x39')]=_0x3f0e6c[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x3f0e6c[_0x85a2('0x39')]:_0x3d36e4['model'];if(!_0x3287e2[_0x85a2('0x37')]['hasOwnProperty']('nolimit')){_0x3f0e6c[_0x85a2('0x3d')]=qs[_0x85a2('0x3d')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x3d')]);_0x3f0e6c['offset']=qs[_0x85a2('0x23')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x23')]);}_0x3f0e6c[_0x85a2('0x3e')]=qs[_0x85a2('0x3f')](_0x3287e2[_0x85a2('0x37')][_0x85a2('0x3f')]);_0x3f0e6c[_0x85a2('0x40')]=qs[_0x85a2('0x38')](_[_0x85a2('0x41')](_0x3287e2[_0x85a2('0x37')],_0x3d36e4[_0x85a2('0x38')]),_0x537058);if(_0x3287e2['query'][_0x85a2('0x42')]){_0x3f0e6c[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0x3f0e6c[_0x85a2('0x40')],{'$or':_[_0x85a2('0x31')](_0x537058,function(_0x2485c5){if(_0x2485c5[_0x85a2('0x44')]!==_0x85a2('0x45')){var _0x3f8bae={};_0x3f8bae[_0x2485c5[_0x85a2('0x36')]]={'$like':'%'+_0x3287e2[_0x85a2('0x37')][_0x85a2('0x42')]+'%'};return _0x3f8bae;}})});}_0x3f0e6c=_['merge']({},_0x3f0e6c,_0x3287e2[_0x85a2('0x46')]);var _0x57266={'where':_0x3f0e6c[_0x85a2('0x40')]};return db[_0x85a2('0x32')][_0x85a2('0x22')](_0x57266)[_0x85a2('0x2d')](function(_0x21aa30){_0x45986a[_0x85a2('0x22')]=_0x21aa30;if(_0x3287e2[_0x85a2('0x37')][_0x85a2('0x47')]){_0x3f0e6c[_0x85a2('0x48')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x3f0e6c);})[_0x85a2('0x2d')](function(_0x311851){_0x45986a[_0x85a2('0x49')]=_0x311851;return _0x45986a;})[_0x85a2('0x2d')](respondWithFilteredResult(_0x2b4631,_0x3f0e6c))[_0x85a2('0x4a')](handleError(_0x2b4631,null));};exports[_0x85a2('0x4b')]=function(_0x902fcc,_0x43bf8e){var _0x29c098={'raw':!![],'where':{'id':_0x902fcc['params']['id']}},_0xf5b22a={};_0xf5b22a[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db[_0x85a2('0x32')][_0x85a2('0x33')]);_0xf5b22a[_0x85a2('0x37')]=_[_0x85a2('0x4c')](_0x902fcc[_0x85a2('0x37')]);_0xf5b22a['filters']=_['intersection'](_0xf5b22a[_0x85a2('0x35')],_0xf5b22a[_0x85a2('0x37')]);_0x29c098['attributes']=_[_0x85a2('0x3a')](_0xf5b22a[_0x85a2('0x35')],qs['fields'](_0x902fcc[_0x85a2('0x37')]['fields']));_0x29c098[_0x85a2('0x39')]=_0x29c098[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x29c098[_0x85a2('0x39')]:_0xf5b22a[_0x85a2('0x35')];if(_0x902fcc[_0x85a2('0x37')][_0x85a2('0x47')]){_0x29c098[_0x85a2('0x48')]=[{'all':!![]}];}_0x29c098=_[_0x85a2('0x43')]({},_0x29c098,_0x902fcc['options']);return db['WhatsappQueue'][_0x85a2('0x4d')](_0x29c098)[_0x85a2('0x2d')](handleEntityNotFound(_0x43bf8e,null))[_0x85a2('0x2d')](respondWithResult(_0x43bf8e,null))[_0x85a2('0x4a')](handleError(_0x43bf8e,null));};exports[_0x85a2('0x4e')]=function(_0xb8a8d4,_0x17a3ed){return db['WhatsappQueue']['create'](_0xb8a8d4[_0x85a2('0x4f')],{})[_0x85a2('0x2d')](function(_0x5596f2){var _0x4ae12c=_0xb8a8d4[_0x85a2('0x50')][_0x85a2('0x2b')]({'plain':!![]});if(!_0x4ae12c)throw new Error(_0x85a2('0x51'));if(_0x4ae12c[_0x85a2('0x52')]===_0x85a2('0x50')){var _0x985a9=_0x5596f2[_0x85a2('0x2b')]({'plain':!![]});var _0x507e3d=_0x85a2('0x53');return db[_0x85a2('0x54')]['find']({'where':{'name':_0x507e3d,'userProfileId':_0x4ae12c[_0x85a2('0x55')]},'raw':!![]})[_0x85a2('0x2d')](function(_0x47bc28){if(_0x47bc28&&_0x47bc28[_0x85a2('0x56')]===0x0){return db[_0x85a2('0x2c')][_0x85a2('0x4e')]({'name':_0x985a9[_0x85a2('0x36')],'resourceId':_0x985a9['id'],'type':_0x47bc28['name'],'sectionId':_0x47bc28['id']},{})['then'](function(){return _0x5596f2;});}else{return _0x5596f2;}})[_0x85a2('0x4a')](function(_0x29dd5a){logger['error'](_0x85a2('0x57'),_0x29dd5a);throw _0x29dd5a;});}return _0x5596f2;})[_0x85a2('0x2d')](respondWithResult(_0x17a3ed,0xc9))[_0x85a2('0x4a')](handleError(_0x17a3ed,null));};exports[_0x85a2('0x29')]=function(_0x37132f,_0x1962d5){if(_0x37132f[_0x85a2('0x4f')]['id']){delete _0x37132f[_0x85a2('0x4f')]['id'];}return db['WhatsappQueue'][_0x85a2('0x4d')]({'where':{'id':_0x37132f['params']['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x1962d5,null))[_0x85a2('0x2d')](saveUpdates(_0x37132f[_0x85a2('0x4f')],null))[_0x85a2('0x2d')](respondWithResult(_0x1962d5,null))['catch'](handleError(_0x1962d5,null));};exports[_0x85a2('0x2a')]=function(_0xa4cbcb,_0x116f11){return db[_0x85a2('0x32')]['find']({'where':{'id':_0xa4cbcb[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x116f11,null))[_0x85a2('0x2d')](removeEntity(_0x116f11,null))[_0x85a2('0x4a')](handleError(_0x116f11,null));};exports[_0x85a2('0x59')]=function(_0x10609a,_0x92b580){return db['WhatsappQueue'][_0x85a2('0x59')]()[_0x85a2('0x2d')](respondWithResult(_0x92b580,null))[_0x85a2('0x4a')](handleError(_0x92b580,null));};exports[_0x85a2('0x5a')]=function(_0x7eaab5,_0x2bfbd5,_0x31fe7b){var _0xf917c={'raw':!![],'where':{}},_0x1871cb={},_0x5dc220;return db['WhatsappQueue'][_0x85a2('0x5b')]({'where':{'id':_0x7eaab5[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x2bfbd5,null))['then'](function(_0x1d634e){if(_0x1d634e){_0x5dc220=_0x1d634e['get']({'plain':!![]});_0x1871cb[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db[_0x85a2('0x5c')][_0x85a2('0x33')]);_0x1871cb[_0x85a2('0x37')]=_[_0x85a2('0x4c')](_0x7eaab5['query']);_0x1871cb[_0x85a2('0x38')]=_[_0x85a2('0x3a')](_0x1871cb[_0x85a2('0x35')],_0x1871cb[_0x85a2('0x37')]);_0xf917c[_0x85a2('0x39')]=_[_0x85a2('0x3a')](_0x1871cb[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x7eaab5[_0x85a2('0x37')]['fields']));_0xf917c[_0x85a2('0x39')]=_0xf917c['attributes'][_0x85a2('0x3c')]?_0xf917c['attributes']:_0x1871cb[_0x85a2('0x35')];if(!_0x7eaab5[_0x85a2('0x37')][_0x85a2('0x5d')]('nolimit')){_0xf917c[_0x85a2('0x3d')]=qs['limit'](_0x7eaab5[_0x85a2('0x37')][_0x85a2('0x3d')]);_0xf917c[_0x85a2('0x23')]=qs[_0x85a2('0x23')](_0x7eaab5[_0x85a2('0x37')]['offset']);}_0xf917c[_0x85a2('0x3e')]=qs[_0x85a2('0x3f')](_0x7eaab5['query'][_0x85a2('0x3f')]);_0xf917c[_0x85a2('0x40')]=qs[_0x85a2('0x38')](_[_0x85a2('0x41')](_0x7eaab5[_0x85a2('0x37')],_0x1871cb[_0x85a2('0x38')]));_0xf917c[_0x85a2('0x40')][_0x85a2('0x5e')]=_0x1d634e['id'];if(_0x7eaab5[_0x85a2('0x37')][_0x85a2('0x42')]){_0xf917c[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0xf917c[_0x85a2('0x40')],{'$or':_['map'](_0xf917c['attributes'],function(_0x26ed1a){var _0x48da5c={};_0x48da5c[_0x26ed1a]={'$like':'%'+_0x7eaab5[_0x85a2('0x37')]['filter']+'%'};return _0x48da5c;})});}_0xf917c=_['merge']({},_0xf917c,_0x7eaab5['options']);return db['UserWhatsappQueue']['findAll'](_0xf917c);}})[_0x85a2('0x2d')](function(_0x21ca17){if(_0x21ca17){return db[_0x85a2('0x5f')]['findAndCountAll']({'where':{'id':_[_0x85a2('0x31')](_0x21ca17,'UserId'),'role':_0x85a2('0x60')},'attributes':['id',_0x85a2('0x36'),'whatsappPause',_0x85a2('0x61'),_0x85a2('0x62')]});}})['then'](function(_0x5d221d){if(_0x5d221d){return{'count':_0x5d221d[_0x85a2('0x22')],'rows':_['map'](_0x5d221d[_0x85a2('0x49')],function(_0x15d3c3){return{'membername':_0x15d3c3['name'],'UserId':_0x15d3c3['id'],'queue_name':_0x5dc220['name'],'WhatsappQueueId':_0x5dc220['id'],'interface':util['format'](_0x85a2('0x63'),_0x85a2('0x64'),_0x15d3c3[_0x85a2('0x36')]),'penalty':0x0,'paused':_0x15d3c3['whatsappPause'],'createdAt':_0x15d3c3[_0x85a2('0x62')],'updatedAt':_0x15d3c3[_0x85a2('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2bfbd5,_0xf917c))[_0x85a2('0x4a')](handleError(_0x2bfbd5,null));};exports[_0x85a2('0x65')]=function(_0x355661,_0x31a7f6,_0x376cad){var _0x53346c={};var _0x25d43f={};var _0x38ff2c;var _0x2e66e6;return db['WhatsappQueue'][_0x85a2('0x5b')]({'where':{'id':_0x355661['params']['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x31a7f6,null))[_0x85a2('0x2d')](function(_0x40015d){if(_0x40015d){_0x38ff2c=_0x40015d;_0x25d43f[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db['Team']['rawAttributes']);_0x25d43f['query']=_['keys'](_0x355661[_0x85a2('0x37')]);_0x25d43f[_0x85a2('0x38')]=_[_0x85a2('0x3a')](_0x25d43f[_0x85a2('0x35')],_0x25d43f[_0x85a2('0x37')]);_0x53346c['attributes']=_['intersection'](_0x25d43f[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x355661['query'][_0x85a2('0x3b')]));_0x53346c[_0x85a2('0x39')]=_0x53346c[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x53346c['attributes']:_0x25d43f[_0x85a2('0x35')];_0x53346c[_0x85a2('0x3e')]=qs['sort'](_0x355661[_0x85a2('0x37')]['sort']);_0x53346c['where']=qs[_0x85a2('0x38')](_['pick'](_0x355661[_0x85a2('0x37')],_0x25d43f[_0x85a2('0x38')]));if(_0x355661[_0x85a2('0x37')][_0x85a2('0x42')]){_0x53346c[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0x53346c['where'],{'$or':_[_0x85a2('0x31')](_0x53346c['attributes'],function(_0x7c3781){var _0x146112={};_0x146112[_0x7c3781]={'$like':'%'+_0x355661['query'][_0x85a2('0x42')]+'%'};return _0x146112;})});}_0x53346c=_[_0x85a2('0x43')]({},_0x53346c,_0x355661['options']);return _0x38ff2c['getTeams'](_0x53346c);}})[_0x85a2('0x2d')](function(_0x59bff7){if(_0x59bff7){_0x2e66e6=_0x59bff7[_0x85a2('0x3c')];if(!_0x355661[_0x85a2('0x37')][_0x85a2('0x5d')]('nolimit')){_0x53346c['limit']=qs['limit'](_0x355661[_0x85a2('0x37')][_0x85a2('0x3d')]);_0x53346c[_0x85a2('0x23')]=qs[_0x85a2('0x23')](_0x355661['query'][_0x85a2('0x23')]);}return _0x38ff2c[_0x85a2('0x65')](_0x53346c);}})['then'](function(_0x50a3ce){if(_0x50a3ce){return _0x50a3ce?{'count':_0x2e66e6,'rows':_0x50a3ce}:null;}})[_0x85a2('0x2d')](respondWithResult(_0x31a7f6,null))[_0x85a2('0x4a')](handleError(_0x31a7f6,null));};exports[_0x85a2('0x66')]=function(_0x26803b,_0x508b18,_0x38a7d2){var _0x12a5fb=_0x26803b['body'][_0x85a2('0x67')];return db[_0x85a2('0x68')][_0x85a2('0x69')]({'where':{'id':_0x12a5fb},'attributes':['id'],'include':[{'model':db[_0x85a2('0x5f')],'as':_0x85a2('0x6a'),'attributes':['id',_0x85a2('0x36'),_0x85a2('0x6b'),_0x85a2('0x6c'),_0x85a2('0x6d')],'raw':!![]}]})['then'](function(_0x1bde20){if(_0x1bde20){var _0x3b89e2=_['flatMap'](_0x1bde20,function(_0x486b9a){var _0x41d329=_0x486b9a[_0x85a2('0x2b')]({'plain':!![]});return _0x41d329['Agents'];});return db[_0x85a2('0x32')][_0x85a2('0x4d')]({'where':{'id':_0x26803b[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](function(_0x38c146){return db[_0x85a2('0x6e')][_0x85a2('0x6f')](function(_0x395ed7){return _0x38c146[_0x85a2('0x66')](_0x12a5fb,{'transaction':_0x395ed7})[_0x85a2('0x2d')](function(){return BPromise[_0x85a2('0x70')](_0x3b89e2,function(_0x1b8d3d){return db[_0x85a2('0x5c')]['findOrCreate']({'where':{'UserId':_0x1b8d3d['id'],'WhatsappQueueId':_0x26803b[_0x85a2('0x58')]['id']},'transaction':_0x395ed7});});})[_0x85a2('0x2d')](function(){_0x3b89e2['forEach'](function(_0x5de65b){socket[_0x85a2('0x71')](_0x85a2('0x72'),{'UserId':_0x5de65b['id'],'WhatsappQueueId':_0x38c146['id']});});});});});}})[_0x85a2('0x2d')](respondWithStatusCode(_0x508b18,null))[_0x85a2('0x4a')](handleError(_0x508b18,null));};exports['removeTeams']=function(_0x386f4e,_0x453d96,_0x261dee){return db[_0x85a2('0x68')]['findAll']({'where':{'id':_0x386f4e[_0x85a2('0x37')][_0x85a2('0x67')]},'attributes':['id'],'include':[{'model':db[_0x85a2('0x5f')],'as':_0x85a2('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x453d96,null))['then'](function(_0x2e04ca){var _0x2c497a=_[_0x85a2('0x31')](_0x2e04ca,'id');var _0x500def=[];var _0x562223=[];var _0x385e73=squel['select']();_0x385e73['field'](_0x85a2('0x73'))[_0x85a2('0x74')](_0x85a2('0x75'),'tq')['join'](_0x85a2('0x76'),'ut',_0x85a2('0x77'))[_0x85a2('0x40')](_0x85a2('0x78'),_0x386f4e[_0x85a2('0x58')]['id']);for(var _0x4db411=0x0;_0x4db411<_0x2e04ca[_0x85a2('0x3c')];_0x4db411+=0x1){let _0x32dcb0=_0x2e04ca[_0x4db411];for(var _0x45efe3=0x0;_0x45efe3<_0x32dcb0[_0x85a2('0x6a')][_0x85a2('0x3c')];_0x45efe3+=0x1){let _0x5ed006=_0x32dcb0[_0x85a2('0x6a')][_0x45efe3];var _0x4c72f0=_0x385e73[_0x85a2('0x79')]();_0x4c72f0[_0x85a2('0x40')](_0x85a2('0x7a'),_0x5ed006['id']);_0x562223[_0x85a2('0x7b')](db[_0x85a2('0x6e')][_0x85a2('0x37')](_0x4c72f0['toString'](),{'type':db[_0x85a2('0x6e')][_0x85a2('0x7c')]['SELECT']})[_0x85a2('0x2d')](function(_0x1c623f){if(_0x1c623f['length']===0x1){return _0x5ed006['id'];}else{var _0x225698=_[_0x85a2('0x7d')](_[_0x85a2('0x31')](_0x1c623f,_0x85a2('0x7e')),function(_0x2b8655){return _[_0x85a2('0x7f')](_0x2c497a,_0x2b8655);});if(_0x225698){return _0x5ed006['id'];}}}));}}return BPromise[_0x85a2('0x80')](_0x562223)['then'](function(_0x490cc2){_0x500def=_(_0x500def)['union'](_0x490cc2)['compact']()[_0x85a2('0x81')]();return db[_0x85a2('0x32')][_0x85a2('0x4d')]({'where':{'id':_0x386f4e[_0x85a2('0x58')]['id']}})['then'](function(_0x4a304d){return db['sequelize']['transaction'](function(_0x350f16){return _0x4a304d[_0x85a2('0x82')](_0x386f4e[_0x85a2('0x37')]['ids'],{'transaction':_0x350f16})[_0x85a2('0x2d')](function(){if(!_[_0x85a2('0x83')](_0x500def)){return _0x4a304d[_0x85a2('0x84')](_0x500def,{'transaction':_0x350f16});}})[_0x85a2('0x2d')](function(){_0x500def['forEach'](function(_0x1c4795){socket[_0x85a2('0x71')]('userWhatsappQueue:remove',{'UserId':_0x1c4795,'WhatsappQueueId':_0x4a304d['id']});});});});});});})['then'](respondWithStatusCode(_0x453d96,null))[_0x85a2('0x4a')](handleError(_0x453d96,null));};exports[_0x85a2('0x85')]=function(_0x17e8bd,_0x13a2be,_0x2ed1a1){return db['WhatsappQueue'][_0x85a2('0x4d')]({'where':{'id':_0x17e8bd[_0x85a2('0x58')]['id']}})['then'](handleEntityNotFound(_0x13a2be,null))[_0x85a2('0x2d')](function(_0x3b71d1){if(_0x3b71d1){return _0x3b71d1[_0x85a2('0x85')](_0x17e8bd[_0x85a2('0x4f')][_0x85a2('0x67')],_['omit'](_0x17e8bd[_0x85a2('0x4f')],[_0x85a2('0x67'),'id'])||{})[_0x85a2('0x86')](function(_0x19ac87){for(var _0x1670d8=0x0;_0x1670d8<_0x17e8bd['body'][_0x85a2('0x67')][_0x85a2('0x3c')];_0x1670d8+=0x1){socket[_0x85a2('0x71')]('userWhatsappQueue:save',{'UserId':_0x17e8bd['body'][_0x85a2('0x67')][_0x1670d8],'WhatsappQueueId':_0x17e8bd[_0x85a2('0x58')]['id']});}return _0x19ac87;});}})[_0x85a2('0x2d')](respondWithResult(_0x13a2be,null))[_0x85a2('0x4a')](handleError(_0x13a2be,null));};exports[_0x85a2('0x84')]=function(_0xb6b4d8,_0x1c2356,_0x283aeb){return db['WhatsappQueue'][_0x85a2('0x4d')]({'where':{'id':_0xb6b4d8['params']['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0x1c2356,null))[_0x85a2('0x2d')](function(_0x3cfa9f){if(_0x3cfa9f){return _0x3cfa9f[_0x85a2('0x84')](_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')])[_0x85a2('0x2d')](function(){if(_[_0x85a2('0x87')](_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')])){for(var _0x1b4862=0x0;_0x1b4862<_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')][_0x85a2('0x3c')];_0x1b4862+=0x1){socket[_0x85a2('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0xb6b4d8['query'][_0x85a2('0x67')][_0x1b4862]),'WhatsappQueueId':Number(_0xb6b4d8['params']['id'])});}}else{socket[_0x85a2('0x71')](_0x85a2('0x88'),{'UserId':Number(_0xb6b4d8[_0x85a2('0x37')][_0x85a2('0x67')]),'WhatsappQueueId':Number(_0xb6b4d8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1c2356,null))['catch'](handleError(_0x1c2356,null));};exports[_0x85a2('0x89')]=function(_0x16c59a,_0xb43c1a,_0x2c1440){var _0x4eba39={};var _0x18232f={};var _0xbac13e;var _0x3df49e;return db[_0x85a2('0x32')][_0x85a2('0x5b')]({'where':{'id':_0x16c59a[_0x85a2('0x58')]['id']}})[_0x85a2('0x2d')](handleEntityNotFound(_0xb43c1a,null))[_0x85a2('0x2d')](function(_0x3a9c24){if(_0x3a9c24){_0xbac13e=_0x3a9c24;_0x18232f[_0x85a2('0x35')]=_[_0x85a2('0x4c')](db['User'][_0x85a2('0x33')]);_0x18232f[_0x85a2('0x37')]=_[_0x85a2('0x4c')](_0x16c59a['query']);_0x18232f[_0x85a2('0x38')]=_[_0x85a2('0x3a')](_0x18232f[_0x85a2('0x35')],_0x18232f[_0x85a2('0x37')]);_0x4eba39[_0x85a2('0x39')]=_[_0x85a2('0x3a')](_0x18232f[_0x85a2('0x35')],qs[_0x85a2('0x3b')](_0x16c59a['query'][_0x85a2('0x3b')]));_0x4eba39['attributes']=_0x4eba39[_0x85a2('0x39')][_0x85a2('0x3c')]?_0x4eba39[_0x85a2('0x39')]:_0x18232f[_0x85a2('0x35')];_0x4eba39['order']=qs[_0x85a2('0x3f')](_0x16c59a['query'][_0x85a2('0x3f')]);_0x4eba39['where']=qs[_0x85a2('0x38')](_['pick'](_0x16c59a[_0x85a2('0x37')],_0x18232f[_0x85a2('0x38')]));if(_0x16c59a[_0x85a2('0x37')][_0x85a2('0x42')]){_0x4eba39[_0x85a2('0x40')]=_[_0x85a2('0x43')](_0x4eba39['where'],{'$or':_['map'](_0x4eba39[_0x85a2('0x39')],function(_0x3a77c7){var _0x1d933a={};_0x1d933a[_0x3a77c7]={'$like':'%'+_0x16c59a[_0x85a2('0x37')][_0x85a2('0x42')]+'%'};return _0x1d933a;})});}_0x4eba39=_[_0x85a2('0x43')]({},_0x4eba39,_0x16c59a[_0x85a2('0x46')]);return _0xbac13e[_0x85a2('0x89')](_0x4eba39);}})['then'](function(_0x5eebba){if(_0x5eebba){_0x3df49e=_0x5eebba[_0x85a2('0x3c')];if(!_0x16c59a[_0x85a2('0x37')][_0x85a2('0x5d')](_0x85a2('0x8a'))){_0x4eba39['limit']=qs[_0x85a2('0x3d')](_0x16c59a['query'][_0x85a2('0x3d')]);_0x4eba39[_0x85a2('0x23')]=qs[_0x85a2('0x23')](_0x16c59a[_0x85a2('0x37')][_0x85a2('0x23')]);}return _0xbac13e[_0x85a2('0x89')](_0x4eba39);}})[_0x85a2('0x2d')](function(_0x4d194b){if(_0x4d194b){return _0x4d194b?{'count':_0x3df49e,'rows':_0x4d194b}:null;}})[_0x85a2('0x2d')](respondWithResult(_0xb43c1a,null))[_0x85a2('0x4a')](handleError(_0xb43c1a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index a217875..85a9578 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 _0x1633=['emit','hook','exports','events','../../mysqldb','WhatsappQueue','save','update'];(function(_0x292911,_0x279a2e){var _0x18dee9=function(_0x43ccf8){while(--_0x43ccf8){_0x292911['push'](_0x292911['shift']());}};_0x18dee9(++_0x279a2e);}(_0x1633,0x133));var _0x3163=function(_0x460f60,_0x2371c8){_0x460f60=_0x460f60-0x0;var _0x4db853=_0x1633[_0x460f60];return _0x4db853;};'use strict';var EventEmitter=require(_0x3163('0x0'));var WhatsappQueue=require(_0x3163('0x1'))['db'][_0x3163('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3163('0x3'),'afterUpdate':_0x3163('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21ade6){return function(_0x4dcbcc,_0x2f7395,_0x51b812){WhatsappQueueEvents[_0x3163('0x5')](_0x21ade6+':'+_0x4dcbcc['id'],_0x4dcbcc);WhatsappQueueEvents[_0x3163('0x5')](_0x21ade6,_0x4dcbcc);_0x51b812(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x3163('0x6')](e,emitEvent(event));}}module[_0x3163('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa610=['hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x35000d,_0xc8945c){var _0x2b856f=function(_0x3d8eb2){while(--_0x3d8eb2){_0x35000d['push'](_0x35000d['shift']());}};_0x2b856f(++_0xc8945c);}(_0xa610,0x1b2));var _0x0a61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa610[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0a61('0x0'));var WhatsappQueue=require(_0x0a61('0x1'))['db'][_0x0a61('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x0a61('0x3')](0x0);var events={'afterCreate':_0x0a61('0x4'),'afterUpdate':'update','afterDestroy':_0x0a61('0x5')};function emitEvent(_0x34a816){return function(_0x13a09f,_0x54e640,_0x2fce0b){WhatsappQueueEvents[_0x0a61('0x6')](_0x34a816+':'+_0x13a09f['id'],_0x13a09f);WhatsappQueueEvents['emit'](_0x34a816,_0x13a09f);_0x2fce0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x0a61('0x7')](e,emitEvent(event));}}module[_0x0a61('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 08e50f3..a043122 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 _0xbff4=['bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','../../config/logger','moment'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xbff4,0x97));var _0x4bff=function(_0x479722,_0x231cef){_0x479722=_0x479722-0x0;var _0x2310fe=_0xbff4[_0x479722];return _0x2310fe;};'use strict';var _=require(_0x4bff('0x0'));var util=require('util');var logger=require(_0x4bff('0x1'))('api');var moment=require(_0x4bff('0x2'));var BPromise=require(_0x4bff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bff('0x4'));var rimraf=require(_0x4bff('0x5'));var config=require(_0x4bff('0x6'));var attributes=require(_0x4bff('0x7'));module[_0x4bff('0x8')]=function(_0x28a86b,_0x1bbb62){return _0x28a86b[_0x4bff('0x9')]('WhatsappQueue',attributes,{'tableName':_0x4bff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbc5=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','request-promise','path','../../config/environment','exports'];(function(_0x55db20,_0x4bee7b){var _0x41b374=function(_0x59c3be){while(--_0x59c3be){_0x55db20['push'](_0x55db20['shift']());}};_0x41b374(++_0x4bee7b);}(_0xcbc5,0x8f));var _0x5cbc=function(_0x501336,_0x3dfa0e){_0x501336=_0x501336-0x0;var _0x1767c0=_0xcbc5[_0x501336];return _0x1767c0;};'use strict';var _=require(_0x5cbc('0x0'));var util=require(_0x5cbc('0x1'));var logger=require(_0x5cbc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cbc('0x3'));var fs=require('fs');var path=require(_0x5cbc('0x4'));var rimraf=require('rimraf');var config=require(_0x5cbc('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0x5cbc('0x6')]=function(_0x24a8cf,_0x2f7bf3){return _0x24a8cf[_0x5cbc('0x7')](_0x5cbc('0x8'),attributes,{'tableName':_0x5cbc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 3128928..7a69579 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 _0xa4b8=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4b8,0x1e9));var _0x8a4b=function(_0x34a9fe,_0x5cf50b){_0x34a9fe=_0x34a9fe-0x0;var _0x443985=_0xa4b8[_0x34a9fe];return _0x443985;};'use strict';var _=require(_0x8a4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a4b('0x1'));var rs=require(_0x8a4b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a4b('0x3'))['db'];var utils=require(_0x8a4b('0x4'));var logger=require('../../config/logger')(_0x8a4b('0x5'));var config=require(_0x8a4b('0x6'));var jayson=require(_0x8a4b('0x7'));var client=jayson[_0x8a4b('0x8')][_0x8a4b('0x9')]({'port':0x232a});config[_0x8a4b('0xa')]=_[_0x8a4b('0xb')](config[_0x8a4b('0xa')],{'host':_0x8a4b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a4b('0xa')]));require('./whatsappQueue.socket')[_0x8a4b('0xd')](socket);function respondWithRpcPromise(_0xaaefb8,_0x47b161,_0x3a8b84){return new BPromise(function(_0x27b718,_0x1d87f3){return client[_0x8a4b('0xe')](_0xaaefb8,_0x3a8b84)[_0x8a4b('0xf')](function(_0x1c8ffa){logger[_0x8a4b('0x10')](_0x8a4b('0x11'),_0x47b161,'request\x20sent');logger[_0x8a4b('0x12')](_0x8a4b('0x13'),_0x47b161,_0x8a4b('0x14'),JSON[_0x8a4b('0x15')](_0x1c8ffa));if(_0x1c8ffa[_0x8a4b('0x16')]){if(_0x1c8ffa[_0x8a4b('0x16')]['code']===0x1f4){logger['error'](_0x8a4b('0x11'),_0x47b161,_0x1c8ffa[_0x8a4b('0x16')][_0x8a4b('0x17')]);return _0x1d87f3(_0x1c8ffa[_0x8a4b('0x16')]['message']);}logger['error'](_0x8a4b('0x11'),_0x47b161,_0x1c8ffa[_0x8a4b('0x16')][_0x8a4b('0x17')]);return _0x27b718(_0x1c8ffa[_0x8a4b('0x16')]['message']);}else{logger['info'](_0x8a4b('0x11'),_0x47b161,'request\x20sent');_0x27b718(_0x1c8ffa['result']['message']);}})[_0x8a4b('0x18')](function(_0x59883a){logger[_0x8a4b('0x16')](_0x8a4b('0x11'),_0x47b161,_0x59883a);_0x1d87f3(_0x59883a);});});}exports['GetWhatsappQueue']=function(_0x4f9b4c){var _0x57e479=this;return new Promise(function(_0x293a74,_0x12a2a1){return db[_0x8a4b('0x19')][_0x8a4b('0x1a')]({'raw':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c['options'][_0x8a4b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x1d')]||null:null,'attributes':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x1e')]||null:null,'limit':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x1f')]||null:null,'include':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x20')]?_['map'](_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x20')],function(_0x429cc2){return{'model':db[_0x429cc2[_0x8a4b('0x21')]],'as':_0x429cc2['as'],'attributes':_0x429cc2[_0x8a4b('0x1e')],'include':_0x429cc2[_0x8a4b('0x20')]?_[_0x8a4b('0x22')](_0x429cc2[_0x8a4b('0x20')],function(_0x36b41e){return{'model':db[_0x36b41e[_0x8a4b('0x21')]],'as':_0x36b41e['as'],'attributes':_0x36b41e[_0x8a4b('0x1e')],'include':_0x36b41e[_0x8a4b('0x20')]?_[_0x8a4b('0x22')](_0x36b41e[_0x8a4b('0x20')],function(_0x196f19){return{'model':db[_0x196f19[_0x8a4b('0x21')]],'as':_0x196f19['as'],'attributes':_0x196f19['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a4b('0xf')](function(_0x40dacf){logger['info'](_0x8a4b('0x23'),_0x4f9b4c);logger[_0x8a4b('0x12')](_0x8a4b('0x23'),_0x4f9b4c,JSON['stringify'](_0x40dacf));_0x293a74(_0x40dacf);})[_0x8a4b('0x18')](function(_0xfe3521){logger['error'](_0x8a4b('0x23'),_0xfe3521[_0x8a4b('0x17')],_0x4f9b4c);_0x12a2a1(_0x57e479['error'](0x1f4,_0xfe3521[_0x8a4b('0x17')]));});});};exports[_0x8a4b('0x24')]=function(_0x581bfa){var _0xee78bb=this;return new Promise(function(_0x35b6db,_0x62c758){return db[_0x8a4b('0x19')][_0x8a4b('0x25')]({'raw':_0x581bfa['options']?_0x581bfa[_0x8a4b('0x1b')][_0x8a4b('0x1c')]===undefined?!![]:![]:!![],'where':_0x581bfa[_0x8a4b('0x1b')]?_0x581bfa['options'][_0x8a4b('0x1d')]||null:null,'attributes':_0x581bfa['options']?_0x581bfa[_0x8a4b('0x1b')]['attributes']||null:null,'include':_0x581bfa[_0x8a4b('0x1b')]?_0x581bfa[_0x8a4b('0x1b')][_0x8a4b('0x20')]?_['map'](_0x581bfa[_0x8a4b('0x1b')][_0x8a4b('0x20')],function(_0x5e3fc4){return{'model':db[_0x5e3fc4[_0x8a4b('0x21')]],'as':_0x5e3fc4['as'],'attributes':_0x5e3fc4[_0x8a4b('0x1e')],'include':_0x5e3fc4[_0x8a4b('0x20')]?_[_0x8a4b('0x22')](_0x5e3fc4['include'],function(_0x3a728a){return{'model':db[_0x3a728a[_0x8a4b('0x21')]],'as':_0x3a728a['as'],'attributes':_0x3a728a[_0x8a4b('0x1e')],'include':_0x3a728a[_0x8a4b('0x20')]?_['map'](_0x3a728a['include'],function(_0x30f51f){return{'model':db[_0x30f51f[_0x8a4b('0x21')]],'as':_0x30f51f['as'],'attributes':_0x30f51f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a4b('0xf')](function(_0x4b54c6){logger[_0x8a4b('0x10')](_0x8a4b('0x24'),_0x581bfa);logger[_0x8a4b('0x12')]('ShowWhatsappQueue',_0x581bfa,JSON[_0x8a4b('0x15')](_0x4b54c6));_0x35b6db(_0x4b54c6);})[_0x8a4b('0x18')](function(_0x135317){logger[_0x8a4b('0x16')](_0x8a4b('0x24'),_0x135317[_0x8a4b('0x17')],_0x581bfa);_0x62c758(_0xee78bb['error'](0x1f4,_0x135317[_0x8a4b('0x17')]));});});}; \ No newline at end of file +var _0x151f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find','lodash'];(function(_0x3af12a,_0x4b60cd){var _0x53013a=function(_0x10b77c){while(--_0x10b77c){_0x3af12a['push'](_0x3af12a['shift']());}};_0x53013a(++_0x4b60cd);}(_0x151f,0xe0));var _0xf151=function(_0x446beb,_0x983a02){_0x446beb=_0x446beb-0x0;var _0x4f8260=_0x151f[_0x446beb];return _0x4f8260;};'use strict';var _=require(_0xf151('0x0'));var util=require(_0xf151('0x1'));var moment=require(_0xf151('0x2'));var BPromise=require(_0xf151('0x3'));var rs=require(_0xf151('0x4'));var fs=require('fs');var Redis=require(_0xf151('0x5'));var db=require(_0xf151('0x6'))['db'];var utils=require(_0xf151('0x7'));var logger=require(_0xf151('0x8'))(_0xf151('0x9'));var config=require(_0xf151('0xa'));var jayson=require(_0xf151('0xb'));var client=jayson[_0xf151('0xc')][_0xf151('0xd')]({'port':0x232a});config['redis']=_[_0xf151('0xe')](config[_0xf151('0xf')],{'host':_0xf151('0x10'),'port':0x18eb});var socket=require(_0xf151('0x11'))(new Redis(config[_0xf151('0xf')]));require(_0xf151('0x12'))[_0xf151('0x13')](socket);function respondWithRpcPromise(_0x23f979,_0x1e74df,_0x1ad9ac){return new BPromise(function(_0x446083,_0x4258ac){return client[_0xf151('0x14')](_0x23f979,_0x1ad9ac)[_0xf151('0x15')](function(_0x10ba9c){logger['info'](_0xf151('0x16'),_0x1e74df,_0xf151('0x17'));logger[_0xf151('0x18')](_0xf151('0x19'),_0x1e74df,_0xf151('0x17'),JSON[_0xf151('0x1a')](_0x10ba9c));if(_0x10ba9c[_0xf151('0x1b')]){if(_0x10ba9c[_0xf151('0x1b')][_0xf151('0x1c')]===0x1f4){logger[_0xf151('0x1b')]('WhatsappQueue,\x20%s,\x20%s',_0x1e74df,_0x10ba9c['error'][_0xf151('0x1d')]);return _0x4258ac(_0x10ba9c['error']['message']);}logger[_0xf151('0x1b')](_0xf151('0x16'),_0x1e74df,_0x10ba9c[_0xf151('0x1b')][_0xf151('0x1d')]);return _0x446083(_0x10ba9c[_0xf151('0x1b')][_0xf151('0x1d')]);}else{logger[_0xf151('0x1e')]('WhatsappQueue,\x20%s,\x20%s',_0x1e74df,_0xf151('0x17'));_0x446083(_0x10ba9c[_0xf151('0x1f')][_0xf151('0x1d')]);}})[_0xf151('0x20')](function(_0x5b4ff4){logger[_0xf151('0x1b')](_0xf151('0x16'),_0x1e74df,_0x5b4ff4);_0x4258ac(_0x5b4ff4);});});}exports['GetWhatsappQueue']=function(_0x44466f){var _0x3900a7=this;return new Promise(function(_0x4f5861,_0x14518d){return db[_0xf151('0x21')][_0xf151('0x22')]({'raw':_0x44466f['options']?_0x44466f[_0xf151('0x23')][_0xf151('0x24')]===undefined?!![]:![]:!![],'where':_0x44466f[_0xf151('0x23')]?_0x44466f[_0xf151('0x23')]['where']||null:null,'attributes':_0x44466f['options']?_0x44466f[_0xf151('0x23')][_0xf151('0x25')]||null:null,'limit':_0x44466f[_0xf151('0x23')]?_0x44466f['options'][_0xf151('0x26')]||null:null,'include':_0x44466f[_0xf151('0x23')]?_0x44466f[_0xf151('0x23')][_0xf151('0x27')]?_['map'](_0x44466f['options'][_0xf151('0x27')],function(_0xb3664e){return{'model':db[_0xb3664e[_0xf151('0x28')]],'as':_0xb3664e['as'],'attributes':_0xb3664e['attributes'],'include':_0xb3664e[_0xf151('0x27')]?_[_0xf151('0x29')](_0xb3664e['include'],function(_0x1d8bda){return{'model':db[_0x1d8bda['model']],'as':_0x1d8bda['as'],'attributes':_0x1d8bda[_0xf151('0x25')],'include':_0x1d8bda[_0xf151('0x27')]?_['map'](_0x1d8bda[_0xf151('0x27')],function(_0x4a3337){return{'model':db[_0x4a3337['model']],'as':_0x4a3337['as'],'attributes':_0x4a3337[_0xf151('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24b980){logger[_0xf151('0x1e')](_0xf151('0x2a'),_0x44466f);logger[_0xf151('0x18')](_0xf151('0x2a'),_0x44466f,JSON[_0xf151('0x1a')](_0x24b980));_0x4f5861(_0x24b980);})['catch'](function(_0xb3b9d9){logger['error'](_0xf151('0x2a'),_0xb3b9d9[_0xf151('0x1d')],_0x44466f);_0x14518d(_0x3900a7['error'](0x1f4,_0xb3b9d9['message']));});});};exports[_0xf151('0x2b')]=function(_0x2daa74){var _0x428484=this;return new Promise(function(_0x10d342,_0x38ca93){return db[_0xf151('0x21')][_0xf151('0x2c')]({'raw':_0x2daa74['options']?_0x2daa74[_0xf151('0x23')][_0xf151('0x24')]===undefined?!![]:![]:!![],'where':_0x2daa74[_0xf151('0x23')]?_0x2daa74[_0xf151('0x23')]['where']||null:null,'attributes':_0x2daa74['options']?_0x2daa74[_0xf151('0x23')]['attributes']||null:null,'include':_0x2daa74[_0xf151('0x23')]?_0x2daa74[_0xf151('0x23')][_0xf151('0x27')]?_[_0xf151('0x29')](_0x2daa74[_0xf151('0x23')][_0xf151('0x27')],function(_0x5cd1e5){return{'model':db[_0x5cd1e5[_0xf151('0x28')]],'as':_0x5cd1e5['as'],'attributes':_0x5cd1e5[_0xf151('0x25')],'include':_0x5cd1e5[_0xf151('0x27')]?_[_0xf151('0x29')](_0x5cd1e5[_0xf151('0x27')],function(_0x2bedf7){return{'model':db[_0x2bedf7[_0xf151('0x28')]],'as':_0x2bedf7['as'],'attributes':_0x2bedf7[_0xf151('0x25')],'include':_0x2bedf7[_0xf151('0x27')]?_['map'](_0x2bedf7['include'],function(_0xddcb37){return{'model':db[_0xddcb37[_0xf151('0x28')]],'as':_0xddcb37['as'],'attributes':_0xddcb37['attributes']};}):[]};}):[]};}):[]:[]})[_0xf151('0x15')](function(_0x227019){logger[_0xf151('0x1e')]('ShowWhatsappQueue',_0x2daa74);logger['debug'](_0xf151('0x2b'),_0x2daa74,JSON[_0xf151('0x1a')](_0x227019));_0x10d342(_0x227019);})[_0xf151('0x20')](function(_0x3f694c){logger[_0xf151('0x1b')](_0xf151('0x2b'),_0x3f694c[_0xf151('0x1d')],_0x2daa74);_0x38ca93(_0x428484['error'](0x1f4,_0x3f694c[_0xf151('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 59d1606..9bc94ae 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 _0xa5b6=['update','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x38a4f3,_0x7a12b7){var _0x303ce3=function(_0x3398c1){while(--_0x3398c1){_0x38a4f3['push'](_0x38a4f3['shift']());}};_0x303ce3(++_0x7a12b7);}(_0xa5b6,0xf4));var _0x6a5b=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0xa5b6[_0x467488];return _0x56107f;};'use strict';var WhatsappQueueEvents=require(_0x6a5b('0x0'));var events=[_0x6a5b('0x1'),'remove',_0x6a5b('0x2')];function createListener(_0x575997,_0x1b8213){return function(_0xb95b55){_0x1b8213['emit'](_0x575997,_0xb95b55);};}function removeListener(_0x174edc,_0x14a152){return function(){WhatsappQueueEvents['removeListener'](_0x174edc,_0x14a152);};}exports[_0x6a5b('0x3')]=function(_0x3787df){for(var _0x4cf95f=0x0,_0x1a7357=events[_0x6a5b('0x4')];_0x4cf95f<_0x1a7357;_0x4cf95f++){var _0x3d85e1=events[_0x4cf95f];var _0x1376fb=createListener(_0x6a5b('0x5')+_0x3d85e1,_0x3787df);WhatsappQueueEvents['on'](_0x3d85e1,_0x1376fb);}}; \ No newline at end of file +var _0xd219=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x103fbc,_0xebf843){var _0x5c9228=function(_0x308c0d){while(--_0x308c0d){_0x103fbc['push'](_0x103fbc['shift']());}};_0x5c9228(++_0xebf843);}(_0xd219,0x13e));var _0x9d21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd219[_0x14add3];return _0x4a174f;};'use strict';var WhatsappQueueEvents=require(_0x9d21('0x0'));var events=[_0x9d21('0x1'),_0x9d21('0x2'),_0x9d21('0x3')];function createListener(_0x3cc760,_0x792c13){return function(_0x309bdc){_0x792c13[_0x9d21('0x4')](_0x3cc760,_0x309bdc);};}function removeListener(_0xcd4745,_0x53f77d){return function(){WhatsappQueueEvents[_0x9d21('0x5')](_0xcd4745,_0x53f77d);};}exports[_0x9d21('0x6')]=function(_0x5974f2){for(var _0x302b27=0x0,_0x4c3f0f=events[_0x9d21('0x7')];_0x302b27<_0x4c3f0f;_0x302b27++){var _0x1ffe1b=events[_0x302b27];var _0xf9866b=createListener(_0x9d21('0x8')+_0x1ffe1b,_0x5974f2);WhatsappQueueEvents['on'](_0x1ffe1b,_0xf9866b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 71c8f50..99936e1 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 _0x75b6=['destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','/describe','show','post','create','put','/:id','update','delete'];(function(_0x5e3f03,_0x41c4ad){var _0x12136d=function(_0x5aaba0){while(--_0x5aaba0){_0x5e3f03['push'](_0x5e3f03['shift']());}};_0x12136d(++_0x41c4ad);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x675b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x675b('0x1'));var express=require(_0x675b('0x2'));var router=express[_0x675b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x675b('0x4'));var config=require(_0x675b('0x5'));var controller=require(_0x675b('0x6'));router['get']('/',auth[_0x675b('0x7')](),controller['index']);router[_0x675b('0x8')](_0x675b('0x9'),auth[_0x675b('0x7')](),controller['describe']);router[_0x675b('0x8')]('/:id',auth[_0x675b('0x7')](),controller[_0x675b('0xa')]);router[_0x675b('0xb')]('/',auth[_0x675b('0x7')](),controller[_0x675b('0xc')]);router[_0x675b('0xd')](_0x675b('0xe'),auth[_0x675b('0x7')](),controller[_0x675b('0xf')]);router[_0x675b('0x10')]('/:id',auth[_0x675b('0x7')](),controller[_0x675b('0x11')]);module[_0x675b('0x12')]=router; \ No newline at end of file +var _0x1410=['multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x1410,0x130));var _0x0141=function(_0x682d41,_0x555e2c){_0x682d41=_0x682d41-0x0;var _0x5f6daf=_0x1410[_0x682d41];return _0x5f6daf;};'use strict';var multer=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var path=require(_0x0141('0x2'));var timeout=require(_0x0141('0x3'));var express=require('express');var router=express[_0x0141('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0141('0x5'));var config=require('../../config/environment');var controller=require(_0x0141('0x6'));router[_0x0141('0x7')]('/',auth[_0x0141('0x8')](),controller[_0x0141('0x9')]);router[_0x0141('0x7')](_0x0141('0xa'),auth[_0x0141('0x8')](),controller[_0x0141('0xb')]);router[_0x0141('0x7')]('/:id',auth[_0x0141('0x8')](),controller[_0x0141('0xc')]);router[_0x0141('0xd')]('/',auth[_0x0141('0x8')](),controller[_0x0141('0xe')]);router[_0x0141('0xf')](_0x0141('0x10'),auth[_0x0141('0x8')](),controller['update']);router[_0x0141('0x11')](_0x0141('0x10'),auth[_0x0141('0x8')](),controller[_0x0141('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 9bcbd36..728931d 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 _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x2f2083,_0x5e857c){var _0x317b68=function(_0x132e8d){while(--_0x132e8d){_0x2f2083['push'](_0x2f2083['shift']());}};_0x317b68(++_0x5e857c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x37dd09,_0x579a71){_0x37dd09=_0x37dd09-0x0;var _0x51dba6=_0x8ef6[_0x37dd09];return _0x51dba6;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0xcce71d,_0x379a75){var _0x468904=function(_0x13782d){while(--_0x13782d){_0xcce71d['push'](_0xcce71d['shift']());}};_0x468904(++_0x379a75);}(_0x34e8,0x12c));var _0x834e=function(_0x1d0911,_0x1f7b03){_0x1d0911=_0x1d0911-0x0;var _0x46b27b=_0x34e8[_0x1d0911];return _0x46b27b;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 822a6b4..6f37e4f 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 _0x35ac=['apply','reject','save','update','then','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','map','VIRTUAL','filter','include','rows','catch','show','keys','options','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range'];(function(_0x16818e,_0x4c3656){var _0x6fadf9=function(_0x182c97){while(--_0x182c97){_0x16818e['push'](_0x16818e['shift']());}};_0x6fadf9(++_0x4c3656);}(_0x35ac,0x176));var _0xc35a=function(_0x13793a,_0x46c747){_0x13793a=_0x13793a-0x0;var _0x2789e8=_0x35ac[_0x13793a];return _0x2789e8;};'use strict';var pdf=require(_0xc35a('0x0'));var emlformat=require(_0xc35a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc35a('0x2'));var jsonpatch=require(_0xc35a('0x3'));var rp=require('request-promise');var moment=require(_0xc35a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc35a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc35a('0x6'));var csv=require(_0xc35a('0x7'));var ejs=require(_0xc35a('0x8'));var fs=require('fs');var _=require(_0xc35a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc35a('0x7'));var querystring=require(_0xc35a('0xa'));var Papa=require(_0xc35a('0xb'));var Redis=require(_0xc35a('0xc'));var authService=require(_0xc35a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc35a('0xe'));var hardwareService=require(_0xc35a('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xc35a('0x10'));var config=require(_0xc35a('0x11'));var licenseUtil=require(_0xc35a('0x12'));var db=require(_0xc35a('0x13'))['db'];function respondWithStatusCode(_0x3c8d0a,_0x32fb1b){_0x32fb1b=_0x32fb1b||0xcc;return function(_0x246058){if(_0x246058){return _0x3c8d0a[_0xc35a('0x14')](_0x32fb1b);}return _0x3c8d0a[_0xc35a('0x15')](_0x32fb1b)[_0xc35a('0x16')]();};}function respondWithResult(_0x4f0763,_0x44e967){_0x44e967=_0x44e967||0xc8;return function(_0x26b80b){if(_0x26b80b){return _0x4f0763['status'](_0x44e967)[_0xc35a('0x17')](_0x26b80b);}};}function respondWithFilteredResult(_0x30fe91,_0x26356a){return function(_0x379ce9){if(_0x379ce9){var _0x5497c5=_0x379ce9[_0xc35a('0x18')],_0x55c8ae=_0x26356a['offset'],_0x4c2dca=_0x26356a['offset']+_0x26356a[_0xc35a('0x19')],_0x55823b;if(_0x4c2dca>=_0x5497c5){_0x4c2dca=_0x5497c5;_0x55823b=0xc8;}else{_0x55823b=0xce;}_0x30fe91[_0xc35a('0x15')](_0x55823b);return _0x30fe91[_0xc35a('0x1a')](_0xc35a('0x1b'),_0x55c8ae+'-'+_0x4c2dca+'/'+_0x5497c5)[_0xc35a('0x17')](_0x379ce9);}return null;};}function patchUpdates(_0x144bac){return function(_0x2798c8){try{jsonpatch[_0xc35a('0x1c')](_0x2798c8,_0x144bac,!![]);}catch(_0x11d79b){return BPromise[_0xc35a('0x1d')](_0x11d79b);}return _0x2798c8[_0xc35a('0x1e')]();};}function saveUpdates(_0x138907,_0x2eed49){return function(_0xa322ba){if(_0xa322ba){return _0xa322ba[_0xc35a('0x1f')](_0x138907)[_0xc35a('0x20')](function(_0x32a241){return _0x32a241;});}return null;};}function removeEntity(_0x37fdae,_0x59ef3e){return function(_0x4b2421){if(_0x4b2421){return _0x4b2421['destroy']()['then'](function(){_0x37fdae[_0xc35a('0x15')](0xcc)[_0xc35a('0x16')]();});}};}function handleEntityNotFound(_0x261bdb,_0x1ecc32){return function(_0x46bace){if(!_0x46bace){_0x261bdb[_0xc35a('0x14')](0x194);}return _0x46bace;};}function handleError(_0x483875,_0x327373){_0x327373=_0x327373||0x1f4;return function(_0x13a37f){logger[_0xc35a('0x21')](_0x13a37f[_0xc35a('0x22')]);if(_0x13a37f[_0xc35a('0x23')]){delete _0x13a37f[_0xc35a('0x23')];}_0x483875[_0xc35a('0x15')](_0x327373)[_0xc35a('0x24')](_0x13a37f);};}exports[_0xc35a('0x25')]=function(_0x5334dd,_0x35400d){var _0x26b9d9={},_0x47cbf3={},_0x107d6e={'count':0x0,'rows':[]};var _0xc2880c=_['map'](db[_0xc35a('0x26')][_0xc35a('0x27')],function(_0x55e2f6){return{'name':_0x55e2f6[_0xc35a('0x28')],'type':_0x55e2f6[_0xc35a('0x29')][_0xc35a('0x2a')]};});_0x47cbf3[_0xc35a('0x2b')]=_['map'](_0xc2880c,_0xc35a('0x23'));_0x47cbf3[_0xc35a('0x2c')]=_['keys'](_0x5334dd[_0xc35a('0x2c')]);_0x47cbf3['filters']=_[_0xc35a('0x2d')](_0x47cbf3['model'],_0x47cbf3[_0xc35a('0x2c')]);_0x26b9d9[_0xc35a('0x2e')]=_['intersection'](_0x47cbf3[_0xc35a('0x2b')],qs[_0xc35a('0x2f')](_0x5334dd['query'][_0xc35a('0x2f')]));_0x26b9d9['attributes']=_0x26b9d9['attributes'][_0xc35a('0x30')]?_0x26b9d9[_0xc35a('0x2e')]:_0x47cbf3[_0xc35a('0x2b')];if(!_0x5334dd['query'][_0xc35a('0x31')](_0xc35a('0x32'))){_0x26b9d9[_0xc35a('0x19')]=qs['limit'](_0x5334dd[_0xc35a('0x2c')]['limit']);_0x26b9d9['offset']=qs[_0xc35a('0x33')](_0x5334dd['query'][_0xc35a('0x33')]);}_0x26b9d9[_0xc35a('0x34')]=qs['sort'](_0x5334dd[_0xc35a('0x2c')]['sort']);_0x26b9d9[_0xc35a('0x35')]=qs['filters'](_['pick'](_0x5334dd['query'],_0x47cbf3['filters']),_0xc2880c);if(_0x5334dd['query']['filter']){_0x26b9d9['where']=_['merge'](_0x26b9d9[_0xc35a('0x35')],{'$or':_[_0xc35a('0x36')](_0xc2880c,function(_0x5052c0){if(_0x5052c0[_0xc35a('0x29')]!==_0xc35a('0x37')){var _0x3b2a9a={};_0x3b2a9a[_0x5052c0[_0xc35a('0x23')]]={'$like':'%'+_0x5334dd[_0xc35a('0x2c')][_0xc35a('0x38')]+'%'};return _0x3b2a9a;}})});}_0x26b9d9=_['merge']({},_0x26b9d9,_0x5334dd['options']);var _0x16dd5d={'where':_0x26b9d9[_0xc35a('0x35')]};return db[_0xc35a('0x26')][_0xc35a('0x18')](_0x16dd5d)['then'](function(_0x296f66){_0x107d6e[_0xc35a('0x18')]=_0x296f66;if(_0x5334dd['query']['includeAll']){_0x26b9d9[_0xc35a('0x39')]=[{'all':!![]}];}return db[_0xc35a('0x26')]['findAll'](_0x26b9d9);})[_0xc35a('0x20')](function(_0x59de32){_0x107d6e[_0xc35a('0x3a')]=_0x59de32;return _0x107d6e;})[_0xc35a('0x20')](respondWithFilteredResult(_0x35400d,_0x26b9d9))[_0xc35a('0x3b')](handleError(_0x35400d,null));};exports[_0xc35a('0x3c')]=function(_0x369d45,_0x513fc3){var _0x5abf43={'raw':!![],'where':{'id':_0x369d45['params']['id']}},_0xaf74={};_0xaf74[_0xc35a('0x2b')]=_[_0xc35a('0x3d')](db[_0xc35a('0x26')]['rawAttributes']);_0xaf74[_0xc35a('0x2c')]=_[_0xc35a('0x3d')](_0x369d45[_0xc35a('0x2c')]);_0xaf74['filters']=_[_0xc35a('0x2d')](_0xaf74[_0xc35a('0x2b')],_0xaf74[_0xc35a('0x2c')]);_0x5abf43[_0xc35a('0x2e')]=_[_0xc35a('0x2d')](_0xaf74['model'],qs['fields'](_0x369d45[_0xc35a('0x2c')][_0xc35a('0x2f')]));_0x5abf43['attributes']=_0x5abf43[_0xc35a('0x2e')]['length']?_0x5abf43[_0xc35a('0x2e')]:_0xaf74[_0xc35a('0x2b')];if(_0x369d45['query']['includeAll']){_0x5abf43[_0xc35a('0x39')]=[{'all':!![]}];}_0x5abf43=_['merge']({},_0x5abf43,_0x369d45[_0xc35a('0x3e')]);return db[_0xc35a('0x26')]['find'](_0x5abf43)[_0xc35a('0x20')](handleEntityNotFound(_0x513fc3,null))[_0xc35a('0x20')](respondWithResult(_0x513fc3,null))[_0xc35a('0x3b')](handleError(_0x513fc3,null));};exports['create']=function(_0x1548d6,_0x5979a6){return db[_0xc35a('0x26')][_0xc35a('0x3f')](_0x1548d6[_0xc35a('0x40')],{})[_0xc35a('0x20')](respondWithResult(_0x5979a6,0xc9))[_0xc35a('0x3b')](handleError(_0x5979a6,null));};exports[_0xc35a('0x1f')]=function(_0x2a6208,_0x5ca70b){if(_0x2a6208[_0xc35a('0x40')]['id']){delete _0x2a6208[_0xc35a('0x40')]['id'];}return db['WhatsappQueueReport'][_0xc35a('0x41')]({'where':{'id':_0x2a6208['params']['id']}})[_0xc35a('0x20')](handleEntityNotFound(_0x5ca70b,null))[_0xc35a('0x20')](saveUpdates(_0x2a6208[_0xc35a('0x40')],null))['then'](respondWithResult(_0x5ca70b,null))[_0xc35a('0x3b')](handleError(_0x5ca70b,null));};exports['destroy']=function(_0x3ad9b4,_0x2aa89f){return db[_0xc35a('0x26')][_0xc35a('0x41')]({'where':{'id':_0x3ad9b4['params']['id']}})[_0xc35a('0x20')](handleEntityNotFound(_0x2aa89f,null))[_0xc35a('0x20')](removeEntity(_0x2aa89f,null))['catch'](handleError(_0x2aa89f,null));};exports['describe']=function(_0xf5e8a9,_0x566b7f){return db[_0xc35a('0x26')][_0xc35a('0x42')]()[_0xc35a('0x20')](respondWithResult(_0x566b7f,null))[_0xc35a('0x3b')](handleError(_0x566b7f,null));}; \ No newline at end of file +var _0x64ba=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','fast-json-patch'];(function(_0x1ee4c6,_0x1212c3){var _0x19edfe=function(_0x369afc){while(--_0x369afc){_0x1ee4c6['push'](_0x1ee4c6['shift']());}};_0x19edfe(++_0x1212c3);}(_0x64ba,0x125));var _0xa64b=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x64ba[_0x4e7d25];return _0x526fe6;};'use strict';var pdf=require(_0xa64b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa64b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa64b('0x2'));var rp=require(_0xa64b('0x3'));var moment=require(_0xa64b('0x4'));var BPromise=require(_0xa64b('0x5'));var Mustache=require(_0xa64b('0x6'));var util=require(_0xa64b('0x7'));var path=require(_0xa64b('0x8'));var sox=require(_0xa64b('0x9'));var csv=require('to-csv');var ejs=require(_0xa64b('0xa'));var fs=require('fs');var _=require(_0xa64b('0xb'));var squel=require(_0xa64b('0xc'));var crypto=require(_0xa64b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa64b('0xe'));var Redis=require(_0xa64b('0xf'));var authService=require(_0xa64b('0x10'));var qs=require(_0xa64b('0x11'));var as=require(_0xa64b('0x12'));var hardwareService=require(_0xa64b('0x13'));var logger=require(_0xa64b('0x14'))(_0xa64b('0x15'));var utils=require(_0xa64b('0x16'));var config=require(_0xa64b('0x17'));var licenseUtil=require(_0xa64b('0x18'));var db=require(_0xa64b('0x19'))['db'];function respondWithStatusCode(_0xa42f44,_0x280d72){_0x280d72=_0x280d72||0xcc;return function(_0x3a5ecc){if(_0x3a5ecc){return _0xa42f44[_0xa64b('0x1a')](_0x280d72);}return _0xa42f44[_0xa64b('0x1b')](_0x280d72)['end']();};}function respondWithResult(_0x4991da,_0x1a9a32){_0x1a9a32=_0x1a9a32||0xc8;return function(_0x43433b){if(_0x43433b){return _0x4991da['status'](_0x1a9a32)['json'](_0x43433b);}};}function respondWithFilteredResult(_0x131c04,_0x497ca3){return function(_0x24c417){if(_0x24c417){var _0x580cbd=_0x24c417[_0xa64b('0x1c')],_0x83c0f3=_0x497ca3[_0xa64b('0x1d')],_0x121a9b=_0x497ca3[_0xa64b('0x1d')]+_0x497ca3[_0xa64b('0x1e')],_0x5b231f;if(_0x121a9b>=_0x580cbd){_0x121a9b=_0x580cbd;_0x5b231f=0xc8;}else{_0x5b231f=0xce;}_0x131c04[_0xa64b('0x1b')](_0x5b231f);return _0x131c04[_0xa64b('0x1f')](_0xa64b('0x20'),_0x83c0f3+'-'+_0x121a9b+'/'+_0x580cbd)[_0xa64b('0x21')](_0x24c417);}return null;};}function patchUpdates(_0x86861d){return function(_0x391e0e){try{jsonpatch['apply'](_0x391e0e,_0x86861d,!![]);}catch(_0xbac339){return BPromise[_0xa64b('0x22')](_0xbac339);}return _0x391e0e[_0xa64b('0x23')]();};}function saveUpdates(_0x2be111,_0x172c5c){return function(_0x54ce09){if(_0x54ce09){return _0x54ce09[_0xa64b('0x24')](_0x2be111)[_0xa64b('0x25')](function(_0x31b3a3){return _0x31b3a3;});}return null;};}function removeEntity(_0x28a22d,_0x3e0c51){return function(_0x4c9393){if(_0x4c9393){return _0x4c9393[_0xa64b('0x26')]()[_0xa64b('0x25')](function(){_0x28a22d[_0xa64b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267a0a,_0x2720b9){return function(_0x536151){if(!_0x536151){_0x267a0a['sendStatus'](0x194);}return _0x536151;};}function handleError(_0x3a2e95,_0x11b067){_0x11b067=_0x11b067||0x1f4;return function(_0x568e75){logger['error'](_0x568e75['stack']);if(_0x568e75[_0xa64b('0x27')]){delete _0x568e75[_0xa64b('0x27')];}_0x3a2e95[_0xa64b('0x1b')](_0x11b067)[_0xa64b('0x28')](_0x568e75);};}exports[_0xa64b('0x29')]=function(_0x9e94f2,_0x42c0d5){var _0x47fca5={},_0x3b7da1={},_0x4b805b={'count':0x0,'rows':[]};var _0x380cfc=_[_0xa64b('0x2a')](db[_0xa64b('0x2b')]['rawAttributes'],function(_0x30a272){return{'name':_0x30a272['fieldName'],'type':_0x30a272[_0xa64b('0x2c')][_0xa64b('0x2d')]};});_0x3b7da1[_0xa64b('0x2e')]=_[_0xa64b('0x2a')](_0x380cfc,_0xa64b('0x27'));_0x3b7da1[_0xa64b('0x2f')]=_[_0xa64b('0x30')](_0x9e94f2[_0xa64b('0x2f')]);_0x3b7da1[_0xa64b('0x31')]=_[_0xa64b('0x32')](_0x3b7da1['model'],_0x3b7da1[_0xa64b('0x2f')]);_0x47fca5['attributes']=_[_0xa64b('0x32')](_0x3b7da1[_0xa64b('0x2e')],qs[_0xa64b('0x33')](_0x9e94f2[_0xa64b('0x2f')]['fields']));_0x47fca5['attributes']=_0x47fca5[_0xa64b('0x34')][_0xa64b('0x35')]?_0x47fca5[_0xa64b('0x34')]:_0x3b7da1[_0xa64b('0x2e')];if(!_0x9e94f2[_0xa64b('0x2f')][_0xa64b('0x36')](_0xa64b('0x37'))){_0x47fca5[_0xa64b('0x1e')]=qs[_0xa64b('0x1e')](_0x9e94f2['query'][_0xa64b('0x1e')]);_0x47fca5[_0xa64b('0x1d')]=qs[_0xa64b('0x1d')](_0x9e94f2[_0xa64b('0x2f')][_0xa64b('0x1d')]);}_0x47fca5['order']=qs[_0xa64b('0x38')](_0x9e94f2[_0xa64b('0x2f')][_0xa64b('0x38')]);_0x47fca5['where']=qs['filters'](_[_0xa64b('0x39')](_0x9e94f2[_0xa64b('0x2f')],_0x3b7da1[_0xa64b('0x31')]),_0x380cfc);if(_0x9e94f2['query']['filter']){_0x47fca5['where']=_['merge'](_0x47fca5[_0xa64b('0x3a')],{'$or':_[_0xa64b('0x2a')](_0x380cfc,function(_0x52a5c2){if(_0x52a5c2[_0xa64b('0x2c')]!==_0xa64b('0x3b')){var _0x170641={};_0x170641[_0x52a5c2[_0xa64b('0x27')]]={'$like':'%'+_0x9e94f2['query']['filter']+'%'};return _0x170641;}})});}_0x47fca5=_[_0xa64b('0x3c')]({},_0x47fca5,_0x9e94f2[_0xa64b('0x3d')]);var _0x57ebc6={'where':_0x47fca5[_0xa64b('0x3a')]};return db['WhatsappQueueReport'][_0xa64b('0x1c')](_0x57ebc6)[_0xa64b('0x25')](function(_0x16747f){_0x4b805b[_0xa64b('0x1c')]=_0x16747f;if(_0x9e94f2['query'][_0xa64b('0x3e')]){_0x47fca5[_0xa64b('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa64b('0x40')](_0x47fca5);})[_0xa64b('0x25')](function(_0x4ad06d){_0x4b805b[_0xa64b('0x41')]=_0x4ad06d;return _0x4b805b;})[_0xa64b('0x25')](respondWithFilteredResult(_0x42c0d5,_0x47fca5))[_0xa64b('0x42')](handleError(_0x42c0d5,null));};exports[_0xa64b('0x43')]=function(_0x14e85d,_0x94cf91){var _0x196480={'raw':!![],'where':{'id':_0x14e85d[_0xa64b('0x44')]['id']}},_0xf7e8d1={};_0xf7e8d1[_0xa64b('0x2e')]=_['keys'](db[_0xa64b('0x2b')][_0xa64b('0x45')]);_0xf7e8d1[_0xa64b('0x2f')]=_[_0xa64b('0x30')](_0x14e85d['query']);_0xf7e8d1[_0xa64b('0x31')]=_[_0xa64b('0x32')](_0xf7e8d1['model'],_0xf7e8d1[_0xa64b('0x2f')]);_0x196480[_0xa64b('0x34')]=_[_0xa64b('0x32')](_0xf7e8d1[_0xa64b('0x2e')],qs[_0xa64b('0x33')](_0x14e85d[_0xa64b('0x2f')]['fields']));_0x196480[_0xa64b('0x34')]=_0x196480[_0xa64b('0x34')][_0xa64b('0x35')]?_0x196480[_0xa64b('0x34')]:_0xf7e8d1[_0xa64b('0x2e')];if(_0x14e85d[_0xa64b('0x2f')][_0xa64b('0x3e')]){_0x196480[_0xa64b('0x3f')]=[{'all':!![]}];}_0x196480=_[_0xa64b('0x3c')]({},_0x196480,_0x14e85d[_0xa64b('0x3d')]);return db[_0xa64b('0x2b')][_0xa64b('0x46')](_0x196480)[_0xa64b('0x25')](handleEntityNotFound(_0x94cf91,null))[_0xa64b('0x25')](respondWithResult(_0x94cf91,null))[_0xa64b('0x42')](handleError(_0x94cf91,null));};exports[_0xa64b('0x47')]=function(_0x8c6c89,_0x1db163){return db['WhatsappQueueReport']['create'](_0x8c6c89[_0xa64b('0x48')],{})[_0xa64b('0x25')](respondWithResult(_0x1db163,0xc9))[_0xa64b('0x42')](handleError(_0x1db163,null));};exports['update']=function(_0x571c62,_0x141fdc){if(_0x571c62[_0xa64b('0x48')]['id']){delete _0x571c62[_0xa64b('0x48')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x571c62[_0xa64b('0x44')]['id']}})[_0xa64b('0x25')](handleEntityNotFound(_0x141fdc,null))['then'](saveUpdates(_0x571c62[_0xa64b('0x48')],null))[_0xa64b('0x25')](respondWithResult(_0x141fdc,null))[_0xa64b('0x42')](handleError(_0x141fdc,null));};exports[_0xa64b('0x26')]=function(_0x49703c,_0xfda60){return db[_0xa64b('0x2b')][_0xa64b('0x46')]({'where':{'id':_0x49703c['params']['id']}})[_0xa64b('0x25')](handleEntityNotFound(_0xfda60,null))[_0xa64b('0x25')](removeEntity(_0xfda60,null))['catch'](handleError(_0xfda60,null));};exports[_0xa64b('0x49')]=function(_0x4c5b2d,_0x533f90){return db[_0xa64b('0x2b')]['describe']()[_0xa64b('0x25')](respondWithResult(_0x533f90,null))['catch'](handleError(_0x533f90,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index afee155..a75f8cf 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 _0xaf88=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','moment','bluebird','request-promise','path'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xaf88,0xed));var _0x8af8=function(_0x3878ba,_0x2686bd){_0x3878ba=_0x3878ba-0x0;var _0x5b0b2f=_0xaf88[_0x3878ba];return _0x5b0b2f;};'use strict';var _=require(_0x8af8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8af8('0x1'));var BPromise=require(_0x8af8('0x2'));var rp=require(_0x8af8('0x3'));var fs=require('fs');var path=require(_0x8af8('0x4'));var rimraf=require('rimraf');var config=require(_0x8af8('0x5'));var attributes=require(_0x8af8('0x6'));module[_0x8af8('0x7')]=function(_0x4a9bc9,_0x39b70d){return _0x4a9bc9[_0x8af8('0x8')](_0x8af8('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x8af8('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9f8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','uniqueid','util'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb9f8,0x8b));var _0x8b9f=function(_0x4c9699,_0x1c98f8){_0x4c9699=_0x4c9699-0x0;var _0x43bca1=_0xb9f8[_0x4c9699];return _0x43bca1;};'use strict';var _=require('lodash');var util=require(_0x8b9f('0x0'));var logger=require(_0x8b9f('0x1'))(_0x8b9f('0x2'));var moment=require(_0x8b9f('0x3'));var BPromise=require(_0x8b9f('0x4'));var rp=require(_0x8b9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b9f('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b9f('0x7'));module[_0x8b9f('0x8')]=function(_0x3a8639,_0x296065){return _0x3a8639['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x8b9f('0x9'),'fields':[_0x8b9f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9e8df13..436b529 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 _0xcaf7=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x57dfbc,_0x5b6990){var _0x46d5b3=function(_0x17a599){while(--_0x17a599){_0x57dfbc['push'](_0x57dfbc['shift']());}};_0x46d5b3(++_0x5b6990);}(_0xcaf7,0x192));var _0x7caf=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xcaf7[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7caf('0x0'));var BPromise=require('bluebird');var rs=require(_0x7caf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7caf('0x2'))['db'];var utils=require(_0x7caf('0x3'));var logger=require('../../config/logger')(_0x7caf('0x4'));var config=require('../../config/environment');var jayson=require(_0x7caf('0x5'));var client=jayson['client'][_0x7caf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xbb41fe,_0x55ae7b,_0x4c11cb){return new BPromise(function(_0x4a888b,_0x46ca0e){return client['request'](_0xbb41fe,_0x4c11cb)[_0x7caf('0x7')](function(_0x111ac4){logger[_0x7caf('0x8')](_0x7caf('0x9'),_0x55ae7b,_0x7caf('0xa'));logger[_0x7caf('0xb')](_0x7caf('0xc'),_0x55ae7b,_0x7caf('0xa'),JSON[_0x7caf('0xd')](_0x111ac4));if(_0x111ac4[_0x7caf('0xe')]){if(_0x111ac4['error'][_0x7caf('0xf')]===0x1f4){logger[_0x7caf('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x55ae7b,_0x111ac4['error'][_0x7caf('0x10')]);return _0x46ca0e(_0x111ac4[_0x7caf('0xe')]['message']);}logger[_0x7caf('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x55ae7b,_0x111ac4[_0x7caf('0xe')][_0x7caf('0x10')]);return _0x4a888b(_0x111ac4[_0x7caf('0xe')][_0x7caf('0x10')]);}else{logger[_0x7caf('0x8')](_0x7caf('0x9'),_0x55ae7b,'request\x20sent');_0x4a888b(_0x111ac4[_0x7caf('0x11')][_0x7caf('0x10')]);}})[_0x7caf('0x12')](function(_0x56f625){logger[_0x7caf('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x55ae7b,_0x56f625);_0x46ca0e(_0x56f625);});});}exports[_0x7caf('0x13')]=function(_0x472fb1){var _0x33b418=this;return new Promise(function(_0x52a553,_0x5b709d){return db[_0x7caf('0x14')][_0x7caf('0x15')](_0x472fb1[_0x7caf('0x16')],{'raw':_0x472fb1['options']?_0x472fb1[_0x7caf('0x17')][_0x7caf('0x18')]===undefined?!![]:![]:!![]})[_0x7caf('0x7')](function(_0x29b47c){logger[_0x7caf('0x8')](_0x7caf('0x13'),_0x472fb1);logger[_0x7caf('0xb')](_0x7caf('0x13'),_0x472fb1,JSON['stringify'](_0x29b47c));_0x52a553(_0x29b47c);})[_0x7caf('0x12')](function(_0x2ad88c){logger[_0x7caf('0xe')](_0x7caf('0x13'),_0x2ad88c['message'],_0x472fb1);_0x5b709d(_0x33b418[_0x7caf('0xe')](0x1f4,_0x2ad88c[_0x7caf('0x10')]));});});};exports[_0x7caf('0x19')]=function(_0x19ea0a){var _0x54ba4f=this;return new Promise(function(_0x3e9f5e,_0x143069){return db[_0x7caf('0x14')][_0x7caf('0x1a')](_0x19ea0a[_0x7caf('0x16')],{'raw':_0x19ea0a['options']?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ea0a[_0x7caf('0x17')]?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x1b')]||null:null,'attributes':_0x19ea0a[_0x7caf('0x17')]?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x1c')]||null:null,'limit':_0x19ea0a[_0x7caf('0x17')]?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x1d')]||null:null})['then'](function(_0x5d6dea){logger['info'](_0x7caf('0x19'),_0x19ea0a);logger[_0x7caf('0xb')]('UpdateWhatsappQueueReport',_0x19ea0a,JSON[_0x7caf('0xd')](_0x5d6dea));_0x3e9f5e(_0x5d6dea);})[_0x7caf('0x12')](function(_0x2fba3f){logger['error'](_0x7caf('0x19'),_0x2fba3f[_0x7caf('0x10')],_0x19ea0a);_0x143069(_0x54ba4f['error'](0x1f4,_0x2fba3f[_0x7caf('0x10')]));});});}; \ No newline at end of file +var _0xdd54=['code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','info','stringify','UpdateWhatsappQueueReport','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x20e882,_0x16185c){var _0x3e0dbe=function(_0x3d0129){while(--_0x3d0129){_0x20e882['push'](_0x20e882['shift']());}};_0x3e0dbe(++_0x16185c);}(_0xdd54,0x159));var _0x4dd5=function(_0x4093bb,_0x12d5d8){_0x4093bb=_0x4093bb-0x0;var _0x349327=_0xdd54[_0x4093bb];return _0x349327;};'use strict';var _=require(_0x4dd5('0x0'));var util=require(_0x4dd5('0x1'));var moment=require(_0x4dd5('0x2'));var BPromise=require(_0x4dd5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4dd5('0x4'));var db=require(_0x4dd5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4dd5('0x6'));var config=require(_0x4dd5('0x7'));var jayson=require(_0x4dd5('0x8'));var client=jayson[_0x4dd5('0x9')][_0x4dd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x447b6c,_0x3df13a,_0x51f586){return new BPromise(function(_0x146965,_0x1e3094){return client[_0x4dd5('0xb')](_0x447b6c,_0x51f586)[_0x4dd5('0xc')](function(_0x2122da){logger['info'](_0x4dd5('0xd'),_0x3df13a,_0x4dd5('0xe'));logger[_0x4dd5('0xf')](_0x4dd5('0x10'),_0x3df13a,_0x4dd5('0xe'),JSON['stringify'](_0x2122da));if(_0x2122da[_0x4dd5('0x11')]){if(_0x2122da['error'][_0x4dd5('0x12')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3df13a,_0x2122da['error']['message']);return _0x1e3094(_0x2122da[_0x4dd5('0x11')]['message']);}logger[_0x4dd5('0x11')](_0x4dd5('0xd'),_0x3df13a,_0x2122da['error'][_0x4dd5('0x13')]);return _0x146965(_0x2122da[_0x4dd5('0x11')]['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x3df13a,_0x4dd5('0xe'));_0x146965(_0x2122da[_0x4dd5('0x14')][_0x4dd5('0x13')]);}})[_0x4dd5('0x15')](function(_0x5d41a4){logger[_0x4dd5('0x11')](_0x4dd5('0xd'),_0x3df13a,_0x5d41a4);_0x1e3094(_0x5d41a4);});});}exports[_0x4dd5('0x16')]=function(_0x1dc77b){var _0x38840b=this;return new Promise(function(_0x4125cb,_0x310641){return db[_0x4dd5('0x17')][_0x4dd5('0x18')](_0x1dc77b[_0x4dd5('0x19')],{'raw':_0x1dc77b[_0x4dd5('0x1a')]?_0x1dc77b['options'][_0x4dd5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x532092){logger[_0x4dd5('0x1c')]('CreateWhatsappQueueReport',_0x1dc77b);logger['debug']('CreateWhatsappQueueReport',_0x1dc77b,JSON[_0x4dd5('0x1d')](_0x532092));_0x4125cb(_0x532092);})[_0x4dd5('0x15')](function(_0x47d3fa){logger[_0x4dd5('0x11')](_0x4dd5('0x16'),_0x47d3fa[_0x4dd5('0x13')],_0x1dc77b);_0x310641(_0x38840b[_0x4dd5('0x11')](0x1f4,_0x47d3fa[_0x4dd5('0x13')]));});});};exports[_0x4dd5('0x1e')]=function(_0x3152b2){var _0x518d28=this;return new Promise(function(_0x1cbda0,_0x2abf17){return db['WhatsappQueueReport']['update'](_0x3152b2[_0x4dd5('0x19')],{'raw':_0x3152b2[_0x4dd5('0x1a')]?_0x3152b2[_0x4dd5('0x1a')][_0x4dd5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3152b2[_0x4dd5('0x1a')]?_0x3152b2['options']['where']||null:null,'attributes':_0x3152b2['options']?_0x3152b2[_0x4dd5('0x1a')][_0x4dd5('0x1f')]||null:null,'limit':_0x3152b2[_0x4dd5('0x1a')]?_0x3152b2[_0x4dd5('0x1a')][_0x4dd5('0x20')]||null:null})[_0x4dd5('0xc')](function(_0x28b622){logger[_0x4dd5('0x1c')](_0x4dd5('0x1e'),_0x3152b2);logger['debug']('UpdateWhatsappQueueReport',_0x3152b2,JSON[_0x4dd5('0x1d')](_0x28b622));_0x1cbda0(_0x28b622);})[_0x4dd5('0x15')](function(_0x23143c){logger[_0x4dd5('0x11')](_0x4dd5('0x1e'),_0x23143c[_0x4dd5('0x13')],_0x3152b2);_0x2abf17(_0x518d28[_0x4dd5('0x11')](0x1f4,_0x23143c[_0x4dd5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f641a6c..c544e64 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 _0x9f89=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x9f89,0x13d));var _0x99f8=function(_0x18e484,_0x3e612f){_0x18e484=_0x18e484-0x0;var _0x2250eb=_0x9f89[_0x18e484];return _0x2250eb;};'use strict';var multer=require('multer');var util=require(_0x99f8('0x0'));var path=require('path');var timeout=require(_0x99f8('0x1'));var express=require(_0x99f8('0x2'));var router=express[_0x99f8('0x3')]();var auth=require(_0x99f8('0x4'));var interaction=require(_0x99f8('0x5'));var config=require('../../config/environment');var controller=require(_0x99f8('0x6'));router[_0x99f8('0x7')]('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0x9')]);router[_0x99f8('0x7')](_0x99f8('0xa'),auth[_0x99f8('0x8')](),controller['describe']);router[_0x99f8('0x7')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),controller[_0x99f8('0xc')]);router['post']('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0xd')]);router[_0x99f8('0xe')](_0x99f8('0xb'),auth['isAuthenticated'](),controller[_0x99f8('0xf')]);router[_0x99f8('0x10')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),controller[_0x99f8('0x11')]);module[_0x99f8('0x12')]=router; \ No newline at end of file +var _0x6c2c=['/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x6c2c,0x158));var _0xc6c2=function(_0x5756c5,_0x339a9f){_0x5756c5=_0x5756c5-0x0;var _0x47a8eb=_0x6c2c[_0x5756c5];return _0x47a8eb;};'use strict';var multer=require('multer');var util=require(_0xc6c2('0x0'));var path=require(_0xc6c2('0x1'));var timeout=require(_0xc6c2('0x2'));var express=require(_0xc6c2('0x3'));var router=express[_0xc6c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6c2('0x5'));var config=require(_0xc6c2('0x6'));var controller=require(_0xc6c2('0x7'));router[_0xc6c2('0x8')]('/',auth[_0xc6c2('0x9')](),controller[_0xc6c2('0xa')]);router[_0xc6c2('0x8')](_0xc6c2('0xb'),auth[_0xc6c2('0x9')](),controller[_0xc6c2('0xc')]);router['get'](_0xc6c2('0xd'),auth[_0xc6c2('0x9')](),controller[_0xc6c2('0xe')]);router[_0xc6c2('0xf')]('/',auth[_0xc6c2('0x9')](),controller[_0xc6c2('0x10')]);router[_0xc6c2('0x11')](_0xc6c2('0xd'),auth[_0xc6c2('0x9')](),controller[_0xc6c2('0x12')]);router[_0xc6c2('0x13')]('/:id',auth[_0xc6c2('0x9')](),controller[_0xc6c2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a81d999..92f47de 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0xe455df,_0x52351e){var _0x5ce541=function(_0x41f971){while(--_0x41f971){_0xe455df['push'](_0xe455df['shift']());}};_0x5ce541(++_0x52351e);}(_0x2032,0xd9));var _0x2203=function(_0x2b283a,_0x53cc01){_0x2b283a=_0x2b283a-0x0;var _0x10e09d=_0x2032[_0x2b283a];return _0x10e09d;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8f8724a..3620ec2 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 _0x47fa=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf'];(function(_0x1a55c2,_0x1481a1){var _0x6ac323=function(_0x2650e4){while(--_0x2650e4){_0x1a55c2['push'](_0x1a55c2['shift']());}};_0x6ac323(++_0x1481a1);}(_0x47fa,0x167));var _0xa47f=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0x47fa[_0x584b9d];return _0x172053;};'use strict';var pdf=require(_0xa47f('0x0'));var emlformat=require(_0xa47f('0x1'));var rimraf=require(_0xa47f('0x2'));var zipdir=require(_0xa47f('0x3'));var jsonpatch=require(_0xa47f('0x4'));var rp=require(_0xa47f('0x5'));var moment=require('moment');var BPromise=require(_0xa47f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa47f('0x7'));var sox=require(_0xa47f('0x8'));var csv=require(_0xa47f('0x9'));var ejs=require(_0xa47f('0xa'));var fs=require('fs');var _=require(_0xa47f('0xb'));var squel=require(_0xa47f('0xc'));var crypto=require('crypto');var jsforce=require(_0xa47f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa47f('0x9'));var querystring=require(_0xa47f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa47f('0xf'));var authService=require(_0xa47f('0x10'));var qs=require(_0xa47f('0x11'));var as=require(_0xa47f('0x12'));var hardwareService=require(_0xa47f('0x13'));var logger=require(_0xa47f('0x14'))(_0xa47f('0x15'));var utils=require(_0xa47f('0x16'));var config=require(_0xa47f('0x17'));var licenseUtil=require(_0xa47f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x139a80,_0x1041bf){_0x1041bf=_0x1041bf||0xcc;return function(_0x5b0219){if(_0x5b0219){return _0x139a80['sendStatus'](_0x1041bf);}return _0x139a80[_0xa47f('0x19')](_0x1041bf)['end']();};}function respondWithResult(_0x267089,_0x59aa21){_0x59aa21=_0x59aa21||0xc8;return function(_0x5d4481){if(_0x5d4481){return _0x267089[_0xa47f('0x19')](_0x59aa21)['json'](_0x5d4481);}};}function respondWithFilteredResult(_0x5a7eed,_0x446728){return function(_0x3b6b75){if(_0x3b6b75){var _0x2ff767=_0x3b6b75[_0xa47f('0x1a')],_0x4e45ea=_0x446728['offset'],_0x225dd5=_0x446728[_0xa47f('0x1b')]+_0x446728[_0xa47f('0x1c')],_0x25a30d;if(_0x225dd5>=_0x2ff767){_0x225dd5=_0x2ff767;_0x25a30d=0xc8;}else{_0x25a30d=0xce;}_0x5a7eed['status'](_0x25a30d);return _0x5a7eed['set'](_0xa47f('0x1d'),_0x4e45ea+'-'+_0x225dd5+'/'+_0x2ff767)[_0xa47f('0x1e')](_0x3b6b75);}return null;};}function patchUpdates(_0x509ef8){return function(_0x5a8326){try{jsonpatch[_0xa47f('0x1f')](_0x5a8326,_0x509ef8,!![]);}catch(_0x14b452){return BPromise[_0xa47f('0x20')](_0x14b452);}return _0x5a8326['save']();};}function saveUpdates(_0x47eefa,_0x4641df){return function(_0xb6802d){if(_0xb6802d){return _0xb6802d[_0xa47f('0x21')](_0x47eefa)[_0xa47f('0x22')](function(_0x5947d6){return _0x5947d6;});}return null;};}function removeEntity(_0x4d3439,_0x4e57fc){return function(_0x4cd61d){if(_0x4cd61d){return _0x4cd61d[_0xa47f('0x23')]()[_0xa47f('0x22')](function(){_0x4d3439[_0xa47f('0x19')](0xcc)[_0xa47f('0x24')]();});}};}function handleEntityNotFound(_0x4db582,_0x2064c1){return function(_0x31fbfa){if(!_0x31fbfa){_0x4db582['sendStatus'](0x194);}return _0x31fbfa;};}function handleError(_0x452f70,_0x5affbf){_0x5affbf=_0x5affbf||0x1f4;return function(_0x537c56){logger[_0xa47f('0x25')](_0x537c56[_0xa47f('0x26')]);if(_0x537c56[_0xa47f('0x27')]){delete _0x537c56[_0xa47f('0x27')];}_0x452f70[_0xa47f('0x19')](_0x5affbf)[_0xa47f('0x28')](_0x537c56);};}exports['index']=function(_0x29155e,_0x42eacc){var _0x9a6d67={},_0x1c13d0={},_0x58e778={'count':0x0,'rows':[]};var _0x10fbc0=_[_0xa47f('0x29')](db[_0xa47f('0x2a')][_0xa47f('0x2b')],function(_0x57e221){return{'name':_0x57e221['fieldName'],'type':_0x57e221[_0xa47f('0x2c')]['key']};});_0x1c13d0[_0xa47f('0x2d')]=_[_0xa47f('0x29')](_0x10fbc0,_0xa47f('0x27'));_0x1c13d0[_0xa47f('0x2e')]=_[_0xa47f('0x2f')](_0x29155e[_0xa47f('0x2e')]);_0x1c13d0[_0xa47f('0x30')]=_[_0xa47f('0x31')](_0x1c13d0[_0xa47f('0x2d')],_0x1c13d0['query']);_0x9a6d67['attributes']=_[_0xa47f('0x31')](_0x1c13d0[_0xa47f('0x2d')],qs[_0xa47f('0x32')](_0x29155e[_0xa47f('0x2e')][_0xa47f('0x32')]));_0x9a6d67[_0xa47f('0x33')]=_0x9a6d67['attributes']['length']?_0x9a6d67[_0xa47f('0x33')]:_0x1c13d0[_0xa47f('0x2d')];if(!_0x29155e[_0xa47f('0x2e')][_0xa47f('0x34')](_0xa47f('0x35'))){_0x9a6d67[_0xa47f('0x1c')]=qs[_0xa47f('0x1c')](_0x29155e[_0xa47f('0x2e')]['limit']);_0x9a6d67[_0xa47f('0x1b')]=qs[_0xa47f('0x1b')](_0x29155e['query'][_0xa47f('0x1b')]);}_0x9a6d67[_0xa47f('0x36')]=qs[_0xa47f('0x37')](_0x29155e[_0xa47f('0x2e')]['sort']);_0x9a6d67['where']=qs['filters'](_[_0xa47f('0x38')](_0x29155e[_0xa47f('0x2e')],_0x1c13d0[_0xa47f('0x30')]),_0x10fbc0);if(_0x29155e[_0xa47f('0x2e')][_0xa47f('0x39')]){_0x9a6d67[_0xa47f('0x3a')]=_[_0xa47f('0x3b')](_0x9a6d67['where'],{'$or':_[_0xa47f('0x29')](_0x10fbc0,function(_0xad9642){if(_0xad9642[_0xa47f('0x2c')]!==_0xa47f('0x3c')){var _0x5747e9={};_0x5747e9[_0xad9642[_0xa47f('0x27')]]={'$like':'%'+_0x29155e[_0xa47f('0x2e')][_0xa47f('0x39')]+'%'};return _0x5747e9;}})});}_0x9a6d67=_[_0xa47f('0x3b')]({},_0x9a6d67,_0x29155e[_0xa47f('0x3d')]);var _0x22d987={'where':_0x9a6d67[_0xa47f('0x3a')]};return db[_0xa47f('0x2a')][_0xa47f('0x1a')](_0x22d987)['then'](function(_0x1f6f3a){_0x58e778[_0xa47f('0x1a')]=_0x1f6f3a;if(_0x29155e['query'][_0xa47f('0x3e')]){_0x9a6d67[_0xa47f('0x3f')]=[{'all':!![]}];}return db[_0xa47f('0x2a')][_0xa47f('0x40')](_0x9a6d67);})[_0xa47f('0x22')](function(_0x559682){_0x58e778[_0xa47f('0x41')]=_0x559682;return _0x58e778;})[_0xa47f('0x22')](respondWithFilteredResult(_0x42eacc,_0x9a6d67))[_0xa47f('0x42')](handleError(_0x42eacc,null));};exports[_0xa47f('0x43')]=function(_0x1f6a15,_0x404521){var _0x3ea1a6={'raw':!![],'where':{'id':_0x1f6a15[_0xa47f('0x44')]['id']}},_0x3ccf9f={};_0x3ccf9f['model']=_[_0xa47f('0x2f')](db[_0xa47f('0x2a')][_0xa47f('0x2b')]);_0x3ccf9f[_0xa47f('0x2e')]=_[_0xa47f('0x2f')](_0x1f6a15[_0xa47f('0x2e')]);_0x3ccf9f[_0xa47f('0x30')]=_[_0xa47f('0x31')](_0x3ccf9f[_0xa47f('0x2d')],_0x3ccf9f[_0xa47f('0x2e')]);_0x3ea1a6[_0xa47f('0x33')]=_[_0xa47f('0x31')](_0x3ccf9f['model'],qs['fields'](_0x1f6a15[_0xa47f('0x2e')]['fields']));_0x3ea1a6[_0xa47f('0x33')]=_0x3ea1a6[_0xa47f('0x33')]['length']?_0x3ea1a6[_0xa47f('0x33')]:_0x3ccf9f[_0xa47f('0x2d')];if(_0x1f6a15[_0xa47f('0x2e')][_0xa47f('0x3e')]){_0x3ea1a6[_0xa47f('0x3f')]=[{'all':!![]}];}_0x3ea1a6=_[_0xa47f('0x3b')]({},_0x3ea1a6,_0x1f6a15[_0xa47f('0x3d')]);return db[_0xa47f('0x2a')][_0xa47f('0x45')](_0x3ea1a6)[_0xa47f('0x22')](handleEntityNotFound(_0x404521,null))[_0xa47f('0x22')](respondWithResult(_0x404521,null))['catch'](handleError(_0x404521,null));};exports[_0xa47f('0x46')]=function(_0x2d39e8,_0x49e595){return db[_0xa47f('0x2a')]['create'](_0x2d39e8[_0xa47f('0x47')],{})['then'](respondWithResult(_0x49e595,0xc9))[_0xa47f('0x42')](handleError(_0x49e595,null));};exports[_0xa47f('0x21')]=function(_0x474507,_0x2bbb5d){if(_0x474507[_0xa47f('0x47')]['id']){delete _0x474507['body']['id'];}return db[_0xa47f('0x2a')]['find']({'where':{'id':_0x474507[_0xa47f('0x44')]['id']}})[_0xa47f('0x22')](handleEntityNotFound(_0x2bbb5d,null))[_0xa47f('0x22')](saveUpdates(_0x474507[_0xa47f('0x47')],null))['then'](respondWithResult(_0x2bbb5d,null))[_0xa47f('0x42')](handleError(_0x2bbb5d,null));};exports[_0xa47f('0x23')]=function(_0x296040,_0x1eb51d){return db[_0xa47f('0x2a')][_0xa47f('0x45')]({'where':{'id':_0x296040[_0xa47f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1eb51d,null))[_0xa47f('0x22')](removeEntity(_0x1eb51d,null))[_0xa47f('0x42')](handleError(_0x1eb51d,null));};exports['describe']=function(_0x396ef4,_0x121ac9){return db[_0xa47f('0x2a')]['describe']()[_0xa47f('0x22')](respondWithResult(_0x121ac9,null))['catch'](handleError(_0x121ac9,null));}; \ No newline at end of file +var _0x0d47=['end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappTransferReport','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','update','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x55beab,_0x75a2cc){var _0x3fe0e8=function(_0x5b3cb0){while(--_0x5b3cb0){_0x55beab['push'](_0x55beab['shift']());}};_0x3fe0e8(++_0x75a2cc);}(_0x0d47,0x1b9));var _0x70d4=function(_0x59e8fa,_0xeaef9f){_0x59e8fa=_0x59e8fa-0x0;var _0x2a9e1b=_0x0d47[_0x59e8fa];return _0x2a9e1b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x70d4('0x0'));var zipdir=require(_0x70d4('0x1'));var jsonpatch=require(_0x70d4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x70d4('0x3'));var Mustache=require(_0x70d4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x70d4('0x5'));var csv=require('to-csv');var ejs=require(_0x70d4('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70d4('0x7'));var crypto=require(_0x70d4('0x8'));var jsforce=require(_0x70d4('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x70d4('0xa'));var Papa=require(_0x70d4('0xb'));var Redis=require(_0x70d4('0xc'));var authService=require(_0x70d4('0xd'));var qs=require(_0x70d4('0xe'));var as=require(_0x70d4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x70d4('0x10'));var licenseUtil=require(_0x70d4('0x11'));var db=require(_0x70d4('0x12'))['db'];function respondWithStatusCode(_0x726ebc,_0x2b3c50){_0x2b3c50=_0x2b3c50||0xcc;return function(_0x146ef4){if(_0x146ef4){return _0x726ebc[_0x70d4('0x13')](_0x2b3c50);}return _0x726ebc[_0x70d4('0x14')](_0x2b3c50)[_0x70d4('0x15')]();};}function respondWithResult(_0x10e8b1,_0x58e9d1){_0x58e9d1=_0x58e9d1||0xc8;return function(_0x321c6d){if(_0x321c6d){return _0x10e8b1['status'](_0x58e9d1)[_0x70d4('0x16')](_0x321c6d);}};}function respondWithFilteredResult(_0x2fa3d9,_0x10e1a1){return function(_0x4a99b4){if(_0x4a99b4){var _0x2cae9e=_0x4a99b4[_0x70d4('0x17')],_0x4b162a=_0x10e1a1[_0x70d4('0x18')],_0x3ed329=_0x10e1a1[_0x70d4('0x18')]+_0x10e1a1[_0x70d4('0x19')],_0xd2a542;if(_0x3ed329>=_0x2cae9e){_0x3ed329=_0x2cae9e;_0xd2a542=0xc8;}else{_0xd2a542=0xce;}_0x2fa3d9[_0x70d4('0x14')](_0xd2a542);return _0x2fa3d9[_0x70d4('0x1a')]('Content-Range',_0x4b162a+'-'+_0x3ed329+'/'+_0x2cae9e)['json'](_0x4a99b4);}return null;};}function patchUpdates(_0xa50a73){return function(_0x208490){try{jsonpatch[_0x70d4('0x1b')](_0x208490,_0xa50a73,!![]);}catch(_0x583b9e){return BPromise[_0x70d4('0x1c')](_0x583b9e);}return _0x208490[_0x70d4('0x1d')]();};}function saveUpdates(_0x3b37dc,_0x303c3e){return function(_0x4e9db8){if(_0x4e9db8){return _0x4e9db8['update'](_0x3b37dc)[_0x70d4('0x1e')](function(_0x18aa92){return _0x18aa92;});}return null;};}function removeEntity(_0x136fb2,_0x4776b4){return function(_0x700961){if(_0x700961){return _0x700961[_0x70d4('0x1f')]()[_0x70d4('0x1e')](function(){_0x136fb2[_0x70d4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54de89,_0x41ebb4){return function(_0x290295){if(!_0x290295){_0x54de89[_0x70d4('0x13')](0x194);}return _0x290295;};}function handleError(_0x2da15e,_0x25c46c){_0x25c46c=_0x25c46c||0x1f4;return function(_0x5f510d){logger[_0x70d4('0x20')](_0x5f510d[_0x70d4('0x21')]);if(_0x5f510d[_0x70d4('0x22')]){delete _0x5f510d[_0x70d4('0x22')];}_0x2da15e[_0x70d4('0x14')](_0x25c46c)['send'](_0x5f510d);};}exports[_0x70d4('0x23')]=function(_0x2866e9,_0xac6c52){var _0x3c3f96={},_0x34856e={},_0x2cc500={'count':0x0,'rows':[]};var _0x421e31=_[_0x70d4('0x24')](db[_0x70d4('0x25')]['rawAttributes'],function(_0x1e734f){return{'name':_0x1e734f[_0x70d4('0x26')],'type':_0x1e734f[_0x70d4('0x27')]['key']};});_0x34856e[_0x70d4('0x28')]=_['map'](_0x421e31,_0x70d4('0x22'));_0x34856e['query']=_['keys'](_0x2866e9[_0x70d4('0x29')]);_0x34856e[_0x70d4('0x2a')]=_['intersection'](_0x34856e[_0x70d4('0x28')],_0x34856e[_0x70d4('0x29')]);_0x3c3f96[_0x70d4('0x2b')]=_[_0x70d4('0x2c')](_0x34856e[_0x70d4('0x28')],qs[_0x70d4('0x2d')](_0x2866e9[_0x70d4('0x29')][_0x70d4('0x2d')]));_0x3c3f96[_0x70d4('0x2b')]=_0x3c3f96[_0x70d4('0x2b')][_0x70d4('0x2e')]?_0x3c3f96[_0x70d4('0x2b')]:_0x34856e[_0x70d4('0x28')];if(!_0x2866e9[_0x70d4('0x29')][_0x70d4('0x2f')](_0x70d4('0x30'))){_0x3c3f96[_0x70d4('0x19')]=qs['limit'](_0x2866e9[_0x70d4('0x29')]['limit']);_0x3c3f96[_0x70d4('0x18')]=qs[_0x70d4('0x18')](_0x2866e9[_0x70d4('0x29')][_0x70d4('0x18')]);}_0x3c3f96['order']=qs[_0x70d4('0x31')](_0x2866e9[_0x70d4('0x29')][_0x70d4('0x31')]);_0x3c3f96[_0x70d4('0x32')]=qs[_0x70d4('0x2a')](_['pick'](_0x2866e9['query'],_0x34856e[_0x70d4('0x2a')]),_0x421e31);if(_0x2866e9[_0x70d4('0x29')]['filter']){_0x3c3f96[_0x70d4('0x32')]=_[_0x70d4('0x33')](_0x3c3f96[_0x70d4('0x32')],{'$or':_['map'](_0x421e31,function(_0x58a98b){if(_0x58a98b[_0x70d4('0x27')]!==_0x70d4('0x34')){var _0xfb0043={};_0xfb0043[_0x58a98b[_0x70d4('0x22')]]={'$like':'%'+_0x2866e9[_0x70d4('0x29')][_0x70d4('0x35')]+'%'};return _0xfb0043;}})});}_0x3c3f96=_[_0x70d4('0x33')]({},_0x3c3f96,_0x2866e9[_0x70d4('0x36')]);var _0x6bff61={'where':_0x3c3f96[_0x70d4('0x32')]};return db[_0x70d4('0x25')]['count'](_0x6bff61)[_0x70d4('0x1e')](function(_0x2fc010){_0x2cc500[_0x70d4('0x17')]=_0x2fc010;if(_0x2866e9['query'][_0x70d4('0x37')]){_0x3c3f96[_0x70d4('0x38')]=[{'all':!![]}];}return db[_0x70d4('0x25')][_0x70d4('0x39')](_0x3c3f96);})[_0x70d4('0x1e')](function(_0x3e3215){_0x2cc500[_0x70d4('0x3a')]=_0x3e3215;return _0x2cc500;})[_0x70d4('0x1e')](respondWithFilteredResult(_0xac6c52,_0x3c3f96))[_0x70d4('0x3b')](handleError(_0xac6c52,null));};exports[_0x70d4('0x3c')]=function(_0xaf661d,_0x54d258){var _0x33c563={'raw':!![],'where':{'id':_0xaf661d[_0x70d4('0x3d')]['id']}},_0x453bee={};_0x453bee[_0x70d4('0x28')]=_[_0x70d4('0x3e')](db[_0x70d4('0x25')]['rawAttributes']);_0x453bee[_0x70d4('0x29')]=_[_0x70d4('0x3e')](_0xaf661d[_0x70d4('0x29')]);_0x453bee['filters']=_[_0x70d4('0x2c')](_0x453bee[_0x70d4('0x28')],_0x453bee['query']);_0x33c563[_0x70d4('0x2b')]=_[_0x70d4('0x2c')](_0x453bee['model'],qs['fields'](_0xaf661d[_0x70d4('0x29')][_0x70d4('0x2d')]));_0x33c563[_0x70d4('0x2b')]=_0x33c563['attributes']['length']?_0x33c563[_0x70d4('0x2b')]:_0x453bee[_0x70d4('0x28')];if(_0xaf661d[_0x70d4('0x29')][_0x70d4('0x37')]){_0x33c563['include']=[{'all':!![]}];}_0x33c563=_[_0x70d4('0x33')]({},_0x33c563,_0xaf661d[_0x70d4('0x36')]);return db[_0x70d4('0x25')][_0x70d4('0x3f')](_0x33c563)['then'](handleEntityNotFound(_0x54d258,null))[_0x70d4('0x1e')](respondWithResult(_0x54d258,null))[_0x70d4('0x3b')](handleError(_0x54d258,null));};exports['create']=function(_0x574b4a,_0x43299b){return db[_0x70d4('0x25')]['create'](_0x574b4a[_0x70d4('0x40')],{})['then'](respondWithResult(_0x43299b,0xc9))['catch'](handleError(_0x43299b,null));};exports[_0x70d4('0x41')]=function(_0x5eb136,_0x4fb899){if(_0x5eb136['body']['id']){delete _0x5eb136['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x5eb136['params']['id']}})[_0x70d4('0x1e')](handleEntityNotFound(_0x4fb899,null))[_0x70d4('0x1e')](saveUpdates(_0x5eb136[_0x70d4('0x40')],null))[_0x70d4('0x1e')](respondWithResult(_0x4fb899,null))[_0x70d4('0x3b')](handleError(_0x4fb899,null));};exports['destroy']=function(_0x4fad89,_0x270066){return db['WhatsappTransferReport'][_0x70d4('0x3f')]({'where':{'id':_0x4fad89['params']['id']}})['then'](handleEntityNotFound(_0x270066,null))[_0x70d4('0x1e')](removeEntity(_0x270066,null))[_0x70d4('0x3b')](handleError(_0x270066,null));};exports['describe']=function(_0x48b966,_0x24a971){return db[_0x70d4('0x25')]['describe']()[_0x70d4('0x1e')](respondWithResult(_0x24a971,null))[_0x70d4('0x3b')](handleError(_0x24a971,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index cef3f25..fc2c239 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 _0xbd41=['bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd41,0x11a));var _0x1bd4=function(_0x2bde9f,_0x3ccd1b){_0x2bde9f=_0x2bde9f-0x0;var _0x3e8886=_0xbd41[_0x2bde9f];return _0x3e8886;};'use strict';var _=require(_0x1bd4('0x0'));var util=require(_0x1bd4('0x1'));var logger=require(_0x1bd4('0x2'))('api');var moment=require(_0x1bd4('0x3'));var BPromise=require(_0x1bd4('0x4'));var rp=require(_0x1bd4('0x5'));var fs=require('fs');var path=require(_0x1bd4('0x6'));var rimraf=require(_0x1bd4('0x7'));var config=require('../../config/environment');var attributes=require(_0x1bd4('0x8'));module['exports']=function(_0x201f3f,_0x3aa671){return _0x201f3f[_0x1bd4('0x9')](_0x1bd4('0xa'),attributes,{'tableName':_0x1bd4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1bd4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2bf=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc2bf,0xb4));var _0xfc2b=function(_0x4c878d,_0x3b8ab1){_0x4c878d=_0x4c878d-0x0;var _0x3f51e2=_0xc2bf[_0x4c878d];return _0x3f51e2;};'use strict';var _=require(_0xfc2b('0x0'));var util=require(_0xfc2b('0x1'));var logger=require(_0xfc2b('0x2'))(_0xfc2b('0x3'));var moment=require('moment');var BPromise=require(_0xfc2b('0x4'));var rp=require(_0xfc2b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc2b('0x6'));var config=require(_0xfc2b('0x7'));var attributes=require(_0xfc2b('0x8'));module[_0xfc2b('0x9')]=function(_0x4d423b,_0x2e7d7b){return _0x4d423b[_0xfc2b('0xa')](_0xfc2b('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xfc2b('0xc'),'fields':[_0xfc2b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d350480..b790ea1 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(_0x455e9a,_0x10cbab){var _0x225f61=function(_0xcf69eb){while(--_0xcf69eb){_0x455e9a['push'](_0x455e9a['shift']());}};_0x225f61(++_0x10cbab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x107188,_0x15ac60){var _0x251c9=function(_0x4c182c){while(--_0x4c182c){_0x107188['push'](_0x107188['shift']());}};_0x251c9(++_0x15ac60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e7ee12e..ce6c307 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8710=['sequelize','sync','then','listen','start','info','Online\x20apps:','map','filter','online','name','join','status','None','seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp'];(function(_0x26f09b,_0x187102){var _0x260f76=function(_0x110b7a){while(--_0x110b7a){_0x26f09b['push'](_0x26f09b['shift']());}};_0x260f76(++_0x187102);}(_0x8710,0x68));var _0x0871=function(_0x9ad130,_0x4951f5){_0x9ad130=_0x9ad130-0x0;var _0x1266f3=_0x8710[_0x9ad130];return _0x1266f3;};'use strict';var _=require(_0x0871('0x0'));var mysqldb=require(_0x0871('0x1'));var rpc=require('./rpc');var config=require(_0x0871('0x2'));var logger=require(_0x0871('0x3'))(_0x0871('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x0871('0x5'));var schedule=require(_0x0871('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x0871('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x0871('0x8')][_0x0871('0x9')]()[_0x0871('0xa')](function(){return rpc[_0x0871('0xb')]();})[_0x0871('0xa')](function(_0x3ed8f4){logger['info'](_0x3ed8f4);return chat[_0x0871('0xc')]();})[_0x0871('0xa')](function(){return whatsapp[_0x0871('0xc')]();})[_0x0871('0xa')](function(){return schedule[_0x0871('0xc')]();})['then'](function(){return transcribe[_0x0871('0xc')]();})[_0x0871('0xa')](function(_0x3fb270){logger[_0x0871('0xd')](_0x3fb270);return pm2[_0x0871('0xc')](pm2Config);})['then'](function(_0xd833bd){logger[_0x0871('0xd')](_0x0871('0xe'),_[_0x0871('0xf')](_[_0x0871('0x10')](_0xd833bd,{'status':_0x0871('0x11')}),_0x0871('0x12'))[_0x0871('0x13')]());logger['info']('Offline\x20apps:',_[_0x0871('0xf')](_[_0x0871('0x10')](_0xd833bd,function(_0x14bc80){return _0x14bc80[_0x0871('0x14')]!==_0x0871('0x11');}),_0x0871('0x12'))[_0x0871('0x13')]()||_0x0871('0x15'));config[_0x0871('0x16')]&&require('./config/seedDB')[_0x0871('0x17')]();require('./config/license')[_0x0871('0x17')]();})[_0x0871('0x18')](function(_0x48eb82){logger[_0x0871('0x19')](_0x0871('0x1a'),_0x48eb82);process[_0x0871('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xfd49=['status','online','seedDB','./config/seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sync','then','info','start','Online\x20apps:','map','filter','name','join'];(function(_0x599b66,_0x31d795){var _0x4bf02d=function(_0x46e6f2){while(--_0x46e6f2){_0x599b66['push'](_0x599b66['shift']());}};_0x4bf02d(++_0x31d795);}(_0xfd49,0x121));var _0x9fd4=function(_0xbae42,_0x56a807){_0xbae42=_0xbae42-0x0;var _0x1e681e=_0xfd49[_0xbae42];return _0x1e681e;};'use strict';var _=require(_0x9fd4('0x0'));var mysqldb=require(_0x9fd4('0x1'));var rpc=require(_0x9fd4('0x2'));var config=require(_0x9fd4('0x3'));var logger=require(_0x9fd4('0x4'))('app');var pm2=require(_0x9fd4('0x5'));var pm2Config=require(_0x9fd4('0x6'));var schedule=require(_0x9fd4('0x7'));var chat=require(_0x9fd4('0x8'));var whatsapp=require(_0x9fd4('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x9fd4('0xa')]()['then'](function(){return rpc['listen']();})[_0x9fd4('0xb')](function(_0x5aa18c){logger[_0x9fd4('0xc')](_0x5aa18c);return chat['start']();})[_0x9fd4('0xb')](function(){return whatsapp[_0x9fd4('0xd')]();})['then'](function(){return schedule[_0x9fd4('0xd')]();})[_0x9fd4('0xb')](function(){return transcribe[_0x9fd4('0xd')]();})['then'](function(_0x165ebb){logger[_0x9fd4('0xc')](_0x165ebb);return pm2[_0x9fd4('0xd')](pm2Config);})[_0x9fd4('0xb')](function(_0x35e15a){logger[_0x9fd4('0xc')](_0x9fd4('0xe'),_[_0x9fd4('0xf')](_[_0x9fd4('0x10')](_0x35e15a,{'status':'online'}),_0x9fd4('0x11'))[_0x9fd4('0x12')]());logger[_0x9fd4('0xc')]('Offline\x20apps:',_[_0x9fd4('0xf')](_[_0x9fd4('0x10')](_0x35e15a,function(_0x1a609a){return _0x1a609a[_0x9fd4('0x13')]!==_0x9fd4('0x14');}),'name')['join']()||'None');config[_0x9fd4('0x15')]&&require(_0x9fd4('0x16'))[_0x9fd4('0x17')]();require(_0x9fd4('0x18'))[_0x9fd4('0x17')]();})[_0x9fd4('0x19')](function(_0x33e2f4){logger[_0x9fd4('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x33e2f4);process[_0x9fd4('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9e165e6..5819872 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 _0xa4f4=['name','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','then','sub','Setting','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','add','blockDuration','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','encryptString','join','promisify','sign','secret','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','md5secret','faxPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','status','unmanaged','json','disposition','Unmanaged.','catch','authorization','startsWith','headers','User','find'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa4f4,0x125));var _0x4a4f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xa4f4[_0x1589dd];return _0x1bddd1;};'use strict';var db=require(_0x4a4f('0x0'))['db'];var config=require(_0x4a4f('0x1'));var hardwareConf=require(_0x4a4f('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x4a4f('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x4a4f('0x4'));var compose=require(_0x4a4f('0x5'));var basicAuth=require(_0x4a4f('0x6'));var crypto=require('crypto');var BPromise=require(_0x4a4f('0x7'));var util=require(_0x4a4f('0x8'));var moment=require(_0x4a4f('0x9'));var validateJwt=expressJwt({'secret':config[_0x4a4f('0xa')][_0x4a4f('0xb')]});var userAttributes=['id',_0x4a4f('0xc'),_0x4a4f('0xd'),'name',_0x4a4f('0xe'),_0x4a4f('0xf'),'userpic','permissions',_0x4a4f('0x10'),'voicePause','chatPause','mailPause',_0x4a4f('0x11'),'smsPause','openchannelPause','pauseType',_0x4a4f('0x12'),'lastLoginAt',_0x4a4f('0x13'),_0x4a4f('0x14'),_0x4a4f('0x15'),'passwordResetAt',_0x4a4f('0x16'),_0x4a4f('0x17'),_0x4a4f('0x18'),_0x4a4f('0x19'),_0x4a4f('0x1a'),_0x4a4f('0x1b'),_0x4a4f('0x1c'),_0x4a4f('0x1d'),_0x4a4f('0x1e'),_0x4a4f('0x1f'),_0x4a4f('0x20'),_0x4a4f('0x21'),'interface',_0x4a4f('0x22'),_0x4a4f('0x23')];exports[_0x4a4f('0x24')]=function(){return this[_0x4a4f('0x25')](!![])[_0x4a4f('0x26')](function(_0x6b7278,_0x53d0b7,_0x1c3e2c){if(_0x6b7278[_0x4a4f('0x27')]){_0x1c3e2c();}else{return db[_0x4a4f('0x28')][_0x4a4f('0x29')]({'where':{'id':_0x6b7278[_0x4a4f('0x2a')]['id']},'attributes':['id',_0x4a4f('0x2b'),'disposition'],'raw':!![]})['then'](function(_0x3a4af7){if(_0x3a4af7&&_0x3a4af7[_0x4a4f('0x2b')]){return _0x53d0b7[_0x4a4f('0x2c')](_0x3a4af7['disposition']===_0x4a4f('0x2d')?0x195:0x193)[_0x4a4f('0x2e')]({'message':_0x3a4af7[_0x4a4f('0x2f')]===_0x4a4f('0x2d')?_0x4a4f('0x30'):'Forbidden.'});}else{_0x1c3e2c();}})[_0x4a4f('0x31')](function(_0x42ff78){_0x1c3e2c(_0x42ff78);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4f0ca4){return compose()['use'](function(_0xcde621,_0x2e97bb,_0x3f878e){var _0x19ae10;if(_0xcde621['headers'][_0x4a4f('0x32')]){if(_[_0x4a4f('0x33')](_0xcde621[_0x4a4f('0x34')][_0x4a4f('0x32')],'Basic')){var _0x48cfef=basicAuth(_0xcde621);db[_0x4a4f('0x35')][_0x4a4f('0x36')]({'where':{'name':_0x48cfef[_0x4a4f('0x37')]}})['then'](function(_0x3d1936){if(!_0x3d1936||!_0x3d1936[_0x4a4f('0x38')](_0x48cfef['pass'])){return _0x2e97bb[_0x4a4f('0x2c')](0x191)['json']({'message':_0x4a4f('0x39')});}_0xcde621[_0x4a4f('0x27')]={'id':_0x3d1936['id']};_0x3f878e();})['catch'](function(_0x2d8638){_0x3f878e(_0x2d8638);});}else if(_[_0x4a4f('0x33')](_0xcde621[_0x4a4f('0x34')][_0x4a4f('0x32')],_0x4a4f('0x3a'))){validateJwt(_0xcde621,_0x2e97bb,_0x3f878e);}else{if(_0x4f0ca4){_0x3f878e();}else{return _0x2e97bb['status'](0x193)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x3b')});}}}else if(_0xcde621[_0x4a4f('0x3c')][_0x4a4f('0x3d')]){try{var _0x1ead67={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x4a4f('0x3e')]()};verifyJwt(_0xcde621[_0x4a4f('0x3c')][_0x4a4f('0x3d')],_0x1ead67)[_0x4a4f('0x3f')](function(_0x1e08a9){return db[_0x4a4f('0x35')][_0x4a4f('0x36')]({'where':{'id':_0x1e08a9[_0x4a4f('0x40')]}})[_0x4a4f('0x3f')](function(_0x41319c){_0x19ae10=_0x41319c;return db[_0x4a4f('0x41')][_0x4a4f('0x29')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x4a4f('0x3f')](function(_0x14b956){if(!_0x19ae10||!_[_0x4a4f('0x42')](_0x19ae10[_0x4a4f('0x43')],_0x1e08a9[_0x4a4f('0x44')])){return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x19ae10['disabled']){return _0x2e97bb[_0x4a4f('0x2c')](0x191)['json']({'message':_0x4a4f('0x45')});}if(_0x19ae10[_0x4a4f('0x46')]){if(_0x14b956['blockDuration']>0x0){if(moment(_0x19ae10['blockedAt'])[_0x4a4f('0x47')](_0x14b956[_0x4a4f('0x48')],_0x4a4f('0x49'))>moment()){return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x45')});}}_0xcde621[_0x4a4f('0x27')]={'id':_0x19ae10['id']};_0x3f878e();});})['catch'](function(){return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x45')});});}catch(_0x4b64c9){_0x3f878e(_0x4b64c9);}}else if(_0x4f0ca4){_0x3f878e();}else{return _0x2e97bb[_0x4a4f('0x2c')](0x193)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x3b')});}})[_0x4a4f('0x26')](function(_0x1c91b5,_0x3d4aa7,_0x379bad){if(_0x1c91b5[_0x4a4f('0x27')]){db[_0x4a4f('0x35')][_0x4a4f('0x36')]({'where':{'id':_0x1c91b5[_0x4a4f('0x27')]['id']},'attributes':userAttributes})[_0x4a4f('0x3f')](function(_0x85c5fe){if(!_0x85c5fe){return _0x3d4aa7[_0x4a4f('0x2c')](0x194)[_0x4a4f('0x2e')]({'message':'User\x20not\x20found.'});}_0x1c91b5['user']=_0x85c5fe;_0x379bad();})[_0x4a4f('0x31')](function(_0x55eefb){_0x379bad(_0x55eefb);});}else if(_0x4f0ca4){_0x379bad();}else{return _0x3d4aa7['status'](0x194)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x4a')});}});};exports[_0x4a4f('0x4b')]=function canUpdate(){return compose()['use'](function(_0x4eed64,_0x242a48,_0x3a7870){return licenseUtil[_0x4a4f('0x4c')]()[_0x4a4f('0x3f')](function(_0x5b61a2){if(_0x5b61a2[_0x4a4f('0x4d')]){_0x3a7870();}else{return _0x242a48[_0x4a4f('0x2c')](0x193)['json']({'message':_0x4a4f('0x4e')});}})[_0x4a4f('0x31')](function(_0x5cedd1){_0x3a7870(_0x5cedd1);});});};exports[_0x4a4f('0x4f')]=function(_0x1a624d,_0x23f3ae,_0x38a4a7){_0x1a624d[_0x4a4f('0x4f')]=!![];return _0x38a4a7();};exports[_0x4a4f('0x50')]=function signToken(_0x60781a){return signJwt(_0x60781a);};exports['setTokenCookie']=function(_0x4f44a3,_0x323c33){if(!_0x4f44a3[_0x4a4f('0x27')]){return _0x323c33[_0x4a4f('0x2c')](0x194)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x51')});}var _0xef04ed={'payload':{'id':_0x4f44a3[_0x4a4f('0x27')]['id'],'role':_0x4f44a3[_0x4a4f('0x27')][_0x4a4f('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0xef04ed)[_0x4a4f('0x3f')](function(_0x6d1738){_0x323c33[_0x4a4f('0x52')](_0x4a4f('0x53'),_0x6d1738);_0x323c33[_0x4a4f('0x54')](_0x4a4f('0x55'));})[_0x4a4f('0x31')](function(_0x250c46){return _0x323c33['status'](0x1f4)[_0x4a4f('0x56')](_0x250c46);});};exports[_0x4a4f('0x57')]=function(_0x1bf144){if(_[_0x4a4f('0x58')](_0x1bf144[_0x4a4f('0x43')])||_[_0x4a4f('0x58')](_0x1bf144[_0x4a4f('0x59')])){return null;}else{return createJwt(_0x1bf144);}};exports[_0x4a4f('0x5a')]=function(_0x192d77){_0x192d77['apiKeyNonce']=generateNonce();_0x192d77[_0x4a4f('0x59')]=generateIssuedAt();return createJwt(_0x192d77);};exports[_0x4a4f('0x5b')]=function(_0x2fdc64,_0x4d356c){var _0x471fa1=_0x2fdc64['query'][_0x4a4f('0x3d')];if(_0x471fa1){var _0x3af7e9={'nonce':_0x4d356c['apiKeyNonce'],'iat':_0x4d356c[_0x4a4f('0x59')],'audience':hardwareConf[_0x4a4f('0x3e')](),'issuer':hardwareConf[_0x4a4f('0x3e')]()};return verifyJwt(_0x471fa1,_0x3af7e9)[_0x4a4f('0x3f')](function(){return generateApiKey(_0x4d356c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0xbac45a){var _0x53ac9d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x53ac9d['test'](_0xbac45a))throw new db['Sequelize']['ValidationError'](_0x4a4f('0x5c'));return;};exports[_0x4a4f('0x5d')]=function(_0x438d60,_0x4763e0,_0x4172fe){var _0x60e0bc=encryptor[_0x4a4f('0x5e')](_0x4763e0)['split'](',');for(var _0x356e74=0x0;_0x356e74<_0x4172fe;_0x356e74++){if(!_0x60e0bc[_0x356e74])break;if(_0x438d60[_0x4a4f('0x5f')]()===_0x60e0bc[_0x356e74]['toLowerCase']()){var _0x1a2fe9=util['format'](_0x4a4f('0x60'),_0x4172fe);if(_0x4172fe===0x1){_0x1a2fe9=_0x4a4f('0x61');}throw new db[(_0x4a4f('0x62'))][(_0x4a4f('0x63'))](_0x1a2fe9);}}return;};exports[_0x4a4f('0x64')]=function(_0x5a24fb,_0x4b31f2){var _0x17eef2=_0x4b31f2?encryptor[_0x4a4f('0x5e')](_0x4b31f2)['split'](','):[];if(_0x17eef2[_0x4a4f('0x65')]===0x5){_0x17eef2[_0x4a4f('0x66')](-0x1,0x1);}_0x17eef2['unshift'](_0x5a24fb);return encryptor[_0x4a4f('0x67')](_0x17eef2[_0x4a4f('0x68')](','));};function signJwt(_0xc7bc78){var _0x5e762d=BPromise[_0x4a4f('0x69')](jwt[_0x4a4f('0x6a')],{'context':jwt});var _0x1d786c=_0xc7bc78[_0x4a4f('0x6b')]||config['secrets'][_0x4a4f('0xb')];return new BPromise(function(_0x2f7f88,_0x30ada6){_0x5e762d(_0xc7bc78[_0x4a4f('0x6c')],_0x1d786c,_0xc7bc78['options'])[_0x4a4f('0x3f')](function(_0x1adf04){_0x2f7f88(_0x1adf04);})[_0x4a4f('0x31')](function(_0x44ad19){_0x30ada6(_0x44ad19);});});}function verifyJwt(_0x1bd4dc,_0x3c7dd8,_0x1ae3a9){var _0x3c78e8=BPromise[_0x4a4f('0x69')](jwt[_0x4a4f('0x6d')],{'context':jwt});var _0x4fec17=_0x1ae3a9||config[_0x4a4f('0xa')][_0x4a4f('0xb')];return new BPromise(function(_0x269902,_0x2ea52b){_0x3c78e8(_0x1bd4dc,_0x4fec17,_0x3c7dd8)[_0x4a4f('0x3f')](function(_0x1729c1){_0x269902(_0x1729c1);})[_0x4a4f('0x31')](function(_0x49d994){_0x2ea52b(_0x49d994);});});}function generateNonce(){return crypto[_0x4a4f('0x6e')](0x10)[_0x4a4f('0x6f')](_0x4a4f('0x70'));}function generateIssuedAt(){return Math[_0x4a4f('0x71')](Date[_0x4a4f('0x72')]()/0x3e8)[_0x4a4f('0x6f')]();}function createJwt(_0x2885f9){var _0x15c8b1={'payload':{'iat':_0x2885f9['apiKeyIat'],'nonce':_0x2885f9[_0x4a4f('0x43')]},'options':{'algorithm':_0x4a4f('0x73'),'subject':_0x2885f9['id'][_0x4a4f('0x6f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x4a4f('0x3e')]()}};return signJwt(_0x15c8b1)[_0x4a4f('0x3f')](function(_0x131843){return{'iat':_0x2885f9[_0x4a4f('0x59')],'nonce':_0x2885f9[_0x4a4f('0x43')],'token':_0x131843};});} \ No newline at end of file +var _0x8e9d=['authenticate','pass','Unknown\x20authorization\x20format','query','getUuid','User','sub','Setting','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','unshift','encryptString','join','promisify','options','verify','secrets','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird','util','session','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','user','findOne','params','disposition','then','closed','status','unmanaged','json','Forbidden.','catch','isAuthenticated','use','startsWith','headers','authorization','Basic','find'];(function(_0x3ffc40,_0xe319f0){var _0x575992=function(_0x5d43a1){while(--_0x5d43a1){_0x3ffc40['push'](_0x3ffc40['shift']());}};_0x575992(++_0xe319f0);}(_0x8e9d,0x123));var _0xd8e9=function(_0x2c293a,_0x305cc3){_0x2c293a=_0x2c293a-0x0;var _0x131bf8=_0x8e9d[_0x2c293a];return _0x131bf8;};'use strict';var db=require(_0xd8e9('0x0'))['db'];var config=require(_0xd8e9('0x1'));var hardwareConf=require(_0xd8e9('0x2'));var licenseUtil=require(_0xd8e9('0x3'));var encryptor=require(_0xd8e9('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xd8e9('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xd8e9('0x6'));var crypto=require(_0xd8e9('0x7'));var BPromise=require(_0xd8e9('0x8'));var util=require(_0xd8e9('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0xd8e9('0xa')]});var userAttributes=['id','role','fullname',_0xd8e9('0xb'),_0xd8e9('0xc'),_0xd8e9('0xd'),_0xd8e9('0xe'),_0xd8e9('0xf'),'md5secret',_0xd8e9('0x10'),_0xd8e9('0x11'),_0xd8e9('0x12'),_0xd8e9('0x13'),_0xd8e9('0x14'),'openchannelPause','pauseType',_0xd8e9('0x15'),_0xd8e9('0x16'),_0xd8e9('0x17'),'crudPermissions',_0xd8e9('0x18'),'passwordResetAt',_0xd8e9('0x19'),_0xd8e9('0x1a'),'phoneBarAutoAnswerDelay',_0xd8e9('0x1b'),_0xd8e9('0x1c'),_0xd8e9('0x1d'),_0xd8e9('0x1e'),_0xd8e9('0x1f'),_0xd8e9('0x20'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0xd8e9('0x21'),_0xd8e9('0x22'),_0xd8e9('0x23'),'settingsEnabled'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x593f51,_0x4fd02e,_0x4b0e5e){if(_0x593f51[_0xd8e9('0x24')]){_0x4b0e5e();}else{return db['ChatInteraction'][_0xd8e9('0x25')]({'where':{'id':_0x593f51[_0xd8e9('0x26')]['id']},'attributes':['id','closed',_0xd8e9('0x27')],'raw':!![]})[_0xd8e9('0x28')](function(_0x4ab95c){if(_0x4ab95c&&_0x4ab95c[_0xd8e9('0x29')]){return _0x4fd02e[_0xd8e9('0x2a')](_0x4ab95c[_0xd8e9('0x27')]===_0xd8e9('0x2b')?0x195:0x193)[_0xd8e9('0x2c')]({'message':_0x4ab95c[_0xd8e9('0x27')]===_0xd8e9('0x2b')?'Unmanaged.':_0xd8e9('0x2d')});}else{_0x4b0e5e();}})[_0xd8e9('0x2e')](function(_0x3a40c7){_0x4b0e5e(_0x3a40c7);});}});};exports[_0xd8e9('0x2f')]=function isAuthenticated(_0x1a44a9){return compose()[_0xd8e9('0x30')](function(_0x1f1a67,_0x203d30,_0xbfb79e){var _0x510a5f;if(_0x1f1a67['headers']['authorization']){if(_[_0xd8e9('0x31')](_0x1f1a67[_0xd8e9('0x32')][_0xd8e9('0x33')],_0xd8e9('0x34'))){var _0x2e986a=basicAuth(_0x1f1a67);db['User'][_0xd8e9('0x35')]({'where':{'name':_0x2e986a['name']}})['then'](function(_0x413093){if(!_0x413093||!_0x413093[_0xd8e9('0x36')](_0x2e986a[_0xd8e9('0x37')])){return _0x203d30['status'](0x191)[_0xd8e9('0x2c')]({'message':'Wrong\x20credentials.'});}_0x1f1a67['user']={'id':_0x413093['id']};_0xbfb79e();})[_0xd8e9('0x2e')](function(_0x9d8ae){_0xbfb79e(_0x9d8ae);});}else if(_[_0xd8e9('0x31')](_0x1f1a67['headers'][_0xd8e9('0x33')],'Bearer')){validateJwt(_0x1f1a67,_0x203d30,_0xbfb79e);}else{if(_0x1a44a9){_0xbfb79e();}else{return _0x203d30[_0xd8e9('0x2a')](0x193)['json']({'message':_0xd8e9('0x38')});}}}else if(_0x1f1a67[_0xd8e9('0x39')]['apikey']){try{var _0x4942a1={'audience':hardwareConf[_0xd8e9('0x3a')](),'issuer':hardwareConf[_0xd8e9('0x3a')]()};verifyJwt(_0x1f1a67['query']['apikey'],_0x4942a1)[_0xd8e9('0x28')](function(_0x3fd380){return db[_0xd8e9('0x3b')][_0xd8e9('0x35')]({'where':{'id':_0x3fd380[_0xd8e9('0x3c')]}})['then'](function(_0x38a403){_0x510a5f=_0x38a403;return db[_0xd8e9('0x3d')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd8e9('0x3e')],'raw':!![]});})[_0xd8e9('0x28')](function(_0x5e31f2){if(!_0x510a5f||!_[_0xd8e9('0x3f')](_0x510a5f['apiKeyNonce'],_0x3fd380[_0xd8e9('0x40')])){return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x41')});}if(_0x510a5f[_0xd8e9('0x42')]){return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x43')});}if(_0x510a5f[_0xd8e9('0x44')]){if(_0x5e31f2[_0xd8e9('0x3e')]>0x0){if(moment(_0x510a5f[_0xd8e9('0x45')])[_0xd8e9('0x46')](_0x5e31f2[_0xd8e9('0x3e')],_0xd8e9('0x47'))>moment()){return _0x203d30['status'](0x191)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x43')});}}else{return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1f1a67['user']={'id':_0x510a5f['id']};_0xbfb79e();});})[_0xd8e9('0x2e')](function(){return _0x203d30[_0xd8e9('0x2a')](0x191)[_0xd8e9('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x23364e){_0xbfb79e(_0x23364e);}}else if(_0x1a44a9){_0xbfb79e();}else{return _0x203d30['status'](0x193)['json']({'message':_0xd8e9('0x38')});}})['use'](function(_0x41c548,_0x1b3449,_0x18dfec){if(_0x41c548[_0xd8e9('0x24')]){db[_0xd8e9('0x3b')][_0xd8e9('0x35')]({'where':{'id':_0x41c548[_0xd8e9('0x24')]['id']},'attributes':userAttributes})[_0xd8e9('0x28')](function(_0x3a22bf){if(!_0x3a22bf){return _0x1b3449['status'](0x194)['json']({'message':'User\x20not\x20found.'});}_0x41c548['user']=_0x3a22bf;_0x18dfec();})[_0xd8e9('0x2e')](function(_0x1aa240){_0x18dfec(_0x1aa240);});}else if(_0x1a44a9){_0x18dfec();}else{return _0x1b3449[_0xd8e9('0x2a')](0x194)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x48')});}});};exports[_0xd8e9('0x49')]=function canUpdate(){return compose()[_0xd8e9('0x30')](function(_0x223264,_0x52084c,_0x5aae5b){return licenseUtil[_0xd8e9('0x4a')]()[_0xd8e9('0x28')](function(_0xb91cbf){if(_0xb91cbf[_0xd8e9('0x4b')]){_0x5aae5b();}else{return _0x52084c[_0xd8e9('0x2a')](0x193)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x4c')});}})['catch'](function(_0x3ddb86){_0x5aae5b(_0x3ddb86);});});};exports[_0xd8e9('0x4d')]=function(_0x3e1109,_0x38cf30,_0xc708dd){_0x3e1109[_0xd8e9('0x4d')]=!![];return _0xc708dd();};exports[_0xd8e9('0x4e')]=function signToken(_0x2be491){return signJwt(_0x2be491);};exports[_0xd8e9('0x4f')]=function(_0x54a860,_0x12939a){if(!_0x54a860['user']){return _0x12939a['status'](0x194)[_0xd8e9('0x2c')]({'message':_0xd8e9('0x50')});}var _0x19f43f={'payload':{'id':_0x54a860[_0xd8e9('0x24')]['id'],'role':_0x54a860['user'][_0xd8e9('0x51')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19f43f)[_0xd8e9('0x28')](function(_0x16afe2){_0x12939a[_0xd8e9('0x52')]('motion.token',_0x16afe2);_0x12939a[_0xd8e9('0x53')](_0xd8e9('0x54'));})['catch'](function(_0x1226ef){return _0x12939a['status'](0x1f4)[_0xd8e9('0x55')](_0x1226ef);});};exports['retrieveApiKey']=function(_0xdd0109){if(_[_0xd8e9('0x56')](_0xdd0109[_0xd8e9('0x57')])||_[_0xd8e9('0x56')](_0xdd0109[_0xd8e9('0x58')])){return null;}else{return createJwt(_0xdd0109);}};exports[_0xd8e9('0x59')]=function(_0x2e46ad){_0x2e46ad[_0xd8e9('0x57')]=generateNonce();_0x2e46ad[_0xd8e9('0x58')]=generateIssuedAt();return createJwt(_0x2e46ad);};exports[_0xd8e9('0x5a')]=function(_0x405a7d,_0x2696b5){var _0x482c15=_0x405a7d[_0xd8e9('0x39')][_0xd8e9('0x5b')];if(_0x482c15){var _0x195932={'nonce':_0x2696b5[_0xd8e9('0x57')],'iat':_0x2696b5['apiKeyIat'],'audience':hardwareConf[_0xd8e9('0x3a')](),'issuer':hardwareConf[_0xd8e9('0x3a')]()};return verifyJwt(_0x482c15,_0x195932)[_0xd8e9('0x28')](function(){return generateApiKey(_0x2696b5);});}else{throw{'message':_0xd8e9('0x5c')};}};exports[_0xd8e9('0x5d')]=function(_0x2ace89){var _0x3bcb95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3bcb95[_0xd8e9('0x5e')](_0x2ace89))throw new db[(_0xd8e9('0x5f'))][(_0xd8e9('0x60'))](_0xd8e9('0x61'));return;};exports['validatePasswordHistory']=function(_0x8d86f8,_0x11b061,_0x10cdab){var _0x13a145=encryptor['decryptString'](_0x11b061)['split'](',');for(var _0x5c11e7=0x0;_0x5c11e7<_0x10cdab;_0x5c11e7++){if(!_0x13a145[_0x5c11e7])break;if(_0x8d86f8[_0xd8e9('0x62')]()===_0x13a145[_0x5c11e7][_0xd8e9('0x62')]()){var _0x492643=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x10cdab);if(_0x10cdab===0x1){_0x492643=_0xd8e9('0x63');}throw new db[(_0xd8e9('0x5f'))]['ValidationError'](_0x492643);}}return;};exports[_0xd8e9('0x64')]=function(_0x4e529d,_0x28fefe){var _0x22c72f=_0x28fefe?encryptor[_0xd8e9('0x65')](_0x28fefe)['split'](','):[];if(_0x22c72f['length']===0x5){_0x22c72f['splice'](-0x1,0x1);}_0x22c72f[_0xd8e9('0x66')](_0x4e529d);return encryptor[_0xd8e9('0x67')](_0x22c72f[_0xd8e9('0x68')](','));};function signJwt(_0x3b420b){var _0xabf1a=BPromise[_0xd8e9('0x69')](jwt['sign'],{'context':jwt});var _0x4b9b61=_0x3b420b['secret']||config['secrets'][_0xd8e9('0xa')];return new BPromise(function(_0x197e60,_0x11bc6a){_0xabf1a(_0x3b420b['payload'],_0x4b9b61,_0x3b420b[_0xd8e9('0x6a')])['then'](function(_0x3b2df9){_0x197e60(_0x3b2df9);})[_0xd8e9('0x2e')](function(_0x1359e1){_0x11bc6a(_0x1359e1);});});}function verifyJwt(_0x338ca3,_0x26e8a9,_0x5b3465){var _0xc41fb8=BPromise['promisify'](jwt[_0xd8e9('0x6b')],{'context':jwt});var _0x495e91=_0x5b3465||config[_0xd8e9('0x6c')][_0xd8e9('0xa')];return new BPromise(function(_0x48345c,_0x28dc5b){_0xc41fb8(_0x338ca3,_0x495e91,_0x26e8a9)[_0xd8e9('0x28')](function(_0xdf33d0){_0x48345c(_0xdf33d0);})[_0xd8e9('0x2e')](function(_0x17b376){_0x28dc5b(_0x17b376);});});}function generateNonce(){return crypto[_0xd8e9('0x6d')](0x10)[_0xd8e9('0x6e')](_0xd8e9('0x6f'));}function generateIssuedAt(){return Math[_0xd8e9('0x70')](Date[_0xd8e9('0x71')]()/0x3e8)['toString']();}function createJwt(_0xbb22c2){var _0x49caed={'payload':{'iat':_0xbb22c2[_0xd8e9('0x58')],'nonce':_0xbb22c2[_0xd8e9('0x57')]},'options':{'algorithm':_0xd8e9('0x72'),'subject':_0xbb22c2['id'][_0xd8e9('0x6e')](),'issuer':hardwareConf[_0xd8e9('0x3a')](),'audience':hardwareConf[_0xd8e9('0x3a')]()}};return signJwt(_0x49caed)[_0xd8e9('0x28')](function(_0x5b1c4e){return{'iat':_0xbb22c2['apiKeyIat'],'nonce':_0xbb22c2['apiKeyNonce'],'token':_0x5b1c4e};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index fbcf8e1..2f18129 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 _0xc7a3=['update','binary','write','end','final','unlink','createReadStream','createDecipher','encryptString','algorithm','secret','utf8','base64','decryptString','bluebird','../../config/environment','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','data'];(function(_0x32be62,_0x22e6fd){var _0x1a37e9=function(_0x35a9c1){while(--_0x35a9c1){_0x32be62['push'](_0x32be62['shift']());}};_0x1a37e9(++_0x22e6fd);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x20d211,_0x4718a5){_0x20d211=_0x20d211-0x0;var _0x350582=_0xc7a3[_0x20d211];return _0x350582;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x3c7a('0x0'));var config=require(_0x3c7a('0x1'));const stringOptions={'secret':config[_0x3c7a('0x2')][_0x3c7a('0x3')],'algorithm':_0x3c7a('0x4')};const fileOptions={'algorithm':_0x3c7a('0x5')};function combineOptions(_0x4e0aaa){var _0x44fd47={};for(var _0x3e1c47 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3e1c47)){_0x44fd47[_0x3e1c47]=fileOptions[_0x3e1c47];}}if(_0x4e0aaa){for(var _0x9c6b1a in _0x4e0aaa){if(_0x4e0aaa[_0x3c7a('0x6')](_0x9c6b1a)){_0x44fd47[_0x9c6b1a]=_0x4e0aaa[_0x9c6b1a];}}}return _0x44fd47;}exports[_0x3c7a('0x7')]=function(_0x48e820,_0x115c8a,_0x4f0608,_0x20d36c){return new BPromise(function(_0x5a6fbf,_0xf7733d){_0x20d36c=combineOptions(_0x20d36c);var _0x3120d8=new Buffer(_0x4f0608);var _0x132476=fs['createReadStream'](_0x48e820);var _0x32633f=fs[_0x3c7a('0x8')](_0x115c8a);var _0x590cb9=crypto[_0x3c7a('0x9')](_0x20d36c['algorithm'],_0x3120d8);_0x132476['on'](_0x3c7a('0xa'),function(_0x4e5413){var _0xfd069f=new Buffer(_0x590cb9[_0x3c7a('0xb')](_0x4e5413),_0x3c7a('0xc'));_0x32633f[_0x3c7a('0xd')](_0xfd069f);});_0x132476['on'](_0x3c7a('0xe'),function(){try{var _0x53e5d7=new Buffer(_0x590cb9[_0x3c7a('0xf')](_0x3c7a('0xc')),_0x3c7a('0xc'));_0x32633f[_0x3c7a('0xd')](_0x53e5d7);_0x32633f[_0x3c7a('0xe')]();_0x32633f['on']('close',function(){return _0x5a6fbf(_0x115c8a);});}catch(_0x3e219a){fs[_0x3c7a('0x10')](_0x115c8a);return _0xf7733d(_0x3e219a);}});});};exports['decryptFile']=function(_0x539270,_0x3044e6,_0xb9201c,_0x687077){return new BPromise(function(_0x4d7a8c,_0x1bae30){_0x687077=combineOptions(_0x687077);var _0x513df6=new Buffer(_0xb9201c);var _0x74fd1e=fs[_0x3c7a('0x11')](_0x539270);var _0x36e8c2=fs[_0x3c7a('0x8')](_0x3044e6);var _0x3cb5bf=crypto[_0x3c7a('0x12')](_0x687077['algorithm'],_0x513df6);_0x74fd1e['on'](_0x3c7a('0xa'),function(_0x2db9df){var _0x3f0024=new Buffer(_0x3cb5bf[_0x3c7a('0xb')](_0x2db9df),_0x3c7a('0xc'));_0x36e8c2[_0x3c7a('0xd')](_0x3f0024);});_0x74fd1e['on'](_0x3c7a('0xe'),function(){try{var _0x34f4a6=new Buffer(_0x3cb5bf[_0x3c7a('0xf')]('binary'),_0x3c7a('0xc'));_0x36e8c2['write'](_0x34f4a6);_0x36e8c2[_0x3c7a('0xe')]();_0x36e8c2['on']('close',function(){return _0x4d7a8c(_0x3044e6);});}catch(_0x40d24e){fs[_0x3c7a('0x10')](_0x3044e6);return _0x1bae30(_0x40d24e);}});});};exports[_0x3c7a('0x13')]=function(_0x7dbe38,_0x283568,_0x245dde){var _0x8251d4=_0x245dde||stringOptions[_0x3c7a('0x14')];var _0x193d48=_0x283568||stringOptions[_0x3c7a('0x15')];var _0x2cc413=crypto[_0x3c7a('0x9')](_0x8251d4,_0x193d48);var _0x56539f=_0x2cc413[_0x3c7a('0xb')](_0x7dbe38,_0x3c7a('0x16'),_0x3c7a('0x17'));_0x56539f+=_0x2cc413[_0x3c7a('0xf')](_0x3c7a('0x17'));return _0x56539f;};exports[_0x3c7a('0x18')]=function(_0x2c000f,_0x8f084b,_0x5bbcde){var _0x33b72d=_0x5bbcde||stringOptions[_0x3c7a('0x14')];var _0x1d2b92=_0x8f084b||stringOptions[_0x3c7a('0x15')];var _0x33065b=crypto[_0x3c7a('0x12')](_0x33b72d,_0x1d2b92);var _0xccf304=_0x33065b[_0x3c7a('0xb')](_0x2c000f,_0x3c7a('0x17'),_0x3c7a('0x16'));_0xccf304+=_0x33065b[_0x3c7a('0xf')](_0x3c7a('0x16'));return _0xccf304;}; \ No newline at end of file +var _0xf494=['final','end','close','unlink','decryptFile','data','update','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','binary','write'];(function(_0x2ace72,_0x814809){var _0x33d102=function(_0x505fd1){while(--_0x505fd1){_0x2ace72['push'](_0x2ace72['shift']());}};_0x33d102(++_0x814809);}(_0xf494,0x1c6));var _0x4f49=function(_0x67c05b,_0x366c79){_0x67c05b=_0x67c05b-0x0;var _0x252a3c=_0xf494[_0x67c05b];return _0x252a3c;};'use strict';var crypto=require(_0x4f49('0x0'));var fs=require('fs');var BPromise=require(_0x4f49('0x1'));var config=require(_0x4f49('0x2'));const stringOptions={'secret':config['secrets'][_0x4f49('0x3')],'algorithm':_0x4f49('0x4')};const fileOptions={'algorithm':_0x4f49('0x5')};function combineOptions(_0x25677c){var _0x20c0d7={};for(var _0x2a15fb in fileOptions){if(fileOptions[_0x4f49('0x6')](_0x2a15fb)){_0x20c0d7[_0x2a15fb]=fileOptions[_0x2a15fb];}}if(_0x25677c){for(var _0x790e8b in _0x25677c){if(_0x25677c[_0x4f49('0x6')](_0x790e8b)){_0x20c0d7[_0x790e8b]=_0x25677c[_0x790e8b];}}}return _0x20c0d7;}exports[_0x4f49('0x7')]=function(_0x42b0e8,_0x5eb186,_0x58e9a0,_0x169c95){return new BPromise(function(_0x327bd5,_0x31a725){_0x169c95=combineOptions(_0x169c95);var _0x30ca57=new Buffer(_0x58e9a0);var _0x185174=fs[_0x4f49('0x8')](_0x42b0e8);var _0x151d8c=fs[_0x4f49('0x9')](_0x5eb186);var _0x53ee74=crypto[_0x4f49('0xa')](_0x169c95[_0x4f49('0xb')],_0x30ca57);_0x185174['on']('data',function(_0x15e7a1){var _0x5bbc75=new Buffer(_0x53ee74['update'](_0x15e7a1),_0x4f49('0xc'));_0x151d8c[_0x4f49('0xd')](_0x5bbc75);});_0x185174['on']('end',function(){try{var _0x1e1c37=new Buffer(_0x53ee74[_0x4f49('0xe')](_0x4f49('0xc')),_0x4f49('0xc'));_0x151d8c[_0x4f49('0xd')](_0x1e1c37);_0x151d8c[_0x4f49('0xf')]();_0x151d8c['on'](_0x4f49('0x10'),function(){return _0x327bd5(_0x5eb186);});}catch(_0x5c373e){fs[_0x4f49('0x11')](_0x5eb186);return _0x31a725(_0x5c373e);}});});};exports[_0x4f49('0x12')]=function(_0x415e83,_0x5878f4,_0x5bdfaf,_0x2f0a0d){return new BPromise(function(_0x2ecaaa,_0x74886e){_0x2f0a0d=combineOptions(_0x2f0a0d);var _0x5cb79c=new Buffer(_0x5bdfaf);var _0x1dccfd=fs[_0x4f49('0x8')](_0x415e83);var _0x4e85df=fs['createWriteStream'](_0x5878f4);var _0x5bb23b=crypto['createDecipher'](_0x2f0a0d['algorithm'],_0x5cb79c);_0x1dccfd['on'](_0x4f49('0x13'),function(_0x1834f4){var _0x1c2d70=new Buffer(_0x5bb23b[_0x4f49('0x14')](_0x1834f4),'binary');_0x4e85df[_0x4f49('0xd')](_0x1c2d70);});_0x1dccfd['on'](_0x4f49('0xf'),function(){try{var _0x197a49=new Buffer(_0x5bb23b[_0x4f49('0xe')](_0x4f49('0xc')),'binary');_0x4e85df[_0x4f49('0xd')](_0x197a49);_0x4e85df[_0x4f49('0xf')]();_0x4e85df['on'](_0x4f49('0x10'),function(){return _0x2ecaaa(_0x5878f4);});}catch(_0x53b57d){fs[_0x4f49('0x11')](_0x5878f4);return _0x74886e(_0x53b57d);}});});};exports[_0x4f49('0x15')]=function(_0x32ca7b,_0x43c458,_0x9d30aa){var _0x36187b=_0x9d30aa||stringOptions['algorithm'];var _0x4e9041=_0x43c458||stringOptions[_0x4f49('0x16')];var _0x429de7=crypto['createCipher'](_0x36187b,_0x4e9041);var _0x408552=_0x429de7[_0x4f49('0x14')](_0x32ca7b,_0x4f49('0x17'),'base64');_0x408552+=_0x429de7[_0x4f49('0xe')](_0x4f49('0x18'));return _0x408552;};exports[_0x4f49('0x19')]=function(_0x148153,_0xfefbab,_0x122404){var _0x4915af=_0x122404||stringOptions['algorithm'];var _0x239f44=_0xfefbab||stringOptions[_0x4f49('0x16')];var _0x605c91=crypto['createDecipher'](_0x4915af,_0x239f44);var _0x3cbfbd=_0x605c91[_0x4f49('0x14')](_0x148153,_0x4f49('0x18'),'utf8');_0x3cbfbd+=_0x605c91['final'](_0x4f49('0x17'));return _0x3cbfbd;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0edf021..0666ca3 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 _0x6c76=['argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics'];(function(_0x4bc53b,_0x39fc31){var _0x5743f5=function(_0x3db0ea){while(--_0x3db0ea){_0x4bc53b['push'](_0x4bc53b['shift']());}};_0x5743f5(++_0x39fc31);}(_0x6c76,0x184));var _0x66c7=function(_0x15b167,_0x4bcba4){_0x15b167=_0x15b167-0x0;var _0x53edfc=_0x6c76[_0x15b167];return _0x53edfc;};'use strict';var util=require(_0x66c7('0x0'));var path=require(_0x66c7('0x1'));var _=require(_0x66c7('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x66c7('0x3'));var zipdir=require(_0x66c7('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x66c7('0x5'))[_0x66c7('0x6')];var logger=require('../../config/logger')(_0x66c7('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x66c7('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x66c7('0x8')][0x4];function analyticExtractedReport(_0x4dffcd,_0x4fa6ce){var _0x208d06={'status':_0x4dffcd};var _0x2b0065={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fa6ce){_0x208d06[_0x66c7('0x9')]=_0x4fa6ce;}return db['AnalyticExtractedReport'][_0x66c7('0xa')](_0x208d06,_0x2b0065);}function main(){var _0xbc35d9=0x1388;var _0xf44e2;logger[_0x66c7('0xb')](util['format'](_0x66c7('0xc'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return db[_0x66c7('0xe')][_0x66c7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x66c7('0x10'),_0x66c7('0x11')]})[_0x66c7('0x12')](function(_0x5176a3){if(_0x5176a3){_0xf44e2=_0x5176a3;_0xbc35d9=_0xf44e2[_0x66c7('0x11')]||0x1388;}})[_0x66c7('0x12')](function(){return dbH[_0x66c7('0x13')][_0x66c7('0x14')](util[_0x66c7('0x15')](_0x66c7('0x16'),QUERY),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]});})['then'](function(_0x110f6d){if(!_0x110f6d[0x0]['num']){return analyticExtractedReport(_0x66c7('0x19'));}var _0x39f951=[];var _0x3c81c0=0x0;var _0x42e930=!![];if(_0x110f6d&&_0x110f6d[_0x66c7('0x1a')]){var _0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9);if(_0xf44e2['split']){for(;_0x42e930;_0x3c81c0+=_0xbc35d9,_0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9)){if(_0x4e229a==0x0||_0x4e229a==_0x110f6d[0x0][_0x66c7('0x1b')]){_0x42e930=![];}_0x39f951[_0x66c7('0x1c')](dbH['sequelize']['query'](util[_0x66c7('0x15')](_0x66c7('0x1d'),QUERY,_0xbc35d9,_0x3c81c0),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')]['SELECT']}));}}else{_0x39f951['push'](dbH[_0x66c7('0x13')][_0x66c7('0x14')](QUERY,{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]}));}}var _0x75f118=path['dirname'](PATH);var _0x4ddbd2=path[_0x66c7('0x1e')](PATH,'.csv');var _0x7462f1=_0xf44e2[_0x66c7('0x10')]&&_0x39f951[_0x66c7('0x1a')]>0x1;var _0x1fc9d3=[];if(!fs['existsSync'](path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2))&&_0x7462f1){fs[_0x66c7('0x20')](path['join'](_0x75f118,_0x4ddbd2));}return BPromise[_0x66c7('0x21')](_0x39f951,function(_0x11a6b9){_0x1fc9d3[_0x66c7('0x1c')](_0x11a6b9);})[_0x66c7('0x12')](function(){for(var _0x2af0a3=0x0;_0x2af0a3<_0x1fc9d3['length'];_0x2af0a3+=0x1){var _0x5bc4e6;var _0x4e514a=_0x1fc9d3[_0x2af0a3];if(_0x7462f1){_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2,util[_0x66c7('0x15')]('%s%d.%s',_0x4ddbd2,_0x2af0a3,_0x66c7('0x22')));}else{_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x22')));}fs[_0x66c7('0x24')](_0x5bc4e6,csv(_0x4e514a));}})['then'](function(){if(_0x7462f1){zipdir(path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2),{'saveTo':path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x25')))},function(_0x592f0e,_0x263b48){});rimraf(path['join'](_0x75f118,_0x4ddbd2),function(){});}})[_0x66c7('0x12')](function(){logger['info'](util[_0x66c7('0x15')](_0x66c7('0x26'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return analyticExtractedReport(_0x66c7('0x27'),_0x7462f1?util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x7462f1?'zip':'csv'):null);});})[_0x66c7('0x28')](function(_0x12e7c6){logger[_0x66c7('0xb')](util[_0x66c7('0x15')](_0x66c7('0x29'),EXTRACTED_REPORT_ID,_0x66c7('0xd')),util[_0x66c7('0x2a')](_0x12e7c6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x66c7('0x2b'));});}main(); \ No newline at end of file +var _0xbd50=['Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x4c7e8e,_0x3c5035){var _0x503c3f=function(_0x5a0659){while(--_0x5a0659){_0x4c7e8e['push'](_0x4c7e8e['shift']());}};_0x503c3f(++_0x3c5035);}(_0xbd50,0x196));var _0x0bd5=function(_0x3b0c35,_0x19bcbe){_0x3b0c35=_0x3b0c35-0x0;var _0x3e1971=_0xbd50[_0x3b0c35];return _0x3e1971;};'use strict';var util=require(_0x0bd5('0x0'));var path=require(_0x0bd5('0x1'));var _=require(_0x0bd5('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x0bd5('0x3'));var zipdir=require(_0x0bd5('0x4'));var rimraf=require(_0x0bd5('0x5'));var db=require(_0x0bd5('0x6'))['db'];var dbH=require(_0x0bd5('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0bd5('0x7')][0x2]);var QUERY=process[_0x0bd5('0x7')][0x3];var PATH=process[_0x0bd5('0x7')][0x4];function analyticExtractedReport(_0x2c0db1,_0x1b99f3){var _0x5ebe64={'status':_0x2c0db1};var _0x47e78d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b99f3){_0x5ebe64[_0x0bd5('0x8')]=_0x1b99f3;}return db[_0x0bd5('0x9')][_0x0bd5('0xa')](_0x5ebe64,_0x47e78d);}function main(){var _0x5f5a0c=0x1388;var _0xa98f54;logger[_0x0bd5('0xb')](util['format'](_0x0bd5('0xc'),EXTRACTED_REPORT_ID,_0x0bd5('0xd')));return db['Setting'][_0x0bd5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0bd5('0xf'),_0x0bd5('0x10')]})['then'](function(_0x2f7a0c){if(_0x2f7a0c){_0xa98f54=_0x2f7a0c;_0x5f5a0c=_0xa98f54[_0x0bd5('0x10')]||0x1388;}})[_0x0bd5('0x11')](function(){return dbH[_0x0bd5('0x12')][_0x0bd5('0x13')](util[_0x0bd5('0x14')](_0x0bd5('0x15'),QUERY),{'type':dbH[_0x0bd5('0x12')]['QueryTypes'][_0x0bd5('0x16')]});})[_0x0bd5('0x11')](function(_0x574315){if(!_0x574315[0x0][_0x0bd5('0x17')]){return analyticExtractedReport(_0x0bd5('0x18'));}var _0x3a34e4=[];var _0xc22553=0x0;var _0x55d565=!![];if(_0x574315&&_0x574315[_0x0bd5('0x19')]){var _0x2e4f36=_0x574315[0x0][_0x0bd5('0x17')]%(_0xc22553+_0x5f5a0c);if(_0xa98f54[_0x0bd5('0xf')]){for(;_0x55d565;_0xc22553+=_0x5f5a0c,_0x2e4f36=_0x574315[0x0][_0x0bd5('0x17')]%(_0xc22553+_0x5f5a0c)){if(_0x2e4f36==0x0||_0x2e4f36==_0x574315[0x0][_0x0bd5('0x17')]){_0x55d565=![];}_0x3a34e4[_0x0bd5('0x1a')](dbH[_0x0bd5('0x12')][_0x0bd5('0x13')](util[_0x0bd5('0x14')](_0x0bd5('0x1b'),QUERY,_0x5f5a0c,_0xc22553),{'type':dbH[_0x0bd5('0x12')][_0x0bd5('0x1c')][_0x0bd5('0x16')]}));}}else{_0x3a34e4['push'](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x0bd5('0x16')]}));}}var _0x86381d=path[_0x0bd5('0x1d')](PATH);var _0x4a6910=path[_0x0bd5('0x1e')](PATH,'.csv');var _0x440f85=_0xa98f54[_0x0bd5('0xf')]&&_0x3a34e4[_0x0bd5('0x19')]>0x1;var _0x5a8139=[];if(!fs[_0x0bd5('0x1f')](path['join'](_0x86381d,_0x4a6910))&&_0x440f85){fs['mkdirSync'](path[_0x0bd5('0x20')](_0x86381d,_0x4a6910));}return BPromise[_0x0bd5('0x21')](_0x3a34e4,function(_0x184db3){_0x5a8139['push'](_0x184db3);})[_0x0bd5('0x11')](function(){for(var _0x5eab3e=0x0;_0x5eab3e<_0x5a8139[_0x0bd5('0x19')];_0x5eab3e+=0x1){var _0x3ffb08;var _0x18cec3=_0x5a8139[_0x5eab3e];if(_0x440f85){_0x3ffb08=path[_0x0bd5('0x20')](_0x86381d,_0x4a6910,util[_0x0bd5('0x14')](_0x0bd5('0x22'),_0x4a6910,_0x5eab3e,_0x0bd5('0x23')));}else{_0x3ffb08=path[_0x0bd5('0x20')](_0x86381d,util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,_0x0bd5('0x23')));}fs[_0x0bd5('0x25')](_0x3ffb08,csv(_0x18cec3));}})[_0x0bd5('0x11')](function(){if(_0x440f85){zipdir(path[_0x0bd5('0x20')](_0x86381d,_0x4a6910),{'saveTo':path['join'](_0x86381d,util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,'zip'))},function(_0x20e6c3,_0x8eccc9){});rimraf(path['join'](_0x86381d,_0x4a6910),function(){});}})[_0x0bd5('0x11')](function(){logger[_0x0bd5('0xb')](util[_0x0bd5('0x14')](_0x0bd5('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x0bd5('0x27'),_0x440f85?util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,_0x440f85?_0x0bd5('0x28'):_0x0bd5('0x23')):null);});})[_0x0bd5('0x29')](function(_0x58de46){logger[_0x0bd5('0xb')](util['format'](_0x0bd5('0x2a'),EXTRACTED_REPORT_ID,_0x0bd5('0xd')),util[_0x0bd5('0x2b')](_0x58de46,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0bd5('0x2c'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 031141f..0675f4f 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x32d926,_0x3f9280){var _0x30979e=function(_0x240f17){while(--_0x240f17){_0x32d926['push'](_0x32d926['shift']());}};_0x30979e(++_0x3f9280);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c0529,_0x5ec1ca){_0x2c0529=_0x2c0529-0x0;var _0x3d990f=_0xb10b[_0x2c0529];return _0x3d990f;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x3eff5b,_0x45d958){var _0x49fb48=function(_0x2eaf68){while(--_0x2eaf68){_0x3eff5b['push'](_0x3eff5b['shift']());}};_0x49fb48(++_0x45d958);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0aa1237..bfcaf0a 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 _0xda6c=['find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.xlsx','existsSync','join','mkdirSync','%s.%s','xlsx','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting'];(function(_0x379b0b,_0x17137b){var _0x3546cc=function(_0x147c90){while(--_0x147c90){_0x379b0b['push'](_0x379b0b['shift']());}};_0x3546cc(++_0x17137b);}(_0xda6c,0x9d));var _0xcda6=function(_0x42e2ad,_0x289729){_0x42e2ad=_0x42e2ad-0x0;var _0x354030=_0xda6c[_0x42e2ad];return _0x354030;};'use strict';var util=require('util');var path=require(_0xcda6('0x0'));var _=require(_0xcda6('0x1'));var fs=require('fs');var json2xls=require(_0xcda6('0x2'));var BPromise=require(_0xcda6('0x3'));var zipdir=require(_0xcda6('0x4'));var rimraf=require('rimraf');var db=require(_0xcda6('0x5'))['db'];var dbH=require(_0xcda6('0x5'))['dbH'];var logger=require(_0xcda6('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcda6('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x4c3c3d,_0x490082){var _0x2f064f={'status':_0x4c3c3d};var _0xaa7e01={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x490082){_0x2f064f[_0xcda6('0x8')]=_0x490082;}return db[_0xcda6('0x9')][_0xcda6('0xa')](_0x2f064f,_0xaa7e01);}function main(){var _0x68ccb9=0x1388;var _0x310540;logger[_0xcda6('0xb')](util[_0xcda6('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcda6('0xd')));return db[_0xcda6('0xe')][_0xcda6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcda6('0x10')]})[_0xcda6('0x11')](function(_0x31c2c1){if(_0x31c2c1){_0x310540=_0x31c2c1;_0x68ccb9=_0x310540[_0xcda6('0x10')]||0x1388;}})[_0xcda6('0x11')](function(){return dbH[_0xcda6('0x12')][_0xcda6('0x13')](util[_0xcda6('0xc')](_0xcda6('0x14'),QUERY),{'type':dbH[_0xcda6('0x12')][_0xcda6('0x15')]['SELECT']});})['then'](function(_0x350997){if(!_0x350997[0x0][_0xcda6('0x16')]){return analyticExtractedReport(_0xcda6('0x17'));}var _0x1eef72=[];var _0x106e4a=0x0;var _0x32b85a=!![];if(_0x310540[_0xcda6('0x18')]){if(_0x350997&&_0x350997[_0xcda6('0x19')]){var _0x180076=_0x350997[0x0][_0xcda6('0x16')]%(_0x106e4a+_0x68ccb9);for(;_0x32b85a;_0x106e4a+=_0x68ccb9,_0x180076=_0x350997[0x0][_0xcda6('0x16')]%(_0x106e4a+_0x68ccb9)){if(_0x180076==0x0||_0x180076==_0x350997[0x0]['num']){_0x32b85a=![];}_0x1eef72[_0xcda6('0x1a')](dbH[_0xcda6('0x12')]['query'](util[_0xcda6('0xc')](_0xcda6('0x1b'),QUERY,_0x68ccb9,_0x106e4a),{'type':dbH[_0xcda6('0x12')][_0xcda6('0x15')][_0xcda6('0x1c')]}));}}}else{_0x1eef72[_0xcda6('0x1a')](dbH[_0xcda6('0x12')]['query'](QUERY,{'type':dbH[_0xcda6('0x12')][_0xcda6('0x15')][_0xcda6('0x1c')]}));}var _0xca8a2c=path[_0xcda6('0x1d')](PATH);var _0x2564f9=path['basename'](PATH,_0xcda6('0x1e'));var _0x201573=_0x310540[_0xcda6('0x18')]&&_0x1eef72[_0xcda6('0x19')]>0x1;var _0x92d258=[];if(!fs[_0xcda6('0x1f')](path[_0xcda6('0x20')](_0xca8a2c,_0x2564f9))&&_0x201573){fs[_0xcda6('0x21')](path['join'](_0xca8a2c,_0x2564f9));}return BPromise['each'](_0x1eef72,function(_0x2f13e4){_0x92d258[_0xcda6('0x1a')](_0x2f13e4);})[_0xcda6('0x11')](function(){for(var _0x3e3cf9=0x0;_0x3e3cf9<_0x92d258[_0xcda6('0x19')];_0x3e3cf9+=0x1){var _0x322ce1;var _0x2101f5=_0x92d258[_0x3e3cf9];if(_0x201573){_0x322ce1=path['join'](_0xca8a2c,_0x2564f9,util[_0xcda6('0xc')]('%s%d.%s',_0x2564f9,_0x3e3cf9,'xlsx'));}else{_0x322ce1=path['join'](_0xca8a2c,util[_0xcda6('0xc')](_0xcda6('0x22'),_0x2564f9,_0xcda6('0x23')));}fs['writeFileSync'](_0x322ce1,json2xls(_0x2101f5),_0xcda6('0x24'));}})[_0xcda6('0x11')](function(){if(_0x201573){zipdir(path[_0xcda6('0x20')](_0xca8a2c,_0x2564f9),{'saveTo':path['join'](_0xca8a2c,util['format']('%s.%s',_0x2564f9,'zip'))},function(_0x31efc1,_0x13e8b1){});rimraf(path['join'](_0xca8a2c,_0x2564f9),function(){});}})['then'](function(){logger[_0xcda6('0xb')](util[_0xcda6('0xc')](_0xcda6('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xcda6('0x26'),_0x201573?util['format'](_0xcda6('0x22'),_0x2564f9,_0x201573?_0xcda6('0x27'):_0xcda6('0x23')):null);});})[_0xcda6('0x28')](function(_0xe30101){logger[_0xcda6('0xb')](util[_0xcda6('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcda6('0xd')),util[_0xcda6('0x29')](_0xe30101,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xcda6('0x2a'));});}main(); \ No newline at end of file +var _0xb06b=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','join','mkdirSync','each','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x2c3ae4,_0x46cc27){var _0x336def=function(_0x667e17){while(--_0x667e17){_0x2c3ae4['push'](_0x2c3ae4['shift']());}};_0x336def(++_0x46cc27);}(_0xb06b,0x1b6));var _0xbb06=function(_0x2cbf99,_0x587c11){_0x2cbf99=_0x2cbf99-0x0;var _0x44c3bb=_0xb06b[_0x2cbf99];return _0x44c3bb;};'use strict';var util=require(_0xbb06('0x0'));var path=require(_0xbb06('0x1'));var _=require(_0xbb06('0x2'));var fs=require('fs');var json2xls=require(_0xbb06('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xbb06('0x4'));var rimraf=require(_0xbb06('0x5'));var db=require(_0xbb06('0x6'))['db'];var dbH=require(_0xbb06('0x6'))[_0xbb06('0x7')];var logger=require(_0xbb06('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb06('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xbb06('0x9')][0x4];function analyticExtractedReport(_0x4864ab,_0x1a80db){var _0x36077b={'status':_0x4864ab};var _0x3e95ac={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a80db){_0x36077b[_0xbb06('0xa')]=_0x1a80db;}return db[_0xbb06('0xb')][_0xbb06('0xc')](_0x36077b,_0x3e95ac);}function main(){var _0x501a15=0x1388;var _0x1eef3e;logger[_0xbb06('0xd')](util[_0xbb06('0xe')](_0xbb06('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xbb06('0x10')][_0xbb06('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb06('0x12'),_0xbb06('0x13')]})['then'](function(_0x20a052){if(_0x20a052){_0x1eef3e=_0x20a052;_0x501a15=_0x1eef3e['splitSizeXlsx']||0x1388;}})[_0xbb06('0x14')](function(){return dbH[_0xbb06('0x15')]['query'](util[_0xbb06('0xe')](_0xbb06('0x16'),QUERY),{'type':dbH['sequelize'][_0xbb06('0x17')][_0xbb06('0x18')]});})[_0xbb06('0x14')](function(_0xfa1e4a){if(!_0xfa1e4a[0x0]['num']){return analyticExtractedReport(_0xbb06('0x19'));}var _0x717137=[];var _0x29a785=0x0;var _0x2e08e8=!![];if(_0x1eef3e[_0xbb06('0x12')]){if(_0xfa1e4a&&_0xfa1e4a[_0xbb06('0x1a')]){var _0x4f49d5=_0xfa1e4a[0x0][_0xbb06('0x1b')]%(_0x29a785+_0x501a15);for(;_0x2e08e8;_0x29a785+=_0x501a15,_0x4f49d5=_0xfa1e4a[0x0][_0xbb06('0x1b')]%(_0x29a785+_0x501a15)){if(_0x4f49d5==0x0||_0x4f49d5==_0xfa1e4a[0x0][_0xbb06('0x1b')]){_0x2e08e8=![];}_0x717137[_0xbb06('0x1c')](dbH[_0xbb06('0x15')][_0xbb06('0x1d')](util[_0xbb06('0xe')](_0xbb06('0x1e'),QUERY,_0x501a15,_0x29a785),{'type':dbH[_0xbb06('0x15')][_0xbb06('0x17')][_0xbb06('0x18')]}));}}}else{_0x717137[_0xbb06('0x1c')](dbH[_0xbb06('0x15')][_0xbb06('0x1d')](QUERY,{'type':dbH[_0xbb06('0x15')][_0xbb06('0x17')][_0xbb06('0x18')]}));}var _0x3067d2=path['dirname'](PATH);var _0x5b02fd=path[_0xbb06('0x1f')](PATH,_0xbb06('0x20'));var _0x1585ea=_0x1eef3e[_0xbb06('0x12')]&&_0x717137[_0xbb06('0x1a')]>0x1;var _0x2d8319=[];if(!fs['existsSync'](path[_0xbb06('0x21')](_0x3067d2,_0x5b02fd))&&_0x1585ea){fs[_0xbb06('0x22')](path['join'](_0x3067d2,_0x5b02fd));}return BPromise[_0xbb06('0x23')](_0x717137,function(_0x3935a2){_0x2d8319[_0xbb06('0x1c')](_0x3935a2);})['then'](function(){for(var _0x2d03a3=0x0;_0x2d03a3<_0x2d8319[_0xbb06('0x1a')];_0x2d03a3+=0x1){var _0x4148f8;var _0x2b07e8=_0x2d8319[_0x2d03a3];if(_0x1585ea){_0x4148f8=path['join'](_0x3067d2,_0x5b02fd,util['format']('%s%d.%s',_0x5b02fd,_0x2d03a3,'xlsx'));}else{_0x4148f8=path[_0xbb06('0x21')](_0x3067d2,util[_0xbb06('0xe')]('%s.%s',_0x5b02fd,_0xbb06('0x24')));}fs[_0xbb06('0x25')](_0x4148f8,json2xls(_0x2b07e8),_0xbb06('0x26'));}})[_0xbb06('0x14')](function(){if(_0x1585ea){zipdir(path[_0xbb06('0x21')](_0x3067d2,_0x5b02fd),{'saveTo':path[_0xbb06('0x21')](_0x3067d2,util[_0xbb06('0xe')](_0xbb06('0x27'),_0x5b02fd,_0xbb06('0x28')))},function(_0x1c9e78,_0x88f761){});rimraf(path['join'](_0x3067d2,_0x5b02fd),function(){});}})[_0xbb06('0x14')](function(){logger[_0xbb06('0xd')](util[_0xbb06('0xe')](_0xbb06('0x29'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xbb06('0x2a'),_0x1585ea?util['format'](_0xbb06('0x27'),_0x5b02fd,_0x1585ea?_0xbb06('0x28'):_0xbb06('0x24')):null);});})['catch'](function(_0x29daf2){logger[_0xbb06('0xd')](util[_0xbb06('0xe')](_0xbb06('0x2b'),EXTRACTED_REPORT_ID,_0xbb06('0x2c')),util[_0xbb06('0x2d')](_0x29daf2,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fb42d5f..1717874 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 _0xefe2=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','lodash','util','Interval','then','intervals','models','VoiceExtension','IntervalId','findAll','uniq','map','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','find','extensions','push','Set','format','type','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','context','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xefe2,0xd9));var _0x2efe=function(_0x5f57f2,_0x455cdd){_0x5f57f2=_0x5f57f2-0x0;var _0x4ff723=_0xefe2[_0x5f57f2];return _0x4ff723;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));function rewrite(_0x521ca2,_0x1278b){var _0x26190d=this;return _0x521ca2['models'][_0x2efe('0x2')]['findAll']({'raw':!![]})[_0x2efe('0x3')](function(_0x4553a6){_0x26190d[_0x2efe('0x4')]=_0x4553a6;return _0x521ca2[_0x2efe('0x5')][_0x2efe('0x6')]['findAll']({'where':{'IntervalId':_0x1278b[_0x2efe('0x7')]},'raw':!![]});})[_0x2efe('0x3')](function(_0x2a2d22){return _0x521ca2[_0x2efe('0x5')]['VoiceExtension'][_0x2efe('0x8')]({'where':{'exten':{'$in':_[_0x2efe('0x9')](_[_0x2efe('0xa')](_0x2a2d22,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x2efe('0x3')](function(_0x5a17d3){var _0x58ba63=_[_0x2efe('0xb')](_0x5a17d3,{'priority':'1'});var _0x34085f=_[_0x2efe('0xb')](_0x5a17d3,{'isApp':0x1});var _0x22e98f=_[_0x2efe('0xc')](_0x34085f,_0x2efe('0xd'));var _0x39a93b=[_0x2efe('0xe'),_0x2efe('0xf')];var _0x3c8910=[];var _0x4cd723=[];for(var _0x58ffa1 in _0x22e98f){if(_0x22e98f[_0x2efe('0x10')](_0x58ffa1)){_0x26190d[_0x2efe('0x11')]=0x2;_0x26190d['extensions']=[];_0x26190d['extension']=_[_0x2efe('0x12')](_0x58ba63,{'exten':_0x22e98f[_0x58ffa1][0x0]['exten']});_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0]['type'],'app':_0x2efe('0x15'),'appdata':util[_0x2efe('0x16')]('CDR(type)=%s',_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')]),'context':_0x22e98f[_0x58ffa1][0x0]['context'],'exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});if(_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')]===_0x2efe('0x19')){if(_0x26190d[_0x2efe('0x1a')]){_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x1b')+(_0x26190d[_0x2efe('0x1a')][_0x2efe('0x1c')]?'${EXTEN:'+_0x26190d[_0x2efe('0x1a')]['cutdigits']+'}':_0x2efe('0x1d')),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d['priority']++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x1f')+_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')],'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});var _0x3d4449=_0x26190d[_0x2efe('0x11')]++;_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d4449+0x2)+_0x2efe('0x21')+(_0x3d4449+0x1)+')','context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x3d4449,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});if(_0x26190d[_0x2efe('0x1a')]){_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x26190d[_0x2efe('0x1a')]['cutdigits']?_0x2efe('0x22')+_0x26190d[_0x2efe('0x1a')][_0x2efe('0x1c')]+'}':_0x2efe('0x23'),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x24')+_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')],'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d['priority']++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});if(_0x26190d[_0x2efe('0x1a')]&&_0x26190d[_0x2efe('0x1a')][_0x2efe('0x10')](_0x2efe('0x25'))&&_0x26190d[_0x2efe('0x1a')][_0x2efe('0x25')]!==_0x2efe('0x26')){_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x22e98f[_0x58ffa1][0x0]['context'],'exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x27')+_0x26190d['extension']['recordingFormat']||_0x2efe('0x28'),'context':_0x22e98f[_0x58ffa1][0x0]['context'],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}}_0x26190d['extensions'][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x29'),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0]['VoiceExtensionId']});_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x2a'),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d['priority']++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});for(var _0x3356ec=0x0,_0x20c5f4=0x0;_0x3356ec<_0x22e98f[_0x58ffa1][_0x2efe('0x2b')];_0x3356ec+=0x1,_0x20c5f4=0x0){var _0xbcd760=_0x22e98f[_0x58ffa1][_0x3356ec];if(_0xbcd760[_0x2efe('0x17')]){_0xbcd760[_0x2efe('0x17')]=_0xbcd760[_0x2efe('0x17')][_0x2efe('0x2c')]();}var _0x1c9032=[];var _0x469822=[];delete _0xbcd760['id'];delete _0xbcd760[_0x2efe('0x2d')];delete _0xbcd760['updatedAt'];var _0x10e196=_0xbcd760[_0x2efe('0x2e')]!==_0x2efe('0x2f')?[_0xbcd760[_0x2efe('0x2e')]]:_0xbcd760[_0x2efe('0x7')]?_[_0x2efe('0xa')](_[_0x2efe('0xb')](_0x26190d['intervals'],{'IntervalId':_0xbcd760[_0x2efe('0x7')]}),_0x2efe('0x2e')):[];if(_0xbcd760[_0x2efe('0x10')](_0x2efe('0x30'))){if(_0xbcd760[_0x2efe('0x30')]&&_0xbcd760['tag']!=='--'){_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x31')+_0xbcd760[_0x2efe('0x30')],'context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760['VoiceExtensionId']});}}if(_0xbcd760['type']==='outbound'&&_0xbcd760[_0x2efe('0x10')](_0x2efe('0x32'))){if(_0xbcd760['callerID']){_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760['type'],'app':'ExecIf','appdata':_0x2efe('0x33')+_0xbcd760['callerID']+')','context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d['priority']+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}else{_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196['length']+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}}if(_0xbcd760[_0x2efe('0x10')](_0x2efe('0x34'))){if(_0x39a93b[_0x2efe('0x35')](_0xbcd760['app'][_0x2efe('0x2c')]())>=0x0&&_0xbcd760[_0x2efe('0x36')]!==_0x2efe('0x37')){if(_0xbcd760['answer']){_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':_0x2efe('0x38'),'context':_0xbcd760['context'],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196['length']+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760['exten'],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d['priority']+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}else{_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':_0x2efe('0x39'),'context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196['length']+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x3a'),'context':_0xbcd760['context'],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}}}for(var _0x3a159e=0x0;_0x3a159e<_0x10e196['length'];_0x3a159e+=0x1){var _0x459373=_0x26190d[_0x2efe('0x11')]+_0x10e196[_0x2efe('0x2b')];var _0x35bfe7=_0x3a159e===_0x10e196['length']-0x1?_0x26190d[_0x2efe('0x11')]+_0x1c9032[_0x2efe('0x2b')]+_0x469822[_0x2efe('0x2b')]+0x2:_0x26190d['priority']+_0x3a159e+0x1;_0x1c9032[_0x2efe('0x3b')](_0x3a159e,0x0,{'type':_0xbcd760['type'],'app':_0x2efe('0x3c'),'appdata':_0x10e196[_0x3a159e]+'?'+_0xbcd760[_0x2efe('0x1e')]+_0x2efe('0x3d')+_0x459373+':'+_0xbcd760[_0x2efe('0x1e')]+',${EXTEN},'+_0x35bfe7,'exten':_0xbcd760[_0x2efe('0xd')],'context':_0xbcd760[_0x2efe('0x1e')],'priority':_0x26190d[_0x2efe('0x11')]+_0x3a159e,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}_0xbcd760['priority']=_0x1c9032[_0x2efe('0x2b')]?_[_0x2efe('0x3e')](_0x1c9032)[_0x2efe('0x11')]+0x1:_0x26190d[_0x2efe('0x11')];_0x26190d[_0x2efe('0x11')]=(_0x469822[_0x2efe('0x2b')]?_[_0x2efe('0x3e')](_0x469822)['priority']:_0xbcd760[_0x2efe('0x11')])+0x1;_0x26190d[_0x2efe('0x13')]=_[_0x2efe('0x3f')](_0x26190d[_0x2efe('0x13')],_0x1c9032,[_0xbcd760],_0x469822);}_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':'Hangup','exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'priority':_0x26190d['priority'],'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});_0x3c8910[_0x2efe('0x14')](_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]);_0x4cd723=_[_0x2efe('0x3f')](_0x4cd723,_0x26190d[_0x2efe('0x13')]);}}return _0x521ca2['transaction'](function(_0x2a9615){return _0x521ca2[_0x2efe('0x5')][_0x2efe('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3c8910}},'transaction':_0x2a9615})[_0x2efe('0x3')](function(_0x19771b){return _0x521ca2[_0x2efe('0x5')][_0x2efe('0x6')][_0x2efe('0x40')](_[_0x2efe('0x41')](_0x4cd723,_0x2efe('0x11')),{'transaction':_0x2a9615});});});})[_0x2efe('0x42')](function(_0x416197){console['error'](_0x416197);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x2b51=['_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','length','createdAt','updatedAt','interval','*,*,*,*','map','tag','callerID','indexOf','app','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','catch','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x2b51,0x1c5));var _0x12b5=function(_0x1ebef9,_0x286e04){_0x1ebef9=_0x1ebef9-0x0;var _0x212cfd=_0x2b51[_0x1ebef9];return _0x212cfd;};'use strict';var _=require(_0x12b5('0x0'));var util=require(_0x12b5('0x1'));function rewrite(_0x2fe8a8,_0x21a927){var _0x17f329=this;return _0x2fe8a8[_0x12b5('0x2')]['Interval'][_0x12b5('0x3')]({'raw':!![]})['then'](function(_0x5b65f8){_0x17f329[_0x12b5('0x4')]=_0x5b65f8;return _0x2fe8a8[_0x12b5('0x2')][_0x12b5('0x5')][_0x12b5('0x3')]({'where':{'IntervalId':_0x21a927[_0x12b5('0x6')]},'raw':!![]});})[_0x12b5('0x7')](function(_0x22f2e0){return _0x2fe8a8[_0x12b5('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x12b5('0x8')](_['map'](_0x22f2e0,_0x12b5('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x12b5('0x7')](function(_0x127cb7){var _0x279b6f=_[_0x12b5('0xa')](_0x127cb7,{'priority':'1'});var _0x37b421=_[_0x12b5('0xa')](_0x127cb7,{'isApp':0x1});var _0x4ef85e=_[_0x12b5('0xb')](_0x37b421,'exten');var _0x5e8c62=[_0x12b5('0xc'),_0x12b5('0xd')];var _0x28e1bc=[];var _0x16fcba=[];for(var _0x20ac1b in _0x4ef85e){if(_0x4ef85e[_0x12b5('0xe')](_0x20ac1b)){_0x17f329[_0x12b5('0xf')]=0x2;_0x17f329['extensions']=[];_0x17f329['extension']=_['find'](_0x279b6f,{'exten':_0x4ef85e[_0x20ac1b][0x0]['exten']});_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':util[_0x12b5('0x14')](_0x12b5('0x15'),_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')]),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});if(_0x4ef85e[_0x20ac1b][0x0]['type']===_0x12b5('0x18')){if(_0x17f329[_0x12b5('0x19')]){_0x17f329[_0x12b5('0x10')]['push']({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x1a')+(_0x17f329['extension'][_0x12b5('0x1b')]?'${EXTEN:'+_0x17f329[_0x12b5('0x19')][_0x12b5('0x1b')]+'}':'${EXTEN}'),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});}_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':'CDR(routeid)='+_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')],'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});var _0x24f52c=_0x17f329['priority']++;_0x17f329['extensions']['push']({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x24f52c+0x2)+'):Goto('+(_0x24f52c+0x1)+')','context':_0x4ef85e[_0x20ac1b][0x0]['context'],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x24f52c,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});if(_0x17f329[_0x12b5('0x19')]){_0x17f329['extensions']['push']({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x17f329[_0x12b5('0x19')][_0x12b5('0x1b')]?_0x12b5('0x1d')+_0x17f329['extension']['cutdigits']+'}':_0x12b5('0x1e'),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});}_0x17f329['extensions'][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x1f')+_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')],'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});if(_0x17f329['extension']&&_0x17f329['extension'][_0x12b5('0xe')]('recordingFormat')&&_0x17f329[_0x12b5('0x19')][_0x12b5('0x20')]!==_0x12b5('0x21')){_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x22'),'context':_0x4ef85e[_0x20ac1b][0x0]['context'],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x23')+_0x17f329[_0x12b5('0x19')]['recordingFormat']||'wav','context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});}}_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x24'),'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0]['exten'],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329[_0x12b5('0xf')]++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});_0x17f329['extensions'][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x12')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'priority':_0x17f329['priority']++,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});for(var _0x5774fb=0x0,_0x3d41f9=0x0;_0x5774fb<_0x4ef85e[_0x20ac1b][_0x12b5('0x25')];_0x5774fb+=0x1,_0x3d41f9=0x0){var _0x494b80=_0x4ef85e[_0x20ac1b][_0x5774fb];if(_0x494b80[_0x12b5('0x12')]){_0x494b80[_0x12b5('0x12')]=_0x494b80[_0x12b5('0x12')]['toLowerCase']();}var _0x57d702=[];var _0xcddbe2=[];delete _0x494b80['id'];delete _0x494b80[_0x12b5('0x26')];delete _0x494b80[_0x12b5('0x27')];var _0x109f28=_0x494b80[_0x12b5('0x28')]!==_0x12b5('0x29')?[_0x494b80['interval']]:_0x494b80['IntervalId']?_[_0x12b5('0x2a')](_[_0x12b5('0xa')](_0x17f329[_0x12b5('0x4')],{'IntervalId':_0x494b80[_0x12b5('0x6')]}),_0x12b5('0x28')):[];if(_0x494b80[_0x12b5('0xe')](_0x12b5('0x2b'))){if(_0x494b80[_0x12b5('0x2b')]&&_0x494b80[_0x12b5('0x2b')]!=='--'){_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':'Set','appdata':'CDR(tag)='+_0x494b80[_0x12b5('0x2b')],'context':_0x494b80[_0x12b5('0x16')],'exten':_0x494b80['exten'],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329[_0x12b5('0xf')]+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});}}if(_0x494b80[_0x12b5('0x12')]===_0x12b5('0x18')&&_0x494b80['hasOwnProperty'](_0x12b5('0x2c'))){if(_0x494b80[_0x12b5('0x2c')]){_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x494b80[_0x12b5('0x2c')]+')','context':_0x494b80[_0x12b5('0x16')],'exten':_0x494b80['exten'],'priority':_0x109f28['length']+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80['VoiceExtensionId']});}else{_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});}}if(_0x494b80[_0x12b5('0xe')]('answer')){if(_0x5e8c62[_0x12b5('0x2d')](_0x494b80[_0x12b5('0x2e')][_0x12b5('0x2f')]())>=0x0&&_0x494b80[_0x12b5('0x30')]!=='custom'){if(_0x494b80['answer']){_0x57d702['push']({'type':_0x494b80['type'],'app':_0x12b5('0x1c'),'appdata':_0x12b5('0x31'),'context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329[_0x12b5('0xf')]+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});_0x57d702[_0x12b5('0x11')]({'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x13'),'appdata':_0x12b5('0x32'),'context':_0x494b80[_0x12b5('0x16')],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329[_0x12b5('0xf')]+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});}else{_0x57d702['push']({'type':_0x494b80['type'],'app':_0x12b5('0x1c'),'appdata':_0x12b5('0x33'),'context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80[_0x12b5('0x17')]});_0x57d702['push']({'type':_0x494b80[_0x12b5('0x12')],'app':'Set','appdata':_0x12b5('0x34'),'context':_0x494b80['context'],'exten':_0x494b80[_0x12b5('0x9')],'priority':_0x109f28[_0x12b5('0x25')]+_0x17f329['priority']+_0x3d41f9++,'VoiceExtensionId':_0x494b80['VoiceExtensionId']});}}}for(var _0x269a8d=0x0;_0x269a8d<_0x109f28[_0x12b5('0x25')];_0x269a8d+=0x1){var _0xac595a=_0x17f329[_0x12b5('0xf')]+_0x109f28['length'];var _0x3b0ca8=_0x269a8d===_0x109f28['length']-0x1?_0x17f329[_0x12b5('0xf')]+_0x57d702[_0x12b5('0x25')]+_0xcddbe2['length']+0x2:_0x17f329['priority']+_0x269a8d+0x1;_0x57d702[_0x12b5('0x35')](_0x269a8d,0x0,{'type':_0x494b80[_0x12b5('0x12')],'app':_0x12b5('0x36'),'appdata':_0x109f28[_0x269a8d]+'?'+_0x494b80[_0x12b5('0x16')]+_0x12b5('0x37')+_0xac595a+':'+_0x494b80[_0x12b5('0x16')]+',${EXTEN},'+_0x3b0ca8,'exten':_0x494b80[_0x12b5('0x9')],'context':_0x494b80[_0x12b5('0x16')],'priority':_0x17f329[_0x12b5('0xf')]+_0x269a8d,'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0]['VoiceExtensionId']});}_0x494b80['priority']=_0x57d702[_0x12b5('0x25')]?_[_0x12b5('0x38')](_0x57d702)[_0x12b5('0xf')]+0x1:_0x17f329['priority'];_0x17f329[_0x12b5('0xf')]=(_0xcddbe2[_0x12b5('0x25')]?_[_0x12b5('0x38')](_0xcddbe2)[_0x12b5('0xf')]:_0x494b80[_0x12b5('0xf')])+0x1;_0x17f329[_0x12b5('0x10')]=_[_0x12b5('0x39')](_0x17f329[_0x12b5('0x10')],_0x57d702,[_0x494b80],_0xcddbe2);}_0x17f329[_0x12b5('0x10')][_0x12b5('0x11')]({'type':_0x4ef85e[_0x20ac1b][0x0]['type'],'app':'Hangup','exten':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x9')],'context':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x16')],'priority':_0x17f329[_0x12b5('0xf')],'VoiceExtensionId':_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]});_0x28e1bc[_0x12b5('0x11')](_0x4ef85e[_0x20ac1b][0x0][_0x12b5('0x17')]);_0x16fcba=_[_0x12b5('0x39')](_0x16fcba,_0x17f329['extensions']);}}return _0x2fe8a8['transaction'](function(_0x41f3f9){return _0x2fe8a8[_0x12b5('0x2')]['VoiceExtension'][_0x12b5('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x28e1bc}},'transaction':_0x41f3f9})[_0x12b5('0x7')](function(_0xa7d971){return _0x2fe8a8[_0x12b5('0x2')][_0x12b5('0x5')]['bulkCreate'](_['sortBy'](_0x16fcba,_0x12b5('0xf')),{'transaction':_0x41f3f9});});});})[_0x12b5('0x3b')](function(_0x27139c){console['error'](_0x27139c);});}exports[_0x12b5('0x3c')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0dc2c1a..35a3575 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 _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x4ceb42,_0x503411){var _0x46c330=function(_0x1ced03){while(--_0x1ced03){_0x4ceb42['push'](_0x4ceb42['shift']());}};_0x46c330(++_0x503411);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x16eecb,_0x2fbbc6){var _0x3c9482=function(_0x586a57){while(--_0x586a57){_0x16eecb['push'](_0x16eecb['shift']());}};_0x3c9482(++_0x2fbbc6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 09f6e8b..13ab7c7 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 _0x2284=['campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','phone','ContactId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','into','cm_hopper_black','ListId','fields','cm_contacts.ListId\x20=\x20','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','error','errors','push','info','sequelize','query','spread','catch','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','emit','Abort\x20parser','SystemError','message','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId'];(function(_0x249565,_0x2a026a){var _0x43dee8=function(_0x15a1ab){while(--_0x15a1ab){_0x249565['push'](_0x249565['shift']());}};_0x43dee8(++_0x2a026a);}(_0x2284,0x12d));var _0x4228=function(_0x4966c3,_0x58da94){_0x4966c3=_0x4966c3-0x0;var _0x5e8d59=_0x2284[_0x4966c3];return _0x5e8d59;};'use strict';var fs=require('fs');var path=require(_0x4228('0x0'));var _=require(_0x4228('0x1'));var Papa=require(_0x4228('0x2'));var util=require(_0x4228('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x4228('0x4'));var Redis=require(_0x4228('0x5'));var db=require(_0x4228('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x4228('0x7'))(_0x4228('0x8'));config[_0x4228('0x9')]=_[_0x4228('0xa')](config[_0x4228('0x9')],{'host':_0x4228('0xb'),'port':0x18eb});var socket=require(_0x4228('0xc'))(new Redis(config[_0x4228('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4228('0xd')](_0x4228('0xe'));function isEmail(_0x3c6009){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x4228('0xf')](_0x3c6009);}function selectNotIn(_0x429332,_0x779622,_0x28b9be,_0x138c39,_0x4d265a){return squel[_0x4228('0x10')]()[_0x4228('0x11')]('phone')[_0x4228('0x12')](_0x138c39)[_0x4228('0x13')](_0x779622,null,_0x779622+_0x4228('0x14')+_0x138c39+'.'+_0x28b9be)[_0x4228('0x15')](_0x138c39+'.'+_0x28b9be+_0x4228('0x16')+_0x429332+'.'+_0x28b9be)[_0x4228('0x15')](_0x779622+'.dialCheckDuplicateType\x20IN\x20('+_0x4d265a[_0x4228('0x13')]()+')');}function insertCmHopper(_0x539c67,_0xce1ed6,_0x3631e2,_0x1aecc1,_0x4497a8){var _0x173e37=[_0x4228('0x17'),_0x4228('0x18'),'cm_contacts.id',_0x4228('0x19'),_0xce1ed6+'.'+_0x1aecc1,_0x4228('0x1a'),_0x4228('0x1b'),_0x4228('0x1c'),'cm_contacts.UserId','\x22'+_0x4497a8+'\x22'];return squel[_0x4228('0x1d')]()['into'](_0x4228('0x1e'))[_0x4228('0x1f')]([_0x4228('0x20'),'scheduledat',_0x4228('0x21'),'ListId',_0x1aecc1,_0x4228('0x22'),_0x4228('0x23'),_0x4228('0x24'),_0x4228('0x25'),_0x4228('0x26')],squel[_0x4228('0x10')]()['fields'](_0x173e37)[_0x4228('0x12')](_0xce1ed6)[_0x4228('0x13')](_0x4228('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0xce1ed6+_0x4228('0x28'))[_0x4228('0x13')](_0x3631e2,null,_0x3631e2+_0x4228('0x14')+_0xce1ed6+'.'+_0x1aecc1)[_0x4228('0x15')](_0xce1ed6+_0x4228('0x29'),_0x539c67)['where'](_0x4228('0x2a'),NOW)[_0x4228('0x15')](_0x4228('0x2b'),selectNotIn(_0xce1ed6,_0x3631e2,_0x1aecc1,'cm_hopper',['\x22always\x22',_0x4228('0x2c')]))[_0x4228('0x15')](_0x4228('0x2b'),selectNotIn(_0xce1ed6,_0x3631e2,_0x1aecc1,_0x4228('0x1e'),[_0x4228('0x2d')])))[_0x4228('0x2e')]();}function insertCmHopperBlack(_0x3e8e7c,_0x3fc4ef,_0x35e2fd,_0x459e88){var _0x3db471=['cm_contacts.phone',_0x4228('0x2f'),_0x4228('0x19'),_0x3fc4ef+'.'+_0x459e88,_0x4228('0x1a'),_0x4228('0x1b')];return squel[_0x4228('0x1d')]()[_0x4228('0x30')](_0x4228('0x31'))['fromQuery'](['phone',_0x4228('0x21'),_0x4228('0x32'),_0x459e88,_0x4228('0x22'),_0x4228('0x23')],squel[_0x4228('0x10')]()[_0x4228('0x33')](_0x3db471)['from'](_0x3fc4ef)[_0x4228('0x13')]('cm_contacts',null,_0x4228('0x34')+_0x3fc4ef+_0x4228('0x28'))[_0x4228('0x13')](_0x35e2fd,null,_0x35e2fd+_0x4228('0x14')+_0x3fc4ef+'.'+_0x459e88)[_0x4228('0x15')](_0x3fc4ef+'.CmListId\x20=\x20?',_0x3e8e7c)[_0x4228('0x15')](_0x4228('0x2a'),NOW)[_0x4228('0x15')](_0x4228('0x2b'),squel['select']()['field'](_0x4228('0x20'))[_0x4228('0x12')](_0x4228('0x31'))['where']('ListId\x20=\x20?',_0x3e8e7c)[_0x4228('0x15')](_0x459e88+_0x4228('0x35'),_0x3fc4ef+'.'+_0x459e88)))['toString']();}function insertCmContact(_0xd553f2,_0xb4991b,_0x13eed2,_0x15aaa9){var _0x2bb1e2=_[_0x4228('0x36')](_[_0x4228('0x37')](_0x15aaa9),[_0x4228('0x32'),_0x4228('0x38'),_0x4228('0x22'),_0x4228('0x23')]);return squel[_0x4228('0x1d')]()['into'](_0x4228('0x27'))[_0x4228('0x1f')](_0x2bb1e2,squel['select']()[_0x4228('0x33')](_0x2bb1e2)['from'](_0xb4991b)[_0x4228('0x15')]('('+_0x13eed2[_0x4228('0x13')](',')+_0x4228('0x39'),squel[_0x4228('0x10')]()['fields'](_0x13eed2)[_0x4228('0x12')](_0x4228('0x27'))[_0x4228('0x15')](_0x4228('0x3a'),_0xd553f2)[_0x4228('0x15')]('deletedAt\x20IS\x20NULL'))[_0x4228('0x15')](_0x4228('0x3b'),squel['select']()[_0x4228('0x11')](_0x4228('0x3c'),_0x4228('0x3d'))['from'](_0xb4991b)[_0x4228('0x3e')](_0x13eed2[_0x4228('0x13')](','))))[_0x4228('0x2e')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x446999){logger[_0x4228('0x3f')](_0x446999['message']);process['exit'](0x1);}function handleError(_0x466536,_0x4ac138){stats[_0x4228('0x40')][_0x4228('0x41')]({'name':_0x4ac138['code'],'message':_0x4ac138['message'],'row':_0x466536});}function handleQuery(_0x1c8570){logger[_0x4228('0x42')](_0x1c8570);return db[_0x4228('0x43')][_0x4228('0x44')](_0x1c8570)[_0x4228('0x45')](function(_0x5d36a8){results['push'](_0x5d36a8);})[_0x4228('0x46')](function(_0x133021){logger['error'](_0x133021['message']);});}function main(_0x1f1ac3,_0x45b5a0,_0x34c513,_0xa019b7){logger[_0x4228('0x42')]('main',_0x1f1ac3,JSON[_0x4228('0x47')](_0x45b5a0));process[_0x4228('0x48')](_0x4228('0x49'));var _0x48735d=_0x45b5a0['binding'];var _0x2bf99f=_0x45b5a0[_0x4228('0x4a')];var _0x55851e=path[_0x4228('0x13')](config[_0x4228('0x4b')],_0x4228('0x4c'),_0x2bf99f+_0x4228('0x4d'));var _0x2c7779=_[_0x4228('0x37')](_0x48735d)[_0x4228('0x13')]();logger['info'](_0x4228('0x4e'),_0x2c7779);fs[_0x4228('0x4f')](_0x55851e,_0x2c7779+'\x0a');Papa[_0x4228('0x50')](fs[_0x4228('0x51')](_0x1f1ac3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1f72f9,_0x3bf8ed){try{for(var _0x1c441f=0x0,_0x1753fd=[];_0x1c441f<_0x1f72f9[_0x4228('0x52')][_0x4228('0x53')];_0x1c441f++){stats[_0x4228('0x54')]+=0x1;if(_0x1f72f9[_0x4228('0x40')][_0x1c441f]){handleError(_0x1f72f9[_0x4228('0x52')][_0x1c441f],_0x1f72f9[_0x4228('0x40')][_0x1c441f]);}else{var _0x510710=[];for(var _0x195a76 in _0x48735d){if(_0x48735d[_0x4228('0x55')](_0x195a76)){if(_0x1f72f9[_0x4228('0x52')][_0x1c441f][_0x48735d[_0x195a76]]){var _0x3d2a0c=_[_0x4228('0x56')](_0x1f72f9[_0x4228('0x52')][_0x1c441f][_0x48735d[_0x195a76]]['replace'](/"/g,'\x27'));switch(_0x195a76){case _0x4228('0x57'):var _0x74a771=moment(_0x3d2a0c,_0x4228('0xe'),!![]);if(_0x74a771[_0x4228('0x58')]()){_0x1753fd[_0x4228('0x41')]('\x22'+_0x3d2a0c+'\x22');}else{_0x510710[_0x4228('0x41')](_0x4228('0x59'));}break;case _0x4228('0x24'):var _0x1a4ef6=parseInt(_0x3d2a0c);_0x3d2a0c=_[_0x4228('0x5a')](_0x1a4ef6)||_0x1a4ef6<0x0||_0x1a4ef6>0x4?_0xa019b7?0x3:0x2:_0x1a4ef6;_0x1753fd['push']('\x22'+_0x3d2a0c+'\x22');break;case'UserId':var _0x431324=parseInt(_0x3d2a0c);if(_[_0x4228('0x5b')](_0x431324)&&_[_0x4228('0x5c')](_0x34c513,_0x431324)){_0x1753fd[_0x4228('0x41')]('\x22'+_0x431324+'\x22');}else{_0x510710['push'](_0x4228('0x5d'));}break;case _0x4228('0x5e'):if(isEmail(_0x3d2a0c)){_0x1753fd['push']('\x22'+_0x3d2a0c+'\x22');}else{_0x510710['push'](_0x4228('0x5f'));}break;case _0x4228('0x60'):var _0x3ddae9=moment(_0x3d2a0c,_0x4228('0x61'),!![]);if(_0x3ddae9[_0x4228('0x58')]()){_0x1753fd[_0x4228('0x41')]('\x22'+_0x3d2a0c+'\x22');}else{_0x510710[_0x4228('0x41')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1753fd[_0x4228('0x41')]('\x22'+_0x3d2a0c+'\x22');}}else{switch(_0x195a76){case _0x4228('0x62'):case _0x4228('0x20'):_0x510710[_0x4228('0x41')](_0x195a76+_0x4228('0x63'));break;default:_0x1753fd[_0x4228('0x41')]('\x22\x22');}}}}if(_0x510710[_0x4228('0x53')]){handleError(_0x1f72f9['data'][_0x1c441f],{'code':_0x4228('0x64'),'message':_0x510710[_0x4228('0x13')]()});}else{fs['appendFileSync'](_0x55851e,_0x1753fd[_0x4228('0x13')]()+'\x0a');}_0x1753fd=[];}if(!(stats['rows']%0xc8)){socket[_0x4228('0x65')]('contact:import:'+_0x2bf99f,stats);stats[_0x4228('0x40')]=[];}}if(stopped){logger[_0x4228('0x42')](_0x4228('0x66'));_0x3bf8ed['abort']();}}catch(_0x2a95c0){handleError(_0x1f72f9[_0x4228('0x52')][_0x1c441f],{'code':_0x4228('0x67'),'message':_0x2a95c0[_0x4228('0x68')]});logger[_0x4228('0x3f')](_0x4228('0x69'),_0x2a95c0[_0x4228('0x68')]);}},'complete':function(){try{var _0x1592e2=[];var _0x5a6e8b='cm_contacts';if(_0x45b5a0[_0x4228('0x6a')]&&_0x45b5a0[_0x4228('0x6a')]['length']){_0x5a6e8b=_0x4228('0x6b')+_0x2bf99f;_0x1592e2['push'](_0x4228('0x6c')+_0x5a6e8b+'\x20LIKE\x20cm_contacts;');}var _0x2b0d41=util['format'](_0x4228('0x6d'),_0x55851e,_0x5a6e8b,_0x2c7779,_0x45b5a0['ListId'],_0x45b5a0[_0x4228('0x38')]||null,NOW,NOW);if(_[_0x4228('0x6e')](_0x48735d[_0x4228('0x57')])){_0x2b0d41+=_0x4228('0x6f');}_0x1592e2[_0x4228('0x41')](_0x2b0d41);if(_0x45b5a0[_0x4228('0x6a')]&&_0x45b5a0[_0x4228('0x6a')][_0x4228('0x53')]){_0x1592e2[_0x4228('0x41')](insertCmContact(_0x45b5a0[_0x4228('0x32')],_0x5a6e8b,_0x45b5a0['duplicates'],_0x48735d));_0x1592e2[_0x4228('0x41')](_0x4228('0x70')+_0x5a6e8b+';');}_0x1592e2['push'](insertCmHopper(_0x45b5a0[_0x4228('0x32')],_0x4228('0x71'),'voice_queues','VoiceQueueId',_0xa019b7));_0x1592e2[_0x4228('0x41')](insertCmHopperBlack(_0x45b5a0[_0x4228('0x32')],'voice_queues_has_cm_blacklists',_0x4228('0x72'),_0x4228('0x73')));_0x1592e2[_0x4228('0x41')](insertCmHopper(_0x45b5a0[_0x4228('0x32')],_0x4228('0x74'),_0x4228('0x75'),_0x4228('0x76'),_0xa019b7));_0x1592e2[_0x4228('0x41')](insertCmHopperBlack(_0x45b5a0[_0x4228('0x32')],_0x4228('0x77'),'campaigns',_0x4228('0x76')));BPromise[_0x4228('0x78')](_0x1592e2,handleQuery)[_0x4228('0x79')](function(_0x5d968f){stats[_0x4228('0x7a')]=!![];stats[_0x4228('0x7b')]=_0x45b5a0[_0x4228('0x6a')]&&_0x45b5a0[_0x4228('0x6a')][_0x4228('0x53')]?results[0x2]['affectedRows']:results[0x0][_0x4228('0x7b')];socket[_0x4228('0x65')](_0x4228('0x7c')+_0x2bf99f,stats);fs[_0x4228('0x7d')](_0x1f1ac3);fs['unlink'](_0x55851e);process[_0x4228('0x7e')](0x0);})[_0x4228('0x46')](function(_0x58f4ce){logger[_0x4228('0x3f')](_0x58f4ce[_0x4228('0x68')]);process[_0x4228('0x7e')](0x1);});}catch(_0x3b9ec7){logger[_0x4228('0x3f')](_0x4228('0x7f'),_0x3b9ec7[_0x4228('0x68')]);process[_0x4228('0x7e')](0x1);}},'error':function(_0x3139a1,_0x44ec7b,_0x30200b,_0x3acbfa){throw new Error(_0x3acbfa);}});}function validate(){if(process[_0x4228('0x80')]&&process['argv'][_0x4228('0x53')]<0x4){throw new Error(_0x4228('0x81'));}var _0x50f2a0=path['join'](config[_0x4228('0x4b')],_0x4228('0x4c'),process[_0x4228('0x80')][0x2]);if(!fs['existsSync'](_0x50f2a0)){throw new Error(_0x4228('0x82'));}var _0x4f579c={};try{_0x4f579c=JSON[_0x4228('0x50')](process[_0x4228('0x80')][0x3]);if(!_0x4f579c['binding']){throw new Error(_0x4228('0x83'));}if(!_0x4f579c[_0x4228('0x84')][_0x4228('0x20')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4f579c[_0x4228('0x84')]['firstName']){throw new Error(_0x4228('0x85'));}var _0x36fd69=0x0;if(_0x4f579c['binding']['UserId']){_0x36fd69=0x1;}if(!_0x4f579c[_0x4228('0x32')]){throw new Error(_0x4228('0x86'));}}catch(_0x1ab139){throw new Error(_0x4228('0x87'));}var _0x4519d4=[];try{_0x4519d4=_[_0x4228('0x88')](JSON[_0x4228('0x50')](process[_0x4228('0x80')][0x4]),'id');}catch(_0x3b6f6c){logger[_0x4228('0x42')](_0x4228('0x89'));}main(_0x50f2a0,_0x4f579c,_0x4519d4,_0x36fd69);}validate();process['on']('SIGINT',handleStop);process['on'](_0x4228('0x8a'),handleUncaughtException); \ No newline at end of file +var _0xdc91=['firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','select','cm_contacts','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','query','spread','send','binding','socket_timestamp','server/files/tmp','.csv','keys','header','writeFileSync','parse','createReadStream','length','rows','data','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','then','affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory'];(function(_0x261b08,_0x563d91){var _0xeeaf84=function(_0x5aeb4b){while(--_0x5aeb4b){_0x261b08['push'](_0x261b08['shift']());}};_0xeeaf84(++_0x563d91);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1110db,_0x38b211){_0x1110db=_0x1110db-0x0;var _0x39652c=_0xdc91[_0x1110db];return _0x39652c;};'use strict';var fs=require('fs');var path=require(_0x1dc9('0x0'));var _=require(_0x1dc9('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x1dc9('0x2'));var Redis=require(_0x1dc9('0x3'));var db=require(_0x1dc9('0x4'))['db'];var config=require(_0x1dc9('0x5'));var logger=require(_0x1dc9('0x6'))(_0x1dc9('0x7'));config[_0x1dc9('0x8')]=_[_0x1dc9('0x9')](config['redis'],{'host':_0x1dc9('0xa'),'port':0x18eb});var socket=require(_0x1dc9('0xb'))(new Redis(config[_0x1dc9('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x1dc9('0xc')](_0x1dc9('0xd'));function isEmail(_0x22bf3f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1dc9('0xe')](_0x22bf3f);}function selectNotIn(_0x2e2e69,_0x32a428,_0x107459,_0x5ab573,_0x356525){return squel['select']()[_0x1dc9('0xf')]('phone')[_0x1dc9('0x10')](_0x5ab573)[_0x1dc9('0x11')](_0x32a428,null,_0x32a428+_0x1dc9('0x12')+_0x5ab573+'.'+_0x107459)[_0x1dc9('0x13')](_0x5ab573+'.'+_0x107459+'\x20=\x20'+_0x2e2e69+'.'+_0x107459)[_0x1dc9('0x13')](_0x32a428+_0x1dc9('0x14')+_0x356525['join']()+')');}function insertCmHopper(_0x41c335,_0x39919e,_0x4fb23f,_0x5daaec,_0x8257d3){var _0x197488=[_0x1dc9('0x15'),_0x1dc9('0x16'),'cm_contacts.id','cm_contacts.ListId',_0x39919e+'.'+_0x5daaec,_0x1dc9('0x17'),_0x1dc9('0x18'),'cm_contacts.priority',_0x1dc9('0x19'),'\x22'+_0x8257d3+'\x22'];return squel[_0x1dc9('0x1a')]()[_0x1dc9('0x1b')](_0x1dc9('0x1c'))[_0x1dc9('0x1d')]([_0x1dc9('0x1e'),_0x1dc9('0x1f'),_0x1dc9('0x20'),_0x1dc9('0x21'),_0x5daaec,_0x1dc9('0x22'),_0x1dc9('0x23'),_0x1dc9('0x24'),_0x1dc9('0x25'),'recallme'],squel['select']()[_0x1dc9('0x26')](_0x197488)['from'](_0x39919e)['join']('cm_contacts',null,_0x1dc9('0x27')+_0x39919e+_0x1dc9('0x28'))[_0x1dc9('0x11')](_0x4fb23f,null,_0x4fb23f+_0x1dc9('0x12')+_0x39919e+'.'+_0x5daaec)[_0x1dc9('0x13')](_0x39919e+_0x1dc9('0x29'),_0x41c335)[_0x1dc9('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1dc9('0x13')](_0x1dc9('0x2a'),selectNotIn(_0x39919e,_0x4fb23f,_0x5daaec,_0x1dc9('0x1c'),['\x22always\x22',_0x1dc9('0x2b')]))[_0x1dc9('0x13')](_0x1dc9('0x2a'),selectNotIn(_0x39919e,_0x4fb23f,_0x5daaec,_0x1dc9('0x1c'),[_0x1dc9('0x2c')])))[_0x1dc9('0x2d')]();}function insertCmHopperBlack(_0x179498,_0x152b48,_0x3e70c3,_0x59f588){var _0x5635e5=[_0x1dc9('0x15'),_0x1dc9('0x2e'),_0x1dc9('0x2f'),_0x152b48+'.'+_0x59f588,_0x1dc9('0x17'),_0x1dc9('0x18')];return squel[_0x1dc9('0x1a')]()[_0x1dc9('0x1b')](_0x1dc9('0x30'))[_0x1dc9('0x1d')](['phone',_0x1dc9('0x20'),_0x1dc9('0x21'),_0x59f588,_0x1dc9('0x22'),_0x1dc9('0x23')],squel[_0x1dc9('0x31')]()[_0x1dc9('0x26')](_0x5635e5)['from'](_0x152b48)['join'](_0x1dc9('0x32'),null,_0x1dc9('0x27')+_0x152b48+'.CmListId')[_0x1dc9('0x11')](_0x3e70c3,null,_0x3e70c3+_0x1dc9('0x12')+_0x152b48+'.'+_0x59f588)[_0x1dc9('0x13')](_0x152b48+'.CmListId\x20=\x20?',_0x179498)[_0x1dc9('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1dc9('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x1dc9('0xf')](_0x1dc9('0x1e'))[_0x1dc9('0x10')](_0x1dc9('0x30'))['where'](_0x1dc9('0x33'),_0x179498)['where'](_0x59f588+_0x1dc9('0x34'),_0x152b48+'.'+_0x59f588)))[_0x1dc9('0x2d')]();}function insertCmContact(_0x16ba99,_0xf69724,_0x1d6bee,_0x2d3b0b){var _0x40bd50=_[_0x1dc9('0x35')](_['keys'](_0x2d3b0b),['ListId',_0x1dc9('0x36'),_0x1dc9('0x22'),_0x1dc9('0x23')]);return squel[_0x1dc9('0x1a')]()['into'](_0x1dc9('0x32'))['fromQuery'](_0x40bd50,squel[_0x1dc9('0x31')]()[_0x1dc9('0x26')](_0x40bd50)[_0x1dc9('0x10')](_0xf69724)[_0x1dc9('0x13')]('('+_0x1d6bee[_0x1dc9('0x11')](',')+_0x1dc9('0x37'),squel['select']()[_0x1dc9('0x26')](_0x1d6bee)[_0x1dc9('0x10')](_0x1dc9('0x32'))[_0x1dc9('0x13')](_0x1dc9('0x33'),_0x16ba99)[_0x1dc9('0x13')]('deletedAt\x20IS\x20NULL'))[_0x1dc9('0x13')](_0x1dc9('0x38'),squel[_0x1dc9('0x31')]()[_0x1dc9('0xf')]('MIN(id)',_0x1dc9('0x39'))[_0x1dc9('0x10')](_0xf69724)[_0x1dc9('0x3a')](_0x1d6bee[_0x1dc9('0x11')](','))))[_0x1dc9('0x2d')]();}function handleStop(){logger[_0x1dc9('0x3b')](_0x1dc9('0x3c'));stopped=!![];}function handleUncaughtException(_0x1a23c1){logger[_0x1dc9('0x3d')](_0x1a23c1[_0x1dc9('0x3e')]);process[_0x1dc9('0x3f')](0x1);}function handleError(_0x38832d,_0x19b0c2){stats[_0x1dc9('0x40')][_0x1dc9('0x41')]({'name':_0x19b0c2[_0x1dc9('0x42')],'message':_0x19b0c2[_0x1dc9('0x3e')],'row':_0x38832d});}function handleQuery(_0x3188cb){logger[_0x1dc9('0x3b')](_0x3188cb);return db['sequelize'][_0x1dc9('0x43')](_0x3188cb)[_0x1dc9('0x44')](function(_0x3a3033){results[_0x1dc9('0x41')](_0x3a3033);})['catch'](function(_0x44ac64){logger[_0x1dc9('0x3d')](_0x44ac64[_0x1dc9('0x3e')]);});}function main(_0x2a2d42,_0x24aff4,_0x437436,_0x145a17){logger[_0x1dc9('0x3b')]('main',_0x2a2d42,JSON['stringify'](_0x24aff4));process[_0x1dc9('0x45')]('start');var _0xab8eb1=_0x24aff4[_0x1dc9('0x46')];var _0x51943d=_0x24aff4[_0x1dc9('0x47')];var _0x4613f0=path[_0x1dc9('0x11')](config['root'],_0x1dc9('0x48'),_0x51943d+_0x1dc9('0x49'));var _0x2f38ad=_[_0x1dc9('0x4a')](_0xab8eb1)[_0x1dc9('0x11')]();logger[_0x1dc9('0x3b')](_0x1dc9('0x4b'),_0x2f38ad);fs[_0x1dc9('0x4c')](_0x4613f0,_0x2f38ad+'\x0a');Papa[_0x1dc9('0x4d')](fs[_0x1dc9('0x4e')](_0x2a2d42),{'header':!![],'skipEmptyLines':!![],'step':function(_0x51bc90,_0x419ee3){try{for(var _0x4780c2=0x0,_0x27ac48=[];_0x4780c2<_0x51bc90['data'][_0x1dc9('0x4f')];_0x4780c2++){stats[_0x1dc9('0x50')]+=0x1;if(_0x51bc90[_0x1dc9('0x40')][_0x4780c2]){handleError(_0x51bc90[_0x1dc9('0x51')][_0x4780c2],_0x51bc90[_0x1dc9('0x40')][_0x4780c2]);}else{var _0x1f2916=[];for(var _0x170253 in _0xab8eb1){if(_0xab8eb1['hasOwnProperty'](_0x170253)){if(_0x51bc90[_0x1dc9('0x51')][_0x4780c2][_0xab8eb1[_0x170253]]){var _0x120f26=_[_0x1dc9('0x52')](_0x51bc90['data'][_0x4780c2][_0xab8eb1[_0x170253]][_0x1dc9('0x53')](/"/g,'\x27'));switch(_0x170253){case'scheduledat':var _0x46b74b=moment(_0x120f26,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x46b74b['isValid']()){_0x27ac48[_0x1dc9('0x41')]('\x22'+_0x120f26+'\x22');}else{_0x1f2916[_0x1dc9('0x41')](_0x1dc9('0x54'));}break;case _0x1dc9('0x24'):var _0x3b5284=parseInt(_0x120f26);_0x120f26=_['isNaN'](_0x3b5284)||_0x3b5284<0x0||_0x3b5284>0x4?_0x145a17?0x3:0x2:_0x3b5284;_0x27ac48[_0x1dc9('0x41')]('\x22'+_0x120f26+'\x22');break;case _0x1dc9('0x25'):var _0x1d7462=parseInt(_0x120f26);if(_[_0x1dc9('0x55')](_0x1d7462)&&_[_0x1dc9('0x56')](_0x437436,_0x1d7462)){_0x27ac48['push']('\x22'+_0x1d7462+'\x22');}else{_0x1f2916['push']('agent\x20not\x20exists');}break;case _0x1dc9('0x57'):if(isEmail(_0x120f26)){_0x27ac48['push']('\x22'+_0x120f26+'\x22');}else{_0x1f2916[_0x1dc9('0x41')](_0x1dc9('0x58'));}break;case _0x1dc9('0x59'):var _0x45fe79=moment(_0x120f26,_0x1dc9('0x5a'),!![]);if(_0x45fe79['isValid']()){_0x27ac48[_0x1dc9('0x41')]('\x22'+_0x120f26+'\x22');}else{_0x1f2916[_0x1dc9('0x41')](_0x1dc9('0x5b'));}break;default:_0x27ac48['push']('\x22'+_0x120f26+'\x22');}}else{switch(_0x170253){case _0x1dc9('0x5c'):case _0x1dc9('0x1e'):_0x1f2916[_0x1dc9('0x41')](_0x170253+'\x20not\x20specified');break;default:_0x27ac48[_0x1dc9('0x41')]('\x22\x22');}}}}if(_0x1f2916[_0x1dc9('0x4f')]){handleError(_0x51bc90['data'][_0x4780c2],{'code':_0x1dc9('0x5d'),'message':_0x1f2916[_0x1dc9('0x11')]()});}else{fs[_0x1dc9('0x5e')](_0x4613f0,_0x27ac48[_0x1dc9('0x11')]()+'\x0a');}_0x27ac48=[];}if(!(stats[_0x1dc9('0x50')]%0xc8)){socket[_0x1dc9('0x5f')](_0x1dc9('0x60')+_0x51943d,stats);stats['errors']=[];}}if(stopped){logger[_0x1dc9('0x3b')]('Abort\x20parser');_0x419ee3[_0x1dc9('0x61')]();}}catch(_0x720949){handleError(_0x51bc90[_0x1dc9('0x51')][_0x4780c2],{'code':_0x1dc9('0x62'),'message':_0x720949['message']});logger[_0x1dc9('0x3d')](_0x1dc9('0x63'),_0x720949[_0x1dc9('0x3e')]);}},'complete':function(){try{var _0x26cc02=[];var _0x373f22='cm_contacts';if(_0x24aff4[_0x1dc9('0x64')]&&_0x24aff4['duplicates']['length']){_0x373f22=_0x1dc9('0x65')+_0x51943d;_0x26cc02[_0x1dc9('0x41')]('CREATE\x20TABLE\x20'+_0x373f22+_0x1dc9('0x66'));}var _0x5ca806=util[_0x1dc9('0xc')](_0x1dc9('0x67'),_0x4613f0,_0x373f22,_0x2f38ad,_0x24aff4[_0x1dc9('0x21')],_0x24aff4[_0x1dc9('0x36')]||null,NOW,NOW);if(_[_0x1dc9('0x68')](_0xab8eb1[_0x1dc9('0x1f')])){_0x5ca806+=',\x20scheduledAt\x20=\x20NOW()';}_0x26cc02[_0x1dc9('0x41')](_0x5ca806);if(_0x24aff4['duplicates']&&_0x24aff4[_0x1dc9('0x64')][_0x1dc9('0x4f')]){_0x26cc02[_0x1dc9('0x41')](insertCmContact(_0x24aff4[_0x1dc9('0x21')],_0x373f22,_0x24aff4[_0x1dc9('0x64')],_0xab8eb1));_0x26cc02[_0x1dc9('0x41')](_0x1dc9('0x69')+_0x373f22+';');}_0x26cc02[_0x1dc9('0x41')](insertCmHopper(_0x24aff4['ListId'],_0x1dc9('0x6a'),_0x1dc9('0x6b'),_0x1dc9('0x6c'),_0x145a17));_0x26cc02[_0x1dc9('0x41')](insertCmHopperBlack(_0x24aff4[_0x1dc9('0x21')],_0x1dc9('0x6d'),_0x1dc9('0x6b'),_0x1dc9('0x6c')));_0x26cc02[_0x1dc9('0x41')](insertCmHopper(_0x24aff4['ListId'],_0x1dc9('0x6e'),'campaigns',_0x1dc9('0x6f'),_0x145a17));_0x26cc02[_0x1dc9('0x41')](insertCmHopperBlack(_0x24aff4[_0x1dc9('0x21')],_0x1dc9('0x70'),_0x1dc9('0x71'),'CampaignId'));BPromise['each'](_0x26cc02,handleQuery)[_0x1dc9('0x72')](function(_0x2155e4){stats['finish']=!![];stats[_0x1dc9('0x73')]=_0x24aff4[_0x1dc9('0x64')]&&_0x24aff4['duplicates'][_0x1dc9('0x4f')]?results[0x2][_0x1dc9('0x73')]:results[0x0][_0x1dc9('0x73')];socket[_0x1dc9('0x5f')](_0x1dc9('0x60')+_0x51943d,stats);fs[_0x1dc9('0x74')](_0x2a2d42);fs[_0x1dc9('0x74')](_0x4613f0);process[_0x1dc9('0x3f')](0x0);})[_0x1dc9('0x75')](function(_0x5ad8b1){logger[_0x1dc9('0x3d')](_0x5ad8b1[_0x1dc9('0x3e')]);process[_0x1dc9('0x3f')](0x1);});}catch(_0xa3e3eb){logger[_0x1dc9('0x3d')](_0x1dc9('0x76'),_0xa3e3eb[_0x1dc9('0x3e')]);process[_0x1dc9('0x3f')](0x1);}},'error':function(_0x4e179c,_0x439bbd,_0x21ec3a,_0x56f1ff){throw new Error(_0x56f1ff);}});}function validate(){if(process[_0x1dc9('0x77')]&&process['argv']['length']<0x4){throw new Error(_0x1dc9('0x78'));}var _0x4059eb=path[_0x1dc9('0x11')](config[_0x1dc9('0x79')],_0x1dc9('0x48'),process['argv'][0x2]);if(!fs['existsSync'](_0x4059eb)){throw new Error(_0x1dc9('0x7a'));}var _0xa321a1={};try{_0xa321a1=JSON[_0x1dc9('0x4d')](process[_0x1dc9('0x77')][0x3]);if(!_0xa321a1[_0x1dc9('0x46')]){throw new Error(_0x1dc9('0x7b'));}if(!_0xa321a1[_0x1dc9('0x46')][_0x1dc9('0x1e')]){throw new Error(_0x1dc9('0x7c'));}if(!_0xa321a1[_0x1dc9('0x46')]['firstName']){throw new Error(_0x1dc9('0x7d'));}var _0xeefa0f=0x0;if(_0xa321a1[_0x1dc9('0x46')][_0x1dc9('0x25')]){_0xeefa0f=0x1;}if(!_0xa321a1[_0x1dc9('0x21')]){throw new Error(_0x1dc9('0x7e'));}}catch(_0x244423){throw new Error(_0x1dc9('0x7f'));}var _0x57ac35=[];try{_0x57ac35=_[_0x1dc9('0x80')](JSON[_0x1dc9('0x4d')](process['argv'][0x4]),'id');}catch(_0x5948d9){logger[_0x1dc9('0x3b')](_0x1dc9('0x81'));}main(_0x4059eb,_0xa321a1,_0x57ac35,_0xeefa0f);}validate();process['on'](_0x1dc9('0x82'),handleStop);process['on'](_0x1dc9('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 9cd15bb..9396b63 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 _0x4e0e=['contactTypeId','orderBy','DROP\x20TABLE\x20','finish','contact:import:','unlink','catch','complete','existsSync','file\x20doesn\x27t\x20exists','argv','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','uncaughtException','path','lodash','util','bluebird','moment','squel','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','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','error','split','findOne','CmContactHasItem','update','updated','create','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','ContactId','createdAt','fields','cm_contacts','cm_hopper_black','ListId\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_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','min_id','group','Received\x20SIGINT','message','exit','errors','code','info','sequelize','query','main','stringify','send','binding','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','parse','data','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','Abort\x20parser','abort','SystemError','step','\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','contactId'];(function(_0x25a2f0,_0x4bda90){var _0x1a160a=function(_0x565138){while(--_0x565138){_0x25a2f0['push'](_0x25a2f0['shift']());}};_0x1a160a(++_0x4bda90);}(_0x4e0e,0x1d4));var _0xe4e0=function(_0x54f3db,_0x69097d){_0x54f3db=_0x54f3db-0x0;var _0x42a971=_0x4e0e[_0x54f3db];return _0x42a971;};'use strict';var fs=require('fs');var path=require(_0xe4e0('0x0'));var _=require(_0xe4e0('0x1'));var Papa=require('papaparse');var util=require(_0xe4e0('0x2'));var BPromise=require(_0xe4e0('0x3'));var moment=require(_0xe4e0('0x4'));var squel=require(_0xe4e0('0x5'));var Redis=require(_0xe4e0('0x6'));var db=require(_0xe4e0('0x7'))['db'];var config=require(_0xe4e0('0x8'));var logger=require(_0xe4e0('0x9'))('import');config[_0xe4e0('0xa')]=_[_0xe4e0('0xb')](config[_0xe4e0('0xa')],{'host':_0xe4e0('0xc'),'port':0x18eb});var socket=require(_0xe4e0('0xd'))(new Redis(config[_0xe4e0('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xe4e0('0xe')](_0xe4e0('0xf'));var tempTableName='cm_contacts_temp_'+moment()[_0xe4e0('0xe')](_0xe4e0('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x9ad206){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))*$/[_0xe4e0('0x11')](_0x9ad206);}function selectNotIn(_0x1f5ae0,_0x291530,_0x5280a2,_0x18beac,_0x400844){return squel[_0xe4e0('0x12')]()[_0xe4e0('0x13')](_0xe4e0('0x14'))[_0xe4e0('0x15')](_0x18beac)[_0xe4e0('0x16')](_0x291530,null,_0x291530+_0xe4e0('0x17')+_0x18beac+'.'+_0x5280a2)[_0xe4e0('0x18')](_0x18beac+'.'+_0x5280a2+'\x20=\x20'+_0x1f5ae0+'.'+_0x5280a2)['where'](_0x291530+_0xe4e0('0x19')+_0x400844['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3e7658,_0x216841){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0xe4e0('0x1a')+tempTableName)[_0xe4e0('0x1b')](function(_0x4a5ebf){if(_0x4a5ebf!==null){var _0x50506c=[];for(var _0x32ca12=0x0;_0x32ca12<_0x4a5ebf[_0xe4e0('0x1c')];_0x32ca12++){var _0x17ff2b=_0x4a5ebf[_0x32ca12];if(!_[_0xe4e0('0x1d')](_0x17ff2b[_0xe4e0('0x14')])){if(!_['isNil'](_0x17ff2b[_0xe4e0('0x1e')]))_0x50506c['push'](insertAdditionalPhones(_0x17ff2b));promisesContact[_0xe4e0('0x1f')]({'contact':_0x17ff2b});}}}Promise[_0xe4e0('0x20')](_0x50506c)[_0xe4e0('0x21')](function(){_0x3e7658({'val':0x1});});})['catch'](function(_0x1c0c6f){logger[_0xe4e0('0x22')](_0x1c0c6f['message']);});});}function insertAdditionalPhones(_0x21e15e){return new Promise(function(_0x25bede,_0x1b3963){var _0x447221=_0x21e15e[_0xe4e0('0x1e')];if(_[_0xe4e0('0x1d')](_0x447221))_0x1b3963({'val':0x0});else{var _0x2303de=_0x447221[_0xe4e0('0x23')](';');var _0x4f8515=[];orderBy=0x0;for(var _0x1c64f8=0x0;_0x1c64f8<_0x2303de[_0xe4e0('0x1c')];_0x1c64f8++){_0x4f8515['push'](splitAdditionalPhone(_0x21e15e['id'],_0x2303de[_0x1c64f8]));}Promise[_0xe4e0('0x20')](_0x4f8515)[_0xe4e0('0x21')](function(){_0x25bede({'val':_0x2303de[_0xe4e0('0x1c')]});});}});}function splitAdditionalPhone(_0x272d71,_0xcc94c6){return new Promise(function(_0x949376,_0x38b7f6){var _0x2db8c9=_0xcc94c6[_0xe4e0('0x23')](':');var _0x45f968=_0x2db8c9[0x0];var _0x9882ae=_0x2db8c9[0x1];if(_0x9882ae!==''){var _0x3ef6bb=_0x9882ae[_0xe4e0('0x23')]('|');var _0x5cb1a1=[];for(var _0x416e37=0x0;_0x416e37<_0x3ef6bb[_0xe4e0('0x1c')];_0x416e37++){if(_0x3ef6bb[_0x416e37]!==''){var _0x1c9a31=_['filter'](promisesAdditionalPhones,{'contactId':_0x272d71,'phone':_0x3ef6bb[_0x416e37]});if(_0x1c9a31[_0xe4e0('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xe4e0('0x1f')]({'contactId':_0x272d71,'contactTypeId':_0x45f968,'phone':_0x3ef6bb[_0x416e37],'orderBy':orderBy});}}}_0x949376({'ok':0x1});}else _0x949376({'res':0x0});});}function createAdditionalPhone(_0x5423d3,_0x4b5009,_0x5ccc13,_0x4ba5af){return new Promise(function(_0x156f95,_0x464aa3){return db['CmContactHasItem'][_0xe4e0('0x24')]({'where':{'CmContactId':_0x5423d3,'item':_0x5ccc13}})[_0xe4e0('0x21')](function(_0x191ba3){if(_0x191ba3){return db[_0xe4e0('0x25')][_0xe4e0('0x26')]({'ItemTypeId':_0x4b5009,'OrderBy':_0x4ba5af},{'where':{'CmContactId':_0x5423d3,'item':_0x5ccc13}})[_0xe4e0('0x21')](function(_0x53a14f){_0x156f95({'res':_0xe4e0('0x27')});});}else{return db['CmContactHasItem'][_0xe4e0('0x28')]({'CmContactId':_0x5423d3,'item':_0x5ccc13,'ItemTypeId':_0x4b5009,'OrderBy':_0x4ba5af,'ItemClass':'PHONE'})[_0xe4e0('0x21')](function(_0x14b2ba){_0x156f95({'res':_0xe4e0('0x29')});});}});});}function updateContact(_0x546983){return new Promise(function(_0x1b8bee,_0x251089){var _0x1ce9c7=_0x546983['id'];delete _0x546983['id'];return db['CmContact']['update'](_0x546983,{'where':{'id':_0x1ce9c7}})['then'](function(_0x4158d4){updatedRows+=0x1;return db[_0xe4e0('0x2a')]['update']({'phone':_0x546983[_0xe4e0('0x14')]},{'where':{'ContactId':_0x1ce9c7}})[_0xe4e0('0x21')](function(_0x3b2f00){_0x1b8bee({'ret':'OK'});});});});}function insertCmHopper(_0x47fb10,_0x59e004,_0x4c6a37,_0x36909e,_0x5eecee){var _0x5c5c8c=[_0xe4e0('0x2b'),_0xe4e0('0x2c'),_0xe4e0('0x2d'),'cm_contacts.ListId',_0x59e004+'.'+_0x36909e,_0xe4e0('0x2e'),_0xe4e0('0x2f'),_0xe4e0('0x30'),_0xe4e0('0x31'),'\x22'+_0x5eecee+'\x22'];return squel[_0xe4e0('0x32')]()[_0xe4e0('0x33')](_0xe4e0('0x34'))[_0xe4e0('0x35')]([_0xe4e0('0x14'),_0xe4e0('0x36'),'ContactId',_0xe4e0('0x37'),_0x36909e,'createdAt',_0xe4e0('0x38'),_0xe4e0('0x39'),_0xe4e0('0x3a'),_0xe4e0('0x3b')],squel[_0xe4e0('0x12')]()['fields'](_0x5c5c8c)['from'](_0x59e004)['join']('cm_contacts',null,_0xe4e0('0x3c')+_0x59e004+_0xe4e0('0x3d'))[_0xe4e0('0x16')](_0x4c6a37,null,_0x4c6a37+'.id\x20=\x20'+_0x59e004+'.'+_0x36909e)[_0xe4e0('0x18')](_0x59e004+_0xe4e0('0x3e'),_0x47fb10)[_0xe4e0('0x18')](_0xe4e0('0x3f'),NOW)[_0xe4e0('0x18')](_0xe4e0('0x40'),selectNotIn(_0x59e004,_0x4c6a37,_0x36909e,'cm_hopper',[_0xe4e0('0x41'),'\x22onlyIfOpen\x22']))[_0xe4e0('0x18')](_0xe4e0('0x40'),selectNotIn(_0x59e004,_0x4c6a37,_0x36909e,_0xe4e0('0x34'),[_0xe4e0('0x41')])))[_0xe4e0('0x42')]();}function insertCmHopperBlack(_0x5eb635,_0x2cf1fe,_0x24c475,_0x33e88d){var _0x25f297=[_0xe4e0('0x2b'),_0xe4e0('0x2d'),'cm_contacts.ListId',_0x2cf1fe+'.'+_0x33e88d,'cm_contacts.createdAt',_0xe4e0('0x2f')];return squel['insert']()[_0xe4e0('0x33')]('cm_hopper_black')['fromQuery']([_0xe4e0('0x14'),_0xe4e0('0x43'),_0xe4e0('0x37'),_0x33e88d,_0xe4e0('0x44'),'updatedAt'],squel[_0xe4e0('0x12')]()[_0xe4e0('0x45')](_0x25f297)[_0xe4e0('0x15')](_0x2cf1fe)[_0xe4e0('0x16')](_0xe4e0('0x46'),null,_0xe4e0('0x3c')+_0x2cf1fe+_0xe4e0('0x3d'))[_0xe4e0('0x16')](_0x24c475,null,_0x24c475+_0xe4e0('0x17')+_0x2cf1fe+'.'+_0x33e88d)['where'](_0x2cf1fe+_0xe4e0('0x3e'),_0x5eb635)['where'](_0xe4e0('0x3f'),NOW)[_0xe4e0('0x18')](_0xe4e0('0x40'),squel[_0xe4e0('0x12')]()[_0xe4e0('0x13')](_0xe4e0('0x14'))['from'](_0xe4e0('0x47'))['where'](_0xe4e0('0x48'),_0x5eb635)[_0xe4e0('0x18')](_0x33e88d+'\x20=\x20?',_0x2cf1fe+'.'+_0x33e88d)))['toString']();}function insertCmHopperAdditionalPhones(_0x586aed){var _0x51d783=[_0xe4e0('0x49'),_0xe4e0('0x4a'),'cm_contact_has_items.OrderBy',_0xe4e0('0x4b'),_0xe4e0('0x4c')];return squel[_0xe4e0('0x32')]()[_0xe4e0('0x33')](_0xe4e0('0x4d'))['fromQuery']([_0xe4e0('0x4e'),_0xe4e0('0x14'),_0xe4e0('0x4f'),'createdAt',_0xe4e0('0x38')],squel['select']()[_0xe4e0('0x45')](_0x51d783)[_0xe4e0('0x15')]('cm_hopper')['join'](_0xe4e0('0x46'),null,_0xe4e0('0x50'))[_0xe4e0('0x16')](_0xe4e0('0x51'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xe4e0('0x18')](_0xe4e0('0x52'),_0x586aed)['where'](_0xe4e0('0x3f'),NOW))[_0xe4e0('0x42')]();}function insertCmContact(_0x773099,_0x1bdc18,_0xcf9a1b,_0x4768bf){var _0x40c54a=_[_0xe4e0('0x53')](_[_0xe4e0('0x54')](_0x4768bf),[_0xe4e0('0x37'),_0xe4e0('0x55'),'createdAt',_0xe4e0('0x38')]);return squel['insert']()[_0xe4e0('0x33')]('cm_contacts')[_0xe4e0('0x35')](_0x40c54a,squel[_0xe4e0('0x12')]()[_0xe4e0('0x45')](_0x40c54a)[_0xe4e0('0x15')](_0x1bdc18)[_0xe4e0('0x18')]('('+_0xcf9a1b[_0xe4e0('0x16')](',')+')\x20NOT\x20IN\x20?',squel[_0xe4e0('0x12')]()[_0xe4e0('0x45')](_0xcf9a1b)[_0xe4e0('0x15')]('cm_contacts')['where']('ListId\x20=\x20?',_0x773099))[_0xe4e0('0x18')]('id\x20IN\x20?',squel[_0xe4e0('0x12')]()[_0xe4e0('0x13')]('MIN(id)',_0xe4e0('0x56'))[_0xe4e0('0x15')](_0x1bdc18)[_0xe4e0('0x57')](_0xcf9a1b['join'](','))))[_0xe4e0('0x42')]();}function handleStop(){logger['info'](_0xe4e0('0x58'));stopped=!![];}function handleUncaughtException(_0x125592){logger[_0xe4e0('0x22')](_0x125592[_0xe4e0('0x59')]);process[_0xe4e0('0x5a')](0x1);}function handleError(_0x2d08dd,_0x27d340){stats[_0xe4e0('0x5b')][_0xe4e0('0x1f')]({'name':_0x27d340[_0xe4e0('0x5c')],'message':_0x27d340[_0xe4e0('0x59')],'row':_0x2d08dd});}function handleQuery(_0x38a3f0){logger[_0xe4e0('0x5d')](_0x38a3f0);return db[_0xe4e0('0x5e')][_0xe4e0('0x5f')](_0x38a3f0)[_0xe4e0('0x1b')](function(_0x54b3af){results[_0xe4e0('0x1f')](_0x54b3af);})['catch'](function(_0x386d50){logger[_0xe4e0('0x22')](_0x386d50[_0xe4e0('0x59')]);});}function main(_0x43b4e1,_0x1b6986,_0x5cdccb,_0x18c092){logger[_0xe4e0('0x5d')](_0xe4e0('0x60'),_0x43b4e1,JSON[_0xe4e0('0x61')](_0x1b6986));process[_0xe4e0('0x62')]('start');var _0x309b8f=_0x1b6986[_0xe4e0('0x63')];var _0x4a8a13=_['clone'](_0x309b8f);var _0x22db76=_0x1b6986[_0xe4e0('0x64')];var _0x2acbe2=path[_0xe4e0('0x16')](config['root'],_0xe4e0('0x65'),_0x22db76+_0xe4e0('0x66'));logger[_0xe4e0('0x5d')](_0xe4e0('0x67'),_0x1b6986);db[_0xe4e0('0x68')][_0xe4e0('0x69')]({'raw':!![],'attributes':['id',_0xe4e0('0x6a')]})[_0xe4e0('0x21')](function(_0x26beb7){for(var _0x2ca698=0x0;_0x2ca698<_0x26beb7[_0xe4e0('0x1c')];_0x2ca698++){if(_0x26beb7[_0x2ca698][_0xe4e0('0x6a')]in _0x309b8f){contactItemTypes[_0xe4e0('0x1f')](_0x26beb7[_0x2ca698]);delete _0x4a8a13[_0x26beb7[_0x2ca698][_0xe4e0('0x6a')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x4a8a13[_0xe4e0('0x1e')]='';var _0x55a98b=_[_0xe4e0('0x54')](_0x4a8a13)['join']();logger['info'](_0xe4e0('0x6b'),_0x55a98b);fs[_0xe4e0('0x6c')](_0x2acbe2,_0x55a98b+'\x0a');Papa[_0xe4e0('0x6d')](fs['createReadStream'](_0x43b4e1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x204a6c,_0x412bb9){try{for(var _0x4dc118=0x0,_0x5839d7=[];_0x4dc118<_0x204a6c[_0xe4e0('0x6e')]['length'];_0x4dc118++){stats['rows']+=0x1;if(_0x204a6c[_0xe4e0('0x5b')][_0x4dc118]){handleError(_0x204a6c['data'][_0x4dc118],_0x204a6c['errors'][_0x4dc118]);}else{var _0x4af733=[];var _0x2d883c=[];for(var _0x1a357f in _0x309b8f){let _0x2d3f0d=contactItemTypes['find'](_0x5717f2=>_0x5717f2['name']===_0x1a357f);if(_['isNil'](_0x2d3f0d)){if(_0x309b8f[_0xe4e0('0x6f')](_0x1a357f)){if(_0x204a6c[_0xe4e0('0x6e')][_0x4dc118][_0x309b8f[_0x1a357f]]){var _0x1e6224=_[_0xe4e0('0x70')](_0x204a6c[_0xe4e0('0x6e')][_0x4dc118][_0x309b8f[_0x1a357f]]['replace'](/"/g,'\x27'));switch(_0x1a357f){case _0xe4e0('0x36'):var _0x106c34=moment(_0x1e6224,_0xe4e0('0xf'),!![]);if(_0x106c34[_0xe4e0('0x71')]()){_0x5839d7['push']('\x22'+_0x1e6224+'\x22');}else{_0x4af733[_0xe4e0('0x1f')](_0xe4e0('0x72'));}break;case'priority':var _0x1bd059=parseInt(_0x1e6224);_0x1e6224=_['isNaN'](_0x1bd059)||_0x1bd059<0x0||_0x1bd059>0x4?_0x18c092?0x3:0x2:_0x1bd059;_0x5839d7['push']('\x22'+_0x1e6224+'\x22');break;case _0xe4e0('0x3a'):var _0x4663b8=parseInt(_0x1e6224);if(_[_0xe4e0('0x73')](_0x4663b8)&&_['includes'](_0x5cdccb,_0x4663b8)){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x4663b8+'\x22');}else{_0x4af733[_0xe4e0('0x1f')]('agent\x20not\x20exists');}break;case _0xe4e0('0x74'):if(isEmail(_0x1e6224)){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x1e6224+'\x22');}else{_0x4af733[_0xe4e0('0x1f')](_0xe4e0('0x75'));}break;case'dateOfBirth':var _0x24dca5=moment(_0x1e6224,_0xe4e0('0x76'),!![]);if(_0x24dca5[_0xe4e0('0x71')]()){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x1e6224+'\x22');}else{_0x4af733[_0xe4e0('0x1f')](_0xe4e0('0x77'));}break;default:_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x1e6224+'\x22');}}else{switch(_0x1a357f){case _0xe4e0('0x78'):case'phone':_0x4af733[_0xe4e0('0x1f')](_0x1a357f+_0xe4e0('0x79'));break;default:_0x5839d7[_0xe4e0('0x1f')]('\x22\x22');}}}}else{var _0x479c71='';for(var _0x2d1d15=0x0;_0x2d1d15<_0x309b8f[_0x1a357f]['length'];_0x2d1d15++){var _0x1e6224=_[_0xe4e0('0x70')](_0x204a6c[_0xe4e0('0x6e')][_0x4dc118][_0x309b8f[_0x1a357f][_0x2d1d15]]['replace'](/"/g,'\x27'));if(_0x479c71=='')_0x479c71=_0x1e6224;else _0x479c71+='|'+_0x1e6224;}_0x2d883c['push'](_0x2d3f0d['id']+':'+_0x479c71);}}if(hasAdditionalPhones){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x2d883c['join'](';')+'\x22');}if(_0x4af733[_0xe4e0('0x1c')]){handleError(_0x204a6c[_0xe4e0('0x6e')][_0x4dc118],{'code':_0xe4e0('0x7a'),'message':_0x4af733[_0xe4e0('0x16')]()});}else{fs[_0xe4e0('0x7b')](_0x2acbe2,_0x5839d7[_0xe4e0('0x16')]()+'\x0a');}_0x5839d7=[];}if(!(stats[_0xe4e0('0x7c')]%0xc8)){socket[_0xe4e0('0x7d')]('contact:import:'+_0x22db76,stats);stats[_0xe4e0('0x5b')]=[];}}if(stopped){logger[_0xe4e0('0x5d')](_0xe4e0('0x7e'));_0x412bb9[_0xe4e0('0x7f')]();}}catch(_0x4b5a9d){handleError(_0x204a6c[_0xe4e0('0x6e')][_0x4dc118],{'code':_0xe4e0('0x80'),'message':_0x4b5a9d[_0xe4e0('0x59')]});logger[_0xe4e0('0x22')](_0xe4e0('0x81'),_0x4b5a9d['message']);}},'complete':function(){try{var _0x4f9de1=[];var _0x2710b4=tempTableName;_0x4f9de1[_0xe4e0('0x1f')]('CREATE\x20TABLE\x20'+_0x2710b4+_0xe4e0('0x82'));logger[_0xe4e0('0x5d')](_0xe4e0('0x83'),contactItemTypes[_0xe4e0('0x1c')]);var _0x9d1ba8=util[_0xe4e0('0xe')](_0xe4e0('0x84'),_0x2acbe2,_0x2710b4,_0x55a98b,_0x1b6986[_0xe4e0('0x37')],_0x1b6986[_0xe4e0('0x55')]||null,NOW,NOW);if(_[_0xe4e0('0x1d')](_0x309b8f[_0xe4e0('0x36')])){_0x9d1ba8+=',\x20scheduledAt\x20=\x20NOW()';}_0x4f9de1[_0xe4e0('0x1f')](_0x9d1ba8);BPromise[_0xe4e0('0x85')](_0x4f9de1,handleQuery)[_0xe4e0('0x21')](function(_0x383c15){BPromise[_0xe4e0('0x20')]([handleAdditionalPhones()])['then'](function(){_0x4f9de1=[];for(var _0x1c1547=0x0;_0x1c1547\x20\x20');}var _0x3123af=path[_0xe4e0('0x16')](config['root'],_0xe4e0('0x65'),process['argv'][0x2]);if(!fs[_0xe4e0('0x90')](_0x3123af)){throw new Error(_0xe4e0('0x91'));}var _0x4b1af3={};try{_0x4b1af3=JSON[_0xe4e0('0x6d')](process[_0xe4e0('0x92')][0x3]);if(!_0x4b1af3[_0xe4e0('0x63')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0xdad221=0x0;if(_0x4b1af3['binding'][_0xe4e0('0x3a')]){_0xdad221=0x1;}if(!_0x4b1af3[_0xe4e0('0x37')]){throw new Error(_0xe4e0('0x93'));}}catch(_0x2c4120){throw new Error(_0xe4e0('0x94'));}var _0xa7c1d1=[];try{_0xa7c1d1=_[_0xe4e0('0x95')](JSON[_0xe4e0('0x6d')](process['argv'][0x4]),'id');}catch(_0x4851a2){logger[_0xe4e0('0x5d')]('No\x20agent\x20available');}main(_0x3123af,_0x4b1af3,_0xa7c1d1,_0xdad221);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe4e0('0x96'),handleUncaughtException); \ No newline at end of file +var _0x0e2a=['sequelize','query','select\x20*\x20from\x20','spread','isNil','phone','AdditionalPhones','push','all','then','catch','error','message','split','length','filter','findOne','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.priority','into','cm_hopper','scheduledat','ListId','createdAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.id','cm_contacts.ListId','fromQuery','updatedAt','fields','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','errors','code','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','body','findAll','name','parse','createReadStream','data','rows','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','finish','affectedRows','emit','unlink','exit','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','uncaughtException','lodash','util','moment','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join'];(function(_0x42a151,_0x3f4007){var _0x324bd1=function(_0x2f72e2){while(--_0x2f72e2){_0x42a151['push'](_0x42a151['shift']());}};_0x324bd1(++_0x3f4007);}(_0x0e2a,0x7f));var _0xa0e2=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x0e2a[_0x58ee19];return _0x49af25;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa0e2('0x0'));var Papa=require('papaparse');var util=require(_0xa0e2('0x1'));var BPromise=require('bluebird');var moment=require(_0xa0e2('0x2'));var squel=require(_0xa0e2('0x3'));var Redis=require(_0xa0e2('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xa0e2('0x5'));var logger=require('../../../config/logger')(_0xa0e2('0x6'));config[_0xa0e2('0x7')]=_[_0xa0e2('0x8')](config[_0xa0e2('0x7')],{'host':_0xa0e2('0x9'),'port':0x18eb});var socket=require(_0xa0e2('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xa0e2('0xb')](_0xa0e2('0xc'));var tempTableName=_0xa0e2('0xd')+moment()[_0xa0e2('0xb')](_0xa0e2('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x1fa20a){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xa0e2('0xf')](_0x1fa20a);}function selectNotIn(_0x69d9b8,_0x4706ee,_0x59668c,_0xe3d7e1,_0x37d947){return squel[_0xa0e2('0x10')]()[_0xa0e2('0x11')]('phone')[_0xa0e2('0x12')](_0xe3d7e1)['join'](_0x4706ee,null,_0x4706ee+_0xa0e2('0x13')+_0xe3d7e1+'.'+_0x59668c)[_0xa0e2('0x14')](_0xe3d7e1+'.'+_0x59668c+_0xa0e2('0x15')+_0x69d9b8+'.'+_0x59668c)[_0xa0e2('0x14')](_0x4706ee+_0xa0e2('0x16')+_0x37d947[_0xa0e2('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2e06e2,_0x46e70e){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa0e2('0x18')][_0xa0e2('0x19')](_0xa0e2('0x1a')+tempTableName)[_0xa0e2('0x1b')](function(_0x567c7c){if(_0x567c7c!==null){var _0x19c3d8=[];for(var _0x53f17a=0x0;_0x53f17a<_0x567c7c['length'];_0x53f17a++){var _0x38abb4=_0x567c7c[_0x53f17a];if(!_[_0xa0e2('0x1c')](_0x38abb4[_0xa0e2('0x1d')])){if(!_[_0xa0e2('0x1c')](_0x38abb4[_0xa0e2('0x1e')]))_0x19c3d8['push'](insertAdditionalPhones(_0x38abb4));promisesContact[_0xa0e2('0x1f')]({'contact':_0x38abb4});}}}Promise[_0xa0e2('0x20')](_0x19c3d8)[_0xa0e2('0x21')](function(){_0x2e06e2({'val':0x1});});})[_0xa0e2('0x22')](function(_0x3a56fd){logger[_0xa0e2('0x23')](_0x3a56fd[_0xa0e2('0x24')]);});});}function insertAdditionalPhones(_0x12bb5f){return new Promise(function(_0x1ff3e8,_0x8b2d11){var _0x59f64d=_0x12bb5f[_0xa0e2('0x1e')];if(_[_0xa0e2('0x1c')](_0x59f64d))_0x8b2d11({'val':0x0});else{var _0x2ad1d9=_0x59f64d[_0xa0e2('0x25')](';');var _0x4f9981=[];orderBy=0x0;for(var _0x367e85=0x0;_0x367e85<_0x2ad1d9['length'];_0x367e85++){_0x4f9981['push'](splitAdditionalPhone(_0x12bb5f['id'],_0x2ad1d9[_0x367e85]));}Promise['all'](_0x4f9981)[_0xa0e2('0x21')](function(){_0x1ff3e8({'val':_0x2ad1d9[_0xa0e2('0x26')]});});}});}function splitAdditionalPhone(_0x3a301c,_0x311215){return new Promise(function(_0x464e4c,_0x2a0d29){var _0x3ddaf2=_0x311215[_0xa0e2('0x25')](':');var _0x1815e3=_0x3ddaf2[0x0];var _0x292240=_0x3ddaf2[0x1];if(_0x292240!==''){var _0x4801a2=_0x292240[_0xa0e2('0x25')]('|');var _0x306614=[];for(var _0x955c1a=0x0;_0x955c1a<_0x4801a2[_0xa0e2('0x26')];_0x955c1a++){if(_0x4801a2[_0x955c1a]!==''){var _0x5daadc=_[_0xa0e2('0x27')](promisesAdditionalPhones,{'contactId':_0x3a301c,'phone':_0x4801a2[_0x955c1a]});if(_0x5daadc[_0xa0e2('0x26')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3a301c,'contactTypeId':_0x1815e3,'phone':_0x4801a2[_0x955c1a],'orderBy':orderBy});}}}_0x464e4c({'ok':0x1});}else _0x464e4c({'res':0x0});});}function createAdditionalPhone(_0x4c59ef,_0x582ac8,_0x1996b1,_0x37cbbb){return new Promise(function(_0x37c09d,_0x513168){return db['CmContactHasItem'][_0xa0e2('0x28')]({'where':{'CmContactId':_0x4c59ef,'item':_0x1996b1}})[_0xa0e2('0x21')](function(_0xe0f954){if(_0xe0f954){return db[_0xa0e2('0x29')][_0xa0e2('0x2a')]({'ItemTypeId':_0x582ac8,'OrderBy':_0x37cbbb},{'where':{'CmContactId':_0x4c59ef,'item':_0x1996b1}})[_0xa0e2('0x21')](function(_0x5c06e2){_0x37c09d({'res':_0xa0e2('0x2b')});});}else{return db[_0xa0e2('0x29')][_0xa0e2('0x2c')]({'CmContactId':_0x4c59ef,'item':_0x1996b1,'ItemTypeId':_0x582ac8,'OrderBy':_0x37cbbb,'ItemClass':'PHONE'})[_0xa0e2('0x21')](function(_0x10f61b){_0x37c09d({'res':_0xa0e2('0x2d')});});}});});}function updateContact(_0x1c5831){return new Promise(function(_0x40b1fd,_0xe34d80){var _0x78ab0e=_0x1c5831['id'];delete _0x1c5831['id'];return db[_0xa0e2('0x2e')][_0xa0e2('0x2a')](_0x1c5831,{'where':{'id':_0x78ab0e}})['then'](function(_0x169364){updatedRows+=0x1;return db[_0xa0e2('0x2f')]['update']({'phone':_0x1c5831[_0xa0e2('0x1d')]},{'where':{'ContactId':_0x78ab0e}})[_0xa0e2('0x21')](function(_0x3752df){_0x40b1fd({'ret':'OK'});});});});}function insertCmHopper(_0x32700a,_0xc1ccbf,_0x55e237,_0x27d0ea,_0x113297){var _0x2afa6e=[_0xa0e2('0x30'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0xc1ccbf+'.'+_0x27d0ea,_0xa0e2('0x31'),'cm_contacts.updatedAt',_0xa0e2('0x32'),'cm_contacts.UserId','\x22'+_0x113297+'\x22'];return squel['insert']()[_0xa0e2('0x33')](_0xa0e2('0x34'))['fromQuery']([_0xa0e2('0x1d'),_0xa0e2('0x35'),'ContactId',_0xa0e2('0x36'),_0x27d0ea,_0xa0e2('0x37'),'updatedAt','priority',_0xa0e2('0x38'),'recallme'],squel[_0xa0e2('0x10')]()['fields'](_0x2afa6e)['from'](_0xc1ccbf)[_0xa0e2('0x17')](_0xa0e2('0x39'),null,_0xa0e2('0x3a')+_0xc1ccbf+_0xa0e2('0x3b'))[_0xa0e2('0x17')](_0x55e237,null,_0x55e237+_0xa0e2('0x13')+_0xc1ccbf+'.'+_0x27d0ea)[_0xa0e2('0x14')](_0xc1ccbf+_0xa0e2('0x3c'),_0x32700a)['where'](_0xa0e2('0x3d'),NOW)[_0xa0e2('0x14')](_0xa0e2('0x3e'),selectNotIn(_0xc1ccbf,_0x55e237,_0x27d0ea,_0xa0e2('0x34'),[_0xa0e2('0x3f'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xc1ccbf,_0x55e237,_0x27d0ea,_0xa0e2('0x34'),[_0xa0e2('0x3f')])))['toString']();}function insertCmHopperBlack(_0x2c69d1,_0x164cf9,_0x4dbe91,_0x31a6c3){var _0x284a44=[_0xa0e2('0x30'),_0xa0e2('0x40'),_0xa0e2('0x41'),_0x164cf9+'.'+_0x31a6c3,_0xa0e2('0x31'),'cm_contacts.updatedAt'];return squel['insert']()['into']('cm_hopper_black')[_0xa0e2('0x42')]([_0xa0e2('0x1d'),'ContactId',_0xa0e2('0x36'),_0x31a6c3,_0xa0e2('0x37'),_0xa0e2('0x43')],squel[_0xa0e2('0x10')]()[_0xa0e2('0x44')](_0x284a44)[_0xa0e2('0x12')](_0x164cf9)[_0xa0e2('0x17')](_0xa0e2('0x39'),null,_0xa0e2('0x3a')+_0x164cf9+_0xa0e2('0x3b'))[_0xa0e2('0x17')](_0x4dbe91,null,_0x4dbe91+_0xa0e2('0x13')+_0x164cf9+'.'+_0x31a6c3)[_0xa0e2('0x14')](_0x164cf9+_0xa0e2('0x3c'),_0x2c69d1)[_0xa0e2('0x14')](_0xa0e2('0x3d'),NOW)[_0xa0e2('0x14')](_0xa0e2('0x3e'),squel[_0xa0e2('0x10')]()['field'](_0xa0e2('0x1d'))['from'](_0xa0e2('0x45'))[_0xa0e2('0x14')](_0xa0e2('0x46'),_0x2c69d1)[_0xa0e2('0x14')](_0x31a6c3+_0xa0e2('0x47'),_0x164cf9+'.'+_0x31a6c3)))[_0xa0e2('0x48')]();}function insertCmHopperAdditionalPhones(_0x5ee8b1){var _0x37efda=['cm_hopper.id',_0xa0e2('0x49'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xa0e2('0x4a')]()[_0xa0e2('0x33')](_0xa0e2('0x4b'))['fromQuery']([_0xa0e2('0x4c'),_0xa0e2('0x1d'),_0xa0e2('0x4d'),'createdAt','updatedAt'],squel[_0xa0e2('0x10')]()['fields'](_0x37efda)[_0xa0e2('0x12')]('cm_hopper')[_0xa0e2('0x17')](_0xa0e2('0x39'),null,_0xa0e2('0x4e'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x5ee8b1)[_0xa0e2('0x14')](_0xa0e2('0x3d'),NOW))[_0xa0e2('0x48')]();}function insertCmContact(_0x7f1c7d,_0x1daf9e,_0x561664,_0x54fe72){var _0xd59471=_[_0xa0e2('0x4f')](_[_0xa0e2('0x50')](_0x54fe72),['ListId',_0xa0e2('0x51'),_0xa0e2('0x37'),_0xa0e2('0x43')]);return squel[_0xa0e2('0x4a')]()[_0xa0e2('0x33')](_0xa0e2('0x39'))[_0xa0e2('0x42')](_0xd59471,squel[_0xa0e2('0x10')]()['fields'](_0xd59471)[_0xa0e2('0x12')](_0x1daf9e)[_0xa0e2('0x14')]('('+_0x561664['join'](',')+_0xa0e2('0x52'),squel['select']()[_0xa0e2('0x44')](_0x561664)[_0xa0e2('0x12')](_0xa0e2('0x39'))[_0xa0e2('0x14')](_0xa0e2('0x46'),_0x7f1c7d))[_0xa0e2('0x14')](_0xa0e2('0x53'),squel[_0xa0e2('0x10')]()['field'](_0xa0e2('0x54'),_0xa0e2('0x55'))[_0xa0e2('0x12')](_0x1daf9e)[_0xa0e2('0x56')](_0x561664[_0xa0e2('0x17')](','))))[_0xa0e2('0x48')]();}function handleStop(){logger[_0xa0e2('0x57')](_0xa0e2('0x58'));stopped=!![];}function handleUncaughtException(_0x4ba045){logger[_0xa0e2('0x23')](_0x4ba045[_0xa0e2('0x24')]);process['exit'](0x1);}function handleError(_0x15b5d5,_0x5cf1d8){stats[_0xa0e2('0x59')]['push']({'name':_0x5cf1d8[_0xa0e2('0x5a')],'message':_0x5cf1d8[_0xa0e2('0x24')],'row':_0x15b5d5});}function handleQuery(_0x102125){logger['info'](_0x102125);return db[_0xa0e2('0x18')]['query'](_0x102125)[_0xa0e2('0x1b')](function(_0x58f5e5){results[_0xa0e2('0x1f')](_0x58f5e5);})['catch'](function(_0x1b54df){logger[_0xa0e2('0x23')](_0x1b54df[_0xa0e2('0x24')]);});}function main(_0x1240ad,_0x141b18,_0x4eb6d8,_0x9466cd){logger[_0xa0e2('0x57')](_0xa0e2('0x5b'),_0x1240ad,JSON[_0xa0e2('0x5c')](_0x141b18));process[_0xa0e2('0x5d')](_0xa0e2('0x5e'));var _0x3ab717=_0x141b18[_0xa0e2('0x5f')];var _0x421b2c=_[_0xa0e2('0x60')](_0x3ab717);var _0x3af302=_0x141b18[_0xa0e2('0x61')];var _0xca1bce=path[_0xa0e2('0x17')](config['root'],_0xa0e2('0x62'),_0x3af302+_0xa0e2('0x63'));logger[_0xa0e2('0x57')](_0xa0e2('0x64'),_0x141b18);db['ContactItemType'][_0xa0e2('0x65')]({'raw':!![],'attributes':['id',_0xa0e2('0x66')]})['then'](function(_0x352936){for(var _0x2d0a30=0x0;_0x2d0a30<_0x352936[_0xa0e2('0x26')];_0x2d0a30++){if(_0x352936[_0x2d0a30][_0xa0e2('0x66')]in _0x3ab717){contactItemTypes['push'](_0x352936[_0x2d0a30]);delete _0x421b2c[_0x352936[_0x2d0a30][_0xa0e2('0x66')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x421b2c[_0xa0e2('0x1e')]='';var _0xa76fb9=_[_0xa0e2('0x50')](_0x421b2c)[_0xa0e2('0x17')]();logger['info']('header',_0xa76fb9);fs['writeFileSync'](_0xca1bce,_0xa76fb9+'\x0a');Papa[_0xa0e2('0x67')](fs[_0xa0e2('0x68')](_0x1240ad),{'header':!![],'skipEmptyLines':!![],'step':function(_0x590f17,_0x646a07){try{for(var _0x493ddb=0x0,_0x5463b4=[];_0x493ddb<_0x590f17[_0xa0e2('0x69')][_0xa0e2('0x26')];_0x493ddb++){stats[_0xa0e2('0x6a')]+=0x1;if(_0x590f17[_0xa0e2('0x59')][_0x493ddb]){handleError(_0x590f17[_0xa0e2('0x69')][_0x493ddb],_0x590f17[_0xa0e2('0x59')][_0x493ddb]);}else{var _0x10f84a=[];var _0x5450f5=[];for(var _0x16e454 in _0x3ab717){let _0x1c8b17=contactItemTypes[_0xa0e2('0x6b')](_0x201370=>_0x201370[_0xa0e2('0x66')]===_0x16e454);if(_[_0xa0e2('0x1c')](_0x1c8b17)){if(_0x3ab717[_0xa0e2('0x6c')](_0x16e454)){if(_0x590f17['data'][_0x493ddb][_0x3ab717[_0x16e454]]){var _0x2cd31d=_[_0xa0e2('0x6d')](_0x590f17[_0xa0e2('0x69')][_0x493ddb][_0x3ab717[_0x16e454]]['replace'](/"/g,'\x27'));switch(_0x16e454){case _0xa0e2('0x35'):var _0x29df54=moment(_0x2cd31d,_0xa0e2('0xc'),!![]);if(_0x29df54[_0xa0e2('0x6e')]()){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}else{_0x10f84a['push'](_0xa0e2('0x6f'));}break;case _0xa0e2('0x70'):var _0x23fe76=parseInt(_0x2cd31d);_0x2cd31d=_[_0xa0e2('0x71')](_0x23fe76)||_0x23fe76<0x0||_0x23fe76>0x4?_0x9466cd?0x3:0x2:_0x23fe76;_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');break;case _0xa0e2('0x38'):var _0x2d4051=parseInt(_0x2cd31d);if(_[_0xa0e2('0x72')](_0x2d4051)&&_[_0xa0e2('0x73')](_0x4eb6d8,_0x2d4051)){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2d4051+'\x22');}else{_0x10f84a[_0xa0e2('0x1f')]('agent\x20not\x20exists');}break;case _0xa0e2('0x74'):if(isEmail(_0x2cd31d)){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}else{_0x10f84a[_0xa0e2('0x1f')](_0xa0e2('0x75'));}break;case'dateOfBirth':var _0x56b0a6=moment(_0x2cd31d,_0xa0e2('0x76'),!![]);if(_0x56b0a6['isValid']()){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}else{_0x10f84a[_0xa0e2('0x1f')](_0xa0e2('0x77'));}break;default:_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x2cd31d+'\x22');}}else{switch(_0x16e454){case _0xa0e2('0x78'):case _0xa0e2('0x1d'):_0x10f84a[_0xa0e2('0x1f')](_0x16e454+_0xa0e2('0x79'));break;default:_0x5463b4['push']('\x22\x22');}}}}else{var _0x35ce69='';for(var _0xb5c299=0x0;_0xb5c299<_0x3ab717[_0x16e454][_0xa0e2('0x26')];_0xb5c299++){var _0x2cd31d=_['trim'](_0x590f17[_0xa0e2('0x69')][_0x493ddb][_0x3ab717[_0x16e454][_0xb5c299]][_0xa0e2('0x7a')](/"/g,'\x27'));if(_0x35ce69=='')_0x35ce69=_0x2cd31d;else _0x35ce69+='|'+_0x2cd31d;}_0x5450f5[_0xa0e2('0x1f')](_0x1c8b17['id']+':'+_0x35ce69);}}if(hasAdditionalPhones){_0x5463b4[_0xa0e2('0x1f')]('\x22'+_0x5450f5[_0xa0e2('0x17')](';')+'\x22');}if(_0x10f84a[_0xa0e2('0x26')]){handleError(_0x590f17['data'][_0x493ddb],{'code':_0xa0e2('0x7b'),'message':_0x10f84a[_0xa0e2('0x17')]()});}else{fs[_0xa0e2('0x7c')](_0xca1bce,_0x5463b4[_0xa0e2('0x17')]()+'\x0a');}_0x5463b4=[];}if(!(stats[_0xa0e2('0x6a')]%0xc8)){socket['emit'](_0xa0e2('0x7d')+_0x3af302,stats);stats['errors']=[];}}if(stopped){logger[_0xa0e2('0x57')](_0xa0e2('0x7e'));_0x646a07['abort']();}}catch(_0x4ad75f){handleError(_0x590f17[_0xa0e2('0x69')][_0x493ddb],{'code':_0xa0e2('0x7f'),'message':_0x4ad75f[_0xa0e2('0x24')]});logger[_0xa0e2('0x23')](_0xa0e2('0x80'),_0x4ad75f[_0xa0e2('0x24')]);}},'complete':function(){try{var _0x57bdc1=[];var _0x4a58fa=tempTableName;_0x57bdc1['push'](_0xa0e2('0x81')+_0x4a58fa+_0xa0e2('0x82'));logger[_0xa0e2('0x57')](_0xa0e2('0x83'),contactItemTypes[_0xa0e2('0x26')]);var _0x1eb047=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0xca1bce,_0x4a58fa,_0xa76fb9,_0x141b18[_0xa0e2('0x36')],_0x141b18[_0xa0e2('0x51')]||null,NOW,NOW);if(_[_0xa0e2('0x1c')](_0x3ab717[_0xa0e2('0x35')])){_0x1eb047+=_0xa0e2('0x84');}_0x57bdc1[_0xa0e2('0x1f')](_0x1eb047);BPromise[_0xa0e2('0x85')](_0x57bdc1,handleQuery)[_0xa0e2('0x21')](function(_0x3389d6){BPromise[_0xa0e2('0x20')]([handleAdditionalPhones()])[_0xa0e2('0x21')](function(){_0x57bdc1=[];for(var _0x56d5e8=0x0;_0x56d5e8\x20\x20');}var _0x10fc22=path[_0xa0e2('0x17')](config[_0xa0e2('0x8f')],_0xa0e2('0x62'),process[_0xa0e2('0x8e')][0x2]);if(!fs[_0xa0e2('0x90')](_0x10fc22)){throw new Error(_0xa0e2('0x91'));}var _0x32bb99={};try{_0x32bb99=JSON[_0xa0e2('0x67')](process['argv'][0x3]);if(!_0x32bb99['binding']){throw new Error(_0xa0e2('0x92'));}var _0x9ee784=0x0;if(_0x32bb99[_0xa0e2('0x5f')][_0xa0e2('0x38')]){_0x9ee784=0x1;}if(!_0x32bb99[_0xa0e2('0x36')]){throw new Error(_0xa0e2('0x93'));}}catch(_0x10b5d9){throw new Error(_0xa0e2('0x94'));}var _0x30e2b4=[];try{_0x30e2b4=_[_0xa0e2('0x95')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x244b46){logger[_0xa0e2('0x57')]('No\x20agent\x20available');}main(_0x10fc22,_0x32bb99,_0x30e2b4,_0x9ee784);}validate();process['on']('SIGINT',handleStop);process['on'](_0xa0e2('0x96'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 7699edd..a9913bb 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd237=['Outbound\x20Call','variable','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','Call\x20To','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','Date','starttime','Answer\x20Time','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','outbound','string'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xd237,0x14f));var _0x7d23=function(_0x50aeb9,_0x5305fc){_0x50aeb9=_0x50aeb9-0x0;var _0x38fa5d=_0xd237[_0x50aeb9];return _0x38fa5d;};'use strict';exports[_0x7d23('0x0')]=function(_0x1c5d0a,_0x413e95){var _0x1b3316=[{'type':'string','content':_0x7d23('0x1'),'variableName':null}];switch(_0x1c5d0a[_0x7d23('0x2')]()){case _0x7d23('0x3'):switch(_0x413e95[_0x7d23('0x2')]()){case _0x7d23('0x4'):_0x1b3316[_0x7d23('0x5')]({'type':'variable','content':'','variableName':_0x7d23('0x6')});_0x1b3316['push']({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x7d23('0x7'):_0x1b3316[_0x7d23('0x5')]({'type':_0x7d23('0x8'),'content':_0x7d23('0x9'),'variableName':null});_0x1b3316[_0x7d23('0x5')]({'type':_0x7d23('0xa'),'content':'','variableName':_0x7d23('0xb')});break;}}return _0x1b3316;};exports[_0x7d23('0xc')]=function(_0x566db0,_0x25675b){var _0x4aebf8=[];switch(_0x566db0[_0x7d23('0x2')]()){case'voice':switch(_0x25675b[_0x7d23('0x2')]()){case'inbound':_0x4aebf8=[{'type':_0x7d23('0x8'),'content':_0x7d23('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0xf'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x10')},{'type':_0x7d23('0xe'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x7d23('0x11')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x12'),'keyType':_0x7d23('0xa'),'variableName':'destexten'},{'type':_0x7d23('0xe'),'content':'','key':'Queue','keyType':_0x7d23('0xa'),'variableName':'queue'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x13'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x14')},{'type':_0x7d23('0xe'),'content':'','key':'Date','keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x15')},{'type':'string','content':_0x7d23('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x17'),'keyType':'variable','variableName':'destcalleridname'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x18'),'keyType':'variable','variableName':_0x7d23('0xb')},{'type':'string','content':_0x7d23('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7d23('0x1a'),'keyType':_0x7d23('0xa'),'variableName':'agentcalledAt'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x1b'),'keyType':_0x7d23('0xa'),'variableName':'agentconnectAt'},{'type':_0x7d23('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x1c')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x1d'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x1e')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x1f'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x20')}];break;case _0x7d23('0x7'):_0x4aebf8=[{'type':'string','content':_0x7d23('0xd'),'variableName':null},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x21'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0xb')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x22'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':'membername'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x13'),'keyType':'variable','keyContent':'','variableName':_0x7d23('0x14')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x23'),'keyType':'variable','keyContent':'','variableName':_0x7d23('0x24')},{'type':_0x7d23('0x8'),'content':_0x7d23('0x19')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x25'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':'answertime'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x26'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0x27')},{'type':_0x7d23('0xe'),'content':'','key':'Duration','keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0x28')},{'type':'keyValue','content':'','key':_0x7d23('0x29'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0x2a')}];break;}}return _0x4aebf8;}; \ No newline at end of file +var _0x8a5c=['destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','queue','UniqueId','Date','agentcalledAt','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','uniqueid','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','calleridnum','outbound','Outbound\x20Call'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x8a5c,0x136));var _0xc8a5=function(_0x1b70ad,_0x3c10ce){_0x1b70ad=_0x1b70ad-0x0;var _0x502a3c=_0x8a5c[_0x1b70ad];return _0x502a3c;};'use strict';exports[_0xc8a5('0x0')]=function(_0x19d1ad,_0x2a8a8d){var _0xb0db76=[{'type':_0xc8a5('0x1'),'content':_0xc8a5('0x2'),'variableName':null}];switch(_0x19d1ad[_0xc8a5('0x3')]()){case _0xc8a5('0x4'):switch(_0x2a8a8d[_0xc8a5('0x3')]()){case'inbound':_0xb0db76[_0xc8a5('0x5')]({'type':_0xc8a5('0x6'),'content':'','variableName':'queue'});_0xb0db76[_0xc8a5('0x5')]({'type':_0xc8a5('0x6'),'content':'','variableName':_0xc8a5('0x7')});break;case _0xc8a5('0x8'):_0xb0db76['push']({'type':_0xc8a5('0x1'),'content':_0xc8a5('0x9'),'variableName':null});_0xb0db76[_0xc8a5('0x5')]({'type':_0xc8a5('0x6'),'content':'','variableName':_0xc8a5('0xa')});break;}}return _0xb0db76;};exports[_0xc8a5('0xb')]=function(_0x136146,_0x16fd9a){var _0xea6d98=[];switch(_0x136146['toLowerCase']()){case'voice':switch(_0x16fd9a[_0xc8a5('0x3')]()){case'inbound':_0xea6d98=[{'type':_0xc8a5('0x1'),'content':_0xc8a5('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0xe'),'keyType':_0xc8a5('0x6'),'variableName':'calleridnum'},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0xf'),'keyType':'variable','variableName':_0xc8a5('0x10')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x11'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x12')},{'type':_0xc8a5('0xd'),'content':'','key':'Queue','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x13')},{'type':'keyValue','content':'','key':_0xc8a5('0x14'),'keyType':_0xc8a5('0x6'),'variableName':'uniqueid'},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x15'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x16')},{'type':_0xc8a5('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x17')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0xa')},{'type':_0xc8a5('0x1'),'content':_0xc8a5('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0xc8a5('0x16')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x19'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x1a')},{'type':_0xc8a5('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x1b')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x1c'),'keyType':_0xc8a5('0x6'),'variableName':_0xc8a5('0x1d')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x1e'),'keyType':_0xc8a5('0x6'),'variableName':'talktime'}];break;case _0xc8a5('0x8'):_0xea6d98=[{'type':_0xc8a5('0x1'),'content':_0xc8a5('0xc'),'variableName':null},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x1f'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0xa')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xc8a5('0x6'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xc8a5('0x14'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x20')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x15'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xc8a5('0x1'),'content':_0xc8a5('0x18')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x21'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x22')},{'type':'keyValue','content':'','key':_0xc8a5('0x23'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x24')},{'type':_0xc8a5('0xd'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0xc8a5('0x25')},{'type':_0xc8a5('0xd'),'content':'','key':_0xc8a5('0x26'),'keyType':_0xc8a5('0x6'),'keyContent':'','variableName':_0xc8a5('0x27')}];break;}}return _0xea6d98;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 62c848d..9095dd3 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28a0=['tracked','user','query','clone','body','html','phone','fax','lodash','../../config/logger','openchannel-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','then','update','catch','error'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0x28a0,0x8a));var _0x028a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x28a0[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x028a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x028a('0x1'))(_0x028a('0x2')),'mail':require(_0x028a('0x1'))('mail-interactions'),'fax':require(_0x028a('0x1'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x028a('0x1'))('chat-interactions'),'whatsapp':require(_0x028a('0x1'))(_0x028a('0x3'))};function getInteractionId(_0x16436e,_0x30cf7f,_0x3aa587){if(_0x16436e&&_0x16436e[_[_0x028a('0x4')](_0x3aa587)+_0x028a('0x5')]){return _0x16436e[_['upperFirst'](_0x3aa587)+_0x028a('0x5')];}else if(_0x16436e&&_0x16436e['id']){return _0x16436e['id'];}else if(_0x30cf7f&&_0x30cf7f['id']){return _0x30cf7f['id'];}else{return _0x028a('0x6');}}function log(_0x20b5e9,_0x270996,_0x47fcbc,_0x208fd8,_0x2e20be,_0x133b8a){loggers[_0x2e20be[_0x028a('0x7')]()][_0x20b5e9]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x133b8a[_0x028a('0x8')](),_0x270996?_0x270996['id']:null,_0x270996?_0x270996[_0x028a('0x9')]:null,_0x270996?_0x270996[_0x028a('0xa')]:null,getInteractionId(_0x47fcbc,_0x208fd8,_0x2e20be),_0x47fcbc?JSON[_0x028a('0xb')](_0x47fcbc):_0x028a('0xc'));}function updateUser(_0x4238aa,_0x55df36,_0x178240,_0x5704b4,_0x572e74){db[_[_0x028a('0x4')](_0x5704b4)+_0x028a('0xd')]['findOne']({'where':{'id':getInteractionId(_0x55df36,_0x178240,_0x5704b4)}})[_0x028a('0xe')](function(_0xe713cc){if(_0xe713cc){return _0xe713cc[_0x028a('0xf')]({'UserId':_0x4238aa?_0x4238aa['id']:null});}})['then'](function(_0x56e61c){if(_0x56e61c){log('info',_0x4238aa,_0x55df36,_0x178240,_0x5704b4,_0x572e74);}})[_0x028a('0x10')](function(){log(_0x028a('0x11'),_0x4238aa,_0x55df36,_0x178240,_0x5704b4,_0x572e74);});}exports[_0x028a('0x12')]=function(_0xe72ee1,_0x46b10f){return function(_0x2f72ad,_0x295157,_0xe7d0bf){var _0x4779cb=_0x2f72ad[_0x028a('0x13')];var _0x5e3a2c={};var _0x1dc89c=_0x2f72ad[_0x028a('0x14')];if(_0x5e3a2c){_0x5e3a2c=_[_0x028a('0x15')](_0x2f72ad['body']);_0x5e3a2c=_['omit'](_0x5e3a2c,[_0x028a('0x16'),_0x028a('0x17'),_0x028a('0x18'),_0x028a('0x19'),'mobile']);}updateUser(_0x4779cb,_0x5e3a2c,_0x1dc89c,_0xe72ee1,_0x46b10f);_0xe7d0bf(null);};}; \ No newline at end of file +var _0x2f42=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','update','info','catch','error','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase'];(function(_0x5a123f,_0x14cb93){var _0x40f3e8=function(_0x19fb34){while(--_0x19fb34){_0x5a123f['push'](_0x5a123f['shift']());}};_0x40f3e8(++_0x14cb93);}(_0x2f42,0x90));var _0x22f4=function(_0x13fcbc,_0x3daa3c){_0x13fcbc=_0x13fcbc-0x0;var _0x1420ab=_0x2f42[_0x13fcbc];return _0x1420ab;};'use strict';var _=require(_0x22f4('0x0'));var db=require(_0x22f4('0x1'))['db'];var loggers={'openchannel':require(_0x22f4('0x2'))('openchannel-interactions'),'mail':require(_0x22f4('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x22f4('0x3')),'sms':require('../../config/logger')(_0x22f4('0x4')),'chat':require(_0x22f4('0x2'))(_0x22f4('0x5')),'whatsapp':require(_0x22f4('0x2'))(_0x22f4('0x6'))};function getInteractionId(_0x224410,_0x27259e,_0xac64d1){if(_0x224410&&_0x224410[_[_0x22f4('0x7')](_0xac64d1)+'InteractionId']){return _0x224410[_[_0x22f4('0x7')](_0xac64d1)+_0x22f4('0x8')];}else if(_0x224410&&_0x224410['id']){return _0x224410['id'];}else if(_0x27259e&&_0x27259e['id']){return _0x27259e['id'];}else{return _0x22f4('0x9');}}function log(_0x7d4608,_0x3010aa,_0x2f018b,_0x4d948d,_0x4cf2b9,_0x4d977f){loggers[_0x4cf2b9[_0x22f4('0xa')]()][_0x7d4608](_0x22f4('0xb'),_0x4d977f[_0x22f4('0xc')](),_0x3010aa?_0x3010aa['id']:null,_0x3010aa?_0x3010aa[_0x22f4('0xd')]:null,_0x3010aa?_0x3010aa['role']:null,getInteractionId(_0x2f018b,_0x4d948d,_0x4cf2b9),_0x2f018b?JSON[_0x22f4('0xe')](_0x2f018b):_0x22f4('0xf'));}function updateUser(_0x3d97c8,_0x1a229f,_0x4a0c3e,_0x314f97,_0x27dc54){db[_[_0x22f4('0x7')](_0x314f97)+'Interaction'][_0x22f4('0x10')]({'where':{'id':getInteractionId(_0x1a229f,_0x4a0c3e,_0x314f97)}})[_0x22f4('0x11')](function(_0xb0ed34){if(_0xb0ed34){return _0xb0ed34[_0x22f4('0x12')]({'UserId':_0x3d97c8?_0x3d97c8['id']:null});}})[_0x22f4('0x11')](function(_0x3bdc78){if(_0x3bdc78){log(_0x22f4('0x13'),_0x3d97c8,_0x1a229f,_0x4a0c3e,_0x314f97,_0x27dc54);}})[_0x22f4('0x14')](function(){log(_0x22f4('0x15'),_0x3d97c8,_0x1a229f,_0x4a0c3e,_0x314f97,_0x27dc54);});}exports['tracked']=function(_0x304d60,_0x5b0301){return function(_0xa3e335,_0x4edf25,_0x2a7178){var _0x3e405a=_0xa3e335[_0x22f4('0x16')];var _0x58f285={};var _0x307bf3=_0xa3e335[_0x22f4('0x17')];if(_0x58f285){_0x58f285=_[_0x22f4('0x18')](_0xa3e335[_0x22f4('0x19')]);_0x58f285=_[_0x22f4('0x1a')](_0x58f285,[_0x22f4('0x19'),_0x22f4('0x1b'),_0x22f4('0x1c'),_0x22f4('0x1d'),_0x22f4('0x1e')]);}updateUser(_0x3e405a,_0x58f285,_0x307bf3,_0x304d60,_0x5b0301);_0x2a7178(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c610cb5..0d224d5 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea82=['crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','final','utf8','parse','hasOwnProperty','use','License','then','count','status','json','format','catch','users','User','admin','user','isUserLimit'];(function(_0x431d2b,_0x7a3416){var _0x7e3d8e=function(_0x3e969b){while(--_0x3e969b){_0x431d2b['push'](_0x431d2b['shift']());}};_0x7e3d8e(++_0x7a3416);}(_0xea82,0xc4));var _0x2ea8=function(_0x282a0d,_0x268c5e){_0x282a0d=_0x282a0d-0x0;var _0xdda2fa=_0xea82[_0x282a0d];return _0xdda2fa;};'use strict';var crypto=require(_0x2ea8('0x0'));var util=require(_0x2ea8('0x1'));var compose=require(_0x2ea8('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2ea8('0x3'));function getValueFromLicense(_0x43c349,_0x59bde0){if(_0x43c349&&_0x59bde0){if(_0x59bde0[_0x2ea8('0x4')]&&_0x59bde0[_0x2ea8('0x5')]){var _0x4cc502=_0x59bde0['data1'];var _0x500779=_0x59bde0[_0x2ea8('0x5')];var _0x281895=_0x4cc502[_0x2ea8('0x6')]('-')[0x4];var _0x40e7c3=_0x4cc502[_0x2ea8('0x6')]('-')[0x0];var _0x47f5b5=crypto[_0x2ea8('0x7')](_0x2ea8('0x8'),util['format'](_0x2ea8('0x9'),_0x281895,_0x4cc502,_0x40e7c3));var _0x47bcab=_0x47f5b5['update'](_0x500779,_0x2ea8('0xa'),'utf8');_0x47bcab+=_0x47f5b5[_0x2ea8('0xb')](_0x2ea8('0xc'));var _0x3fc83b=JSON[_0x2ea8('0xd')](_0x47bcab);return _0x3fc83b[_0x2ea8('0xe')](_0x43c349)?_0x3fc83b[_0x43c349]:null;}}return null;}function isLimit(_0x19bf28,_0x5505d9,_0x27282e,_0x3e5c7d){var _0x1d8afe=_0x5505d9;return compose()[_0x2ea8('0xf')](function(_0x17fcbc,_0x574c89,_0x48f902){return db[_0x2ea8('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2ea8('0x11')](function(_0x3ce5e7){var _0x341701=getValueFromLicense(_0x19bf28,_0x3ce5e7);return _0x341701?_0x341701:_0x1d8afe;})[_0x2ea8('0x11')](function(_0x323d29){_0x1d8afe=_0x323d29;return _0x27282e[_0x2ea8('0x12')](_0x3e5c7d);})[_0x2ea8('0x11')](function(_0x5853e0){if(_0x5853e0>=_0x1d8afe){return _0x574c89[_0x2ea8('0x13')](0x193)[_0x2ea8('0x14')]({'message':util[_0x2ea8('0x15')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x19bf28)});}_0x48f902();})[_0x2ea8('0x16')](function(_0x5b7c45){_0x48f902(_0x5b7c45);});});}function isUserLimit(){return isLimit(_0x2ea8('0x17'),0x1,db[_0x2ea8('0x18')],{'where':{'$or':[{'role':_0x2ea8('0x19')},{'role':_0x2ea8('0x1a')}]}});}exports[_0x2ea8('0x1b')]=isUserLimit; \ No newline at end of file +var _0x1723=['isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','findOne','then','status','json','catch','users','User','admin','user'];(function(_0x4d6e55,_0x59afcc){var _0x2184c6=function(_0x59729b){while(--_0x59729b){_0x4d6e55['push'](_0x4d6e55['shift']());}};_0x2184c6(++_0x59afcc);}(_0x1723,0xb7));var _0x3172=function(_0x18039c,_0x5a4428){_0x18039c=_0x18039c-0x0;var _0x6cd389=_0x1723[_0x18039c];return _0x6cd389;};'use strict';var crypto=require(_0x3172('0x0'));var util=require(_0x3172('0x1'));var compose=require(_0x3172('0x2'));var db=require(_0x3172('0x3'))['db'];var config=require(_0x3172('0x4'));function getValueFromLicense(_0x49bfdf,_0x182eb5){if(_0x49bfdf&&_0x182eb5){if(_0x182eb5['data1']&&_0x182eb5[_0x3172('0x5')]){var _0x53d0ca=_0x182eb5[_0x3172('0x6')];var _0x3dea17=_0x182eb5[_0x3172('0x5')];var _0x609273=_0x53d0ca['split']('-')[0x4];var _0x30fb17=_0x53d0ca[_0x3172('0x7')]('-')[0x0];var _0x57874b=crypto[_0x3172('0x8')](_0x3172('0x9'),util[_0x3172('0xa')](_0x3172('0xb'),_0x609273,_0x53d0ca,_0x30fb17));var _0x2d4bcc=_0x57874b[_0x3172('0xc')](_0x3dea17,_0x3172('0xd'),_0x3172('0xe'));_0x2d4bcc+=_0x57874b['final'](_0x3172('0xe'));var _0x3c72ba=JSON[_0x3172('0xf')](_0x2d4bcc);return _0x3c72ba['hasOwnProperty'](_0x49bfdf)?_0x3c72ba[_0x49bfdf]:null;}}return null;}function isLimit(_0x3f506a,_0x5865f7,_0x1c6e1a,_0x16eb51){var _0x2126d4=_0x5865f7;return compose()['use'](function(_0x1f1c82,_0x518952,_0x518518){return db['License'][_0x3172('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x3172('0x11')](function(_0x471ca8){var _0x4331f0=getValueFromLicense(_0x3f506a,_0x471ca8);return _0x4331f0?_0x4331f0:_0x2126d4;})['then'](function(_0x371b3a){_0x2126d4=_0x371b3a;return _0x1c6e1a['count'](_0x16eb51);})[_0x3172('0x11')](function(_0xf1bd08){if(_0xf1bd08>=_0x2126d4){return _0x518952[_0x3172('0x12')](0x193)[_0x3172('0x13')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3f506a)});}_0x518518();})[_0x3172('0x14')](function(_0x41cf83){_0x518518(_0x41cf83);});});}function isUserLimit(){return isLimit(_0x3172('0x15'),0x1,db[_0x3172('0x16')],{'where':{'$or':[{'role':_0x3172('0x17')},{'role':_0x3172('0x18')}]}});}exports[_0x3172('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index cfb1f7c..ddf9fc6 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 _0xbb06=['lodash','sqlOperator','startsWith','[$or]','and','[$and]','split','slice','forEach','shift','filter','indexOf','map','push','buildExpression','DATE','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','$endsWith','pop','utcOffset','hours','minutes','seconds'];(function(_0x4381fb,_0x465ed9){var _0x2ccf63=function(_0x2c0581){while(--_0x2c0581){_0x4381fb['push'](_0x4381fb['shift']());}};_0x2ccf63(++_0x465ed9);}(_0xbb06,0x72));var _0x6bb0=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xbb06[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x6bb0('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x51e7da){var _0x5ec450={'conditions':[]};_0x5ec450[_0x6bb0('0x1')]=_[_0x6bb0('0x2')](_0x51e7da,_0x6bb0('0x3'))?'or':_0x6bb0('0x4');var _0x35b379=_0x51e7da['replace'](_0x6bb0('0x5'),'')['replace']('[$or]','')['split']('||');for(var _0x26fafa=0x0;_0x26fafa<_0x35b379['length'];_0x26fafa++){var _0x53f4ad=_0x35b379[_0x26fafa][_0x6bb0('0x6')](':=');var _0x244ce6=_0x53f4ad[0x0];var _0x2fd085=_0x53f4ad[_0x6bb0('0x7')](0x1);_0x2fd085[_0x6bb0('0x8')](function(_0x42ff73){var _0x3690e3=_0x42ff73[_0x6bb0('0x6')]('[')[_0x6bb0('0x9')]();var _0x553c5c=_0x42ff73['match'](/\[(.*?)\]/g);_0x553c5c['forEach'](function(_0x2e0747){var _0x38c67b=_0x2e0747[_0x6bb0('0x6')]('[')[_0x6bb0('0xa')](function(_0x2f01ec){return _0x2f01ec[_0x6bb0('0xb')](']')>-0x1;})[_0x6bb0('0xc')](function(_0x50bc56){return _0x50bc56['split'](']')[0x0];})[0x0];_0x5ec450['conditions'][_0x6bb0('0xd')]({'field':_0x244ce6,'operator':_0x3690e3,'value':_0x38c67b});});});}return _0x5ec450;};exports[_0x6bb0('0xe')]=function(_0x1ab9fc,_0x27e9e4,_0x32c093){var _0xdb1cd1={};if(_0x27e9e4===_0x6bb0('0xf')){if(_0x32c093[_0x6bb0('0x10')]==='$eq'){_0x32c093[_0x6bb0('0x10')]=_0x6bb0('0x11');_0x32c093[_0x6bb0('0x12')]+=','+_0x32c093[_0x6bb0('0x12')];}else if(_['includes']([_0x6bb0('0x13'),_0x6bb0('0x14')],_0x32c093[_0x6bb0('0x10')])){_0x32c093['value']=moment(_0x32c093['value'])[_0x6bb0('0x15')](0x1,_0x6bb0('0x16'))[_0x6bb0('0x17')](_0x6bb0('0x18'));}}if(_0x32c093[_0x6bb0('0x19')]){_0x27e9e4=_0x32c093[_0x6bb0('0x19')];_0xdb1cd1[_0x6bb0('0x1a')]=_0x6bb0('0x1b')+_0x1ab9fc+'.'+_0x32c093[_0x6bb0('0x1c')]+_0x6bb0('0x1d')+_0x32c093[_0x6bb0('0x19')]+')\x20'+parseOperator(_0x32c093['operator']);}else{_0xdb1cd1[_0x6bb0('0x1a')]=_0x1ab9fc+'.'+_0x32c093['field']+'\x20'+parseOperator(_0x32c093[_0x6bb0('0x10')]);}if(_[_0x6bb0('0x1e')]([_0x6bb0('0x1f'),_0x6bb0('0x20')],_0x32c093[_0x6bb0('0x10')]))_0xdb1cd1[_0x6bb0('0x1a')]='('+_0xdb1cd1[_0x6bb0('0x1a')]+_0x6bb0('0x21')+_0x1ab9fc+'.'+_0x32c093[_0x6bb0('0x1c')]+_0x6bb0('0x22');_0xdb1cd1[_0x6bb0('0x12')]=parseValue(_0x27e9e4,_0x32c093['operator'],_0x32c093[_0x6bb0('0x12')]);return _0xdb1cd1;};function parseOperator(_0x48c4d5){var _0x185a62;switch(_0x48c4d5){case'$in':_0x185a62=_0x6bb0('0x23');break;case _0x6bb0('0x20'):_0x185a62=_0x6bb0('0x24');break;case _0x6bb0('0x25'):_0x185a62='=\x20?';break;case _0x6bb0('0x1f'):_0x185a62=_0x6bb0('0x26');break;case'$substring':case _0x6bb0('0x27'):case'$endsWith':_0x185a62=_0x6bb0('0x28');break;case _0x6bb0('0x29'):_0x185a62=_0x6bb0('0x2a');break;case _0x6bb0('0x13'):_0x185a62=_0x6bb0('0x2b');break;case _0x6bb0('0x14'):_0x185a62=_0x6bb0('0x2c');break;case _0x6bb0('0x2d'):_0x185a62=_0x6bb0('0x2e');break;case _0x6bb0('0x11'):_0x185a62=_0x6bb0('0x2f');break;}return _0x185a62;}function parseValue(_0x552eb2,_0x17eacd,_0x36772d){var _0x4a6228={'start':undefined,'end':undefined};switch(_0x17eacd){case _0x6bb0('0x30'):case _0x6bb0('0x20'):_0x4a6228[_0x6bb0('0x31')]=_0x36772d[_0x6bb0('0x6')](',');break;case _0x6bb0('0x32'):_0x4a6228[_0x6bb0('0x31')]='%'+_0x36772d+'%';break;case'$startsWith':_0x4a6228[_0x6bb0('0x31')]=_0x36772d+'%';break;case _0x6bb0('0x33'):_0x4a6228[_0x6bb0('0x31')]='%'+_0x36772d;break;case'$between':var _0x4bea6a=_0x36772d[_0x6bb0('0x6')](',');var _0x36772d=_0x4bea6a['shift']();var _0x8ba701=_0x4bea6a[_0x6bb0('0x34')]();if(_0x552eb2==='DATE'){_0x36772d=moment(_0x36772d)['utcOffset'](0x0,!![])[_0x6bb0('0x17')]();_0x8ba701=moment(_0x8ba701)[_0x6bb0('0x35')](0x0,!![])[_0x6bb0('0x15')](0x17,_0x6bb0('0x36'))[_0x6bb0('0x15')](0x3b,_0x6bb0('0x37'))[_0x6bb0('0x15')](0x3b,_0x6bb0('0x38'))[_0x6bb0('0x17')]();}_0x4a6228={'start':_0x36772d,'end':_0x8ba701};break;default:_0x4a6228[_0x6bb0('0x31')]=_0x36772d;break;}return _0x4a6228;} \ No newline at end of file +var _0xccf2=['match','filter','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','format','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','forEach','split','shift'];(function(_0x41a537,_0x4d36df){var _0x34b004=function(_0x36c356){while(--_0x36c356){_0x41a537['push'](_0x41a537['shift']());}};_0x34b004(++_0x4d36df);}(_0xccf2,0x1e3));var _0x2ccf=function(_0x43fa05,_0x3fa44d){_0x43fa05=_0x43fa05-0x0;var _0x2eb8d0=_0xccf2[_0x43fa05];return _0x2eb8d0;};'use strict';var _=require(_0x2ccf('0x0'));var moment=require(_0x2ccf('0x1'));exports[_0x2ccf('0x2')]=function(_0x30d02c){var _0x7caf19={'conditions':[]};_0x7caf19[_0x2ccf('0x3')]=_[_0x2ccf('0x4')](_0x30d02c,_0x2ccf('0x5'))?'or':'and';var _0x286650=_0x30d02c[_0x2ccf('0x6')](_0x2ccf('0x7'),'')[_0x2ccf('0x6')](_0x2ccf('0x5'),'')['split']('||');for(var _0x1eb8fe=0x0;_0x1eb8fe<_0x286650[_0x2ccf('0x8')];_0x1eb8fe++){var _0x372f33=_0x286650[_0x1eb8fe]['split'](':=');var _0x402c33=_0x372f33[0x0];var _0x3773ae=_0x372f33['slice'](0x1);_0x3773ae[_0x2ccf('0x9')](function(_0x57ed07){var _0x4e9c5e=_0x57ed07[_0x2ccf('0xa')]('[')[_0x2ccf('0xb')]();var _0x31f2a8=_0x57ed07[_0x2ccf('0xc')](/\[(.*?)\]/g);_0x31f2a8[_0x2ccf('0x9')](function(_0x267d9a){var _0x11694d=_0x267d9a[_0x2ccf('0xa')]('[')[_0x2ccf('0xd')](function(_0x442c65){return _0x442c65['indexOf'](']')>-0x1;})['map'](function(_0xdbc357){return _0xdbc357[_0x2ccf('0xa')](']')[0x0];})[0x0];_0x7caf19[_0x2ccf('0xe')][_0x2ccf('0xf')]({'field':_0x402c33,'operator':_0x4e9c5e,'value':_0x11694d});});});}return _0x7caf19;};exports[_0x2ccf('0x10')]=function(_0x424c70,_0x4b1801,_0x3097e6){var _0x5a2641={};if(_0x4b1801===_0x2ccf('0x11')){if(_0x3097e6[_0x2ccf('0x12')]===_0x2ccf('0x13')){_0x3097e6['operator']='$between';_0x3097e6[_0x2ccf('0x14')]+=','+_0x3097e6['value'];}else if(_[_0x2ccf('0x15')]([_0x2ccf('0x16'),_0x2ccf('0x17')],_0x3097e6[_0x2ccf('0x12')])){_0x3097e6[_0x2ccf('0x14')]=moment(_0x3097e6[_0x2ccf('0x14')])[_0x2ccf('0x18')](0x1,_0x2ccf('0x19'))['format']('YYYY-MM-DD');}}if(_0x3097e6[_0x2ccf('0x1a')]){_0x4b1801=_0x3097e6[_0x2ccf('0x1a')];_0x5a2641[_0x2ccf('0x1b')]='CAST('+_0x424c70+'.'+_0x3097e6[_0x2ccf('0x1c')]+_0x2ccf('0x1d')+_0x3097e6[_0x2ccf('0x1a')]+')\x20'+parseOperator(_0x3097e6['operator']);}else{_0x5a2641[_0x2ccf('0x1b')]=_0x424c70+'.'+_0x3097e6[_0x2ccf('0x1c')]+'\x20'+parseOperator(_0x3097e6[_0x2ccf('0x12')]);}if(_['includes']([_0x2ccf('0x1e'),_0x2ccf('0x1f')],_0x3097e6['operator']))_0x5a2641[_0x2ccf('0x1b')]='('+_0x5a2641[_0x2ccf('0x1b')]+_0x2ccf('0x20')+_0x424c70+'.'+_0x3097e6[_0x2ccf('0x1c')]+'\x20IS\x20NULL)';_0x5a2641[_0x2ccf('0x14')]=parseValue(_0x4b1801,_0x3097e6['operator'],_0x3097e6[_0x2ccf('0x14')]);return _0x5a2641;};function parseOperator(_0x42c6ed){var _0x57613d;switch(_0x42c6ed){case _0x2ccf('0x21'):_0x57613d=_0x2ccf('0x22');break;case'$notIn':_0x57613d=_0x2ccf('0x23');break;case'$eq':_0x57613d=_0x2ccf('0x24');break;case'$ne':_0x57613d=_0x2ccf('0x25');break;case _0x2ccf('0x26'):case _0x2ccf('0x27'):case _0x2ccf('0x28'):_0x57613d='LIKE\x20?';break;case _0x2ccf('0x29'):_0x57613d=_0x2ccf('0x2a');break;case _0x2ccf('0x16'):_0x57613d=_0x2ccf('0x2b');break;case _0x2ccf('0x17'):_0x57613d=_0x2ccf('0x2c');break;case _0x2ccf('0x2d'):_0x57613d=_0x2ccf('0x2e');break;case _0x2ccf('0x2f'):_0x57613d=_0x2ccf('0x30');break;}return _0x57613d;}function parseValue(_0x1bf9c3,_0x25e012,_0x26f596){var _0x1d57a9={'start':undefined,'end':undefined};switch(_0x25e012){case _0x2ccf('0x21'):case _0x2ccf('0x1f'):_0x1d57a9[_0x2ccf('0x31')]=_0x26f596[_0x2ccf('0xa')](',');break;case _0x2ccf('0x26'):_0x1d57a9[_0x2ccf('0x31')]='%'+_0x26f596+'%';break;case _0x2ccf('0x27'):_0x1d57a9[_0x2ccf('0x31')]=_0x26f596+'%';break;case'$endsWith':_0x1d57a9[_0x2ccf('0x31')]='%'+_0x26f596;break;case'$between':var _0x165675=_0x26f596['split'](',');var _0x26f596=_0x165675[_0x2ccf('0xb')]();var _0x333620=_0x165675[_0x2ccf('0x32')]();if(_0x1bf9c3===_0x2ccf('0x11')){_0x26f596=moment(_0x26f596)['utcOffset'](0x0,!![])[_0x2ccf('0x33')]();_0x333620=moment(_0x333620)[_0x2ccf('0x34')](0x0,!![])['add'](0x17,_0x2ccf('0x35'))['add'](0x3b,_0x2ccf('0x36'))[_0x2ccf('0x18')](0x3b,'seconds')[_0x2ccf('0x33')]();}_0x1d57a9={'start':_0x26f596,'end':_0x333620};break;default:_0x1d57a9[_0x2ccf('0x31')]=_0x26f596;break;}return _0x1d57a9;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 0802770..a561aae 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 _0x9fb0=['^[+]?[0-9]*$','isEmail','match','forEach','join','lodash','moment','fields','split','filters','forOwn','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','offset','map','indexOf','priority','cast','col','unsigned','substr','DESC','length','isObject','isString','unset','omit','isNumeric'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x9fb0,0x15b));var _0x09fb=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x9fb0[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x09fb('0x0'));var sequelize=require('sequelize');var moment=require(_0x09fb('0x1'));var LIMIT_VALUE=0xfa;exports[_0x09fb('0x2')]=function(_0x4057fe){var _0x226c2d=null;if(_0x4057fe){_0x226c2d=_0x4057fe[_0x09fb('0x3')](',');}return _0x226c2d;};exports[_0x09fb('0x4')]=function(_0x33a001,_0x5cde40){var _0x3b7c5e={};if(!_['isEmpty'](_0x33a001)){_[_0x09fb('0x5')](_0x33a001,function(_0x2fb625,_0x4bd64f){try{if(_0x5cde40){var _0x32aa58=_[_0x09fb('0x6')](_0x5cde40,{'name':_0x4bd64f})||{};if(_0x32aa58[_0x09fb('0x7')]===_0x09fb('0x8')&&_[_0x09fb('0x9')](_0x2fb625)){var _0x23d031=JSON[_0x09fb('0xa')](_0x2fb625);var _0x5ae11b={'$gte':moment(moment(_0x23d031[_0x09fb('0xb')])['format'](_0x09fb('0xc')))[_0x09fb('0xd')]()[_0x09fb('0xe')](),'$lte':moment(moment(_0x23d031[_0x09fb('0xf')])[_0x09fb('0xe')](_0x09fb('0xc')))[_0x09fb('0xd')]()[_0x09fb('0x10')](0x1,'s')[_0x09fb('0xe')]()};_0x3b7c5e[_0x4bd64f]=_0x5ae11b;}else{_0x3b7c5e[_0x4bd64f]=_[_0x09fb('0x11')](_0x2fb625)?_0x2fb625:JSON[_0x09fb('0xa')](_0x2fb625);}}else{_0x3b7c5e[_0x4bd64f]=_[_0x09fb('0x11')](_0x2fb625)?_0x2fb625:JSON['parse'](_0x2fb625);}}catch(_0x5018b7){_0x3b7c5e[_0x4bd64f]=_0x2fb625['split'](',');}});}return _0x3b7c5e;};exports['limit']=function(_0x1fa472){_0x1fa472=parseInt(_0x1fa472,0xa);if(!_0x1fa472||_0x1fa472<0x0){_0x1fa472=LIMIT_VALUE;}return _0x1fa472;};exports[_0x09fb('0x12')]=function(_0x38aecb){_0x38aecb=parseInt(_0x38aecb,0xa);if(!_0x38aecb||_0x38aecb<0x0){_0x38aecb=0x0;}return _0x38aecb;};exports['sort']=function(_0x51ccb7){var _0x4c2748,_0x2ee408=null;if(_0x51ccb7){_0x4c2748=_0x51ccb7[_0x09fb('0x3')](',');_0x2ee408=_[_0x09fb('0x13')](_0x4c2748,function(_0x550ab5){if(_0x550ab5[_0x09fb('0x14')]('-')===0x0){return[_0x550ab5===_0x09fb('0x15')?sequelize[_0x09fb('0x16')](sequelize[_0x09fb('0x17')]('priority'),_0x09fb('0x18')):_0x550ab5[_0x09fb('0x19')](0x1),_0x09fb('0x1a')];}else{return[_0x550ab5===_0x09fb('0x15')?sequelize['cast'](sequelize[_0x09fb('0x17')]('priority'),'unsigned'):_0x550ab5,'ASC'];}});}return _0x2ee408;};exports['omit']=function(_0x21e5cb,_0x3cb207){if(_['isEmpty'](_0x21e5cb)){return _0x21e5cb;}if(_[_0x09fb('0x11')](_0x21e5cb)){for(var _0x1a37e0=0x0;_0x1a37e0<_0x21e5cb[_0x09fb('0x1b')];_0x1a37e0+=0x1){_0x21e5cb[_0x1a37e0]=this['omit'](_0x21e5cb[_0x1a37e0],_0x3cb207);}return _0x21e5cb;}if(!_[_0x09fb('0x1c')](_0x21e5cb)){return _0x21e5cb;}if(_[_0x09fb('0x1d')](_0x3cb207)){_0x3cb207=[_0x3cb207];}if(!_[_0x09fb('0x11')](_0x3cb207)){return _0x21e5cb;}for(var _0x369227=0x0;_0x369227<_0x3cb207[_0x09fb('0x1b')];_0x369227+=0x1){_[_0x09fb('0x1e')](_0x21e5cb,_0x3cb207[_0x369227]);}for(var _0x515b77 in _0x21e5cb){if(_0x21e5cb['hasOwnProperty'](_0x515b77)){_0x21e5cb[_0x515b77]=this[_0x09fb('0x1f')](_0x21e5cb[_0x515b77],_0x3cb207);}}return _0x21e5cb;};exports[_0x09fb('0x20')]=function(_0x59bdf0){return _0x59bdf0['match'](RegExp(_0x09fb('0x21')))?!![]:![];};exports[_0x09fb('0x22')]=function(_0x48a721){return _0x48a721[_0x09fb('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2c71e9){var _0x105138=[];_0x2c71e9[_0x09fb('0x3')](/[ ,]+/)[_0x09fb('0x24')](function(_0x2699ab){_0x2699ab=_0x2699ab['replace'](/([^:]")"+/g,'$1');_0x2699ab='+'+_0x2699ab+'*';if(_0x2699ab['includes']('@'))_0x2699ab='\x22'+_0x2699ab+'\x22';_0x105138['push'](_0x2699ab);});return _0x105138[_0x09fb('0x25')]('\x20');}; \ No newline at end of file +var _0x6611=['utc','$lte','YYYY-MM-DD','subtract','isArray','limit','sort','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isEmail','match','getFullTextValue','forEach','replace','push','join','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','parse','$gte','format'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x6611,0xe3));var _0x1661=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6611[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var sequelize=require(_0x1661('0x0'));var moment=require(_0x1661('0x1'));var LIMIT_VALUE=0xfa;exports[_0x1661('0x2')]=function(_0x5a3761){var _0x1d9c72=null;if(_0x5a3761){_0x1d9c72=_0x5a3761[_0x1661('0x3')](',');}return _0x1d9c72;};exports[_0x1661('0x4')]=function(_0x58f9f1,_0x1891e6){var _0x178551={};if(!_[_0x1661('0x5')](_0x58f9f1)){_[_0x1661('0x6')](_0x58f9f1,function(_0x25823b,_0x55fa83){try{if(_0x1891e6){var _0x263728=_[_0x1661('0x7')](_0x1891e6,{'name':_0x55fa83})||{};if(_0x263728['type']===_0x1661('0x8')&&_[_0x1661('0x9')](_0x25823b)){var _0x4b8358=JSON[_0x1661('0xa')](_0x25823b);var _0x11a867={'$gte':moment(moment(_0x4b8358[_0x1661('0xb')])[_0x1661('0xc')]('YYYY-MM-DD'))[_0x1661('0xd')]()[_0x1661('0xc')](),'$lte':moment(moment(_0x4b8358[_0x1661('0xe')])['format'](_0x1661('0xf')))[_0x1661('0xd')]()[_0x1661('0x10')](0x1,'s')[_0x1661('0xc')]()};_0x178551[_0x55fa83]=_0x11a867;}else{_0x178551[_0x55fa83]=_[_0x1661('0x11')](_0x25823b)?_0x25823b:JSON['parse'](_0x25823b);}}else{_0x178551[_0x55fa83]=_['isArray'](_0x25823b)?_0x25823b:JSON['parse'](_0x25823b);}}catch(_0x2a8300){_0x178551[_0x55fa83]=_0x25823b[_0x1661('0x3')](',');}});}return _0x178551;};exports[_0x1661('0x12')]=function(_0x2f69b2){_0x2f69b2=parseInt(_0x2f69b2,0xa);if(!_0x2f69b2||_0x2f69b2<0x0){_0x2f69b2=LIMIT_VALUE;}return _0x2f69b2;};exports['offset']=function(_0x47f045){_0x47f045=parseInt(_0x47f045,0xa);if(!_0x47f045||_0x47f045<0x0){_0x47f045=0x0;}return _0x47f045;};exports[_0x1661('0x13')]=function(_0xee393d){var _0x2986a5,_0xeee42f=null;if(_0xee393d){_0x2986a5=_0xee393d[_0x1661('0x3')](',');_0xeee42f=_['map'](_0x2986a5,function(_0x452307){if(_0x452307[_0x1661('0x14')]('-')===0x0){return[_0x452307===_0x1661('0x15')?sequelize[_0x1661('0x16')](sequelize[_0x1661('0x17')]('priority'),_0x1661('0x18')):_0x452307['substr'](0x1),_0x1661('0x19')];}else{return[_0x452307==='priority'?sequelize[_0x1661('0x16')](sequelize['col'](_0x1661('0x15')),_0x1661('0x18')):_0x452307,_0x1661('0x1a')];}});}return _0xeee42f;};exports[_0x1661('0x1b')]=function(_0x1800f7,_0x5ca146){if(_[_0x1661('0x5')](_0x1800f7)){return _0x1800f7;}if(_['isArray'](_0x1800f7)){for(var _0x459a01=0x0;_0x459a01<_0x1800f7[_0x1661('0x1c')];_0x459a01+=0x1){_0x1800f7[_0x459a01]=this[_0x1661('0x1b')](_0x1800f7[_0x459a01],_0x5ca146);}return _0x1800f7;}if(!_[_0x1661('0x1d')](_0x1800f7)){return _0x1800f7;}if(_[_0x1661('0x1e')](_0x5ca146)){_0x5ca146=[_0x5ca146];}if(!_['isArray'](_0x5ca146)){return _0x1800f7;}for(var _0x5e7d1e=0x0;_0x5e7d1e<_0x5ca146[_0x1661('0x1c')];_0x5e7d1e+=0x1){_[_0x1661('0x1f')](_0x1800f7,_0x5ca146[_0x5e7d1e]);}for(var _0x618ce8 in _0x1800f7){if(_0x1800f7[_0x1661('0x20')](_0x618ce8)){_0x1800f7[_0x618ce8]=this['omit'](_0x1800f7[_0x618ce8],_0x5ca146);}}return _0x1800f7;};exports['isNumeric']=function(_0x1b8f14){return _0x1b8f14['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x1661('0x21')]=function(_0xdf1cb0){return _0xdf1cb0[_0x1661('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x1661('0x23')]=function(_0x58deae){var _0xf3a309=[];_0x58deae['split'](/[ ,]+/)[_0x1661('0x24')](function(_0x13e4bf){_0x13e4bf=_0x13e4bf[_0x1661('0x25')](/([^:]")"+/g,'$1');_0x13e4bf='+'+_0x13e4bf+'*';if(_0x13e4bf['includes']('@'))_0x13e4bf='\x22'+_0x13e4bf+'\x22';_0xf3a309[_0x1661('0x26')](_0x13e4bf);});return _0xf3a309[_0x1661('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 225a537..ed28e62 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3cf=['production','set','join','root','appPath','client','json\x20replacer','split','use','static','engine','html','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','path','moment','./environment','default','get'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xc3cf,0x157));var _0xfc3c=function(_0x54d4ef,_0x33d50e){_0x54d4ef=_0x54d4ef-0x0;var _0x53c39c=_0xc3cf[_0x54d4ef];return _0x53c39c;};'use strict';var express=require(_0xfc3c('0x0'));var favicon=require(_0xfc3c('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0xfc3c('0x2'));var passport=require('passport');var cors=require('cors');var moment=require(_0xfc3c('0x3'));var config=require(_0xfc3c('0x4'));var db=require('../mysqldb')['db'];exports[_0xfc3c('0x5')]=function(_0xe009e){var _0x323f32=_0xe009e[_0xfc3c('0x6')]('env');if(_0x323f32===_0xfc3c('0x7')){_0xe009e[_0xfc3c('0x8')]('appPath',path[_0xfc3c('0x9')](config[_0xfc3c('0xa')],'public'));}if(_0x323f32==='development'||_0x323f32==='test'){_0xe009e['set'](_0xfc3c('0xb'),path[_0xfc3c('0x9')](config['root'],_0xfc3c('0xc')));_0xe009e['use'](errorHandler());}_0xe009e[_0xfc3c('0x8')](_0xfc3c('0xd'),function(_0x291a4d,_0x4a907e){if(this[_0x291a4d]instanceof Date){_0x4a907e=this[_0x291a4d]['toISOString']()[_0xfc3c('0xe')]('.')[0x0]+'Z';}return _0x4a907e;});_0xe009e[_0xfc3c('0xf')](express[_0xfc3c('0x10')](_0xe009e[_0xfc3c('0x6')](_0xfc3c('0xb'))));_0xe009e[_0xfc3c('0x8')]('views',config[_0xfc3c('0xa')]+'/server/views');_0xe009e[_0xfc3c('0x11')](_0xfc3c('0x12'),require('ejs')[_0xfc3c('0x13')]);_0xe009e['set'](_0xfc3c('0x14'),_0xfc3c('0x12'));_0xe009e[_0xfc3c('0xf')](bodyParser[_0xfc3c('0x15')]({'limit':_0xfc3c('0x16'),'extended':!![]}));_0xe009e[_0xfc3c('0xf')](bodyParser[_0xfc3c('0x17')]({'limit':_0xfc3c('0x16')}));_0xe009e[_0xfc3c('0xf')](cors());_0xe009e[_0xfc3c('0xf')](methodOverride());_0xe009e[_0xfc3c('0xf')](cookieParser());_0xe009e[_0xfc3c('0xf')](passport[_0xfc3c('0x18')]());}; \ No newline at end of file +var _0x8f32=['initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','public','development','test','root','client','json\x20replacer','toISOString','use','static','views','engine','ejs','renderFile','view\x20engine','json','50mb'];(function(_0x4ba1d0,_0x2e64ab){var _0xb50d33=function(_0x117b1e){while(--_0x117b1e){_0x4ba1d0['push'](_0x4ba1d0['shift']());}};_0xb50d33(++_0x2e64ab);}(_0x8f32,0x1eb));var _0x28f3=function(_0x27e78b,_0x39d982){_0x27e78b=_0x27e78b-0x0;var _0x4cf4e4=_0x8f32[_0x27e78b];return _0x4cf4e4;};'use strict';var express=require(_0x28f3('0x0'));var favicon=require(_0x28f3('0x1'));var bodyParser=require(_0x28f3('0x2'));var methodOverride=require(_0x28f3('0x3'));var cookieParser=require(_0x28f3('0x4'));var errorHandler=require(_0x28f3('0x5'));var path=require(_0x28f3('0x6'));var passport=require('passport');var cors=require(_0x28f3('0x7'));var moment=require(_0x28f3('0x8'));var config=require(_0x28f3('0x9'));var db=require(_0x28f3('0xa'))['db'];exports[_0x28f3('0xb')]=function(_0x4e336c){var _0x32c37b=_0x4e336c[_0x28f3('0xc')](_0x28f3('0xd'));if(_0x32c37b===_0x28f3('0xe')){_0x4e336c[_0x28f3('0xf')](_0x28f3('0x10'),path[_0x28f3('0x11')](config['root'],_0x28f3('0x12')));}if(_0x32c37b===_0x28f3('0x13')||_0x32c37b===_0x28f3('0x14')){_0x4e336c[_0x28f3('0xf')](_0x28f3('0x10'),path[_0x28f3('0x11')](config[_0x28f3('0x15')],_0x28f3('0x16')));_0x4e336c['use'](errorHandler());}_0x4e336c[_0x28f3('0xf')](_0x28f3('0x17'),function(_0x1e6654,_0x46f551){if(this[_0x1e6654]instanceof Date){_0x46f551=this[_0x1e6654][_0x28f3('0x18')]()['split']('.')[0x0]+'Z';}return _0x46f551;});_0x4e336c[_0x28f3('0x19')](express[_0x28f3('0x1a')](_0x4e336c[_0x28f3('0xc')](_0x28f3('0x10'))));_0x4e336c['set'](_0x28f3('0x1b'),config['root']+'/server/views');_0x4e336c[_0x28f3('0x1c')]('html',require(_0x28f3('0x1d'))[_0x28f3('0x1e')]);_0x4e336c[_0x28f3('0xf')](_0x28f3('0x1f'),'html');_0x4e336c[_0x28f3('0x19')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x4e336c[_0x28f3('0x19')](bodyParser[_0x28f3('0x20')]({'limit':_0x28f3('0x21')}));_0x4e336c['use'](cors());_0x4e336c[_0x28f3('0x19')](methodOverride());_0x4e336c['use'](cookieParser());_0x4e336c[_0x28f3('0x19')](passport[_0x28f3('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ffc0cba..c7da744 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 _0x6003=['lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','keys','family','internal','head','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','update','getUuid','platform','win32','utf8','hostname','macAddress','md5','digest','substring'];(function(_0x543150,_0x111976){var _0x1c2965=function(_0xf4b216){while(--_0xf4b216){_0x543150['push'](_0x543150['shift']());}};_0x1c2965(++_0x111976);}(_0x6003,0xae));var _0x3600=function(_0x2dc6e6,_0x13b6f2){_0x2dc6e6=_0x2dc6e6-0x0;var _0xca4573=_0x6003[_0x2dc6e6];return _0xca4573;};'use strict';var _=require(_0x3600('0x0'));var os=require('os');var crypto=require(_0x3600('0x1'));var machine=require(_0x3600('0x2'));var exec=require(_0x3600('0x3'))['execSync'];function getInterfaces(){var _0x484cf5=[];var _0x367da4=os[_0x3600('0x4')]();var _0x29c0fd=_['orderBy'](_[_0x3600('0x5')](_0x367da4));for(var _0x279faf=0x0;_0x279faf<_0x29c0fd['length'];_0x279faf++){var _0x2953ac=_0x367da4[_0x29c0fd[_0x279faf]]['filter'](function(_0x4880c7){return _0x4880c7[_0x3600('0x6')]==='IPv4'&&_0x4880c7[_0x3600('0x7')]===![];});_0x484cf5=_0x484cf5['concat'](_0x2953ac);}return _0x484cf5;}function getFirstInterface(){var _0x8c8dd=_[_0x3600('0x8')](getInterfaces());return{'macAddress':_0x8c8dd&&_0x8c8dd[_0x3600('0x9')]?_0x8c8dd[_0x3600('0x9')]:'00:00:00:00:00:00','ipAddress':_0x8c8dd&&_0x8c8dd[_0x3600('0xa')]?_0x8c8dd[_0x3600('0xa')]:_0x3600('0xb')};}exports[_0x3600('0xc')]=getFirstInterface;function getCPUhash(){var _0x43b701=_[_0x3600('0xd')](os[_0x3600('0xe')]()[_0x3600('0xf')](function(_0x430281){return _0x430281[_0x3600('0x10')];}))[_0x3600('0x11')](':');return crypto[_0x3600('0x12')]('md5')[_0x3600('0x13')](_0x43b701)['digest']('hex');}exports[_0x3600('0x14')]=function(){switch(os[_0x3600('0x15')]()){case _0x3600('0x16'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3600('0x17')})['replace']('\x0d\x0a','');default:var _0x10bdd3=getFirstInterface();var _0x521829=getCPUhash();var _0x28260c=_0x521829+'|'+os[_0x3600('0x18')]()+'|'+_0x10bdd3[_0x3600('0x19')]+'|'+_0x10bdd3['ipAddress'];var _0x5e980d=crypto[_0x3600('0x12')](_0x3600('0x1a'))[_0x3600('0x13')](_0x28260c)[_0x3600('0x1b')]('hex');return _0x5e980d[_0x3600('0x1c')](0x0,0x8)+'-'+_0x5e980d['substring'](0x8,0xc)+'-'+_0x5e980d[_0x3600('0x1c')](0xc,0x10)+'-'+_0x5e980d[_0x3600('0x1c')](0x10,0x14)+'-'+_0x5e980d[_0x3600('0x1c')](0x14);}}; \ No newline at end of file +var _0x1354=['crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','cpus','model','join','createHash','md5','update','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','digest','substring','lodash'];(function(_0x555c79,_0x1c383b){var _0x4c1889=function(_0x5d43d1){while(--_0x5d43d1){_0x555c79['push'](_0x555c79['shift']());}};_0x4c1889(++_0x1c383b);}(_0x1354,0x95));var _0x4135=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x1354[_0x1f83a5];return _0x45edf0;};'use strict';var _=require(_0x4135('0x0'));var os=require('os');var crypto=require(_0x4135('0x1'));var machine=require(_0x4135('0x2'));var exec=require(_0x4135('0x3'))[_0x4135('0x4')];function getInterfaces(){var _0x435d5e=[];var _0x102fec=os['networkInterfaces']();var _0x2c75a3=_[_0x4135('0x5')](_[_0x4135('0x6')](_0x102fec));for(var _0x4a8e27=0x0;_0x4a8e27<_0x2c75a3[_0x4135('0x7')];_0x4a8e27++){var _0x2bcd68=_0x102fec[_0x2c75a3[_0x4a8e27]]['filter'](function(_0x419ad4){return _0x419ad4[_0x4135('0x8')]===_0x4135('0x9')&&_0x419ad4['internal']===![];});_0x435d5e=_0x435d5e[_0x4135('0xa')](_0x2bcd68);}return _0x435d5e;}function getFirstInterface(){var _0x4bc745=_[_0x4135('0xb')](getInterfaces());return{'macAddress':_0x4bc745&&_0x4bc745[_0x4135('0xc')]?_0x4bc745[_0x4135('0xc')]:_0x4135('0xd'),'ipAddress':_0x4bc745&&_0x4bc745['address']?_0x4bc745[_0x4135('0xe')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x73c55f=_[_0x4135('0x5')](os[_0x4135('0xf')]()['map'](function(_0x307e6f){return _0x307e6f[_0x4135('0x10')];}))[_0x4135('0x11')](':');return crypto[_0x4135('0x12')](_0x4135('0x13'))[_0x4135('0x14')](_0x73c55f)['digest']('hex');}exports[_0x4135('0x15')]=function(){switch(os[_0x4135('0x16')]()){case _0x4135('0x17'):return exec(_0x4135('0x18'),{'encoding':'utf8'})[_0x4135('0x19')]('\x0d\x0a','');default:var _0x2e8733=getFirstInterface();var _0x5d3eba=getCPUhash();var _0x590108=_0x5d3eba+'|'+os[_0x4135('0x1a')]()+'|'+_0x2e8733['macAddress']+'|'+_0x2e8733[_0x4135('0x1b')];var _0x5382ea=crypto['createHash']('md5')['update'](_0x590108)[_0x4135('0x1c')]('hex');return _0x5382ea[_0x4135('0x1d')](0x0,0x8)+'-'+_0x5382ea[_0x4135('0x1d')](0x8,0xc)+'-'+_0x5382ea[_0x4135('0x1d')](0xc,0x10)+'-'+_0x5382ea['substring'](0x10,0x14)+'-'+_0x5382ea[_0x4135('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7e466f6..7e4e004 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 _0x4392=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','findOrCreate','spread','message','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x4392,0x1e3));var _0x2439=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0x4392[_0x5cc61d];return _0x2e25d0;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x2439('0x0'));var BPromise=require('bluebird');var pkginfo=require(_0x2439('0x1'))(module,_0x2439('0x2'));var db=require(_0x2439('0x3'))['db'];var encryptor=require(_0x2439('0x4'));var hardware=require(_0x2439('0x5'));var logger=require(_0x2439('0x6'))(_0x2439('0x7'));var jira=require(_0x2439('0x8'));const {config}=require('process');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xe86bf9){return new BPromise(function(_0x2000ec,_0x5bf944){var _0xc5a80f=util[_0x2439('0x9')](_0x2439('0xa'),HOST,_0xe86bf9,module[_0x2439('0xb')][_0x2439('0x2')]);if(oldToken){_0xc5a80f=util[_0x2439('0x9')](_0x2439('0xc'),HOST,_0xe86bf9,module[_0x2439('0xb')][_0x2439('0x2')],oldToken);}var _0x189cdc={'uri':_0xc5a80f,'method':_0x2439('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x189cdc)[_0x2439('0xe')](function(_0xd08341){_0x2000ec(_0xd08341);})[_0x2439('0xf')](function(_0x20e866){_0x5bf944(_0x20e866);});});}function sendJiraAlert(_0xce5e34,_0x3f24a5,_0x25487b){var _0x140b25=_0x2439('0x10');return db[_0x2439('0x11')][_0x2439('0x12')]({'where':{'role':_0x2439('0x13')},'attributes':[_0x2439('0x14'),_0x2439('0x15')],'raw':!![]})['then'](function(_0x548963){ADMIN=_0x548963;_0x140b25+=_0x2439('0x16')+_0x25487b+'|\x0a';_0x140b25+='|uuid|'+_0xce5e34+'|\x0a';_0x140b25+='|machineUuid|'+_0x3f24a5+'|\x0a';_0x140b25+=_0x2439('0x17')+ADMIN[_0x2439('0x14')]+'|\x0a';_0x140b25+=_0x2439('0x18')+ADMIN['email']+'|\x0a';return _0x140b25;})[_0x2439('0xe')](function(_0x42cd53){var _0x56afc4=hardware[_0x2439('0x19')]()[_0x2439('0x1a')];return jira[_0x2439('0x1b')]({'key':_0x2439('0x1c'),'summary':_0x2439('0x1d'),'description':_0x42cd53,'issuetype':_0x2439('0x1e'),'oldToken':_0xce5e34,'newToken':_0x3f24a5,'email':ADMIN[_0x2439('0x15')],'name':ADMIN[_0x2439('0x14')],'reason':GRAY_PERIOD_REASON,'ip':_0x56afc4});});}function manageLicense(_0x3eb528,_0x38b7bb){var _0xd804a3=_0x38b7bb[_0x2439('0x1f')]({'plain':!![]});httpRequest(_0x3eb528)[_0x2439('0xe')](function(_0x56e963){if(oldToken){oldToken=undefined;}if(_0x56e963['active']){if(!_0xd804a3['license']&&_0xd804a3[_0x2439('0x7')]!=_0x56e963[_0x2439('0x7')]||_0xd804a3[_0x2439('0x7')]&&_0xd804a3[_0x2439('0x20')]){logger['info'](_0x2439('0x21'));}if(_0xd804a3[_0x2439('0x7')]&&!_0xd804a3[_0x2439('0x20')]&&_0xd804a3[_0x2439('0x7')]!=_0x56e963['license']){logger[_0x2439('0x22')](_0x2439('0x23'));}if(_0xd804a3[_0x2439('0x7')]&&!_0xd804a3[_0x2439('0x20')]&&_0xd804a3[_0x2439('0x7')]==_0x56e963[_0x2439('0x7')]){return _0x38b7bb;}return _0x38b7bb[_0x2439('0x24')]({'data1':_0x3eb528,'data2':null,'license':_0x56e963[_0x2439('0x7')]});}else{if(_0x56e963['license']||_0xd804a3['license']){if(!_0xd804a3['data2']){if(_0xd804a3['data1']==_0x3eb528){GRAY_PERIOD_REASON=_0x2439('0x25');logger[_0x2439('0x22')](_0x2439('0x26'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0xd804a3[_0x2439('0x27')];logger[_0x2439('0x22')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xd804a3['data1'],_0x3eb528);}sendJiraAlert(_0xd804a3[_0x2439('0x27')],_0x56e963[_0x2439('0x28')],GRAY_PERIOD_REASON);logger['info'](_0x2439('0x29'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2439('0x9')](_0x2439('0x2a')));return _0x38b7bb[_0x2439('0x24')]({'data2':encryptor[_0x2439('0x2b')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0xd804a3[_0x2439('0x20')]),'days')>DAYS){logger[_0x2439('0x22')](_0x2439('0x2c'),moment()[_0x2439('0x9')](_0x2439('0x2a')));return _0x38b7bb['update']({'data1':_0x3eb528,'data2':null,'license':null});}}}else{if(_0xd804a3[_0x2439('0x27')]!=_0x3eb528){logger[_0x2439('0x22')](_0x2439('0x2d'),_0xd804a3['data1'],_0x3eb528);return _0x38b7bb[_0x2439('0x24')]({'data1':_0x3eb528,'data2':null,'license':null});}}}return _0x38b7bb;})[_0x2439('0xe')](function(_0xf2747b){_0x38b7bb=_0xf2747b;})[_0x2439('0xf')](function(_0xa71183){logger[_0x2439('0x2e')](_0xa71183['message']);})[_0x2439('0x2f')](function(){setTimeout(function(){manageLicense(hardware[_0x2439('0x30')](),_0x38b7bb);},TIME);});}function defaultLicense(){var _0xab403a=hardware[_0x2439('0x30')]();if(_0xab403a){return db['License'][_0x2439('0x31')]({'where':{'id':0x1},'defaults':{'data1':_0xab403a}})[_0x2439('0x32')](function(_0x211772,_0x177fc1){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xab403a);manageLicense(_0xab403a,_0x211772);})['catch'](function(_0x98a050){logger['error'](_0x98a050[_0x2439('0x33')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x7ccb=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','License','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','pkginfo','version','./hardware','../logger','../../api/jira/jira.controller','process','format','%s/api/servers/%s/check?version=%s','exports','GET','then','||FIELD||VALUE||\x0a','User','admin','email','|reason|','|machineUuid|','|name|','fullname','|email|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','active','license','data2','info','update','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x7ccb,0x77));var _0xb7cc=function(_0x3572b3,_0x593ffe){_0x3572b3=_0x3572b3-0x0;var _0x55e4aa=_0x7ccb[_0x3572b3];return _0x55e4aa;};'use strict';var util=require(_0xb7cc('0x0'));var moment=require(_0xb7cc('0x1'));var rp=require(_0xb7cc('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xb7cc('0x3'))(module,_0xb7cc('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb7cc('0x5'));var logger=require(_0xb7cc('0x6'))('license');var jira=require(_0xb7cc('0x7'));const {config}=require(_0xb7cc('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3497d9){return new BPromise(function(_0x162fac,_0x234554){var _0x2fba5c=util[_0xb7cc('0x9')](_0xb7cc('0xa'),HOST,_0x3497d9,module[_0xb7cc('0xb')][_0xb7cc('0x4')]);if(oldToken){_0x2fba5c=util[_0xb7cc('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3497d9,module[_0xb7cc('0xb')][_0xb7cc('0x4')],oldToken);}var _0x1642ff={'uri':_0x2fba5c,'method':_0xb7cc('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1642ff)[_0xb7cc('0xd')](function(_0x22bff0){_0x162fac(_0x22bff0);})['catch'](function(_0x2d0e02){_0x234554(_0x2d0e02);});});}function sendJiraAlert(_0x3147fc,_0x3c2944,_0x163466){var _0x200ef2=_0xb7cc('0xe');return db[_0xb7cc('0xf')]['findOne']({'where':{'role':_0xb7cc('0x10')},'attributes':['fullname',_0xb7cc('0x11')],'raw':!![]})[_0xb7cc('0xd')](function(_0x5e78da){ADMIN=_0x5e78da;_0x200ef2+=_0xb7cc('0x12')+_0x163466+'|\x0a';_0x200ef2+='|uuid|'+_0x3147fc+'|\x0a';_0x200ef2+=_0xb7cc('0x13')+_0x3c2944+'|\x0a';_0x200ef2+=_0xb7cc('0x14')+ADMIN[_0xb7cc('0x15')]+'|\x0a';_0x200ef2+=_0xb7cc('0x16')+ADMIN[_0xb7cc('0x11')]+'|\x0a';return _0x200ef2;})[_0xb7cc('0xd')](function(_0x1a77a3){var _0x42dd93=hardware['getFirstInterface']()[_0xb7cc('0x17')];return jira[_0xb7cc('0x18')]({'key':_0xb7cc('0x19'),'summary':_0xb7cc('0x1a'),'description':_0x1a77a3,'issuetype':'Alert','oldToken':_0x3147fc,'newToken':_0x3c2944,'email':ADMIN[_0xb7cc('0x11')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x42dd93});});}function manageLicense(_0x2f9bae,_0x3392b0){var _0xe4d505=_0x3392b0['get']({'plain':!![]});httpRequest(_0x2f9bae)['then'](function(_0x1b7c99){if(oldToken){oldToken=undefined;}if(_0x1b7c99[_0xb7cc('0x1b')]){if(!_0xe4d505['license']&&_0xe4d505['license']!=_0x1b7c99[_0xb7cc('0x1c')]||_0xe4d505[_0xb7cc('0x1c')]&&_0xe4d505[_0xb7cc('0x1d')]){logger[_0xb7cc('0x1e')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xe4d505[_0xb7cc('0x1c')]&&!_0xe4d505[_0xb7cc('0x1d')]&&_0xe4d505[_0xb7cc('0x1c')]!=_0x1b7c99[_0xb7cc('0x1c')]){logger[_0xb7cc('0x1e')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xe4d505[_0xb7cc('0x1c')]&&!_0xe4d505[_0xb7cc('0x1d')]&&_0xe4d505['license']==_0x1b7c99[_0xb7cc('0x1c')]){return _0x3392b0;}return _0x3392b0[_0xb7cc('0x1f')]({'data1':_0x2f9bae,'data2':null,'license':_0x1b7c99[_0xb7cc('0x1c')]});}else{if(_0x1b7c99['license']||_0xe4d505[_0xb7cc('0x1c')]){if(!_0xe4d505[_0xb7cc('0x1d')]){if(_0xe4d505[_0xb7cc('0x20')]==_0x2f9bae){GRAY_PERIOD_REASON='Disabled';logger[_0xb7cc('0x1e')](_0xb7cc('0x21'));}else{GRAY_PERIOD_REASON=_0xb7cc('0x22');oldToken=_0xe4d505['data1'];logger[_0xb7cc('0x1e')](_0xb7cc('0x23'),_0xe4d505[_0xb7cc('0x20')],_0x2f9bae);}sendJiraAlert(_0xe4d505['data1'],_0x1b7c99[_0xb7cc('0x24')],GRAY_PERIOD_REASON);logger[_0xb7cc('0x1e')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb7cc('0x25')](),moment()[_0xb7cc('0x9')](_0xb7cc('0x26')));return _0x3392b0['update']({'data2':encryptor[_0xb7cc('0x27')](moment()['format'](_0xb7cc('0x26')))});}else{if(moment()[_0xb7cc('0x28')](encryptor[_0xb7cc('0x29')](_0xe4d505[_0xb7cc('0x1d')]),_0xb7cc('0x2a'))>DAYS){logger['info'](_0xb7cc('0x2b'),moment()[_0xb7cc('0x9')](_0xb7cc('0x26')));return _0x3392b0['update']({'data1':_0x2f9bae,'data2':null,'license':null});}}}else{if(_0xe4d505['data1']!=_0x2f9bae){logger[_0xb7cc('0x1e')](_0xb7cc('0x23'),_0xe4d505[_0xb7cc('0x20')],_0x2f9bae);return _0x3392b0[_0xb7cc('0x1f')]({'data1':_0x2f9bae,'data2':null,'license':null});}}}return _0x3392b0;})['then'](function(_0x47d322){_0x3392b0=_0x47d322;})[_0xb7cc('0x2c')](function(_0x1965b6){logger[_0xb7cc('0x2d')](_0x1965b6['message']);})[_0xb7cc('0x2e')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3392b0);},TIME);});}function defaultLicense(){var _0x36dcc0=hardware['getUuid']();if(_0x36dcc0){return db[_0xb7cc('0x2f')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x36dcc0}})['spread'](function(_0x3316d8,_0x3b344b){logger['info'](_0xb7cc('0x30'),_0x36dcc0);manageLicense(_0x36dcc0,_0x3316d8);})[_0xb7cc('0x2c')](function(_0x308539){logger[_0xb7cc('0x2d')](_0x308539[_0xb7cc('0x31')]);});}}exports[_0xb7cc('0x32')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 37dca8b..9bebda7 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 _0x6e74=['getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','then','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','uuid','machineUuid','gray','deadline','add','days','grayReason','disabled','User','findAll','role','sequelize','COUNT','col','count','user','telephone','users','telephones','forEach','admin','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license'];(function(_0x28f494,_0x58e758){var _0x3fa985=function(_0x26c9ad){while(--_0x26c9ad){_0x28f494['push'](_0x28f494['shift']());}};_0x3fa985(++_0x58e758);}(_0x6e74,0x1c5));var _0x46e7=function(_0x1baea8,_0x2c2394){_0x1baea8=_0x1baea8-0x0;var _0x594cfd=_0x6e74[_0x1baea8];return _0x594cfd;};'use strict';var util=require(_0x46e7('0x0'));var _=require(_0x46e7('0x1'));var moment=require(_0x46e7('0x2'));var BPromise=require(_0x46e7('0x3'));var hardware=require(_0x46e7('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x46e7('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x46e7('0x6'),'machineUuid':hardware[_0x46e7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x46e7('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x46e7('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5ab612){return new BPromise(function(_0x4b6995,_0x445626){return db[_0x46e7('0xa')]['find'](_['defaults'](_0x5ab612,{'raw':!![],'where':{'id':0x1}}))[_0x46e7('0xb')](function(_0x375a98){return checkLicense(_0x375a98,null);})[_0x46e7('0xb')](function(_0x18375a){_0x4b6995(_0x18375a);return;})['catch'](function(_0x131a02){_0x445626(_0x131a02);});});}function checkLicense(_0x444d0b,_0x30a13d){if(!_0x444d0b){demoLicense['uuid']=_0x444d0b[_0x46e7('0xc')];return demoLicense;}try{var _0x34eb58=_0x30a13d||_0x444d0b['license'];if(_[_0x46e7('0xd')](_0x34eb58)){throw new Error(_0x46e7('0xe'));}var _0x12bef9=_0x444d0b[_0x46e7('0xc')];var _0x397029=_0x444d0b[_0x46e7('0xf')];var _0x2b811f=_0x12bef9[_0x46e7('0x10')]('-')[0x4];var _0x4054ea=_0x12bef9['split']('-')[0x0];var _0x38ea54=encryptor[_0x46e7('0x11')](_0x34eb58,util[_0x46e7('0x12')]('%s:%s:%s',_0x2b811f,_0x12bef9,_0x4054ea));var _0x3b8d77=JSON[_0x46e7('0x13')](_0x38ea54);_0x3b8d77['demo']=![];_0x3b8d77[_0x46e7('0x14')]=_0x12bef9;_0x3b8d77[_0x46e7('0x15')]=hardware[_0x46e7('0x7')]();if(_0x397029){var _0x3a3a90=encryptor[_0x46e7('0x11')](_0x397029);_0x3b8d77[_0x46e7('0x16')]=_0x3a3a90;_0x3b8d77[_0x46e7('0x17')]=moment(_0x3a3a90)[_0x46e7('0x18')](0x7,_0x46e7('0x19'))[_0x46e7('0x12')]();_0x3b8d77[_0x46e7('0x1a')]=_0x3b8d77['uuid']!=_0x3b8d77[_0x46e7('0x15')]?'changed':_0x46e7('0x1b');}return _0x3b8d77;}catch(_0x10e704){breakingLicense['uuid']=_0x444d0b['data1'];breakingLicense['message']=_0x10e704['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2f77f2,_0x1fa853){getLicense()[_0x46e7('0xb')](function(_0x3439ae){return db[_0x46e7('0x1c')][_0x46e7('0x1d')]({'attributes':[_0x46e7('0x1e'),[db[_0x46e7('0x1f')]['fn'](_0x46e7('0x20'),db[_0x46e7('0x1f')][_0x46e7('0x21')](_0x46e7('0x1e'))),_0x46e7('0x22')]],'group':'role','where':{'role':{'$or':['admin',_0x46e7('0x23'),_0x46e7('0x24')]}},'raw':!![]})['then'](function(_0x55d3ea){var _0x49f81c={'user':_0x3439ae[_0x46e7('0x25')]||0x0,'telephone':_0x3439ae[_0x46e7('0x26')]||0x0};_0x55d3ea[_0x46e7('0x27')](function(_0x3cf5e4){var _0x4d0137=_0x3cf5e4['role']===_0x46e7('0x28')?'user':_0x3cf5e4[_0x46e7('0x1e')];_0x49f81c[_0x4d0137]-=_0x3cf5e4['count'];if(_0x49f81c[_0x4d0137]<0x0)_0x49f81c[_0x4d0137]=0x0;});_0x2f77f2(_0x49f81c);return;});})[_0x46e7('0x29')](function(_0x833a9f){_0x1fa853(_0x833a9f);});});}function checkUserLimits(_0x25285e){return new BPromise(function(_0x1e2f1e,_0x550190){getLimits()[_0x46e7('0xb')](function(_0x4bb721){var _0xd8180b=_[_0x46e7('0x2a')](_[_0x46e7('0x2b')](_0x25285e,_0x46e7('0x1e')),[_0x46e7('0x28'),_0x46e7('0x23'),'telephone']);var _0x51fc59=(_0xd8180b[_0x46e7('0x28')]||0x0)+(_0xd8180b[_0x46e7('0x23')]||0x0);var _0x42b77b=_0xd8180b[_0x46e7('0x24')]||0x0;if(_0x51fc59>_0x4bb721['user'])return _0x550190(_0x46e7('0x2c'));if(_0x42b77b>_0x4bb721[_0x46e7('0x24')])return _0x550190(_0x46e7('0x2d'));return _0x1e2f1e();})[_0x46e7('0x29')](function(_0x4a3e1d){_0x550190(_0x4a3e1d);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xb2ab=['find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','message','User','role','sequelize','COUNT','col','count','admin','user','telephone','users','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb2ab,0x1ef));var _0xbb2a=function(_0x101803,_0x5ee4d9){_0x101803=_0x101803-0x0;var _0x55d59c=_0xb2ab[_0x101803];return _0x55d59c;};'use strict';var util=require(_0xbb2a('0x0'));var _=require(_0xbb2a('0x1'));var moment=require(_0xbb2a('0x2'));var BPromise=require(_0xbb2a('0x3'));var hardware=require(_0xbb2a('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xbb2a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb2a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbb2a('0x7'),'machineUuid':hardware[_0xbb2a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb2a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbb2a('0x9'),'machineUuid':hardware[_0xbb2a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x359601){return new BPromise(function(_0x43273f,_0x238b60){return db[_0xbb2a('0xa')][_0xbb2a('0xb')](_[_0xbb2a('0xc')](_0x359601,{'raw':!![],'where':{'id':0x1}}))[_0xbb2a('0xd')](function(_0x4be9e0){return checkLicense(_0x4be9e0,null);})[_0xbb2a('0xd')](function(_0x558b74){_0x43273f(_0x558b74);return;})[_0xbb2a('0xe')](function(_0x223c85){_0x238b60(_0x223c85);});});}function checkLicense(_0x5be922,_0x3db2b0){if(!_0x5be922){demoLicense[_0xbb2a('0xf')]=_0x5be922[_0xbb2a('0x10')];return demoLicense;}try{var _0x17ddfd=_0x3db2b0||_0x5be922[_0xbb2a('0x11')];if(_[_0xbb2a('0x12')](_0x17ddfd)){throw new Error(_0xbb2a('0x13'));}var _0x31dfa7=_0x5be922[_0xbb2a('0x10')];var _0x626bf7=_0x5be922[_0xbb2a('0x14')];var _0x31f0d9=_0x31dfa7['split']('-')[0x4];var _0x45ba1c=_0x31dfa7['split']('-')[0x0];var _0x271f28=encryptor[_0xbb2a('0x15')](_0x17ddfd,util[_0xbb2a('0x16')](_0xbb2a('0x17'),_0x31f0d9,_0x31dfa7,_0x45ba1c));var _0x459aa8=JSON[_0xbb2a('0x18')](_0x271f28);_0x459aa8[_0xbb2a('0x19')]=![];_0x459aa8[_0xbb2a('0xf')]=_0x31dfa7;_0x459aa8[_0xbb2a('0x1a')]=hardware[_0xbb2a('0x8')]();if(_0x626bf7){var _0x1b919a=encryptor[_0xbb2a('0x15')](_0x626bf7);_0x459aa8[_0xbb2a('0x1b')]=_0x1b919a;_0x459aa8[_0xbb2a('0x1c')]=moment(_0x1b919a)[_0xbb2a('0x1d')](0x7,'days')['format']();_0x459aa8['grayReason']=_0x459aa8[_0xbb2a('0xf')]!=_0x459aa8['machineUuid']?'changed':'disabled';}return _0x459aa8;}catch(_0x1933bb){breakingLicense['uuid']=_0x5be922[_0xbb2a('0x10')];breakingLicense[_0xbb2a('0x1e')]=_0x1933bb[_0xbb2a('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xe5a9a2,_0x2921b6){getLicense()[_0xbb2a('0xd')](function(_0x1f57f2){return db[_0xbb2a('0x1f')]['findAll']({'attributes':[_0xbb2a('0x20'),[db[_0xbb2a('0x21')]['fn'](_0xbb2a('0x22'),db[_0xbb2a('0x21')][_0xbb2a('0x23')](_0xbb2a('0x20'))),_0xbb2a('0x24')]],'group':'role','where':{'role':{'$or':[_0xbb2a('0x25'),_0xbb2a('0x26'),_0xbb2a('0x27')]}},'raw':!![]})[_0xbb2a('0xd')](function(_0xe10277){var _0x5b366a={'user':_0x1f57f2[_0xbb2a('0x28')]||0x0,'telephone':_0x1f57f2['telephones']||0x0};_0xe10277[_0xbb2a('0x29')](function(_0x59c0a4){var _0x1c9d89=_0x59c0a4[_0xbb2a('0x20')]===_0xbb2a('0x25')?_0xbb2a('0x26'):_0x59c0a4[_0xbb2a('0x20')];_0x5b366a[_0x1c9d89]-=_0x59c0a4[_0xbb2a('0x24')];if(_0x5b366a[_0x1c9d89]<0x0)_0x5b366a[_0x1c9d89]=0x0;});_0xe5a9a2(_0x5b366a);return;});})[_0xbb2a('0xe')](function(_0x58e203){_0x2921b6(_0x58e203);});});}function checkUserLimits(_0x5301f5){return new BPromise(function(_0x1d2377,_0xc3749e){getLimits()['then'](function(_0x2a1dba){var _0x5a8ea3=_[_0xbb2a('0x2a')](_['countBy'](_0x5301f5,_0xbb2a('0x20')),['admin',_0xbb2a('0x26'),_0xbb2a('0x27')]);var _0x21a391=(_0x5a8ea3[_0xbb2a('0x25')]||0x0)+(_0x5a8ea3[_0xbb2a('0x26')]||0x0);var _0xa20baa=_0x5a8ea3[_0xbb2a('0x27')]||0x0;if(_0x21a391>_0x2a1dba[_0xbb2a('0x26')])return _0xc3749e(_0xbb2a('0x2b'));if(_0xa20baa>_0x2a1dba[_0xbb2a('0x27')])return _0xc3749e(_0xbb2a('0x2c'));return _0x1d2377();})['catch'](function(_0x4e9b50){_0xc3749e(_0x4e9b50);});});}module[_0xbb2a('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index ceb2d91..d298039 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 _0x8156=['secret','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x16c314,_0x4bcd8e){var _0x1b0580=function(_0x429c5d){while(--_0x429c5d){_0x16c314['push'](_0x16c314['shift']());}};_0x1b0580(++_0x4bcd8e);}(_0x8156,0xad));var _0x6815=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8156[_0x3947c9];return _0x2e7871;};'use strict';module['exports']={'DOMAIN':_0x6815('0x0'),'SESSION_SECRET':_0x6815('0x1'),'GOOGLE_ID':_0x6815('0x2'),'GOOGLE_SECRET':_0x6815('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xc8ce=['myappanuglar-secret','app-id','exports'];(function(_0x57eaa0,_0x32aae5){var _0x9d53d2=function(_0x3c6ccd){while(--_0x3c6ccd){_0x57eaa0['push'](_0x57eaa0['shift']());}};_0x9d53d2(++_0x32aae5);}(_0xc8ce,0x176));var _0xec8c=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xc8ce[_0x56740a];return _0x257144;};'use strict';module[_0xec8c('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xec8c('0x1'),'GOOGLE_ID':_0xec8c('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index cc661be..71ec3ba 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa347=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','File','%s-%s','error','transports','env','moment','util','path','INFO','/var','format','%s-%s.log','message','{{{','replace'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xa347,0x89));var _0x7a34=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xa347[_0x28d18d];return _0x470640;};'use strict';var moment=require(_0x7a34('0x0'));var winston=require('winston');var util=require(_0x7a34('0x1'));var path=require(_0x7a34('0x2'));var debugLevel=_0x7a34('0x3');function filename(_0x4228e9,_0x53db56){return path['join'](_0x7a34('0x4'),'log','xcally',util[_0x7a34('0x5')](_0x7a34('0x6'),_0x4228e9,_0x53db56));}function formatter(_0x25d0e,_0x5141d7){_0x5141d7['message']=_0x5141d7[_0x7a34('0x7')]['replace'](/@@{/g,_0x7a34('0x8'))[_0x7a34('0x9')](/}@@/g,_0x7a34('0xa'))[_0x7a34('0x9')](/@{/g,'{{')[_0x7a34('0x9')](/}@/g,'}}');return util[_0x7a34('0x5')](_0x7a34('0xb'),moment()[_0x7a34('0x5')](_0x7a34('0xc')),_0x5141d7[_0x7a34('0xd')]['toUpperCase'](),_0x25d0e,_0x5141d7[_0x7a34('0x7')]);}module[_0x7a34('0xe')]=function(_0x3fb222){return new winston[(_0x7a34('0xf'))]({'transports':[new winston['transports'][(_0x7a34('0x10'))]({'name':util['format'](_0x7a34('0x11'),_0x3fb222,'error'),'filename':filename(_0x3fb222,'error'),'level':_0x7a34('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3cbc52){return formatter(_0x3fb222,_0x3cbc52);}}),new winston[(_0x7a34('0x13'))][(_0x7a34('0x10'))]({'name':util[_0x7a34('0x5')](_0x7a34('0x11'),_0x3fb222,'info'),'filename':filename(_0x3fb222,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x49f247){return formatter(_0x3fb222,_0x49f247);}}),new winston[(_0x7a34('0x13'))]['Console']({'level':process[_0x7a34('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x45c660){return formatter(_0x3fb222,_0x45c660);}})]});}; \ No newline at end of file +var _0xc782=['format','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','exports','transports','%s-%s','error','File','Console','env','debugLevel','moment','winston','util','/var','log','xcally','%s-%s.log','message','replace','}}}'];(function(_0xf680c2,_0x5d30d2){var _0x2baa0e=function(_0x51e5c3){while(--_0x51e5c3){_0xf680c2['push'](_0xf680c2['shift']());}};_0x2baa0e(++_0x5d30d2);}(_0xc782,0x1af));var _0x2c78=function(_0x1b3ddb,_0x190f99){_0x1b3ddb=_0x1b3ddb-0x0;var _0x3b952d=_0xc782[_0x1b3ddb];return _0x3b952d;};'use strict';var moment=require(_0x2c78('0x0'));var winston=require(_0x2c78('0x1'));var util=require(_0x2c78('0x2'));var path=require('path');var debugLevel='INFO';function filename(_0x44d25e,_0x34c0c9){return path['join'](_0x2c78('0x3'),_0x2c78('0x4'),_0x2c78('0x5'),util['format'](_0x2c78('0x6'),_0x44d25e,_0x34c0c9));}function formatter(_0x198a88,_0x2e7242){_0x2e7242['message']=_0x2e7242[_0x2c78('0x7')][_0x2c78('0x8')](/@@{/g,'{{{')[_0x2c78('0x8')](/}@@/g,_0x2c78('0x9'))[_0x2c78('0x8')](/@{/g,'{{')[_0x2c78('0x8')](/}@/g,'}}');return util[_0x2c78('0xa')](_0x2c78('0xb'),moment()[_0x2c78('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2e7242['level'][_0x2c78('0xc')](),_0x198a88,_0x2e7242[_0x2c78('0x7')]);}module[_0x2c78('0xd')]=function(_0x39ad2a){return new winston['Logger']({'transports':[new winston[(_0x2c78('0xe'))]['File']({'name':util[_0x2c78('0xa')](_0x2c78('0xf'),_0x39ad2a,'error'),'filename':filename(_0x39ad2a,_0x2c78('0x10')),'level':_0x2c78('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7f8a3){return formatter(_0x39ad2a,_0x7f8a3);}}),new winston[(_0x2c78('0xe'))][(_0x2c78('0x11'))]({'name':util[_0x2c78('0xa')](_0x2c78('0xf'),_0x39ad2a,'info'),'filename':filename(_0x39ad2a,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x274398){return formatter(_0x39ad2a,_0x274398);}}),new winston[(_0x2c78('0xe'))][(_0x2c78('0x12'))]({'level':process[_0x2c78('0x13')][_0x2c78('0x14')]||debugLevel,'json':![],'formatter':function(_0x1c7e4b){return formatter(_0x39ad2a,_0x1c7e4b);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d0c34fe..1d98b84 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 _0x8cd9=['agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x46c11f,_0x437db5){var _0x781344=function(_0x3a48f6){while(--_0x3a48f6){_0x46c11f['push'](_0x46c11f['shift']());}};_0x781344(++_0x437db5);}(_0x8cd9,0x186));var _0x98cd=function(_0x7494c8,_0x1c787e){_0x7494c8=_0x7494c8-0x0;var _0x5bf5ad=_0x8cd9[_0x7494c8];return _0x5bf5ad;};'use strict';var path=require(_0x98cd('0x0'));var os=require('os');var config={'apps':[{'name':_0x98cd('0x1'),'script':path[_0x98cd('0x2')](__dirname,_0x98cd('0x3'))},{'name':_0x98cd('0x4'),'script':path[_0x98cd('0x2')](__dirname,_0x98cd('0x5'))},{'name':_0x98cd('0x6'),'script':path[_0x98cd('0x2')](__dirname,_0x98cd('0x7'))},{'name':_0x98cd('0x8'),'script':path['join'](__dirname,_0x98cd('0x9'))},{'name':'routing','script':path[_0x98cd('0x2')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x98cd('0x2')](__dirname,_0x98cd('0xa'))}]};module[_0x98cd('0xb')]=config; \ No newline at end of file +var _0x32b3=['routing','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x5e97d7,_0xb16c6f){var _0x528559=function(_0x27b3ed){while(--_0x27b3ed){_0x5e97d7['push'](_0x5e97d7['shift']());}};_0x528559(++_0xb16c6f);}(_0x32b3,0x1c5));var _0x332b=function(_0x59f6be,_0x472a09){_0x59f6be=_0x59f6be-0x0;var _0x2aef59=_0x32b3[_0x59f6be];return _0x2aef59;};'use strict';var path=require(_0x332b('0x0'));var os=require('os');var config={'apps':[{'name':_0x332b('0x1'),'script':path[_0x332b('0x2')](__dirname,_0x332b('0x3'))},{'name':_0x332b('0x4'),'script':path[_0x332b('0x2')](__dirname,_0x332b('0x5'))},{'name':_0x332b('0x6'),'script':path[_0x332b('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x332b('0x7'),'script':path[_0x332b('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x332b('0x8'),'script':path[_0x332b('0x2')](__dirname,_0x332b('0x9'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6b31d78..9c2d518 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 _0xdc68=['saved','pm2','bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0xdb29a5,_0x24f948){var _0x237689=function(_0x5d9c6e){while(--_0x5d9c6e){_0xdb29a5['push'](_0xdb29a5['shift']());}};_0x237689(++_0x24f948);}(_0xdc68,0x16d));var _0x8dc6=function(_0x66ce7d,_0x2ee406){_0x66ce7d=_0x66ce7d-0x0;var _0x9591d6=_0xdc68[_0x66ce7d];return _0x9591d6;};'use strict';var pm2=require(_0x8dc6('0x0'));var BPromise=require(_0x8dc6('0x1'));var config=require(_0x8dc6('0x2'));function connect(){return new BPromise(function(_0x5c3a9c,_0x10682e){return pm2[_0x8dc6('0x3')](function(_0x33c2b8){if(_0x33c2b8){return _0x10682e(_0x33c2b8);}return _0x5c3a9c('connected');});});};exports[_0x8dc6('0x4')]=function(_0x1f218a){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x54ec52,_0xd4f620){return pm2['start'](_0x1f218a,function(_0x4ba80b,_0x1e9df2){if(_0x4ba80b){return _0xd4f620(_0x4ba80b);}pm2[_0x8dc6('0x6')]();return _0x54ec52(_0x1e9df2);});});});};exports[_0x8dc6('0x7')]=function(_0x4a3b62){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x47b1de,_0x3cd256){return pm2[_0x8dc6('0x7')](_0x4a3b62,function(_0x1cc4f5,_0x11ed99){if(_0x1cc4f5){return _0x3cd256(_0x1cc4f5);}pm2[_0x8dc6('0x6')]();return _0x47b1de(_0x11ed99);});});});};exports[_0x8dc6('0x8')]=function(_0x3a03b3){return connect()['then'](function(){return new BPromise(function(_0x194195,_0x44ca66){return pm2[_0x8dc6('0x8')](_0x3a03b3,function(_0x202b0f,_0x3f7b72){if(_0x202b0f){return _0x44ca66(_0x202b0f);}pm2[_0x8dc6('0x6')]();return _0x194195(_0x3f7b72);});});});};exports[_0x8dc6('0x9')]=function(){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x480af1,_0x4a8e5f){return pm2['list'](function(_0x557785,_0x5c4c32){if(_0x557785){return _0x4a8e5f(_0x557785);}pm2[_0x8dc6('0x6')]();return _0x480af1(_0x5c4c32);});});});};exports['describe']=function(_0x5d5fc3){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x16bad6,_0x2664af){return pm2[_0x8dc6('0xa')](_0x5d5fc3,function(_0x5022d8,_0x3a0c10){if(_0x5022d8){return _0x2664af(_0x5022d8);}pm2['disconnect']();return _0x16bad6(_0x3a0c10);});});});};exports[_0x8dc6('0xb')]=function(_0x3f87c3){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x59d685,_0x30f26b){return pm2[_0x8dc6('0xb')](_0x3f87c3,function(_0x2c9e35,_0x4cdf21){if(_0x2c9e35){return _0x30f26b(_0x2c9e35);}pm2[_0x8dc6('0x6')]();return _0x59d685(_0x4cdf21);});});});};exports[_0x8dc6('0xc')]=function(){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x38d16d,_0x175208){return pm2[_0x8dc6('0xc')](function(_0x513790){if(_0x513790){return _0x175208(_0x513790);}return _0x38d16d(_0x8dc6('0xd'));});});});}; \ No newline at end of file +var _0x3912=['saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x145c3b,_0x51de15){var _0x2ba2e1=function(_0x488cd8){while(--_0x488cd8){_0x145c3b['push'](_0x145c3b['shift']());}};_0x2ba2e1(++_0x51de15);}(_0x3912,0xa9));var _0x2391=function(_0x28de14,_0x3033b6){_0x28de14=_0x28de14-0x0;var _0x16f202=_0x3912[_0x28de14];return _0x16f202;};'use strict';var pm2=require(_0x2391('0x0'));var BPromise=require(_0x2391('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5b719f,_0x3837ce){return pm2[_0x2391('0x2')](function(_0x186bf8){if(_0x186bf8){return _0x3837ce(_0x186bf8);}return _0x5b719f(_0x2391('0x3'));});});};exports[_0x2391('0x4')]=function(_0x22e7fd){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0xd5a969,_0x79b197){return pm2[_0x2391('0x4')](_0x22e7fd,function(_0x10cf7f,_0x463e84){if(_0x10cf7f){return _0x79b197(_0x10cf7f);}pm2[_0x2391('0x6')]();return _0xd5a969(_0x463e84);});});});};exports[_0x2391('0x7')]=function(_0x8d7719){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0x9a061,_0x231b20){return pm2[_0x2391('0x7')](_0x8d7719,function(_0x237cd8,_0x4974a9){if(_0x237cd8){return _0x231b20(_0x237cd8);}pm2[_0x2391('0x6')]();return _0x9a061(_0x4974a9);});});});};exports[_0x2391('0x8')]=function(_0x1795c6){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0x10b4f4,_0x42bdcf){return pm2[_0x2391('0x8')](_0x1795c6,function(_0x1cbc31,_0x264296){if(_0x1cbc31){return _0x42bdcf(_0x1cbc31);}pm2['disconnect']();return _0x10b4f4(_0x264296);});});});};exports[_0x2391('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x158884,_0x45fd64){return pm2[_0x2391('0x9')](function(_0x1d3d24,_0x5f27bd){if(_0x1d3d24){return _0x45fd64(_0x1d3d24);}pm2['disconnect']();return _0x158884(_0x5f27bd);});});});};exports[_0x2391('0xa')]=function(_0x1770ff){return connect()['then'](function(){return new BPromise(function(_0x2ff9ed,_0xe46b89){return pm2['describe'](_0x1770ff,function(_0x28ca95,_0x2e870f){if(_0x28ca95){return _0xe46b89(_0x28ca95);}pm2['disconnect']();return _0x2ff9ed(_0x2e870f);});});});};exports['delete']=function(_0x3143f){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0xb47893,_0x52e5a6){return pm2[_0x2391('0xb')](_0x3143f,function(_0x588557,_0x3af205){if(_0x588557){return _0x52e5a6(_0x588557);}pm2[_0x2391('0x6')]();return _0xb47893(_0x3af205);});});});};exports[_0x2391('0xc')]=function(){return connect()[_0x2391('0x5')](function(){return new BPromise(function(_0x55640b,_0x3c6b17){return pm2['dump'](function(_0x43ee25){if(_0x43ee25){return _0x3c6b17(_0x43ee25);}return _0x55640b(_0x2391('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ab186c9..970d6d3 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 _0xb0e3=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','subtract','minutes','then','length'];(function(_0x4e73f1,_0x138e55){var _0x58c69b=function(_0x22930b){while(--_0x22930b){_0x4e73f1['push'](_0x4e73f1['shift']());}};_0x58c69b(++_0x138e55);}(_0xb0e3,0x98));var _0x3b0e=function(_0x4b503a,_0x2060c5){_0x4b503a=_0x4b503a-0x0;var _0x2a6443=_0xb0e3[_0x4b503a];return _0x2a6443;};'use strict';var _=require(_0x3b0e('0x0'));var moment=require(_0x3b0e('0x1'));var Redis=require(_0x3b0e('0x2'));var util=require('util');var config=require(_0x3b0e('0x3'));var db=require(_0x3b0e('0x4'))['db'];var logger=require('../logger')(_0x3b0e('0x5'));config[_0x3b0e('0x6')]=_[_0x3b0e('0x7')](config[_0x3b0e('0x6')],{'host':_0x3b0e('0x8'),'port':0x18eb});var io=require(_0x3b0e('0x9'))(new Redis(config[_0x3b0e('0x6')]));function closeInteractions(){var _0x2c67f8=0x0;var _0x3eea91=[];return db[_0x3b0e('0xa')][_0x3b0e('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x403659){_0x2c67f8=_0x403659[_0x3b0e('0xc')];if(_0x2c67f8){return db['ChatInteraction'][_0x3b0e('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3b0e('0xe')](_0x403659[_0x3b0e('0xc')],_0x3b0e('0xf'))}}});}else{return[];}})[_0x3b0e('0x10')](function(_0x55b0a8){if(_0x55b0a8&&_0x55b0a8[_0x3b0e('0x11')]){_0x3eea91=_[_0x3b0e('0x12')](_0x55b0a8||[],'id');logger[_0x3b0e('0x13')](_0x3b0e('0x14'),_0x3eea91[_0x3b0e('0x15')]());return db[_0x3b0e('0x16')][_0x3b0e('0x17')]({'closeReason':_0x3b0e('0x18'),'disposition':_0x3b0e('0x19'),'closed':!![],'closedAt':moment()[_0x3b0e('0x1a')](_0x3b0e('0x1b'))},{'where':{'id':_0x3eea91}});}})['then'](function(){if(_0x3eea91&&_0x3eea91['length']){logger['info'](_0x3b0e('0x1c'),_0x3eea91[_0x3b0e('0x15')]());for(var _0xe20a0b=0x0;_0xe20a0b<_0x3eea91['length'];_0xe20a0b++){io[_0x3b0e('0x1d')](_0x3b0e('0x1e'),{'id':_0x3eea91[_0xe20a0b],'closed':!![]});}}})[_0x3b0e('0x1f')](function(_0x564991){logger['error'](_0x3b0e('0x20'),_0x564991?util['inspect'](_0x564991,{'showHidden':![],'depth':null}):'');});}exports[_0x3b0e('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x14bc=['defaults','localhost','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','length','info','join','update','system','timeout','format','emit','chatInteraction:update','catch','inspect','start','moment','ioredis','util','../../config/environment','../logger','schedule','redis'];(function(_0x90d794,_0xf3931b){var _0x1b05a5=function(_0x169299){while(--_0x169299){_0x90d794['push'](_0x90d794['shift']());}};_0x1b05a5(++_0xf3931b);}(_0x14bc,0x19d));var _0xc14b=function(_0x405c7e,_0x264502){_0x405c7e=_0x405c7e-0x0;var _0x3fa7d9=_0x14bc[_0x405c7e];return _0x3fa7d9;};'use strict';var _=require('lodash');var moment=require(_0xc14b('0x0'));var Redis=require(_0xc14b('0x1'));var util=require(_0xc14b('0x2'));var config=require(_0xc14b('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc14b('0x4'))(_0xc14b('0x5'));config[_0xc14b('0x6')]=_[_0xc14b('0x7')](config['redis'],{'host':_0xc14b('0x8'),'port':0x18eb});var io=require(_0xc14b('0x9'))(new Redis(config[_0xc14b('0x6')]));function closeInteractions(){var _0x5e361a=0x0;var _0xf44f69=[];return db['Setting'][_0xc14b('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xc14b('0xb')](function(_0x4afdbd){_0x5e361a=_0x4afdbd[_0xc14b('0xc')];if(_0x5e361a){return db[_0xc14b('0xd')][_0xc14b('0xe')]({'raw':!![],'attributes':['id',_0xc14b('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4afdbd['chatTimeout'],'minutes')}}});}else{return[];}})[_0xc14b('0xb')](function(_0x3f0020){if(_0x3f0020&&_0x3f0020[_0xc14b('0x10')]){_0xf44f69=_['map'](_0x3f0020||[],'id');logger[_0xc14b('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0xf44f69[_0xc14b('0x12')]());return db['ChatInteraction'][_0xc14b('0x13')]({'closeReason':_0xc14b('0x14'),'disposition':_0xc14b('0x15'),'closed':!![],'closedAt':moment()[_0xc14b('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xf44f69}});}})[_0xc14b('0xb')](function(){if(_0xf44f69&&_0xf44f69[_0xc14b('0x10')]){logger[_0xc14b('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xf44f69[_0xc14b('0x12')]());for(var _0x14e368=0x0;_0x14e368<_0xf44f69[_0xc14b('0x10')];_0x14e368++){io[_0xc14b('0x17')](_0xc14b('0x18'),{'id':_0xf44f69[_0x14e368],'closed':!![]});}}})[_0xc14b('0x19')](function(_0xca1581){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0xca1581?util[_0xc14b('0x1a')](_0xca1581,{'showHidden':![],'depth':null}):'');});}exports[_0xc14b('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 375484c..6020071 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 _0xc5b6=['lodash','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','name','MailServerOut','keys','jobs','map','keyBy','toString','intersection','difference','length','exists','stop','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','deleteJob','stop\x20cron','update','update\x20cron','start','util','path'];(function(_0x205d4f,_0x1551d7){var _0x2a740b=function(_0x3c9995){while(--_0x3c9995){_0x205d4f['push'](_0x205d4f['shift']());}};_0x2a740b(++_0x1551d7);}(_0xc5b6,0xb8));var _0x6c5b=function(_0x232045,_0x1e7473){_0x232045=_0x232045-0x0;var _0xa834d=_0xc5b6[_0x232045];return _0xa834d;};'use strict';var fs=require('fs');var util=require(_0x6c5b('0x0'));var path=require(_0x6c5b('0x1'));var _=require(_0x6c5b('0x2'));var moment=require(_0x6c5b('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6c5b('0x4'));var BPromise=require(_0x6c5b('0x5'));var logger=require(_0x6c5b('0x6'))(_0x6c5b('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x6c5b('0x8'));var analyticDefaultReportController=require(_0x6c5b('0x9'));var client=jayson[_0x6c5b('0xa')][_0x6c5b('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1c1b3a,_0x299f74){return function(){logger['info'](_0x6c5b('0xc'),_0x1c1b3a[_0x6c5b('0xd')]);var _0x2ee49d=!![];var _0x52ea6a={'tls':{'rejectUnauthorized':![]}};if(_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x10')]){_0x52ea6a[_0x6c5b('0x10')]=_0x1c1b3a[_0x6c5b('0xe')]['Smtp'][_0x6c5b('0x10')];}else{_0x52ea6a[_0x6c5b('0x11')]=_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')]['host'];_0x52ea6a[_0x6c5b('0x12')]=_0x1c1b3a[_0x6c5b('0xe')]['Smtp'][_0x6c5b('0x12')];_0x52ea6a[_0x6c5b('0x13')]=_0x1c1b3a['MailAccount']['Smtp']['secure'];}if(_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x14')]){_0x52ea6a['auth']={'user':_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x15')],'pass':_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x16')]};}var _0x59d35b={'account':_0x52ea6a,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1c1b3a[_0x6c5b('0xe')]['name'],_0x1c1b3a['MailAccount'][_0x6c5b('0xd')]||_0x1c1b3a[_0x6c5b('0xe')]['Smtp']['user']),'to':_0x1c1b3a[_0x6c5b('0xd')],'cc':_0x1c1b3a['cc'],'bcc':_0x1c1b3a[_0x6c5b('0x17')],'subject':util[_0x6c5b('0x18')](_0x6c5b('0x19'),_0x299f74['name'],_0x1c1b3a[_0x6c5b('0x1a')],_0x1c1b3a['subtractUnit'])}};var _0x4b5421=path[_0x6c5b('0x1b')](__dirname,_0x6c5b('0x1c'));var _0x28072c=_0x299f74['savename'];var _0x44573c=util['format'](_0x6c5b('0x1d'),path[_0x6c5b('0x1e')](_0x299f74['savename'],path['extname'](_0x299f74['savename'])),'zip');var _0xcc2a6b=path['join'](_0x4b5421,_0x28072c);var _0x25d2b1=path['join'](_0x4b5421,_0x44573c);if(fs[_0x6c5b('0x1f')](_0xcc2a6b)){_0x299f74[_0x6c5b('0x20')]=_0x6c5b('0x21');_0x59d35b['message']['attachments']=[{'filename':_0x28072c,'path':_0xcc2a6b}];_0x59d35b[_0x6c5b('0x22')]['text']=util[_0x6c5b('0x18')](_0x6c5b('0x23'),JSON[_0x6c5b('0x24')](_0x299f74,null,0x2));}else if(fs[_0x6c5b('0x1f')](_0x25d2b1)){_0x299f74[_0x6c5b('0x20')]=_0x6c5b('0x21');_0x59d35b[_0x6c5b('0x22')][_0x6c5b('0x25')]=[{'filename':_0x44573c,'path':_0x25d2b1}];}else{_0x59d35b['message'][_0x6c5b('0x26')]=_0x6c5b('0x27');if(!_0x1c1b3a[_0x6c5b('0x28')]){_0x2ee49d=![];logger[_0x6c5b('0x29')](_0x6c5b('0x2a'));}}if(_0x2ee49d){return client[_0x6c5b('0x2b')](_0x6c5b('0x2c'),_0x59d35b)[_0x6c5b('0x2d')](function(_0x213230){if(_0x213230['error']){return logger['error'](_0x6c5b('0x2e'),JSON[_0x6c5b('0x24')](_0x213230));}return logger['info'](_0x6c5b('0x2f'));})[_0x6c5b('0x30')](function(_0x449a41){return logger[_0x6c5b('0x31')](_0x6c5b('0x2e'),JSON[_0x6c5b('0x24')](_0x449a41));});}};}function handleError(){return function(_0x1375bc){return logger['error'](JSON['stringify'](_0x1375bc));};}function handleResult(_0x4fbc1e){return function(_0x4aef3c){logger[_0x6c5b('0x29')](_0x6c5b('0x32'),JSON[_0x6c5b('0x24')](_0x4aef3c));if(_0x4fbc1e[_0x6c5b('0xe')]&&_0x4fbc1e[_0x6c5b('0xe')][_0x6c5b('0xf')]&&!_[_0x6c5b('0x33')](_0x4fbc1e['email'])){setTimeout(handleSendEmail(_0x4fbc1e,_0x4aef3c),0x3c*0x3e8);}};}function handleJob(_0x26acb8){return function(){try{if(_[_0x6c5b('0x33')](_0x26acb8['subtractNumber'])){return logger['info'](_0x6c5b('0x34'));}if(_[_0x6c5b('0x33')](_0x26acb8[_0x6c5b('0x35')])){return logger[_0x6c5b('0x29')](_0x6c5b('0x36'));}var _0x28891d={'startDate':moment()[_0x6c5b('0x37')](_0x26acb8['subtractNumber'],_0x26acb8[_0x6c5b('0x35')])[_0x6c5b('0x18')](_0x6c5b('0x38')),'endDate':moment()['format'](_0x6c5b('0x38')),'type':_0x6c5b('0x39'),'output':_0x26acb8['output'],'name':_0x26acb8['name']};if(!_[_0x6c5b('0x33')](_0x26acb8[_0x6c5b('0x3a')])){logger[_0x6c5b('0x29')](_0x6c5b('0x3b'),_0x26acb8[_0x6c5b('0x3a')]);return analyticDefaultReportController[_0x6c5b('0x3c')]({'id':_0x26acb8['DefaultReportId']},_0x28891d)[_0x6c5b('0x2d')](handleResult(_0x26acb8))['catch'](handleError());}if(!_['isNil'](_0x26acb8[_0x6c5b('0x3d')])){logger['info'](_0x6c5b('0x3e'),_0x26acb8[_0x6c5b('0x3d')]);return analyticCustomReportController[_0x6c5b('0x3c')]({'id':_0x26acb8[_0x6c5b('0x3d')]},_0x28891d)[_0x6c5b('0x2d')](handleResult(_0x26acb8))[_0x6c5b('0x30')](handleError());}}catch(_0x465a20){logger[_0x6c5b('0x31')](JSON['stringify'](_0x465a20));}return logger['info'](_0x6c5b('0x3f'));};}function getJobs(_0x4630ad){var _0x4d5a74={};if(_0x4630ad){_0x4d5a74['id']=_0x4630ad;}return db[_0x6c5b('0x40')][_0x6c5b('0x41')]({'where':_0x4d5a74,'include':[{'model':db[_0x6c5b('0xe')],'attributes':['id',_0x6c5b('0x42'),_0x6c5b('0xd')],'include':[{'model':db[_0x6c5b('0x43')],'as':'Smtp'}]}]})[_0x6c5b('0x2d')](function(_0xf2584c){var _0x17d59c=_[_0x6c5b('0x44')](manager[_0x6c5b('0x45')]);var _0xd9454f=_[_0x6c5b('0x46')](_0xf2584c,function(_0x3bf6ed){return _0x3bf6ed['id']['toString']();});var _0x1adc1b=_[_0x6c5b('0x47')](_0xf2584c,function(_0x175334){return _0x175334['id'][_0x6c5b('0x48')]();});var _0x57072c=_0x4630ad?_0xd9454f:_['difference'](_0xd9454f,_0x17d59c);var _0x2e8a81=_[_0x6c5b('0x49')](_0xd9454f,_0x17d59c);var _0x484601=_[_0x6c5b('0x4a')](_0x17d59c,_0xd9454f);var _0x468e7d;var _0xa550a1;for(_0x468e7d=0x0;_0x468e7d<_0x484601[_0x6c5b('0x4b')]&&!_0x4630ad;_0x468e7d+=0x1){_0xa550a1=_0x484601[_0x468e7d]['toString']();if(manager[_0x6c5b('0x4c')](_0xa550a1)){manager[_0x6c5b('0x4d')](_0xa550a1);manager['deleteJob'](_0xa550a1);logger['info'](_0x6c5b('0x4e'),_0xa550a1);}}logger[_0x6c5b('0x29')]('toRun',JSON['stringify'](_0x57072c));for(_0x468e7d=0x0;_0x468e7d<_0x57072c[_0x6c5b('0x4b')];_0x468e7d+=0x1){_0xa550a1=_0x57072c[_0x468e7d][_0x6c5b('0x48')]();logger[_0x6c5b('0x29')](_0x6c5b('0x4f'),_0xa550a1);if(_0x4630ad){logger[_0x6c5b('0x29')](_0x6c5b('0x50'),_0x4630ad);logger['info'](JSON[_0x6c5b('0x24')](_0x1adc1b[_0xa550a1]));BPromise[_0x6c5b('0x51')]()[_0x6c5b('0x2d')](handleJob(_0x1adc1b[_0xa550a1]));logger[_0x6c5b('0x29')](_0x6c5b('0x52'),_0x1adc1b[_0xa550a1][_0x6c5b('0x42')],_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]);}else if(_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]&&_0x1adc1b[_0xa550a1][_0x6c5b('0x54')]&&moment()[_0x6c5b('0x55')](_0x1adc1b[_0xa550a1]['startAt'],_0x1adc1b[_0xa550a1][_0x6c5b('0x56')])){manager[_0x6c5b('0x57')](_0xa550a1,_0x1adc1b[_0xa550a1][_0x6c5b('0x53')],handleJob(_0x1adc1b[_0xa550a1]));manager['start'](_0xa550a1);logger[_0x6c5b('0x29')]('add\x20cron',_0x1adc1b[_0xa550a1][_0x6c5b('0x42')],_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]);}else if(manager[_0x6c5b('0x4c')](_0xa550a1)){manager[_0x6c5b('0x4d')](_0xa550a1);manager[_0x6c5b('0x58')](_0xa550a1);logger[_0x6c5b('0x29')](_0x6c5b('0x59'),_0x1adc1b[_0xa550a1][_0x6c5b('0x42')],_0x1adc1b[_0xa550a1]['cron']);}}for(_0x468e7d=0x0,_0xa550a1;_0x468e7d<_0x2e8a81[_0x6c5b('0x4b')]&&!_0x4630ad;_0x468e7d+=0x1){_0xa550a1=_0x2e8a81[_0x468e7d][_0x6c5b('0x48')]();if(manager[_0x6c5b('0x4c')](_0xa550a1)){if(_0x1adc1b[_0xa550a1]['cron']&&_0x1adc1b[_0xa550a1]['active']&&moment()[_0x6c5b('0x55')](_0x1adc1b[_0xa550a1]['startAt'],_0x1adc1b[_0xa550a1][_0x6c5b('0x56')])){manager[_0x6c5b('0x5a')](_0xa550a1,_0x1adc1b[_0xa550a1][_0x6c5b('0x53')],handleJob(_0x1adc1b[_0xa550a1]));logger[_0x6c5b('0x29')](_0x6c5b('0x5b'),_0x1adc1b[_0xa550a1]['name'],_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]);}else{manager[_0x6c5b('0x4d')](_0xa550a1);manager[_0x6c5b('0x58')](_0xa550a1);logger[_0x6c5b('0x29')](_0x6c5b('0x59'),_0x1adc1b[_0xa550a1]['name'],_0x1adc1b[_0xa550a1]['cron']);}}}})['catch'](function(_0x213ca1){logger[_0x6c5b('0x31')](JSON[_0x6c5b('0x24')](_0x213ca1));});}exports['run']=function(_0x3beb0f){return getJobs(_0x3beb0f);};exports[_0x6c5b('0x5c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0e8f=['active','isBetween','startAt','add','start','stop','stop\x20cron','update','run','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','../../files/reports','%s.%s','basename','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x0e8f,0x66));var _0xf0e8=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x0e8f[_0xa6cc5c];return _0x44803d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xf0e8('0x0'));var _=require(_0xf0e8('0x1'));var moment=require(_0xf0e8('0x2'));var CronJobManager=require(_0xf0e8('0x3'));var jayson=require(_0xf0e8('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0xf0e8('0x5'));var db=require(_0xf0e8('0x6'))['db'];var analyticCustomReportController=require(_0xf0e8('0x7'));var analyticDefaultReportController=require(_0xf0e8('0x8'));var client=jayson['client'][_0xf0e8('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1abfad,_0x3e7577){return function(){logger[_0xf0e8('0xa')](_0xf0e8('0xb'),_0x1abfad[_0xf0e8('0xc')]);var _0x34eb40=!![];var _0x2a7af4={'tls':{'rejectUnauthorized':![]}};if(_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0xf')]){_0x2a7af4[_0xf0e8('0xf')]=_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0xf')];}else{_0x2a7af4[_0xf0e8('0x10')]=_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x10')];_0x2a7af4[_0xf0e8('0x11')]=_0x1abfad[_0xf0e8('0xd')]['Smtp'][_0xf0e8('0x11')];_0x2a7af4[_0xf0e8('0x12')]=_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')]['secure'];}if(_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x13')]){_0x2a7af4[_0xf0e8('0x14')]={'user':_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x15')],'pass':_0x1abfad[_0xf0e8('0xd')]['Smtp'][_0xf0e8('0x16')]};}var _0x11f23e={'account':_0x2a7af4,'message':{'from':util[_0xf0e8('0x17')](_0xf0e8('0x18'),_0x1abfad[_0xf0e8('0xd')]['name'],_0x1abfad['MailAccount']['email']||_0x1abfad[_0xf0e8('0xd')][_0xf0e8('0xe')][_0xf0e8('0x15')]),'to':_0x1abfad[_0xf0e8('0xc')],'cc':_0x1abfad['cc'],'bcc':_0x1abfad[_0xf0e8('0x19')],'subject':util[_0xf0e8('0x17')](_0xf0e8('0x1a'),_0x3e7577[_0xf0e8('0x1b')],_0x1abfad['subtractNumber'],_0x1abfad[_0xf0e8('0x1c')])}};var _0xc4e05e=path[_0xf0e8('0x1d')](__dirname,_0xf0e8('0x1e'));var _0x290fab=_0x3e7577['savename'];var _0x19619d=util['format'](_0xf0e8('0x1f'),path[_0xf0e8('0x20')](_0x3e7577['savename'],path['extname'](_0x3e7577['savename'])),'zip');var _0x422a8d=path[_0xf0e8('0x1d')](_0xc4e05e,_0x290fab);var _0x510018=path[_0xf0e8('0x1d')](_0xc4e05e,_0x19619d);if(fs[_0xf0e8('0x21')](_0x422a8d)){_0x3e7577[_0xf0e8('0x22')]='Sent';_0x11f23e[_0xf0e8('0x23')][_0xf0e8('0x24')]=[{'filename':_0x290fab,'path':_0x422a8d}];_0x11f23e['message'][_0xf0e8('0x25')]=util['format'](_0xf0e8('0x26'),JSON[_0xf0e8('0x27')](_0x3e7577,null,0x2));}else if(fs[_0xf0e8('0x21')](_0x510018)){_0x3e7577[_0xf0e8('0x22')]=_0xf0e8('0x28');_0x11f23e[_0xf0e8('0x23')][_0xf0e8('0x24')]=[{'filename':_0x19619d,'path':_0x510018}];}else{_0x11f23e[_0xf0e8('0x23')]['text']=_0xf0e8('0x29');if(!_0x1abfad[_0xf0e8('0x2a')]){_0x34eb40=![];logger['info'](_0xf0e8('0x2b'));}}if(_0x34eb40){return client[_0xf0e8('0x2c')](_0xf0e8('0x2d'),_0x11f23e)[_0xf0e8('0x2e')](function(_0x206dc8){if(_0x206dc8['error']){return logger[_0xf0e8('0x2f')](_0xf0e8('0x30'),JSON[_0xf0e8('0x27')](_0x206dc8));}return logger['info'](_0xf0e8('0x31'));})[_0xf0e8('0x32')](function(_0x1ebc87){return logger['error']('error\x20mail',JSON[_0xf0e8('0x27')](_0x1ebc87));});}};}function handleError(){return function(_0x248582){return logger['error'](JSON[_0xf0e8('0x27')](_0x248582));};}function handleResult(_0x2cd15d){return function(_0x267aa5){logger[_0xf0e8('0xa')](_0xf0e8('0x33'),JSON[_0xf0e8('0x27')](_0x267aa5));if(_0x2cd15d[_0xf0e8('0xd')]&&_0x2cd15d[_0xf0e8('0xd')][_0xf0e8('0xe')]&&!_[_0xf0e8('0x34')](_0x2cd15d[_0xf0e8('0xc')])){setTimeout(handleSendEmail(_0x2cd15d,_0x267aa5),0x3c*0x3e8);}};}function handleJob(_0x4981a0){return function(){try{if(_[_0xf0e8('0x34')](_0x4981a0[_0xf0e8('0x35')])){return logger[_0xf0e8('0xa')](_0xf0e8('0x36'));}if(_['isNil'](_0x4981a0['subtractUnit'])){return logger[_0xf0e8('0xa')](_0xf0e8('0x37'));}var _0x3c66f3={'startDate':moment()['subtract'](_0x4981a0['subtractNumber'],_0x4981a0[_0xf0e8('0x1c')])['format'](_0xf0e8('0x38')),'endDate':moment()[_0xf0e8('0x17')](_0xf0e8('0x38')),'type':_0xf0e8('0x39'),'output':_0x4981a0[_0xf0e8('0x3a')],'name':_0x4981a0[_0xf0e8('0x1b')]};if(!_[_0xf0e8('0x34')](_0x4981a0[_0xf0e8('0x3b')])){logger[_0xf0e8('0xa')](_0xf0e8('0x3c'),_0x4981a0[_0xf0e8('0x3b')]);return analyticDefaultReportController[_0xf0e8('0x3d')]({'id':_0x4981a0['DefaultReportId']},_0x3c66f3)[_0xf0e8('0x2e')](handleResult(_0x4981a0))[_0xf0e8('0x32')](handleError());}if(!_[_0xf0e8('0x34')](_0x4981a0[_0xf0e8('0x3e')])){logger['info'](_0xf0e8('0x3f'),_0x4981a0['CustomReportId']);return analyticCustomReportController[_0xf0e8('0x3d')]({'id':_0x4981a0[_0xf0e8('0x3e')]},_0x3c66f3)[_0xf0e8('0x2e')](handleResult(_0x4981a0))['catch'](handleError());}}catch(_0x783fe9){logger[_0xf0e8('0x2f')](JSON[_0xf0e8('0x27')](_0x783fe9));}return logger['info'](_0xf0e8('0x40'));};}function getJobs(_0x46ea95){var _0x1b4388={};if(_0x46ea95){_0x1b4388['id']=_0x46ea95;}return db[_0xf0e8('0x41')][_0xf0e8('0x42')]({'where':_0x1b4388,'include':[{'model':db[_0xf0e8('0xd')],'attributes':['id',_0xf0e8('0x1b'),'email'],'include':[{'model':db[_0xf0e8('0x43')],'as':_0xf0e8('0xe')}]}]})[_0xf0e8('0x2e')](function(_0x2961a4){var _0xbbea66=_[_0xf0e8('0x44')](manager['jobs']);var _0x9439b6=_[_0xf0e8('0x45')](_0x2961a4,function(_0xba145a){return _0xba145a['id'][_0xf0e8('0x46')]();});var _0x454d14=_[_0xf0e8('0x47')](_0x2961a4,function(_0x4f633a){return _0x4f633a['id'][_0xf0e8('0x46')]();});var _0x622467=_0x46ea95?_0x9439b6:_[_0xf0e8('0x48')](_0x9439b6,_0xbbea66);var _0x27ebba=_[_0xf0e8('0x49')](_0x9439b6,_0xbbea66);var _0x4742f9=_['difference'](_0xbbea66,_0x9439b6);var _0x16a208;var _0x706b42;for(_0x16a208=0x0;_0x16a208<_0x4742f9[_0xf0e8('0x4a')]&&!_0x46ea95;_0x16a208+=0x1){_0x706b42=_0x4742f9[_0x16a208]['toString']();if(manager[_0xf0e8('0x4b')](_0x706b42)){manager['stop'](_0x706b42);manager[_0xf0e8('0x4c')](_0x706b42);logger[_0xf0e8('0xa')](_0xf0e8('0x4d'),_0x706b42);}}logger[_0xf0e8('0xa')](_0xf0e8('0x4e'),JSON[_0xf0e8('0x27')](_0x622467));for(_0x16a208=0x0;_0x16a208<_0x622467[_0xf0e8('0x4a')];_0x16a208+=0x1){_0x706b42=_0x622467[_0x16a208][_0xf0e8('0x46')]();logger['info'](_0xf0e8('0x4f'),_0x706b42);if(_0x46ea95){logger[_0xf0e8('0xa')](_0xf0e8('0x50'),_0x46ea95);logger[_0xf0e8('0xa')](JSON[_0xf0e8('0x27')](_0x454d14[_0x706b42]));BPromise[_0xf0e8('0x51')]()['then'](handleJob(_0x454d14[_0x706b42]));logger['info'](_0xf0e8('0x52'),_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}else if(_0x454d14[_0x706b42][_0xf0e8('0x53')]&&_0x454d14[_0x706b42][_0xf0e8('0x54')]&&moment()[_0xf0e8('0x55')](_0x454d14[_0x706b42][_0xf0e8('0x56')],_0x454d14[_0x706b42]['endAt'])){manager[_0xf0e8('0x57')](_0x706b42,_0x454d14[_0x706b42][_0xf0e8('0x53')],handleJob(_0x454d14[_0x706b42]));manager[_0xf0e8('0x58')](_0x706b42);logger[_0xf0e8('0xa')]('add\x20cron',_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}else if(manager[_0xf0e8('0x4b')](_0x706b42)){manager[_0xf0e8('0x59')](_0x706b42);manager[_0xf0e8('0x4c')](_0x706b42);logger[_0xf0e8('0xa')](_0xf0e8('0x5a'),_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42]['cron']);}}for(_0x16a208=0x0,_0x706b42;_0x16a208<_0x27ebba[_0xf0e8('0x4a')]&&!_0x46ea95;_0x16a208+=0x1){_0x706b42=_0x27ebba[_0x16a208][_0xf0e8('0x46')]();if(manager[_0xf0e8('0x4b')](_0x706b42)){if(_0x454d14[_0x706b42][_0xf0e8('0x53')]&&_0x454d14[_0x706b42]['active']&&moment()['isBetween'](_0x454d14[_0x706b42][_0xf0e8('0x56')],_0x454d14[_0x706b42]['endAt'])){manager[_0xf0e8('0x5b')](_0x706b42,_0x454d14[_0x706b42][_0xf0e8('0x53')],handleJob(_0x454d14[_0x706b42]));logger[_0xf0e8('0xa')]('update\x20cron',_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}else{manager[_0xf0e8('0x59')](_0x706b42);manager[_0xf0e8('0x4c')](_0x706b42);logger['info'](_0xf0e8('0x5a'),_0x454d14[_0x706b42][_0xf0e8('0x1b')],_0x454d14[_0x706b42][_0xf0e8('0x53')]);}}}})[_0xf0e8('0x32')](function(_0x272ead){logger[_0xf0e8('0x2f')](JSON['stringify'](_0x272ead));});}exports[_0xf0e8('0x5c')]=function(_0x4744af){return getJobs(_0x4744af);};exports[_0xf0e8('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 6500af3..06d7c1f 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 _0x7618=['substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','fileText','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','bucket','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Neutral','update','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Sentiment','Negative','Mixed','catch','name','SequelizeValidationError','error','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob'];(function(_0x4fc20e,_0x19052e){var _0x5baa17=function(_0xa89783){while(--_0xa89783){_0x4fc20e['push'](_0x4fc20e['shift']());}};_0x5baa17(++_0x19052e);}(_0x7618,0xd1));var _0x8761=function(_0x2bd625,_0x1f964e){_0x2bd625=_0x2bd625-0x0;var _0x4d6adf=_0x7618[_0x2bd625];return _0x4d6adf;};var _=require(_0x8761('0x0'));var AWS=require(_0x8761('0x1'));var rp=require(_0x8761('0x2'));var util=require(_0x8761('0x3'));var BPromise=require(_0x8761('0x4'));var db=require(_0x8761('0x5'))['db'];var logger=require(_0x8761('0x6'))(_0x8761('0x7'));function getTranscriptionJob(_0x1649cb,_0x217bda,_0x1be853,_0x49f3f0){return new Promise(function(_0x58d15e,_0x32d989){var _0x5d9d6e=new AWS[(_0x8761('0x8'))]({'accessKeyId':_0x217bda,'secretAccessKey':_0x1649cb,'region':_0x1be853});_0x5d9d6e[_0x8761('0x9')]({'TranscriptionJobName':_0x49f3f0},function(_0x445beb,_0x20e67a){if(_0x445beb){return _0x32d989(_0x445beb);}else{return _0x58d15e(_0x20e67a);}});});}function sentiment(_0x1dbb69,_0x3d73de,_0x3b21a6,_0x1b10a6,_0x3a1e38){return new Promise(function(_0xfd01df,_0x5510ce){var _0x25888c=new AWS['Comprehend']({'accessKeyId':_0x3d73de,'secretAccessKey':_0x1dbb69,'region':_0x3b21a6});_0x25888c['detectSentiment']({'Text':_0x1b10a6,'LanguageCode':_0x3a1e38[_0x8761('0xa')](0x0,0x2)},function(_0x3a58cf,_0x3506d8){if(_0x3a58cf){return _0x5510ce(_0x3a58cf);}else{return _0xfd01df(_0x3506d8);}});});}function checkTranscribeJob(_0x29b1d1,_0x9f7b05,_0x32d5c1){var _0x5c4219;return new BPromise(function(_0x422683,_0x4a1e47){logger[_0x8761('0xb')](util['format'](_0x8761('0xc'),_0x29b1d1['id'],_0x29b1d1[_0x8761('0xd')]));return getTranscriptionJob(_0x32d5c1['data1'],_0x32d5c1[_0x8761('0xe')],_0x9f7b05[_0x8761('0xf')],_0x29b1d1['transcribeName'])[_0x8761('0x10')](function(_0x3976e1){logger[_0x8761('0xb')](util['format'](_0x8761('0x11'),_0x29b1d1['id'],_0x29b1d1['transcribeName'],_0x3976e1[_0x8761('0x12')]['TranscriptionJobStatus']));if(!_0x29b1d1['fileText']){switch(_0x3976e1[_0x8761('0x12')][_0x8761('0x13')]){case _0x8761('0x14'):var _0x480e8a={'transcribeStatus':_0x3976e1[_0x8761('0x12')]['TranscriptionJobStatus'],'fileUri':_0x3976e1[_0x8761('0x12')][_0x8761('0x15')][_0x8761('0x16')]};logger['info'](util[_0x8761('0x17')]('[RECORDING:%d]\x20Get\x20transcript',_0x29b1d1['id']));return rp({'uri':_0x3976e1[_0x8761('0x12')][_0x8761('0x15')]['TranscriptFileUri'],'json':!![]})[_0x8761('0x10')](function(_0x47ff31){logger[_0x8761('0xb')](util['format'](_0x8761('0x18'),_0x29b1d1['id']));if(_0x47ff31&&_0x47ff31[_0x8761('0x19')]&&_0x47ff31[_0x8761('0x19')]['transcripts']&&_0x47ff31[_0x8761('0x19')]['transcripts']['length']){_0x480e8a[_0x8761('0x1a')]='';for(var _0x37e59e=0x0;_0x37e59e<_0x47ff31[_0x8761('0x19')][_0x8761('0x1b')][_0x8761('0x1c')];_0x37e59e++){_0x480e8a[_0x8761('0x1a')]+=_0x47ff31[_0x8761('0x19')]['transcripts'][_0x37e59e][_0x8761('0x1d')]+'';}}return _0x29b1d1['update'](_0x480e8a);})['then'](function(){logger[_0x8761('0xb')](util['format'](_0x8761('0x1e'),_0x29b1d1['id']));if(!_0x29b1d1['tempSentiment']){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x21'));}if(!_0x9f7b05[_0x8761('0x22')]||!_0x9f7b05['sentimentAccountId']||!_0x9f7b05[_0x8761('0x23')]||!_0x9f7b05['language']||!_0x9f7b05[_0x8761('0x24')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x480e8a['fileText']){throw new Error(_0x8761('0x25'));}if(_0x9f7b05[_0x8761('0x26')]===_0x32d5c1['id']){return _0x32d5c1;}else{return db[_0x8761('0x27')][_0x8761('0x28')]({'where':{'id':_settings[_0x8761('0x26')]}});}})[_0x8761('0x10')](function(_0x44bb5c){if(!_0x44bb5c){throw new db['Sequelize'][(_0x8761('0x20'))](_0x8761('0x29'));}if(!_0x44bb5c[_0x8761('0x2a')]||!_0x44bb5c[_0x8761('0xe')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x5c4219=_0x44bb5c;logger[_0x8761('0xb')](util[_0x8761('0x17')](_0x8761('0x2b'),_0x29b1d1['id']));return sentiment(_0x5c4219[_0x8761('0x2a')],_0x5c4219[_0x8761('0xe')],_0x9f7b05[_0x8761('0x23')],_0x480e8a['fileText'],_0x9f7b05[_0x8761('0x2c')]);})[_0x8761('0x10')](function(_0x4e3902){logger[_0x8761('0xb')](util[_0x8761('0x17')](_0x8761('0x2d'),_0x29b1d1['id']));return _0x29b1d1['update']({'sentiment':_0x4e3902['Sentiment'],'sPositive':_0x4e3902[_0x8761('0x2e')][_0x8761('0x2f')],'sNegative':_0x4e3902[_0x8761('0x2e')]['Negative'],'sMixed':_0x4e3902[_0x8761('0x2e')]['Mixed'],'sNeutral':_0x4e3902[_0x8761('0x2e')][_0x8761('0x30')]});})[_0x8761('0x10')](function(){logger['info'](util[_0x8761('0x17')](_0x8761('0x1e'),_0x29b1d1['id']));_0x422683();});case'FAILED':return _0x29b1d1[_0x8761('0x31')]({'transcribeStatus':_0x8761('0x32'),'failureReason':_0x3976e1['TranscriptionJob'][_0x8761('0x33')]})[_0x8761('0x10')](function(){logger[_0x8761('0xb')](util[_0x8761('0x17')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x29b1d1['id']));_0x422683();});default:logger['info'](util[_0x8761('0x17')](_0x8761('0x34'),_0x29b1d1['id']));break;}}else{return BPromise[_0x8761('0x35')]()[_0x8761('0x10')](function(){if(!_0x29b1d1[_0x8761('0x36')]){throw new db[(_0x8761('0x1f'))]['ValidationError'](_0x8761('0x21'));}if(!_0x9f7b05[_0x8761('0x22')]||!_0x9f7b05[_0x8761('0x26')]||!_0x9f7b05[_0x8761('0x23')]||!_0x9f7b05['language']||!_0x9f7b05[_0x8761('0x24')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x37'));}if(!_0x29b1d1[_0x8761('0x1a')]){throw new Error(_0x8761('0x25'));}if(_0x9f7b05[_0x8761('0x26')]===_0x32d5c1['id']){return _0x32d5c1;}else{return db[_0x8761('0x27')][_0x8761('0x28')]({'where':{'id':_settings[_0x8761('0x26')]}});}})['then'](function(_0x502ccb){if(!_0x502ccb){throw new db['Sequelize']['ValidationError'](_0x8761('0x29'));}if(!_0x502ccb[_0x8761('0x2a')]||!_0x502ccb[_0x8761('0xe')]){throw new db['Sequelize'][(_0x8761('0x20'))](_0x8761('0x38'));}_0x5c4219=_0x502ccb;logger[_0x8761('0xb')](util[_0x8761('0x17')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x29b1d1['id']));return sentiment(_0x5c4219[_0x8761('0x2a')],_0x5c4219['data2'],_0x9f7b05[_0x8761('0x23')],_0x29b1d1[_0x8761('0x1a')],_0x9f7b05['language']);})['then'](function(_0x269509){logger['info'](util[_0x8761('0x17')](_0x8761('0x2d'),_0x29b1d1['id']));return _0x29b1d1[_0x8761('0x31')]({'sentiment':_0x269509[_0x8761('0x39')],'sPositive':_0x269509['SentimentScore'][_0x8761('0x2f')],'sNegative':_0x269509[_0x8761('0x2e')][_0x8761('0x3a')],'sMixed':_0x269509['SentimentScore'][_0x8761('0x3b')],'sNeutral':_0x269509['SentimentScore']['Neutral'],'transcribeStatus':_0x8761('0x14')});})['then'](function(){logger['info'](util[_0x8761('0x17')](_0x8761('0x1e'),_0x29b1d1['id']));_0x422683();});}})[_0x8761('0x3c')](function(_0x511abc){if(_0x511abc){if(!_0x511abc[_0x8761('0x3d')]||_0x511abc['name']!==_0x8761('0x3e')){logger[_0x8761('0x3f')](util[_0x8761('0x17')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x29b1d1['id']),util['inspect'](_0x511abc,{'showHidden':![],'depth':null}));}}_0x422683();});});}function checkTranscribe(){var _0x2e2f06;var _0x3660ad;var _0x140933;return db['VoiceRecording'][_0x8761('0x40')]({'where':{'transcribeStatus':_0x8761('0x41')}})[_0x8761('0x10')](function(_0x26c683){if(!_0x26c683||!_0x26c683['length']){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x42'));}_0x2e2f06=_0x26c683;return db[_0x8761('0x43')][_0x8761('0x28')]({'where':{'id':0x1}});})['then'](function(_0xc2111c){if(!_0xc2111c){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x44'));}_0x3660ad=_0xc2111c;if(!_0x3660ad[_0x8761('0x7')]||!_0x3660ad['transcribeAccountId']||!_0x3660ad[_0x8761('0xf')]||!_0x3660ad['language']||!_0x3660ad[_0x8761('0x24')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x45'));}return db['CloudProvider']['findOne']({'where':{'id':_0x3660ad[_0x8761('0x46')]}});})[_0x8761('0x10')](function(_0x37740d){if(!_0x37740d){throw new db[(_0x8761('0x1f'))]['ValidationError'](_0x8761('0x29'));}if(!_0x37740d['data1']||!_0x37740d[_0x8761('0xe')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x38'));}_0x140933=_0x37740d;var _0x1673bc=[];_0x2e2f06['forEach'](function(_0x196577){_0x1673bc['push'](checkTranscribeJob(_0x196577,_0x3660ad,_0x140933));});return BPromise[_0x8761('0x47')](_0x1673bc);})[_0x8761('0x3c')](function(_0x2700c8){if(_0x2700c8){if(!_0x2700c8[_0x8761('0x3d')]||_0x2700c8[_0x8761('0x3d')]!==_0x8761('0x3e')){logger[_0x8761('0x3f')](util['inspect'](_0x2700c8,{'showHidden':![],'depth':null}));}}});}exports[_0x8761('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xbee3=['[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Sequelize','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Negative','FAILED','FailureReason','resolve','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','Neutral','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','all','catch','SequelizeValidationError','error','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then'];(function(_0x41b29b,_0x1e9f85){var _0x30bba7=function(_0x1247dc){while(--_0x1247dc){_0x41b29b['push'](_0x41b29b['shift']());}};_0x30bba7(++_0x1e9f85);}(_0xbee3,0x110));var _0x3bee=function(_0x46923f,_0x503b17){_0x46923f=_0x46923f-0x0;var _0x2de413=_0xbee3[_0x46923f];return _0x2de413;};var _=require('lodash');var AWS=require(_0x3bee('0x0'));var rp=require(_0x3bee('0x1'));var util=require(_0x3bee('0x2'));var BPromise=require(_0x3bee('0x3'));var db=require(_0x3bee('0x4'))['db'];var logger=require(_0x3bee('0x5'))(_0x3bee('0x6'));function getTranscriptionJob(_0x295be7,_0x51f36a,_0x58999d,_0x102d87){return new Promise(function(_0x5d4141,_0x1511b4){var _0x44718d=new AWS['TranscribeService']({'accessKeyId':_0x51f36a,'secretAccessKey':_0x295be7,'region':_0x58999d});_0x44718d[_0x3bee('0x7')]({'TranscriptionJobName':_0x102d87},function(_0x15d9fd,_0x335984){if(_0x15d9fd){return _0x1511b4(_0x15d9fd);}else{return _0x5d4141(_0x335984);}});});}function sentiment(_0x40e138,_0x3a991e,_0x36ed05,_0x4066e9,_0x2a0f8b){return new Promise(function(_0x37d0f5,_0x208fe3){var _0x47ea92=new AWS['Comprehend']({'accessKeyId':_0x3a991e,'secretAccessKey':_0x40e138,'region':_0x36ed05});_0x47ea92[_0x3bee('0x8')]({'Text':_0x4066e9,'LanguageCode':_0x2a0f8b['substring'](0x0,0x2)},function(_0x6f9dc4,_0x1644f5){if(_0x6f9dc4){return _0x208fe3(_0x6f9dc4);}else{return _0x37d0f5(_0x1644f5);}});});}function checkTranscribeJob(_0x1ed3a8,_0x4f3a63,_0x2d4eae){var _0x4c3018;return new BPromise(function(_0x406af1,_0x3242db){logger[_0x3bee('0x9')](util[_0x3bee('0xa')](_0x3bee('0xb'),_0x1ed3a8['id'],_0x1ed3a8[_0x3bee('0xc')]));return getTranscriptionJob(_0x2d4eae[_0x3bee('0xd')],_0x2d4eae[_0x3bee('0xe')],_0x4f3a63['transcribeRegion'],_0x1ed3a8[_0x3bee('0xc')])[_0x3bee('0xf')](function(_0xc81f7f){logger[_0x3bee('0x9')](util[_0x3bee('0xa')](_0x3bee('0x10'),_0x1ed3a8['id'],_0x1ed3a8[_0x3bee('0xc')],_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x12')]));if(!_0x1ed3a8[_0x3bee('0x13')]){switch(_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x12')]){case _0x3bee('0x14'):var _0x17fffc={'transcribeStatus':_0xc81f7f['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x15')][_0x3bee('0x16')]};logger[_0x3bee('0x9')](util['format'](_0x3bee('0x17'),_0x1ed3a8['id']));return rp({'uri':_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x15')][_0x3bee('0x16')],'json':!![]})[_0x3bee('0xf')](function(_0x1a0fbb){logger[_0x3bee('0x9')](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x1ed3a8['id']));if(_0x1a0fbb&&_0x1a0fbb[_0x3bee('0x18')]&&_0x1a0fbb['results']['transcripts']&&_0x1a0fbb[_0x3bee('0x18')][_0x3bee('0x19')][_0x3bee('0x1a')]){_0x17fffc[_0x3bee('0x13')]='';for(var _0x142d53=0x0;_0x142d53<_0x1a0fbb['results']['transcripts'][_0x3bee('0x1a')];_0x142d53++){_0x17fffc['fileText']+=_0x1a0fbb[_0x3bee('0x18')][_0x3bee('0x19')][_0x142d53][_0x3bee('0x1b')]+'';}}return _0x1ed3a8[_0x3bee('0x1c')](_0x17fffc);})[_0x3bee('0xf')](function(){logger[_0x3bee('0x9')](util['format'](_0x3bee('0x1d'),_0x1ed3a8['id']));if(!_0x1ed3a8[_0x3bee('0x1e')]){throw new db['Sequelize'][(_0x3bee('0x1f'))](_0x3bee('0x20'));}if(!_0x4f3a63[_0x3bee('0x21')]||!_0x4f3a63[_0x3bee('0x22')]||!_0x4f3a63[_0x3bee('0x23')]||!_0x4f3a63['language']||!_0x4f3a63['bucket']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x17fffc[_0x3bee('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x4f3a63[_0x3bee('0x22')]===_0x2d4eae['id']){return _0x2d4eae;}else{return db[_0x3bee('0x24')][_0x3bee('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3bee('0xf')](function(_0x39144f){if(!_0x39144f){throw new db['Sequelize'][(_0x3bee('0x1f'))](_0x3bee('0x26'));}if(!_0x39144f['data1']||!_0x39144f[_0x3bee('0xe')]){throw new db[(_0x3bee('0x27'))]['ValidationError'](_0x3bee('0x28'));}_0x4c3018=_0x39144f;logger['info'](util['format'](_0x3bee('0x29'),_0x1ed3a8['id']));return sentiment(_0x4c3018[_0x3bee('0xd')],_0x4c3018[_0x3bee('0xe')],_0x4f3a63['sentimentRegion'],_0x17fffc[_0x3bee('0x13')],_0x4f3a63[_0x3bee('0x2a')]);})['then'](function(_0x1f89ee){logger[_0x3bee('0x9')](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ed3a8['id']));return _0x1ed3a8['update']({'sentiment':_0x1f89ee[_0x3bee('0x2b')],'sPositive':_0x1f89ee[_0x3bee('0x2c')][_0x3bee('0x2d')],'sNegative':_0x1f89ee[_0x3bee('0x2c')][_0x3bee('0x2e')],'sMixed':_0x1f89ee['SentimentScore']['Mixed'],'sNeutral':_0x1f89ee[_0x3bee('0x2c')]['Neutral']});})['then'](function(){logger[_0x3bee('0x9')](util[_0x3bee('0xa')](_0x3bee('0x1d'),_0x1ed3a8['id']));_0x406af1();});case _0x3bee('0x2f'):return _0x1ed3a8[_0x3bee('0x1c')]({'transcribeStatus':_0x3bee('0x2f'),'failureReason':_0xc81f7f[_0x3bee('0x11')][_0x3bee('0x30')]})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ed3a8['id']));_0x406af1();});default:logger[_0x3bee('0x9')](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1ed3a8['id']));break;}}else{return BPromise[_0x3bee('0x31')]()[_0x3bee('0xf')](function(){if(!_0x1ed3a8[_0x3bee('0x1e')]){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x20'));}if(!_0x4f3a63[_0x3bee('0x21')]||!_0x4f3a63['sentimentAccountId']||!_0x4f3a63['sentimentRegion']||!_0x4f3a63[_0x3bee('0x2a')]||!_0x4f3a63[_0x3bee('0x32')]){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x33'));}if(!_0x1ed3a8['fileText']){throw new Error(_0x3bee('0x34'));}if(_0x4f3a63[_0x3bee('0x22')]===_0x2d4eae['id']){return _0x2d4eae;}else{return db['CloudProvider'][_0x3bee('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x402930){if(!_0x402930){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x26'));}if(!_0x402930[_0x3bee('0xd')]||!_0x402930[_0x3bee('0xe')]){throw new db[(_0x3bee('0x27'))]['ValidationError'](_0x3bee('0x28'));}_0x4c3018=_0x402930;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1ed3a8['id']));return sentiment(_0x4c3018[_0x3bee('0xd')],_0x4c3018[_0x3bee('0xe')],_0x4f3a63['sentimentRegion'],_0x1ed3a8[_0x3bee('0x13')],_0x4f3a63[_0x3bee('0x2a')]);})[_0x3bee('0xf')](function(_0x1ce7ae){logger['info'](util['format'](_0x3bee('0x35'),_0x1ed3a8['id']));return _0x1ed3a8[_0x3bee('0x1c')]({'sentiment':_0x1ce7ae[_0x3bee('0x2b')],'sPositive':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x2d')],'sNegative':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x2e')],'sMixed':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x36')],'sNeutral':_0x1ce7ae[_0x3bee('0x2c')][_0x3bee('0x37')],'transcribeStatus':_0x3bee('0x14')});})[_0x3bee('0xf')](function(){logger[_0x3bee('0x9')](util['format'](_0x3bee('0x1d'),_0x1ed3a8['id']));_0x406af1();});}})['catch'](function(_0x99c415){if(_0x99c415){if(!_0x99c415[_0x3bee('0x38')]||_0x99c415[_0x3bee('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0x3bee('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x1ed3a8['id']),util[_0x3bee('0x39')](_0x99c415,{'showHidden':![],'depth':null}));}}_0x406af1();});});}function checkTranscribe(){var _0x3a4209;var _0x5911c9;var _0x2f216f;return db[_0x3bee('0x3a')][_0x3bee('0x3b')]({'where':{'transcribeStatus':_0x3bee('0x3c')}})[_0x3bee('0xf')](function(_0x4e6b2d){if(!_0x4e6b2d||!_0x4e6b2d['length']){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x3d'));}_0x3a4209=_0x4e6b2d;return db[_0x3bee('0x3e')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x5e7bb8){if(!_0x5e7bb8){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x3f'));}_0x5911c9=_0x5e7bb8;if(!_0x5911c9[_0x3bee('0x6')]||!_0x5911c9[_0x3bee('0x40')]||!_0x5911c9[_0x3bee('0x41')]||!_0x5911c9[_0x3bee('0x2a')]||!_0x5911c9['bucket']){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x42'));}return db[_0x3bee('0x24')][_0x3bee('0x25')]({'where':{'id':_0x5911c9['transcribeAccountId']}});})['then'](function(_0x4d0b69){if(!_0x4d0b69){throw new db[(_0x3bee('0x27'))][(_0x3bee('0x1f'))](_0x3bee('0x26'));}if(!_0x4d0b69[_0x3bee('0xd')]||!_0x4d0b69[_0x3bee('0xe')]){throw new db[(_0x3bee('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2f216f=_0x4d0b69;var _0x1231cb=[];_0x3a4209['forEach'](function(_0x10ac40){_0x1231cb['push'](checkTranscribeJob(_0x10ac40,_0x5911c9,_0x2f216f));});return BPromise[_0x3bee('0x43')](_0x1231cb);})[_0x3bee('0x44')](function(_0x1adeec){if(_0x1adeec){if(!_0x1adeec['name']||_0x1adeec[_0x3bee('0x38')]!==_0x3bee('0x45')){logger[_0x3bee('0x46')](util[_0x3bee('0x39')](_0x1adeec,{'showHidden':![],'depth':null}));}}});}exports[_0x3bee('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 18bb165..20b323d 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 _0xb38e=['join','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','ioredis','util','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','map','update','timeout','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x4515fa,_0x2ff933){var _0x57c392=function(_0x4ff527){while(--_0x4ff527){_0x4515fa['push'](_0x4515fa['shift']());}};_0x57c392(++_0x2ff933);}(_0xb38e,0xec));var _0xeb38=function(_0x4828a3,_0x11ae2b){_0x4828a3=_0x4828a3-0x0;var _0x455fe3=_0xb38e[_0x4828a3];return _0x455fe3;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xeb38('0x2'))('schedule');config[_0xeb38('0x3')]=_[_0xeb38('0x4')](config[_0xeb38('0x3')],{'host':_0xeb38('0x5'),'port':0x18eb});var io=require(_0xeb38('0x6'))(new Redis(config[_0xeb38('0x3')]));function closeInteractions(){var _0x3e8883=[];return db[_0xeb38('0x7')]['findAll']({'raw':!![],'attributes':['id',_0xeb38('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xeb38('0x9')](0x18,'hours')}}})['then'](function(_0x990e6a){if(_0x990e6a&&_0x990e6a['length']){_0x3e8883=_[_0xeb38('0xa')](_0x990e6a||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3e8883['join']());return db[_0xeb38('0x7')][_0xeb38('0xb')]({'closeReason':'system','disposition':_0xeb38('0xc'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3e8883}});}})['then'](function(){if(_0x3e8883&&_0x3e8883[_0xeb38('0xd')]){logger[_0xeb38('0xe')](_0xeb38('0xf'),_0x3e8883[_0xeb38('0x10')]());for(var _0x3d0a81=0x0;_0x3d0a81<_0x3e8883[_0xeb38('0xd')];_0x3d0a81++){io['emit'](_0xeb38('0x11'),{'id':_0x3e8883[_0x3d0a81],'closed':!![]});}}})[_0xeb38('0x12')](function(_0x3be8b8){logger['error'](_0xeb38('0x13'),_0x3be8b8?util['inspect'](_0x3be8b8,{'showHidden':![],'depth':null}):'');});}exports[_0xeb38('0x14')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb237=['emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','map','info','join','update','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xb237,0x1d0));var _0x7b23=function(_0x33199a,_0xcd7e98){_0x33199a=_0x33199a-0x0;var _0x17c3d=_0xb237[_0x33199a];return _0x17c3d;};'use strict';var _=require(_0x7b23('0x0'));var moment=require(_0x7b23('0x1'));var Redis=require(_0x7b23('0x2'));var util=require('util');var config=require(_0x7b23('0x3'));var db=require(_0x7b23('0x4'))['db'];var logger=require(_0x7b23('0x5'))(_0x7b23('0x6'));config[_0x7b23('0x7')]=_[_0x7b23('0x8')](config[_0x7b23('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7b23('0x9'))(new Redis(config[_0x7b23('0x7')]));function closeInteractions(){var _0x529959=[];return db[_0x7b23('0xa')][_0x7b23('0xb')]({'raw':!![],'attributes':['id',_0x7b23('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7b23('0xd')](0x18,'hours')}}})[_0x7b23('0xe')](function(_0x449b76){if(_0x449b76&&_0x449b76['length']){_0x529959=_[_0x7b23('0xf')](_0x449b76||[],'id');logger[_0x7b23('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x529959[_0x7b23('0x11')]());return db['WhatsappInteraction'][_0x7b23('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x7b23('0x13')](_0x7b23('0x14'))},{'where':{'id':_0x529959}});}})[_0x7b23('0xe')](function(){if(_0x529959&&_0x529959['length']){logger[_0x7b23('0x10')](_0x7b23('0x15'),_0x529959[_0x7b23('0x11')]());for(var _0x4fc1fa=0x0;_0x4fc1fa<_0x529959['length'];_0x4fc1fa++){io[_0x7b23('0x16')](_0x7b23('0x17'),{'id':_0x529959[_0x4fc1fa],'closed':!![]});}}})['catch'](function(_0x20ad6d){logger[_0x7b23('0x18')](_0x7b23('0x19'),_0x20ad6d?util[_0x7b23('0x1a')](_0x20ad6d,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 69ac515..dbc4103 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5137=['now','destroy','then','CmContact','finished\x20populating','contacts1','CmHopper','bulkCreate','log','hopper1','contacts2','hopper2','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x4a3225,_0x5e4140){var _0x423624=function(_0x4ddf34){while(--_0x4ddf34){_0x4a3225['push'](_0x4a3225['shift']());}};_0x423624(++_0x5e4140);}(_0x5137,0xc7));var _0x7513=function(_0x21a706,_0x18ac12){_0x21a706=_0x21a706-0x0;var _0x56dea0=_0x5137[_0x21a706];return _0x56dea0;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7513('0x0')]({'id':i,'firstName':_0x7513('0x1')+i,'lastName':_0x7513('0x2')+i,'phone':0xf879fb460+i,'email':_0x7513('0x3')+i+_0x7513('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7513('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7513('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7513('0x3')+i+_0x7513('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7513('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x7513('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7513('0x5')](),'updatedAt':Date[_0x7513('0x5')]()});}db['CmContact'][_0x7513('0x6')]({'where':{}})[_0x7513('0x7')](function(){return db[_0x7513('0x8')]['bulkCreate'](contacts);})[_0x7513('0x7')](function(){console['log'](_0x7513('0x9'),_0x7513('0xa'));return db[_0x7513('0xb')][_0x7513('0x6')]({'where':{}});})[_0x7513('0x7')](function(){return db[_0x7513('0xb')][_0x7513('0xc')](hopper);})['then'](function(){console[_0x7513('0xd')](_0x7513('0x9'),_0x7513('0xe'));return db['CmContact'][_0x7513('0xc')](contacts2);})[_0x7513('0x7')](function(){console[_0x7513('0xd')]('finished\x20populating',_0x7513('0xf'));return db[_0x7513('0xb')]['bulkCreate'](hopper2);})[_0x7513('0x7')](function(){console[_0x7513('0xd')](_0x7513('0x9'),_0x7513('0x10'));})['catch'](function(_0x5f0286){console[_0x7513('0xd')](_0x5f0286);}); \ No newline at end of file +var _0xb87d=['hopper1','contacts2','hopper2','catch','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','push','CmContact','destroy','log','finished\x20populating','contacts1','then','CmHopper','bulkCreate'];(function(_0x310a70,_0x306f74){var _0x232326=function(_0x312ff9){while(--_0x312ff9){_0x310a70['push'](_0x310a70['shift']());}};_0x232326(++_0x306f74);}(_0xb87d,0x180));var _0xdb87=function(_0x1cca2e,_0x2eb56c){_0x1cca2e=_0x1cca2e-0x0;var _0x1531dd=_0xb87d[_0x1cca2e];return _0x1531dd;};'use strict';var util=require(_0xdb87('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xdb87('0x1')+i,'lastName':_0xdb87('0x2')+i,'phone':0xf879fb460+i,'email':_0xdb87('0x3')+i+_0xdb87('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xdb87('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xdb87('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xdb87('0x6')]({'id':i,'firstName':_0xdb87('0x1')+i,'lastName':_0xdb87('0x2')+i,'phone':0xf879fb460+i,'email':_0xdb87('0x3')+i+_0xdb87('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xdb87('0x6')]({'id':i,'active':![],'scheduledat':Date[_0xdb87('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xdb87('0x5')](),'updatedAt':Date[_0xdb87('0x5')]()});}db[_0xdb87('0x7')][_0xdb87('0x8')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0xdb87('0x9')](_0xdb87('0xa'),_0xdb87('0xb'));return db['CmHopper']['destroy']({'where':{}});})[_0xdb87('0xc')](function(){return db[_0xdb87('0xd')][_0xdb87('0xe')](hopper);})[_0xdb87('0xc')](function(){console[_0xdb87('0x9')](_0xdb87('0xa'),_0xdb87('0xf'));return db[_0xdb87('0x7')][_0xdb87('0xe')](contacts2);})[_0xdb87('0xc')](function(){console['log']('finished\x20populating',_0xdb87('0x10'));return db[_0xdb87('0xd')]['bulkCreate'](hopper2);})[_0xdb87('0xc')](function(){console[_0xdb87('0x9')](_0xdb87('0xa'),_0xdb87('0x11'));})[_0xdb87('0x12')](function(_0x3ea57a){console['log'](_0x3ea57a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3bed360..eef6143 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fe0=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x5fe0,0x111));var _0x05fe=function(_0x4529e2,_0x4c82d8){_0x4529e2=_0x4529e2-0x0;var _0x46cbc9=_0x5fe0[_0x4529e2];return _0x46cbc9;};'use strict';var util=require(_0x05fe('0x0'));var db=require(_0x05fe('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x05fe('0x2')]({'name':util[_0x05fe('0x3')](_0x05fe('0x4'),_0x05fe('0x5'),i),'fullname':util['format'](_0x05fe('0x4'),_0x05fe('0x5'),i),'email':util[_0x05fe('0x3')](_0x05fe('0x6'),_0x05fe('0x5'),i),'role':_0x05fe('0x5'),'password':_0x05fe('0x7'),'internal':0xfa0+i,'type':_0x05fe('0x8'),'transport':[_0x05fe('0x9'),'ws',_0x05fe('0xa')],'disallow':[_0x05fe('0xb')],'allow':[_0x05fe('0xc')],'defaultuser':util[_0x05fe('0x3')](_0x05fe('0x4'),_0x05fe('0x5'),i),'encryption':'yes','avpf':_0x05fe('0xd'),'force_avp':'yes','icesupport':_0x05fe('0xd'),'dtlsenable':_0x05fe('0xd'),'dtlsverify':'no','dtlscertfile':_0x05fe('0xe'),'dtlsprivatekey':_0x05fe('0xf'),'dtlssetup':'actpass','callerid':util[_0x05fe('0x3')]('\x22%s\x22\x20<%s>',util[_0x05fe('0x3')](_0x05fe('0x4'),'agent',i),0xfa0+i)});}db[_0x05fe('0x10')][_0x05fe('0x11')](users)[_0x05fe('0x12')](function(){console[_0x05fe('0x13')](_0x05fe('0x14'));})[_0x05fe('0x15')](function(_0x1b2d0f){console[_0x05fe('0x13')](_0x1b2d0f);}); \ No newline at end of file +var _0x1aab=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','%s%s','agent','format','%s%s@xcally.com','password','wss','all'];(function(_0x59cdec,_0xd2be16){var _0x1f8369=function(_0xc38bf5){while(--_0xc38bf5){_0x59cdec['push'](_0x59cdec['shift']());}};_0x1f8369(++_0xd2be16);}(_0x1aab,0x139));var _0xb1aa=function(_0x1dc3ef,_0x440625){_0x1dc3ef=_0x1dc3ef-0x0;var _0xe54c21=_0x1aab[_0x1dc3ef];return _0xe54c21;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xb1aa('0x0'),_0xb1aa('0x1'),i),'fullname':util['format'](_0xb1aa('0x0'),'agent',i),'email':util[_0xb1aa('0x2')](_0xb1aa('0x3'),'agent',i),'role':_0xb1aa('0x1'),'password':_0xb1aa('0x4'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xb1aa('0x5')],'disallow':[_0xb1aa('0x6')],'allow':[_0xb1aa('0x7')],'defaultuser':util[_0xb1aa('0x2')](_0xb1aa('0x0'),'agent',i),'encryption':_0xb1aa('0x8'),'avpf':_0xb1aa('0x8'),'force_avp':_0xb1aa('0x8'),'icesupport':_0xb1aa('0x8'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xb1aa('0x9'),'dtlsprivatekey':_0xb1aa('0xa'),'dtlssetup':_0xb1aa('0xb'),'callerid':util[_0xb1aa('0x2')]('\x22%s\x22\x20<%s>',util[_0xb1aa('0x2')](_0xb1aa('0x0'),_0xb1aa('0x1'),i),0xfa0+i)});}db['User'][_0xb1aa('0xc')](users)[_0xb1aa('0xd')](function(){console[_0xb1aa('0xe')](_0xb1aa('0xf'));})['catch'](function(_0xc2e01d){console[_0xb1aa('0xe')](_0xc2e01d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8d2ab24..8ec8e24 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3114=['leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','connection','setMaxListeners','address','remoteAddress','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','map','Campaign','where','format','%s:queue:%s','length','handshake','query','find','role','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','include','push','ChatQueue','SmsQueue','MailQueue','user','userProfileId','VoiceQueue','FaxQueue','OpenchannelQueue','WhatsappQueues','WhatsappQueue','Trunk','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s'];(function(_0x56cd62,_0x34ac7b){var _0x2fd401=function(_0x49e3ab){while(--_0x49e3ab){_0x56cd62['push'](_0x56cd62['shift']());}};_0x2fd401(++_0x34ac7b);}(_0x3114,0x19f));var _0x4311=function(_0x160ce8,_0x4b3856){_0x160ce8=_0x160ce8-0x0;var _0x5a1b89=_0x3114[_0x160ce8];return _0x5a1b89;};'use strict';var _=require(_0x4311('0x0'));var util=require(_0x4311('0x1'));var BPromise=require(_0x4311('0x2'));var db=require(_0x4311('0x3'))['db'];var config=require(_0x4311('0x4'));var queryQueues={'attributes':['id',_0x4311('0x5')],'include':[{'as':_0x4311('0x6'),'model':db[_0x4311('0x7')],'attributes':['id',_0x4311('0x5'),'role'],'raw':!![],'where':{'role':_0x4311('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4311('0x5')],'where':{'role':_0x4311('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4311('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4311('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4311('0x5'),_0x4311('0xa')],'where':{'type':_0x4311('0xb')}};function getAssociatedResources(_0x1c818b,_0x5119fa,_0x4e2445){return db[_0x4311('0xc')][_0x4311('0xd')]({'where':{'name':_0x1c818b,'userProfileId':_0x5119fa},'raw':!![]})[_0x4311('0xe')](function(_0x262b92){if(_0x262b92){if(_0x262b92['autoAssociation']){switch(_0x1c818b){case _0x4311('0xf'):case _0x4311('0x10'):case _0x4311('0x11'):case _0x4311('0x12'):case _0x4311('0x13'):case _0x4311('0x14'):case'WhatsappQueues':return db[_0x4e2445][_0x4311('0x15')](queryQueues);case _0x4311('0x16'):return db[_0x4e2445][_0x4311('0x15')](queryTelephones);case _0x4311('0x17'):return db[_0x4e2445][_0x4311('0x15')](queryTrunks);case _0x4311('0x18'):return db[_0x4e2445][_0x4311('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0x4311('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x262b92['id']},'raw':!![]})['then'](function(_0x5cbe10){if(_0x5cbe10){var _0x384f59={'where':{'id':_[_0x4311('0x19')](_0x5cbe10,'resourceId')},'raw':!![]};switch(_0x4e2445){case'User':_0x384f59['where']['role']=_0x4311('0x9');break;case _0x4311('0x1a'):_0x384f59[_0x4311('0x1b')]['type']=_0x4311('0xb');break;}return db[_0x4e2445][_0x4311('0x15')](_0x384f59);}else{return[];}});}}else{return[];}})[_0x4311('0xe')](function(_0x4b7f4f){return _0x4b7f4f;});}function joinOrLeaveQueues(_0x3febdd,_0x119ecc,_0x5dcc54,_0x1668ba){_0x3febdd[_0x119ecc](util[_0x4311('0x1c')](_0x4311('0x1d'),_0x5dcc54,_0x1668ba[_0x4311('0x5')]));if(_0x1668ba[_0x4311('0x6')]){for(var _0x5964b4=0x0;_0x5964b4<_0x1668ba[_0x4311('0x6')][_0x4311('0x1e')];_0x5964b4+=0x1){_0x3febdd[_0x119ecc](util[_0x4311('0x1c')]('user:%s',_0x1668ba[_0x4311('0x6')][_0x5964b4][_0x4311('0x5')]));}}}function joinOrLeave(_0x5b6630,_0x16297d,_0x17e08a){var _0x151ed3;if(_0x5b6630[_0x4311('0x1f')][_0x4311('0x20')]['id']){db[_0x4311('0x7')][_0x4311('0x21')]({'attributes':['id','name',_0x4311('0x22'),'userProfileId'],'where':{'id':_0x5b6630[_0x4311('0x1f')][_0x4311('0x20')]['id']},'include':[{'model':db[_0x4311('0x23')],'as':_0x4311('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4311('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4311('0x26')],'as':_0x4311('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x4311('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4311('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x4311('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x514167){if(_0x514167){_0x151ed3=_0x514167;_0x5b6630[_0x16297d](util['format']('user:%s',_0x514167[_0x4311('0x5')]));var _0x3ac832=[];switch(_0x514167[_0x4311('0x22')]){case'admin':_0x5b6630[_0x16297d](_0x4311('0x2b'));_0x5b6630[_0x16297d](_0x4311('0x2c'));if(queryQueues['hasOwnProperty'](_0x4311('0x2d'))){delete queryQueues[_0x4311('0x2d')];}_0x3ac832[_0x4311('0x2e')](db['VoiceQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x2f')][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['FaxQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x30')][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x31')][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['OpenchannelQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['WhatsappQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['User'][_0x4311('0x15')](queryTelephones));_0x3ac832['push'](db['Trunk'][_0x4311('0x15')](queryTrunks));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x1a')][_0x4311('0x15')](queryCampaigns));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x7')][_0x4311('0x15')](queryAgents));break;case _0x4311('0x32'):_0x5b6630[_0x16297d](_0x4311('0x2b'));_0x5b6630[_0x16297d](_0x4311('0x2c'));_0x3ac832['push'](getAssociatedResources('VoiceQueues',_0x514167[_0x4311('0x33')],_0x4311('0x34')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources('ChatQueues',_0x514167['userProfileId'],_0x4311('0x2f')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x11'),_0x514167[_0x4311('0x33')],_0x4311('0x35')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x12'),_0x514167[_0x4311('0x33')],'SmsQueue'));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x13'),_0x514167[_0x4311('0x33')],_0x4311('0x31')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources('OpenchannelQueues',_0x514167[_0x4311('0x33')],_0x4311('0x36')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x37'),_0x514167[_0x4311('0x33')],_0x4311('0x38')));_0x3ac832['push'](getAssociatedResources(_0x4311('0x16'),_0x514167['userProfileId'],_0x4311('0x7')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x17'),_0x514167['userProfileId'],_0x4311('0x39')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x18'),_0x514167[_0x4311('0x33')],_0x4311('0x1a')));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x7')]['findAll'](queryAgents));break;case'agent':_0x5b6630[_0x16297d]('voice:inbound');_0x5b6630[_0x16297d]('voice:outbound');_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3a')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832['push'](_0x514167['getChatQueues']({'attributes':['id','name']}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3b')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832['push'](_0x514167[_0x4311('0x3c')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3d')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3e')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3f')]({'attributes':['id',_0x4311('0x5')]}));break;}return BPromise[_0x4311('0x40')](_0x3ac832);}})[_0x4311('0xe')](function(_0x592cb4){if(_0x592cb4&&_0x592cb4['length']){for(var _0x4f2094=0x0;_0x4f2094<_0x592cb4[_0x4311('0x1e')];_0x4f2094+=0x1){for(var _0x47f966=0x0;_0x47f966<_0x592cb4[_0x4f2094][_0x4311('0x1e')];_0x47f966+=0x1){switch(_0x4f2094){case 0x0:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x41'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x1:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x42'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x2:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x43'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x3:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x44'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x4:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x45'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x5:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x46'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x6:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x47'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x7:_0x5b6630[_0x16297d](util[_0x4311('0x1c')](_0x4311('0x48'),_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0x5')]));break;case 0x8:_0x5b6630[_0x16297d](util['format'](_0x4311('0x49'),_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0x5')]));break;case 0x9:_0x5b6630[_0x16297d](util[_0x4311('0x1c')](_0x4311('0x4a'),_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0xa')],_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0x5')]));break;case 0xa:_0x5b6630[_0x16297d](util['format']('user:%s',_0x592cb4[_0x4f2094][_0x47f966]['name']));break;}}}}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x5e55b0=_[_0x4311('0x19')](_0x151ed3[_0x4311('0x24')],'id');return _0x151ed3['removeChatInteractions'](_0x5e55b0)[_0x4311('0xe')](function(){for(var _0x2efd13=0x0;_0x2efd13<_0x5e55b0[_0x4311('0x1e')];_0x2efd13+=0x1){_0x17e08a[_0x4311('0x4c')](_0x4311('0x4d'),{'ChatInteractionId':Number(_0x5e55b0[_0x2efd13]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d==='leave'){var _0x1cc063=_['map'](_0x151ed3[_0x4311('0x25')],'id');return _0x151ed3[_0x4311('0x4e')](_0x1cc063)[_0x4311('0xe')](function(){for(var _0x52635e=0x0;_0x52635e<_0x1cc063[_0x4311('0x1e')];_0x52635e+=0x1){_0x17e08a['emit'](_0x4311('0x4f'),{'MailInteractionId':Number(_0x1cc063[_0x52635e]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x5981b6=_['map'](_0x151ed3['FaxInteractions'],'id');return _0x151ed3[_0x4311('0x50')](_0x5981b6)[_0x4311('0xe')](function(){for(var _0x327ddf=0x0;_0x327ddf<_0x5981b6[_0x4311('0x1e')];_0x327ddf+=0x1){_0x17e08a[_0x4311('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5981b6[_0x327ddf]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x3829d6=_[_0x4311('0x19')](_0x151ed3['SmsInteractions'],'id');return _0x151ed3[_0x4311('0x51')](_0x3829d6)[_0x4311('0xe')](function(){for(var _0x530c28=0x0;_0x530c28<_0x3829d6[_0x4311('0x1e')];_0x530c28+=0x1){_0x17e08a[_0x4311('0x4c')](_0x4311('0x52'),{'SmsInteractionId':Number(_0x3829d6[_0x530c28]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x5113fd=_['map'](_0x151ed3[_0x4311('0x29')],'id');return _0x151ed3[_0x4311('0x53')](_0x5113fd)['then'](function(){for(var _0x5c20e5=0x0;_0x5c20e5<_0x5113fd[_0x4311('0x1e')];_0x5c20e5+=0x1){_0x17e08a[_0x4311('0x4c')](_0x4311('0x54'),{'OpenchannelInteractionId':Number(_0x5113fd[_0x5c20e5]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x36eb76=_[_0x4311('0x19')](_0x151ed3['WhatsappInteractions'],'id');return _0x151ed3[_0x4311('0x55')](_0x36eb76)[_0x4311('0xe')](function(){for(var _0x54e3ee=0x0;_0x54e3ee<_0x36eb76[_0x4311('0x1e')];_0x54e3ee+=0x1){_0x17e08a['emit'](_0x4311('0x56'),{'WhatsappInteractionId':Number(_0x36eb76[_0x54e3ee]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0x57')](function(_0x5f566d){_0x5b6630['log'](_0x5f566d);});}}function onDisconnect(_0x2434bf,_0x3e50ef){joinOrLeave(_0x2434bf,_0x4311('0x4b'),_0x3e50ef);}function onConnect(_0x7c6403){joinOrLeave(_0x7c6403,'join');}exports['default']=function(_0x4983a5){_0x4983a5['on'](_0x4311('0x58'),function(_0xb6e3f7){_0xb6e3f7[_0x4311('0x59')](0x0);_0xb6e3f7[_0x4311('0x5a')]=_0xb6e3f7['request']['connection'][_0x4311('0x5b')]+':'+_0xb6e3f7['request'][_0x4311('0x58')][_0x4311('0x5c')];_0xb6e3f7['connectedAt']=new Date();_0xb6e3f7[_0x4311('0x5d')]=function(_0x5c656c){console[_0x4311('0x5d')](_0x4311('0x5e')+_0xb6e3f7[_0x4311('0x5f')]['name']+'['+_0xb6e3f7[_0x4311('0x5a')]+']',_0x5c656c);};_0xb6e3f7['on'](_0x4311('0x60'),function(){onDisconnect(_0xb6e3f7,_0x4983a5);_0xb6e3f7[_0x4311('0x5d')](_0x4311('0x61'));});onConnect(_0xb6e3f7);_0xb6e3f7[_0x4311('0x5d')]('CONNECTED');});}; \ No newline at end of file +var _0xcdd8=['openchannel','campaign:%s:%s','leave','map','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','catch','join','default','connection','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','log','CONNECTED','lodash','util','bluebird','name','Agents','User','role','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','telephone','where','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','MailQueues','WhatsappQueues','Campaign','agent','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','fax','mail'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xcdd8,0x19d));var _0x8cdd=function(_0x57aad9,_0x23f445){_0x57aad9=_0x57aad9-0x0;var _0x5f1486=_0xcdd8[_0x57aad9];return _0x5f1486;};'use strict';var _=require(_0x8cdd('0x0'));var util=require(_0x8cdd('0x1'));var BPromise=require(_0x8cdd('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x8cdd('0x3')],'include':[{'as':_0x8cdd('0x4'),'model':db[_0x8cdd('0x5')],'attributes':['id',_0x8cdd('0x3'),_0x8cdd('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8cdd('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x8cdd('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x8cdd('0x7')],'where':{'type':_0x8cdd('0x8')}};function getAssociatedResources(_0x425959,_0x7a82a0,_0x2ce77f){return db[_0x8cdd('0x9')][_0x8cdd('0xa')]({'where':{'name':_0x425959,'userProfileId':_0x7a82a0},'raw':!![]})[_0x8cdd('0xb')](function(_0x2a2373){if(_0x2a2373){if(_0x2a2373[_0x8cdd('0xc')]){switch(_0x425959){case'VoiceQueues':case _0x8cdd('0xd'):case _0x8cdd('0xe'):case _0x8cdd('0xf'):case'MailQueues':case _0x8cdd('0x10'):case'WhatsappQueues':return db[_0x2ce77f][_0x8cdd('0x11')](queryQueues);case _0x8cdd('0x12'):return db[_0x2ce77f][_0x8cdd('0x11')](queryTelephones);case _0x8cdd('0x13'):return db[_0x2ce77f]['findAll'](queryTrunks);case _0x8cdd('0x14'):return db[_0x2ce77f][_0x8cdd('0x11')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x8cdd('0x15')],'where':{'sectionId':_0x2a2373['id']},'raw':!![]})[_0x8cdd('0xb')](function(_0x232de3){if(_0x232de3){var _0x48f976={'where':{'id':_['map'](_0x232de3,_0x8cdd('0x15'))},'raw':!![]};switch(_0x2ce77f){case'User':_0x48f976['where'][_0x8cdd('0x6')]=_0x8cdd('0x16');break;case'Campaign':_0x48f976[_0x8cdd('0x17')][_0x8cdd('0x7')]=_0x8cdd('0x8');break;}return db[_0x2ce77f]['findAll'](_0x48f976);}else{return[];}});}}else{return[];}})[_0x8cdd('0xb')](function(_0xa99920){return _0xa99920;});}function joinOrLeaveQueues(_0x4bde99,_0xe77929,_0x42b9,_0x51e304){_0x4bde99[_0xe77929](util[_0x8cdd('0x18')](_0x8cdd('0x19'),_0x42b9,_0x51e304[_0x8cdd('0x3')]));if(_0x51e304[_0x8cdd('0x4')]){for(var _0x5bf44e=0x0;_0x5bf44e<_0x51e304[_0x8cdd('0x4')][_0x8cdd('0x1a')];_0x5bf44e+=0x1){_0x4bde99[_0xe77929](util[_0x8cdd('0x18')](_0x8cdd('0x1b'),_0x51e304[_0x8cdd('0x4')][_0x5bf44e]['name']));}}}function joinOrLeave(_0x202d37,_0x57eb77,_0x1843ba){var _0x366c05;if(_0x202d37[_0x8cdd('0x1c')][_0x8cdd('0x1d')]['id']){db[_0x8cdd('0x5')][_0x8cdd('0x1e')]({'attributes':['id',_0x8cdd('0x3'),_0x8cdd('0x6'),_0x8cdd('0x1f')],'where':{'id':_0x202d37[_0x8cdd('0x1c')][_0x8cdd('0x1d')]['id']},'include':[{'model':db[_0x8cdd('0x20')],'as':_0x8cdd('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x22')],'as':_0x8cdd('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x25')],'as':_0x8cdd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x27')],'as':_0x8cdd('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cdd('0x29')],'as':_0x8cdd('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x8cdd('0xb')](function(_0x8d50b4){if(_0x8d50b4){_0x366c05=_0x8d50b4;_0x202d37[_0x57eb77](util['format'](_0x8cdd('0x1b'),_0x8d50b4[_0x8cdd('0x3')]));var _0x25bc45=[];switch(_0x8d50b4[_0x8cdd('0x6')]){case _0x8cdd('0x2b'):_0x202d37[_0x57eb77](_0x8cdd('0x2c'));_0x202d37[_0x57eb77](_0x8cdd('0x2d'));if(queryQueues[_0x8cdd('0x2e')]('include')){delete queryQueues[_0x8cdd('0x2f')];}_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x31')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x32')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x33')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x34')]['findAll'](queryQueues));_0x25bc45['push'](db[_0x8cdd('0x35')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x36')]['findAll'](queryQueues));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x37')][_0x8cdd('0x11')](queryQueues));_0x25bc45[_0x8cdd('0x30')](db['User'][_0x8cdd('0x11')](queryTelephones));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x38')]['findAll'](queryTrunks));_0x25bc45[_0x8cdd('0x30')](db['Campaign'][_0x8cdd('0x11')](queryCampaigns));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x5')][_0x8cdd('0x11')](queryAgents));break;case _0x8cdd('0x39'):_0x202d37[_0x57eb77](_0x8cdd('0x2c'));_0x202d37[_0x57eb77](_0x8cdd('0x2d'));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x3a'),_0x8d50b4['userProfileId'],_0x8cdd('0x31')));_0x25bc45['push'](getAssociatedResources(_0x8cdd('0xd'),_0x8d50b4[_0x8cdd('0x1f')],_0x8cdd('0x32')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources('FaxQueues',_0x8d50b4['userProfileId'],'FaxQueue'));_0x25bc45['push'](getAssociatedResources('SmsQueues',_0x8d50b4['userProfileId'],_0x8cdd('0x34')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x3b'),_0x8d50b4['userProfileId'],_0x8cdd('0x35')));_0x25bc45['push'](getAssociatedResources(_0x8cdd('0x10'),_0x8d50b4['userProfileId'],_0x8cdd('0x36')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x3c'),_0x8d50b4[_0x8cdd('0x1f')],'WhatsappQueue'));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x12'),_0x8d50b4[_0x8cdd('0x1f')],'User'));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x13'),_0x8d50b4[_0x8cdd('0x1f')],_0x8cdd('0x38')));_0x25bc45[_0x8cdd('0x30')](getAssociatedResources(_0x8cdd('0x14'),_0x8d50b4[_0x8cdd('0x1f')],_0x8cdd('0x3d')));_0x25bc45[_0x8cdd('0x30')](db[_0x8cdd('0x5')][_0x8cdd('0x11')](queryAgents));break;case _0x8cdd('0x3e'):_0x202d37[_0x57eb77](_0x8cdd('0x2c'));_0x202d37[_0x57eb77](_0x8cdd('0x2d'));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4['getVoiceQueues']({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x3f')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45['push'](_0x8d50b4[_0x8cdd('0x40')]({'attributes':['id','name']}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x41')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x42')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45[_0x8cdd('0x30')](_0x8d50b4[_0x8cdd('0x43')]({'attributes':['id',_0x8cdd('0x3')]}));_0x25bc45['push'](_0x8d50b4[_0x8cdd('0x44')]({'attributes':['id','name']}));break;}return BPromise[_0x8cdd('0x45')](_0x25bc45);}})[_0x8cdd('0xb')](function(_0x4d21a7){if(_0x4d21a7&&_0x4d21a7[_0x8cdd('0x1a')]){for(var _0x7314c4=0x0;_0x7314c4<_0x4d21a7[_0x8cdd('0x1a')];_0x7314c4+=0x1){for(var _0x2f9069=0x0;_0x2f9069<_0x4d21a7[_0x7314c4][_0x8cdd('0x1a')];_0x2f9069+=0x1){switch(_0x7314c4){case 0x0:joinOrLeaveQueues(_0x202d37,_0x57eb77,'voice',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x1:joinOrLeaveQueues(_0x202d37,_0x57eb77,'chat',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x2:joinOrLeaveQueues(_0x202d37,_0x57eb77,_0x8cdd('0x46'),_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x3:joinOrLeaveQueues(_0x202d37,_0x57eb77,'sms',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x4:joinOrLeaveQueues(_0x202d37,_0x57eb77,_0x8cdd('0x47'),_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x5:joinOrLeaveQueues(_0x202d37,_0x57eb77,_0x8cdd('0x48'),_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x6:joinOrLeaveQueues(_0x202d37,_0x57eb77,'whatsapp',_0x4d21a7[_0x7314c4][_0x2f9069]);break;case 0x7:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')]('telephone:%s',_0x4d21a7[_0x7314c4][_0x2f9069][_0x8cdd('0x3')]));break;case 0x8:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')]('trunk:%s',_0x4d21a7[_0x7314c4][_0x2f9069]['name']));break;case 0x9:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')](_0x8cdd('0x49'),_0x4d21a7[_0x7314c4][_0x2f9069]['type'],_0x4d21a7[_0x7314c4][_0x2f9069]['name']));break;case 0xa:_0x202d37[_0x57eb77](util[_0x8cdd('0x18')](_0x8cdd('0x1b'),_0x4d21a7[_0x7314c4][_0x2f9069][_0x8cdd('0x3')]));break;}}}}})['then'](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x4e45ab=_[_0x8cdd('0x4b')](_0x366c05['ChatInteractions'],'id');return _0x366c05['removeChatInteractions'](_0x4e45ab)[_0x8cdd('0xb')](function(){for(var _0xd037c6=0x0;_0xd037c6<_0x4e45ab['length'];_0xd037c6+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x4d'),{'ChatInteractionId':Number(_0x4e45ab[_0xd037c6]),'UserId':Number(_0x366c05['id'])});}});}})['then'](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x2d5b1a=_[_0x8cdd('0x4b')](_0x366c05[_0x8cdd('0x23')],'id');return _0x366c05[_0x8cdd('0x4e')](_0x2d5b1a)[_0x8cdd('0xb')](function(){for(var _0x11beba=0x0;_0x11beba<_0x2d5b1a[_0x8cdd('0x1a')];_0x11beba+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x4f'),{'MailInteractionId':Number(_0x2d5b1a[_0x11beba]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0xb')](function(){if(_0x57eb77==='leave'){var _0x4da206=_[_0x8cdd('0x4b')](_0x366c05[_0x8cdd('0x50')],'id');return _0x366c05[_0x8cdd('0x51')](_0x4da206)[_0x8cdd('0xb')](function(){for(var _0x520e0b=0x0;_0x520e0b<_0x4da206[_0x8cdd('0x1a')];_0x520e0b+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x52'),{'FaxInteractionId':Number(_0x4da206[_0x520e0b]),'UserId':Number(_0x366c05['id'])});}});}})['then'](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x5a3fa5=_[_0x8cdd('0x4b')](_0x366c05[_0x8cdd('0x26')],'id');return _0x366c05[_0x8cdd('0x53')](_0x5a3fa5)[_0x8cdd('0xb')](function(){for(var _0x21b2ba=0x0;_0x21b2ba<_0x5a3fa5['length'];_0x21b2ba+=0x1){_0x1843ba[_0x8cdd('0x4c')](_0x8cdd('0x54'),{'SmsInteractionId':Number(_0x5a3fa5[_0x21b2ba]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0xb')](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x4af325=_['map'](_0x366c05[_0x8cdd('0x28')],'id');return _0x366c05['removeOpenchannelInteractions'](_0x4af325)['then'](function(){for(var _0x49a700=0x0;_0x49a700<_0x4af325[_0x8cdd('0x1a')];_0x49a700+=0x1){_0x1843ba[_0x8cdd('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4af325[_0x49a700]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0xb')](function(){if(_0x57eb77===_0x8cdd('0x4a')){var _0x55d2eb=_[_0x8cdd('0x4b')](_0x366c05['WhatsappInteractions'],'id');return _0x366c05['removeWhatsappInteractions'](_0x55d2eb)[_0x8cdd('0xb')](function(){for(var _0x133a68=0x0;_0x133a68<_0x55d2eb[_0x8cdd('0x1a')];_0x133a68+=0x1){_0x1843ba[_0x8cdd('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x55d2eb[_0x133a68]),'UserId':Number(_0x366c05['id'])});}});}})[_0x8cdd('0x55')](function(_0x3260dc){_0x202d37['log'](_0x3260dc);});}}function onDisconnect(_0x9db4d,_0x2f0dff){joinOrLeave(_0x9db4d,_0x8cdd('0x4a'),_0x2f0dff);}function onConnect(_0x46ee0d){joinOrLeave(_0x46ee0d,_0x8cdd('0x56'));}exports[_0x8cdd('0x57')]=function(_0x7f919b){_0x7f919b['on'](_0x8cdd('0x58'),function(_0xe73803){_0xe73803['setMaxListeners'](0x0);_0xe73803[_0x8cdd('0x59')]=_0xe73803[_0x8cdd('0x5a')][_0x8cdd('0x58')][_0x8cdd('0x5b')]+':'+_0xe73803[_0x8cdd('0x5a')][_0x8cdd('0x58')][_0x8cdd('0x5c')];_0xe73803['connectedAt']=new Date();_0xe73803['log']=function(_0x2e1855){console['log'](_0x8cdd('0x5d')+_0xe73803['nsp']['name']+'['+_0xe73803[_0x8cdd('0x59')]+']',_0x2e1855);};_0xe73803['on'](_0x8cdd('0x5e'),function(){onDisconnect(_0xe73803,_0x7f919b);_0xe73803[_0x8cdd('0x5f')]('DISCONNECTED');});onConnect(_0xe73803);_0xe73803['log'](_0x8cdd('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f157d41..f42a19b 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 _0xe105=['Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','info','Trigger,\x20%s','error','code','get','event','direction','UserId','User','find','then','SIP/%s','channel','catch','outgoingmessage','opened','changed','closed','interface','format','name','length','hasOwnProperty','model','hook','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','Sms','SmsInteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','afterCreate','WhatsappMessage','Fax','FaxInteraction','FaxMessage'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xe105,0x13e));var _0x5e10=function(_0x5afa1a,_0x35043e){_0x5afa1a=_0x5afa1a-0x0;var _0x5e3ec2=_0xe105[_0x5afa1a];return _0x5e3ec2;};'use strict';var util=require(_0x5e10('0x0'));var db=require(_0x5e10('0x1'))['db'];var jayson=require(_0x5e10('0x2'));var logger=require(_0x5e10('0x3'))(_0x5e10('0x4'));var client=jayson[_0x5e10('0x5')][_0x5e10('0x6')]({'port':0x232a});var triggers=[{'channel':_0x5e10('0x7'),'model':_0x5e10('0x8'),'event':'afterCreate','condition':_0x5e10('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0x5e10('0x8'),'event':_0x5e10('0xa'),'condition':_0x5e10('0xb'),'callback':afterUpdate},{'channel':_0x5e10('0x7'),'model':_0x5e10('0xc'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x5e10('0xd'),'model':_0x5e10('0xe'),'event':'afterCreate','condition':_0x5e10('0x9'),'callback':afterCreate},{'channel':_0x5e10('0xd'),'model':_0x5e10('0xe'),'event':_0x5e10('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5e10('0xd'),'model':_0x5e10('0xf'),'event':'afterCreate','condition':_0x5e10('0x10'),'callback':afterCreateMessage},{'channel':_0x5e10('0x11'),'model':_0x5e10('0x12'),'event':_0x5e10('0x13'),'condition':_0x5e10('0x9'),'callback':afterCreate},{'channel':_0x5e10('0x11'),'model':_0x5e10('0x12'),'event':_0x5e10('0xa'),'condition':_0x5e10('0xb'),'callback':afterUpdate},{'channel':_0x5e10('0x11'),'model':_0x5e10('0x14'),'event':_0x5e10('0x13'),'condition':_0x5e10('0x10'),'callback':afterCreateMessage},{'channel':_0x5e10('0x15'),'model':_0x5e10('0x16'),'event':_0x5e10('0x13'),'condition':_0x5e10('0x9'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x5e10('0xa'),'condition':_0x5e10('0xb'),'callback':afterUpdate},{'channel':_0x5e10('0x15'),'model':_0x5e10('0x17'),'event':'afterCreate','condition':_0x5e10('0x10'),'callback':afterCreateMessage},{'channel':_0x5e10('0x18'),'model':_0x5e10('0x19'),'event':_0x5e10('0x13'),'condition':_0x5e10('0x9'),'callback':afterCreate},{'channel':_0x5e10('0x18'),'model':_0x5e10('0x19'),'event':_0x5e10('0xa'),'condition':_0x5e10('0xb'),'callback':afterUpdate},{'channel':_0x5e10('0x18'),'model':_0x5e10('0x1a'),'event':_0x5e10('0x13'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x5e10('0x1b'),'model':_0x5e10('0x1c'),'event':_0x5e10('0x13'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x5e10('0x1b'),'model':_0x5e10('0x1c'),'event':_0x5e10('0xa'),'condition':_0x5e10('0xb'),'callback':afterUpdate},{'channel':_0x5e10('0x1b'),'model':_0x5e10('0x1d'),'event':'afterCreate','condition':_0x5e10('0x10'),'callback':afterCreateMessage}];function request(_0x3c73f4){return client['request'](_0x5e10('0x1e'),_0x3c73f4)['then'](function(_0x536b7c){logger[_0x5e10('0x1f')](_0x5e10('0x20'),_0x5e10('0x1e'),_0x536b7c);if(_0x536b7c[_0x5e10('0x21')]){if(_0x536b7c[_0x5e10('0x21')][_0x5e10('0x22')]===0x1f4){logger[_0x5e10('0x21')]('Trigger,\x20%s',_0x5e10('0x1e'),_0x536b7c[_0x5e10('0x21')]);}}})['catch'](function(_0x4f57f8){logger[_0x5e10('0x21')](_0x5e10('0x20'),_0x5e10('0x1e'),_0x4f57f8);});}function afterCreateMessage(_0x14609e,_0xc9de43){return function(_0x3e4753,_0x1d1e90){_0x3e4753=_0x3e4753[_0x5e10('0x23')]({'plain':!![]});_0x3e4753['channel']=_0x14609e;_0x3e4753[_0x5e10('0x24')]=_0x3e4753[_0x5e10('0x25')];if(_0x3e4753[_0x5e10('0x26')]){return db[_0x5e10('0x27')][_0x5e10('0x28')]({'where':{'id':_0x3e4753[_0x5e10('0x26')]},'attributes':['id','name'],'raw':!![]})[_0x5e10('0x29')](function(_0x4140ad){_0x3e4753['interface']=util['format'](_0x5e10('0x2a'),_0x4140ad['name']);_0x3e4753[_0x5e10('0x2b')]=_0x14609e;return request({'event':'incomingmessage','message':_0x3e4753});})[_0x5e10('0x2c')](function(_0x1689db){console['error'](_0x1689db);});}else{return request({'event':_0x5e10('0x2d'),'message':_0x3e4753});}};}function afterCreate(_0x558e62,_0x202fbb){return function(_0x3d02c4,_0x20bcbf){_0x3d02c4=_0x3d02c4[_0x5e10('0x23')]({'plain':!![]});_0x3d02c4['channel']=_0x558e62;_0x3d02c4[_0x5e10('0x24')]=_0x5e10('0x2e');return request({'event':_0x202fbb,'message':_0x3d02c4});};}function afterUpdate(_0xb6f7d1,_0x46080c){return function(_0x32ca2b,_0x534087){if(_0x32ca2b[_0x5e10('0x2f')](_0x5e10('0x30'))&&_0x32ca2b[_0x5e10('0x30')]){_0x32ca2b=_0x32ca2b[_0x5e10('0x23')]({'plain':!![]});_0x32ca2b[_0x5e10('0x2b')]=_0xb6f7d1;_0x32ca2b[_0x5e10('0x24')]='closed';if(_0x32ca2b['UserId']){return db['User'][_0x5e10('0x28')]({'where':{'id':_0x32ca2b['UserId']},'attributes':['id','name'],'raw':!![]})[_0x5e10('0x29')](function(_0x18ea27){_0x32ca2b[_0x5e10('0x31')]=util[_0x5e10('0x32')]('SIP/%s',_0x18ea27[_0x5e10('0x33')]);return request({'event':_0x46080c,'message':_0x32ca2b});})[_0x5e10('0x2c')](function(_0x4f0e8c){console[_0x5e10('0x21')](_0x4f0e8c);});}else{return request({'event':_0x46080c,'message':_0x32ca2b});}}};}exports['default']=function(){for(var _0xfad430=0x0;_0xfad430=_0x4cc64e[_0x7153('0x10')]){throw Error(_0x7153('0x11'));}_0x55f474(_0x57b2ac);})[_0x7153('0x12')](function(_0x33e5eb){_0xad2639(_0x33e5eb);});});}; \ No newline at end of file +var _0x6b2e=['includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','fax','sms','whatsapp','openchannel','toLowerCase'];(function(_0x171a2f,_0x1f2ccf){var _0x4f14c7=function(_0x4aa818){while(--_0x4aa818){_0x171a2f['push'](_0x171a2f['shift']());}};_0x4f14c7(++_0x1f2ccf);}(_0x6b2e,0x141));var _0xe6b2=function(_0xd41e48,_0x39d04c){_0xd41e48=_0xd41e48-0x0;var _0x1871a1=_0x6b2e[_0xd41e48];return _0x1871a1;};'use strict';var _=require(_0xe6b2('0x0'));var BPromise=require(_0xe6b2('0x1'));var db=require(_0xe6b2('0x2'))['db'];var util=require(_0xe6b2('0x3'));var channels=['voice','mail','chat',_0xe6b2('0x4'),_0xe6b2('0x5'),_0xe6b2('0x6'),_0xe6b2('0x7')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x19f707){_0x19f707=_0x19f707[_0xe6b2('0x8')]();return _[_0xe6b2('0x9')](channels,_0x19f707);};exports[_0xe6b2('0xa')]=function(_0x2e19ae,_0x39cd7c,_0x208277,_0x14581c){var _0x2cd331={'loginAttempts':_0x39cd7c,'blocked':_0x208277};if(!_[_0xe6b2('0xb')](_0x14581c)){_0x2cd331[_0xe6b2('0xc')]=_0x14581c;}return _0x2e19ae[_0xe6b2('0xd')](_0x2cd331);};exports['getLicense']=function(_0x1c5e96){return new BPromise(function(_0x11232c,_0x551c66){var _0x66fcb2=0x0;if(_0x1c5e96['role']!==_0xe6b2('0xe')){_0x11232c(_0x1c5e96);}db[_0xe6b2('0xf')][_0xe6b2('0x10')]({'where':{'role':_0xe6b2('0xe'),'online':!![],'id':{'$ne':_0x1c5e96['id']}}})[_0xe6b2('0x11')](function(_0x339e2b){_0x66fcb2=_0x339e2b;return util[_0xe6b2('0x12')]();})[_0xe6b2('0x11')](function(_0xbb5220){if(_0xbb5220&&_0xbb5220[_0xe6b2('0x13')]&&_0x66fcb2>=_0xbb5220[_0xe6b2('0x13')]){throw Error(_0xe6b2('0x14'));}_0x11232c(_0x1c5e96);})[_0xe6b2('0x15')](function(_0x50b8fe){_0x551c66(_0x50b8fe);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 4fb8d6f..371bb74 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62e9=['render','json','send','exports','404','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x62e9,0x7b));var _0x962e=function(_0x56386e,_0x3d95e6){_0x56386e=_0x56386e-0x0;var _0x40112b=_0x62e9[_0x56386e];return _0x40112b;};'use strict';module[_0x962e('0x0')][0x194]=function pageNotFound(_0x473002,_0x33b688){var _0x227cbc=_0x962e('0x1');var _0x524fe7=0x194;var _0x3b4636={'status':_0x524fe7};_0x33b688[_0x962e('0x2')](_0x3b4636[_0x962e('0x2')]);_0x33b688[_0x962e('0x3')](_0x227cbc,{},function(_0x57c4ff,_0x20c564){if(_0x57c4ff){return _0x33b688['status'](_0x3b4636[_0x962e('0x2')])[_0x962e('0x4')](_0x3b4636);}_0x33b688[_0x962e('0x5')](_0x20c564);});}; \ No newline at end of file +var _0x9587=['404','status','render','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9587,0x173));var _0x7958=function(_0x305c8f,_0xc5f7fb){_0x305c8f=_0x305c8f-0x0;var _0x5ddc30=_0x9587[_0x305c8f];return _0x5ddc30;};'use strict';module[_0x7958('0x0')][0x194]=function pageNotFound(_0x9c388d,_0x3d7c41){var _0x645fa9=_0x7958('0x1');var _0x152bab=0x194;var _0x176cd1={'status':_0x152bab};_0x3d7c41[_0x7958('0x2')](_0x176cd1['status']);_0x3d7c41[_0x7958('0x3')](_0x645fa9,{},function(_0x2e8f13,_0x59e816){if(_0x2e8f13){return _0x3d7c41[_0x7958('0x2')](_0x176cd1[_0x7958('0x2')])['json'](_0x176cd1);}_0x3d7c41['send'](_0x59e816);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 247c763..ff0deae 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x872c=['ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasMany','Recordings','UserId','VoiceQueuesRt','VoiceExtension','Extensions','cascade','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','UserMailQueue','ChatQueues','FaxQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','Members','CmHopper','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','UserVoiceQueue','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','Contact','ContactId','MailAccountId','hasOne','Imap','Smtp','Dispositions','CannedAnswer','MailMessage','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','TagId','Items','FaxAccountId','Answers','user_has_fax_accounts','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Website','CmCompany','CompanyId','Hoppers','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','AnalyticCustomReport','moh_has_sounds','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','SubjectId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','Field','Variable','Subjects','Description','VariableId','DeskConfiguration','DeskField','ZohoConfiguration','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','VtigerField','ServicenowConfiguration','Dynamics365Account','FreshsalesAccount','FreshsalesConfiguration','ChatInternalMessage','FromId','JscriptyQuestionReport','SessionId','ProjectId','FaxQueues','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','FromAgent','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','sectionId','WhatsappAccountId','whatsapp_interaction_has_tags','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','ToQueue','WhatsappQueueId','exports','path','../config/environment','jstz','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','Disposition','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x872c,0x142));var _0xc872=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x872c[_0x3bf83f];return _0x22c4a9;};'use strict';var path=require(_0xc872('0x0'));var config=require(_0xc872('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xc872('0x2'));var timezone=jstz['determine']();config[_0xc872('0x3')]=_[_0xc872('0x4')](config[_0xc872('0x3')],{'database':'motion2','username':_0xc872('0x5'),'password':_0xc872('0x6'),'options':{'host':_0xc872('0x7'),'port':0xcea,'dialect':_0xc872('0x8'),'dialectOptions':{'charset':_0xc872('0x9')},'logging':![],'timezone':timezone[_0xc872('0xa')](),'define':{'charset':_0xc872('0xb'),'collate':_0xc872('0xc')}}});config[_0xc872('0xd')]=_[_0xc872('0x4')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0xc872('0x6'),'options':{'host':_0xc872('0x7'),'port':0xcea,'dialect':_0xc872('0x8'),'dialectOptions':{'charset':_0xc872('0x9')},'logging':![],'timezone':timezone[_0xc872('0xa')](),'define':{'charset':_0xc872('0xb'),'collate':_0xc872('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc872('0x3')]['database'],config['sequelize'][_0xc872('0xe')],config['sequelize'][_0xc872('0xf')],config['sequelize'][_0xc872('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc872('0xd')][_0xc872('0x11')],config['sequelizeHistory'][_0xc872('0xe')],config['sequelizeHistory']['password'],config[_0xc872('0xd')][_0xc872('0x10')])};db[_0xc872('0x12')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x14'));db[_0xc872('0x15')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x16'));db[_0xc872('0x17')]=db['sequelize'][_0xc872('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x18'));db[_0xc872('0x19')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x1a'));db[_0xc872('0x1b')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x1c'));db[_0xc872('0x1d')]=db[_0xc872('0x3')]['import'](_0xc872('0x1e'));db['ScreenRecording']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x1f'));db[_0xc872('0x20')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xc872('0x3')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xc872('0x21')]=db[_0xc872('0x3')]['import'](_0xc872('0x22'));db[_0xc872('0x23')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x24'));db[_0xc872('0x25')]=db['sequelize'][_0xc872('0x13')]('../api/trunk/trunk.model');db[_0xc872('0x26')]=db[_0xc872('0x3')]['import'](_0xc872('0x27'));db[_0xc872('0x28')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x29'));db['UserVoiceQueue']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xc872('0x2a')]=db[_0xc872('0x3')]['import'](_0xc872('0x2b'));db['UserMailQueue']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0xc872('0x2c')]=db['sequelize']['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xc872('0x2d')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x2e'));db[_0xc872('0x2f')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xc872('0x30')]=db[_0xc872('0x3')]['import'](_0xc872('0x31'));db[_0xc872('0x32')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x33'));db[_0xc872('0x34')]=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0xc872('0x35')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x36'));db[_0xc872('0x37')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x38'));db['MailSubstatus']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x39'));db[_0xc872('0x3a')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x3b'));db[_0xc872('0x3c')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/mailApplication/mailApplication.model');db[_0xc872('0x3d')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0xc872('0x3e')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/dashboard/dashboard.model');db[_0xc872('0x3f')]=db[_0xc872('0x3')]['import'](_0xc872('0x40'));db[_0xc872('0x41')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x42'));db[_0xc872('0x43')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x44'));db[_0xc872('0x45')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xc872('0x46')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x47'));db['FaxQueue']=db['sequelize'][_0xc872('0x13')](_0xc872('0x48'));db[_0xc872('0x49')]=db['sequelize']['import'](_0xc872('0x4a'));db[_0xc872('0x4b')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x4c'));db[_0xc872('0x4d')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/smsApplication/smsApplication.model');db[_0xc872('0x4e')]=db[_0xc872('0x3')]['import'](_0xc872('0x4f'));db[_0xc872('0x50')]=db['sequelize'][_0xc872('0x13')]('../api/smsMessage/smsMessage.model');db[_0xc872('0x51')]=db[_0xc872('0x3')]['import'](_0xc872('0x52'));db['OpenchannelAccount']=db[_0xc872('0x3')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0xc872('0x53')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x54'));db[_0xc872('0x55')]=db[_0xc872('0x3')]['import'](_0xc872('0x56'));db[_0xc872('0x57')]=db[_0xc872('0x3')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xc872('0x58')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x59'));db[_0xc872('0x5a')]=db['sequelize']['import'](_0xc872('0x5b'));db[_0xc872('0x5c')]=db[_0xc872('0x3')]['import'](_0xc872('0x5d'));db[_0xc872('0x5e')]=db['sequelize']['import'](_0xc872('0x5f'));db[_0xc872('0x60')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xc872('0x61')]=db[_0xc872('0x3')]['import'](_0xc872('0x62'));db[_0xc872('0x63')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x64'));db[_0xc872('0x65')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x66'));db[_0xc872('0x67')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x68'));db[_0xc872('0x69')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x6a'));db['CmCompany']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/cmCompany/cmCompany.model');db[_0xc872('0x6b')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xc872('0x3')]['import'](_0xc872('0x6c'));db[_0xc872('0x6d')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x6e'));db[_0xc872('0x6f')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x70'));db['CmHopperHistory']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x71'));db[_0xc872('0x72')]=db[_0xc872('0x3')]['import'](_0xc872('0x73'));db['CmCustomField']=db['sequelize'][_0xc872('0x13')](_0xc872('0x74'));db[_0xc872('0x75')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x76'));db[_0xc872('0x77')]=db[_0xc872('0x3')]['import']('../api/automation/automation.model');db['CannedAnswer']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0xc872('0x78')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/disposition/disposition.model');db[_0xc872('0x79')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x7a'));db['Interval']=db[_0xc872('0x3')]['import']('../api/interval/interval.model');db[_0xc872('0x7b')]=db[_0xc872('0x3')]['import'](_0xc872('0x7c'));db[_0xc872('0x7d')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x7e'));db['VoiceQueuesLog']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x7f'));db[_0xc872('0x80')]=db[_0xc872('0x3')]['import'](_0xc872('0x81'));db[_0xc872('0x82')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x83'));db[_0xc872('0x84')]=db[_0xc872('0x3')]['import'](_0xc872('0x85'));db[_0xc872('0x86')]=db['sequelize']['import']('../api/template/template.model');db[_0xc872('0x87')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x88'));db['Variable']=db[_0xc872('0x3')]['import']('../api/variable/variable.model');db[_0xc872('0x89')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x8a'));db[_0xc872('0x8b')]=db[_0xc872('0x3')]['import'](_0xc872('0x8c'));db['AnalyticCustomReport']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x8d'));db[_0xc872('0x8e')]=db['sequelize']['import'](_0xc872('0x8f'));db[_0xc872('0x90')]=db['sequelize']['import'](_0xc872('0x91'));db[_0xc872('0x92')]=db['sequelize'][_0xc872('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xc872('0x93')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x94'));db[_0xc872('0x95')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x96'));db[_0xc872('0x97')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x98'));db[_0xc872('0x99')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x9a'));db['SalesforceField']=db[_0xc872('0x3')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xc872('0x9b')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x9c'));db[_0xc872('0x9d')]=db[_0xc872('0x3')]['import'](_0xc872('0x9e'));db[_0xc872('0x9f')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xc872('0xa0')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xa1'));db['DeskConfiguration']=db['sequelize'][_0xc872('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa2'));db['ZohoAccount']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa3'));db['ZohoConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa4'));db[_0xc872('0xa5')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa6'));db[_0xc872('0xa7')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa8'));db[_0xc872('0xa9')]=db['sequelize'][_0xc872('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xc872('0xaa')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xab'));db[_0xc872('0xac')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xad'));db['FreshdeskConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xae'));db['FreshdeskField']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xaf'));db[_0xc872('0xb0')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb1'));db[_0xc872('0xb2')]=db[_0xc872('0x3')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize'][_0xc872('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xc872('0xb3')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb4'));db['ServicenowConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb5'));db[_0xc872('0xb6')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb7'));db['Dynamics365Account']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb8'));db[_0xc872('0xb9')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xc872('0xba')]=db['sequelize']['import'](_0xc872('0xbb'));db['FreshsalesAccount']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xbc'));db['FreshsalesConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xc872('0xbd')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xbe'));db[_0xc872('0x89')]=db['sequelize']['import'](_0xc872('0x8a'));db[_0xc872('0xbf')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xc0'));db[_0xc872('0xc1')]=db[_0xc872('0x3')]['import']('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0xc872('0x3')]['import'](_0xc872('0xc2'));db[_0xc872('0xc3')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xc4'));db['JscriptyQuestionReport']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xc5'));db[_0xc872('0xc6')]=db[_0xc872('0x3')]['import'](_0xc872('0xc7'));db[_0xc872('0xc8')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xc9'));db[_0xc872('0xca')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xc872('0x3')]['import'](_0xc872('0xcb'));db[_0xc872('0xcc')]=db['sequelize']['import'](_0xc872('0xcd'));db['Setting']=db['sequelize'][_0xc872('0x13')](_0xc872('0xce'));db[_0xc872('0xcf')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd0'));db[_0xc872('0xd1')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd2'));db[_0xc872('0xd3')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/squareRecording/squareRecording.model');db[_0xc872('0xd4')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd5'));db[_0xc872('0xd6')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd7'));db[_0xc872('0xd8')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd9'));db[_0xc872('0xda')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/campaign/campaign.model');db[_0xc872('0xdb')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xdc'));db[_0xc872('0xdd')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xde'));db['Plugin']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xdf'));db['MailTransferReport']=db[_0xc872('0x3')]['import'](_0xc872('0xe0'));db[_0xc872('0xe1')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xe2'));db[_0xc872('0xe3')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xe4'));db['OpenchannelTransferReport']=db[_0xc872('0x3')]['import'](_0xc872('0xe5'));db[_0xc872('0xe6')]=db[_0xc872('0x3')]['import'](_0xc872('0xe7'));db[_0xc872('0xe8')]=db['sequelize']['import'](_0xc872('0xe9'));db[_0xc872('0xea')]=db[_0xc872('0x3')]['import'](_0xc872('0xeb'));db[_0xc872('0xec')]=db['sequelize']['import'](_0xc872('0xed'));db['UserProfileSection']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xee'));db[_0xc872('0xef')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf0'));db[_0xc872('0xf1')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf2'));db['WhatsappAccount']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf3'));db[_0xc872('0xf4')]=db['sequelize']['import'](_0xc872('0xf5'));db[_0xc872('0xf6')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xf7'));db[_0xc872('0xf8')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf9'));db[_0xc872('0xfa')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xfb'));db[_0xc872('0xfc')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xfd'));db[_0xc872('0xfe')]=db[_0xc872('0x3')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xc872('0xff')]=db[_0xc872('0x3')]['import'](_0xc872('0x100'));db[_0xc872('0x12')]['hasOne'](db[_0xc872('0x20')],{'as':_0xc872('0x20'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0xc872('0x101')](db[_0xc872('0x1d')],{'as':_0xc872('0x102'),'foreignKey':_0xc872('0x103')});db['User']['hasMany'](db[_0xc872('0x28')],{'as':_0xc872('0x104'),'foreignKey':'UserId'});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':_0xc872('0x106'),'onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x12')][_0xc872('0x101')](db['CmHopperFinal'],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0x109')],{'as':'HopperHistory','foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x72')],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x55')],{'as':_0xc872('0x10a'),'foreignKey':'UserId'});db[_0xc872('0x12')]['hasMany'](db[_0xc872('0x60')],{'as':_0xc872('0x10b'),'foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x4e')],{'as':_0xc872('0x10c'),'foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x45')],{'as':_0xc872('0x10d'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0x3a')],{'as':_0xc872('0x10e'),'foreignKey':'UserId'});db[_0xc872('0x12')]['hasMany'](db[_0xc872('0xf6')],{'as':_0xc872('0x10f'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0xf1')],{'as':'Notifications','foreignKey':_0xc872('0x110')});db[_0xc872('0x12')][_0xc872('0x111')](db[_0xc872('0xec')],{'as':_0xc872('0xec'),'foreignKey':_0xc872('0x112')});db[_0xc872('0x12')][_0xc872('0x113')](db['ChatGroup'],{'as':_0xc872('0x114'),'through':_0xc872('0x115')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x6b')],{'as':_0xc872('0x116'),'through':_0xc872('0x117')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0xe8')],{'as':_0xc872('0x118'),'through':_0xc872('0x119')});db['User'][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x11a')});db[_0xc872('0x12')][_0xc872('0x113')](db['MailInteraction'],{'as':_0xc872('0x10e'),'through':'user_has_mail_interactions'});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x60')],{'as':_0xc872('0x10b'),'through':_0xc872('0x11b')});db['User'][_0xc872('0x113')](db['FaxInteraction'],{'as':_0xc872('0x10d'),'through':_0xc872('0x11c')});db['User'][_0xc872('0x113')](db[_0xc872('0x4e')],{'as':_0xc872('0x10c'),'through':'user_has_sms_interactions'});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x55')],{'as':_0xc872('0x10a'),'through':_0xc872('0x11d')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0xf6')],{'as':_0xc872('0x10f'),'through':_0xc872('0x11e')});db[_0xc872('0x12')]['belongsToMany'](db[_0xc872('0x1b')],{'as':_0xc872('0x11f'),'through':'UserVoiceQueue','required':![]});db['User'][_0xc872('0x113')](db[_0xc872('0x37')],{'as':_0xc872('0x120'),'through':_0xc872('0x121'),'required':![]});db[_0xc872('0x12')]['belongsToMany'](db['ChatQueue'],{'as':_0xc872('0x122'),'through':_0xc872('0x2a'),'required':![],'hooks':!![]});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x123')],{'as':'FaxQueues','through':_0xc872('0x2c'),'required':![]});db['User'][_0xc872('0x113')](db[_0xc872('0x51')],{'as':'SmsQueues','through':_0xc872('0x2d'),'required':![]});db['User']['belongsToMany'](db[_0xc872('0x58')],{'as':'OpenchannelQueues','through':_0xc872('0x2f'),'required':![]});db[_0xc872('0x12')][_0xc872('0x113')](db['WhatsappQueue'],{'as':_0xc872('0x124'),'through':_0xc872('0x30'),'required':![]});db['User'][_0xc872('0x113')](db[_0xc872('0xe8')],{'through':_0xc872('0x119')});db['User'][_0xc872('0x113')](db['VoicePrefix'],{'as':_0xc872('0x125'),'through':_0xc872('0x126'),'required':![]});db[_0xc872('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':_0xc872('0x127'),'through':_0xc872('0x128')});db['User'][_0xc872('0x113')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xc872('0x12')][_0xc872('0x113')](db['MailAccount'],{'as':_0xc872('0x129'),'through':_0xc872('0x12a')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x12b')],{'as':'OpenchannelAccounts','through':_0xc872('0x12c')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x4b')],{'as':'SmsAccounts','through':_0xc872('0x12d')});db[_0xc872('0x12')]['belongsToMany'](db[_0xc872('0x12e')],{'as':'WhatsappAccounts','through':_0xc872('0x12f')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0xd1')],{'as':_0xc872('0x130'),'through':_0xc872('0x131')});db[_0xc872('0x15')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':'SpiedAgents','onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x132')});db[_0xc872('0x17')][_0xc872('0x101')](db['VoiceExtension'],{'onDelete':_0xc872('0x107')});db[_0xc872('0x105')][_0xc872('0x101')](db['VoiceExtension'],{'as':_0xc872('0x133'),'onDelete':_0xc872('0x107')});db[_0xc872('0x19')]['belongsToMany'](db[_0xc872('0x82')],{'as':_0xc872('0x134'),'through':'moh_has_sounds'});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x28')],{'as':_0xc872('0x135'),'foreignKey':'VoiceQueueId'});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x136')],{'as':'Hoppers','foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x6f')],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')]['hasMany'](db[_0xc872('0x109')],{'as':_0xc872('0x138'),'foreignKey':'VoiceQueueId'});db[_0xc872('0x1b')][_0xc872('0x101')](db['ReportAgentPreview'],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x6d')],{'as':_0xc872('0x139'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0xc6')],{'as':_0xc872('0x13a'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x111')](db[_0xc872('0x25')],{'as':_0xc872('0x25'),'foreignKey':'TrunkId'});db['VoiceQueue']['belongsTo'](db[_0xc872('0x25')],{'as':_0xc872('0x13b'),'foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0xc872('0x13c'),'foreignKey':_0xc872('0x13d')});db['VoiceQueue']['belongsTo'](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x1b')][_0xc872('0x113')](db[_0xc872('0xe8')],{'as':_0xc872('0x118'),'through':_0xc872('0x140')});db[_0xc872('0x1b')]['belongsToMany'](db['User'],{'as':_0xc872('0x141'),'through':_0xc872('0x142')});db[_0xc872('0x1b')][_0xc872('0x113')](db[_0xc872('0xd6')],{'as':'Teams','through':_0xc872('0x143')});db[_0xc872('0x1b')]['belongsToMany'](db['CmList'],{'as':_0xc872('0x144'),'through':_0xc872('0x145')});db[_0xc872('0x1d')][_0xc872('0x111')](db['User'],{'as':_0xc872('0x12'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x146')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x12'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x20')]['hasMany'](db[_0xc872('0x147')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xc872('0x147')][_0xc872('0x111')](db[_0xc872('0x20')],{'foreignKey':_0xc872('0x149'),'targetKey':_0xc872('0x14a')});db['VoiceCallReport'][_0xc872('0x101')](db[_0xc872('0x21')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xc872('0x14b')][_0xc872('0x101')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0xc872('0x14c'),'constraints':![]});db[_0xc872('0x14b')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':'User','foreignKey':_0xc872('0x103')});db['VoiceCallReport'][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x32')][_0xc872('0x111')](db[_0xc872('0x35')],{'as':'MailAccount','foreignKey':_0xc872('0x14f')});db[_0xc872('0x34')][_0xc872('0x111')](db['MailAccount'],{'as':_0xc872('0x35'),'foreignKey':'MailAccountId'});db[_0xc872('0x35')][_0xc872('0x150')](db['MailServerIn'],{'as':_0xc872('0x151'),'onDelete':_0xc872('0x107')});db[_0xc872('0x35')][_0xc872('0x150')](db[_0xc872('0x34')],{'as':_0xc872('0x152'),'onDelete':_0xc872('0x107')});db[_0xc872('0x35')]['hasMany'](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x14f')});db['MailAccount']['hasMany'](db[_0xc872('0x154')],{'as':'Answers','foreignKey':_0xc872('0x14f')});db[_0xc872('0x35')][_0xc872('0x101')](db[_0xc872('0x155')],{'as':_0xc872('0x148'),'foreignKey':_0xc872('0x14f')});db[_0xc872('0x35')]['hasMany'](db[_0xc872('0x3a')],{'as':_0xc872('0x156')});db[_0xc872('0x35')]['hasMany'](db['MailApplication'],{'as':_0xc872('0x133')});db[_0xc872('0x35')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x35')]['belongsTo'](db[_0xc872('0x86')],{'as':_0xc872('0x86'),'foreignKey':_0xc872('0x159')});db[_0xc872('0x35')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x35')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':_0xc872('0x12a')});db[_0xc872('0x37')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x121')});db[_0xc872('0x37')]['belongsToMany'](db[_0xc872('0xd6')],{'through':_0xc872('0x15a'),'as':_0xc872('0x15b')});db[_0xc872('0x3a')][_0xc872('0x101')](db[_0xc872('0x155')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x15c')});db[_0xc872('0x3a')][_0xc872('0x111')](db['MailAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x14f')});db[_0xc872('0x3a')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db['MailInteraction']['belongsTo'](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x3a')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x15f'),'as':_0xc872('0x160')});db['MailInteraction'][_0xc872('0x113')](db[_0xc872('0x84')],{'through':'mail_interaction_has_tags','as':_0xc872('0x161')});db[_0xc872('0x3a')][_0xc872('0x113')](db['User'],{'as':_0xc872('0x162'),'through':_0xc872('0x163'),'foreignKey':_0xc872('0x15c')});db[_0xc872('0x155')][_0xc872('0x101')](db[_0xc872('0xdd')],{'as':_0xc872('0x164'),'onDelete':_0xc872('0x107')});db[_0xc872('0x155')]['belongsTo'](db[_0xc872('0x12')],{'as':_0xc872('0x12')});db['MailMessage'][_0xc872('0x111')](db[_0xc872('0x6b')],{'onDelete':'cascade','as':_0xc872('0x14d')});db[_0xc872('0x155')][_0xc872('0x111')](db[_0xc872('0x3a')],{'as':_0xc872('0x165'),'foreignKey':'MailInteractionId'});db[_0xc872('0x155')][_0xc872('0x111')](db[_0xc872('0x35')],{'as':'Account','foreignKey':_0xc872('0x14f')});db[_0xc872('0x3c')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x3c')][_0xc872('0x111')](db['MailQueue'],{'onDelete':_0xc872('0x166')});db['MailApplication'][_0xc872('0x111')](db[_0xc872('0x35')],{'onDelete':'restrict'});db[_0xc872('0x3c')]['belongsTo'](db[_0xc872('0x13c')],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x3c')][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x167')});db['MailQueueReport']['belongsTo'](db[_0xc872('0x35')],{});db[_0xc872('0x3d')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x3d')]['belongsTo'](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x3d')][_0xc872('0x111')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0xc872('0x155')],{});db['MailQueueReport']['belongsTo'](db[_0xc872('0x12')],{});db[_0xc872('0x3d')][_0xc872('0x111')](db[_0xc872('0x37')],{});db[_0xc872('0x3e')][_0xc872('0x101')](db[_0xc872('0x3f')],{'as':_0xc872('0x168'),'onDelete':'cascade'});db[_0xc872('0x41')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':'Dispositions','foreignKey':_0xc872('0x169')});db['FaxAccount']['hasMany'](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db[_0xc872('0x45')],{'as':'Interactions'});db[_0xc872('0x41')]['hasMany'](db[_0xc872('0x43')],{'as':'Applications'});db[_0xc872('0x41')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':'Exntensions','onDelete':_0xc872('0x107')});db[_0xc872('0x41')][_0xc872('0x101')](db[_0xc872('0x46')],{'as':_0xc872('0x148')});db[_0xc872('0x41')][_0xc872('0x111')](db[_0xc872('0x25')],{'as':_0xc872('0x25')});db[_0xc872('0x41')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x41')][_0xc872('0x111')](db['Pause'],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x41')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x16b')});db[_0xc872('0x43')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0xc872('0x123')],{'onDelete':_0xc872('0x166')});db['FaxApplication'][_0xc872('0x111')](db['FaxAccount'],{'onDelete':_0xc872('0x166')});db[_0xc872('0x43')][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':_0xc872('0x166'),'foreignKey':'TagId'});db[_0xc872('0x45')]['hasMany'](db[_0xc872('0x46')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':'FaxInteractionId'});db[_0xc872('0x45')][_0xc872('0x111')](db[_0xc872('0x41')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x169')});db[_0xc872('0x45')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x45')][_0xc872('0x111')](db['User'],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db['FaxInteraction']['belongsToMany'](db[_0xc872('0x84')],{'through':_0xc872('0x16c'),'as':_0xc872('0x160')});db[_0xc872('0x45')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xc872('0x161')});db[_0xc872('0x45')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':_0xc872('0x11c'),'foreignKey':_0xc872('0x16d')});db['FaxMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x107'),'as':'User'});db['FaxMessage'][_0xc872('0x111')](db[_0xc872('0x45')],{'as':_0xc872('0x165'),'foreignKey':_0xc872('0x16d')});db[_0xc872('0x46')][_0xc872('0x111')](db[_0xc872('0x6b')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db[_0xc872('0x46')][_0xc872('0x111')](db[_0xc872('0xdd')],{'as':_0xc872('0xdd'),'foreignKey':_0xc872('0x16e')});db[_0xc872('0x46')][_0xc872('0x111')](db[_0xc872('0x41')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x169')});db[_0xc872('0x123')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x2c')});db[_0xc872('0x123')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x16f'),'as':'Teams'});db[_0xc872('0x49')]['belongsTo'](db[_0xc872('0x41')],{});db['FaxQueueReport']['belongsTo'](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x49')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x49')][_0xc872('0x111')](db[_0xc872('0x45')],{});db[_0xc872('0x49')][_0xc872('0x111')](db[_0xc872('0x46')],{});db['FaxQueueReport'][_0xc872('0x111')](db[_0xc872('0x12')],{});db[_0xc872('0x49')]['belongsTo'](db['FaxQueue'],{});db[_0xc872('0x4b')]['hasMany'](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x170')});db[_0xc872('0x4b')][_0xc872('0x101')](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x170')});db[_0xc872('0x4b')]['hasMany'](db[_0xc872('0x50')],{'as':_0xc872('0x148'),'foreignKey':'SmsAccountId'});db[_0xc872('0x4b')][_0xc872('0x101')](db[_0xc872('0x4e')],{'as':_0xc872('0x156')});db['SmsAccount'][_0xc872('0x101')](db[_0xc872('0x4d')],{'as':'Applications'});db[_0xc872('0x4b')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x4b')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db['SmsAccount'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x12d')});db[_0xc872('0x4d')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x4d')][_0xc872('0x111')](db[_0xc872('0x51')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x4d')][_0xc872('0x111')](db[_0xc872('0x4b')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x4d')]['belongsTo'](db[_0xc872('0x13c')],{'onDelete':_0xc872('0x166'),'foreignKey':'IntervalId'});db[_0xc872('0x4d')][_0xc872('0x111')](db['Tag'],{'onDelete':_0xc872('0x166'),'foreignKey':'TagId'});db[_0xc872('0x4e')][_0xc872('0x101')](db[_0xc872('0x50')],{'as':_0xc872('0x148'),'onDelete':'cascade','foreignKey':_0xc872('0x171')});db[_0xc872('0x4e')]['belongsTo'](db[_0xc872('0x4b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x170')});db[_0xc872('0x4e')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':'ContactId'});db[_0xc872('0x4e')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':'Owner','foreignKey':_0xc872('0x103')});db['SmsInteraction'][_0xc872('0x113')](db['Tag'],{'through':_0xc872('0x172'),'as':_0xc872('0x160')});db['SmsInteraction'][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x172'),'as':_0xc872('0x161')});db[_0xc872('0x4e')][_0xc872('0x113')](db['User'],{'as':'Users','through':_0xc872('0x173'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x12')});db[_0xc872('0x50')][_0xc872('0x111')](db['CmContact'],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db['SmsMessage'][_0xc872('0x111')](db[_0xc872('0x4e')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x165'),'foreignKey':_0xc872('0x171')});db[_0xc872('0x50')][_0xc872('0x111')](db[_0xc872('0x4b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x170')});db['SmsQueue'][_0xc872('0x113')](db['User'],{'as':'Agents','through':_0xc872('0x2d'),'foreignKey':_0xc872('0x174')});db[_0xc872('0x51')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x175'),'as':'Teams'});db[_0xc872('0x12b')][_0xc872('0x101')](db['Disposition'],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')][_0xc872('0x101')](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')]['hasMany'](db[_0xc872('0x55')],{'as':'Interactions','foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')]['hasMany'](db[_0xc872('0x57')],{'as':_0xc872('0x148'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')][_0xc872('0x101')](db[_0xc872('0x53')],{'as':'Applications','foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x12b')]['belongsToMany'](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x12c')});db[_0xc872('0x53')]['belongsTo'](db['User'],{'onDelete':_0xc872('0x166')});db[_0xc872('0x53')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x177')});db[_0xc872('0x53')][_0xc872('0x111')](db[_0xc872('0x12b')],{'onDelete':'restrict','foreignKey':_0xc872('0x176')});db[_0xc872('0x53')][_0xc872('0x111')](db[_0xc872('0x13c')],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x53')]['belongsTo'](db['Tag'],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x167')});db[_0xc872('0x55')]['hasMany'](db['OpenchannelMessage'],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x178')});db['OpenchannelInteraction'][_0xc872('0x111')](db['OpenchannelAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x55')]['belongsTo'](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x55')][_0xc872('0x111')](db['User'],{'as':'Owner','foreignKey':_0xc872('0x103')});db[_0xc872('0x55')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x179'),'as':_0xc872('0x160')});db[_0xc872('0x55')][_0xc872('0x113')](db['Tag'],{'through':_0xc872('0x179'),'as':_0xc872('0x161')});db[_0xc872('0x55')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':_0xc872('0x11d'),'foreignKey':_0xc872('0x178')});db[_0xc872('0x57')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':'cascade','as':'User'});db[_0xc872('0x57')]['belongsTo'](db[_0xc872('0x6b')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db[_0xc872('0x57')][_0xc872('0x111')](db[_0xc872('0x55')],{'onDelete':_0xc872('0x107'),'as':'Interaction','foreignKey':_0xc872('0x178')});db[_0xc872('0x57')][_0xc872('0x111')](db['Attachment'],{'as':_0xc872('0xdd'),'foreignKey':_0xc872('0x16e')});db['OpenchannelMessage'][_0xc872('0x111')](db[_0xc872('0x12b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x58')]['belongsToMany'](db['User'],{'as':_0xc872('0x141'),'through':'UserOpenchannelQueue','foreignKey':_0xc872('0x177')});db[_0xc872('0x58')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x17a'),'as':_0xc872('0x15b')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':'Dispositions','foreignKey':_0xc872('0x17b')});db[_0xc872('0x5a')]['hasMany'](db['CannedAnswer'],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x17b')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x69')],{'as':_0xc872('0x17c')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x60')],{'as':_0xc872('0x156')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x5e')],{'as':_0xc872('0x133')});db[_0xc872('0x5a')][_0xc872('0x101')](db['ChatMessage'],{'as':_0xc872('0x148')});db['ChatWebsite'][_0xc872('0x111')](db['CmList'],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db['ChatWebsite'][_0xc872('0x111')](db['Interval'],{'as':'Interval','foreignKey':_0xc872('0x13d')});db[_0xc872('0x5a')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0xc872('0x13f')});db[_0xc872('0x5a')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport']['belongsTo'](db[_0xc872('0x12b')],{});db['OpenchannelQueueReport'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x5c')]['belongsTo'](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x5c')][_0xc872('0x111')](db[_0xc872('0x55')],{});db[_0xc872('0x5c')][_0xc872('0x111')](db[_0xc872('0x57')],{});db[_0xc872('0x5c')]['belongsTo'](db[_0xc872('0x12')],{});db[_0xc872('0x5c')][_0xc872('0x111')](db[_0xc872('0x58')],{});db[_0xc872('0x5e')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x17d'),'foreignKey':_0xc872('0x103'),'onDelete':_0xc872('0x166')});db[_0xc872('0x5e')][_0xc872('0x111')](db['ChatQueue'],{'as':_0xc872('0x17e'),'foreignKey':_0xc872('0x17f'),'onDelete':_0xc872('0x166')});db['ChatApplication'][_0xc872('0x111')](db[_0xc872('0x5a')],{'as':'Website','foreignKey':_0xc872('0x17b'),'onDelete':'restrict'});db[_0xc872('0x5e')][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc872('0x60')][_0xc872('0x101')](db[_0xc872('0x61')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x180')});db[_0xc872('0x60')][_0xc872('0x111')](db[_0xc872('0x5a')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x17b')});db[_0xc872('0x60')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x60')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x60')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x181'),'as':'Tags'});db[_0xc872('0x60')]['belongsToMany'](db[_0xc872('0x84')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db['ChatInteraction'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Users','through':_0xc872('0x11b'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x12')});db['ChatMessage'][_0xc872('0x111')](db['CmContact'],{'onDelete':_0xc872('0x107'),'as':'Contact','foreignKey':_0xc872('0x14e')});db['ChatMessage'][_0xc872('0x111')](db[_0xc872('0x60')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x165'),'foreignKey':_0xc872('0x180')});db[_0xc872('0x61')][_0xc872('0x111')](db[_0xc872('0xdd')],{'as':_0xc872('0xdd'),'foreignKey':_0xc872('0x16e')});db[_0xc872('0x61')][_0xc872('0x111')](db[_0xc872('0x5a')],{'as':'Account','foreignKey':_0xc872('0x17b')});db[_0xc872('0x63')][_0xc872('0x111')](db['CmContact'],{'onDelete':'cascade','as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x63')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0xc872('0x17b')});db[_0xc872('0x65')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':'UserChatQueue','hooks':!![]});db[_0xc872('0x65')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':'team_has_chat_queues','as':_0xc872('0x15b')});db[_0xc872('0x67')][_0xc872('0x101')](db['ChatInternalMessage'],{'as':_0xc872('0x148'),'foreignKey':_0xc872('0x182'),'onDelete':'cascade'});db[_0xc872('0x67')][_0xc872('0x113')](db['User'],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0xc872('0x5a')],{'as':_0xc872('0x183'),'foreignKey':'ChatWebsiteId'});db[_0xc872('0x184')][_0xc872('0x101')](db[_0xc872('0x6b')],{'as':_0xc872('0x116'),'foreignKey':_0xc872('0x185')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x136')],{'as':_0xc872('0x186'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x6f')],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x109')],{'as':_0xc872('0x138'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x72')],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0xc872('0x6b')][_0xc872('0x101')](db['OpenchannelInteraction'],{'as':_0xc872('0x10a'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db['CmContact']['hasMany'](db[_0xc872('0x60')],{'as':_0xc872('0x10b'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x4e')],{'as':'SmsInteractions','foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db['CmContact'][_0xc872('0x101')](db[_0xc872('0x45')],{'as':_0xc872('0x10d'),'foreignKey':'ContactId','onDelete':_0xc872('0x166')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x3a')],{'as':_0xc872('0x10e'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db[_0xc872('0x6b')][_0xc872('0x111')](db[_0xc872('0x184')],{'as':_0xc872('0x187'),'foreignKey':_0xc872('0x185')});db['CmContact'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158'),'onDelete':_0xc872('0x107')});db['CmContact'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':'cm_user_has_contacts'});db[_0xc872('0x6b')]['belongsToMany'](db[_0xc872('0x84')],{'as':_0xc872('0x160'),'through':_0xc872('0x188')});db['CmContact']['belongsToMany'](db[_0xc872('0x84')],{'through':_0xc872('0x188'),'as':_0xc872('0x161')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':'Contact','foreignKey':_0xc872('0x14e'),'onDelete':'cascade'});db['CmHopper'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':'ListId','onDelete':_0xc872('0x107')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x17d'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x1b')],{'as':_0xc872('0x17e'),'foreignKey':_0xc872('0x137'),'onDelete':_0xc872('0x107')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0xda')],{'as':_0xc872('0xda'),'foreignKey':_0xc872('0x189'),'onDelete':_0xc872('0x107')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x18a')});db[_0xc872('0x6d')]['belongsTo'](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x107')});db[_0xc872('0x6d')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158'),'onDelete':_0xc872('0x107')});db[_0xc872('0x6d')]['belongsTo'](db[_0xc872('0x1b')],{'as':_0xc872('0x17e'),'foreignKey':_0xc872('0x137'),'onDelete':_0xc872('0x107')});db[_0xc872('0x6d')]['belongsTo'](db[_0xc872('0xda')],{'as':_0xc872('0xda'),'foreignKey':_0xc872('0x189'),'onDelete':_0xc872('0x107')});db['Automation']['hasMany'](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x18b'),'singular':_0xc872('0x18c')},'foreignKey':'AutomationAllId','onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x77')][_0xc872('0x101')](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x18d'),'singular':_0xc872('0x18e')},'foreignKey':_0xc872('0x18f'),'onDelete':'cascade','hooks':!![]});db[_0xc872('0x77')][_0xc872('0x101')](db[_0xc872('0x75')],{'as':'Actions','foreignKey':_0xc872('0x190'),'onDelete':'cascade','hooks':!![]});db[_0xc872('0x78')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0xc872('0x107')});db['Interval']['hasMany'](db[_0xc872('0x13c')],{'as':_0xc872('0x191'),'foreignKey':'IntervalId','onDelete':_0xc872('0x107'),'hooks':!![],'required':![]});db[_0xc872('0x13c')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xc872('0x166')});db['Interval'][_0xc872('0x101')](db[_0xc872('0x3c')],{'as':_0xc872('0x192'),'foreignKey':'IntervalId'});db[_0xc872('0x13c')][_0xc872('0x101')](db[_0xc872('0x5e')],{'as':_0xc872('0x193'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x13c')][_0xc872('0x101')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xc872('0x13d')});db['Interval'][_0xc872('0x101')](db[_0xc872('0x4d')],{'as':_0xc872('0x194'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x80')][_0xc872('0x111')](db[_0xc872('0x35')],{});db[_0xc872('0x80')][_0xc872('0x111')](db[_0xc872('0x8e')],{'foreignKey':'DefaultReportId'});db[_0xc872('0x80')]['belongsTo'](db[_0xc872('0x195')],{'foreignKey':'CustomReportId'});db[_0xc872('0x82')][_0xc872('0x113')](db[_0xc872('0x19')],{'as':'Mohs','through':_0xc872('0x196'),'onDelete':'restrict'});db[_0xc872('0x84')][_0xc872('0x113')](db[_0xc872('0x6b')],{'through':_0xc872('0x188')});db['Tag'][_0xc872('0x113')](db[_0xc872('0x60')],{'through':_0xc872('0x181')});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xc872('0x84')][_0xc872('0x113')](db['SmsInteraction'],{'through':_0xc872('0x172')});db[_0xc872('0x84')]['belongsToMany'](db[_0xc872('0x45')],{'through':_0xc872('0x16c')});db[_0xc872('0x84')][_0xc872('0x113')](db[_0xc872('0x55')],{'through':_0xc872('0x179')});db[_0xc872('0x84')]['belongsToMany'](db[_0xc872('0xf6')],{'through':'whatsapp_interaction_has_tags'});db[_0xc872('0x87')]['hasMany'](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x197'),'singular':_0xc872('0x198')},'foreignKey':_0xc872('0x199'),'onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x87')][_0xc872('0x101')](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x19a'),'singular':_0xc872('0x19b')},'foreignKey':_0xc872('0x19c'),'onDelete':_0xc872('0x107'),'hooks':!![]});db['Trigger'][_0xc872('0x101')](db[_0xc872('0x75')],{'as':_0xc872('0x19d'),'foreignKey':_0xc872('0x19e'),'onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x195')][_0xc872('0x101')](db[_0xc872('0x93')],{'as':_0xc872('0x19f'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xc872('0x8e')][_0xc872('0x101')](db[_0xc872('0x93')],{'as':_0xc872('0x19f'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a0')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0xc872('0x19f'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a1')});db[_0xc872('0x93')][_0xc872('0x111')](db[_0xc872('0x92')],{'foreignKey':_0xc872('0x1a1')});db[_0xc872('0x97')][_0xc872('0x101')](db[_0xc872('0x99')],{'as':_0xc872('0x1a2'),'onDelete':'cascade','foreignKey':_0xc872('0x1a3')});db[_0xc872('0x99')][_0xc872('0x101')](db['SalesforceField'],{'as':'Subjects','onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x99')]['hasMany'](db[_0xc872('0x1a5')],{'as':_0xc872('0x1a6'),'onDelete':'cascade','foreignKey':_0xc872('0x1a7')});db['SalesforceConfiguration']['hasMany'](db[_0xc872('0x1a5')],{'as':'Fields','onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x99')][_0xc872('0x111')](db[_0xc872('0x97')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0x1a5')][_0xc872('0x101')](db[_0xc872('0x1a5')],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1a5')][_0xc872('0x101')](db[_0xc872('0x1a5')],{'as':'Description','foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1a5')][_0xc872('0x101')](db[_0xc872('0x1a5')],{'as':_0xc872('0x1aa'),'foreignKey':'FieldId'});db[_0xc872('0x1a5')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':'Variable','foreignKey':'VariableId'});db[_0xc872('0x9b')][_0xc872('0x101')](db['SugarcrmConfiguration'],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db['SugarcrmConfiguration'][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':_0xc872('0x1ac'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x9d')][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x9d')][_0xc872('0x101')](db['SugarcrmField'],{'as':_0xc872('0x19f'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x9d')][_0xc872('0x111')](db[_0xc872('0x9b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0x9f')][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':'Subject','foreignKey':_0xc872('0x1a4')});db['SugarcrmField'][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x9f')]['hasMany'](db['SugarcrmField'],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db['SugarcrmField'][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db[_0xc872('0xa0')][_0xc872('0x101')](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xc872('0x1af')][_0xc872('0x101')](db[_0xc872('0x1b0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1af')][_0xc872('0x101')](db[_0xc872('0x1b0')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1af')]['hasMany'](db[_0xc872('0x1b0')],{'as':_0xc872('0x19f'),'onDelete':'cascade','foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1af')][_0xc872('0x111')](db[_0xc872('0xa0')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0x1af')][_0xc872('0x113')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0xc872('0x101')](db['DeskField'],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b0')][_0xc872('0x101')](db['DeskField'],{'as':_0xc872('0x1ad'),'foreignKey':'DescriptionId'});db[_0xc872('0x1b0')][_0xc872('0x101')](db['DeskField'],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b0')][_0xc872('0x111')](db['Variable'],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db['ZohoAccount'][_0xc872('0x101')](db[_0xc872('0x1b1')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':'AccountId'});db[_0xc872('0x1b1')]['hasMany'](db[_0xc872('0xa5')],{'as':_0xc872('0x1ac'),'onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b1')][_0xc872('0x101')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xc872('0x107'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xc872('0x101')](db[_0xc872('0xa5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b1')][_0xc872('0x111')](db[_0xc872('0x1b2')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db['ZohoField']['hasMany'](db[_0xc872('0xa5')],{'as':_0xc872('0x1a9'),'foreignKey':'SubjectId'});db[_0xc872('0xa5')]['hasMany'](db[_0xc872('0xa5')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0xa5')][_0xc872('0x101')](db[_0xc872('0xa5')],{'as':'Field','foreignKey':'FieldId'});db[_0xc872('0xa5')]['belongsTo'](db[_0xc872('0x1ab')],{'as':'Variable','foreignKey':_0xc872('0x1ae')});db[_0xc872('0xa7')][_0xc872('0x101')](db[_0xc872('0xa9')],{'as':_0xc872('0x1a2'),'onDelete':'cascade','foreignKey':_0xc872('0x1a3')});db[_0xc872('0xa9')][_0xc872('0x101')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xc872('0x1a4')});db[_0xc872('0xa9')][_0xc872('0x101')](db[_0xc872('0xaa')],{'as':_0xc872('0x1a6'),'foreignKey':'DescriptionId'});db[_0xc872('0xa9')][_0xc872('0x101')](db[_0xc872('0xaa')],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0xa9')][_0xc872('0x111')](db[_0xc872('0xa7')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xa9')]['belongsToMany'](db[_0xc872('0x84')],{'through':_0xc872('0x1b3')});db[_0xc872('0xaa')]['hasMany'](db[_0xc872('0xaa')],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0xaa')][_0xc872('0x101')](db[_0xc872('0xaa')],{'as':'Description','foreignKey':_0xc872('0x1a7')});db[_0xc872('0xaa')]['hasMany'](db['ZendeskField'],{'as':_0xc872('0x1aa'),'foreignKey':'FieldId'});db[_0xc872('0xaa')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db[_0xc872('0xac')][_0xc872('0x101')](db[_0xc872('0x1b4')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0x1b4')][_0xc872('0x101')](db[_0xc872('0x1b5')],{'as':_0xc872('0x1ac'),'onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b4')]['hasMany'](db[_0xc872('0x1b5')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db['FreshdeskConfiguration'][_0xc872('0x101')](db[_0xc872('0x1b5')],{'as':_0xc872('0x19f'),'onDelete':'cascade','foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b4')][_0xc872('0x111')](db['FreshdeskAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xc872('0x84')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xc872('0x1b5')][_0xc872('0x101')](db['FreshdeskField'],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db['FreshdeskField'][_0xc872('0x101')](db[_0xc872('0x1b5')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1b5')]['hasMany'](db[_0xc872('0x1b5')],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b5')][_0xc872('0x111')](db['Variable'],{'as':_0xc872('0x1ab'),'foreignKey':'VariableId'});db[_0xc872('0xb0')][_0xc872('0x101')](db[_0xc872('0xb2')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xb2')]['hasMany'](db[_0xc872('0x1b6')],{'as':_0xc872('0x1ac'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0xb2')][_0xc872('0x101')](db[_0xc872('0x1b6')],{'as':_0xc872('0x1a6'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xc872('0x101')](db[_0xc872('0x1b6')],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0xb2')][_0xc872('0x111')](db[_0xc872('0xb0')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0x1b6')]['hasMany'](db['VtigerField'],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b6')][_0xc872('0x101')](db[_0xc872('0x1b6')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1b6')]['hasMany'](db[_0xc872('0x1b6')],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db['VtigerField'][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':'Variable','foreignKey':_0xc872('0x1ae')});db['ServicenowAccount']['hasMany'](db[_0xc872('0x1b7')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':'AccountId'});db[_0xc872('0x1b7')][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x1ac'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b7')][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x1a6'),'foreignKey':'DescriptionId'});db[_0xc872('0x1b7')][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0x1b7')][_0xc872('0x111')](db[_0xc872('0xb3')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xb6')]['hasMany'](db[_0xc872('0xb6')],{'as':'Subject','foreignKey':_0xc872('0x1a4')});db['ServicenowField'][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x1ad'),'foreignKey':'DescriptionId'});db[_0xc872('0xb6')]['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc872('0xb6')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db['Dynamics365Account'][_0xc872('0x101')](db[_0xc872('0xb9')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xb9')][_0xc872('0x101')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0xb9')]['hasMany'](db[_0xc872('0xba')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0xb9')]['hasMany'](db['Dynamics365Field'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xc872('0x111')](db[_0xc872('0x1b8')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0xc872('0x101')](db[_0xc872('0xba')],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0xba')][_0xc872('0x101')](db[_0xc872('0xba')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0xba')][_0xc872('0x101')](db[_0xc872('0xba')],{'as':'Field','foreignKey':_0xc872('0x1a8')});db[_0xc872('0xba')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db[_0xc872('0x1b9')][_0xc872('0x101')](db[_0xc872('0x1ba')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db['FreshsalesConfiguration'][_0xc872('0x101')](db[_0xc872('0xbd')],{'as':_0xc872('0x1ac'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1ba')][_0xc872('0x101')](db[_0xc872('0xbd')],{'as':'Descriptions','foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1ba')][_0xc872('0x101')](db['FreshsalesField'],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0x1ba')]['belongsTo'](db[_0xc872('0x1b9')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0xbd')]['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xc872('0x1a4')});db['FreshsalesField']['hasMany'](db[_0xc872('0xbd')],{'as':_0xc872('0x1ad'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0xc872('0xbd')],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db['FreshsalesField'][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db['ChatQueueReport'][_0xc872('0x111')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db['ChatQueueReport'][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x60')],{});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x61')],{});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x12')],{});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x65')],{});db[_0xc872('0x1bb')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':'cascade','foreignKey':_0xc872('0x1bc')});db[_0xc872('0x1bb')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x107'),'foreignKey':'ToId'});db[_0xc872('0xc6')][_0xc872('0x101')](db[_0xc872('0x1bd')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xc872('0xc6')][_0xc872('0x101')](db[_0xc872('0xc3')],{'foreignKey':_0xc872('0x1be'),'onDelete':_0xc872('0x107')});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0x4b')],{});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0xc8')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':'ContactId'});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0x4e')],{});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0x50')],{});db[_0xc872('0xc8')]['belongsTo'](db['User'],{});db[_0xc872('0xc8')]['belongsTo'](db['SmsQueue'],{});db[_0xc872('0xcc')]['hasMany'](db[_0xc872('0xc6')],{'foreignKey':_0xc872('0x1bf')});db[_0xc872('0xcc')][_0xc872('0x101')](db[_0xc872('0x1bd')],{'foreignKey':_0xc872('0x1bf')});db[_0xc872('0xcc')]['hasMany'](db[_0xc872('0xc3')],{'foreignKey':_0xc872('0x1bf')});db[_0xc872('0xd1')]['belongsToMany'](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':'user_has_square_projects'});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':_0xc872('0x11a')});db[_0xc872('0xd6')]['belongsToMany'](db[_0xc872('0x1b')],{'through':_0xc872('0x143'),'as':_0xc872('0x11f')});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0x37')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team'][_0xc872('0x113')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xc872('0x122')});db['Team']['belongsToMany'](db[_0xc872('0x123')],{'through':'team_has_fax_queues','as':_0xc872('0x1c0')});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0x51')],{'through':_0xc872('0x175'),'as':_0xc872('0x1c1')});db[_0xc872('0xd6')]['belongsToMany'](db[_0xc872('0x58')],{'through':_0xc872('0x17a'),'as':_0xc872('0x1c2')});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0xfe')],{'through':_0xc872('0x1c3'),'as':_0xc872('0x124')});db['Campaign']['hasMany'](db[_0xc872('0x136')],{'as':_0xc872('0x186'),'foreignKey':_0xc872('0x189')});db[_0xc872('0xda')][_0xc872('0x101')](db['CmHopperFinal'],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x189')});db[_0xc872('0xda')][_0xc872('0x101')](db[_0xc872('0x109')],{'as':_0xc872('0x138'),'foreignKey':_0xc872('0x189')});db['Campaign'][_0xc872('0x101')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xc872('0x189')});db['Campaign'][_0xc872('0x111')](db[_0xc872('0x25')],{'as':'Trunk','foreignKey':_0xc872('0x1c4')});db[_0xc872('0xda')][_0xc872('0x111')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xc872('0x1c5')});db[_0xc872('0xda')][_0xc872('0x111')](db[_0xc872('0x13c')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xc872('0xda')][_0xc872('0x111')](db[_0xc872('0xd1')],{'as':_0xc872('0xd1'),'foreignKey':_0xc872('0x1c6')});db[_0xc872('0xda')]['belongsToMany'](db[_0xc872('0xe8')],{'as':_0xc872('0x118'),'through':_0xc872('0x1c7')});db[_0xc872('0xda')][_0xc872('0x113')](db['CmList'],{'as':_0xc872('0x144'),'through':_0xc872('0x1c8')});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x155')],{});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x3a')],{});db[_0xc872('0x1c9')]['belongsTo'](db[_0xc872('0x35')],{'foreignKey':_0xc872('0x1ca'),'as':_0xc872('0x1cb')});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cc'),'as':'FromAgent'});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0x1c9')]['belongsTo'](db[_0xc872('0x37')],{'foreignKey':_0xc872('0x1cf'),'as':'ToQueue'});db['MailTransferReport'][_0xc872('0x111')](db['MailAccount'],{'foreignKey':_0xc872('0x1d0'),'as':'ToAccount'});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatMessage'],{});db[_0xc872('0xe1')]['belongsTo'](db[_0xc872('0x60')],{});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xc872('0xe1')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cc'),'as':'FromAgent'});db[_0xc872('0xe1')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatQueue'],{'foreignKey':_0xc872('0x1d1'),'as':'ToQueue'});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatWebsite'],{'foreignKey':_0xc872('0x1d2'),'as':_0xc872('0x1d3')});db[_0xc872('0xe3')][_0xc872('0x111')](db[_0xc872('0x46')],{});db[_0xc872('0xe3')][_0xc872('0x111')](db[_0xc872('0x45')],{});db[_0xc872('0xe3')]['belongsTo'](db[_0xc872('0x41')],{'foreignKey':_0xc872('0x1d4'),'as':_0xc872('0x1cb')});db[_0xc872('0xe3')][_0xc872('0x111')](db['User'],{'foreignKey':_0xc872('0x1cc'),'as':_0xc872('0x1d5')});db[_0xc872('0xe3')][_0xc872('0x111')](db['User'],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db['FaxTransferReport'][_0xc872('0x111')](db[_0xc872('0x123')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xc872('0xe3')][_0xc872('0x111')](db['FaxAccount'],{'foreignKey':_0xc872('0x1d6'),'as':'ToAccount'});db[_0xc872('0x1d7')][_0xc872('0x111')](db['OpenchannelMessage'],{});db[_0xc872('0x1d7')][_0xc872('0x111')](db['OpenchannelInteraction'],{});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x12b')],{'foreignKey':_0xc872('0x1d8'),'as':_0xc872('0x1cb')});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x12')],{'foreignKey':'FromUserId','as':_0xc872('0x1d5')});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x58')],{'foreignKey':_0xc872('0x1d9'),'as':'ToQueue'});db[_0xc872('0x1d7')][_0xc872('0x111')](db[_0xc872('0x12b')],{'foreignKey':_0xc872('0x1da'),'as':_0xc872('0x1d3')});db['SmsTransferReport'][_0xc872('0x111')](db[_0xc872('0x50')],{});db[_0xc872('0xe6')]['belongsTo'](db[_0xc872('0x4e')],{});db[_0xc872('0xe6')][_0xc872('0x111')](db[_0xc872('0x4b')],{'foreignKey':_0xc872('0x1db'),'as':_0xc872('0x1cb')});db[_0xc872('0xe6')]['belongsTo'](db['User'],{'foreignKey':_0xc872('0x1cc'),'as':_0xc872('0x1d5')});db[_0xc872('0xe6')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':'ToUserId','as':_0xc872('0x1ce')});db['SmsTransferReport'][_0xc872('0x111')](db[_0xc872('0x51')],{'foreignKey':_0xc872('0x1dc'),'as':'ToQueue'});db[_0xc872('0xe6')][_0xc872('0x111')](db[_0xc872('0x4b')],{'foreignKey':_0xc872('0x1dd'),'as':_0xc872('0x1d3')});db[_0xc872('0xe8')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xc872('0xe8')][_0xc872('0x101')](db['CmContact'],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')]['hasMany'](db[_0xc872('0x6f')],{'as':'HopperFinals','foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')][_0xc872('0x101')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')][_0xc872('0x101')](db[_0xc872('0x72')],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')][_0xc872('0x113')](db[_0xc872('0x1b')],{'as':_0xc872('0x1de'),'through':_0xc872('0x140')});db[_0xc872('0xe8')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xc872('0xea')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':_0xc872('0x106'),'onDelete':_0xc872('0x107')});db[_0xc872('0xea')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':'user_has_voice_prefixes'});db[_0xc872('0xec')][_0xc872('0x101')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'foreignKey':_0xc872('0x112')});db['UserProfile']['hasMany'](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xc872('0x112'),'onDelete':_0xc872('0x107')});db['UserProfileSection'][_0xc872('0x101')](db[_0xc872('0xef')],{'as':'Resources','foreignKey':_0xc872('0x1df'),'onDelete':_0xc872('0x107')});db[_0xc872('0x12e')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x1e0')});db[_0xc872('0x12e')]['hasMany'](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x1e0')});db['WhatsappAccount'][_0xc872('0x101')](db[_0xc872('0xf8')],{'as':'Messages','foreignKey':_0xc872('0x1e0')});db[_0xc872('0x12e')][_0xc872('0x101')](db['WhatsappInteraction'],{'as':_0xc872('0x156')});db[_0xc872('0x12e')]['hasMany'](db[_0xc872('0xf4')],{'as':'Applications'});db[_0xc872('0x12e')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x12e')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db['WhatsappAccount'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':_0xc872('0x12f')});db[_0xc872('0xf4')][_0xc872('0x111')](db['User'],{'onDelete':_0xc872('0x166')});db['WhatsappApplication'][_0xc872('0x111')](db[_0xc872('0xfe')],{'onDelete':_0xc872('0x166')});db[_0xc872('0xf4')][_0xc872('0x111')](db['WhatsappAccount'],{'onDelete':_0xc872('0x166')});db[_0xc872('0xf4')][_0xc872('0x111')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xc872('0x13d')});db['WhatsappApplication'][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':_0xc872('0x166'),'foreignKey':'TagId'});db[_0xc872('0xf6')][_0xc872('0x101')](db[_0xc872('0xf8')],{'as':'Messages','onDelete':_0xc872('0x107'),'foreignKey':'WhatsappInteractionId'});db[_0xc872('0xf6')]['belongsTo'](db['WhatsappAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1e0')});db[_0xc872('0xf6')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0xf6')]['belongsTo'](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db['WhatsappInteraction'][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x1e1'),'as':_0xc872('0x160')});db[_0xc872('0xf6')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x1e1'),'as':_0xc872('0x161')});db['WhatsappInteraction'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':'user_has_whatsapp_interactions','foreignKey':_0xc872('0x1e2')});db['WhatsappMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x12')});db['WhatsappMessage'][_0xc872('0x111')](db[_0xc872('0x6b')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db['WhatsappMessage']['belongsTo'](db[_0xc872('0xf6')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x165'),'foreignKey':_0xc872('0x1e2')});db[_0xc872('0xf8')][_0xc872('0x111')](db[_0xc872('0x12e')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1e0')});db[_0xc872('0xfa')][_0xc872('0x111')](db['WhatsappAccount'],{});db[_0xc872('0xfa')]['belongsTo'](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0xfa')]['belongsTo'](db[_0xc872('0xf6')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc872('0xfe')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc872('0xf8')],{});db[_0xc872('0xfa')]['belongsTo'](db['User'],{});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0xf8')],{});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0xf6')],{});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0x12e')],{'foreignKey':_0xc872('0x1e3'),'as':_0xc872('0x1cb')});db[_0xc872('0xfc')][_0xc872('0x111')](db['WhatsappAccount'],{'foreignKey':_0xc872('0x1e4'),'as':_0xc872('0x1d3')});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0xfe')],{'foreignKey':_0xc872('0x1e5'),'as':_0xc872('0x1e6')});db[_0xc872('0xfc')][_0xc872('0x111')](db['User'],{'foreignKey':_0xc872('0x1cc'),'as':_0xc872('0x1d5')});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0xfe')][_0xc872('0x113')](db['User'],{'as':_0xc872('0x141'),'through':_0xc872('0x30'),'foreignKey':_0xc872('0x1e7')});db[_0xc872('0xfe')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xc872('0x1e8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xaa8d=['DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','hasOne','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ChatInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','ChatQueues','UserChatQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueue','Members','VoiceQueueId','CmHopperBlack','HopperBlacks','JscriptySessionReport','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','UserVoiceQueue','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailServerIn','Imap','Smtp','Dispositions','MailAccountId','CannedAnswer','Interactions','ListId','TemplateId','Agents','team_has_mail_queues','Messages','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','Interaction','MailInteractionId','MailApplication','restrict','TagId','MailQueueReport','List','Items','FaxAccountId','Answers','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsite','ChatWebsiteId','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','CompanyId','Hoppers','HopperHistories','JscriptySessions','Company','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','VariableId','DescriptionId','SugarcrmAccount','DeskField','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','FreshsalesAccount','FromId','ToId','SessionId','SmsQueueReport','ProjectId','MailQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','FromChatWebsiteId','FromAccount','FromUserId','ToChatQueueId','ToQueue','ToAccount','FaxTransferReport','ToUserId','ToAgent','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSection','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','motion2','xcall','127.0.0.1','utf8mb4','sequelizeHistory','xC@LL1234','mysql','name','password','options','database','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model'];(function(_0x5b8968,_0x2a599a){var _0x26526d=function(_0x478e34){while(--_0x478e34){_0x5b8968['push'](_0x5b8968['shift']());}};_0x26526d(++_0x2a599a);}(_0xaa8d,0x147));var _0xdaa8=function(_0x3c3982,_0x163010){_0x3c3982=_0x3c3982-0x0;var _0x66448f=_0xaa8d[_0x3c3982];return _0x66448f;};'use strict';var path=require(_0xdaa8('0x0'));var config=require(_0xdaa8('0x1'));var Sequelize=require(_0xdaa8('0x2'));var _=require(_0xdaa8('0x3'));var jstz=require(_0xdaa8('0x4'));var timezone=jstz['determine']();config[_0xdaa8('0x2')]=_['defaultsDeep'](config[_0xdaa8('0x2')],{'database':_0xdaa8('0x5'),'username':_0xdaa8('0x6'),'password':'xC@LL1234','options':{'host':_0xdaa8('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xdaa8('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0xdaa8('0x9')],{'database':_0xdaa8('0x5'),'username':'xcall','password':_0xdaa8('0xa'),'options':{'host':_0xdaa8('0x7'),'port':0xcea,'dialect':_0xdaa8('0xb'),'dialectOptions':{'charset':_0xdaa8('0x8')},'logging':![],'timezone':timezone[_0xdaa8('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdaa8('0x2')]['database'],config[_0xdaa8('0x2')]['username'],config['sequelize'][_0xdaa8('0xd')],config[_0xdaa8('0x2')][_0xdaa8('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdaa8('0x9')][_0xdaa8('0xf')],config[_0xdaa8('0x9')][_0xdaa8('0x10')],config['sequelizeHistory'][_0xdaa8('0xd')],config[_0xdaa8('0x9')][_0xdaa8('0xe')])};db[_0xdaa8('0x11')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x13'));db[_0xdaa8('0x14')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x15'));db[_0xdaa8('0x16')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x17'));db['VoiceExtension']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x18'));db[_0xdaa8('0x19')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x1a'));db['VoiceQueue']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x1b'));db['VoiceRecording']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x1c'));db[_0xdaa8('0x1d')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x1e'));db[_0xdaa8('0x1f')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x20'));db[_0xdaa8('0x21')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x22'));db[_0xdaa8('0x23')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/voiceCallReport/voiceCallReport.model');db[_0xdaa8('0x24')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x25'));db[_0xdaa8('0x26')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x27'));db[_0xdaa8('0x28')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x29'));db['MemberReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/memberReport/memberReport.model');db[_0xdaa8('0x2a')]=db[_0xdaa8('0x2')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x2b'));db[_0xdaa8('0x2c')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x2d'));db['UserVoiceQueue']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x2e'));db['UserChatQueue']=db['sequelize'][_0xdaa8('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0xdaa8('0x2f')]=db['sequelize']['import'](_0xdaa8('0x30'));db[_0xdaa8('0x31')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x32'));db[_0xdaa8('0x33')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x34'));db[_0xdaa8('0x35')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x36'));db[_0xdaa8('0x37')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0xdaa8('0x38')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x39'));db[_0xdaa8('0x3a')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3b'));db['MailQueue']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3c'));db['MailSubstatus']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3d'));db[_0xdaa8('0x3e')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x3f'));db[_0xdaa8('0x40')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x41'));db['MailApplication']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x42'));db['MailQueueReport']=db['sequelize']['import'](_0xdaa8('0x43'));db['Dashboard']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x44'));db[_0xdaa8('0x45')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x46'));db[_0xdaa8('0x47')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/faxAccount/faxAccount.model');db[_0xdaa8('0x48')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x49'));db['FaxInteraction']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x4a'));db[_0xdaa8('0x4b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x4c'));db[_0xdaa8('0x4d')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x4e'));db[_0xdaa8('0x4f')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x50'));db[_0xdaa8('0x51')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x52'));db[_0xdaa8('0x53')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x54'));db[_0xdaa8('0x55')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x56'));db[_0xdaa8('0x57')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x58'));db[_0xdaa8('0x59')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x5a'));db[_0xdaa8('0x5b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0xdaa8('0x5c')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x5d'));db[_0xdaa8('0x5e')]=db[_0xdaa8('0x2')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0xdaa8('0x5f')]=db[_0xdaa8('0x2')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xdaa8('0x60')]=db['sequelize']['import'](_0xdaa8('0x61'));db['ChatWebsite']=db[_0xdaa8('0x2')]['import']('../api/chatWebsite/chatWebsite.model');db[_0xdaa8('0x62')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xdaa8('0x63')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x64'));db[_0xdaa8('0x65')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x66'));db[_0xdaa8('0x67')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x68'));db['ChatOfflineMessage']=db['sequelize'][_0xdaa8('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xdaa8('0x69')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x6a'));db[_0xdaa8('0x6b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x6c'));db[_0xdaa8('0x6d')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x6e'));db['CmCompany']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x6f'));db[_0xdaa8('0x70')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x71'));db[_0xdaa8('0x72')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x73'));db['CmHopperBlack']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x74'));db[_0xdaa8('0x75')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x76'));db[_0xdaa8('0x77')]=db[_0xdaa8('0x2')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xdaa8('0x78')]=db['sequelize'][_0xdaa8('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xdaa8('0x79')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x7a'));db['Action']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x7b'));db[_0xdaa8('0x7c')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x7d'));db['CannedAnswer']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x7e'));db[_0xdaa8('0x7f')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x80'));db[_0xdaa8('0x81')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x82'));db[_0xdaa8('0x83')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/interval/interval.model');db[_0xdaa8('0x84')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x85'));db[_0xdaa8('0x86')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x87'));db[_0xdaa8('0x88')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x89'));db['Schedule']=db['sequelize']['import'](_0xdaa8('0x8a'));db[_0xdaa8('0x8b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x8c'));db['Tag']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x8d'));db[_0xdaa8('0x8e')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/template/template.model');db[_0xdaa8('0x8f')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x90'));db[_0xdaa8('0x91')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x92'));db[_0xdaa8('0x93')]=db[_0xdaa8('0x2')]['import']('../api/integration/integration.model');db[_0xdaa8('0x94')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/integrationReport/integrationReport.model');db[_0xdaa8('0x95')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x96'));db[_0xdaa8('0x97')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x98'));db[_0xdaa8('0x99')]=db['sequelize']['import'](_0xdaa8('0x9a'));db[_0xdaa8('0x9b')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0x9c'));db['AnalyticFieldReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x9d'));db[_0xdaa8('0x9e')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x9f'));db[_0xdaa8('0xa0')]=db[_0xdaa8('0x2')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xdaa8('0xa1')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xdaa8('0xa2')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xa3'));db['SugarcrmAccount']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xa4'));db[_0xdaa8('0xa5')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xa6'));db[_0xdaa8('0xa7')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xa8'));db[_0xdaa8('0xa9')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xaa'));db[_0xdaa8('0xab')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xac'));db['DeskField']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xad'));db[_0xdaa8('0xae')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xaf'));db[_0xdaa8('0xb0')]=db['sequelize']['import'](_0xdaa8('0xb1'));db[_0xdaa8('0xb2')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xb3'));db[_0xdaa8('0xb4')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xb5'));db[_0xdaa8('0xb6')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xb7'));db['ZendeskField']=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0xdaa8('0xb8')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xb9'));db[_0xdaa8('0xba')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xbb'));db[_0xdaa8('0xbc')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xbd'));db[_0xdaa8('0xbe')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xdaa8('0xbf')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xc0'));db[_0xdaa8('0xc1')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xc2'));db[_0xdaa8('0xc3')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xc4'));db[_0xdaa8('0xc5')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xc6'));db[_0xdaa8('0xc7')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0xdaa8('0xc8')]=db['sequelize'][_0xdaa8('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xdaa8('0xc9')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xca'));db[_0xdaa8('0xcb')]=db['sequelize']['import'](_0xdaa8('0xcc'));db['FreshsalesAccount']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xcd'));db[_0xdaa8('0xce')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xcf'));db[_0xdaa8('0xd0')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xd1'));db[_0xdaa8('0x93')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xd2'));db['Network']=db['sequelize']['import']('../api/network/network.model');db[_0xdaa8('0xd3')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xd4'));db[_0xdaa8('0xd5')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xd6'));db[_0xdaa8('0xd7')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xd8'));db[_0xdaa8('0xd9')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xda'));db['JscriptySessionReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xdb'));db['SmsQueueReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xdc'));db[_0xdaa8('0xdd')]=db['sequelize']['import'](_0xdaa8('0xde'));db['SquareDetailsReport']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xdf'));db[_0xdaa8('0xe0')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0xdaa8('0xe1')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xe2'));db['SquareOdbc']=db['sequelize'][_0xdaa8('0x12')]('../api/squareOdbc/squareOdbc.model');db[_0xdaa8('0xe3')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xe4'));db['SquareRecording']=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xe5'));db[_0xdaa8('0xe6')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xe7'));db[_0xdaa8('0xe8')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xe9'));db['License']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xea'));db[_0xdaa8('0xeb')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xec'));db[_0xdaa8('0xed')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xee'));db[_0xdaa8('0xef')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/attachment/attachment.model');db[_0xdaa8('0xf0')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xf1'));db[_0xdaa8('0xf2')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xf3'));db[_0xdaa8('0xf4')]=db['sequelize'][_0xdaa8('0x12')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0xf5'));db[_0xdaa8('0xf6')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xdaa8('0x2')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0xdaa8('0xf7')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xf8'));db['VoicePrefix']=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db[_0xdaa8('0xf9')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xfa'));db['UserProfileSection']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0xfb'));db[_0xdaa8('0xfc')]=db['sequelize'][_0xdaa8('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xdaa8('0xfd')]=db[_0xdaa8('0x2')]['import'](_0xdaa8('0xfe'));db[_0xdaa8('0xff')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0xdaa8('0x100')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x101'));db[_0xdaa8('0x102')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x103'));db['WhatsappMessage']=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x104'));db[_0xdaa8('0x105')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x106'));db[_0xdaa8('0x107')]=db['sequelize'][_0xdaa8('0x12')](_0xdaa8('0x108'));db[_0xdaa8('0x109')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')](_0xdaa8('0x10a'));db[_0xdaa8('0x10b')]=db[_0xdaa8('0x2')][_0xdaa8('0x12')]('../api/cloudProvider/cloudProvider.model');db[_0xdaa8('0x11')][_0xdaa8('0x10c')](db[_0xdaa8('0x1f')],{'as':_0xdaa8('0x1f'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x10e')});db['User'][_0xdaa8('0x10f')](db[_0xdaa8('0x110')],{'as':_0xdaa8('0x111'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')]['hasMany'](db[_0xdaa8('0x2c')],{'as':_0xdaa8('0x112'),'foreignKey':'UserId'});db[_0xdaa8('0x11')]['hasMany'](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x114'),'onDelete':_0xdaa8('0x10d'),'hooks':!![]});db['User'][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':_0xdaa8('0x115'),'foreignKey':'UserId'});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db['CmHopperHistory'],{'as':_0xdaa8('0x116'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x78')],{'as':'ReportAgentPreview','foreignKey':_0xdaa8('0x10e')});db['User'][_0xdaa8('0x10f')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x65')],{'as':_0xdaa8('0x117'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x119'),'foreignKey':'UserId'});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x11a'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db[_0xdaa8('0x102')],{'as':_0xdaa8('0x11b'),'foreignKey':'UserId'});db[_0xdaa8('0x11')][_0xdaa8('0x10f')](db['Notification'],{'as':_0xdaa8('0x11c'),'foreignKey':_0xdaa8('0x11d')});db[_0xdaa8('0x11')][_0xdaa8('0x11e')](db[_0xdaa8('0xf9')],{'as':_0xdaa8('0xf9'),'foreignKey':_0xdaa8('0x11f')});db['User'][_0xdaa8('0x120')](db[_0xdaa8('0x6b')],{'as':_0xdaa8('0x121'),'through':_0xdaa8('0x122')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['CmContact'],{'as':_0xdaa8('0x123'),'through':_0xdaa8('0x124')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['CmList'],{'as':_0xdaa8('0x125'),'through':_0xdaa8('0x126')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':'user_has_teams'});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x11a'),'through':_0xdaa8('0x127')});db['User']['belongsToMany'](db[_0xdaa8('0x65')],{'as':_0xdaa8('0x117'),'through':_0xdaa8('0x128')});db[_0xdaa8('0x11')]['belongsToMany'](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x119'),'through':_0xdaa8('0x129')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x55')],{'as':_0xdaa8('0x12a'),'through':_0xdaa8('0x12b')});db[_0xdaa8('0x11')]['belongsToMany'](db[_0xdaa8('0x5e')],{'as':_0xdaa8('0x12c'),'through':_0xdaa8('0x12d')});db[_0xdaa8('0x11')]['belongsToMany'](db[_0xdaa8('0x102')],{'as':'WhatsappInteractions','through':_0xdaa8('0x12e')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['VoiceQueue'],{'as':_0xdaa8('0x12f'),'through':'UserVoiceQueue','required':![]});db['User'][_0xdaa8('0x120')](db[_0xdaa8('0x130')],{'as':'MailQueues','through':_0xdaa8('0x2f'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['ChatQueue'],{'as':_0xdaa8('0x131'),'through':_0xdaa8('0x132'),'required':![],'hooks':!![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['SmsQueue'],{'as':_0xdaa8('0x133'),'through':_0xdaa8('0x33'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['OpenchannelQueue'],{'as':_0xdaa8('0x134'),'through':_0xdaa8('0x35'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x109')],{'as':_0xdaa8('0x135'),'through':_0xdaa8('0x37'),'required':![]});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0xf7')],{'through':'cm_user_has_lists'});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x136')],{'as':_0xdaa8('0x137'),'through':_0xdaa8('0x138'),'required':![]});db[_0xdaa8('0x11')]['belongsToMany'](db['ChatWebsite'],{'as':_0xdaa8('0x139'),'through':_0xdaa8('0x13a')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0x47')],{'as':_0xdaa8('0x13b'),'through':_0xdaa8('0x13c')});db['User'][_0xdaa8('0x120')](db['MailAccount'],{'as':_0xdaa8('0x13d'),'through':_0xdaa8('0x13e')});db['User']['belongsToMany'](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xdaa8('0x13f')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['SmsAccount'],{'as':_0xdaa8('0x140'),'through':_0xdaa8('0x141')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db['WhatsappAccount'],{'as':_0xdaa8('0x142'),'through':_0xdaa8('0x143')});db[_0xdaa8('0x11')][_0xdaa8('0x120')](db[_0xdaa8('0xe3')],{'as':_0xdaa8('0x144'),'through':_0xdaa8('0x145')});db[_0xdaa8('0x14')][_0xdaa8('0x10f')](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x146'),'onDelete':'cascade','foreignKey':_0xdaa8('0x147')});db[_0xdaa8('0x16')]['hasMany'](db[_0xdaa8('0x113')],{'onDelete':'cascade'});db[_0xdaa8('0x113')][_0xdaa8('0x10f')](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x148'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x19')][_0xdaa8('0x120')](db[_0xdaa8('0x8b')],{'as':_0xdaa8('0x149'),'through':_0xdaa8('0x14a')});db[_0xdaa8('0x14b')][_0xdaa8('0x10f')](db[_0xdaa8('0x2c')],{'as':_0xdaa8('0x14c'),'foreignKey':_0xdaa8('0x14d')});db[_0xdaa8('0x14b')][_0xdaa8('0x10f')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xdaa8('0x14d')});db[_0xdaa8('0x14b')][_0xdaa8('0x10f')](db['CmHopperFinal'],{'as':_0xdaa8('0x115'),'foreignKey':_0xdaa8('0x14d')});db[_0xdaa8('0x14b')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xdaa8('0x14b')]['hasMany'](db['ReportAgentPreview'],{'as':_0xdaa8('0x78'),'foreignKey':'VoiceQueueId'});db[_0xdaa8('0x14b')]['hasMany'](db[_0xdaa8('0x14e')],{'as':_0xdaa8('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xdaa8('0x10f')](db[_0xdaa8('0x150')],{'as':'JscriptySessions','foreignKey':_0xdaa8('0x14d')});db['VoiceQueue']['belongsTo'](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x2a'),'foreignKey':'TrunkId'});db[_0xdaa8('0x14b')][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x151'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0xdaa8('0x11e')](db[_0xdaa8('0x83')],{'as':_0xdaa8('0x83'),'foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x14b')][_0xdaa8('0x11e')](db['Pause'],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db[_0xdaa8('0x14b')][_0xdaa8('0x120')](db[_0xdaa8('0xf7')],{'as':'Lists','through':_0xdaa8('0x155')});db[_0xdaa8('0x14b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xdaa8('0x156')});db['VoiceQueue'][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'as':_0xdaa8('0x157'),'through':_0xdaa8('0x158')});db[_0xdaa8('0x14b')][_0xdaa8('0x120')](db['CmList'],{'as':_0xdaa8('0x159'),'through':_0xdaa8('0x15a')});db['VoiceRecording'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x11'),'foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x1d')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'User','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x1f')][_0xdaa8('0x10f')](db[_0xdaa8('0x21')],{'as':'Messages','onDelete':_0xdaa8('0x10d'),'foreignKey':'mailboxuser','sourceKey':_0xdaa8('0x15b')});db[_0xdaa8('0x21')]['belongsTo'](db[_0xdaa8('0x1f')],{'foreignKey':_0xdaa8('0x15c'),'targetKey':'mailbox'});db[_0xdaa8('0x23')][_0xdaa8('0x10f')](db[_0xdaa8('0x28')],{'as':_0xdaa8('0x15d'),'foreignKey':_0xdaa8('0x15e'),'constraints':![]});db[_0xdaa8('0x23')][_0xdaa8('0x10f')](db['VoiceAgentReport'],{'as':_0xdaa8('0x15f'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xdaa8('0x11')],{'as':'User','foreignKey':'UserId'});db[_0xdaa8('0x23')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x161')][_0xdaa8('0x11e')](db['MailAccount'],{'as':_0xdaa8('0x3a'),'foreignKey':'MailAccountId'});db[_0xdaa8('0x38')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{'as':_0xdaa8('0x3a'),'foreignKey':'MailAccountId'});db[_0xdaa8('0x3a')]['hasOne'](db['MailServerIn'],{'as':_0xdaa8('0x162'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x3a')][_0xdaa8('0x10c')](db['MailServerOut'],{'as':_0xdaa8('0x163'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x3a')]['hasMany'](db['Disposition'],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x165')});db[_0xdaa8('0x3a')]['hasMany'](db[_0xdaa8('0x166')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xdaa8('0x3a')]['hasMany'](db[_0xdaa8('0x40')],{'as':'Messages','foreignKey':_0xdaa8('0x165')});db[_0xdaa8('0x3a')]['hasMany'](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x167')});db['MailAccount'][_0xdaa8('0x10f')](db['MailApplication'],{'as':'Applications'});db['MailAccount']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xdaa8('0x168')});db['MailAccount'][_0xdaa8('0x11e')](db['Template'],{'as':_0xdaa8('0x8e'),'foreignKey':_0xdaa8('0x169')});db[_0xdaa8('0x3a')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db['MailAccount']['belongsToMany'](db['User'],{'as':_0xdaa8('0x16a'),'through':'user_has_mail_accounts'});db[_0xdaa8('0x130')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x2f')});db[_0xdaa8('0x130')]['belongsToMany'](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x16b'),'as':_0xdaa8('0x157')});db[_0xdaa8('0x3e')][_0xdaa8('0x10f')](db['MailMessage'],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'MailInteractionId'});db[_0xdaa8('0x3e')][_0xdaa8('0x11e')](db['MailAccount'],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x165')});db[_0xdaa8('0x3e')]['belongsTo'](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x3e')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16f'),'foreignKey':_0xdaa8('0x10e')});db['MailInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x171'),'as':_0xdaa8('0x172')});db[_0xdaa8('0x3e')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x171'),'as':'ThroughTags'});db['MailInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Users','through':_0xdaa8('0x127'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xdaa8('0x10f')](db[_0xdaa8('0xef')],{'as':'Attachments','onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x40')][_0xdaa8('0x11e')](db['User'],{'as':_0xdaa8('0x11')});db[_0xdaa8('0x40')]['belongsTo'](db[_0xdaa8('0x70')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db['MailMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x174')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0xdaa8('0x175')]['belongsTo'](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x175')][_0xdaa8('0x11e')](db[_0xdaa8('0x130')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x175')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x175')]['belongsTo'](db[_0xdaa8('0x83')],{'onDelete':'restrict','foreignKey':_0xdaa8('0x152')});db['MailApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db['MailAccount'],{});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':'ListId'});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x3e')],{});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x40')],{});db['MailQueueReport'][_0xdaa8('0x11e')](db['User'],{});db[_0xdaa8('0x178')][_0xdaa8('0x11e')](db[_0xdaa8('0x130')],{});db['Dashboard'][_0xdaa8('0x10f')](db[_0xdaa8('0x45')],{'as':_0xdaa8('0x17a'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x17b')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x166')],{'as':_0xdaa8('0x17c'),'foreignKey':_0xdaa8('0x17b')});db['FaxAccount']['hasMany'](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x167')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x48')],{'as':_0xdaa8('0x148')});db[_0xdaa8('0x47')]['hasMany'](db[_0xdaa8('0x113')],{'as':_0xdaa8('0x17d'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x47')][_0xdaa8('0x10f')](db[_0xdaa8('0x4b')],{'as':_0xdaa8('0x16c')});db['FaxAccount'][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x2a')});db['FaxAccount'][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x47')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db[_0xdaa8('0x47')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x13c')});db[_0xdaa8('0x48')][_0xdaa8('0x11e')](db['User'],{'onDelete':_0xdaa8('0x176')});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x48')][_0xdaa8('0x11e')](db['Tag'],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x118')][_0xdaa8('0x10f')](db[_0xdaa8('0x4b')],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x17e')});db[_0xdaa8('0x118')]['belongsTo'](db[_0xdaa8('0x47')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xdaa8('0x118')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x118')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16f'),'foreignKey':_0xdaa8('0x10e')});db['FaxInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':'fax_interaction_has_tags','as':_0xdaa8('0x172')});db['FaxInteraction'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x17f'),'as':_0xdaa8('0x180')});db['FaxInteraction']['belongsToMany'](db[_0xdaa8('0x11')],{'as':'Users','through':_0xdaa8('0x129'),'foreignKey':_0xdaa8('0x17e')});db['FaxMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x11')});db[_0xdaa8('0x4b')][_0xdaa8('0x11e')](db[_0xdaa8('0x118')],{'as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x17e')});db[_0xdaa8('0x4b')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db['FaxMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0xef')],{'as':_0xdaa8('0xef'),'foreignKey':_0xdaa8('0x181')});db[_0xdaa8('0x4b')][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x17b')});db[_0xdaa8('0x4d')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x31')});db[_0xdaa8('0x4d')][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x182'),'as':_0xdaa8('0x157')});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{});db['FaxQueueReport'][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db['FaxQueueReport'][_0xdaa8('0x11e')](db['FaxInteraction'],{});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db[_0xdaa8('0x4b')],{});db['FaxQueueReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x4f')][_0xdaa8('0x11e')](db['FaxQueue'],{});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':'Dispositions','foreignKey':_0xdaa8('0x183')});db[_0xdaa8('0x51')]['hasMany'](db[_0xdaa8('0x166')],{'as':'Answers','foreignKey':_0xdaa8('0x183')});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db[_0xdaa8('0x57')],{'as':_0xdaa8('0x16c'),'foreignKey':'SmsAccountId'});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db['SmsInteraction'],{'as':_0xdaa8('0x167')});db[_0xdaa8('0x51')][_0xdaa8('0x10f')](db[_0xdaa8('0x53')],{'as':_0xdaa8('0x148')});db[_0xdaa8('0x51')][_0xdaa8('0x11e')](db['CmList'],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x51')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdaa8('0x51')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0xdaa8('0x53')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x53')][_0xdaa8('0x11e')](db[_0xdaa8('0x59')],{'onDelete':_0xdaa8('0x176')});db['SmsApplication'][_0xdaa8('0x11e')](db['SmsAccount'],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x53')][_0xdaa8('0x11e')](db[_0xdaa8('0x83')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x152')});db['SmsApplication']['belongsTo'](db['Tag'],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db['SmsInteraction'][_0xdaa8('0x10f')](db[_0xdaa8('0x57')],{'as':_0xdaa8('0x16c'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'as':'Account','foreignKey':_0xdaa8('0x183')});db['SmsInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x55')]['belongsTo'](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':_0xdaa8('0x10e')});db['SmsInteraction']['belongsToMany'](db[_0xdaa8('0x170')],{'through':'sms_interaction_has_tags','as':_0xdaa8('0x172')});db[_0xdaa8('0x55')]['belongsToMany'](db[_0xdaa8('0x170')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db['SmsInteraction']['belongsToMany'](db[_0xdaa8('0x11')],{'as':'Users','through':_0xdaa8('0x12b'),'foreignKey':'SmsInteractionId'});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x11')});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db[_0xdaa8('0x55')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x184')});db[_0xdaa8('0x57')][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'as':_0xdaa8('0x16d'),'foreignKey':'SmsAccountId'});db[_0xdaa8('0x59')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x33'),'foreignKey':_0xdaa8('0x185')});db['SmsQueue'][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x186'),'as':_0xdaa8('0x157')});db['OpenchannelAccount'][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db[_0xdaa8('0x166')],{'as':_0xdaa8('0x17c'),'foreignKey':'OpenchannelAccountId'});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db[_0xdaa8('0x5e')],{'as':_0xdaa8('0x167'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db['OpenchannelMessage'],{'as':_0xdaa8('0x16c'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5b')][_0xdaa8('0x10f')](db[_0xdaa8('0x5c')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x5b')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdaa8('0x5b')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x13f')});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db['User'],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db[_0xdaa8('0x60')],{'onDelete':_0xdaa8('0x176'),'foreignKey':'OpenchannelQueueId'});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x5c')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x5c')][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x5e')][_0xdaa8('0x10f')](db[_0xdaa8('0x5f')],{'as':_0xdaa8('0x16c'),'onDelete':'cascade','foreignKey':_0xdaa8('0x188')});db[_0xdaa8('0x5e')][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{'as':_0xdaa8('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0xdaa8('0x5e')]['belongsTo'](db['CmContact'],{'as':_0xdaa8('0x16e'),'foreignKey':'ContactId'});db[_0xdaa8('0x5e')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16f'),'foreignKey':'UserId'});db[_0xdaa8('0x5e')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x189'),'as':'Tags'});db['OpenchannelInteraction'][_0xdaa8('0x120')](db['Tag'],{'through':_0xdaa8('0x189'),'as':'ThroughTags'});db[_0xdaa8('0x5e')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x12d'),'foreignKey':_0xdaa8('0x188')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x11')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':'Contact'});db['OpenchannelMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x5e')],{'onDelete':'cascade','as':_0xdaa8('0x173'),'foreignKey':_0xdaa8('0x188')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db['Attachment'],{'as':_0xdaa8('0xef'),'foreignKey':_0xdaa8('0x181')});db[_0xdaa8('0x5f')][_0xdaa8('0x11e')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xdaa8('0x187')});db[_0xdaa8('0x60')][_0xdaa8('0x120')](db['User'],{'as':'Agents','through':_0xdaa8('0x35'),'foreignKey':_0xdaa8('0x18b')});db[_0xdaa8('0x60')][_0xdaa8('0x120')](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x18c'),'as':_0xdaa8('0x157')});db[_0xdaa8('0x18d')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x18e')});db['ChatWebsite']['hasMany'](db[_0xdaa8('0x166')],{'as':_0xdaa8('0x17c'),'foreignKey':_0xdaa8('0x18e')});db[_0xdaa8('0x18d')][_0xdaa8('0x10f')](db['ChatProactiveAction'],{'as':_0xdaa8('0x18f')});db[_0xdaa8('0x18d')]['hasMany'](db[_0xdaa8('0x65')],{'as':_0xdaa8('0x167')});db[_0xdaa8('0x18d')][_0xdaa8('0x10f')](db[_0xdaa8('0x63')],{'as':_0xdaa8('0x148')});db[_0xdaa8('0x18d')]['hasMany'](db['ChatMessage'],{'as':_0xdaa8('0x16c')});db[_0xdaa8('0x18d')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xdaa8('0x18d')]['belongsTo'](db[_0xdaa8('0x83')],{'as':'Interval','foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x18d')][_0xdaa8('0x11e')](db[_0xdaa8('0x84')],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db[_0xdaa8('0x18d')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':'user_has_chat_websites'});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':'ContactId'});db[_0xdaa8('0x62')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xdaa8('0x62')]['belongsTo'](db[_0xdaa8('0x5f')],{});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x62')][_0xdaa8('0x11e')](db['OpenchannelQueue'],{});db[_0xdaa8('0x63')]['belongsTo'](db['User'],{'as':_0xdaa8('0x190'),'foreignKey':_0xdaa8('0x10e'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x63')]['belongsTo'](db[_0xdaa8('0x69')],{'as':_0xdaa8('0x191'),'foreignKey':'ChatQueueId','onDelete':_0xdaa8('0x176')});db['ChatApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x192'),'foreignKey':_0xdaa8('0x18e'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x63')][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xdaa8('0x65')]['hasMany'](db[_0xdaa8('0x67')],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x193')});db['ChatInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x18e')});db[_0xdaa8('0x65')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db['ChatInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0xdaa8('0x65')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x194'),'as':_0xdaa8('0x172')});db[_0xdaa8('0x65')][_0xdaa8('0x120')](db['Tag'],{'through':_0xdaa8('0x194'),'as':'ThroughTags'});db[_0xdaa8('0x65')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x128'),'foreignKey':_0xdaa8('0x193')});db['ChatMessage'][_0xdaa8('0x11e')](db['User'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x11')});db['ChatMessage'][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'onDelete':'cascade','as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x67')][_0xdaa8('0x11e')](db[_0xdaa8('0x65')],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x173'),'foreignKey':'ChatInteractionId'});db[_0xdaa8('0x67')]['belongsTo'](db[_0xdaa8('0xef')],{'as':'Attachment','foreignKey':_0xdaa8('0x181')});db[_0xdaa8('0x67')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0xdaa8('0x195')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e'),'foreignKey':'ContactId'});db[_0xdaa8('0x195')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x18e')});db[_0xdaa8('0x69')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':'UserChatQueue','hooks':!![]});db[_0xdaa8('0x69')][_0xdaa8('0x120')](db['Team'],{'through':_0xdaa8('0x196'),'as':'Teams'});db[_0xdaa8('0x6b')][_0xdaa8('0x10f')](db[_0xdaa8('0xd5')],{'as':_0xdaa8('0x16c'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xdaa8('0x6b')][_0xdaa8('0x120')](db['User'],{'as':_0xdaa8('0x14c'),'through':_0xdaa8('0x122')});db[_0xdaa8('0x6d')][_0xdaa8('0x11e')](db['ChatWebsite'],{'as':_0xdaa8('0x192'),'foreignKey':_0xdaa8('0x18e')});db['CmCompany']['hasMany'](db['CmContact'],{'as':'Contacts','foreignKey':_0xdaa8('0x197')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x72')],{'as':_0xdaa8('0x198'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':_0xdaa8('0x115'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x70')]['hasMany'](db[_0xdaa8('0x77')],{'as':_0xdaa8('0x199'),'foreignKey':'ContactId'});db['CmContact'][_0xdaa8('0x10f')](db[_0xdaa8('0x78')],{'as':_0xdaa8('0x78'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x70')]['hasMany'](db[_0xdaa8('0x150')],{'as':_0xdaa8('0x19a'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0xdaa8('0x12c'),'foreignKey':_0xdaa8('0x160'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x65')],{'as':'ChatInteractions','foreignKey':_0xdaa8('0x160'),'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')][_0xdaa8('0x10f')](db[_0xdaa8('0x55')],{'as':_0xdaa8('0x12a'),'foreignKey':'ContactId','onDelete':_0xdaa8('0x176')});db['CmContact'][_0xdaa8('0x10f')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')]['hasMany'](db[_0xdaa8('0x3e')],{'as':_0xdaa8('0x11a'),'foreignKey':'ContactId','onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x70')]['belongsTo'](db['CmCompany'],{'as':_0xdaa8('0x19b'),'foreignKey':_0xdaa8('0x197')});db[_0xdaa8('0x70')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x70')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':'cm_user_has_contacts'});db[_0xdaa8('0x70')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'as':_0xdaa8('0x172'),'through':_0xdaa8('0x19c')});db[_0xdaa8('0x70')][_0xdaa8('0x120')](db['Tag'],{'through':_0xdaa8('0x19c'),'as':'ThroughTags'});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160'),'onDelete':'cascade'});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db['CmList'],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Agent','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x14b')],{'as':'Queue','foreignKey':_0xdaa8('0x14d'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0xeb')],{'as':_0xdaa8('0xeb'),'foreignKey':'CampaignId','onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x72')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':_0xdaa8('0x19d')});db['CmHopperBlack'][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160'),'onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x14e')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168'),'onDelete':_0xdaa8('0x10d')});db['CmHopperBlack']['belongsTo'](db[_0xdaa8('0x14b')],{'as':_0xdaa8('0x191'),'foreignKey':'VoiceQueueId','onDelete':_0xdaa8('0x10d')});db['CmHopperBlack'][_0xdaa8('0x11e')](db[_0xdaa8('0xeb')],{'as':_0xdaa8('0xeb'),'foreignKey':_0xdaa8('0x19e'),'onDelete':_0xdaa8('0x10d')});db['Automation'][_0xdaa8('0x10f')](db[_0xdaa8('0x81')],{'as':{'plural':_0xdaa8('0x19f'),'singular':_0xdaa8('0x1a0')},'foreignKey':_0xdaa8('0x1a1'),'onDelete':_0xdaa8('0x10d'),'hooks':!![]});db['Automation'][_0xdaa8('0x10f')](db['Condition'],{'as':{'plural':_0xdaa8('0x1a2'),'singular':_0xdaa8('0x1a3')},'foreignKey':_0xdaa8('0x1a4'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xdaa8('0x10f')](db['Action'],{'as':_0xdaa8('0x1a5'),'foreignKey':'AutomationId','onDelete':_0xdaa8('0x10d'),'hooks':!![]});db[_0xdaa8('0x7f')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x1a6'),'onDelete':'cascade'});db['Interval'][_0xdaa8('0x10f')](db[_0xdaa8('0x83')],{'as':'Intervals','foreignKey':_0xdaa8('0x152'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xdaa8('0x83')]['hasMany'](db[_0xdaa8('0x113')],{'as':'Extensions','foreignKey':_0xdaa8('0x152'),'onDelete':_0xdaa8('0x176')});db['Interval'][_0xdaa8('0x10f')](db[_0xdaa8('0x175')],{'as':_0xdaa8('0x1a7'),'foreignKey':'IntervalId'});db[_0xdaa8('0x83')]['hasMany'](db[_0xdaa8('0x63')],{'as':'ChatApplications','foreignKey':_0xdaa8('0x152')});db[_0xdaa8('0x83')][_0xdaa8('0x10f')](db[_0xdaa8('0x48')],{'as':_0xdaa8('0x1a8'),'foreignKey':'IntervalId'});db[_0xdaa8('0x83')][_0xdaa8('0x10f')](db[_0xdaa8('0x53')],{'as':_0xdaa8('0x1a9'),'foreignKey':'IntervalId'});db[_0xdaa8('0x1aa')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{});db[_0xdaa8('0x1aa')][_0xdaa8('0x11e')](db['AnalyticDefaultReport'],{'foreignKey':_0xdaa8('0x1ab')});db[_0xdaa8('0x1aa')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0xdaa8('0x1ac')});db['Sound'][_0xdaa8('0x120')](db['VoiceMusicOnHold'],{'as':_0xdaa8('0x1ad'),'through':'moh_has_sounds','onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x70')],{'through':_0xdaa8('0x19c')});db[_0xdaa8('0x170')]['belongsToMany'](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db['SmsInteraction'],{'through':_0xdaa8('0x1ae')});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x118')],{'through':_0xdaa8('0x17f')});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x5e')],{'through':'openchannel_interaction_has_tags'});db[_0xdaa8('0x170')][_0xdaa8('0x120')](db[_0xdaa8('0x102')],{'through':_0xdaa8('0x1af')});db[_0xdaa8('0x8f')][_0xdaa8('0x10f')](db[_0xdaa8('0x81')],{'as':{'plural':_0xdaa8('0x1b0'),'singular':_0xdaa8('0x1b1')},'foreignKey':_0xdaa8('0x1b2'),'onDelete':_0xdaa8('0x10d'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xdaa8('0x81')],{'as':{'plural':_0xdaa8('0x1b3'),'singular':'AnyCondition'},'foreignKey':_0xdaa8('0x1b4'),'onDelete':'cascade','hooks':!![]});db[_0xdaa8('0x8f')][_0xdaa8('0x10f')](db['Action'],{'as':_0xdaa8('0x1a5'),'foreignKey':'TriggerId','onDelete':_0xdaa8('0x10d'),'hooks':!![]});db[_0xdaa8('0x95')][_0xdaa8('0x10f')](db[_0xdaa8('0x1b5')],{'as':'Fields','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1ac'),'hooks':!![]});db[_0xdaa8('0x97')][_0xdaa8('0x10f')](db['AnalyticFieldReport'],{'as':_0xdaa8('0x1b6'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1ab')});db[_0xdaa8('0x9b')][_0xdaa8('0x10f')](db['AnalyticFieldReport'],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'MetricId'});db[_0xdaa8('0x1b5')][_0xdaa8('0x11e')](db[_0xdaa8('0x9b')],{'foreignKey':_0xdaa8('0x1b7')});db[_0xdaa8('0xa0')][_0xdaa8('0x10f')](db[_0xdaa8('0xa1')],{'as':_0xdaa8('0x1b8'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xa1')]['hasMany'](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa1')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1bc'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xdaa8('0xa1')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':'Fields','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa1')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xdaa8('0xa2')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa2')][_0xdaa8('0x10f')](db[_0xdaa8('0xa2')],{'as':_0xdaa8('0x1bf'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xdaa8('0x10f')](db['SalesforceField'],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa2')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xdaa8('0x1c1')});db['SugarcrmAccount'][_0xdaa8('0x10f')](db[_0xdaa8('0xa5')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xa5')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa5')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1bc'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xa5')][_0xdaa8('0x10f')](db['SugarcrmField'],{'as':_0xdaa8('0x1b6'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa5')][_0xdaa8('0x11e')](db[_0xdaa8('0x1c3')],{'as':'Account','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xa7')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xa7')]['hasMany'](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xa7')][_0xdaa8('0x10f')](db[_0xdaa8('0xa7')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xa7')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xa9')][_0xdaa8('0x10f')](db[_0xdaa8('0xab')],{'as':_0xdaa8('0x1b8'),'onDelete':'cascade','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xab')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c4')],{'as':_0xdaa8('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xdaa8('0xab')][_0xdaa8('0x10f')](db['DeskField'],{'as':'Descriptions','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xab')][_0xdaa8('0x10f')](db['DeskField'],{'as':'Fields','onDelete':_0xdaa8('0x10d'),'foreignKey':'FieldId'});db[_0xdaa8('0xab')][_0xdaa8('0x11e')](db[_0xdaa8('0xa9')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db['DeskConfiguration'][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x1c5')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0x1c4')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c4')],{'as':'Description','foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0x1c4')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c4')],{'as':_0xdaa8('0x1c0'),'foreignKey':'FieldId'});db[_0xdaa8('0x1c4')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xae')][_0xdaa8('0x10f')](db[_0xdaa8('0xb0')],{'as':'Configurations','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xb0')][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xdaa8('0xb0')]['hasMany'](db[_0xdaa8('0xb2')],{'as':'Descriptions','onDelete':_0xdaa8('0x10d'),'foreignKey':'DescriptionId'});db[_0xdaa8('0xb0')][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xb0')]['belongsTo'](db[_0xdaa8('0xae')],{'as':'Account','foreignKey':'AccountId'});db['ZohoField'][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db['ZohoField']['hasMany'](db[_0xdaa8('0xb2')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db['ZohoField'][_0xdaa8('0x10f')](db[_0xdaa8('0xb2')],{'as':'Field','foreignKey':'FieldId'});db['ZohoField'][_0xdaa8('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xb4')][_0xdaa8('0x10f')](db[_0xdaa8('0xb6')],{'as':'Configurations','onDelete':_0xdaa8('0x10d'),'foreignKey':'AccountId'});db[_0xdaa8('0xb6')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1ba'),'foreignKey':'SubjectId'});db[_0xdaa8('0xb6')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db['ZendeskConfiguration'][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':'Fields','foreignKey':'FieldId'});db[_0xdaa8('0xb6')][_0xdaa8('0x11e')](db[_0xdaa8('0xb4')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xb6')]['belongsToMany'](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x1c7')});db['ZendeskField'][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db['ZendeskField'][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1bf'),'foreignKey':'DescriptionId'});db[_0xdaa8('0x1c6')][_0xdaa8('0x10f')](db[_0xdaa8('0x1c6')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0x1c6')][_0xdaa8('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xb8')][_0xdaa8('0x10f')](db[_0xdaa8('0xba')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xba')][_0xdaa8('0x10f')](db[_0xdaa8('0xbc')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xba')][_0xdaa8('0x10f')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xba')][_0xdaa8('0x10f')](db['FreshdeskField'],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1bd')});db['FreshdeskConfiguration'][_0xdaa8('0x11e')](db[_0xdaa8('0xb8')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xba')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xdaa8('0xbc')][_0xdaa8('0x10f')](db[_0xdaa8('0xbc')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db['FreshdeskField'][_0xdaa8('0x10f')](db['FreshdeskField'],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xbc')]['hasMany'](db['FreshdeskField'],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xbc')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xbe')][_0xdaa8('0x10f')](db[_0xdaa8('0xbf')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xbf')][_0xdaa8('0x10f')](db['VtigerField'],{'as':_0xdaa8('0x1ba'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xbf')]['hasMany'](db['VtigerField'],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xbf')][_0xdaa8('0x10f')](db[_0xdaa8('0xc1')],{'as':_0xdaa8('0x1b6'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xbf')][_0xdaa8('0x11e')](db[_0xdaa8('0xbe')],{'as':'Account','foreignKey':_0xdaa8('0x1b9')});db['VtigerField'][_0xdaa8('0x10f')](db['VtigerField'],{'as':_0xdaa8('0x1be'),'foreignKey':'SubjectId'});db[_0xdaa8('0xc1')][_0xdaa8('0x10f')](db['VtigerField'],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc1')][_0xdaa8('0x10f')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db['Variable'],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xc3')][_0xdaa8('0x10f')](db[_0xdaa8('0xc5')],{'as':'Configurations','onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xc5')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':'Subjects','foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xc5')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc5')][_0xdaa8('0x10f')](db['ServicenowField'],{'as':_0xdaa8('0x1b6'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xc5')][_0xdaa8('0x11e')](db[_0xdaa8('0xc3')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xc7')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xc7')]['hasMany'](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc7')][_0xdaa8('0x10f')](db[_0xdaa8('0xc7')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xc7')][_0xdaa8('0x11e')](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db['Dynamics365Account'][_0xdaa8('0x10f')](db['Dynamics365Configuration'],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db['Dynamics365Configuration'][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1ba'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'SubjectId'});db[_0xdaa8('0xc9')][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1bc'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xc9')][_0xdaa8('0x10f')](db['Dynamics365Field'],{'as':_0xdaa8('0x1b6'),'onDelete':_0xdaa8('0x10d'),'foreignKey':'FieldId'});db[_0xdaa8('0xc9')][_0xdaa8('0x11e')](db[_0xdaa8('0xc8')],{'as':'Account','foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xcb')][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1be'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xcb')][_0xdaa8('0x10f')](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1bf'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db[_0xdaa8('0xcb')],{'as':_0xdaa8('0x1c0'),'foreignKey':'FieldId'});db[_0xdaa8('0xcb')]['belongsTo'](db[_0xdaa8('0x91')],{'as':_0xdaa8('0x91'),'foreignKey':'VariableId'});db[_0xdaa8('0x1c8')][_0xdaa8('0x10f')](db[_0xdaa8('0xce')],{'as':_0xdaa8('0x1b8'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1b9')});db['FreshsalesConfiguration'][_0xdaa8('0x10f')](db['FreshsalesField'],{'as':_0xdaa8('0x1ba'),'foreignKey':_0xdaa8('0x1bb')});db[_0xdaa8('0xce')][_0xdaa8('0x10f')](db['FreshsalesField'],{'as':_0xdaa8('0x1bc'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xce')]['hasMany'](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1b6'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xce')][_0xdaa8('0x11e')](db[_0xdaa8('0x1c8')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1b9')});db[_0xdaa8('0xd0')][_0xdaa8('0x10f')](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1be'),'foreignKey':'SubjectId'});db[_0xdaa8('0xd0')]['hasMany'](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1bf'),'foreignKey':_0xdaa8('0x1c2')});db[_0xdaa8('0xd0')][_0xdaa8('0x10f')](db[_0xdaa8('0xd0')],{'as':_0xdaa8('0x1c0'),'foreignKey':_0xdaa8('0x1bd')});db[_0xdaa8('0xd0')][_0xdaa8('0x11e')](db['Variable'],{'as':_0xdaa8('0x91'),'foreignKey':_0xdaa8('0x1c1')});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':'ContactId'});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x65')],{});db[_0xdaa8('0xd3')]['belongsTo'](db[_0xdaa8('0x67')],{});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db['User'],{});db[_0xdaa8('0xd3')][_0xdaa8('0x11e')](db[_0xdaa8('0x69')],{});db[_0xdaa8('0xd5')]['belongsTo'](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1c9')});db[_0xdaa8('0xd5')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1ca')});db[_0xdaa8('0x150')][_0xdaa8('0x10f')](db[_0xdaa8('0xd9')],{'foreignKey':_0xdaa8('0x1cb'),'onDelete':'cascade'});db['JscriptySessionReport'][_0xdaa8('0x10f')](db[_0xdaa8('0xd7')],{'foreignKey':'SessionId','onDelete':_0xdaa8('0x10d')});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db['SmsAccount'],{});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':'Contact','foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0x55')],{});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db[_0xdaa8('0x57')],{});db[_0xdaa8('0x1cc')]['belongsTo'](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x1cc')][_0xdaa8('0x11e')](db['SmsQueue'],{});db[_0xdaa8('0xe0')]['hasMany'](db[_0xdaa8('0x150')],{'foreignKey':'ProjectId'});db[_0xdaa8('0xe0')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xdaa8('0x1cd')});db[_0xdaa8('0xe0')][_0xdaa8('0x10f')](db[_0xdaa8('0xd7')],{'foreignKey':_0xdaa8('0x1cd')});db[_0xdaa8('0xe3')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x145')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':'user_has_teams'});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x14b')],{'through':_0xdaa8('0x158'),'as':'VoiceQueues'});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x130')],{'through':'team_has_mail_queues','as':_0xdaa8('0x1ce')});db[_0xdaa8('0xe8')]['belongsToMany'](db[_0xdaa8('0x69')],{'through':_0xdaa8('0x196'),'as':_0xdaa8('0x131')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x4d')],{'through':_0xdaa8('0x182'),'as':'FaxQueues'});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db[_0xdaa8('0x59')],{'through':_0xdaa8('0x186'),'as':_0xdaa8('0x133')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0xdaa8('0x134')});db[_0xdaa8('0xe8')][_0xdaa8('0x120')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0xdaa8('0x135')});db[_0xdaa8('0xeb')]['hasMany'](db[_0xdaa8('0x72')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':_0xdaa8('0x115'),'foreignKey':_0xdaa8('0x19e')});db[_0xdaa8('0xeb')][_0xdaa8('0x10f')](db[_0xdaa8('0x77')],{'as':_0xdaa8('0x199'),'foreignKey':_0xdaa8('0x19e')});db['Campaign'][_0xdaa8('0x10f')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xdaa8('0x19e')});db[_0xdaa8('0xeb')][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':_0xdaa8('0x2a'),'foreignKey':'TrunkId'});db['Campaign'][_0xdaa8('0x11e')](db[_0xdaa8('0x2a')],{'as':'TrunkBackup','foreignKey':_0xdaa8('0x1cf')});db[_0xdaa8('0xeb')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0xdaa8('0xeb')][_0xdaa8('0x11e')](db[_0xdaa8('0xe3')],{'as':_0xdaa8('0xe3'),'foreignKey':_0xdaa8('0x1d0')});db[_0xdaa8('0xeb')]['belongsToMany'](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x125'),'through':'campaigns_has_cm_lists'});db[_0xdaa8('0xeb')][_0xdaa8('0x120')](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x159'),'through':_0xdaa8('0x1d1')});db['MailTransferReport']['belongsTo'](db[_0xdaa8('0x40')],{});db['MailTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x3e')],{});db['MailTransferReport']['belongsTo'](db[_0xdaa8('0x3a')],{'foreignKey':_0xdaa8('0x1d2'),'as':'FromAccount'});db[_0xdaa8('0xf2')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':'FromUserId','as':_0xdaa8('0x1d3')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xdaa8('0xf2')]['belongsTo'](db[_0xdaa8('0x130')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xdaa8('0xf2')][_0xdaa8('0x11e')](db[_0xdaa8('0x3a')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db[_0xdaa8('0x67')],{});db['ChatTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x65')],{});db['ChatTransferReport']['belongsTo'](db[_0xdaa8('0x18d')],{'foreignKey':_0xdaa8('0x1d4'),'as':_0xdaa8('0x1d5')});db['ChatTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':'FromAgent'});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db['ChatQueue'],{'foreignKey':_0xdaa8('0x1d7'),'as':_0xdaa8('0x1d8')});db[_0xdaa8('0xf4')][_0xdaa8('0x11e')](db[_0xdaa8('0x18d')],{'foreignKey':'ToChatWebsiteId','as':_0xdaa8('0x1d9')});db['FaxTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x4b')],{});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x118')],{});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'foreignKey':'FromFaxAccountId','as':_0xdaa8('0x1d5')});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':'FromAgent'});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db[_0xdaa8('0x1da')][_0xdaa8('0x11e')](db[_0xdaa8('0x4d')],{'foreignKey':_0xdaa8('0x1dd'),'as':'ToQueue'});db['FaxTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x47')],{'foreignKey':_0xdaa8('0x1de'),'as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0xdaa8('0x5f')],{});db[_0xdaa8('0xf6')]['belongsTo'](db[_0xdaa8('0x5e')],{});db['OpenchannelTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0x5b')],{'foreignKey':'FromOpenchannelAccountId','as':_0xdaa8('0x1d5')});db[_0xdaa8('0xf6')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':_0xdaa8('0x1d3')});db[_0xdaa8('0xf6')][_0xdaa8('0x11e')](db['User'],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db[_0xdaa8('0xf6')][_0xdaa8('0x11e')](db[_0xdaa8('0x60')],{'foreignKey':_0xdaa8('0x1df'),'as':_0xdaa8('0x1d8')});db['OpenchannelTransferReport']['belongsTo'](db[_0xdaa8('0x5b')],{'foreignKey':_0xdaa8('0x1e0'),'as':_0xdaa8('0x1d9')});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db['SmsMessage'],{});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x55')],{});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'foreignKey':_0xdaa8('0x1e2'),'as':_0xdaa8('0x1d5')});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1d6'),'as':_0xdaa8('0x1d3')});db[_0xdaa8('0x1e1')]['belongsTo'](db[_0xdaa8('0x11')],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db[_0xdaa8('0x1e1')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0xdaa8('0x1e3'),'as':'ToQueue'});db[_0xdaa8('0x1e1')][_0xdaa8('0x11e')](db[_0xdaa8('0x51')],{'foreignKey':_0xdaa8('0x1e4'),'as':_0xdaa8('0x1d9')});db[_0xdaa8('0xf7')]['hasMany'](db[_0xdaa8('0x7f')],{'as':'Dispositions','foreignKey':'ListId'});db[_0xdaa8('0xf7')][_0xdaa8('0x10f')](db[_0xdaa8('0x79')],{'as':'CustomFields','foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')][_0xdaa8('0x10f')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x123'),'onDelete':'cascade','foreignKey':_0xdaa8('0x168')});db['CmList'][_0xdaa8('0x10f')](db[_0xdaa8('0x75')],{'as':'HopperFinals','foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')]['hasMany'](db[_0xdaa8('0x77')],{'as':_0xdaa8('0x116'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')]['hasMany'](db['ReportAgentPreview'],{'as':_0xdaa8('0x78'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xf7')]['belongsToMany'](db[_0xdaa8('0x14b')],{'as':_0xdaa8('0x1e5'),'through':_0xdaa8('0x155')});db['CmList'][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':'Agents','through':_0xdaa8('0x126')});db[_0xdaa8('0x136')][_0xdaa8('0x10f')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0xdaa8('0x136')][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x138')});db['UserProfile'][_0xdaa8('0x10f')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'foreignKey':_0xdaa8('0x11f')});db['UserProfile'][_0xdaa8('0x10f')](db[_0xdaa8('0x1e6')],{'as':_0xdaa8('0x1e7'),'foreignKey':_0xdaa8('0x11f'),'onDelete':'cascade'});db['UserProfileSection'][_0xdaa8('0x10f')](db[_0xdaa8('0xfc')],{'as':_0xdaa8('0x1e8'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0xdaa8('0xff')][_0xdaa8('0x10f')](db[_0xdaa8('0x7f')],{'as':_0xdaa8('0x164'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0xff')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0xff')][_0xdaa8('0x10f')](db[_0xdaa8('0x1ea')],{'as':_0xdaa8('0x16c'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0xff')]['hasMany'](db[_0xdaa8('0x102')],{'as':_0xdaa8('0x167')});db[_0xdaa8('0xff')][_0xdaa8('0x10f')](db[_0xdaa8('0x100')],{'as':'Applications'});db[_0xdaa8('0xff')]['belongsTo'](db[_0xdaa8('0xf7')],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0xff')][_0xdaa8('0x11e')](db['Pause'],{'as':_0xdaa8('0x153'),'foreignKey':_0xdaa8('0x154')});db['WhatsappAccount'][_0xdaa8('0x120')](db['User'],{'as':_0xdaa8('0x16a'),'through':_0xdaa8('0x143')});db['WhatsappApplication']['belongsTo'](db[_0xdaa8('0x11')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x100')][_0xdaa8('0x11e')](db['WhatsappQueue'],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x100')]['belongsTo'](db[_0xdaa8('0xff')],{'onDelete':_0xdaa8('0x176')});db[_0xdaa8('0x100')][_0xdaa8('0x11e')](db['Interval'],{'onDelete':_0xdaa8('0x176'),'foreignKey':'IntervalId'});db['WhatsappApplication'][_0xdaa8('0x11e')](db[_0xdaa8('0x170')],{'onDelete':_0xdaa8('0x176'),'foreignKey':_0xdaa8('0x177')});db[_0xdaa8('0x102')]['hasMany'](db[_0xdaa8('0x1ea')],{'as':_0xdaa8('0x16c'),'onDelete':_0xdaa8('0x10d'),'foreignKey':_0xdaa8('0x1eb')});db['WhatsappInteraction'][_0xdaa8('0x11e')](db['WhatsappAccount'],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0x102')][_0xdaa8('0x11e')](db['CmContact'],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db['WhatsappInteraction'][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':'Owner','foreignKey':_0xdaa8('0x10e')});db[_0xdaa8('0x102')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':'whatsapp_interaction_has_tags','as':_0xdaa8('0x172')});db[_0xdaa8('0x102')][_0xdaa8('0x120')](db[_0xdaa8('0x170')],{'through':_0xdaa8('0x1af'),'as':_0xdaa8('0x180')});db[_0xdaa8('0x102')]['belongsToMany'](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x18a'),'through':_0xdaa8('0x12e'),'foreignKey':'WhatsappInteractionId'});db[_0xdaa8('0x1ea')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x11')});db[_0xdaa8('0x1ea')][_0xdaa8('0x11e')](db['CmContact'],{'onDelete':_0xdaa8('0x10d'),'as':_0xdaa8('0x16e')});db[_0xdaa8('0x1ea')][_0xdaa8('0x11e')](db[_0xdaa8('0x102')],{'onDelete':_0xdaa8('0x10d'),'as':'Interaction','foreignKey':_0xdaa8('0x1eb')});db[_0xdaa8('0x1ea')]['belongsTo'](db[_0xdaa8('0xff')],{'as':_0xdaa8('0x16d'),'foreignKey':_0xdaa8('0x1e9')});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0xff')],{});db[_0xdaa8('0x105')]['belongsTo'](db['CmList'],{'as':_0xdaa8('0x179'),'foreignKey':_0xdaa8('0x168')});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x70')],{'as':_0xdaa8('0x16e'),'foreignKey':_0xdaa8('0x160')});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db['WhatsappInteraction'],{});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x109')],{});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x1ea')],{});db[_0xdaa8('0x105')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x1ea')],{});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x102')],{});db['WhatsappTransferReport'][_0xdaa8('0x11e')](db[_0xdaa8('0xff')],{'foreignKey':'FromWhatsappAccountId','as':_0xdaa8('0x1d5')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0xdaa8('0x1d9')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x109')],{'foreignKey':_0xdaa8('0x1ec'),'as':_0xdaa8('0x1d8')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db[_0xdaa8('0x11')],{'foreignKey':'FromUserId','as':_0xdaa8('0x1d3')});db[_0xdaa8('0x107')][_0xdaa8('0x11e')](db['User'],{'foreignKey':_0xdaa8('0x1db'),'as':_0xdaa8('0x1dc')});db['WhatsappQueue'][_0xdaa8('0x120')](db[_0xdaa8('0x11')],{'as':_0xdaa8('0x16a'),'through':'UserWhatsappQueue','foreignKey':_0xdaa8('0x1ed')});db[_0xdaa8('0x109')]['belongsToMany'](db[_0xdaa8('0xe8')],{'through':_0xdaa8('0x1ee'),'as':_0xdaa8('0x157')});module[_0xdaa8('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 697dc31..098a692 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','lodash','express','express-winston','util','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','role','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','remoteAddress','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails'];(function(_0x5a5fb2,_0x4d4a48){var _0x1cda0c=function(_0x5761d5){while(--_0x5761d5){_0x5a5fb2['push'](_0x5a5fb2['shift']());}};_0x1cda0c(++_0x4d4a48);}(_0xb10b,0x12a));var _0xbb10=function(_0x4565eb,_0x167f79){_0x4565eb=_0x4565eb-0x0;var _0x67832=_0xb10b[_0x4565eb];return _0x67832;};'use strict';var _=require(_0xbb10('0x0'));var path=require('path');var express=require(_0xbb10('0x1'));var ewinston=require(_0xbb10('0x2'));var util=require(_0xbb10('0x3'));var errors=require('./errors');var config=require(_0xbb10('0x4'));var logger=require(_0xbb10('0x5'))(_0xbb10('0x6'));var authLogger=require(_0xbb10('0x5'))(_0xbb10('0x7'));exports[_0xbb10('0x8')]=function(_0x481979){_0x481979[_0xbb10('0x9')](ewinston[_0xbb10('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x513741,_0x1b9e94){var _0x3fb675=_0xbb10('0xb');if(!_[_0xbb10('0xc')](_0x513741[_0xbb10('0xd')])){_0x3fb675+=_0xbb10('0xe');var _0x229887=_0x513741[_0xbb10('0xd')];maskSensitiveData(_0x229887);}return util['format'](_0x3fb675,_0x513741['method'],_0x513741[_0xbb10('0xf')][_0xbb10('0x10')]?_0x513741[_0xbb10('0xf')]['x-forwarded-for']:_0x513741[_0xbb10('0x11')]['remoteAddress']||_0x513741['ip'],_0x513741[_0xbb10('0x12')],_0x1b9e94[_0xbb10('0x13')],_0x1b9e94[_0xbb10('0x14')],_0x513741[_0xbb10('0x15')]?_0x513741[_0xbb10('0x15')]['id']:null,_0x513741[_0xbb10('0x15')]?_0x513741['user'][_0xbb10('0x16')]:null,_0x513741[_0xbb10('0x15')]?_0x513741[_0xbb10('0x15')][_0xbb10('0x17')]:null,_0x229887?util[_0xbb10('0x18')](_0x229887,![],null):'');}}));_0x481979[_0xbb10('0x9')](ewinston[_0xbb10('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x36b5e8,_0x3e26f4){var _0x2b184e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x36b5e8[_0xbb10('0xd')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x19')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x1a')]){_0x2b184e=_0xbb10('0x1b');}return util[_0xbb10('0x1c')](_0x2b184e,_0x36b5e8[_0xbb10('0x1d')],_0x36b5e8[_0xbb10('0xf')][_0xbb10('0x10')]?_0x36b5e8['headers'][_0xbb10('0x10')]:_0x36b5e8[_0xbb10('0x11')][_0xbb10('0x1e')]||_0x36b5e8['ip'],_0x36b5e8[_0xbb10('0x12')],_0x3e26f4[_0xbb10('0x13')],_0x3e26f4[_0xbb10('0x14')],_0x36b5e8['user']?_0x36b5e8[_0xbb10('0x15')]['id']:null,_0x36b5e8[_0xbb10('0x15')]?_0x36b5e8['user']['name']:null,_0x36b5e8[_0xbb10('0x15')]?_0x36b5e8[_0xbb10('0x15')][_0xbb10('0x17')]:null,_0x36b5e8[_0xbb10('0xd')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x19')]?_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x19')]:_0xbb10('0x1f'),_0x36b5e8[_0xbb10('0xd')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x1a')]?_0x36b5e8['body']['agent_id']:'',_0x36b5e8['body']&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x20')]?_0x36b5e8[_0xbb10('0xd')]['agent_name']:'');},'ignoreRoute':function(_0x2fdde9){var _0x24d586=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x24d586[_0xbb10('0x21')](_0x2fdde9[_0xbb10('0x12')]);}}));_0x481979[_0xbb10('0x9')](_0xbb10('0x22'),require(_0xbb10('0x23')));_0x481979['use'](_0xbb10('0x24'),require(_0xbb10('0x25')));_0x481979[_0xbb10('0x9')](_0xbb10('0x26'),require(_0xbb10('0x27')));_0x481979[_0xbb10('0x9')]('/api/voice/extensions',require(_0xbb10('0x28')));_0x481979['use'](_0xbb10('0x29'),require('./api/voiceMusicOnHold'));_0x481979[_0xbb10('0x9')](_0xbb10('0x2a'),require(_0xbb10('0x2b')));_0x481979['use']('/api/voice/recordings',require(_0xbb10('0x2c')));_0x481979[_0xbb10('0x9')]('/api/screen/recordings',require(_0xbb10('0x2d')));_0x481979[_0xbb10('0x9')](_0xbb10('0x2e'),require(_0xbb10('0x2f')));_0x481979[_0xbb10('0x9')](_0xbb10('0x30'),require(_0xbb10('0x31')));_0x481979['use'](_0xbb10('0x32'),require(_0xbb10('0x33')));_0x481979[_0xbb10('0x9')](_0xbb10('0x34'),require(_0xbb10('0x35')));_0x481979[_0xbb10('0x9')](_0xbb10('0x36'),require(_0xbb10('0x37')));_0x481979[_0xbb10('0x9')]('/api/voice/queues/reports',require(_0xbb10('0x38')));_0x481979[_0xbb10('0x9')](_0xbb10('0x39'),require(_0xbb10('0x3a')));_0x481979['use'](_0xbb10('0x3b'),require('./api/trunk'));_0x481979['use'](_0xbb10('0x3c'),require(_0xbb10('0x3d')));_0x481979[_0xbb10('0x9')](_0xbb10('0x3e'),require(_0xbb10('0x3f')));_0x481979[_0xbb10('0x9')]('/api/mail/accounts',require(_0xbb10('0x40')));_0x481979[_0xbb10('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x481979['use'](_0xbb10('0x41'),require(_0xbb10('0x42')));_0x481979[_0xbb10('0x9')]('/api/mail/interactions',require(_0xbb10('0x43')));_0x481979[_0xbb10('0x9')](_0xbb10('0x44'),require('./api/mailMessage'));_0x481979[_0xbb10('0x9')](_0xbb10('0x45'),require(_0xbb10('0x46')));_0x481979[_0xbb10('0x9')]('/api/mail/reports/queue',require(_0xbb10('0x47')));_0x481979[_0xbb10('0x9')]('/api/dashboards',require(_0xbb10('0x48')));_0x481979[_0xbb10('0x9')](_0xbb10('0x49'),require(_0xbb10('0x4a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x4b'),require('./api/faxAccount'));_0x481979[_0xbb10('0x9')](_0xbb10('0x4c'),require(_0xbb10('0x4d')));_0x481979[_0xbb10('0x9')]('/api/fax/interactions',require(_0xbb10('0x4e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x4f'),require(_0xbb10('0x50')));_0x481979['use'](_0xbb10('0x51'),require(_0xbb10('0x52')));_0x481979['use']('/api/fax/reports/queue',require(_0xbb10('0x53')));_0x481979['use'](_0xbb10('0x54'),require(_0xbb10('0x55')));_0x481979['use'](_0xbb10('0x56'),require(_0xbb10('0x57')));_0x481979[_0xbb10('0x9')]('/api/sms/interactions',require(_0xbb10('0x58')));_0x481979[_0xbb10('0x9')](_0xbb10('0x59'),require(_0xbb10('0x5a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x5b'),require(_0xbb10('0x5c')));_0x481979[_0xbb10('0x9')](_0xbb10('0x5d'),require(_0xbb10('0x5e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x5f'),require('./api/openchannelApplication'));_0x481979[_0xbb10('0x9')](_0xbb10('0x60'),require('./api/openchannelInteraction'));_0x481979[_0xbb10('0x9')](_0xbb10('0x61'),require(_0xbb10('0x62')));_0x481979[_0xbb10('0x9')](_0xbb10('0x63'),require(_0xbb10('0x64')));_0x481979[_0xbb10('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x481979[_0xbb10('0x9')](_0xbb10('0x65'),require(_0xbb10('0x66')));_0x481979['use']('/api/chat/applications',require(_0xbb10('0x67')));_0x481979[_0xbb10('0x9')](_0xbb10('0x68'),require(_0xbb10('0x69')));_0x481979[_0xbb10('0x9')](_0xbb10('0x6a'),require(_0xbb10('0x6b')));_0x481979[_0xbb10('0x9')](_0xbb10('0x6c'),require(_0xbb10('0x6d')));_0x481979['use']('/api/chat/queues',require(_0xbb10('0x6e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x6f'),require(_0xbb10('0x70')));_0x481979[_0xbb10('0x9')](_0xbb10('0x71'),require(_0xbb10('0x72')));_0x481979[_0xbb10('0x9')](_0xbb10('0x73'),require(_0xbb10('0x74')));_0x481979[_0xbb10('0x9')](_0xbb10('0x75'),require(_0xbb10('0x76')));_0x481979[_0xbb10('0x9')](_0xbb10('0x77'),require('./api/cmHopper'));_0x481979[_0xbb10('0x9')]('/api/cm/hopper_black',require(_0xbb10('0x78')));_0x481979[_0xbb10('0x9')](_0xbb10('0x79'),require(_0xbb10('0x7a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x7b'),require(_0xbb10('0x7c')));_0x481979[_0xbb10('0x9')](_0xbb10('0x7d'),require(_0xbb10('0x7e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x7f'),require(_0xbb10('0x80')));_0x481979[_0xbb10('0x9')](_0xbb10('0x81'),require('./api/automation'));_0x481979[_0xbb10('0x9')](_0xbb10('0x82'),require(_0xbb10('0x83')));_0x481979[_0xbb10('0x9')](_0xbb10('0x84'),require(_0xbb10('0x85')));_0x481979['use'](_0xbb10('0x86'),require(_0xbb10('0x87')));_0x481979[_0xbb10('0x9')](_0xbb10('0x88'),require(_0xbb10('0x89')));_0x481979[_0xbb10('0x9')](_0xbb10('0x8a'),require(_0xbb10('0x8b')));_0x481979[_0xbb10('0x9')](_0xbb10('0x8c'),require(_0xbb10('0x8d')));_0x481979[_0xbb10('0x9')](_0xbb10('0x8e'),require('./api/voiceQueuesLog'));_0x481979['use'](_0xbb10('0x8f'),require(_0xbb10('0x90')));_0x481979[_0xbb10('0x9')](_0xbb10('0x91'),require('./api/sound'));_0x481979['use'](_0xbb10('0x92'),require(_0xbb10('0x93')));_0x481979[_0xbb10('0x9')](_0xbb10('0x94'),require(_0xbb10('0x95')));_0x481979[_0xbb10('0x9')](_0xbb10('0x96'),require('./api/trigger'));_0x481979[_0xbb10('0x9')](_0xbb10('0x97'),require('./api/variable'));_0x481979['use']('/api/integrations',require(_0xbb10('0x98')));_0x481979[_0xbb10('0x9')](_0xbb10('0x99'),require('./api/integrationReport'));_0x481979['use']('/api/analytics/custom_reports',require(_0xbb10('0x9a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x9b'),require('./api/analyticDefaultReport'));_0x481979[_0xbb10('0x9')](_0xbb10('0x9c'),require('./api/analyticExtractedReport'));_0x481979['use'](_0xbb10('0x9d'),require(_0xbb10('0x9e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x9f'),require('./api/analyticFieldReport'));_0x481979[_0xbb10('0x9')](_0xbb10('0xa0'),require(_0xbb10('0xa1')));_0x481979['use'](_0xbb10('0xa2'),require(_0xbb10('0xa3')));_0x481979[_0xbb10('0x9')]('/api/integrations/salesforce/configurations',require(_0xbb10('0xa4')));_0x481979[_0xbb10('0x9')](_0xbb10('0xa5'),require(_0xbb10('0xa6')));_0x481979['use'](_0xbb10('0xa7'),require(_0xbb10('0xa8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xa9'),require('./api/intSugarcrmConfiguration'));_0x481979[_0xbb10('0x9')](_0xbb10('0xaa'),require(_0xbb10('0xab')));_0x481979[_0xbb10('0x9')](_0xbb10('0xac'),require(_0xbb10('0xad')));_0x481979[_0xbb10('0x9')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x481979['use'](_0xbb10('0xae'),require(_0xbb10('0xaf')));_0x481979[_0xbb10('0x9')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x481979[_0xbb10('0x9')](_0xbb10('0xb0'),require(_0xbb10('0xb1')));_0x481979[_0xbb10('0x9')](_0xbb10('0xb2'),require(_0xbb10('0xb3')));_0x481979['use'](_0xbb10('0xb4'),require(_0xbb10('0xb5')));_0x481979[_0xbb10('0x9')](_0xbb10('0xb6'),require(_0xbb10('0xb7')));_0x481979['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x481979[_0xbb10('0x9')](_0xbb10('0xb8'),require(_0xbb10('0xb9')));_0x481979[_0xbb10('0x9')](_0xbb10('0xba'),require(_0xbb10('0xbb')));_0x481979['use'](_0xbb10('0xbc'),require('./api/intFreshdeskField'));_0x481979['use']('/api/integrations/vtiger/accounts',require(_0xbb10('0xbd')));_0x481979[_0xbb10('0x9')](_0xbb10('0xbe'),require(_0xbb10('0xbf')));_0x481979['use'](_0xbb10('0xc0'),require('./api/intVtigerField'));_0x481979['use'](_0xbb10('0xc1'),require(_0xbb10('0xc2')));_0x481979[_0xbb10('0x9')](_0xbb10('0xc3'),require(_0xbb10('0xc4')));_0x481979['use'](_0xbb10('0xc5'),require(_0xbb10('0xc6')));_0x481979[_0xbb10('0x9')](_0xbb10('0xc7'),require(_0xbb10('0xc8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xc9'),require('./api/intDynamics365Configuration'));_0x481979[_0xbb10('0x9')](_0xbb10('0xca'),require(_0xbb10('0xcb')));_0x481979[_0xbb10('0x9')](_0xbb10('0xcc'),require(_0xbb10('0xcd')));_0x481979[_0xbb10('0x9')](_0xbb10('0xce'),require('./api/intFreshsalesConfiguration'));_0x481979[_0xbb10('0x9')](_0xbb10('0xcf'),require(_0xbb10('0xd0')));_0x481979['use']('/api/networks',require('./api/network'));_0x481979[_0xbb10('0x9')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x481979[_0xbb10('0x9')](_0xbb10('0xd1'),require(_0xbb10('0xd2')));_0x481979[_0xbb10('0x9')](_0xbb10('0xd3'),require(_0xbb10('0xd4')));_0x481979[_0xbb10('0x9')](_0xbb10('0xd5'),require(_0xbb10('0xd6')));_0x481979['use'](_0xbb10('0xd7'),require(_0xbb10('0xd8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xd9'),require('./api/smsQueueReport'));_0x481979['use'](_0xbb10('0xda'),require(_0xbb10('0xdb')));_0x481979[_0xbb10('0x9')](_0xbb10('0xdc'),require('./api/squareReportDetail'));_0x481979[_0xbb10('0x9')](_0xbb10('0xdd'),require(_0xbb10('0xde')));_0x481979[_0xbb10('0x9')](_0xbb10('0xdf'),require('./api/setting'));_0x481979['use'](_0xbb10('0xe0'),require(_0xbb10('0xe1')));_0x481979[_0xbb10('0x9')]('/api/square/projects',require(_0xbb10('0xe2')));_0x481979[_0xbb10('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x481979[_0xbb10('0x9')](_0xbb10('0xe3'),require(_0xbb10('0xe4')));_0x481979['use'](_0xbb10('0xe5'),require(_0xbb10('0xe6')));_0x481979[_0xbb10('0x9')](_0xbb10('0xe7'),require(_0xbb10('0xe8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xe9'),require(_0xbb10('0xea')));_0x481979[_0xbb10('0x9')]('/api/migrations',require(_0xbb10('0xeb')));_0x481979[_0xbb10('0x9')](_0xbb10('0xec'),require(_0xbb10('0xed')));_0x481979[_0xbb10('0x9')](_0xbb10('0xee'),require(_0xbb10('0xef')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf0'),require(_0xbb10('0xf1')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf2'),require('./api/chatTransferReport'));_0x481979['use'](_0xbb10('0xf3'),require(_0xbb10('0xf4')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf5'),require(_0xbb10('0xf6')));_0x481979['use'](_0xbb10('0xf7'),require(_0xbb10('0xf8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf9'),require(_0xbb10('0xfa')));_0x481979[_0xbb10('0x9')]('/api/voice/prefixes',require(_0xbb10('0xfb')));_0x481979[_0xbb10('0x9')]('/api/userProfiles',require(_0xbb10('0xfc')));_0x481979['use'](_0xbb10('0xfd'),require(_0xbb10('0xfe')));_0x481979[_0xbb10('0x9')](_0xbb10('0xff'),require(_0xbb10('0x100')));_0x481979['use'](_0xbb10('0x101'),require('./api/notification'));_0x481979[_0xbb10('0x9')](_0xbb10('0x102'),require('./api/whatsappAccount'));_0x481979['use'](_0xbb10('0x103'),require(_0xbb10('0x104')));_0x481979[_0xbb10('0x9')](_0xbb10('0x105'),require(_0xbb10('0x106')));_0x481979[_0xbb10('0x9')](_0xbb10('0x107'),require(_0xbb10('0x108')));_0x481979[_0xbb10('0x9')](_0xbb10('0x109'),require(_0xbb10('0x10a')));_0x481979['use'](_0xbb10('0x10b'),require(_0xbb10('0x10c')));_0x481979[_0xbb10('0x9')](_0xbb10('0x10d'),require(_0xbb10('0x10e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x10f'),require(_0xbb10('0x110')));_0x481979[_0xbb10('0x9')](_0xbb10('0x111'),require(_0xbb10('0x112')));_0x481979[_0xbb10('0x9')]('/api/auth/google',require(_0xbb10('0x113')));_0x481979['use'](_0xbb10('0x114'),require(_0xbb10('0x115')));_0x481979[_0xbb10('0x9')](_0xbb10('0x116'),require(_0xbb10('0x117')));_0x481979['use'](_0xbb10('0x118'),require(_0xbb10('0x119')));_0x481979[_0xbb10('0x9')](_0xbb10('0x11a'),require(_0xbb10('0x11b')));_0x481979[_0xbb10('0x9')]('/api/pm2',require('./api/pm2'));_0x481979[_0xbb10('0x9')](_0xbb10('0x11c'),require(_0xbb10('0x11d')));_0x481979['use'](_0xbb10('0x11e'),express[_0xbb10('0x11f')](path['join'](config[_0xbb10('0x120')],_0xbb10('0x11e'))));_0x481979['use'](_0xbb10('0x121'),express['static'](path[_0xbb10('0x122')](config[_0xbb10('0x120')],'/www')));_0x481979[_0xbb10('0x9')](_0xbb10('0x123'),express['static'](path['join'](config[_0xbb10('0x120')],_0xbb10('0x123'))));_0x481979[_0xbb10('0x9')](_0xbb10('0x124'),express[_0xbb10('0x11f')](path['join'](config[_0xbb10('0x120')],_0xbb10('0x125'),_0xbb10('0x126'))));_0x481979['use'](_0xbb10('0x127'),express[_0xbb10('0x11f')](path[_0xbb10('0x122')](config[_0xbb10('0x120')],_0xbb10('0x128'))));_0x481979[_0xbb10('0x129')](_0xbb10('0x12a'))[_0xbb10('0x12b')](errors[0x194]);_0x481979[_0xbb10('0x129')]('/*')['get'](function(_0x4fc544,_0x37e40c){_0x37e40c[_0xbb10('0x12c')](path[_0xbb10('0x12d')](_0x481979[_0xbb10('0x12b')](_0xbb10('0x12e'))+_0xbb10('0x12f')));});};var sensitiveFields=[_0xbb10('0x130'),_0xbb10('0x131'),_0xbb10('0x132'),_0xbb10('0x133'),_0xbb10('0x134'),_0xbb10('0x135'),_0xbb10('0x136'),'phone',_0xbb10('0x137'),_0xbb10('0x138'),_0xbb10('0x139'),_0xbb10('0x13a'),_0xbb10('0x13b'),_0xbb10('0x13c'),_0xbb10('0x13d'),_0xbb10('0x13e'),_0xbb10('0x13f'),_0xbb10('0x140'),_0xbb10('0x141'),'accessToken',_0xbb10('0x142'),'authToken',_0xbb10('0x143'),_0xbb10('0x144'),_0xbb10('0x145'),_0xbb10('0x146'),_0xbb10('0x147'),_0xbb10('0x148'),'vidaooApiKey',_0xbb10('0x149'),'privateKey',_0xbb10('0x14a'),_0xbb10('0x14b'),_0xbb10('0x14c'),_0xbb10('0x15'),_0xbb10('0x14d'),_0xbb10('0x14e'),_0xbb10('0x14f'),_0xbb10('0x150'),_0xbb10('0x151'),_0xbb10('0x152'),_0xbb10('0x153')];function maskSensitiveData(_0xa09041){var _0x589565=/(?!^)[\s\S](?!$)/g;for(var _0x3696b3 in _0xa09041){if(_['isArray'](_0xa09041[_0x3696b3])){for(var _0xe70161=0x0;_0xe70161<_0xa09041[_0x3696b3][_0xbb10('0x154')];_0xe70161++){maskSensitiveData(_0xa09041[_0x3696b3][_0xe70161]);}}else if(_[_0xbb10('0x155')](_0xa09041[_0x3696b3])){maskSensitiveData(_0xa09041[_0x3696b3]);}else if(_[_0xbb10('0x156')](_0xa09041[_0x3696b3])){_0xa09041[_0x3696b3]=_0xa09041[_0x3696b3][_0xbb10('0x157')](/{{{/g,_0xbb10('0x158'))[_0xbb10('0x157')](/}}}/g,'}@@')[_0xbb10('0x157')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x3696b3)){_0xa09041[_0x3696b3]=_0xa09041[_0x3696b3][_0xbb10('0x157')](_0x589565,'*');}}}} \ No newline at end of file +var _0x757a=['/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','length','isPlainObject','isString','replace','path','express','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','responseTime','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','remoteAddress','statusCode','name','agent_id','agent_name','url','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x2ed078,_0x15ac92){var _0x5b35e5=function(_0x16994b){while(--_0x16994b){_0x2ed078['push'](_0x2ed078['shift']());}};_0x5b35e5(++_0x15ac92);}(_0x757a,0xde));var _0xa757=function(_0x3c1c22,_0x58e925){_0x3c1c22=_0x3c1c22-0x0;var _0x1425cd=_0x757a[_0x3c1c22];return _0x1425cd;};'use strict';var _=require('lodash');var path=require(_0xa757('0x0'));var express=require(_0xa757('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xa757('0x2'));var logger=require(_0xa757('0x3'))(_0xa757('0x4'));var authLogger=require(_0xa757('0x3'))(_0xa757('0x5'));exports[_0xa757('0x6')]=function(_0x5edca8){_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x53be0e,_0x2930fa){var _0x2f7793=_0xa757('0x9');if(!_[_0xa757('0xa')](_0x53be0e[_0xa757('0xb')])){_0x2f7793+='\x20body=%s';var _0x89c630=_0x53be0e[_0xa757('0xb')];maskSensitiveData(_0x89c630);}return util[_0xa757('0xc')](_0x2f7793,_0x53be0e[_0xa757('0xd')],_0x53be0e[_0xa757('0xe')][_0xa757('0xf')]?_0x53be0e[_0xa757('0xe')]['x-forwarded-for']:_0x53be0e['connection']['remoteAddress']||_0x53be0e['ip'],_0x53be0e['url'],_0x2930fa['statusCode'],_0x2930fa[_0xa757('0x10')],_0x53be0e['user']?_0x53be0e['user']['id']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e['user']['name']:null,_0x53be0e[_0xa757('0x11')]?_0x53be0e[_0xa757('0x11')][_0xa757('0x12')]:null,_0x89c630?util[_0xa757('0x13')](_0x89c630,![],null):'');}}));_0x5edca8[_0xa757('0x7')](ewinston[_0xa757('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xf12b68,_0x2f7947){var _0x185011=_0xa757('0x14');if(_0xf12b68['body']&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]&&_0xf12b68[_0xa757('0xb')]['agent_id']){_0x185011='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa757('0xc')](_0x185011,_0xf12b68[_0xa757('0xd')],_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]?_0xf12b68[_0xa757('0xe')][_0xa757('0xf')]:_0xf12b68['connection'][_0xa757('0x16')]||_0xf12b68['ip'],_0xf12b68['url'],_0x2f7947[_0xa757('0x17')],_0x2f7947[_0xa757('0x10')],_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')]['id']:null,_0xf12b68['user']?_0xf12b68['user'][_0xa757('0x18')]:null,_0xf12b68[_0xa757('0x11')]?_0xf12b68[_0xa757('0x11')][_0xa757('0x12')]:null,_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]?_0xf12b68[_0xa757('0xb')][_0xa757('0x15')]:'other',_0xf12b68[_0xa757('0xb')]&&_0xf12b68['body'][_0xa757('0x19')]?_0xf12b68['body'][_0xa757('0x19')]:'',_0xf12b68[_0xa757('0xb')]&&_0xf12b68[_0xa757('0xb')]['agent_name']?_0xf12b68[_0xa757('0xb')][_0xa757('0x1a')]:'');},'ignoreRoute':function(_0x471e84){var _0x3bf7f3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3bf7f3['test'](_0x471e84[_0xa757('0x1b')]);}}));_0x5edca8['use']('/api/users',require('./api/user'));_0x5edca8['use'](_0xa757('0x1c'),require('./api/voiceChanSpy'));_0x5edca8[_0xa757('0x7')](_0xa757('0x1d'),require('./api/voiceContext'));_0x5edca8[_0xa757('0x7')]('/api/voice/extensions',require(_0xa757('0x1e')));_0x5edca8[_0xa757('0x7')]('/api/voice/mohs',require(_0xa757('0x1f')));_0x5edca8['use'](_0xa757('0x20'),require(_0xa757('0x21')));_0x5edca8[_0xa757('0x7')](_0xa757('0x22'),require(_0xa757('0x23')));_0x5edca8[_0xa757('0x7')](_0xa757('0x24'),require(_0xa757('0x25')));_0x5edca8[_0xa757('0x7')](_0xa757('0x26'),require(_0xa757('0x27')));_0x5edca8[_0xa757('0x7')](_0xa757('0x28'),require(_0xa757('0x29')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2a'),require(_0xa757('0x2b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2c'),require(_0xa757('0x2d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x2e'),require(_0xa757('0x2f')));_0x5edca8[_0xa757('0x7')]('/api/voice/queues/reports',require(_0xa757('0x30')));_0x5edca8[_0xa757('0x7')](_0xa757('0x31'),require(_0xa757('0x32')));_0x5edca8[_0xa757('0x7')]('/api/trunks',require(_0xa757('0x33')));_0x5edca8[_0xa757('0x7')](_0xa757('0x34'),require(_0xa757('0x35')));_0x5edca8[_0xa757('0x7')](_0xa757('0x36'),require('./api/mailServerOut'));_0x5edca8[_0xa757('0x7')](_0xa757('0x37'),require(_0xa757('0x38')));_0x5edca8[_0xa757('0x7')](_0xa757('0x39'),require(_0xa757('0x3a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3b'),require(_0xa757('0x3c')));_0x5edca8['use'](_0xa757('0x3d'),require(_0xa757('0x3e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x3f'),require(_0xa757('0x40')));_0x5edca8[_0xa757('0x7')]('/api/mail/applications',require(_0xa757('0x41')));_0x5edca8[_0xa757('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x42'),require('./api/dashboard'));_0x5edca8['use'](_0xa757('0x43'),require(_0xa757('0x44')));_0x5edca8[_0xa757('0x7')]('/api/fax/accounts',require(_0xa757('0x45')));_0x5edca8[_0xa757('0x7')](_0xa757('0x46'),require(_0xa757('0x47')));_0x5edca8[_0xa757('0x7')]('/api/fax/interactions',require(_0xa757('0x48')));_0x5edca8['use']('/api/fax/messages',require(_0xa757('0x49')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4a'),require(_0xa757('0x4b')));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x4c'),require(_0xa757('0x4d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x4e'),require(_0xa757('0x4f')));_0x5edca8['use'](_0xa757('0x50'),require(_0xa757('0x51')));_0x5edca8['use'](_0xa757('0x52'),require('./api/smsMessage'));_0x5edca8[_0xa757('0x7')](_0xa757('0x53'),require('./api/smsQueue'));_0x5edca8[_0xa757('0x7')](_0xa757('0x54'),require('./api/openchannelAccount'));_0x5edca8[_0xa757('0x7')](_0xa757('0x55'),require(_0xa757('0x56')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/interactions',require(_0xa757('0x57')));_0x5edca8[_0xa757('0x7')](_0xa757('0x58'),require(_0xa757('0x59')));_0x5edca8['use'](_0xa757('0x5a'),require('./api/openchannelQueue'));_0x5edca8['use'](_0xa757('0x5b'),require(_0xa757('0x5c')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/queue',require(_0xa757('0x5d')));_0x5edca8['use'](_0xa757('0x5e'),require(_0xa757('0x5f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x60'),require(_0xa757('0x61')));_0x5edca8[_0xa757('0x7')](_0xa757('0x62'),require(_0xa757('0x63')));_0x5edca8['use'](_0xa757('0x64'),require(_0xa757('0x65')));_0x5edca8[_0xa757('0x7')](_0xa757('0x66'),require(_0xa757('0x67')));_0x5edca8[_0xa757('0x7')](_0xa757('0x68'),require(_0xa757('0x69')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6a'),require(_0xa757('0x6b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6c'),require(_0xa757('0x6d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x6e'),require('./api/cmContact'));_0x5edca8[_0xa757('0x7')]('/api/cm/hopper',require(_0xa757('0x6f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x70'),require(_0xa757('0x71')));_0x5edca8['use'](_0xa757('0x72'),require(_0xa757('0x73')));_0x5edca8[_0xa757('0x7')](_0xa757('0x74'),require('./api/cmHopperHistory'));_0x5edca8[_0xa757('0x7')](_0xa757('0x75'),require(_0xa757('0x76')));_0x5edca8[_0xa757('0x7')](_0xa757('0x77'),require(_0xa757('0x78')));_0x5edca8['use']('/api/automations',require('./api/automation'));_0x5edca8['use'](_0xa757('0x79'),require(_0xa757('0x7a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7b'),require(_0xa757('0x7c')));_0x5edca8[_0xa757('0x7')]('/api/conditions',require(_0xa757('0x7d')));_0x5edca8[_0xa757('0x7')](_0xa757('0x7e'),require(_0xa757('0x7f')));_0x5edca8['use'](_0xa757('0x80'),require(_0xa757('0x81')));_0x5edca8['use'](_0xa757('0x82'),require('./api/cdr'));_0x5edca8[_0xa757('0x7')]('/api/voiceQueuesLog',require(_0xa757('0x83')));_0x5edca8['use']('/api/schedules',require(_0xa757('0x84')));_0x5edca8[_0xa757('0x7')](_0xa757('0x85'),require(_0xa757('0x86')));_0x5edca8[_0xa757('0x7')](_0xa757('0x87'),require('./api/tag'));_0x5edca8['use'](_0xa757('0x88'),require(_0xa757('0x89')));_0x5edca8[_0xa757('0x7')]('/api/triggers',require('./api/trigger'));_0x5edca8[_0xa757('0x7')](_0xa757('0x8a'),require(_0xa757('0x8b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x8c'),require(_0xa757('0x8d')));_0x5edca8['use'](_0xa757('0x8e'),require(_0xa757('0x8f')));_0x5edca8[_0xa757('0x7')](_0xa757('0x90'),require(_0xa757('0x91')));_0x5edca8[_0xa757('0x7')](_0xa757('0x92'),require(_0xa757('0x93')));_0x5edca8[_0xa757('0x7')](_0xa757('0x94'),require('./api/analyticExtractedReport'));_0x5edca8[_0xa757('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5edca8[_0xa757('0x7')](_0xa757('0x95'),require(_0xa757('0x96')));_0x5edca8[_0xa757('0x7')](_0xa757('0x97'),require(_0xa757('0x98')));_0x5edca8[_0xa757('0x7')](_0xa757('0x99'),require(_0xa757('0x9a')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9b'),require('./api/intSalesforceConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9c'),require('./api/intSalesforceField'));_0x5edca8[_0xa757('0x7')](_0xa757('0x9d'),require(_0xa757('0x9e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x9f'),require(_0xa757('0xa0')));_0x5edca8['use'](_0xa757('0xa1'),require('./api/intSugarcrmField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xa2'),require(_0xa757('0xa3')));_0x5edca8[_0xa757('0x7')](_0xa757('0xa4'),require('./api/intDeskConfiguration'));_0x5edca8['use'](_0xa757('0xa5'),require(_0xa757('0xa6')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zoho/accounts',require(_0xa757('0xa7')));_0x5edca8['use'](_0xa757('0xa8'),require(_0xa757('0xa9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xaa'),require(_0xa757('0xab')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/accounts',require(_0xa757('0xac')));_0x5edca8[_0xa757('0x7')](_0xa757('0xad'),require(_0xa757('0xae')));_0x5edca8[_0xa757('0x7')]('/api/integrations/zendesk/fields',require(_0xa757('0xaf')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb0'),require(_0xa757('0xb1')));_0x5edca8[_0xa757('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa757('0xb2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb3'),require('./api/intFreshdeskField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xb4'),require(_0xa757('0xb5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb6'),require(_0xa757('0xb7')));_0x5edca8[_0xa757('0x7')](_0xa757('0xb8'),require(_0xa757('0xb9')));_0x5edca8[_0xa757('0x7')](_0xa757('0xba'),require(_0xa757('0xbb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xbc'),require('./api/intServicenowConfiguration'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbd'),require('./api/intServicenowField'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbe'),require('./api/intDynamics365Account'));_0x5edca8[_0xa757('0x7')](_0xa757('0xbf'),require(_0xa757('0xc0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc1'),require(_0xa757('0xc2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc3'),require(_0xa757('0xc4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc5'),require(_0xa757('0xc6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xc7'),require(_0xa757('0xc8')));_0x5edca8[_0xa757('0x7')]('/api/networks',require(_0xa757('0xc9')));_0x5edca8['use'](_0xa757('0xca'),require(_0xa757('0xcb')));_0x5edca8[_0xa757('0x7')](_0xa757('0xcc'),require(_0xa757('0xcd')));_0x5edca8['use'](_0xa757('0xce'),require(_0xa757('0xcf')));_0x5edca8[_0xa757('0x7')]('/api/jscripty/questions/reports',require(_0xa757('0xd0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd1'),require('./api/jscriptySessionReport'));_0x5edca8['use'](_0xa757('0xd2'),require(_0xa757('0xd3')));_0x5edca8[_0xa757('0x7')]('/api/square/reports',require(_0xa757('0xd4')));_0x5edca8['use']('/api/square/details/reports',require(_0xa757('0xd5')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd6'),require('./api/jscriptyProject'));_0x5edca8[_0xa757('0x7')](_0xa757('0xd7'),require(_0xa757('0xd8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xd9'),require(_0xa757('0xda')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdb'),require(_0xa757('0xdc')));_0x5edca8[_0xa757('0x7')](_0xa757('0xdd'),require(_0xa757('0xde')));_0x5edca8['use'](_0xa757('0xdf'),require(_0xa757('0xe0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe1'),require(_0xa757('0xe2')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe3'),require(_0xa757('0xe4')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe5'),require(_0xa757('0xe6')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe7'),require(_0xa757('0xe8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xe9'),require(_0xa757('0xea')));_0x5edca8[_0xa757('0x7')](_0xa757('0xeb'),require(_0xa757('0xec')));_0x5edca8[_0xa757('0x7')](_0xa757('0xed'),require('./api/mailTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0xee'),require('./api/chatTransferReport'));_0x5edca8[_0xa757('0x7')]('/api/fax/reports/transfer',require(_0xa757('0xef')));_0x5edca8[_0xa757('0x7')]('/api/openchannel/reports/transfer',require(_0xa757('0xf0')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf1'),require(_0xa757('0xf2')));_0x5edca8['use'](_0xa757('0xf3'),require(_0xa757('0xf4')));_0x5edca8['use'](_0xa757('0xf5'),require(_0xa757('0xf6')));_0x5edca8['use'](_0xa757('0xf7'),require(_0xa757('0xf8')));_0x5edca8[_0xa757('0x7')](_0xa757('0xf9'),require(_0xa757('0xfa')));_0x5edca8[_0xa757('0x7')](_0xa757('0xfb'),require(_0xa757('0xfc')));_0x5edca8[_0xa757('0x7')]('/api/notifications',require('./api/notification'));_0x5edca8[_0xa757('0x7')](_0xa757('0xfd'),require(_0xa757('0xfe')));_0x5edca8[_0xa757('0x7')](_0xa757('0xff'),require(_0xa757('0x100')));_0x5edca8[_0xa757('0x7')]('/api/whatsapp/interactions',require(_0xa757('0x101')));_0x5edca8['use'](_0xa757('0x102'),require(_0xa757('0x103')));_0x5edca8[_0xa757('0x7')](_0xa757('0x104'),require(_0xa757('0x105')));_0x5edca8['use'](_0xa757('0x106'),require('./api/whatsappTransferReport'));_0x5edca8[_0xa757('0x7')](_0xa757('0x107'),require(_0xa757('0x108')));_0x5edca8[_0xa757('0x7')]('/api/cloudProviders',require(_0xa757('0x109')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10a'),require(_0xa757('0x10b')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10c'),require(_0xa757('0x10d')));_0x5edca8[_0xa757('0x7')]('/api/jira',require(_0xa757('0x10e')));_0x5edca8[_0xa757('0x7')](_0xa757('0x10f'),require(_0xa757('0x110')));_0x5edca8['use'](_0xa757('0x111'),require(_0xa757('0x112')));_0x5edca8[_0xa757('0x7')](_0xa757('0x113'),require(_0xa757('0x114')));_0x5edca8[_0xa757('0x7')](_0xa757('0x115'),require('./api/pm2'));_0x5edca8['use'](_0xa757('0x116'),require('./api/webbar'));_0x5edca8[_0xa757('0x7')]('/apidoc',express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x119'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11a'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11a'))));_0x5edca8[_0xa757('0x7')]('/demo',express[_0xa757('0x11b')](path['join'](config[_0xa757('0x118')],_0xa757('0x11c'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x11d'),express['static'](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x11e'),_0xa757('0x11f'))));_0x5edca8[_0xa757('0x7')](_0xa757('0x120'),express[_0xa757('0x11b')](path[_0xa757('0x117')](config[_0xa757('0x118')],_0xa757('0x121'))));_0x5edca8[_0xa757('0x122')](_0xa757('0x123'))[_0xa757('0x124')](errors[0x194]);_0x5edca8[_0xa757('0x122')]('/*')[_0xa757('0x124')](function(_0x56a060,_0x4af060){_0x4af060[_0xa757('0x125')](path['resolve'](_0x5edca8[_0xa757('0x124')](_0xa757('0x126'))+_0xa757('0x127')));});};var sensitiveFields=[_0xa757('0x128'),'password',_0xa757('0x129'),_0xa757('0x12a'),_0xa757('0x12b'),_0xa757('0x12c'),_0xa757('0x12d'),_0xa757('0x12e'),'mobile',_0xa757('0x12f'),_0xa757('0x130'),_0xa757('0x131'),_0xa757('0x132'),_0xa757('0x133'),'code','accessKey',_0xa757('0x134'),'token',_0xa757('0x135'),'accessToken',_0xa757('0x136'),_0xa757('0x137'),_0xa757('0x138'),_0xa757('0x139'),_0xa757('0x13a'),_0xa757('0x13b'),_0xa757('0x13c'),_0xa757('0x13d'),_0xa757('0x13e'),_0xa757('0x13f'),_0xa757('0x140'),'accesskeyid',_0xa757('0x141'),_0xa757('0x142'),_0xa757('0x11'),_0xa757('0x143'),_0xa757('0x144'),_0xa757('0x145'),'dsn',_0xa757('0x146'),_0xa757('0x147'),'oldPassword'];function maskSensitiveData(_0x133f0c){var _0x68a80b=/(?!^)[\s\S](?!$)/g;for(var _0x1f4782 in _0x133f0c){if(_['isArray'](_0x133f0c[_0x1f4782])){for(var _0x3ae3bf=0x0;_0x3ae3bf<_0x133f0c[_0x1f4782][_0xa757('0x148')];_0x3ae3bf++){maskSensitiveData(_0x133f0c[_0x1f4782][_0x3ae3bf]);}}else if(_[_0xa757('0x149')](_0x133f0c[_0x1f4782])){maskSensitiveData(_0x133f0c[_0x1f4782]);}else if(_[_0xa757('0x14a')](_0x133f0c[_0x1f4782])){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782][_0xa757('0x14b')](/{{{/g,'@@{')[_0xa757('0x14b')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa757('0x14b')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1f4782)){_0x133f0c[_0x1f4782]=_0x133f0c[_0x1f4782]['replace'](_0x68a80b,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2e6763a..f5e7ccf 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57a2=['lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','http','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird'];(function(_0x5a3601,_0xb2fb5a){var _0x34fbce=function(_0x30119c){while(--_0x30119c){_0x5a3601['push'](_0x5a3601['shift']());}};_0x34fbce(++_0xb2fb5a);}(_0x57a2,0x8a));var _0x257a=function(_0x20d02e,_0x39ee28){_0x20d02e=_0x20d02e-0x0;var _0x30f90d=_0x57a2[_0x20d02e];return _0x30f90d;};'use strict';var jayson=require(_0x257a('0x0'));var BPromise=require(_0x257a('0x1'));var _=require(_0x257a('0x2'));var config=require(_0x257a('0x3'));exports[_0x257a('0x4')]=function(){return new BPromise(function(_0x319434,_0x45e55c){var _0x4e9d58={};_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x5')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x6')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x8')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x9')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xa')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xb')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xc')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xd')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0xe')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xf')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x10')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/mailServerIn/mailServerIn.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x11')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x12')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x13')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x14')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x15')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x16')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x17')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x18')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x19')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/faxQueue/faxQueue.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1a')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1b')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x1c')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1d')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x1e')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1f')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x20')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x21')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x22')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/chatInteraction/chatInteraction.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x23')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/chatQueue/chatQueue.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x24')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x25')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x26')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x27')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x28')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x29')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2a')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2b')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/trigger/trigger.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/variable/variable.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x2c')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2d')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2e')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2f')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x30')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x31')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x32')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x33')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x34')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x35')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x36')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/squareOdbc/squareOdbc.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x37')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/squareRecording/squareRecording.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x38')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x39')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3a')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/plugin/plugin.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3b')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3c')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3d')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3417e1=jayson['server'](_0x4e9d58)[_0x257a('0x3e')]();var _0x22eef0=config[_0x257a('0x3f')][_0x257a('0x40')]||config['port']+0x1;var _0x49afe1=config[_0x257a('0x3f')]['ip']||_0x257a('0x41');_0x3417e1['on']('error',function(_0x341d80){return _0x45e55c(_0x341d80);});_0x3417e1[_0x257a('0x4')](_0x22eef0,_0x49afe1,function(){console[_0x257a('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x49afe1,_0x22eef0);require(_0x257a('0x43'))[_0x257a('0x44')]();return _0x319434(_0x257a('0x45')+_0x49afe1+':'+_0x22eef0);});});}; \ No newline at end of file +var _0x07dd=['../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0x07dd,0xfb));var _0xd07d=function(_0x52f52c,_0x1fcf9a){_0x52f52c=_0x52f52c-0x0;var _0x143fc8=_0x07dd[_0x52f52c];return _0x143fc8;};'use strict';var jayson=require(_0xd07d('0x0'));var BPromise=require('bluebird');var _=require(_0xd07d('0x1'));var config=require(_0xd07d('0x2'));exports[_0xd07d('0x3')]=function(){return new BPromise(function(_0x18e53a,_0x1007ff){var _0x1d758f={};_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/user/user.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x5')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceQueue/voiceQueue.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceRecording/voiceRecording.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x6')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x7')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x8')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x9')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xa')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xb')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xc')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/mailAccount/mailAccount.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0xd')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/mailInteraction/mailInteraction.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xe')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0xf')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x10')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/faxAccount/faxAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x11')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x12')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x13')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x14')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x15')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/smsAccount/smsAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x16')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x17')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x18')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x19')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1a')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1b')));_0x1d758f=_['merge'](_0x1d758f,require('../api/chatInteraction/chatInteraction.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/chatMessage/chatMessage.rpc'));_0x1d758f=_['merge'](_0x1d758f,require('../api/chatQueue/chatQueue.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x1c')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1d')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x1e')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x1f')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x20')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/pause/pause.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x21')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x22')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x23')));_0x1d758f=_['merge'](_0x1d758f,require('../api/variable/variable.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x24')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x25')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x26')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x27')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x28')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x29')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2a')));_0x1d758f=_['merge'](_0x1d758f,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2b')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2c')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2d')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2e')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x2f')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x30')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require('../api/campaign/campaign.rpc'));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x31')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x32')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x33')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x34')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x35')));_0x1d758f=_['merge'](_0x1d758f,require(_0xd07d('0x36')));_0x1d758f=_[_0xd07d('0x4')](_0x1d758f,require(_0xd07d('0x37')));var _0xadeba5=jayson[_0xd07d('0x38')](_0x1d758f)[_0xd07d('0x39')]();var _0x4a32ff=config[_0xd07d('0x3a')][_0xd07d('0x3b')]||config[_0xd07d('0x3b')]+0x1;var _0xd0a054=config[_0xd07d('0x3a')]['ip']||'localhost';_0xadeba5['on'](_0xd07d('0x3c'),function(_0x1b374a){return _0x1007ff(_0x1b374a);});_0xadeba5[_0xd07d('0x3')](_0x4a32ff,_0xd0a054,function(){console[_0xd07d('0x3d')](_0xd07d('0x3e'),_0xd0a054,_0x4a32ff);require(_0xd07d('0x3f'))[_0xd07d('0x40')]();return _0x18e53a(_0xd07d('0x41')+_0xd0a054+':'+_0x4a32ff);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 08d2c8a..c4f370f 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 _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x55054d,_0x35adc6){var _0x5324fa=function(_0x348b0c){while(--_0x348b0c){_0x55054d['push'](_0x55054d['shift']());}};_0x5324fa(++_0x35adc6);}(_0xe706,0xa3));var _0x6e70=function(_0x37bef1,_0xecf330){_0x37bef1=_0x37bef1-0x0;var _0x342427=_0xe706[_0x37bef1];return _0x342427;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file +var _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xcb91[_0x367361];return _0x195d2d;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ae579dc..f36a226 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 _0xa5ca=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x37aa98,_0x41c55e){var _0x520e03=function(_0x5b831b){while(--_0x5b831b){_0x37aa98['push'](_0x37aa98['shift']());}};_0x520e03(++_0x41c55e);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xa5ca[_0x286bfb];return _0x52b683;};'use strict';var util=require(_0xaa5c('0x0'));var error={'E_AGI_UNDEFINED':_0xaa5c('0x1'),'E_AGI_ARGUMENT_PORT':_0xaa5c('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xaa5c('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xaa5c('0x4'),'E_AGI_SOCKET_ERROR':_0xaa5c('0x5'),'E_AGI_SOCKET_CLOSE':_0xaa5c('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xaa5c('0x7'),'E_AGI_COMMAND_EMPTY':_0xaa5c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x49da9b){var _0x49da9b=_0x49da9b||null,_0x10bee5=_0x10bee5||[],_0x283bc5=0x1,_0x5b39a7='';if(!error[_0x49da9b]){_0x49da9b='E_AGI_UNDEFINED';}_0x10bee5[_0xaa5c('0x9')](error[_0x49da9b]);while(arguments[_0x283bc5]){_0x10bee5[_0xaa5c('0x9')](arguments[_0x283bc5]);_0x283bc5++;}_0x5b39a7=util[_0xaa5c('0xa')]['apply'](util,_0x10bee5);this[_0xaa5c('0xb')]=_0x5b39a7;this[_0xaa5c('0xc')]=_0x49da9b;}module[_0xaa5c('0xd')]=AGIError; \ No newline at end of file +var _0xf429=['format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','push'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0xf429,0xd4));var _0x9f42=function(_0x237c45,_0x55cf99){_0x237c45=_0x237c45-0x0;var _0x2942f6=_0xf429[_0x237c45];return _0x2942f6;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x9f42('0x0'),'E_AGI_ARGUMENT_PORT':_0x9f42('0x1'),'E_AGI_SERVER_ERROR':_0x9f42('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x9f42('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x9f42('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x9f42('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x9f42('0x6'),'E_AGI_COMMAND_EMPTY':_0x9f42('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x874a2b){var _0x874a2b=_0x874a2b||null,_0x4329bf=_0x4329bf||[],_0x108fcb=0x1,_0x484ccd='';if(!error[_0x874a2b]){_0x874a2b='E_AGI_UNDEFINED';}_0x4329bf[_0x9f42('0x8')](error[_0x874a2b]);while(arguments[_0x108fcb]){_0x4329bf['push'](arguments[_0x108fcb]);_0x108fcb++;}_0x484ccd=util[_0x9f42('0x9')]['apply'](util,_0x4329bf);this[_0x9f42('0xa')]=_0x484ccd;this[_0x9f42('0xb')]=_0x874a2b;}module[_0x9f42('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 0699c86..6d34170 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 _0x337f=['default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','edges','addEdge','push','size','relations','getVertex','traverseBFS','info','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x337f,0x11c));var _0xf337=function(_0x545396,_0x488e77){_0x545396=_0x545396-0x0;var _0x143122=_0x337f[_0x545396];return _0x143122;};'use strict';var _=require(_0xf337('0x0'));var logger=require(_0xf337('0x1'))(_0xf337('0x2'));var verticesWithRetry=['menu',_0xf337('0x3'),_0xf337('0x4')];var Graph=function(){this[_0xf337('0x5')]={};this['edges']={};this[_0xf337('0x6')]=0x0;};Graph[_0xf337('0x7')]['addVertex']=function(_0x959d1a){this['vertices'][_0x959d1a['id']]=_0x959d1a;this[_0xf337('0x8')][_0x959d1a['id']]=[];};Graph['prototype'][_0xf337('0x9')]=function(_0x56bd39,_0x4b80a2,_0x1f0a95){this[_0xf337('0x8')][_0x56bd39][_0xf337('0xa')]({'target':_0x4b80a2,'condition':_0x1f0a95});this[_0xf337('0x6')]+=0x1;};Graph[_0xf337('0x7')][_0xf337('0xb')]=function(){return _[_0xf337('0xb')](this[_0xf337('0x5')]);};Graph['prototype'][_0xf337('0xc')]=function(){return this[_0xf337('0x6')];};Graph[_0xf337('0x7')][_0xf337('0xd')]=function(_0x14358b){return this[_0xf337('0x5')][_0x14358b];};Graph[_0xf337('0x7')][_0xf337('0xe')]=function(_0x44721e,_0xab8324){if(!this[_0xf337('0x5')][_0x44721e]){return logger[_0xf337('0xf')]('no\x20vertex\x20found');}var _0x2da77a=_0xab8324(this[_0xf337('0x5')][_0x44721e]);if(!_0x2da77a){return logger[_0xf337('0xf')]('stop\x20traverse');}if(this[_0xf337('0x8')][_0x44721e][_0xf337('0x10')]===0x0){return logger['info'](_0xf337('0x11'));}for(var _0x39146c=0x0,_0x100cb0=[],_0x4a7e4c=![];_0x39146c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','debug','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context'];(function(_0x3e9199,_0x98724){var _0x379a3f=function(_0x3ce1cb){while(--_0x3ce1cb){_0x3e9199['push'](_0x3e9199['shift']());}};_0x379a3f(++_0x98724);}(_0xac31,0xca));var _0x1ac3=function(_0x42c788,_0x9d6583){_0x42c788=_0x42c788-0x0;var _0x58bae9=_0xac31[_0x42c788];return _0x58bae9;};'use strict';var parser=require(_0x1ac3('0x0'));var _=require(_0x1ac3('0x1'));var syncho=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var config=require(_0x1ac3('0x5'));var logger=require(_0x1ac3('0x6'))('agi');var utilLicense=require(_0x1ac3('0x7'));var rpc=require(_0x1ac3('0x8'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x1ac3('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1ac3('0xa')]=_[_0x1ac3('0xb')](config[_0x1ac3('0xa')],{'ip':_0x1ac3('0xc'),'port':0x11dd});function connectionHandler(_0x57893c){process[_0x1ac3('0xd')](function(){syncho(function(){try{setChannelVariables(_0x57893c);agiHandler(_0x57893c);}catch(_0x4d7695){logger[_0x1ac3('0xe')](_0x4d7695[_0x1ac3('0xf')]);}});});}function listeningHandler(){console[_0x1ac3('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1ac3('0xa')][_0x1ac3('0x11')]);logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x14'),config[_0x1ac3('0xa')]['ip'],config['agi'][_0x1ac3('0x11')]));}function errorHandler(_0x376814){if(_0x376814&&_0x376814[_0x1ac3('0x15')]&&_0x376814[_0x1ac3('0x16')]){logger['error'](util[_0x1ac3('0x13')](_0x1ac3('0x17'),_0x376814[_0x1ac3('0x15')],_0x376814[_0x1ac3('0x16')]));}else{logger['error'](util[_0x1ac3('0x13')](_0x1ac3('0x18'),_0x376814['stack']));}}function closeHandler(){logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x19'),this['arg_1'],this[_0x1ac3('0x1a')],this[_0x1ac3('0x1b')],this[_0x1ac3('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x195683){logger['error'](_0x195683[_0x1ac3('0xf')]);}}function timeoutHandler(){logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x1d'),this[_0x1ac3('0x1e')],this['calleridname'],this[_0x1ac3('0x1b')],this[_0x1ac3('0x1c')],this[_0x1ac3('0x1f')]));}function hangupHandler(){logger[_0x1ac3('0x12')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1ac3('0x1e')],this[_0x1ac3('0x1a')],this[_0x1ac3('0x1b')],this[_0x1ac3('0x1c')],this[_0x1ac3('0x1f')]));this[_0x1ac3('0x20')]=!![];}function getRoot(_0x23b767){return parser[_0x1ac3('0x21')](_0x23b767,{'object':!![]})[_0x1ac3('0x22')]['root'];}function addVertex(_0x1e277f,_0x231b7f,_0x4b19f2){_0x231b7f[_0x1ac3('0x23')]=_0x4b19f2;if(_0x231b7f[_0x1ac3('0x24')]('retry')){_0x231b7f[_0x1ac3('0x25')]=parseInt(_0x231b7f[_0x1ac3('0x26')],0xa);}_0x1e277f[_0x1ac3('0x27')](_[_0x1ac3('0x28')](_0x231b7f,_0x1ac3('0x29')));}function initGraph(_0x565a0f,_0x5a2ab2){var _0x503a64=new Graph();for(var _0x528807 in _0x565a0f){if(_0x565a0f['hasOwnProperty'](_0x528807)){if(_[_0x1ac3('0x2a')](_0x565a0f[_0x528807])){for(var _0x4b04fb=0x0;_0x4b04fb<_0x565a0f[_0x528807][_0x1ac3('0x2b')];_0x4b04fb+=0x1){addVertex(_0x503a64,_0x565a0f[_0x528807][_0x4b04fb],_0x528807);}}else{addVertex(_0x503a64,_0x565a0f[_0x528807],_0x528807);}}}for(var _0x3e4a4e=0x0;_0x3e4a4e<_0x5a2ab2[_0x1ac3('0x2b')];_0x3e4a4e+=0x1){if(_0x5a2ab2[_0x3e4a4e][_0x1ac3('0x2c')]&&_0x5a2ab2[_0x3e4a4e]['target']){_0x503a64[_0x1ac3('0x2d')](_0x5a2ab2[_0x3e4a4e]['source'],_0x5a2ab2[_0x3e4a4e][_0x1ac3('0x2e')],_0x5a2ab2[_0x3e4a4e][_0x1ac3('0x2f')]);}}return _0x503a64;}function getSquareProject(_0x440aed,_0x1c5653){rpc[_0x1ac3('0x30')](_0x440aed)[_0x1ac3('0x31')](function(_0x9c17c2){_0x1c5653(null,_0x9c17c2);})['catch'](function(_0x2248b6){_0x1c5653(null,_0x2248b6);});}function createSquareReport(_0x3b4c65,_0x434781){rpc[_0x1ac3('0x32')](_0x3b4c65)['then'](function(_0x3591a9){if(_0x434781){_0x434781(null,_0x3591a9);}})[_0x1ac3('0x33')](function(_0xce0836){if(_0x434781){_0x434781(null,_0xce0836);}});}function setChannelVariables(_0x294513){for(var _0x204d78 in _0x294513){if(_0x294513['hasOwnProperty'](_0x204d78)){if(_0x204d78[_0x1ac3('0x34')](_0x1ac3('0x35'))===0x0){_0x294513[_0x204d78[_0x1ac3('0x36')](0x4)]=_0x294513[_0x204d78];delete _0x294513[_0x204d78];}}}}function getLogFromObject(_0x156ccd){return util[_0x1ac3('0x37')](_0x156ccd,{'showHidden':![],'depth':null});}function agiHandler(_0x43362a){var _0x4c1283,_0x2102a1,_0x174a53,_0x431f11,_0xf6d79e;logger['debug'](_0x1ac3('0x38'),JSON[_0x1ac3('0x39')](_0x43362a,null,0x2));logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x3a'),_0x43362a[_0x1ac3('0x1e')],_0x43362a[_0x1ac3('0x1a')],_0x43362a[_0x1ac3('0x1b')],_0x43362a[_0x1ac3('0x1c')],_0x43362a['uniqueid']));_0x43362a['on'](_0x1ac3('0xe'),errorHandler);_0x43362a['on'](_0x1ac3('0x3b'),closeHandler);_0x43362a['on']('timeout',timeoutHandler);_0x43362a[_0x1ac3('0x20')]=![];_0x43362a['on'](_0x1ac3('0x3c'),hangupHandler);var _0x17c69e=getSquareProject[_0x1ac3('0x3d')](null,_0x43362a[_0x1ac3('0x1e')]);if(_0x17c69e){if(_0x17c69e[_0x1ac3('0x3e')]){_0x4c1283=getRoot(_0x17c69e[_0x1ac3('0x3e')]);if(_0x4c1283&&_0x4c1283[_0x1ac3('0x3f')]){logger['debug'](_0x1ac3('0x40'),JSON['stringify'](_0x4c1283,null,0x2));_0x43362a[_0x1ac3('0x41')]=moment()[_0x1ac3('0x13')](_0x1ac3('0x42'));_0x2102a1=initGraph(_[_0x1ac3('0x28')](_0x4c1283,_0x1ac3('0x29')),_0x4c1283[_0x1ac3('0x29')]);_0x174a53=new Vertices(_0x43362a,rpc,mailRpc);logger['info'](util[_0x1ac3('0x13')](_0x1ac3('0x43'),_0x43362a[_0x1ac3('0x1e')],_0x43362a['calleridname'],_0x43362a[_0x1ac3('0x1b')],_0x43362a[_0x1ac3('0x1c')],_0x43362a['uniqueid']));_0x2102a1[_0x1ac3('0x44')](_0x4c1283[_0x1ac3('0x3f')]['id'],function(_0xb4664e){try{_0xb4664e=_0x174a53[_0x1ac3('0x45')](_0xb4664e);logger[_0x1ac3('0x46')](_0x1ac3('0x47'),JSON[_0x1ac3('0x39')](_0xb4664e,null,0x2));if(_0xb4664e[_0x1ac3('0x23')]==='gotoc'){logger[_0x1ac3('0x12')](_0x1ac3('0x48'));_0x43362a[_0x1ac3('0x49')]=_0xb4664e[_0x1ac3('0x49')]||_0x43362a[_0x1ac3('0x49')];_0x43362a[_0x1ac3('0x4a')]=_0xb4664e[_0x1ac3('0x4a')];_0x43362a['priority']=_0xb4664e['priority']?_0xb4664e[_0x1ac3('0x4b')]-0x1:0x1;return null;}else if(_0xb4664e&&_0x174a53[_0xb4664e[_0x1ac3('0x23')]]){_0xf6d79e=_0x174a53[_0xb4664e['agicommand']](_0xb4664e);logger[_0x1ac3('0x12')](_0x1ac3('0x4c'),JSON['stringify'](_0xf6d79e,null,0x2));if(_0xf6d79e&&_0xf6d79e[_0x1ac3('0x4d')]===AGI_CODE_SUCCESS&&_0xf6d79e['result']!==AGI_RESULT_ERROR&&!_0x43362a[_0x1ac3('0x20')]){logger[_0x1ac3('0x46')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return _[_0x1ac3('0x4e')](_0xf6d79e['result'])?null:_0xf6d79e[_0x1ac3('0x4f')][_0x1ac3('0x50')]();}else{logger[_0x1ac3('0xe')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return null;}}else{logger[_0x1ac3('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x26b5b1){logger[_0x1ac3('0xe')](_0x26b5b1[_0x1ac3('0xf')]);return null;}});if(_0x4c1283[_0x1ac3('0x51')]){logger['info'](util[_0x1ac3('0x13')](_0x1ac3('0x52'),_0x43362a[_0x1ac3('0x1e')],_0x43362a[_0x1ac3('0x1a')],_0x43362a['callerid'],_0x43362a[_0x1ac3('0x1c')],_0x43362a[_0x1ac3('0x1f')]));_0x2102a1[_0x1ac3('0x44')](_0x4c1283[_0x1ac3('0x51')]['id'],function(_0x5cfd01){try{_0x5cfd01=_0x174a53[_0x1ac3('0x45')](_0x5cfd01);logger['debug'](_0x1ac3('0x47'),JSON[_0x1ac3('0x39')](_0x5cfd01,null,0x2));if(_0x5cfd01&&_0x174a53[_0x5cfd01[_0x1ac3('0x23')]]){_0xf6d79e=_0x174a53[_0x5cfd01[_0x1ac3('0x23')]](_0x5cfd01);if(_0xf6d79e){logger[_0x1ac3('0x46')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return _[_0x1ac3('0x4e')](_0xf6d79e['result'])?null:_0xf6d79e['result'][_0x1ac3('0x50')]();}else{logger[_0x1ac3('0xe')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x5b85c5){logger[_0x1ac3('0xe')](_0x5b85c5[_0x1ac3('0xf')]);return null;}});}logger['info'](util[_0x1ac3('0x13')](_0x1ac3('0x53'),_0x43362a[_0x1ac3('0x1e')],_0x43362a[_0x1ac3('0x1a')],_0x43362a['callerid'],_0x43362a['dnid'],_0x43362a[_0x1ac3('0x1f')]));logger[_0x1ac3('0x12')](util['format'](_0x1ac3('0x54'),_0x43362a['context'],_0x43362a['extension'],parseInt(_0x43362a[_0x1ac3('0x4b')],0xa)+0x1));_0x43362a[_0x1ac3('0x55')](_0x43362a['context'],_0x43362a[_0x1ac3('0x4a')],parseInt(_0x43362a['priority'],0xa)+0x1);_0x43362a[_0x1ac3('0x3b')]();}}else{logger[_0x1ac3('0xe')](util[_0x1ac3('0x13')](_0x1ac3('0x56'),_0x43362a[_0x1ac3('0x1e')]));_0x43362a[_0x1ac3('0x55')](_0x43362a[_0x1ac3('0x49')],_0x43362a[_0x1ac3('0x4a')],parseInt(_0x43362a[_0x1ac3('0x4b')],0xa)+0x1);_0x43362a[_0x1ac3('0x3b')]();}}else{logger[_0x1ac3('0xe')](util['format']('Project\x20%s\x20not\x20found',_0x43362a[_0x1ac3('0x1e')]));_0x43362a[_0x1ac3('0x55')](_0x43362a[_0x1ac3('0x49')],_0x43362a[_0x1ac3('0x4a')],parseInt(_0x43362a[_0x1ac3('0x4b')],0xa)+0x1);_0x43362a[_0x1ac3('0x3b')]();}}function main(){var _0x2ca351;return utilLicense[_0x1ac3('0x57')]()[_0x1ac3('0x31')](function(_0x3149f6){if(_0x3149f6){if(_0x3149f6['voice']){if(_0x3149f6[_0x1ac3('0x58')]&&_0x3149f6[_0x1ac3('0x58')]>0x0){logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x59'),_0x3149f6['callysquare']));_0x2ca351=_0x3149f6[_0x1ac3('0x58')];}else{logger[_0x1ac3('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2ca351=-0x1;}}})[_0x1ac3('0x33')](function(_0x17ebb9){logger[_0x1ac3('0xe')]('[LICENSE]',_0x17ebb9[_0x1ac3('0xf')]);})['finally'](function(){var _0x5035cf=require('./server')(config['agi'][_0x1ac3('0x11')],config[_0x1ac3('0xa')]['ip'],_0x2ca351);_0x5035cf['on'](_0x1ac3('0xe'),errorHandler);_0x5035cf['on'](_0x1ac3('0x5a'),listeningHandler);_0x5035cf['on'](_0x1ac3('0x5b'),connectionHandler);_0x5035cf['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x32ef=['Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','source','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','close','timeout','evtHangup','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','context','extension','priority','response','code','result','isUndefined','toString','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','error','stack','log'];(function(_0x247502,_0x565e72){var _0x39297d=function(_0x3caa80){while(--_0x3caa80){_0x247502['push'](_0x247502['shift']());}};_0x39297d(++_0x565e72);}(_0x32ef,0xf9));var _0xf32e=function(_0x5a032b,_0x42fc7a){_0x5a032b=_0x5a032b-0x0;var _0x3517aa=_0x32ef[_0x5a032b];return _0x3517aa;};'use strict';var parser=require(_0xf32e('0x0'));var _=require(_0xf32e('0x1'));var syncho=require(_0xf32e('0x2'));var util=require(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var config=require(_0xf32e('0x5'));var logger=require('../../config/logger')(_0xf32e('0x6'));var utilLicense=require(_0xf32e('0x7'));var rpc=require('./rpc');var mailRpc=require(_0xf32e('0x8'));var Graph=require(_0xf32e('0x9'));var Vertices=require(_0xf32e('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf32e('0x6')]=_[_0xf32e('0xb')](config[_0xf32e('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xdac5e){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xdac5e);agiHandler(_0xdac5e);}catch(_0x384f27){logger[_0xf32e('0xc')](_0x384f27[_0xf32e('0xd')]);}});});}function listeningHandler(){console[_0xf32e('0xe')](_0xf32e('0xf'),config['agi'][_0xf32e('0x10')]);logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x13'),config[_0xf32e('0x6')]['ip'],config[_0xf32e('0x6')][_0xf32e('0x10')]));}function errorHandler(_0x303d4d){if(_0x303d4d&&_0x303d4d[_0xf32e('0x14')]&&_0x303d4d[_0xf32e('0x15')]){logger[_0xf32e('0xc')](util['format'](_0xf32e('0x16'),_0x303d4d[_0xf32e('0x14')],_0x303d4d[_0xf32e('0x15')]));}else{logger[_0xf32e('0xc')](util[_0xf32e('0x12')](_0xf32e('0x17'),_0x303d4d['stack']));}}function closeHandler(){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x18'),this[_0xf32e('0x19')],this[_0xf32e('0x1a')],this[_0xf32e('0x1b')],this[_0xf32e('0x1c')],this[_0xf32e('0x1d')]));try{createSquareReport(this);}catch(_0x21aa73){logger['error'](_0x21aa73[_0xf32e('0xd')]);}}function timeoutHandler(){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x1e'),this[_0xf32e('0x19')],this[_0xf32e('0x1a')],this[_0xf32e('0x1b')],this[_0xf32e('0x1c')],this[_0xf32e('0x1d')]));}function hangupHandler(){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x1f'),this[_0xf32e('0x19')],this[_0xf32e('0x1a')],this[_0xf32e('0x1b')],this['dnid'],this[_0xf32e('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x27b92c){return parser[_0xf32e('0x20')](_0x27b92c,{'object':!![]})[_0xf32e('0x21')][_0xf32e('0x22')];}function addVertex(_0x35e34c,_0x5409b4,_0x227405){_0x5409b4[_0xf32e('0x23')]=_0x227405;if(_0x5409b4[_0xf32e('0x24')](_0xf32e('0x25'))){_0x5409b4['maxRetry']=parseInt(_0x5409b4[_0xf32e('0x25')],0xa);}_0x35e34c[_0xf32e('0x26')](_[_0xf32e('0x27')](_0x5409b4,_0xf32e('0x28')));}function initGraph(_0xb3ee4b,_0x15103f){var _0x2f925b=new Graph();for(var _0x1eb42e in _0xb3ee4b){if(_0xb3ee4b[_0xf32e('0x24')](_0x1eb42e)){if(_[_0xf32e('0x29')](_0xb3ee4b[_0x1eb42e])){for(var _0x488489=0x0;_0x488489<_0xb3ee4b[_0x1eb42e][_0xf32e('0x2a')];_0x488489+=0x1){addVertex(_0x2f925b,_0xb3ee4b[_0x1eb42e][_0x488489],_0x1eb42e);}}else{addVertex(_0x2f925b,_0xb3ee4b[_0x1eb42e],_0x1eb42e);}}}for(var _0x88eaa5=0x0;_0x88eaa5<_0x15103f[_0xf32e('0x2a')];_0x88eaa5+=0x1){if(_0x15103f[_0x88eaa5]['source']&&_0x15103f[_0x88eaa5][_0xf32e('0x2b')]){_0x2f925b['addEdge'](_0x15103f[_0x88eaa5][_0xf32e('0x2c')],_0x15103f[_0x88eaa5]['target'],_0x15103f[_0x88eaa5][_0xf32e('0x2d')]);}}return _0x2f925b;}function getSquareProject(_0x39965e,_0x3e42ac){rpc[_0xf32e('0x2e')](_0x39965e)[_0xf32e('0x2f')](function(_0x4e64d4){_0x3e42ac(null,_0x4e64d4);})[_0xf32e('0x30')](function(_0x1d3c7a){_0x3e42ac(null,_0x1d3c7a);});}function createSquareReport(_0x175096,_0x498c9c){rpc[_0xf32e('0x31')](_0x175096)[_0xf32e('0x2f')](function(_0x2d0d31){if(_0x498c9c){_0x498c9c(null,_0x2d0d31);}})[_0xf32e('0x30')](function(_0x3e0c1e){if(_0x498c9c){_0x498c9c(null,_0x3e0c1e);}});}function setChannelVariables(_0x3f4362){for(var _0x146b52 in _0x3f4362){if(_0x3f4362[_0xf32e('0x24')](_0x146b52)){if(_0x146b52[_0xf32e('0x32')](_0xf32e('0x33'))===0x0){_0x3f4362[_0x146b52[_0xf32e('0x34')](0x4)]=_0x3f4362[_0x146b52];delete _0x3f4362[_0x146b52];}}}}function getLogFromObject(_0x45524d){return util[_0xf32e('0x35')](_0x45524d,{'showHidden':![],'depth':null});}function agiHandler(_0x5c04ae){var _0x7b643e,_0x5232de,_0x576446,_0x529b70,_0x565552;logger[_0xf32e('0x36')](_0xf32e('0x37'),JSON[_0xf32e('0x38')](_0x5c04ae,null,0x2));logger[_0xf32e('0x11')](util[_0xf32e('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae[_0xf32e('0x1c')],_0x5c04ae['uniqueid']));_0x5c04ae['on'](_0xf32e('0xc'),errorHandler);_0x5c04ae['on'](_0xf32e('0x39'),closeHandler);_0x5c04ae['on'](_0xf32e('0x3a'),timeoutHandler);_0x5c04ae[_0xf32e('0x3b')]=![];_0x5c04ae['on'](_0xf32e('0x3c'),hangupHandler);var _0x576f37=getSquareProject[_0xf32e('0x3d')](null,_0x5c04ae[_0xf32e('0x19')]);if(_0x576f37){if(_0x576f37[_0xf32e('0x3e')]){_0x7b643e=getRoot(_0x576f37['production']);if(_0x7b643e&&_0x7b643e[_0xf32e('0x3f')]){logger['debug'](_0xf32e('0x22'),JSON[_0xf32e('0x38')](_0x7b643e,null,0x2));_0x5c04ae[_0xf32e('0x40')]=moment()['format'](_0xf32e('0x41'));_0x5232de=initGraph(_[_0xf32e('0x27')](_0x7b643e,_0xf32e('0x28')),_0x7b643e[_0xf32e('0x28')]);_0x576446=new Vertices(_0x5c04ae,rpc,mailRpc);logger[_0xf32e('0x11')](util[_0xf32e('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae[_0xf32e('0x1c')],_0x5c04ae[_0xf32e('0x1d')]));_0x5232de[_0xf32e('0x42')](_0x7b643e[_0xf32e('0x3f')]['id'],function(_0x56bf88){try{_0x56bf88=_0x576446[_0xf32e('0x43')](_0x56bf88);logger[_0xf32e('0x36')](_0xf32e('0x44'),JSON[_0xf32e('0x38')](_0x56bf88,null,0x2));if(_0x56bf88[_0xf32e('0x23')]===_0xf32e('0x45')){logger[_0xf32e('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5c04ae[_0xf32e('0x46')]=_0x56bf88[_0xf32e('0x46')]||_0x5c04ae[_0xf32e('0x46')];_0x5c04ae[_0xf32e('0x47')]=_0x56bf88[_0xf32e('0x47')];_0x5c04ae[_0xf32e('0x48')]=_0x56bf88[_0xf32e('0x48')]?_0x56bf88[_0xf32e('0x48')]-0x1:0x1;return null;}else if(_0x56bf88&&_0x576446[_0x56bf88[_0xf32e('0x23')]]){_0x565552=_0x576446[_0x56bf88[_0xf32e('0x23')]](_0x56bf88);logger['info'](_0xf32e('0x49'),JSON[_0xf32e('0x38')](_0x565552,null,0x2));if(_0x565552&&_0x565552[_0xf32e('0x4a')]===AGI_CODE_SUCCESS&&_0x565552[_0xf32e('0x4b')]!==AGI_RESULT_ERROR&&!_0x5c04ae[_0xf32e('0x3b')]){logger[_0xf32e('0x36')]('response',getLogFromObject(_0x565552));return _[_0xf32e('0x4c')](_0x565552[_0xf32e('0x4b')])?null:_0x565552[_0xf32e('0x4b')][_0xf32e('0x4d')]();}else{logger[_0xf32e('0xc')]('response',getLogFromObject(_0x565552));return null;}}else{logger[_0xf32e('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0xd81744){logger[_0xf32e('0xc')](_0xd81744['stack']);return null;}});if(_0x7b643e[_0xf32e('0x4e')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae[_0xf32e('0x1c')],_0x5c04ae[_0xf32e('0x1d')]));_0x5232de[_0xf32e('0x42')](_0x7b643e[_0xf32e('0x4e')]['id'],function(_0x40fedb){try{_0x40fedb=_0x576446[_0xf32e('0x43')](_0x40fedb);logger[_0xf32e('0x36')](_0xf32e('0x44'),JSON[_0xf32e('0x38')](_0x40fedb,null,0x2));if(_0x40fedb&&_0x576446[_0x40fedb[_0xf32e('0x23')]]){_0x565552=_0x576446[_0x40fedb[_0xf32e('0x23')]](_0x40fedb);if(_0x565552){logger['debug'](_0xf32e('0x49'),getLogFromObject(_0x565552));return _[_0xf32e('0x4c')](_0x565552[_0xf32e('0x4b')])?null:_0x565552['result']['toString']();}else{logger['error'](_0xf32e('0x49'),getLogFromObject(_0x565552));return null;}}else{logger[_0xf32e('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x436b8a){logger[_0xf32e('0xc')](_0x436b8a['stack']);return null;}});}logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x4f'),_0x5c04ae[_0xf32e('0x19')],_0x5c04ae[_0xf32e('0x1a')],_0x5c04ae[_0xf32e('0x1b')],_0x5c04ae['dnid'],_0x5c04ae[_0xf32e('0x1d')]));logger[_0xf32e('0x11')](util[_0xf32e('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5c04ae[_0xf32e('0x46')],_0x5c04ae[_0xf32e('0x47')],parseInt(_0x5c04ae[_0xf32e('0x48')],0xa)+0x1));_0x5c04ae['continueAt'](_0x5c04ae['context'],_0x5c04ae['extension'],parseInt(_0x5c04ae[_0xf32e('0x48')],0xa)+0x1);_0x5c04ae[_0xf32e('0x39')]();}}else{logger[_0xf32e('0xc')](util[_0xf32e('0x12')]('Project\x20%s\x20not\x20published',_0x5c04ae[_0xf32e('0x19')]));_0x5c04ae[_0xf32e('0x50')](_0x5c04ae[_0xf32e('0x46')],_0x5c04ae[_0xf32e('0x47')],parseInt(_0x5c04ae[_0xf32e('0x48')],0xa)+0x1);_0x5c04ae['close']();}}else{logger[_0xf32e('0xc')](util[_0xf32e('0x12')](_0xf32e('0x51'),_0x5c04ae[_0xf32e('0x19')]));_0x5c04ae['continueAt'](_0x5c04ae[_0xf32e('0x46')],_0x5c04ae['extension'],parseInt(_0x5c04ae['priority'],0xa)+0x1);_0x5c04ae[_0xf32e('0x39')]();}}function main(){var _0x1954e1;return utilLicense[_0xf32e('0x52')]()[_0xf32e('0x2f')](function(_0x1d58fa){if(_0x1d58fa){if(_0x1d58fa[_0xf32e('0x53')]){if(_0x1d58fa[_0xf32e('0x54')]&&_0x1d58fa[_0xf32e('0x54')]>0x0){logger[_0xf32e('0x11')](util[_0xf32e('0x12')](_0xf32e('0x55'),_0x1d58fa[_0xf32e('0x54')]));_0x1954e1=_0x1d58fa['callysquare'];}else{logger[_0xf32e('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xf32e('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1954e1=-0x1;}}})[_0xf32e('0x30')](function(_0x2b179e){logger[_0xf32e('0xc')]('[LICENSE]',_0x2b179e[_0xf32e('0xd')]);})[_0xf32e('0x4e')](function(){var _0x500bfb=require('./server')(config['agi'][_0xf32e('0x10')],config[_0xf32e('0x6')]['ip'],_0x1954e1);_0x500bfb['on'](_0xf32e('0xc'),errorHandler);_0x500bfb['on'](_0xf32e('0x56'),listeningHandler);_0x500bfb['on'](_0xf32e('0x57'),connectionHandler);_0x500bfb['on'](_0xf32e('0x39'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 0471add..d5e1bbb 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x5e4531,_0xc0bb44){var _0x5d9eb2=function(_0x5a6b39){while(--_0x5a6b39){_0x5e4531['push'](_0x5e4531['shift']());}};_0x5d9eb2(++_0xc0bb44);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x128b60,_0x55b192){var _0x2135db=function(_0x233544){while(--_0x233544){_0x128b60['push'](_0x128b60['shift']());}};_0x2135db(++_0x55b192);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fd5bd6f..989931f 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb10b,0x12a));var _0xbb10=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0xb10b[_0x174202];return _0x4daa4a;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xb10b,0x12a));var _0xbb10=function(_0x49d7c8,_0x52d9a3){_0x49d7c8=_0x49d7c8-0x0;var _0x450089=_0xb10b[_0x49d7c8];return _0x450089;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 1938b09..5bb6027 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 _0xc23c=['catch','ShowSquareProject','getMailAccountById','ShowMailAccount','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0xc23c,0x120));var _0xcc23=function(_0x4e9466,_0x290606){_0x4e9466=_0x4e9466-0x0;var _0x5e8099=_0xc23c[_0x4e9466];return _0x5e8099;};'use strict';var BPromise=require(_0xcc23('0x0'));var moment=require(_0xcc23('0x1'));var _=require(_0xcc23('0x2'));var util=require(_0xcc23('0x3'));var jayson=require(_0xcc23('0x4'));var client=jayson[_0xcc23('0x5')][_0xcc23('0x6')]({'port':0x2329});function request(_0x3f1cc3,_0x3d849d){return new BPromise(function(_0x188ae1,_0x14eb8b){return client[_0xcc23('0x7')](_0x3f1cc3,_0x3d849d)[_0xcc23('0x8')](function(_0x27ac62){if(_0x27ac62[_0xcc23('0x9')]){return _0x14eb8b(_0x27ac62[_0xcc23('0x9')][_0xcc23('0xa')]);}else{return _0x188ae1(_0x27ac62[_0xcc23('0xb')]);}})[_0xcc23('0xc')](function(_0x47dbb4){return _0x14eb8b(_0x47dbb4);});});}exports['getSquareProject']=function(_0x34b55c){return request(_0xcc23('0xd'),{'options':{'raw':![],'where':{'name':_0x34b55c},'attributes':['production']}});};exports[_0xcc23('0xe')]=function(_0x45a1c0){return request(_0xcc23('0xf'),{'options':{'raw':![],'where':{'id':_0x45a1c0},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0xcc23('0x10'),_0xcc23('0x11')]}});};exports[_0xcc23('0x12')]=function(_0xf85645){return request('ShowSquareProject',{'options':{'where':{'id':_0xf85645},'attributes':[_0xcc23('0x10')]}});};exports[_0xcc23('0x13')]=function(_0x1576cc){return request(_0xcc23('0x14'),{'options':{'where':{'id':_0x1576cc},'attributes':[_0xcc23('0x10')]}});};exports[_0xcc23('0x15')]=function(_0x4565e5){return request(_0xcc23('0x16'),{'options':{'where':{'id':_0x4565e5},'attributes':['name']}});};exports[_0xcc23('0x17')]=function(_0x5cc555){return request(_0xcc23('0x18'),{'options':{'where':{'id':_0x5cc555},'attributes':[_0xcc23('0x19')]}});};exports[_0xcc23('0x1a')]=function(_0xb4d3f0){return request('ShowUser',{'options':{'where':{'id':_0xb4d3f0},'attributes':['name']}});};exports[_0xcc23('0x1b')]=function(_0x39417f){return request(_0xcc23('0x1c'),{'options':{'where':{'id':_0x39417f},'attributes':[_0xcc23('0x10')]}});};exports[_0xcc23('0x1d')]=function(_0x2a2ece){return request(_0xcc23('0x1e'),{'options':{'where':{'id':_0x2a2ece},'attributes':[_0xcc23('0x1f')]}});};exports['getIntervalById']=function(_0xc2d50c){return request(_0xcc23('0x20'),{'options':{'raw':![],'where':{'id':_0xc2d50c},'include':[{'model':_0xcc23('0x21'),'as':_0xcc23('0x22')}]}});};exports[_0xcc23('0x23')]=function(_0x36270f){return request(_0xcc23('0x24'),{'options':{'where':{'id':_0x36270f},'attributes':['id',_0xcc23('0x10')]}});};exports['createSmsMessage']=function(_0x17d1c3){return request(_0xcc23('0x25'),{'body':_0x17d1c3});};exports['createSquareDetailsReport']=function(_0x2a80a1){return request(_0xcc23('0x26'),{'body':_0x2a80a1});};exports[_0xcc23('0x27')]=function(_0x372164){return request(_0xcc23('0x28'),{'body':_['merge'](_0x372164,{'project_name':_0x372164[_0xcc23('0x29')],'prev_project_name':_0x372164[_0xcc23('0x2a')]||'','is_subproject':_0x372164['arg_2']?!![]:![],'leaveAt':moment()[_0xcc23('0x2b')](_0xcc23('0x2c'))})});};exports[_0xcc23('0x2d')]=function(_0x1a1c89){return request(_0xcc23('0x2e'),{'body':_0x1a1c89});};exports[_0xcc23('0x2f')]=function(_0x17a9ba){return request(_0xcc23('0x30'),{'body':_0x17a9ba});};exports[_0xcc23('0x31')]=function(_0x3dcc6c){return request(_0xcc23('0x32'),{'options':{'raw':![],'where':{'phone':_0x3dcc6c[_0xcc23('0x33')],'ListId':_0x3dcc6c[_0xcc23('0x34')]}}})[_0xcc23('0x8')](function(_0x45a962){if(_0x45a962){return _0x45a962;}return request('CreateCmContact',{'body':_0x3dcc6c});});};exports[_0xcc23('0x35')]=function(_0x2bdf58){return request(_0xcc23('0x36'),{'options':{'where':{'id':_0x2bdf58},'attributes':['name']}});};exports[_0xcc23('0x37')]=function(_0x378da4,_0x3ec8e3){return request('LoginUser',{'body':{'interface':_0x3ec8e3},'options':{'where':_0x378da4}});};exports[_0xcc23('0x38')]=function(_0x3b72eb,_0xe691ee,_0x34d5c6){return request('PauseUser',{'body':{'type':_0xe691ee,'uniqueid':_0x34d5c6},'options':{'where':_0x3b72eb}});};exports[_0xcc23('0x39')]=function(_0xa88705){return request('UnpauseUser',{'body':{},'options':{'where':_0xa88705}});};exports[_0xcc23('0x3a')]=function(_0x38233f){return request(_0xcc23('0x3b'),{'body':{},'options':{'where':_0x38233f}});}; \ No newline at end of file +var _0x7d1f=['ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','request','error','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x7d1f,0x10f));var _0xf7d1=function(_0x391714,_0x249b14){_0x391714=_0x391714-0x0;var _0xf29811=_0x7d1f[_0x391714];return _0xf29811;};'use strict';var BPromise=require(_0xf7d1('0x0'));var moment=require(_0xf7d1('0x1'));var _=require(_0xf7d1('0x2'));var util=require(_0xf7d1('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xf7d1('0x4')]['http']({'port':0x2329});function request(_0x2dc23e,_0x547da2){return new BPromise(function(_0x5bcef6,_0xe6e78){return client[_0xf7d1('0x5')](_0x2dc23e,_0x547da2)['then'](function(_0x5edc59){if(_0x5edc59[_0xf7d1('0x6')]){return _0xe6e78(_0x5edc59['error']['message']);}else{return _0x5bcef6(_0x5edc59[_0xf7d1('0x7')]);}})['catch'](function(_0x486cf5){return _0xe6e78(_0x486cf5);});});}exports[_0xf7d1('0x8')]=function(_0x38e386){return request(_0xf7d1('0x9'),{'options':{'raw':![],'where':{'name':_0x38e386},'attributes':['production']}});};exports[_0xf7d1('0xa')]=function(_0x46120b){return request(_0xf7d1('0xb'),{'options':{'raw':![],'where':{'id':_0x46120b},'include':[{'model':_0xf7d1('0xc'),'as':_0xf7d1('0xd')}],'attributes':['id',_0xf7d1('0xe'),_0xf7d1('0xf')]}});};exports[_0xf7d1('0x10')]=function(_0x1f3dc6){return request(_0xf7d1('0x9'),{'options':{'where':{'id':_0x1f3dc6},'attributes':[_0xf7d1('0xe')]}});};exports['getVoiceQueueById']=function(_0x98fb45){return request(_0xf7d1('0x11'),{'options':{'where':{'id':_0x98fb45},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x12')]=function(_0x31fe26){return request(_0xf7d1('0x13'),{'options':{'where':{'id':_0x31fe26},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x14')]=function(_0x4bc028){return request(_0xf7d1('0x15'),{'options':{'where':{'id':_0x4bc028},'attributes':[_0xf7d1('0x16')]}});};exports[_0xf7d1('0x17')]=function(_0x4c8e4d){return request(_0xf7d1('0x18'),{'options':{'where':{'id':_0x4c8e4d},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x19')]=function(_0x399d92){return request(_0xf7d1('0x1a'),{'options':{'where':{'id':_0x399d92},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x1b')]=function(_0x38106c){return request(_0xf7d1('0x1c'),{'options':{'where':{'id':_0x38106c},'attributes':[_0xf7d1('0x1d')]}});};exports[_0xf7d1('0x1e')]=function(_0xdd2b10){return request(_0xf7d1('0x1f'),{'options':{'raw':![],'where':{'id':_0xdd2b10},'include':[{'model':_0xf7d1('0x20'),'as':_0xf7d1('0x21')}]}});};exports[_0xf7d1('0x22')]=function(_0x30419d){return request(_0xf7d1('0x23'),{'options':{'where':{'id':_0x30419d},'attributes':['id','name']}});};exports[_0xf7d1('0x24')]=function(_0x5b5848){return request(_0xf7d1('0x25'),{'body':_0x5b5848});};exports[_0xf7d1('0x26')]=function(_0x499980){return request('CreateSquareDetailsReport',{'body':_0x499980});};exports[_0xf7d1('0x27')]=function(_0x38ecf2){return request(_0xf7d1('0x28'),{'body':_[_0xf7d1('0x29')](_0x38ecf2,{'project_name':_0x38ecf2[_0xf7d1('0x2a')],'prev_project_name':_0x38ecf2[_0xf7d1('0x2b')]||'','is_subproject':_0x38ecf2[_0xf7d1('0x2b')]?!![]:![],'leaveAt':moment()[_0xf7d1('0x2c')](_0xf7d1('0x2d'))})});};exports[_0xf7d1('0x2e')]=function(_0x2f90bc){return request(_0xf7d1('0x2f'),{'body':_0x2f90bc});};exports['createSquareMessage']=function(_0x313f61){return request(_0xf7d1('0x30'),{'body':_0x313f61});};exports[_0xf7d1('0x31')]=function(_0x692ca9){return request(_0xf7d1('0x32'),{'options':{'raw':![],'where':{'phone':_0x692ca9['phone'],'ListId':_0x692ca9['ListId']}}})['then'](function(_0x431827){if(_0x431827){return _0x431827;}return request(_0xf7d1('0x33'),{'body':_0x692ca9});});};exports['getPauseById']=function(_0x2dace7){return request('ShowPause',{'options':{'where':{'id':_0x2dace7},'attributes':[_0xf7d1('0xe')]}});};exports[_0xf7d1('0x34')]=function(_0x1d93b9,_0x54b3e1){return request(_0xf7d1('0x35'),{'body':{'interface':_0x54b3e1},'options':{'where':_0x1d93b9}});};exports['agentPause']=function(_0x4c6cc4,_0x109344,_0x5bdfeb){return request(_0xf7d1('0x36'),{'body':{'type':_0x109344,'uniqueid':_0x5bdfeb},'options':{'where':_0x4c6cc4}});};exports[_0xf7d1('0x37')]=function(_0xbf915a){return request(_0xf7d1('0x38'),{'body':{},'options':{'where':_0xbf915a}});};exports[_0xf7d1('0x39')]=function(_0x54d91e){return request(_0xf7d1('0x3a'),{'body':{},'options':{'where':_0x54d91e}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 138ae4c..37e6ae8 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 _0x2bc6=['exports','./polly','./lex'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2bc6,0x163));var _0x62bc=function(_0x47b908,_0x2fa01e){_0x47b908=_0x47b908-0x0;var _0x4a9b9b=_0x2bc6[_0x47b908];return _0x4a9b9b;};var polly=require(_0x62bc('0x0'));var lex=require(_0x62bc('0x1'));module[_0x62bc('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xcb99=['exports','./polly'];(function(_0x1fdaff,_0x13e5bb){var _0x20cf91=function(_0xbb93b9){while(--_0xbb93b9){_0x1fdaff['push'](_0x1fdaff['shift']());}};_0x20cf91(++_0x13e5bb);}(_0xcb99,0x8b));var _0x9cb9=function(_0x36a073,_0x2ce3ce){_0x36a073=_0x36a073-0x0;var _0xc9762b=_0xcb99[_0x36a073];return _0xc9762b;};var polly=require(_0x9cb9('0x0'));var lex=require('./lex');module[_0x9cb9('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index df663dc..9d51372 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 _0xb469=['exports','./lib/api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb469,0x13b));var _0x9b46=function(_0x4f031a,_0x2bc6e9){_0x4f031a=_0x4f031a-0x0;var _0x37c43f=_0xb469[_0x4f031a];return _0x37c43f;};'use strict';var lex=require(_0x9b46('0x0'));module[_0x9b46('0x1')]=function(_0x2d18d9,_0x34f477,_0x1a41e8,_0x895347,_0x9212ae,_0x52f688){return lex(_0x2d18d9,_0x34f477,_0x1a41e8,_0x895347,_0x9212ae,_0x52f688);}; \ No newline at end of file +var _0x8eeb=['./lib/api'];(function(_0x202cf2,_0x175408){var _0x4c9388=function(_0x2dd09e){while(--_0x2dd09e){_0x202cf2['push'](_0x202cf2['shift']());}};_0x4c9388(++_0x175408);}(_0x8eeb,0x183));var _0xb8ee=function(_0x498411,_0x29bae3){_0x498411=_0x498411-0x0;var _0x4a9f68=_0x8eeb[_0x498411];return _0x4a9f68;};'use strict';var lex=require(_0xb8ee('0x0'));module['exports']=function(_0x464dec,_0x2b3ac1,_0x4cb601,_0x29c63e,_0x2ca97d,_0x42df81){return lex(_0x464dec,_0x2b3ac1,_0x4cb601,_0x29c63e,_0x2ca97d,_0x42df81);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index d329642..24d6a00 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 _0x1c36=['slot_','LexRuntime','$LATEST','postText','slots','hasOwnProperty'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x1c36,0xbd));var _0x61c3=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x1c36[_0x255d5b];return _0x3e141a;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x1c915e,_0x28b7d0){return new BPromise(function(_0x1a89f8,_0x5337fd){_0x1c915e[_0x61c3('0x0')](_0x28b7d0,function(_0x1f1558,_0x344a14){if(_0x1f1558){_0x5337fd(_0x1f1558);}if(_0x344a14['slots']){for(const _0x3be4e1 in _0x344a14[_0x61c3('0x1')]){if(_0x344a14['slots'][_0x61c3('0x2')](_0x3be4e1)){var _0x3103d2=_0x344a14[_0x61c3('0x1')][_0x3be4e1];_0x344a14[_0x61c3('0x3')+_0x3be4e1]=_0x3103d2;}}}_0x1a89f8(_0x344a14);});});}module['exports']=function(_0x359519,_0x394819,_0x500ac4,_0x2b2258,_0x6b95b9,_0x1a471){var _0xeca255=new AWS[(_0x61c3('0x4'))]({'accessKeyId':_0x394819,'secretAccessKey':_0x500ac4,'region':_0x2b2258});var _0x5caf93={'botAlias':_0x61c3('0x5'),'botName':_0x1a471,'inputText':_0x6b95b9,'userId':_0x359519};return lexResult(_0xeca255,_0x5caf93);}; \ No newline at end of file +var _0x084b=['exports','LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x45513e,_0x433f83){var _0x59331f=function(_0x3d2c8c){while(--_0x3d2c8c){_0x45513e['push'](_0x45513e['shift']());}};_0x59331f(++_0x433f83);}(_0x084b,0x7a));var _0xb084=function(_0x570878,_0x4fc7de){_0x570878=_0x570878-0x0;var _0x43397a=_0x084b[_0x570878];return _0x43397a;};'use strict';var BPromise=require(_0xb084('0x0'));var AWS=require(_0xb084('0x1'));function lexResult(_0x46a9e7,_0x522ed8){return new BPromise(function(_0x20472d,_0x2a0eb9){_0x46a9e7['postText'](_0x522ed8,function(_0xd67cfe,_0x105298){if(_0xd67cfe){_0x2a0eb9(_0xd67cfe);}if(_0x105298[_0xb084('0x2')]){for(const _0x306dc2 in _0x105298['slots']){if(_0x105298['slots'][_0xb084('0x3')](_0x306dc2)){var _0x26bbb1=_0x105298[_0xb084('0x2')][_0x306dc2];_0x105298['slot_'+_0x306dc2]=_0x26bbb1;}}}_0x20472d(_0x105298);});});}module[_0xb084('0x4')]=function(_0x5e61db,_0x34ab47,_0x387c72,_0x4c664e,_0x2e763d,_0x3e8630){var _0x459de6=new AWS[(_0xb084('0x5'))]({'accessKeyId':_0x34ab47,'secretAccessKey':_0x387c72,'region':_0x4c664e});var _0x293799={'botAlias':'$LATEST','botName':_0x3e8630,'inputText':_0x2e763d,'userId':_0x5e61db};return lexResult(_0x459de6,_0x293799);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 9471688..2a18762 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 _0x4d08=['./lib/api'];(function(_0x2b2ac8,_0x22f79a){var _0x5cd081=function(_0x31155d){while(--_0x31155d){_0x2b2ac8['push'](_0x2b2ac8['shift']());}};_0x5cd081(++_0x22f79a);}(_0x4d08,0x66));var _0x84d0=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x4d08[_0x1a21ff];return _0x25afc1;};'use strict';var polly=require(_0x84d0('0x0'));module['exports']=function(_0x4dc7a1,_0x9bd2c1,_0x7c323,_0x4f08b6,_0x8824d5,_0x2efe30,_0x5e6083){return polly(_0x4dc7a1,_0x9bd2c1,_0x7c323,_0x4f08b6,_0x8824d5,_0x2efe30,_0x5e6083);}; \ No newline at end of file +var _0xa092=['./lib/api','exports'];(function(_0x4d3835,_0x4f5f50){var _0x823439=function(_0x25a5c6){while(--_0x25a5c6){_0x4d3835['push'](_0x4d3835['shift']());}};_0x823439(++_0x4f5f50);}(_0xa092,0xbe));var _0x2a09=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xa092[_0x35885a];return _0xe86249;};'use strict';var polly=require(_0x2a09('0x0'));module[_0x2a09('0x1')]=function(_0x550da2,_0xcea217,_0x3e9ad4,_0x4c61d8,_0x5db3bf,_0x546fe7,_0x54f2f5){return polly(_0x550da2,_0xcea217,_0x3e9ad4,_0x4c61d8,_0x5db3bf,_0x546fe7,_0x54f2f5);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 5c8ce4b..09ec76b 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 _0x70b1=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','bluebird','randomstring'];(function(_0x16dd8f,_0x453e17){var _0x2d4c7b=function(_0x49af70){while(--_0x49af70){_0x16dd8f['push'](_0x16dd8f['shift']());}};_0x2d4c7b(++_0x453e17);}(_0x70b1,0x11e));var _0x170b=function(_0x210d3,_0x2ed879){_0x210d3=_0x210d3-0x0;var _0x5612df=_0x70b1[_0x210d3];return _0x5612df;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x170b('0x0'));var rs=require(_0x170b('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x286e36,_0x466c36,_0x37d02c){return new BPromise(function(_0x4a6e5b,_0x51b3dd){_0x286e36[_0x170b('0x2')](_0x466c36,function(_0x1fac9d,_0x4a1a23){if(_0x1fac9d){_0x51b3dd(_0x1fac9d);}else if(_0x4a1a23){if(_0x4a1a23[_0x170b('0x3')]instanceof Buffer){fs[_0x170b('0x4')](_0x37d02c,_0x4a1a23[_0x170b('0x3')],function(_0x251546){if(_0x251546){_0x51b3dd(_0x251546);}else{_0x4a6e5b();}});}else{_0x51b3dd(new Error(_0x170b('0x5')));}}else{_0x51b3dd(new Error(_0x170b('0x6')));}});});}module['exports']=function(_0x15eac4,_0x23a6a8,_0x36f430,_0x1a4806,_0x3c7266,_0x2fc50a,_0x59a824){var _0x577a2f=new AWS[(_0x170b('0x7'))]({'accessKeyId':_0x15eac4,'secretAccessKey':_0x23a6a8,'region':_0x36f430});var _0x130462={'Text':_0x3c7266,'TextType':_0x2fc50a||'text','OutputFormat':'mp3','VoiceId':_0x1a4806};return pollyResult(_0x577a2f,_0x130462,_0x59a824);}; \ No newline at end of file +var _0xb7d9=['exports','Polly','text','mp3','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x32cce8,_0x18762f){var _0x4a732b=function(_0x5a3a21){while(--_0x5a3a21){_0x32cce8['push'](_0x32cce8['shift']());}};_0x4a732b(++_0x18762f);}(_0xb7d9,0xd5));var _0x9b7d=function(_0x26236f,_0x36916c){_0x26236f=_0x26236f-0x0;var _0x11c59f=_0xb7d9[_0x26236f];return _0x11c59f;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9b7d('0x0'));var rs=require(_0x9b7d('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x5160f1,_0x3053f8,_0x4a9931){return new BPromise(function(_0x594a78,_0x545888){_0x5160f1[_0x9b7d('0x2')](_0x3053f8,function(_0x106750,_0x4a54ad){if(_0x106750){_0x545888(_0x106750);}else if(_0x4a54ad){if(_0x4a54ad['AudioStream']instanceof Buffer){fs[_0x9b7d('0x3')](_0x4a9931,_0x4a54ad[_0x9b7d('0x4')],function(_0x3a5a03){if(_0x3a5a03){_0x545888(_0x3a5a03);}else{_0x594a78();}});}else{_0x545888(new Error(_0x9b7d('0x5')));}}else{_0x545888(new Error(_0x9b7d('0x6')));}});});}module[_0x9b7d('0x7')]=function(_0xf3a8fc,_0x1e769b,_0x4110e4,_0x2b03c6,_0x13ca00,_0x2423b2,_0x74eca3){var _0xf2a9e7=new AWS[(_0x9b7d('0x8'))]({'accessKeyId':_0xf3a8fc,'secretAccessKey':_0x1e769b,'region':_0x4110e4});var _0x137174={'Text':_0x13ca00,'TextType':_0x2423b2||_0x9b7d('0x9'),'OutputFormat':_0x9b7d('0xa'),'VoiceId':_0x2b03c6};return pollyResult(_0xf2a9e7,_0x137174,_0x74eca3);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index b81d27d..d08e8a0 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 _0xb5b7=['exports'];(function(_0x3433ad,_0x4a5dcb){var _0x52d586=function(_0xa158c8){while(--_0xa158c8){_0x3433ad['push'](_0x3433ad['shift']());}};_0x52d586(++_0x4a5dcb);}(_0xb5b7,0x11a));var _0x7b5b=function(_0x4efa59,_0x58a514){_0x4efa59=_0x4efa59-0x0;var _0x5ba9c1=_0xb5b7[_0x4efa59];return _0x5ba9c1;};'use strict';var asr=require('./lib/api');module[_0x7b5b('0x0')]=function(_0x240114,_0x535f17,_0x48f995,_0x304f7b){return asr(_0x240114,_0x535f17,_0x48f995);}; \ No newline at end of file +var _0x61ee=['./lib/api','exports'];(function(_0x5514eb,_0x49abef){var _0x44b07d=function(_0x4a57cf){while(--_0x4a57cf){_0x5514eb['push'](_0x5514eb['shift']());}};_0x44b07d(++_0x49abef);}(_0x61ee,0x1ac));var _0xe61e=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x61ee[_0x59ae8f];return _0x3900b5;};'use strict';var asr=require(_0xe61e('0x0'));module[_0xe61e('0x1')]=function(_0x5c030c,_0x383898,_0x58768d,_0x126e67){return asr(_0x5c030c,_0x383898,_0x58768d);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 6113c36..a9ed9e2 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 _0x2bd8=['filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x31132e,_0x45d964){var _0x41dea6=function(_0x2c5e43){while(--_0x2c5e43){_0x31132e['push'](_0x31132e['shift']());}};_0x41dea6(++_0x45d964);}(_0x2bd8,0x1ba));var _0x82bd=function(_0x4bb409,_0x241cc4){_0x4bb409=_0x4bb409-0x0;var _0x2ef7d4=_0x2bd8[_0x4bb409];return _0x2ef7d4;};'use strict';var url=require(_0x82bd('0x0'));var BPromise=require(_0x82bd('0x1'));var fs=require('fs');var host=_0x82bd('0x2');module[_0x82bd('0x3')]=function(_0x3f8d99,_0x3f3c13,_0x1c9538){return new BPromise(function(_0x379bb1,_0x3bf48b){var _0x3cecad;if(typeof _0x3f8d99!==_0x82bd('0x4')||_0x3f8d99[_0x82bd('0x5')]===0x0){return _0x3bf48b(_0x82bd('0x6'));}if(typeof _0x3f3c13!==_0x82bd('0x4')||_0x3f3c13['length']===0x0){return _0x3bf48b('key\x20should\x20be\x20a\x20string');}if(typeof _0x1c9538!==_0x82bd('0x7')&&(typeof _0x1c9538!=='string'||_0x1c9538[_0x82bd('0x5')]===0x0)){return _0x3bf48b(_0x82bd('0x8'));}try{_0x3cecad=fs[_0x82bd('0x9')](_0x3f8d99)['toString'](_0x82bd('0xa'));}catch(_0x1a2cbb){return _0x3bf48b(_0x1a2cbb);}return _0x379bb1({'method':_0x82bd('0xb'),'uri':host+_0x82bd('0xc')+_0x3f3c13,'body':{'config':{'encoding':_0x82bd('0xd'),'sampleRateHertz':'8000','languageCode':_0x1c9538},'audio':{'content':_0x3cecad}},'json':!![]});});}; \ No newline at end of file +var _0xa609=['readFileSync','toString','base64','POST','8000','bluebird','string','length','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xa609,0x7d));var _0x9a60=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa609[_0x502c7d];return _0x30b7ed;};'use strict';var url=require('url');var BPromise=require(_0x9a60('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x3c9d1a,_0x35cd5e,_0x5dedd0){return new BPromise(function(_0x466d4a,_0x167441){var _0x4b7f2d;if(typeof _0x3c9d1a!==_0x9a60('0x1')||_0x3c9d1a[_0x9a60('0x2')]===0x0){return _0x167441('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x35cd5e!==_0x9a60('0x1')||_0x35cd5e['length']===0x0){return _0x167441('key\x20should\x20be\x20a\x20string');}if(typeof _0x5dedd0!==_0x9a60('0x3')&&(typeof _0x5dedd0!==_0x9a60('0x1')||_0x5dedd0[_0x9a60('0x2')]===0x0)){return _0x167441(_0x9a60('0x4'));}try{_0x4b7f2d=fs[_0x9a60('0x5')](_0x3c9d1a)[_0x9a60('0x6')](_0x9a60('0x7'));}catch(_0x54bc3b){return _0x167441(_0x54bc3b);}return _0x466d4a({'method':_0x9a60('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x35cd5e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x9a60('0x9'),'languageCode':_0x5dedd0},'audio':{'content':_0x4b7f2d}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 210b306..c8cb640 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 _0xf221=['exports','./asr'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf221,0x131));var _0x1f22=function(_0x5d51b5,_0xafd87c){_0x5d51b5=_0x5d51b5-0x0;var _0x4714ba=_0xf221[_0x5d51b5];return _0x4714ba;};var asr=require(_0x1f22('0x0'));module[_0x1f22('0x1')]={'asr':asr}; \ No newline at end of file +var _0xeb3b=['./asr','exports'];(function(_0x47a73a,_0x47c476){var _0x493c3f=function(_0x2cec8e){while(--_0x2cec8e){_0x47a73a['push'](_0x47a73a['shift']());}};_0x493c3f(++_0x47c476);}(_0xeb3b,0x19e));var _0xbeb3=function(_0xb4e2df,_0x1cbb7c){_0xb4e2df=_0xb4e2df-0x0;var _0x5e95ba=_0xeb3b[_0xb4e2df];return _0x5e95ba;};var asr=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 00551e5..bdce46c 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 _0x9a47=['googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','agi','https:','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','protocol','host','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','utf8','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','stringify','jQ1olc','null','generic','log','TRY\x20TO\x20GET2','RET:','RET\x20slic:','slice','AFTER\x20SLICE','ERR','\x22\x20might\x20not\x20exist','REPONSE2','desdt','goggleTTS\x20path','asr','uri','results','map','transcript','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0x9a47,0x14c));var _0x79a4=function(_0x322ce6,_0x5070a9){_0x322ce6=_0x322ce6-0x0;var _0x3e9d62=_0x9a47[_0x322ce6];return _0x3e9d62;};'use strict';var apiai=require(_0x79a4('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x79a4('0x1'));var fs=require('fs');var http=require(_0x79a4('0x2'));var https=require(_0x79a4('0x3'));var md5=require(_0x79a4('0x4'));var path=require(_0x79a4('0x5'));var querystring=require('querystring');var rp=require(_0x79a4('0x6'));var rs=require(_0x79a4('0x7'));var sox=require(_0x79a4('0x8'));var tts=require(_0x79a4('0x9'));var urlParse=require(_0x79a4('0xa'))[_0x79a4('0xb')];var util=require(_0x79a4('0xc'));var aws=require(_0x79a4('0xd'));var google=require('./google');var sestek=require(_0x79a4('0xe'));var tilde=require(_0x79a4('0xf'));var logger=require('../../../config/logger')(_0x79a4('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x40f549,_0x4f8f6d){return new BPromise(function(_0x5dbfe3,_0x61e51c){var _0x27c7e0=urlParse(_0x40f549);var _0x254a00=_0x27c7e0['protocol']===_0x79a4('0x11')?https:http;var _0x37df8b={'host':_0x27c7e0['host'],'path':_0x27c7e0['path'],'headers':{'user-agent':_0x79a4('0x12')}};_0x254a00[_0x79a4('0x13')](_0x37df8b,function(_0x1bdcc0){if(_0x1bdcc0['statusCode']!==0xc8){logger[_0x79a4('0x14')](_0x79a4('0x15')+_0x40f549+'\x20failed,\x20status\x20code\x20=\x20'+_0x1bdcc0[_0x79a4('0x16')]+'\x20('+_0x1bdcc0[_0x79a4('0x17')]+')');_0x61e51c(new Error(_0x79a4('0x15')+_0x40f549+_0x79a4('0x18')+_0x1bdcc0[_0x79a4('0x16')]+'\x20('+_0x1bdcc0['statusMessage']+')'));return;}var _0x2fe1b2=fs[_0x79a4('0x19')](_0x4f8f6d);_0x2fe1b2['on'](_0x79a4('0x1a'),function(){logger[_0x79a4('0x1b')](_0x79a4('0x1c'));_0x2fe1b2[_0x79a4('0x1d')](_0x5dbfe3);});_0x2fe1b2['on'](_0x79a4('0x14'),function(_0x446358){fs[_0x79a4('0x1e')](_0x4f8f6d);logger[_0x79a4('0x14')]('download\x20error',_0x446358);_0x61e51c(_0x446358);});_0x1bdcc0[_0x79a4('0x1f')](_0x2fe1b2);})['on']('error',function(_0x158b7b){logger['error'](_0x158b7b);_0x61e51c(_0x158b7b);})[_0x79a4('0x20')]();});}function uploadFile(_0x4a02c4){return new BPromise(function(_0x379b09,_0x1b72a8){var _0x42118c=urlParse(_0x4a02c4);var _0x477ed0=_0x42118c[_0x79a4('0x21')]===_0x79a4('0x11')?https:http;var _0x471c6={'host':_0x42118c[_0x79a4('0x22')],'path':_0x42118c[_0x79a4('0x5')],'headers':{'user-agent':_0x79a4('0x12')}};_0x477ed0['get'](_0x471c6,function(_0x39fefe){if(_0x39fefe[_0x79a4('0x16')]!==0xc8){_0x1b72a8(new Error('request\x20to\x20'+_0x4a02c4+_0x79a4('0x18')+_0x39fefe[_0x79a4('0x16')]+'\x20('+_0x39fefe[_0x79a4('0x17')]+')'));return;}var _0x3839c2='';_0x39fefe['on'](_0x79a4('0x23'),function(_0x3017db){_0x3839c2+=_0x3017db;});_0x39fefe['on'](_0x79a4('0x20'),function(){_0x379b09(_0x3839c2);});})['on'](_0x79a4('0x14'),function(_0x521449){_0x1b72a8(_0x521449);})[_0x79a4('0x20')]();});}function convertFile(_0x2b44b7,_0x5ad3a9){return new BPromise(function(_0x456283,_0x3c190f){var _0x4d57ac=sox[_0x79a4('0x24')](_0x2b44b7,_0x5ad3a9,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d57ac['on'](_0x79a4('0x14'),function(_0x118a2c){logger[_0x79a4('0x14')](_0x79a4('0x25'),_0x118a2c);_0x3c190f(_0x118a2c);});_0x4d57ac['on']('end',function(){logger['info'](_0x79a4('0x26'));_0x456283();});_0x4d57ac[_0x79a4('0x27')]();});}function base64Decode(_0x2249ca,_0x5a8957){var _0x298f43=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs['generate'](0x4)+_0x79a4('0x2a'));fs[_0x79a4('0x2b')](_0x298f43,_0x2249ca,_0x79a4('0x2c'));return convertFile(_0x298f43,_0x5a8957)[_0x79a4('0x2d')](function(){try{fs[_0x79a4('0x1e')](_0x298f43);fs[_0x79a4('0x2e')](_0x5a8957,_0x79a4('0x2f'));}catch(_0x91170a){logger[_0x79a4('0x14')](_0x91170a);}return _0x5a8957[_0x79a4('0x30')]('.')[0x0];});}function base64Encode(_0x342d98){var _0x17d5b7=fs[_0x79a4('0x31')](_0x342d98);return new Buffer(_0x17d5b7)['toString'](_0x79a4('0x2c'));}exports[_0x79a4('0x32')]=function(_0x320085,_0xc8b11,_0x5cc6a1,_0x5162c5,_0x1b4f89,_0x285819){var _0x16ee3a,_0x279c29;var _0x4aba31=_0x79a4('0x33');var _0x955631='?key='+_0x320085;var _0x272dcb={};if(_0xc8b11===_0x79a4('0x34')){_0x272dcb[_0x79a4('0x35')]={'ssml':_0x5cc6a1};}else{_0x272dcb[_0x79a4('0x35')]={'text':_0x5cc6a1};};_0x272dcb[_0x79a4('0x36')]={'languageCode':_0x5162c5,'ssmlGender':_0x1b4f89};_0x272dcb[_0x79a4('0x37')]={'audioEncoding':_0x79a4('0x38'),'sampleRateHertz':0x1f40};var _0x3321c5={'url':_0x4aba31+'text:synthesize'+_0x955631,'method':_0x79a4('0x39'),'json':!![],'body':_0x272dcb};return rp(_0x3321c5)['then'](function(_0x523bdf){return new BPromise(function(_0x4f6958,_0x1eddaf){_0x16ee3a=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x3b'));var _0x156f96=Buffer[_0x79a4('0x3c')](_0x523bdf[_0x79a4('0x3d')],_0x79a4('0x2c'));return fs['writeFile'](_0x16ee3a,_0x156f96,function(_0x38c6ae){_0x1eddaf(_0x38c6ae);},function(_0x5e2d4f){fs[_0x79a4('0x2e')](_0x16ee3a,'777');_0x4f6958(_0x5e2d4f);});});})[_0x79a4('0x2d')](function(_0x1ea36e){_0x279c29=path[_0x79a4('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x79a4('0x2a'));return convertFile(_0x16ee3a,_0x279c29);})[_0x79a4('0x2d')](function(){try{fs[_0x79a4('0x1e')](_0x16ee3a);fs[_0x79a4('0x2e')](_0x279c29,_0x79a4('0x2f'));}catch(_0x6a0438){logger[_0x79a4('0x14')](_0x6a0438);}logger[_0x79a4('0x1b')](_0x79a4('0x3e'),_0x279c29['split']('.')[0x0]);return _0x279c29[_0x79a4('0x30')]('.')[0x0];});};exports[_0x79a4('0x3f')]=function(_0x45733b,_0xa93022){var _0x240848,_0x4084eb;var _0x336e4e;var _0x4cb4b8={'encoding':_0x79a4('0x40'),'method':_0x79a4('0x39'),'timeout':0x2710,'url':_0x79a4('0x41'),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x79a4('0x42')]([[[_0x79a4('0x43'),JSON['stringify']([_0x45733b,_0xa93022||'en-US',![],_0x79a4('0x44')]),null,_0x79a4('0x45')]]]))};console[_0x79a4('0x46')](_0x79a4('0x47'),_0x4cb4b8);return rp(_0x4cb4b8)[_0x79a4('0x2d')](function(_0x58ede9){console['log'](_0x79a4('0x48'),_0x58ede9);try{console[_0x79a4('0x46')](_0x79a4('0x49'),_0x58ede9[_0x79a4('0x4a')](0x5));console[_0x79a4('0x46')]('eval\x20RET\x20slic:',eval(_0x58ede9[_0x79a4('0x4a')](0x5))[0x0][0x2]);_0x336e4e=eval(_0x58ede9[_0x79a4('0x4a')](0x5))[0x0][0x2];console[_0x79a4('0x46')](_0x79a4('0x4b'),_0x336e4e);}catch(_0x260bd6){console[_0x79a4('0x46')](_0x79a4('0x4c'),_0x260bd6);throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}if(!_0x336e4e){throw new Error('lang\x20\x22'+lang+_0x79a4('0x4d'));}try{_0x336e4e=eval(_0x336e4e)[0x0];}catch(_0x2a7f76){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x79a4('0x23')]);}console[_0x79a4('0x46')](_0x79a4('0x4e'),_0x336e4e);const _0x1427c4=_0x336e4e;console['log']('buffer2',_0x1427c4);_0x240848=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x3b'));console[_0x79a4('0x46')]('filepath',_0x240848);fs[_0x79a4('0x2b')](_0x240848,_0x336e4e,{'encoding':_0x79a4('0x2c')});_0x4084eb=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+'.wav');console[_0x79a4('0x46')]('desdt',_0x4084eb);return convertFile(_0x240848,_0x4084eb);})['then'](function(){try{console[_0x79a4('0x46')](_0x79a4('0x4f'),_0x4084eb);fs[_0x79a4('0x2e')](_0x4084eb,_0x79a4('0x2f'));}catch(_0xfe3e7d){logger['error'](_0xfe3e7d);}logger[_0x79a4('0x1b')](_0x79a4('0x50'),_0x4084eb[_0x79a4('0x30')]('.')[0x0]);console[_0x79a4('0x46')]('destination\x20ended\x202\x20da\x20gen',_0x4084eb[_0x79a4('0x30')]('.')[0x0]);return _0x4084eb['split']('.')[0x0];});};exports['googleASR']=function(_0x12f309,_0x548fa0,_0x192eed){return google[_0x79a4('0x51')](_0x12f309,_0x548fa0,_0x192eed)['then'](function(_0x822475){logger[_0x79a4('0x1b')](_0x822475[_0x79a4('0x52')]);return rp(_0x822475);})[_0x79a4('0x2d')](function(_0x5cfc20){var _0x3b448e='';var _0x4c57d8=0x0;try{fs[_0x79a4('0x1e')](_0x12f309);}catch(_0x638f52){logger[_0x79a4('0x14')](_0x638f52);}if(_0x5cfc20&&_0x5cfc20[_0x79a4('0x53')]){_0x3b448e=_0x5cfc20['results'][_0x79a4('0x54')](function(_0x2d3fa9){return _0x2d3fa9&&_0x2d3fa9['alternatives'][0x0]&&_0x2d3fa9['alternatives'][0x0][_0x79a4('0x55')]?_0x2d3fa9[_0x79a4('0x56')][0x0][_0x79a4('0x55')]:'';})[_0x79a4('0x57')]('\x0a');_0x4c57d8=_0x5cfc20[_0x79a4('0x53')][_0x79a4('0x54')](function(_0x5a06c6){return _0x5a06c6&&_0x5a06c6[_0x79a4('0x56')][0x0]&&_0x5a06c6[_0x79a4('0x56')][0x0][_0x79a4('0x58')]?_0x5a06c6[_0x79a4('0x56')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x79a4('0x1b')](_0x79a4('0x59'),_0x3b448e);logger[_0x79a4('0x1b')](_0x79a4('0x5a'),_0x4c57d8);return{'transcript':_0x3b448e,'confidence':_0x4c57d8};})[_0x79a4('0x5b')](function(_0x122743){logger[_0x79a4('0x14')]('[%s]\x20%s:%s',_0x122743['statusCode'],_0x122743[_0x79a4('0x5c')],_0x122743[_0x79a4('0x5d')]);});};exports[_0x79a4('0x5e')]=function(_0x48fb94,_0x4b9fbe,_0x13a380,_0x12e181){var _0x26bd0a=apiai(_0x4b9fbe,{'language':_0x12e181||'en'});return _0x26bd0a[_0x79a4('0x5f')](_0x13a380,{'sessionId':md5(_0x48fb94)})[_0x79a4('0x2d')](function(_0x3b7751){logger[_0x79a4('0x1b')](JSON[_0x79a4('0x42')](_0x3b7751));return{'source':_0x3b7751['result']['source'],'resolvedQuery':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x61')],'action':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x62')],'actionIncomplete':_0x3b7751['result'][_0x79a4('0x63')],'speech':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x64')][_0x79a4('0x65')],'score':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x66')],'statusCode':_0x3b7751['status'][_0x79a4('0x67')],'endConversation':_0x3b7751[_0x79a4('0x60')]['metadata'][_0x79a4('0x68')]||![],'isFallbackIntent':_0x3b7751[_0x79a4('0x60')]['metadata'][_0x79a4('0x69')]};});};exports[_0x79a4('0x6a')]=function(_0x4eebf3,_0x10ed60,_0x3e32c1,_0x5842f6,_0x130af9,_0x239cd3){var _0x5e5350=_0x5842f6[_0x79a4('0x6b')](/\\n/g,'\x0a');var _0x2c080f={'credentials':{'private_key':_0x5e5350,'client_email':_0x3e32c1}};var _0x3a8986=new dialogflow[(_0x79a4('0x6c'))](_0x2c080f);var _0x40048a=_0x3a8986[_0x79a4('0x6d')](_0x10ed60,md5(_0x4eebf3));var _0x11c262={'session':_0x40048a,'queryInput':{'text':{'text':_0x130af9,'languageCode':_0x239cd3}}};return _0x3a8986[_0x79a4('0x6e')](_0x11c262)[_0x79a4('0x2d')](function(_0x16fa02){if(_0x16fa02&&_0x16fa02[_0x79a4('0x6f')]){logger['info'](_0x79a4('0x70'),JSON[_0x79a4('0x42')](_0x16fa02));var _0x3385b2=_0x16fa02[0x0];if(_0x3385b2){var _0x15a67e={'action':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x62')],'allRequiredParamsPresent':_0x3385b2['queryResult']['allRequiredParamsPresent'],'endConversation':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x72')]&&_0x3385b2[_0x79a4('0x71')][_0x79a4('0x72')][_0x79a4('0x73')]?_0x3385b2[_0x79a4('0x71')][_0x79a4('0x72')]['fields'][_0x79a4('0x74')][_0x79a4('0x75')]:![],'fulfillmentText':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x76')],'intentName':_0x3385b2['queryResult'][_0x79a4('0x77')]['name'],'intentDisplayName':_0x3385b2[_0x79a4('0x71')]['intent']['displayName'],'isFallbackIntent':_0x3385b2[_0x79a4('0x71')]['intent'][_0x79a4('0x78')],'languageCode':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x79')],'queryText':_0x3385b2[_0x79a4('0x71')]['queryText'],'responseId':_0x3385b2['responseId'],'score':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x7a')],'speech':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x76')],'providerResponse':JSON[_0x79a4('0x42')](_0x16fa02)};return _0x15a67e;}}});};exports['tildeASR']=function(_0x56ffb5,_0x532488,_0x494356,_0x4534ab){return tilde['asr'](_0x56ffb5,_0x532488,_0x494356,_0x4534ab)[_0x79a4('0x2d')](function(_0x4aa6f0){try{fs['unlink'](_0x56ffb5);}catch(_0x505eff){logger[_0x79a4('0x14')](_0x505eff);}logger[_0x79a4('0x1b')](_0x79a4('0x7b'),_0x4aa6f0[_0x79a4('0x55')]);logger[_0x79a4('0x1b')](_0x79a4('0x7c'),_0x4aa6f0[_0x79a4('0x58')]);return _0x4aa6f0;});};exports[_0x79a4('0x7d')]=function(_0x45d8a9,_0x4aa6bb,_0x588c58,_0x47d4ae,_0x336f74,_0xa67463){var _0x50383b=path['resolve'](__dirname,_0x79a4('0x29'),rs['generate'](0x4)+_0x79a4('0x3b'));var _0x2539a3;return aws[_0x79a4('0x7e')](_0x45d8a9,_0x4aa6bb,_0x588c58,_0x47d4ae,_0x336f74,_0xa67463,_0x50383b)[_0x79a4('0x2d')](function(){_0x2539a3=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x2a'));return convertFile(_0x50383b,_0x2539a3);})[_0x79a4('0x2d')](function(){try{fs[_0x79a4('0x1e')](_0x50383b);fs[_0x79a4('0x2e')](_0x2539a3,_0x79a4('0x2f'));}catch(_0x241f41){logger[_0x79a4('0x14')](_0x241f41);}return _0x2539a3[_0x79a4('0x30')]('.')[0x0];});};exports[_0x79a4('0x7f')]=function(_0x4861f0,_0x3486af,_0x5f356a,_0x12a64a,_0xd3f367,_0x2cad82){return aws[_0x79a4('0x80')](_0x4861f0,_0x3486af,_0x5f356a,_0x12a64a,_0xd3f367,_0x2cad82)[_0x79a4('0x2d')](function(_0x23d410){logger[_0x79a4('0x1b')](JSON[_0x79a4('0x42')](_0x23d410));return _0x23d410;});};exports[_0x79a4('0x81')]=function(_0x21db80,_0x4c79c0,_0x1d2b80,_0x5748aa){var _0x5abd7e=util[_0x79a4('0x82')](_0x79a4('0x83'),ISPEECH_API,_0x21db80,encodeURIComponent(_0x4c79c0),_0x1d2b80,_0x5748aa);var _0x1521c9=path[_0x79a4('0x28')](__dirname,'tmp',rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x3b'));var _0xf064eb;return downloadFile(_0x5abd7e,_0x1521c9)[_0x79a4('0x2d')](function(){_0xf064eb=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs['generate'](0x4)+_0x79a4('0x2a'));return convertFile(_0x1521c9,_0xf064eb);})[_0x79a4('0x2d')](function(){try{fs['unlink'](_0x1521c9);fs[_0x79a4('0x2e')](_0xf064eb,'777');}catch(_0x49fe4d){logger[_0x79a4('0x14')](_0x49fe4d);}return _0xf064eb[_0x79a4('0x30')]('.')[0x0];});};exports[_0x79a4('0x84')]=function(_0x118fb1,_0x436fc4,_0x3004bc,_0x1b32dd){var _0x339410=util[_0x79a4('0x82')](_0x79a4('0x85'),ISPEECH_API,_0x436fc4,_0x3004bc,base64Encode(_0x118fb1),_0x1b32dd?util[_0x79a4('0x82')]('model=%s',encodeURIComponent(_0x1b32dd)):'freeform=3');return uploadFile(_0x339410)[_0x79a4('0x2d')](function(_0x5ec957){return querystring['parse'](_0x5ec957);});};exports['sestekNDA']=function(_0x1f4370,_0x867322){return sestek[_0x79a4('0x86')](_0x1f4370,_0x867322)[_0x79a4('0x2d')](function(_0x3ee529){logger[_0x79a4('0x1b')](JSON[_0x79a4('0x42')](_0x3ee529));var _0x2c7c7b={'speech':_0x3ee529['text'],'action':_0x3ee529[_0x79a4('0x87')]?_0x3ee529[_0x79a4('0x87')][_0x79a4('0x88')]:undefined,'actiondata':_0x3ee529[_0x79a4('0x87')]?_0x3ee529[_0x79a4('0x87')][_0x79a4('0x89')]:undefined};if(_0x3ee529[_0x79a4('0x87')]&&_0x3ee529['channelData'][_0x79a4('0x8a')]){return base64Decode(_0x3ee529['channelData'][_0x79a4('0x8a')][_0x79a4('0x8b')],path[_0x79a4('0x28')](__dirname,'tmp',rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x2a')))[_0x79a4('0x2d')](function(_0x138d20){_0x2c7c7b[_0x79a4('0x8c')]=_0x138d20;return _0x2c7c7b;});}return _0x2c7c7b;});};exports[_0x79a4('0x8d')]=function(){return __dirname;}; \ No newline at end of file +var _0x29d7=['metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','lex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','md5','querystring','request-promise','randomstring','sox','google-tts-api','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','path','WHAT_EVER','get','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','error','unlink','pipe','end','protocol','request\x20to\x20','data','transcode','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','POST','resolve','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','en-US','null','generic','slice','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','uri','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','speech','score','status'];(function(_0x57ae34,_0x1e8647){var _0x55b4b1=function(_0x4e8e53){while(--_0x4e8e53){_0x57ae34['push'](_0x57ae34['shift']());}};_0x55b4b1(++_0x1e8647);}(_0x29d7,0x1c9));var _0x729d=function(_0x35b793,_0x36e20d){_0x35b793=_0x35b793-0x0;var _0x402572=_0x29d7[_0x35b793];return _0x402572;};'use strict';var apiai=require(_0x729d('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x729d('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x729d('0x2'));var path=require('path');var querystring=require(_0x729d('0x3'));var rp=require(_0x729d('0x4'));var rs=require(_0x729d('0x5'));var sox=require(_0x729d('0x6'));var tts=require(_0x729d('0x7'));var urlParse=require('url')['parse'];var util=require(_0x729d('0x8'));var aws=require(_0x729d('0x9'));var google=require(_0x729d('0xa'));var sestek=require(_0x729d('0xb'));var tilde=require(_0x729d('0xc'));var logger=require(_0x729d('0xd'))(_0x729d('0xe'));var ISPEECH_API=_0x729d('0xf');function downloadFile(_0x424d54,_0x4b65b6){return new BPromise(function(_0x112fd4,_0xe6e2dc){var _0x59c441=urlParse(_0x424d54);var _0x520272=_0x59c441['protocol']===_0x729d('0x10')?https:http;var _0x3fa53c={'host':_0x59c441['host'],'path':_0x59c441[_0x729d('0x11')],'headers':{'user-agent':_0x729d('0x12')}};_0x520272[_0x729d('0x13')](_0x3fa53c,function(_0x2e8ef4){if(_0x2e8ef4[_0x729d('0x14')]!==0xc8){logger['error']('request\x20to\x20'+_0x424d54+'\x20failed,\x20status\x20code\x20=\x20'+_0x2e8ef4[_0x729d('0x14')]+'\x20('+_0x2e8ef4[_0x729d('0x15')]+')');_0xe6e2dc(new Error('request\x20to\x20'+_0x424d54+_0x729d('0x16')+_0x2e8ef4['statusCode']+'\x20('+_0x2e8ef4['statusMessage']+')'));return;}var _0xe64479=fs['createWriteStream'](_0x4b65b6);_0xe64479['on'](_0x729d('0x17'),function(){logger[_0x729d('0x18')](_0x729d('0x19'));_0xe64479[_0x729d('0x1a')](_0x112fd4);});_0xe64479['on'](_0x729d('0x1b'),function(_0x56250e){fs[_0x729d('0x1c')](_0x4b65b6);logger['error']('download\x20error',_0x56250e);_0xe6e2dc(_0x56250e);});_0x2e8ef4[_0x729d('0x1d')](_0xe64479);})['on'](_0x729d('0x1b'),function(_0x14a4a3){logger[_0x729d('0x1b')](_0x14a4a3);_0xe6e2dc(_0x14a4a3);})[_0x729d('0x1e')]();});}function uploadFile(_0x1f848a){return new BPromise(function(_0x4fead7,_0x1a3d9a){var _0x2f79c7=urlParse(_0x1f848a);var _0x2550c3=_0x2f79c7[_0x729d('0x1f')]===_0x729d('0x10')?https:http;var _0x410032={'host':_0x2f79c7['host'],'path':_0x2f79c7[_0x729d('0x11')],'headers':{'user-agent':_0x729d('0x12')}};_0x2550c3['get'](_0x410032,function(_0x282cd6){if(_0x282cd6[_0x729d('0x14')]!==0xc8){_0x1a3d9a(new Error(_0x729d('0x20')+_0x1f848a+_0x729d('0x16')+_0x282cd6['statusCode']+'\x20('+_0x282cd6['statusMessage']+')'));return;}var _0x442f67='';_0x282cd6['on'](_0x729d('0x21'),function(_0x33cf22){_0x442f67+=_0x33cf22;});_0x282cd6['on']('end',function(){_0x4fead7(_0x442f67);});})['on'](_0x729d('0x1b'),function(_0x15035c){_0x1a3d9a(_0x15035c);})[_0x729d('0x1e')]();});}function convertFile(_0x51b399,_0x2cd0e3){return new BPromise(function(_0x1c6e40,_0x5d97db){var _0x53277a=sox[_0x729d('0x22')](_0x51b399,_0x2cd0e3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53277a['on'](_0x729d('0x1b'),function(_0x5d3192){logger[_0x729d('0x1b')](_0x729d('0x23'),_0x5d3192);_0x5d97db(_0x5d3192);});_0x53277a['on']('end',function(){logger[_0x729d('0x18')](_0x729d('0x24'));_0x1c6e40();});_0x53277a[_0x729d('0x25')]();});}function base64Decode(_0x489335,_0x28b19b){var _0x52bdff=path['resolve'](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+_0x729d('0x28'));fs[_0x729d('0x29')](_0x52bdff,_0x489335,'base64');return convertFile(_0x52bdff,_0x28b19b)[_0x729d('0x2a')](function(){try{fs[_0x729d('0x1c')](_0x52bdff);fs[_0x729d('0x2b')](_0x28b19b,_0x729d('0x2c'));}catch(_0x3c1c9d){logger[_0x729d('0x1b')](_0x3c1c9d);}return _0x28b19b[_0x729d('0x2d')]('.')[0x0];});}function base64Encode(_0xf07f12){var _0x47cf9b=fs['readFileSync'](_0xf07f12);return new Buffer(_0x47cf9b)['toString'](_0x729d('0x2e'));}exports[_0x729d('0x2f')]=function(_0xaad33b,_0x4177cf,_0x248efa,_0x2f64b5,_0x376d91,_0x2d3efd){var _0xdd463c,_0x54008f;var _0x44ba89=_0x729d('0x30');var _0x5b1d67=_0x729d('0x31')+_0xaad33b;var _0x17b70f={};if(_0x4177cf==='ssml'){_0x17b70f[_0x729d('0x32')]={'ssml':_0x248efa};}else{_0x17b70f[_0x729d('0x32')]={'text':_0x248efa};};_0x17b70f[_0x729d('0x33')]={'languageCode':_0x2f64b5,'ssmlGender':_0x376d91};_0x17b70f['audioConfig']={'audioEncoding':_0x729d('0x34'),'sampleRateHertz':0x1f40};var _0xa1eed1={'url':_0x44ba89+'text:synthesize'+_0x5b1d67,'method':_0x729d('0x35'),'json':!![],'body':_0x17b70f};return rp(_0xa1eed1)[_0x729d('0x2a')](function(_0x315676){return new BPromise(function(_0x4307c9,_0x1672f5){_0xdd463c=path[_0x729d('0x36')](__dirname,'tmp',rs[_0x729d('0x27')](0x4)+'.mp3');var _0x24ed98=Buffer[_0x729d('0x37')](_0x315676[_0x729d('0x38')],_0x729d('0x2e'));return fs[_0x729d('0x39')](_0xdd463c,_0x24ed98,function(_0x2a2df8){_0x1672f5(_0x2a2df8);},function(_0x2a081d){fs['chmodSync'](_0xdd463c,'777');_0x4307c9(_0x2a081d);});});})[_0x729d('0x2a')](function(_0x38f4dd){_0x54008f=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs['generate'](0x4)+_0x729d('0x28'));return convertFile(_0xdd463c,_0x54008f);})[_0x729d('0x2a')](function(){try{fs[_0x729d('0x1c')](_0xdd463c);fs[_0x729d('0x2b')](_0x54008f,_0x729d('0x2c'));}catch(_0x9e0490){logger[_0x729d('0x1b')](_0x9e0490);}logger[_0x729d('0x18')](_0x729d('0x3a'),_0x54008f[_0x729d('0x2d')]('.')[0x0]);return _0x54008f['split']('.')[0x0];});};exports['googleTTS']=function(_0x5226bb,_0x3703c8){var _0x3b030c=_0x729d('0x3b');var _0x3f8d54,_0x38988a;var _0x350241;var _0x2d7c9b={'encoding':_0x729d('0x3c'),'method':_0x729d('0x35'),'timeout':0x2710,'url':_0x3b030c,'headers':{'Content-Type':_0x729d('0x3d')},'body':_0x729d('0x3e')+encodeURIComponent(JSON[_0x729d('0x3f')]([[['jQ1olc',JSON['stringify']([_0x5226bb,_0x3703c8||_0x729d('0x40'),![],_0x729d('0x41')]),null,_0x729d('0x42')]]]))};return rp(_0x2d7c9b)['then'](function(_0x499aa3){try{_0x350241=eval(_0x499aa3[_0x729d('0x43')](0x5))[0x0][0x2];}catch(_0x37bf39){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}if(!_0x350241){throw new Error(_0x729d('0x44')+lang+_0x729d('0x45'));}try{_0x350241=eval(_0x350241)[0x0];}catch(_0x219899){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x729d('0x21')]);}const _0x3a9acc=_0x350241;_0x3f8d54=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs['generate'](0x4)+_0x729d('0x46'));fs[_0x729d('0x29')](_0x3f8d54,_0x350241,{'encoding':_0x729d('0x2e')});_0x38988a=path['resolve'](__dirname,'tmp',rs[_0x729d('0x27')](0x4)+_0x729d('0x28'));return convertFile(_0x3f8d54,_0x38988a);})['then'](function(){try{fs[_0x729d('0x1c')](_0x3f8d54);fs['chmodSync'](_0x38988a,_0x729d('0x2c'));}catch(_0x1457f7){logger[_0x729d('0x1b')](_0x1457f7);}logger[_0x729d('0x18')](_0x729d('0x47'),_0x38988a['split']('.')[0x0]);return _0x38988a['split']('.')[0x0];});};exports[_0x729d('0x48')]=function(_0x4ccf81,_0x5bbf63,_0x2b1b13){return google['asr'](_0x4ccf81,_0x5bbf63,_0x2b1b13)['then'](function(_0x279edf){logger['info'](_0x279edf[_0x729d('0x49')]);return rp(_0x279edf);})[_0x729d('0x2a')](function(_0x33f5b2){var _0x54c6c5='';var _0x2cc1a8=0x0;try{fs[_0x729d('0x1c')](_0x4ccf81);}catch(_0x14f3b2){logger[_0x729d('0x1b')](_0x14f3b2);}if(_0x33f5b2&&_0x33f5b2['results']){_0x54c6c5=_0x33f5b2['results'][_0x729d('0x4a')](function(_0x202cfe){return _0x202cfe&&_0x202cfe[_0x729d('0x4b')][0x0]&&_0x202cfe['alternatives'][0x0][_0x729d('0x4c')]?_0x202cfe[_0x729d('0x4b')][0x0][_0x729d('0x4c')]:'';})[_0x729d('0x4d')]('\x0a');_0x2cc1a8=_0x33f5b2['results']['map'](function(_0x276fc7){return _0x276fc7&&_0x276fc7[_0x729d('0x4b')][0x0]&&_0x276fc7[_0x729d('0x4b')][0x0]['confidence']?_0x276fc7[_0x729d('0x4b')][0x0]['confidence']:0x0;})[_0x729d('0x4d')]('\x0a');}logger[_0x729d('0x18')](_0x729d('0x4e'),_0x54c6c5);logger['info'](_0x729d('0x4f'),_0x2cc1a8);return{'transcript':_0x54c6c5,'confidence':_0x2cc1a8};})['catch'](function(_0x3bbb71){logger[_0x729d('0x1b')](_0x729d('0x50'),_0x3bbb71[_0x729d('0x14')],_0x3bbb71['name'],_0x3bbb71[_0x729d('0x51')]);});};exports[_0x729d('0x52')]=function(_0x3a961c,_0x3f2ea9,_0x4c8d31,_0xf28294){var _0x408d28=apiai(_0x3f2ea9,{'language':_0xf28294||'en'});return _0x408d28[_0x729d('0x53')](_0x4c8d31,{'sessionId':md5(_0x3a961c)})[_0x729d('0x2a')](function(_0x19a367){logger['info'](JSON['stringify'](_0x19a367));return{'source':_0x19a367[_0x729d('0x54')][_0x729d('0x55')],'resolvedQuery':_0x19a367[_0x729d('0x54')][_0x729d('0x56')],'action':_0x19a367[_0x729d('0x54')]['action'],'actionIncomplete':_0x19a367[_0x729d('0x54')][_0x729d('0x57')],'speech':_0x19a367[_0x729d('0x54')]['fulfillment'][_0x729d('0x58')],'score':_0x19a367[_0x729d('0x54')][_0x729d('0x59')],'statusCode':_0x19a367[_0x729d('0x5a')]['code'],'endConversation':_0x19a367[_0x729d('0x54')][_0x729d('0x5b')][_0x729d('0x5c')]||![],'isFallbackIntent':_0x19a367[_0x729d('0x54')][_0x729d('0x5b')][_0x729d('0x5d')]};});};exports[_0x729d('0x5e')]=function(_0x4fda93,_0x3ebebd,_0x16adc6,_0x5249dc,_0x1ecd3c,_0xd94c5f){var _0x3383dd=_0x5249dc[_0x729d('0x5f')](/\\n/g,'\x0a');var _0x47a748={'credentials':{'private_key':_0x3383dd,'client_email':_0x16adc6}};var _0x2da01c=new dialogflow[(_0x729d('0x60'))](_0x47a748);var _0x37fa7f=_0x2da01c[_0x729d('0x61')](_0x3ebebd,md5(_0x4fda93));var _0x20c993={'session':_0x37fa7f,'queryInput':{'text':{'text':_0x1ecd3c,'languageCode':_0xd94c5f}}};return _0x2da01c['detectIntent'](_0x20c993)[_0x729d('0x2a')](function(_0x5e6d36){if(_0x5e6d36&&_0x5e6d36[_0x729d('0x62')]){logger[_0x729d('0x18')](_0x729d('0x63'),JSON[_0x729d('0x3f')](_0x5e6d36));var _0x18a045=_0x5e6d36[0x0];if(_0x18a045){var _0x37257a={'action':_0x18a045[_0x729d('0x64')]['action'],'allRequiredParamsPresent':_0x18a045['queryResult'][_0x729d('0x65')],'endConversation':_0x18a045[_0x729d('0x64')][_0x729d('0x66')]&&_0x18a045[_0x729d('0x64')][_0x729d('0x66')][_0x729d('0x67')]?_0x18a045['queryResult'][_0x729d('0x66')]['fields'][_0x729d('0x68')][_0x729d('0x69')]:![],'fulfillmentText':_0x18a045[_0x729d('0x64')][_0x729d('0x6a')],'intentName':_0x18a045[_0x729d('0x64')][_0x729d('0x6b')][_0x729d('0x6c')],'intentDisplayName':_0x18a045[_0x729d('0x64')][_0x729d('0x6b')]['displayName'],'isFallbackIntent':_0x18a045[_0x729d('0x64')][_0x729d('0x6b')][_0x729d('0x6d')],'languageCode':_0x18a045[_0x729d('0x64')][_0x729d('0x6e')],'queryText':_0x18a045['queryResult'][_0x729d('0x6f')],'responseId':_0x18a045[_0x729d('0x70')],'score':_0x18a045[_0x729d('0x64')][_0x729d('0x71')],'speech':_0x18a045[_0x729d('0x64')][_0x729d('0x6a')],'providerResponse':JSON[_0x729d('0x3f')](_0x5e6d36)};return _0x37257a;}}});};exports[_0x729d('0x72')]=function(_0x44220a,_0x54dda7,_0x44a757,_0x214d73){return tilde['asr'](_0x44220a,_0x54dda7,_0x44a757,_0x214d73)['then'](function(_0x226562){try{fs['unlink'](_0x44220a);}catch(_0x4d0561){logger[_0x729d('0x1b')](_0x4d0561);}logger[_0x729d('0x18')](_0x729d('0x73'),_0x226562[_0x729d('0x4c')]);logger[_0x729d('0x18')](_0x729d('0x74'),_0x226562[_0x729d('0x75')]);return _0x226562;});};exports[_0x729d('0x76')]=function(_0x4a33bf,_0x336120,_0x31c46d,_0x452018,_0x4de96b,_0x474762){var _0x16c338=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+_0x729d('0x46'));var _0x4f9070;return aws[_0x729d('0x77')](_0x4a33bf,_0x336120,_0x31c46d,_0x452018,_0x4de96b,_0x474762,_0x16c338)[_0x729d('0x2a')](function(){_0x4f9070=path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+'.wav');return convertFile(_0x16c338,_0x4f9070);})['then'](function(){try{fs[_0x729d('0x1c')](_0x16c338);fs[_0x729d('0x2b')](_0x4f9070,_0x729d('0x2c'));}catch(_0x4d4428){logger[_0x729d('0x1b')](_0x4d4428);}return _0x4f9070[_0x729d('0x2d')]('.')[0x0];});};exports[_0x729d('0x78')]=function(_0x577dc1,_0x335c1a,_0x2264e5,_0x1e4030,_0x4105e8,_0x23d899){return aws[_0x729d('0x79')](_0x577dc1,_0x335c1a,_0x2264e5,_0x1e4030,_0x4105e8,_0x23d899)[_0x729d('0x2a')](function(_0x398c43){logger[_0x729d('0x18')](JSON['stringify'](_0x398c43));return _0x398c43;});};exports['ispeechTTS']=function(_0xa620dc,_0x26edb2,_0x3a7a1d,_0x2c7fef){var _0x5903a3=util[_0x729d('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xa620dc,encodeURIComponent(_0x26edb2),_0x3a7a1d,_0x2c7fef);var _0x324223=path[_0x729d('0x36')](__dirname,'tmp',rs[_0x729d('0x27')](0x4)+_0x729d('0x46'));var _0x944483;return downloadFile(_0x5903a3,_0x324223)['then'](function(){_0x944483=path['resolve'](__dirname,_0x729d('0x26'),rs['generate'](0x4)+_0x729d('0x28'));return convertFile(_0x324223,_0x944483);})[_0x729d('0x2a')](function(){try{fs[_0x729d('0x1c')](_0x324223);fs[_0x729d('0x2b')](_0x944483,_0x729d('0x2c'));}catch(_0x4f491f){logger['error'](_0x4f491f);}return _0x944483[_0x729d('0x2d')]('.')[0x0];});};exports[_0x729d('0x7b')]=function(_0x238425,_0x4447dc,_0x17717e,_0x77fa11){var _0x3085fd=util[_0x729d('0x7a')](_0x729d('0x7c'),ISPEECH_API,_0x4447dc,_0x17717e,base64Encode(_0x238425),_0x77fa11?util[_0x729d('0x7a')](_0x729d('0x7d'),encodeURIComponent(_0x77fa11)):'freeform=3');return uploadFile(_0x3085fd)['then'](function(_0xc3f982){return querystring[_0x729d('0x7e')](_0xc3f982);});};exports[_0x729d('0x7f')]=function(_0x4bf501,_0x3eacf3){return sestek[_0x729d('0x80')](_0x4bf501,_0x3eacf3)[_0x729d('0x2a')](function(_0x2957d9){logger[_0x729d('0x18')](JSON['stringify'](_0x2957d9));var _0x1409a2={'speech':_0x2957d9[_0x729d('0x81')],'action':_0x2957d9[_0x729d('0x82')]?_0x2957d9['channelData'][_0x729d('0x83')]:undefined,'actiondata':_0x2957d9[_0x729d('0x82')]?_0x2957d9[_0x729d('0x82')][_0x729d('0x84')]:undefined};if(_0x2957d9['channelData']&&_0x2957d9[_0x729d('0x82')][_0x729d('0x85')]){return base64Decode(_0x2957d9[_0x729d('0x82')][_0x729d('0x85')][_0x729d('0x86')],path[_0x729d('0x36')](__dirname,_0x729d('0x26'),rs[_0x729d('0x27')](0x4)+_0x729d('0x28')))[_0x729d('0x2a')](function(_0x56e8e5){_0x1409a2[_0x729d('0x87')]=_0x56e8e5;return _0x1409a2;});}return _0x1409a2;});};exports[_0x729d('0x88')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 9ecbdb7..4657107 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 _0x6912=['./nda'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x6912,0x143));var _0x2691=function(_0x1337bd,_0x108bcf){_0x1337bd=_0x1337bd-0x0;var _0x15d6ee=_0x6912[_0x1337bd];return _0x15d6ee;};var nda=require(_0x2691('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xc90d=['./nda','exports'];(function(_0x1d1550,_0x147fc4){var _0x2a6f1d=function(_0x94f31e){while(--_0x94f31e){_0x1d1550['push'](_0x1d1550['shift']());}};_0x2a6f1d(++_0x147fc4);}(_0xc90d,0xf8));var _0xdc90=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0xc90d[_0x143cc6];return _0x2cedba;};var nda=require(_0xdc90('0x0'));module[_0xdc90('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 3e891be..0322db0 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 _0x9f84=['CustomActionData','info','stringify','request-promise','url','agi','ndauth_url','/token','password','then','POST','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','extension','text','Bearer\x20','project','body','ndagenerate_audio','channelData','custom_action','CustomAction','custom_action_data'];(function(_0x10dc96,_0x797d1f){var _0x12e3f7=function(_0x377042){while(--_0x377042){_0x10dc96['push'](_0x10dc96['shift']());}};_0x12e3f7(++_0x797d1f);}(_0x9f84,0xa5));var _0x49f8=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0x9f84[_0x35027c];return _0x4bba7d;};'use strict';var rp=require(_0x49f8('0x0'));var url=require(_0x49f8('0x1'));var logger=require('../../../../../config/logger')(_0x49f8('0x2'));module['exports']=function(_0x5ea890,_0x36d4fc){var _0x3e215f={'method':'POST','uri':url['resolve'](_0x36d4fc[_0x49f8('0x3')],_0x49f8('0x4')),'form':{'grant_type':_0x49f8('0x5'),'username':_0x36d4fc['username'],'password':_0x36d4fc[_0x49f8('0x5')]},'json':!![]};return rp(_0x3e215f)[_0x49f8('0x6')](function(_0x5e866a){var _0x89f5ee={'method':_0x49f8('0x7'),'uri':url[_0x49f8('0x8')](_0x36d4fc['ndassistant_url'],_0x49f8('0x9')),'body':{'type':_0x36d4fc[_0x49f8('0xa')]||_0x49f8('0xb'),'channelId':_0x49f8('0xc'),'conversation':{'id':_0x5ea890[_0x49f8('0xd')]},'from':{'id':_0x5ea890['callerid'],'name':_0x5ea890['calleridname']},'recipient':{'id':_0x5ea890['dnid'],'name':_0x5ea890[_0x49f8('0xe')]},'text':_0x36d4fc[_0x49f8('0xf')],'channelData':{}},'headers':{'Authorization':_0x49f8('0x10')+_0x5e866a['access_token']},'json':!![]};if(_0x36d4fc[_0x49f8('0x11')]){_0x89f5ee[_0x49f8('0x12')]['channelData']['ProjectName']=_0x36d4fc[_0x49f8('0x11')];}if(_0x36d4fc[_0x49f8('0x13')]=='1'){_0x89f5ee[_0x49f8('0x12')][_0x49f8('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x36d4fc[_0x49f8('0x15')]){_0x89f5ee[_0x49f8('0x12')]['channelData'][_0x49f8('0x16')]=_0x36d4fc[_0x49f8('0x15')];if(_0x36d4fc[_0x49f8('0x17')]){_0x89f5ee[_0x49f8('0x12')][_0x49f8('0x14')][_0x49f8('0x18')]=_0x36d4fc[_0x49f8('0x17')];}}logger[_0x49f8('0x19')](JSON[_0x49f8('0x1a')](_0x89f5ee));return rp(_0x89f5ee);});}; \ No newline at end of file +var _0xf014=['ndauth_url','/token','username','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','url','../../../../../config/logger','agi','exports','POST'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0xf014,0x1ad));var _0x4f01=function(_0x4b4154,_0x38a122){_0x4b4154=_0x4b4154-0x0;var _0x340ed7=_0xf014[_0x4b4154];return _0x340ed7;};'use strict';var rp=require('request-promise');var url=require(_0x4f01('0x0'));var logger=require(_0x4f01('0x1'))(_0x4f01('0x2'));module[_0x4f01('0x3')]=function(_0x3a2ff2,_0x29f7da){var _0x282740={'method':_0x4f01('0x4'),'uri':url['resolve'](_0x29f7da[_0x4f01('0x5')],_0x4f01('0x6')),'form':{'grant_type':'password','username':_0x29f7da[_0x4f01('0x7')],'password':_0x29f7da[_0x4f01('0x8')]},'json':!![]};return rp(_0x282740)[_0x4f01('0x9')](function(_0xea6b68){var _0x3d63dd={'method':_0x4f01('0x4'),'uri':url[_0x4f01('0xa')](_0x29f7da[_0x4f01('0xb')],_0x4f01('0xc')),'body':{'type':_0x29f7da[_0x4f01('0xd')]||_0x4f01('0xe'),'channelId':'Nda','conversation':{'id':_0x3a2ff2[_0x4f01('0xf')]},'from':{'id':_0x3a2ff2[_0x4f01('0x10')],'name':_0x3a2ff2[_0x4f01('0x11')]},'recipient':{'id':_0x3a2ff2[_0x4f01('0x12')],'name':_0x3a2ff2['extension']},'text':_0x29f7da[_0x4f01('0x13')],'channelData':{}},'headers':{'Authorization':_0x4f01('0x14')+_0xea6b68[_0x4f01('0x15')]},'json':!![]};if(_0x29f7da[_0x4f01('0x16')]){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')][_0x4f01('0x19')]=_0x29f7da['project'];}if(_0x29f7da[_0x4f01('0x1a')]=='1'){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4f01('0x1b')};}if(_0x29f7da[_0x4f01('0x1c')]){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')]['CustomAction']=_0x29f7da[_0x4f01('0x1c')];if(_0x29f7da[_0x4f01('0x1d')]){_0x3d63dd[_0x4f01('0x17')][_0x4f01('0x18')][_0x4f01('0x1e')]=_0x29f7da['custom_action_data'];}}logger['info'](JSON['stringify'](_0x3d63dd));return rp(_0x3d63dd);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 78323e5..d433c74 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 _0x7b17=['./lib/api'];(function(_0x58eed6,_0x49a046){var _0x381fa7=function(_0x1ebf98){while(--_0x1ebf98){_0x58eed6['push'](_0x58eed6['shift']());}};_0x381fa7(++_0x49a046);}(_0x7b17,0x161));var _0x77b1=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x7b17[_0x235482];return _0x5f5bea;};'use strict';var asr=require(_0x77b1('0x0'));module['exports']=function(_0xcdf071,_0x39bc5e,_0xcd18ac,_0x3f27a1){return asr(_0xcdf071,_0x39bc5e,_0xcd18ac,_0x3f27a1);}; \ No newline at end of file +var _0x5e05=['exports','./lib/api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e05,0x12b));var _0x55e0=function(_0x2159b8,_0x2621fa){_0x2159b8=_0x2159b8-0x0;var _0x342a67=_0x5e05[_0x2159b8];return _0x342a67;};'use strict';var asr=require(_0x55e0('0x0'));module[_0x55e0('0x1')]=function(_0x1fcec4,_0xc5c577,_0x1d7d80,_0x176f03){return asr(_0x1fcec4,_0xc5c577,_0x1d7d80,_0x176f03);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 210073d..77a6627 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 _0xed5b=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0xed5b,0x137));var _0xbed5=function(_0x4c0f5a,_0x191842){_0x4c0f5a=_0x4c0f5a-0x0;var _0x2346db=_0xed5b[_0x4c0f5a];return _0x2346db;};'use strict';var BPromise=require('bluebird');var _=require(_0xbed5('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbed5('0x1'));var crypto=require(_0xbed5('0x2'));var logger=require(_0xbed5('0x3'))(_0xbed5('0x4'));module[_0xbed5('0x5')]=function(_0x119561,_0x3733b8,_0x47401c,_0x56fa8a){return new BPromise(function(_0x460021,_0x36dda9){logger[_0xbed5('0x6')](_0xbed5('0x7'),_0x56fa8a||_0xbed5('0x8'));var _0x16a9d6=new WebSocket(_0x56fa8a||_0xbed5('0x8'),{'perMessageDeflate':![]});var _0xabefe1='';var _0x2a85a9='0';var _0x9b6e6f='1';var _0x4e1391=_0xbed5('0x9');function _0x32f6bc(_0x4d0942){var _0x4187b1=crypto['createHash'](_0xbed5('0xa'));_0x4187b1[_0xbed5('0xb')](_0x4d0942);return _0x4187b1[_0xbed5('0xc')](_0xbed5('0xd'));}function _0xb5581e(){try{logger[_0xbed5('0x6')](_0xbed5('0xe'));var _0x5183dd=moment()[_0xbed5('0xf')]();var _0x1917bd=_0x32f6bc(_0x5183dd+_0x3733b8+_0x47401c);_0x16a9d6[_0xbed5('0x10')](JSON['stringify']({'appID':_0x3733b8,'timestamp':_0x5183dd,'appKey':_0x1917bd}));var _0x423dd9=fs[_0xbed5('0x11')](_0x119561);_0x423dd9['on'](_0xbed5('0x12'),function(_0x1dd1eb){_0x16a9d6[_0xbed5('0x10')](_0x1dd1eb);});_0x423dd9['on'](_0xbed5('0x13'),function(){_0x16a9d6['send'](_0xbed5('0x14'));});}catch(_0x3a087c){logger[_0xbed5('0x15')](_0xbed5('0x16'),JSON[_0xbed5('0x17')](_0x3a087c));_0x16a9d6[_0xbed5('0x18')]();}}function _0x21ddd9(_0xcc6feb){try{if(_0xcc6feb){var _0x3b525e=JSON[_0xbed5('0x19')](_0xcc6feb);switch(_0x3b525e['status']){case 0x0:if(_0x3b525e[_0xbed5('0x1a')]){if(_0x3b525e['result'][_0xbed5('0x1b')]){logger[_0xbed5('0x6')](_0xbed5('0x1c'),JSON[_0xbed5('0x17')](_0x3b525e[_0xbed5('0x1a')][_0xbed5('0x1d')]));_0xabefe1=_0x3b525e['result']['hypotheses'][0x0][_0xbed5('0x1e')];_0x2a85a9=_0x3b525e[_0xbed5('0x1a')][_0xbed5('0x1d')][0x0][_0xbed5('0x1f')];_0x9b6e6f='0';_0x4e1391=_0xbed5('0x20');_0x16a9d6['terminate']();}}break;case 0x1:logger[_0xbed5('0x6')](_0xbed5('0x9'));_0x9b6e6f='1';_0x4e1391='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xbed5('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x9b6e6f='2';_0x4e1391=_0xbed5('0x21');break;case 0x9:logger['info'](_0xbed5('0x22'));_0x9b6e6f='9';_0x4e1391=_0xbed5('0x22');break;case 0xa:logger['info']('Authentication\x20failed.');_0x9b6e6f='10';_0x4e1391=_0xbed5('0x23');break;case 0xb:logger['info'](_0xbed5('0x24'));_0x9b6e6f='11';_0x4e1391='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x216260){logger[_0xbed5('0x15')](_0xbed5('0x25'),JSON[_0xbed5('0x17')](_0x216260));_0x16a9d6[_0xbed5('0x18')]();}}function _0x2595dc(){logger[_0xbed5('0x6')](_0xbed5('0x26'));_0x460021({'transcript':_0xabefe1,'confidence':_0x2a85a9,'status':_0x9b6e6f,'status_message':_0x4e1391});}function _0x6573da(_0x53ae60){logger[_0xbed5('0x15')](_0xbed5('0x27'));if(!_[_0xbed5('0x28')](_0x53ae60)){logger[_0xbed5('0x15')](_['isObject'](_0x53ae60)?JSON['stringify'](_0x53ae60):_0x53ae60);}}_0x16a9d6['on'](_0xbed5('0x29'),_0xb5581e);_0x16a9d6['on'](_0xbed5('0x2a'),_0x21ddd9);_0x16a9d6['on'](_0xbed5('0x13'),_0x2595dc);_0x16a9d6['on'](_0xbed5('0x15'),_0x6573da);});}; \ No newline at end of file +var _0xce08=['result','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xce08,0xb4));var _0x8ce0=function(_0x3ad21f,_0x42387f){_0x3ad21f=_0x3ad21f-0x0;var _0x3262c6=_0xce08[_0x3ad21f];return _0x3262c6;};'use strict';var BPromise=require(_0x8ce0('0x0'));var _=require(_0x8ce0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8ce0('0x2'));var crypto=require(_0x8ce0('0x3'));var logger=require(_0x8ce0('0x4'))(_0x8ce0('0x5'));module[_0x8ce0('0x6')]=function(_0x280d96,_0x4aa3f3,_0x297dfc,_0x5d70ab){return new BPromise(function(_0x3fe981,_0x198da8){logger['info']('Tilde\x20URI',_0x5d70ab||_0x8ce0('0x7'));var _0x66dc09=new WebSocket(_0x5d70ab||_0x8ce0('0x7'),{'perMessageDeflate':![]});var _0x1aa771='';var _0xbd08b6='0';var _0x733de3='1';var _0x2b5fa9=_0x8ce0('0x8');function _0x1596eb(_0x12a296){var _0x57133f=crypto[_0x8ce0('0x9')](_0x8ce0('0xa'));_0x57133f[_0x8ce0('0xb')](_0x12a296);return _0x57133f[_0x8ce0('0xc')](_0x8ce0('0xd'));}function _0xa81ef8(){try{logger['info'](_0x8ce0('0xe'));var _0x88801f=moment()[_0x8ce0('0xf')]();var _0x598be5=_0x1596eb(_0x88801f+_0x4aa3f3+_0x297dfc);_0x66dc09[_0x8ce0('0x10')](JSON['stringify']({'appID':_0x4aa3f3,'timestamp':_0x88801f,'appKey':_0x598be5}));var _0x1a467e=fs[_0x8ce0('0x11')](_0x280d96);_0x1a467e['on']('data',function(_0x88e0ff){_0x66dc09[_0x8ce0('0x10')](_0x88e0ff);});_0x1a467e['on'](_0x8ce0('0x12'),function(){_0x66dc09[_0x8ce0('0x10')](_0x8ce0('0x13'));});}catch(_0x168892){logger['error'](_0x8ce0('0x14'),JSON[_0x8ce0('0x15')](_0x168892));_0x66dc09[_0x8ce0('0x16')]();}}function _0xac064d(_0x8817ed){try{if(_0x8817ed){var _0x2742d6=JSON[_0x8ce0('0x17')](_0x8817ed);switch(_0x2742d6[_0x8ce0('0x18')]){case 0x0:if(_0x2742d6[_0x8ce0('0x19')]){if(_0x2742d6[_0x8ce0('0x19')]['final']){logger[_0x8ce0('0x1a')](_0x8ce0('0x1b'),JSON[_0x8ce0('0x15')](_0x2742d6[_0x8ce0('0x19')][_0x8ce0('0x1c')]));_0x1aa771=_0x2742d6[_0x8ce0('0x19')][_0x8ce0('0x1c')][0x0][_0x8ce0('0x1d')];_0xbd08b6=_0x2742d6[_0x8ce0('0x19')][_0x8ce0('0x1c')][0x0]['likelihood'];_0x733de3='0';_0x2b5fa9=_0x8ce0('0x1e');_0x66dc09[_0x8ce0('0x16')]();}}break;case 0x1:logger[_0x8ce0('0x1a')](_0x8ce0('0x8'));_0x733de3='1';_0x2b5fa9=_0x8ce0('0x8');break;case 0x2:logger['info'](_0x8ce0('0x1f'));_0x733de3='2';_0x2b5fa9=_0x8ce0('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x733de3='9';_0x2b5fa9=_0x8ce0('0x20');break;case 0xa:logger[_0x8ce0('0x1a')](_0x8ce0('0x21'));_0x733de3='10';_0x2b5fa9=_0x8ce0('0x21');break;case 0xb:logger[_0x8ce0('0x1a')](_0x8ce0('0x22'));_0x733de3='11';_0x2b5fa9=_0x8ce0('0x22');}}}catch(_0x33f132){logger[_0x8ce0('0x23')](_0x8ce0('0x24'),JSON[_0x8ce0('0x15')](_0x33f132));_0x66dc09['terminate']();}}function _0xbea614(){logger[_0x8ce0('0x1a')]('Close\x20Tilde\x20ASR\x20socket');_0x3fe981({'transcript':_0x1aa771,'confidence':_0xbd08b6,'status':_0x733de3,'status_message':_0x2b5fa9});}function _0x462fac(_0x30ba20){logger['error'](_0x8ce0('0x25'));if(!_[_0x8ce0('0x26')](_0x30ba20)){logger[_0x8ce0('0x23')](_['isObject'](_0x30ba20)?JSON[_0x8ce0('0x15')](_0x30ba20):_0x30ba20);}}_0x66dc09['on'](_0x8ce0('0x27'),_0xa81ef8);_0x66dc09['on'](_0x8ce0('0x28'),_0xac064d);_0x66dc09['on']('close',_0xbea614);_0x66dc09['on'](_0x8ce0('0x23'),_0x462fac);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 3e19792..cae4b41 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 _0xb586=['./asr'];(function(_0x39e706,_0x37e095){var _0x1d3193=function(_0x127473){while(--_0x127473){_0x39e706['push'](_0x39e706['shift']());}};_0x1d3193(++_0x37e095);}(_0xb586,0xbd));var _0x6b58=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xb586[_0x581af1];return _0x54c22e;};var asr=require(_0x6b58('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xaf9f=['./asr'];(function(_0x391fc8,_0xdaf8fd){var _0x320291=function(_0x1f0ae2){while(--_0x1f0ae2){_0x391fc8['push'](_0x391fc8['shift']());}};_0x320291(++_0xdaf8fd);}(_0xaf9f,0x1b4));var _0xfaf9=function(_0x150fa2,_0x156632){_0x150fa2=_0x150fa2-0x0;var _0x88e6ba=_0xaf9f[_0x150fa2];return _0x88e6ba;};var asr=require(_0xfaf9('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 4cb8aaa..60336fc 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 _0xad36=['emit','connection','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','close','nextTick','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad36,0x11c));var _0x6ad3=function(_0x3fce62,_0x1b4b67){_0x3fce62=_0x3fce62-0x0;var _0xea826b=_0xad36[_0x3fce62];return _0xea826b;};'use strict';var util=require('util');var net=require(_0x6ad3('0x0'));var EventEmitter=require(_0x6ad3('0x1'))[_0x6ad3('0x2')];var AGIError=require(_0x6ad3('0x3'));var AGIChannel=require(_0x6ad3('0x4'));var AGIServer=function(_0x35a0ee,_0xef54ab,_0x17a9b2){var _0x3d8fee=this,_0x35a0ee=_0x35a0ee||0x11dd,_0xef54ab=_0xef54ab||_0x6ad3('0x5'),_0x3d669f=null,_0x3c3041=0x0;EventEmitter['call'](_0x3d8fee);function _0x5693c1(){if(!_0x35a0ee){_0x3d8fee['emit']('error',new AGIError(_0x6ad3('0x6')));return![];}_0x3d669f=net[_0x6ad3('0x7')]();_0x3d669f[_0x6ad3('0x8')](_0x35a0ee,_0xef54ab);_0x3d669f['on'](_0x6ad3('0x9'),function(){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0x9'));});_0x3d669f['on'](_0x6ad3('0xb'),function(_0x293c9d){_0x3d669f[_0x6ad3('0xc')](function(_0x4a47d0,_0x6bb2f5){if(_0x4a47d0){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xd'),new AGIError(_0x6ad3('0xe'),_0x4a47d0));}else if(_0x17a9b2&&_0x17a9b2<0x0){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xd'),new AGIError(_0x6ad3('0xf')));_0x293c9d[_0x6ad3('0x10')]();}else if(_0x17a9b2&&_0x17a9b2>0x0&&_0x17a9b2<_0x6bb2f5){_0x3c3041+=0x1;_0x3d8fee['emit'](_0x6ad3('0xd'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3c3041));_0x293c9d[_0x6ad3('0x10')]();}else{var _0x2541fa=new AGIChannel(_0x293c9d);_0x2541fa['on'](_0x6ad3('0x11'),function(){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xb'),_0x2541fa);});}});});_0x3d669f['on']('error',function(_0x2d406b){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x2d406b['code']));});_0x3d669f['on']('close',function(){_0x3d8fee['emit'](_0x6ad3('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6ad3('0x13')](function(){_0x5693c1();});};util['inherits'](AGIServer,EventEmitter);module[_0x6ad3('0x14')]=function(_0x1d688f,_0x2a1570,_0x3f8ce2){return new AGIServer(_0x1d688f,_0x2a1570,_0x3f8ce2);}; \ No newline at end of file +var _0x4f17=['E_AGI_SERVER_MAXCONNECTION','code','close','nextTick','inherits','exports','util','events','EventEmitter','./channel','127.0.0.1','emit','error','createServer','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x21af57,_0x14fa55){var _0x2bb0d5=function(_0xd45987){while(--_0xd45987){_0x21af57['push'](_0x21af57['shift']());}};_0x2bb0d5(++_0x14fa55);}(_0x4f17,0x9e));var _0x74f1=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0x4f17[_0x57ee1d];return _0x12a933;};'use strict';var util=require(_0x74f1('0x0'));var net=require('net');var EventEmitter=require(_0x74f1('0x1'))[_0x74f1('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x74f1('0x3'));var AGIServer=function(_0x4694a1,_0x3f16b2,_0x62251d){var _0x2d1ff2=this,_0x4694a1=_0x4694a1||0x11dd,_0x3f16b2=_0x3f16b2||_0x74f1('0x4'),_0x3f65bb=null,_0x4b894a=0x0;EventEmitter['call'](_0x2d1ff2);function _0x34ec03(){if(!_0x4694a1){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x3f65bb=net[_0x74f1('0x7')]();_0x3f65bb['listen'](_0x4694a1,_0x3f16b2);_0x3f65bb['on'](_0x74f1('0x8'),function(){_0x2d1ff2['emit'](_0x74f1('0x8'));});_0x3f65bb['on'](_0x74f1('0x9'),function(_0x57e775){_0x3f65bb['getConnections'](function(_0x28307c,_0x14484a){if(_0x28307c){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x6'),new AGIError(_0x74f1('0xa'),_0x28307c));}else if(_0x62251d&&_0x62251d<0x0){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x6'),new AGIError(_0x74f1('0xb')));_0x57e775[_0x74f1('0xc')]();}else if(_0x62251d&&_0x62251d>0x0&&_0x62251d<_0x14484a){_0x4b894a+=0x1;_0x2d1ff2[_0x74f1('0x5')]('error',new AGIError(_0x74f1('0xd'),_0x4b894a));_0x57e775['destroy']();}else{var _0x41488b=new AGIChannel(_0x57e775);_0x41488b['on']('ready',function(){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0x9'),_0x41488b);});}});});_0x3f65bb['on'](_0x74f1('0x6'),function(_0x1016a7){_0x2d1ff2[_0x74f1('0x5')]('error',new AGIError(_0x74f1('0xa'),_0x1016a7[_0x74f1('0xe')]));});_0x3f65bb['on']('close',function(){_0x2d1ff2[_0x74f1('0x5')](_0x74f1('0xf'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x74f1('0x10')](function(){_0x34ec03();});};util[_0x74f1('0x11')](AGIServer,EventEmitter);module[_0x74f1('0x12')]=function(_0x1e5cf1,_0x174051,_0x4a10ab){return new AGIServer(_0x1e5cf1,_0x174051,_0x4a10ab);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 6c665be..c2994f5 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 _0x59d8=['accountcode','dnid','arg_1','createSquareMessage','createCmContact','callback_','random','isEmpty','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','split','replaceAll','getVariable','extra','toString','getAndSetVariable','result','setVariable','maxRetry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','no\x20condition\x20configured','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','operation','no\x20operation\x20configured','math\x20%s','isArray','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','QUEUE','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','name','catch','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority'];(function(_0x1e8ec3,_0x3f0312){var _0x2d5f70=function(_0x1c812a){while(--_0x1c812a){_0x1e8ec3['push'](_0x1e8ec3['shift']());}};_0x2d5f70(++_0x3f0312);}(_0x59d8,0x18d));var _0x859d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x59d8[_0x167cc1];return _0x10bc4b;};'use strict';var fs=require('fs');var path=require(_0x859d('0x0'));var util=require(_0x859d('0x1'));var _=require(_0x859d('0x2'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x859d('0x3'));var moment=require(_0x859d('0x4'));var Mustache=require(_0x859d('0x5'));var rp=require(_0x859d('0x6'));var logger=require(_0x859d('0x7'))(_0x859d('0x8'));var config=require(_0x859d('0x9'));var scripts=require(_0x859d('0xa'));var FILES_PATH=_0x859d('0xb');var recursiveMapAttributes=[_0x859d('0xc'),_0x859d('0xd')];var verticesWithRetry=['menu',_0x859d('0xe'),_0x859d('0xf')];var AGIVertices=function(_0x3aefae,_0x5a1bd2,_0x3c061d){this[_0x859d('0x10')]=_0x3aefae;this[_0x859d('0x11')]=_0x5a1bd2;this['mailRpc']=_0x3c061d;};AGIVertices[_0x859d('0x12')]['getVariable']=function(_0x13746e,_0x343240){this['rpc'][_0x859d('0x13')](_0x13746e)['then'](function(_0xc9d3ef){_0x343240(null,_0xc9d3ef?_0xc9d3ef[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0xc35bca){_0x343240(_0xc35bca);});};AGIVertices[_0x859d('0x12')]['getVoiceQueue']=function(_0x9c8fc2,_0x183354){this[_0x859d('0x11')][_0x859d('0x16')](_0x9c8fc2)[_0x859d('0x17')](function(_0xfa1832){_0x183354(null,_0xfa1832?_0xfa1832[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x933c09){_0x183354(_0x933c09);});};AGIVertices[_0x859d('0x12')][_0x859d('0x18')]=function(_0xc9dfd2,_0x215a3e){this[_0x859d('0x11')][_0x859d('0x19')](_0xc9dfd2)['then'](function(_0x2d4748){_0x215a3e(null,_0x2d4748?_0x2d4748[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x1d85b6){_0x215a3e(_0x1d85b6);});};AGIVertices[_0x859d('0x12')]['getSquareOdbc']=function(_0x2a5cd3,_0xfe7af5){this[_0x859d('0x11')][_0x859d('0x1a')](_0x2a5cd3)['then'](function(_0xcde409){_0xfe7af5(null,_0xcde409?_0xcde409[_0x859d('0x1b')]:![]);})[_0x859d('0x15')](function(_0x4ff883){_0xfe7af5(_0x4ff883);});};AGIVertices[_0x859d('0x12')]['getUser']=function(_0x46e200,_0x2a617e){this[_0x859d('0x11')][_0x859d('0x1c')](_0x46e200)[_0x859d('0x17')](function(_0x1be420){_0x2a617e(null,_0x1be420?_0x1be420[_0x859d('0x14')]:![]);})['catch'](function(_0x22e39d){_0x2a617e(_0x22e39d);});};AGIVertices[_0x859d('0x12')]['getTrunk']=function(_0x46d528,_0x55d1ac){this[_0x859d('0x11')][_0x859d('0x1d')](_0x46d528)[_0x859d('0x17')](function(_0x598979){_0x55d1ac(null,_0x598979?_0x598979[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x356642){_0x55d1ac(_0x356642);});};AGIVertices[_0x859d('0x12')][_0x859d('0x1e')]=function(_0x2d3c36,_0x473666){var _0x3d0ac1=this;this[_0x859d('0x11')][_0x859d('0x1f')](_0x2d3c36)[_0x859d('0x17')](function(_0x514eeb){_0x473666(null,_0x514eeb?_0x3d0ac1[_0x859d('0x20')](_0x514eeb[_0x859d('0x21')]):![]);})['catch'](function(_0x5b31f1){_0x473666(_0x5b31f1);});};AGIVertices['prototype'][_0x859d('0x22')]=function(_0x5d8f28,_0x3766d9){this[_0x859d('0x11')][_0x859d('0x23')](_0x5d8f28)['then'](function(_0x6a5962){_0x3766d9(null,_0x6a5962?_0x6a5962:![]);})['catch'](function(_0x2c514f){_0x3766d9(_0x2c514f);});};AGIVertices[_0x859d('0x12')]['sendMailMessage']=function(_0x3d7266,_0x419ecd,_0x1ec9ab){this[_0x859d('0x24')][_0x859d('0x25')](_0x3d7266,_0x419ecd)[_0x859d('0x17')](function(){_0x1ec9ab(null);})[_0x859d('0x15')](function(_0x5c6f45){_0x1ec9ab(_0x5c6f45);});};AGIVertices[_0x859d('0x12')][_0x859d('0x26')]=function(_0xea7293,_0x47293c){this[_0x859d('0x11')]['getIntervalById'](_0xea7293)[_0x859d('0x17')](function(_0x318347){if(_0x318347){if(_0x318347[_0x859d('0x27')]){_0x47293c(null,[_0x318347[_0x859d('0x28')]]);}else{_0x47293c(null,_['map'](_0x318347['Intervals'],_0x859d('0x28')));}}else{_0x47293c(null,![]);}})[_0x859d('0x15')](function(_0x286a74){_0x47293c(_0x286a74);});};AGIVertices[_0x859d('0x12')][_0x859d('0x20')]=function(_0xa747be){return util[_0x859d('0x29')](_0x859d('0x2a'),FILES_PATH,_0xa747be);};AGIVertices[_0x859d('0x12')][_0x859d('0x2b')]=function(_0x2bc958,_0x225ab3,_0x514bac){odbc[_0x859d('0x2c')](_0x2bc958,function(_0x58e1a6){if(_0x58e1a6){logger['error'](_0x859d('0x2d'),_0x58e1a6);_0x514bac(_0x58e1a6);}else{logger[_0x859d('0x2e')](_0x859d('0x2f'));odbc[_0x859d('0x30')](_0x225ab3,function(_0x1b810e,_0x1316ea){if(_0x1b810e){logger[_0x859d('0x2e')](_0x859d('0x31'),_0x225ab3);_0x514bac(_0x1b810e);}else{logger[_0x859d('0x2e')](_0x859d('0x32'),_0x225ab3);odbc[_0x859d('0x33')](function(_0xbc3e5d){if(_0xbc3e5d){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xbc3e5d);}_0x514bac(null,_0x1316ea);});}});}});};AGIVertices[_0x859d('0x12')][_0x859d('0x34')]=function(_0x30da75,_0xc996f6){this[_0x859d('0x11')][_0x859d('0x35')](_0x30da75)[_0x859d('0x17')](function(_0x295a3f){_0xc996f6(null,_0x295a3f?_0x295a3f:![]);})[_0x859d('0x15')](function(_0x4edd12){_0xc996f6(_0x4edd12);});};AGIVertices[_0x859d('0x12')][_0x859d('0x36')]=function(_0x44a9b9,_0x33162b){this['rpc'][_0x859d('0x36')](_0x44a9b9)['then'](function(_0x2213e3){_0x33162b(null,_0x2213e3);})[_0x859d('0x15')](function(_0x504e4b){_0x33162b(_0x504e4b);});};AGIVertices[_0x859d('0x12')][_0x859d('0x37')]=function(_0x1881e5,_0x6cd649,_0x2de87a){this[_0x859d('0x11')][_0x859d('0x37')]({'uniqueid':this['channel'][_0x859d('0x38')],'node':_0x1881e5[_0x859d('0x39')],'application':_0x1881e5[_0x859d('0x3a')],'data':_0x6cd649||null,'project_name':this[_0x859d('0x10')]['arg_1'],'callerid':this[_0x859d('0x10')]['callerid']})[_0x859d('0x17')](function(_0x43f82a){if(_0x2de87a){_0x2de87a(null,_0x43f82a);}})[_0x859d('0x15')](function(_0xf08219){if(_0x2de87a){_0x2de87a(_0xf08219);}});};AGIVertices[_0x859d('0x12')][_0x859d('0x3b')]=function(_0x34ca7a,_0x221932,_0x3872b9,_0x861be4){this['rpc'][_0x859d('0x3b')]({'uniqueid':this[_0x859d('0x10')]['uniqueid'],'callerid':this[_0x859d('0x10')][_0x859d('0x3c')],'calleridname':this[_0x859d('0x10')][_0x859d('0x3d')],'context':this[_0x859d('0x10')][_0x859d('0x3e')],'extension':this[_0x859d('0x10')][_0x859d('0x3f')],'priority':this['channel'][_0x859d('0x40')],'accountcode':this[_0x859d('0x10')][_0x859d('0x41')],'dnid':this[_0x859d('0x10')][_0x859d('0x42')],'projectName':this[_0x859d('0x10')][_0x859d('0x43')],'saveName':_0x221932,'filename':_0x34ca7a['file']||_0x221932,'savePath':_0x3872b9})[_0x859d('0x17')](function(_0x5749d7){_0x861be4(null,_0x5749d7);})[_0x859d('0x15')](function(_0x5a67f9){_0x861be4(_0x5a67f9);});};AGIVertices['prototype'][_0x859d('0x44')]=function(_0x5266da,_0x416f90,_0x4072ad,_0x73db95,_0x3bd261){this[_0x859d('0x11')][_0x859d('0x44')]({'uniqueid':this[_0x859d('0x10')]['uniqueid'],'body':_0x5266da,'direction':_0x416f90,'providerName':_0x4072ad,'providerResponse':_0x73db95})['then'](function(_0x53f44c){if(_0x3bd261){_0x3bd261(null,_0x53f44c);}})[_0x859d('0x15')](function(_0x560f35){if(_0x3bd261){_0x3bd261(_0x560f35);}});};AGIVertices[_0x859d('0x12')][_0x859d('0x45')]=function(_0x2dd245,_0x233488){this['rpc'][_0x859d('0x45')]({'firstName':_['isEmpty'](_0x2dd245['name'])||_['isNil'](_0x2dd245['name'])?_0x859d('0x46')+Math[_0x859d('0x47')]():_0x2dd245[_0x859d('0x14')],'lastName':_[_0x859d('0x48')](_0x2dd245[_0x859d('0x49')])||_[_0x859d('0x4a')](_0x2dd245[_0x859d('0x49')])?null:_0x2dd245[_0x859d('0x49')],'phone':_0x2dd245[_0x859d('0x4b')],'ListId':_0x2dd245[_0x859d('0x4c')],'scheduledat':_0x2dd245[_0x859d('0x4d')],'callbackUniqueid':this[_0x859d('0x10')][_0x859d('0x38')],'tags':_0x859d('0x4e'),'description':_0x859d('0x4f')+_0x2dd245['scheduledAt']['toString'](),'priority':_0x2dd245[_0x859d('0x50')]})['then'](function(_0x2fcae3){_0x233488(null,_0x2fcae3);})['catch'](function(_0x1f9f2e){_0x233488(_0x1f9f2e);});};AGIVertices[_0x859d('0x12')]['getPause']=function(_0x27c773,_0x3822b8){this[_0x859d('0x11')][_0x859d('0x51')](_0x27c773)[_0x859d('0x17')](function(_0x5ba0fc){_0x3822b8(null,_0x5ba0fc?_0x5ba0fc[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x4eeeda){_0x3822b8(_0x4eeeda);});};AGIVertices[_0x859d('0x12')][_0x859d('0x52')]=function(_0x21244c,_0x546250,_0x4bea0c){var _0x4cb7c9={'role':_0x859d('0x53')};_0x4cb7c9[_0x21244c]=this[_0x859d('0x10')][_0x859d('0x3c')];this[_0x859d('0x11')]['agentPause'](_0x4cb7c9,_0x546250,this[_0x859d('0x10')]['uniqueid'])['then'](function(_0x2871d0){_0x4bea0c(null,_[_0x859d('0x4a')](_0x2871d0)?![]:!![]);})['catch'](function(_0x325af2){logger[_0x859d('0x54')](_0x325af2);_0x4bea0c(null,![]);});};AGIVertices['prototype'][_0x859d('0x55')]=function(_0x508760,_0x52fcc7){var _0x50f814={'role':_0x859d('0x53')};_0x50f814[_0x508760]=this[_0x859d('0x10')][_0x859d('0x3c')];this[_0x859d('0x11')]['agentUnpause'](_0x50f814)['then'](function(_0x584105){_0x52fcc7(null,_[_0x859d('0x4a')](_0x584105)?![]:!![]);})[_0x859d('0x15')](function(_0x57d7c8){logger[_0x859d('0x54')](_0x57d7c8);_0x52fcc7(null,![]);});};AGIVertices[_0x859d('0x12')]['agentLogout']=function(_0x5e8919,_0x970d38){var _0x27dc76={'role':_0x859d('0x53')};_0x27dc76[_0x5e8919]=this[_0x859d('0x10')][_0x859d('0x3c')];this[_0x859d('0x11')][_0x859d('0x56')](_0x27dc76)[_0x859d('0x17')](function(_0x40b230){_0x970d38(null,_[_0x859d('0x4a')](_0x40b230)?![]:!![]);})['catch'](function(_0x593859){logger[_0x859d('0x54')](_0x593859);_0x970d38(null,![]);});};AGIVertices[_0x859d('0x12')][_0x859d('0x57')]=function(_0x38c9da,_0x15bda3){var _0x52ad32={'role':_0x859d('0x53')};_0x52ad32[_0x38c9da]=this[_0x859d('0x10')][_0x859d('0x3c')];var _0x37a04e=_0x38c9da!=_0x859d('0x58')?util['format'](_0x859d('0x59'),'LOCAL',this[_0x859d('0x10')][_0x859d('0x3c')]):undefined;this[_0x859d('0x11')][_0x859d('0x57')](_0x52ad32,_0x37a04e)['then'](function(_0x4195ab){_0x15bda3(null,_['isNil'](_0x4195ab)?![]:!![]);})['catch'](function(_0x110399){logger[_0x859d('0x54')](_0x110399);_0x15bda3(null,![]);});};AGIVertices[_0x859d('0x12')][_0x859d('0x5a')]=function(_0x141f5e,_0x15744d){sh[_0x859d('0x5b')](_[_0x859d('0x5c')](_0x141f5e),function(_0x3cf73b,_0x17581a){var _0x1ac205=_0x17581a[_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'');_0x15744d(null,_0x1ac205);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x32976e,_0x5c302a){scripts[_0x859d('0x5e')](_0x32976e[_0x859d('0x5f')],_0x32976e['google_cloud_tts_text_type']||_0x859d('0x60'),_0x32976e[_0x859d('0x60')],_0x32976e[_0x859d('0x61')]||_0x859d('0x62'),_0x32976e[_0x859d('0x63')]||'MALE',_0x32976e[_0x859d('0x64')]||_0x859d('0x65'))['then'](function(_0x219138){_0x5c302a(null,_0x219138);})[_0x859d('0x15')](function(_0x1565a7){_0x5c302a(_0x1565a7);});};AGIVertices[_0x859d('0x12')][_0x859d('0x66')]=function(_0x1585c4,_0x2ff8eb){scripts[_0x859d('0x66')](_0x1585c4['text'],_0x1585c4['google_tts_language']||'en',0x1)['then'](function(_0x284cd3){_0x2ff8eb(null,_0x284cd3);})[_0x859d('0x15')](function(_0xe84f8b){_0x2ff8eb(_0xe84f8b);});};AGIVertices[_0x859d('0x12')][_0x859d('0x67')]=function(_0x45c289,_0x4347b2){var _0x7e7097={'uri':_0x45c289[_0x859d('0x68')],'method':_0x45c289[_0x859d('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x45c289[_0x859d('0x6a')])===_0x859d('0x6b')&&parseInt(_0x45c289['timeout'])>=0x1?parseInt(_0x45c289[_0x859d('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x859d('0x6c')]([_0x859d('0x6d'),_0x859d('0x6e')],_0x7e7097[_0x859d('0x69')][_0x859d('0x6f')]())){try{_0x7e7097['body']=_0x45c289[_0x859d('0xd')]?JSON[_0x859d('0x70')](_0x45c289['rawBody']):{};}catch(_0x30fa1e){logger['error'](_0x859d('0x71'),_0x30fa1e);}}try{_0x7e7097[_0x859d('0x72')]=_0x45c289[_0x859d('0xc')]?JSON[_0x859d('0x70')](_0x45c289[_0x859d('0xc')]):{};}catch(_0x154e9b){logger[_0x859d('0x54')](_0x859d('0x73'),_0x154e9b);}if(_0x45c289[_0x859d('0x74')]){try{var _0x22d387=require(_0x45c289[_0x859d('0x74')])[_0x859d('0x75')](this,_0x7e7097);_0x7e7097['uri']=Mustache['render'](_0x45c289[_0x859d('0x68')],_0x22d387,{},['$$','$$']);if(_0x7e7097['headers']){_0x7e7097[_0x859d('0x72')]=JSON[_0x859d('0x70')](Mustache[_0x859d('0x76')](JSON['stringify'](_0x7e7097[_0x859d('0x72')]),_0x22d387,{},['$$','$$']));}if(_0x7e7097[_0x859d('0x77')]){_0x7e7097['body']=JSON[_0x859d('0x70')](Mustache[_0x859d('0x76')](JSON[_0x859d('0x78')](_0x7e7097[_0x859d('0x77')]),_0x22d387,{},['$$','$$']));}}catch(_0x322da4){logger[_0x859d('0x54')](_0x859d('0x79'),_0x322da4);}}rp(_0x7e7097)[_0x859d('0x17')](function(_0x3fe55e){var _0x4fb563={'statusCode':_0x3fe55e['statusCode']||0xc8,'statusMessage':_0x3fe55e[_0x859d('0x7a')]||'OK','headers':_0x3fe55e[_0x859d('0x72')]||{},'body':_0x3fe55e['body']||{}};_0x4347b2(null,_0x4fb563);})[_0x859d('0x15')](function(_0x42f07e){var _0x28d5c3={'statusCode':_0x42f07e[_0x859d('0x7b')]||0x1f4,'statusMessage':_0x42f07e[_0x859d('0x7c')]||_0x859d('0x7d'),'headers':_0x42f07e[_0x859d('0x7e')][_0x859d('0x72')]||{},'body':_0x42f07e[_0x859d('0x7e')][_0x859d('0x77')]||{}};_0x4347b2(null,_0x28d5c3);});};AGIVertices[_0x859d('0x12')][_0x859d('0x7f')]=function(_0xa953b8,_0x2581cd){scripts[_0x859d('0x7f')](this[_0x859d('0x10')][_0x859d('0x38')],_0xa953b8['key'],_0xa953b8[_0x859d('0x60')],_0xa953b8['dialogflow_language']||'en')[_0x859d('0x17')](function(_0x5c9e13){_0x2581cd(null,_0x5c9e13);})[_0x859d('0x15')](function(_0x530d5a){_0x2581cd(_0x530d5a);});};AGIVertices['prototype'][_0x859d('0x80')]=function(_0x5bcb41,_0x3d8a51){scripts[_0x859d('0x80')](this[_0x859d('0x10')]['uniqueid'],_0x5bcb41['dialogflowV2_project_id'],_0x5bcb41[_0x859d('0x81')],_0x5bcb41[_0x859d('0x82')],_0x5bcb41['text'],_0x5bcb41[_0x859d('0x83')]||'en')['then'](function(_0x183c35){_0x3d8a51(null,_0x183c35);})[_0x859d('0x15')](function(_0x5278c1){_0x3d8a51(_0x5278c1);});};AGIVertices[_0x859d('0x12')][_0x859d('0x84')]=function(_0x12282b,_0x10d8a1){scripts['sestekNDA'](this['channel'],_0x12282b)['then'](function(_0x2dac8c){_0x10d8a1(null,_0x2dac8c);})[_0x859d('0x15')](function(_0x34a693){_0x10d8a1(_0x34a693);});};AGIVertices[_0x859d('0x12')][_0x859d('0x85')]=function(_0x2d9318,_0x4c8c00){scripts[_0x859d('0x85')](_0x2d9318[_0x859d('0x86')],_0x2d9318[_0x859d('0x60')],_0x2d9318[_0x859d('0x87')]||_0x859d('0x62'),_0x2d9318['speed'])[_0x859d('0x17')](function(_0xf3f8fa){_0x4c8c00(null,_0xf3f8fa);})[_0x859d('0x15')](function(_0x1f6694){_0x4c8c00(_0x1f6694);});};AGIVertices[_0x859d('0x12')]['ispeechASR']=function(_0x4049fc,_0x223583,_0x59c937){scripts[_0x859d('0x88')](_0x223583,_0x4049fc[_0x859d('0x86')],_0x4049fc[_0x859d('0x89')]||'en-US',this[_0x859d('0x8a')](_0x4049fc['model'])?_0x4049fc[_0x859d('0x8b')]:undefined)[_0x859d('0x17')](function(_0x3c2761){_0x59c937(null,_0x3c2761);})['catch'](function(_0x403701){_0x59c937(_0x403701);});};AGIVertices[_0x859d('0x12')][_0x859d('0x8c')]=function(_0x5a0465,_0x569dd6){scripts[_0x859d('0x8c')](_0x5a0465[_0x859d('0x8d')],_0x5a0465[_0x859d('0x8e')],_0x5a0465[_0x859d('0x8f')],_0x5a0465['aws_polly_voice']||_0x859d('0x90'),_0x5a0465['text'],_0x5a0465['aws_text_type']||_0x859d('0x60'))[_0x859d('0x17')](function(_0x5acfeb){_0x569dd6(null,_0x5acfeb);})[_0x859d('0x15')](function(_0x4c241f){_0x569dd6(_0x4c241f);});};AGIVertices[_0x859d('0x12')][_0x859d('0x91')]=function(_0xb23a76,_0x5c9060){scripts[_0x859d('0x91')](this[_0x859d('0x10')]['uniqueid'],_0xb23a76['aws_access_key_id'],_0xb23a76['aws_secret_access_key'],_0xb23a76['aws_lex_region'],_0xb23a76[_0x859d('0x60')],_0xb23a76[_0x859d('0x92')])['then'](function(_0x5d7717){_0x5c9060(null,_0x5d7717);})['catch'](function(_0xa3621){_0x5c9060(_0xa3621);});};AGIVertices[_0x859d('0x12')][_0x859d('0x93')]=function(_0x59b18d,_0xf3dd79,_0x5c24c4){scripts['googleASR'](_0xf3dd79,_0x59b18d[_0x859d('0x86')],_0x59b18d[_0x859d('0x94')]||_0x859d('0x62'))[_0x859d('0x17')](function(_0x286d2a){_0x5c24c4(null,_0x286d2a);})[_0x859d('0x15')](function(_0x59db79){_0x5c24c4(_0x59db79);});};AGIVertices[_0x859d('0x12')][_0x859d('0x95')]=function(_0x138853,_0x6022bb,_0x190333){scripts[_0x859d('0x95')](_0x6022bb,_0x138853[_0x859d('0x96')],_0x138853['appsecret'],_0x138853[_0x859d('0x97')])['then'](function(_0x304ea0){_0x190333(null,_0x304ea0);})[_0x859d('0x15')](function(_0x57fa29){_0x190333(_0x57fa29);});};AGIVertices[_0x859d('0x12')][_0x859d('0x98')]=function(_0x466edd){var _0xf91826=_[_0x859d('0x6c')](verticesWithRetry,_0x466edd[_0x859d('0x3a')])?_0x466edd:_[_0x859d('0x99')](_0x466edd);for(var _0x1ffe03 in _0xf91826){if(_0xf91826[_0x859d('0x9a')](_0x1ffe03)){if(_0xf91826[_0x1ffe03]&&_['isString'](_0xf91826[_0x1ffe03])){if(_['includes'](recursiveMapAttributes,_0x1ffe03)){_0xf91826[_0x1ffe03]=this[_0x859d('0x9b')](_0xf91826[_0x1ffe03]);}else{_0xf91826[_0x1ffe03]=this[_0x859d('0x9c')](_0xf91826[_0x1ffe03]);}}}}return _0xf91826;};AGIVertices['prototype'][_0x859d('0x9d')]=function(_0x2aee83){for(var _0xcdbb8f in _0x2aee83){if(_0x2aee83[_0x859d('0x9a')](_0xcdbb8f)){if(_[_0x859d('0x9e')](_0x2aee83[_0xcdbb8f])){this[_0x859d('0x9d')](_0x2aee83[_0xcdbb8f]);}else if(_['isArray'](_0x2aee83[_0xcdbb8f])){for(var _0x1335aa=0x0;_0x1335aa<_0x2aee83[_0xcdbb8f][_0x859d('0x9f')];_0x1335aa++){this[_0x859d('0x9d')](_0x2aee83[_0xcdbb8f][_0x1335aa]);}}else if(_['isString'](_0x2aee83[_0xcdbb8f])){_0x2aee83[_0xcdbb8f]=this[_0x859d('0x9c')](_0x2aee83[_0xcdbb8f]);}}}};AGIVertices[_0x859d('0x12')][_0x859d('0xa0')]=function(_0x56bdbe,_0x312671){for(var _0x4957e2 in _0x56bdbe){if(_0x56bdbe['hasOwnProperty'](_0x4957e2)){if(_[_0x859d('0x9e')](_0x56bdbe[_0x4957e2])){if(!_['isEmpty'](_0x56bdbe[_0x4957e2])){this['saveRestApiResult'](_0x56bdbe[_0x4957e2],util['format'](_0x859d('0xa1'),_0x312671,_0x4957e2));}}else if(_['isArray'](_0x56bdbe[_0x4957e2])){for(var _0x31d8bd=0x0;_0x31d8bd<_0x56bdbe[_0x4957e2]['length'];_0x31d8bd++){this['saveRestApiResult'](_0x56bdbe[_0x4957e2][_0x31d8bd],util[_0x859d('0x29')](_0x859d('0xa1'),_0x312671,_0x4957e2+'['+_0x31d8bd+']'));}}else{if(!_[_0x859d('0x4a')](_0x56bdbe[_0x4957e2])){this[_0x859d('0x10')]['setVariable'](util[_0x859d('0x29')](_0x859d('0xa1'),_0x312671,_0x4957e2),_0x56bdbe[_0x4957e2]);}}}}};AGIVertices[_0x859d('0x12')][_0x859d('0x9b')]=function(_0xf00f44){try{var _0x1ec44a=JSON[_0x859d('0x70')](_0xf00f44);this[_0x859d('0x9d')](_0x1ec44a);return JSON[_0x859d('0x78')](_0x1ec44a);}catch(_0xe96e8e){return this[_0x859d('0x9c')](_0xf00f44);}};AGIVertices[_0x859d('0x12')][_0x859d('0x9c')]=function(_0x46aa7d){var _0x3b189f=_0x46aa7d['split']('{');for(var _0x542273=0x1;_0x542273<_0x3b189f[_0x859d('0x9f')];_0x542273+=0x1){var _0x4e4a8d=_0x3b189f[_0x542273][_0x859d('0xa2')]('}');if(_0x4e4a8d[_0x859d('0x9f')]>0x1){_0x46aa7d=_0x46aa7d[_0x859d('0xa3')]('{'+_0x4e4a8d[0x0]+'}',this[_0x859d('0x10')][_0x859d('0xa4')](_0x4e4a8d[0x0])[_0x859d('0xa5')]||_0x4e4a8d[0x0]);}}if(_0x3b189f[_0x859d('0x9f')]===0x1){return _0x46aa7d[_0x859d('0xa6')]();}return this[_0x859d('0x9c')](_0x46aa7d);};AGIVertices['prototype'][_0x859d('0xa7')]=function(_0x58b825,_0x5d2a5f){var _0x1b3333=this[_0x859d('0x10')]['getVariable'](_0x58b825);if(_0x1b3333[_0x859d('0xa8')]===-0x1){return _0x1b3333;}logger[_0x859d('0x2e')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5d2a5f,_0x1b3333[_0x859d('0xa5')]));return this['channel'][_0x859d('0xa9')](_0x5d2a5f,_0x1b3333[_0x859d('0xa5')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x8a')]=function(_0x537c75){return _0x537c75&&_0x537c75!=='0'&&_0x537c75!=='-1'&&_0x537c75!=='';};AGIVertices[_0x859d('0x12')][_0x859d('0xaa')]=function(_0x40789b){this['createSquareDetailsReport'][_0x859d('0x75')](this,_0x40789b,'-');_0x40789b['retry']=_0x40789b[_0x859d('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x859d('0xab')]=function(_0x50622d){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x50622d[_0x859d('0x39')]));if(!this['isConfigured'](_0x50622d[_0x859d('0x60')])){return this['channel'][_0x859d('0xac')](_0x859d('0xad'));}var _0x322fad='\x22'+_0x50622d[_0x859d('0x60')]+'\x22';if(this['isConfigured'](_0x50622d[_0x859d('0x7e')])){_0x322fad+=','+_0x50622d[_0x859d('0x7e')];}var _0x26c1c7=this['channel'][_0x859d('0x5b')](_0x859d('0xae'),_0x322fad);if(_0x26c1c7[_0x859d('0xa8')]===-0x1){return _0x26c1c7;}return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xaf'),_0x322fad));};AGIVertices[_0x859d('0x12')]['mrcprecog']=function(_0x47ed5d){logger['info'](util[_0x859d('0x29')](_0x859d('0xb0'),_0x47ed5d[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x47ed5d[_0x859d('0xb1')])){return this[_0x859d('0x10')]['noop'](_0x859d('0xb2'));}var _0x4ed375=_0x47ed5d[_0x859d('0xb1')];if(this[_0x859d('0x8a')](_0x47ed5d[_0x859d('0x7e')])){_0x4ed375+=','+_0x47ed5d[_0x859d('0x7e')];}var _0x1ded40=this[_0x859d('0x10')][_0x859d('0x5b')]('MRCPRecog',_0x4ed375);if(_0x1ded40[_0x859d('0xa8')]===-0x1){return _0x1ded40;}var _0x296e59=this[_0x859d('0xa7')](_0x859d('0xb3'),_0x859d('0xb4'));if(_0x296e59['result']===-0x1){return _0x296e59;}var _0xada98c=this[_0x859d('0xa7')](_0x859d('0xb5'),_0x859d('0xb6'));if(_0xada98c[_0x859d('0xa8')]===-0x1){return _0xada98c;}var _0xea090d=this[_0x859d('0xa7')](_0x859d('0xb7'),_0x859d('0xb8'));if(_0xea090d[_0x859d('0xa8')]===-0x1){return _0xea090d;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4ed375));};AGIVertices['prototype'][_0x859d('0x8')]=function(_0x57badc){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xb9'),_0x57badc[_0x859d('0x39')]));return this['channel'][_0x859d('0x8')]([_0x57badc[_0x859d('0xba')],_0x57badc[_0x859d('0xbb')]]);};AGIVertices[_0x859d('0x12')][_0x859d('0xbc')]=function(_0x1739cb){logger[_0x859d('0x2e')](util['format'](_0x859d('0xbd'),_0x1739cb['label']));if(this[_0x859d('0x8a')](_0x1739cb[_0x859d('0x6a')])){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xbe'),_0x1739cb['timeout']));var _0x46b190=this[_0x859d('0x10')][_0x859d('0xbf')](_0x1739cb['timeout']);if(_0x46b190[_0x859d('0xa8')]===-0x1){return _0x46b190;}}return this[_0x859d('0x10')][_0x859d('0xbc')]();};AGIVertices[_0x859d('0x12')][_0x859d('0x4e')]=function(_0x375d15){logger['info'](util[_0x859d('0x29')](_0x859d('0xc0'),_0x375d15[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x375d15[_0x859d('0x4c')])){return this['channel'][_0x859d('0x54')](_0x375d15,_0x859d('0xc1'));}_0x375d15[_0x859d('0x4d')]=moment();if(this['isConfigured'](_0x375d15[_0x859d('0xc2')])){_0x375d15[_0x859d('0x4d')]=moment()[_0x859d('0xc3')](_0x375d15[_0x859d('0xc2')],'minutes');}if(!this['isConfigured'](_0x375d15[_0x859d('0x50')])){_0x375d15[_0x859d('0x50')]=0x2;}this['createCmContact'][_0x859d('0x75')](this,_0x375d15);return this['channel'][_0x859d('0xac')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x375d15[_0x859d('0x4b')],_0x375d15[_0x859d('0x4c')],_0x375d15[_0x859d('0x4d')]));};AGIVertices[_0x859d('0x12')][_0x859d('0xc4')]=function(_0x150efa){logger[_0x859d('0x2e')](util['format'](_0x859d('0xc5'),_0x150efa['label']));var _0x5dc8ca=this[_0x859d('0x10')][_0x859d('0x5b')](_0x150efa[_0x859d('0xc6')],_0x150efa['options']);if(_0x5dc8ca[_0x859d('0xa8')]===-0x1){return _0x5dc8ca;}return this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0xc7'),_0x150efa[_0x859d('0xc6')],_0x150efa['options']));};AGIVertices[_0x859d('0x12')]['lumenvoxtts']=function(_0x1802c1){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xc8'),_0x1802c1[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x1802c1[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20text\x20configured');}var _0x28c79a='\x22'+_0x1802c1[_0x859d('0x60')]+'\x22';if(this[_0x859d('0x8a')](_0x1802c1['options'])){_0x28c79a+=','+_0x1802c1[_0x859d('0x7e')];}var _0x1e4c9e=this[_0x859d('0x10')]['exec'](_0x859d('0xae'),_0x28c79a);if(_0x1e4c9e[_0x859d('0xa8')]===-0x1){return _0x1e4c9e;}return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0xaf'),_0x28c79a));};AGIVertices[_0x859d('0x12')]['sestektts']=function(_0x5dc745){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xc9'),_0x5dc745['label']));if(!this[_0x859d('0x8a')](_0x5dc745[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}var _0x2d5309='\x22'+_0x5dc745[_0x859d('0x60')]+'\x22';if(this['isConfigured'](_0x5dc745[_0x859d('0x7e')])){_0x2d5309+=','+_0x5dc745[_0x859d('0x7e')];}var _0x235073=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xae'),_0x2d5309);if(_0x235073[_0x859d('0xa8')]===-0x1){return _0x235073;}return this['channel']['noop'](util[_0x859d('0x29')](_0x859d('0xaf'),_0x2d5309));};AGIVertices[_0x859d('0x12')]['lumenvoxasr']=function(_0x2ad8c6){logger[_0x859d('0x2e')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2ad8c6[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2ad8c6[_0x859d('0xb1')])){return this['channel'][_0x859d('0xac')](_0x859d('0xb2'));}var _0x1ba46d=_0x2ad8c6[_0x859d('0xb1')];if(this[_0x859d('0x8a')](_0x2ad8c6['options'])){_0x1ba46d+=','+_0x2ad8c6[_0x859d('0x7e')];}var _0x20c456=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xca'),_0x1ba46d);if(_0x20c456[_0x859d('0xa8')]===-0x1){return _0x20c456;}var _0x3578af=this[_0x859d('0xa7')](_0x859d('0xb3'),_0x859d('0xcb'));if(_0x3578af['result']===-0x1){return _0x3578af;}var _0x965612=this['getAndSetVariable'](_0x859d('0xb5'),_0x859d('0xcc'));if(_0x965612[_0x859d('0xa8')]===-0x1){return _0x965612;}var _0x37887a=this[_0x859d('0xa7')](_0x859d('0xb7'),_0x859d('0xcd'));if(_0x37887a[_0x859d('0xa8')]===-0x1){return _0x37887a;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xce'),_0x1ba46d));};AGIVertices[_0x859d('0x12')]['sestekasr']=function(_0x466415){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xcf'),_0x466415[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x466415[_0x859d('0xb1')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xb2'));}var _0x48f38a=_0x466415[_0x859d('0xb1')];if(this[_0x859d('0x8a')](_0x466415[_0x859d('0x7e')])){_0x48f38a+=','+_0x466415['options'];}var _0x5ba48d=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xca'),_0x48f38a);if(_0x5ba48d[_0x859d('0xa8')]===-0x1){return _0x5ba48d;}var _0xaa57a2=this[_0x859d('0xa7')](_0x859d('0xb3'),_0x859d('0xd0'));if(_0xaa57a2[_0x859d('0xa8')]===-0x1){return _0xaa57a2;}var _0x555e00=this['getAndSetVariable'](_0x859d('0xb5'),_0x859d('0xd1'));if(_0x555e00[_0x859d('0xa8')]===-0x1){return _0x555e00;}var _0x3a8d10=this[_0x859d('0xa7')](_0x859d('0xb7'),_0x859d('0xd2'));if(_0x3a8d10[_0x859d('0xa8')]===-0x1){return _0x3a8d10;}return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0xce'),_0x48f38a));};AGIVertices['prototype'][_0x859d('0xd3')]=function(_0x41ba74){logger[_0x859d('0x2e')](util['format'](_0x859d('0xd4'),_0x41ba74[_0x859d('0x39')]));if(!this['isConfigured'](_0x41ba74[_0x859d('0xd5')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x41ba74,'no\x20database\x20selected');}var _0x59a7ab=this[_0x859d('0xd6')]['sync'](this,_0x41ba74['odbc_id']);if(!_0x59a7ab){return this[_0x859d('0x10')][_0x859d('0x54')](_0x41ba74,_0x859d('0xd7'));}if(!this[_0x859d('0x8a')](_0x41ba74[_0x859d('0x30')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x41ba74,_0x859d('0xd8'));}var _0x2084e3=_0x41ba74[_0x859d('0x30')][_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xd9'),_0x2084e3));var _0x2920fe=this[_0x859d('0x2b')]['sync'](this,_0x59a7ab,_0x2084e3);this['createSquareDetailsReport'][_0x859d('0x75')](this,_0x41ba74,_0x2084e3);if(!this[_0x859d('0x8a')](_0x41ba74['variable_id'])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3741de=this['getVariable'][_0x859d('0x75')](this,_0x41ba74[_0x859d('0xda')]);if(!_0x3741de){return this['channel']['error'](_0x41ba74,_0x859d('0xdb'));}var _0x206fcf=this;_0x2920fe[_0x859d('0xdc')](function(_0x5ed673,_0x4875f9){Object[_0x859d('0xdd')](_0x5ed673)['forEach'](function(_0xded9ec){_0x206fcf[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0xde'),_0x3741de,_0x4875f9,_0xded9ec),_0x5ed673[_0xded9ec]);});});this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')]('%s_ROWS_COUNT',_0x3741de),_0x2920fe[_0x859d('0x9f')]);return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('variable\x20%s\x20set',_0x3741de));};AGIVertices[_0x859d('0x12')][_0x859d('0xdf')]=function(_0xa26abd){logger[_0x859d('0xe0')](util[_0x859d('0x29')](_0x859d('0xe1'),_0xa26abd[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0xa26abd[_0x859d('0xe2')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0xa26abd,_0x859d('0xe3'));}var _0x42c3fb=this[_0x859d('0xe4')][_0x859d('0x75')](this,_0xa26abd['sip_id']);if(!_0x42c3fb){return this[_0x859d('0x10')]['error'](_0xa26abd,_0x859d('0xe5'));}var _0x67d5c2=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xe6'),[util[_0x859d('0x29')](_0x859d('0xe7'),_0x42c3fb),_0xa26abd[_0x859d('0x6a')],_0xa26abd[_0x859d('0xe8')],_0xa26abd[_0x859d('0x68')]]);if(_0x67d5c2[_0x859d('0xa8')]===-0x1){return _0x67d5c2;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xe9'),_0x859d('0xe6')));};AGIVertices[_0x859d('0x12')][_0x859d('0xea')]=function(_0x213a51){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xeb'),_0x213a51[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x213a51[_0x859d('0x86')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xec'));}if(!this[_0x859d('0x8a')](_0x213a51['text'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xed')]=!![];this['createSquareDetailsReport'](_0x213a51);this[_0x859d('0x44')](_0x213a51[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xee'),_0x213a51[_0x859d('0x60')]));var _0x32c3ca=this[_0x859d('0x7f')][_0x859d('0x75')](this,_0x213a51);if(_0x32c3ca){for(var _0x39b90a in _0x32c3ca){if(_0x32c3ca[_0x859d('0x9a')](_0x39b90a)){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0xef'),_0x39b90a['toUpperCase']()),_0x32c3ca[_0x39b90a]);}}this[_0x859d('0x44')](_0x32c3ca[_0x859d('0xf0')],_0x859d('0xf1'),_0x859d('0xea'),'');return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Dialogflow\x20Result\x20%s',_0x32c3ca[_0x859d('0xf0')]));}return this[_0x859d('0x10')]['error'](_0x213a51,_0x859d('0xf2'));};AGIVertices[_0x859d('0x12')][_0x859d('0xf3')]=function(_0x35b7b2){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xf4'),_0x35b7b2[_0x859d('0x39')]));if(!this['isConfigured'](_0x35b7b2[_0x859d('0xf5')])){return this[_0x859d('0x10')]['noop'](_0x859d('0xf6'));}if(!this['isConfigured'](_0x35b7b2[_0x859d('0x81')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xf7'));}if(!this[_0x859d('0x8a')](_0x35b7b2['private_key'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xf8'));}if(!this[_0x859d('0x8a')](_0x35b7b2[_0x859d('0x83')])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x35b7b2[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xed')]=!![];this[_0x859d('0x37')](_0x35b7b2);this[_0x859d('0x44')](_0x35b7b2[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x35b7b2['text']));var _0x31e51c=this[_0x859d('0x80')][_0x859d('0x75')](this,_0x35b7b2);if(_0x31e51c){for(var _0x78ac68 in _0x31e51c){if(_0x31e51c[_0x859d('0x9a')](_0x78ac68)){if(_0x78ac68!=='providerResponse'){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0xef'),_0x78ac68[_0x859d('0x6f')]()),_0x31e51c[_0x78ac68]);}}}this[_0x859d('0x44')](_0x31e51c[_0x859d('0xf0')],_0x859d('0xf1'),'dialogflowV2',_0x31e51c[_0x859d('0xf9')]);return this[_0x859d('0x10')]['noop'](util['format'](_0x859d('0xfa'),_0x31e51c[_0x859d('0xf0')]));}return this[_0x859d('0x10')]['error'](_0x35b7b2,_0x859d('0xfb'));};AGIVertices['prototype'][_0x859d('0xfc')]=function(_0x40162d){logger['info'](util[_0x859d('0x29')](_0x859d('0xfd'),_0x40162d[_0x859d('0x39')]));if(!this['isConfigured'](_0x40162d['ndauth_url'])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x40162d[_0x859d('0xfe')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xff'));}if(!this[_0x859d('0x8a')](_0x40162d[_0x859d('0x100')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x101'));}if(!this[_0x859d('0x8a')](_0x40162d[_0x859d('0x102')])){return this[_0x859d('0x10')]['noop'](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xed')]=!![];this[_0x859d('0x37')](_0x40162d);this[_0x859d('0x44')](_0x40162d[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x103'),_0x40162d[_0x859d('0x60')]));var _0x727023=this['sestekNDA'][_0x859d('0x75')](this,_0x40162d);if(_0x727023){for(var _0x3b7576 in _0x727023){if(_0x727023[_0x859d('0x9a')](_0x3b7576)){this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')]('SESTEK_NDA_%s',_0x3b7576[_0x859d('0x6f')]()),_0x727023[_0x3b7576]);}}this[_0x859d('0x44')](_0x727023[_0x859d('0xf0')],_0x859d('0xf1'),_0x859d('0xfc'),'');if(_0x727023[_0x859d('0x104')]){this['channel']['noop'](util[_0x859d('0x29')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x727023[_0x859d('0x104')]));var _0x479881=this[_0x859d('0x10')][_0x859d('0x105')](_0x727023[_0x859d('0x104')]);try{fs[_0x859d('0x106')](_0x727023[_0x859d('0x104')]+'.wav');}catch(_0xe3e3cc){logger[_0x859d('0x54')](_0xe3e3cc);}return _0x479881;}else{return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x107'),_0x727023[_0x859d('0xf0')]));}}return this[_0x859d('0x10')][_0x859d('0x54')](_0x40162d,_0x859d('0x108'));};AGIVertices[_0x859d('0x12')][_0x859d('0x109')]=function(_0x9f80f5){logger[_0x859d('0x2e')](util['format'](_0x859d('0x10a'),_0x9f80f5[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x109'));};AGIVertices[_0x859d('0x12')]['ext_dial']=function(_0x2df04e){logger['info'](util[_0x859d('0x29')](_0x859d('0x10b'),_0x2df04e[_0x859d('0x39')]));var _0x45d377='';if(_0x2df04e[_0x859d('0x10c')]){if(!this[_0x859d('0x8a')](_0x2df04e['trunk_id'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2df04e,_0x859d('0x10d'));}else{var _0x313d4f=parseInt(_0x2df04e[_0x859d('0x10c')],0xa);if(isNaN(_0x313d4f)){_0x45d377=_0x2df04e[_0x859d('0x10c')];}else{_0x45d377=this[_0x859d('0x10e')][_0x859d('0x75')](this,_0x2df04e[_0x859d('0x10c')]);if(!_0x45d377){return this[_0x859d('0x10')]['error'](_0x2df04e,_0x859d('0x10f'));}}}}else if(_0x2df04e[_0x859d('0x110')]){_0x45d377=_0x2df04e[_0x859d('0x110')];}else{return this[_0x859d('0x10')][_0x859d('0x54')](_0x2df04e,_0x859d('0x10d'));}var _0x3f14db=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xe6'),[util['format'](_0x859d('0x111'),_0x45d377,_0x2df04e[_0x859d('0x4b')]),_0x2df04e[_0x859d('0x6a')],_0x2df04e[_0x859d('0xe8')],_0x2df04e[_0x859d('0x68')]]);if(_0x3f14db[_0x859d('0xa8')]===-0x1){return _0x3f14db;}return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0xe9'),_0x859d('0xe6')));};AGIVertices[_0x859d('0x12')]['finally']=function(_0x219871){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x112'),_0x219871[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x113'));};AGIVertices[_0x859d('0x12')]['getdigits']=function(_0x4a4da8){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x114'),_0x4a4da8[_0x859d('0x39')]));if(_0x4a4da8[_0x859d('0x115')]===0x0){return this['maxRetry'](_0x4a4da8);}_0x4a4da8[_0x859d('0x115')]-=0x1;if(!this[_0x859d('0x8a')](_0x4a4da8[_0x859d('0x116')])){return this['channel'][_0x859d('0x54')](_0x4a4da8,_0x859d('0x117'));}var _0x3dc397=this['getSound'][_0x859d('0x75')](this,_0x4a4da8[_0x859d('0x116')]);if(!_0x3dc397){return this['channel'][_0x859d('0x54')](_0x4a4da8,_0x859d('0x118'));}if(!this[_0x859d('0x8a')](_0x4a4da8[_0x859d('0xda')])){return this[_0x859d('0x10')]['error'](_0x859d('0x119'));}var _0x1053cb=this[_0x859d('0x10')]['getData'](_0x3dc397,_0x4a4da8[_0x859d('0x11a')],_0x4a4da8[_0x859d('0x11b')]);var _0x2c98be=_0x1053cb[_0x859d('0xa8')]?_0x1053cb['result'][_0x859d('0xa6')]():'';logger['info'](_0x859d('0x11c'),JSON[_0x859d('0x78')](_0x1053cb));if(_0x1053cb[_0x859d('0xa8')]===-0x1){this[_0x859d('0x37')][_0x859d('0x75')](this,_0x4a4da8,_0x2c98be);return _0x1053cb;}else if(_0x1053cb[_0x859d('0xa5')]==='timeout'){_0x1053cb['result']=_0x2c98be[_0x859d('0x9f')]>=parseInt(_0x4a4da8[_0x859d('0x11d')])?'x':'i';}else{_0x1053cb[_0x859d('0xa8')]=_0x2c98be[_0x859d('0x9f')]>=parseInt(_0x4a4da8[_0x859d('0x11d')])&&_0x2c98be[_0x859d('0x9f')]<=parseInt(_0x4a4da8[_0x859d('0x11b')])?'x':'i';}var _0x3d21a7=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x4a4da8[_0x859d('0xda')]);if(!_0x3d21a7){return this[_0x859d('0x10')][_0x859d('0x54')](_0x4a4da8,_0x859d('0xdb'));}this[_0x859d('0x10')][_0x859d('0xa9')](_0x3d21a7,_0x2c98be);if(this[_0x859d('0x8a')](_0x4a4da8[_0x859d('0x11e')])){var _0x40d25d=parseInt(_0x4a4da8['hiddendigitsnum'],0xa);var _0xd2e46b=rs[_0x859d('0x11f')]({'charset':'*','length':_0x40d25d});var _0x4db509=_0x2c98be['length'];if(_0x4db509>0x0){if(_0x4db509>_0x40d25d){this['createSquareDetailsReport'][_0x859d('0x75')](this,_0x4a4da8,_0x4a4da8[_0x859d('0x120')]===_0x859d('0x121')?_0xd2e46b+_0x2c98be['substr'](_0x40d25d):_0x2c98be[_0x859d('0x122')](0x0,_0x4db509-_0x40d25d)+_0xd2e46b);}else{this[_0x859d('0x37')][_0x859d('0x75')](this,_0x4a4da8,rs['generate']({'charset':'*','length':_0x4db509}));}}else{this[_0x859d('0x37')][_0x859d('0x75')](this,_0x4a4da8,'');}}else{this[_0x859d('0x37')]['sync'](this,_0x4a4da8,_0x2c98be);}return _0x1053cb;};AGIVertices[_0x859d('0x12')][_0x859d('0xf')]=function(_0x15b6d5){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x123'),_0x15b6d5[_0x859d('0x39')]));return this['getdigits'](_0x15b6d5);};AGIVertices['prototype']['goal']=function(_0x5cf983){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x124'),_0x5cf983[_0x859d('0x39')]));this[_0x859d('0x37')][_0x859d('0x75')](this,_0x5cf983,_0x5cf983['goalname']);return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('GOAL\x20%s',_0x5cf983[_0x859d('0x125')]));};AGIVertices['prototype'][_0x859d('0x126')]=function(_0x5539eb){logger['info'](util['format'](_0x859d('0x127'),_0x5539eb[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x5539eb[_0x859d('0x8d')])||!this[_0x859d('0x8a')](_0x5539eb[_0x859d('0x8e')])){return this[_0x859d('0x10')]['noop'](_0x859d('0x128'));}if(!this[_0x859d('0x8a')](_0x5539eb[_0x859d('0x60')])){return this['channel']['noop'](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x129'),_0x5539eb[_0x859d('0x60')]));var _0x17d788=this[_0x859d('0x8c')][_0x859d('0x75')](this,_0x5539eb);if(_0x17d788){this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x12a'),_0x17d788));var _0x3aae41=this[_0x859d('0x10')][_0x859d('0x105')](_0x17d788);try{fs[_0x859d('0x106')](_0x17d788+_0x859d('0x12b'));}catch(_0x484932){logger[_0x859d('0x54')](_0x484932);}return _0x3aae41;}return this[_0x859d('0x10')][_0x859d('0x54')](_0x5539eb,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x859d('0x12')][_0x859d('0x12c')]=function(_0x5c5fa0){logger['info'](util[_0x859d('0x29')](_0x859d('0x12d'),_0x5c5fa0[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x5c5fa0[_0x859d('0x8d')])||!this[_0x859d('0x8a')](_0x5c5fa0[_0x859d('0x8e')])){return this[_0x859d('0x10')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x859d('0x8a')](_0x5c5fa0['aws_bot_name'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x12e'));}if(!this[_0x859d('0x8a')](_0x5c5fa0['text'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this['channel'][_0x859d('0xed')]=!![];this['createSquareDetailsReport'](_0x5c5fa0);this[_0x859d('0x44')](_0x5c5fa0[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x12f'),_0x5c5fa0[_0x859d('0x60')]));var _0x2d454e=this['awsLex'][_0x859d('0x75')](this,_0x5c5fa0);if(_0x2d454e){for(var _0x40e7f2 in _0x2d454e){if(_0x2d454e[_0x859d('0x9a')](_0x40e7f2)&&_[_0x859d('0x130')](_0x2d454e[_0x40e7f2])){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')]('AWS_LEX_%s',_0x40e7f2[_0x859d('0x6f')]()),_0x2d454e[_0x40e7f2]);}}if(_[_0x859d('0x4a')](_0x2d454e[_0x859d('0x7c')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x131'));}else{this['createSquareMessage'](_0x2d454e[_0x859d('0x7c')],'out','amazonlex','');return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x2d454e['message']));}}return this[_0x859d('0x10')][_0x859d('0x54')](_0x5c5fa0,_0x859d('0x132'));};AGIVertices['prototype'][_0x859d('0x133')]=function(_0x48effa){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x134'),_0x48effa['label'],_0x48effa[_0x859d('0x6a')]));if(!this['isConfigured'](_0x48effa[_0x859d('0x86')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xec'));}var _0x58cc10=_0x859d('0x135');var _0x81f06e=util[_0x859d('0x29')](_0x859d('0x136'),FILES_PATH,rs['generate'](0x4));var _0x3421d6=util[_0x859d('0x29')]('%s.%s',_0x81f06e,_0x58cc10);var _0x5b12d0=!![];if(_0x48effa[_0x859d('0x137')]===_0x859d('0x138')){_0x5b12d0=![];}var _0x31f05b=this[_0x859d('0x10')]['recordFile'](_0x81f06e,_0x58cc10,_0x48effa[_0x859d('0x139')],_0x48effa['timeout'],undefined,_0x5b12d0);if(_0x31f05b[_0x859d('0xa8')]!==-0x1){this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x13a'),_0x3421d6));var _0x4c4d60=this[_0x859d('0x93')][_0x859d('0x75')](this,_0x48effa,_0x3421d6);if(_0x4c4d60){for(var _0x3f1a35 in _0x4c4d60){if(_0x4c4d60[_0x859d('0x9a')](_0x3f1a35)){this[_0x859d('0x10')][_0x859d('0xa9')](util['format'](_0x859d('0x13b'),_0x3f1a35['toUpperCase']()),_0x4c4d60[_0x3f1a35]);}}return this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0x13c'),JSON[_0x859d('0x78')](_0x4c4d60)));}}return _0x31f05b;};AGIVertices[_0x859d('0x12')]['tildeasr']=function(_0x874d67){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x13d'),_0x874d67[_0x859d('0x39')]));if(!this['isConfigured'](_0x874d67[_0x859d('0x96')])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x874d67[_0x859d('0x13e')])){return this[_0x859d('0x10')]['noop'](_0x859d('0x13f'));}var _0x26178f=_0x859d('0x135');var _0x4da111=util[_0x859d('0x29')](_0x859d('0x136'),FILES_PATH,rs['generate'](0x4));var _0x4659a0=util[_0x859d('0x29')](_0x859d('0xa1'),_0x4da111,_0x26178f);var _0x5b36cd=!![];if(_0x874d67[_0x859d('0x137')]===_0x859d('0x138')){_0x5b36cd=![];}var _0x482f2d=this[_0x859d('0x10')][_0x859d('0x140')](_0x4da111,_0x26178f,_0x874d67[_0x859d('0x139')],_0x874d67[_0x859d('0x6a')],undefined,_0x5b36cd);if(_0x482f2d[_0x859d('0xa8')]!==-0x1){this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x141'),_0x4659a0));var _0x4395f6=this[_0x859d('0x95')][_0x859d('0x75')](this,_0x874d67,_0x4659a0);if(_0x4395f6){for(var _0x2cd71c in _0x4395f6){if(_0x4395f6[_0x859d('0x9a')](_0x2cd71c)){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')]('TILDE_ASR_%s',_0x2cd71c[_0x859d('0x6f')]()),_0x4395f6[_0x2cd71c]);}}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x142'),JSON[_0x859d('0x78')](_0x4395f6)));}}return _0x482f2d;};AGIVertices[_0x859d('0x12')]['gotoc']=function(_0xd34371){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x143'),_0xd34371[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0x144')](_0xd34371[_0x859d('0x3e')],_0xd34371[_0x859d('0x3f')],_0xd34371[_0x859d('0x40')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x145')]=function(_0x3f9819){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3f9819[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x3f9819['condition'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x3f9819,_0x859d('0x146'));}try{var _0x5052d1=eval(_0x3f9819[_0x859d('0x147')])?_0x859d('0x148'):_0x859d('0x149');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3f9819['condition'],_0x5052d1));return{'code':0xc8,'result':_0x5052d1};}catch(_0x3d4686){return{'code':0xc8,'result':_0x859d('0x149')};}};AGIVertices['prototype'][_0x859d('0x14a')]=function(_0x39b3b7){logger['info'](util[_0x859d('0x29')](_0x859d('0x14b'),_0x39b3b7['label']));if(!this[_0x859d('0x8a')](_0x39b3b7[_0x859d('0x14c')])){return this['channel'][_0x859d('0x54')](_0x39b3b7,'no\x20interval\x20configured');}var _0x5cb199=this[_0x859d('0x26')]['sync'](this,_0x39b3b7['interval_id']);if(!_0x5cb199){return this[_0x859d('0x10')][_0x859d('0x54')](_0x39b3b7,_0x859d('0x14d'));}for(var _0x48c50a=0x0;_0x48c50a<_0x5cb199[_0x859d('0x9f')];_0x48c50a+=0x1){var _0x337caa=this['channel'][_0x859d('0xa4')](util[_0x859d('0x29')](_0x859d('0x14e'),_0x5cb199[_0x48c50a]));if(_0x337caa[_0x859d('0xa8')]===-0x1){return _0x337caa;}logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x337caa[_0x859d('0xa5')]));if(_0x337caa['extra']==='true'){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x148')));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x148')));return{'code':0xc8,'result':_0x859d('0x148')};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x149')));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x149')));}}return{'code':0xc8,'result':_0x859d('0x149')};};AGIVertices[_0x859d('0x12')][_0x859d('0x150')]=function(_0x145edb){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x145edb['label']));return this['channel']['hangup']();};AGIVertices['prototype'][_0x859d('0x151')]=function(_0xdb6160){logger['info'](util[_0x859d('0x29')](_0x859d('0x152'),_0xdb6160[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0xdb6160[_0x859d('0x86')])){return this['channel'][_0x859d('0xac')](_0x859d('0xec'));}var _0x497d11='wav';var _0x5bb620=util['format'](_0x859d('0x136'),FILES_PATH,rs['generate'](0x4));var _0x419dd2=util[_0x859d('0x29')](_0x859d('0xa1'),_0x5bb620,_0x497d11);var _0xadc32a=!![];if(_0xdb6160['beep']===_0x859d('0x138')){_0xadc32a=![];}var _0x2d1df2=this[_0x859d('0x10')][_0x859d('0x140')](_0x5bb620,_0x497d11,_0xdb6160['intKey'],_0xdb6160[_0x859d('0x6a')],undefined,_0xadc32a);if(_0x2d1df2['result']!==-0x1){this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x153'),_0x419dd2));var _0xff53a6=this[_0x859d('0x88')][_0x859d('0x75')](this,_0xdb6160,_0x419dd2);if(_0xff53a6){for(var _0x3c80da in _0xff53a6){if(_0xff53a6['hasOwnProperty'](_0x3c80da)){this[_0x859d('0x10')][_0x859d('0xa9')](util['format'](_0x859d('0x154'),_0x3c80da[_0x859d('0x6f')]()),_0xff53a6[_0x3c80da]);}}return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0xff53a6)));}}return _0x2d1df2;};AGIVertices[_0x859d('0x12')][_0x859d('0x155')]=function(_0x1a98e3){logger['info'](util[_0x859d('0x29')](_0x859d('0x156'),_0x1a98e3[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x1a98e3[_0x859d('0x86')])){return this[_0x859d('0x10')]['noop']('no\x20key\x20configured');}if(!this[_0x859d('0x8a')](_0x1a98e3[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x157'),_0x1a98e3[_0x859d('0x60')]));var _0x24cf86=this[_0x859d('0x85')][_0x859d('0x75')](this,_0x1a98e3);if(_0x24cf86){this['channel']['noop'](util[_0x859d('0x29')]('ispeech\x20%s\x20file\x20created',_0x24cf86));var _0x544f20=this[_0x859d('0x10')][_0x859d('0x105')](_0x24cf86,_0x1a98e3['intKey']);try{fs[_0x859d('0x106')](_0x24cf86+'.wav');}catch(_0xfbd3fc){logger['error'](_0xfbd3fc);}return _0x544f20;}return this[_0x859d('0x10')][_0x859d('0x54')](_0x1a98e3,_0x859d('0x158'));};AGIVertices[_0x859d('0x12')][_0x859d('0x159')]=function(_0x37b504){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15a'),_0x37b504[_0x859d('0x39')]));if(!this['isConfigured'](_0x37b504['findBy'])){return this['channel'][_0x859d('0x54')](_0x37b504,_0x859d('0x15b'));}logger['info'](util[_0x859d('0x29')](_0x859d('0x15c'),this['channel'][_0x859d('0x3c')],_0x37b504[_0x859d('0x15d')]));var _0x2a99dc=this[_0x859d('0x57')][_0x859d('0x75')](this,_0x37b504[_0x859d('0x15d')]);if(_0x2a99dc){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15e'),this['channel'][_0x859d('0x3c')],_0x37b504[_0x859d('0x15d')]));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x37b504['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x859d('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0x37b504[_0x859d('0x15d')]));this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x15f'),this['channel'][_0x859d('0x3c')],_0x37b504['findBy']));return{'code':0xc8,'result':_0x859d('0x160')};}};AGIVertices['prototype'][_0x859d('0x161')]=function(_0x146901){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x162'),_0x146901[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x146901['findBy'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x146901,_0x859d('0x15b'));}logger['info'](util[_0x859d('0x29')](_0x859d('0x15c'),this[_0x859d('0x10')]['callerid'],_0x146901[_0x859d('0x15d')]));var _0x2ea9e8=this[_0x859d('0x56')][_0x859d('0x75')](this,_0x146901[_0x859d('0x15d')]);if(_0x2ea9e8){logger['info'](util[_0x859d('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x859d('0x10')]['callerid'],_0x146901[_0x859d('0x15d')]));this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x146901[_0x859d('0x15d')]));return{'code':0xc8,'result':_0x859d('0x163')};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15f'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x146901[_0x859d('0x15d')]));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0x146901['findBy']));return{'code':0xc8,'result':_0x859d('0x160')};}};AGIVertices[_0x859d('0x12')]['math']=function(_0x528bbb){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x528bbb[_0x859d('0x39')]));if(!this['isConfigured'](_0x528bbb[_0x859d('0x164')])){return this['channel'][_0x859d('0x54')](_0x528bbb,_0x859d('0x165'));}this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x166'),_0x528bbb['operation']));var _0x5a111f=eval(_0x528bbb[_0x859d('0x164')]);if(!this[_0x859d('0x8a')](_0x528bbb['variable_id'])){return this['channel'][_0x859d('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x472849=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x528bbb['variable_id']);if(!_0x472849){return this[_0x859d('0x10')][_0x859d('0x54')](_0x528bbb,_0x859d('0xdb'));}if(_[_0x859d('0x167')](_0x5a111f)){var _0x15f9c4=this;_0x5a111f['forEach'](function(_0x240a5f,_0x418035){_0x15f9c4['channel']['setVariable'](util[_0x859d('0x29')]('%s[%s]',_0x472849,_0x418035),_0x240a5f);});return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x168'),_0x472849));}else{return this[_0x859d('0x10')][_0x859d('0xa9')](_0x472849,_0x5a111f);}};AGIVertices[_0x859d('0x12')][_0x859d('0x169')]=function(_0x446cf0){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x16a'),_0x446cf0[_0x859d('0x39')]));if(_0x446cf0[_0x859d('0x115')]===0x0){return this[_0x859d('0xaa')](_0x446cf0);}_0x446cf0[_0x859d('0x115')]-=0x1;if(!this['isConfigured'](_0x446cf0[_0x859d('0x116')])){return this['channel'][_0x859d('0x54')](_0x446cf0,_0x859d('0x117'));}var _0x4e07be=this['getSound'][_0x859d('0x75')](this,_0x446cf0[_0x859d('0x116')]);if(!_0x4e07be){return this[_0x859d('0x10')][_0x859d('0x54')](_0x446cf0,_0x859d('0x118'));}var _0x2d3f3a=this['channel'][_0x859d('0x16b')](_0x4e07be,_0x446cf0[_0x859d('0x11a')],_0x446cf0[_0x859d('0x16c')]);var _0x19e8a8=_0x2d3f3a[_0x859d('0xa8')];if(_0x2d3f3a['result']===-0x1){this[_0x859d('0x37')][_0x859d('0x75')](this,_0x446cf0,'-1');return _0x2d3f3a;}else if(_0x2d3f3a['extra']===_0x859d('0x6a')){_0x2d3f3a[_0x859d('0xa8')]=_0x2d3f3a[_0x859d('0xa8')][_0x859d('0x9f')]>0x0?_0x2d3f3a[_0x859d('0xa8')]:'t';}else if(_[_0x859d('0x48')](_0x2d3f3a[_0x859d('0xa8')])){_0x2d3f3a[_0x859d('0xa8')]='#';_0x19e8a8='#';}if(!this[_0x859d('0x8a')](_0x446cf0[_0x859d('0xda')])){this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x119'));}else{var _0x39bbc6=this[_0x859d('0xa4')]['sync'](this,_0x446cf0[_0x859d('0xda')]);if(!_0x39bbc6){return this['channel'][_0x859d('0x54')](_0x446cf0,_0x859d('0xdb'));}this[_0x859d('0x10')]['setVariable'](_0x39bbc6,_0x19e8a8);}this[_0x859d('0x37')][_0x859d('0x75')](this,_0x446cf0,_0x19e8a8);return _0x2d3f3a;};AGIVertices[_0x859d('0x12')][_0x859d('0xac')]=function(_0x2abe1f){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x16d'),_0x2abe1f[_0x859d('0x39')]));return this['channel'][_0x859d('0xac')](_0x2abe1f[_0x859d('0x16e')]||_0x2abe1f[_0x859d('0x39')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x16f')]=function(_0xe3137c){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x170'),_0xe3137c['label']));if(!this['isConfigured'](_0xe3137c[_0x859d('0x15d')])){return this['channel'][_0x859d('0x54')](_0xe3137c,_0x859d('0x15b'));}logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15c'),this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c[_0x859d('0x15d')]));var _0x32314d=this[_0x859d('0x171')]['sync'](this,_0xe3137c['pause_id']);var _0x53c68c=this[_0x859d('0x52')][_0x859d('0x75')](this,_0xe3137c[_0x859d('0x15d')],_0x32314d);if(_0x53c68c){logger['info'](util[_0x859d('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c['findBy']));this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c[_0x859d('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')]['callerid'],_0xe3137c['findBy']));this[_0x859d('0x10')][_0x859d('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c[_0x859d('0x15d')]));return{'code':0xc8,'result':_0x859d('0x160')};}};AGIVertices[_0x859d('0x12')]['playback']=function(_0xc68cbb){logger[_0x859d('0x2e')](util['format'](_0x859d('0x172'),_0xc68cbb['label']));if(!this[_0x859d('0x8a')](_0xc68cbb[_0x859d('0x116')])){return this[_0x859d('0x10')]['error'](_0xc68cbb,_0x859d('0x117'));}var _0x5eeffd=this[_0x859d('0x1e')]['sync'](this,_0xc68cbb['file_id']);if(!_0x5eeffd){return this[_0x859d('0x10')]['error'](_0xc68cbb,_0x859d('0x118'));}var _0x38e576=this[_0x859d('0x10')]['exec'](_0x859d('0x173'),[_0x5eeffd,_0xc68cbb[_0x859d('0xe8')]]);if(_0x38e576['result']===-0x1){return _0x38e576;}return this['channel'][_0x859d('0xac')](util['format'](_0x859d('0xc7'),_0x859d('0x173'),_0x5eeffd));};AGIVertices[_0x859d('0x12')][_0x859d('0x174')]=function(_0xf9b19b){logger[_0x859d('0x2e')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xf9b19b[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0xf9b19b[_0x859d('0x175')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0xf9b19b,'no\x20queue\x20selected');}var _0x347572='';var _0xd114a3=parseInt(_0xf9b19b[_0x859d('0x175')],0xa);if(isNaN(_0xd114a3)){_0x347572=_0xf9b19b[_0x859d('0x175')];}else{_0x347572=this[_0x859d('0x176')]['sync'](this,_0xf9b19b['queue_id']);if(!_0x347572){return this['channel']['error'](_0xf9b19b,_0x859d('0x177'));}}var _0x571855='';if(this['isConfigured'](_0xf9b19b['file_id'])){var _0x24f0c1=this[_0x859d('0x1e')][_0x859d('0x75')](this,_0xf9b19b['file_id']);if(_0x24f0c1){_0x571855=_0x24f0c1;}}this[_0x859d('0x37')][_0x859d('0x75')](this,_0xf9b19b,_0x347572);if(_0xf9b19b[_0x859d('0xe8')][_0x859d('0x178')]('x')<0x0){_0xf9b19b[_0x859d('0xe8')]+='x';}if(_0xf9b19b['opts'][_0x859d('0x178')]('X')<0x0){_0xf9b19b['opts']+='X';}this['channel'][_0x859d('0xa9')]('XMCS-QUEUE',_0x347572?_0x347572['toLowerCase']():'');var _0x4c927c=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0x179'),[_0x347572,_0xf9b19b[_0x859d('0xe8')],_0xf9b19b[_0x859d('0x68')],_0x571855,_0xf9b19b['timeout'],_0xf9b19b[_0x859d('0x8')],_0xf9b19b['macro'],_0xf9b19b[_0x859d('0x17a')],'',_0xf9b19b[_0x859d('0x17b')]]);if(_0x4c927c[_0x859d('0xa8')]===-0x1){return _0x4c927c;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Executed\x20command\x20%s\x20%s',_0x859d('0x179'),_0x347572));};AGIVertices[_0x859d('0x12')]['record']=function(_0x5accb8){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x17c'),_0x5accb8[_0x859d('0x39')]));var _0x576a67=_0x5accb8[_0x859d('0x17d')]||'wav';var _0x1bcad8=util['format'](_0x859d('0x17e'),this[_0x859d('0x10')][_0x859d('0x38')],rs[_0x859d('0x11f')](0x5));var _0x22e879=util[_0x859d('0x29')](_0x859d('0x17f'),FILES_PATH,_0x1bcad8,_0x576a67);var _0x7c9e5b=util['format'](_0x859d('0x136'),FILES_PATH,_0x1bcad8);this['createSquareRecording'][_0x859d('0x75')](this,_0x5accb8,_0x1bcad8,_0x22e879);this[_0x859d('0x10')][_0x859d('0xa9')]('RECORDING_SAVENAME',_0x1bcad8);logger[_0x859d('0x2e')](_0x859d('0x180'),_0x7c9e5b,_0x576a67,_0x5accb8[_0x859d('0x181')],_0x5accb8[_0x859d('0x6a')]);return this[_0x859d('0x10')][_0x859d('0x140')](_0x7c9e5b,_0x576a67,_0x5accb8['escape_digits'],_0x5accb8[_0x859d('0x6a')],undefined,!![]);};AGIVertices[_0x859d('0x12')][_0x859d('0x182')]=function(_0x1138ca){logger[_0x859d('0x2e')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1138ca[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x1138ca['url'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x183'));}var _0xf61625=this[_0x859d('0x67')][_0x859d('0x75')](this,_0x1138ca);logger['info'](util['format'](_0x859d('0x184'),util[_0x859d('0x185')](_0xf61625,{'showHidden':![],'depth':null})));if(!this[_0x859d('0x8a')](_0x1138ca[_0x859d('0xda')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x186'));}var _0x1013a4=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x1138ca[_0x859d('0xda')]);if(!_0x1013a4){return this[_0x859d('0x10')]['error'](_0x1138ca,'no\x20variable\x20found');}this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0x187'),_0x1013a4),_0xf61625['statusCode']?_0xf61625[_0x859d('0x7b')]:_0x859d('0x188'));this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')]('%s_STATUS_MESSAGE',_0x1013a4),_0xf61625[_0x859d('0x7a')]?_0xf61625[_0x859d('0x7a')]:'OK');if(_0xf61625[_0x859d('0x77')]){try{this[_0x859d('0xa0')](_0xf61625[_0x859d('0x77')],_0x1013a4);}catch(_0x3d8572){logger[_0x859d('0x54')](util[_0x859d('0x29')](_0x859d('0x189'),_0x1013a4));}}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x18a'),_0x1013a4));};AGIVertices['prototype'][_0x859d('0x18b')]=function(_0x28d3a8){logger['info'](util[_0x859d('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x28d3a8[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0x18c')](_0x28d3a8[_0x859d('0x18d')][_0x859d('0x5d')](/\s+/g,''),_0x28d3a8[_0x859d('0x181')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x18e')]=function(_0x2a43d4){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x18f'),_0x2a43d4[_0x859d('0x39')]));return this[_0x859d('0x10')]['sayNumber'](_0x2a43d4[_0x859d('0x6b')][_0x859d('0x5d')](/\s+/g,''),_0x2a43d4[_0x859d('0x181')]);};AGIVertices['prototype']['sayphonetic']=function(_0x249c49){logger[_0x859d('0x2e')](util['format'](_0x859d('0x190'),_0x249c49['label']));return this[_0x859d('0x10')][_0x859d('0x191')](_0x249c49['text'],_0x249c49[_0x859d('0x181')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x192')]=function(_0x2ff638){logger[_0x859d('0x2e')](util['format'](_0x859d('0x193'),_0x2ff638[_0x859d('0x39')]));if(!this['isConfigured'](_0x2ff638[_0x859d('0x194')])){return this['channel'][_0x859d('0xac')](_0x859d('0x195'));}var _0x48f521=this[_0x859d('0x22')][_0x859d('0x75')](this,_0x2ff638[_0x859d('0x194')]);if(!_0x48f521||!_0x48f521['Smtp']){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2ff638,_0x859d('0x196'));}var _0xcb4537={'from':util[_0x859d('0x29')](_0x859d('0x197'),_0x48f521[_0x859d('0x14')],_0x48f521[_0x859d('0x198')]||_0x48f521[_0x859d('0x199')][_0x859d('0x19a')]),'to':_0x2ff638['to']||'','cc':_0x2ff638['cc']||'','bcc':_0x2ff638[_0x859d('0x19b')]||'','subject':_0x2ff638[_0x859d('0x19c')],'html':_0x2ff638['text'],'text':_0x2ff638[_0x859d('0x60')]};var _0x17c09f={'tls':{'rejectUnauthorized':![]}};if(_0x48f521['Smtp'][_0x859d('0x19d')]){_0x17c09f[_0x859d('0x19d')]=_0x48f521[_0x859d('0x199')][_0x859d('0x19d')];}else{_0x17c09f['host']=_0x48f521['Smtp'][_0x859d('0x19e')];_0x17c09f[_0x859d('0x19f')]=_0x48f521[_0x859d('0x199')][_0x859d('0x19f')];_0x17c09f[_0x859d('0x1a0')]=_0x48f521[_0x859d('0x199')][_0x859d('0x1a0')];}if(_0x48f521[_0x859d('0x199')][_0x859d('0x1a1')]){_0x17c09f[_0x859d('0x1a2')]={'user':_0x48f521['Smtp'][_0x859d('0x19a')],'pass':_0x48f521[_0x859d('0x199')][_0x859d('0x1a3')]};}if(this[_0x859d('0x8a')](_0x2ff638[_0x859d('0x1a4')])){}logger['debug'](_0x859d('0x1a5'),JSON[_0x859d('0x78')](_0xcb4537));this[_0x859d('0x37')][_0x859d('0x75')](this,_0x2ff638,_0x2ff638['account_id']);this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x1a6'),_0x48f521['name']));this[_0x859d('0x25')][_0x859d('0x75')](this,_0x17c09f,_0xcb4537);return this[_0x859d('0x10')]['noop'](_0x859d('0x1a7'));};AGIVertices['prototype'][_0x859d('0x1a8')]=function(_0xb0348b){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1a9'),_0xb0348b[_0x859d('0x39')]));return this['channel'][_0x859d('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x859d('0x12')][_0x859d('0x1aa')]=function(_0x3d2922){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1ab'),_0x3d2922[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x3d2922[_0x859d('0x1ac')])){return this['channel'][_0x859d('0xac')](_0x859d('0x1ad'));}var _0x51dd1b=this[_0x859d('0x34')][_0x859d('0x75')](this,_0x3d2922['sms_account_id']);if(!_0x51dd1b){return this['channel'][_0x859d('0x54')](_0x3d2922,_0x859d('0x1ae'));}var _0x25e4fb={'body':_0x3d2922['sms_text'],'phone':_0x3d2922['to']||'','SmsAccountId':_0x51dd1b['id']};logger[_0x859d('0xe0')](_0x859d('0x1af'),JSON[_0x859d('0x78')](_0x25e4fb));this[_0x859d('0x37')][_0x859d('0x75')](this,_0x3d2922,_0x3d2922[_0x859d('0x1ac')]);this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x51dd1b[_0x859d('0x14')]));this[_0x859d('0x36')][_0x859d('0x75')](this,_0x25e4fb);return this['channel'][_0x859d('0xac')](_0x859d('0x1b0'));};AGIVertices[_0x859d('0x12')][_0x859d('0x1b1')]=function(_0x2d3a17){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1b2'),_0x2d3a17[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2d3a17[_0x859d('0xda')])){return this[_0x859d('0x10')]['error'](_0x2d3a17,_0x859d('0x1b3'));}var _0x31f9ae=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x2d3a17['variable_id']);if(!_0x31f9ae){return this['channel'][_0x859d('0x54')](_0x2d3a17,_0x859d('0xdb'));}return this[_0x859d('0x10')][_0x859d('0xa9')](_0x31f9ae,_0x2d3a17['variable_value']);};AGIVertices['prototype']['start']=function(_0x319ee7){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1b4'),_0x319ee7['label']));this[_0x859d('0x10')]['noop'](_0x859d('0x1b5'));if(_0x319ee7[_0x859d('0xbc')]==='yes'){this['channel']['noop'](_0x859d('0x1b6'));return this[_0x859d('0x10')]['answer']();}return this['channel']['noop'](_0x859d('0x1b7'));};AGIVertices['prototype'][_0x859d('0x1b8')]=function(_0x2fd71e){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1b9'),_0x2fd71e[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2fd71e[_0x859d('0x1ba')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2fd71e,'no\x20subproject\x20selected');}var _0x3935c9=this['getSquareProject'][_0x859d('0x75')](this,_0x2fd71e['project_id']);if(!this[_0x859d('0x8a')](_0x3935c9)){return this['channel'][_0x859d('0x54')](_0x2fd71e,util[_0x859d('0x29')](_0x859d('0x1bb'),_0x2fd71e[_0x859d('0x1ba')]));}if(_0x3935c9===this['channel'][_0x859d('0x43')]){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2fd71e,_0x859d('0x1bc'));}this[_0x859d('0x37')][_0x859d('0x75')](this,_0x2fd71e,_0x3935c9);var _0x11f426=this[_0x859d('0x10')][_0x859d('0x5b')]('AGI',util[_0x859d('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||_0x859d('0x1bd'),_0x3935c9,this[_0x859d('0x10')]['arg_1']));if(_0x11f426['result']===-0x1){return _0x11f426;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xc7'),'AGI',_0x3935c9));};AGIVertices[_0x859d('0x12')]['system']=function(_0x14a5cc){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x14a5cc[_0x859d('0x39')]));var _0x3e9a5e=this[_0x859d('0x5a')][_0x859d('0x75')](this,_0x14a5cc['command']);this[_0x859d('0x37')][_0x859d('0x75')](this,_0x14a5cc,_0x14a5cc[_0x859d('0xba')]);if(this[_0x859d('0x8a')](_0x14a5cc[_0x859d('0xda')])){var _0x47b838=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x14a5cc['variable_id']);if(_0x47b838){this[_0x859d('0x10')]['setVariable'](_0x47b838,_0x3e9a5e);return this[_0x859d('0x10')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x14a5cc[_0x859d('0xba')],_0x47b838));}}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x14a5cc[_0x859d('0xba')]));};AGIVertices['prototype'][_0x859d('0x1be')]=function(_0x44ed33){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x44ed33['label']));_0x44ed33['text']=_0x44ed33['text'][_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x859d('0x8a')](_0x44ed33['apiKey'])){return this[_0x859d('0x10')]['noop'](_0x859d('0x1bf'));}if(!this[_0x859d('0x8a')](_0x44ed33[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x1c0'),_0x44ed33[_0x859d('0x60')]));var _0x4469d3=this['googleCloudTTS'][_0x859d('0x75')](this,_0x44ed33);if(_0x4469d3){this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4469d3));var _0x3f2828=this[_0x859d('0x10')][_0x859d('0x105')](_0x4469d3);try{fs[_0x859d('0x106')](_0x4469d3+_0x859d('0x12b'));}catch(_0x4179d4){logger[_0x859d('0x54')](_0x4179d4);}return _0x3f2828;}return this['channel'][_0x859d('0x54')](_0x44ed33,_0x859d('0x1c1'));};AGIVertices[_0x859d('0x12')][_0x859d('0x1c2')]=function(_0x24e303){logger[_0x859d('0x2e')](util['format'](_0x859d('0x1c3'),_0x24e303[_0x859d('0x39')]));_0x24e303['text']=_0x24e303['text'][_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x859d('0x8a')](_0x24e303['text'])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20text\x20configured');}this['channel'][_0x859d('0xac')](util[_0x859d('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x24e303['text']));var _0x22a12c=this[_0x859d('0x66')][_0x859d('0x75')](this,_0x24e303);if(_0x22a12c){this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0x1c4'),_0x22a12c));var _0x28a305=this[_0x859d('0x10')][_0x859d('0x105')](_0x22a12c);try{}catch(_0x5b8fb4){logger[_0x859d('0x54')](_0x5b8fb4);}return _0x28a305;}return this[_0x859d('0x10')]['error'](_0x24e303,_0x859d('0x1c5'));};AGIVertices[_0x859d('0x12')][_0x859d('0x1c6')]=function(_0x7a5adb){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1c7'),_0x7a5adb[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x7a5adb[_0x859d('0x15d')])){return this['channel'][_0x859d('0x54')](_0x7a5adb,_0x859d('0x15b'));}logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15c'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x7a5adb[_0x859d('0x15d')]));var _0x1957b9=this[_0x859d('0x55')][_0x859d('0x75')](this,_0x7a5adb['findBy']);if(_0x1957b9){logger['info'](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')]['callerid'],_0x7a5adb[_0x859d('0x15d')]));this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0x15e'),this['channel']['callerid'],_0x7a5adb['findBy']));return{'code':0xc8,'result':_0x859d('0x163')};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15f'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x7a5adb[_0x859d('0x15d')]));this['channel'][_0x859d('0xac')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')]['callerid'],_0x7a5adb[_0x859d('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x859d('0x12')]['voicemail']=function(_0x554516){logger[_0x859d('0x2e')](util['format'](_0x859d('0x1c8'),_0x554516[_0x859d('0x39')]));var _0x43f1b2=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0x1c9'),[_0x554516[_0x859d('0x1ca')],_0x554516[_0x859d('0x7e')]]);if(_0x43f1b2[_0x859d('0xa8')]===-0x1){return _0x43f1b2;}return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xc7'),_0x859d('0x1c9'),_0x554516[_0x859d('0x1ca')]));};AGIVertices[_0x859d('0x12')][_0x859d('0x1cb')]=function(_0x2866f2){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1cc'),_0x2866f2[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2866f2['variable_id'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2866f2,_0x859d('0x1b3'));}var _0x5bdceb=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x2866f2[_0x859d('0xda')]);if(!_0x5bdceb){return this['channel'][_0x859d('0x54')](_0x2866f2,_0x859d('0xdb'));}var _0x5e82ce=this[_0x859d('0x10')][_0x859d('0xa4')](_0x5bdceb);return{'code':0xc8,'result':_0x5e82ce[_0x859d('0xa5')]?_0x5e82ce[_0x859d('0xa5')]:'-'};};String['prototype']['replaceAll']=function(_0x4034c6,_0x6931d){return this[_0x859d('0xa2')](_0x4034c6)[_0x859d('0x1cd')](_0x6931d);};module['exports']=AGIVertices; \ No newline at end of file +var _0xb730=['generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','subject','service','host','port','secure','auth','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','AGI','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','odbc','randomstring','request-promise','../../config/logger','../../config/environment','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','isNil','agentUnpause','agent','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','url','method','timeout','number','includes','POST','toUpperCase','body','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','tildeASR','appid','appsecret','clear','clone','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','replaceObjectAllVariables','split','length','replaceAll','getVariable','extra','toString','getAndSetVariable','maxRetry','retry','isConfigured','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit'];(function(_0x2ec7e4,_0x3cac0c){var _0x1d1056=function(_0x1a6380){while(--_0x1a6380){_0x2ec7e4['push'](_0x2ec7e4['shift']());}};_0x1d1056(++_0x3cac0c);}(_0xb730,0xac));var _0x0b73=function(_0x2f0998,_0x1f674a){_0x2f0998=_0x2f0998-0x0;var _0x2b78af=_0xb730[_0x2f0998];return _0x2b78af;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x0b73('0x0'));var _=require(_0x0b73('0x1'));var sh=require('shelljs');var odbc=require(_0x0b73('0x2'))();var rs=require(_0x0b73('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x0b73('0x4'));var logger=require(_0x0b73('0x5'))('agi');var config=require(_0x0b73('0x6'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x0b73('0x7')];var verticesWithRetry=[_0x0b73('0x8'),_0x0b73('0x9'),_0x0b73('0xa')];var AGIVertices=function(_0x372d11,_0x46176f,_0x590783){this[_0x0b73('0xb')]=_0x372d11;this[_0x0b73('0xc')]=_0x46176f;this['mailRpc']=_0x590783;};AGIVertices[_0x0b73('0xd')]['getVariable']=function(_0x5998b7,_0x4de446){this[_0x0b73('0xc')][_0x0b73('0xe')](_0x5998b7)[_0x0b73('0xf')](function(_0x46230a){_0x4de446(null,_0x46230a?_0x46230a[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x2b180c){_0x4de446(_0x2b180c);});};AGIVertices['prototype'][_0x0b73('0x12')]=function(_0x16827b,_0x505938){this[_0x0b73('0xc')][_0x0b73('0x13')](_0x16827b)[_0x0b73('0xf')](function(_0xcdadfb){_0x505938(null,_0xcdadfb?_0xcdadfb[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0xa0fffe){_0x505938(_0xa0fffe);});};AGIVertices[_0x0b73('0xd')]['getSquareProject']=function(_0x19e27d,_0x2be6e8){this[_0x0b73('0xc')]['getSquareProjectById'](_0x19e27d)[_0x0b73('0xf')](function(_0x784d39){_0x2be6e8(null,_0x784d39?_0x784d39['name']:![]);})['catch'](function(_0x45d7a1){_0x2be6e8(_0x45d7a1);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x14')]=function(_0xc5c4,_0x4947e3){this[_0x0b73('0xc')][_0x0b73('0x15')](_0xc5c4)['then'](function(_0x30dd76){_0x4947e3(null,_0x30dd76?_0x30dd76['dsn']:![]);})[_0x0b73('0x11')](function(_0x165b98){_0x4947e3(_0x165b98);});};AGIVertices['prototype'][_0x0b73('0x16')]=function(_0x4a77e3,_0x3992da){this[_0x0b73('0xc')][_0x0b73('0x17')](_0x4a77e3)[_0x0b73('0xf')](function(_0x24184e){_0x3992da(null,_0x24184e?_0x24184e[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x59edce){_0x3992da(_0x59edce);});};AGIVertices['prototype']['getTrunk']=function(_0x28321a,_0x15e748){this['rpc'][_0x0b73('0x18')](_0x28321a)['then'](function(_0x53f3df){_0x15e748(null,_0x53f3df?_0x53f3df[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x24bd43){_0x15e748(_0x24bd43);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x19')]=function(_0x32f655,_0x16be94){var _0x28b25c=this;this[_0x0b73('0xc')][_0x0b73('0x1a')](_0x32f655)[_0x0b73('0xf')](function(_0x189cf9){_0x16be94(null,_0x189cf9?_0x28b25c[_0x0b73('0x1b')](_0x189cf9[_0x0b73('0x1c')]):![]);})[_0x0b73('0x11')](function(_0x146ad8){_0x16be94(_0x146ad8);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1d')]=function(_0x531a89,_0xb268c){this[_0x0b73('0xc')]['getMailAccountById'](_0x531a89)[_0x0b73('0xf')](function(_0x1da1a0){_0xb268c(null,_0x1da1a0?_0x1da1a0:![]);})['catch'](function(_0x1038cb){_0xb268c(_0x1038cb);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1e')]=function(_0x490449,_0x3556fe,_0x128913){this['mailRpc'][_0x0b73('0x1e')](_0x490449,_0x3556fe)[_0x0b73('0xf')](function(){_0x128913(null);})[_0x0b73('0x11')](function(_0x502d17){_0x128913(_0x502d17);});};AGIVertices['prototype'][_0x0b73('0x1f')]=function(_0x5e5726,_0x518d67){this['rpc'][_0x0b73('0x20')](_0x5e5726)['then'](function(_0x10b66b){if(_0x10b66b){if(_0x10b66b[_0x0b73('0x21')]){_0x518d67(null,[_0x10b66b[_0x0b73('0x22')]]);}else{_0x518d67(null,_[_0x0b73('0x23')](_0x10b66b['Intervals'],'interval'));}}else{_0x518d67(null,![]);}})['catch'](function(_0x387f56){_0x518d67(_0x387f56);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1b')]=function(_0x547a9f){return util[_0x0b73('0x24')](_0x0b73('0x25'),FILES_PATH,_0x547a9f);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x26')]=function(_0x4c9fe4,_0x3ccee6,_0x1a4e48){odbc[_0x0b73('0x27')](_0x4c9fe4,function(_0x270131){if(_0x270131){logger[_0x0b73('0x28')](_0x0b73('0x29'),_0x270131);_0x1a4e48(_0x270131);}else{logger['info'](_0x0b73('0x2a'));odbc[_0x0b73('0x2b')](_0x3ccee6,function(_0x2b0711,_0x59f108){if(_0x2b0711){logger[_0x0b73('0x2c')](_0x0b73('0x2d'),_0x3ccee6);_0x1a4e48(_0x2b0711);}else{logger['info'](_0x0b73('0x2e'),_0x3ccee6);odbc[_0x0b73('0x2f')](function(_0x7ffde7){if(_0x7ffde7){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x7ffde7);}_0x1a4e48(null,_0x59f108);});}});}});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x30')]=function(_0x2ad18a,_0x21021e){this[_0x0b73('0xc')][_0x0b73('0x31')](_0x2ad18a)[_0x0b73('0xf')](function(_0x1e6afb){_0x21021e(null,_0x1e6afb?_0x1e6afb:![]);})[_0x0b73('0x11')](function(_0x993d0d){_0x21021e(_0x993d0d);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x32')]=function(_0x1f887d,_0x476dfb){this[_0x0b73('0xc')]['createSmsMessage'](_0x1f887d)[_0x0b73('0xf')](function(_0x2b7ad8){_0x476dfb(null,_0x2b7ad8);})['catch'](function(_0x354e40){_0x476dfb(_0x354e40);});};AGIVertices['prototype'][_0x0b73('0x33')]=function(_0x64461d,_0x11fc39,_0x3239fe){this['rpc'][_0x0b73('0x33')]({'uniqueid':this[_0x0b73('0xb')][_0x0b73('0x34')],'node':_0x64461d[_0x0b73('0x35')],'application':_0x64461d[_0x0b73('0x36')],'data':_0x11fc39||null,'project_name':this[_0x0b73('0xb')][_0x0b73('0x37')],'callerid':this[_0x0b73('0xb')][_0x0b73('0x38')]})['then'](function(_0x502d95){if(_0x3239fe){_0x3239fe(null,_0x502d95);}})[_0x0b73('0x11')](function(_0x5e3774){if(_0x3239fe){_0x3239fe(_0x5e3774);}});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x39')]=function(_0x11f676,_0x2db1e3,_0x140a4e,_0x368220){this[_0x0b73('0xc')][_0x0b73('0x39')]({'uniqueid':this[_0x0b73('0xb')][_0x0b73('0x34')],'callerid':this[_0x0b73('0xb')][_0x0b73('0x38')],'calleridname':this[_0x0b73('0xb')]['calleridname'],'context':this[_0x0b73('0xb')][_0x0b73('0x3a')],'extension':this[_0x0b73('0xb')][_0x0b73('0x3b')],'priority':this[_0x0b73('0xb')][_0x0b73('0x3c')],'accountcode':this['channel'][_0x0b73('0x3d')],'dnid':this['channel']['dnid'],'projectName':this['channel'][_0x0b73('0x37')],'saveName':_0x2db1e3,'filename':_0x11f676[_0x0b73('0x3e')]||_0x2db1e3,'savePath':_0x140a4e})['then'](function(_0x15ae6c){_0x368220(null,_0x15ae6c);})[_0x0b73('0x11')](function(_0x5d1266){_0x368220(_0x5d1266);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x3f')]=function(_0x5af0ec,_0x39ef14,_0x13e01f,_0x1a4e1f,_0x1d1ced){this[_0x0b73('0xc')][_0x0b73('0x3f')]({'uniqueid':this[_0x0b73('0xb')]['uniqueid'],'body':_0x5af0ec,'direction':_0x39ef14,'providerName':_0x13e01f,'providerResponse':_0x1a4e1f})[_0x0b73('0xf')](function(_0x1b1e2b){if(_0x1d1ced){_0x1d1ced(null,_0x1b1e2b);}})['catch'](function(_0x1cc690){if(_0x1d1ced){_0x1d1ced(_0x1cc690);}});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x40')]=function(_0x4a0aeb,_0x38c4ba){this[_0x0b73('0xc')][_0x0b73('0x40')]({'firstName':_[_0x0b73('0x41')](_0x4a0aeb['name'])||_['isNil'](_0x4a0aeb['name'])?_0x0b73('0x42')+Math[_0x0b73('0x43')]():_0x4a0aeb['name'],'lastName':_[_0x0b73('0x41')](_0x4a0aeb[_0x0b73('0x44')])||_['isNil'](_0x4a0aeb['lastName'])?null:_0x4a0aeb['lastName'],'phone':_0x4a0aeb[_0x0b73('0x45')],'ListId':_0x4a0aeb[_0x0b73('0x46')],'scheduledat':_0x4a0aeb[_0x0b73('0x47')],'callbackUniqueid':this[_0x0b73('0xb')]['uniqueid'],'tags':_0x0b73('0x48'),'description':_0x0b73('0x49')+_0x4a0aeb[_0x0b73('0x47')]['toString'](),'priority':_0x4a0aeb[_0x0b73('0x4a')]})[_0x0b73('0xf')](function(_0x2d31ec){_0x38c4ba(null,_0x2d31ec);})[_0x0b73('0x11')](function(_0xc12d78){_0x38c4ba(_0xc12d78);});};AGIVertices['prototype'][_0x0b73('0x4b')]=function(_0x25d6c7,_0x17e45b){this[_0x0b73('0xc')][_0x0b73('0x4c')](_0x25d6c7)['then'](function(_0x5e0525){_0x17e45b(null,_0x5e0525?_0x5e0525[_0x0b73('0x10')]:![]);})[_0x0b73('0x11')](function(_0x4e7e13){_0x17e45b(_0x4e7e13);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x4d')]=function(_0x268780,_0x2d3b82,_0x1c9872){var _0x1a18b2={'role':'agent'};_0x1a18b2[_0x268780]=this[_0x0b73('0xb')][_0x0b73('0x38')];this[_0x0b73('0xc')][_0x0b73('0x4d')](_0x1a18b2,_0x2d3b82,this[_0x0b73('0xb')][_0x0b73('0x34')])[_0x0b73('0xf')](function(_0x9ff7b0){_0x1c9872(null,_[_0x0b73('0x4e')](_0x9ff7b0)?![]:!![]);})[_0x0b73('0x11')](function(_0x4ced5f){logger[_0x0b73('0x28')](_0x4ced5f);_0x1c9872(null,![]);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x4f')]=function(_0x56cc12,_0x4f82cc){var _0x31b6b3={'role':_0x0b73('0x50')};_0x31b6b3[_0x56cc12]=this[_0x0b73('0xb')][_0x0b73('0x38')];this[_0x0b73('0xc')][_0x0b73('0x4f')](_0x31b6b3)[_0x0b73('0xf')](function(_0x2528b4){_0x4f82cc(null,_[_0x0b73('0x4e')](_0x2528b4)?![]:!![]);})['catch'](function(_0x473ce9){logger['error'](_0x473ce9);_0x4f82cc(null,![]);});};AGIVertices[_0x0b73('0xd')]['agentLogout']=function(_0x34004e,_0x1718a1){var _0x50f701={'role':_0x0b73('0x50')};_0x50f701[_0x34004e]=this['channel'][_0x0b73('0x38')];this['rpc']['agentLogout'](_0x50f701)['then'](function(_0x18808c){_0x1718a1(null,_[_0x0b73('0x4e')](_0x18808c)?![]:!![]);})[_0x0b73('0x11')](function(_0x259c2b){logger[_0x0b73('0x28')](_0x259c2b);_0x1718a1(null,![]);});};AGIVertices['prototype'][_0x0b73('0x51')]=function(_0x1d7218,_0x14cccc){var _0x10ebba={'role':_0x0b73('0x50')};_0x10ebba[_0x1d7218]=this[_0x0b73('0xb')]['callerid'];var _0x10b2b6=_0x1d7218!='internal'?util[_0x0b73('0x24')](_0x0b73('0x52'),_0x0b73('0x53'),this[_0x0b73('0xb')]['callerid']):undefined;this[_0x0b73('0xc')][_0x0b73('0x51')](_0x10ebba,_0x10b2b6)[_0x0b73('0xf')](function(_0x350141){_0x14cccc(null,_[_0x0b73('0x4e')](_0x350141)?![]:!![]);})['catch'](function(_0x3ec8d8){logger[_0x0b73('0x28')](_0x3ec8d8);_0x14cccc(null,![]);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x54')]=function(_0x544b0b,_0x523cfd){sh[_0x0b73('0x55')](_[_0x0b73('0x56')](_0x544b0b),function(_0x2af97d,_0x3fa891){var _0x432ecf=_0x3fa891[_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'');_0x523cfd(null,_0x432ecf);});};AGIVertices['prototype'][_0x0b73('0x58')]=function(_0x77907d,_0x48174a){scripts[_0x0b73('0x58')](_0x77907d['apiKey'],_0x77907d[_0x0b73('0x59')]||_0x0b73('0x5a'),_0x77907d[_0x0b73('0x5a')],_0x77907d[_0x0b73('0x5b')]||_0x0b73('0x5c'),_0x77907d['ssmlGender']||_0x0b73('0x5d'),_0x77907d[_0x0b73('0x5e')]||_0x0b73('0x5f'))[_0x0b73('0xf')](function(_0x11237c){_0x48174a(null,_0x11237c);})[_0x0b73('0x11')](function(_0x15922c){_0x48174a(_0x15922c);});};AGIVertices['prototype']['googleTTS']=function(_0x2bf9c6,_0x2c6da0){scripts[_0x0b73('0x60')](_0x2bf9c6[_0x0b73('0x5a')],_0x2bf9c6['google_tts_language']||'en',0x1)[_0x0b73('0xf')](function(_0x4443fa){_0x2c6da0(null,_0x4443fa);})[_0x0b73('0x11')](function(_0x244405){_0x2c6da0(_0x244405);});};AGIVertices[_0x0b73('0xd')]['restAPI']=function(_0x4e5414,_0x1ee0d1){var _0xd9f97f={'uri':_0x4e5414[_0x0b73('0x61')],'method':_0x4e5414[_0x0b73('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4e5414[_0x0b73('0x63')])===_0x0b73('0x64')&&parseInt(_0x4e5414[_0x0b73('0x63')])>=0x1?parseInt(_0x4e5414[_0x0b73('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x0b73('0x65')]([_0x0b73('0x66'),'PUT'],_0xd9f97f[_0x0b73('0x62')][_0x0b73('0x67')]())){try{_0xd9f97f[_0x0b73('0x68')]=_0x4e5414[_0x0b73('0x7')]?JSON[_0x0b73('0x69')](_0x4e5414[_0x0b73('0x7')]):{};}catch(_0x7fb9a7){logger[_0x0b73('0x28')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x7fb9a7);}}try{_0xd9f97f[_0x0b73('0x6a')]=_0x4e5414[_0x0b73('0x6b')]?JSON[_0x0b73('0x69')](_0x4e5414[_0x0b73('0x6b')]):{};}catch(_0x220963){logger['error'](_0x0b73('0x6c'),_0x220963);}if(_0x4e5414[_0x0b73('0x6d')]){try{var _0x2efaf2=require(_0x4e5414[_0x0b73('0x6d')])['sync'](this,_0xd9f97f);_0xd9f97f[_0x0b73('0x6e')]=Mustache[_0x0b73('0x6f')](_0x4e5414['url'],_0x2efaf2,{},['$$','$$']);if(_0xd9f97f['headers']){_0xd9f97f[_0x0b73('0x6a')]=JSON[_0x0b73('0x69')](Mustache[_0x0b73('0x6f')](JSON[_0x0b73('0x70')](_0xd9f97f[_0x0b73('0x6a')]),_0x2efaf2,{},['$$','$$']));}if(_0xd9f97f['body']){_0xd9f97f[_0x0b73('0x68')]=JSON[_0x0b73('0x69')](Mustache[_0x0b73('0x6f')](JSON[_0x0b73('0x70')](_0xd9f97f['body']),_0x2efaf2,{},['$$','$$']));}}catch(_0x1f42c3){logger[_0x0b73('0x28')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1f42c3);}}rp(_0xd9f97f)[_0x0b73('0xf')](function(_0x47db9a){var _0x233f63={'statusCode':_0x47db9a['statusCode']||0xc8,'statusMessage':_0x47db9a[_0x0b73('0x71')]||'OK','headers':_0x47db9a[_0x0b73('0x6a')]||{},'body':_0x47db9a[_0x0b73('0x68')]||{}};_0x1ee0d1(null,_0x233f63);})[_0x0b73('0x11')](function(_0x39b4ae){var _0xbfe1fe={'statusCode':_0x39b4ae[_0x0b73('0x72')]||0x1f4,'statusMessage':_0x39b4ae[_0x0b73('0x73')]||_0x0b73('0x74'),'headers':_0x39b4ae[_0x0b73('0x75')][_0x0b73('0x6a')]||{},'body':_0x39b4ae[_0x0b73('0x75')][_0x0b73('0x68')]||{}};_0x1ee0d1(null,_0xbfe1fe);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x76')]=function(_0x1b6809,_0x14890c){scripts[_0x0b73('0x76')](this[_0x0b73('0xb')]['uniqueid'],_0x1b6809[_0x0b73('0x77')],_0x1b6809['text'],_0x1b6809['dialogflow_language']||'en')[_0x0b73('0xf')](function(_0x46825a){_0x14890c(null,_0x46825a);})[_0x0b73('0x11')](function(_0x54ca79){_0x14890c(_0x54ca79);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x78')]=function(_0x5cb6f2,_0x563ede){scripts[_0x0b73('0x78')](this[_0x0b73('0xb')]['uniqueid'],_0x5cb6f2['dialogflowV2_project_id'],_0x5cb6f2[_0x0b73('0x79')],_0x5cb6f2[_0x0b73('0x7a')],_0x5cb6f2[_0x0b73('0x5a')],_0x5cb6f2[_0x0b73('0x7b')]||'en')[_0x0b73('0xf')](function(_0xf99141){_0x563ede(null,_0xf99141);})[_0x0b73('0x11')](function(_0xf2dba4){_0x563ede(_0xf2dba4);});};AGIVertices['prototype'][_0x0b73('0x7c')]=function(_0x30c4cb,_0x59bf4b){scripts[_0x0b73('0x7c')](this[_0x0b73('0xb')],_0x30c4cb)[_0x0b73('0xf')](function(_0xfc891f){_0x59bf4b(null,_0xfc891f);})[_0x0b73('0x11')](function(_0x4a1c74){_0x59bf4b(_0x4a1c74);});};AGIVertices[_0x0b73('0xd')]['ispeechTTS']=function(_0x1b15ec,_0x48f5bf){scripts[_0x0b73('0x7d')](_0x1b15ec[_0x0b73('0x77')],_0x1b15ec['text'],_0x1b15ec['ispeech_tts_language']||_0x0b73('0x5c'),_0x1b15ec[_0x0b73('0x7e')])[_0x0b73('0xf')](function(_0x124045){_0x48f5bf(null,_0x124045);})[_0x0b73('0x11')](function(_0x43f0c4){_0x48f5bf(_0x43f0c4);});};AGIVertices['prototype'][_0x0b73('0x7f')]=function(_0xce8882,_0x5505ee,_0x1a1507){scripts['ispeechASR'](_0x5505ee,_0xce8882['key'],_0xce8882['ispeech_asr_language']||'en-US',this['isConfigured'](_0xce8882[_0x0b73('0x80')])?_0xce8882[_0x0b73('0x80')]:undefined)['then'](function(_0x446500){_0x1a1507(null,_0x446500);})[_0x0b73('0x11')](function(_0x374d41){_0x1a1507(_0x374d41);});};AGIVertices['prototype']['awsPolly']=function(_0x20779b,_0xf6e4ed){scripts[_0x0b73('0x81')](_0x20779b['aws_access_key_id'],_0x20779b[_0x0b73('0x82')],_0x20779b[_0x0b73('0x83')],_0x20779b[_0x0b73('0x84')]||'Amy',_0x20779b[_0x0b73('0x5a')],_0x20779b[_0x0b73('0x85')]||_0x0b73('0x5a'))[_0x0b73('0xf')](function(_0x5babf9){_0xf6e4ed(null,_0x5babf9);})[_0x0b73('0x11')](function(_0x309089){_0xf6e4ed(_0x309089);});};AGIVertices['prototype'][_0x0b73('0x86')]=function(_0x2c4b17,_0x42b120){scripts['awsLex'](this['channel'][_0x0b73('0x34')],_0x2c4b17['aws_access_key_id'],_0x2c4b17[_0x0b73('0x82')],_0x2c4b17[_0x0b73('0x87')],_0x2c4b17[_0x0b73('0x5a')],_0x2c4b17[_0x0b73('0x88')])[_0x0b73('0xf')](function(_0xddfd7b){_0x42b120(null,_0xddfd7b);})[_0x0b73('0x11')](function(_0x1e08f6){_0x42b120(_0x1e08f6);});};AGIVertices['prototype']['googleASR']=function(_0xa59a96,_0x376d5c,_0x1dc6aa){scripts['googleASR'](_0x376d5c,_0xa59a96[_0x0b73('0x77')],_0xa59a96['google_asr_language']||'en-US')['then'](function(_0x5f2478){_0x1dc6aa(null,_0x5f2478);})[_0x0b73('0x11')](function(_0x16eec0){_0x1dc6aa(_0x16eec0);});};AGIVertices[_0x0b73('0xd')][_0x0b73('0x89')]=function(_0x30493f,_0x3f6255,_0x317758){scripts['tildeASR'](_0x3f6255,_0x30493f[_0x0b73('0x8a')],_0x30493f[_0x0b73('0x8b')],_0x30493f[_0x0b73('0x6e')])[_0x0b73('0xf')](function(_0x36ea93){_0x317758(null,_0x36ea93);})['catch'](function(_0x17c07a){_0x317758(_0x17c07a);});};AGIVertices['prototype'][_0x0b73('0x8c')]=function(_0x1042c8){var _0x5e6fd4=_[_0x0b73('0x65')](verticesWithRetry,_0x1042c8[_0x0b73('0x36')])?_0x1042c8:_[_0x0b73('0x8d')](_0x1042c8);for(var _0x128786 in _0x5e6fd4){if(_0x5e6fd4['hasOwnProperty'](_0x128786)){if(_0x5e6fd4[_0x128786]&&_['isString'](_0x5e6fd4[_0x128786])){if(_[_0x0b73('0x65')](recursiveMapAttributes,_0x128786)){_0x5e6fd4[_0x128786]=this['replaceObjectAllVariables'](_0x5e6fd4[_0x128786]);}else{_0x5e6fd4[_0x128786]=this[_0x0b73('0x8e')](_0x5e6fd4[_0x128786]);}}}}return _0x5e6fd4;};AGIVertices['prototype'][_0x0b73('0x8f')]=function(_0x737638){for(var _0x4acd8c in _0x737638){if(_0x737638['hasOwnProperty'](_0x4acd8c)){if(_[_0x0b73('0x90')](_0x737638[_0x4acd8c])){this[_0x0b73('0x8f')](_0x737638[_0x4acd8c]);}else if(_[_0x0b73('0x91')](_0x737638[_0x4acd8c])){for(var _0x1c5309=0x0;_0x1c5309<_0x737638[_0x4acd8c]['length'];_0x1c5309++){this[_0x0b73('0x8f')](_0x737638[_0x4acd8c][_0x1c5309]);}}else if(_[_0x0b73('0x92')](_0x737638[_0x4acd8c])){_0x737638[_0x4acd8c]=this[_0x0b73('0x8e')](_0x737638[_0x4acd8c]);}}}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x93')]=function(_0x291048,_0x2cfa70){for(var _0x1a2015 in _0x291048){if(_0x291048[_0x0b73('0x94')](_0x1a2015)){if(_['isPlainObject'](_0x291048[_0x1a2015])){if(!_[_0x0b73('0x41')](_0x291048[_0x1a2015])){this[_0x0b73('0x93')](_0x291048[_0x1a2015],util['format'](_0x0b73('0x95'),_0x2cfa70,_0x1a2015));}}else if(_[_0x0b73('0x91')](_0x291048[_0x1a2015])){for(var _0x29621a=0x0;_0x29621a<_0x291048[_0x1a2015]['length'];_0x29621a++){this[_0x0b73('0x93')](_0x291048[_0x1a2015][_0x29621a],util[_0x0b73('0x24')](_0x0b73('0x95'),_0x2cfa70,_0x1a2015+'['+_0x29621a+']'));}}else{if(!_[_0x0b73('0x4e')](_0x291048[_0x1a2015])){this[_0x0b73('0xb')][_0x0b73('0x96')](util[_0x0b73('0x24')]('%s.%s',_0x2cfa70,_0x1a2015),_0x291048[_0x1a2015]);}}}}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x97')]=function(_0x31ca0c){try{var _0x4932f0=JSON['parse'](_0x31ca0c);this[_0x0b73('0x8f')](_0x4932f0);return JSON['stringify'](_0x4932f0);}catch(_0x2932a0){return this[_0x0b73('0x8e')](_0x31ca0c);}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x8e')]=function(_0xd950f4){var _0x67b492=_0xd950f4[_0x0b73('0x98')]('{');for(var _0x5ac1a4=0x1;_0x5ac1a4<_0x67b492[_0x0b73('0x99')];_0x5ac1a4+=0x1){var _0x12f8b4=_0x67b492[_0x5ac1a4][_0x0b73('0x98')]('}');if(_0x12f8b4[_0x0b73('0x99')]>0x1){_0xd950f4=_0xd950f4[_0x0b73('0x9a')]('{'+_0x12f8b4[0x0]+'}',this[_0x0b73('0xb')][_0x0b73('0x9b')](_0x12f8b4[0x0])[_0x0b73('0x9c')]||_0x12f8b4[0x0]);}}if(_0x67b492[_0x0b73('0x99')]===0x1){return _0xd950f4[_0x0b73('0x9d')]();}return this['replaceAllVariables'](_0xd950f4);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x9e')]=function(_0x569126,_0x11f282){var _0x95f2bd=this[_0x0b73('0xb')][_0x0b73('0x9b')](_0x569126);if(_0x95f2bd['result']===-0x1){return _0x95f2bd;}logger['info'](util[_0x0b73('0x24')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x11f282,_0x95f2bd[_0x0b73('0x9c')]));return this[_0x0b73('0xb')][_0x0b73('0x96')](_0x11f282,_0x95f2bd[_0x0b73('0x9c')]);};AGIVertices['prototype']['isConfigured']=function(_0x54316d){return _0x54316d&&_0x54316d!=='0'&&_0x54316d!=='-1'&&_0x54316d!=='';};AGIVertices[_0x0b73('0xd')][_0x0b73('0x9f')]=function(_0x5b18d6){this[_0x0b73('0x33')]['sync'](this,_0x5b18d6,'-');_0x5b18d6[_0x0b73('0xa0')]=_0x5b18d6[_0x0b73('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0b73('0xd')]['mrcpsynth']=function(_0x28ec06){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x28ec06[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x28ec06[_0x0b73('0x5a')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}var _0x3178cd='\x22'+_0x28ec06[_0x0b73('0x5a')]+'\x22';if(this[_0x0b73('0xa1')](_0x28ec06[_0x0b73('0x75')])){_0x3178cd+=','+_0x28ec06[_0x0b73('0x75')];}var _0x96e807=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xa4'),_0x3178cd);if(_0x96e807[_0x0b73('0xa5')]===-0x1){return _0x96e807;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3178cd));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xa6')]=function(_0x1808b5){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xa7'),_0x1808b5[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x1808b5[_0x0b73('0xa8')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xa9'));}var _0x140661=_0x1808b5[_0x0b73('0xa8')];if(this['isConfigured'](_0x1808b5['options'])){_0x140661+=','+_0x1808b5[_0x0b73('0x75')];}var _0x26e28a=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xaa'),_0x140661);if(_0x26e28a[_0x0b73('0xa5')]===-0x1){return _0x26e28a;}var _0x3a42aa=this[_0x0b73('0x9e')](_0x0b73('0xab'),_0x0b73('0xac'));if(_0x3a42aa[_0x0b73('0xa5')]===-0x1){return _0x3a42aa;}var _0x3fe64e=this['getAndSetVariable'](_0x0b73('0xad'),'MRCP_RECOG_TRANSCRIPT');if(_0x3fe64e[_0x0b73('0xa5')]===-0x1){return _0x3fe64e;}var _0x5597bb=this[_0x0b73('0x9e')](_0x0b73('0xae'),_0x0b73('0xaf'));if(_0x5597bb[_0x0b73('0xa5')]===-0x1){return _0x5597bb;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0xb0'),_0x140661));};AGIVertices[_0x0b73('0xd')]['agi']=function(_0xfd3bcf){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xb1'),_0xfd3bcf['label']));return this[_0x0b73('0xb')][_0x0b73('0xb2')]([_0xfd3bcf[_0x0b73('0xb3')],_0xfd3bcf[_0x0b73('0xb4')]]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0xb5')]=function(_0x132302){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xb6'),_0x132302[_0x0b73('0x35')]));if(this['isConfigured'](_0x132302[_0x0b73('0x63')])){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xb7'),_0x132302[_0x0b73('0x63')]));var _0x35da33=this['channel'][_0x0b73('0xb8')](_0x132302[_0x0b73('0x63')]);if(_0x35da33[_0x0b73('0xa5')]===-0x1){return _0x35da33;}}return this[_0x0b73('0xb')][_0x0b73('0xb5')]();};AGIVertices['prototype'][_0x0b73('0x48')]=function(_0xb30ee8){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xb9'),_0xb30ee8[_0x0b73('0x35')]));if(!this['isConfigured'](_0xb30ee8[_0x0b73('0x46')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0xb30ee8,_0x0b73('0xba'));}_0xb30ee8[_0x0b73('0x47')]=moment();if(this[_0x0b73('0xa1')](_0xb30ee8[_0x0b73('0xbb')])){_0xb30ee8[_0x0b73('0x47')]=moment()[_0x0b73('0xbc')](_0xb30ee8[_0x0b73('0xbb')],_0x0b73('0xbd'));}if(!this[_0x0b73('0xa1')](_0xb30ee8[_0x0b73('0x4a')])){_0xb30ee8[_0x0b73('0x4a')]=0x2;}this[_0x0b73('0x40')][_0x0b73('0xbe')](this,_0xb30ee8);return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xbf'),_0xb30ee8[_0x0b73('0x45')],_0xb30ee8[_0x0b73('0x46')],_0xb30ee8[_0x0b73('0x47')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xc0')]=function(_0x43000e){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xc1'),_0x43000e[_0x0b73('0x35')]));var _0xd1ba=this['channel'][_0x0b73('0x55')](_0x43000e[_0x0b73('0xc2')],_0x43000e[_0x0b73('0x75')]);if(_0xd1ba[_0x0b73('0xa5')]===-0x1){return _0xd1ba;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),_0x43000e[_0x0b73('0xc2')],_0x43000e[_0x0b73('0x75')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xc4')]=function(_0x4eb3fc){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xc5'),_0x4eb3fc['label']));if(!this[_0x0b73('0xa1')](_0x4eb3fc[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}var _0x211e42='\x22'+_0x4eb3fc[_0x0b73('0x5a')]+'\x22';if(this[_0x0b73('0xa1')](_0x4eb3fc[_0x0b73('0x75')])){_0x211e42+=','+_0x4eb3fc['options'];}var _0x2967e6=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xa4'),_0x211e42);if(_0x2967e6['result']===-0x1){return _0x2967e6;}return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x211e42));};AGIVertices['prototype'][_0x0b73('0xc6')]=function(_0xd1bfe5){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xc7'),_0xd1bfe5[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0xd1bfe5[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}var _0x3241df='\x22'+_0xd1bfe5[_0x0b73('0x5a')]+'\x22';if(this[_0x0b73('0xa1')](_0xd1bfe5['options'])){_0x3241df+=','+_0xd1bfe5['options'];}var _0x5c5be1=this[_0x0b73('0xb')]['exec']('MRCPSynth',_0x3241df);if(_0x5c5be1['result']===-0x1){return _0x5c5be1;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc8'),_0x3241df));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xc9')]=function(_0x20da14){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xca'),_0x20da14['label']));if(!this['isConfigured'](_0x20da14[_0x0b73('0xa8')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa9'));}var _0x5c9cec=_0x20da14[_0x0b73('0xa8')];if(this[_0x0b73('0xa1')](_0x20da14[_0x0b73('0x75')])){_0x5c9cec+=','+_0x20da14[_0x0b73('0x75')];}var _0x261c3a=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0xaa'),_0x5c9cec);if(_0x261c3a[_0x0b73('0xa5')]===-0x1){return _0x261c3a;}var _0x1e67fd=this[_0x0b73('0x9e')](_0x0b73('0xab'),_0x0b73('0xcb'));if(_0x1e67fd[_0x0b73('0xa5')]===-0x1){return _0x1e67fd;}var _0x27e18d=this[_0x0b73('0x9e')](_0x0b73('0xad'),_0x0b73('0xcc'));if(_0x27e18d[_0x0b73('0xa5')]===-0x1){return _0x27e18d;}var _0x55caad=this['getAndSetVariable'](_0x0b73('0xae'),_0x0b73('0xcd'));if(_0x55caad[_0x0b73('0xa5')]===-0x1){return _0x55caad;}return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0xb0'),_0x5c9cec));};AGIVertices[_0x0b73('0xd')]['sestekasr']=function(_0x115c34){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xce'),_0x115c34[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x115c34['grammar'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20grammar\x20configured');}var _0x562bb8=_0x115c34[_0x0b73('0xa8')];if(this[_0x0b73('0xa1')](_0x115c34['options'])){_0x562bb8+=','+_0x115c34[_0x0b73('0x75')];}var _0x3cb432=this['channel'][_0x0b73('0x55')](_0x0b73('0xaa'),_0x562bb8);if(_0x3cb432[_0x0b73('0xa5')]===-0x1){return _0x3cb432;}var _0x42b530=this['getAndSetVariable'](_0x0b73('0xab'),_0x0b73('0xcf'));if(_0x42b530[_0x0b73('0xa5')]===-0x1){return _0x42b530;}var _0x24079b=this[_0x0b73('0x9e')](_0x0b73('0xad'),_0x0b73('0xd0'));if(_0x24079b['result']===-0x1){return _0x24079b;}var _0x3951f8=this[_0x0b73('0x9e')](_0x0b73('0xae'),_0x0b73('0xd1'));if(_0x3951f8[_0x0b73('0xa5')]===-0x1){return _0x3951f8;}return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0xb0'),_0x562bb8));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xd2')]=function(_0x17c35b){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xd3'),_0x17c35b[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x17c35b[_0x0b73('0xd4')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,_0x0b73('0xd5'));}var _0x51bf0c=this['getSquareOdbc'][_0x0b73('0xbe')](this,_0x17c35b[_0x0b73('0xd4')]);if(!_0x51bf0c){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,'no\x20odbc\x20database\x20found');}if(!this[_0x0b73('0xa1')](_0x17c35b[_0x0b73('0x2b')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,_0x0b73('0xd6'));}var _0x26358e=_0x17c35b[_0x0b73('0x2b')][_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('query:\x20%s',_0x26358e));var _0x585960=this[_0x0b73('0x26')][_0x0b73('0xbe')](this,_0x51bf0c,_0x26358e);this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x17c35b,_0x26358e);if(!this[_0x0b73('0xa1')](_0x17c35b[_0x0b73('0xd7')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xd8'));}var _0x3882b8=this[_0x0b73('0x9b')][_0x0b73('0xbe')](this,_0x17c35b[_0x0b73('0xd7')]);if(!_0x3882b8){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x17c35b,_0x0b73('0xd9'));}var _0x4e5c49=this;_0x585960[_0x0b73('0xda')](function(_0x56071c,_0x3224f2){Object[_0x0b73('0xdb')](_0x56071c)[_0x0b73('0xda')](function(_0x4c9f65){_0x4e5c49[_0x0b73('0xb')]['setVariable'](util[_0x0b73('0x24')]('%s[%s][%s]',_0x3882b8,_0x3224f2,_0x4c9f65),_0x56071c[_0x4c9f65]);});});this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0xdc'),_0x3882b8),_0x585960[_0x0b73('0x99')]);return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xdd'),_0x3882b8));};AGIVertices['prototype'][_0x0b73('0xde')]=function(_0x4743ce){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x4743ce[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x4743ce[_0x0b73('0xdf')])){return this['channel'][_0x0b73('0x28')](_0x4743ce,_0x0b73('0xe0'));}var _0x444c35=this[_0x0b73('0x16')][_0x0b73('0xbe')](this,_0x4743ce[_0x0b73('0xdf')]);if(!_0x444c35){return this['channel'][_0x0b73('0x28')](_0x4743ce,_0x0b73('0xe1'));}var _0x19d1d7=this['channel'][_0x0b73('0x55')]('DIAL',[util[_0x0b73('0x24')](_0x0b73('0xe2'),_0x444c35),_0x4743ce[_0x0b73('0x63')],_0x4743ce[_0x0b73('0xe3')],_0x4743ce[_0x0b73('0x61')]]);if(_0x19d1d7[_0x0b73('0xa5')]===-0x1){return _0x19d1d7;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xe4'),'DIAL'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xe5')]=function(_0x1e5780){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0xe6'),_0x1e5780[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x1e5780[_0x0b73('0x77')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xe7'));}if(!this['isConfigured'](_0x1e5780[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}this[_0x0b73('0xb')][_0x0b73('0xe8')]=!![];this[_0x0b73('0x33')](_0x1e5780);this[_0x0b73('0x3f')](_0x1e5780[_0x0b73('0x5a')],'in','','');this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0xe9'),_0x1e5780[_0x0b73('0x5a')]));var _0x1133c3=this[_0x0b73('0x76')]['sync'](this,_0x1e5780);if(_0x1133c3){for(var _0xa229c0 in _0x1133c3){if(_0x1133c3[_0x0b73('0x94')](_0xa229c0)){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')]('DIALOGFLOW_%s',_0xa229c0['toUpperCase']()),_0x1133c3[_0xa229c0]);}}this[_0x0b73('0x3f')](_0x1133c3['speech'],_0x0b73('0xea'),'dialogflow','');return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xeb'),_0x1133c3[_0x0b73('0xec')]));}return this[_0x0b73('0xb')]['error'](_0x1e5780,_0x0b73('0xed'));};AGIVertices[_0x0b73('0xd')]['dialogflowV2']=function(_0x5633d3){logger['info'](util[_0x0b73('0x24')](_0x0b73('0xee'),_0x5633d3[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x5633d3['dialogflowV2_project_id'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20project_id\x20configured');}if(!this[_0x0b73('0xa1')](_0x5633d3[_0x0b73('0x79')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xef'));}if(!this[_0x0b73('0xa1')](_0x5633d3[_0x0b73('0x7a')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xf0'));}if(!this[_0x0b73('0xa1')](_0x5633d3[_0x0b73('0x7b')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xf1'));}if(!this[_0x0b73('0xa1')](_0x5633d3['text'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}this[_0x0b73('0xb')][_0x0b73('0xe8')]=!![];this[_0x0b73('0x33')](_0x5633d3);this[_0x0b73('0x3f')](_0x5633d3[_0x0b73('0x5a')],'in','','');this['channel']['noop'](util[_0x0b73('0x24')]('Trying\x20DialogflowV2:\x20%s',_0x5633d3[_0x0b73('0x5a')]));var _0x31b875=this[_0x0b73('0x78')]['sync'](this,_0x5633d3);if(_0x31b875){for(var _0x4eb11e in _0x31b875){if(_0x31b875['hasOwnProperty'](_0x4eb11e)){if(_0x4eb11e!==_0x0b73('0xf2')){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0xf3'),_0x4eb11e['toUpperCase']()),_0x31b875[_0x4eb11e]);}}}this['createSquareMessage'](_0x31b875['speech'],_0x0b73('0xea'),_0x0b73('0xf4'),_0x31b875[_0x0b73('0xf2')]);return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')]('DialogflowV2\x20Result\x20%s',_0x31b875[_0x0b73('0xec')]));}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x5633d3,_0x0b73('0xf5'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0xf6')]=function(_0x46aa15){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0xf7'),_0x46aa15[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xf8')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xf9'));}if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xfa')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20username\x20configured');}if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xfb')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xfc'));}if(!this[_0x0b73('0xa1')](_0x46aa15[_0x0b73('0xfd')])){return this[_0x0b73('0xb')]['noop']('no\x20text\x20configured');}this[_0x0b73('0xb')]['bot']=!![];this[_0x0b73('0x33')](_0x46aa15);this['createSquareMessage'](_0x46aa15[_0x0b73('0x5a')],'in','','');this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Trying\x20SestekNDA:\x20%s',_0x46aa15[_0x0b73('0x5a')]));var _0x3a90f0=this['sestekNDA'][_0x0b73('0xbe')](this,_0x46aa15);if(_0x3a90f0){for(var _0xaf359c in _0x3a90f0){if(_0x3a90f0['hasOwnProperty'](_0xaf359c)){this[_0x0b73('0xb')][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0xfe'),_0xaf359c[_0x0b73('0x67')]()),_0x3a90f0[_0xaf359c]);}}this[_0x0b73('0x3f')](_0x3a90f0[_0x0b73('0xec')],_0x0b73('0xea'),'sesteknda','');if(_0x3a90f0[_0x0b73('0xff')]){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x3a90f0[_0x0b73('0xff')]));var _0x2072b8=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x3a90f0[_0x0b73('0xff')]);try{fs[_0x0b73('0x101')](_0x3a90f0[_0x0b73('0xff')]+'.wav');}catch(_0xa4ad4d){logger['error'](_0xa4ad4d);}return _0x2072b8;}else{return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x102'),_0x3a90f0[_0x0b73('0xec')]));}}return this['channel'][_0x0b73('0x28')](_0x46aa15,_0x0b73('0x103'));};AGIVertices['prototype']['end']=function(_0x1e24db){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x104'),_0x1e24db[_0x0b73('0x35')]));return this['channel']['noop'](_0x0b73('0x105'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x106')]=function(_0x352b10){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x352b10[_0x0b73('0x35')]));var _0x523cb3='';if(_0x352b10['trunk_id']){if(!this[_0x0b73('0xa1')](_0x352b10[_0x0b73('0x107')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x352b10,'no\x20trunk\x20selected');}else{var _0xaefd80=parseInt(_0x352b10['trunk_id'],0xa);if(isNaN(_0xaefd80)){_0x523cb3=_0x352b10['trunk_id'];}else{_0x523cb3=this[_0x0b73('0x108')][_0x0b73('0xbe')](this,_0x352b10[_0x0b73('0x107')]);if(!_0x523cb3){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x352b10,_0x0b73('0x109'));}}}}else if(_0x352b10[_0x0b73('0x10a')]){_0x523cb3=_0x352b10[_0x0b73('0x10a')];}else{return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x352b10,'no\x20trunk\x20selected');}var _0x57cd25=this['channel'][_0x0b73('0x55')]('DIAL',[util[_0x0b73('0x24')]('SIP/%s/%s',_0x523cb3,_0x352b10[_0x0b73('0x45')]),_0x352b10['timeout'],_0x352b10[_0x0b73('0xe3')],_0x352b10[_0x0b73('0x61')]]);if(_0x57cd25[_0x0b73('0xa5')]===-0x1){return _0x57cd25;}return this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0xe4'),'DIAL'));};AGIVertices['prototype'][_0x0b73('0x10b')]=function(_0x17d8ff){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x17d8ff['label']));return this[_0x0b73('0xb')][_0x0b73('0xa2')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x3ceca1){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x10c'),_0x3ceca1['label']));if(_0x3ceca1[_0x0b73('0xa0')]===0x0){return this['maxRetry'](_0x3ceca1);}_0x3ceca1[_0x0b73('0xa0')]-=0x1;if(!this[_0x0b73('0xa1')](_0x3ceca1[_0x0b73('0x10d')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3ceca1,_0x0b73('0x10e'));}var _0x51eff0=this[_0x0b73('0x19')][_0x0b73('0xbe')](this,_0x3ceca1[_0x0b73('0x10d')]);if(!_0x51eff0){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3ceca1,_0x0b73('0x10f'));}if(!this[_0x0b73('0xa1')](_0x3ceca1[_0x0b73('0xd7')])){return this[_0x0b73('0xb')][_0x0b73('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x53f8ae=this[_0x0b73('0xb')][_0x0b73('0x110')](_0x51eff0,_0x3ceca1[_0x0b73('0x111')],_0x3ceca1['maxdigit']);var _0x5b094d=_0x53f8ae[_0x0b73('0xa5')]?_0x53f8ae[_0x0b73('0xa5')][_0x0b73('0x9d')]():'';logger['info'](_0x0b73('0x112'),JSON[_0x0b73('0x70')](_0x53f8ae));if(_0x53f8ae[_0x0b73('0xa5')]===-0x1){this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,_0x5b094d);return _0x53f8ae;}else if(_0x53f8ae[_0x0b73('0x9c')]===_0x0b73('0x63')){_0x53f8ae[_0x0b73('0xa5')]=_0x5b094d[_0x0b73('0x99')]>=parseInt(_0x3ceca1[_0x0b73('0x113')])?'x':'i';}else{_0x53f8ae[_0x0b73('0xa5')]=_0x5b094d[_0x0b73('0x99')]>=parseInt(_0x3ceca1[_0x0b73('0x113')])&&_0x5b094d[_0x0b73('0x99')]<=parseInt(_0x3ceca1[_0x0b73('0x114')])?'x':'i';}var _0x43366a=this['getVariable'][_0x0b73('0xbe')](this,_0x3ceca1[_0x0b73('0xd7')]);if(!_0x43366a){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3ceca1,_0x0b73('0xd9'));}this['channel']['setVariable'](_0x43366a,_0x5b094d);if(this['isConfigured'](_0x3ceca1['hiddendigitsnum'])){var _0x41a88a=parseInt(_0x3ceca1['hiddendigitsnum'],0xa);var _0x40f92b=rs[_0x0b73('0x115')]({'charset':'*','length':_0x41a88a});var _0x211221=_0x5b094d[_0x0b73('0x99')];if(_0x211221>0x0){if(_0x211221>_0x41a88a){this[_0x0b73('0x33')]['sync'](this,_0x3ceca1,_0x3ceca1['hiddendigitspos']==='first'?_0x40f92b+_0x5b094d[_0x0b73('0x116')](_0x41a88a):_0x5b094d[_0x0b73('0x116')](0x0,_0x211221-_0x41a88a)+_0x40f92b);}else{this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,rs[_0x0b73('0x115')]({'charset':'*','length':_0x211221}));}}else{this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,'');}}else{this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3ceca1,_0x5b094d);}return _0x53f8ae;};AGIVertices['prototype']['getsecretdigits']=function(_0x166416){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x166416[_0x0b73('0x35')]));return this[_0x0b73('0x9')](_0x166416);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x117')]=function(_0x5a49f0){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x118'),_0x5a49f0[_0x0b73('0x35')]));this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x5a49f0,_0x5a49f0['goalname']);return this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x119'),_0x5a49f0[_0x0b73('0x11a')]));};AGIVertices[_0x0b73('0xd')]['awspolly']=function(_0xcbd953){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x11b'),_0xcbd953[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0xcbd953[_0x0b73('0x11c')])||!this[_0x0b73('0xa1')](_0xcbd953[_0x0b73('0x82')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x11d'));}if(!this[_0x0b73('0xa1')](_0xcbd953[_0x0b73('0x5a')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xa3'));}this['channel'][_0x0b73('0xa2')](util['format']('Trying\x20aws\x20Polly\x20%s',_0xcbd953[_0x0b73('0x5a')]));var _0x37488a=this[_0x0b73('0x81')][_0x0b73('0xbe')](this,_0xcbd953);if(_0x37488a){this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x11e'),_0x37488a));var _0x1eff8c=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x37488a);try{fs[_0x0b73('0x101')](_0x37488a+_0x0b73('0x11f'));}catch(_0x554a12){logger[_0x0b73('0x28')](_0x554a12);}return _0x1eff8c;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0xcbd953,_0x0b73('0x120'));};AGIVertices[_0x0b73('0xd')]['awslex']=function(_0x65c16c){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x121'),_0x65c16c['label']));if(!this[_0x0b73('0xa1')](_0x65c16c[_0x0b73('0x11c')])||!this[_0x0b73('0xa1')](_0x65c16c['aws_secret_access_key'])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x11d'));}if(!this['isConfigured'](_0x65c16c['aws_bot_name'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x122'));}if(!this[_0x0b73('0xa1')](_0x65c16c[_0x0b73('0x5a')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}this['channel']['bot']=!![];this[_0x0b73('0x33')](_0x65c16c);this[_0x0b73('0x3f')](_0x65c16c[_0x0b73('0x5a')],'in','','');this['channel']['noop'](util['format'](_0x0b73('0x123'),_0x65c16c[_0x0b73('0x5a')]));var _0x20c24f=this['awsLex']['sync'](this,_0x65c16c);if(_0x20c24f){for(var _0x7af1af in _0x20c24f){if(_0x20c24f['hasOwnProperty'](_0x7af1af)&&_[_0x0b73('0x92')](_0x20c24f[_0x7af1af])){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x124'),_0x7af1af['toUpperCase']()),_0x20c24f[_0x7af1af]);}}if(_[_0x0b73('0x4e')](_0x20c24f[_0x0b73('0x73')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x125'));}else{this[_0x0b73('0x3f')](_0x20c24f[_0x0b73('0x73')],_0x0b73('0xea'),_0x0b73('0x126'),'');return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('Amazon\x20Lex\x20Result\x20%s',_0x20c24f[_0x0b73('0x73')]));}}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x65c16c,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x0b73('0xd')][_0x0b73('0x127')]=function(_0x2bcadb){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x128'),_0x2bcadb[_0x0b73('0x35')],_0x2bcadb[_0x0b73('0x63')]));if(!this['isConfigured'](_0x2bcadb[_0x0b73('0x77')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xe7'));}var _0x54c950=_0x0b73('0x129');var _0x44324a=util['format'](_0x0b73('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x4a9cf3=util[_0x0b73('0x24')]('%s.%s',_0x44324a,_0x54c950);var _0x384200=!![];if(_0x2bcadb[_0x0b73('0x12b')]===_0x0b73('0x12c')){_0x384200=![];}var _0x1114b6=this[_0x0b73('0xb')][_0x0b73('0x12d')](_0x44324a,_0x54c950,_0x2bcadb[_0x0b73('0x12e')],_0x2bcadb['timeout'],undefined,_0x384200);if(_0x1114b6[_0x0b73('0xa5')]!==-0x1){this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('google\x20%s\x20file\x20created',_0x4a9cf3));var _0x225778=this[_0x0b73('0x12f')][_0x0b73('0xbe')](this,_0x2bcadb,_0x4a9cf3);if(_0x225778){for(var _0x436cdc in _0x225778){if(_0x225778[_0x0b73('0x94')](_0x436cdc)){this[_0x0b73('0xb')][_0x0b73('0x96')](util['format'](_0x0b73('0x130'),_0x436cdc['toUpperCase']()),_0x225778[_0x436cdc]);}}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x131'),JSON[_0x0b73('0x70')](_0x225778)));}}return _0x1114b6;};AGIVertices[_0x0b73('0xd')][_0x0b73('0x132')]=function(_0xd2f7c9){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x133'),_0xd2f7c9[_0x0b73('0x35')]));if(!this['isConfigured'](_0xd2f7c9[_0x0b73('0x8a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0x134'));}if(!this[_0x0b73('0xa1')](_0xd2f7c9[_0x0b73('0x8b')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x135'));}var _0x2d82ce=_0x0b73('0x129');var _0x564eaf=util[_0x0b73('0x24')](_0x0b73('0x12a'),FILES_PATH,rs[_0x0b73('0x115')](0x4));var _0x1cacda=util['format'](_0x0b73('0x95'),_0x564eaf,_0x2d82ce);var _0x12e176=!![];if(_0xd2f7c9[_0x0b73('0x12b')]===_0x0b73('0x12c')){_0x12e176=![];}var _0x25be7b=this[_0x0b73('0xb')][_0x0b73('0x12d')](_0x564eaf,_0x2d82ce,_0xd2f7c9[_0x0b73('0x12e')],_0xd2f7c9[_0x0b73('0x63')],undefined,_0x12e176);if(_0x25be7b[_0x0b73('0xa5')]!==-0x1){this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('tilde\x20%s\x20file\x20created',_0x1cacda));var _0x3ed7e3=this[_0x0b73('0x89')]['sync'](this,_0xd2f7c9,_0x1cacda);if(_0x3ed7e3){for(var _0x15c46b in _0x3ed7e3){if(_0x3ed7e3['hasOwnProperty'](_0x15c46b)){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x136'),_0x15c46b[_0x0b73('0x67')]()),_0x3ed7e3[_0x15c46b]);}}return this[_0x0b73('0xb')]['noop'](util['format'](_0x0b73('0x137'),JSON['stringify'](_0x3ed7e3)));}}return _0x25be7b;};AGIVertices[_0x0b73('0xd')][_0x0b73('0x138')]=function(_0x5a4c50){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x139'),_0x5a4c50[_0x0b73('0x35')]));return this['channel'][_0x0b73('0x13a')](_0x5a4c50[_0x0b73('0x3a')],_0x5a4c50[_0x0b73('0x3b')],_0x5a4c50[_0x0b73('0x3c')]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x13b')]=function(_0x1dec68){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x13c'),_0x1dec68['label']));if(!this['isConfigured'](_0x1dec68[_0x0b73('0x13d')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x1dec68,_0x0b73('0x13e'));}try{var _0x5ae746=eval(_0x1dec68[_0x0b73('0x13d')])?_0x0b73('0x13f'):_0x0b73('0x140');this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x141'),_0x1dec68[_0x0b73('0x13d')],_0x5ae746));return{'code':0xc8,'result':_0x5ae746};}catch(_0x13ceb3){return{'code':0xc8,'result':_0x0b73('0x140')};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x142')]=function(_0x438980){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x143'),_0x438980[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x438980[_0x0b73('0x144')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x438980,_0x0b73('0x145'));}var _0x1f79ab=this[_0x0b73('0x1f')][_0x0b73('0xbe')](this,_0x438980[_0x0b73('0x144')]);if(!_0x1f79ab){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x438980,_0x0b73('0x146'));}for(var _0x50144e=0x0;_0x50144e<_0x1f79ab[_0x0b73('0x99')];_0x50144e+=0x1){var _0x12ccdc=this[_0x0b73('0xb')]['getVariable'](util[_0x0b73('0x24')](_0x0b73('0x147'),_0x1f79ab[_0x50144e]));if(_0x12ccdc[_0x0b73('0xa5')]===-0x1){return _0x12ccdc;}logger['info'](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x12ccdc[_0x0b73('0x9c')]));if(_0x12ccdc[_0x0b73('0x9c')]===_0x0b73('0x13f')){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x0b73('0x13f')));this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x0b73('0x13f')));return{'code':0xc8,'result':'true'};}else{logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x148'),_0x1f79ab[_0x50144e],_0x0b73('0x140')));this['channel']['noop'](util['format']('IFTIME\x20%s\x20%s',_0x1f79ab[_0x50144e],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x0b73('0xd')][_0x0b73('0x149')]=function(_0x592ec4){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x14a'),_0x592ec4['label']));return this[_0x0b73('0xb')][_0x0b73('0x149')]();};AGIVertices[_0x0b73('0xd')][_0x0b73('0x14b')]=function(_0x118551){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x14c'),_0x118551[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x118551[_0x0b73('0x77')])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0xe7'));}var _0x22d3f6=_0x0b73('0x129');var _0x1dca35=util[_0x0b73('0x24')](_0x0b73('0x12a'),FILES_PATH,rs[_0x0b73('0x115')](0x4));var _0x4e82f2=util[_0x0b73('0x24')](_0x0b73('0x95'),_0x1dca35,_0x22d3f6);var _0x21e1e3=!![];if(_0x118551[_0x0b73('0x12b')]===_0x0b73('0x12c')){_0x21e1e3=![];}var _0x3605d4=this[_0x0b73('0xb')][_0x0b73('0x12d')](_0x1dca35,_0x22d3f6,_0x118551[_0x0b73('0x12e')],_0x118551['timeout'],undefined,_0x21e1e3);if(_0x3605d4[_0x0b73('0xa5')]!==-0x1){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format']('ispeech\x20%s\x20file\x20created',_0x4e82f2));var _0x5e1f2d=this[_0x0b73('0x7f')][_0x0b73('0xbe')](this,_0x118551,_0x4e82f2);if(_0x5e1f2d){for(var _0x7d251b in _0x5e1f2d){if(_0x5e1f2d[_0x0b73('0x94')](_0x7d251b)){this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')]('ISPEECH_ASR_%s',_0x7d251b['toUpperCase']()),_0x5e1f2d[_0x7d251b]);}}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x14d'),JSON[_0x0b73('0x70')](_0x5e1f2d)));}}return _0x3605d4;};AGIVertices[_0x0b73('0xd')]['ispeechtts']=function(_0x47e83b){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x14e'),_0x47e83b[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x47e83b[_0x0b73('0x77')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20key\x20configured');}if(!this[_0x0b73('0xa1')](_0x47e83b[_0x0b73('0x5a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0xa3'));}this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x14f'),_0x47e83b['text']));var _0x46d5a0=this[_0x0b73('0x7d')][_0x0b73('0xbe')](this,_0x47e83b);if(_0x46d5a0){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format']('ispeech\x20%s\x20file\x20created',_0x46d5a0));var _0x14add4=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x46d5a0,_0x47e83b[_0x0b73('0x12e')]);try{fs[_0x0b73('0x101')](_0x46d5a0+_0x0b73('0x11f'));}catch(_0x1afae1){logger[_0x0b73('0x28')](_0x1afae1);}return _0x14add4;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x47e83b,_0x0b73('0x150'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x151')]=function(_0x4eff9b){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4eff9b['label']));if(!this['isConfigured'](_0x4eff9b[_0x0b73('0x152')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x4eff9b,'no\x20find\x20by\x20configured');}logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x153'),this[_0x0b73('0xb')]['callerid'],_0x4eff9b[_0x0b73('0x152')]));var _0x3cf3c4=this[_0x0b73('0x51')][_0x0b73('0xbe')](this,_0x4eff9b[_0x0b73('0x152')]);if(_0x3cf3c4){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x154'),this['channel'][_0x0b73('0x38')],_0x4eff9b['findBy']));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0b73('0x38')],_0x4eff9b[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x155')};}else{logger['info'](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x4eff9b[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x4eff9b[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x157')};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x158')]=function(_0x545664){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x545664[_0x0b73('0x35')]));if(!this['isConfigured'](_0x545664[_0x0b73('0x152')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x545664,_0x0b73('0x159'));}logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x153'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664['findBy']));var _0x487b8a=this['agentLogout']['sync'](this,_0x545664['findBy']);if(_0x487b8a){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664[_0x0b73('0x152')]));this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x155')};}else{logger['info'](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x545664[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x156'),this['channel']['callerid'],_0x545664[_0x0b73('0x152')]));return{'code':0xc8,'result':_0x0b73('0x157')};}};AGIVertices[_0x0b73('0xd')]['math']=function(_0x1b6c03){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1b6c03[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x1b6c03[_0x0b73('0x15a')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x1b6c03,_0x0b73('0x15b'));}this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0x15c'),_0x1b6c03[_0x0b73('0x15a')]));var _0x238dc3=eval(_0x1b6c03[_0x0b73('0x15a')]);if(!this['isConfigured'](_0x1b6c03['variable_id'])){return this[_0x0b73('0xb')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3b4cac=this['getVariable']['sync'](this,_0x1b6c03['variable_id']);if(!_0x3b4cac){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x1b6c03,_0x0b73('0xd9'));}if(_[_0x0b73('0x91')](_0x238dc3)){var _0xff7759=this;_0x238dc3[_0x0b73('0xda')](function(_0x2f52a5,_0x5c8333){_0xff7759['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x15d'),_0x3b4cac,_0x5c8333),_0x2f52a5);});return this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0x15e'),_0x3b4cac));}else{return this['channel']['setVariable'](_0x3b4cac,_0x238dc3);}};AGIVertices[_0x0b73('0xd')]['menu']=function(_0x92dfda){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x15f'),_0x92dfda['label']));if(_0x92dfda[_0x0b73('0xa0')]===0x0){return this[_0x0b73('0x9f')](_0x92dfda);}_0x92dfda[_0x0b73('0xa0')]-=0x1;if(!this['isConfigured'](_0x92dfda[_0x0b73('0x10d')])){return this[_0x0b73('0xb')]['error'](_0x92dfda,_0x0b73('0x10e'));}var _0x509c34=this['getSound'][_0x0b73('0xbe')](this,_0x92dfda['file_id']);if(!_0x509c34){return this['channel']['error'](_0x92dfda,_0x0b73('0x10f'));}var _0x32dfbf=this[_0x0b73('0xb')][_0x0b73('0x110')](_0x509c34,_0x92dfda['response'],_0x92dfda[_0x0b73('0x160')]);var _0x5acbcd=_0x32dfbf['result'];if(_0x32dfbf[_0x0b73('0xa5')]===-0x1){this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x92dfda,'-1');return _0x32dfbf;}else if(_0x32dfbf['extra']===_0x0b73('0x63')){_0x32dfbf[_0x0b73('0xa5')]=_0x32dfbf[_0x0b73('0xa5')][_0x0b73('0x99')]>0x0?_0x32dfbf[_0x0b73('0xa5')]:'t';}else if(_[_0x0b73('0x41')](_0x32dfbf['result'])){_0x32dfbf[_0x0b73('0xa5')]='#';_0x5acbcd='#';}if(!this[_0x0b73('0xa1')](_0x92dfda[_0x0b73('0xd7')])){this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xd8'));}else{var _0x5e1c81=this['getVariable']['sync'](this,_0x92dfda[_0x0b73('0xd7')]);if(!_0x5e1c81){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x92dfda,_0x0b73('0xd9'));}this[_0x0b73('0xb')]['setVariable'](_0x5e1c81,_0x5acbcd);}this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x92dfda,_0x5acbcd);return _0x32dfbf;};AGIVertices[_0x0b73('0xd')][_0x0b73('0xa2')]=function(_0x10b9a4){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x161'),_0x10b9a4[_0x0b73('0x35')]));return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x10b9a4[_0x0b73('0x162')]||_0x10b9a4['label']);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x163')]=function(_0x45c895){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x164'),_0x45c895['label']));if(!this[_0x0b73('0xa1')](_0x45c895['findBy'])){return this[_0x0b73('0xb')]['error'](_0x45c895,'no\x20find\x20by\x20configured');}logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x153'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895['findBy']));var _0x10d409=this[_0x0b73('0x4b')]['sync'](this,_0x45c895[_0x0b73('0x165')]);var _0xa5fbc8=this[_0x0b73('0x4d')][_0x0b73('0xbe')](this,_0x45c895[_0x0b73('0x152')],_0x10d409);if(_0xa5fbc8){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895['findBy']));return{'code':0xc8,'result':_0x0b73('0x155')};}else{logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x156'),this['channel'][_0x0b73('0x38')],_0x45c895[_0x0b73('0x152')]));this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x45c895[_0x0b73('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x166')]=function(_0x7813dc){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x7813dc['label']));if(!this[_0x0b73('0xa1')](_0x7813dc[_0x0b73('0x10d')])){return this[_0x0b73('0xb')]['error'](_0x7813dc,'no\x20file\x20audio\x20selected');}var _0x3be651=this['getSound'][_0x0b73('0xbe')](this,_0x7813dc[_0x0b73('0x10d')]);if(!_0x3be651){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x7813dc,_0x0b73('0x10f'));}var _0x79dfec=this['channel'][_0x0b73('0x55')]('PLAYBACK',[_0x3be651,_0x7813dc['opts']]);if(_0x79dfec['result']===-0x1){return _0x79dfec;}return this['channel'][_0x0b73('0xa2')](util['format']('Executed\x20command\x20%s\x20%s',_0x0b73('0x167'),_0x3be651));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x168')]=function(_0x3c09da){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x169'),_0x3c09da[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x3c09da['queue_id'])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3c09da,_0x0b73('0x16a'));}var _0x1a406c='';var _0x1fd819=parseInt(_0x3c09da['queue_id'],0xa);if(isNaN(_0x1fd819)){_0x1a406c=_0x3c09da[_0x0b73('0x16b')];}else{_0x1a406c=this[_0x0b73('0x12')][_0x0b73('0xbe')](this,_0x3c09da[_0x0b73('0x16b')]);if(!_0x1a406c){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3c09da,_0x0b73('0x16c'));}}var _0x24f8e4='';if(this[_0x0b73('0xa1')](_0x3c09da[_0x0b73('0x10d')])){var _0x5f592c=this[_0x0b73('0x19')][_0x0b73('0xbe')](this,_0x3c09da[_0x0b73('0x10d')]);if(_0x5f592c){_0x24f8e4=_0x5f592c;}}this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x3c09da,_0x1a406c);if(_0x3c09da[_0x0b73('0xe3')][_0x0b73('0x16d')]('x')<0x0){_0x3c09da[_0x0b73('0xe3')]+='x';}if(_0x3c09da['opts'][_0x0b73('0x16d')]('X')<0x0){_0x3c09da[_0x0b73('0xe3')]+='X';}this[_0x0b73('0xb')]['setVariable'](_0x0b73('0x16e'),_0x1a406c?_0x1a406c[_0x0b73('0x16f')]():'');var _0x10afd5=this['channel'][_0x0b73('0x55')](_0x0b73('0x170'),[_0x1a406c,_0x3c09da['opts'],_0x3c09da[_0x0b73('0x61')],_0x24f8e4,_0x3c09da[_0x0b73('0x63')],_0x3c09da[_0x0b73('0xb2')],_0x3c09da['macro'],_0x3c09da['gosub'],'',_0x3c09da[_0x0b73('0x171')]]);if(_0x10afd5['result']===-0x1){return _0x10afd5;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),_0x0b73('0x170'),_0x1a406c));};AGIVertices[_0x0b73('0xd')]['record']=function(_0x1bd33b){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x172'),_0x1bd33b['label']));var _0x10c67f=_0x1bd33b['recordingFormat']||_0x0b73('0x129');var _0x332fb0=util[_0x0b73('0x24')](_0x0b73('0x173'),this[_0x0b73('0xb')][_0x0b73('0x34')],rs[_0x0b73('0x115')](0x5));var _0x56923b=util[_0x0b73('0x24')](_0x0b73('0x174'),FILES_PATH,_0x332fb0,_0x10c67f);var _0x3de250=util[_0x0b73('0x24')]('%s/recordings/%s',FILES_PATH,_0x332fb0);this[_0x0b73('0x39')][_0x0b73('0xbe')](this,_0x1bd33b,_0x332fb0,_0x56923b);this[_0x0b73('0xb')]['setVariable'](_0x0b73('0x175'),_0x332fb0);logger[_0x0b73('0x2c')](_0x0b73('0x176'),_0x3de250,_0x10c67f,_0x1bd33b[_0x0b73('0x177')],_0x1bd33b[_0x0b73('0x63')]);return this['channel'][_0x0b73('0x12d')](_0x3de250,_0x10c67f,_0x1bd33b[_0x0b73('0x177')],_0x1bd33b[_0x0b73('0x63')],undefined,!![]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x178')]=function(_0x59ec5a){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x179'),_0x59ec5a[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x59ec5a['url'])){return this['channel'][_0x0b73('0xa2')](_0x0b73('0x17a'));}var _0x4be3b0=this[_0x0b73('0x17b')]['sync'](this,_0x59ec5a);logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Response:',util['inspect'](_0x4be3b0,{'showHidden':![],'depth':null})));if(!this[_0x0b73('0xa1')](_0x59ec5a['variable_id'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x17c'));}var _0x3096d2=this[_0x0b73('0x9b')][_0x0b73('0xbe')](this,_0x59ec5a['variable_id']);if(!_0x3096d2){return this[_0x0b73('0xb')]['error'](_0x59ec5a,_0x0b73('0xd9'));}this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x17d'),_0x3096d2),_0x4be3b0[_0x0b73('0x72')]?_0x4be3b0[_0x0b73('0x72')]:'200');this['channel'][_0x0b73('0x96')](util[_0x0b73('0x24')](_0x0b73('0x17e'),_0x3096d2),_0x4be3b0[_0x0b73('0x71')]?_0x4be3b0[_0x0b73('0x71')]:'OK');if(_0x4be3b0[_0x0b73('0x68')]){try{this[_0x0b73('0x93')](_0x4be3b0[_0x0b73('0x68')],_0x3096d2);}catch(_0xd2e16){logger[_0x0b73('0x28')](util['format'](_0x0b73('0x17f'),_0x3096d2));}}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0xdd'),_0x3096d2));};AGIVertices['prototype']['saydigits']=function(_0x160b1a){logger[_0x0b73('0x2c')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x160b1a[_0x0b73('0x35')]));return this[_0x0b73('0xb')][_0x0b73('0x180')](_0x160b1a[_0x0b73('0x181')]['replace'](/\s+/g,''),_0x160b1a[_0x0b73('0x177')]);};AGIVertices['prototype'][_0x0b73('0x182')]=function(_0x3de5c7){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x183'),_0x3de5c7[_0x0b73('0x35')]));return this[_0x0b73('0xb')][_0x0b73('0x184')](_0x3de5c7[_0x0b73('0x64')][_0x0b73('0x57')](/\s+/g,''),_0x3de5c7[_0x0b73('0x177')]);};AGIVertices['prototype']['sayphonetic']=function(_0x584ace){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x185'),_0x584ace[_0x0b73('0x35')]));return this['channel']['sayPhonetic'](_0x584ace[_0x0b73('0x5a')],_0x584ace[_0x0b73('0x177')]);};AGIVertices[_0x0b73('0xd')]['sendMail']=function(_0x318799){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x318799[_0x0b73('0x35')]));if(!this['isConfigured'](_0x318799[_0x0b73('0x186')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x187'));}var _0x288215=this['getMailAccount'][_0x0b73('0xbe')](this,_0x318799[_0x0b73('0x186')]);if(!_0x288215||!_0x288215[_0x0b73('0x188')]){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x318799,_0x0b73('0x189'));}var _0x43bf56={'from':util[_0x0b73('0x24')]('\x22%s\x22\x20<%s>',_0x288215[_0x0b73('0x10')],_0x288215[_0x0b73('0x18a')]||_0x288215[_0x0b73('0x188')][_0x0b73('0x18b')]),'to':_0x318799['to']||'','cc':_0x318799['cc']||'','bcc':_0x318799['bcc']||'','subject':_0x318799[_0x0b73('0x18c')],'html':_0x318799[_0x0b73('0x5a')],'text':_0x318799[_0x0b73('0x5a')]};var _0x1a2f0d={'tls':{'rejectUnauthorized':![]}};if(_0x288215[_0x0b73('0x188')][_0x0b73('0x18d')]){_0x1a2f0d[_0x0b73('0x18d')]=_0x288215[_0x0b73('0x188')][_0x0b73('0x18d')];}else{_0x1a2f0d[_0x0b73('0x18e')]=_0x288215[_0x0b73('0x188')][_0x0b73('0x18e')];_0x1a2f0d[_0x0b73('0x18f')]=_0x288215[_0x0b73('0x188')][_0x0b73('0x18f')];_0x1a2f0d['secure']=_0x288215[_0x0b73('0x188')][_0x0b73('0x190')];}if(_0x288215['Smtp']['authentication']){_0x1a2f0d[_0x0b73('0x191')]={'user':_0x288215[_0x0b73('0x188')][_0x0b73('0x18b')],'pass':_0x288215[_0x0b73('0x188')]['pass']};}if(this['isConfigured'](_0x318799[_0x0b73('0x192')])){}logger['debug'](_0x0b73('0x193'),JSON['stringify'](_0x43bf56));this['createSquareDetailsReport']['sync'](this,_0x318799,_0x318799[_0x0b73('0x186')]);this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x288215['name']));this[_0x0b73('0x1e')][_0x0b73('0xbe')](this,_0x1a2f0d,_0x43bf56);return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x194'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x195')]=function(_0x2431e6){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x196'),_0x2431e6[_0x0b73('0x35')]));return this['channel'][_0x0b73('0xa2')](_0x0b73('0x197'));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x198')]=function(_0x4fe567){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x199'),_0x4fe567[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x4fe567[_0x0b73('0x19a')])){return this[_0x0b73('0xb')]['noop'](_0x0b73('0x19b'));}var _0x4b1917=this[_0x0b73('0x30')][_0x0b73('0xbe')](this,_0x4fe567[_0x0b73('0x19a')]);if(!_0x4b1917){return this['channel'][_0x0b73('0x28')](_0x4fe567,_0x0b73('0x19c'));}var _0x96bc54={'body':_0x4fe567[_0x0b73('0x19d')],'phone':_0x4fe567['to']||'','SmsAccountId':_0x4b1917['id']};logger['debug'](_0x0b73('0x19e'),JSON[_0x0b73('0x70')](_0x96bc54));this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x4fe567,_0x4fe567[_0x0b73('0x19a')]);this[_0x0b73('0xb')]['noop'](util['format'](_0x0b73('0x19f'),_0x4b1917['name']));this['createSmsMessage'][_0x0b73('0xbe')](this,_0x96bc54);return this['channel'][_0x0b73('0xa2')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1a0')]=function(_0x38fd24){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x1a1'),_0x38fd24[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x38fd24[_0x0b73('0xd7')])){return this['channel'][_0x0b73('0x28')](_0x38fd24,_0x0b73('0x1a2'));}var _0x38cf12=this['getVariable']['sync'](this,_0x38fd24[_0x0b73('0xd7')]);if(!_0x38cf12){return this['channel'][_0x0b73('0x28')](_0x38fd24,_0x0b73('0xd9'));}return this[_0x0b73('0xb')][_0x0b73('0x96')](_0x38cf12,_0x38fd24[_0x0b73('0x1a3')]);};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1a4')]=function(_0x17862e){logger['info'](util['format'](_0x0b73('0x1a5'),_0x17862e['label']));this['channel'][_0x0b73('0xa2')](_0x0b73('0x1a6'));if(_0x17862e['answer']===_0x0b73('0x1a7')){this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x1a8'));return this[_0x0b73('0xb')][_0x0b73('0xb5')]();}return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x1a9'));};AGIVertices[_0x0b73('0xd')]['subproject']=function(_0x6e8b93){logger['info'](util['format'](_0x0b73('0x1aa'),_0x6e8b93[_0x0b73('0x35')]));if(!this['isConfigured'](_0x6e8b93[_0x0b73('0x1ab')])){return this[_0x0b73('0xb')]['error'](_0x6e8b93,_0x0b73('0x1ac'));}var _0x3ebd46=this[_0x0b73('0x1ad')][_0x0b73('0xbe')](this,_0x6e8b93['project_id']);if(!this['isConfigured'](_0x3ebd46)){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x6e8b93,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x6e8b93['project_id']));}if(_0x3ebd46===this[_0x0b73('0xb')][_0x0b73('0x37')]){return this['channel'][_0x0b73('0x28')](_0x6e8b93,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x0b73('0x33')][_0x0b73('0xbe')](this,_0x6e8b93,_0x3ebd46);var _0x50ff61=this['channel'][_0x0b73('0x55')](_0x0b73('0x1ae'),util[_0x0b73('0x24')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x0b73('0xb2')]['host']||_0x0b73('0x1af'),_0x3ebd46,this[_0x0b73('0xb')][_0x0b73('0x37')]));if(_0x50ff61[_0x0b73('0xa5')]===-0x1){return _0x50ff61;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),'AGI',_0x3ebd46));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1b0')]=function(_0xe82e29){logger[_0x0b73('0x2c')](util[_0x0b73('0x24')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xe82e29['label']));var _0x3a500a=this['shellCommand']['sync'](this,_0xe82e29[_0x0b73('0xb3')]);this['createSquareDetailsReport'][_0x0b73('0xbe')](this,_0xe82e29,_0xe82e29['command']);if(this[_0x0b73('0xa1')](_0xe82e29[_0x0b73('0xd7')])){var _0x314361=this['getVariable'][_0x0b73('0xbe')](this,_0xe82e29[_0x0b73('0xd7')]);if(_0x314361){this[_0x0b73('0xb')][_0x0b73('0x96')](_0x314361,_0x3a500a);return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xe82e29[_0x0b73('0xb3')],_0x314361));}}return this['channel'][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x1b1'),_0xe82e29[_0x0b73('0xb3')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1b2')]=function(_0x5154b2){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5154b2[_0x0b73('0x35')]));_0x5154b2[_0x0b73('0x5a')]=_0x5154b2[_0x0b73('0x5a')][_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5154b2['apiKey'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0x1b3'));}if(!this['isConfigured'](_0x5154b2[_0x0b73('0x5a')])){return this[_0x0b73('0xb')][_0x0b73('0xa2')]('no\x20text\x20configured');}this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x1b4'),_0x5154b2['text']));var _0x113def=this[_0x0b73('0x58')][_0x0b73('0xbe')](this,_0x5154b2);if(_0x113def){this[_0x0b73('0xb')][_0x0b73('0xa2')](util['format'](_0x0b73('0x1b5'),_0x113def));var _0x273795=this[_0x0b73('0xb')][_0x0b73('0x100')](_0x113def);try{fs[_0x0b73('0x101')](_0x113def+_0x0b73('0x11f'));}catch(_0x416db0){logger['error'](_0x416db0);}return _0x273795;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x5154b2,_0x0b73('0x1b6'));};AGIVertices[_0x0b73('0xd')]['tts']=function(_0x381f86){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x1b7'),_0x381f86['label']));_0x381f86['text']=_0x381f86[_0x0b73('0x5a')][_0x0b73('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x381f86['text'])){return this[_0x0b73('0xb')][_0x0b73('0xa2')](_0x0b73('0xa3'));}this['channel'][_0x0b73('0xa2')](util['format'](_0x0b73('0x1b8'),_0x381f86[_0x0b73('0x5a')]));var _0x1ac1ac=this[_0x0b73('0x60')][_0x0b73('0xbe')](this,_0x381f86);if(_0x1ac1ac){this[_0x0b73('0xb')]['noop'](util[_0x0b73('0x24')](_0x0b73('0x1b9'),_0x1ac1ac));var _0x532baf=this[_0x0b73('0xb')]['streamFile'](_0x1ac1ac);try{fs[_0x0b73('0x101')](_0x1ac1ac+_0x0b73('0x11f'));}catch(_0x381580){logger[_0x0b73('0x28')](_0x381580);}return _0x532baf;}return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x381f86,_0x0b73('0x1ba'));};AGIVertices['prototype']['unpause']=function(_0x28410e){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x28410e[_0x0b73('0x35')]));if(!this[_0x0b73('0xa1')](_0x28410e[_0x0b73('0x152')])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x28410e,_0x0b73('0x159'));}logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x153'),this['channel'][_0x0b73('0x38')],_0x28410e[_0x0b73('0x152')]));var _0x122453=this[_0x0b73('0x4f')][_0x0b73('0xbe')](this,_0x28410e[_0x0b73('0x152')]);if(_0x122453){logger['info'](util[_0x0b73('0x24')](_0x0b73('0x154'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x28410e[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0b73('0x38')],_0x28410e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x0b73('0x2c')](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x28410e[_0x0b73('0x152')]));this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0x156'),this[_0x0b73('0xb')][_0x0b73('0x38')],_0x28410e['findBy']));return{'code':0xc8,'result':_0x0b73('0x157')};}};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1bb')]=function(_0x2b3e09){logger[_0x0b73('0x2c')](util['format'](_0x0b73('0x1bc'),_0x2b3e09[_0x0b73('0x35')]));var _0x2e9920=this[_0x0b73('0xb')][_0x0b73('0x55')](_0x0b73('0x1bd'),[_0x2b3e09[_0x0b73('0x1be')],_0x2b3e09[_0x0b73('0x75')]]);if(_0x2e9920[_0x0b73('0xa5')]===-0x1){return _0x2e9920;}return this[_0x0b73('0xb')][_0x0b73('0xa2')](util[_0x0b73('0x24')](_0x0b73('0xc3'),_0x0b73('0x1bd'),_0x2b3e09[_0x0b73('0x1be')]));};AGIVertices[_0x0b73('0xd')][_0x0b73('0x1bf')]=function(_0x3812a4){logger['info'](util[_0x0b73('0x24')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3812a4['label']));if(!this[_0x0b73('0xa1')](_0x3812a4['variable_id'])){return this[_0x0b73('0xb')][_0x0b73('0x28')](_0x3812a4,_0x0b73('0x1a2'));}var _0x215af4=this['getVariable']['sync'](this,_0x3812a4[_0x0b73('0xd7')]);if(!_0x215af4){return this['channel'][_0x0b73('0x28')](_0x3812a4,_0x0b73('0xd9'));}var _0x550968=this[_0x0b73('0xb')][_0x0b73('0x9b')](_0x215af4);return{'code':0xc8,'result':_0x550968[_0x0b73('0x9c')]?_0x550968['extra']:'-'};};String[_0x0b73('0xd')][_0x0b73('0x9a')]=function(_0x5e9204,_0x4ba61b){return this['split'](_0x5e9204)[_0x0b73('0x1c0')](_0x4ba61b);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 068ea9c..0d23457 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 _0x7da7=['[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','prototype','channels','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid'];(function(_0x5e2daf,_0x44ad21){var _0x299133=function(_0x1dabd3){while(--_0x1dabd3){_0x5e2daf['push'](_0x5e2daf['shift']());}};_0x299133(++_0x44ad21);}(_0x7da7,0x10d));var _0x77da=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x7da7[_0x5b740b];return _0x6f8f4e;};'use strict';var util=require(_0x77da('0x0'));var _=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x77da('0x3'));var RpcUser=require(_0x77da('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3a9fa6){this[_0x77da('0x5')]=_0x3a9fa6['voiceQueues'];this[_0x77da('0x6')]=_0x3a9fa6[_0x77da('0x6')];this['timers']=_0x3a9fa6[_0x77da('0x7')];this['channels']={};ami['on'](_0x77da('0x8'),this[_0x77da('0x9')][_0x77da('0xa')](this));ami['on'](_0x77da('0xb'),this[_0x77da('0xc')]['bind'](this));ami['on'](_0x77da('0xd'),this[_0x77da('0xe')][_0x77da('0xa')](this));ami['on']('agentringnoanswer',this[_0x77da('0xf')][_0x77da('0xa')](this));ami['on'](_0x77da('0x10'),this[_0x77da('0x11')]['bind'](this));ami['on'](_0x77da('0x12'),this[_0x77da('0x13')][_0x77da('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x77da('0xa')](this));}function getDiff(_0x4263d9){var _0x589aa1=moment()[_0x77da('0x14')](0x0);var _0x369df0=moment(_0x4263d9)[_0x77da('0x14')](0x0);return _0x589aa1[_0x77da('0x15')](_0x369df0,'seconds');}Acw[_0x77da('0x16')]['startAcw']=function(_0x29cd7b){try{var _0x366443=this;var _0x1b0e17=this[_0x77da('0x17')][_0x29cd7b]['interface'];var _0x5c07da=this['channels'][_0x29cd7b]['queue'];var _0x103e46=this[_0x77da('0x5')][_0x5c07da];var _0x289887=![];var _0x335dcb=_0x77da('0x18');if(_0x103e46[_0x77da('0x19')]){if(_0x103e46[_0x77da('0x1a')][_0x77da('0x1b')]){_0x289887=!![];_0x335dcb=_0x103e46['mandatoryDispositionPause']['name'];}}ami[_0x77da('0x1c')]({'action':_0x77da('0x1d'),'interface':_0x1b0e17,'paused':!![],'reason':_0x335dcb})['then'](function(_0x45a122){if(_0x366443[_0x77da('0x6')][_0x1b0e17]){return RpcUser[_0x77da('0x1e')](_0x366443['agents'][_0x1b0e17]['id'])['then'](function(_0x3e6cfe){if(_0x3e6cfe&&!_0x3e6cfe['voicePause']){logger[_0x77da('0x1f')](_0x77da('0x20'),_0x29cd7b,_0x1b0e17,_0x5c07da);var _0xc52f0e=_0x366443[_0x77da('0x17')][_0x29cd7b][_0x77da('0x21')]&&_0x366443[_0x77da('0x17')][_0x29cd7b][_0x77da('0x22')]?_0x366443['channels'][_0x29cd7b]['destlinkedid']:_0x29cd7b;return RpcUser[_0x77da('0x23')](_0x366443[_0x77da('0x6')][_0x1b0e17],_0x335dcb,_0xc52f0e)[_0x77da('0x24')](function(_0xbd06b7){if(!_0x289887){_0x366443['timers'][_0x1b0e17]={};logger[_0x77da('0x1f')](_0x77da('0x25'),_0x29cd7b,_0x366443[_0x77da('0x5')][_0x5c07da][_0x77da('0x26')],_0x1b0e17,_0x5c07da);_0x366443[_0x77da('0x7')][_0x1b0e17]['timer']=setTimeout(_0x366443[_0x77da('0x27')][_0x77da('0xa')](_0x366443,_0x1b0e17),_0x366443[_0x77da('0x5')][_0x5c07da][_0x77da('0x26')]*0x3e8);_0x366443['timers'][_0x1b0e17]['lastPauseAt']=moment()['format'](_0x77da('0x28'));_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x29')]=_0x29cd7b;_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2a')]=_0x5c07da;_0x366443['timers'][_0x1b0e17][_0x77da('0x2b')]=function(){var _0x26f5a0=getDiff(_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2c')]);clearTimeout(_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2d')]);_0x366443['timers'][_0x1b0e17][_0x77da('0x2d')]=![];RpcVoiceAgentReport[_0x77da('0x2e')]({'acwtime':_0x26f5a0},_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x29')],_0x1b0e17)[_0x77da('0x24')](function(_0x12ea16){logger[_0x77da('0x1f')](_0x77da('0x2f'),_0x29cd7b,_0x26f5a0,_0x12ea16);})['catch'](function(_0x5e8d1e){logger[_0x77da('0x30')](_0x77da('0x31'),_0x29cd7b,_0x5e8d1e);});delete _0x366443['timers'][_0x1b0e17];};}});}else{logger[_0x77da('0x1f')](_0x77da('0x32'),_0x29cd7b,_0x1b0e17,_0x5c07da);}});}})[_0x77da('0x33')](function(_0x10540a){logger[_0x77da('0x30')](_0x77da('0x25'),_0x29cd7b,_0x366443[_0x77da('0x5')][_0x5c07da]['acwTimeout'],_0x1b0e17,_0x5c07da);})[_0x77da('0x34')](function(){delete _0x366443['channels'][_0x29cd7b];});}catch(_0x54b7f2){logger['error'](_0x77da('0x35'),_0x54b7f2['message']);}};Acw[_0x77da('0x16')][_0x77da('0x27')]=function(_0xce9df2){try{var _0x3cc78b=this;if(_0x3cc78b[_0x77da('0x7')][_0xce9df2]){_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x2d')]=![];var _0x501306=_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x29')];var _0x1ca53a=_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x2a')];var _0x188284=_0x3cc78b['voiceQueues'][_0x1ca53a][_0x77da('0x26')];logger[_0x77da('0x1f')](_0x77da('0x36'),_0xce9df2);RpcUser['saveUnpause'](this[_0x77da('0x6')][_0xce9df2]);RpcVoiceAgentReport['update']({'acwtime':_0x188284,'agentacw':!![]},_0x501306,_0xce9df2)['then'](function(_0x599e21){logger['info'](_0x77da('0x2f'),_0x501306,_0x188284,_0x599e21);})[_0x77da('0x33')](function(_0xebdea1){logger['error'](_0x77da('0x31'),_0x501306,_0xebdea1);});}else{logger['error'](_0x77da('0x37'),_0xce9df2);if(_0x3cc78b['timers']){logger[_0x77da('0x1f')](_0x77da('0x38'),JSON[_0x77da('0x39')](_0x3cc78b[_0x77da('0x7')]));}}}catch(_0x240bee){logger['error'](_0x77da('0x3a'),_0x240bee[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')][_0x77da('0x9')]=function(_0x32a9c4){try{if(this[_0x77da('0x5')][_0x32a9c4['queue']]&&(this[_0x77da('0x5')][_0x32a9c4[_0x77da('0x2a')]][_0x77da('0x3')]||this[_0x77da('0x5')][_0x32a9c4[_0x77da('0x2a')]][_0x77da('0x19')])){if(this['agents'][_0x32a9c4[_0x77da('0x3c')]]){this['channels'][_0x32a9c4[_0x77da('0x29')]]={'queue':_0x32a9c4[_0x77da('0x2a')],'interface':_0x32a9c4[_0x77da('0x3c')],'destlinkedid':_0x32a9c4['destlinkedid']};}}}catch(_0x1c83c2){logger[_0x77da('0x30')](_0x77da('0x3d'),_0x1c83c2[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')][_0x77da('0x3e')]=function(_0x203caa){try{if(this[_0x77da('0x5')][_0x203caa[_0x77da('0x2a')]]&&(this['voiceQueues'][_0x203caa[_0x77da('0x2a')]][_0x77da('0x3')]||this[_0x77da('0x5')][_0x203caa[_0x77da('0x2a')]][_0x77da('0x19')])){if(this[_0x77da('0x6')][_0x203caa['interface']]){this['channels'][_0x203caa[_0x77da('0x29')]]={'queue':_0x203caa[_0x77da('0x2a')],'interface':_0x203caa[_0x77da('0x3c')]};}}}catch(_0x326054){logger[_0x77da('0x30')](_0x77da('0x3f'),_0x326054['message']);}};Acw[_0x77da('0x16')][_0x77da('0xc')]=function(_0x332f80){try{if(this[_0x77da('0x17')][_0x332f80['uniqueid']]&&_[_0x77da('0x40')](this['channels'][_0x332f80['uniqueid']][_0x77da('0x21')])){logger[_0x77da('0x1f')](_0x77da('0x41'),_0x332f80[_0x77da('0x29')]);this['startAcw'](_0x332f80[_0x77da('0x29')]);}else if(this[_0x77da('0x17')][_0x332f80['linkedid']]&&_[_0x77da('0x40')](this[_0x77da('0x17')][_0x332f80['linkedid']][_0x77da('0x21')])){logger[_0x77da('0x1f')](_0x77da('0x42'),_0x332f80[_0x77da('0x43')]);this[_0x77da('0x44')](_0x332f80[_0x77da('0x43')]);}}catch(_0x2b96c1){logger[_0x77da('0x30')](_0x77da('0x45'),_0x2b96c1[_0x77da('0x3b')]);}};Acw['prototype'][_0x77da('0xe')]=function(_0x513017){try{if(this[_0x77da('0x17')][_0x513017[_0x77da('0x29')]]&&this[_0x77da('0x17')][_0x513017[_0x77da('0x29')]][_0x77da('0x21')]){logger[_0x77da('0x1f')](_0x77da('0x46'),_0x513017['uniqueid']);this[_0x77da('0x44')](_0x513017[_0x77da('0x29')]);}else if(this[_0x77da('0x17')][_0x513017[_0x77da('0x43')]]&&this['channels'][_0x513017[_0x77da('0x43')]][_0x77da('0x21')]){logger[_0x77da('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x513017['linkedid']);this[_0x77da('0x44')](_0x513017[_0x77da('0x43')]);}}catch(_0x42ea9e){logger[_0x77da('0x30')](_0x77da('0x47'),_0x42ea9e['message']);}};Acw['prototype'][_0x77da('0x11')]=function(_0x36f161){try{if(!_['isNil'](this[_0x77da('0x17')][_0x36f161[_0x77da('0x48')]])){this[_0x77da('0x44')](_0x36f161['transfereeuniqueid']);if(this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]]){this['channels'][_0x36f161[_0x77da('0x49')]][_0x77da('0x21')]=!![];this[_0x77da('0x17')][_0x36f161[_0x77da('0x4a')]]=this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]];delete this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]];}}else if(!_[_0x77da('0x4b')](this['channels'][_0x36f161[_0x77da('0x4a')]])){this[_0x77da('0x44')](_0x36f161[_0x77da('0x4a')]);if(this[_0x77da('0x17')][_0x36f161[_0x77da('0x4c')]]){this[_0x77da('0x17')][_0x36f161['origtransfereruniqueid']][_0x77da('0x21')]=!![];this[_0x77da('0x17')][_0x36f161[_0x77da('0x48')]]=this['channels'][_0x36f161[_0x77da('0x4c')]];delete this[_0x77da('0x17')][_0x36f161[_0x77da('0x4c')]];}}}catch(_0x8592c7){logger[_0x77da('0x30')](_0x77da('0x4d'),_0x8592c7[_0x77da('0x3b')]);}};Acw['prototype'][_0x77da('0x13')]=function(_0x52c8f0){try{if(this[_0x77da('0x17')][_0x52c8f0[_0x77da('0x4e')]]){logger[_0x77da('0x1f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x77da('0x39')](_0x52c8f0[_0x77da('0x4e')]));this[_0x77da('0x44')](_0x52c8f0[_0x77da('0x4e')]);}else if(this['channels'][_0x52c8f0['transfererlinkedid']]){logger['info'](_0x77da('0x4f'),JSON[_0x77da('0x39')](_0x52c8f0[_0x77da('0x50')]));this[_0x77da('0x44')](_0x52c8f0[_0x77da('0x50')]);}}catch(_0x454f35){logger[_0x77da('0x30')](_0x77da('0x51'),_0x454f35[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')]['syncAgentRingNoAnswer']=function(_0x3028ca){try{if(this[_0x77da('0x5')][_0x3028ca['queue']]&&this['voiceQueues'][_0x3028ca[_0x77da('0x2a')]]['autopause']===_0x77da('0x52')){if(this[_0x77da('0x6')][_0x3028ca[_0x77da('0x3c')]]){logger['info'](_0x77da('0x53'),_0x3028ca[_0x77da('0x29')],_0x3028ca[_0x77da('0x3c')],_0x3028ca[_0x77da('0x2a')]);return RpcUser[_0x77da('0x23')](this['agents'][_0x3028ca[_0x77da('0x3c')]],_0x77da('0x54'),_0x3028ca['uniqueid']);}}}catch(_0x3fdde1){logger[_0x77da('0x30')](_0x77da('0x55'),_0x3fdde1[_0x77da('0x3b')]);}};module[_0x77da('0x56')]=Acw; \ No newline at end of file +var _0xa41a=['[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','queue','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','attended','destlinkedid','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer'];(function(_0x2fe9da,_0x296bb5){var _0x188fdf=function(_0x19d114){while(--_0x19d114){_0x2fe9da['push'](_0x2fe9da['shift']());}};_0x188fdf(++_0x296bb5);}(_0xa41a,0x6b));var _0xaa41=function(_0x4db03f,_0x195454){_0x4db03f=_0x4db03f-0x0;var _0x662f56=_0xa41a[_0x4db03f];return _0x662f56;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var moment=require('moment');var ami=require(_0xaa41('0x2'));var logger=require(_0xaa41('0x3'))(_0xaa41('0x4'));var RpcUser=require(_0xaa41('0x5'));var RpcVoiceAgentReport=require(_0xaa41('0x6'));function Acw(_0x3168be){this[_0xaa41('0x7')]=_0x3168be[_0xaa41('0x7')];this['agents']=_0x3168be[_0xaa41('0x8')];this[_0xaa41('0x9')]=_0x3168be['timers'];this['channels']={};ami['on'](_0xaa41('0xa'),this[_0xaa41('0xb')]['bind'](this));ami['on'](_0xaa41('0xc'),this[_0xaa41('0xd')][_0xaa41('0xe')](this));ami['on'](_0xaa41('0xf'),this[_0xaa41('0x10')][_0xaa41('0xe')](this));ami['on'](_0xaa41('0x11'),this[_0xaa41('0x12')][_0xaa41('0xe')](this));ami['on']('attendedtransfer',this[_0xaa41('0x13')][_0xaa41('0xe')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xaa41('0xe')](this));ami['on']('custom:agentConnectPreview',this[_0xaa41('0x14')][_0xaa41('0xe')](this));}function getDiff(_0x2f64bc){var _0x889d44=moment()[_0xaa41('0x15')](0x0);var _0x4eaf81=moment(_0x2f64bc)[_0xaa41('0x15')](0x0);return _0x889d44[_0xaa41('0x16')](_0x4eaf81,_0xaa41('0x17'));}Acw[_0xaa41('0x18')][_0xaa41('0x19')]=function(_0x2005ae){try{var _0x1e1e02=this;var _0x550ad5=this[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x1b')];var _0x4210fa=this[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x1c')];var _0xd20ddf=this[_0xaa41('0x7')][_0x4210fa];var _0x46e6d3=![];var _0x150ddf='ACW';if(_0xd20ddf['mandatoryDisposition']){if(_0xd20ddf[_0xaa41('0x1d')][_0xaa41('0x1e')]){_0x46e6d3=!![];_0x150ddf=_0xd20ddf[_0xaa41('0x1d')]['name'];}}ami[_0xaa41('0x1f')]({'action':_0xaa41('0x20'),'interface':_0x550ad5,'paused':!![],'reason':_0x150ddf})['then'](function(_0x513c61){if(_0x1e1e02[_0xaa41('0x8')][_0x550ad5]){return RpcUser['getAgent'](_0x1e1e02[_0xaa41('0x8')][_0x550ad5]['id'])[_0xaa41('0x21')](function(_0x3e2175){if(_0x3e2175&&!_0x3e2175[_0xaa41('0x22')]){logger[_0xaa41('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x550ad5,_0x4210fa);var _0x43c430=_0x1e1e02[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x24')]&&_0x1e1e02[_0xaa41('0x1a')][_0x2005ae][_0xaa41('0x25')]?_0x1e1e02[_0xaa41('0x1a')][_0x2005ae]['destlinkedid']:_0x2005ae;return RpcUser['savePause'](_0x1e1e02[_0xaa41('0x8')][_0x550ad5],_0x150ddf,_0x43c430)['then'](function(_0x493a10){if(!_0x46e6d3){_0x1e1e02[_0xaa41('0x9')][_0x550ad5]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x1e1e02[_0xaa41('0x7')][_0x4210fa][_0xaa41('0x26')],_0x550ad5,_0x4210fa);_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x27')]=setTimeout(_0x1e1e02[_0xaa41('0x28')][_0xaa41('0xe')](_0x1e1e02,_0x550ad5),_0x1e1e02['voiceQueues'][_0x4210fa][_0xaa41('0x26')]*0x3e8);_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x29')]=moment()[_0xaa41('0x2a')](_0xaa41('0x2b'));_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x2c')]=_0x2005ae;_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['queue']=_0x4210fa;_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['updateAcw']=function(){var _0x5dad80=getDiff(_0x1e1e02[_0xaa41('0x9')][_0x550ad5][_0xaa41('0x29')]);clearTimeout(_0x1e1e02['timers'][_0x550ad5][_0xaa41('0x27')]);_0x1e1e02[_0xaa41('0x9')][_0x550ad5]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x5dad80},_0x1e1e02['timers'][_0x550ad5][_0xaa41('0x2c')],_0x550ad5)[_0xaa41('0x21')](function(_0x2a186e){logger[_0xaa41('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x2005ae,_0x5dad80,_0x2a186e);})[_0xaa41('0x2d')](function(_0x45c8fe){logger[_0xaa41('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x2005ae,_0x45c8fe);});delete _0x1e1e02[_0xaa41('0x9')][_0x550ad5];};}});}else{logger[_0xaa41('0x23')](_0xaa41('0x2f'),_0x2005ae,_0x550ad5,_0x4210fa);}});}})['catch'](function(_0x252c62){logger[_0xaa41('0x2e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2005ae,_0x1e1e02[_0xaa41('0x7')][_0x4210fa][_0xaa41('0x26')],_0x550ad5,_0x4210fa);})[_0xaa41('0x30')](function(){delete _0x1e1e02['channels'][_0x2005ae];});}catch(_0x22b272){logger['error'](_0xaa41('0x31'),_0x22b272[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')]['stopAcw']=function(_0x526377){try{var _0x4cdd42=this;if(_0x4cdd42[_0xaa41('0x9')][_0x526377]){_0x4cdd42[_0xaa41('0x9')][_0x526377][_0xaa41('0x27')]=![];var _0x224eb3=_0x4cdd42['timers'][_0x526377]['uniqueid'];var _0x267999=_0x4cdd42[_0xaa41('0x9')][_0x526377][_0xaa41('0x1c')];var _0x4e8d2e=_0x4cdd42[_0xaa41('0x7')][_0x267999][_0xaa41('0x26')];logger[_0xaa41('0x23')]('[TIMER][STOP][AGENT:%s]',_0x526377);RpcUser[_0xaa41('0x33')](this[_0xaa41('0x8')][_0x526377]);RpcVoiceAgentReport[_0xaa41('0x34')]({'acwtime':_0x4e8d2e,'agentacw':!![]},_0x224eb3,_0x526377)[_0xaa41('0x21')](function(_0x57f1bf){logger['info'](_0xaa41('0x35'),_0x224eb3,_0x4e8d2e,_0x57f1bf);})[_0xaa41('0x2d')](function(_0x5eae08){logger[_0xaa41('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x224eb3,_0x5eae08);});}else{logger[_0xaa41('0x2e')](_0xaa41('0x36'),_0x526377);if(_0x4cdd42[_0xaa41('0x9')]){logger[_0xaa41('0x23')](_0xaa41('0x37'),JSON[_0xaa41('0x38')](_0x4cdd42[_0xaa41('0x9')]));}}}catch(_0x21f204){logger['error'](_0xaa41('0x39'),_0x21f204[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0xb')]=function(_0xc84fb8){try{if(this[_0xaa41('0x7')][_0xc84fb8['queue']]&&(this['voiceQueues'][_0xc84fb8[_0xaa41('0x1c')]]['acw']||this[_0xaa41('0x7')][_0xc84fb8[_0xaa41('0x1c')]][_0xaa41('0x3a')])){if(this[_0xaa41('0x8')][_0xc84fb8[_0xaa41('0x1b')]]){this[_0xaa41('0x1a')][_0xc84fb8[_0xaa41('0x2c')]]={'queue':_0xc84fb8['queue'],'interface':_0xc84fb8[_0xaa41('0x1b')],'destlinkedid':_0xc84fb8['destlinkedid']};}}}catch(_0x4dd842){logger[_0xaa41('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x4dd842['message']);}};Acw['prototype'][_0xaa41('0x14')]=function(_0x525b09){try{if(this[_0xaa41('0x7')][_0x525b09[_0xaa41('0x1c')]]&&(this['voiceQueues'][_0x525b09['queue']][_0xaa41('0x4')]||this[_0xaa41('0x7')][_0x525b09[_0xaa41('0x1c')]][_0xaa41('0x3a')])){if(this[_0xaa41('0x8')][_0x525b09[_0xaa41('0x1b')]]){this[_0xaa41('0x1a')][_0x525b09[_0xaa41('0x2c')]]={'queue':_0x525b09[_0xaa41('0x1c')],'interface':_0x525b09['interface']};}}}catch(_0x2eec35){logger[_0xaa41('0x2e')](_0xaa41('0x3b'),_0x2eec35[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0xd')]=function(_0x538b12){try{if(this[_0xaa41('0x1a')][_0x538b12[_0xaa41('0x2c')]]&&_[_0xaa41('0x3c')](this[_0xaa41('0x1a')][_0x538b12['uniqueid']][_0xaa41('0x24')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x538b12[_0xaa41('0x2c')]);this[_0xaa41('0x19')](_0x538b12[_0xaa41('0x2c')]);}else if(this['channels'][_0x538b12[_0xaa41('0x3d')]]&&_[_0xaa41('0x3c')](this[_0xaa41('0x1a')][_0x538b12['linkedid']][_0xaa41('0x24')])){logger[_0xaa41('0x23')](_0xaa41('0x3e'),_0x538b12[_0xaa41('0x3d')]);this[_0xaa41('0x19')](_0x538b12[_0xaa41('0x3d')]);}}catch(_0x333a9f){logger[_0xaa41('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x333a9f[_0xaa41('0x32')]);}};Acw['prototype']['syncHangup']=function(_0x1bdcd6){try{if(this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x2c')]]&&this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x2c')]][_0xaa41('0x24')]){logger[_0xaa41('0x23')](_0xaa41('0x3f'),_0x1bdcd6['uniqueid']);this[_0xaa41('0x19')](_0x1bdcd6[_0xaa41('0x2c')]);}else if(this[_0xaa41('0x1a')][_0x1bdcd6['linkedid']]&&this[_0xaa41('0x1a')][_0x1bdcd6[_0xaa41('0x3d')]]['attended']){logger[_0xaa41('0x23')](_0xaa41('0x40'),_0x1bdcd6[_0xaa41('0x3d')]);this['startAcw'](_0x1bdcd6[_0xaa41('0x3d')]);}}catch(_0xc8e626){logger['error']('[ACW][syncHangup]\x20%s',_0xc8e626[_0xaa41('0x32')]);}};Acw[_0xaa41('0x18')][_0xaa41('0x13')]=function(_0x4d20c6){try{if(!_[_0xaa41('0x41')](this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x42')]])){this[_0xaa41('0x19')](_0x4d20c6[_0xaa41('0x42')]);if(this['channels'][_0x4d20c6[_0xaa41('0x43')]]){this['channels'][_0x4d20c6['secondtransfereruniqueid']][_0xaa41('0x24')]=!![];this['channels'][_0x4d20c6[_0xaa41('0x44')]]=this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x43')]];delete this['channels'][_0x4d20c6[_0xaa41('0x43')]];}}else if(!_[_0xaa41('0x41')](this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x44')]])){this[_0xaa41('0x19')](_0x4d20c6[_0xaa41('0x44')]);if(this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x45')]]){this[_0xaa41('0x1a')][_0x4d20c6['origtransfereruniqueid']][_0xaa41('0x24')]=!![];this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x42')]]=this['channels'][_0x4d20c6[_0xaa41('0x45')]];delete this[_0xaa41('0x1a')][_0x4d20c6[_0xaa41('0x45')]];}}}catch(_0x134579){logger[_0xaa41('0x2e')](_0xaa41('0x46'),_0x134579[_0xaa41('0x32')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x5cb34d){try{if(this['channels'][_0x5cb34d['transfereruniqueid']]){logger['info'](_0xaa41('0x47'),JSON['stringify'](_0x5cb34d['transfereruniqueid']));this[_0xaa41('0x19')](_0x5cb34d[_0xaa41('0x48')]);}else if(this[_0xaa41('0x1a')][_0x5cb34d[_0xaa41('0x49')]]){logger['info'](_0xaa41('0x4a'),JSON[_0xaa41('0x38')](_0x5cb34d[_0xaa41('0x49')]));this[_0xaa41('0x19')](_0x5cb34d[_0xaa41('0x49')]);}}catch(_0x41ca40){logger[_0xaa41('0x2e')](_0xaa41('0x4b'),_0x41ca40[_0xaa41('0x32')]);}};Acw['prototype'][_0xaa41('0x12')]=function(_0x2d2af8){try{if(this['voiceQueues'][_0x2d2af8['queue']]&&this['voiceQueues'][_0x2d2af8[_0xaa41('0x1c')]]['autopause']===_0xaa41('0x4c')){if(this['agents'][_0x2d2af8[_0xaa41('0x1b')]]){logger[_0xaa41('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x2d2af8[_0xaa41('0x2c')],_0x2d2af8[_0xaa41('0x1b')],_0x2d2af8[_0xaa41('0x1c')]);return RpcUser[_0xaa41('0x4d')](this['agents'][_0x2d2af8['interface']],_0xaa41('0x4e'),_0x2d2af8[_0xaa41('0x2c')]);}}}catch(_0x4d6d0c){logger['error'](_0xaa41('0x4f'),_0x4d6d0c[_0xaa41('0x32')]);}};module[_0xaa41('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1042661..c0c63f8 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 _0x6d6c=['../../config/environment','asterisk','port','password','keepConnected','Action','promisify','error','username','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','once','bluebird','moment','util','lodash','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6d6c,0x93));var _0xc6d6=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x6d6c[_0x52b7b9];return _0x5b5d30;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xc6d6('0x0'));var moment=require(_0xc6d6('0x1'));var util=require(_0xc6d6('0x2'));var _=require(_0xc6d6('0x3'));var logger=require(_0xc6d6('0x4'))('ami');var config=require(_0xc6d6('0x5'));var ami=new Manager(config[_0xc6d6('0x6')][_0xc6d6('0x7')],config[_0xc6d6('0x6')]['ip'],config['asterisk']['username'],config[_0xc6d6('0x6')][_0xc6d6('0x8')],!![]);ami[_0xc6d6('0x9')]();ami[_0xc6d6('0xa')]=BPromise[_0xc6d6('0xb')](ami['action']);function error(_0x27151c){logger[_0xc6d6('0xc')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config[_0xc6d6('0x6')][_0xc6d6('0x7')],util[_0xc6d6('0xe')](_0x27151c,![],null)));}function close(){logger['error'](util[_0xc6d6('0xf')](_0xc6d6('0x10'),config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config[_0xc6d6('0x6')][_0xc6d6('0x7')]));}ami[_0xc6d6('0x11')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xc6d6('0x12')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x13')});};};ami[_0xc6d6('0x14')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x15')});};};ami[_0xc6d6('0x16')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x17')});};};ami[_0xc6d6('0x18')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x19')});};};function connect(_0x20eaf5){logger[_0xc6d6('0x1a')](util[_0xc6d6('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xc6d6('0x6')]['username'],config[_0xc6d6('0x6')]['ip'],config['asterisk'][_0xc6d6('0x7')]));ami['once'](_0xc6d6('0xc'),error);ami['once'](_0xc6d6('0x1b'),close);}ami['on'](_0xc6d6('0x1c'),connect);ami['on'](_0xc6d6('0x1d'),function(_0x56d5f9){logger[_0xc6d6('0x1a')](util[_0xc6d6('0xf')](_0xc6d6('0x1e'),config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config[_0xc6d6('0x6')][_0xc6d6('0x7')],util['inspect'](_0x56d5f9,![],null)));});ami['on'](_0xc6d6('0x1f'),function(_0x395dac){logger[_0xc6d6('0x1a')](util[_0xc6d6('0xf')](_0xc6d6('0x20'),config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config['asterisk'][_0xc6d6('0x7')]));return BPromise[_0xc6d6('0x21')]()[_0xc6d6('0x22')](ami['actionSipShowRegistry']())[_0xc6d6('0x22')](ami['actionDeviceStateList']())['then'](ami[_0xc6d6('0x14')]())[_0xc6d6('0x22')](ami[_0xc6d6('0x16')]())[_0xc6d6('0x22')](ami[_0xc6d6('0x18')]())[_0xc6d6('0x23')](function(_0x3366db){console[_0xc6d6('0x24')](_0x3366db);});});ami[_0xc6d6('0x25')](_0xc6d6('0xc'),error);ami[_0xc6d6('0x25')](_0xc6d6('0x1b'),close);module['exports']=ami; \ No newline at end of file +var _0xc21f=['asterisk','port','password','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','fullybooted','resolve','then','actionSipShowRegistry','actionCoreShowChannels','catch','log','close','exports','asterisk-manager','util','lodash','../../config/logger','ami'];(function(_0x4e8ac0,_0x45d5d9){var _0x1ce292=function(_0xc1741f){while(--_0xc1741f){_0x4e8ac0['push'](_0x4e8ac0['shift']());}};_0x1ce292(++_0x45d5d9);}(_0xc21f,0x1dc));var _0xfc21=function(_0x40c1e3,_0xbcea04){_0x40c1e3=_0x40c1e3-0x0;var _0x17cd43=_0xc21f[_0x40c1e3];return _0x17cd43;};'use strict';var Manager=require(_0xfc21('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xfc21('0x1'));var _=require(_0xfc21('0x2'));var logger=require(_0xfc21('0x3'))(_0xfc21('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0xfc21('0x5')][_0xfc21('0x6')],config[_0xfc21('0x5')]['ip'],config['asterisk']['username'],config[_0xfc21('0x5')][_0xfc21('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0xfc21('0x8')]);function error(_0x14b5b4){logger[_0xfc21('0x9')](util[_0xfc21('0xa')](_0xfc21('0xb'),config[_0xfc21('0x5')][_0xfc21('0xc')],config['asterisk']['ip'],config[_0xfc21('0x5')][_0xfc21('0x6')],util[_0xfc21('0xd')](_0x14b5b4,![],null)));}function close(){logger[_0xfc21('0x9')](util['format'](_0xfc21('0xe'),config[_0xfc21('0x5')][_0xfc21('0xc')],config[_0xfc21('0x5')]['ip'],config[_0xfc21('0x5')][_0xfc21('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xfc21('0xf')]({'action':_0xfc21('0x10')});};};ami[_0xfc21('0x11')]=function(){return function(){return ami[_0xfc21('0xf')]({'action':_0xfc21('0x12')});};};ami[_0xfc21('0x13')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xfc21('0x14')]=function(){return function(){return ami['Action']({'action':_0xfc21('0x15')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xfc21('0xf')]({'action':_0xfc21('0x16')});};};function connect(_0xb8d540){logger[_0xfc21('0x17')](util[_0xfc21('0xa')](_0xfc21('0x18'),config[_0xfc21('0x5')][_0xfc21('0xc')],config[_0xfc21('0x5')]['ip'],config[_0xfc21('0x5')]['port']));ami[_0xfc21('0x19')]('error',error);ami[_0xfc21('0x19')]('close',close);}ami['on'](_0xfc21('0x1a'),connect);ami['on'](_0xfc21('0x1b'),function(_0x2730d9){logger[_0xfc21('0x17')](util[_0xfc21('0xa')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xfc21('0xc')],config['asterisk']['ip'],config['asterisk'][_0xfc21('0x6')],util[_0xfc21('0xd')](_0x2730d9,![],null)));});ami['on'](_0xfc21('0x1c'),function(_0x39112e){logger[_0xfc21('0x17')](util[_0xfc21('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0xfc21('0x5')]['ip'],config[_0xfc21('0x5')][_0xfc21('0x6')]));return BPromise[_0xfc21('0x1d')]()[_0xfc21('0x1e')](ami[_0xfc21('0x1f')]())['then'](ami[_0xfc21('0x11')]())[_0xfc21('0x1e')](ami[_0xfc21('0x13')]())[_0xfc21('0x1e')](ami[_0xfc21('0x14')]())[_0xfc21('0x1e')](ami[_0xfc21('0x20')]())[_0xfc21('0x21')](function(_0x3150c3){console[_0xfc21('0x22')](_0x3150c3);});});ami[_0xfc21('0x19')]('error',error);ami['once'](_0xfc21('0x23'),close);module[_0xfc21('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index cb42900..e761e6e 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 _0xaa59=['bluebird','../../config/logger','client','http','Request','request','debug','rpc','error','memberReport','message','result','exports','jayson/promise'];(function(_0x2cab76,_0x4f2c93){var _0x26074d=function(_0x310cc2){while(--_0x310cc2){_0x2cab76['push'](_0x2cab76['shift']());}};_0x26074d(++_0x4f2c93);}(_0xaa59,0xb5));var _0x9aa5=function(_0x8054a0,_0x38a3a7){_0x8054a0=_0x8054a0-0x0;var _0x6388b7=_0xaa59[_0x8054a0];return _0x6388b7;};'use strict';var jayson=require(_0x9aa5('0x0'));var BPromise=require(_0x9aa5('0x1'));var logger=require(_0x9aa5('0x2'))('ami');var client=jayson[_0x9aa5('0x3')][_0x9aa5('0x4')]({'port':0x2329});client[_0x9aa5('0x5')]=function(_0x58ce45,_0x35ad27){return new BPromise(function(_0x2e5699,_0x4da9e9){return client[_0x9aa5('0x6')](_0x58ce45,_0x35ad27)['then'](function(_0x342935){logger[_0x9aa5('0x7')](_0x9aa5('0x8'),'memberReport',_0x58ce45,_0x35ad27,_0x342935);if(_0x342935[_0x9aa5('0x9')]){logger[_0x9aa5('0x9')]('rpc',_0x9aa5('0xa'),_0x58ce45,_0x342935[_0x9aa5('0x9')]['message'],_0x35ad27);return _0x4da9e9(_0x342935['error'][_0x9aa5('0xb')]);}else{return _0x2e5699(_0x342935[_0x9aa5('0xc')]);}})['catch'](function(_0x155a1d){logger[_0x9aa5('0x9')]('rpc',_0x9aa5('0xa'),_0x58ce45,_0x155a1d,_0x35ad27);return _0x4da9e9(_0x155a1d);});});};module[_0x9aa5('0xd')]=client; \ No newline at end of file +var _0x3f44=['bluebird','../../config/logger','ami','client','http','request','memberReport','error','rpc','message','catch'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x3f44,0xe7));var _0x43f4=function(_0x571cb8,_0x495cad){_0x571cb8=_0x571cb8-0x0;var _0x59fd5c=_0x3f44[_0x571cb8];return _0x59fd5c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x43f4('0x0'));var logger=require(_0x43f4('0x1'))(_0x43f4('0x2'));var client=jayson[_0x43f4('0x3')][_0x43f4('0x4')]({'port':0x2329});client['Request']=function(_0x4c082b,_0x19ffc5){return new BPromise(function(_0x549eb3,_0x5a561a){return client[_0x43f4('0x5')](_0x4c082b,_0x19ffc5)['then'](function(_0x544c65){logger['debug']('rpc',_0x43f4('0x6'),_0x4c082b,_0x19ffc5,_0x544c65);if(_0x544c65[_0x43f4('0x7')]){logger[_0x43f4('0x7')](_0x43f4('0x8'),_0x43f4('0x6'),_0x4c082b,_0x544c65[_0x43f4('0x7')][_0x43f4('0x9')],_0x19ffc5);return _0x5a561a(_0x544c65['error'][_0x43f4('0x9')]);}else{return _0x549eb3(_0x544c65['result']);}})[_0x43f4('0xa')](function(_0x724fa2){logger[_0x43f4('0x7')](_0x43f4('0x8'),'memberReport',_0x4c082b,_0x724fa2,_0x19ffc5);return _0x5a561a(_0x724fa2);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9489bf7..97c850c 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 _0xb6b8=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','getQueue','lodash','moment','string','isNil','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type'];(function(_0x2b1237,_0xcffa7a){var _0x1a86cc=function(_0x32de42){while(--_0x32de42){_0x2b1237['push'](_0x2b1237['shift']());}};_0x1a86cc(++_0xcffa7a);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x3fda6a,_0x28474f){_0x3fda6a=_0x3fda6a-0x0;var _0x1159aa=_0xb6b8[_0x3fda6a];return _0x1159aa;};'use strict';var util=require('util');var _=require(_0x8b6b('0x0'));var moment=require(_0x8b6b('0x1'));function checkNameSurname(_0x4633fe,_0x3cc9c9,_0x1153aa){var _0x387e4c='';if(!_['isNil'](_0x3cc9c9)&&_0x8b6b('0x2')===typeof _0x3cc9c9){_0x387e4c+=_0x3cc9c9;}if(!_[_0x8b6b('0x3')](_0x1153aa)&&_0x8b6b('0x2')===typeof _0x1153aa){_0x387e4c+='\x20'+_0x1153aa;}if(_0x387e4c!==''){return _0x387e4c;}return _0x4633fe;}function Action(_0x5db098,_0x144451,_0x511688){this['voiceQueue']=_0x5db098;this[_0x8b6b('0x4')]=_0x511688||undefined;this[_0x8b6b('0x5')]=checkNameSurname(_0x144451[_0x8b6b('0x6')][_0x8b6b('0x7')],_0x144451[_0x8b6b('0x6')][_0x8b6b('0x8')],_0x144451[_0x8b6b('0x6')][_0x8b6b('0x9')]);this['number']=_0x144451['Contact']['phone'];this[_0x8b6b('0xa')]=_0x5db098[_0x8b6b('0x5')];this[_0x8b6b('0xb')]=_0x144451['active']||![];this[_0x8b6b('0xc')]=_0x5db098[_0x8b6b('0xc')];this['dialQueueTimeout']=_0x5db098[_0x8b6b('0xd')]||0x3;this['scheduledat']=_0x144451[_0x8b6b('0xe')];this[_0x8b6b('0xf')]=_0x144451['countbusyretry'];this['countcongestionretry']=_0x144451[_0x8b6b('0x10')];this['countnoanswerretry']=_0x144451[_0x8b6b('0x11')];this[_0x8b6b('0x12')]=_0x144451[_0x8b6b('0x12')];this[_0x8b6b('0x13')]=_0x144451[_0x8b6b('0x13')];this['countabandonedretry']=_0x144451[_0x8b6b('0x14')];this[_0x8b6b('0x15')]=_0x144451[_0x8b6b('0x15')];this[_0x8b6b('0x16')]=_0x144451[_0x8b6b('0x16')];this[_0x8b6b('0x17')]=_0x144451[_0x8b6b('0x17')];this['ListId']=_0x144451[_0x8b6b('0x18')];this[_0x8b6b('0x19')]=_0x144451[_0x8b6b('0x19')];this[_0x8b6b('0x1a')]=_0x144451['VoiceQueueId'];this[_0x8b6b('0x1b')]=_0x144451[_0x8b6b('0x1b')];this['idHopper']=_0x144451['id'];this['ContactFirstName']=_0x144451[_0x8b6b('0x6')][_0x8b6b('0x8')]||'';this[_0x8b6b('0x1c')]=moment()['format'](_0x8b6b('0x1d'));this[_0x8b6b('0x1e')]=_0x144451[_0x8b6b('0x1e')];this['callbackuniqueid']=_0x144451[_0x8b6b('0x1f')];this[_0x8b6b('0x20')]=_0x144451[_0x8b6b('0x20')];this['recallme']=_0x144451['recallme'];this[_0x8b6b('0x21')]='';this[_0x8b6b('0x22')]='';}Action[_0x8b6b('0x23')]['getCaller']=function(){return util[_0x8b6b('0x24')](_0x8b6b('0x25'),this[_0x8b6b('0x5')],this[_0x8b6b('0x26')][_0x8b6b('0x27')]>0x0?this['number']['substring'](this[_0x8b6b('0x26')][_0x8b6b('0x27')]):this[_0x8b6b('0x28')]);};Action[_0x8b6b('0x23')][_0x8b6b('0x29')]=function(){return this[_0x8b6b('0xa')];};module['exports']=Action; \ No newline at end of file +var _0xaf4c=['string','isNil','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','exports','lodash','moment'];(function(_0x40444c,_0x114482){var _0x53d773=function(_0xa7432a){while(--_0xa7432a){_0x40444c['push'](_0x40444c['shift']());}};_0x53d773(++_0x114482);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x388810,_0x3ea1bb){_0x388810=_0x388810-0x0;var _0x331d29=_0xaf4c[_0x388810];return _0x331d29;};'use strict';var util=require('util');var _=require(_0xcaf4('0x0'));var moment=require(_0xcaf4('0x1'));function checkNameSurname(_0x4cd268,_0x10c20a,_0x453ce8){var _0x19adc9='';if(!_['isNil'](_0x10c20a)&&_0xcaf4('0x2')===typeof _0x10c20a){_0x19adc9+=_0x10c20a;}if(!_[_0xcaf4('0x3')](_0x453ce8)&&_0xcaf4('0x2')===typeof _0x453ce8){_0x19adc9+='\x20'+_0x453ce8;}if(_0x19adc9!==''){return _0x19adc9;}return _0x4cd268;}function Action(_0x4fddcf,_0x21ad95,_0x548527){this[_0xcaf4('0x4')]=_0x4fddcf;this[_0xcaf4('0x5')]=_0x548527||undefined;this[_0xcaf4('0x6')]=checkNameSurname(_0x21ad95[_0xcaf4('0x7')][_0xcaf4('0x8')],_0x21ad95[_0xcaf4('0x7')]['firstName'],_0x21ad95['Contact'][_0xcaf4('0x9')]);this[_0xcaf4('0xa')]=_0x21ad95[_0xcaf4('0x7')][_0xcaf4('0x8')];this[_0xcaf4('0xb')]=_0x4fddcf[_0xcaf4('0x6')];this[_0xcaf4('0xc')]=_0x21ad95[_0xcaf4('0xc')]||![];this[_0xcaf4('0xd')]=_0x4fddcf['type'];this[_0xcaf4('0xe')]=_0x4fddcf[_0xcaf4('0xe')]||0x3;this['scheduledat']=_0x21ad95[_0xcaf4('0xf')];this[_0xcaf4('0x10')]=_0x21ad95[_0xcaf4('0x10')];this['countcongestionretry']=_0x21ad95[_0xcaf4('0x11')];this[_0xcaf4('0x12')]=_0x21ad95['countnoanswerretry'];this[_0xcaf4('0x13')]=_0x21ad95['countnosuchnumberretry'];this[_0xcaf4('0x14')]=_0x21ad95[_0xcaf4('0x14')];this[_0xcaf4('0x15')]=_0x21ad95[_0xcaf4('0x15')];this[_0xcaf4('0x16')]=_0x21ad95[_0xcaf4('0x16')];this['countagentrejectretry']=_0x21ad95[_0xcaf4('0x17')];this['ContactId']=_0x21ad95[_0xcaf4('0x18')];this['ListId']=_0x21ad95[_0xcaf4('0x19')];this[_0xcaf4('0x1a')]=_0x21ad95[_0xcaf4('0x1a')];this['VoiceQueueId']=_0x21ad95['VoiceQueueId'];this[_0xcaf4('0x1b')]=_0x21ad95[_0xcaf4('0x1b')];this[_0xcaf4('0x1c')]=_0x21ad95['id'];this[_0xcaf4('0x1d')]=_0x21ad95[_0xcaf4('0x7')]['firstName']||'';this[_0xcaf4('0x1e')]=moment()[_0xcaf4('0x1f')](_0xcaf4('0x20'));this['callback']=_0x21ad95[_0xcaf4('0x21')];this[_0xcaf4('0x22')]=_0x21ad95[_0xcaf4('0x22')];this['callbackat']=_0x21ad95[_0xcaf4('0x23')];this['recallme']=_0x21ad95[_0xcaf4('0x24')];this[_0xcaf4('0x25')]='';this[_0xcaf4('0x26')]='';}Action['prototype'][_0xcaf4('0x27')]=function(){return util[_0xcaf4('0x1f')](_0xcaf4('0x28'),this[_0xcaf4('0x6')],this['voiceQueue'][_0xcaf4('0x29')]>0x0?this[_0xcaf4('0xa')]['substring'](this[_0xcaf4('0x4')][_0xcaf4('0x29')]):this[_0xcaf4('0xa')]);};Action[_0xcaf4('0x2a')][_0xcaf4('0x2b')]=function(){return this[_0xcaf4('0xb')];};module[_0xcaf4('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index f15f9da..1ec1e57 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 _0xc81a=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff'];(function(_0x2ead82,_0x40f9b7){var _0x41bc2=function(_0x13619e){while(--_0x13619e){_0x2ead82['push'](_0x2ead82['shift']());}};_0x41bc2(++_0x40f9b7);}(_0xc81a,0x71));var _0xac81=function(_0x296e54,_0x45f94f){_0x296e54=_0x296e54-0x0;var _0x42411d=_0xc81a[_0x296e54];return _0x42411d;};'use strict';var util=require(_0xac81('0x0'));var _=require('lodash');var moment=require(_0xac81('0x1'));function getSeconds(_0x4df2e3,_0x708c){var _0x5175ab=moment(_0x4df2e3)[_0xac81('0x2')](0x0);var _0x1892ab=moment(_0x708c)[_0xac81('0x2')](0x0);return _0x5175ab[_0xac81('0x3')](_0x1892ab,_0xac81('0x4'));}function AdditionalPhone(_0xfc990e){this[_0xac81('0x5')]=_0xfc990e[_0xac81('0x5')];this['scheduledat']=_0xfc990e[_0xac81('0x6')]||undefined;this[_0xac81('0x7')]=_0xfc990e[_0xac81('0x7')];this[_0xac81('0x8')]=_0xfc990e[_0xac81('0x7')]===_0xac81('0x9')?_0xac81('0xa'):_0xfc990e[_0xac81('0x7')];this[_0xac81('0xb')]=_0xfc990e[_0xac81('0xb')];this[_0xac81('0xc')]=_0xfc990e[_0xac81('0xc')];this[_0xac81('0xd')]=_0xfc990e[_0xac81('0xd')];this['countglobal']=_0xfc990e[_0xac81('0xb')]+_0xfc990e[_0xac81('0xc')]+_0xfc990e[_0xac81('0xd')]+_0xfc990e[_0xac81('0xe')]+_0xfc990e[_0xac81('0xf')]+_0xfc990e[_0xac81('0x10')]+_0xfc990e[_0xac81('0x11')]+_0xfc990e[_0xac81('0x12')];this[_0xac81('0xe')]=_0xfc990e[_0xac81('0xe')];this[_0xac81('0xf')]=_0xfc990e[_0xac81('0xf')];this[_0xac81('0x10')]=_0xfc990e[_0xac81('0x10')];this['countmachineretry']=_0xfc990e['countmachineretry'];this[_0xac81('0x12')]=_0xfc990e['countagentrejectretry'];this['queue']=_0xfc990e[_0xac81('0xa')];this[_0xac81('0x13')]=_0xfc990e[_0xac81('0x14')];this[_0xac81('0x15')]=_0xfc990e['number'];this[_0xac81('0x16')]=_0xfc990e['starttime'];this['responsetime']=_0xfc990e['responsetime'];this[_0xac81('0x17')]=_0xfc990e[_0xac81('0x18')];this[_0xac81('0x19')]=getSeconds(_0xfc990e[_0xac81('0x18')],_0xfc990e[_0xac81('0x16')]);this[_0xac81('0x1a')]=0x0;this[_0xac81('0x1b')]=0x0;this[_0xac81('0x1c')]=_0xfc990e[_0xac81('0x1c')];this[_0xac81('0x1d')]=_0xfc990e[_0xac81('0x1d')];this[_0xac81('0x1e')]=_0xfc990e[_0xac81('0x1e')];this[_0xac81('0x1f')]=_0xfc990e['recallme'];this[_0xac81('0x20')]=_0xfc990e['ContactId'];this[_0xac81('0x21')]=_0xfc990e[_0xac81('0x21')];this[_0xac81('0x22')]=_0xfc990e[_0xac81('0x22')];this[_0xac81('0x23')]=_0xfc990e[_0xac81('0x23')];this[_0xac81('0x24')]=_0xfc990e[_0xac81('0x24')];this['originatecalleridnum']=_0xfc990e[_0xac81('0x25')]||'';this[_0xac81('0x26')]=_0xfc990e[_0xac81('0x26')]||'';}module['exports']=History; \ No newline at end of file +var _0xf5c2=['countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue'];(function(_0x488814,_0x3fec59){var _0x58138b=function(_0x575c59){while(--_0x575c59){_0x488814['push'](_0x488814['shift']());}};_0x58138b(++_0x3fec59);}(_0xf5c2,0x1ee));var _0x2f5c=function(_0x196dc5,_0x50be9d){_0x196dc5=_0x196dc5-0x0;var _0x56458e=_0xf5c2[_0x196dc5];return _0x56458e;};'use strict';var util=require(_0x2f5c('0x0'));var _=require(_0x2f5c('0x1'));var moment=require(_0x2f5c('0x2'));function getSeconds(_0x4ddb31,_0x53f58f){var _0x5b89eb=moment(_0x4ddb31)['milliseconds'](0x0);var _0x46178f=moment(_0x53f58f)[_0x2f5c('0x3')](0x0);return _0x5b89eb[_0x2f5c('0x4')](_0x46178f,_0x2f5c('0x5'));}function AdditionalPhone(_0x261b6f){this['uniqueid']=_0x261b6f[_0x2f5c('0x6')];this[_0x2f5c('0x7')]=_0x261b6f[_0x2f5c('0x7')]||undefined;this['type']=_0x261b6f[_0x2f5c('0x8')];this['campaigntype']=_0x261b6f[_0x2f5c('0x8')]==='outbound'?_0x2f5c('0x9'):_0x261b6f['type'];this[_0x2f5c('0xa')]=_0x261b6f['countbusyretry'];this['countcongestionretry']=_0x261b6f[_0x2f5c('0xb')];this[_0x2f5c('0xc')]=_0x261b6f[_0x2f5c('0xc')];this['countglobal']=_0x261b6f['countbusyretry']+_0x261b6f[_0x2f5c('0xb')]+_0x261b6f[_0x2f5c('0xc')]+_0x261b6f['countnosuchnumberretry']+_0x261b6f[_0x2f5c('0xd')]+_0x261b6f[_0x2f5c('0xe')]+_0x261b6f[_0x2f5c('0xf')]+_0x261b6f['countagentrejectretry'];this[_0x2f5c('0x10')]=_0x261b6f[_0x2f5c('0x10')];this[_0x2f5c('0xd')]=_0x261b6f['countdropretry'];this[_0x2f5c('0xe')]=_0x261b6f['countabandonedretry'];this[_0x2f5c('0xf')]=_0x261b6f['countmachineretry'];this[_0x2f5c('0x11')]=_0x261b6f[_0x2f5c('0x11')];this[_0x2f5c('0x9')]=_0x261b6f[_0x2f5c('0x9')];this[_0x2f5c('0x12')]=_0x261b6f[_0x2f5c('0x13')];this[_0x2f5c('0x14')]=_0x261b6f['number'];this[_0x2f5c('0x15')]=_0x261b6f[_0x2f5c('0x15')];this['responsetime']=_0x261b6f[_0x2f5c('0x16')];this[_0x2f5c('0x17')]=_0x261b6f[_0x2f5c('0x16')];this[_0x2f5c('0x18')]=getSeconds(_0x261b6f['responsetime'],_0x261b6f[_0x2f5c('0x15')]);this[_0x2f5c('0x19')]=0x0;this[_0x2f5c('0x1a')]=0x0;this[_0x2f5c('0x1b')]=_0x261b6f['callback'];this['callbackuniqueid']=_0x261b6f['callbackuniqueid'];this[_0x2f5c('0x1c')]=_0x261b6f[_0x2f5c('0x1c')];this['recallme']=_0x261b6f[_0x2f5c('0x1d')];this[_0x2f5c('0x1e')]=_0x261b6f['ContactId'];this[_0x2f5c('0x1f')]=_0x261b6f[_0x2f5c('0x1f')];this[_0x2f5c('0x20')]=_0x261b6f[_0x2f5c('0x20')];this['VoiceQueueId']=_0x261b6f['VoiceQueueId'];this[_0x2f5c('0x21')]=_0x261b6f[_0x2f5c('0x21')];this[_0x2f5c('0x22')]=_0x261b6f[_0x2f5c('0x22')]||'';this['originatecalleridname']=_0x261b6f['originatecalleridname']||'';}module[_0x2f5c('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 16a7a26..4784e27 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 _0xdd5b=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','answertime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd5b,0x182));var _0xbdd5=function(_0x364192,_0x2ce6b4){_0x364192=_0x364192-0x0;var _0x493370=_0xdd5b[_0x364192];return _0x493370;};'use strict';var util=require(_0xbdd5('0x0'));var _=require('lodash');var moment=require(_0xbdd5('0x1'));function getSeconds(_0x48f8fb,_0x255327){var _0x2f28d9=moment(_0x48f8fb)[_0xbdd5('0x2')](0x0);var _0x5e41a6=moment(_0x255327)['milliseconds'](0x0);return _0x2f28d9[_0xbdd5('0x3')](_0x5e41a6,_0xbdd5('0x4'));}function AgentComplete(_0x529bcf,_0x3dddef){this[_0xbdd5('0x5')]=0x4;this[_0xbdd5('0x6')]=_0xbdd5('0x7');this[_0xbdd5('0x8')]=_0x529bcf[_0xbdd5('0x8')];this[_0xbdd5('0x9')]=_0x529bcf[_0xbdd5('0x9')];this[_0xbdd5('0xa')]=_0x529bcf['type']===_0xbdd5('0xb')?_0xbdd5('0xc'):_0x529bcf[_0xbdd5('0x9')];this[_0xbdd5('0xd')]=_0x529bcf[_0xbdd5('0xd')];this[_0xbdd5('0xe')]=_0x529bcf[_0xbdd5('0xe')];this[_0xbdd5('0xf')]=_0x529bcf[_0xbdd5('0xf')];this[_0xbdd5('0x10')]=_0x529bcf[_0xbdd5('0xd')]+_0x529bcf[_0xbdd5('0xe')]+_0x529bcf[_0xbdd5('0xf')]+_0x529bcf[_0xbdd5('0x11')]+_0x529bcf[_0xbdd5('0x12')]+_0x529bcf[_0xbdd5('0x13')]+_0x529bcf[_0xbdd5('0x14')]+_0x529bcf[_0xbdd5('0x15')];this['countnosuchnumberretry']=_0x529bcf['countnosuchnumberretry'];this['countdropretry']=_0x529bcf[_0xbdd5('0x12')];this[_0xbdd5('0x13')]=_0x529bcf[_0xbdd5('0x13')];this['countmachineretry']=_0x529bcf[_0xbdd5('0x14')];this[_0xbdd5('0x15')]=_0x529bcf['countagentrejectretry'];this['uniqueid']=_0x3dddef['uniqueid'];this[_0xbdd5('0x16')]=_0x529bcf['name'];this[_0xbdd5('0x17')]=_0x529bcf[_0xbdd5('0x18')];this[_0xbdd5('0x19')]=_0x529bcf[_0xbdd5('0x19')];this[_0xbdd5('0x1a')]=_0x529bcf[_0xbdd5('0x1a')];this['answertime']=_0x529bcf[_0xbdd5('0x1b')];this[_0xbdd5('0x1c')]=moment()[_0xbdd5('0x1d')](_0xbdd5('0x1e'));this['ringtime']=getSeconds(_0x529bcf['responsetime'],_0x529bcf['starttime']);this[_0xbdd5('0x1f')]=getSeconds(_0x529bcf[_0xbdd5('0x1b')],_0x529bcf[_0xbdd5('0x1a')]);this['talktime']=getSeconds(this[_0xbdd5('0x1c')],_0x529bcf[_0xbdd5('0x1b')]);this['queue']=_0x3dddef[_0xbdd5('0xc')];this[_0xbdd5('0x20')]=_0x3dddef[_0xbdd5('0x20')];this[_0xbdd5('0x21')]=_0x3dddef['reason'];this[_0xbdd5('0x22')]=_0x529bcf[_0xbdd5('0x22')];this['callbackuniqueid']=_0x529bcf[_0xbdd5('0x23')];this[_0xbdd5('0x24')]=_0x529bcf[_0xbdd5('0x24')];this[_0xbdd5('0x25')]=_0x529bcf[_0xbdd5('0x25')];this[_0xbdd5('0x26')]=_0x529bcf[_0xbdd5('0x26')];this[_0xbdd5('0x27')]=_0x529bcf[_0xbdd5('0x27')];this['UserId']=_0x529bcf[_0xbdd5('0x28')];this[_0xbdd5('0x29')]=_0x529bcf[_0xbdd5('0x29')];this[_0xbdd5('0x2a')]=_0x529bcf[_0xbdd5('0x2a')];this['originatecalleridnum']=_0x529bcf[_0xbdd5('0x2b')]||'';this[_0xbdd5('0x2c')]=_0x529bcf['originatecalleridname']||'';}module[_0xbdd5('0x2d')]=AgentComplete; \ No newline at end of file +var _0x3c21=['exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x385331,_0x17c181){var _0x8a2653=function(_0x255dd2){while(--_0x255dd2){_0x385331['push'](_0x385331['shift']());}};_0x8a2653(++_0x17c181);}(_0x3c21,0x1f0));var _0x13c2=function(_0x3a0355,_0x52ef8e){_0x3a0355=_0x3a0355-0x0;var _0x1d924d=_0x3c21[_0x3a0355];return _0x1d924d;};'use strict';var util=require(_0x13c2('0x0'));var _=require(_0x13c2('0x1'));var moment=require(_0x13c2('0x2'));function getSeconds(_0x25f609,_0x5e4386){var _0xd4dca9=moment(_0x25f609)['milliseconds'](0x0);var _0x3b465f=moment(_0x5e4386)[_0x13c2('0x3')](0x0);return _0xd4dca9[_0x13c2('0x4')](_0x3b465f,'seconds');}function AgentComplete(_0x3b87ab,_0x38365d){this[_0x13c2('0x5')]=0x4;this[_0x13c2('0x6')]=_0x13c2('0x7');this[_0x13c2('0x8')]=_0x3b87ab[_0x13c2('0x8')];this[_0x13c2('0x9')]=_0x3b87ab[_0x13c2('0x9')];this['campaigntype']=_0x3b87ab['type']===_0x13c2('0xa')?_0x13c2('0xb'):_0x3b87ab['type'];this[_0x13c2('0xc')]=_0x3b87ab[_0x13c2('0xc')];this[_0x13c2('0xd')]=_0x3b87ab[_0x13c2('0xd')];this[_0x13c2('0xe')]=_0x3b87ab[_0x13c2('0xe')];this[_0x13c2('0xf')]=_0x3b87ab[_0x13c2('0xc')]+_0x3b87ab[_0x13c2('0xd')]+_0x3b87ab['countnoanswerretry']+_0x3b87ab[_0x13c2('0x10')]+_0x3b87ab[_0x13c2('0x11')]+_0x3b87ab[_0x13c2('0x12')]+_0x3b87ab['countmachineretry']+_0x3b87ab['countagentrejectretry'];this['countnosuchnumberretry']=_0x3b87ab['countnosuchnumberretry'];this[_0x13c2('0x11')]=_0x3b87ab[_0x13c2('0x11')];this[_0x13c2('0x12')]=_0x3b87ab[_0x13c2('0x12')];this['countmachineretry']=_0x3b87ab[_0x13c2('0x13')];this[_0x13c2('0x14')]=_0x3b87ab[_0x13c2('0x14')];this[_0x13c2('0x15')]=_0x38365d[_0x13c2('0x15')];this['calleridname']=_0x3b87ab['name'];this[_0x13c2('0x16')]=_0x3b87ab[_0x13c2('0x17')];this['starttime']=_0x3b87ab[_0x13c2('0x18')];this[_0x13c2('0x19')]=_0x3b87ab[_0x13c2('0x19')];this[_0x13c2('0x1a')]=_0x3b87ab[_0x13c2('0x1a')];this[_0x13c2('0x1b')]=moment()['format'](_0x13c2('0x1c'));this[_0x13c2('0x1d')]=getSeconds(_0x3b87ab[_0x13c2('0x19')],_0x3b87ab[_0x13c2('0x18')]);this['holdtime']=getSeconds(_0x3b87ab[_0x13c2('0x1a')],_0x3b87ab[_0x13c2('0x19')]);this[_0x13c2('0x1e')]=getSeconds(this[_0x13c2('0x1b')],_0x3b87ab['answertime']);this[_0x13c2('0xb')]=_0x38365d[_0x13c2('0xb')];this[_0x13c2('0x1f')]=_0x38365d['membername'];this[_0x13c2('0x20')]=_0x38365d[_0x13c2('0x20')];this[_0x13c2('0x21')]=_0x3b87ab[_0x13c2('0x21')];this['callbackuniqueid']=_0x3b87ab[_0x13c2('0x22')];this['callbackat']=_0x3b87ab[_0x13c2('0x23')];this[_0x13c2('0x24')]=_0x3b87ab['recallme'];this[_0x13c2('0x25')]=_0x3b87ab[_0x13c2('0x25')];this[_0x13c2('0x26')]=_0x3b87ab[_0x13c2('0x26')];this[_0x13c2('0x27')]=_0x3b87ab[_0x13c2('0x27')];this[_0x13c2('0x28')]=_0x3b87ab[_0x13c2('0x28')];this['CampaignId']=_0x3b87ab[_0x13c2('0x29')];this['originatecalleridnum']=_0x3b87ab[_0x13c2('0x2a')]||'';this[_0x13c2('0x2b')]=_0x3b87ab[_0x13c2('0x2b')]||'';}module[_0x13c2('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e129973..987a478 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 _0x29b6=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x56103f,_0x32c915){var _0x405c6c=function(_0x5e8ab1){while(--_0x5e8ab1){_0x56103f['push'](_0x56103f['shift']());}};_0x405c6c(++_0x32c915);}(_0x29b6,0xf9));var _0x629b=function(_0x49dedd,_0x2f517e){_0x49dedd=_0x49dedd-0x0;var _0x32c535=_0x29b6[_0x49dedd];return _0x32c535;};'use strict';var util=require('util');var _=require(_0x629b('0x0'));var moment=require(_0x629b('0x1'));function getSeconds(_0x89d95b,_0x9e1d6a){var _0x52aab9=moment(_0x89d95b)[_0x629b('0x2')](0x0);var _0x394160=moment(_0x9e1d6a)[_0x629b('0x2')](0x0);return _0x52aab9[_0x629b('0x3')](_0x394160,_0x629b('0x4'));}function Final(_0x3aa59c){this[_0x629b('0x5')]=_0x3aa59c[_0x629b('0x5')];this[_0x629b('0x6')]=_0x3aa59c[_0x629b('0x6')];this[_0x629b('0x7')]=_0x3aa59c[_0x629b('0x7')];this[_0x629b('0x8')]=_0x3aa59c[_0x629b('0x7')]===_0x629b('0x9')?_0x629b('0xa'):_0x3aa59c[_0x629b('0x7')];this[_0x629b('0xb')]=_0x3aa59c[_0x629b('0xb')];this[_0x629b('0xc')]=_0x3aa59c[_0x629b('0xc')];this['countnoanswerretry']=_0x3aa59c[_0x629b('0xd')];this[_0x629b('0xe')]=_0x3aa59c[_0x629b('0xb')]+_0x3aa59c[_0x629b('0xc')]+_0x3aa59c[_0x629b('0xd')]+_0x3aa59c[_0x629b('0xf')]+_0x3aa59c[_0x629b('0x10')]+_0x3aa59c[_0x629b('0x11')]+_0x3aa59c['countmachineretry']+_0x3aa59c[_0x629b('0x12')];this[_0x629b('0xf')]=_0x3aa59c[_0x629b('0xf')];this[_0x629b('0x10')]=_0x3aa59c[_0x629b('0x10')];this[_0x629b('0x11')]=_0x3aa59c['countabandonedretry'];this[_0x629b('0x13')]=_0x3aa59c[_0x629b('0x13')];this[_0x629b('0x12')]=_0x3aa59c[_0x629b('0x12')];this[_0x629b('0xa')]=_0x3aa59c['queue'];this['calleridname']=_0x3aa59c[_0x629b('0x14')];this[_0x629b('0x15')]=_0x3aa59c[_0x629b('0x15')];this[_0x629b('0x16')]=_0x3aa59c[_0x629b('0x16')];this[_0x629b('0x17')]=_0x3aa59c[_0x629b('0x17')];this[_0x629b('0x18')]=_0x3aa59c[_0x629b('0x17')];this[_0x629b('0x19')]=_0x3aa59c[_0x629b('0x19')]||0x0;this[_0x629b('0x1a')]=_0x3aa59c[_0x629b('0x1a')]||0x0;this[_0x629b('0x1b')]=_0x3aa59c[_0x629b('0x1b')]||0x0;this[_0x629b('0x1c')]=_0x3aa59c[_0x629b('0x1c')];this[_0x629b('0x1d')]=_0x3aa59c[_0x629b('0x1d')];this[_0x629b('0x1e')]=_0x3aa59c[_0x629b('0x1e')];this['recallme']=_0x3aa59c[_0x629b('0x1f')];this[_0x629b('0x20')]=_0x3aa59c[_0x629b('0x20')];this['ListId']=_0x3aa59c[_0x629b('0x21')];this['UserId']=_0x3aa59c['UserId'];this['VoiceQueueId']=_0x3aa59c['VoiceQueueId'];this[_0x629b('0x22')]=_0x3aa59c[_0x629b('0x22')];this[_0x629b('0x23')]=_0x3aa59c[_0x629b('0x23')]||'';this['originatecalleridname']=_0x3aa59c[_0x629b('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0x2a43=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridnum','starttime','responsetime','endtime'];(function(_0x4ace03,_0x68babb){var _0x3c6fc1=function(_0x4c95c1){while(--_0x4c95c1){_0x4ace03['push'](_0x4ace03['shift']());}};_0x3c6fc1(++_0x68babb);}(_0x2a43,0x11c));var _0x32a4=function(_0x32c49b,_0x444f09){_0x32c49b=_0x32c49b-0x0;var _0x1acc02=_0x2a43[_0x32c49b];return _0x1acc02;};'use strict';var util=require('util');var _=require(_0x32a4('0x0'));var moment=require('moment');function getSeconds(_0x24e97c,_0x51186f){var _0x4eaed1=moment(_0x24e97c)[_0x32a4('0x1')](0x0);var _0x66957f=moment(_0x51186f)[_0x32a4('0x1')](0x0);return _0x4eaed1[_0x32a4('0x2')](_0x66957f,_0x32a4('0x3'));}function Final(_0x340444){this[_0x32a4('0x4')]=_0x340444[_0x32a4('0x4')];this[_0x32a4('0x5')]=_0x340444[_0x32a4('0x5')];this[_0x32a4('0x6')]=_0x340444[_0x32a4('0x6')];this[_0x32a4('0x7')]=_0x340444[_0x32a4('0x6')]===_0x32a4('0x8')?'queue':_0x340444[_0x32a4('0x6')];this[_0x32a4('0x9')]=_0x340444[_0x32a4('0x9')];this[_0x32a4('0xa')]=_0x340444[_0x32a4('0xa')];this['countnoanswerretry']=_0x340444[_0x32a4('0xb')];this[_0x32a4('0xc')]=_0x340444[_0x32a4('0x9')]+_0x340444[_0x32a4('0xa')]+_0x340444['countnoanswerretry']+_0x340444[_0x32a4('0xd')]+_0x340444[_0x32a4('0xe')]+_0x340444[_0x32a4('0xf')]+_0x340444['countmachineretry']+_0x340444[_0x32a4('0x10')];this[_0x32a4('0xd')]=_0x340444['countnosuchnumberretry'];this[_0x32a4('0xe')]=_0x340444[_0x32a4('0xe')];this['countabandonedretry']=_0x340444[_0x32a4('0xf')];this[_0x32a4('0x11')]=_0x340444['countmachineretry'];this[_0x32a4('0x10')]=_0x340444[_0x32a4('0x10')];this['queue']=_0x340444['queue'];this['calleridname']=_0x340444['calleridname'];this[_0x32a4('0x12')]=_0x340444[_0x32a4('0x12')];this[_0x32a4('0x13')]=_0x340444[_0x32a4('0x13')];this[_0x32a4('0x14')]=_0x340444[_0x32a4('0x14')];this[_0x32a4('0x15')]=_0x340444['responsetime'];this['ringtime']=_0x340444['ringtime']||0x0;this[_0x32a4('0x16')]=_0x340444['holdtime']||0x0;this[_0x32a4('0x17')]=_0x340444[_0x32a4('0x17')]||0x0;this[_0x32a4('0x18')]=_0x340444[_0x32a4('0x18')];this[_0x32a4('0x19')]=_0x340444[_0x32a4('0x19')];this[_0x32a4('0x1a')]=_0x340444[_0x32a4('0x1a')];this[_0x32a4('0x1b')]=_0x340444['recallme'];this['ContactId']=_0x340444[_0x32a4('0x1c')];this['ListId']=_0x340444['ListId'];this[_0x32a4('0x1d')]=_0x340444['UserId'];this[_0x32a4('0x1e')]=_0x340444[_0x32a4('0x1e')];this['CampaignId']=_0x340444[_0x32a4('0x1f')];this[_0x32a4('0x20')]=_0x340444['originatecalleridnum']||'';this['originatecalleridname']=_0x340444['originatecalleridname']||'';}module[_0x32a4('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 2aab5be..1b9c6fb 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 _0xd5bd=['UserId','VoiceQueueId','util','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x7bfdde,_0x48896f){var _0x1314ef=function(_0x365c56){while(--_0x365c56){_0x7bfdde['push'](_0x7bfdde['shift']());}};_0x1314ef(++_0x48896f);}(_0xd5bd,0xa6));var _0xdd5b=function(_0x754f7f,_0x5a0753){_0x754f7f=_0x754f7f-0x0;var _0x20d21b=_0xd5bd[_0x754f7f];return _0x20d21b;};'use strict';var util=require(_0xdd5b('0x0'));var _=require('lodash');var moment=require(_0xdd5b('0x1'));function getSeconds(_0x436ada,_0x540e4d){var _0x2986c8=moment(_0x436ada)[_0xdd5b('0x2')](0x0);var _0x1442b9=moment(_0x540e4d)[_0xdd5b('0x2')](0x0);return _0x2986c8[_0xdd5b('0x3')](_0x1442b9,_0xdd5b('0x4'));}function Hangup(_0x37f938,_0x1aa732){this[_0xdd5b('0x5')]=0x4;this['statedesc']='Answer';this[_0xdd5b('0x6')]=_0x37f938[_0xdd5b('0x6')];this[_0xdd5b('0x7')]=_0x37f938[_0xdd5b('0x7')];this[_0xdd5b('0x8')]=_0x37f938[_0xdd5b('0x7')]==='outbound'?_0xdd5b('0x9'):_0x37f938[_0xdd5b('0x7')];this[_0xdd5b('0xa')]=_0x37f938[_0xdd5b('0xa')];this[_0xdd5b('0xb')]=_0x37f938['countcongestionretry'];this[_0xdd5b('0xc')]=_0x37f938[_0xdd5b('0xc')];this['countglobal']=_0x37f938[_0xdd5b('0xa')]+_0x37f938[_0xdd5b('0xb')]+_0x37f938[_0xdd5b('0xc')]+_0x37f938[_0xdd5b('0xd')]+_0x37f938[_0xdd5b('0xe')]+_0x37f938[_0xdd5b('0xf')]+_0x37f938[_0xdd5b('0x10')]+_0x37f938[_0xdd5b('0x11')];this[_0xdd5b('0xd')]=_0x37f938['countnosuchnumberretry'];this[_0xdd5b('0xe')]=_0x37f938[_0xdd5b('0xe')];this[_0xdd5b('0xf')]=_0x37f938[_0xdd5b('0xf')];this['countmachineretry']=_0x37f938[_0xdd5b('0x10')];this[_0xdd5b('0x11')]=_0x37f938[_0xdd5b('0x11')];this[_0xdd5b('0x12')]=_0x1aa732[_0xdd5b('0x12')];this[_0xdd5b('0x13')]=_0x37f938[_0xdd5b('0x14')];this['calleridnum']=_0x37f938[_0xdd5b('0x15')];this[_0xdd5b('0x16')]=_0x37f938[_0xdd5b('0x16')];this[_0xdd5b('0x17')]=_0x37f938[_0xdd5b('0x17')];this[_0xdd5b('0x18')]=moment()[_0xdd5b('0x19')](_0xdd5b('0x1a'));this[_0xdd5b('0x1b')]=getSeconds(_0x37f938['responsetime'],_0x37f938[_0xdd5b('0x16')]);this[_0xdd5b('0x1c')]=0x0;this[_0xdd5b('0x1d')]=getSeconds(this['endtime'],_0x37f938['responsetime']);this[_0xdd5b('0x9')]=_0x37f938[_0xdd5b('0x9')];this[_0xdd5b('0x1e')]='IVR';this[_0xdd5b('0x1f')]=_0x1aa732[_0xdd5b('0x20')];this[_0xdd5b('0x21')]=_0x37f938[_0xdd5b('0x21')];this[_0xdd5b('0x22')]=_0x37f938[_0xdd5b('0x22')];this['callbackat']=_0x37f938[_0xdd5b('0x23')];this[_0xdd5b('0x24')]=_0x37f938[_0xdd5b('0x24')];this[_0xdd5b('0x25')]=_0x37f938[_0xdd5b('0x25')];this[_0xdd5b('0x26')]=_0x37f938[_0xdd5b('0x26')];this[_0xdd5b('0x27')]=_0x37f938[_0xdd5b('0x27')];this[_0xdd5b('0x28')]=_0x37f938[_0xdd5b('0x28')];this['CampaignId']=_0x37f938['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x8e0c=['seconds','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','diff'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8e0c,0xf9));var _0xc8e0=function(_0x5cc8e1,_0x113e9a){_0x5cc8e1=_0x5cc8e1-0x0;var _0x311b10=_0x8e0c[_0x5cc8e1];return _0x311b10;};'use strict';var util=require(_0xc8e0('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x473070,_0x27a8c0){var _0x2466e6=moment(_0x473070)['milliseconds'](0x0);var _0x59c89e=moment(_0x27a8c0)[_0xc8e0('0x1')](0x0);return _0x2466e6[_0xc8e0('0x2')](_0x59c89e,_0xc8e0('0x3'));}function Hangup(_0x2859a4,_0x59cc8d){this[_0xc8e0('0x4')]=0x4;this['statedesc']=_0xc8e0('0x5');this[_0xc8e0('0x6')]=_0x2859a4[_0xc8e0('0x6')];this[_0xc8e0('0x7')]=_0x2859a4[_0xc8e0('0x7')];this[_0xc8e0('0x8')]=_0x2859a4[_0xc8e0('0x7')]===_0xc8e0('0x9')?'queue':_0x2859a4[_0xc8e0('0x7')];this[_0xc8e0('0xa')]=_0x2859a4[_0xc8e0('0xa')];this['countcongestionretry']=_0x2859a4[_0xc8e0('0xb')];this[_0xc8e0('0xc')]=_0x2859a4[_0xc8e0('0xc')];this[_0xc8e0('0xd')]=_0x2859a4[_0xc8e0('0xa')]+_0x2859a4[_0xc8e0('0xb')]+_0x2859a4[_0xc8e0('0xc')]+_0x2859a4['countnosuchnumberretry']+_0x2859a4[_0xc8e0('0xe')]+_0x2859a4[_0xc8e0('0xf')]+_0x2859a4['countmachineretry']+_0x2859a4['countagentrejectretry'];this[_0xc8e0('0x10')]=_0x2859a4[_0xc8e0('0x10')];this[_0xc8e0('0xe')]=_0x2859a4['countdropretry'];this[_0xc8e0('0xf')]=_0x2859a4[_0xc8e0('0xf')];this[_0xc8e0('0x11')]=_0x2859a4[_0xc8e0('0x11')];this['countagentrejectretry']=_0x2859a4[_0xc8e0('0x12')];this[_0xc8e0('0x13')]=_0x59cc8d[_0xc8e0('0x13')];this[_0xc8e0('0x14')]=_0x2859a4[_0xc8e0('0x15')];this[_0xc8e0('0x16')]=_0x2859a4['number'];this[_0xc8e0('0x17')]=_0x2859a4[_0xc8e0('0x17')];this[_0xc8e0('0x18')]=_0x2859a4[_0xc8e0('0x18')];this[_0xc8e0('0x19')]=moment()[_0xc8e0('0x1a')](_0xc8e0('0x1b'));this[_0xc8e0('0x1c')]=getSeconds(_0x2859a4['responsetime'],_0x2859a4[_0xc8e0('0x17')]);this['holdtime']=0x0;this[_0xc8e0('0x1d')]=getSeconds(this[_0xc8e0('0x19')],_0x2859a4['responsetime']);this['queue']=_0x2859a4[_0xc8e0('0x1e')];this[_0xc8e0('0x1f')]='IVR';this['reason']=_0x59cc8d[_0xc8e0('0x20')];this['callback']=_0x2859a4['callback'];this[_0xc8e0('0x21')]=_0x2859a4[_0xc8e0('0x21')];this[_0xc8e0('0x22')]=_0x2859a4[_0xc8e0('0x22')];this[_0xc8e0('0x23')]=_0x2859a4['recallme'];this[_0xc8e0('0x24')]=_0x2859a4[_0xc8e0('0x24')];this[_0xc8e0('0x25')]=_0x2859a4[_0xc8e0('0x25')];this[_0xc8e0('0x26')]=_0x2859a4[_0xc8e0('0x26')];this['VoiceQueueId']=_0x2859a4[_0xc8e0('0x27')];this[_0xc8e0('0x28')]=_0x2859a4[_0xc8e0('0x28')];}module[_0xc8e0('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 5d9478c..0da4bbd 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 _0xe303=['endtime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime'];(function(_0x3c4eef,_0x13b21e){var _0x221e68=function(_0x283dbb){while(--_0x283dbb){_0x3c4eef['push'](_0x3c4eef['shift']());}};_0x221e68(++_0x13b21e);}(_0xe303,0x112));var _0x3e30=function(_0x1e76ca,_0x44517c){_0x1e76ca=_0x1e76ca-0x0;var _0x548150=_0xe303[_0x1e76ca];return _0x548150;};'use strict';var util=require(_0x3e30('0x0'));var _=require('lodash');var moment=require(_0x3e30('0x1'));function getSeconds(_0x519323,_0x3d3305){var _0x296359=moment(_0x519323)['milliseconds'](0x0);var _0x482002=moment(_0x3d3305)[_0x3e30('0x2')](0x0);return _0x296359['diff'](_0x482002,_0x3e30('0x3'));}function History(_0x2713d4){this[_0x3e30('0x4')]=_0x2713d4[_0x3e30('0x4')];this[_0x3e30('0x5')]=_0x2713d4[_0x3e30('0x5')]||undefined;this[_0x3e30('0x6')]=_0x2713d4['type'];this[_0x3e30('0x7')]=_0x2713d4[_0x3e30('0x6')]===_0x3e30('0x8')?_0x3e30('0x9'):_0x2713d4[_0x3e30('0x6')];this[_0x3e30('0xa')]=_0x2713d4['countbusyretry'];this[_0x3e30('0xb')]=_0x2713d4[_0x3e30('0xb')];this['countnoanswerretry']=_0x2713d4['countnoanswerretry'];this['countglobal']=_0x2713d4[_0x3e30('0xa')]+_0x2713d4[_0x3e30('0xb')]+_0x2713d4[_0x3e30('0xc')]+_0x2713d4[_0x3e30('0xd')]+_0x2713d4[_0x3e30('0xe')]+_0x2713d4[_0x3e30('0xf')]+_0x2713d4[_0x3e30('0x10')]+_0x2713d4[_0x3e30('0x11')];this['countnosuchnumberretry']=_0x2713d4[_0x3e30('0xd')];this[_0x3e30('0xe')]=_0x2713d4[_0x3e30('0xe')];this[_0x3e30('0xf')]=_0x2713d4[_0x3e30('0xf')];this[_0x3e30('0x10')]=_0x2713d4[_0x3e30('0x10')];this[_0x3e30('0x11')]=_0x2713d4[_0x3e30('0x11')];this[_0x3e30('0x9')]=_0x2713d4[_0x3e30('0x9')];this[_0x3e30('0x12')]=_0x2713d4['name'];this[_0x3e30('0x13')]=_0x2713d4[_0x3e30('0x14')];this[_0x3e30('0x15')]=_0x2713d4[_0x3e30('0x15')];this['responsetime']=_0x2713d4['responsetime'];this[_0x3e30('0x16')]=_0x2713d4[_0x3e30('0x17')];this[_0x3e30('0x18')]=getSeconds(_0x2713d4[_0x3e30('0x17')],_0x2713d4[_0x3e30('0x15')]);this['holdtime']=0x0;this[_0x3e30('0x19')]=0x0;this[_0x3e30('0x1a')]=_0x2713d4['callback'];this['callbackuniqueid']=_0x2713d4[_0x3e30('0x1b')];this[_0x3e30('0x1c')]=_0x2713d4['callbackat'];this['recallme']=_0x2713d4[_0x3e30('0x1d')];this[_0x3e30('0x1e')]=_0x2713d4[_0x3e30('0x1e')];this[_0x3e30('0x1f')]=_0x2713d4['ListId'];this[_0x3e30('0x20')]=_0x2713d4[_0x3e30('0x20')];this[_0x3e30('0x21')]=_0x2713d4[_0x3e30('0x21')];this[_0x3e30('0x22')]=_0x2713d4['CampaignId'];this[_0x3e30('0x23')]=_0x2713d4[_0x3e30('0x23')]||'';this[_0x3e30('0x24')]=_0x2713d4[_0x3e30('0x24')]||'';}module['exports']=History; \ No newline at end of file +var _0xafa8=['countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x2753ca,_0x57c477){var _0x4306cc=function(_0x40ae24){while(--_0x40ae24){_0x2753ca['push'](_0x2753ca['shift']());}};_0x4306cc(++_0x57c477);}(_0xafa8,0x135));var _0x8afa=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xafa8[_0x56740a];return _0x257144;};'use strict';var util=require('util');var _=require(_0x8afa('0x0'));var moment=require(_0x8afa('0x1'));function getSeconds(_0xe901e8,_0x221aec){var _0x198d41=moment(_0xe901e8)[_0x8afa('0x2')](0x0);var _0x144520=moment(_0x221aec)['milliseconds'](0x0);return _0x198d41[_0x8afa('0x3')](_0x144520,'seconds');}function History(_0x1912b1){this['uniqueid']=_0x1912b1['uniqueid'];this[_0x8afa('0x4')]=_0x1912b1[_0x8afa('0x4')]||undefined;this[_0x8afa('0x5')]=_0x1912b1[_0x8afa('0x5')];this['campaigntype']=_0x1912b1[_0x8afa('0x5')]===_0x8afa('0x6')?_0x8afa('0x7'):_0x1912b1[_0x8afa('0x5')];this[_0x8afa('0x8')]=_0x1912b1[_0x8afa('0x8')];this[_0x8afa('0x9')]=_0x1912b1[_0x8afa('0x9')];this[_0x8afa('0xa')]=_0x1912b1['countnoanswerretry'];this[_0x8afa('0xb')]=_0x1912b1[_0x8afa('0x8')]+_0x1912b1[_0x8afa('0x9')]+_0x1912b1[_0x8afa('0xa')]+_0x1912b1[_0x8afa('0xc')]+_0x1912b1[_0x8afa('0xd')]+_0x1912b1[_0x8afa('0xe')]+_0x1912b1[_0x8afa('0xf')]+_0x1912b1[_0x8afa('0x10')];this['countnosuchnumberretry']=_0x1912b1[_0x8afa('0xc')];this['countdropretry']=_0x1912b1[_0x8afa('0xd')];this[_0x8afa('0xe')]=_0x1912b1[_0x8afa('0xe')];this['countmachineretry']=_0x1912b1[_0x8afa('0xf')];this[_0x8afa('0x10')]=_0x1912b1[_0x8afa('0x10')];this[_0x8afa('0x7')]=_0x1912b1['queue'];this[_0x8afa('0x11')]=_0x1912b1[_0x8afa('0x12')];this[_0x8afa('0x13')]=_0x1912b1['number'];this[_0x8afa('0x14')]=_0x1912b1[_0x8afa('0x14')];this[_0x8afa('0x15')]=_0x1912b1[_0x8afa('0x15')];this[_0x8afa('0x16')]=_0x1912b1[_0x8afa('0x15')];this[_0x8afa('0x17')]=getSeconds(_0x1912b1['responsetime'],_0x1912b1[_0x8afa('0x14')]);this[_0x8afa('0x18')]=0x0;this[_0x8afa('0x19')]=0x0;this[_0x8afa('0x1a')]=_0x1912b1[_0x8afa('0x1a')];this['callbackuniqueid']=_0x1912b1['callbackuniqueid'];this[_0x8afa('0x1b')]=_0x1912b1['callbackat'];this[_0x8afa('0x1c')]=_0x1912b1[_0x8afa('0x1c')];this['ContactId']=_0x1912b1[_0x8afa('0x1d')];this[_0x8afa('0x1e')]=_0x1912b1[_0x8afa('0x1e')];this[_0x8afa('0x1f')]=_0x1912b1['UserId'];this[_0x8afa('0x20')]=_0x1912b1['VoiceQueueId'];this[_0x8afa('0x21')]=_0x1912b1[_0x8afa('0x21')];this[_0x8afa('0x22')]=_0x1912b1['originatecalleridnum']||'';this[_0x8afa('0x23')]=_0x1912b1['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 6ba25da..ccb3c83 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 _0x92f0=['cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','syncNewExten','actionid','locked','paused','agents','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','iftime\x20%s,%s','all','INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','Queue','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','emit','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','getDataPredictive','dropRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','floor','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','lodash','bluebird','moment','md5','../../../config/environment/','../../../config/logger','dialer','booked','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','contactsId','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','varset','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','\x20INTERVAL_IS_NULL','Interval','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','undefined','isNil','Action','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','membername','AMD','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject'];(function(_0x480843,_0x8121e6){var _0x1d5cd9=function(_0x54ca2a){while(--_0x54ca2a){_0x480843['push'](_0x480843['shift']());}};_0x1d5cd9(++_0x8121e6);}(_0x92f0,0x10d));var _0x092f=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x92f0[_0x130209];return _0x155fb7;};'use strict';var util=require('util');var _=require(_0x092f('0x0'));var BPromise=require(_0x092f('0x1'));var uuid=require('uuid');var moment=require(_0x092f('0x2'));var rr=require('rr');var md5=require(_0x092f('0x3'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0x092f('0x4'));var logger=require(_0x092f('0x5'))(_0x092f('0x6'));var loggerBooked=require(_0x092f('0x5'))(_0x092f('0x7'));var loggerPredictive=require(_0x092f('0x5'))('predictive');var loggerPredictiveCalls=require(_0x092f('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x092f('0x5'))('syncQueueSummary');var ami=require(_0x092f('0x8'));config['redis']=_[_0x092f('0x9')](config['redis'],{'host':_0x092f('0xa'),'port':0x18eb});var io=require(_0x092f('0xb'))(new Redis(config[_0x092f('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x092f('0xd'));var cmHopperBlack=require(_0x092f('0xe'));var voiceQueueRt=require(_0x092f('0xf'));var Action=require(_0x092f('0x10'));var History=require(_0x092f('0x11'));var Final=require('./final');var AgentComplete=require(_0x092f('0x12'));var QueueCallerAbandon=require(_0x092f('0x13'));var Hangup=require('./hangup');var ipAgi=process[_0x092f('0x14')][_0x092f('0x15')]||_0x092f('0x16');var strategy={'rrmemory':_0x092f('0x17'),'roundrobin':_0x092f('0x18')};var Sequence=function(){};Sequence[_0x092f('0x19')][_0x092f('0x1a')]=function(_0x272ea5){this['tail']=this[_0x092f('0x1b')]?this[_0x092f('0x1b')][_0x092f('0x1c')](_0x272ea5):_0x272ea5();};function Dialer(_0x212e99,_0x57e911){this['sequence']=new Sequence();this[_0x092f('0x1d')]=_0x57e911;this[_0x092f('0x1e')]=_0x212e99[_0x092f('0x1e')];this[_0x092f('0x1f')]=_0x212e99[_0x092f('0x1f')];this['agents']=_0x212e99['agents'];this[_0x092f('0x20')]=_0x212e99[_0x092f('0x20')];this[_0x092f('0x21')]=config[_0x092f('0x21')]||0x2;this[_0x092f('0x22')]={};this['actions']={};this[_0x092f('0x23')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x092f('0x24')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x092f('0x25')]={};ami['on'](_0x092f('0x26'),this[_0x092f('0x27')]['bind'](this));ami['on'](_0x092f('0x28'),this['syncQueueCallerAbandon'][_0x092f('0x29')](this));ami['on'](_0x092f('0x2a'),this[_0x092f('0x2b')][_0x092f('0x29')](this));ami['on'](_0x092f('0x2c'),this[_0x092f('0x2d')][_0x092f('0x29')](this));ami['on'](_0x092f('0x2e'),this[_0x092f('0x2f')][_0x092f('0x29')](this));ami['on'](_0x092f('0x30'),this[_0x092f('0x31')][_0x092f('0x29')](this));ami['on'](_0x092f('0x32'),this['syncNewExten'][_0x092f('0x29')](this));ami['on'](_0x092f('0x33'),this['syncVarSet'][_0x092f('0x29')](this));ami['on']('queuemember',this['syncQueueMember'][_0x092f('0x29')](this));ami['on'](_0x092f('0x34'),this[_0x092f('0x35')][_0x092f('0x29')](this));this['loopCampaigns']();this[_0x092f('0x36')]();}function isNotNull(_0x55f71b){return _0x55f71b!==null&&!_[_0x092f('0x37')](_0x55f71b);}function checkIsLoggedIn(_0x3434d8,_0x372327){return function(){if(_0x372327<=0x0){_0x3434d8[_0x092f('0x38')]=_0x092f('0x39');throw _0x3434d8[_0x092f('0x3a')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x58830a){return _0x58830a;}function checkIsActive(_0x4f74c8,_0x23aea7){return function(){if(!isActive(_0x23aea7)){_0x4f74c8['message']=_0x092f('0x3b');throw _0x4f74c8['name']+_0x092f('0x3c');}};}function checkInterval(_0xa97ece){return function(){if(!isNotNull(_0xa97ece['Interval'])){_0xa97ece[_0x092f('0x38')]='INTERVAL_IS_NULL';throw _0xa97ece[_0x092f('0x3a')]+_0x092f('0x3d');}if(!isNotNull(_0xa97ece[_0x092f('0x3e')][_0x092f('0x3f')])){_0xa97ece[_0x092f('0x38')]=_0x092f('0x40');throw _0xa97ece['name']+_0x092f('0x3d');}if(!isNotNull(_[_0x092f('0x41')](_0xa97ece[_0x092f('0x3e')][_0x092f('0x3f')]))){_0xa97ece['message']=_0x092f('0x40');throw _0xa97ece[_0x092f('0x3a')]+_0x092f('0x3d');}};}function msgResponse(_0x48dffa,_0x3d91d5,_0x3a842e){return{'action':_0x48dffa,'response':_0x3d91d5,'message':_0x3a842e,'stack':_0x3a842e};}function myreject(_0x1e1807){return function(_0x45447e){return _0x1e1807(msgResponse(_0x092f('0x42'),_0x092f('0x43'),JSON[_0x092f('0x44')](_0x45447e)));};}function getSeconds(_0x3bb841,_0x59f95f){var _0x47fb26=moment(_0x3bb841)[_0x092f('0x45')](0x0);var _0x4c5224=moment(_0x59f95f)[_0x092f('0x45')](0x0);return _0x47fb26[_0x092f('0x46')](_0x4c5224,_0x092f('0x47'));}function emit(_0x284017,_0x109b29,_0x3eabb9){io['to'](_0x284017)['emit'](_0x109b29,_0x3eabb9);}function emitVoiceQueueSummary(_0x17944a){if(_0x17944a[_0x092f('0x48')]===_0x092f('0x49')){var _0x42f3a0={'id':_0x17944a['id'],'name':_0x17944a[_0x092f('0x3a')],'strategy':_0x17944a[_0x092f('0x4a')],'answered':_0x17944a[_0x092f('0x4b')],'available':_0x17944a[_0x092f('0x4c')],'loggedIn':_0x17944a[_0x092f('0x4d')],'pTalking':_0x17944a[_0x092f('0x4e')],'sumBillable':_0x17944a['sumBillable'],'sumDuration':_0x17944a[_0x092f('0x4f')],'sumHoldTime':_0x17944a['sumHoldTime']||0x0,'talking':_0x17944a['talking'],'total':_0x17944a['total'],'type':_0x17944a[_0x092f('0x48')],'unmanaged':_0x17944a[_0x092f('0x50')],'abandoned':_0x17944a[_0x092f('0x51')],'waiting':_0x17944a[_0x092f('0x52')],'loggedInDb':_0x17944a[_0x092f('0x53')],'dialActive':_0x17944a[_0x092f('0x54')],'dialMethod':_0x17944a[_0x092f('0x55')],'dialOriginateCallerIdName':_0x17944a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x17944a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x17944a[_0x092f('0x56')],'dialPrefix':_0x17944a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x17944a[_0x092f('0x57')],'outboundAnswerCallsDay':_0x17944a[_0x092f('0x58')],'outboundBlacklistCallsDay':_0x17944a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x17944a[_0x092f('0x59')],'outboundCongestionCallsDay':_0x17944a[_0x092f('0x5a')],'outboundDropCallsDayACS':_0x17944a[_0x092f('0x5b')],'outboundDropCallsDayCallersExit':_0x17944a[_0x092f('0x5c')],'outboundDropCallsDayTimeout':_0x17944a[_0x092f('0x5d')],'outboundNoAnswerCallsDay':_0x17944a[_0x092f('0x5e')],'outboundNoSuchCallsDay':_0x17944a[_0x092f('0x5f')],'outboundOriginateFailureCallsDay':_0x17944a[_0x092f('0x60')],'outboundReCallsDay':_0x17944a['outboundReCallsDay'],'outboundRejectCallsDay':_0x17944a[_0x092f('0x61')],'outboundUnknownCallsDay':_0x17944a[_0x092f('0x62')],'predictiveIntervalAnsweredCalls':_0x17944a[_0x092f('0x63')],'predictiveIntervalAvgHoldtime':_0x17944a[_0x092f('0x64')],'predictiveIntervalAvgTalktime':_0x17944a[_0x092f('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x17944a[_0x092f('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x17944a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x17944a[_0x092f('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x17944a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x17944a[_0x092f('0x68')],'predictiveIntervalMultiplicativeFactor':_0x17944a[_0x092f('0x69')],'predictiveIntervalPauses':_0x17944a[_0x092f('0x6a')],'predictiveIntervalAvailable':_0x17944a[_0x092f('0x6b')],'predictiveIntervalTotalCalls':_0x17944a[_0x092f('0x6c')],'message':_0x17944a['message'],'originated':_0x17944a[_0x092f('0x6d')],'erlangCalls':_0x17944a['erlangCalls'],'erlangCallToSecond':_0x17944a[_0x092f('0x6e')],'erlangAbandonmentRate':_0x17944a[_0x092f('0x6f')],'erlangBusyFactor':_0x17944a[_0x092f('0x70')],'startPredictive':_0x17944a[_0x092f('0x71')],'startProgressive':_0x17944a['startProgressive']};if(_0x17944a['Trunk']){_0x42f3a0[_0x092f('0x72')]={'id':_0x17944a['Trunk']['id'],'name':_0x17944a[_0x092f('0x72')][_0x092f('0x3a')],'active':_0x17944a['Trunk'][_0x092f('0x73')],'callerid':_0x17944a[_0x092f('0x72')][_0x092f('0x74')]};}if(_0x17944a[_0x092f('0x3e')]){_0x42f3a0[_0x092f('0x3e')]={'id':_0x17944a[_0x092f('0x3e')]['id'],'name':_0x17944a['Interval'][_0x092f('0x3a')]};}var _0xaf3701=md5(JSON[_0x092f('0x44')](_0x42f3a0));if(_0x17944a[_0x092f('0x3')]!==_0xaf3701){_0x17944a[_0x092f('0x3')]=_0xaf3701;emit(util['format']('voice:queue:%s',_0x42f3a0[_0x092f('0x3a')]),_0x092f('0x75'),_0x42f3a0);}}}function emitCampaignSummary(_0x371447){if(_0x371447['type']===_0x092f('0x76')){emit(util[_0x092f('0x77')](_0x092f('0x78'),_0x371447[_0x092f('0x3a')]),_0x092f('0x79'),_0x371447);}}function checkGetDataPredictive(_0x35c4fc){if(isNotNull(_0x35c4fc)&&!_[_0x092f('0x41')](_0x35c4fc)){loggerPredictive['info'](_0x092f('0x7a'));loggerPredictive[_0x092f('0x7b')](_0x092f('0x7c'),_0x35c4fc[_0x092f('0x6c')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x7d'),_0x35c4fc[_0x092f('0x63')]);loggerPredictive['info'](_0x092f('0x7e'),_0x35c4fc[_0x092f('0x7f')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x80'),_0x35c4fc['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x092f('0x7b')](_0x092f('0x81'),_0x35c4fc['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x092f('0x7b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35c4fc[_0x092f('0x65')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x82'));if(_0x35c4fc['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x35c4fc[_0x092f('0x65')])&&_0x35c4fc[_0x092f('0x65')]>0x0){return!![];}loggerPredictive[_0x092f('0x7b')](_0x092f('0x83'));if(!_[_0x092f('0x37')](_0x35c4fc[_0x092f('0x64')])&&_0x35c4fc['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x092f('0x7b')](_0x092f('0x84'));}else{loggerPredictive[_0x092f('0x7b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x092f('0x85'));}return![];}function mergeDataErlangB(_0x5ca4b1){return function(_0x91e846){loggerPredictive[_0x092f('0x7b')](_0x092f('0x86'));loggerPredictive[_0x092f('0x7b')](_0x092f('0x87'),_0x91e846[_0x092f('0x88')]);loggerPredictive['info'](_0x092f('0x89'),_0x91e846[_0x092f('0x6e')]);loggerPredictive[_0x092f('0x7b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x91e846[_0x092f('0x6f')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x91e846['erlangBusyFactor']);loggerPredictive[_0x092f('0x7b')](_0x092f('0x8a'),_0x91e846[_0x092f('0x6f')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x82'));_[_0x092f('0x8b')](_0x5ca4b1,_0x91e846);};}function getDiff(_0x2e5c5f){var _0x4021f5=moment()['milliseconds'](0x0);var _0x42a6db=moment(_0x2e5c5f)[_0x092f('0x45')](0x0);return _0x4021f5[_0x092f('0x46')](_0x42a6db,_0x092f('0x47'));}function ifInterval(_0x4f9c84,_0x17127b){if(_[_0x092f('0x37')](_0x17127b)){return![];}return getDiff(_0x17127b)<_0x4f9c84*0x3c;}function freeVariablesPredictive(_0x40131e){if(isNotNull(_0x40131e)){if(!_[_0x092f('0x37')](_0x40131e[_0x092f('0x24')])){_0x40131e['startProgressive']=undefined;loggerPredictive[_0x092f('0x7b')](_0x40131e[_0x092f('0x3a')],_0x092f('0x8c'));}if(!_[_0x092f('0x37')](_0x40131e[_0x092f('0x71')])){_0x40131e[_0x092f('0x71')]=undefined;loggerPredictive['info'](_0x40131e[_0x092f('0x3a')],_0x092f('0x8d'));}if(!_[_0x092f('0x37')](_0x40131e[_0x092f('0x8e')])){clearInterval(_0x40131e['handlePredictive']);_0x40131e[_0x092f('0x8e')]=undefined;loggerPredictive[_0x092f('0x7b')](_0x40131e[_0x092f('0x3a')],_0x092f('0x8f'));}}}function erlangb(_0x33ca63,_0x36c29a){if(_0x36c29a===0x0){return 0x0;}var _0x5ebfcb=0x1;for(var _0x44ed91=0x1;_0x44ed91<=_0x36c29a;_0x44ed91+=0x1){_0x5ebfcb=0x1+_0x5ebfcb*_0x44ed91/_0x33ca63;}return 0x1/_0x5ebfcb;}function isVoiceQueueOutbound(_0x521f83){return _0x521f83===_0x092f('0x49');}function isNotPreview(_0x95a2ed){return _0x95a2ed!=='preview';}function isCampaignIvr(_0xe59cf6){return _0xe59cf6==='ivr';}function getCallerId(_0x2ba911,_0x16c622,_0x1d9245){if(!_[_0x092f('0x37')](_0x1d9245)&&typeof _0x1d9245===_0x092f('0x90')&&!_[_0x092f('0x41')](_0x1d9245)){if(!_[_0x092f('0x37')](_0x16c622)&&typeof _0x16c622===_0x092f('0x90')&&!_['isEmpty'](_0x16c622)){return util[_0x092f('0x77')](_0x092f('0x91'),_0x16c622,_0x1d9245);}return util[_0x092f('0x77')](_0x092f('0x91'),_0x1d9245,_0x1d9245);}if(!_['isUndefined'](_0x2ba911)&&typeof _0x2ba911==='string'&&!_[_0x092f('0x41')](_0x2ba911)){return _0x2ba911;}return _0x092f('0x92');}function loggerCatchQueueSummary(_0x137f00,_0x1d00ee){return function(_0x43a0a8){freeVariablesPredictive(_0x1d00ee);emitVoiceQueueSummary(_0x1d00ee);emitCampaignSummary(_0x1d00ee);loggerSyncQueueSummary[_0x092f('0x93')](_0x137f00,util[_0x092f('0x94')](_0x43a0a8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x59ca53,_0x2cf40e){return function(_0x431ded){loggerPredictive[_0x092f('0x93')](_0x2cf40e[_0x092f('0x3a')],_0x59ca53);loggerPredictive[_0x092f('0x93')](_0x431ded[_0x092f('0x95')]);freeVariablesPredictive(_0x2cf40e);};}function loggerCatch(_0x51d0af){return function(_0x418cd2){logger['error'](_0x51d0af,util[_0x092f('0x94')](_0x418cd2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1dfe53){return _0x1dfe53&&!_['isUndefined'](_0x1dfe53)&&_0x1dfe53[_0x092f('0x96')]>0x0;}function decremetOriginate(_0x413a27){if(!_[_0x092f('0x37')](_0x413a27)&&_0x413a27!==null){if(typeof _0x413a27[_0x092f('0x6d')]!=='undefined'){if(_0x413a27['originated']>0x0){_0x413a27[_0x092f('0x6d')]-=0x1;}else{logger[_0x092f('0x93')](_0x092f('0x97'));}}}else{logger['error'](_0x092f('0x98'));}}function checkContactLowerLimitOriginate(_0xebb2be,_0x2dddc8,_0x25166c){if(_0x2dddc8>_0x25166c){for(var _0x1d1777=0x0;_0x1d1777<_0x2dddc8-_0x25166c;_0x1d1777+=0x1){decremetOriginate(_0xebb2be);}}}function loggerGetContactDialer(_0x36f7db,_0x7c2c23,_0x7c476){return function(_0x5d8a5a){checkContactLowerLimitOriginate(_0x7c2c23,_0x7c476,0x0);logger[_0x092f('0x93')](_0x36f7db,util[_0x092f('0x94')](_0x5d8a5a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x17b629){return function(_0x187408){if(isNotNull(_0x187408)&&isNotNull(_0x187408[0x0])){if(_0x187408[0x0][_0x092f('0x99')]>0x0){_0x17b629[_0x092f('0x38')]='RESCHEDULED_CONTACTS';logger[_0x092f('0x7b')](_0x092f('0x9a')+_0x17b629[_0x092f('0x3a')],_0x187408[0x0]['contactsRescheduled'],_0x092f('0x9b'));}else{_0x17b629['message']=_0x092f('0x9c');logger[_0x092f('0x7b')](_0x092f('0x9d')+_0x17b629['name']);}}};}function notSendMessagesQueue(_0x2644d3){if(_0x2644d3[_0x092f('0x9e')]){freeVariablesPredictive(_0x2644d3);if(_0x2644d3['originated']===0x0&&_0x2644d3[_0x092f('0x9f')]===0x0&&_0x2644d3['waiting']===0x0&&(_0x2644d3[_0x092f('0x4e')]||0x0)===0x0){_0x2644d3['sendMessageOneNotActive']=![];_0x2644d3[_0x092f('0x4c')]=0x0;_0x2644d3['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x092f('0x93')](_0x092f('0xa0'),_0x2644d3['name'],_0x092f('0xa1'));}else{_0x2644d3[_0x092f('0x38')]=_0x092f('0xa2');loggerSyncQueueSummary[_0x092f('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2644d3[_0x092f('0x3a')],_0x092f('0xa3'));}emitVoiceQueueSummary(_0x2644d3);}}function notSendMessagesCampaign(_0x4444d5){if(_0x4444d5['sendMessageOneNotActive']){if(_0x4444d5['originated']===0x0){_0x4444d5[_0x092f('0x9e')]=![];_0x4444d5[_0x092f('0x38')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x092f('0x93')](_0x092f('0xa4'),_0x4444d5[_0x092f('0x3a')],_0x092f('0xa1'));}else{_0x4444d5[_0x092f('0x38')]=_0x092f('0xa2');loggerSyncQueueSummary[_0x092f('0x93')](_0x092f('0xa4'),_0x4444d5[_0x092f('0x3a')],_0x092f('0xa3'));}emitCampaignSummary(_0x4444d5);}}function createObjHistory(_0x5d92ca,_0x4d6808,_0x11b83f,_0x23e69a,_0x56aac9){_0x5d92ca[_0x092f('0x38')]=_0x11b83f;var _0x2035cf=new Action(_0x5d92ca,_0x4d6808);var _0x134a19=new History(_0x2035cf);_0x134a19[_0x092f('0xa5')]=_0x23e69a;_0x134a19[_0x092f('0xa6')]=_0x56aac9;_0x134a19[_0x092f('0xa7')]=_0x2035cf[_0x092f('0xa8')];return _0x134a19;}Dialer[_0x092f('0x19')][_0x092f('0x36')]=function(){var _0x395398=this;setInterval(function(){_0x395398[_0x092f('0xa9')](_0x395398[_0x092f('0xaa')],_0x092f('0xab'));_0x395398[_0x092f('0xa9')](_0x395398[_0x092f('0xac')],_0x092f('0xad'));},0x32c8);};Dialer[_0x092f('0x19')][_0x092f('0xa9')]=function(_0x5a24a5,_0x27fb48){var _0x45a82a=this;for(var _0x4e26f0 in _0x5a24a5){if(typeof _0x5a24a5[_0x4e26f0]!==_0x092f('0xae')){this['sequence'][_0x092f('0x1a')](function(){if(!_[_0x092f('0xaf')](_0x5a24a5[_0x4e26f0])){return ami[_0x092f('0xb0')]({'action':'status','channel':_0x5a24a5[_0x4e26f0][_0x092f('0xb1')]})[_0x092f('0xb2')](function(_0xb2f768){if(_0xb2f768[_0x092f('0x38')]===_0x092f('0xb3')){setTimeout(function(){if(_0x5a24a5[_0x4e26f0]&&_0x5a24a5[_0x4e26f0][_0x092f('0x48')]!==_0x092f('0x76')){_0x45a82a['updateOriginated'](_0x45a82a['voiceQueues'][_0x5a24a5[_0x4e26f0][_0x092f('0xb4')]]);logger[_0x092f('0x93')](_0x092f('0xb5'),_0x27fb48,_0x4e26f0,_0x5a24a5[_0x4e26f0][_0x092f('0xb4')]);delete _0x5a24a5[_0x4e26f0];}if(_0x5a24a5[_0x4e26f0]&&_0x5a24a5[_0x4e26f0][_0x092f('0x48')]==='ivr'){_0x45a82a[_0x092f('0xb6')](_0x45a82a['campaigns'][_0x5a24a5[_0x4e26f0][_0x092f('0xb4')]]);logger[_0x092f('0x93')](_0x092f('0xb7'),_0x27fb48,_0x4e26f0,_0x5a24a5[_0x4e26f0]['queue']);delete _0x5a24a5[_0x4e26f0];}},0x2328);}});}});}}};Dialer[_0x092f('0x19')]['countReScheduled']=function(_0x41cd7c){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xba')](_0x41cd7c))[_0x092f('0xb2')](loggerCatch(_0x092f('0xbb')));};Dialer['prototype'][_0x092f('0xbc')]=function(_0xc8c742){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopperBlack[_0x092f('0xbc')](_0xc8c742))[_0x092f('0xb2')](loggerCatch(_0x092f('0xbd')));};Dialer['prototype'][_0x092f('0xbe')]=function(_0x21df78){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopperBlack[_0x092f('0xbe')](_0x21df78))[_0x092f('0xb2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x092f('0x19')][_0x092f('0xbf')]=function(_0x32f3cc){return BPromise[_0x092f('0xb8')]()['then'](cmHopperHistory['avgHandleTime'](_0x32f3cc))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc0')));};Dialer['prototype'][_0x092f('0xc1')]=function(_0x210a54){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper['rescheduleContact'](_0x210a54))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc2')));};Dialer[_0x092f('0x19')][_0x092f('0xc3')]=function(_0x3522e5,_0x48b2ae,_0x1b28ae){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xc3')](_0x3522e5,_0x48b2ae,_0x1b28ae))['catch'](loggerCatch(_0x092f('0xc4')));};Dialer[_0x092f('0x19')][_0x092f('0xc5')]=function(_0x1cb222,_0x3aa983,_0x30f2f7,_0x2e70e8){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper['getContactDialer'](_0x1cb222,_0x3aa983,_0x30f2f7,_0x2e70e8))[_0x092f('0xb2')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x092f('0x19')][_0x092f('0xc6')]=function(_0xd1f050,_0xeee83e,_0x126e15){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xc6')](_0xd1f050,_0xeee83e,_0x126e15))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc7')));};Dialer['prototype'][_0x092f('0xc8')]=function(_0x16a22a){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](voiceQueueRt[_0x092f('0xc8')](_0x16a22a))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc9')));};Dialer[_0x092f('0x19')][_0x092f('0xca')]=function(_0x4f35e5){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xca')](_0x4f35e5))[_0x092f('0xb2')](loggerCatch(_0x092f('0xcb')));};Dialer[_0x092f('0x19')][_0x092f('0xcc')]=function(_0x5e8f09){return BPromise[_0x092f('0xb8')]()['then'](cmHopperHistory[_0x092f('0xcc')](_0x5e8f09))['catch'](loggerCatch(_0x092f('0xcd')));};Dialer[_0x092f('0x19')][_0x092f('0xb6')]=function(_0x7c9cad){if(!_['isUndefined'](_0x7c9cad)&&_0x7c9cad!==null){if(typeof _0x7c9cad[_0x092f('0x6d')]!=='undefined'){if(_0x7c9cad[_0x092f('0x6d')]>0x0){_0x7c9cad[_0x092f('0x6d')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x092f('0xce'));}};Dialer[_0x092f('0x19')]['loggerHandler']=function(_0x41bef0,_0x59c1ab){var _0xc700bf=this;return function(_0x5c6c2d){_0xc700bf[_0x092f('0xb6')](_0x59c1ab);logger[_0x092f('0x93')](_0x41bef0,util[_0x092f('0x94')](_0x5c6c2d,{'showHidden':![],'depth':null}));};};Dialer[_0x092f('0x19')][_0x092f('0xcf')]=function(_0x7e12d7,_0x3eef70,_0x489649){var _0x542853={'state':0x19,'statedesc':'notFound'};this[_0x092f('0xb6')](_0x3eef70);this['saveInDb'](_['merge'](_0x542853,_[_0x092f('0xd0')](_0x489649,[_0x092f('0xd1'),_0x092f('0xd2'),_0x092f('0xd3'),_0x092f('0xd4'),_0x092f('0xd5')])),_0x092f('0xd6'),_0x092f('0xd7'));logger['error'](_0x7e12d7);};Dialer[_0x092f('0x19')]['isSuccess']=function(_0x3f257d){return _0x3f257d===_0x092f('0xd8');};Dialer[_0x092f('0x19')][_0x092f('0xd9')]=function(_0x58634f){return!_[_0x092f('0x37')](_0x58634f)&&_0x58634f&&!_[_0x092f('0x37')](_0x58634f['name'])&&!_[_0x092f('0x37')](_0x58634f['active'])&&_0x58634f[_0x092f('0x73')]&&(this[_0x092f('0x20')][util[_0x092f('0x77')](_0x092f('0xda'),_0x58634f[_0x092f('0x3a')])][_0x092f('0xdb')]===_0x092f('0xdc')||this['trunks'][util['format'](_0x092f('0xda'),_0x58634f[_0x092f('0x3a')])][_0x092f('0xdb')]===_0x092f('0xdd'));};Dialer[_0x092f('0x19')]['saveInDb']=function(_0xd7e8ee,_0x28c06b,_0x31e9be){this[_0x092f('0xcc')](_0xd7e8ee)[_0x092f('0xb2')](loggerCatch(_0x28c06b));this[_0x092f('0xca')](_0xd7e8ee)[_0x092f('0xb2')](loggerCatch(_0x31e9be));};Dialer['prototype']['syncVarSet']=function(_0x2ad31d){var _0x15bc35=this[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];var _0x207823;if(!_[_0x092f('0xaf')](_0x2ad31d)&&!_['isNil'](_0x2ad31d[_0x092f('0xdf')])&&!_[_0x092f('0xaf')](_0x2ad31d[_0x092f('0xdf')]['amdstatus'])&&_0x2ad31d[_0x092f('0xe0')]===_0x092f('0xe1')&&_0x15bc35){if(_0x15bc35[_0x092f('0x48')]!==_0x092f('0x76')&&this['voiceQueues'][_0x15bc35[_0x092f('0xb4')]][_0x092f('0xe2')]&&_0x2ad31d[_0x092f('0xe3')]==='HANGUP'){delete this[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];this['updateOriginated'](this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]]);this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x57')]+=0x1;_0x207823=new Hangup(_0x15bc35,_0x2ad31d);_0x207823[_0x092f('0xa5')]=0x12;_0x207823[_0x092f('0xa6')]=_0x092f('0xe4');_0x207823[_0x092f('0xe5')]=_0x092f('0xe6');this[_0x092f('0xe7')](_0x207823,_0x092f('0xe8'),'[syncHangupInAMD]');}if(_0x15bc35[_0x092f('0x48')]!==_0x092f('0x76')&&this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]]['dialAMDActive']&&_0x2ad31d['value']===_0x092f('0xe9')){var _0xeab3de=this;return new BPromise(function(_0xde2428,_0x84f56f){delete _0xeab3de[_0x092f('0xaa')][_0x2ad31d['uniqueid']];_0xeab3de['updateOriginated'](_0xeab3de['voiceQueues'][_0x15bc35['queue']]);_0xeab3de[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;_0xeab3de[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x57')]+=0x1;var _0x95a9c2=_0xeab3de[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]];var _0x2a87cc=new Hangup(_0x15bc35,_0x2ad31d);_0x2a87cc[_0x092f('0xa5')]=0x13;_0x2a87cc[_0x092f('0xa6')]=_0x092f('0xea');_0x2a87cc['membername']=_0x092f('0xe6');_0x2a87cc[_0x092f('0xeb')]+=0x1;_0x2a87cc[_0x092f('0xec')]+=0x1;_0x2a87cc[_0x092f('0xed')]=!![];_0xeab3de['createHistory'](_0x2a87cc)[_0x092f('0xb2')](loggerCatch(_0x092f('0xee')));if(_0x2a87cc[_0x092f('0xef')]+_0x2a87cc[_0x092f('0xf0')]+_0x2a87cc[_0x092f('0xf1')]+_0x2a87cc[_0x092f('0xf2')]+_0x2a87cc[_0x092f('0xf3')]+_0x2a87cc[_0x092f('0xf4')]+_0x2a87cc['countmachineretry']+_0x2a87cc[_0x092f('0xf5')]>=_0x95a9c2['dialGlobalMaxRetry']){_0xeab3de[_0x092f('0xf6')](_0x2a87cc,_0xde2428,_0x84f56f,_0x092f('0xf7'));}else{if(_0x2a87cc[_0x092f('0xeb')]>=_0x95a9c2[_0x092f('0xf8')]){_0xeab3de[_0x092f('0xf9')](_0x2a87cc,_0xde2428,_0x84f56f,_0x092f('0xfa'));}else{_0xeab3de[_0x092f('0xc1')]({'active':![],'countmachineretry':_0x2a87cc[_0x092f('0xeb')],'scheduledat':moment()[_0x092f('0xfb')](_0x95a9c2[_0x092f('0xfc')],_0x092f('0xfd'))['format'](_0x092f('0xfe')),'ContactId':_0x2a87cc[_0x092f('0xd1')],'ListId':_0x2a87cc['ListId'],'VoiceQueueId':_0x2a87cc[_0x092f('0xd4')]||undefined,'CampaignId':_0x2a87cc[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0xff')));_0xde2428({'reschedule':0x1});}}});}if(_0x15bc35[_0x092f('0x48')]===_0x092f('0x76')&&this[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0xe2')]&&_0x2ad31d['value']==='HANGUP'){delete this[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]]);_0x207823=new Hangup(_0x15bc35,_0x2ad31d);_0x207823[_0x092f('0xa5')]=0x12;_0x207823[_0x092f('0xa6')]=_0x092f('0xe4');_0x207823[_0x092f('0xe5')]=_0x092f('0xe6');this['saveInDb'](_0x207823,_0x092f('0x100'),_0x092f('0x101'));}if(_0x15bc35['type']==='ivr'&&this[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]]['dialAMDActive']&&_0x2ad31d[_0x092f('0xe3')]==='MACHINE'){var _0xeab3de=this;return new BPromise(function(_0x5c8fb3,_0x28da24){delete _0xeab3de[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];_0xeab3de[_0x092f('0xb6')](_0xeab3de[_0x092f('0x1f')][_0x15bc35['queue']]);_0xeab3de[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;_0xeab3de[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5425d6=_0xeab3de[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]];var _0x593002=new Hangup(_0x15bc35,_0x2ad31d);_0x593002[_0x092f('0xa5')]=0x13;_0x593002[_0x092f('0xa6')]=_0x092f('0xea');_0x593002['membername']=_0x092f('0xe6');_0x593002[_0x092f('0xeb')]+=0x1;_0x593002[_0x092f('0xec')]+=0x1;_0x593002[_0x092f('0xed')]=!![];_0xeab3de[_0x092f('0xcc')](_0x593002)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x593002[_0x092f('0xef')]+_0x593002[_0x092f('0xf0')]+_0x593002[_0x092f('0xf1')]+_0x593002[_0x092f('0xf2')]+_0x593002[_0x092f('0xf3')]+_0x593002[_0x092f('0xf4')]+_0x593002[_0x092f('0xeb')]+_0x593002[_0x092f('0xf5')]>=_0x5425d6[_0x092f('0x102')]){_0xeab3de[_0x092f('0xf6')](_0x593002,_0x5c8fb3,_0x28da24,_0x092f('0xf7'));}else{if(_0x593002[_0x092f('0xeb')]>=_0x5425d6['dialMachineMaxRetry']){_0xeab3de[_0x092f('0xf9')](_0x593002,_0x5c8fb3,_0x28da24,'reason\x2019\x20machine....');}else{_0xeab3de['rescheduleContact']({'active':![],'countmachineretry':_0x593002[_0x092f('0xeb')],'scheduledat':moment()['add'](_0x5425d6[_0x092f('0xfc')],'minutes')[_0x092f('0x77')](_0x092f('0xfe')),'ContactId':_0x593002['ContactId'],'ListId':_0x593002['ListId'],'VoiceQueueId':_0x593002[_0x092f('0xd4')]||undefined,'CampaignId':_0x593002[_0x092f('0xd5')]||undefined})['catch'](loggerCatch(_0x092f('0xff')));_0x5c8fb3({'reschedule':0x1});}}});}}};Dialer[_0x092f('0x19')]['syncHangup']=function(_0x1f9b0b){var _0xe2b021=this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];var _0x1032ba=this;var _0x52b845;if(_0xe2b021&&_0xe2b021['type']===_0x092f('0x76')){delete this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1f')][_0xe2b021[_0x092f('0xb4')]]);this['campaigns'][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x103')]+=0x1;_0x52b845=new Hangup(_0xe2b021,_0x1f9b0b);this[_0x092f('0xcc')](_0x52b845)['catch'](loggerCatch(_0x092f('0x104')));this[_0x092f('0xca')](_0x52b845)[_0x092f('0xb2')](loggerCatch(_0x092f('0x105')));}if(_0xe2b021&&_0xe2b021[_0x092f('0x48')]!==_0x092f('0x76')&&isNotNull(this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]]['dialQueueProject'])){delete this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]]);this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;this['voiceQueues'][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x57')]+=0x1;_0x52b845=new Hangup(_0xe2b021,_0x1f9b0b);_0x52b845['state']=0x10;_0x52b845['statedesc']=_0x092f('0x106');_0x52b845[_0x092f('0xe5')]=_0x092f('0x107');this['createHistory'](_0x52b845)['catch'](loggerCatch(_0x092f('0x104')));this[_0x092f('0xca')](_0x52b845)[_0x092f('0xb2')](loggerCatch(_0x092f('0x105')));}if(_0xe2b021&&_0xe2b021['type']!==_0x092f('0x76')&&!isNotNull(this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x108')])){delete this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]]);this['voiceQueues'][_0xe2b021[_0x092f('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x52b845=new Hangup(_0xe2b021,_0x1f9b0b);_0x52b845['state']=0xc;_0x52b845[_0x092f('0xa6')]=_0x1f9b0b[_0x092f('0x109')];_0x52b845[_0x092f('0xe5')]=_0x092f('0x10a');this[_0x092f('0xcc')](_0x52b845)[_0x092f('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x092f('0xca')](_0x52b845)['catch'](loggerCatch(_0x092f('0x105')));}};Dialer[_0x092f('0x19')][_0x092f('0x2d')]=function(_0x39cf31){var _0x26aa65=this['uniqueId'][_0x39cf31[_0x092f('0xde')]];var _0x1f0d7d=this;if(this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]]){if(_0x26aa65&&_0x26aa65[_0x092f('0x48')]!=='ivr'){delete this[_0x092f('0xaa')][_0x39cf31[_0x092f('0xde')]];this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;var _0x392677=new AgentComplete(_0x26aa65,_0x39cf31);if(_0x39cf31['reason']===_0x092f('0x10b')){_0x392677[_0x092f('0x10c')]=this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]][_0x092f('0x10d')]&&this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]][_0x092f('0x10e')]?moment()[_0x092f('0x77')](_0x092f('0xfe')):undefined;}this[_0x092f('0xcc')](_0x392677)[_0x092f('0xb2')](loggerCatch(_0x092f('0x10f')));this[_0x092f('0xca')](_0x392677)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x092f('0x27')]=function(_0xb9f849){if(this[_0x092f('0x1e')][_0xb9f849[_0x092f('0xb4')]]){if(this[_0x092f('0xaa')][_0xb9f849[_0x092f('0xde')]]&&this[_0x092f('0xaa')][_0xb9f849['uniqueid']][_0x092f('0x48')]!==_0x092f('0x76')){this[_0x092f('0xb6')](this['voiceQueues'][_0xb9f849[_0x092f('0xb4')]]);this[_0x092f('0xaa')][_0xb9f849['uniqueid']][_0x092f('0x110')]=moment()['format'](_0x092f('0xfe'));}}};Dialer[_0x092f('0x19')][_0x092f('0x111')]=function(_0x58aeba){this['createHistory'](_0x58aeba)[_0x092f('0xb2')](loggerCatch(_0x092f('0x10f')));this['moveContactManagedDialer'](_0x58aeba)[_0x092f('0xb2')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x092f('0x19')]['syncQueueCallerAbandon']=function(_0x358d49){var _0x3398b4=this[_0x092f('0xaa')][_0x358d49[_0x092f('0xde')]];var _0x1ce8e6=this;if(this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]]){if(_0x3398b4&&_0x3398b4['type']!==_0x092f('0x76')){delete this[_0x092f('0xaa')][_0x358d49[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]]);_0x3398b4[_0x092f('0x112')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));var _0x45f497=new QueueCallerAbandon(_0x3398b4,_0x358d49);if(getSeconds(_0x3398b4[_0x092f('0x112')],_0x3398b4['responsetime'])>=_0x3398b4[_0x092f('0x113')]){this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x7f')]+=0x1;this['voiceQueues'][_0x358d49[_0x092f('0xb4')]][_0x092f('0x5d')]+=0x1;this[_0x092f('0x1e')][_0x358d49['queue']][_0x092f('0x114')]+=0x1;_0x45f497[_0x092f('0xa5')]=0xa;_0x45f497[_0x092f('0xa6')]='Drop';_0x45f497[_0x092f('0x115')]=_0x092f('0x116');_0x45f497[_0x092f('0x10c')]=this['voiceQueues'][_0x358d49[_0x092f('0xb4')]]['dialQueueProject2']?moment()[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x45f497['countdropretry']+=0x1;_0x45f497['countglobal']+=0x1;if(_0x45f497[_0x092f('0xf3')]>=this[_0x092f('0x1e')][_0x358d49['queue']]['dialDropMaxRetry']){this[_0x092f('0x111')](_0x45f497);}else{this[_0x092f('0xc1')]({'active':![],'countdropretry':_0x45f497[_0x092f('0xf3')],'scheduledat':moment()[_0x092f('0xfb')](this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x117')],_0x092f('0xfd'))[_0x092f('0x77')](_0x092f('0xfe')),'ContactId':_0x3398b4[_0x092f('0xd1')],'ListId':_0x3398b4['ListId'],'VoiceQueueId':_0x3398b4[_0x092f('0xd4')]||undefined,'CampaignId':_0x3398b4[_0x092f('0xd5')]||undefined})['catch'](loggerCatch(_0x092f('0x118')));var _0x2bbd30=new History(_0x45f497);_0x2bbd30['state']=0xa;_0x2bbd30['statedesc']=_0x092f('0x119');_0x2bbd30['starttime']=moment()[_0x092f('0x77')](_0x092f('0xfe'));_0x2bbd30['endtime']=_0x2bbd30[_0x092f('0xa8')];_0x2bbd30['calleridname']=_0x45f497[_0x092f('0x11a')];_0x2bbd30[_0x092f('0x11b')]=_0x45f497[_0x092f('0x11b')];this[_0x092f('0xcc')](_0x2bbd30)[_0x092f('0xb2')](loggerCatch(_0x092f('0x11c')));}}else{this['voiceQueues'][_0x358d49[_0x092f('0xb4')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x358d49['queue']][_0x092f('0x5c')]+=0x1;_0x45f497[_0x092f('0xa5')]=0xb;_0x45f497[_0x092f('0xa6')]=_0x092f('0x11d');_0x45f497['dropreason']=_0x092f('0x11e');_0x45f497['countabandonedretry']+=0x1;_0x45f497[_0x092f('0xec')]+=0x1;if(_0x45f497[_0x092f('0xf4')]>=this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x11f')]){this[_0x092f('0x111')](_0x45f497);}else{this[_0x092f('0xc1')]({'active':![],'countabandonedretry':_0x45f497[_0x092f('0xf4')],'scheduledat':moment()[_0x092f('0xfb')](this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x120')],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3398b4[_0x092f('0xd1')],'ListId':_0x3398b4[_0x092f('0xd2')],'VoiceQueueId':_0x3398b4[_0x092f('0xd4')]||undefined,'CampaignId':_0x3398b4['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2bbd30=new History(_0x45f497);_0x2bbd30[_0x092f('0xa5')]=0xb;_0x2bbd30[_0x092f('0xa6')]='Abandoned';_0x2bbd30[_0x092f('0xa8')]=moment()[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bbd30[_0x092f('0xa7')]=_0x2bbd30['starttime'];_0x2bbd30[_0x092f('0x11a')]=_0x45f497[_0x092f('0x11a')];_0x2bbd30['calleridnum']=_0x45f497['calleridnum'];this[_0x092f('0xcc')](_0x2bbd30)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x092f('0x19')][_0x092f('0x121')]=function(_0x52dcfa){if(this[_0x092f('0xac')][_0x52dcfa[_0x092f('0xde')]]){this['actions'][_0x52dcfa[_0x092f('0xde')]][_0x092f('0xb1')]=_0x52dcfa[_0x092f('0xb1')];}if(this[_0x092f('0xaa')][_0x52dcfa[_0x092f('0xde')]]){this[_0x092f('0xaa')][_0x52dcfa['uniqueid']][_0x092f('0xb1')]=_0x52dcfa[_0x092f('0xb1')];}};Dialer[_0x092f('0x19')]['syncQueueMember']=function(_0x988515){if(strategy[this['voiceQueues'][this['actions'][_0x988515['actionid']][_0x092f('0xb4')]][_0x092f('0x4a')]]===_0x092f('0x18')){if(this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]]&&_[_0x092f('0xaf')](this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0x123')])&&_0x988515[_0x092f('0xdb')]==='1'&&_0x988515[_0x092f('0x124')]==='0'){if(this[_0x092f('0x125')][_0x988515[_0x092f('0x126')]]){if(!this[_0x092f('0x125')][_0x988515[_0x092f('0x126')]]['locked']){this[_0x092f('0x125')][_0x988515['stateinterface']][_0x092f('0x123')]=!![];this['actions'][_0x988515[_0x092f('0x122')]][_0x092f('0x123')]=!![];this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0x126')]=_0x988515[_0x092f('0x126')];}}}}else if((strategy[this[_0x092f('0x1e')][this[_0x092f('0xac')][_0x988515['actionid']]['queue']][_0x092f('0x4a')]]||_0x092f('0x17'))===_0x092f('0x17')){if(this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]]){if(this['agents'][_0x988515[_0x092f('0x126')]]){this[_0x092f('0xac')][_0x988515['actionid']][_0x092f('0x126')]=_0x988515[_0x092f('0x126')];if(_['isNil'](this['queueBooked'][this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0xb4')]])){this[_0x092f('0x127')][this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0xb4')]]=[];}this[_0x092f('0x127')][this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]]['queue']][_0x092f('0x128')](_[_0x092f('0x8b')](_['pick'](this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]],[_0x092f('0x129'),'stateinterface']),{'status':_0x988515[_0x092f('0xdb')],'paused':_0x988515[_0x092f('0x124')]}));}}}};function unlockQueueStatus(_0x3f16ce,_0x542cf1){setTimeout(function(){if(_[_0x092f('0x37')](_0x3f16ce[_0x092f('0x12a')])){loggerBooked[_0x092f('0x93')](_0x092f('0x12b'),_0x542cf1);}_0x3f16ce['queueStatusComplete']=!![];loggerBooked[_0x092f('0x7b')](_0x092f('0x12c'),_0x542cf1,JSON['stringify'](_[_0x092f('0xd0')](_0x3f16ce,[_0x092f('0x3a'),_0x092f('0x12a')])));},0x1f3);}Dialer[_0x092f('0x19')][_0x092f('0x35')]=function(_0x16b051){var _0x576cba=this;var _0x1e318d=_0x576cba[_0x092f('0x1e')][_0x576cba[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]];if(strategy[this[_0x092f('0x1e')][this[_0x092f('0xac')][_0x16b051['actionid']][_0x092f('0xb4')]][_0x092f('0x4a')]]==='roundrobin'){if(this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]&&this['actions'][_0x16b051['actionid']][_0x092f('0x126')]){this['preview'][_0x092f('0x12d')](this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0x129')],this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0x126')])[_0x092f('0xb2')](function(_0x21fe67){logger[_0x092f('0x93')](_0x092f('0x12e'),util['inspect'](_0x21fe67,{'showHidden':![],'depth':null}));})[_0x092f('0x1c')](function(){_0x576cba[_0x092f('0xb6')](_0x576cba[_0x092f('0x1e')][_0x576cba['actions'][_0x16b051['actionid']]['queue']]);_0x576cba[_0x092f('0x125')][_0x576cba[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0x126')]][_0x092f('0x123')]=![];delete _0x576cba['actions'][_0x16b051['actionid']];unlockQueueStatus(_0x1e318d);});}else{this[_0x092f('0xb6')](this['voiceQueues'][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0x092f('0xac')][_0x16b051['actionid']]['ContactId'],'ListId':this['actions'][_0x16b051['actionid']][_0x092f('0xd2')],'VoiceQueueId':this['actions'][_0x16b051[_0x092f('0x122')]][_0x092f('0xd4')]||undefined,'CampaignId':this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x12f')));delete this[_0x092f('0xac')][_0x16b051['actionid']];unlockQueueStatus(_0x1e318d);}}else if((strategy[this[_0x092f('0x1e')][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]]['strategy']]||'rrmemory')===_0x092f('0x17')){var _0x7e12f6;if(this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]])){if(this[_0x092f('0x25')][_0x576cba[_0x092f('0xac')][_0x16b051['actionid']][_0x092f('0xb4')]]){this[_0x092f('0x25')][_0x576cba[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]]=this[_0x092f('0x25')][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]['queue']]?this[_0x092f('0x25')][this['actions'][_0x16b051['actionid']][_0x092f('0xb4')]]:this[_0x092f('0x127')][this[_0x092f('0xac')][_0x16b051['actionid']]['queue']]?this['queueBooked'][this['actions'][_0x16b051['actionid']][_0x092f('0xb4')]][_0x092f('0x130')]||0x0:0x0;}this[_0x092f('0x127')][this['actions'][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]]['_rr']=this['queueBookedRR'][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]];for(var _0x57ac7b=0x0;_0x57ac7b=0x0;})['catch'](myreject(_0x35b41e)));}}else{_0x8fbca5[_0x092f('0x128')](ami[_0x092f('0xb0')]({'action':'command','command':util['format'](_0x092f('0x14a'),_0xbd4c8f,!_[_0x092f('0x37')](config[_0x092f('0x141')][_0xcdcaca])?_0xcdcaca:'')})[_0x092f('0xb9')](function(_0x1e316e){return _0x1e316e['content']['indexOf']('true')>=0x0;})[_0x092f('0xb2')](myreject(_0x35b41e)));}BPromise[_0x092f('0x14b')](_0x8fbca5)[_0x092f('0xb9')](function(_0xb8f4ab){var _0x3831d9=_['some'](_0xb8f4ab);if(_0x3831d9){return _0x3143ee(_0x3831d9);}else{_0x1e6062[_0x092f('0x38')]=_0x64b9fc?'GLOBAL_INTERVAL_IS_OVERTIME':_0x092f('0x14c');return _0x35b41e(msgResponse('[ifTime][promiseAll]',_0x092f('0x13e'),_0x092f('0x14d')+_0x64b9fc+'\x20'+_0x38de89+'\x20Interval\x20is\x20overtime:\x20'+util[_0x092f('0x94')](_0xbd4c8f,{'showHidden':![],'depth':null})+_0x092f('0x14e')+_0xcdcaca));}})[_0x092f('0xb2')](function(_0x1d9a09){return _0x35b41e(msgResponse(_0x092f('0x13c'),'Failure',JSON[_0x092f('0x44')](_0x1d9a09)));});});};Dialer[_0x092f('0x19')][_0x092f('0x14f')]=function(_0x788eab){var _0x4f2e4a=this;return function(){switch(_0x788eab[_0x092f('0x55')]){case _0x092f('0x150'):freeVariablesPredictive(_0x788eab);_0x4f2e4a[_0x092f('0x151')](_0x788eab,0x1);break;case'power':freeVariablesPredictive(_0x788eab);_0x4f2e4a[_0x092f('0x151')](_0x788eab,_0x788eab[_0x092f('0x152')]);break;case'predictive':_0x4f2e4a[_0x092f('0x153')](_0x788eab);break;case _0x092f('0x7'):freeVariablesPredictive(_0x788eab);_0x4f2e4a[_0x092f('0x151')](_0x788eab,0x1);break;default:freeVariablesPredictive(_0x788eab);logger['error'](_0x092f('0x154'),_0x788eab[_0x092f('0x3a')],'method\x20not\x20recognized');}};};Dialer[_0x092f('0x19')]['launchHandleIvr']=function(_0x17f077){var _0x36a0eb=this;return function(){_0x36a0eb[_0x092f('0x155')](_0x17f077);};};Dialer[_0x092f('0x19')][_0x092f('0x2f')]=function(_0x1d3151){var _0x5ec408=this;if(isNotPreview(_0x1d3151[_0x092f('0x55')])){if(isVoiceQueueOutbound(_0x1d3151[_0x092f('0x48')])&&isActive(_0x1d3151[_0x092f('0x54')])){_0x1d3151[_0x092f('0x9e')]=!![];BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](checkIsLoggedIn(_0x1d3151,_0x1d3151[_0x092f('0x4d')]))[_0x092f('0xb9')](checkIsActive(_0x1d3151,_0x1d3151[_0x092f('0x54')]))['then'](checkInterval(_0x1d3151))[_0x092f('0xb9')](_0x5ec408['checkIsTrunkReachable'](_0x1d3151))[_0x092f('0xb9')](_0x5ec408[_0x092f('0x13b')](_0x1d3151[_0x092f('0x156')],_0x1d3151[_0x092f('0x157')],_0x1d3151[_0x092f('0x3a')],_0x1d3151))[_0x092f('0xb9')](_0x5ec408[_0x092f('0x13d')](_0x1d3151['Interval'],_0x1d3151[_0x092f('0x157')],_0x1d3151[_0x092f('0x3a')],_0x1d3151))[_0x092f('0xb9')](_0x5ec408[_0x092f('0x14f')](_0x1d3151))[_0x092f('0xb2')](loggerCatchQueueSummary(_0x092f('0x158'),_0x1d3151));}else{notSendMessagesQueue(_0x1d3151);}}else{freeVariablesPredictive(_0x1d3151);}};Dialer['prototype']['syncCampaigns']=function(){var _0x443b66=this;var _0x310801;for(var _0x3b5aa3 in this[_0x092f('0x1f')]){if(typeof this['campaigns'][_0x3b5aa3]!==_0x092f('0xae')){_0x310801=this['campaigns'][_0x3b5aa3];if(isCampaignIvr(_0x310801[_0x092f('0x48')])&&isActive(_0x310801['active'])){_0x310801[_0x092f('0x9e')]=!![];BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](checkIsActive(_0x310801,_0x310801[_0x092f('0x73')]))[_0x092f('0xb9')](checkInterval(_0x310801))[_0x092f('0xb9')](_0x443b66[_0x092f('0x159')](_0x310801))['then'](_0x443b66[_0x092f('0x13b')](_0x310801[_0x092f('0x156')],_0x310801[_0x092f('0x157')],_0x310801[_0x092f('0x3a')],_0x310801))['then'](_0x443b66[_0x092f('0x13d')](_0x310801['Interval'],_0x310801['dialTimezone'],_0x310801['name'],_0x310801))[_0x092f('0xb9')](_0x443b66[_0x092f('0x15a')](_0x310801))[_0x092f('0xb2')](loggerCatchQueueSummary(_0x092f('0x15b'),_0x310801));}else{notSendMessagesCampaign(_0x310801);}}}};function getCallerIdRandom(_0xd1f6be,_0x4f6d1f){var _0x313073;var _0x216e43;var _0x4ceb6d;if(_0x4f6d1f<=0x0){_0x4f6d1f=0x1;}_0x313073=new RegExp(_0x092f('0x15c')+_0x4f6d1f+'}$');_0x216e43=Math[_0x092f('0x15d')](0xa,_0x4f6d1f-0x1);_0x4ceb6d=Math[_0x092f('0x15d')](0xa,_0x4f6d1f)-0x1;return util[_0x092f('0x77')]('%s',_[_0x092f('0x15e')](_0xd1f6be,_0x313073,_[_0x092f('0x15f')](_0x216e43,_0x4ceb6d)));}function extractCalleridName(_0x577c60){var _0x20969d=_0x577c60[_0x092f('0x160')](/"(.*?)"/);return _0x20969d?_0x20969d[0x1]:_0x577c60;}function extractCalleridNumber(_0x47206e){var _0x43c71a=_0x47206e[_0x092f('0x160')](/<(.*?)>/);return _0x43c71a?_0x43c71a[0x1]:_0x47206e;}Dialer[_0x092f('0x19')][_0x092f('0x161')]=function(_0xfa5179,_0x8cefb9){var _0x3ba217=this;var _0x43d206=uuid['v4']();this['actions'][_0x43d206]=new Action(_0xfa5179,_0x8cefb9,_0x43d206);return new BPromise(function(_0x4edb4e,_0x1a5fea){if(_['isUndefined'](_0xfa5179)&&typeof _0xfa5179!=='object'){return _0x1a5fea(msgResponse(_0x092f('0x162'),'Failure',_0x092f('0x163')));}if(_['isUndefined'](_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')])||_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')]===null){return _0x1a5fea(msgResponse('originate','Failure',_0x092f('0x166')));}var _0x698b8b={'XMD-CALLERID':_0x3ba217[_0x092f('0xac')][_0x43d206]['getCaller'](),'XMD-AGI':_0xfa5179[_0x092f('0x108')]?util[_0x092f('0x77')](_0x092f('0x167'),ipAgi,_0xfa5179[_0x092f('0x108')]):_0x092f('0x168'),'XMD-AGIAFTER':_0xfa5179['dialQueueProject2']?util[_0x092f('0x77')](_0x092f('0x167'),ipAgi,_0xfa5179[_0x092f('0x10d')]):_0x092f('0x168'),'XMD-QUEUE':_0xfa5179['type']===_0x092f('0x49')?util['format']('\x22%s,%s%s,,,%s\x22',_0xfa5179[_0x092f('0x3a')],_0xfa5179[_0x092f('0x169')]||'',_0xfa5179['dialAgiAfterHangupAgent']?'c':'',_0xfa5179['dialQueueTimeout']||0x3):_0x092f('0x168'),'XMD-CONTACTID':_0x8cefb9['ContactId'],'XMD-CDRTYPE':_0x092f('0x6'),'CALLERID(all)':_0x3ba217[_0x092f('0xac')][_0x43d206][_0x092f('0x16a')](),'XMD-AMD':_0xfa5179['dialAMDActive']?_0x092f('0x16b'):_0x092f('0x168'),'XMD-DESTINATION':_0x092f('0xe1')};if(_0xfa5179[_0x092f('0xe2')]){_0x698b8b[_0x092f('0x16c')]=_0xfa5179[_0x092f('0x16d')]||0x9c4;_0x698b8b[_0x092f('0x16e')]=_0xfa5179['dialAMDGreeting']||0x5dc;_0x698b8b[_0x092f('0x16f')]=_0xfa5179[_0x092f('0x170')]||0x320;_0x698b8b['XMD-AMDTOTALANALYSISTIME']=_0xfa5179[_0x092f('0x171')]||0x1388;_0x698b8b['XMD-AMDMINWORDLENGTH']=_0xfa5179['dialAMDMinWordLength']||0x64;_0x698b8b[_0x092f('0x172')]=_0xfa5179['dialAMDBetweenWordsSilence']||0x32;_0x698b8b[_0x092f('0x173')]=_0xfa5179[_0x092f('0x174')]||0x3;_0x698b8b[_0x092f('0x175')]=_0xfa5179[_0x092f('0x176')]||0x100;_0x698b8b[_0x092f('0x177')]=_0xfa5179[_0x092f('0x178')]||0x1388;}if(_0xfa5179[_0x092f('0x48')]===_0x092f('0x49')){_0x698b8b[_0x092f('0x179')]=_0x8cefb9['VoiceQueueId'];}else{_0x698b8b[_0x092f('0x17a')]=_0x8cefb9[_0x092f('0xd5')];}for(var _0x84187e in _0x8cefb9['Contact']){if(typeof _0x8cefb9['Contact'][_0x84187e]!==_0x092f('0xae')){if(isNotNull(_0x8cefb9[_0x092f('0x164')][_0x84187e])&&_0x84187e!=='id'&&_0x84187e!=='tags'&&_0x84187e!=='createdAt'&&_0x84187e!=='updatedAt'){_0x698b8b[util[_0x092f('0x77')](_0x092f('0x17b'),_0x092f('0x17c'),_[_0x092f('0x17d')](_0x84187e))]=_0x8cefb9[_0x092f('0x164')][_0x84187e];}}}var _0x229401=_0x3ba217[_0x092f('0xd9')](_0xfa5179['Trunk'])?getCallerId(_0xfa5179[_0x092f('0x72')][_0x092f('0x74')],_0xfa5179[_0x092f('0x17e')],_0xfa5179[_0x092f('0x17f')]>0x0?getCallerIdRandom(_0xfa5179[_0x092f('0x180')],_0xfa5179[_0x092f('0x17f')]):_0xfa5179[_0x092f('0x180')]):getCallerId(_['isNil'](_0xfa5179[_0x092f('0x138')])?_0xfa5179[_0x092f('0x72')][_0x092f('0x74')]:_0xfa5179[_0x092f('0x138')][_0x092f('0x74')],_0xfa5179[_0x092f('0x17e')],_0xfa5179[_0x092f('0x17f')]>0x0?getCallerIdRandom(_0xfa5179[_0x092f('0x180')],_0xfa5179['dialRandomLastDigitCallerIdNumber']):_0xfa5179[_0x092f('0x180')]);if(_0x229401){_0x698b8b['XMD-ORIGINATECALLERIDNAME']=_0x3ba217[_0x092f('0xac')][_0x43d206]['originatecalleridname']=extractCalleridName(_0x229401);_0x698b8b[_0x092f('0x181')]=_0x3ba217[_0x092f('0xac')][_0x43d206][_0x092f('0x182')]=extractCalleridNumber(_0x229401);}return ami[_0x092f('0xb0')]({'actionid':_0x43d206,'action':_0x092f('0x162'),'channel':_0x3ba217[_0x092f('0xd9')](_0xfa5179['Trunk'])?util['format'](_0x092f('0x183'),_0xfa5179[_0x092f('0x72')][_0x092f('0x3a')],isNotNull(_0xfa5179[_0x092f('0x184')])?_0xfa5179['dialPrefix'][_0x092f('0x185')]()||'':'',_0xfa5179[_0x092f('0x186')]>0x0?_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')][_0x092f('0x187')](_0xfa5179[_0x092f('0x186')]):_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')]):util[_0x092f('0x77')]('SIP/%s/%s%s',_[_0x092f('0xaf')](_0xfa5179[_0x092f('0x138')])?_0xfa5179[_0x092f('0x72')][_0x092f('0x3a')]:_0xfa5179[_0x092f('0x138')][_0x092f('0x3a')],isNotNull(_0xfa5179[_0x092f('0x184')])?_0xfa5179[_0x092f('0x184')][_0x092f('0x185')]()||'':'',_0xfa5179[_0x092f('0x186')]>0x0?_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')][_0x092f('0x187')](_0xfa5179[_0x092f('0x186')]):_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')]),'callerid':_0x229401,'Exten':_0x092f('0xe1'),'Context':'from-sip','Priority':'1','variable':_0x698b8b,'timeout':(_0xfa5179[_0x092f('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43d206})[_0x092f('0xb9')](function(_0x4459d2){return _0x4edb4e(_0x4459d2);})['catch'](function(_0x11d955){_0xfa5179['outboundOriginateFailureCallsDay']+=0x1;var _0x4dc144=new History(_0x3ba217['actions'][_0x43d206]);logger[_0x092f('0x93')](util[_0x092f('0x77')](_0x092f('0x188'),JSON[_0x092f('0x44')](_0x11d955)));_0x4dc144[_0x092f('0xa5')]=0xe;_0x4dc144[_0x092f('0xa6')]='OriginateError';_0x4dc144[_0x092f('0xa8')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));_0x4dc144[_0x092f('0xa7')]=_0x4dc144[_0x092f('0xa8')];_0x3ba217[_0x092f('0xcc')](_0x4dc144)[_0x092f('0xb2')](loggerCatch('[originate][error]'));_0x3ba217['moveContactManagedDialer'](_0x4dc144)[_0x092f('0xb2')](loggerCatch(_0x092f('0x189')))['finally'](function(){delete _0x3ba217['actions'][_0x43d206];return _0x1a5fea(msgResponse(_0x092f('0x162'),_0x092f('0x43'),_0x092f('0x18a')));});});});};Dialer[_0x092f('0x19')][_0x092f('0x2b')]=function(_0x3fc070){var _0x45ba17=this[_0x092f('0xac')][_0x3fc070[_0x092f('0x122')]];if(_0x45ba17){delete this[_0x092f('0xac')][_0x3fc070['actionid']];_0x45ba17[_0x092f('0x18b')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));var _0x330863=_0x45ba17[_0x092f('0x48')]===_0x092f('0x76')?this['campaigns'][_0x45ba17[_0x092f('0xb4')]]:this['voiceQueues'][_0x45ba17[_0x092f('0x18c')]()];if(!this[_0x092f('0x18d')](_0x3fc070[_0x092f('0x18e')])){this[_0x092f('0xb6')](_0x330863);return this['callProgressDetecting'](_0x45ba17,_0x330863,_0x3fc070)['catch'](loggerCatch(_0x092f('0x18f')));}this['uniqueId'][_0x3fc070['uniqueid']]=_0x45ba17;}};Dialer[_0x092f('0x19')][_0x092f('0x190')]=function(_0x12b47a,_0x14a1b7,_0x4d6b90){var _0x66b3e1=new History(_0x14a1b7);if(_0x66b3e1[_0x092f('0xef')]+_0x66b3e1[_0x092f('0xf0')]+_0x66b3e1['countnoanswerretry']+_0x66b3e1['countnosuchnumberretry']+_0x66b3e1[_0x092f('0xf3')]+_0x66b3e1[_0x092f('0xf4')]+_0x66b3e1['countmachineretry']+_0x66b3e1['countagentrejectretry']>=_0x4d6b90[_0x092f('0x102')]-0x1){return!![];}switch(_0x12b47a){case 0x3:if(_0x66b3e1[_0x092f('0xf1')]>=_0x4d6b90[_0x092f('0x191')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countnoanswerretry':_0x66b3e1[_0x092f('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90[_0x092f('0x192')],_0x092f('0xfd'))[_0x092f('0x77')](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1['ListId'],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x193')));break;case 0x5:if(_0x66b3e1[_0x092f('0xef')]>=_0x4d6b90['dialBusyMaxRetry']-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countbusyretry':_0x66b3e1[_0x092f('0xef')]+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90['dialBusyRetryFrequency'],_0x092f('0xfd'))['format'](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1['ListId'],'VoiceQueueId':_0x66b3e1['VoiceQueueId']||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x194')));break;case 0x8:if(_0x66b3e1['countcongestionretry']>=_0x4d6b90[_0x092f('0x195')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countcongestionretry':_0x66b3e1['countcongestionretry']+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90[_0x092f('0x196')],'minutes')['format'](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1['VoiceQueueId']||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x197')));break;case 0x0:if(_0x66b3e1['countnosuchnumberretry']>=_0x4d6b90[_0x092f('0x198')]-0x1){return!![];}else{this[_0x092f('0xc1')]({'active':![],'countnosuchnumberretry':_0x66b3e1[_0x092f('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90['dialNoSuchNumberRetryFrequency'],_0x092f('0xfd'))['format'](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x199')));}break;case 0xa:if(_0x66b3e1[_0x092f('0xf3')]>=_0x4d6b90[_0x092f('0x19a')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countdropretry':_0x66b3e1[_0x092f('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90['dialDropRetryFrequency'],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1['ListId'],'VoiceQueueId':_0x66b3e1['VoiceQueueId']||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x118')));break;case 0xb:if(_0x66b3e1['countabandonedretry']>=_0x4d6b90[_0x092f('0x11f')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countabandonedretry':_0x66b3e1[_0x092f('0xf4')]+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90[_0x092f('0x120')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x19b')));break;case 0x13:if(_0x66b3e1['countmachineretry']>=_0x4d6b90['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x66b3e1[_0x092f('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90[_0x092f('0xfc')],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0xff')));break;case 0x14:if(_0x66b3e1[_0x092f('0xf5')]>=_0x4d6b90[_0x092f('0x19c')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countagentrejectretry':_0x66b3e1[_0x092f('0xf5')]+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90[_0x092f('0x19d')],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1['ContactId'],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x19e')));break;default:return!![];}};Dialer[_0x092f('0x19')][_0x092f('0x19f')]=function(_0x3f6929,_0x4dd27f,_0x445163){var _0x4fe47d=this;var _0x3663ae=new History(_0x3f6929);return new BPromise(function(_0x248f7e,_0x1d765b){if(_[_0x092f('0x37')](_0x4dd27f)&&typeof _0x4dd27f!=='object'){return _0x1d765b(msgResponse('[callProgressDetecting]',_0x092f('0x13e'),_0x092f('0x1a0')));}if(_[_0x092f('0x37')](_0x445163)&&typeof _0x445163!==_0x092f('0x1a1')){return _0x1d765b(msgResponse(_0x092f('0x1a2'),_0x092f('0x13e'),_0x092f('0x1a3')));}switch(_0x445163['reason']){case'0':_0x4dd27f[_0x092f('0x5f')]+=0x1;_0x3663ae['state']=0x0;_0x3663ae['statedesc']=_0x092f('0x1a4');_0x3663ae['countnosuchnumberretry']+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami['emit'](_0x092f('0x1a5'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1a7')));_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0xee')));if(_0x4fe47d['checkRetriveMax'](0x0,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf2')]>=_0x4dd27f['dialNoSuchNumberMaxRetry']){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1a8'));}else{_0x4fe47d[_0x092f('0xf6')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1a8'));}}break;case'3':_0x4dd27f[_0x092f('0x5e')]+=0x1;_0x3663ae['state']=0x3;_0x3663ae[_0x092f('0xa6')]='NoAnswer';_0x3663ae[_0x092f('0xf1')]+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami[_0x092f('0x1a9')](_0x092f('0x1aa'),ut['buildObj'](_0x3f6929,_0x092f('0x1ab')));_0x4fe47d['createHistory'](_0x3663ae)['catch'](loggerCatch(_0x092f('0x1ac')));if(_0x4fe47d[_0x092f('0x190')](0x3,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf1')]>=_0x4dd27f['dialNoAnswerMaxRetry']){_0x4fe47d['createStateFinal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1ad'));}else{_0x4fe47d[_0x092f('0xf6')](_0x3663ae,_0x248f7e,_0x1d765b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4dd27f[_0x092f('0x59')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0x5;_0x3663ae['statedesc']=_0x092f('0x1ae');_0x3663ae['countbusyretry']+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami[_0x092f('0x1a9')](_0x092f('0x1af'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1b0')));_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4fe47d[_0x092f('0x190')](0x5,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xef')]>=_0x4dd27f[_0x092f('0x1b1')]){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,'reason\x205\x20busy');}else{_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b2'));}}break;case'8':_0x4dd27f[_0x092f('0x5a')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0x8;_0x3663ae[_0x092f('0xa6')]=_0x092f('0x1b3');_0x3663ae[_0x092f('0xf0')]+=0x1;_0x3663ae['countglobal']+=0x1;ami[_0x092f('0x1a9')](_0x092f('0x1b4'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1b5')));_0x4fe47d['createHistory'](_0x3663ae)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4fe47d[_0x092f('0x190')](0x8,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf0')]>=_0x4dd27f[_0x092f('0x195')]){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b6'));}else{_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b6'));}}break;case'11':_0x4dd27f[_0x092f('0x1b7')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0xb;_0x3663ae[_0x092f('0xa6')]='Abandoned';_0x3663ae[_0x092f('0xf4')]+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0x1b8')));if(_0x4fe47d[_0x092f('0x190')](0xb,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf4')]>=_0x4dd27f[_0x092f('0x11f')]){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b9'));}else{_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b9'));}}break;case'20':_0x4dd27f[_0x092f('0x61')]+=0x1;_0x3663ae['state']=0x14;_0x3663ae['statedesc']=_0x092f('0x1ba');_0x3663ae[_0x092f('0xf5')]+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami['emit'](_0x092f('0x1bb'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1bc')));_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0x1bd')));if(_0x4fe47d['checkRetriveMax'](0x14,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf5')]>=_0x4dd27f[_0x092f('0x19c')]){_0x4fe47d['createStateFinal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1be'));}else{_0x4fe47d[_0x092f('0xf6')](_0x3663ae,_0x248f7e,_0x1d765b,'reason\x2020\x20agentreject');}}break;default:_0x4dd27f[_0x092f('0x62')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0xc;_0x3663ae[_0x092f('0xa6')]=_0x445163[_0x092f('0x1bf')];_0x4fe47d['createHistory'](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0x1c0')));if(_0x4fe47d[_0x092f('0x190')](_0x445163[_0x092f('0x1bf')],_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xef')]+_0x3663ae['countcongestionretry']+_0x3663ae[_0x092f('0xf1')]+_0x3663ae['countnosuchnumberretry']+_0x3663ae[_0x092f('0xf3')]+_0x3663ae[_0x092f('0xf4')]+_0x3663ae[_0x092f('0xeb')]+_0x3663ae['countagentrejectretry']>=_0x4dd27f[_0x092f('0x102')]){_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x445163[_0x092f('0x1bf')]);}else{_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x445163[_0x092f('0x1bf')]);}}}});};Dialer[_0x092f('0x19')]['stateGlobal']=function(_0x3b47be,_0x50d7af,_0x265ee8,_0x2b7086){var _0x295e44=new Final(_0x3b47be);_0x295e44['state']=0xf;_0x295e44[_0x092f('0xa6')]=_0x092f('0x1c1');this[_0x092f('0xf9')](_0x295e44,_0x50d7af,_0x265ee8,_0x2b7086);};Dialer[_0x092f('0x19')]['createStateFinal']=function(_0x2864e7,_0x478c45,_0x2eaf19,_0x72983){this['moveContactManagedDialer'](_0x2864e7)[_0x092f('0xb9')](function(){return _0x478c45(msgResponse(_0x092f('0x1a2'),_0x092f('0xd8'),_0x72983));})[_0x092f('0xb2')](function(){return _0x2eaf19(msgResponse(_0x092f('0x1c2'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype']['predictive']=function(_0x2b2d88){var _0x480aad=_0x2b2d88[_0x092f('0x1c3')]/0x64;var _0x325deb=_0x2b2d88[_0x092f('0x5d')]/(_0x2b2d88[_0x092f('0x5d')]+_0x2b2d88[_0x092f('0x58')]);var _0x1cfd14=Math[_0x092f('0x1c4')](_0x2b2d88['predictiveIntervalAvailable']*(_0x2b2d88[_0x092f('0x1c5')]/0x64));var _0x16e04b=Math[_0x092f('0x1c4')](_0x2b2d88['predictiveIntervalAvailable']*(_0x2b2d88[_0x092f('0x1c6')]/0x64));var _0x42c915=_0x2b2d88[_0x092f('0x4c')]+_0x2b2d88['talking'];var _0x32333a=Math['floor'](_0x2b2d88[_0x092f('0x88')]*_0x2b2d88['erlangAbandonmentRate']*_0x2b2d88[_0x092f('0x68')]*_0x2b2d88['predictiveIntervalMultiplicativeFactor']);if(_[_0x092f('0x37')](_0x2b2d88[_0x092f('0x24')])){if(!_[_0x092f('0x37')](_0x2b2d88[_0x092f('0x71')])){_0x2b2d88[_0x092f('0x71')]=undefined;loggerPredictive['error'](_0x092f('0x1c7'),_0x092f('0x1c8'));}if(!_['isUndefined'](_0x2b2d88[_0x092f('0x8e')])){loggerPredictive[_0x092f('0x93')](_0x092f('0x1c7'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2b2d88[_0x092f('0x8e')]);_0x2b2d88[_0x092f('0x8e')]=undefined;}_0x2b2d88['startProgressive']=moment()[_0x092f('0x77')](_0x092f('0xfe'));loggerPredictive['info'](_0x2b2d88[_0x092f('0x3a')],'collection\x20data\x20in\x20progressive\x20at',_0x2b2d88[_0x092f('0x24')]);this[_0x092f('0x151')](_0x2b2d88,0x1);}else if(ifInterval(_0x2b2d88['dialPredictiveInterval'],_0x2b2d88[_0x092f('0x24')])){this[_0x092f('0x151')](_0x2b2d88,0x1);loggerPredictiveCalls[_0x092f('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x2b2d88[_0x092f('0x24')],_0x2b2d88[_0x092f('0x3a')]);_0x2b2d88['erlangCalls']=0x0;_0x2b2d88[_0x092f('0x114')]=0x0;}else if(_0x480aad<_0x325deb&&_0x2b2d88[_0x092f('0x1c9')]==='dropRate'){freeVariablesPredictive(_0x2b2d88);loggerPredictive['info'](_0x092f('0x1ca'),_0x092f('0x1cb'),_0x325deb,_0x092f('0x24'),_0x2b2d88[_0x092f('0x3a')]);}else if(_0x32333a<_0x2b2d88[_0x092f('0x114')]&&_0x2b2d88[_0x092f('0x1c9')]==='dropRate'){freeVariablesPredictive(_0x2b2d88);loggerPredictive[_0x092f('0x7b')](_0x092f('0x1cc'),'Max\x20Drop\x20',_0x32333a,'Drop\x20in\x20this\x20interval',_0x2b2d88[_0x092f('0x114')],'startProgressive',_0x2b2d88['name']);}else if(!ifInterval(_0x2b2d88[_0x092f('0x1cd')],_0x2b2d88[_0x092f('0x24')])&&_[_0x092f('0x37')](_0x2b2d88[_0x092f('0x71')])&&!_[_0x092f('0x37')](_0x2b2d88['startProgressive'])){_0x2b2d88[_0x092f('0x71')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));loggerPredictive[_0x092f('0x7b')](_0x2b2d88['name'],_0x092f('0x1ce'),_0x2b2d88[_0x092f('0x71')]);this[_0x092f('0xbf')](_0x2b2d88['dialPredictiveInterval'])[_0x092f('0xb9')](this['getDataPredictive'](_0x2b2d88))[_0x092f('0xb9')](mergeDataErlangB(_0x2b2d88))['then'](this[_0x092f('0x1cf')](_0x2b2d88))[_0x092f('0xb2')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2b2d88));}else if(!ifInterval(_0x2b2d88['dialPredictiveInterval'],_0x2b2d88[_0x092f('0x71')])){_0x2b2d88['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2b2d88[_0x092f('0x71')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x092f('0x7b')](_0x2b2d88[_0x092f('0x3a')],_0x092f('0x1d0'),_0x2b2d88[_0x092f('0x71')]);clearInterval(_0x2b2d88[_0x092f('0x8e')]);_0x2b2d88[_0x092f('0x8e')]=undefined;this[_0x092f('0xbf')](_0x2b2d88[_0x092f('0x1cd')])[_0x092f('0xb9')](this['getDataPredictive'](_0x2b2d88))[_0x092f('0xb9')](mergeDataErlangB(_0x2b2d88))[_0x092f('0xb9')](this[_0x092f('0x1cf')](_0x2b2d88))[_0x092f('0xb2')](loggerCatchPredictive(_0x092f('0x1d1'),_0x2b2d88));}else if(_0x2b2d88[_0x092f('0x6b')]&&_0x42c915<_0x2b2d88[_0x092f('0x6b')]-_0x16e04b){freeVariablesPredictive(_0x2b2d88);loggerPredictive['info'](_0x2b2d88[_0x092f('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x42c915,_0x092f('0x1d2'),_0x2b2d88['predictiveIntervalAvailable'],'-',_0x16e04b,'=',_0x2b2d88[_0x092f('0x6b')]-_0x16e04b,')');}else if(_0x2b2d88['predictiveIntervalAvailable']&&_0x42c915>_0x2b2d88[_0x092f('0x6b')]+_0x1cfd14){freeVariablesPredictive(_0x2b2d88);loggerPredictive[_0x092f('0x7b')](_0x2b2d88[_0x092f('0x3a')],_0x092f('0x1d3'),_0x42c915,')\x20are\x20more\x20than\x20threshold\x20(',_0x2b2d88[_0x092f('0x6b')],'+',_0x1cfd14,'=',_0x2b2d88[_0x092f('0x6b')]+_0x1cfd14,')');}};Dialer[_0x092f('0x19')][_0x092f('0x1d4')]=function(_0x5d5952){var _0xac6ad2=this;return function(_0x4fd2d0){return new BPromise(function(_0xf06e91,_0x3d0bda){_['merge'](_0x5d5952,_0x4fd2d0[0x0]);if(checkGetDataPredictive(_0x4fd2d0[0x0])){var _0x1d4ba0=_0x5d5952[_0x092f('0x6b')]=_0x5d5952[_0x092f('0x9f')]+_0x5d5952['available'];var _0x10394d=_0x5d5952[_0x092f('0x1cd')]*0x3c;var _0x4e11d0=_0x4fd2d0[0x0][_0x092f('0x65')]+_0x4fd2d0[0x0][_0x092f('0x64')];var _0x29acb7=(_0x4fd2d0[0x0][_0x092f('0x63')]+_0x4fd2d0[0x0][_0x092f('0x7f')]+_0x4fd2d0[0x0][_0x092f('0x66')])/_0x4fd2d0[0x0][_0x092f('0x6c')];_0x5d5952[_0x092f('0x68')]=_0x29acb7>0x0?_0x29acb7:0x1;switch(_0x5d5952[_0x092f('0x1c9')]){case _0x092f('0x1d5'):var _0xf2ccbe=_0x5d5952[_0x092f('0x1c3')]/0x64;return _0xac6ad2[_0x092f('0x1d6')](_0x1d4ba0,_0x10394d,_0x4e11d0,_0x29acb7,_0xf2ccbe)[_0x092f('0xb9')](function(_0x249c27){return _0xf06e91(_0x249c27);});case'agentBusyFactor':var _0x36c1e6=_0x5d5952[_0x092f('0x1c3')]/0x64;return _0xac6ad2[_0x092f('0x1d7')](_0x1d4ba0,_0x10394d,_0x4e11d0,_0x29acb7,_0x36c1e6)[_0x092f('0xb9')](function(_0x34229f){return _0xf06e91(_0x34229f);});default:return _0x3d0bda(msgResponse(_0x092f('0x1d8'),'Failure',_0x092f('0x1d9')));}}else{return _0x3d0bda(msgResponse(_0x092f('0x1d8'),_0x092f('0x13e'),_0x092f('0x1da')));}});};};Dialer['prototype'][_0x092f('0x1db')]=function(_0x28fe70){var _0x2877f2=this;return function(_0x42bc09){return new BPromise(function(_0x212a1f,_0x58aef6){_[_0x092f('0x8b')](_0x28fe70,_0x42bc09[0x0]);if(checkGetDataPredictive(_0x42bc09[0x0])){loggerPredictive['info'](JSON[_0x092f('0x44')](_0x42bc09[0x0]));if(_0x28fe70[_0x092f('0x1c9')]===_0x092f('0x1d5')){return _0x2877f2['getVoiceQueueRtPauses'](_0x28fe70['id'])[_0x092f('0xb9')](function(_0x1344cb){var _0x57fd10=_0x28fe70['loggedIn']-_0x1344cb[0x0][_0x092f('0x1dc')];var _0x57efe4=_0x28fe70[_0x092f('0x1cd')]*0x3c;var _0x144cc2=_0x42bc09[0x0][_0x092f('0x65')]+_0x42bc09[0x0]['predictiveIntervalAvgHoldtime'];var _0x1d570e=(_0x42bc09[0x0]['predictiveIntervalAnsweredCalls']+_0x42bc09[0x0][_0x092f('0x7f')]+_0x42bc09[0x0][_0x092f('0x66')])/_0x42bc09[0x0]['predictiveIntervalTotalCalls'];var _0x4796b3=_0x28fe70['dialPredictiveOptimizationPercentage']/0x64;_0x28fe70['predictiveIntervalPauses']=_0x1344cb[0x0]['outboundQueuePauses']||0x0;_0x28fe70['predictiveIntervalHitRate']=_0x1d570e>0x0?_0x1d570e:0x1;return _0x2877f2[_0x092f('0x1d6')](_0x57fd10,_0x57efe4,_0x144cc2,_0x1d570e,_0x4796b3);})[_0x092f('0xb9')](function(_0x57399b){return _0x212a1f(_0x57399b);})['catch'](function(_0x4148da){return _0x58aef6(msgResponse(_0x092f('0x1dd'),'Failure',JSON[_0x092f('0x44')](_0x4148da)));});}if(_0x28fe70[_0x092f('0x1c9')]===_0x092f('0x1de')){return _0x2877f2[_0x092f('0xc8')](_0x28fe70['id'])[_0x092f('0xb9')](function(_0x2ff95c){var _0x131171=_0x28fe70[_0x092f('0x4d')]-_0x2ff95c[0x0][_0x092f('0x1dc')];var _0x4a9f35=_0x28fe70[_0x092f('0x1cd')]*0x3c;var _0x42d75d=_0x42bc09[0x0][_0x092f('0x65')]+_0x42bc09[0x0]['predictiveIntervalAvgHoldtime'];var _0x134484=(_0x42bc09[0x0][_0x092f('0x63')]+_0x42bc09[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x42bc09[0x0][_0x092f('0x66')])/_0x42bc09[0x0][_0x092f('0x6c')];var _0x42f4c7=_0x28fe70[_0x092f('0x1c3')]/0x64;_0x28fe70[_0x092f('0x6a')]=_0x2ff95c[0x0][_0x092f('0x1dc')]||0x0;_0x28fe70[_0x092f('0x68')]=_0x134484>0x0?_0x134484:0x1;return _0x2877f2[_0x092f('0x1d7')](_0x131171,_0x4a9f35,_0x42d75d,_0x134484,_0x42f4c7);})[_0x092f('0xb9')](function(_0x5ea315){return _0x212a1f(_0x5ea315);})[_0x092f('0xb2')](function(_0x4bd6cc){return _0x58aef6(msgResponse(_0x092f('0x1dd'),_0x092f('0x13e'),JSON[_0x092f('0x44')](_0x4bd6cc)));});}}else{return _0x58aef6(msgResponse('[getDataPredictive]',_0x092f('0x13e'),_0x092f('0x1da')));}});};};Dialer[_0x092f('0x19')][_0x092f('0x1cf')]=function(_0x5b1ea3){var _0x17cd3f=this;return function(){var _0x1339bc=0x0;var _0x4927a2=Math[_0x092f('0x1df')](_0x5b1ea3['erlangCallToSecond']*0x3e8);if(_0x4927a2>0x0){_0x4927a2=_0x4927a2<0x64?0x64:_0x4927a2;loggerPredictive[_0x092f('0x7b')](_0x5b1ea3[_0x092f('0x3a')],'one\x20call\x20every:',_0x4927a2,_0x092f('0x45'));_0x5b1ea3[_0x092f('0x8e')]=setInterval(function(){_0x17cd3f[_0x092f('0x8e')](_0x5b1ea3);loggerPredictiveCalls[_0x092f('0x7b')]('[handlePredictive]',_0x1339bc+=0x1);},_0x4927a2);}else{loggerPredictive['info'](_0x5b1ea3[_0x092f('0x3a')],_0x092f('0x1e0'));}};};Dialer[_0x092f('0x19')][_0x092f('0x1e1')]=function(_0x1a8b11,_0x31ff7c){var _0x44d875=this;return function(_0x121315){if(_[_0x092f('0x41')](_0x121315)){if(_[_0x092f('0xaf')](_0x31ff7c[_0x092f('0xd3')])||!_0x31ff7c[_0x092f('0x1e2')]){if(_0x1a8b11[_0x092f('0x55')]===_0x092f('0x7')){_0x1a8b11['queueStatusComplete']=_[_0x092f('0x37')](_0x1a8b11[_0x092f('0x12a')])?!![]:_0x1a8b11[_0x092f('0x12a')];var _0x11666e=uuid['v4']();_0x44d875[_0x092f('0xac')][_0x11666e]=new Action(_0x1a8b11,_0x31ff7c,_0x11666e);loggerBooked[_0x092f('0x7b')](_0x092f('0x1e3'),_0x11666e,_0x092f('0x1e4'),JSON[_0x092f('0x44')](_0x1a8b11['queueStatusComplete']),'Queue:\x20',_0x1a8b11[_0x092f('0x3a')]);if(_0x1a8b11[_0x092f('0x12a')]){_0x1a8b11[_0x092f('0x12a')]=![];_0x44d875[_0x092f('0x127')][_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xb4')]]=[];ami[_0x092f('0xb0')]({'actionid':_0x11666e,'action':_0x092f('0x1e5'),'queue':_0x1a8b11['name']})[_0x092f('0xb2')](function(){_0x44d875[_0x092f('0xb6')](_0x1a8b11);_0x44d875[_0x092f('0xc1')]({'active':![],'ContactId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd1')],'ListId':_0x44d875[_0x092f('0xac')][_0x11666e]['ListId'],'VoiceQueueId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd4')]||undefined,'CampaignId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd5')]||undefined})['catch'](loggerCatch(_0x092f('0x1e6')));delete _0x44d875[_0x092f('0xac')][_0x11666e];});}else{loggerBooked[_0x092f('0x7b')](_0x092f('0x1e7'),JSON[_0x092f('0x44')](_0x1a8b11[_0x092f('0x12a')]),_0x092f('0x1e8'),_0x1a8b11['name']);_0x44d875['updateOriginated'](_0x1a8b11);_0x44d875[_0x092f('0xc1')]({'active':![],'ContactId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd1')],'ListId':_0x44d875['actions'][_0x11666e][_0x092f('0xd2')],'VoiceQueueId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd4')]||undefined,'CampaignId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x1e6')));delete _0x44d875[_0x092f('0xac')][_0x11666e];}}else{return _0x44d875[_0x092f('0x161')](_0x1a8b11,_0x31ff7c);}}else{if(getDiff(_0x31ff7c[_0x092f('0x1e9')])<_0x1a8b11[_0x092f('0x1ea')]*0x3c){if(_0x31ff7c['Agent']&&!_0x31ff7c[_0x092f('0x1eb')][_0x092f('0x1ec')]){_0x44d875['preview']['run'](_0x31ff7c['id'])[_0x092f('0x1c')](function(){_0x44d875[_0x092f('0xb6')](_0x1a8b11);});}else{_0x44d875[_0x092f('0xc3')]({'active':![]},_0x31ff7c['id'],0x1)['finally'](function(){_0x44d875[_0x092f('0xb6')](_0x1a8b11);});}}else{_0x1a8b11['outboundReCallsDay']+=0x1;_0x44d875[_0x092f('0xb6')](_0x1a8b11);if(_0x1a8b11[_0x092f('0x1ed')]){_0x44d875['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x31ff7c[_0x092f('0xd1')],'ListId':_0x31ff7c[_0x092f('0xd2')],'VoiceQueueId':_0x31ff7c[_0x092f('0xd4')]||undefined,'CampaignId':_0x31ff7c[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x1ee')));_0x44d875[_0x092f('0xcc')](createObjHistory(_0x1a8b11,_0x31ff7c,_0x092f('0x1ef'),0x17,'RecallInQueue'))[_0x092f('0xb2')](loggerCatch(_0x092f('0x1f0')));}else{_0x44d875[_0x092f('0xe7')](createObjHistory(_0x1a8b11,_0x31ff7c,_0x092f('0x1f1'),0x16,'RecallFailedTimeout'),_0x092f('0x1f2'),_0x092f('0x1f3'));}}}}else{_0x1a8b11[_0x092f('0x1f4')]+=0x1;_0x44d875[_0x092f('0xe7')](createObjHistory(_0x1a8b11,_0x31ff7c,_0x092f('0x1f5'),0xd,'Blacklist'),_0x092f('0x1f6'),_0x092f('0x1f7'));throw _0x092f('0x1f8');}};};Dialer['prototype'][_0x092f('0x155')]=function(_0x51201e){var _0xc6a769=this;var _0x599816=_0x51201e[_0x092f('0x1f9')]-_0x51201e[_0x092f('0x6d')]-_0x51201e['temp'];emitCampaignSummary(_0x51201e);if(_0x599816>0x0){if(_0x599816>this[_0x092f('0x21')]){_0x599816=this[_0x092f('0x21')];}_0x51201e[_0x092f('0x1fa')]+=_0x599816;this[_0x092f('0xc6')](_0x51201e['id'],_0x599816,_0x51201e[_0x092f('0x1fb')])[_0x092f('0xb9')](function(_0x229715){_0x51201e[_0x092f('0x1fa')]-=_0x599816;_0x51201e[_0x092f('0x1fa')]=_0x51201e[_0x092f('0x1fa')]>0x0?_0x51201e[_0x092f('0x1fa')]:0x0;if(!checkContactEmpty(_0x229715)){_0x51201e[_0x092f('0x38')]=_0x092f('0x9c');logger['info'](_0x092f('0x1fc')+_0x51201e['name']);}else{_0x51201e[_0x092f('0x6d')]+=_0x229715[_0x092f('0x96')];_0x51201e[_0x092f('0x38')]=_0x092f('0x1fd');for(var _0x3651cb=0x0;_0x3651cb<_0x229715[_0x092f('0x96')];_0x3651cb+=0x1){_0x51201e[_0x092f('0x1fe')]+=0x1;if(_[_0x092f('0xaf')](_0x229715[_0x3651cb])||_[_0x092f('0xaf')](_0x229715[_0x3651cb][_0x092f('0x164')])||_['isNil'](_0x229715[_0x3651cb]['Contact'][_0x092f('0x165')])){_0xc6a769[_0x092f('0xcf')](_0x092f('0x1ff'),_0x51201e,_0x229715[_0x3651cb]);}else{_0xc6a769[_0x092f('0xbe')](_[_0x092f('0xd0')](_0x229715[_0x3651cb],[_0x092f('0xd5'),_0x092f('0x200')]))['then'](_0xc6a769[_0x092f('0x1e1')](_0x51201e,_0x229715[_0x3651cb]))['catch'](_0xc6a769[_0x092f('0x201')](_0x092f('0x202'),_0x51201e));}}}})['catch'](loggerGetContactDialer(_0x092f('0x203'),_0x51201e,_0x599816));}};Dialer[_0x092f('0x19')][_0x092f('0x151')]=function(_0x41a901,_0x5b440e){var _0x4c7729=this;var _0x117617=[];var _0x56ebba=_0x5b440e>=0x1?_0x5b440e:0x1;if(_0x41a901[_0x092f('0x55')]==='booked'){_0x56ebba=0x1;}var _0x186c2c=Math[_0x092f('0x1df')](_0x41a901[_0x092f('0x4c')]*_0x56ebba)-_0x41a901['originated']-_0x41a901[_0x092f('0x1fa')];emitVoiceQueueSummary(_0x41a901);if(_0x41a901[_0x092f('0x204')]>0x0){var _0x188413=_0x41a901['dialLimitQueue']-_0x41a901[_0x092f('0x6d')]-_0x41a901[_0x092f('0x9f')]-_0x41a901['temp']-_0x41a901['pTalking'];if(_0x186c2c>_0x188413){_0x186c2c=_0x188413;}}if(_0x186c2c>0x0){if(_0x41a901[_0x092f('0x55')]==='booked'){_0x186c2c=0x1;}if(_0x186c2c>this[_0x092f('0x21')]){_0x186c2c=this[_0x092f('0x21')];}_0x41a901[_0x092f('0x1fa')]+=_0x186c2c;for(var _0x2b57bc in this['agents']){if(typeof this[_0x092f('0x125')][_0x2b57bc]!=='undefined'){if(this[_0x092f('0x125')][_0x2b57bc][_0x092f('0xa5')]===_0x092f('0x205')&&this[_0x092f('0x125')][_0x2b57bc][_0x092f('0xdb')]===_0x092f('0xdc')){_0x117617[_0x092f('0x128')](this[_0x092f('0x125')][_0x2b57bc]['id']);}}}this[_0x092f('0xc5')](_0x41a901['id'],_0x117617,_0x186c2c,_0x41a901[_0x092f('0x1fb')])[_0x092f('0xb9')](function(_0x4a2f21){_0x41a901[_0x092f('0x1fa')]-=_0x186c2c;_0x41a901['temp']=_0x41a901[_0x092f('0x1fa')]>0x0?_0x41a901[_0x092f('0x1fa')]:0x0;if(!checkContactEmpty(_0x4a2f21)){_0x4c7729[_0x092f('0xba')](_0x41a901)[_0x092f('0xb9')](sendMessageReschedule(_0x41a901))['catch'](loggerCatch(_0x092f('0xbb')));}else{_0x41a901['originated']+=_0x4a2f21[_0x092f('0x96')];_0x41a901[_0x092f('0x38')]=_0x41a901[_0x092f('0x55')]==='booked'?_0x092f('0x16b'):_0x092f('0x1fd');for(var _0x405974=0x0;_0x405974<_0x4a2f21['length'];_0x405974+=0x1){if(_['isNil'](_0x4a2f21[_0x405974])||_[_0x092f('0xaf')](_0x4a2f21[_0x405974][_0x092f('0x164')])||_[_0x092f('0xaf')](_0x4a2f21[_0x405974][_0x092f('0x164')][_0x092f('0x165')])){_0x4c7729[_0x092f('0xcf')](_0x092f('0x1ff'),_0x41a901,_0x4a2f21[_0x405974]);}else{_0x4c7729[_0x092f('0xbc')](_[_0x092f('0xd0')](_0x4a2f21[_0x405974],['VoiceQueueId','Contact.phone']))[_0x092f('0xb9')](_0x4c7729[_0x092f('0x1e1')](_0x41a901,_0x4a2f21[_0x405974]))['catch'](_0x4c7729['loggerHandler'](_0x092f('0x1ff'),_0x41a901));}}}})['catch'](loggerGetContactDialer(_0x092f('0x206'),_0x41a901,_0x186c2c));}};Dialer[_0x092f('0x19')][_0x092f('0x8e')]=function(_0x8b8072){if(_0x8b8072[_0x092f('0x204')]>0x0){var _0xb5fe4b=_0x8b8072[_0x092f('0x204')]-_0x8b8072['originated']-_0x8b8072[_0x092f('0x9f')];if(_0xb5fe4b>0x0){this['tryOriginatePredictive'](_0x8b8072);}else{loggerPredictiveCalls['info'](_0x092f('0x207'));}}else{this['tryOriginatePredictive'](_0x8b8072);}};Dialer['prototype'][_0x092f('0x208')]=function(_0x507cb9){var _0x824c88=this;var _0x499c8e=[];_0x507cb9['originated']+=0x1;for(var _0x3a7e2b in this[_0x092f('0x125')]){if(typeof this[_0x092f('0x125')][_0x3a7e2b]!==_0x092f('0xae')){if(this['agents'][_0x3a7e2b][_0x092f('0xa5')]===_0x092f('0x205')&&this['agents'][_0x3a7e2b][_0x092f('0xdb')]===_0x092f('0xdc')){_0x499c8e[_0x092f('0x128')](this[_0x092f('0x125')][_0x3a7e2b]['id']);}}}this[_0x092f('0xc5')](_0x507cb9['id'],_0x499c8e,0x1,_0x507cb9[_0x092f('0x1fb')])[_0x092f('0xb9')](function(_0x1e4b4f){if(!checkContactEmpty(_0x1e4b4f)){checkContactLowerLimitOriginate(_0x507cb9,0x1,0x0);_0x824c88[_0x092f('0xba')](_0x507cb9)[_0x092f('0xb9')](sendMessageReschedule(_0x507cb9))[_0x092f('0xb2')](loggerCatch(_0x092f('0xbb')));}else{_0x507cb9[_0x092f('0x38')]=_0x092f('0x1fd');if(_['isNil'](_0x1e4b4f[0x0])||_[_0x092f('0xaf')](_0x1e4b4f[0x0][_0x092f('0x164')])||_[_0x092f('0xaf')](_0x1e4b4f[0x0]['Contact'][_0x092f('0x165')])){_0x824c88['emptyContact']('[actionOriginate]\x20',_0x507cb9,_0x1e4b4f[0x0]);}else{_0x824c88[_0x092f('0xbc')](_[_0x092f('0xd0')](_0x1e4b4f[0x0],[_0x092f('0xd4'),_0x092f('0x200')]))[_0x092f('0xb9')](_0x824c88[_0x092f('0x1e1')](_0x507cb9,_0x1e4b4f[0x0]))[_0x092f('0xb2')](_0x824c88[_0x092f('0x201')](_0x092f('0x209'),_0x507cb9));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x507cb9,0x1));emitVoiceQueueSummary(_0x507cb9);};Dialer[_0x092f('0x19')]['abandonmentRate']=function(_0x3898f2,_0xa13716,_0x3c3334,_0x5a2e35,_0x169385,_0x90d862){loggerPredictive[_0x092f('0x7b')](_0x092f('0x20a'));loggerPredictive[_0x092f('0x7b')](_0x092f('0x20b'),_0x3898f2);loggerPredictive['info'](_0x092f('0x20c'),_0xa13716);loggerPredictive[_0x092f('0x7b')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c3334);loggerPredictive[_0x092f('0x7b')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a2e35);loggerPredictive[_0x092f('0x7b')](_0x092f('0x20d'),_0x169385);loggerPredictive['info'](_0x092f('0x82'));return new BPromise(function(_0x1ee1ca,_0x2e9303){if(_0x3898f2<=0x0||isNaN(_0x3898f2)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),_0x092f('0x20f')+_0x3898f2));}if(_0x3c3334<=0x0||isNaN(_0x3c3334)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),'Ts\x20=\x20'+_0x3c3334));}if(_0x5a2e35<=0x0||isNaN(_0x5a2e35)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),'p\x20=\x20'+_0x5a2e35));}if(_0xa13716<=0x0||isNaN(_0xa13716)){return _0x2e9303(msgResponse(_0x092f('0x20e'),'Error',_0x092f('0x210')+_0xa13716));}if(_0x169385<=0x0||isNaN(_0x169385)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),_0x092f('0x211')+_0x169385));}_0x90d862=_0x90d862||0x0;var _0x3b704b=0x1/_0x3c3334;var _0x50d211=0x0;var _0x75d359=0x0;var _0x529000=0x0;var _0x303db9=0x0;for(var _0x4b436f=0x0;_0x529000<_0x169385;_0x4b436f+=0x1){_0x75d359=_0x4b436f/_0xa13716;_0x50d211=(_0x5a2e35*_0x75d359+_0x90d862)/_0x3b704b;_0x529000=erlangb(_0x50d211,_0x3898f2);_0x303db9=_0x50d211/_0x3898f2*(0x1-erlangb(_0x50d211,_0x3898f2));}return _0x1ee1ca({'erlangCalls':_0x4b436f,'erlangCallToSecond':_0xa13716/_0x4b436f,'erlangAbandonmentRate':_0x529000,'erlangBusyFactor':_0x303db9});});};Dialer[_0x092f('0x19')]['busyFactor']=function(_0x58b2e3,_0x3adedf,_0x226a1a,_0x7f30e8,_0x185565,_0x53ac63){loggerPredictive[_0x092f('0x7b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x092f('0x7b')](_0x092f('0x20b'),_0x58b2e3);loggerPredictive[_0x092f('0x7b')](_0x092f('0x20c'),_0x3adedf);loggerPredictive[_0x092f('0x7b')](_0x092f('0x212'),_0x226a1a);loggerPredictive[_0x092f('0x7b')](_0x092f('0x213'),_0x7f30e8);loggerPredictive[_0x092f('0x7b')](_0x092f('0x214'),_0x185565);loggerPredictive[_0x092f('0x7b')]('---------------------------');return new BPromise(function(_0x2778fc,_0x4ca596){if(_0x58b2e3<=0x0||isNaN(_0x58b2e3)){return _0x4ca596(msgResponse(_0x092f('0x215'),_0x092f('0x43'),'m\x20=\x20'+_0x58b2e3));}if(_0x226a1a<=0x0||isNaN(_0x226a1a)){return _0x4ca596(msgResponse(_0x092f('0x215'),_0x092f('0x43'),'Ts\x20=\x20'+_0x226a1a));}if(_0x7f30e8<=0x0||isNaN(_0x7f30e8)){return _0x4ca596(msgResponse('[busyFactor]',_0x092f('0x43'),'p\x20=\x20'+_0x7f30e8));}if(_0x3adedf<=0x0||isNaN(_0x3adedf)){return _0x4ca596(msgResponse(_0x092f('0x215'),_0x092f('0x43'),_0x092f('0x210')+_0x3adedf));}if(_0x185565<=0x0||isNaN(_0x185565)){return _0x4ca596(msgResponse(_0x092f('0x215'),'Error','Umin\x20=\x20'+_0x185565));}_0x53ac63=_0x53ac63||0x0;var _0x144fb4=0x1/_0x226a1a;var _0x170155=0x0;var _0x1ece7e=0x0;var _0x5855e2=0x0;var _0x208322=0x0;for(var _0x287eac=0x0;_0x208322<_0x185565;_0x287eac+=0x1){_0x1ece7e=_0x287eac/_0x3adedf;_0x170155=(_0x7f30e8*_0x1ece7e+_0x53ac63)/_0x144fb4;_0x5855e2=erlangb(_0x170155,_0x58b2e3);_0x208322=_0x170155/_0x58b2e3*(0x1-erlangb(_0x170155,_0x58b2e3));}return _0x2778fc({'erlangCalls':_0x287eac,'erlangCallToSecond':_0x3adedf/_0x287eac,'erlangAbandonmentRate':_0x5855e2,'erlangBusyFactor':_0x208322});});};module['exports']=Dialer; \ No newline at end of file +var _0x08af=['_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','Action','iftime\x20%s,%s','interval','timezones','content','indexOf','true','command','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTime','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','emptyContact','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','name','message','NOT_ACTIVE','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','format','ivr','campaign:ivr:%s','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','checkIsBlackList','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','reachable','SIP/%s','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','membername','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','value','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','cause-txt','[syncHangupIvr]','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','Abandoned','dropreason','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actions','actionid','locked','paused','stateinterface','strategy','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[unlock][syncQueueStatusComplete]'];(function(_0x391baa,_0x23308b){var _0x450dde=function(_0x3f63d3){while(--_0x3f63d3){_0x391baa['push'](_0x391baa['shift']());}};_0x450dde(++_0x23308b);}(_0x08af,0xff));var _0xf08a=function(_0x2aaf0c,_0x120301){_0x2aaf0c=_0x2aaf0c-0x0;var _0x2ccbed=_0x08af[_0x2aaf0c];return _0x2ccbed;};'use strict';var util=require('util');var _=require(_0xf08a('0x0'));var BPromise=require(_0xf08a('0x1'));var uuid=require('uuid');var moment=require(_0xf08a('0x2'));var rr=require('rr');var md5=require(_0xf08a('0x3'));var Redis=require(_0xf08a('0x4'));var ut=require(_0xf08a('0x5'));var config=require(_0xf08a('0x6'));var logger=require(_0xf08a('0x7'))('dialer');var loggerBooked=require(_0xf08a('0x7'))(_0xf08a('0x8'));var loggerPredictive=require(_0xf08a('0x7'))(_0xf08a('0x9'));var loggerPredictiveCalls=require(_0xf08a('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xf08a('0x7'))(_0xf08a('0xa'));var ami=require(_0xf08a('0xb'));config['redis']=_[_0xf08a('0xc')](config[_0xf08a('0xd')],{'host':_0xf08a('0xe'),'port':0x18eb});var io=require(_0xf08a('0xf'))(new Redis(config[_0xf08a('0xd')]));var cmHopper=require(_0xf08a('0x10'));var cmHopperHistory=require(_0xf08a('0x11'));var cmHopperBlack=require(_0xf08a('0x12'));var voiceQueueRt=require(_0xf08a('0x13'));var Action=require(_0xf08a('0x14'));var History=require('./history');var Final=require(_0xf08a('0x15'));var AgentComplete=require(_0xf08a('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xf08a('0x17'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xf08a('0x18');var strategy={'rrmemory':_0xf08a('0x19'),'roundrobin':_0xf08a('0x1a')};var Sequence=function(){};Sequence[_0xf08a('0x1b')][_0xf08a('0x1c')]=function(_0x2fe7df){this['tail']=this[_0xf08a('0x1d')]?this[_0xf08a('0x1d')][_0xf08a('0x1e')](_0x2fe7df):_0x2fe7df();};function Dialer(_0x248567,_0x587ead){this['sequence']=new Sequence();this[_0xf08a('0x1f')]=_0x587ead;this[_0xf08a('0x20')]=_0x248567['voiceQueues'];this[_0xf08a('0x21')]=_0x248567[_0xf08a('0x21')];this['agents']=_0x248567[_0xf08a('0x22')];this['trunks']=_0x248567[_0xf08a('0x23')];this['maxNumberOriginate']=config[_0xf08a('0x24')]||0x2;this[_0xf08a('0x25')]={};this['actions']={};this[_0xf08a('0x26')]={};this[_0xf08a('0x27')]={};this[_0xf08a('0x28')]={};this[_0xf08a('0x29')]={};this['startProgressive']={};this[_0xf08a('0x2a')]={};this[_0xf08a('0x2b')]={};this[_0xf08a('0x2c')]={};ami['on'](_0xf08a('0x2d'),this['syncAgentConnect'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x2f'),this['syncQueueCallerAbandon'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x30'),this['syncOriginateResponse'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x31'),this[_0xf08a('0x32')]['bind'](this));ami['on'](_0xf08a('0x33'),this[_0xf08a('0xa')][_0xf08a('0x2e')](this));ami['on']('hangup',this['syncHangup'][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x34'),this[_0xf08a('0x35')][_0xf08a('0x2e')](this));ami['on']('varset',this[_0xf08a('0x36')][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x37'),this[_0xf08a('0x38')][_0xf08a('0x2e')](this));ami['on'](_0xf08a('0x39'),this[_0xf08a('0x3a')][_0xf08a('0x2e')](this));this['loopCampaigns']();this[_0xf08a('0x3b')]();}function isNotNull(_0x28604d){return _0x28604d!==null&&!_[_0xf08a('0x3c')](_0x28604d);}function checkIsLoggedIn(_0x3cc493,_0x32d261){return function(){if(_0x32d261<=0x0){_0x3cc493['message']='AGENTS_NOT_LOGGED';throw _0x3cc493[_0xf08a('0x3d')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3d24d0){return _0x3d24d0;}function checkIsActive(_0x4a54ca,_0x370efc){return function(){if(!isActive(_0x370efc)){_0x4a54ca[_0xf08a('0x3e')]=_0xf08a('0x3f');throw _0x4a54ca[_0xf08a('0x3d')]+'\x20NOT\x20Active';}};}function checkInterval(_0x42e4de){return function(){if(!isNotNull(_0x42e4de[_0xf08a('0x40')])){_0x42e4de['message']='INTERVAL_IS_NULL';throw _0x42e4de[_0xf08a('0x3d')]+_0xf08a('0x41');}if(!isNotNull(_0x42e4de[_0xf08a('0x40')][_0xf08a('0x42')])){_0x42e4de['message']=_0xf08a('0x43');throw _0x42e4de[_0xf08a('0x3d')]+_0xf08a('0x41');}if(!isNotNull(_[_0xf08a('0x44')](_0x42e4de[_0xf08a('0x40')][_0xf08a('0x42')]))){_0x42e4de[_0xf08a('0x3e')]='INTERVAL_IS_NULL';throw _0x42e4de[_0xf08a('0x3d')]+_0xf08a('0x41');}};}function msgResponse(_0x3eae0e,_0x32a8b9,_0x1f3a7f){return{'action':_0x3eae0e,'response':_0x32a8b9,'message':_0x1f3a7f,'stack':_0x1f3a7f};}function myreject(_0x4e72c9){return function(_0x89b3d6){return _0x4e72c9(msgResponse(_0xf08a('0x45'),'Error',JSON[_0xf08a('0x46')](_0x89b3d6)));};}function getSeconds(_0x47a235,_0x27d3e7){var _0x1199be=moment(_0x47a235)[_0xf08a('0x47')](0x0);var _0x271f2a=moment(_0x27d3e7)['milliseconds'](0x0);return _0x1199be[_0xf08a('0x48')](_0x271f2a,_0xf08a('0x49'));}function emit(_0x27397d,_0x1cc8c7,_0x5368f6){io['to'](_0x27397d)[_0xf08a('0x4a')](_0x1cc8c7,_0x5368f6);}function emitVoiceQueueSummary(_0xd28adc){if(_0xd28adc[_0xf08a('0x4b')]===_0xf08a('0x4c')){var _0x555aea={'id':_0xd28adc['id'],'name':_0xd28adc[_0xf08a('0x3d')],'strategy':_0xd28adc['strategy'],'answered':_0xd28adc[_0xf08a('0x4d')],'available':_0xd28adc[_0xf08a('0x4e')],'loggedIn':_0xd28adc[_0xf08a('0x4f')],'pTalking':_0xd28adc[_0xf08a('0x50')],'sumBillable':_0xd28adc[_0xf08a('0x51')],'sumDuration':_0xd28adc[_0xf08a('0x52')],'sumHoldTime':_0xd28adc[_0xf08a('0x53')]||0x0,'talking':_0xd28adc[_0xf08a('0x54')],'total':_0xd28adc['total'],'type':_0xd28adc[_0xf08a('0x4b')],'unmanaged':_0xd28adc[_0xf08a('0x55')],'abandoned':_0xd28adc[_0xf08a('0x56')],'waiting':_0xd28adc[_0xf08a('0x57')],'loggedInDb':_0xd28adc[_0xf08a('0x58')],'dialActive':_0xd28adc[_0xf08a('0x59')],'dialMethod':_0xd28adc[_0xf08a('0x5a')],'dialOriginateCallerIdName':_0xd28adc[_0xf08a('0x5b')],'dialOriginateCallerIdNumber':_0xd28adc['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xd28adc[_0xf08a('0x5c')],'dialPrefix':_0xd28adc['dialPrefix'],'outboundAnswerAgiCallsDay':_0xd28adc[_0xf08a('0x5d')],'outboundAnswerCallsDay':_0xd28adc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xd28adc[_0xf08a('0x5e')],'outboundBusyCallsDay':_0xd28adc[_0xf08a('0x5f')],'outboundCongestionCallsDay':_0xd28adc['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xd28adc[_0xf08a('0x60')],'outboundDropCallsDayCallersExit':_0xd28adc[_0xf08a('0x61')],'outboundDropCallsDayTimeout':_0xd28adc[_0xf08a('0x62')],'outboundNoAnswerCallsDay':_0xd28adc['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xd28adc[_0xf08a('0x63')],'outboundOriginateFailureCallsDay':_0xd28adc[_0xf08a('0x64')],'outboundReCallsDay':_0xd28adc[_0xf08a('0x65')],'outboundRejectCallsDay':_0xd28adc[_0xf08a('0x66')],'outboundUnknownCallsDay':_0xd28adc[_0xf08a('0x67')],'predictiveIntervalAnsweredCalls':_0xd28adc['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xd28adc[_0xf08a('0x68')],'predictiveIntervalAvgTalktime':_0xd28adc['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xd28adc[_0xf08a('0x69')],'predictiveIntervalDroppedCallsTimeout':_0xd28adc[_0xf08a('0x6a')],'predictiveIntervalErlangCalls':_0xd28adc[_0xf08a('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0xd28adc[_0xf08a('0x6c')],'predictiveIntervalHitRate':_0xd28adc[_0xf08a('0x6d')],'predictiveIntervalMultiplicativeFactor':_0xd28adc[_0xf08a('0x6e')],'predictiveIntervalPauses':_0xd28adc[_0xf08a('0x6f')],'predictiveIntervalAvailable':_0xd28adc[_0xf08a('0x70')],'predictiveIntervalTotalCalls':_0xd28adc[_0xf08a('0x71')],'message':_0xd28adc['message'],'originated':_0xd28adc[_0xf08a('0x72')],'erlangCalls':_0xd28adc[_0xf08a('0x73')],'erlangCallToSecond':_0xd28adc['erlangCallToSecond'],'erlangAbandonmentRate':_0xd28adc[_0xf08a('0x74')],'erlangBusyFactor':_0xd28adc[_0xf08a('0x75')],'startPredictive':_0xd28adc[_0xf08a('0x29')],'startProgressive':_0xd28adc[_0xf08a('0x76')]};if(_0xd28adc[_0xf08a('0x77')]){_0x555aea[_0xf08a('0x77')]={'id':_0xd28adc[_0xf08a('0x77')]['id'],'name':_0xd28adc[_0xf08a('0x77')][_0xf08a('0x3d')],'active':_0xd28adc['Trunk'][_0xf08a('0x78')],'callerid':_0xd28adc['Trunk']['callerid']};}if(_0xd28adc['Interval']){_0x555aea[_0xf08a('0x40')]={'id':_0xd28adc['Interval']['id'],'name':_0xd28adc['Interval'][_0xf08a('0x3d')]};}var _0x48d015=md5(JSON[_0xf08a('0x46')](_0x555aea));if(_0xd28adc['md5']!==_0x48d015){_0xd28adc[_0xf08a('0x3')]=_0x48d015;emit(util[_0xf08a('0x79')]('voice:queue:%s',_0x555aea[_0xf08a('0x3d')]),'voice_queue:save',_0x555aea);}}}function emitCampaignSummary(_0xf6ea45){if(_0xf6ea45[_0xf08a('0x4b')]===_0xf08a('0x7a')){emit(util[_0xf08a('0x79')](_0xf08a('0x7b'),_0xf6ea45['name']),'campaign:save',_0xf6ea45);}}function checkGetDataPredictive(_0x174faa){if(isNotNull(_0x174faa)&&!_[_0xf08a('0x44')](_0x174faa)){loggerPredictive[_0xf08a('0x7c')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xf08a('0x7c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x174faa[_0xf08a('0x71')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x7d'),_0x174faa[_0xf08a('0x7e')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x7f'),_0x174faa[_0xf08a('0x6a')]);loggerPredictive[_0xf08a('0x7c')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x174faa[_0xf08a('0x69')]);loggerPredictive['info'](_0xf08a('0x80'),_0x174faa[_0xf08a('0x68')]);loggerPredictive['info'](_0xf08a('0x81'),_0x174faa[_0xf08a('0x82')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x83'));if(_0x174faa[_0xf08a('0x71')]>0x0){if(!_['isUndefined'](_0x174faa[_0xf08a('0x82')])&&_0x174faa[_0xf08a('0x82')]>0x0){return!![];}loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x84'));if(!_[_0xf08a('0x3c')](_0x174faa[_0xf08a('0x68')])&&_0x174faa[_0xf08a('0x68')]>0x0){return!![];}loggerPredictive['info'](_0xf08a('0x85'));}else{loggerPredictive['info'](_0xf08a('0x86'));}}else{loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x87'));}return![];}function mergeDataErlangB(_0xa5b6ce){return function(_0x453ee8){loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x88'));loggerPredictive[_0xf08a('0x7c')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x453ee8['erlangCalls']);loggerPredictive[_0xf08a('0x7c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x453ee8[_0xf08a('0x89')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x8a'),_0x453ee8[_0xf08a('0x74')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x8b'),_0x453ee8[_0xf08a('0x75')]);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x8a'),_0x453ee8[_0xf08a('0x74')]);loggerPredictive['info']('---------------------------');_[_0xf08a('0x8c')](_0xa5b6ce,_0x453ee8);};}function getDiff(_0x22b89e){var _0x595550=moment()[_0xf08a('0x47')](0x0);var _0x21491c=moment(_0x22b89e)[_0xf08a('0x47')](0x0);return _0x595550[_0xf08a('0x48')](_0x21491c,_0xf08a('0x49'));}function ifInterval(_0xa68a38,_0x6020b8){if(_[_0xf08a('0x3c')](_0x6020b8)){return![];}return getDiff(_0x6020b8)<_0xa68a38*0x3c;}function freeVariablesPredictive(_0x3e330a){if(isNotNull(_0x3e330a)){if(!_[_0xf08a('0x3c')](_0x3e330a[_0xf08a('0x76')])){_0x3e330a[_0xf08a('0x76')]=undefined;loggerPredictive[_0xf08a('0x7c')](_0x3e330a[_0xf08a('0x3d')],_0xf08a('0x8d'));}if(!_['isUndefined'](_0x3e330a['startPredictive'])){_0x3e330a[_0xf08a('0x29')]=undefined;loggerPredictive[_0xf08a('0x7c')](_0x3e330a['name'],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x3e330a[_0xf08a('0x8e')])){clearInterval(_0x3e330a['handlePredictive']);_0x3e330a[_0xf08a('0x8e')]=undefined;loggerPredictive[_0xf08a('0x7c')](_0x3e330a['name'],_0xf08a('0x8f'));}}}function erlangb(_0x56d443,_0x10dd60){if(_0x10dd60===0x0){return 0x0;}var _0x3958e2=0x1;for(var _0x24d104=0x1;_0x24d104<=_0x10dd60;_0x24d104+=0x1){_0x3958e2=0x1+_0x3958e2*_0x24d104/_0x56d443;}return 0x1/_0x3958e2;}function isVoiceQueueOutbound(_0x2bb760){return _0x2bb760===_0xf08a('0x4c');}function isNotPreview(_0x5e6dcd){return _0x5e6dcd!==_0xf08a('0x1f');}function isCampaignIvr(_0x57dafb){return _0x57dafb===_0xf08a('0x7a');}function getCallerId(_0x521b5c,_0x4acf4d,_0x2861ae){if(!_[_0xf08a('0x3c')](_0x2861ae)&&typeof _0x2861ae===_0xf08a('0x90')&&!_[_0xf08a('0x44')](_0x2861ae)){if(!_[_0xf08a('0x3c')](_0x4acf4d)&&typeof _0x4acf4d==='string'&&!_['isEmpty'](_0x4acf4d)){return util[_0xf08a('0x79')](_0xf08a('0x91'),_0x4acf4d,_0x2861ae);}return util[_0xf08a('0x79')](_0xf08a('0x91'),_0x2861ae,_0x2861ae);}if(!_[_0xf08a('0x3c')](_0x521b5c)&&typeof _0x521b5c===_0xf08a('0x90')&&!_[_0xf08a('0x44')](_0x521b5c)){return _0x521b5c;}return _0xf08a('0x92');}function loggerCatchQueueSummary(_0x53da84,_0x5ad2f9){return function(_0x13e0bb){freeVariablesPredictive(_0x5ad2f9);emitVoiceQueueSummary(_0x5ad2f9);emitCampaignSummary(_0x5ad2f9);loggerSyncQueueSummary[_0xf08a('0x93')](_0x53da84,util[_0xf08a('0x94')](_0x13e0bb,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x708ae1,_0x4dc551){return function(_0x573f8f){loggerPredictive[_0xf08a('0x93')](_0x4dc551['name'],_0x708ae1);loggerPredictive[_0xf08a('0x93')](_0x573f8f[_0xf08a('0x95')]);freeVariablesPredictive(_0x4dc551);};}function loggerCatch(_0x34ce76){return function(_0x34373d){logger[_0xf08a('0x93')](_0x34ce76,util[_0xf08a('0x94')](_0x34373d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xbbb288){return _0xbbb288&&!_['isUndefined'](_0xbbb288)&&_0xbbb288[_0xf08a('0x96')]>0x0;}function decremetOriginate(_0x359459){if(!_[_0xf08a('0x3c')](_0x359459)&&_0x359459!==null){if(typeof _0x359459['originated']!==_0xf08a('0x97')){if(_0x359459['originated']>0x0){_0x359459[_0xf08a('0x72')]-=0x1;}else{logger[_0xf08a('0x93')](_0xf08a('0x98'));}}}else{logger[_0xf08a('0x93')](_0xf08a('0x99'));}}function checkContactLowerLimitOriginate(_0x515457,_0x21c111,_0x436512){if(_0x21c111>_0x436512){for(var _0x428584=0x0;_0x428584<_0x21c111-_0x436512;_0x428584+=0x1){decremetOriginate(_0x515457);}}}function loggerGetContactDialer(_0x435945,_0x3519cb,_0x4c0f6b){return function(_0x54e1be){checkContactLowerLimitOriginate(_0x3519cb,_0x4c0f6b,0x0);logger['error'](_0x435945,util[_0xf08a('0x94')](_0x54e1be,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x589788){return function(_0x445f4c){if(isNotNull(_0x445f4c)&&isNotNull(_0x445f4c[0x0])){if(_0x445f4c[0x0][_0xf08a('0x9a')]>0x0){_0x589788[_0xf08a('0x3e')]=_0xf08a('0x9b');logger[_0xf08a('0x7c')](_0xf08a('0x9c')+_0x589788[_0xf08a('0x3d')],_0x445f4c[0x0]['contactsRescheduled'],_0xf08a('0x9d'));}else{_0x589788['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf08a('0x7c')](_0xf08a('0x9e')+_0x589788[_0xf08a('0x3d')]);}}};}function notSendMessagesQueue(_0x38112b){if(_0x38112b[_0xf08a('0x9f')]){freeVariablesPredictive(_0x38112b);if(_0x38112b[_0xf08a('0x72')]===0x0&&_0x38112b[_0xf08a('0x54')]===0x0&&_0x38112b[_0xf08a('0x57')]===0x0&&(_0x38112b['pTalking']||0x0)===0x0){_0x38112b[_0xf08a('0x9f')]=![];_0x38112b[_0xf08a('0x4e')]=0x0;_0x38112b[_0xf08a('0x3e')]=_0xf08a('0x3f');loggerSyncQueueSummary['error'](_0xf08a('0xa0'),_0x38112b[_0xf08a('0x3d')],_0xf08a('0xa1'));}else{_0x38112b[_0xf08a('0x3e')]=_0xf08a('0xa2');loggerSyncQueueSummary[_0xf08a('0x93')](_0xf08a('0xa0'),_0x38112b[_0xf08a('0x3d')],_0xf08a('0xa3'));}emitVoiceQueueSummary(_0x38112b);}}function notSendMessagesCampaign(_0x2a3626){if(_0x2a3626[_0xf08a('0x9f')]){if(_0x2a3626[_0xf08a('0x72')]===0x0){_0x2a3626[_0xf08a('0x9f')]=![];_0x2a3626[_0xf08a('0x3e')]=_0xf08a('0x3f');loggerSyncQueueSummary[_0xf08a('0x93')](_0xf08a('0xa4'),_0x2a3626[_0xf08a('0x3d')],_0xf08a('0xa1'));}else{_0x2a3626[_0xf08a('0x3e')]=_0xf08a('0xa2');loggerSyncQueueSummary[_0xf08a('0x93')](_0xf08a('0xa4'),_0x2a3626[_0xf08a('0x3d')],_0xf08a('0xa3'));}emitCampaignSummary(_0x2a3626);}}function createObjHistory(_0x40adb4,_0x4e93be,_0x18f3de,_0x25507a,_0x565c4f){_0x40adb4[_0xf08a('0x3e')]=_0x18f3de;var _0x3d1fe1=new Action(_0x40adb4,_0x4e93be);var _0x3a955c=new History(_0x3d1fe1);_0x3a955c[_0xf08a('0xa5')]=_0x25507a;_0x3a955c[_0xf08a('0xa6')]=_0x565c4f;_0x3a955c['endtime']=_0x3d1fe1['starttime'];return _0x3a955c;}Dialer[_0xf08a('0x1b')][_0xf08a('0x3b')]=function(){var _0x421fa7=this;setInterval(function(){_0x421fa7[_0xf08a('0xa7')](_0x421fa7[_0xf08a('0x27')],_0xf08a('0xa8'));_0x421fa7[_0xf08a('0xa7')](_0x421fa7['actions'],_0xf08a('0xa9'));},0x32c8);};Dialer[_0xf08a('0x1b')][_0xf08a('0xa7')]=function(_0x4dcfc9,_0x47626d){var _0x2ed842=this;for(var _0x4cea49 in _0x4dcfc9){if(typeof _0x4dcfc9[_0x4cea49]!=='undefined'){this[_0xf08a('0xaa')][_0xf08a('0x1c')](function(){if(!_[_0xf08a('0xab')](_0x4dcfc9[_0x4cea49])){return ami['Action']({'action':_0xf08a('0xac'),'channel':_0x4dcfc9[_0x4cea49][_0xf08a('0xad')]})[_0xf08a('0xae')](function(_0x466bf3){if(_0x466bf3[_0xf08a('0x3e')]===_0xf08a('0xaf')){setTimeout(function(){if(_0x4dcfc9[_0x4cea49]&&_0x4dcfc9[_0x4cea49][_0xf08a('0x4b')]!==_0xf08a('0x7a')){_0x2ed842['updateOriginated'](_0x2ed842[_0xf08a('0x20')][_0x4dcfc9[_0x4cea49][_0xf08a('0xb0')]]);logger[_0xf08a('0x93')](_0xf08a('0xb1'),_0x47626d,_0x4cea49,_0x4dcfc9[_0x4cea49][_0xf08a('0xb0')]);delete _0x4dcfc9[_0x4cea49];}if(_0x4dcfc9[_0x4cea49]&&_0x4dcfc9[_0x4cea49]['type']===_0xf08a('0x7a')){_0x2ed842[_0xf08a('0xb2')](_0x2ed842['campaigns'][_0x4dcfc9[_0x4cea49]['queue']]);logger[_0xf08a('0x93')](_0xf08a('0xb3'),_0x47626d,_0x4cea49,_0x4dcfc9[_0x4cea49][_0xf08a('0xb0')]);delete _0x4dcfc9[_0x4cea49];}},0x2328);}});}});}}};Dialer[_0xf08a('0x1b')]['countReScheduled']=function(_0x58db0c){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x58db0c))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xf08a('0xb4')]=function(_0x453bd3){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](cmHopperBlack['checkIsBlackList'](_0x453bd3))['catch'](loggerCatch(_0xf08a('0xb7')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xb8')]=function(_0x350309){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopperBlack[_0xf08a('0xb8')](_0x350309))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xb9')));};Dialer['prototype'][_0xf08a('0xba')]=function(_0xe87736){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](cmHopperHistory['avgHandleTime'](_0xe87736))[_0xf08a('0xae')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xf08a('0x1b')][_0xf08a('0xbb')]=function(_0x593708){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper[_0xf08a('0xbb')](_0x593708))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xbc')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xbd')]=function(_0x4db368,_0x3385d4,_0x17e705){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper[_0xf08a('0xbd')](_0x4db368,_0x3385d4,_0x17e705))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xbe')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xbf')]=function(_0x51b193,_0x162447,_0x4dc693,_0x35deec){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper['getContactDialer'](_0x51b193,_0x162447,_0x4dc693,_0x35deec))[_0xf08a('0xae')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0xf08a('0xc0')]=function(_0x53fbd9,_0x11ae27,_0x58c58d){return BPromise['resolve']()[_0xf08a('0xb6')](cmHopper[_0xf08a('0xc0')](_0x53fbd9,_0x11ae27,_0x58c58d))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xc1')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xc2')]=function(_0x591e2b){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x591e2b))[_0xf08a('0xae')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xf08a('0xc3')]=function(_0xcc47ed){return BPromise[_0xf08a('0xb5')]()['then'](cmHopper['moveContactManagedDialer'](_0xcc47ed))[_0xf08a('0xae')](loggerCatch(_0xf08a('0xc4')));};Dialer['prototype'][_0xf08a('0xc5')]=function(_0x5711c6){return BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](cmHopperHistory['createHistory'](_0x5711c6))['catch'](loggerCatch(_0xf08a('0xc6')));};Dialer[_0xf08a('0x1b')][_0xf08a('0xb2')]=function(_0x191fcf){if(!_[_0xf08a('0x3c')](_0x191fcf)&&_0x191fcf!==null){if(typeof _0x191fcf[_0xf08a('0x72')]!=='undefined'){if(_0x191fcf[_0xf08a('0x72')]>0x0){_0x191fcf[_0xf08a('0x72')]-=0x1;}else{logger[_0xf08a('0x93')](_0xf08a('0xc7'));}}}else{logger[_0xf08a('0x93')](_0xf08a('0xc8'));}};Dialer[_0xf08a('0x1b')][_0xf08a('0xc9')]=function(_0x572498,_0x389859){var _0x43f36b=this;return function(_0x250d41){_0x43f36b[_0xf08a('0xb2')](_0x389859);logger['error'](_0x572498,util[_0xf08a('0x94')](_0x250d41,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x2d8eb7,_0x317c4c,_0x209042){var _0x53db20={'state':0x19,'statedesc':'notFound'};this[_0xf08a('0xb2')](_0x317c4c);this[_0xf08a('0xca')](_['merge'](_0x53db20,_[_0xf08a('0xcb')](_0x209042,[_0xf08a('0xcc'),_0xf08a('0xcd'),_0xf08a('0xce'),'VoiceQueueId',_0xf08a('0xcf')])),_0xf08a('0xd0'),_0xf08a('0xd1'));logger[_0xf08a('0x93')](_0x2d8eb7);};Dialer[_0xf08a('0x1b')][_0xf08a('0xd2')]=function(_0x4b0847){return _0x4b0847===_0xf08a('0xd3');};Dialer[_0xf08a('0x1b')]['isTrunkReachable']=function(_0x29c5f5){return!_[_0xf08a('0x3c')](_0x29c5f5)&&_0x29c5f5&&!_[_0xf08a('0x3c')](_0x29c5f5['name'])&&!_['isUndefined'](_0x29c5f5[_0xf08a('0x78')])&&_0x29c5f5[_0xf08a('0x78')]&&(this[_0xf08a('0x23')][util[_0xf08a('0x79')]('SIP/%s',_0x29c5f5[_0xf08a('0x3d')])]['status']===_0xf08a('0xd4')||this[_0xf08a('0x23')][util['format'](_0xf08a('0xd5'),_0x29c5f5[_0xf08a('0x3d')])][_0xf08a('0xac')]==='unmonitored');};Dialer[_0xf08a('0x1b')][_0xf08a('0xca')]=function(_0x2536ea,_0x2e0a4e,_0x29111f){this[_0xf08a('0xc5')](_0x2536ea)[_0xf08a('0xae')](loggerCatch(_0x2e0a4e));this[_0xf08a('0xc3')](_0x2536ea)[_0xf08a('0xae')](loggerCatch(_0x29111f));};Dialer['prototype'][_0xf08a('0x36')]=function(_0x3f7815){var _0x5b9a0a=this[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];var _0xc5842e;if(!_['isNil'](_0x3f7815)&&!_[_0xf08a('0xab')](_0x3f7815['variable'])&&!_[_0xf08a('0xab')](_0x3f7815[_0xf08a('0xd7')]['amdstatus'])&&_0x3f7815[_0xf08a('0xd8')]===_0xf08a('0xd9')&&_0x5b9a0a){if(_0x5b9a0a[_0xf08a('0x4b')]!=='ivr'&&this['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xda')]&&_0x3f7815['value']===_0xf08a('0xdb')){delete this[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]]);this['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;this[_0xf08a('0x20')][_0x5b9a0a['queue']][_0xf08a('0x5d')]+=0x1;_0xc5842e=new Hangup(_0x5b9a0a,_0x3f7815);_0xc5842e[_0xf08a('0xa5')]=0x12;_0xc5842e['statedesc']='HangupInAMD';_0xc5842e[_0xf08a('0xdd')]='AMD';this[_0xf08a('0xca')](_0xc5842e,'[syncHangupInAMD][createHistory]',_0xf08a('0xde'));}if(_0x5b9a0a[_0xf08a('0x4b')]!==_0xf08a('0x7a')&&this[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xda')]&&_0x3f7815['value']===_0xf08a('0xdf')){var _0x459388=this;return new BPromise(function(_0x39dec8,_0x113b81){delete _0x459388[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];_0x459388[_0xf08a('0xb2')](_0x459388['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]]);_0x459388['voiceQueues'][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;_0x459388[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0x5d')]+=0x1;var _0x2f3bb8=_0x459388[_0xf08a('0x20')][_0x5b9a0a[_0xf08a('0xb0')]];var _0xf5c4f8=new Hangup(_0x5b9a0a,_0x3f7815);_0xf5c4f8['state']=0x13;_0xf5c4f8[_0xf08a('0xa6')]=_0xf08a('0xe0');_0xf5c4f8[_0xf08a('0xdd')]='AMD';_0xf5c4f8[_0xf08a('0xe1')]+=0x1;_0xf5c4f8[_0xf08a('0xe2')]+=0x1;_0xf5c4f8[_0xf08a('0xe3')]=!![];_0x459388[_0xf08a('0xc5')](_0xf5c4f8)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xf5c4f8[_0xf08a('0xe4')]+_0xf5c4f8[_0xf08a('0xe5')]+_0xf5c4f8['countnoanswerretry']+_0xf5c4f8[_0xf08a('0xe6')]+_0xf5c4f8[_0xf08a('0xe7')]+_0xf5c4f8[_0xf08a('0xe8')]+_0xf5c4f8[_0xf08a('0xe1')]+_0xf5c4f8[_0xf08a('0xe9')]>=_0x2f3bb8[_0xf08a('0xea')]){_0x459388[_0xf08a('0xeb')](_0xf5c4f8,_0x39dec8,_0x113b81,_0xf08a('0xec'));}else{if(_0xf5c4f8[_0xf08a('0xe1')]>=_0x2f3bb8[_0xf08a('0xed')]){_0x459388['createStateFinal'](_0xf5c4f8,_0x39dec8,_0x113b81,_0xf08a('0xee'));}else{_0x459388[_0xf08a('0xbb')]({'active':![],'countmachineretry':_0xf5c4f8[_0xf08a('0xe1')],'scheduledat':moment()[_0xf08a('0xef')](_0x2f3bb8[_0xf08a('0xf0')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0xf5c4f8[_0xf08a('0xcc')],'ListId':_0xf5c4f8['ListId'],'VoiceQueueId':_0xf5c4f8[_0xf08a('0xf3')]||undefined,'CampaignId':_0xf5c4f8[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0xf4')));_0x39dec8({'reschedule':0x1});}}});}if(_0x5b9a0a['type']===_0xf08a('0x7a')&&this[_0xf08a('0x21')][_0x5b9a0a['queue']][_0xf08a('0xda')]&&_0x3f7815[_0xf08a('0xf5')]===_0xf08a('0xdb')){delete this[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]]);_0xc5842e=new Hangup(_0x5b9a0a,_0x3f7815);_0xc5842e[_0xf08a('0xa5')]=0x12;_0xc5842e['statedesc']=_0xf08a('0xf6');_0xc5842e['membername']='AMD';this[_0xf08a('0xca')](_0xc5842e,_0xf08a('0xf7'),_0xf08a('0xf8'));}if(_0x5b9a0a[_0xf08a('0x4b')]==='ivr'&&this[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]]['dialAMDActive']&&_0x3f7815[_0xf08a('0xf5')]===_0xf08a('0xdf')){var _0x459388=this;return new BPromise(function(_0xad66c9,_0x29dc38){delete _0x459388[_0xf08a('0x27')][_0x3f7815[_0xf08a('0xd6')]];_0x459388[_0xf08a('0xb2')](_0x459388[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]]);_0x459388[_0xf08a('0x21')][_0x5b9a0a[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;_0x459388['campaigns'][_0x5b9a0a[_0xf08a('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3a82fe=_0x459388['campaigns'][_0x5b9a0a[_0xf08a('0xb0')]];var _0x58b85e=new Hangup(_0x5b9a0a,_0x3f7815);_0x58b85e[_0xf08a('0xa5')]=0x13;_0x58b85e[_0xf08a('0xa6')]=_0xf08a('0xe0');_0x58b85e[_0xf08a('0xdd')]='AMD';_0x58b85e[_0xf08a('0xe1')]+=0x1;_0x58b85e[_0xf08a('0xe2')]+=0x1;_0x58b85e['amd']=!![];_0x459388[_0xf08a('0xc5')](_0x58b85e)['catch'](loggerCatch(_0xf08a('0xf9')));if(_0x58b85e['countbusyretry']+_0x58b85e['countcongestionretry']+_0x58b85e[_0xf08a('0xfa')]+_0x58b85e['countnosuchnumberretry']+_0x58b85e[_0xf08a('0xe7')]+_0x58b85e[_0xf08a('0xe8')]+_0x58b85e[_0xf08a('0xe1')]+_0x58b85e[_0xf08a('0xe9')]>=_0x3a82fe[_0xf08a('0xea')]){_0x459388[_0xf08a('0xeb')](_0x58b85e,_0xad66c9,_0x29dc38,_0xf08a('0xec'));}else{if(_0x58b85e[_0xf08a('0xe1')]>=_0x3a82fe[_0xf08a('0xed')]){_0x459388[_0xf08a('0xfb')](_0x58b85e,_0xad66c9,_0x29dc38,_0xf08a('0xee'));}else{_0x459388[_0xf08a('0xbb')]({'active':![],'countmachineretry':_0x58b85e[_0xf08a('0xe1')],'scheduledat':moment()[_0xf08a('0xef')](_0x3a82fe[_0xf08a('0xf0')],'minutes')[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x58b85e[_0xf08a('0xcc')],'ListId':_0x58b85e[_0xf08a('0xcd')],'VoiceQueueId':_0x58b85e[_0xf08a('0xf3')]||undefined,'CampaignId':_0x58b85e[_0xf08a('0xcf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xad66c9({'reschedule':0x1});}}});}}};Dialer[_0xf08a('0x1b')]['syncHangup']=function(_0x774592){var _0x2ae533=this[_0xf08a('0x27')][_0x774592[_0xf08a('0xd6')]];var _0x39be66=this;var _0x1566fb;if(_0x2ae533&&_0x2ae533['type']===_0xf08a('0x7a')){delete this['uniqueId'][_0x774592[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this[_0xf08a('0x21')][_0x2ae533['queue']]);this[_0xf08a('0x21')][_0x2ae533['queue']][_0xf08a('0xfc')]+=0x1;_0x1566fb=new Hangup(_0x2ae533,_0x774592);this[_0xf08a('0xc5')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0xfd')));this[_0xf08a('0xc3')](_0x1566fb)[_0xf08a('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x2ae533&&_0x2ae533[_0xf08a('0x4b')]!=='ivr'&&isNotNull(this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]][_0xf08a('0xfe')])){delete this[_0xf08a('0x27')][_0x774592['uniqueid']];this[_0xf08a('0xb2')](this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]]);this['voiceQueues'][_0x2ae533['queue']][_0xf08a('0xdc')]+=0x1;this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]][_0xf08a('0x5d')]+=0x1;_0x1566fb=new Hangup(_0x2ae533,_0x774592);_0x1566fb['state']=0x10;_0x1566fb[_0xf08a('0xa6')]=_0xf08a('0xff');_0x1566fb['membername']=_0xf08a('0x100');this[_0xf08a('0xc5')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0xfd')));this[_0xf08a('0xc3')](_0x1566fb)[_0xf08a('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x2ae533&&_0x2ae533[_0xf08a('0x4b')]!=='ivr'&&!isNotNull(this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]][_0xf08a('0xfe')])){delete this[_0xf08a('0x27')][_0x774592[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this['voiceQueues'][_0x2ae533['queue']]);this[_0xf08a('0x20')][_0x2ae533[_0xf08a('0xb0')]]['outboundUnknownCallsDay']+=0x1;_0x1566fb=new Hangup(_0x2ae533,_0x774592);_0x1566fb[_0xf08a('0xa5')]=0xc;_0x1566fb[_0xf08a('0xa6')]=_0x774592[_0xf08a('0x101')];_0x1566fb[_0xf08a('0xdd')]='Unknow';this[_0xf08a('0xc5')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0xfd')));this[_0xf08a('0xc3')](_0x1566fb)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x102')));}};Dialer[_0xf08a('0x1b')][_0xf08a('0x32')]=function(_0x2e885b){var _0x4aaee3=this[_0xf08a('0x27')][_0x2e885b['uniqueid']];var _0x1ce140=this;if(this[_0xf08a('0x20')][_0x2e885b[_0xf08a('0xb0')]]){if(_0x4aaee3&&_0x4aaee3[_0xf08a('0x4b')]!==_0xf08a('0x7a')){delete this[_0xf08a('0x27')][_0x2e885b[_0xf08a('0xd6')]];this[_0xf08a('0x20')][_0x2e885b[_0xf08a('0xb0')]][_0xf08a('0xdc')]+=0x1;var _0x2bef5c=new AgentComplete(_0x4aaee3,_0x2e885b);if(_0x2e885b[_0xf08a('0x103')]==='agent'){_0x2bef5c[_0xf08a('0x104')]=this['voiceQueues'][_0x2e885b[_0xf08a('0xb0')]][_0xf08a('0x105')]&&this[_0xf08a('0x20')][_0x2e885b[_0xf08a('0xb0')]][_0xf08a('0x106')]?moment()[_0xf08a('0x79')](_0xf08a('0xf2')):undefined;}this['createHistory'](_0x2bef5c)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x107')));this[_0xf08a('0xc3')](_0x2bef5c)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x108')));}}};Dialer[_0xf08a('0x1b')]['syncAgentConnect']=function(_0x722335){if(this[_0xf08a('0x20')][_0x722335['queue']]){if(this[_0xf08a('0x27')][_0x722335[_0xf08a('0xd6')]]&&this['uniqueId'][_0x722335['uniqueid']]['type']!==_0xf08a('0x7a')){this[_0xf08a('0xb2')](this['voiceQueues'][_0x722335[_0xf08a('0xb0')]]);this[_0xf08a('0x27')][_0x722335[_0xf08a('0xd6')]][_0xf08a('0x109')]=moment()['format'](_0xf08a('0xf2'));}}};Dialer['prototype'][_0xf08a('0x10a')]=function(_0xdfd2ca){this['createHistory'](_0xdfd2ca)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xf08a('0xc3')](_0xdfd2ca)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x10b')));};Dialer[_0xf08a('0x1b')][_0xf08a('0x10c')]=function(_0x209716){var _0x477e8c=this[_0xf08a('0x27')][_0x209716[_0xf08a('0xd6')]];var _0x57bfd6=this;if(this[_0xf08a('0x20')][_0x209716['queue']]){if(_0x477e8c&&_0x477e8c[_0xf08a('0x4b')]!=='ivr'){delete this[_0xf08a('0x27')][_0x209716[_0xf08a('0xd6')]];this[_0xf08a('0xb2')](this['voiceQueues'][_0x209716[_0xf08a('0xb0')]]);_0x477e8c[_0xf08a('0x10d')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4b788a=new QueueCallerAbandon(_0x477e8c,_0x209716);if(getSeconds(_0x477e8c[_0xf08a('0x10d')],_0x477e8c[_0xf08a('0x10e')])>=_0x477e8c[_0xf08a('0x10f')]){this['voiceQueues'][_0x209716['queue']][_0xf08a('0x6a')]+=0x1;this['voiceQueues'][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x62')]+=0x1;this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4b788a[_0xf08a('0xa5')]=0xa;_0x4b788a[_0xf08a('0xa6')]=_0xf08a('0x110');_0x4b788a['dropreason']=_0xf08a('0x111');_0x4b788a[_0xf08a('0x104')]=this['voiceQueues'][_0x209716['queue']][_0xf08a('0x105')]?moment()[_0xf08a('0x79')](_0xf08a('0xf2')):undefined;_0x4b788a[_0xf08a('0xe7')]+=0x1;_0x4b788a[_0xf08a('0xe2')]+=0x1;if(_0x4b788a[_0xf08a('0xe7')]>=this[_0xf08a('0x20')][_0x209716['queue']][_0xf08a('0x112')]){this[_0xf08a('0x10a')](_0x4b788a);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x4b788a['countdropretry'],'scheduledat':moment()['add'](this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x113')],_0xf08a('0xf1'))[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x477e8c[_0xf08a('0xcc')],'ListId':_0x477e8c[_0xf08a('0xcd')],'VoiceQueueId':_0x477e8c[_0xf08a('0xf3')]||undefined,'CampaignId':_0x477e8c[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x114')));var _0x3fdc52=new History(_0x4b788a);_0x3fdc52[_0xf08a('0xa5')]=0xa;_0x3fdc52['statedesc']=_0xf08a('0x110');_0x3fdc52[_0xf08a('0x115')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fdc52[_0xf08a('0x116')]=_0x3fdc52['starttime'];_0x3fdc52[_0xf08a('0x117')]=_0x4b788a[_0xf08a('0x117')];_0x3fdc52['calleridnum']=_0x4b788a[_0xf08a('0x118')];this[_0xf08a('0xc5')](_0x3fdc52)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x69')]+=0x1;this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x61')]+=0x1;_0x4b788a[_0xf08a('0xa5')]=0xb;_0x4b788a[_0xf08a('0xa6')]=_0xf08a('0x119');_0x4b788a[_0xf08a('0x11a')]='CALLEREXIT';_0x4b788a[_0xf08a('0xe8')]+=0x1;_0x4b788a[_0xf08a('0xe2')]+=0x1;if(_0x4b788a[_0xf08a('0xe8')]>=this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]]['dialAbandonedMaxRetry']){this[_0xf08a('0x10a')](_0x4b788a);}else{this[_0xf08a('0xbb')]({'active':![],'countabandonedretry':_0x4b788a[_0xf08a('0xe8')],'scheduledat':moment()['add'](this[_0xf08a('0x20')][_0x209716[_0xf08a('0xb0')]][_0xf08a('0x11b')],'minutes')[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x477e8c[_0xf08a('0xcc')],'ListId':_0x477e8c[_0xf08a('0xcd')],'VoiceQueueId':_0x477e8c[_0xf08a('0xf3')]||undefined,'CampaignId':_0x477e8c[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x11c')));var _0x3fdc52=new History(_0x4b788a);_0x3fdc52['state']=0xb;_0x3fdc52[_0xf08a('0xa6')]='Abandoned';_0x3fdc52[_0xf08a('0x115')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fdc52[_0xf08a('0x116')]=_0x3fdc52[_0xf08a('0x115')];_0x3fdc52[_0xf08a('0x117')]=_0x4b788a[_0xf08a('0x117')];_0x3fdc52[_0xf08a('0x118')]=_0x4b788a[_0xf08a('0x118')];this[_0xf08a('0xc5')](_0x3fdc52)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xf08a('0x1b')][_0xf08a('0x35')]=function(_0x223ac6){if(this['actions'][_0x223ac6[_0xf08a('0xd6')]]){this['actions'][_0x223ac6['uniqueid']][_0xf08a('0xad')]=_0x223ac6[_0xf08a('0xad')];}if(this[_0xf08a('0x27')][_0x223ac6[_0xf08a('0xd6')]]){this[_0xf08a('0x27')][_0x223ac6[_0xf08a('0xd6')]][_0xf08a('0xad')]=_0x223ac6[_0xf08a('0xad')];}};Dialer[_0xf08a('0x1b')][_0xf08a('0x38')]=function(_0x34b1b8){if(strategy[this[_0xf08a('0x20')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']]['strategy']]==='roundrobin'){if(this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]&&_[_0xf08a('0xab')](this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]][_0xf08a('0x11f')])&&_0x34b1b8['status']==='1'&&_0x34b1b8[_0xf08a('0x120')]==='0'){if(this['agents'][_0x34b1b8[_0xf08a('0x121')]]){if(!this[_0xf08a('0x22')][_0x34b1b8[_0xf08a('0x121')]][_0xf08a('0x11f')]){this[_0xf08a('0x22')][_0x34b1b8[_0xf08a('0x121')]][_0xf08a('0x11f')]=!![];this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['locked']=!![];this['actions'][_0x34b1b8[_0xf08a('0x11e')]][_0xf08a('0x121')]=_0x34b1b8[_0xf08a('0x121')];}}}}else if((strategy[this[_0xf08a('0x20')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']][_0xf08a('0x122')]]||'rrmemory')==='rrmemory'){if(this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]){if(this[_0xf08a('0x22')][_0x34b1b8[_0xf08a('0x121')]]){this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['stateinterface']=_0x34b1b8[_0xf08a('0x121')];if(_['isNil'](this[_0xf08a('0x2b')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']])){this[_0xf08a('0x2b')][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]]['queue']]=[];}this['queueBooked'][this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]][_0xf08a('0xb0')]][_0xf08a('0x123')](_[_0xf08a('0x8c')](_[_0xf08a('0xcb')](this[_0xf08a('0x11d')][_0x34b1b8[_0xf08a('0x11e')]],[_0xf08a('0x124'),_0xf08a('0x121')]),{'status':_0x34b1b8[_0xf08a('0xac')],'paused':_0x34b1b8[_0xf08a('0x120')]}));}}}};function unlockQueueStatus(_0x5254e0,_0x51d4bd){setTimeout(function(){if(_[_0xf08a('0x3c')](_0x5254e0[_0xf08a('0x125')])){loggerBooked[_0xf08a('0x93')]('[unlockQueueStatus][undefined]',_0x51d4bd);}_0x5254e0[_0xf08a('0x125')]=!![];loggerBooked[_0xf08a('0x7c')](_0xf08a('0x126'),_0x51d4bd,JSON[_0xf08a('0x46')](_[_0xf08a('0xcb')](_0x5254e0,[_0xf08a('0x3d'),_0xf08a('0x125')])));},0x1f3);}Dialer['prototype'][_0xf08a('0x3a')]=function(_0xdfc99){var _0x434c91=this;var _0x22f823=_0x434c91[_0xf08a('0x20')][_0x434c91[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]];if(strategy[this[_0xf08a('0x20')][this['actions'][_0xdfc99['actionid']][_0xf08a('0xb0')]][_0xf08a('0x122')]]===_0xf08a('0x1a')){if(this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]&&this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0x121')]){this[_0xf08a('0x1f')]['run'](this['actions'][_0xdfc99[_0xf08a('0x11e')]]['idHopper'],this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0x121')])[_0xf08a('0xae')](function(_0xf73b23){logger[_0xf08a('0x93')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0xf73b23,{'showHidden':![],'depth':null}));})['finally'](function(){_0x434c91[_0xf08a('0xb2')](_0x434c91[_0xf08a('0x20')][_0x434c91['actions'][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]]);_0x434c91[_0xf08a('0x22')][_0x434c91[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0x121')]]['locked']=![];delete _0x434c91[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]];unlockQueueStatus(_0x22f823);});}else{this[_0xf08a('0xb2')](this['voiceQueues'][this['actions'][_0xdfc99['actionid']]['queue']]);this[_0xf08a('0xbb')]({'active':![],'ContactId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]['ContactId'],'ListId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xcd')],'VoiceQueueId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x127')));delete this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]];unlockQueueStatus(_0x22f823);}}else if((strategy[this[_0xf08a('0x20')][this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]][_0xf08a('0x122')]]||_0xf08a('0x19'))===_0xf08a('0x19')){var _0x453209;if(this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]&&!_['isEmpty'](this['queueBooked'][this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]])){if(this[_0xf08a('0x2c')][_0x434c91['actions'][_0xdfc99['actionid']]['queue']]){this[_0xf08a('0x2c')][_0x434c91['actions'][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]]=this[_0xf08a('0x2c')][this[_0xf08a('0x11d')][_0xdfc99['actionid']][_0xf08a('0xb0')]]?this[_0xf08a('0x2c')][this['actions'][_0xdfc99['actionid']][_0xf08a('0xb0')]]:this[_0xf08a('0x2b')][this[_0xf08a('0x11d')][_0xdfc99['actionid']][_0xf08a('0xb0')]]?this[_0xf08a('0x2b')][this['actions'][_0xdfc99[_0xf08a('0x11e')]][_0xf08a('0xb0')]][_0xf08a('0x128')]||0x0:0x0;}this['queueBooked'][this[_0xf08a('0x11d')][_0xdfc99[_0xf08a('0x11e')]]['queue']][_0xf08a('0x128')]=this[_0xf08a('0x2c')][this[_0xf08a('0x11d')][_0xdfc99['actionid']]['queue']];for(var _0x5a7d66=0x0;_0x5a7d66=0x0;})[_0xf08a('0xae')](myreject(_0x483d28)));}}else{_0x3e9eca[_0xf08a('0x123')](ami['Action']({'action':_0xf08a('0x148'),'command':util[_0xf08a('0x79')]('iftime\x20%s,%s',_0x214cd8,!_['isUndefined'](config[_0xf08a('0x144')][_0x2948a2])?_0x2948a2:'')})[_0xf08a('0xb6')](function(_0x3d61b3){return _0x3d61b3[_0xf08a('0x145')]['indexOf'](_0xf08a('0x147'))>=0x0;})[_0xf08a('0xae')](myreject(_0x483d28)));}BPromise[_0xf08a('0x149')](_0x3e9eca)['then'](function(_0x155f35){var _0x5e7487=_[_0xf08a('0x14a')](_0x155f35);if(_0x5e7487){return _0x20c503(_0x5e7487);}else{_0x2023f7[_0xf08a('0x3e')]=_0x203f0c?'GLOBAL_INTERVAL_IS_OVERTIME':_0xf08a('0x14b');return _0x483d28(msgResponse(_0xf08a('0x14c'),_0xf08a('0x13d'),_0xf08a('0x14d')+_0x203f0c+'\x20'+_0x361855+_0xf08a('0x14e')+util[_0xf08a('0x94')](_0x214cd8,{'showHidden':![],'depth':null})+_0xf08a('0x14f')+_0x2948a2));}})[_0xf08a('0xae')](function(_0x5672d1){return _0x483d28(msgResponse(_0xf08a('0x13b'),_0xf08a('0x13d'),JSON['stringify'](_0x5672d1)));});});};Dialer[_0xf08a('0x1b')]['checkDialMethod']=function(_0x3326c5){var _0xfba845=this;return function(){switch(_0x3326c5['dialMethod']){case'progressive':freeVariablesPredictive(_0x3326c5);_0xfba845[_0xf08a('0x150')](_0x3326c5,0x1);break;case _0xf08a('0x151'):freeVariablesPredictive(_0x3326c5);_0xfba845['handlePower'](_0x3326c5,_0x3326c5[_0xf08a('0x152')]);break;case _0xf08a('0x9'):_0xfba845[_0xf08a('0x9')](_0x3326c5);break;case _0xf08a('0x8'):freeVariablesPredictive(_0x3326c5);_0xfba845[_0xf08a('0x150')](_0x3326c5,0x1);break;default:freeVariablesPredictive(_0x3326c5);logger[_0xf08a('0x93')](_0xf08a('0x153'),_0x3326c5['name'],_0xf08a('0x154'));}};};Dialer[_0xf08a('0x1b')][_0xf08a('0x155')]=function(_0x7f0952){var _0x41d6da=this;return function(){_0x41d6da[_0xf08a('0x156')](_0x7f0952);};};Dialer['prototype'][_0xf08a('0xa')]=function(_0x129cd8){var _0x556231=this;if(isNotPreview(_0x129cd8[_0xf08a('0x5a')])){if(isVoiceQueueOutbound(_0x129cd8[_0xf08a('0x4b')])&&isActive(_0x129cd8[_0xf08a('0x59')])){_0x129cd8['sendMessageOneNotActive']=!![];BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](checkIsLoggedIn(_0x129cd8,_0x129cd8[_0xf08a('0x4f')]))['then'](checkIsActive(_0x129cd8,_0x129cd8['dialActive']))[_0xf08a('0xb6')](checkInterval(_0x129cd8))[_0xf08a('0xb6')](_0x556231['checkIsTrunkReachable'](_0x129cd8))[_0xf08a('0xb6')](_0x556231['checkIfTime'](_0x129cd8[_0xf08a('0x157')],_0x129cd8[_0xf08a('0x158')],_0x129cd8['name'],_0x129cd8))[_0xf08a('0xb6')](_0x556231[_0xf08a('0x13c')](_0x129cd8[_0xf08a('0x40')],_0x129cd8[_0xf08a('0x158')],_0x129cd8['name'],_0x129cd8))[_0xf08a('0xb6')](_0x556231[_0xf08a('0x159')](_0x129cd8))['catch'](loggerCatchQueueSummary(_0xf08a('0x15a'),_0x129cd8));}else{notSendMessagesQueue(_0x129cd8);}}else{freeVariablesPredictive(_0x129cd8);}};Dialer[_0xf08a('0x1b')][_0xf08a('0x136')]=function(){var _0x5c1f27=this;var _0x20f425;for(var _0x5a77e0 in this[_0xf08a('0x21')]){if(typeof this['campaigns'][_0x5a77e0]!==_0xf08a('0x97')){_0x20f425=this[_0xf08a('0x21')][_0x5a77e0];if(isCampaignIvr(_0x20f425['type'])&&isActive(_0x20f425[_0xf08a('0x78')])){_0x20f425['sendMessageOneNotActive']=!![];BPromise[_0xf08a('0xb5')]()[_0xf08a('0xb6')](checkIsActive(_0x20f425,_0x20f425[_0xf08a('0x78')]))[_0xf08a('0xb6')](checkInterval(_0x20f425))[_0xf08a('0xb6')](_0x5c1f27[_0xf08a('0x137')](_0x20f425))[_0xf08a('0xb6')](_0x5c1f27[_0xf08a('0x15b')](_0x20f425[_0xf08a('0x157')],_0x20f425[_0xf08a('0x158')],_0x20f425[_0xf08a('0x3d')],_0x20f425))[_0xf08a('0xb6')](_0x5c1f27['checkIfTimeIntervals'](_0x20f425[_0xf08a('0x40')],_0x20f425[_0xf08a('0x158')],_0x20f425[_0xf08a('0x3d')],_0x20f425))[_0xf08a('0xb6')](_0x5c1f27[_0xf08a('0x155')](_0x20f425))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x20f425));}else{notSendMessagesCampaign(_0x20f425);}}}};function getCallerIdRandom(_0x4e6dd5,_0x3aac11){var _0x206018;var _0xce1136;var _0x3be4bd;if(_0x3aac11<=0x0){_0x3aac11=0x1;}_0x206018=new RegExp(_0xf08a('0x15c')+_0x3aac11+'}$');_0xce1136=Math[_0xf08a('0x15d')](0xa,_0x3aac11-0x1);_0x3be4bd=Math['pow'](0xa,_0x3aac11)-0x1;return util[_0xf08a('0x79')]('%s',_[_0xf08a('0x15e')](_0x4e6dd5,_0x206018,_[_0xf08a('0x15f')](_0xce1136,_0x3be4bd)));}function extractCalleridName(_0x4fc400){var _0x3cab0c=_0x4fc400['match'](/"(.*?)"/);return _0x3cab0c?_0x3cab0c[0x1]:_0x4fc400;}function extractCalleridNumber(_0x44ec57){var _0x415ca8=_0x44ec57[_0xf08a('0x160')](/<(.*?)>/);return _0x415ca8?_0x415ca8[0x1]:_0x44ec57;}Dialer['prototype'][_0xf08a('0x161')]=function(_0x44d69a,_0x3da716){var _0xc5f6d6=this;var _0x2f1b1c=uuid['v4']();this['actions'][_0x2f1b1c]=new Action(_0x44d69a,_0x3da716,_0x2f1b1c);return new BPromise(function(_0xbe122,_0x52edd2){if(_[_0xf08a('0x3c')](_0x44d69a)&&typeof _0x44d69a!==_0xf08a('0x162')){return _0x52edd2(msgResponse(_0xf08a('0x163'),_0xf08a('0x13d'),_0xf08a('0x164')));}if(_[_0xf08a('0x3c')](_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')])||_0x3da716['Contact'][_0xf08a('0x166')]===null){return _0x52edd2(msgResponse(_0xf08a('0x163'),_0xf08a('0x13d'),'contact\x20is\x20undefine'));}var _0x36c7c7={'XMD-CALLERID':_0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c][_0xf08a('0x167')](),'XMD-AGI':_0x44d69a[_0xf08a('0xfe')]?util[_0xf08a('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x44d69a[_0xf08a('0xfe')]):_0xf08a('0x168'),'XMD-AGIAFTER':_0x44d69a['dialQueueProject2']?util['format'](_0xf08a('0x169'),ipAgi,_0x44d69a[_0xf08a('0x105')]):'NONE','XMD-QUEUE':_0x44d69a['type']===_0xf08a('0x4c')?util[_0xf08a('0x79')](_0xf08a('0x16a'),_0x44d69a[_0xf08a('0x3d')],_0x44d69a[_0xf08a('0x16b')]||'',_0x44d69a[_0xf08a('0x106')]?'c':'',_0x44d69a[_0xf08a('0x10f')]||0x3):'NONE','XMD-CONTACTID':_0x3da716[_0xf08a('0xcc')],'XMD-CDRTYPE':_0xf08a('0x16c'),'CALLERID(all)':_0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c][_0xf08a('0x167')](),'XMD-AMD':_0x44d69a[_0xf08a('0xda')]?'ACTIVE':_0xf08a('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x44d69a[_0xf08a('0xda')]){_0x36c7c7[_0xf08a('0x16d')]=_0x44d69a[_0xf08a('0x16e')]||0x9c4;_0x36c7c7[_0xf08a('0x16f')]=_0x44d69a[_0xf08a('0x170')]||0x5dc;_0x36c7c7['XMD-AMDAFTERGREETINGSILENCE']=_0x44d69a[_0xf08a('0x171')]||0x320;_0x36c7c7[_0xf08a('0x172')]=_0x44d69a[_0xf08a('0x173')]||0x1388;_0x36c7c7[_0xf08a('0x174')]=_0x44d69a[_0xf08a('0x175')]||0x64;_0x36c7c7[_0xf08a('0x176')]=_0x44d69a[_0xf08a('0x177')]||0x32;_0x36c7c7[_0xf08a('0x178')]=_0x44d69a['dialAMDMaximumNumberOfWords']||0x3;_0x36c7c7[_0xf08a('0x179')]=_0x44d69a[_0xf08a('0x17a')]||0x100;_0x36c7c7['XMD-AMDMAXIMUMWORDLENGTH']=_0x44d69a[_0xf08a('0x17b')]||0x1388;}if(_0x44d69a['type']===_0xf08a('0x4c')){_0x36c7c7[_0xf08a('0x17c')]=_0x3da716[_0xf08a('0xf3')];}else{_0x36c7c7[_0xf08a('0x17d')]=_0x3da716[_0xf08a('0xcf')];}for(var _0x47381a in _0x3da716[_0xf08a('0x165')]){if(typeof _0x3da716['Contact'][_0x47381a]!==_0xf08a('0x97')){if(isNotNull(_0x3da716[_0xf08a('0x165')][_0x47381a])&&_0x47381a!=='id'&&_0x47381a!==_0xf08a('0x17e')&&_0x47381a!=='createdAt'&&_0x47381a!==_0xf08a('0x17f')){_0x36c7c7[util[_0xf08a('0x79')](_0xf08a('0x180'),_0xf08a('0x181'),_['toUpper'](_0x47381a))]=_0x3da716['Contact'][_0x47381a];}}}var _0x2dab29=_0xc5f6d6['isTrunkReachable'](_0x44d69a['Trunk'])?getCallerId(_0x44d69a[_0xf08a('0x77')]['callerid'],_0x44d69a[_0xf08a('0x5b')],_0x44d69a[_0xf08a('0x182')]>0x0?getCallerIdRandom(_0x44d69a[_0xf08a('0x183')],_0x44d69a[_0xf08a('0x182')]):_0x44d69a['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x44d69a[_0xf08a('0x184')])?_0x44d69a[_0xf08a('0x77')]['callerid']:_0x44d69a['TrunkBackup']['callerid'],_0x44d69a['dialOriginateCallerIdName'],_0x44d69a[_0xf08a('0x182')]>0x0?getCallerIdRandom(_0x44d69a[_0xf08a('0x183')],_0x44d69a[_0xf08a('0x182')]):_0x44d69a[_0xf08a('0x183')]);if(_0x2dab29){_0x36c7c7[_0xf08a('0x185')]=_0xc5f6d6['actions'][_0x2f1b1c][_0xf08a('0x186')]=extractCalleridName(_0x2dab29);_0x36c7c7[_0xf08a('0x187')]=_0xc5f6d6['actions'][_0x2f1b1c][_0xf08a('0x188')]=extractCalleridNumber(_0x2dab29);}return ami['Action']({'actionid':_0x2f1b1c,'action':_0xf08a('0x163'),'channel':_0xc5f6d6[_0xf08a('0x138')](_0x44d69a[_0xf08a('0x77')])?util['format'](_0xf08a('0x189'),_0x44d69a[_0xf08a('0x77')][_0xf08a('0x3d')],isNotNull(_0x44d69a[_0xf08a('0x18a')])?_0x44d69a[_0xf08a('0x18a')][_0xf08a('0x18b')]()||'':'',_0x44d69a['dialCutDigit']>0x0?_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')][_0xf08a('0x18c')](_0x44d69a[_0xf08a('0x18d')]):_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')]):util['format'](_0xf08a('0x189'),_[_0xf08a('0xab')](_0x44d69a[_0xf08a('0x184')])?_0x44d69a[_0xf08a('0x77')]['name']:_0x44d69a['TrunkBackup'][_0xf08a('0x3d')],isNotNull(_0x44d69a[_0xf08a('0x18a')])?_0x44d69a['dialPrefix'][_0xf08a('0x18b')]()||'':'',_0x44d69a['dialCutDigit']>0x0?_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')][_0xf08a('0x18c')](_0x44d69a['dialCutDigit']):_0x3da716[_0xf08a('0x165')][_0xf08a('0x166')]),'callerid':_0x2dab29,'Exten':_0xf08a('0xd9'),'Context':_0xf08a('0x18e'),'Priority':'1','variable':_0x36c7c7,'timeout':(_0x44d69a[_0xf08a('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2f1b1c})[_0xf08a('0xb6')](function(_0x2b9dd2){return _0xbe122(_0x2b9dd2);})[_0xf08a('0xae')](function(_0x700c03){_0x44d69a[_0xf08a('0x64')]+=0x1;var _0x10bf58=new History(_0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c]);logger[_0xf08a('0x93')](util[_0xf08a('0x79')]('[originateError]:\x20%s',JSON['stringify'](_0x700c03)));_0x10bf58['state']=0xe;_0x10bf58[_0xf08a('0xa6')]=_0xf08a('0x18f');_0x10bf58[_0xf08a('0x115')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x10bf58[_0xf08a('0x116')]=_0x10bf58[_0xf08a('0x115')];_0xc5f6d6[_0xf08a('0xc5')](_0x10bf58)[_0xf08a('0xae')](loggerCatch('[originate][error]'));_0xc5f6d6[_0xf08a('0xc3')](_0x10bf58)['catch'](loggerCatch(_0xf08a('0x190')))[_0xf08a('0x1e')](function(){delete _0xc5f6d6[_0xf08a('0x11d')][_0x2f1b1c];return _0x52edd2(msgResponse(_0xf08a('0x163'),'Error',_0xf08a('0x191')));});});});};Dialer[_0xf08a('0x1b')][_0xf08a('0x192')]=function(_0x515b73){var _0x3cc279=this['actions'][_0x515b73[_0xf08a('0x11e')]];if(_0x3cc279){delete this['actions'][_0x515b73[_0xf08a('0x11e')]];_0x3cc279[_0xf08a('0x10e')]=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x337259=_0x3cc279[_0xf08a('0x4b')]===_0xf08a('0x7a')?this[_0xf08a('0x21')][_0x3cc279[_0xf08a('0xb0')]]:this[_0xf08a('0x20')][_0x3cc279['getQueue']()];if(!this['isSuccess'](_0x515b73[_0xf08a('0x193')])){this[_0xf08a('0xb2')](_0x337259);return this[_0xf08a('0x194')](_0x3cc279,_0x337259,_0x515b73)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x195')));}this['uniqueId'][_0x515b73['uniqueid']]=_0x3cc279;}};Dialer[_0xf08a('0x1b')][_0xf08a('0x196')]=function(_0x5f116b,_0xc549e3,_0x501de9){var _0x592307=new History(_0xc549e3);if(_0x592307[_0xf08a('0xe4')]+_0x592307[_0xf08a('0xe5')]+_0x592307[_0xf08a('0xfa')]+_0x592307[_0xf08a('0xe6')]+_0x592307[_0xf08a('0xe7')]+_0x592307[_0xf08a('0xe8')]+_0x592307[_0xf08a('0xe1')]+_0x592307[_0xf08a('0xe9')]>=_0x501de9[_0xf08a('0xea')]-0x1){return!![];}switch(_0x5f116b){case 0x3:if(_0x592307[_0xf08a('0xfa')]>=_0x501de9[_0xf08a('0x197')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countnoanswerretry':_0x592307[_0xf08a('0xfa')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x198')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307['VoiceQueueId']||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x199')));break;case 0x5:if(_0x592307['countbusyretry']>=_0x501de9[_0xf08a('0x19a')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countbusyretry':_0x592307[_0xf08a('0xe4')]+=0x1,'scheduledat':moment()['add'](_0x501de9[_0xf08a('0x19b')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307['ListId'],'VoiceQueueId':_0x592307['VoiceQueueId']||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x19c')));break;case 0x8:if(_0x592307['countcongestionretry']>=_0x501de9[_0xf08a('0x19d')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countcongestionretry':_0x592307['countcongestionretry']+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x19e')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x19f')));break;case 0x0:if(_0x592307[_0xf08a('0xe6')]>=_0x501de9[_0xf08a('0x1a0')]-0x1){return!![];}else{this[_0xf08a('0xbb')]({'active':![],'countnosuchnumberretry':_0x592307['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x501de9[_0xf08a('0x1a1')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x592307[_0xf08a('0xe7')]>=_0x501de9[_0xf08a('0x112')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countdropretry':_0x592307[_0xf08a('0xe7')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x113')],_0xf08a('0xf1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x114')));break;case 0xb:if(_0x592307[_0xf08a('0xe8')]>=_0x501de9['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x592307[_0xf08a('0xe8')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9['dialAbandonedRetryFrequency'],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307['ContactId'],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307['VoiceQueueId']||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x11c')));break;case 0x13:if(_0x592307['countmachineretry']>=_0x501de9[_0xf08a('0xed')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countmachineretry':_0x592307[_0xf08a('0xe1')]+=0x1,'scheduledat':moment()['add'](_0x501de9['dialMachineRetryFrequency'],'minutes')[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307[_0xf08a('0xcc')],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x592307[_0xf08a('0xe9')]>=_0x501de9[_0xf08a('0x1a2')]-0x1){return!![];}this[_0xf08a('0xbb')]({'active':![],'countagentrejectretry':_0x592307[_0xf08a('0xe9')]+=0x1,'scheduledat':moment()[_0xf08a('0xef')](_0x501de9[_0xf08a('0x1a3')],_0xf08a('0xf1'))[_0xf08a('0x79')](_0xf08a('0xf2')),'ContactId':_0x592307['ContactId'],'ListId':_0x592307[_0xf08a('0xcd')],'VoiceQueueId':_0x592307[_0xf08a('0xf3')]||undefined,'CampaignId':_0x592307['CampaignId']||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1a4')));break;default:return!![];}};Dialer[_0xf08a('0x1b')]['callProgressDetecting']=function(_0x1c16a3,_0x1537e5,_0x5899b4){var _0x331c50=this;var _0xa56156=new History(_0x1c16a3);return new BPromise(function(_0x44601e,_0x15e818){if(_[_0xf08a('0x3c')](_0x1537e5)&&typeof _0x1537e5!==_0xf08a('0x162')){return _0x15e818(msgResponse(_0xf08a('0x1a5'),_0xf08a('0x13d'),_0xf08a('0x1a6')));}if(_[_0xf08a('0x3c')](_0x5899b4)&&typeof _0x5899b4!=='object'){return _0x15e818(msgResponse('[callProgressDetecting]','Failure',_0xf08a('0x1a7')));}switch(_0x5899b4[_0xf08a('0x103')]){case'0':_0x1537e5[_0xf08a('0x63')]+=0x1;_0xa56156[_0xf08a('0xa5')]=0x0;_0xa56156[_0xf08a('0xa6')]=_0xf08a('0x1a8');_0xa56156[_0xf08a('0xe6')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1a9'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1ab')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x331c50[_0xf08a('0x196')](0x0,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe6')]>=_0x1537e5[_0xf08a('0x1a0')]){_0x331c50['createStateFinal'](_0xa56156,_0x44601e,_0x15e818,'reason\x200\x20no\x20such\x20number....');}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1ac'));}}break;case'3':_0x1537e5[_0xf08a('0x1ad')]+=0x1;_0xa56156['state']=0x3;_0xa56156['statedesc']=_0xf08a('0x1ae');_0xa56156[_0xf08a('0xfa')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1af'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1b0')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1b1')));if(_0x331c50[_0xf08a('0x196')](0x3,_0x1c16a3,_0x1537e5)){if(_0xa56156['countnoanswerretry']>=_0x1537e5[_0xf08a('0x197')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1b2'));}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1537e5[_0xf08a('0x5f')]+=0x1;_0xa56156[_0xf08a('0xa5')]=0x5;_0xa56156[_0xf08a('0xa6')]=_0xf08a('0x1b3');_0xa56156[_0xf08a('0xe4')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1b4'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1b5')));_0x331c50[_0xf08a('0xc5')](_0xa56156)['catch'](loggerCatch(_0xf08a('0x1b6')));if(_0x331c50['checkRetriveMax'](0x5,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe4')]>=_0x1537e5[_0xf08a('0x19a')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1b7'));}else{_0x331c50['stateGlobal'](_0xa56156,_0x44601e,_0x15e818,'reason\x205\x20busy');}}break;case'8':_0x1537e5[_0xf08a('0x1b8')]+=0x1;_0xa56156['state']=0x8;_0xa56156['statedesc']=_0xf08a('0x1b9');_0xa56156[_0xf08a('0xe5')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1ba'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1bb')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1bc')));if(_0x331c50[_0xf08a('0x196')](0x8,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe5')]>=_0x1537e5[_0xf08a('0x19d')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1bd'));}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1bd'));}}break;case'11':_0x1537e5['outboundAbandonedCallsDay']+=0x1;_0xa56156[_0xf08a('0xa5')]=0xb;_0xa56156[_0xf08a('0xa6')]=_0xf08a('0x119');_0xa56156[_0xf08a('0xe8')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;_0x331c50['createHistory'](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1be')));if(_0x331c50[_0xf08a('0x196')](0xb,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe8')]>=_0x1537e5[_0xf08a('0x1bf')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,'reason\x2011\x20abandoned');}else{_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1c0'));}}break;case'20':_0x1537e5[_0xf08a('0x66')]+=0x1;_0xa56156['state']=0x14;_0xa56156[_0xf08a('0xa6')]='AgentReject';_0xa56156[_0xf08a('0xe9')]+=0x1;_0xa56156[_0xf08a('0xe2')]+=0x1;ami[_0xf08a('0x4a')](_0xf08a('0x1c1'),ut[_0xf08a('0x1aa')](_0x1c16a3,_0xf08a('0x1c2')));_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1c3')));if(_0x331c50[_0xf08a('0x196')](0x14,_0x1c16a3,_0x1537e5)){if(_0xa56156[_0xf08a('0xe9')]>=_0x1537e5[_0xf08a('0x1a2')]){_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1c4'));}else{_0x331c50['stateGlobal'](_0xa56156,_0x44601e,_0x15e818,_0xf08a('0x1c4'));}}break;default:_0x1537e5[_0xf08a('0x67')]+=0x1;_0xa56156[_0xf08a('0xa5')]=0xc;_0xa56156[_0xf08a('0xa6')]=_0x5899b4['reason'];_0x331c50[_0xf08a('0xc5')](_0xa56156)[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1c5')));if(_0x331c50[_0xf08a('0x196')](_0x5899b4[_0xf08a('0x103')],_0x1c16a3,_0x1537e5)){if(_0xa56156['countbusyretry']+_0xa56156[_0xf08a('0xe5')]+_0xa56156[_0xf08a('0xfa')]+_0xa56156[_0xf08a('0xe6')]+_0xa56156['countdropretry']+_0xa56156[_0xf08a('0xe8')]+_0xa56156[_0xf08a('0xe1')]+_0xa56156[_0xf08a('0xe9')]>=_0x1537e5[_0xf08a('0xea')]){_0x331c50[_0xf08a('0xeb')](_0xa56156,_0x44601e,_0x15e818,_0x5899b4[_0xf08a('0x103')]);}else{_0x331c50[_0xf08a('0xfb')](_0xa56156,_0x44601e,_0x15e818,_0x5899b4['reason']);}}}});};Dialer[_0xf08a('0x1b')][_0xf08a('0xeb')]=function(_0x18f3e4,_0x2e731e,_0x8c6cd2,_0x393de5){var _0x4a401c=new Final(_0x18f3e4);_0x4a401c[_0xf08a('0xa5')]=0xf;_0x4a401c[_0xf08a('0xa6')]=_0xf08a('0x1c6');this[_0xf08a('0xfb')](_0x4a401c,_0x2e731e,_0x8c6cd2,_0x393de5);};Dialer[_0xf08a('0x1b')][_0xf08a('0xfb')]=function(_0x336bc6,_0x4fab0f,_0x3f7765,_0xb9f769){this['moveContactManagedDialer'](_0x336bc6)[_0xf08a('0xb6')](function(){return _0x4fab0f(msgResponse(_0xf08a('0x1a5'),'Success',_0xb9f769));})[_0xf08a('0xae')](function(){return _0x3f7765(msgResponse(_0xf08a('0x1c7'),_0xf08a('0x13d'),_0xf08a('0x1c8')));});};Dialer[_0xf08a('0x1b')][_0xf08a('0x9')]=function(_0x470e59){var _0x258b46=_0x470e59[_0xf08a('0x1c9')]/0x64;var _0x5f1743=_0x470e59[_0xf08a('0x62')]/(_0x470e59[_0xf08a('0x62')]+_0x470e59[_0xf08a('0xdc')]);var _0x2c3b90=Math[_0xf08a('0x1ca')](_0x470e59[_0xf08a('0x70')]*(_0x470e59[_0xf08a('0x1cb')]/0x64));var _0x45db29=Math['round'](_0x470e59[_0xf08a('0x70')]*(_0x470e59['predictiveIntervalMinThreshold']/0x64));var _0x3ecbf9=_0x470e59[_0xf08a('0x4e')]+_0x470e59[_0xf08a('0x54')];var _0x1ad705=Math[_0xf08a('0x1cc')](_0x470e59['erlangCalls']*_0x470e59['erlangAbandonmentRate']*_0x470e59[_0xf08a('0x6d')]*_0x470e59[_0xf08a('0x6e')]);if(_[_0xf08a('0x3c')](_0x470e59[_0xf08a('0x76')])){if(!_[_0xf08a('0x3c')](_0x470e59['startPredictive'])){_0x470e59[_0xf08a('0x29')]=undefined;loggerPredictive[_0xf08a('0x93')](_0xf08a('0x1cd'),_0xf08a('0x1ce'));}if(!_[_0xf08a('0x3c')](_0x470e59['handlePredictive'])){loggerPredictive[_0xf08a('0x93')](_0xf08a('0x1cd'),_0xf08a('0x1cf'));clearInterval(_0x470e59['handlePredictive']);_0x470e59[_0xf08a('0x8e')]=undefined;}_0x470e59[_0xf08a('0x76')]=moment()[_0xf08a('0x79')](_0xf08a('0xf2'));loggerPredictive[_0xf08a('0x7c')](_0x470e59[_0xf08a('0x3d')],_0xf08a('0x1d0'),_0x470e59[_0xf08a('0x76')]);this['handlePower'](_0x470e59,0x1);}else if(ifInterval(_0x470e59[_0xf08a('0x1d1')],_0x470e59[_0xf08a('0x76')])){this[_0xf08a('0x150')](_0x470e59,0x1);loggerPredictiveCalls['info'](_0xf08a('0x1d2'),_0x470e59['startProgressive'],_0x470e59[_0xf08a('0x3d')]);_0x470e59['erlangCalls']=0x0;_0x470e59[_0xf08a('0x6c')]=0x0;}else if(_0x258b46<_0x5f1743&&_0x470e59[_0xf08a('0x1d3')]===_0xf08a('0x1d4')){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x1d5'),_0xf08a('0x1d6'),_0x5f1743,'startProgressive',_0x470e59[_0xf08a('0x3d')]);}else if(_0x1ad705<_0x470e59[_0xf08a('0x6c')]&&_0x470e59[_0xf08a('0x1d3')]===_0xf08a('0x1d4')){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x1d7'),_0xf08a('0x1d8'),_0x1ad705,_0xf08a('0x1d9'),_0x470e59[_0xf08a('0x6c')],_0xf08a('0x76'),_0x470e59[_0xf08a('0x3d')]);}else if(!ifInterval(_0x470e59[_0xf08a('0x1d1')],_0x470e59[_0xf08a('0x76')])&&_[_0xf08a('0x3c')](_0x470e59[_0xf08a('0x29')])&&!_['isUndefined'](_0x470e59[_0xf08a('0x76')])){_0x470e59[_0xf08a('0x29')]=moment()[_0xf08a('0x79')](_0xf08a('0xf2'));loggerPredictive[_0xf08a('0x7c')](_0x470e59['name'],_0xf08a('0x1da'),_0x470e59[_0xf08a('0x29')]);this[_0xf08a('0xba')](_0x470e59[_0xf08a('0x1d1')])[_0xf08a('0xb6')](this['getDataPredictive'](_0x470e59))[_0xf08a('0xb6')](mergeDataErlangB(_0x470e59))[_0xf08a('0xb6')](this[_0xf08a('0x1db')](_0x470e59))[_0xf08a('0xae')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x470e59));}else if(!ifInterval(_0x470e59['dialPredictiveInterval'],_0x470e59[_0xf08a('0x29')])){_0x470e59[_0xf08a('0x6c')]=0x0;_0x470e59['startPredictive']=moment()[_0xf08a('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf08a('0x7c')](_0x470e59['name'],_0xf08a('0x1dc'),_0x470e59[_0xf08a('0x29')]);clearInterval(_0x470e59[_0xf08a('0x8e')]);_0x470e59['handlePredictive']=undefined;this[_0xf08a('0xba')](_0x470e59[_0xf08a('0x1d1')])[_0xf08a('0xb6')](this[_0xf08a('0x1dd')](_0x470e59))[_0xf08a('0xb6')](mergeDataErlangB(_0x470e59))[_0xf08a('0xb6')](this['startMethodPredictive'](_0x470e59))[_0xf08a('0xae')](loggerCatchPredictive(_0xf08a('0x1de'),_0x470e59));}else if(_0x470e59[_0xf08a('0x70')]&&_0x3ecbf9<_0x470e59[_0xf08a('0x70')]-_0x45db29){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0x470e59[_0xf08a('0x3d')],_0xf08a('0x1df'),_0x3ecbf9,_0xf08a('0x1e0'),_0x470e59[_0xf08a('0x70')],'-',_0x45db29,'=',_0x470e59['predictiveIntervalAvailable']-_0x45db29,')');}else if(_0x470e59[_0xf08a('0x70')]&&_0x3ecbf9>_0x470e59[_0xf08a('0x70')]+_0x2c3b90){freeVariablesPredictive(_0x470e59);loggerPredictive[_0xf08a('0x7c')](_0x470e59[_0xf08a('0x3d')],_0xf08a('0x1df'),_0x3ecbf9,_0xf08a('0x1e1'),_0x470e59[_0xf08a('0x70')],'+',_0x2c3b90,'=',_0x470e59[_0xf08a('0x70')]+_0x2c3b90,')');}};Dialer['prototype'][_0xf08a('0x1dd')]=function(_0x59502a){var _0x2a56c1=this;return function(_0x3647da){return new BPromise(function(_0x2a72eb,_0x228294){_['merge'](_0x59502a,_0x3647da[0x0]);if(checkGetDataPredictive(_0x3647da[0x0])){var _0x1576ce=_0x59502a[_0xf08a('0x70')]=_0x59502a[_0xf08a('0x54')]+_0x59502a[_0xf08a('0x4e')];var _0x5d9271=_0x59502a[_0xf08a('0x1d1')]*0x3c;var _0x34ceef=_0x3647da[0x0]['predictiveIntervalAvgTalktime']+_0x3647da[0x0]['predictiveIntervalAvgHoldtime'];var _0x59f545=(_0x3647da[0x0][_0xf08a('0x7e')]+_0x3647da[0x0][_0xf08a('0x6a')]+_0x3647da[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3647da[0x0][_0xf08a('0x71')];_0x59502a[_0xf08a('0x6d')]=_0x59f545>0x0?_0x59f545:0x1;switch(_0x59502a[_0xf08a('0x1d3')]){case _0xf08a('0x1d4'):var _0x2d5b88=_0x59502a[_0xf08a('0x1c9')]/0x64;return _0x2a56c1[_0xf08a('0x1e2')](_0x1576ce,_0x5d9271,_0x34ceef,_0x59f545,_0x2d5b88)['then'](function(_0xa125b7){return _0x2a72eb(_0xa125b7);});case _0xf08a('0x1e3'):var _0x360191=_0x59502a[_0xf08a('0x1c9')]/0x64;return _0x2a56c1[_0xf08a('0x1e4')](_0x1576ce,_0x5d9271,_0x34ceef,_0x59f545,_0x360191)[_0xf08a('0xb6')](function(_0xc962e6){return _0x2a72eb(_0xc962e6);});default:return _0x228294(msgResponse(_0xf08a('0x1e5'),_0xf08a('0x13d'),'Unknown\x20Predictive'));}}else{return _0x228294(msgResponse(_0xf08a('0x1e5'),_0xf08a('0x13d'),_0xf08a('0x1e6')));}});};};Dialer[_0xf08a('0x1b')][_0xf08a('0x1e7')]=function(_0x496026){var _0x151359=this;return function(_0x19a7dc){return new BPromise(function(_0x1d4521,_0x163cb1){_[_0xf08a('0x8c')](_0x496026,_0x19a7dc[0x0]);if(checkGetDataPredictive(_0x19a7dc[0x0])){loggerPredictive[_0xf08a('0x7c')](JSON[_0xf08a('0x46')](_0x19a7dc[0x0]));if(_0x496026['dialPredictiveOptimization']===_0xf08a('0x1d4')){return _0x151359[_0xf08a('0xc2')](_0x496026['id'])[_0xf08a('0xb6')](function(_0x470162){var _0x356092=_0x496026[_0xf08a('0x4f')]-_0x470162[0x0][_0xf08a('0x1e8')];var _0x2c49fc=_0x496026[_0xf08a('0x1d1')]*0x3c;var _0x3094aa=_0x19a7dc[0x0]['predictiveIntervalAvgTalktime']+_0x19a7dc[0x0][_0xf08a('0x68')];var _0x3dca7c=(_0x19a7dc[0x0][_0xf08a('0x7e')]+_0x19a7dc[0x0][_0xf08a('0x6a')]+_0x19a7dc[0x0][_0xf08a('0x69')])/_0x19a7dc[0x0][_0xf08a('0x71')];var _0x149685=_0x496026[_0xf08a('0x1c9')]/0x64;_0x496026[_0xf08a('0x6f')]=_0x470162[0x0][_0xf08a('0x1e8')]||0x0;_0x496026[_0xf08a('0x6d')]=_0x3dca7c>0x0?_0x3dca7c:0x1;return _0x151359[_0xf08a('0x1e2')](_0x356092,_0x2c49fc,_0x3094aa,_0x3dca7c,_0x149685);})[_0xf08a('0xb6')](function(_0x351625){return _0x1d4521(_0x351625);})['catch'](function(_0x4a0a8b){return _0x163cb1(msgResponse('[CatchErlangB]',_0xf08a('0x13d'),JSON[_0xf08a('0x46')](_0x4a0a8b)));});}if(_0x496026[_0xf08a('0x1d3')]==='agentBusyFactor'){return _0x151359[_0xf08a('0xc2')](_0x496026['id'])[_0xf08a('0xb6')](function(_0x11ad90){var _0x2cd809=_0x496026[_0xf08a('0x4f')]-_0x11ad90[0x0][_0xf08a('0x1e8')];var _0x523245=_0x496026[_0xf08a('0x1d1')]*0x3c;var _0x47b6cf=_0x19a7dc[0x0][_0xf08a('0x82')]+_0x19a7dc[0x0][_0xf08a('0x68')];var _0x20ea86=(_0x19a7dc[0x0][_0xf08a('0x7e')]+_0x19a7dc[0x0][_0xf08a('0x6a')]+_0x19a7dc[0x0][_0xf08a('0x69')])/_0x19a7dc[0x0][_0xf08a('0x71')];var _0x4fc6fb=_0x496026[_0xf08a('0x1c9')]/0x64;_0x496026[_0xf08a('0x6f')]=_0x11ad90[0x0][_0xf08a('0x1e8')]||0x0;_0x496026[_0xf08a('0x6d')]=_0x20ea86>0x0?_0x20ea86:0x1;return _0x151359[_0xf08a('0x1e4')](_0x2cd809,_0x523245,_0x47b6cf,_0x20ea86,_0x4fc6fb);})['then'](function(_0x36f195){return _0x1d4521(_0x36f195);})[_0xf08a('0xae')](function(_0x44a029){return _0x163cb1(msgResponse(_0xf08a('0x1e9'),_0xf08a('0x13d'),JSON[_0xf08a('0x46')](_0x44a029)));});}}else{return _0x163cb1(msgResponse(_0xf08a('0x1e5'),_0xf08a('0x13d'),_0xf08a('0x1e6')));}});};};Dialer[_0xf08a('0x1b')][_0xf08a('0x1db')]=function(_0xb7e655){var _0x51000a=this;return function(){var _0x7306fa=0x0;var _0x9c5de9=Math[_0xf08a('0x1cc')](_0xb7e655[_0xf08a('0x89')]*0x3e8);if(_0x9c5de9>0x0){_0x9c5de9=_0x9c5de9<0x64?0x64:_0x9c5de9;loggerPredictive[_0xf08a('0x7c')](_0xb7e655[_0xf08a('0x3d')],_0xf08a('0x1ea'),_0x9c5de9,_0xf08a('0x47'));_0xb7e655[_0xf08a('0x8e')]=setInterval(function(){_0x51000a[_0xf08a('0x8e')](_0xb7e655);loggerPredictiveCalls[_0xf08a('0x7c')]('[handlePredictive]',_0x7306fa+=0x1);},_0x9c5de9);}else{loggerPredictive[_0xf08a('0x7c')](_0xb7e655[_0xf08a('0x3d')],_0xf08a('0x1eb'));}};};Dialer[_0xf08a('0x1b')]['checkContactBlack']=function(_0x29f935,_0x4d1058){var _0x2064d1=this;return function(_0x324ae0){if(_[_0xf08a('0x44')](_0x324ae0)){if(_[_0xf08a('0xab')](_0x4d1058[_0xf08a('0xce')])||!_0x4d1058[_0xf08a('0x1ec')]){if(_0x29f935['dialMethod']===_0xf08a('0x8')){_0x29f935['queueStatusComplete']=_[_0xf08a('0x3c')](_0x29f935[_0xf08a('0x125')])?!![]:_0x29f935[_0xf08a('0x125')];var _0x7abb2b=uuid['v4']();_0x2064d1[_0xf08a('0x11d')][_0x7abb2b]=new Action(_0x29f935,_0x4d1058,_0x7abb2b);loggerBooked[_0xf08a('0x7c')](_0xf08a('0x1ed'),_0x7abb2b,_0xf08a('0x1ee'),JSON[_0xf08a('0x46')](_0x29f935[_0xf08a('0x125')]),_0xf08a('0x1ef'),_0x29f935['name']);if(_0x29f935[_0xf08a('0x125')]){_0x29f935['queueStatusComplete']=![];_0x2064d1[_0xf08a('0x2b')][_0x2064d1['actions'][_0x7abb2b][_0xf08a('0xb0')]]=[];ami[_0xf08a('0x141')]({'actionid':_0x7abb2b,'action':_0xf08a('0x1f0'),'queue':_0x29f935[_0xf08a('0x3d')]})['catch'](function(){_0x2064d1[_0xf08a('0xb2')](_0x29f935);_0x2064d1[_0xf08a('0xbb')]({'active':![],'ContactId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xcc')],'ListId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b]['ListId'],'VoiceQueueId':_0x2064d1['actions'][_0x7abb2b][_0xf08a('0xf3')]||undefined,'CampaignId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f1')));delete _0x2064d1['actions'][_0x7abb2b];});}else{loggerBooked[_0xf08a('0x7c')]('[booked][checkContactBlack][else]',JSON[_0xf08a('0x46')](_0x29f935['queueStatusComplete']),_0xf08a('0x1ef'),_0x29f935[_0xf08a('0x3d')]);_0x2064d1[_0xf08a('0xb2')](_0x29f935);_0x2064d1[_0xf08a('0xbb')]({'active':![],'ContactId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xcc')],'ListId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b]['ListId'],'VoiceQueueId':_0x2064d1[_0xf08a('0x11d')][_0x7abb2b][_0xf08a('0xf3')]||undefined,'CampaignId':_0x2064d1['actions'][_0x7abb2b][_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f1')));delete _0x2064d1[_0xf08a('0x11d')][_0x7abb2b];}}else{return _0x2064d1[_0xf08a('0x161')](_0x29f935,_0x4d1058);}}else{if(getDiff(_0x4d1058[_0xf08a('0x1f2')])<_0x29f935[_0xf08a('0x1f3')]*0x3c){if(_0x4d1058['Agent']&&!_0x4d1058[_0xf08a('0x1f4')]['voicePause']){_0x2064d1['preview']['run'](_0x4d1058['id'])[_0xf08a('0x1e')](function(){_0x2064d1['updateOriginated'](_0x29f935);});}else{_0x2064d1['unlockContact']({'active':![]},_0x4d1058['id'],0x1)['finally'](function(){_0x2064d1['updateOriginated'](_0x29f935);});}}else{_0x29f935[_0xf08a('0x65')]+=0x1;_0x2064d1[_0xf08a('0xb2')](_0x29f935);if(_0x29f935[_0xf08a('0x1f5')]){_0x2064d1['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d1058[_0xf08a('0xcc')],'ListId':_0x4d1058[_0xf08a('0xcd')],'VoiceQueueId':_0x4d1058[_0xf08a('0xf3')]||undefined,'CampaignId':_0x4d1058[_0xf08a('0xcf')]||undefined})[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f6')));_0x2064d1[_0xf08a('0xc5')](createObjHistory(_0x29f935,_0x4d1058,_0xf08a('0x1f7'),0x17,_0xf08a('0x1f8')))[_0xf08a('0xae')](loggerCatch(_0xf08a('0x1f9')));}else{_0x2064d1['saveInDb'](createObjHistory(_0x29f935,_0x4d1058,_0xf08a('0x1fa'),0x16,_0xf08a('0x1fb')),_0xf08a('0x1fc'),_0xf08a('0x1fd'));}}}}else{_0x29f935[_0xf08a('0x5e')]+=0x1;_0x2064d1[_0xf08a('0xca')](createObjHistory(_0x29f935,_0x4d1058,'BLACKLIST',0xd,'Blacklist'),_0xf08a('0x1fe'),_0xf08a('0x1ff'));throw _0xf08a('0x200');}};};Dialer[_0xf08a('0x1b')][_0xf08a('0x156')]=function(_0x4d46cc){var _0x36c962=this;var _0x3dbec9=_0x4d46cc[_0xf08a('0x201')]-_0x4d46cc[_0xf08a('0x72')]-_0x4d46cc[_0xf08a('0x202')];emitCampaignSummary(_0x4d46cc);if(_0x3dbec9>0x0){if(_0x3dbec9>this[_0xf08a('0x24')]){_0x3dbec9=this[_0xf08a('0x24')];}_0x4d46cc[_0xf08a('0x202')]+=_0x3dbec9;this[_0xf08a('0xc0')](_0x4d46cc['id'],_0x3dbec9,_0x4d46cc[_0xf08a('0x203')])[_0xf08a('0xb6')](function(_0x4c3249){_0x4d46cc[_0xf08a('0x202')]-=_0x3dbec9;_0x4d46cc[_0xf08a('0x202')]=_0x4d46cc[_0xf08a('0x202')]>0x0?_0x4d46cc[_0xf08a('0x202')]:0x0;if(!checkContactEmpty(_0x4c3249)){_0x4d46cc[_0xf08a('0x3e')]=_0xf08a('0x204');logger[_0xf08a('0x7c')](_0xf08a('0x205')+_0x4d46cc[_0xf08a('0x3d')]);}else{_0x4d46cc[_0xf08a('0x72')]+=_0x4c3249['length'];_0x4d46cc[_0xf08a('0x3e')]='RUNNING';for(var _0x1572fd=0x0;_0x1572fd<_0x4c3249[_0xf08a('0x96')];_0x1572fd+=0x1){_0x4d46cc[_0xf08a('0x206')]+=0x1;if(_[_0xf08a('0xab')](_0x4c3249[_0x1572fd])||_['isNil'](_0x4c3249[_0x1572fd][_0xf08a('0x165')])||_['isNil'](_0x4c3249[_0x1572fd]['Contact'][_0xf08a('0x166')])){_0x36c962['emptyContact'](_0xf08a('0x207'),_0x4d46cc,_0x4c3249[_0x1572fd]);}else{_0x36c962[_0xf08a('0xb8')](_['pick'](_0x4c3249[_0x1572fd],[_0xf08a('0xcf'),_0xf08a('0x208')]))[_0xf08a('0xb6')](_0x36c962[_0xf08a('0x209')](_0x4d46cc,_0x4c3249[_0x1572fd]))[_0xf08a('0xae')](_0x36c962['loggerHandler'](_0xf08a('0x20a'),_0x4d46cc));}}}})[_0xf08a('0xae')](loggerGetContactDialer(_0xf08a('0x20b'),_0x4d46cc,_0x3dbec9));}};Dialer[_0xf08a('0x1b')]['handlePower']=function(_0x473802,_0x372eec){var _0x2d78f3=this;var _0x48688e=[];var _0x30c955=_0x372eec>=0x1?_0x372eec:0x1;if(_0x473802[_0xf08a('0x5a')]==='booked'){_0x30c955=0x1;}var _0x25a44e=Math[_0xf08a('0x1cc')](_0x473802['available']*_0x30c955)-_0x473802[_0xf08a('0x72')]-_0x473802[_0xf08a('0x202')];emitVoiceQueueSummary(_0x473802);if(_0x473802[_0xf08a('0x20c')]>0x0){var _0x3ddf53=_0x473802[_0xf08a('0x20c')]-_0x473802[_0xf08a('0x72')]-_0x473802[_0xf08a('0x54')]-_0x473802[_0xf08a('0x202')]-_0x473802['pTalking'];if(_0x25a44e>_0x3ddf53){_0x25a44e=_0x3ddf53;}}if(_0x25a44e>0x0){if(_0x473802[_0xf08a('0x5a')]===_0xf08a('0x8')){_0x25a44e=0x1;}if(_0x25a44e>this[_0xf08a('0x24')]){_0x25a44e=this[_0xf08a('0x24')];}_0x473802['temp']+=_0x25a44e;for(var _0x5278c4 in this[_0xf08a('0x22')]){if(typeof this['agents'][_0x5278c4]!==_0xf08a('0x97')){if(this[_0xf08a('0x22')][_0x5278c4][_0xf08a('0xa5')]===_0xf08a('0x20d')&&this['agents'][_0x5278c4][_0xf08a('0xac')]===_0xf08a('0xd4')){_0x48688e[_0xf08a('0x123')](this[_0xf08a('0x22')][_0x5278c4]['id']);}}}this[_0xf08a('0xbf')](_0x473802['id'],_0x48688e,_0x25a44e,_0x473802[_0xf08a('0x203')])[_0xf08a('0xb6')](function(_0x40d3dc){_0x473802[_0xf08a('0x202')]-=_0x25a44e;_0x473802[_0xf08a('0x202')]=_0x473802[_0xf08a('0x202')]>0x0?_0x473802[_0xf08a('0x202')]:0x0;if(!checkContactEmpty(_0x40d3dc)){_0x2d78f3['countReScheduled'](_0x473802)[_0xf08a('0xb6')](sendMessageReschedule(_0x473802))['catch'](loggerCatch(_0xf08a('0x20e')));}else{_0x473802[_0xf08a('0x72')]+=_0x40d3dc[_0xf08a('0x96')];_0x473802[_0xf08a('0x3e')]=_0x473802[_0xf08a('0x5a')]===_0xf08a('0x8')?_0xf08a('0x20f'):'RUNNING';for(var _0x92c406=0x0;_0x92c406<_0x40d3dc[_0xf08a('0x96')];_0x92c406+=0x1){if(_[_0xf08a('0xab')](_0x40d3dc[_0x92c406])||_['isNil'](_0x40d3dc[_0x92c406][_0xf08a('0x165')])||_['isNil'](_0x40d3dc[_0x92c406][_0xf08a('0x165')][_0xf08a('0x166')])){_0x2d78f3[_0xf08a('0x210')]('[actionOriginate]\x20',_0x473802,_0x40d3dc[_0x92c406]);}else{_0x2d78f3['checkIsBlackList'](_[_0xf08a('0xcb')](_0x40d3dc[_0x92c406],[_0xf08a('0xf3'),_0xf08a('0x208')]))[_0xf08a('0xb6')](_0x2d78f3[_0xf08a('0x209')](_0x473802,_0x40d3dc[_0x92c406]))['catch'](_0x2d78f3[_0xf08a('0xc9')](_0xf08a('0x207'),_0x473802));}}}})['catch'](loggerGetContactDialer(_0xf08a('0x211'),_0x473802,_0x25a44e));}};Dialer[_0xf08a('0x1b')]['handlePredictive']=function(_0x3276a9){if(_0x3276a9[_0xf08a('0x20c')]>0x0){var _0x372832=_0x3276a9['dialLimitQueue']-_0x3276a9['originated']-_0x3276a9[_0xf08a('0x54')];if(_0x372832>0x0){this['tryOriginatePredictive'](_0x3276a9);}else{loggerPredictiveCalls[_0xf08a('0x7c')](_0xf08a('0x212'));}}else{this['tryOriginatePredictive'](_0x3276a9);}};Dialer[_0xf08a('0x1b')][_0xf08a('0x213')]=function(_0x2fb107){var _0x50bf1d=this;var _0x444a3b=[];_0x2fb107[_0xf08a('0x72')]+=0x1;for(var _0x577215 in this[_0xf08a('0x22')]){if(typeof this[_0xf08a('0x22')][_0x577215]!==_0xf08a('0x97')){if(this[_0xf08a('0x22')][_0x577215][_0xf08a('0xa5')]===_0xf08a('0x20d')&&this['agents'][_0x577215][_0xf08a('0xac')]==='reachable'){_0x444a3b['push'](this[_0xf08a('0x22')][_0x577215]['id']);}}}this[_0xf08a('0xbf')](_0x2fb107['id'],_0x444a3b,0x1,_0x2fb107[_0xf08a('0x203')])[_0xf08a('0xb6')](function(_0x2a3c35){if(!checkContactEmpty(_0x2a3c35)){checkContactLowerLimitOriginate(_0x2fb107,0x1,0x0);_0x50bf1d['countReScheduled'](_0x2fb107)[_0xf08a('0xb6')](sendMessageReschedule(_0x2fb107))[_0xf08a('0xae')](loggerCatch('[countReScheduled]\x20'));}else{_0x2fb107[_0xf08a('0x3e')]='RUNNING';if(_['isNil'](_0x2a3c35[0x0])||_['isNil'](_0x2a3c35[0x0][_0xf08a('0x165')])||_[_0xf08a('0xab')](_0x2a3c35[0x0][_0xf08a('0x165')][_0xf08a('0x166')])){_0x50bf1d[_0xf08a('0x210')]('[actionOriginate]\x20',_0x2fb107,_0x2a3c35[0x0]);}else{_0x50bf1d[_0xf08a('0xb4')](_[_0xf08a('0xcb')](_0x2a3c35[0x0],[_0xf08a('0xf3'),_0xf08a('0x208')]))[_0xf08a('0xb6')](_0x50bf1d[_0xf08a('0x209')](_0x2fb107,_0x2a3c35[0x0]))[_0xf08a('0xae')](_0x50bf1d[_0xf08a('0xc9')](_0xf08a('0x214'),_0x2fb107));}}})[_0xf08a('0xae')](loggerGetContactDialer(_0xf08a('0x215'),_0x2fb107,0x1));emitVoiceQueueSummary(_0x2fb107);};Dialer[_0xf08a('0x1b')][_0xf08a('0x1e2')]=function(_0x3cd281,_0x11ce90,_0x1586d1,_0x5e8b59,_0x4ec832,_0x443440){loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x216'));loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x217'),_0x3cd281);loggerPredictive[_0xf08a('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x11ce90);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x218'),_0x1586d1);loggerPredictive[_0xf08a('0x7c')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e8b59);loggerPredictive['info'](_0xf08a('0x219'),_0x4ec832);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x83'));return new BPromise(function(_0x3fc9f7,_0x5315c5){if(_0x3cd281<=0x0||isNaN(_0x3cd281)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),_0xf08a('0x21b'),'m\x20=\x20'+_0x3cd281));}if(_0x1586d1<=0x0||isNaN(_0x1586d1)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),_0xf08a('0x21b'),_0xf08a('0x21c')+_0x1586d1));}if(_0x5e8b59<=0x0||isNaN(_0x5e8b59)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),_0xf08a('0x21b'),_0xf08a('0x21d')+_0x5e8b59));}if(_0x11ce90<=0x0||isNaN(_0x11ce90)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),'Error',_0xf08a('0x21e')+_0x11ce90));}if(_0x4ec832<=0x0||isNaN(_0x4ec832)){return _0x5315c5(msgResponse(_0xf08a('0x21a'),'Error','Amax\x20=\x20'+_0x4ec832));}_0x443440=_0x443440||0x0;var _0x4646bb=0x1/_0x1586d1;var _0x2daae5=0x0;var _0x50146b=0x0;var _0x51b0b1=0x0;var _0x1df102=0x0;for(var _0x21c600=0x0;_0x51b0b1<_0x4ec832;_0x21c600+=0x1){_0x50146b=_0x21c600/_0x11ce90;_0x2daae5=(_0x5e8b59*_0x50146b+_0x443440)/_0x4646bb;_0x51b0b1=erlangb(_0x2daae5,_0x3cd281);_0x1df102=_0x2daae5/_0x3cd281*(0x1-erlangb(_0x2daae5,_0x3cd281));}return _0x3fc9f7({'erlangCalls':_0x21c600,'erlangCallToSecond':_0x11ce90/_0x21c600,'erlangAbandonmentRate':_0x51b0b1,'erlangBusyFactor':_0x1df102});});};Dialer[_0xf08a('0x1b')][_0xf08a('0x1e4')]=function(_0x374f2f,_0x118cdd,_0x38df52,_0x7c9204,_0x21d9f2,_0x3bb55b){loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x21f'));loggerPredictive['info'](_0xf08a('0x217'),_0x374f2f);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x220'),_0x118cdd);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x218'),_0x38df52);loggerPredictive['info'](_0xf08a('0x221'),_0x7c9204);loggerPredictive[_0xf08a('0x7c')](_0xf08a('0x222'),_0x21d9f2);loggerPredictive['info'](_0xf08a('0x83'));return new BPromise(function(_0x5336f8,_0x357ffd){if(_0x374f2f<=0x0||isNaN(_0x374f2f)){return _0x357ffd(msgResponse(_0xf08a('0x223'),_0xf08a('0x21b'),_0xf08a('0x224')+_0x374f2f));}if(_0x38df52<=0x0||isNaN(_0x38df52)){return _0x357ffd(msgResponse(_0xf08a('0x223'),_0xf08a('0x21b'),_0xf08a('0x21c')+_0x38df52));}if(_0x7c9204<=0x0||isNaN(_0x7c9204)){return _0x357ffd(msgResponse('[busyFactor]',_0xf08a('0x21b'),_0xf08a('0x21d')+_0x7c9204));}if(_0x118cdd<=0x0||isNaN(_0x118cdd)){return _0x357ffd(msgResponse(_0xf08a('0x223'),'Error',_0xf08a('0x21e')+_0x118cdd));}if(_0x21d9f2<=0x0||isNaN(_0x21d9f2)){return _0x357ffd(msgResponse(_0xf08a('0x223'),_0xf08a('0x21b'),_0xf08a('0x225')+_0x21d9f2));}_0x3bb55b=_0x3bb55b||0x0;var _0x479bae=0x1/_0x38df52;var _0x2e884c=0x0;var _0x3fb125=0x0;var _0x43e2cf=0x0;var _0x4823c0=0x0;for(var _0x416aab=0x0;_0x4823c0<_0x21d9f2;_0x416aab+=0x1){_0x3fb125=_0x416aab/_0x118cdd;_0x2e884c=(_0x7c9204*_0x3fb125+_0x3bb55b)/_0x479bae;_0x43e2cf=erlangb(_0x2e884c,_0x374f2f);_0x4823c0=_0x2e884c/_0x374f2f*(0x1-erlangb(_0x2e884c,_0x374f2f));}return _0x5336f8({'erlangCalls':_0x416aab,'erlangCallToSecond':_0x118cdd/_0x416aab,'erlangAbandonmentRate':_0x43e2cf,'erlangBusyFactor':_0x4823c0});});};module[_0xf08a('0x226')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ced4c3a..88c3a33 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 _0x38b2=['exports','util','moment','milliseconds','diff','seconds','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','responsetime','droptime','endtime','ringtime','starttime','holdtime','talktime','membername','connectedlinename','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1c924b,_0x3d8154){var _0x282ec3=function(_0x15e1be){while(--_0x15e1be){_0x1c924b['push'](_0x1c924b['shift']());}};_0x282ec3(++_0x3d8154);}(_0x38b2,0x17b));var _0x238b=function(_0x1eb383,_0x4fb920){_0x1eb383=_0x1eb383-0x0;var _0x25b88b=_0x38b2[_0x1eb383];return _0x25b88b;};'use strict';var util=require(_0x238b('0x0'));var _=require('lodash');var moment=require(_0x238b('0x1'));function getSeconds(_0x626fd0,_0x50e76f){var _0x3cb874=moment(_0x626fd0)['milliseconds'](0x0);var _0x3e8084=moment(_0x50e76f)[_0x238b('0x2')](0x0);return _0x3cb874[_0x238b('0x3')](_0x3e8084,_0x238b('0x4'));}function QueueCallerAbandon(_0x288c5a,_0x34093d){this['scheduledat']=_0x288c5a['scheduledat'];this[_0x238b('0x5')]=_0x288c5a['type'];this[_0x238b('0x6')]=_0x288c5a['type']==='outbound'?_0x238b('0x7'):_0x288c5a[_0x238b('0x5')];this[_0x238b('0x8')]=_0x288c5a['countbusyretry'];this[_0x238b('0x9')]=_0x288c5a[_0x238b('0x9')];this[_0x238b('0xa')]=_0x288c5a[_0x238b('0xa')];this[_0x238b('0xb')]=_0x288c5a['countbusyretry']+_0x288c5a[_0x238b('0x9')]+_0x288c5a[_0x238b('0xa')]+_0x288c5a['countnosuchnumberretry']+_0x288c5a['countdropretry']+_0x288c5a[_0x238b('0xc')]+_0x288c5a[_0x238b('0xd')]+_0x288c5a[_0x238b('0xe')];this[_0x238b('0xf')]=_0x288c5a[_0x238b('0xf')];this[_0x238b('0x10')]=_0x288c5a['countdropretry'];this[_0x238b('0xc')]=_0x288c5a['countabandonedretry'];this[_0x238b('0xd')]=_0x288c5a[_0x238b('0xd')];this[_0x238b('0xe')]=_0x288c5a['countagentrejectretry'];this[_0x238b('0x11')]=_0x34093d[_0x238b('0x11')];this[_0x238b('0x12')]=_0x288c5a[_0x238b('0x13')];this[_0x238b('0x14')]=_0x288c5a[_0x238b('0x15')];this['starttime']=_0x288c5a['starttime'];this[_0x238b('0x16')]=_0x288c5a[_0x238b('0x16')];this['droptime']=_0x288c5a[_0x238b('0x17')];this[_0x238b('0x18')]=this[_0x238b('0x17')];this[_0x238b('0x19')]=getSeconds(_0x288c5a[_0x238b('0x16')],_0x288c5a[_0x238b('0x1a')]);this[_0x238b('0x1b')]=getSeconds(this['droptime'],_0x288c5a[_0x238b('0x16')]);this[_0x238b('0x1c')]=0x0;this['queue']=_0x34093d['queue'];this[_0x238b('0x1d')]=_0x34093d[_0x238b('0x1e')];this['reason']=_0x34093d['reason'];this['callback']=_0x288c5a['callback'];this['callbackuniqueid']=_0x288c5a[_0x238b('0x1f')];this[_0x238b('0x20')]=_0x288c5a[_0x238b('0x20')];this[_0x238b('0x21')]=_0x288c5a[_0x238b('0x21')];this['ContactId']=_0x288c5a[_0x238b('0x22')];this['ListId']=_0x288c5a[_0x238b('0x23')];this[_0x238b('0x24')]=_0x288c5a[_0x238b('0x24')];this[_0x238b('0x25')]=_0x288c5a[_0x238b('0x25')];this[_0x238b('0x26')]=_0x288c5a[_0x238b('0x26')];this['originatecalleridnum']=_0x288c5a[_0x238b('0x27')]||'';this[_0x238b('0x28')]=_0x288c5a[_0x238b('0x28')]||'';}module[_0x238b('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xf2be=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','responsetime','droptime','endtime','ringtime','starttime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat'];(function(_0x312b02,_0x5a4c99){var _0x34a298=function(_0x992e5a){while(--_0x992e5a){_0x312b02['push'](_0x312b02['shift']());}};_0x34a298(++_0x5a4c99);}(_0xf2be,0xf5));var _0xef2b=function(_0x16a142,_0xc2c144){_0x16a142=_0x16a142-0x0;var _0x5e28c0=_0xf2be[_0x16a142];return _0x5e28c0;};'use strict';var util=require(_0xef2b('0x0'));var _=require(_0xef2b('0x1'));var moment=require(_0xef2b('0x2'));function getSeconds(_0x3e7b9f,_0x2d1b5d){var _0x23390d=moment(_0x3e7b9f)[_0xef2b('0x3')](0x0);var _0x2bcb6f=moment(_0x2d1b5d)[_0xef2b('0x3')](0x0);return _0x23390d[_0xef2b('0x4')](_0x2bcb6f,_0xef2b('0x5'));}function QueueCallerAbandon(_0x5aa5bb,_0x980bcc){this[_0xef2b('0x6')]=_0x5aa5bb['scheduledat'];this[_0xef2b('0x7')]=_0x5aa5bb[_0xef2b('0x7')];this[_0xef2b('0x8')]=_0x5aa5bb['type']==='outbound'?_0xef2b('0x9'):_0x5aa5bb[_0xef2b('0x7')];this['countbusyretry']=_0x5aa5bb[_0xef2b('0xa')];this['countcongestionretry']=_0x5aa5bb[_0xef2b('0xb')];this[_0xef2b('0xc')]=_0x5aa5bb[_0xef2b('0xc')];this[_0xef2b('0xd')]=_0x5aa5bb['countbusyretry']+_0x5aa5bb[_0xef2b('0xb')]+_0x5aa5bb[_0xef2b('0xc')]+_0x5aa5bb['countnosuchnumberretry']+_0x5aa5bb[_0xef2b('0xe')]+_0x5aa5bb[_0xef2b('0xf')]+_0x5aa5bb[_0xef2b('0x10')]+_0x5aa5bb[_0xef2b('0x11')];this['countnosuchnumberretry']=_0x5aa5bb[_0xef2b('0x12')];this[_0xef2b('0xe')]=_0x5aa5bb[_0xef2b('0xe')];this[_0xef2b('0xf')]=_0x5aa5bb[_0xef2b('0xf')];this[_0xef2b('0x10')]=_0x5aa5bb[_0xef2b('0x10')];this[_0xef2b('0x11')]=_0x5aa5bb[_0xef2b('0x11')];this[_0xef2b('0x13')]=_0x980bcc[_0xef2b('0x13')];this['calleridname']=_0x5aa5bb[_0xef2b('0x14')];this[_0xef2b('0x15')]=_0x5aa5bb[_0xef2b('0x16')];this['starttime']=_0x5aa5bb['starttime'];this[_0xef2b('0x17')]=_0x5aa5bb[_0xef2b('0x17')];this[_0xef2b('0x18')]=_0x5aa5bb[_0xef2b('0x18')];this[_0xef2b('0x19')]=this[_0xef2b('0x18')];this[_0xef2b('0x1a')]=getSeconds(_0x5aa5bb[_0xef2b('0x17')],_0x5aa5bb[_0xef2b('0x1b')]);this['holdtime']=getSeconds(this[_0xef2b('0x18')],_0x5aa5bb[_0xef2b('0x17')]);this[_0xef2b('0x1c')]=0x0;this['queue']=_0x980bcc['queue'];this[_0xef2b('0x1d')]=_0x980bcc[_0xef2b('0x1e')];this[_0xef2b('0x1f')]=_0x980bcc[_0xef2b('0x1f')];this[_0xef2b('0x20')]=_0x5aa5bb[_0xef2b('0x20')];this['callbackuniqueid']=_0x5aa5bb[_0xef2b('0x21')];this[_0xef2b('0x22')]=_0x5aa5bb['callbackat'];this[_0xef2b('0x23')]=_0x5aa5bb['recallme'];this['ContactId']=_0x5aa5bb[_0xef2b('0x24')];this[_0xef2b('0x25')]=_0x5aa5bb[_0xef2b('0x25')];this[_0xef2b('0x26')]=_0x5aa5bb['UserId'];this['VoiceQueueId']=_0x5aa5bb['VoiceQueueId'];this[_0xef2b('0x27')]=_0x5aa5bb[_0xef2b('0x27')];this[_0xef2b('0x28')]=_0x5aa5bb[_0xef2b('0x28')]||'';this['originatecalleridname']=_0x5aa5bb['originatecalleridname']||'';}module[_0xef2b('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a24c2ae..267d1ca 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 _0x1547=['util','lodash','uniqueid','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x45e415,_0x197c84){var _0x5da3b8=function(_0x91bad5){while(--_0x91bad5){_0x45e415['push'](_0x45e415['shift']());}};_0x5da3b8(++_0x197c84);}(_0x1547,0x9a));var _0x7154=function(_0x492095,_0x3a1697){_0x492095=_0x492095-0x0;var _0x4a53e4=_0x1547[_0x492095];return _0x4a53e4;};'use strict';var util=require(_0x7154('0x0'));var _=require(_0x7154('0x1'));var moment=require('moment');function Action(_0x17f237,_0x442754,_0x91981b){this[_0x7154('0x2')]=_0x17f237||undefined;this['channel']=util[_0x7154('0x3')](_0x7154('0x4'),_0x442754[_0x7154('0x5')],_0x442754[_0x7154('0x6')][_0x7154('0x7')],_0x91981b[_0x7154('0x8')]);this[_0x7154('0x9')]=_0x442754['localstationid'];this[_0x7154('0xa')]=_0x442754[_0x7154('0xa')];this[_0x7154('0xb')]=_0x91981b[_0x7154('0xb')];this['AttachmentId']=_0x91981b[_0x7154('0xc')];}module[_0x7154('0xd')]=Action; \ No newline at end of file +var _0x0f19=['localstationid','headerinfo','path','AttachmentId','moment','channel','%s/%s/%s','tech','Trunk','fax'];(function(_0xa83433,_0x223c0e){var _0x52f418=function(_0x7bd1c5){while(--_0x7bd1c5){_0xa83433['push'](_0xa83433['shift']());}};_0x52f418(++_0x223c0e);}(_0x0f19,0x194));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x90f1('0x0'));function Action(_0x589565,_0x310ec5,_0x53458d){this['uniqueid']=_0x589565||undefined;this[_0x90f1('0x1')]=util['format'](_0x90f1('0x2'),_0x310ec5[_0x90f1('0x3')],_0x310ec5[_0x90f1('0x4')]['name'],_0x53458d[_0x90f1('0x5')]);this[_0x90f1('0x6')]=_0x310ec5[_0x90f1('0x6')];this['headerinfo']=_0x310ec5[_0x90f1('0x7')];this['path']=_0x53458d[_0x90f1('0x8')];this[_0x90f1('0x9')]=_0x53458d[_0x90f1('0x9')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 3df23ff..30980e8 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 _0xe785=['syncNewchannel','context','hasOwnProperty','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','then','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','hangup','syncHangup','syncOriginateResponse','prototype'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0xe785,0x14c));var _0x5e78=function(_0x41682b,_0x33b6e4){_0x41682b=_0x41682b-0x0;var _0x137693=_0xe785[_0x41682b];return _0x137693;};'use strict';var util=require(_0x5e78('0x0'));var _=require(_0x5e78('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5e78('0x2'));var moment=require(_0x5e78('0x3'));var path=require('path');var tiff2pdf=require(_0x5e78('0x4'));var gs=require(_0x5e78('0x5'));var logger=require(_0x5e78('0x6'))(_0x5e78('0x7'));var ami=require('../ami');var rpcDb=require(_0x5e78('0x8'));var Channel=require(_0x5e78('0x9'));var ut=require(_0x5e78('0xa'));var Action=require(_0x5e78('0xb'));var faxAccount=require(_0x5e78('0xc'));var attachment=require(_0x5e78('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2dd5db){this['channels']={};this['faxAccounts']=_0x2dd5db[_0x5e78('0xe')];this[_0x5e78('0xf')]=_0x2dd5db[_0x5e78('0xf')];this[_0x5e78('0x10')]={};ami['on'](_0x5e78('0x11'),this['syncNewchannel']['bind'](this));ami['on'](_0x5e78('0x12'),this[_0x5e78('0x13')][_0x5e78('0x14')](this));ami['on'](_0x5e78('0x15'),this[_0x5e78('0x16')][_0x5e78('0x14')](this));ami['on'](_0x5e78('0x17'),this[_0x5e78('0x18')][_0x5e78('0x14')](this));ami['on'](_0x5e78('0x19'),this[_0x5e78('0x1a')][_0x5e78('0x14')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x5e78('0x1b'),this[_0x5e78('0x1c')][_0x5e78('0x14')](this));ami['on']('originateresponse',this[_0x5e78('0x1d')][_0x5e78('0x14')](this));}Fax[_0x5e78('0x1e')][_0x5e78('0x1f')]=function(_0x5b7ff4){if(_0x5b7ff4[_0x5e78('0x20')]==='from-voip-provider'){for(var _0x44186c in this['faxAccounts']){if(this[_0x5e78('0xe')][_0x5e78('0x21')](_0x44186c)){if(_0x5b7ff4['exten']===this[_0x5e78('0xe')][_0x44186c][_0x5e78('0x22')]){this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]]={};this['channels'][_0x5b7ff4[_0x5e78('0x24')]][_0x5e78('0x25')]=_0x5b7ff4[_0x5e78('0x25')];this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]]['id']=this[_0x5e78('0xe')][_0x44186c]['id'];this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]][_0x5e78('0x26')]=this[_0x5e78('0xe')][_0x44186c][_0x5e78('0x26')];logger[_0x5e78('0x27')](_0x5b7ff4['uniqueid'],_0x5e78('0x28'));}}}}if(this[_0x5e78('0x10')][_0x5b7ff4[_0x5e78('0x24')]]){this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]]={};this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]][_0x5e78('0x25')]=_0x5b7ff4['channel'];logger['info'](_0x5b7ff4[_0x5e78('0x24')],_0x5e78('0x28'));}};Fax['prototype']['syncVarSet']=function(_0x6f8098){if(this['channels'][_0x6f8098['uniqueid']]){for(var _0x5c3e59 in _0x6f8098[_0x5e78('0x29')]){if(_0x6f8098[_0x5e78('0x29')][_0x5e78('0x21')](_0x5c3e59)){this[_0x5e78('0x23')][_0x6f8098[_0x5e78('0x24')]][_0x5c3e59]=_0x6f8098[_0x5e78('0x2a')];}}}};Fax['prototype'][_0x5e78('0x16')]=function(_0x2d1ce9){if(this[_0x5e78('0x23')][_0x2d1ce9[_0x5e78('0x24')]]){this['channels'][_0x2d1ce9[_0x5e78('0x24')]][_0x5e78('0x2b')]=_0x2d1ce9['channelstate'];this[_0x5e78('0x23')][_0x2d1ce9['uniqueid']][_0x5e78('0x2c')]=_0x2d1ce9['channelstatedesc'];}};Fax['prototype'][_0x5e78('0x18')]=function(_0x5863e7){if(this[_0x5e78('0x23')][_0x5863e7[_0x5e78('0x24')]]){for(var _0x26a15d in _0x5863e7[_0x5e78('0x29')]){if(_0x5863e7[_0x5e78('0x29')][_0x5e78('0x21')](_0x26a15d)){this[_0x5e78('0x23')][_0x5863e7[_0x5e78('0x24')]][_0x26a15d]=_0x5863e7['value'];}}}};Fax['prototype'][_0x5e78('0x1a')]=function(_0x56aff8){if(this['channels'][_0x56aff8[_0x5e78('0x24')]]){this['channels'][_0x56aff8[_0x5e78('0x24')]][_0x5e78('0x2d')]=_0x56aff8[_0x5e78('0x2d')];this['channels'][_0x56aff8['uniqueid']][_0x5e78('0x2e')]=_0x56aff8[_0x5e78('0x2e')];this[_0x5e78('0x23')][_0x56aff8[_0x5e78('0x24')]]['localstationid']=_0x56aff8[_0x5e78('0x22')];this[_0x5e78('0x23')][_0x56aff8['uniqueid']]['filename']=_0x56aff8['filename'];logger[_0x5e78('0x27')](_0x56aff8[_0x5e78('0x24')],_0x5e78('0x2f'));}};Fax[_0x5e78('0x1e')][_0x5e78('0x30')]=function(_0xfccc71){var _0x19fc37=this;if(this['channels'][_0xfccc71[_0x5e78('0x24')]]){var _0xfd8f50=this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]]['id'];this['channels'][_0xfccc71[_0x5e78('0x24')]]['remotestationid']=_0xfccc71[_0x5e78('0x31')];this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]][_0x5e78('0x32')]=_0xfccc71[_0x5e78('0x32')];this[_0x5e78('0x23')][_0xfccc71['uniqueid']][_0x5e78('0x22')]=_0xfccc71[_0x5e78('0x22')];this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]][_0x5e78('0x33')]=_0xfccc71['resolution'];this[_0x5e78('0x23')][_0xfccc71['uniqueid']][_0x5e78('0x34')]=_0xfccc71[_0x5e78('0x34')];this[_0x5e78('0x23')][_0xfccc71['uniqueid']][_0x5e78('0x35')]=_0xfccc71[_0x5e78('0x35')];this['channels'][_0xfccc71[_0x5e78('0x24')]][_0x5e78('0x36')]=_0xfccc71[_0x5e78('0x36')];if(this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0xfccc71['filename'],_0x5e78('0x37'),function(_0x1d42c0){logger[_0x5e78('0x27')](_0xfccc71['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x1d42c0[_0x5e78('0x38')]);attachment['create']({'name':path['parse'](_0xfccc71[_0x5e78('0x35')])[_0x5e78('0x26')],'basename':path[_0x5e78('0x39')](_0xfccc71[_0x5e78('0x35')])[_0x5e78('0x26')]+'.pdf','type':_0x5e78('0x3a')})['then'](function(_0x45f1f4){faxAccount[_0x5e78('0x3b')](_0xfd8f50,{'from':_0xfccc71['calleridnum'],'mapKey':'fax','body':path[_0x5e78('0x39')](_0xfccc71['filename'])['name']+'.pdf','AttachmentId':_0x45f1f4['id']})[_0x5e78('0x3c')](function(_0x4cdc4a){logger[_0x5e78('0x3d')](_0xfccc71['uniqueid'],_0x5e78('0x3e'),JSON[_0x5e78('0x3f')](_0x4cdc4a));});})[_0x5e78('0x3c')](function(_0x40130f){logger[_0x5e78('0x3d')](_0xfccc71[_0x5e78('0x24')],_0x5e78('0x40'),JSON['stringify'](_0x40130f));});});}logger[_0x5e78('0x27')](_0xfccc71[_0x5e78('0x24')],_0x5e78('0x40'));}};Fax[_0x5e78('0x1e')]['syncOriginateResponse']=function(_0x1a586d){if(this[_0x5e78('0x10')][_0x1a586d[_0x5e78('0x24')]]){_[_0x5e78('0x41')](this[_0x5e78('0x23')][_0x1a586d[_0x5e78('0x24')]],_[_0x5e78('0x42')](_0x1a586d,[_0x5e78('0x43'),_0x5e78('0x44')]));}};function updateStatus(_0x222584){if(_0x222584[_0x5e78('0x45')]){faxMessage[_0x5e78('0x46')](_0x222584[_0x5e78('0x45')],{'failMessage':_0x5e78('0x47')})['then'](function(_0x29b8e4){ut[_0x5e78('0x48')](_0x5e78('0x49'),_0x29b8e4);})[_0x5e78('0x3c')](function(_0xd50f71){ut[_0x5e78('0x48')](_0x5e78('0x4a'),_0xd50f71);});}else{ut[_0x5e78('0x48')](_0x5e78('0x4b'));}}Fax[_0x5e78('0x1e')]['updateStatus']=function(_0x58e086,_0x3ff49d,_0x199f16){var _0x5108ec=this;var _0x2405ad={};if(_0x3ff49d){_0x2405ad={'read':_0x3ff49d};}else{_0x2405ad={'failMessage':_0x199f16};}if(this[_0x5e78('0x10')][_0x58e086][_0x5e78('0x45')]){faxMessage['update'](this[_0x5e78('0x10')][_0x58e086]['AttachmentId'],_0x2405ad)['then'](function(_0x18d016){ut[_0x5e78('0x48')](_0x5e78('0x4c'),_0x18d016);})[_0x5e78('0x3c')](function(_0x6a7a1c){ut[_0x5e78('0x48')](_0x5e78('0x4d'),_0x6a7a1c);})[_0x5e78('0x4e')](function(){delete _0x5108ec[_0x5e78('0x23')][_0x58e086];delete _0x5108ec['actions'][_0x58e086];});}else{ut['logger'](_0x5e78('0x4f'));delete this[_0x5e78('0x23')][_0x58e086];delete this[_0x5e78('0x10')][_0x58e086];}};Fax['prototype'][_0x5e78('0x1c')]=function(_0x9db381){var _0x30a66f=this;if(this['channels'][_0x9db381[_0x5e78('0x24')]]){if(this[_0x5e78('0x10')][_0x9db381[_0x5e78('0x24')]]){this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]]['id']=this[_0x5e78('0x10')][_0x9db381[_0x5e78('0x24')]]['id'];this['channels'][_0x9db381['uniqueid']][_0x5e78('0x26')]=this['actions'][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x26')];}logger[_0x5e78('0x27')](_0x9db381[_0x5e78('0x24')],this['actions'][_0x9db381[_0x5e78('0x24')]]?_0x5e78('0x50'):_0x5e78('0x51'),JSON[_0x5e78('0x3f')](this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]]));if(this[_0x5e78('0x10')][_0x9db381[_0x5e78('0x24')]]){if(this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x52')]>0x0&&this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x19')]===_0x5e78('0x53')){this[_0x5e78('0x54')](_0x9db381[_0x5e78('0x24')],!![]);}else{this[_0x5e78('0x54')](_0x9db381[_0x5e78('0x24')],![],this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x55')]:_0x5e78('0x56'));}}}};Fax[_0x5e78('0x1e')][_0x5e78('0x57')]=function(_0x62b937){var _0x38bb39=this;return new BPromise(function(_0x454054,_0x34e980){_0x38bb39[_0x5e78('0x58')](_0x62b937,_0x38bb39[_0x5e78('0xe')][_0x62b937[_0x5e78('0x59')]])[_0x5e78('0x5a')](function(_0x42a6ca){ut[_0x5e78('0x48')]('[Fax][execOriginate][success]',_0x42a6ca);_0x454054(ut['message'](_0x5e78('0x5b')));})['catch'](function(_0x96b469){ut[_0x5e78('0x48')](_0x5e78('0x5c'),_0x96b469);updateStatus(_0x62b937);_0x34e980(ut[_0x5e78('0x38')]('Fax\x20failed'));});});};Fax['prototype'][_0x5e78('0x5d')]=function(_0x2e7f55){var _0x277024=this;return new BPromise(function(_0x424444,_0x4468bf){var _0x31dfb0=_0x277024[_0x5e78('0x5e')](_0x277024[_0x5e78('0xe')][_0x2e7f55[_0x5e78('0x59')]]['Trunk'],_0x2e7f55);if(_0x31dfb0[_0x5e78('0x5f')]){_0x424444(ut[_0x5e78('0x38')]('Trunk\x20Reachable'));}else{_0x4468bf(ut[_0x5e78('0x38')](_0x31dfb0[_0x5e78('0x38')]));}});};function originate(_0x18f9c3,_0x2a91c4,_0x43b459){return new BPromise(function(_0x23a714,_0x545715){if(_0x43b459){var _0x290d81=util[_0x5e78('0x60')](_0x5e78('0x61'),path['parse'](_0x18f9c3[_0x5e78('0x62')])[_0x5e78('0x26')],_0x18f9c3['path']);gs[_0x5e78('0x63')](_0x290d81)['then'](function(){_0x18f9c3[_0x5e78('0x62')]=util[_0x5e78('0x60')](_0x5e78('0x64'),path[_0x5e78('0x39')](_0x18f9c3[_0x5e78('0x62')])[_0x5e78('0x65')],path[_0x5e78('0x39')](_0x18f9c3[_0x5e78('0x62')])[_0x5e78('0x26')]);_0x2a91c4['XMF-PATH']=_0x18f9c3[_0x5e78('0x62')];ut[_0x5e78('0x48')](_0x5e78('0x66'),'');ami[_0x5e78('0x67')](ut[_0x5e78('0x68')](_0x18f9c3,_0x2a91c4))[_0x5e78('0x5a')](function(_0x5a9c35){_0x23a714(_0x5a9c35);})[_0x5e78('0x3c')](function(_0x364238){_0x545715(_0x364238);});})['catch'](function(_0x1d84df){_0x545715(_0x1d84df);});}else{ami[_0x5e78('0x67')](ut['variablesAction'](_0x18f9c3,_0x2a91c4))['then'](function(_0x1b7c76){_0x23a714(_0x1b7c76);})[_0x5e78('0x3c')](function(_0x5269d1){_0x545715(_0x5269d1);});}});}Fax['prototype'][_0x5e78('0x58')]=function(_0x5c2be0,_0x426dce){var _0x4e77f2=this;return new BPromise(function(_0x411005,_0x57aba4){var _0x2ef7fc=uuid['v4']();var _0x506901=ut[_0x5e78('0x69')](_0x5c2be0,_0x426dce);_0x4e77f2[_0x5e78('0x10')][_0x2ef7fc]=new Action(_0x2ef7fc,_0x426dce,_0x5c2be0);var _0x489c54=_0x4e77f2['actions'][_0x2ef7fc];if(path['parse'](_0x5c2be0['path'])[_0x5e78('0x6a')]===_0x5e78('0x6b')){originate(_0x489c54,_0x506901,!![])[_0x5e78('0x5a')](function(_0x1700a2){_0x411005(_0x1700a2);})[_0x5e78('0x3c')](function(_0xa154cf){_0x57aba4(_0xa154cf);});}else{originate(_0x489c54,_0x506901,![])['then'](function(_0x1ef02f){_0x411005(_0x1ef02f);})[_0x5e78('0x3c')](function(_0x4ed480){_0x57aba4(_0x4ed480);});}});};Fax[_0x5e78('0x1e')][_0x5e78('0x6c')]=function(_0x1d2f74){return!_[_0x5e78('0x6d')](_0x1d2f74)&&!_[_0x5e78('0x6d')](_0x1d2f74['name'])&&!_[_0x5e78('0x6d')](_0x1d2f74[_0x5e78('0x6e')])&&_0x1d2f74['active']&&!_['isNil'](this[_0x5e78('0xf')][util[_0x5e78('0x60')](_0x5e78('0x6f'),_0x1d2f74[_0x5e78('0x26')])])&&!_['isNil'](this[_0x5e78('0xf')][util['format'](_0x5e78('0x6f'),_0x1d2f74[_0x5e78('0x26')])][_0x5e78('0x2e')])&&(this[_0x5e78('0xf')][util['format'](_0x5e78('0x6f'),_0x1d2f74[_0x5e78('0x26')])]['status']===_0x5e78('0x70')||this[_0x5e78('0xf')][util[_0x5e78('0x60')]('SIP/%s',_0x1d2f74[_0x5e78('0x26')])]['status']==='unmonitored');};Fax[_0x5e78('0x1e')]['checkTrunk']=function(_0x1d2eb5,_0x35e465){if(!this['isTrunkReachable'](_0x1d2eb5)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x5e78('0x6d')](_0x1d2eb5)?'':_0x1d2eb5[_0x5e78('0x26')]+_0x5e78('0x71'));return{'isValid':![],'message':_0x5e78('0x72')};}if(_[_0x5e78('0x6d')](_0x35e465[_0x5e78('0x7')])){ut[_0x5e78('0x48')](_0x5e78('0x73'),JSON['stringify'](_0x35e465));return{'isValid':![],'message':_0x5e78('0x74')};}if(_['isNil'](_0x35e465['path'])){ut[_0x5e78('0x48')](_0x5e78('0x75'),JSON[_0x5e78('0x3f')](_0x35e465));return{'isValid':![],'message':_0x5e78('0x76')};}return{'isValid':!![],'message':_0x5e78('0x77')};};module[_0x5e78('0x78')]=Fax; \ No newline at end of file +var _0x4a9a=['channel','name','info','\x20syncNewchannel\x20','uniqueid','prototype','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','actions','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','localstationid'];(function(_0x89ec8e,_0x432d5b){var _0x3e5cab=function(_0x997c71){while(--_0x997c71){_0x89ec8e['push'](_0x89ec8e['shift']());}};_0x3e5cab(++_0x432d5b);}(_0x4a9a,0x1b0));var _0xa4a9=function(_0x56e857,_0x49ea58){_0x56e857=_0x56e857-0x0;var _0x79a466=_0x4a9a[_0x56e857];return _0x79a466;};'use strict';var util=require('util');var _=require(_0xa4a9('0x0'));var BPromise=require(_0xa4a9('0x1'));var uuid=require(_0xa4a9('0x2'));var moment=require(_0xa4a9('0x3'));var path=require('path');var tiff2pdf=require(_0xa4a9('0x4'));var gs=require(_0xa4a9('0x5'));var logger=require('../../../config/logger')(_0xa4a9('0x6'));var ami=require('../ami');var rpcDb=require(_0xa4a9('0x7'));var Channel=require(_0xa4a9('0x8'));var ut=require(_0xa4a9('0x9'));var Action=require('./action');var faxAccount=require(_0xa4a9('0xa'));var attachment=require(_0xa4a9('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x6bef86){this[_0xa4a9('0xc')]={};this[_0xa4a9('0xd')]=_0x6bef86['faxAccounts'];this['trunks']=_0x6bef86[_0xa4a9('0xe')];this['actions']={};ami['on'](_0xa4a9('0xf'),this['syncNewchannel'][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x11'),this['syncVarSet'][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x12'),this[_0xa4a9('0x13')][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x14'),this['syncNewExten'][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x15'),this[_0xa4a9('0x16')]['bind'](this));ami['on'](_0xa4a9('0x17'),this[_0xa4a9('0x18')][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x19'),this[_0xa4a9('0x1a')][_0xa4a9('0x10')](this));ami['on'](_0xa4a9('0x1b'),this[_0xa4a9('0x1c')][_0xa4a9('0x10')](this));}Fax['prototype']['syncNewchannel']=function(_0x9e360f){if(_0x9e360f[_0xa4a9('0x1d')]===_0xa4a9('0x1e')){for(var _0x5849d1 in this[_0xa4a9('0xd')]){if(this[_0xa4a9('0xd')]['hasOwnProperty'](_0x5849d1)){if(_0x9e360f['exten']===this[_0xa4a9('0xd')][_0x5849d1][_0xa4a9('0x1f')]){this['channels'][_0x9e360f['uniqueid']]={};this[_0xa4a9('0xc')][_0x9e360f['uniqueid']][_0xa4a9('0x20')]=_0x9e360f[_0xa4a9('0x20')];this[_0xa4a9('0xc')][_0x9e360f['uniqueid']]['id']=this[_0xa4a9('0xd')][_0x5849d1]['id'];this[_0xa4a9('0xc')][_0x9e360f['uniqueid']][_0xa4a9('0x21')]=this[_0xa4a9('0xd')][_0x5849d1][_0xa4a9('0x21')];logger[_0xa4a9('0x22')](_0x9e360f['uniqueid'],_0xa4a9('0x23'));}}}}if(this['actions'][_0x9e360f[_0xa4a9('0x24')]]){this[_0xa4a9('0xc')][_0x9e360f[_0xa4a9('0x24')]]={};this[_0xa4a9('0xc')][_0x9e360f[_0xa4a9('0x24')]][_0xa4a9('0x20')]=_0x9e360f['channel'];logger['info'](_0x9e360f[_0xa4a9('0x24')],'\x20syncNewchannel\x20');}};Fax[_0xa4a9('0x25')]['syncVarSet']=function(_0x4c0ae0){if(this[_0xa4a9('0xc')][_0x4c0ae0[_0xa4a9('0x24')]]){for(var _0x33dfa1 in _0x4c0ae0[_0xa4a9('0x26')]){if(_0x4c0ae0[_0xa4a9('0x26')][_0xa4a9('0x27')](_0x33dfa1)){this[_0xa4a9('0xc')][_0x4c0ae0[_0xa4a9('0x24')]][_0x33dfa1]=_0x4c0ae0[_0xa4a9('0x28')];}}}};Fax[_0xa4a9('0x25')][_0xa4a9('0x13')]=function(_0x287c31){if(this[_0xa4a9('0xc')][_0x287c31[_0xa4a9('0x24')]]){this[_0xa4a9('0xc')][_0x287c31[_0xa4a9('0x24')]][_0xa4a9('0x29')]=_0x287c31[_0xa4a9('0x29')];this[_0xa4a9('0xc')][_0x287c31[_0xa4a9('0x24')]][_0xa4a9('0x2a')]=_0x287c31['channelstatedesc'];}};Fax['prototype'][_0xa4a9('0x2b')]=function(_0x5eb43b){if(this[_0xa4a9('0xc')][_0x5eb43b['uniqueid']]){for(var _0x5d507b in _0x5eb43b[_0xa4a9('0x26')]){if(_0x5eb43b[_0xa4a9('0x26')]['hasOwnProperty'](_0x5d507b)){this[_0xa4a9('0xc')][_0x5eb43b[_0xa4a9('0x24')]][_0x5d507b]=_0x5eb43b[_0xa4a9('0x28')];}}}};Fax[_0xa4a9('0x25')][_0xa4a9('0x16')]=function(_0x381779){if(this['channels'][_0x381779[_0xa4a9('0x24')]]){this['channels'][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x2c')]=_0x381779[_0xa4a9('0x2c')];this['channels'][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x2d')]=_0x381779['status'];this[_0xa4a9('0xc')][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x1f')]=_0x381779[_0xa4a9('0x1f')];this[_0xa4a9('0xc')][_0x381779[_0xa4a9('0x24')]][_0xa4a9('0x2e')]=_0x381779['filename'];logger[_0xa4a9('0x22')](_0x381779['uniqueid'],_0xa4a9('0x2f'));}};Fax[_0xa4a9('0x25')]['syncReceiveFax']=function(_0x1fb8e9){var _0x4e840f=this;if(this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]){var _0x455ef2=this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]['id'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x30')]=_0x1fb8e9[_0xa4a9('0x30')];this['channels'][_0x1fb8e9[_0xa4a9('0x24')]]['pagestransferred']=_0x1fb8e9['pagestransferred'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x1f')]=_0x1fb8e9['localstationid'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x31')]=_0x1fb8e9[_0xa4a9('0x31')];this[_0xa4a9('0xc')][_0x1fb8e9['uniqueid']][_0xa4a9('0x32')]=_0x1fb8e9[_0xa4a9('0x32')];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]][_0xa4a9('0x2e')]=_0x1fb8e9['filename'];this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]['calleridnum']=_0x1fb8e9[_0xa4a9('0x33')];if(this[_0xa4a9('0xc')][_0x1fb8e9[_0xa4a9('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x1fb8e9[_0xa4a9('0x2e')],_0xa4a9('0x34'),function(_0xdf950b){logger['info'](_0x1fb8e9[_0xa4a9('0x24')],'\x20result\x20conversion\x20file\x20',_0xdf950b[_0xa4a9('0x35')]);attachment[_0xa4a9('0x36')]({'name':path[_0xa4a9('0x37')](_0x1fb8e9[_0xa4a9('0x2e')])[_0xa4a9('0x21')],'basename':path['parse'](_0x1fb8e9[_0xa4a9('0x2e')])[_0xa4a9('0x21')]+_0xa4a9('0x38'),'type':_0xa4a9('0x39')})[_0xa4a9('0x3a')](function(_0x5c9d){faxAccount[_0xa4a9('0x3b')](_0x455ef2,{'from':_0x1fb8e9['calleridnum'],'mapKey':'fax','body':path[_0xa4a9('0x37')](_0x1fb8e9[_0xa4a9('0x2e')])[_0xa4a9('0x21')]+'.pdf','AttachmentId':_0x5c9d['id']})[_0xa4a9('0x3c')](function(_0x44bd5c){logger[_0xa4a9('0x3d')](_0x1fb8e9[_0xa4a9('0x24')],_0xa4a9('0x3e'),JSON['stringify'](_0x44bd5c));});})[_0xa4a9('0x3c')](function(_0x5432bc){logger[_0xa4a9('0x3d')](_0x1fb8e9[_0xa4a9('0x24')],_0xa4a9('0x3f'),JSON[_0xa4a9('0x40')](_0x5432bc));});});}logger[_0xa4a9('0x22')](_0x1fb8e9[_0xa4a9('0x24')],_0xa4a9('0x3f'));}};Fax['prototype'][_0xa4a9('0x1c')]=function(_0xa41045){if(this[_0xa4a9('0x41')][_0xa41045[_0xa4a9('0x24')]]){_[_0xa4a9('0x42')](this['channels'][_0xa41045[_0xa4a9('0x24')]],_[_0xa4a9('0x43')](_0xa41045,[_0xa4a9('0x44'),'reason']));}};function updateStatus(_0x3d6def){if(_0x3d6def[_0xa4a9('0x45')]){faxMessage[_0xa4a9('0x46')](_0x3d6def['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x3adec3){ut['logger']('[Fax][Message][Error][Updated]',_0x3adec3);})[_0xa4a9('0x3c')](function(_0x3b92f9){ut[_0xa4a9('0x47')](_0xa4a9('0x48'),_0x3b92f9);});}else{ut[_0xa4a9('0x47')](_0xa4a9('0x49'));}}Fax[_0xa4a9('0x25')][_0xa4a9('0x4a')]=function(_0x116617,_0x5186a0,_0x36460c){var _0x4a5499=this;var _0x5a1968={};if(_0x5186a0){_0x5a1968={'read':_0x5186a0};}else{_0x5a1968={'failMessage':_0x36460c};}if(this['actions'][_0x116617][_0xa4a9('0x45')]){faxMessage[_0xa4a9('0x46')](this[_0xa4a9('0x41')][_0x116617][_0xa4a9('0x45')],_0x5a1968)[_0xa4a9('0x3a')](function(_0x281630){ut['logger']('[Fax][Message][Updated]',_0x281630);})[_0xa4a9('0x3c')](function(_0x59554f){ut[_0xa4a9('0x47')](_0xa4a9('0x4b'),_0x59554f);})[_0xa4a9('0x4c')](function(){delete _0x4a5499[_0xa4a9('0xc')][_0x116617];delete _0x4a5499['actions'][_0x116617];});}else{ut[_0xa4a9('0x47')](_0xa4a9('0x4d'));delete this['channels'][_0x116617];delete this['actions'][_0x116617];}};Fax['prototype'][_0xa4a9('0x1a')]=function(_0x215341){var _0x30c1de=this;if(this['channels'][_0x215341['uniqueid']]){if(this['actions'][_0x215341['uniqueid']]){this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]]['id']=this[_0xa4a9('0x41')][_0x215341['uniqueid']]['id'];this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x21')]=this[_0xa4a9('0x41')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x21')];}logger[_0xa4a9('0x22')](_0x215341[_0xa4a9('0x24')],this[_0xa4a9('0x41')][_0x215341[_0xa4a9('0x24')]]?_0xa4a9('0x4e'):_0xa4a9('0x4f'),JSON['stringify'](this[_0xa4a9('0xc')][_0x215341['uniqueid']]));if(this[_0xa4a9('0x41')][_0x215341[_0xa4a9('0x24')]]){if(this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x50')]>0x0&&this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]][_0xa4a9('0x15')]===_0xa4a9('0x51')){this[_0xa4a9('0x4a')](_0x215341[_0xa4a9('0x24')],!![]);}else{this[_0xa4a9('0x4a')](_0x215341[_0xa4a9('0x24')],![],this[_0xa4a9('0xc')][_0x215341[_0xa4a9('0x24')]]['faxstatusstring']?_0xa4a9('0x52')+this[_0xa4a9('0xc')][_0x215341['uniqueid']][_0xa4a9('0x53')]:_0xa4a9('0x54'));}}}};Fax[_0xa4a9('0x25')][_0xa4a9('0x55')]=function(_0x45b11f){var _0x49b712=this;return new BPromise(function(_0x1de673,_0x50e244){_0x49b712[_0xa4a9('0x56')](_0x45b11f,_0x49b712['faxAccounts'][_0x45b11f[_0xa4a9('0x57')]])[_0xa4a9('0x3a')](function(_0x288b5b){ut[_0xa4a9('0x47')]('[Fax][execOriginate][success]',_0x288b5b);_0x1de673(ut[_0xa4a9('0x35')](_0xa4a9('0x58')));})[_0xa4a9('0x3c')](function(_0x5b364e){ut[_0xa4a9('0x47')](_0xa4a9('0x59'),_0x5b364e);updateStatus(_0x45b11f);_0x50e244(ut[_0xa4a9('0x35')](_0xa4a9('0x5a')));});});};Fax['prototype']['checkAfterSend']=function(_0x221ac0){var _0xf30284=this;return new BPromise(function(_0x29a421,_0x13d655){var _0xc82ecf=_0xf30284[_0xa4a9('0x5b')](_0xf30284[_0xa4a9('0xd')][_0x221ac0[_0xa4a9('0x57')]][_0xa4a9('0x5c')],_0x221ac0);if(_0xc82ecf[_0xa4a9('0x5d')]){_0x29a421(ut['message'](_0xa4a9('0x5e')));}else{_0x13d655(ut[_0xa4a9('0x35')](_0xc82ecf[_0xa4a9('0x35')]));}});};function originate(_0x36314b,_0x43bd8f,_0x2be0ca){return new BPromise(function(_0x32e0ee,_0x20add8){if(_0x2be0ca){var _0x57998f=util[_0xa4a9('0x5f')](_0xa4a9('0x60'),path[_0xa4a9('0x37')](_0x36314b[_0xa4a9('0x61')])[_0xa4a9('0x21')],_0x36314b[_0xa4a9('0x61')]);gs['execute'](_0x57998f)[_0xa4a9('0x3a')](function(){_0x36314b[_0xa4a9('0x61')]=util[_0xa4a9('0x5f')](_0xa4a9('0x62'),path['parse'](_0x36314b['path'])['dir'],path[_0xa4a9('0x37')](_0x36314b['path'])[_0xa4a9('0x21')]);_0x43bd8f[_0xa4a9('0x63')]=_0x36314b[_0xa4a9('0x61')];ut[_0xa4a9('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0xa4a9('0x64')](ut[_0xa4a9('0x65')](_0x36314b,_0x43bd8f))[_0xa4a9('0x3a')](function(_0x2673b6){_0x32e0ee(_0x2673b6);})[_0xa4a9('0x3c')](function(_0x5eaf86){_0x20add8(_0x5eaf86);});})[_0xa4a9('0x3c')](function(_0x2e98c9){_0x20add8(_0x2e98c9);});}else{ami[_0xa4a9('0x64')](ut[_0xa4a9('0x65')](_0x36314b,_0x43bd8f))[_0xa4a9('0x3a')](function(_0x3df6ec){_0x32e0ee(_0x3df6ec);})[_0xa4a9('0x3c')](function(_0x45653f){_0x20add8(_0x45653f);});}});}Fax[_0xa4a9('0x25')][_0xa4a9('0x56')]=function(_0xe5ee11,_0x5902d1){var _0x482a71=this;return new BPromise(function(_0x264b67,_0x3b2b52){var _0xdc6797=uuid['v4']();var _0x2c97b8=ut[_0xa4a9('0x66')](_0xe5ee11,_0x5902d1);_0x482a71[_0xa4a9('0x41')][_0xdc6797]=new Action(_0xdc6797,_0x5902d1,_0xe5ee11);var _0x49ed9e=_0x482a71[_0xa4a9('0x41')][_0xdc6797];if(path[_0xa4a9('0x37')](_0xe5ee11[_0xa4a9('0x61')])[_0xa4a9('0x67')]===_0xa4a9('0x38')){originate(_0x49ed9e,_0x2c97b8,!![])[_0xa4a9('0x3a')](function(_0x5c4fac){_0x264b67(_0x5c4fac);})['catch'](function(_0x2b028b){_0x3b2b52(_0x2b028b);});}else{originate(_0x49ed9e,_0x2c97b8,![])[_0xa4a9('0x3a')](function(_0x79930a){_0x264b67(_0x79930a);})[_0xa4a9('0x3c')](function(_0x183488){_0x3b2b52(_0x183488);});}});};Fax[_0xa4a9('0x25')][_0xa4a9('0x68')]=function(_0x40b95e){return!_[_0xa4a9('0x69')](_0x40b95e)&&!_[_0xa4a9('0x69')](_0x40b95e['name'])&&!_[_0xa4a9('0x69')](_0x40b95e[_0xa4a9('0x6a')])&&_0x40b95e[_0xa4a9('0x6a')]&&!_['isNil'](this['trunks'][util['format'](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])])&&!_[_0xa4a9('0x69')](this[_0xa4a9('0xe')][util['format'](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])][_0xa4a9('0x2d')])&&(this[_0xa4a9('0xe')][util[_0xa4a9('0x5f')](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])][_0xa4a9('0x2d')]===_0xa4a9('0x6c')||this['trunks'][util['format'](_0xa4a9('0x6b'),_0x40b95e[_0xa4a9('0x21')])][_0xa4a9('0x2d')]===_0xa4a9('0x6d'));};Fax[_0xa4a9('0x25')][_0xa4a9('0x5b')]=function(_0x301d93,_0x1e47b9){if(!this[_0xa4a9('0x68')](_0x301d93)){ut['logger'](_0xa4a9('0x6e'),_['isNil'](_0x301d93)?'':_0x301d93['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xa4a9('0x6f')};}if(_[_0xa4a9('0x69')](_0x1e47b9[_0xa4a9('0x6')])){ut[_0xa4a9('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xa4a9('0x40')](_0x1e47b9));return{'isValid':![],'message':_0xa4a9('0x70')};}if(_[_0xa4a9('0x69')](_0x1e47b9[_0xa4a9('0x61')])){ut['logger'](_0xa4a9('0x71'),JSON['stringify'](_0x1e47b9));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xa4a9('0x72')};};module[_0xa4a9('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 64f5157..8cd8bc1 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 _0x3d61=['../../../config/logger','preview','../rpc/faxAccount','inspect','notify','resolve','then','catch','util','bluebird'];(function(_0x726b28,_0x308f6){var _0x2e5208=function(_0x1864b2){while(--_0x1864b2){_0x726b28['push'](_0x726b28['shift']());}};_0x2e5208(++_0x308f6);}(_0x3d61,0x120));var _0x13d6=function(_0x15241b,_0x5beebf){_0x15241b=_0x15241b-0x0;var _0x284afc=_0x3d61[_0x15241b];return _0x284afc;};'use strict';var util=require(_0x13d6('0x0'));var BPromise=require(_0x13d6('0x1'));var logger=require(_0x13d6('0x2'))(_0x13d6('0x3'));var _=require('lodash');var faxAccount=require(_0x13d6('0x4'));function loggerCatch(_0x1f9959){return function(_0x2e6f17){logger['error'](_0x1f9959,util[_0x13d6('0x5')](_0x2e6f17,{'showHidden':![],'depth':null}));};}exports[_0x13d6('0x6')]=function(_0xce3fb1,_0x55520e){return BPromise[_0x13d6('0x7')]()[_0x13d6('0x8')](faxAccount[_0x13d6('0x6')](_0xce3fb1,_0x55520e))[_0x13d6('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x400e=['preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x3cb664,_0x29edc3){var _0x2eaff0=function(_0x181825){while(--_0x181825){_0x3cb664['push'](_0x3cb664['shift']());}};_0x2eaff0(++_0x29edc3);}(_0x400e,0x195));var _0xe400=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x400e[_0x3f9584];return _0x9d54c;};'use strict';var util=require(_0xe400('0x0'));var BPromise=require(_0xe400('0x1'));var logger=require(_0xe400('0x2'))(_0xe400('0x3'));var _=require(_0xe400('0x4'));var faxAccount=require(_0xe400('0x5'));function loggerCatch(_0x32d24a){return function(_0x575cb7){logger[_0xe400('0x6')](_0x32d24a,util[_0xe400('0x7')](_0x575cb7,{'showHidden':![],'depth':null}));};}exports[_0xe400('0x8')]=function(_0x59b6ae,_0x50fcea){return BPromise[_0xe400('0x9')]()['then'](faxAccount[_0xe400('0x8')](_0x59b6ae,_0x50fcea))[_0xe400('0xa')](loggerCatch(_0xe400('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 49f7685..93fbea9 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 _0x36a2=['Exec\x20gs','inspect','../../../../config/logger','fax','child_process','exec','execute','info'];(function(_0x37a22b,_0x254ca9){var _0x1cb235=function(_0x2f2ac2){while(--_0x2f2ac2){_0x37a22b['push'](_0x37a22b['shift']());}};_0x1cb235(++_0x254ca9);}(_0x36a2,0xba));var _0x236a=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0x36a2[_0x4fa738];return _0x55bf55;};'use strict';var util=require('util');var logger=require(_0x236a('0x0'))(_0x236a('0x1'));var BPromise=require('bluebird');var exec=require(_0x236a('0x2'))[_0x236a('0x3')];exports[_0x236a('0x4')]=function(_0x15a47d){return new BPromise(function(_0x4243af,_0x2e115c){exec(_0x15a47d,function(_0x39c377,_0x681a8f,_0x31d149){logger[_0x236a('0x5')](_0x236a('0x6'),_0x681a8f);if(_0x39c377){logger[_0x236a('0x5')](_0x236a('0x6'),'\x20Error\x20:',util[_0x236a('0x7')](_0x39c377,{'showHidden':![],'depth':null}),_0x681a8f,_0x31d149);_0x2e115c(_0x39c377);}_0x4243af(_0x681a8f);});});}; \ No newline at end of file +var _0x3ef1=['exec','execute','Exec\x20gs','inspect','util','fax','bluebird'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x3ef1,0x11c));var _0x13ef=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x3ef1[_0x42245d];return _0x4b211a;};'use strict';var util=require(_0x13ef('0x0'));var logger=require('../../../../config/logger')(_0x13ef('0x1'));var BPromise=require(_0x13ef('0x2'));var exec=require('child_process')[_0x13ef('0x3')];exports[_0x13ef('0x4')]=function(_0x4408c1){return new BPromise(function(_0x321baf,_0x869490){exec(_0x4408c1,function(_0x21aee8,_0x5519ab,_0x52ae49){logger['info'](_0x13ef('0x5'),_0x5519ab);if(_0x21aee8){logger['info']('Exec\x20gs','\x20Error\x20:',util[_0x13ef('0x6')](_0x21aee8,{'showHidden':![],'depth':null}),_0x5519ab,_0x52ae49);_0x869490(_0x21aee8);}_0x321baf(_0x5519ab);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 17a9e95..e0dab67 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 _0x2bc6=['moment','logger','info','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash'];(function(_0x112aa4,_0x2f4419){var _0x24a0c7=function(_0x534a3f){while(--_0x534a3f){_0x112aa4['push'](_0x112aa4['shift']());}};_0x24a0c7(++_0x2f4419);}(_0x2bc6,0x163));var _0x62bc=function(_0x2563dd,_0xffb1a7){_0x2563dd=_0x2563dd-0x0;var _0x220b17=_0x2bc6[_0x2563dd];return _0x220b17;};'use strict';var util=require(_0x62bc('0x0'));var _=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x5c5a2a){return{'message':_0x5c5a2a};};exports[_0x62bc('0x3')]=function(_0x576608,_0x2a1959){logger[_0x62bc('0x4')](_0x576608,util['inspect'](_0x2a1959,{'showHidden':![],'depth':null}));};exports[_0x62bc('0x5')]=function(_0x450cb6,_0x40af10){var _0x3f3dc9={'XMF-ECM':_0x40af10[_0x62bc('0x6')],'XMF-HEADERINFO':_0x40af10[_0x62bc('0x7')],'XMF-MINRATE':_0x40af10['minrate'],'XMF-MAXRATE':_0x40af10[_0x62bc('0x8')],'XMF-MODEM':util[_0x62bc('0x9')](_0x62bc('0xa'),_0x40af10[_0x62bc('0xb')]),'XMF-GATEWAY':_0x40af10['gateway'],'XMF-FAXDETECT':_0x40af10[_0x62bc('0xc')],'XMF-T38TIMEOUT':_0x40af10[_0x62bc('0xd')],'XMF-LOCALSTATIONID':_0x40af10[_0x62bc('0xe')],'XMF-PATH':_0x450cb6['path']};return _0x3f3dc9;};exports[_0x62bc('0xf')]=function(_0x22e6c8,_0x256784){return{'actionid':_0x22e6c8[_0x62bc('0x10')],'action':_0x62bc('0x11'),'channel':_0x22e6c8[_0x62bc('0x12')],'Exten':_0x62bc('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x62bc('0x9')](_0x62bc('0x14'),_0x22e6c8['headerinfo']?_0x22e6c8[_0x62bc('0x7')]:'',_0x22e6c8[_0x62bc('0xe')]),'variable':_0x256784,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x22e6c8[_0x62bc('0x10')]};}; \ No newline at end of file +var _0xb821=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','message','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0x1c37a5,_0x59ee51){var _0x389d03=function(_0x51b4f4){while(--_0x51b4f4){_0x1c37a5['push'](_0x1c37a5['shift']());}};_0x389d03(++_0x59ee51);}(_0xb821,0xa7));var _0x1b82=function(_0x21f7bf,_0x16f7e0){_0x21f7bf=_0x21f7bf-0x0;var _0x14c5ed=_0xb821[_0x21f7bf];return _0x14c5ed;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x1b82('0x2')]=function(_0x578a10){return{'message':_0x578a10};};exports['logger']=function(_0x3b1d14,_0x1403ab){logger[_0x1b82('0x3')](_0x3b1d14,util[_0x1b82('0x4')](_0x1403ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e27c4,_0x192434){var _0x202a5f={'XMF-ECM':_0x192434[_0x1b82('0x5')],'XMF-HEADERINFO':_0x192434[_0x1b82('0x6')],'XMF-MINRATE':_0x192434[_0x1b82('0x7')],'XMF-MAXRATE':_0x192434[_0x1b82('0x8')],'XMF-MODEM':util[_0x1b82('0x9')](_0x1b82('0xa'),_0x192434['modem']),'XMF-GATEWAY':_0x192434[_0x1b82('0xb')],'XMF-FAXDETECT':_0x192434[_0x1b82('0xc')],'XMF-T38TIMEOUT':_0x192434[_0x1b82('0xd')],'XMF-LOCALSTATIONID':_0x192434[_0x1b82('0xe')],'XMF-PATH':_0x3e27c4[_0x1b82('0xf')]};return _0x202a5f;};exports[_0x1b82('0x10')]=function(_0x739f99,_0x1ce719){return{'actionid':_0x739f99['uniqueid'],'action':_0x1b82('0x11'),'channel':_0x739f99[_0x1b82('0x12')],'Exten':_0x1b82('0x13'),'Context':_0x1b82('0x14'),'Priority':'1','callerid':util['format'](_0x1b82('0x15'),_0x739f99['headerinfo']?_0x739f99['headerinfo']:'',_0x739f99[_0x1b82('0xe')]),'variable':_0x1ce719,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x739f99['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index c4a04d4..47bf011 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 _0x810f=['getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x810f,0x114));var _0xf810=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x810f[_0x3b0731];return _0x4204d7;};'use strict';var BPromise=require(_0xf810('0x0'));var util=require(_0xf810('0x1'));var moment=require(_0xf810('0x2'));var server=require('./server');var Realtime=require(_0xf810('0x3'));var Report=require(_0xf810('0x4'));var Acw=require('./acw');var Trigger=require(_0xf810('0x5'));var Dialer=require(_0xf810('0x6'));var Preview=require(_0xf810('0x7'));var Fax=require('./fax');var user=require(_0xf810('0x8'));var voiceQueue=require(_0xf810('0x9'));var voiceQueueReport=require(_0xf810('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xf810('0xb'));var trigger=require(_0xf810('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0xf810('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf810('0xe'));var zendesk=require(_0xf810('0xf'));var salesforce=require(_0xf810('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xf810('0x11'));var desk=require(_0xf810('0x12'));var zoho=require(_0xf810('0x13'));var vtiger=require(_0xf810('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xf810('0x15'));var dynamics365=require(_0xf810('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf810('0x17')](_0xf810('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf810('0x17')](_0xf810('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xf810('0x19')](user[_0xf810('0x1a')]())[_0xf810('0x19')](realtime[_0xf810('0x1b')]())[_0xf810('0x19')](user['getTelephones']())[_0xf810('0x19')](realtime[_0xf810('0x1c')]())[_0xf810('0x19')](trunk[_0xf810('0x1d')]())[_0xf810('0x19')](realtime[_0xf810('0x1e')]())[_0xf810('0x19')](voiceQueue[_0xf810('0x1f')]())[_0xf810('0x19')](realtime[_0xf810('0x20')]())[_0xf810('0x19')](trigger[_0xf810('0x21')]())[_0xf810('0x19')](realtime[_0xf810('0x22')]())[_0xf810('0x19')](template[_0xf810('0x23')]())[_0xf810('0x19')](realtime[_0xf810('0x24')]())[_0xf810('0x19')](zendesk[_0xf810('0x25')]())[_0xf810('0x19')](realtime[_0xf810('0x26')]())[_0xf810('0x19')](salesforce['getSalesforceAccounts']())[_0xf810('0x19')](realtime[_0xf810('0x27')]())['then'](sugarcrm[_0xf810('0x28')]())[_0xf810('0x19')](realtime[_0xf810('0x29')]())[_0xf810('0x19')](freshdesk[_0xf810('0x2a')]())['then'](realtime[_0xf810('0x2b')]())[_0xf810('0x19')](desk[_0xf810('0x2c')]())[_0xf810('0x19')](realtime['initDeskAccounts']())['then'](zoho[_0xf810('0x2d')]())[_0xf810('0x19')](realtime[_0xf810('0x2e')]())[_0xf810('0x19')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0xf810('0x19')](freshsales['getFreshsalesAccounts']())[_0xf810('0x19')](realtime[_0xf810('0x2f')]())[_0xf810('0x19')](servicenow[_0xf810('0x30')]())[_0xf810('0x19')](realtime[_0xf810('0x31')]())[_0xf810('0x19')](dynamics365['getDynamics365Accounts']())[_0xf810('0x19')](realtime[_0xf810('0x32')]())[_0xf810('0x19')](campaign[_0xf810('0x33')]())[_0xf810('0x19')](realtime[_0xf810('0x34')]())[_0xf810('0x19')](voiceExtension[_0xf810('0x35')]())['then'](realtime[_0xf810('0x36')]())[_0xf810('0x19')](faxAccount['getFaxAccounts']())['then'](realtime[_0xf810('0x37')]())[_0xf810('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xf810('0x38')]()[_0xf810('0x19')](voiceQueueReport[_0xf810('0x39')]())[_0xf810('0x19')](realtime[_0xf810('0x3a')]())[_0xf810('0x19')](cmHopperHistory[_0xf810('0x3b')]())[_0xf810('0x19')](realtime[_0xf810('0x3c')]())[_0xf810('0x19')](cmHopperHistory['getCampaignHopperHistory']())[_0xf810('0x19')](realtime['initCampaignHopperHistory']())[_0xf810('0x19')](voiceCallReport[_0xf810('0x3d')]())['then'](realtime[_0xf810('0x3e')]())[_0xf810('0x19')](function(_0x5e5bc5){})[_0xf810('0x3f')](function(_0x333ce4){console['log'](_0x333ce4);});}function main(){return server[_0xf810('0x40')](realtime,preview,fax)[_0xf810('0x19')](function(_0x1ba3b3){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xf810('0x41')]();setInterval(initRealtime,0x1388);})[_0xf810('0x3f')](function(_0x3069fc){console[_0xf810('0x42')](_0x3069fc);});}main(); \ No newline at end of file +var _0xfde9=['sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch'];(function(_0x803309,_0x273077){var _0x2d5337=function(_0x24167c){while(--_0x24167c){_0x803309['push'](_0x803309['shift']());}};_0x2d5337(++_0x273077);}(_0xfde9,0x141));var _0x9fde=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0xfde9[_0x4cf0b7];return _0x545f10;};'use strict';var BPromise=require(_0x9fde('0x0'));var util=require('util');var moment=require(_0x9fde('0x1'));var server=require(_0x9fde('0x2'));var Realtime=require(_0x9fde('0x3'));var Report=require(_0x9fde('0x4'));var Acw=require(_0x9fde('0x5'));var Trigger=require(_0x9fde('0x6'));var Dialer=require(_0x9fde('0x7'));var Preview=require(_0x9fde('0x8'));var Fax=require('./fax');var user=require(_0x9fde('0x9'));var voiceQueue=require(_0x9fde('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x9fde('0xb'));var trunk=require(_0x9fde('0xc'));var trigger=require(_0x9fde('0xd'));var template=require(_0x9fde('0xe'));var cmHopperHistory=require(_0x9fde('0xf'));var campaign=require(_0x9fde('0x10'));var voiceExtension=require(_0x9fde('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x9fde('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9fde('0x13'));var desk=require(_0x9fde('0x14'));var zoho=require(_0x9fde('0x15'));var vtiger=require(_0x9fde('0x16'));var freshsales=require(_0x9fde('0x17'));var servicenow=require(_0x9fde('0x18'));var dynamics365=require(_0x9fde('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x9fde('0x1a')](_0x9fde('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9fde('0x1a')](_0x9fde('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9fde('0x1c')]()[_0x9fde('0x1d')](user[_0x9fde('0x1e')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x1f')]())['then'](user[_0x9fde('0x20')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x21')]())[_0x9fde('0x1d')](trunk[_0x9fde('0x22')]())['then'](realtime[_0x9fde('0x23')]())['then'](voiceQueue[_0x9fde('0x24')]())[_0x9fde('0x1d')](realtime['initVoiceQueues']())[_0x9fde('0x1d')](trigger[_0x9fde('0x25')]())[_0x9fde('0x1d')](realtime['initTriggers']())[_0x9fde('0x1d')](template['getTemplates']())[_0x9fde('0x1d')](realtime['initTemplates']())[_0x9fde('0x1d')](zendesk['getZendeskAccounts']())[_0x9fde('0x1d')](realtime[_0x9fde('0x26')]())[_0x9fde('0x1d')](salesforce[_0x9fde('0x27')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x28')]())[_0x9fde('0x1d')](sugarcrm[_0x9fde('0x29')]())[_0x9fde('0x1d')](realtime['initSugarcrmAccounts']())[_0x9fde('0x1d')](freshdesk[_0x9fde('0x2a')]())[_0x9fde('0x1d')](realtime['initFreshdeskAccounts']())[_0x9fde('0x1d')](desk[_0x9fde('0x2b')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x2c')]())[_0x9fde('0x1d')](zoho['getZohoAccounts']())[_0x9fde('0x1d')](realtime[_0x9fde('0x2d')]())['then'](vtiger[_0x9fde('0x2e')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x2f')]())['then'](freshsales['getFreshsalesAccounts']())[_0x9fde('0x1d')](realtime[_0x9fde('0x30')]())['then'](servicenow[_0x9fde('0x31')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x32')]())[_0x9fde('0x1d')](dynamics365[_0x9fde('0x33')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x34')]())['then'](campaign['getCampaigns']())[_0x9fde('0x1d')](realtime['initCampaigns']())['then'](voiceExtension[_0x9fde('0x35')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x36')]())['then'](faxAccount[_0x9fde('0x37')]())['then'](realtime[_0x9fde('0x38')]())[_0x9fde('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x9fde('0x1d')](voiceQueueReport[_0x9fde('0x39')]())[_0x9fde('0x1d')](realtime[_0x9fde('0x3a')]())[_0x9fde('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x9fde('0x1d')](realtime[_0x9fde('0x3b')]())[_0x9fde('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x9fde('0x1d')](realtime[_0x9fde('0x3c')]())['then'](voiceCallReport[_0x9fde('0x3d')]())['then'](realtime['initVoiceCallReports']())[_0x9fde('0x1d')](function(_0x3595a5){})[_0x9fde('0x3e')](function(_0x4ba1cf){console['log'](_0x4ba1cf);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x46ecee){return initRealtime();})[_0x9fde('0x1d')](function(){return initParams();})[_0x9fde('0x1d')](function(){report[_0x9fde('0x3f')]();setInterval(initRealtime,0x1388);})[_0x9fde('0x3e')](function(_0x5c07b8){console['log'](_0x5c07b8);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 2bea8f3..6af2ae6 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 _0x167d=['util','moment','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','toNumber','format','address','stringify','user:%s','emit','user:save','lodash'];(function(_0x3c5b33,_0x1ce8fa){var _0x269a62=function(_0x26a7e5){while(--_0x26a7e5){_0x3c5b33['push'](_0x3c5b33['shift']());}};_0x269a62(++_0x1ce8fa);}(_0x167d,0x143));var _0xd167=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x167d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd167('0x0'));var util=require(_0xd167('0x1'));var moment=require(_0xd167('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xd167('0x3'));config[_0xd167('0x4')]=_[_0xd167('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd167('0x6'))(new Redis(config['redis']));function Agent(_0x601e6a){this['id']=_0x601e6a['id']||0x0;this[_0xd167('0x7')]=_0x601e6a[_0xd167('0x7')]||'';this[_0xd167('0x8')]=_0x601e6a[_0xd167('0x8')]||'';this[_0xd167('0x9')]=_0x601e6a[_0xd167('0x9')]||'';this['fullname']=_0x601e6a[_0xd167('0xa')]||'';this[_0xd167('0xb')]='unknown';this['stateTime']=0x0;this[_0xd167('0xc')]=_0xd167('0xd');this['address']='';this[_0xd167('0xe')]='';this['mobile']='';this[_0xd167('0xf')]='';this[_0xd167('0x10')]=_0x601e6a[_0xd167('0x10')]||![];this[_0xd167('0x11')]=_0xd167('0xd');this[_0xd167('0x12')]=0x0;this[_0xd167('0x13')]='';this[_0xd167('0x14')]='';this[_0xd167('0x15')]=![];this['local']=![];this[_0xd167('0x16')]='';}Agent[_0xd167('0x17')][_0xd167('0x18')]=function(_0x34c7de){var _0x5c6e1f;if(_0x34c7de&&_0x34c7de['state']){_0x5c6e1f=_0x34c7de[_0xd167('0xb')][_0xd167('0x19')]();switch(_0x5c6e1f){case _0xd167('0x1a'):_0x5c6e1f=_0xd167('0x1b');break;case'inuse':_0x5c6e1f=_0xd167('0x1c');break;}}if(_0x5c6e1f&&this[_0xd167('0x11')]!==_0x5c6e1f||_0x34c7de['statePause']){this[_0xd167('0x12')]=_[_0xd167('0x1d')](moment()[_0xd167('0x1e')]('x'));}if(_0x5c6e1f){this[_0xd167('0x11')]=_0x5c6e1f;}var _0x1ad3f0={'id':this['id'],'name':this['name'],'email':this[_0xd167('0x8')],'accountcode':this[_0xd167('0x9')],'fullname':this[_0xd167('0xa')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xd167('0x1f')],'online':this[_0xd167('0x10')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd167('0x12')],'voiceStatusCallerIdNumber':this[_0xd167('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd167('0xf')],'onhold':this[_0xd167('0x15')]};var _0x80d060=md5(JSON[_0xd167('0x20')](_0x1ad3f0));if(this[_0xd167('0x16')]!==_0x80d060){this['md5']=_0x80d060;io['to'](util['format'](_0xd167('0x21'),_0x1ad3f0['name']))[_0xd167('0x22')](_0xd167('0x23'),_0x1ad3f0);}};module['exports']=Agent; \ No newline at end of file +var _0x5b55=['state','toLowerCase','not_inuse','idle','talking','statePause','voiceStatusTime','toNumber','format','interface','onhold','stringify','user:%s','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','name','email','accountcode','fullname','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime'];(function(_0x20c8c5,_0x28e1ee){var _0x3309b0=function(_0x264c43){while(--_0x264c43){_0x20c8c5['push'](_0x20c8c5['shift']());}};_0x3309b0(++_0x28e1ee);}(_0x5b55,0x18a));var _0x55b5=function(_0x18175b,_0x4d7376){_0x18175b=_0x18175b-0x0;var _0x210d45=_0x5b55[_0x18175b];return _0x210d45;};'use strict';var _=require(_0x55b5('0x0'));var util=require(_0x55b5('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x55b5('0x2'));var config=require(_0x55b5('0x3'));config['redis']=_[_0x55b5('0x4')](config[_0x55b5('0x5')],{'host':_0x55b5('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x55b5('0x5')]));function Agent(_0x5640d0){this['id']=_0x5640d0['id']||0x0;this[_0x55b5('0x7')]=_0x5640d0[_0x55b5('0x7')]||'';this['email']=_0x5640d0[_0x55b5('0x8')]||'';this[_0x55b5('0x9')]=_0x5640d0[_0x55b5('0x9')]||'';this['fullname']=_0x5640d0[_0x55b5('0xa')]||'';this['state']='unknown';this[_0x55b5('0xb')]=0x0;this[_0x55b5('0xc')]='unknown';this[_0x55b5('0xd')]='';this[_0x55b5('0xe')]='';this[_0x55b5('0xf')]='';this['interface']='';this[_0x55b5('0x10')]=_0x5640d0['online']||![];this[_0x55b5('0x11')]='unknown';this['voiceStatusTime']=0x0;this[_0x55b5('0x12')]='';this[_0x55b5('0x13')]='';this['onhold']=![];this[_0x55b5('0x14')]=![];this[_0x55b5('0x15')]='';}Agent[_0x55b5('0x16')][_0x55b5('0x17')]=function(_0x2e37fe){var _0x2bb2d3;if(_0x2e37fe&&_0x2e37fe[_0x55b5('0x18')]){_0x2bb2d3=_0x2e37fe[_0x55b5('0x18')][_0x55b5('0x19')]();switch(_0x2bb2d3){case _0x55b5('0x1a'):_0x2bb2d3=_0x55b5('0x1b');break;case'inuse':_0x2bb2d3=_0x55b5('0x1c');break;}}if(_0x2bb2d3&&this['voiceStatus']!==_0x2bb2d3||_0x2e37fe[_0x55b5('0x1d')]){this[_0x55b5('0x1e')]=_[_0x55b5('0x1f')](moment()[_0x55b5('0x20')]('x'));}if(_0x2bb2d3){this['voiceStatus']=_0x2bb2d3;}var _0x1add5d={'id':this['id'],'name':this[_0x55b5('0x7')],'email':this[_0x55b5('0x8')],'accountcode':this[_0x55b5('0x9')],'fullname':this['fullname'],'state':this[_0x55b5('0x18')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x55b5('0xd')],'online':this[_0x55b5('0x10')],'voiceStatus':this[_0x55b5('0x11')],'voiceStatusTime':this[_0x55b5('0x1e')],'voiceStatusCallerIdNumber':this[_0x55b5('0x12')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x55b5('0x21')],'onhold':this[_0x55b5('0x22')]};var _0x457d4d=md5(JSON[_0x55b5('0x23')](_0x1add5d));if(this['md5']!==_0x457d4d){this['md5']=_0x457d4d;io['to'](util[_0x55b5('0x20')](_0x55b5('0x24'),_0x1add5d['name']))['emit']('user:save',_0x1add5d);}};module[_0x55b5('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 46f5d9b..5d78e45 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 _0x17bd=['exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17bd,0xfb));var _0xd17b=function(_0xec88c3,_0x1be347){_0xec88c3=_0xec88c3-0x0;var _0x331d53=_0x17bd[_0xec88c3];return _0x331d53;};'use strict';function Campaign(_0x2652a4){this['id']=_0x2652a4['id']||0x0;this[_0xd17b('0x0')]=_0x2652a4[_0xd17b('0x0')]||'';this['type']=_0x2652a4[_0xd17b('0x1')]||_0xd17b('0x2');this[_0xd17b('0x3')]=0x0;this[_0xd17b('0x4')]=0x0;this[_0xd17b('0x5')]=0x0;this[_0xd17b('0x6')]=0x0;this[_0xd17b('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0xd17b('0x8')]=_0x2652a4[_0xd17b('0x8')];this[_0xd17b('0x9')]=_0x2652a4[_0xd17b('0x9')];this[_0xd17b('0xa')]=_0x2652a4[_0xd17b('0xa')]||null;this[_0xd17b('0xb')]=_0x2652a4[_0xd17b('0xb')]?_0x2652a4[_0xd17b('0xb')]:null;this[_0xd17b('0xc')]=_0x2652a4[_0xd17b('0xc')];this[_0xd17b('0xd')]=_0x2652a4['dialOriginateCallerIdNumber'];this[_0xd17b('0xe')]=_0x2652a4[_0xd17b('0xe')]||0x1e;this[_0xd17b('0xf')]=_0x2652a4[_0xd17b('0xf')];this['dialCongestionRetryFrequency']=_0x2652a4[_0xd17b('0x10')];this['dialBusyMaxRetry']=_0x2652a4[_0xd17b('0x11')];this[_0xd17b('0x12')]=_0x2652a4[_0xd17b('0x12')];this['dialNoAnswerMaxRetry']=_0x2652a4[_0xd17b('0x13')];this[_0xd17b('0x14')]=_0x2652a4[_0xd17b('0x14')];this[_0xd17b('0x15')]=_0x2652a4[_0xd17b('0x15')];this['dialNoSuchNumberMaxRetry']=_0x2652a4[_0xd17b('0x16')]||0x3;this[_0xd17b('0x17')]=_0x2652a4[_0xd17b('0x17')]||0x96;this[_0xd17b('0x18')]=_0x2652a4['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x2652a4['dialDropRetryFrequency']||0x96;this[_0xd17b('0x19')]=_0x2652a4['dialAbandonedMaxRetry']||0x3;this[_0xd17b('0x1a')]=_0x2652a4[_0xd17b('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x2652a4[_0xd17b('0x1b')]||0x3;this[_0xd17b('0x1c')]=_0x2652a4[_0xd17b('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x2652a4[_0xd17b('0x1d')]||0x3;this[_0xd17b('0x1e')]=_0x2652a4[_0xd17b('0x1e')]||0x96;this[_0xd17b('0x1f')]=_0x2652a4[_0xd17b('0x1f')]||'DESC';this['dialPrefix']=_0x2652a4[_0xd17b('0x20')]||undefined;this[_0xd17b('0x21')]=_0x2652a4[_0xd17b('0x21')]||undefined;this[_0xd17b('0x22')]=_0x2652a4[_0xd17b('0x22')]||undefined;this['TrunkBackup']=_0x2652a4[_0xd17b('0x23')]?_0x2652a4[_0xd17b('0x23')]:undefined;this[_0xd17b('0x24')]=_0x2652a4[_0xd17b('0x24')]?_0x2652a4['Trunk']:undefined;this['Interval']=_0x2652a4[_0xd17b('0x25')]?_0x2652a4[_0xd17b('0x25')]:undefined;this[_0xd17b('0x26')]=_0x2652a4[_0xd17b('0x26')]?_0x2652a4['SquareProject']:undefined;this[_0xd17b('0x27')]=_0x2652a4[_0xd17b('0x26')]?_0x2652a4[_0xd17b('0x26')]['name']:undefined;this['dialAMDActive']=_0x2652a4[_0xd17b('0x28')]||![];this[_0xd17b('0x29')]=_0x2652a4[_0xd17b('0x29')];this[_0xd17b('0x2a')]=_0x2652a4[_0xd17b('0x2a')];this[_0xd17b('0x2b')]=_0x2652a4['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x2652a4[_0xd17b('0x2c')];this[_0xd17b('0x2d')]=_0x2652a4[_0xd17b('0x2d')];this['dialAMDBetweenWordsSilence']=_0x2652a4[_0xd17b('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x2652a4['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x2652a4[_0xd17b('0x2f')];this['dialAMDMaximumWordLength']=_0x2652a4[_0xd17b('0x30')];}module[_0xd17b('0x31')]=Campaign; \ No newline at end of file +var _0x3017=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x3017,0x1ba));var _0x7301=function(_0x5ebafc,_0x3fd116){_0x5ebafc=_0x5ebafc-0x0;var _0x227d5e=_0x3017[_0x5ebafc];return _0x227d5e;};'use strict';function Campaign(_0x539209){this['id']=_0x539209['id']||0x0;this['name']=_0x539209[_0x7301('0x0')]||'';this[_0x7301('0x1')]=_0x539209[_0x7301('0x1')]||_0x7301('0x2');this[_0x7301('0x3')]=0x0;this[_0x7301('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x7301('0x5')]=0x0;this[_0x7301('0x6')]='';this[_0x7301('0x7')]=!![];this[_0x7301('0x8')]=_0x539209[_0x7301('0x8')];this['limitCalls']=_0x539209[_0x7301('0x9')];this[_0x7301('0xa')]=_0x539209[_0x7301('0xa')]||null;this[_0x7301('0xb')]=_0x539209['dialGlobalInterval']?_0x539209['dialGlobalInterval']:null;this[_0x7301('0xc')]=_0x539209[_0x7301('0xc')];this['dialOriginateCallerIdNumber']=_0x539209[_0x7301('0xd')];this[_0x7301('0xe')]=_0x539209['dialOriginateTimeout']||0x1e;this[_0x7301('0xf')]=_0x539209['dialCongestionMaxRetry'];this[_0x7301('0x10')]=_0x539209[_0x7301('0x10')];this[_0x7301('0x11')]=_0x539209[_0x7301('0x11')];this[_0x7301('0x12')]=_0x539209[_0x7301('0x12')];this[_0x7301('0x13')]=_0x539209[_0x7301('0x13')];this[_0x7301('0x14')]=_0x539209['dialNoAnswerRetryFrequency'];this[_0x7301('0x15')]=_0x539209[_0x7301('0x15')];this['dialNoSuchNumberMaxRetry']=_0x539209[_0x7301('0x16')]||0x3;this[_0x7301('0x17')]=_0x539209[_0x7301('0x17')]||0x96;this[_0x7301('0x18')]=_0x539209[_0x7301('0x18')]||0x3;this[_0x7301('0x19')]=_0x539209[_0x7301('0x19')]||0x96;this[_0x7301('0x1a')]=_0x539209[_0x7301('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x539209['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x539209['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x539209[_0x7301('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x539209[_0x7301('0x1c')]||0x3;this[_0x7301('0x1d')]=_0x539209['dialAgentRejectRetryFrequency']||0x96;this[_0x7301('0x1e')]=_0x539209['dialOrderByScheduledAt']||_0x7301('0x1f');this[_0x7301('0x20')]=_0x539209[_0x7301('0x20')]||undefined;this[_0x7301('0x21')]=_0x539209[_0x7301('0x21')]||undefined;this['dialCutDigit']=_0x539209[_0x7301('0x22')]||undefined;this['TrunkBackup']=_0x539209[_0x7301('0x23')]?_0x539209[_0x7301('0x23')]:undefined;this['Trunk']=_0x539209[_0x7301('0x24')]?_0x539209['Trunk']:undefined;this['Interval']=_0x539209[_0x7301('0x25')]?_0x539209[_0x7301('0x25')]:undefined;this[_0x7301('0x26')]=_0x539209[_0x7301('0x26')]?_0x539209['SquareProject']:undefined;this[_0x7301('0x27')]=_0x539209[_0x7301('0x26')]?_0x539209['SquareProject'][_0x7301('0x0')]:undefined;this[_0x7301('0x28')]=_0x539209[_0x7301('0x28')]||![];this[_0x7301('0x29')]=_0x539209[_0x7301('0x29')];this[_0x7301('0x2a')]=_0x539209[_0x7301('0x2a')];this[_0x7301('0x2b')]=_0x539209[_0x7301('0x2b')];this[_0x7301('0x2c')]=_0x539209[_0x7301('0x2c')];this[_0x7301('0x2d')]=_0x539209[_0x7301('0x2d')];this['dialAMDBetweenWordsSilence']=_0x539209[_0x7301('0x2e')];this[_0x7301('0x2f')]=_0x539209[_0x7301('0x2f')];this[_0x7301('0x30')]=_0x539209[_0x7301('0x30')];this[_0x7301('0x31')]=_0x539209[_0x7301('0x31')];}module[_0x7301('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 63cc221..a7019cc 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 _0x8d62=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','billableseconds','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x8d62,0xf8));var _0x28d6=function(_0x52e58e,_0x269cbf){_0x52e58e=_0x52e58e-0x0;var _0x248e8f=_0x8d62[_0x52e58e];return _0x248e8f;};'use strict';function Channel(){this['starttime']=null;this[_0x28d6('0x0')]='';this[_0x28d6('0x1')]='';this[_0x28d6('0x2')]=0x0;this[_0x28d6('0x3')]='';this[_0x28d6('0x4')]=undefined;this[_0x28d6('0x5')]=undefined;this[_0x28d6('0x6')]=0x0;this[_0x28d6('0x7')]='';this[_0x28d6('0x8')]=0x0;this[_0x28d6('0x9')]=0x0;this[_0x28d6('0xa')]=0x0;this[_0x28d6('0xb')]=![];this[_0x28d6('0xc')]=null;this[_0x28d6('0xd')]=null;this['unmanaged']=![];this[_0x28d6('0xe')]=![];this[_0x28d6('0xf')]='';this[_0x28d6('0x10')]='';this['duration']=0x0;this[_0x28d6('0x11')]=0x0;this['holdtime']=0x0;this[_0x28d6('0x12')]=null;this[_0x28d6('0x13')]=null;this[_0x28d6('0x14')]=null;this[_0x28d6('0x15')]=![];this[_0x28d6('0x16')]=null;this['queue']=null;this[_0x28d6('0x17')]=[];this[_0x28d6('0x18')]=undefined;this[_0x28d6('0x19')]=undefined;this[_0x28d6('0x1a')]=0x0;}module[_0x28d6('0x1b')]=Channel; \ No newline at end of file +var _0x9f89=['linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x9f89,0x13d));var _0x99f8=function(_0x556e5c,_0x4194d1){_0x556e5c=_0x556e5c-0x0;var _0x3fdaac=_0x9f89[_0x556e5c];return _0x3fdaac;};'use strict';function Channel(){this['starttime']=null;this[_0x99f8('0x0')]='';this['destinationchannel']='';this[_0x99f8('0x1')]=0x0;this[_0x99f8('0x2')]='';this[_0x99f8('0x3')]=undefined;this[_0x99f8('0x4')]=undefined;this[_0x99f8('0x5')]=0x0;this['context']='';this[_0x99f8('0x6')]=0x0;this[_0x99f8('0x7')]=0x0;this[_0x99f8('0x8')]=0x0;this[_0x99f8('0x9')]=![];this[_0x99f8('0xa')]=null;this[_0x99f8('0xb')]=null;this[_0x99f8('0xc')]=![];this['abandoned']=![];this[_0x99f8('0xd')]='';this[_0x99f8('0xe')]='';this[_0x99f8('0xf')]=0x0;this[_0x99f8('0x10')]=0x0;this['holdtime']=0x0;this[_0x99f8('0x11')]=null;this[_0x99f8('0x12')]=null;this[_0x99f8('0x13')]=null;this[_0x99f8('0x14')]=![];this['monitorFilename']=null;this[_0x99f8('0x15')]=null;this[_0x99f8('0x16')]=[];this[_0x99f8('0x17')]=undefined;this[_0x99f8('0x18')]=undefined;this[_0x99f8('0x19')]=0x0;}module[_0x99f8('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d8b6324..dc01399 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 _0x41d9=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x22e4fd){this['id']=_0x22e4fd['id']||0x0;this[_0x941d('0x0')]=_0x22e4fd[_0x941d('0x0')]||'';this[_0x941d('0x1')]=_0x22e4fd[_0x941d('0x1')]||'';this[_0x941d('0x2')]=_0x22e4fd[_0x941d('0x2')]||'';this['authType']=_0x22e4fd[_0x941d('0x3')]||'';this[_0x941d('0x4')]=_0x22e4fd['password']||'';this[_0x941d('0x5')]=_0x22e4fd[_0x941d('0x5')]||'';this['consumerSecret']=_0x22e4fd[_0x941d('0x6')]||'';this['token']=_0x22e4fd[_0x941d('0x7')]||'';this[_0x941d('0x8')]=_0x22e4fd[_0x941d('0x8')]||'';this[_0x941d('0x9')]=_0x22e4fd[_0x941d('0x9')]||'';this['serverUrl']=_0x22e4fd[_0x941d('0xa')]||'';this[_0x941d('0xb')]=_0x22e4fd[_0x941d('0xb')]||{};}module[_0x941d('0xc')]=DeskAccount; \ No newline at end of file +var _0xc5c7=['tokenSecret','type','Configurations','name','username','remoteUri','authType','password','consumerKey','token'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x2443b5,_0x3be475){_0x2443b5=_0x2443b5-0x0;var _0x1acfc6=_0xc5c7[_0x2443b5];return _0x1acfc6;};'use strict';function DeskAccount(_0x191cba){this['id']=_0x191cba['id']||0x0;this[_0x7c5c('0x0')]=_0x191cba[_0x7c5c('0x0')]||'';this[_0x7c5c('0x1')]=_0x191cba[_0x7c5c('0x1')]||'';this[_0x7c5c('0x2')]=_0x191cba[_0x7c5c('0x2')]||'';this['authType']=_0x191cba[_0x7c5c('0x3')]||'';this[_0x7c5c('0x4')]=_0x191cba[_0x7c5c('0x4')]||'';this[_0x7c5c('0x5')]=_0x191cba[_0x7c5c('0x5')]||'';this['consumerSecret']=_0x191cba['consumerSecret']||'';this[_0x7c5c('0x6')]=_0x191cba['token']||'';this[_0x7c5c('0x7')]=_0x191cba['tokenSecret']||'';this[_0x7c5c('0x8')]=_0x191cba[_0x7c5c('0x8')]||'';this['serverUrl']=_0x191cba['serverUrl']||'';this[_0x7c5c('0x9')]=_0x191cba[_0x7c5c('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 40c8b89..5d3ac57 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 _0x7117=['tenantId','clientId','clientSecret','Configurations','exports','name','username','password','remoteUri'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x7117,0x12e));var _0x7711=function(_0x26caf1,_0x4667c9){_0x26caf1=_0x26caf1-0x0;var _0x2ab897=_0x7117[_0x26caf1];return _0x2ab897;};'use strict';function Dynamics365Account(_0x4dceed){this['id']=_0x4dceed['id']||0x0;this[_0x7711('0x0')]=_0x4dceed[_0x7711('0x0')]||'';this['username']=_0x4dceed[_0x7711('0x1')]||'';this['password']=_0x4dceed[_0x7711('0x2')]||'';this[_0x7711('0x3')]=_0x4dceed[_0x7711('0x3')]||'';this[_0x7711('0x4')]=_0x4dceed[_0x7711('0x4')]||'';this['clientId']=_0x4dceed[_0x7711('0x5')]||'';this[_0x7711('0x6')]=_0x4dceed['clientSecret']||{};this['serverUrl']=_0x4dceed['serverUrl']||'';this[_0x7711('0x7')]=_0x4dceed[_0x7711('0x7')]||{};}module[_0x7711('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x1fdc=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1fdc,0xf4));var _0xc1fd=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x1fdc[_0x8b8564];return _0x360c61;};'use strict';function Dynamics365Account(_0x1ed9a9){this['id']=_0x1ed9a9['id']||0x0;this[_0xc1fd('0x0')]=_0x1ed9a9['name']||'';this['username']=_0x1ed9a9[_0xc1fd('0x1')]||'';this[_0xc1fd('0x2')]=_0x1ed9a9[_0xc1fd('0x2')]||'';this[_0xc1fd('0x3')]=_0x1ed9a9[_0xc1fd('0x3')]||'';this[_0xc1fd('0x4')]=_0x1ed9a9[_0xc1fd('0x4')]||'';this[_0xc1fd('0x5')]=_0x1ed9a9[_0xc1fd('0x5')]||'';this['clientSecret']=_0x1ed9a9[_0xc1fd('0x6')]||{};this[_0xc1fd('0x7')]=_0x1ed9a9['serverUrl']||'';this[_0xc1fd('0x8')]=_0x1ed9a9[_0xc1fd('0x8')]||{};}module[_0xc1fd('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index dde2ba3..fc33f01 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 _0xb826=['t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x3d9e9f,_0x52ab42){var _0x4768f6=function(_0x4bbae8){while(--_0x4bbae8){_0x3d9e9f['push'](_0x3d9e9f['shift']());}};_0x4768f6(++_0x52ab42);}(_0xb826,0x149));var _0x6b82=function(_0x45281e,_0x1565cd){_0x45281e=_0x45281e-0x0;var _0xb4b8f1=_0xb826[_0x45281e];return _0xb4b8f1;};'use strict';function FaxAccount(_0x1f5277){this['id']=_0x1f5277['id']||0x0;this['name']=_0x1f5277[_0x6b82('0x0')]||'';this[_0x6b82('0x1')]=_0x1f5277[_0x6b82('0x1')];this['ecm']=_0x1f5277[_0x6b82('0x2')];this[_0x6b82('0x3')]=_0x1f5277[_0x6b82('0x3')];this[_0x6b82('0x4')]=_0x1f5277[_0x6b82('0x4')];this[_0x6b82('0x5')]=_0x1f5277[_0x6b82('0x5')]||0x960;this[_0x6b82('0x6')]=_0x1f5277[_0x6b82('0x6')]||0x3840;this[_0x6b82('0x7')]=_0x1f5277[_0x6b82('0x7')]||_0x6b82('0x8');this[_0x6b82('0x9')]=_0x1f5277[_0x6b82('0x9')]||'no';this['faxdetect']=_0x1f5277[_0x6b82('0xa')]||'no';this['t38timeout']=_0x1f5277[_0x6b82('0xb')]||0x1388;this[_0x6b82('0xc')]=_0x1f5277['tech']||'SIP';this[_0x6b82('0xd')]=_0x1f5277[_0x6b82('0xd')]?_0x1f5277['Trunk']:undefined;this['ListId']=_0x1f5277[_0x6b82('0xe')];this[_0x6b82('0xf')]=_0x1f5277[_0x6b82('0xf')];}module[_0x6b82('0x10')]=FaxAccount; \ No newline at end of file +var _0xcaf2=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0xf858e,_0x51b0f1){var _0x5344d8=function(_0x5219d6){while(--_0x5219d6){_0xf858e['push'](_0xf858e['shift']());}};_0x5344d8(++_0x51b0f1);}(_0xcaf2,0x8a));var _0x2caf=function(_0x40a107,_0x5acc82){_0x40a107=_0x40a107-0x0;var _0x4beb59=_0xcaf2[_0x40a107];return _0x4beb59;};'use strict';function FaxAccount(_0x3ee093){this['id']=_0x3ee093['id']||0x0;this['name']=_0x3ee093[_0x2caf('0x0')]||'';this[_0x2caf('0x1')]=_0x3ee093['description'];this[_0x2caf('0x2')]=_0x3ee093[_0x2caf('0x2')];this['headerinfo']=_0x3ee093[_0x2caf('0x3')];this['localstationid']=_0x3ee093[_0x2caf('0x4')];this[_0x2caf('0x5')]=_0x3ee093[_0x2caf('0x5')]||0x960;this['maxrate']=_0x3ee093[_0x2caf('0x6')]||0x3840;this[_0x2caf('0x7')]=_0x3ee093[_0x2caf('0x7')]||_0x2caf('0x8');this['gateway']=_0x3ee093[_0x2caf('0x9')]||'no';this[_0x2caf('0xa')]=_0x3ee093[_0x2caf('0xa')]||'no';this[_0x2caf('0xb')]=_0x3ee093[_0x2caf('0xb')]||0x1388;this[_0x2caf('0xc')]=_0x3ee093[_0x2caf('0xc')]||_0x2caf('0xd');this[_0x2caf('0xe')]=_0x3ee093['Trunk']?_0x3ee093[_0x2caf('0xe')]:undefined;this[_0x2caf('0xf')]=_0x3ee093[_0x2caf('0xf')];this[_0x2caf('0x10')]=_0x3ee093[_0x2caf('0x10')];}module[_0x2caf('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index eac6002..9ea1a5a 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 _0xe308=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x41841e,_0x4c7017){var _0x45b5dc=function(_0x2a3a73){while(--_0x2a3a73){_0x41841e['push'](_0x41841e['shift']());}};_0x45b5dc(++_0x4c7017);}(_0xe308,0x1f2));var _0x8e30=function(_0x4a7d54,_0x16702c){_0x4a7d54=_0x4a7d54-0x0;var _0x45d1fe=_0xe308[_0x4a7d54];return _0x45d1fe;};'use strict';function FreshdeskAccount(_0x467d90){this['id']=_0x467d90['id']||0x0;this[_0x8e30('0x0')]=_0x467d90[_0x8e30('0x0')]||'';this[_0x8e30('0x1')]=_0x467d90['username']||'';this[_0x8e30('0x2')]=_0x467d90[_0x8e30('0x3')]||'';this[_0x8e30('0x4')]=_0x467d90[_0x8e30('0x4')]||'';this[_0x8e30('0x5')]=_0x467d90[_0x8e30('0x5')]||'';this[_0x8e30('0x6')]=_0x467d90[_0x8e30('0x6')]||{};}module[_0x8e30('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x2e2c=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x2e2c,0xb0));var _0xc2e2=function(_0xf1603b,_0x257c11){_0xf1603b=_0xf1603b-0x0;var _0x298fab=_0x2e2c[_0xf1603b];return _0x298fab;};'use strict';function FreshdeskAccount(_0x4b9d0b){this['id']=_0x4b9d0b['id']||0x0;this['name']=_0x4b9d0b[_0xc2e2('0x0')]||'';this[_0xc2e2('0x1')]=_0x4b9d0b[_0xc2e2('0x1')]||'';this['apiKey']=_0x4b9d0b[_0xc2e2('0x2')]||'';this[_0xc2e2('0x3')]=_0x4b9d0b[_0xc2e2('0x3')]||'';this[_0xc2e2('0x4')]=_0x4b9d0b[_0xc2e2('0x4')]||'';this[_0xc2e2('0x5')]=_0x4b9d0b[_0xc2e2('0x5')]||{};}module[_0xc2e2('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4280ccb..7e8ff2f 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 _0x9c55=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c55,0x6e));var _0x59c5=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x9c55[_0x5a7e78];return _0xa8d4a1;};'use strict';function FreshsalesAccount(_0x2d3125){this['id']=_0x2d3125['id']||0x0;this[_0x59c5('0x0')]=_0x2d3125[_0x59c5('0x0')]||'';this[_0x59c5('0x1')]=_0x2d3125[_0x59c5('0x1')]||'';this[_0x59c5('0x2')]=_0x2d3125[_0x59c5('0x3')]||'';this[_0x59c5('0x4')]=_0x2d3125[_0x59c5('0x4')]||'';this[_0x59c5('0x5')]=_0x2d3125['serverUrl']||'';this[_0x59c5('0x6')]=_0x2d3125[_0x59c5('0x6')]||{};}module[_0x59c5('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2f30=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4e8f22,_0x2b6646){var _0x44afeb=function(_0x2dd80f){while(--_0x2dd80f){_0x4e8f22['push'](_0x4e8f22['shift']());}};_0x44afeb(++_0x2b6646);}(_0x2f30,0xe6));var _0x02f3=function(_0x586ca0,_0x85e206){_0x586ca0=_0x586ca0-0x0;var _0x19e129=_0x2f30[_0x586ca0];return _0x19e129;};'use strict';function FreshsalesAccount(_0x26d156){this['id']=_0x26d156['id']||0x0;this[_0x02f3('0x0')]=_0x26d156[_0x02f3('0x0')]||'';this[_0x02f3('0x1')]=_0x26d156['username']||'';this['apiKey']=_0x26d156[_0x02f3('0x2')]||'';this[_0x02f3('0x3')]=_0x26d156[_0x02f3('0x3')]||'';this[_0x02f3('0x4')]=_0x26d156[_0x02f3('0x4')]||'';this[_0x02f3('0x5')]=_0x26d156['Configurations']||{};}module[_0x02f3('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f8566d6..9d6db8b 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 _0x4490=['queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','priority','holdtime','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum','queue','queuecallerleaveAt','position'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x4490,0x112));var _0x0449=function(_0x2bb7c0,_0x114b3e){_0x2bb7c0=_0x2bb7c0-0x0;var _0x17dec6=_0x4490[_0x2bb7c0];return _0x17dec6;};'use strict';function QueueReport(){this['type']=_0x0449('0x0');this[_0x0449('0x1')]='';this[_0x0449('0x2')]='';this['calleridname']='';this[_0x0449('0x3')]='';this['queuecallerjoinAt']=null;this[_0x0449('0x4')]=null;this[_0x0449('0x5')]=0x1;this['count']=0x1;this[_0x0449('0x6')]=![];this['queuecallerabandonAt']=null;this[_0x0449('0x7')]=![];this[_0x0449('0x8')]=null;this['queuecallerexit']=![];this[_0x0449('0x9')]=null;this[_0x0449('0xa')]=0x1;this['channel']='';this[_0x0449('0xb')]='';this['connectedlinename']='';this[_0x0449('0xc')]='';this[_0x0449('0xd')]='';this['exten']='';this[_0x0449('0xe')]='';this[_0x0449('0xf')]=0x0;this['assigned']=![];this[_0x0449('0x10')]='';this[_0x0449('0x11')]=0x0;this[_0x0449('0x12')]={};}module[_0x0449('0x13')]=QueueReport; \ No newline at end of file +var _0x9f87=['assigned','mohtime','variables','type','inbound','calleridnum','queuecallerjoinAt','queuecallerleaveAt','count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten','priority'];(function(_0x522cd8,_0x44ffa1){var _0x1342af=function(_0x3c332f){while(--_0x3c332f){_0x522cd8['push'](_0x522cd8['shift']());}};_0x1342af(++_0x44ffa1);}(_0x9f87,0xae));var _0x79f8=function(_0x181b70,_0x88e45f){_0x181b70=_0x181b70-0x0;var _0x170400=_0x9f87[_0x181b70];return _0x170400;};'use strict';function QueueReport(){this[_0x79f8('0x0')]=_0x79f8('0x1');this['uniqueid']='';this[_0x79f8('0x2')]='';this['calleridname']='';this['queue']='';this[_0x79f8('0x3')]=null;this[_0x79f8('0x4')]=null;this['position']=0x1;this[_0x79f8('0x5')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x79f8('0x6')]=![];this[_0x79f8('0x7')]=null;this[_0x79f8('0x8')]=![];this[_0x79f8('0x9')]=null;this[_0x79f8('0xa')]=0x1;this[_0x79f8('0xb')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x79f8('0xc')]='';this[_0x79f8('0xd')]='';this[_0x79f8('0xe')]='';this[_0x79f8('0xf')]='';this['holdtime']=0x0;this[_0x79f8('0x10')]=![];this['lastAssignedTo']='';this[_0x79f8('0x11')]=0x0;this[_0x79f8('0x12')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 3103bd2..2da7666 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 _0xcd82=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x390fe6,_0x35d391){var _0x54eef1=function(_0x3f12eb){while(--_0x3f12eb){_0x390fe6['push'](_0x390fe6['shift']());}};_0x54eef1(++_0x35d391);}(_0xcd82,0x11d));var _0x2cd8=function(_0x4afab8,_0x2ffa2a){_0x4afab8=_0x4afab8-0x0;var _0x14a02d=_0xcd82[_0x4afab8];return _0x14a02d;};'use strict';function SalesforceAccount(_0x47a8d7){this['id']=_0x47a8d7['id']||0x0;this[_0x2cd8('0x0')]=_0x47a8d7[_0x2cd8('0x0')]||'';this[_0x2cd8('0x1')]=_0x47a8d7[_0x2cd8('0x1')]||'';this['remoteUri']=_0x47a8d7[_0x2cd8('0x2')]||'';this[_0x2cd8('0x3')]=_0x47a8d7[_0x2cd8('0x3')]||'';this[_0x2cd8('0x4')]=_0x47a8d7[_0x2cd8('0x4')]||'';this[_0x2cd8('0x5')]=_0x47a8d7[_0x2cd8('0x5')]||'';this[_0x2cd8('0x6')]=_0x47a8d7['securityToken']||'';this[_0x2cd8('0x7')]=_0x47a8d7['type']||_0x2cd8('0x8');this['serverUrl']=_0x47a8d7[_0x2cd8('0x9')]||'';this[_0x2cd8('0xa')]=_0x47a8d7['Configurations']||{};}module[_0x2cd8('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x6d88=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','name'];(function(_0x1f3127,_0xc73a0b){var _0x2cf9cd=function(_0x4ff434){while(--_0x4ff434){_0x1f3127['push'](_0x1f3127['shift']());}};_0x2cf9cd(++_0xc73a0b);}(_0x6d88,0x18f));var _0x86d8=function(_0x656650,_0x5412fb){_0x656650=_0x656650-0x0;var _0x4a9198=_0x6d88[_0x656650];return _0x4a9198;};'use strict';function SalesforceAccount(_0x106c3e){this['id']=_0x106c3e['id']||0x0;this[_0x86d8('0x0')]=_0x106c3e[_0x86d8('0x0')]||'';this[_0x86d8('0x1')]=_0x106c3e['username']||'';this[_0x86d8('0x2')]=_0x106c3e[_0x86d8('0x2')]||'';this[_0x86d8('0x3')]=_0x106c3e[_0x86d8('0x3')]||'';this[_0x86d8('0x4')]=_0x106c3e['clientId']||'';this[_0x86d8('0x5')]=_0x106c3e['clientSecret']||'';this[_0x86d8('0x6')]=_0x106c3e[_0x86d8('0x6')]||'';this[_0x86d8('0x7')]=_0x106c3e[_0x86d8('0x7')]||_0x86d8('0x8');this['serverUrl']=_0x106c3e[_0x86d8('0x9')]||'';this['Configurations']=_0x106c3e['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e0873a2..74722cb 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 _0xadbb=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x11bee9,_0x25da90){var _0x3b9e0d=function(_0x135747){while(--_0x135747){_0x11bee9['push'](_0x11bee9['shift']());}};_0x3b9e0d(++_0x25da90);}(_0xadbb,0xe2));var _0xbadb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xadbb[_0x1facfa];return _0x9ec701;};'use strict';function ServicenowAccount(_0x572b37){this['id']=_0x572b37['id']||0x0;this[_0xbadb('0x0')]=_0x572b37[_0xbadb('0x0')]||'';this[_0xbadb('0x1')]=_0x572b37[_0xbadb('0x1')]||'';this[_0xbadb('0x2')]=_0x572b37['password']||'';this[_0xbadb('0x3')]=_0x572b37[_0xbadb('0x3')]||'';this[_0xbadb('0x4')]=_0x572b37[_0xbadb('0x4')]||'';this[_0xbadb('0x5')]=_0x572b37[_0xbadb('0x5')]||{};}module[_0xbadb('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x4de1=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5b1c36,_0x5357a7){var _0x571aea=function(_0x4247fd){while(--_0x4247fd){_0x5b1c36['push'](_0x5b1c36['shift']());}};_0x571aea(++_0x5357a7);}(_0x4de1,0x16d));var _0x14de=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x4de1[_0x2932cf];return _0x1711dd;};'use strict';function ServicenowAccount(_0x2d449f){this['id']=_0x2d449f['id']||0x0;this[_0x14de('0x0')]=_0x2d449f['name']||'';this[_0x14de('0x1')]=_0x2d449f[_0x14de('0x1')]||'';this[_0x14de('0x2')]=_0x2d449f[_0x14de('0x2')]||'';this[_0x14de('0x3')]=_0x2d449f[_0x14de('0x3')]||'';this[_0x14de('0x4')]=_0x2d449f[_0x14de('0x4')]||'';this['Configurations']=_0x2d449f[_0x14de('0x5')]||{};}module[_0x14de('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8cd897a..51f218b 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 _0x2c20=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3b2d0c,_0x1e3636){var _0x31014b=function(_0x5d577){while(--_0x5d577){_0x3b2d0c['push'](_0x3b2d0c['shift']());}};_0x31014b(++_0x1e3636);}(_0x2c20,0x1a5));var _0x02c2=function(_0x1877fe,_0x29ade1){_0x1877fe=_0x1877fe-0x0;var _0x463539=_0x2c20[_0x1877fe];return _0x463539;};'use strict';function SugarcrmAccount(_0x6ae99a){this['id']=_0x6ae99a['id']||0x0;this[_0x02c2('0x0')]=_0x6ae99a[_0x02c2('0x0')]||'';this[_0x02c2('0x1')]=_0x6ae99a['username']||'';this[_0x02c2('0x2')]=_0x6ae99a[_0x02c2('0x2')]||'';this[_0x02c2('0x3')]=_0x6ae99a[_0x02c2('0x3')]||'';this[_0x02c2('0x4')]=_0x6ae99a['serverUrl']||'';this[_0x02c2('0x5')]=_0x6ae99a[_0x02c2('0x5')]||{};}module[_0x02c2('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1f49=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5b1fcc,_0x128850){var _0x31a903=function(_0x1233f6){while(--_0x1233f6){_0x5b1fcc['push'](_0x5b1fcc['shift']());}};_0x31a903(++_0x128850);}(_0x1f49,0x1ac));var _0x91f4=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x1f49[_0x3207aa];return _0x51758f;};'use strict';function SugarcrmAccount(_0x179f71){this['id']=_0x179f71['id']||0x0;this[_0x91f4('0x0')]=_0x179f71[_0x91f4('0x0')]||'';this[_0x91f4('0x1')]=_0x179f71[_0x91f4('0x1')]||'';this[_0x91f4('0x2')]=_0x179f71['password']||'';this[_0x91f4('0x3')]=_0x179f71[_0x91f4('0x3')]||'';this[_0x91f4('0x4')]=_0x179f71[_0x91f4('0x4')]||'';this['Configurations']=_0x179f71[_0x91f4('0x5')]||{};}module[_0x91f4('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 69410ff..2386de2 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 _0x514e=['stateTime','status','unknown','address','exports','name','accountcode','state'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x514e,0x17d));var _0xe514=function(_0x282169,_0x1c16fb){_0x282169=_0x282169-0x0;var _0x54d965=_0x514e[_0x282169];return _0x54d965;};'use strict';function Telephone(_0xabf88c){this['id']=_0xabf88c['id']||0x0;this[_0xe514('0x0')]=_0xabf88c[_0xe514('0x0')]||'';this['accountcode']=_0xabf88c[_0xe514('0x1')]||'';this[_0xe514('0x2')]='unknown';this[_0xe514('0x3')]=0x0;this[_0xe514('0x4')]=_0xe514('0x5');this[_0xe514('0x6')]='';}module[_0xe514('0x7')]=Telephone; \ No newline at end of file +var _0xa747=['exports','name','accountcode','state','stateTime','status','unknown','address'];(function(_0x196d22,_0xed536a){var _0x554a53=function(_0x1a4b1d){while(--_0x1a4b1d){_0x196d22['push'](_0x196d22['shift']());}};_0x554a53(++_0xed536a);}(_0xa747,0x99));var _0x7a74=function(_0x3a95d8,_0x335365){_0x3a95d8=_0x3a95d8-0x0;var _0x2cbdb7=_0xa747[_0x3a95d8];return _0x2cbdb7;};'use strict';function Telephone(_0x57b5c5){this['id']=_0x57b5c5['id']||0x0;this[_0x7a74('0x0')]=_0x57b5c5[_0x7a74('0x0')]||'';this[_0x7a74('0x1')]=_0x57b5c5['accountcode']||'';this[_0x7a74('0x2')]='unknown';this[_0x7a74('0x3')]=0x0;this[_0x7a74('0x4')]=_0x7a74('0x5');this[_0x7a74('0x6')]='';}module[_0x7a74('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 979a71d..10e7e14 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 _0xc75a=['name'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0xc75a,0xeb));var _0xac75=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xc75a[_0xaaf2e2];return _0x28bc36;};'use strict';function template(_0x193adf){this['id']=_0x193adf['id']||0x0;this[_0xac75('0x0')]=_0x193adf[_0xac75('0x0')]||'';this['html']=_0x193adf['html']||'';}module['exports']=template; \ No newline at end of file +var _0xe67e=['exports','name','html'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0xe67e,0x142));var _0xee67=function(_0xbe6f0,_0x18e5e2){_0xbe6f0=_0xbe6f0-0x0;var _0x5e2b92=_0xe67e[_0xbe6f0];return _0x5e2b92;};'use strict';function template(_0x3e3c49){this['id']=_0x3e3c49['id']||0x0;this[_0xee67('0x0')]=_0x3e3c49[_0xee67('0x0')]||'';this['html']=_0x3e3c49[_0xee67('0x1')]||'';}module[_0xee67('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 484fc22..89b8406 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 _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0x6aa7,0x178));var _0x76aa=function(_0x39790f,_0x4009ec){_0x39790f=_0x39790f-0x0;var _0x10c304=_0x6aa7[_0x39790f];return _0x10c304;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file +var _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x21ba9e,_0x36882b){var _0x1ff3b6=function(_0x38598a){while(--_0x38598a){_0x21ba9e['push'](_0x21ba9e['shift']());}};_0x1ff3b6(++_0x36882b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x12ae36,_0x226cd0){_0x12ae36=_0x12ae36-0x0;var _0x3312fd=_0x8ef6[_0x12ae36];return _0x3312fd;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e0e216b..b25c3a0 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 _0x5ec1=['registry','indexOf','port','domain','refresh','stateRegistry','unknown','registrationtime','active','name','state','stateTime','status'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5ec1,0xa4));var _0x15ec=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x5ec1[_0x4ee9cd];return _0x328a5b;};'use strict';function Trunk(_0xe238b6){this['id']=_0xe238b6['id']||0x0;this[_0x15ec('0x0')]=_0xe238b6[_0x15ec('0x0')]||![];this[_0x15ec('0x1')]=_0xe238b6[_0x15ec('0x1')]||'';this[_0x15ec('0x2')]='unknown';this[_0x15ec('0x3')]=0x0;this[_0x15ec('0x4')]='unknown';this[_0x15ec('0x5')]=_0xe238b6[_0x15ec('0x5')]&&_0xe238b6[_0x15ec('0x5')][_0x15ec('0x6')](':')?_0xe238b6[_0x15ec('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0x15ec('0x7')]='';this[_0x15ec('0x8')]='';this['domainport']='';this[_0x15ec('0x9')]='';this[_0x15ec('0xa')]=_0x15ec('0xb');this[_0x15ec('0xc')]='';this['address']='';}module['exports']=Trunk; \ No newline at end of file +var _0xc73a=['stateTime','registry','split','host','port','domain','domainport','refresh','registrationtime','exports','active','name','unknown'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc73a,0x1c4));var _0xac73=function(_0x3d7771,_0x1f2047){_0x3d7771=_0x3d7771-0x0;var _0x3cdbb9=_0xc73a[_0x3d7771];return _0x3cdbb9;};'use strict';function Trunk(_0x316990){this['id']=_0x316990['id']||0x0;this['active']=_0x316990[_0xac73('0x0')]||![];this[_0xac73('0x1')]=_0x316990[_0xac73('0x1')]||'';this['state']=_0xac73('0x2');this[_0xac73('0x3')]=0x0;this['status']='unknown';this[_0xac73('0x4')]=_0x316990[_0xac73('0x4')]&&_0x316990[_0xac73('0x4')]['indexOf'](':')?_0x316990[_0xac73('0x4')][_0xac73('0x5')](':')[0x0]:'';this[_0xac73('0x6')]='';this[_0xac73('0x7')]='';this[_0xac73('0x8')]='';this[_0xac73('0x9')]='';this[_0xac73('0xa')]='';this['stateRegistry']=_0xac73('0x2');this[_0xac73('0xb')]='';this['address']='';}module[_0xac73('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 891063c..2dd1323 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 _0x2570=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x10d045,_0x7bfe7b){var _0x25b93f=function(_0x6a8c74){while(--_0x6a8c74){_0x10d045['push'](_0x10d045['shift']());}};_0x25b93f(++_0x7bfe7b);}(_0x2570,0xfe));var _0x0257=function(_0xe59cff,_0x1a7dbe){_0xe59cff=_0xe59cff-0x0;var _0x26e8c1=_0x2570[_0xe59cff];return _0x26e8c1;};'use strict';function voiceExtension(_0x422319){this['id']=_0x422319['id']||0x0;this[_0x0257('0x0')]=_0x422319[_0x0257('0x0')]||'';this[_0x0257('0x1')]=_0x422319[_0x0257('0x1')]||_0x0257('0x2');this[_0x0257('0x3')]=_0x422319[_0x0257('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x1565=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1bb2d1,_0x21fa4b){var _0x38e89a=function(_0x138bcc){while(--_0x138bcc){_0x1bb2d1['push'](_0x1bb2d1['shift']());}};_0x38e89a(++_0x21fa4b);}(_0x1565,0x1bc));var _0x5156=function(_0x51a13c,_0x1e6e34){_0x51a13c=_0x51a13c-0x0;var _0x300f02=_0x1565[_0x51a13c];return _0x300f02;};'use strict';function voiceExtension(_0x6efa29){this['id']=_0x6efa29['id']||0x0;this[_0x5156('0x0')]=_0x6efa29['exten']||'';this[_0x5156('0x1')]=_0x6efa29[_0x5156('0x1')]||_0x5156('0x2');this[_0x5156('0x3')]=_0x6efa29[_0x5156('0x3')]||![];}module[_0x5156('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 19470eb..ec3bc97 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 _0x5649=['roundrobin','name','monitor_format','type','inbound','talking','answered','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory'];(function(_0x105638,_0x483da6){var _0x55bc7f=function(_0x4e51c4){while(--_0x4e51c4){_0x105638['push'](_0x105638['shift']());}};_0x55bc7f(++_0x483da6);}(_0x5649,0x15b));var _0x9564=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x5649[_0x516927];return _0x30749b;};'use strict';var statusDesc=[_0x9564('0x0'),'not_inuse',_0x9564('0x1'),'busy',_0x9564('0x2'),'unavailable',_0x9564('0x3'),_0x9564('0x4'),_0x9564('0x5')];var monitorFormat={'wav':_0x9564('0x6'),'wav49':_0x9564('0x7'),'gsm':_0x9564('0x8')};var strategy={'rrmemory':_0x9564('0x9'),'roundrobin':_0x9564('0xa')};function VoiceQueue(_0x221bff){this['id']=_0x221bff['id']||0x0;this['name']=_0x221bff[_0x9564('0xb')]||'';this[_0x9564('0xc')]=_0x221bff['monitor_format']||'';this[_0x9564('0xd')]=_0x221bff[_0x9564('0xd')]||_0x9564('0xe');this['waiting']=0x0;this[_0x9564('0xf')]=0x0;this['total']=0x0;this[_0x9564('0x10')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x9564('0x11')]=0x0;this[_0x9564('0x12')]=0x0;this['abandoned']=0x0;this[_0x9564('0x13')]=0x0;this[_0x9564('0x14')]=0x0;this['acw']=_0x221bff[_0x9564('0x15')]||![];this[_0x9564('0x16')]=_0x221bff[_0x9564('0x16')]||0xa;this['autopause']=_0x221bff[_0x9564('0x17')]||'no';this[_0x9564('0x18')]=!![];this['message']='';this[_0x9564('0x19')]=0x0;this[_0x9564('0x1a')]=0x0;this[_0x9564('0x1b')]=_0x221bff['dialTimezone']||null;this[_0x9564('0x1c')]=_0x221bff[_0x9564('0x1c')]?_0x221bff['dialGlobalInterval']:null;this[_0x9564('0x1d')]=_0x221bff['dialActive'];this['dialMethod']=_0x221bff[_0x9564('0x1e')]||_0x9564('0x1f');this[_0x9564('0x20')]=_0x221bff[_0x9564('0x20')]||0x0;this['dialLimitQueue']=_0x221bff[_0x9564('0x21')]||0x0;this[_0x9564('0x22')]=_0x221bff[_0x9564('0x22')]||0x1;this[_0x9564('0x23')]=_0x221bff['dialPredictiveOptimization']||_0x9564('0x24');this[_0x9564('0x25')]=_0x221bff[_0x9564('0x25')]||0.03;this['dialPredictiveInterval']=_0x221bff[_0x9564('0x26')]||0x258;this[_0x9564('0x27')]=_0x221bff[_0x9564('0x27')]||_0x9564('0x28');this[_0x9564('0x29')]=_0x221bff[_0x9564('0x29')]||_0x9564('0x28');this[_0x9564('0x2a')]=_0x221bff[_0x9564('0x2a')]||0x1e;this['dialQueueOptions']=_0x221bff[_0x9564('0x2b')]||_0x9564('0x2c');this['dialQueueTimeout']=_0x221bff[_0x9564('0x2d')]||0x3;this[_0x9564('0x2e')]=_0x221bff[_0x9564('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x221bff['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x221bff[_0x9564('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x221bff[_0x9564('0x30')]||0x3;this[_0x9564('0x31')]=_0x221bff[_0x9564('0x31')]||0x96;this[_0x9564('0x32')]=_0x221bff[_0x9564('0x32')]||0x3;this[_0x9564('0x33')]=_0x221bff[_0x9564('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x221bff['dialNoSuchNumberMaxRetry']||0x3;this[_0x9564('0x34')]=_0x221bff[_0x9564('0x34')]||0x96;this['dialDropMaxRetry']=_0x221bff['dialDropMaxRetry']||0x3;this[_0x9564('0x35')]=_0x221bff['dialDropRetryFrequency']||0x96;this[_0x9564('0x36')]=_0x221bff[_0x9564('0x36')]||0x3;this[_0x9564('0x37')]=_0x221bff[_0x9564('0x37')]||0x96;this[_0x9564('0x38')]=_0x221bff[_0x9564('0x38')]||0x3;this['dialMachineRetryFrequency']=_0x221bff['dialMachineRetryFrequency']||0x96;this[_0x9564('0x39')]=_0x221bff[_0x9564('0x39')]||0x3;this[_0x9564('0x3a')]=_0x221bff[_0x9564('0x3a')]||0x96;this[_0x9564('0x3b')]=_0x221bff[_0x9564('0x3b')]||0x4;this[_0x9564('0x3c')]=_0x221bff['Trunk']?_0x221bff[_0x9564('0x3c')]:undefined;this[_0x9564('0x3d')]=_0x221bff[_0x9564('0x3d')]?_0x221bff[_0x9564('0x3d')]:undefined;this['dialPrefix']=_0x221bff[_0x9564('0x3e')]||undefined;this[_0x9564('0x3f')]=_0x221bff[_0x9564('0x3f')]?_0x221bff[_0x9564('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x221bff[_0x9564('0x40')]||_0x9564('0x41');this['dialRandomLastDigitCallerIdNumber']=_0x221bff[_0x9564('0x42')]||undefined;this[_0x9564('0x43')]=_0x221bff['dialCutDigit']||undefined;this[_0x9564('0x44')]=strategy[_0x221bff[_0x9564('0x44')]]||_0x9564('0x9');this[_0x9564('0x45')]=!![];this[_0x9564('0x46')]=_0x221bff['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x221bff[_0x9564('0x47')];this[_0x9564('0x48')]=_0x221bff[_0x9564('0x48')];this[_0x9564('0x49')]=_0x221bff['dialAMDAfterGreetingSilence'];this[_0x9564('0x4a')]=_0x221bff[_0x9564('0x4a')];this[_0x9564('0x4b')]=_0x221bff['dialAMDMinWordLength'];this[_0x9564('0x4c')]=_0x221bff[_0x9564('0x4c')];this[_0x9564('0x4d')]=_0x221bff[_0x9564('0x4d')];this['dialAMDSilenceThreshold']=_0x221bff[_0x9564('0x4e')];this['dialAMDMaximumWordLength']=_0x221bff[_0x9564('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0x9564('0x50')]=0x0;this[_0x9564('0x51')]=_0x221bff[_0x9564('0x51')];this[_0x9564('0x52')]=0x0;this[_0x9564('0x53')]=0x0;this[_0x9564('0x54')]=0x0;this[_0x9564('0x55')]=0x0;this[_0x9564('0x56')]=0x0;this[_0x9564('0x57')]=0x0;this[_0x9564('0x58')]=0x0;this[_0x9564('0x59')]=0x0;this[_0x9564('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x9564('0x5b')]=0x0;this[_0x9564('0x5c')]=0x0;this[_0x9564('0x5d')]=0x0;this[_0x9564('0x5e')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x9564('0x5f')]=1.05;this[_0x9564('0x60')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x9564('0x61')]=0x0;this[_0x9564('0x62')]=0x0;this[_0x9564('0x63')]=0x0;this[_0x9564('0x64')]=0x0;this[_0x9564('0x65')]=0x0;this[_0x9564('0x66')]=_0x221bff['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x9564('0x67')]=_0x221bff[_0x9564('0x68')]||0xa;this[_0x9564('0x69')]=0x0;this[_0x9564('0x6a')]=0x0;this[_0x9564('0x6b')]=0x1;this[_0x9564('0x6c')]=0x0;this[_0x9564('0x6d')]=0x0;this[_0x9564('0x6e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x9564('0x6f')]=_0x221bff[_0x9564('0x6f')]||0x1e;this[_0x9564('0x70')]=_0x221bff['dialRecallInQueue']||![];this[_0x9564('0x71')]=_0x221bff['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x221bff[_0x9564('0x72')]||![];this[_0x9564('0x73')]=_0x221bff[_0x9564('0x73')]||![];this[_0x9564('0xc')]=monitorFormat[_0x221bff[_0x9564('0xc')]]?monitorFormat[_0x221bff['monitor_format']]:undefined;this[_0x9564('0x74')]=_0x221bff['mandatoryDisposition']||![];this[_0x9564('0x75')]=_0x221bff[_0x9564('0x75')]?_0x221bff[_0x9564('0x75')]:undefined;}module[_0x9564('0x76')]=VoiceQueue; \ No newline at end of file +var _0x25f2=['dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav49','gsm','roundrobin','name','monitor_format','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber'];(function(_0x11bc68,_0x4f4b90){var _0x499c81=function(_0x1727b3){while(--_0x1727b3){_0x11bc68['push'](_0x11bc68['shift']());}};_0x499c81(++_0x4f4b90);}(_0x25f2,0x1a0));var _0x225f=function(_0x1d0713,_0x1e69e8){_0x1d0713=_0x1d0713-0x0;var _0x201805=_0x25f2[_0x1d0713];return _0x201805;};'use strict';var statusDesc=[_0x225f('0x0'),_0x225f('0x1'),_0x225f('0x2'),_0x225f('0x3'),'invalid',_0x225f('0x4'),_0x225f('0x5'),_0x225f('0x6'),_0x225f('0x7')];var monitorFormat={'wav':'wav','wav49':_0x225f('0x8'),'gsm':_0x225f('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x225f('0xa')};function VoiceQueue(_0x44c0d2){this['id']=_0x44c0d2['id']||0x0;this[_0x225f('0xb')]=_0x44c0d2[_0x225f('0xb')]||'';this[_0x225f('0xc')]=_0x44c0d2[_0x225f('0xc')]||'';this['type']=_0x44c0d2['type']||'inbound';this['waiting']=0x0;this['talking']=0x0;this[_0x225f('0xd')]=0x0;this[_0x225f('0xe')]=0x0;this[_0x225f('0xf')]=0x0;this[_0x225f('0x10')]=0x0;this[_0x225f('0x11')]=0x0;this['unmanaged']=0x0;this[_0x225f('0x12')]=0x0;this[_0x225f('0x13')]=0x0;this[_0x225f('0x14')]=0x0;this[_0x225f('0x15')]=_0x44c0d2[_0x225f('0x15')]||![];this[_0x225f('0x16')]=_0x44c0d2['acwTimeout']||0xa;this[_0x225f('0x17')]=_0x44c0d2[_0x225f('0x17')]||'no';this[_0x225f('0x18')]=!![];this[_0x225f('0x19')]='';this[_0x225f('0x1a')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x44c0d2['dialTimezone']||null;this['dialGlobalInterval']=_0x44c0d2['dialGlobalInterval']?_0x44c0d2[_0x225f('0x1b')]:null;this[_0x225f('0x1c')]=_0x44c0d2[_0x225f('0x1c')];this['dialMethod']=_0x44c0d2[_0x225f('0x1d')]||_0x225f('0x1e');this[_0x225f('0x1f')]=_0x44c0d2[_0x225f('0x1f')]||0x0;this[_0x225f('0x20')]=_0x44c0d2[_0x225f('0x20')]||0x0;this[_0x225f('0x21')]=_0x44c0d2['dialPowerLevel']||0x1;this[_0x225f('0x22')]=_0x44c0d2[_0x225f('0x22')]||_0x225f('0x23');this[_0x225f('0x24')]=_0x44c0d2[_0x225f('0x24')]||0.03;this[_0x225f('0x25')]=_0x44c0d2[_0x225f('0x25')]||0x258;this[_0x225f('0x26')]=_0x44c0d2['dialOriginateCallerIdName']||_0x225f('0x27');this[_0x225f('0x28')]=_0x44c0d2[_0x225f('0x28')]||_0x225f('0x27');this['dialOriginateTimeout']=_0x44c0d2['dialOriginateTimeout']||0x1e;this[_0x225f('0x29')]=_0x44c0d2[_0x225f('0x29')]||_0x225f('0x2a');this['dialQueueTimeout']=_0x44c0d2[_0x225f('0x2b')]||0x3;this[_0x225f('0x2c')]=_0x44c0d2[_0x225f('0x2c')]||undefined;this[_0x225f('0x2d')]=_0x44c0d2[_0x225f('0x2d')]||0x3;this[_0x225f('0x2e')]=_0x44c0d2['dialCongestionRetryFrequency']||0x96;this[_0x225f('0x2f')]=_0x44c0d2[_0x225f('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x44c0d2[_0x225f('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x44c0d2[_0x225f('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x44c0d2['dialNoAnswerRetryFrequency']||0x96;this[_0x225f('0x32')]=_0x44c0d2[_0x225f('0x32')]||0x3;this[_0x225f('0x33')]=_0x44c0d2[_0x225f('0x33')]||0x96;this[_0x225f('0x34')]=_0x44c0d2['dialDropMaxRetry']||0x3;this[_0x225f('0x35')]=_0x44c0d2['dialDropRetryFrequency']||0x96;this[_0x225f('0x36')]=_0x44c0d2['dialAbandonedMaxRetry']||0x3;this[_0x225f('0x37')]=_0x44c0d2['dialAbandonedRetryFrequency']||0x96;this[_0x225f('0x38')]=_0x44c0d2['dialMachineMaxRetry']||0x3;this[_0x225f('0x39')]=_0x44c0d2[_0x225f('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x44c0d2[_0x225f('0x3a')]||0x3;this[_0x225f('0x3b')]=_0x44c0d2[_0x225f('0x3b')]||0x96;this[_0x225f('0x3c')]=_0x44c0d2[_0x225f('0x3c')]||0x4;this['Trunk']=_0x44c0d2[_0x225f('0x3d')]?_0x44c0d2[_0x225f('0x3d')]:undefined;this['TrunkBackup']=_0x44c0d2[_0x225f('0x3e')]?_0x44c0d2[_0x225f('0x3e')]:undefined;this[_0x225f('0x3f')]=_0x44c0d2[_0x225f('0x3f')]||undefined;this[_0x225f('0x40')]=_0x44c0d2[_0x225f('0x40')]?_0x44c0d2[_0x225f('0x40')]:undefined;this[_0x225f('0x41')]=_0x44c0d2[_0x225f('0x41')]||_0x225f('0x42');this[_0x225f('0x43')]=_0x44c0d2['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x225f('0x44')]=_0x44c0d2[_0x225f('0x44')]||undefined;this[_0x225f('0x45')]=strategy[_0x44c0d2[_0x225f('0x45')]]||_0x225f('0x46');this[_0x225f('0x47')]=!![];this[_0x225f('0x48')]=_0x44c0d2[_0x225f('0x48')]||![];this[_0x225f('0x49')]=_0x44c0d2[_0x225f('0x49')];this[_0x225f('0x4a')]=_0x44c0d2[_0x225f('0x4a')];this[_0x225f('0x4b')]=_0x44c0d2[_0x225f('0x4b')];this[_0x225f('0x4c')]=_0x44c0d2['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x44c0d2['dialAMDMinWordLength'];this[_0x225f('0x4d')]=_0x44c0d2[_0x225f('0x4d')];this[_0x225f('0x4e')]=_0x44c0d2[_0x225f('0x4e')];this[_0x225f('0x4f')]=_0x44c0d2[_0x225f('0x4f')];this['dialAMDMaximumWordLength']=_0x44c0d2[_0x225f('0x50')];this[_0x225f('0x51')]=0x0;this[_0x225f('0x52')]=0x0;this[_0x225f('0x53')]=_0x44c0d2[_0x225f('0x53')];this[_0x225f('0x54')]=0x0;this[_0x225f('0x55')]=0x0;this[_0x225f('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x225f('0x57')]=0x0;this[_0x225f('0x58')]=0x0;this[_0x225f('0x59')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x225f('0x5a')]=0x0;this[_0x225f('0x5b')]=0x0;this[_0x225f('0x5c')]=0x0;this[_0x225f('0x5d')]=0x0;this[_0x225f('0x5e')]=0x0;this[_0x225f('0x5f')]=0x0;this[_0x225f('0x60')]=undefined;this[_0x225f('0x61')]=undefined;this[_0x225f('0x62')]=undefined;this[_0x225f('0x63')]=1.05;this[_0x225f('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x225f('0x65')]=0x0;this[_0x225f('0x66')]=0x0;this[_0x225f('0x67')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x225f('0x68')]=0x0;this[_0x225f('0x69')]=0x0;this[_0x225f('0x6a')]=_0x44c0d2[_0x225f('0x6b')]||0x14;this[_0x225f('0x6c')]=_0x44c0d2['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x225f('0x6d')]=0x0;this[_0x225f('0x6e')]=0x1;this[_0x225f('0x6f')]=0x0;this[_0x225f('0x70')]=0x0;this[_0x225f('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0x225f('0x72')]=_0x44c0d2['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x44c0d2[_0x225f('0x73')]||![];this['dialQueueProject2']=_0x44c0d2[_0x225f('0x74')]||undefined;this[_0x225f('0x75')]=_0x44c0d2[_0x225f('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x44c0d2[_0x225f('0x76')]||![];this[_0x225f('0xc')]=monitorFormat[_0x44c0d2[_0x225f('0xc')]]?monitorFormat[_0x44c0d2[_0x225f('0xc')]]:undefined;this['mandatoryDisposition']=_0x44c0d2['mandatoryDisposition']||![];this[_0x225f('0x77')]=_0x44c0d2[_0x225f('0x77')]?_0x44c0d2[_0x225f('0x77')]:undefined;}module[_0x225f('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index baec81d..5d65040 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 _0x838f=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x3537a4,_0x34b417){var _0x1b0cb3=function(_0x4ce672){while(--_0x4ce672){_0x3537a4['push'](_0x3537a4['shift']());}};_0x1b0cb3(++_0x34b417);}(_0x838f,0xce));var _0xf838=function(_0x3bdd16,_0x563dc6){_0x3bdd16=_0x3bdd16-0x0;var _0x1e9db3=_0x838f[_0x3bdd16];return _0x1e9db3;};'use strict';function VtigerAccount(_0xffbb23){this['id']=_0xffbb23['id']||0x0;this[_0xf838('0x0')]=_0xffbb23[_0xf838('0x0')]||'';this[_0xf838('0x1')]=_0xffbb23[_0xf838('0x1')]||'';this[_0xf838('0x2')]=_0xffbb23['accessKey']||'';this['remoteUri']=_0xffbb23[_0xf838('0x3')]||'';this[_0xf838('0x4')]=_0xffbb23[_0xf838('0x4')]||'';this[_0xf838('0x5')]=_0xffbb23[_0xf838('0x5')]||{};}module[_0xf838('0x6')]=VtigerAccount; \ No newline at end of file +var _0xfaa8=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x58a4af,_0x4eac03){var _0x4c4539=function(_0x4e2c0b){while(--_0x4e2c0b){_0x58a4af['push'](_0x58a4af['shift']());}};_0x4c4539(++_0x4eac03);}(_0xfaa8,0xec));var _0x8faa=function(_0x466157,_0x5769b5){_0x466157=_0x466157-0x0;var _0xd6688=_0xfaa8[_0x466157];return _0xd6688;};'use strict';function VtigerAccount(_0x5408cb){this['id']=_0x5408cb['id']||0x0;this['name']=_0x5408cb[_0x8faa('0x0')]||'';this[_0x8faa('0x1')]=_0x5408cb['username']||'';this[_0x8faa('0x2')]=_0x5408cb[_0x8faa('0x2')]||'';this[_0x8faa('0x3')]=_0x5408cb['remoteUri']||'';this[_0x8faa('0x4')]=_0x5408cb[_0x8faa('0x4')]||'';this[_0x8faa('0x5')]=_0x5408cb[_0x8faa('0x5')]||{};}module[_0x8faa('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a4ee3a9..d921500 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x520bd8,_0x41d26){_0x520bd8=_0x520bd8-0x0;var _0xcd00bf=_0x7a54[_0x520bd8];return _0xcd00bf;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x48f6d6,_0x518af9){var _0x3dca9c=function(_0x1d4983){while(--_0x1d4983){_0x48f6d6['push'](_0x48f6d6['shift']());}};_0x3dca9c(++_0x518af9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a446d,_0x590154){_0x3a446d=_0x3a446d-0x0;var _0x149eb8=_0x5f2f[_0x3a446d];return _0x149eb8;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d582ae4..ecf418e 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 _0x9805=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x4e961c,_0x3a88c5){var _0xe1b347=function(_0x325b8b){while(--_0x325b8b){_0x4e961c['push'](_0x4e961c['shift']());}};_0xe1b347(++_0x3a88c5);}(_0x9805,0x18f));var _0x5980=function(_0x510ef9,_0x58f37b){_0x510ef9=_0x510ef9-0x0;var _0x3c6558=_0x9805[_0x510ef9];return _0x3c6558;};'use strict';function ZohoAccount(_0x22e2bb){this['id']=_0x22e2bb['id']||0x0;this[_0x5980('0x0')]=_0x22e2bb[_0x5980('0x0')]||'';this[_0x5980('0x1')]=_0x22e2bb['description']||'';this['host']=_0x22e2bb[_0x5980('0x2')]||'';this[_0x5980('0x3')]=_0x22e2bb[_0x5980('0x3')]||'';this[_0x5980('0x4')]=_0x22e2bb['clientId']||'';this['clientSecret']=_0x22e2bb[_0x5980('0x5')]||'';this[_0x5980('0x6')]=_0x22e2bb[_0x5980('0x6')]||'';this[_0x5980('0x7')]=_0x22e2bb[_0x5980('0x7')]||'';this[_0x5980('0x8')]=_0x22e2bb[_0x5980('0x8')]||'';this[_0x5980('0x9')]=_0x22e2bb[_0x5980('0x9')]||{};}module[_0x5980('0xa')]=ZohoAccount; \ No newline at end of file +var _0x0f42=['zone','clientId','clientSecret','serverUrl','code','Configurations','name','description','host'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x0f42,0x126));var _0x20f4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0f42[_0x13d07a];return _0x5ee0ee;};'use strict';function ZohoAccount(_0x2b9c18){this['id']=_0x2b9c18['id']||0x0;this[_0x20f4('0x0')]=_0x2b9c18[_0x20f4('0x0')]||'';this[_0x20f4('0x1')]=_0x2b9c18['description']||'';this[_0x20f4('0x2')]=_0x2b9c18['host']||'';this[_0x20f4('0x3')]=_0x2b9c18['zone']||'';this[_0x20f4('0x4')]=_0x2b9c18[_0x20f4('0x4')]||'';this[_0x20f4('0x5')]=_0x2b9c18['clientSecret']||'';this[_0x20f4('0x6')]=_0x2b9c18[_0x20f4('0x6')]||'';this['code']=_0x2b9c18[_0x20f4('0x7')]||'';this['refreshToken']=_0x2b9c18['refreshToken']||'';this['Configurations']=_0x2b9c18[_0x20f4('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1805e74..33a330b 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 _0x7069=['format','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent'];(function(_0x35baec,_0x3e17b7){var _0x8779e9=function(_0x56b6a8){while(--_0x56b6a8){_0x35baec['push'](_0x35baec['shift']());}};_0x8779e9(++_0x3e17b7);}(_0x7069,0x1cd));var _0x9706=function(_0x14d69c,_0x4c072d){_0x14d69c=_0x14d69c-0x0;var _0x5c0ee0=_0x7069[_0x14d69c];return _0x5c0ee0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9706('0x0'));function checkNameSurname(_0x4140ac,_0x2239b5,_0xab301f){var _0x39ed70='';if(!_[_0x9706('0x1')](_0x2239b5)&&_0x9706('0x2')===typeof _0x2239b5){_0x39ed70+=_0x2239b5;}if(!_['isNil'](_0xab301f)&&'string'===typeof _0xab301f){_0x39ed70+='\x20'+_0xab301f;}if(_0x39ed70!==''){return _0x39ed70;}return _0x4140ac;}function Action(_0x44122a,_0x46d910,_0x123f29,_0x4ae453,_0x1f852c){this[_0x9706('0x3')]=_0x123f29||undefined;this['idContact']=_0x44122a['id'];this[_0x9706('0x4')]=_0x46d910[_0x9706('0x5')];this['type']=_0x46d910[_0x9706('0x6')];this[_0x9706('0x7')]=_0x9706('0x4');this[_0x9706('0x8')]=![];this[_0x9706('0x9')]=_[_0x9706('0x1')](_0x44122a['Agent'])?undefined:_0x44122a[_0x9706('0xa')]['name'];this[_0x9706('0xb')]=this[_0x9706('0x9')]?util[_0x9706('0xc')]('SIP/%s',this[_0x9706('0x9')]):_0x4ae453||undefined;this[_0x9706('0xd')]=checkNameSurname(_0x44122a['Contact'][_0x9706('0xe')],_0x44122a[_0x9706('0xf')][_0x9706('0x10')],_0x44122a['Contact'][_0x9706('0x11')]);this[_0x9706('0x12')]=_0x44122a[_0x9706('0x12')]||![];this[_0x9706('0x13')]=_0x44122a[_0x9706('0xf')][_0x9706('0xe')];this[_0x9706('0x14')]=_0x44122a[_0x9706('0x14')];this[_0x9706('0x15')]=_0x44122a[_0x9706('0x15')]||0x0;this[_0x9706('0x16')]=_0x44122a[_0x9706('0x16')]||0x0;this[_0x9706('0x17')]=_0x44122a['countnoanswerretry']||0x0;this[_0x9706('0x18')]=(_0x44122a[_0x9706('0x15')]||0x0)+(_0x44122a[_0x9706('0x16')]||0x0)+(_0x44122a[_0x9706('0x17')]||0x0)+(_0x44122a[_0x9706('0x19')]||0x0)+(_0x44122a['countdropretry']||0x0)+(_0x44122a[_0x9706('0x1a')]||0x0)+(_0x44122a[_0x9706('0x1b')]||0x0)+(_0x44122a[_0x9706('0x1c')]||0x0);this[_0x9706('0x19')]=_0x44122a[_0x9706('0x19')]||0x0;this[_0x9706('0x1d')]=_0x44122a[_0x9706('0x1d')]||0x0;this['countabandonedretry']=_0x44122a[_0x9706('0x1a')]||0x0;this['countmachineretry']=_0x44122a[_0x9706('0x1b')]||0x0;this[_0x9706('0x1c')]=_0x44122a['countagentrejectretry']||0x0;this['callback']=_0x44122a['callback'];this['callbackuniqueid']=_0x44122a[_0x9706('0x1e')];this['callbackat']=_0x44122a[_0x9706('0x1f')];this['recallme']=_0x44122a[_0x9706('0x20')];this[_0x9706('0x21')]=_0x44122a['ContactId'];this['ListId']=_0x44122a[_0x9706('0x22')];this[_0x9706('0x23')]=_[_0x9706('0x1')](_0x44122a['Agent'])?_0x44122a['UserId']:_0x44122a[_0x9706('0xa')]['id'];this[_0x9706('0x24')]=_0x44122a['VoiceQueueId'];this[_0x9706('0x25')]='';this[_0x9706('0x26')]='';}Action[_0x9706('0x27')][_0x9706('0x28')]=function(){return util[_0x9706('0xc')]('\x22%s\x22\x20<%s>',this[_0x9706('0xd')],this[_0x9706('0x29')]);};module[_0x9706('0x2a')]=Action; \ No newline at end of file +var _0x110d=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','exports','lodash','isNil','string','uniqueid','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry'];(function(_0x87d357,_0xf5fe0b){var _0x479c89=function(_0xcc6200){while(--_0xcc6200){_0x87d357['push'](_0x87d357['shift']());}};_0x479c89(++_0xf5fe0b);}(_0x110d,0x12b));var _0xd110=function(_0x1abbb8,_0x3638d7){_0x1abbb8=_0x1abbb8-0x0;var _0x388130=_0x110d[_0x1abbb8];return _0x388130;};'use strict';var util=require('util');var _=require(_0xd110('0x0'));var moment=require('moment');function checkNameSurname(_0xe9c4cf,_0x2682b7,_0x817a5d){var _0x53be79='';if(!_[_0xd110('0x1')](_0x2682b7)&&_0xd110('0x2')===typeof _0x2682b7){_0x53be79+=_0x2682b7;}if(!_[_0xd110('0x1')](_0x817a5d)&&_0xd110('0x2')===typeof _0x817a5d){_0x53be79+='\x20'+_0x817a5d;}if(_0x53be79!==''){return _0x53be79;}return _0xe9c4cf;}function Action(_0xdc8d38,_0xee93c1,_0x29abd9,_0x68effc,_0x1a3f29){this[_0xd110('0x3')]=_0x29abd9||undefined;this['idContact']=_0xdc8d38['id'];this[_0xd110('0x4')]=_0xee93c1[_0xd110('0x5')];this[_0xd110('0x6')]=_0xee93c1[_0xd110('0x6')];this[_0xd110('0x7')]=_0xd110('0x4');this['dialAnswer']=![];this[_0xd110('0x8')]=_[_0xd110('0x1')](_0xdc8d38[_0xd110('0x9')])?undefined:_0xdc8d38['Agent'][_0xd110('0x5')];this['channelAgent']=this[_0xd110('0x8')]?util[_0xd110('0xa')](_0xd110('0xb'),this[_0xd110('0x8')]):_0x68effc||undefined;this[_0xd110('0xc')]=checkNameSurname(_0xdc8d38[_0xd110('0xd')][_0xd110('0xe')],_0xdc8d38[_0xd110('0xd')][_0xd110('0xf')],_0xdc8d38[_0xd110('0xd')][_0xd110('0x10')]);this[_0xd110('0x11')]=_0xdc8d38[_0xd110('0x11')]||![];this['calleridnum']=_0xdc8d38['Contact']['phone'];this[_0xd110('0x12')]=_0xdc8d38['scheduledat'];this[_0xd110('0x13')]=_0xdc8d38['countbusyretry']||0x0;this['countcongestionretry']=_0xdc8d38[_0xd110('0x14')]||0x0;this[_0xd110('0x15')]=_0xdc8d38[_0xd110('0x15')]||0x0;this[_0xd110('0x16')]=(_0xdc8d38['countbusyretry']||0x0)+(_0xdc8d38['countcongestionretry']||0x0)+(_0xdc8d38[_0xd110('0x15')]||0x0)+(_0xdc8d38[_0xd110('0x17')]||0x0)+(_0xdc8d38[_0xd110('0x18')]||0x0)+(_0xdc8d38['countabandonedretry']||0x0)+(_0xdc8d38['countmachineretry']||0x0)+(_0xdc8d38['countagentrejectretry']||0x0);this[_0xd110('0x17')]=_0xdc8d38[_0xd110('0x17')]||0x0;this['countdropretry']=_0xdc8d38[_0xd110('0x18')]||0x0;this['countabandonedretry']=_0xdc8d38['countabandonedretry']||0x0;this['countmachineretry']=_0xdc8d38[_0xd110('0x19')]||0x0;this[_0xd110('0x1a')]=_0xdc8d38[_0xd110('0x1a')]||0x0;this[_0xd110('0x1b')]=_0xdc8d38[_0xd110('0x1b')];this[_0xd110('0x1c')]=_0xdc8d38[_0xd110('0x1c')];this[_0xd110('0x1d')]=_0xdc8d38['callbackat'];this['recallme']=_0xdc8d38[_0xd110('0x1e')];this[_0xd110('0x1f')]=_0xdc8d38[_0xd110('0x1f')];this[_0xd110('0x20')]=_0xdc8d38['ListId'];this['UserId']=_['isNil'](_0xdc8d38['Agent'])?_0xdc8d38[_0xd110('0x21')]:_0xdc8d38[_0xd110('0x9')]['id'];this[_0xd110('0x22')]=_0xdc8d38[_0xd110('0x22')];this[_0xd110('0x23')]='';this[_0xd110('0x24')]='';}Action[_0xd110('0x25')]['getCaller']=function(){return util[_0xd110('0xa')](_0xd110('0x26'),this['calleridname'],this['number']);};module[_0xd110('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 895417a..0307863 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','clearZombieChannels','size','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','buildObj','connect','custom:agentConnectPreview','buildAcw','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','format','reachable','unmonitored','run','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','\x20Queue','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncHangupRequest','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','pTalking'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xb')]));var Sequence=function(){};Sequence[_0x0a9e('0xc')][_0x0a9e('0xd')]=function(_0x3ab53f){this[_0x0a9e('0xe')]=this[_0x0a9e('0xe')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0xf')]=_0x527cdd[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]={};this[_0x0a9e('0x13')]=_0x527cdd['agents'];this[_0x0a9e('0x14')]=0x0;ami['on'](_0x0a9e('0x15'),this[_0x0a9e('0x16')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')]['bind'](this));ami['on'](_0x0a9e('0x1a'),this['syncHangupRequest'][_0x0a9e('0x17')](this));ami['on']('dialend',this[_0x0a9e('0x1b')][_0x0a9e('0x17')](this));ami['on']('newexten',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x1f'),this[_0x0a9e('0x20')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x21'),this[_0x0a9e('0x22')][_0x0a9e('0x17')](this));this[_0x0a9e('0x23')](this[_0x0a9e('0xf')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x24')](_0x4bb1e3,_0x2c3407);}function emitCampaignPreview(_0x53682f){if(_0x53682f[_0x0a9e('0x25')]==='outbound'){var _0x588269={'id':_0x53682f['id'],'name':_0x53682f[_0x0a9e('0x26')],'strategy':_0x53682f[_0x0a9e('0x27')],'answered':_0x53682f[_0x0a9e('0x28')],'available':_0x53682f[_0x0a9e('0x29')],'loggedIn':_0x53682f['loggedIn'],'pTalking':_0x53682f[_0x0a9e('0x2a')],'sumBillable':_0x53682f[_0x0a9e('0x2b')],'sumDuration':_0x53682f[_0x0a9e('0x2c')],'sumHoldTime':_0x53682f[_0x0a9e('0x2d')]||0x0,'talking':_0x53682f[_0x0a9e('0x2e')],'total':_0x53682f[_0x0a9e('0x2f')],'type':_0x53682f[_0x0a9e('0x25')],'unmanaged':_0x53682f['unmanaged'],'abandoned':_0x53682f['abandoned'],'waiting':_0x53682f[_0x0a9e('0x30')],'loggedInDb':_0x53682f[_0x0a9e('0x31')],'dialActive':_0x53682f[_0x0a9e('0x32')],'dialMethod':_0x53682f[_0x0a9e('0x33')],'dialOriginateCallerIdName':_0x53682f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53682f[_0x0a9e('0x34')],'dialOriginateTimeout':_0x53682f['dialOriginateTimeout'],'dialPrefix':_0x53682f[_0x0a9e('0x35')],'outboundAnswerAgiCallsDay':_0x53682f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53682f[_0x0a9e('0x36')],'outboundBlacklistCallsDay':_0x53682f[_0x0a9e('0x37')],'outboundBusyCallsDay':_0x53682f[_0x0a9e('0x38')],'outboundCongestionCallsDay':_0x53682f[_0x0a9e('0x39')],'outboundDropCallsDayACS':_0x53682f[_0x0a9e('0x3a')],'outboundDropCallsDayCallersExit':_0x53682f[_0x0a9e('0x3b')],'outboundDropCallsDayTimeout':_0x53682f[_0x0a9e('0x3c')],'outboundNoAnswerCallsDay':_0x53682f[_0x0a9e('0x3d')],'outboundNoSuchCallsDay':_0x53682f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x53682f[_0x0a9e('0x3e')],'outboundReCallsDay':_0x53682f[_0x0a9e('0x3f')],'outboundRejectCallsDay':_0x53682f[_0x0a9e('0x40')],'outboundUnknownCallsDay':_0x53682f[_0x0a9e('0x41')],'outboundAbandonedCallsDay':_0x53682f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x53682f[_0x0a9e('0x42')],'predictiveIntervalAvgHoldtime':_0x53682f[_0x0a9e('0x43')],'predictiveIntervalAvgTalktime':_0x53682f[_0x0a9e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x53682f[_0x0a9e('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x53682f[_0x0a9e('0x46')],'predictiveIntervalErlangCalls':_0x53682f[_0x0a9e('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x53682f[_0x0a9e('0x48')],'predictiveIntervalHitRate':_0x53682f[_0x0a9e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x53682f[_0x0a9e('0x4a')],'predictiveIntervalPauses':_0x53682f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53682f[_0x0a9e('0x4b')],'predictiveIntervalTotalCalls':_0x53682f['predictiveIntervalTotalCalls'],'message':_0x53682f[_0x0a9e('0x4c')],'originated':_0x53682f[_0x0a9e('0x4d')],'erlangCalls':_0x53682f[_0x0a9e('0x4e')],'erlangCallToSecond':_0x53682f[_0x0a9e('0x4f')],'erlangAbandonmentRate':_0x53682f[_0x0a9e('0x50')],'erlangBusyFactor':_0x53682f['erlangBusyFactor'],'startPredictive':_0x53682f[_0x0a9e('0x51')],'startProgressive':_0x53682f[_0x0a9e('0x52')]};if(_0x53682f[_0x0a9e('0x53')]){_0x588269[_0x0a9e('0x53')]={'id':_0x53682f[_0x0a9e('0x53')]['id'],'name':_0x53682f[_0x0a9e('0x53')][_0x0a9e('0x26')],'active':_0x53682f[_0x0a9e('0x53')]['active'],'callerid':_0x53682f[_0x0a9e('0x53')]['callerid']};}if(_0x53682f[_0x0a9e('0x54')]){_0x588269[_0x0a9e('0x54')]={'id':_0x53682f[_0x0a9e('0x54')]['id'],'name':_0x53682f[_0x0a9e('0x54')]['name']};}var _0x191e91=md5(JSON[_0x0a9e('0x55')](_0x588269));if(_0x53682f[_0x0a9e('0x3')]!==_0x191e91){_0x53682f[_0x0a9e('0x3')]=_0x191e91;emit(util['format']('voice:queue:%s',_0x588269[_0x0a9e('0x26')]),'voice_queue:save',_0x588269);}}}function emitVoiceQueueChannelRemove(_0x24936a){logger[_0x0a9e('0x56')](_0x0a9e('0x57'),JSON[_0x0a9e('0x55')](_0x24936a));emit(util['format'](_0x0a9e('0x58'),_0x24936a[_0x0a9e('0x26')]),_0x0a9e('0x59'),_0x24936a);}function notSendMessagesQueue(_0x533942){if(_0x533942[_0x0a9e('0x5a')]){if(_0x533942[_0x0a9e('0x4d')]===0x0&&_0x533942[_0x0a9e('0x2a')]===0x0){_0x533942['sendMessageOneNotActive']=![];_0x533942['available']=0x0;_0x533942[_0x0a9e('0x5b')]=0x0;_0x533942[_0x0a9e('0x4c')]='NOT_ACTIVE';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942[_0x0a9e('0x26')]+_0x0a9e('0x5e'));}else{_0x533942['message']='IS_DISACTIVED';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942['name']+_0x0a9e('0x5f'));}emitCampaignPreview(_0x533942);}}Preview[_0x0a9e('0xc')][_0x0a9e('0x23')]=function(){var _0x5b4f5e=this;setInterval(function(){_0x5b4f5e[_0x0a9e('0x60')]();},0x7cf);};Preview[_0x0a9e('0xc')][_0x0a9e('0x60')]=function(){var _0x43dd5b=this[_0x0a9e('0xf')];this[_0x0a9e('0x14')]+=0x1;for(var _0x2881b3 in _0x43dd5b){if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&(_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')||_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x62'))&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(this[_0x0a9e('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(_0x43dd5b[_0x2881b3][_0x0a9e('0x32')]){this[_0x0a9e('0x64')](_0x43dd5b[_0x2881b3]);this[_0x0a9e('0x65')](_0x43dd5b[_0x2881b3]);}else{notSendMessagesQueue(_0x43dd5b[_0x2881b3]);}}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x66')]=function(_0x2c2cb0){var _0x35ed4a=this;this['sequence'][_0x0a9e('0xd')](function(){if(!_[_0x0a9e('0x67')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0])){loggerAction[_0x0a9e('0x56')](_0x0a9e('0x68'),_0x2c2cb0,_0x0a9e('0x69'),_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')],'originated:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a['campaignsPreview'][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x4d')]),'pTalking:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x2a')]),JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['dialAnswer']),JSON[_0x0a9e('0x55')](_[_0x0a9e('0x6b')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0],[_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x0a9e('0x6f')])));return ami[_0x0a9e('0x70')]({'action':_0x0a9e('0x71'),'channel':_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x72')]})[_0x0a9e('0x73')](function(_0x4f7240){if(_0x4f7240['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]){ut[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x76')]===!![]){ut['decrementTalkink'](_0x35ed4a['campaignsPreview'][_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));ut[_0x0a9e('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['queue']);delete _0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x78')]=function(){var _0x3c20b2=this;loggerAction[_0x0a9e('0x56')]('[action]',_[_0x0a9e('0x79')](this[_0x0a9e('0x12')]));for(var _0x508b47 in this['actions']){if(_0x3c20b2[_0x0a9e('0x12')][_0x0a9e('0x61')](_0x508b47)){_0x3c20b2['clearZombieChannel'](_0x508b47);}}};Preview[_0x0a9e('0xc')]['recallMe']=function(_0x211ef9){var _0x523cd2=this;rpcDb[_0x0a9e('0x7a')](_0x211ef9['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2da03c){if(!_['isNil'](_0x2da03c)){for(var _0x2f7092=0x0;_0x2f7092<_0x2da03c[_0x0a9e('0x7b')];_0x2f7092+=0x1){if(ut[_0x0a9e('0x7c')](_0x2da03c[_0x2f7092][_0x0a9e('0x7d')])<_0x211ef9[_0x0a9e('0x7e')]*0x3c){if(_0x2da03c[_0x2f7092][_0x0a9e('0x7f')]&&!_0x2da03c[_0x2f7092][_0x0a9e('0x7f')][_0x0a9e('0x80')]){_0x523cd2['run'](_0x2da03c[_0x2f7092]['id'])[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')))[_0x0a9e('0x73')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')));}else{rpcDb['disableContact'](_0x2da03c[_0x2f7092]['id']);}}else{var _0x956fbe=new Action(_0x2da03c[_0x2f7092],_0x211ef9);_0x956fbe[_0x0a9e('0x84')]=moment()['format'](_0x0a9e('0x85'));_0x211ef9['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x86')](_0x956fbe,0x17,'RecallInQueue');if(_0x211ef9['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0a9e('0x87')](_0x2da03c[_0x2f7092]));rpcDb['createCustomerHistory'](_0x956fbe,_0x0a9e('0x88'));}else{ut[_0x0a9e('0x86')](_0x956fbe,0x16,_0x0a9e('0x89'));rpcDb[_0x0a9e('0x8a')](_0x956fbe,_0x0a9e('0x8b'));rpcDb[_0x0a9e('0x8c')](_0x956fbe,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x73')](ut['logger2'](_0x0a9e('0x8d')));};Preview[_0x0a9e('0xc')][_0x0a9e('0x64')]=function(_0x5adf8f){_0x5adf8f[_0x0a9e('0x5a')]=!![];if(ut[_0x0a9e('0x8e')](_0x5adf8f[_0x0a9e('0x8f')])){_0x5adf8f[_0x0a9e('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0a9e('0x90')](_0x5adf8f[_0x0a9e('0x32')])){_0x5adf8f['message']=_0x0a9e('0x91');}else if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x53')])){if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x93')])){_0x5adf8f['message']=_0x0a9e('0x94');}else{_0x5adf8f[_0x0a9e('0x4c')]=_0x0a9e('0x95');}}else{_0x5adf8f['message']=_0x0a9e('0x95');}emitCampaignPreview(_0x5adf8f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x242745,_0x4556c5,_0x9375fb){var _0x19c995=this;var _0x186f39=this[_0x0a9e('0x12')][_0x4556c5];var _0x387489=this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]];var _0x1cc4f3;if(_0x387489){switch(_0x9375fb){case'1':_0x387489[_0x0a9e('0x96')]+=0x1;_0x186f39[_0x0a9e('0x97')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x0,_0x0a9e('0x9a'));ami[_0x0a9e('0x24')](_0x0a9e('0x9b'),ut['buildObj'](_0x186f39,_0x0a9e('0x9c')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0x9d'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,'Global');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xa0'));}else{if(_0x186f39[_0x0a9e('0x97')]>=_0x387489[_0x0a9e('0xa1')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x186f39,_0x0a9e('0x97'),_0x387489[_0x0a9e('0xa2')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];break;case _0x0a9e('0xa6'):var _0x1a0677=moment()['format'](_0x0a9e('0x85'));_0x186f39[_0x0a9e('0xa7')]=_0x1a0677;_0x186f39[_0x0a9e('0xa8')]=_0x1a0677;_0x186f39['dialAnswer']=!![];_0x387489[_0x0a9e('0x2a')]+=0x1;logger['info'](_0x0a9e('0xa9'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],_0x0a9e('0xab'),_0x387489[_0x0a9e('0x2a')]);ami[_0x0a9e('0x24')]('custom:agentconnect',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xad'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));if(_0x387489['acw']){ami[_0x0a9e('0x24')](_0x0a9e('0xae'),ut[_0x0a9e('0xaf')](_0x186f39));}break;case'16':ami[_0x0a9e('0x24')]('custom:agentcomplete',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0')));_0x387489[_0x0a9e('0x36')]+=0x1;_0x387489[_0x0a9e('0x2f')]+=0x1;_0x387489[_0x0a9e('0x28')]+=0x1;ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xb2'));_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x4,'Answer');rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xb3'));rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0xb4')](_0x186f39);_0x387489[_0x0a9e('0x2c')]+=_0x186f39[_0x0a9e('0xb5')];_0x387489[_0x0a9e('0x2b')]+=_0x186f39['talktime'];logger['info'](_0x0a9e('0xb6'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],'pTalking:\x20',_0x387489[_0x0a9e('0x2a')]);delete this[_0x0a9e('0x12')][_0x242745['linkedid']];break;case _0x0a9e('0xb7'):_0x387489[_0x0a9e('0x38')]+=0x1;_0x186f39[_0x0a9e('0xb8')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x5,_0x0a9e('0xb9'));ami['emit'](_0x0a9e('0xba'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xbd'));}else{if(_0x186f39[_0x0a9e('0xb8')]>=_0x387489[_0x0a9e('0xbe')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xb8'),_0x387489[_0x0a9e('0xc0')]),_0x186f39['unlockAgent'],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc1'):_0x387489['outboundNoAnswerCallsDay']+=0x1;_0x186f39['countnoanswerretry']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut['logCustomer'](_0x186f39,0x3,'NoAnswer');ami[_0x0a9e('0x24')](_0x0a9e('0xc2'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xc3')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xc4'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xc5'));}else{if(_0x186f39[_0x0a9e('0xc6')]>=_0x387489['dialNoAnswerMaxRetry']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xc4'));}else{rpcDb[_0x0a9e('0xc7')](ut['scheduledAt'](_0x186f39,_0x0a9e('0xc6'),_0x387489[_0x0a9e('0xc8')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc9'):_0x387489[_0x0a9e('0x39')]+=0x1;_0x186f39[_0x0a9e('0xca')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x8,_0x0a9e('0xcb'));ami['emit'](_0x0a9e('0xcc'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xcd')));rpcDb['createCustomerHistory'](_0x186f39,_0x0a9e('0xce'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xcf'));}else{if(_0x186f39[_0x0a9e('0xca')]>=_0x387489[_0x0a9e('0xd0')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xca'),_0x387489[_0x0a9e('0xc0')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xd1'):_0x387489[_0x0a9e('0x40')]+=0x1;_0x186f39[_0x0a9e('0xd2')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x14,_0x0a9e('0xd3'));ami['emit'](_0x0a9e('0xd4'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xd5')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xd6'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0x14,'AgentReject');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x186f39[_0x0a9e('0xd2')]>=_0x387489[_0x0a9e('0xd7')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,'countagentrejectretry',_0x387489[_0x0a9e('0xd9')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39['activeContact']);}}break;case _0x0a9e('0xda'):_0x387489[_0x0a9e('0xdb')]+=0x1;_0x186f39[_0x0a9e('0xdc')]+=0x1;_0x186f39['countglobal']=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xb,_0x0a9e('0xdd'));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xde'));if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x186f39[_0x0a9e('0xdf')]>=_0x387489['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xde'));}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xdc'),_0x387489['dialAbandonedRetryFrequency']),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;default:if(_0x186f39[_0x0a9e('0x76')]){ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xe0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x387489[_0x0a9e('0x26')],_0x242745);}_0x387489['outboundUnknownCallsDay']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xc,_0x242745[_0x0a9e('0xe1')]||_0x242745[_0x0a9e('0xe2')]);rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xe3'));}else{rpcDb['createCustomerFinal'](_0x186f39,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];}if(!(_0x186f39['dialAnswer']&&_0x9375fb==='16')){ut[_0x0a9e('0x74')](_0x387489,_0x0a9e('0xe4'));logger[_0x0a9e('0x56')](_0x0a9e('0xe5'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489['name'],_0x0a9e('0xe6'),_0x387489[_0x0a9e('0x4d')]);}if(_0x9375fb!==_0x0a9e('0xa6')){delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];delete this['actions'][_0x242745[_0x0a9e('0xe7')]];}}};Preview[_0x0a9e('0xc')]['callProgressDetectingAgent']=function(_0x3c313d,_0x19fd11,_0xcacabb){if(_[_0x0a9e('0xe8')](_0x19fd11)&&_0x0a9e('0xe9')!==typeof _0x19fd11){return;}if(_[_0x0a9e('0xe8')](_0xcacabb)&&_0x0a9e('0xe9')!==typeof _0xcacabb){return;}switch(_0xcacabb[_0x0a9e('0xea')]){case'0':ut[_0x0a9e('0xeb')](_0x3c313d,0x0,_0x0a9e('0x9a'));rpcDb['createAgentHistory'](_0x3c313d,_0x0a9e('0xec'));break;case'3':ut[_0x0a9e('0xeb')](_0x3c313d,0x3,_0x0a9e('0xed'));rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xef'));break;case'5':ut['logAgent'](_0x3c313d,0x5,'Busy');rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xf0'));break;case'8':ut[_0x0a9e('0xeb')](_0x3c313d,0x8,_0x0a9e('0xcb'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xeb')](_0x3c313d,0x16,_0x0a9e('0xf1'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0a9e('0xeb')](_0x3c313d,0xc,_0xcacabb['reason']);rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a9e('0x74')](_0x19fd11,_0x0a9e('0xf2'));logger[_0x0a9e('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x3c313d[_0x0a9e('0xaa')],'\x20Queue',_0x19fd11[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x19fd11[_0x0a9e('0x4d')]);delete this[_0x0a9e('0x12')][_0x3c313d[_0x0a9e('0xaa')]];};Preview[_0x0a9e('0xc')][_0x0a9e('0xf3')]=function(_0xe89aaa,_0x2aaf07,_0x27d1f5,_0x4262d0,_0xc876d4){var _0x2415fe=this;return new BPromise(function(_0x399def,_0x98c62c){if(_[_0x0a9e('0x67')](_0x2aaf07)||_['isNil'](_0x2aaf07['Contact'])||_[_0x0a9e('0x67')](_0x2aaf07['Contact'][_0x0a9e('0xf4')])||_[_0x0a9e('0x67')](_0x2aaf07['VoiceQueueId'])){_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0xf5'),_0x4262d0,_0xc876d4));return;}var _0x387bbe=uuid['v4']();var _0x18adc8=_0x2415fe['campaignsPreview'][_0x2aaf07[_0x0a9e('0x69')][_0x0a9e('0x26')]];var _0x374f0b=_0x27d1f5?_0x2415fe[_0x0a9e('0x13')][_0x27d1f5]['id']:undefined;_0x2415fe['actions'][_0x387bbe]=new Action(_0x2aaf07,_0x18adc8,_0x387bbe,_0x27d1f5,_0x374f0b);var _0x19e9ed=_0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x19e9ed[_0x0a9e('0xa3')]=_0x4262d0;_0x19e9ed['activeContact']=_0xc876d4;_0x19e9ed[_0x0a9e('0xf6')]=_0x27d1f5;if(_[_0x0a9e('0xf7')](_0xe89aaa)){_0x2415fe[_0x0a9e('0xf8')](_0x19e9ed,_0x18adc8,_0x2aaf07,_0x27d1f5)['then'](function(_0x303f75){logger[_0x0a9e('0x56')](_0x0a9e('0xf9'),_0x0a9e('0xfa')+_0x19e9ed[_0x0a9e('0x6a')]+'\x20IdHopper:\x20'+_0x19e9ed[_0x0a9e('0xfb')],JSON[_0x0a9e('0x55')](_0x303f75));ami['emit'](_0x0a9e('0xfc'),ut[_0x0a9e('0xac')](_0x19e9ed,_0x0a9e('0xfd'),_0x2415fe['campaignsPreview'][_0x19e9ed['queue']]));_0x399def(ut['message'](_0x0a9e('0xfe')));})[_0x0a9e('0x73')](function(_0x55f91a){ut[_0x0a9e('0x5c')](_0x0a9e('0xff'),_0x55f91a);_0x98c62c(ut[_0x0a9e('0x4c')]('Call\x20failed',_0x4262d0,_0xc876d4));});}else{_0x18adc8[_0x0a9e('0x37')]+=0x1;ut[_0x0a9e('0x100')](_0x19e9ed);rpcDb[_0x0a9e('0x101')](_0x19e9ed,_0x0a9e('0x102'));delete _0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0x103'),_0x4262d0,_0xc876d4));}});};Preview[_0x0a9e('0xc')][_0x0a9e('0x92')]=function(_0x5a1848){return!_[_0x0a9e('0x67')](_0x5a1848)&&!_['isNil'](_0x5a1848[_0x0a9e('0x26')])&&!_[_0x0a9e('0x67')](_0x5a1848[_0x0a9e('0x104')])&&_0x5a1848[_0x0a9e('0x104')]&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])])&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')])&&(this[_0x0a9e('0x11')][util[_0x0a9e('0x106')](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x107')||this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x108'));};Preview[_0x0a9e('0xc')][_0x0a9e('0x109')]=function(_0x2895c5,_0x20ae21){var _0x566b90=this;return new BPromise(function(_0x3b581c,_0xd2391){_0x566b90[_0x0a9e('0x10a')](_0x2895c5,_0x20ae21)['then'](function(_0x1402c7){_0x3b581c(_[_0x0a9e('0x6b')](_0x1402c7,[_0x0a9e('0x4c')]));})[_0x0a9e('0x73')](function(_0x370b5e){if(_0x370b5e[_0x0a9e('0x10b')]){rpcDb[_0x0a9e('0x10c')](_0x2895c5);}if(_0x370b5e[_0x0a9e('0x104')]){rpcDb[_0x0a9e('0x10d')](_0x2895c5);}_0xd2391(_[_0x0a9e('0x6b')](_0x370b5e,['message']));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10a')]=function(_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new BPromise(function(_0x3942fd,_0x5cb48d){var _0x382687,_0x4f854b;rpcDb['getContactPreview'](_0x15a9ed)['then'](function(_0x19e4e6){if(!_[_0x0a9e('0x67')](_0x19e4e6[0x0])){_0x4f854b=_0x19e4e6[0x0][_0x0a9e('0x10e')]?![]:!![];_0x382687=_0x19e4e6[0x0][_0x0a9e('0x10e')]?!![]:![];_0x382687=_0x3db98f?!![]:_0x382687;}var _0x4d99a8=_0x2b624e[_0x0a9e('0x10f')](_0x19e4e6);if(_0x4d99a8[_0x0a9e('0x110')]){rpcDb[_0x0a9e('0x111')](_[_0x0a9e('0x6b')](_0x19e4e6[0x0],[_0x0a9e('0x6e'),'Contact.phone']))['then'](function(_0x9484c8){_0x2b624e[_0x0a9e('0xf3')](_0x9484c8,_0x19e4e6[0x0],_0x3db98f,_0x4f854b,_0x382687)[_0x0a9e('0x81')](function(_0x5e85d0){_0x3942fd(_0x5e85d0);})[_0x0a9e('0x73')](function(_0x248a9a){_0x5cb48d(_0x248a9a);});})[_0x0a9e('0x73')](function(_0x4cee8c){ut[_0x0a9e('0x5c')](_0x0a9e('0x112'),_0x4cee8c);_0x5cb48d(ut[_0x0a9e('0x4c')]('Call\x20unsuccessful',_0x4f854b,_0x382687));});}else{_0x5cb48d(ut[_0x0a9e('0x4c')](_0x4d99a8[_0x0a9e('0x4c')],_0x4f854b,_0x382687));}})[_0x0a9e('0x73')](function(_0x549e03){ut['logger']('[Preview][getContactPreview]',_0x549e03);_0x5cb48d(ut[_0x0a9e('0x4c')](_0x0a9e('0x113'),![],!![]));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10f')]=function(_0x5d83fd){if(_[_0x0a9e('0x67')](_0x5d83fd)||_['isEmpty'](_0x5d83fd)||!_[_0x0a9e('0x67')](_0x5d83fd[0x0][_0x0a9e('0x7f')])&&_[_0x0a9e('0x67')](_0x5d83fd[0x0]['Agent'][_0x0a9e('0x26')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x114'),_0x5d83fd);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x40eb5d=this['campaignsPreview'][_0x5d83fd[0x0][_0x0a9e('0x69')]['name']];_0x40eb5d[_0x0a9e('0x4c')]='ACTIVE';if(_[_0x0a9e('0x67')](_0x40eb5d)){ut[_0x0a9e('0x5c')](_0x0a9e('0x115'),_0x40eb5d);return{'isValid':![],'message':_0x0a9e('0x116')};}if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x53')])){ut[_0x0a9e('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x93')])){ut['logger'](_0x0a9e('0x118'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x119'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x0a9e('0x90')](_0x40eb5d[_0x0a9e('0x32')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x11a'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b'));return{'isValid':![],'message':_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b')};}return{'isValid':!![],'message':_0x0a9e('0x11c')};};Preview['prototype'][_0x0a9e('0xf8')]=function(_0x53c7de,_0x3c9854,_0x2968e2,_0x5b9c76){var _0x315e31=this;return new BPromise(function(_0x5d577b,_0x2d45db){var _0x5691ac=_0x53c7de[_0x0a9e('0xaa')];var _0x469035=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?util[_0x0a9e('0x106')](_0x0a9e('0x11d'),_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x35')])?'':_0x3c9854[_0x0a9e('0x35')]['trim']()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')]):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')]:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854['dialPrefix'])?'':_0x3c9854[_0x0a9e('0x35')][_0x0a9e('0x121')]()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2['Contact'][_0x0a9e('0xf4')]);var _0x294310=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?ut[_0x0a9e('0x122')](_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x125')](_0x3c9854[_0x0a9e('0x34')],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]):ut[_0x0a9e('0x122')](_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')]['callerid']:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854[_0x0a9e('0x126')]>0x0?ut['getCallerIdRandom'](_0x3c9854['dialOriginateCallerIdNumber'],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]);if(_0x294310){_0x53c7de[_0x0a9e('0x127')]=ut['extractCalleridName'](_0x294310);_0x53c7de[_0x0a9e('0x128')]=ut[_0x0a9e('0x129')](_0x294310);}var _0x4d8a67=ut[_0x0a9e('0x12a')](_0x3c9854,_0x2968e2,_0x469035,_0x294310,_0x5691ac,_0x53c7de);_['merge'](_0x53c7de,ut[_0x0a9e('0x12b')](_0x4d8a67));_0x53c7de['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x70')](ut[_0x0a9e('0x12c')](_0x53c7de,_0x3c9854,_0x4d8a67,_0x53c7de[_0x0a9e('0xa4')],_0x5b9c76))[_0x0a9e('0x81')](function(_0x7d59a9){_0x3c9854[_0x0a9e('0x4d')]+=0x1;logger['info'](_0x0a9e('0x12d'),_0x5691ac,_0x0a9e('0x12e'),_0x3c9854[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x3c9854[_0x0a9e('0x4d')]);_0x5d577b(_0x7d59a9);})[_0x0a9e('0x73')](function(_0x31c937){ut['logAgent'](_0x53c7de,0xe,'OriginateError');rpcDb[_0x0a9e('0xee')](_0x53c7de,'[originateFailure][logOriginateFailure]');_0x2d45db(_0x31c937);});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x1c')]=function(_0x1f0318){if(this[_0x0a9e('0x12')][_0x1f0318[_0x0a9e('0xa5')]]){this[_0x0a9e('0x12')][_0x1f0318['linkedid']][_0x0a9e('0x72')]=_0x1f0318['channel'];}};Preview['prototype'][_0x0a9e('0x16')]=function(_0x593f9e){var _0x38dceb=this;var _0x5dc978=this['actions'][_0x593f9e[_0x0a9e('0x12f')]];if(_0x5dc978){if(_0x5dc978['lookAgent']&&this[_0x0a9e('0x13')][_0x5dc978[_0x0a9e('0xf6')]]){ut[_0x0a9e('0x130')](_0x5dc978,this['agents'][_0x5dc978[_0x0a9e('0xf6')]][_0x0a9e('0x26')],this[_0x0a9e('0x13')][_0x5dc978['lookAgent']]['id']);}var _0x5236c9=_[_0x0a9e('0x131')](_0x5dc978);_0x5236c9[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));var _0x3b0db2=_0x38dceb[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]];if(ut[_0x0a9e('0x132')](_0x593f9e[_0x0a9e('0x133')])){if(_0x5dc978[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x5dc978['idContact']);}if(_0x5dc978['activeContact']){rpcDb[_0x0a9e('0x10d')](_0x5dc978[_0x0a9e('0xfb')]);}ami[_0x0a9e('0x24')](_0x0a9e('0x134'),ut[_0x0a9e('0xac')](_0x5dc978,_0x0a9e('0x135'),this[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]]));this['callProgressDetectingAgent'](_0x5236c9,_0x3b0db2,_0x593f9e);}else{_0x5dc978['starttime']=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));ut['logAgent'](_0x5236c9,0x4,_0x0a9e('0x136'));rpcDb[_0x0a9e('0xee')](_0x5236c9,_0x0a9e('0x137'));}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x19')]=function(_0x2683ad){var _0x167196=this;var _0x262281=this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]];var _0xbd1af3;if(_0x262281){_0xbd1af3=this[_0x0a9e('0xf')][_0x262281['queue']];logger[_0x0a9e('0x56')](_0x0a9e('0x138'),_0x2683ad[_0x0a9e('0xa5')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);}if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]]&&_0x2683ad[_0x0a9e('0xa5')]!==_0x2683ad[_0x0a9e('0xaa')]){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad['linkedid']][_0x0a9e('0x76')]){this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger['info'](_0x0a9e('0x13b'),_0x2683ad['linkedid'],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}else if(_0x262281&&_[_0x0a9e('0x67')](_0x262281[_0x0a9e('0x13c')])&&_0xbd1af3[_0x0a9e('0x13d')]&&_0x2683ad[_0x0a9e('0xa5')]===_0x2683ad[_0x0a9e('0xaa')]&&_[_0x0a9e('0x67')](_0x2683ad[_0x0a9e('0xea')])&&_0x2683ad[_0x0a9e('0x139')]==='16'&&_0x2683ad['channelstate']==='6'&&_['isUndefined'](_0x262281[_0x0a9e('0x13e')])){if(_0x262281[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x262281['idContact']);}if(_0x262281[_0x0a9e('0xa4')]){rpcDb[_0x0a9e('0x10d')](_0x262281[_0x0a9e('0xfb')]);}_0x2683ad['reason']='22';this[_0x0a9e('0x13f')](_0x262281,_0xbd1af3,_0x2683ad);}else if(_0x262281&&_0x262281['transfer']){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad[_0x0a9e('0xa5')]]['dialAnswer']){logger[_0x0a9e('0x56')](_0x0a9e('0x140'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad['cause'],_0x0a9e('0x12e'),_0xbd1af3['name'],'pTalking:\x20',_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger[_0x0a9e('0x56')](_0x0a9e('0x13b'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}};Preview[_0x0a9e('0xc')]['syncDialEnd']=function(_0x233e48){if(this[_0x0a9e('0x12')][_0x233e48[_0x0a9e('0xe7')]]&&_0x233e48[_0x0a9e('0xe7')]!==_0x233e48['destuniqueid']){this['callProgressDetectingCustomer'](_0x233e48,_0x233e48['destlinkedid'],_0x233e48[_0x0a9e('0xe2')]);}};Preview['prototype'][_0x0a9e('0x141')]=function(_0x1fafc2){if(this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]]&&_0x1fafc2[_0x0a9e('0xa5')]!==_0x1fafc2[_0x0a9e('0xaa')]&&!this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){if(_0x1fafc2[_0x0a9e('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x1fafc2,_0x1fafc2[_0x0a9e('0xa5')],_0x1fafc2['cause']);}}};Preview[_0x0a9e('0xc')]['addVariable']=function(_0xf4de86,_0x2c5385,_0x216791){if(this['actions'][_0xf4de86]){if(_[_0x0a9e('0x67')](this[_0x0a9e('0x12')][_0xf4de86]['variables'])){this['actions'][_0xf4de86][_0x0a9e('0x142')]={};}this[_0x0a9e('0x12')][_0xf4de86][_0x0a9e('0x142')][_0x2c5385]=_0x216791;}};Preview['prototype']['syncVarSet']=function(_0x4869c1){try{if(!_[_0x0a9e('0x67')](_0x4869c1)){if(ut[_0x0a9e('0x143')](_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0])){this[_0x0a9e('0x146')](_0x4869c1[_0x0a9e('0xaa')],_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0],_0x4869c1[_0x0a9e('0x147')]);}}}catch(_0x18e38b){logger[_0x0a9e('0x148')](_0x0a9e('0x149'),util[_0x0a9e('0x14a')](_0x18e38b,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xc')][_0x0a9e('0x20')]=function(_0x1a74c4){if(_0x1a74c4){if(this[_0x0a9e('0x12')][_0x1a74c4[_0x0a9e('0x14b')]]){this['actions'][_0x1a74c4[_0x0a9e('0x14b')]][_0x0a9e('0x13e')]=!![];}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x22')]=function(_0x4790f7){if(_0x4790f7){if(this[_0x0a9e('0x12')][_0x4790f7['transfererlinkedid']]){this[_0x0a9e('0x12')][_0x4790f7[_0x0a9e('0x14c')]][_0x0a9e('0x13e')]=!![];}}};module[_0x0a9e('0x14d')]=Preview; \ No newline at end of file +var _0xa9e0=['sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','clearZombieChannels','size','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','buildObj','connect','custom:agentConnectPreview','buildAcw','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','format','reachable','unmonitored','run','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','\x20Queue','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncHangupRequest','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','pTalking'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xb')]));var Sequence=function(){};Sequence[_0x0a9e('0xc')][_0x0a9e('0xd')]=function(_0x3ab53f){this[_0x0a9e('0xe')]=this[_0x0a9e('0xe')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0xf')]=_0x527cdd[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]={};this[_0x0a9e('0x13')]=_0x527cdd['agents'];this[_0x0a9e('0x14')]=0x0;ami['on'](_0x0a9e('0x15'),this[_0x0a9e('0x16')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')]['bind'](this));ami['on'](_0x0a9e('0x1a'),this['syncHangupRequest'][_0x0a9e('0x17')](this));ami['on']('dialend',this[_0x0a9e('0x1b')][_0x0a9e('0x17')](this));ami['on']('newexten',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x1f'),this[_0x0a9e('0x20')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x21'),this[_0x0a9e('0x22')][_0x0a9e('0x17')](this));this[_0x0a9e('0x23')](this[_0x0a9e('0xf')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x24')](_0x4bb1e3,_0x2c3407);}function emitCampaignPreview(_0x53682f){if(_0x53682f[_0x0a9e('0x25')]==='outbound'){var _0x588269={'id':_0x53682f['id'],'name':_0x53682f[_0x0a9e('0x26')],'strategy':_0x53682f[_0x0a9e('0x27')],'answered':_0x53682f[_0x0a9e('0x28')],'available':_0x53682f[_0x0a9e('0x29')],'loggedIn':_0x53682f['loggedIn'],'pTalking':_0x53682f[_0x0a9e('0x2a')],'sumBillable':_0x53682f[_0x0a9e('0x2b')],'sumDuration':_0x53682f[_0x0a9e('0x2c')],'sumHoldTime':_0x53682f[_0x0a9e('0x2d')]||0x0,'talking':_0x53682f[_0x0a9e('0x2e')],'total':_0x53682f[_0x0a9e('0x2f')],'type':_0x53682f[_0x0a9e('0x25')],'unmanaged':_0x53682f['unmanaged'],'abandoned':_0x53682f['abandoned'],'waiting':_0x53682f[_0x0a9e('0x30')],'loggedInDb':_0x53682f[_0x0a9e('0x31')],'dialActive':_0x53682f[_0x0a9e('0x32')],'dialMethod':_0x53682f[_0x0a9e('0x33')],'dialOriginateCallerIdName':_0x53682f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53682f[_0x0a9e('0x34')],'dialOriginateTimeout':_0x53682f['dialOriginateTimeout'],'dialPrefix':_0x53682f[_0x0a9e('0x35')],'outboundAnswerAgiCallsDay':_0x53682f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53682f[_0x0a9e('0x36')],'outboundBlacklistCallsDay':_0x53682f[_0x0a9e('0x37')],'outboundBusyCallsDay':_0x53682f[_0x0a9e('0x38')],'outboundCongestionCallsDay':_0x53682f[_0x0a9e('0x39')],'outboundDropCallsDayACS':_0x53682f[_0x0a9e('0x3a')],'outboundDropCallsDayCallersExit':_0x53682f[_0x0a9e('0x3b')],'outboundDropCallsDayTimeout':_0x53682f[_0x0a9e('0x3c')],'outboundNoAnswerCallsDay':_0x53682f[_0x0a9e('0x3d')],'outboundNoSuchCallsDay':_0x53682f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x53682f[_0x0a9e('0x3e')],'outboundReCallsDay':_0x53682f[_0x0a9e('0x3f')],'outboundRejectCallsDay':_0x53682f[_0x0a9e('0x40')],'outboundUnknownCallsDay':_0x53682f[_0x0a9e('0x41')],'outboundAbandonedCallsDay':_0x53682f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x53682f[_0x0a9e('0x42')],'predictiveIntervalAvgHoldtime':_0x53682f[_0x0a9e('0x43')],'predictiveIntervalAvgTalktime':_0x53682f[_0x0a9e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x53682f[_0x0a9e('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x53682f[_0x0a9e('0x46')],'predictiveIntervalErlangCalls':_0x53682f[_0x0a9e('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x53682f[_0x0a9e('0x48')],'predictiveIntervalHitRate':_0x53682f[_0x0a9e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x53682f[_0x0a9e('0x4a')],'predictiveIntervalPauses':_0x53682f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53682f[_0x0a9e('0x4b')],'predictiveIntervalTotalCalls':_0x53682f['predictiveIntervalTotalCalls'],'message':_0x53682f[_0x0a9e('0x4c')],'originated':_0x53682f[_0x0a9e('0x4d')],'erlangCalls':_0x53682f[_0x0a9e('0x4e')],'erlangCallToSecond':_0x53682f[_0x0a9e('0x4f')],'erlangAbandonmentRate':_0x53682f[_0x0a9e('0x50')],'erlangBusyFactor':_0x53682f['erlangBusyFactor'],'startPredictive':_0x53682f[_0x0a9e('0x51')],'startProgressive':_0x53682f[_0x0a9e('0x52')]};if(_0x53682f[_0x0a9e('0x53')]){_0x588269[_0x0a9e('0x53')]={'id':_0x53682f[_0x0a9e('0x53')]['id'],'name':_0x53682f[_0x0a9e('0x53')][_0x0a9e('0x26')],'active':_0x53682f[_0x0a9e('0x53')]['active'],'callerid':_0x53682f[_0x0a9e('0x53')]['callerid']};}if(_0x53682f[_0x0a9e('0x54')]){_0x588269[_0x0a9e('0x54')]={'id':_0x53682f[_0x0a9e('0x54')]['id'],'name':_0x53682f[_0x0a9e('0x54')]['name']};}var _0x191e91=md5(JSON[_0x0a9e('0x55')](_0x588269));if(_0x53682f[_0x0a9e('0x3')]!==_0x191e91){_0x53682f[_0x0a9e('0x3')]=_0x191e91;emit(util['format']('voice:queue:%s',_0x588269[_0x0a9e('0x26')]),'voice_queue:save',_0x588269);}}}function emitVoiceQueueChannelRemove(_0x24936a){logger[_0x0a9e('0x56')](_0x0a9e('0x57'),JSON[_0x0a9e('0x55')](_0x24936a));emit(util['format'](_0x0a9e('0x58'),_0x24936a[_0x0a9e('0x26')]),_0x0a9e('0x59'),_0x24936a);}function notSendMessagesQueue(_0x533942){if(_0x533942[_0x0a9e('0x5a')]){if(_0x533942[_0x0a9e('0x4d')]===0x0&&_0x533942[_0x0a9e('0x2a')]===0x0){_0x533942['sendMessageOneNotActive']=![];_0x533942['available']=0x0;_0x533942[_0x0a9e('0x5b')]=0x0;_0x533942[_0x0a9e('0x4c')]='NOT_ACTIVE';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942[_0x0a9e('0x26')]+_0x0a9e('0x5e'));}else{_0x533942['message']='IS_DISACTIVED';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942['name']+_0x0a9e('0x5f'));}emitCampaignPreview(_0x533942);}}Preview[_0x0a9e('0xc')][_0x0a9e('0x23')]=function(){var _0x5b4f5e=this;setInterval(function(){_0x5b4f5e[_0x0a9e('0x60')]();},0x7cf);};Preview[_0x0a9e('0xc')][_0x0a9e('0x60')]=function(){var _0x43dd5b=this[_0x0a9e('0xf')];this[_0x0a9e('0x14')]+=0x1;for(var _0x2881b3 in _0x43dd5b){if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&(_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')||_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x62'))&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(this[_0x0a9e('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(_0x43dd5b[_0x2881b3][_0x0a9e('0x32')]){this[_0x0a9e('0x64')](_0x43dd5b[_0x2881b3]);this[_0x0a9e('0x65')](_0x43dd5b[_0x2881b3]);}else{notSendMessagesQueue(_0x43dd5b[_0x2881b3]);}}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x66')]=function(_0x2c2cb0){var _0x35ed4a=this;this['sequence'][_0x0a9e('0xd')](function(){if(!_[_0x0a9e('0x67')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0])){loggerAction[_0x0a9e('0x56')](_0x0a9e('0x68'),_0x2c2cb0,_0x0a9e('0x69'),_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')],'originated:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a['campaignsPreview'][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x4d')]),'pTalking:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x2a')]),JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['dialAnswer']),JSON[_0x0a9e('0x55')](_[_0x0a9e('0x6b')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0],[_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x0a9e('0x6f')])));return ami[_0x0a9e('0x70')]({'action':_0x0a9e('0x71'),'channel':_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x72')]})[_0x0a9e('0x73')](function(_0x4f7240){if(_0x4f7240['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]){ut[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x76')]===!![]){ut['decrementTalkink'](_0x35ed4a['campaignsPreview'][_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));ut[_0x0a9e('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['queue']);delete _0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x78')]=function(){var _0x3c20b2=this;loggerAction[_0x0a9e('0x56')]('[action]',_[_0x0a9e('0x79')](this[_0x0a9e('0x12')]));for(var _0x508b47 in this['actions']){if(_0x3c20b2[_0x0a9e('0x12')][_0x0a9e('0x61')](_0x508b47)){_0x3c20b2['clearZombieChannel'](_0x508b47);}}};Preview[_0x0a9e('0xc')]['recallMe']=function(_0x211ef9){var _0x523cd2=this;rpcDb[_0x0a9e('0x7a')](_0x211ef9['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2da03c){if(!_['isNil'](_0x2da03c)){for(var _0x2f7092=0x0;_0x2f7092<_0x2da03c[_0x0a9e('0x7b')];_0x2f7092+=0x1){if(ut[_0x0a9e('0x7c')](_0x2da03c[_0x2f7092][_0x0a9e('0x7d')])<_0x211ef9[_0x0a9e('0x7e')]*0x3c){if(_0x2da03c[_0x2f7092][_0x0a9e('0x7f')]&&!_0x2da03c[_0x2f7092][_0x0a9e('0x7f')][_0x0a9e('0x80')]){_0x523cd2['run'](_0x2da03c[_0x2f7092]['id'])[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')))[_0x0a9e('0x73')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')));}else{rpcDb['disableContact'](_0x2da03c[_0x2f7092]['id']);}}else{var _0x956fbe=new Action(_0x2da03c[_0x2f7092],_0x211ef9);_0x956fbe[_0x0a9e('0x84')]=moment()['format'](_0x0a9e('0x85'));_0x211ef9['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x86')](_0x956fbe,0x17,'RecallInQueue');if(_0x211ef9['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0a9e('0x87')](_0x2da03c[_0x2f7092]));rpcDb['createCustomerHistory'](_0x956fbe,_0x0a9e('0x88'));}else{ut[_0x0a9e('0x86')](_0x956fbe,0x16,_0x0a9e('0x89'));rpcDb[_0x0a9e('0x8a')](_0x956fbe,_0x0a9e('0x8b'));rpcDb[_0x0a9e('0x8c')](_0x956fbe,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x73')](ut['logger2'](_0x0a9e('0x8d')));};Preview[_0x0a9e('0xc')][_0x0a9e('0x64')]=function(_0x5adf8f){_0x5adf8f[_0x0a9e('0x5a')]=!![];if(ut[_0x0a9e('0x8e')](_0x5adf8f[_0x0a9e('0x8f')])){_0x5adf8f[_0x0a9e('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0a9e('0x90')](_0x5adf8f[_0x0a9e('0x32')])){_0x5adf8f['message']=_0x0a9e('0x91');}else if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x53')])){if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x93')])){_0x5adf8f['message']=_0x0a9e('0x94');}else{_0x5adf8f[_0x0a9e('0x4c')]=_0x0a9e('0x95');}}else{_0x5adf8f['message']=_0x0a9e('0x95');}emitCampaignPreview(_0x5adf8f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x242745,_0x4556c5,_0x9375fb){var _0x19c995=this;var _0x186f39=this[_0x0a9e('0x12')][_0x4556c5];var _0x387489=this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]];var _0x1cc4f3;if(_0x387489){switch(_0x9375fb){case'1':_0x387489[_0x0a9e('0x96')]+=0x1;_0x186f39[_0x0a9e('0x97')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x0,_0x0a9e('0x9a'));ami[_0x0a9e('0x24')](_0x0a9e('0x9b'),ut['buildObj'](_0x186f39,_0x0a9e('0x9c')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0x9d'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,'Global');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xa0'));}else{if(_0x186f39[_0x0a9e('0x97')]>=_0x387489[_0x0a9e('0xa1')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x186f39,_0x0a9e('0x97'),_0x387489[_0x0a9e('0xa2')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];break;case _0x0a9e('0xa6'):var _0x1a0677=moment()['format'](_0x0a9e('0x85'));_0x186f39[_0x0a9e('0xa7')]=_0x1a0677;_0x186f39[_0x0a9e('0xa8')]=_0x1a0677;_0x186f39['dialAnswer']=!![];_0x387489[_0x0a9e('0x2a')]+=0x1;logger['info'](_0x0a9e('0xa9'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],_0x0a9e('0xab'),_0x387489[_0x0a9e('0x2a')]);ami[_0x0a9e('0x24')]('custom:agentconnect',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xad'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));if(_0x387489['acw']){ami[_0x0a9e('0x24')](_0x0a9e('0xae'),ut[_0x0a9e('0xaf')](_0x186f39));}break;case'16':ami[_0x0a9e('0x24')]('custom:agentcomplete',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0')));_0x387489[_0x0a9e('0x36')]+=0x1;_0x387489[_0x0a9e('0x2f')]+=0x1;_0x387489[_0x0a9e('0x28')]+=0x1;ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xb2'));_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x4,'Answer');rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xb3'));rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0xb4')](_0x186f39);_0x387489[_0x0a9e('0x2c')]+=_0x186f39[_0x0a9e('0xb5')];_0x387489[_0x0a9e('0x2b')]+=_0x186f39['talktime'];logger['info'](_0x0a9e('0xb6'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],'pTalking:\x20',_0x387489[_0x0a9e('0x2a')]);delete this[_0x0a9e('0x12')][_0x242745['linkedid']];break;case _0x0a9e('0xb7'):_0x387489[_0x0a9e('0x38')]+=0x1;_0x186f39[_0x0a9e('0xb8')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x5,_0x0a9e('0xb9'));ami['emit'](_0x0a9e('0xba'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xbd'));}else{if(_0x186f39[_0x0a9e('0xb8')]>=_0x387489[_0x0a9e('0xbe')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xb8'),_0x387489[_0x0a9e('0xc0')]),_0x186f39['unlockAgent'],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc1'):_0x387489['outboundNoAnswerCallsDay']+=0x1;_0x186f39['countnoanswerretry']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut['logCustomer'](_0x186f39,0x3,'NoAnswer');ami[_0x0a9e('0x24')](_0x0a9e('0xc2'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xc3')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xc4'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xc5'));}else{if(_0x186f39[_0x0a9e('0xc6')]>=_0x387489['dialNoAnswerMaxRetry']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xc4'));}else{rpcDb[_0x0a9e('0xc7')](ut['scheduledAt'](_0x186f39,_0x0a9e('0xc6'),_0x387489[_0x0a9e('0xc8')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc9'):_0x387489[_0x0a9e('0x39')]+=0x1;_0x186f39[_0x0a9e('0xca')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x8,_0x0a9e('0xcb'));ami['emit'](_0x0a9e('0xcc'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xcd')));rpcDb['createCustomerHistory'](_0x186f39,_0x0a9e('0xce'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xcf'));}else{if(_0x186f39[_0x0a9e('0xca')]>=_0x387489[_0x0a9e('0xd0')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xca'),_0x387489[_0x0a9e('0xc0')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xd1'):_0x387489[_0x0a9e('0x40')]+=0x1;_0x186f39[_0x0a9e('0xd2')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x14,_0x0a9e('0xd3'));ami['emit'](_0x0a9e('0xd4'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xd5')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xd6'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0x14,'AgentReject');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x186f39[_0x0a9e('0xd2')]>=_0x387489[_0x0a9e('0xd7')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,'countagentrejectretry',_0x387489[_0x0a9e('0xd9')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39['activeContact']);}}break;case _0x0a9e('0xda'):_0x387489[_0x0a9e('0xdb')]+=0x1;_0x186f39[_0x0a9e('0xdc')]+=0x1;_0x186f39['countglobal']=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xb,_0x0a9e('0xdd'));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xde'));if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x186f39[_0x0a9e('0xdf')]>=_0x387489['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xde'));}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xdc'),_0x387489['dialAbandonedRetryFrequency']),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;default:if(_0x186f39[_0x0a9e('0x76')]){ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xe0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x387489[_0x0a9e('0x26')],_0x242745);}_0x387489['outboundUnknownCallsDay']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xc,_0x242745[_0x0a9e('0xe1')]||_0x242745[_0x0a9e('0xe2')]);rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xe3'));}else{rpcDb['createCustomerFinal'](_0x186f39,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];}if(!(_0x186f39['dialAnswer']&&_0x9375fb==='16')){ut[_0x0a9e('0x74')](_0x387489,_0x0a9e('0xe4'));logger[_0x0a9e('0x56')](_0x0a9e('0xe5'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489['name'],_0x0a9e('0xe6'),_0x387489[_0x0a9e('0x4d')]);}if(_0x9375fb!==_0x0a9e('0xa6')){delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];delete this['actions'][_0x242745[_0x0a9e('0xe7')]];}}};Preview[_0x0a9e('0xc')]['callProgressDetectingAgent']=function(_0x3c313d,_0x19fd11,_0xcacabb){if(_[_0x0a9e('0xe8')](_0x19fd11)&&_0x0a9e('0xe9')!==typeof _0x19fd11){return;}if(_[_0x0a9e('0xe8')](_0xcacabb)&&_0x0a9e('0xe9')!==typeof _0xcacabb){return;}switch(_0xcacabb[_0x0a9e('0xea')]){case'0':ut[_0x0a9e('0xeb')](_0x3c313d,0x0,_0x0a9e('0x9a'));rpcDb['createAgentHistory'](_0x3c313d,_0x0a9e('0xec'));break;case'3':ut[_0x0a9e('0xeb')](_0x3c313d,0x3,_0x0a9e('0xed'));rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xef'));break;case'5':ut['logAgent'](_0x3c313d,0x5,'Busy');rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xf0'));break;case'8':ut[_0x0a9e('0xeb')](_0x3c313d,0x8,_0x0a9e('0xcb'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xeb')](_0x3c313d,0x16,_0x0a9e('0xf1'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0a9e('0xeb')](_0x3c313d,0xc,_0xcacabb['reason']);rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a9e('0x74')](_0x19fd11,_0x0a9e('0xf2'));logger[_0x0a9e('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x3c313d[_0x0a9e('0xaa')],'\x20Queue',_0x19fd11[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x19fd11[_0x0a9e('0x4d')]);delete this[_0x0a9e('0x12')][_0x3c313d[_0x0a9e('0xaa')]];};Preview[_0x0a9e('0xc')][_0x0a9e('0xf3')]=function(_0xe89aaa,_0x2aaf07,_0x27d1f5,_0x4262d0,_0xc876d4){var _0x2415fe=this;return new BPromise(function(_0x399def,_0x98c62c){if(_[_0x0a9e('0x67')](_0x2aaf07)||_['isNil'](_0x2aaf07['Contact'])||_[_0x0a9e('0x67')](_0x2aaf07['Contact'][_0x0a9e('0xf4')])||_[_0x0a9e('0x67')](_0x2aaf07['VoiceQueueId'])){_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0xf5'),_0x4262d0,_0xc876d4));return;}var _0x387bbe=uuid['v4']();var _0x18adc8=_0x2415fe['campaignsPreview'][_0x2aaf07[_0x0a9e('0x69')][_0x0a9e('0x26')]];var _0x374f0b=_0x27d1f5?_0x2415fe[_0x0a9e('0x13')][_0x27d1f5]['id']:undefined;_0x2415fe['actions'][_0x387bbe]=new Action(_0x2aaf07,_0x18adc8,_0x387bbe,_0x27d1f5,_0x374f0b);var _0x19e9ed=_0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x19e9ed[_0x0a9e('0xa3')]=_0x4262d0;_0x19e9ed['activeContact']=_0xc876d4;_0x19e9ed[_0x0a9e('0xf6')]=_0x27d1f5;if(_[_0x0a9e('0xf7')](_0xe89aaa)){_0x2415fe[_0x0a9e('0xf8')](_0x19e9ed,_0x18adc8,_0x2aaf07,_0x27d1f5)['then'](function(_0x303f75){logger[_0x0a9e('0x56')](_0x0a9e('0xf9'),_0x0a9e('0xfa')+_0x19e9ed[_0x0a9e('0x6a')]+'\x20IdHopper:\x20'+_0x19e9ed[_0x0a9e('0xfb')],JSON[_0x0a9e('0x55')](_0x303f75));ami['emit'](_0x0a9e('0xfc'),ut[_0x0a9e('0xac')](_0x19e9ed,_0x0a9e('0xfd'),_0x2415fe['campaignsPreview'][_0x19e9ed['queue']]));_0x399def(ut['message'](_0x0a9e('0xfe')));})[_0x0a9e('0x73')](function(_0x55f91a){ut[_0x0a9e('0x5c')](_0x0a9e('0xff'),_0x55f91a);_0x98c62c(ut[_0x0a9e('0x4c')]('Call\x20failed',_0x4262d0,_0xc876d4));});}else{_0x18adc8[_0x0a9e('0x37')]+=0x1;ut[_0x0a9e('0x100')](_0x19e9ed);rpcDb[_0x0a9e('0x101')](_0x19e9ed,_0x0a9e('0x102'));delete _0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0x103'),_0x4262d0,_0xc876d4));}});};Preview[_0x0a9e('0xc')][_0x0a9e('0x92')]=function(_0x5a1848){return!_[_0x0a9e('0x67')](_0x5a1848)&&!_['isNil'](_0x5a1848[_0x0a9e('0x26')])&&!_[_0x0a9e('0x67')](_0x5a1848[_0x0a9e('0x104')])&&_0x5a1848[_0x0a9e('0x104')]&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])])&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')])&&(this[_0x0a9e('0x11')][util[_0x0a9e('0x106')](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x107')||this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x108'));};Preview[_0x0a9e('0xc')][_0x0a9e('0x109')]=function(_0x2895c5,_0x20ae21){var _0x566b90=this;return new BPromise(function(_0x3b581c,_0xd2391){_0x566b90[_0x0a9e('0x10a')](_0x2895c5,_0x20ae21)['then'](function(_0x1402c7){_0x3b581c(_[_0x0a9e('0x6b')](_0x1402c7,[_0x0a9e('0x4c')]));})[_0x0a9e('0x73')](function(_0x370b5e){if(_0x370b5e[_0x0a9e('0x10b')]){rpcDb[_0x0a9e('0x10c')](_0x2895c5);}if(_0x370b5e[_0x0a9e('0x104')]){rpcDb[_0x0a9e('0x10d')](_0x2895c5);}_0xd2391(_[_0x0a9e('0x6b')](_0x370b5e,['message']));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10a')]=function(_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new BPromise(function(_0x3942fd,_0x5cb48d){var _0x382687,_0x4f854b;rpcDb['getContactPreview'](_0x15a9ed)['then'](function(_0x19e4e6){if(!_[_0x0a9e('0x67')](_0x19e4e6[0x0])){_0x4f854b=_0x19e4e6[0x0][_0x0a9e('0x10e')]?![]:!![];_0x382687=_0x19e4e6[0x0][_0x0a9e('0x10e')]?!![]:![];_0x382687=_0x3db98f?!![]:_0x382687;}var _0x4d99a8=_0x2b624e[_0x0a9e('0x10f')](_0x19e4e6);if(_0x4d99a8[_0x0a9e('0x110')]){rpcDb[_0x0a9e('0x111')](_[_0x0a9e('0x6b')](_0x19e4e6[0x0],[_0x0a9e('0x6e'),'Contact.phone']))['then'](function(_0x9484c8){_0x2b624e[_0x0a9e('0xf3')](_0x9484c8,_0x19e4e6[0x0],_0x3db98f,_0x4f854b,_0x382687)[_0x0a9e('0x81')](function(_0x5e85d0){_0x3942fd(_0x5e85d0);})[_0x0a9e('0x73')](function(_0x248a9a){_0x5cb48d(_0x248a9a);});})[_0x0a9e('0x73')](function(_0x4cee8c){ut[_0x0a9e('0x5c')](_0x0a9e('0x112'),_0x4cee8c);_0x5cb48d(ut[_0x0a9e('0x4c')]('Call\x20unsuccessful',_0x4f854b,_0x382687));});}else{_0x5cb48d(ut[_0x0a9e('0x4c')](_0x4d99a8[_0x0a9e('0x4c')],_0x4f854b,_0x382687));}})[_0x0a9e('0x73')](function(_0x549e03){ut['logger']('[Preview][getContactPreview]',_0x549e03);_0x5cb48d(ut[_0x0a9e('0x4c')](_0x0a9e('0x113'),![],!![]));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10f')]=function(_0x5d83fd){if(_[_0x0a9e('0x67')](_0x5d83fd)||_['isEmpty'](_0x5d83fd)||!_[_0x0a9e('0x67')](_0x5d83fd[0x0][_0x0a9e('0x7f')])&&_[_0x0a9e('0x67')](_0x5d83fd[0x0]['Agent'][_0x0a9e('0x26')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x114'),_0x5d83fd);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x40eb5d=this['campaignsPreview'][_0x5d83fd[0x0][_0x0a9e('0x69')]['name']];_0x40eb5d[_0x0a9e('0x4c')]='ACTIVE';if(_[_0x0a9e('0x67')](_0x40eb5d)){ut[_0x0a9e('0x5c')](_0x0a9e('0x115'),_0x40eb5d);return{'isValid':![],'message':_0x0a9e('0x116')};}if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x53')])){ut[_0x0a9e('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x93')])){ut['logger'](_0x0a9e('0x118'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x119'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x0a9e('0x90')](_0x40eb5d[_0x0a9e('0x32')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x11a'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b'));return{'isValid':![],'message':_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b')};}return{'isValid':!![],'message':_0x0a9e('0x11c')};};Preview['prototype'][_0x0a9e('0xf8')]=function(_0x53c7de,_0x3c9854,_0x2968e2,_0x5b9c76){var _0x315e31=this;return new BPromise(function(_0x5d577b,_0x2d45db){var _0x5691ac=_0x53c7de[_0x0a9e('0xaa')];var _0x469035=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?util[_0x0a9e('0x106')](_0x0a9e('0x11d'),_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x35')])?'':_0x3c9854[_0x0a9e('0x35')]['trim']()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')]):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')]:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854['dialPrefix'])?'':_0x3c9854[_0x0a9e('0x35')][_0x0a9e('0x121')]()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2['Contact'][_0x0a9e('0xf4')]);var _0x294310=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?ut[_0x0a9e('0x122')](_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x125')](_0x3c9854[_0x0a9e('0x34')],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]):ut[_0x0a9e('0x122')](_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')]['callerid']:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854[_0x0a9e('0x126')]>0x0?ut['getCallerIdRandom'](_0x3c9854['dialOriginateCallerIdNumber'],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]);if(_0x294310){_0x53c7de[_0x0a9e('0x127')]=ut['extractCalleridName'](_0x294310);_0x53c7de[_0x0a9e('0x128')]=ut[_0x0a9e('0x129')](_0x294310);}var _0x4d8a67=ut[_0x0a9e('0x12a')](_0x3c9854,_0x2968e2,_0x469035,_0x294310,_0x5691ac,_0x53c7de);_['merge'](_0x53c7de,ut[_0x0a9e('0x12b')](_0x4d8a67));_0x53c7de['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x70')](ut[_0x0a9e('0x12c')](_0x53c7de,_0x3c9854,_0x4d8a67,_0x53c7de[_0x0a9e('0xa4')],_0x5b9c76))[_0x0a9e('0x81')](function(_0x7d59a9){_0x3c9854[_0x0a9e('0x4d')]+=0x1;logger['info'](_0x0a9e('0x12d'),_0x5691ac,_0x0a9e('0x12e'),_0x3c9854[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x3c9854[_0x0a9e('0x4d')]);_0x5d577b(_0x7d59a9);})[_0x0a9e('0x73')](function(_0x31c937){ut['logAgent'](_0x53c7de,0xe,'OriginateError');rpcDb[_0x0a9e('0xee')](_0x53c7de,'[originateFailure][logOriginateFailure]');_0x2d45db(_0x31c937);});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x1c')]=function(_0x1f0318){if(this[_0x0a9e('0x12')][_0x1f0318[_0x0a9e('0xa5')]]){this[_0x0a9e('0x12')][_0x1f0318['linkedid']][_0x0a9e('0x72')]=_0x1f0318['channel'];}};Preview['prototype'][_0x0a9e('0x16')]=function(_0x593f9e){var _0x38dceb=this;var _0x5dc978=this['actions'][_0x593f9e[_0x0a9e('0x12f')]];if(_0x5dc978){if(_0x5dc978['lookAgent']&&this[_0x0a9e('0x13')][_0x5dc978[_0x0a9e('0xf6')]]){ut[_0x0a9e('0x130')](_0x5dc978,this['agents'][_0x5dc978[_0x0a9e('0xf6')]][_0x0a9e('0x26')],this[_0x0a9e('0x13')][_0x5dc978['lookAgent']]['id']);}var _0x5236c9=_[_0x0a9e('0x131')](_0x5dc978);_0x5236c9[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));var _0x3b0db2=_0x38dceb[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]];if(ut[_0x0a9e('0x132')](_0x593f9e[_0x0a9e('0x133')])){if(_0x5dc978[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x5dc978['idContact']);}if(_0x5dc978['activeContact']){rpcDb[_0x0a9e('0x10d')](_0x5dc978[_0x0a9e('0xfb')]);}ami[_0x0a9e('0x24')](_0x0a9e('0x134'),ut[_0x0a9e('0xac')](_0x5dc978,_0x0a9e('0x135'),this[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]]));this['callProgressDetectingAgent'](_0x5236c9,_0x3b0db2,_0x593f9e);}else{_0x5dc978['starttime']=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));ut['logAgent'](_0x5236c9,0x4,_0x0a9e('0x136'));rpcDb[_0x0a9e('0xee')](_0x5236c9,_0x0a9e('0x137'));}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x19')]=function(_0x2683ad){var _0x167196=this;var _0x262281=this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]];var _0xbd1af3;if(_0x262281){_0xbd1af3=this[_0x0a9e('0xf')][_0x262281['queue']];logger[_0x0a9e('0x56')](_0x0a9e('0x138'),_0x2683ad[_0x0a9e('0xa5')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);}if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]]&&_0x2683ad[_0x0a9e('0xa5')]!==_0x2683ad[_0x0a9e('0xaa')]){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad['linkedid']][_0x0a9e('0x76')]){this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger['info'](_0x0a9e('0x13b'),_0x2683ad['linkedid'],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}else if(_0x262281&&_[_0x0a9e('0x67')](_0x262281[_0x0a9e('0x13c')])&&_0xbd1af3[_0x0a9e('0x13d')]&&_0x2683ad[_0x0a9e('0xa5')]===_0x2683ad[_0x0a9e('0xaa')]&&_[_0x0a9e('0x67')](_0x2683ad[_0x0a9e('0xea')])&&_0x2683ad[_0x0a9e('0x139')]==='16'&&_0x2683ad['channelstate']==='6'&&_['isUndefined'](_0x262281[_0x0a9e('0x13e')])){if(_0x262281[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x262281['idContact']);}if(_0x262281[_0x0a9e('0xa4')]){rpcDb[_0x0a9e('0x10d')](_0x262281[_0x0a9e('0xfb')]);}_0x2683ad['reason']='22';this[_0x0a9e('0x13f')](_0x262281,_0xbd1af3,_0x2683ad);}else if(_0x262281&&_0x262281['transfer']){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad[_0x0a9e('0xa5')]]['dialAnswer']){logger[_0x0a9e('0x56')](_0x0a9e('0x140'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad['cause'],_0x0a9e('0x12e'),_0xbd1af3['name'],'pTalking:\x20',_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger[_0x0a9e('0x56')](_0x0a9e('0x13b'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}};Preview[_0x0a9e('0xc')]['syncDialEnd']=function(_0x233e48){if(this[_0x0a9e('0x12')][_0x233e48[_0x0a9e('0xe7')]]&&_0x233e48[_0x0a9e('0xe7')]!==_0x233e48['destuniqueid']){this['callProgressDetectingCustomer'](_0x233e48,_0x233e48['destlinkedid'],_0x233e48[_0x0a9e('0xe2')]);}};Preview['prototype'][_0x0a9e('0x141')]=function(_0x1fafc2){if(this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]]&&_0x1fafc2[_0x0a9e('0xa5')]!==_0x1fafc2[_0x0a9e('0xaa')]&&!this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){if(_0x1fafc2[_0x0a9e('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x1fafc2,_0x1fafc2[_0x0a9e('0xa5')],_0x1fafc2['cause']);}}};Preview[_0x0a9e('0xc')]['addVariable']=function(_0xf4de86,_0x2c5385,_0x216791){if(this['actions'][_0xf4de86]){if(_[_0x0a9e('0x67')](this[_0x0a9e('0x12')][_0xf4de86]['variables'])){this['actions'][_0xf4de86][_0x0a9e('0x142')]={};}this[_0x0a9e('0x12')][_0xf4de86][_0x0a9e('0x142')][_0x2c5385]=_0x216791;}};Preview['prototype']['syncVarSet']=function(_0x4869c1){try{if(!_[_0x0a9e('0x67')](_0x4869c1)){if(ut[_0x0a9e('0x143')](_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0])){this[_0x0a9e('0x146')](_0x4869c1[_0x0a9e('0xaa')],_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0],_0x4869c1[_0x0a9e('0x147')]);}}}catch(_0x18e38b){logger[_0x0a9e('0x148')](_0x0a9e('0x149'),util[_0x0a9e('0x14a')](_0x18e38b,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xc')][_0x0a9e('0x20')]=function(_0x1a74c4){if(_0x1a74c4){if(this[_0x0a9e('0x12')][_0x1a74c4[_0x0a9e('0x14b')]]){this['actions'][_0x1a74c4[_0x0a9e('0x14b')]][_0x0a9e('0x13e')]=!![];}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x22')]=function(_0x4790f7){if(_0x4790f7){if(this[_0x0a9e('0x12')][_0x4790f7['transfererlinkedid']]){this[_0x0a9e('0x12')][_0x4790f7[_0x0a9e('0x14c')]][_0x0a9e('0x13e')]=!![];}}};module[_0x0a9e('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5731f8c..ea7adb4 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 _0x6334=['../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','catch','[createHistory]\x20','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt'];(function(_0x365439,_0x562ef8){var _0x3215b4=function(_0x172f20){while(--_0x172f20){_0x365439['push'](_0x365439['shift']());}};_0x3215b4(++_0x562ef8);}(_0x6334,0x119));var _0x4633=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x6334[_0x21d532];return _0x37bda1;};'use strict';var util=require(_0x4633('0x0'));var BPromise=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var _=require(_0x4633('0x4'));var cmHopper=require(_0x4633('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x4633('0x6'));var cmHopperBlack=require(_0x4633('0x7'));var voiceQueueRt=require(_0x4633('0x8'));var agentReportPreview=require(_0x4633('0x9'));var voiceQueueReport=require(_0x4633('0xa'));function loggerCatch(_0x6493dc){return function(_0x175e14){logger['error'](_0x6493dc,util[_0x4633('0xb')](_0x175e14,{'showHidden':![],'depth':null}));};}function create(_0x56891d){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopperHistory['createHistory'](_0x56891d))[_0x4633('0xe')](loggerCatch(_0x4633('0xf')));}function createAgent(_0x4018ba){return BPromise['resolve']()[_0x4633('0xd')](agentReportPreview[_0x4633('0x10')](_0x4018ba))['catch'](loggerCatch(_0x4633('0xf')));}function moveContact(_0x3d5182){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper['moveContactManagedDialer'](_0x3d5182,!![]))[_0x4633('0xe')](loggerCatch(_0x4633('0x11')));}exports[_0x4633('0x12')]=function(_0x48e92c){return BPromise['resolve']()['then'](cmHopperBlack[_0x4633('0x12')](_0x48e92c))[_0x4633('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x1d967e){return BPromise['resolve']()[_0x4633('0xd')](cmHopper[_0x4633('0x13')](_0x1d967e))[_0x4633('0xe')](loggerCatch(_0x4633('0x14')));};exports['createHistory']=function(_0x2c38e5,_0x15bd98){create(_0x2c38e5)[_0x4633('0xe')](loggerCatch(_0x15bd98));moveContact(_0x2c38e5)['catch'](loggerCatch(_0x15bd98));};exports[_0x4633('0x15')]=function(_0x37e536,_0x1c7186){createAgent(_0x37e536)[_0x4633('0xe')](loggerCatch(_0x1c7186));};exports[_0x4633('0x16')]=function(_0x5953b8,_0x4691f2){create(_0x5953b8)[_0x4633('0xe')](loggerCatch(_0x4691f2));};exports['createCustomerFinal']=function(_0x57e61c,_0x182901){moveContact(_0x57e61c)['catch'](loggerCatch(_0x182901));};exports[_0x4633('0x17')]=function(_0x5b5011,_0x57dfb8,_0x109472){if(_0x57dfb8){_0x5b5011[_0x4633('0x18')]=null;}if(_0x109472){_0x5b5011[_0x4633('0x19')]=![];}return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x17')](_0x5b5011))['catch'](loggerCatch(_0x4633('0x1a')));};exports['countReScheduled']=function(_0x22d9c1){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x1b')](_0x22d9c1))[_0x4633('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x4633('0x1c')]=function(_0x399220){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x1c')]({'UserId':null},_0x399220,0x1))[_0x4633('0xe')](loggerCatch(_0x4633('0x1d')));};exports[_0x4633('0x1e')]=function(_0xef2ecf){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x1c')]({'active':![]},_0xef2ecf,0x1))[_0x4633('0xe')](loggerCatch(_0x4633('0x1f')));};exports[_0x4633('0x20')]=function(_0x3f03aa){var _0x20ca8b={};_0x20ca8b[_0x4633('0x21')]=_0x3f03aa['type'];_0x20ca8b[_0x4633('0x22')]=_0x3f03aa[_0x4633('0x22')];_0x20ca8b[_0x4633('0x23')]=_0x3f03aa[_0x4633('0x23')];_0x20ca8b[_0x4633('0x24')]=_0x3f03aa[_0x4633('0x24')];_0x20ca8b['queue']=_0x3f03aa[_0x4633('0x25')];_0x20ca8b['queuecallerjoinAt']=_0x3f03aa[_0x4633('0x26')];_0x20ca8b[_0x4633('0x27')]=_0x3f03aa[_0x4633('0x26')];_0x20ca8b[_0x4633('0x28')]=0x1;_0x20ca8b[_0x4633('0x29')]=_0x3f03aa[_0x4633('0x2a')];_0x20ca8b[_0x4633('0x2b')]=_0x3f03aa[_0x4633('0x2c')];_0x20ca8b[_0x4633('0x2d')]=_0x4633('0x2e');_0x20ca8b[_0x4633('0x2f')]=_0x4633('0x30');_0x20ca8b[_0x4633('0x31')]=0x0;_0x20ca8b[_0x4633('0x32')]=0x1;_0x20ca8b['lastAssignedTo']=_0x3f03aa['membername'];_0x20ca8b[_0x4633('0x33')]=_0x4633('0x34');return BPromise['resolve']()[_0x4633('0xd')](voiceQueueReport[_0x4633('0x35')](_0x20ca8b))[_0x4633('0xe')](loggerCatch(_0x4633('0x36')));};exports['getContactRecallMe']=function(_0x3f92ef,_0x52322e){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x37')](_0x3f92ef,_0x52322e))[_0x4633('0xe')](loggerCatch(_0x4633('0x38')));};exports[_0x4633('0x39')]=function(_0x15c02e){return BPromise[_0x4633('0xc')]()['then'](cmHopper[_0x4633('0x17')](_0x15c02e,!![],!![]))[_0x4633('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xee14=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','type'];(function(_0x1ba721,_0x46c292){var _0x45fdab=function(_0x13a2a5){while(--_0x13a2a5){_0x1ba721['push'](_0x1ba721['shift']());}};_0x45fdab(++_0x46c292);}(_0xee14,0x13a));var _0x4ee1=function(_0x22fa25,_0x2cf805){_0x22fa25=_0x22fa25-0x0;var _0x3363e1=_0xee14[_0x22fa25];return _0x3363e1;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var _=require(_0x4ee1('0x2'));var cmHopper=require(_0x4ee1('0x3'));var cmHopperFinal=require(_0x4ee1('0x4'));var cmHopperHistory=require(_0x4ee1('0x5'));var cmHopperBlack=require(_0x4ee1('0x6'));var voiceQueueRt=require(_0x4ee1('0x7'));var agentReportPreview=require(_0x4ee1('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xba6d36){return function(_0x573700){logger[_0x4ee1('0x9')](_0xba6d36,util[_0x4ee1('0xa')](_0x573700,{'showHidden':![],'depth':null}));};}function create(_0x187656){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperHistory[_0x4ee1('0xd')](_0x187656))['catch'](loggerCatch(_0x4ee1('0xe')));}function createAgent(_0x38be25){return BPromise['resolve']()[_0x4ee1('0xc')](agentReportPreview[_0x4ee1('0xd')](_0x38be25))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0xe')));}function moveContact(_0x5cbcb0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x10')](_0x5cbcb0,!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x11')));}exports[_0x4ee1('0x12')]=function(_0x5616d6){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperBlack[_0x4ee1('0x12')](_0x5616d6))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x13')));};exports[_0x4ee1('0x14')]=function(_0x2ffb2d){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactPreview'](_0x2ffb2d))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x15')));};exports[_0x4ee1('0xd')]=function(_0x1b1e0e,_0x123c5e){create(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));moveContact(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));};exports[_0x4ee1('0x16')]=function(_0x360056,_0x3a0967){createAgent(_0x360056)[_0x4ee1('0xf')](loggerCatch(_0x3a0967));};exports['createCustomerHistory']=function(_0x236215,_0x3db827){create(_0x236215)[_0x4ee1('0xf')](loggerCatch(_0x3db827));};exports[_0x4ee1('0x17')]=function(_0x43f9a2,_0x383ab0){moveContact(_0x43f9a2)['catch'](loggerCatch(_0x383ab0));};exports[_0x4ee1('0x18')]=function(_0x333e96,_0x46611a,_0x3f0d59){if(_0x46611a){_0x333e96[_0x4ee1('0x19')]=null;}if(_0x3f0d59){_0x333e96[_0x4ee1('0x1a')]=![];}return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x333e96))[_0x4ee1('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x14110c){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1b')](_0x14110c))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1c')));};exports['unlockContact']=function(_0x5cc0b5){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['unlockContact']({'UserId':null},_0x5cc0b5,0x1))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1d')));};exports[_0x4ee1('0x1e')]=function(_0x215949){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1f')]({'active':![]},_0x215949,0x1))['catch'](loggerCatch(_0x4ee1('0x20')));};exports['crateCustomerReportQueue']=function(_0x4746c2){var _0x4ec408={};_0x4ec408[_0x4ee1('0x21')]=_0x4746c2[_0x4ee1('0x21')];_0x4ec408[_0x4ee1('0x22')]=_0x4746c2[_0x4ee1('0x22')];_0x4ec408[_0x4ee1('0x23')]=_0x4746c2['calleridnum'];_0x4ec408[_0x4ee1('0x24')]=_0x4746c2['calleridname'];_0x4ec408[_0x4ee1('0x25')]=_0x4746c2[_0x4ee1('0x25')];_0x4ec408[_0x4ee1('0x26')]=_0x4746c2[_0x4ee1('0x27')];_0x4ec408[_0x4ee1('0x28')]=_0x4746c2['answertime'];_0x4ec408[_0x4ee1('0x29')]=0x1;_0x4ec408[_0x4ee1('0x2a')]=_0x4746c2[_0x4ee1('0x2b')];_0x4ec408[_0x4ee1('0x2c')]=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x2e')]='from-sip';_0x4ec408['exten']=_0x4ee1('0x2f');_0x4ec408[_0x4ee1('0x30')]=0x0;_0x4ec408[_0x4ee1('0x31')]=0x1;_0x4ec408['lastAssignedTo']=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x32')]=_0x4ee1('0x33');return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](voiceQueueReport[_0x4ee1('0x34')](_0x4ec408))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x35')));};exports[_0x4ee1('0x36')]=function(_0x3cc595,_0x4445d0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactRecallMe'](_0x3cc595,_0x4445d0))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x37')));};exports[_0x4ee1('0x38')]=function(_0x50539f){return BPromise['resolve']()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x50539f,!![],!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x39')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index a83db96..c978fc6 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 _0x9bfa=['xmd-callerid','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','updatedAt','%s%s','XMD-','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','starttime','responsetime','endtime','state','statedesc','membername','logCustomer','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','not_inuse','status','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callback','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype'];(function(_0x2d7226,_0x35edb1){var _0x59b03f=function(_0x45c59a){while(--_0x45c59a){_0x2d7226['push'](_0x2d7226['shift']());}};_0x59b03f(++_0x35edb1);}(_0x9bfa,0x1a0));var _0xa9bf=function(_0x1e2b28,_0x3f8e73){_0x1e2b28=_0x1e2b28-0x0;var _0x3c64dd=_0x9bfa[_0x1e2b28];return _0x3c64dd;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa9bf('0x0'));var logger=require(_0xa9bf('0x1'))('preview');var ipAgi=process[_0xa9bf('0x2')][_0xa9bf('0x3')]||_0xa9bf('0x4');function getSeconds(_0x37ace3,_0x56e3f8){var _0x1c1b33=moment(_0x37ace3)[_0xa9bf('0x5')](0x0);var _0x487611=moment(_0x56e3f8)[_0xa9bf('0x5')](0x0);return _0x1c1b33[_0xa9bf('0x6')](_0x487611,_0xa9bf('0x7'));}exports[_0xa9bf('0x8')]=function(_0x80cb57){return function(_0x346459){logger[_0xa9bf('0x9')](_0x80cb57,util[_0xa9bf('0xa')](_0x346459,{'showHidden':![],'depth':null}));};};exports[_0xa9bf('0xb')]=function(_0x375527,_0x413a73){logger[_0xa9bf('0xc')](_0x375527,util['inspect'](_0x413a73,{'showHidden':![],'depth':null}));};exports[_0xa9bf('0xd')]=function(_0x48d703,_0x4a148e){logger[_0xa9bf('0x9')](_0x48d703,util[_0xa9bf('0xa')](_0x4a148e,{'showHidden':![],'depth':null}));};exports[_0xa9bf('0xe')]=function(_0x2d4ff7){return function(_0xf74f8){logger[_0xa9bf('0xc')](_0x2d4ff7,util['inspect'](_0xf74f8,{'showHidden':![],'depth':null}));};};exports[_0xa9bf('0xf')]=function(_0x40df88,_0x179000,_0x303172){return{'message':_0x40df88,'unlock':_0x179000,'active':_0x303172};};exports[_0xa9bf('0x10')]=function(_0x156950,_0xa0f9f,_0x3f4cf3){if(!_[_0xa9bf('0x11')](_0x3f4cf3)&&_0xa9bf('0x12')===typeof _0x3f4cf3&&!_['isEmpty'](_0x3f4cf3)){if(!_[_0xa9bf('0x11')](_0xa0f9f)&&_0xa9bf('0x12')===typeof _0xa0f9f&&!_[_0xa9bf('0x13')](_0xa0f9f)){return util[_0xa9bf('0x14')](_0xa9bf('0x15'),_0xa0f9f,_0x3f4cf3);}return util[_0xa9bf('0x14')](_0xa9bf('0x15'),_0x3f4cf3,_0x3f4cf3);}if(!_[_0xa9bf('0x11')](_0x156950)&&_0xa9bf('0x12')===typeof _0x156950&&!_[_0xa9bf('0x13')](_0x156950)){return _0x156950;}return _0xa9bf('0x16');};exports[_0xa9bf('0x17')]=function(_0xa7b87f){if(_['isNil'](_0xa7b87f)){return![];}return _0xa7b87f;};exports[_0xa9bf('0x18')]=function(_0x1064b8,_0x765dc7,_0xfe2092,_0x5dcc5b,_0x22afca,_0x2b4849){var _0x3f8f83={'XMD-QUEUE':_0x765dc7[_0xa9bf('0x19')]?_0x765dc7[_0xa9bf('0x19')][_0xa9bf('0x1a')]:'','XMD-CALLERID':_0x5dcc5b,'XMD-CALLERID-PREVIEW':_0x2b4849?util[_0xa9bf('0x14')](_0xa9bf('0x15'),_0x2b4849[_0xa9bf('0x1b')],_0x2b4849[_0xa9bf('0x1c')]):_0x5dcc5b,'XMD-DIALID':_0x22afca,'XMD-CONTACTID':_0x765dc7[_0xa9bf('0x1d')],'XMD-CDRTYPE':_0xa9bf('0x1e'),'CALLERID(all)':_0x5dcc5b,'XMD-VOICEQUEUEID':_0x765dc7[_0xa9bf('0x1f')],'XMD-DIALCHANNEL':_0xfe2092,'XMD-DIALTIMEOUT':_0x1064b8[_0xa9bf('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xa9bf('0x14')](_0xa9bf('0x21'),_0x1064b8['dialQueueProject2']?'g':'',_[_0xa9bf('0x13')](_0x1064b8[_0xa9bf('0x22')])?'':_0xa9bf('0x23')),'XMD-DIALURL':_0x1064b8['dialPreviewUrl']||'','XMD-AGI':_0x1064b8[_0xa9bf('0x24')]?util[_0xa9bf('0x14')](_0xa9bf('0x25'),ipAgi,_0x1064b8[_0xa9bf('0x24')]):_0xa9bf('0x26'),'XMD-AGIAFTER':_0x1064b8['dialQueueProject2']?util[_0xa9bf('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1064b8['dialQueueProject2']):_0xa9bf('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x2b4849?_0x2b4849[_0xa9bf('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x2b4849?_0x2b4849[_0xa9bf('0x28')]:'','XMD-DESTINATION':_0xa9bf('0x29')};if(!_[_0xa9bf('0x13')](_0x1064b8[_0xa9bf('0x22')])){_0x3f8f83[util[_0xa9bf('0x14')]('%s',_0xa9bf('0x2a'))]=_0x1064b8[_0xa9bf('0x22')];_0x3f8f83[util[_0xa9bf('0x14')]('%s',_0xa9bf('0x2b'))]=_0x22afca;}if(_0x765dc7&&_0x765dc7[_0xa9bf('0x2c')]){for(var _0x2b6c48 in _0x765dc7[_0xa9bf('0x2c')]){if(_0x765dc7[_0xa9bf('0x2c')]['hasOwnProperty'](_0x2b6c48)){if(!_[_0xa9bf('0x2d')](_0x765dc7[_0xa9bf('0x2c')][_0x2b6c48])&&_0x2b6c48!=='id'&&_0x2b6c48!=='tags'&&_0x2b6c48!=='createdAt'&&_0x2b6c48!==_0xa9bf('0x2e')){_0x3f8f83[util['format'](_0xa9bf('0x2f'),_0xa9bf('0x30'),_['toUpper'](_0x2b6c48))]=_0x765dc7[_0xa9bf('0x2c')][_0x2b6c48];}}}}return _0x3f8f83;};exports[_0xa9bf('0x31')]=function(_0x24bdce){var _0x1ccff5={};for(var _0x252d68 in _0x24bdce){if(_0x24bdce[_0xa9bf('0x32')](_0x252d68)){_0x1ccff5[util[_0xa9bf('0x14')]('%s',_['toLower'](_0x252d68))]=_0x24bdce[_0x252d68];}}return{'variables':_0x1ccff5};};exports['updateOriginated']=function(_0x445812,_0x4ca62f){if(!_[_0xa9bf('0x2d')](_0x445812)){if(_0x445812[_0xa9bf('0x32')](_0xa9bf('0x33'))){if(_0x445812[_0xa9bf('0x33')]>0x0){_0x445812[_0xa9bf('0x33')]-=0x1;}else{logger[_0xa9bf('0x9')](_0xa9bf('0x34'),_0x4ca62f);}}}else{logger[_0xa9bf('0x9')](_0xa9bf('0x35'),_0x4ca62f);}};exports[_0xa9bf('0x36')]=function(_0x14c18a){var _0x5c98dd=moment()[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x14c18a['state']=0xd;_0x14c18a['statedesc']='Blacklist';_0x14c18a[_0xa9bf('0x38')]=_0x5c98dd;_0x14c18a[_0xa9bf('0x39')]=_0x5c98dd;_0x14c18a[_0xa9bf('0x3a')]=_0x5c98dd;};exports['logAgent']=function(_0x39e111,_0x2213f3,_0x1c91cd){var _0x18f427=moment()[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x39e111[_0xa9bf('0x3b')]=_0x2213f3;_0x39e111[_0xa9bf('0x3c')]=_0x1c91cd;_0x39e111[_0xa9bf('0x39')]=_0x18f427;_0x39e111['ringtime']=getSeconds(_0x39e111['responsetime'],_0x39e111['starttime']);};exports['logLookAgent']=function(_0x316aba,_0x239819,_0x26993e){_0x316aba[_0xa9bf('0x3d')]=_0x239819;_0x316aba['UserId']=_0x26993e;};exports[_0xa9bf('0x3e')]=function(_0x16a68e,_0x41db27,_0x5904f0){var _0x653ba7=moment()[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x16a68e[_0xa9bf('0x3b')]=_0x41db27;_0x16a68e['statedesc']=_0x5904f0;_0x16a68e[_0xa9bf('0x39')]=_0x16a68e[_0xa9bf('0x39')]?_0x16a68e[_0xa9bf('0x39')]:_0x653ba7;_0x16a68e[_0xa9bf('0x3a')]=_0x16a68e[_0xa9bf('0x3a')]?_0x16a68e['endtime']:_0x653ba7;_0x16a68e[_0xa9bf('0x3f')]=getSeconds(_0x16a68e[_0xa9bf('0x39')]||0x0,_0x16a68e[_0xa9bf('0x38')]||0x0);_0x16a68e[_0xa9bf('0x40')]=_0x16a68e[_0xa9bf('0x41')]?getSeconds(_0x16a68e[_0xa9bf('0x3a')],_0x16a68e['answertime']):0x0;};exports[_0xa9bf('0x42')]=function(_0x1798c8){return _0x1798c8==='Failure';};exports[_0xa9bf('0x43')]=function(_0x1e7cbb,_0x5bef74,_0x15ff60,_0x1e87a3,_0x26ff72){var _0x24b4b1=_0x1e87a3?_0xa9bf('0x44'):_0x1e7cbb['calleridname'];_0x24b4b1=_0x26ff72?_0xa9bf('0x45'):_0x24b4b1;return{'actionid':_0x1e7cbb['uniqueid'],'action':_0xa9bf('0x46'),'channel':_0x1e7cbb[_0xa9bf('0x47')],'callerid':util['format'](_0xa9bf('0x15'),_0x24b4b1,_0x1e7cbb[_0xa9bf('0x1c')]),'Exten':_0xa9bf('0x29'),'Context':_0xa9bf('0x48'),'Priority':'1','variable':_0x15ff60,'timeout':(_0x5bef74['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1e7cbb[_0xa9bf('0x49')]};};exports['totalGlobal']=function(_0x386a15){return _0x386a15[_0xa9bf('0x4a')]+_0x386a15[_0xa9bf('0x4b')]+_0x386a15[_0xa9bf('0x4c')]+_0x386a15['countagentrejectretry']+_0x386a15[_0xa9bf('0x4d')];};exports[_0xa9bf('0x4e')]=function(_0x41bc41){var _0x6c8cc=_[_0xa9bf('0x4f')](_0x41bc41);_0x6c8cc[_0xa9bf('0x3b')]=0xf;_0x6c8cc[_0xa9bf('0x3c')]='Global';return _0x6c8cc;};exports[_0xa9bf('0x50')]=function(_0x7cc70a,_0xf18ce1,_0xbd574d){var _0x69fbe3={};_0x69fbe3[_0xf18ce1]=_0x7cc70a[_0xf18ce1];_0x69fbe3[_0xa9bf('0x51')]=![];_0x69fbe3[_0xa9bf('0x52')]=moment()['add'](_0xbd574d,'minutes')[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x69fbe3[_0xa9bf('0x1d')]=_0x7cc70a[_0xa9bf('0x1d')];_0x69fbe3[_0xa9bf('0x53')]=_0x7cc70a[_0xa9bf('0x53')];_0x69fbe3['VoiceQueueId']=_0x7cc70a[_0xa9bf('0x1f')]||undefined;return _0x69fbe3;};exports[_0xa9bf('0x54')]=function(_0x1dd11b,_0x228daf){if(!_['isNil'](_0x1dd11b)){if(_0x1dd11b[_0xa9bf('0x55')]>0x0){_0x1dd11b[_0xa9bf('0x55')]-=0x1;}else{logger['error'](_0x228daf,_0xa9bf('0x56'));}}else{logger[_0xa9bf('0x9')](_0x228daf,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xa9bf('0x57')]=function(_0xc39221){if(_0xc39221<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2720a8,_0x145138,_0x43c8a0){_0x2720a8[_0xa9bf('0x58')]=_0x145138;_0x2720a8[_0xa9bf('0x1a')]=_0x2720a8[_0xa9bf('0x59')];_0x2720a8[_0xa9bf('0x5a')]=_0x2720a8['channelAgent'];if(_0x43c8a0){_0x2720a8[_0xa9bf('0x5b')]=_0x43c8a0['mandatoryDisposition'];}return _0x2720a8;};exports['buildAcw']=function(_0x3487ff){var _0x19a5d6={};_0x19a5d6[_0xa9bf('0x59')]=_0x3487ff['queue'];_0x19a5d6[_0xa9bf('0x5a')]=_0x3487ff['channelAgent'];_0x19a5d6['uniqueid']=_0x3487ff[_0xa9bf('0x49')];return _0x19a5d6;};exports['agentReadyId']=function(_0x13e78f){var _0x48b047=[];for(var _0x404e67 in _0x13e78f){if(_0x13e78f['hasOwnProperty'](_0x404e67)){if(!_[_0xa9bf('0x2d')](_0x13e78f[_0x404e67])&&_0x13e78f[_0x404e67][_0xa9bf('0x3b')]===_0xa9bf('0x5c')&&_0x13e78f[_0x404e67][_0xa9bf('0x5d')]==='reachable'){_0x48b047[_0xa9bf('0x5e')](_0x13e78f[_0x404e67]['id']);}}}return _0x48b047;};exports[_0xa9bf('0x5f')]=function(_0x366ecb){var _0x38fd05=moment()[_0xa9bf('0x5')](0x0);var _0x5ce0b4=moment(_0x366ecb)[_0xa9bf('0x5')](0x0);return _0x38fd05[_0xa9bf('0x6')](_0x5ce0b4,_0xa9bf('0x7'));};exports['createBody']=function(_0x49edde){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x49edde[_0xa9bf('0x1d')],'ListId':_0x49edde[_0xa9bf('0x53')],'VoiceQueueId':_0x49edde['VoiceQueueId']||undefined,'CampaignId':_0x49edde[_0xa9bf('0x60')]||undefined};};exports[_0xa9bf('0x61')]=function(_0xab517d){if(_0xab517d===_0xa9bf('0x49')||_0xab517d===_0xa9bf('0x62')||_0xab517d===_0xa9bf('0x59')||_0xab517d===_0xa9bf('0x63')||_0xab517d===_0xa9bf('0x64')||_0xab517d===_0xa9bf('0x65')||_0xab517d===_0xa9bf('0x3d')||_0xab517d==='channelAgent'||_0xab517d===_0xa9bf('0x1b')||_0xab517d===_0xa9bf('0x51')||_0xab517d===_0xa9bf('0x1c')||_0xab517d===_0xa9bf('0x52')||_0xab517d===_0xa9bf('0x4a')||_0xab517d===_0xa9bf('0x4b')||_0xab517d===_0xa9bf('0x4c')||_0xab517d==='countglobal'||_0xab517d===_0xa9bf('0x66')||_0xab517d==='callbackuniqueid'||_0xab517d==='callbackat'||_0xab517d===_0xa9bf('0x67')||_0xab517d==='ContactId'||_0xab517d===_0xa9bf('0x53')||_0xab517d===_0xa9bf('0x68')||_0xab517d===_0xa9bf('0x1f')||_0xab517d===_0xa9bf('0x69')||_0xab517d===_0xa9bf('0x6a')||_0xab517d===_0xa9bf('0x6b')||_0xab517d==='xmd-phone'||_0xab517d===_0xa9bf('0x6c')||_0xab517d===_0xa9bf('0x6d')||_0xab517d===_0xa9bf('0x6e')||_0xab517d===_0xa9bf('0x6f')||_0xab517d===_0xa9bf('0x70')||_0xab517d===_0xa9bf('0x71')||_0xab517d===_0xa9bf('0x72')||_0xab517d===_0xa9bf('0x73')||_0xab517d===_0xa9bf('0x74')||_0xab517d==='xmd-agiafter'||_0xab517d==='xmd-agi'||_0xab517d===_0xa9bf('0x75')||_0xab517d==='rtpaudioqosbridged'||_0xab517d==='rtpaudioqosjitter'||_0xab517d===_0xa9bf('0x76')||_0xab517d===_0xa9bf('0x77')||_0xab517d===_0xa9bf('0x78')||_0xab517d==='rtpaudioqosrtt'||_0xab517d==='rtpaudioqosrttbridged'||_0xab517d===_0xa9bf('0x75')||_0xab517d===_0xa9bf('0x79')||_0xab517d==='rtpaudioqosjitter'||_0xab517d===_0xa9bf('0x76')||_0xab517d===_0xa9bf('0x77')||_0xab517d===_0xa9bf('0x78')||_0xab517d===_0xa9bf('0x7a')||_0xab517d===_0xa9bf('0x7b')||_0xab517d===_0xa9bf('0x7c')||_0xab517d===_0xa9bf('0x7d')||_0xab517d===_0xa9bf('0x3b')||_0xab517d===_0xa9bf('0x3c')){return![];}return!![];};exports[_0xa9bf('0x7e')]=function(_0x3e80fe,_0xce0470){var _0x116ef9,_0x53f958,_0x4e6eb8;if(_0xce0470<=0x0){_0xce0470=0x1;}_0x116ef9=new RegExp(_0xa9bf('0x7f')+_0xce0470+'}$');_0x53f958=Math[_0xa9bf('0x80')](0xa,_0xce0470-0x1);_0x4e6eb8=Math['pow'](0xa,_0xce0470)-0x1;return util[_0xa9bf('0x14')]('%s',_[_0xa9bf('0x81')](_0x3e80fe,_0x116ef9,_[_0xa9bf('0x82')](_0x53f958,_0x4e6eb8)));};exports['extractCalleridName']=function(_0x25faba){var _0x56a74a=_0x25faba['match'](/"(.*?)"/);return _0x56a74a?_0x56a74a[0x1]:_0x25faba;};exports[_0xa9bf('0x83')]=function(_0x37b6c7){var _0x3f7451=_0x37b6c7[_0xa9bf('0x84')](/<(.*?)>/);return _0x3f7451?_0x3f7451[0x1]:_0x37b6c7;}; \ No newline at end of file +var _0x052a=['moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','info','loggerError','inspect','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','isNil','%s%s','XMD-','toUpper','Contact','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','endtime','logAgent','state','statedesc','ringtime','starttime','logLookAgent','membername','logCustomer','responsetime','talktime','answertime','variablesAction','RECALL','BOOKED','originate','from-sip','timeout','uniqueid','countagentrejectretry','cloneAction','clone','Global','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','mandatoryDisposition','buildAcw','queue','interface','channelAgent','agentReadyId','not_inuse','status','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','active','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash'];(function(_0x30688c,_0x20adc7){var _0x574366=function(_0xbd61cc){while(--_0xbd61cc){_0x30688c['push'](_0x30688c['shift']());}};_0x574366(++_0x20adc7);}(_0x052a,0x8a));var _0xa052=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x052a[_0x57d370];return _0x550fd2;};'use strict';var util=require(_0xa052('0x0'));var _=require(_0xa052('0x1'));var moment=require(_0xa052('0x2'));var logger=require(_0xa052('0x3'))(_0xa052('0x4'));var ipAgi=process[_0xa052('0x5')][_0xa052('0x6')]||'127.0.0.1';function getSeconds(_0x6e894f,_0x10f603){var _0x49b02d=moment(_0x6e894f)[_0xa052('0x7')](0x0);var _0x67602c=moment(_0x10f603)[_0xa052('0x7')](0x0);return _0x49b02d[_0xa052('0x8')](_0x67602c,_0xa052('0x9'));}exports[_0xa052('0xa')]=function(_0x3ef2de){return function(_0x4911c7){logger[_0xa052('0xb')](_0x3ef2de,util['inspect'](_0x4911c7,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5a94b9,_0xc837d8){logger[_0xa052('0xc')](_0x5a94b9,util['inspect'](_0xc837d8,{'showHidden':![],'depth':null}));};exports[_0xa052('0xd')]=function(_0x357e34,_0x43be99){logger[_0xa052('0xb')](_0x357e34,util[_0xa052('0xe')](_0x43be99,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3e18c7){return function(_0x80f129){logger[_0xa052('0xc')](_0x3e18c7,util[_0xa052('0xe')](_0x80f129,{'showHidden':![],'depth':null}));};};exports[_0xa052('0xf')]=function(_0x21fdae,_0x3013df,_0x1fbe2c){return{'message':_0x21fdae,'unlock':_0x3013df,'active':_0x1fbe2c};};exports[_0xa052('0x10')]=function(_0x23ff93,_0x2df484,_0x5c798c){if(!_[_0xa052('0x11')](_0x5c798c)&&_0xa052('0x12')===typeof _0x5c798c&&!_[_0xa052('0x13')](_0x5c798c)){if(!_[_0xa052('0x11')](_0x2df484)&&_0xa052('0x12')===typeof _0x2df484&&!_[_0xa052('0x13')](_0x2df484)){return util[_0xa052('0x14')]('\x22%s\x22\x20<%s>',_0x2df484,_0x5c798c);}return util['format']('\x22%s\x22\x20<%s>',_0x5c798c,_0x5c798c);}if(!_[_0xa052('0x11')](_0x23ff93)&&_0xa052('0x12')===typeof _0x23ff93&&!_[_0xa052('0x13')](_0x23ff93)){return _0x23ff93;}return _0xa052('0x15');};exports[_0xa052('0x16')]=function(_0xd23a5e){if(_['isNil'](_0xd23a5e)){return![];}return _0xd23a5e;};exports[_0xa052('0x17')]=function(_0x5325db,_0x5a6284,_0x1850b0,_0x4118af,_0x2801a0,_0x48024d){var _0x5549e1={'XMD-QUEUE':_0x5a6284[_0xa052('0x18')]?_0x5a6284[_0xa052('0x18')][_0xa052('0x19')]:'','XMD-CALLERID':_0x4118af,'XMD-CALLERID-PREVIEW':_0x48024d?util[_0xa052('0x14')](_0xa052('0x1a'),_0x48024d[_0xa052('0x1b')],_0x48024d[_0xa052('0x1c')]):_0x4118af,'XMD-DIALID':_0x2801a0,'XMD-CONTACTID':_0x5a6284['ContactId'],'XMD-CDRTYPE':_0xa052('0x1d'),'CALLERID(all)':_0x4118af,'XMD-VOICEQUEUEID':_0x5a6284[_0xa052('0x1e')],'XMD-DIALCHANNEL':_0x1850b0,'XMD-DIALTIMEOUT':_0x5325db['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xa052('0x14')](_0xa052('0x1f'),_0x5325db[_0xa052('0x20')]?'g':'',_[_0xa052('0x13')](_0x5325db[_0xa052('0x21')])?'':_0xa052('0x22')),'XMD-DIALURL':_0x5325db[_0xa052('0x23')]||'','XMD-AGI':_0x5325db['dialQueueProject']?util[_0xa052('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5325db['dialQueueProject']):_0xa052('0x24'),'XMD-AGIAFTER':_0x5325db[_0xa052('0x20')]?util[_0xa052('0x14')](_0xa052('0x25'),ipAgi,_0x5325db[_0xa052('0x20')]):_0xa052('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x48024d?_0x48024d[_0xa052('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x48024d?_0x48024d[_0xa052('0x27')]:'','XMD-DESTINATION':_0xa052('0x28')};if(!_[_0xa052('0x13')](_0x5325db[_0xa052('0x21')])){_0x5549e1[util[_0xa052('0x14')]('%s',_0xa052('0x29'))]=_0x5325db[_0xa052('0x21')];_0x5549e1[util[_0xa052('0x14')]('%s',_0xa052('0x2a'))]=_0x2801a0;}if(_0x5a6284&&_0x5a6284['Contact']){for(var _0x26e67a in _0x5a6284['Contact']){if(_0x5a6284['Contact'][_0xa052('0x2b')](_0x26e67a)){if(!_[_0xa052('0x2c')](_0x5a6284['Contact'][_0x26e67a])&&_0x26e67a!=='id'&&_0x26e67a!=='tags'&&_0x26e67a!=='createdAt'&&_0x26e67a!=='updatedAt'){_0x5549e1[util[_0xa052('0x14')](_0xa052('0x2d'),_0xa052('0x2e'),_[_0xa052('0x2f')](_0x26e67a))]=_0x5a6284[_0xa052('0x30')][_0x26e67a];}}}}return _0x5549e1;};exports[_0xa052('0x31')]=function(_0x20857e){var _0x340510={};for(var _0x4e5dcc in _0x20857e){if(_0x20857e[_0xa052('0x2b')](_0x4e5dcc)){_0x340510[util['format']('%s',_[_0xa052('0x32')](_0x4e5dcc))]=_0x20857e[_0x4e5dcc];}}return{'variables':_0x340510};};exports[_0xa052('0x33')]=function(_0x771b71,_0x2372fd){if(!_[_0xa052('0x2c')](_0x771b71)){if(_0x771b71[_0xa052('0x2b')](_0xa052('0x34'))){if(_0x771b71[_0xa052('0x34')]>0x0){_0x771b71['originated']-=0x1;}else{logger[_0xa052('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2372fd);}}}else{logger[_0xa052('0xb')](_0xa052('0x35'),_0x2372fd);}};exports[_0xa052('0x36')]=function(_0xf31d0d){var _0x21e438=moment()[_0xa052('0x14')](_0xa052('0x37'));_0xf31d0d['state']=0xd;_0xf31d0d['statedesc']='Blacklist';_0xf31d0d['starttime']=_0x21e438;_0xf31d0d['responsetime']=_0x21e438;_0xf31d0d[_0xa052('0x38')]=_0x21e438;};exports[_0xa052('0x39')]=function(_0x7ca252,_0x241ef6,_0x2cdfe4){var _0x25e469=moment()[_0xa052('0x14')](_0xa052('0x37'));_0x7ca252[_0xa052('0x3a')]=_0x241ef6;_0x7ca252[_0xa052('0x3b')]=_0x2cdfe4;_0x7ca252['responsetime']=_0x25e469;_0x7ca252[_0xa052('0x3c')]=getSeconds(_0x7ca252['responsetime'],_0x7ca252[_0xa052('0x3d')]);};exports[_0xa052('0x3e')]=function(_0x3a74a9,_0x4cf906,_0x4b553d){_0x3a74a9[_0xa052('0x3f')]=_0x4cf906;_0x3a74a9['UserId']=_0x4b553d;};exports[_0xa052('0x40')]=function(_0x381875,_0x559f4b,_0x3bde68){var _0x51b5f0=moment()[_0xa052('0x14')](_0xa052('0x37'));_0x381875[_0xa052('0x3a')]=_0x559f4b;_0x381875[_0xa052('0x3b')]=_0x3bde68;_0x381875['responsetime']=_0x381875[_0xa052('0x41')]?_0x381875[_0xa052('0x41')]:_0x51b5f0;_0x381875[_0xa052('0x38')]=_0x381875['endtime']?_0x381875['endtime']:_0x51b5f0;_0x381875[_0xa052('0x3c')]=getSeconds(_0x381875['responsetime']||0x0,_0x381875[_0xa052('0x3d')]||0x0);_0x381875[_0xa052('0x42')]=_0x381875[_0xa052('0x43')]?getSeconds(_0x381875[_0xa052('0x38')],_0x381875[_0xa052('0x43')]):0x0;};exports['isFailure']=function(_0x161642){return _0x161642==='Failure';};exports[_0xa052('0x44')]=function(_0xf21d40,_0x24e53d,_0x1b8d1b,_0x2a3d8e,_0x1217de){var _0xcd7339=_0x2a3d8e?_0xa052('0x45'):_0xf21d40[_0xa052('0x1b')];_0xcd7339=_0x1217de?_0xa052('0x46'):_0xcd7339;return{'actionid':_0xf21d40['uniqueid'],'action':_0xa052('0x47'),'channel':_0xf21d40['channelAgent'],'callerid':util[_0xa052('0x14')](_0xa052('0x1a'),_0xcd7339,_0xf21d40[_0xa052('0x1c')]),'Exten':_0xa052('0x28'),'Context':_0xa052('0x48'),'Priority':'1','variable':_0x1b8d1b,'timeout':(_0x24e53d[_0xa052('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0xf21d40[_0xa052('0x4a')]};};exports['totalGlobal']=function(_0x37dfce){return _0x37dfce['countbusyretry']+_0x37dfce['countcongestionretry']+_0x37dfce['countnoanswerretry']+_0x37dfce[_0xa052('0x4b')]+_0x37dfce['countnosuchnumberretry'];};exports[_0xa052('0x4c')]=function(_0x19822e){var _0x485aa2=_[_0xa052('0x4d')](_0x19822e);_0x485aa2[_0xa052('0x3a')]=0xf;_0x485aa2[_0xa052('0x3b')]=_0xa052('0x4e');return _0x485aa2;};exports['scheduledAt']=function(_0x38a5eb,_0x3b610c,_0x29077a){var _0xacc14e={};_0xacc14e[_0x3b610c]=_0x38a5eb[_0x3b610c];_0xacc14e['active']=![];_0xacc14e[_0xa052('0x4f')]=moment()[_0xa052('0x50')](_0x29077a,_0xa052('0x51'))['format'](_0xa052('0x37'));_0xacc14e[_0xa052('0x52')]=_0x38a5eb[_0xa052('0x52')];_0xacc14e[_0xa052('0x53')]=_0x38a5eb['ListId'];_0xacc14e[_0xa052('0x1e')]=_0x38a5eb['VoiceQueueId']||undefined;return _0xacc14e;};exports[_0xa052('0x54')]=function(_0x2e44f7,_0xeab12){if(!_['isNil'](_0x2e44f7)){if(_0x2e44f7[_0xa052('0x55')]>0x0){_0x2e44f7['pTalking']-=0x1;}else{logger[_0xa052('0xb')](_0xeab12,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa052('0xb')](_0xeab12,_0xa052('0x56'));}};exports[_0xa052('0x57')]=function(_0x1a5510){if(_0x1a5510<=0x0){return!![];}return![];};exports[_0xa052('0x58')]=function(_0x4c59a9,_0x14b8c0,_0x387160){_0x4c59a9['lastevent']=_0x14b8c0;_0x4c59a9[_0xa052('0x19')]=_0x4c59a9['queue'];_0x4c59a9['interface']=_0x4c59a9['channelAgent'];if(_0x387160){_0x4c59a9[_0xa052('0x59')]=_0x387160[_0xa052('0x59')];}return _0x4c59a9;};exports[_0xa052('0x5a')]=function(_0x4d296a){var _0x4981e4={};_0x4981e4['queue']=_0x4d296a[_0xa052('0x5b')];_0x4981e4[_0xa052('0x5c')]=_0x4d296a[_0xa052('0x5d')];_0x4981e4[_0xa052('0x4a')]=_0x4d296a[_0xa052('0x4a')];return _0x4981e4;};exports[_0xa052('0x5e')]=function(_0x420974){var _0x46fbad=[];for(var _0x5e4420 in _0x420974){if(_0x420974[_0xa052('0x2b')](_0x5e4420)){if(!_[_0xa052('0x2c')](_0x420974[_0x5e4420])&&_0x420974[_0x5e4420][_0xa052('0x3a')]===_0xa052('0x5f')&&_0x420974[_0x5e4420][_0xa052('0x60')]==='reachable'){_0x46fbad['push'](_0x420974[_0x5e4420]['id']);}}}return _0x46fbad;};exports[_0xa052('0x61')]=function(_0x13410f){var _0x3c93cc=moment()['milliseconds'](0x0);var _0x16685b=moment(_0x13410f)['milliseconds'](0x0);return _0x3c93cc['diff'](_0x16685b,'seconds');};exports[_0xa052('0x62')]=function(_0xb23b3e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xb23b3e[_0xa052('0x52')],'ListId':_0xb23b3e['ListId'],'VoiceQueueId':_0xb23b3e[_0xa052('0x1e')]||undefined,'CampaignId':_0xb23b3e[_0xa052('0x63')]||undefined};};exports[_0xa052('0x64')]=function(_0x8a5d85){if(_0x8a5d85===_0xa052('0x4a')||_0x8a5d85===_0xa052('0x65')||_0x8a5d85===_0xa052('0x5b')||_0x8a5d85===_0xa052('0x66')||_0x8a5d85==='campaigntype'||_0x8a5d85===_0xa052('0x67')||_0x8a5d85===_0xa052('0x3f')||_0x8a5d85==='channelAgent'||_0x8a5d85===_0xa052('0x1b')||_0x8a5d85===_0xa052('0x68')||_0x8a5d85==='calleridnum'||_0x8a5d85===_0xa052('0x4f')||_0x8a5d85===_0xa052('0x69')||_0x8a5d85===_0xa052('0x6a')||_0x8a5d85===_0xa052('0x6b')||_0x8a5d85===_0xa052('0x6c')||_0x8a5d85==='callback'||_0x8a5d85==='callbackuniqueid'||_0x8a5d85==='callbackat'||_0x8a5d85===_0xa052('0x6d')||_0x8a5d85==='ContactId'||_0x8a5d85==='ListId'||_0x8a5d85===_0xa052('0x6e')||_0x8a5d85===_0xa052('0x1e')||_0x8a5d85===_0xa052('0x6f')||_0x8a5d85===_0xa052('0x70')||_0x8a5d85===_0xa052('0x71')||_0x8a5d85===_0xa052('0x72')||_0x8a5d85==='xmd-listid'||_0x8a5d85===_0xa052('0x73')||_0x8a5d85==='xmd-dialtimeout'||_0x8a5d85===_0xa052('0x74')||_0x8a5d85===_0xa052('0x75')||_0x8a5d85===_0xa052('0x76')||_0x8a5d85===_0xa052('0x77')||_0x8a5d85===_0xa052('0x78')||_0x8a5d85===_0xa052('0x79')||_0x8a5d85===_0xa052('0x7a')||_0x8a5d85===_0xa052('0x7b')||_0x8a5d85===_0xa052('0x7c')||_0x8a5d85===_0xa052('0x7d')||_0x8a5d85==='rtpaudioqosjitter'||_0x8a5d85===_0xa052('0x7e')||_0x8a5d85==='rtpaudioqosloss'||_0x8a5d85===_0xa052('0x7f')||_0x8a5d85===_0xa052('0x80')||_0x8a5d85===_0xa052('0x81')||_0x8a5d85==='rtpaudioqos'||_0x8a5d85===_0xa052('0x7d')||_0x8a5d85==='rtpaudioqosjitter'||_0x8a5d85===_0xa052('0x7e')||_0x8a5d85===_0xa052('0x82')||_0x8a5d85===_0xa052('0x7f')||_0x8a5d85===_0xa052('0x80')||_0x8a5d85===_0xa052('0x81')||_0x8a5d85===_0xa052('0x83')||_0x8a5d85===_0xa052('0x84')||_0x8a5d85===_0xa052('0x3a')||_0x8a5d85==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x48bdb0,_0x475608){var _0x244660,_0x40c5bf,_0x4da1c1;if(_0x475608<=0x0){_0x475608=0x1;}_0x244660=new RegExp(_0xa052('0x85')+_0x475608+'}$');_0x40c5bf=Math[_0xa052('0x86')](0xa,_0x475608-0x1);_0x4da1c1=Math[_0xa052('0x86')](0xa,_0x475608)-0x1;return util[_0xa052('0x14')]('%s',_[_0xa052('0x87')](_0x48bdb0,_0x244660,_[_0xa052('0x88')](_0x40c5bf,_0x4da1c1)));};exports[_0xa052('0x89')]=function(_0x5ae352){var _0x4cd912=_0x5ae352[_0xa052('0x8a')](/"(.*?)"/);return _0x4cd912?_0x4cd912[0x1]:_0x5ae352;};exports[_0xa052('0x8b')]=function(_0xf7ca4f){var _0x19684d=_0xf7ca4f[_0xa052('0x8a')](/<(.*?)>/);return _0x19684d?_0x19684d[0x1]:_0xf7ca4f;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 9d5f9d3..dc15eff 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x59f4ee,_0x4afda2){var _0x52b5e4=function(_0x1a9c52){while(--_0x1a9c52){_0x59f4ee['push'](_0x59f4ee['shift']());}};_0x52b5e4(++_0x4afda2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48eab1,_0x5777b2){_0x48eab1=_0x48eab1-0x0;var _0x5333bf=_0x5f2f[_0x48eab1];return _0x5333bf;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3c7e74,_0x431a67){var _0x5e7924=function(_0x39e11f){while(--_0x39e11f){_0x3c7e74['push'](_0x3c7e74['shift']());}};_0x5e7924(++_0x431a67);}(_0x5f2f,0x73));var _0xf5f2=function(_0x170023,_0x18320f){_0x170023=_0x170023-0x0;var _0x348f38=_0x5f2f[_0x170023];return _0x348f38;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b0206c6..e13c832 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 _0x7903=['uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','sumDuration','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','dialQueueProject','SquareProject','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','interface','name','total','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','length','isNil','SIP/%s','isUndefined','initTelephones','mergeFromDatabase','prototype','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x7903,0xe2));var _0x3790=function(_0x39f715,_0x23886f){_0x39f715=_0x39f715-0x0;var _0x4408b7=_0x7903[_0x39f715];return _0x4408b7;};'use strict';var BPromise=require(_0x3790('0x0'));var util=require('util');var _=require(_0x3790('0x1'));var moment=require(_0x3790('0x2'));var Agent=require(_0x3790('0x3'));var Telephone=require(_0x3790('0x4'));var Trunk=require(_0x3790('0x5'));var VoiceQueue=require(_0x3790('0x6'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x3790('0x7'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x3790('0x8'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x3790('0x9'));var ServicenowAccount=require(_0x3790('0xa'));var Dynamics365Account=require(_0x3790('0xb'));var FreshsalesAccount=require(_0x3790('0xc'));var FaxAccount=require(_0x3790('0xd'));var Realtime=function(){this[_0x3790('0xe')]={};this[_0x3790('0xf')]={};this[_0x3790('0x10')]={};this[_0x3790('0x11')]={};this[_0x3790('0x12')]={};this[_0x3790('0x13')]={};this[_0x3790('0x14')]={};this[_0x3790('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3790('0x16')]={};this[_0x3790('0x17')]={};this[_0x3790('0x18')]={};this[_0x3790('0x19')]={};this[_0x3790('0x1a')]={};this[_0x3790('0x1b')]={};this[_0x3790('0x1c')]={};this['sugarcrmAccounts']={};this[_0x3790('0x1d')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x3790('0x1e')]={};this[_0x3790('0x1f')]={};this[_0x3790('0x20')]={};this[_0x3790('0x21')]={};this[_0x3790('0x22')]={};};function freeIsNotKey(_0x18dc9f,_0x335d11,_0x11a707){var _0x1e0273=_['mapKeys'](_0x18dc9f,function(_0x3b9293,_0x227ec6){return _0x3b9293[_0x11a707];});for(var _0x237453 in _0x335d11){if(_0x335d11[_0x3790('0x23')](_0x237453)){if(!_0x1e0273[_0x237453]){delete _0x335d11[_0x237453];}}}}function freeIsNotKeySip(_0x322bcd,_0x5eef80){var _0x42ce78=_[_0x3790('0x24')](_0x322bcd,function(_0x465a0b,_0x52aac4){return util[_0x3790('0x25')]('SIP/%s',_0x465a0b['name']);});for(var _0x5e81d4 in _0x5eef80){if(_0x5eef80[_0x3790('0x23')](_0x5e81d4)){if(!_0x42ce78[_0x5e81d4]){delete _0x5eef80[_0x5e81d4];}}}}function freeIsNotKeyAgent(_0x579488,_0x5c7055){var _0x3032ec=_[_0x3790('0x24')](_0x579488,function(_0x127f49,_0x24e556){var _0x4e3036=_['isNil'](_0x127f49[_0x3790('0x26')])?util['format']('SIP/%s',_0x127f49[_0x3790('0x27')]):_0x127f49['interface'];return _0x4e3036;});for(var _0x2d009e in _0x5c7055){if(_0x5c7055[_0x3790('0x23')](_0x2d009e)){if(!_0x3032ec[_0x2d009e]){delete _0x5c7055[_0x2d009e];}}}}function clearVoiceCallReports(_0x2ce362){_0x2ce362[_0x3790('0x28')]=0x0;_0x2ce362['answered']=0x0;_0x2ce362[_0x3790('0x29')]=0x0;_0x2ce362['sumDuration']=0x0;_0x2ce362[_0x3790('0x2a')]=0x0;}function clearCampaigns(_0x55d7c0){if(!_[_0x3790('0x2b')](_0x55d7c0)){for(var _0x2934cb in _0x55d7c0){if(_0x55d7c0[_0x3790('0x23')](_0x2934cb)){_0x55d7c0[_0x2934cb][_0x3790('0x2c')]=0x0;_0x55d7c0[_0x2934cb][_0x3790('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x163fea){if(!_[_0x3790('0x2b')](_0x163fea)){for(var _0x30af62 in _0x163fea){if(_0x163fea[_0x3790('0x23')](_0x30af62)){_0x163fea[_0x30af62]['total']=0x0;_0x163fea[_0x30af62][_0x3790('0x2e')]=0x0;_0x163fea[_0x30af62][_0x3790('0x2f')]=0x0;_0x163fea[_0x30af62][_0x3790('0x30')]=0x0;_0x163fea[_0x30af62][_0x3790('0x29')]=0x0;_0x163fea[_0x30af62]['sumDuration']=0x0;_0x163fea[_0x30af62][_0x3790('0x2a')]=0x0;_0x163fea[_0x30af62][_0x3790('0x31')]=0x0;_0x163fea[_0x30af62]['outboundNoAnswerCallsDay']=0x0;_0x163fea[_0x30af62][_0x3790('0x32')]=0x0;_0x163fea[_0x30af62]['outboundCongestionCallsDay']=0x0;_0x163fea[_0x30af62][_0x3790('0x33')]=0x0;_0x163fea[_0x30af62][_0x3790('0x34')]=0x0;_0x163fea[_0x30af62]['outboundDropCallsDayTimeout']=0x0;_0x163fea[_0x30af62][_0x3790('0x35')]=0x0;_0x163fea[_0x30af62]['outboundBlacklistCallsDay']=0x0;_0x163fea[_0x30af62]['outboundOriginateFailureCallsDay']=0x0;_0x163fea[_0x30af62]['outboundRejectCallsDay']=0x0;_0x163fea[_0x30af62][_0x3790('0x36')]=0x0;_0x163fea[_0x30af62][_0x3790('0x31')]=0x0;_0x163fea[_0x30af62][_0x3790('0x37')]=0x0;_0x163fea[_0x30af62][_0x3790('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1f1894,_0x377e12){for(var _0xa1da7f in _0x377e12){if(_0x1f1894[_0x3790('0x23')](_0xa1da7f)){_0x1f1894[_0xa1da7f]=_0x377e12[_0xa1da7f];}}};Realtime['prototype']['initAgents']=function(){var _0x4d524c=this;return function(_0x3d0db9){if(_0x3d0db9){freeIsNotKeyAgent(_0x3d0db9,_0x4d524c['agents']);for(var _0x52789b=0x0,_0x294e3d={},_0x3c6306={};_0x52789b<_0x3d0db9[_0x3790('0x39')];_0x52789b+=0x1){_0x294e3d=_0x3d0db9[_0x52789b];var _0x42f325=_[_0x3790('0x3a')](_0x294e3d[_0x3790('0x26')])?util[_0x3790('0x25')](_0x3790('0x3b'),_0x294e3d['name']):_0x294e3d[_0x3790('0x26')];if(_[_0x3790('0x3c')](_0x4d524c['agents'][_0x42f325])){_0x4d524c['agents'][_0x42f325]=new Agent(_0x294e3d);}else{_0x4d524c['mergeFromDatabase'](_0x4d524c[_0x3790('0xe')][_0x42f325],_0x294e3d);}}}return _0x4d524c[_0x3790('0xe')];};};Realtime['prototype'][_0x3790('0x3d')]=function(){var _0x5e43d2=this;return function(_0x297773){if(_0x297773){freeIsNotKeySip(_0x297773,_0x5e43d2['telephones']);for(var _0x152b24=0x0,_0x4b62d5={},_0x165c50={};_0x152b24<_0x297773[_0x3790('0x39')];_0x152b24+=0x1){_0x4b62d5=_0x297773[_0x152b24];if(_[_0x3790('0x3c')](_0x5e43d2[_0x3790('0xf')][util[_0x3790('0x25')](_0x3790('0x3b'),_0x4b62d5[_0x3790('0x27')])])){_0x5e43d2[_0x3790('0xf')][util['format'](_0x3790('0x3b'),_0x4b62d5[_0x3790('0x27')])]=new Telephone(_0x4b62d5);}else{_0x5e43d2[_0x3790('0x3e')](_0x5e43d2['telephones'][util[_0x3790('0x25')](_0x3790('0x3b'),_0x4b62d5['name'])],_0x4b62d5);}}}return _0x5e43d2[_0x3790('0xf')];};};Realtime[_0x3790('0x3f')][_0x3790('0x40')]=function(){var _0xcd0b07=this;return function(_0x15f4f8){if(_0x15f4f8){freeIsNotKeySip(_0x15f4f8,_0xcd0b07[_0x3790('0x10')]);for(var _0x451874=0x0,_0x49d85a={},_0x15d10c={};_0x451874<_0x15f4f8[_0x3790('0x39')];_0x451874+=0x1){_0x49d85a=_0x15f4f8[_0x451874];if(_[_0x3790('0x3c')](_0xcd0b07[_0x3790('0x10')][util[_0x3790('0x25')](_0x3790('0x3b'),_0x49d85a[_0x3790('0x27')])])){_0xcd0b07[_0x3790('0x10')][util[_0x3790('0x25')]('SIP/%s',_0x49d85a[_0x3790('0x27')])]=new Trunk(_0x49d85a);}else{_0xcd0b07[_0x3790('0x3e')](_0xcd0b07[_0x3790('0x10')][util['format'](_0x3790('0x3b'),_0x49d85a['name'])],_0x49d85a);}}}return _0xcd0b07[_0x3790('0x10')];};};Realtime[_0x3790('0x3f')][_0x3790('0x41')]=function(){var _0x21e131=this;return function(_0x3afa8b){if(_0x3afa8b){freeIsNotKey(_0x3afa8b,_0x21e131[_0x3790('0x11')],'name');for(var _0x4fb1ad=0x0,_0x331772={},_0x262e63={};_0x4fb1ad<_0x3afa8b[_0x3790('0x39')];_0x4fb1ad+=0x1){_0x331772=_0x3afa8b[_0x4fb1ad];if(_[_0x3790('0x3c')](_0x21e131['voiceQueues'][_0x331772[_0x3790('0x27')]])){_0x21e131[_0x3790('0x11')][_0x331772['name']]=new VoiceQueue(_0x331772);}else{_0x21e131[_0x3790('0x3e')](_0x21e131[_0x3790('0x11')][_0x331772[_0x3790('0x27')]],_0x331772);}}}return _0x21e131['voiceQueues'];};};Realtime[_0x3790('0x3f')]['initTriggers']=function(){var _0x1dacd2=this;return function(_0xee5db4){if(_0xee5db4){freeIsNotKey(_0xee5db4,_0x1dacd2[_0x3790('0x12')],'id');for(var _0x3a29e1=0x0,_0x1c72a1={},_0x40fd8c={};_0x3a29e1<_0xee5db4['length'];_0x3a29e1+=0x1){_0x1c72a1=_0xee5db4[_0x3a29e1];if(_['isUndefined'](_0x1dacd2[_0x3790('0x12')][_0x1c72a1['id']])){_0x1dacd2[_0x3790('0x12')][_0x1c72a1['id']]=new Trigger(_0x1c72a1);}else{_0x1dacd2[_0x3790('0x3e')](_0x1dacd2[_0x3790('0x12')][_0x1c72a1['id']],_0x1c72a1);}}}return _0x1dacd2[_0x3790('0x12')];};};Realtime[_0x3790('0x3f')][_0x3790('0x42')]=function(){var _0x2cf5f5=this;return function(_0xe02a75){if(_0xe02a75){freeIsNotKey(_0xe02a75,_0x2cf5f5[_0x3790('0x14')],'id');for(var _0x1408ba=0x0,_0x4d0adf={},_0x1f74f1={};_0x1408ba<_0xe02a75[_0x3790('0x39')];_0x1408ba+=0x1){_0x4d0adf=_0xe02a75[_0x1408ba];if(_[_0x3790('0x3c')](_0x2cf5f5['templates'][_0x4d0adf['id']])){_0x2cf5f5[_0x3790('0x14')][_0x4d0adf['id']]=new Template(_0x4d0adf);}else{_0x2cf5f5[_0x3790('0x3e')](_0x2cf5f5['templates'][_0x4d0adf['id']],_0x4d0adf);}}}return _0x2cf5f5[_0x3790('0x14')];};};Realtime['prototype'][_0x3790('0x43')]=function(){var _0x19f7eb=this;return function(_0x499473){if(_0x499473){freeIsNotKey(_0x499473,_0x19f7eb[_0x3790('0x1b')],'id');for(var _0x5eef08=0x0,_0x55acc9={},_0x3da9df={};_0x5eef08<_0x499473[_0x3790('0x39')];_0x5eef08+=0x1){_0x55acc9=_0x499473[_0x5eef08];if(_['isUndefined'](_0x19f7eb['zendeskAccounts'][_0x55acc9['id']])){_0x19f7eb[_0x3790('0x1b')][_0x55acc9['id']]=new ZendeskAccount(_0x55acc9);}else{_0x19f7eb['mergeFromDatabase'](_0x19f7eb[_0x3790('0x1b')][_0x55acc9['id']],_0x55acc9);}}}return _0x19f7eb[_0x3790('0x1b')];};};Realtime[_0x3790('0x3f')][_0x3790('0x44')]=function(){var _0x53305e=this;return function(_0x2c7218){if(_0x2c7218){freeIsNotKey(_0x2c7218,_0x53305e[_0x3790('0x1c')],'id');for(var _0x14d6ee=0x0,_0x1df27e={},_0x31aebe={};_0x14d6ee<_0x2c7218[_0x3790('0x39')];_0x14d6ee+=0x1){_0x1df27e=_0x2c7218[_0x14d6ee];if(_[_0x3790('0x3c')](_0x53305e['salesforceAccounts'][_0x1df27e['id']])){_0x53305e[_0x3790('0x1c')][_0x1df27e['id']]=new SalesforceAccount(_0x1df27e);}else{_0x53305e[_0x3790('0x3e')](_0x53305e['salesforceAccounts'][_0x1df27e['id']],_0x1df27e);}}}return _0x53305e[_0x3790('0x1c')];};};Realtime[_0x3790('0x3f')][_0x3790('0x45')]=function(){var _0xae59d5=this;return function(_0x5241be){if(_0x5241be){freeIsNotKey(_0x5241be,_0xae59d5['freshdeskAccounts'],'id');for(var _0x19b3ce=0x0,_0x418255={},_0x4c0b50={};_0x19b3ce<_0x5241be[_0x3790('0x39')];_0x19b3ce+=0x1){_0x418255=_0x5241be[_0x19b3ce];if(_[_0x3790('0x3c')](_0xae59d5[_0x3790('0x1d')][_0x418255['id']])){_0xae59d5[_0x3790('0x1d')][_0x418255['id']]=new FreshdeskAccount(_0x418255);}else{_0xae59d5[_0x3790('0x3e')](_0xae59d5['freshdeskAccounts'][_0x418255['id']],_0x418255);}}}return _0xae59d5['freshdeskAccounts'];};};Realtime['prototype'][_0x3790('0x46')]=function(){var _0x20e455=this;return function(_0xcaee36){if(_0xcaee36){freeIsNotKey(_0xcaee36,_0x20e455['zohoAccounts'],'id');for(var _0x6c13da=0x0,_0x41d574={},_0x114200={};_0x6c13da<_0xcaee36[_0x3790('0x39')];_0x6c13da+=0x1){_0x41d574=_0xcaee36[_0x6c13da];if(_[_0x3790('0x3c')](_0x20e455['zohoAccounts'][_0x41d574['id']])){_0x20e455[_0x3790('0x47')][_0x41d574['id']]=new ZohoAccount(_0x41d574);}else{_0x20e455[_0x3790('0x3e')](_0x20e455['zohoAccounts'][_0x41d574['id']],_0x41d574);}}}return _0x20e455[_0x3790('0x47')];};};Realtime['prototype'][_0x3790('0x48')]=function(){var _0x1d2f9c=this;return function(_0x590e8c){if(_0x590e8c){freeIsNotKey(_0x590e8c,_0x1d2f9c['deskAccounts'],'id');for(var _0x55096=0x0,_0x2590f9={},_0xeccea7={};_0x55096<_0x590e8c[_0x3790('0x39')];_0x55096+=0x1){_0x2590f9=_0x590e8c[_0x55096];if(_['isUndefined'](_0x1d2f9c[_0x3790('0x49')][_0x2590f9['id']])){_0x1d2f9c[_0x3790('0x49')][_0x2590f9['id']]=new DeskAccount(_0x2590f9);}else{_0x1d2f9c[_0x3790('0x3e')](_0x1d2f9c[_0x3790('0x49')][_0x2590f9['id']],_0x2590f9);}}}return _0x1d2f9c[_0x3790('0x49')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4a')]=function(){var _0x4baa1=this;return function(_0x26b66b){if(_0x26b66b){freeIsNotKey(_0x26b66b,_0x4baa1[_0x3790('0x4b')],'id');for(var _0x536518=0x0,_0x530a32={},_0x5dc186={};_0x536518<_0x26b66b['length'];_0x536518+=0x1){_0x530a32=_0x26b66b[_0x536518];if(_[_0x3790('0x3c')](_0x4baa1['sugarcrmAccounts'][_0x530a32['id']])){_0x4baa1['sugarcrmAccounts'][_0x530a32['id']]=new SugarcrmAccount(_0x530a32);}else{_0x4baa1['mergeFromDatabase'](_0x4baa1[_0x3790('0x4b')][_0x530a32['id']],_0x530a32);}}}return _0x4baa1[_0x3790('0x4b')];};};Realtime['prototype'][_0x3790('0x4c')]=function(){var _0x566b3e=this;return function(_0x466ad6){if(_0x466ad6){freeIsNotKey(_0x466ad6,_0x566b3e['vtigerAccounts'],'id');for(var _0x54178f=0x0,_0x10d65e={},_0x5c6c11={};_0x54178f<_0x466ad6[_0x3790('0x39')];_0x54178f+=0x1){_0x10d65e=_0x466ad6[_0x54178f];if(_[_0x3790('0x3c')](_0x566b3e['vtigerAccounts'][_0x10d65e['id']])){_0x566b3e[_0x3790('0x1e')][_0x10d65e['id']]=new VtigerAccount(_0x10d65e);}else{_0x566b3e[_0x3790('0x3e')](_0x566b3e[_0x3790('0x1e')][_0x10d65e['id']],_0x10d65e);}}}return _0x566b3e[_0x3790('0x1e')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4d')]=function(){var _0x1f80ad=this;return function(_0x3f98c5){if(_0x3f98c5){freeIsNotKey(_0x3f98c5,_0x1f80ad[_0x3790('0x1f')],'id');for(var _0x43ad71=0x0,_0x3fe46f={},_0x2e9c15={};_0x43ad71<_0x3f98c5[_0x3790('0x39')];_0x43ad71+=0x1){_0x3fe46f=_0x3f98c5[_0x43ad71];if(_[_0x3790('0x3c')](_0x1f80ad[_0x3790('0x1f')][_0x3fe46f['id']])){_0x1f80ad[_0x3790('0x1f')][_0x3fe46f['id']]=new ServicenowAccount(_0x3fe46f);}else{_0x1f80ad[_0x3790('0x3e')](_0x1f80ad[_0x3790('0x1f')][_0x3fe46f['id']],_0x3fe46f);}}}return _0x1f80ad[_0x3790('0x1f')];};};Realtime[_0x3790('0x3f')]['initDynamics365Accounts']=function(){var _0x46059f=this;return function(_0x26da52){if(_0x26da52){freeIsNotKey(_0x26da52,_0x46059f['dynamics365Accounts'],'id');for(var _0x1df343=0x0,_0x228b48={},_0x4af0cc={};_0x1df343<_0x26da52[_0x3790('0x39')];_0x1df343+=0x1){_0x228b48=_0x26da52[_0x1df343];if(_[_0x3790('0x3c')](_0x46059f[_0x3790('0x20')][_0x228b48['id']])){_0x46059f[_0x3790('0x20')][_0x228b48['id']]=new Dynamics365Account(_0x228b48);}else{_0x46059f[_0x3790('0x3e')](_0x46059f[_0x3790('0x20')][_0x228b48['id']],_0x228b48);}}}return _0x46059f[_0x3790('0x20')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4e')]=function(){var _0x1ee96e=this;return function(_0x4b560e){if(_0x4b560e){freeIsNotKey(_0x4b560e,_0x1ee96e[_0x3790('0x21')],'id');for(var _0x41ca69=0x0,_0x1bb8c1={},_0xd04cef={};_0x41ca69<_0x4b560e[_0x3790('0x39')];_0x41ca69+=0x1){_0x1bb8c1=_0x4b560e[_0x41ca69];if(_[_0x3790('0x3c')](_0x1ee96e[_0x3790('0x21')][_0x1bb8c1['id']])){_0x1ee96e['freshsalesAccounts'][_0x1bb8c1['id']]=new FreshsalesAccount(_0x1bb8c1);}else{_0x1ee96e[_0x3790('0x3e')](_0x1ee96e['freshsalesAccounts'][_0x1bb8c1['id']],_0x1bb8c1);}}}return _0x1ee96e[_0x3790('0x21')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4f')]=function(){var _0x150a9a=this;return function(_0x31cc61){for(var _0x50a9f6=0x0;_0x50a9f6<_0x31cc61[_0x3790('0x39')];_0x50a9f6+=0x1){_[_0x3790('0x50')](_0x150a9a[_0x3790('0x11')][_0x31cc61[_0x50a9f6][_0x3790('0x27')]],_0x31cc61[_0x50a9f6]);}return _0x150a9a[_0x3790('0x11')];};};Realtime[_0x3790('0x3f')][_0x3790('0x51')]=function(){var _0x4ae1e8=this;return function(_0xde2bb2){clearVoiceQueues(_0x4ae1e8['voiceQueues']);if(_0xde2bb2){_0xde2bb2=_[_0x3790('0x52')](_0xde2bb2,_0x3790('0x53'));for(var _0x52275d in _0xde2bb2){if(_0xde2bb2[_0x3790('0x23')](_0x52275d)){var _0x13e96e={};for(var _0x464ddc=0x0;_0x464ddc<_0xde2bb2[_0x52275d]['length'];_0x464ddc+=0x1){var _0xdfff42=_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x54')];if(_0x4ae1e8[_0x3790('0x11')][_0xdfff42]){if(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x55')]){_0x4ae1e8['voiceQueues'][_0xdfff42][_0x3790('0x2f')]+=0x1;}if(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x56')]){_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x30')]+=0x1;}_0x4ae1e8[_0x3790('0x11')][_0xdfff42]['sumHoldTime']+=moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x57')])[_0x3790('0x58')](moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x59')]),_0x3790('0x5a'))||0x0;if(_0x464ddc===_0xde2bb2[_0x52275d][_0x3790('0x39')]-0x1){_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x5b')]+=moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x5c')]||_0xde2bb2[_0x52275d][_0x464ddc]['queuecallerabandonAt']||_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x5d')])[_0x3790('0x58')](moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x59')]),_0x3790('0x5a'))||0x0;_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x28')]+=0x1;if(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x5e')]){_0x4ae1e8[_0x3790('0x11')][_0xdfff42]['answered']+=0x1;_0x4ae1e8[_0x3790('0x11')][_0xdfff42]['sumBillable']+=moment(_0xde2bb2[_0x52275d][_0x464ddc]['queuecallercompleteAt'])[_0x3790('0x58')](moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x57')]),_0x3790('0x5a'))||0x0;}}else{_0x4ae1e8['voiceQueues'][_0xdfff42][_0x3790('0x5b')]+=_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x29')]||0x0;}}}}}}return _0x4ae1e8[_0x3790('0x11')];};};Realtime[_0x3790('0x3f')][_0x3790('0x5f')]=function(){var _0x57985d=this;return function(_0x58ae20){clearVoiceCallReports(_0x57985d[_0x3790('0x15')]);if(_0x58ae20){for(var _0x135fd7=0x0;_0x135fd7<_0x58ae20[_0x3790('0x39')];_0x135fd7+=0x1){_0x57985d[_0x3790('0x15')][_0x3790('0x28')]+=0x1;_0x57985d[_0x3790('0x15')][_0x3790('0x5b')]+=_0x58ae20[_0x135fd7][_0x3790('0x60')];if(_0x58ae20[_0x135fd7][_0x3790('0x61')]==='ANSWERED'){_0x57985d[_0x3790('0x15')]['answered']+=0x1;_0x57985d[_0x3790('0x15')][_0x3790('0x29')]+=_0x58ae20[_0x135fd7][_0x3790('0x60')]-_0x58ae20[_0x135fd7][_0x3790('0x62')]||0x0;_0x57985d[_0x3790('0x15')][_0x3790('0x2a')]+=_0x58ae20[_0x135fd7][_0x3790('0x62')];}}}return _0x57985d[_0x3790('0x15')];};};Realtime[_0x3790('0x3f')]['initCampaigns']=function(){var _0x52c15a=this;return function(_0x2885a1){if(_0x2885a1){freeIsNotKey(_0x2885a1,_0x52c15a[_0x3790('0x13')],_0x3790('0x27'));for(var _0xb1a169=0x0,_0x3e299a={};_0xb1a169<_0x2885a1[_0x3790('0x39')];_0xb1a169+=0x1){_0x3e299a=_0x2885a1[_0xb1a169];if(_[_0x3790('0x3c')](_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]])){_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]]=new Campaign(_0x3e299a);}else{_0x52c15a[_0x3790('0x3e')](_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]],_0x3e299a);_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]][_0x3790('0x63')]=_0x3e299a[_0x3790('0x64')]?_0x3e299a[_0x3790('0x64')][_0x3790('0x27')]:undefined;}}}return _0x52c15a[_0x3790('0x13')];};};Realtime[_0x3790('0x3f')]['initVoiceExtensions']=function(){var _0x2bf023=this;return function(_0xb349d8){if(_0xb349d8){freeIsNotKey(_0xb349d8,_0x2bf023['voiceExtensions'],'id');for(var _0x598ade=0x0,_0xc7fdc7={};_0x598ade<_0xb349d8[_0x3790('0x39')];_0x598ade+=0x1){_0xc7fdc7=_0xb349d8[_0x598ade];if(_['isUndefined'](_0x2bf023['voiceExtensions'][_0xc7fdc7['id']])){_0x2bf023[_0x3790('0x16')][_0xc7fdc7['id']]=new VoiceExtension(_0xc7fdc7);}else{_0x2bf023[_0x3790('0x3e')](_0x2bf023[_0x3790('0x16')][_0xc7fdc7['id']],_0xc7fdc7);}}}return _0x2bf023[_0x3790('0x16')];};};Realtime[_0x3790('0x3f')]['initCampaignHopperHistory']=function(){var _0x47bc85=this;return function(_0xc11950){clearCampaigns(_0x47bc85['campaigns']);for(var _0x4dbf9d=0x0;_0x4dbf9d<_0xc11950[_0x3790('0x39')];_0x4dbf9d+=0x1){_[_0x3790('0x50')](_0x47bc85['campaigns'][_0xc11950[_0x4dbf9d][_0x3790('0x27')]],_0xc11950[_0x4dbf9d]);}return _0x47bc85[_0x3790('0x13')];};};Realtime['prototype'][_0x3790('0x65')]=function(){var _0x5ee9db=this;return function(_0x4a0e30){if(_0x4a0e30){freeIsNotKey(_0x4a0e30,_0x5ee9db[_0x3790('0x22')],'id');for(var _0x16bb40=0x0,_0x5983e3={},_0x2c4de9={};_0x16bb40<_0x4a0e30[_0x3790('0x39')];_0x16bb40+=0x1){_0x5983e3=_0x4a0e30[_0x16bb40];if(_[_0x3790('0x3c')](_0x5ee9db[_0x3790('0x22')][_0x5983e3['id']])){_0x5ee9db[_0x3790('0x22')][_0x5983e3['id']]=new FaxAccount(_0x5983e3);}else{_0x5ee9db['mergeFromDatabase'](_0x5ee9db[_0x3790('0x22')][_0x5983e3['id']],_0x5983e3);}}}return _0x5ee9db[_0x3790('0x22')];};};module[_0x3790('0x66')]=Realtime; \ No newline at end of file +var _0x426a=['uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','freshdeskAccounts','deskAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','sumDuration','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy'];(function(_0xc45c30,_0x206f01){var _0x22797e=function(_0x1c6033){while(--_0x1c6033){_0xc45c30['push'](_0xc45c30['shift']());}};_0x22797e(++_0x206f01);}(_0x426a,0x1c6));var _0xa426=function(_0x1aa565,_0x4c322a){_0x1aa565=_0x1aa565-0x0;var _0x5f5015=_0x426a[_0x1aa565];return _0x5f5015;};'use strict';var BPromise=require(_0xa426('0x0'));var util=require(_0xa426('0x1'));var _=require(_0xa426('0x2'));var moment=require(_0xa426('0x3'));var Agent=require(_0xa426('0x4'));var Telephone=require(_0xa426('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa426('0x6'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0xa426('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xa426('0x8'));var SalesforceAccount=require(_0xa426('0x9'));var FreshdeskAccount=require(_0xa426('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xa426('0xb'));var DeskAccount=require(_0xa426('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xa426('0xd'));var FreshsalesAccount=require(_0xa426('0xe'));var FaxAccount=require(_0xa426('0xf'));var Realtime=function(){this[_0xa426('0x10')]={};this[_0xa426('0x11')]={};this[_0xa426('0x12')]={};this[_0xa426('0x13')]={};this[_0xa426('0x14')]={};this[_0xa426('0x15')]={};this[_0xa426('0x16')]={};this[_0xa426('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa426('0x18')]={};this[_0xa426('0x19')]={};this[_0xa426('0x1a')]={};this[_0xa426('0x1b')]={};this[_0xa426('0x1c')]={};this[_0xa426('0x1d')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0xa426('0x1e')]={};this['zohoAccounts']={};this[_0xa426('0x1f')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0xa426('0x20')]={};this['freshsalesAccounts']={};this[_0xa426('0x21')]={};};function freeIsNotKey(_0x3de49a,_0x13d649,_0x5c6da2){var _0x2ffea9=_[_0xa426('0x22')](_0x3de49a,function(_0x4c7617,_0x26c666){return _0x4c7617[_0x5c6da2];});for(var _0x2f2357 in _0x13d649){if(_0x13d649['hasOwnProperty'](_0x2f2357)){if(!_0x2ffea9[_0x2f2357]){delete _0x13d649[_0x2f2357];}}}}function freeIsNotKeySip(_0x38a9f0,_0x254939){var _0x5eb1de=_['mapKeys'](_0x38a9f0,function(_0xae9e4f,_0x10d1cd){return util[_0xa426('0x23')](_0xa426('0x24'),_0xae9e4f[_0xa426('0x25')]);});for(var _0x6fa356 in _0x254939){if(_0x254939[_0xa426('0x26')](_0x6fa356)){if(!_0x5eb1de[_0x6fa356]){delete _0x254939[_0x6fa356];}}}}function freeIsNotKeyAgent(_0xfc6f55,_0x5eb4aa){var _0x7715c4=_[_0xa426('0x22')](_0xfc6f55,function(_0x50f681,_0x34d53a){var _0x428f04=_[_0xa426('0x27')](_0x50f681[_0xa426('0x28')])?util[_0xa426('0x23')]('SIP/%s',_0x50f681[_0xa426('0x25')]):_0x50f681['interface'];return _0x428f04;});for(var _0x4b9f75 in _0x5eb4aa){if(_0x5eb4aa['hasOwnProperty'](_0x4b9f75)){if(!_0x7715c4[_0x4b9f75]){delete _0x5eb4aa[_0x4b9f75];}}}}function clearVoiceCallReports(_0x5e349e){_0x5e349e[_0xa426('0x29')]=0x0;_0x5e349e[_0xa426('0x2a')]=0x0;_0x5e349e[_0xa426('0x2b')]=0x0;_0x5e349e['sumDuration']=0x0;_0x5e349e[_0xa426('0x2c')]=0x0;}function clearCampaigns(_0x4115d7){if(!_[_0xa426('0x2d')](_0x4115d7)){for(var _0x57046c in _0x4115d7){if(_0x4115d7[_0xa426('0x26')](_0x57046c)){_0x4115d7[_0x57046c]['ivrTotalCallsDays']=0x0;_0x4115d7[_0x57046c][_0xa426('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x2839e1){if(!_[_0xa426('0x2d')](_0x2839e1)){for(var _0x57ed6a in _0x2839e1){if(_0x2839e1[_0xa426('0x26')](_0x57ed6a)){_0x2839e1[_0x57ed6a]['total']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2a')]=0x0;_0x2839e1[_0x57ed6a]['unmanaged']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2f')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2b')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x30')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x2c')]=0x0;_0x2839e1[_0x57ed6a]['outboundAnswerAgiCallsDay']=0x0;_0x2839e1[_0x57ed6a]['outboundNoAnswerCallsDay']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x31')]=0x0;_0x2839e1[_0x57ed6a]['outboundCongestionCallsDay']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x32')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x33')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x34')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x35')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x36')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x37')]=0x0;_0x2839e1[_0x57ed6a]['outboundRejectCallsDay']=0x0;_0x2839e1[_0x57ed6a]['outboundReCallsDay']=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x38')]=0x0;_0x2839e1[_0x57ed6a][_0xa426('0x39')]=0x0;_0x2839e1[_0x57ed6a]['queueStatusComplete']=!![];}}}}Realtime[_0xa426('0x3a')][_0xa426('0x3b')]=function(_0x3f00f1,_0x15ac40){for(var _0x321fb8 in _0x15ac40){if(_0x3f00f1['hasOwnProperty'](_0x321fb8)){_0x3f00f1[_0x321fb8]=_0x15ac40[_0x321fb8];}}};Realtime['prototype'][_0xa426('0x3c')]=function(){var _0x58be5c=this;return function(_0x3a0a2e){if(_0x3a0a2e){freeIsNotKeyAgent(_0x3a0a2e,_0x58be5c['agents']);for(var _0x3504a8=0x0,_0x92a2d3={},_0x18046c={};_0x3504a8<_0x3a0a2e[_0xa426('0x3d')];_0x3504a8+=0x1){_0x92a2d3=_0x3a0a2e[_0x3504a8];var _0x4614b9=_['isNil'](_0x92a2d3[_0xa426('0x28')])?util[_0xa426('0x23')](_0xa426('0x24'),_0x92a2d3[_0xa426('0x25')]):_0x92a2d3['interface'];if(_[_0xa426('0x3e')](_0x58be5c['agents'][_0x4614b9])){_0x58be5c['agents'][_0x4614b9]=new Agent(_0x92a2d3);}else{_0x58be5c[_0xa426('0x3b')](_0x58be5c[_0xa426('0x10')][_0x4614b9],_0x92a2d3);}}}return _0x58be5c[_0xa426('0x10')];};};Realtime[_0xa426('0x3a')][_0xa426('0x3f')]=function(){var _0x18966d=this;return function(_0x181706){if(_0x181706){freeIsNotKeySip(_0x181706,_0x18966d[_0xa426('0x11')]);for(var _0x496312=0x0,_0x1bb38e={},_0x999671={};_0x496312<_0x181706[_0xa426('0x3d')];_0x496312+=0x1){_0x1bb38e=_0x181706[_0x496312];if(_[_0xa426('0x3e')](_0x18966d['telephones'][util[_0xa426('0x23')](_0xa426('0x24'),_0x1bb38e[_0xa426('0x25')])])){_0x18966d['telephones'][util[_0xa426('0x23')]('SIP/%s',_0x1bb38e['name'])]=new Telephone(_0x1bb38e);}else{_0x18966d['mergeFromDatabase'](_0x18966d['telephones'][util['format'](_0xa426('0x24'),_0x1bb38e['name'])],_0x1bb38e);}}}return _0x18966d[_0xa426('0x11')];};};Realtime['prototype'][_0xa426('0x40')]=function(){var _0x309545=this;return function(_0x18d0ef){if(_0x18d0ef){freeIsNotKeySip(_0x18d0ef,_0x309545['trunks']);for(var _0x3b89b7=0x0,_0x225b78={},_0x4a740c={};_0x3b89b7<_0x18d0ef[_0xa426('0x3d')];_0x3b89b7+=0x1){_0x225b78=_0x18d0ef[_0x3b89b7];if(_[_0xa426('0x3e')](_0x309545[_0xa426('0x12')][util[_0xa426('0x23')](_0xa426('0x24'),_0x225b78[_0xa426('0x25')])])){_0x309545[_0xa426('0x12')][util[_0xa426('0x23')]('SIP/%s',_0x225b78[_0xa426('0x25')])]=new Trunk(_0x225b78);}else{_0x309545['mergeFromDatabase'](_0x309545['trunks'][util[_0xa426('0x23')]('SIP/%s',_0x225b78[_0xa426('0x25')])],_0x225b78);}}}return _0x309545[_0xa426('0x12')];};};Realtime[_0xa426('0x3a')][_0xa426('0x41')]=function(){var _0x50e487=this;return function(_0x3b2823){if(_0x3b2823){freeIsNotKey(_0x3b2823,_0x50e487[_0xa426('0x13')],_0xa426('0x25'));for(var _0x130c40=0x0,_0x30d61b={},_0x21ac30={};_0x130c40<_0x3b2823[_0xa426('0x3d')];_0x130c40+=0x1){_0x30d61b=_0x3b2823[_0x130c40];if(_[_0xa426('0x3e')](_0x50e487['voiceQueues'][_0x30d61b[_0xa426('0x25')]])){_0x50e487[_0xa426('0x13')][_0x30d61b['name']]=new VoiceQueue(_0x30d61b);}else{_0x50e487[_0xa426('0x3b')](_0x50e487[_0xa426('0x13')][_0x30d61b[_0xa426('0x25')]],_0x30d61b);}}}return _0x50e487[_0xa426('0x13')];};};Realtime[_0xa426('0x3a')][_0xa426('0x42')]=function(){var _0x73665d=this;return function(_0x4410bf){if(_0x4410bf){freeIsNotKey(_0x4410bf,_0x73665d[_0xa426('0x14')],'id');for(var _0x4ea8de=0x0,_0x59d87c={},_0x485673={};_0x4ea8de<_0x4410bf[_0xa426('0x3d')];_0x4ea8de+=0x1){_0x59d87c=_0x4410bf[_0x4ea8de];if(_['isUndefined'](_0x73665d[_0xa426('0x14')][_0x59d87c['id']])){_0x73665d[_0xa426('0x14')][_0x59d87c['id']]=new Trigger(_0x59d87c);}else{_0x73665d[_0xa426('0x3b')](_0x73665d['triggers'][_0x59d87c['id']],_0x59d87c);}}}return _0x73665d['triggers'];};};Realtime[_0xa426('0x3a')][_0xa426('0x43')]=function(){var _0x18dccd=this;return function(_0x52629b){if(_0x52629b){freeIsNotKey(_0x52629b,_0x18dccd['templates'],'id');for(var _0x40de1c=0x0,_0x5b255a={},_0x26c2b2={};_0x40de1c<_0x52629b['length'];_0x40de1c+=0x1){_0x5b255a=_0x52629b[_0x40de1c];if(_[_0xa426('0x3e')](_0x18dccd[_0xa426('0x16')][_0x5b255a['id']])){_0x18dccd[_0xa426('0x16')][_0x5b255a['id']]=new Template(_0x5b255a);}else{_0x18dccd['mergeFromDatabase'](_0x18dccd['templates'][_0x5b255a['id']],_0x5b255a);}}}return _0x18dccd[_0xa426('0x16')];};};Realtime['prototype'][_0xa426('0x44')]=function(){var _0x39da3a=this;return function(_0x3de1a7){if(_0x3de1a7){freeIsNotKey(_0x3de1a7,_0x39da3a[_0xa426('0x1d')],'id');for(var _0x4a9318=0x0,_0x5d4bef={},_0x35b0a5={};_0x4a9318<_0x3de1a7['length'];_0x4a9318+=0x1){_0x5d4bef=_0x3de1a7[_0x4a9318];if(_[_0xa426('0x3e')](_0x39da3a[_0xa426('0x1d')][_0x5d4bef['id']])){_0x39da3a[_0xa426('0x1d')][_0x5d4bef['id']]=new ZendeskAccount(_0x5d4bef);}else{_0x39da3a[_0xa426('0x3b')](_0x39da3a[_0xa426('0x1d')][_0x5d4bef['id']],_0x5d4bef);}}}return _0x39da3a['zendeskAccounts'];};};Realtime['prototype'][_0xa426('0x45')]=function(){var _0x3d6321=this;return function(_0xce7e){if(_0xce7e){freeIsNotKey(_0xce7e,_0x3d6321['salesforceAccounts'],'id');for(var _0x43f4ab=0x0,_0x49c41d={},_0x4c8e6b={};_0x43f4ab<_0xce7e[_0xa426('0x3d')];_0x43f4ab+=0x1){_0x49c41d=_0xce7e[_0x43f4ab];if(_['isUndefined'](_0x3d6321['salesforceAccounts'][_0x49c41d['id']])){_0x3d6321['salesforceAccounts'][_0x49c41d['id']]=new SalesforceAccount(_0x49c41d);}else{_0x3d6321['mergeFromDatabase'](_0x3d6321[_0xa426('0x46')][_0x49c41d['id']],_0x49c41d);}}}return _0x3d6321['salesforceAccounts'];};};Realtime[_0xa426('0x3a')][_0xa426('0x47')]=function(){var _0x4cc52b=this;return function(_0xa842ce){if(_0xa842ce){freeIsNotKey(_0xa842ce,_0x4cc52b[_0xa426('0x1e')],'id');for(var _0x3e770f=0x0,_0x11f0c2={},_0x59d416={};_0x3e770f<_0xa842ce[_0xa426('0x3d')];_0x3e770f+=0x1){_0x11f0c2=_0xa842ce[_0x3e770f];if(_[_0xa426('0x3e')](_0x4cc52b[_0xa426('0x1e')][_0x11f0c2['id']])){_0x4cc52b[_0xa426('0x1e')][_0x11f0c2['id']]=new FreshdeskAccount(_0x11f0c2);}else{_0x4cc52b[_0xa426('0x3b')](_0x4cc52b[_0xa426('0x1e')][_0x11f0c2['id']],_0x11f0c2);}}}return _0x4cc52b[_0xa426('0x1e')];};};Realtime['prototype'][_0xa426('0x48')]=function(){var _0xde3287=this;return function(_0x5d07ab){if(_0x5d07ab){freeIsNotKey(_0x5d07ab,_0xde3287[_0xa426('0x49')],'id');for(var _0x26606e=0x0,_0x436eeb={},_0x2c844a={};_0x26606e<_0x5d07ab[_0xa426('0x3d')];_0x26606e+=0x1){_0x436eeb=_0x5d07ab[_0x26606e];if(_[_0xa426('0x3e')](_0xde3287[_0xa426('0x49')][_0x436eeb['id']])){_0xde3287[_0xa426('0x49')][_0x436eeb['id']]=new ZohoAccount(_0x436eeb);}else{_0xde3287['mergeFromDatabase'](_0xde3287[_0xa426('0x49')][_0x436eeb['id']],_0x436eeb);}}}return _0xde3287[_0xa426('0x49')];};};Realtime[_0xa426('0x3a')]['initDeskAccounts']=function(){var _0x5a61ad=this;return function(_0x34d973){if(_0x34d973){freeIsNotKey(_0x34d973,_0x5a61ad[_0xa426('0x1f')],'id');for(var _0x5bb2da=0x0,_0xa845d6={},_0x2e252d={};_0x5bb2da<_0x34d973[_0xa426('0x3d')];_0x5bb2da+=0x1){_0xa845d6=_0x34d973[_0x5bb2da];if(_[_0xa426('0x3e')](_0x5a61ad[_0xa426('0x1f')][_0xa845d6['id']])){_0x5a61ad[_0xa426('0x1f')][_0xa845d6['id']]=new DeskAccount(_0xa845d6);}else{_0x5a61ad[_0xa426('0x3b')](_0x5a61ad['deskAccounts'][_0xa845d6['id']],_0xa845d6);}}}return _0x5a61ad[_0xa426('0x1f')];};};Realtime[_0xa426('0x3a')][_0xa426('0x4a')]=function(){var _0x317a48=this;return function(_0x11d17f){if(_0x11d17f){freeIsNotKey(_0x11d17f,_0x317a48[_0xa426('0x4b')],'id');for(var _0xff5b31=0x0,_0x2a7467={},_0x568286={};_0xff5b31<_0x11d17f[_0xa426('0x3d')];_0xff5b31+=0x1){_0x2a7467=_0x11d17f[_0xff5b31];if(_[_0xa426('0x3e')](_0x317a48[_0xa426('0x4b')][_0x2a7467['id']])){_0x317a48[_0xa426('0x4b')][_0x2a7467['id']]=new SugarcrmAccount(_0x2a7467);}else{_0x317a48[_0xa426('0x3b')](_0x317a48[_0xa426('0x4b')][_0x2a7467['id']],_0x2a7467);}}}return _0x317a48['sugarcrmAccounts'];};};Realtime[_0xa426('0x3a')][_0xa426('0x4c')]=function(){var _0x15d686=this;return function(_0x387ac4){if(_0x387ac4){freeIsNotKey(_0x387ac4,_0x15d686['vtigerAccounts'],'id');for(var _0x1438d6=0x0,_0x1d764f={},_0xf1e098={};_0x1438d6<_0x387ac4[_0xa426('0x3d')];_0x1438d6+=0x1){_0x1d764f=_0x387ac4[_0x1438d6];if(_[_0xa426('0x3e')](_0x15d686[_0xa426('0x4d')][_0x1d764f['id']])){_0x15d686['vtigerAccounts'][_0x1d764f['id']]=new VtigerAccount(_0x1d764f);}else{_0x15d686[_0xa426('0x3b')](_0x15d686[_0xa426('0x4d')][_0x1d764f['id']],_0x1d764f);}}}return _0x15d686[_0xa426('0x4d')];};};Realtime['prototype'][_0xa426('0x4e')]=function(){var _0x1e5845=this;return function(_0x502ef3){if(_0x502ef3){freeIsNotKey(_0x502ef3,_0x1e5845[_0xa426('0x4f')],'id');for(var _0x2d3b67=0x0,_0x3ccc9d={},_0x1bb35c={};_0x2d3b67<_0x502ef3[_0xa426('0x3d')];_0x2d3b67+=0x1){_0x3ccc9d=_0x502ef3[_0x2d3b67];if(_[_0xa426('0x3e')](_0x1e5845[_0xa426('0x4f')][_0x3ccc9d['id']])){_0x1e5845[_0xa426('0x4f')][_0x3ccc9d['id']]=new ServicenowAccount(_0x3ccc9d);}else{_0x1e5845['mergeFromDatabase'](_0x1e5845[_0xa426('0x4f')][_0x3ccc9d['id']],_0x3ccc9d);}}}return _0x1e5845[_0xa426('0x4f')];};};Realtime[_0xa426('0x3a')][_0xa426('0x50')]=function(){var _0x27a986=this;return function(_0x12943f){if(_0x12943f){freeIsNotKey(_0x12943f,_0x27a986[_0xa426('0x20')],'id');for(var _0x559491=0x0,_0x379ad7={},_0x3befb={};_0x559491<_0x12943f[_0xa426('0x3d')];_0x559491+=0x1){_0x379ad7=_0x12943f[_0x559491];if(_[_0xa426('0x3e')](_0x27a986[_0xa426('0x20')][_0x379ad7['id']])){_0x27a986[_0xa426('0x20')][_0x379ad7['id']]=new Dynamics365Account(_0x379ad7);}else{_0x27a986[_0xa426('0x3b')](_0x27a986[_0xa426('0x20')][_0x379ad7['id']],_0x379ad7);}}}return _0x27a986[_0xa426('0x20')];};};Realtime[_0xa426('0x3a')][_0xa426('0x51')]=function(){var _0x3a9a30=this;return function(_0x56c356){if(_0x56c356){freeIsNotKey(_0x56c356,_0x3a9a30[_0xa426('0x52')],'id');for(var _0x1c2fe3=0x0,_0x53f2cc={},_0x475e57={};_0x1c2fe3<_0x56c356[_0xa426('0x3d')];_0x1c2fe3+=0x1){_0x53f2cc=_0x56c356[_0x1c2fe3];if(_['isUndefined'](_0x3a9a30['freshsalesAccounts'][_0x53f2cc['id']])){_0x3a9a30[_0xa426('0x52')][_0x53f2cc['id']]=new FreshsalesAccount(_0x53f2cc);}else{_0x3a9a30[_0xa426('0x3b')](_0x3a9a30[_0xa426('0x52')][_0x53f2cc['id']],_0x53f2cc);}}}return _0x3a9a30[_0xa426('0x52')];};};Realtime[_0xa426('0x3a')][_0xa426('0x53')]=function(){var _0x5546c7=this;return function(_0x2a8155){for(var _0x1fcbe1=0x0;_0x1fcbe1<_0x2a8155[_0xa426('0x3d')];_0x1fcbe1+=0x1){_['merge'](_0x5546c7[_0xa426('0x13')][_0x2a8155[_0x1fcbe1][_0xa426('0x25')]],_0x2a8155[_0x1fcbe1]);}return _0x5546c7['voiceQueues'];};};Realtime[_0xa426('0x3a')][_0xa426('0x54')]=function(){var _0x49fd7d=this;return function(_0x29ca7d){clearVoiceQueues(_0x49fd7d[_0xa426('0x13')]);if(_0x29ca7d){_0x29ca7d=_[_0xa426('0x55')](_0x29ca7d,_0xa426('0x56'));for(var _0x48c170 in _0x29ca7d){if(_0x29ca7d[_0xa426('0x26')](_0x48c170)){var _0x52b8ac={};for(var _0xaec777=0x0;_0xaec777<_0x29ca7d[_0x48c170][_0xa426('0x3d')];_0xaec777+=0x1){var _0x40ec6a=_0x29ca7d[_0x48c170][_0xaec777]['queue'];if(_0x49fd7d['voiceQueues'][_0x40ec6a]){if(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x57')]){_0x49fd7d[_0xa426('0x13')][_0x40ec6a]['unmanaged']+=0x1;}if(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x58')]){_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2f')]+=0x1;}_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2b')]+=moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x59')])[_0xa426('0x5a')](moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5b')]),_0xa426('0x5c'))||0x0;if(_0xaec777===_0x29ca7d[_0x48c170]['length']-0x1){_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x30')]+=moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5d')]||_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5e')]||_0x29ca7d[_0x48c170][_0xaec777]['queuecallerexitAt'])[_0xa426('0x5a')](moment(_0x29ca7d[_0x48c170][_0xaec777]['queuecallerjoinAt']),'seconds')||0x0;_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x29')]+=0x1;if(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x5f')]){_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2a')]+=0x1;_0x49fd7d[_0xa426('0x13')][_0x40ec6a]['sumBillable']+=moment(_0x29ca7d[_0x48c170][_0xaec777]['queuecallercompleteAt'])['diff'](moment(_0x29ca7d[_0x48c170][_0xaec777][_0xa426('0x59')]),_0xa426('0x5c'))||0x0;}}else{_0x49fd7d['voiceQueues'][_0x40ec6a][_0xa426('0x30')]+=_0x49fd7d[_0xa426('0x13')][_0x40ec6a][_0xa426('0x2b')]||0x0;}}}}}}return _0x49fd7d[_0xa426('0x13')];};};Realtime[_0xa426('0x3a')][_0xa426('0x60')]=function(){var _0x2576d6=this;return function(_0x493d70){clearVoiceCallReports(_0x2576d6['outbound']);if(_0x493d70){for(var _0x389da1=0x0;_0x389da1<_0x493d70['length'];_0x389da1+=0x1){_0x2576d6['outbound'][_0xa426('0x29')]+=0x1;_0x2576d6[_0xa426('0x17')][_0xa426('0x30')]+=_0x493d70[_0x389da1][_0xa426('0x61')];if(_0x493d70[_0x389da1][_0xa426('0x62')]===_0xa426('0x63')){_0x2576d6['outbound'][_0xa426('0x2a')]+=0x1;_0x2576d6[_0xa426('0x17')]['sumHoldTime']+=_0x493d70[_0x389da1][_0xa426('0x61')]-_0x493d70[_0x389da1]['billableseconds']||0x0;_0x2576d6[_0xa426('0x17')][_0xa426('0x2c')]+=_0x493d70[_0x389da1][_0xa426('0x64')];}}}return _0x2576d6['outbound'];};};Realtime[_0xa426('0x3a')][_0xa426('0x65')]=function(){var _0x33449d=this;return function(_0x2c22ab){if(_0x2c22ab){freeIsNotKey(_0x2c22ab,_0x33449d['campaigns'],_0xa426('0x25'));for(var _0x2d25d6=0x0,_0x462032={};_0x2d25d6<_0x2c22ab[_0xa426('0x3d')];_0x2d25d6+=0x1){_0x462032=_0x2c22ab[_0x2d25d6];if(_[_0xa426('0x3e')](_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]])){_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]]=new Campaign(_0x462032);}else{_0x33449d[_0xa426('0x3b')](_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]],_0x462032);_0x33449d[_0xa426('0x15')][_0x462032[_0xa426('0x25')]][_0xa426('0x66')]=_0x462032[_0xa426('0x67')]?_0x462032[_0xa426('0x67')][_0xa426('0x25')]:undefined;}}}return _0x33449d['campaigns'];};};Realtime[_0xa426('0x3a')][_0xa426('0x68')]=function(){var _0xfbcf9=this;return function(_0x10fdfa){if(_0x10fdfa){freeIsNotKey(_0x10fdfa,_0xfbcf9[_0xa426('0x18')],'id');for(var _0x1acfb9=0x0,_0x4cba32={};_0x1acfb9<_0x10fdfa[_0xa426('0x3d')];_0x1acfb9+=0x1){_0x4cba32=_0x10fdfa[_0x1acfb9];if(_['isUndefined'](_0xfbcf9[_0xa426('0x18')][_0x4cba32['id']])){_0xfbcf9['voiceExtensions'][_0x4cba32['id']]=new VoiceExtension(_0x4cba32);}else{_0xfbcf9[_0xa426('0x3b')](_0xfbcf9[_0xa426('0x18')][_0x4cba32['id']],_0x4cba32);}}}return _0xfbcf9[_0xa426('0x18')];};};Realtime['prototype'][_0xa426('0x69')]=function(){var _0x308074=this;return function(_0x1f01ed){clearCampaigns(_0x308074['campaigns']);for(var _0x529cda=0x0;_0x529cda<_0x1f01ed[_0xa426('0x3d')];_0x529cda+=0x1){_['merge'](_0x308074['campaigns'][_0x1f01ed[_0x529cda]['name']],_0x1f01ed[_0x529cda]);}return _0x308074['campaigns'];};};Realtime['prototype'][_0xa426('0x6a')]=function(){var _0x5d409d=this;return function(_0xef4b57){if(_0xef4b57){freeIsNotKey(_0xef4b57,_0x5d409d[_0xa426('0x21')],'id');for(var _0x39f7fb=0x0,_0x4273b2={},_0x51c374={};_0x39f7fb<_0xef4b57[_0xa426('0x3d')];_0x39f7fb+=0x1){_0x4273b2=_0xef4b57[_0x39f7fb];if(_[_0xa426('0x3e')](_0x5d409d[_0xa426('0x21')][_0x4273b2['id']])){_0x5d409d[_0xa426('0x21')][_0x4273b2['id']]=new FaxAccount(_0x4273b2);}else{_0x5d409d[_0xa426('0x3b')](_0x5d409d[_0xa426('0x21')][_0x4273b2['id']],_0x4273b2);}}}return _0x5d409d['faxAccounts'];};};module[_0xa426('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0496c9e..7ca6422 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 _0x1a62=['originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','connectedlinenum','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','create','startsWith','indexOf','mobile','phone','substring','transfererlinkedid','exports','lodash','moment','../../../config/environment','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','name','isNil','accountcode','SIP/%s','voiceQueueReport','length','assigned','lastAssignedTo','interface','format','queuecallercomplete','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x1a62,0x1dc));var _0x21a6=function(_0x20ea90,_0x263730){_0x20ea90=_0x20ea90-0x0;var _0x9f6f6d=_0x1a62[_0x20ea90];return _0x9f6f6d;};'use strict';var _=require(_0x21a6('0x0'));var moment=require(_0x21a6('0x1'));var util=require('util');var config=require(_0x21a6('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x21a6('0x3'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x21a6('0x4'));var RpcVoiceTransferReport=require(_0x21a6('0x5'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x21a6('0x6'));var VoiceAgentReport=require(_0x21a6('0x7'));var VoiceDialReport=require(_0x21a6('0x8'));var UserReport=require(_0x21a6('0x9'));function Report(_0x53e4de){this[_0x21a6('0xa')]=_0x53e4de;this[_0x21a6('0xb')]=_0x53e4de[_0x21a6('0xb')];this[_0x21a6('0xc')]=_0x53e4de['telephones'];}Report['prototype'][_0x21a6('0xd')]=function(_0x260ff0){var _0x901a42=new VoiceQueueReport(this[_0x21a6('0xa')]);var _0x444d2a=new VoiceAgentReport(this[_0x21a6('0xa')]);var _0x42f79c=new VoiceDialReport(this[_0x21a6('0xa')]);var _0x220920=new VoiceCallReport(this[_0x21a6('0xa')]);var _0x567d1f=new UserReport(this[_0x21a6('0xa')]);if(config[_0x21a6('0xe')]&&config[_0x21a6('0xe')][_0x21a6('0xf')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x11'),this['voiceCallReport'][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x12'),this[_0x21a6('0x13')][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x14'),this[_0x21a6('0x15')][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x16'),this[_0x21a6('0x17')][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x18'),this[_0x21a6('0x19')]['bind'](this));}};Report[_0x21a6('0x1a')][_0x21a6('0x1b')]=function(_0x3276cd){var _0x8402c1;_0x8402c1=_[_0x21a6('0x1c')](this['agents'],function(_0xd61e1b){return _0xd61e1b['accountcode']==_0x3276cd||_0xd61e1b[_0x21a6('0x1d')]==_0x3276cd;});if(_[_0x21a6('0x1e')](_0x8402c1)){var _0x4d9938=_[_0x21a6('0x1c')](this[_0x21a6('0xc')],function(_0x212bc5){return _0x212bc5[_0x21a6('0x1f')]==_0x3276cd||_0x212bc5[_0x21a6('0x1d')]==_0x3276cd;});if(_0x4d9938){_0x8402c1=_[_0x21a6('0x1c')](this[_0x21a6('0xb')],function(_0x63f0c7){return _0x63f0c7['interface']==util['format'](_0x21a6('0x20'),_0x4d9938[_0x21a6('0x1d')]);});}}return _0x8402c1;};Report[_0x21a6('0x1a')][_0x21a6('0x21')]=function(_0x3ff6db){for(var _0x119109=0x0;_0x119109<_0x3ff6db[_0x21a6('0x22')];_0x119109+=0x1){var _0x5cda1a=this[_0x21a6('0x1b')](_0x3ff6db[_0x119109]['connectedlinenum']);if(_0x5cda1a){_0x3ff6db[_0x119109][_0x21a6('0x1f')]=_0x5cda1a[_0x21a6('0x1f')];_0x3ff6db[_0x119109][_0x21a6('0x23')]=!![];_0x3ff6db[_0x119109][_0x21a6('0x24')]=_0x5cda1a[_0x21a6('0x1d')];_0x3ff6db[_0x119109][_0x21a6('0x25')]=_['isNil'](_0x5cda1a['interface'])?util[_0x21a6('0x26')](_0x21a6('0x20'),_0x5cda1a['name']):_0x5cda1a[_0x21a6('0x25')];if(_0x3ff6db[_0x119109][_0x21a6('0x27')]){_0x3ff6db[_0x119109]['queuecallercompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3ff6db[_0x119109][_0x21a6('0x28')]){_0x3ff6db[_0x119109][_0x21a6('0x29')]=moment()[_0x21a6('0x26')](_0x21a6('0x2a'));}RpcMemberReport[_0x21a6('0x21')](_0x3ff6db[_0x119109]);}RpcVoiceQueueReport['create'](_0x3ff6db[_0x119109]);}};function extractCalleridNumber(_0x135501){var _0xd69b59=_0x135501[_0x21a6('0x2b')](/<(.*?)>/);return _0xd69b59?_0xd69b59[0x1]:_0x135501;}Report[_0x21a6('0x1a')][_0x21a6('0x2c')]=function(_0x32dafd){_0x32dafd[_0x21a6('0x2d')]=_0x32dafd[_0x21a6('0x2d')]||_0x32dafd[_0x21a6('0x2e')];if(_0x32dafd[_0x21a6('0x2f')]==_0x21a6('0x30')){_0x32dafd[_0x21a6('0x31')]=_0x21a6('0x32');_0x32dafd[_0x21a6('0x33')]=_0x32dafd['queue'];if(_0x32dafd[_0x21a6('0x34')]==_0x21a6('0x35')){_0x32dafd[_0x21a6('0x1f')]='';_0x32dafd[_0x21a6('0x2d')]=extractCalleridNumber(_0x32dafd['callerid']);}else if(_0x32dafd[_0x21a6('0x34')]==_0x21a6('0x36')){if(_0x32dafd[_0x21a6('0x2d')]==_0x21a6('0x37')){_0x32dafd[_0x21a6('0x2d')]=extractCalleridNumber(_0x32dafd[_0x21a6('0x38')]);_0x32dafd[_0x21a6('0x39')]=_0x32dafd[_0x21a6('0x3a')];_0x32dafd[_0x21a6('0x3b')]=[_0x32dafd['channel'],_0x32dafd[_0x21a6('0x3c')]=_0x32dafd[_0x21a6('0x3b')]][0x0];_0x32dafd[_0x21a6('0x3d')]=_0x32dafd['calleridpreview'];}else{_0x32dafd[_0x21a6('0x2d')]=_0x32dafd['calleridnum'];_0x32dafd[_0x21a6('0x39')]=_0x32dafd['originatecalleridnum'];if(_0x32dafd[_0x21a6('0x3e')]==_0x21a6('0x3f')){_0x32dafd[_0x21a6('0x1f')]=_0x32dafd['connectedlinenum'];}else{_0x32dafd['accountcode']='';}}}}else{_0x32dafd[_0x21a6('0x3d')]=util['format'](_0x21a6('0x40'),_0x32dafd[_0x21a6('0x41')],_0x32dafd[_0x21a6('0x39')]);}if(RpcVoiceTransferReport[_0x21a6('0x42')][_0x32dafd[_0x21a6('0x43')]]){var _0x23d959=RpcVoiceTransferReport[_0x21a6('0x42')][_0x32dafd[_0x21a6('0x43')]];_0x23d959[_0x21a6('0x44')]=_0x32dafd[_0x21a6('0x45')];RpcVoiceTransferReport['blindTransfer'](_0x23d959);delete RpcVoiceTransferReport[_0x21a6('0x42')][_0x32dafd['linkedid']];}RpcVoiceCallReport['create'](_0x32dafd);if(_0x32dafd[_0x21a6('0x46')]){for(var _0xa3cac8=0x0;_0xa3cac8<_0x32dafd['monitors'][_0x21a6('0x22')];_0xa3cac8+=0x1){_0x32dafd[_0x21a6('0x47')]=_0x32dafd[_0x21a6('0x48')][_0xa3cac8][_0x21a6('0x49')];_0x32dafd[_0x21a6('0x4a')]=_0x32dafd[_0x21a6('0x48')][_0xa3cac8][_0x21a6('0x4a')];if(_0x32dafd[_0x21a6('0x2e')]=='xcally-motion-preview'){_0x32dafd['calleridnum']=_0x32dafd[_0x21a6('0x4b')];_0x32dafd[_0x21a6('0x41')]=_0x32dafd[_0x21a6('0x4c')];_0x32dafd[_0x21a6('0x4b')]=_0x32dafd[_0x21a6('0x1f')];_0x32dafd[_0x21a6('0x4c')]=_0x32dafd[_0x21a6('0x4d')];_0x32dafd[_0x21a6('0x2e')]=_0x32dafd[_0x21a6('0x3a')];}else if(_0x32dafd[_0x21a6('0x2e')]==_0x21a6('0x4e')){_0x32dafd[_0x21a6('0x39')]=_0x32dafd[_0x21a6('0x2d')];_0x32dafd['exten']=_0x32dafd[_0x21a6('0x3a')];}RpcVoiceRecording['create'](_0x32dafd);}}};Report['prototype'][_0x21a6('0x13')]=function(_0x5413e6){if(_[_0x21a6('0x4f')](_0x5413e6)){_0x5413e6[_0x21a6('0x50')](function(_0x40800d){RpcVoiceAgentReport[_0x21a6('0x51')](_0x40800d);});}else{RpcVoiceAgentReport['create'](_0x5413e6);}};Report[_0x21a6('0x1a')][_0x21a6('0x15')]=function(_0x22ea1f){RpcVoiceDialReport['create'](_0x22ea1f);var _0xe459e;var _0x47843d;var _0x3c4050=_0x22ea1f[_0x21a6('0x3c')];if(_[_0x21a6('0x52')](_0x3c4050,'Local')){_0x47843d=_0x3c4050['substring'](_0x3c4050[_0x21a6('0x53')]('/')+0x1,_0x3c4050[_0x21a6('0x53')]('@'));_0xe459e=_[_0x21a6('0x1c')](this['agents'],function(_0x40067f){return _0x40067f[_0x21a6('0x54')]==_0x47843d||_0x40067f[_0x21a6('0x55')]==_0x47843d||_0x40067f[_0x21a6('0x1f')]==_0x47843d;});}else{_0x47843d=_0x3c4050[_0x21a6('0x56')](_0x3c4050['indexOf']('/')+0x1,_0x3c4050['lastIndexOf']('-'));_0xe459e=this[_0x21a6('0x1b')](_0x47843d);}if(_0xe459e){_0x22ea1f[_0x21a6('0x25')]=_[_0x21a6('0x1e')](_0xe459e[_0x21a6('0x25')])?util[_0x21a6('0x26')](_0x21a6('0x20'),_0xe459e[_0x21a6('0x1d')]):_0xe459e[_0x21a6('0x25')];_0x22ea1f[_0x21a6('0x4d')]=_0xe459e[_0x21a6('0x1d')];_0x22ea1f[_0x21a6('0x1f')]=_0xe459e['accountcode'];RpcMemberReport['voiceDialReport'](_0x22ea1f);}};Report[_0x21a6('0x1a')][_0x21a6('0x17')]=function(_0x347456){RpcVoiceTransferReport[_0x21a6('0x42')][_0x347456[_0x21a6('0x57')]]=_0x347456;};Report[_0x21a6('0x1a')][_0x21a6('0x19')]=function(_0x3a0172){RpcVoiceTransferReport[_0x21a6('0x19')](_0x3a0172);};module[_0x21a6('0x58')]=Report; \ No newline at end of file +var _0xadb9=['blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','interface','format','SIP/%s','voiceQueueReport','connectedlinenum','assigned','lastAssignedTo','name','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','transfers','linkedid','create','monitor','monitors','length','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','substring','mobile','phone','indexOf','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','xdr','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport'];(function(_0xfab68e,_0x24ffff){var _0x4e9380=function(_0x59b6fa){while(--_0x59b6fa){_0xfab68e['push'](_0xfab68e['shift']());}};_0x4e9380(++_0x24ffff);}(_0xadb9,0x188));var _0x9adb=function(_0x20b8d,_0x471e78){_0x20b8d=_0x20b8d-0x0;var _0x44b833=_0xadb9[_0x20b8d];return _0x44b833;};'use strict';var _=require(_0x9adb('0x0'));var moment=require(_0x9adb('0x1'));var util=require(_0x9adb('0x2'));var config=require(_0x9adb('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9adb('0x4'));var RpcVoiceCallReport=require(_0x9adb('0x5'));var RpcVoiceDialReport=require(_0x9adb('0x6'));var RpcMemberReport=require(_0x9adb('0x7'));var RpcVoiceQueueReport=require(_0x9adb('0x8'));var RpcVoiceRecording=require(_0x9adb('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x9adb('0xa'));var VoiceCallReport=require(_0x9adb('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x9adb('0xc'));function Report(_0x568761){this[_0x9adb('0xd')]=_0x568761;this[_0x9adb('0xe')]=_0x568761[_0x9adb('0xe')];this[_0x9adb('0xf')]=_0x568761[_0x9adb('0xf')];}Report[_0x9adb('0x10')]['sync']=function(_0x5b38e3){var _0x2c107c=new VoiceQueueReport(this[_0x9adb('0xd')]);var _0x418d2d=new VoiceAgentReport(this[_0x9adb('0xd')]);var _0x291521=new VoiceDialReport(this[_0x9adb('0xd')]);var _0xe3a882=new VoiceCallReport(this[_0x9adb('0xd')]);var _0x1c4672=new UserReport(this[_0x9adb('0xd')]);if(config['xdr']&&config[_0x9adb('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this[_0x9adb('0x12')][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x14'),this[_0x9adb('0x15')][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x16'),this['voiceDialReport'][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x17'),this[_0x9adb('0x18')][_0x9adb('0x13')](this));ami['on'](_0x9adb('0x19'),this[_0x9adb('0x1a')][_0x9adb('0x13')](this));}};Report[_0x9adb('0x10')][_0x9adb('0x1b')]=function(_0x36260d){var _0x4cc329;_0x4cc329=_[_0x9adb('0x1c')](this['agents'],function(_0x8827f2){return _0x8827f2['accountcode']==_0x36260d||_0x8827f2['name']==_0x36260d;});if(_[_0x9adb('0x1d')](_0x4cc329)){var _0x9eafde=_['find'](this['telephones'],function(_0x31103b){return _0x31103b[_0x9adb('0x1e')]==_0x36260d||_0x31103b['name']==_0x36260d;});if(_0x9eafde){_0x4cc329=_[_0x9adb('0x1c')](this[_0x9adb('0xe')],function(_0x46fb9e){return _0x46fb9e[_0x9adb('0x1f')]==util[_0x9adb('0x20')](_0x9adb('0x21'),_0x9eafde['name']);});}}return _0x4cc329;};Report[_0x9adb('0x10')][_0x9adb('0x22')]=function(_0x6bd8ca){for(var _0x2bd13c=0x0;_0x2bd13c<_0x6bd8ca['length'];_0x2bd13c+=0x1){var _0x4c13d5=this[_0x9adb('0x1b')](_0x6bd8ca[_0x2bd13c][_0x9adb('0x23')]);if(_0x4c13d5){_0x6bd8ca[_0x2bd13c]['accountcode']=_0x4c13d5['accountcode'];_0x6bd8ca[_0x2bd13c][_0x9adb('0x24')]=!![];_0x6bd8ca[_0x2bd13c][_0x9adb('0x25')]=_0x4c13d5['name'];_0x6bd8ca[_0x2bd13c][_0x9adb('0x1f')]=_['isNil'](_0x4c13d5[_0x9adb('0x1f')])?util[_0x9adb('0x20')](_0x9adb('0x21'),_0x4c13d5[_0x9adb('0x26')]):_0x4c13d5[_0x9adb('0x1f')];if(_0x6bd8ca[_0x2bd13c][_0x9adb('0x27')]){_0x6bd8ca[_0x2bd13c]['queuecallercompleteAt']=moment()[_0x9adb('0x20')](_0x9adb('0x28'));}if(_0x6bd8ca[_0x2bd13c]['queuecallerexit']){_0x6bd8ca[_0x2bd13c]['queuecallerexitAt']=moment()[_0x9adb('0x20')](_0x9adb('0x28'));}RpcMemberReport[_0x9adb('0x22')](_0x6bd8ca[_0x2bd13c]);}RpcVoiceQueueReport['create'](_0x6bd8ca[_0x2bd13c]);}};function extractCalleridNumber(_0x1ce746){var _0x1ffa10=_0x1ce746[_0x9adb('0x29')](/<(.*?)>/);return _0x1ffa10?_0x1ffa10[0x1]:_0x1ce746;}Report[_0x9adb('0x10')][_0x9adb('0x12')]=function(_0x599df7){_0x599df7[_0x9adb('0x2a')]=_0x599df7[_0x9adb('0x2a')]||_0x599df7[_0x9adb('0x2b')];if(_0x599df7[_0x9adb('0x2c')]==_0x9adb('0x2d')){_0x599df7[_0x9adb('0x2e')]=_0x9adb('0x2f');_0x599df7[_0x9adb('0x30')]=_0x599df7[_0x9adb('0x2f')];if(_0x599df7[_0x9adb('0x31')]=='from-voip-provider'){_0x599df7['accountcode']='';_0x599df7[_0x9adb('0x2a')]=extractCalleridNumber(_0x599df7[_0x9adb('0x32')]);}else if(_0x599df7[_0x9adb('0x31')]==_0x9adb('0x33')){if(_0x599df7[_0x9adb('0x2a')]==_0x9adb('0x34')){_0x599df7[_0x9adb('0x2a')]=extractCalleridNumber(_0x599df7[_0x9adb('0x35')]);_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x37')];_0x599df7['destinationchannel']=[_0x599df7[_0x9adb('0x38')],_0x599df7['channel']=_0x599df7[_0x9adb('0x39')]][0x0];_0x599df7[_0x9adb('0x32')]=_0x599df7[_0x9adb('0x35')];}else{_0x599df7[_0x9adb('0x2a')]=_0x599df7['calleridnum'];_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x37')];if(_0x599df7[_0x9adb('0x3a')]==_0x9adb('0x3b')){_0x599df7[_0x9adb('0x1e')]=_0x599df7[_0x9adb('0x23')];}else{_0x599df7[_0x9adb('0x1e')]='';}}}}else{_0x599df7[_0x9adb('0x32')]=util[_0x9adb('0x20')]('\x22%s\x22\x20<%s>',_0x599df7['calleridname'],_0x599df7['calleridnum']);}if(RpcVoiceTransferReport[_0x9adb('0x3c')][_0x599df7['linkedid']]){var _0x56cabb=RpcVoiceTransferReport[_0x9adb('0x3c')][_0x599df7[_0x9adb('0x3d')]];_0x56cabb['transfereelinkedid']=_0x599df7['uniqueid'];RpcVoiceTransferReport[_0x9adb('0x18')](_0x56cabb);delete RpcVoiceTransferReport['transfers'][_0x599df7[_0x9adb('0x3d')]];}RpcVoiceCallReport[_0x9adb('0x3e')](_0x599df7);if(_0x599df7[_0x9adb('0x3f')]){for(var _0x496bc4=0x0;_0x496bc4<_0x599df7[_0x9adb('0x40')][_0x9adb('0x41')];_0x496bc4+=0x1){_0x599df7['monitorFilename']=_0x599df7[_0x9adb('0x40')][_0x496bc4][_0x9adb('0x42')];_0x599df7['createdAt']=_0x599df7[_0x9adb('0x40')][_0x496bc4][_0x9adb('0x43')];if(_0x599df7['exten']==_0x9adb('0x34')){_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x23')];_0x599df7[_0x9adb('0x44')]=_0x599df7[_0x9adb('0x45')];_0x599df7[_0x9adb('0x23')]=_0x599df7[_0x9adb('0x1e')];_0x599df7[_0x9adb('0x45')]=_0x599df7[_0x9adb('0x46')];_0x599df7[_0x9adb('0x2b')]=_0x599df7['originatecalleridnum'];}else if(_0x599df7['exten']==_0x9adb('0x47')){_0x599df7[_0x9adb('0x36')]=_0x599df7[_0x9adb('0x2a')];_0x599df7[_0x9adb('0x2b')]=_0x599df7[_0x9adb('0x37')];}RpcVoiceRecording[_0x9adb('0x3e')](_0x599df7);}}};Report[_0x9adb('0x10')][_0x9adb('0x15')]=function(_0x2309e1){if(_[_0x9adb('0x48')](_0x2309e1)){_0x2309e1[_0x9adb('0x49')](function(_0x2c71e8){RpcVoiceAgentReport[_0x9adb('0x3e')](_0x2c71e8);});}else{RpcVoiceAgentReport[_0x9adb('0x3e')](_0x2309e1);}};Report[_0x9adb('0x10')][_0x9adb('0x4a')]=function(_0x1bfc56){RpcVoiceDialReport['create'](_0x1bfc56);var _0x1cc446;var _0x30e827;var _0x20a0ca=_0x1bfc56[_0x9adb('0x38')];if(_[_0x9adb('0x4b')](_0x20a0ca,'Local')){_0x30e827=_0x20a0ca[_0x9adb('0x4c')](_0x20a0ca['indexOf']('/')+0x1,_0x20a0ca['indexOf']('@'));_0x1cc446=_[_0x9adb('0x1c')](this[_0x9adb('0xe')],function(_0x307b75){return _0x307b75[_0x9adb('0x4d')]==_0x30e827||_0x307b75[_0x9adb('0x4e')]==_0x30e827||_0x307b75[_0x9adb('0x1e')]==_0x30e827;});}else{_0x30e827=_0x20a0ca[_0x9adb('0x4c')](_0x20a0ca[_0x9adb('0x4f')]('/')+0x1,_0x20a0ca[_0x9adb('0x50')]('-'));_0x1cc446=this[_0x9adb('0x1b')](_0x30e827);}if(_0x1cc446){_0x1bfc56[_0x9adb('0x1f')]=_[_0x9adb('0x1d')](_0x1cc446['interface'])?util[_0x9adb('0x20')]('SIP/%s',_0x1cc446[_0x9adb('0x26')]):_0x1cc446[_0x9adb('0x1f')];_0x1bfc56[_0x9adb('0x46')]=_0x1cc446[_0x9adb('0x26')];_0x1bfc56[_0x9adb('0x1e')]=_0x1cc446['accountcode'];RpcMemberReport[_0x9adb('0x4a')](_0x1bfc56);}};Report[_0x9adb('0x10')][_0x9adb('0x18')]=function(_0x41807d){RpcVoiceTransferReport[_0x9adb('0x3c')][_0x41807d[_0x9adb('0x51')]]=_0x41807d;};Report['prototype'][_0x9adb('0x1a')]=function(_0x3a151a){RpcVoiceTransferReport[_0x9adb('0x1a')](_0x3a151a);};module[_0x9adb('0x52')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 9791058..02decce 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 _0xf58a=['telephone:%s','telephone:save','startsWith','Local','indexOf','find','phone','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','exports','moment','util','bluebird','../../../config/environment','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registry','syncRegistry','devicestatechange','syncDeviceState','bind','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','inspect','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','state','merge','event','actionid','format','trunk:%s','name','[userReport][registry]','[userReport][devicestatechange]','device','inuse','local','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:'];(function(_0x163bea,_0x149878){var _0x4630c4=function(_0x2d06d8){while(--_0x2d06d8){_0x163bea['push'](_0x163bea['shift']());}};_0x4630c4(++_0x149878);}(_0xf58a,0xde));var _0xaf58=function(_0x10ff5e,_0x34be81){_0x10ff5e=_0x10ff5e-0x0;var _0x5f0325=_0xf58a[_0x10ff5e];return _0x5f0325;};'use strict';var _=require('lodash');var moment=require(_0xaf58('0x0'));var util=require(_0xaf58('0x1'));var Redis=require('ioredis');var BPromise=require(_0xaf58('0x2'));var config=require(_0xaf58('0x3'));var logger=require('../../../config/logger')(_0xaf58('0x4'));var ami=require(_0xaf58('0x5'));config[_0xaf58('0x6')]=_['defaults'](config[_0xaf58('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xaf58('0x7'))(new Redis(config[_0xaf58('0x6')]));function UserReport(_0xc6d6cb){this[_0xaf58('0x8')]=_0xc6d6cb[_0xaf58('0x8')];this['agents']=_0xc6d6cb[_0xaf58('0x9')];this[_0xaf58('0xa')]=_0xc6d6cb[_0xaf58('0xa')];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on'](_0xaf58('0xb'),this[_0xaf58('0xc')]['bind'](this));ami['on'](_0xaf58('0xd'),this[_0xaf58('0xe')][_0xaf58('0xf')](this));ami['on'](_0xaf58('0x10'),this[_0xaf58('0x11')][_0xaf58('0xf')](this));return this[_0xaf58('0x12')]();}function showSipRegistrations(){Promise[_0xaf58('0x13')]()[_0xaf58('0x14')](ami[_0xaf58('0x15')]())[_0xaf58('0x16')](function(_0x1a14cb){logger[_0xaf58('0x17')](_0xaf58('0x18'),util['inspect'](_0x1a14cb,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xaf58('0x13')]()[_0xaf58('0x14')](ami[_0xaf58('0x19')]())[_0xaf58('0x16')](function(_0x74b1f0){logger[_0xaf58('0x17')](_0xaf58('0x1a'),util['inspect'](_0x74b1f0,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xaf58('0x14')](ami[_0xaf58('0x1b')]())[_0xaf58('0x16')](function(_0x2a7ba6){logger[_0xaf58('0x17')](_0xaf58('0x1c'),util[_0xaf58('0x1d')](_0x2a7ba6,{'showHidden':![],'depth':null}));});}UserReport[_0xaf58('0x1e')][_0xaf58('0x12')]=function(){setInterval(function(){BPromise['resolve']()[_0xaf58('0x14')](showSipRegistrations())[_0xaf58('0x14')](listDeviceStates())[_0xaf58('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xaf58('0x1e')]['isNotNull']=function(_0x4ee83d){return _0x4ee83d!==null&&!_[_0xaf58('0x1f')](_0x4ee83d);};UserReport[_0xaf58('0x1e')]['emit']=function(_0xc0069a,_0xc328d2,_0x6fecbe){io['to'](_0xc0069a)[_0xaf58('0x20')](_0xc328d2,_0x6fecbe);};UserReport['prototype'][_0xaf58('0xc')]=function(_0x4dfd32){try{if(this[_0xaf58('0x21')](_0x4dfd32)){logger[_0xaf58('0x22')](_0xaf58('0x23'),_0x4dfd32[_0xaf58('0x24')],_0x4dfd32['state']);logger[_0xaf58('0x25')]('[userReport][registry]',util['inspect'](_0x4dfd32,{'showHidden':![],'depth':null}));var _0x4b1978=_['find'](this[_0xaf58('0x8')],{'registry':_0x4dfd32[_0xaf58('0x24')]});if(_0x4b1978){_0x4dfd32['stateRegistry']=_0x4dfd32[_0xaf58('0x26')];_[_0xaf58('0x27')](_0x4b1978,_['omit'](_0x4dfd32,[_0xaf58('0x28'),_0xaf58('0x29'),'username',_0xaf58('0x26')]));logger[_0xaf58('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xaf58('0x1d')](_0x4b1978,{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')](_0xaf58('0x2b'),_0x4b1978[_0xaf58('0x2c')]),'trunk:save',_0x4b1978);}}}catch(_0x11a7f1){logger['error'](_0xaf58('0x2d'),util[_0xaf58('0x1d')](_0x11a7f1,{'showHidden':![],'depth':null}));}};UserReport[_0xaf58('0x1e')][_0xaf58('0xe')]=function(_0x2306c0){try{if(this['isNotNull'](_0x2306c0)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x2306c0['device'],_0x2306c0['state']);logger[_0xaf58('0x25')](_0xaf58('0x2e'),util[_0xaf58('0x1d')](_0x2306c0,{'showHidden':![],'depth':null}));if(this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]]){if(!this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]]['local']||_0x2306c0['state']['toLowerCase']()==_0xaf58('0x30')){this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x31')]=![];if(this['agents'][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x26')]!==_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]()){this[_0xaf58('0x9')][_0x2306c0['device']][_0xaf58('0x33')]=_[_0xaf58('0x34')](moment()[_0xaf58('0x2a')]('x'));}this['agents'][_0x2306c0[_0xaf58('0x2f')]]['state']=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]]['updateStatusRealtime'](_0x2306c0);}}else if(this[_0xaf58('0xa')][_0x2306c0['device']]){if(this[_0xaf58('0xa')][_0x2306c0[_0xaf58('0x2f')]]['state']!==_0x2306c0[_0xaf58('0x26')]['toLowerCase']()){this[_0xaf58('0xa')][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x33')]=_['toNumber'](moment()[_0xaf58('0x2a')]('x'));}this['telephones'][_0x2306c0['device']][_0xaf58('0x26')]=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();logger[_0xaf58('0x25')](_0xaf58('0x35'),util['inspect'](this['telephones'][_0x2306c0[_0xaf58('0x2f')]],{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')](_0xaf58('0x36'),this['telephones'][_0x2306c0['device']][_0xaf58('0x2c')]),_0xaf58('0x37'),this[_0xaf58('0xa')][_0x2306c0['device']]);}else if(this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]]){if(this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]]['state']!==_0x2306c0[_0xaf58('0x26')]['toLowerCase']()){this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x33')]=_[_0xaf58('0x34')](moment()[_0xaf58('0x2a')]('x'));}this[_0xaf58('0x8')][_0x2306c0['device']][_0xaf58('0x26')]=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();logger[_0xaf58('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xaf58('0x1d')](this['trunks'][_0x2306c0['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xaf58('0x2b'),this['trunks'][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x2c')]),'trunk:save',this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]]);}else if(_[_0xaf58('0x38')](_0x2306c0['device'],_0xaf58('0x39'))){var _0x31a248=_0x2306c0['device'];var _0xce0b56=_0x31a248['substring'](_0x31a248[_0xaf58('0x3a')]('/')+0x1,_0x31a248[_0xaf58('0x3a')]('@'));var _0x417d15=_[_0xaf58('0x3b')](this['agents'],function(_0x1acf0b){return _0x1acf0b['mobile']==_0xce0b56||_0x1acf0b[_0xaf58('0x3c')]==_0xce0b56||_0x1acf0b['accountcode']==_0xce0b56;});if(_0x417d15){if(_0x417d15[_0xaf58('0x26')]!==_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]()){_0x417d15[_0xaf58('0x33')]=_[_0xaf58('0x34')](moment()['format']('x'));}_0x417d15[_0xaf58('0x26')]=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();_0x417d15['local']=!![];_0x417d15['updateStatusRealtime'](_0x2306c0);}}}}catch(_0x3aa0f9){logger['error']('[userReport][devicestatechange]',util[_0xaf58('0x1d')](_0x3aa0f9,{'showHidden':![],'depth':null}));}};UserReport[_0xaf58('0x1e')][_0xaf58('0x11')]=function(_0x4f632d){try{if(this[_0xaf58('0x21')](_0x4f632d)&&this[_0xaf58('0x21')](_0x4f632d['peerstatus'])){logger[_0xaf58('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4f632d['peer'],_0x4f632d[_0xaf58('0x3d')],_0x4f632d['peerstatus']);logger[_0xaf58('0x25')](_0xaf58('0x3e'),util[_0xaf58('0x1d')](_0x4f632d,{'showHidden':![],'depth':null}));if(this[_0xaf58('0x9')][_0x4f632d['peer']]){if(!this[_0xaf58('0x9')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x31')]||_0x4f632d[_0xaf58('0x10')][_0xaf58('0x32')]()==_0xaf58('0x40')){this['agents'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x31')]=![];this[_0xaf58('0x9')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x41')]=_0x4f632d[_0xaf58('0x10')][_0xaf58('0x32')]();this['agents'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x3d')]=_0x4f632d[_0xaf58('0x3d')];this[_0xaf58('0x9')][_0x4f632d[_0xaf58('0x3f')]]['updateStatusRealtime'](_0x4f632d);}}else if(this[_0xaf58('0xa')][_0x4f632d[_0xaf58('0x3f')]]){this[_0xaf58('0xa')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x41')]=_0x4f632d['peerstatus'][_0xaf58('0x32')]();this['telephones'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x3d')]=_0x4f632d[_0xaf58('0x3d')];logger[_0xaf58('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xaf58('0x1d')](this[_0xaf58('0xa')][_0x4f632d[_0xaf58('0x3f')]],{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')]('telephone:%s',this['telephones'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x2c')]),'telephone:save',this['telephones'][_0x4f632d[_0xaf58('0x3f')]]);}else if(this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]]){this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x41')]=_0x4f632d['peerstatus']['toLowerCase']();this['trunks'][_0x4f632d['peer']]['address']=_0x4f632d[_0xaf58('0x3d')];logger[_0xaf58('0x25')](_0xaf58('0x42'),util[_0xaf58('0x1d')](this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]],{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')](_0xaf58('0x2b'),this[_0xaf58('0x8')][_0x4f632d['peer']]['name']),_0xaf58('0x43'),this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]]);}}}catch(_0x1d7148){logger[_0xaf58('0x17')](_0xaf58('0x3e'),util[_0xaf58('0x1d')](_0x1d7148,{'showHidden':![],'depth':null}));}};module[_0xaf58('0x44')]=UserReport; \ No newline at end of file +var _0x2630=['[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','inuse','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','debug','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state'];(function(_0x2641da,_0x30ff28){var _0x1f8431=function(_0x4daacc){while(--_0x4daacc){_0x2641da['push'](_0x2641da['shift']());}};_0x1f8431(++_0x30ff28);}(_0x2630,0x79));var _0x0263=function(_0x391e7c,_0x14818f){_0x391e7c=_0x391e7c-0x0;var _0x1b5a58=_0x2630[_0x391e7c];return _0x1b5a58;};'use strict';var _=require(_0x0263('0x0'));var moment=require(_0x0263('0x1'));var util=require(_0x0263('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x0263('0x3'));var logger=require(_0x0263('0x4'))(_0x0263('0x5'));var ami=require(_0x0263('0x6'));config[_0x0263('0x7')]=_[_0x0263('0x8')](config['redis'],{'host':_0x0263('0x9'),'port':0x18eb});var io=require(_0x0263('0xa'))(new Redis(config['redis']));function UserReport(_0x8053d9){this[_0x0263('0xb')]=_0x8053d9[_0x0263('0xb')];this[_0x0263('0xc')]=_0x8053d9[_0x0263('0xc')];this['telephones']=_0x8053d9[_0x0263('0xd')];ami['on'](_0x0263('0xe'),this[_0x0263('0xf')][_0x0263('0x10')](this));ami['on'](_0x0263('0x11'),this['syncRegistry'][_0x0263('0x10')](this));ami['on']('devicestatechange',this[_0x0263('0x12')][_0x0263('0x10')](this));ami['on'](_0x0263('0x13'),this['syncPeerStatus'][_0x0263('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x0263('0x14')]()['then'](ami[_0x0263('0x15')]())[_0x0263('0x16')](function(_0x1dda38){logger[_0x0263('0x17')](_0x0263('0x18'),util[_0x0263('0x19')](_0x1dda38,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x0263('0x14')]()[_0x0263('0x1a')](ami[_0x0263('0x1b')]())[_0x0263('0x16')](function(_0x480793){logger['error']('[userReport][devicestatelist]',util['inspect'](_0x480793,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x0263('0x14')]()['then'](ami[_0x0263('0x1c')]())['catch'](function(_0x22cd32){logger['error'](_0x0263('0x1d'),util['inspect'](_0x22cd32,{'showHidden':![],'depth':null}));});}UserReport[_0x0263('0x1e')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x0263('0x1a')](showSipRegistrations())[_0x0263('0x1a')](listDeviceStates())[_0x0263('0x1a')](showPeersStatus());},0x32c8);};UserReport[_0x0263('0x1e')][_0x0263('0x1f')]=function(_0x1e2311){return _0x1e2311!==null&&!_['isUndefined'](_0x1e2311);};UserReport[_0x0263('0x1e')][_0x0263('0x20')]=function(_0xf630ac,_0x1f0fb4,_0xad6e40){io['to'](_0xf630ac)[_0x0263('0x20')](_0x1f0fb4,_0xad6e40);};UserReport['prototype'][_0x0263('0xf')]=function(_0x121e86){try{if(this[_0x0263('0x1f')](_0x121e86)){logger[_0x0263('0x21')](_0x0263('0x22'),_0x121e86[_0x0263('0x23')],_0x121e86[_0x0263('0x24')]);logger['debug'](_0x0263('0x25'),util[_0x0263('0x19')](_0x121e86,{'showHidden':![],'depth':null}));var _0x41b743=_[_0x0263('0x26')](this[_0x0263('0xb')],{'registry':_0x121e86[_0x0263('0x23')]});if(_0x41b743){_0x121e86[_0x0263('0x27')]=_0x121e86[_0x0263('0x24')];_[_0x0263('0x28')](_0x41b743,_[_0x0263('0x29')](_0x121e86,[_0x0263('0x2a'),_0x0263('0x2b'),_0x0263('0x23'),'state']));logger['debug'](_0x0263('0x2c'),util[_0x0263('0x19')](_0x41b743,{'showHidden':![],'depth':null}));this[_0x0263('0x20')](util[_0x0263('0x2d')](_0x0263('0x2e'),_0x41b743[_0x0263('0x2f')]),_0x0263('0x30'),_0x41b743);}}}catch(_0x2033ca){logger[_0x0263('0x17')](_0x0263('0x25'),util[_0x0263('0x19')](_0x2033ca,{'showHidden':![],'depth':null}));}};UserReport[_0x0263('0x1e')][_0x0263('0x12')]=function(_0x59059c){try{if(this[_0x0263('0x1f')](_0x59059c)){logger[_0x0263('0x21')](_0x0263('0x31'),_0x59059c['device'],_0x59059c[_0x0263('0x24')]);logger['debug']('[userReport][devicestatechange]',util[_0x0263('0x19')](_0x59059c,{'showHidden':![],'depth':null}));if(this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]]){if(!this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]]['local']||_0x59059c['state']['toLowerCase']()==_0x0263('0x33')){this['agents'][_0x59059c[_0x0263('0x32')]][_0x0263('0x34')]=![];if(this['agents'][_0x59059c['device']][_0x0263('0x24')]!==_0x59059c[_0x0263('0x24')][_0x0263('0x35')]()){this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]][_0x0263('0x36')]=_[_0x0263('0x37')](moment()[_0x0263('0x2d')]('x'));}this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]][_0x0263('0x24')]=_0x59059c[_0x0263('0x24')][_0x0263('0x35')]();this[_0x0263('0xc')][_0x59059c[_0x0263('0x32')]][_0x0263('0x38')](_0x59059c);}}else if(this['telephones'][_0x59059c[_0x0263('0x32')]]){if(this[_0x0263('0xd')][_0x59059c[_0x0263('0x32')]][_0x0263('0x24')]!==_0x59059c[_0x0263('0x24')][_0x0263('0x35')]()){this[_0x0263('0xd')][_0x59059c['device']][_0x0263('0x36')]=_[_0x0263('0x37')](moment()['format']('x'));}this[_0x0263('0xd')][_0x59059c['device']][_0x0263('0x24')]=_0x59059c[_0x0263('0x24')]['toLowerCase']();logger[_0x0263('0x39')](_0x0263('0x3a'),util[_0x0263('0x19')](this['telephones'][_0x59059c[_0x0263('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x0263('0x2d')]('telephone:%s',this[_0x0263('0xd')][_0x59059c['device']][_0x0263('0x2f')]),_0x0263('0x3b'),this[_0x0263('0xd')][_0x59059c[_0x0263('0x32')]]);}else if(this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]]){if(this['trunks'][_0x59059c['device']][_0x0263('0x24')]!==_0x59059c['state'][_0x0263('0x35')]()){this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]][_0x0263('0x36')]=_[_0x0263('0x37')](moment()[_0x0263('0x2d')]('x'));}this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]][_0x0263('0x24')]=_0x59059c['state'][_0x0263('0x35')]();logger[_0x0263('0x39')](_0x0263('0x3c'),util['inspect'](this['trunks'][_0x59059c[_0x0263('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x0263('0x2d')](_0x0263('0x2e'),this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]]['name']),_0x0263('0x30'),this[_0x0263('0xb')][_0x59059c[_0x0263('0x32')]]);}else if(_[_0x0263('0x3d')](_0x59059c[_0x0263('0x32')],'Local')){var _0x303328=_0x59059c[_0x0263('0x32')];var _0x214166=_0x303328[_0x0263('0x3e')](_0x303328[_0x0263('0x3f')]('/')+0x1,_0x303328[_0x0263('0x3f')]('@'));var _0xf23c30=_[_0x0263('0x26')](this['agents'],function(_0x15255c){return _0x15255c[_0x0263('0x40')]==_0x214166||_0x15255c[_0x0263('0x41')]==_0x214166||_0x15255c[_0x0263('0x42')]==_0x214166;});if(_0xf23c30){if(_0xf23c30[_0x0263('0x24')]!==_0x59059c[_0x0263('0x24')][_0x0263('0x35')]()){_0xf23c30[_0x0263('0x36')]=_[_0x0263('0x37')](moment()[_0x0263('0x2d')]('x'));}_0xf23c30[_0x0263('0x24')]=_0x59059c[_0x0263('0x24')][_0x0263('0x35')]();_0xf23c30['local']=!![];_0xf23c30[_0x0263('0x38')](_0x59059c);}}}}catch(_0x295faa){logger[_0x0263('0x17')](_0x0263('0x43'),util['inspect'](_0x295faa,{'showHidden':![],'depth':null}));}};UserReport[_0x0263('0x1e')][_0x0263('0x44')]=function(_0x58b3da){try{if(this['isNotNull'](_0x58b3da)&&this[_0x0263('0x1f')](_0x58b3da[_0x0263('0x13')])){logger[_0x0263('0x21')](_0x0263('0x45'),_0x58b3da[_0x0263('0x46')],_0x58b3da['address'],_0x58b3da[_0x0263('0x13')]);logger[_0x0263('0x39')](_0x0263('0x47'),util[_0x0263('0x19')](_0x58b3da,{'showHidden':![],'depth':null}));if(this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]]){if(!this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x34')]||_0x58b3da[_0x0263('0x13')]['toLowerCase']()==_0x0263('0x48')){this[_0x0263('0xc')][_0x58b3da['peer']][_0x0263('0x34')]=![];this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x49')]=_0x58b3da[_0x0263('0x13')]['toLowerCase']();this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x4a')]=_0x58b3da[_0x0263('0x4a')];this[_0x0263('0xc')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x38')](_0x58b3da);}}else if(this[_0x0263('0xd')][_0x58b3da[_0x0263('0x46')]]){this[_0x0263('0xd')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x49')]=_0x58b3da[_0x0263('0x13')][_0x0263('0x35')]();this['telephones'][_0x58b3da['peer']][_0x0263('0x4a')]=_0x58b3da[_0x0263('0x4a')];logger[_0x0263('0x39')](_0x0263('0x4b'),util[_0x0263('0x19')](this[_0x0263('0xd')][_0x58b3da[_0x0263('0x46')]],{'showHidden':![],'depth':null}));this[_0x0263('0x20')](util[_0x0263('0x2d')](_0x0263('0x4c'),this['telephones'][_0x58b3da[_0x0263('0x46')]][_0x0263('0x2f')]),'telephone:save',this['telephones'][_0x58b3da[_0x0263('0x46')]]);}else if(this[_0x0263('0xb')][_0x58b3da[_0x0263('0x46')]]){this[_0x0263('0xb')][_0x58b3da[_0x0263('0x46')]][_0x0263('0x49')]=_0x58b3da['peerstatus'][_0x0263('0x35')]();this[_0x0263('0xb')][_0x58b3da['peer']][_0x0263('0x4a')]=_0x58b3da[_0x0263('0x4a')];logger[_0x0263('0x39')](_0x0263('0x4d'),util[_0x0263('0x19')](this[_0x0263('0xb')][_0x58b3da['peer']],{'showHidden':![],'depth':null}));this[_0x0263('0x20')](util[_0x0263('0x2d')](_0x0263('0x2e'),this['trunks'][_0x58b3da[_0x0263('0x46')]][_0x0263('0x2f')]),'trunk:save',this[_0x0263('0xb')][_0x58b3da[_0x0263('0x46')]]);}}}catch(_0x43ed5b){logger['error'](_0x0263('0x47'),util['inspect'](_0x43ed5b,{'showHidden':![],'depth':null}));}};module[_0x0263('0x4e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 6a75168..7b333b2 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 _0xdc1a=['talktime','acwTimeout','agentacw','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','format','queue','type','inbound','variables','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xdc1a,0x1f4));var _0xadc1=function(_0x3f318a,_0x4ca287){_0x3f318a=_0x3f318a-0x0;var _0x4e8bf3=_0xdc1a[_0x3f318a];return _0x4e8bf3;};'use strict';var _=require(_0xadc1('0x0'));var moment=require('moment');var util=require(_0xadc1('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xadc1('0x2'))(_0xadc1('0x3'));var ami=require(_0xadc1('0x4'));config[_0xadc1('0x5')]=_[_0xadc1('0x6')](config[_0xadc1('0x5')],{'host':_0xadc1('0x7'),'port':0x18eb});var io=require(_0xadc1('0x8'))(new Redis(config[_0xadc1('0x5')]));function VoiceAgentReport(_0x5db26b){this[_0xadc1('0x9')]={};this[_0xadc1('0xa')]=_0x5db26b['voiceQueues'];this['agents']=_0x5db26b[_0xadc1('0xb')];this['variables']={};ami['on'](_0xadc1('0xc'),this['syncAgentCalled'][_0xadc1('0xd')](this));ami['on']('agentconnect',this[_0xadc1('0xe')][_0xadc1('0xd')](this));ami['on'](_0xadc1('0xf'),this[_0xadc1('0x10')][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x11'),this['syncQueueCallerAbandon'][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x12'),this['syncAgentComplete'][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x13'),this[_0xadc1('0x14')]['bind'](this));ami['on'](_0xadc1('0x15'),this[_0xadc1('0x16')][_0xadc1('0xd')](this));ami['on']('musiconholdstart',this[_0xadc1('0x17')][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x18'),this[_0xadc1('0x19')]['bind'](this));ami['on'](_0xadc1('0x1a'),this['syncAttendedTransfer'][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x1b'),this[_0xadc1('0x1c')][_0xadc1('0xd')](this));}VoiceAgentReport['prototype'][_0xadc1('0x1d')]=function(_0x565737,_0x5bb353,_0x599783){io['to'](_0x565737)[_0xadc1('0x1d')](_0x5bb353,_0x599783);};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x1f')]=function(_0x2b76cf){return _0x2b76cf!==null&&!_[_0xadc1('0x20')](_0x2b76cf);};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x21')]=function(_0x58f79e){try{if(this['isNotNull'](_0x58f79e)){logger['info'](_0xadc1('0x22'),_0x58f79e[_0xadc1('0x23')],_0x58f79e[_0xadc1('0x24')],_0x58f79e['destuniqueid']);logger[_0xadc1('0x25')](_0xadc1('0x26'),_0x58f79e[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x58f79e,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]])){this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]]={};}if(_[_0xadc1('0x20')](this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]][_0x58f79e['destuniqueid']])){this[_0xadc1('0x9')][_0x58f79e['uniqueid']][_0x58f79e[_0xadc1('0x28')]]={'agentcalledAt':moment()[_0xadc1('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','mandatoryDisposition':this[_0xadc1('0xa')][_0x58f79e[_0xadc1('0x2a')]]?this[_0xadc1('0xa')][_0x58f79e['queue']]['mandatoryDisposition']||![]:![],'type':this[_0xadc1('0xa')][_0x58f79e[_0xadc1('0x2a')]]?this[_0xadc1('0xa')][_0x58f79e['queue']][_0xadc1('0x2b')]||_0xadc1('0x2c'):_0xadc1('0x2c'),'variables':this[_0xadc1('0x2d')][_0x58f79e['uniqueid']]};}_[_0xadc1('0x2e')](this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]][_0x58f79e[_0xadc1('0x28')]],_[_0xadc1('0x2f')](_0x58f79e,[_0xadc1('0x30'),_0xadc1('0x31')]));logger[_0xadc1('0x25')](_0xadc1('0x32'),_0x58f79e[_0xadc1('0x23')],util['inspect'](this['channels'][_0x58f79e[_0xadc1('0x23')]][_0x58f79e[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')]('custom:agentcalled',this['channels'][_0x58f79e['uniqueid']][_0x58f79e[_0xadc1('0x28')]]);logger[_0xadc1('0x25')](_0xadc1('0x33'),_0x58f79e[_0xadc1('0x23')],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x58f79e['uniqueid']][_0x58f79e[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xadc1('0x29')](_0xadc1('0x34'),_0x58f79e['membername']),_0xadc1('0x35'),this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]][_0x58f79e['destuniqueid']]);}}catch(_0x1fa68a){logger[_0xadc1('0x36')](_0xadc1('0x37'),_0x58f79e[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1fa68a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['syncAgentConnect']=function(_0xf8d7e8){try{if(this[_0xadc1('0x1f')](_0xf8d7e8)){if(this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]]){logger[_0xadc1('0x25')](_0xadc1('0x38'),_0xf8d7e8[_0xadc1('0x23')],util[_0xadc1('0x27')](_0xf8d7e8,{'showHidden':![],'depth':null}));for(var _0x5adf78 in this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']]){if(this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0xadc1('0x39')](_0x5adf78)){if(_0xf8d7e8[_0xadc1('0x28')]===_0x5adf78){logger[_0xadc1('0x3a')](_0xadc1('0x3b'),_0xf8d7e8[_0xadc1('0x23')],_0xf8d7e8[_0xadc1('0x24')],_0xf8d7e8[_0xadc1('0x28')]);this['channels'][_0xf8d7e8['uniqueid']][_0x5adf78][_0xadc1('0x3c')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x3e')]=_0xf8d7e8[_0xadc1('0x3e')];this['channels'][_0xf8d7e8['uniqueid']][_0x5adf78][_0xadc1('0x3f')]=_0xf8d7e8[_0xadc1('0x3f')];this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]['destchannelstate']=_0xf8d7e8['destchannelstate'];this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x40')]=_0xf8d7e8[_0xadc1('0x40')];this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]['holdtime']=_0xf8d7e8[_0xadc1('0x41')];this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x42')]=_0xadc1('0x43');_[_0xadc1('0x2e')](this[_0xadc1('0xb')][_0xf8d7e8[_0xadc1('0x44')]],_['pick'](_0xf8d7e8,[_0xadc1('0x2a'),_0xadc1('0x45')]));logger[_0xadc1('0x25')](_0xadc1('0x46'),_0xf8d7e8[_0xadc1('0x23')],util['inspect'](this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0xf8d7e8[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')]('custom:agentconnect',this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0xf8d7e8[_0xadc1('0x28')]]);logger[_0xadc1('0x25')](_0xadc1('0x47'),_0xf8d7e8['uniqueid'],util[_0xadc1('0x27')](this['channels'][_0xf8d7e8['uniqueid']][_0xf8d7e8[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xadc1('0x29')]('user:%s',_0xf8d7e8[_0xadc1('0x24')]),'user:agentconnect',this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0xf8d7e8[_0xadc1('0x28')]]);}else if(!this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0xf')]&&!this['channels'][_0xf8d7e8['uniqueid']][_0x5adf78]['agentcomplete']){logger[_0xadc1('0x3a')](_0xadc1('0x48'),_0xf8d7e8[_0xadc1('0x23')],this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78]['membername'],_0x5adf78);this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]['agentringnoanswer']=!![];this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x49')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x4a')]=_0xf8d7e8[_0xadc1('0x28')];this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78][_0xadc1('0x4b')]=_0xf8d7e8[_0xadc1('0x24')];this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78]['lastevent']=_0xadc1('0x4c');this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78]['reason']=_0xadc1('0x4c');logger[_0xadc1('0x25')](_0xadc1('0x4d'),_0xf8d7e8[_0xadc1('0x23')],util[_0xadc1('0x27')](this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x4e'),this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]);}}}}}}catch(_0x1ee9e0){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][agentconnect]',_0xf8d7e8[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1ee9e0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x10')]=function(_0x1d7103){try{if(this[_0xadc1('0x1f')](_0x1d7103)){logger[_0xadc1('0x25')](_0xadc1('0x4f'),_0x1d7103[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1d7103,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d7103[_0xadc1('0x23')]]&&this[_0xadc1('0x9')][_0x1d7103['uniqueid']][_0x1d7103[_0xadc1('0x28')]]){logger['info'](_0xadc1('0x50'),_0x1d7103[_0xadc1('0x23')],_0x1d7103[_0xadc1('0x24')],_0x1d7103[_0xadc1('0x28')]);this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103[_0xadc1('0x28')]]['agentringnoanswer']=!![];this['channels'][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']][_0xadc1('0x49')]=moment()['format'](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103[_0xadc1('0x28')]][_0xadc1('0x42')]=_0xadc1('0x51');this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']]['reason']=_0xadc1('0x51');logger[_0xadc1('0x25')](_0xadc1('0x52'),_0x1d7103['uniqueid'],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x53'),this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']]);}}}catch(_0x52d8a8){logger[_0xadc1('0x36')](_0xadc1('0x54'),_0x1d7103[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x52d8a8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x55')]=function(_0x5ff1c5){try{if(this[_0xadc1('0x1f')](_0x5ff1c5)){logger['debug'](_0xadc1('0x56'),_0x5ff1c5[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x5ff1c5,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]]){for(var _0x34b4f2 in this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']]){if(this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0xadc1('0x39')](_0x34b4f2)&&!this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0xf')]&&!this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0x12')]){logger[_0xadc1('0x3a')](_0xadc1('0x57'),_0x5ff1c5[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']][_0x34b4f2][_0xadc1('0x24')],_0x34b4f2);this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0xf')]=!![];this['channels'][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0x49')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']][_0x34b4f2][_0xadc1('0x42')]=_0xadc1('0x58');this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0x59')]=_0xadc1('0x58');logger[_0xadc1('0x25')](_0xadc1('0x5a'),_0x5ff1c5[_0xadc1('0x23')],util['inspect'](this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x5b'),this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']][_0x34b4f2]);}}}}}catch(_0x4b7c1f){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][queuecallerabandon]',_0x5ff1c5[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x4b7c1f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['syncAgentComplete']=function(_0x1a86a1){try{if(this[_0xadc1('0x1f')](_0x1a86a1)){logger[_0xadc1('0x25')](_0xadc1('0x5c'),_0x1a86a1[_0xadc1('0x23')],util['inspect'](_0x1a86a1,{'showHidden':![],'depth':null}));if(this['channels'][_0x1a86a1[_0xadc1('0x23')]]){for(var _0x55e730 in this[_0xadc1('0x9')][_0x1a86a1['uniqueid']]){if(this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0xadc1('0x39')](_0x55e730)){if(this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x3c')]&&!this[_0xadc1('0x9')][_0x1a86a1['uniqueid']][_0x55e730][_0xadc1('0x12')]){logger[_0xadc1('0x3a')](_0xadc1('0x5d'),_0x1a86a1[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x1a86a1['uniqueid']][_0x55e730][_0xadc1('0x24')],_0x55e730);this['channels'][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]['agentcomplete']=!![];this[_0xadc1('0x9')][_0x1a86a1['uniqueid']][_0x55e730][_0xadc1('0x5e')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x42')]='complete';this['channels'][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x59')]=_0x1a86a1[_0xadc1('0x59')]==_0xadc1('0x5f')?'agent':_0x1a86a1[_0xadc1('0x59')];this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]['talktime']=_0x1a86a1[_0xadc1('0x60')];if(this['voiceQueues'][_0x1a86a1[_0xadc1('0x2a')]]&&this[_0xadc1('0xa')][_0x1a86a1[_0xadc1('0x2a')]]['acw']){this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]['acwtime']=this[_0xadc1('0xa')][_0x1a86a1[_0xadc1('0x2a')]][_0xadc1('0x61')];this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x62')]=!![];}this['agents'][_0x1a86a1['interface']]=_[_0xadc1('0x2f')](this[_0xadc1('0xb')][_0x1a86a1[_0xadc1('0x44')]],[_0xadc1('0x2a'),_0xadc1('0x45')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x1a86a1[_0xadc1('0x23')],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x63'),this['channels'][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x1a86a1['uniqueid'],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730],{'showHidden':![],'depth':null}));this['emit'](util[_0xadc1('0x29')](_0xadc1('0x34'),_0x1a86a1['membername']),_0xadc1('0x64'),this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]);}}}}}}catch(_0x567144){logger[_0xadc1('0x36')](_0xadc1('0x65'),_0x1a86a1[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x567144,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['syncVarSet']=function(_0x5e2284){try{if(this[_0xadc1('0x1f')](_0x5e2284)){logger[_0xadc1('0x25')](_0xadc1('0x66'),_0x5e2284['uniqueid'],util[_0xadc1('0x27')](_0x5e2284,{'showHidden':![],'depth':null}));this[_0xadc1('0x67')](_0x5e2284[_0xadc1('0x23')],_[_0xadc1('0x68')](_0x5e2284[_0xadc1('0x69')])[0x0],_0x5e2284['value']);if(this[_0xadc1('0x9')][_0x5e2284[_0xadc1('0x23')]]){for(var _0x6576c5 in this[_0xadc1('0x9')][_0x5e2284[_0xadc1('0x23')]]){if(this['channels'][_0x5e2284['uniqueid']][_0xadc1('0x39')](_0x6576c5)){logger[_0xadc1('0x3a')](_0xadc1('0x6a'),_0x5e2284['uniqueid'],_0x6576c5,_[_0xadc1('0x68')](_0x5e2284[_0xadc1('0x69')])[0x0],_0x5e2284[_0xadc1('0x6b')]);if(_[_0xadc1('0x20')](this['channels'][_0x5e2284[_0xadc1('0x23')]][_0x6576c5][_0xadc1('0x2d')])){this[_0xadc1('0x9')][_0x5e2284[_0xadc1('0x23')]][_0x6576c5][_0xadc1('0x2d')]={};}this[_0xadc1('0x9')][_0x5e2284['uniqueid']][_0x6576c5][_0xadc1('0x2d')]=this[_0xadc1('0x2d')][_0x5e2284['uniqueid']];}}}}}catch(_0x24e597){logger[_0xadc1('0x36')](_0xadc1('0x6c'),_0x5e2284['uniqueid'],util[_0xadc1('0x27')](_0x24e597,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['addVariable']=function(_0x99ef83,_0x46c952,_0x130d72){var _0x5d76c7=[_0xadc1('0x6d'),'rtpaudioqosbridged',_0xadc1('0x6e'),_0xadc1('0x6f'),_0xadc1('0x70'),'rtpaudioqoslossbridged',_0xadc1('0x71'),'rtpaudioqosrttbridged',_0xadc1('0x72'),_0xadc1('0x73'),_0xadc1('0x74'),'bridgepvtcallid','membercalls',_0xadc1('0x75'),_0xadc1('0x76'),'memberlastcall',_0xadc1('0x24'),_0xadc1('0x77'),'memberrealtime'];if(!_[_0xadc1('0x78')](_0x46c952)&&!_[_0xadc1('0x79')](_0x5d76c7,_0x46c952)){if(_[_0xadc1('0x20')](this[_0xadc1('0x2d')][_0x99ef83])){this[_0xadc1('0x2d')][_0x99ef83]={};}this['variables'][_0x99ef83][_0x46c952]=_0x130d72;}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x16')]=function(_0xabbc7){try{if(this[_0xadc1('0x1f')](_0xabbc7)){logger[_0xadc1('0x25')]('[%s][voiceAgentReport][hangup]\x20event:',_0xabbc7[_0xadc1('0x23')],util[_0xadc1('0x27')](_0xabbc7,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]){for(var _0xa5626c in this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]){if(this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]][_0xadc1('0x39')](_0xa5626c)){if(this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]][_0xa5626c][_0xadc1('0x59')]=='transfer'&&this[_0xadc1('0x9')][_0xabbc7['uniqueid']][_0xa5626c][_0xadc1('0x12')]){logger[_0xadc1('0x3a')](_0xadc1('0x7a'),_0xabbc7[_0xadc1('0x23')],_0xa5626c);this['channels'][_0xabbc7[_0xadc1('0x23')]][_0xa5626c]['agentcompleteAt']=moment()[_0xadc1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0xabbc7['uniqueid'],util[_0xadc1('0x27')](_['values'](this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xadc1('0x7b'),_[_0xadc1('0x7c')](this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]));delete this[_0xadc1('0x9')][_0xabbc7['uniqueid']];}if(this[_0xadc1('0x2d')][_0xabbc7[_0xadc1('0x23')]]){delete this[_0xadc1('0x2d')][_0xabbc7[_0xadc1('0x23')]];}}}catch(_0x2be671){logger[_0xadc1('0x36')](_0xadc1('0x7d'),_0xabbc7[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x2be671,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x7e')]=function(_0x694b41){try{if(this[_0xadc1('0x1f')](_0x694b41)){logger['debug'](_0xadc1('0x7f'),_0x694b41[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x694b41,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]]){for(var _0x1bc4e9 in this['channels'][_0x694b41['transfereeuniqueid']]){if(this['channels'][_0x694b41['transfereeuniqueid']][_0xadc1('0x39')](_0x1bc4e9)){if(_0x694b41[_0xadc1('0x81')]===_0x1bc4e9){logger[_0xadc1('0x3a')](_0xadc1('0x82'),_0x694b41[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x24')],_0x1bc4e9);var _0xb49a89=moment();this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9]['agentcomplete']=!![];this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x5e')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this['channels'][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x42')]=_0xadc1('0x83');this[_0xadc1('0x9')][_0x694b41['transfereeuniqueid']][_0x1bc4e9][_0xadc1('0x59')]=_0xadc1('0x5f');this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x60')]=_0xb49a89['diff'](this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9]['agentconnectAt'],_0xadc1('0x84'));}}}}if(this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x85')]]){var _0x55fa00=this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x85')]];this['channels'][_0x694b41[_0xadc1('0x85')]]=this['channels'][_0x694b41['transfereeuniqueid']];this[_0xadc1('0x9')][_0x694b41['transfereeuniqueid']]=_0x55fa00;}}}catch(_0x2195ae){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][attendedtransfer]',_0x694b41[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x2195ae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x1c')]=function(_0x1247c5){try{if(this[_0xadc1('0x1f')](_0x1247c5)){logger[_0xadc1('0x25')](_0xadc1('0x86'),_0x1247c5[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1247c5,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]]){for(var _0x34eacf in this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]]){if(this['channels'][_0x1247c5['transfereeuniqueid']][_0xadc1('0x39')](_0x34eacf)){if(_0x1247c5[_0xadc1('0x87')]===_0x34eacf){logger[_0xadc1('0x3a')](_0xadc1('0x88'),_0x1247c5[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x24')],_0x34eacf);var _0x69d6db=moment();this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x12')]=!![];this['channels'][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x5e')]=_0x69d6db;this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x42')]='complete';this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x59')]='transfer';this['channels'][_0x1247c5['transfereeuniqueid']][_0x34eacf]['talktime']=_0x69d6db[_0xadc1('0x89')](this['channels'][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x3c')],_0xadc1('0x84'));}}}}}}catch(_0x549606){logger[_0xadc1('0x36')](_0xadc1('0x8a'),_0x1247c5['uniqueid'],util['inspect'](_0x549606,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x2f0001){var _0x2705e9='';try{if(this[_0xadc1('0x1f')](_0x2f0001)){logger[_0xadc1('0x25')](_0xadc1('0x8b'),_0x2f0001[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x2f0001,{'showHidden':![],'depth':null}));if(_0x2f0001['channel']){_0x2705e9=_0x2f0001['channel'][_0xadc1('0x8c')](0x0,_0x2f0001[_0xadc1('0x8d')]['lastIndexOf']('-'));if(this['agents'][_0x2705e9]){logger['info'](_0xadc1('0x8e'),_0x2f0001[_0xadc1('0x23')],_0x2705e9);this['agents'][_0x2705e9][_0xadc1('0x8f')]=!![];}}}}catch(_0x539d57){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][musiconholdstart]',_0x2f0001[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x539d57,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x19')]=function(_0x7a8d9c){var _0x2a53ea='';try{if(this[_0xadc1('0x1f')](_0x7a8d9c)){logger[_0xadc1('0x25')](_0xadc1('0x90'),_0x7a8d9c['uniqueid'],util[_0xadc1('0x27')](_0x7a8d9c,{'showHidden':![],'depth':null}));if(_0x7a8d9c[_0xadc1('0x8d')]){_0x2a53ea=_0x7a8d9c[_0xadc1('0x8d')][_0xadc1('0x8c')](0x0,_0x7a8d9c['channel'][_0xadc1('0x91')]('-'));if(this[_0xadc1('0xb')][_0x2a53ea]){logger[_0xadc1('0x3a')](_0xadc1('0x92'),_0x7a8d9c[_0xadc1('0x23')],_0x2a53ea);this[_0xadc1('0xb')][_0x2a53ea][_0xadc1('0x8f')]=![];}}}}catch(_0x27eb3c){logger['error'](_0xadc1('0x93'),_0x7a8d9c['uniqueid'],util[_0xadc1('0x27')](_0x27eb3c,{'showHidden':![],'depth':null}));}};module[_0xadc1('0x94')]=VoiceAgentReport; \ No newline at end of file +var _0x18a4=['info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','merge','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','error','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variables','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','voiceQueues','agents','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','bind','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined'];(function(_0x7b47c7,_0x5002b1){var _0x59e875=function(_0x572a10){while(--_0x572a10){_0x7b47c7['push'](_0x7b47c7['shift']());}};_0x59e875(++_0x5002b1);}(_0x18a4,0x75));var _0x418a=function(_0x620cbe,_0x193075){_0x620cbe=_0x620cbe-0x0;var _0x30ad91=_0x18a4[_0x620cbe];return _0x30ad91;};'use strict';var _=require(_0x418a('0x0'));var moment=require(_0x418a('0x1'));var util=require(_0x418a('0x2'));var Redis=require(_0x418a('0x3'));var config=require(_0x418a('0x4'));var logger=require('../../../config/logger')(_0x418a('0x5'));var ami=require(_0x418a('0x6'));config[_0x418a('0x7')]=_[_0x418a('0x8')](config[_0x418a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x418a('0x9'))(new Redis(config[_0x418a('0x7')]));function VoiceAgentReport(_0x48c4bf){this['channels']={};this[_0x418a('0xa')]=_0x48c4bf['voiceQueues'];this[_0x418a('0xb')]=_0x48c4bf[_0x418a('0xb')];this['variables']={};ami['on']('agentcalled',this[_0x418a('0xc')]['bind'](this));ami['on'](_0x418a('0xd'),this[_0x418a('0xe')]['bind'](this));ami['on'](_0x418a('0xf'),this[_0x418a('0x10')][_0x418a('0x11')](this));ami['on'](_0x418a('0x12'),this['syncQueueCallerAbandon'][_0x418a('0x11')](this));ami['on'](_0x418a('0x13'),this['syncAgentComplete'][_0x418a('0x11')](this));ami['on'](_0x418a('0x14'),this[_0x418a('0x15')][_0x418a('0x11')](this));ami['on'](_0x418a('0x16'),this[_0x418a('0x17')][_0x418a('0x11')](this));ami['on'](_0x418a('0x18'),this[_0x418a('0x19')][_0x418a('0x11')](this));ami['on'](_0x418a('0x1a'),this['syncMusicOnHoldStop'][_0x418a('0x11')](this));ami['on']('attendedtransfer',this[_0x418a('0x1b')][_0x418a('0x11')](this));ami['on'](_0x418a('0x1c'),this['syncBlindTransfer'][_0x418a('0x11')](this));}VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x1e')]=function(_0x425079,_0x2fcd8f,_0x46cc01){io['to'](_0x425079)['emit'](_0x2fcd8f,_0x46cc01);};VoiceAgentReport['prototype'][_0x418a('0x1f')]=function(_0x7aa944){return _0x7aa944!==null&&!_[_0x418a('0x20')](_0x7aa944);};VoiceAgentReport['prototype'][_0x418a('0xc')]=function(_0x5ca22c){try{if(this['isNotNull'](_0x5ca22c)){logger[_0x418a('0x21')](_0x418a('0x22'),_0x5ca22c['uniqueid'],_0x5ca22c['membername'],_0x5ca22c[_0x418a('0x23')]);logger[_0x418a('0x24')](_0x418a('0x25'),_0x5ca22c[_0x418a('0x26')],util[_0x418a('0x27')](_0x5ca22c,{'showHidden':![],'depth':null}));if(_[_0x418a('0x20')](this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]])){this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]]={};}if(_[_0x418a('0x20')](this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]])){this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]]={'agentcalledAt':moment()[_0x418a('0x29')](_0x418a('0x2a')),'lastevent':_0x418a('0x2b'),'mandatoryDisposition':this[_0x418a('0xa')][_0x5ca22c['queue']]?this[_0x418a('0xa')][_0x5ca22c[_0x418a('0x2c')]][_0x418a('0x2d')]||![]:![],'type':this[_0x418a('0xa')][_0x5ca22c[_0x418a('0x2c')]]?this['voiceQueues'][_0x5ca22c['queue']]['type']||_0x418a('0x2e'):_0x418a('0x2e'),'variables':this['variables'][_0x5ca22c[_0x418a('0x26')]]};}_[_0x418a('0x2f')](this[_0x418a('0x28')][_0x5ca22c['uniqueid']][_0x5ca22c[_0x418a('0x23')]],_[_0x418a('0x30')](_0x5ca22c,[_0x418a('0x31'),'privilege']));logger[_0x418a('0x24')](_0x418a('0x32'),_0x5ca22c[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')]('custom:agentcalled',this[_0x418a('0x28')][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c['destuniqueid']]);logger['debug'](_0x418a('0x33'),_0x5ca22c[_0x418a('0x26')],util[_0x418a('0x27')](this['channels'][_0x5ca22c[_0x418a('0x26')]][_0x5ca22c[_0x418a('0x23')]],{'showHidden':![],'depth':null}));this[_0x418a('0x1e')](util[_0x418a('0x29')]('user:%s',_0x5ca22c[_0x418a('0x34')]),'user:called',this['channels'][_0x5ca22c['uniqueid']][_0x5ca22c[_0x418a('0x23')]]);}}catch(_0x3697f0){logger[_0x418a('0x35')]('[%s][voiceAgentReport][agentcalled]',_0x5ca22c[_0x418a('0x26')],util['inspect'](_0x3697f0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x418a('0xe')]=function(_0x15ae56){try{if(this['isNotNull'](_0x15ae56)){if(this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]]){logger[_0x418a('0x24')](_0x418a('0x36'),_0x15ae56[_0x418a('0x26')],util['inspect'](_0x15ae56,{'showHidden':![],'depth':null}));for(var _0x1823aa in this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]]){if(this[_0x418a('0x28')][_0x15ae56['uniqueid']][_0x418a('0x37')](_0x1823aa)){if(_0x15ae56[_0x418a('0x23')]===_0x1823aa){logger[_0x418a('0x21')](_0x418a('0x38'),_0x15ae56[_0x418a('0x26')],_0x15ae56[_0x418a('0x34')],_0x15ae56[_0x418a('0x23')]);this[_0x418a('0x28')][_0x15ae56['uniqueid']][_0x1823aa][_0x418a('0x39')]=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3a')]=_0x15ae56[_0x418a('0x3a')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3b')]=_0x15ae56[_0x418a('0x3b')];this['channels'][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3c')]=_0x15ae56[_0x418a('0x3c')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3d')]=_0x15ae56[_0x418a('0x3d')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]['holdtime']=_0x15ae56[_0x418a('0x3e')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x3f')]='connect';_[_0x418a('0x2f')](this[_0x418a('0xb')][_0x15ae56[_0x418a('0x40')]],_[_0x418a('0x41')](_0x15ae56,[_0x418a('0x2c'),_0x418a('0x42')]));logger[_0x418a('0x24')](_0x418a('0x43'),_0x15ae56[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x15ae56[_0x418a('0x23')]],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x44'),this['channels'][_0x15ae56[_0x418a('0x26')]][_0x15ae56[_0x418a('0x23')]]);logger[_0x418a('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x15ae56[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x15ae56['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x418a('0x1e')](util['format'](_0x418a('0x45'),_0x15ae56[_0x418a('0x34')]),_0x418a('0x46'),this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x15ae56[_0x418a('0x23')]]);}else if(!this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0xf')]&&!this['channels'][_0x15ae56['uniqueid']][_0x1823aa]['agentcomplete']){logger[_0x418a('0x21')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x15ae56[_0x418a('0x26')],this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]['membername'],_0x1823aa);this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0xf')]=!![];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x47')]=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x48')]=_0x15ae56[_0x418a('0x23')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x49')]=_0x15ae56[_0x418a('0x34')];this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]['lastevent']='answered_elsewhere';this['channels'][_0x15ae56[_0x418a('0x26')]][_0x1823aa][_0x418a('0x4a')]=_0x418a('0x4b');logger[_0x418a('0x24')](_0x418a('0x4c'),_0x15ae56[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')]('custom:agentansweredelsewhere',this[_0x418a('0x28')][_0x15ae56[_0x418a('0x26')]][_0x1823aa]);}}}}}}catch(_0x39294b){logger['error'](_0x418a('0x4d'),_0x15ae56[_0x418a('0x26')],util['inspect'](_0x39294b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x38e2a5){try{if(this['isNotNull'](_0x38e2a5)){logger[_0x418a('0x24')](_0x418a('0x4e'),_0x38e2a5[_0x418a('0x26')],util[_0x418a('0x27')](_0x38e2a5,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]]&&this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5['destuniqueid']]){logger[_0x418a('0x21')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x38e2a5[_0x418a('0x26')],_0x38e2a5[_0x418a('0x34')],_0x38e2a5['destuniqueid']);this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5[_0x418a('0x23')]]['agentringnoanswer']=!![];this[_0x418a('0x28')][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5['destuniqueid']][_0x418a('0x47')]=moment()['format'](_0x418a('0x2a'));this[_0x418a('0x28')][_0x38e2a5['uniqueid']][_0x38e2a5[_0x418a('0x23')]][_0x418a('0x3f')]=_0x418a('0x4f');this[_0x418a('0x28')][_0x38e2a5['uniqueid']][_0x38e2a5[_0x418a('0x23')]][_0x418a('0x4a')]=_0x418a('0x4f');logger[_0x418a('0x24')](_0x418a('0x50'),_0x38e2a5[_0x418a('0x26')],util[_0x418a('0x27')](this['channels'][_0x38e2a5[_0x418a('0x26')]][_0x38e2a5['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x51'),this[_0x418a('0x28')][_0x38e2a5['uniqueid']][_0x38e2a5[_0x418a('0x23')]]);}}}catch(_0x49b239){logger[_0x418a('0x35')](_0x418a('0x52'),_0x38e2a5['uniqueid'],util['inspect'](_0x49b239,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x53')]=function(_0x38f469){try{if(this[_0x418a('0x1f')](_0x38f469)){logger[_0x418a('0x24')](_0x418a('0x54'),_0x38f469[_0x418a('0x26')],util[_0x418a('0x27')](_0x38f469,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x38f469['uniqueid']]){for(var _0x3e7423 in this[_0x418a('0x28')][_0x38f469['uniqueid']]){if(this[_0x418a('0x28')][_0x38f469['uniqueid']][_0x418a('0x37')](_0x3e7423)&&!this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0xf')]&&!this['channels'][_0x38f469['uniqueid']][_0x3e7423][_0x418a('0x13')]){logger[_0x418a('0x21')](_0x418a('0x55'),_0x38f469[_0x418a('0x26')],this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0x34')],_0x3e7423);this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0xf')]=!![];this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423]['agentringnoanswerAt']=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0x3f')]='abandoned';this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423][_0x418a('0x4a')]=_0x418a('0x56');logger[_0x418a('0x24')](_0x418a('0x57'),_0x38f469[_0x418a('0x26')],util['inspect'](this[_0x418a('0x28')][_0x38f469[_0x418a('0x26')]][_0x3e7423],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')]('custom:agentqueuecallerabandon',this['channels'][_0x38f469[_0x418a('0x26')]][_0x3e7423]);}}}}}catch(_0x31a88e){logger[_0x418a('0x35')]('[%s][voiceAgentReport][queuecallerabandon]',_0x38f469[_0x418a('0x26')],util[_0x418a('0x27')](_0x31a88e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x58')]=function(_0x47b179){try{if(this['isNotNull'](_0x47b179)){logger[_0x418a('0x24')](_0x418a('0x59'),_0x47b179[_0x418a('0x26')],util[_0x418a('0x27')](_0x47b179,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x47b179['uniqueid']]){for(var _0x46dca0 in this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]]){if(this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x418a('0x37')](_0x46dca0)){if(this['channels'][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x39')]&&!this['channels'][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x13')]){logger[_0x418a('0x21')](_0x418a('0x5a'),_0x47b179[_0x418a('0x26')],this['channels'][_0x47b179['uniqueid']][_0x46dca0][_0x418a('0x34')],_0x46dca0);this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0]['agentcomplete']=!![];this['channels'][_0x47b179['uniqueid']][_0x46dca0][_0x418a('0x5b')]=moment()[_0x418a('0x29')](_0x418a('0x2a'));this[_0x418a('0x28')][_0x47b179['uniqueid']][_0x46dca0]['lastevent']=_0x418a('0x5c');this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x4a')]=_0x47b179[_0x418a('0x4a')]=='transfer'?_0x418a('0x5d'):_0x47b179[_0x418a('0x4a')];this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x5e')]=_0x47b179['talktime'];if(this[_0x418a('0xa')][_0x47b179[_0x418a('0x2c')]]&&this['voiceQueues'][_0x47b179['queue']][_0x418a('0x5f')]){this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0][_0x418a('0x60')]=this['voiceQueues'][_0x47b179[_0x418a('0x2c')]][_0x418a('0x61')];this[_0x418a('0x28')][_0x47b179['uniqueid']][_0x46dca0][_0x418a('0x62')]=!![];}this[_0x418a('0xb')][_0x47b179[_0x418a('0x40')]]=_[_0x418a('0x30')](this[_0x418a('0xb')][_0x47b179[_0x418a('0x40')]],['queue',_0x418a('0x42')]);logger[_0x418a('0x24')](_0x418a('0x63'),_0x47b179[_0x418a('0x26')],util['inspect'](this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0],{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x64'),this['channels'][_0x47b179[_0x418a('0x26')]][_0x46dca0]);logger['debug'](_0x418a('0x65'),_0x47b179[_0x418a('0x26')],util[_0x418a('0x27')](this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0],{'showHidden':![],'depth':null}));this[_0x418a('0x1e')](util[_0x418a('0x29')](_0x418a('0x45'),_0x47b179[_0x418a('0x34')]),_0x418a('0x66'),this[_0x418a('0x28')][_0x47b179[_0x418a('0x26')]][_0x46dca0]);}}}}}}catch(_0x1589fc){logger[_0x418a('0x35')](_0x418a('0x67'),_0x47b179['uniqueid'],util[_0x418a('0x27')](_0x1589fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x15')]=function(_0x8fcbe0){try{if(this[_0x418a('0x1f')](_0x8fcbe0)){logger[_0x418a('0x24')](_0x418a('0x68'),_0x8fcbe0['uniqueid'],util['inspect'](_0x8fcbe0,{'showHidden':![],'depth':null}));this[_0x418a('0x69')](_0x8fcbe0[_0x418a('0x26')],_[_0x418a('0x6a')](_0x8fcbe0[_0x418a('0x6b')])[0x0],_0x8fcbe0[_0x418a('0x6c')]);if(this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]]){for(var _0x22e53a in this['channels'][_0x8fcbe0[_0x418a('0x26')]]){if(this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x418a('0x37')](_0x22e53a)){logger[_0x418a('0x21')](_0x418a('0x6d'),_0x8fcbe0['uniqueid'],_0x22e53a,_[_0x418a('0x6a')](_0x8fcbe0['variable'])[0x0],_0x8fcbe0[_0x418a('0x6c')]);if(_['isUndefined'](this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x22e53a][_0x418a('0x6e')])){this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x22e53a][_0x418a('0x6e')]={};}this[_0x418a('0x28')][_0x8fcbe0[_0x418a('0x26')]][_0x22e53a][_0x418a('0x6e')]=this[_0x418a('0x6e')][_0x8fcbe0[_0x418a('0x26')]];}}}}}catch(_0x533d09){logger['error'](_0x418a('0x6f'),_0x8fcbe0[_0x418a('0x26')],util[_0x418a('0x27')](_0x533d09,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x69')]=function(_0x1b4a00,_0x13ba2e,_0x318034){var _0x27c6ee=[_0x418a('0x70'),_0x418a('0x71'),'rtpaudioqosjitter',_0x418a('0x72'),_0x418a('0x73'),_0x418a('0x74'),_0x418a('0x75'),'rtpaudioqosrttbridged',_0x418a('0x76'),'sipuri','bridgepeer','bridgepvtcallid',_0x418a('0x77'),_0x418a('0x78'),_0x418a('0x79'),_0x418a('0x7a'),_0x418a('0x34'),_0x418a('0x7b'),'memberrealtime'];if(!_['isNil'](_0x13ba2e)&&!_[_0x418a('0x7c')](_0x27c6ee,_0x13ba2e)){if(_[_0x418a('0x20')](this[_0x418a('0x6e')][_0x1b4a00])){this[_0x418a('0x6e')][_0x1b4a00]={};}this[_0x418a('0x6e')][_0x1b4a00][_0x13ba2e]=_0x318034;}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x17')]=function(_0x20a102){try{if(this[_0x418a('0x1f')](_0x20a102)){logger[_0x418a('0x24')](_0x418a('0x7d'),_0x20a102[_0x418a('0x26')],util['inspect'](_0x20a102,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x20a102['uniqueid']]){for(var _0x499c0e in this[_0x418a('0x28')][_0x20a102['uniqueid']]){if(this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]][_0x418a('0x37')](_0x499c0e)){if(this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]][_0x499c0e][_0x418a('0x4a')]==_0x418a('0x7e')&&this['channels'][_0x20a102[_0x418a('0x26')]][_0x499c0e][_0x418a('0x13')]){logger['info'](_0x418a('0x7f'),_0x20a102['uniqueid'],_0x499c0e);this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]][_0x499c0e]['agentcompleteAt']=moment()[_0x418a('0x29')](_0x418a('0x2a'));}}}logger['debug'](_0x418a('0x80'),_0x20a102[_0x418a('0x26')],util[_0x418a('0x27')](_[_0x418a('0x81')](this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x418a('0x1e')](_0x418a('0x82'),_[_0x418a('0x81')](this[_0x418a('0x28')][_0x20a102[_0x418a('0x26')]]));delete this[_0x418a('0x28')][_0x20a102['uniqueid']];}if(this[_0x418a('0x6e')][_0x20a102[_0x418a('0x26')]]){delete this[_0x418a('0x6e')][_0x20a102[_0x418a('0x26')]];}}}catch(_0x13c7b9){logger[_0x418a('0x35')]('[%s][voiceAgentReport][hangup]',_0x20a102['uniqueid'],util[_0x418a('0x27')](_0x13c7b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x1b')]=function(_0x698472){try{if(this[_0x418a('0x1f')](_0x698472)){logger[_0x418a('0x24')](_0x418a('0x83'),_0x698472[_0x418a('0x26')],util['inspect'](_0x698472,{'showHidden':![],'depth':null}));if(this['channels'][_0x698472[_0x418a('0x84')]]){for(var _0x35b563 in this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]]){if(this[_0x418a('0x28')][_0x698472['transfereeuniqueid']]['hasOwnProperty'](_0x35b563)){if(_0x698472[_0x418a('0x85')]===_0x35b563){logger[_0x418a('0x21')](_0x418a('0x86'),_0x698472[_0x418a('0x26')],this['channels'][_0x698472['transfereeuniqueid']][_0x35b563]['membername'],_0x35b563);var _0x4d8d57=moment();this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]][_0x35b563][_0x418a('0x13')]=!![];this['channels'][_0x698472['transfereeuniqueid']][_0x35b563][_0x418a('0x5b')]=moment()[_0x418a('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x698472['transfereeuniqueid']][_0x35b563][_0x418a('0x3f')]='complete';this['channels'][_0x698472[_0x418a('0x84')]][_0x35b563][_0x418a('0x4a')]=_0x418a('0x7e');this[_0x418a('0x28')][_0x698472['transfereeuniqueid']][_0x35b563][_0x418a('0x5e')]=_0x4d8d57[_0x418a('0x87')](this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]][_0x35b563][_0x418a('0x39')],_0x418a('0x88'));}}}}if(this['channels'][_0x698472[_0x418a('0x89')]]){var _0x3e8350=this[_0x418a('0x28')][_0x698472[_0x418a('0x89')]];this[_0x418a('0x28')][_0x698472[_0x418a('0x89')]]=this[_0x418a('0x28')][_0x698472[_0x418a('0x84')]];this['channels'][_0x698472[_0x418a('0x84')]]=_0x3e8350;}}}catch(_0x6d003d){logger[_0x418a('0x35')]('[%s][voiceAgentReport][attendedtransfer]',_0x698472[_0x418a('0x26')],util[_0x418a('0x27')](_0x6d003d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x8a')]=function(_0x14792f){try{if(this[_0x418a('0x1f')](_0x14792f)){logger[_0x418a('0x24')](_0x418a('0x8b'),_0x14792f[_0x418a('0x26')],util[_0x418a('0x27')](_0x14792f,{'showHidden':![],'depth':null}));if(this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]]){for(var _0x1cfe6f in this['channels'][_0x14792f[_0x418a('0x84')]]){if(this['channels'][_0x14792f[_0x418a('0x84')]][_0x418a('0x37')](_0x1cfe6f)){if(_0x14792f[_0x418a('0x8c')]===_0x1cfe6f){logger[_0x418a('0x21')](_0x418a('0x8d'),_0x14792f[_0x418a('0x26')],this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x34')],_0x1cfe6f);var _0x7336c5=moment();this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x13')]=!![];this['channels'][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x5b')]=_0x7336c5;this[_0x418a('0x28')][_0x14792f['transfereeuniqueid']][_0x1cfe6f]['lastevent']='complete';this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x4a')]='transfer';this['channels'][_0x14792f[_0x418a('0x84')]][_0x1cfe6f][_0x418a('0x5e')]=_0x7336c5[_0x418a('0x87')](this[_0x418a('0x28')][_0x14792f[_0x418a('0x84')]][_0x1cfe6f]['agentconnectAt'],_0x418a('0x88'));}}}}}}catch(_0x332244){logger['error'](_0x418a('0x8e'),_0x14792f[_0x418a('0x26')],util[_0x418a('0x27')](_0x332244,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x418a('0x1d')][_0x418a('0x19')]=function(_0x7f70d5){var _0xee199c='';try{if(this[_0x418a('0x1f')](_0x7f70d5)){logger[_0x418a('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x7f70d5['uniqueid'],util[_0x418a('0x27')](_0x7f70d5,{'showHidden':![],'depth':null}));if(_0x7f70d5[_0x418a('0x8f')]){_0xee199c=_0x7f70d5[_0x418a('0x8f')][_0x418a('0x90')](0x0,_0x7f70d5[_0x418a('0x8f')]['lastIndexOf']('-'));if(this['agents'][_0xee199c]){logger[_0x418a('0x21')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x7f70d5[_0x418a('0x26')],_0xee199c);this[_0x418a('0xb')][_0xee199c][_0x418a('0x91')]=!![];}}}}catch(_0x1663e9){logger[_0x418a('0x35')]('[%s][voiceAgentReport][musiconholdstart]',_0x7f70d5[_0x418a('0x26')],util[_0x418a('0x27')](_0x1663e9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x25f07b){var _0x583940='';try{if(this[_0x418a('0x1f')](_0x25f07b)){logger[_0x418a('0x24')](_0x418a('0x92'),_0x25f07b[_0x418a('0x26')],util[_0x418a('0x27')](_0x25f07b,{'showHidden':![],'depth':null}));if(_0x25f07b[_0x418a('0x8f')]){_0x583940=_0x25f07b[_0x418a('0x8f')]['substring'](0x0,_0x25f07b[_0x418a('0x8f')][_0x418a('0x93')]('-'));if(this['agents'][_0x583940]){logger[_0x418a('0x21')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x25f07b[_0x418a('0x26')],_0x583940);this[_0x418a('0xb')][_0x583940][_0x418a('0x91')]=![];}}}}catch(_0xcd7a32){logger['error'](_0x418a('0x94'),_0x25f07b[_0x418a('0x26')],util['inspect'](_0xcd7a32,{'showHidden':![],'depth':null}));}};module[_0x418a('0x95')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 37a2d31..1135106 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 _0x5516=['answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','membername','name','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isUndefined','emit','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','context','from-sip','split','destconnectedlinenum','exten','debug','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','match','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0x5516,0x1b8));var _0x6551=function(_0x5e0914,_0x481afe){_0x5e0914=_0x5e0914-0x0;var _0x5eebff=_0x5516[_0x5e0914];return _0x5eebff;};'use strict';var BPromise=require(_0x6551('0x0'));var _=require('lodash');var moment=require(_0x6551('0x1'));var util=require(_0x6551('0x2'));var path=require(_0x6551('0x3'));var Redis=require(_0x6551('0x4'));var config=require(_0x6551('0x5'));var logger=require(_0x6551('0x6'))('ami');var ami=require('../ami');var Channel=require(_0x6551('0x7'));var statusDesc=[_0x6551('0x8'),_0x6551('0x9'),_0x6551('0xa'),_0x6551('0xb'),_0x6551('0xc'),_0x6551('0xd'),'ringing',_0x6551('0xe'),_0x6551('0xf')];var applications=[_0x6551('0x10'),'queue',_0x6551('0x11'),_0x6551('0x12'),_0x6551('0x13'),_0x6551('0x14')];var dispositions=[_0x6551('0x15'),_0x6551('0x16'),_0x6551('0x16'),_0x6551('0x15'),_0x6551('0x15'),'NO\x20ANSWER',_0x6551('0x17'),'BUSY','FAILED','FAILED',_0x6551('0x16')];var actions={};config[_0x6551('0x18')]=_[_0x6551('0x19')](config['redis'],{'host':_0x6551('0x1a'),'port':0x18eb});var io=require(_0x6551('0x1b'))(new Redis(config['redis']));function VoiceCallReport(_0x29f4d2){this[_0x6551('0x1c')]=_0x29f4d2[_0x6551('0x1c')];this['agents']=_0x29f4d2[_0x6551('0x1d')];this[_0x6551('0x1e')]={};ami['on'](_0x6551('0x1f'),this[_0x6551('0x20')][_0x6551('0x21')](this));ami['on'](_0x6551('0x22'),this[_0x6551('0x20')][_0x6551('0x21')](this));ami['on']('newchannel',this[_0x6551('0x23')][_0x6551('0x21')](this));ami['on'](_0x6551('0x24'),this['syncNewState'][_0x6551('0x21')](this));ami['on'](_0x6551('0x25'),this[_0x6551('0x26')][_0x6551('0x21')](this));ami['on'](_0x6551('0x27'),this[_0x6551('0x28')][_0x6551('0x21')](this));ami['on'](_0x6551('0x29'),this[_0x6551('0x2a')][_0x6551('0x21')](this));ami['on']('attendedtransfer',this[_0x6551('0x2b')][_0x6551('0x21')](this));ami['on'](_0x6551('0x2c'),this[_0x6551('0x2d')]['bind'](this));ami['on'](_0x6551('0x2e'),this[_0x6551('0x2f')]['bind'](this));ami['on'](_0x6551('0x30'),this[_0x6551('0x31')]['bind'](this));try{logger[_0x6551('0x32')](_0x6551('0x33'));ami[_0x6551('0x34')]();}catch(_0x3ac5e7){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x6551('0x35')](_0x3ac5e7,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x5aba73){return _0x5aba73!==null&&!_[_0x6551('0x36')](_0x5aba73);};VoiceCallReport['prototype'][_0x6551('0x37')]=function(_0x271ed0,_0x5fb119,_0x23a56c){io['to'](_0x271ed0)[_0x6551('0x37')](_0x5fb119,_0x23a56c);};VoiceCallReport[_0x6551('0x38')]['syncNewCallerId']=function(_0x32dd20){try{if(this[_0x6551('0x39')](_0x32dd20)){logger['info'](_0x6551('0x3a'),_0x32dd20[_0x6551('0x3b')],_0x32dd20[_0x6551('0x3c')],_0x32dd20[_0x6551('0x3d')]);logger['debug'](_0x6551('0x3e'),_0x32dd20['uniqueid'],util[_0x6551('0x35')](_0x32dd20,{'showHidden':![],'depth':null}));if(_0x32dd20[_0x6551('0x3b')]===_0x32dd20[_0x6551('0x3f')]){if(!_['isUndefined'](this[_0x6551('0x1c')][_0x32dd20[_0x6551('0x3b')]])){_[_0x6551('0x40')](this[_0x6551('0x1c')][_0x32dd20[_0x6551('0x3b')]],_[_0x6551('0x41')](_0x32dd20,_[_0x6551('0x42')](this[_0x6551('0x1c')][_0x32dd20[_0x6551('0x3b')]])));}}}}catch(_0x180776){logger[_0x6551('0x43')](_0x6551('0x44'),_0x32dd20['uniqueid'],util[_0x6551('0x35')](_0x180776,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')]['syncNewChannel']=function(_0x3e8065){try{if(this['isNotNull'](_0x3e8065)){logger['debug'](_0x6551('0x45'),_0x3e8065['uniqueid'],util[_0x6551('0x35')](_0x3e8065,{'showHidden':![],'depth':null}));if(_0x3e8065[_0x6551('0x3b')]===_0x3e8065[_0x6551('0x3f')]&&_0x3e8065[_0x6551('0x46')]!='OutgoingSpoolFailed'){if(_[_0x6551('0x36')](this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]])){logger[_0x6551('0x32')](_0x6551('0x47'),_0x3e8065[_0x6551('0x3b')],_0x3e8065['context'],_0x3e8065['exten']);this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]]=new Channel();this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]][_0x6551('0x48')]=moment()[_0x6551('0x49')](_0x6551('0x4a'));this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]][_0x6551('0x4b')]=dispositions[_[_0x6551('0x4c')](_0x3e8065['channelstate'])];_[_0x6551('0x40')](this[_0x6551('0x1c')][_0x3e8065['uniqueid']],_[_0x6551('0x41')](_0x3e8065,_[_0x6551('0x42')](this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]])));if(_0x3e8065[_0x6551('0x4d')]===_0x6551('0x4e')){if(this[_0x6551('0x1d')][_0x3e8065['channel'][_0x6551('0x4f')]('-')[0x0]]){this['agents'][_0x3e8065[_0x6551('0x46')]['split']('-')[0x0]][_0x6551('0x50')]=_0x3e8065[_0x6551('0x51')];logger[_0x6551('0x52')](_0x6551('0x53'),_0x3e8065[_0x6551('0x3b')],util[_0x6551('0x35')]({'destaccountcode':this[_0x6551('0x1d')][_0x3e8065[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')],'destconnectedlinenum':_0x3e8065['exten']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x6551('0x55'),this[_0x6551('0x1d')][_0x3e8065[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x6551('0x1d')][_0x3e8065[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')],'destconnectedlinenum':_0x3e8065[_0x6551('0x51')]});}}}}}}catch(_0x1a0481){logger[_0x6551('0x43')]('[%s][voiceCallReport][newchannel]',_0x3e8065['uniqueid'],util[_0x6551('0x35')](_0x1a0481,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x20')]=function(_0x1ac52d){try{if(this[_0x6551('0x39')](_0x1ac52d)){logger['debug'](_0x6551('0x56'),_0x1ac52d['uniqueid'],util[_0x6551('0x35')](_0x1ac52d,{'showHidden':![],'depth':null}));if(_0x1ac52d['uniqueid']===_0x1ac52d['linkedid']&&_0x1ac52d[_0x6551('0x51')]!='h'&&_0x1ac52d[_0x6551('0x46')]!=_0x6551('0x57')){_0x1ac52d[_0x6551('0x58')]=_0x1ac52d['application'][_0x6551('0x59')]();_0x1ac52d[_0x6551('0x5a')]=(_0x1ac52d[_0x6551('0x5b')]||_0x1ac52d[_0x6551('0x5a')])[_0x6551('0x59')]();logger['info'](_0x6551('0x5c'),_0x1ac52d[_0x6551('0x3b')],_0x1ac52d[_0x6551('0x58')],_0x1ac52d[_0x6551('0x5a')]);if(_[_0x6551('0x36')](this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]])){this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]]=new Channel();this['channels'][_0x1ac52d[_0x6551('0x3b')]]['starttime']=_0x1ac52d[_0x6551('0x5d')]?moment()[_0x6551('0x5e')](moment['duration'](_0x1ac52d[_0x6551('0x5d')])[_0x6551('0x5f')](),_0x6551('0x5f'))[_0x6551('0x49')](_0x6551('0x4a')):moment()[_0x6551('0x49')](_0x6551('0x4a'));this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]][_0x6551('0x4b')]=_0x6551('0x15');}_['merge'](this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]],_[_0x6551('0x41')](_0x1ac52d,_['keys'](this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]])));if(_[_0x6551('0x60')](applications,_0x1ac52d[_0x6551('0x58')])){this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]][_0x6551('0x61')]=_0x1ac52d[_0x6551('0x58')];this[_0x6551('0x1c')][_0x1ac52d['uniqueid']][_0x6551('0x62')]=_0x1ac52d[_0x6551('0x5a')];if(_0x1ac52d[_0x6551('0x58')]===_0x6551('0x10')&&_[_0x6551('0x63')](_0x1ac52d[_0x6551('0x5a')],'cdr(')){var _0x182e3d=_0x1ac52d[_0x6551('0x5a')][_0x6551('0x4f')]('=');var _0x3985b0=_0x182e3d[0x0][_0x6551('0x64')](/cdr\((.*)\)/);if(_0x3985b0){this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]][_0x3985b0[0x1]]=_0x182e3d[0x1];}}else if(_0x1ac52d['application']==='queue'){this[_0x6551('0x1c')][_0x1ac52d['uniqueid']][_0x6551('0x65')]=_0x1ac52d['applicationdata'][_0x6551('0x4f')](',')[0x0];}}}}}catch(_0x4223f){logger[_0x6551('0x43')](_0x6551('0x66'),_0x1ac52d[_0x6551('0x3b')],util[_0x6551('0x35')](_0x4223f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x67')]=function(_0x3d7ad0){try{if(this[_0x6551('0x39')](_0x3d7ad0)){logger[_0x6551('0x32')](_0x6551('0x68'),_0x3d7ad0[_0x6551('0x3b')],_0x3d7ad0[_0x6551('0x3f')],_0x3d7ad0['calleridname'],_0x3d7ad0['calleridnum']);logger[_0x6551('0x52')]('[%s][voiceCallReport][newstate]\x20event:',_0x3d7ad0[_0x6551('0x3b')],util[_0x6551('0x35')](_0x3d7ad0,{'showHidden':![],'depth':null}));if(_0x3d7ad0[_0x6551('0x3b')]!==_0x3d7ad0[_0x6551('0x3f')]){if(this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]]){if(_0x3d7ad0[_0x6551('0x69')]==='6'){if(!this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6a')]){var _0x52e8fc=moment();this['channels'][_0x3d7ad0[_0x6551('0x3f')]]['answered']=!![];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6b')]=_0x52e8fc[_0x6551('0x49')](_0x6551('0x4a'));if(this['channels'][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x48')]){this[_0x6551('0x1c')][_0x3d7ad0['linkedid']][_0x6551('0x6c')]=_0x52e8fc[_0x6551('0x6d')](this['channels'][_0x3d7ad0['linkedid']]['starttime'],_0x6551('0x5f'));}}this[_0x6551('0x1c')][_0x3d7ad0['linkedid']][_0x6551('0x3f')]=_0x3d7ad0[_0x6551('0x3b')];if(_0x3d7ad0[_0x6551('0x3d')]!=='xcally-motion-preview'){this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6e')]=_0x3d7ad0[_0x6551('0x3d')];}this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6f')]=_0x3d7ad0['calleridname'];this[_0x6551('0x1c')][_0x3d7ad0['linkedid']][_0x6551('0x70')]=_0x3d7ad0[_0x6551('0x46')];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x4b')]=dispositions[_[_0x6551('0x4c')](_0x3d7ad0[_0x6551('0x69')])];if(this[_0x6551('0x1d')][_0x3d7ad0['channel'][_0x6551('0x4f')]('-')[0x0]]){this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]]['UserId']=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['id'];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x71')]=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x72')];}}}}else{if(this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3b')]]){if(_0x3d7ad0[_0x6551('0x69')]==='6'){if(this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]){this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3b')]]['UserId']=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['id'];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3b')]][_0x6551('0x71')]=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['name'];}}}}}}catch(_0x18c29a){logger[_0x6551('0x43')]('[%s][voiceCallReport][newstate]',_0x3d7ad0['uniqueid'],util[_0x6551('0x35')](_0x18c29a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x73')]=function(_0x32958b,_0x484fcd){try{if(this['channels'][_0x32958b]){logger[_0x6551('0x32')](_0x6551('0x74'),_0x32958b,_0x484fcd);this[_0x6551('0x1c')][_0x32958b]['monitor']=!![];if(_[_0x6551('0x75')](_0x484fcd,_0x6551('0x76'))){_0x484fcd=_0x484fcd[_0x6551('0x77')](_0x6551('0x76'),_0x6551('0x78'));}this[_0x6551('0x1c')][_0x32958b][_0x6551('0x79')]=_0x484fcd;var _0x314645=_[_0x6551('0x7a')](this[_0x6551('0x1c')][_0x32958b][_0x6551('0x7b')],{'filename':_0x484fcd});if(_['isNil'](_0x314645)){this[_0x6551('0x1c')][_0x32958b]['monitors']['push']({'filename':_0x484fcd,'createdAt':moment()[_0x6551('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x377ab5){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x32958b,util[_0x6551('0x35')](_0x377ab5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x26')]=function(_0x5767f0){try{if(this[_0x6551('0x39')](_0x5767f0)){logger[_0x6551('0x52')](_0x6551('0x7c'),_0x5767f0['uniqueid'],util['inspect'](_0x5767f0,{'showHidden':![],'depth':null}));if(this['channels'][_0x5767f0[_0x6551('0x3b')]]&&_0x5767f0[_0x6551('0x46')]!=_0x6551('0x57')){if(this[_0x6551('0x39')](_0x5767f0['variable'])){if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x7e')])){logger[_0x6551('0x32')](_0x6551('0x7f'),_0x5767f0[_0x6551('0x3b')],_0x5767f0['value']);this[_0x6551('0x73')](_0x5767f0['uniqueid'],_0x5767f0['value']);}else if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')]['xmd-phone'])){logger[_0x6551('0x32')](_0x6551('0x80'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this['channels'][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x3d')]=_0x5767f0[_0x6551('0x81')];}else if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')][_0x6551('0x82')])){logger[_0x6551('0x32')](_0x6551('0x83'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x84')]=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x85')])){logger['info'](_0x6551('0x86'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]]['type']=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5767f0[_0x6551('0x3b')],_0x5767f0['value'][_0x6551('0x4f')](',')[0x0]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]]['queue']=_0x5767f0['value'][_0x6551('0x4f')](',')[0x0];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x88')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0['uniqueid']][_0x6551('0x89')]=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')]['xmd-destination'])){logger['info'](_0x6551('0x8a'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0['uniqueid']]['destination']=_0x5767f0['value'];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x8b')])){logger[_0x6551('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5767f0['uniqueid'],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x8c')]=_0x5767f0[_0x6551('0x81')];}else if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')][_0x6551('0x8d')])){logger[_0x6551('0x32')](_0x6551('0x8e'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x65')]=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0['variable'][_0x6551('0x8f')])){logger[_0x6551('0x32')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]]['sipcalluniqueid']=_0x5767f0[_0x6551('0x81')];}}}else if(this['isNotNull'](_0x5767f0['variable'][_0x6551('0x7e')])){if(_0x5767f0[_0x6551('0x81')]){var _0x438e45=path[_0x6551('0x90')](_0x5767f0[_0x6551('0x81')])[_0x6551('0x72')];logger[_0x6551('0x32')](_0x6551('0x7f'),_0x438e45,_0x5767f0[_0x6551('0x81')]);this['syncMixMonitorFilename'](_0x438e45,_0x5767f0[_0x6551('0x81')]);}}else if(this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3f')]]){if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')])){if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')][_0x6551('0x8f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5767f0[_0x6551('0x3f')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3f')]][_0x6551('0x91')]=_0x5767f0[_0x6551('0x81')];}}}}}catch(_0x29e9f6){logger['error'](_0x6551('0x92'),_0x5767f0[_0x6551('0x3b')],util[_0x6551('0x35')](_0x29e9f6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6551('0x28')]=function(_0x56c18a){try{if(this[_0x6551('0x39')](_0x56c18a)){logger[_0x6551('0x52')]('[%s][voiceCallReport][hangup]\x20event:',_0x56c18a['uniqueid'],util[_0x6551('0x35')](_0x56c18a,{'showHidden':![],'depth':null}));if(this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]]){logger[_0x6551('0x32')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x56c18a[_0x6551('0x3b')],_0x56c18a[_0x6551('0x93')]);var _0x10f10d=moment();this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x94')]=_0x10f10d[_0x6551('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6551('0x1c')][_0x56c18a['uniqueid']]['duration']=_0x10f10d['diff'](this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]]['starttime'],'seconds');if(this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x6a')]){this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x95')]=_0x10f10d['diff'](this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x6b')],_0x6551('0x5f'));this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]]['holdtime']=this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x5d')]-this['channels'][_0x56c18a[_0x6551('0x3b')]]['billableseconds'];}if(_0x56c18a[_0x6551('0x4d')]===_0x6551('0x4e')){if(this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')]['split']('-')[0x0]]){this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]=_[_0x6551('0x96')](this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]],['destconnectedlinenum']);logger[_0x6551('0x52')](_0x6551('0x97'),_0x56c18a[_0x6551('0x3b')],util[_0x6551('0x35')]({'destaccountcode':this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x6551('0x49')]('user:%s',this[_0x6551('0x1d')][_0x56c18a['channel'][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x72')]),_0x6551('0x98'),{'destaccountcode':this[_0x6551('0x1d')][_0x56c18a['channel'][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')]});}}if(_0x56c18a['event']===_0x6551('0x99')){this['blindTransfers'][_0x56c18a[_0x6551('0x3b')]]=this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]];}else{if(this[_0x6551('0x1c')][_0x56c18a['uniqueid']][_0x6551('0x9a')]===_0x6551('0x9b')&&this[_0x6551('0x1e')][_0x56c18a[_0x6551('0x3b')]]){this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x3b')]=[this[_0x6551('0x1c')][_0x56c18a['uniqueid']][_0x6551('0x3f')],this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x3f')]=this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x3b')]][0x0];delete this[_0x6551('0x1e')][_0x56c18a[_0x6551('0x3b')]];}}logger[_0x6551('0x52')](_0x6551('0x9c'),_0x56c18a[_0x6551('0x3b')],util[_0x6551('0x35')](this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]],{'showHidden':![],'depth':null}));ami[_0x6551('0x37')]('custom:voiceCallReport',this[_0x6551('0x1c')][_0x56c18a['uniqueid']]);delete this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]];}}}catch(_0x265e33){logger[_0x6551('0x43')](_0x6551('0x9d'),_0x56c18a[_0x6551('0x3b')],util[_0x6551('0x35')](_0x265e33,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x2b')]=function(_0x1e4e0f){try{if(this[_0x6551('0x39')](_0x1e4e0f)){logger[_0x6551('0x32')](_0x6551('0x9e'),_0x1e4e0f[_0x6551('0x3b')],_0x1e4e0f[_0x6551('0x9f')],_0x1e4e0f[_0x6551('0xa0')]);logger[_0x6551('0x52')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x1e4e0f[_0x6551('0x3b')],util[_0x6551('0x35')](_0x1e4e0f,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e4e0f['transfereeuniqueid']]){this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa1')]][_0x6551('0xa2')]=_0x1e4e0f[_0x6551('0x9f')];this[_0x6551('0x1c')][_0x1e4e0f['transfereeuniqueid']][_0x6551('0xa3')]=_0x1e4e0f[_0x6551('0xa0')];if(this['channels'][_0x1e4e0f[_0x6551('0xa4')]]){var _0x5b840d=this['channels'][_0x1e4e0f['secondtransfereruniqueid']];this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa4')]]=this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa1')]];this['channels'][_0x1e4e0f[_0x6551('0xa1')]]=_0x5b840d;}}else if(this[_0x6551('0x1c')][_0x1e4e0f['transfertargetuniqueid']]){this[_0x6551('0x1c')][_0x1e4e0f['transfertargetuniqueid']]['transfercalleridnum']=_0x1e4e0f[_0x6551('0x9f')];this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa5')]][_0x6551('0xa3')]=_0x1e4e0f[_0x6551('0xa0')];if(this[_0x6551('0x1c')][_0x1e4e0f['origtransfereruniqueid']]){var _0x5b840d=this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa6')]];this[_0x6551('0x1c')][_0x1e4e0f['origtransfereruniqueid']]=this['channels'][_0x1e4e0f[_0x6551('0xa5')]];this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa5')]]=_0x5b840d;}}}}catch(_0x5a494f){logger[_0x6551('0x43')](_0x6551('0xa7'),_0x1e4e0f[_0x6551('0x3b')],util[_0x6551('0x35')](_0x5a494f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')]['syncBlindTransfer']=function(_0x1b74f6){try{if(this['isNotNull'](_0x1b74f6)){logger['info'](_0x6551('0xa8'),_0x1b74f6['uniqueid'],_0x1b74f6[_0x6551('0xa9')],_0x1b74f6['extension']);logger[_0x6551('0x52')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1b74f6['uniqueid'],util[_0x6551('0x35')](_0x1b74f6,{'showHidden':![],'depth':null}));if(this[_0x6551('0x1c')][_0x1b74f6[_0x6551('0xa1')]]){this[_0x6551('0x1c')][_0x1b74f6[_0x6551('0xa1')]][_0x6551('0xa2')]=_0x1b74f6['transfereecalleridnum'];this[_0x6551('0x1c')][_0x1b74f6[_0x6551('0xa1')]]['transferconnectedlinenum']=_0x1b74f6['extension'];this[_0x6551('0x28')]({'event':'BlindTransfer','uniqueid':_0x1b74f6[_0x6551('0xa1')],'context':_0x1b74f6[_0x6551('0x4d')],'channel':_0x1b74f6[_0x6551('0xaa')]});}}}catch(_0x25745f){logger[_0x6551('0x43')]('[%s][voiceCallReport][blindtransfer]',_0x1b74f6[_0x6551('0x3b')],util[_0x6551('0x35')](_0x25745f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6551('0x2f')]=function(_0x5af2f5){try{if(this[_0x6551('0x39')](_0x5af2f5)){logger[_0x6551('0x52')](_0x6551('0xab'),_0x5af2f5[_0x6551('0x3b')],util[_0x6551('0x35')](_0x5af2f5,{'showHidden':![],'depth':null}));if(this['channels'][_0x5af2f5['uniqueid']]){if(!_[_0x6551('0xac')](this[_0x6551('0x1c')][_0x5af2f5['uniqueid']][_0x6551('0x6b')])){this[_0x6551('0x1c')][_0x5af2f5['uniqueid']]['mohstarttime']=moment()[_0x6551('0x49')](_0x6551('0x4a'));logger[_0x6551('0x32')](_0x6551('0xad'),_0x5af2f5['uniqueid'],this[_0x6551('0x1c')][_0x5af2f5['uniqueid']][_0x6551('0xae')]);}}}}catch(_0x204d5e){logger[_0x6551('0x43')](_0x6551('0xaf'),_0x5af2f5['uniqueid'],util[_0x6551('0x35')](_0x204d5e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x31')]=function(_0x1693b1){try{if(this[_0x6551('0x39')](_0x1693b1)){logger[_0x6551('0x52')](_0x6551('0xb0'),_0x1693b1[_0x6551('0x3b')],util[_0x6551('0x35')](_0x1693b1,{'showHidden':![],'depth':null}));if(this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]]){if(!_[_0x6551('0xac')](this['channels'][_0x1693b1['uniqueid']][_0x6551('0xae')])){this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xb1')]+=moment()[_0x6551('0xb2')](0x0)[_0x6551('0x6d')](this['channels'][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xae')],_0x6551('0x5f'));logger[_0x6551('0x32')](_0x6551('0xb3'),_0x1693b1[_0x6551('0x3b')],this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xb1')]);delete this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xae')];}}}}catch(_0x59feb8){logger['error'](_0x6551('0xb4'),_0x1693b1[_0x6551('0x3b')],util[_0x6551('0x35')](_0x59feb8,{'showHidden':![],'depth':null}));}};module[_0x6551('0xb5')]=VoiceCallReport; \ No newline at end of file +var _0xd2cf=['application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','disposition','keys','includes','lastdata','set','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','answertime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','syncHangup','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','attendedtransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','error','debug','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','channelstate','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0xd2cf,0x1e6));var _0xfd2c=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xd2cf[_0xb1cf84];return _0x4bad2e;};'use strict';var BPromise=require(_0xfd2c('0x0'));var _=require(_0xfd2c('0x1'));var moment=require('moment');var util=require(_0xfd2c('0x2'));var path=require(_0xfd2c('0x3'));var Redis=require(_0xfd2c('0x4'));var config=require(_0xfd2c('0x5'));var logger=require(_0xfd2c('0x6'))(_0xfd2c('0x7'));var ami=require(_0xfd2c('0x8'));var Channel=require('../model/channel');var statusDesc=[_0xfd2c('0x9'),_0xfd2c('0xa'),_0xfd2c('0xb'),_0xfd2c('0xc'),'invalid',_0xfd2c('0xd'),_0xfd2c('0xe'),_0xfd2c('0xf'),_0xfd2c('0x10')];var applications=['set',_0xfd2c('0x11'),_0xfd2c('0x12'),_0xfd2c('0x13'),_0xfd2c('0x14'),'voicemail'];var dispositions=[_0xfd2c('0x15'),'FAILED',_0xfd2c('0x16'),_0xfd2c('0x15'),_0xfd2c('0x15'),_0xfd2c('0x15'),_0xfd2c('0x17'),'BUSY','FAILED',_0xfd2c('0x16'),'FAILED'];var actions={};config['redis']=_[_0xfd2c('0x18')](config[_0xfd2c('0x19')],{'host':'localhost','port':0x18eb});var io=require(_0xfd2c('0x1a'))(new Redis(config[_0xfd2c('0x19')]));function VoiceCallReport(_0x435dbe){this[_0xfd2c('0x1b')]=_0x435dbe['channels'];this[_0xfd2c('0x1c')]=_0x435dbe[_0xfd2c('0x1c')];this['blindTransfers']={};ami['on'](_0xfd2c('0x1d'),this[_0xfd2c('0x1e')][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x20'),this[_0xfd2c('0x1e')][_0xfd2c('0x1f')](this));ami['on']('newchannel',this[_0xfd2c('0x21')][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x22'),this[_0xfd2c('0x23')]['bind'](this));ami['on'](_0xfd2c('0x24'),this[_0xfd2c('0x25')]['bind'](this));ami['on'](_0xfd2c('0x26'),this['syncHangup'][_0xfd2c('0x1f')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x27'),this['syncAttendedTransfer'][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x28'),this['syncBlindTransfer'][_0xfd2c('0x1f')](this));ami['on'](_0xfd2c('0x29'),this[_0xfd2c('0x2a')]['bind'](this));ami['on'](_0xfd2c('0x2b'),this[_0xfd2c('0x2c')][_0xfd2c('0x1f')](this));try{logger[_0xfd2c('0x2d')](_0xfd2c('0x2e'));ami[_0xfd2c('0x2f')]();}catch(_0x24d880){logger['error'](_0xfd2c('0x30'),util[_0xfd2c('0x31')](_0x24d880,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xfd2c('0x32')]['isNotNull']=function(_0x2d606b){return _0x2d606b!==null&&!_[_0xfd2c('0x33')](_0x2d606b);};VoiceCallReport[_0xfd2c('0x32')]['emit']=function(_0x16a410,_0x511b76,_0x19a3bd){io['to'](_0x16a410)[_0xfd2c('0x34')](_0x511b76,_0x19a3bd);};VoiceCallReport[_0xfd2c('0x32')]['syncNewCallerId']=function(_0x3f8ed0){try{if(this[_0xfd2c('0x35')](_0x3f8ed0)){logger['info'](_0xfd2c('0x36'),_0x3f8ed0['uniqueid'],_0x3f8ed0[_0xfd2c('0x37')],_0x3f8ed0[_0xfd2c('0x38')]);logger['debug'](_0xfd2c('0x39'),_0x3f8ed0['uniqueid'],util[_0xfd2c('0x31')](_0x3f8ed0,{'showHidden':![],'depth':null}));if(_0x3f8ed0[_0xfd2c('0x3a')]===_0x3f8ed0[_0xfd2c('0x3b')]){if(!_['isUndefined'](this[_0xfd2c('0x1b')][_0x3f8ed0['uniqueid']])){_[_0xfd2c('0x3c')](this[_0xfd2c('0x1b')][_0x3f8ed0[_0xfd2c('0x3a')]],_[_0xfd2c('0x3d')](_0x3f8ed0,_['keys'](this['channels'][_0x3f8ed0['uniqueid']])));}}}}catch(_0x55abd5){logger[_0xfd2c('0x3e')]('[%s][voiceCallReport][newcallerid]',_0x3f8ed0[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x55abd5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0x21')]=function(_0x49ca0a){try{if(this[_0xfd2c('0x35')](_0x49ca0a)){logger[_0xfd2c('0x3f')](_0xfd2c('0x40'),_0x49ca0a[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x49ca0a,{'showHidden':![],'depth':null}));if(_0x49ca0a[_0xfd2c('0x3a')]===_0x49ca0a['linkedid']&&_0x49ca0a[_0xfd2c('0x41')]!=_0xfd2c('0x42')){if(_[_0xfd2c('0x33')](this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]])){logger[_0xfd2c('0x2d')](_0xfd2c('0x43'),_0x49ca0a[_0xfd2c('0x3a')],_0x49ca0a[_0xfd2c('0x44')],_0x49ca0a[_0xfd2c('0x45')]);this[_0xfd2c('0x1b')][_0x49ca0a['uniqueid']]=new Channel();this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]][_0xfd2c('0x46')]=moment()[_0xfd2c('0x47')](_0xfd2c('0x48'));this[_0xfd2c('0x1b')][_0x49ca0a['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x49ca0a[_0xfd2c('0x49')])];_[_0xfd2c('0x3c')](this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]],_[_0xfd2c('0x3d')](_0x49ca0a,_['keys'](this[_0xfd2c('0x1b')][_0x49ca0a[_0xfd2c('0x3a')]])));if(_0x49ca0a[_0xfd2c('0x44')]===_0xfd2c('0x4a')){if(this[_0xfd2c('0x1c')][_0x49ca0a[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]){this['agents'][_0x49ca0a[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x4c')]=_0x49ca0a[_0xfd2c('0x45')];logger[_0xfd2c('0x3f')](_0xfd2c('0x4d'),_0x49ca0a[_0xfd2c('0x3a')],util[_0xfd2c('0x31')]({'destaccountcode':this[_0xfd2c('0x1c')][_0x49ca0a['channel'][_0xfd2c('0x4b')]('-')[0x0]][_0xfd2c('0x4e')],'destconnectedlinenum':_0x49ca0a[_0xfd2c('0x45')]},{'showHidden':![],'depth':null}));this[_0xfd2c('0x34')](util[_0xfd2c('0x47')](_0xfd2c('0x4f'),this[_0xfd2c('0x1c')][_0x49ca0a['channel']['split']('-')[0x0]][_0xfd2c('0x50')]),_0xfd2c('0x51'),{'destaccountcode':this[_0xfd2c('0x1c')][_0x49ca0a[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x4e')],'destconnectedlinenum':_0x49ca0a['exten']});}}}}}}catch(_0x4a34fa){logger[_0xfd2c('0x3e')](_0xfd2c('0x52'),_0x49ca0a[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x4a34fa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0x1e')]=function(_0x2539f4){try{if(this[_0xfd2c('0x35')](_0x2539f4)){logger[_0xfd2c('0x3f')](_0xfd2c('0x53'),_0x2539f4['uniqueid'],util['inspect'](_0x2539f4,{'showHidden':![],'depth':null}));if(_0x2539f4[_0xfd2c('0x3a')]===_0x2539f4[_0xfd2c('0x3b')]&&_0x2539f4['exten']!='h'&&_0x2539f4['channel']!=_0xfd2c('0x42')){_0x2539f4[_0xfd2c('0x54')]=_0x2539f4[_0xfd2c('0x54')][_0xfd2c('0x55')]();_0x2539f4[_0xfd2c('0x56')]=(_0x2539f4[_0xfd2c('0x57')]||_0x2539f4[_0xfd2c('0x56')])[_0xfd2c('0x55')]();logger[_0xfd2c('0x2d')](_0xfd2c('0x58'),_0x2539f4[_0xfd2c('0x3a')],_0x2539f4['application'],_0x2539f4[_0xfd2c('0x56')]);if(_['isUndefined'](this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]])){this['channels'][_0x2539f4[_0xfd2c('0x3a')]]=new Channel();this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x46')]=_0x2539f4['duration']?moment()[_0xfd2c('0x59')](moment[_0xfd2c('0x5a')](_0x2539f4[_0xfd2c('0x5a')])[_0xfd2c('0x5b')](),_0xfd2c('0x5b'))[_0xfd2c('0x47')](_0xfd2c('0x48')):moment()[_0xfd2c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x5c')]='NO\x20ANSWER';}_[_0xfd2c('0x3c')](this[_0xfd2c('0x1b')][_0x2539f4['uniqueid']],_[_0xfd2c('0x3d')](_0x2539f4,_[_0xfd2c('0x5d')](this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]])));if(_[_0xfd2c('0x5e')](applications,_0x2539f4[_0xfd2c('0x54')])){this[_0xfd2c('0x1b')][_0x2539f4[_0xfd2c('0x3a')]]['lastapplication']=_0x2539f4[_0xfd2c('0x54')];this['channels'][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x5f')]=_0x2539f4[_0xfd2c('0x56')];if(_0x2539f4[_0xfd2c('0x54')]===_0xfd2c('0x60')&&_[_0xfd2c('0x61')](_0x2539f4[_0xfd2c('0x56')],_0xfd2c('0x62'))){var _0x4091d0=_0x2539f4[_0xfd2c('0x56')][_0xfd2c('0x4b')]('=');var _0x598290=_0x4091d0[0x0][_0xfd2c('0x63')](/cdr\((.*)\)/);if(_0x598290){this[_0xfd2c('0x1b')][_0x2539f4['uniqueid']][_0x598290[0x1]]=_0x4091d0[0x1];}}else if(_0x2539f4[_0xfd2c('0x54')]==='queue'){this['channels'][_0x2539f4[_0xfd2c('0x3a')]][_0xfd2c('0x11')]=_0x2539f4['applicationdata'][_0xfd2c('0x4b')](',')[0x0];}}}}}catch(_0x3771e){logger[_0xfd2c('0x3e')](_0xfd2c('0x64'),_0x2539f4['uniqueid'],util[_0xfd2c('0x31')](_0x3771e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0x23')]=function(_0x3bfdbf){try{if(this['isNotNull'](_0x3bfdbf)){logger[_0xfd2c('0x2d')](_0xfd2c('0x65'),_0x3bfdbf['uniqueid'],_0x3bfdbf[_0xfd2c('0x3b')],_0x3bfdbf[_0xfd2c('0x37')],_0x3bfdbf['calleridnum']);logger[_0xfd2c('0x3f')](_0xfd2c('0x66'),_0x3bfdbf[_0xfd2c('0x3a')],util['inspect'](_0x3bfdbf,{'showHidden':![],'depth':null}));if(_0x3bfdbf[_0xfd2c('0x3a')]!==_0x3bfdbf[_0xfd2c('0x3b')]){if(this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]]){if(_0x3bfdbf[_0xfd2c('0x49')]==='6'){if(!this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]]['answered']){var _0x140b6b=moment();this['channels'][_0x3bfdbf['linkedid']][_0xfd2c('0x67')]=!![];this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]]['answertime']=_0x140b6b[_0xfd2c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x46')]){this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]]['holdtime']=_0x140b6b[_0xfd2c('0x68')](this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]]['starttime'],_0xfd2c('0x5b'));}}this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x3b')]=_0x3bfdbf[_0xfd2c('0x3a')];if(_0x3bfdbf[_0xfd2c('0x38')]!==_0xfd2c('0x69')){this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6a')]=_0x3bfdbf[_0xfd2c('0x38')];}this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6b')]=_0x3bfdbf[_0xfd2c('0x37')];this['channels'][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6c')]=_0x3bfdbf['channel'];this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]]['disposition']=dispositions[_[_0xfd2c('0x6d')](_0x3bfdbf[_0xfd2c('0x49')])];if(this['agents'][_0x3bfdbf[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]){this[_0xfd2c('0x1b')][_0x3bfdbf[_0xfd2c('0x3b')]][_0xfd2c('0x6e')]=this[_0xfd2c('0x1c')][_0x3bfdbf[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]['id'];this[_0xfd2c('0x1b')][_0x3bfdbf['linkedid']][_0xfd2c('0x6f')]=this[_0xfd2c('0x1c')][_0x3bfdbf['channel'][_0xfd2c('0x4b')]('-')[0x0]]['name'];}}}}else{if(this[_0xfd2c('0x1b')][_0x3bfdbf['uniqueid']]){if(_0x3bfdbf[_0xfd2c('0x49')]==='6'){if(this[_0xfd2c('0x1c')][_0x3bfdbf[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]){this[_0xfd2c('0x1b')][_0x3bfdbf['uniqueid']]['UserId']=this['agents'][_0x3bfdbf['channel'][_0xfd2c('0x4b')]('-')[0x0]]['id'];this['channels'][_0x3bfdbf[_0xfd2c('0x3a')]][_0xfd2c('0x6f')]=this[_0xfd2c('0x1c')][_0x3bfdbf[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x50')];}}}}}}catch(_0x20fbb2){logger[_0xfd2c('0x3e')](_0xfd2c('0x70'),_0x3bfdbf[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x20fbb2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfd2c('0x71')]=function(_0x219b88,_0x47e3e2){try{if(this['channels'][_0x219b88]){logger['info'](_0xfd2c('0x72'),_0x219b88,_0x47e3e2);this[_0xfd2c('0x1b')][_0x219b88]['monitor']=!![];if(_[_0xfd2c('0x73')](_0x47e3e2,_0xfd2c('0x74'))){_0x47e3e2=_0x47e3e2[_0xfd2c('0x75')]('.wav49',_0xfd2c('0x76'));}this[_0xfd2c('0x1b')][_0x219b88][_0xfd2c('0x77')]=_0x47e3e2;var _0x4d1b24=_['find'](this[_0xfd2c('0x1b')][_0x219b88][_0xfd2c('0x78')],{'filename':_0x47e3e2});if(_['isNil'](_0x4d1b24)){this[_0xfd2c('0x1b')][_0x219b88][_0xfd2c('0x78')][_0xfd2c('0x79')]({'filename':_0x47e3e2,'createdAt':moment()['format'](_0xfd2c('0x48')),'mixmonitorid':'','status':'rec'});}}}catch(_0x12c9a1){logger['error'](_0xfd2c('0x7a'),_0x219b88,util[_0xfd2c('0x31')](_0x12c9a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')]['syncVarSet']=function(_0x36c4cd){try{if(this['isNotNull'](_0x36c4cd)){logger[_0xfd2c('0x3f')](_0xfd2c('0x7b'),_0x36c4cd[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x36c4cd,{'showHidden':![],'depth':null}));if(this['channels'][_0x36c4cd[_0xfd2c('0x3a')]]&&_0x36c4cd[_0xfd2c('0x41')]!='OutgoingSpoolFailed'){if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')])){if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x7d')])){logger[_0xfd2c('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x71')](_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x7f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd['value']);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x38')]=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x80')])){logger['info'](_0xfd2c('0x81'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd['value']);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x82')]=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x83')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x84'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this['channels'][_0x36c4cd[_0xfd2c('0x3a')]]['type']=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x85')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x86'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')][_0xfd2c('0x4b')](',')[0x0]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x11')]=_0x36c4cd['value'][_0xfd2c('0x4b')](',')[0x0];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x87')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x88'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x89')]=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd['variable'][_0xfd2c('0x8a')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x8b'),_0x36c4cd['uniqueid'],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]]['destination']=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd['variable'][_0xfd2c('0x8c')])){logger[_0xfd2c('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]]['calleridpreview']=_0x36c4cd[_0xfd2c('0x7e')];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x8d')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x8e'),_0x36c4cd[_0xfd2c('0x3a')],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]][_0xfd2c('0x11')]=_0x36c4cd['value'];}else if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')][_0xfd2c('0x8f')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x90'),_0x36c4cd['uniqueid'],_0x36c4cd['value']);this[_0xfd2c('0x1b')][_0x36c4cd[_0xfd2c('0x3a')]]['sipcalluniqueid']=_0x36c4cd[_0xfd2c('0x7e')];}}}else if(this['isNotNull'](_0x36c4cd[_0xfd2c('0x7c')]['mixmonitor_filename'])){if(_0x36c4cd[_0xfd2c('0x7e')]){var _0xfb6285=path[_0xfd2c('0x91')](_0x36c4cd[_0xfd2c('0x7e')])['name'];logger[_0xfd2c('0x2d')](_0xfd2c('0x92'),_0xfb6285,_0x36c4cd[_0xfd2c('0x7e')]);this['syncMixMonitorFilename'](_0xfb6285,_0x36c4cd['value']);}}else if(this[_0xfd2c('0x1b')][_0x36c4cd['linkedid']]){if(this[_0xfd2c('0x35')](_0x36c4cd[_0xfd2c('0x7c')])){if(this['isNotNull'](_0x36c4cd['variable'][_0xfd2c('0x8f')])){logger[_0xfd2c('0x2d')](_0xfd2c('0x90'),_0x36c4cd['linkedid'],_0x36c4cd[_0xfd2c('0x7e')]);this[_0xfd2c('0x1b')][_0x36c4cd['linkedid']]['sipcalllinkedid']=_0x36c4cd[_0xfd2c('0x7e')];}}}}}catch(_0x341257){logger[_0xfd2c('0x3e')](_0xfd2c('0x93'),_0x36c4cd[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x341257,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x1cf540){try{if(this['isNotNull'](_0x1cf540)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x1cf540[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x1cf540,{'showHidden':![],'depth':null}));if(this['channels'][_0x1cf540['uniqueid']]){logger[_0xfd2c('0x2d')](_0xfd2c('0x94'),_0x1cf540[_0xfd2c('0x3a')],_0x1cf540[_0xfd2c('0x95')]);var _0x1c4004=moment();this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x96')]=_0x1c4004['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x5a')]=_0x1c4004[_0xfd2c('0x68')](this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']]['starttime'],_0xfd2c('0x5b'));if(this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x67')]){this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x97')]=_0x1c4004['diff'](this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x98')],_0xfd2c('0x5b'));this['channels'][_0x1cf540[_0xfd2c('0x3a')]]['holdtime']=this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x5a')]-this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x97')];}if(_0x1cf540['context']===_0xfd2c('0x4a')){if(this[_0xfd2c('0x1c')][_0x1cf540['channel'][_0xfd2c('0x4b')]('-')[0x0]]){this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]]=_[_0xfd2c('0x99')](this['agents'][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]],[_0xfd2c('0x4c')]);logger[_0xfd2c('0x3f')](_0xfd2c('0x9a'),_0x1cf540[_0xfd2c('0x3a')],util[_0xfd2c('0x31')]({'destaccountcode':this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]][_0xfd2c('0x4e')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')]['split']('-')[0x0]][_0xfd2c('0x50')]),_0xfd2c('0x9b'),{'destaccountcode':this[_0xfd2c('0x1c')][_0x1cf540[_0xfd2c('0x41')][_0xfd2c('0x4b')]('-')[0x0]][_0xfd2c('0x4e')]});}}if(_0x1cf540[_0xfd2c('0x9c')]===_0xfd2c('0x9d')){this[_0xfd2c('0x9e')][_0x1cf540[_0xfd2c('0x3a')]]=this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]];}else{if(this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x9f')]==='outbound'&&this[_0xfd2c('0x9e')][_0x1cf540[_0xfd2c('0x3a')]]){this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]][_0xfd2c('0x3a')]=[this['channels'][_0x1cf540[_0xfd2c('0x3a')]]['linkedid'],this['channels'][_0x1cf540[_0xfd2c('0x3a')]]['linkedid']=this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']][_0xfd2c('0x3a')]][0x0];delete this[_0xfd2c('0x9e')][_0x1cf540[_0xfd2c('0x3a')]];}}logger[_0xfd2c('0x3f')](_0xfd2c('0xa0'),_0x1cf540[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](this[_0xfd2c('0x1b')][_0x1cf540['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xfd2c('0x34')](_0xfd2c('0xa1'),this[_0xfd2c('0x1b')][_0x1cf540[_0xfd2c('0x3a')]]);delete this['channels'][_0x1cf540[_0xfd2c('0x3a')]];}}}catch(_0x8e666b){logger[_0xfd2c('0x3e')](_0xfd2c('0xa2'),_0x1cf540['uniqueid'],util['inspect'](_0x8e666b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')][_0xfd2c('0xa3')]=function(_0x40e3b6){try{if(this[_0xfd2c('0x35')](_0x40e3b6)){logger[_0xfd2c('0x2d')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x40e3b6[_0xfd2c('0x3a')],_0x40e3b6[_0xfd2c('0xa4')],_0x40e3b6[_0xfd2c('0xa5')]);logger[_0xfd2c('0x3f')](_0xfd2c('0xa6'),_0x40e3b6[_0xfd2c('0x3a')],util['inspect'](_0x40e3b6,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa7')]]){this['channels'][_0x40e3b6[_0xfd2c('0xa7')]][_0xfd2c('0xa8')]=_0x40e3b6['origtransferercalleridnum'];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa7')]]['transferconnectedlinenum']=_0x40e3b6[_0xfd2c('0xa5')];if(this['channels'][_0x40e3b6[_0xfd2c('0xa9')]]){var _0x4595f0=this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa9')]];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa9')]]=this[_0xfd2c('0x1b')][_0x40e3b6['transfereeuniqueid']];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xa7')]]=_0x4595f0;}}else if(this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]]){this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]]['transfercalleridnum']=_0x40e3b6[_0xfd2c('0xa4')];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]]['transferconnectedlinenum']=_0x40e3b6[_0xfd2c('0xa5')];if(this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xab')]]){var _0x4595f0=this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xab')]];this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xab')]]=this[_0xfd2c('0x1b')][_0x40e3b6[_0xfd2c('0xaa')]];this[_0xfd2c('0x1b')][_0x40e3b6['transfertargetuniqueid']]=_0x4595f0;}}}}catch(_0x52a775){logger['error'](_0xfd2c('0xac'),_0x40e3b6['uniqueid'],util[_0xfd2c('0x31')](_0x52a775,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')]['syncBlindTransfer']=function(_0x3247e3){try{if(this[_0xfd2c('0x35')](_0x3247e3)){logger['info'](_0xfd2c('0xad'),_0x3247e3['uniqueid'],_0x3247e3[_0xfd2c('0xae')],_0x3247e3[_0xfd2c('0xaf')]);logger['debug'](_0xfd2c('0xb0'),_0x3247e3[_0xfd2c('0x3a')],util['inspect'](_0x3247e3,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x3247e3[_0xfd2c('0xa7')]]){this[_0xfd2c('0x1b')][_0x3247e3[_0xfd2c('0xa7')]][_0xfd2c('0xa8')]=_0x3247e3[_0xfd2c('0xae')];this[_0xfd2c('0x1b')][_0x3247e3[_0xfd2c('0xa7')]][_0xfd2c('0xb1')]=_0x3247e3[_0xfd2c('0xaf')];this[_0xfd2c('0xb2')]({'event':_0xfd2c('0x9d'),'uniqueid':_0x3247e3[_0xfd2c('0xa7')],'context':_0x3247e3['context'],'channel':_0x3247e3[_0xfd2c('0xb3')]});}}}catch(_0x2e8801){logger['error']('[%s][voiceCallReport][blindtransfer]',_0x3247e3['uniqueid'],util['inspect'](_0x2e8801,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfd2c('0x32')]['syncMusicOnHoldStart']=function(_0x5b3fa3){try{if(this[_0xfd2c('0x35')](_0x5b3fa3)){logger[_0xfd2c('0x3f')](_0xfd2c('0xb4'),_0x5b3fa3[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0x5b3fa3,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]]){if(!_['isNil'](this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]][_0xfd2c('0x98')])){this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]][_0xfd2c('0xb5')]=moment()[_0xfd2c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfd2c('0x2d')](_0xfd2c('0xb6'),_0x5b3fa3[_0xfd2c('0x3a')],this[_0xfd2c('0x1b')][_0x5b3fa3[_0xfd2c('0x3a')]]['mohstarttime']);}}}}catch(_0xd1aa75){logger[_0xfd2c('0x3e')](_0xfd2c('0xb7'),_0x5b3fa3[_0xfd2c('0x3a')],util[_0xfd2c('0x31')](_0xd1aa75,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfd2c('0x2c')]=function(_0x3ce1ea){try{if(this[_0xfd2c('0x35')](_0x3ce1ea)){logger[_0xfd2c('0x3f')](_0xfd2c('0xb8'),_0x3ce1ea['uniqueid'],util[_0xfd2c('0x31')](_0x3ce1ea,{'showHidden':![],'depth':null}));if(this[_0xfd2c('0x1b')][_0x3ce1ea[_0xfd2c('0x3a')]]){if(!_['isNil'](this[_0xfd2c('0x1b')][_0x3ce1ea['uniqueid']][_0xfd2c('0xb5')])){this[_0xfd2c('0x1b')][_0x3ce1ea[_0xfd2c('0x3a')]][_0xfd2c('0xb9')]+=moment()[_0xfd2c('0xba')](0x0)['diff'](this['channels'][_0x3ce1ea[_0xfd2c('0x3a')]]['mohstarttime'],_0xfd2c('0x5b'));logger[_0xfd2c('0x2d')](_0xfd2c('0xbb'),_0x3ce1ea[_0xfd2c('0x3a')],this[_0xfd2c('0x1b')][_0x3ce1ea[_0xfd2c('0x3a')]]['mohtime']);delete this['channels'][_0x3ce1ea[_0xfd2c('0x3a')]][_0xfd2c('0xb5')];}}}}catch(_0x47b2ae){logger[_0xfd2c('0x3e')](_0xfd2c('0xbc'),_0x3ce1ea['uniqueid'],util[_0xfd2c('0x31')](_0x47b2ae,{'showHidden':![],'depth':null}));}};module[_0xfd2c('0xbd')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 7c22dd1..2e6cd5a 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 _0x4294=['varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','substring','lastIndexOf','channel','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','starttime','complete','answered','holdtime','diff','seconds','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend'];(function(_0x528049,_0x309a12){var _0x106c8f=function(_0x27567c){while(--_0x27567c){_0x528049['push'](_0x528049['shift']());}};_0x106c8f(++_0x309a12);}(_0x4294,0x135));var _0x4429=function(_0x4dda4d,_0xb94ff7){_0x4dda4d=_0x4dda4d-0x0;var _0x5c16be=_0x4294[_0x4dda4d];return _0x5c16be;};'use strict';var _=require(_0x4429('0x0'));var moment=require(_0x4429('0x1'));var util=require(_0x4429('0x2'));var Redis=require('ioredis');var config=require(_0x4429('0x3'));var logger=require(_0x4429('0x4'))(_0x4429('0x5'));var ami=require(_0x4429('0x6'));config[_0x4429('0x7')]=_[_0x4429('0x8')](config['redis'],{'host':_0x4429('0x9'),'port':0x18eb});var io=require(_0x4429('0xa'))(new Redis(config[_0x4429('0x7')]));function VoiceDialReport(_0x55015e){this[_0x4429('0xb')]=_0x55015e[_0x4429('0xc')];this[_0x4429('0xd')]=_0x55015e[_0x4429('0xd')];this['variables']={};ami['on'](_0x4429('0xe'),this[_0x4429('0xf')][_0x4429('0x10')](this));ami['on'](_0x4429('0x11'),this['syncDialEnd'][_0x4429('0x10')](this));ami['on'](_0x4429('0x12'),this[_0x4429('0x13')][_0x4429('0x10')](this));ami['on'](_0x4429('0x14'),this[_0x4429('0x15')][_0x4429('0x10')](this));}VoiceDialReport[_0x4429('0x16')][_0x4429('0x17')]=function(_0x315351){return _0x315351!==null&&!_[_0x4429('0x18')](_0x315351);};VoiceDialReport['prototype'][_0x4429('0x19')]=function(_0x204fac,_0x135077,_0x3eef02){io['to'](_0x204fac)[_0x4429('0x19')](_0x135077,_0x3eef02);};VoiceDialReport[_0x4429('0x16')][_0x4429('0xf')]=function(_0x34c197){try{if(this[_0x4429('0x17')](_0x34c197)){logger[_0x4429('0x1a')](_0x4429('0x1b'),_0x34c197[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x34c197,{'showHidden':![],'depth':null}));if(this[_0x4429('0xb')][_0x34c197['uniqueid']]){_['merge'](this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]],{'starttime':moment()[_0x4429('0x1e')](_0x4429('0x1f')),'lastevent':'called','interface':_0x34c197['channel'][_0x4429('0x20')](0x0,_0x34c197['channel'][_0x4429('0x21')]('-')),'membername':_0x34c197[_0x4429('0x22')][_0x4429('0x20')](_0x34c197[_0x4429('0x22')]['lastIndexOf']('/')+0x1,_0x34c197[_0x4429('0x22')][_0x4429('0x21')]('-'))},_[_0x4429('0x23')](_0x34c197,[_0x4429('0x24'),_0x4429('0x25')]));logger[_0x4429('0x26')](_0x4429('0x27'),_0x34c197[_0x4429('0x1c')],this['channels'][_0x34c197[_0x4429('0x1c')]][_0x4429('0x28')],this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]]['interface']);logger[_0x4429('0x1a')](_0x4429('0x29'),_0x34c197['uniqueid'],util[_0x4429('0x1d')](this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),_0x4429('0x2b'),this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x34c197['uniqueid'],util[_0x4429('0x1d')](this['channels'][_0x34c197[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')](_0x4429('0x2c'),this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]]);}}}catch(_0x6b0320){logger[_0x4429('0x2d')](_0x4429('0x2e'),_0x34c197[_0x4429('0x1c')],util['inspect'](_0x6b0320,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4429('0x16')][_0x4429('0x2f')]=function(_0x25f086){try{if(this['isNotNull'](_0x25f086)){logger[_0x4429('0x1a')](_0x4429('0x30'),_0x25f086['uniqueid'],util['inspect'](_0x25f086,{'showHidden':![],'depth':null}));if(this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]]){this[_0x4429('0xb')][_0x25f086['uniqueid']][_0x4429('0x31')]=_0x25f086[_0x4429('0x31')];if(_0x25f086[_0x4429('0x31')]==='ANSWER'){this[_0x4429('0xb')][_0x25f086['uniqueid']][_0x4429('0x32')]=_0x25f086[_0x4429('0x32')];this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]]['connectedlinename']=_0x25f086[_0x4429('0x33')];this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]][_0x4429('0x34')]=moment()[_0x4429('0x1e')](_0x4429('0x1f'));this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]][_0x4429('0x35')]=_0x4429('0x36');logger[_0x4429('0x26')](_0x4429('0x37'),_0x25f086[_0x4429('0x1c')],_0x25f086['channel'][_0x4429('0x20')](_0x25f086[_0x4429('0x22')][_0x4429('0x21')]('/')+0x1,_0x25f086['channel']['lastIndexOf']('-')));logger[_0x4429('0x1a')](_0x4429('0x38'),_0x25f086[_0x4429('0x1c')],util['inspect'](this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')](_0x4429('0x39'),this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]]);}logger[_0x4429('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x25f086[_0x4429('0x1c')],util[_0x4429('0x1d')](this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),'voice_outbound_channel:save',this[_0x4429('0xb')][_0x25f086['uniqueid']]);}}}catch(_0x234af6){logger[_0x4429('0x2d')]('[%s][voiceDialReport][dialend]',_0x25f086['uniqueid'],util[_0x4429('0x1d')](_0x234af6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4429('0x16')][_0x4429('0x13')]=function(_0x1e8bc9){try{if(this[_0x4429('0x17')](_0x1e8bc9)){logger[_0x4429('0x1a')](_0x4429('0x3a'),_0x1e8bc9[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x1e8bc9,{'showHidden':![],'depth':null}));this['addVariable'](_0x1e8bc9[_0x4429('0x1c')],_[_0x4429('0x3b')](_0x1e8bc9[_0x4429('0x3c')])[0x0],_0x1e8bc9[_0x4429('0x3d')]);if(this['isNotNull'](_0x1e8bc9[_0x4429('0x3c')])&&this[_0x4429('0x17')](_0x1e8bc9['variable']['outboundrouteid'])){if(_[_0x4429('0x18')](this['channels'][_0x1e8bc9[_0x4429('0x1c')]])){this['channels'][_0x1e8bc9[_0x4429('0x1c')]]={'routeId':_0x1e8bc9['value'],'variables':this[_0x4429('0x3e')][_0x1e8bc9[_0x4429('0x1c')]]};logger['info'](_0x4429('0x3f'),_0x1e8bc9[_0x4429('0x1c')],_0x1e8bc9[_0x4429('0x3c')][_0x4429('0x40')],_[_0x4429('0x3b')](_0x1e8bc9[_0x4429('0x3c')])[0x0],_0x1e8bc9[_0x4429('0x3d')]);logger[_0x4429('0x1a')](_0x4429('0x41'),_0x1e8bc9[_0x4429('0x1c')],util[_0x4429('0x1d')](this['channels'][_0x1e8bc9['uniqueid']],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),'voice_outbound_channel:save',this[_0x4429('0xb')][_0x1e8bc9[_0x4429('0x1c')]]);}}}}catch(_0x25d2b7){logger[_0x4429('0x2d')](_0x4429('0x42'),_0x1e8bc9[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x25d2b7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4429('0x16')]['addVariable']=function(_0x3d5358,_0x256b92,_0x2bf063){var _0x1f8351=[_0x4429('0x43'),_0x4429('0x44'),_0x4429('0x45'),_0x4429('0x46'),_0x4429('0x47'),_0x4429('0x48'),_0x4429('0x49'),_0x4429('0x4a'),_0x4429('0x4b'),_0x4429('0x4c'),_0x4429('0x4d'),_0x4429('0x4e'),_0x4429('0x4f'),_0x4429('0x50'),'memberinterface','memberlastcall','membername',_0x4429('0x51'),_0x4429('0x52')];if(!_[_0x4429('0x53')](_0x256b92)&&!_[_0x4429('0x54')](_0x1f8351,_0x256b92)){if(_[_0x4429('0x18')](this['variables'][_0x3d5358])){this[_0x4429('0x3e')][_0x3d5358]={};}this['variables'][_0x3d5358][_0x256b92]=_0x2bf063;}};VoiceDialReport['prototype'][_0x4429('0x15')]=function(_0x10abcd){try{if(this[_0x4429('0x17')](_0x10abcd)){logger[_0x4429('0x1a')](_0x4429('0x55'),_0x10abcd[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x10abcd,{'showHidden':![],'depth':null}));if(this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]){logger[_0x4429('0x26')](_0x4429('0x56'),_0x10abcd['uniqueid'],_0x10abcd[_0x4429('0x57')]);this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]['endtime']=moment()['format'](_0x4429('0x1f'));this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x58')]=moment(this[_0x4429('0xb')][_0x10abcd['uniqueid']][_0x4429('0x59')])['diff'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5a')],'seconds');this['channels'][_0x10abcd[_0x4429('0x1c')]]['lastevent']=_0x4429('0x5b');this[_0x4429('0xd')]['total']+=0x1;if(this['channels'][_0x10abcd['uniqueid']][_0x4429('0x34')]){this[_0x4429('0xd')][_0x4429('0x5c')]+=0x1;this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5d')]=moment(this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]['answertime'])[_0x4429('0x5e')](this['channels'][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5a')],_0x4429('0x5f'));this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x60')]=moment(this[_0x4429('0xb')][_0x10abcd['uniqueid']]['endtime'])[_0x4429('0x5e')](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x34')],_0x4429('0x5f'));this[_0x4429('0xd')]['sumHoldTime']+=this['channels'][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5d')]||0x0;this[_0x4429('0xd')]['sumBillable']+=this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x60')];}this[_0x4429('0xd')][_0x4429('0x61')]+=this[_0x4429('0xb')][_0x10abcd['uniqueid']][_0x4429('0x58')];logger[_0x4429('0x1a')](_0x4429('0x62'),_0x10abcd[_0x4429('0x1c')],util['inspect'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')]('custom:voiceDialReport',this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]);logger[_0x4429('0x1a')](_0x4429('0x63'),_0x10abcd[_0x4429('0x1c')],util['inspect'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')](_0x4429('0x64'),this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]);logger[_0x4429('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x10abcd['uniqueid'],util['inspect'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),_0x4429('0x65'),this[_0x4429('0xd')]);logger[_0x4429('0x26')](_0x4429('0x66'),JSON[_0x4429('0x67')](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]));logger[_0x4429('0x1a')](_0x4429('0x68'),_0x10abcd[_0x4429('0x1c')],util[_0x4429('0x1d')](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x4429('0x2a'),_0x4429('0x69'),this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]);delete this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]];}else if(this[_0x4429('0xb')][_0x10abcd[_0x4429('0x6a')]]){this[_0x4429('0xb')][_0x10abcd[_0x4429('0x6a')]][_0x4429('0x1c')]=this[_0x4429('0xb')][_0x10abcd[_0x4429('0x6a')]]['destuniqueid'];}if(this[_0x4429('0x3e')][_0x10abcd['uniqueid']]){delete this['variables'][_0x10abcd[_0x4429('0x1c')]];}}}catch(_0x410508){logger['error'](_0x4429('0x6b'),_0x10abcd[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x410508,{'showHidden':![],'depth':null}));}};module[_0x4429('0x6c')]=VoiceDialReport; \ No newline at end of file +var _0x354e=['destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','duration','endtime','diff','starttime','complete','total','answered','seconds','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','stringify','linkedid'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0x354e,0x14a));var _0xe354=function(_0x255709,_0x390c9a){_0x255709=_0x255709-0x0;var _0x28ba83=_0x354e[_0x255709];return _0x28ba83;};'use strict';var _=require(_0xe354('0x0'));var moment=require(_0xe354('0x1'));var util=require(_0xe354('0x2'));var Redis=require(_0xe354('0x3'));var config=require(_0xe354('0x4'));var logger=require(_0xe354('0x5'))(_0xe354('0x6'));var ami=require(_0xe354('0x7'));config[_0xe354('0x8')]=_['defaults'](config[_0xe354('0x8')],{'host':_0xe354('0x9'),'port':0x18eb});var io=require(_0xe354('0xa'))(new Redis(config[_0xe354('0x8')]));function VoiceDialReport(_0x32046b){this['channels']=_0x32046b[_0xe354('0xb')];this[_0xe354('0xc')]=_0x32046b[_0xe354('0xc')];this[_0xe354('0xd')]={};ami['on'](_0xe354('0xe'),this[_0xe354('0xf')][_0xe354('0x10')](this));ami['on'](_0xe354('0x11'),this[_0xe354('0x12')]['bind'](this));ami['on'](_0xe354('0x13'),this[_0xe354('0x14')][_0xe354('0x10')](this));ami['on']('hangup',this['syncHangup'][_0xe354('0x10')](this));}VoiceDialReport[_0xe354('0x15')][_0xe354('0x16')]=function(_0x2bfb54){return _0x2bfb54!==null&&!_[_0xe354('0x17')](_0x2bfb54);};VoiceDialReport[_0xe354('0x15')][_0xe354('0x18')]=function(_0x4a5bac,_0x1f320a,_0x536269){io['to'](_0x4a5bac)[_0xe354('0x18')](_0x1f320a,_0x536269);};VoiceDialReport['prototype'][_0xe354('0xf')]=function(_0x2c944c){try{if(this['isNotNull'](_0x2c944c)){logger['debug'](_0xe354('0x19'),_0x2c944c['uniqueid'],util[_0xe354('0x1a')](_0x2c944c,{'showHidden':![],'depth':null}));if(this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]]){_[_0xe354('0x1d')](this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]],{'starttime':moment()[_0xe354('0x1e')](_0xe354('0x1f')),'lastevent':'called','interface':_0x2c944c[_0xe354('0x20')][_0xe354('0x21')](0x0,_0x2c944c['channel'][_0xe354('0x22')]('-')),'membername':_0x2c944c[_0xe354('0x20')]['substring'](_0x2c944c['channel']['lastIndexOf']('/')+0x1,_0x2c944c[_0xe354('0x20')][_0xe354('0x22')]('-'))},_[_0xe354('0x23')](_0x2c944c,[_0xe354('0x24'),_0xe354('0x25')]));logger[_0xe354('0x26')](_0xe354('0x27'),_0x2c944c[_0xe354('0x1c')],this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]][_0xe354('0x28')],this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]][_0xe354('0x29')]);logger['debug'](_0xe354('0x2a'),_0x2c944c[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x2c944c[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0xe354('0x2b'),'voice_outbound_channel:save',this['channels'][_0x2c944c['uniqueid']]);logger[_0xe354('0x2c')](_0xe354('0x2d'),_0x2c944c[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x2c944c[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe354('0x2e'),this[_0xe354('0x1b')][_0x2c944c[_0xe354('0x1c')]]);}}}catch(_0x1e13fa){logger[_0xe354('0x2f')](_0xe354('0x30'),_0x2c944c['uniqueid'],util['inspect'](_0x1e13fa,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xe354('0x12')]=function(_0x4910a0){try{if(this[_0xe354('0x16')](_0x4910a0)){logger[_0xe354('0x2c')](_0xe354('0x31'),_0x4910a0['uniqueid'],util[_0xe354('0x1a')](_0x4910a0,{'showHidden':![],'depth':null}));if(this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]]){this['channels'][_0x4910a0['uniqueid']][_0xe354('0x32')]=_0x4910a0[_0xe354('0x32')];if(_0x4910a0['dialstatus']===_0xe354('0x33')){this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]][_0xe354('0x34')]=_0x4910a0[_0xe354('0x34')];this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]][_0xe354('0x35')]=_0x4910a0[_0xe354('0x35')];this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]][_0xe354('0x36')]=moment()[_0xe354('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe354('0x1b')][_0x4910a0['uniqueid']][_0xe354('0x37')]=_0xe354('0x38');logger[_0xe354('0x26')](_0xe354('0x39'),_0x4910a0[_0xe354('0x1c')],_0x4910a0[_0xe354('0x20')][_0xe354('0x21')](_0x4910a0['channel']['lastIndexOf']('/')+0x1,_0x4910a0[_0xe354('0x20')][_0xe354('0x22')]('-')));logger[_0xe354('0x2c')](_0xe354('0x3a'),_0x4910a0[_0xe354('0x1c')],util['inspect'](this[_0xe354('0x1b')][_0x4910a0['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]]);}logger[_0xe354('0x2c')](_0xe354('0x3b'),_0x4910a0[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x4910a0['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xe354('0x2b'),_0xe354('0x3c'),this[_0xe354('0x1b')][_0x4910a0[_0xe354('0x1c')]]);}}}catch(_0x439213){logger['error'](_0xe354('0x3d'),_0x4910a0[_0xe354('0x1c')],util[_0xe354('0x1a')](_0x439213,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe354('0x15')][_0xe354('0x14')]=function(_0x4fc5b8){try{if(this[_0xe354('0x16')](_0x4fc5b8)){logger['debug']('[%s][voiceDialReport][varset]\x20event:',_0x4fc5b8[_0xe354('0x1c')],util['inspect'](_0x4fc5b8,{'showHidden':![],'depth':null}));this[_0xe354('0x3e')](_0x4fc5b8[_0xe354('0x1c')],_[_0xe354('0x3f')](_0x4fc5b8[_0xe354('0x40')])[0x0],_0x4fc5b8[_0xe354('0x41')]);if(this[_0xe354('0x16')](_0x4fc5b8[_0xe354('0x40')])&&this['isNotNull'](_0x4fc5b8[_0xe354('0x40')][_0xe354('0x42')])){if(_[_0xe354('0x17')](this[_0xe354('0x1b')][_0x4fc5b8['uniqueid']])){this[_0xe354('0x1b')][_0x4fc5b8[_0xe354('0x1c')]]={'routeId':_0x4fc5b8['value'],'variables':this[_0xe354('0xd')][_0x4fc5b8['uniqueid']]};logger[_0xe354('0x26')](_0xe354('0x43'),_0x4fc5b8[_0xe354('0x1c')],_0x4fc5b8[_0xe354('0x40')][_0xe354('0x42')],_[_0xe354('0x3f')](_0x4fc5b8[_0xe354('0x40')])[0x0],_0x4fc5b8[_0xe354('0x41')]);logger[_0xe354('0x2c')](_0xe354('0x44'),_0x4fc5b8['uniqueid'],util[_0xe354('0x1a')](this[_0xe354('0x1b')][_0x4fc5b8['uniqueid']],{'showHidden':![],'depth':null}));this[_0xe354('0x18')](_0xe354('0x2b'),_0xe354('0x3c'),this['channels'][_0x4fc5b8[_0xe354('0x1c')]]);}}}}catch(_0x297b41){logger['error'](_0xe354('0x45'),_0x4fc5b8[_0xe354('0x1c')],util[_0xe354('0x1a')](_0x297b41,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe354('0x15')][_0xe354('0x3e')]=function(_0x3db04c,_0x11dc03,_0x4d3d55){var _0x1a8b05=[_0xe354('0x46'),_0xe354('0x47'),'rtpaudioqosjitter',_0xe354('0x48'),_0xe354('0x49'),_0xe354('0x4a'),_0xe354('0x4b'),'rtpaudioqosrttbridged',_0xe354('0x4c'),'sipuri','bridgepeer','bridgepvtcallid',_0xe354('0x4d'),_0xe354('0x4e'),_0xe354('0x4f'),_0xe354('0x50'),_0xe354('0x28'),_0xe354('0x51'),_0xe354('0x52')];if(!_[_0xe354('0x53')](_0x11dc03)&&!_[_0xe354('0x54')](_0x1a8b05,_0x11dc03)){if(_[_0xe354('0x17')](this[_0xe354('0xd')][_0x3db04c])){this[_0xe354('0xd')][_0x3db04c]={};}this['variables'][_0x3db04c][_0x11dc03]=_0x4d3d55;}};VoiceDialReport['prototype'][_0xe354('0x55')]=function(_0x4ff538){try{if(this[_0xe354('0x16')](_0x4ff538)){logger[_0xe354('0x2c')](_0xe354('0x56'),_0x4ff538['uniqueid'],util[_0xe354('0x1a')](_0x4ff538,{'showHidden':![],'depth':null}));if(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]){logger[_0xe354('0x26')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4ff538[_0xe354('0x1c')],_0x4ff538['cause-txt']);this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]['endtime']=moment()['format'](_0xe354('0x1f'));this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x57')]=moment(this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x58')])[_0xe354('0x59')](this[_0xe354('0x1b')][_0x4ff538['uniqueid']][_0xe354('0x5a')],'seconds');this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]['lastevent']=_0xe354('0x5b');this['outbound'][_0xe354('0x5c')]+=0x1;if(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x36')]){this['outbound'][_0xe354('0x5d')]+=0x1;this['channels'][_0x4ff538[_0xe354('0x1c')]]['holdtime']=moment(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x36')])[_0xe354('0x59')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x5a')],_0xe354('0x5e'));this[_0xe354('0x1b')][_0x4ff538['uniqueid']][_0xe354('0x5f')]=moment(this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x58')])[_0xe354('0x59')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x36')],_0xe354('0x5e'));this[_0xe354('0xc')][_0xe354('0x60')]+=this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x61')]||0x0;this[_0xe354('0xc')][_0xe354('0x62')]+=this['channels'][_0x4ff538[_0xe354('0x1c')]][_0xe354('0x5f')];}this['outbound'][_0xe354('0x63')]+=this[_0xe354('0x1b')][_0x4ff538['uniqueid']][_0xe354('0x57')];logger[_0xe354('0x2c')](_0xe354('0x64'),_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xe354('0x18')]('custom:voiceDialReport',this[_0xe354('0x1b')][_0x4ff538['uniqueid']]);logger[_0xe354('0x2c')](_0xe354('0x65'),_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xe354('0x18')](_0xe354('0x66'),this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]);logger[_0xe354('0x2c')](_0xe354('0x67'),_0x4ff538['uniqueid'],util['inspect'](this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));this[_0xe354('0x18')](_0xe354('0x2b'),'voice_outbound:save',this[_0xe354('0xc')]);logger[_0xe354('0x26')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xe354('0x68')](this[_0xe354('0x1b')][_0x4ff538['uniqueid']]));logger[_0xe354('0x2c')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](this['channels'][_0x4ff538[_0xe354('0x1c')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:remove',this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]]);delete this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x1c')]];}else if(this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x69')]]){this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x69')]][_0xe354('0x1c')]=this[_0xe354('0x1b')][_0x4ff538[_0xe354('0x69')]][_0xe354('0x6a')];}if(this['variables'][_0x4ff538[_0xe354('0x1c')]]){delete this[_0xe354('0xd')][_0x4ff538['uniqueid']];}}}catch(_0xf45239){logger['error'](_0xe354('0x6b'),_0x4ff538[_0xe354('0x1c')],util[_0xe354('0x1a')](_0xf45239,{'showHidden':![],'depth':null}));}};module[_0xe354('0x6c')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 09b6080..e6247f5 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 _0x02ce=['syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','prototype','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','variables','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice_queue_channel:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','name','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','Trunk','active','callerid','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','loggedIn','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','count','info','pick','keys','push','emitVoiceQueueChannelSave','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','milliseconds','diff','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','queuesummarycomplete','bind','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x02ce,0x1ac));var _0xe02c=function(_0x45b523,_0x36346c){_0x45b523=_0x45b523-0x0;var _0x5d26eb=_0x02ce[_0x45b523];return _0x5d26eb;};'use strict';var _=require(_0xe02c('0x0'));var moment=require(_0xe02c('0x1'));var util=require(_0xe02c('0x2'));var md5=require('md5');var Redis=require(_0xe02c('0x3'));var config=require('../../../config/environment');var logger=require(_0xe02c('0x4'))(_0xe02c('0x5'));var ami=require(_0xe02c('0x6'));var QueueReport=require(_0xe02c('0x7'));config[_0xe02c('0x8')]=_[_0xe02c('0x9')](config[_0xe02c('0x8')],{'host':_0xe02c('0xa'),'port':0x18eb});var io=require(_0xe02c('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xe02c('0xc')]=function(_0x2d85d7){this[_0xe02c('0xd')]=this[_0xe02c('0xd')]?this[_0xe02c('0xd')][_0xe02c('0xe')](_0x2d85d7):_0x2d85d7();};function VoiceQueueReport(_0x17fb93){this[_0xe02c('0xf')]=new Sequence();this[_0xe02c('0x10')]={};this[_0xe02c('0x11')]=_0x17fb93[_0xe02c('0x11')];this[_0xe02c('0x12')]=_0x17fb93[_0xe02c('0x13')];this[_0xe02c('0x14')]=_0x17fb93[_0xe02c('0x14')];this[_0xe02c('0x15')]=!![];this[_0xe02c('0x16')]=_0x17fb93[_0xe02c('0x16')];this['variables']={};ami['on'](_0xe02c('0x17'),this['syncQueueSummary']['bind'](this));ami['on'](_0xe02c('0x18'),this['syncQueueSummaryComplete'][_0xe02c('0x19')](this));ami['on']('queuecallerjoin',this[_0xe02c('0x1a')]['bind'](this));ami['on'](_0xe02c('0x1b'),this[_0xe02c('0x1c')]['bind'](this));ami['on'](_0xe02c('0x1d'),this[_0xe02c('0x1e')]['bind'](this));ami['on'](_0xe02c('0x1f'),this[_0xe02c('0x20')]['bind'](this));ami['on']('agentconnect',this[_0xe02c('0x21')]['bind'](this));ami['on'](_0xe02c('0x22'),this[_0xe02c('0x23')][_0xe02c('0x19')](this));ami['on'](_0xe02c('0x24'),this[_0xe02c('0x25')]['bind'](this));ami['on'](_0xe02c('0x26'),this['syncFullyBooted']['bind'](this));ami['on'](_0xe02c('0x27'),this[_0xe02c('0x28')]['bind'](this));ami['on'](_0xe02c('0x29'),this[_0xe02c('0x2a')]['bind'](this));ami['on'](_0xe02c('0x2b'),this[_0xe02c('0x2c')][_0xe02c('0x19')](this));ami['on'](_0xe02c('0x2d'),this[_0xe02c('0x2e')][_0xe02c('0x19')](this));this[_0xe02c('0x2f')]();this[_0xe02c('0x30')]();}function clearChannels(_0xeae877){if(!_[_0xe02c('0x31')](_0xeae877)){for(var _0x60b65e in _0xeae877){if(_0xeae877['hasOwnProperty'](_0x60b65e)){delete _0xeae877[_0x60b65e];}}}}function clearCampaigns(_0xefd882){if(!_[_0xe02c('0x31')](_0xefd882)){for(var _0x3592ca in _0xefd882){if(_0xefd882[_0xe02c('0x32')](_0x3592ca)){_0xefd882[_0x3592ca][_0xe02c('0x33')]=0x0;}}}}function clearVoiceQueues(_0x303d24){if(!_[_0xe02c('0x31')](_0x303d24)){for(var _0x1c14d6 in _0x303d24){if(_0x303d24['hasOwnProperty'](_0x1c14d6)){_0x303d24[_0x1c14d6][_0xe02c('0x33')]=0x0;_0x303d24[_0x1c14d6][_0xe02c('0x34')]=0x0;_0x303d24[_0x1c14d6][_0xe02c('0x35')]=0x0;_0x303d24[_0x1c14d6]['waiting']=0x0;_0x303d24[_0x1c14d6][_0xe02c('0x36')]=!![];}}}}function clearAgentBooked(_0x2d1d98){if(!_[_0xe02c('0x31')](_0x2d1d98)){for(var _0x287f7e in _0x2d1d98){if(_0x2d1d98[_0xe02c('0x32')](_0x287f7e)){_0x2d1d98[_0x287f7e][_0xe02c('0x37')]=!![];}}}}VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x39')]=function(){var _0x9ee479=this;for(var _0x288004 in this[_0xe02c('0x12')]){if(this['channels'][_0xe02c('0x32')](_0x288004)&&!this[_0xe02c('0x12')][_0x288004][_0xe02c('0x3a')]){this[_0xe02c('0xf')][_0xe02c('0xc')](function(){if(!_[_0xe02c('0x3b')](_0x9ee479['channels'][_0x288004])){return ami[_0xe02c('0x3c')]({'action':_0xe02c('0x3d'),'channel':_0x9ee479['channels'][_0x288004][_0xe02c('0x3e')]})[_0xe02c('0x3f')](function(_0x43ac5d){if(_0x43ac5d[_0xe02c('0x40')]===_0xe02c('0x41')){setTimeout(function(){if(_0x9ee479['channels'][_0x288004]){delete _0x9ee479['channels'][_0x288004];logger[_0xe02c('0x42')](_0xe02c('0x43'),_0x288004,util['inspect'](_0x43ac5d,{'showHidden':![],'depth':null}));}if(_0x9ee479[_0xe02c('0x10')][_0x288004]){delete _0x9ee479['queueReports'][_0x288004];logger[_0xe02c('0x42')](_0xe02c('0x44'),_0x288004,util[_0xe02c('0x45')](_0x43ac5d,{'showHidden':![],'depth':null}));}if(_0x9ee479[_0xe02c('0x46')][_0x288004]){delete _0x9ee479[_0xe02c('0x46')][_0x288004];logger['error'](_0xe02c('0x47'),_0x288004,util['inspect'](_0x43ac5d,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x48')]=function(){logger[_0xe02c('0x42')](_0xe02c('0x49'));clearChannels(this[_0xe02c('0x12')]);this[_0xe02c('0x4a')](this['queueReports']);clearAgentBooked(this[_0xe02c('0x11')]);clearVoiceQueues(this[_0xe02c('0x14')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x4a')]=function(_0x4ea038){var _0x396a06=this;if(!_['isEmpty'](_0x4ea038)){for(var _0x2bf07b in _0x4ea038){if(_0x4ea038[_0xe02c('0x32')](_0x2bf07b)){_0x396a06['emitVoiceQueueChannelRemove'](_0x4ea038[_0x2bf07b],_0xe02c('0x4b'));delete _0x4ea038[_0x2bf07b];}}}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x4c')]=function(_0x441961,_0x3c4a65,_0x28922a){io['to'](_0x441961)['emit'](_0x3c4a65,_0x28922a);};VoiceQueueReport[_0xe02c('0x38')]['emitVoiceQueueChannelSave']=function(_0x5ae8cd,_0x3db057){logger[_0xe02c('0x4d')](_0xe02c('0x4e')+_0x3db057+_0xe02c('0x4f'),_0x5ae8cd['uniqueid'],util[_0xe02c('0x45')](_0x5ae8cd,{'showHidden':![],'depth':null}));this[_0xe02c('0x4c')](util[_0xe02c('0x50')]('voice:queue:%s',_0x5ae8cd['name']),_0xe02c('0x51'),_0x5ae8cd);};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x52')]=function(_0x2313d2,_0x1b0876){logger[_0xe02c('0x4d')](_0xe02c('0x4e')+_0x1b0876+_0xe02c('0x53'),_0x2313d2[_0xe02c('0x54')],util['inspect'](_0x2313d2,{'showHidden':![],'depth':null}));this[_0xe02c('0x4c')](util['format']('voice:queue:%s',_0x2313d2[_0xe02c('0x55')]),_0xe02c('0x56'),_0x2313d2);};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x57')]=function(_0x24d506,_0x12ca0e){if(_0x24d506[_0xe02c('0x58')]===_0xe02c('0x59')){var _0x58d1cc={'id':_0x24d506['id'],'name':_0x24d506['name'],'strategy':_0x24d506[_0xe02c('0x5a')],'answered':_0x24d506[_0xe02c('0x5b')],'available':_0x24d506[_0xe02c('0x5c')],'loggedIn':_0x24d506['loggedIn'],'pTalking':_0x24d506[_0xe02c('0x35')],'sumBillable':_0x24d506[_0xe02c('0x5d')],'sumDuration':_0x24d506[_0xe02c('0x5e')],'sumHoldTime':_0x24d506[_0xe02c('0x5f')]||0x0,'talking':_0x24d506[_0xe02c('0x34')],'total':_0x24d506[_0xe02c('0x60')],'type':_0x24d506[_0xe02c('0x58')],'unmanaged':_0x24d506[_0xe02c('0x61')],'abandoned':_0x24d506[_0xe02c('0x62')],'waiting':_0x24d506[_0xe02c('0x63')]};if(_0x24d506['Trunk']){_0x58d1cc[_0xe02c('0x64')]={'id':_0x24d506[_0xe02c('0x64')]['id'],'name':_0x24d506[_0xe02c('0x64')][_0xe02c('0x55')],'active':_0x24d506[_0xe02c('0x64')][_0xe02c('0x65')],'callerid':_0x24d506[_0xe02c('0x64')][_0xe02c('0x66')]};}if(_0x24d506[_0xe02c('0x67')]){_0x58d1cc[_0xe02c('0x67')]={'id':_0x24d506[_0xe02c('0x67')]['id'],'name':_0x24d506[_0xe02c('0x67')][_0xe02c('0x55')]};}var _0x48ec5c=md5(JSON[_0xe02c('0x68')](_0x58d1cc));if(_0x24d506['md5']!==_0x48ec5c){_0x24d506[_0xe02c('0x69')]=_0x48ec5c;logger[_0xe02c('0x4d')](_0xe02c('0x6a')+_0x12ca0e+_0xe02c('0x6b'),util[_0xe02c('0x45')](_0x58d1cc,{'showHidden':![],'depth':null}));this[_0xe02c('0x4c')](util[_0xe02c('0x50')](_0xe02c('0x6c'),_0x58d1cc[_0xe02c('0x55')]),_0xe02c('0x6d'),_0x58d1cc);}}};VoiceQueueReport['prototype'][_0xe02c('0x6e')]=function(_0x43beb){return _0x43beb!==null&&!_[_0xe02c('0x6f')](_0x43beb);};VoiceQueueReport['prototype'][_0xe02c('0x30')]=function(){var _0x5ab97d=this;setInterval(function(){_0x5ab97d[_0xe02c('0x39')]();ami['Action']({'action':'queues'})['catch'](function(_0x55cf99){logger['error']('[voiceQueueReport][queues]',util[_0xe02c('0x45')](_0x55cf99,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x2f')]=function(){var _0x35fbe2=this;setInterval(function(){if(_0x35fbe2['flagQueueSummary']){return ami[_0xe02c('0x3c')]({'action':_0xe02c('0x17')})['then'](function(_0x37ef7d){_0x35fbe2[_0xe02c('0x15')]=![];})[_0xe02c('0x3f')](function(_0x51f940){logger['error'](_0xe02c('0x70'),util[_0xe02c('0x45')](_0x51f940,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xe02c('0x38')]['syncQueueSummary']=function(_0xef6965){try{if(this['isNotNull'](_0xef6965)&&this['isNotNull'](_0xef6965[_0xe02c('0x71')])){logger[_0xe02c('0x4d')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xe02c('0x45')](_0xef6965,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]]){logger['info'](_0xe02c('0x72'),_0xef6965[_0xe02c('0x71')]);var _0x57d003=_[_0xe02c('0x73')](this[_0xe02c('0x12')],_0xe02c('0x71'))[_0xef6965[_0xe02c('0x71')]]||0x0;var _0x446c71=_0x57d003-_0xef6965[_0xe02c('0x74')];if(this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x63')]!==_['toNumber'](_0xef6965['callers'])||this['voiceQueues'][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x75')]!==_[_0xe02c('0x76')](_0xef6965['loggedin'])||this['voiceQueues'][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x5c')]!==_[_0xe02c('0x76')](_0xef6965[_0xe02c('0x5c')])||this[_0xe02c('0x14')][_0xef6965['queue']][_0xe02c('0x34')]!==_0x446c71){this[_0xe02c('0x14')][_0xef6965['queue']]['waiting']=_[_0xe02c('0x76')](_0xef6965['callers']);this['voiceQueues'][_0xef6965['queue']][_0xe02c('0x75')]=_[_0xe02c('0x76')](_0xef6965[_0xe02c('0x77')]);this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x5c')]=_['toNumber'](_0xef6965[_0xe02c('0x5c')]);this['voiceQueues'][_0xef6965['queue']][_0xe02c('0x34')]=_0x446c71>0x0?_0x446c71:0x0;this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x34')]=this['voiceQueues'][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x34')]>_['toNumber'](_0xef6965[_0xe02c('0x77')])?_[_0xe02c('0x76')](_0xef6965['loggedin']):this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x34')];this[_0xe02c('0x57')](this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]],_0xe02c('0x17'));}logger['debug'](_0xe02c('0x78'),util['inspect'](this['voiceQueues'][_0xef6965['queue']],{'showHidden':![],'depth':null}));ami[_0xe02c('0x4c')](_0xe02c('0x79'),this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]]);}}}catch(_0x5a99a3){logger[_0xe02c('0x42')](_0xe02c('0x70'),util['inspect'](_0x5a99a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x33c8fc){logger[_0xe02c('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x33c8fc,{'showHidden':![],'depth':null}));this[_0xe02c('0x15')]=!![];};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x1a')]=function(_0x36e0c0){try{if(this[_0xe02c('0x6e')](_0x36e0c0)){logger['debug'](_0xe02c('0x7a'),_0x36e0c0[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x36e0c0,{'showHidden':![],'depth':null}));if(_[_0xe02c('0x6f')](this[_0xe02c('0x10')][_0x36e0c0[_0xe02c('0x54')]])){this['queueReports'][_0x36e0c0[_0xe02c('0x54')]]=[];this[_0xe02c('0x12')][_0x36e0c0['uniqueid']]={};}var _0x1c15d1=new QueueReport();_0x1c15d1[_0xe02c('0x55')]=_0x36e0c0[_0xe02c('0x71')];_0x1c15d1[_0xe02c('0x58')]=this['voiceQueues'][_0x1c15d1[_0xe02c('0x55')]]&&this[_0xe02c('0x14')][_0x1c15d1['name']]['type']?this['voiceQueues'][_0x1c15d1[_0xe02c('0x55')]][_0xe02c('0x58')]||_0xe02c('0x59'):_0xe02c('0x59');_0x1c15d1[_0xe02c('0x71')]=_0x36e0c0['queue'];_0x1c15d1[_0xe02c('0x7b')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x1c15d1['position']=_0x36e0c0['position'];_0x1c15d1['count']=_0x36e0c0[_0xe02c('0x7d')];_0x1c15d1[_0xe02c('0x54')]=_0x36e0c0[_0xe02c('0x54')];logger[_0xe02c('0x7e')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1c15d1[_0xe02c('0x55')],_0x1c15d1['type']);_['merge'](_0x1c15d1,_[_0xe02c('0x7f')](_0x36e0c0,_[_0xe02c('0x80')](_0x1c15d1)));this[_0xe02c('0x10')][_0x36e0c0[_0xe02c('0x54')]][_0xe02c('0x81')](_0x1c15d1);this[_0xe02c('0x12')][_0x36e0c0[_0xe02c('0x54')]]=_0x1c15d1;this[_0xe02c('0x82')](_0x1c15d1,'queuecallerjoin');}}catch(_0x41cde2){logger[_0xe02c('0x42')](_0xe02c('0x7a'),_0x36e0c0[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x41cde2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x1c')]=function(_0x1ccc02){try{if(this[_0xe02c('0x6e')](_0x1ccc02)){logger[_0xe02c('0x4d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1ccc02['uniqueid'],util[_0xe02c('0x45')](_0x1ccc02,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0x1ccc02[_0xe02c('0x54')]]){var _0x76fb21=_[_0xe02c('0x83')](this['queueReports'][_0x1ccc02[_0xe02c('0x54')]]);_0x76fb21[_0xe02c('0x84')]=![];_0x76fb21[_0xe02c('0x85')]=null;_0x76fb21[_0xe02c('0x86')]=_0x1ccc02[_0xe02c('0x86')];_0x76fb21[_0xe02c('0x87')]=_0x1ccc02[_0xe02c('0x87')];_0x76fb21[_0xe02c('0x1b')]=!![];_0x76fb21[_0xe02c('0x88')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x76fb21[_0xe02c('0x89')]='ABANDONED';_0x76fb21['lastAssignedTo']=null;logger[_0xe02c('0x7e')](_0xe02c('0x8a'),_0x76fb21['name'],_0x76fb21[_0xe02c('0x58')]);this['channels'][_0x1ccc02[_0xe02c('0x54')]]=_0x76fb21;this['emitVoiceQueueChannelRemove'](_0x76fb21,_0xe02c('0x1b'));}}}catch(_0x16c217){logger[_0xe02c('0x42')](_0xe02c('0x8b'),_0x1ccc02[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x16c217,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x1e')]=function(_0x3d3954){try{if(this[_0xe02c('0x6e')](_0x3d3954)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x3d3954['uniqueid'],util[_0xe02c('0x45')](_0x3d3954,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0x3d3954[_0xe02c('0x54')]]){var _0x1133ce=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0x3d3954[_0xe02c('0x54')]]);_0x1133ce[_0xe02c('0x8c')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x1133ce[_0xe02c('0x8d')]=_0x3d3954[_0xe02c('0x8d')];_0x1133ce[_0xe02c('0x8e')]=_0x3d3954['connectedlinename'];logger['info'](_0xe02c('0x8f'),_0x1133ce[_0xe02c('0x55')],_0x1133ce[_0xe02c('0x58')],_0x3d3954['connectedlinenum'],_0x3d3954[_0xe02c('0x8e')]);this[_0xe02c('0x12')][_0x3d3954[_0xe02c('0x54')]]=_0x1133ce;this[_0xe02c('0x82')](_0x1133ce,_0xe02c('0x1d'));}}}catch(_0x5c0506){logger[_0xe02c('0x42')](_0xe02c('0x90'),_0x3d3954[_0xe02c('0x54')],util['inspect'](_0x5c0506,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x21')]=function(_0xbbe9ab){try{if(this[_0xe02c('0x6e')](_0xbbe9ab)){logger[_0xe02c('0x4d')]('[%s][voiceQueueReport][agentconnect]',_0xbbe9ab[_0xe02c('0x54')],util[_0xe02c('0x45')](_0xbbe9ab,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0xbbe9ab['uniqueid']]){var _0x3c129c=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0xbbe9ab[_0xe02c('0x54')]]);_0x3c129c[_0xe02c('0x84')]=!![];_0x3c129c['queuecallerexitreason']=_0xe02c('0x91');logger[_0xe02c('0x7e')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3c129c[_0xe02c('0x55')],_0x3c129c['type']);}}}catch(_0x52fcd6){logger['error'](_0xe02c('0x92'),_0xbbe9ab[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x52fcd6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x20')]=function(_0x167f9e){try{if(this[_0xe02c('0x6e')](_0x167f9e)){logger[_0xe02c('0x4d')](_0xe02c('0x93'),_0x167f9e[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x167f9e,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x54')]]){var _0xfe0b1c=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0x167f9e['uniqueid']]);_0xfe0b1c[_0xe02c('0x1b')]=![];_0xfe0b1c['queuecallerabandonAt']=null;_0xfe0b1c[_0xe02c('0x94')]=!![];_0xfe0b1c[_0xe02c('0x95')]=_0x167f9e[_0xe02c('0x96')];_0xfe0b1c[_0xe02c('0x86')]=_0x167f9e[_0xe02c('0x86')];_0xfe0b1c[_0xe02c('0x84')]=!![];_0xfe0b1c[_0xe02c('0x97')]=![];_0xfe0b1c[_0xe02c('0x98')]=null;if(!_0xfe0b1c[_0xe02c('0x99')]){if(_0x167f9e[_0xe02c('0x9a')]==_0xe02c('0x99')){_0xfe0b1c[_0xe02c('0x89')]='COMPLETED';logger[_0xe02c('0x7e')](_0xe02c('0x9b'),_0xfe0b1c['name'],_0xfe0b1c[_0xe02c('0x58')]);}else{if(_['startsWith'](_0x167f9e['channel'][_0xe02c('0x9c')](),_0xe02c('0x9d'))){if(this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x9e')]]){var _0x4b4b7c=_['last'](this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x9e')]]);_0x4b4b7c['queuecallercomplete']=![];_0x4b4b7c[_0xe02c('0x97')]=!![];_0x4b4b7c[_0xe02c('0x98')]=moment(_0xfe0b1c[_0xe02c('0x7b')])[_0xe02c('0x9f')](_0x167f9e[_0xe02c('0x86')],_0xe02c('0xa0'))['format'](_0xe02c('0x7c'));_0x4b4b7c[_0xe02c('0x89')]=_0xe02c('0xa1');_0x4b4b7c[_0xe02c('0x99')]=!![];_0x4b4b7c[_0xe02c('0xa2')]=_0xe02c('0xa3');_0x4b4b7c[_0xe02c('0xa4')]=_0x167f9e[_0xe02c('0xa5')];_0x4b4b7c[_0xe02c('0xa6')]=_0x167f9e[_0xe02c('0x54')];logger[_0xe02c('0x7e')](_0xe02c('0xa7'),_0x4b4b7c[_0xe02c('0x55')],_0x4b4b7c[_0xe02c('0x58')]);var _0x5c4ed7=this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x9e')]];this[_0xe02c('0x10')][_0x167f9e['linkedid']]=this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x54')]];this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x54')]]=_0x5c4ed7;}}else{_0xfe0b1c[_0xe02c('0x89')]=_0xe02c('0xa8')+_0x167f9e[_0xe02c('0x9a')]['toUpperCase']();logger[_0xe02c('0x7e')](_0xe02c('0xa9'),_0xfe0b1c[_0xe02c('0x55')],_0xfe0b1c[_0xe02c('0x58')],_0xfe0b1c[_0xe02c('0x89')]);}}}this[_0xe02c('0x12')][_0x167f9e[_0xe02c('0x54')]]=_0xfe0b1c;this[_0xe02c('0x52')](_0xfe0b1c,_0xe02c('0x1f'));}}}catch(_0x5ed226){logger[_0xe02c('0x42')](_0xe02c('0x93'),_0x167f9e['uniqueid'],util[_0xe02c('0x45')](_0x5ed226,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x23')]=function(_0x46fd38){try{if(this[_0xe02c('0x6e')](_0x46fd38)){logger[_0xe02c('0x4d')]('[%s][voiceQueueReport][varset]',_0x46fd38[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x46fd38,{'showHidden':![],'depth':null}));this[_0xe02c('0xaa')](_0x46fd38['uniqueid'],_['keys'](_0x46fd38[_0xe02c('0xab')])[0x0],_0x46fd38[_0xe02c('0xac')]);if(this[_0xe02c('0x10')][_0x46fd38['uniqueid']]){var _0x15d16c=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0x46fd38[_0xe02c('0x54')]]);if(_0x15d16c){if(this[_0xe02c('0x6e')](_0x46fd38['variable'])&&this[_0xe02c('0x6e')](_0x46fd38[_0xe02c('0xab')][_0xe02c('0xad')])){switch(_0x46fd38[_0xe02c('0xac')]){case _0xe02c('0xae'):_0x15d16c[_0xe02c('0x97')]=![];_0x15d16c[_0xe02c('0x98')]=null;break;case _0xe02c('0xaf'):_0x15d16c[_0xe02c('0xb0')]=_0xe02c('0xb1');_0x15d16c[_0xe02c('0x97')]=!![];_0x15d16c[_0xe02c('0x98')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x15d16c[_0xe02c('0x8c')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x46fd38[_0xe02c('0x54')],util['inspect'](_0x15d16c,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x15d16c);break;default:_0x15d16c[_0xe02c('0x97')]=!![];_0x15d16c[_0xe02c('0x98')]=moment()[_0xe02c('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x15d16c[_0xe02c('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x15d16c[_0xe02c('0x1b')]=![];_0x15d16c[_0xe02c('0x88')]=null;_0x15d16c['queuecallerexitreason']=_0x46fd38[_0xe02c('0xac')];this['channels'][_0x46fd38['uniqueid']]=_0x15d16c;this[_0xe02c('0x52')](_0x15d16c,_0xe02c('0x22'));}else if(this[_0xe02c('0x6e')](_0x46fd38[_0xe02c('0xab')])&&this['isNotNull'](_0x46fd38[_0xe02c('0xab')][_0xe02c('0xb2')])){if(!_0x15d16c[_0xe02c('0x1b')]){_0x15d16c[_0xe02c('0x97')]=!![];_0x15d16c[_0xe02c('0x98')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x15d16c[_0xe02c('0x89')]=_0xe02c('0xb3');_0x15d16c[_0xe02c('0x8c')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));this[_0xe02c('0x12')][_0x46fd38[_0xe02c('0x54')]]=_0x15d16c;}}logger[_0xe02c('0x7e')](_0xe02c('0xb4'),_0x46fd38[_0xe02c('0x54')],_0x15d16c['name'],_0x15d16c[_0xe02c('0x58')],_[_0xe02c('0x80')](_0x46fd38['variable'])[0x0],_0x46fd38[_0xe02c('0xac')]);_0x15d16c[_0xe02c('0x46')]=this[_0xe02c('0x46')][_0x46fd38['uniqueid']];}}}}catch(_0x3becd8){logger[_0xe02c('0x42')](_0xe02c('0xb5'),_0x46fd38['uniqueid'],util[_0xe02c('0x45')](_0x3becd8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0xaa')]=function(_0x319d13,_0x28663f,_0x4f633b){var _0x46eec2=['rtpaudioqos',_0xe02c('0xb6'),'rtpaudioqosjitter',_0xe02c('0xb7'),'rtpaudioqosloss',_0xe02c('0xb8'),_0xe02c('0xb9'),_0xe02c('0xba'),_0xe02c('0xbb'),_0xe02c('0xbc'),'bridgepeer','bridgepvtcallid',_0xe02c('0xbd'),_0xe02c('0xbe'),_0xe02c('0xbf'),_0xe02c('0xc0'),_0xe02c('0x96'),'memberpenalty',_0xe02c('0xc1')];if(!_[_0xe02c('0x3b')](_0x28663f)&&!_[_0xe02c('0xc2')](_0x46eec2,_0x28663f)){if(_['isUndefined'](this[_0xe02c('0x46')][_0x319d13])){this[_0xe02c('0x46')][_0x319d13]={};}this[_0xe02c('0x46')][_0x319d13][_0x28663f]=_0x4f633b;}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x25')]=function(_0x25e09b){try{if(this['isNotNull'](_0x25e09b)){logger['debug'](_0xe02c('0xc3'),_0x25e09b[_0xe02c('0x54')],util['inspect'](_0x25e09b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x25e09b['uniqueid']]){for(var _0x531596=0x0,_0x329e4d={};_0x5315960x0?_0x9fa40e:0x0;this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2c')]=this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2c')]>_[_0xc659('0x69')](_0x3cbb6c[_0xc659('0x6a')])?_[_0xc659('0x69')](_0x3cbb6c[_0xc659('0x6a')]):this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]][_0xc659('0x2c')];this[_0xc659('0x6b')](this[_0xc659('0xf')][_0x3cbb6c['queue']],_0xc659('0x12'));}logger['debug'](_0xc659('0x6c'),util[_0xc659('0x37')](this[_0xc659('0xf')][_0x3cbb6c[_0xc659('0x64')]],{'showHidden':![],'depth':null}));ami[_0xc659('0x3f')](_0xc659('0x6d'),this['voiceQueues'][_0x3cbb6c[_0xc659('0x64')]]);}}}catch(_0x1b4e6b){logger[_0xc659('0x36')](_0xc659('0x62'),util[_0xc659('0x37')](_0x1b4e6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')]['syncQueueSummaryComplete']=function(_0x1b3504){logger[_0xc659('0x41')](_0xc659('0x6e'),util['inspect'](_0x1b3504,{'showHidden':![],'depth':null}));this[_0xc659('0x10')]=!![];};VoiceQueueReport[_0xc659('0x30')]['syncQueueCallerJoin']=function(_0x3b58f7){try{if(this[_0xc659('0x5c')](_0x3b58f7)){logger[_0xc659('0x41')](_0xc659('0x6f'),_0x3b58f7[_0xc659('0x43')],util[_0xc659('0x37')](_0x3b58f7,{'showHidden':![],'depth':null}));if(_[_0xc659('0x5d')](this['queueReports'][_0x3b58f7[_0xc659('0x43')]])){this[_0xc659('0xb')][_0x3b58f7['uniqueid']]=[];this[_0xc659('0xd')][_0x3b58f7['uniqueid']]={};}var _0x7fbb8e=new QueueReport();_0x7fbb8e[_0xc659('0x45')]=_0x3b58f7['queue'];_0x7fbb8e[_0xc659('0x48')]=this[_0xc659('0xf')][_0x7fbb8e['name']]&&this['voiceQueues'][_0x7fbb8e[_0xc659('0x45')]][_0xc659('0x48')]?this[_0xc659('0xf')][_0x7fbb8e[_0xc659('0x45')]][_0xc659('0x48')]||_0xc659('0x49'):'inbound';_0x7fbb8e['queue']=_0x3b58f7['queue'];_0x7fbb8e[_0xc659('0x70')]=moment()[_0xc659('0x44')](_0xc659('0x71'));_0x7fbb8e[_0xc659('0x72')]=_0x3b58f7[_0xc659('0x72')];_0x7fbb8e['count']=_0x3b58f7[_0xc659('0x73')];_0x7fbb8e['uniqueid']=_0x3b58f7[_0xc659('0x43')];logger[_0xc659('0x65')](_0xc659('0x74'),_0x7fbb8e[_0xc659('0x45')],_0x7fbb8e[_0xc659('0x48')]);_[_0xc659('0x75')](_0x7fbb8e,_[_0xc659('0x76')](_0x3b58f7,_['keys'](_0x7fbb8e)));this['queueReports'][_0x3b58f7[_0xc659('0x43')]]['push'](_0x7fbb8e);this['channels'][_0x3b58f7[_0xc659('0x43')]]=_0x7fbb8e;this[_0xc659('0x40')](_0x7fbb8e,_0xc659('0x17'));}}catch(_0x1938a7){logger[_0xc659('0x36')](_0xc659('0x6f'),_0x3b58f7[_0xc659('0x43')],util['inspect'](_0x1938a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')]['syncQueueCallerAbandon']=function(_0x43e7c3){try{if(this[_0xc659('0x5c')](_0x43e7c3)){logger[_0xc659('0x41')](_0xc659('0x77'),_0x43e7c3[_0xc659('0x43')],util['inspect'](_0x43e7c3,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0x43e7c3[_0xc659('0x43')]]){var _0x44dc3b=_[_0xc659('0x78')](this[_0xc659('0xb')][_0x43e7c3[_0xc659('0x43')]]);_0x44dc3b[_0xc659('0x79')]=![];_0x44dc3b[_0xc659('0x7a')]=null;_0x44dc3b[_0xc659('0x7b')]=_0x43e7c3[_0xc659('0x7b')];_0x44dc3b[_0xc659('0x7c')]=_0x43e7c3[_0xc659('0x7c')];_0x44dc3b[_0xc659('0x19')]=!![];_0x44dc3b['queuecallerabandonAt']=moment()[_0xc659('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x44dc3b['queuecallerexitreason']='ABANDONED';_0x44dc3b[_0xc659('0x7d')]=null;logger[_0xc659('0x65')](_0xc659('0x7e'),_0x44dc3b[_0xc659('0x45')],_0x44dc3b[_0xc659('0x48')]);this[_0xc659('0xd')][_0x43e7c3[_0xc659('0x43')]]=_0x44dc3b;this[_0xc659('0x3d')](_0x44dc3b,_0xc659('0x19'));}}}catch(_0x382041){logger[_0xc659('0x36')](_0xc659('0x77'),_0x43e7c3[_0xc659('0x43')],util[_0xc659('0x37')](_0x382041,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')]['syncQueueCallerLeave']=function(_0x4781a6){try{if(this['isNotNull'](_0x4781a6)){logger[_0xc659('0x41')](_0xc659('0x7f'),_0x4781a6[_0xc659('0x43')],util['inspect'](_0x4781a6,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0x4781a6[_0xc659('0x43')]]){var _0x29b3ad=_['last'](this[_0xc659('0xb')][_0x4781a6[_0xc659('0x43')]]);_0x29b3ad[_0xc659('0x80')]=moment()[_0xc659('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b3ad[_0xc659('0x81')]=_0x4781a6[_0xc659('0x81')];_0x29b3ad[_0xc659('0x82')]=_0x4781a6[_0xc659('0x82')];logger[_0xc659('0x65')](_0xc659('0x83'),_0x29b3ad[_0xc659('0x45')],_0x29b3ad[_0xc659('0x48')],_0x4781a6['connectedlinenum'],_0x4781a6['connectedlinename']);this['channels'][_0x4781a6[_0xc659('0x43')]]=_0x29b3ad;this[_0xc659('0x40')](_0x29b3ad,'queuecallerleave');}}}catch(_0x138daa){logger[_0xc659('0x36')]('[%s][voiceQueueReport][queuecallerleave]',_0x4781a6[_0xc659('0x43')],util[_0xc659('0x37')](_0x138daa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc659('0x1f')]=function(_0x6e82f3){try{if(this[_0xc659('0x5c')](_0x6e82f3)){logger['debug'](_0xc659('0x84'),_0x6e82f3['uniqueid'],util[_0xc659('0x37')](_0x6e82f3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x6e82f3[_0xc659('0x43')]]){var _0x19eeb0=_['last'](this[_0xc659('0xb')][_0x6e82f3['uniqueid']]);_0x19eeb0[_0xc659('0x79')]=!![];_0x19eeb0[_0xc659('0x85')]=_0xc659('0x86');logger['info'](_0xc659('0x87'),_0x19eeb0[_0xc659('0x45')],_0x19eeb0[_0xc659('0x48')]);}}}catch(_0x37638c){logger['error'](_0xc659('0x84'),_0x6e82f3['uniqueid'],util[_0xc659('0x37')](_0x37638c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')][_0xc659('0x1d')]=function(_0xe66d63){try{if(this[_0xc659('0x5c')](_0xe66d63)){logger[_0xc659('0x41')](_0xc659('0x88'),_0xe66d63[_0xc659('0x43')],util['inspect'](_0xe66d63,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0xe66d63[_0xc659('0x43')]]){var _0x38dd10=_[_0xc659('0x78')](this[_0xc659('0xb')][_0xe66d63[_0xc659('0x43')]]);_0x38dd10['queuecallerabandon']=![];_0x38dd10[_0xc659('0x89')]=null;_0x38dd10[_0xc659('0x8a')]=!![];_0x38dd10['lastAssignedTo']=_0xe66d63[_0xc659('0x8b')];_0x38dd10[_0xc659('0x7b')]=_0xe66d63[_0xc659('0x7b')];_0x38dd10[_0xc659('0x79')]=!![];_0x38dd10[_0xc659('0x8c')]=![];_0x38dd10[_0xc659('0x8d')]=null;if(!_0x38dd10[_0xc659('0x8e')]){if(_0xe66d63['reason']==_0xc659('0x8e')){_0x38dd10[_0xc659('0x85')]=_0xc659('0x8f');logger['info'](_0xc659('0x90'),_0x38dd10[_0xc659('0x45')],_0x38dd10[_0xc659('0x48')]);}else{if(_['startsWith'](_0xe66d63['channel'][_0xc659('0x91')](),_0xc659('0x92'))){if(this[_0xc659('0xb')][_0xe66d63[_0xc659('0x93')]]){var _0x2e82c3=_[_0xc659('0x78')](this['queueReports'][_0xe66d63['linkedid']]);_0x2e82c3[_0xc659('0x79')]=![];_0x2e82c3[_0xc659('0x8c')]=!![];_0x2e82c3[_0xc659('0x8d')]=moment(_0x38dd10['queuecallerjoinAt'])[_0xc659('0x94')](_0xe66d63[_0xc659('0x7b')],_0xc659('0x95'))[_0xc659('0x44')](_0xc659('0x71'));_0x2e82c3[_0xc659('0x85')]=_0xc659('0x96');_0x2e82c3[_0xc659('0x8e')]=!![];_0x2e82c3[_0xc659('0x97')]=_0xc659('0x98');_0x2e82c3['transferexten']=_0xe66d63[_0xc659('0x99')];_0x2e82c3['transferuniqueid']=_0xe66d63['uniqueid'];logger[_0xc659('0x65')](_0xc659('0x9a'),_0x2e82c3[_0xc659('0x45')],_0x2e82c3['type']);var _0x19c44a=this['queueReports'][_0xe66d63[_0xc659('0x93')]];this[_0xc659('0xb')][_0xe66d63[_0xc659('0x93')]]=this['queueReports'][_0xe66d63[_0xc659('0x43')]];this[_0xc659('0xb')][_0xe66d63[_0xc659('0x43')]]=_0x19c44a;}}else{_0x38dd10[_0xc659('0x85')]=_0xc659('0x9b')+_0xe66d63[_0xc659('0x9c')][_0xc659('0x9d')]();logger[_0xc659('0x65')](_0xc659('0x9e'),_0x38dd10[_0xc659('0x45')],_0x38dd10['type'],_0x38dd10[_0xc659('0x85')]);}}}this['channels'][_0xe66d63['uniqueid']]=_0x38dd10;this[_0xc659('0x3d')](_0x38dd10,_0xc659('0x1c'));}}}catch(_0x3726cd){logger[_0xc659('0x36')](_0xc659('0x88'),_0xe66d63['uniqueid'],util['inspect'](_0x3726cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x3d7545){try{if(this[_0xc659('0x5c')](_0x3d7545)){logger[_0xc659('0x41')](_0xc659('0x9f'),_0x3d7545['uniqueid'],util[_0xc659('0x37')](_0x3d7545,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d7545[_0xc659('0x43')],_['keys'](_0x3d7545['variable'])[0x0],_0x3d7545[_0xc659('0xa0')]);if(this['queueReports'][_0x3d7545[_0xc659('0x43')]]){var _0x57709e=_['last'](this[_0xc659('0xb')][_0x3d7545[_0xc659('0x43')]]);if(_0x57709e){if(this[_0xc659('0x5c')](_0x3d7545[_0xc659('0xa1')])&&this[_0xc659('0x5c')](_0x3d7545['variable']['queuestatus'])){switch(_0x3d7545[_0xc659('0xa0')]){case _0xc659('0xa2'):_0x57709e['queuecallerexit']=![];_0x57709e['queuecallerexitAt']=null;break;case _0xc659('0xa3'):_0x57709e['lastevent']='timeout';_0x57709e['queuecallerexit']=!![];_0x57709e['queuecallerexitAt']=moment()[_0xc659('0x44')](_0xc659('0x71'));_0x57709e['queuecallerleaveAt']=moment()[_0xc659('0x44')](_0xc659('0x71'));logger['debug'](_0xc659('0xa4'),_0x3d7545[_0xc659('0x43')],util[_0xc659('0x37')](_0x57709e,{'showHidden':![],'depth':null}));ami[_0xc659('0x3f')](_0xc659('0xa5'),_0x57709e);break;default:_0x57709e['queuecallerexit']=!![];_0x57709e[_0xc659('0x8d')]=moment()['format'](_0xc659('0x71'));_0x57709e[_0xc659('0x80')]=moment()[_0xc659('0x44')](_0xc659('0x71'));}_0x57709e[_0xc659('0x19')]=![];_0x57709e[_0xc659('0x89')]=null;_0x57709e[_0xc659('0x85')]=_0x3d7545[_0xc659('0xa0')];this[_0xc659('0xd')][_0x3d7545[_0xc659('0x43')]]=_0x57709e;this[_0xc659('0x3d')](_0x57709e,_0xc659('0x20'));}else if(this[_0xc659('0x5c')](_0x3d7545[_0xc659('0xa1')])&&this[_0xc659('0x5c')](_0x3d7545[_0xc659('0xa1')][_0xc659('0xa6')])){if(!_0x57709e[_0xc659('0x19')]){_0x57709e['queuecallerexit']=!![];_0x57709e[_0xc659('0x8d')]=moment()['format'](_0xc659('0x71'));_0x57709e['queuecallerexitreason']=_0xc659('0xa7');_0x57709e[_0xc659('0x80')]=moment()['format'](_0xc659('0x71'));this[_0xc659('0xd')][_0x3d7545[_0xc659('0x43')]]=_0x57709e;}}logger[_0xc659('0x65')](_0xc659('0xa8'),_0x3d7545[_0xc659('0x43')],_0x57709e[_0xc659('0x45')],_0x57709e[_0xc659('0x48')],_[_0xc659('0xa9')](_0x3d7545[_0xc659('0xa1')])[0x0],_0x3d7545[_0xc659('0xa0')]);_0x57709e['variables']=this[_0xc659('0x39')][_0x3d7545[_0xc659('0x43')]];}}}}catch(_0x2b99bd){logger[_0xc659('0x36')](_0xc659('0x9f'),_0x3d7545[_0xc659('0x43')],util['inspect'](_0x2b99bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc659('0x30')][_0xc659('0xaa')]=function(_0x254e28,_0x27a7fc,_0x114cbd){var _0x358a36=[_0xc659('0xab'),_0xc659('0xac'),_0xc659('0xad'),_0xc659('0xae'),_0xc659('0xaf'),'rtpaudioqoslossbridged',_0xc659('0xb0'),_0xc659('0xb1'),'sipcallid',_0xc659('0xb2'),_0xc659('0xb3'),_0xc659('0xb4'),_0xc659('0xb5'),_0xc659('0xb6'),_0xc659('0xb7'),'memberlastcall','membername',_0xc659('0xb8'),_0xc659('0xb9')];if(!_[_0xc659('0xba')](_0x27a7fc)&&!_[_0xc659('0xbb')](_0x358a36,_0x27a7fc)){if(_[_0xc659('0x5d')](this[_0xc659('0x39')][_0x254e28])){this[_0xc659('0x39')][_0x254e28]={};}this[_0xc659('0x39')][_0x254e28][_0x27a7fc]=_0x114cbd;}};VoiceQueueReport['prototype'][_0xc659('0xbc')]=function(_0x171750){try{if(this[_0xc659('0x5c')](_0x171750)){logger[_0xc659('0x41')](_0xc659('0xbd'),_0x171750['uniqueid'],util['inspect'](_0x171750,{'showHidden':![],'depth':null}));if(this[_0xc659('0xb')][_0x171750[_0xc659('0x43')]]){for(var _0x22dbf2=0x0,_0x24b6b0={};_0x22dbf2=0x0?moment(_0x348cb8[_0x9fe8('0x19')])[_0x9fe8('0xd')](_0x348cb8[_0x9fe8('0x17')],_0x9fe8('0x18')):null,'data1':_0x9fe8('0x1a'),'data2':_0x348cb8['accountcode'],'data3':_0x348cb8[_0x9fe8('0x10')],'data4':_0x348cb8[_0x9fe8('0x1b')]||null,'role':'agent','internal':_0x348cb8[_0x9fe8('0x13')]?_[_0x9fe8('0x1c')](_0x348cb8[_0x9fe8('0x13')]):undefined,'uniqueid':_0x348cb8[_0x9fe8('0x14')]},'log':_0x9fe8('0x4')});}; \ No newline at end of file +var _0xc7c5=['../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','diff','seconds','inbound','calleridnum','exten','queue','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','outbound','accountcode','dialstring','moment','lodash','util'];(function(_0x94b892,_0x3f3502){var _0x9ba26e=function(_0x332f3a){while(--_0x332f3a){_0x94b892['push'](_0x94b892['shift']());}};_0x9ba26e(++_0x3f3502);}(_0xc7c5,0xab));var _0x5c7c=function(_0x4091a0,_0x3980d0){_0x4091a0=_0x4091a0-0x0;var _0x5514f9=_0xc7c5[_0x4091a0];return _0x5514f9;};'use strict';var moment=require(_0x5c7c('0x0'));var _=require(_0x5c7c('0x1'));var util=require(_0x5c7c('0x2'));var client=require(_0x5c7c('0x3'));exports[_0x5c7c('0x4')]=function(_0x47fbac){var _0x35cef3=_0x47fbac[_0x5c7c('0x5')]||_0x47fbac['queuecallerexitAt'];return client[_0x5c7c('0x6')](_0x5c7c('0x7'),{'body':{'channel':_0x5c7c('0x8'),'membername':_0x47fbac[_0x5c7c('0x9')],'interface':_[_0x5c7c('0xa')](_0x47fbac[_0x5c7c('0xb')])?util[_0x5c7c('0xc')]('SIP/%s',_0x47fbac[_0x5c7c('0x9')]):_0x47fbac[_0x5c7c('0xb')],'type':_0x5c7c('0xd'),'enterAt':_0x47fbac['queuecallerleaveAt'],'exitAt':_0x35cef3,'duration':moment(_0x35cef3)[_0x5c7c('0xe')](_0x47fbac['queuecallerleaveAt'],_0x5c7c('0xf')),'data1':_0x5c7c('0x10'),'data2':_0x47fbac[_0x5c7c('0x11')],'data3':_0x47fbac[_0x5c7c('0x12')],'data4':null,'data5':_0x47fbac[_0x5c7c('0x13')],'role':'agent','internal':_0x47fbac['accountcode']?_[_0x5c7c('0x14')](_0x47fbac['accountcode']):undefined,'uniqueid':_0x47fbac[_0x5c7c('0x15')]},'log':_0x5c7c('0x7')});};exports[_0x5c7c('0x16')]=function(_0x3cefca){return client[_0x5c7c('0x6')](_0x5c7c('0x7'),{'body':{'channel':'voice','membername':_0x3cefca[_0x5c7c('0x17')],'interface':_0x3cefca[_0x5c7c('0xb')],'type':'TALKING','enterAt':_0x3cefca['starttime'],'exitAt':_0x3cefca[_0x5c7c('0x18')],'duration':moment(_0x3cefca[_0x5c7c('0x18')])[_0x5c7c('0xe')](_0x3cefca[_0x5c7c('0x19')],_0x5c7c('0xf'))>=0x0?moment(_0x3cefca[_0x5c7c('0x18')])[_0x5c7c('0xe')](_0x3cefca[_0x5c7c('0x19')],_0x5c7c('0xf')):null,'data1':_0x5c7c('0x1a'),'data2':_0x3cefca[_0x5c7c('0x1b')],'data3':_0x3cefca[_0x5c7c('0x12')],'data4':_0x3cefca[_0x5c7c('0x1c')]||null,'role':'agent','internal':_0x3cefca['accountcode']?_[_0x5c7c('0x14')](_0x3cefca[_0x5c7c('0x1b')]):undefined,'uniqueid':_0x3cefca[_0x5c7c('0x15')]},'log':_0x5c7c('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a49903d..ab65af4 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 _0xf403=['name','html','../client','Request','GetTemplate'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf403,0x1d3));var _0x3f40=function(_0x3e1e37,_0x561b20){_0x3e1e37=_0x3e1e37-0x0;var _0x5848cd=_0xf403[_0x3e1e37];return _0x5848cd;};'use strict';var client=require(_0x3f40('0x0'));exports['getTemplates']=function(_0x456979){return function(_0x197a40){return client[_0x3f40('0x1')](_0x3f40('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3f40('0x3'),_0x3f40('0x4')]},'log':_0x3f40('0x2')});};}; \ No newline at end of file +var _0x823c=['GetTemplate','name','html','../client','Request'];(function(_0x5abb00,_0x342d70){var _0xf9b854=function(_0x43ac30){while(--_0x43ac30){_0x5abb00['push'](_0x5abb00['shift']());}};_0xf9b854(++_0x342d70);}(_0x823c,0x143));var _0xc823=function(_0x3c4721,_0x3a44e8){_0x3c4721=_0x3c4721-0x0;var _0x1e9835=_0x823c[_0x3c4721];return _0x1e9835;};'use strict';var client=require(_0xc823('0x0'));exports['getTemplates']=function(_0x30a06f){return function(_0x5f9bd8){return client[_0xc823('0x1')](_0xc823('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc823('0x3'),_0xc823('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fde3bda..91edf7c 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 _0xd290=['channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','data1','data2','data4','data5','data7','../client','getTriggers','name'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xd290,0x165));var _0x0d29=function(_0x2fda9c,_0x30bf59){_0x2fda9c=_0x2fda9c-0x0;var _0xbec45=_0xd290[_0x2fda9c];return _0xbec45;};'use strict';var client=require(_0x0d29('0x0'));exports[_0x0d29('0x1')]=function(_0x4a3a00){return function(_0xdc7443){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0d29('0x2'),_0x0d29('0x3'),_0x0d29('0x4')],'include':[{'model':_0x0d29('0x5'),'as':_0x0d29('0x6'),'attributes':['id','field',_0x0d29('0x7'),_0x0d29('0x8')]},{'model':_0x0d29('0x5'),'as':_0x0d29('0x9'),'attributes':['id',_0x0d29('0xa'),'operator',_0x0d29('0x8')]},{'model':_0x0d29('0xb'),'as':_0x0d29('0xc'),'attributes':['id','action',_0x0d29('0xd'),_0x0d29('0xe'),'data3',_0x0d29('0xf'),_0x0d29('0x10'),'data6',_0x0d29('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x7bc2=['Action','Actions','action','data1','data2','data3','data4','data6','data7','GetTrigger','../client','getTriggers','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x7bc2,0xb2));var _0x27bc=function(_0x32f977,_0x375585){_0x32f977=_0x32f977-0x0;var _0x2a0ebd=_0x7bc2[_0x32f977];return _0x2a0ebd;};'use strict';var client=require(_0x27bc('0x0'));exports[_0x27bc('0x1')]=function(_0x323f43){return function(_0x80bfd1){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x27bc('0x2'),_0x27bc('0x3'),_0x27bc('0x4')],'include':[{'model':_0x27bc('0x5'),'as':_0x27bc('0x6'),'attributes':['id',_0x27bc('0x7'),_0x27bc('0x8'),_0x27bc('0x9')]},{'model':_0x27bc('0x5'),'as':_0x27bc('0xa'),'attributes':['id',_0x27bc('0x7'),_0x27bc('0x8'),_0x27bc('0x9')]},{'model':_0x27bc('0xb'),'as':_0x27bc('0xc'),'attributes':['id',_0x27bc('0xd'),_0x27bc('0xe'),_0x27bc('0xf'),_0x27bc('0x10'),_0x27bc('0x11'),'data5',_0x27bc('0x12'),_0x27bc('0x13')]}]},'log':_0x27bc('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 466403b..7ffca94 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 _0xc75b=['GetTrunk','registry','../client','getTrunks','Request'];(function(_0x33f4e1,_0x12a80f){var _0xa2a02d=function(_0x3833fa){while(--_0x3833fa){_0x33f4e1['push'](_0x33f4e1['shift']());}};_0xa2a02d(++_0x12a80f);}(_0xc75b,0x13d));var _0xbc75=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xc75b[_0x14a862];return _0x245eb5;};'use strict';var client=require(_0xbc75('0x0'));exports[_0xbc75('0x1')]=function(_0x55ed2c){return function(_0x334cff){return client[_0xbc75('0x2')](_0xbc75('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xbc75('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xa10d=['../client','getTrunks','GetTrunk','name'];(function(_0x4b7982,_0x5b0967){var _0x3239b6=function(_0x4c309f){while(--_0x4c309f){_0x4b7982['push'](_0x4b7982['shift']());}};_0x3239b6(++_0x5b0967);}(_0xa10d,0xac));var _0xda10=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xa10d[_0x344a3f];return _0x264712;};'use strict';var client=require(_0xda10('0x0'));exports[_0xda10('0x1')]=function(_0x1f08e0){return function(_0x44fd4c){return client['Request'](_0xda10('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xda10('0x3'),'registry']},'log':_0xda10('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 64ca94f..8365c5c 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 _0x0962=['internal','savePause','saveUnpause','getAgent','Request','ShowUser','online','lastLoginAt','lastPauseAt','getAgents','agent','name','email','accountcode','fullname','pauseType','voicePause','phone','mobile','interface','telephone'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x0962,0xc6));var _0x2096=function(_0xf03fe,_0x40fa88){_0xf03fe=_0xf03fe-0x0;var _0x1cc466=_0x0962[_0xf03fe];return _0x1cc466;};'use strict';var client=require('../client');exports[_0x2096('0x0')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0x2096('0x1')},'attributes':['id',_0x2096('0x2'),_0x2096('0x3'),_0x2096('0x4'),_0x2096('0x5'),'online','lastLoginAt',_0x2096('0x6'),'lastPauseAt',_0x2096('0x7'),_0x2096('0x8'),_0x2096('0x9'),_0x2096('0xa')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x2096('0xb')},'attributes':['id',_0x2096('0x2'),_0x2096('0x4'),_0x2096('0xc')]},'log':'getTelephones'});};};exports[_0x2096('0xd')]=function(_0xb80a90,_0x4b43bd,_0x2b118e){return client['Request']('PauseUser',{'body':{'type':_0x4b43bd,'uniqueid':_0x2b118e},'options':{'where':{'id':_0xb80a90['id']}},'log':'savePause'});};exports[_0x2096('0xe')]=function(_0x1292d2){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1292d2['id']}},'log':'savePause'});};exports[_0x2096('0xf')]=function(_0x58d0a9){return client[_0x2096('0x10')](_0x2096('0x11'),{'options':{'raw':![],'where':{'role':_0x2096('0x1'),'id':_0x58d0a9},'attributes':['id',_0x2096('0x2'),_0x2096('0x3'),_0x2096('0x4'),_0x2096('0x5'),_0x2096('0x12'),_0x2096('0x13'),_0x2096('0x6'),_0x2096('0x14'),'voicePause','interface']},'log':_0x2096('0xf')});}; \ No newline at end of file +var _0xa216=['Request','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','voicePause','mobile','getAgents','getTelephones','telephone','name','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','pauseType','../client'];(function(_0x216d9d,_0x4e9708){var _0x3fbfb6=function(_0x5e88d6){while(--_0x5e88d6){_0x216d9d['push'](_0x216d9d['shift']());}};_0x3fbfb6(++_0x4e9708);}(_0xa216,0x1e2));var _0x6a21=function(_0x320fa3,_0x1a10c5){_0x320fa3=_0x320fa3-0x0;var _0x2a0ba3=_0xa216[_0x320fa3];return _0x2a0ba3;};'use strict';var client=require(_0x6a21('0x0'));exports['getAgents']=function(){return function(){return client[_0x6a21('0x1')](_0x6a21('0x2'),{'options':{'raw':![],'where':{'role':_0x6a21('0x3')},'attributes':['id','name',_0x6a21('0x4'),_0x6a21('0x5'),_0x6a21('0x6'),_0x6a21('0x7'),_0x6a21('0x8'),'pauseType','lastPauseAt',_0x6a21('0x9'),'phone',_0x6a21('0xa'),'interface']},'log':_0x6a21('0xb')});};};exports[_0x6a21('0xc')]=function(){return function(){return client[_0x6a21('0x1')](_0x6a21('0x2'),{'options':{'raw':!![],'where':{'role':_0x6a21('0xd')},'attributes':['id',_0x6a21('0xe'),_0x6a21('0x5'),'internal']},'log':_0x6a21('0xc')});};};exports[_0x6a21('0xf')]=function(_0x47d633,_0x2877e1,_0x4c64d2){return client['Request']('PauseUser',{'body':{'type':_0x2877e1,'uniqueid':_0x4c64d2},'options':{'where':{'id':_0x47d633['id']}},'log':_0x6a21('0xf')});};exports[_0x6a21('0x10')]=function(_0xe67401){return client['Request'](_0x6a21('0x11'),{'body':{},'options':{'where':{'id':_0xe67401['id']}},'log':_0x6a21('0xf')});};exports[_0x6a21('0x12')]=function(_0x1d8202){return client[_0x6a21('0x1')](_0x6a21('0x13'),{'options':{'raw':![],'where':{'role':_0x6a21('0x3'),'id':_0x1d8202},'attributes':['id',_0x6a21('0xe'),_0x6a21('0x4'),_0x6a21('0x5'),_0x6a21('0x6'),_0x6a21('0x7'),_0x6a21('0x8'),_0x6a21('0x14'),'lastPauseAt',_0x6a21('0x9'),'interface']},'log':_0x6a21('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d611207..18576e6 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 _0x60b9=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x4a64f3,_0x116434){var _0x314fd5=function(_0xb43140){while(--_0xb43140){_0x4a64f3['push'](_0x4a64f3['shift']());}};_0x314fd5(++_0x116434);}(_0x60b9,0xa2));var _0x960b=function(_0x45f580,_0x2da15c){_0x45f580=_0x45f580-0x0;var _0x421e50=_0x60b9[_0x45f580];return _0x421e50;};'use strict';var client=require(_0x960b('0x0'));exports[_0x960b('0x1')]=function(_0x741a1){return client[_0x960b('0x2')](_0x960b('0x3'),{'body':_0x741a1,'log':_0x960b('0x3')});};exports['update']=function(_0x460cc6,_0x8cdfbb,_0xaeab64){return client[_0x960b('0x2')](_0x960b('0x4'),{'body':_0x460cc6,'options':{'where':{'uniqueid':_0x8cdfbb,'interface':_0xaeab64,'agentcomplete':!![]}},'log':_0x960b('0x4')});}; \ No newline at end of file +var _0xa882=['update','Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x2407c2,_0x376131){var _0x4ec0b4=function(_0x1e9f99){while(--_0x1e9f99){_0x2407c2['push'](_0x2407c2['shift']());}};_0x4ec0b4(++_0x376131);}(_0xa882,0x135));var _0x2a88=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa882[_0x4f9b18];return _0x29f20c;};'use strict';var client=require(_0x2a88('0x0'));exports[_0x2a88('0x1')]=function(_0x4408e7){return client['Request'](_0x2a88('0x2'),{'body':_0x4408e7,'log':'CreateVoiceAgentReport'});};exports[_0x2a88('0x3')]=function(_0x32a298,_0x124ee7,_0x30511f){return client[_0x2a88('0x4')]('UpdateVoiceAgentReport',{'body':_0x32a298,'options':{'where':{'uniqueid':_0x124ee7,'interface':_0x30511f,'agentcomplete':!![]}},'log':_0x2a88('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 8531a11..df5030a 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 _0xe518=['CreateVoiceCallReport','getVoiceCallReports','outbound','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','moment','util','lodash','../client','create','Request','calleridnum','context','callerid'];(function(_0x1ce3b3,_0x4d5856){var _0x53777f=function(_0x3b9104){while(--_0x3b9104){_0x1ce3b3['push'](_0x1ce3b3['shift']());}};_0x53777f(++_0x4d5856);}(_0xe518,0x13a));var _0x8e51=function(_0x82bada,_0x5378d3){_0x82bada=_0x82bada-0x0;var _0x37770d=_0xe518[_0x82bada];return _0x37770d;};'use strict';var moment=require(_0x8e51('0x0'));var util=require(_0x8e51('0x1'));var _=require(_0x8e51('0x2'));var client=require(_0x8e51('0x3'));exports[_0x8e51('0x4')]=function(_0x5d6542){return client[_0x8e51('0x5')]('CreateVoiceCallReport',{'body':_['merge'](_0x5d6542,{'source':_0x5d6542[_0x8e51('0x6')],'destinationcontext':_0x5d6542[_0x8e51('0x7')],'callerid':_0x5d6542[_0x8e51('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x8e51('0x9')});};exports[_0x8e51('0xa')]=function(){return function(){return client[_0x8e51('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x8e51('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x8e51('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8e51('0xd')](_0x8e51('0xc'))[_0x8e51('0xe')](_0x8e51('0xf'))]}},'attributes':[_0x8e51('0x10'),'disposition',_0x8e51('0x11'),_0x8e51('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x9f6a=['create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client'];(function(_0x235e7e,_0x5079e9){var _0x30410e=function(_0x437257){while(--_0x437257){_0x235e7e['push'](_0x235e7e['shift']());}};_0x30410e(++_0x5079e9);}(_0x9f6a,0x128));var _0xa9f6=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x9f6a[_0x223461];return _0x4dbe0a;};'use strict';var moment=require('moment');var util=require(_0xa9f6('0x0'));var _=require(_0xa9f6('0x1'));var client=require(_0xa9f6('0x2'));exports[_0xa9f6('0x3')]=function(_0x2bb530){return client[_0xa9f6('0x4')](_0xa9f6('0x5'),{'body':_[_0xa9f6('0x6')](_0x2bb530,{'source':_0x2bb530[_0xa9f6('0x7')],'destinationcontext':_0x2bb530[_0xa9f6('0x8')],'callerid':_0x2bb530[_0xa9f6('0x9')],'amaflags':_0xa9f6('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0xa9f6('0xb')]=function(){return function(){return client['Request'](_0xa9f6('0xc'),{'options':{'where':{'type':[_0xa9f6('0xd')],'createdAt':{'$between':[moment()['startOf'](_0xa9f6('0xe'))[_0xa9f6('0xf')](_0xa9f6('0x10')),moment()[_0xa9f6('0x11')](_0xa9f6('0xe'))[_0xa9f6('0xf')](_0xa9f6('0x10'))]}},'attributes':[_0xa9f6('0x12'),_0xa9f6('0x13'),_0xa9f6('0x14'),_0xa9f6('0x15')]},'log':_0xa9f6('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a12615a..3b9e015 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 _0xc949=['CreateVoiceDialReport','../client','create','Request'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc949,0x89));var _0x9c94=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xc949[_0xf71120];return _0xbe2fd3;};'use strict';var client=require(_0x9c94('0x0'));exports[_0x9c94('0x1')]=function(_0x34a1c2){return client[_0x9c94('0x2')](_0x9c94('0x3'),{'body':_0x34a1c2,'log':_0x9c94('0x3')});}; \ No newline at end of file +var _0x20ae=['create','Request'];(function(_0x3cfe49,_0x4f4b56){var _0x17c3b5=function(_0x4fe442){while(--_0x4fe442){_0x3cfe49['push'](_0x3cfe49['shift']());}};_0x17c3b5(++_0x4f4b56);}(_0x20ae,0x9e));var _0xe20a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x20ae[_0x17b6e3];return _0x3906f3;};'use strict';var client=require('../client');exports[_0xe20a('0x0')]=function(_0x4c99ca){return client[_0xe20a('0x1')]('CreateVoiceDialReport',{'body':_0x4c99ca,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f5ffe1b..22f07c0 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 _0xc931=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x29ed47,_0x423d7b){var _0x5f014d=function(_0x44954d){while(--_0x44954d){_0x29ed47['push'](_0x29ed47['shift']());}};_0x5f014d(++_0x423d7b);}(_0xc931,0x19c));var _0x1c93=function(_0x4fa616,_0x235360){_0x4fa616=_0x4fa616-0x0;var _0x5e5d79=_0xc931[_0x4fa616];return _0x5e5d79;};'use strict';var client=require(_0x1c93('0x0'));exports[_0x1c93('0x1')]=function(){return function(){return client['Request'](_0x1c93('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1c93('0x3'),_0x1c93('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1c93('0x1')});};}; \ No newline at end of file +var _0xfce5=['GetVoiceExtension','getVoiceExtensions','Request'];(function(_0x53f715,_0x52587b){var _0x16c757=function(_0x5cc9bf){while(--_0x5cc9bf){_0x53f715['push'](_0x53f715['shift']());}};_0x16c757(++_0x52587b);}(_0xfce5,0x70));var _0x5fce=function(_0x25ad66,_0x46e4dc){_0x25ad66=_0x25ad66-0x0;var _0x141bc4=_0xfce5[_0x25ad66];return _0x141bc4;};'use strict';var client=require('../client');exports[_0x5fce('0x0')]=function(){return function(){return client[_0x5fce('0x1')](_0x5fce('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x5fce('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index e8214fa..fec6d6a 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 _0x13b3=['dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout'];(function(_0x429394,_0x5cac7c){var _0x557691=function(_0x4200e4){while(--_0x4200e4){_0x429394['push'](_0x429394['shift']());}};_0x557691(++_0x5cac7c);}(_0x13b3,0xb9));var _0x313b=function(_0x38c21f,_0x5d27a5){_0x38c21f=_0x38c21f-0x0;var _0x2e1b03=_0x13b3[_0x38c21f];return _0x2e1b03;};'use strict';var client=require(_0x313b('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x313b('0x1')](_0x313b('0x2'),{'options':{'raw':![],'attributes':['id',_0x313b('0x3'),'acw',_0x313b('0x4'),'autopause',_0x313b('0x5'),_0x313b('0x6'),_0x313b('0x7'),_0x313b('0x8'),'dialLimitChannel',_0x313b('0x9'),_0x313b('0xa'),_0x313b('0xb'),_0x313b('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x313b('0xd'),_0x313b('0xe'),_0x313b('0xf'),'dialQueueTimeout',_0x313b('0x10'),_0x313b('0x11'),_0x313b('0x12'),_0x313b('0x13'),_0x313b('0x14'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x313b('0x15'),_0x313b('0x16'),_0x313b('0x17'),'dialPrefix','dialCheckDuplicateType',_0x313b('0x18'),_0x313b('0x19'),_0x313b('0x1a'),'dialAMDAfterGreetingSilence',_0x313b('0x1b'),'dialAMDMinWordLength',_0x313b('0x1c'),'dialAMDMaximumNumberOfWords',_0x313b('0x1d'),'dialAMDMaximumWordLength','timeout',_0x313b('0x1e'),'dialRecallInQueue',_0x313b('0x1f'),'dialAgiAfterHangupAgent',_0x313b('0x20'),_0x313b('0x21'),_0x313b('0x5'),_0x313b('0x22'),_0x313b('0x23'),'dialCutDigit',_0x313b('0x24'),_0x313b('0x25'),_0x313b('0x26'),'dialDropRetryFrequency',_0x313b('0x27'),_0x313b('0x28'),_0x313b('0x29'),_0x313b('0x2a'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x313b('0x2b'),_0x313b('0x2c'),_0x313b('0x2d')],'include':[{'model':'Trunk','as':_0x313b('0x2e'),'attributes':['id',_0x313b('0x3'),_0x313b('0x2f'),_0x313b('0x30')]},{'model':_0x313b('0x31'),'as':'mandatoryDispositionPause','attributes':['id',_0x313b('0x3')]},{'model':_0x313b('0x2e'),'as':'TrunkBackup','attributes':['id','name','callerid','active']},{'model':'Interval','as':_0x313b('0x32'),'attributes':['id',_0x313b('0x3')],'include':[{'model':'Interval','as':_0x313b('0x33'),'attributes':['id',_0x313b('0x3'),_0x313b('0x34')]}]}]},'log':_0x313b('0x35')});};}; \ No newline at end of file +var _0x1814=['dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','name','TrunkBackup','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient'];(function(_0x9a803a,_0x9a79fc){var _0x1bd637=function(_0x27a1b9){while(--_0x27a1b9){_0x9a803a['push'](_0x9a803a['shift']());}};_0x1bd637(++_0x9a79fc);}(_0x1814,0x109));var _0x4181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1814[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4181('0x0'));exports[_0x4181('0x1')]=function(){return function(){return client['Request'](_0x4181('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4181('0x3'),'acwTimeout',_0x4181('0x4'),_0x4181('0x5'),_0x4181('0x6'),'dialActive',_0x4181('0x7'),_0x4181('0x8'),'dialLimitQueue',_0x4181('0x9'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x4181('0xa'),_0x4181('0xb'),_0x4181('0xc'),_0x4181('0xd'),'dialQueueOptions',_0x4181('0xe'),'dialQueueProject',_0x4181('0xf'),_0x4181('0x10'),_0x4181('0x11'),_0x4181('0x12'),_0x4181('0x13'),_0x4181('0x14'),_0x4181('0x15'),_0x4181('0x16'),_0x4181('0x17'),_0x4181('0x18'),_0x4181('0x19'),_0x4181('0x1a'),_0x4181('0x1b'),_0x4181('0x1c'),_0x4181('0x1d'),_0x4181('0x1e'),_0x4181('0x1f'),_0x4181('0x20'),_0x4181('0x21'),'dialAMDSilenceThreshold',_0x4181('0x22'),_0x4181('0x23'),_0x4181('0x24'),_0x4181('0x25'),_0x4181('0x26'),'dialAgiAfterHangupAgent',_0x4181('0x27'),_0x4181('0x28'),'monitor_format',_0x4181('0x29'),_0x4181('0x2a'),_0x4181('0x2b'),_0x4181('0x2c'),'dialNoSuchNumberRetryFrequency',_0x4181('0x2d'),'dialDropRetryFrequency',_0x4181('0x2e'),_0x4181('0x2f'),_0x4181('0x30'),_0x4181('0x31'),'dialAgentRejectMaxRetry',_0x4181('0x32'),_0x4181('0x33'),_0x4181('0x34'),_0x4181('0x35')],'include':[{'model':'Trunk','as':_0x4181('0x36'),'attributes':['id','name',_0x4181('0x37'),'active']},{'model':_0x4181('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x4181('0x39')]},{'model':_0x4181('0x36'),'as':_0x4181('0x3a'),'attributes':['id',_0x4181('0x39'),_0x4181('0x37'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0x4181('0x39')],'include':[{'model':'Interval','as':_0x4181('0x3b'),'attributes':['id','name',_0x4181('0x3c')]}]}]},'log':_0x4181('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ae77ae4..f9d0131 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 _0x15f7=['moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x15f7,0xe4));var _0x715f=function(_0x58736a,_0x5d0121){_0x58736a=_0x58736a-0x0;var _0x4518e2=_0x15f7[_0x58736a];return _0x4518e2;};'use strict';var moment=require(_0x715f('0x0'));var _=require(_0x715f('0x1'));var client=require(_0x715f('0x2'));exports[_0x715f('0x3')]=function(_0x1eabfd){return client[_0x715f('0x4')]('CreateVoiceQueueReport',{'body':_0x1eabfd,'log':_0x715f('0x5')});};exports[_0x715f('0x6')]=function(){return function(){return client[_0x715f('0x4')](_0x715f('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x715f('0x8'))[_0x715f('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x715f('0x8'))[_0x715f('0x9')](_0x715f('0xa'))]}},'attributes':[_0x715f('0xb'),_0x715f('0xc'),'queuecallerjoinAt',_0x715f('0xd'),_0x715f('0xe'),'queuecallercompleteAt','queuecallerexit',_0x715f('0xf'),_0x715f('0x10'),_0x715f('0x11')]},'log':_0x715f('0x12')});};}; \ No newline at end of file +var _0xa66b=['lodash','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment'];(function(_0x1fc41f,_0xa4e0a9){var _0x32600d=function(_0x2358bf){while(--_0x2358bf){_0x1fc41f['push'](_0x1fc41f['shift']());}};_0x32600d(++_0xa4e0a9);}(_0xa66b,0x68));var _0xba66=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0xa66b[_0x28d225];return _0x1f79e1;};'use strict';var moment=require(_0xba66('0x0'));var _=require(_0xba66('0x1'));var client=require(_0xba66('0x2'));exports[_0xba66('0x3')]=function(_0x3a9c80){return client[_0xba66('0x4')](_0xba66('0x5'),{'body':_0x3a9c80,'log':_0xba66('0x5')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request'](_0xba66('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xba66('0x7')](_0xba66('0x8'))[_0xba66('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xba66('0xa')](_0xba66('0x8'))[_0xba66('0x9')](_0xba66('0xb'))]}},'attributes':['uniqueid',_0xba66('0xc'),_0xba66('0xd'),_0xba66('0xe'),_0xba66('0xf'),_0xba66('0x10'),_0xba66('0x11'),_0xba66('0x12'),_0xba66('0x13'),_0xba66('0x14')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index e394ce9..2e97ee9 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 _0x9a36=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x35c39f,_0x12076e){var _0x2f97ae=function(_0x4029c5){while(--_0x4029c5){_0x35c39f['push'](_0x35c39f['shift']());}};_0x2f97ae(++_0x12076e);}(_0x9a36,0xc2));var _0x69a3=function(_0x22a50b,_0x96421f){_0x22a50b=_0x22a50b-0x0;var _0x109ae8=_0x9a36[_0x22a50b];return _0x109ae8;};'use strict';var client=require(_0x69a3('0x0'));exports[_0x69a3('0x1')]=function(_0x564d8e){return function(){return client['Request'](_0x69a3('0x2'),{'options':{'where':{'VoiceQueueId':_0x564d8e,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xf774=['Request','../client'];(function(_0x106f05,_0x1eed65){var _0x5081f1=function(_0x5d8a8f){while(--_0x5d8a8f){_0x106f05['push'](_0x106f05['shift']());}};_0x5081f1(++_0x1eed65);}(_0xf774,0x15d));var _0x4f77=function(_0x563508,_0x54e679){_0x563508=_0x563508-0x0;var _0x25439e=_0xf774[_0x563508];return _0x25439e;};'use strict';var client=require(_0x4f77('0x0'));exports['getVoiceQueueRtPauses']=function(_0x111d08){return function(){return client[_0x4f77('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x111d08,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a937392..09ae086 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 _0x6df5=['monitorFilename','lodash','../client','create','Request','CreateVoiceRecording','merge'];(function(_0x29fef8,_0x510e39){var _0x3d891a=function(_0xb9fd42){while(--_0xb9fd42){_0x29fef8['push'](_0x29fef8['shift']());}};_0x3d891a(++_0x510e39);}(_0x6df5,0x190));var _0x56df=function(_0x74118b,_0x239694){_0x74118b=_0x74118b-0x0;var _0x257525=_0x6df5[_0x74118b];return _0x257525;};'use strict';var _=require(_0x56df('0x0'));var client=require(_0x56df('0x1'));exports[_0x56df('0x2')]=function(_0x2fc3bd){return client[_0x56df('0x3')](_0x56df('0x4'),{'body':_[_0x56df('0x5')](_0x2fc3bd,{'value':_0x2fc3bd[_0x56df('0x6')]}),'log':_0x56df('0x4')});}; \ No newline at end of file +var _0x1d13=['CreateVoiceRecording','monitorFilename','lodash'];(function(_0x21fc76,_0x5ba9a0){var _0x4a579b=function(_0x2ce02f){while(--_0x2ce02f){_0x21fc76['push'](_0x21fc76['shift']());}};_0x4a579b(++_0x5ba9a0);}(_0x1d13,0xe6));var _0x31d1=function(_0x13e914,_0x25a3c3){_0x13e914=_0x13e914-0x0;var _0x32b3be=_0x1d13[_0x13e914];return _0x32b3be;};'use strict';var _=require(_0x31d1('0x0'));var client=require('../client');exports['create']=function(_0x57082d){return client['Request'](_0x31d1('0x1'),{'body':_['merge'](_0x57082d,{'value':_0x57082d[_0x31d1('0x2')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 112e9ee..351fe2a 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 _0x4b77=['transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result'];(function(_0xae3f20,_0x1eb2c9){var _0x13d9a6=function(_0x537dbe){while(--_0x537dbe){_0xae3f20['push'](_0xae3f20['shift']());}};_0x13d9a6(++_0x1eb2c9);}(_0x4b77,0x119));var _0x74b7=function(_0x21978a,_0x578ead){_0x21978a=_0x21978a-0x0;var _0x614849=_0x4b77[_0x21978a];return _0x614849;};'use strict';var client=require(_0x74b7('0x0'));exports[_0x74b7('0x1')]={};exports[_0x74b7('0x2')]=function(_0x4ac44b){return client[_0x74b7('0x3')](_0x74b7('0x4'),{'body':{'result':_0x4ac44b[_0x74b7('0x5')],'transfererchannel':_0x4ac44b[_0x74b7('0x6')],'transferercalleridnum':_0x4ac44b[_0x74b7('0x7')],'transferercalleridname':_0x4ac44b[_0x74b7('0x8')],'transfererconnectedlinenum':_0x4ac44b[_0x74b7('0x9')],'transfererconnectedlinename':_0x4ac44b[_0x74b7('0xa')],'transfereraccountcode':_0x4ac44b[_0x74b7('0xb')],'transferercontext':_0x4ac44b[_0x74b7('0xc')],'transfererexten':_0x4ac44b[_0x74b7('0xd')],'transfererlinkedid':_0x4ac44b['transfererlinkedid'],'transfereechannel':_0x4ac44b['transfereechannel'],'transfereecalleridnum':_0x4ac44b[_0x74b7('0xe')],'transfereecalleridname':_0x4ac44b['transfereecalleridname'],'transfereeconnectedlinenum':_0x4ac44b[_0x74b7('0xf')],'transfereeconnectedlinename':_0x4ac44b[_0x74b7('0x10')],'transfereeaccountcode':_0x4ac44b[_0x74b7('0x11')],'transfereecontext':_0x4ac44b[_0x74b7('0x12')],'transfereeexten':_0x4ac44b[_0x74b7('0x13')],'transfereelinkedid':_0x4ac44b[_0x74b7('0x14')],'isexternal':_0x4ac44b[_0x74b7('0x15')],'context':_0x4ac44b['context'],'extension':_0x4ac44b[_0x74b7('0x16')],'type':_0x74b7('0x17')},'log':'CreateVoiceTransferReport'});};exports[_0x74b7('0x18')]=function(_0x12c725){return client[_0x74b7('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x12c725[_0x74b7('0x5')],'transfererchannel':_0x12c725[_0x74b7('0x19')],'transferercalleridnum':_0x12c725[_0x74b7('0x1a')],'transferercalleridname':_0x12c725['origtransferercalleridname'],'transfererconnectedlinenum':_0x12c725[_0x74b7('0x1b')],'transfererconnectedlinename':_0x12c725[_0x74b7('0x1c')],'transfereraccountcode':_0x12c725[_0x74b7('0x1d')],'transferercontext':_0x12c725[_0x74b7('0x1e')],'transfererexten':_0x12c725['secondtransfererexten'],'transfererlinkedid':_0x12c725[_0x74b7('0x1f')],'transfereechannel':_0x12c725[_0x74b7('0x20')],'transfereecalleridnum':_0x12c725['transfertargetcalleridnum'],'transfereecalleridname':_0x12c725[_0x74b7('0x21')],'transfereeconnectedlinenum':_0x12c725[_0x74b7('0x22')],'transfereeconnectedlinename':_0x12c725[_0x74b7('0x23')],'transfereeaccountcode':_0x12c725[_0x74b7('0x24')],'transfereecontext':_0x12c725['transfertargetcontext'],'transfereeexten':_0x12c725[_0x74b7('0x25')],'transfereelinkedid':_0x12c725['transfertargetlinkedid'],'isexternal':_0x12c725[_0x74b7('0x15')],'context':_0x12c725[_0x74b7('0x26')],'extension':_0x12c725[_0x74b7('0x27')],'type':_0x74b7('0x28')},'log':_0x74b7('0x4')});}; \ No newline at end of file +var _0x7191=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x10d44a,_0x4a421a){var _0x199e2b=function(_0x411637){while(--_0x411637){_0x10d44a['push'](_0x10d44a['shift']());}};_0x199e2b(++_0x4a421a);}(_0x7191,0x160));var _0x1719=function(_0x4bf885,_0x3b0f7a){_0x4bf885=_0x4bf885-0x0;var _0x462f25=_0x7191[_0x4bf885];return _0x462f25;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x1719('0x0')]=function(_0x3feeb9){return client[_0x1719('0x1')](_0x1719('0x2'),{'body':{'result':_0x3feeb9['result'],'transfererchannel':_0x3feeb9['transfererchannel'],'transferercalleridnum':_0x3feeb9[_0x1719('0x3')],'transferercalleridname':_0x3feeb9[_0x1719('0x4')],'transfererconnectedlinenum':_0x3feeb9[_0x1719('0x5')],'transfererconnectedlinename':_0x3feeb9[_0x1719('0x6')],'transfereraccountcode':_0x3feeb9[_0x1719('0x7')],'transferercontext':_0x3feeb9[_0x1719('0x8')],'transfererexten':_0x3feeb9[_0x1719('0x9')],'transfererlinkedid':_0x3feeb9[_0x1719('0xa')],'transfereechannel':_0x3feeb9[_0x1719('0xb')],'transfereecalleridnum':_0x3feeb9[_0x1719('0xc')],'transfereecalleridname':_0x3feeb9['transfereecalleridname'],'transfereeconnectedlinenum':_0x3feeb9[_0x1719('0xd')],'transfereeconnectedlinename':_0x3feeb9[_0x1719('0xe')],'transfereeaccountcode':_0x3feeb9[_0x1719('0xf')],'transfereecontext':_0x3feeb9['transfereecontext'],'transfereeexten':_0x3feeb9['transfereeexten'],'transfereelinkedid':_0x3feeb9[_0x1719('0x10')],'isexternal':_0x3feeb9[_0x1719('0x11')],'context':_0x3feeb9[_0x1719('0x12')],'extension':_0x3feeb9[_0x1719('0x13')],'type':'blind'},'log':_0x1719('0x2')});};exports[_0x1719('0x14')]=function(_0xdffad1){return client['Request'](_0x1719('0x2'),{'body':{'result':_0xdffad1[_0x1719('0x15')],'transfererchannel':_0xdffad1[_0x1719('0x16')],'transferercalleridnum':_0xdffad1[_0x1719('0x17')],'transferercalleridname':_0xdffad1[_0x1719('0x18')],'transfererconnectedlinenum':_0xdffad1[_0x1719('0x19')],'transfererconnectedlinename':_0xdffad1[_0x1719('0x1a')],'transfereraccountcode':_0xdffad1[_0x1719('0x1b')],'transferercontext':_0xdffad1['secondtransferercontext'],'transfererexten':_0xdffad1[_0x1719('0x1c')],'transfererlinkedid':_0xdffad1[_0x1719('0x1d')],'transfereechannel':_0xdffad1[_0x1719('0x1e')],'transfereecalleridnum':_0xdffad1[_0x1719('0x1f')],'transfereecalleridname':_0xdffad1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xdffad1['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xdffad1[_0x1719('0x20')],'transfereeaccountcode':_0xdffad1['transfertargetaccountcode'],'transfereecontext':_0xdffad1[_0x1719('0x21')],'transfereeexten':_0xdffad1[_0x1719('0x22')],'transfereelinkedid':_0xdffad1[_0x1719('0x23')],'isexternal':_0xdffad1['isexternal'],'context':_0xdffad1['origtransferercontext'],'extension':_0xdffad1[_0x1719('0x24')],'type':_0x1719('0x25')},'log':_0x1719('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index cc4f699..7e890ea 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 _0x5f55=['127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','../../../config/environment','../ami','listen','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','validate','find','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','then','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','rec','mixmonitorid','MixMonitor\x20Success','resolve','destinationchannel','StopMixMonitor','stop','%s.%s','status','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','map','Channel\x20doesn\x27t\x20exist','Hangup','voicequeuechannelredirect','context','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','send','checkAfterSend','server'];(function(_0x56a621,_0x3d2308){var _0x514d7a=function(_0x5df093){while(--_0x5df093){_0x56a621['push'](_0x56a621['shift']());}};_0x514d7a(++_0x3d2308);}(_0x5f55,0x10f));var _0x55f5=function(_0x18ec3f,_0x7c819e){_0x18ec3f=_0x18ec3f-0x0;var _0x2dbfec=_0x5f55[_0x18ec3f];return _0x2dbfec;};'use strict';var _=require(_0x55f5('0x0'));var util=require(_0x55f5('0x1'));var jayson=require(_0x55f5('0x2'));var schema=require('validate');var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x55f5('0x3'));var properties=require('../properties');var ami=require(_0x55f5('0x4'));exports[_0x55f5('0x5')]=function(_0xfee881,_0x1f0b13,_0x5122a5){return new BPromise(function(_0x22d94b,_0x407aec){var _0x24d392={'QueuePause':function(_0x33d931){return new Promise(function(_0xe3a5cf,_0x110812){var _0x5254a8=util[_0x55f5('0x6')]('%s/%s','SIP',_0x33d931[_0x55f5('0x7')]);if(_0xfee881[_0x55f5('0x8')]&&_0xfee881['timers'][_0x5254a8]&&_0xfee881[_0x55f5('0x8')][_0x5254a8][_0x55f5('0x9')]){_0xfee881[_0x55f5('0x8')][_0x5254a8][_0x55f5('0xa')]();}if(_0xfee881['agents'][_0x5254a8]){_0xfee881[_0x55f5('0xb')][_0x5254a8][_0x55f5('0xc')]({'statePause':_0x33d931['pause']?!![]:![]});}_0xe3a5cf({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3ed31f){var _0x2c8533=this;return new Promise(function(_0x34d897,_0x4a1c43){if(ami[_0x55f5('0xd')]()==![]){return _0x4a1c43(_0x2c8533['error'](0x1f4,[config[_0x55f5('0xe')]['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}_0x3ed31f=_[_0x55f5('0x12')](_0x3ed31f,_[_0x55f5('0x13')](properties[_0x55f5('0x14')]));_0x3ed31f[_0x55f5('0x15')]=_0x55f5('0x16');return ami[_0x55f5('0x17')](_0x3ed31f)['then'](function(_0x2f34a9){_0x34d897({'code':0xc8,'message':_0x2f34a9[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x565de1){_0x4a1c43(_0x2c8533[_0x55f5('0x1a')](0x1f5,_0x565de1['message']));});});},'Command':function(_0xbfe019){var _0x3bf6a8=this;return new Promise(function(_0x41319e,_0x468896){if(ami[_0x55f5('0xd')]()==![]){return _0x468896(_0x3bf6a8[_0x55f5('0x1a')](0x1f4,[config[_0x55f5('0xe')]['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}_0xbfe019=_['pick'](_0xbfe019,_0x55f5('0x1b'));_0xbfe019[_0x55f5('0x15')]=_0x55f5('0x1c');return ami['Action'](_0xbfe019)['then'](function(_0x161fec){_0x41319e({'code':0xc8,'message':_0x161fec[_0x55f5('0x1d')]});})[_0x55f5('0x19')](function(_0x47c1ba){_0x468896(_0x3bf6a8[_0x55f5('0x1a')](0x1f5,_0x47c1ba[_0x55f5('0x18')]));});});},'VoiceQueues':function(_0x4f97ff){return new Promise(function(_0x8a671d,_0x233e8a){var _0x115577=[];for(var _0x514878 in _0xfee881[_0x55f5('0x1e')]){if(_0xfee881[_0x55f5('0x1e')][_0x55f5('0x1f')](_0x514878)){var _0x3cc1a3=_0xfee881['voiceQueues'][_0x514878];var _0x49ca85={'id':_0x3cc1a3['id'],'name':_0x3cc1a3[_0x55f5('0x7')],'strategy':_0x3cc1a3['strategy'],'answered':_0x3cc1a3[_0x55f5('0x20')],'available':_0x3cc1a3['available'],'loggedIn':_0x3cc1a3[_0x55f5('0x21')],'pTalking':_0x3cc1a3[_0x55f5('0x22')],'sumBillable':_0x3cc1a3[_0x55f5('0x23')],'sumDuration':_0x3cc1a3[_0x55f5('0x24')],'sumHoldTime':_0x3cc1a3[_0x55f5('0x25')]||0x0,'talking':_0x3cc1a3['talking'],'total':_0x3cc1a3[_0x55f5('0x26')],'type':_0x3cc1a3[_0x55f5('0x27')],'unmanaged':_0x3cc1a3[_0x55f5('0x28')],'abandoned':_0x3cc1a3[_0x55f5('0x29')],'waiting':_0x3cc1a3[_0x55f5('0x2a')],'loggedInDb':_0x3cc1a3['loggedInDb']};if(_0x3cc1a3[_0x55f5('0x27')]==='outbound'){_0x49ca85[_0x55f5('0x2b')]=_0x3cc1a3[_0x55f5('0x2b')];_0x49ca85[_0x55f5('0x2c')]=_0x3cc1a3[_0x55f5('0x2c')];_0x49ca85[_0x55f5('0x2d')]=_0x3cc1a3[_0x55f5('0x2d')];_0x49ca85[_0x55f5('0x2e')]=_0x3cc1a3[_0x55f5('0x2e')];_0x49ca85[_0x55f5('0x2f')]=_0x3cc1a3[_0x55f5('0x2f')];_0x49ca85[_0x55f5('0x30')]=_0x3cc1a3[_0x55f5('0x30')];_0x49ca85[_0x55f5('0x31')]=_0x3cc1a3['outboundAnswerAgiCallsDay'];_0x49ca85[_0x55f5('0x32')]=_0x3cc1a3[_0x55f5('0x32')];_0x49ca85[_0x55f5('0x33')]=_0x3cc1a3[_0x55f5('0x33')];_0x49ca85[_0x55f5('0x34')]=_0x3cc1a3[_0x55f5('0x34')];_0x49ca85[_0x55f5('0x35')]=_0x3cc1a3[_0x55f5('0x35')];_0x49ca85[_0x55f5('0x36')]=_0x3cc1a3[_0x55f5('0x36')];_0x49ca85[_0x55f5('0x37')]=_0x3cc1a3[_0x55f5('0x37')];_0x49ca85['outboundDropCallsDayTimeout']=_0x3cc1a3[_0x55f5('0x38')];_0x49ca85['outboundNoAnswerCallsDay']=_0x3cc1a3[_0x55f5('0x39')];_0x49ca85['outboundNoSuchCallsDay']=_0x3cc1a3[_0x55f5('0x3a')];_0x49ca85[_0x55f5('0x3b')]=_0x3cc1a3['outboundOriginateFailureCallsDay'];_0x49ca85[_0x55f5('0x3c')]=_0x3cc1a3[_0x55f5('0x3c')];_0x49ca85[_0x55f5('0x3d')]=_0x3cc1a3['outboundRejectCallsDay'];_0x49ca85[_0x55f5('0x3e')]=_0x3cc1a3[_0x55f5('0x3e')];_0x49ca85['predictiveIntervalAnsweredCalls']=_0x3cc1a3['predictiveIntervalAnsweredCalls'];_0x49ca85[_0x55f5('0x3f')]=_0x3cc1a3[_0x55f5('0x3f')];_0x49ca85[_0x55f5('0x40')]=_0x3cc1a3[_0x55f5('0x40')];_0x49ca85['predictiveIntervalDroppedCallsCallersExit']=_0x3cc1a3[_0x55f5('0x41')];_0x49ca85[_0x55f5('0x42')]=_0x3cc1a3[_0x55f5('0x42')];_0x49ca85[_0x55f5('0x43')]=_0x3cc1a3[_0x55f5('0x43')];_0x49ca85[_0x55f5('0x44')]=_0x3cc1a3[_0x55f5('0x44')];_0x49ca85[_0x55f5('0x45')]=_0x3cc1a3[_0x55f5('0x45')];_0x49ca85[_0x55f5('0x46')]=_0x3cc1a3['predictiveIntervalMultiplicativeFactor'];_0x49ca85[_0x55f5('0x47')]=_0x3cc1a3[_0x55f5('0x47')];_0x49ca85[_0x55f5('0x48')]=_0x3cc1a3['predictiveIntervalAvailable'];_0x49ca85[_0x55f5('0x49')]=_0x3cc1a3[_0x55f5('0x49')];_0x49ca85[_0x55f5('0x18')]=_0x3cc1a3[_0x55f5('0x18')];_0x49ca85[_0x55f5('0x4a')]=_0x3cc1a3[_0x55f5('0x4a')];_0x49ca85[_0x55f5('0x4b')]=_0x3cc1a3['erlangCalls'];_0x49ca85['erlangCallToSecond']=_0x3cc1a3[_0x55f5('0x4c')];_0x49ca85[_0x55f5('0x4d')]=_0x3cc1a3[_0x55f5('0x4d')];_0x49ca85[_0x55f5('0x4e')]=_0x3cc1a3[_0x55f5('0x4e')];_0x49ca85[_0x55f5('0x4f')]=_0x3cc1a3['startPredictive'];_0x49ca85[_0x55f5('0x50')]=_0x3cc1a3[_0x55f5('0x50')];}if(_0x3cc1a3[_0x55f5('0x51')]){_0x49ca85[_0x55f5('0x51')]={'id':_0x3cc1a3[_0x55f5('0x51')]['id'],'name':_0x3cc1a3[_0x55f5('0x51')][_0x55f5('0x7')],'active':_0x3cc1a3['Trunk'][_0x55f5('0x52')],'callerid':_0x3cc1a3['Trunk'][_0x55f5('0x53')]};}if(_0x3cc1a3[_0x55f5('0x54')]){_0x49ca85[_0x55f5('0x54')]={'id':_0x3cc1a3[_0x55f5('0x54')]['id'],'name':_0x3cc1a3['Interval'][_0x55f5('0x7')]};}_0x115577[_0x55f5('0x55')](_0x49ca85);}}_0x8a671d({'count':_0x115577[_0x55f5('0x56')],'rows':_0x115577});});},'VoiceChannels':function(_0x5a3a55){return new Promise(function(_0x2275a5,_0x15834c){var _0x5288ee=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x58')]);_0x2275a5({'count':_0x5288ee[_0x55f5('0x56')],'rows':_0x5288ee});});},'VoiceChannelMixMonitor':function(_0x493829){var _0x1bf58b=this;return new Promise(function(_0x31c0d5,_0x353519){if(ami['isConnected']()==![]){return _0x353519(_0x1bf58b[_0x55f5('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],'ami\x20disconnected'][_0x55f5('0x11')]('\x20')));}var _0xc467ed=schema(properties[_0x55f5('0x59')])[_0x55f5('0x5a')](_0x493829);if(_0xc467ed[_0x55f5('0x56')]>0x0){return _0x353519(_0x1bf58b['error'](0x1f4,_['map'](_0xc467ed,_0x55f5('0x18'))[_0x55f5('0x11')](',\x20')));}var _0x351451=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x58')],{'uniqueid':_0x493829[_0x55f5('0x5c')]});if(_0x351451&&_0x351451[_0x55f5('0x5d')]){var _0x518c46=util[_0x55f5('0x6')]('%s.%s',_0x493829[_0x55f5('0x5e')]||_0x493829[_0x55f5('0x5c')],_0x493829[_0x55f5('0x6')]||_0x55f5('0x5f'));return ami[_0x55f5('0x17')]({'action':_0x55f5('0x60'),'channel':_0x351451[_0x55f5('0x5d')],'file':_0x518c46,'options':_0x55f5('0x61')})[_0x55f5('0x62')](function(_0x3ed9bd){var _0xc5afb3=_[_0x55f5('0x5b')](_0x351451['monitors'],{'filename':_0x55f5('0x63')+_0x518c46[_0x55f5('0x64')]()});if(_[_0x55f5('0x65')](_0xc5afb3)){_0x351451[_0x55f5('0x66')]['push']({'filename':_0x55f5('0x63')+_0x518c46['toLowerCase'](),'createdAt':moment()[_0x55f5('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3ed9bd['mixmonitorid'],'status':_0x55f5('0x67')});}else{_0xc5afb3[_0x55f5('0x68')]=_0x3ed9bd[_0x55f5('0x68')];_0xc5afb3['status']=_0x55f5('0x67');}_0x31c0d5({'code':0xc8,'message':[_0x493829[_0x55f5('0x5c')],_0x55f5('0x69'),_0x3ed9bd[_0x55f5('0x68')]][_0x55f5('0x11')]('\x20'),'mixmonitorid':_0x3ed9bd[_0x55f5('0x68')]});})['catch'](function(_0x4c2fa1){_0x353519(_0x1bf58b[_0x55f5('0x1a')](0x1f5,[_0x493829[_0x55f5('0x5c')],_0x4c2fa1['message']['toLowerCase']()][_0x55f5('0x11')]('\x20')));});}else{return _0x353519(_0x1bf58b[_0x55f5('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x24c2af){var _0xf690ae=this;return new Promise(function(_0x929e7b,_0x46bda2){if(ami['isConnected']()==![]){return _0x46bda2(_0xf690ae[_0x55f5('0x1a')](0x1f4,[config[_0x55f5('0xe')]['ip'],config['asterisk'][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}var _0x382909=schema(properties[_0x55f5('0x59')])[_0x55f5('0x5a')](_0x24c2af);if(_0x382909[_0x55f5('0x56')]>0x0){return _0x46bda2(_0xf690ae['error'](0x1f4,_['map'](_0x382909,'message')[_0x55f5('0x11')](',\x20')));}var _0x19d9b9=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x58')],{'uniqueid':_0x24c2af[_0x55f5('0x5c')]});if(_0x19d9b9){return BPromise[_0x55f5('0x6a')]()[_0x55f5('0x62')](function(){if(_0x19d9b9['channel']){return ami[_0x55f5('0x17')]({'action':'StopMixMonitor','channel':_0x19d9b9[_0x55f5('0x5d')],'mixmonitorid':_0x24c2af[_0x55f5('0x68')]})['catch'](function(_0x4ab2c6){});}})[_0x55f5('0x62')](function(){if(_0x19d9b9[_0x55f5('0x6b')]){return ami[_0x55f5('0x17')]({'action':_0x55f5('0x6c'),'channel':_0x19d9b9[_0x55f5('0x6b')],'mixmonitorid':_0x24c2af[_0x55f5('0x68')]})[_0x55f5('0x19')](function(_0x36f18b){});}})[_0x55f5('0x62')](function(_0x24b11c){var _0x40e8ce=_[_0x55f5('0x5b')](_0x19d9b9[_0x55f5('0x66')],{'mixmonitorid':_0x24c2af[_0x55f5('0x68')]});if(_0x40e8ce){_0x40e8ce['status']=_0x55f5('0x6d');}})[_0x55f5('0x62')](function(){var _0x690a8=util[_0x55f5('0x6')](_0x55f5('0x6e'),_0x24c2af[_0x55f5('0x5e')]||_0x24c2af['uniqueid'],_0x24c2af['format']||_0x55f5('0x5f'));var _0x2804c4=_[_0x55f5('0x5b')](_0x19d9b9[_0x55f5('0x66')],{'filename':_0x55f5('0x63')+_0x690a8[_0x55f5('0x64')]()});if(_0x2804c4){_0x2804c4[_0x55f5('0x6f')]=_0x55f5('0x6d');}})[_0x55f5('0x62')](function(){_0x929e7b({'code':0xc8,'message':[_0x24c2af['uniqueid'],_0x55f5('0x70')]['join']('\x20')});})[_0x55f5('0x19')](function(_0x4c7f0f){_0x46bda2(_0xf690ae[_0x55f5('0x1a')](0x1f5,[_0x24c2af[_0x55f5('0x5c')],_0x4c7f0f['message'][_0x55f5('0x64')]()][_0x55f5('0x11')]('\x20')));});}else{return _0x46bda2(_0xf690ae[_0x55f5('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x423436){return new Promise(function(_0x50bb20,_0x517bf7){var _0x10d292=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x71')]);_0x50bb20({'count':_0x10d292[_0x55f5('0x56')],'rows':_0x10d292});});},'VoiceQueuesChannel':function(_0x4d2f54){var _0x11cdb0=this;return new Promise(function(_0x480610,_0x2fe2cb){var _0x18147a=schema(properties[_0x55f5('0x72')])[_0x55f5('0x5a')](_0x4d2f54);if(_0x18147a['length']>0x0){return _0x2fe2cb(_0x11cdb0[_0x55f5('0x1a')](0x1f4,_[_0x55f5('0x73')](_0x18147a,'message')[_0x55f5('0x11')](',\x20')));}var _0x175a49=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x71')],{'uniqueid':_0x4d2f54[_0x55f5('0x5c')]});if(_0x175a49){_0x480610(_0x175a49);}else{return _0x2fe2cb(_0x11cdb0['error'](0x1f5,_0x55f5('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x4f976c){var _0x2925fc=this;return new Promise(function(_0xccee24,_0x5731c0){if(ami[_0x55f5('0xd')]()==![]){return _0x5731c0(_0x2925fc['error'](0x1f4,[config[_0x55f5('0xe')]['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}var _0x52bec6=schema(properties['voicequeuechannelhangup'])['validate'](_0x4f976c);if(_0x52bec6[_0x55f5('0x56')]>0x0){return _0x5731c0(_0x2925fc[_0x55f5('0x1a')](0x1f4,_[_0x55f5('0x73')](_0x52bec6,_0x55f5('0x18'))[_0x55f5('0x11')](',\x20')));}var _0x40d405=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x71')],{'uniqueid':_0x4f976c[_0x55f5('0x5c')]});if(_0x40d405&&_0x40d405['channel']){return ami[_0x55f5('0x17')]({'action':_0x55f5('0x75'),'channel':_0x40d405[_0x55f5('0x5d')]})[_0x55f5('0x62')](function(_0x51c47e){_0xccee24({'code':0xc8,'message':[_0x4f976c[_0x55f5('0x5c')],_0x51c47e[_0x55f5('0x18')][_0x55f5('0x64')]()]['join']('\x20')});})[_0x55f5('0x19')](function(_0x41e431){_0x5731c0(_0x2925fc['error'](0x1f5,[_0x4f976c['uniqueid'],_0x41e431[_0x55f5('0x18')]['toLowerCase']()][_0x55f5('0x11')]('\x20')));});}else{return _0x5731c0(_0x2925fc[_0x55f5('0x1a')](0x1f5,_0x55f5('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x15a5b1){var _0x53e215=this;return new Promise(function(_0x517583,_0x48224a){if(ami[_0x55f5('0xd')]()==![]){return _0x48224a(_0x53e215[_0x55f5('0x1a')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}var _0x42307c=schema(properties[_0x55f5('0x76')])['validate'](_0x15a5b1);if(_0x42307c['length']>0x0){return _0x48224a(_0x53e215[_0x55f5('0x1a')](0x1f4,_[_0x55f5('0x73')](_0x42307c,_0x55f5('0x18'))[_0x55f5('0x11')](',\x20')));}var _0x579f9f=_['find'](_0xfee881['queueChannels'],{'uniqueid':_0x15a5b1[_0x55f5('0x5c')]});if(_0x579f9f&&_0x579f9f['channel']){return ami[_0x55f5('0x17')]({'action':'Redirect','channel':_0x579f9f[_0x55f5('0x5d')],'exten':_0x15a5b1['exten'],'context':_0x15a5b1['context']||_0x579f9f[_0x55f5('0x77')],'priority':0x1})[_0x55f5('0x62')](function(_0x219a49){_0x517583({'code':0xc8,'message':[_0x15a5b1[_0x55f5('0x5c')],_0x219a49[_0x55f5('0x18')][_0x55f5('0x64')]()][_0x55f5('0x11')]('\x20')});})['catch'](function(_0x56c8a1){_0x48224a(_0x53e215[_0x55f5('0x1a')](0x1f5,[_0x15a5b1['uniqueid'],_0x56c8a1[_0x55f5('0x18')][_0x55f5('0x64')]()]['join']('\x20')));});}else{return _0x48224a(_0x53e215['error'](0x1f5,_0x55f5('0x74')));}});},'Agents':function(_0x3fc6f8){return new Promise(function(_0x6c22a5,_0x3a5a17){var _0x22f0e6=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0xb')]);_0x6c22a5({'count':_0x22f0e6['length'],'rows':_0x22f0e6});});},'Telephones':function(_0x56b4bc){return new Promise(function(_0x233b28,_0x120032){var _0xbcec8e=_['values'](_0xfee881['telephones']);_0x233b28({'count':_0xbcec8e[_0x55f5('0x56')],'rows':_0xbcec8e});});},'Trunks':function(_0x58165b){return new Promise(function(_0x1812b8,_0x3a7b27){var _0x14c1d7=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x78')]);_0x1812b8({'count':_0x14c1d7['length'],'rows':_0x14c1d7});});},'OutboundChannels':function(_0x4b1ff9){return new Promise(function(_0x17752c,_0xbb52ac){var _0xeb9fea=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x79')]);_0x17752c({'count':_0xeb9fea[_0x55f5('0x56')],'rows':_0xeb9fea});});},'Outbound':function(_0x5d7183){return new Promise(function(_0x38f38c,_0x264c30){_0x38f38c(_0xfee881['outbound']);});},'Campaigns':function(_0x185b81){return new Promise(function(_0x1d4abe,_0xad542d){var _0x482ea1=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x7a')]);_0x1d4abe({'count':_0x482ea1['length'],'rows':_0x482ea1});});},'VoiceQueuesPreview':function(_0x309d3f){var _0x5454bb=this;return new Promise(function(_0x43a674,_0x5e945b){_0x1f0b13[_0x55f5('0x7b')](_0x309d3f['id'])[_0x55f5('0x62')](function(_0x3575c7){_0x43a674({'code':0xc8,'message':_0x3575c7[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x3e8979){_0x5e945b(_0x5454bb[_0x55f5('0x1a')](0x1f4,_0x3e8979[_0x55f5('0x18')]));});});},'EventManager':function(_0xe8ac31){var _0x2e8636=this;return new Promise(function(_0xf4b9d3,_0x2b301b){if(!_0xe8ac31['event']){return _0x2b301b(_0x2e8636[_0x55f5('0x1a')](0x1f4,_0x55f5('0x7c')));}ami[_0x55f5('0x7d')](_0x55f5('0x7e')+_0xe8ac31[_0x55f5('0x7f')],_0xe8ac31[_0x55f5('0x18')]);_0xf4b9d3({'code':0xc8,'message':_0xe8ac31});});},'FaxAccounts':function(_0x5ab95b){return new Promise(function(_0x5e86d1,_0x3a7d09){var _0x4bbd7d=_[_0x55f5('0x57')](_0xfee881['faxAccounts']);_0x5e86d1({'count':_0x4bbd7d[_0x55f5('0x56')],'rows':_0x4bbd7d});});},'SendFax':function(_0xe1dc33){var _0xc9ea5c=this;return new Promise(function(_0x38f7c6,_0x381dcc){_0x5122a5[_0x55f5('0x80')](_0xe1dc33)[_0x55f5('0x62')](function(_0x159dc0){_0x38f7c6({'code':0xc8,'message':_0x159dc0[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x361220){_0x381dcc(_0xc9ea5c[_0x55f5('0x1a')](0x1f4,_0x361220[_0x55f5('0x18')]));});});},'CheckAfterSend':function(_0x2d4bbf){var _0x51ea97=this;return new Promise(function(_0x3c3487,_0x50afb1){_0x5122a5[_0x55f5('0x81')](_0x2d4bbf)['then'](function(_0xd60f0f){_0x3c3487({'code':0xc8,'message':_0xd60f0f[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x4a157d){_0x50afb1(_0x51ea97['error'](0x1f4,_0x4a157d['message']));});});}};var _0x2e5891=jayson[_0x55f5('0x82')](_0x24d392)['http']();_0x2e5891['on'](_0x55f5('0x1a'),function(_0x1664a1){return _0x407aec(_0x1664a1);});_0x2e5891[_0x55f5('0x5')](0x232a,_0x55f5('0x83'),function(){console[_0x55f5('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x22d94b(_0x55f5('0x85')+0x232a);});});}; \ No newline at end of file +var _0x3a75=['pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','values','channels','username','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','then','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','wav','stop','StopMixMonitor\x20Success','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','module','action','Reload','message','catch','error','pick','command','Command','Action','voiceQueues','hasOwnProperty','available','loggedIn'];(function(_0xf89d02,_0x5197c9){var _0x2bf516=function(_0x33e0a6){while(--_0x33e0a6){_0xf89d02['push'](_0xf89d02['shift']());}};_0x2bf516(++_0x5197c9);}(_0x3a75,0x66));var _0x53a7=function(_0x3b65a4,_0xfb86df){_0x3b65a4=_0x3b65a4-0x0;var _0x589cec=_0x3a75[_0x3b65a4];return _0x589cec;};'use strict';var _=require(_0x53a7('0x0'));var util=require(_0x53a7('0x1'));var jayson=require('jayson/promise');var schema=require(_0x53a7('0x2'));var BPromise=require(_0x53a7('0x3'));var moment=require(_0x53a7('0x4'));var config=require(_0x53a7('0x5'));var properties=require(_0x53a7('0x6'));var ami=require(_0x53a7('0x7'));exports[_0x53a7('0x8')]=function(_0x9d9eb8,_0x3a13e6,_0x577f37){return new BPromise(function(_0x3b1ac2,_0x71b464){var _0x1ccfc0={'QueuePause':function(_0x18b68e){return new Promise(function(_0xd007c2,_0x2302c4){var _0x4f8938=util[_0x53a7('0x9')](_0x53a7('0xa'),'SIP',_0x18b68e[_0x53a7('0xb')]);if(_0x9d9eb8[_0x53a7('0xc')]&&_0x9d9eb8['timers'][_0x4f8938]&&_0x9d9eb8[_0x53a7('0xc')][_0x4f8938][_0x53a7('0xd')]){_0x9d9eb8[_0x53a7('0xc')][_0x4f8938][_0x53a7('0xe')]();}if(_0x9d9eb8[_0x53a7('0xf')][_0x4f8938]){_0x9d9eb8[_0x53a7('0xf')][_0x4f8938][_0x53a7('0x10')]({'statePause':_0x18b68e[_0x53a7('0x11')]?!![]:![]});}_0xd007c2({'code':0xc8,'message':_0x53a7('0x12')});});},'Reload':function(_0x522161){var _0x53d63a=this;return new Promise(function(_0x518178,_0x4bfa82){if(ami[_0x53a7('0x13')]()==![]){return _0x4bfa82(_0x53d63a['error'](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')]['username'],_0x53a7('0x15')][_0x53a7('0x16')]('\x20')));}_0x522161=_['pick'](_0x522161,_['keys'](properties[_0x53a7('0x17')]));_0x522161[_0x53a7('0x18')]=_0x53a7('0x19');return ami['Action'](_0x522161)['then'](function(_0x536725){_0x518178({'code':0xc8,'message':_0x536725[_0x53a7('0x1a')]});})[_0x53a7('0x1b')](function(_0xd03ca2){_0x4bfa82(_0x53d63a[_0x53a7('0x1c')](0x1f5,_0xd03ca2[_0x53a7('0x1a')]));});});},'Command':function(_0x41dc8b){var _0x5cd317=this;return new Promise(function(_0x515d65,_0x36a00b){if(ami[_0x53a7('0x13')]()==![]){return _0x36a00b(_0x5cd317[_0x53a7('0x1c')](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x41dc8b=_[_0x53a7('0x1d')](_0x41dc8b,_0x53a7('0x1e'));_0x41dc8b['action']=_0x53a7('0x1f');return ami[_0x53a7('0x20')](_0x41dc8b)['then'](function(_0xacf7e9){_0x515d65({'code':0xc8,'message':_0xacf7e9['content']});})['catch'](function(_0x4eba26){_0x36a00b(_0x5cd317[_0x53a7('0x1c')](0x1f5,_0x4eba26[_0x53a7('0x1a')]));});});},'VoiceQueues':function(_0x5997d7){return new Promise(function(_0x2e42cc,_0x508eb3){var _0x4802f2=[];for(var _0x1ce1b9 in _0x9d9eb8['voiceQueues']){if(_0x9d9eb8[_0x53a7('0x21')][_0x53a7('0x22')](_0x1ce1b9)){var _0x2673e4=_0x9d9eb8[_0x53a7('0x21')][_0x1ce1b9];var _0x47dfd1={'id':_0x2673e4['id'],'name':_0x2673e4[_0x53a7('0xb')],'strategy':_0x2673e4['strategy'],'answered':_0x2673e4['answered'],'available':_0x2673e4[_0x53a7('0x23')],'loggedIn':_0x2673e4[_0x53a7('0x24')],'pTalking':_0x2673e4[_0x53a7('0x25')],'sumBillable':_0x2673e4[_0x53a7('0x26')],'sumDuration':_0x2673e4[_0x53a7('0x27')],'sumHoldTime':_0x2673e4[_0x53a7('0x28')]||0x0,'talking':_0x2673e4[_0x53a7('0x29')],'total':_0x2673e4[_0x53a7('0x2a')],'type':_0x2673e4[_0x53a7('0x2b')],'unmanaged':_0x2673e4['unmanaged'],'abandoned':_0x2673e4[_0x53a7('0x2c')],'waiting':_0x2673e4[_0x53a7('0x2d')],'loggedInDb':_0x2673e4[_0x53a7('0x2e')]};if(_0x2673e4[_0x53a7('0x2b')]===_0x53a7('0x2f')){_0x47dfd1['dialActive']=_0x2673e4[_0x53a7('0x30')];_0x47dfd1['dialMethod']=_0x2673e4[_0x53a7('0x31')];_0x47dfd1[_0x53a7('0x32')]=_0x2673e4['dialOriginateCallerIdName'];_0x47dfd1[_0x53a7('0x33')]=_0x2673e4[_0x53a7('0x33')];_0x47dfd1[_0x53a7('0x34')]=_0x2673e4[_0x53a7('0x34')];_0x47dfd1[_0x53a7('0x35')]=_0x2673e4[_0x53a7('0x35')];_0x47dfd1['outboundAnswerAgiCallsDay']=_0x2673e4[_0x53a7('0x36')];_0x47dfd1[_0x53a7('0x37')]=_0x2673e4[_0x53a7('0x37')];_0x47dfd1[_0x53a7('0x38')]=_0x2673e4[_0x53a7('0x38')];_0x47dfd1[_0x53a7('0x39')]=_0x2673e4['outboundBusyCallsDay'];_0x47dfd1[_0x53a7('0x3a')]=_0x2673e4['outboundCongestionCallsDay'];_0x47dfd1[_0x53a7('0x3b')]=_0x2673e4['outboundDropCallsDayACS'];_0x47dfd1[_0x53a7('0x3c')]=_0x2673e4['outboundDropCallsDayCallersExit'];_0x47dfd1['outboundDropCallsDayTimeout']=_0x2673e4['outboundDropCallsDayTimeout'];_0x47dfd1['outboundNoAnswerCallsDay']=_0x2673e4[_0x53a7('0x3d')];_0x47dfd1[_0x53a7('0x3e')]=_0x2673e4[_0x53a7('0x3e')];_0x47dfd1[_0x53a7('0x3f')]=_0x2673e4[_0x53a7('0x3f')];_0x47dfd1['outboundReCallsDay']=_0x2673e4[_0x53a7('0x40')];_0x47dfd1[_0x53a7('0x41')]=_0x2673e4[_0x53a7('0x41')];_0x47dfd1[_0x53a7('0x42')]=_0x2673e4[_0x53a7('0x42')];_0x47dfd1['predictiveIntervalAnsweredCalls']=_0x2673e4[_0x53a7('0x43')];_0x47dfd1[_0x53a7('0x44')]=_0x2673e4[_0x53a7('0x44')];_0x47dfd1[_0x53a7('0x45')]=_0x2673e4[_0x53a7('0x45')];_0x47dfd1[_0x53a7('0x46')]=_0x2673e4['predictiveIntervalDroppedCallsCallersExit'];_0x47dfd1[_0x53a7('0x47')]=_0x2673e4[_0x53a7('0x47')];_0x47dfd1[_0x53a7('0x48')]=_0x2673e4[_0x53a7('0x48')];_0x47dfd1['predictiveIntervalErlangCallsDroppedCalls']=_0x2673e4[_0x53a7('0x49')];_0x47dfd1['predictiveIntervalHitRate']=_0x2673e4['predictiveIntervalHitRate'];_0x47dfd1[_0x53a7('0x4a')]=_0x2673e4[_0x53a7('0x4a')];_0x47dfd1[_0x53a7('0x4b')]=_0x2673e4[_0x53a7('0x4b')];_0x47dfd1[_0x53a7('0x4c')]=_0x2673e4['predictiveIntervalAvailable'];_0x47dfd1[_0x53a7('0x4d')]=_0x2673e4[_0x53a7('0x4d')];_0x47dfd1[_0x53a7('0x1a')]=_0x2673e4[_0x53a7('0x1a')];_0x47dfd1['originated']=_0x2673e4[_0x53a7('0x4e')];_0x47dfd1[_0x53a7('0x4f')]=_0x2673e4[_0x53a7('0x4f')];_0x47dfd1[_0x53a7('0x50')]=_0x2673e4[_0x53a7('0x50')];_0x47dfd1[_0x53a7('0x51')]=_0x2673e4['erlangAbandonmentRate'];_0x47dfd1['erlangBusyFactor']=_0x2673e4['erlangBusyFactor'];_0x47dfd1[_0x53a7('0x52')]=_0x2673e4['startPredictive'];_0x47dfd1['startProgressive']=_0x2673e4[_0x53a7('0x53')];}if(_0x2673e4[_0x53a7('0x54')]){_0x47dfd1['Trunk']={'id':_0x2673e4[_0x53a7('0x54')]['id'],'name':_0x2673e4[_0x53a7('0x54')][_0x53a7('0xb')],'active':_0x2673e4[_0x53a7('0x54')]['active'],'callerid':_0x2673e4[_0x53a7('0x54')][_0x53a7('0x55')]};}if(_0x2673e4['Interval']){_0x47dfd1['Interval']={'id':_0x2673e4[_0x53a7('0x56')]['id'],'name':_0x2673e4[_0x53a7('0x56')][_0x53a7('0xb')]};}_0x4802f2[_0x53a7('0x57')](_0x47dfd1);}}_0x2e42cc({'count':_0x4802f2[_0x53a7('0x58')],'rows':_0x4802f2});});},'VoiceChannels':function(_0x5a5634){return new Promise(function(_0x23f1e9,_0x285a8c){var _0x13c148=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x5a')]);_0x23f1e9({'count':_0x13c148[_0x53a7('0x58')],'rows':_0x13c148});});},'VoiceChannelMixMonitor':function(_0x542f1e){var _0x3af95a=this;return new Promise(function(_0x2d43f7,_0x4e71c2){if(ami[_0x53a7('0x13')]()==![]){return _0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')][_0x53a7('0x5b')],_0x53a7('0x15')]['join']('\x20')));}var _0x4757da=schema(properties['voicechannel'])[_0x53a7('0x2')](_0x542f1e);if(_0x4757da[_0x53a7('0x58')]>0x0){return _0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f4,_['map'](_0x4757da,'message')[_0x53a7('0x16')](',\x20')));}var _0x408d05=_['find'](_0x9d9eb8[_0x53a7('0x5a')],{'uniqueid':_0x542f1e[_0x53a7('0x5c')]});if(_0x408d05&&_0x408d05[_0x53a7('0x5d')]){var _0x2105f5=util[_0x53a7('0x9')](_0x53a7('0x5e'),_0x542f1e[_0x53a7('0x5f')]||_0x542f1e[_0x53a7('0x5c')],_0x542f1e[_0x53a7('0x9')]||'wav');return ami[_0x53a7('0x20')]({'action':_0x53a7('0x60'),'channel':_0x408d05[_0x53a7('0x5d')],'file':_0x2105f5,'options':_0x53a7('0x61')})[_0x53a7('0x62')](function(_0x10f31c){var _0x1c1758=_[_0x53a7('0x63')](_0x408d05['monitors'],{'filename':_0x53a7('0x64')+_0x2105f5[_0x53a7('0x65')]()});if(_[_0x53a7('0x66')](_0x1c1758)){_0x408d05[_0x53a7('0x67')][_0x53a7('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x2105f5['toLowerCase'](),'createdAt':moment()[_0x53a7('0x9')](_0x53a7('0x68')),'mixmonitorid':_0x10f31c[_0x53a7('0x69')],'status':_0x53a7('0x6a')});}else{_0x1c1758[_0x53a7('0x69')]=_0x10f31c[_0x53a7('0x69')];_0x1c1758[_0x53a7('0x6b')]=_0x53a7('0x6a');}_0x2d43f7({'code':0xc8,'message':[_0x542f1e[_0x53a7('0x5c')],_0x53a7('0x6c'),_0x10f31c[_0x53a7('0x69')]][_0x53a7('0x16')]('\x20'),'mixmonitorid':_0x10f31c[_0x53a7('0x69')]});})[_0x53a7('0x1b')](function(_0xc85e29){_0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f5,[_0x542f1e[_0x53a7('0x5c')],_0xc85e29[_0x53a7('0x1a')]['toLowerCase']()][_0x53a7('0x16')]('\x20')));});}else{return _0x4e71c2(_0x3af95a[_0x53a7('0x1c')](0x1f5,_0x53a7('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x35a39d){var _0x2fa260=this;return new Promise(function(_0x256390,_0x4d5479){if(ami['isConnected']()==![]){return _0x4d5479(_0x2fa260['error'](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')][_0x53a7('0x5b')],_0x53a7('0x15')][_0x53a7('0x16')]('\x20')));}var _0x2727bc=schema(properties['voicechannel'])['validate'](_0x35a39d);if(_0x2727bc[_0x53a7('0x58')]>0x0){return _0x4d5479(_0x2fa260[_0x53a7('0x1c')](0x1f4,_[_0x53a7('0x6e')](_0x2727bc,_0x53a7('0x1a'))[_0x53a7('0x16')](',\x20')));}var _0x410bb7=_['find'](_0x9d9eb8[_0x53a7('0x5a')],{'uniqueid':_0x35a39d[_0x53a7('0x5c')]});if(_0x410bb7){return BPromise[_0x53a7('0x6f')]()[_0x53a7('0x62')](function(){if(_0x410bb7[_0x53a7('0x5d')]){return ami[_0x53a7('0x20')]({'action':_0x53a7('0x70'),'channel':_0x410bb7[_0x53a7('0x5d')],'mixmonitorid':_0x35a39d['mixmonitorid']})['catch'](function(_0x55dd5e){});}})[_0x53a7('0x62')](function(){if(_0x410bb7[_0x53a7('0x71')]){return ami['Action']({'action':_0x53a7('0x70'),'channel':_0x410bb7[_0x53a7('0x71')],'mixmonitorid':_0x35a39d[_0x53a7('0x69')]})[_0x53a7('0x1b')](function(_0x35929f){});}})['then'](function(_0x363012){var _0x2835cb=_[_0x53a7('0x63')](_0x410bb7[_0x53a7('0x67')],{'mixmonitorid':_0x35a39d[_0x53a7('0x69')]});if(_0x2835cb){_0x2835cb[_0x53a7('0x6b')]='stop';}})['then'](function(){var _0x3d548b=util['format'](_0x53a7('0x5e'),_0x35a39d[_0x53a7('0x5f')]||_0x35a39d[_0x53a7('0x5c')],_0x35a39d['format']||_0x53a7('0x72'));var _0x57aa40=_[_0x53a7('0x63')](_0x410bb7[_0x53a7('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x3d548b['toLowerCase']()});if(_0x57aa40){_0x57aa40[_0x53a7('0x6b')]=_0x53a7('0x73');}})[_0x53a7('0x62')](function(){_0x256390({'code':0xc8,'message':[_0x35a39d[_0x53a7('0x5c')],_0x53a7('0x74')]['join']('\x20')});})['catch'](function(_0x437d58){_0x4d5479(_0x2fa260[_0x53a7('0x1c')](0x1f5,[_0x35a39d[_0x53a7('0x5c')],_0x437d58['message'][_0x53a7('0x65')]()][_0x53a7('0x16')]('\x20')));});}else{return _0x4d5479(_0x2fa260[_0x53a7('0x1c')](0x1f5,_0x53a7('0x6d')));}});},'VoiceQueuesChannels':function(_0xdd92b2){return new Promise(function(_0x37d28b,_0x510bb1){var _0x1dcdb5=_['values'](_0x9d9eb8['queueChannels']);_0x37d28b({'count':_0x1dcdb5['length'],'rows':_0x1dcdb5});});},'VoiceQueuesChannel':function(_0x3bdfaa){var _0x23d5f2=this;return new Promise(function(_0x1c5ed1,_0x2482ed){var _0x4198b2=schema(properties['voicequeuechannel'])['validate'](_0x3bdfaa);if(_0x4198b2['length']>0x0){return _0x2482ed(_0x23d5f2[_0x53a7('0x1c')](0x1f4,_[_0x53a7('0x6e')](_0x4198b2,_0x53a7('0x1a'))['join'](',\x20')));}var _0x30bf83=_[_0x53a7('0x63')](_0x9d9eb8['queueChannels'],{'uniqueid':_0x3bdfaa[_0x53a7('0x5c')]});if(_0x30bf83){_0x1c5ed1(_0x30bf83);}else{return _0x2482ed(_0x23d5f2[_0x53a7('0x1c')](0x1f5,_0x53a7('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x320f07){var _0x921600=this;return new Promise(function(_0x192de1,_0x302efa){if(ami[_0x53a7('0x13')]()==![]){return _0x302efa(_0x921600[_0x53a7('0x1c')](0x1f4,[config[_0x53a7('0x14')]['ip'],config[_0x53a7('0x14')][_0x53a7('0x5b')],_0x53a7('0x15')][_0x53a7('0x16')]('\x20')));}var _0x4c807a=schema(properties[_0x53a7('0x75')])['validate'](_0x320f07);if(_0x4c807a[_0x53a7('0x58')]>0x0){return _0x302efa(_0x921600[_0x53a7('0x1c')](0x1f4,_[_0x53a7('0x6e')](_0x4c807a,_0x53a7('0x1a'))['join'](',\x20')));}var _0x380c38=_['find'](_0x9d9eb8[_0x53a7('0x76')],{'uniqueid':_0x320f07[_0x53a7('0x5c')]});if(_0x380c38&&_0x380c38[_0x53a7('0x5d')]){return ami['Action']({'action':_0x53a7('0x77'),'channel':_0x380c38[_0x53a7('0x5d')]})[_0x53a7('0x62')](function(_0x2dfd46){_0x192de1({'code':0xc8,'message':[_0x320f07[_0x53a7('0x5c')],_0x2dfd46['message']['toLowerCase']()][_0x53a7('0x16')]('\x20')});})[_0x53a7('0x1b')](function(_0x3bce14){_0x302efa(_0x921600[_0x53a7('0x1c')](0x1f5,[_0x320f07[_0x53a7('0x5c')],_0x3bce14[_0x53a7('0x1a')][_0x53a7('0x65')]()][_0x53a7('0x16')]('\x20')));});}else{return _0x302efa(_0x921600['error'](0x1f5,_0x53a7('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x53ed81){var _0x5ec220=this;return new Promise(function(_0x426841,_0x5a2caf){if(ami[_0x53a7('0x13')]()==![]){return _0x5a2caf(_0x5ec220[_0x53a7('0x1c')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x53a7('0x15')]['join']('\x20')));}var _0x3cfb9d=schema(properties[_0x53a7('0x78')])[_0x53a7('0x2')](_0x53ed81);if(_0x3cfb9d[_0x53a7('0x58')]>0x0){return _0x5a2caf(_0x5ec220[_0x53a7('0x1c')](0x1f4,_['map'](_0x3cfb9d,_0x53a7('0x1a'))[_0x53a7('0x16')](',\x20')));}var _0x156f3d=_[_0x53a7('0x63')](_0x9d9eb8[_0x53a7('0x76')],{'uniqueid':_0x53ed81[_0x53a7('0x5c')]});if(_0x156f3d&&_0x156f3d[_0x53a7('0x5d')]){return ami[_0x53a7('0x20')]({'action':_0x53a7('0x79'),'channel':_0x156f3d[_0x53a7('0x5d')],'exten':_0x53ed81[_0x53a7('0x7a')],'context':_0x53ed81[_0x53a7('0x7b')]||_0x156f3d[_0x53a7('0x7b')],'priority':0x1})['then'](function(_0x23810e){_0x426841({'code':0xc8,'message':[_0x53ed81[_0x53a7('0x5c')],_0x23810e[_0x53a7('0x1a')]['toLowerCase']()][_0x53a7('0x16')]('\x20')});})[_0x53a7('0x1b')](function(_0x490fff){_0x5a2caf(_0x5ec220['error'](0x1f5,[_0x53ed81[_0x53a7('0x5c')],_0x490fff[_0x53a7('0x1a')]['toLowerCase']()][_0x53a7('0x16')]('\x20')));});}else{return _0x5a2caf(_0x5ec220['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x360c5d){return new Promise(function(_0x22c002,_0x1a5bce){var _0xbe689a=_[_0x53a7('0x59')](_0x9d9eb8['agents']);_0x22c002({'count':_0xbe689a[_0x53a7('0x58')],'rows':_0xbe689a});});},'Telephones':function(_0x238e61){return new Promise(function(_0x3de335,_0xa68d0c){var _0x15b58d=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7c')]);_0x3de335({'count':_0x15b58d['length'],'rows':_0x15b58d});});},'Trunks':function(_0x68239c){return new Promise(function(_0x45c144,_0x2b315c){var _0x224241=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7d')]);_0x45c144({'count':_0x224241['length'],'rows':_0x224241});});},'OutboundChannels':function(_0x98ea86){return new Promise(function(_0x2da202,_0x12e9d4){var _0x5b461a=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7e')]);_0x2da202({'count':_0x5b461a[_0x53a7('0x58')],'rows':_0x5b461a});});},'Outbound':function(_0x37487f){return new Promise(function(_0xf69fa7,_0x4e25f2){_0xf69fa7(_0x9d9eb8[_0x53a7('0x2f')]);});},'Campaigns':function(_0x219cd7){return new Promise(function(_0x177794,_0x342e84){var _0x489581=_[_0x53a7('0x59')](_0x9d9eb8[_0x53a7('0x7f')]);_0x177794({'count':_0x489581['length'],'rows':_0x489581});});},'VoiceQueuesPreview':function(_0x5659e8){var _0x223e67=this;return new Promise(function(_0x326394,_0x37bd44){_0x3a13e6['run'](_0x5659e8['id'])[_0x53a7('0x62')](function(_0x3a8bdb){_0x326394({'code':0xc8,'message':_0x3a8bdb['message']});})[_0x53a7('0x1b')](function(_0x2ccc4f){_0x37bd44(_0x223e67[_0x53a7('0x1c')](0x1f4,_0x2ccc4f[_0x53a7('0x1a')]));});});},'EventManager':function(_0x1c67a6){var _0xa49922=this;return new Promise(function(_0x5787bc,_0x16db74){if(!_0x1c67a6[_0x53a7('0x80')]){return _0x16db74(_0xa49922[_0x53a7('0x1c')](0x1f4,_0x53a7('0x81')));}ami[_0x53a7('0x82')](_0x53a7('0x83')+_0x1c67a6[_0x53a7('0x80')],_0x1c67a6[_0x53a7('0x1a')]);_0x5787bc({'code':0xc8,'message':_0x1c67a6});});},'FaxAccounts':function(_0x273283){return new Promise(function(_0x4d7c12,_0x418b81){var _0x4c1dce=_['values'](_0x9d9eb8[_0x53a7('0x84')]);_0x4d7c12({'count':_0x4c1dce['length'],'rows':_0x4c1dce});});},'SendFax':function(_0x3c25ef){var _0x39a36f=this;return new Promise(function(_0x173828,_0x7eb1cb){_0x577f37[_0x53a7('0x85')](_0x3c25ef)[_0x53a7('0x62')](function(_0x13daff){_0x173828({'code':0xc8,'message':_0x13daff['message']});})[_0x53a7('0x1b')](function(_0x16dad7){_0x7eb1cb(_0x39a36f[_0x53a7('0x1c')](0x1f4,_0x16dad7[_0x53a7('0x1a')]));});});},'CheckAfterSend':function(_0x31e2a8){var _0x24e9ac=this;return new Promise(function(_0xb046fc,_0x1c8ffd){_0x577f37[_0x53a7('0x86')](_0x31e2a8)['then'](function(_0x1ddb46){_0xb046fc({'code':0xc8,'message':_0x1ddb46[_0x53a7('0x1a')]});})[_0x53a7('0x1b')](function(_0x2c42cf){_0x1c8ffd(_0x24e9ac[_0x53a7('0x1c')](0x1f4,_0x2c42cf[_0x53a7('0x1a')]));});});}};var _0x48a8ef=jayson['server'](_0x1ccfc0)['http']();_0x48a8ef['on']('error',function(_0x55798d){return _0x71b464(_0x55798d);});_0x48a8ef[_0x53a7('0x8')](0x232a,_0x53a7('0x87'),function(){console[_0x53a7('0x88')](_0x53a7('0x89'),0x232a);return _0x3b1ac2(_0x53a7('0x8a')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index dd99f44..f8334c4 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 _0xdf00=['Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','action','toLowerCase','merge','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','exec','data2','xmd-contactid','data3','split','phone','map','destcalleridnum','calleridnum','firstName','mobile','fax','ListId','createdAt','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','destcalleridname'];(function(_0x1946aa,_0x493b74){var _0x3c4133=function(_0xdce9b){while(--_0xdce9b){_0x1946aa['push'](_0x1946aa['shift']());}};_0x3c4133(++_0x493b74);}(_0xdf00,0x1df));var _0x0df0=function(_0xbf4f21,_0x708c3f){_0xbf4f21=_0xbf4f21-0x0;var _0x11f46e=_0xdf00[_0xbf4f21];return _0x11f46e;};'use strict';var _=require('lodash');var BPromise=require(_0x0df0('0x0'));var Redis=require('ioredis');var util=require(_0x0df0('0x1'));var config=require(_0x0df0('0x2'));var logger=require(_0x0df0('0x3'))(_0x0df0('0x4'));var cmContactRpc=require(_0x0df0('0x5'));config[_0x0df0('0x6')]=_[_0x0df0('0x7')](config[_0x0df0('0x6')],{'host':_0x0df0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0df0('0x6')]));function emit(_0x6e4b65,_0x189336,_0x594bdb,_0x360857,_0x326b08){logger[_0x0df0('0x9')]('[CM][%s][%s]',_0x6e4b65,_0x189336['id'],_0x594bdb,_0x360857,JSON[_0x0df0('0xa')](_0x326b08));io['to'](_0x594bdb)[_0x0df0('0xb')](_0x360857,_0x326b08);}exports[_0x0df0('0xc')]=function(_0x1db754,_0x7f0400,_0x2897b5,_0x15ac5a){var _0x5c39d9,_0x2bb757;var _0x7040b3={};var _0x454b17=Number(_0x2897b5['data1']);var _0x547a73=_0x2897b5[_0x0df0('0xd')]?Boolean(Number(_0x2897b5[_0x0df0('0xd')])):![];var _0x2db3aa;if(_0x15ac5a[_0x0df0('0xe')]){_0x7040b3['id']=_0x15ac5a[_0x0df0('0xe')];}if(!_0x7040b3['id']){_0x7040b3['ListId']=_0x454b17;_0x2db3aa=_0x2897b5[_0x0df0('0xf')]&&_0x2897b5[_0x0df0('0xf')]!=='0'?_0x2897b5[_0x0df0('0xf')][_0x0df0('0x10')](','):[_0x0df0('0x11')];_0x7040b3['$or']=_[_0x0df0('0x12')](_0x2db3aa,function(_0x1ed699){var _0x6fdc9a={};_0x6fdc9a[_0x1ed699]=_0x15ac5a['routeId']?_0x15ac5a[_0x0df0('0x13')]:_0x15ac5a[_0x0df0('0x14')];return _0x6fdc9a;});}var _0x55dc44=['id',_0x0df0('0x15'),'lastName',_0x0df0('0x11'),_0x0df0('0x16'),_0x0df0('0x17'),_0x0df0('0x18'),_0x0df0('0x19'),'scheduledAt','updatedAt'];var _0x34af37=_['union'](_0x55dc44,_0x2db3aa);BPromise[_0x0df0('0x1a')]()['then'](cmContactRpc['getContacts']({'attributes':_0x34af37,'where':_0x7040b3}))[_0x0df0('0x1b')](function(_0x550697){_0x2bb757=_0x550697;if(!_[_0x0df0('0x1c')](_0x2bb757)){if(_0x2bb757[_0x0df0('0x1d')]===0x1){_0x5c39d9=_0x2bb757[0x0];logger[_0x0df0('0x9')](_0x0df0('0x1e'),_0x15ac5a['uniqueid'],_0x7f0400['id'],_0x5c39d9['id']);}else{logger[_0x0df0('0x9')](_0x0df0('0x1f'),_0x15ac5a['uniqueid'],_0x7f0400['id'],_[_0x0df0('0x12')](_0x2bb757,'id')[_0x0df0('0x20')](','));}return;}else{logger[_0x0df0('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id']);var _0x906b48={'ListId':_0x454b17};var _0x483782=_0x2897b5[_0x0df0('0x22')]&&_0x2897b5[_0x0df0('0x22')]!=='0'?_0x2897b5[_0x0df0('0x22')]:_0x0df0('0x11');if(_0x547a73){logger[_0x0df0('0x9')](_0x0df0('0x23'),_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id']);_0x906b48[_0x483782]=_[_0x0df0('0x24')](_0x15ac5a['routeId'])?_0x15ac5a[_0x0df0('0x14')]:_0x15ac5a[_0x0df0('0x13')];if(_[_0x0df0('0x24')](_0x15ac5a[_0x0df0('0x25')])){_0x906b48[_0x0df0('0x15')]=_0x15ac5a[_0x0df0('0x26')]&&_0x15ac5a[_0x0df0('0x26')]!==_0x0df0('0x27')?_0x15ac5a[_0x0df0('0x26')]:'Unknown';}else{_0x906b48[_0x0df0('0x15')]=_0x15ac5a[_0x0df0('0x28')]&&_0x15ac5a[_0x0df0('0x28')]!==_0x0df0('0x27')?_0x15ac5a[_0x0df0('0x28')]:_0x0df0('0x29');}return BPromise['resolve']()[_0x0df0('0x1b')](cmContactRpc[_0x0df0('0x2a')](_0x906b48))['then'](function(_0x406715){_0x5c39d9=_0x406715;_0x2bb757['push'](_0x406715);if(_0x5c39d9){logger['info'](_0x0df0('0x2b'),_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id'],_0x5c39d9['id']);}return;});}else{logger[_0x0df0('0x9')](_0x0df0('0x2c'),_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id']);_0x906b48[_0x483782]=_[_0x0df0('0x24')](_0x15ac5a[_0x0df0('0x25')])?_0x15ac5a[_0x0df0('0x14')]:_0x15ac5a[_0x0df0('0x13')];if(_[_0x0df0('0x24')](_0x15ac5a[_0x0df0('0x25')])){_0x906b48[_0x0df0('0x15')]=_0x15ac5a[_0x0df0('0x26')]&&_0x15ac5a[_0x0df0('0x26')]!==''?_0x15ac5a[_0x0df0('0x26')]:_0x0df0('0x29');}else{_0x906b48[_0x0df0('0x15')]=_0x15ac5a['destcalleridname']&&_0x15ac5a[_0x0df0('0x28')]!==_0x0df0('0x27')?_0x15ac5a[_0x0df0('0x28')]:_0x0df0('0x29');}_0x5c39d9=_0x906b48;_0x2bb757[_0x0df0('0x2d')](_0x906b48);return;}}})[_0x0df0('0x1b')](function(){if(_0x1db754){emit(_0x15ac5a['uniqueid'],_0x7f0400,util[_0x0df0('0x2e')](_0x0df0('0x2f'),_0x1db754[_0x0df0('0x30')]),util[_0x0df0('0x2e')]('trigger:%s',_0x2897b5[_0x0df0('0x31')][_0x0df0('0x32')]()),{'evt':_[_0x0df0('0x33')](_0x15ac5a,{'autoCreate':_0x547a73}),'contact':_0x5c39d9===undefined?{}:_0x5c39d9,'contacts':_0x2bb757[_0x0df0('0x1d')]===0x0?undefined:_0x2bb757});}});}; \ No newline at end of file +var _0x5422=['destcalleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','Unknown','format','user:%s','name','action','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x5422,0x1aa));var _0x2542=function(_0x19ecb5,_0x8fc0b9){_0x19ecb5=_0x19ecb5-0x0;var _0x4f2ae3=_0x5422[_0x19ecb5];return _0x4f2ae3;};'use strict';var _=require(_0x2542('0x0'));var BPromise=require('bluebird');var Redis=require(_0x2542('0x1'));var util=require(_0x2542('0x2'));var config=require(_0x2542('0x3'));var logger=require(_0x2542('0x4'))(_0x2542('0x5'));var cmContactRpc=require(_0x2542('0x6'));config[_0x2542('0x7')]=_['defaults'](config[_0x2542('0x7')],{'host':_0x2542('0x8'),'port':0x18eb});var io=require(_0x2542('0x9'))(new Redis(config[_0x2542('0x7')]));function emit(_0x28e6a1,_0xcf99a7,_0x5b8b1e,_0x2723ed,_0x858ccf){logger[_0x2542('0xa')](_0x2542('0xb'),_0x28e6a1,_0xcf99a7['id'],_0x5b8b1e,_0x2723ed,JSON[_0x2542('0xc')](_0x858ccf));io['to'](_0x5b8b1e)[_0x2542('0xd')](_0x2723ed,_0x858ccf);}exports['exec']=function(_0x5bfac0,_0x40a56a,_0x5d2c72,_0x144097){var _0x36d6fe,_0x41535a;var _0x31d87f={};var _0x216cf5=Number(_0x5d2c72['data1']);var _0x35aca0=_0x5d2c72[_0x2542('0xe')]?Boolean(Number(_0x5d2c72[_0x2542('0xe')])):![];var _0x14b7a9;if(_0x144097[_0x2542('0xf')]){_0x31d87f['id']=_0x144097[_0x2542('0xf')];}if(!_0x31d87f['id']){_0x31d87f[_0x2542('0x10')]=_0x216cf5;_0x14b7a9=_0x5d2c72['data3']&&_0x5d2c72[_0x2542('0x11')]!=='0'?_0x5d2c72[_0x2542('0x11')][_0x2542('0x12')](','):[_0x2542('0x13')];_0x31d87f[_0x2542('0x14')]=_['map'](_0x14b7a9,function(_0x2d17dd){var _0x43b124={};_0x43b124[_0x2d17dd]=_0x144097[_0x2542('0x15')]?_0x144097[_0x2542('0x16')]:_0x144097['calleridnum'];return _0x43b124;});}var _0x44d4c8=['id',_0x2542('0x17'),'lastName',_0x2542('0x13'),'mobile',_0x2542('0x18'),_0x2542('0x10'),_0x2542('0x19'),_0x2542('0x1a'),_0x2542('0x1b')];var _0x4f4c6b=_[_0x2542('0x1c')](_0x44d4c8,_0x14b7a9);BPromise[_0x2542('0x1d')]()[_0x2542('0x1e')](cmContactRpc[_0x2542('0x1f')]({'attributes':_0x4f4c6b,'where':_0x31d87f}))['then'](function(_0x40d9d2){_0x41535a=_0x40d9d2;if(!_[_0x2542('0x20')](_0x41535a)){if(_0x41535a[_0x2542('0x21')]===0x1){_0x36d6fe=_0x41535a[0x0];logger['info'](_0x2542('0x22'),_0x144097[_0x2542('0x23')],_0x40a56a['id'],_0x36d6fe['id']);}else{logger[_0x2542('0xa')](_0x2542('0x24'),_0x144097[_0x2542('0x23')],_0x40a56a['id'],_[_0x2542('0x25')](_0x41535a,'id')[_0x2542('0x26')](','));}return;}else{logger[_0x2542('0xa')](_0x2542('0x27'),_0x144097[_0x2542('0x23')],_0x40a56a['id']);var _0x456c5d={'ListId':_0x216cf5};var _0x27ac78=_0x5d2c72['data4']&&_0x5d2c72[_0x2542('0x28')]!=='0'?_0x5d2c72['data4']:_0x2542('0x13');if(_0x35aca0){logger[_0x2542('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x144097[_0x2542('0x23')],_0x40a56a['id']);_0x456c5d[_0x27ac78]=_['isNil'](_0x144097[_0x2542('0x15')])?_0x144097[_0x2542('0x29')]:_0x144097[_0x2542('0x16')];if(_['isNil'](_0x144097['routeId'])){_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2a')]&&_0x144097[_0x2542('0x2a')]!==_0x2542('0x2b')?_0x144097[_0x2542('0x2a')]:'Unknown';}else{_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2c')]&&_0x144097[_0x2542('0x2c')]!==_0x2542('0x2b')?_0x144097[_0x2542('0x2c')]:'Unknown';}return BPromise[_0x2542('0x1d')]()['then'](cmContactRpc[_0x2542('0x2d')](_0x456c5d))[_0x2542('0x1e')](function(_0xfebcb4){_0x36d6fe=_0xfebcb4;_0x41535a[_0x2542('0x2e')](_0xfebcb4);if(_0x36d6fe){logger[_0x2542('0xa')](_0x2542('0x2f'),_0x144097['uniqueid'],_0x40a56a['id'],_0x36d6fe['id']);}return;});}else{logger[_0x2542('0xa')](_0x2542('0x30'),_0x144097[_0x2542('0x23')],_0x40a56a['id']);_0x456c5d[_0x27ac78]=_['isNil'](_0x144097[_0x2542('0x15')])?_0x144097['calleridnum']:_0x144097[_0x2542('0x16')];if(_[_0x2542('0x31')](_0x144097[_0x2542('0x15')])){_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2a')]&&_0x144097['calleridname']!==''?_0x144097[_0x2542('0x2a')]:_0x2542('0x32');}else{_0x456c5d[_0x2542('0x17')]=_0x144097[_0x2542('0x2c')]&&_0x144097[_0x2542('0x2c')]!==_0x2542('0x2b')?_0x144097[_0x2542('0x2c')]:_0x2542('0x32');}_0x36d6fe=_0x456c5d;_0x41535a[_0x2542('0x2e')](_0x456c5d);return;}}})[_0x2542('0x1e')](function(){if(_0x5bfac0){emit(_0x144097[_0x2542('0x23')],_0x40a56a,util[_0x2542('0x33')](_0x2542('0x34'),_0x5bfac0[_0x2542('0x35')]),util['format']('trigger:%s',_0x5d2c72[_0x2542('0x36')]['toLowerCase']()),{'evt':_[_0x2542('0x37')](_0x144097,{'autoCreate':_0x35aca0}),'contact':_0x36d6fe===undefined?{}:_0x36d6fe,'contacts':_0x41535a[_0x2542('0x21')]===0x0?undefined:_0x41535a});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fbe641d..e288e08 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 _0x95ef=['custom:agentcongestion','custom:agentreject','custom:timeout','custom:dialconnect','syncAgentDial','custom:dialend','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','motionbar','data1','TemplateId','html','data2','template\x20not\x20found','uri','buildUri','isNil','data4','data5','800','data6','winApplication','render','winArguments','data3','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','integration','exec','queue','urlforward','script','parse','query','search','AllConditions','every','checkConditions','channel','AnyConditions','some','ChatWebsiteId','upperFirst','AccountId','operator','message','value','event','membername','lastevent','routeId','exports','lodash','url','mustache','ioredis','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','freshsalesAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber'];(function(_0x564cb3,_0x1bbedc){var _0x9e150d=function(_0x51f587){while(--_0x51f587){_0x564cb3['push'](_0x564cb3['shift']());}};_0x9e150d(++_0x1bbedc);}(_0x95ef,0xb4));var _0xf95e=function(_0x1a1268,_0x2fa7c9){_0x1a1268=_0x1a1268-0x0;var _0x508459=_0x95ef[_0x1a1268];return _0x508459;};'use strict';var util=require('util');var _=require(_0xf95e('0x0'));var url=require(_0xf95e('0x1'));var Mustache=require(_0xf95e('0x2'));var Redis=require(_0xf95e('0x3'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require('./cmContact');var script=require('./script');var config=require(_0xf95e('0x4'));var logger=require(_0xf95e('0x5'))(_0xf95e('0x6'));var ami=require('../ami');config[_0xf95e('0x7')]=_[_0xf95e('0x8')](config['redis'],{'host':_0xf95e('0x9'),'port':0x18eb});var io=require(_0xf95e('0xa'))(new Redis(config[_0xf95e('0x7')]));var operators={'equals':function(_0x2ce8e9,_0x1cf814){return _0x2ce8e9==_0x1cf814;},'not_equals':function(_0x46b0e7,_0x40f38d){return _0x46b0e7!=_0x40f38d;}};var barAndWebActions=[_0xf95e('0xb'),_0xf95e('0x1'),_0xf95e('0xc')];function Trigger(_0x460b4c){this[_0xf95e('0xd')]=_0x460b4c[_0xf95e('0xd')];this[_0xf95e('0xe')]=_0x460b4c['agents'];this[_0xf95e('0xf')]=_0x460b4c[_0xf95e('0xf')];this[_0xf95e('0x10')]=_0x460b4c[_0xf95e('0x10')];this[_0xf95e('0x11')]=_0x460b4c['voiceExtensions'];this[_0xf95e('0x12')]=_0x460b4c[_0xf95e('0x12')];this[_0xf95e('0x13')]=_0x460b4c['freshdeskAccounts'];this[_0xf95e('0x14')]=_0x460b4c[_0xf95e('0x14')];this[_0xf95e('0x15')]=_0x460b4c[_0xf95e('0x15')];this['zohoAccounts']=_0x460b4c[_0xf95e('0x16')];this[_0xf95e('0x17')]=_0x460b4c[_0xf95e('0x17')];this[_0xf95e('0x18')]=_0x460b4c[_0xf95e('0x18')];this[_0xf95e('0x19')]=_0x460b4c['servicenowAccounts'];this[_0xf95e('0x1a')]=_0x460b4c[_0xf95e('0x1a')];this['freshsalesAccounts']=_0x460b4c['freshsalesAccounts'];this[_0xf95e('0x1b')]={'zendesk':this[_0xf95e('0x12')],'salesforce':this[_0xf95e('0x14')],'freshdesk':this[_0xf95e('0x13')],'sugarcrm':this[_0xf95e('0x15')],'zoho':this[_0xf95e('0x16')],'desk':this[_0xf95e('0x17')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xf95e('0x1a')],'freshsales':this[_0xf95e('0x1c')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x1f'),this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on']('custom:agentringnoanswer',this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x20'),this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x21'),this[_0xf95e('0x1d')]['bind'](this));ami['on']('custom:agentnoanswer',this[_0xf95e('0x1d')]['bind'](this));ami['on']('custom:agentbusy',this[_0xf95e('0x1d')]['bind'](this));ami['on'](_0xf95e('0x22'),this['syncCustomEvent'][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x23'),this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on']('custom:queuecallerabandon',this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x24'),this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on'](_0xf95e('0x25'),this[_0xf95e('0x26')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x27'),this['syncAgentDial'][_0xf95e('0x1e')](this));ami['on']('custom:newinteraction',this[_0xf95e('0x1d')]['bind'](this));ami['on']('custom:closedinteraction',this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x28'),this['syncCustomEvent'][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x29'),this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x2a'),this[_0xf95e('0x1d')][_0xf95e('0x1e')](this));ami['on'](_0xf95e('0x2b'),this[_0xf95e('0x1d')]['bind'](this));}Trigger[_0xf95e('0x2c')][_0xf95e('0x2d')]=function(_0x287a6d,_0x5ebba6,_0x10f001){logger['info'](_0x287a6d,_0x5ebba6,JSON[_0xf95e('0x2e')](_0x10f001));io['to'](_0x287a6d)[_0xf95e('0x2d')](_0x5ebba6,_0x10f001);};Trigger[_0xf95e('0x2c')][_0xf95e('0x1d')]=function(_0x4c4482){var _0x2d242e=_[_0xf95e('0x2f')](_0x4c4482);this[_0xf95e('0x30')](_0x2d242e);};Trigger[_0xf95e('0x2c')][_0xf95e('0x26')]=function(_0x3349d2){if(this['agents'][_0x3349d2[_0xf95e('0x31')]]){this[_0xf95e('0x1d')](_0x3349d2);}};Trigger[_0xf95e('0x2c')][_0xf95e('0x30')]=function(_0x4df779){var _0xb0038d;for(var _0x164ade in this['triggers']){if(this['triggers'][_0xf95e('0x32')](_0x164ade)){if(this[_0xf95e('0xd')][_0x164ade][_0xf95e('0x33')]){_0xb0038d=this[_0xf95e('0x34')](this[_0xf95e('0xd')][_0x164ade],_0x4df779);if(_0xb0038d){_[_0xf95e('0x35')](_0x4df779,_0x4df779[_0xf95e('0x36')]);for(var _0x5c77ba=0x0,_0x268960,_0x6febc9,_0x2949cf;_0x5c77ba0x0){_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(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 3ef2ac6..40be49c 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 _0x7e69=['isdisabled','info','toUpperCase','systemuserid','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','headers','lastIndexOf','value','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','customField','idField','substring','indexOf','content','ticketType','incidents','assign','getString','Subjects','Fields','phonecall','phonecalls','Descriptions','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','userEmail','length','internalemailaddress','email'];(function(_0x3d760a,_0x2a4a1a){var _0x5817ca=function(_0x3e12b6){while(--_0x3e12b6){_0x3d760a['push'](_0x3d760a['shift']());}};_0x5817ca(++_0x2a4a1a);}(_0x7e69,0x111));var _0x97e6=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x7e69[_0x2797c6];return _0x54809f;};'use strict';var _=require('lodash');var BPromise=require(_0x97e6('0x0'));var rp=require(_0x97e6('0x1'));var util=require(_0x97e6('0x2'));var intUtil=require(_0x97e6('0x3'));var md5=require(_0x97e6('0x4'));var Redis=require(_0x97e6('0x5'));var logger=require(_0x97e6('0x6'))('dynamics365');var config=require(_0x97e6('0x7'));config['redis']=_[_0x97e6('0x8')](config[_0x97e6('0x9')],{'host':_0x97e6('0xa'),'port':0x18eb});var io=require(_0x97e6('0xb'))(new Redis(config['redis']));function getAuthToken(_0x1b7deb,_0x18df0f,_0x1cfda7){var _0x4e4d08={'method':_0x97e6('0xc'),'uri':_0x18df0f,'form':{'client_id':_0x1b7deb[_0x97e6('0xd')],'resource':_0x1b7deb[_0x97e6('0xe')],'username':_0x1b7deb[_0x97e6('0xf')],'password':_0x1b7deb['password'],'grant_type':_0x97e6('0x10'),'client_secret':_0x1b7deb[_0x97e6('0x11')]},'json':!![]};return rp(_0x4e4d08)[_0x97e6('0x12')](function(_0x203179){return _0x203179[_0x97e6('0x13')];})[_0x97e6('0x14')](function(_0x259ee2){logger[_0x97e6('0x15')]('['+[_0x1cfda7['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x259ee2[_0x97e6('0x16')];});}function getUser(_0x599b52,_0x4a445b,_0x1a2baa,_0x214168,_0x5ca2c1,_0x44cce5){return new BPromise(function(_0x2b29b9,_0x918311){return getAuthToken(_0x4a445b,_0x214168,_0x44cce5)[_0x97e6('0x12')](function(_0x11b02a){var _0x2955c4={'method':_0x97e6('0x17'),'uri':_0x5ca2c1+_0x97e6('0x18'),'headers':{'Authorization':_0x97e6('0x19')+_0x11b02a,'OData-Version':_0x97e6('0x1a')},'json':!![]};return rp(_0x2955c4);})[_0x97e6('0x12')](function(_0x5a83c9){var _0x510e07=_0x5a83c9['value'];var _0x51797a=![];var _0x14ba64=null;if(!_[_0x97e6('0x1b')](_0x1a2baa)){if(intUtil[_0x97e6('0x1c')](_0x1a2baa['email'])){_0x599b52[_0x97e6('0x1d')]=_0x1a2baa['email'];for(_0x14ba64=0x0;_0x14ba64<_0x510e07[_0x97e6('0x1e')];_0x14ba64++){if(_0x510e07[_0x14ba64][_0x97e6('0x1f')]===_0x1a2baa[_0x97e6('0x20')]&&!_0x510e07[_0x14ba64][_0x97e6('0x21')]){_0x51797a=!![];logger[_0x97e6('0x22')]('['+[_0x44cce5[_0x97e6('0x23')]()]+']\x20Agent\x20found\x20'+_0x510e07[_0x14ba64][_0x97e6('0x24')]+'!');_0x599b52[_0x97e6('0x25')]=_0x510e07[_0x14ba64][_0x97e6('0x24')];}}}}if(!_0x51797a){logger[_0x97e6('0x22')]('['+[_0x44cce5[_0x97e6('0x23')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x599b52[_0x97e6('0x1d')]=_0x4a445b[_0x97e6('0xf')];for(_0x14ba64=0x0;_0x14ba64<_0x510e07[_0x97e6('0x1e')];_0x14ba64++){if(_0x510e07[_0x14ba64][_0x97e6('0x1f')]===_0x4a445b[_0x97e6('0xf')]){_0x599b52[_0x97e6('0x25')]=_0x510e07[_0x14ba64][_0x97e6('0x24')];}}}_0x2b29b9(_0x599b52);})[_0x97e6('0x14')](function(_0x1664d4){_0x918311(_0x1664d4['message']);});});}function createEndUser(_0xcc0395,_0x4473a4,_0x1dd88d,_0x7c7ec0,_0x1ff248,_0x435ada){return new BPromise(function(_0x5a094e,_0x44fefc){return getAuthToken(_0x4473a4,_0x1dd88d,_0x435ada)[_0x97e6('0x12')](function(_0x28bd96){var _0x151bd3=_0x435ada[_0x97e6('0x26')]()==='outbound'?_0x1ff248[_0x97e6('0x27')]:_0x1ff248[_0x97e6('0x28')];var _0xcc3934={'method':'POST','uri':_0x7c7ec0+_0x97e6('0x29'),'body':{'telephone1':_0x151bd3,'fullname':_0x151bd3,'firstname':_0x151bd3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x97e6('0x2a')+_0xcc0395[_0x97e6('0x25')]+')'},'headers':{'Authorization':_0x97e6('0x19')+_0x28bd96,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xcc3934);})['then'](function(_0x5e78ab){var _0x225b11=_0x5e78ab[_0x97e6('0x2b')]['odata-entityid'];var _0x17e42b=_0x225b11['substring'](_0x225b11[_0x97e6('0x2c')]('(')+0x1,_0x225b11[_0x97e6('0x2c')](')'));_0xcc0395['enduserId']=_0x17e42b;_0x5a094e(_0xcc0395);})[_0x97e6('0x14')](function(_0x430eef){_0x44fefc(_0x430eef[_0x97e6('0x16')]);});});}function getEndUser(_0x3cd020,_0x5278d0,_0x1af22d,_0xaed14,_0x498b59,_0x2af490){return new BPromise(function(_0x496f1e,_0x2c322c){return getAuthToken(_0x5278d0,_0x1af22d,_0x2af490)[_0x97e6('0x12')](function(_0x104db3){var _0x41f177={'method':_0x97e6('0x17'),'uri':_0xaed14+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x104db3,'If-None-Match':null,'OData-Version':_0x97e6('0x1a')},'json':!![]};return rp(_0x41f177);})['then'](function(_0x597600){var _0x26b08f=null;if(_0x597600){var _0x19a8df=_0x597600[_0x97e6('0x2d')];var _0x4cec6f=![];for(_0x26b08f=0x0;_0x26b08f<_0x19a8df[_0x97e6('0x1e')];_0x26b08f++){var _0x46119c=_0x2af490[_0x97e6('0x26')]()==='outbound'?_0x498b59['destcalleridnum']:_0x498b59[_0x97e6('0x28')];if(_0x19a8df[_0x26b08f][_0x97e6('0x2e')]===_0x46119c){_0x4cec6f=!![];_0x3cd020[_0x97e6('0x2f')]=_0x19a8df[_0x26b08f][_0x97e6('0x30')];}}if(_0x4cec6f){_0x496f1e(_0x3cd020);}else{return createEndUser(_0x3cd020,_0x5278d0,_0x1af22d,_0xaed14,_0x498b59,_0x2af490)[_0x97e6('0x12')](function(_0x5cfc71){logger[_0x97e6('0x22')]('['+[_0x2af490[_0x97e6('0x23')]()]+_0x97e6('0x31'),_0x5cfc71['enduserId']);_0x496f1e(_0x5cfc71);});}}else{return createEndUser(_0x3cd020,_0x5278d0,_0x1af22d,_0xaed14,_0x498b59,_0x2af490)[_0x97e6('0x12')](function(_0x19e683){logger[_0x97e6('0x22')]('['+[_0x2af490['toUpperCase']()]+_0x97e6('0x32'),_0x19e683['enduserId']);_0x496f1e(_0x19e683);});}});});}function getCustomFields(_0x3ccfa6,_0x5298ed,_0x7af854){var _0x91e140={};if(_0x3ccfa6[_0x97e6('0x1e')]>0x0){_[_0x97e6('0x33')](_0x3ccfa6,function(_0x3cce54){if(_0x3cce54[_0x97e6('0x34')]===_0x97e6('0x35')&&_0x3cce54['nameField']&&!_0x3cce54[_0x97e6('0x36')]){var _0x55b514=_0x3cce54[_0x97e6('0x37')][_0x97e6('0x26')]();var _0xc92e82=_0x55b514[_0x97e6('0x38')](0x0,_0x55b514[_0x97e6('0x39')]('_'));var _0x4418e=_0x55b514[_0x97e6('0x38')](_0x55b514[_0x97e6('0x39')]('_')+0x1);if(_0xc92e82===_0x7af854){_0x91e140[_0x4418e]=_0x3cce54[_0x97e6('0x3a')];}}});}return _0x91e140;}function getTicket(_0x5f09b4,_0x1579e0,_0x46d0aa,_0x5770da,_0x50fec1,_0x45f1b1,_0x42d512){return new BPromise(function(_0x434be3,_0x4048a9){var _0x39670e;return getAuthToken(_0x1579e0,_0x46d0aa,_0x42d512)['then'](function(_0x135200){if(_0x45f1b1[_0x97e6('0x3b')]==='incident'){_0x39670e={'method':_0x97e6('0xc'),'uri':_0x5770da+_0x97e6('0x3c'),'body':Object[_0x97e6('0x3d')]({},{'title':intUtil[_0x97e6('0x3e')](_0x45f1b1[_0x97e6('0x3f')],_0x50fec1,'\x20'),'description':intUtil[_0x97e6('0x3e')](_0x45f1b1['Descriptions'],_0x50fec1,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x5f09b4[_0x97e6('0x2f')]+')','ownerid@odata.bind':_0x97e6('0x2a')+_0x5f09b4[_0x97e6('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x45f1b1[_0x97e6('0x40')],_0x50fec1,_0x45f1b1['ticketType'])),'headers':{'Authorization':_0x97e6('0x19')+_0x135200,'OData-Version':_0x97e6('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x45f1b1['ticketType']===_0x97e6('0x41')){_0x39670e={'method':_0x97e6('0xc'),'uri':_0x5770da+_0x97e6('0x42'),'body':Object['assign']({},{'subject':intUtil[_0x97e6('0x3e')](_0x45f1b1[_0x97e6('0x3f')],_0x50fec1,'\x20'),'phonenumber':String(_0x50fec1[_0x97e6('0x28')]),'description':intUtil[_0x97e6('0x3e')](_0x45f1b1[_0x97e6('0x43')],_0x50fec1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x97e6('0x44')+_0x5f09b4[_0x97e6('0x2f')]+')','ownerid@odata.bind':_0x97e6('0x2a')+_0x5f09b4[_0x97e6('0x25')]+')','directioncode':_0x5f09b4[_0x97e6('0x45')]===_0x97e6('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x97e6('0x2a')+_0x5f09b4[_0x97e6('0x25')]+')','participationtypemask':_0x5f09b4[_0x97e6('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x97e6('0x44')+_0x5f09b4[_0x97e6('0x2f')]+')','participationtypemask':_0x5f09b4[_0x97e6('0x45')]==='queue'?0x1:0x2}]},getCustomFields(_0x45f1b1['Fields'],_0x50fec1,_0x45f1b1['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x135200,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x39670e);})[_0x97e6('0x12')](function(_0x2420ea){var _0x13ae7f=_0x2420ea[_0x97e6('0x2b')]['odata-entityid'];var _0x4ffcae=_0x13ae7f['substring'](_0x13ae7f[_0x97e6('0x2c')]('(')+0x1,_0x13ae7f['lastIndexOf'](')'));_0x5f09b4[_0x97e6('0x47')]=_0x4ffcae;_0x434be3(_0x5f09b4);})['catch'](function(_0x312c76){_0x4048a9(_0x312c76[_0x97e6('0x16')]);});});}function emit(_0x11ed4a,_0x261cff,_0xdfa17a,_0x3146e9){var _0x4fcb19={'uri':util[_0x97e6('0x48')](_0x97e6('0x49'),_0x11ed4a,_0xdfa17a,_0x3146e9)};io['to'](util[_0x97e6('0x48')](_0x97e6('0x4a'),_0x261cff))[_0x97e6('0x4b')](_0x97e6('0x4c'),_0x4fcb19);}exports['cs']=function(_0x42b49d,_0xdbc063,_0x17dbbd,_0x4a7289,_0x1ea318,_0x4b17e0,_0x1a7a9e,_0x5df04f){var _0x4ddda1={};_0x4b17e0[_0x97e6('0xe')]=intUtil['stripTrailingSlash'](_0x4b17e0[_0x97e6('0xe')]);_0x4b17e0[_0x97e6('0x4d')]=intUtil[_0x97e6('0x4e')](_0x4b17e0['serverUrl']);_0x4ddda1[_0x97e6('0x45')]=_0x5df04f==='queue'||_0x5df04f==='unmanaged'?_0x97e6('0x46'):_0x97e6('0x4f');var _0x508bb9=util[_0x97e6('0x48')](_0x97e6('0x50'),_0x4b17e0[_0x97e6('0xe')]);var _0x1b0d90=util[_0x97e6('0x48')](_0x97e6('0x51'),_0x4b17e0[_0x97e6('0x52')]);var _0xb88c2b=util[_0x97e6('0x48')](_0x97e6('0x53'),_0x4b17e0[_0x97e6('0x4d')],_0xdbc063[_0x97e6('0x54')],md5(_0xdbc063[_0x97e6('0x54')]));if(_0x1ea318&&_0x1ea318[_0x97e6('0x55')]){logger[_0x97e6('0x22')](_0x97e6('0x56'),_0x97e6('0x57'));_0xdbc063['recordingURL']=_0xb88c2b;}else if(_0x1a7a9e&&_0x1a7a9e['recordingFormat']&&_0x1a7a9e[_0x97e6('0x58')]!==_0x97e6('0x59')){logger[_0x97e6('0x22')](_0x97e6('0x5a'),'Recording\x20is\x20enabled!');_0xdbc063[_0x97e6('0x5b')]=_0xb88c2b;}else{_0xdbc063[_0x97e6('0x5b')]='';}return getUser(_0x4ddda1,_0x4b17e0,_0x4a7289,_0x1b0d90,_0x508bb9,_0x5df04f)['then'](function(_0xc84770){logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5c'),_0xc84770['userId']);logger['info']('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5d'),_0xc84770['userEmail']);return getEndUser(_0xc84770,_0x4b17e0,_0x1b0d90,_0x508bb9,_0xdbc063,_0x5df04f);})['then'](function(_0x1ebcca){logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5e'),_0x1ebcca[_0x97e6('0x2f')]);logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5f'),_0xdbc063['calleridnum']);return getTicket(_0x1ebcca,_0x4b17e0,_0x1b0d90,_0x508bb9,_0xdbc063,_0x17dbbd,_0x5df04f);})[_0x97e6('0x12')](function(_0x48d88a){logger[_0x97e6('0x22')](util[_0x97e6('0x48')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x60'),_0x17dbbd[_0x97e6('0x3b')],_0x48d88a[_0x97e6('0x47')]));logger[_0x97e6('0x22')](util['format']('['+_0x5df04f['toUpperCase']()+_0x97e6('0x61'),_0x5df04f));if(_0x5df04f!==_0x97e6('0x62')){logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4b17e0['remoteUri'],_0x4a7289[_0x97e6('0x63')],_0x17dbbd[_0x97e6('0x3b')],_0x48d88a['ticketId']);}})[_0x97e6('0x14')](function(_0x2cd11a){logger[_0x97e6('0x15')]('['+_0x5df04f['toUpperCase']()+_0x97e6('0x64'),util[_0x97e6('0x65')](_0x2cd11a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x65b7=['assign','callDirection','queue','odata-entityid','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','userEmail','length','internalemailaddress','email','info',']\x20Agent\x20found\x20','systemuserid','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','idField','indexOf','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65b7,0x197));var _0x765b=function(_0x1a3083,_0x5bfa95){_0x1a3083=_0x1a3083-0x0;var _0xe8fea5=_0x65b7[_0x1a3083];return _0xe8fea5;};'use strict';var _=require('lodash');var BPromise=require(_0x765b('0x0'));var rp=require(_0x765b('0x1'));var util=require(_0x765b('0x2'));var intUtil=require(_0x765b('0x3'));var md5=require(_0x765b('0x4'));var Redis=require('ioredis');var logger=require(_0x765b('0x5'))('dynamics365');var config=require(_0x765b('0x6'));config[_0x765b('0x7')]=_[_0x765b('0x8')](config[_0x765b('0x7')],{'host':_0x765b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x765b('0x7')]));function getAuthToken(_0x504eee,_0x1ef61a,_0x3ae025){var _0x171bd5={'method':_0x765b('0xa'),'uri':_0x1ef61a,'form':{'client_id':_0x504eee[_0x765b('0xb')],'resource':_0x504eee[_0x765b('0xc')],'username':_0x504eee[_0x765b('0xd')],'password':_0x504eee[_0x765b('0xe')],'grant_type':_0x765b('0xe'),'client_secret':_0x504eee[_0x765b('0xf')]},'json':!![]};return rp(_0x171bd5)['then'](function(_0x282d92){return _0x282d92[_0x765b('0x10')];})['catch'](function(_0x30b10a){logger[_0x765b('0x11')]('['+[_0x3ae025[_0x765b('0x12')]()]+_0x765b('0x13'));return _0x30b10a[_0x765b('0x14')];});}function getUser(_0x445a97,_0x4873b7,_0x13940b,_0x48e949,_0x38ce35,_0x2583e1){return new BPromise(function(_0x215b66,_0x5e741b){return getAuthToken(_0x4873b7,_0x48e949,_0x2583e1)['then'](function(_0x4b9c37){var _0x24271c={'method':_0x765b('0x15'),'uri':_0x38ce35+_0x765b('0x16'),'headers':{'Authorization':_0x765b('0x17')+_0x4b9c37,'OData-Version':_0x765b('0x18')},'json':!![]};return rp(_0x24271c);})[_0x765b('0x19')](function(_0x4ac926){var _0x418e33=_0x4ac926[_0x765b('0x1a')];var _0x56bde0=![];var _0x3c2e2f=null;if(!_[_0x765b('0x1b')](_0x13940b)){if(intUtil['validateEmail'](_0x13940b['email'])){_0x445a97[_0x765b('0x1c')]=_0x13940b['email'];for(_0x3c2e2f=0x0;_0x3c2e2f<_0x418e33[_0x765b('0x1d')];_0x3c2e2f++){if(_0x418e33[_0x3c2e2f][_0x765b('0x1e')]===_0x13940b[_0x765b('0x1f')]&&!_0x418e33[_0x3c2e2f]['isdisabled']){_0x56bde0=!![];logger[_0x765b('0x20')]('['+[_0x2583e1[_0x765b('0x12')]()]+_0x765b('0x21')+_0x418e33[_0x3c2e2f][_0x765b('0x22')]+'!');_0x445a97[_0x765b('0x23')]=_0x418e33[_0x3c2e2f][_0x765b('0x22')];}}}}if(!_0x56bde0){logger[_0x765b('0x20')]('['+[_0x2583e1[_0x765b('0x12')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x445a97[_0x765b('0x1c')]=_0x4873b7[_0x765b('0xd')];for(_0x3c2e2f=0x0;_0x3c2e2f<_0x418e33[_0x765b('0x1d')];_0x3c2e2f++){if(_0x418e33[_0x3c2e2f][_0x765b('0x1e')]===_0x4873b7[_0x765b('0xd')]){_0x445a97[_0x765b('0x23')]=_0x418e33[_0x3c2e2f][_0x765b('0x22')];}}}_0x215b66(_0x445a97);})[_0x765b('0x24')](function(_0x223df4){_0x5e741b(_0x223df4[_0x765b('0x14')]);});});}function createEndUser(_0x4ecb42,_0x1e535a,_0x17c4d9,_0x2bacba,_0x352318,_0x1c40c0){return new BPromise(function(_0x2868c8,_0x42b3be){return getAuthToken(_0x1e535a,_0x17c4d9,_0x1c40c0)['then'](function(_0x1202b9){var _0x4df8ca=_0x1c40c0[_0x765b('0x25')]()===_0x765b('0x26')?_0x352318[_0x765b('0x27')]:_0x352318[_0x765b('0x28')];var _0x20dff1={'method':_0x765b('0xa'),'uri':_0x2bacba+_0x765b('0x29'),'body':{'telephone1':_0x4df8ca,'fullname':_0x4df8ca,'firstname':_0x4df8ca,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x765b('0x2a')+_0x4ecb42[_0x765b('0x23')]+')'},'headers':{'Authorization':_0x765b('0x17')+_0x1202b9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x20dff1);})[_0x765b('0x19')](function(_0x1cf889){var _0x26b3b6=_0x1cf889[_0x765b('0x2b')]['odata-entityid'];var _0x44ea2f=_0x26b3b6[_0x765b('0x2c')](_0x26b3b6['lastIndexOf']('(')+0x1,_0x26b3b6[_0x765b('0x2d')](')'));_0x4ecb42[_0x765b('0x2e')]=_0x44ea2f;_0x2868c8(_0x4ecb42);})[_0x765b('0x24')](function(_0x1d17be){_0x42b3be(_0x1d17be[_0x765b('0x14')]);});});}function getEndUser(_0x519156,_0x53cf5d,_0x2ed7e7,_0xfd4616,_0x5947ae,_0x53b48f){return new BPromise(function(_0x2a1074,_0x78cdf9){return getAuthToken(_0x53cf5d,_0x2ed7e7,_0x53b48f)[_0x765b('0x19')](function(_0x5bcdcc){var _0xebd93={'method':_0x765b('0x15'),'uri':_0xfd4616+_0x765b('0x2f'),'headers':{'Authorization':_0x765b('0x17')+_0x5bcdcc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xebd93);})['then'](function(_0xa43794){var _0x7940f1=null;if(_0xa43794){var _0x44dec8=_0xa43794['value'];var _0x5c1039=![];for(_0x7940f1=0x0;_0x7940f1<_0x44dec8[_0x765b('0x1d')];_0x7940f1++){var _0x126e57=_0x53b48f['toLowerCase']()===_0x765b('0x26')?_0x5947ae[_0x765b('0x27')]:_0x5947ae[_0x765b('0x28')];if(_0x44dec8[_0x7940f1][_0x765b('0x30')]===_0x126e57){_0x5c1039=!![];_0x519156[_0x765b('0x2e')]=_0x44dec8[_0x7940f1][_0x765b('0x31')];}}if(_0x5c1039){_0x2a1074(_0x519156);}else{return createEndUser(_0x519156,_0x53cf5d,_0x2ed7e7,_0xfd4616,_0x5947ae,_0x53b48f)[_0x765b('0x19')](function(_0x4ae5e2){logger[_0x765b('0x20')]('['+[_0x53b48f[_0x765b('0x12')]()]+_0x765b('0x32'),_0x4ae5e2['enduserId']);_0x2a1074(_0x4ae5e2);});}}else{return createEndUser(_0x519156,_0x53cf5d,_0x2ed7e7,_0xfd4616,_0x5947ae,_0x53b48f)[_0x765b('0x19')](function(_0x44b52f){logger[_0x765b('0x20')]('['+[_0x53b48f['toUpperCase']()]+_0x765b('0x33'),_0x44b52f[_0x765b('0x2e')]);_0x2a1074(_0x44b52f);});}});});}function getCustomFields(_0x251819,_0x22c9cb,_0x476062){var _0x1db7d2={};if(_0x251819[_0x765b('0x1d')]>0x0){_[_0x765b('0x34')](_0x251819,function(_0x105cdb){if(_0x105cdb[_0x765b('0x35')]===_0x765b('0x36')&&_0x105cdb[_0x765b('0x37')]&&!_0x105cdb['customField']){var _0x2cf8ed=_0x105cdb[_0x765b('0x38')][_0x765b('0x25')]();var _0x2218b6=_0x2cf8ed['substring'](0x0,_0x2cf8ed['indexOf']('_'));var _0x4556f6=_0x2cf8ed[_0x765b('0x2c')](_0x2cf8ed[_0x765b('0x39')]('_')+0x1);if(_0x2218b6===_0x476062){_0x1db7d2[_0x4556f6]=_0x105cdb['content'];}}});}return _0x1db7d2;}function getTicket(_0x1102d6,_0x522091,_0xa4378e,_0x5d683e,_0x51cc06,_0x5459b8,_0xf54b98){return new BPromise(function(_0x39b353,_0x250c82){var _0x22a28d;return getAuthToken(_0x522091,_0xa4378e,_0xf54b98)[_0x765b('0x19')](function(_0x210d48){if(_0x5459b8[_0x765b('0x3a')]===_0x765b('0x3b')){_0x22a28d={'method':_0x765b('0xa'),'uri':_0x5d683e+_0x765b('0x3c'),'body':Object['assign']({},{'title':intUtil[_0x765b('0x3d')](_0x5459b8[_0x765b('0x3e')],_0x51cc06,'\x20'),'description':intUtil['getString'](_0x5459b8[_0x765b('0x3f')],_0x51cc06,'\x0a'),'customerid_contact@odata.bind':_0x765b('0x40')+_0x1102d6[_0x765b('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x1102d6['userId']+')','caseorigincode':'1'},getCustomFields(_0x5459b8[_0x765b('0x41')],_0x51cc06,_0x5459b8['ticketType'])),'headers':{'Authorization':_0x765b('0x17')+_0x210d48,'OData-Version':_0x765b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5459b8['ticketType']===_0x765b('0x42')){_0x22a28d={'method':'POST','uri':_0x5d683e+_0x765b('0x43'),'body':Object[_0x765b('0x44')]({},{'subject':intUtil['getString'](_0x5459b8[_0x765b('0x3e')],_0x51cc06,'\x20'),'phonenumber':String(_0x51cc06[_0x765b('0x28')]),'description':intUtil[_0x765b('0x3d')](_0x5459b8[_0x765b('0x3f')],_0x51cc06,'\x0a'),'regardingobjectid_contact@odata.bind':_0x765b('0x40')+_0x1102d6[_0x765b('0x2e')]+')','ownerid@odata.bind':_0x765b('0x2a')+_0x1102d6[_0x765b('0x23')]+')','directioncode':_0x1102d6[_0x765b('0x45')]===_0x765b('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x765b('0x2a')+_0x1102d6['userId']+')','participationtypemask':_0x1102d6['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x765b('0x40')+_0x1102d6[_0x765b('0x2e')]+')','participationtypemask':_0x1102d6[_0x765b('0x45')]===_0x765b('0x46')?0x1:0x2}]},getCustomFields(_0x5459b8[_0x765b('0x41')],_0x51cc06,_0x5459b8[_0x765b('0x3a')])),'headers':{'Authorization':_0x765b('0x17')+_0x210d48,'OData-Version':_0x765b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x22a28d);})['then'](function(_0x15fb06){var _0x1db35c=_0x15fb06[_0x765b('0x2b')][_0x765b('0x47')];var _0x556d86=_0x1db35c[_0x765b('0x2c')](_0x1db35c[_0x765b('0x2d')]('(')+0x1,_0x1db35c[_0x765b('0x2d')](')'));_0x1102d6['ticketId']=_0x556d86;_0x39b353(_0x1102d6);})[_0x765b('0x24')](function(_0x27a3cd){_0x250c82(_0x27a3cd['message']);});});}function emit(_0x326c14,_0x77f099,_0x288c61,_0x41a610){var _0x1db3b1={'uri':util[_0x765b('0x48')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x326c14,_0x288c61,_0x41a610)};io['to'](util['format'](_0x765b('0x49'),_0x77f099))[_0x765b('0x4a')]('trigger:browser:url',_0x1db3b1);}exports['cs']=function(_0x591474,_0xd00e8,_0x36835f,_0x23a62a,_0x508b27,_0x3314d9,_0x36fd2f,_0x486649){var _0x15e5bb={};_0x3314d9[_0x765b('0xc')]=intUtil[_0x765b('0x4b')](_0x3314d9['remoteUri']);_0x3314d9['serverUrl']=intUtil['stripTrailingSlash'](_0x3314d9[_0x765b('0x4c')]);_0x15e5bb[_0x765b('0x45')]=_0x486649===_0x765b('0x46')||_0x486649===_0x765b('0x4d')?_0x765b('0x46'):_0x765b('0x26');var _0x51a297=util[_0x765b('0x48')](_0x765b('0x4e'),_0x3314d9['remoteUri']);var _0x3ea2b8=util[_0x765b('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3314d9['tenantId']);var _0x21d704=util[_0x765b('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3314d9['serverUrl'],_0xd00e8[_0x765b('0x4f')],md5(_0xd00e8[_0x765b('0x4f')]));if(_0x508b27&&_0x508b27[_0x765b('0x50')]){logger[_0x765b('0x20')](_0x765b('0x51'),'Recording\x20is\x20enabled!');_0xd00e8[_0x765b('0x52')]=_0x21d704;}else if(_0x36fd2f&&_0x36fd2f[_0x765b('0x53')]&&_0x36fd2f['recordingFormat']!=='none'){logger['info'](_0x765b('0x54'),_0x765b('0x55'));_0xd00e8[_0x765b('0x52')]=_0x21d704;}else{_0xd00e8[_0x765b('0x52')]='';}return getUser(_0x15e5bb,_0x3314d9,_0x23a62a,_0x3ea2b8,_0x51a297,_0x486649)[_0x765b('0x19')](function(_0x4c9919){logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x56'),_0x4c9919['userId']);logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x57'),_0x4c9919[_0x765b('0x1c')]);return getEndUser(_0x4c9919,_0x3314d9,_0x3ea2b8,_0x51a297,_0xd00e8,_0x486649);})[_0x765b('0x19')](function(_0x32074c){logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x32074c[_0x765b('0x2e')]);logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x58'),_0xd00e8[_0x765b('0x28')]);return getTicket(_0x32074c,_0x3314d9,_0x3ea2b8,_0x51a297,_0xd00e8,_0x36835f,_0x486649);})['then'](function(_0x33852a){logger[_0x765b('0x20')](util[_0x765b('0x48')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x59'),_0x36835f[_0x765b('0x3a')],_0x33852a[_0x765b('0x5a')]));logger[_0x765b('0x20')](util[_0x765b('0x48')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x5b'),_0x486649));if(_0x486649!=='unmanaged'){logger[_0x765b('0x20')]('['+_0x486649[_0x765b('0x12')]()+']',_0x765b('0x5c'));emit(_0x3314d9[_0x765b('0xc')],_0x23a62a['name'],_0x36835f['ticketType'],_0x33852a['ticketId']);}})[_0x765b('0x24')](function(_0x34530b){logger[_0x765b('0x11')]('['+_0x486649[_0x765b('0x12')]()+_0x765b('0x5d'),util[_0x765b('0x5e')](_0x34530b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 405c2aa..f25c8bf 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 _0x551a=['application/json','emit','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Fields','custom_fields','mapValues','keyBy','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','map','type','nameField','customField','content','idField','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x551a,0x157));var _0xa551=function(_0x1841c1,_0x5645e2){_0x1841c1=_0x1841c1-0x0;var _0xa1db6a=_0x551a[_0x1841c1];return _0xa1db6a;};'use strict';var _=require(_0xa551('0x0'));var rp=require(_0xa551('0x1'));var md5=require(_0xa551('0x2'));var util=require(_0xa551('0x3'));var Redis=require(_0xa551('0x4'));var intUtil=require(_0xa551('0x5'));var config=require(_0xa551('0x6'));var logger=require(_0xa551('0x7'))(_0xa551('0x8'));config[_0xa551('0x9')]=_[_0xa551('0xa')](config['redis'],{'host':_0xa551('0xb'),'port':0x18eb});var io=require(_0xa551('0xc'))(new Redis(config[_0xa551('0x9')]));var headers={'Content-Type':'application/json','Accept':_0xa551('0xd')};function emit(_0x205d52,_0x1d2a83,_0x3bbb32){io['to'](_0x205d52)[_0xa551('0xe')](_0x1d2a83,_0x3bbb32);}function getTicket(_0x27d54f,_0x1a1eed,_0x6f7b62,_0x2cbd44,_0x1d4673){logger['info']('Creating\x20new\x20ticket...');var _0x55825a=_[_0xa551('0xf')]({'responder_id':_0x1a1eed['id'],'requester_id':_0x6f7b62['id'],'name':util[_0xa551('0x10')](_0xa551('0x11'),_0x1d4673[_0xa551('0x12')]),'phone':_0x1d4673[_0xa551('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xa551('0x14')](_0x2cbd44[_0xa551('0x15')],_0x1d4673,'\x20'),'description':intUtil[_0xa551('0x14')](_0x2cbd44[_0xa551('0x16')],_0x1d4673,'
'),'tags':getTags(_0x2cbd44['Tags'],'name')},getCustomFields(_0x2cbd44[_0xa551('0x17')],_0x1d4673));_0x55825a[_0xa551('0x18')]=_[_0xa551('0x19')](_[_0xa551('0x1a')](_0x55825a[_0xa551('0x18')],'id'),'value');return request({'uri':util[_0xa551('0x10')]('%s/api/v2/tickets',_0x27d54f[_0xa551('0x1b')]),'method':_0xa551('0x1c'),'body':_0x55825a})[_0xa551('0x1d')](function(_0x9e1c7b){logger[_0xa551('0x1e')](_0xa551('0x1f'));return _0x9e1c7b;});}function getUser(_0x35f660,_0x45a889){if(intUtil['validateEmail'](_0x45a889)){return request({'uri':util[_0xa551('0x10')](_0xa551('0x20'),_0x35f660['remoteUri']),'qs':{'email':_0x45a889}})['then'](function(_0x1a440a){if(_0x1a440a[_0xa551('0x21')]){logger['info'](_0xa551('0x22'));return _[_0xa551('0x23')](_0x1a440a,function(_0x4e4fd7){return _0x4e4fd7['contact'][_0xa551('0x24')]===_0x45a889;});}else{logger[_0xa551('0x1e')](_0xa551('0x25'));return request({'uri':util['format'](_0xa551('0x26'),_0x35f660[_0xa551('0x1b')])})[_0xa551('0x1d')](function(_0x5beded){logger[_0xa551('0x1e')](_0xa551('0x27'));return _0x5beded;});}});}else{logger[_0xa551('0x1e')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa551('0x10')](_0xa551('0x26'),_0x35f660[_0xa551('0x1b')])})[_0xa551('0x1d')](function(_0x89c55){logger['info'](_0xa551('0x27'));return _0x89c55;});}}function getEndUser(_0x596bd9,_0x98210b,_0x25c350){logger['info'](_0xa551('0x28'),_0x25c350);return request({'uri':util['format'](_0xa551('0x29'),_0x596bd9['remoteUri']),'qs':{'phone':_0x25c350}})[_0xa551('0x1d')](function(_0x4ed882){if(_0x4ed882[_0xa551('0x21')]){logger[_0xa551('0x1e')](_0xa551('0x2a'));return _[_0xa551('0x23')](_0x4ed882,{'phone':_0x25c350});}else{logger[_0xa551('0x1e')](_0xa551('0x2b'));return request({'uri':util[_0xa551('0x10')](_0xa551('0x29'),_0x596bd9[_0xa551('0x1b')]),'method':'POST','body':{'name':_0x98210b,'phone':_0x25c350}})[_0xa551('0x1d')](function(_0x4a2426){logger[_0xa551('0x1e')](_0xa551('0x2c'));return _0x4a2426;});}});}function getAuth(_0x7168b9){return util[_0xa551('0x10')](_0xa551('0x2d'),new Buffer(_0x7168b9[_0xa551('0x2e')]+':X')[_0xa551('0x2f')]('base64'));}function request(_0x4d916e){logger[_0xa551('0x30')](_0xa551('0x31'),JSON[_0xa551('0x32')](_0x4d916e));return rp(_['defaults'](_0x4d916e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x32f703,_0x3fedac){var _0x32d1fa=[];if(_0x32f703&&_0x32f703[_0xa551('0x21')]>0x0){_0x32d1fa=_[_0xa551('0x33')](_0x32f703,_0x3fedac);}return _0x32d1fa;}function getCustomFields(_0x55a81a,_0x37642a){var _0x2a30a2=[];var _0x4d439e={'custom_fields':[]};if(_0x55a81a[_0xa551('0x21')]>0x0){_['forEach'](_0x55a81a,function(_0x4c8b19){if(_0x4c8b19[_0xa551('0x34')]==='string'&&_0x4c8b19[_0xa551('0x35')]&&!_0x4c8b19[_0xa551('0x36')]){_0x4d439e[_0x4c8b19[_0xa551('0x35')]['toLowerCase']()]=_0x4c8b19[_0xa551('0x37')][_0xa551('0x2f')]();}else if(_0x4c8b19[_0xa551('0x34')]==='string'&&_0x4c8b19[_0xa551('0x38')]&&_0x4c8b19['customField']){_0x4d439e[_0xa551('0x18')][_0xa551('0x39')]({'id':_0x4c8b19[_0xa551('0x38')],'value':_0x4c8b19[_0xa551('0x37')][_0xa551('0x2f')]()});}else if(_0x4c8b19['type']===_0xa551('0x3a')&&_0x4c8b19[_0xa551('0x3b')]&&_0x4c8b19[_0xa551('0x38')]&&_0x4c8b19['customField']){_0x37642a[_0x4c8b19[_0xa551('0x3b')]]&&_0x4d439e[_0xa551('0x18')][_0xa551('0x39')]({'id':_0x4c8b19[_0xa551('0x38')],'value':_0x37642a[_0x4c8b19[_0xa551('0x3b')]][_0xa551('0x2f')]()});}else if(_0x4c8b19['type']===_0xa551('0x3c')&&_0x4c8b19[_0xa551('0x3d')]&&_0x4c8b19[_0xa551('0x3d')][_0xa551('0x3e')]&&_0x4c8b19[_0xa551('0x38')]&&_0x4c8b19[_0xa551('0x36')]){_0x37642a[_0x4c8b19['Variable'][_0xa551('0x3e')][_0xa551('0x3f')]()]&&_0x4d439e[_0xa551('0x18')][_0xa551('0x39')]({'id':_0x4c8b19['idField'],'value':_0x37642a[_0x4c8b19[_0xa551('0x3d')][_0xa551('0x3e')][_0xa551('0x3f')]()][_0xa551('0x2f')]()});}});}return _0x4d439e;}exports[_0xa551('0x40')]=function(_0x1d4423,_0x2bf111,_0x296879,_0xffc975,_0xce0a9a,_0x35ecbd){var _0x449120,_0x2fb260;_0x35ecbd[_0xa551('0x1b')]=intUtil[_0xa551('0x41')](_0x35ecbd[_0xa551('0x1b')]);_0x35ecbd[_0xa551('0x42')]=intUtil['stripTrailingSlash'](_0x35ecbd[_0xa551('0x42')]);if(_0xce0a9a&&_0xce0a9a[_0xa551('0x43')]){logger[_0xa551('0x1e')](_0xa551('0x44'),'Recording\x20is\x20enabled!');_0x2bf111['recordingURL']=util['format'](_0xa551('0x45'),_0x35ecbd[_0xa551('0x42')],_0x2bf111[_0xa551('0x46')],md5(_0x2bf111['uniqueid']));}else{_0x2bf111[_0xa551('0x47')]='';}headers[_0xa551('0x48')]=getAuth(_0x35ecbd);return getUser(_0x35ecbd,_0xffc975[_0xa551('0x24')])[_0xa551('0x1d')](function(_0x15998f){_0x449120=_0x15998f;logger[_0xa551('0x1e')]('The\x20User\x20ID\x20is:',_0x449120['id']);return getEndUser(_0x35ecbd,_0x2bf111[_0xa551('0x12')],_0x2bf111[_0xa551('0x13')]);})[_0xa551('0x1d')](function(_0x4482dc){_0x2fb260=_0x4482dc;logger[_0xa551('0x1e')]('The\x20Enduser\x20ID\x20is:',_0x2fb260['id']);return getTicket(_0x35ecbd,_0x449120,_0x2fb260,_0x296879,_0x2bf111);})[_0xa551('0x1d')](function(_0x3ca151){if(_0x3ca151&&_0x3ca151['id']){logger[_0xa551('0x1e')](_0xa551('0x1f'));logger[_0xa551('0x1e')](_0xa551('0x49'),_0x3ca151['id']);logger[_0xa551('0x1e')](_0xa551('0x44'),_0xa551('0x4a'));emit(util[_0xa551('0x10')]('user:%s',_0xffc975[_0xa551('0x3e')]),_0xa551('0x4b'),{'uri':util['format'](_0xa551('0x4c'),_0x35ecbd[_0xa551('0x1b')],_0x3ca151['id'])});}})[_0xa551('0x4d')](function(_0x45a413){logger[_0xa551('0x4e')]('[QUEUE]',JSON[_0xa551('0x32')](_0x45a413));});};exports[_0xa551('0x4f')]=function(_0xdc7f18,_0x6383e6,_0x18b3d6,_0x3c69d0,_0x241aec,_0x52ba8b,_0x535f6d){var _0x205b14,_0x57cc46;_0x52ba8b[_0xa551('0x1b')]=intUtil['stripTrailingSlash'](_0x52ba8b[_0xa551('0x1b')]);_0x52ba8b[_0xa551('0x42')]=intUtil['stripTrailingSlash'](_0x52ba8b[_0xa551('0x42')]);if(_0x535f6d&&_0x535f6d[_0xa551('0x50')]&&_0x535f6d[_0xa551('0x50')]!==_0xa551('0x51')){logger[_0xa551('0x1e')](_0xa551('0x52'),_0xa551('0x53'));_0x6383e6[_0xa551('0x47')]=util[_0xa551('0x10')](_0xa551('0x45'),_0x52ba8b[_0xa551('0x42')],_0x6383e6[_0xa551('0x46')],md5(_0x6383e6['uniqueid']));}headers[_0xa551('0x48')]=getAuth(_0x52ba8b);return getUser(_0x52ba8b,_0x3c69d0[_0xa551('0x24')])[_0xa551('0x1d')](function(_0x11f848){_0x205b14=_0x11f848;logger[_0xa551('0x1e')]('The\x20User\x20ID\x20is:',_0x205b14['id']);return getEndUser(_0x52ba8b,_0x6383e6[_0xa551('0x54')],_0x6383e6['destcalleridnum']);})[_0xa551('0x1d')](function(_0x6bd717){_0x57cc46=_0x6bd717;logger[_0xa551('0x1e')](_0xa551('0x55'),_0x57cc46['id']);return getTicket(_0x52ba8b,_0x205b14,_0x57cc46,_0x18b3d6,_0x6383e6);})['then'](function(_0x4d29de){if(_0x4d29de&&_0x4d29de['id']){logger['info']('Ticket\x20created!');logger[_0xa551('0x1e')](_0xa551('0x49'),_0x4d29de['id']);logger[_0xa551('0x1e')](_0xa551('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa551('0x10')]('user:%s',_0x3c69d0[_0xa551('0x3e')]),_0xa551('0x4b'),{'uri':util[_0xa551('0x10')](_0xa551('0x4c'),_0x52ba8b['remoteUri'],_0x4d29de['id'])});}})[_0xa551('0x4d')](function(_0x20c4ad){logger[_0xa551('0x4e')]('[OUTBOUND]',JSON[_0xa551('0x32')](_0x20c4ad));});};exports['unmanaged']=function(_0x218de4,_0x43af72,_0x5a861f,_0x1d120e,_0x2c99e6,_0x297be2){var _0x1e2efb,_0x548bd7;_0x297be2['remoteUri']=intUtil['stripTrailingSlash'](_0x297be2[_0xa551('0x1b')]);_0x297be2[_0xa551('0x42')]=intUtil[_0xa551('0x41')](_0x297be2[_0xa551('0x42')]);if(_0x2c99e6&&_0x2c99e6[_0xa551('0x43')]){logger[_0xa551('0x1e')]('['+_0x43af72[_0xa551('0x56')][_0xa551('0x57')]()+']',_0xa551('0x53'));_0x43af72[_0xa551('0x47')]=util[_0xa551('0x10')](_0xa551('0x45'),_0x297be2[_0xa551('0x42')],_0x43af72[_0xa551('0x46')],md5(_0x43af72[_0xa551('0x46')]));}else{_0x43af72['recordingURL']='';}headers[_0xa551('0x48')]=getAuth(_0x297be2);return getUser(_0x297be2,'')[_0xa551('0x1d')](function(_0x1eb8f4){_0x1e2efb=_0x1eb8f4;logger['info'](_0xa551('0x58'),_0x1e2efb['id']);return getEndUser(_0x297be2,_0x43af72[_0xa551('0x12')],_0x43af72[_0xa551('0x13')]);})[_0xa551('0x1d')](function(_0x2d3c57){_0x548bd7=_0x2d3c57;logger['info'](_0xa551('0x55'),_0x548bd7['id']);return getTicket(_0x297be2,_0x1e2efb,_0x548bd7,_0x5a861f,_0x43af72);})[_0xa551('0x1d')](function(_0x495401){if(_0x495401){logger[_0xa551('0x1e')](_0xa551('0x1f'));logger[_0xa551('0x1e')]('The\x20Ticket\x20ID\x20is:',_0x495401['id']);}})[_0xa551('0x4d')](function(_0x341aef){logger[_0xa551('0x4e')]('['+_0x43af72[_0xa551('0x56')][_0xa551('0x57')]()+']',JSON[_0xa551('0x32')](_0x341aef));});}; \ No newline at end of file +var _0x5aeb=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','name','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','Authorization','catch','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0x5aeb,0x95));var _0xb5ae=function(_0x3588f1,_0x261028){_0x3588f1=_0x3588f1-0x0;var _0x2631d4=_0x5aeb[_0x3588f1];return _0x2631d4;};'use strict';var _=require('lodash');var rp=require(_0xb5ae('0x0'));var md5=require('md5');var util=require(_0xb5ae('0x1'));var Redis=require(_0xb5ae('0x2'));var intUtil=require(_0xb5ae('0x3'));var config=require(_0xb5ae('0x4'));var logger=require('../../../../config/logger')(_0xb5ae('0x5'));config[_0xb5ae('0x6')]=_['defaults'](config[_0xb5ae('0x6')],{'host':_0xb5ae('0x7'),'port':0x18eb});var io=require(_0xb5ae('0x8'))(new Redis(config[_0xb5ae('0x6')]));var headers={'Content-Type':_0xb5ae('0x9'),'Accept':_0xb5ae('0x9')};function emit(_0x7a1d13,_0x215733,_0x376882){io['to'](_0x7a1d13)[_0xb5ae('0xa')](_0x215733,_0x376882);}function getTicket(_0x3c9e9c,_0x2dba06,_0x1bcadd,_0x36eaa5,_0x3802fe){logger[_0xb5ae('0xb')]('Creating\x20new\x20ticket...');var _0x24ac1a=_[_0xb5ae('0xc')]({'responder_id':_0x2dba06['id'],'requester_id':_0x1bcadd['id'],'name':util['format'](_0xb5ae('0xd'),_0x3802fe['calleridname']),'phone':_0x3802fe[_0xb5ae('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb5ae('0xf')](_0x36eaa5[_0xb5ae('0x10')],_0x3802fe,'\x20'),'description':intUtil['getString'](_0x36eaa5[_0xb5ae('0x11')],_0x3802fe,_0xb5ae('0x12')),'tags':getTags(_0x36eaa5[_0xb5ae('0x13')],'name')},getCustomFields(_0x36eaa5[_0xb5ae('0x14')],_0x3802fe));_0x24ac1a[_0xb5ae('0x15')]=_[_0xb5ae('0x16')](_[_0xb5ae('0x17')](_0x24ac1a[_0xb5ae('0x15')],'id'),_0xb5ae('0x18'));return request({'uri':util['format'](_0xb5ae('0x19'),_0x3c9e9c['remoteUri']),'method':_0xb5ae('0x1a'),'body':_0x24ac1a})[_0xb5ae('0x1b')](function(_0x5dc1b3){logger['info'](_0xb5ae('0x1c'));return _0x5dc1b3;});}function getUser(_0x313cbd,_0x585368){if(intUtil[_0xb5ae('0x1d')](_0x585368)){return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x1f'),_0x313cbd[_0xb5ae('0x20')]),'qs':{'email':_0x585368}})['then'](function(_0x300ead){if(_0x300ead[_0xb5ae('0x21')]){logger[_0xb5ae('0xb')](_0xb5ae('0x22'));return _[_0xb5ae('0x23')](_0x300ead,function(_0x46794f){return _0x46794f[_0xb5ae('0x24')]['email']===_0x585368;});}else{logger[_0xb5ae('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xb5ae('0x25'),_0x313cbd[_0xb5ae('0x20')])})['then'](function(_0x4c9aed){logger[_0xb5ae('0xb')](_0xb5ae('0x26'));return _0x4c9aed;});}});}else{logger[_0xb5ae('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x25'),_0x313cbd['remoteUri'])})[_0xb5ae('0x1b')](function(_0x57a63d){logger[_0xb5ae('0xb')]('Admin\x20account\x20selected.');return _0x57a63d;});}}function getEndUser(_0x46c6d2,_0x3ff72a,_0xf65587){logger[_0xb5ae('0xb')](_0xb5ae('0x27'),_0xf65587);return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x28'),_0x46c6d2['remoteUri']),'qs':{'phone':_0xf65587}})[_0xb5ae('0x1b')](function(_0x4bc83f){if(_0x4bc83f[_0xb5ae('0x21')]){logger[_0xb5ae('0xb')]('Enduser\x20found!');return _['find'](_0x4bc83f,{'phone':_0xf65587});}else{logger[_0xb5ae('0xb')](_0xb5ae('0x29'));return request({'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x28'),_0x46c6d2['remoteUri']),'method':'POST','body':{'name':_0x3ff72a,'phone':_0xf65587}})[_0xb5ae('0x1b')](function(_0x3090c2){logger['info'](_0xb5ae('0x2a'));return _0x3090c2;});}});}function getAuth(_0x5718b7){return util[_0xb5ae('0x1e')](_0xb5ae('0x2b'),new Buffer(_0x5718b7[_0xb5ae('0x2c')]+':X')[_0xb5ae('0x2d')](_0xb5ae('0x2e')));}function request(_0x5cbacd){logger[_0xb5ae('0x2f')](_0xb5ae('0x30'),JSON[_0xb5ae('0x31')](_0x5cbacd));return rp(_[_0xb5ae('0x32')](_0x5cbacd,{'method':_0xb5ae('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5139a6,_0x4ed051){var _0x4c26ed=[];if(_0x5139a6&&_0x5139a6[_0xb5ae('0x21')]>0x0){_0x4c26ed=_[_0xb5ae('0x34')](_0x5139a6,_0x4ed051);}return _0x4c26ed;}function getCustomFields(_0x50b4bd,_0x65bd4e){var _0x5beb66=[];var _0x1bffea={'custom_fields':[]};if(_0x50b4bd[_0xb5ae('0x21')]>0x0){_[_0xb5ae('0x35')](_0x50b4bd,function(_0x23704c){if(_0x23704c[_0xb5ae('0x36')]===_0xb5ae('0x37')&&_0x23704c[_0xb5ae('0x38')]&&!_0x23704c[_0xb5ae('0x39')]){_0x1bffea[_0x23704c['nameField'][_0xb5ae('0x3a')]()]=_0x23704c[_0xb5ae('0x3b')]['toString']();}else if(_0x23704c[_0xb5ae('0x36')]===_0xb5ae('0x37')&&_0x23704c['idField']&&_0x23704c['customField']){_0x1bffea[_0xb5ae('0x15')]['push']({'id':_0x23704c[_0xb5ae('0x3c')],'value':_0x23704c[_0xb5ae('0x3b')]['toString']()});}else if(_0x23704c['type']===_0xb5ae('0x3d')&&_0x23704c[_0xb5ae('0x3e')]&&_0x23704c['idField']&&_0x23704c['customField']){_0x65bd4e[_0x23704c[_0xb5ae('0x3e')]]&&_0x1bffea[_0xb5ae('0x15')][_0xb5ae('0x3f')]({'id':_0x23704c[_0xb5ae('0x3c')],'value':_0x65bd4e[_0x23704c[_0xb5ae('0x3e')]][_0xb5ae('0x2d')]()});}else if(_0x23704c[_0xb5ae('0x36')]===_0xb5ae('0x40')&&_0x23704c[_0xb5ae('0x41')]&&_0x23704c[_0xb5ae('0x41')][_0xb5ae('0x42')]&&_0x23704c['idField']&&_0x23704c[_0xb5ae('0x39')]){_0x65bd4e[_0x23704c[_0xb5ae('0x41')][_0xb5ae('0x42')]['toLowerCase']()]&&_0x1bffea[_0xb5ae('0x15')][_0xb5ae('0x3f')]({'id':_0x23704c[_0xb5ae('0x3c')],'value':_0x65bd4e[_0x23704c[_0xb5ae('0x41')][_0xb5ae('0x42')][_0xb5ae('0x3a')]()][_0xb5ae('0x2d')]()});}});}return _0x1bffea;}exports['queue']=function(_0x6bcad0,_0x525dfb,_0x16fe74,_0x1957d4,_0x161367,_0x213fc6){var _0x564540,_0x568784;_0x213fc6['remoteUri']=intUtil[_0xb5ae('0x43')](_0x213fc6[_0xb5ae('0x20')]);_0x213fc6['serverUrl']=intUtil['stripTrailingSlash'](_0x213fc6['serverUrl']);if(_0x161367&&_0x161367[_0xb5ae('0x44')]){logger[_0xb5ae('0xb')]('[QUEUE]',_0xb5ae('0x45'));_0x525dfb[_0xb5ae('0x46')]=util[_0xb5ae('0x1e')](_0xb5ae('0x47'),_0x213fc6[_0xb5ae('0x48')],_0x525dfb[_0xb5ae('0x49')],md5(_0x525dfb['uniqueid']));}else{_0x525dfb[_0xb5ae('0x46')]='';}headers['Authorization']=getAuth(_0x213fc6);return getUser(_0x213fc6,_0x1957d4[_0xb5ae('0x4a')])[_0xb5ae('0x1b')](function(_0x5702f3){_0x564540=_0x5702f3;logger['info'](_0xb5ae('0x4b'),_0x564540['id']);return getEndUser(_0x213fc6,_0x525dfb[_0xb5ae('0x4c')],_0x525dfb['calleridnum']);})[_0xb5ae('0x1b')](function(_0x1cca51){_0x568784=_0x1cca51;logger[_0xb5ae('0xb')](_0xb5ae('0x4d'),_0x568784['id']);return getTicket(_0x213fc6,_0x564540,_0x568784,_0x16fe74,_0x525dfb);})[_0xb5ae('0x1b')](function(_0x49db6e){if(_0x49db6e&&_0x49db6e['id']){logger['info'](_0xb5ae('0x1c'));logger['info'](_0xb5ae('0x4e'),_0x49db6e['id']);logger[_0xb5ae('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb5ae('0x1e')](_0xb5ae('0x4f'),_0x1957d4[_0xb5ae('0x42')]),_0xb5ae('0x50'),{'uri':util[_0xb5ae('0x1e')](_0xb5ae('0x51'),_0x213fc6['remoteUri'],_0x49db6e['id'])});}})['catch'](function(_0x418ab7){logger[_0xb5ae('0x52')](_0xb5ae('0x53'),JSON[_0xb5ae('0x31')](_0x418ab7));});};exports[_0xb5ae('0x54')]=function(_0x528705,_0x2c677d,_0x4ae15e,_0x1e4e2d,_0x213855,_0x4a8151,_0x44da48){var _0x45bd4b,_0x40f7dd;_0x4a8151[_0xb5ae('0x20')]=intUtil[_0xb5ae('0x43')](_0x4a8151[_0xb5ae('0x20')]);_0x4a8151[_0xb5ae('0x48')]=intUtil[_0xb5ae('0x43')](_0x4a8151[_0xb5ae('0x48')]);if(_0x44da48&&_0x44da48[_0xb5ae('0x55')]&&_0x44da48[_0xb5ae('0x55')]!==_0xb5ae('0x56')){logger[_0xb5ae('0xb')](_0xb5ae('0x57'),'Recording\x20is\x20enabled!');_0x2c677d[_0xb5ae('0x46')]=util[_0xb5ae('0x1e')](_0xb5ae('0x47'),_0x4a8151[_0xb5ae('0x48')],_0x2c677d[_0xb5ae('0x49')],md5(_0x2c677d['uniqueid']));}headers['Authorization']=getAuth(_0x4a8151);return getUser(_0x4a8151,_0x1e4e2d[_0xb5ae('0x4a')])[_0xb5ae('0x1b')](function(_0x4ced21){_0x45bd4b=_0x4ced21;logger[_0xb5ae('0xb')]('The\x20User\x20ID\x20is:',_0x45bd4b['id']);return getEndUser(_0x4a8151,_0x2c677d[_0xb5ae('0x58')],_0x2c677d[_0xb5ae('0x59')]);})[_0xb5ae('0x1b')](function(_0x66b77f){_0x40f7dd=_0x66b77f;logger[_0xb5ae('0xb')](_0xb5ae('0x4d'),_0x40f7dd['id']);return getTicket(_0x4a8151,_0x45bd4b,_0x40f7dd,_0x4ae15e,_0x2c677d);})[_0xb5ae('0x1b')](function(_0xc54dbe){if(_0xc54dbe&&_0xc54dbe['id']){logger[_0xb5ae('0xb')]('Ticket\x20created!');logger[_0xb5ae('0xb')](_0xb5ae('0x4e'),_0xc54dbe['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb5ae('0x1e')](_0xb5ae('0x4f'),_0x1e4e2d[_0xb5ae('0x42')]),_0xb5ae('0x50'),{'uri':util['format'](_0xb5ae('0x51'),_0x4a8151[_0xb5ae('0x20')],_0xc54dbe['id'])});}})['catch'](function(_0x126ac3){logger[_0xb5ae('0x52')](_0xb5ae('0x57'),JSON[_0xb5ae('0x31')](_0x126ac3));});};exports[_0xb5ae('0x5a')]=function(_0x88b2,_0x3ddb55,_0x2bbb7c,_0x125db8,_0x3138b4,_0x187ed9){var _0x52bcaf,_0x2a9ffe;_0x187ed9[_0xb5ae('0x20')]=intUtil['stripTrailingSlash'](_0x187ed9[_0xb5ae('0x20')]);_0x187ed9[_0xb5ae('0x48')]=intUtil[_0xb5ae('0x43')](_0x187ed9[_0xb5ae('0x48')]);if(_0x3138b4&&_0x3138b4[_0xb5ae('0x44')]){logger[_0xb5ae('0xb')]('['+_0x3ddb55[_0xb5ae('0x5b')][_0xb5ae('0x5c')]()+']','Recording\x20is\x20enabled!');_0x3ddb55[_0xb5ae('0x46')]=util[_0xb5ae('0x1e')](_0xb5ae('0x47'),_0x187ed9[_0xb5ae('0x48')],_0x3ddb55[_0xb5ae('0x49')],md5(_0x3ddb55[_0xb5ae('0x49')]));}else{_0x3ddb55[_0xb5ae('0x46')]='';}headers[_0xb5ae('0x5d')]=getAuth(_0x187ed9);return getUser(_0x187ed9,'')[_0xb5ae('0x1b')](function(_0x12e045){_0x52bcaf=_0x12e045;logger['info']('The\x20User\x20ID\x20is:',_0x52bcaf['id']);return getEndUser(_0x187ed9,_0x3ddb55[_0xb5ae('0x4c')],_0x3ddb55[_0xb5ae('0xe')]);})[_0xb5ae('0x1b')](function(_0x463892){_0x2a9ffe=_0x463892;logger[_0xb5ae('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2a9ffe['id']);return getTicket(_0x187ed9,_0x52bcaf,_0x2a9ffe,_0x2bbb7c,_0x3ddb55);})[_0xb5ae('0x1b')](function(_0x38b5fe){if(_0x38b5fe){logger['info'](_0xb5ae('0x1c'));logger[_0xb5ae('0xb')]('The\x20Ticket\x20ID\x20is:',_0x38b5fe['id']);}})[_0xb5ae('0x5e')](function(_0x42f538){logger[_0xb5ae('0x52')]('['+_0x3ddb55[_0xb5ae('0x5b')][_0xb5ae('0x5c')]()+']',JSON[_0xb5ae('0x31')](_0x42f538));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 06a2ce1..2a83784 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 _0x251b=['headers','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','catch','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message'];(function(_0x1bea5d,_0x4bbc42){var _0x3164b6=function(_0x22b0c7){while(--_0x22b0c7){_0x1bea5d['push'](_0x1bea5d['shift']());}};_0x3164b6(++_0x4bbc42);}(_0x251b,0x185));var _0xb251=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x251b[_0x28b0a1];return _0x21470c;};'use strict';var _=require(_0xb251('0x0'));var rp=require(_0xb251('0x1'));var md5=require(_0xb251('0x2'));var util=require(_0xb251('0x3'));var moment=require(_0xb251('0x4'));var Promise=require(_0xb251('0x5'));var Redis=require(_0xb251('0x6'));var intUtil=require(_0xb251('0x7'));var config=require(_0xb251('0x8'));var logger=require(_0xb251('0x9'))(_0xb251('0xa'));config[_0xb251('0xb')]=_['defaults'](config[_0xb251('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xb251('0xc'))(new Redis(config[_0xb251('0xb')]));function getAdminId(_0x923bc0,_0x4c385a,_0x62a96,_0x34ace7){return new Promise(function(_0x3a3a12,_0x59f5a1){var _0x3e0dee=![];var _0x420139={'method':_0xb251('0xd'),'uri':_0x34ace7+_0xb251('0xe'),'json':!![]};_0x420139['headers']=_0x62a96;logger[_0xb251('0xf')](_0xb251('0x10'));return rp(_0x420139)[_0xb251('0x11')](function(_0x2f72c8){if(_0x2f72c8){var _0x23587c=_0x2f72c8[_0xb251('0x12')];var _0x36b0d7=null;for(_0x36b0d7=0x0;_0x36b0d7<_0x23587c[_0xb251('0x13')];_0x36b0d7++){if(_0x23587c[_0x36b0d7]['email']===_0x923bc0[_0xb251('0x14')]){_0x923bc0[_0xb251('0x15')]=_0x23587c[_0x36b0d7]['id'];_0x3e0dee=!![];}}if(_0x3e0dee){logger[_0xb251('0xf')](_0xb251('0x16'),_0x923bc0[_0xb251('0x15')]);_0x3a3a12(_0x923bc0);}else{_0x59f5a1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x59f5a1({'statusCode':0x194,'message':_0xb251('0x17')});}})['catch'](function(_0xfe9723){logger['error']('['+[_0x4c385a[_0xb251('0x18')]()]+']',_0xfe9723[_0xb251('0x19')]);_0x59f5a1(_0xfe9723);});});}function getUser(_0x168e9e,_0xd21486,_0x3197c5){return function(_0xb07d0){return new Promise(function(_0x45a43a,_0x3130a4){var _0x4aa9f2={'method':'GET','uri':_0x3197c5+_0xb251('0xe'),'json':!![]};_0x4aa9f2[_0xb251('0x1a')]=_0xd21486;logger[_0xb251('0xf')]('Getting\x20user\x20list');return rp(_0x4aa9f2)['then'](function(_0x485b2f){if(_0x485b2f){var _0x2c8065=_0x485b2f[_0xb251('0x12')];var _0x4b8e09=![];var _0x39335d=null;if(_0xb07d0['agentEmail']!==null){logger[_0xb251('0xf')](_0xb251('0x1b'),_0xb07d0[_0xb251('0x1c')]);_0xb07d0[_0xb251('0x1d')]=_0xb07d0[_0xb251('0x1c')];for(_0x39335d=0x0;_0x39335d<_0x2c8065[_0xb251('0x13')];_0x39335d++){if(_0x2c8065[_0x39335d][_0xb251('0x1e')]===_0xb07d0[_0xb251('0x1c')]){_0x4b8e09=!![];_0xb07d0[_0xb251('0x1f')]=_0x2c8065[_0x39335d]['id'];logger[_0xb251('0xf')](_0xb251('0x20'),_0xb07d0[_0xb251('0x1f')]);}}}if(!_0x4b8e09){logger['info'](_0xb251('0x21'));_0xb07d0['userEmail']=_0xb07d0[_0xb251('0x14')];_0xb07d0[_0xb251('0x1f')]=_0xb07d0[_0xb251('0x15')];_0x4b8e09=!![];}if(_0x4b8e09){_0x45a43a(_0xb07d0);}else{_0x3130a4({'statusCode':0x194,'message':_0xb251('0x17')});}}else{_0x3130a4({'statusCode':0x194,'message':_0xb251('0x17')});}})['catch'](function(_0x48ed05){logger[_0xb251('0x22')]('['+[_0x168e9e[_0xb251('0x18')]()]+']',_0x48ed05[_0xb251('0x19')]);_0x3130a4(_0x48ed05);});});};}function searchContact(_0x23910a,_0x532ddd,_0x21ab86,_0x4f76c1){return new Promise(function(_0x522ea0,_0x3a873d){var _0x2039e4={'method':'GET','headers':_0x532ddd,'uri':_0x23910a+_0xb251('0x23')+_0x4f76c1+_0xb251('0x24')+_0x21ab86+_0xb251('0x25'),'json':!![]};rp(_0x2039e4)['then'](function(_0x2067e8){var _0x578e1e=_[_0xb251('0x26')](_0x2067e8[_0xb251('0x27')][_0xb251('0x27')],[_0x21ab86,_0x4f76c1]);_0x522ea0(_0x578e1e);})[_0xb251('0x28')](function(_0xf6750e){_0x3a873d(_0xf6750e);});});}function getEndUser(_0x5cc495,_0x436cf9,_0x534a47){return function(_0x35bed4){return new Promise(function(_0x538d70,_0x26db00){logger[_0xb251('0xf')](util['format'](_0xb251('0x29'),_0x35bed4[_0xb251('0x2a')]));searchContact(_0x534a47,_0x436cf9,_0xb251('0x2b'),_0x35bed4[_0xb251('0x2a')])[_0xb251('0x11')](function(_0x2c4ea2){if(_0x2c4ea2){_0x35bed4['endUserId']=_0x2c4ea2['id'];logger[_0xb251('0xf')](_0xb251('0x2c'),_0x35bed4['endUserId']);return _0x538d70(_0x35bed4);}searchContact(_0x534a47,_0x436cf9,_0xb251('0x2d'),_0x35bed4['contactNumber'])['then'](function(_0x295a62){if(_0x295a62){_0x35bed4[_0xb251('0x2e')]=_0x295a62['id'];logger[_0xb251('0xf')](_0xb251('0x2f'),_0x35bed4[_0xb251('0x2e')]);return _0x538d70(_0x35bed4);}createEndUser(_0x35bed4,_0x5cc495,_0x436cf9,_0x534a47)[_0xb251('0x11')](function(_0x937110){logger[_0xb251('0xf')](_0xb251('0x30'),_0x937110[_0xb251('0x2e')]);return _0x538d70(_0x937110);});});})[_0xb251('0x28')](function(_0x13c5f4){_0x26db00(_0x13c5f4);});});};}function createEndUser(_0x26e9a3,_0x9289c7,_0x353590,_0x58f5c1){return new Promise(function(_0x137792,_0x21040a){var _0x5bc790=moment();var _0x47dd9d={'method':_0xb251('0x31'),'uri':_0x58f5c1+_0xb251('0x32'),'body':{'contact':{'last_name':_0x26e9a3[_0xb251('0x2a')],'work_number':_0x26e9a3[_0xb251('0x2a')],'mobile_number':_0x26e9a3[_0xb251('0x2a')],'owner_id':_0x26e9a3[_0xb251('0x1f')],'created_at':_0x5bc790[_0xb251('0x33')](_0xb251('0x34'))}},'json':!![]};_0x47dd9d[_0xb251('0x1a')]=_0x353590;logger[_0xb251('0xf')](_0xb251('0x35'));return rp(_0x47dd9d)[_0xb251('0x11')](function(_0x69e041){_0x26e9a3[_0xb251('0x2e')]=_0x69e041[_0xb251('0x36')]['id'];_0x137792(_0x26e9a3);})[_0xb251('0x28')](function(_0x3b99e2){logger[_0xb251('0x22')]('['+[_0x9289c7[_0xb251('0x18')]()]+']',_0x3b99e2[_0xb251('0x19')]);_0x21040a(_0x3b99e2[_0xb251('0x19')]);});});}function getTicket(_0x1f13db,_0x197389,_0x176943,_0xceefe1,_0xa151a8){return function(_0x34d3b7){logger[_0xb251('0xf')](_0xb251('0x37'));return new Promise(function(_0x5b4ad7,_0x47bf36){var _0xdef67=moment();var _0x34584b={'method':_0xb251('0x31'),'uri':_0x176943+_0xb251('0x38'),'body':{'title':intUtil[_0xb251('0x39')](_0xceefe1['Subjects'],_0xa151a8,'\x20'),'description':intUtil[_0xb251('0x39')](_0xceefe1[_0xb251('0x3a')],_0xa151a8,'\x0a'),'owner_id':_0x34d3b7[_0xb251('0x1f')],'creater_id':_0x34d3b7['adminId'],'targetable_id':_0x34d3b7[_0xb251('0x2e')],'targetable_type':_0xb251('0x3b'),'created_at':_0xdef67['format'](_0xb251('0x34')),'due_date':_0xdef67['add'](0x1e,'m')[_0xb251('0x33')](_0xb251('0x34'))},'json':!![]};_0x34584b[_0xb251('0x1a')]=_0x197389;return rp(_0x34584b)['then'](function(_0x555f9b){_0x34d3b7[_0xb251('0x3c')]=_0x555f9b['task']['id'];logger['info'](_0xb251('0x3d'),_0x34d3b7[_0xb251('0x3c')]);_0x5b4ad7(_0x34d3b7);})[_0xb251('0x28')](function(_0x3d5764){logger[_0xb251('0x22')]('['+[_0x1f13db[_0xb251('0x18')]()]+']',_0x3d5764[_0xb251('0x19')]);_0x47bf36(_0x3d5764[_0xb251('0x19')]);});});};}function emit(_0x32618e,_0x18fba7,_0x3feb44){var _0x5a1a3a={'uri':_0x32618e+_0xb251('0x3e')+_0x3feb44};io['to'](util[_0xb251('0x33')]('user:%s',_0x18fba7))[_0xb251('0x3f')](_0xb251('0x40'),_0x5a1a3a);}exports['cs']=function(_0x5466c0,_0x377716,_0xd69f41,_0x173f76,_0x80202,_0x402df6,_0x4ce63a,_0x124460){var _0xcd90e5={};var _0x557a6b={'Authorization':_0xb251('0x41')+_0x402df6[_0xb251('0x42')]};_0x402df6[_0xb251('0x43')]=intUtil[_0xb251('0x44')](_0x402df6[_0xb251('0x43')]);_0x402df6[_0xb251('0x45')]=intUtil[_0xb251('0x44')](_0x402df6['serverUrl']);var _0x1514d0=_0x402df6[_0xb251('0x43')];_0xcd90e5['adminEmail']=_0x402df6[_0xb251('0x46')];_0xcd90e5[_0xb251('0x2a')]=_0x124460['toLowerCase']()==='outbound'?_0x377716['destcalleridnum']:_0x377716['calleridnum'];_0xcd90e5[_0xb251('0x47')]=_0x124460==='queue'||_0x124460===_0xb251('0x48')?_0xb251('0x49'):'outbound';if(_0x173f76){_0xcd90e5[_0xb251('0x1c')]=_0x173f76['email'];}var _0x132770=util[_0xb251('0x33')](_0xb251('0x4a'),_0x402df6[_0xb251('0x45')],_0x377716[_0xb251('0x4b')],md5(_0x377716[_0xb251('0x4b')]));if(_0x80202&&_0x80202[_0xb251('0x4c')]){logger['info'](_0xb251('0x4d'),'Recording\x20is\x20enabled!');_0x377716['recordingURL']=_0x132770;}else if(_0x4ce63a&&_0x4ce63a[_0xb251('0x4e')]&&_0x4ce63a[_0xb251('0x4e')]!==_0xb251('0x4f')){logger['info'](_0xb251('0x50'),'Recording\x20is\x20enabled!');_0x377716[_0xb251('0x51')]=_0x132770;}else{_0x377716['recordingURL']='';}return getAdminId(_0xcd90e5,_0x124460,_0x557a6b,_0x1514d0)[_0xb251('0x11')](getUser(_0x124460,_0x557a6b,_0x1514d0))[_0xb251('0x11')](getEndUser(_0x124460,_0x557a6b,_0x1514d0))[_0xb251('0x11')](getTicket(_0x124460,_0x557a6b,_0x1514d0,_0xd69f41,_0x377716))[_0xb251('0x11')](function(_0x4b20ab){logger['info'](util[_0xb251('0x33')](_0xb251('0x52'),_0x4b20ab['ticketId']));if(_0x124460!=='unmanaged'){logger[_0xb251('0xf')]('['+[_0x124460['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1514d0,_0x173f76['name'],_0x4b20ab[_0xb251('0x2e')]);}})[_0xb251('0x28')](function(_0x1cd309){logger[_0xb251('0x22')]('['+[_0x124460[_0xb251('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x1cd309,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa74a=['Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','GET','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','catch','POST','contactNumber','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','toUpperCase','message','Creating\x20new\x20task','getString','Descriptions'];(function(_0x58998c,_0x2b9ab4){var _0x9789db=function(_0x1c4108){while(--_0x1c4108){_0x58998c['push'](_0x58998c['shift']());}};_0x9789db(++_0x2b9ab4);}(_0xa74a,0x66));var _0xaa74=function(_0x50303d,_0x295b19){_0x50303d=_0x50303d-0x0;var _0x16b13f=_0xa74a[_0x50303d];return _0x16b13f;};'use strict';var _=require(_0xaa74('0x0'));var rp=require(_0xaa74('0x1'));var md5=require(_0xaa74('0x2'));var util=require(_0xaa74('0x3'));var moment=require(_0xaa74('0x4'));var Promise=require(_0xaa74('0x5'));var Redis=require('ioredis');var intUtil=require(_0xaa74('0x6'));var config=require(_0xaa74('0x7'));var logger=require(_0xaa74('0x8'))('freshsales');config['redis']=_[_0xaa74('0x9')](config[_0xaa74('0xa')],{'host':_0xaa74('0xb'),'port':0x18eb});var io=require(_0xaa74('0xc'))(new Redis(config[_0xaa74('0xa')]));function getAdminId(_0x5a3684,_0x197336,_0x5de8d6,_0x13b760){return new Promise(function(_0x502005,_0x29771f){var _0xbe2a51=![];var _0x4e5c4e={'method':_0xaa74('0xd'),'uri':_0x13b760+'/api/selector/owners','json':!![]};_0x4e5c4e[_0xaa74('0xe')]=_0x5de8d6;logger[_0xaa74('0xf')]('Getting\x20admin\x20information');return rp(_0x4e5c4e)[_0xaa74('0x10')](function(_0x28bc7f){if(_0x28bc7f){var _0x2065a1=_0x28bc7f[_0xaa74('0x11')];var _0x1455ab=null;for(_0x1455ab=0x0;_0x1455ab<_0x2065a1[_0xaa74('0x12')];_0x1455ab++){if(_0x2065a1[_0x1455ab][_0xaa74('0x13')]===_0x5a3684[_0xaa74('0x14')]){_0x5a3684[_0xaa74('0x15')]=_0x2065a1[_0x1455ab]['id'];_0xbe2a51=!![];}}if(_0xbe2a51){logger[_0xaa74('0xf')](_0xaa74('0x16'),_0x5a3684['adminId']);_0x502005(_0x5a3684);}else{_0x29771f({'statusCode':0x194,'message':_0xaa74('0x17')});}}else{_0x29771f({'statusCode':0x194,'message':_0xaa74('0x17')});}})['catch'](function(_0x3185f4){logger['error']('['+[_0x197336['toUpperCase']()]+']',_0x3185f4['message']);_0x29771f(_0x3185f4);});});}function getUser(_0x5925ac,_0xbe83ac,_0x4f9617){return function(_0x3d9b94){return new Promise(function(_0x57779d,_0x1c81ef){var _0x29eedb={'method':_0xaa74('0xd'),'uri':_0x4f9617+'/api/selector/owners','json':!![]};_0x29eedb['headers']=_0xbe83ac;logger['info']('Getting\x20user\x20list');return rp(_0x29eedb)[_0xaa74('0x10')](function(_0x163f06){if(_0x163f06){var _0x2c27dd=_0x163f06[_0xaa74('0x11')];var _0xcfc5ba=![];var _0x2b1d10=null;if(_0x3d9b94[_0xaa74('0x18')]!==null){logger[_0xaa74('0xf')]('Getting\x20user\x20with\x20email',_0x3d9b94[_0xaa74('0x18')]);_0x3d9b94[_0xaa74('0x19')]=_0x3d9b94[_0xaa74('0x18')];for(_0x2b1d10=0x0;_0x2b1d10<_0x2c27dd[_0xaa74('0x12')];_0x2b1d10++){if(_0x2c27dd[_0x2b1d10][_0xaa74('0x13')]===_0x3d9b94[_0xaa74('0x18')]){_0xcfc5ba=!![];_0x3d9b94[_0xaa74('0x1a')]=_0x2c27dd[_0x2b1d10]['id'];logger[_0xaa74('0xf')](_0xaa74('0x1b'),_0x3d9b94[_0xaa74('0x1a')]);}}}if(!_0xcfc5ba){logger['info'](_0xaa74('0x1c'));_0x3d9b94[_0xaa74('0x19')]=_0x3d9b94['adminEmail'];_0x3d9b94[_0xaa74('0x1a')]=_0x3d9b94['adminId'];_0xcfc5ba=!![];}if(_0xcfc5ba){_0x57779d(_0x3d9b94);}else{_0x1c81ef({'statusCode':0x194,'message':_0xaa74('0x17')});}}else{_0x1c81ef({'statusCode':0x194,'message':_0xaa74('0x17')});}})['catch'](function(_0x1361d6){logger[_0xaa74('0x1d')]('['+[_0x5925ac['toUpperCase']()]+']',_0x1361d6['message']);_0x1c81ef(_0x1361d6);});});};}function searchContact(_0x1ae058,_0x59c455,_0x40f328,_0x229418){return new Promise(function(_0x5a313b,_0x40bc29){var _0x2eb111={'method':'GET','headers':_0x59c455,'uri':_0x1ae058+'/api/lookup?q='+_0x229418+_0xaa74('0x1e')+_0x40f328+_0xaa74('0x1f'),'json':!![]};rp(_0x2eb111)[_0xaa74('0x10')](function(_0x33ab16){var _0x2624d3=_[_0xaa74('0x20')](_0x33ab16['contacts'][_0xaa74('0x21')],[_0x40f328,_0x229418]);_0x5a313b(_0x2624d3);})['catch'](function(_0xa8eefe){_0x40bc29(_0xa8eefe);});});}function getEndUser(_0x52fdfe,_0x2afb05,_0x3aff14){return function(_0x3d183d){return new Promise(function(_0x216202,_0x4fcb57){logger[_0xaa74('0xf')](util['format'](_0xaa74('0x22'),_0x3d183d['contactNumber']));searchContact(_0x3aff14,_0x2afb05,_0xaa74('0x23'),_0x3d183d['contactNumber'])[_0xaa74('0x10')](function(_0x599610){if(_0x599610){_0x3d183d[_0xaa74('0x24')]=_0x599610['id'];logger['info'](_0xaa74('0x25'),_0x3d183d[_0xaa74('0x24')]);return _0x216202(_0x3d183d);}searchContact(_0x3aff14,_0x2afb05,_0xaa74('0x26'),_0x3d183d['contactNumber'])[_0xaa74('0x10')](function(_0x4727db){if(_0x4727db){_0x3d183d[_0xaa74('0x24')]=_0x4727db['id'];logger[_0xaa74('0xf')]('Contact\x20found\x20work_number:',_0x3d183d[_0xaa74('0x24')]);return _0x216202(_0x3d183d);}createEndUser(_0x3d183d,_0x52fdfe,_0x2afb05,_0x3aff14)[_0xaa74('0x10')](function(_0x546971){logger[_0xaa74('0xf')](_0xaa74('0x27'),_0x546971['endUserId']);return _0x216202(_0x546971);});});})[_0xaa74('0x28')](function(_0x49d35d){_0x4fcb57(_0x49d35d);});});};}function createEndUser(_0x1e5f8f,_0x4db3ff,_0x3da413,_0x252b7b){return new Promise(function(_0x5d8405,_0xae0bc4){var _0x4a1c5d=moment();var _0x44c58c={'method':_0xaa74('0x29'),'uri':_0x252b7b+'/api/contacts','body':{'contact':{'last_name':_0x1e5f8f[_0xaa74('0x2a')],'work_number':_0x1e5f8f[_0xaa74('0x2a')],'mobile_number':_0x1e5f8f[_0xaa74('0x2a')],'owner_id':_0x1e5f8f[_0xaa74('0x1a')],'created_at':_0x4a1c5d[_0xaa74('0x2b')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x44c58c[_0xaa74('0xe')]=_0x3da413;logger[_0xaa74('0xf')](_0xaa74('0x2c'));return rp(_0x44c58c)[_0xaa74('0x10')](function(_0x353348){_0x1e5f8f[_0xaa74('0x24')]=_0x353348['contact']['id'];_0x5d8405(_0x1e5f8f);})[_0xaa74('0x28')](function(_0x57f6ec){logger[_0xaa74('0x1d')]('['+[_0x4db3ff[_0xaa74('0x2d')]()]+']',_0x57f6ec[_0xaa74('0x2e')]);_0xae0bc4(_0x57f6ec[_0xaa74('0x2e')]);});});}function getTicket(_0x56c7cf,_0x888cc1,_0x1b1a4a,_0x2a3e63,_0x5bcc67){return function(_0x3bbd50){logger[_0xaa74('0xf')](_0xaa74('0x2f'));return new Promise(function(_0x562d03,_0x20b1c3){var _0x529fdf=moment();var _0x151d2a={'method':_0xaa74('0x29'),'uri':_0x1b1a4a+'/api/tasks','body':{'title':intUtil[_0xaa74('0x30')](_0x2a3e63['Subjects'],_0x5bcc67,'\x20'),'description':intUtil[_0xaa74('0x30')](_0x2a3e63[_0xaa74('0x31')],_0x5bcc67,'\x0a'),'owner_id':_0x3bbd50[_0xaa74('0x1a')],'creater_id':_0x3bbd50[_0xaa74('0x15')],'targetable_id':_0x3bbd50['endUserId'],'targetable_type':_0xaa74('0x32'),'created_at':_0x529fdf[_0xaa74('0x2b')](_0xaa74('0x33')),'due_date':_0x529fdf[_0xaa74('0x34')](0x1e,'m')[_0xaa74('0x2b')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x151d2a[_0xaa74('0xe')]=_0x888cc1;return rp(_0x151d2a)[_0xaa74('0x10')](function(_0x560658){_0x3bbd50[_0xaa74('0x35')]=_0x560658['task']['id'];logger[_0xaa74('0xf')](_0xaa74('0x36'),_0x3bbd50['ticketId']);_0x562d03(_0x3bbd50);})[_0xaa74('0x28')](function(_0xf01dde){logger[_0xaa74('0x1d')]('['+[_0x56c7cf[_0xaa74('0x2d')]()]+']',_0xf01dde[_0xaa74('0x2e')]);_0x20b1c3(_0xf01dde[_0xaa74('0x2e')]);});});};}function emit(_0x4d424b,_0x3936bf,_0x2f6295){var _0x23116a={'uri':_0x4d424b+'/contacts/'+_0x2f6295};io['to'](util[_0xaa74('0x2b')](_0xaa74('0x37'),_0x3936bf))[_0xaa74('0x38')]('trigger:browser:url',_0x23116a);}exports['cs']=function(_0x764c14,_0x519846,_0x3631ed,_0x2a81e8,_0x52b2f5,_0x1a0a5f,_0x15e073,_0x28c34c){var _0x2f8254={};var _0x1584d8={'Authorization':_0xaa74('0x39')+_0x1a0a5f[_0xaa74('0x3a')]};_0x1a0a5f[_0xaa74('0x3b')]=intUtil['stripTrailingSlash'](_0x1a0a5f['remoteUri']);_0x1a0a5f[_0xaa74('0x3c')]=intUtil[_0xaa74('0x3d')](_0x1a0a5f[_0xaa74('0x3c')]);var _0x49cec8=_0x1a0a5f['remoteUri'];_0x2f8254['adminEmail']=_0x1a0a5f[_0xaa74('0x3e')];_0x2f8254[_0xaa74('0x2a')]=_0x28c34c[_0xaa74('0x3f')]()===_0xaa74('0x40')?_0x519846['destcalleridnum']:_0x519846['calleridnum'];_0x2f8254['callDirection']=_0x28c34c===_0xaa74('0x41')||_0x28c34c===_0xaa74('0x42')?_0xaa74('0x41'):'outbound';if(_0x2a81e8){_0x2f8254['agentEmail']=_0x2a81e8[_0xaa74('0x13')];}var _0x38ab13=util[_0xaa74('0x2b')](_0xaa74('0x43'),_0x1a0a5f[_0xaa74('0x3c')],_0x519846['uniqueid'],md5(_0x519846[_0xaa74('0x44')]));if(_0x52b2f5&&_0x52b2f5[_0xaa74('0x45')]){logger[_0xaa74('0xf')]('[QUEUE]',_0xaa74('0x46'));_0x519846['recordingURL']=_0x38ab13;}else if(_0x15e073&&_0x15e073['recordingFormat']&&_0x15e073['recordingFormat']!==_0xaa74('0x47')){logger[_0xaa74('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x519846[_0xaa74('0x48')]=_0x38ab13;}else{_0x519846[_0xaa74('0x48')]='';}return getAdminId(_0x2f8254,_0x28c34c,_0x1584d8,_0x49cec8)[_0xaa74('0x10')](getUser(_0x28c34c,_0x1584d8,_0x49cec8))[_0xaa74('0x10')](getEndUser(_0x28c34c,_0x1584d8,_0x49cec8))[_0xaa74('0x10')](getTicket(_0x28c34c,_0x1584d8,_0x49cec8,_0x3631ed,_0x519846))[_0xaa74('0x10')](function(_0x10bb23){logger[_0xaa74('0xf')](util[_0xaa74('0x2b')](_0xaa74('0x49'),_0x10bb23[_0xaa74('0x35')]));if(_0x28c34c!==_0xaa74('0x42')){logger[_0xaa74('0xf')]('['+[_0x28c34c[_0xaa74('0x2d')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x49cec8,_0x2a81e8[_0xaa74('0x4a')],_0x10bb23[_0xaa74('0x24')]);}})[_0xaa74('0x28')](function(_0x1ab376){logger[_0xaa74('0x1d')]('['+[_0x28c34c[_0xaa74('0x2d')]()]+_0xaa74('0x4b'),util['inspect'](_0x1ab376,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index a321af0..e23aff3 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 _0x13f6=['includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','data1','freshdesk','zoho','desk','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','vtiger','dynamics365','freshsales','servicenow'];(function(_0x1e65c1,_0x82f104){var _0x476f83=function(_0x34d835){while(--_0x34d835){_0x1e65c1['push'](_0x1e65c1['shift']());}};_0x476f83(++_0x82f104);}(_0x13f6,0x124));var _0x613f=function(_0x448359,_0x3faace){_0x448359=_0x448359-0x0;var _0x23ca1c=_0x13f6[_0x448359];return _0x23ca1c;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x613f('0x2'));var freshdesk=require(_0x613f('0x3'));var zoho=require(_0x613f('0x4'));var desk=require('./desk');var vtiger=require(_0x613f('0x5'));var servicenow=require(_0x613f('0x6'));var dynamics365=require(_0x613f('0x7'));var freshsales=require('./freshsales');var integrations=[_0x613f('0x8'),_0x613f('0x9'),'sugarcrm','freshdesk','zoho','desk',_0x613f('0xa'),_0x613f('0xb'),_0x613f('0xc'),_0x613f('0xd')];exports['exec']=function(_0x1a8dd0,_0x40d7f5,_0xcd514c,_0x5210a0,_0x2622f3,_0x164edf){if(_0xcd514c){if(_[_0x613f('0xe')](integrations,_0x1a8dd0['data1'][_0x613f('0xf')]())){try{var _0xa81fcd=null;var _0x542230='';var _0x4c2a85=_0xcd514c[_0x1a8dd0['data1'][_0x613f('0xf')]()];if(_0x4c2a85){var _0x1ebab5=_0x4c2a85[_0x1a8dd0[_0x613f('0x10')]];if(_0x1ebab5){var _0x375db1=_[_0x613f('0x11')](_0x1ebab5[_0x613f('0x12')],{'id':parseInt(_0x1a8dd0[_0x613f('0x13')],0xa)});if(_0x375db1){if(_0x5210a0){if(_0x2622f3&&_0x40d7f5[_0x613f('0x14')]){_0x542230=_0x613f('0x14');}else if(_0x40d7f5[_0x613f('0x15')]){_0x542230='outbound';}else{console[_0x613f('0x16')]('EVENT\x20UNKNOWN',_0x40d7f5);}}else{_0x542230='unmanaged';}switch(_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')]()){case'zendesk':zendesk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x9'):salesforce[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case'sugarcrm':sugarcrm[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x18'):freshdesk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x19'):zoho[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x1a'):desk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0xa'):vtiger[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0xc'):freshsales['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;case _0x613f('0xd'):servicenow['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;case'dynamics365':dynamics365['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;default:console['log'](_0x613f('0x1b'));}}else{_0xa81fcd=require('../../../../config/logger')(_0x1a8dd0['data1'][_0x613f('0xf')]());_0xa81fcd[_0x613f('0x1c')]('[EXEC]',util[_0x613f('0x1d')](_0x613f('0x1e'),_0x1a8dd0[_0x613f('0x17')]['toLowerCase'](),_0x1a8dd0['data3']));}}else{_0xa81fcd=require(_0x613f('0x1f'))(_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')]());_0xa81fcd['error'](_0x613f('0x20'),util[_0x613f('0x1d')](_0x613f('0x21'),_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')](),_0x1a8dd0['data2']));}}else{}}catch(_0x30fb15){console[_0x613f('0x1c')](_0x30fb15);}}}}; \ No newline at end of file +var _0x14a0=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','freshsales','data1','toLowerCase','data2','find','Configurations','queue','outbound','log','unmanaged','salesforce','sugarcrm','vtiger','servicenow','dynamics365'];(function(_0x1bc77c,_0x8bf8da){var _0xd9fe11=function(_0x2ca2e4){while(--_0x2ca2e4){_0x1bc77c['push'](_0x1bc77c['shift']());}};_0xd9fe11(++_0x8bf8da);}(_0x14a0,0x8e));var _0x014a=function(_0xf6fc7c,_0x4c29ab){_0xf6fc7c=_0xf6fc7c-0x0;var _0xccc936=_0x14a0[_0xf6fc7c];return _0xccc936;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var zendesk=require(_0x014a('0x1'));var salesforce=require(_0x014a('0x2'));var sugarcrm=require(_0x014a('0x3'));var freshdesk=require(_0x014a('0x4'));var zoho=require(_0x014a('0x5'));var desk=require(_0x014a('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x014a('0x7'));var freshsales=require(_0x014a('0x8'));var integrations=[_0x014a('0x9'),'salesforce','sugarcrm',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'vtiger','dynamics365',_0x014a('0xd'),'servicenow'];exports['exec']=function(_0x5aa52f,_0x4f3539,_0x330469,_0x4c7418,_0x431be8,_0x168c70){if(_0x330469){if(_['includes'](integrations,_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]())){try{var _0x2c84ad=null;var _0x43bfeb='';var _0x1bcd1=_0x330469[_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()];if(_0x1bcd1){var _0x23c917=_0x1bcd1[_0x5aa52f[_0x014a('0x10')]];if(_0x23c917){var _0x71535d=_[_0x014a('0x11')](_0x23c917[_0x014a('0x12')],{'id':parseInt(_0x5aa52f['data3'],0xa)});if(_0x71535d){if(_0x4c7418){if(_0x431be8&&_0x4f3539[_0x014a('0x13')]){_0x43bfeb=_0x014a('0x13');}else if(_0x4f3539['routeId']){_0x43bfeb=_0x014a('0x14');}else{console[_0x014a('0x15')]('EVENT\x20UNKNOWN',_0x4f3539);}}else{_0x43bfeb=_0x014a('0x16');}switch(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()){case _0x014a('0x9'):zendesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x17'):salesforce[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x18'):sugarcrm[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xa'):freshdesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xb'):zoho[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xc'):desk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x19'):vtiger[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xd'):freshsales['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1a'):servicenow['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1b'):dynamics365['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;default:console[_0x014a('0x15')]('unknown\x20integration');}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x20'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f['data3']));}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f['data1'][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x21'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f[_0x014a('0x10')]));}}else{}}catch(_0x165a42){console['error'](_0x165a42);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 6ee2f13..401b0b4 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 _0x71e0=['newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','error','stringify','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','request-promise','bluebird','md5','jsforce','ioredis','./util','../../../../config/logger','redis','defaults','socket.io-emitter','emit','assign','utc','getString','Subjects','Descriptions','WhoId','ContactId','sobject','ticketType','isNil','validateEmail','User','find','execute','length','Email','info','Agent\x20%s\x20found.','Name','identity','then','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Task','upperFirst','create','forEach','type','idField','content','toString','variable','variableName','customVariable','name','toLowerCase','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display'];(function(_0x5bd789,_0x29703d){var _0x63d1db=function(_0x206077){while(--_0x206077){_0x5bd789['push'](_0x5bd789['shift']());}};_0x63d1db(++_0x29703d);}(_0x71e0,0x160));var _0x071e=function(_0x5ba34b,_0x539df5){_0x5ba34b=_0x5ba34b-0x0;var _0x5d1351=_0x71e0[_0x5ba34b];return _0x5d1351;};'use strict';var _=require('lodash');var rp=require(_0x071e('0x0'));var moment=require('moment');var BPromise=require(_0x071e('0x1'));var md5=require(_0x071e('0x2'));var jsforce=require(_0x071e('0x3'));var util=require('util');var Redis=require(_0x071e('0x4'));var intUtil=require(_0x071e('0x5'));var config=require('../../../../config/environment');var logger=require(_0x071e('0x6'))('salesforce');config[_0x071e('0x7')]=_[_0x071e('0x8')](config[_0x071e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x071e('0x9'))(new Redis(config[_0x071e('0x7')]));function emit(_0x2b5c55,_0x419a84,_0x4f0719){io['to'](_0x2b5c55)[_0x071e('0xa')](_0x419a84,_0x4f0719);}function getTicket(_0x3087e8,_0x397e2c,_0x589844,_0x22639c,_0xd98ab1,_0x3405ce,_0x3a815e,_0x5f40cd){var _0xa6528c={};if(_0x22639c['ticketType']==='Task'){_0xa6528c=Object[_0x071e('0xb')]({},{'OwnerId':_0x397e2c['id'],'ActivityDate':moment[_0x071e('0xc')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xe')],_0xd98ab1,'\x20'),'Description':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xf')],_0xd98ab1,'\x0a')},getCustomFields(_0x3405ce,_0xd98ab1));if(_0x589844){_0xa6528c[_0x071e('0x10')]=_0x589844['id'];}}else if(_0x22639c['ticketType']==='Case'){_0xa6528c=Object[_0x071e('0xb')]({},{'OwnerId':_0x397e2c['id'],'Subject':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xe')],_0xd98ab1,'\x20'),'Description':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xf')],_0xd98ab1,'\x0a')},getCustomFields(_0x3405ce,_0xd98ab1));if(_0x589844){_0xa6528c[_0x071e('0x11')]=_0x589844['id'];}}return _0x3a815e[_0x071e('0x12')](_0x22639c[_0x071e('0x13')])['create'](_0xa6528c);}function getUser(_0x21fa92,_0x1f6fb1,_0xdebebd){if(!_[_0x071e('0x14')](_0x1f6fb1)&&intUtil[_0x071e('0x15')](_0x1f6fb1)){var _0x653bde={'Email':_0x1f6fb1};var _0x54528b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xdebebd[_0x071e('0x12')](_0x071e('0x16'))[_0x071e('0x17')](_0x653bde,_0x54528b)[_0x071e('0x18')]()['then'](function(_0x240ca8){if(_0x240ca8[_0x071e('0x19')]){var _0x9715d9=_[_0x071e('0x17')](_0x240ca8,function(_0x13dadc){return _0x13dadc[_0x071e('0x1a')]===_0x1f6fb1;});if(_0x9715d9){logger[_0x071e('0x1b')](_0x071e('0x1c'),_0x1f6fb1);return BPromise['resolve']({'id':_0x9715d9['Id'],'name':_0x9715d9[_0x071e('0x1d')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1f6fb1);return _0xdebebd[_0x071e('0x1e')]()[_0x071e('0x1f')](function(_0x482983){return BPromise[_0x071e('0x20')]({'id':_0x482983[_0x071e('0x21')],'name':_0x482983[_0x071e('0x22')]});});}});}else{logger[_0x071e('0x1b')](_0x071e('0x23'),_0x1f6fb1);return _0xdebebd['identity']()[_0x071e('0x1f')](function(_0x135779){return BPromise[_0x071e('0x20')]({'id':_0x135779['user_id'],'name':_0x135779[_0x071e('0x22')]});});}}function getEndUser(_0x592d43,_0x2fb050,_0x15b6d3,_0x221c6f,_0x4b0055){var _0x52d9ed={'Phone':_0x221c6f};var _0x12654b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x071e('0x20')]()[_0x071e('0x1f')](function(){if(_0x2fb050[_0x071e('0x13')]==='Task'){logger[_0x071e('0x1b')](_0x071e('0x24'),_0x221c6f,_0x2fb050[_0x071e('0x25')]);switch(_0x2fb050[_0x071e('0x25')]){case _0x071e('0x26'):return _0x4b0055[_0x071e('0x12')](_0x071e('0x27'))[_0x071e('0x17')](_0x52d9ed,_0x12654b)[_0x071e('0x18')]()[_0x071e('0x1f')](function(_0x4df417){if(_0x4df417&&_0x4df417[_0x071e('0x19')]){return _0x4df417;}else{return _0x4b0055[_0x071e('0x12')](_0x071e('0x28'))[_0x071e('0x17')](_0x52d9ed,_0x12654b);}});case _0x071e('0x29'):return _0x4b0055['sobject'](_0x071e('0x27'))[_0x071e('0x17')](_0x52d9ed,_0x12654b)['execute']();case _0x071e('0x2a'):return _0x4b0055[_0x071e('0x12')](_0x071e('0x28'))[_0x071e('0x17')](_0x52d9ed,_0x12654b);default:return null;}}else if(_0x2fb050[_0x071e('0x13')]==='Case'){logger[_0x071e('0x1b')](_0x071e('0x24'),_0x221c6f,'contact');return _0x4b0055[_0x071e('0x12')](_0x071e('0x27'))[_0x071e('0x17')](_0x52d9ed,_0x12654b)[_0x071e('0x18')]();}})['then'](function(_0x393873){if(_0x393873&&_0x393873[_0x071e('0x19')]){var _0x507064=_[_0x071e('0x17')](_0x393873,function(_0x4151ae){return _0x4151ae['Phone']===_0x221c6f;});if(_0x507064){return BPromise[_0x071e('0x20')]({'id':_0x507064['Id'],'name':_0x507064[_0x071e('0x1d')],'phone':_0x507064[_0x071e('0x2b')]});}}})[_0x071e('0x1f')](function(_0x16a37f){if(_0x16a37f){logger[_0x071e('0x1b')](_0x071e('0x2c'),_0x221c6f);return BPromise['resolve'](_0x16a37f);}else{logger[_0x071e('0x1b')](_0x071e('0x2d'),_0x221c6f);var _0x3f9655={'LastName':_0x15b6d3!==_0x071e('0x2e')?_0x15b6d3:util[_0x071e('0x2f')](_0x071e('0x30'),_0x221c6f),'Phone':_0x221c6f};if(_0x2fb050[_0x071e('0x31')]){if(_0x2fb050[_0x071e('0x31')]===_0x071e('0x29')){logger['info'](_0x071e('0x32'),_0x221c6f,_0x2fb050[_0x071e('0x31')]);}else if(_0x2fb050[_0x071e('0x31')]===_0x071e('0x2a')&&_0x2fb050['ticketType']===_0x071e('0x33')){logger[_0x071e('0x1b')](_0x071e('0x32'),_0x221c6f,_0x2fb050['moduleCreate']);_0x3f9655['Company']='No\x20Company';}else{return null;}}return _0x4b0055['sobject'](_[_0x071e('0x34')](_0x2fb050[_0x071e('0x31')]))[_0x071e('0x35')](_0x3f9655);}});}function getCustomFields(_0x5ac883,_0x361d49){var _0x190b3c={};if(_0x5ac883[_0x071e('0x19')]>0x0){_[_0x071e('0x36')](_0x5ac883,function(_0x244b78){if(_0x244b78[_0x071e('0x37')]==='string'&&_0x244b78[_0x071e('0x38')]){_0x190b3c[_0x244b78['idField']]=_0x244b78[_0x071e('0x39')][_0x071e('0x3a')]();}else if(_0x244b78[_0x071e('0x37')]===_0x071e('0x3b')&&_0x244b78[_0x071e('0x3c')]&&_0x244b78[_0x071e('0x38')]){_0x361d49[_0x244b78['variableName']]&&(_0x190b3c[_0x244b78[_0x071e('0x38')]]=_0x361d49[_0x244b78[_0x071e('0x3c')]][_0x071e('0x3a')]());}else if(_0x244b78[_0x071e('0x37')]===_0x071e('0x3d')&&_0x244b78['Variable']&&_0x244b78['Variable'][_0x071e('0x3e')]&&_0x244b78[_0x071e('0x38')]){_0x361d49[_0x244b78['Variable']['name'][_0x071e('0x3f')]()]&&(_0x190b3c[_0x244b78['idField']]=_0x361d49[_0x244b78[_0x071e('0x40')][_0x071e('0x3e')][_0x071e('0x3f')]()][_0x071e('0x3a')]());}});}return _0x190b3c;}function getConnection(_0x3d5019){var _0x3365a8=_0x3d5019[_0x071e('0x41')][_0x071e('0x42')](_0x3d5019[_0x071e('0x43')]);var _0x4c84db=new jsforce[(_0x071e('0x44'))]({'oauth2':{'loginUrl':_0x3d5019[_0x071e('0x45')]||_0x071e('0x46'),'clientId':_0x3d5019[_0x071e('0x47')],'clientSecret':_0x3d5019['clientSecret']}});return _0x4c84db[_0x071e('0x48')](_0x3d5019[_0x071e('0x49')],_0x3365a8)[_0x071e('0x1f')](function(){logger[_0x071e('0x1b')]('Connection\x20established.');return _0x4c84db;});}exports[_0x071e('0x4a')]=function(_0x5350ed,_0x256e5d,_0xcc911e,_0x2dcdb9,_0x3b1d73,_0x27e714){var _0x3da1db,_0x39bbf4,_0x5c3089,_0x5d978a;_0x27e714[_0x071e('0x4b')]=intUtil[_0x071e('0x4c')](_0x27e714[_0x071e('0x4b')]);_0x27e714[_0x071e('0x45')]=intUtil[_0x071e('0x4c')](_0x27e714[_0x071e('0x45')]);if(_0x3b1d73&&_0x3b1d73[_0x071e('0x4d')]){logger[_0x071e('0x1b')]('[QUEUE]',_0x071e('0x4e'));_0x256e5d[_0x071e('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27e714[_0x071e('0x4b')],_0x256e5d['uniqueid'],md5(_0x256e5d[_0x071e('0x50')]));}else{_0x256e5d[_0x071e('0x4f')]='';}return getConnection(_0x27e714)['then'](function(_0x47d3fa){_0x5d978a=_0x47d3fa;return getUser(_0x27e714,_0x2dcdb9[_0x071e('0x51')],_0x5d978a);})[_0x071e('0x1f')](function(_0x15d56e){_0x3da1db=_0x15d56e;return getEndUser(_0x27e714,_0xcc911e,_0x256e5d['calleridname'],_0x256e5d[_0x071e('0x52')],_0x5d978a);})[_0x071e('0x1f')](function(_0x1e6799){_0x39bbf4=_0x1e6799;return getTicket(_0x27e714,_0x3da1db,_0x39bbf4,_0xcc911e,_0x256e5d,_0xcc911e[_0x071e('0x53')],_0x5d978a,_0x071e('0x4a'));})[_0x071e('0x1f')](function(_0x21fb48){_0x5c3089=_0x21fb48;logger[_0x071e('0x1b')](_0x071e('0x54'),_0x5c3089['id']);logger['info'](_0x071e('0x55'),_0x5c3089['id'],_0x2dcdb9['name'],_0x27e714[_0x071e('0x37')]);switch(_0x27e714['type']){case'integrationTab':emit(util[_0x071e('0x2f')](_0x071e('0x56'),_0x2dcdb9['name']),_0x071e('0x57'),{'recordId':_0x5c3089['id']});break;case _0x071e('0x58'):emit(util[_0x071e('0x2f')](_0x071e('0x56'),_0x2dcdb9[_0x071e('0x3e')]),_0x071e('0x59'),{'uri':util['format'](_0x071e('0x5a'),_0x5d978a[_0x071e('0x5b')],_0x5c3089['id'])});break;default:logger['error'](_0x071e('0x5c'));}})[_0x071e('0x5d')](function(_0x338189){logger['error'](_0x071e('0x5e'),JSON['stringify'](_0x338189));});};exports['outbound']=function(_0xabd3dc,_0x5d0813,_0x497ae8,_0xa882d3,_0x41cb39,_0x43218f,_0xc142d6){var _0x120d47,_0x3deb1c,_0xc6a1d9,_0x3f67fa;_0x43218f['serverUrl']=intUtil[_0x071e('0x4c')](_0x43218f[_0x071e('0x4b')]);_0x43218f[_0x071e('0x45')]=intUtil[_0x071e('0x4c')](_0x43218f[_0x071e('0x45')]);if(_0xc142d6&&_0xc142d6[_0x071e('0x5f')]&&_0xc142d6[_0x071e('0x5f')]!==_0x071e('0x60')){logger[_0x071e('0x1b')](_0x071e('0x61'),_0x071e('0x4e'));_0x5d0813[_0x071e('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43218f[_0x071e('0x4b')],_0x5d0813[_0x071e('0x50')],md5(_0x5d0813[_0x071e('0x50')]));}return getConnection(_0x43218f)[_0x071e('0x1f')](function(_0x4bb73b){_0x3f67fa=_0x4bb73b;return getUser(_0x43218f,_0xa882d3['email'],_0x3f67fa);})[_0x071e('0x1f')](function(_0x2a3a7d){_0x120d47=_0x2a3a7d;return getEndUser(_0x43218f,_0x497ae8,_0x5d0813[_0x071e('0x62')],_0x5d0813[_0x071e('0x63')],_0x3f67fa);})[_0x071e('0x1f')](function(_0x4edd39){_0x3deb1c=_0x4edd39;return getTicket(_0x43218f,_0x120d47,_0x3deb1c,_0x497ae8,_0x5d0813,_0x497ae8[_0x071e('0x53')],_0x3f67fa,_0x071e('0x64'));})[_0x071e('0x1f')](function(_0x27d8fd){_0xc6a1d9=_0x27d8fd;logger[_0x071e('0x1b')](_0x071e('0x65'),_0xc6a1d9['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xc6a1d9['id'],_0xa882d3[_0x071e('0x3e')],_0x43218f['type']);switch(_0x43218f['type']){case _0x071e('0x66'):emit(util['format'](_0x071e('0x56'),_0xa882d3['name']),_0x071e('0x57'),{'recordId':_0xc6a1d9['id']});break;case'newTab':emit(util['format'](_0x071e('0x56'),_0xa882d3['name']),_0x071e('0x59'),{'uri':util[_0x071e('0x2f')]('%s/%s/e',_0x3f67fa[_0x071e('0x5b')],_0xc6a1d9['id'])});break;default:logger['error'](_0x071e('0x61'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x071e('0x5d')](function(_0x28b075){logger[_0x071e('0x67')]('[OUTBOUND]',JSON[_0x071e('0x68')](_0x28b075));});};exports[_0x071e('0x69')]=function(_0x32f053,_0x4b86f8,_0x4804e4,_0x187c92,_0x37fac3,_0x2a5e11){var _0x3f47ff,_0x3b9ac4,_0x5138ca,_0x924279;_0x2a5e11[_0x071e('0x4b')]=intUtil[_0x071e('0x4c')](_0x2a5e11['serverUrl']);_0x2a5e11[_0x071e('0x45')]=intUtil['stripTrailingSlash'](_0x2a5e11[_0x071e('0x45')]);if(_0x37fac3&&_0x37fac3[_0x071e('0x4d')]){logger[_0x071e('0x1b')]('['+_0x4b86f8[_0x071e('0x6a')][_0x071e('0x6b')]()+']','Recording\x20is\x20enabled!');_0x4b86f8[_0x071e('0x4f')]=util[_0x071e('0x2f')](_0x071e('0x6c'),_0x2a5e11[_0x071e('0x4b')],_0x4b86f8[_0x071e('0x50')],md5(_0x4b86f8[_0x071e('0x50')]));}else{_0x4b86f8[_0x071e('0x4f')]='';}return getConnection(_0x2a5e11)[_0x071e('0x1f')](function(_0x17225d){_0x924279=_0x17225d;if(!_[_0x071e('0x14')](_0x187c92)){return getUser(_0x2a5e11,_0x187c92[_0x071e('0x3e')],_0x924279);}else{return getUser(_0x2a5e11,null,_0x924279);}})[_0x071e('0x1f')](function(_0x48b854){_0x3f47ff=_0x48b854;return getEndUser(_0x2a5e11,_0x4804e4,_0x4b86f8[_0x071e('0x6d')],_0x4b86f8[_0x071e('0x52')],_0x924279);})[_0x071e('0x1f')](function(_0xeee41e){_0x3b9ac4=_0xeee41e;return getTicket(_0x2a5e11,_0x3f47ff,_0x3b9ac4,_0x4804e4,_0x4b86f8,_0x4804e4[_0x071e('0x53')],_0x924279);})[_0x071e('0x1f')](function(_0x325d7b){_0x5138ca=_0x325d7b;logger[_0x071e('0x1b')]('['+_0x4b86f8['lastevent'][_0x071e('0x6b')]()+']\x20Ticket\x20%s\x20created.',_0x5138ca['id']);logger['info']('['+_0x4b86f8[_0x071e('0x6a')][_0x071e('0x6b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x2a5e11[_0x071e('0x37')]);})['catch'](function(_0x436df5){logger[_0x071e('0x67')]('['+_0x4b86f8[_0x071e('0x6a')][_0x071e('0x6b')]()+']',JSON[_0x071e('0x68')](_0x436df5));});}; \ No newline at end of file +var _0x08c5=['resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','lead','Case','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','string','idField','toString','type','variable','variableName','customVariable','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','recordingURL','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','ContactId','sobject','create','isNil','validateEmail','User','find','execute','length','info','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then'];(function(_0xff6314,_0xdd09b){var _0x1d38f4=function(_0x25b328){while(--_0x25b328){_0xff6314['push'](_0xff6314['shift']());}};_0x1d38f4(++_0xdd09b);}(_0x08c5,0x197));var _0x508c=function(_0x1acb08,_0x1a1c0e){_0x1acb08=_0x1acb08-0x0;var _0x183cef=_0x08c5[_0x1acb08];return _0x183cef;};'use strict';var _=require(_0x508c('0x0'));var rp=require('request-promise');var moment=require(_0x508c('0x1'));var BPromise=require(_0x508c('0x2'));var md5=require('md5');var jsforce=require(_0x508c('0x3'));var util=require(_0x508c('0x4'));var Redis=require('ioredis');var intUtil=require(_0x508c('0x5'));var config=require(_0x508c('0x6'));var logger=require(_0x508c('0x7'))(_0x508c('0x8'));config[_0x508c('0x9')]=_['defaults'](config[_0x508c('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x508c('0x9')]));function emit(_0x47aaec,_0x254413,_0x41b5d4){io['to'](_0x47aaec)[_0x508c('0xa')](_0x254413,_0x41b5d4);}function getTicket(_0x8d145a,_0xc2b6d8,_0x295549,_0x2674cc,_0x408bfb,_0x3e78de,_0x2b11d2,_0xa8da75){var _0x77b64c={};if(_0x2674cc[_0x508c('0xb')]===_0x508c('0xc')){_0x77b64c=Object[_0x508c('0xd')]({},{'OwnerId':_0xc2b6d8['id'],'ActivityDate':moment[_0x508c('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x508c('0xf')](_0x2674cc[_0x508c('0x10')],_0x408bfb,'\x20'),'Description':intUtil[_0x508c('0xf')](_0x2674cc[_0x508c('0x11')],_0x408bfb,'\x0a')},getCustomFields(_0x3e78de,_0x408bfb));if(_0x295549){_0x77b64c[_0x508c('0x12')]=_0x295549['id'];}}else if(_0x2674cc['ticketType']==='Case'){_0x77b64c=Object[_0x508c('0xd')]({},{'OwnerId':_0xc2b6d8['id'],'Subject':intUtil['getString'](_0x2674cc[_0x508c('0x10')],_0x408bfb,'\x20'),'Description':intUtil[_0x508c('0xf')](_0x2674cc['Descriptions'],_0x408bfb,'\x0a')},getCustomFields(_0x3e78de,_0x408bfb));if(_0x295549){_0x77b64c[_0x508c('0x13')]=_0x295549['id'];}}return _0x2b11d2[_0x508c('0x14')](_0x2674cc[_0x508c('0xb')])[_0x508c('0x15')](_0x77b64c);}function getUser(_0x458860,_0x160875,_0x4ffe57){if(!_[_0x508c('0x16')](_0x160875)&&intUtil[_0x508c('0x17')](_0x160875)){var _0x2850b3={'Email':_0x160875};var _0x2f470e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ffe57[_0x508c('0x14')](_0x508c('0x18'))[_0x508c('0x19')](_0x2850b3,_0x2f470e)[_0x508c('0x1a')]()['then'](function(_0x453398){if(_0x453398[_0x508c('0x1b')]){var _0x3dbfd4=_['find'](_0x453398,function(_0x1b3ff0){return _0x1b3ff0['Email']===_0x160875;});if(_0x3dbfd4){logger[_0x508c('0x1c')]('Agent\x20%s\x20found.',_0x160875);return BPromise['resolve']({'id':_0x3dbfd4['Id'],'name':_0x3dbfd4[_0x508c('0x1d')]});}}else{logger[_0x508c('0x1c')](_0x508c('0x1e'),_0x160875);return _0x4ffe57[_0x508c('0x1f')]()[_0x508c('0x20')](function(_0x518092){return BPromise[_0x508c('0x21')]({'id':_0x518092[_0x508c('0x22')],'name':_0x518092[_0x508c('0x23')]});});}});}else{logger['info'](_0x508c('0x1e'),_0x160875);return _0x4ffe57[_0x508c('0x1f')]()[_0x508c('0x20')](function(_0x3b9061){return BPromise['resolve']({'id':_0x3b9061[_0x508c('0x22')],'name':_0x3b9061[_0x508c('0x23')]});});}}function getEndUser(_0x217a13,_0x5c6d3f,_0x1a2bba,_0x41dc72,_0x2b6a74){var _0x1cc702={'Phone':_0x41dc72};var _0x132245={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x508c('0x21')]()[_0x508c('0x20')](function(){if(_0x5c6d3f['ticketType']===_0x508c('0xc')){logger[_0x508c('0x1c')](_0x508c('0x24'),_0x41dc72,_0x5c6d3f['moduleSearch']);switch(_0x5c6d3f[_0x508c('0x25')]){case _0x508c('0x26'):return _0x2b6a74[_0x508c('0x14')](_0x508c('0x27'))['find'](_0x1cc702,_0x132245)[_0x508c('0x1a')]()[_0x508c('0x20')](function(_0x4d8f0f){if(_0x4d8f0f&&_0x4d8f0f[_0x508c('0x1b')]){return _0x4d8f0f;}else{return _0x2b6a74[_0x508c('0x14')](_0x508c('0x28'))['find'](_0x1cc702,_0x132245);}});case'contact':return _0x2b6a74[_0x508c('0x14')](_0x508c('0x27'))[_0x508c('0x19')](_0x1cc702,_0x132245)[_0x508c('0x1a')]();case _0x508c('0x29'):return _0x2b6a74[_0x508c('0x14')](_0x508c('0x28'))['find'](_0x1cc702,_0x132245);default:return null;}}else if(_0x5c6d3f[_0x508c('0xb')]===_0x508c('0x2a')){logger[_0x508c('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x41dc72,_0x508c('0x2b'));return _0x2b6a74[_0x508c('0x14')]('Contact')[_0x508c('0x19')](_0x1cc702,_0x132245)[_0x508c('0x1a')]();}})['then'](function(_0x1337ad){if(_0x1337ad&&_0x1337ad[_0x508c('0x1b')]){var _0x37e1c1=_[_0x508c('0x19')](_0x1337ad,function(_0x4185cf){return _0x4185cf[_0x508c('0x2c')]===_0x41dc72;});if(_0x37e1c1){return BPromise[_0x508c('0x21')]({'id':_0x37e1c1['Id'],'name':_0x37e1c1[_0x508c('0x1d')],'phone':_0x37e1c1[_0x508c('0x2c')]});}}})[_0x508c('0x20')](function(_0x39970e){if(_0x39970e){logger[_0x508c('0x1c')](_0x508c('0x2d'),_0x41dc72);return BPromise[_0x508c('0x21')](_0x39970e);}else{logger['info'](_0x508c('0x2e'),_0x41dc72);var _0x4a6690={'LastName':_0x1a2bba!==''?_0x1a2bba:util[_0x508c('0x2f')](_0x508c('0x30'),_0x41dc72),'Phone':_0x41dc72};if(_0x5c6d3f[_0x508c('0x31')]){if(_0x5c6d3f[_0x508c('0x31')]===_0x508c('0x2b')){logger[_0x508c('0x1c')](_0x508c('0x32'),_0x41dc72,_0x5c6d3f[_0x508c('0x31')]);}else if(_0x5c6d3f[_0x508c('0x31')]===_0x508c('0x29')&&_0x5c6d3f['ticketType']==='Task'){logger[_0x508c('0x1c')](_0x508c('0x32'),_0x41dc72,_0x5c6d3f['moduleCreate']);_0x4a6690[_0x508c('0x33')]=_0x508c('0x34');}else{return null;}}return _0x2b6a74[_0x508c('0x14')](_[_0x508c('0x35')](_0x5c6d3f[_0x508c('0x31')]))[_0x508c('0x15')](_0x4a6690);}});}function getCustomFields(_0x93c557,_0x49ad29){var _0x385a1d={};if(_0x93c557['length']>0x0){_['forEach'](_0x93c557,function(_0x5004d6){if(_0x5004d6['type']===_0x508c('0x36')&&_0x5004d6['idField']){_0x385a1d[_0x5004d6[_0x508c('0x37')]]=_0x5004d6['content'][_0x508c('0x38')]();}else if(_0x5004d6[_0x508c('0x39')]===_0x508c('0x3a')&&_0x5004d6['variableName']&&_0x5004d6[_0x508c('0x37')]){_0x49ad29[_0x5004d6['variableName']]&&(_0x385a1d[_0x5004d6[_0x508c('0x37')]]=_0x49ad29[_0x5004d6[_0x508c('0x3b')]][_0x508c('0x38')]());}else if(_0x5004d6[_0x508c('0x39')]===_0x508c('0x3c')&&_0x5004d6['Variable']&&_0x5004d6[_0x508c('0x3d')]['name']&&_0x5004d6['idField']){_0x49ad29[_0x5004d6[_0x508c('0x3d')]['name']['toLowerCase']()]&&(_0x385a1d[_0x5004d6[_0x508c('0x37')]]=_0x49ad29[_0x5004d6['Variable']['name']['toLowerCase']()][_0x508c('0x38')]());}});}return _0x385a1d;}function getConnection(_0x55ba4b){var _0x57d01b=_0x55ba4b[_0x508c('0x3e')][_0x508c('0x3f')](_0x55ba4b[_0x508c('0x40')]);var _0x13c205=new jsforce[(_0x508c('0x41'))]({'oauth2':{'loginUrl':_0x55ba4b[_0x508c('0x42')]||_0x508c('0x43'),'clientId':_0x55ba4b['clientId'],'clientSecret':_0x55ba4b[_0x508c('0x44')]}});return _0x13c205[_0x508c('0x45')](_0x55ba4b[_0x508c('0x46')],_0x57d01b)[_0x508c('0x20')](function(){logger[_0x508c('0x1c')](_0x508c('0x47'));return _0x13c205;});}exports['queue']=function(_0x132639,_0x3f1678,_0x267b5e,_0x405b04,_0x5dc376,_0xe6810e){var _0x321bc5,_0x33dd1f,_0x495f50,_0x54fcac;_0xe6810e[_0x508c('0x48')]=intUtil['stripTrailingSlash'](_0xe6810e['serverUrl']);_0xe6810e[_0x508c('0x42')]=intUtil['stripTrailingSlash'](_0xe6810e['remoteUri']);if(_0x5dc376&&_0x5dc376[_0x508c('0x49')]){logger[_0x508c('0x1c')](_0x508c('0x4a'),_0x508c('0x4b'));_0x3f1678['recordingURL']=util['format'](_0x508c('0x4c'),_0xe6810e['serverUrl'],_0x3f1678['uniqueid'],md5(_0x3f1678['uniqueid']));}else{_0x3f1678['recordingURL']='';}return getConnection(_0xe6810e)['then'](function(_0x1c432e){_0x54fcac=_0x1c432e;return getUser(_0xe6810e,_0x405b04['email'],_0x54fcac);})['then'](function(_0x36dc38){_0x321bc5=_0x36dc38;return getEndUser(_0xe6810e,_0x267b5e,_0x3f1678[_0x508c('0x4d')],_0x3f1678[_0x508c('0x4e')],_0x54fcac);})[_0x508c('0x20')](function(_0x8da8e1){_0x33dd1f=_0x8da8e1;return getTicket(_0xe6810e,_0x321bc5,_0x33dd1f,_0x267b5e,_0x3f1678,_0x267b5e[_0x508c('0x4f')],_0x54fcac,_0x508c('0x50'));})[_0x508c('0x20')](function(_0x2a40cf){_0x495f50=_0x2a40cf;logger[_0x508c('0x1c')](_0x508c('0x51'),_0x495f50['id']);logger[_0x508c('0x1c')](_0x508c('0x52'),_0x495f50['id'],_0x405b04['name'],_0xe6810e[_0x508c('0x39')]);switch(_0xe6810e[_0x508c('0x39')]){case _0x508c('0x53'):emit(util[_0x508c('0x2f')](_0x508c('0x54'),_0x405b04['name']),_0x508c('0x55'),{'recordId':_0x495f50['id']});break;case _0x508c('0x56'):emit(util[_0x508c('0x2f')]('user:%s',_0x405b04['name']),'trigger:browser:url',{'uri':util[_0x508c('0x2f')](_0x508c('0x57'),_0x54fcac['instanceUrl'],_0x495f50['id'])});break;default:logger[_0x508c('0x58')](_0x508c('0x59'));}})[_0x508c('0x5a')](function(_0x1bc144){logger[_0x508c('0x58')](_0x508c('0x4a'),JSON[_0x508c('0x5b')](_0x1bc144));});};exports[_0x508c('0x5c')]=function(_0x2fc834,_0xe91890,_0x112ece,_0x4a8905,_0x1dd7da,_0x4f30bc,_0x481fe7){var _0x527f45,_0x189302,_0x4ae17d,_0x30f8be;_0x4f30bc['serverUrl']=intUtil[_0x508c('0x5d')](_0x4f30bc[_0x508c('0x48')]);_0x4f30bc['remoteUri']=intUtil[_0x508c('0x5d')](_0x4f30bc[_0x508c('0x42')]);if(_0x481fe7&&_0x481fe7[_0x508c('0x5e')]&&_0x481fe7[_0x508c('0x5e')]!==_0x508c('0x5f')){logger[_0x508c('0x1c')](_0x508c('0x60'),'Recording\x20is\x20enabled!');_0xe91890['recordingURL']=util[_0x508c('0x2f')](_0x508c('0x4c'),_0x4f30bc[_0x508c('0x48')],_0xe91890['uniqueid'],md5(_0xe91890[_0x508c('0x61')]));}return getConnection(_0x4f30bc)[_0x508c('0x20')](function(_0x3222a9){_0x30f8be=_0x3222a9;return getUser(_0x4f30bc,_0x4a8905[_0x508c('0x62')],_0x30f8be);})['then'](function(_0x505f9b){_0x527f45=_0x505f9b;return getEndUser(_0x4f30bc,_0x112ece,_0xe91890[_0x508c('0x63')],_0xe91890[_0x508c('0x64')],_0x30f8be);})[_0x508c('0x20')](function(_0x7bb9f5){_0x189302=_0x7bb9f5;return getTicket(_0x4f30bc,_0x527f45,_0x189302,_0x112ece,_0xe91890,_0x112ece['Fields'],_0x30f8be,_0x508c('0x5c'));})['then'](function(_0x1b840){_0x4ae17d=_0x1b840;logger[_0x508c('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4ae17d['id']);logger[_0x508c('0x1c')](_0x508c('0x65'),_0x4ae17d['id'],_0x4a8905[_0x508c('0x66')],_0x4f30bc[_0x508c('0x39')]);switch(_0x4f30bc[_0x508c('0x39')]){case _0x508c('0x53'):emit(util['format'](_0x508c('0x54'),_0x4a8905[_0x508c('0x66')]),_0x508c('0x55'),{'recordId':_0x4ae17d['id']});break;case _0x508c('0x56'):emit(util['format']('user:%s',_0x4a8905[_0x508c('0x66')]),'trigger:browser:url',{'uri':util[_0x508c('0x2f')](_0x508c('0x57'),_0x30f8be[_0x508c('0x67')],_0x4ae17d['id'])});break;default:logger[_0x508c('0x58')](_0x508c('0x60'),_0x508c('0x68'));}})[_0x508c('0x5a')](function(_0xb06531){logger[_0x508c('0x58')](_0x508c('0x60'),JSON[_0x508c('0x5b')](_0xb06531));});};exports[_0x508c('0x69')]=function(_0x2738e1,_0x421b8d,_0x433bbc,_0x4041bb,_0xd451f8,_0x48b617){var _0x4b01e0,_0x76479b,_0x33cbd6,_0x4028a0;_0x48b617[_0x508c('0x48')]=intUtil[_0x508c('0x5d')](_0x48b617[_0x508c('0x48')]);_0x48b617[_0x508c('0x42')]=intUtil['stripTrailingSlash'](_0x48b617['remoteUri']);if(_0xd451f8&&_0xd451f8[_0x508c('0x49')]){logger[_0x508c('0x1c')]('['+_0x421b8d[_0x508c('0x6a')]['toUpperCase']()+']',_0x508c('0x4b'));_0x421b8d[_0x508c('0x6b')]=util[_0x508c('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48b617[_0x508c('0x48')],_0x421b8d['uniqueid'],md5(_0x421b8d[_0x508c('0x61')]));}else{_0x421b8d[_0x508c('0x6b')]='';}return getConnection(_0x48b617)[_0x508c('0x20')](function(_0x2aa64a){_0x4028a0=_0x2aa64a;if(!_[_0x508c('0x16')](_0x4041bb)){return getUser(_0x48b617,_0x4041bb[_0x508c('0x66')],_0x4028a0);}else{return getUser(_0x48b617,null,_0x4028a0);}})[_0x508c('0x20')](function(_0x1cc8de){_0x4b01e0=_0x1cc8de;return getEndUser(_0x48b617,_0x433bbc,_0x421b8d[_0x508c('0x4d')],_0x421b8d['calleridnum'],_0x4028a0);})[_0x508c('0x20')](function(_0xdd2f53){_0x76479b=_0xdd2f53;return getTicket(_0x48b617,_0x4b01e0,_0x76479b,_0x433bbc,_0x421b8d,_0x433bbc[_0x508c('0x4f')],_0x4028a0);})[_0x508c('0x20')](function(_0x3d05cc){_0x33cbd6=_0x3d05cc;logger[_0x508c('0x1c')]('['+_0x421b8d[_0x508c('0x6a')][_0x508c('0x6c')]()+']\x20Ticket\x20%s\x20created.',_0x33cbd6['id']);logger[_0x508c('0x1c')]('['+_0x421b8d[_0x508c('0x6a')]['toUpperCase']()+_0x508c('0x6d'),_0x48b617['type']);})[_0x508c('0x5a')](function(_0x5a6695){logger['error']('['+_0x421b8d[_0x508c('0x6a')][_0x508c('0x6c')]()+']',JSON[_0x508c('0x5b')](_0x5a6695));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 5a2cd3e..c899264 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(_0x3e8455,_0x401fa1){var _0x5537bf=function(_0x341b2d){while(--_0x341b2d){_0x3e8455['push'](_0x3e8455['shift']());}};_0x5537bf(++_0x401fa1);}(_0x1261,0x144));var _0x1126=function(_0x4caf0d,_0x580ea2){_0x4caf0d=_0x4caf0d-0x0;var _0x473297=_0x1261[_0x4caf0d];return _0x473297;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x1b9930,_0x5bf350){var _0x336cf3=function(_0x3a84cb){while(--_0x3a84cb){_0x1b9930['push'](_0x1b9930['shift']());}};_0x336cf3(++_0x5bf350);}(_0x326f,0xd1));var _0xf326=function(_0x72474a,_0x378493){_0x72474a=_0x72474a-0x0;var _0x3c5939=_0x326f[_0x72474a];return _0x3c5939;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index ff27331..097a2dc 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 _0xa5d7=['request-promise','bluebird','md5','ioredis','../../../../config/environment','sugarcrm','defaults','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','length','forEach','push','idField','set_entry','JSON','Calls','Basic\x20%s','toString','get_server_info','get_entry_list','stringify','Employees','format','user_name','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','then','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','string','variableName','customVariable','Variable','custom_fields','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','Inbound','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','uri','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','users','lastevent','toUpperCase','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x907c23,_0x2d6267){_0x907c23=_0x907c23-0x0;var _0x18930d=_0xa5d7[_0x907c23];return _0x18930d;};'use strict';var _=require(_0x7a5d('0x0'));var rp=require(_0x7a5d('0x1'));var BPromise=require(_0x7a5d('0x2'));var md5=require(_0x7a5d('0x3'));var util=require('util');var Redis=require(_0x7a5d('0x4'));var intUtil=require('./util');var config=require(_0x7a5d('0x5'));var logger=require('../../../../config/logger')(_0x7a5d('0x6'));config['redis']=_[_0x7a5d('0x7')](config[_0x7a5d('0x8')],{'host':_0x7a5d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a5d('0x8')]));var def={'method':_0x7a5d('0xa'),'json':!![]};function emit(_0x5e6442,_0x33aeaa,_0x5d793f){io['to'](_0x5e6442)[_0x7a5d('0xb')](_0x33aeaa,_0x5d793f);}function getTicket(_0x1057e5,_0x28b554,_0x58cb5d,_0x130ec4,_0x8f88a8,_0x25da61,_0xd91332,_0x593a68){logger[_0x7a5d('0xc')](_0x7a5d('0xd'));var _0x42d2cc=new Date();var _0x196db3=[{'name':_0x7a5d('0xe'),'value':intUtil[_0x7a5d('0xf')](_0x130ec4[_0x7a5d('0x10')],_0x8f88a8,'\x20')},{'name':'assigned_user_id','value':_0x28b554['id']},{'name':'created_by','value':_0x28b554['id']},{'name':_0x7a5d('0x11'),'value':intUtil['getString'](_0x130ec4[_0x7a5d('0x12')],_0x8f88a8,'\x0a')},{'name':_0x7a5d('0x13'),'value':_0x42d2cc[_0x7a5d('0x14')]()[_0x7a5d('0x15')](0x0,0x13)[_0x7a5d('0x16')]('T','\x20')},{'name':_0x7a5d('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x7a5d('0x18'),'value':_0x58cb5d['id']},{'name':_0x7a5d('0x19'),'value':_0x7a5d('0x1a')},{'name':_0x7a5d('0x1b'),'value':_0x58cb5d[_0x7a5d('0xe')]},{'name':'direction','value':_0x593a68}];if(_0x25da61[_0x7a5d('0x1c')]){_[_0x7a5d('0x1d')](_0x25da61,function(_0x4af635){if(_0x8f88a8[_0x4af635['variableName']]){_0x196db3[_0x7a5d('0x1e')]({'name':_0x4af635[_0x7a5d('0x1f')],'value':_0x8f88a8[_0x4af635['variableName']]});}});}return request({'form':{'method':_0x7a5d('0x20'),'input_type':'JSON','response_type':_0x7a5d('0x21'),'rest_data':JSON['stringify']({'session':_0xd91332['id'],'module_name':_0x7a5d('0x22'),'name_value_list':_0x196db3})}});}function getAuth(_0x334d3d){return util['format'](_0x7a5d('0x23'),new Buffer(_0x334d3d['apiKey']+':X')[_0x7a5d('0x24')]('base64'));}function getServerInfo(_0x56183a){return request({'form':{'method':_0x7a5d('0x25'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON['stringify']({'session':_0x56183a['id']})}});}function getUser(_0x7b8ce1,_0x45377a,_0x1bd069){if(!_['isNil'](_0x45377a)){logger[_0x7a5d('0xc')]('Getting\x20agent\x20with\x20name',_0x45377a);return request({'form':{'method':_0x7a5d('0x26'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON[_0x7a5d('0x27')]({'session':_0x1bd069['id'],'module_name':_0x7a5d('0x28'),'query':util[_0x7a5d('0x29')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x45377a),'order_by':'','offset':'0','select_fields':['id',_0x7a5d('0xe'),_0x7a5d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1c33f5){if(_0x1c33f5[_0x7a5d('0x2b')][_0x7a5d('0x1c')]){var _0x72bedd=_['find'](_0x1c33f5[_0x7a5d('0x2b')],function(_0x2f922d){return _0x2f922d[_0x7a5d('0x2c')][_0x7a5d('0x2a')][_0x7a5d('0x2d')]===_0x45377a;});if(_0x72bedd){logger[_0x7a5d('0xc')](_0x7a5d('0x2e'));return BPromise[_0x7a5d('0x2f')]({'id':_0x72bedd['name_value_list']['id'][_0x7a5d('0x2d')],'name':_0x72bedd[_0x7a5d('0x2c')][_0x7a5d('0xe')][_0x7a5d('0x2d')]});}}logger[_0x7a5d('0xc')](_0x7a5d('0x30'));return BPromise[_0x7a5d('0x2f')]({'id':_0x1bd069[_0x7a5d('0x2c')][_0x7a5d('0x31')][_0x7a5d('0x2d')],'name':_0x1bd069[_0x7a5d('0x2c')][_0x7a5d('0x2a')][_0x7a5d('0x2d')]});});}else{logger[_0x7a5d('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7a5d('0x2f')]({'id':_0x1bd069['name_value_list'][_0x7a5d('0x31')][_0x7a5d('0x2d')],'name':_0x1bd069[_0x7a5d('0x2c')]['user_name'][_0x7a5d('0x2d')]});}}function getEndUser(_0x1251ab,_0x358bba,_0x1966c2,_0x53789d){logger[_0x7a5d('0xc')](_0x7a5d('0x32'),_0x1966c2);return request({'form':{'method':_0x7a5d('0x26'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON[_0x7a5d('0x27')]({'session':_0x53789d['id'],'module_name':'Contacts','query':util[_0x7a5d('0x29')](_0x7a5d('0x33'),_0x1966c2),'order_by':'','offset':'0','select_fields':['id',_0x7a5d('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7a5d('0x34')](function(_0x2b5edf){if(_0x2b5edf[_0x7a5d('0x2b')][_0x7a5d('0x1c')]){var _0x305e61=_[_0x7a5d('0x35')](_0x2b5edf[_0x7a5d('0x2b')],function(_0x292055){return _0x292055[_0x7a5d('0x2c')][_0x7a5d('0x36')][_0x7a5d('0x2d')]===_0x1966c2;});if(_0x305e61){logger[_0x7a5d('0xc')](_0x7a5d('0x37'));return BPromise[_0x7a5d('0x2f')]({'id':_0x305e61['name_value_list']['id'][_0x7a5d('0x2d')],'name':_0x305e61[_0x7a5d('0x2c')][_0x7a5d('0xe')][_0x7a5d('0x2d')],'phone':_0x305e61[_0x7a5d('0x2c')][_0x7a5d('0x36')][_0x7a5d('0x2d')]});}}else{logger[_0x7a5d('0xc')](_0x7a5d('0x38'));return request({'form':{'method':'set_entry','input_type':_0x7a5d('0x21'),'response_type':'JSON','rest_data':JSON[_0x7a5d('0x27')]({'session':_0x53789d['id'],'module_name':'Contacts','name_value_list':[{'name':_0x7a5d('0x39'),'value':_0x358bba!==_0x7a5d('0x3a')?_0x358bba:util[_0x7a5d('0x29')]('Caller\x20-\x20%s',_0x1966c2)},{'name':_0x7a5d('0x36'),'value':_0x1966c2}]})}})['then'](function(_0x5b669f){logger[_0x7a5d('0xc')](_0x7a5d('0x3b'));return BPromise['resolve']({'id':_0x5b669f['id'],'name':_0x5b669f[_0x7a5d('0x2b')][_0x7a5d('0x39')][_0x7a5d('0x2d')],'phone':_0x5b669f['entry_list'][_0x7a5d('0x36')][_0x7a5d('0x2d')]});});}});}function request(_0x4cadfe){logger[_0x7a5d('0x3c')](_0x7a5d('0x3d'),JSON[_0x7a5d('0x27')](_0x4cadfe));return rp(_[_0x7a5d('0x3e')](def,_0x4cadfe));}function getTags(_0x42f33e,_0x3bf875){var _0x33f5b9=[];if(_0x42f33e&&_0x42f33e['length']>0x0){_0x33f5b9=_[_0x7a5d('0x3f')](_0x42f33e,_0x3bf875);}return _0x33f5b9;}function getCustomFields(_0x425381,_0x391313){var _0x2248f1=[];var _0x1170c9={'custom_fields':[]};if(_0x425381[_0x7a5d('0x1c')]>0x0){_[_0x7a5d('0x1d')](_0x425381,function(_0x2cf395){if(_0x2cf395[_0x7a5d('0x40')]==='string'&&_0x2cf395[_0x7a5d('0x41')]&&!_0x2cf395[_0x7a5d('0x42')]){_0x1170c9[_0x2cf395[_0x7a5d('0x41')][_0x7a5d('0x43')]()]=_0x2cf395[_0x7a5d('0x44')][_0x7a5d('0x24')]();}else if(_0x2cf395['type']===_0x7a5d('0x45')&&_0x2cf395[_0x7a5d('0x1f')]&&_0x2cf395[_0x7a5d('0x42')]){_0x1170c9['custom_fields'][_0x7a5d('0x1e')]({'id':_0x2cf395[_0x7a5d('0x1f')],'value':_0x2cf395['content'][_0x7a5d('0x24')]()});}else if(_0x2cf395[_0x7a5d('0x40')]==='variable'&&_0x2cf395[_0x7a5d('0x46')]&&_0x2cf395['idField']&&_0x2cf395[_0x7a5d('0x42')]){_0x391313[_0x2cf395[_0x7a5d('0x46')]]&&_0x1170c9['custom_fields'][_0x7a5d('0x1e')]({'id':_0x2cf395['idField'],'value':_0x391313[_0x2cf395[_0x7a5d('0x46')]][_0x7a5d('0x24')]()});}else if(_0x2cf395[_0x7a5d('0x40')]===_0x7a5d('0x47')&&_0x2cf395[_0x7a5d('0x48')]&&_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')]&&_0x2cf395[_0x7a5d('0x1f')]&&_0x2cf395['customField']){_0x391313[_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')][_0x7a5d('0x43')]()]&&_0x1170c9[_0x7a5d('0x49')]['push']({'id':_0x2cf395[_0x7a5d('0x1f')],'value':_0x391313[_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')][_0x7a5d('0x43')]()]['toString']()});}});}return _0x1170c9;}function getConnection(_0x255d90){return request({'method':'POST','form':{'method':_0x7a5d('0x4a'),'input_type':_0x7a5d('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x255d90[_0x7a5d('0x4b')],'password':_0x255d90[_0x7a5d('0x4c')],'encryption':_0x7a5d('0x4d')},'application':_0x7a5d('0x4e')})}})[_0x7a5d('0x34')](function(_0x50f589){var _0x151d9a=_0x50f589;if(_0x151d9a['id']){def[_0x7a5d('0x4f')]=_0x151d9a['id'];return BPromise[_0x7a5d('0x2f')](_0x151d9a);}else{throw new Error(util[_0x7a5d('0x29')](_0x7a5d('0x50'),_0x255d90['id']));}});}function setRelationship(_0x110b3b,_0x13f598,_0x1c60aa,_0x4630b4){return request({'form':{'method':_0x7a5d('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x7a5d('0x27')]({'session':_0x110b3b['id'],'module_name':_0x7a5d('0x22'),'module_id':_0x1c60aa['id'],'link_field_name':_0x4630b4,'related_ids':[_0x13f598['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x24e989,_0x84cbf,_0x410e26,_0x3e0e3b,_0x3c91d2,_0x1d62e8){var _0x5099cc,_0x14366e,_0xc05cda,_0x540ca4;_0x1d62e8[_0x7a5d('0x52')]=intUtil[_0x7a5d('0x53')](_0x1d62e8['remoteUri']);_0x1d62e8[_0x7a5d('0x54')]=intUtil['stripTrailingSlash'](_0x1d62e8['serverUrl']);def['uri']=util[_0x7a5d('0x29')](_0x7a5d('0x55'),_0x1d62e8[_0x7a5d('0x52')]);if(_0x3c91d2&&_0x3c91d2['monitor_format']){logger[_0x7a5d('0xc')](_0x7a5d('0x56'),_0x7a5d('0x57'));_0x84cbf[_0x7a5d('0x58')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d62e8[_0x7a5d('0x54')],_0x84cbf[_0x7a5d('0x59')],md5(_0x84cbf[_0x7a5d('0x59')]));}else{_0x84cbf[_0x7a5d('0x58')]='';}return getConnection(_0x1d62e8)[_0x7a5d('0x34')](function(_0x44c0ad){_0x540ca4=_0x44c0ad;return getUser(_0x1d62e8,_0x3e0e3b['name'],_0x540ca4);})[_0x7a5d('0x34')](function(_0x34d739){_0x5099cc=_0x34d739;logger[_0x7a5d('0xc')](_0x7a5d('0x5a'),_0x5099cc['id']);return getEndUser(_0x1d62e8,_0x84cbf[_0x7a5d('0x5b')],_0x84cbf['calleridnum'],_0x540ca4);})[_0x7a5d('0x34')](function(_0x4b1abd){_0x14366e=_0x4b1abd;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x14366e['id']);return getTicket(_0x1d62e8,_0x5099cc,_0x14366e,_0x410e26,_0x84cbf,_0x410e26['Fields'],_0x540ca4,_0x7a5d('0x5c'));})[_0x7a5d('0x34')](function(_0x12b36e){_0xc05cda=_0x12b36e;logger[_0x7a5d('0xc')]('Ticket\x20created!');logger[_0x7a5d('0xc')]('The\x20Ticket\x20ID\x20is:',_0xc05cda['id']);return setRelationship(_0x540ca4,_0x5099cc,_0xc05cda,'users');})[_0x7a5d('0x34')](function(){return setRelationship(_0x540ca4,_0x14366e,_0xc05cda,_0x7a5d('0x5d'));})['then'](function(){return getServerInfo(_0x540ca4);})[_0x7a5d('0x34')](function(_0x4c8fdc){var _0x11fc99=parseInt(_0x4c8fdc['version']['charAt'](0x0));var _0x59cdbb=util[_0x7a5d('0x29')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1d62e8[_0x7a5d('0x52')],_0xc05cda['id']);if(_0x11fc99>0x6){_0x59cdbb=util[_0x7a5d('0x29')](_0x7a5d('0x5e'),_0x1d62e8['remoteUri'],_0xc05cda['id']);}logger[_0x7a5d('0xc')](_0x7a5d('0x56'),_0x7a5d('0x5f'));emit(util[_0x7a5d('0x29')]('user:%s',_0x3e0e3b[_0x7a5d('0xe')]),_0x7a5d('0x60'),{'uri':_0x59cdbb});})[_0x7a5d('0x61')](function(_0x427644){logger[_0x7a5d('0x62')](_0x7a5d('0x56'),JSON[_0x7a5d('0x27')](_0x427644));});};exports[_0x7a5d('0x63')]=function(_0x1d7e7e,_0x4348bf,_0x27247a,_0x29c612,_0x357556,_0x408c0e,_0x2ff2d2){var _0x3b263c,_0x2d2355,_0x21e1d1,_0x37c3fe;_0x408c0e[_0x7a5d('0x52')]=intUtil['stripTrailingSlash'](_0x408c0e[_0x7a5d('0x52')]);_0x408c0e[_0x7a5d('0x54')]=intUtil['stripTrailingSlash'](_0x408c0e[_0x7a5d('0x54')]);def[_0x7a5d('0x64')]=util[_0x7a5d('0x29')](_0x7a5d('0x55'),_0x408c0e[_0x7a5d('0x52')]);if(_0x2ff2d2&&_0x2ff2d2[_0x7a5d('0x65')]&&_0x2ff2d2[_0x7a5d('0x65')]!=='none'){logger[_0x7a5d('0xc')](_0x7a5d('0x66'),_0x7a5d('0x57'));_0x4348bf[_0x7a5d('0x58')]=util[_0x7a5d('0x29')](_0x7a5d('0x67'),_0x408c0e[_0x7a5d('0x54')],_0x4348bf['uniqueid'],md5(_0x4348bf['uniqueid']));}return getConnection(_0x408c0e)[_0x7a5d('0x34')](function(_0x1a6668){_0x37c3fe=_0x1a6668;return getUser(_0x408c0e,_0x29c612[_0x7a5d('0xe')],_0x37c3fe);})[_0x7a5d('0x34')](function(_0x5b3e3d){_0x3b263c=_0x5b3e3d;logger[_0x7a5d('0xc')]('The\x20User\x20ID\x20is:',_0x3b263c['id']);return getEndUser(_0x408c0e,_0x4348bf['destcalleridname'],_0x4348bf[_0x7a5d('0x68')],_0x37c3fe);})[_0x7a5d('0x34')](function(_0x5a7db5){_0x2d2355=_0x5a7db5;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2d2355['id']);return getTicket(_0x408c0e,_0x3b263c,_0x2d2355,_0x27247a,_0x4348bf,_0x27247a[_0x7a5d('0x69')],_0x37c3fe,_0x7a5d('0x6a'));})[_0x7a5d('0x34')](function(_0xd450bc){_0x21e1d1=_0xd450bc;logger[_0x7a5d('0xc')]('Ticket\x20created!');logger['info'](_0x7a5d('0x6b'),_0x21e1d1['id']);return setRelationship(_0x37c3fe,_0x3b263c,_0x21e1d1,'users');})[_0x7a5d('0x34')](function(){return setRelationship(_0x37c3fe,_0x2d2355,_0x21e1d1,_0x7a5d('0x5d'));})['then'](function(){return getServerInfo(_0x37c3fe);})[_0x7a5d('0x34')](function(_0x2c65a9){var _0x33e36c=parseInt(_0x2c65a9['version']['charAt'](0x0));var _0x54f2a8=util['format'](_0x7a5d('0x6c'),_0x408c0e[_0x7a5d('0x52')],_0x21e1d1['id']);if(_0x33e36c>0x6){_0x54f2a8=util[_0x7a5d('0x29')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x408c0e[_0x7a5d('0x52')],_0x21e1d1['id']);}logger[_0x7a5d('0xc')](_0x7a5d('0x66'),_0x7a5d('0x5f'));emit(util[_0x7a5d('0x29')]('user:%s',_0x29c612[_0x7a5d('0xe')]),_0x7a5d('0x60'),{'uri':_0x54f2a8});})[_0x7a5d('0x61')](function(_0x2ddfff){logger[_0x7a5d('0x62')](_0x7a5d('0x66'),JSON['stringify'](_0x2ddfff));});};exports[_0x7a5d('0x6d')]=function(_0x5a844e,_0x5a2840,_0xc041b2,_0x66b40c,_0x375c3e,_0x598e65){var _0x20b292,_0x477169,_0x4b5041,_0x204b72;_0x598e65[_0x7a5d('0x52')]=intUtil['stripTrailingSlash'](_0x598e65['remoteUri']);_0x598e65[_0x7a5d('0x54')]=intUtil[_0x7a5d('0x53')](_0x598e65[_0x7a5d('0x54')]);def[_0x7a5d('0x64')]=util['format']('%s/service/v4_1/rest.php',_0x598e65[_0x7a5d('0x52')]);if(_0x375c3e&&_0x375c3e['monitor_format']){logger[_0x7a5d('0xc')]('['+_0x5a2840['lastevent']['toUpperCase']()+']',_0x7a5d('0x57'));_0x5a2840['recordingURL']=util[_0x7a5d('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x598e65['serverUrl'],_0x5a2840[_0x7a5d('0x59')],md5(_0x5a2840[_0x7a5d('0x59')]));}else{_0x5a2840[_0x7a5d('0x58')]='';}return getConnection(_0x598e65)['then'](function(_0x56a03f){_0x204b72=_0x56a03f;if(!_['isNil'](_0x66b40c)){return getUser(_0x598e65,_0x66b40c['name'],_0x204b72);}else{return getUser(_0x598e65,null,_0x204b72);}})[_0x7a5d('0x34')](function(_0x45fa9e){_0x20b292=_0x45fa9e;logger[_0x7a5d('0xc')](_0x7a5d('0x5a'),_0x20b292['id']);return getEndUser(_0x598e65,_0x5a2840[_0x7a5d('0x5b')],_0x5a2840['calleridnum'],_0x204b72);})[_0x7a5d('0x34')](function(_0x495870){_0x477169=_0x495870;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x477169['id']);return getTicket(_0x598e65,_0x20b292,_0x477169,_0xc041b2,_0x5a2840,_0xc041b2[_0x7a5d('0x69')],_0x204b72,_0x7a5d('0x5c'));})[_0x7a5d('0x34')](function(_0x5d5e22){_0x4b5041=_0x5d5e22;logger['info']('Ticket\x20created!');logger[_0x7a5d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4b5041['id']);return setRelationship(_0x204b72,_0x20b292,_0x4b5041,_0x7a5d('0x6e'));})[_0x7a5d('0x34')](function(){return setRelationship(_0x204b72,_0x477169,_0x4b5041,_0x7a5d('0x5d'));})[_0x7a5d('0x34')](function(){return getServerInfo(_0x204b72);})[_0x7a5d('0x61')](function(_0xd9fa44){logger[_0x7a5d('0x62')]('['+_0x5a2840[_0x7a5d('0x6f')][_0x7a5d('0x70')]()+']',JSON[_0x7a5d('0x27')](_0xd9fa44));});}; \ No newline at end of file +var _0x0630=['Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','idField','JSON','stringify','Calls','format','apiKey','toString','base64','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Enduser\x20created.','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','custom_fields','push','content','variable','variableName','Variable','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','unmanaged','uri','lastevent','isNil','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','POST','info'];(function(_0x40b7ad,_0xc20173){var _0x1f263e=function(_0x3e0c0a){while(--_0x3e0c0a){_0x40b7ad['push'](_0x40b7ad['shift']());}};_0x1f263e(++_0xc20173);}(_0x0630,0xde));var _0x0063=function(_0x5cc2cc,_0xa5eb7e){_0x5cc2cc=_0x5cc2cc-0x0;var _0x5bb4cd=_0x0630[_0x5cc2cc];return _0x5bb4cd;};'use strict';var _=require(_0x0063('0x0'));var rp=require(_0x0063('0x1'));var BPromise=require(_0x0063('0x2'));var md5=require(_0x0063('0x3'));var util=require(_0x0063('0x4'));var Redis=require(_0x0063('0x5'));var intUtil=require(_0x0063('0x6'));var config=require(_0x0063('0x7'));var logger=require(_0x0063('0x8'))(_0x0063('0x9'));config['redis']=_[_0x0063('0xa')](config['redis'],{'host':_0x0063('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x0063('0xc'),'json':!![]};function emit(_0x5c3dda,_0x19dbc3,_0x52f9b9){io['to'](_0x5c3dda)['emit'](_0x19dbc3,_0x52f9b9);}function getTicket(_0x4798d5,_0x20355c,_0x2683c1,_0x3e0e2a,_0x3ed8f9,_0x40d9ec,_0x51f75b,_0x7a5f24){logger[_0x0063('0xd')](_0x0063('0xe'));var _0x202105=new Date();var _0x242b9f=[{'name':_0x0063('0xf'),'value':intUtil['getString'](_0x3e0e2a[_0x0063('0x10')],_0x3ed8f9,'\x20')},{'name':_0x0063('0x11'),'value':_0x20355c['id']},{'name':'created_by','value':_0x20355c['id']},{'name':_0x0063('0x12'),'value':intUtil[_0x0063('0x13')](_0x3e0e2a[_0x0063('0x14')],_0x3ed8f9,'\x0a')},{'name':'date_start','value':_0x202105[_0x0063('0x15')]()[_0x0063('0x16')](0x0,0x13)[_0x0063('0x17')]('T','\x20')},{'name':_0x0063('0x18'),'value':'0'},{'name':_0x0063('0x19'),'value':'15'},{'name':'parent_id','value':_0x2683c1['id']},{'name':'parent_type','value':_0x0063('0x1a')},{'name':_0x0063('0x1b'),'value':_0x2683c1[_0x0063('0xf')]},{'name':_0x0063('0x1c'),'value':_0x7a5f24}];if(_0x40d9ec[_0x0063('0x1d')]){_['forEach'](_0x40d9ec,function(_0x1d85aa){if(_0x3ed8f9[_0x1d85aa['variableName']]){_0x242b9f['push']({'name':_0x1d85aa[_0x0063('0x1e')],'value':_0x3ed8f9[_0x1d85aa['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x0063('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0063('0x20')]({'session':_0x51f75b['id'],'module_name':_0x0063('0x21'),'name_value_list':_0x242b9f})}});}function getAuth(_0x16f7a1){return util[_0x0063('0x22')]('Basic\x20%s',new Buffer(_0x16f7a1[_0x0063('0x23')]+':X')[_0x0063('0x24')](_0x0063('0x25')));}function getServerInfo(_0x2b7136){return request({'form':{'method':'get_server_info','input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON['stringify']({'session':_0x2b7136['id']})}});}function getUser(_0x36944c,_0x4fd8c5,_0x209c8f){if(!_['isNil'](_0x4fd8c5)){logger['info'](_0x0063('0x26'),_0x4fd8c5);return request({'form':{'method':_0x0063('0x27'),'input_type':_0x0063('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0063('0x20')]({'session':_0x209c8f['id'],'module_name':_0x0063('0x28'),'query':util['format'](_0x0063('0x29'),_0x4fd8c5),'order_by':'','offset':'0','select_fields':['id','name',_0x0063('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0063('0x2b')](function(_0x2fd1c3){if(_0x2fd1c3[_0x0063('0x2c')][_0x0063('0x1d')]){var _0x379db9=_[_0x0063('0x2d')](_0x2fd1c3[_0x0063('0x2c')],function(_0x268df2){return _0x268df2[_0x0063('0x2e')]['user_name'][_0x0063('0x2f')]===_0x4fd8c5;});if(_0x379db9){logger[_0x0063('0xd')]('Agent\x20found!');return BPromise[_0x0063('0x30')]({'id':_0x379db9['name_value_list']['id'][_0x0063('0x2f')],'name':_0x379db9[_0x0063('0x2e')][_0x0063('0xf')][_0x0063('0x2f')]});}}logger['info'](_0x0063('0x31'));return BPromise[_0x0063('0x30')]({'id':_0x209c8f[_0x0063('0x2e')][_0x0063('0x32')][_0x0063('0x2f')],'name':_0x209c8f[_0x0063('0x2e')][_0x0063('0x2a')][_0x0063('0x2f')]});});}else{logger['info'](_0x0063('0x33'));return BPromise[_0x0063('0x30')]({'id':_0x209c8f['name_value_list']['user_id'][_0x0063('0x2f')],'name':_0x209c8f[_0x0063('0x2e')][_0x0063('0x2a')][_0x0063('0x2f')]});}}function getEndUser(_0x78e502,_0x995f43,_0x581553,_0x472359){logger[_0x0063('0xd')](_0x0063('0x34'),_0x581553);return request({'form':{'method':'get_entry_list','input_type':_0x0063('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0063('0x20')]({'session':_0x472359['id'],'module_name':_0x0063('0x1a'),'query':util[_0x0063('0x22')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x581553),'order_by':'','offset':'0','select_fields':['id',_0x0063('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0063('0x2b')](function(_0x38d6f7){if(_0x38d6f7['entry_list']['length']){var _0x1f31e7=_[_0x0063('0x2d')](_0x38d6f7['entry_list'],function(_0xeda140){return _0xeda140[_0x0063('0x2e')][_0x0063('0x35')]['value']===_0x581553;});if(_0x1f31e7){logger[_0x0063('0xd')]('Enduser\x20found!');return BPromise[_0x0063('0x30')]({'id':_0x1f31e7[_0x0063('0x2e')]['id'][_0x0063('0x2f')],'name':_0x1f31e7[_0x0063('0x2e')][_0x0063('0xf')]['value'],'phone':_0x1f31e7[_0x0063('0x2e')][_0x0063('0x35')]['value']});}}else{logger['info'](_0x0063('0x36'));return request({'form':{'method':_0x0063('0x37'),'input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON[_0x0063('0x20')]({'session':_0x472359['id'],'module_name':_0x0063('0x1a'),'name_value_list':[{'name':_0x0063('0x38'),'value':_0x995f43!==''?_0x995f43:util[_0x0063('0x22')]('Caller\x20-\x20%s',_0x581553)},{'name':'phone_home','value':_0x581553}]})}})[_0x0063('0x2b')](function(_0xe93c5f){logger[_0x0063('0xd')](_0x0063('0x39'));return BPromise[_0x0063('0x30')]({'id':_0xe93c5f['id'],'name':_0xe93c5f[_0x0063('0x2c')][_0x0063('0x38')][_0x0063('0x2f')],'phone':_0xe93c5f[_0x0063('0x2c')][_0x0063('0x35')][_0x0063('0x2f')]});});}});}function request(_0x5ba483){logger['debug'](_0x0063('0x3a'),JSON[_0x0063('0x20')](_0x5ba483));return rp(_[_0x0063('0x3b')](def,_0x5ba483));}function getTags(_0x2d180e,_0x1832c9){var _0x5cdbbd=[];if(_0x2d180e&&_0x2d180e[_0x0063('0x1d')]>0x0){_0x5cdbbd=_[_0x0063('0x3c')](_0x2d180e,_0x1832c9);}return _0x5cdbbd;}function getCustomFields(_0x283c25,_0x3a705d){var _0x121a58=[];var _0x5e5055={'custom_fields':[]};if(_0x283c25[_0x0063('0x1d')]>0x0){_[_0x0063('0x3d')](_0x283c25,function(_0x31b4b3){if(_0x31b4b3[_0x0063('0x3e')]===_0x0063('0x3f')&&_0x31b4b3[_0x0063('0x40')]&&!_0x31b4b3[_0x0063('0x41')]){_0x5e5055[_0x31b4b3[_0x0063('0x40')][_0x0063('0x42')]()]=_0x31b4b3['content'][_0x0063('0x24')]();}else if(_0x31b4b3[_0x0063('0x3e')]===_0x0063('0x3f')&&_0x31b4b3[_0x0063('0x1e')]&&_0x31b4b3['customField']){_0x5e5055[_0x0063('0x43')][_0x0063('0x44')]({'id':_0x31b4b3['idField'],'value':_0x31b4b3[_0x0063('0x45')]['toString']()});}else if(_0x31b4b3[_0x0063('0x3e')]===_0x0063('0x46')&&_0x31b4b3[_0x0063('0x47')]&&_0x31b4b3[_0x0063('0x1e')]&&_0x31b4b3[_0x0063('0x41')]){_0x3a705d[_0x31b4b3[_0x0063('0x47')]]&&_0x5e5055[_0x0063('0x43')][_0x0063('0x44')]({'id':_0x31b4b3[_0x0063('0x1e')],'value':_0x3a705d[_0x31b4b3['variableName']][_0x0063('0x24')]()});}else if(_0x31b4b3['type']==='customVariable'&&_0x31b4b3[_0x0063('0x48')]&&_0x31b4b3[_0x0063('0x48')]['name']&&_0x31b4b3['idField']&&_0x31b4b3[_0x0063('0x41')]){_0x3a705d[_0x31b4b3[_0x0063('0x48')][_0x0063('0xf')][_0x0063('0x42')]()]&&_0x5e5055[_0x0063('0x43')][_0x0063('0x44')]({'id':_0x31b4b3[_0x0063('0x1e')],'value':_0x3a705d[_0x31b4b3[_0x0063('0x48')][_0x0063('0xf')][_0x0063('0x42')]()][_0x0063('0x24')]()});}});}return _0x5e5055;}function getConnection(_0x2ad33e){return request({'method':_0x0063('0xc'),'form':{'method':'login','input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON[_0x0063('0x20')]({'user_auth':{'user_name':_0x2ad33e[_0x0063('0x49')],'password':_0x2ad33e['password'],'encryption':'PLAIN'},'application':_0x0063('0x4a')})}})[_0x0063('0x2b')](function(_0x5e934a){var _0x4c406a=_0x5e934a;if(_0x4c406a['id']){def[_0x0063('0x4b')]=_0x4c406a['id'];return BPromise['resolve'](_0x4c406a);}else{throw new Error(util[_0x0063('0x22')](_0x0063('0x4c'),_0x2ad33e['id']));}});}function setRelationship(_0x308742,_0x4e47ec,_0x2dcdb3,_0xca1be4){return request({'form':{'method':_0x0063('0x4d'),'input_type':_0x0063('0x1f'),'response_type':_0x0063('0x1f'),'rest_data':JSON[_0x0063('0x20')]({'session':_0x308742['id'],'module_name':_0x0063('0x21'),'module_id':_0x2dcdb3['id'],'link_field_name':_0xca1be4,'related_ids':[_0x4e47ec['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0063('0x4e')]=function(_0x593114,_0x299f6a,_0xf0303b,_0x4d3355,_0x3baf27,_0x496acf){var _0x2bec17,_0x11a7cb,_0x21035c,_0x4d4a1c;_0x496acf['remoteUri']=intUtil[_0x0063('0x4f')](_0x496acf[_0x0063('0x50')]);_0x496acf[_0x0063('0x51')]=intUtil['stripTrailingSlash'](_0x496acf['serverUrl']);def['uri']=util[_0x0063('0x22')](_0x0063('0x52'),_0x496acf['remoteUri']);if(_0x3baf27&&_0x3baf27[_0x0063('0x53')]){logger[_0x0063('0xd')](_0x0063('0x54'),_0x0063('0x55'));_0x299f6a[_0x0063('0x56')]=util[_0x0063('0x22')](_0x0063('0x57'),_0x496acf['serverUrl'],_0x299f6a['uniqueid'],md5(_0x299f6a[_0x0063('0x58')]));}else{_0x299f6a[_0x0063('0x56')]='';}return getConnection(_0x496acf)[_0x0063('0x2b')](function(_0xdb2fd3){_0x4d4a1c=_0xdb2fd3;return getUser(_0x496acf,_0x4d3355[_0x0063('0xf')],_0x4d4a1c);})[_0x0063('0x2b')](function(_0xe48f3a){_0x2bec17=_0xe48f3a;logger[_0x0063('0xd')](_0x0063('0x59'),_0x2bec17['id']);return getEndUser(_0x496acf,_0x299f6a[_0x0063('0x5a')],_0x299f6a['calleridnum'],_0x4d4a1c);})[_0x0063('0x2b')](function(_0x92ae6e){_0x11a7cb=_0x92ae6e;logger[_0x0063('0xd')]('The\x20Enduser\x20ID\x20is:',_0x11a7cb['id']);return getTicket(_0x496acf,_0x2bec17,_0x11a7cb,_0xf0303b,_0x299f6a,_0xf0303b[_0x0063('0x5b')],_0x4d4a1c,_0x0063('0x5c'));})[_0x0063('0x2b')](function(_0x1837c3){_0x21035c=_0x1837c3;logger[_0x0063('0xd')](_0x0063('0x5d'));logger[_0x0063('0xd')](_0x0063('0x5e'),_0x21035c['id']);return setRelationship(_0x4d4a1c,_0x2bec17,_0x21035c,'users');})['then'](function(){return setRelationship(_0x4d4a1c,_0x11a7cb,_0x21035c,_0x0063('0x5f'));})['then'](function(){return getServerInfo(_0x4d4a1c);})[_0x0063('0x2b')](function(_0x48c573){var _0x1083fb=parseInt(_0x48c573[_0x0063('0x60')][_0x0063('0x61')](0x0));var _0x2b51b2=util[_0x0063('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x496acf[_0x0063('0x50')],_0x21035c['id']);if(_0x1083fb>0x6){_0x2b51b2=util['format'](_0x0063('0x62'),_0x496acf[_0x0063('0x50')],_0x21035c['id']);}logger['info'](_0x0063('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0063('0x22')](_0x0063('0x63'),_0x4d3355[_0x0063('0xf')]),_0x0063('0x64'),{'uri':_0x2b51b2});})[_0x0063('0x65')](function(_0x376889){logger['error'](_0x0063('0x54'),JSON[_0x0063('0x20')](_0x376889));});};exports['outbound']=function(_0x3c3091,_0x30c440,_0x2d1bed,_0x3b2820,_0xdd6ec,_0xfdfe86,_0x4b0b6d){var _0x1abac9,_0x4169fd,_0x55cced,_0x51cc13;_0xfdfe86[_0x0063('0x50')]=intUtil[_0x0063('0x4f')](_0xfdfe86[_0x0063('0x50')]);_0xfdfe86[_0x0063('0x51')]=intUtil[_0x0063('0x4f')](_0xfdfe86[_0x0063('0x51')]);def['uri']=util[_0x0063('0x22')](_0x0063('0x52'),_0xfdfe86[_0x0063('0x50')]);if(_0x4b0b6d&&_0x4b0b6d['recordingFormat']&&_0x4b0b6d[_0x0063('0x66')]!==_0x0063('0x67')){logger[_0x0063('0xd')](_0x0063('0x68'),_0x0063('0x55'));_0x30c440['recordingURL']=util[_0x0063('0x22')](_0x0063('0x57'),_0xfdfe86[_0x0063('0x51')],_0x30c440[_0x0063('0x58')],md5(_0x30c440['uniqueid']));}return getConnection(_0xfdfe86)[_0x0063('0x2b')](function(_0x197993){_0x51cc13=_0x197993;return getUser(_0xfdfe86,_0x3b2820[_0x0063('0xf')],_0x51cc13);})[_0x0063('0x2b')](function(_0x123f82){_0x1abac9=_0x123f82;logger[_0x0063('0xd')](_0x0063('0x59'),_0x1abac9['id']);return getEndUser(_0xfdfe86,_0x30c440[_0x0063('0x69')],_0x30c440[_0x0063('0x6a')],_0x51cc13);})[_0x0063('0x2b')](function(_0x4e1375){_0x4169fd=_0x4e1375;logger[_0x0063('0xd')](_0x0063('0x6b'),_0x4169fd['id']);return getTicket(_0xfdfe86,_0x1abac9,_0x4169fd,_0x2d1bed,_0x30c440,_0x2d1bed[_0x0063('0x5b')],_0x51cc13,_0x0063('0x6c'));})[_0x0063('0x2b')](function(_0x583d3b){_0x55cced=_0x583d3b;logger[_0x0063('0xd')](_0x0063('0x5d'));logger[_0x0063('0xd')](_0x0063('0x5e'),_0x55cced['id']);return setRelationship(_0x51cc13,_0x1abac9,_0x55cced,_0x0063('0x6d'));})[_0x0063('0x2b')](function(){return setRelationship(_0x51cc13,_0x4169fd,_0x55cced,_0x0063('0x5f'));})[_0x0063('0x2b')](function(){return getServerInfo(_0x51cc13);})[_0x0063('0x2b')](function(_0xe663e){var _0x727e45=parseInt(_0xe663e['version']['charAt'](0x0));var _0x2a6390=util[_0x0063('0x22')](_0x0063('0x6e'),_0xfdfe86[_0x0063('0x50')],_0x55cced['id']);if(_0x727e45>0x6){_0x2a6390=util['format'](_0x0063('0x62'),_0xfdfe86[_0x0063('0x50')],_0x55cced['id']);}logger[_0x0063('0xd')](_0x0063('0x68'),_0x0063('0x6f'));emit(util[_0x0063('0x22')](_0x0063('0x63'),_0x3b2820[_0x0063('0xf')]),_0x0063('0x64'),{'uri':_0x2a6390});})[_0x0063('0x65')](function(_0x244360){logger[_0x0063('0x70')](_0x0063('0x68'),JSON[_0x0063('0x20')](_0x244360));});};exports[_0x0063('0x71')]=function(_0x450eea,_0x3d9b31,_0x1d139e,_0x27662e,_0x539b8,_0x166a94){var _0x1bea94,_0x3052a6,_0x2fcd65,_0x44ed12;_0x166a94[_0x0063('0x50')]=intUtil['stripTrailingSlash'](_0x166a94['remoteUri']);_0x166a94['serverUrl']=intUtil[_0x0063('0x4f')](_0x166a94['serverUrl']);def[_0x0063('0x72')]=util[_0x0063('0x22')](_0x0063('0x52'),_0x166a94[_0x0063('0x50')]);if(_0x539b8&&_0x539b8[_0x0063('0x53')]){logger[_0x0063('0xd')]('['+_0x3d9b31[_0x0063('0x73')]['toUpperCase']()+']',_0x0063('0x55'));_0x3d9b31['recordingURL']=util[_0x0063('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x166a94['serverUrl'],_0x3d9b31[_0x0063('0x58')],md5(_0x3d9b31[_0x0063('0x58')]));}else{_0x3d9b31['recordingURL']='';}return getConnection(_0x166a94)[_0x0063('0x2b')](function(_0x36d4b2){_0x44ed12=_0x36d4b2;if(!_[_0x0063('0x74')](_0x27662e)){return getUser(_0x166a94,_0x27662e[_0x0063('0xf')],_0x44ed12);}else{return getUser(_0x166a94,null,_0x44ed12);}})[_0x0063('0x2b')](function(_0x42d0c9){_0x1bea94=_0x42d0c9;logger[_0x0063('0xd')](_0x0063('0x59'),_0x1bea94['id']);return getEndUser(_0x166a94,_0x3d9b31[_0x0063('0x5a')],_0x3d9b31['calleridnum'],_0x44ed12);})[_0x0063('0x2b')](function(_0x1db8d3){_0x3052a6=_0x1db8d3;logger[_0x0063('0xd')](_0x0063('0x6b'),_0x3052a6['id']);return getTicket(_0x166a94,_0x1bea94,_0x3052a6,_0x1d139e,_0x3d9b31,_0x1d139e[_0x0063('0x5b')],_0x44ed12,_0x0063('0x5c'));})[_0x0063('0x2b')](function(_0x2352e2){_0x2fcd65=_0x2352e2;logger[_0x0063('0xd')](_0x0063('0x5d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2fcd65['id']);return setRelationship(_0x44ed12,_0x1bea94,_0x2fcd65,_0x0063('0x6d'));})[_0x0063('0x2b')](function(){return setRelationship(_0x44ed12,_0x3052a6,_0x2fcd65,'contacts');})['then'](function(){return getServerInfo(_0x44ed12);})[_0x0063('0x65')](function(_0x3d1c2d){logger[_0x0063('0x70')]('['+_0x3d9b31[_0x0063('0x73')][_0x0063('0x75')]()+']',JSON[_0x0063('0x20')](_0x3d1c2d));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index aa3375f..bf16a5e 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 _0x5152=['validateEmail','isNil','test','util','getString','length','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','type','keyValue','string','format','%s:\x20%s','key','keyContent','keyType','join','stripTrailingSlash','slice','lastIndexOf'];(function(_0x7008c2,_0x3a16d5){var _0xf7ed2a=function(_0x2d4708){while(--_0x2d4708){_0x7008c2['push'](_0x7008c2['shift']());}};_0xf7ed2a(++_0x3a16d5);}(_0x5152,0x155));var _0x2515=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x5152[_0x2bf466];return _0x856885;};'use strict';var _=require('lodash');var util=require(_0x2515('0x0'));exports[_0x2515('0x1')]=function(_0x13532d,_0x4d3208,_0x90f589){var _0x2fe602=[];if(_0x13532d[_0x2515('0x2')]>0x0){var _0x53ac81=_['sortBy'](_0x13532d,['id']);for(var _0x38984e=0x0;_0x38984e<_0x53ac81[_0x2515('0x2')];_0x38984e++){var _0x4e2a44=_0x53ac81[_0x38984e];if(_0x4e2a44['type']==='string'){_0x2fe602[_0x2515('0x3')](_0x4e2a44['content']);}else if(_0x4e2a44['type']===_0x2515('0x4')&&_0x4e2a44[_0x2515('0x5')]){_0x4d3208[_0x4e2a44[_0x2515('0x5')]]&&_0x2fe602['push'](_0x4d3208[_0x4e2a44['variableName']][_0x2515('0x6')]());}else if(_0x4e2a44['type']===_0x2515('0x7')&&_0x4e2a44[_0x2515('0x8')]&&_0x4e2a44['Variable'][_0x2515('0x9')]){_0x4d3208[_0x4e2a44[_0x2515('0x8')][_0x2515('0x9')][_0x2515('0xa')]()]&&_0x2fe602['push'](_0x4d3208[_0x4e2a44['Variable']['name'][_0x2515('0xa')]()][_0x2515('0x6')]());}else if(_0x4e2a44[_0x2515('0xb')]===_0x2515('0xc')){if(_0x4e2a44['keyType']===_0x2515('0xd')&&_0x4e2a44['key']){_0x2fe602['push'](util[_0x2515('0xe')](_0x2515('0xf'),_0x4e2a44[_0x2515('0x10')],_0x4e2a44[_0x2515('0x11')]));}else if(_0x4e2a44[_0x2515('0x12')]===_0x2515('0x4')&&_0x4e2a44['variableName']&&_0x4e2a44['key']){_0x4d3208[_0x4e2a44[_0x2515('0x5')]]&&_0x2fe602[_0x2515('0x3')](util[_0x2515('0xe')](_0x2515('0xf'),_0x4e2a44[_0x2515('0x10')],_0x4d3208[_0x4e2a44['variableName']]));}else if(_0x4e2a44['keyType']===_0x2515('0x7')&&_0x4e2a44['Variable']&&_0x4e2a44[_0x2515('0x8')][_0x2515('0x9')]&&_0x4e2a44['key']){_0x4d3208[_0x4e2a44[_0x2515('0x8')][_0x2515('0x9')][_0x2515('0xa')]()]&&_0x2fe602[_0x2515('0x3')](util[_0x2515('0xe')](_0x2515('0xf'),_0x4e2a44[_0x2515('0x10')],_0x4d3208[_0x4e2a44[_0x2515('0x8')]['name']['toLowerCase']()]));}}}}return _0x2fe602[_0x2515('0x13')](_0x90f589);};exports[_0x2515('0x14')]=function(_0xecbd0){var _0x454a40=_0xecbd0[_0x2515('0x15')](-0x1);if(_0x454a40==='/'){_0xecbd0=_0xecbd0['substring'](0x0,_0xecbd0[_0x2515('0x16')](_0x454a40));}return _0xecbd0;};exports[_0x2515('0x17')]=function(_0x2d3c12){if(!_[_0x2515('0x18')](_0x2d3c12)&&_0x2d3c12!==''){var _0x410a27=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x410a27[_0x2515('0x19')](String(_0x2d3c12)[_0x2515('0xa')]());}else{return![];}}; \ No newline at end of file +var _0x1b73=['Variable','name','push','toLowerCase','keyValue','keyType','format','%s:\x20%s','keyContent','key','join','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','type','string','variable','variableName','toString','customVariable'];(function(_0x29a62d,_0x2790e3){var _0x3fd562=function(_0x161a74){while(--_0x161a74){_0x29a62d['push'](_0x29a62d['shift']());}};_0x3fd562(++_0x2790e3);}(_0x1b73,0x163));var _0x31b7=function(_0x383522,_0x139c39){_0x383522=_0x383522-0x0;var _0x70e7a7=_0x1b73[_0x383522];return _0x70e7a7;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));exports[_0x31b7('0x1')]=function(_0x16c0b2,_0x1ad60a,_0x3bb035){var _0x3160b6=[];if(_0x16c0b2['length']>0x0){var _0x51e183=_['sortBy'](_0x16c0b2,['id']);for(var _0x239d95=0x0;_0x239d95<_0x51e183[_0x31b7('0x2')];_0x239d95++){var _0xd539dd=_0x51e183[_0x239d95];if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0x4')){_0x3160b6['push'](_0xd539dd['content']);}else if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0x5')&&_0xd539dd[_0x31b7('0x6')]){_0x1ad60a[_0xd539dd[_0x31b7('0x6')]]&&_0x3160b6['push'](_0x1ad60a[_0xd539dd['variableName']][_0x31b7('0x7')]());}else if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0x8')&&_0xd539dd[_0x31b7('0x9')]&&_0xd539dd[_0x31b7('0x9')][_0x31b7('0xa')]){_0x1ad60a[_0xd539dd[_0x31b7('0x9')][_0x31b7('0xa')]['toLowerCase']()]&&_0x3160b6[_0x31b7('0xb')](_0x1ad60a[_0xd539dd['Variable'][_0x31b7('0xa')][_0x31b7('0xc')]()]['toString']());}else if(_0xd539dd[_0x31b7('0x3')]===_0x31b7('0xd')){if(_0xd539dd[_0x31b7('0xe')]===_0x31b7('0x4')&&_0xd539dd['key']){_0x3160b6[_0x31b7('0xb')](util[_0x31b7('0xf')](_0x31b7('0x10'),_0xd539dd['key'],_0xd539dd[_0x31b7('0x11')]));}else if(_0xd539dd[_0x31b7('0xe')]===_0x31b7('0x5')&&_0xd539dd[_0x31b7('0x6')]&&_0xd539dd[_0x31b7('0x12')]){_0x1ad60a[_0xd539dd['variableName']]&&_0x3160b6[_0x31b7('0xb')](util[_0x31b7('0xf')]('%s:\x20%s',_0xd539dd['key'],_0x1ad60a[_0xd539dd[_0x31b7('0x6')]]));}else if(_0xd539dd[_0x31b7('0xe')]==='customVariable'&&_0xd539dd[_0x31b7('0x9')]&&_0xd539dd['Variable'][_0x31b7('0xa')]&&_0xd539dd[_0x31b7('0x12')]){_0x1ad60a[_0xd539dd[_0x31b7('0x9')]['name'][_0x31b7('0xc')]()]&&_0x3160b6[_0x31b7('0xb')](util[_0x31b7('0xf')](_0x31b7('0x10'),_0xd539dd['key'],_0x1ad60a[_0xd539dd['Variable'][_0x31b7('0xa')][_0x31b7('0xc')]()]));}}}}return _0x3160b6[_0x31b7('0x13')](_0x3bb035);};exports['stripTrailingSlash']=function(_0x5ed94b){var _0x5c4691=_0x5ed94b[_0x31b7('0x14')](-0x1);if(_0x5c4691==='/'){_0x5ed94b=_0x5ed94b[_0x31b7('0x15')](0x0,_0x5ed94b[_0x31b7('0x16')](_0x5c4691));}return _0x5ed94b;};exports[_0x31b7('0x17')]=function(_0x286552){if(!_[_0x31b7('0x18')](_0x286552)&&_0x286552!==''){var _0x5916bb=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x5916bb[_0x31b7('0x19')](String(_0x286552)[_0x31b7('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index ae8cd15..71c812c 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 _0xce89=['then','success','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','catch','getUser','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','create','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','sessionName','HelpDesk','stringify'];(function(_0x5d0004,_0x4bcb9a){var _0x4be732=function(_0x30e2f4){while(--_0x30e2f4){_0x5d0004['push'](_0x5d0004['shift']());}};_0x4be732(++_0x4bcb9a);}(_0xce89,0xaa));var _0x9ce8=function(_0xfdb740,_0x14c2da){_0xfdb740=_0xfdb740-0x0;var _0x4a837d=_0xce89[_0xfdb740];return _0x4a837d;};'use strict';var _=require(_0x9ce8('0x0'));var rp=require('request-promise');var BPromise=require(_0x9ce8('0x1'));var md5=require(_0x9ce8('0x2'));var util=require(_0x9ce8('0x3'));var Redis=require(_0x9ce8('0x4'));var intUtil=require('./util');var config=require(_0x9ce8('0x5'));var logger=require(_0x9ce8('0x6'))('vTiger');config[_0x9ce8('0x7')]=_[_0x9ce8('0x8')](config[_0x9ce8('0x7')],{'host':_0x9ce8('0x9'),'port':0x18eb});var io=require(_0x9ce8('0xa'))(new Redis(config['redis']));function emit(_0x15c856,_0x1ed314,_0x472bb0){io['to'](_0x15c856)[_0x9ce8('0xb')](_0x1ed314,_0x472bb0);}function getCustomFields(_0x1e2eca,_0x14a710){var _0x38b25b={};if(_0x1e2eca[_0x9ce8('0xc')]>0x0){_[_0x9ce8('0xd')](_0x1e2eca,function(_0x5beabe){if(_0x5beabe[_0x9ce8('0xe')]==='string'&&_0x5beabe[_0x9ce8('0xf')]){_0x38b25b[_0x5beabe['idField']]=_0x5beabe[_0x9ce8('0x10')][_0x9ce8('0x11')]();}else if(_0x5beabe[_0x9ce8('0xe')]==='variable'&&_0x5beabe[_0x9ce8('0x12')]&&_0x5beabe[_0x9ce8('0xf')]&&_0x14a710[_0x5beabe[_0x9ce8('0x12')]]){_0x38b25b[_0x5beabe[_0x9ce8('0xf')]]=_0x14a710[_0x5beabe[_0x9ce8('0x12')]][_0x9ce8('0x11')]();}else if(_0x5beabe['type']===_0x9ce8('0x13')&&_0x5beabe[_0x9ce8('0x14')]&&_0x5beabe['Variable'][_0x9ce8('0x15')]&&_0x5beabe['idField']&&_0x14a710[_0x5beabe[_0x9ce8('0x14')]['name'][_0x9ce8('0x16')]()]){_0x38b25b[_0x5beabe[_0x9ce8('0xf')]]=_0x14a710[_0x5beabe[_0x9ce8('0x14')][_0x9ce8('0x15')]['toLowerCase']()]['toString']();}});}return _0x38b25b;}function createTicket(_0x5a0082,_0x50508a,_0x2ced43,_0x1d50c2,_0x260726,_0x58f806,_0xb9454d){logger[_0x9ce8('0x17')](_0x9ce8('0x18'));var _0x343e89=_[_0x9ce8('0x19')]({'parent_id':'','assigned_user_id':_0x50508a['id'],'ticketpriorities':_0x9ce8('0x1a'),'ticketstatus':_0x9ce8('0x1b'),'ticket_title':intUtil[_0x9ce8('0x1c')](_0x1d50c2[_0x9ce8('0x1d')],_0x260726,'\x20'),'description':intUtil[_0x9ce8('0x1c')](_0x1d50c2[_0x9ce8('0x1e')],_0x260726,'\x0a'),'contact_id':_0x2ced43['id']},getCustomFields(_0x58f806,_0x260726));var _0x513365={'method':_0x9ce8('0x1f'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0x5a0082[_0x9ce8('0x22')]),'form':{'operation':'create','username':_0x5a0082['username'],'sessionName':_0xb9454d[_0x9ce8('0x23')],'elementType':_0x9ce8('0x24'),'element':JSON[_0x9ce8('0x25')](_0x343e89)},'json':!![]};return request(_0x513365)[_0x9ce8('0x26')](function(_0x3a368d){if(_0x3a368d[_0x9ce8('0x27')]){return BPromise['resolve']({'id':_0x3a368d['result']['id']});}else{throw new Error(util[_0x9ce8('0x20')](_0x9ce8('0x28'),JSON[_0x9ce8('0x25')](_0x3a368d[_0x9ce8('0x29')])));}})['catch'](function(_0x534cfb){var _0x5b6fc4=_0x534cfb[_0x9ce8('0x2a')]||0x1f4;logger['error'](_0x9ce8('0x2b'),'createTicket',_0x5b6fc4,JSON['stringify'](_0x534cfb));});}function getUser(_0x38982d,_0x6cc6d7,_0x2f5d8d){if(intUtil[_0x9ce8('0x2c')](_0x6cc6d7)){logger[_0x9ce8('0x17')]('Getting\x20agent\x20with\x20email',_0x6cc6d7);return request({'method':_0x9ce8('0x2d'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0x38982d['remoteUri']),'qs':{'operation':'query','username':_0x38982d[_0x9ce8('0x2e')],'sessionName':_0x2f5d8d['sessionName'],'query':util[_0x9ce8('0x20')](_0x9ce8('0x2f'),_0x6cc6d7)},'json':!![]})[_0x9ce8('0x26')](function(_0x31a65d){if(_0x31a65d['success']&&_0x31a65d[_0x9ce8('0x30')]['length']){logger[_0x9ce8('0x17')](_0x9ce8('0x31'));return BPromise['resolve']({'id':_0x31a65d['result'][0x0]['id'],'email':_0x31a65d[_0x9ce8('0x30')][0x0][_0x9ce8('0x32')],'name':_0x31a65d[_0x9ce8('0x30')][0x0][_0x9ce8('0x33')]+'\x20'+_0x31a65d[_0x9ce8('0x30')][_0x9ce8('0x34')]});}else{logger[_0x9ce8('0x17')](_0x9ce8('0x35'));return BPromise[_0x9ce8('0x36')]({'id':_0x2f5d8d[_0x9ce8('0x37')],'email':_0x38982d[_0x9ce8('0x2e')],'name':_0x9ce8('0x38')});}})['catch'](function(_0x4291c4){var _0x47eeab=_0x4291c4['statusCode']||0x1f4;logger[_0x9ce8('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x47eeab,JSON[_0x9ce8('0x25')](_0x4291c4));});}else{logger[_0x9ce8('0x17')](_0x9ce8('0x35'));return BPromise[_0x9ce8('0x36')]({'id':_0x2f5d8d[_0x9ce8('0x37')],'email':_0x38982d[_0x9ce8('0x2e')],'name':_0x9ce8('0x38')})[_0x9ce8('0x39')](function(_0x12b5be){var _0x1d9820=_0x12b5be[_0x9ce8('0x2a')]||0x1f4;logger['error'](_0x9ce8('0x2b'),_0x9ce8('0x3a'),_0x1d9820,JSON[_0x9ce8('0x25')](_0x12b5be));});}}function getEndUser(_0x1382d3,_0x6cf2be,_0xe5bfcc,_0x1270a3){logger[_0x9ce8('0x17')](_0x9ce8('0x3b'),_0xe5bfcc);return request({'method':_0x9ce8('0x2d'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0x1382d3[_0x9ce8('0x22')]),'qs':{'operation':_0x9ce8('0x3c'),'username':_0x1382d3[_0x9ce8('0x2e')],'sessionName':_0x1270a3[_0x9ce8('0x23')],'query':util[_0x9ce8('0x20')](_0x9ce8('0x3d'),_0xe5bfcc,_0xe5bfcc,_0xe5bfcc,_0xe5bfcc,_0xe5bfcc)},'json':!![]})[_0x9ce8('0x26')](function(_0x59efec){if(_0x59efec[_0x9ce8('0x27')]&&_0x59efec[_0x9ce8('0x30')][_0x9ce8('0xc')]){logger[_0x9ce8('0x17')](_0x9ce8('0x3e'));return BPromise['resolve']({'id':_0x59efec[_0x9ce8('0x30')][0x0]['id'],'name':_0x59efec[_0x9ce8('0x30')][0x0][_0x9ce8('0x3f')]+'\x20'+_0x59efec[_0x9ce8('0x30')][0x0][_0x9ce8('0x40')],'phone':_0xe5bfcc});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x9ce8('0x1f'),'uri':util['format'](_0x9ce8('0x21'),_0x1382d3['remoteUri']),'form':{'operation':_0x9ce8('0x41'),'sessionName':_0x1270a3[_0x9ce8('0x23')],'elementType':_0x9ce8('0x42'),'element':JSON['stringify']({'lastname':_0x6cf2be,'phone':_0xe5bfcc,'assigned_user_id':'\x20'})},'json':!![]})[_0x9ce8('0x26')](function(_0x56e6e6){logger[_0x9ce8('0x17')](_0x9ce8('0x43'));return BPromise['resolve']({'id':_0x56e6e6['result']['id'],'name':_0x56e6e6['result'][_0x9ce8('0x40')],'phone':_0x56e6e6[_0x9ce8('0x30')][_0x9ce8('0x44')]});})['catch'](function(_0x45a4c5){var _0xd234c0=_0x45a4c5[_0x9ce8('0x2a')]||0x1f4;logger[_0x9ce8('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x9ce8('0x45'),_0xd234c0,JSON[_0x9ce8('0x25')](_0x45a4c5));});}});}function getConnection(_0xf71cb6){var _0x3179b0=_0xf71cb6[_0x9ce8('0x2e')];var _0x2553ee=_0xf71cb6[_0x9ce8('0x46')];return request({'method':_0x9ce8('0x2d'),'uri':util[_0x9ce8('0x20')]('%s/webservice.php',_0xf71cb6['remoteUri']),'qs':{'operation':_0x9ce8('0x47'),'username':_0x3179b0},'json':!![]})['then'](function(_0x357f59){if(_0x357f59[_0x9ce8('0x27')]){return request({'method':_0x9ce8('0x1f'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0xf71cb6[_0x9ce8('0x22')]),'form':{'operation':'login','username':_0x3179b0,'accessKey':md5(_0x357f59[_0x9ce8('0x30')][_0x9ce8('0x48')]+_0x2553ee)},'json':!![]});}})[_0x9ce8('0x26')](function(_0x5deddc){if(_0x5deddc[_0x9ce8('0x27')]){return BPromise[_0x9ce8('0x36')](_0x5deddc[_0x9ce8('0x30')]);}else{throw new Error(util[_0x9ce8('0x20')](_0x9ce8('0x49'),_0xf71cb6['id']));}})['catch'](function(_0x5e70c2){var _0xd532f3=_0x5e70c2[_0x9ce8('0x2a')]||0x1f4;logger[_0x9ce8('0x29')](_0x9ce8('0x2b'),'getConnection',_0xd532f3,JSON[_0x9ce8('0x25')](_0x5e70c2));});}function request(_0x99bafa){logger[_0x9ce8('0x17')](_0x9ce8('0x4a'),JSON['stringify'](_0x99bafa));return rp(_0x99bafa);}exports['queue']=function(_0x5cf438,_0x180e75,_0x4aac60,_0x55a706,_0x31bc24,_0x534452){var _0x291689,_0x44da7d,_0x3ed47e,_0x1ed9f6;_0x534452[_0x9ce8('0x22')]=intUtil[_0x9ce8('0x4b')](_0x534452[_0x9ce8('0x22')]);if(_0x31bc24&&_0x31bc24['monitor_format']){logger[_0x9ce8('0x17')](_0x9ce8('0x4c'),_0x9ce8('0x4d'));_0x180e75['recordingURL']=util[_0x9ce8('0x20')](_0x9ce8('0x4e'),_0x534452[_0x9ce8('0x4f')],_0x180e75[_0x9ce8('0x50')],md5(_0x180e75[_0x9ce8('0x50')]));}else{_0x180e75[_0x9ce8('0x51')]='';}return getConnection(_0x534452)['then'](function(_0x66b744){_0x1ed9f6=_0x66b744;return getUser(_0x534452,_0x55a706[_0x9ce8('0x52')],_0x1ed9f6);})['then'](function(_0x1665fa){_0x291689=_0x1665fa;logger['info'](_0x9ce8('0x53'),_0x291689['id']);return getEndUser(_0x534452,_0x180e75[_0x9ce8('0x54')],_0x180e75[_0x9ce8('0x55')],_0x1ed9f6);})[_0x9ce8('0x26')](function(_0x8427e4){_0x44da7d=_0x8427e4;logger['info'](_0x9ce8('0x56'),_0x44da7d['id']);return createTicket(_0x534452,_0x291689,_0x44da7d,_0x4aac60,_0x180e75,_0x4aac60['Fields'],_0x1ed9f6);})[_0x9ce8('0x26')](function(_0x5be219){_0x3ed47e=_0x5be219;logger[_0x9ce8('0x17')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3ed47e['id']);var _0x2dad34=util[_0x9ce8('0x20')](_0x9ce8('0x57'),_0x534452['remoteUri'],_[_0x9ce8('0x58')](_0x3ed47e['id'],'x')[0x1]);logger[_0x9ce8('0x17')](_0x9ce8('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9ce8('0x20')](_0x9ce8('0x59'),_0x55a706['name']),_0x9ce8('0x5a'),{'uri':_0x2dad34});})[_0x9ce8('0x39')](function(_0x35f410){logger[_0x9ce8('0x29')]('[QUEUE]',JSON[_0x9ce8('0x25')](_0x35f410));});};exports['outbound']=function(_0x595966,_0x26763f,_0x283d79,_0x283f95,_0x18b2d3,_0x18a1ca,_0x2c043d){var _0x1e4eec,_0x34e7ca,_0x237456,_0x3ab11b;_0x18a1ca[_0x9ce8('0x22')]=intUtil[_0x9ce8('0x4b')](_0x18a1ca[_0x9ce8('0x22')]);_0x18a1ca[_0x9ce8('0x4f')]=intUtil[_0x9ce8('0x4b')](_0x18a1ca['serverUrl']);if(_0x2c043d&&_0x2c043d[_0x9ce8('0x5b')]&&_0x2c043d['recordingFormat']!==_0x9ce8('0x5c')){logger[_0x9ce8('0x17')](_0x9ce8('0x5d'),_0x9ce8('0x4d'));_0x26763f[_0x9ce8('0x51')]=util[_0x9ce8('0x20')](_0x9ce8('0x4e'),_0x18a1ca[_0x9ce8('0x4f')],_0x26763f[_0x9ce8('0x50')],md5(_0x26763f['uniqueid']));}return getConnection(_0x18a1ca)[_0x9ce8('0x26')](function(_0x582317){_0x3ab11b=_0x582317;return getUser(_0x18a1ca,_0x283f95[_0x9ce8('0x52')],_0x3ab11b);})[_0x9ce8('0x26')](function(_0x206563){_0x1e4eec=_0x206563;logger['info'](_0x9ce8('0x53'),_0x1e4eec['id']);return getEndUser(_0x18a1ca,_0x26763f[_0x9ce8('0x5e')],_0x26763f[_0x9ce8('0x5f')],_0x3ab11b);})[_0x9ce8('0x26')](function(_0x53cc79){_0x34e7ca=_0x53cc79;logger[_0x9ce8('0x17')]('The\x20Enduser\x20ID\x20is:',_0x34e7ca['id']);return createTicket(_0x18a1ca,_0x1e4eec,_0x34e7ca,_0x283d79,_0x26763f,_0x283d79[_0x9ce8('0x60')],_0x3ab11b);})[_0x9ce8('0x26')](function(_0x2d5b80){_0x237456=_0x2d5b80;logger[_0x9ce8('0x17')](_0x9ce8('0x61'));logger[_0x9ce8('0x17')](_0x9ce8('0x62'),_0x237456['id']);var _0x380d49=util[_0x9ce8('0x20')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x18a1ca[_0x9ce8('0x22')],_['split'](_0x237456['id'],'x')[0x1]);logger[_0x9ce8('0x17')](_0x9ce8('0x5d'),_0x9ce8('0x63'));emit(util[_0x9ce8('0x20')](_0x9ce8('0x59'),_0x283f95[_0x9ce8('0x15')]),_0x9ce8('0x5a'),{'uri':_0x380d49});})[_0x9ce8('0x39')](function(_0x1f1ec7){logger[_0x9ce8('0x29')]('[OUTBOUND]',JSON['stringify'](_0x1f1ec7));});};exports[_0x9ce8('0x64')]=function(_0x8f05fe,_0x83c6e1,_0x4155d3,_0x1284f9,_0x2cc5d0,_0x4b7d66){var _0x58516d,_0x99b046,_0x29b7f5,_0x1a8955;_0x4b7d66[_0x9ce8('0x22')]=intUtil[_0x9ce8('0x4b')](_0x4b7d66['remoteUri']);_0x4b7d66[_0x9ce8('0x4f')]=intUtil[_0x9ce8('0x4b')](_0x4b7d66['serverUrl']);if(_0x2cc5d0&&_0x2cc5d0[_0x9ce8('0x65')]){logger[_0x9ce8('0x17')]('['+_0x83c6e1[_0x9ce8('0x66')][_0x9ce8('0x67')]()+']','Recording\x20is\x20enabled!');_0x83c6e1[_0x9ce8('0x51')]=util[_0x9ce8('0x20')](_0x9ce8('0x4e'),_0x4b7d66[_0x9ce8('0x4f')],_0x83c6e1['uniqueid'],md5(_0x83c6e1[_0x9ce8('0x50')]));}else{_0x83c6e1['recordingURL']='';}return getConnection(_0x4b7d66)[_0x9ce8('0x26')](function(_0x35d17d){_0x1a8955=_0x35d17d;return getUser(_0x4b7d66,'',_0x1a8955);})['then'](function(_0x2f4ba3){_0x58516d=_0x2f4ba3;logger['info'](_0x9ce8('0x53'),_0x58516d['id']);return getEndUser(_0x4b7d66,_0x83c6e1['calleridname'],_0x83c6e1[_0x9ce8('0x55')],_0x1a8955);})[_0x9ce8('0x26')](function(_0x397b21){_0x99b046=_0x397b21;logger[_0x9ce8('0x17')](_0x9ce8('0x56'),_0x99b046['id']);return createTicket(_0x4b7d66,_0x58516d,_0x99b046,_0x4155d3,_0x83c6e1,_0x4155d3['Fields'],_0x1a8955);})[_0x9ce8('0x26')](function(_0x1d2f58){_0x29b7f5=_0x1d2f58;logger[_0x9ce8('0x17')](_0x9ce8('0x61'));logger['info'](_0x9ce8('0x62'),_0x29b7f5['id']);})[_0x9ce8('0x39')](function(_0x4621bb){logger[_0x9ce8('0x29')]('['+_0x83c6e1[_0x9ce8('0x66')]['toUpperCase']()+']',JSON[_0x9ce8('0x25')](_0x4621bb));});}; \ No newline at end of file +var _0x98dc=['resolve','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','result','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','admin','%s/webservice.php','Enduser\x20found!','firstname','lastname','Contacts','phone','getEndUser','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','serverUrl','recordingFormat','email','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','calleridname','Ticket\x20created!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','socket.io-emitter','emit','length','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','Subjects','getString','POST','remoteUri','create','sessionName','HelpDesk','stringify','success'];(function(_0x28f76b,_0x357734){var _0x19c11e=function(_0x48d0ca){while(--_0x48d0ca){_0x28f76b['push'](_0x28f76b['shift']());}};_0x19c11e(++_0x357734);}(_0x98dc,0x96));var _0xc98d=function(_0x1f39d1,_0x3ac1cd){_0x1f39d1=_0x1f39d1-0x0;var _0x4dd32c=_0x98dc[_0x1f39d1];return _0x4dd32c;};'use strict';var _=require(_0xc98d('0x0'));var rp=require(_0xc98d('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xc98d('0x2'));var Redis=require(_0xc98d('0x3'));var intUtil=require(_0xc98d('0x4'));var config=require(_0xc98d('0x5'));var logger=require(_0xc98d('0x6'))(_0xc98d('0x7'));config[_0xc98d('0x8')]=_[_0xc98d('0x9')](config[_0xc98d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc98d('0xa'))(new Redis(config[_0xc98d('0x8')]));function emit(_0x2a86e3,_0x286edc,_0x145a00){io['to'](_0x2a86e3)[_0xc98d('0xb')](_0x286edc,_0x145a00);}function getCustomFields(_0x5e7b63,_0x517138){var _0x539d4e={};if(_0x5e7b63[_0xc98d('0xc')]>0x0){_['forEach'](_0x5e7b63,function(_0x3d45dc){if(_0x3d45dc[_0xc98d('0xd')]===_0xc98d('0xe')&&_0x3d45dc[_0xc98d('0xf')]){_0x539d4e[_0x3d45dc[_0xc98d('0xf')]]=_0x3d45dc['content'][_0xc98d('0x10')]();}else if(_0x3d45dc[_0xc98d('0xd')]===_0xc98d('0x11')&&_0x3d45dc[_0xc98d('0x12')]&&_0x3d45dc[_0xc98d('0xf')]&&_0x517138[_0x3d45dc[_0xc98d('0x12')]]){_0x539d4e[_0x3d45dc[_0xc98d('0xf')]]=_0x517138[_0x3d45dc[_0xc98d('0x12')]]['toString']();}else if(_0x3d45dc[_0xc98d('0xd')]===_0xc98d('0x13')&&_0x3d45dc[_0xc98d('0x14')]&&_0x3d45dc[_0xc98d('0x14')]['name']&&_0x3d45dc[_0xc98d('0xf')]&&_0x517138[_0x3d45dc['Variable'][_0xc98d('0x15')][_0xc98d('0x16')]()]){_0x539d4e[_0x3d45dc[_0xc98d('0xf')]]=_0x517138[_0x3d45dc[_0xc98d('0x14')]['name'][_0xc98d('0x16')]()]['toString']();}});}return _0x539d4e;}function createTicket(_0x4a6e97,_0x14bc4c,_0x56e60b,_0x25daff,_0x5e9730,_0x1109ac,_0x331f22){logger[_0xc98d('0x17')]('Creating\x20new\x20ticket...');var _0x3b9219=_[_0xc98d('0x18')]({'parent_id':'','assigned_user_id':_0x14bc4c['id'],'ticketpriorities':_0xc98d('0x19'),'ticketstatus':_0xc98d('0x1a'),'ticket_title':intUtil['getString'](_0x25daff[_0xc98d('0x1b')],_0x5e9730,'\x20'),'description':intUtil[_0xc98d('0x1c')](_0x25daff['Descriptions'],_0x5e9730,'\x0a'),'contact_id':_0x56e60b['id']},getCustomFields(_0x1109ac,_0x5e9730));var _0x1f965c={'method':_0xc98d('0x1d'),'uri':util['format']('%s/webservice.php',_0x4a6e97[_0xc98d('0x1e')]),'form':{'operation':_0xc98d('0x1f'),'username':_0x4a6e97['username'],'sessionName':_0x331f22[_0xc98d('0x20')],'elementType':_0xc98d('0x21'),'element':JSON[_0xc98d('0x22')](_0x3b9219)},'json':!![]};return request(_0x1f965c)['then'](function(_0x5a4058){if(_0x5a4058[_0xc98d('0x23')]){return BPromise[_0xc98d('0x24')]({'id':_0x5a4058['result']['id']});}else{throw new Error(util[_0xc98d('0x25')](_0xc98d('0x26'),JSON['stringify'](_0x5a4058[_0xc98d('0x27')])));}})[_0xc98d('0x28')](function(_0x8262c6){var _0x5bb0bd=_0x8262c6[_0xc98d('0x29')]||0x1f4;logger[_0xc98d('0x27')](_0xc98d('0x2a'),'createTicket',_0x5bb0bd,JSON['stringify'](_0x8262c6));});}function getUser(_0x5c87e1,_0x139be0,_0x4af3a9){if(intUtil['validateEmail'](_0x139be0)){logger['info'](_0xc98d('0x2b'),_0x139be0);return request({'method':_0xc98d('0x2c'),'uri':util[_0xc98d('0x25')]('%s/webservice.php',_0x5c87e1[_0xc98d('0x1e')]),'qs':{'operation':_0xc98d('0x2d'),'username':_0x5c87e1['username'],'sessionName':_0x4af3a9[_0xc98d('0x20')],'query':util[_0xc98d('0x25')](_0xc98d('0x2e'),_0x139be0)},'json':!![]})[_0xc98d('0x2f')](function(_0xdd44a7){if(_0xdd44a7[_0xc98d('0x23')]&&_0xdd44a7[_0xc98d('0x30')]['length']){logger[_0xc98d('0x17')](_0xc98d('0x31'));return BPromise[_0xc98d('0x24')]({'id':_0xdd44a7[_0xc98d('0x30')][0x0]['id'],'email':_0xdd44a7[_0xc98d('0x30')][0x0][_0xc98d('0x32')],'name':_0xdd44a7['result'][0x0][_0xc98d('0x33')]+'\x20'+_0xdd44a7[_0xc98d('0x30')]['last_name']});}else{logger[_0xc98d('0x17')](_0xc98d('0x34'));return BPromise[_0xc98d('0x24')]({'id':_0x4af3a9['userId'],'email':_0x5c87e1[_0xc98d('0x35')],'name':_0xc98d('0x36')});}})[_0xc98d('0x28')](function(_0x3c46a0){var _0x4a96a0=_0x3c46a0[_0xc98d('0x29')]||0x1f4;logger[_0xc98d('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4a96a0,JSON[_0xc98d('0x22')](_0x3c46a0));});}else{logger[_0xc98d('0x17')](_0xc98d('0x34'));return BPromise['resolve']({'id':_0x4af3a9['userId'],'email':_0x5c87e1[_0xc98d('0x35')],'name':_0xc98d('0x36')})[_0xc98d('0x28')](function(_0x2d76b3){var _0x2f220f=_0x2d76b3[_0xc98d('0x29')]||0x1f4;logger['error'](_0xc98d('0x2a'),'getUser',_0x2f220f,JSON[_0xc98d('0x22')](_0x2d76b3));});}}function getEndUser(_0x2fa4dd,_0x4248e7,_0x20a6b5,_0x4ed72d){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x20a6b5);return request({'method':'GET','uri':util[_0xc98d('0x25')](_0xc98d('0x37'),_0x2fa4dd['remoteUri']),'qs':{'operation':'query','username':_0x2fa4dd[_0xc98d('0x35')],'sessionName':_0x4ed72d['sessionName'],'query':util['format']('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x20a6b5,_0x20a6b5,_0x20a6b5,_0x20a6b5,_0x20a6b5)},'json':!![]})['then'](function(_0x5896ac){if(_0x5896ac[_0xc98d('0x23')]&&_0x5896ac[_0xc98d('0x30')][_0xc98d('0xc')]){logger[_0xc98d('0x17')](_0xc98d('0x38'));return BPromise['resolve']({'id':_0x5896ac['result'][0x0]['id'],'name':_0x5896ac[_0xc98d('0x30')][0x0][_0xc98d('0x39')]+'\x20'+_0x5896ac[_0xc98d('0x30')][0x0][_0xc98d('0x3a')],'phone':_0x20a6b5});}else{logger[_0xc98d('0x17')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0xc98d('0x25')]('%s/webservice.php',_0x2fa4dd['remoteUri']),'form':{'operation':_0xc98d('0x1f'),'sessionName':_0x4ed72d[_0xc98d('0x20')],'elementType':_0xc98d('0x3b'),'element':JSON[_0xc98d('0x22')]({'lastname':_0x4248e7,'phone':_0x20a6b5,'assigned_user_id':'\x20'})},'json':!![]})[_0xc98d('0x2f')](function(_0x351713){logger[_0xc98d('0x17')]('Enduser\x20created.');return BPromise[_0xc98d('0x24')]({'id':_0x351713[_0xc98d('0x30')]['id'],'name':_0x351713[_0xc98d('0x30')][_0xc98d('0x3a')],'phone':_0x351713['result'][_0xc98d('0x3c')]});})[_0xc98d('0x28')](function(_0x4ec319){var _0x1fdea7=_0x4ec319[_0xc98d('0x29')]||0x1f4;logger[_0xc98d('0x27')](_0xc98d('0x2a'),_0xc98d('0x3d'),_0x1fdea7,JSON[_0xc98d('0x22')](_0x4ec319));});}});}function getConnection(_0x56b4af){var _0x1a5437=_0x56b4af[_0xc98d('0x35')];var _0x31efa4=_0x56b4af['accessKey'];return request({'method':_0xc98d('0x2c'),'uri':util[_0xc98d('0x25')](_0xc98d('0x37'),_0x56b4af[_0xc98d('0x1e')]),'qs':{'operation':_0xc98d('0x3e'),'username':_0x1a5437},'json':!![]})[_0xc98d('0x2f')](function(_0x5f40b5){if(_0x5f40b5['success']){return request({'method':_0xc98d('0x1d'),'uri':util['format'](_0xc98d('0x37'),_0x56b4af['remoteUri']),'form':{'operation':'login','username':_0x1a5437,'accessKey':md5(_0x5f40b5[_0xc98d('0x30')][_0xc98d('0x3f')]+_0x31efa4)},'json':!![]});}})[_0xc98d('0x2f')](function(_0x416d55){if(_0x416d55[_0xc98d('0x23')]){return BPromise[_0xc98d('0x24')](_0x416d55[_0xc98d('0x30')]);}else{throw new Error(util[_0xc98d('0x25')](_0xc98d('0x40'),_0x56b4af['id']));}})[_0xc98d('0x28')](function(_0x1d5b6f){var _0x2924aa=_0x1d5b6f[_0xc98d('0x29')]||0x1f4;logger['error'](_0xc98d('0x2a'),_0xc98d('0x41'),_0x2924aa,JSON[_0xc98d('0x22')](_0x1d5b6f));});}function request(_0x5d15d4){logger['info'](_0xc98d('0x42'),JSON['stringify'](_0x5d15d4));return rp(_0x5d15d4);}exports[_0xc98d('0x43')]=function(_0x15b956,_0x536e13,_0x297050,_0x579a7b,_0x4c7eea,_0x5df668){var _0x891b91,_0x115c17,_0x2f1ede,_0x1de65a;_0x5df668['remoteUri']=intUtil[_0xc98d('0x44')](_0x5df668[_0xc98d('0x1e')]);if(_0x4c7eea&&_0x4c7eea['monitor_format']){logger[_0xc98d('0x17')](_0xc98d('0x45'),_0xc98d('0x46'));_0x536e13[_0xc98d('0x47')]=util[_0xc98d('0x25')](_0xc98d('0x48'),_0x5df668['serverUrl'],_0x536e13[_0xc98d('0x49')],md5(_0x536e13[_0xc98d('0x49')]));}else{_0x536e13[_0xc98d('0x47')]='';}return getConnection(_0x5df668)[_0xc98d('0x2f')](function(_0x4b22e8){_0x1de65a=_0x4b22e8;return getUser(_0x5df668,_0x579a7b['email'],_0x1de65a);})['then'](function(_0x3528ac){_0x891b91=_0x3528ac;logger[_0xc98d('0x17')](_0xc98d('0x4a'),_0x891b91['id']);return getEndUser(_0x5df668,_0x536e13['calleridname'],_0x536e13[_0xc98d('0x4b')],_0x1de65a);})[_0xc98d('0x2f')](function(_0x364df7){_0x115c17=_0x364df7;logger[_0xc98d('0x17')](_0xc98d('0x4c'),_0x115c17['id']);return createTicket(_0x5df668,_0x891b91,_0x115c17,_0x297050,_0x536e13,_0x297050[_0xc98d('0x4d')],_0x1de65a);})[_0xc98d('0x2f')](function(_0x29ab91){_0x2f1ede=_0x29ab91;logger[_0xc98d('0x17')]('Ticket\x20created!');logger[_0xc98d('0x17')](_0xc98d('0x4e'),_0x2f1ede['id']);var _0x419f20=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x5df668['remoteUri'],_[_0xc98d('0x4f')](_0x2f1ede['id'],'x')[0x1]);logger[_0xc98d('0x17')](_0xc98d('0x45'),_0xc98d('0x50'));emit(util[_0xc98d('0x25')](_0xc98d('0x51'),_0x579a7b[_0xc98d('0x15')]),'trigger:browser:url',{'uri':_0x419f20});})['catch'](function(_0x2c3623){logger[_0xc98d('0x27')](_0xc98d('0x45'),JSON['stringify'](_0x2c3623));});};exports[_0xc98d('0x52')]=function(_0x18d4e4,_0x1a1fd6,_0x148ace,_0x3f9aef,_0x208826,_0x2e41cf,_0x282573){var _0x1892e9,_0x52d62c,_0x6eddbd,_0x13385c;_0x2e41cf[_0xc98d('0x1e')]=intUtil['stripTrailingSlash'](_0x2e41cf[_0xc98d('0x1e')]);_0x2e41cf[_0xc98d('0x53')]=intUtil[_0xc98d('0x44')](_0x2e41cf[_0xc98d('0x53')]);if(_0x282573&&_0x282573[_0xc98d('0x54')]&&_0x282573[_0xc98d('0x54')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1a1fd6[_0xc98d('0x47')]=util['format'](_0xc98d('0x48'),_0x2e41cf['serverUrl'],_0x1a1fd6[_0xc98d('0x49')],md5(_0x1a1fd6[_0xc98d('0x49')]));}return getConnection(_0x2e41cf)[_0xc98d('0x2f')](function(_0xe2ea90){_0x13385c=_0xe2ea90;return getUser(_0x2e41cf,_0x3f9aef[_0xc98d('0x55')],_0x13385c);})[_0xc98d('0x2f')](function(_0x4a3e5f){_0x1892e9=_0x4a3e5f;logger[_0xc98d('0x17')]('The\x20User\x20ID\x20is:',_0x1892e9['id']);return getEndUser(_0x2e41cf,_0x1a1fd6['destcalleridname'],_0x1a1fd6['destcalleridnum'],_0x13385c);})[_0xc98d('0x2f')](function(_0x30823f){_0x52d62c=_0x30823f;logger[_0xc98d('0x17')](_0xc98d('0x4c'),_0x52d62c['id']);return createTicket(_0x2e41cf,_0x1892e9,_0x52d62c,_0x148ace,_0x1a1fd6,_0x148ace[_0xc98d('0x4d')],_0x13385c);})['then'](function(_0x363ff0){_0x6eddbd=_0x363ff0;logger['info']('Ticket\x20created!');logger['info'](_0xc98d('0x4e'),_0x6eddbd['id']);var _0x48a6fa=util[_0xc98d('0x25')](_0xc98d('0x56'),_0x2e41cf[_0xc98d('0x1e')],_['split'](_0x6eddbd['id'],'x')[0x1]);logger[_0xc98d('0x17')](_0xc98d('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc98d('0x25')](_0xc98d('0x51'),_0x3f9aef['name']),_0xc98d('0x58'),{'uri':_0x48a6fa});})['catch'](function(_0x2d19ab){logger[_0xc98d('0x27')]('[OUTBOUND]',JSON[_0xc98d('0x22')](_0x2d19ab));});};exports['unmanaged']=function(_0x107246,_0x3bb6b5,_0x32b8aa,_0x20edbf,_0x472f94,_0x2220d1){var _0x41564d,_0x345f52,_0x3cebe6,_0x18eb64;_0x2220d1[_0xc98d('0x1e')]=intUtil[_0xc98d('0x44')](_0x2220d1['remoteUri']);_0x2220d1[_0xc98d('0x53')]=intUtil[_0xc98d('0x44')](_0x2220d1[_0xc98d('0x53')]);if(_0x472f94&&_0x472f94['monitor_format']){logger[_0xc98d('0x17')]('['+_0x3bb6b5[_0xc98d('0x59')][_0xc98d('0x5a')]()+']',_0xc98d('0x46'));_0x3bb6b5[_0xc98d('0x47')]=util[_0xc98d('0x25')](_0xc98d('0x48'),_0x2220d1[_0xc98d('0x53')],_0x3bb6b5[_0xc98d('0x49')],md5(_0x3bb6b5[_0xc98d('0x49')]));}else{_0x3bb6b5[_0xc98d('0x47')]='';}return getConnection(_0x2220d1)[_0xc98d('0x2f')](function(_0xa1a21c){_0x18eb64=_0xa1a21c;return getUser(_0x2220d1,'',_0x18eb64);})[_0xc98d('0x2f')](function(_0x518a81){_0x41564d=_0x518a81;logger[_0xc98d('0x17')](_0xc98d('0x4a'),_0x41564d['id']);return getEndUser(_0x2220d1,_0x3bb6b5[_0xc98d('0x5b')],_0x3bb6b5[_0xc98d('0x4b')],_0x18eb64);})['then'](function(_0x39e2ba){_0x345f52=_0x39e2ba;logger[_0xc98d('0x17')](_0xc98d('0x4c'),_0x345f52['id']);return createTicket(_0x2220d1,_0x41564d,_0x345f52,_0x32b8aa,_0x3bb6b5,_0x32b8aa[_0xc98d('0x4d')],_0x18eb64);})[_0xc98d('0x2f')](function(_0x5b3ef7){_0x3cebe6=_0x5b3ef7;logger['info'](_0xc98d('0x5c'));logger[_0xc98d('0x17')]('The\x20Ticket\x20ID\x20is:',_0x3cebe6['id']);})[_0xc98d('0x28')](function(_0x99832){logger[_0xc98d('0x27')]('['+_0x3bb6b5[_0xc98d('0x59')]['toUpperCase']()+']',JSON['stringify'](_0x99832));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 7bdb8a0..b7493e7 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 _0xfa59=['%s/search.json','type:user\x20role:agent\x20email:%s','count','results','agent','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','debug','[HTTP]','map','type','nameField','customField','toLowerCase','content','string','idField','variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail'];(function(_0x3e24f4,_0x2a95b8){var _0x2c91f7=function(_0x282056){while(--_0x282056){_0x3e24f4['push'](_0x3e24f4['shift']());}};_0x2c91f7(++_0x2a95b8);}(_0xfa59,0x121));var _0x9fa5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfa59[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x9fa5('0x0'));var util=require(_0x9fa5('0x1'));var Redis=require(_0x9fa5('0x2'));var intUtil=require(_0x9fa5('0x3'));var config=require(_0x9fa5('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0x9fa5('0x5')]=_[_0x9fa5('0x6')](config[_0x9fa5('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9fa5('0x5')]));function emit(_0x22ce04,_0x17c8ee,_0x50dd56){io['to'](_0x22ce04)['emit'](_0x17c8ee,_0x50dd56);}var headers={'Content-Type':_0x9fa5('0x7'),'Accept':_0x9fa5('0x7')};function getTicket(_0x5e197d,_0x19c67e,_0x16b1f3,_0x88cf7a,_0x2c6513){logger[_0x9fa5('0x8')](_0x9fa5('0x9'));return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0xb'),_0x5e197d[_0x9fa5('0xc')]),'method':_0x9fa5('0xd'),'body':{'ticket':_[_0x9fa5('0xe')]({'requester_id':_0x16b1f3['id'],'submitter_id':_0x19c67e?_0x19c67e['id']:undefined,'assignee_id':_0x19c67e?_0x19c67e['id']:undefined,'tags':getTags(_0x88cf7a[_0x9fa5('0xf')],_0x9fa5('0x10')),'subject':intUtil[_0x9fa5('0x11')](_0x88cf7a['Subjects'],_0x2c6513,'\x20'),'description':intUtil[_0x9fa5('0x11')](_0x88cf7a[_0x9fa5('0x12')],_0x2c6513,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9fa5('0x11')](_0x88cf7a[_0x9fa5('0x12')],_0x2c6513,'\x0a')}},getCustomFields(_0x88cf7a[_0x9fa5('0x13')],_0x2c6513))}})['then'](function(_0x440713){logger[_0x9fa5('0x8')](_0x9fa5('0x14'));return _0x440713[_0x9fa5('0x15')];});}function getUser(_0x22fa3a,_0x510603){if(intUtil[_0x9fa5('0x16')](_0x510603)){logger[_0x9fa5('0x8')]('Getting\x20agent\x20with\x20email',_0x510603);return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x17'),_0x22fa3a['remoteUri']),'qs':{'query':util[_0x9fa5('0xa')](_0x9fa5('0x18'),_0x510603)}})['then'](function(_0x3e871b){if(_0x3e871b[_0x9fa5('0x19')]){logger['info']('Agent\x20found!');return _['find'](_0x3e871b[_0x9fa5('0x1a')],{'email':_0x510603,'role':_0x9fa5('0x1b')});}else{logger[_0x9fa5('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9fa5('0xa')]('%s/users/me.json',_0x22fa3a[_0x9fa5('0xc')])})[_0x9fa5('0x1c')](function(_0x4546a8){logger[_0x9fa5('0x8')](_0x9fa5('0x1d'));return _0x4546a8[_0x9fa5('0x1e')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x22fa3a[_0x9fa5('0xc')])})[_0x9fa5('0x1c')](function(_0x33e026){logger[_0x9fa5('0x8')](_0x9fa5('0x1d'));return _0x33e026[_0x9fa5('0x1e')];});}}function getEndUser(_0x53511d,_0x472f2c,_0x4c6419){logger[_0x9fa5('0x8')](_0x9fa5('0x1f'),_0x4c6419);return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x17'),_0x53511d[_0x9fa5('0xc')]),'qs':{'query':util[_0x9fa5('0xa')](_0x9fa5('0x20'),_0x4c6419)}})[_0x9fa5('0x1c')](function(_0x36fae0){var _0x1d89f2;if(_0x36fae0[_0x9fa5('0x1a')][_0x9fa5('0x21')]){_0x36fae0[_0x9fa5('0x1a')]=_[_0x9fa5('0x22')](_0x36fae0['results'],{'suspended':![],'role':'end-user'});if(_0x36fae0['results']['length']){_0x1d89f2=_[_0x9fa5('0x23')](_0x36fae0[_0x9fa5('0x1a')]);}}if(_0x1d89f2){logger[_0x9fa5('0x8')](_0x9fa5('0x24'));return _0x1d89f2;}else{logger['info'](_0x9fa5('0x25'));return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x26'),_0x53511d[_0x9fa5('0xc')]),'method':_0x9fa5('0xd'),'body':{'user':{'role':_0x9fa5('0x27'),'name':util[_0x9fa5('0xa')](_0x9fa5('0x28'),_0x472f2c||_0x4c6419),'phone':_0x4c6419}}})[_0x9fa5('0x1c')](function(_0xd20fb3){logger[_0x9fa5('0x8')](_0x9fa5('0x29'));return _0xd20fb3[_0x9fa5('0x1e')];});}});}function getAuth(_0x53176a){var _0x3ca454;if(_0x53176a[_0x9fa5('0x2a')]==='password'){_0x3ca454=util[_0x9fa5('0xa')](_0x9fa5('0x2b'),_0x53176a[_0x9fa5('0x2c')],_0x53176a[_0x9fa5('0x2d')]);}else if(_0x53176a[_0x9fa5('0x2a')]===_0x9fa5('0x2e')){_0x3ca454=util[_0x9fa5('0xa')]('%s/token:%s',_0x53176a[_0x9fa5('0x2c')],_0x53176a[_0x9fa5('0x2e')]);}return util['format'](_0x9fa5('0x2f'),new Buffer(_0x3ca454)[_0x9fa5('0x30')](_0x9fa5('0x31')));}function request(_0x5f077d){logger[_0x9fa5('0x32')](_0x9fa5('0x33'),JSON['stringify'](_0x5f077d));return rp(_[_0x9fa5('0x6')](_0x5f077d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3370b3,_0x7279f){var _0x1033fd=[];if(_0x3370b3&&_0x3370b3[_0x9fa5('0x21')]>0x0){_0x1033fd=_[_0x9fa5('0x34')](_0x3370b3,_0x7279f);}return _0x1033fd;}function getCustomFields(_0x4863c3,_0x40ee51){var _0x2a7d06=[];var _0x47c7de={'custom_fields':[]};if(_0x4863c3[_0x9fa5('0x21')]>0x0){_['forEach'](_0x4863c3,function(_0x319677){if(_0x319677[_0x9fa5('0x35')]==='string'&&_0x319677[_0x9fa5('0x36')]&&!_0x319677[_0x9fa5('0x37')]){_0x47c7de[_0x319677[_0x9fa5('0x36')][_0x9fa5('0x38')]()]=_0x319677[_0x9fa5('0x39')][_0x9fa5('0x30')]();}else if(_0x319677[_0x9fa5('0x35')]===_0x9fa5('0x3a')&&_0x319677['idField']&&_0x319677[_0x9fa5('0x37')]){_0x47c7de['custom_fields']['push']({'id':_0x319677[_0x9fa5('0x3b')],'value':_0x319677[_0x9fa5('0x39')][_0x9fa5('0x30')]()});}else if(_0x319677[_0x9fa5('0x35')]===_0x9fa5('0x3c')&&_0x319677[_0x9fa5('0x3d')]&&_0x319677[_0x9fa5('0x3b')]&&_0x319677['customField']){_0x40ee51[_0x319677['variableName']]&&_0x47c7de[_0x9fa5('0x3e')][_0x9fa5('0x3f')]({'id':_0x319677[_0x9fa5('0x3b')],'value':_0x40ee51[_0x319677[_0x9fa5('0x3d')]][_0x9fa5('0x30')]()});}else if(_0x319677['type']===_0x9fa5('0x40')&&_0x319677[_0x9fa5('0x41')]&&_0x319677[_0x9fa5('0x41')]['name']&&_0x319677['idField']&&_0x319677[_0x9fa5('0x37')]){_0x40ee51[_0x319677['Variable'][_0x9fa5('0x10')][_0x9fa5('0x38')]()]&&_0x47c7de['custom_fields'][_0x9fa5('0x3f')]({'id':_0x319677[_0x9fa5('0x3b')],'value':_0x40ee51[_0x319677[_0x9fa5('0x41')][_0x9fa5('0x10')][_0x9fa5('0x38')]()][_0x9fa5('0x30')]()});}});}return _0x47c7de;}exports[_0x9fa5('0x42')]=function(_0x3cbfc6,_0x1bc04c,_0x2adb5b,_0x4f3da3,_0x1ea532,_0x1c4762){var _0xee5fcf,_0x2e7091;_0x1c4762[_0x9fa5('0xc')]=intUtil[_0x9fa5('0x43')](_0x1c4762[_0x9fa5('0xc')]);_0x1c4762['serverUrl']=intUtil[_0x9fa5('0x43')](_0x1c4762[_0x9fa5('0x44')]);if(_0x1ea532&&_0x1ea532['monitor_format']){logger[_0x9fa5('0x8')](_0x9fa5('0x45'),_0x9fa5('0x46'));_0x1bc04c['recordingURL']=util[_0x9fa5('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c4762[_0x9fa5('0x44')],_0x1bc04c[_0x9fa5('0x47')],md5(_0x1bc04c[_0x9fa5('0x47')]));}else{_0x1bc04c[_0x9fa5('0x48')]='';}headers['Authorization']=getAuth(_0x1c4762);return getUser(_0x1c4762,_0x4f3da3[_0x9fa5('0x49')])[_0x9fa5('0x1c')](function(_0x4cfeaf){_0xee5fcf=_0x4cfeaf;logger[_0x9fa5('0x8')](_0x9fa5('0x4a'),_0xee5fcf['id']);return getEndUser(_0x1c4762,_0x1bc04c[_0x9fa5('0x4b')],_0x1bc04c[_0x9fa5('0x4c')]);})['then'](function(_0x212154){_0x2e7091=_0x212154;logger[_0x9fa5('0x8')](_0x9fa5('0x4d'),_0x2e7091['id']);return getTicket(_0x1c4762,_0xee5fcf,_0x2e7091,_0x2adb5b,_0x1bc04c);})['then'](function(_0x3b5de8){if(_0x3b5de8){logger[_0x9fa5('0x8')](_0x9fa5('0x4e'),_0x3b5de8['id']);switch(_0x1c4762[_0x9fa5('0x35')]){case _0x9fa5('0x4f'):logger['info'](_0x9fa5('0x45'),_0x9fa5('0x50'));return request({'uri':util['format'](_0x9fa5('0x51'),_0x1c4762[_0x9fa5('0xc')],_0xee5fcf['id'],_0x3b5de8['id']),'method':_0x9fa5('0xd')});case _0x9fa5('0x52'):logger[_0x9fa5('0x8')](_0x9fa5('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9fa5('0xa')](_0x9fa5('0x53'),_0x4f3da3[_0x9fa5('0x10')]),_0x9fa5('0x54'),{'uri':util[_0x9fa5('0xa')](_0x9fa5('0x55'),_0x1c4762[_0x9fa5('0xc')][_0x9fa5('0x56')]('/api/v2',''),_0x3b5de8['id'])});break;default:logger[_0x9fa5('0x57')](_0x9fa5('0x45'),_0x9fa5('0x58'));}}})[_0x9fa5('0x59')](function(_0x5082cb){logger[_0x9fa5('0x57')](_0x9fa5('0x5a'),util['inspect'](_0x5082cb,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5c1922,_0x44c62d,_0x57b167,_0x29ebd7,_0x1c87cd,_0x4db2eb,_0x821bd8){var _0x1d0207,_0x1e0e2f;_0x4db2eb[_0x9fa5('0xc')]=intUtil[_0x9fa5('0x43')](_0x4db2eb[_0x9fa5('0xc')]);_0x4db2eb[_0x9fa5('0x44')]=intUtil['stripTrailingSlash'](_0x4db2eb['serverUrl']);if(_0x821bd8&&_0x821bd8['recordingFormat']&&_0x821bd8[_0x9fa5('0x5b')]!=='none'){logger['info'](_0x9fa5('0x5c'),_0x9fa5('0x46'));_0x44c62d[_0x9fa5('0x48')]=util[_0x9fa5('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4db2eb[_0x9fa5('0x44')],_0x44c62d[_0x9fa5('0x47')],md5(_0x44c62d[_0x9fa5('0x47')]));}headers[_0x9fa5('0x5d')]=getAuth(_0x4db2eb);return getUser(_0x4db2eb,_0x29ebd7[_0x9fa5('0x49')])[_0x9fa5('0x1c')](function(_0x16b34b){_0x1d0207=_0x16b34b;logger[_0x9fa5('0x8')]('The\x20User\x20ID\x20is:',_0x1d0207['id']);return getEndUser(_0x4db2eb,_0x44c62d[_0x9fa5('0x5e')],_0x44c62d[_0x9fa5('0x5f')]);})[_0x9fa5('0x1c')](function(_0x4e03a0){_0x1e0e2f=_0x4e03a0;logger[_0x9fa5('0x8')](_0x9fa5('0x4d'),_0x1e0e2f['id']);return getTicket(_0x4db2eb,_0x1d0207,_0x1e0e2f,_0x57b167,_0x44c62d);})[_0x9fa5('0x1c')](function(_0x5b44ed){if(_0x5b44ed){logger['info'](_0x9fa5('0x4e'),_0x5b44ed['id']);switch(_0x4db2eb[_0x9fa5('0x35')]){case'integrationTab':logger['info'](_0x9fa5('0x5c'),_0x9fa5('0x50'));return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x51'),_0x4db2eb['remoteUri'],_0x1d0207['id'],_0x5b44ed['id']),'method':'POST'});case _0x9fa5('0x52'):logger[_0x9fa5('0x8')](_0x9fa5('0x5c'),_0x9fa5('0x60'));emit(util['format']('user:%s',_0x29ebd7['name']),_0x9fa5('0x54'),{'uri':util[_0x9fa5('0xa')]('%s/agent/tickets/%s',_0x4db2eb['remoteUri'][_0x9fa5('0x56')](_0x9fa5('0x61'),''),_0x5b44ed['id'])});break;default:logger[_0x9fa5('0x57')](_0x9fa5('0x5c'),_0x9fa5('0x58'));}}})[_0x9fa5('0x59')](function(_0x3a6406){logger[_0x9fa5('0x57')](_0x9fa5('0x62'),util[_0x9fa5('0x63')](_0x3a6406,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xf33120,_0x2b419a,_0xbd9e76,_0x16989b,_0x201f6d,_0x19c81f){var _0x496a4e,_0x2501bc;_0x19c81f['remoteUri']=intUtil[_0x9fa5('0x43')](_0x19c81f[_0x9fa5('0xc')]);_0x19c81f['serverUrl']=intUtil[_0x9fa5('0x43')](_0x19c81f[_0x9fa5('0x44')]);if(_0x201f6d&&_0x201f6d['monitor_format']){logger[_0x9fa5('0x8')]('['+_0x2b419a[_0x9fa5('0x64')][_0x9fa5('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b419a[_0x9fa5('0x48')]=util[_0x9fa5('0xa')](_0x9fa5('0x66'),_0x19c81f[_0x9fa5('0x44')],_0x2b419a['uniqueid'],md5(_0x2b419a['uniqueid']));}else{_0x2b419a[_0x9fa5('0x48')]='';}headers['Authorization']=getAuth(_0x19c81f);return getUser(_0x19c81f)[_0x9fa5('0x1c')](function(_0x10b033){_0x496a4e=_0x10b033;logger[_0x9fa5('0x8')](_0x9fa5('0x4a'),_0x496a4e['id']);return getEndUser(_0x19c81f,_0x2b419a[_0x9fa5('0x4b')],_0x2b419a[_0x9fa5('0x4c')]);})[_0x9fa5('0x1c')](function(_0x389318){_0x2501bc=_0x389318;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2501bc['id']);return getTicket(_0x19c81f,_0x496a4e,_0x2501bc,_0xbd9e76,_0x2b419a);})[_0x9fa5('0x1c')](function(_0x8e0829){if(_0x8e0829){logger['info'](_0x9fa5('0x4e'),_0x8e0829['id']);}})[_0x9fa5('0x59')](function(_0x53f010){logger['error']('['+_0x2b419a[_0x9fa5('0x64')][_0x9fa5('0x65')]()+']'+_0x9fa5('0x67'),util[_0x9fa5('0x63')](_0x53f010,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x02ad=['zendesk','redis','defaults','localhost','emit','application/json','info','format','%s/tickets.json','POST','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','toLowerCase','content','string','idField','customField','push','variableName','customVariable','Variable','custom_fields','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','./util','../../../../config/logger'];(function(_0x1b2477,_0x368cc0){var _0x38b837=function(_0x353499){while(--_0x353499){_0x1b2477['push'](_0x1b2477['shift']());}};_0x38b837(++_0x368cc0);}(_0x02ad,0x68));var _0xd02a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x02ad[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var rp=require(_0xd02a('0x0'));var md5=require(_0xd02a('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd02a('0x2'));var config=require('../../../../config/environment');var logger=require(_0xd02a('0x3'))(_0xd02a('0x4'));config[_0xd02a('0x5')]=_[_0xd02a('0x6')](config[_0xd02a('0x5')],{'host':_0xd02a('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd02a('0x5')]));function emit(_0x113939,_0x5327c1,_0x1b4cd3){io['to'](_0x113939)[_0xd02a('0x8')](_0x5327c1,_0x1b4cd3);}var headers={'Content-Type':_0xd02a('0x9'),'Accept':'application/json'};function getTicket(_0x14f52d,_0x39b452,_0x1a55a7,_0xb290e8,_0x284ce2){logger[_0xd02a('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd02a('0xb')](_0xd02a('0xc'),_0x14f52d['remoteUri']),'method':_0xd02a('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x1a55a7['id'],'submitter_id':_0x39b452?_0x39b452['id']:undefined,'assignee_id':_0x39b452?_0x39b452['id']:undefined,'tags':getTags(_0xb290e8['Tags'],_0xd02a('0xe')),'subject':intUtil[_0xd02a('0xf')](_0xb290e8[_0xd02a('0x10')],_0x284ce2,'\x20'),'description':intUtil['getString'](_0xb290e8[_0xd02a('0x11')],_0x284ce2,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xb290e8['Descriptions'],_0x284ce2,'\x0a')}},getCustomFields(_0xb290e8[_0xd02a('0x12')],_0x284ce2))}})[_0xd02a('0x13')](function(_0x1b85cf){logger[_0xd02a('0xa')](_0xd02a('0x14'));return _0x1b85cf['ticket'];});}function getUser(_0x896b3,_0x4832b0){if(intUtil[_0xd02a('0x15')](_0x4832b0)){logger[_0xd02a('0xa')](_0xd02a('0x16'),_0x4832b0);return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x17'),_0x896b3[_0xd02a('0x18')]),'qs':{'query':util[_0xd02a('0xb')](_0xd02a('0x19'),_0x4832b0)}})[_0xd02a('0x13')](function(_0x35636a){if(_0x35636a[_0xd02a('0x1a')]){logger[_0xd02a('0xa')](_0xd02a('0x1b'));return _[_0xd02a('0x1c')](_0x35636a[_0xd02a('0x1d')],{'email':_0x4832b0,'role':_0xd02a('0x1e')});}else{logger['info'](_0xd02a('0x1f'));return request({'uri':util[_0xd02a('0xb')]('%s/users/me.json',_0x896b3[_0xd02a('0x18')])})[_0xd02a('0x13')](function(_0x3fac0a){logger['info'](_0xd02a('0x20'));return _0x3fac0a[_0xd02a('0x21')];});}});}else{logger[_0xd02a('0xa')](_0xd02a('0x1f'));return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x22'),_0x896b3[_0xd02a('0x18')])})[_0xd02a('0x13')](function(_0x29ff5f){logger[_0xd02a('0xa')](_0xd02a('0x20'));return _0x29ff5f[_0xd02a('0x21')];});}}function getEndUser(_0x334b04,_0x2638b4,_0x3e6ec2){logger[_0xd02a('0xa')](_0xd02a('0x23'),_0x3e6ec2);return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x17'),_0x334b04[_0xd02a('0x18')]),'qs':{'query':util[_0xd02a('0xb')](_0xd02a('0x24'),_0x3e6ec2)}})[_0xd02a('0x13')](function(_0x4ac4ed){var _0x377a3d;if(_0x4ac4ed['results']['length']){_0x4ac4ed[_0xd02a('0x1d')]=_[_0xd02a('0x25')](_0x4ac4ed[_0xd02a('0x1d')],{'suspended':![],'role':_0xd02a('0x26')});if(_0x4ac4ed['results'][_0xd02a('0x27')]){_0x377a3d=_[_0xd02a('0x28')](_0x4ac4ed[_0xd02a('0x1d')]);}}if(_0x377a3d){logger['info'](_0xd02a('0x29'));return _0x377a3d;}else{logger[_0xd02a('0xa')](_0xd02a('0x2a'));return request({'uri':util['format'](_0xd02a('0x2b'),_0x334b04[_0xd02a('0x18')]),'method':'POST','body':{'user':{'role':_0xd02a('0x26'),'name':util[_0xd02a('0xb')](_0xd02a('0x2c'),_0x2638b4||_0x3e6ec2),'phone':_0x3e6ec2}}})[_0xd02a('0x13')](function(_0x23d024){logger[_0xd02a('0xa')]('Enduser\x20created.');return _0x23d024[_0xd02a('0x21')];});}});}function getAuth(_0x38ac84){var _0x2fa5a7;if(_0x38ac84[_0xd02a('0x2d')]===_0xd02a('0x2e')){_0x2fa5a7=util[_0xd02a('0xb')](_0xd02a('0x2f'),_0x38ac84[_0xd02a('0x30')],_0x38ac84['password']);}else if(_0x38ac84[_0xd02a('0x2d')]==='token'){_0x2fa5a7=util[_0xd02a('0xb')](_0xd02a('0x31'),_0x38ac84[_0xd02a('0x30')],_0x38ac84[_0xd02a('0x32')]);}return util[_0xd02a('0xb')](_0xd02a('0x33'),new Buffer(_0x2fa5a7)[_0xd02a('0x34')](_0xd02a('0x35')));}function request(_0xede411){logger[_0xd02a('0x36')](_0xd02a('0x37'),JSON[_0xd02a('0x38')](_0xede411));return rp(_[_0xd02a('0x6')](_0xede411,{'method':_0xd02a('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x88c4e2,_0x5803c5){var _0x55d2a9=[];if(_0x88c4e2&&_0x88c4e2[_0xd02a('0x27')]>0x0){_0x55d2a9=_[_0xd02a('0x3a')](_0x88c4e2,_0x5803c5);}return _0x55d2a9;}function getCustomFields(_0x3db1b1,_0x45f0e5){var _0x1c8379=[];var _0x285202={'custom_fields':[]};if(_0x3db1b1[_0xd02a('0x27')]>0x0){_[_0xd02a('0x3b')](_0x3db1b1,function(_0xc9d287){if(_0xc9d287[_0xd02a('0x3c')]==='string'&&_0xc9d287[_0xd02a('0x3d')]&&!_0xc9d287['customField']){_0x285202[_0xc9d287['nameField'][_0xd02a('0x3e')]()]=_0xc9d287[_0xd02a('0x3f')]['toString']();}else if(_0xc9d287[_0xd02a('0x3c')]===_0xd02a('0x40')&&_0xc9d287[_0xd02a('0x41')]&&_0xc9d287[_0xd02a('0x42')]){_0x285202['custom_fields'][_0xd02a('0x43')]({'id':_0xc9d287[_0xd02a('0x41')],'value':_0xc9d287[_0xd02a('0x3f')][_0xd02a('0x34')]()});}else if(_0xc9d287[_0xd02a('0x3c')]==='variable'&&_0xc9d287['variableName']&&_0xc9d287[_0xd02a('0x41')]&&_0xc9d287[_0xd02a('0x42')]){_0x45f0e5[_0xc9d287['variableName']]&&_0x285202['custom_fields'][_0xd02a('0x43')]({'id':_0xc9d287['idField'],'value':_0x45f0e5[_0xc9d287[_0xd02a('0x44')]][_0xd02a('0x34')]()});}else if(_0xc9d287[_0xd02a('0x3c')]===_0xd02a('0x45')&&_0xc9d287[_0xd02a('0x46')]&&_0xc9d287[_0xd02a('0x46')][_0xd02a('0xe')]&&_0xc9d287[_0xd02a('0x41')]&&_0xc9d287[_0xd02a('0x42')]){_0x45f0e5[_0xc9d287[_0xd02a('0x46')][_0xd02a('0xe')][_0xd02a('0x3e')]()]&&_0x285202[_0xd02a('0x47')][_0xd02a('0x43')]({'id':_0xc9d287[_0xd02a('0x41')],'value':_0x45f0e5[_0xc9d287[_0xd02a('0x46')][_0xd02a('0xe')][_0xd02a('0x3e')]()][_0xd02a('0x34')]()});}});}return _0x285202;}exports['queue']=function(_0x366d62,_0x57c30c,_0x1c950b,_0x372087,_0x3aa9e0,_0x56fde5){var _0xa4e309,_0x1e74c2;_0x56fde5[_0xd02a('0x18')]=intUtil[_0xd02a('0x48')](_0x56fde5[_0xd02a('0x18')]);_0x56fde5[_0xd02a('0x49')]=intUtil['stripTrailingSlash'](_0x56fde5[_0xd02a('0x49')]);if(_0x3aa9e0&&_0x3aa9e0['monitor_format']){logger[_0xd02a('0xa')]('[QUEUE]',_0xd02a('0x4a'));_0x57c30c[_0xd02a('0x4b')]=util['format'](_0xd02a('0x4c'),_0x56fde5[_0xd02a('0x49')],_0x57c30c[_0xd02a('0x4d')],md5(_0x57c30c[_0xd02a('0x4d')]));}else{_0x57c30c['recordingURL']='';}headers[_0xd02a('0x4e')]=getAuth(_0x56fde5);return getUser(_0x56fde5,_0x372087[_0xd02a('0x4f')])['then'](function(_0x1ea9ef){_0xa4e309=_0x1ea9ef;logger[_0xd02a('0xa')]('The\x20User\x20ID\x20is:',_0xa4e309['id']);return getEndUser(_0x56fde5,_0x57c30c[_0xd02a('0x50')],_0x57c30c['calleridnum']);})[_0xd02a('0x13')](function(_0x56a830){_0x1e74c2=_0x56a830;logger[_0xd02a('0xa')](_0xd02a('0x51'),_0x1e74c2['id']);return getTicket(_0x56fde5,_0xa4e309,_0x1e74c2,_0x1c950b,_0x57c30c);})[_0xd02a('0x13')](function(_0x4a8f41){if(_0x4a8f41){logger[_0xd02a('0xa')](_0xd02a('0x52'),_0x4a8f41['id']);switch(_0x56fde5[_0xd02a('0x3c')]){case _0xd02a('0x53'):logger['info'](_0xd02a('0x54'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x55'),_0x56fde5['remoteUri'],_0xa4e309['id'],_0x4a8f41['id']),'method':_0xd02a('0xd')});case _0xd02a('0x56'):logger[_0xd02a('0xa')](_0xd02a('0x54'),_0xd02a('0x57'));emit(util['format'](_0xd02a('0x58'),_0x372087[_0xd02a('0xe')]),_0xd02a('0x59'),{'uri':util[_0xd02a('0xb')](_0xd02a('0x5a'),_0x56fde5[_0xd02a('0x18')][_0xd02a('0x5b')](_0xd02a('0x5c'),''),_0x4a8f41['id'])});break;default:logger[_0xd02a('0x5d')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x35f368){logger['error'](_0xd02a('0x5e'),util[_0xd02a('0x5f')](_0x35f368,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x32256b,_0x36da29,_0x250e53,_0x4bb560,_0x482360,_0x35d98c,_0x3e5c83){var _0x30e40f,_0xcc8d79;_0x35d98c[_0xd02a('0x18')]=intUtil[_0xd02a('0x48')](_0x35d98c[_0xd02a('0x18')]);_0x35d98c[_0xd02a('0x49')]=intUtil[_0xd02a('0x48')](_0x35d98c['serverUrl']);if(_0x3e5c83&&_0x3e5c83['recordingFormat']&&_0x3e5c83['recordingFormat']!=='none'){logger['info'](_0xd02a('0x60'),_0xd02a('0x4a'));_0x36da29[_0xd02a('0x4b')]=util['format'](_0xd02a('0x4c'),_0x35d98c[_0xd02a('0x49')],_0x36da29[_0xd02a('0x4d')],md5(_0x36da29[_0xd02a('0x4d')]));}headers[_0xd02a('0x4e')]=getAuth(_0x35d98c);return getUser(_0x35d98c,_0x4bb560[_0xd02a('0x4f')])[_0xd02a('0x13')](function(_0x4ad2e0){_0x30e40f=_0x4ad2e0;logger[_0xd02a('0xa')](_0xd02a('0x61'),_0x30e40f['id']);return getEndUser(_0x35d98c,_0x36da29['destcalleridname'],_0x36da29[_0xd02a('0x62')]);})[_0xd02a('0x13')](function(_0x2310ea){_0xcc8d79=_0x2310ea;logger[_0xd02a('0xa')](_0xd02a('0x51'),_0xcc8d79['id']);return getTicket(_0x35d98c,_0x30e40f,_0xcc8d79,_0x250e53,_0x36da29);})[_0xd02a('0x13')](function(_0x271111){if(_0x271111){logger['info'](_0xd02a('0x52'),_0x271111['id']);switch(_0x35d98c['type']){case'integrationTab':logger[_0xd02a('0xa')]('[OUTBOUND]',_0xd02a('0x63'));return request({'uri':util[_0xd02a('0xb')](_0xd02a('0x55'),_0x35d98c[_0xd02a('0x18')],_0x30e40f['id'],_0x271111['id']),'method':_0xd02a('0xd')});case'newTab':logger[_0xd02a('0xa')](_0xd02a('0x60'),_0xd02a('0x57'));emit(util[_0xd02a('0xb')](_0xd02a('0x58'),_0x4bb560[_0xd02a('0xe')]),_0xd02a('0x59'),{'uri':util['format'](_0xd02a('0x5a'),_0x35d98c[_0xd02a('0x18')][_0xd02a('0x5b')]('/api/v2',''),_0x271111['id'])});break;default:logger[_0xd02a('0x5d')]('[OUTBOUND]',_0xd02a('0x64'));}}})[_0xd02a('0x65')](function(_0x27e833){logger[_0xd02a('0x5d')](_0xd02a('0x66'),util[_0xd02a('0x5f')](_0x27e833,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x213b48,_0x2f47d4,_0x58f1e7,_0x438621,_0xf7c202,_0x473ca9){var _0x3168ad,_0x3c35f8;_0x473ca9[_0xd02a('0x18')]=intUtil['stripTrailingSlash'](_0x473ca9['remoteUri']);_0x473ca9[_0xd02a('0x49')]=intUtil[_0xd02a('0x48')](_0x473ca9[_0xd02a('0x49')]);if(_0xf7c202&&_0xf7c202[_0xd02a('0x67')]){logger[_0xd02a('0xa')]('['+_0x2f47d4[_0xd02a('0x68')]['toUpperCase']()+']',_0xd02a('0x4a'));_0x2f47d4[_0xd02a('0x4b')]=util[_0xd02a('0xb')](_0xd02a('0x4c'),_0x473ca9[_0xd02a('0x49')],_0x2f47d4['uniqueid'],md5(_0x2f47d4[_0xd02a('0x4d')]));}else{_0x2f47d4[_0xd02a('0x4b')]='';}headers['Authorization']=getAuth(_0x473ca9);return getUser(_0x473ca9)[_0xd02a('0x13')](function(_0x123d2c){_0x3168ad=_0x123d2c;logger[_0xd02a('0xa')]('The\x20User\x20ID\x20is:',_0x3168ad['id']);return getEndUser(_0x473ca9,_0x2f47d4['calleridname'],_0x2f47d4[_0xd02a('0x69')]);})['then'](function(_0xd8313c){_0x3c35f8=_0xd8313c;logger[_0xd02a('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3c35f8['id']);return getTicket(_0x473ca9,_0x3168ad,_0x3c35f8,_0x58f1e7,_0x2f47d4);})['then'](function(_0x44b422){if(_0x44b422){logger[_0xd02a('0xa')](_0xd02a('0x52'),_0x44b422['id']);}})[_0xd02a('0x65')](function(_0x548e41){logger[_0xd02a('0x5d')]('['+_0x2f47d4[_0xd02a('0x68')][_0xd02a('0x6a')]()+']'+_0xd02a('0x6b'),util[_0xd02a('0x5f')](_0x548e41,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 0725a27..9e5296e 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 _0x0854=['Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','mm:ss','answertime','endtime','utc','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','/api/voice/recordings/','destcalleridnum','Outbound','user:%s','[OUTBOUND]','toUpperCase','lodash','md5','util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Administrator','user','Using\x20the\x20admin\x20account!','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString'];(function(_0x1ff39e,_0x49c7f4){var _0x32bf89=function(_0x2ad262){while(--_0x2ad262){_0x1ff39e['push'](_0x1ff39e['shift']());}};_0x32bf89(++_0x49c7f4);}(_0x0854,0xd9));var _0x4085=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0854[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4085('0x0'));var rp=require('request-promise');var md5=require(_0x4085('0x1'));var util=require(_0x4085('0x2'));var intUtil=require('./util');var moment=require(_0x4085('0x3'));var Redis=require(_0x4085('0x4'));var BPromise=require(_0x4085('0x5'));var config=require(_0x4085('0x6'));var logger=require('../../../../config/logger')(_0x4085('0x7'));config[_0x4085('0x8')]=_[_0x4085('0x9')](config[_0x4085('0x8')],{'host':_0x4085('0xa'),'port':0x18eb});var io=require(_0x4085('0xb'))(new Redis(config['redis']));function emit(_0xb10def,_0x4cf43c,_0x58d4eb){io['to'](_0xb10def)[_0x4085('0xc')](_0x4cf43c,_0x58d4eb);}function request(_0x23c35f){logger[_0x4085('0xd')](_0x4085('0xe'),JSON[_0x4085('0xf')](_0x23c35f));return rp(_0x23c35f);}function getCustomFields(_0x1d9ea8,_0x404fb4){var _0x3a0704={};if(_0x1d9ea8['length']>0x0){_[_0x4085('0x10')](_0x1d9ea8,function(_0x41a3e1){if(_0x41a3e1[_0x4085('0x11')]===_0x4085('0x12')&&_0x41a3e1['idField']){_0x3a0704[_0x41a3e1[_0x4085('0x13')]]=_0x41a3e1[_0x4085('0x14')][_0x4085('0x15')]();}else if(_0x41a3e1[_0x4085('0x11')]==='variable'&&_0x41a3e1[_0x4085('0x16')]&&_0x41a3e1[_0x4085('0x13')]&&_0x404fb4[_0x41a3e1[_0x4085('0x16')]]){_0x3a0704[_0x41a3e1[_0x4085('0x13')]]=_0x404fb4[_0x41a3e1['variableName']][_0x4085('0x15')]();}else if(_0x41a3e1[_0x4085('0x11')]===_0x4085('0x17')&&_0x41a3e1['Variable']&&_0x41a3e1[_0x4085('0x18')][_0x4085('0x19')]&&_0x41a3e1[_0x4085('0x13')]&&_0x404fb4[_0x41a3e1[_0x4085('0x18')][_0x4085('0x19')][_0x4085('0x1a')]()]){_0x3a0704[_0x41a3e1[_0x4085('0x13')]]=_0x404fb4[_0x41a3e1[_0x4085('0x18')][_0x4085('0x19')]['toLowerCase']()][_0x4085('0x15')]();}});}return _0x3a0704;}function getName(_0x1a16c8){if(_0x1a16c8[_0x4085('0x1b')]('\x20')>0x0){var _0x141d28=_0x1a16c8['split'](/ (.+)/);if(_0x141d28[0x1]){return _0x141d28;}}return[_0x1a16c8,_0x1a16c8];}var accountsTokens={};function getAccessToken(_0x269edf){return new Promise(function(_0x451d1e,_0x246b75){if(!_[_0x4085('0x1c')](accountsTokens[_0x269edf['id']])&&!_[_0x4085('0x1c')](accountsTokens[_0x269edf['id']][_0x4085('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x269edf['id']][_0x4085('0x1e')])){_0x451d1e(accountsTokens[_0x269edf['id']]['access_token']);}}var _0x48dcf5;switch(_0x269edf[_0x4085('0x1f')]){case'US':_0x48dcf5='https://accounts.zoho.com';break;case'AU':_0x48dcf5=_0x4085('0x20');break;case'EU':_0x48dcf5=_0x4085('0x21');break;case'IN':_0x48dcf5=_0x4085('0x22');break;case'CN':_0x48dcf5=_0x4085('0x23');break;default:_0x48dcf5='https://accounts.zoho.eu';break;}var _0x591c6b={'method':_0x4085('0x24'),'uri':_0x48dcf5+'/oauth/v2/token','qs':{'refresh_token':_0x269edf['refreshToken'],'client_id':_0x269edf[_0x4085('0x25')],'client_secret':_0x269edf['clientSecret'],'grant_type':_0x4085('0x26')},'json':!![]};return rp(_0x591c6b)[_0x4085('0x27')](function(_0xdb74d3){accountsTokens[_0x269edf['id']]={'access_token':_0xdb74d3[_0x4085('0x1d')],'expires_in':moment()[_0x4085('0x28')](_0xdb74d3['expires_in'],_0x4085('0x29'))};_0x451d1e(_0xdb74d3[_0x4085('0x1d')]);})[_0x4085('0x2a')](function(_0x1bacf6){logger['error'](_0x4085('0x2b'),_0x1bacf6['stack']);_0x246b75(_0x1bacf6);});});}function getUser(_0x457210,_0x45969b,_0x29952e,_0x2e285b){logger[_0x4085('0x2c')](_0x4085('0x2d'));return request({'method':_0x4085('0x2e'),'uri':util[_0x4085('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x45969b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x4085('0x30')+_0x457210},'json':!![]})['then'](function(_0x3b8dbf){if(_0x3b8dbf[_0x4085('0x31')]){var _0x2f552e=-0x1;if(_[_0x4085('0x32')](_0x3b8dbf[_0x4085('0x31')])){if(!_['isNil'](_0x2e285b)){_0x2f552e=_[_0x4085('0x33')](_0x3b8dbf[_0x4085('0x31')],function(_0x4d89f7){return _0x4d89f7[_0x4085('0x34')]===_0x2e285b;});}if(_0x2f552e>=0x0){logger[_0x4085('0x2c')](_0x4085('0x35'));}else{logger[_0x4085('0x2c')]('Using\x20the\x20admin\x20account!');_0x2f552e=_[_0x4085('0x33')](_0x3b8dbf[_0x4085('0x31')],function(_0x43474e){return _0x43474e['profile'][_0x4085('0x19')]===_0x4085('0x36');});}return _0x3b8dbf[_0x4085('0x31')][_0x2f552e];}else{if(_0x3b8dbf[_0x4085('0x37')]['profile']['name']===_0x4085('0x36')){logger[_0x4085('0x2c')](_0x4085('0x38'));user=_0x3b8dbf[_0x4085('0x37')];return user;}else{logger[_0x4085('0x39')](_0x4085('0x3a'),JSON[_0x4085('0xf')](_0x3b8dbf));throw new Error(_0x4085('0x3b')+JSON[_0x4085('0xf')](_0x3b8dbf));}}}else{logger['error'](_0x4085('0x3a'),JSON[_0x4085('0xf')](_0x3b8dbf));throw new Error(_0x4085('0x3b')+JSON[_0x4085('0xf')](_0x3b8dbf));}})[_0x4085('0x2a')](function(_0x577d08){console['error'](_0x577d08);});}function getZohoUser(_0x211d0d,_0x3e68b4){return new BPromise(function(_0x43587a,_0x38b47a){request(_0x211d0d)[_0x4085('0x27')](function(_0x304193){var _0x193db2=null;if(_0x304193){_0x193db2=_0x304193['data'][0x0];_0x193db2[_0x4085('0x3c')]=_0x3e68b4;}_0x43587a(_0x193db2);})[_0x4085('0x2a')](function(_0x3082bd){_0x38b47a(_0x3082bd);});});}function createEndUser(_0xd664e1,_0x5a4c4c,_0x2e6e3c,_0x53257f,_0x35ab4c,_0x196693){var _0x2e6e3c=getName(_0x2e6e3c);return request({'method':_0x4085('0x24'),'uri':_0x4085('0x3d')+_0x5a4c4c+_0x4085('0x3e')+_['startCase'](_0x196693[_0x4085('0x3f')])+'s','body':{'data':[{'Last_Name':_0x2e6e3c[0x1],'First_Name':_0x2e6e3c[0x0],'Phone':_0x53257f,'Owner':{'name':!_[_0x4085('0x1c')](_0x35ab4c[_0x4085('0x40')][_0x4085('0x19')])?_0x35ab4c[_0x4085('0x40')][_0x4085('0x19')]:!_[_0x4085('0x1c')](_0x35ab4c[_0x4085('0x41')])?_0x35ab4c[_0x4085('0x41')]+'\x20'+_0x35ab4c[_0x4085('0x42')]:_0x35ab4c[_0x4085('0x42')],'id':_0x35ab4c['id']}}]},'headers':{'Authorization':_0x4085('0x30')+_0xd664e1},'json':!![]})[_0x4085('0x27')](function(_0x12236f){if(_0x12236f&&_0x12236f[_0x4085('0x43')][0x0][_0x4085('0x44')]===_0x4085('0x45')){var _0x1e31d5=_0x12236f[_0x4085('0x43')][0x0][_0x4085('0x46')];_0x1e31d5['enduserType']=_[_0x4085('0x47')](_0x196693['moduleCreate'])+'s';return _0x1e31d5;}logger[_0x4085('0x39')](_0x4085('0x3a'),JSON['stringify'](data));throw new Error(_0x4085('0x48')+JSON['stringify'](data));})[_0x4085('0x2a')](function(_0xd09559){console[_0x4085('0x49')](_0x4085('0x4a'),_0xd09559);});}function getEndUser(_0x51d353,_0x17388b,_0x2fc17d,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5){var _0x47abdd={'method':_0x4085('0x2e'),'uri':'','headers':{'Authorization':_0x4085('0x30')+_0x51d353},'json':!![]};switch(_0x3e90d5['moduleSearch']){case _0x4085('0x4b'):_0x47abdd[_0x4085('0x4c')]=_0x4085('0x3d')+_0x17388b+_0x4085('0x4d')+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4e'))[_0x4085('0x27')](function(_0x50c46c){if(_0x50c46c)return _0x50c46c;_0x47abdd[_0x4085('0x4c')]=_0x4085('0x3d')+_0x17388b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4f'))[_0x4085('0x27')](function(_0x3fd28d){if(_0x3fd28d)return _0x3fd28d;if(_0x3e90d5[_0x4085('0x3f')]!='nothing'){return createEndUser(_0x51d353,_0x17388b,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5);}else{return{};}});});break;case'contact':_0x47abdd[_0x4085('0x4c')]=_0x4085('0x3d')+_0x17388b+_0x4085('0x4d')+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4e'))[_0x4085('0x27')](function(_0x49fb03){if(_0x49fb03)return _0x49fb03;if(_0x3e90d5[_0x4085('0x3f')]!=_0x4085('0x50')){return createEndUser(_0x51d353,_0x17388b,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5);}else{return{};}});break;case _0x4085('0x51'):_0x47abdd[_0x4085('0x4c')]='https://www.zohoapis.'+_0x17388b+_0x4085('0x52')+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4f'))['then'](function(_0x4c886a){if(_0x4c886a)return _0x4c886a;if(_0x3e90d5[_0x4085('0x3f')]!=_0x4085('0x50')){return createEndUser(_0x51d353,_0x17388b,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5);}else{return{};}});break;}}function getCall(_0x16c931,_0x4cc137,_0xf1cb49,_0x4d67f3,_0x232e92,_0x429da5,_0x27502f,_0x5d588c){logger['info'](_0x4085('0x53'));var _0x2b3fb9={};_0x2b3fb9[_0x4085('0x54')]={'name':!_['isNil'](_0x4d67f3['role'][_0x4085('0x19')])&&!_['isNil'](_0x4d67f3['profile']['name'])&&_0x4d67f3[_0x4085('0x55')]['name']===_0x4085('0x56')?_0x4d67f3[_0x4085('0x40')]['name']:!_[_0x4085('0x1c')](_0x4d67f3['first_name'])?_0x4d67f3[_0x4085('0x41')]+'\x20'+_0x4d67f3[_0x4085('0x42')]:_0x4d67f3['last_name'],'id':_0x4d67f3['id']};_0x2b3fb9[_0x4085('0x57')]=intUtil[_0x4085('0x58')](_0x429da5[_0x4085('0x59')],_0x27502f,'\x20');_0x2b3fb9[_0x4085('0x5a')]=intUtil[_0x4085('0x58')](_0x429da5[_0x4085('0x5b')],_0x27502f,'\x0a');if(_0x232e92[_0x4085('0x3c')]===_0x4085('0x4e')){_0x2b3fb9['Who_Id']={'name':!_[_0x4085('0x1c')](_0x232e92[_0x4085('0x5c')])?_0x232e92[_0x4085('0x5c')]:!_[_0x4085('0x1c')](_0x232e92[_0x4085('0x5d')])?_0x232e92['First_Name']+'\x20'+_0x232e92[_0x4085('0x5e')]:_0x232e92[_0x4085('0x5e')],'id':_0x232e92['id']};}if(_0x232e92[_0x4085('0x3c')]===_0x4085('0x4f')){_0x2b3fb9[_0x4085('0x5f')]={'name':!_[_0x4085('0x1c')](_0x232e92[_0x4085('0x5c')])?_0x232e92[_0x4085('0x5c')]:!_['isNil'](_0x232e92[_0x4085('0x5d')])?_0x232e92[_0x4085('0x5d')]+'\x20'+_0x232e92[_0x4085('0x5e')]:_0x232e92[_0x4085('0x5e')],'id':_0x232e92['id']};_0x2b3fb9[_0x4085('0x60')]=_[_0x4085('0x47')](_0x232e92[_0x4085('0x3c')]);}if(_0x27502f['talktime']){_0x2b3fb9[_0x4085('0x61')]=moment['utc'](parseInt(_0x27502f[_0x4085('0x62')])*0x3e8)[_0x4085('0x2f')](_0x4085('0x63'));}else if(_0x27502f[_0x4085('0x64')]&&_0x27502f[_0x4085('0x65')]){_0x2b3fb9['Call_Duration']=moment[_0x4085('0x66')](moment(_0x27502f[_0x4085('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0x4085('0x67')](moment(_0x27502f[_0x4085('0x68')],_0x4085('0x69'))))['format'](_0x4085('0x63'));}switch(_0x27502f[_0x4085('0x6a')]){case _0x4085('0x6b'):_0x2b3fb9[_0x4085('0x6c')]=_0x4085('0x6d');break;case _0x4085('0x6e'):case _0x4085('0x6f'):_0x2b3fb9[_0x4085('0x6c')]='Answered';break;case _0x4085('0x70'):_0x2b3fb9['Call_Result']=_0x4085('0x71');break;case'abandoned':_0x2b3fb9[_0x4085('0x6c')]=_0x4085('0x72');break;case'timeout':_0x2b3fb9[_0x4085('0x6c')]=_0x4085('0x73');default:}_0x2b3fb9[_0x4085('0x74')]=(_0x5d588c===_0x4085('0x75')?moment(_0x27502f[_0x4085('0x68')])[_0x4085('0x2f')](_0x4085('0x69')):moment(_0x27502f[_0x4085('0x76')])[_0x4085('0x2f')](_0x4085('0x69')))||moment()[_0x4085('0x2f')](_0x4085('0x69'));_0x2b3fb9[_0x4085('0x77')]=_0x5d588c||_0x4085('0x78');_0x2b3fb9=_[_0x4085('0x79')](_0x2b3fb9,getCustomFields(_0x429da5[_0x4085('0x7a')],_0x27502f));return request({'method':_0x4085('0x24'),'uri':_0x4085('0x3d')+_0x4cc137+_0x4085('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x16c931},'body':{'data':[_0x2b3fb9]},'json':!![]})[_0x4085('0x27')](function(_0x315a24){if(_0x315a24&&_0x315a24[_0x4085('0x43')][0x0][_0x4085('0x44')]==='SUCCESS'){logger[_0x4085('0x2c')](_0x4085('0x7c'));return{'id':_0x315a24[_0x4085('0x43')][0x0][_0x4085('0x46')]['id']};}})[_0x4085('0x2a')](function(_0x3fdcd0){logger['info']('err',_0x3fdcd0[_0x4085('0x7d')]);console[_0x4085('0x49')]('err',_0x3fdcd0);});}exports[_0x4085('0x7e')]=function(_0x1298db,_0x210027,_0x53a2dc,_0x1844e2,_0x5dabb6,_0x563f1c){var _0x3fba63,_0xae1163,_0x4c36d9;_0x563f1c[_0x4085('0x7f')]=intUtil[_0x4085('0x80')](_0x563f1c['host']);_0x563f1c['serverUrl']=intUtil[_0x4085('0x80')](_0x563f1c[_0x4085('0x81')]);if(_0x5dabb6&&_0x5dabb6[_0x4085('0x82')]){logger[_0x4085('0x2c')](_0x4085('0x83'),_0x4085('0x84'));_0x210027[_0x4085('0x85')]=_0x563f1c['serverUrl']+'/api/voice/recordings/'+_0x210027[_0x4085('0x86')]+_0x4085('0x87')+md5(_0x210027[_0x4085('0x86')]);}else{_0x210027[_0x4085('0x85')]='';}var _0x2ce5e0=_0x563f1c[_0x4085('0x7f')]===_0x4085('0x88')?'eu':_0x4085('0x89');return getAccessToken(_0x563f1c)[_0x4085('0x27')](function(_0x456627){_0x4c36d9=_0x456627;return getUser(_0x4c36d9,_0x2ce5e0,_0x563f1c,_0x1844e2[_0x4085('0x34')]);})[_0x4085('0x27')](function(_0x124d4a){_0x3fba63=_0x124d4a;logger[_0x4085('0x2c')](_0x4085('0x8a'),_0x3fba63['id']);return getEndUser(_0x4c36d9,_0x2ce5e0,_0x563f1c,_0x210027[_0x4085('0x8b')],_0x210027[_0x4085('0x8c')],_0x3fba63,_0x53a2dc);})[_0x4085('0x27')](function(_0x2d091c){_0xae1163=_0x2d091c;return getCall(_0x4c36d9,_0x2ce5e0,_0x563f1c,_0x3fba63,_0xae1163,_0x53a2dc,_0x210027,'Inbound');})['then'](function(_0x46f323){if(_0x46f323){logger['info'](_0x4085('0x8d'),_0x46f323['id']);logger[_0x4085('0x2c')]('[QUEUE]',_0x4085('0x8e'));emit(util[_0x4085('0x2f')]('user:%s',_0x1844e2[_0x4085('0x19')]),_0x4085('0x8f'),{'uri':_0x4085('0x90')+_0x563f1c[_0x4085('0x7f')]+_0x4085('0x91')+_0x46f323['id']});}})[_0x4085('0x2a')](function(_0x40f6d4){logger['error']('[QUEUE]',JSON[_0x4085('0xf')](_0x40f6d4));});};exports['outbound']=function(_0x273454,_0x3f6a6f,_0x2ad6b0,_0x260716,_0x24c82b,_0x2df140,_0x15bbfb){var _0xc7c3d9,_0x34431d,_0x42889e;_0x2df140[_0x4085('0x7f')]=intUtil[_0x4085('0x80')](_0x2df140[_0x4085('0x7f')]);_0x2df140[_0x4085('0x81')]=intUtil[_0x4085('0x80')](_0x2df140[_0x4085('0x81')]);if(_0x15bbfb&&_0x15bbfb[_0x4085('0x92')]&&_0x15bbfb[_0x4085('0x92')]!=='none'){logger[_0x4085('0x2c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3f6a6f[_0x4085('0x85')]=_0x2df140[_0x4085('0x81')]+_0x4085('0x93')+_0x3f6a6f['uniqueid']+_0x4085('0x87')+md5(_0x3f6a6f[_0x4085('0x86')]);}var _0xb6757c=_0x2df140[_0x4085('0x7f')]===_0x4085('0x88')?'eu':_0x4085('0x89');return getAccessToken(_0x2df140)[_0x4085('0x27')](function(_0x585f36){_0x42889e=_0x585f36;return getUser(_0x42889e,_0xb6757c,_0x2df140,_0x260716[_0x4085('0x34')]);})['then'](function(_0x541765){_0xc7c3d9=_0x541765;logger[_0x4085('0x2c')](_0x4085('0x8a'),_0xc7c3d9['id']);return getEndUser(_0x42889e,_0xb6757c,_0x2df140,_0x3f6a6f['destcalleridname'],_0x3f6a6f[_0x4085('0x94')],_0xc7c3d9,_0x2ad6b0);})[_0x4085('0x27')](function(_0x54fc76){_0x34431d=_0x54fc76;return getCall(_0x42889e,_0xb6757c,_0x2df140,_0xc7c3d9,_0x34431d,_0x2ad6b0,_0x3f6a6f,_0x4085('0x95'));})['then'](function(_0x372269){if(_0x372269){logger[_0x4085('0x2c')](_0x4085('0x8d'),_0x372269['id']);logger['info']('[OUTBOUND]',_0x4085('0x8e'));emit(util[_0x4085('0x2f')](_0x4085('0x96'),_0x260716[_0x4085('0x19')]),_0x4085('0x8f'),{'uri':_0x4085('0x90')+_0x2df140[_0x4085('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x372269['id']});}})[_0x4085('0x2a')](function(_0x4d5845){logger[_0x4085('0x39')](_0x4085('0x97'),JSON[_0x4085('0xf')](_0x4d5845));});};exports['unmanaged']=function(_0x1d2872,_0x37719f,_0x2e17e1,_0x18e5b1,_0x35f708,_0x3591b1){var _0x23668d,_0x37be55,_0x1da339;_0x3591b1[_0x4085('0x7f')]=intUtil[_0x4085('0x80')](_0x3591b1[_0x4085('0x7f')]);_0x3591b1[_0x4085('0x81')]=intUtil[_0x4085('0x80')](_0x3591b1['serverUrl']);if(_0x35f708&&_0x35f708[_0x4085('0x82')]){logger[_0x4085('0x2c')]('['+_0x37719f[_0x4085('0x6a')][_0x4085('0x98')]()+']','Recording\x20is\x20enabled!');_0x37719f[_0x4085('0x85')]=_0x3591b1['serverUrl']+_0x4085('0x93')+_0x37719f[_0x4085('0x86')]+_0x4085('0x87')+md5(_0x37719f[_0x4085('0x86')]);}else{_0x37719f[_0x4085('0x85')]='';}var _0x37a4c0=_0x3591b1[_0x4085('0x7f')]===_0x4085('0x88')?'eu':_0x4085('0x89');return getAccessToken(_0x3591b1)[_0x4085('0x27')](function(_0x42b323){_0x1da339=_0x42b323;return getUser(_0x1da339,_0x37a4c0,_0x3591b1);})[_0x4085('0x27')](function(_0x5cebb0){_0x23668d=_0x5cebb0;logger[_0x4085('0x2c')]('The\x20User\x20ID\x20is:',_0x23668d['id']);return getEndUser(_0x1da339,_0x37a4c0,_0x3591b1,_0x37719f[_0x4085('0x8b')],_0x37719f[_0x4085('0x8c')],_0x23668d,_0x2e17e1);})[_0x4085('0x27')](function(_0x256739){_0x37be55=_0x256739;return getCall(_0x1da339,_0x37a4c0,_0x3591b1,_0x23668d,_0x37be55,_0x2e17e1,_0x37719f,_0x4085('0x78'));})[_0x4085('0x27')](function(_0x385f51){if(_0x385f51){logger[_0x4085('0x2c')]('The\x20Call\x20ID\x20is:',_0x385f51['id']);}})[_0x4085('0x2a')](function(_0x31c56c){logger['error']('['+_0x37719f[_0x4085('0x6a')][_0x4085('0x98')]()+']',JSON['stringify'](_0x31c56c));});}; \ No newline at end of file +var _0xb199=['last_name','data','code','SUCCESS','moduleCreate','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','starttime','Inbound','Fields','/crm/v2/Calls','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','destcalleridnum','user:%s','https://crm.','unmanaged','toUpperCase','/downloads?type=uniqueid&token=','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','forEach','string','idField','toString','variable','variableName','type','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','startCase','role','first_name'];(function(_0x5ad74d,_0xc5b4db){var _0x5b0b4f=function(_0x396ef9){while(--_0x396ef9){_0x5ad74d['push'](_0x5ad74d['shift']());}};_0x5b0b4f(++_0xc5b4db);}(_0xb199,0xdc));var _0x9b19=function(_0x212faf,_0x28bd40){_0x212faf=_0x212faf-0x0;var _0x5844a7=_0xb199[_0x212faf];return _0x5844a7;};'use strict';var _=require('lodash');var rp=require(_0x9b19('0x0'));var md5=require(_0x9b19('0x1'));var util=require(_0x9b19('0x2'));var intUtil=require(_0x9b19('0x3'));var moment=require('moment');var Redis=require(_0x9b19('0x4'));var BPromise=require(_0x9b19('0x5'));var config=require(_0x9b19('0x6'));var logger=require(_0x9b19('0x7'))(_0x9b19('0x8'));config[_0x9b19('0x9')]=_[_0x9b19('0xa')](config['redis'],{'host':_0x9b19('0xb'),'port':0x18eb});var io=require(_0x9b19('0xc'))(new Redis(config[_0x9b19('0x9')]));function emit(_0x2c0186,_0x39a0eb,_0x36e712){io['to'](_0x2c0186)[_0x9b19('0xd')](_0x39a0eb,_0x36e712);}function request(_0x4e26d7){logger['debug']('[HTTP]',JSON[_0x9b19('0xe')](_0x4e26d7));return rp(_0x4e26d7);}function getCustomFields(_0x55406a,_0x52a916){var _0xb65165={};if(_0x55406a[_0x9b19('0xf')]>0x0){_[_0x9b19('0x10')](_0x55406a,function(_0x1adfbc){if(_0x1adfbc['type']===_0x9b19('0x11')&&_0x1adfbc[_0x9b19('0x12')]){_0xb65165[_0x1adfbc['idField']]=_0x1adfbc['content'][_0x9b19('0x13')]();}else if(_0x1adfbc['type']===_0x9b19('0x14')&&_0x1adfbc[_0x9b19('0x15')]&&_0x1adfbc[_0x9b19('0x12')]&&_0x52a916[_0x1adfbc[_0x9b19('0x15')]]){_0xb65165[_0x1adfbc[_0x9b19('0x12')]]=_0x52a916[_0x1adfbc['variableName']]['toString']();}else if(_0x1adfbc[_0x9b19('0x16')]===_0x9b19('0x17')&&_0x1adfbc['Variable']&&_0x1adfbc['Variable'][_0x9b19('0x18')]&&_0x1adfbc['idField']&&_0x52a916[_0x1adfbc[_0x9b19('0x19')]['name'][_0x9b19('0x1a')]()]){_0xb65165[_0x1adfbc[_0x9b19('0x12')]]=_0x52a916[_0x1adfbc[_0x9b19('0x19')][_0x9b19('0x18')][_0x9b19('0x1a')]()][_0x9b19('0x13')]();}});}return _0xb65165;}function getName(_0x438153){if(_0x438153[_0x9b19('0x1b')]('\x20')>0x0){var _0x1898d8=_0x438153[_0x9b19('0x1c')](/ (.+)/);if(_0x1898d8[0x1]){return _0x1898d8;}}return[_0x438153,_0x438153];}var accountsTokens={};function getAccessToken(_0x7c1723){return new Promise(function(_0xa973aa,_0x1ec994){if(!_[_0x9b19('0x1d')](accountsTokens[_0x7c1723['id']])&&!_[_0x9b19('0x1d')](accountsTokens[_0x7c1723['id']][_0x9b19('0x1e')])){if(moment()[_0x9b19('0x1f')](accountsTokens[_0x7c1723['id']][_0x9b19('0x20')])){_0xa973aa(accountsTokens[_0x7c1723['id']][_0x9b19('0x1e')]);}}var _0x973a75;switch(_0x7c1723[_0x9b19('0x21')]){case'US':_0x973a75=_0x9b19('0x22');break;case'AU':_0x973a75='https://accounts.zoho.com.au';break;case'EU':_0x973a75='https://accounts.zoho.eu';break;case'IN':_0x973a75='https://accounts.zoho.in';break;case'CN':_0x973a75=_0x9b19('0x23');break;default:_0x973a75='https://accounts.zoho.eu';break;}var _0x4eab6a={'method':'POST','uri':_0x973a75+_0x9b19('0x24'),'qs':{'refresh_token':_0x7c1723['refreshToken'],'client_id':_0x7c1723[_0x9b19('0x25')],'client_secret':_0x7c1723[_0x9b19('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4eab6a)[_0x9b19('0x27')](function(_0x1dd724){accountsTokens[_0x7c1723['id']]={'access_token':_0x1dd724[_0x9b19('0x1e')],'expires_in':moment()[_0x9b19('0x28')](_0x1dd724[_0x9b19('0x20')],_0x9b19('0x29'))};_0xa973aa(_0x1dd724[_0x9b19('0x1e')]);})[_0x9b19('0x2a')](function(_0x5e3298){logger[_0x9b19('0x2b')]('Failing\x20creating\x20the\x20access_token',_0x5e3298[_0x9b19('0x2c')]);_0x1ec994(_0x5e3298);});});}function getUser(_0x4c2a62,_0x1dca03,_0x346375,_0x385bd6){logger[_0x9b19('0x2d')](_0x9b19('0x2e'));return request({'method':_0x9b19('0x2f'),'uri':util[_0x9b19('0x30')](_0x9b19('0x31'),_0x1dca03),'qs':{'type':_0x9b19('0x32')},'headers':{'Authorization':_0x9b19('0x33')+_0x4c2a62},'json':!![]})['then'](function(_0x582179){if(_0x582179['users']){var _0x1f3bb0=-0x1;if(_[_0x9b19('0x34')](_0x582179['users'])){if(!_['isNil'](_0x385bd6)){_0x1f3bb0=_['findIndex'](_0x582179[_0x9b19('0x35')],function(_0x25236b){return _0x25236b[_0x9b19('0x36')]===_0x385bd6;});}if(_0x1f3bb0>=0x0){logger[_0x9b19('0x2d')](_0x9b19('0x37'));}else{logger[_0x9b19('0x2d')](_0x9b19('0x38'));_0x1f3bb0=_['findIndex'](_0x582179[_0x9b19('0x35')],function(_0x57ab64){return _0x57ab64[_0x9b19('0x39')]['name']===_0x9b19('0x3a');});}return _0x582179['users'][_0x1f3bb0];}else{if(_0x582179[_0x9b19('0x3b')][_0x9b19('0x39')]['name']===_0x9b19('0x3a')){logger[_0x9b19('0x2d')](_0x9b19('0x38'));user=_0x582179[_0x9b19('0x3b')];return user;}else{logger['error'](_0x9b19('0x3c'),JSON[_0x9b19('0xe')](_0x582179));throw new Error(_0x9b19('0x3d')+JSON['stringify'](_0x582179));}}}else{logger[_0x9b19('0x2b')](_0x9b19('0x3c'),JSON[_0x9b19('0xe')](_0x582179));throw new Error(_0x9b19('0x3d')+JSON[_0x9b19('0xe')](_0x582179));}})['catch'](function(_0x4b3708){console[_0x9b19('0x2b')](_0x4b3708);});}function getZohoUser(_0x4beafb,_0x26da61){return new BPromise(function(_0x369590,_0x4b7fcb){request(_0x4beafb)[_0x9b19('0x27')](function(_0x1e08eb){var _0x272b0b=null;if(_0x1e08eb){_0x272b0b=_0x1e08eb['data'][0x0];_0x272b0b[_0x9b19('0x3e')]=_0x26da61;}_0x369590(_0x272b0b);})['catch'](function(_0x3d278d){_0x4b7fcb(_0x3d278d);});});}function createEndUser(_0x4c3a13,_0x424b41,_0x2a1b95,_0x69dda7,_0x2ef7ad,_0x2c78d8){var _0x2a1b95=getName(_0x2a1b95);return request({'method':_0x9b19('0x3f'),'uri':_0x9b19('0x40')+_0x424b41+'/crm/v2/'+_[_0x9b19('0x41')](_0x2c78d8['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x2a1b95[0x1],'First_Name':_0x2a1b95[0x0],'Phone':_0x69dda7,'Owner':{'name':!_[_0x9b19('0x1d')](_0x2ef7ad['role']['name'])?_0x2ef7ad[_0x9b19('0x42')][_0x9b19('0x18')]:!_[_0x9b19('0x1d')](_0x2ef7ad[_0x9b19('0x43')])?_0x2ef7ad['first_name']+'\x20'+_0x2ef7ad[_0x9b19('0x44')]:_0x2ef7ad[_0x9b19('0x44')],'id':_0x2ef7ad['id']}}]},'headers':{'Authorization':_0x9b19('0x33')+_0x4c3a13},'json':!![]})[_0x9b19('0x27')](function(_0x800159){if(_0x800159&&_0x800159[_0x9b19('0x45')][0x0][_0x9b19('0x46')]===_0x9b19('0x47')){var _0x4331f8=_0x800159[_0x9b19('0x45')][0x0]['details'];_0x4331f8['enduserType']=_[_0x9b19('0x41')](_0x2c78d8[_0x9b19('0x48')])+'s';return _0x4331f8;}logger['error'](_0x9b19('0x3c'),JSON[_0x9b19('0xe')](data));throw new Error(_0x9b19('0x49')+JSON[_0x9b19('0xe')](data));})[_0x9b19('0x2a')](function(_0x14fd25){console[_0x9b19('0x4a')]('CREATE\x20ERROR',_0x14fd25);});}function getEndUser(_0x3e2a19,_0x3e5635,_0x14f374,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6){var _0x5e5357={'method':_0x9b19('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3e2a19},'json':!![]};switch(_0x5a46c6[_0x9b19('0x4b')]){case'contact_lead':_0x5e5357[_0x9b19('0x4c')]='https://www.zohoapis.'+_0x3e5635+_0x9b19('0x4d')+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4e'))[_0x9b19('0x27')](function(_0x591f4f){if(_0x591f4f)return _0x591f4f;_0x5e5357[_0x9b19('0x4c')]=_0x9b19('0x40')+_0x3e5635+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4f'))[_0x9b19('0x27')](function(_0x6497bf){if(_0x6497bf)return _0x6497bf;if(_0x5a46c6[_0x9b19('0x48')]!=_0x9b19('0x50')){return createEndUser(_0x3e2a19,_0x3e5635,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6);}else{return{};}});});break;case'contact':_0x5e5357['uri']=_0x9b19('0x40')+_0x3e5635+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4e'))['then'](function(_0x4f9220){if(_0x4f9220)return _0x4f9220;if(_0x5a46c6[_0x9b19('0x48')]!=_0x9b19('0x50')){return createEndUser(_0x3e2a19,_0x3e5635,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6);}else{return{};}});break;case'lead':_0x5e5357[_0x9b19('0x4c')]=_0x9b19('0x40')+_0x3e5635+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2e70d6+'))';return getZohoUser(_0x5e5357,_0x9b19('0x4f'))['then'](function(_0x129345){if(_0x129345)return _0x129345;if(_0x5a46c6[_0x9b19('0x48')]!=_0x9b19('0x50')){return createEndUser(_0x3e2a19,_0x3e5635,_0x393a9f,_0x2e70d6,_0x557f18,_0x5a46c6);}else{return{};}});break;}}function getCall(_0x4aaf35,_0x3def1c,_0x6fe833,_0x5926e8,_0x1c5b1e,_0x538dfc,_0x4bf668,_0xee3f15){logger[_0x9b19('0x2d')]('Creating\x20new\x20call...');var _0x4a8617={};_0x4a8617[_0x9b19('0x51')]={'name':!_['isNil'](_0x5926e8[_0x9b19('0x42')][_0x9b19('0x18')])&&!_['isNil'](_0x5926e8[_0x9b19('0x39')][_0x9b19('0x18')])&&_0x5926e8['profile'][_0x9b19('0x18')]===_0x9b19('0x52')?_0x5926e8['role'][_0x9b19('0x18')]:!_[_0x9b19('0x1d')](_0x5926e8[_0x9b19('0x43')])?_0x5926e8[_0x9b19('0x43')]+'\x20'+_0x5926e8[_0x9b19('0x44')]:_0x5926e8[_0x9b19('0x44')],'id':_0x5926e8['id']};_0x4a8617[_0x9b19('0x53')]=intUtil[_0x9b19('0x54')](_0x538dfc[_0x9b19('0x55')],_0x4bf668,'\x20');_0x4a8617[_0x9b19('0x56')]=intUtil['getString'](_0x538dfc['Descriptions'],_0x4bf668,'\x0a');if(_0x1c5b1e[_0x9b19('0x3e')]===_0x9b19('0x4e')){_0x4a8617[_0x9b19('0x57')]={'name':!_['isNil'](_0x1c5b1e[_0x9b19('0x58')])?_0x1c5b1e[_0x9b19('0x58')]:!_[_0x9b19('0x1d')](_0x1c5b1e[_0x9b19('0x59')])?_0x1c5b1e[_0x9b19('0x59')]+'\x20'+_0x1c5b1e['Last_Name']:_0x1c5b1e[_0x9b19('0x5a')],'id':_0x1c5b1e['id']};}if(_0x1c5b1e[_0x9b19('0x3e')]===_0x9b19('0x4f')){_0x4a8617[_0x9b19('0x5b')]={'name':!_[_0x9b19('0x1d')](_0x1c5b1e[_0x9b19('0x58')])?_0x1c5b1e['Full_Name']:!_['isNil'](_0x1c5b1e[_0x9b19('0x59')])?_0x1c5b1e[_0x9b19('0x59')]+'\x20'+_0x1c5b1e[_0x9b19('0x5a')]:_0x1c5b1e['Last_Name'],'id':_0x1c5b1e['id']};_0x4a8617[_0x9b19('0x5c')]=_[_0x9b19('0x41')](_0x1c5b1e[_0x9b19('0x3e')]);}if(_0x4bf668[_0x9b19('0x5d')]){_0x4a8617[_0x9b19('0x5e')]=moment['utc'](parseInt(_0x4bf668[_0x9b19('0x5d')])*0x3e8)[_0x9b19('0x30')]('mm:ss');}else if(_0x4bf668[_0x9b19('0x5f')]&&_0x4bf668['endtime']){_0x4a8617[_0x9b19('0x5e')]=moment[_0x9b19('0x60')](moment(_0x4bf668[_0x9b19('0x61')],_0x9b19('0x62'))[_0x9b19('0x63')](moment(_0x4bf668['starttime'],_0x9b19('0x62'))))['format']('mm:ss');}switch(_0x4bf668[_0x9b19('0x64')]){case'called':_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x66');break;case _0x9b19('0x67'):case _0x9b19('0x68'):_0x4a8617[_0x9b19('0x65')]='Answered';break;case _0x9b19('0x69'):_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x6a');break;case _0x9b19('0x6b'):_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x6c');break;case'timeout':_0x4a8617[_0x9b19('0x65')]=_0x9b19('0x6d');default:}_0x4a8617['Call_Start_Time']=(_0xee3f15===_0x9b19('0x6e')?moment(_0x4bf668[_0x9b19('0x6f')])[_0x9b19('0x30')](_0x9b19('0x62')):moment(_0x4bf668['agentcalledAt'])['format'](_0x9b19('0x62')))||moment()['format'](_0x9b19('0x62'));_0x4a8617['Call_Type']=_0xee3f15||_0x9b19('0x70');_0x4a8617=_['merge'](_0x4a8617,getCustomFields(_0x538dfc[_0x9b19('0x71')],_0x4bf668));return request({'method':_0x9b19('0x3f'),'uri':'https://www.zohoapis.'+_0x3def1c+_0x9b19('0x72'),'headers':{'Authorization':_0x9b19('0x33')+_0x4aaf35},'body':{'data':[_0x4a8617]},'json':!![]})['then'](function(_0x48e2eb){if(_0x48e2eb&&_0x48e2eb['data'][0x0]['code']===_0x9b19('0x47')){logger[_0x9b19('0x2d')]('Call\x20created!');return{'id':_0x48e2eb[_0x9b19('0x45')][0x0][_0x9b19('0x73')]['id']};}})['catch'](function(_0x2368eb){logger[_0x9b19('0x2d')](_0x9b19('0x74'),_0x2368eb[_0x9b19('0x2c')]);console['log'](_0x9b19('0x74'),_0x2368eb);});}exports[_0x9b19('0x75')]=function(_0x7624c6,_0x46600c,_0x43a4fb,_0x36f1d6,_0x4d7667,_0x441acf){var _0xb697d2,_0x4fb840,_0x34dbd2;_0x441acf[_0x9b19('0x76')]=intUtil['stripTrailingSlash'](_0x441acf['host']);_0x441acf[_0x9b19('0x77')]=intUtil[_0x9b19('0x78')](_0x441acf['serverUrl']);if(_0x4d7667&&_0x4d7667[_0x9b19('0x79')]){logger[_0x9b19('0x2d')](_0x9b19('0x7a'),_0x9b19('0x7b'));_0x46600c[_0x9b19('0x7c')]=_0x441acf['serverUrl']+_0x9b19('0x7d')+_0x46600c[_0x9b19('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x46600c[_0x9b19('0x7e')]);}else{_0x46600c[_0x9b19('0x7c')]='';}var _0x51e4b3=_0x441acf[_0x9b19('0x76')]===_0x9b19('0x7f')?'eu':_0x9b19('0x80');return getAccessToken(_0x441acf)[_0x9b19('0x27')](function(_0x544c20){_0x34dbd2=_0x544c20;return getUser(_0x34dbd2,_0x51e4b3,_0x441acf,_0x36f1d6[_0x9b19('0x36')]);})['then'](function(_0x5c0b20){_0xb697d2=_0x5c0b20;logger[_0x9b19('0x2d')](_0x9b19('0x81'),_0xb697d2['id']);return getEndUser(_0x34dbd2,_0x51e4b3,_0x441acf,_0x46600c[_0x9b19('0x82')],_0x46600c[_0x9b19('0x83')],_0xb697d2,_0x43a4fb);})[_0x9b19('0x27')](function(_0x36cac1){_0x4fb840=_0x36cac1;return getCall(_0x34dbd2,_0x51e4b3,_0x441acf,_0xb697d2,_0x4fb840,_0x43a4fb,_0x46600c,_0x9b19('0x70'));})[_0x9b19('0x27')](function(_0x573ceb){if(_0x573ceb){logger[_0x9b19('0x2d')](_0x9b19('0x84'),_0x573ceb['id']);logger[_0x9b19('0x2d')](_0x9b19('0x7a'),_0x9b19('0x85'));emit(util[_0x9b19('0x30')]('user:%s',_0x36f1d6[_0x9b19('0x18')]),_0x9b19('0x86'),{'uri':'https://crm.'+_0x441acf['host']+_0x9b19('0x87')+_0x573ceb['id']});}})[_0x9b19('0x2a')](function(_0x3290e2){logger[_0x9b19('0x2b')](_0x9b19('0x7a'),JSON[_0x9b19('0xe')](_0x3290e2));});};exports[_0x9b19('0x6e')]=function(_0x454523,_0x160b6d,_0x33bf81,_0xed4dcd,_0x2c9d20,_0x16f078,_0x2e9444){var _0x4bbe00,_0x15df64,_0x2483d4;_0x16f078[_0x9b19('0x76')]=intUtil['stripTrailingSlash'](_0x16f078[_0x9b19('0x76')]);_0x16f078[_0x9b19('0x77')]=intUtil[_0x9b19('0x78')](_0x16f078['serverUrl']);if(_0x2e9444&&_0x2e9444['recordingFormat']&&_0x2e9444['recordingFormat']!==_0x9b19('0x88')){logger[_0x9b19('0x2d')](_0x9b19('0x89'),'Recording\x20is\x20enabled!');_0x160b6d['recordingURL']=_0x16f078[_0x9b19('0x77')]+_0x9b19('0x7d')+_0x160b6d[_0x9b19('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x160b6d[_0x9b19('0x7e')]);}var _0x26e611=_0x16f078[_0x9b19('0x76')]===_0x9b19('0x7f')?'eu':_0x9b19('0x80');return getAccessToken(_0x16f078)[_0x9b19('0x27')](function(_0x416e7c){_0x2483d4=_0x416e7c;return getUser(_0x2483d4,_0x26e611,_0x16f078,_0xed4dcd[_0x9b19('0x36')]);})[_0x9b19('0x27')](function(_0x4e3dcb){_0x4bbe00=_0x4e3dcb;logger[_0x9b19('0x2d')]('The\x20User\x20ID\x20is:',_0x4bbe00['id']);return getEndUser(_0x2483d4,_0x26e611,_0x16f078,_0x160b6d['destcalleridname'],_0x160b6d[_0x9b19('0x8a')],_0x4bbe00,_0x33bf81);})[_0x9b19('0x27')](function(_0x298a63){_0x15df64=_0x298a63;return getCall(_0x2483d4,_0x26e611,_0x16f078,_0x4bbe00,_0x15df64,_0x33bf81,_0x160b6d,'Outbound');})['then'](function(_0x828a31){if(_0x828a31){logger[_0x9b19('0x2d')]('The\x20Call\x20ID\x20is:',_0x828a31['id']);logger['info']('[OUTBOUND]',_0x9b19('0x85'));emit(util[_0x9b19('0x30')](_0x9b19('0x8b'),_0xed4dcd[_0x9b19('0x18')]),_0x9b19('0x86'),{'uri':_0x9b19('0x8c')+_0x16f078[_0x9b19('0x76')]+_0x9b19('0x87')+_0x828a31['id']});}})[_0x9b19('0x2a')](function(_0xba2f0e){logger[_0x9b19('0x2b')](_0x9b19('0x89'),JSON[_0x9b19('0xe')](_0xba2f0e));});};exports[_0x9b19('0x8d')]=function(_0x99a8b7,_0x3d6656,_0x4057d5,_0x3e6e6c,_0x5dabc2,_0x152419){var _0x2e4fab,_0x413cbe,_0x8fe088;_0x152419[_0x9b19('0x76')]=intUtil[_0x9b19('0x78')](_0x152419[_0x9b19('0x76')]);_0x152419[_0x9b19('0x77')]=intUtil['stripTrailingSlash'](_0x152419[_0x9b19('0x77')]);if(_0x5dabc2&&_0x5dabc2['monitor_format']){logger[_0x9b19('0x2d')]('['+_0x3d6656[_0x9b19('0x64')][_0x9b19('0x8e')]()+']',_0x9b19('0x7b'));_0x3d6656[_0x9b19('0x7c')]=_0x152419[_0x9b19('0x77')]+_0x9b19('0x7d')+_0x3d6656[_0x9b19('0x7e')]+_0x9b19('0x8f')+md5(_0x3d6656[_0x9b19('0x7e')]);}else{_0x3d6656[_0x9b19('0x7c')]='';}var _0x2eb9d8=_0x152419['host']===_0x9b19('0x7f')?'eu':_0x9b19('0x80');return getAccessToken(_0x152419)['then'](function(_0x3400f5){_0x8fe088=_0x3400f5;return getUser(_0x8fe088,_0x2eb9d8,_0x152419);})[_0x9b19('0x27')](function(_0x12e285){_0x2e4fab=_0x12e285;logger[_0x9b19('0x2d')](_0x9b19('0x81'),_0x2e4fab['id']);return getEndUser(_0x8fe088,_0x2eb9d8,_0x152419,_0x3d6656[_0x9b19('0x82')],_0x3d6656['calleridnum'],_0x2e4fab,_0x4057d5);})[_0x9b19('0x27')](function(_0x438df0){_0x413cbe=_0x438df0;return getCall(_0x8fe088,_0x2eb9d8,_0x152419,_0x2e4fab,_0x413cbe,_0x4057d5,_0x3d6656,_0x9b19('0x70'));})['then'](function(_0x3f716f){if(_0x3f716f){logger[_0x9b19('0x2d')](_0x9b19('0x84'),_0x3f716f['id']);}})[_0x9b19('0x2a')](function(_0x2ce9ee){logger[_0x9b19('0x2b')]('['+_0x3d6656[_0x9b19('0x64')][_0x9b19('0x8e')]()+']',JSON[_0x9b19('0xe')](_0x2ce9ee));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 62440ae..71e964e 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(_0x19d69c,_0x3a2fc7){var _0x43678f=function(_0x53eed2){while(--_0x53eed2){_0x19d69c['push'](_0x19d69c['shift']());}};_0x43678f(++_0x3a2fc7);}(_0x7a54,0x106));var _0x47a5=function(_0x16fbf6,_0x382861){_0x16fbf6=_0x16fbf6-0x0;var _0x1705e6=_0x7a54[_0x16fbf6];return _0x1705e6;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x4867e9,_0x2afddc){var _0x35f715=function(_0x57650c){while(--_0x57650c){_0x4867e9['push'](_0x4867e9['shift']());}};_0x35f715(++_0x2afddc);}(_0x7a54,0x106));var _0x47a5=function(_0x2ef8c9,_0x3f6d7c){_0x2ef8c9=_0x2ef8c9-0x0;var _0x1aaa45=_0x7a54[_0x2ef8c9];return _0x1aaa45;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 50173ac..94fa77c 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x36bde9,_0x5c46fa){var _0x1532ce=function(_0x75b516){while(--_0x75b516){_0x36bde9['push'](_0x36bde9['shift']());}};_0x1532ce(++_0x5c46fa);}(_0xb10b,0x12a));var _0xbb10=function(_0xfec81c,_0x3f7f63){_0xfec81c=_0xfec81c-0x0;var _0x5d21f6=_0xb10b[_0xfec81c];return _0x5d21f6;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x5650f2,_0xef79fe){var _0x28049d=function(_0x5070e6){while(--_0x5070e6){_0x5650f2['push'](_0x5650f2['shift']());}};_0x28049d(++_0xef79fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48bc79,_0xe4b766){_0x48bc79=_0x48bc79-0x0;var _0x2f2bf2=_0x5f2f[_0x48bc79];return _0x2f2bf2;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index cc8508b..f44097a 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 _0x7c49=['Request','request','then','debug','rpc','routing','error','message','exports','jayson/promise','bluebird','client'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x7c49,0x141));var _0x97c4=function(_0xca970f,_0x4f794e){_0xca970f=_0xca970f-0x0;var _0x1a6e3d=_0x7c49[_0xca970f];return _0x1a6e3d;};'use strict';var jayson=require(_0x97c4('0x0'));var BPromise=require(_0x97c4('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x97c4('0x2')]['http']({'port':0x2329});client[_0x97c4('0x3')]=function(_0x128c74,_0x5e3808){return new BPromise(function(_0x596686,_0x294b13){return client[_0x97c4('0x4')](_0x128c74,_0x5e3808)[_0x97c4('0x5')](function(_0x538c14){logger[_0x97c4('0x6')](_0x97c4('0x7'),_0x97c4('0x8'),_0x128c74,_0x5e3808,_0x538c14);if(_0x538c14[_0x97c4('0x9')]){logger[_0x97c4('0x9')](_0x97c4('0x7'),_0x97c4('0x8'),_0x128c74,_0x538c14[_0x97c4('0x9')][_0x97c4('0xa')],_0x5e3808);return _0x294b13(_0x538c14[_0x97c4('0x9')][_0x97c4('0xa')]);}else{return _0x596686(_0x538c14['result']);}})['catch'](function(_0x1b615a){logger[_0x97c4('0x9')]('rpc',_0x97c4('0x8'),_0x128c74,_0x1b615a,_0x5e3808);return _0x294b13(_0x1b615a);});});};module[_0x97c4('0xb')]=client; \ No newline at end of file +var _0xde64=['client','http','request','then','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x47a261,_0x6d2b0b){var _0x2254ec=function(_0x5ed2da){while(--_0x5ed2da){_0x47a261['push'](_0x47a261['shift']());}};_0x2254ec(++_0x6d2b0b);}(_0xde64,0x17c));var _0x4de6=function(_0x1dc9a4,_0x3beafe){_0x1dc9a4=_0x1dc9a4-0x0;var _0x4977db=_0xde64[_0x1dc9a4];return _0x4977db;};'use strict';var jayson=require(_0x4de6('0x0'));var BPromise=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var client=jayson[_0x4de6('0x4')][_0x4de6('0x5')]({'port':0x2329});client['Request']=function(_0x3c4b91,_0x3bd290){return new BPromise(function(_0x5a5c5a,_0x529726){return client[_0x4de6('0x6')](_0x3c4b91,_0x3bd290)[_0x4de6('0x7')](function(_0x4da17f){logger['debug'](_0x4de6('0x8'),_0x4de6('0x3'),_0x3c4b91,_0x3bd290,_0x4da17f);if(_0x4da17f[_0x4de6('0x9')]){logger[_0x4de6('0x9')](_0x4de6('0x8'),_0x4de6('0x3'),_0x3c4b91,_0x4da17f['error'][_0x4de6('0xa')],_0x3bd290);return _0x529726(_0x4da17f[_0x4de6('0x9')][_0x4de6('0xa')]);}else{return _0x5a5c5a(_0x4da17f['result']);}})[_0x4de6('0xb')](function(_0x170183){logger[_0x4de6('0x9')](_0x4de6('0x8'),_0x4de6('0x3'),_0x3c4b91,_0x170183,_0x3bd290);return _0x529726(_0x170183);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ad39536..416fb07 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 _0xa63f=['./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email'];(function(_0x34f7f7,_0x198a82){var _0x3df0ea=function(_0x504168){while(--_0x504168){_0x34f7f7['push'](_0x34f7f7['shift']());}};_0x3df0ea(++_0x198a82);}(_0xa63f,0x1b6));var _0xfa63=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xa63f[_0x3b7a0c];return _0x3bb70f;};'use strict';var BPromise=require(_0xfa63('0x0'));var server=require(_0xfa63('0x1'));var Realtime=require(_0xfa63('0x2'));var EmailChannel=require(_0xfa63('0x3'));var mailAccount=require(_0xfa63('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xfa63('0x5'))['db'];function initRealtime(){return BPromise[_0xfa63('0x6')]()[_0xfa63('0x7')](mailAccount[_0xfa63('0x8')]())[_0xfa63('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0xfa63('0x9')](realtime[_0xfa63('0xa')]);return realtime;});}function main(){return server[_0xfa63('0xb')](realtime,email)[_0xfa63('0x7')](function(_0x486050){return initRealtime();})['then'](function(_0x575b64){return db[_0xfa63('0xc')][_0xfa63('0xd')]({'attributes':['id',_0xfa63('0xe')],'raw':!![]});})['then'](function(_0x181fec){return setInterval(initRealtime,_0x181fec['loginMailFrequency']*0x3e8);})[_0xfa63('0xf')](function(_0x4b1959){console[_0xfa63('0x10')](_0x4b1959);});}main(); \ No newline at end of file +var _0xc15b=['bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','getMailAccounts','then','initMailAccounts','listen','findOne','loginMailFrequency','log'];(function(_0x4d9ea1,_0x164c30){var _0x8a5bc4=function(_0x103064){while(--_0x103064){_0x4d9ea1['push'](_0x4d9ea1['shift']());}};_0x8a5bc4(++_0x164c30);}(_0xc15b,0xe4));var _0xbc15=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc15b[_0x209941];return _0x1e8729;};'use strict';var BPromise=require(_0xbc15('0x0'));var server=require('./server');var Realtime=require(_0xbc15('0x1'));var EmailChannel=require(_0xbc15('0x2'));var mailAccount=require(_0xbc15('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xbc15('0x4'))['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0xbc15('0x5')]())[_0xbc15('0x6')](realtime[_0xbc15('0x7')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xbc15('0x8')](realtime,email)[_0xbc15('0x6')](function(_0x3cb4b5){return initRealtime();})['then'](function(_0x5c6269){return db['Setting'][_0xbc15('0x9')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0xbc15('0x6')](function(_0x42f0b9){return setInterval(initRealtime,_0x42f0b9[_0xbc15('0xa')]*0x3e8);})['catch'](function(_0x413eda){console[_0xbc15('0xb')](_0x413eda);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c248e13..95bce01 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 _0x8d9b=['socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','handleImapEmail','end','bind','error','handleImapError','status','disabled','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','lodash','md5','ioredis','../../../config/environment','email','redis','defaults','localhost'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8d9b,0x11e));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xb8d9('0x1'));var Redis=require(_0xb8d9('0x2'));var config=require(_0xb8d9('0x3'));var logger=require('../../../config/logger')(_0xb8d9('0x4'));config[_0xb8d9('0x5')]=_[_0xb8d9('0x6')](config['redis'],{'host':_0xb8d9('0x7'),'port':0x18eb});var io=require(_0xb8d9('0x8'))(new Redis(config[_0xb8d9('0x5')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xb8d9('0x9'));var mailAccount=require(_0xb8d9('0xa'));var md5Accounts={};function EmailChannel(_0x138886){logger[_0xb8d9('0xb')]('start\x20email\x20channel');this[_0xb8d9('0xc')]=_0x138886[_0xb8d9('0xc')];this['imapAccounts']={};this[_0xb8d9('0xd')]=new EmailSmtp();}EmailChannel[_0xb8d9('0xe')][_0xb8d9('0xf')]=function(_0x33d583){var _0x13a2bf=this[_0xb8d9('0xc')][_0x33d583];var _0x49f54f={'id':_0x13a2bf['id'],'name':_0x13a2bf[_0xb8d9('0x10')],'key':_0x13a2bf[_0xb8d9('0x11')],'active':_0x13a2bf[_0xb8d9('0x12')],'Imap':{'status':_0x13a2bf['Imap']['status'],'messageStatus':_0x13a2bf[_0xb8d9('0x13')][_0xb8d9('0x14')],'total':_0x13a2bf[_0xb8d9('0x13')][_0xb8d9('0x15')]}};if(_[_0xb8d9('0x16')](md5Accounts[_0x33d583])){md5Accounts[_0x33d583]={};}var _0x4ca1ce=md5(JSON[_0xb8d9('0x17')](_0x49f54f));if(md5Accounts[_0x33d583][_0xb8d9('0x1')]!==_0x4ca1ce){md5Accounts[_0x33d583]['md5']=_0x4ca1ce;io[_0xb8d9('0xf')](_0xb8d9('0x18'),_0x49f54f);}};EmailChannel['prototype'][_0xb8d9('0x19')]=function(_0x267ff3){for(var _0x1c0c47 in _0x267ff3){if(_0x267ff3[_0xb8d9('0x1a')](_0x1c0c47)){if(_0x267ff3[_0x1c0c47][_0xb8d9('0x13')]&&_0x267ff3[_0x1c0c47][_0xb8d9('0x12')]){var _0xdeeb02=_0x267ff3[_0x1c0c47][_0xb8d9('0x13')];if(!this['imapAccounts'][_0xb8d9('0x1a')](_0xdeeb02['id'])){this[_0xb8d9('0x1b')][_0xdeeb02['id']]=new EmailImap(_0xdeeb02,_0x267ff3[_0x1c0c47][_0xb8d9('0x4')]);this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on']('box',this['handleImapBox']['bind'](this,_0x1c0c47));this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on'](_0xb8d9('0x4'),this[_0xb8d9('0x1c')]['bind'](this,_0x1c0c47));this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on'](_0xb8d9('0x1d'),this['handleImapEnd'][_0xb8d9('0x1e')](this,_0x1c0c47));this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on'](_0xb8d9('0x1f'),this[_0xb8d9('0x20')][_0xb8d9('0x1e')](this,_0x1c0c47));}}else{if(_[_0xb8d9('0x16')](this['mailAccounts'][_0x1c0c47][_0xb8d9('0x13')])){this['mailAccounts'][_0x1c0c47][_0xb8d9('0x13')]={};}this[_0xb8d9('0xc')][_0x1c0c47][_0xb8d9('0x13')][_0xb8d9('0x21')]=_0xb8d9('0x22');this[_0xb8d9('0xc')][_0x1c0c47][_0xb8d9('0x13')]['messageStatus']='';this['emit'](_0x1c0c47);}}}};EmailChannel[_0xb8d9('0xe')]['handleImapBox']=function(_0xd0783f,_0x4885fc){if(this[_0xb8d9('0xc')][_0xd0783f]){this[_0xb8d9('0xc')][_0xd0783f][_0xb8d9('0x13')][_0xb8d9('0x21')]=_0xb8d9('0x23');this['mailAccounts'][_0xd0783f][_0xb8d9('0x13')][_0xb8d9('0x14')]=_0x4885fc['name'];if(_0x4885fc['messages']){this[_0xb8d9('0xc')][_0xd0783f]['Imap'][_0xb8d9('0x15')]=_0x4885fc['messages']['total'];}return this[_0xb8d9('0xf')](_0xd0783f);}};EmailChannel[_0xb8d9('0xe')]['handleImapEmail']=function(_0x1d6355,_0x4bdddf){logger[_0xb8d9('0xb')](_0xb8d9('0x24'),_0x4bdddf['firstName'],_0x4bdddf[_0xb8d9('0x25')],_0x4bdddf[_0xb8d9('0x26')],_0x1d6355);if(this[_0xb8d9('0xc')][_0x1d6355]){return mailAccount[_0xb8d9('0x27')](_0x1d6355,_0x4bdddf)[_0xb8d9('0x28')](function(_0x5bcd38){if(_0x5bcd38){logger['info'](_0xb8d9('0x29'));}})['catch'](function(_0xb6ac3b){logger['error'](_0xb8d9('0x2a'),JSON['stringify'](_0xb6ac3b));});}};EmailChannel[_0xb8d9('0xe')]['handleImapEnd']=function(_0x571925){if(this['mailAccounts'][_0x571925]&&this['mailAccounts'][_0x571925][_0xb8d9('0x13')]){if(this[_0xb8d9('0x1b')][this[_0xb8d9('0xc')][_0x571925][_0xb8d9('0x13')]['id']]){delete this[_0xb8d9('0x1b')][this[_0xb8d9('0xc')][_0x571925][_0xb8d9('0x13')]['id']];}this[_0xb8d9('0xc')][_0x571925][_0xb8d9('0x13')][_0xb8d9('0x2b')]=moment();this[_0xb8d9('0xf')](_0x571925);}};EmailChannel[_0xb8d9('0xe')]['handleImapError']=function(_0x494b13,_0x3362e3){if(this[_0xb8d9('0xc')][_0x494b13]){this[_0xb8d9('0xc')][_0x494b13][_0xb8d9('0x13')][_0xb8d9('0x21')]=_0xb8d9('0x1f');this[_0xb8d9('0xc')][_0x494b13]['Imap']['messageStatus']=_0x3362e3;return this[_0xb8d9('0xf')](_0x494b13);}};EmailChannel[_0xb8d9('0xe')][_0xb8d9('0x2c')]=function(_0x1acbc0,_0x2f6a33){return this[_0xb8d9('0xd')][_0xb8d9('0x2d')](_0x1acbc0,_0x2f6a33);};EmailChannel[_0xb8d9('0xe')][_0xb8d9('0x2e')]=function(_0x4d4b7f){var _0x964578=this;if(this[_0xb8d9('0xc')][_0x4d4b7f['id']]){if(_[_0xb8d9('0x16')](this[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')])){this[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')]={};}this[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')][_0xb8d9('0x2b')]=moment();return new BPromise(function(_0x562cf9,_0x7e72d9){return _0x964578[_0xb8d9('0xd')]['verify'](_0x4d4b7f)['then'](function(_0x14885c){_0x964578[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')][_0xb8d9('0x21')]=_0xb8d9('0x30');_0x964578['mailAccounts'][_0x4d4b7f['id']]['Smtp'][_0xb8d9('0x14')]='';_0x964578[_0xb8d9('0xf')](_0x4d4b7f['id']);_0x562cf9(_0x14885c);})['catch'](function(_0x55a290){_0x964578['mailAccounts'][_0x4d4b7f['id']]['Smtp'][_0xb8d9('0x21')]='error';_0x964578[_0xb8d9('0xc')][_0x4d4b7f['id']]['Smtp']['messageStatus']=_0x55a290;_0x964578[_0xb8d9('0xf')](_0x4d4b7f['id']);_0x7e72d9(_0x55a290);});});}return this[_0xb8d9('0xd')]['verify'](_0x4d4b7f);};module['exports']=EmailChannel; \ No newline at end of file +var _0x1215=['total','isNil','emit','refresh','hasOwnProperty','email','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','Imap','messageStatus'];(function(_0x47f732,_0x1f38bc){var _0xf080de=function(_0x3bf80b){while(--_0x3bf80b){_0x47f732['push'](_0x47f732['shift']());}};_0xf080de(++_0x1f38bc);}(_0x1215,0x86));var _0x5121=function(_0x578062,_0x2858e9){_0x578062=_0x578062-0x0;var _0x2ba7f5=_0x1215[_0x578062];return _0x2ba7f5;};'use strict';var _=require('lodash');var moment=require(_0x5121('0x0'));var BPromise=require(_0x5121('0x1'));var md5=require(_0x5121('0x2'));var Redis=require(_0x5121('0x3'));var config=require(_0x5121('0x4'));var logger=require(_0x5121('0x5'))('email');config[_0x5121('0x6')]=_[_0x5121('0x7')](config[_0x5121('0x6')],{'host':_0x5121('0x8'),'port':0x18eb});var io=require(_0x5121('0x9'))(new Redis(config[_0x5121('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x5121('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3bd229){logger[_0x5121('0xb')](_0x5121('0xc'));this[_0x5121('0xd')]=_0x3bd229[_0x5121('0xd')];this[_0x5121('0xe')]={};this[_0x5121('0xf')]=new EmailSmtp();}EmailChannel[_0x5121('0x10')]['emit']=function(_0x38f0a5){var _0x4c4417=this[_0x5121('0xd')][_0x38f0a5];var _0x2190b7={'id':_0x4c4417['id'],'name':_0x4c4417[_0x5121('0x11')],'key':_0x4c4417[_0x5121('0x12')],'active':_0x4c4417[_0x5121('0x13')],'Imap':{'status':_0x4c4417[_0x5121('0x14')]['status'],'messageStatus':_0x4c4417[_0x5121('0x14')][_0x5121('0x15')],'total':_0x4c4417['Imap'][_0x5121('0x16')]}};if(_[_0x5121('0x17')](md5Accounts[_0x38f0a5])){md5Accounts[_0x38f0a5]={};}var _0xff9f3f=md5(JSON['stringify'](_0x2190b7));if(md5Accounts[_0x38f0a5][_0x5121('0x2')]!==_0xff9f3f){md5Accounts[_0x38f0a5][_0x5121('0x2')]=_0xff9f3f;io[_0x5121('0x18')]('mailAccount:update',_0x2190b7);}};EmailChannel[_0x5121('0x10')][_0x5121('0x19')]=function(_0x65cada){for(var _0x50939d in _0x65cada){if(_0x65cada[_0x5121('0x1a')](_0x50939d)){if(_0x65cada[_0x50939d][_0x5121('0x14')]&&_0x65cada[_0x50939d][_0x5121('0x13')]){var _0x45cbde=_0x65cada[_0x50939d][_0x5121('0x14')];if(!this['imapAccounts'][_0x5121('0x1a')](_0x45cbde['id'])){this['imapAccounts'][_0x45cbde['id']]=new EmailImap(_0x45cbde,_0x65cada[_0x50939d][_0x5121('0x1b')]);this[_0x5121('0xe')][_0x45cbde['id']]['on']('box',this[_0x5121('0x1c')][_0x5121('0x1d')](this,_0x50939d));this[_0x5121('0xe')][_0x45cbde['id']]['on'](_0x5121('0x1b'),this[_0x5121('0x1e')][_0x5121('0x1d')](this,_0x50939d));this[_0x5121('0xe')][_0x45cbde['id']]['on'](_0x5121('0x1f'),this[_0x5121('0x20')][_0x5121('0x1d')](this,_0x50939d));this[_0x5121('0xe')][_0x45cbde['id']]['on'](_0x5121('0x21'),this[_0x5121('0x22')][_0x5121('0x1d')](this,_0x50939d));}}else{if(_[_0x5121('0x17')](this['mailAccounts'][_0x50939d]['Imap'])){this[_0x5121('0xd')][_0x50939d]['Imap']={};}this[_0x5121('0xd')][_0x50939d][_0x5121('0x14')][_0x5121('0x23')]='disabled';this[_0x5121('0xd')][_0x50939d][_0x5121('0x14')][_0x5121('0x15')]='';this[_0x5121('0x18')](_0x50939d);}}}};EmailChannel[_0x5121('0x10')][_0x5121('0x1c')]=function(_0x22bfc6,_0x59b3a4){if(this[_0x5121('0xd')][_0x22bfc6]){this[_0x5121('0xd')][_0x22bfc6][_0x5121('0x14')][_0x5121('0x23')]=_0x5121('0x24');this[_0x5121('0xd')][_0x22bfc6][_0x5121('0x14')][_0x5121('0x15')]=_0x59b3a4['name'];if(_0x59b3a4[_0x5121('0x25')]){this[_0x5121('0xd')][_0x22bfc6][_0x5121('0x14')][_0x5121('0x16')]=_0x59b3a4[_0x5121('0x25')][_0x5121('0x16')];}return this['emit'](_0x22bfc6);}};EmailChannel['prototype'][_0x5121('0x1e')]=function(_0x49de05,_0x40a73a){logger['info'](_0x5121('0x26'),_0x40a73a['firstName'],_0x40a73a[_0x5121('0x27')],_0x40a73a[_0x5121('0x28')],_0x49de05);if(this[_0x5121('0xd')][_0x49de05]){return mailAccount['notify'](_0x49de05,_0x40a73a)[_0x5121('0x29')](function(_0x581c4c){if(_0x581c4c){logger[_0x5121('0xb')](_0x5121('0x2a'));}})['catch'](function(_0x36436f){logger[_0x5121('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x36436f));});}};EmailChannel[_0x5121('0x10')]['handleImapEnd']=function(_0x41d21b){if(this[_0x5121('0xd')][_0x41d21b]&&this[_0x5121('0xd')][_0x41d21b]['Imap']){if(this[_0x5121('0xe')][this[_0x5121('0xd')][_0x41d21b][_0x5121('0x14')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x41d21b]['Imap']['id']];}this[_0x5121('0xd')][_0x41d21b][_0x5121('0x14')][_0x5121('0x2b')]=moment();this['emit'](_0x41d21b);}};EmailChannel['prototype'][_0x5121('0x22')]=function(_0x21cba4,_0x1fc19a){if(this['mailAccounts'][_0x21cba4]){this['mailAccounts'][_0x21cba4][_0x5121('0x14')]['status']=_0x5121('0x21');this['mailAccounts'][_0x21cba4]['Imap'][_0x5121('0x15')]=_0x1fc19a;return this[_0x5121('0x18')](_0x21cba4);}};EmailChannel[_0x5121('0x10')][_0x5121('0x2c')]=function(_0x56e679,_0x58aa0d){return this[_0x5121('0xf')][_0x5121('0x2d')](_0x56e679,_0x58aa0d);};EmailChannel[_0x5121('0x10')][_0x5121('0x2e')]=function(_0x472243){var _0x46c6c9=this;if(this[_0x5121('0xd')][_0x472243['id']]){if(_[_0x5121('0x17')](this['mailAccounts'][_0x472243['id']]['Smtp'])){this[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')]={};}this[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')][_0x5121('0x2b')]=moment();return new BPromise(function(_0x4dcd16,_0x1c9acf){return _0x46c6c9['smtp'][_0x5121('0x30')](_0x472243)[_0x5121('0x29')](function(_0x57cdc6){_0x46c6c9[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')][_0x5121('0x23')]=_0x5121('0x31');_0x46c6c9[_0x5121('0xd')][_0x472243['id']]['Smtp'][_0x5121('0x15')]='';_0x46c6c9[_0x5121('0x18')](_0x472243['id']);_0x4dcd16(_0x57cdc6);})[_0x5121('0x32')](function(_0x20cc5b){_0x46c6c9[_0x5121('0xd')][_0x472243['id']]['Smtp'][_0x5121('0x23')]=_0x5121('0x21');_0x46c6c9[_0x5121('0xd')][_0x472243['id']][_0x5121('0x2f')][_0x5121('0x15')]=_0x20cc5b;_0x46c6c9[_0x5121('0x18')](_0x472243['id']);_0x1c9acf(_0x20cc5b);});});}return this[_0x5121('0xf')][_0x5121('0x30')](_0x472243);};module[_0x5121('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f4798d9..1ab4e1e 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 _0x6565=['port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','isNil','service','user','password','host'];(function(_0x4f0c77,_0x59d08f){var _0x3369ed=function(_0x1178c1){while(--_0x1178c1){_0x4f0c77['push'](_0x4f0c77['shift']());}};_0x3369ed(++_0x59d08f);}(_0x6565,0x15a));var _0x5656=function(_0x2ada6a,_0x49cece){_0x2ada6a=_0x2ada6a-0x0;var _0x42b8fa=_0x6565[_0x2ada6a];return _0x42b8fa;};'use strict';var fs=require('fs');var path=require(_0x5656('0x0'));var util=require(_0x5656('0x1'));var Imap=require(_0x5656('0x2'));var _=require(_0x5656('0x3'));var rs=require(_0x5656('0x4'));var simpleParser=require(_0x5656('0x5'))[_0x5656('0x6')];var Iconv=require(_0x5656('0x7'))['Iconv'];var EventEmitter=require(_0x5656('0x8'))[_0x5656('0x9')];var utils=require('./utils');var logger=require(_0x5656('0xa'))(_0x5656('0xb'));function EmailImap(_0x1f64d4,_0x2bc148){this['mailbox']=_0x5656('0xc');this[_0x5656('0xd')]=this[_0x5656('0xe')](_0x1f64d4,_0x2bc148);this[_0x5656('0x2')]=new Imap(this['account']);this[_0x5656('0x2')][_0x5656('0xf')](_0x5656('0x10'),this[_0x5656('0x11')]['bind'](this));this[_0x5656('0x2')][_0x5656('0xf')](_0x5656('0x12'),this[_0x5656('0x13')][_0x5656('0x14')](this));this[_0x5656('0x2')]['on'](_0x5656('0x15'),this[_0x5656('0x16')][_0x5656('0x14')](this));this['imap'][_0x5656('0x17')]();}util[_0x5656('0x18')](EmailImap,EventEmitter);EmailImap[_0x5656('0x19')][_0x5656('0xe')]=function(_0x3a6bf0,_0x31d939){var _0x5260de={'connTimeout':_0x3a6bf0['connTimeout']?_0x3a6bf0[_0x5656('0x1a')]*0x3e8:0x2710,'authTimeout':_0x3a6bf0['authTimeout']?_0x3a6bf0['authTimeout']*0x3e8:0x1388};if(_[_0x5656('0x1b')](_0x3a6bf0[_0x5656('0x1c')])){if(_0x3a6bf0['authentication']){_0x5260de[_0x5656('0x1d')]=_0x3a6bf0[_0x5656('0x1d')];_0x5260de[_0x5656('0x1e')]=_0x3a6bf0[_0x5656('0x1e')];}_0x5260de[_0x5656('0x1f')]=_0x3a6bf0[_0x5656('0x1f')];_0x5260de['port']=_0x3a6bf0[_0x5656('0x20')]||0x3e1;if(_0x3a6bf0[_0x5656('0x21')]){_0x5260de[_0x5656('0x21')]=!![];}else{_0x5260de['tls']=![];_0x5260de[_0x5656('0x22')]=_0x5656('0x23');}}else{_0x5260de[_0x5656('0x1d')]=_0x3a6bf0[_0x5656('0x1d')];_0x5260de[_0x5656('0x1e')]=_0x3a6bf0['password'];_0x5260de['host']=utils[_0x5656('0x24')](_0x3a6bf0['service']);_0x5260de[_0x5656('0x20')]=0x3e1;_0x5260de[_0x5656('0x21')]=!![];}_0x5260de[_0x5656('0xb')]=_0x31d939||_0x3a6bf0[_0x5656('0x1d')]||_0x5656('0x25');return _0x5260de;};EmailImap[_0x5656('0x19')][_0x5656('0x11')]=function(){this[_0x5656('0x2')][_0x5656('0x26')](this[_0x5656('0x27')],![],this[_0x5656('0x28')][_0x5656('0x14')](this));};EmailImap[_0x5656('0x19')][_0x5656('0x28')]=function(_0x1c8fe0,_0x323957){if(_0x1c8fe0){this[_0x5656('0x16')](_0x1c8fe0,!![]);}else{this[_0x5656('0x29')](_0x5656('0x2a'),_0x323957);this[_0x5656('0x2b')]();}};EmailImap[_0x5656('0x19')][_0x5656('0x2c')]=function(_0x102285){if(_0x102285){this[_0x5656('0x16')](_0x102285,!![]);}else{this[_0x5656('0x2')]['end']();}};EmailImap['prototype'][_0x5656('0x2b')]=function(){this['imap'][_0x5656('0x2d')]([_0x5656('0x2e')],this[_0x5656('0x2f')]['bind'](this));};EmailImap['prototype'][_0x5656('0x2f')]=function(_0x3dfe56,_0x488075){if(_0x3dfe56){this[_0x5656('0x16')](_0x3dfe56,!![]);}else{if(_0x488075['length']){try{var _0x505dda=this[_0x5656('0x2')][_0x5656('0x30')](_0x488075,{'bodies':'','markSeen':!![]});_0x505dda['on']('message',this[_0x5656('0x31')][_0x5656('0x14')](this));_0x505dda[_0x5656('0xf')](_0x5656('0x15'),this['handleFetchError']['bind'](this));_0x505dda[_0x5656('0xf')](_0x5656('0x12'),this[_0x5656('0x32')][_0x5656('0x14')](this));}catch(_0x1a08ad){logger[_0x5656('0x15')](_0x1a08ad);}}else{this[_0x5656('0x2')][_0x5656('0x33')](!![],this[_0x5656('0x2c')][_0x5656('0x14')](this));}}};EmailImap[_0x5656('0x19')]['handleFetchMessage']=function(_0x356e9f,_0x28115c){_0x356e9f['on'](_0x5656('0x34'),this[_0x5656('0x35')]['bind'](this));_0x356e9f['once'](_0x5656('0x36'),this[_0x5656('0x37')][_0x5656('0x14')](this));_0x356e9f[_0x5656('0xf')](_0x5656('0x12'),this[_0x5656('0x38')]['bind'](this));};EmailImap['prototype'][_0x5656('0x35')]=function(_0x2596a5,_0xe857c5){simpleParser(_0x2596a5,{'Iconv':Iconv},this[_0x5656('0x39')]['bind'](this));};EmailImap[_0x5656('0x19')][_0x5656('0x37')]=function(_0x551151){};EmailImap['prototype'][_0x5656('0x38')]=function(){};EmailImap[_0x5656('0x19')][_0x5656('0x39')]=function(_0x390f92,_0x1273ad){if(_0x390f92){logger[_0x5656('0x15')](_0x390f92);}else{var _0x3560d8=this;utils['parser'](this['account'],_0x1273ad,function(_0x54b26e){_0x3560d8[_0x5656('0x29')](_0x5656('0xb'),_0x54b26e);});}};EmailImap[_0x5656('0x19')][_0x5656('0x32')]=function(){this[_0x5656('0x2')][_0x5656('0x33')](!![],this[_0x5656('0x2c')][_0x5656('0x14')](this));};EmailImap[_0x5656('0x19')][_0x5656('0x3a')]=function(_0x35f2c8){this[_0x5656('0x16')](_0x35f2c8);this[_0x5656('0x2')][_0x5656('0x33')](!![],this[_0x5656('0x2c')][_0x5656('0x14')](this));};EmailImap[_0x5656('0x19')]['handleEnd']=function(){this[_0x5656('0x29')]('end');};EmailImap[_0x5656('0x19')][_0x5656('0x16')]=function(_0x8c74ab,_0x4f20c8){logger[_0x5656('0x15')]('handleError',this['account'][_0x5656('0xb')],JSON['stringify'](_0x8c74ab));var _0x4eab2a='';if(_0x8c74ab){if(_0x8c74ab[_0x5656('0x3b')]){_0x4eab2a=_0x8c74ab[_0x5656('0x3b')];}else{for(var _0x4277d2 in _0x8c74ab){if(_0x8c74ab[_0x5656('0x3c')](_0x4277d2)){_0x4eab2a+=_[_0x5656('0x3d')](_0x4277d2)+':\x20'+_0x8c74ab[_0x4277d2]+'\x0a';}}}}if(_0x4f20c8){this[_0x5656('0x2')][_0x5656('0x12')]();}else{this['emit'](_0x5656('0x15'),_0x4eab2a);this['emit']('end');}};module[_0x5656('0x3e')]=EmailImap; \ No newline at end of file +var _0xc2ba=['imap','lodash','randomstring','mailparser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','error','handleError','inherits','prototype','connTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','handleFetchError','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports'];(function(_0x58c525,_0x571d1a){var _0x34272f=function(_0x2e0ddc){while(--_0x2e0ddc){_0x58c525['push'](_0x58c525['shift']());}};_0x34272f(++_0x571d1a);}(_0xc2ba,0x131));var _0xac2b=function(_0x3295ed,_0x47006d){_0x3295ed=_0x3295ed-0x0;var _0x190c3f=_0xc2ba[_0x3295ed];return _0x190c3f;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xac2b('0x0'));var _=require(_0xac2b('0x1'));var rs=require(_0xac2b('0x2'));var simpleParser=require(_0xac2b('0x3'))['simpleParser'];var Iconv=require(_0xac2b('0x4'))['Iconv'];var EventEmitter=require(_0xac2b('0x5'))[_0xac2b('0x6')];var utils=require(_0xac2b('0x7'));var logger=require(_0xac2b('0x8'))(_0xac2b('0x9'));function EmailImap(_0x1364b1,_0x3fb6a5){this[_0xac2b('0xa')]=_0xac2b('0xb');this[_0xac2b('0xc')]=this[_0xac2b('0xd')](_0x1364b1,_0x3fb6a5);this[_0xac2b('0x0')]=new Imap(this['account']);this[_0xac2b('0x0')][_0xac2b('0xe')](_0xac2b('0xf'),this[_0xac2b('0x10')][_0xac2b('0x11')](this));this[_0xac2b('0x0')]['once'](_0xac2b('0x12'),this['handleEnd'][_0xac2b('0x11')](this));this[_0xac2b('0x0')]['on'](_0xac2b('0x13'),this[_0xac2b('0x14')][_0xac2b('0x11')](this));this[_0xac2b('0x0')]['connect']();}util[_0xac2b('0x15')](EmailImap,EventEmitter);EmailImap[_0xac2b('0x16')][_0xac2b('0xd')]=function(_0x37e88e,_0x346af5){var _0x300c9d={'connTimeout':_0x37e88e[_0xac2b('0x17')]?_0x37e88e[_0xac2b('0x17')]*0x3e8:0x2710,'authTimeout':_0x37e88e['authTimeout']?_0x37e88e['authTimeout']*0x3e8:0x1388};if(_[_0xac2b('0x18')](_0x37e88e[_0xac2b('0x19')])){if(_0x37e88e[_0xac2b('0x1a')]){_0x300c9d[_0xac2b('0x1b')]=_0x37e88e[_0xac2b('0x1b')];_0x300c9d[_0xac2b('0x1c')]=_0x37e88e[_0xac2b('0x1c')];}_0x300c9d[_0xac2b('0x1d')]=_0x37e88e[_0xac2b('0x1d')];_0x300c9d[_0xac2b('0x1e')]=_0x37e88e[_0xac2b('0x1e')]||0x3e1;if(_0x37e88e[_0xac2b('0x1f')]){_0x300c9d[_0xac2b('0x1f')]=!![];}else{_0x300c9d['tls']=![];_0x300c9d[_0xac2b('0x20')]=_0xac2b('0x21');}}else{_0x300c9d[_0xac2b('0x1b')]=_0x37e88e[_0xac2b('0x1b')];_0x300c9d[_0xac2b('0x1c')]=_0x37e88e['password'];_0x300c9d['host']=utils[_0xac2b('0x22')](_0x37e88e[_0xac2b('0x19')]);_0x300c9d[_0xac2b('0x1e')]=0x3e1;_0x300c9d['tls']=!![];}_0x300c9d[_0xac2b('0x9')]=_0x346af5||_0x37e88e['user']||_0xac2b('0x23');return _0x300c9d;};EmailImap[_0xac2b('0x16')][_0xac2b('0x10')]=function(){this[_0xac2b('0x0')]['openBox'](this[_0xac2b('0xa')],![],this[_0xac2b('0x24')]['bind'](this));};EmailImap['prototype'][_0xac2b('0x24')]=function(_0x146847,_0x4ec0f7){if(_0x146847){this[_0xac2b('0x14')](_0x146847,!![]);}else{this[_0xac2b('0x25')](_0xac2b('0x26'),_0x4ec0f7);this[_0xac2b('0x27')]();}};EmailImap[_0xac2b('0x16')][_0xac2b('0x28')]=function(_0x2778af){if(_0x2778af){this[_0xac2b('0x14')](_0x2778af,!![]);}else{this[_0xac2b('0x0')]['end']();}};EmailImap[_0xac2b('0x16')][_0xac2b('0x27')]=function(){this['imap'][_0xac2b('0x29')]([_0xac2b('0x2a')],this['handleReadUnseen'][_0xac2b('0x11')](this));};EmailImap['prototype'][_0xac2b('0x2b')]=function(_0xbcb118,_0x25da09){if(_0xbcb118){this['handleError'](_0xbcb118,!![]);}else{if(_0x25da09['length']){try{var _0x91b067=this[_0xac2b('0x0')][_0xac2b('0x2c')](_0x25da09,{'bodies':'','markSeen':!![]});_0x91b067['on'](_0xac2b('0x2d'),this[_0xac2b('0x2e')]['bind'](this));_0x91b067['once'](_0xac2b('0x13'),this['handleFetchError'][_0xac2b('0x11')](this));_0x91b067[_0xac2b('0xe')](_0xac2b('0x12'),this[_0xac2b('0x2f')][_0xac2b('0x11')](this));}catch(_0x5c1488){logger[_0xac2b('0x13')](_0x5c1488);}}else{this[_0xac2b('0x0')][_0xac2b('0x30')](!![],this[_0xac2b('0x28')][_0xac2b('0x11')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x478d76,_0x37b836){_0x478d76['on']('body',this[_0xac2b('0x31')][_0xac2b('0x11')](this));_0x478d76['once'](_0xac2b('0x32'),this[_0xac2b('0x33')][_0xac2b('0x11')](this));_0x478d76['once'](_0xac2b('0x12'),this['handleMessageEnd'][_0xac2b('0x11')](this));};EmailImap[_0xac2b('0x16')][_0xac2b('0x31')]=function(_0x4e22f2,_0xb01cdb){simpleParser(_0x4e22f2,{'Iconv':Iconv},this[_0xac2b('0x34')]['bind'](this));};EmailImap[_0xac2b('0x16')][_0xac2b('0x33')]=function(_0x21f703){};EmailImap['prototype'][_0xac2b('0x35')]=function(){};EmailImap['prototype'][_0xac2b('0x34')]=function(_0x33cdc2,_0x540d84){if(_0x33cdc2){logger[_0xac2b('0x13')](_0x33cdc2);}else{var _0x4f3782=this;utils['parser'](this['account'],_0x540d84,function(_0x48ede1){_0x4f3782[_0xac2b('0x25')](_0xac2b('0x9'),_0x48ede1);});}};EmailImap[_0xac2b('0x16')][_0xac2b('0x2f')]=function(){this[_0xac2b('0x0')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xac2b('0x16')][_0xac2b('0x36')]=function(_0x1d4096){this[_0xac2b('0x14')](_0x1d4096);this[_0xac2b('0x0')][_0xac2b('0x30')](!![],this[_0xac2b('0x28')][_0xac2b('0x11')](this));};EmailImap['prototype'][_0xac2b('0x37')]=function(){this['emit'](_0xac2b('0x12'));};EmailImap[_0xac2b('0x16')]['handleError']=function(_0x16359a,_0x37d00e){logger[_0xac2b('0x13')](_0xac2b('0x14'),this[_0xac2b('0xc')][_0xac2b('0x9')],JSON[_0xac2b('0x38')](_0x16359a));var _0x4b9a45='';if(_0x16359a){if(_0x16359a[_0xac2b('0x39')]){_0x4b9a45=_0x16359a[_0xac2b('0x39')];}else{for(var _0xe53d9 in _0x16359a){if(_0x16359a[_0xac2b('0x3a')](_0xe53d9)){_0x4b9a45+=_[_0xac2b('0x3b')](_0xe53d9)+':\x20'+_0x16359a[_0xe53d9]+'\x0a';}}}}if(_0x37d00e){this[_0xac2b('0x0')][_0xac2b('0x12')]();}else{this['emit'](_0xac2b('0x13'),_0x4b9a45);this[_0xac2b('0x25')](_0xac2b('0x12'));}};module[_0xac2b('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 359004f..888f7ca 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 _0xb59d=['use','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xb59d,0x12e));var _0xdb59=function(_0x3cff7c,_0x4ed4f9){_0x3cff7c=_0x3cff7c-0x0;var _0x4f3c8d=_0xb59d[_0x3cff7c];return _0x4f3c8d;};'use strict';var nodemailer=require(_0xdb59('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xdb59('0x1'));function EmailSmtp(){}EmailSmtp[_0xdb59('0x2')]['send']=function(_0x4d7301,_0x414aa1){return new BPromise(function(_0x138dcb,_0x8c6b24){var _0xaff2f4=nodemailer[_0xdb59('0x3')](_0x4d7301);_0xaff2f4[_0xdb59('0x4')]('compile',inlineBase64());_0xaff2f4[_0xdb59('0x5')](_0x414aa1,function(_0x14a0c9,_0x18036c){if(_0x14a0c9){_0x8c6b24(_0x14a0c9[_0xdb59('0x6')]());}else{_0x138dcb(_0x18036c);}});});};EmailSmtp[_0xdb59('0x2')][_0xdb59('0x7')]=function(_0x1763af){return new BPromise(function(_0x3ac61c,_0xa9df4a){var _0x36fcd1=nodemailer[_0xdb59('0x3')](_0x1763af);_0x36fcd1[_0xdb59('0x7')](function(_0x1f3e13,_0x3c55a4){if(_0x1f3e13){_0xa9df4a(_0x1f3e13[_0xdb59('0x6')]());}else{if(_0x3c55a4){_0x3ac61c(_0x3c55a4);}else{_0xa9df4a('Not\x20verifired');}}});});};module[_0xdb59('0x8')]=EmailSmtp; \ No newline at end of file +var _0x7fe6=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7fe6,0x1ae));var _0x67fe=function(_0x412ff5,_0x47a49f){_0x412ff5=_0x412ff5-0x0;var _0x280aeb=_0x7fe6[_0x412ff5];return _0x280aeb;};'use strict';var nodemailer=require(_0x67fe('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x67fe('0x1'));function EmailSmtp(){}EmailSmtp[_0x67fe('0x2')]['send']=function(_0x53d25f,_0x4f9fa3){return new BPromise(function(_0x3f4070,_0x2bf6ee){var _0x42127b=nodemailer[_0x67fe('0x3')](_0x53d25f);_0x42127b['use']('compile',inlineBase64());_0x42127b['sendMail'](_0x4f9fa3,function(_0x458b0c,_0x483715){if(_0x458b0c){_0x2bf6ee(_0x458b0c['toString']());}else{_0x3f4070(_0x483715);}});});};EmailSmtp[_0x67fe('0x2')]['verify']=function(_0xcb7634){return new BPromise(function(_0x1d10bf,_0x48314f){var _0x5f406c=nodemailer['createTransport'](_0xcb7634);_0x5f406c[_0x67fe('0x4')](function(_0x4ea3cd,_0x4e9045){if(_0x4ea3cd){_0x48314f(_0x4ea3cd['toString']());}else{if(_0x4e9045){_0x1d10bf(_0x4e9045);}else{_0x48314f(_0x67fe('0x5'));}}});});};module[_0x67fe('0x6')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3f39a00..f829eaa 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 _0xd2d4=['imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1','lodash','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','join','Anonymous','pop','isEmpty','test','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo'];(function(_0xd6a763,_0x563229){var _0x4bf8ca=function(_0x213e83){while(--_0x213e83){_0xd6a763['push'](_0xd6a763['shift']());}};_0x4bf8ca(++_0x563229);}(_0xd2d4,0x8c));var _0x4d2d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd2d4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4d2d('0x0'));var moment=require('moment');var random=require(_0x4d2d('0x1'));var fs=require('fs');var path=require(_0x4d2d('0x2'));var util=require(_0x4d2d('0x3'));var tnef=require('node-tnef');var logger=require(_0x4d2d('0x4'))('email');var config=require(_0x4d2d('0x5'));function getAddress(_0x5bd1af){var _0x553b2c=_[_0x4d2d('0x6')](_0x5bd1af[_0x4d2d('0x7')]);return _0x553b2c&&_0x553b2c['address']?_0x553b2c[_0x4d2d('0x8')]:_0x4d2d('0x9')+random[_0x4d2d('0xa')](0x6)+_0x4d2d('0xb');}function getFirstName(_0x30fb3b){var _0x2c75e8=_[_0x4d2d('0x6')](_0x30fb3b[_0x4d2d('0x7')]);if(_0x2c75e8&&_0x2c75e8[_0x4d2d('0xc')]){var _0x2fbfe1=_0x2c75e8[_0x4d2d('0xc')][_0x4d2d('0xd')](/\s+/);return _0x2fbfe1[_0x4d2d('0xe')]?_0x2fbfe1['slice'](0x0,-0x1)[_0x4d2d('0xf')]('\x20'):_0x2c75e8['name'];}return _0x4d2d('0x10');}function getLastName(_0x471082){var _0xcace4e=_['head'](_0x471082['value']);if(_0xcace4e&&_0xcace4e['name']){var _0x3e878e=_0xcace4e['name'][_0x4d2d('0xd')](/\s+/);return _0x3e878e['length']>0x1?_0x3e878e[_0x4d2d('0x11')]():'';}return'';}function getMails(_0x3d2fdf,_0x4667b5){var _0x2f8c18='';for(var _0x442a28=0x0;_0x442a28<_0x4667b5[_0x4d2d('0x7')]['length'];_0x442a28+=0x1){if(_0x4667b5['value'][_0x442a28]['address']!==_0x3d2fdf){if(!_[_0x4d2d('0x12')](_0x2f8c18)){_0x2f8c18+=',';}_0x2f8c18+=_0x4667b5[_0x4d2d('0x7')][_0x442a28][_0x4d2d('0xc')]||_0x4667b5[_0x4d2d('0x7')][_0x442a28][_0x4d2d('0x8')]||'';_0x2f8c18+='\x20<';_0x2f8c18+=_0x4667b5['value'][_0x442a28][_0x4d2d('0x8')]?_0x4667b5[_0x4d2d('0x7')][_0x442a28][_0x4d2d('0x8')]:_0x4d2d('0x9')+random['generate'](0x6)+_0x4d2d('0xb');_0x2f8c18+='>';}}return _0x2f8c18;}function parseEmail(_0x465d6f,_0x146854,_0x16e3b1){if(_0x146854['html']){var _0x41d960=/)<[^<]*)*<\/script>/gi;while(_0x41d960[_0x4d2d('0x13')](_0x146854[_0x4d2d('0x14')])){_0x146854[_0x4d2d('0x14')]=_0x146854[_0x4d2d('0x14')][_0x4d2d('0x15')](_0x41d960,'');}_0x16e3b1[_0x4d2d('0x16')]=_0x146854[_0x4d2d('0x14')];}else{_0x16e3b1[_0x4d2d('0x16')]=_0x146854[_0x4d2d('0x17')];}if(_0x16e3b1[_0x4d2d('0x16')]){_0x16e3b1[_0x4d2d('0x16')]=_0x16e3b1[_0x4d2d('0x16')]['replace'](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','split','length','Anonymous','pop','isEmpty','html','test','body','message','originCc','originTo','includes','bcc','attachments','type','attachment','filename','attachment-','format','%s-%s','join','root','writeFileSync','content','push','contentType','parser'];(function(_0x5ac6b6,_0x360830){var _0x1e2d88=function(_0x10a329){while(--_0x10a329){_0x5ac6b6['push'](_0x5ac6b6['shift']());}};_0x1e2d88(++_0x360830);}(_0xda3b,0x99));var _0xbda3=function(_0x18a601,_0x4ecde7){_0x18a601=_0x18a601-0x0;var _0x25bf03=_0xda3b[_0x18a601];return _0x25bf03;};'use strict';var _=require(_0xbda3('0x0'));var moment=require(_0xbda3('0x1'));var random=require(_0xbda3('0x2'));var fs=require('fs');var path=require(_0xbda3('0x3'));var util=require(_0xbda3('0x4'));var tnef=require(_0xbda3('0x5'));var logger=require(_0xbda3('0x6'))(_0xbda3('0x7'));var config=require('../../../config/environment');function getAddress(_0x197b5a){var _0x5d5e16=_[_0xbda3('0x8')](_0x197b5a[_0xbda3('0x9')]);return _0x5d5e16&&_0x5d5e16[_0xbda3('0xa')]?_0x5d5e16[_0xbda3('0xa')]:_0xbda3('0xb')+random[_0xbda3('0xc')](0x6)+_0xbda3('0xd');}function getFirstName(_0x2e3d70){var _0x3e9490=_[_0xbda3('0x8')](_0x2e3d70[_0xbda3('0x9')]);if(_0x3e9490&&_0x3e9490[_0xbda3('0xe')]){var _0x287e31=_0x3e9490['name'][_0xbda3('0xf')](/\s+/);return _0x287e31[_0xbda3('0x10')]?_0x287e31['slice'](0x0,-0x1)['join']('\x20'):_0x3e9490[_0xbda3('0xe')];}return _0xbda3('0x11');}function getLastName(_0x56c924){var _0x537206=_[_0xbda3('0x8')](_0x56c924[_0xbda3('0x9')]);if(_0x537206&&_0x537206['name']){var _0x4381f7=_0x537206[_0xbda3('0xe')][_0xbda3('0xf')](/\s+/);return _0x4381f7[_0xbda3('0x10')]>0x1?_0x4381f7[_0xbda3('0x12')]():'';}return'';}function getMails(_0x2e6d0c,_0x68459e){var _0x5c190f='';for(var _0x32d8b2=0x0;_0x32d8b2<_0x68459e[_0xbda3('0x9')][_0xbda3('0x10')];_0x32d8b2+=0x1){if(_0x68459e['value'][_0x32d8b2][_0xbda3('0xa')]!==_0x2e6d0c){if(!_[_0xbda3('0x13')](_0x5c190f)){_0x5c190f+=',';}_0x5c190f+=_0x68459e[_0xbda3('0x9')][_0x32d8b2][_0xbda3('0xe')]||_0x68459e[_0xbda3('0x9')][_0x32d8b2][_0xbda3('0xa')]||'';_0x5c190f+='\x20<';_0x5c190f+=_0x68459e['value'][_0x32d8b2][_0xbda3('0xa')]?_0x68459e[_0xbda3('0x9')][_0x32d8b2][_0xbda3('0xa')]:_0xbda3('0xb')+random[_0xbda3('0xc')](0x6)+_0xbda3('0xd');_0x5c190f+='>';}}return _0x5c190f;}function parseEmail(_0x203e21,_0x254b75,_0x2d7819){if(_0x254b75[_0xbda3('0x14')]){var _0x4a77bb=/)<[^<]*)*<\/script>/gi;while(_0x4a77bb[_0xbda3('0x15')](_0x254b75[_0xbda3('0x14')])){_0x254b75[_0xbda3('0x14')]=_0x254b75[_0xbda3('0x14')]['replace'](_0x4a77bb,'');}_0x2d7819[_0xbda3('0x16')]=_0x254b75[_0xbda3('0x14')];}else{_0x2d7819['body']=_0x254b75['textAsHtml'];}if(_0x2d7819['body']){_0x2d7819[_0xbda3('0x16')]=_0x2d7819[_0xbda3('0x16')]['replace'](/0x0){if(this[_0x28a0bc+'Capacity']>0x0&&this[_0x28a0bc+_0x647d('0x23')]>=this[_0x28a0bc+_0x647d('0x24')]){return _0x647d('0x25');}else{return _0x647d('0x26');}}else{return'idle';}};Agent['prototype'][_0x647d('0x27')]=function(){var _0x4a26e2=[_0x647d('0x28'),_0x647d('0x29'),_0x647d('0x2a'),_0x647d('0x2b'),_0x647d('0x2c'),_0x647d('0x2d')];for(var _0x389791=0x0;_0x389791<_0x4a26e2[_0x647d('0x2e')];_0x389791+=0x1){var _0x243f13=this[_0x647d('0x2f')](_0x4a26e2[_0x389791]);if(this[_0x4a26e2[_0x389791]+_0x647d('0x30')]!==_0x243f13){this[_0x4a26e2[_0x389791]+_0x647d('0x31')]=_[_0x647d('0x32')](moment()[_0x647d('0x33')]('x'));}this[_0x4a26e2[_0x389791]+_0x647d('0x30')]=_0x243f13;}var _0x3fd97f={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x647d('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x647d('0xf')],'faxPause':this[_0x647d('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x647d('0x11')],'chatStatusTime':this[_0x647d('0x34')],'chatCapacity':this[_0x647d('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x647d('0x14')],'mailStatusTime':this[_0x647d('0x16')],'mailCapacity':this[_0x647d('0x17')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x647d('0x35')],'faxCapacity':this[_0x647d('0x19')],'faxCurrentCapacity':this[_0x647d('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x647d('0x1b')],'smsCapacity':this[_0x647d('0x1c')],'smsCurrentCapacity':this[_0x647d('0x36')],'whatsappStatus':this[_0x647d('0x1d')],'whatsappStatusTime':this[_0x647d('0x37')],'whatsappCapacity':this[_0x647d('0x1e')],'whatsappCurrentCapacity':this[_0x647d('0x1f')],'openchannelStatus':this[_0x647d('0x38')],'openchannelStatusTime':this[_0x647d('0x39')],'openchannelCapacity':this[_0x647d('0x20')],'openchannelCurrentCapacity':this[_0x647d('0x21')],'busy':this['busy'],'busyQueue':this[_0x647d('0x22')]};var _0xce1f54=md5(JSON[_0x647d('0x3a')](_0x3fd97f));if(this[_0x647d('0x2')]!==_0xce1f54){this[_0x647d('0x2')]=_0xce1f54;io[_0x647d('0x3b')](_0x647d('0x3c'),_0x3fd97f);}};module[_0x647d('0x3d')]=Agent; \ No newline at end of file +var _0x02f7=['smsStatusTime','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','sms','length','Status','toNumber','smsCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatusTime','busy','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus'];(function(_0x54c8b6,_0x11f6a1){var _0x147ed9=function(_0x2c0fd0){while(--_0x2c0fd0){_0x54c8b6['push'](_0x54c8b6['shift']());}};_0x147ed9(++_0x11f6a1);}(_0x02f7,0x1d3));var _0x702f=function(_0x32fa1f,_0x3735be){_0x32fa1f=_0x32fa1f-0x0;var _0x51a8ca=_0x02f7[_0x32fa1f];return _0x51a8ca;};'use strict';var _=require(_0x702f('0x0'));var moment=require(_0x702f('0x1'));var md5=require(_0x702f('0x2'));var Redis=require('ioredis');var config=require(_0x702f('0x3'));config[_0x702f('0x4')]=_[_0x702f('0x5')](config[_0x702f('0x4')],{'host':_0x702f('0x6'),'port':0x18eb});var io=require(_0x702f('0x7'))(new Redis(config['redis']));function Agent(_0x5f1d5d){this['id']=_0x5f1d5d['id']||0x0;this[_0x702f('0x8')]=_0x5f1d5d['name']||'';this[_0x702f('0x9')]=_0x5f1d5d[_0x702f('0x9')]||!![];this[_0x702f('0xa')]=_0x5f1d5d[_0x702f('0xa')]||![];this[_0x702f('0xb')]=_0x5f1d5d['chatPause']||![];this[_0x702f('0xc')]=_0x5f1d5d[_0x702f('0xc')]||![];this[_0x702f('0xd')]=_0x5f1d5d['faxPause']||![];this[_0x702f('0xe')]=_0x5f1d5d[_0x702f('0xe')]||![];this[_0x702f('0xf')]=_0x5f1d5d['openchannelPause']||![];this['chatStatus']=_0x702f('0x10');this[_0x702f('0x11')]=0x0;this[_0x702f('0x12')]=_0x5f1d5d['chatCapacity']||0x0;this[_0x702f('0x13')]=0x0;this[_0x702f('0x14')]='unknown';this[_0x702f('0x15')]=0x0;this[_0x702f('0x16')]=_0x5f1d5d[_0x702f('0x16')]||0x0;this[_0x702f('0x17')]=0x0;this[_0x702f('0x18')]=_0x702f('0x10');this[_0x702f('0x19')]=0x0;this['faxCapacity']=_0x5f1d5d[_0x702f('0x1a')]||0x0;this[_0x702f('0x1b')]=0x0;this[_0x702f('0x1c')]=_0x702f('0x10');this[_0x702f('0x1d')]=0x0;this['smsCapacity']=_0x5f1d5d['smsCapacity']||0x0;this[_0x702f('0x1e')]=0x0;this['whatsappStatus']=_0x702f('0x10');this[_0x702f('0x1f')]=0x0;this[_0x702f('0x20')]=_0x5f1d5d[_0x702f('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x702f('0x21')]='unknown';this['openchannelStatusTime']=0x0;this[_0x702f('0x22')]=_0x5f1d5d[_0x702f('0x22')]||0x0;this[_0x702f('0x23')]=0x0;this['busy']=![];this[_0x702f('0x24')]=undefined;this[_0x702f('0x2')]='';this[_0x702f('0x25')]();}Agent['prototype'][_0x702f('0x26')]=function(_0x3eccee){if(this[_0x3eccee+_0x702f('0x27')]>0x0){if(this[_0x3eccee+_0x702f('0x28')]>0x0&&this[_0x3eccee+_0x702f('0x27')]>=this[_0x3eccee+_0x702f('0x28')]){return _0x702f('0x29');}else{return _0x702f('0x2a');}}else{return _0x702f('0x2b');}};Agent[_0x702f('0x2c')][_0x702f('0x25')]=function(){var _0x28a0d8=[_0x702f('0x2d'),_0x702f('0x2e'),_0x702f('0x2f'),_0x702f('0x30'),_0x702f('0x31'),'whatsapp'];for(var _0x3a2aeb=0x0;_0x3a2aeb<_0x28a0d8[_0x702f('0x32')];_0x3a2aeb+=0x1){var _0x46136d=this[_0x702f('0x26')](_0x28a0d8[_0x3a2aeb]);if(this[_0x28a0d8[_0x3a2aeb]+_0x702f('0x33')]!==_0x46136d){this[_0x28a0d8[_0x3a2aeb]+'StatusTime']=_[_0x702f('0x34')](moment()['format']('x'));}this[_0x28a0d8[_0x3a2aeb]+_0x702f('0x33')]=_0x46136d;}var _0x62bc25={'id':this['id'],'name':this[_0x702f('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x702f('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x702f('0xe')],'faxPause':this[_0x702f('0xd')],'openchannelPause':this[_0x702f('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x702f('0x11')],'chatCapacity':this[_0x702f('0x12')],'chatCurrentCapacity':this[_0x702f('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x702f('0x16')],'mailCurrentCapacity':this[_0x702f('0x17')],'faxStatus':this[_0x702f('0x18')],'faxStatusTime':this[_0x702f('0x19')],'faxCapacity':this[_0x702f('0x1a')],'faxCurrentCapacity':this[_0x702f('0x1b')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x702f('0x1d')],'smsCapacity':this[_0x702f('0x35')],'smsCurrentCapacity':this[_0x702f('0x1e')],'whatsappStatus':this[_0x702f('0x36')],'whatsappStatusTime':this[_0x702f('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x702f('0x37')],'openchannelStatus':this[_0x702f('0x21')],'openchannelStatusTime':this[_0x702f('0x38')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x702f('0x23')],'busy':this[_0x702f('0x39')],'busyQueue':this[_0x702f('0x24')]};var _0x8a908a=md5(JSON[_0x702f('0x3a')](_0x62bc25));if(this[_0x702f('0x2')]!==_0x8a908a){this[_0x702f('0x2')]=_0x8a908a;io[_0x702f('0x3b')](_0x702f('0x3c'),_0x62bc25);}};module[_0x702f('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index aabf27e..4aa1ae4 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 _0xabdc=['chatPause','paused','available','format','chat:queue:%s','chat_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length'];(function(_0x14559f,_0x218697){var _0x46f698=function(_0x57993e){while(--_0x57993e){_0x14559f['push'](_0x14559f['shift']());}};_0x46f698(++_0x218697);}(_0xabdc,0x156));var _0xcabd=function(_0x4caf17,_0x3d4143){_0x4caf17=_0x4caf17-0x0;var _0x286bfa=_0xabdc[_0x4caf17];return _0x286bfa;};'use strict';var _=require(_0xcabd('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xcabd('0x1'));var config=require(_0xcabd('0x2'));config[_0xcabd('0x3')]=_[_0xcabd('0x4')](config['redis'],{'host':_0xcabd('0x5'),'port':0x18eb});var io=require(_0xcabd('0x6'))(new Redis(config[_0xcabd('0x3')]));function ChatQueue(_0x2120bb){this['id']=_0x2120bb['id']||0x0;this[_0xcabd('0x7')]=_0x2120bb['name']||'';this[_0xcabd('0x8')]=_0x2120bb['timeout']||0xa;this[_0xcabd('0x9')]=_0x2120bb['strategy']||_0xcabd('0xa');this[_0xcabd('0xb')]=_0x2120bb[_0xcabd('0xb')];this[_0xcabd('0xc')]={};this[_0xcabd('0xd')]=0x0;this[_0xcabd('0xe')]='';this[_0xcabd('0xf')]();this['updateRealtime']();}ChatQueue[_0xcabd('0x10')][_0xcabd('0xf')]=function(){var _0x5c8563=this['mapAgentsId'][_0xcabd('0x11')];this[_0xcabd('0xc')]=_[_0xcabd('0x12')](this[_0xcabd('0xb')],'id');this[_0xcabd('0xc')]['_rr']=_0x5c8563;};ChatQueue[_0xcabd('0x10')][_0xcabd('0x13')]=function(){this[_0xcabd('0x14')]=0x0;this['paused']=0x0;for(var _0x2b75c9=0x0;_0x2b75c9=0x0?this[_0xcabd('0x18')]:0x0;var _0x4f0a47={'id':this['id'],'available':this[_0xcabd('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xcabd('0x7')],'paused':this[_0xcabd('0x17')],'waiting':this[_0xcabd('0xd')]};var _0x1f5d7d=md5(JSON['stringify'](_0x4f0a47));if(this[_0xcabd('0xe')]!==_0x1f5d7d){this[_0xcabd('0xe')]=_0x1f5d7d;io['to'](util[_0xcabd('0x19')](_0xcabd('0x1a'),_0x4f0a47[_0xcabd('0x7')]))['emit'](_0xcabd('0x1b'),_0x4f0a47);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x3633=['paused','length','online','chatPause','available','waiting','format','chat:queue:%s','emit','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','prototype','updateRouting','_rr','Agents','loggedIn'];(function(_0x30da35,_0x280ba8){var _0x4f47bb=function(_0x1c0121){while(--_0x1c0121){_0x30da35['push'](_0x30da35['shift']());}};_0x4f47bb(++_0x280ba8);}(_0x3633,0xda));var _0x3363=function(_0x42ca45,_0x52d00b){_0x42ca45=_0x42ca45-0x0;var _0xa6205c=_0x3633[_0x42ca45];return _0xa6205c;};'use strict';var _=require(_0x3363('0x0'));var md5=require(_0x3363('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3363('0x2'));config[_0x3363('0x3')]=_[_0x3363('0x4')](config[_0x3363('0x3')],{'host':_0x3363('0x5'),'port':0x18eb});var io=require(_0x3363('0x6'))(new Redis(config[_0x3363('0x3')]));function ChatQueue(_0x4966f4){this['id']=_0x4966f4['id']||0x0;this['name']=_0x4966f4[_0x3363('0x7')]||'';this[_0x3363('0x8')]=_0x4966f4[_0x3363('0x8')]||0xa;this['strategy']=_0x4966f4[_0x3363('0x9')]||'beepall';this['Agents']=_0x4966f4['Agents'];this[_0x3363('0xa')]={};this['waiting']=0x0;this[_0x3363('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x3363('0xb')][_0x3363('0xc')]=function(){var _0x39b018=this[_0x3363('0xa')][_0x3363('0xd')];this[_0x3363('0xa')]=_['map'](this[_0x3363('0xe')],'id');this[_0x3363('0xa')]['_rr']=_0x39b018;};ChatQueue[_0x3363('0xb')]['updateRealtime']=function(){this[_0x3363('0xf')]=0x0;this[_0x3363('0x10')]=0x0;for(var _0x4158b2=0x0;_0x4158b2=0x0?this['available']:0x0;var _0x38b308={'id':this['id'],'available':this[_0x3363('0x14')],'loggedIn':this[_0x3363('0xf')],'name':this['name'],'paused':this[_0x3363('0x10')],'waiting':this[_0x3363('0x15')]};var _0x4b83c4=md5(JSON['stringify'](_0x38b308));if(this[_0x3363('0x1')]!==_0x4b83c4){this[_0x3363('0x1')]=_0x4b83c4;io['to'](util[_0x3363('0x16')](_0x3363('0x17'),_0x38b308['name']))[_0x3363('0x18')]('chat_queue:save',_0x38b308);}};module[_0x3363('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 203d7d0..fe9001d 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(_0x5ebba4,_0x2a0897){var _0x51128b=function(_0x1bd92a){while(--_0x1bd92a){_0x5ebba4['push'](_0x5ebba4['shift']());}};_0x51128b(++_0x2a0897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x3ce98d,_0x4dbf4b){var _0x22e6cb=function(_0x2fee66){while(--_0x2fee66){_0x3ce98d['push'](_0x3ce98d['shift']());}};_0x22e6cb(++_0x4dbf4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 03334f0..7975bbe 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 _0xf5de=['name','Intervals','exports'];(function(_0xb606f2,_0x47b7a2){var _0x6ee9e0=function(_0x4f9e3d){while(--_0x4f9e3d){_0xb606f2['push'](_0xb606f2['shift']());}};_0x6ee9e0(++_0x47b7a2);}(_0xf5de,0x198));var _0xef5d=function(_0x99f2a0,_0x53b2bb){_0x99f2a0=_0x99f2a0-0x0;var _0x34d315=_0xf5de[_0x99f2a0];return _0x34d315;};'use strict';function Interval(_0x22646f){this['id']=_0x22646f['id']||0x0;this[_0xef5d('0x0')]=_0x22646f[_0xef5d('0x0')]||'';this[_0xef5d('0x1')]=_0x22646f[_0xef5d('0x1')]||{};}module[_0xef5d('0x2')]=Interval; \ No newline at end of file +var _0xa3e5=['name','Intervals','exports'];(function(_0x5d7487,_0x5f2539){var _0x274f25=function(_0x35a95b){while(--_0x35a95b){_0x5d7487['push'](_0x5d7487['shift']());}};_0x274f25(++_0x5f2539);}(_0xa3e5,0x198));var _0x5a3e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa3e5[_0x311c35];return _0x5cc50c;};'use strict';function Interval(_0x3b4b03){this['id']=_0x3b4b03['id']||0x0;this['name']=_0x3b4b03[_0x5a3e('0x0')]||'';this['Intervals']=_0x3b4b03[_0x5a3e('0x1')]||{};}module[_0x5a3e('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index f08e8bb..a5bb063 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 _0x7c7f=['available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','length','online','mailPause','paused','loggedIn'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x7c7f,0x163));var _0xf7c7=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x7c7f[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xf7c7('0x0'));var md5=require(_0xf7c7('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xf7c7('0x2'));config[_0xf7c7('0x3')]=_[_0xf7c7('0x4')](config['redis'],{'host':_0xf7c7('0x5'),'port':0x18eb});var io=require(_0xf7c7('0x6'))(new Redis(config['redis']));function MailQueue(_0x4acf8a){this['id']=_0x4acf8a['id']||0x0;this[_0xf7c7('0x7')]=_0x4acf8a['name']||'';this['timeout']=_0x4acf8a[_0xf7c7('0x8')]||0xa;this[_0xf7c7('0x9')]=_0x4acf8a[_0xf7c7('0x9')]||_0xf7c7('0xa');this[_0xf7c7('0xb')]=_0x4acf8a['Agents'];this[_0xf7c7('0xc')]={};this['waiting']=0x0;this[_0xf7c7('0x1')]='';this[_0xf7c7('0xd')]();this[_0xf7c7('0xe')]();}MailQueue[_0xf7c7('0xf')]['updateRouting']=function(){var _0x52b15a=this['mapAgentsId'][_0xf7c7('0x10')];this[_0xf7c7('0xc')]=_['map'](this['Agents'],'id');this[_0xf7c7('0xc')][_0xf7c7('0x10')]=_0x52b15a;};MailQueue[_0xf7c7('0xf')][_0xf7c7('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x103442=0x0;_0x103442=0x0?this['available']:0x0;var _0x446146={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xf7c7('0x7')],'paused':this[_0xf7c7('0x14')],'waiting':this['waiting']};var _0x1fbe56=md5(JSON[_0xf7c7('0x17')](_0x446146));if(this[_0xf7c7('0x1')]!==_0x1fbe56){this[_0xf7c7('0x1')]=_0x1fbe56;io['to'](util[_0xf7c7('0x18')](_0xf7c7('0x19'),_0x446146[_0xf7c7('0x7')]))[_0xf7c7('0x1a')](_0xf7c7('0x1b'),_0x446146);}};module[_0xf7c7('0x1c')]=MailQueue; \ No newline at end of file +var _0x7847=['md5','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','map','mapAgentsId','_rr','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','exports','lodash'];(function(_0x9e53fd,_0x2c6bce){var _0xecf3f4=function(_0x2dbedb){while(--_0x2dbedb){_0x9e53fd['push'](_0x9e53fd['shift']());}};_0xecf3f4(++_0x2c6bce);}(_0x7847,0xca));var _0x7784=function(_0x33e61d,_0x182628){_0x33e61d=_0x33e61d-0x0;var _0x185b31=_0x7847[_0x33e61d];return _0x185b31;};'use strict';var _=require(_0x7784('0x0'));var md5=require(_0x7784('0x1'));var util=require('util');var Redis=require(_0x7784('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x7784('0x3')](config[_0x7784('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x7784('0x5'))(new Redis(config[_0x7784('0x4')]));function MailQueue(_0x1bf408){this['id']=_0x1bf408['id']||0x0;this[_0x7784('0x6')]=_0x1bf408[_0x7784('0x6')]||'';this[_0x7784('0x7')]=_0x1bf408[_0x7784('0x7')]||0xa;this['strategy']=_0x1bf408[_0x7784('0x8')]||_0x7784('0x9');this[_0x7784('0xa')]=_0x1bf408[_0x7784('0xa')];this['mapAgentsId']={};this[_0x7784('0xb')]=0x0;this[_0x7784('0x1')]='';this[_0x7784('0xc')]();this[_0x7784('0xd')]();}MailQueue[_0x7784('0xe')]['updateRouting']=function(){var _0x2353a6=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x7784('0xf')](this['Agents'],'id');this[_0x7784('0x10')][_0x7784('0x11')]=_0x2353a6;};MailQueue[_0x7784('0xe')]['updateRealtime']=function(){this[_0x7784('0x12')]=0x0;this[_0x7784('0x13')]=0x0;for(var _0x36ee32=0x0;_0x36ee32=0x0?this[_0x7784('0x17')]:0x0;var _0x35ce10={'id':this['id'],'available':this[_0x7784('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7784('0x6')],'paused':this[_0x7784('0x13')],'waiting':this['waiting']};var _0x484fae=md5(JSON[_0x7784('0x18')](_0x35ce10));if(this[_0x7784('0x1')]!==_0x484fae){this['md5']=_0x484fae;io['to'](util[_0x7784('0x19')]('mail:queue:%s',_0x35ce10[_0x7784('0x6')]))[_0x7784('0x1a')](_0x7784('0x1b'),_0x35ce10);}};module[_0x7784('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 013d3ed..0416888 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 _0x68e6=['lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','loggedIn','length','online','paused','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4e6472,_0x5b8cee){var _0x3aa423=function(_0x403de9){while(--_0x403de9){_0x4e6472['push'](_0x4e6472['shift']());}};_0x3aa423(++_0x5b8cee);}(_0x68e6,0xea));var _0x668e=function(_0x1b8f6f,_0x3dacc0){_0x1b8f6f=_0x1b8f6f-0x0;var _0x15410d=_0x68e6[_0x1b8f6f];return _0x15410d;};'use strict';var _=require(_0x668e('0x0'));var md5=require('md5');var util=require(_0x668e('0x1'));var Redis=require(_0x668e('0x2'));var config=require(_0x668e('0x3'));config[_0x668e('0x4')]=_[_0x668e('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x668e('0x6'))(new Redis(config[_0x668e('0x4')]));function OpenchannelQueue(_0x217cbc){this['id']=_0x217cbc['id']||0x0;this[_0x668e('0x7')]=_0x217cbc[_0x668e('0x7')]||'';this[_0x668e('0x8')]=_0x217cbc[_0x668e('0x8')]||0xa;this[_0x668e('0x9')]=_0x217cbc[_0x668e('0x9')]||_0x668e('0xa');this[_0x668e('0xb')]=_0x217cbc['Agents'];this[_0x668e('0xc')]={};this[_0x668e('0xd')]=0x0;this[_0x668e('0xe')]='';this[_0x668e('0xf')]();this['updateRealtime']();}OpenchannelQueue[_0x668e('0x10')]['updateRouting']=function(){var _0x433f22=this['mapAgentsId'][_0x668e('0x11')];this[_0x668e('0xc')]=_['map'](this['Agents'],'id');this[_0x668e('0xc')][_0x668e('0x11')]=_0x433f22;};OpenchannelQueue[_0x668e('0x10')]['updateRealtime']=function(){this[_0x668e('0x12')]=0x0;this['paused']=0x0;for(var _0x4c88f2=0x0;_0x4c88f2=0x0?this[_0x668e('0x16')]:0x0;var _0x3ee619={'id':this['id'],'available':this[_0x668e('0x16')],'loggedIn':this[_0x668e('0x12')],'name':this['name'],'paused':this[_0x668e('0x15')],'waiting':this[_0x668e('0xd')]};var _0x40e1f2=md5(JSON[_0x668e('0x17')](_0x3ee619));if(this[_0x668e('0xe')]!==_0x40e1f2){this['md5']=_0x40e1f2;io['to'](util['format'](_0x668e('0x18'),_0x3ee619['name']))['emit'](_0x668e('0x19'),_0x3ee619);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x60e5=['md5','updateRealtime','updateRouting','mapAgentsId','Agents','_rr','length','online','loggedIn','openchannelPause','paused','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','waiting'];(function(_0x1ffd47,_0x33f9ad){var _0x5f3d74=function(_0x3e2ef7){while(--_0x3e2ef7){_0x1ffd47['push'](_0x1ffd47['shift']());}};_0x5f3d74(++_0x33f9ad);}(_0x60e5,0x197));var _0x560e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x60e5[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x560e('0x0'));var md5=require('md5');var util=require(_0x560e('0x1'));var Redis=require(_0x560e('0x2'));var config=require(_0x560e('0x3'));config['redis']=_[_0x560e('0x4')](config['redis'],{'host':_0x560e('0x5'),'port':0x18eb});var io=require(_0x560e('0x6'))(new Redis(config[_0x560e('0x7')]));function OpenchannelQueue(_0x2aabdc){this['id']=_0x2aabdc['id']||0x0;this[_0x560e('0x8')]=_0x2aabdc['name']||'';this[_0x560e('0x9')]=_0x2aabdc['timeout']||0xa;this['strategy']=_0x2aabdc[_0x560e('0xa')]||_0x560e('0xb');this['Agents']=_0x2aabdc['Agents'];this['mapAgentsId']={};this[_0x560e('0xc')]=0x0;this[_0x560e('0xd')]='';this['updateRouting']();this[_0x560e('0xe')]();}OpenchannelQueue['prototype'][_0x560e('0xf')]=function(){var _0x3ba902=this['mapAgentsId']['_rr'];this[_0x560e('0x10')]=_['map'](this[_0x560e('0x11')],'id');this[_0x560e('0x10')][_0x560e('0x12')]=_0x3ba902;};OpenchannelQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3604c2=0x0;_0x3604c2=0x0?this[_0x560e('0x18')]:0x0;var _0x26e687={'id':this['id'],'available':this[_0x560e('0x18')],'loggedIn':this[_0x560e('0x15')],'name':this[_0x560e('0x8')],'paused':this[_0x560e('0x17')],'waiting':this[_0x560e('0xc')]};var _0x3f6416=md5(JSON[_0x560e('0x19')](_0x26e687));if(this[_0x560e('0xd')]!==_0x3f6416){this[_0x560e('0xd')]=_0x3f6416;io['to'](util[_0x560e('0x1a')](_0x560e('0x1b'),_0x26e687[_0x560e('0x8')]))[_0x560e('0x1c')](_0x560e('0x1d'),_0x26e687);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 262717c..a8fe4af 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 _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x35a59c,_0x3c08ef){var _0x11bf0e=function(_0x154cec){while(--_0x154cec){_0x35a59c['push'](_0x35a59c['shift']());}};_0x11bf0e(++_0x3c08ef);}(_0x757a,0xde));var _0xa757=function(_0x1aabca,_0x235007){_0x1aabca=_0x1aabca-0x0;var _0x3ba211=_0x757a[_0x1aabca];return _0x3ba211;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7d19aef..b001138 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 _0x79fa=['map','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x79fa,0xfa));var _0xa79f=function(_0x5ef352,_0x28d288){_0x5ef352=_0x5ef352-0x0;var _0x2abc83=_0x79fa[_0x5ef352];return _0x2abc83;};'use strict';var _=require(_0xa79f('0x0'));var md5=require('md5');var util=require(_0xa79f('0x1'));var Redis=require(_0xa79f('0x2'));var config=require(_0xa79f('0x3'));config['redis']=_[_0xa79f('0x4')](config[_0xa79f('0x5')],{'host':_0xa79f('0x6'),'port':0x18eb});var io=require(_0xa79f('0x7'))(new Redis(config[_0xa79f('0x5')]));function WhatsappQueue(_0x54af9b){this['id']=_0x54af9b['id']||0x0;this[_0xa79f('0x8')]=_0x54af9b[_0xa79f('0x8')]||'';this['timeout']=_0x54af9b[_0xa79f('0x9')]||0xa;this['strategy']=_0x54af9b[_0xa79f('0xa')]||_0xa79f('0xb');this[_0xa79f('0xc')]=_0x54af9b[_0xa79f('0xc')];this[_0xa79f('0xd')]={};this[_0xa79f('0xe')]=0x0;this[_0xa79f('0xf')]='';this[_0xa79f('0x10')]();this[_0xa79f('0x11')]();}WhatsappQueue[_0xa79f('0x12')][_0xa79f('0x10')]=function(){var _0x1e4a93=this[_0xa79f('0xd')][_0xa79f('0x13')];this[_0xa79f('0xd')]=_[_0xa79f('0x14')](this[_0xa79f('0xc')],'id');this['mapAgentsId']['_rr']=_0x1e4a93;};WhatsappQueue[_0xa79f('0x12')][_0xa79f('0x11')]=function(){this[_0xa79f('0x15')]=0x0;this[_0xa79f('0x16')]=0x0;for(var _0x488e39=0x0;_0x488e39=0x0?this[_0xa79f('0x19')]:0x0;var _0x3c6a3a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa79f('0x8')],'paused':this[_0xa79f('0x16')],'waiting':this[_0xa79f('0xe')]};var _0x412cef=md5(JSON[_0xa79f('0x1a')](_0x3c6a3a));if(this[_0xa79f('0xf')]!==_0x412cef){this['md5']=_0x412cef;io['to'](util[_0xa79f('0x1b')](_0xa79f('0x1c'),_0x3c6a3a['name']))['emit']('whatsapp_queue:save',_0x3c6a3a);}};module[_0xa79f('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xc7bd=['paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn'];(function(_0x3bd208,_0x3a59c2){var _0x97a34f=function(_0x55cb80){while(--_0x55cb80){_0x3bd208['push'](_0x3bd208['shift']());}};_0x97a34f(++_0x3a59c2);}(_0xc7bd,0x115));var _0xdc7b=function(_0x5bdf55,_0x770947){_0x5bdf55=_0x5bdf55-0x0;var _0x536329=_0xc7bd[_0x5bdf55];return _0x536329;};'use strict';var _=require(_0xdc7b('0x0'));var md5=require('md5');var util=require(_0xdc7b('0x1'));var Redis=require(_0xdc7b('0x2'));var config=require('../../../config/environment');config[_0xdc7b('0x3')]=_[_0xdc7b('0x4')](config[_0xdc7b('0x3')],{'host':_0xdc7b('0x5'),'port':0x18eb});var io=require(_0xdc7b('0x6'))(new Redis(config[_0xdc7b('0x3')]));function WhatsappQueue(_0x4e9652){this['id']=_0x4e9652['id']||0x0;this[_0xdc7b('0x7')]=_0x4e9652['name']||'';this[_0xdc7b('0x8')]=_0x4e9652[_0xdc7b('0x8')]||0xa;this[_0xdc7b('0x9')]=_0x4e9652[_0xdc7b('0x9')]||_0xdc7b('0xa');this[_0xdc7b('0xb')]=_0x4e9652[_0xdc7b('0xb')];this['mapAgentsId']={};this[_0xdc7b('0xc')]=0x0;this[_0xdc7b('0xd')]='';this['updateRouting']();this[_0xdc7b('0xe')]();}WhatsappQueue[_0xdc7b('0xf')][_0xdc7b('0x10')]=function(){var _0x19fd3c=this['mapAgentsId'][_0xdc7b('0x11')];this['mapAgentsId']=_[_0xdc7b('0x12')](this[_0xdc7b('0xb')],'id');this['mapAgentsId'][_0xdc7b('0x11')]=_0x19fd3c;};WhatsappQueue['prototype'][_0xdc7b('0xe')]=function(){this[_0xdc7b('0x13')]=0x0;this[_0xdc7b('0x14')]=0x0;for(var _0x10e7b4=0x0;_0x10e7b4=0x0?this[_0xdc7b('0x18')]:0x0;var _0x1865b5={'id':this['id'],'available':this[_0xdc7b('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xdc7b('0x7')],'paused':this[_0xdc7b('0x14')],'waiting':this[_0xdc7b('0xc')]};var _0xc976d5=md5(JSON['stringify'](_0x1865b5));if(this['md5']!==_0xc976d5){this[_0xdc7b('0xd')]=_0xc976d5;io['to'](util[_0xdc7b('0x19')](_0xdc7b('0x1a'),_0x1865b5[_0xdc7b('0x7')]))['emit']('whatsapp_queue:save',_0x1865b5);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 798f30a..c5f503e 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 _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x1cb9,0x14e));var _0x91cb=function(_0xdd64fd,_0x163e58){_0xdd64fd=_0xdd64fd-0x0;var _0x282b4c=_0x1cb9[_0xdd64fd];return _0x282b4c;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file +var _0xe14b=['initMailQueues','mailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','../model/agent','../model/interval','../model/chatQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues'];(function(_0x175e3f,_0x427787){var _0x1ba866=function(_0x4576df){while(--_0x4576df){_0x175e3f['push'](_0x175e3f['shift']());}};_0x1ba866(++_0x427787);}(_0xe14b,0x93));var _0xbe14=function(_0x528bac,_0x2f1aef){_0x528bac=_0x528bac-0x0;var _0x5ba7c9=_0xe14b[_0x528bac];return _0x5ba7c9;};'use strict';var BPromise=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xbe14('0x2'));var Interval=require(_0xbe14('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xbe14('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xbe14('0x5'));var WhatsappQueue=require(_0xbe14('0x6'));var Realtime=function(){this[_0xbe14('0x7')]={};this[_0xbe14('0x8')]={};this[_0xbe14('0x9')]={};this[_0xbe14('0xa')]={};this[_0xbe14('0xb')]={};this['mailQueues']={};this['faxQueues']={};this['whatsappQueues']={};this[_0xbe14('0xc')]={};this[_0xbe14('0xd')]={};this[_0xbe14('0xe')]={};this[_0xbe14('0xf')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x113243,_0x3f70cb,_0x4935cc){var _0x254c3b=_[_0xbe14('0x10')](_0x113243,function(_0x886a5e,_0x3d38c2){return _0x886a5e[_0x4935cc];});for(var _0x27792f in _0x3f70cb){if(_0x3f70cb[_0xbe14('0x11')](_0x27792f)){if(!_0x254c3b[_0x27792f]){delete _0x3f70cb[_0x27792f];}}}}Realtime[_0xbe14('0x12')][_0xbe14('0x13')]=function(_0x16893f,_0xa2cf72){for(var _0x1e4826 in _0xa2cf72){if(_0x16893f[_0xbe14('0x11')](_0x1e4826)){_0x16893f[_0x1e4826]=_0xa2cf72[_0x1e4826];}}};Realtime[_0xbe14('0x12')]['initAgents']=function(){var _0x55b3a7=this;return function(_0x3f58f5){if(_0x3f58f5){freeIsNotKey(_0x3f58f5,_0x55b3a7[_0xbe14('0x7')],'id');for(var _0xf4ac9=0x0,_0x37ce4e={},_0x4e8f34={};_0xf4ac9<_0x3f58f5[_0xbe14('0x14')];_0xf4ac9+=0x1){_0x37ce4e=_0x3f58f5[_0xf4ac9];if(_[_0xbe14('0x15')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']])){_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']]=new Agent(_0x37ce4e);}else{_0x55b3a7[_0xbe14('0x13')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']],_0x37ce4e);}}}return _0x55b3a7[_0xbe14('0x7')];};};Realtime['prototype'][_0xbe14('0x16')]=function(){var _0x456ca8=this;return function(_0x329588){if(_0x329588){freeIsNotKey(_0x329588,_0x456ca8[_0xbe14('0x8')],'id');for(var _0x3249da=0x0,_0x37e4c1={},_0x59a9e3={};_0x3249da<_0x329588[_0xbe14('0x14')];_0x3249da+=0x1){_0x37e4c1=_0x329588[_0x3249da];if(_[_0xbe14('0x15')](_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']])){_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']]=new Interval(_0x37e4c1);}else{_0x456ca8[_0xbe14('0x13')](_0x456ca8['intervals'][_0x37e4c1['id']],_0x37e4c1);}}}return _0x456ca8[_0xbe14('0x8')];};};Realtime['prototype'][_0xbe14('0x17')]=function(){var _0x56e80c=this;return function(_0x32e8eb){if(_0x32e8eb){freeIsNotKey(_0x32e8eb,_0x56e80c['openchannelQueues'],'id');for(var _0x274018=0x0,_0x3d3608={},_0x505dbd={};_0x274018<_0x32e8eb[_0xbe14('0x14')];_0x274018+=0x1){_0x3d3608=_0x32e8eb[_0x274018];if(_['isUndefined'](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']])){_0x56e80c['openchannelQueues'][_0x3d3608['id']]=new OpenchannelQueue(_0x3d3608);}else{_0x56e80c[_0xbe14('0x13')](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']],_0x3d3608);}_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x18')]();_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x19')]();}}return _0x56e80c['openchannelQueues'];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1a')]=function(){var _0x391556=this;return function(_0x169369){if(_0x169369){freeIsNotKey(_0x169369,_0x391556['chatQueues'],'id');for(var _0x16f884=0x0,_0x29fc64={},_0x59bf34={};_0x16f884<_0x169369[_0xbe14('0x14')];_0x16f884+=0x1){_0x29fc64=_0x169369[_0x16f884];if(_[_0xbe14('0x15')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']])){_0x391556[_0xbe14('0xa')][_0x29fc64['id']]=new ChatQueue(_0x29fc64);}else{_0x391556[_0xbe14('0x13')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']],_0x29fc64);}_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x18')]();_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x19')]();}}return _0x391556[_0xbe14('0xa')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1b')]=function(){var _0x10ae36=this;return function(_0x223f7a){if(_0x223f7a){freeIsNotKey(_0x223f7a,_0x10ae36[_0xbe14('0xb')],'id');for(var _0x6ba36c=0x0,_0x2ff48e={},_0x29e76a={};_0x6ba36c<_0x223f7a[_0xbe14('0x14')];_0x6ba36c+=0x1){_0x2ff48e=_0x223f7a[_0x6ba36c];if(_['isUndefined'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']])){_0x10ae36['smsQueues'][_0x2ff48e['id']]=new SmsQueue(_0x2ff48e);}else{_0x10ae36['mergeFromDatabase'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']],_0x2ff48e);}_0x10ae36['smsQueues'][_0x2ff48e['id']][_0xbe14('0x18')]();_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']]['updateRealtime']();}}return _0x10ae36['smsQueues'];};};Realtime['prototype'][_0xbe14('0x1c')]=function(){var _0xa3d24=this;return function(_0x5f27b6){if(_0x5f27b6){freeIsNotKey(_0x5f27b6,_0xa3d24[_0xbe14('0x1d')],'id');for(var _0x1faf3e=0x0,_0x452635={},_0x1aa849={};_0x1faf3e<_0x5f27b6[_0xbe14('0x14')];_0x1faf3e+=0x1){_0x452635=_0x5f27b6[_0x1faf3e];if(_['isUndefined'](_0xa3d24['mailQueues'][_0x452635['id']])){_0xa3d24[_0xbe14('0x1d')][_0x452635['id']]=new MailQueue(_0x452635);}else{_0xa3d24['mergeFromDatabase'](_0xa3d24['mailQueues'][_0x452635['id']],_0x452635);}_0xa3d24['mailQueues'][_0x452635['id']][_0xbe14('0x18')]();_0xa3d24[_0xbe14('0x1d')][_0x452635['id']][_0xbe14('0x19')]();}}return _0xa3d24[_0xbe14('0x1d')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1e')]=function(){var _0xcdc50=this;return function(_0x10ec3c){if(_0x10ec3c){freeIsNotKey(_0x10ec3c,_0xcdc50[_0xbe14('0x1f')],'id');for(var _0x2dfd5a=0x0,_0x41652d={},_0x32c59d={};_0x2dfd5a<_0x10ec3c['length'];_0x2dfd5a+=0x1){_0x41652d=_0x10ec3c[_0x2dfd5a];if(_['isUndefined'](_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']])){_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']]=new FaxQueue(_0x41652d);}else{_0xcdc50[_0xbe14('0x13')](_0xcdc50['faxQueues'][_0x41652d['id']],_0x41652d);}_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x18')]();_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x19')]();}}return _0xcdc50[_0xbe14('0x1f')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x20')]=function(){var _0x128843=this;return function(_0x1b2608){if(_0x1b2608){freeIsNotKey(_0x1b2608,_0x128843['whatsappQueues'],'id');for(var _0xe51424=0x0,_0x841b71={},_0x3463c4={};_0xe51424<_0x1b2608[_0xbe14('0x14')];_0xe51424+=0x1){_0x841b71=_0x1b2608[_0xe51424];if(_[_0xbe14('0x15')](_0x128843[_0xbe14('0x21')][_0x841b71['id']])){_0x128843['whatsappQueues'][_0x841b71['id']]=new WhatsappQueue(_0x841b71);}else{_0x128843[_0xbe14('0x13')](_0x128843[_0xbe14('0x21')][_0x841b71['id']],_0x841b71);}_0x128843[_0xbe14('0x21')][_0x841b71['id']][_0xbe14('0x18')]();_0x128843['whatsappQueues'][_0x841b71['id']]['updateRealtime']();}}return _0x128843[_0xbe14('0x21')];};};module[_0xbe14('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index caf374e..ea5f8d4 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 _0x1b17=['UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x181a71,_0x537203){var _0x3e33aa=function(_0x2b5f07){while(--_0x2b5f07){_0x181a71['push'](_0x181a71['shift']());}};_0x3e33aa(++_0x537203);}(_0x1b17,0x8e));var _0x71b1=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0x1b17[_0xd2f4ac];return _0x9757b2;};'use strict';var client=require(_0x71b1('0x0'));exports['update']=function(_0x381c02,_0x1fd347){return client[_0x71b1('0x1')](_0x71b1('0x2'),{'body':_0x1fd347,'options':{'where':{'id':_0x381c02}},'log':_0x71b1('0x3')});};exports['addTags']=function(_0x5ef1a6,_0x3d9aac){return client['Request'](_0x71b1('0x4'),{'body':_0x3d9aac,'options':{'where':{'id':_0x5ef1a6}},'log':_0x71b1('0x5')});}; \ No newline at end of file +var _0xd850=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x4248e9,_0x19f4bc){var _0x4a26af=function(_0x4fa24a){while(--_0x4fa24a){_0x4248e9['push'](_0x4248e9['shift']());}};_0x4a26af(++_0x19f4bc);}(_0xd850,0x127));var _0x0d85=function(_0x128a9c,_0x1370e6){_0x128a9c=_0x128a9c-0x0;var _0x3a5ba6=_0xd850[_0x128a9c];return _0x3a5ba6;};'use strict';var client=require(_0x0d85('0x0'));exports[_0x0d85('0x1')]=function(_0x2c7847,_0x158976){return client[_0x0d85('0x2')](_0x0d85('0x3'),{'body':_0x158976,'options':{'where':{'id':_0x2c7847}},'log':_0x0d85('0x4')});};exports[_0x0d85('0x5')]=function(_0x57f5ab,_0x2cb5c7){return client[_0x0d85('0x2')](_0x0d85('0x6'),{'body':_0x2cb5c7,'options':{'where':{'id':_0x57f5ab}},'log':_0x0d85('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e53a3ad..9b789d2 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 _0x541e=['create','createChatMessage'];(function(_0xacff68,_0x2dbbdb){var _0x3bd807=function(_0x4a54a6){while(--_0x4a54a6){_0xacff68['push'](_0xacff68['shift']());}};_0x3bd807(++_0x2dbbdb);}(_0x541e,0x118));var _0xe541=function(_0x225ed0,_0x4588f0){_0x225ed0=_0x225ed0-0x0;var _0x251288=_0x541e[_0x225ed0];return _0x251288;};'use strict';var client=require('../client');exports[_0xe541('0x0')]=function(_0x451baa){return client['Request']('CreateChatMessage',{'body':_0x451baa,'log':_0xe541('0x1')});}; \ No newline at end of file +var _0x5178=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x1357be,_0x2947ed){var _0x338882=function(_0x66f99c){while(--_0x66f99c){_0x1357be['push'](_0x1357be['shift']());}};_0x338882(++_0x2947ed);}(_0x5178,0x149));var _0x8517=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5178[_0x1facfa];return _0x9ec701;};'use strict';var client=require('../client');exports[_0x8517('0x0')]=function(_0x1e482c){return client[_0x8517('0x1')](_0x8517('0x2'),{'body':_0x1e482c,'log':_0x8517('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a4f0dd7..2fb2b06 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 _0xcaa3=['chatPause','getChatQueues','name','timeout','strategy','Agents','online'];(function(_0x2e7582,_0x1a1cda){var _0x1c24b8=function(_0x4034e7){while(--_0x4034e7){_0x2e7582['push'](_0x2e7582['shift']());}};_0x1c24b8(++_0x1a1cda);}(_0xcaa3,0x6a));var _0x3caa=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xcaa3[_0x540133];return _0x26b6e9;};'use strict';var client=require('../client');exports[_0x3caa('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x3caa('0x1'),_0x3caa('0x2'),_0x3caa('0x3')],'include':[{'model':'User','as':_0x3caa('0x4'),'attributes':['id','name',_0x3caa('0x5'),_0x3caa('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x0210=['online','chatPause','../client','getChatQueues','Request','User','Agents'];(function(_0x14b3fa,_0x2112ab){var _0x21319d=function(_0x5df354){while(--_0x5df354){_0x14b3fa['push'](_0x14b3fa['shift']());}};_0x21319d(++_0x2112ab);}(_0x0210,0x136));var _0x0021=function(_0x3da6d1,_0x3f53a){_0x3da6d1=_0x3da6d1-0x0;var _0xfff18c=_0x0210[_0x3da6d1];return _0xfff18c;};'use strict';var client=require(_0x0021('0x0'));exports[_0x0021('0x1')]=function(){return function(){return client[_0x0021('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x0021('0x3'),'as':_0x0021('0x4'),'attributes':['id','name',_0x0021('0x5'),_0x0021('0x6')]}]},'log':_0x0021('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index feccb94..8f865a8 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 _0xf822=['../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x536c5b,_0x2d2e76){var _0xd78870=function(_0x2b9b68){while(--_0x2b9b68){_0x536c5b['push'](_0x536c5b['shift']());}};_0xd78870(++_0x2d2e76);}(_0xf822,0x19e));var _0x2f82=function(_0x24ba6,_0x51e338){_0x24ba6=_0x24ba6-0x0;var _0x3d6acb=_0xf822[_0x24ba6];return _0x3d6acb;};'use strict';var client=require(_0x2f82('0x0'));exports['create']=function(_0xef5887){return client[_0x2f82('0x1')](_0x2f82('0x2'),{'body':_0xef5887,'log':_0x2f82('0x2')});};exports[_0x2f82('0x3')]=function(_0x260206,_0x48a05c){return client[_0x2f82('0x1')](_0x2f82('0x4'),{'body':_0x48a05c,'options':{'where':{'uniqueid':_0x260206},'order':[['id',_0x2f82('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x90ae=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x162f62,_0x3a9bfb){var _0x2157b3=function(_0x2e50fc){while(--_0x2e50fc){_0x162f62['push'](_0x162f62['shift']());}};_0x2157b3(++_0x3a9bfb);}(_0x90ae,0x195));var _0xe90a=function(_0x524269,_0x4353eb){_0x524269=_0x524269-0x0;var _0x79c72d=_0x90ae[_0x524269];return _0x79c72d;};'use strict';var client=require(_0xe90a('0x0'));exports[_0xe90a('0x1')]=function(_0x384758){return client['Request'](_0xe90a('0x2'),{'body':_0x384758,'log':_0xe90a('0x2')});};exports[_0xe90a('0x3')]=function(_0xcb31b6,_0x2b677c){return client[_0xe90a('0x4')](_0xe90a('0x5'),{'body':_0x2b677c,'options':{'where':{'uniqueid':_0xcb31b6},'order':[['id',_0xe90a('0x6')]],'limit':0x1},'log':_0xe90a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 923c2b4..8ebdfde 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 _0xf5c8=['../client','update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x7d59e2,_0x5ddd0b){var _0x34e7a7=function(_0x523d1f){while(--_0x523d1f){_0x7d59e2['push'](_0x7d59e2['shift']());}};_0x34e7a7(++_0x5ddd0b);}(_0xf5c8,0x12c));var _0x8f5c=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xf5c8[_0x172747];return _0x509692;};'use strict';var client=require(_0x8f5c('0x0'));exports[_0x8f5c('0x1')]=function(_0x502f0e,_0x4ac2f8){return client[_0x8f5c('0x2')](_0x8f5c('0x3'),{'body':_0x4ac2f8,'options':{'where':{'id':_0x502f0e}},'log':_0x8f5c('0x4')});};exports[_0x8f5c('0x5')]=function(_0x42c610,_0x29a075){return client['Request']('AddTagsToFaxInteraction',{'body':_0x29a075,'options':{'where':{'id':_0x42c610}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x0de3=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0de3,0x137));var _0x30de=function(_0x623c4,_0xbf74ca){_0x623c4=_0x623c4-0x0;var _0x433fb2=_0x0de3[_0x623c4];return _0x433fb2;};'use strict';var client=require(_0x30de('0x0'));exports[_0x30de('0x1')]=function(_0x88d483,_0x363184){return client[_0x30de('0x2')](_0x30de('0x3'),{'body':_0x363184,'options':{'where':{'id':_0x88d483}},'log':_0x30de('0x4')});};exports[_0x30de('0x5')]=function(_0x21fe62,_0x37e746){return client['Request'](_0x30de('0x6'),{'body':_0x37e746,'options':{'where':{'id':_0x21fe62}},'log':_0x30de('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 5ca42a7..af41402 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 _0xc26a=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x156b06,_0x218402){var _0xff667e=function(_0x2bfddd){while(--_0x2bfddd){_0x156b06['push'](_0x156b06['shift']());}};_0xff667e(++_0x218402);}(_0xc26a,0xce));var _0xac26=function(_0x749614,_0x9c4b56){_0x749614=_0x749614-0x0;var _0x4cacdf=_0xc26a[_0x749614];return _0x4cacdf;};'use strict';var client=require('../client');exports[_0xac26('0x0')]=function(_0x531caf){return client[_0xac26('0x1')](_0xac26('0x2'),{'body':_0x531caf,'log':_0xac26('0x3')});}; \ No newline at end of file +var _0x36a7=['create','CreateFaxMessage','../client'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x36a7,0x17f));var _0x736a=function(_0x27aed8,_0x230fc1){_0x27aed8=_0x27aed8-0x0;var _0x574952=_0x36a7[_0x27aed8];return _0x574952;};'use strict';var client=require(_0x736a('0x0'));exports[_0x736a('0x1')]=function(_0x4eeb30){return client['Request'](_0x736a('0x2'),{'body':_0x4eeb30,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2d359a6..4129c5f 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 _0xb462=['name','timeout','strategy','Agents','online','faxPause','../client','getFaxQueues'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xb462,0x1ae));var _0x2b46=function(_0x1dac39,_0x564e64){_0x1dac39=_0x1dac39-0x0;var _0xe19468=_0xb462[_0x1dac39];return _0xe19468;};'use strict';var client=require(_0x2b46('0x0'));exports[_0x2b46('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x2b46('0x2'),_0x2b46('0x3'),_0x2b46('0x4')],'include':[{'model':'User','as':_0x2b46('0x5'),'attributes':['id',_0x2b46('0x2'),_0x2b46('0x6'),_0x2b46('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x4f42=['getFaxQueues','Request','GetFaxQueue','name','timeout','User','online','faxPause','../client'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x4f42,0x167));var _0x24f4=function(_0x5d3b00,_0x1eb66f){_0x5d3b00=_0x5d3b00-0x0;var _0x5813e8=_0x4f42[_0x5d3b00];return _0x5813e8;};'use strict';var client=require(_0x24f4('0x0'));exports[_0x24f4('0x1')]=function(){return function(){return client[_0x24f4('0x2')](_0x24f4('0x3'),{'options':{'raw':![],'attributes':['id',_0x24f4('0x4'),_0x24f4('0x5'),'strategy'],'include':[{'model':_0x24f4('0x6'),'as':'Agents','attributes':['id',_0x24f4('0x4'),_0x24f4('0x7'),_0x24f4('0x8')]}]},'log':_0x24f4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0af9bf5..dd45c9d 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 _0xf1a2=['update','UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf1a2,0x15f));var _0x2f1a=function(_0x218655,_0x3dfeda){_0x218655=_0x218655-0x0;var _0xa674d2=_0xf1a2[_0x218655];return _0xa674d2;};'use strict';var client=require(_0x2f1a('0x0'));exports['create']=function(_0x1cc940){return client[_0x2f1a('0x1')]('CreateFaxQueueReport',{'body':_0x1cc940,'log':_0x2f1a('0x2')});};exports[_0x2f1a('0x3')]=function(_0x5252aa,_0x29366c){return client['Request'](_0x2f1a('0x4'),{'body':_0x29366c,'options':{'where':{'uniqueid':_0x5252aa},'order':[['id',_0x2f1a('0x5')]],'limit':0x1},'log':_0x2f1a('0x4')});}; \ No newline at end of file +var _0x0a9e=['update','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x0a9e,0x1c5));var _0xe0a9=function(_0x25aa24,_0x47fe6b){_0x25aa24=_0x25aa24-0x0;var _0x947233=_0x0a9e[_0x25aa24];return _0x947233;};'use strict';var client=require(_0xe0a9('0x0'));exports[_0xe0a9('0x1')]=function(_0x2dd2ca){return client['Request'](_0xe0a9('0x2'),{'body':_0x2dd2ca,'log':_0xe0a9('0x2')});};exports[_0xe0a9('0x3')]=function(_0x5c7f2b,_0x106a6a){return client['Request'](_0xe0a9('0x4'),{'body':_0x106a6a,'options':{'where':{'uniqueid':_0x5c7f2b},'order':[['id',_0xe0a9('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 0565337..7bfc3b7 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 _0x9348=['getIntervals','Request','GetInterval','name','Intervals','../client'];(function(_0x27cf9b,_0x505a83){var _0x83ecc0=function(_0x48434e){while(--_0x48434e){_0x27cf9b['push'](_0x27cf9b['shift']());}};_0x83ecc0(++_0x505a83);}(_0x9348,0x10d));var _0x8934=function(_0x2e2e99,_0x536d56){_0x2e2e99=_0x2e2e99-0x0;var _0x37f788=_0x9348[_0x2e2e99];return _0x37f788;};'use strict';var client=require(_0x8934('0x0'));exports[_0x8934('0x1')]=function(){return function(){return client[_0x8934('0x2')](_0x8934('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8934('0x4')],'include':[{'model':'Interval','as':_0x8934('0x5'),'attributes':['id',_0x8934('0x4'),'interval']}]},'log':_0x8934('0x1')});};}; \ No newline at end of file +var _0xdd4f=['interval','getIntervals','../client','name','Interval'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xc4879e,_0x32fc57){_0xc4879e=_0xc4879e-0x0;var _0xcb113b=_0xdd4f[_0xc4879e];return _0xcb113b;};'use strict';var client=require(_0xfdd4('0x0'));exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfdd4('0x1')],'include':[{'model':_0xfdd4('0x2'),'as':'Intervals','attributes':['id',_0xfdd4('0x1'),_0xfdd4('0x3')]}]},'log':_0xfdd4('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 43bff23..79c94fb 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 _0x0fae=['updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x159468,_0x19e94c){var _0x2d9008=function(_0x4cc185){while(--_0x4cc185){_0x159468['push'](_0x159468['shift']());}};_0x2d9008(++_0x19e94c);}(_0x0fae,0x137));var _0xe0fa=function(_0x3aab6d,_0x4216bf){_0x3aab6d=_0x3aab6d-0x0;var _0x33fd3b=_0x0fae[_0x3aab6d];return _0x33fd3b;};'use strict';var client=require(_0xe0fa('0x0'));exports[_0xe0fa('0x1')]=function(_0x2f1e55,_0x3bc0cf){return client[_0xe0fa('0x2')](_0xe0fa('0x3'),{'body':_0x3bc0cf,'options':{'where':{'id':_0x2f1e55}},'log':_0xe0fa('0x4')});};exports['addTags']=function(_0x41cc37,_0x3a1d5a){return client[_0xe0fa('0x2')](_0xe0fa('0x5'),{'body':_0x3a1d5a,'options':{'where':{'id':_0x41cc37}},'log':_0xe0fa('0x6')});}; \ No newline at end of file +var _0x1a1d=['updateMailInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0x1a1d,0x150));var _0xd1a1=function(_0x46ec98,_0x1244ce){_0x46ec98=_0x46ec98-0x0;var _0x2680f0=_0x1a1d[_0x46ec98];return _0x2680f0;};'use strict';var client=require(_0xd1a1('0x0'));exports[_0xd1a1('0x1')]=function(_0x212937,_0x26a24a){return client[_0xd1a1('0x2')](_0xd1a1('0x3'),{'body':_0x26a24a,'options':{'where':{'id':_0x212937}},'log':_0xd1a1('0x4')});};exports['addTags']=function(_0x18430f,_0xa57b12){return client[_0xd1a1('0x2')]('AddTagsToMailInteraction',{'body':_0xa57b12,'options':{'where':{'id':_0x18430f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 8d1ff8d..c66bd1e 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 _0x85ac=['../client','create','Request','CreateMailMessage'];(function(_0x18bfdb,_0x241d43){var _0x44334c=function(_0x55e999){while(--_0x55e999){_0x18bfdb['push'](_0x18bfdb['shift']());}};_0x44334c(++_0x241d43);}(_0x85ac,0xa4));var _0xc85a=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x85ac[_0x279d37];return _0x530173;};'use strict';var client=require(_0xc85a('0x0'));exports[_0xc85a('0x1')]=function(_0x26c0ee){return client[_0xc85a('0x2')](_0xc85a('0x3'),{'body':_0x26c0ee,'log':'createMailMessage'});}; \ No newline at end of file +var _0xa4d6=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x7e3f06,_0x426f70){var _0x12b8ff=function(_0x47c83c){while(--_0x47c83c){_0x7e3f06['push'](_0x7e3f06['shift']());}};_0x12b8ff(++_0x426f70);}(_0xa4d6,0xd3));var _0x6a4d=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xa4d6[_0xef8146];return _0x5a6cb0;};'use strict';var client=require(_0x6a4d('0x0'));exports[_0x6a4d('0x1')]=function(_0x428a2e){return client['Request'](_0x6a4d('0x2'),{'body':_0x428a2e,'log':_0x6a4d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 08d8713..45b7b1a 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 _0x3cd7=['name','timeout','online','mailPause','getMailQueues','Request'];(function(_0xc27fdd,_0x429076){var _0x56adbc=function(_0x103a10){while(--_0x103a10){_0xc27fdd['push'](_0xc27fdd['shift']());}};_0x56adbc(++_0x429076);}(_0x3cd7,0x10c));var _0x73cd=function(_0x400dbc,_0x242e67){_0x400dbc=_0x400dbc-0x0;var _0xf0970f=_0x3cd7[_0x400dbc];return _0xf0970f;};'use strict';var client=require('../client');exports[_0x73cd('0x0')]=function(){return function(){return client[_0x73cd('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x73cd('0x2'),_0x73cd('0x3'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x73cd('0x4'),_0x73cd('0x5')]}]},'log':_0x73cd('0x0')});};}; \ No newline at end of file +var _0x9041=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','User','Agents','name'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0x9041,0x12b));var _0x1904=function(_0x1f2129,_0x37fed3){_0x1f2129=_0x1f2129-0x0;var _0x2bc546=_0x9041[_0x1f2129];return _0x2bc546;};'use strict';var client=require(_0x1904('0x0'));exports[_0x1904('0x1')]=function(){return function(){return client[_0x1904('0x2')](_0x1904('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x1904('0x4'),'as':_0x1904('0x5'),'attributes':['id',_0x1904('0x6'),_0x1904('0x7'),_0x1904('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e45e899..ec64aff 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 _0x0681=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x4be6c8,_0x4d62fd){var _0x5310f4=function(_0x617452){while(--_0x617452){_0x4be6c8['push'](_0x4be6c8['shift']());}};_0x5310f4(++_0x4d62fd);}(_0x0681,0x9f));var _0x1068=function(_0x5ad924,_0x3a0103){_0x5ad924=_0x5ad924-0x0;var _0x44ad27=_0x0681[_0x5ad924];return _0x44ad27;};'use strict';var client=require(_0x1068('0x0'));exports[_0x1068('0x1')]=function(_0x3b5701){return client[_0x1068('0x2')](_0x1068('0x3'),{'body':_0x3b5701,'log':_0x1068('0x3')});};exports[_0x1068('0x4')]=function(_0x55a82f,_0x2c65a2){return client[_0x1068('0x2')](_0x1068('0x5'),{'body':_0x2c65a2,'options':{'where':{'uniqueid':_0x55a82f},'order':[['id',_0x1068('0x6')]],'limit':0x1},'log':_0x1068('0x5')});}; \ No newline at end of file +var _0xcf28=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update'];(function(_0x33afd3,_0xcaf7bb){var _0x57b24b=function(_0x1fad4d){while(--_0x1fad4d){_0x33afd3['push'](_0x33afd3['shift']());}};_0x57b24b(++_0xcaf7bb);}(_0xcf28,0x106));var _0x8cf2=function(_0x174987,_0x2b5c76){_0x174987=_0x174987-0x0;var _0x544f5f=_0xcf28[_0x174987];return _0x544f5f;};'use strict';var client=require(_0x8cf2('0x0'));exports[_0x8cf2('0x1')]=function(_0x25b424){return client['Request']('CreateMailQueueReport',{'body':_0x25b424,'log':_0x8cf2('0x2')});};exports[_0x8cf2('0x3')]=function(_0x1f8848,_0x47fb4a){return client[_0x8cf2('0x4')](_0x8cf2('0x5'),{'body':_0x47fb4a,'options':{'where':{'uniqueid':_0x1f8848},'order':[['id',_0x8cf2('0x6')]],'limit':0x1},'log':_0x8cf2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f328d71..7adcffb 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 _0xddd1=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xddd1,0x176));var _0x1ddd=function(_0x4bd24a,_0x36f2b1){_0x4bd24a=_0x4bd24a-0x0;var _0x107837=_0xddd1[_0x4bd24a];return _0x107837;};'use strict';var client=require('../client');exports['update']=function(_0x58e5ea,_0x3cf203){return client[_0x1ddd('0x0')](_0x1ddd('0x1'),{'body':_0x3cf203,'options':{'where':{'id':_0x58e5ea}},'log':_0x1ddd('0x2')});};exports[_0x1ddd('0x3')]=function(_0x561348,_0x1a0a03){return client['Request'](_0x1ddd('0x4'),{'body':_0x1a0a03,'options':{'where':{'id':_0x561348}},'log':_0x1ddd('0x5')});}; \ No newline at end of file +var _0x0a86=['../client','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x1c2d2c,_0x3250ec){var _0x17da47=function(_0x285609){while(--_0x285609){_0x1c2d2c['push'](_0x1c2d2c['shift']());}};_0x17da47(++_0x3250ec);}(_0x0a86,0xa5));var _0x60a8=function(_0x295b1a,_0x1e31a){_0x295b1a=_0x295b1a-0x0;var _0x2bb42b=_0x0a86[_0x295b1a];return _0x2bb42b;};'use strict';var client=require(_0x60a8('0x0'));exports['update']=function(_0x206f03,_0x4a122c){return client[_0x60a8('0x1')]('UpdateOpenchannelInteraction',{'body':_0x4a122c,'options':{'where':{'id':_0x206f03}},'log':_0x60a8('0x2')});};exports[_0x60a8('0x3')]=function(_0x2d9fd5,_0x224904){return client[_0x60a8('0x1')](_0x60a8('0x4'),{'body':_0x224904,'options':{'where':{'id':_0x2d9fd5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 7071997..3d93cb7 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 _0x878f=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x4091b4,_0x287ca1){var _0x4d7f61=function(_0x1b7bfc){while(--_0x1b7bfc){_0x4091b4['push'](_0x4091b4['shift']());}};_0x4d7f61(++_0x287ca1);}(_0x878f,0x173));var _0xf878=function(_0x37a9ba,_0x2deb9e){_0x37a9ba=_0x37a9ba-0x0;var _0xdd2b0=_0x878f[_0x37a9ba];return _0xdd2b0;};'use strict';var client=require('../client');exports[_0xf878('0x0')]=function(_0x658976){return client[_0xf878('0x1')](_0xf878('0x2'),{'body':_0x658976,'log':_0xf878('0x3')});}; \ No newline at end of file +var _0x00bb=['CreateOpenchannelMessage','../client','create'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var client=require(_0xb00b('0x0'));exports[_0xb00b('0x1')]=function(_0x468a51){return client['Request'](_0xb00b('0x2'),{'body':_0x468a51,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8586af2..e64b0d9 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 _0x91ac=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','User','Agents','online'];(function(_0x741d93,_0x324edb){var _0x102ebb=function(_0x59b500){while(--_0x59b500){_0x741d93['push'](_0x741d93['shift']());}};_0x102ebb(++_0x324edb);}(_0x91ac,0x1d9));var _0xc91a=function(_0x46a581,_0x5cb898){_0x46a581=_0x46a581-0x0;var _0x102f89=_0x91ac[_0x46a581];return _0x102f89;};'use strict';var client=require('../client');exports[_0xc91a('0x0')]=function(){return function(){return client[_0xc91a('0x1')](_0xc91a('0x2'),{'options':{'raw':![],'attributes':['id',_0xc91a('0x3'),'timeout','strategy'],'include':[{'model':_0xc91a('0x4'),'as':_0xc91a('0x5'),'attributes':['id',_0xc91a('0x3'),_0xc91a('0x6'),_0xc91a('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x0759=['strategy','User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x0759,0xcc));var _0x9075=function(_0x54ba70,_0x4b2263){_0x54ba70=_0x54ba70-0x0;var _0xe61097=_0x0759[_0x54ba70];return _0xe61097;};'use strict';var client=require(_0x9075('0x0'));exports[_0x9075('0x1')]=function(){return function(){return client[_0x9075('0x2')](_0x9075('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9075('0x4'),_0x9075('0x5')],'include':[{'model':_0x9075('0x6'),'as':_0x9075('0x7'),'attributes':['id',_0x9075('0x8'),_0x9075('0x9'),_0x9075('0xa')]}]},'log':_0x9075('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7ba568d..2d41d32 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 _0xe0d8=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0xe0d8,0xa8));var _0x8e0d=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xe0d8[_0x48e1ec];return _0x3b33eb;};'use strict';var client=require(_0x8e0d('0x0'));exports['create']=function(_0x8ae639){return client[_0x8e0d('0x1')]('CreateOpenchannelQueueReport',{'body':_0x8ae639,'log':_0x8e0d('0x2')});};exports['update']=function(_0x526058,_0x50b9df){return client[_0x8e0d('0x1')](_0x8e0d('0x3'),{'body':_0x50b9df,'options':{'where':{'uniqueid':_0x526058},'order':[['id',_0x8e0d('0x4')]],'limit':0x1},'log':_0x8e0d('0x3')});}; \ No newline at end of file +var _0xeef8=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x85ed67,_0xbcd74b){var _0x3d8956=function(_0x46b6c5){while(--_0x46b6c5){_0x85ed67['push'](_0x85ed67['shift']());}};_0x3d8956(++_0xbcd74b);}(_0xeef8,0x174));var _0x8eef=function(_0x21ff29,_0x370c92){_0x21ff29=_0x21ff29-0x0;var _0x331f4a=_0xeef8[_0x21ff29];return _0x331f4a;};'use strict';var client=require('../client');exports[_0x8eef('0x0')]=function(_0x59a49e){return client[_0x8eef('0x1')](_0x8eef('0x2'),{'body':_0x59a49e,'log':_0x8eef('0x2')});};exports[_0x8eef('0x3')]=function(_0x3ad76d,_0xb66eed){return client['Request'](_0x8eef('0x4'),{'body':_0xb66eed,'options':{'where':{'uniqueid':_0x3ad76d},'order':[['id',_0x8eef('0x5')]],'limit':0x1},'log':_0x8eef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 535d62b..0a6aba4 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 _0x71f7=['UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0x71f7,0xbc));var _0x771f=function(_0x50e5a2,_0x343251){_0x50e5a2=_0x50e5a2-0x0;var _0x3cd677=_0x71f7[_0x50e5a2];return _0x3cd677;};'use strict';var client=require('../client');exports[_0x771f('0x0')]=function(_0x107522,_0x5d036b){return client['Request'](_0x771f('0x1'),{'body':_0x5d036b,'options':{'where':{'id':_0x107522}},'log':_0x771f('0x2')});};exports[_0x771f('0x3')]=function(_0x2f26ba,_0x5eded3){return client[_0x771f('0x4')](_0x771f('0x5'),{'body':_0x5eded3,'options':{'where':{'id':_0x2f26ba}},'log':_0x771f('0x6')});}; \ No newline at end of file +var _0x282f=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x282f,0x153));var _0xf282=function(_0x87953f,_0x582db0){_0x87953f=_0x87953f-0x0;var _0x5dca0f=_0x282f[_0x87953f];return _0x5dca0f;};'use strict';var client=require(_0xf282('0x0'));exports[_0xf282('0x1')]=function(_0x3472d9,_0x47f799){return client[_0xf282('0x2')]('UpdateSmsInteraction',{'body':_0x47f799,'options':{'where':{'id':_0x3472d9}},'log':_0xf282('0x3')});};exports[_0xf282('0x4')]=function(_0x2e2120,_0x25abc7){return client['Request'](_0xf282('0x5'),{'body':_0x25abc7,'options':{'where':{'id':_0x2e2120}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3b705d5..c0eb10e 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 _0x39b0=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x5804c1,_0x326a16){var _0x4231e8=function(_0x47ce95){while(--_0x47ce95){_0x5804c1['push'](_0x5804c1['shift']());}};_0x4231e8(++_0x326a16);}(_0x39b0,0x152));var _0x039b=function(_0xd081f2,_0x583bc0){_0xd081f2=_0xd081f2-0x0;var _0x5eaf54=_0x39b0[_0xd081f2];return _0x5eaf54;};'use strict';var client=require(_0x039b('0x0'));exports[_0x039b('0x1')]=function(_0x2fa3f6){return client[_0x039b('0x2')](_0x039b('0x3'),{'body':_0x2fa3f6,'log':_0x039b('0x4')});}; \ No newline at end of file +var _0xd847=['Request','../client','create'];(function(_0x4f9a38,_0x3b68d7){var _0xa2d8c5=function(_0x508976){while(--_0x508976){_0x4f9a38['push'](_0x4f9a38['shift']());}};_0xa2d8c5(++_0x3b68d7);}(_0xd847,0x18a));var _0x7d84=function(_0x20f4af,_0x4163e6){_0x20f4af=_0x20f4af-0x0;var _0x20b7ed=_0xd847[_0x20f4af];return _0x20b7ed;};'use strict';var client=require(_0x7d84('0x0'));exports[_0x7d84('0x1')]=function(_0x3e5e53){return client[_0x7d84('0x2')]('CreateSmsMessage',{'body':_0x3e5e53,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index da297ee..16f0d9d 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 _0x351b=['getSmsQueues','GetSmsQueue','name','timeout','strategy','Agents','smsPause','../client'];(function(_0x15c86f,_0x33d4f7){var _0x3c5897=function(_0x234f91){while(--_0x234f91){_0x15c86f['push'](_0x15c86f['shift']());}};_0x3c5897(++_0x33d4f7);}(_0x351b,0xcf));var _0xb351=function(_0x28de52,_0x25b2b4){_0x28de52=_0x28de52-0x0;var _0x268cff=_0x351b[_0x28de52];return _0x268cff;};'use strict';var client=require(_0xb351('0x0'));exports[_0xb351('0x1')]=function(){return function(){return client['Request'](_0xb351('0x2'),{'options':{'raw':![],'attributes':['id',_0xb351('0x3'),_0xb351('0x4'),_0xb351('0x5')],'include':[{'model':'User','as':_0xb351('0x6'),'attributes':['id',_0xb351('0x3'),'online',_0xb351('0x7')]}]},'log':_0xb351('0x1')});};}; \ No newline at end of file +var _0xdbb9=['name','strategy','User','Agents','online','smsPause','getSmsQueues','Request','GetSmsQueue'];(function(_0x23684f,_0x560771){var _0x59d314=function(_0x5dadff){while(--_0x5dadff){_0x23684f['push'](_0x23684f['shift']());}};_0x59d314(++_0x560771);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x462574,_0x4d2bb2){_0x462574=_0x462574-0x0;var _0x29b113=_0xdbb9[_0x462574];return _0x29b113;};'use strict';var client=require('../client');exports[_0x9dbb('0x0')]=function(){return function(){return client[_0x9dbb('0x1')](_0x9dbb('0x2'),{'options':{'raw':![],'attributes':['id',_0x9dbb('0x3'),'timeout',_0x9dbb('0x4')],'include':[{'model':_0x9dbb('0x5'),'as':_0x9dbb('0x6'),'attributes':['id',_0x9dbb('0x3'),_0x9dbb('0x7'),_0x9dbb('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6957efd..50bfd37 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 _0xc7d5=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x4e07d9,_0x15d276){var _0x508643=function(_0x145846){while(--_0x145846){_0x4e07d9['push'](_0x4e07d9['shift']());}};_0x508643(++_0x15d276);}(_0xc7d5,0x6b));var _0x5c7d=function(_0x3696b9,_0x1e3799){_0x3696b9=_0x3696b9-0x0;var _0x234e28=_0xc7d5[_0x3696b9];return _0x234e28;};'use strict';var client=require(_0x5c7d('0x0'));exports[_0x5c7d('0x1')]=function(_0x3d5f05){return client[_0x5c7d('0x2')](_0x5c7d('0x3'),{'body':_0x3d5f05,'log':_0x5c7d('0x3')});};exports[_0x5c7d('0x4')]=function(_0x47a8be,_0x402b3d){return client[_0x5c7d('0x2')](_0x5c7d('0x5'),{'body':_0x402b3d,'options':{'where':{'uniqueid':_0x47a8be},'order':[['id',_0x5c7d('0x6')]],'limit':0x1},'log':_0x5c7d('0x5')});}; \ No newline at end of file +var _0x33ad=['UpdateSmsQueueReport','create','Request','CreateSmsQueueReport','update'];(function(_0x22c149,_0x5db6f2){var _0xec36de=function(_0x14b967){while(--_0x14b967){_0x22c149['push'](_0x22c149['shift']());}};_0xec36de(++_0x5db6f2);}(_0x33ad,0x74));var _0xd33a=function(_0x3bc7ef,_0x591902){_0x3bc7ef=_0x3bc7ef-0x0;var _0xe81c32=_0x33ad[_0x3bc7ef];return _0xe81c32;};'use strict';var client=require('../client');exports[_0xd33a('0x0')]=function(_0x44d27b){return client[_0xd33a('0x1')](_0xd33a('0x2'),{'body':_0x44d27b,'log':_0xd33a('0x2')});};exports[_0xd33a('0x3')]=function(_0x3a7f6d,_0x5bdf83){return client['Request']('UpdateSmsQueueReport',{'body':_0x5bdf83,'options':{'where':{'uniqueid':_0x3a7f6d},'order':[['id','DESC']],'limit':0x1},'log':_0xd33a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1709736..1c429fa 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 _0x4428=['lastPauseAt','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','pauseType'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4428,0x12b));var _0x8442=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x4428[_0x500419];return _0x241c1a;};'use strict';var client=require(_0x8442('0x0'));exports[_0x8442('0x1')]=function(){return function(){return client[_0x8442('0x2')](_0x8442('0x3'),{'options':{'raw':!![],'where':{'role':_0x8442('0x4')},'attributes':['id',_0x8442('0x5'),'online',_0x8442('0x6'),_0x8442('0x7'),'voicePause',_0x8442('0x8'),_0x8442('0x9'),'faxPause',_0x8442('0xa'),_0x8442('0xb'),_0x8442('0xc'),_0x8442('0xd'),'mailCapacity',_0x8442('0xe'),_0x8442('0xf'),'whatsappCapacity',_0x8442('0x10')]},'log':_0x8442('0x1')});};}; \ No newline at end of file +var _0xef8a=['agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','whatsappPause','chatCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser'];(function(_0x1efa5c,_0x4deafb){var _0x4f8376=function(_0x132a82){while(--_0x132a82){_0x1efa5c['push'](_0x1efa5c['shift']());}};_0x4f8376(++_0x4deafb);}(_0xef8a,0x7c));var _0xaef8=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xef8a[_0x519756];return _0x37047e;};'use strict';var client=require(_0xaef8('0x0'));exports[_0xaef8('0x1')]=function(){return function(){return client[_0xaef8('0x2')](_0xaef8('0x3'),{'options':{'raw':!![],'where':{'role':_0xaef8('0x4')},'attributes':['id',_0xaef8('0x5'),_0xaef8('0x6'),_0xaef8('0x7'),_0xaef8('0x8'),'voicePause',_0xaef8('0x9'),_0xaef8('0xa'),_0xaef8('0xb'),'smsPause',_0xaef8('0xc'),'openchannelPause',_0xaef8('0xd'),'mailCapacity','faxCapacity',_0xaef8('0xe'),'whatsappCapacity',_0xaef8('0xf')]},'log':_0xaef8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index f6cbeae..15b7161 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 _0x9589=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x5cb8a0,_0x5d55c2){var _0x7dcb3b=function(_0x31771c){while(--_0x31771c){_0x5cb8a0['push'](_0x5cb8a0['shift']());}};_0x7dcb3b(++_0x5d55c2);}(_0x9589,0xbc));var _0x9958=function(_0xd2bd1,_0x3ba7d6){_0xd2bd1=_0xd2bd1-0x0;var _0x9c70bd=_0x9589[_0xd2bd1];return _0x9c70bd;};'use strict';var client=require(_0x9958('0x0'));exports[_0x9958('0x1')]=function(_0x220175,_0x454fcd){return client[_0x9958('0x2')]('UpdateWhatsappInteraction',{'body':_0x454fcd,'options':{'where':{'id':_0x220175}},'log':_0x9958('0x3')});};exports[_0x9958('0x4')]=function(_0xe7c0e,_0x4845d4){return client[_0x9958('0x2')](_0x9958('0x5'),{'body':_0x4845d4,'options':{'where':{'id':_0xe7c0e}},'log':_0x9958('0x6')});}; \ No newline at end of file +var _0x9e9b=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x5454db,_0x188379){var _0x214143=function(_0x4fe16c){while(--_0x4fe16c){_0x5454db['push'](_0x5454db['shift']());}};_0x214143(++_0x188379);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x9e9b[_0x2d4661];return _0x42ed1e;};'use strict';var client=require(_0xb9e9('0x0'));exports['update']=function(_0x5af29a,_0x39a0db){return client[_0xb9e9('0x1')](_0xb9e9('0x2'),{'body':_0x39a0db,'options':{'where':{'id':_0x5af29a}},'log':_0xb9e9('0x3')});};exports['addTags']=function(_0x430131,_0x394a8e){return client['Request'](_0xb9e9('0x4'),{'body':_0x394a8e,'options':{'where':{'id':_0x430131}},'log':_0xb9e9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 154b2f5..d3fb8c5 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 _0x4bb2=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x4bb2,0x132));var _0x24bb=function(_0x20352e,_0x2839a0){_0x20352e=_0x20352e-0x0;var _0x2f2569=_0x4bb2[_0x20352e];return _0x2f2569;};'use strict';var client=require(_0x24bb('0x0'));exports[_0x24bb('0x1')]=function(_0x5a5a85){return client['Request'](_0x24bb('0x2'),{'body':_0x5a5a85,'log':_0x24bb('0x3')});}; \ No newline at end of file +var _0x175b=['createWhatsappMessage','../client','create','Request'];(function(_0x3f6f46,_0x406356){var _0x57c056=function(_0x188fa6){while(--_0x188fa6){_0x3f6f46['push'](_0x3f6f46['shift']());}};_0x57c056(++_0x406356);}(_0x175b,0xcd));var _0xb175=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x175b[_0x4de586];return _0x46baf5;};'use strict';var client=require(_0xb175('0x0'));exports[_0xb175('0x1')]=function(_0x1fb87a){return client[_0xb175('0x2')]('CreateWhatsappMessage',{'body':_0x1fb87a,'log':_0xb175('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7c99709..75a86cb 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 _0xe9e8=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','../client'];(function(_0x4e5d67,_0x54dffc){var _0x4acdf3=function(_0x53e5a3){while(--_0x53e5a3){_0x4e5d67['push'](_0x4e5d67['shift']());}};_0x4acdf3(++_0x54dffc);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x2c673f,_0x1d675e){_0x2c673f=_0x2c673f-0x0;var _0x45d894=_0xe9e8[_0x2c673f];return _0x45d894;};'use strict';var client=require(_0x8e9e('0x0'));exports[_0x8e9e('0x1')]=function(){return function(){return client[_0x8e9e('0x2')](_0x8e9e('0x3'),{'options':{'raw':![],'attributes':['id',_0x8e9e('0x4'),_0x8e9e('0x5'),_0x8e9e('0x6')],'include':[{'model':'User','as':_0x8e9e('0x7'),'attributes':['id',_0x8e9e('0x4'),_0x8e9e('0x8'),'whatsappPause']}]},'log':_0x8e9e('0x1')});};}; \ No newline at end of file +var _0x6ae2=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x55c308,_0x326124){var _0x46d3be=function(_0x274594){while(--_0x274594){_0x55c308['push'](_0x55c308['shift']());}};_0x46d3be(++_0x326124);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x5a2cf2,_0x5e7dea){_0x5a2cf2=_0x5a2cf2-0x0;var _0x72d05f=_0x6ae2[_0x5a2cf2];return _0x72d05f;};'use strict';var client=require(_0x26ae('0x0'));exports[_0x26ae('0x1')]=function(){return function(){return client[_0x26ae('0x2')](_0x26ae('0x3'),{'options':{'raw':![],'attributes':['id',_0x26ae('0x4'),_0x26ae('0x5'),_0x26ae('0x6')],'include':[{'model':_0x26ae('0x7'),'as':_0x26ae('0x8'),'attributes':['id','name',_0x26ae('0x9'),_0x26ae('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 590e91f..4d85c34 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 _0x0904=['../client','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport'];(function(_0xf12c07,_0x41faec){var _0x46cd37=function(_0x4da11c){while(--_0x4da11c){_0xf12c07['push'](_0xf12c07['shift']());}};_0x46cd37(++_0x41faec);}(_0x0904,0x162));var _0x4090=function(_0x1f94b0,_0x58c657){_0x1f94b0=_0x1f94b0-0x0;var _0x5cba72=_0x0904[_0x1f94b0];return _0x5cba72;};'use strict';var client=require(_0x4090('0x0'));exports['create']=function(_0x246fa2){return client[_0x4090('0x1')](_0x4090('0x2'),{'body':_0x246fa2,'log':_0x4090('0x2')});};exports[_0x4090('0x3')]=function(_0x47ae83,_0x4feb03){return client[_0x4090('0x1')]('UpdateWhatsappQueueReport',{'body':_0x4feb03,'options':{'where':{'uniqueid':_0x47ae83},'order':[['id',_0x4090('0x4')]],'limit':0x1},'log':_0x4090('0x5')});}; \ No newline at end of file +var _0x98da=['update','UpdateWhatsappQueueReport','create','Request'];(function(_0x3da25b,_0xd3e6c){var _0x238c18=function(_0x3b349f){while(--_0x3b349f){_0x3da25b['push'](_0x3da25b['shift']());}};_0x238c18(++_0xd3e6c);}(_0x98da,0x66));var _0xa98d=function(_0x3667d4,_0x2cea61){_0x3667d4=_0x3667d4-0x0;var _0x115071=_0x98da[_0x3667d4];return _0x115071;};'use strict';var client=require('../client');exports[_0xa98d('0x0')]=function(_0x11d9bf){return client[_0xa98d('0x1')]('CreateWhatsappQueueReport',{'body':_0x11d9bf,'log':'CreateWhatsappQueueReport'});};exports[_0xa98d('0x2')]=function(_0x4e618c,_0x254b84){return client[_0xa98d('0x1')](_0xa98d('0x3'),{'body':_0x254b84,'options':{'where':{'uniqueid':_0x4e618c},'order':[['id','DESC']],'limit':0x1},'log':_0xa98d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 3100171..02a5890 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 _0xc1a6=['./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','toLowerCase','length','error','[%s][AGENT]\x20%s','message','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','name','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing'];(function(_0xb8a951,_0x1d7dbf){var _0x3eff0c=function(_0x3dee4f){while(--_0x3dee4f){_0xb8a951['push'](_0xb8a951['shift']());}};_0x3eff0c(++_0x1d7dbf);}(_0xc1a6,0xe9));var _0x6c1a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xc1a6[_0xc4001c];return _0x49f7bc;};'use strict';var schema=require(_0x6c1a('0x0'));var _=require(_0x6c1a('0x1'));var util=require('util');var seqqueue=require(_0x6c1a('0x2'));var logger=require(_0x6c1a('0x3'))(_0x6c1a('0x4'));var strategy=require(_0x6c1a('0x5'));var queue=schema({'name':{'type':_0x6c1a('0x6'),'required':!![],'message':_0x6c1a('0x7')},'timeout':{'type':_0x6c1a('0x8'),'message':_0x6c1a('0x9')}});function writeLog(_0x1186d0,_0x12b6e8,_0x33a313){return logger[_0x6c1a('0xa')](util[_0x6c1a('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1186d0,_0x12b6e8['name'],_0x33a313));}function handleFindAgent(_0x4cf5fa){return function(_0x97e5c5){return _0x97e5c5['name'][_0x6c1a('0xc')]()===_0x4cf5fa[_0x6c1a('0xc')]();};}exports['consequence']=function(_0x1cc9a2,_0x3a9181,_0x17a040,_0x5907a9){return function(_0x1f10af){try{var _0x250f5e={'name':_0x3a9181[0x0],'timeout':_0x3a9181[0x1]};var _0x201ddf=queue[_0x6c1a('0x0')](_0x250f5e,{'typecast':!![]});if(_0x201ddf[_0x6c1a('0xd')]){logger[_0x6c1a('0xe')](_0x6c1a('0xf'),_0x1cc9a2,_['map'](_0x201ddf,_0x6c1a('0x10'))['join'](',\x20'));_0x1f10af[_0x6c1a('0x11')]();}else{var _0x186776=_[_0x6c1a('0x12')](_0x17a040['agents'],handleFindAgent(_0x250f5e['name']));if(_0x186776){var _0x557f5a=(_0x250f5e[_0x6c1a('0x13')]||0xa)*0x3e8;var _0x45cbd3,_0x5659b7;var _0x450747=seqqueue[_0x6c1a('0x14')](_0x557f5a);_0x450747['id']=_0x1cc9a2;_0x450747[_0x6c1a('0x15')]=_0x557f5a;_0x450747[_0x6c1a('0x16')]=_0x5907a9[_0x6c1a('0x16')];writeLog(_0x1cc9a2,_0x186776,util[_0x6c1a('0xb')](_0x6c1a('0x17'),_0x557f5a));_0x17a040[_0x6c1a('0x18')][_0x1cc9a2]['on'](_0x6c1a('0x19'),function(){logger[_0x6c1a('0xa')](_0x6c1a('0x1a'),_0x1cc9a2);clearTimeout(_0x5659b7);_0x5659b7=undefined;_0x450747[_0x6c1a('0x1b')]();if(_0x17a040['rules'][_0x1cc9a2]){delete _0x17a040['rules'][_0x1cc9a2];}_0x1f10af[_0x6c1a('0x11')]();});_0x17a040[_0x6c1a('0x18')][_0x1cc9a2]['on']('complete',function(){if(_0x17a040[_0x6c1a('0x18')][_0x1cc9a2]){delete _0x17a040['rules'][_0x1cc9a2];}});_0x5659b7=setTimeout(function(){logger[_0x6c1a('0xa')](_0x6c1a('0x1c'),_0x1cc9a2);clearTimeout(_0x5659b7);_0x450747[_0x6c1a('0x1b')]();_0x1f10af[_0x6c1a('0x1d')]();},_0x557f5a);strategy['agent'](_0x450747,_0x186776,_0x17a040,_0x5907a9);}else{logger[_0x6c1a('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1cc9a2,_0x250f5e[_0x6c1a('0x1e')]);_0x1f10af[_0x6c1a('0x11')]();}}}catch(_0x518864){console[_0x6c1a('0x1f')](_0x518864);logger[_0x6c1a('0xe')](_0x6c1a('0x20'),_0x1cc9a2,_0x518864[_0x6c1a('0x21')]);_0x1f10af['stop']();}};}; \ No newline at end of file +var _0x4366=['[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','find','agents','timeout','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x4366,0x1be));var _0x6436=function(_0x4b0ef7,_0x3c427e){_0x4b0ef7=_0x4b0ef7-0x0;var _0x30674e=_0x4366[_0x4b0ef7];return _0x30674e;};'use strict';var schema=require(_0x6436('0x0'));var _=require(_0x6436('0x1'));var util=require(_0x6436('0x2'));var seqqueue=require(_0x6436('0x3'));var logger=require(_0x6436('0x4'))(_0x6436('0x5'));var strategy=require(_0x6436('0x6'));var queue=schema({'name':{'type':_0x6436('0x7'),'required':!![],'message':_0x6436('0x8')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5029f9,_0x246dc4,_0x4fc5c8){return logger[_0x6436('0x9')](util['format'](_0x6436('0xa'),_0x5029f9,_0x246dc4['name'],_0x4fc5c8));}function handleFindAgent(_0x26baee){return function(_0x4e3494){return _0x4e3494[_0x6436('0xb')][_0x6436('0xc')]()===_0x26baee[_0x6436('0xc')]();};}exports[_0x6436('0xd')]=function(_0x55a922,_0x214176,_0x42f4a4,_0x2b27a8){return function(_0x411905){try{var _0x15eaca={'name':_0x214176[0x0],'timeout':_0x214176[0x1]};var _0x2f5bec=queue['validate'](_0x15eaca,{'typecast':!![]});if(_0x2f5bec[_0x6436('0xe')]){logger['error'](_0x6436('0xf'),_0x55a922,_[_0x6436('0x10')](_0x2f5bec,_0x6436('0x11'))['join'](',\x20'));_0x411905['stop']();}else{var _0x37be08=_[_0x6436('0x12')](_0x42f4a4[_0x6436('0x13')],handleFindAgent(_0x15eaca[_0x6436('0xb')]));if(_0x37be08){var _0x9c415=(_0x15eaca[_0x6436('0x14')]||0xa)*0x3e8;var _0x4c9a79,_0x4016c8;var _0x2a8636=seqqueue['createQueue'](_0x9c415);_0x2a8636['id']=_0x55a922;_0x2a8636[_0x6436('0x15')]=_0x9c415;_0x2a8636['channel']=_0x2b27a8[_0x6436('0x16')];writeLog(_0x55a922,_0x37be08,util['format'](_0x6436('0x17'),_0x9c415));_0x42f4a4['rules'][_0x55a922]['on'](_0x6436('0x18'),function(){logger[_0x6436('0x9')](_0x6436('0x19'),_0x55a922);clearTimeout(_0x4016c8);_0x4016c8=undefined;_0x2a8636[_0x6436('0x1a')]();if(_0x42f4a4[_0x6436('0x1b')][_0x55a922]){delete _0x42f4a4[_0x6436('0x1b')][_0x55a922];}_0x411905[_0x6436('0x1c')]();});_0x42f4a4['rules'][_0x55a922]['on'](_0x6436('0x1d'),function(){if(_0x42f4a4['rules'][_0x55a922]){delete _0x42f4a4[_0x6436('0x1b')][_0x55a922];}});_0x4016c8=setTimeout(function(){logger[_0x6436('0x9')](_0x6436('0x1e'),_0x55a922);clearTimeout(_0x4016c8);_0x2a8636[_0x6436('0x1a')]();_0x411905['next']();},_0x9c415);strategy[_0x6436('0x1f')](_0x2a8636,_0x37be08,_0x42f4a4,_0x2b27a8);}else{logger['error'](_0x6436('0x20'),_0x55a922,_0x15eaca[_0x6436('0xb')]);_0x411905[_0x6436('0x1c')]();}}}catch(_0x4527ba){console[_0x6436('0x21')](_0x4527ba);logger[_0x6436('0x22')](_0x6436('0x23'),_0x55a922,_0x4527ba[_0x6436('0x24')]);_0x411905[_0x6436('0x1c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 2f23118..b16f88d 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 _0x867b=['$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','stringify','then','dialogState','Failed','next','catch','lodash','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','[%s][AMAZONLEX]\x20%s','body','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime'];(function(_0x1572b2,_0x4360ca){var _0x4c42bf=function(_0x41f2d0){while(--_0x41f2d0){_0x1572b2['push'](_0x1572b2['shift']());}};_0x4c42bf(++_0x4360ca);}(_0x867b,0x6b));var _0xb867=function(_0x1a8814,_0x4fea57){_0x1a8814=_0x1a8814-0x0;var _0x2de9fc=_0x867b[_0x1a8814];return _0x2de9fc;};'use strict';var _=require(_0xb867('0x0'));var moment=require(_0xb867('0x1'));var AWS=require(_0xb867('0x2'));var utils=require('./utils');var logger=require(_0xb867('0x3'))('routing');var rpc={'chatMessage':require(_0xb867('0x4')),'openchannelMessage':require(_0xb867('0x5')),'mailMessage':require(_0xb867('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb867('0x7')),'whatsappMessage':require(_0xb867('0x8'))};exports[_0xb867('0x9')]=function(_0x43e7a4,_0x37fc49){return function(_0x3fec48){try{if(!_[_0xb867('0xa')](this[_0xb867('0xb')][_0xb867('0xc')])){logger[_0xb867('0xd')]('[%s][AMAZONLEX]\x20%s',_0x43e7a4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3fec48['next']();}var _0x179fe2={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb867('0xe')](_0xb867('0xf')),'direction':'out'};if(this[_0xb867('0x10')]==='sms'||this[_0xb867('0x10')]===_0xb867('0x11')){_0x179fe2[_0xb867('0x12')]=this[_0xb867('0xb')][_0xb867('0x12')];}var _0xda7a88=this[_0xb867('0x10')];if(_0xda7a88==='chat'){_0x179fe2[_0xb867('0x13')]=this[_0xb867('0x14')]['id'];}else{_0x179fe2[_['upperFirst'](_0xda7a88)+_0xb867('0x15')]=this[_0xb867('0x14')]['id'];}_0x179fe2[_[_0xb867('0x16')](_0xda7a88)+_0xb867('0x17')]=this[_0xb867('0xb')]['id'];if(this['interaction'][_0xb867('0x18')]){var _0x3ca231=_0x37fc49[0x4];if(!_[_0xb867('0x19')](_0x3ca231)){_0x179fe2['body']=utils['getMustacheRender'](_0x3ca231,this);return rpc[_0xda7a88+_0xb867('0x1a')]['create'](_0x179fe2)['then'](function(_0x5d4293){logger[_0xb867('0xd')](_0xb867('0x1b'),_0x43e7a4,_0x179fe2[_0xb867('0x1c')]);})['catch'](function(_0x2ebfc5){logger[_0xb867('0x1d')](_0xb867('0x1b'),_0x43e7a4,JSON['stringify'](_0x2ebfc5));})[_0xb867('0x1e')](function(){logger[_0xb867('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x43e7a4);_0x3fec48[_0xb867('0x1f')]();});}else{logger[_0xb867('0xd')](_0xb867('0x20'),_0x43e7a4);_0x3fec48[_0xb867('0x1f')]();}}else{var _0x211a38=this;var _0x15818c=new AWS[(_0xb867('0x21'))]({'accessKeyId':_0x37fc49[0x0],'secretAccessKey':_0x37fc49[0x1],'region':_0x37fc49[0x2]});var _0x5e756d={'botAlias':_0xb867('0x22'),'botName':_0x37fc49[0x3],'inputText':this['message'][_0xb867('0x1c')],'userId':this[_0xb867('0x10')]+':'+this[_0xb867('0xb')]['id'][_0xb867('0x23')]()};_0x15818c[_0xb867('0x24')](_0x5e756d,function(_0x118325,_0x4998dd){if(_0x118325){logger[_0xb867('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x43e7a4,_0x118325[_0xb867('0x25')]);_0x3fec48['next']();}else if(_0x4998dd&&_0x4998dd[_0xb867('0x25')]){_0x211a38[_0xb867('0x1c')][_0xb867('0x26')]=_0x4998dd;_0x179fe2['body']=_0x4998dd['message'];_0x179fe2[_0xb867('0x27')]='amazonlex';_0x179fe2[_0xb867('0x28')]=JSON[_0xb867('0x29')](_0x4998dd);return rpc[_0xda7a88+'Message']['create'](_0x179fe2)[_0xb867('0x2a')](function(_0x52ddfb){logger[_0xb867('0xd')](_0xb867('0x1b'),_0x43e7a4,_0x179fe2['body']);if(_0x4998dd[_0xb867('0x2b')]==_0xb867('0x2c')){_0x3fec48[_0xb867('0x2d')]();}else{_0x3fec48['stop']();}})[_0xb867('0x2e')](function(_0x49f546){logger[_0xb867('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x43e7a4,JSON['stringify'](_0x49f546));_0x3fec48['next']();});}else{_0x3fec48[_0xb867('0x2d')]();}});}}catch(_0xeaae91){logger[_0xb867('0x1d')](_0xb867('0x1b'),_0x43e7a4,JSON[_0xb867('0x29')](_0xeaae91));_0x3fec48[_0xb867('0x1f')]();}};}; \ No newline at end of file +var _0x342f=['account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','amazonlex','message','providerName','providerResponse','create','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','ChatWebsiteId'];(function(_0x211576,_0xcc41af){var _0x3ce235=function(_0x28bd8a){while(--_0x28bd8a){_0x211576['push'](_0x211576['shift']());}};_0x3ce235(++_0xcc41af);}(_0x342f,0xba));var _0xf342=function(_0x501169,_0x5cf53c){_0x501169=_0x501169-0x0;var _0x278f31=_0x342f[_0x501169];return _0x278f31;};'use strict';var _=require('lodash');var moment=require(_0xf342('0x0'));var AWS=require(_0xf342('0x1'));var utils=require(_0xf342('0x2'));var logger=require(_0xf342('0x3'))(_0xf342('0x4'));var rpc={'chatMessage':require(_0xf342('0x5')),'openchannelMessage':require(_0xf342('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf342('0x7')),'faxMessage':require(_0xf342('0x8')),'whatsappMessage':require(_0xf342('0x9'))};exports[_0xf342('0xa')]=function(_0x5ba05b,_0x40a204){return function(_0x4a70d9){try{if(!_[_0xf342('0xb')](this[_0xf342('0xc')][_0xf342('0xd')])){logger[_0xf342('0xe')](_0xf342('0xf'),_0x5ba05b,_0xf342('0x10'));return _0x4a70d9[_0xf342('0x11')]();}var _0xc00419={'ContactId':this[_0xf342('0x12')]['id'],'sentAt':moment()[_0xf342('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf342('0x14')};if(this[_0xf342('0x15')]===_0xf342('0x16')||this['channel']===_0xf342('0x17')){_0xc00419[_0xf342('0x18')]=this['interaction'][_0xf342('0x18')];}var _0xbe1e6b=this[_0xf342('0x15')];if(_0xbe1e6b==='chat'){_0xc00419[_0xf342('0x19')]=this[_0xf342('0x1a')]['id'];}else{_0xc00419[_[_0xf342('0x1b')](_0xbe1e6b)+_0xf342('0x1c')]=this['account']['id'];}_0xc00419[_['upperFirst'](_0xbe1e6b)+_0xf342('0x1d')]=this['interaction']['id'];if(this['interaction'][_0xf342('0x1e')]){var _0x93eb2b=_0x40a204[0x4];if(!_[_0xf342('0x1f')](_0x93eb2b)){_0xc00419[_0xf342('0x20')]=utils[_0xf342('0x21')](_0x93eb2b,this);return rpc[_0xbe1e6b+_0xf342('0x22')]['create'](_0xc00419)[_0xf342('0x23')](function(_0xdd067b){logger[_0xf342('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5ba05b,_0xc00419[_0xf342('0x20')]);})[_0xf342('0x24')](function(_0x554102){logger[_0xf342('0x25')](_0xf342('0xf'),_0x5ba05b,JSON[_0xf342('0x26')](_0x554102));})['finally'](function(){logger[_0xf342('0xe')](_0xf342('0x27'),_0x5ba05b);_0x4a70d9[_0xf342('0x28')]();});}else{logger[_0xf342('0xe')](_0xf342('0x29'),_0x5ba05b);_0x4a70d9[_0xf342('0x28')]();}}else{var _0x351ae5=this;var _0x5a3274=new AWS[(_0xf342('0x2a'))]({'accessKeyId':_0x40a204[0x0],'secretAccessKey':_0x40a204[0x1],'region':_0x40a204[0x2]});var _0x2f175b={'botAlias':_0xf342('0x2b'),'botName':_0x40a204[0x3],'inputText':this['message'][_0xf342('0x20')],'userId':this[_0xf342('0x15')]+':'+this[_0xf342('0xc')]['id'][_0xf342('0x2c')]()};_0x5a3274[_0xf342('0x2d')](_0x2f175b,function(_0x5006d0,_0x58f82d){if(_0x5006d0){logger[_0xf342('0x25')](_0xf342('0xf'),_0x5ba05b,_0x5006d0['message']);_0x4a70d9[_0xf342('0x11')]();}else if(_0x58f82d&&_0x58f82d['message']){_0x351ae5[_0xf342('0x20')][_0xf342('0x2e')]=_0x58f82d;_0xc00419[_0xf342('0x20')]=_0x58f82d[_0xf342('0x2f')];_0xc00419[_0xf342('0x30')]=_0xf342('0x2e');_0xc00419[_0xf342('0x31')]=JSON[_0xf342('0x26')](_0x58f82d);return rpc[_0xbe1e6b+_0xf342('0x22')][_0xf342('0x32')](_0xc00419)[_0xf342('0x23')](function(_0x5137fd){logger[_0xf342('0xe')](_0xf342('0xf'),_0x5ba05b,_0xc00419['body']);if(_0x58f82d[_0xf342('0x33')]==_0xf342('0x34')){_0x4a70d9['next']();}else{_0x4a70d9[_0xf342('0x28')]();}})[_0xf342('0x24')](function(_0x19eceb){logger[_0xf342('0x25')](_0xf342('0xf'),_0x5ba05b,JSON[_0xf342('0x26')](_0x19eceb));_0x4a70d9[_0xf342('0x11')]();});}else{_0x4a70d9['next']();}});}}catch(_0x3a496d){logger[_0xf342('0x25')]('[%s][AMAZONLEX]\x20%s',_0x5ba05b,JSON[_0xf342('0x26')](_0x3a496d));_0x4a70d9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index dc04b01..e3ae603 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 _0x4f74=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','body','','headers','auto-replied','All','auto_reply','sendMailMessage','then','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','getMustacheRender'];(function(_0x1dc821,_0xaa6f05){var _0x449f0b=function(_0x5a27b7){while(--_0x5a27b7){_0x1dc821['push'](_0x1dc821['shift']());}};_0x449f0b(++_0xaa6f05);}(_0x4f74,0x130));var _0x44f7=function(_0x596684,_0x3e7a0a){_0x596684=_0x596684-0x0;var _0x21d272=_0x4f74[_0x596684];return _0x21d272;};'use strict';var _=require(_0x44f7('0x0'));var moment=require(_0x44f7('0x1'));var utils=require(_0x44f7('0x2'));var logger=require('../../../../config/logger')(_0x44f7('0x3'));var rpc={'chatMessage':require(_0x44f7('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x44f7('0x5'))};var mailRpc=require(_0x44f7('0x6'));exports[_0x44f7('0x7')]=function(_0x5a0ebf,_0x213bf0){return function(_0x223421){try{if(_0x213bf0[0x0]==='1'&&(_[_0x44f7('0x8')](this[_0x44f7('0x9')][_0x44f7('0xa')])||!this[_0x44f7('0x9')][_0x44f7('0xa')])){logger[_0x44f7('0xb')]('[%s][AUTOREPLY]\x20%s',_0x5a0ebf,_0x44f7('0xc'));return _0x223421[_0x44f7('0xd')]();}var _0x567d50=this[_0x44f7('0xe')];var _0x2e94fd={'body':utils[_0x44f7('0xf')](_0x213bf0[0x1],this),'ContactId':this[_0x44f7('0x10')]['id'],'sentAt':moment()[_0x44f7('0x11')](_0x44f7('0x12')),'direction':_0x44f7('0x13')};if(this['message']){_0x2e94fd['to']=this[_0x44f7('0x14')][_0x44f7('0x15')]||'';_0x2e94fd['cc']=this[_0x44f7('0x14')]['cc']||'';_0x2e94fd[_0x44f7('0x15')]=this[_0x44f7('0x14')]['to']||'';_0x2e94fd[_0x44f7('0x16')]=this['message']['phone']||'';_0x2e94fd[_0x44f7('0x17')]=!![];if(this['message'][_0x44f7('0x18')]){_0x2e94fd[_0x44f7('0x18')]='';_0x2e94fd['subject']+=_[_0x44f7('0x19')](this[_0x44f7('0x14')][_0x44f7('0x18')],_0x44f7('0x1a'))?'':_0x44f7('0x1b');_0x2e94fd['subject']+=this[_0x44f7('0x14')]['subject'];}}if(this[_0x44f7('0xe')]===_0x44f7('0x1c')){_0x2e94fd['ChatWebsiteId']=this[_0x44f7('0x1d')]['id'];}else{_0x2e94fd[_[_0x44f7('0x1e')](this[_0x44f7('0xe')])+_0x44f7('0x1f')]=this[_0x44f7('0x1d')]['id'];}_0x2e94fd[_[_0x44f7('0x1e')](this['channel'])+_0x44f7('0x20')]=this[_0x44f7('0x9')]['id'];if(rpc[this[_0x44f7('0xe')]+_0x44f7('0x21')]){if(this[_0x44f7('0xe')]==='mail'){var _0x430b02={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x44f7('0x22')]['service']){_0x430b02['service']=this[_0x44f7('0x1d')][_0x44f7('0x22')][_0x44f7('0x23')];}else{_0x430b02[_0x44f7('0x24')]=this['account'][_0x44f7('0x22')][_0x44f7('0x24')];_0x430b02[_0x44f7('0x25')]=this['account'][_0x44f7('0x22')]['port'];_0x430b02[_0x44f7('0x26')]=this['account'][_0x44f7('0x22')][_0x44f7('0x26')];}if(this[_0x44f7('0x1d')]['Smtp'][_0x44f7('0x27')]){_0x430b02[_0x44f7('0x28')]={'user':this['account']['Smtp'][_0x44f7('0x29')],'pass':this[_0x44f7('0x1d')][_0x44f7('0x22')][_0x44f7('0x2a')]};}_0x2e94fd[_0x44f7('0x2b')]=this[_0x44f7('0x14')][_0x44f7('0x2c')];_0x2e94fd[_0x44f7('0x2d')]=''+_['replace'](_0x2e94fd[_0x44f7('0x2e')],_0x44f7('0x2f'),_0x44f7('0x30'))+_0x44f7('0x31');_0x2e94fd[_0x44f7('0x32')]={'Auto-Submitted':_0x44f7('0x33'),'X-Auto-Response-Suppress':_0x44f7('0x34'),'Precedence':_0x44f7('0x35')};return mailRpc[_0x44f7('0x36')](_0x430b02,_0x2e94fd)[_0x44f7('0x37')](function(_0x5407f3){logger[_0x44f7('0xb')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x5a0ebf);_0x2e94fd[_0x44f7('0x2c')]=_0x5407f3[_0x44f7('0x14')][_0x44f7('0x2c')];return rpc[_0x567d50+_0x44f7('0x21')][_0x44f7('0x38')](_0x2e94fd);})[_0x44f7('0x37')](function(_0x50e435){logger[_0x44f7('0xb')](_0x44f7('0x39'),_0x5a0ebf,JSON[_0x44f7('0x3a')](_0x50e435));})['catch'](function(_0x3169a3){logger[_0x44f7('0x3b')](_0x44f7('0x3c'),_0x5a0ebf,JSON[_0x44f7('0x3a')](_0x3169a3));})[_0x44f7('0x3d')](function(){_0x223421['next']();});}else{return rpc[this[_0x44f7('0xe')]+'Message'][_0x44f7('0x38')](_0x2e94fd)[_0x44f7('0x37')](function(_0x5a882b){logger[_0x44f7('0xb')](_0x44f7('0x39'),_0x5a0ebf,_0x2e94fd[_0x44f7('0x2e')]);})[_0x44f7('0x3e')](function(_0x518028){logger['error'](_0x44f7('0x39'),_0x5a0ebf,JSON[_0x44f7('0x3a')](_0x518028));})['finally'](function(){_0x223421[_0x44f7('0xd')]();});}}}catch(_0x33419f){logger['error'](_0x44f7('0x39'),_0x5a0ebf,JSON['stringify'](_0x33419f));_0x223421[_0x44f7('0x3f')]();}};}; \ No newline at end of file +var _0x8b21=['Autoreply\x20already\x20sent','next','getMustacheRender','contact','format','out','message','from','phone','read','subject','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','replace','body','','headers','auto-replied','All','auto_reply','sendMailMessage','then','messageId','create','info','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','created','[%s][AUTOREPLY]\x20%s'];(function(_0x332251,_0x3c134f){var _0x592e7d=function(_0x5bc27d){while(--_0x5bc27d){_0x332251['push'](_0x332251['shift']());}};_0x592e7d(++_0x3c134f);}(_0x8b21,0xac));var _0x18b2=function(_0x5ea1b4,_0x2017cb){_0x5ea1b4=_0x5ea1b4-0x0;var _0x4dab42=_0x8b21[_0x5ea1b4];return _0x4dab42;};'use strict';var _=require(_0x18b2('0x0'));var moment=require(_0x18b2('0x1'));var utils=require(_0x18b2('0x2'));var logger=require(_0x18b2('0x3'))(_0x18b2('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x18b2('0x5')),'mailMessage':require(_0x18b2('0x6')),'smsMessage':require(_0x18b2('0x7')),'faxMessage':require(_0x18b2('0x8')),'whatsappMessage':require(_0x18b2('0x9'))};var mailRpc=require('../../mailRpc');exports[_0x18b2('0xa')]=function(_0x59f7ec,_0x1d5255){return function(_0x41cc25){try{if(_0x1d5255[0x0]==='1'&&(_['isNil'](this[_0x18b2('0xb')][_0x18b2('0xc')])||!this[_0x18b2('0xb')][_0x18b2('0xc')])){logger['info'](_0x18b2('0xd'),_0x59f7ec,_0x18b2('0xe'));return _0x41cc25[_0x18b2('0xf')]();}var _0x36dc3a=this['channel'];var _0x5482bc={'body':utils[_0x18b2('0x10')](_0x1d5255[0x1],this),'ContactId':this[_0x18b2('0x11')]['id'],'sentAt':moment()[_0x18b2('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x18b2('0x13')};if(this['message']){_0x5482bc['to']=this[_0x18b2('0x14')]['from']||'';_0x5482bc['cc']=this[_0x18b2('0x14')]['cc']||'';_0x5482bc[_0x18b2('0x15')]=this['message']['to']||'';_0x5482bc[_0x18b2('0x16')]=this['message'][_0x18b2('0x16')]||'';_0x5482bc[_0x18b2('0x17')]=!![];if(this[_0x18b2('0x14')]['subject']){_0x5482bc[_0x18b2('0x18')]='';_0x5482bc['subject']+=_['startsWith'](this[_0x18b2('0x14')][_0x18b2('0x18')],'Re:')?'':'Re:\x20';_0x5482bc[_0x18b2('0x18')]+=this[_0x18b2('0x14')][_0x18b2('0x18')];}}if(this[_0x18b2('0x19')]==='chat'){_0x5482bc[_0x18b2('0x1a')]=this[_0x18b2('0x1b')]['id'];}else{_0x5482bc[_[_0x18b2('0x1c')](this[_0x18b2('0x19')])+_0x18b2('0x1d')]=this[_0x18b2('0x1b')]['id'];}_0x5482bc[_[_0x18b2('0x1c')](this[_0x18b2('0x19')])+_0x18b2('0x1e')]=this[_0x18b2('0xb')]['id'];if(rpc[this[_0x18b2('0x19')]+_0x18b2('0x1f')]){if(this[_0x18b2('0x19')]==='mail'){var _0x405af4={'tls':{'rejectUnauthorized':![]}};if(this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x21')]){_0x405af4['service']=this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x21')];}else{_0x405af4[_0x18b2('0x22')]=this['account'][_0x18b2('0x20')][_0x18b2('0x22')];_0x405af4['port']=this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x23')];_0x405af4[_0x18b2('0x24')]=this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x24')];}if(this['account'][_0x18b2('0x20')][_0x18b2('0x25')]){_0x405af4[_0x18b2('0x26')]={'user':this[_0x18b2('0x1b')]['Smtp'][_0x18b2('0x27')],'pass':this[_0x18b2('0x1b')][_0x18b2('0x20')][_0x18b2('0x28')]};}_0x5482bc[_0x18b2('0x29')]=this[_0x18b2('0x14')]['messageId'];_0x5482bc['html']=''+_[_0x18b2('0x2a')](_0x5482bc[_0x18b2('0x2b')],_0x18b2('0x2c'),_0x18b2('0x2d'))+_0x18b2('0x2e');_0x5482bc[_0x18b2('0x2f')]={'Auto-Submitted':_0x18b2('0x30'),'X-Auto-Response-Suppress':_0x18b2('0x31'),'Precedence':_0x18b2('0x32')};return mailRpc[_0x18b2('0x33')](_0x405af4,_0x5482bc)[_0x18b2('0x34')](function(_0x7e729d){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x59f7ec);_0x5482bc[_0x18b2('0x35')]=_0x7e729d[_0x18b2('0x14')][_0x18b2('0x35')];return rpc[_0x36dc3a+_0x18b2('0x1f')][_0x18b2('0x36')](_0x5482bc);})[_0x18b2('0x34')](function(_0x3bb1b3){logger[_0x18b2('0x37')](_0x18b2('0xd'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x3bb1b3));})[_0x18b2('0x39')](function(_0x2b355b){logger[_0x18b2('0x3a')](_0x18b2('0x3b'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x2b355b));})[_0x18b2('0x3c')](function(){_0x41cc25[_0x18b2('0xf')]();});}else{return rpc[this[_0x18b2('0x19')]+_0x18b2('0x1f')][_0x18b2('0x36')](_0x5482bc)[_0x18b2('0x34')](function(_0x8896ee){logger[_0x18b2('0x37')](_0x18b2('0xd'),_0x59f7ec,_0x5482bc[_0x18b2('0x2b')]);})[_0x18b2('0x39')](function(_0x136f53){logger[_0x18b2('0x3a')](_0x18b2('0xd'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x136f53));})[_0x18b2('0x3c')](function(){_0x41cc25[_0x18b2('0xf')]();});}}}catch(_0x32e932){logger[_0x18b2('0x3a')](_0x18b2('0xd'),_0x59f7ec,JSON[_0x18b2('0x38')](_0x32e932));_0x41cc25[_0x18b2('0x3d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 6dbcf2c..4f3ece6 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 _0x9303=['interaction','[%s][CLOSE]\x20%s','stringify','finally','error','stop','moment','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x324645,_0xdc9c60){var _0x518909=function(_0x48a9f9){while(--_0x48a9f9){_0x324645['push'](_0x324645['shift']());}};_0x518909(++_0xdc9c60);}(_0x9303,0xd7));var _0x3930=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9303[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require(_0x3930('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x3930('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x3930('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3930('0x3'))};exports[_0x3930('0x4')]=function(_0x1fb17,_0x2fa9c6,_0x57e19d,_0x44949e){return function(_0x55af25){try{logger['info'](_0x3930('0x5'),_0x1fb17,_0x2fa9c6[0x0]);var _0x4397b0={'closed':0x1,'closedAt':moment()[_0x3930('0x6')](_0x3930('0x7')),'closeReason':_0x3930('0x8'),'disposition':_0x2fa9c6[0x0]};if(rpc[_0x44949e['channel']+'Interaction']){rpc[_0x44949e[_0x3930('0x9')]+'Interaction']['update'](_0x44949e['interaction']['id'],_0x4397b0)[_0x3930('0xa')](function(_0x3ca6f5){logger[_0x3930('0xb')](_0x3930('0xc'),_0x1fb17,_0x44949e[_0x3930('0xd')]['id']);})['catch'](function(_0x13b928){logger['error'](_0x3930('0xe'),_0x1fb17,JSON[_0x3930('0xf')](_0x13b928));})[_0x3930('0x10')](function(){_0x55af25['stop']();});}}catch(_0x11b256){logger[_0x3930('0x11')]('[%s][CLOSE]\x20%s',_0x1fb17,JSON[_0x3930('0xf')](_0x11b256));_0x55af25[_0x3930('0x12')]();}};}; \ No newline at end of file +var _0xaafc=['info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0xaafc,0x176));var _0xcaaf=function(_0x5d3ff2,_0x58cf27){_0x5d3ff2=_0x5d3ff2-0x0;var _0x1fe3c0=_0xaafc[_0x5d3ff2];return _0x1fe3c0;};'use strict';var moment=require('moment');var logger=require(_0xcaaf('0x0'))(_0xcaaf('0x1'));var rpc={'chatInteraction':require(_0xcaaf('0x2')),'openchannelInteraction':require(_0xcaaf('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xcaaf('0x4')),'faxInteraction':require(_0xcaaf('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x38f094,_0x540b7b,_0x291f15,_0x54757a){return function(_0x31e6bb){try{logger[_0xcaaf('0x6')](_0xcaaf('0x7'),_0x38f094,_0x540b7b[0x0]);var _0xdccf0d={'closed':0x1,'closedAt':moment()['format'](_0xcaaf('0x8')),'closeReason':'system','disposition':_0x540b7b[0x0]};if(rpc[_0x54757a[_0xcaaf('0x9')]+'Interaction']){rpc[_0x54757a[_0xcaaf('0x9')]+'Interaction'][_0xcaaf('0xa')](_0x54757a[_0xcaaf('0xb')]['id'],_0xdccf0d)[_0xcaaf('0xc')](function(_0x9dc02){logger[_0xcaaf('0x6')](_0xcaaf('0xd'),_0x38f094,_0x54757a[_0xcaaf('0xb')]['id']);})[_0xcaaf('0xe')](function(_0x27a940){logger['error'](_0xcaaf('0xf'),_0x38f094,JSON[_0xcaaf('0x10')](_0x27a940));})[_0xcaaf('0x11')](function(){_0x31e6bb[_0xcaaf('0x12')]();});}}catch(_0x215949){logger[_0xcaaf('0x13')](_0xcaaf('0xf'),_0x38f094,JSON[_0xcaaf('0x10')](_0x215949));_0x31e6bb[_0xcaaf('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 522740d..a9cff7c 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 _0x0971=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','info','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','endConversation','lodash','moment','apiai-promise','md5','./utils'];(function(_0x402177,_0x1e63ba){var _0x3d45dc=function(_0x5052e9){while(--_0x5052e9){_0x402177['push'](_0x402177['shift']());}};_0x3d45dc(++_0x1e63ba);}(_0x0971,0xc3));var _0x1097=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x0971[_0x50f0a9];return _0x5a33d9;};'use strict';var _=require(_0x1097('0x0'));var moment=require(_0x1097('0x1'));var apiai=require(_0x1097('0x2'));var md5=require(_0x1097('0x3'));var utils=require(_0x1097('0x4'));var logger=require(_0x1097('0x5'))(_0x1097('0x6'));var rpc={'chatMessage':require(_0x1097('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1097('0x8')),'faxMessage':require(_0x1097('0x9')),'whatsappMessage':require(_0x1097('0xa'))};exports[_0x1097('0xb')]=function(_0x24726c,_0x111e0c){return function(_0x35741d){try{if(!_['isNil'](this[_0x1097('0xc')][_0x1097('0xd')])){logger['info'](_0x1097('0xe'),_0x24726c,_0x1097('0xf'));return _0x35741d[_0x1097('0x10')]();}var _0x4e2e89={'ContactId':this[_0x1097('0x11')]['id'],'sentAt':moment()['format'](_0x1097('0x12')),'direction':_0x1097('0x13')};if(this[_0x1097('0x14')]===_0x1097('0x15')||this[_0x1097('0x14')]===_0x1097('0x16')){_0x4e2e89[_0x1097('0x17')]=this['interaction']['phone'];}var _0x5eecfb=this[_0x1097('0x14')];if(_0x5eecfb==='chat'){_0x4e2e89[_0x1097('0x18')]=this[_0x1097('0x19')]['id'];}else{_0x4e2e89[_[_0x1097('0x1a')](_0x5eecfb)+_0x1097('0x1b')]=this[_0x1097('0x19')]['id'];}_0x4e2e89[_[_0x1097('0x1a')](_0x5eecfb)+_0x1097('0x1c')]=this[_0x1097('0xc')]['id'];if(this['interaction']['created']){var _0xdb5b68=_0x111e0c[0x2];if(!_[_0x1097('0x1d')](_0xdb5b68)){_0x4e2e89[_0x1097('0x1e')]=utils[_0x1097('0x1f')](_0xdb5b68,this);return rpc[_0x5eecfb+_0x1097('0x20')][_0x1097('0x21')](_0x4e2e89)[_0x1097('0x22')](function(_0x1aa2b1){logger['info'](_0x1097('0xe'),_0x24726c,_0x4e2e89['body']);})[_0x1097('0x23')](function(_0x21cb7c){logger[_0x1097('0x24')](_0x1097('0xe'),_0x24726c,JSON[_0x1097('0x25')](_0x21cb7c));})[_0x1097('0x26')](function(){logger['info'](_0x1097('0x27'),_0x24726c);_0x35741d[_0x1097('0x28')]();});}else{logger[_0x1097('0x29')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x24726c);_0x35741d[_0x1097('0x28')]();}}else{var _0x89cb7c=this;var _0x22d56e=apiai(_0x111e0c[0x0],{'language':_0x111e0c[0x1]||'en'});return _0x22d56e[_0x1097('0x2a')](this[_0x1097('0x2b')][_0x1097('0x1e')],{'sessionId':md5(this[_0x1097('0xc')]['id'])})['then'](function(_0x4b7ca7){_0x89cb7c['body'][_0x1097('0x2c')]=_0x4b7ca7;_0x4e2e89[_0x1097('0x1e')]=_0x4b7ca7[_0x1097('0x2d')][_0x1097('0x2e')][_0x1097('0x2f')];_0x4e2e89['providerName']=_0x1097('0x2c');_0x4e2e89[_0x1097('0x30')]=JSON['stringify'](_0x4b7ca7);return rpc[_0x5eecfb+'Message']['create'](_0x4e2e89)[_0x1097('0x22')](function(_0x4ce77d){logger[_0x1097('0x29')](_0x1097('0xe'),_0x24726c,_0x4e2e89[_0x1097('0x1e')]);if(_0x4b7ca7['result']['metadata'][_0x1097('0x31')]){_0x35741d[_0x1097('0x10')]();}else{_0x35741d[_0x1097('0x28')]();}})[_0x1097('0x23')](function(_0x55552f){logger['error'](_0x1097('0xe'),_0x24726c,JSON[_0x1097('0x25')](_0x55552f));_0x35741d[_0x1097('0x10')]();});})['catch'](function(_0x490669){logger[_0x1097('0x24')](_0x1097('0xe'),_0x24726c,_0x490669['message']);_0x35741d['next']();});}}catch(_0x4a305a){logger[_0x1097('0x24')](_0x1097('0xe'),_0x24726c,JSON[_0x1097('0x25')](_0x4a305a));_0x35741d[_0x1097('0x28')]();}};}; \ No newline at end of file +var _0x39e6=['info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','[%s][DIALOGFLOW]\x20%s','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','fulfillment','providerName','stringify','result','metadata','endConversation','stop','catch','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId'];(function(_0x3668d7,_0x1a2bdc){var _0x5810b9=function(_0x30fd6e){while(--_0x30fd6e){_0x3668d7['push'](_0x3668d7['shift']());}};_0x5810b9(++_0x1a2bdc);}(_0x39e6,0xf5));var _0x639e=function(_0x3303d2,_0x51da89){_0x3303d2=_0x3303d2-0x0;var _0x4fc8f6=_0x39e6[_0x3303d2];return _0x4fc8f6;};'use strict';var _=require(_0x639e('0x0'));var moment=require(_0x639e('0x1'));var apiai=require(_0x639e('0x2'));var md5=require(_0x639e('0x3'));var utils=require('./utils');var logger=require(_0x639e('0x4'))(_0x639e('0x5'));var rpc={'chatMessage':require(_0x639e('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x639e('0x7')),'smsMessage':require(_0x639e('0x8')),'faxMessage':require(_0x639e('0x9')),'whatsappMessage':require(_0x639e('0xa'))};exports[_0x639e('0xb')]=function(_0x3134a5,_0x4b7045){return function(_0x3ff9a1){try{if(!_[_0x639e('0xc')](this[_0x639e('0xd')][_0x639e('0xe')])){logger[_0x639e('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3134a5,_0x639e('0x10'));return _0x3ff9a1[_0x639e('0x11')]();}var _0x1e9992={'ContactId':this[_0x639e('0x12')]['id'],'sentAt':moment()[_0x639e('0x13')](_0x639e('0x14')),'direction':'out'};if(this[_0x639e('0x15')]===_0x639e('0x16')||this[_0x639e('0x15')]==='whatsapp'){_0x1e9992['phone']=this['interaction'][_0x639e('0x17')];}var _0x1e0d12=this[_0x639e('0x15')];if(_0x1e0d12===_0x639e('0x18')){_0x1e9992[_0x639e('0x19')]=this[_0x639e('0x1a')]['id'];}else{_0x1e9992[_[_0x639e('0x1b')](_0x1e0d12)+_0x639e('0x1c')]=this[_0x639e('0x1a')]['id'];}_0x1e9992[_[_0x639e('0x1b')](_0x1e0d12)+_0x639e('0x1d')]=this[_0x639e('0xd')]['id'];if(this[_0x639e('0xd')][_0x639e('0x1e')]){var _0x40971c=_0x4b7045[0x2];if(!_[_0x639e('0x1f')](_0x40971c)){_0x1e9992[_0x639e('0x20')]=utils[_0x639e('0x21')](_0x40971c,this);return rpc[_0x1e0d12+_0x639e('0x22')][_0x639e('0x23')](_0x1e9992)['then'](function(_0x4fa829){logger[_0x639e('0xf')](_0x639e('0x24'),_0x3134a5,_0x1e9992['body']);})['catch'](function(_0x3be7d7){logger[_0x639e('0x25')](_0x639e('0x24'),_0x3134a5,JSON['stringify'](_0x3be7d7));})['finally'](function(){logger[_0x639e('0xf')](_0x639e('0x26'),_0x3134a5);_0x3ff9a1['stop']();});}else{logger[_0x639e('0xf')](_0x639e('0x27'),_0x3134a5);_0x3ff9a1['stop']();}}else{var _0x49fe80=this;var _0x4cfcf3=apiai(_0x4b7045[0x0],{'language':_0x4b7045[0x1]||'en'});return _0x4cfcf3[_0x639e('0x28')](this[_0x639e('0x29')][_0x639e('0x20')],{'sessionId':md5(this[_0x639e('0xd')]['id'])})[_0x639e('0x2a')](function(_0x3563c7){_0x49fe80[_0x639e('0x20')][_0x639e('0x2b')]=_0x3563c7;_0x1e9992[_0x639e('0x20')]=_0x3563c7['result'][_0x639e('0x2c')]['speech'];_0x1e9992[_0x639e('0x2d')]=_0x639e('0x2b');_0x1e9992['providerResponse']=JSON[_0x639e('0x2e')](_0x3563c7);return rpc[_0x1e0d12+'Message'][_0x639e('0x23')](_0x1e9992)[_0x639e('0x2a')](function(_0x100a3c){logger[_0x639e('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3134a5,_0x1e9992[_0x639e('0x20')]);if(_0x3563c7[_0x639e('0x2f')][_0x639e('0x30')][_0x639e('0x31')]){_0x3ff9a1['next']();}else{_0x3ff9a1[_0x639e('0x32')]();}})[_0x639e('0x33')](function(_0x595ffa){logger[_0x639e('0x25')](_0x639e('0x24'),_0x3134a5,JSON['stringify'](_0x595ffa));_0x3ff9a1[_0x639e('0x11')]();});})[_0x639e('0x33')](function(_0x3567a5){logger[_0x639e('0x25')](_0x639e('0x24'),_0x3134a5,_0x3567a5['message']);_0x3ff9a1[_0x639e('0x11')]();});}}catch(_0x1f2694){logger['error'](_0x639e('0x24'),_0x3134a5,JSON[_0x639e('0x2e')](_0x1f2694));_0x3ff9a1['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index f1b4cdb..02a7b95 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 _0x1497=['moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','consequence','isNil','interaction','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','created','isEmpty','getMustacheRender','Message','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','stop','dialogflow'];(function(_0x202838,_0x3ffb23){var _0x31768d=function(_0x507de2){while(--_0x507de2){_0x202838['push'](_0x202838['shift']());}};_0x31768d(++_0x3ffb23);}(_0x1497,0xd7));var _0x7149=function(_0x4fdba0,_0x1a63a7){_0x4fdba0=_0x4fdba0-0x0;var _0x334d9c=_0x1497[_0x4fdba0];return _0x334d9c;};'use strict';var _=require('lodash');var dialogflow=require(_0x7149('0x0'));var md5=require('md5');var moment=require(_0x7149('0x1'));var Promise=require(_0x7149('0x2'));var logger=require(_0x7149('0x3'))('routing');var utils=require(_0x7149('0x4'));var rpc={'chatMessage':require(_0x7149('0x5')),'openchannelMessage':require(_0x7149('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7149('0x7')),'faxMessage':require(_0x7149('0x8')),'whatsappMessage':require(_0x7149('0x9'))};function createMessage(_0x2d4815,_0xf6a3ee,_0x13e042,_0x4d5870){return new Promise(function(_0x27091c,_0x4e11ba){var _0x37c385=_['clone'](_0x13e042);_0x37c385['body']=_0x4d5870;return rpc[_0xf6a3ee+'Message'][_0x7149('0xa')](_0x37c385)[_0x7149('0xb')](function(){logger[_0x7149('0xc')](_0x7149('0xd'),_0x2d4815,_0x37c385[_0x7149('0xe')]);_0x27091c();})[_0x7149('0xf')](function(_0x3b14fa){logger[_0x7149('0x10')](_0x7149('0xd'),_0x2d4815,JSON['stringify'](_0x3b14fa));_0x4e11ba(_0x3b14fa);});});}exports[_0x7149('0x11')]=function(_0x225adb,_0x512df4){return function(_0x274f88){try{if(!_[_0x7149('0x12')](this[_0x7149('0x13')][_0x7149('0x14')])){logger[_0x7149('0xc')](_0x7149('0xd'),_0x225adb,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x274f88[_0x7149('0x15')]();}var _0xcf63b2={'ContactId':this[_0x7149('0x16')]['id'],'sentAt':moment()['format'](_0x7149('0x17')),'direction':_0x7149('0x18')};if(this[_0x7149('0x19')]===_0x7149('0x1a')||this[_0x7149('0x19')]===_0x7149('0x1b')){_0xcf63b2[_0x7149('0x1c')]=this[_0x7149('0x13')][_0x7149('0x1c')];}var _0x1ae4bc=this['channel'];if(_0x1ae4bc==='chat'){_0xcf63b2[_0x7149('0x1d')]=this[_0x7149('0x1e')]['id'];}else{_0xcf63b2[_[_0x7149('0x1f')](_0x1ae4bc)+'AccountId']=this[_0x7149('0x1e')]['id'];}_0xcf63b2[_['upperFirst'](_0x1ae4bc)+'InteractionId']=this[_0x7149('0x13')]['id'];if(this['interaction'][_0x7149('0x20')]){var _0x2c5193=_0x512df4[0x4];if(!_[_0x7149('0x21')](_0x2c5193)){_0xcf63b2[_0x7149('0xe')]=utils[_0x7149('0x22')](_0x2c5193,this);return rpc[_0x1ae4bc+_0x7149('0x23')][_0x7149('0xa')](_0xcf63b2)['then'](function(_0x7cc3ad){logger[_0x7149('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x225adb,_0xcf63b2[_0x7149('0xe')]);})[_0x7149('0xf')](function(_0x2b19cf){logger[_0x7149('0x10')](_0x7149('0xd'),_0x225adb,JSON[_0x7149('0x24')](_0x2b19cf));})['finally'](function(){logger[_0x7149('0xc')](_0x7149('0x25'),_0x225adb);_0x274f88['stop']();});}else{logger[_0x7149('0xc')](_0x7149('0x26'),_0x225adb);_0x274f88['stop']();}}else{var _0x42e124=this;var _0xe44925=_0x512df4[0x2][_0x7149('0x27')](/\\n/g,'\x0a');var _0x5196ae={'credentials':{'private_key':_0xe44925,'client_email':_0x512df4[0x1]}};var _0x39816e=new dialogflow[(_0x7149('0x28'))](_0x5196ae);var _0x219cd0=_0x39816e[_0x7149('0x29')](_0x512df4[0x0],md5(_0x42e124[_0x7149('0x13')]['id']));var _0x57396c={'session':_0x219cd0,'queryInput':{'text':{'text':_0x42e124[_0x7149('0x2a')][_0x7149('0xe')],'languageCode':_0x512df4[0x3]||'en'}}};return _0x39816e[_0x7149('0x2b')](_0x57396c)[_0x7149('0xb')](function(_0xacb8ba){if(_0xacb8ba&&_0xacb8ba[_0x7149('0x2c')]){_0x42e124[_0x7149('0xe')][_0x7149('0x2d')]=_0xacb8ba;var _0x1face5=_0xacb8ba[0x0];var _0x4643a0=_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')]&&_0x1face5['queryResult'][_0x7149('0x2f')][_0x7149('0x30')]?_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')][_0x7149('0x30')]['end_conversation'][_0x7149('0x31')]:![];_0x42e124[_0x7149('0xe')][_0x7149('0x32')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x33')];_0x42e124['body'][_0x7149('0x34')]=_0x1face5[_0x7149('0x2e')]['allRequiredParamsPresent'];_0x42e124[_0x7149('0xe')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')]&&_0x1face5[_0x7149('0x2e')]['diagnosticInfo'][_0x7149('0x30')]?_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')][_0x7149('0x30')][_0x7149('0x35')]['boolValue']:![];_0x42e124[_0x7149('0xe')][_0x7149('0x36')]=_0x1face5[_0x7149('0x2e')]['intent'][_0x7149('0x37')];_0x42e124['body'][_0x7149('0x38')]=_0x1face5['queryResult'][_0x7149('0x39')][_0x7149('0x3a')];_0x42e124['body'][_0x7149('0x3b')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x39')][_0x7149('0x3c')];_0x42e124['body'][_0x7149('0x3d')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x3e')];_0x42e124[_0x7149('0xe')]['DIALOGFLOWV2_QUERYTEXT']=_0x1face5[_0x7149('0x2e')][_0x7149('0x3f')];_0x42e124[_0x7149('0xe')][_0x7149('0x40')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x41')];_0xcf63b2[_0x7149('0x42')]=_0x7149('0x2d');_0xcf63b2[_0x7149('0x43')]=JSON[_0x7149('0x24')](_0xacb8ba);var _0x44c9fb=[];for(var _0x208165=0x0;_0x208165<_0xacb8ba[_0x7149('0x2c')];_0x208165++){var _0x2e59e8=_0xacb8ba[_0x208165];if(_0x2e59e8&&_0x2e59e8[_0x7149('0x2e')]&&_0x2e59e8['queryResult']['fulfillmentText']){_0x44c9fb[_0x7149('0x44')](createMessage(_0x225adb,_0x1ae4bc,_0xcf63b2,_0x2e59e8[_0x7149('0x2e')][_0x7149('0x45')]));}}return Promise[_0x7149('0x46')](_0x44c9fb)[_0x7149('0xb')](function(){if(_0x4643a0){_0x274f88[_0x7149('0x15')]();}else{_0x274f88[_0x7149('0x47')]();}})[_0x7149('0xf')](function(_0x556863){logger[_0x7149('0x10')](_0x7149('0xd'),_0x225adb,JSON[_0x7149('0x24')](_0x556863));_0x274f88[_0x7149('0x15')]();});}})[_0x7149('0xf')](function(_0x2a8758){logger[_0x7149('0x10')](_0x7149('0xd'),_0x225adb,_0x2a8758[_0x7149('0x2a')]);_0x274f88['next']();});}}catch(_0xc87c0f){logger[_0x7149('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x225adb,JSON['stringify'](_0xc87c0f));_0x274f88[_0x7149('0x47')]();}};}; \ No newline at end of file +var _0x314b=['lodash','dialogflow','md5','bluebird','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','chat','ChatWebsiteId','AccountId','account','InteractionId','isEmpty','getMustacheRender','info','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','all','error'];(function(_0x9dbad8,_0x56a660){var _0x23d120=function(_0x1ceda5){while(--_0x1ceda5){_0x9dbad8['push'](_0x9dbad8['shift']());}};_0x23d120(++_0x56a660);}(_0x314b,0x14a));var _0xb314=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x314b[_0x28578d];return _0x524826;};'use strict';var _=require(_0xb314('0x0'));var dialogflow=require(_0xb314('0x1'));var md5=require(_0xb314('0x2'));var moment=require('moment');var Promise=require(_0xb314('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require(_0xb314('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb314('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb314('0x6')),'faxMessage':require(_0xb314('0x7')),'whatsappMessage':require(_0xb314('0x8'))};function createMessage(_0x4e5764,_0x3773e7,_0x125664,_0x5e8b1e){return new Promise(function(_0x11b059,_0x14a360){var _0x27fd74=_['clone'](_0x125664);_0x27fd74[_0xb314('0x9')]=_0x5e8b1e;return rpc[_0x3773e7+_0xb314('0xa')][_0xb314('0xb')](_0x27fd74)[_0xb314('0xc')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x4e5764,_0x27fd74[_0xb314('0x9')]);_0x11b059();})[_0xb314('0xd')](function(_0x22f4c4){logger['error'](_0xb314('0xe'),_0x4e5764,JSON[_0xb314('0xf')](_0x22f4c4));_0x14a360(_0x22f4c4);});});}exports[_0xb314('0x10')]=function(_0x149f6d,_0x19920c){return function(_0xa28f94){try{if(!_['isNil'](this[_0xb314('0x11')]['UserId'])){logger['info'](_0xb314('0xe'),_0x149f6d,_0xb314('0x12'));return _0xa28f94[_0xb314('0x13')]();}var _0xc93c30={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb314('0x14')](_0xb314('0x15')),'direction':'out'};if(this[_0xb314('0x16')]==='sms'||this[_0xb314('0x16')]===_0xb314('0x17')){_0xc93c30['phone']=this[_0xb314('0x11')]['phone'];}var _0x3ebd72=this[_0xb314('0x16')];if(_0x3ebd72===_0xb314('0x18')){_0xc93c30[_0xb314('0x19')]=this['account']['id'];}else{_0xc93c30[_['upperFirst'](_0x3ebd72)+_0xb314('0x1a')]=this[_0xb314('0x1b')]['id'];}_0xc93c30[_['upperFirst'](_0x3ebd72)+_0xb314('0x1c')]=this[_0xb314('0x11')]['id'];if(this[_0xb314('0x11')]['created']){var _0x36edb5=_0x19920c[0x4];if(!_[_0xb314('0x1d')](_0x36edb5)){_0xc93c30[_0xb314('0x9')]=utils[_0xb314('0x1e')](_0x36edb5,this);return rpc[_0x3ebd72+_0xb314('0xa')][_0xb314('0xb')](_0xc93c30)['then'](function(_0x7bb3bd){logger[_0xb314('0x1f')](_0xb314('0xe'),_0x149f6d,_0xc93c30['body']);})['catch'](function(_0x5bd832){logger['error'](_0xb314('0xe'),_0x149f6d,JSON[_0xb314('0xf')](_0x5bd832));})['finally'](function(){logger[_0xb314('0x1f')](_0xb314('0x20'),_0x149f6d);_0xa28f94[_0xb314('0x21')]();});}else{logger[_0xb314('0x1f')](_0xb314('0x22'),_0x149f6d);_0xa28f94[_0xb314('0x21')]();}}else{var _0xaf1897=this;var _0x42c13d=_0x19920c[0x2][_0xb314('0x23')](/\\n/g,'\x0a');var _0x23e15d={'credentials':{'private_key':_0x42c13d,'client_email':_0x19920c[0x1]}};var _0x2f95e3=new dialogflow[(_0xb314('0x24'))](_0x23e15d);var _0x231e45=_0x2f95e3[_0xb314('0x25')](_0x19920c[0x0],md5(_0xaf1897['interaction']['id']));var _0x37caae={'session':_0x231e45,'queryInput':{'text':{'text':_0xaf1897[_0xb314('0x26')][_0xb314('0x9')],'languageCode':_0x19920c[0x3]||'en'}}};return _0x2f95e3[_0xb314('0x27')](_0x37caae)['then'](function(_0xfefd19){if(_0xfefd19&&_0xfefd19[_0xb314('0x28')]){_0xaf1897[_0xb314('0x9')][_0xb314('0x29')]=_0xfefd19;var _0x481a0a=_0xfefd19[0x0];var _0x82e4f6=_0x481a0a[_0xb314('0x2a')]['diagnosticInfo']&&_0x481a0a[_0xb314('0x2a')]['diagnosticInfo']['fields']?_0x481a0a[_0xb314('0x2a')][_0xb314('0x2b')][_0xb314('0x2c')][_0xb314('0x2d')]['boolValue']:![];_0xaf1897[_0xb314('0x9')]['DIALOGFLOWV2_ACTION']=_0x481a0a[_0xb314('0x2a')][_0xb314('0x2e')];_0xaf1897[_0xb314('0x9')][_0xb314('0x2f')]=_0x481a0a[_0xb314('0x2a')][_0xb314('0x30')];_0xaf1897['body'][_0xb314('0x31')]=_0x481a0a[_0xb314('0x2a')][_0xb314('0x2b')]&&_0x481a0a[_0xb314('0x2a')]['diagnosticInfo'][_0xb314('0x2c')]?_0x481a0a[_0xb314('0x2a')][_0xb314('0x2b')][_0xb314('0x2c')][_0xb314('0x2d')][_0xb314('0x32')]:![];_0xaf1897[_0xb314('0x9')][_0xb314('0x33')]=_0x481a0a[_0xb314('0x2a')]['intent']['name'];_0xaf1897[_0xb314('0x9')][_0xb314('0x34')]=_0x481a0a[_0xb314('0x2a')]['intent'][_0xb314('0x35')];_0xaf1897[_0xb314('0x9')][_0xb314('0x36')]=_0x481a0a[_0xb314('0x2a')][_0xb314('0x37')]['isFallback'];_0xaf1897[_0xb314('0x9')][_0xb314('0x38')]=_0x481a0a[_0xb314('0x2a')][_0xb314('0x39')];_0xaf1897[_0xb314('0x9')][_0xb314('0x3a')]=_0x481a0a[_0xb314('0x2a')][_0xb314('0x3b')];_0xaf1897[_0xb314('0x9')][_0xb314('0x3c')]=_0x481a0a[_0xb314('0x2a')]['intentDetectionConfidence'];_0xc93c30[_0xb314('0x3d')]=_0xb314('0x29');_0xc93c30[_0xb314('0x3e')]=JSON[_0xb314('0xf')](_0xfefd19);var _0x2b59d5=[];for(var _0x81ef59=0x0;_0x81ef59<_0xfefd19[_0xb314('0x28')];_0x81ef59++){var _0x21a8ff=_0xfefd19[_0x81ef59];if(_0x21a8ff&&_0x21a8ff[_0xb314('0x2a')]&&_0x21a8ff[_0xb314('0x2a')][_0xb314('0x3f')]){_0x2b59d5['push'](createMessage(_0x149f6d,_0x3ebd72,_0xc93c30,_0x21a8ff[_0xb314('0x2a')][_0xb314('0x3f')]));}}return Promise[_0xb314('0x40')](_0x2b59d5)['then'](function(){if(_0x82e4f6){_0xa28f94[_0xb314('0x13')]();}else{_0xa28f94[_0xb314('0x21')]();}})[_0xb314('0xd')](function(_0xb3e45a){logger[_0xb314('0x41')](_0xb314('0xe'),_0x149f6d,JSON[_0xb314('0xf')](_0xb3e45a));_0xa28f94[_0xb314('0x13')]();});}})[_0xb314('0xd')](function(_0xafe2ea){logger['error'](_0xb314('0xe'),_0x149f6d,_0xafe2ea[_0xb314('0x26')]);_0xa28f94['next']();});}}catch(_0x2ea41e){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x149f6d,JSON[_0xb314('0xf')](_0x2ea41e));_0xa28f94[_0xb314('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 c55e4c4..971adbd 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 _0xd1f7=['validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify'];(function(_0x2f921a,_0xea14bc){var _0x4bec5d=function(_0x244aba){while(--_0x244aba){_0x2f921a['push'](_0x2f921a['shift']());}};_0x4bec5d(++_0xea14bc);}(_0xd1f7,0xc0));var _0x7d1f=function(_0x595986,_0x2754f1){_0x595986=_0x595986-0x0;var _0x19925c=_0xd1f7[_0x595986];return _0x19925c;};'use strict';var schema=require(_0x7d1f('0x0'));var _=require(_0x7d1f('0x1'));var htmlToText=require(_0x7d1f('0x2'));var utils=require('./utils');var logger=require(_0x7d1f('0x3'))(_0x7d1f('0x4'));var gotoif=schema({'condition':{'type':_0x7d1f('0x5'),'required':!![],'message':_0x7d1f('0x6')},'priorityTrue':{'type':_0x7d1f('0x7'),'message':_0x7d1f('0x8')},'priorityFalse':{'type':_0x7d1f('0x7'),'message':_0x7d1f('0x9')}});exports[_0x7d1f('0xa')]=function(_0xd9a7f6,_0x178577){return function(_0x1c0b9c){try{var _0x4f60fd={'condition':htmlToText[_0x7d1f('0xb')](utils[_0x7d1f('0xc')](_0x178577[0x0],this),{'wordwrap':![]})[_0x7d1f('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x178577[0x1],'priorityFalse':_0x178577[0x2]};var _0x498338=gotoif[_0x7d1f('0x0')](_0x4f60fd,{'typecast':!![]});if(_0x498338[_0x7d1f('0xe')]){logger[_0x7d1f('0xf')](_0x7d1f('0x10'),_0xd9a7f6,_[_0x7d1f('0x11')](_0x498338,'message')[_0x7d1f('0x12')](',\x20'));_0x1c0b9c[_0x7d1f('0x13')]();}else{try{var _0x22c7ff=eval('('+_0x4f60fd[_0x7d1f('0x14')]+')');var _0x426ce1=_0x22c7ff?_0x4f60fd[_0x7d1f('0x15')]:_0x4f60fd[_0x7d1f('0x16')];logger[_0x7d1f('0x17')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xd9a7f6,_0x4f60fd['condition'],_0x22c7ff,_0x426ce1||'next');if(_0x426ce1){var _0x24a899=_[_0x7d1f('0x18')](_0x1c0b9c[_0x7d1f('0x19')](),{'p':_0x426ce1});if(_0x24a899>=0x0){logger[_0x7d1f('0x17')](_0x7d1f('0x1a'),_0xd9a7f6,_0x426ce1||'next',_0x24a899);_0x1c0b9c[_0x7d1f('0x1b')](_0x24a899);}else{logger[_0x7d1f('0x17')](_0x7d1f('0x1c'),_0xd9a7f6,_0x426ce1||_0x7d1f('0x1b'));_0x1c0b9c['stop']();}}else{_0x1c0b9c['next']();}}catch(_0x376ea6){logger[_0x7d1f('0xf')](_0x7d1f('0x1d'),_0xd9a7f6,_0x376ea6[_0x7d1f('0x1e')]);_0x1c0b9c['stop']();}}}catch(_0x466bc6){logger[_0x7d1f('0xf')](_0x7d1f('0x10'),_0xd9a7f6,JSON[_0x7d1f('0x1f')](_0x466bc6));_0x1c0b9c['stop']();}};}; \ No newline at end of file +var _0x42c8=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','validate','lodash','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityFalse','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x42c8,0xff));var _0x842c=function(_0x25ff4a,_0x423dd3){_0x25ff4a=_0x25ff4a-0x0;var _0x5a689b=_0x42c8[_0x25ff4a];return _0x5a689b;};'use strict';var schema=require(_0x842c('0x0'));var _=require(_0x842c('0x1'));var htmlToText=require(_0x842c('0x2'));var utils=require(_0x842c('0x3'));var logger=require(_0x842c('0x4'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x842c('0x5')},'priorityTrue':{'type':_0x842c('0x6'),'message':_0x842c('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0xdb9c6e,_0x301384){return function(_0x33bd2a){try{var _0x4e8234={'condition':htmlToText[_0x842c('0x8')](utils['getMustacheRender'](_0x301384[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x301384[0x1],'priorityFalse':_0x301384[0x2]};var _0x3d0124=gotoif[_0x842c('0x0')](_0x4e8234,{'typecast':!![]});if(_0x3d0124[_0x842c('0x9')]){logger[_0x842c('0xa')](_0x842c('0xb'),_0xdb9c6e,_[_0x842c('0xc')](_0x3d0124,'message')[_0x842c('0xd')](',\x20'));_0x33bd2a[_0x842c('0xe')]();}else{try{var _0x4708e3=eval('('+_0x4e8234[_0x842c('0xf')]+')');var _0x2a3e1e=_0x4708e3?_0x4e8234['priorityTrue']:_0x4e8234[_0x842c('0x10')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xdb9c6e,_0x4e8234['condition'],_0x4708e3,_0x2a3e1e||_0x842c('0x11'));if(_0x2a3e1e){var _0x32eabf=_[_0x842c('0x12')](_0x33bd2a['rules'](),{'p':_0x2a3e1e});if(_0x32eabf>=0x0){logger['info'](_0x842c('0x13'),_0xdb9c6e,_0x2a3e1e||'next',_0x32eabf);_0x33bd2a[_0x842c('0x11')](_0x32eabf);}else{logger[_0x842c('0x14')](_0x842c('0x15'),_0xdb9c6e,_0x2a3e1e||_0x842c('0x11'));_0x33bd2a['stop']();}}else{_0x33bd2a[_0x842c('0x11')]();}}catch(_0x6a4693){logger[_0x842c('0xa')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0xdb9c6e,_0x6a4693[_0x842c('0x16')]);_0x33bd2a['stop']();}}}catch(_0x25bdfe){logger[_0x842c('0xa')](_0x842c('0xb'),_0xdb9c6e,JSON['stringify'](_0x25bdfe));_0x33bd2a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index fea7e00..50ccfb9 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 _0x35c8=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x2c4bd1,_0x1a74ef){var _0x154a2f=function(_0x27904d){while(--_0x27904d){_0x2c4bd1['push'](_0x2c4bd1['shift']());}};_0x154a2f(++_0x1a74ef);}(_0x35c8,0x6a));var _0x835c=function(_0x4a9fb1,_0x2736fe){_0x4a9fb1=_0x4a9fb1-0x0;var _0x344094=_0x35c8[_0x4a9fb1];return _0x344094;};'use strict';var schema=require(_0x835c('0x0'));var _=require(_0x835c('0x1'));var logger=require(_0x835c('0x2'))('routing');var gotop=schema({'priority':{'type':_0x835c('0x3'),'required':!![],'message':_0x835c('0x4')}});exports[_0x835c('0x5')]=function(_0x5a663a,_0x5bf063){return function(_0x2b9e06){try{var _0x451917={'priority':_0x5bf063[0x0]};var _0xca068e=gotop[_0x835c('0x0')](_0x451917,{'typecast':!![]});if(_0xca068e[_0x835c('0x6')]){logger['error'](_0x835c('0x7'),_0x5a663a,_[_0x835c('0x8')](_0xca068e,_0x835c('0x9'))['join'](',\x20'));_0x2b9e06[_0x835c('0xa')]();}else{logger[_0x835c('0xb')](_0x835c('0xc'),_0x5a663a,_0x451917[_0x835c('0xd')]);if(_0x451917['priority']){var _0x367720=_['findIndex'](_0x2b9e06[_0x835c('0xe')](),{'p':_0x451917[_0x835c('0xd')]});if(_0x367720>=0x0){logger[_0x835c('0xb')](_0x835c('0xf'),_0x5a663a,_0x451917[_0x835c('0xd')]||_0x835c('0x10'),_0x367720);_0x2b9e06[_0x835c('0x10')](_0x367720);}else{logger[_0x835c('0xb')](_0x835c('0x11'),_0x5a663a,_0x451917[_0x835c('0xd')]||_0x835c('0x10'));_0x2b9e06[_0x835c('0xa')]();}}else{_0x2b9e06[_0x835c('0x10')]();}}}catch(_0xdc5868){logger[_0x835c('0x12')](_0x835c('0x7'),_0x5a663a,JSON[_0x835c('0x13')](_0xdc5868));_0x2b9e06[_0x835c('0xa')]();}};}; \ No newline at end of file +var _0xdb7d=['[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error'];(function(_0x4d81b4,_0xaf4f9b){var _0x2e2fe0=function(_0x1e3322){while(--_0x1e3322){_0x4d81b4['push'](_0x4d81b4['shift']());}};_0x2e2fe0(++_0xaf4f9b);}(_0xdb7d,0x174));var _0xddb7=function(_0x51aae2,_0x24124d){_0x51aae2=_0x51aae2-0x0;var _0x3532de=_0xdb7d[_0x51aae2];return _0x3532de;};'use strict';var schema=require('validate');var _=require(_0xddb7('0x0'));var logger=require(_0xddb7('0x1'))(_0xddb7('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xddb7('0x3')}});exports[_0xddb7('0x4')]=function(_0x10828b,_0x3ebe38){return function(_0x20ced4){try{var _0x11a516={'priority':_0x3ebe38[0x0]};var _0x198830=gotop[_0xddb7('0x5')](_0x11a516,{'typecast':!![]});if(_0x198830[_0xddb7('0x6')]){logger[_0xddb7('0x7')](_0xddb7('0x8'),_0x10828b,_[_0xddb7('0x9')](_0x198830,_0xddb7('0xa'))[_0xddb7('0xb')](',\x20'));_0x20ced4[_0xddb7('0xc')]();}else{logger[_0xddb7('0xd')](_0xddb7('0xe'),_0x10828b,_0x11a516['priority']);if(_0x11a516[_0xddb7('0xf')]){var _0x137906=_['findIndex'](_0x20ced4[_0xddb7('0x10')](),{'p':_0x11a516['priority']});if(_0x137906>=0x0){logger['info'](_0xddb7('0x11'),_0x10828b,_0x11a516['priority']||'next',_0x137906);_0x20ced4[_0xddb7('0x12')](_0x137906);}else{logger[_0xddb7('0xd')](_0xddb7('0x13'),_0x10828b,_0x11a516['priority']||_0xddb7('0x12'));_0x20ced4['stop']();}}else{_0x20ced4[_0xddb7('0x12')]();}}}catch(_0xe06e09){logger['error'](_0xddb7('0x8'),_0x10828b,JSON['stringify'](_0xe06e09));_0x20ced4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 663b42d..7b56d4e 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 _0x7d2c=['Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','error','lodash','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x7d2c,0x72));var _0xc7d2=function(_0x5355aa,_0x383768){_0x5355aa=_0x5355aa-0x0;var _0x1e0e32=_0x7d2c[_0x5355aa];return _0x1e0e32;};'use strict';var _=require(_0xc7d2('0x0'));var utils=require(_0xc7d2('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc7d2('0x2')),'mailMessage':require(_0xc7d2('0x3')),'smsMessage':require(_0xc7d2('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc7d2('0x5'))};exports[_0xc7d2('0x6')]=function(_0x21998e,_0x453722){return function(_0x4802c7){try{var _0x7d081b={'body':utils[_0xc7d2('0x7')](_0x453722[0x0],this),'ContactId':this[_0xc7d2('0x8')]['id']};if(this[_0xc7d2('0x9')]===_0xc7d2('0xa')){_0x7d081b[_0xc7d2('0xb')]=this[_0xc7d2('0xc')]['id'];}else{_0x7d081b[_[_0xc7d2('0xd')](this[_0xc7d2('0x9')])+'AccountId']=this[_0xc7d2('0xc')]['id'];}_0x7d081b[_[_0xc7d2('0xd')](this[_0xc7d2('0x9')])+_0xc7d2('0xe')]=this[_0xc7d2('0xf')]['id'];if(rpc[this[_0xc7d2('0x9')]+_0xc7d2('0x10')]){return rpc[this[_0xc7d2('0x9')]+_0xc7d2('0x10')][_0xc7d2('0x11')](_0x7d081b)[_0xc7d2('0x12')](function(_0x5b2e6c){logger[_0xc7d2('0x13')](_0xc7d2('0x14'),_0x21998e,_0x7d081b[_0xc7d2('0x15')]);_0x4802c7[_0xc7d2('0x16')]();})[_0xc7d2('0x17')](function(_0x1f75cc){logger['error'](_0xc7d2('0x14'),_0x21998e,JSON[_0xc7d2('0x18')](_0x1f75cc));_0x4802c7['stop']();});}}catch(_0x3f7c55){logger[_0xc7d2('0x19')](_0xc7d2('0x14'),_0x21998e,JSON[_0xc7d2('0x18')](_0x3f7c55));_0x4802c7['stop']();}};}; \ No newline at end of file +var _0xfc25=['interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','account','upperFirst','AccountId','channel','InteractionId'];(function(_0x1311cc,_0x13fae7){var _0xa37f96=function(_0x35e0ae){while(--_0x35e0ae){_0x1311cc['push'](_0x1311cc['shift']());}};_0xa37f96(++_0x13fae7);}(_0xfc25,0x10f));var _0x5fc2=function(_0x2cd145,_0x4e181f){_0x2cd145=_0x2cd145-0x0;var _0x1b3d13=_0xfc25[_0x2cd145];return _0x1b3d13;};'use strict';var _=require(_0x5fc2('0x0'));var utils=require(_0x5fc2('0x1'));var logger=require(_0x5fc2('0x2'))(_0x5fc2('0x3'));var rpc={'chatMessage':require(_0x5fc2('0x4')),'openchannelMessage':require(_0x5fc2('0x5')),'mailMessage':require(_0x5fc2('0x6')),'smsMessage':require(_0x5fc2('0x7')),'faxMessage':require(_0x5fc2('0x8')),'whatsappMessage':require(_0x5fc2('0x9'))};exports[_0x5fc2('0xa')]=function(_0x5af151,_0x417036){return function(_0x38beaf){try{var _0x2603e9={'body':utils[_0x5fc2('0xb')](_0x417036[0x0],this),'ContactId':this[_0x5fc2('0xc')]['id']};if(this['channel']===_0x5fc2('0xd')){_0x2603e9['ChatWebsiteId']=this[_0x5fc2('0xe')]['id'];}else{_0x2603e9[_[_0x5fc2('0xf')](this['channel'])+_0x5fc2('0x10')]=this['account']['id'];}_0x2603e9[_[_0x5fc2('0xf')](this[_0x5fc2('0x11')])+_0x5fc2('0x12')]=this[_0x5fc2('0x13')]['id'];if(rpc[this[_0x5fc2('0x11')]+_0x5fc2('0x14')]){return rpc[this[_0x5fc2('0x11')]+_0x5fc2('0x14')][_0x5fc2('0x15')](_0x2603e9)[_0x5fc2('0x16')](function(_0x2c0360){logger[_0x5fc2('0x17')](_0x5fc2('0x18'),_0x5af151,_0x2603e9[_0x5fc2('0x19')]);_0x38beaf['next']();})[_0x5fc2('0x1a')](function(_0x5b72a6){logger['error'](_0x5fc2('0x18'),_0x5af151,JSON[_0x5fc2('0x1b')](_0x5b72a6));_0x38beaf[_0x5fc2('0x1c')]();});}}catch(_0x3add35){logger['error'](_0x5fc2('0x18'),_0x5af151,JSON['stringify'](_0x3add35));_0x38beaf[_0x5fc2('0x1c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index c2f08b8..b1419e8 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 _0xe0da=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop'];(function(_0xbb4f11,_0x1c42e8){var _0x384632=function(_0x9bb541){while(--_0x9bb541){_0xbb4f11['push'](_0xbb4f11['shift']());}};_0x384632(++_0x1c42e8);}(_0xe0da,0x19a));var _0xae0d=function(_0x1910cc,_0x384e02){_0x1910cc=_0x1910cc-0x0;var _0x29a717=_0xe0da[_0x1910cc];return _0x29a717;};'use strict';var utils=require(_0xae0d('0x0'));var logger=require(_0xae0d('0x1'))(_0xae0d('0x2'));exports[_0xae0d('0x3')]=function(_0x4dded5,_0x79d84c){return function(_0x335b2b){try{logger[_0xae0d('0x4')](_0xae0d('0x5'),_0x4dded5,utils['getMustacheRender'](_0x79d84c[0x0],this));_0x335b2b[_0xae0d('0x6')]();}catch(_0x1e398f){logger[_0xae0d('0x7')](_0xae0d('0x5'),_0x4dded5,JSON[_0xae0d('0x8')](_0x1e398f));_0x335b2b[_0xae0d('0x9')]();}};}; \ No newline at end of file +var _0x7dec=['stringify','consequence','info','[%s][NOOP]\x20%s','next','error'];(function(_0x5e3678,_0x51a39a){var _0xd66960=function(_0x368c5e){while(--_0x368c5e){_0x5e3678['push'](_0x5e3678['shift']());}};_0xd66960(++_0x51a39a);}(_0x7dec,0x1b7));var _0xc7de=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x7dec[_0x5d80de];return _0x1c7556;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports[_0xc7de('0x0')]=function(_0x4542b3,_0x33ed6c){return function(_0x34e53b){try{logger[_0xc7de('0x1')](_0xc7de('0x2'),_0x4542b3,utils['getMustacheRender'](_0x33ed6c[0x0],this));_0x34e53b[_0xc7de('0x3')]();}catch(_0x41e4d2){logger[_0xc7de('0x4')](_0xc7de('0x2'),_0x4542b3,JSON[_0xc7de('0x5')](_0x41e4d2));_0x34e53b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 04e0500..176109c 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 _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x21377b,_0x50fcf3){var _0xcc4585=function(_0x35236d){while(--_0x35236d){_0x21377b['push'](_0x21377b['shift']());}};_0xcc4585(++_0x50fcf3);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ No newline at end of file +var _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x3b3896,_0x4610a0){var _0x27a648=function(_0x257a34){while(--_0x257a34){_0x3b3896['push'](_0x3b3896['shift']());}};_0x27a648(++_0x4610a0);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c8976,_0x5784b1){_0x4c8976=_0x4c8976-0x0;var _0x55ee12=_0xedd9[_0x4c8976];return _0x55ee12;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index b8270e8..19f84ae 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 _0x319c=['routing','squeue','agent','realtime','handleTimeout','bind','timeout','handleDrained','prototype','push','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util'];(function(_0xa4616b,_0x4ff22b){var _0x6891f9=function(_0x3bf874){while(--_0x3bf874){_0xa4616b['push'](_0xa4616b['shift']());}};_0x6891f9(++_0x4ff22b);}(_0x319c,0x173));var _0xc319=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x319c[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xc319('0x0'));var uuid=require(_0xc319('0x1'));var util=require(_0xc319('0x2'));var logger=require('../../../../../config/logger')(_0xc319('0x3'));var Agent=function(_0x3f5de9,_0x37ef0d,_0x3f3b39,_0x16467a){this['notificationId']=uuid['v4']();this[_0xc319('0x4')]=_0x3f5de9;this[_0xc319('0x5')]=_0x37ef0d;this[_0xc319('0x6')]=_0x3f3b39;this[_0xc319('0x3')]=_0x16467a;this[_0xc319('0x4')]['push'](this['handleRun']['bind'](this),this[_0xc319('0x7')][_0xc319('0x8')](this));this[_0xc319('0x4')]['on'](_0xc319('0x9'),this[_0xc319('0x7')][_0xc319('0x8')](this));this[_0xc319('0x4')]['on']('drained',this[_0xc319('0xa')]['bind'](this));};Agent[_0xc319('0xb')][_0xc319('0xc')]=function(){this[_0xc319('0x4')][_0xc319('0xc')](this[_0xc319('0xd')][_0xc319('0x8')](this),this[_0xc319('0x7')]['bind'](this));};Agent['prototype'][_0xc319('0xa')]=function(){this[_0xc319('0x7')](!![]);};Agent[_0xc319('0xb')]['handleRun']=function(_0x59ced4){logger[_0xc319('0xe')](_0xc319('0xf'),this[_0xc319('0x4')]['id'],this[_0xc319('0x5')]['id']);if(_[_0xc319('0x10')](this[_0xc319('0x6')][_0xc319('0x11')][this['agent']['id']])){logger[_0xc319('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc319('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xc319('0xc')][_0xc319('0x8')](this),0x3e8);}else{if(this[_0xc319('0x3')][_0xc319('0x12')]||util['isAgentAvailable'](this[_0xc319('0x4')]['id'],this['realtime']['agents'][this[_0xc319('0x5')]['id']],this[_0xc319('0x4')][_0xc319('0x13')],![])){this[_0xc319('0x6')][_0xc319('0x11')][this[_0xc319('0x5')]['id']][_0xc319('0x14')]=!![];this[_0xc319('0x6')][_0xc319('0x11')][this[_0xc319('0x5')]['id']][_0xc319('0x15')]=undefined;util[_0xc319('0x16')](this[_0xc319('0x17')],this[_0xc319('0x4')]['id'],this[_0xc319('0x6')]['agents'][this[_0xc319('0x5')]['id']],null,this[_0xc319('0x3')]);util[_0xc319('0x18')](this[_0xc319('0x4')]['id'],this['realtime'][_0xc319('0x11')][this[_0xc319('0x5')]['id']],_0xc319('0x19')+(this[_0xc319('0x3')][_0xc319('0x12')]?_0xc319('0x1a'):''));}else{logger[_0xc319('0xe')](_0xc319('0x1b'),this[_0xc319('0x4')]['id'],this[_0xc319('0x5')]['id']);setTimeout(this[_0xc319('0xc')][_0xc319('0x8')](this),0x3e8);}}};Agent[_0xc319('0xb')]['handleTimeout']=function(_0x3d10c9){if(_['isNil'](this[_0xc319('0x6')][_0xc319('0x11')][this[_0xc319('0x5')]['id']])){return logger[_0xc319('0xe')](_0xc319('0x1c'),this[_0xc319('0x4')]['id'],this['agent']['id']);}else{logger['info'](_0xc319('0x1d'),this[_0xc319('0x4')]['id'],this[_0xc319('0x5')]['id']);util[_0xc319('0x1e')](this['notificationId'],this[_0xc319('0x4')]['id'],this[_0xc319('0x6')][_0xc319('0x11')][this['agent']['id']],null,this[_0xc319('0x3')]);this[_0xc319('0x6')]['agents'][this[_0xc319('0x5')]['id']][_0xc319('0x14')]=![];this[_0xc319('0x6')][_0xc319('0x11')][this['agent']['id']][_0xc319('0x15')]=undefined;util['writeLog'](this[_0xc319('0x4')]['id'],this['realtime'][_0xc319('0x11')][this[_0xc319('0x5')]['id']],_0x3d10c9?_0xc319('0x1f'):_0xc319('0x20'));}if(!_0x3d10c9){setTimeout(this['push'][_0xc319('0x8')](this),0x3e8);}};function agent(_0x112bad,_0x49a7a5,_0x4fa1db,_0x31ac2d){return new Agent(_0x112bad,_0x49a7a5,_0x4fa1db,_0x31ac2d);}module[_0xc319('0x21')]=agent; \ No newline at end of file +var _0xf757=['channel','busy','busyQueue','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','bind','timeout','handleTimeout','drained','handleDrained','push','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x287d78,_0x82c6a0){var _0x880125=function(_0x46a636){while(--_0x46a636){_0x287d78['push'](_0x287d78['shift']());}};_0x880125(++_0x82c6a0);}(_0xf757,0x89));var _0x7f75=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xf757[_0x1f1511];return _0x1d9ab8;};'use strict';var _=require(_0x7f75('0x0'));var uuid=require(_0x7f75('0x1'));var util=require(_0x7f75('0x2'));var logger=require(_0x7f75('0x3'))(_0x7f75('0x4'));var Agent=function(_0x31d79b,_0x542a02,_0x27af46,_0x11d0a0){this[_0x7f75('0x5')]=uuid['v4']();this[_0x7f75('0x6')]=_0x31d79b;this[_0x7f75('0x7')]=_0x542a02;this[_0x7f75('0x8')]=_0x27af46;this['routing']=_0x11d0a0;this[_0x7f75('0x6')]['push'](this[_0x7f75('0x9')][_0x7f75('0xa')](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x7f75('0xb'),this[_0x7f75('0xc')][_0x7f75('0xa')](this));this[_0x7f75('0x6')]['on'](_0x7f75('0xd'),this[_0x7f75('0xe')][_0x7f75('0xa')](this));};Agent['prototype'][_0x7f75('0xf')]=function(){this[_0x7f75('0x6')][_0x7f75('0xf')](this[_0x7f75('0x9')][_0x7f75('0xa')](this),this['handleTimeout']['bind'](this));};Agent[_0x7f75('0x10')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x7f75('0x10')][_0x7f75('0x9')]=function(_0x1a4fb8){logger[_0x7f75('0x11')](_0x7f75('0x12'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);if(_[_0x7f75('0x13')](this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']])){logger['info'](_0x7f75('0x15'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);setTimeout(this[_0x7f75('0xf')][_0x7f75('0xa')](this),0x3e8);}else{if(this[_0x7f75('0x4')][_0x7f75('0x16')]||util['isAgentAvailable'](this[_0x7f75('0x6')]['id'],this['realtime'][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],this['squeue'][_0x7f75('0x17')],![])){this[_0x7f75('0x8')][_0x7f75('0x14')][this['agent']['id']][_0x7f75('0x18')]=!![];this[_0x7f75('0x8')]['agents'][this[_0x7f75('0x7')]['id']][_0x7f75('0x19')]=undefined;util['showNotification'](this[_0x7f75('0x5')],this[_0x7f75('0x6')]['id'],this['realtime'][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],null,this[_0x7f75('0x4')]);util['writeLog'](this[_0x7f75('0x6')]['id'],this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],'RINGING'+(this['routing'][_0x7f75('0x16')]?':FORCED':''));}else{logger[_0x7f75('0x11')](_0x7f75('0x1a'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);setTimeout(this[_0x7f75('0xf')]['bind'](this),0x3e8);}}};Agent[_0x7f75('0x10')][_0x7f75('0xc')]=function(_0x21a480){if(_[_0x7f75('0x13')](this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']])){return logger[_0x7f75('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);}else{logger[_0x7f75('0x11')](_0x7f75('0x1b'),this[_0x7f75('0x6')]['id'],this[_0x7f75('0x7')]['id']);util[_0x7f75('0x1c')](this['notificationId'],this[_0x7f75('0x6')]['id'],this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],null,this[_0x7f75('0x4')]);this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']]['busy']=![];this[_0x7f75('0x8')]['agents'][this[_0x7f75('0x7')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0x7f75('0x6')]['id'],this[_0x7f75('0x8')][_0x7f75('0x14')][this[_0x7f75('0x7')]['id']],_0x21a480?_0x7f75('0x1d'):_0x7f75('0x1e'));}if(!_0x21a480){setTimeout(this['push'][_0x7f75('0xa')](this),0x3e8);}};function agent(_0x130e0b,_0x4161e5,_0x47cd6a,_0x544e0f){return new Agent(_0x130e0b,_0x4161e5,_0x47cd6a,_0x544e0f);}module[_0x7f75('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 706ca2c..37b4f63 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 _0x1d6a=['handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','length','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push'];(function(_0x350bcc,_0x44efe8){var _0x5876ad=function(_0x303464){while(--_0x303464){_0x350bcc['push'](_0x350bcc['shift']());}};_0x5876ad(++_0x44efe8);}(_0x1d6a,0x1d3));var _0xa1d6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1d6a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xa1d6('0x0'));var uuid=require(_0xa1d6('0x1'));var util=require('./util');var logger=require(_0xa1d6('0x2'))(_0xa1d6('0x3'));var Beepall=function(_0x449cb1,_0x1a6622,_0xc22c0e,_0x3688af){this[_0xa1d6('0x4')]=uuid['v4']();this[_0xa1d6('0x5')]=_0x449cb1;this[_0xa1d6('0x6')]=_0x1a6622;this[_0xa1d6('0x7')]=_0xc22c0e;this['routing']=_0x3688af;this['squeue'][_0xa1d6('0x8')](this[_0xa1d6('0x9')][_0xa1d6('0xa')](this),this[_0xa1d6('0xb')][_0xa1d6('0xa')](this));this[_0xa1d6('0x5')]['on']('timeout',this[_0xa1d6('0xb')][_0xa1d6('0xa')](this));this[_0xa1d6('0x5')]['on'](_0xa1d6('0xc'),this[_0xa1d6('0xd')][_0xa1d6('0xa')](this));};Beepall['prototype'][_0xa1d6('0x8')]=function(){this['squeue']['push'](this[_0xa1d6('0x9')][_0xa1d6('0xa')](this),this[_0xa1d6('0xb')][_0xa1d6('0xa')](this));};Beepall[_0xa1d6('0xe')][_0xa1d6('0xd')]=function(_0x8cb514){this[_0xa1d6('0xb')](!![]);};Beepall[_0xa1d6('0xe')]['handleRun']=function(_0x4a4a73){var _0x54688b=!![];if(!_['isNil'](this[_0xa1d6('0x6')])&&!_[_0xa1d6('0xf')](this['queue'][_0xa1d6('0x10')])&&this[_0xa1d6('0x6')][_0xa1d6('0x10')]['length']>0x0){for(var _0x27513d=0x0,_0x4664dc;_0x27513d0x0){for(var _0xb1853d=0x0,_0x5e42ff;_0xb1853d0x0&&_0x43d5d7[_0x573450+_0x6db0('0x23')]>=_0x43d5d7[_0x573450+_0x6db0('0x22')]){writeLog(_0x489839,_0x43d5d7,_0x573450['toUpperCase']()+_0x6db0('0x24'));return![];}}return!![];};exports[_0x6db0('0x25')]=function(_0x18a791,_0x1d28bc,_0x4e2023,_0x256da8,_0x327470){return sendNotification(!![],_0x18a791,_0x1d28bc,_0x4e2023,_0x256da8,_0x327470);};exports['hideNotification']=function(_0x403ec3,_0x22eb49,_0x391a46,_0x2a10fa,_0x4d9225){return sendNotification(![],_0x403ec3,_0x22eb49,_0x391a46,_0x2a10fa,_0x4d9225);};exports[_0x6db0('0x26')]=writeLog; \ No newline at end of file +var _0xa45c=['format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','ioredis','../../../../../config/logger','redis','localhost','socket.io-emitter','emit'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0xa45c,0x6d));var _0xca45=function(_0x373686,_0x231df1){_0x373686=_0x373686-0x0;var _0x56234e=_0xa45c[_0x373686];return _0x56234e;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var utils=require('../utils');var Mustache=require('mustache');var Redis=require(_0xca45('0x2'));var config=require('../../../../../config/environment');var logger=require(_0xca45('0x3'))('routing');config[_0xca45('0x4')]=_['defaults'](config['redis'],{'host':_0xca45('0x5'),'port':0x18eb});var io=require(_0xca45('0x6'))(new Redis(config[_0xca45('0x4')]));function emit(_0x15628b,_0x578a7b,_0x1a8b9c){io['to'](_0x15628b)[_0xca45('0x7')](_0x578a7b,_0x1a8b9c);}function sendNotification(_0x7ceab1,_0x307649,_0x312400,_0x5c18b9,_0xeb0cd9,_0x342542){io['to'](util[_0xca45('0x8')](_0xca45('0x9'),_0x5c18b9[_0xca45('0xa')]))[_0xca45('0x7')](_0xca45('0xb'),_0x5c18b9);var _0x4a8692=_0x342542||{};var _0x643942=_0x312400[_0xca45('0xc')]('.');var _0x44a6cc={'uniqueid':_0x307649,'channel':_0x643942[0x0],'id':_0x643942[0x1],'title':_0x643942[0x0]+_0xca45('0xd'),'interactionId':_0x643942[0x2],'queue':_0xeb0cd9?_0xeb0cd9['name']:null,'sound':_0x4a8692[_0xca45('0xe')][_0xca45('0xf')],'shake':_0x4a8692[_0xca45('0xe')]['notificationShake']};try{if(!_0x4a8692[_0xca45('0x10')]){_0x4a8692['body']={};}if(_0xeb0cd9){_0x4a8692[_0xca45('0x10')][_0xca45('0x11')]=_0xeb0cd9;}else if(_0x4a8692[_0xca45('0x10')][_0xca45('0x11')]){delete _0x4a8692[_0xca45('0x10')][_0xca45('0x11')];}_0x44a6cc[_0xca45('0x12')]=utils['getMustacheRender'](_0x4a8692[_0xca45('0xe')]['notificationTemplate'],_0x4a8692);}catch(_0x533853){_0x44a6cc[_0xca45('0x12')]=_0xca45('0x13');logger['error'](util[_0xca45('0x8')](_0xca45('0x14'),_0x307649,_0x533853['message']));}io['to'](util[_0xca45('0x8')](_0xca45('0x9'),_0x5c18b9[_0xca45('0xa')]))[_0xca45('0x7')](util['format'](_0xca45('0x15'),_0x7ceab1?_0xca45('0x16'):_0xca45('0x17')),_0x44a6cc);}function writeLog(_0xdea7de,_0x548d0c,_0x2c0a39){return logger[_0xca45('0x18')](util[_0xca45('0x8')](_0xca45('0x19'),_0xdea7de,_0x548d0c[_0xca45('0xa')],_0x2c0a39));}exports[_0xca45('0x1a')]=function(_0x14816d,_0x2c443c,_0x14cd25,_0x4998b5){if(_0x2c443c[_0xca45('0x1b')]){writeLog(_0x14816d,_0x2c443c,_0xca45('0x1c'));return![];}if(!_0x2c443c[_0xca45('0x1d')]){writeLog(_0x14816d,_0x2c443c,_0xca45('0x1e'));return![];}if(_0x2c443c[_0x14cd25+_0xca45('0x1f')]){writeLog(_0x14816d,_0x2c443c,'PAUSE');return![];}if(_0x4998b5&&_0x2c443c['hasOwnProperty'](_0x14cd25+'Capacity')&&_0x2c443c[_0xca45('0x20')](_0x14cd25+'CurrentCapacity')){if(_0x2c443c[_0x14cd25+'Capacity']>0x0&&_0x2c443c[_0x14cd25+_0xca45('0x21')]>=_0x2c443c[_0x14cd25+_0xca45('0x22')]){writeLog(_0x14816d,_0x2c443c,_0x14cd25[_0xca45('0x23')]()+_0xca45('0x24'));return![];}}return!![];};exports[_0xca45('0x25')]=function(_0x59cb19,_0x27353b,_0x2a5cd4,_0x3593a5,_0x4d546c){return sendNotification(!![],_0x59cb19,_0x27353b,_0x2a5cd4,_0x3593a5,_0x4d546c);};exports['hideNotification']=function(_0x592ad2,_0x430591,_0x2e51b1,_0x5cb991,_0xa1870d){return sendNotification(![],_0x592ad2,_0x430591,_0x2e51b1,_0x5cb991,_0xa1870d);};exports[_0xca45('0x26')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 07d37e3..57ed86d 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 _0x3d68=['map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','validate','shelljs','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s'];(function(_0x3712a6,_0x2d2f58){var _0xe08c4=function(_0x31972d){while(--_0x31972d){_0x3712a6['push'](_0x3712a6['shift']());}};_0xe08c4(++_0x2d2f58);}(_0x3d68,0x142));var _0x83d6=function(_0x482eb0,_0x4f2356){_0x482eb0=_0x482eb0-0x0;var _0x895995=_0x3d68[_0x482eb0];return _0x895995;};'use strict';var schema=require(_0x83d6('0x0'));var sh=require(_0x83d6('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x83d6('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0x83d6('0x3')}});exports[_0x83d6('0x4')]=function(_0x1bd6d3,_0x2d6119){return function(_0x76193e){try{var _0x2e360f={'command':_0x2d6119[0x0]};var _0x2d8675=system['validate'](_0x2e360f,{'typecast':!![]});if(_0x2d8675[_0x83d6('0x5')]){logger[_0x83d6('0x6')](_0x83d6('0x7'),_0x1bd6d3,_[_0x83d6('0x8')](_0x2d8675,_0x83d6('0x9'))[_0x83d6('0xa')](',\x20'));logger[_0x83d6('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1bd6d3);_0x76193e[_0x83d6('0xc')]();}else{var _0x469228=this;var _0x5a7a63=utils[_0x83d6('0xd')](_0x2d6119[0x0],this);logger[_0x83d6('0xb')](_0x83d6('0xe'),_0x1bd6d3,_0x5a7a63);sh[_0x83d6('0xf')](_[_0x83d6('0x10')](_0x5a7a63),function(_0x5d9177,_0x460a3c){logger[_0x83d6('0xb')](_0x83d6('0x11'),_0x1bd6d3,_0x5d9177);if(_0x5d9177==0x0){var _0x50c4ac=_0x460a3c['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x83d6('0x12')](_0x2d6119[0x1])||_['isEmpty'](_0x2d6119[0x1])){logger[_0x83d6('0xb')](_0x83d6('0x13'),_0x1bd6d3);_0x469228[_0x83d6('0x14')][_0x2d6119[0x1]]=_0x50c4ac;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1bd6d3,_0x2d6119[0x1],_0x50c4ac);_0x469228[_0x83d6('0x14')][_0x2d6119[0x1]]=_0x50c4ac;}}_0x76193e[_0x83d6('0xc')]();});}}catch(_0x1afab4){logger[_0x83d6('0x6')](_0x83d6('0x7'),_0x1bd6d3,_[_0x83d6('0x15')](_0x1afab4)?JSON['stringify'](_0x1afab4):_0x1afab4);logger[_0x83d6('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1bd6d3);_0x76193e[_0x83d6('0xc')]();}};}; \ No newline at end of file +var _0x9e5a=['replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x9e5a,0x118));var _0xa9e5=function(_0x4d09eb,_0x9a0421){_0x4d09eb=_0x4d09eb-0x0;var _0x4429b4=_0x9e5a[_0x4d09eb];return _0x4429b4;};'use strict';var schema=require('validate');var sh=require(_0xa9e5('0x0'));var _=require(_0xa9e5('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa9e5('0x2')]=function(_0x517f6e,_0x1f2eb7){return function(_0x550f9c){try{var _0x2698e3={'command':_0x1f2eb7[0x0]};var _0x5123b3=system[_0xa9e5('0x3')](_0x2698e3,{'typecast':!![]});if(_0x5123b3['length']){logger[_0xa9e5('0x4')](_0xa9e5('0x5'),_0x517f6e,_[_0xa9e5('0x6')](_0x5123b3,_0xa9e5('0x7'))['join'](',\x20'));logger[_0xa9e5('0x8')](_0xa9e5('0x9'),_0x517f6e);_0x550f9c[_0xa9e5('0xa')]();}else{var _0x33679e=this;var _0x3ce2a1=utils[_0xa9e5('0xb')](_0x1f2eb7[0x0],this);logger['info'](_0xa9e5('0xc'),_0x517f6e,_0x3ce2a1);sh[_0xa9e5('0xd')](_['trim'](_0x3ce2a1),function(_0x245065,_0x47534b){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x517f6e,_0x245065);if(_0x245065==0x0){var _0x5f2f2c=_0x47534b[_0xa9e5('0xe')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1f2eb7[0x1])||_[_0xa9e5('0xf')](_0x1f2eb7[0x1])){logger['info'](_0xa9e5('0x10'),_0x517f6e);_0x33679e[_0xa9e5('0x11')][_0x1f2eb7[0x1]]=_0x5f2f2c;}else{logger['info'](_0xa9e5('0x12'),_0x517f6e,_0x1f2eb7[0x1],_0x5f2f2c);_0x33679e['body'][_0x1f2eb7[0x1]]=_0x5f2f2c;}}_0x550f9c[_0xa9e5('0xa')]();});}}catch(_0x4b2e84){logger[_0xa9e5('0x4')](_0xa9e5('0x5'),_0x517f6e,_[_0xa9e5('0x13')](_0x4b2e84)?JSON[_0xa9e5('0x14')](_0x4b2e84):_0x4b2e84);logger[_0xa9e5('0x8')](_0xa9e5('0x9'),_0x517f6e);_0x550f9c[_0xa9e5('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 48e281d..f761e94 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 _0x3502=['message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','next','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x31ff9a,_0x12a9d3){var _0x3b43c4=function(_0x5943a4){while(--_0x5943a4){_0x31ff9a['push'](_0x31ff9a['shift']());}};_0x3b43c4(++_0x12a9d3);}(_0x3502,0x90));var _0x2350=function(_0x3665f5,_0x172766){_0x3665f5=_0x3665f5-0x0;var _0x525fd7=_0x3502[_0x3665f5];return _0x525fd7;};'use strict';var schema=require(_0x2350('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x2350('0x1')),'smsInteraction':require(_0x2350('0x2')),'mailInteraction':require(_0x2350('0x3')),'faxInteraction':require(_0x2350('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x2350('0x5'),'required':!![],'message':_0x2350('0x6')}});exports[_0x2350('0x7')]=function(_0x4dbff7,_0x2ed19f,_0x546c13,_0x1295ba){return function(_0x5b6664){try{var _0x2dea50={'tag':_0x2ed19f[0x0]};var _0x592565=tag['validate'](_0x2dea50,{'typecast':!![]});if(_0x592565[_0x2350('0x8')]){logger[_0x2350('0x9')]('[%s][TAG]\x20%s',_0x4dbff7,_['map'](_0x592565,_0x2350('0xa'))['join'](',\x20'));logger['info'](_0x2350('0xb'),_0x4dbff7);_0x5b6664['next']();}else{var _0x2efc07={'ids':[_0x2ed19f[0x0]]};if(rpc[_0x1295ba[_0x2350('0xc')]+_0x2350('0xd')]){rpc[_0x1295ba['channel']+_0x2350('0xd')]['addTags'](_0x1295ba[_0x2350('0xe')]['id'],_0x2efc07)[_0x2350('0xf')](function(_0x1ad50f){logger['info'](_0x2350('0x10'),_0x4dbff7,_0x2ed19f[0x1],_0x1295ba[_0x2350('0xc')],_0x1295ba[_0x2350('0xe')]['id']);})[_0x2350('0x11')](function(_0x33dc22){logger[_0x2350('0x9')](_0x2350('0x12'),_0x4dbff7,JSON[_0x2350('0x13')](_0x33dc22));logger['info'](_0x2350('0xb'),_0x4dbff7);})['finally'](function(){_0x5b6664[_0x2350('0x14')]();});}}}catch(_0x229519){logger[_0x2350('0x9')]('[%s][TAG]\x20%s',_0x4dbff7,_[_0x2350('0x15')](_0x229519)?JSON[_0x2350('0x13')](_0x229519):_0x229519);logger['info'](_0x2350('0xb'),_0x4dbff7);_0x5b6664['next']();}};}; \ No newline at end of file +var _0x4b20=['../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x16440b,_0x4befe6){var _0x443362=function(_0x1cb562){while(--_0x1cb562){_0x16440b['push'](_0x16440b['shift']());}};_0x443362(++_0x4befe6);}(_0x4b20,0x8d));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var schema=require('validate');var _=require(_0x04b2('0x0'));var rpc={'chatInteraction':require(_0x04b2('0x1')),'openchannelInteraction':require(_0x04b2('0x2')),'smsInteraction':require(_0x04b2('0x3')),'mailInteraction':require(_0x04b2('0x4')),'faxInteraction':require(_0x04b2('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x04b2('0x6'));var tag=schema({'tag':{'type':_0x04b2('0x7'),'required':!![],'message':_0x04b2('0x8')}});exports[_0x04b2('0x9')]=function(_0x43d1d5,_0x363a07,_0x39c5c9,_0x29366d){return function(_0x40149a){try{var _0x1f1b3d={'tag':_0x363a07[0x0]};var _0x116fc3=tag[_0x04b2('0xa')](_0x1f1b3d,{'typecast':!![]});if(_0x116fc3[_0x04b2('0xb')]){logger[_0x04b2('0xc')](_0x04b2('0xd'),_0x43d1d5,_[_0x04b2('0xe')](_0x116fc3,_0x04b2('0xf'))[_0x04b2('0x10')](',\x20'));logger[_0x04b2('0x11')](_0x04b2('0x12'),_0x43d1d5);_0x40149a[_0x04b2('0x13')]();}else{var _0x464b8f={'ids':[_0x363a07[0x0]]};if(rpc[_0x29366d['channel']+'Interaction']){rpc[_0x29366d['channel']+_0x04b2('0x14')][_0x04b2('0x15')](_0x29366d[_0x04b2('0x16')]['id'],_0x464b8f)[_0x04b2('0x17')](function(_0x2f62ba){logger[_0x04b2('0x11')](_0x04b2('0x18'),_0x43d1d5,_0x363a07[0x1],_0x29366d[_0x04b2('0x19')],_0x29366d[_0x04b2('0x16')]['id']);})[_0x04b2('0x1a')](function(_0x4fb595){logger[_0x04b2('0xc')]('[%s][TAG]\x20%s',_0x43d1d5,JSON[_0x04b2('0x1b')](_0x4fb595));logger[_0x04b2('0x11')](_0x04b2('0x12'),_0x43d1d5);})['finally'](function(){_0x40149a[_0x04b2('0x13')]();});}}}catch(_0x285d60){logger['error'](_0x04b2('0xd'),_0x43d1d5,_[_0x04b2('0x1c')](_0x285d60)?JSON[_0x04b2('0x1b')](_0x285d60):_0x285d60);logger[_0x04b2('0x11')](_0x04b2('0x12'),_0x43d1d5);_0x40149a[_0x04b2('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index b35821f..68eca7f 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 _0xb43b=['list','mustache','exports','render','merge','body','contact','message','account','interaction'];(function(_0x2dd22e,_0xec41fe){var _0x257b01=function(_0x26de99){while(--_0x26de99){_0x2dd22e['push'](_0x2dd22e['shift']());}};_0x257b01(++_0xec41fe);}(_0xb43b,0xbf));var _0xbb43=function(_0x504489,_0x38bc0b){_0x504489=_0x504489-0x0;var _0x443d64=_0xb43b[_0x504489];return _0x443d64;};'use strict';var Mustache=require(_0xbb43('0x0'));var _=require('lodash');module[_0xbb43('0x1')]={'getMustacheRender':function(_0x21ce6c,_0x831f09){return Mustache[_0xbb43('0x2')](_0x21ce6c,_[_0xbb43('0x3')](_0x831f09[_0xbb43('0x4')],{'contact':_0x831f09[_0xbb43('0x5')],'message':_0x831f09[_0xbb43('0x6')],'account':_0x831f09[_0xbb43('0x7')],'interaction':_0x831f09[_0xbb43('0x8')],'list':_0x831f09[_0xbb43('0x9')]}))||'';}}; \ No newline at end of file +var _0x1f38=['lodash','exports','render','body','contact','message','account','interaction','mustache'];(function(_0x46890c,_0x5a478c){var _0x1b0cde=function(_0x14a48e){while(--_0x14a48e){_0x46890c['push'](_0x46890c['shift']());}};_0x1b0cde(++_0x5a478c);}(_0x1f38,0xd7));var _0x81f3=function(_0x4b662d,_0x5b8058){_0x4b662d=_0x4b662d-0x0;var _0x3b9fd4=_0x1f38[_0x4b662d];return _0x3b9fd4;};'use strict';var Mustache=require(_0x81f3('0x0'));var _=require(_0x81f3('0x1'));module[_0x81f3('0x2')]={'getMustacheRender':function(_0x3f167c,_0x261dcf){return Mustache[_0x81f3('0x3')](_0x3f167c,_['merge'](_0x261dcf[_0x81f3('0x4')],{'contact':_0x261dcf[_0x81f3('0x5')],'message':_0x261dcf[_0x81f3('0x6')],'account':_0x261dcf[_0x81f3('0x7')],'interaction':_0x261dcf[_0x81f3('0x8')],'list':_0x261dcf['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 616ddd4..e0dec80 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 _0x1e28=['\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','stringify','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','end','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','push','dialogflow','dialogflowv2','amazonlex','slice','tag','TagId','%s:%s:%s','condition','intervals','./applications/','priority','info','on\x20interval'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1e28,0x84));var _0x81e2=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x1e28[_0x87239];return _0x53af1e;};'use strict';var _=require('lodash');var util=require(_0x81e2('0x0'));var path=require(_0x81e2('0x1'));var fs=require('fs');var jayson=require(_0x81e2('0x2'));var BPromise=require(_0x81e2('0x3'));var uuid=require(_0x81e2('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x81e2('0x5')),'smsQueueReport':require(_0x81e2('0x6')),'faxQueueReport':require(_0x81e2('0x7')),'whatsappQueueReport':require(_0x81e2('0x8'))};var RuleEngine=require(_0x81e2('0x9'));function getId(_0x4a654e,_0x21082e,_0x3ad824){return util[_0x81e2('0xa')](_0x81e2('0xb'),_0x4a654e,_0x21082e||0x0,_0x3ad824||0x0);}function getIntervals(_0x2dc3d5,_0xa4dc19){var _0x3ce44a=[];if(!_['isNil'](_0xa4dc19['IntervalId'])&&!_[_0x81e2('0xc')](_0x2dc3d5[_0xa4dc19[_0x81e2('0xd')]])&&!_[_0x81e2('0xc')](_0x2dc3d5[_0xa4dc19['IntervalId']][_0x81e2('0xe')])){_0x3ce44a=_['map'](_0x2dc3d5[_0xa4dc19[_0x81e2('0xd')]]['Intervals'],_0x81e2('0xf'));}else if(!_[_0x81e2('0xc')](_0xa4dc19[_0x81e2('0xf')])){_0x3ce44a=[_0xa4dc19['interval']];}return _0x3ce44a;}exports[_0x81e2('0x10')]=function(_0x116b81){_0x116b81['rules']={};return new BPromise(function(_0x14c3db,_0x4c9f03){var _0x5909c7={'Start':function(_0x202cef){var _0x4c3bdc=this;return new Promise(function(_0x4f4b2a,_0x19324c){if(_0x202cef){try{var _0x3f571c=[];var _0x56644e=getId(_0x202cef[_0x81e2('0x11')],_0x202cef[_0x81e2('0x12')]?_0x202cef[_0x81e2('0x12')]['id']:0x0,_0x202cef[_0x81e2('0x13')]?_0x202cef[_0x81e2('0x13')]['id']:0x0);if(_0x202cef[_0x81e2('0x14')]&&_[_0x81e2('0x15')](_0x202cef[_0x81e2('0x14')])&&_0x202cef[_0x81e2('0x14')][_0x81e2('0x16')]){for(var _0x4bf117=0x0;_0x4bf117<_0x202cef['applications'][_0x81e2('0x16')];_0x4bf117+=0x1){var _0x375f6e=_0x202cef['applications'][_0x4bf117];if(fs[_0x81e2('0x17')](path[_0x81e2('0x18')](__dirname,_0x81e2('0x14'),_0x375f6e[_0x81e2('0x19')]+_0x81e2('0x1a')))){var _0x2dcc88=[];switch(_0x375f6e['app']['toLowerCase']()){case _0x81e2('0x1b'):var _0x3cc97f=_0x375f6e[_0x81e2('0x1c')][_0x81e2('0x1d')](',');_0x2dcc88[_0x81e2('0x1e')](_0x3cc97f[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0x3cc97f['slice'](0x1,_0x3cc97f[_0x81e2('0x16')])['join'](','));break;case _0x81e2('0x1f'):var _0x3cde0f=_0x375f6e[_0x81e2('0x1c')]['split'](',');_0x2dcc88[_0x81e2('0x1e')](_0x3cde0f[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0x3cde0f[0x1]);_0x2dcc88[_0x81e2('0x1e')](_0x3cde0f['slice'](0x2,_0x3cde0f[_0x81e2('0x16')])['join'](','));break;case _0x81e2('0x20'):var _0x12db8f=_0x375f6e[_0x81e2('0x1c')]['split'](',');_0x2dcc88['push'](_0x12db8f[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0x12db8f[0x1]);_0x2dcc88[_0x81e2('0x1e')](_0x12db8f[0x2]);_0x2dcc88[_0x81e2('0x1e')](_0x12db8f[0x3]);_0x2dcc88['push'](_0x12db8f['slice'](0x4,_0x12db8f['length'])['join'](','));break;case _0x81e2('0x21'):var _0xada5b3=_0x375f6e[_0x81e2('0x1c')][_0x81e2('0x1d')](',');_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x1]);_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x2]);_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x3]);_0x2dcc88['push'](_0xada5b3[_0x81e2('0x22')](0x4,_0xada5b3['length'])[_0x81e2('0x18')](','));break;case _0x81e2('0x12'):_0x2dcc88[_0x81e2('0x1e')](_0x375f6e['appdata']);break;case _0x81e2('0x23'):_0x2dcc88[_0x81e2('0x1e')](_0x375f6e[_0x81e2('0x24')]);_0x2dcc88[_0x81e2('0x1e')](_0x375f6e[_0x81e2('0x1c')]);break;default:_0x2dcc88=_[_0x81e2('0xc')](_0x375f6e[_0x81e2('0x1c')])?[]:_0x375f6e['appdata'][_0x81e2('0x1d')](',');}var _0x48619c={'id':util[_0x81e2('0xa')](_0x81e2('0x25'),_0x56644e,_0x375f6e['id'],_0x375f6e['app']),'condition':require('./interval')[_0x81e2('0x26')](_0x56644e,getIntervals(_0x116b81[_0x81e2('0x27')],_0x375f6e),_0x116b81),'consequence':require(_0x81e2('0x28')+_0x375f6e[_0x81e2('0x19')])['consequence'](_0x56644e,_0x2dcc88,_0x116b81,_0x202cef),'p':_0x375f6e[_0x81e2('0x29')]||0x0};logger[_0x81e2('0x2a')]('Push\x20new\x20rule',_0x48619c['id'],_0x81e2('0x2b'),getIntervals(_0x116b81[_0x81e2('0x27')],_0x375f6e)[_0x81e2('0x18')](_0x81e2('0x2c')));_0x3f571c[_0x81e2('0x1e')](_0x48619c);}else{logger[_0x81e2('0x2d')](_0x81e2('0x2e'),path[_0x81e2('0x18')](__dirname,_0x81e2('0x14'),_0x375f6e[_0x81e2('0x19')]+'.js'));}}_0x116b81['rules'][_0x56644e]=new RuleEngine(_0x3f571c);_0x116b81[_0x81e2('0x2f')][_0x56644e]['execute'](_0x202cef,function(_0x4c0936){logger[_0x81e2('0x2a')]('Applications\x20executed',JSON[_0x81e2('0x30')](_0x4c0936['matchPath']));if(_0x116b81[_0x81e2('0x2f')][_0x56644e]){_0x116b81[_0x81e2('0x2f')][_0x56644e][_0x81e2('0x31')](_0x81e2('0x32'));}});return _0x4f4b2a({'code':0xc8,'message':_0x202cef});}else{logger['info'](_0x81e2('0x33'));return _0x4f4b2a({'code':0xc8,'message':_0x202cef});}}catch(_0x3eee2d){logger[_0x81e2('0x2d')](_0x3eee2d['stack']);return _0x19324c(_0x4c3bdc[_0x81e2('0x2d')](0x1f4,_0x3eee2d));}}return _0x19324c(_0x81e2('0x34'));});},'AcceptMessage':function(_0x3882ee){var _0x138d8e=this;return new Promise(function(_0x218b48,_0x33c1ae){if(_0x3882ee[_0x81e2('0x12')]&&_0x3882ee[_0x81e2('0x12')]['id']){try{var _0x4afe8e=getId(_0x3882ee[_0x81e2('0x11')],_0x3882ee[_0x81e2('0x12')]?_0x3882ee[_0x81e2('0x12')]['id']:0x0,_0x3882ee[_0x81e2('0x13')]?_0x3882ee[_0x81e2('0x13')]['id']:0x0);if(_0x116b81['rules'][_0x4afe8e]){_0x116b81[_0x81e2('0x2f')][_0x4afe8e]['emit'](_0x81e2('0x35'));if(rpc[_0x3882ee[_0x81e2('0x11')]+_0x81e2('0x36')]){rpc[_0x3882ee[_0x81e2('0x11')]+_0x81e2('0x36')][_0x81e2('0x37')](_0x4afe8e,{'UserId':_0x3882ee[_0x81e2('0x12')]['UserId']})[_0x81e2('0x38')](function(_0x46f357){logger['error'](_0x81e2('0x39'));});}}return _0x218b48({'code':0xc8,'message':_0x3882ee});}catch(_0x27fd77){logger[_0x81e2('0x2d')](_0x27fd77[_0x81e2('0x3a')]);return _0x33c1ae(_0x138d8e['error'](0x1f4,_0x27fd77));}}logger['error'](_0x81e2('0x3b'));return _0x33c1ae(_0x138d8e['error'](0x1f4,_0x81e2('0x3b')));});},'RejectMessage':function(_0x11270b){var _0x35c571=this;return new Promise(function(_0x4f3a06,_0x5e7990){if(_0x11270b[_0x81e2('0x3c')]&&_0x11270b[_0x81e2('0x3c')]['id']){try{if(_0x116b81[_0x81e2('0x3d')][_0x11270b['agent']['id']]){_0x116b81['agents'][_0x11270b[_0x81e2('0x3c')]['id']][_0x81e2('0x3e')]=![];_0x116b81['agents'][_0x11270b['agent']['id']][_0x81e2('0x3f')]=undefined;}return _0x4f3a06({'code':0xc8,'message':_0x11270b});}catch(_0x3bffed){logger[_0x81e2('0x2d')](_0x3bffed['stack']);return _0x5e7990(_0x35c571[_0x81e2('0x2d')](0x1f4,_0x3bffed));}}logger[_0x81e2('0x2d')](_0x81e2('0x3b'));return _0x5e7990(_0x35c571['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x6f8d65){var _0x47329c=this;return new Promise(function(_0x58b1d3,_0x597de7){if(_0x6f8d65[_0x81e2('0x11')]&&_0x6f8d65['interaction']&&_0x6f8d65[_0x81e2('0x13')]['id']){try{var _0x26c9c7=getId(_0x6f8d65[_0x81e2('0x11')],_0x6f8d65[_0x81e2('0x12')]?_0x6f8d65[_0x81e2('0x12')]['id']:0x0,_0x6f8d65[_0x81e2('0x13')]?_0x6f8d65[_0x81e2('0x13')]['id']:0x0);if(_0x116b81[_0x81e2('0x2f')][_0x26c9c7]){_0x116b81[_0x81e2('0x2f')][_0x26c9c7]['emit'](_0x81e2('0x35'));}return _0x58b1d3({'code':0xc8,'message':_0x6f8d65});}catch(_0x29ed2b){logger[_0x81e2('0x2d')](_0x29ed2b[_0x81e2('0x3a')]);return _0x597de7(_0x47329c[_0x81e2('0x2d')](0x1f4,_0x29ed2b));}}logger['error'](_0x81e2('0x3b'));return _0x597de7(_0x47329c['error'](0x1f4,_0x81e2('0x3b')));});},'AgentCapacity':function(_0x30687c){var _0x58090f=this;return new Promise(function(_0x1b8844,_0x51851e){if(_0x116b81[_0x81e2('0x3d')][_0x81e2('0x40')](_0x30687c['id'])){for(var _0x2d3d03 in _0x30687c[_0x81e2('0x41')]){if(_0x30687c[_0x81e2('0x41')][_0x81e2('0x40')](_0x2d3d03)){if(_0x116b81[_0x81e2('0x3d')][_0x30687c['id']]['hasOwnProperty'](_0x2d3d03+_0x81e2('0x42'))){_0x116b81[_0x81e2('0x3d')][_0x30687c['id']][_0x2d3d03+_0x81e2('0x42')]=parseInt(_0x30687c[_0x81e2('0x41')][_0x2d3d03],0xa);}}}_0x116b81[_0x81e2('0x3d')][_0x30687c['id']][_0x81e2('0x43')]();return _0x1b8844({'code':0xc8,'message':_0x116b81[_0x81e2('0x3d')][_0x30687c['id']]});}else{return _0x51851e(_0x58090f[_0x81e2('0x2d')](0x1f4,_0x81e2('0x44')));}});},'Agents':function(_0x1e02ce){return new Promise(function(_0x57fb7a,_0x35b1da){var _0x4264a4=_[_0x81e2('0x45')](_0x116b81['agents']);_0x57fb7a({'count':_0x4264a4[_0x81e2('0x16')],'rows':_0x4264a4});});},'ChatQueues':function(_0x37045b){return new Promise(function(_0x53f33a,_0x3b9a47){var _0x47672a=[];for(var _0x24527e in _0x116b81['chatQueues']){if(_0x116b81[_0x81e2('0x46')]['hasOwnProperty'](_0x24527e)){var _0xd88ce=_0x116b81['chatQueues'][_0x24527e];var _0x4e6b5={'id':_0xd88ce['id'],'available':_0xd88ce[_0x81e2('0x47')],'loggedIn':_0xd88ce[_0x81e2('0x48')],'name':_0xd88ce[_0x81e2('0x49')],'paused':_0xd88ce[_0x81e2('0x4a')],'waiting':_0xd88ce[_0x81e2('0x4b')]};_0x47672a['push'](_0x4e6b5);}}_0x53f33a({'count':_0x47672a['length'],'rows':_0x47672a});});},'MailQueues':function(_0x2d5792){return new Promise(function(_0x16e369,_0x312b0e){var _0x2e068e=[];for(var _0x136ea1 in _0x116b81[_0x81e2('0x4c')]){if(_0x116b81['mailQueues']['hasOwnProperty'](_0x136ea1)){var _0x5f24be=_0x116b81[_0x81e2('0x4c')][_0x136ea1];var _0x222e3f={'id':_0x5f24be['id'],'available':_0x5f24be[_0x81e2('0x47')],'loggedIn':_0x5f24be[_0x81e2('0x48')],'name':_0x5f24be[_0x81e2('0x49')],'paused':_0x5f24be[_0x81e2('0x4a')],'waiting':_0x5f24be['waiting']};_0x2e068e[_0x81e2('0x1e')](_0x222e3f);}}_0x16e369({'count':_0x2e068e[_0x81e2('0x16')],'rows':_0x2e068e});});},'OpenchannelQueues':function(_0xa06c79){return new Promise(function(_0x55461a,_0x28f6f5){var _0x1087f3=[];for(var _0x561087 in _0x116b81[_0x81e2('0x4d')]){if(_0x116b81[_0x81e2('0x4d')][_0x81e2('0x40')](_0x561087)){var _0x4cebe6=_0x116b81[_0x81e2('0x4d')][_0x561087];var _0x163de0={'id':_0x4cebe6['id'],'available':_0x4cebe6[_0x81e2('0x47')],'loggedIn':_0x4cebe6[_0x81e2('0x48')],'name':_0x4cebe6[_0x81e2('0x49')],'paused':_0x4cebe6[_0x81e2('0x4a')],'waiting':_0x4cebe6[_0x81e2('0x4b')]};_0x1087f3[_0x81e2('0x1e')](_0x163de0);}}_0x55461a({'count':_0x1087f3[_0x81e2('0x16')],'rows':_0x1087f3});});},'SmsQueues':function(_0x57ae8f){return new Promise(function(_0xd96928,_0x2d952c){var _0x51ebd2=[];for(var _0x1f293f in _0x116b81[_0x81e2('0x4e')]){if(_0x116b81['smsQueues'][_0x81e2('0x40')](_0x1f293f)){var _0xc7d1bc=_0x116b81[_0x81e2('0x4e')][_0x1f293f];var _0x429d78={'id':_0xc7d1bc['id'],'available':_0xc7d1bc['available'],'loggedIn':_0xc7d1bc[_0x81e2('0x48')],'name':_0xc7d1bc[_0x81e2('0x49')],'paused':_0xc7d1bc[_0x81e2('0x4a')],'waiting':_0xc7d1bc[_0x81e2('0x4b')]};_0x51ebd2[_0x81e2('0x1e')](_0x429d78);}}_0xd96928({'count':_0x51ebd2[_0x81e2('0x16')],'rows':_0x51ebd2});});},'FaxQueues':function(_0x752249){return new Promise(function(_0x1ada03,_0x2ebd24){var _0x1b0edb=[];for(var _0x18eadd in _0x116b81[_0x81e2('0x4f')]){if(_0x116b81[_0x81e2('0x4f')]['hasOwnProperty'](_0x18eadd)){var _0x8b81f0=_0x116b81['faxQueues'][_0x18eadd];var _0x36aa73={'id':_0x8b81f0['id'],'available':_0x8b81f0[_0x81e2('0x47')],'loggedIn':_0x8b81f0[_0x81e2('0x48')],'name':_0x8b81f0[_0x81e2('0x49')],'paused':_0x8b81f0[_0x81e2('0x4a')],'waiting':_0x8b81f0[_0x81e2('0x4b')]};_0x1b0edb['push'](_0x36aa73);}}_0x1ada03({'count':_0x1b0edb['length'],'rows':_0x1b0edb});});},'WhatsappQueues':function(_0x425831){return new Promise(function(_0x230357,_0x2ae5ba){var _0x2b1bb7=[];for(var _0x4de88b in _0x116b81[_0x81e2('0x50')]){if(_0x116b81[_0x81e2('0x50')][_0x81e2('0x40')](_0x4de88b)){var _0x48ce5a=_0x116b81[_0x81e2('0x50')][_0x4de88b];var _0x1d62e4={'id':_0x48ce5a['id'],'available':_0x48ce5a[_0x81e2('0x47')],'loggedIn':_0x48ce5a[_0x81e2('0x48')],'name':_0x48ce5a[_0x81e2('0x49')],'paused':_0x48ce5a[_0x81e2('0x4a')],'waiting':_0x48ce5a['waiting']};_0x2b1bb7[_0x81e2('0x1e')](_0x1d62e4);}}_0x230357({'count':_0x2b1bb7['length'],'rows':_0x2b1bb7});});},'ChatQueuesWaitingInteractions':function(_0x15a710){return new Promise(function(_0x2fa9cf,_0x2e5997){var _0x11934c=_['values'](_0x116b81[_0x81e2('0x51')]);_0x2fa9cf({'count':_0x11934c[_0x81e2('0x16')],'rows':_0x11934c});});},'MailQueuesWaitingInteractions':function(_0x46a129){return new Promise(function(_0x56fc82,_0x302127){var _0x1f9c32=_[_0x81e2('0x45')](_0x116b81[_0x81e2('0x52')]);_0x56fc82({'count':_0x1f9c32[_0x81e2('0x16')],'rows':_0x1f9c32});});},'OpenchannelQueuesWaitingInteractions':function(_0x42f638){return new Promise(function(_0x4e0b05,_0x3aa7b6){var _0x2c3b93=_[_0x81e2('0x45')](_0x116b81['openchannelQueuesWaitingInteractions']);_0x4e0b05({'count':_0x2c3b93['length'],'rows':_0x2c3b93});});},'SmsQueuesWaitingInteractions':function(_0x8029a8){return new Promise(function(_0x555d79,_0x1db2a6){var _0x4618c5=_['values'](_0x116b81[_0x81e2('0x53')]);_0x555d79({'count':_0x4618c5[_0x81e2('0x16')],'rows':_0x4618c5});});},'FaxQueuesWaitingInteractions':function(_0x367c60){return new Promise(function(_0x5ae94c,_0x5cb829){var _0x4868e8=_[_0x81e2('0x45')](_0x116b81['faxQueuesWaitingInteractions']);_0x5ae94c({'count':_0x4868e8[_0x81e2('0x16')],'rows':_0x4868e8});});},'WhatsappQueuesWaitingInteractions':function(_0x5e493c){return new Promise(function(_0x17a1d8,_0x2098dc){var _0x1d6c51=_[_0x81e2('0x45')](_0x116b81[_0x81e2('0x54')]);_0x17a1d8({'count':_0x1d6c51[_0x81e2('0x16')],'rows':_0x1d6c51});});}};var _0x3e4156=jayson['server'](_0x5909c7)[_0x81e2('0x55')]();_0x3e4156['on'](_0x81e2('0x2d'),function(_0x30eea9){logger[_0x81e2('0x2d')](JSON['stringify'](_0x30eea9));return _0x4c9f03(_0x30eea9);});_0x3e4156['listen'](0x232c,'127.0.0.1',function(){console[_0x81e2('0x56')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x14c3db(_0x81e2('0x57')+0x232c);});});}; \ No newline at end of file +var _0x5dc2=['server','http','127.0.0.1','log','lodash','util','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','dialogflowv2','appdata','amazonlex','tag','%s:%s:%s','intervals','./applications/','consequence','priority','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','info','stack','routing\x20is\x20empty','QueueReport','UserId','catch','agent','agents','busy','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','agent\x20not\x20found','chatQueues','loggedIn','waiting','mailQueues','available','openchannelQueues','name','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x2c1fbd,_0x3470ff){var _0x506652=function(_0x45544f){while(--_0x45544f){_0x2c1fbd['push'](_0x2c1fbd['shift']());}};_0x506652(++_0x3470ff);}(_0x5dc2,0xb6));var _0x25dc=function(_0x2b2321,_0x2ccacd){_0x2b2321=_0x2b2321-0x0;var _0x14e601=_0x5dc2[_0x2b2321];return _0x14e601;};'use strict';var _=require(_0x25dc('0x0'));var util=require(_0x25dc('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x25dc('0x2'));var BPromise=require(_0x25dc('0x3'));var uuid=require(_0x25dc('0x4'));var config=require('../../../config/environment');var logger=require(_0x25dc('0x5'))(_0x25dc('0x6'));var rpc={'openchannelQueueReport':require(_0x25dc('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x25dc('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x25dc('0x9')),'whatsappQueueReport':require(_0x25dc('0xa'))};var RuleEngine=require(_0x25dc('0xb'));function getId(_0x46b603,_0x1fa806,_0x575178){return util[_0x25dc('0xc')](_0x25dc('0xd'),_0x46b603,_0x1fa806||0x0,_0x575178||0x0);}function getIntervals(_0x52f81a,_0x209dd0){var _0xb3a2ec=[];if(!_[_0x25dc('0xe')](_0x209dd0[_0x25dc('0xf')])&&!_['isNil'](_0x52f81a[_0x209dd0[_0x25dc('0xf')]])&&!_[_0x25dc('0xe')](_0x52f81a[_0x209dd0[_0x25dc('0xf')]][_0x25dc('0x10')])){_0xb3a2ec=_[_0x25dc('0x11')](_0x52f81a[_0x209dd0[_0x25dc('0xf')]][_0x25dc('0x10')],_0x25dc('0x12'));}else if(!_[_0x25dc('0xe')](_0x209dd0['interval'])){_0xb3a2ec=[_0x209dd0[_0x25dc('0x12')]];}return _0xb3a2ec;}exports[_0x25dc('0x13')]=function(_0x2531cf){_0x2531cf[_0x25dc('0x14')]={};return new BPromise(function(_0x164526,_0x14a680){var _0x41bf64={'Start':function(_0x453126){var _0x6fbdff=this;return new Promise(function(_0x55af7b,_0xaaa430){if(_0x453126){try{var _0x38a162=[];var _0x294b4e=getId(_0x453126[_0x25dc('0x15')],_0x453126[_0x25dc('0x16')]?_0x453126[_0x25dc('0x16')]['id']:0x0,_0x453126[_0x25dc('0x17')]?_0x453126[_0x25dc('0x17')]['id']:0x0);if(_0x453126['applications']&&_[_0x25dc('0x18')](_0x453126[_0x25dc('0x19')])&&_0x453126['applications']['length']){for(var _0x8344b7=0x0;_0x8344b7<_0x453126[_0x25dc('0x19')][_0x25dc('0x1a')];_0x8344b7+=0x1){var _0x9b94e6=_0x453126['applications'][_0x8344b7];if(fs[_0x25dc('0x1b')](path[_0x25dc('0x1c')](__dirname,_0x25dc('0x19'),_0x9b94e6[_0x25dc('0x1d')]+_0x25dc('0x1e')))){var _0x45a4ac=[];switch(_0x9b94e6[_0x25dc('0x1d')][_0x25dc('0x1f')]()){case _0x25dc('0x20'):var _0x8d9fcb=_0x9b94e6['appdata'][_0x25dc('0x21')](',');_0x45a4ac[_0x25dc('0x22')](_0x8d9fcb[0x0]);_0x45a4ac['push'](_0x8d9fcb[_0x25dc('0x23')](0x1,_0x8d9fcb[_0x25dc('0x1a')])[_0x25dc('0x1c')](','));break;case _0x25dc('0x24'):var _0x3a8417=_0x9b94e6['appdata'][_0x25dc('0x21')](',');_0x45a4ac[_0x25dc('0x22')](_0x3a8417[0x0]);_0x45a4ac[_0x25dc('0x22')](_0x3a8417[0x1]);_0x45a4ac[_0x25dc('0x22')](_0x3a8417[_0x25dc('0x23')](0x2,_0x3a8417['length'])[_0x25dc('0x1c')](','));break;case _0x25dc('0x25'):var _0x3138af=_0x9b94e6[_0x25dc('0x26')]['split'](',');_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x0]);_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x1]);_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x2]);_0x45a4ac[_0x25dc('0x22')](_0x3138af[0x3]);_0x45a4ac['push'](_0x3138af[_0x25dc('0x23')](0x4,_0x3138af[_0x25dc('0x1a')])[_0x25dc('0x1c')](','));break;case _0x25dc('0x27'):var _0x5afdbf=_0x9b94e6[_0x25dc('0x26')]['split'](',');_0x45a4ac['push'](_0x5afdbf[0x0]);_0x45a4ac[_0x25dc('0x22')](_0x5afdbf[0x1]);_0x45a4ac['push'](_0x5afdbf[0x2]);_0x45a4ac['push'](_0x5afdbf[0x3]);_0x45a4ac[_0x25dc('0x22')](_0x5afdbf[_0x25dc('0x23')](0x4,_0x5afdbf[_0x25dc('0x1a')])['join'](','));break;case'message':_0x45a4ac[_0x25dc('0x22')](_0x9b94e6[_0x25dc('0x26')]);break;case _0x25dc('0x28'):_0x45a4ac[_0x25dc('0x22')](_0x9b94e6['TagId']);_0x45a4ac[_0x25dc('0x22')](_0x9b94e6['appdata']);break;default:_0x45a4ac=_[_0x25dc('0xe')](_0x9b94e6[_0x25dc('0x26')])?[]:_0x9b94e6[_0x25dc('0x26')]['split'](',');}var _0x2fcbc7={'id':util[_0x25dc('0xc')](_0x25dc('0x29'),_0x294b4e,_0x9b94e6['id'],_0x9b94e6[_0x25dc('0x1d')]),'condition':require('./interval')['condition'](_0x294b4e,getIntervals(_0x2531cf[_0x25dc('0x2a')],_0x9b94e6),_0x2531cf),'consequence':require(_0x25dc('0x2b')+_0x9b94e6[_0x25dc('0x1d')])[_0x25dc('0x2c')](_0x294b4e,_0x45a4ac,_0x2531cf,_0x453126),'p':_0x9b94e6[_0x25dc('0x2d')]||0x0};logger['info'](_0x25dc('0x2e'),_0x2fcbc7['id'],'on\x20interval',getIntervals(_0x2531cf['intervals'],_0x9b94e6)['join']('\x20|\x20'));_0x38a162['push'](_0x2fcbc7);}else{logger[_0x25dc('0x2f')](_0x25dc('0x30'),path[_0x25dc('0x1c')](__dirname,_0x25dc('0x19'),_0x9b94e6[_0x25dc('0x1d')]+_0x25dc('0x1e')));}}_0x2531cf[_0x25dc('0x14')][_0x294b4e]=new RuleEngine(_0x38a162);_0x2531cf[_0x25dc('0x14')][_0x294b4e][_0x25dc('0x31')](_0x453126,function(_0x5a2c40){logger['info'](_0x25dc('0x32'),JSON[_0x25dc('0x33')](_0x5a2c40[_0x25dc('0x34')]));if(_0x2531cf[_0x25dc('0x14')][_0x294b4e]){_0x2531cf[_0x25dc('0x14')][_0x294b4e][_0x25dc('0x35')]('complete');}});return _0x55af7b({'code':0xc8,'message':_0x453126});}else{logger[_0x25dc('0x36')]('No\x20applications\x20to\x20execute');return _0x55af7b({'code':0xc8,'message':_0x453126});}}catch(_0x87b77b){logger[_0x25dc('0x2f')](_0x87b77b[_0x25dc('0x37')]);return _0xaaa430(_0x6fbdff['error'](0x1f4,_0x87b77b));}}return _0xaaa430(_0x25dc('0x38'));});},'AcceptMessage':function(_0x30e9c6){var _0x24722f=this;return new Promise(function(_0x585d3f,_0x530978){if(_0x30e9c6[_0x25dc('0x16')]&&_0x30e9c6[_0x25dc('0x16')]['id']){try{var _0x16ade3=getId(_0x30e9c6[_0x25dc('0x15')],_0x30e9c6[_0x25dc('0x16')]?_0x30e9c6['message']['id']:0x0,_0x30e9c6['interaction']?_0x30e9c6[_0x25dc('0x17')]['id']:0x0);if(_0x2531cf[_0x25dc('0x14')][_0x16ade3]){_0x2531cf[_0x25dc('0x14')][_0x16ade3][_0x25dc('0x35')]('end');if(rpc[_0x30e9c6[_0x25dc('0x15')]+_0x25dc('0x39')]){rpc[_0x30e9c6[_0x25dc('0x15')]+_0x25dc('0x39')]['update'](_0x16ade3,{'UserId':_0x30e9c6[_0x25dc('0x16')][_0x25dc('0x3a')]})[_0x25dc('0x3b')](function(_0x65d126){logger[_0x25dc('0x2f')]('error\x20update\x20queue\x20report');});}}return _0x585d3f({'code':0xc8,'message':_0x30e9c6});}catch(_0x3960bf){logger[_0x25dc('0x2f')](_0x3960bf[_0x25dc('0x37')]);return _0x530978(_0x24722f[_0x25dc('0x2f')](0x1f4,_0x3960bf));}}logger[_0x25dc('0x2f')]('message\x20is\x20empty');return _0x530978(_0x24722f[_0x25dc('0x2f')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x14c7e4){var _0x1aa9b7=this;return new Promise(function(_0x5c701d,_0x5cc1ea){if(_0x14c7e4[_0x25dc('0x3c')]&&_0x14c7e4[_0x25dc('0x3c')]['id']){try{if(_0x2531cf[_0x25dc('0x3d')][_0x14c7e4[_0x25dc('0x3c')]['id']]){_0x2531cf['agents'][_0x14c7e4[_0x25dc('0x3c')]['id']][_0x25dc('0x3e')]=![];_0x2531cf[_0x25dc('0x3d')][_0x14c7e4[_0x25dc('0x3c')]['id']][_0x25dc('0x3f')]=undefined;}return _0x5c701d({'code':0xc8,'message':_0x14c7e4});}catch(_0x29d2f2){logger[_0x25dc('0x2f')](_0x29d2f2[_0x25dc('0x37')]);return _0x5cc1ea(_0x1aa9b7[_0x25dc('0x2f')](0x1f4,_0x29d2f2));}}logger[_0x25dc('0x2f')](_0x25dc('0x40'));return _0x5cc1ea(_0x1aa9b7[_0x25dc('0x2f')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x824698){var _0x4bb11e=this;return new Promise(function(_0x406775,_0x53012a){if(_0x824698[_0x25dc('0x15')]&&_0x824698[_0x25dc('0x17')]&&_0x824698[_0x25dc('0x17')]['id']){try{var _0x440fd0=getId(_0x824698[_0x25dc('0x15')],_0x824698[_0x25dc('0x16')]?_0x824698[_0x25dc('0x16')]['id']:0x0,_0x824698['interaction']?_0x824698['interaction']['id']:0x0);if(_0x2531cf[_0x25dc('0x14')][_0x440fd0]){_0x2531cf['rules'][_0x440fd0][_0x25dc('0x35')]('end');}return _0x406775({'code':0xc8,'message':_0x824698});}catch(_0x16ba1b){logger['error'](_0x16ba1b[_0x25dc('0x37')]);return _0x53012a(_0x4bb11e['error'](0x1f4,_0x16ba1b));}}logger[_0x25dc('0x2f')](_0x25dc('0x40'));return _0x53012a(_0x4bb11e['error'](0x1f4,_0x25dc('0x40')));});},'AgentCapacity':function(_0x542bbd){var _0x42836c=this;return new Promise(function(_0x55dd6d,_0x21c431){if(_0x2531cf['agents'][_0x25dc('0x41')](_0x542bbd['id'])){for(var _0x2bfb2a in _0x542bbd[_0x25dc('0x42')]){if(_0x542bbd[_0x25dc('0x42')][_0x25dc('0x41')](_0x2bfb2a)){if(_0x2531cf[_0x25dc('0x3d')][_0x542bbd['id']][_0x25dc('0x41')](_0x2bfb2a+'CurrentCapacity')){_0x2531cf[_0x25dc('0x3d')][_0x542bbd['id']][_0x2bfb2a+'CurrentCapacity']=parseInt(_0x542bbd['capacity'][_0x2bfb2a],0xa);}}}_0x2531cf['agents'][_0x542bbd['id']]['updateRealtime']();return _0x55dd6d({'code':0xc8,'message':_0x2531cf[_0x25dc('0x3d')][_0x542bbd['id']]});}else{return _0x21c431(_0x42836c[_0x25dc('0x2f')](0x1f4,_0x25dc('0x43')));}});},'Agents':function(_0xafdb4b){return new Promise(function(_0x5e38e6,_0x42b337){var _0x235b80=_['values'](_0x2531cf[_0x25dc('0x3d')]);_0x5e38e6({'count':_0x235b80[_0x25dc('0x1a')],'rows':_0x235b80});});},'ChatQueues':function(_0x502c1b){return new Promise(function(_0x3538c4,_0x4d9125){var _0x4a9cf2=[];for(var _0x49f67d in _0x2531cf[_0x25dc('0x44')]){if(_0x2531cf['chatQueues'][_0x25dc('0x41')](_0x49f67d)){var _0x37603a=_0x2531cf[_0x25dc('0x44')][_0x49f67d];var _0x1eba5e={'id':_0x37603a['id'],'available':_0x37603a['available'],'loggedIn':_0x37603a[_0x25dc('0x45')],'name':_0x37603a['name'],'paused':_0x37603a['paused'],'waiting':_0x37603a[_0x25dc('0x46')]};_0x4a9cf2['push'](_0x1eba5e);}}_0x3538c4({'count':_0x4a9cf2['length'],'rows':_0x4a9cf2});});},'MailQueues':function(_0x18bf2f){return new Promise(function(_0x28d281,_0x401a00){var _0x274bf5=[];for(var _0x557f48 in _0x2531cf[_0x25dc('0x47')]){if(_0x2531cf[_0x25dc('0x47')][_0x25dc('0x41')](_0x557f48)){var _0x141c92=_0x2531cf[_0x25dc('0x47')][_0x557f48];var _0x7f9b80={'id':_0x141c92['id'],'available':_0x141c92[_0x25dc('0x48')],'loggedIn':_0x141c92[_0x25dc('0x45')],'name':_0x141c92['name'],'paused':_0x141c92['paused'],'waiting':_0x141c92[_0x25dc('0x46')]};_0x274bf5[_0x25dc('0x22')](_0x7f9b80);}}_0x28d281({'count':_0x274bf5['length'],'rows':_0x274bf5});});},'OpenchannelQueues':function(_0x59647f){return new Promise(function(_0x3bb133,_0x46d7e9){var _0x3f5a7e=[];for(var _0x47566a in _0x2531cf[_0x25dc('0x49')]){if(_0x2531cf[_0x25dc('0x49')][_0x25dc('0x41')](_0x47566a)){var _0x1c8642=_0x2531cf[_0x25dc('0x49')][_0x47566a];var _0x2bb8be={'id':_0x1c8642['id'],'available':_0x1c8642['available'],'loggedIn':_0x1c8642['loggedIn'],'name':_0x1c8642[_0x25dc('0x4a')],'paused':_0x1c8642[_0x25dc('0x4b')],'waiting':_0x1c8642['waiting']};_0x3f5a7e[_0x25dc('0x22')](_0x2bb8be);}}_0x3bb133({'count':_0x3f5a7e[_0x25dc('0x1a')],'rows':_0x3f5a7e});});},'SmsQueues':function(_0x513cae){return new Promise(function(_0x3a9109,_0x3c994f){var _0x4edee3=[];for(var _0x26308e in _0x2531cf[_0x25dc('0x4c')]){if(_0x2531cf['smsQueues'][_0x25dc('0x41')](_0x26308e)){var _0x139b74=_0x2531cf[_0x25dc('0x4c')][_0x26308e];var _0xc0bac8={'id':_0x139b74['id'],'available':_0x139b74[_0x25dc('0x48')],'loggedIn':_0x139b74[_0x25dc('0x45')],'name':_0x139b74[_0x25dc('0x4a')],'paused':_0x139b74[_0x25dc('0x4b')],'waiting':_0x139b74['waiting']};_0x4edee3[_0x25dc('0x22')](_0xc0bac8);}}_0x3a9109({'count':_0x4edee3[_0x25dc('0x1a')],'rows':_0x4edee3});});},'FaxQueues':function(_0x642758){return new Promise(function(_0x15f4bc,_0x200bb1){var _0x132d6c=[];for(var _0x535508 in _0x2531cf[_0x25dc('0x4d')]){if(_0x2531cf[_0x25dc('0x4d')]['hasOwnProperty'](_0x535508)){var _0x32d15d=_0x2531cf[_0x25dc('0x4d')][_0x535508];var _0x158579={'id':_0x32d15d['id'],'available':_0x32d15d['available'],'loggedIn':_0x32d15d['loggedIn'],'name':_0x32d15d[_0x25dc('0x4a')],'paused':_0x32d15d[_0x25dc('0x4b')],'waiting':_0x32d15d[_0x25dc('0x46')]};_0x132d6c[_0x25dc('0x22')](_0x158579);}}_0x15f4bc({'count':_0x132d6c['length'],'rows':_0x132d6c});});},'WhatsappQueues':function(_0x3ec514){return new Promise(function(_0x522dc9,_0x3c8d88){var _0x278635=[];for(var _0x10f578 in _0x2531cf[_0x25dc('0x4e')]){if(_0x2531cf[_0x25dc('0x4e')]['hasOwnProperty'](_0x10f578)){var _0x10a377=_0x2531cf[_0x25dc('0x4e')][_0x10f578];var _0x1878e4={'id':_0x10a377['id'],'available':_0x10a377['available'],'loggedIn':_0x10a377[_0x25dc('0x45')],'name':_0x10a377['name'],'paused':_0x10a377['paused'],'waiting':_0x10a377[_0x25dc('0x46')]};_0x278635['push'](_0x1878e4);}}_0x522dc9({'count':_0x278635[_0x25dc('0x1a')],'rows':_0x278635});});},'ChatQueuesWaitingInteractions':function(_0x2b8d2c){return new Promise(function(_0x1837c1,_0x36df95){var _0x32cccd=_['values'](_0x2531cf[_0x25dc('0x4f')]);_0x1837c1({'count':_0x32cccd[_0x25dc('0x1a')],'rows':_0x32cccd});});},'MailQueuesWaitingInteractions':function(_0x3ea37e){return new Promise(function(_0x28a918,_0x2bda09){var _0x497ecc=_['values'](_0x2531cf[_0x25dc('0x50')]);_0x28a918({'count':_0x497ecc[_0x25dc('0x1a')],'rows':_0x497ecc});});},'OpenchannelQueuesWaitingInteractions':function(_0x2a5e6d){return new Promise(function(_0x26a13c,_0x5a190a){var _0x59b6ce=_[_0x25dc('0x51')](_0x2531cf[_0x25dc('0x52')]);_0x26a13c({'count':_0x59b6ce[_0x25dc('0x1a')],'rows':_0x59b6ce});});},'SmsQueuesWaitingInteractions':function(_0x4e29f1){return new Promise(function(_0x59be8f,_0x4e135c){var _0x1e29f5=_[_0x25dc('0x51')](_0x2531cf[_0x25dc('0x53')]);_0x59be8f({'count':_0x1e29f5[_0x25dc('0x1a')],'rows':_0x1e29f5});});},'FaxQueuesWaitingInteractions':function(_0x26dd5e){return new Promise(function(_0x10a3fa,_0x47e39c){var _0x4a6347=_[_0x25dc('0x51')](_0x2531cf[_0x25dc('0x54')]);_0x10a3fa({'count':_0x4a6347[_0x25dc('0x1a')],'rows':_0x4a6347});});},'WhatsappQueuesWaitingInteractions':function(_0x4784e0){return new Promise(function(_0x2e3c68,_0x678d66){var _0x90646f=_[_0x25dc('0x51')](_0x2531cf['whatsappQueuesWaitingInteractions']);_0x2e3c68({'count':_0x90646f['length'],'rows':_0x90646f});});}};var _0x5c8bfd=jayson[_0x25dc('0x55')](_0x41bf64)[_0x25dc('0x56')]();_0x5c8bfd['on'](_0x25dc('0x2f'),function(_0x1c370a){logger[_0x25dc('0x2f')](JSON[_0x25dc('0x33')](_0x1c370a));return _0x14a680(_0x1c370a);});_0x5c8bfd['listen'](0x232c,_0x25dc('0x57'),function(){console[_0x25dc('0x58')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x164526('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e516ef9..c3c1152 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 _0xe502=['message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','then','error','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe502,0x88));var _0x2e50=function(_0x54861e,_0x305f42){_0x54861e=_0x54861e-0x0;var _0x4c20d7=_0xe502[_0x54861e];return _0x4c20d7;};'use strict';var util=require(_0x2e50('0x0'));var BPromise=require(_0x2e50('0x1'));var jayson=require(_0x2e50('0x2'));var _=require('lodash');var logger=require(_0x2e50('0x3'))(_0x2e50('0x4'));var client=jayson[_0x2e50('0x5')][_0x2e50('0x6')]({'port':0x232a});function request(_0x2bb743,_0x43c862){return new BPromise(function(_0x46fead,_0x314206){return client['request'](_0x2bb743,_0x43c862)[_0x2e50('0x7')](function(_0x279d80){if(_0x279d80[_0x2e50('0x8')]){return _0x314206(_0x279d80['error']['message']);}else{return _0x46fead(_0x279d80[_0x2e50('0x9')]);}})[_0x2e50('0xa')](function(_0x2fa973){return _0x314206(_0x2fa973);});});}exports[_0x2e50('0xb')]=function(_0x4857d4,_0x21106e,_0x214d76){return function(_0x874698){if(_0x214d76['rules']&&!_0x214d76['rules'][_0x4857d4]){logger[_0x2e50('0xc')](_0x2e50('0xd'),_0x4857d4);return _0x874698[_0x2e50('0xe')]();}var _0x22cce3=[];for(var _0x33473f=0x0;_0x33473f<_0x21106e[_0x2e50('0xf')];_0x33473f+=0x1){_0x22cce3['push'](request(_0x2e50('0x10'),{'command':util[_0x2e50('0x11')](_0x2e50('0x12'),_0x21106e[_0x33473f])})[_0x2e50('0x7')](function(_0x126368){return _0x126368&&_0x126368['message']&&_0x126368[_0x2e50('0x13')][_0x2e50('0x14')](_0x2e50('0x15'))>=0x0?!![]:![];})[_0x2e50('0xa')](function(_0x9e23d0){logger[_0x2e50('0x8')](_0x2e50('0x16'),_0x4857d4,_0x21106e[_0x33473f]);}));}BPromise[_0x2e50('0x17')](_0x22cce3)['then'](function(_0x4b9053){var _0x21ca79=_[_0x2e50('0x18')](_0x4b9053);logger[_0x2e50('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x4857d4,_0x21106e[_0x2e50('0x19')](_0x2e50('0x1a')),_0x21ca79);_0x874698[_0x2e50('0x1b')](_0x21ca79);})[_0x2e50('0xa')](function(_0x544427){console[_0x2e50('0x1c')](_0x544427);logger['error'](_0x2e50('0x1d'),_0x4857d4,_0x21106e[_0x2e50('0x19')]('\x20|\x20'),_0x544427[_0x2e50('0x1e')]);_0x874698['stop']();});};}; \ No newline at end of file +var _0xee64=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s'];(function(_0xb51f38,_0x37361b){var _0x333754=function(_0x442f07){while(--_0x442f07){_0xb51f38['push'](_0xb51f38['shift']());}};_0x333754(++_0x37361b);}(_0xee64,0x19c));var _0x4ee6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xee64[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x4ee6('0x0'));var BPromise=require(_0x4ee6('0x1'));var jayson=require(_0x4ee6('0x2'));var _=require(_0x4ee6('0x3'));var logger=require(_0x4ee6('0x4'))(_0x4ee6('0x5'));var client=jayson[_0x4ee6('0x6')][_0x4ee6('0x7')]({'port':0x232a});function request(_0x5477a3,_0x4bf865){return new BPromise(function(_0x3d7886,_0x25c824){return client[_0x4ee6('0x8')](_0x5477a3,_0x4bf865)[_0x4ee6('0x9')](function(_0x5e8f91){if(_0x5e8f91['error']){return _0x25c824(_0x5e8f91[_0x4ee6('0xa')][_0x4ee6('0xb')]);}else{return _0x3d7886(_0x5e8f91['result']);}})[_0x4ee6('0xc')](function(_0x2eb012){return _0x25c824(_0x2eb012);});});}exports[_0x4ee6('0xd')]=function(_0x4e3249,_0x294adb,_0x12ce14){return function(_0x5ba8ee){if(_0x12ce14[_0x4ee6('0xe')]&&!_0x12ce14[_0x4ee6('0xe')][_0x4e3249]){logger[_0x4ee6('0xf')](_0x4ee6('0x10'),_0x4e3249);return _0x5ba8ee[_0x4ee6('0x11')]();}var _0x5214ba=[];for(var _0x4993aa=0x0;_0x4993aa<_0x294adb['length'];_0x4993aa+=0x1){_0x5214ba[_0x4ee6('0x12')](request(_0x4ee6('0x13'),{'command':util[_0x4ee6('0x14')](_0x4ee6('0x15'),_0x294adb[_0x4993aa])})[_0x4ee6('0x9')](function(_0x8fa939){return _0x8fa939&&_0x8fa939[_0x4ee6('0xb')]&&_0x8fa939[_0x4ee6('0xb')]['indexOf'](_0x4ee6('0x16'))>=0x0?!![]:![];})[_0x4ee6('0xc')](function(_0x3cbf8c){logger[_0x4ee6('0xa')](_0x4ee6('0x17'),_0x4e3249,_0x294adb[_0x4993aa]);}));}BPromise[_0x4ee6('0x18')](_0x5214ba)['then'](function(_0x4649eb){var _0x64d2ee=_[_0x4ee6('0x19')](_0x4649eb);logger['info'](_0x4ee6('0x1a'),_0x4e3249,_0x294adb[_0x4ee6('0x1b')](_0x4ee6('0x1c')),_0x64d2ee);_0x5ba8ee[_0x4ee6('0x1d')](_0x64d2ee);})['catch'](function(_0x1abbf0){console[_0x4ee6('0x1e')](_0x1abbf0);logger[_0x4ee6('0xa')](_0x4ee6('0x1a'),_0x4e3249,_0x294adb[_0x4ee6('0x1b')](_0x4ee6('0x1c')),_0x1abbf0['stack']);_0x5ba8ee[_0x4ee6('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 0f3ec7b..a34d3f8 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 _0xd434=['holdtime','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','ATTENDED','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','lodash','util','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','[%s][agents][agentcalled]','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','ringtime','talktime','error','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned'];(function(_0x227e36,_0x4fade0){var _0x4040b0=function(_0x302efa){while(--_0x302efa){_0x227e36['push'](_0x227e36['shift']());}};_0x4040b0(++_0x4fade0);}(_0xd434,0x1ba));var _0x4d43=function(_0x5718b3,_0x239d7e){_0x5718b3=_0x5718b3-0x0;var _0x2ab75f=_0xd434[_0x5718b3];return _0x2ab75f;};'use strict';var _=require(_0x4d43('0x0'));var util=require(_0x4d43('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x548005,_0x1b0b18){utils[_0x4d43('0x2')](util[_0x4d43('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x548005[_0x4d43('0x4')],_0x548005[_0x4d43('0x5')],_0x548005[_0x4d43('0x6')],_0x548005[_0x4d43('0x7')],_0x548005[_0x4d43('0x8')],_0x548005['calleridnum'],_0x548005[_0x4d43('0x9')],_0x548005[_0x4d43('0xa')]));if(_0x548005[_0x4d43('0x6')]){utils[_0x4d43('0xb')](_0x548005[_0x4d43('0x6')])['then'](function(_0x1467b4){if(_0x1467b4){_0x548005[_0x4d43('0xc')]=_0x1467b4[_0x4d43('0xc')];_0x548005['agentacw']=_0x548005[_0x4d43('0xd')]?_0x1467b4['acw']:![];_0x548005['acwtime']=_0x548005[_0x4d43('0xe')]?_0x1467b4[_0x4d43('0xf')]:0x0;}utils[_0x4d43('0x10')]('CreateVoiceAgentReport',_0x548005);});}else{utils[_0x4d43('0x10')](_0x4d43('0x11'),_0x548005);}if(_0x1b0b18){delete transfers[_0x548005[_0x4d43('0x4')]];}else{delete agents[_0x548005[_0x4d43('0x12')]];}}exports[_0x4d43('0x13')]=function(_0xd8dc9b){try{utils[_0x4d43('0x14')](util[_0x4d43('0x3')]('[%s][agents][agentcalled]',_0xd8dc9b[_0x4d43('0x4')]),_0xd8dc9b);agents[_0xd8dc9b[_0x4d43('0x12')]]=_0xd8dc9b;agents[_0xd8dc9b[_0x4d43('0x12')]][_0x4d43('0x15')]=utils['now']();agents[_0xd8dc9b['destuniqueid']][_0x4d43('0xa')]='called';agents[_0xd8dc9b[_0x4d43('0x12')]][_0x4d43('0x9')]=null;agents[_0xd8dc9b[_0x4d43('0x12')]][_0x4d43('0x16')]=null;utils['info'](util[_0x4d43('0x3')](_0x4d43('0x17'),_0xd8dc9b['uniqueid'],agents[_0xd8dc9b['destuniqueid']][_0x4d43('0x7')],_0xd8dc9b['destuniqueid']));}catch(_0x3e232c){utils['error'](util[_0x4d43('0x3')](_0x4d43('0x18'),_0xd8dc9b['uniqueid']),_0x3e232c);}};exports['agentringnoanswer']=function(_0x5c324a){try{if(!_['isNil'](agents[_0x5c324a[_0x4d43('0x12')]])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x19'),_0x5c324a['uniqueid']),_0x5c324a);utils[_0x4d43('0x2')](util[_0x4d43('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5c324a[_0x4d43('0x4')],agents[_0x5c324a['destuniqueid']][_0x4d43('0x7')],_0x5c324a[_0x4d43('0x12')]));agents[_0x5c324a['destuniqueid']][_0x4d43('0x1a')]=!![];agents[_0x5c324a[_0x4d43('0x12')]][_0x4d43('0x1b')]=utils[_0x4d43('0x1c')]();agents[_0x5c324a['destuniqueid']]['lastevent']=_0x4d43('0x1d');agents[_0x5c324a['destuniqueid']][_0x4d43('0x1e')]='timeout';agents[_0x5c324a[_0x4d43('0x12')]]['holdtime']=_0x5c324a[_0x4d43('0x1f')]?parseInt(_0x5c324a[_0x4d43('0x1f')])/0x3e8:0x0;agents[_0x5c324a['destuniqueid']][_0x4d43('0x20')]=0x0;unanswered['push'](_0x5c324a[_0x4d43('0x12')]);}}catch(_0x9d84cd){utils[_0x4d43('0x21')](util[_0x4d43('0x3')](_0x4d43('0x19'),_0x5c324a[_0x4d43('0x4')]),_0x9d84cd);}};exports['queuecallerabandon']=function(_0x2fb922){try{_['forIn'](agents,function(_0x5724c0,_0x66331d){if(_0x5724c0[_0x4d43('0x4')]==_0x2fb922[_0x4d43('0x4')]&&!_[_0x4d43('0x22')](unanswered,_0x5724c0[_0x4d43('0x12')])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x23'),_0x2fb922[_0x4d43('0x4')]),_0x2fb922);utils[_0x4d43('0x2')](util['format'](_0x4d43('0x24'),_0x2fb922['uniqueid'],_0x5724c0[_0x4d43('0x7')],_0x5724c0[_0x4d43('0x12')]));_0x5724c0[_0x4d43('0x1a')]=!![];_0x5724c0[_0x4d43('0x1b')]=utils[_0x4d43('0x1c')]();_0x5724c0[_0x4d43('0xa')]=_0x4d43('0x25');_0x5724c0[_0x4d43('0x1e')]=_0x4d43('0x25');_0x5724c0[_0x4d43('0x26')]=_0x2fb922[_0x4d43('0x26')];_0x5724c0['talktime']=0x0;writeDB(_0x5724c0);}});}catch(_0x378dca){utils['error'](util['format'](_0x4d43('0x23'),_0x2fb922[_0x4d43('0x4')]),_0x378dca);}};exports['agentconnect']=function(_0x2a80c7){try{if(agents[_0x2a80c7['destuniqueid']]){utils[_0x4d43('0x14')](util['format']('[%s][agents][agentconnect]',_0x2a80c7['uniqueid']),_0x2a80c7);utils['info'](util['format'](_0x4d43('0x27'),_0x2a80c7[_0x4d43('0x4')],agents[_0x2a80c7[_0x4d43('0x12')]][_0x4d43('0x7')],_0x2a80c7[_0x4d43('0x12')]));agents[_0x2a80c7[_0x4d43('0x12')]][_0x4d43('0x28')]=utils[_0x4d43('0x1c')]();agents[_0x2a80c7[_0x4d43('0x12')]][_0x4d43('0x9')]=_0x2a80c7['connectedlinenum'];agents[_0x2a80c7[_0x4d43('0x12')]]['connectedlinename']=_0x2a80c7['connectedlinename'];agents[_0x2a80c7[_0x4d43('0x12')]]['holdtime']=_0x2a80c7[_0x4d43('0x1f')];agents[_0x2a80c7['destuniqueid']][_0x4d43('0xa')]='connect';_['forIn'](agents,function(_0x51236f,_0x30d5cf){if(_0x51236f[_0x4d43('0x12')]!=_0x2a80c7[_0x4d43('0x12')]&&_0x51236f[_0x4d43('0x4')]==_0x2a80c7[_0x4d43('0x4')]){_0x51236f['talktime']=0x0;_0x51236f['holdtime']=_0x2a80c7[_0x4d43('0x1f')];_0x51236f['agentringnoanswer']=!![];_0x51236f[_0x4d43('0x1b')]=utils['now']();_0x51236f[_0x4d43('0xa')]='answered_elsewhere';_0x51236f[_0x4d43('0x1e')]=_0x4d43('0x29');_0x51236f[_0x4d43('0x2a')]=_0x2a80c7[_0x4d43('0x12')];_0x51236f[_0x4d43('0x2b')]=_0x2a80c7[_0x4d43('0x7')];writeDB(_0x51236f);}});}}catch(_0x450a2a){utils[_0x4d43('0x21')](util[_0x4d43('0x3')]('[%s][agents][agentconnect]',_0x2a80c7['uniqueid']),_0x450a2a);}};exports[_0x4d43('0xd')]=function(_0x393bde){try{if(!_[_0x4d43('0x2c')](agents[_0x393bde[_0x4d43('0x12')]])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x2d'),_0x393bde['uniqueid']),_0x393bde);utils[_0x4d43('0x2')](util[_0x4d43('0x3')](_0x4d43('0x2e'),_0x393bde[_0x4d43('0x4')],agents[_0x393bde[_0x4d43('0x12')]]['membername'],_0x393bde[_0x4d43('0x12')]));agents[_0x393bde[_0x4d43('0x12')]]['agentcomplete']=!![];agents[_0x393bde['destuniqueid']][_0x4d43('0x2f')]=utils[_0x4d43('0x1c')]();agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x20')]=utils['diffTime'](agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x2f')],agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x28')]);agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x1e')]=_0x393bde[_0x4d43('0x1e')];agents[_0x393bde[_0x4d43('0x12')]]['lastevent']=_0x4d43('0x30');writeDB(agents[_0x393bde['destuniqueid']]);}}catch(_0x20dcac){utils[_0x4d43('0x21')](util['format']('[%s][agents][agentcomplete]',_0x393bde[_0x4d43('0x4')]),_0x20dcac);}};exports[_0x4d43('0x31')]=function(_0x266ff9){try{if(!_[_0x4d43('0x2c')](agents[_0x266ff9['transfereruniqueid']])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x32'),_0x266ff9[_0x4d43('0x4')]),_0x266ff9);utils['info'](util[_0x4d43('0x3')](_0x4d43('0x33'),_0x266ff9['uniqueid'],agents[_0x266ff9[_0x4d43('0x34')]]['membername'],agents[_0x266ff9['transfereruniqueid']][_0x4d43('0x4')]));agents[_0x266ff9['transfereruniqueid']][_0x4d43('0x35')]=!![];agents[_0x266ff9['transfereruniqueid']][_0x4d43('0x36')]=_0x4d43('0x37');agents[_0x266ff9[_0x4d43('0x34')]][_0x4d43('0x38')]=_0x266ff9[_0x4d43('0x39')];agents[_0x266ff9[_0x4d43('0x34')]][_0x4d43('0x3a')]=agents[_0x266ff9[_0x4d43('0x34')]][_0x4d43('0x4')];}}catch(_0xc6c067){utils[_0x4d43('0x21')](util[_0x4d43('0x3')](_0x4d43('0x32'),_0x266ff9['uniqueid']),_0xc6c067);}};exports[_0x4d43('0x3b')]=function(_0x44d774){try{utils[_0x4d43('0x14')](util['format'](_0x4d43('0x3c'),_0x44d774[_0x4d43('0x3d')]),_0x44d774);if(_0x44d774[_0x4d43('0x3d')]==_0x44d774[_0x4d43('0x3e')]){if(!_[_0x4d43('0x2c')](agents[_0x44d774[_0x4d43('0x3f')]])){utils['info'](util[_0x4d43('0x3')](_0x4d43('0x40'),_0x44d774[_0x4d43('0x3d')],agents[_0x44d774['secondtransfereruniqueid']][_0x4d43('0x7')]));agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x35')]=!![];agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x36')]='ATTENDED';agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x38')]=_0x44d774[_0x4d43('0x41')];agents[_0x44d774['secondtransfereruniqueid']]['transferuniqueid']=_0x44d774['origtransfereruniqueid'];}if(_0x44d774[_0x4d43('0x42')]&&agents[_0x44d774[_0x4d43('0x42')]]){agents[_0x44d774[_0x4d43('0x42')]]['agententerreason']=0x1;transfers[_0x44d774['transfereeuniqueid']]=_[_0x4d43('0x43')](agents[_0x44d774[_0x4d43('0x42')]]);transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x44')]=agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x44')];transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x45')]=agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x45')];transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x15')]=utils[_0x4d43('0x1c')]();transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x28')]=utils[_0x4d43('0x1c')]();transfers[_0x44d774[_0x4d43('0x42')]]['holdtime']=0x0;transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x46')]=0x2;}}else if(_0x44d774[_0x4d43('0x3f')]==_0x44d774['secondtransfererlinkedid']){if(!_[_0x4d43('0x2c')](agents[_0x44d774[_0x4d43('0x3d')]])){utils['info'](util[_0x4d43('0x3')](_0x4d43('0x40'),_0x44d774['origtransfereruniqueid'],agents[_0x44d774[_0x4d43('0x3d')]][_0x4d43('0x7')]));agents[_0x44d774[_0x4d43('0x3d')]]['transfer']=!![];agents[_0x44d774[_0x4d43('0x3d')]]['transfertype']=_0x4d43('0x47');agents[_0x44d774['origtransfereruniqueid']][_0x4d43('0x38')]=_0x44d774['secondtransfererexten'];agents[_0x44d774[_0x4d43('0x3d')]][_0x4d43('0x3a')]=_0x44d774[_0x4d43('0x3f')];}if(_0x44d774['transfertargetuniqueid']&&agents[_0x44d774[_0x4d43('0x48')]]){agents[_0x44d774[_0x4d43('0x48')]][_0x4d43('0x46')]=0x1;transfers[_0x44d774[_0x4d43('0x48')]]=_[_0x4d43('0x43')](agents[_0x44d774[_0x4d43('0x48')]]);transfers[_0x44d774[_0x4d43('0x48')]]['calleridnum']=agents[_0x44d774['origtransfereruniqueid']][_0x4d43('0x44')];transfers[_0x44d774[_0x4d43('0x48')]][_0x4d43('0x45')]=agents[_0x44d774[_0x4d43('0x3d')]][_0x4d43('0x45')];transfers[_0x44d774['transfertargetuniqueid']][_0x4d43('0x15')]=utils['now']();transfers[_0x44d774[_0x4d43('0x48')]]['agentconnectAt']=utils[_0x4d43('0x1c')]();transfers[_0x44d774['transfertargetuniqueid']][_0x4d43('0x26')]=0x0;transfers[_0x44d774[_0x4d43('0x48')]][_0x4d43('0x46')]=0x2;}}}catch(_0x420e53){utils[_0x4d43('0x21')](util[_0x4d43('0x3')]('[%s][agents][attendedtransfer]',_0x44d774[_0x4d43('0x3d')]),_0x420e53);}};exports[_0x4d43('0x49')]=function(_0xd46d7c){try{utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x4a'),_0xd46d7c['uniqueid']),_0xd46d7c);if(agents[_0xd46d7c[_0x4d43('0x4')]]&&agents[_0xd46d7c['uniqueid']][_0x4d43('0x1e')]==='timeout'){if(_0xd46d7c['cause']==='21'){agents[_0xd46d7c['uniqueid']]['reason']=_0x4d43('0x4b');agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xa')]=_0x4d43('0x4b');}utils[_0x4d43('0x2')](util[_0x4d43('0x3')](_0x4d43('0x4c'),_0xd46d7c[_0x4d43('0x4')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x7')],agents[_0xd46d7c['uniqueid']][_0x4d43('0x1e')],agents[_0xd46d7c['uniqueid']]['lastevent']));writeDB(agents[_0xd46d7c[_0x4d43('0x4')]]);var _0x531acc=unanswered[_0x4d43('0x4d')](_0xd46d7c[_0x4d43('0x4')]);if(_0x531acc>-0x1){unanswered['splice'](_0x531acc,0x1);}}if(transfers[_0xd46d7c[_0x4d43('0x4')]]){transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xd')]=!![];transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x2f')]=utils[_0x4d43('0x1c')]();transfers[_0xd46d7c['uniqueid']]['talktime']=utils[_0x4d43('0x4e')](transfers[_0xd46d7c[_0x4d43('0x4')]]['agentcompleteAt'],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x28')]);transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')]=_0x4d43('0x4f');transfers[_0xd46d7c['uniqueid']][_0x4d43('0xa')]='complete';utils[_0x4d43('0x2')](util[_0x4d43('0x3')](_0x4d43('0x4c'),_0xd46d7c[_0x4d43('0x4')],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x7')],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xa')]));writeDB(transfers[_0xd46d7c[_0x4d43('0x4')]],!![]);}if(agents[_0xd46d7c['uniqueid']]&&agents[_0xd46d7c['uniqueid']]['agentconnectAt']){agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xd')]=!![];agents[_0xd46d7c[_0x4d43('0x4')]]['agentcompleteAt']=utils[_0x4d43('0x1c')]();agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x20')]=utils['diffTime'](agents[_0xd46d7c['uniqueid']][_0x4d43('0x2f')],agents[_0xd46d7c['uniqueid']][_0x4d43('0x28')]);agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')]=agents[_0xd46d7c['uniqueid']]['transfer']?_0x4d43('0x35'):_0x4d43('0x4f');agents[_0xd46d7c[_0x4d43('0x4')]]['lastevent']='complete';utils[_0x4d43('0x2')](util['format'](_0x4d43('0x4c'),_0xd46d7c[_0x4d43('0x4')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x7')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xa')]));writeDB(agents[_0xd46d7c[_0x4d43('0x4')]]);}}catch(_0x5258eb){utils[_0x4d43('0x21')](util[_0x4d43('0x3')](_0x4d43('0x4a'),_0xd46d7c[_0x4d43('0x4')]),_0x5258eb);}}; \ No newline at end of file +var _0xc2e2=['acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','uniqueid','agentcalledAt','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]','now','timeout','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','diffTime','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0xc2e2,0x140));var _0x2c2e=function(_0x594d1e,_0x12fa4e){_0x594d1e=_0x594d1e-0x0;var _0x5363e4=_0xc2e2[_0x594d1e];return _0x5363e4;};'use strict';var _=require(_0x2c2e('0x0'));var util=require(_0x2c2e('0x1'));var utils=require(_0x2c2e('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4e57ac,_0x12f116){utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')](_0x2c2e('0x5'),_0x4e57ac['uniqueid'],_0x4e57ac['channel'],_0x4e57ac[_0x2c2e('0x6')],_0x4e57ac[_0x2c2e('0x7')],_0x4e57ac[_0x2c2e('0x8')],_0x4e57ac[_0x2c2e('0x9')],_0x4e57ac[_0x2c2e('0xa')],_0x4e57ac['lastevent']));if(_0x4e57ac[_0x2c2e('0x6')]){utils[_0x2c2e('0xb')](_0x4e57ac['queue'])[_0x2c2e('0xc')](function(_0x34381f){if(_0x34381f){_0x4e57ac[_0x2c2e('0xd')]=_0x34381f['type'];_0x4e57ac[_0x2c2e('0xe')]=_0x4e57ac[_0x2c2e('0xf')]?_0x34381f[_0x2c2e('0x10')]:![];_0x4e57ac[_0x2c2e('0x11')]=_0x4e57ac['agentacw']?_0x34381f[_0x2c2e('0x12')]:0x0;}utils[_0x2c2e('0x13')](_0x2c2e('0x14'),_0x4e57ac);});}else{utils['request'](_0x2c2e('0x14'),_0x4e57ac);}if(_0x12f116){delete transfers[_0x4e57ac['uniqueid']];}else{delete agents[_0x4e57ac[_0x2c2e('0x15')]];}}exports['agentcalled']=function(_0x592354){try{utils[_0x2c2e('0x16')](util['format']('[%s][agents][agentcalled]',_0x592354[_0x2c2e('0x17')]),_0x592354);agents[_0x592354[_0x2c2e('0x15')]]=_0x592354;agents[_0x592354[_0x2c2e('0x15')]][_0x2c2e('0x18')]=utils['now']();agents[_0x592354[_0x2c2e('0x15')]][_0x2c2e('0x19')]='called';agents[_0x592354['destuniqueid']][_0x2c2e('0xa')]=null;agents[_0x592354[_0x2c2e('0x15')]][_0x2c2e('0x1a')]=null;utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x1b'),_0x592354[_0x2c2e('0x17')],agents[_0x592354['destuniqueid']][_0x2c2e('0x7')],_0x592354[_0x2c2e('0x15')]));}catch(_0x9189da){utils[_0x2c2e('0x1c')](util['format'](_0x2c2e('0x1d'),_0x592354[_0x2c2e('0x17')]),_0x9189da);}};exports[_0x2c2e('0x1e')]=function(_0x197e3a){try{if(!_['isNil'](agents[_0x197e3a['destuniqueid']])){utils['debug'](util['format'](_0x2c2e('0x1f'),_0x197e3a[_0x2c2e('0x17')]),_0x197e3a);utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x197e3a[_0x2c2e('0x17')],agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x7')],_0x197e3a[_0x2c2e('0x15')]));agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x1e')]=!![];agents[_0x197e3a[_0x2c2e('0x15')]]['agentringnoanswerAt']=utils[_0x2c2e('0x20')]();agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x19')]='timeout';agents[_0x197e3a[_0x2c2e('0x15')]]['reason']=_0x2c2e('0x21');agents[_0x197e3a['destuniqueid']][_0x2c2e('0x22')]=_0x197e3a[_0x2c2e('0x23')]?parseInt(_0x197e3a[_0x2c2e('0x23')])/0x3e8:0x0;agents[_0x197e3a[_0x2c2e('0x15')]][_0x2c2e('0x24')]=0x0;unanswered[_0x2c2e('0x25')](_0x197e3a['destuniqueid']);}}catch(_0x23b008){utils['error'](util[_0x2c2e('0x4')](_0x2c2e('0x1f'),_0x197e3a[_0x2c2e('0x17')]),_0x23b008);}};exports['queuecallerabandon']=function(_0x555c7f){try{_[_0x2c2e('0x26')](agents,function(_0x50b82e,_0x3fea28){if(_0x50b82e[_0x2c2e('0x17')]==_0x555c7f[_0x2c2e('0x17')]&&!_['includes'](unanswered,_0x50b82e[_0x2c2e('0x15')])){utils['debug'](util[_0x2c2e('0x4')](_0x2c2e('0x27'),_0x555c7f['uniqueid']),_0x555c7f);utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x28'),_0x555c7f[_0x2c2e('0x17')],_0x50b82e[_0x2c2e('0x7')],_0x50b82e['destuniqueid']));_0x50b82e['agentringnoanswer']=!![];_0x50b82e[_0x2c2e('0x29')]=utils[_0x2c2e('0x20')]();_0x50b82e['lastevent']=_0x2c2e('0x2a');_0x50b82e[_0x2c2e('0x2b')]='abandoned';_0x50b82e[_0x2c2e('0x22')]=_0x555c7f[_0x2c2e('0x22')];_0x50b82e[_0x2c2e('0x24')]=0x0;writeDB(_0x50b82e);}});}catch(_0x4cc1ab){utils[_0x2c2e('0x1c')](util['format']('[%s][agents][queuecallerabandon]',_0x555c7f[_0x2c2e('0x17')]),_0x4cc1ab);}};exports['agentconnect']=function(_0x587f45){try{if(agents[_0x587f45[_0x2c2e('0x15')]]){utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')]('[%s][agents][agentconnect]',_0x587f45['uniqueid']),_0x587f45);utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x587f45[_0x2c2e('0x17')],agents[_0x587f45['destuniqueid']][_0x2c2e('0x7')],_0x587f45['destuniqueid']));agents[_0x587f45[_0x2c2e('0x15')]][_0x2c2e('0x2c')]=utils[_0x2c2e('0x20')]();agents[_0x587f45['destuniqueid']][_0x2c2e('0xa')]=_0x587f45[_0x2c2e('0xa')];agents[_0x587f45['destuniqueid']][_0x2c2e('0x1a')]=_0x587f45[_0x2c2e('0x1a')];agents[_0x587f45[_0x2c2e('0x15')]][_0x2c2e('0x22')]=_0x587f45[_0x2c2e('0x23')];agents[_0x587f45[_0x2c2e('0x15')]][_0x2c2e('0x19')]=_0x2c2e('0x2d');_[_0x2c2e('0x26')](agents,function(_0x5bab69,_0x3949ac){if(_0x5bab69[_0x2c2e('0x15')]!=_0x587f45[_0x2c2e('0x15')]&&_0x5bab69[_0x2c2e('0x17')]==_0x587f45[_0x2c2e('0x17')]){_0x5bab69[_0x2c2e('0x24')]=0x0;_0x5bab69['holdtime']=_0x587f45['ringtime'];_0x5bab69[_0x2c2e('0x1e')]=!![];_0x5bab69[_0x2c2e('0x29')]=utils['now']();_0x5bab69[_0x2c2e('0x19')]=_0x2c2e('0x2e');_0x5bab69[_0x2c2e('0x2b')]=_0x2c2e('0x2e');_0x5bab69[_0x2c2e('0x2f')]=_0x587f45[_0x2c2e('0x15')];_0x5bab69[_0x2c2e('0x30')]=_0x587f45[_0x2c2e('0x7')];writeDB(_0x5bab69);}});}}catch(_0x25c21e){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x31'),_0x587f45[_0x2c2e('0x17')]),_0x25c21e);}};exports['agentcomplete']=function(_0x5d46ed){try{if(!_['isNil'](agents[_0x5d46ed[_0x2c2e('0x15')]])){utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')](_0x2c2e('0x32'),_0x5d46ed[_0x2c2e('0x17')]),_0x5d46ed);utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x33'),_0x5d46ed[_0x2c2e('0x17')],agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x7')],_0x5d46ed['destuniqueid']));agents[_0x5d46ed['destuniqueid']]['agentcomplete']=!![];agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x34')]=utils[_0x2c2e('0x20')]();agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x24')]=utils['diffTime'](agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x34')],agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x2c')]);agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x2b')]=_0x5d46ed[_0x2c2e('0x2b')];agents[_0x5d46ed[_0x2c2e('0x15')]][_0x2c2e('0x19')]=_0x2c2e('0x35');writeDB(agents[_0x5d46ed['destuniqueid']]);}}catch(_0x5c8678){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x32'),_0x5d46ed[_0x2c2e('0x17')]),_0x5c8678);}};exports[_0x2c2e('0x36')]=function(_0xcc1c1a){try{if(!_[_0x2c2e('0x37')](agents[_0xcc1c1a[_0x2c2e('0x38')]])){utils['debug'](util[_0x2c2e('0x4')](_0x2c2e('0x39'),_0xcc1c1a[_0x2c2e('0x17')]),_0xcc1c1a);utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0xcc1c1a[_0x2c2e('0x17')],agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x7')],agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x17')]));agents[_0xcc1c1a['transfereruniqueid']][_0x2c2e('0x3a')]=!![];agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x3b')]='blind';agents[_0xcc1c1a[_0x2c2e('0x38')]]['transferexten']=_0xcc1c1a[_0x2c2e('0x3c')];agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x3d')]=agents[_0xcc1c1a[_0x2c2e('0x38')]][_0x2c2e('0x17')];}}catch(_0x3efe01){utils['error'](util[_0x2c2e('0x4')](_0x2c2e('0x39'),_0xcc1c1a[_0x2c2e('0x17')]),_0x3efe01);}};exports['attendedtransfer']=function(_0x4b7482){try{utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')](_0x2c2e('0x3e'),_0x4b7482[_0x2c2e('0x3f')]),_0x4b7482);if(_0x4b7482[_0x2c2e('0x3f')]==_0x4b7482[_0x2c2e('0x40')]){if(!_[_0x2c2e('0x37')](agents[_0x4b7482[_0x2c2e('0x41')]])){utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x42'),_0x4b7482['origtransfereruniqueid'],agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x7')]));agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x3a')]=!![];agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x3b')]=_0x2c2e('0x43');agents[_0x4b7482['secondtransfereruniqueid']][_0x2c2e('0x44')]=_0x4b7482[_0x2c2e('0x45')];agents[_0x4b7482['secondtransfereruniqueid']][_0x2c2e('0x3d')]=_0x4b7482['origtransfereruniqueid'];}if(_0x4b7482[_0x2c2e('0x46')]&&agents[_0x4b7482[_0x2c2e('0x46')]]){agents[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x47')]=0x1;transfers[_0x4b7482[_0x2c2e('0x46')]]=_[_0x2c2e('0x48')](agents[_0x4b7482[_0x2c2e('0x46')]]);transfers[_0x4b7482[_0x2c2e('0x46')]]['calleridnum']=agents[_0x4b7482[_0x2c2e('0x41')]][_0x2c2e('0x9')];transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x49')]=agents[_0x4b7482[_0x2c2e('0x41')]]['calleridname'];transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x18')]=utils[_0x2c2e('0x20')]();transfers[_0x4b7482['transfereeuniqueid']]['agentconnectAt']=utils[_0x2c2e('0x20')]();transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x22')]=0x0;transfers[_0x4b7482[_0x2c2e('0x46')]][_0x2c2e('0x47')]=0x2;}}else if(_0x4b7482[_0x2c2e('0x41')]==_0x4b7482[_0x2c2e('0x4a')]){if(!_[_0x2c2e('0x37')](agents[_0x4b7482[_0x2c2e('0x3f')]])){utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')](_0x2c2e('0x42'),_0x4b7482['origtransfereruniqueid'],agents[_0x4b7482[_0x2c2e('0x3f')]]['membername']));agents[_0x4b7482[_0x2c2e('0x3f')]]['transfer']=!![];agents[_0x4b7482[_0x2c2e('0x3f')]]['transfertype']='ATTENDED';agents[_0x4b7482[_0x2c2e('0x3f')]][_0x2c2e('0x44')]=_0x4b7482[_0x2c2e('0x4b')];agents[_0x4b7482[_0x2c2e('0x3f')]][_0x2c2e('0x3d')]=_0x4b7482[_0x2c2e('0x41')];}if(_0x4b7482[_0x2c2e('0x4c')]&&agents[_0x4b7482['transfertargetuniqueid']]){agents[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x47')]=0x1;transfers[_0x4b7482[_0x2c2e('0x4c')]]=_[_0x2c2e('0x48')](agents[_0x4b7482[_0x2c2e('0x4c')]]);transfers[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x9')]=agents[_0x4b7482['origtransfereruniqueid']][_0x2c2e('0x9')];transfers[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x49')]=agents[_0x4b7482[_0x2c2e('0x3f')]][_0x2c2e('0x49')];transfers[_0x4b7482[_0x2c2e('0x4c')]][_0x2c2e('0x18')]=utils[_0x2c2e('0x20')]();transfers[_0x4b7482[_0x2c2e('0x4c')]]['agentconnectAt']=utils[_0x2c2e('0x20')]();transfers[_0x4b7482['transfertargetuniqueid']][_0x2c2e('0x22')]=0x0;transfers[_0x4b7482[_0x2c2e('0x4c')]][_0x2c2e('0x47')]=0x2;}}}catch(_0x48dfeb){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x3e'),_0x4b7482[_0x2c2e('0x3f')]),_0x48dfeb);}};exports[_0x2c2e('0x4d')]=function(_0x3b22ce){try{utils[_0x2c2e('0x16')](util[_0x2c2e('0x4')](_0x2c2e('0x4e'),_0x3b22ce[_0x2c2e('0x17')]),_0x3b22ce);if(agents[_0x3b22ce[_0x2c2e('0x17')]]&&agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')]==='timeout'){if(_0x3b22ce['cause']==='21'){agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')]=_0x2c2e('0x4f');agents[_0x3b22ce['uniqueid']][_0x2c2e('0x19')]='rejected';}utils[_0x2c2e('0x3')](util['format'](_0x2c2e('0x50'),_0x3b22ce[_0x2c2e('0x17')],agents[_0x3b22ce[_0x2c2e('0x17')]]['membername'],agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')],agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x19')]));writeDB(agents[_0x3b22ce[_0x2c2e('0x17')]]);var _0x12d876=unanswered[_0x2c2e('0x51')](_0x3b22ce['uniqueid']);if(_0x12d876>-0x1){unanswered['splice'](_0x12d876,0x1);}}if(transfers[_0x3b22ce['uniqueid']]){transfers[_0x3b22ce[_0x2c2e('0x17')]]['agentcomplete']=!![];transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')]=utils[_0x2c2e('0x20')]();transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x24')]=utils['diffTime'](transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')],transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2c')]);transfers[_0x3b22ce['uniqueid']][_0x2c2e('0x2b')]=_0x2c2e('0x52');transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x19')]='complete';utils['info'](util[_0x2c2e('0x4')](_0x2c2e('0x50'),_0x3b22ce[_0x2c2e('0x17')],transfers[_0x3b22ce['uniqueid']][_0x2c2e('0x7')],transfers[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x2b')],transfers[_0x3b22ce['uniqueid']][_0x2c2e('0x19')]));writeDB(transfers[_0x3b22ce[_0x2c2e('0x17')]],!![]);}if(agents[_0x3b22ce[_0x2c2e('0x17')]]&&agents[_0x3b22ce[_0x2c2e('0x17')]]['agentconnectAt']){agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0xf')]=!![];agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')]=utils['now']();agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x24')]=utils[_0x2c2e('0x53')](agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x34')],agents[_0x3b22ce[_0x2c2e('0x17')]]['agentconnectAt']);agents[_0x3b22ce['uniqueid']][_0x2c2e('0x2b')]=agents[_0x3b22ce['uniqueid']][_0x2c2e('0x3a')]?_0x2c2e('0x3a'):_0x2c2e('0x52');agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x19')]=_0x2c2e('0x35');utils[_0x2c2e('0x3')](util[_0x2c2e('0x4')](_0x2c2e('0x50'),_0x3b22ce[_0x2c2e('0x17')],agents[_0x3b22ce[_0x2c2e('0x17')]][_0x2c2e('0x7')],agents[_0x3b22ce['uniqueid']]['reason'],agents[_0x3b22ce[_0x2c2e('0x17')]]['lastevent']));writeDB(agents[_0x3b22ce[_0x2c2e('0x17')]]);}}catch(_0x1713bd){utils[_0x2c2e('0x1c')](util[_0x2c2e('0x4')](_0x2c2e('0x4e'),_0x3b22ce[_0x2c2e('0x17')]),_0x1713bd);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ac884e8..224d753 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 _0x067a=['newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','error','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s'];(function(_0x1898b4,_0x7c9b14){var _0x3c528a=function(_0x597804){while(--_0x597804){_0x1898b4['push'](_0x1898b4['shift']());}};_0x3c528a(++_0x7c9b14);}(_0x067a,0x79));var _0xa067=function(_0x105849,_0x5c22b0){_0x105849=_0x105849-0x0;var _0x59024f=_0x067a[_0x105849];return _0x59024f;};'use strict';var _=require(_0xa067('0x0'));var util=require(_0xa067('0x1'));var utils=require(_0xa067('0x2'));var dispositions=[_0xa067('0x3'),_0xa067('0x4'),'FAILED',_0xa067('0x3'),_0xa067('0x3'),_0xa067('0x3'),_0xa067('0x5'),_0xa067('0x6'),'FAILED',_0xa067('0x4'),_0xa067('0x4')];var channels={};function writeDB(_0x3f1dd){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x9'),_0x3f1dd[_0xa067('0xa')],_0x3f1dd[_0xa067('0xb')],_0x3f1dd[_0xa067('0xc')],_0x3f1dd[_0xa067('0xd')],_0x3f1dd['interface'],_0x3f1dd[_0xa067('0xe')],_0x3f1dd[_0xa067('0xf')],_0x3f1dd[_0xa067('0x10')]));if(_0x3f1dd[_0xa067('0x11')]){utils[_0xa067('0x12')](_0x3f1dd[_0xa067('0x11')])[_0xa067('0x13')](function(_0x59add3){if(_0x59add3){_0x3f1dd[_0xa067('0x14')]=_0x59add3['id'];}utils['request']('CreateVoiceCallReport',_0x3f1dd);});}else{utils[_0xa067('0x15')]('CreateVoiceCallReport',_0x3f1dd);}if(channels[_0x3f1dd[_0xa067('0xa')]]){delete channels[_0x3f1dd['uniqueid']];}}exports[_0xa067('0x16')]=function(_0x21b2fc){try{utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x18'),_0x21b2fc[_0xa067('0xa')]),_0x21b2fc);if(_0x21b2fc[_0xa067('0xa')]==_0x21b2fc['linkedid']&&_0x21b2fc['channel']!=_0xa067('0x19')){utils[_0xa067('0x7')](util['format'](_0xa067('0x1a'),_0x21b2fc[_0xa067('0xa')],_0x21b2fc[_0xa067('0x1b')],_0x21b2fc[_0xa067('0x1c')]));channels[_0x21b2fc[_0xa067('0xa')]]={'uniqueid':_0x21b2fc[_0xa067('0xa')],'accountcode':_0x21b2fc[_0xa067('0x11')],'source':_0x21b2fc[_0xa067('0xe')],'destination':_0x21b2fc['exten'],'destinationcontext':_0x21b2fc[_0xa067('0x1b')],'channel':_0x21b2fc['channel'],'starttime':utils[_0xa067('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa067('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x5868cd){utils['error'](util[_0xa067('0x8')](_0xa067('0x18'),_0x21b2fc[_0xa067('0xa')]),_0x5868cd);}};exports['newstate']=function(_0x570868){try{utils['debug'](util['format'](_0xa067('0x1e'),_0x570868['uniqueid']),_0x570868);if(!_[_0xa067('0x1f')](channels[_0x570868['uniqueid']])&&_0x570868[_0xa067('0x20')]==0x6){utils['info'](util[_0xa067('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x570868[_0xa067('0xa')],_0x570868[_0xa067('0x1b')],_0x570868[_0xa067('0xb')]));if(_['isNil'](channels[_0x570868['uniqueid']][_0xa067('0x21')])){channels[_0x570868[_0xa067('0xa')]][_0xa067('0x21')]=utils[_0xa067('0x1d')]();}}else if(!_[_0xa067('0x1f')](channels[_0x570868[_0xa067('0x22')]])&&_0x570868['channelstate']==0x6&&_0x570868[_0xa067('0x1b')]!=_0xa067('0x23')){utils['info'](util[_0xa067('0x8')](_0xa067('0x24'),_0x570868[_0xa067('0xa')],_0x570868[_0xa067('0x22')],_0x570868['context'],_0x570868[_0xa067('0xb')]));channels[_0x570868['linkedid']][_0xa067('0x11')]=_0x570868[_0xa067('0x11')];channels[_0x570868[_0xa067('0x22')]][_0xa067('0x25')]=_0x570868[_0xa067('0xb')];if(_['isNil'](channels[_0x570868[_0xa067('0x22')]][_0xa067('0x26')])){channels[_0x570868['linkedid']][_0xa067('0x26')]=utils[_0xa067('0x1d')]();}channels[_0x570868[_0xa067('0x22')]][_0xa067('0x27')]=dispositions[_[_0xa067('0x28')](_0x570868[_0xa067('0x20')])]||_0xa067('0x5');}}catch(_0x53d90c){utils['error'](util['format'](_0xa067('0x1e'),_0x570868[_0xa067('0xa')]),_0x53d90c);}};exports[_0xa067('0x29')]=function(_0x52a19e){try{if(!_[_0xa067('0x1f')](channels[_0x52a19e[_0xa067('0xa')]])){utils[_0xa067('0x17')](util[_0xa067('0x8')]('[%s][calls][hangup]',_0x52a19e[_0xa067('0xa')]),_0x52a19e);if(_['isNil'](channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2a')])){channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2a')]=_0x52a19e[_0xa067('0x2b')]+'\x20<'+_0x52a19e[_0xa067('0xe')]+'>';}utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x2c'),_0x52a19e['uniqueid'],channels[_0x52a19e['uniqueid']]['callerid'],_0x52a19e[_0xa067('0x2d')]));channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2e')]=utils[_0xa067('0x1d')]();channels[_0x52a19e['uniqueid']]['duration']=utils['diffTime'](channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2e')],channels[_0x52a19e['uniqueid']][_0xa067('0x2f')]);channels[_0x52a19e['uniqueid']][_0xa067('0x30')]=channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x26')]?utils['diffTime'](channels[_0x52a19e[_0xa067('0xa')]]['endtime'],channels[_0x52a19e['uniqueid']]['answertime']):0x0;writeDB(channels[_0x52a19e['uniqueid']]);}}catch(_0x2fd18b){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x32'),_0x52a19e[_0xa067('0xa')]),_0x2fd18b);}};exports['attendedtransfer']=function(_0x958927){try{if(!_[_0xa067('0x1f')](channels[_0x958927[_0xa067('0x33')]])){utils['debug'](util[_0xa067('0x8')](_0xa067('0x34'),_0x958927[_0xa067('0x35')]),_0x958927);if(channels[_0x958927[_0xa067('0x33')]]['channel']==_0x958927[_0xa067('0x36')]){utils[_0xa067('0x7')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x958927['origtransfereruniqueid'],_0x958927[_0xa067('0x33')],_0x958927[_0xa067('0x37')]));channels[_0x958927[_0xa067('0x33')]]['destinationchannel']=_0x958927['secondtransfererchannel'];channels[_0x958927[_0xa067('0x33')]][_0xa067('0x38')]=_0xa067('0x39');}else if(channels[_0x958927[_0xa067('0x33')]][_0xa067('0xb')]=_0x958927['transfertargetchannel']){utils['info'](util[_0xa067('0x8')](_0xa067('0x3a'),_0x958927['origtransfereruniqueid'],_0x958927[_0xa067('0x33')],_0x958927[_0xa067('0x3b')]));channels[_0x958927['localtwolinkedid']]['destinationchannel']=_0x958927['origtransfererchannel'];channels[_0x958927['localtwolinkedid']][_0xa067('0x38')]=_0xa067('0x39');}}}catch(_0x1c676a){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x34'),_0x958927[_0xa067('0x35')]),_0x1c676a);}};exports[_0xa067('0x3c')]=function(_0x346753){try{if(!_[_0xa067('0x1f')](channels[_0x346753[_0xa067('0xa')]])){utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x3d'),_0x346753[_0xa067('0xa')]),_0x346753);channels[_0x346753[_0xa067('0xa')]][_0xa067('0x3e')]=utils[_0xa067('0x1d')]();utils['info'](util[_0xa067('0x8')](_0xa067('0x3f'),_0x346753['uniqueid'],channels[_0x346753[_0xa067('0xa')]][_0xa067('0x3e')]));}}catch(_0x4970fe){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x3d'),_0x346753[_0xa067('0xa')]),_0x4970fe);}};exports[_0xa067('0x40')]=function(_0x3f07f6){try{if(!_[_0xa067('0x1f')](channels[_0x3f07f6[_0xa067('0xa')]])){utils[_0xa067('0x17')](util['format'](_0xa067('0x41'),_0x3f07f6['uniqueid']),_0x3f07f6);if(!_[_0xa067('0x1f')](channels[_0x3f07f6[_0xa067('0xa')]][_0xa067('0x3e')])){channels[_0x3f07f6[_0xa067('0xa')]][_0xa067('0x42')]+=utils[_0xa067('0x43')](utils['now'](),channels[_0x3f07f6['uniqueid']][_0xa067('0x3e')]);utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x44'),_0x3f07f6[_0xa067('0xa')],channels[_0x3f07f6[_0xa067('0xa')]]['mohtime']));delete channels[_0x3f07f6[_0xa067('0xa')]][_0xa067('0x3e')];}}}catch(_0x2c6f8a){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x41'),_0x3f07f6[_0xa067('0xa')]),_0x2c6f8a);}};exports['varset']=function(_0x5afa6e){try{if(!_[_0xa067('0x1f')](channels[_0x5afa6e[_0xa067('0xa')]])){utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x45'),_0x5afa6e['uniqueid']),_0x5afa6e);if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x47')])){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x48'),_0x5afa6e['uniqueid'],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x4a')]=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')]['xmd-phone'])){utils[_0xa067('0x7')](util['format'](_0xa067('0x4b'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e['value']));channels[_0x5afa6e[_0xa067('0xa')]]['destination']=_0x5afa6e[_0xa067('0x49')];channels[_0x5afa6e[_0xa067('0xa')]]['callerid']='\x22'+_0x5afa6e[_0xa067('0x49')]+_0xa067('0x4c')+_0x5afa6e[_0xa067('0x49')]+'>';}if(!_[_0xa067('0x1f')](_0x5afa6e['variable']['xmd-callerid-preview'])||!_['isNil'](_0x5afa6e[_0xa067('0x46')][_0xa067('0x4d')])){utils['info'](util[_0xa067('0x8')](_0xa067('0x4e'),_0x5afa6e[_0xa067('0xa')],!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x4f')])?_0xa067('0x4f'):_0xa067('0x4d'),_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x2a')]=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x50')])||!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')]['xmcs-queue'])){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x4e'),_0x5afa6e[_0xa067('0xa')],!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x50')])?_0xa067('0x50'):_0xa067('0x51'),_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x52')]=_0xa067('0x53');channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x54')]=_0x5afa6e[_0xa067('0x49')];channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0xc')]=!![];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')]['xmd-contactid'])){utils['info'](util['format'](_0xa067('0x55'),_0x5afa6e['uniqueid'],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e['uniqueid']]['ContactId']=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e['variable'][_0xa067('0x56')])){utils[_0xa067('0x7')](util['format'](_0xa067('0x57'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]]['type']=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x58')])){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x59'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e['uniqueid']][_0xa067('0x5a')]=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x5b')])){utils[_0xa067('0x7')](util['format'](_0xa067('0x5c'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x5b')]=_0x5afa6e[_0xa067('0x49')];}}}catch(_0x53224f){utils['error'](util[_0xa067('0x8')](_0xa067('0x45'),_0x5afa6e[_0xa067('0xa')]),_0x53224f);}};exports[_0xa067('0x5d')]=function(_0x4e6285){try{if(!_[_0xa067('0x1f')](channels[_0x4e6285['uniqueid']])){utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x5e'),_0x4e6285[_0xa067('0xa')]),_0x4e6285);utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x5f'),_0x4e6285[_0xa067('0xa')],_0x4e6285[_0xa067('0x60')],_0x4e6285[_0xa067('0x61')]));if(_0x4e6285[_0xa067('0x60')][_0xa067('0x62')]()==_0xa067('0x63')&&_['startsWith'](_0x4e6285[_0xa067('0x61')][_0xa067('0x62')](),_0xa067('0x64'))){var _0x10d0d6=_0x4e6285[_0xa067('0x61')][_0xa067('0x65')]('=');var _0x337235=_0x10d0d6[0x0][_0xa067('0x66')](_0x10d0d6[0x0]['lastIndexOf']('(')+0x1,_0x10d0d6[0x0][_0xa067('0x67')](')'));var _0x4bc4c7=_0x10d0d6[0x1];channels[_0x4e6285[_0xa067('0xa')]][_0x337235]=_0x4bc4c7;}if(!_[_0xa067('0x68')]([_0xa067('0x29'),_0xa067('0x69'),'execif',_0xa067('0x63'),_0xa067('0x6a')],_0x4e6285['application'][_0xa067('0x62')]())){channels[_0x4e6285[_0xa067('0xa')]][_0xa067('0x52')]=_0x4e6285[_0xa067('0x60')];channels[_0x4e6285[_0xa067('0xa')]][_0xa067('0x54')]=_0x4e6285[_0xa067('0x61')];}}}catch(_0x16bcc2){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x5e'),_0x4e6285[_0xa067('0xa')]),_0x16bcc2);}}; \ No newline at end of file +var _0xf00b=['calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','[%s][calls][newchannel]','linkedid','context','exten','now','DOCUMENTATION','error','newstate','debug','format','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf00b,0x133));var _0xbf00=function(_0x18c22d,_0x315d7e){_0x18c22d=_0x18c22d-0x0;var _0x3bbb6b=_0xf00b[_0x18c22d];return _0x3bbb6b;};'use strict';var _=require(_0xbf00('0x0'));var util=require('util');var utils=require(_0xbf00('0x1'));var dispositions=['NO\x20ANSWER',_0xbf00('0x2'),_0xbf00('0x2'),_0xbf00('0x3'),_0xbf00('0x3'),_0xbf00('0x3'),_0xbf00('0x4'),_0xbf00('0x5'),_0xbf00('0x2'),_0xbf00('0x2'),_0xbf00('0x2')];var channels={};function writeDB(_0x1d7a0a){utils[_0xbf00('0x6')](util['format'](_0xbf00('0x7'),_0x1d7a0a['uniqueid'],_0x1d7a0a[_0xbf00('0x8')],_0x1d7a0a['queue'],_0x1d7a0a[_0xbf00('0x9')],_0x1d7a0a[_0xbf00('0xa')],_0x1d7a0a[_0xbf00('0xb')],_0x1d7a0a[_0xbf00('0xc')],_0x1d7a0a[_0xbf00('0xd')]));if(_0x1d7a0a[_0xbf00('0xe')]){utils[_0xbf00('0xf')](_0x1d7a0a[_0xbf00('0xe')])[_0xbf00('0x10')](function(_0x4db1b0){if(_0x4db1b0){_0x1d7a0a[_0xbf00('0x11')]=_0x4db1b0['id'];}utils[_0xbf00('0x12')](_0xbf00('0x13'),_0x1d7a0a);});}else{utils[_0xbf00('0x12')](_0xbf00('0x13'),_0x1d7a0a);}if(channels[_0x1d7a0a['uniqueid']]){delete channels[_0x1d7a0a[_0xbf00('0x14')]];}}exports[_0xbf00('0x15')]=function(_0x147ac0){try{utils['debug'](util['format'](_0xbf00('0x16'),_0x147ac0[_0xbf00('0x14')]),_0x147ac0);if(_0x147ac0[_0xbf00('0x14')]==_0x147ac0[_0xbf00('0x17')]&&_0x147ac0[_0xbf00('0x8')]!='OutgoingSpoolFailed'){utils[_0xbf00('0x6')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x147ac0[_0xbf00('0x14')],_0x147ac0[_0xbf00('0x18')],_0x147ac0[_0xbf00('0x19')]));channels[_0x147ac0[_0xbf00('0x14')]]={'uniqueid':_0x147ac0['uniqueid'],'accountcode':_0x147ac0['accountcode'],'source':_0x147ac0[_0xbf00('0xb')],'destination':_0x147ac0['exten'],'destinationcontext':_0x147ac0['context'],'channel':_0x147ac0[_0xbf00('0x8')],'starttime':utils[_0xbf00('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xbf00('0x3'),'amaflags':_0xbf00('0x1b')};}}catch(_0x2bddc9){utils[_0xbf00('0x1c')](util['format']('[%s][calls][newchannel]',_0x147ac0[_0xbf00('0x14')]),_0x2bddc9);}};exports[_0xbf00('0x1d')]=function(_0x1b2828){try{utils[_0xbf00('0x1e')](util[_0xbf00('0x1f')](_0xbf00('0x20'),_0x1b2828[_0xbf00('0x14')]),_0x1b2828);if(!_['isNil'](channels[_0x1b2828[_0xbf00('0x14')]])&&_0x1b2828[_0xbf00('0x21')]==0x6){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x22'),_0x1b2828['uniqueid'],_0x1b2828[_0xbf00('0x18')],_0x1b2828['channel']));if(_[_0xbf00('0x23')](channels[_0x1b2828[_0xbf00('0x14')]][_0xbf00('0x24')])){channels[_0x1b2828[_0xbf00('0x14')]][_0xbf00('0x24')]=utils[_0xbf00('0x1a')]();}}else if(!_[_0xbf00('0x23')](channels[_0x1b2828[_0xbf00('0x17')]])&&_0x1b2828['channelstate']==0x6&&_0x1b2828[_0xbf00('0x18')]!=_0xbf00('0x25')){utils[_0xbf00('0x6')](util['format'](_0xbf00('0x26'),_0x1b2828['uniqueid'],_0x1b2828['linkedid'],_0x1b2828[_0xbf00('0x18')],_0x1b2828[_0xbf00('0x8')]));channels[_0x1b2828[_0xbf00('0x17')]][_0xbf00('0xe')]=_0x1b2828['accountcode'];channels[_0x1b2828['linkedid']][_0xbf00('0x27')]=_0x1b2828[_0xbf00('0x8')];if(_[_0xbf00('0x23')](channels[_0x1b2828[_0xbf00('0x17')]][_0xbf00('0x28')])){channels[_0x1b2828['linkedid']][_0xbf00('0x28')]=utils['now']();}channels[_0x1b2828[_0xbf00('0x17')]][_0xbf00('0x29')]=dispositions[_[_0xbf00('0x2a')](_0x1b2828[_0xbf00('0x21')])]||'ANSWERED';}}catch(_0x4273f5){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x20'),_0x1b2828[_0xbf00('0x14')]),_0x4273f5);}};exports[_0xbf00('0x2b')]=function(_0x9fa870){try{if(!_[_0xbf00('0x23')](channels[_0x9fa870[_0xbf00('0x14')]])){utils[_0xbf00('0x1e')](util['format']('[%s][calls][hangup]',_0x9fa870[_0xbf00('0x14')]),_0x9fa870);if(_[_0xbf00('0x23')](channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2c')])){channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2c')]=_0x9fa870[_0xbf00('0x2d')]+'\x20<'+_0x9fa870[_0xbf00('0xb')]+'>';}utils[_0xbf00('0x6')](util[_0xbf00('0x1f')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x9fa870['uniqueid'],channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2c')],_0x9fa870[_0xbf00('0x2e')]));channels[_0x9fa870['uniqueid']][_0xbf00('0x2f')]=utils[_0xbf00('0x1a')]();channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x30')]=utils[_0xbf00('0x31')](channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x2f')],channels[_0x9fa870[_0xbf00('0x14')]]['starttime']);channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x32')]=channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x28')]?utils[_0xbf00('0x31')](channels[_0x9fa870[_0xbf00('0x14')]]['endtime'],channels[_0x9fa870[_0xbf00('0x14')]][_0xbf00('0x28')]):0x0;writeDB(channels[_0x9fa870[_0xbf00('0x14')]]);}}catch(_0x46965e){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x33'),_0x9fa870['uniqueid']),_0x46965e);}};exports[_0xbf00('0x34')]=function(_0x115bbf){try{if(!_['isNil'](channels[_0x115bbf[_0xbf00('0x35')]])){utils['debug'](util[_0xbf00('0x1f')](_0xbf00('0x36'),_0x115bbf[_0xbf00('0x37')]),_0x115bbf);if(channels[_0x115bbf[_0xbf00('0x35')]]['channel']==_0x115bbf['transfereechannel']){utils['info'](util['format'](_0xbf00('0x38'),_0x115bbf[_0xbf00('0x37')],_0x115bbf[_0xbf00('0x35')],_0x115bbf[_0xbf00('0x39')]));channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x27')]=_0x115bbf[_0xbf00('0x39')];channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x3a')]=_0xbf00('0x3b');}else if(channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x8')]=_0x115bbf[_0xbf00('0x3c')]){utils['info'](util[_0xbf00('0x1f')](_0xbf00('0x38'),_0x115bbf[_0xbf00('0x37')],_0x115bbf[_0xbf00('0x35')],_0x115bbf[_0xbf00('0x3d')]));channels[_0x115bbf[_0xbf00('0x35')]]['destinationchannel']=_0x115bbf['origtransfererchannel'];channels[_0x115bbf[_0xbf00('0x35')]][_0xbf00('0x3a')]=_0xbf00('0x3b');}}}catch(_0xb8e6d4){utils[_0xbf00('0x1c')](util['format'](_0xbf00('0x36'),_0x115bbf['origtransfereruniqueid']),_0xb8e6d4);}};exports['musiconholdstart']=function(_0x5f1083){try{if(!_[_0xbf00('0x23')](channels[_0x5f1083[_0xbf00('0x14')]])){utils[_0xbf00('0x1e')](util[_0xbf00('0x1f')]('[%s][calls][musiconholdstart]',_0x5f1083[_0xbf00('0x14')]),_0x5f1083);channels[_0x5f1083['uniqueid']][_0xbf00('0x3e')]=utils[_0xbf00('0x1a')]();utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x3f'),_0x5f1083['uniqueid'],channels[_0x5f1083[_0xbf00('0x14')]][_0xbf00('0x3e')]));}}catch(_0x137a9b){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')]('[%s][calls][musiconholdstart]',_0x5f1083[_0xbf00('0x14')]),_0x137a9b);}};exports[_0xbf00('0x40')]=function(_0x34080e){try{if(!_['isNil'](channels[_0x34080e[_0xbf00('0x14')]])){utils['debug'](util[_0xbf00('0x1f')]('[%s][calls][musiconholdstop]',_0x34080e['uniqueid']),_0x34080e);if(!_['isNil'](channels[_0x34080e[_0xbf00('0x14')]][_0xbf00('0x3e')])){channels[_0x34080e['uniqueid']]['mohtime']+=utils[_0xbf00('0x31')](utils[_0xbf00('0x1a')](),channels[_0x34080e['uniqueid']][_0xbf00('0x3e')]);utils['info'](util[_0xbf00('0x1f')](_0xbf00('0x41'),_0x34080e['uniqueid'],channels[_0x34080e[_0xbf00('0x14')]]['mohtime']));delete channels[_0x34080e[_0xbf00('0x14')]]['musiconholdstartAt'];}}}catch(_0x4fcc4a){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x42'),_0x34080e[_0xbf00('0x14')]),_0x4fcc4a);}};exports[_0xbf00('0x43')]=function(_0x5d0ce3){try{if(!_[_0xbf00('0x23')](channels[_0x5d0ce3[_0xbf00('0x14')]])){utils[_0xbf00('0x1e')](util[_0xbf00('0x1f')](_0xbf00('0x44'),_0x5d0ce3['uniqueid']),_0x5d0ce3);if(!_[_0xbf00('0x23')](_0x5d0ce3['variable']['xmd-originatecalleridnum'])){utils['info'](util[_0xbf00('0x1f')](_0xbf00('0x45'),_0x5d0ce3['uniqueid'],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x47')]=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x49')])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5d0ce3['uniqueid'],_0x5d0ce3['value']));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x4a')]=_0x5d0ce3[_0xbf00('0x46')];channels[_0x5d0ce3['uniqueid']][_0xbf00('0x2c')]='\x22'+_0x5d0ce3[_0xbf00('0x46')]+_0xbf00('0x4b')+_0x5d0ce3[_0xbf00('0x46')]+'>';}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x4c')])||!_['isNil'](_0x5d0ce3['variable'][_0xbf00('0x4d')])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x4e'),_0x5d0ce3[_0xbf00('0x14')],!_['isNil'](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x4c')])?_0xbf00('0x4c'):_0xbf00('0x4d'),_0x5d0ce3['value']));channels[_0x5d0ce3[_0xbf00('0x14')]]['callerid']=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')]['xmd-queue'])||!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')]['xmcs-queue'])){utils['info'](util['format'](_0xbf00('0x4e'),_0x5d0ce3['uniqueid'],!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x4f')])?_0xbf00('0x4f'):_0xbf00('0x50'),_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3['uniqueid']][_0xbf00('0x51')]=_0xbf00('0x52');channels[_0x5d0ce3['uniqueid']][_0xbf00('0x53')]=_0x5d0ce3['value'];channels[_0x5d0ce3['uniqueid']][_0xbf00('0x54')]=!![];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x55')])){utils[_0xbf00('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5d0ce3[_0xbf00('0x14')],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x56')]=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3['variable']['xmd-cdrtype'])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x57'),_0x5d0ce3[_0xbf00('0x14')],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]]['type']=_0x5d0ce3['value'];}if(!_['isNil'](_0x5d0ce3[_0xbf00('0x48')][_0xbf00('0x58')])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5d0ce3['uniqueid'],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x59')]=_0x5d0ce3[_0xbf00('0x46')];}if(!_[_0xbf00('0x23')](_0x5d0ce3[_0xbf00('0x48')]['sipcallid'])){utils[_0xbf00('0x6')](util[_0xbf00('0x1f')](_0xbf00('0x5a'),_0x5d0ce3[_0xbf00('0x14')],_0x5d0ce3[_0xbf00('0x46')]));channels[_0x5d0ce3[_0xbf00('0x14')]][_0xbf00('0x5b')]=_0x5d0ce3['value'];}}}catch(_0x594406){utils['error'](util[_0xbf00('0x1f')](_0xbf00('0x44'),_0x5d0ce3[_0xbf00('0x14')]),_0x594406);}};exports['newexten']=function(_0x1d0d4a){try{if(!_[_0xbf00('0x23')](channels[_0x1d0d4a[_0xbf00('0x14')]])){utils['debug'](util[_0xbf00('0x1f')]('[%s][calls][newexten]',_0x1d0d4a[_0xbf00('0x14')]),_0x1d0d4a);utils[_0xbf00('0x6')](util['format'](_0xbf00('0x5c'),_0x1d0d4a['uniqueid'],_0x1d0d4a[_0xbf00('0x5d')],_0x1d0d4a['appdata']));if(_0x1d0d4a[_0xbf00('0x5d')][_0xbf00('0x5e')]()==_0xbf00('0x5f')&&_[_0xbf00('0x60')](_0x1d0d4a['appdata'][_0xbf00('0x5e')](),_0xbf00('0x61'))){var _0x2dda7a=_0x1d0d4a[_0xbf00('0x62')]['split']('=');var _0x4ed323=_0x2dda7a[0x0][_0xbf00('0x63')](_0x2dda7a[0x0][_0xbf00('0x64')]('(')+0x1,_0x2dda7a[0x0]['lastIndexOf'](')'));var _0x15e2db=_0x2dda7a[0x1];channels[_0x1d0d4a['uniqueid']][_0x4ed323]=_0x15e2db;}if(!_[_0xbf00('0x65')]([_0xbf00('0x2b'),_0xbf00('0x66'),_0xbf00('0x67'),'set',_0xbf00('0x68')],_0x1d0d4a[_0xbf00('0x5d')][_0xbf00('0x5e')]())){channels[_0x1d0d4a[_0xbf00('0x14')]]['lastapplication']=_0x1d0d4a[_0xbf00('0x5d')];channels[_0x1d0d4a[_0xbf00('0x14')]][_0xbf00('0x53')]=_0x1d0d4a[_0xbf00('0x62')];}}}catch(_0x76c2f7){utils[_0xbf00('0x1c')](util[_0xbf00('0x1f')](_0xbf00('0x69'),_0x1d0d4a[_0xbf00('0x14')]),_0x76c2f7);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 60a9efb..ea9bc1f 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 _0xc9ab=['[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown'];(function(_0x49e209,_0x17e553){var _0x514496=function(_0x4f76dc){while(--_0x4f76dc){_0x49e209['push'](_0x49e209['shift']());}};_0x514496(++_0x17e553);}(_0xc9ab,0x17d));var _0xbc9a=function(_0x3f2cdb,_0x123c97){_0x3f2cdb=_0x3f2cdb-0x0;var _0xe804ee=_0xc9ab[_0x3f2cdb];return _0xe804ee;};'use strict';var utils=require('./utils');exports[_0xbc9a('0x0')]=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x2'));};exports[_0xbc9a('0x3')]=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x4'));};exports['fullybooted']=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x5'));};exports[_0xbc9a('0x6')]=function(_0x3903cb){utils[_0xbc9a('0x6')](_0xbc9a('0x7'),_0x3903cb);};exports[_0xbc9a('0x8')]=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x9'));};exports[_0xbc9a('0xa')]=function(_0x2dcf20){}; \ No newline at end of file +var _0x5938=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected'];(function(_0x1e6f6a,_0x206956){var _0xd3e41d=function(_0x9a8d14){while(--_0x9a8d14){_0x1e6f6a['push'](_0x1e6f6a['shift']());}};_0xd3e41d(++_0x206956);}(_0x5938,0x18d));var _0x8593=function(_0x3da148,_0x549dda){_0x3da148=_0x3da148-0x0;var _0x3c37cf=_0x5938[_0x3da148];return _0x3c37cf;};'use strict';var utils=require(_0x8593('0x0'));exports['connect']=function(){utils[_0x8593('0x1')](_0x8593('0x2'));};exports['shutdown']=function(){utils[_0x8593('0x1')]('[core]\x20shutdown');};exports[_0x8593('0x3')]=function(){utils[_0x8593('0x1')](_0x8593('0x4'));};exports[_0x8593('0x5')]=function(_0xa81945){utils['error'](_0x8593('0x6'),_0xa81945);};exports[_0x8593('0x7')]=function(){utils['info'](_0x8593('0x8'));};exports[_0x8593('0x9')]=function(_0x4c9772){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b2baf7f..b10ec47 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 _0x57d5=['answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','lodash','util','format','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','variable','outboundrouteid','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil'];(function(_0x1988fa,_0x2d7bc1){var _0x277568=function(_0x230149){while(--_0x230149){_0x1988fa['push'](_0x1988fa['shift']());}};_0x277568(++_0x2d7bc1);}(_0x57d5,0xa1));var _0x557d=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x57d5[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0x557d('0x0'));var util=require(_0x557d('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x5200ce){utils['info'](util[_0x557d('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x5200ce['uniqueid'],_0x5200ce['channel'],_0x5200ce[_0x557d('0x3')],_0x5200ce[_0x557d('0x4')],_0x5200ce[_0x557d('0x5')],_0x5200ce[_0x557d('0x6')]));utils['request'](_0x557d('0x7'),_0x5200ce);delete dials[_0x5200ce[_0x557d('0x8')]];}exports['newexten']=function(_0x560f6a){try{utils[_0x557d('0x9')](util[_0x557d('0x2')](_0x557d('0xa'),_0x560f6a[_0x557d('0x8')]),_0x560f6a);utils[_0x557d('0xb')](util[_0x557d('0x2')](_0x557d('0xc'),_0x560f6a[_0x557d('0x8')],_0x560f6a[_0x557d('0xd')],_0x560f6a[_0x557d('0xe')]));if(_0x560f6a[_0x557d('0xd')][_0x557d('0xf')]()==_0x557d('0x10')&&_[_0x557d('0x11')](_0x560f6a[_0x557d('0xe')]['toLowerCase'](),_0x557d('0x12'))){var _0x569ad0=_0x560f6a[_0x557d('0xe')][_0x557d('0x13')]('=');dials[_0x560f6a[_0x557d('0x8')]]={'routeId':_0x569ad0[0x1]};}}catch(_0x330bfb){utils['error'](util[_0x557d('0x2')](_0x557d('0xa'),_0x560f6a[_0x557d('0x8')]),_0x330bfb);}};exports[_0x557d('0x14')]=function(_0x369729){try{utils['debug'](util[_0x557d('0x2')](_0x557d('0x15'),_0x369729[_0x557d('0x8')]),_0x369729);if(!_['isNil'](_0x369729[_0x557d('0x16')][_0x557d('0x17')])){utils[_0x557d('0xb')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x369729[_0x557d('0x8')],_0x369729[_0x557d('0x18')]));dials[_0x369729[_0x557d('0x8')]]={'routeId':_0x369729[_0x557d('0x18')]};}}catch(_0x44b4e6){utils[_0x557d('0x19')](util['format'](_0x557d('0x15'),_0x369729[_0x557d('0x8')]),_0x44b4e6);}};exports[_0x557d('0x1a')]=function(_0x10960f){try{if(!_['isNil'](dials[_0x10960f[_0x557d('0x8')]])){utils[_0x557d('0x9')](util[_0x557d('0x2')](_0x557d('0x1b'),_0x10960f[_0x557d('0x8')]),_0x10960f);dials[_0x10960f[_0x557d('0x8')]]=_[_0x557d('0x1c')](dials[_0x10960f[_0x557d('0x8')]],_0x10960f);dials[_0x10960f[_0x557d('0x8')]][_0x557d('0x1d')]=utils['now']();dials[_0x10960f['uniqueid']][_0x557d('0x1e')]=_0x557d('0x1f');utils[_0x557d('0xb')](util[_0x557d('0x2')](_0x557d('0x20'),_0x10960f[_0x557d('0x8')],dials[_0x10960f[_0x557d('0x8')]][_0x557d('0x1d')]));}}catch(_0x310fb7){utils['error'](util['format'](_0x557d('0x1b'),_0x10960f[_0x557d('0x8')]),_0x310fb7);}};exports[_0x557d('0x21')]=function(_0x44c5ff){try{if(!_[_0x557d('0x22')](dials[_0x44c5ff[_0x557d('0x8')]])){utils[_0x557d('0x9')](util['format']('[%s][dials][dialend]',_0x44c5ff[_0x557d('0x8')]),_0x44c5ff);dials[_0x44c5ff[_0x557d('0x8')]][_0x557d('0x6')]=_0x44c5ff[_0x557d('0x6')];if(_0x44c5ff[_0x557d('0x6')]=='ANSWER'){dials[_0x44c5ff[_0x557d('0x8')]]=_[_0x557d('0x1c')](dials[_0x44c5ff[_0x557d('0x8')]],_0x44c5ff);dials[_0x44c5ff[_0x557d('0x8')]][_0x557d('0x23')]=utils[_0x557d('0x24')]();dials[_0x44c5ff['uniqueid']][_0x557d('0x1e')]=_0x557d('0x25');utils[_0x557d('0xb')](util['format'](_0x557d('0x26'),_0x44c5ff[_0x557d('0x8')],_0x44c5ff[_0x557d('0x6')],dials[_0x44c5ff[_0x557d('0x8')]][_0x557d('0x23')]));}else{utils[_0x557d('0xb')](util[_0x557d('0x2')](_0x557d('0x27'),_0x44c5ff[_0x557d('0x8')],_0x44c5ff[_0x557d('0x6')]));}}}catch(_0x49d63b){utils[_0x557d('0x19')](util['format'](_0x557d('0x28'),_0x44c5ff[_0x557d('0x8')]),_0x49d63b);}};exports[_0x557d('0x29')]=function(_0x4164d6){try{if(!_[_0x557d('0x22')](dials[_0x4164d6[_0x557d('0x8')]])){utils['debug'](util[_0x557d('0x2')]('[%s][dials][hangup]',_0x4164d6[_0x557d('0x8')]),_0x4164d6);utils['info'](util[_0x557d('0x2')](_0x557d('0x2a'),_0x4164d6[_0x557d('0x8')],_0x4164d6[_0x557d('0x4')],_0x4164d6[_0x557d('0x2b')],_0x4164d6['cause-txt']));dials[_0x4164d6[_0x557d('0x8')]]=_[_0x557d('0x1c')](dials[_0x4164d6[_0x557d('0x8')]],{'endtime':utils[_0x557d('0x24')](),'lastevent':_0x557d('0x2c')});dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x2d')]=utils[_0x557d('0x2e')](dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x2f')],dials[_0x4164d6[_0x557d('0x8')]]['starttime']);dials[_0x4164d6['uniqueid']][_0x557d('0x30')]=utils[_0x557d('0x2e')](dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x23')]||dials[_0x4164d6[_0x557d('0x8')]]['endtime'],dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x1d')]);dials[_0x4164d6[_0x557d('0x8')]]['billableseconds']=dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x23')]?utils['diffTime'](dials[_0x4164d6[_0x557d('0x8')]]['endtime'],dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x23')]):0x0;writeDB(dials[_0x4164d6['uniqueid']]);}}catch(_0x5753be){utils[_0x557d('0x19')](util['format']('[%s][dials][hangup]',_0x4164d6[_0x557d('0x8')]),_0x5753be);}}; \ No newline at end of file +var _0xe60a=['channel','calleridnum','connectedlinenum','dialstatus','request','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x3eeccc,_0x257200){var _0x73d5e5=function(_0x1d9503){while(--_0x1d9503){_0x3eeccc['push'](_0x3eeccc['shift']());}};_0x73d5e5(++_0x257200);}(_0xe60a,0x8e));var _0xae60=function(_0x5b734b,_0x4553b2){_0x5b734b=_0x5b734b-0x0;var _0x3f88f1=_0xe60a[_0x5b734b];return _0x3f88f1;};'use strict';var _=require('lodash');var util=require(_0xae60('0x0'));var utils=require(_0xae60('0x1'));var dials={};function writeDB(_0x4c6a7f){utils[_0xae60('0x2')](util[_0xae60('0x3')](_0xae60('0x4'),_0x4c6a7f['uniqueid'],_0x4c6a7f[_0xae60('0x5')],_0x4c6a7f['dialstring'],_0x4c6a7f[_0xae60('0x6')],_0x4c6a7f[_0xae60('0x7')],_0x4c6a7f[_0xae60('0x8')]));utils[_0xae60('0x9')]('CreateVoiceDialReport',_0x4c6a7f);delete dials[_0x4c6a7f[_0xae60('0xa')]];}exports['newexten']=function(_0x261ebb){try{utils['debug'](util[_0xae60('0x3')]('[%s][dials][newexten]',_0x261ebb['uniqueid']),_0x261ebb);utils[_0xae60('0x2')](util[_0xae60('0x3')](_0xae60('0xb'),_0x261ebb[_0xae60('0xa')],_0x261ebb[_0xae60('0xc')],_0x261ebb[_0xae60('0xd')]));if(_0x261ebb[_0xae60('0xc')][_0xae60('0xe')]()==_0xae60('0xf')&&_['startsWith'](_0x261ebb[_0xae60('0xd')][_0xae60('0xe')](),_0xae60('0x10'))){var _0x4ca4e7=_0x261ebb['appdata'][_0xae60('0x11')]('=');dials[_0x261ebb[_0xae60('0xa')]]={'routeId':_0x4ca4e7[0x1]};}}catch(_0x397a21){utils[_0xae60('0x12')](util[_0xae60('0x3')](_0xae60('0x13'),_0x261ebb[_0xae60('0xa')]),_0x397a21);}};exports[_0xae60('0x14')]=function(_0x151d50){try{utils[_0xae60('0x15')](util[_0xae60('0x3')](_0xae60('0x16'),_0x151d50['uniqueid']),_0x151d50);if(!_['isNil'](_0x151d50[_0xae60('0x17')][_0xae60('0x18')])){utils[_0xae60('0x2')](util['format'](_0xae60('0x19'),_0x151d50['uniqueid'],_0x151d50[_0xae60('0x1a')]));dials[_0x151d50[_0xae60('0xa')]]={'routeId':_0x151d50[_0xae60('0x1a')]};}}catch(_0x2389b1){utils[_0xae60('0x12')](util[_0xae60('0x3')]('[%s][dials][varset]',_0x151d50[_0xae60('0xa')]),_0x2389b1);}};exports['dialbegin']=function(_0x256d32){try{if(!_[_0xae60('0x1b')](dials[_0x256d32[_0xae60('0xa')]])){utils['debug'](util['format'](_0xae60('0x1c'),_0x256d32[_0xae60('0xa')]),_0x256d32);dials[_0x256d32['uniqueid']]=_[_0xae60('0x1d')](dials[_0x256d32[_0xae60('0xa')]],_0x256d32);dials[_0x256d32[_0xae60('0xa')]][_0xae60('0x1e')]=utils[_0xae60('0x1f')]();dials[_0x256d32[_0xae60('0xa')]][_0xae60('0x20')]='called';utils[_0xae60('0x2')](util[_0xae60('0x3')](_0xae60('0x21'),_0x256d32[_0xae60('0xa')],dials[_0x256d32[_0xae60('0xa')]][_0xae60('0x1e')]));}}catch(_0x40dd3d){utils[_0xae60('0x12')](util[_0xae60('0x3')](_0xae60('0x1c'),_0x256d32[_0xae60('0xa')]),_0x40dd3d);}};exports['dialend']=function(_0xbd99ca){try{if(!_[_0xae60('0x1b')](dials[_0xbd99ca[_0xae60('0xa')]])){utils[_0xae60('0x15')](util[_0xae60('0x3')](_0xae60('0x22'),_0xbd99ca[_0xae60('0xa')]),_0xbd99ca);dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x8')]=_0xbd99ca[_0xae60('0x8')];if(_0xbd99ca[_0xae60('0x8')]==_0xae60('0x23')){dials[_0xbd99ca[_0xae60('0xa')]]=_[_0xae60('0x1d')](dials[_0xbd99ca['uniqueid']],_0xbd99ca);dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x24')]=utils[_0xae60('0x1f')]();dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x20')]=_0xae60('0x25');utils[_0xae60('0x2')](util['format'](_0xae60('0x26'),_0xbd99ca[_0xae60('0xa')],_0xbd99ca[_0xae60('0x8')],dials[_0xbd99ca[_0xae60('0xa')]][_0xae60('0x24')]));}else{utils['info'](util[_0xae60('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0xbd99ca[_0xae60('0xa')],_0xbd99ca[_0xae60('0x8')]));}}}catch(_0x4c6113){utils[_0xae60('0x12')](util[_0xae60('0x3')](_0xae60('0x22'),_0xbd99ca[_0xae60('0xa')]),_0x4c6113);}};exports[_0xae60('0x27')]=function(_0x93ea46){try{if(!_[_0xae60('0x1b')](dials[_0x93ea46[_0xae60('0xa')]])){utils[_0xae60('0x15')](util['format'](_0xae60('0x28'),_0x93ea46[_0xae60('0xa')]),_0x93ea46);utils['info'](util[_0xae60('0x3')](_0xae60('0x29'),_0x93ea46[_0xae60('0xa')],_0x93ea46[_0xae60('0x6')],_0x93ea46[_0xae60('0x2a')],_0x93ea46[_0xae60('0x2b')]));dials[_0x93ea46[_0xae60('0xa')]]=_['assign'](dials[_0x93ea46['uniqueid']],{'endtime':utils[_0xae60('0x1f')](),'lastevent':_0xae60('0x2c')});dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x2d')]=utils[_0xae60('0x2e')](dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x2f')],dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x1e')]);dials[_0x93ea46[_0xae60('0xa')]]['holdtime']=utils['diffTime'](dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x24')]||dials[_0x93ea46['uniqueid']][_0xae60('0x2f')],dials[_0x93ea46[_0xae60('0xa')]]['starttime']);dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x30')]=dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x24')]?utils[_0xae60('0x2e')](dials[_0x93ea46[_0xae60('0xa')]]['endtime'],dials[_0x93ea46[_0xae60('0xa')]][_0xae60('0x24')]):0x0;writeDB(dials[_0x93ea46[_0xae60('0xa')]]);}}catch(_0x4c9e94){utils['error'](util[_0xae60('0x3')](_0xae60('0x28'),_0x93ea46[_0xae60('0xa')]),_0x4c9e94);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 01f5708..922667b 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 _0xa510=['[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0x2f6802,_0x154994){var _0x11cab0=function(_0x385a0c){while(--_0x385a0c){_0x2f6802['push'](_0x2f6802['shift']());}};_0x11cab0(++_0x154994);}(_0xa510,0x1ab));var _0x0a51=function(_0x3763a6,_0xf9796a){_0x3763a6=_0x3763a6-0x0;var _0x14384c=_0xa510[_0x3763a6];return _0x14384c;};var AsteriskManager=require(_0x0a51('0x0'));var config=require(_0x0a51('0x1'));var utils=require('./utils');var util=require(_0x0a51('0x2'));var ami=new AsteriskManager(config[_0x0a51('0x3')][_0x0a51('0x4')],config['asterisk']['ip'],config[_0x0a51('0x3')][_0x0a51('0x5')],config[_0x0a51('0x3')]['password'],!![]);ami[_0x0a51('0x6')]();if(config[_0x0a51('0x7')]&&config[_0x0a51('0x7')][_0x0a51('0x8')]){utils[_0x0a51('0x9')](_0x0a51('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x0a51('0xb'));var queues=require(_0x0a51('0xc'));var recordings=require(_0x0a51('0xd'));var members=require(_0x0a51('0xe'));var dials=require(_0x0a51('0xf'));var transfers=require(_0x0a51('0x10'));var core=require(_0x0a51('0x11'));ami['on'](_0x0a51('0x12'),core[_0x0a51('0x12')]);ami['on'](_0x0a51('0x13'),core[_0x0a51('0x13')]);ami['on'](_0x0a51('0x14'),core[_0x0a51('0x14')]);ami['on'](_0x0a51('0x15'),core['error']);ami['on'](_0x0a51('0x16'),core[_0x0a51('0x16')]);ami['on'](_0x0a51('0x17'),core[_0x0a51('0x17')]);ami['on']('devicestatechange',function(_0x6edfc0){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x19'),_0x6edfc0[_0x0a51('0x1a')]),_0x6edfc0);members['devicestatechange'](_0x6edfc0);}catch(_0x1027a6){utils['error'](util['format'](_0x0a51('0x19'),_0x6edfc0[_0x0a51('0x1a')]),_0x1027a6);}});ami['on']('agentcalled',function(_0x1357dd){try{utils[_0x0a51('0x1b')](util['format'](_0x0a51('0x1c'),_0x1357dd[_0x0a51('0x1d')]),_0x1357dd);agents[_0x0a51('0x1e')](_0x1357dd);}catch(_0x2f88c5){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x1c'),_0x1357dd[_0x0a51('0x1d')]),_0x2f88c5);}});ami['on'](_0x0a51('0x1f'),function(_0x1856eb){try{utils[_0x0a51('0x1b')](util['format'](_0x0a51('0x20'),_0x1856eb[_0x0a51('0x1d')]),_0x1856eb);agents['agentringnoanswer'](_0x1856eb);}catch(_0x799525){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x20'),_0x1856eb[_0x0a51('0x1d')]),_0x799525);}});ami['on'](_0x0a51('0x21'),function(_0x324545){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')](_0x0a51('0x22'),_0x324545['uniqueid']),_0x324545);agents[_0x0a51('0x21')](_0x324545);queues[_0x0a51('0x21')](_0x324545);}catch(_0x4c6028){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x22'),_0x324545[_0x0a51('0x1d')]),_0x4c6028);}});ami['on']('agentcomplete',function(_0x1ac011){try{utils['debug'](util['format'](_0x0a51('0x23'),_0x1ac011[_0x0a51('0x1d')]),_0x1ac011);agents[_0x0a51('0x24')](_0x1ac011);queues['agentcomplete'](_0x1ac011);members[_0x0a51('0x24')](_0x1ac011);}catch(_0x92e7e5){utils[_0x0a51('0x15')](util[_0x0a51('0x18')]('[%s][index][agentcomplete]',_0x1ac011[_0x0a51('0x1d')]),_0x92e7e5);}});ami['on'](_0x0a51('0x25'),function(_0x515c90){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][queuecallerabandon]',_0x515c90['uniqueid']),_0x515c90);agents[_0x0a51('0x25')](_0x515c90);queues[_0x0a51('0x25')](_0x515c90);}catch(_0x64bd86){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x26'),_0x515c90[_0x0a51('0x1d')]),_0x64bd86);}});ami['on'](_0x0a51('0x27'),function(_0x20fd74){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][queuecallerjoin]',_0x20fd74[_0x0a51('0x1d')]),_0x20fd74);queues['queuecallerjoin'](_0x20fd74);recordings[_0x0a51('0x27')](_0x20fd74);}catch(_0x2fece9){utils[_0x0a51('0x15')](util[_0x0a51('0x18')]('[%s][index][queuecallerjoin]',_0x20fd74[_0x0a51('0x1d')]),_0x2fece9);}});ami['on'](_0x0a51('0x28'),function(_0x216a6b){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][queuecallerleave]',_0x216a6b[_0x0a51('0x1d')]),_0x216a6b);queues[_0x0a51('0x28')](_0x216a6b);}catch(_0x55bb10){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x29'),_0x216a6b['uniqueid']),_0x55bb10);}});ami['on']('musiconholdstart',function(_0x373468){try{utils[_0x0a51('0x1b')](util['format'](_0x0a51('0x2a'),_0x373468['uniqueid']),_0x373468);queues['musiconholdstart'](_0x373468);calls[_0x0a51('0x2b')](_0x373468);}catch(_0x4af704){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x2a'),_0x373468[_0x0a51('0x1d')]),_0x4af704);}});ami['on']('musiconholdstop',function(_0x42ffa3){try{utils[_0x0a51('0x1b')](util['format']('[%s][index][musiconholdstop]',_0x42ffa3[_0x0a51('0x1d')]),_0x42ffa3);queues[_0x0a51('0x2c')](_0x42ffa3);calls['musiconholdstop'](_0x42ffa3);}catch(_0x4b1c4a){utils[_0x0a51('0x15')](util['format']('[%s][index][musiconholdstop]',_0x42ffa3[_0x0a51('0x1d')]),_0x4b1c4a);}});ami['on']('newstate',function(_0xaa8e37){try{utils[_0x0a51('0x1b')](util['format']('[%s][index][newstate]',_0xaa8e37[_0x0a51('0x1d')]),_0xaa8e37);calls[_0x0a51('0x2d')](_0xaa8e37);recordings['newstate'](_0xaa8e37);}catch(_0x50aa9f){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x2e'),_0xaa8e37['uniqueid']),_0x50aa9f);}});ami['on'](_0x0a51('0x2f'),function(_0x121a3c){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][hangup]',_0x121a3c['uniqueid']),_0x121a3c);calls['hangup'](_0x121a3c);recordings[_0x0a51('0x2f')](_0x121a3c);dials[_0x0a51('0x2f')](_0x121a3c);agents['hangup'](_0x121a3c);queues[_0x0a51('0x2f')](_0x121a3c);}catch(_0x262af7){utils['error'](util['format'](_0x0a51('0x30'),_0x121a3c[_0x0a51('0x1d')]),_0x262af7);}});ami['on'](_0x0a51('0x31'),function(_0x3c193f){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x32'),_0x3c193f[_0x0a51('0x1d')]),_0x3c193f);members['cdr'](_0x3c193f);}catch(_0xeb8a60){utils['error'](util[_0x0a51('0x18')](_0x0a51('0x32'),_0x3c193f[_0x0a51('0x1d')]),_0xeb8a60);}});ami['on'](_0x0a51('0x33'),function(_0x11c14f){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')](_0x0a51('0x34'),_0x11c14f['uniqueid']),_0x11c14f);queues[_0x0a51('0x33')](_0x11c14f);agents[_0x0a51('0x33')](_0x11c14f);transfers['blindtransfer'](_0x11c14f);}catch(_0x12f45b){utils[_0x0a51('0x15')](util[_0x0a51('0x18')]('[%s][index][blindtransfer]',_0x11c14f[_0x0a51('0x1d')]),_0x12f45b);}});ami['on'](_0x0a51('0x35'),function(_0x1b5729){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')](_0x0a51('0x36'),_0x1b5729[_0x0a51('0x37')]),_0x1b5729);queues[_0x0a51('0x35')](_0x1b5729);transfers['attendedtransfer'](_0x1b5729);agents[_0x0a51('0x35')](_0x1b5729);calls[_0x0a51('0x35')](_0x1b5729);}catch(_0x21bea4){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x36'),_0x1b5729['origtransfereruniqueid']),_0x21bea4);}});ami['on']('varset',function(_0x204180){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x38'),_0x204180[_0x0a51('0x1d')]),_0x204180);queues[_0x0a51('0x39')](_0x204180);recordings[_0x0a51('0x39')](_0x204180);calls['varset'](_0x204180);dials[_0x0a51('0x39')](_0x204180);}catch(_0x49ad22){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x38'),_0x204180[_0x0a51('0x1d')]),_0x49ad22);}});ami['on'](_0x0a51('0x3a'),function(_0x286791){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x3b'),_0x286791[_0x0a51('0x1d')]),_0x286791);calls['newexten'](_0x286791);recordings[_0x0a51('0x3a')](_0x286791);dials[_0x0a51('0x3a')](_0x286791);}catch(_0x5c63b9){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x3b'),_0x286791[_0x0a51('0x1d')]),_0x5c63b9);}});ami['on'](_0x0a51('0x3c'),function(_0x292261){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x3d'),_0x292261['uniqueid']),_0x292261);calls[_0x0a51('0x3c')](_0x292261);recordings[_0x0a51('0x3c')](_0x292261);}catch(_0x2e833e){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x3d'),_0x292261['uniqueid']),_0x2e833e);}});ami['on'](_0x0a51('0x3e'),function(_0x70b3d3){try{utils['debug'](util[_0x0a51('0x18')]('[%s][index][dialbegin]',_0x70b3d3[_0x0a51('0x1d')]),_0x70b3d3);dials['dialbegin'](_0x70b3d3);}catch(_0x5eddbb){utils['error'](util[_0x0a51('0x18')](_0x0a51('0x3f'),_0x70b3d3[_0x0a51('0x1d')]),_0x5eddbb);}});ami['on'](_0x0a51('0x40'),function(_0x1068bc){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x41'),_0x1068bc['uniqueid']),_0x1068bc);dials[_0x0a51('0x40')](_0x1068bc);}catch(_0x1b7f1f){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x41'),_0x1068bc['uniqueid']),_0x1b7f1f);}});} \ No newline at end of file +var _0x4d2a=['./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','asterisk-manager','../../config/environment','asterisk','port','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller'];(function(_0x39db49,_0x5a1bfd){var _0x345c13=function(_0x42c8fe){while(--_0x42c8fe){_0x39db49['push'](_0x39db49['shift']());}};_0x345c13(++_0x5a1bfd);}(_0x4d2a,0x165));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xa4d2('0x0'));var config=require(_0xa4d2('0x1'));var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config[_0xa4d2('0x2')][_0xa4d2('0x3')],config['asterisk']['ip'],config[_0xa4d2('0x2')]['username'],config[_0xa4d2('0x2')][_0xa4d2('0x4')],!![]);ami[_0xa4d2('0x5')]();if(config[_0xa4d2('0x6')]&&config[_0xa4d2('0x6')][_0xa4d2('0x7')]){utils['info'](_0xa4d2('0x8'));}else{var agents=require(_0xa4d2('0x9'));var calls=require('./calls.controller');var queues=require(_0xa4d2('0xa'));var recordings=require(_0xa4d2('0xb'));var members=require(_0xa4d2('0xc'));var dials=require(_0xa4d2('0xd'));var transfers=require(_0xa4d2('0xe'));var core=require(_0xa4d2('0xf'));ami['on']('connect',core['connect']);ami['on'](_0xa4d2('0x10'),core[_0xa4d2('0x10')]);ami['on'](_0xa4d2('0x11'),core['fullybooted']);ami['on'](_0xa4d2('0x12'),core[_0xa4d2('0x12')]);ami['on'](_0xa4d2('0x13'),core[_0xa4d2('0x13')]);ami['on'](_0xa4d2('0x14'),core[_0xa4d2('0x14')]);ami['on'](_0xa4d2('0x15'),function(_0x3650c7){try{utils[_0xa4d2('0x16')](util['format'](_0xa4d2('0x17'),_0x3650c7[_0xa4d2('0x18')]),_0x3650c7);members[_0xa4d2('0x15')](_0x3650c7);}catch(_0x907717){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x17'),_0x3650c7['device']),_0x907717);}});ami['on'](_0xa4d2('0x1a'),function(_0x1c8e57){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')]('[%s][index][agentcalled]',_0x1c8e57[_0xa4d2('0x1b')]),_0x1c8e57);agents[_0xa4d2('0x1a')](_0x1c8e57);}catch(_0xdc6f68){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x1c'),_0x1c8e57[_0xa4d2('0x1b')]),_0xdc6f68);}});ami['on']('agentringnoanswer',function(_0x424858){try{utils['debug'](util[_0xa4d2('0x19')](_0xa4d2('0x1d'),_0x424858[_0xa4d2('0x1b')]),_0x424858);agents['agentringnoanswer'](_0x424858);}catch(_0x12d240){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x1d'),_0x424858[_0xa4d2('0x1b')]),_0x12d240);}});ami['on'](_0xa4d2('0x1e'),function(_0x428e31){try{utils[_0xa4d2('0x16')](util['format'](_0xa4d2('0x1f'),_0x428e31[_0xa4d2('0x1b')]),_0x428e31);agents[_0xa4d2('0x1e')](_0x428e31);queues[_0xa4d2('0x1e')](_0x428e31);}catch(_0x5547e0){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x1f'),_0x428e31[_0xa4d2('0x1b')]),_0x5547e0);}});ami['on'](_0xa4d2('0x20'),function(_0x270d17){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x21'),_0x270d17['uniqueid']),_0x270d17);agents[_0xa4d2('0x20')](_0x270d17);queues[_0xa4d2('0x20')](_0x270d17);members[_0xa4d2('0x20')](_0x270d17);}catch(_0x26ac98){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x21'),_0x270d17[_0xa4d2('0x1b')]),_0x26ac98);}});ami['on'](_0xa4d2('0x22'),function(_0x7a1900){try{utils[_0xa4d2('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x7a1900[_0xa4d2('0x1b')]),_0x7a1900);agents[_0xa4d2('0x22')](_0x7a1900);queues[_0xa4d2('0x22')](_0x7a1900);}catch(_0x20e1bb){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][queuecallerabandon]',_0x7a1900[_0xa4d2('0x1b')]),_0x20e1bb);}});ami['on'](_0xa4d2('0x23'),function(_0x50bc0c){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x24'),_0x50bc0c[_0xa4d2('0x1b')]),_0x50bc0c);queues[_0xa4d2('0x23')](_0x50bc0c);recordings[_0xa4d2('0x23')](_0x50bc0c);}catch(_0x4e259f){utils['error'](util['format'](_0xa4d2('0x24'),_0x50bc0c[_0xa4d2('0x1b')]),_0x4e259f);}});ami['on'](_0xa4d2('0x25'),function(_0x56563a){try{utils['debug'](util['format']('[%s][index][queuecallerleave]',_0x56563a[_0xa4d2('0x1b')]),_0x56563a);queues[_0xa4d2('0x25')](_0x56563a);}catch(_0x1ccb16){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][queuecallerleave]',_0x56563a[_0xa4d2('0x1b')]),_0x1ccb16);}});ami['on'](_0xa4d2('0x26'),function(_0x312dfe){try{utils[_0xa4d2('0x16')](util['format'](_0xa4d2('0x27'),_0x312dfe[_0xa4d2('0x1b')]),_0x312dfe);queues[_0xa4d2('0x26')](_0x312dfe);calls[_0xa4d2('0x26')](_0x312dfe);}catch(_0x2cdad2){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x27'),_0x312dfe['uniqueid']),_0x2cdad2);}});ami['on'](_0xa4d2('0x28'),function(_0x1b3cbd){try{utils['debug'](util['format'](_0xa4d2('0x29'),_0x1b3cbd['uniqueid']),_0x1b3cbd);queues[_0xa4d2('0x28')](_0x1b3cbd);calls['musiconholdstop'](_0x1b3cbd);}catch(_0x161e4d){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x29'),_0x1b3cbd[_0xa4d2('0x1b')]),_0x161e4d);}});ami['on']('newstate',function(_0x21f9fb){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')]('[%s][index][newstate]',_0x21f9fb[_0xa4d2('0x1b')]),_0x21f9fb);calls['newstate'](_0x21f9fb);recordings[_0xa4d2('0x2a')](_0x21f9fb);}catch(_0x271a65){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x2b'),_0x21f9fb[_0xa4d2('0x1b')]),_0x271a65);}});ami['on']('hangup',function(_0x25a4d3){try{utils['debug'](util[_0xa4d2('0x19')]('[%s][index][hangup]',_0x25a4d3[_0xa4d2('0x1b')]),_0x25a4d3);calls['hangup'](_0x25a4d3);recordings[_0xa4d2('0x2c')](_0x25a4d3);dials['hangup'](_0x25a4d3);agents[_0xa4d2('0x2c')](_0x25a4d3);queues['hangup'](_0x25a4d3);}catch(_0x35670f){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x2d'),_0x25a4d3['uniqueid']),_0x35670f);}});ami['on'](_0xa4d2('0x2e'),function(_0x3e1cfc){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x2f'),_0x3e1cfc[_0xa4d2('0x1b')]),_0x3e1cfc);members[_0xa4d2('0x2e')](_0x3e1cfc);}catch(_0x23de07){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][cdr]',_0x3e1cfc[_0xa4d2('0x1b')]),_0x23de07);}});ami['on']('blindtransfer',function(_0x3812f7){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x30'),_0x3812f7[_0xa4d2('0x1b')]),_0x3812f7);queues[_0xa4d2('0x31')](_0x3812f7);agents[_0xa4d2('0x31')](_0x3812f7);transfers[_0xa4d2('0x31')](_0x3812f7);}catch(_0x3d9dc7){utils[_0xa4d2('0x12')](util['format'](_0xa4d2('0x30'),_0x3812f7[_0xa4d2('0x1b')]),_0x3d9dc7);}});ami['on'](_0xa4d2('0x32'),function(_0x3dad56){try{utils['debug'](util[_0xa4d2('0x19')]('[%s][index][attendedtransfer]',_0x3dad56[_0xa4d2('0x33')]),_0x3dad56);queues[_0xa4d2('0x32')](_0x3dad56);transfers['attendedtransfer'](_0x3dad56);agents['attendedtransfer'](_0x3dad56);calls['attendedtransfer'](_0x3dad56);}catch(_0x1e480a){utils['error'](util['format'](_0xa4d2('0x34'),_0x3dad56['origtransfereruniqueid']),_0x1e480a);}});ami['on']('varset',function(_0x379819){try{utils['debug'](util[_0xa4d2('0x19')](_0xa4d2('0x35'),_0x379819[_0xa4d2('0x1b')]),_0x379819);queues[_0xa4d2('0x36')](_0x379819);recordings[_0xa4d2('0x36')](_0x379819);calls[_0xa4d2('0x36')](_0x379819);dials['varset'](_0x379819);}catch(_0x43d8d7){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x35'),_0x379819[_0xa4d2('0x1b')]),_0x43d8d7);}});ami['on'](_0xa4d2('0x37'),function(_0x2b0960){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x38'),_0x2b0960['uniqueid']),_0x2b0960);calls[_0xa4d2('0x37')](_0x2b0960);recordings[_0xa4d2('0x37')](_0x2b0960);dials['newexten'](_0x2b0960);}catch(_0x5f3849){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x38'),_0x2b0960[_0xa4d2('0x1b')]),_0x5f3849);}});ami['on'](_0xa4d2('0x39'),function(_0x495cf1){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x3a'),_0x495cf1[_0xa4d2('0x1b')]),_0x495cf1);calls[_0xa4d2('0x39')](_0x495cf1);recordings[_0xa4d2('0x39')](_0x495cf1);}catch(_0x19176e){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')](_0xa4d2('0x3a'),_0x495cf1[_0xa4d2('0x1b')]),_0x19176e);}});ami['on'](_0xa4d2('0x3b'),function(_0x472c2f){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x3c'),_0x472c2f['uniqueid']),_0x472c2f);dials[_0xa4d2('0x3b')](_0x472c2f);}catch(_0xb2ba33){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s]dialbegin',_0x472c2f[_0xa4d2('0x1b')]),_0xb2ba33);}});ami['on']('dialend',function(_0x2641f3){try{utils[_0xa4d2('0x16')](util[_0xa4d2('0x19')](_0xa4d2('0x3d'),_0x2641f3['uniqueid']),_0x2641f3);dials['dialend'](_0x2641f3);}catch(_0x54ef96){utils[_0xa4d2('0x12')](util[_0xa4d2('0x19')]('[%s][index][dialend]',_0x2641f3[_0xa4d2('0x1b')]),_0x54ef96);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 262ac67..ef31db2 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 _0x2dfb=['data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','source','destination','lodash','./utils','Local/_attended@transfer','Queue:','info','uniqueid','interface','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','channel','split'];(function(_0x19b9a0,_0x2f7153){var _0x2b3bd6=function(_0x5d339d){while(--_0x5d339d){_0x19b9a0['push'](_0x19b9a0['shift']());}};_0x2b3bd6(++_0x2f7153);}(_0x2dfb,0x138));var _0xb2df=function(_0x7f1eea,_0x89199c){_0x7f1eea=_0x7f1eea-0x0;var _0x172778=_0x2dfb[_0x7f1eea];return _0x172778;};'use strict';var _=require(_0xb2df('0x0'));var util=require('util');var utils=require(_0xb2df('0x1'));var members={};var exclude=[_0xb2df('0x2'),_0xb2df('0x3')];function writeDB(_0x30e422){utils[_0xb2df('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x30e422[_0xb2df('0x5')],_0x30e422[_0xb2df('0x6')],_0x30e422['channel'],_0x30e422[_0xb2df('0x7')],_0x30e422['membername'],_0x30e422[_0xb2df('0x8')]));if(_0x30e422[_0xb2df('0x6')]){utils[_0xb2df('0x9')](_0x30e422[_0xb2df('0x6')])[_0xb2df('0xa')](function(_0x2143f0){if(_0x2143f0){_0x30e422[_0xb2df('0xb')]=_0x2143f0[_0xb2df('0xc')];_0x30e422[_0xb2df('0xd')]=_0x2143f0[_0xb2df('0xd')];utils[_0xb2df('0xe')](_0xb2df('0xf'),_0x30e422);}else{utils['getUserByName'](_0x30e422['interface']['split']('/')[0x1])['then'](function(_0x2bd28c){if(_0x2bd28c){_0x30e422['membername']=_0x2bd28c[_0xb2df('0xc')];_0x30e422[_0xb2df('0xd')]=_0x2bd28c['internal'];utils[_0xb2df('0xe')]('CreateMemberReport',_0x30e422);}});}})['catch'](function(_0x2586f9){utils[_0xb2df('0x10')](util[_0xb2df('0x11')](_0xb2df('0x12'),_0x30e422[_0xb2df('0x5')]),_0x2586f9);});}delete members[_0x30e422[_0xb2df('0x6')]];}function startsWith(_0x4547e5,_0x30b609){return _[_0xb2df('0x13')](_0x4547e5,function(_0x51fead){return _[_0xb2df('0x14')](_0x30b609,_0x51fead);});}exports[_0xb2df('0x15')]=function(_0x2f1941){try{utils[_0xb2df('0x16')](util[_0xb2df('0x11')](_0xb2df('0x17'),members[_0x2f1941['device']]?members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]:_0x2f1941[_0xb2df('0x18')]),_0x2f1941);utils['info'](util[_0xb2df('0x11')](_0xb2df('0x19'),members[_0x2f1941[_0xb2df('0x18')]]?members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]:_0x2f1941[_0xb2df('0x18')],_0x2f1941['state'],_0x2f1941[_0xb2df('0x18')]));switch(_0x2f1941[_0xb2df('0x1a')]){case _0xb2df('0x1b'):case _0xb2df('0x1c'):if(!startsWith(exclude,_0x2f1941[_0xb2df('0x18')])){members[_0x2f1941[_0xb2df('0x18')]]={'channel':_0xb2df('0x1d'),'interface':_0x2f1941[_0xb2df('0x18')],'type':'TALKING','enterAt':utils['now'](),'role':_0xb2df('0x1e')};}break;case _0xb2df('0x1f'):if(!_[_0xb2df('0x20')](members[_0x2f1941[_0xb2df('0x18')]])){members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x21')]=utils[_0xb2df('0x22')]();members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x23')]=utils[_0xb2df('0x24')](members[_0x2f1941['device']][_0xb2df('0x21')],members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x25')]);if(members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]){writeDB(members[_0x2f1941[_0xb2df('0x18')]]);}}break;default:break;}}catch(_0x326e72){utils['error'](util[_0xb2df('0x11')](_0xb2df('0x17'),members[_0x2f1941[_0xb2df('0x18')]]?members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]:_0x2f1941[_0xb2df('0x18')]),_0x326e72);}};exports['agentcomplete']=function(_0x126ecf){try{if(!_['isNil'](members[_0x126ecf[_0xb2df('0x6')]])){utils[_0xb2df('0x16')](util[_0xb2df('0x11')](_0xb2df('0x26'),_0x126ecf['uniqueid']),_0x126ecf);utils[_0xb2df('0x4')](util['format'](_0xb2df('0x27'),_0x126ecf[_0xb2df('0x5')],_0x126ecf[_0xb2df('0x6')],_0x126ecf[_0xb2df('0x28')]));members[_0x126ecf[_0xb2df('0x6')]]=_[_0xb2df('0x29')](members[_0x126ecf[_0xb2df('0x6')]],{'data4':_0x126ecf[_0xb2df('0x28')],'uniqueid':_0x126ecf['uniqueid']});}}catch(_0x28e6f2){utils[_0xb2df('0x10')](util[_0xb2df('0x11')](_0xb2df('0x26'),_0x126ecf['uniqueid']),_0x28e6f2);}};exports['cdr']=function(_0x12b29e){try{utils[_0xb2df('0x16')](util[_0xb2df('0x11')](_0xb2df('0x2a'),_0x12b29e[_0xb2df('0x5')]),_0x12b29e);if(_0x12b29e[_0xb2df('0x2b')]){var _0x47d8f0=_0x12b29e[_0xb2df('0x2b')][_0xb2df('0x2c')]('-')[0x0];if(!_[_0xb2df('0x20')](members[_0x47d8f0])){members[_0x47d8f0]=_[_0xb2df('0x29')](members[_0x47d8f0],{'data1':members[_0x47d8f0]['data1']||_0x12b29e[_0xb2df('0x8')],'data2':members[_0x47d8f0][_0xb2df('0x7')]||_0x12b29e['source'],'data3':members[_0x47d8f0][_0xb2df('0x2d')]||_0x12b29e['destination'],'uniqueid':members[_0x47d8f0]['uniqueid']||_0x12b29e['uniqueid']});utils[_0xb2df('0x4')](util[_0xb2df('0x11')](_0xb2df('0x2e'),_0x12b29e[_0xb2df('0x5')],members[_0x47d8f0][_0xb2df('0x2f')],members[_0x47d8f0][_0xb2df('0x7')],members[_0x47d8f0][_0xb2df('0x2d')]));if(members[_0x47d8f0]['exitAt']){writeDB(members[_0x47d8f0]);}}}if(_0x12b29e[_0xb2df('0x30')]){var _0x475867=_0x12b29e[_0xb2df('0x30')]['split']('-')[0x0];if(!_[_0xb2df('0x20')](members[_0x475867])){members[_0x475867]=_[_0xb2df('0x29')](members[_0x475867],{'data1':members[_0x475867][_0xb2df('0x2f')]||_0x12b29e[_0xb2df('0x8')],'data2':members[_0x475867][_0xb2df('0x7')]||_0x12b29e[_0xb2df('0x31')],'data3':members[_0x475867]['data3']||_0x12b29e[_0xb2df('0x32')],'uniqueid':members[_0x475867][_0xb2df('0x5')]||_0x12b29e['uniqueid']});utils[_0xb2df('0x4')](util[_0xb2df('0x11')](_0xb2df('0x2e'),_0x12b29e['uniqueid'],members[_0x475867][_0xb2df('0x2f')],members[_0x475867][_0xb2df('0x7')],members[_0x475867][_0xb2df('0x2d')]));if(members[_0x475867][_0xb2df('0x21')]){writeDB(members[_0x475867]);}}}}catch(_0x1e78c0){utils[_0xb2df('0x10')](util['format'](_0xb2df('0x2a'),_0x12b29e[_0xb2df('0x5')]),_0x1e78c0);}}; \ No newline at end of file +var _0x89f2=['voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','data3','lodash','util','Local/_attended@transfer','Queue:','info','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x89f2,0x11f));var _0x289f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x89f2[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x289f('0x0'));var util=require(_0x289f('0x1'));var utils=require('./utils');var members={};var exclude=[_0x289f('0x2'),_0x289f('0x3')];function writeDB(_0x2cf347){utils[_0x289f('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2cf347[_0x289f('0x5')],_0x2cf347['interface'],_0x2cf347[_0x289f('0x6')],_0x2cf347[_0x289f('0x7')],_0x2cf347[_0x289f('0x8')],_0x2cf347[_0x289f('0x9')]));if(_0x2cf347[_0x289f('0xa')]){utils[_0x289f('0xb')](_0x2cf347[_0x289f('0xa')])[_0x289f('0xc')](function(_0x17e08e){if(_0x17e08e){_0x2cf347[_0x289f('0x8')]=_0x17e08e[_0x289f('0xd')];_0x2cf347[_0x289f('0xe')]=_0x17e08e[_0x289f('0xe')];utils[_0x289f('0xf')](_0x289f('0x10'),_0x2cf347);}else{utils[_0x289f('0x11')](_0x2cf347[_0x289f('0xa')][_0x289f('0x12')]('/')[0x1])[_0x289f('0xc')](function(_0x4a7649){if(_0x4a7649){_0x2cf347[_0x289f('0x8')]=_0x4a7649['name'];_0x2cf347[_0x289f('0xe')]=_0x4a7649[_0x289f('0xe')];utils[_0x289f('0xf')]('CreateMemberReport',_0x2cf347);}});}})[_0x289f('0x13')](function(_0x33b8ec){utils[_0x289f('0x14')](util['format'](_0x289f('0x15'),_0x2cf347[_0x289f('0x5')]),_0x33b8ec);});}delete members[_0x2cf347[_0x289f('0xa')]];}function startsWith(_0x5b0f7,_0x592b1e){return _[_0x289f('0x16')](_0x5b0f7,function(_0x1bc291){return _[_0x289f('0x17')](_0x592b1e,_0x1bc291);});}exports[_0x289f('0x18')]=function(_0x12b980){try{utils[_0x289f('0x19')](util[_0x289f('0x1a')]('[%s][members][devicestatechange]',members[_0x12b980[_0x289f('0x1b')]]?members[_0x12b980['device']][_0x289f('0x5')]:_0x12b980[_0x289f('0x1b')]),_0x12b980);utils[_0x289f('0x4')](util['format'](_0x289f('0x1c'),members[_0x12b980['device']]?members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x5')]:_0x12b980[_0x289f('0x1b')],_0x12b980[_0x289f('0x1d')],_0x12b980['device']));switch(_0x12b980[_0x289f('0x1d')]){case _0x289f('0x1e'):case'BUSY':if(!startsWith(exclude,_0x12b980[_0x289f('0x1b')])){members[_0x12b980[_0x289f('0x1b')]]={'channel':_0x289f('0x1f'),'interface':_0x12b980[_0x289f('0x1b')],'type':'TALKING','enterAt':utils['now'](),'role':_0x289f('0x20')};}break;case _0x289f('0x21'):if(!_[_0x289f('0x22')](members[_0x12b980[_0x289f('0x1b')]])){members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x23')]=utils[_0x289f('0x24')]();members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x25')]=utils[_0x289f('0x26')](members[_0x12b980[_0x289f('0x1b')]]['exitAt'],members[_0x12b980[_0x289f('0x1b')]][_0x289f('0x27')]);if(members[_0x12b980[_0x289f('0x1b')]]['uniqueid']){writeDB(members[_0x12b980[_0x289f('0x1b')]]);}}break;default:break;}}catch(_0x24997b){utils[_0x289f('0x14')](util['format']('[%s][members][devicestatechange]',members[_0x12b980[_0x289f('0x1b')]]?members[_0x12b980['device']][_0x289f('0x5')]:_0x12b980[_0x289f('0x1b')]),_0x24997b);}};exports[_0x289f('0x28')]=function(_0x1b6980){try{if(!_[_0x289f('0x22')](members[_0x1b6980[_0x289f('0xa')]])){utils['debug'](util[_0x289f('0x1a')](_0x289f('0x29'),_0x1b6980[_0x289f('0x5')]),_0x1b6980);utils[_0x289f('0x4')](util[_0x289f('0x1a')](_0x289f('0x2a'),_0x1b6980[_0x289f('0x5')],_0x1b6980[_0x289f('0xa')],_0x1b6980[_0x289f('0x2b')]));members[_0x1b6980[_0x289f('0xa')]]=_[_0x289f('0x2c')](members[_0x1b6980[_0x289f('0xa')]],{'data4':_0x1b6980[_0x289f('0x2b')],'uniqueid':_0x1b6980[_0x289f('0x5')]});}}catch(_0x633a49){utils['error'](util[_0x289f('0x1a')]('[%s][members][agentcomplete]',_0x1b6980['uniqueid']),_0x633a49);}};exports[_0x289f('0x2d')]=function(_0x930f61){try{utils[_0x289f('0x19')](util['format'](_0x289f('0x2e'),_0x930f61[_0x289f('0x5')]),_0x930f61);if(_0x930f61[_0x289f('0x6')]){var _0xf61cc0=_0x930f61['channel'][_0x289f('0x12')]('-')[0x0];if(!_[_0x289f('0x22')](members[_0xf61cc0])){members[_0xf61cc0]=_['assign'](members[_0xf61cc0],{'data1':members[_0xf61cc0]['data1']||_0x930f61[_0x289f('0x9')],'data2':members[_0xf61cc0][_0x289f('0x7')]||_0x930f61[_0x289f('0x2f')],'data3':members[_0xf61cc0]['data3']||_0x930f61[_0x289f('0x30')],'uniqueid':members[_0xf61cc0]['uniqueid']||_0x930f61[_0x289f('0x5')]});utils[_0x289f('0x4')](util[_0x289f('0x1a')](_0x289f('0x31'),_0x930f61[_0x289f('0x5')],members[_0xf61cc0]['data1'],members[_0xf61cc0][_0x289f('0x7')],members[_0xf61cc0]['data3']));if(members[_0xf61cc0][_0x289f('0x23')]){writeDB(members[_0xf61cc0]);}}}if(_0x930f61[_0x289f('0x32')]){var _0x8463aa=_0x930f61[_0x289f('0x32')][_0x289f('0x12')]('-')[0x0];if(!_[_0x289f('0x22')](members[_0x8463aa])){members[_0x8463aa]=_['assign'](members[_0x8463aa],{'data1':members[_0x8463aa]['data1']||_0x930f61[_0x289f('0x9')],'data2':members[_0x8463aa][_0x289f('0x7')]||_0x930f61['source'],'data3':members[_0x8463aa]['data3']||_0x930f61[_0x289f('0x30')],'uniqueid':members[_0x8463aa]['uniqueid']||_0x930f61['uniqueid']});utils['info'](util[_0x289f('0x1a')](_0x289f('0x31'),_0x930f61[_0x289f('0x5')],members[_0x8463aa][_0x289f('0x33')],members[_0x8463aa]['data2'],members[_0x8463aa][_0x289f('0x34')]));if(members[_0x8463aa][_0x289f('0x23')]){writeDB(members[_0x8463aa]);}}}}catch(_0x1b1499){utils[_0x289f('0x14')](util['format'](_0x289f('0x2e'),_0x930f61['uniqueid']),_0x1b1499);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 52d2bd3..4b922c5 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 _0xd386=['queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xd386,0x10c));var _0x6d38=function(_0x41a93b,_0x2fc19d){_0x41a93b=_0x41a93b-0x0;var _0x220a7e=_0xd386[_0x41a93b];return _0x220a7e;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var utils=require(_0x6d38('0x2'));var queues={};function writeDB(_0x5506c9){utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5506c9[_0x6d38('0x5')],_0x5506c9[_0x6d38('0x6')],_0x5506c9[_0x6d38('0x7')],_0x5506c9[_0x6d38('0x8')],_0x5506c9['calleridnum'],_0x5506c9[_0x6d38('0x9')],_0x5506c9[_0x6d38('0xa')]));if(_0x5506c9[_0x6d38('0x7')]){utils[_0x6d38('0xb')](_0x5506c9[_0x6d38('0x7')])[_0x6d38('0xc')](function(_0x49d71a){if(_0x49d71a){_0x5506c9[_0x6d38('0xd')]=_0x49d71a['type'];}utils[_0x6d38('0xe')]('CreateVoiceQueueReport',_0x5506c9);});}else{utils[_0x6d38('0xe')](_0x6d38('0xf'),_0x5506c9);}if(_0x5506c9[_0x6d38('0x10')]){delete queues[_0x5506c9['transfereduniqueid']];}else{delete queues[_0x5506c9[_0x6d38('0x5')]];}}exports[_0x6d38('0x11')]=function(_0x404a35){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x404a35[_0x6d38('0x5')]),_0x404a35);utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x12'),_0x404a35[_0x6d38('0x5')],_0x404a35['queue'],_0x404a35[_0x6d38('0x13')]));queues[_0x404a35[_0x6d38('0x5')]]=_[_0x6d38('0x14')](_0x404a35,{'originalposition':_0x404a35[_0x6d38('0x13')],'queuecallerjoinAt':utils[_0x6d38('0x15')](),'mohtime':0x0});}catch(_0x22a822){utils[_0x6d38('0x16')](util['format']('[%s][queues][queuecallerjoin]',_0x404a35['uniqueid']),_0x22a822);}};exports[_0x6d38('0x17')]=function(_0x46e7d7){try{if(!_[_0x6d38('0x18')](queues[_0x46e7d7[_0x6d38('0x5')]])){utils[_0x6d38('0x19')](util[_0x6d38('0x4')]('[%s][queues][hangup]',_0x46e7d7[_0x6d38('0x5')]),_0x46e7d7);if(queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1a')]){if(!queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1b')]&&!queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1c')]){queues[_0x46e7d7[_0x6d38('0x5')]]['queuecallercomplete']=!![];queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1d')]=utils['now']();queues[_0x46e7d7['uniqueid']][_0x6d38('0xa')]=_0x6d38('0x1e');}utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x46e7d7[_0x6d38('0x5')],queues[_0x46e7d7['uniqueid']][_0x6d38('0x1f')],queues[_0x46e7d7['uniqueid']][_0x6d38('0xa')]));writeDB(queues[_0x46e7d7['uniqueid']]);}else if(queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x10')]){utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x20'),_0x46e7d7['uniqueid'],queues[_0x46e7d7['uniqueid']][_0x6d38('0x1f')],queues[_0x46e7d7[_0x6d38('0x5')]]['transfereduniqueid']));queues[queues[_0x46e7d7['uniqueid']][_0x6d38('0x10')]]=queues[_0x46e7d7['uniqueid']];queues[queues[_0x46e7d7['uniqueid']][_0x6d38('0x10')]][_0x6d38('0x21')]=0x2;delete queues[_0x46e7d7[_0x6d38('0x5')]];}}}catch(_0x1440c1){utils[_0x6d38('0x16')](util[_0x6d38('0x4')]('[%s][queues][hangup]',_0x46e7d7[_0x6d38('0x5')]),_0x1440c1);}};exports['varset']=function(_0x19ab6e){try{utils['debug'](util[_0x6d38('0x4')]('[%s][queues][varset]',_0x19ab6e[_0x6d38('0x5')]),_0x19ab6e);if(!_[_0x6d38('0x18')](_0x19ab6e['variable']['queuestatus'])&&_0x19ab6e[_0x6d38('0x22')][_0x6d38('0x23')]()!==_0x6d38('0x24')){if(!_[_0x6d38('0x18')](queues[_0x19ab6e[_0x6d38('0x5')]])){queues[_0x19ab6e[_0x6d38('0x5')]]['queuecallerabandon']=![];queues[_0x19ab6e['uniqueid']][_0x6d38('0x25')]=null;queues[_0x19ab6e['uniqueid']][_0x6d38('0x1c')]=!![];queues[_0x19ab6e['uniqueid']][_0x6d38('0x26')]=utils[_0x6d38('0x15')]();queues[_0x19ab6e[_0x6d38('0x5')]]['queuecallerexitreason']=_0x19ab6e[_0x6d38('0x22')][_0x6d38('0x23')]();utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x27'),_0x19ab6e[_0x6d38('0x5')],queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x19ab6e[_0x6d38('0x22')],queues[_0x19ab6e['uniqueid']][_0x6d38('0xa')]));writeDB(queues[_0x19ab6e[_0x6d38('0x5')]]);}}else if(!_[_0x6d38('0x18')](_0x19ab6e['variable']['queueposition'])){if(!_[_0x6d38('0x18')](queues[_0x19ab6e['uniqueid']])&&!queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x1b')]){queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x1b')]=![];queues[_0x19ab6e['uniqueid']][_0x6d38('0x25')]=null;queues[_0x19ab6e['uniqueid']]['queuecallerexit']=!![];queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x26')]=utils['now']();queues[_0x19ab6e['uniqueid']][_0x6d38('0xa')]=_0x6d38('0x28');utils['info'](util['format'](_0x6d38('0x29'),_0x19ab6e[_0x6d38('0x5')],queues[_0x19ab6e['uniqueid']]['name'],_0x19ab6e[_0x6d38('0x22')],queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0xa')]));}}}catch(_0x2a17a5){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x2a'),_0x19ab6e['uniqueid']),_0x2a17a5);}};exports[_0x6d38('0x1b')]=function(_0x3d028a){try{if(!_['isNil'](queues[_0x3d028a[_0x6d38('0x5')]])){utils[_0x6d38('0x19')](util['format']('[%s][queues][queuecallerabandon]',_0x3d028a['uniqueid']),_0x3d028a);queues[_0x3d028a['uniqueid']][_0x6d38('0x1c')]=![];queues[_0x3d028a[_0x6d38('0x5')]]['queuecallerexitAt']=null;queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0x1b')]=!![];queues[_0x3d028a['uniqueid']]['queuecallerabandonAt']=utils[_0x6d38('0x15')]();queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0xa')]=_0x6d38('0x2b');utils['info'](util[_0x6d38('0x4')](_0x6d38('0x2c'),_0x3d028a[_0x6d38('0x5')],queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0x1f')],queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0xa')]));}}catch(_0x140b8a){utils[_0x6d38('0x16')](util[_0x6d38('0x4')]('[%s][queues][queuecallerabandon]',_0x3d028a[_0x6d38('0x5')]),_0x140b8a);}};exports[_0x6d38('0x2d')]=function(_0x46410b){try{if(!_[_0x6d38('0x18')](queues[_0x46410b['uniqueid']])){utils[_0x6d38('0x19')](util[_0x6d38('0x4')](_0x6d38('0x2e'),_0x46410b[_0x6d38('0x5')]),_0x46410b);utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x2f'),_0x46410b[_0x6d38('0x5')],queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x46410b[_0x6d38('0x30')],_0x46410b['connectedlinename']));queues[_0x46410b['uniqueid']][_0x6d38('0x2d')]=!![];queues[_0x46410b['uniqueid']][_0x6d38('0x1a')]=utils['now']();queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x31')]=utils[_0x6d38('0x32')](queues[_0x46410b['uniqueid']][_0x6d38('0x1a')],queues[_0x46410b[_0x6d38('0x5')]]['queuecallerjoinAt']);queues[_0x46410b['uniqueid']][_0x6d38('0x13')]=_0x46410b['position'];queues[_0x46410b[_0x6d38('0x5')]]['count']=_0x46410b[_0x6d38('0x33')];queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x30')]=_0x46410b['connectedlinenum'];queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x34')]=_0x46410b['connectedlinename'];}}catch(_0x5389f6){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x2e'),_0x46410b[_0x6d38('0x5')]),_0x5389f6);}};exports[_0x6d38('0x35')]=function(_0x456f73){try{if(!_[_0x6d38('0x18')](queues[_0x456f73[_0x6d38('0x5')]])){utils['debug'](util[_0x6d38('0x4')](_0x6d38('0x36'),_0x456f73[_0x6d38('0x5')]),_0x456f73);utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x456f73[_0x6d38('0x5')],queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x456f73[_0x6d38('0x37')],_0x456f73[_0x6d38('0x38')]));queues[_0x456f73['uniqueid']][_0x6d38('0x1b')]=![];queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x1b')]=![];queues[_0x456f73['uniqueid']][_0x6d38('0x25')]=null;queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x1c')]=![];queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0xa')]=null;queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x26')]=null;queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x39')]=!![];queues[_0x456f73['uniqueid']][_0x6d38('0x9')]=_0x456f73[_0x6d38('0x38')];queues[_0x456f73[_0x6d38('0x5')]]['lastAssignedTo']=_0x456f73['membername'];}}catch(_0x1bfce2){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x36'),_0x456f73[_0x6d38('0x5')]),_0x1bfce2);}};exports[_0x6d38('0x3a')]=function(_0x4f3bdc){try{if(!_['isNil'](queues[_0x4f3bdc[_0x6d38('0x5')]])){if(queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1a')]){utils[_0x6d38('0x19')](util[_0x6d38('0x4')]('[%s][queues][agentcomplete]',_0x4f3bdc[_0x6d38('0x5')]),_0x4f3bdc);queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1b')]=![];queues[_0x4f3bdc[_0x6d38('0x5')]]['queuecallerabandon']=![];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x25')]=null;queues[_0x4f3bdc['uniqueid']]['queuecallerexit']=![];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x26')]=null;queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x39')]=!![];queues[_0x4f3bdc[_0x6d38('0x5')]]['lastAssignedTo']=_0x4f3bdc[_0x6d38('0x37')];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x3b')]=!![];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1d')]=utils[_0x6d38('0x15')]();if(_0x4f3bdc[_0x6d38('0x3c')]==_0x6d38('0x3d')){if(!queues[_0x4f3bdc['uniqueid']][_0x6d38('0x3d')]){queues[_0x4f3bdc[_0x6d38('0x5')]]['queuecallerexitreason']=_0x6d38('0x3e');}}else{queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0xa')]='COMPLETEDBY'+_0x4f3bdc['reason'][_0x6d38('0x23')]();}utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x3f'),_0x4f3bdc[_0x6d38('0x5')],queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x4f3bdc[_0x6d38('0x37')],queues[_0x4f3bdc[_0x6d38('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4f3bdc[_0x6d38('0x5')]]);}}}catch(_0x4daee6){utils['error'](util[_0x6d38('0x4')]('[%s][queues][agentcomplete]',_0x4f3bdc[_0x6d38('0x5')]),_0x4daee6);}};exports[_0x6d38('0x40')]=function(_0x5a06f9){try{if(!_['isNil'](queues[_0x5a06f9['transfereeuniqueid']])){utils[_0x6d38('0x19')](util['format'](_0x6d38('0x41'),_0x5a06f9['uniqueid']),_0x5a06f9);queues[_0x5a06f9['transfereeuniqueid']][_0x6d38('0x3d')]=!![];queues[_0x5a06f9[_0x6d38('0x42')]]['transfertype']=_0x6d38('0x43');queues[_0x5a06f9[_0x6d38('0x42')]][_0x6d38('0x44')]=_0x5a06f9['extension'];queues[_0x5a06f9['transfereeuniqueid']][_0x6d38('0x45')]=_0x5a06f9[_0x6d38('0x42')];queues[_0x5a06f9['transfereeuniqueid']][_0x6d38('0xa')]=_0x6d38('0x46');utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x47'),_0x5a06f9['uniqueid'],queues[_0x5a06f9['transfereeuniqueid']]['name'],_0x5a06f9['transfereeuniqueid'],_0x5a06f9['extension']));}}catch(_0x22738f){utils[_0x6d38('0x16')](util[_0x6d38('0x4')]('[%s][queues][blindtransfer]',_0x5a06f9[_0x6d38('0x5')]),_0x22738f);}};exports['attendedtransfer']=function(_0x6a503){try{utils[_0x6d38('0x19')](util[_0x6d38('0x4')](_0x6d38('0x48'),_0x6a503[_0x6d38('0x49')]),_0x6a503);if(_0x6a503[_0x6d38('0x49')]==_0x6a503[_0x6d38('0x4a')]){if(!_[_0x6d38('0x18')](queues[_0x6a503[_0x6d38('0x4b')]])){utils[_0x6d38('0x3')](util['format'](_0x6d38('0x4c'),_0x6a503['origtransfereruniqueid'],queues[_0x6a503['secondtransfererlinkedid']]['name'],_0x6a503[_0x6d38('0x4d')]));queues[_0x6a503[_0x6d38('0x4b')]]['transfer']=!![];queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x4e')]='ATTENDED';queues[_0x6a503[_0x6d38('0x4b')]]['transferexten']=_0x6a503[_0x6d38('0x4d')];queues[_0x6a503['secondtransfererlinkedid']][_0x6d38('0x45')]=_0x6a503[_0x6d38('0x49')];queues[_0x6a503['secondtransfererlinkedid']][_0x6d38('0xa')]=_0x6d38('0x4f');}if(!_[_0x6d38('0x18')](queues[_0x6a503[_0x6d38('0x4a')]])){if(_0x6a503[_0x6d38('0x50')]&&queues[_0x6a503[_0x6d38('0x50')]]){queues[_0x6a503[_0x6d38('0x50')]][_0x6d38('0x21')]=0x1;queues[_0x6a503[_0x6d38('0x42')]]=_['clone'](queues[_0x6a503[_0x6d38('0x50')]]);queues[_0x6a503['transfereeuniqueid']][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x51')];queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x21')]=0x2;queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x52')]=queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x52')];queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x53')]=queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x53')];queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x54')]=utils[_0x6d38('0x15')]();queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x1a')]=utils[_0x6d38('0x15')]();queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x31')]=0x0;queues[_0x6a503['transfereeuniqueid']][_0x6d38('0x55')]=0x0;utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x56'),_0x6a503[_0x6d38('0x49')],queues[_0x6a503['transfereeuniqueid']]['name'],queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x52')],queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x53')]));}else{utils['info'](util[_0x6d38('0x4')](_0x6d38('0x57'),_0x6a503['origtransfereruniqueid'],queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x1f')],_0x6a503['secondtransfererlinkedid']));queues[_0x6a503['origtransfererlinkedid']][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x4b')];}}}else if(_0x6a503[_0x6d38('0x58')]==_0x6a503[_0x6d38('0x4b')]){if(!_['isNil'](queues[_0x6a503[_0x6d38('0x4a')]])){utils[_0x6d38('0x3')](util['format'](_0x6d38('0x59'),_0x6a503[_0x6d38('0x49')],queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x1f')],_0x6a503[_0x6d38('0x58')],_0x6a503[_0x6d38('0x5a')]));queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x3d')]=!![];queues[_0x6a503['origtransfererlinkedid']][_0x6d38('0x4e')]='ATTENDED';queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x44')]=_0x6a503[_0x6d38('0x5a')];queues[_0x6a503['origtransfererlinkedid']][_0x6d38('0x45')]=_0x6a503[_0x6d38('0x58')];queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x6d38('0x18')](queues[_0x6a503[_0x6d38('0x4b')]])){if(_0x6a503[_0x6d38('0x5b')]&&queues[_0x6a503[_0x6d38('0x5b')]]){queues[_0x6a503[_0x6d38('0x5b')]][_0x6d38('0x21')]=0x1;queues[_0x6a503['transfertargetuniqueid']]=_['clone'](queues[_0x6a503[_0x6d38('0x5b')]]);queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x51')];queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x21')]=0x2;queues[_0x6a503['transfertargetuniqueid']][_0x6d38('0x52')]=queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x52')];queues[_0x6a503['transfertargetuniqueid']][_0x6d38('0x53')]=queues[_0x6a503[_0x6d38('0x4a')]]['calleridname'];queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x54')]=utils[_0x6d38('0x15')]();queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x1a')]=utils['now']();queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x31')]=0x0;queues[_0x6a503[_0x6d38('0x51')]]['mohtime']=0x0;utils[_0x6d38('0x3')](util['format'](_0x6d38('0x5c'),_0x6a503['origtransfereruniqueid'],queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x1f')],queues[_0x6a503['transfertargetuniqueid']][_0x6d38('0x10')],queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x52')],queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x53')]));}else{utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x6a503[_0x6d38('0x49')],queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x1f')],_0x6a503[_0x6d38('0x4a')]));queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x4a')];}}}}catch(_0x404284){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x48'),_0x6a503[_0x6d38('0x49')]),_0x404284);}};exports[_0x6d38('0x5d')]=function(_0x480ab9){try{if(!_[_0x6d38('0x18')](queues[_0x480ab9[_0x6d38('0x5')]])){utils['debug'](util[_0x6d38('0x4')](_0x6d38('0x5e'),_0x480ab9['uniqueid']),_0x480ab9);queues[_0x480ab9[_0x6d38('0x5')]]['musiconholdstartAt']=utils[_0x6d38('0x15')]();utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x480ab9[_0x6d38('0x5')],queues[_0x480ab9[_0x6d38('0x5')]][_0x6d38('0x1f')],queues[_0x480ab9['uniqueid']][_0x6d38('0x5f')]));}}catch(_0x532a50){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x5e'),_0x480ab9[_0x6d38('0x5')]),_0x532a50);}};exports[_0x6d38('0x60')]=function(_0x452260){try{if(!_[_0x6d38('0x18')](queues[_0x452260['uniqueid']])){if(!_[_0x6d38('0x18')](queues[_0x452260[_0x6d38('0x5')]][_0x6d38('0x5f')])){utils[_0x6d38('0x19')](util[_0x6d38('0x4')]('[%s][queues][musiconholdstop]',_0x452260[_0x6d38('0x5')]),_0x452260);queues[_0x452260[_0x6d38('0x5')]]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x452260['uniqueid']][_0x6d38('0x5f')]);utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x61'),_0x452260['uniqueid'],queues[_0x452260[_0x6d38('0x5')]][_0x6d38('0x1f')],queues[_0x452260[_0x6d38('0x5')]]['mohtime']));delete queues[_0x452260[_0x6d38('0x5')]][_0x6d38('0x5f')];}}}catch(_0x309b28){utils[_0x6d38('0x16')](util['format']('[%s][queues][musiconholdstop]',_0x452260[_0x6d38('0x5')]),_0x309b28);}}; \ No newline at end of file +var _0x1267=['isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','COMPLETEDBYAGENT','name','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','position','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','hangup'];(function(_0x1b5328,_0x5a359e){var _0x2fde32=function(_0x59864a){while(--_0x59864a){_0x1b5328['push'](_0x1b5328['shift']());}};_0x2fde32(++_0x5a359e);}(_0x1267,0xb5));var _0x7126=function(_0x246967,_0x11dd9a){_0x246967=_0x246967-0x0;var _0x239faa=_0x1267[_0x246967];return _0x239faa;};'use strict';var _=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4c4304){utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x4'),_0x4c4304[_0x7126('0x5')],_0x4c4304[_0x7126('0x6')],_0x4c4304[_0x7126('0x7')],_0x4c4304[_0x7126('0x8')],_0x4c4304['calleridnum'],_0x4c4304[_0x7126('0x9')],_0x4c4304[_0x7126('0xa')]));if(_0x4c4304[_0x7126('0x7')]){utils[_0x7126('0xb')](_0x4c4304['queue'])[_0x7126('0xc')](function(_0x4f1e7f){if(_0x4f1e7f){_0x4c4304[_0x7126('0xd')]=_0x4f1e7f['type'];}utils[_0x7126('0xe')](_0x7126('0xf'),_0x4c4304);});}else{utils[_0x7126('0xe')](_0x7126('0xf'),_0x4c4304);}if(_0x4c4304[_0x7126('0x10')]){delete queues[_0x4c4304['transfereduniqueid']];}else{delete queues[_0x4c4304['uniqueid']];}}exports[_0x7126('0x11')]=function(_0x397339){try{utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x13'),_0x397339[_0x7126('0x5')]),_0x397339);utils['info'](util['format'](_0x7126('0x14'),_0x397339[_0x7126('0x5')],_0x397339['queue'],_0x397339['position']));queues[_0x397339[_0x7126('0x5')]]=_[_0x7126('0x15')](_0x397339,{'originalposition':_0x397339['position'],'queuecallerjoinAt':utils[_0x7126('0x16')](),'mohtime':0x0});}catch(_0x52866f){utils[_0x7126('0x17')](util[_0x7126('0x3')]('[%s][queues][queuecallerjoin]',_0x397339['uniqueid']),_0x52866f);}};exports[_0x7126('0x18')]=function(_0x4bd126){try{if(!_[_0x7126('0x19')](queues[_0x4bd126[_0x7126('0x5')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x1a'),_0x4bd126[_0x7126('0x5')]),_0x4bd126);if(queues[_0x4bd126[_0x7126('0x5')]]['queuecallerleaveAt']){if(!queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x1b')]&&!queues[_0x4bd126['uniqueid']][_0x7126('0x1c')]){queues[_0x4bd126[_0x7126('0x5')]]['queuecallercomplete']=!![];queues[_0x4bd126[_0x7126('0x5')]]['queuecallercompleteAt']=utils['now']();queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0xa')]=_0x7126('0x1d');}utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4bd126[_0x7126('0x5')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x1e')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0xa')]));writeDB(queues[_0x4bd126[_0x7126('0x5')]]);}else if(queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x10')]){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4bd126[_0x7126('0x5')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x1e')],queues[_0x4bd126[_0x7126('0x5')]][_0x7126('0x10')]));queues[queues[_0x4bd126[_0x7126('0x5')]]['transfereduniqueid']]=queues[_0x4bd126[_0x7126('0x5')]];queues[queues[_0x4bd126['uniqueid']][_0x7126('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x4bd126[_0x7126('0x5')]];}}}catch(_0x15b2bb){utils[_0x7126('0x17')](util['format']('[%s][queues][hangup]',_0x4bd126['uniqueid']),_0x15b2bb);}};exports[_0x7126('0x1f')]=function(_0x4a74c4){try{utils['debug'](util[_0x7126('0x3')](_0x7126('0x20'),_0x4a74c4[_0x7126('0x5')]),_0x4a74c4);if(!_[_0x7126('0x19')](_0x4a74c4[_0x7126('0x21')][_0x7126('0x22')])&&_0x4a74c4[_0x7126('0x23')]['toUpperCase']()!==_0x7126('0x24')){if(!_['isNil'](queues[_0x4a74c4['uniqueid']])){queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x25')]=null;queues[_0x4a74c4['uniqueid']][_0x7126('0x1c')]=!![];queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x26')]=utils['now']();queues[_0x4a74c4['uniqueid']][_0x7126('0xa')]=_0x4a74c4[_0x7126('0x23')][_0x7126('0x27')]();utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4a74c4[_0x7126('0x5')],queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x1e')],_0x4a74c4[_0x7126('0x23')],queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4a74c4['uniqueid']]);}}else if(!_[_0x7126('0x19')](_0x4a74c4[_0x7126('0x21')][_0x7126('0x28')])){if(!_[_0x7126('0x19')](queues[_0x4a74c4[_0x7126('0x5')]])&&!queues[_0x4a74c4['uniqueid']][_0x7126('0x1b')]){queues[_0x4a74c4['uniqueid']][_0x7126('0x1b')]=![];queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerabandonAt']=null;queues[_0x4a74c4[_0x7126('0x5')]][_0x7126('0x1c')]=!![];queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerexitAt']=utils[_0x7126('0x16')]();queues[_0x4a74c4[_0x7126('0x5')]]['queuecallerexitreason']=_0x7126('0x29');utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4a74c4[_0x7126('0x5')],queues[_0x4a74c4['uniqueid']][_0x7126('0x1e')],_0x4a74c4[_0x7126('0x23')],queues[_0x4a74c4['uniqueid']][_0x7126('0xa')]));}}}catch(_0x153c44){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x20'),_0x4a74c4[_0x7126('0x5')]),_0x153c44);}};exports[_0x7126('0x1b')]=function(_0x59d293){try{if(!_[_0x7126('0x19')](queues[_0x59d293[_0x7126('0x5')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x2a'),_0x59d293[_0x7126('0x5')]),_0x59d293);queues[_0x59d293[_0x7126('0x5')]][_0x7126('0x1c')]=![];queues[_0x59d293[_0x7126('0x5')]][_0x7126('0x26')]=null;queues[_0x59d293[_0x7126('0x5')]]['queuecallerabandon']=!![];queues[_0x59d293[_0x7126('0x5')]][_0x7126('0x25')]=utils[_0x7126('0x16')]();queues[_0x59d293[_0x7126('0x5')]][_0x7126('0xa')]=_0x7126('0x2b');utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x59d293[_0x7126('0x5')],queues[_0x59d293['uniqueid']][_0x7126('0x1e')],queues[_0x59d293[_0x7126('0x5')]][_0x7126('0xa')]));}}catch(_0xf825d9){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x2a'),_0x59d293['uniqueid']),_0xf825d9);}};exports[_0x7126('0x2c')]=function(_0x2371de){try{if(!_[_0x7126('0x19')](queues[_0x2371de['uniqueid']])){utils[_0x7126('0x12')](util[_0x7126('0x3')]('[%s][queues][queuecallerleave]',_0x2371de[_0x7126('0x5')]),_0x2371de);utils[_0x7126('0x2')](util['format'](_0x7126('0x2d'),_0x2371de[_0x7126('0x5')],queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x1e')],_0x2371de[_0x7126('0x2e')],_0x2371de[_0x7126('0x2f')]));queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x2c')]=!![];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x30')]=utils[_0x7126('0x16')]();queues[_0x2371de[_0x7126('0x5')]]['holdtime']=utils[_0x7126('0x31')](queues[_0x2371de[_0x7126('0x5')]]['queuecallerleaveAt'],queues[_0x2371de[_0x7126('0x5')]]['queuecallerjoinAt']);queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x32')]=_0x2371de[_0x7126('0x32')];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x33')]=_0x2371de[_0x7126('0x33')];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x2e')]=_0x2371de[_0x7126('0x2e')];queues[_0x2371de[_0x7126('0x5')]][_0x7126('0x2f')]=_0x2371de[_0x7126('0x2f')];}}catch(_0x17e123){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x34'),_0x2371de[_0x7126('0x5')]),_0x17e123);}};exports['agentconnect']=function(_0x5b443f){try{if(!_[_0x7126('0x19')](queues[_0x5b443f['uniqueid']])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x35'),_0x5b443f['uniqueid']),_0x5b443f);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5b443f[_0x7126('0x5')],queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1e')],_0x5b443f[_0x7126('0x36')],_0x5b443f[_0x7126('0x37')]));queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0x5b443f['uniqueid']][_0x7126('0x25')]=null;queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x1c')]=![];queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0xa')]=null;queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x26')]=null;queues[_0x5b443f['uniqueid']][_0x7126('0x38')]=!![];queues[_0x5b443f['uniqueid']]['accountcode']=_0x5b443f[_0x7126('0x37')];queues[_0x5b443f[_0x7126('0x5')]][_0x7126('0x8')]=_0x5b443f[_0x7126('0x36')];}}catch(_0x2d59d6){utils['error'](util[_0x7126('0x3')](_0x7126('0x35'),_0x5b443f[_0x7126('0x5')]),_0x2d59d6);}};exports[_0x7126('0x39')]=function(_0xdcc04b){try{if(!_[_0x7126('0x19')](queues[_0xdcc04b['uniqueid']])){if(queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x30')]){utils['debug'](util[_0x7126('0x3')](_0x7126('0x3a'),_0xdcc04b[_0x7126('0x5')]),_0xdcc04b);queues[_0xdcc04b[_0x7126('0x5')]]['queuecallerabandon']=![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x1b')]=![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x25')]=null;queues[_0xdcc04b['uniqueid']][_0x7126('0x1c')]=![];queues[_0xdcc04b['uniqueid']][_0x7126('0x26')]=null;queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x38')]=!![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x8')]=_0xdcc04b[_0x7126('0x36')];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x3b')]=!![];queues[_0xdcc04b[_0x7126('0x5')]][_0x7126('0x3c')]=utils[_0x7126('0x16')]();if(_0xdcc04b[_0x7126('0x3d')]=='transfer'){if(!queues[_0xdcc04b['uniqueid']][_0x7126('0x3e')]){queues[_0xdcc04b[_0x7126('0x5')]]['queuecallerexitreason']=_0x7126('0x3f');}}else{queues[_0xdcc04b['uniqueid']][_0x7126('0xa')]='COMPLETEDBY'+_0xdcc04b[_0x7126('0x3d')][_0x7126('0x27')]();}utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xdcc04b[_0x7126('0x5')],queues[_0xdcc04b[_0x7126('0x5')]]['name'],_0xdcc04b[_0x7126('0x36')],queues[_0xdcc04b[_0x7126('0x5')]]['queuecallerexitreason']));writeDB(queues[_0xdcc04b[_0x7126('0x5')]]);}}}catch(_0x110beb){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x3a'),_0xdcc04b['uniqueid']),_0x110beb);}};exports['blindtransfer']=function(_0x5d1e5d){try{if(!_['isNil'](queues[_0x5d1e5d[_0x7126('0x40')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')]('[%s][queues][blindtransfer]',_0x5d1e5d[_0x7126('0x5')]),_0x5d1e5d);queues[_0x5d1e5d['transfereeuniqueid']][_0x7126('0x3e')]=!![];queues[_0x5d1e5d[_0x7126('0x40')]][_0x7126('0x41')]=_0x7126('0x42');queues[_0x5d1e5d['transfereeuniqueid']][_0x7126('0x43')]=_0x5d1e5d['extension'];queues[_0x5d1e5d[_0x7126('0x40')]][_0x7126('0x44')]=_0x5d1e5d[_0x7126('0x40')];queues[_0x5d1e5d['transfereeuniqueid']][_0x7126('0xa')]=_0x7126('0x45');utils[_0x7126('0x2')](util['format'](_0x7126('0x46'),_0x5d1e5d[_0x7126('0x5')],queues[_0x5d1e5d[_0x7126('0x40')]][_0x7126('0x1e')],_0x5d1e5d['transfereeuniqueid'],_0x5d1e5d['extension']));}}catch(_0x549671){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x47'),_0x5d1e5d[_0x7126('0x5')]),_0x549671);}};exports[_0x7126('0x48')]=function(_0xa991d1){try{utils[_0x7126('0x12')](util[_0x7126('0x3')]('[%s][queues][attendedtransfer]',_0xa991d1[_0x7126('0x49')]),_0xa991d1);if(_0xa991d1[_0x7126('0x49')]==_0xa991d1[_0x7126('0x4a')]){if(!_['isNil'](queues[_0xa991d1[_0x7126('0x4b')]])){utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x4c'),_0xa991d1[_0x7126('0x49')],queues[_0xa991d1[_0x7126('0x4b')]][_0x7126('0x1e')],_0xa991d1[_0x7126('0x4d')]));queues[_0xa991d1['secondtransfererlinkedid']]['transfer']=!![];queues[_0xa991d1[_0x7126('0x4b')]][_0x7126('0x41')]=_0x7126('0x4e');queues[_0xa991d1['secondtransfererlinkedid']]['transferexten']=_0xa991d1[_0x7126('0x4d')];queues[_0xa991d1[_0x7126('0x4b')]]['transferuniqueid']=_0xa991d1[_0x7126('0x49')];queues[_0xa991d1[_0x7126('0x4b')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x7126('0x19')](queues[_0xa991d1['origtransfererlinkedid']])){if(_0xa991d1['transfereelinkedid']&&queues[_0xa991d1[_0x7126('0x4f')]]){queues[_0xa991d1['transfereelinkedid']][_0x7126('0x50')]=0x1;queues[_0xa991d1[_0x7126('0x40')]]=_[_0x7126('0x51')](queues[_0xa991d1['transfereelinkedid']]);queues[_0xa991d1[_0x7126('0x40')]]['transfereduniqueid']=_0xa991d1[_0x7126('0x52')];queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x50')]=0x2;queues[_0xa991d1['transfereeuniqueid']][_0x7126('0x53')]=queues[_0xa991d1['secondtransfererlinkedid']][_0x7126('0x53')];queues[_0xa991d1[_0x7126('0x40')]]['calleridname']=queues[_0xa991d1[_0x7126('0x4b')]][_0x7126('0x54')];queues[_0xa991d1['transfereeuniqueid']][_0x7126('0x55')]=utils[_0x7126('0x16')]();queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x30')]=utils['now']();queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x56')]=0x0;queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x57')]=0x0;utils['info'](util[_0x7126('0x3')](_0x7126('0x58'),_0xa991d1[_0x7126('0x49')],queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x1e')],queues[_0xa991d1[_0x7126('0x40')]][_0x7126('0x53')],queues[_0xa991d1['transfereeuniqueid']][_0x7126('0x54')]));}else{utils[_0x7126('0x2')](util[_0x7126('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xa991d1['origtransfereruniqueid'],queues[_0xa991d1[_0x7126('0x4a')]][_0x7126('0x1e')],_0xa991d1[_0x7126('0x4b')]));queues[_0xa991d1[_0x7126('0x4a')]]['transfereduniqueid']=_0xa991d1['secondtransfererlinkedid'];}}}else if(_0xa991d1[_0x7126('0x59')]==_0xa991d1['secondtransfererlinkedid']){if(!_[_0x7126('0x19')](queues[_0xa991d1[_0x7126('0x4a')]])){utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x5a'),_0xa991d1['origtransfereruniqueid'],queues[_0xa991d1[_0x7126('0x4a')]]['name'],_0xa991d1[_0x7126('0x59')],_0xa991d1[_0x7126('0x5b')]));queues[_0xa991d1['origtransfererlinkedid']][_0x7126('0x3e')]=!![];queues[_0xa991d1[_0x7126('0x4a')]]['transfertype']=_0x7126('0x4e');queues[_0xa991d1['origtransfererlinkedid']][_0x7126('0x43')]=_0xa991d1[_0x7126('0x5b')];queues[_0xa991d1['origtransfererlinkedid']][_0x7126('0x44')]=_0xa991d1[_0x7126('0x59')];queues[_0xa991d1[_0x7126('0x4a')]]['queuecallerexitreason']=_0x7126('0x5c');}if(!_[_0x7126('0x19')](queues[_0xa991d1['secondtransfererlinkedid']])){if(_0xa991d1[_0x7126('0x5d')]&&queues[_0xa991d1['transfertargetlinkedid']]){queues[_0xa991d1[_0x7126('0x5d')]][_0x7126('0x50')]=0x1;queues[_0xa991d1[_0x7126('0x52')]]=_['clone'](queues[_0xa991d1[_0x7126('0x5d')]]);queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x10')]=_0xa991d1[_0x7126('0x52')];queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x50')]=0x2;queues[_0xa991d1['transfertargetuniqueid']]['calleridnum']=queues[_0xa991d1[_0x7126('0x4a')]][_0x7126('0x53')];queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x54')]=queues[_0xa991d1[_0x7126('0x4a')]][_0x7126('0x54')];queues[_0xa991d1['transfertargetuniqueid']][_0x7126('0x55')]=utils[_0x7126('0x16')]();queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x30')]=utils[_0x7126('0x16')]();queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x56')]=0x0;queues[_0xa991d1['transfertargetuniqueid']][_0x7126('0x57')]=0x0;utils[_0x7126('0x2')](util[_0x7126('0x3')](_0x7126('0x5e'),_0xa991d1[_0x7126('0x49')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x1e')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x10')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x53')],queues[_0xa991d1[_0x7126('0x52')]][_0x7126('0x54')]));}else{utils[_0x7126('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xa991d1['origtransfereruniqueid'],queues[_0xa991d1[_0x7126('0x4b')]]['name'],_0xa991d1['origtransfererlinkedid']));queues[_0xa991d1['secondtransfererlinkedid']][_0x7126('0x10')]=_0xa991d1[_0x7126('0x4a')];}}}}catch(_0x2e5169){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x5f'),_0xa991d1[_0x7126('0x49')]),_0x2e5169);}};exports[_0x7126('0x60')]=function(_0x44a638){try{if(!_[_0x7126('0x19')](queues[_0x44a638[_0x7126('0x5')]])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x61'),_0x44a638[_0x7126('0x5')]),_0x44a638);queues[_0x44a638[_0x7126('0x5')]][_0x7126('0x62')]=utils[_0x7126('0x16')]();utils['info'](util[_0x7126('0x3')](_0x7126('0x63'),_0x44a638[_0x7126('0x5')],queues[_0x44a638['uniqueid']]['name'],queues[_0x44a638[_0x7126('0x5')]]['musiconholdstartAt']));}}catch(_0x5dd0bf){utils[_0x7126('0x17')](util[_0x7126('0x3')](_0x7126('0x61'),_0x44a638[_0x7126('0x5')]),_0x5dd0bf);}};exports[_0x7126('0x64')]=function(_0x30993a){try{if(!_[_0x7126('0x19')](queues[_0x30993a[_0x7126('0x5')]])){if(!_[_0x7126('0x19')](queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x62')])){utils[_0x7126('0x12')](util[_0x7126('0x3')](_0x7126('0x65'),_0x30993a[_0x7126('0x5')]),_0x30993a);queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x57')]+=utils['diffTime'](utils[_0x7126('0x16')](),queues[_0x30993a[_0x7126('0x5')]]['musiconholdstartAt']);utils[_0x7126('0x2')](util['format'](_0x7126('0x66'),_0x30993a[_0x7126('0x5')],queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x1e')],queues[_0x30993a['uniqueid']][_0x7126('0x57')]));delete queues[_0x30993a[_0x7126('0x5')]][_0x7126('0x62')];}}}catch(_0x471457){utils['error'](util[_0x7126('0x3')]('[%s][queues][musiconholdstop]',_0x30993a[_0x7126('0x5')]),_0x471457);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 54d6d6b..805d34c 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 _0x057f=['[%s][recordings][queuecallerjoin]','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','monitors','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin'];(function(_0x5f5cb0,_0x55fd38){var _0x3dfe42=function(_0x8eb5be){while(--_0x8eb5be){_0x5f5cb0['push'](_0x5f5cb0['shift']());}};_0x3dfe42(++_0x55fd38);}(_0x057f,0x1d7));var _0xf057=function(_0x1c46b1,_0x1c02b1){_0x1c46b1=_0x1c46b1-0x0;var _0x36741d=_0x057f[_0x1c46b1];return _0x36741d;};'use strict';var _=require(_0xf057('0x0'));var util=require('util');var utils=require(_0xf057('0x1'));var recordings={};function writeDB(_0x12e6e0){utils[_0xf057('0x2')](util['format'](_0xf057('0x3'),_0x12e6e0[_0xf057('0x4')]));if(_0x12e6e0[_0xf057('0x5')]){utils[_0xf057('0x6')](_0x12e6e0[_0xf057('0x5')])[_0xf057('0x7')](function(_0x42f720){if(_0x42f720){_0x12e6e0[_0xf057('0x8')]=_0x42f720[_0xf057('0x9')];_0x12e6e0[_0xf057('0xa')]=_0x42f720['id'];}utils[_0xf057('0xb')](_0xf057('0xc'),_0x12e6e0);});}else{utils['request']('CreateVoiceRecording',_0x12e6e0);}}exports[_0xf057('0xd')]=function(_0x450855){try{utils['debug'](util[_0xf057('0xe')]('[%s][recordings][newchannel]',_0x450855[_0xf057('0x4')]),_0x450855);if(_0x450855[_0xf057('0x4')]==_0x450855[_0xf057('0xf')]){utils[_0xf057('0x2')](util['format'](_0xf057('0x10'),_0x450855[_0xf057('0x4')],_0x450855[_0xf057('0x11')],_0x450855[_0xf057('0x12')]));recordings[_0x450855['uniqueid']]={'uniqueid':_0x450855[_0xf057('0x4')],'accountcode':_0x450855['accountcode'],'exten':_0x450855[_0xf057('0x12')],'context':_0x450855['context'],'channel':_0x450855[_0xf057('0x13')],'monitors':[]};}}catch(_0x7aedae){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x15'),_0x450855[_0xf057('0x4')]),_0x7aedae);}};exports[_0xf057('0x16')]=function(_0x2d69f3){try{utils['debug'](util[_0xf057('0xe')]('[%s][recordings][newstate]',_0x2d69f3[_0xf057('0x4')]),_0x2d69f3);if(!_[_0xf057('0x17')](recordings[_0x2d69f3['uniqueid']])&&_0x2d69f3[_0xf057('0x18')]==0x6){utils[_0xf057('0x2')](util[_0xf057('0xe')](_0xf057('0x19'),_0x2d69f3[_0xf057('0x4')],_0x2d69f3[_0xf057('0x11')],_0x2d69f3['channel']));}else if(!_[_0xf057('0x17')](recordings[_0x2d69f3['linkedid']])&&_0x2d69f3[_0xf057('0x18')]==0x6&&_0x2d69f3[_0xf057('0x11')]!=_0xf057('0x1a')){utils['info'](util[_0xf057('0xe')](_0xf057('0x1b'),_0x2d69f3[_0xf057('0x4')],_0x2d69f3[_0xf057('0xf')],_0x2d69f3[_0xf057('0x11')],_0x2d69f3['channel']));recordings[_0x2d69f3[_0xf057('0xf')]][_0xf057('0x5')]=_0x2d69f3[_0xf057('0x5')];}}catch(_0x2494b0){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x1c'),_0x2d69f3[_0xf057('0x4')]),_0x2494b0);}};exports[_0xf057('0x1d')]=function(_0xc17f67){try{if(!_[_0xf057('0x17')](_0xc17f67[_0xf057('0x1e')])&&!_[_0xf057('0x17')](_0xc17f67[_0xf057('0x1e')][_0xf057('0x1f')])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x21'),_0xc17f67[_0xf057('0x4')]),_0xc17f67);utils['info'](util[_0xf057('0xe')](_0xf057('0x22'),_0xc17f67['uniqueid'],_0xc17f67['variable'],_0xc17f67[_0xf057('0x23')]));if(_[_0xf057('0x24')](_0xc17f67[_0xf057('0x23')],'.wav49')){_0xc17f67[_0xf057('0x23')]=_0xc17f67[_0xf057('0x23')][_0xf057('0x25')](_0xf057('0x26'),_0xf057('0x27'));}if(recordings[_0xc17f67['linkedid']]){var _0x5ef52c=_['find'](recordings[_0xc17f67[_0xf057('0xf')]]['monitors'],{'value':_0xc17f67[_0xf057('0x23')]});if(_[_0xf057('0x17')](_0x5ef52c)){recordings[_0xc17f67[_0xf057('0xf')]]['monitors'][_0xf057('0x28')]({'value':_0xc17f67[_0xf057('0x23')]});}}}}catch(_0x18908b){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x21'),_0xc17f67[_0xf057('0x4')]),_0x18908b);}};exports[_0xf057('0x29')]=function(_0x3311be){try{if(!_[_0xf057('0x17')](recordings[_0x3311be[_0xf057('0x4')]])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x2a'),_0x3311be['uniqueid']),_0x3311be);utils[_0xf057('0x2')](util['format'](_0xf057('0x2b'),_0x3311be[_0xf057('0x4')],_0x3311be[_0xf057('0x2c')],_0x3311be[_0xf057('0x2d')],_0x3311be[_0xf057('0x2e')]));recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x2c')]=_0x3311be[_0xf057('0x2c')];recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x2d')]=_0x3311be[_0xf057('0x2d')];recordings[_0x3311be[_0xf057('0x4')]]['connectedlinenum']=_0x3311be[_0xf057('0x2f')];recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x30')]=_0x3311be[_0xf057('0x30')];if(recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x31')]=='outbound'&&recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x5')]){recordings[_0x3311be[_0xf057('0x4')]]['connectedlinenum']=recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x5')];recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x30')]='';}recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x32')][_0xf057('0x33')](function(_0x18ec77){var _0x46a981=_[_0xf057('0x34')](recordings[_0x3311be[_0xf057('0x4')]]);_0x46a981[_0xf057('0x23')]=_0x18ec77[_0xf057('0x23')];writeDB(_0x46a981);});delete recordings[_0x3311be[_0xf057('0x4')]];}}catch(_0x1cd3fd){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x2a'),_0x3311be[_0xf057('0x4')]),_0x1cd3fd);}};exports[_0xf057('0x35')]=function(_0x29e8d1){try{if(!_['isNil'](recordings[_0x29e8d1[_0xf057('0x4')]])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x36'),_0x29e8d1['uniqueid']),_0x29e8d1);utils['info'](util[_0xf057('0xe')](_0xf057('0x37'),_0x29e8d1[_0xf057('0x4')],_0x29e8d1[_0xf057('0x38')],_0x29e8d1[_0xf057('0x39')]));if(_0x29e8d1[_0xf057('0x38')][_0xf057('0x3a')]()==_0xf057('0x3b')&&_[_0xf057('0x3c')](_0x29e8d1['appdata']['toLowerCase'](),'cdr')){var _0x5cde20=_0x29e8d1[_0xf057('0x39')][_0xf057('0x3d')]('=');var _0x54bbc7=_0x5cde20[0x0][_0xf057('0x3e')](_0x5cde20[0x0]['lastIndexOf']('(')+0x1,_0x5cde20[0x0][_0xf057('0x3f')](')'));var _0x363890=_0x5cde20[0x1];recordings[_0x29e8d1[_0xf057('0x4')]][_0x54bbc7]=_0x363890;}}}catch(_0x2b578c){utils['error'](util[_0xf057('0xe')](_0xf057('0x36'),_0x29e8d1['uniqueid']),_0x2b578c);}};exports[_0xf057('0x40')]=function(_0x328e92){try{if(!_[_0xf057('0x17')](recordings[_0x328e92[_0xf057('0x4')]])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x41'),_0x328e92[_0xf057('0x4')]),_0x328e92);utils[_0xf057('0x2')](util[_0xf057('0xe')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x328e92[_0xf057('0x4')],_0x328e92['queue']));recordings[_0x328e92[_0xf057('0x4')]][_0xf057('0x42')]=_0x328e92[_0xf057('0x42')];}}catch(_0x2ccbd6){utils[_0xf057('0x14')](util['format'](_0xf057('0x41'),_0x328e92[_0xf057('0x4')]),_0x2ccbd6);}}; \ No newline at end of file +var _0x6cc0=['substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','hangup','calleridname','cause-txt','calleridnum','connectedlinename','type','outbound','connectedlinenum','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x6cc0,0x1d5));var _0x06cc=function(_0x53f9bb,_0x4733a5){_0x53f9bb=_0x53f9bb-0x0;var _0x26351c=_0x6cc0[_0x53f9bb];return _0x26351c;};'use strict';var _=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var utils=require(_0x06cc('0x2'));var recordings={};function writeDB(_0x49b018){utils[_0x06cc('0x3')](util[_0x06cc('0x4')](_0x06cc('0x5'),_0x49b018[_0x06cc('0x6')]));if(_0x49b018['accountcode']){utils[_0x06cc('0x7')](_0x49b018[_0x06cc('0x8')])['then'](function(_0x38b206){if(_0x38b206){_0x49b018[_0x06cc('0x9')]=_0x38b206[_0x06cc('0xa')];_0x49b018[_0x06cc('0xb')]=_0x38b206['id'];}utils['request'](_0x06cc('0xc'),_0x49b018);});}else{utils[_0x06cc('0xd')](_0x06cc('0xc'),_0x49b018);}}exports[_0x06cc('0xe')]=function(_0x40c238){try{utils[_0x06cc('0xf')](util[_0x06cc('0x4')](_0x06cc('0x10'),_0x40c238['uniqueid']),_0x40c238);if(_0x40c238[_0x06cc('0x6')]==_0x40c238[_0x06cc('0x11')]){utils[_0x06cc('0x3')](util['format'](_0x06cc('0x12'),_0x40c238[_0x06cc('0x6')],_0x40c238[_0x06cc('0x13')],_0x40c238[_0x06cc('0x14')]));recordings[_0x40c238['uniqueid']]={'uniqueid':_0x40c238[_0x06cc('0x6')],'accountcode':_0x40c238[_0x06cc('0x8')],'exten':_0x40c238[_0x06cc('0x14')],'context':_0x40c238[_0x06cc('0x13')],'channel':_0x40c238[_0x06cc('0x15')],'monitors':[]};}}catch(_0x1c4898){utils[_0x06cc('0x16')](util[_0x06cc('0x4')](_0x06cc('0x10'),_0x40c238['uniqueid']),_0x1c4898);}};exports[_0x06cc('0x17')]=function(_0x298a88){try{utils[_0x06cc('0xf')](util['format'](_0x06cc('0x18'),_0x298a88[_0x06cc('0x6')]),_0x298a88);if(!_[_0x06cc('0x19')](recordings[_0x298a88[_0x06cc('0x6')]])&&_0x298a88[_0x06cc('0x1a')]==0x6){utils[_0x06cc('0x3')](util['format'](_0x06cc('0x1b'),_0x298a88[_0x06cc('0x6')],_0x298a88[_0x06cc('0x13')],_0x298a88['channel']));}else if(!_[_0x06cc('0x19')](recordings[_0x298a88['linkedid']])&&_0x298a88[_0x06cc('0x1a')]==0x6&&_0x298a88[_0x06cc('0x13')]!=_0x06cc('0x1c')){utils[_0x06cc('0x3')](util[_0x06cc('0x4')](_0x06cc('0x1d'),_0x298a88['uniqueid'],_0x298a88[_0x06cc('0x11')],_0x298a88[_0x06cc('0x13')],_0x298a88['channel']));recordings[_0x298a88[_0x06cc('0x11')]][_0x06cc('0x8')]=_0x298a88[_0x06cc('0x8')];}}catch(_0x1e9080){utils[_0x06cc('0x16')](util[_0x06cc('0x4')]('[%s][recordings][newstate]',_0x298a88[_0x06cc('0x6')]),_0x1e9080);}};exports['varset']=function(_0x16d8db){try{if(!_['isNil'](_0x16d8db[_0x06cc('0x1e')])&&!_['isNil'](_0x16d8db[_0x06cc('0x1e')][_0x06cc('0x1f')])){utils[_0x06cc('0xf')](util[_0x06cc('0x4')](_0x06cc('0x20'),_0x16d8db[_0x06cc('0x6')]),_0x16d8db);utils[_0x06cc('0x3')](util['format'](_0x06cc('0x21'),_0x16d8db[_0x06cc('0x6')],_0x16d8db['variable'],_0x16d8db[_0x06cc('0x22')]));if(_[_0x06cc('0x23')](_0x16d8db[_0x06cc('0x22')],'.wav49')){_0x16d8db[_0x06cc('0x22')]=_0x16d8db[_0x06cc('0x22')]['replace'](_0x06cc('0x24'),_0x06cc('0x25'));}if(recordings[_0x16d8db[_0x06cc('0x11')]]){var _0x4e3e6a=_[_0x06cc('0x26')](recordings[_0x16d8db[_0x06cc('0x11')]][_0x06cc('0x27')],{'value':_0x16d8db[_0x06cc('0x22')]});if(_[_0x06cc('0x19')](_0x4e3e6a)){recordings[_0x16d8db['linkedid']][_0x06cc('0x27')][_0x06cc('0x28')]({'value':_0x16d8db[_0x06cc('0x22')]});}}}}catch(_0x17092a){utils[_0x06cc('0x16')](util[_0x06cc('0x4')](_0x06cc('0x20'),_0x16d8db[_0x06cc('0x6')]),_0x17092a);}};exports[_0x06cc('0x29')]=function(_0xf63258){try{if(!_[_0x06cc('0x19')](recordings[_0xf63258[_0x06cc('0x6')]])){utils[_0x06cc('0xf')](util['format']('[%s][recordings][hangup]',_0xf63258[_0x06cc('0x6')]),_0xf63258);utils[_0x06cc('0x3')](util[_0x06cc('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xf63258['uniqueid'],_0xf63258['calleridnum'],_0xf63258[_0x06cc('0x2a')],_0xf63258[_0x06cc('0x2b')]));recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x2c')]=_0xf63258['calleridnum'];recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x2a')]=_0xf63258[_0x06cc('0x2a')];recordings[_0xf63258[_0x06cc('0x6')]]['connectedlinenum']=_0xf63258['connectedlinenum'];recordings[_0xf63258['uniqueid']][_0x06cc('0x2d')]=_0xf63258[_0x06cc('0x2d')];if(recordings[_0xf63258['uniqueid']][_0x06cc('0x2e')]==_0x06cc('0x2f')&&recordings[_0xf63258['uniqueid']]['accountcode']){recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x30')]=recordings[_0xf63258[_0x06cc('0x6')]][_0x06cc('0x8')];recordings[_0xf63258['uniqueid']][_0x06cc('0x2d')]='';}recordings[_0xf63258[_0x06cc('0x6')]]['monitors'][_0x06cc('0x31')](function(_0x354e8e){var _0x468b2d=_[_0x06cc('0x32')](recordings[_0xf63258[_0x06cc('0x6')]]);_0x468b2d[_0x06cc('0x22')]=_0x354e8e['value'];writeDB(_0x468b2d);});delete recordings[_0xf63258[_0x06cc('0x6')]];}}catch(_0x366129){utils[_0x06cc('0x16')](util['format'](_0x06cc('0x33'),_0xf63258[_0x06cc('0x6')]),_0x366129);}};exports[_0x06cc('0x34')]=function(_0x18f3bd){try{if(!_[_0x06cc('0x19')](recordings[_0x18f3bd['uniqueid']])){utils[_0x06cc('0xf')](util[_0x06cc('0x4')]('[%s][recordings][newexten]',_0x18f3bd[_0x06cc('0x6')]),_0x18f3bd);utils['info'](util[_0x06cc('0x4')](_0x06cc('0x35'),_0x18f3bd[_0x06cc('0x6')],_0x18f3bd[_0x06cc('0x36')],_0x18f3bd[_0x06cc('0x37')]));if(_0x18f3bd['application'][_0x06cc('0x38')]()==_0x06cc('0x39')&&_['startsWith'](_0x18f3bd[_0x06cc('0x37')][_0x06cc('0x38')](),_0x06cc('0x3a'))){var _0x25fd7e=_0x18f3bd[_0x06cc('0x37')]['split']('=');var _0x8ed1af=_0x25fd7e[0x0][_0x06cc('0x3b')](_0x25fd7e[0x0][_0x06cc('0x3c')]('(')+0x1,_0x25fd7e[0x0][_0x06cc('0x3c')](')'));var _0x8eaaa8=_0x25fd7e[0x1];recordings[_0x18f3bd[_0x06cc('0x6')]][_0x8ed1af]=_0x8eaaa8;}}}catch(_0x15630a){utils[_0x06cc('0x16')](util['format'](_0x06cc('0x3d'),_0x18f3bd['uniqueid']),_0x15630a);}};exports[_0x06cc('0x3e')]=function(_0x4e9b41){try{if(!_['isNil'](recordings[_0x4e9b41[_0x06cc('0x6')]])){utils[_0x06cc('0xf')](util[_0x06cc('0x4')](_0x06cc('0x3f'),_0x4e9b41[_0x06cc('0x6')]),_0x4e9b41);utils[_0x06cc('0x3')](util[_0x06cc('0x4')](_0x06cc('0x40'),_0x4e9b41[_0x06cc('0x6')],_0x4e9b41['queue']));recordings[_0x4e9b41['uniqueid']][_0x06cc('0x41')]=_0x4e9b41[_0x06cc('0x41')];}}catch(_0x2a638f){utils[_0x06cc('0x16')](util[_0x06cc('0x4')](_0x06cc('0x3f'),_0x4e9b41[_0x06cc('0x6')]),_0x2a638f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 5761724..00f0d0f 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 _0x74f5=['transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinename'];(function(_0x52dd6e,_0x4c049c){var _0x4710b5=function(_0x22e40d){while(--_0x22e40d){_0x52dd6e['push'](_0x52dd6e['shift']());}};_0x4710b5(++_0x4c049c);}(_0x74f5,0x13b));var _0x574f=function(_0x1aa883,_0x50f53b){_0x1aa883=_0x1aa883-0x0;var _0x5e9fb5=_0x74f5[_0x1aa883];return _0x5e9fb5;};'use strict';var _=require(_0x574f('0x0'));var util=require(_0x574f('0x1'));var utils=require(_0x574f('0x2'));function writeDB(_0x4fb1ef){utils[_0x574f('0x3')](util['format'](_0x574f('0x4'),_0x4fb1ef[_0x574f('0x5')]===_0x574f('0x6')?_0x4fb1ef[_0x574f('0x7')]:_0x4fb1ef[_0x574f('0x8')],_0x4fb1ef[_0x574f('0x5')]));utils[_0x574f('0x9')](_0x574f('0xa'),_0x4fb1ef);}exports[_0x574f('0xb')]=function(_0x4ba867){try{utils[_0x574f('0xc')](util[_0x574f('0xd')](_0x574f('0xe'),_0x4ba867['uniqueid']),_0x4ba867);utils[_0x574f('0x3')](util[_0x574f('0xd')](_0x574f('0xf'),_0x4ba867[_0x574f('0x8')],_0x4ba867[_0x574f('0x10')],_0x4ba867['transferercalleridname'],_0x4ba867['transfereecalleridnum'],_0x4ba867['transfereecalleridname']));_0x4ba867[_0x574f('0x5')]=_0x574f('0x11');writeDB(_0x4ba867);}catch(_0x59ca99){utils[_0x574f('0x12')](util[_0x574f('0xd')](_0x574f('0xe'),_0x4ba867['uniqueid']),_0x59ca99);}};exports['attendedtransfer']=function(_0x21108d){try{utils[_0x574f('0xc')](util[_0x574f('0xd')](_0x574f('0x13'),_0x21108d[_0x574f('0x7')]),_0x21108d);utils[_0x574f('0x3')](util[_0x574f('0xd')](_0x574f('0x14'),_0x21108d[_0x574f('0x7')],_0x21108d[_0x574f('0x15')],_0x21108d[_0x574f('0x16')],_0x21108d[_0x574f('0x17')],_0x21108d[_0x574f('0x18')]));_0x21108d=_['assign'](_0x21108d,{'transfererchannel':_0x21108d['origtransfererchannel'],'transferercalleridnum':_0x21108d[_0x574f('0x15')],'transferercalleridname':_0x21108d['origtransferercalleridname'],'transfererconnectedlinenum':_0x21108d[_0x574f('0x19')],'transfererconnectedlinename':_0x21108d[_0x574f('0x1a')],'transfereraccountcode':_0x21108d['origtransfereraccountcode'],'transferercontext':_0x21108d[_0x574f('0x1b')],'transfererexten':_0x21108d[_0x574f('0x1c')],'transfererlinkedid':_0x21108d['origtransfererlinkedid'],'context':_0x21108d[_0x574f('0x1d')],'extension':_0x21108d[_0x574f('0x1e')],'type':_0x574f('0x6')});if(_[_0x574f('0x1f')](_0x21108d[_0x574f('0x20')])){_0x21108d=_[_0x574f('0x21')](_0x21108d,{'transfereechannel':_0x21108d[_0x574f('0x22')],'transfereecalleridnum':_0x21108d[_0x574f('0x17')],'transfereecalleridname':_0x21108d[_0x574f('0x18')],'transfereeconnectedlinenum':_0x21108d['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x21108d[_0x574f('0x23')],'transfereeaccountcode':_0x21108d[_0x574f('0x24')],'transfereecontext':_0x21108d[_0x574f('0x25')],'transfereeexten':_0x21108d['transfertargetexten'],'transfereelinkedid':_0x21108d[_0x574f('0x26')]});}writeDB(_0x21108d);}catch(_0x517df8){utils['error'](util[_0x574f('0xd')]('[%s][transfers][attendedtransfer]',_0x21108d['origtransfereruniqueid']),_0x517df8);}}; \ No newline at end of file +var _0x453d=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum'];(function(_0x22fe5c,_0x28645c){var _0x17a217=function(_0x1306f0){while(--_0x1306f0){_0x22fe5c['push'](_0x22fe5c['shift']());}};_0x17a217(++_0x28645c);}(_0x453d,0x19f));var _0xd453=function(_0x283f62,_0x14b393){_0x283f62=_0x283f62-0x0;var _0x43e7df=_0x453d[_0x283f62];return _0x43e7df;};'use strict';var _=require(_0xd453('0x0'));var util=require(_0xd453('0x1'));var utils=require(_0xd453('0x2'));function writeDB(_0x2d1de7){utils[_0xd453('0x3')](util[_0xd453('0x4')](_0xd453('0x5'),_0x2d1de7['type']===_0xd453('0x6')?_0x2d1de7[_0xd453('0x7')]:_0x2d1de7[_0xd453('0x8')],_0x2d1de7[_0xd453('0x9')]));utils[_0xd453('0xa')]('CreateVoiceTransferReport',_0x2d1de7);}exports['blindtransfer']=function(_0x545138){try{utils['debug'](util[_0xd453('0x4')](_0xd453('0xb'),_0x545138[_0xd453('0x8')]),_0x545138);utils[_0xd453('0x3')](util['format'](_0xd453('0xc'),_0x545138['uniqueid'],_0x545138[_0xd453('0xd')],_0x545138['transferercalleridname'],_0x545138[_0xd453('0xe')],_0x545138[_0xd453('0xf')]));_0x545138[_0xd453('0x9')]=_0xd453('0x10');writeDB(_0x545138);}catch(_0x347d34){utils[_0xd453('0x11')](util[_0xd453('0x4')]('[%s][transfers][blindtransfer]',_0x545138[_0xd453('0x8')]),_0x347d34);}};exports[_0xd453('0x12')]=function(_0x47cc1c){try{utils['debug'](util[_0xd453('0x4')](_0xd453('0x13'),_0x47cc1c['origtransfereruniqueid']),_0x47cc1c);utils[_0xd453('0x3')](util['format'](_0xd453('0x14'),_0x47cc1c[_0xd453('0x7')],_0x47cc1c['origtransferercalleridnum'],_0x47cc1c[_0xd453('0x15')],_0x47cc1c[_0xd453('0x16')],_0x47cc1c['transfertargetcalleridname']));_0x47cc1c=_['assign'](_0x47cc1c,{'transfererchannel':_0x47cc1c[_0xd453('0x17')],'transferercalleridnum':_0x47cc1c['origtransferercalleridnum'],'transferercalleridname':_0x47cc1c['origtransferercalleridname'],'transfererconnectedlinenum':_0x47cc1c[_0xd453('0x18')],'transfererconnectedlinename':_0x47cc1c[_0xd453('0x19')],'transfereraccountcode':_0x47cc1c[_0xd453('0x1a')],'transferercontext':_0x47cc1c[_0xd453('0x1b')],'transfererexten':_0x47cc1c['secondtransfererexten'],'transfererlinkedid':_0x47cc1c['origtransfererlinkedid'],'context':_0x47cc1c[_0xd453('0x1c')],'extension':_0x47cc1c[_0xd453('0x1d')],'type':_0xd453('0x6')});if(_[_0xd453('0x1e')](_0x47cc1c[_0xd453('0x1f')])){_0x47cc1c=_['assign'](_0x47cc1c,{'transfereechannel':_0x47cc1c[_0xd453('0x20')],'transfereecalleridnum':_0x47cc1c[_0xd453('0x16')],'transfereecalleridname':_0x47cc1c[_0xd453('0x21')],'transfereeconnectedlinenum':_0x47cc1c[_0xd453('0x22')],'transfereeconnectedlinename':_0x47cc1c[_0xd453('0x23')],'transfereeaccountcode':_0x47cc1c[_0xd453('0x24')],'transfereecontext':_0x47cc1c[_0xd453('0x25')],'transfereeexten':_0x47cc1c[_0xd453('0x26')],'transfereelinkedid':_0x47cc1c[_0xd453('0x27')]});}writeDB(_0x47cc1c);}catch(_0x24f966){utils[_0xd453('0x11')](util[_0xd453('0x4')](_0xd453('0x13'),_0x47cc1c[_0xd453('0x7')]),_0x24f966);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e8fb307..8323aa2 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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb10b,0x12a));var _0xbb10=function(_0x39c684,_0x1e0093){_0x39c684=_0x39c684-0x0;var _0x3da800=_0xb10b[_0x39c684];return _0x3da800;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x479722,_0x231cef){var _0x2310fe=function(_0xd96529){while(--_0xd96529){_0x479722['push'](_0x479722['shift']());}};_0x2310fe(++_0x231cef);}(_0x7a54,0x106));var _0x47a5=function(_0x50e77a,_0x50b66a){_0x50e77a=_0x50e77a-0x0;var _0x28bca6=_0x7a54[_0x50e77a];return _0x28bca6;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file